From 52a1d41cd272c92d9a38d12ef797bc05e19e231a Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Sun, 15 Mar 2020 20:51:29 -0400 Subject: [PATCH 001/143] Gramatica lalr(1) de Cool definida (Pendiente a cambios) --- .gitignore | 3 + __pycache__/nonterminals.cpython-37.pyc | Bin 0 -> 863 bytes __pycache__/productions.cpython-37.pyc | Bin 0 -> 2340 bytes __pycache__/terminals.cpython-37.pyc | Bin 0 -> 1406 bytes cmp/__init__.py | 0 cmp/__pycache__/__init__.cpython-36.pyc | Bin 0 -> 145 bytes cmp/__pycache__/__init__.cpython-37.pyc | Bin 0 -> 149 bytes cmp/__pycache__/ast.cpython-37.pyc | Bin 0 -> 3162 bytes cmp/__pycache__/automata.cpython-36.pyc | Bin 0 -> 7850 bytes cmp/__pycache__/automata.cpython-37.pyc | Bin 0 -> 7888 bytes cmp/__pycache__/pycompiler.cpython-36.pyc | Bin 0 -> 16363 bytes cmp/__pycache__/pycompiler.cpython-37.pyc | Bin 0 -> 16739 bytes cmp/__pycache__/utils.cpython-36.pyc | Bin 0 -> 9536 bytes cmp/__pycache__/utils.cpython-37.pyc | Bin 0 -> 9679 bytes cmp/__pycache__/visitor.cpython-37.pyc | Bin 0 -> 2310 bytes cmp/ast.py | 66 +++ cmp/automata.py | 212 +++++++ cmp/cil.py | 266 +++++++++ cmp/grammalyzer/__init__.py | 4 + .../__pycache__/__init__.cpython-37.pyc | Bin 0 -> 507 bytes .../__pycache__/automatas.cpython-37.pyc | Bin 0 -> 5663 bytes .../__pycache__/cleaner.cpython-37.pyc | Bin 0 -> 6177 bytes .../__pycache__/dtree.cpython-37.pyc | Bin 0 -> 3791 bytes .../firsts_follows_tools.cpython-37.pyc | Bin 0 -> 1689 bytes .../__pycache__/lexer.cpython-37.pyc | Bin 0 -> 2403 bytes .../__pycache__/parsing.cpython-37.pyc | Bin 0 -> 7847 bytes .../__pycache__/tools.cpython-37.pyc | Bin 0 -> 1674 bytes .../__pycache__/utils.cpython-37.pyc | Bin 0 -> 1646 bytes cmp/grammalyzer/automatas.py | 209 +++++++ cmp/grammalyzer/cleaner.py | 268 +++++++++ cmp/grammalyzer/conflict/__init__.py | 2 + cmp/grammalyzer/conflict/llconflict.py | 142 +++++ cmp/grammalyzer/conflict/lrconflict.py | 195 +++++++ cmp/grammalyzer/dtree.py | 105 ++++ cmp/grammalyzer/lexer.py | 65 +++ cmp/grammalyzer/parsing.py | 260 +++++++++ cmp/grammalyzer/utils.py | 93 ++++ cmp/pycompiler.py | 522 ++++++++++++++++++ cmp/regex/__init__.py | 3 + cmp/regex/__pycache__/__init__.cpython-37.pyc | Bin 0 -> 272 bytes cmp/regex/__pycache__/ast.cpython-37.pyc | Bin 0 -> 4799 bytes cmp/regex/__pycache__/automata.cpython-37.pyc | Bin 0 -> 10003 bytes cmp/regex/__pycache__/regex.cpython-37.pyc | Bin 0 -> 29214 bytes cmp/regex/__pycache__/utils.cpython-37.pyc | Bin 0 -> 4968 bytes cmp/regex/ast.py | 104 ++++ cmp/regex/automata.py | 297 ++++++++++ cmp/regex/regex.py | 435 +++++++++++++++ cmp/regex/utils.py | 196 +++++++ cmp/semantic.py | 223 ++++++++ cmp/utils.py | 236 ++++++++ cmp/visitor.py | 85 +++ main.py | 21 + nonterminals.py | 24 + productions.py | 108 ++++ productions.txt | 60 ++ terminals.py | 65 +++ 56 files changed, 4269 insertions(+) create mode 100644 .gitignore create mode 100644 __pycache__/nonterminals.cpython-37.pyc create mode 100644 __pycache__/productions.cpython-37.pyc create mode 100644 __pycache__/terminals.cpython-37.pyc create mode 100755 cmp/__init__.py create mode 100755 cmp/__pycache__/__init__.cpython-36.pyc create mode 100644 cmp/__pycache__/__init__.cpython-37.pyc create mode 100644 cmp/__pycache__/ast.cpython-37.pyc create mode 100755 cmp/__pycache__/automata.cpython-36.pyc create mode 100644 cmp/__pycache__/automata.cpython-37.pyc create mode 100755 cmp/__pycache__/pycompiler.cpython-36.pyc create mode 100644 cmp/__pycache__/pycompiler.cpython-37.pyc create mode 100755 cmp/__pycache__/utils.cpython-36.pyc create mode 100644 cmp/__pycache__/utils.cpython-37.pyc create mode 100644 cmp/__pycache__/visitor.cpython-37.pyc create mode 100755 cmp/ast.py create mode 100755 cmp/automata.py create mode 100755 cmp/cil.py create mode 100755 cmp/grammalyzer/__init__.py create mode 100644 cmp/grammalyzer/__pycache__/__init__.cpython-37.pyc create mode 100644 cmp/grammalyzer/__pycache__/automatas.cpython-37.pyc create mode 100644 cmp/grammalyzer/__pycache__/cleaner.cpython-37.pyc create mode 100644 cmp/grammalyzer/__pycache__/dtree.cpython-37.pyc create mode 100644 cmp/grammalyzer/__pycache__/firsts_follows_tools.cpython-37.pyc create mode 100644 cmp/grammalyzer/__pycache__/lexer.cpython-37.pyc create mode 100644 cmp/grammalyzer/__pycache__/parsing.cpython-37.pyc create mode 100644 cmp/grammalyzer/__pycache__/tools.cpython-37.pyc create mode 100644 cmp/grammalyzer/__pycache__/utils.cpython-37.pyc create mode 100644 cmp/grammalyzer/automatas.py create mode 100644 cmp/grammalyzer/cleaner.py create mode 100644 cmp/grammalyzer/conflict/__init__.py create mode 100644 cmp/grammalyzer/conflict/llconflict.py create mode 100644 cmp/grammalyzer/conflict/lrconflict.py create mode 100755 cmp/grammalyzer/dtree.py create mode 100644 cmp/grammalyzer/lexer.py create mode 100755 cmp/grammalyzer/parsing.py create mode 100644 cmp/grammalyzer/utils.py create mode 100755 cmp/pycompiler.py create mode 100644 cmp/regex/__init__.py create mode 100644 cmp/regex/__pycache__/__init__.cpython-37.pyc create mode 100644 cmp/regex/__pycache__/ast.cpython-37.pyc create mode 100644 cmp/regex/__pycache__/automata.cpython-37.pyc create mode 100644 cmp/regex/__pycache__/regex.cpython-37.pyc create mode 100644 cmp/regex/__pycache__/utils.cpython-37.pyc create mode 100644 cmp/regex/ast.py create mode 100644 cmp/regex/automata.py create mode 100644 cmp/regex/regex.py create mode 100644 cmp/regex/utils.py create mode 100755 cmp/semantic.py create mode 100755 cmp/utils.py create mode 100755 cmp/visitor.py create mode 100644 main.py create mode 100644 nonterminals.py create mode 100644 productions.py create mode 100644 productions.txt create mode 100644 terminals.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..c9b5915e6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.idea +.vscode +resources \ No newline at end of file diff --git a/__pycache__/nonterminals.cpython-37.pyc b/__pycache__/nonterminals.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a2e04955a97febc89dd3e631d837c2c7960f6e04 GIT binary patch literal 863 zcma*ky^hmB5C?GEabi1ma^D{`bQD1fmZ%Zpa!0O#Q>2_ITp+Ez8_wLW*IKVn#4QyC z?*JvQ!Xs=66|X?W>?Egaapcj@Yt3Z;>)B{Dbm02(vwHue=QzLZ!~Nw0Ucue`fpIN+>|`GEKK7_bd({8xWj^!1^=SXQoAprx&;S*H0#pbJQ4uIY4M9Ux42n?+ zC_#-tBh(l)M(u!hP`jXA)E;OLwGY}y9e@r{hoD2$5$FhY3_3=gfKKS?(wRK^138_E zYl2Hfgdi#lY9&8_uP3m#MiZr%YmrOdMFl5KGi{i@CuOTHSuvtp#iqP$bQTeZ$Z+bpIGrYWLJS-~{YZ2G&=s;vsUI4ub0UCch!YTMdH zxuol`Sz7&N*I4d3T=F%r7$6EK$it)SCi9hT!{Kvy|$etXG(dH z-nf@pd?l-E=qxM3O|aM;feFuTCbFj z6JI>Ug;5X}yOa4g?Ky-s!`BdM+ZWCtt9>>;*6bKlOK!R8np6HlPU#tGwZdgDC4D{JJw2_Sp5almSySlO`pf;3Vil{P zr>v!{OKQ*{YN$a|QimC$jylXr)}+0LHJGDu4eQV%)`{(u^C=fnc2X{;T#{_SGO>XT zSdnbP6=D;cu$uB}$~DOuxJI188CXxrBxm6|aTaIcM#`I#bFe|2!#TJm*@D}|7PjCc z$u?{f+t`L~$~!6Vrrb)|OSzr0FF6k%6X$Urb|e?z6XF6cz^5rcOZmBE2fiS7umfL8 zF2YyDMO=ihQ{IzY0#TnOT!LN6W!O6{ye;@|a0Rd6>dDm$^+HvZ*H?x7MER-B*T`}W z*Ao5P!Y^|#6mL zJ;QI&+*`s*aqX81>_1n!_x}~0*;QlpPPY*2&wkiBF#G`hxc=;6Hi&f7HiDoRU^o#0 zhtYhdWr-w|t5Rg)`3TvsY=}lU_OWMMLCAiKx;dle9;0uC!3SLHMi~0m;W$LL8)*)P z#~zThd?{kyr*p}YP0%f1_v9K;D-+pXkKyZ)AFYyVlXX)MO8C%&^PVtKwwuy8GJM17 zouL_e{)ar5FF9?oY@w(|;$$(M!rPvCDnk!t0xUd6H@7I-0p^B7E4udT*s?Kkwmol@ zvyME^j+OzbsJ;2499uen~B6hb#WXCyy7TF6AU z$Aa-;qV43g`%`t!Ij7aKX|ofF-DM&APBc~Yq=J{Ex-Q=A4jUR~7$t+g9Pm=2vVt>@ zYAFW1WQ3j*Ro*Z`u2Jzr%d{~rSU}_)9*!}6-8jbUzsJC}ypUN7ahCEpP1A24Jy=dYKu0R#N3kE#M)rs7?wL2eBZsz zb+K=jOV#E}rZd_;qQl}C_IZTNk`eFUhy|nEF>r)#u~G#PEVrnuwMxE56+|92^Yd@`xHLjEgq9 zvHC3~=X)@gtrf)TC@%R(xm837MEg+=)O1`kJ$GnZ)WT)+1>KOm7KBEK10YpgmU3LO zLUjIA{FbPic>TB2KlU8#pW1kaexDXP7c~g_2j_Gtx_y(bf&OT^{PyTP*7h7q$Hx0A z1qlA2m!{4Yw1TE)kD8N(zD&>bPtR$DHJLY^o#>|ilgJa#>6~IsolzTVTdj~zNDXyS F{U1fYp1lA7 literal 0 HcmV?d00001 diff --git a/__pycache__/terminals.cpython-37.pyc b/__pycache__/terminals.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b2ba4744c456403a98c7aac6d409fb6c1ead3e72 GIT binary patch literal 1406 zcmZwH%Wl&^6b4{VVkfDaw51nry#a-`>CLR6po$GUREaLoEQnnDxUuSZ%-C&|B6t?M zb}NAsPrh+xjy>m0@~+pj4IHno7VZvuvo#nudC;E;PgHL9?tG zXpS`t-DAx`^Q?Q&0&5;xWGz5TtVQTPYYBS5x(_{MJ%Apu9zu^rN?GuBgRgY^u0&f0)pu%1JktQXK0YZKaLZ9#q3HnhX)L%XaU zXpglE?X&iv1J*v|_y-@2zVoN7ZC~VKCvSv)Zf28&@>ZJZFh0xMVVuz!>AZcaR77rE zh_8kCR*3CF^b4_vM4Abr%VtCw#>Ue0T#Pa)bv@ZoLEemMEL&lEsrUi)1?5)YB2wO@ z*e}FxA@+3x%P53Xh(kQcn?m6I9Wzz-q5o2LV}*t2Q5a)dF5b(jld31}(5E;HgOIeG zDpx;<-4V%7H9}j6tno`QbQ_KAs)XXfsdl|{%4E-rR7!Q%REevxfU>nbH5$2j(^r{n zxmv4JSK8TF4HAX4rqWJn6b?KUsaV<(1=*k+G?vpkJR4S>-Z@RiO8bMGq|Q~{D!J0G zuLQDNxlHzLkCR@H3qn~3y(vOHjf+wDxG2+ANEGMJz3xQkV%3wlX!X5RAnO2S5ofAs zH^sbt#0*8feJn2S?MxIITO_(jrG*OO!%Q>ex9NwM*g%B6W|b{Ti@sdAk+hNcB%%?@ zDqGkA1C{(V^hR01vMC&As7Bgvrb}p6y2p)q77+?f49Dul(1xTbY1T$zd`mJOr0tq9CUv~N#`MIh3**U3Y zsYUt$MfsJf$tC&4`T>tjYlLd literal 0 HcmV?d00001 diff --git a/cmp/__pycache__/__init__.cpython-37.pyc b/cmp/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6376b86b689ed7af1d5b227d6d75f1f98856b7ff GIT binary patch literal 149 zcmZ?b<>g`kf<>K!yVl7qb9~6oz01O-8?!3`HPe1o6vGKO;XkRX;l? zwJfzrKcFbTGBvp*zgRz@vLquvPv5;LF*i4{NWn2LF{iQ$s3JMHKtDb{GcU6wK3=b& V@)n0pZhlH>PO2Tq+|NMF005cdB)tFt literal 0 HcmV?d00001 diff --git a/cmp/__pycache__/ast.cpython-37.pyc b/cmp/__pycache__/ast.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e53e26a0657c368bceda831c9fadfab6f143f270 GIT binary patch literal 3162 zcmb7GO>f&a7$)^)*>T!5>Dun2n>Sz|-bcLC4nr4YErwzjBS5hojG=;SDvdMQ$|$vK z4EM4GNO#|@D3BcYj|N?L>Up=G_B@m&D{i_j0!WDz$@h8Q_u)(4TwZPnJWmdyyMK8? z{LM!3IQZB^N$#RjLdi&sWKT+QTPRD}heFv0R?kAqQ7&3;XdT!+8*NY3(5{)bgSM~g zXxB~K4eihg-ECVn)Y75sc}m_9?dEgX5ZwXm;<50tiIQAK6^fozqGu_otV7YWm5o_W z=5%8f4kQNf;hW_aN&UUTV`wBIQ@RK7los6oQCQevZP2q3&$yct0GZanjk^Pj}*RXAs9xXE569^pkXbZ$Ib%Y?OF{OJOy9|Yt6C=7zE5d@=HJ&5?-41!-C^rQTbu3@ghP^l0Up}8ufVV3u$ zX`kCwjc?O1Q6OVhY+vLeg8A~Mn%j)!Rw(Ax$3 zwYjDB;y-+#ea@}3;%L3hYQCQNGIW>lgTo5CY@ecQqhpf;K0)=eGL!>_Kx4{P-k~_4 z#%dtsXZ0V(eZ7A^4>)6lvT(sg*sDM`Xi0Lry9{3MH06Ubj;;QMRSN zgx8{_74%&}$q8GNOLM|Aq}_Jy%wQWj%_Qxo!@(%Tc2b&)RSe8UZ~;G95<1zJzU@1j z?Ey;p5alMyd4}{!R zywNsd9fLv(~W%jYH*g=U#w zGAHfdOBO)=VTLhYx41H0j!%jnpR5~j692h@fAK4RC^hBhpF5ZyYi`cW?dEV zv`Kus_7r!DtK!6Z>`d*axKm6WjNmEnc3;T)r14V_+z21->5bNNn#p7X$7($Y22npr zf*?;gZ{m+}M%&G|rb(mMINt7$lb$=+8AfV>vF5BVQSxnIU6HG@WI-jBEVj^CWTEV5 zzbggS}W(OsbpO!bt6xzNjm5kL#zK??Al8GHu;YE7)KTTs{>DK8CG z$!W&oEI{9&f2KFw)QplAUW;c+Rx_fDb)u2t&VjPz7;(NQed*bF~s1Rh%r^PSEsQ5)(Im-|DWmqm%mS?7$ z<@jq?JgGn8+*)r5_t<>rB89xincVP;);Kt4LX)RBFJ%F9dFhf$KE)OV-hD5f^9+`CNd@=Pe@o0MsXNoO~zBbyE8kl zt?qSpmL5P^BX1-Ui3kb7fde-#+&Ca1gg799Q2v0r!X+Fz=0N!Us-}BqCleFIjJmp} zo?m^B-}luwUszZu{pyMLul@eGD_dsx98S`^kw0uQ*&h?i+FodTyd)52Ux*bZL-WhJ}OV+iT{Nnaxjy##CR=# z&65Qg+!R>h2{|WAsQGeUma%3*F31YrfjlA?@h-|c$p5|(?PwA`ii{U)EAV`4Gx9TdFUkAm z19%^mXXS%L1Nh+DX7I*v04?{ixY*H*!i`i3h4dt^7)N^ zH#)!BiEc#d{5Ms97&ViAeEyrmWTW3Z|DtMiyA5^vnO>ta+{K7ycW}P3o%Fknq;YOA z)ZwL0qkCO8E*H5W9%r{=NII8w=%CqB%}&(he*EyAlXw9?Qjt1!Cv{PZ7Rar;iMPkM zFIg5+4`q=0D2vjuM+tQy=E-$otp(cje4-k?xRtc}y%?vA5`8op#H~)hS3lH~G}iUp zT3>RohH5c!_MDN|E2n7L4Ae;;H1*nG&7KfoL)!&|#GWgh zopbo*wf#NkIp^Bxk-xK&`lv093TdHT05jdx+w+98_0m;m>+)4+=Oo4lGe@+qVr9$F zqAG(L?KPy-^YuD72o9-wUCpyOxY6irN3mW&dp&2LT0mblPGcL|H6~k~oIYL@9YecM$qI=A~nZz999v`>2hcPWS znhzQ7p0r$?Jv1ka!}%C)K8*^=8o4`XQvnq|H3AlZNN)|C{iXXZdhi>j!P-{&s*}K3 zNcSettZ&>v+B~DbUx2^*-DYkktr6O|&l#oiR9RW;gQB>UBBU9AoOuD@b zQB?P;P?XUWTNEMj32ueQ$t6mV$RY2a_+cfQhy-%m6Vnod0(y`#>}2Gp9!lUp%3$X= zX`ud*1_ZuQQF_vcl#A^G^ew>ETkDH@8tRAFu&=2$(4Jo0en3jyLxT(KcRDYb< zyD+IOX7BmbZ->@y0jOa*Zww;HYP}`&&#`}0P77)Igfp7QUZr#nBLUA_HNfsg0ILTR z3jPn>Q}=;a>I{p+f>kv3i+D1{t6EVe{kn|c)w*y{0Nv&c{mX?+DN=-2xC}vN17f+h zY;6II3}IOAd)`)M%fDjxhs@~;089sT8FV^K9Bcy^-RySo{qH1ZvvLyu zXJefp>@ZD+VJ~LX_)c|R-H%_2JLp2PJ?KR0LDs!Ne_#Rb0rsC|amoy8^<=c8?nS-2 zV3C;-f-Yu8%xFXmiI})N#r+kq639EW%+fiIN+NQ?PJ2Py7zuWq0@3Y~{$!lSWH+Q6u7g6zk60&dwu@ z8`}U-1G+9vl>u5CvB{o0^7frJjFX13wTKAgB6ZDoXWv=|IQ;BS z++0l!2jQ!zq*_R5EhS<3N)-CAbg2XDFbeuQR~swn7`)e1zgzFEH70B)A6`Y!i70bD zvP*JeEimC{Y_-JeHU_$YxThN{2Da5=&BI!?(mJ9hC`f_`O7yHU1bx+7Z}lv2uVAnx zd`vDW)nP`AF;coK$Mpf;gzw`J`3injL>6#ngAdscg-QX(ODHD90I^Q{#tab*i>YB7 zWbtW>2>TeW{1ogy!KgDshn1Y|;PXA0lc9qNq|dNHOt>bVN_`fE#FH`ptkus$PH=+z z87yRSHIS2wG+W-ROq;!)t?am2$arYwCi=~XGpJDp7S>Q1#|=0hkX=X*F~@4^!VF*p zo1S{Z)<&+qoH820I1h1&XH3N3IS#)-bE&{%3B)7?V;&5`FX35+N8mMV$|I2LM!bx` z497!q{Jq%>m4E>}qVis@d@;|0GIa$Wm3|XIGXNr=xCT4)wNaIPg zbtlMr^iz{{U~r!HI#F*T1`Vv~oyWRbbhMXr2WIoyLUvqZX4ABs#dyltn1SO~jNybZ z9$qqziQQATr!8j<`9!mSmTNJd0#@P4@7Km-Kqq;fnWljrC+5Qipq+Ql+;jF;yqejq z2+3J!ZtkeGwAnjqzt`wSZ=yfjvShbpa}NJh!2C#*quB?TI&u?pdy!((jaL%)E&P)1 z30@4m)ep!C#R3-3us~f#p)1eCainw2q3wH^8&hc<6P)hO zSvt{^lSvY}kKsHoSt&fqrmHF>_lh%QkO#XVdA^glnKz2e+_^GvfWipav6`> zyH@yeG_-`;tKkGx<$BD^FbE;2*XuvT)R@BHH8sFZt3&|4!;(8O?$F(k95!S#k{FY{ zNM~AidL`pjLHMPNMD+qj!GGmcPBKy5h0bXX+S|G%kp6qjN!+8|1JVGacEoH23o-9d zrYH;ZXJ|50ASxOlH}EcZGwPgsp{#56HZ++mu*kHS>@m3Z30ho4GJ=VSpG<7Fka67f zeCoZlk1PDf?KZ>FIHX?x>BMg1gjUw|vF(~1O9x9`+;g6XC||;DGQUgepl;G3pKw5C zln}Mo>pz>dr|rt^fG&%V+4C*#iJWJiKN2Q?B=Y=`fK33Mc%SF}cIN^pblXU-!A+fk zgFDGpJCQo4D;7*XHR#{My$G28> zf(<6vxtld(WVxl8;lDt8%#6@vA}DZ~2s+LrLU}BC!_Y&LpbAr$V*0`aXh4T9y?5NV z5mUC|$lJIwG9N69_=fKo_nhD|`L=h zjr{RDzU_kwFRW_!m2a*8;^+MQ?#orTRz!%nDO*YhNSrdlV-QzLDf-BYz0;CNBGvIU8llC}H2jW%dvI%o1kQB6Uhh zQfm7G7hy!!>Io@&fNt=@(7p2#TEq67(SoNCt0SI=W-yF-XyotXiab7f32V)#0tSl~ zfIqlrS1?!HR}l9$(IM$dKaWd>g9}rXkf^4rX z81_g6?TubD+Gf}LzpXB4w5wTUW)^i}FqHj7`>RYdK9enKGrGo0J%u(qK9cK^ z_Mb;-HMC&lq`j7mYd%xPMo+cJT%51Pi#F|2FnVY8_&{+RSoJq}CKR_M&LRzmE10++ zY8#5(6|1=GsxjC&2*J#9I*`DeNRAJzUd2+?P}T6NdC&C|^&QmIcUjQ)C|+CCH5RX- zm_!xW*&A#(s7s&NH{1JAXBo8!_#C{DV&^AqIdsz?7$)q56C%=l%v z1c3wM5QV^`B$Vz7VCCR%oXpMo+sWERI4+`8t<+Qzu0Hkn2GUg$$uSvC(ri({kXW*Q z1q17UPJX%(59F{I4Bseq@X1iU7b@b>|u zp(!NNp&gg>|BNwH9xm&`3Jk#TugVMjZ{;N2BG;V$wwcY609z`!< z65i&vWbz5>G}|6#@i+=yhMpsN(~a;4j8tD@`vWY_vNIg0{s0ly&?Yd9ia*cZmsot2 z#n)K8%;M`TzQMu(F*%^tSP&s6j(niVz6SG3GTq+$2y|5ViVYqmYE6SC!UtYlD zhlMZ<1N50MM%@(#CY^FfcRZ|Ogu=V4M3UA1F_)S*HuGgkRawu>Xw7V7zdXh36Z5wE*AoPif&tCfpuJ zufeM7O|DI5F%mG$GNGk&?O4Vv%yv0@f@$8Wx{Bc+{QIMiKEl~1*r)nvpE{@E-uqnM z?z4Nkqb}T*Z)SC+Fa?G`z)R14dpL+pe4Ry;vlzN?XyLzc%gpYVfl(^qioQWZqhW@_ grgehkT!rz6q&2Oga4SD>o(sMI00Y4~4*&oF literal 0 HcmV?d00001 diff --git a/cmp/__pycache__/automata.cpython-37.pyc b/cmp/__pycache__/automata.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b962df3506f510eb42617a5f8330283ed825a80b GIT binary patch literal 7888 zcmbtZO^h7Jb*}2}>FJ%F9j=xuiliu-rf6DY%Ou74hc*aCvZx=x@?)fTIW!wWL?}&QzAs~sB7Tf$6 zpz|uOBM0pI4u; z{Y7;_eHKukQ5V&VxG$+o>T|fCRF~D~abH$1sXFe@sxPQ7;(kiKtiFW%bLxh=qOM~9 z)9RXf1#ix%>*}{~KdZj1zJmMnDgsTuZc2C3W*WcQk{|$oynDD_$CZ!?smOpW=E{}2 zG=7q5+~m$*30=bIN4Ku7_q*}c%})F<)>q%v{oS~g_LHmc?xySg-qp8sv)gUz3$OK> zo!vdmXmtlyo7-u>+f18R2D>J@*=cqksOBy1^Gv8FBWZKZ%&qn{@K0k6AnVORTrZg*i94&B@~r3CEV6lq4bgQ?h@OcW zjdrh{HX1x|QbQwTX#bII^W*2!ETokdC6zzIDC4sHd4x{pE3p~r#Z>Hzq2H@!c(WPm zb3AC~AA&STQi2SJ9tb3lJSldrWMacV435NYasR?F*g2a8=q(LPS?RC@VtSc>#o>2hxy^m85?&2*%7p?7l4iNn@XAaMgtTCg><8#t9%_kY<9Ne#4O-_qadH= z@#~>p;*^q|VgfER<%exBBUYxW;v@x!9AkoBU&T`t)z4uyAtbONAZBF$fme}LxhO00 z6z)rM@1&EeiTzs?BmQ_VM2bwLNNtGCa3uHk5OvQX8Ya8l2mQ_z8m6}1OvYs8vw)IV z_;PRA?L9f6d1N2V-i1J<9?agCo!QI0HH%^Gbzj$gi@tsVJ2*j|lFS-dH+Fzan3q@sEj_s`Yb4_6Ad?d( zsK~?EgHQo@3>-l^33RmdEYtNehDQXQiOebP@ktH*B9XGX0Iu$xb99|OwLpv0d0Dhx zMTck&y`9UMgixO!!a8io%wGkq|I+(YjNlo{!roT(u1I}4gh#M1w_ymaDfCwgdznj4 z0=Nkem5KY+A#*at*W^cD1 z3x>M1VnYz^E(G*!UP2Jb{ zo(fWMl$M5u&~o%Y&~Y41WeUFS%V~~fa^DA+p)tcC^U=a1pbdBaCJXhyXCY1Du&jI) zfXn5L68SugcK#%bARmv0bATRZbC3^=SqZ7&O*yMrS@E)9v#ftLws&bd)cb*Ky^7S9h#T`wbPt&voIlV1`>W z;BVEof;(=1@SM&8hUpkDYn>*MgKofTxBA_|t=9;fx)F-K{~g7ARe|FFSy{&ro5aZy z?Cl(zK-A~;Wjtx_U`pxspcCsl`~ILma0c%49Dj+;XY8bQPsKZ$Zlb>6EHh1}Dd$Se z_(Z2B8a*ePw$GGl)S;#prYSpDinT9S(rksP2|6Hmm>%Zwy9U_h0 z*)|ZZ?0ZB1Kpa9jsTf;}h&gUxq;weC808B;@P6P8gJEeH9*8V}dIXOdVbd%}86uN? ziQuku(?%Tu%~78tyfUD@-@0!}I>kE5y`N5Wb2+ zYNUeHk`s=uv_cqCeTH#pZXM1RWC!Bsu_m_;^flIW;r+3Z;HmVN(8RcM!e4gsIpGAysGpmKoUayI z!O|SOg-o4o<&cG!2aywyIc|Sk!Q;M#D_KP|iW_h|_!Fso#2hP`2Q`2aZ2J0#t~VT| ztBgi4&qrM1TNMd*PG`Xe)ujfHB@w`vta>mkzlm!Z9)XG3lt&=dtqrC*u@sL;@egJT z^sL~^612@zj7;q-j-a0wM$DouUH&KJra;T;nnmkV^lYY+Vr<+SL+ko)jMlNj`Nr?W zy|EZHbgK6X;A*-TO@cK`Ob;G!B>XF6BBh3iA2v%sppsMc3=L+CYGw2j>(TD-*MK zG(oS~jdw69-?HMiNT4!smn_C8Gark9*ey&vOAd1shH`YRuj z5}FNkp4jQzXiV+3B#AZizfYtwCWMQGC7dFQ@$oLh+Jq`8Y7PolCPIt^2M0`d%{Nc-ijf*Ok^F-7tqTSn`1jgyP$~;b7SB@ zi{5DbFjhYUZf{&h+f5dRN#Cw$4cyPac>jF8_);R&w&Nanb2ebZ$y zJLj9f>0fC-V$_z6LVNYSxVN?q%Z{Z=E{HHdxFsA5MF!(`6A21s*Hd1zV*#%urHqY zkHus8*n8}+2DWG%J@F2_1NeN&l_jhURgjkX2CGp{em|gJKcE#{STWu^-&yL&>2AyWRm&QA(Rd8oD16y!3rB3rf+%cv1+A3W);dk9Be^*~H zURzm#GZE`aEHs+ZU|0216Rfc6$gs{;bm!T#4(b*G+WE0si%swbS|_0;$0xt75)-h3 zY~|GW$lg$~k#D)0OUcTeljFig=nX*qTU=v;TalMhgG2r$FF|Z0xp&qH?wW26){o;a z3(kZJHYZl21MB+$Rgd%o;_Bb-0~z!*HQs5NVlQU%Lp0-71$xFX&^ZiZOr@n`>%WQ6-F;&PpDmUF2 z-(!^KnKZK+8&#TUp!)*^SG%ryVMY8~9Q`(%6*j-a=3O@5VZ+4H8DdgEZ?RznI(Fn^ zLFP%zxRPsVBDq|toQV9W90gId_<|>^wQ5jZz!gNLD2hUi**|8TjzU{YnUEbiE6Wrn zu1X$`zWHS~!LqCgR*b9^YjQ>=M1f8K*=KD?0|e7MU7aPz!GjlZGXZ0pu@h06Y{lo- z=ve-tHha0d-AUV>b}v5upmD5;$Msohf{lK=2N|W=oq}pk&Vcey`7T20A^OFEs6a)) z>b?}rA_Ia|ejpuvDL|nG_8lKkgP+()dla~qR`lLDY!ZtEw#2fbrMQ18Cl)`ya`hO| zyp<3C`{R#4#<9jIr~d#DrjBR{_pgNPw%EJS(bt|zGW{dWhPpF^H*??J9mF>B&tu40 zWL%hl`7hj!grc_d(}n&c^y?*O15bY2D$`0oeY3yaQw}z9v&6Pj$Bs})Gd@*1ExbiG SSfd9K2Jq0Y{h@d>3jPNbqgcNH literal 0 HcmV?d00001 diff --git a/cmp/__pycache__/pycompiler.cpython-36.pyc b/cmp/__pycache__/pycompiler.cpython-36.pyc new file mode 100755 index 0000000000000000000000000000000000000000..b84e01d1023193a6ee2b5bba0bc13d3a69536fa4 GIT binary patch literal 16363 zcmc&*eQaD;R)1eJ^JYADCbnZIX_^jgvaLhv^t;ezL)tWHvs=8S3GJ@g?sVe!oOm*x zncVl>jYngU>MZT@$Fd+H@v*GLN(iwM64Jsy2<;!N5Fl2SkdTlbAR&-IMFJrKLKLCp z_dEC9H*f5*lM1nn{qFm|=iGD8`Q3BwJ@3iM$;vmL`QWYR9Odk5PE zY*7uxz#do)Yv7;+O}t|-EjWp{)Lajf(#xv3zTQ*|ZsJ8@do}Soa{0Qx{F|2YQNu^) z&)n#)hi7iK!*@b;<~7yb3|HcAbmq0q_(r#LCat9YLZ{i@?Bj`*_1>A@=1O)l|Z&EsmLaciU5)^`-uQcbX!WHHTR7DeLsRJRwZcvDeiYM#YV zq;fg@jc(gU(qjBJ-N4n%h`_)@;8D}?^&z1;FLeasj#4t3V2k+v7i-> zOE?z9!m8LLZ?4Zc=z&!#}nzf#_w$l5Kw!;$KK8er=$ErI!pHB#Wx@yV zq6Bn&$w9sDmecX$N>Je2WBEi)>fhKFm^66ZcJ^q`#J2NQTb;UnVqm{yy>)EMmG-+k zpZ}_TtN5mtLNy0sr6n~75q?OyDw@v5WfU)k*TQ-bu3}VBQCQ#TG*8zz>ruDe)yFEl z-fq@=T~%Lc2F-f(o!{ap*TpM!UYGt~S^LhnI*EYwWDa;L7@$(^Q0&BH>IHz`@M2Pk zH+tKI-^5=CvugSCyxx9naaNrc&Kq zQEFc(tXz(aJ-$x9QY@Uy8^rLDyVAP49~w?xj&jw$kt25`cYSf>sk>6#uXTcm%Q-rS zM(L!3z(Pe4b<`0SM_CBivY*s_EKaj{lm#I+nM^@tC2Y41un=7^+C0FA1a3L9JcKP` zUA|i__zzb-KrOGYV9S0)J^rHeD2zLphuYB7P9dPQfManC1#Z0|+zQ0{fY@^4oBkY+ zuN*i=@zo%!qwdE&Y5N!`)lC}((YNuu@vROTvP1l&iSx%jH^I-`7`>meh|DP`qmeUN z{U1Xe_f-yd==B_hxg3R@p8W4M@Mez4bdHEozw%i18>4w@5j72QWklc3;MNyNh+PB( zaYfsBb-cDw565YnXp#p_aufIBXD;pX1gWmkP>BNZ|7^r)c*R-z$UXtzZm37v85Qs~ z+>WZyEmkL>WB03|mub&JVXRd4kpLmJYpU}d#q(WlKhFnlpfGK}*T74MUCVwNbd`ex zK}~|MgTXZR6TwU{i+wem3=Rcz5}-{5^AO5mae^}~Vp}Q0m&wQp6fs;@#(o@9G4wJ< zvpK9X{>U63cWI;oRuXX|ZVjxrYFp@r76du4-+-yz%Dg385DQVBv-ntI-yZ6YfYe9j zv)98;c)O?0eUY`XTF>gAF#dYh8H;Dz-IZoLI=7g;0Ei&>@LeMbJEO$A(Tr}G@WX4W z>pO=)ftGhjh#+9uvv&XBE>c-Li5O()0yY6rcslu@Or69H^)!m{UcPw3eZI_E5dGD1 zw8Zt^rQ1U4JRTP3jSkgO=?O$)tMyEmcpMJ1sZ8*BwfUtVE z=tuneExaNvW^h&$=U{~S-60y~Da`*+p80$*3H6HMr>WCq+jx2KQpYoWfJ}>TBkYTV zlbZ6FkWJ!{pUyK~q4(k-s88clDAKN|E$dqX0{hm4+jin2Ox&YW8T|Y#Nu`~dSD-Y? z&JR1ZG!YEpE}-iyDl}^u3!8)6zOAvV@1Bh63*Jz#w1OAF%vx^`b{LTTe2$&Gj(yxY zhP4<`&EEPfGbebY(fEZN!F>B!0bCQ23?AV=6EeLJv>j@2gsp{s+M1S`E?DaX;ZA%= zCK`?FVT^j$8;xJgQJu|oZ1%u-!kiG%gjBwrx=;j;3%?a#*i0bXr>RnVdSkY zl0&w^^x|H_#<$2OyHh42CG73bj7UZg9ZL(Pu|^_<#2`2smXrHX`8kgLI=0j^mPs#H zYbdT}KT3eV=xr26-SctS-KOUE@({y`Kzu~RY*q2DC((~HNhx*zN3@hoaNFC%PD-Jk zx`bqR`Pn7B3Z0NBbSMCd_uH(L9YRMar93ngY8-#ubGv{|oU|0;5<3*p?xAl)r9a>+ zDS-n+0=oynarG-g!+sPv?EhhoLaqs8Mt!oe!lwx~tJX!R=qqSfs;K+Xp(gz?-y9<< zZ8Ucil}v2yM}n~ar#TWiVeR%xM}#%d>k+#0ecUmQ86S+Nu-kQ{wn=w$pw@=J3eVR- z4JD{9q1exmISl<7HY2sEVgK(MsVP{YNBv~%BW|Cwq<#SB(67A*Y#HeOJVz#{1ot>p z?>pnb(ep2|>Ye^U(~4}QUYHt-K{6;)L-oi!9Jj{}&m4ZF2aS#lr;I4(-zNj?K!osm zhCUsiF+%e`)jIpJ@6KZznWg`@0d1JBBLbe%l|=O*>Re&v{BfUk8Y6){mJweKSL3Ac z`r7pyaXNjJOmv2`{fTcz_F?PwOc~+nud(T<(7|Hh%y6=GJVueH3w(wAUpAxgzR@1MW$PTSR{r zy@v(mZATn&9&?g~E;;&g%ZXjgR9M?it6)|I2QDVZibml}Ip342qg^9X)a!(mrdh{{ z;K~?V3n_dNEcxS}+XZaWpC8|3CrDOM$?4xePWqYcj>K^pRdRfH2Q(>1n@H)1 z*H*$>M$jHlFnjXeu;M;2Ah@KKc(jinLbLe~Y!O{T_#q{kAt+P}+Jtd2`_X*QV~g&f zFhNu1f!r_oSvInnBrgluOp=d|O-W4*MB-?7af{;n_tQaz3LS1sK za6F~+tCkPo{^8(=OtRO4AZ8jnlTgK$VWohT_IT#z(}D49Uc zj*4}5NmA%BRY!a|S)qVmg!%KA)>h&@+!MM-ho}o2<1DyG@`t@7?$pwhs|Bf3VKdi5JRalR2G&}WfC#;Jk>Uxr7 z5h48#gDv$43r^6g*IB&Af=sKcC=6T|d4cy6kCNT#MDq0qDJ9NuS&naem}9A6(Y%5^ z7t|~8aEz?-t9xS7c!ip5Bo;l0lh_)Ld61lqloV&%(rYwGk6?tfV^xM#Jc%v0D)T-) zQwVzJstnnMYx)Fsim#0Hy$sn;;p(#n0H^D=_S>iP@<Xp8B?+ke4`00z)^pYdy^7*GGDo_rP^|W5{qcGXyINfE_5A&3 z*d~vc)D;}6Pq4Vm;y4ScR~peKmEJH*WQX7M5FR^ASc7IOymsvl!PGTK=3DNsMot2-LRcV1?L z=m=(Jf;fSrEdxy$nwQFkCoR9x+yWBM16B`C;V zKM%ysJ&y#lfhTKMxSl;<)bG(nZXwA_pFw#_OMUNTbh_TJ!MGpI+VWhbEQwfL@T&By z`Ro0uoQ>f*DBMZ3L1Xd>9*M$Hr4>yKtDJ0b;;wJBMTW~91!FVx>8E$-Ag4<{M{zQO zwE)o`jA|MntxK*O8u6w%yqR55A^Expm+Wj-&}3K_7qvXBYu>D=<2GD99SVQecwA5? zjwOlz>2OoByHeX%GOFz0k1H!(^2h6z?Z7r*^4Z{#TN2AUy@UrThpf}DW0<{tiM%0C z?kqbMxQ0O%*S*_EapvNBZL2WwkTY1oz=Ev7TPKh+XXD%*c!B*jeXaUtn)J@D<=~@J z;Bi*u8I~}-uen>rxYY6oMTvR~lGOc5*bEZy#cr^fF-hUM*ocQR#YFe#t%^<^_&Mhm zl0J+D@UhecmpzWwJ8!)e=IxX~l0QyFtogzk&cq`rB=FkkZGb3*DB|h^Q3vrXvNwu52Kq=&U zW*w)$nrS`ahpPPfw*IR+{iGfJJ<{g7)QP?74ag_#zs~#-vXEa=E#2eVxmqz^=B;Co9e; z?`TjmeK~r;JeYF+O}0-vHJ)7qWW%ztn%F;TTDJR@Y*ZnZu&vV0HV)XrD#G7^t=?w) z(Ah+Av=&jK)8MhoAQxd12ILl^MubdD10uK6D$e5rC4R)S>O2p$?@SG^^PFCtt}~NL z-?{Se)lBMWh|E<8Op`5UlOtin==PJiv{NAd*>-dNTF^ZAZHfU8Sp8F`;X5Uj$7KBy z%&*5vsV6!FV|b!fO{UPOYG$M_tacT?KcSu__LXJl%9WkW)OJ$*-J$MPG0Zc5rNepH znF99q5AVe&QdBPSe|qdpsIVxw_7IsBq!6s5f1tA?WX9t<8LcAj#GJ}{h_93a#V*#3 zm1f609h!_B38GQ>Gvxg!4iH67R%ZN?KY_oJKj#;#hpIFFWOYJMIN*`&N2589Eoz}K zvm)2c*Aw>e>xp~$$_rn7$#-6QeMXWFCxUsIAHnR1o*P-74CbIDhZFBIa&>l1vWjA# z05AEan>hXEYyejz%{zp8qm~^}ErE|JB`$+;7)Ih*t(kgofZcYxH*?|?Nj`=5ze`E7 zG6b`AvYAa;x>mW_axG%!&I3PIMp(bjH{|4`9O=Swwt%gaL5#)Zq3xP8aDb7|Rz^ zKx6<{1R%Zw5OfKM#`C8iz|TAcBp3OCM5{Qg6K~uxZ*(v=n0EtD_$YxYzOUg29rN;; zh>R9KJp4M=nj}b0?8Uxwy8a>CtiQDQ9)5_3#a$OUUFNNmEIx%IDTken^-wk8uxAo9 z6E3ItfW4O3=^#I}3tHF*l&OrSK-(HJS}@OIAGW74uKM;-0Hx ztFeVo6Mqd2QZ#515C4_XAmlKZK1}DDSt)l6D=G>g*z3DgDM55Fgis zZ0kQ}EWnSF#^>*57KW#Wz4Hi8*gII_fe54zELGRXyv~r0cqEu48CcRYqa5zRTxBV| zoldy^^RREGB_~zb8{QvbF6$rqRlAsbL;`H~7CfPO-Y;y^zcEZ=UYHhvn0XAR>K)wD z+B9}uF!9L~nfv#QW0=z%zI@C$=7EsNToY&1{}QUyK7J{!@V`ij&ERTXia_bDkzURKg8t&r z3Qf|BtGg<*zddxUc!7?p`krYXKuO!ZzRm<&(T2O_j1WL_Ih^nEbeqK;7VoimpT!Um z=Lcfp^+$}ZMx@bO2q|bx#~GEq36AQr&g~$UprVU)E=+RPd`vQRy#KJQ`Xb} E1D{fb4*&oF literal 0 HcmV?d00001 diff --git a/cmp/__pycache__/pycompiler.cpython-37.pyc b/cmp/__pycache__/pycompiler.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..22f71c26a64b03df3c7d82141a13c5ad5eb2c3db GIT binary patch literal 16739 zcmc&*TZ|mpS*}}mSNHUc$1}6z%R0NA#b$RLXPnC>fsNzX>$P`HmdO&EY-o~n+Fdnv zw|lzVRW%z=t0yEoj-81U8XL}CL zn2}e+x!{#N7w4i^_9{4+eAk=vs`rdNvtIV*y#+k0c!x03VqCnovvs52ZLxp;c(!m{ z!VxZ_7?~rZVT>%47!&W98*5hVY&5t0xb$Ms+}dgeYj*5}es?o=dh+i);G&1O zo;`c3zvZ93-SuDdgR`#${T;s*^~1BT>_oTvy|b-;zk9Z|H8?xiY4x`T?XDlJ4|Za= z(P;PDQKL~LC=Lq4ESkeZ3gGp$wq>#gKc0CA3_b<5Hs$ zMnR)NiV8V(!yGQ?L8NMI42>PW5OEZ9kE^Ee68MAQpwTcZHfc2GbHinGQgtl>0}Xg4 z=rX4oE-;=MnR`~S5@AI~xVmOUHqPejdUc$*(hl3bFlzQ%e!wnb_nO~}eB8$6>pKJg zauD=`HA~PD7y8jHKbV4*rsp*pB!Q6FG|Y-wv2vJ^>gkZ4L~{-4(a4HGLwn{7XoCf` z4i2G+t0|Z-w}E#Kod6jeW*ZVyZsCfJMjwb=#Zv{LRWTQ=;k;fu){ZTmCJ$1Ru$r}T zMS7e;8|ACv-ddgO}#wxs87Bx*u${d(Cm-M94U3coaos>>2k#SR?C!Wg0iZj14OlQg&Pj zw=rKqNIZwhd)uw3-S35Kwh{y+>!5^U&5X++m2NW(!JZi=h{~sNB+_TW9IoWR%0y7g zt`slqRN%XdHP=jVKC&{TjLiG?1LFm-#Mg{nD{|g|c-^yh?Kg~0;eK&sKQK+>4Tvsz z8#TcVX#-}T(WbO#eccSIkxN0~*|(kW3sL!XGr4zeTfsL+rdQy-S3HJsSBwuCyGeca z)N_s)x2^EIQQ0d|pm2P)k1Bgs80$Mi^uuTlP)jXJ+cUmwpk`aS>dAUJ=P{jqb$7(P8g z7GTXrWBpvW-)eTl^XvMZfWqocz65m(64RxnrCV|wXomq ztLwnO*=^Pa{h-!rdd*t+z2BwI?&Fmjp9^KT+TZ(5uNE6?heV*pHYBK$s)caSZAWnh ziZ|f^nPj|h5duDY7#E`LLD!FMNE_6JAw&hZMRbMIBFh(}C}`iwrlp)l-RdG!t*W_V z)tnRNam&TEgJVJ3RHfCDIb=!B85ezj_z_l2{qH3H>)rfj=p&8LBt|B@8ac@BA0dlZ-X2UBn~dG4U&>yc`Er$p}c^CJ~M2_=o@@o39yJ9b6CY_ns(L- zQ*m;@{6B!McGB)#GvNKcnO|UoTPV_*KdPIloXonLxR_<{khdtV=3#FM=Q(fLTfw>N z&wGz~tKyC>ct?Q6qoSxZ4RNky_!kMtNfZ%`b$Yrq1z%zOo}$c*WcE<*1w(j!Z346Mn1zm)hC;D06$eBOfwWkoh7 zbcSHVTNT3;2KaQK>8mPZN5FrGpDNDR*YiMEl%skm2lPHyRj(~qjBA_57|ehQbH<|5 zC$BJcvt%=Tag zIP^llkpm~cOm8=^(vIND&8BAw7oka`@msk8^Ydp1ut@|nXu`8bGFcBZ7KZ?{1$~-o ztTaZ_?s@*CWQgY)jhlXiezzKpZ{v9=HS7i$f2euGEs>a}i=SH3`o= zS4;cUwc{Ypijeqs8jWvj*c^nKcMg^s~&!10-8ph}oS2SHR!M4}_-(O+L4eZ zGm%NY{{oJXUR)9wDZ6C}kEjrdtrQum^^Y`m0Y`WS#iMIfkU~Xdj7A(g;vrg*p&5!{ zr3=0Ie65!kmCL zw&AS)5n)xa$R*RwNqvDA4K%JEsvSRqu4MS>R2`5wzRTf=acIYVsM#+}G-_xvYZZBP zWZZ|zK}3vF1xZb_p6Z$B@iaq`j)ewXW^udI6`T?R71i=5XsGpJMf~OA^2AC~y=<(N zrZR{OB+S4lVGi#Z;V+}&I~<0OK=_OX+KM{yK>vsV{=(0pNJ%~Kq&;k(VwM5v&v{}( z!lA2*={*njSdL4HZ!kuo6e$EG%zU^B^E)p2Dy9p}P8#7!IB=RD_vh?1A&13evnEqMX)$a20PKGy+Y7@8?FyO<{^$n*LGz(p|LfckIgIT$U&k;uQoA*( zbEV*?X-_dW|91Ka`)y2;oUA!Dy5jy#n8?bQu#~a;5~>d3=8LHRI~*z27BV8(r>coq z8ILSU|48gZYa=*`d#uWAjV+q)?{mZCDB%%x^?@-7s?UGa-CM)M=`6IWUR#(dh(s&P zo`p!GOmP!0lluAnd?pf#1ty#Ym5Am)!yyuYPQF&qauu+iw5@+!y9+qR_AuVA)9WWY ztB_I2-fHkP`fRat{&?1lMwem6#_G%dW)v4b(Y|>rN&-yrTrb-T3D)syHgV;mQjz}) zj>L1sF6nX>p`9+H2+k$GLQo(eY5cuH3)k zNC|goZ1nvC?2!h4_xVQ~oD}o#xxvS$K1H@s7_|5T^&Kb9cmOBQbE=9TK4}u^f3h2D z9K&??A^iXo;VHb4nh54wsk&B&FOk93ZvGEdPxoU5mqG zYq3v`j4cH~0vZU;rj`1ewuqA4*i(1Wg+2c#H|+Q-93)rBzZen&r^1qyCdT3na-)R# zksb>X|J)R{kimB8qez))vV{;$vKSZOO^(Us(3_&NHLCa=kM)m8! z#26}z!BYWl=7TfnvnAw)3!Zs!urP^iV5c2hbtkZnR>W<(6EMiJlGtRl5z8?4towy@ zvvg!5a#l>qy`;!YA{&%a$}r-1YWuX(Ot*eQkRY44&4UK68{ z;Vjo&vW6$7>>>SxB-A{C;pAY?KRz9dpMa=Z%t0{&8UMF3YncFOnKc81Bv^u`^5dDu zB^}$>)^WyZVggBvAWw}k2LvbbC=^>vbY!Cg%^@!&1iD@Hd zO&?8GWYK|-1DJ#M8OS&ehp*xSCP+z45bkUV3*({wk$o@V2=AdtohEI3yhGB|Or&;6 zdKyx@BrOf8U6PJgFR4T{#M~tX4e4Eycvi2#Ws;;bx=e_-OTrnh7gVxY{SfMpddDON zzvw;T9rqr;XVwpUCm?5@lVG^1ASw)r6w3sBZX(@C?+ia-#jYrf^%RDAmX+gJSzg0`4HH;U^~<}5WkY$!MaXyWS%odHZX2)3@ewn z2GLH9IXuI)OU+)dAE}H0zqZv6{91IY*{k(?eoZh@Q$dn-xb)`$R`6~X4B`gYSo{Ku zD=dByMJlivIg$F}=oIgl(il_6Os|F0Y?Wp* zeERw=zn0@QP*oV!kap7F1X*==YVWNv+PuEzstErp00eYGM!Sy7;9V@l4|sxCB(B7j zjVpsJu_QB{WC@-@v&+N!r!<$$$FVA#0GvDR8K$1mLW4L-plW0ibn7#V(&N%+pkIU$;Xnn{p?0_MBQgfOhdpzZS#6LjUO~>Pz0Hg`-5x|Ta-=<;>-I(U z9!=y`jn+5*IraOc~sD3|_y3ozL5q;0Y6^o^pggm0DaNCu)+|{g}Ta31JEE2clCZ z;Jbj9uMs{zH%tq>0hZUQBe!X$7rlgr>`E{CO(@yBR|p%D|ITqyJ8+P9Z9I4G9><-H z=Zm|AkpsRjbcFNooP3pX!hv#iJo6jsS@qQ<^Pfx0>;V{5_znPfMc!fiqVNrSw-}Y~ zyQAU*x}ZhLZ-2>eda?6--`mkZ5_uF#RIw6UqVe;Y3ax>T@$1$dxA~PP= z$%Gtvt8$JTHB5Iu|Enn@7LDOgr3)AJ8=bJ<%V{Uw{>OwTxB=KEzzJG-_G=j&Pd)hSN9y0V>ww}4 z$Bf+q>I($}DYHc}eQ311sB_tl>AoKZXn5ZvrGnPV8!B!uh!&I++rj5h=sA(>C=i!% z2+IrERhhv`zReMyqQ1l?qV_^wv+cE83eBRBxzG=?g&v+t32rm!Z_OmRpvlfkfrnFE z==PglC_aL+!9|bK9Fxt@wPNgeO_=K+;uAtqFZTMBkpamd*kr*qf}&{insCKsJ^pX# zwTJNu6CG>5lpL;k8sX%95RYMs*t&!xtfOEGAJ`MhfrjVEZ1CDnu4#fh$+ZZ6)Wdh7 zS>Ax>(t$4uAQIcZx?_7AW>%ViP9h@Dn{u%o2B2>9!)p`ggz6lIGikvl=o zgxuUh^KWzZBG=)hROQb_;DmowYgkR^&e8O=2?YsWrp>4%H74?=mGC_NY3NSqNe1>1 zVGODec@{LBc?Y7A*SC?6?ZFH2Aiu<9EGUyvRNVC|5Mx4^D-k@(50*4#k5fZ_3v|T%5HMZMQ8o^yyp2o#hd?u2FCDo zI_*h3<%Pa_39L6@r=$=?Rl;sUWDF<>ktL=?y|CF2@ZAq7EHt{Ra}Kz z8?{?oKE4R^f-Wm%vNG+6w}Q*85NSr_KS|h+;{rTVtt?|_y5i2ETy=}p)#|c4U!7C& z3^dU{vdaY=AqUq%mm~6xpowo*{C#X~+KzHbq!*Ku%f-FAY}-SZ4i!H~ogsQvXsGSYh}LNdMtX=qb2rk+Lz zvVdR9h_qaXv_!kCPrPw2eWS-OYm#?8N8rF0G|WQhcQHrgYa3A;^eAfB*^=$;*jyi4 zXKHV9x^MmnKRDl~a4qOmw$^FhGAIz2{oeMLA2i_`XauH_op-W<*$(<_J%Lnm+usnW zVoyQtE}E<0ZPz?%EYC5#KT;rxP(u2oqlk1I!WqC-HvGFuZ1=yiwOQh~oQDLwtbPnQy*?s2 zCxLrLym_t`?4ctBzOY9tCj}Cz666Rt=(23%kOr?2p_EZGV0H-;f%}n$80@r)uTM3^ zypSQZ5tGt8X+GqD1WxU@jsT+ii0-TTpedG{0)M}t=iHas4d);Z!GdxKn29~ZC8(FR zK!#&b+=h_$drDl0;BTR;5?~a;4`);f{#OG3wYLBHoZQ!*Xd?KPFPIU(GI8rpc)LB2 z?t#NS^sOxYQqp08BXJrAI&sD~+(8I%WQ!WCQTr$cRdHW?6ud}$v;>#>D4wNgwFsbS1!4&8CbG_cS@n+q`9&fTCpk2o}@!A%F%r3FB4zuf&+I?$g zdZs_dw`!J|rdvXpL2HB%33*KX!V^It(;G%@A*FWoKy4G!b0WGzWVdW|8Ul_{>RGwT=Z|_3XafdORJ96RqLv2uiIT` z-RZjPZnv;rP}Y4*+uAv@v~y^$7xgJ!)TJY}Uec%aoUWi(#*BGg#f&Ou%;9N4*YH&H z=MJ6qieA)9N7nj0#!u*Fj4xwW6;CJi3Z7Q*w4e(Qtj3vN028ZGh$`=!zTRtv?S3yR zKk$2@-)s3%@xej&Nxu_0ci+1gmG15a?M}bf;*#{|pmQ6SkmOtIN?Yr;R@(lF(vEhI z>~%*MbP>q7x}?jv7xX1v(eogpsH=JbBPCtai@2Bdl0Jd^oL<%^aj)nVeG2z^kbMUC zsy?gF;l7~H>sN5E=?nT*+!ysl{Tl8|x(<>qN7Xz1Uf68+eDlB$?=@7k)QSfJ&re8D zK$#cOw{hLa6|A5Mt)YFWhL&dy*@7Hwsn!~HcW!L;yZ()xj{mW5Zh)x=ek<$;H{L%8xB9&s_f50gZJPSmd(F-@VbL5xPk^WSljAQjcnex?IHRK zbfx1vPE3;%IUT=e=CCAknp!s;Q(?a#Bt@zxB*o1FUYI2`}~qy z1Rkc)ii-X|)KwG3faqDu1#Zh~aB>2-c-F%VKk|$`6#P!3LwvxqSo(rp$|;oyK1PT* zL~f@UgwvSJLq}2_JBe8dql&7i24^Rb$xWOr7FaMa+*yS=`&z z&Ct)J*$=mTW0v`zDw>n$89c&ArD#@EZJKBCRvCt5SB4>X6cIwnhH6`V!#Y%nu^6&5 z=9wMyj9{j~N43Nny%@@?m=cImtHCQ1%$l4x8ygz0U;_@}4vY?gQHl>KHRsSYj=^Vs zt7&wCOdWGmWF{q-o0MTfo@9LCQm8qU35vc1*+HdtY*VIsKP^9kiQiZ$t_h+vxMT{{L5nJ|G!X7^+z(MVNSnL0+`f#?aRqeD! z(C!6c6X8g#3ngs$f4Y{U=lM@P@7IWTdRXBkojefYIcp8|uyKNCZ?D<)Juj+wUKg=Y zhyAMOJ>6?|;y0#7&^!bUy-n=oGS6bpbBs>RyvF7do6Br?CY#sUyuoH{Nz#*(l|<2j z1Q*bhRn09I%Ed|nt%JX!wCp*CGb43>t;Om5QG>aMEdMvi^`QI=9`GEj$px1~wPEj6 zexS@hDR=^9(da{jmFC-8ZM&aXpWwX&n`OwMa0s7u2+uh}>^5|MZ0W*t1PijJh&4aK zoRT@x#cX8>VJcUa;&oV2es1?{JvVZ7W$5C09&gLISDz!`l%3|V)6bq+7+ZKwO&~@U zjQxv@)v~d9jQzJ>#QG}cE@hZ39NM5~DTl?01dCdR{jy+R&DJc+ns0_n*zLqK>zO)q zMg@6VPM(VT!t7T#`#H=pJgqMb*+<~{ef2w5&;D+FM!W`Jc&$>e*E6%GjHv)` z;R@bFGqfIG{m336u%bQ1lmG`>mz_R6cRqmJpCT%!=@0C;>rnZq1gqLbYzjYXuf7>M zJN|(LSBP}0n{kvX1`!pz&D~uD5Sg;Rn7g^@_x$}`bL$TApt-x&;C!;->dj8S)$9bf zR5r;$8<$9AT#G;jLW(Jedva1)uIxzWeZ?F5Q*?bqz&CYsKNR1c$U?4J1Rwqgo02Ecm5Rx3j z(8HMb*@!dGJh}unA7ebJIUrlD3C`nU11+9E-id`^kY<3Qc}OX!dlFvqkb%VrC<2`w zVoHcK!0R-WUPys{P64}wU!xp=jH($yIw=#X=xpM%a_yloYBu&!xgB`o0DnJ&V5fXb zU#&If%vHQL%#+M7qhaQx`z>S=5=~y>_+^flcTFGXY%(21|D1W?@91#t- zqFa*mK1mT0u%c!O*cmDwRYTM41si?S^};?~YYP9|1pNH0?98WX%uU0oylnh^bT+M#+TVZ}Ejh#1NA^J#Ig5SH8aX(%ZXs_`I~DU$ma*XE8abF_vs@^1 zRxroGoDbqTanu~Q$RClr$Qf8eQ4vpJK?B8YWH1~h@~AVsP*)nIs1WRS+Myx2!aVa1 zdQp)fZ%@Yx%>x;Us2iey7!}2<2BO)BGI%t=yMB?2svGTnUqibvhB#tluh)vLSPr!X z8E+4KkNf-(3jzkbJlkpr9vB*wlRNvUUVb@UVa6e~_FH{};@)^9og~{bi$(0+@w~yc zuba)iE(-be?p_eqpZN95@T!;VeN%7NIj8xgTRBDR2Y3_ENG-LrSdlVp*&e)-;y8nl*n(mX%EqRN)$wQ! zoDn#4*+zdtK-4Qs)lQoyxVQL_{;2i0aRs!8&*J~!3+3wsd|^pGvG8kzd|<)X2>G-! z{-~l)K!28_`FGm^gVzur876Fqc66V>SI~&K4w||IJ8kAbwKxaD z67?hdDRRWb(L~i0=vrUF$;qtjyXyb4Roz*77NwfG!%oMa8})=FdnSTp6nG zA( zUb%r8d3H`5`P4m0D*uX`k&{SwujFY(Ub309$t>|jGF^~&<{kkQ#;lB7hQjMbDb5Fm z7$!1~=LpPAjQ%CAfM=!!pTH!8aWLxiCq4x~Q$ik9#PSZVyb^+Td_O?+FU8I&B_y*% z3F)b~$gawWWqs>UCls*8$jJ}jSDIn_<4gs)Xj%p5ZsH?{XyD%vkwgPm^LS5g7UUE$ zT?(O4Hu4c@LMWN4M~hRt{B;V=g6la3+62EyJ}=?dSTU(DpXL`COl_6}?Fu@ZFOzl)4?Qs$E|}WamA*KULMdFJ{utHu`}K= zB~Ba+H9jiFIQ}jALIOm%{OO%DMowrtcZq|;w3u(lA2g;R#)>Ky#!BtqXTVS(&I3!o zU{GBA@y<)^iqIIr(3{{qK>VvjQ^7wWM=A`H{xU*IebWzF>+rmP#QK;-e8QQ8n$7v_ zbk?z(>7hwvHD!yEY5j8!;uM{qXTJ5XIWSWPLY#H2HL5d1UV6JYVtyq5 zyO4_wAoHrxSe~746Y4=clH?p}l1t8|?12(T)4+$O$|9wZF`|GeaKIA{rwGbG%(pLI0hg$Pd_sTa|A~qPXDu7col5#VDy! zi)#396#O3wPmy*9WjboK6kMeMo2$o`_~IIyZ?Rcp!%$lyaWOZ6Fw0b<^3C|`+ATV7 XvDXWB?VZZ2mBrfmrTOx?+NJ*mO(a7m literal 0 HcmV?d00001 diff --git a/cmp/__pycache__/utils.cpython-37.pyc b/cmp/__pycache__/utils.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0c51983b5685a8268d9f9532221381378227e0fb GIT binary patch literal 9679 zcmb_i+m9SqTCY=8eVLw~_INzL8*jxpYj@TjXR|9V#u$^tu~@Q`DE7v?lX#nUpPHGT z>C5<3O?IZ~e#uzaD=iYc2nmTbYd`XW_7M=gAP^vggoMOHfy4tsV#R;pCw{-LE?wPe zn@FTb=hUfl`@Zv??_Trf!a~KuuW-=$?w_8ttpDUo`g75^ff77Kr7f*GR#&a5uDxb= zoi(THuDRX9T0vR2ENyG&p{1Pzd#$LC>Y^?^RBI)DOwZ{GT4l_b*Hz4@V#XZa7IY17 zHGl5FS*z$ndhwyPHjn{sHCrof|5#~9 zyASO(M;CMv$hf+s%Xk*_E4rfRafqU>>IL+abWI<^v#b~OVLa#bl0JfGMK9~4c+TV4 z$MLM{6Z#~c3;L8kjb}}t(LaahA$?YV3C~6C;YjDA>RbI@*lhQFbK4K!sjFzQ6?X&; zKRJQ|$}B|RM!AI&ETamop?#o+R>K;y#&NKvTCLlW6ZoMiV@lnL+`#Xw%S%-Jq}kc^ zgFmrM6=Tn@T-oe*{VUrY{}bO_0a5q;R@e`&yuTlA_Ip=a{eI_4tGjb$H*9x;m7V>l z+-S6W?Xb}(5Cw9Gr7CK0G=GMbbWV%7@<+T`-a-k^qXOR6mO4-)o6o2AP(4!$XG#0F zo%kG1kmMSl-0s%sbucqx{0f!mTA9GSo^o^>a~k2E6<1;1lxfLg#r?i#r8Ev1x7E;~ku zI7Duz8HCfA%!4mdz9I)Dget0{8l0FwCO2^cAtEIReHo4P!p0Z5HS;P5KdE@h?^`>% z8TwuxRwWy}YQp^;|EhN%oR{m}X_{u&>xY}Zx%$GDezw+Udg#BqvEj^B7G(3=SvOBGd{ zzSDTCjDoyQvYk+nI|_?I2!?7)y=gsDi2$3U7>n=Jj_>q1J0`(LwM0WSVki`?K!i>W zPUi`{GC6NHHe?6E1~-T&FnR`zQhaz)a{^WUCHTy5HjPe@xsXF~;GX(Xdwsg;#^iuLjWk4itdUDCVRWB7$j+#@Akgh)kG3 zB-2YICDAxYSXY@Zp$8h0ntJ*kU_Xq%17N?912%0v;u*7{antnB32VxY$H#mzR4@gg z{_;zp#xrI^<<-S!)N0!mA{#OV;8AP50PK9D(d+jHzUem_*K&|2r6D&dlLitulLnFs zz*VRYY_p7;hGcF-5~R;Qu=`(+`?k<4Z3nu<;S9P0Zd7Rp?OqTz;UdMnP{M})r)nuS z8vcVuQ4PIy@Ot}>o*!vrP1iZL+h|zZ8RS2Haqc%p$!z{ zX^yZZYA(|)hPu?8VRe?3$LbYUKhKK#&Cu-R*h-{IY(I}h)f#YpS=HQfpegzDH0F;7BxmtG_OQg_VO(6`GW2HQ8MM{`bms^j<3a~CsA77lEjXEBGx;RK6XhW(OYU(MDWk~QB57qQ#n$JS$Y;EW3Lwv@aT^^su# zaEim?1hz-GGPo~T!kq`?pGsT$jnT_E?a@(bh>+nV&vaa$2#->wEL-7`guW+Z{D|Fw zI)+)8eTuW6Kp?|o`t*=(xWk{S?^r$i+p(2618sPT?nNfpykjzes5>g(p>^-#$My)W zA0;Y232>l%+3DL8=R@541H=jx{(*hf1ItGx$kh%!W@uV_<@Lzf_V>m8ga2LKfXC8p z8WD)7*lq6Y_$FpsGVAlXYa4#g-`g?Q-^Huwf7cqEN;X`%*6Fw4pj=;5It9zo#pDS`H{G0y1w9KoR7P-3J3L|%`-|j^PIy!+Uv$2ggWCg?M$50nW z?kW_rA{eEHfWlS083;W!)?}Fgpe_-Ph6DfXaao)CHN&&ma^e~EsI&H!gH>obxGc7YWT;# zGbkLbAznIx(W|zgZr;EKnZe|#S>8ek9-|s6Q>6$TD5z_w@(_m7+}P_tK|55?_fA3N z?U6$vhp;QEx+n1DAmrX%tM|67aj|9?BD=xeQE^AMTSq&fO=Xx_wi#%i05Qub$5h2O)Hp2;r$4gC z4V2*PsK#j#Bts;xgJg)S3rJZYHKI#+7JVc~^xQ+75^0bMRN{P8xYOVEdxPJVQ0~oU z&~AAld%PCH&|oEwwBBbN=ff2XWE!ZF{N%Oc?|D}}@SePZN}lX_A@DHbcl{OVmt7kS z6EXQ_Z@2rI*&K`KW(J-oB-aanETS=vp(nB?02Ecm5R%ZstYU?EkCkZ1v6`ee^C?P_ z3PBKE6P(965K1?Hd=d-6AP)StXzIY5TjV2VJm9*+vOsDC6oJn6EX6PS9So;&!$J!5 z3-Z&&=lXsQKz6DbzBx}Or=r4%4dm(_A=GT_qjEcFh_d@Z2Ek70mJY4f=gb8Rn~SXK zs3HVRy5B+oL81!@1kI?tWBM?z;l824%H7cTn!bsFPf!9ndF6_0mtAoL+22CRe!QU@ zC;`EaB|+QZdPh=(NDcahI7tZZhdkik%2D-Oz3pEAdp)^_Oe>M&GOffr4;fa2_q6rQ zN%RA=b%uDzvCx*VNf>Shul)!U(@Q^^hdE|A0_BfS9!IW*TTv}Bb~s2Pg9NOwSps$j zi$~SaG<(5%-*g*c{|~TF3jgE;{QRuU(33T0vBx_vVGp^*Kg{6RgUNG_8KgADATeLu z!AkQ1s~2*^ZH)eq0B9zW0boeLzUN=G=49hf(b%v? zYHyuM8nIz(BYVG!K*c_3jT~65>j+lVcEx<0g(S;ia(b3Tmc#IAB& z4-w2T+X;JCL#`8VVL=1MErczSpB3kK^|?A~`@@!Rzh@ zp?BZ+&Oxi5^ZLeXdYsd|-|@Zv{Vh2DD>z67~D`0|bVNqKT?0 z(AB>7aUYkkOq}$X(=v8@Ub#jWyVdXRT>lGhO{9v};9|NSNN2is%uM4&2n!26z+jXj zs$4ue**^m!n(EKf-7Pg(p0#_XjwnaWQ1EgBYBlH<73-FmJ|ne%eyF~S2zKP`9UD4u zQ)?r4Xg{@vu88xwyB5>~MW5>78+p;6MOOm)8i6t23#u-Ts0DBtC#~sV(#MQEIVVg$ zdC$C#>aS3Ql8AB7=g*4RWFse&S+t7?x*%ibCIJ-2q>Nm;!fQpz$p>mmR z>vjf^q@d8tdRhTlk8B6&{n)}c0(Yq5Rf*u6P0UIel*ER7s(d1*a*g4xQ2QS-oKpL% z`SWj>{_akm$k`GQK3zRU@Jj+q_!i{f#+#^O(?Kf_=*yoE5cb#_@0cD=6pU#2VvOTI zV2&ICSGe@qoijr6B1lZ(bnX&6hiMMqj=y6}LyQ?!B(!YqFST9l^76tAPZOuldu(~EUSTyRsUEsUA?4;EnAm|bnt$DCNP%>2qFL;pbx7+_dPz~EmbGKDHQOlscQl;AmHLD`z1 z12vkUkP;!YfjRjkPy823Dk+&V5b$DJXPDsyf1!?1QbpQYW literal 0 HcmV?d00001 diff --git a/cmp/__pycache__/visitor.cpython-37.pyc b/cmp/__pycache__/visitor.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..303cfda46e1cc0fdb3c89982a37a5a39641d1e78 GIT binary patch literal 2310 zcmah~O>f&q5Zw<_qG;J^6Sqy$v<3Qsf(2?NK+#?dBWMHUQm6rP6VMPem$W5Oq_U)w z+MrJkVEIy@|3EtSFYUFb{)L?SW~mRyIh4WdXtJ#HEhVp*EjsIj= zPNOP5PIMrQNOR+>jR()Ck&Y%|9!-+J+1p3G<6@HZ##!oo4YFG}dLhnsa4NpI#?^9J6_xag&k?-wiMI2@2!CtC8xC5cvxM`|s zLk`;W1B~SoUFW?GQbqo^8k7JHTa6c(RBX-{Y=mkkUP;u2k6Zdd%|=e{z`Ez6=A%|E z?y)OYwP&pIE=0LMW24R$>Nxjjyk-l*8wda|Adsl93_G<15KiB8(vv*4rHk=Bd#wQc z0{=?dFCkL%KM6YCUsl67kv=Mo7{3moFsTAZyY#YaSG5ai;u+DZp-purY??ovN6Iq~NUK6-lrm7g#XNhgBH<1ec{J<6ZoA0npi+%P`c`H;shO zNQwBo^&4lLoR&srNp9q{m)1dBgUpPSCr_C_PZO&4glFQ;5SN{q`)M)nmF6Nmi9WR52%Tk#t*|u zp-!>{UAG&CFHfS3j#(g2r-Sa1p+cB0ns7CYCkYN&rSFs9YIb96BXscKM~ssE9{1Yb zjwfvc14&4jri~ {node.__class__.__name__}' + child = self.visit(node.node, tabs + 1) + return f'{ans}\n{child}' + + @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(AtomicNode) + def visit(self, node, tabs=0): + return '\t' * tabs + f'\\__ {node.__class__.__name__}: {node.lex}' + + printer = PrintVisitor() + return (lambda ast: printer.visit(ast)) diff --git a/cmp/automata.py b/cmp/automata.py new file mode 100755 index 000000000..4d07f53c3 --- /dev/null +++ b/cmp/automata.py @@ -0,0 +1,212 @@ +try: + import pydot +except ModuleNotFoundError: + pass + + +class State: + def __init__(self, state, final=False, formatter=lambda x: str(x), shape='circle'): + self.state = state + self.final = final + self.transitions = {} + self.epsilon_transitions = set() + self.tag = None + self.formatter = formatter + self.shape = shape + + # The method name is set this way from compatibility issues. + def set_formatter(self, value, attr='formatter', visited=None): + if visited is None: + visited = set() + elif self in visited: + return + + visited.add(self) + self.__setattr__(attr, value) + for destinations in self.transitions.values(): + for node in destinations: + node.set_formatter(value, attr, visited) + for node in self.epsilon_transitions: + node.set_formatter(value, attr, visited) + return self + + def has_transition(self, symbol): + return symbol in self.transitions + + def add_transition(self, symbol, state): + try: + self.transitions[symbol].append(state) + except KeyError: + self.transitions[symbol] = [state] + return self + + def add_epsilon_transition(self, state): + self.epsilon_transitions.add(state) + return self + + def recognize(self, string): + states = self.epsilon_closure + for symbol in string: + states = self.move_by_state(symbol, *states) + states = self.epsilon_closure_by_state(*states) + + return any(s.final for s in states) + + def to_deterministic(self, formatter=lambda x: str(x)): + closure = self.epsilon_closure + start = State(tuple(closure), any(s.final for s in closure), formatter) + + closures = [closure] + states = [start] + pending = [start] + + while pending: + state = pending.pop() + symbols = {symbol for s in state.state for symbol in s.transitions} + + for symbol in symbols: + move = self.move_by_state(symbol, *state.state) + closure = self.epsilon_closure_by_state(*move) + + if closure not in closures: + new_state = State(tuple(closure), any(s.final for s in closure), formatter) + closures.append(closure) + states.append(new_state) + pending.append(new_state) + else: + index = closures.index(closure) + new_state = states[index] + + state.add_transition(symbol, new_state) + + return start + + @staticmethod + def from_nfa(nfa, get_states=False): + states = [] + for n in range(nfa.states): + state = State(n, n in nfa.finals) + states.append(state) + + for (origin, symbol), destinations in nfa.map.items(): + origin = states[origin] + origin[symbol] = [states[d] for d in destinations] + + if get_states: + return states[nfa.start], states + return states[nfa.start] + + @staticmethod + def move_by_state(symbol, *states): + return {s for state in states if state.has_transition(symbol) for s in state[symbol]} + + @staticmethod + def epsilon_closure_by_state(*states): + closure = {state for state in states} + + n = 0 + while n != len(closure): + n = len(closure) + tmp = [s for s in closure] + for s in tmp: + for epsilon_state in s.epsilon_transitions: + closure.add(epsilon_state) + return closure + + @property + def epsilon_closure(self): + return self.epsilon_closure_by_state(self) + + @property + def name(self): + return self.formatter(self.state) + + def get(self, symbol): + target = self.transitions[symbol] + assert len(target) == 1 + return target[0] + + def __getitem__(self, symbol): + if symbol == '': + return self.epsilon_transitions + try: + return self.transitions[symbol] + except KeyError: + return None + + def __setitem__(self, symbol, value): + if symbol == '': + self.epsilon_transitions = value + else: + self.transitions[symbol] = value + + def __repr__(self): + return str(self) + + def __str__(self): + return str(self.state) + + def __hash__(self): + return hash(self.state) + + def __iter__(self): + yield from self._visit() + + def _visit(self, visited=None): + if visited is None: + visited = set() + elif self in visited: + return + + visited.add(self) + yield self + + for destinations in self.transitions.values(): + for node in destinations: + yield from node._visit(visited) + for node in self.epsilon_transitions: + yield from node._visit(visited) + + def graph(self): + G = pydot.Dot(rankdir='LR', margin=0.1) + G.add_node(pydot.Node('start', shape='plaintext', label='', width=0, height=0)) + + visited = set() + + def visit(start): + ids = id(start) + if ids not in visited: + visited.add(ids) + G.add_node(pydot.Node(ids, label=start.name, shape=self.shape, style='bold' if start.final else '')) + for tran, destinations in start.transitions.items(): + for end in destinations: + visit(end) + G.add_edge(pydot.Edge(ids, id(end), label=tran, labeldistance=2)) + for end in start.epsilon_transitions: + visit(end) + G.add_edge(pydot.Edge(ids, id(end), label='ε', labeldistance=2)) + + visit(self) + G.add_edge(pydot.Edge('start', id(self), label='', style='dashed')) + + return G + + def _repr_svg_(self): + try: + return self.graph().create_svg().decode('utf8') + except: + pass + + def write_to(self, fname): + return self.graph().write_svg(fname) + + +def multiline_formatter(state): + return '\n'.join(str(item) for item in state) + + +def lr0_formatter(state): + try: + return '\n'.join(str(item)[:-2] for item in state) + except TypeError: + return str(state)[:-2] diff --git a/cmp/cil.py b/cmp/cil.py new file mode 100755 index 000000000..94752e724 --- /dev/null +++ b/cmp/cil.py @@ -0,0 +1,266 @@ +import cmp.visitor as visitor + + +class Node: + pass + + +class ProgramNode(Node): + def __init__(self, dottypes, dotdata, dotcode): + self.dottypes = dottypes + self.dotdata = dotdata + self.dotcode = dotcode + + +class TypeNode(Node): + def __init__(self, name): + self.name = name + self.attributes = [] + self.methods = [] + + +class DataNode(Node): + def __init__(self, vname, value): + self.name = vname + self.value = value + + +class FunctionNode(Node): + def __init__(self, fname, params, localvars, instructions): + self.name = fname + self.params = params + self.localvars = localvars + self.instructions = instructions + + +class ParamNode(Node): + def __init__(self, name): + self.name = name + + +class LocalNode(Node): + def __init__(self, name): + self.name = name + + +class InstructionNode(Node): + pass + + +class AssignNode(InstructionNode): + def __init__(self, dest, source): + self.dest = dest + self.source = source + + +class ArithmeticNode(InstructionNode): + def __init__(self, dest, left, right): + self.dest = dest + self.left = left + self.right = right + + +class PlusNode(ArithmeticNode): + pass + + +class MinusNode(ArithmeticNode): + pass + + +class StarNode(ArithmeticNode): + pass + + +class DivNode(ArithmeticNode): + pass + + +class GetAttribNode(InstructionNode): + pass + + +class SetAttribNode(InstructionNode): + pass + + +class GetIndexNode(InstructionNode): + pass + + +class SetIndexNode(InstructionNode): + pass + + +class AllocateNode(InstructionNode): + def __init__(self, itype, dest): + self.type = itype + self.dest = dest + + +class ArrayNode(InstructionNode): + pass + + +class TypeOfNode(InstructionNode): + def __init__(self, obj, dest): + self.obj = obj + self.dest = dest + + +class LabelNode(InstructionNode): + pass + + +class GotoNode(InstructionNode): + pass + + +class GotoIfNode(InstructionNode): + pass + + +class StaticCallNode(InstructionNode): + def __init__(self, function, dest): + self.function = function + self.dest = dest + + +class DynamicCallNode(InstructionNode): + def __init__(self, xtype, method, dest): + self.type = xtype + self.method = method + self.dest = dest + + +class ArgNode(InstructionNode): + def __init__(self, name): + self.name = name + + +class ReturnNode(InstructionNode): + def __init__(self, value=None): + self.value = value + + +class LoadNode(InstructionNode): + def __init__(self, dest, msg): + self.dest = dest + self.msg = msg + + +class LengthNode(InstructionNode): + pass + + +class ConcatNode(InstructionNode): + pass + + +class PrefixNode(InstructionNode): + pass + + +class SubstringNode(InstructionNode): + pass + + +class ToStrNode(InstructionNode): + def __init__(self, dest, ivalue): + self.dest = dest + self.ivalue = ivalue + + +class ReadNode(InstructionNode): + def __init__(self, dest): + self.dest = dest + + +class PrintNode(InstructionNode): + def __init__(self, str_addr): + self.str_addr = str_addr + + +def get_formatter(): + class PrintVisitor(object): + @visitor.on('node') + def visit(self, node): + pass + + @visitor.when(ProgramNode) + def visit(self, node): + 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): + attributes = '\n\t'.join(f'attribute {x}' for x 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): + 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(ParamNode) + def visit(self, node): + return f'PARAM {node.name}' + + @visitor.when(LocalNode) + def visit(self, node): + return f'LOCAL {node.name}' + + @visitor.when(AssignNode) + def visit(self, node): + return f'{node.dest} = {node.source}' + + @visitor.when(PlusNode) + def visit(self, node): + return f'{node.dest} = {node.left} + {node.right}' + + @visitor.when(MinusNode) + def visit(self, node): + return f'{node.dest} = {node.left} - {node.right}' + + @visitor.when(StarNode) + def visit(self, node): + return f'{node.dest} = {node.left} * {node.right}' + + @visitor.when(DivNode) + def visit(self, node): + return f'{node.dest} = {node.left} / {node.right}' + + @visitor.when(AllocateNode) + def visit(self, node): + return f'{node.dest} = ALLOCATE {node.type}' + + @visitor.when(TypeOfNode) + def visit(self, node): + return f'{node.dest} = TYPEOF {node.type}' + + @visitor.when(StaticCallNode) + def visit(self, node): + return f'{node.dest} = CALL {node.function}' + + @visitor.when(DynamicCallNode) + def visit(self, node): + return f'{node.dest} = VCALL {node.type} {node.method}' + + @visitor.when(ArgNode) + def visit(self, node): + return f'ARG {node.name}' + + @visitor.when(ReturnNode) + def visit(self, node): + return f'RETURN {node.value if node.value is not None else ""}' + + printer = PrintVisitor() + return (lambda ast: printer.visit(ast)) diff --git a/cmp/grammalyzer/__init__.py b/cmp/grammalyzer/__init__.py new file mode 100755 index 000000000..37b649957 --- /dev/null +++ b/cmp/grammalyzer/__init__.py @@ -0,0 +1,4 @@ +from .parsing import ShiftReduceParser, LL1Parser, SLR1Parser, LR1Parser, LALR1Parser +from .lexer import Lexer +from .dtree import LLDerivationTree, LRDerivationTree +from .cleaner import delete_common_prefix, delete_immediate_left_recursion, clean_grammar diff --git a/cmp/grammalyzer/__pycache__/__init__.cpython-37.pyc b/cmp/grammalyzer/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..51b330d5027a11dbc6b232fe64ca88c758074c79 GIT binary patch literal 507 zcmY*Wu};G<5RH?jY0{(=i4lo83lTf205L`owM-s}qU73I_~Po4RxK01!!KoJ;ul!J zE(OF%et!3!b$UAAL{VVrx_^<6pZb0?%}?2yT!7QEraQ}}E)9c?RW}TbD7AUs6ahl!&iA~W8RX-4bR;K@z*y&CxkkCS2DnwQ1 zD}uS$c4r4wAVMVy?Ms-qIYGImMvv>FQbJMZ3n~x`x{Hsvx6*+{y&$tIat!ngxCZ(f zxGPOE^7g!Hbs`!V(>H>*AE<5f2{beiYIwCMGTgw&Bv~qiWV?2$ s>ZDXkCMB+t?^JU4tY781s70IS=c`>exI|U0B}~k^81~e0QGl`Z~y=R literal 0 HcmV?d00001 diff --git a/cmp/grammalyzer/__pycache__/automatas.cpython-37.pyc b/cmp/grammalyzer/__pycache__/automatas.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..15b03be660a7a211193a7928a5ecf5712f04a92e GIT binary patch literal 5663 zcmb_gO^+N$8LsND>FN30*$?m9PO=ULJbZX<6B3X%j_o8)oWRD4tr$jx^?0hip4py{ zt*&)uS2a0gEs;b@WI#d)F0&UTB$N{;!-+FL0QD6vxp3r=1LAqBXJ*G6CqaSHRCRTA zRdrRp&-=Vj^`$}~VE8S+9sTroON{-UZpJ?wg$qdW`^W?nJYsEL<87;Eak{r6yY18* zQ??_w?bSS#9pOfqwqNtx*;*F&p2*x|wLthHi)&5H6Gq{$- zQ86dx@9|n$91{!T2ud^JxL6cRC{;w|8mm6`G3LXnR^nb$brmMF?d?c4qh=>uzulGX zx>BL6^2E8K!Zxn?=er$M$5VMNR3G!SYq8O7_qG*!G-a&fWOjTXbsP04t!+?S`ngE7 z8I)pyOfk(qWbZM>HQVC@-hV}NS<`%I?X!WUt(HBokvnlk+bvg~+p7GG-R6P|>z2_8c-EOqfX!lk&WWC+4M?1S{Ro_-!>~cLm-P`#jSdE&oqTM^c zK(nK%dTjTJ(JR&?dFJ%0+0^(v3gfobtfU1c4%H-fuiHz4wXmuh^(e{pWET%qv)hRi4?V(;NV2zOcQ@?Bp{lxx+eDu@$@K7~+1bEq zx1|g_D)HiU@N6f1Yuz-GdDo)HQH=YR&pnQ0<+)|ep;YAZIG!|U zz4W6i?X$rMby94~=8P=-i+Rx)FB5eovl%3=fQT9JYIGqpP}yOfznWF=+aD z(GePIGTwM>vrYbZ0NMjHD&uk)?L@Df=>v0&l*_D)z$`fY+x%-Wwec64(c6kZ}5SuZS6Gq!0Z1;yYipf9s2OQjP`T} zqxjlyWe3^*E=CTJa!0WHZ?*=3%ImBSFiKA6l)Fb;{Ohf^ck<|$L%;kD)_KZds<0Wz zzj16jXXf3x^xY0xP|H<@_Z4-H{PoAIWBrI}e^}B%tE}_;AjYk?Z?LU5ZZPc(XHvw)O?udc-KCd|C&}gZcC40fh0FErjW*C33gfNUtFwt6g`Ff9tGXPygPcRpqOvP=zKbOkMDL4(F;;w0bccE%nQ8#^WbtKp6rC-Le%a+Rc5 z7h+w>dM9quOA=?T-VT!joa%s9CE>MNNcc-h*-UW#z#Wqytsx+qIY^acM_keE$VHl3 z=57h#kukmqrww>u6)m_hC30k5K}`T>ws;=Syui!W0$RzZ(PIK)qNoXo@8G5hkoK=? z0@TYy^g{;V*?6KlZXC+OB9%CHoM1jpFFFyx;yn`1zd1XD%=)y9cUOlhaY z!TU)z>UKBlcfz_jw6mZOv^3=Y8ohl)?#HM`hH*T_?BjM-FY%ryJWKg?bdldjmU!De zL68h4FNzJjR9$lcMVlV6eB887@8omT-&py;)c*L@FW_NZLB_ZPJNi7e;~eZLFQIlq z%w)p}G2g-sD8U42!8ZMP4q=+diyPQo1xvlh`X@CT+GGcCu}y>o@&WN6NV}sTed-4I zx#h_-~9fKj*-uN{y;8hkTXWq7w4z9oGc^gObp+(^YzydL)AW(2?e3OyqN zg0WKbq>`zYOC8e0)LI63prLBHDFKy&a5Q@pHxRICqOW7Pk?}k@pJRDe5zbe%0!zMx zXA|QQWl}OxL1q@Og4wu;0(F4w5$1^WgP5raIpo4 zbN10^s|bbVkf*>**4lL}iU1<#DWg}LZ7>L`dT9i_Otqv1YMI8JdS?Udb&RTLGY-RZ zNo>O243X>{D8UiIG zq+tmJN3@jZw85^%BKIsT%30ezb2By3%}I~}0o-khP%JlZFW+n-@~o$<`t0R;6o)q_ zghyy4zWEZ8M3TUOY9PKedovac6X%sr;87Rpunajn1>A`Yu~X!c7BL%Eb*2Of*(AwL zEo2NeBUc`hC}-RBMgkGT?k{lp3Q7}zk$ol%e;#`IGi3^oPXajbZ@8`t4)OLtyL5#h zIFK+F#0qRg^$`5d2RH~QNPZ(_9F^7J6R?S^0@S(?7B22Q?LgGv2%tTP8o&Psow?8D zX`LD75M8p`*IC4t01_iV$o1dH*af7bku|%6yejFO&I?y~cw0dily9WXU$;I&T=I1R zeF6H;1;nNDW`L0wN0BM33uZPYGn-O68^kK~L98m`{WH2iE;Nc-!LXw9tyx_(GUp@6 zoO^IBZ#bvssg?GCzRZ6ob4HYQ9oH+cKy^W$z(qbu8F5W&dy0A~Q`s-Rc6mzhkOQTv zhwLX$QubBKzD5}tI1N6hs8prw8f<@BTeFf70OU1sSZiC2`Lj&C>5f@ zkv1uVHK0!T0&3(B(RYGf;w-{0tthU*b^kxu9i#gIy~FH28zDF#ERQgp`)mx~=l#1t zF`Z#D!~7u>7X~>zf1NOlR3aST=WkvBlFQRbR>26LuJT1j_)tiN^cV$f7Dp)m*Vcob zUjea2pu8lqB0#HB%d~qhJ%Hhh0~ph#o;a}2AXt?9tBB?m6XVZ7M$I5q2D9+o8K8Tn zHK!}Bc|F^jzl7jCnA7Fqf}SIU-{)KB=zy-vV1Y8dN0&Ekc+@?t@(BEbya4s<1^C<3 z@V7mK0#7~Su4U4njj zfMZmi;=|Sh_~VDhACIfYCjMCXQvUd=lTa``NtPX~ZQE@9~Z zkAziM(tFPhh+*QX{nOT!S0nTZ{xZ#(J4mT+m;GGe1*iT4 Du6@db literal 0 HcmV?d00001 diff --git a/cmp/grammalyzer/__pycache__/cleaner.cpython-37.pyc b/cmp/grammalyzer/__pycache__/cleaner.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fc4325eb3aebc2410125eba9ee281f4c8d47b123 GIT binary patch literal 6177 zcmb_gO>i7X74DwD{nes4Lbem5OiW0k;8=+r65|*X%d$*D5U$w7pt7QjcE;AMW_Nab zX6=<~HkB%wM7{(=ai9pHubgJnQEBm_*NVMX-J6xEJYSd8k6#t3h;$Yy`UP5V%iiroG{gc* zD>wVnm3__C`a0UKcv$vMWhU8JN_YJg}Xj>Szo#st}?Md;Vpmut0XzJ%l!8KnH{X$1w5FK?{pl)m!Y9Y~G z3+;L$b}j5zcwZ#?`{D!5)$eHi5=pR&_3lV1^0LKc(I^euvvSrh<1+2;8cE^D8YC!P zmHWke;ziMyELFkf_I{aV8`LT|LwQ?5BD$0Lq=Y-GU{0x3O-fj?%qx^Isxln4e$S{% zHj3|9_D!5~0p~Q;GadXdi_RgWGFk*)X>servW?%F;998sxEb1QM>)0^_)Wj%C_4xv zyRE#deglPi*zC5v$aXzDaHu_WyY;#sQd>Q2q0w&oQPZ*O&YD;El*3D32o)M!$8Lpo z>?v9|u-Cd#-LWIzcCjwji@JmLvgKmmYkBwV%u4=A}9|PW8ZRrRHn?we>iyERCk5#*)+YQcHQw@Vb{)F7VNKz9I`u z3+LLAAB3&hsxqiv!G43oq*i^Mwpg~>%5Qqn^4RvzESFYsHL>67dgJZSF6%+No=Sh& zh`nYzHJzZn?kt;YUcB!7PN@BKv~SI=hfQy8Bk-tSoI9)`hO zz1g0-#?}~YZedhC@SK*Xj-{ye`;|Z6lCgYO zUWM(u+RfsQY-kGt)+$vo)~U8FVH;xC*pcrGSN}k}BX5a!1!icj;hLiveXVyoo4xYf z6<|o8?LWGb7_N0t>_}Mol^qcSDO`XbS>KKrSl=ztxpEnG$W(Yy+!DR11X8S2`{s^J zOti?(Z!U{?C{ZF0K*k-ps!0z!TajZcuijM=6w>y$I$hsW zFbKcZ^jzPGGdmgHA>AFN<8+6QBTK}}3{DEnOtc2TH9VAPuAp;mXs-(?I+`nC%Nkq7 z5}>&Bax~CaJ=Kmrlgic9SPR`v^jXnnb1e*5!_)z+{(0%tH5gm3txkW7cGQp=V(VD0 zJ$^G2(pwF@tMTga97j(DVciL$(?^HX6}|aA#~^KckQRLk*)=-I;n6{&nfw?MfNmt( zj@U1Ls&xz;MeJVjLp$09LXVeT;$xgCUlureI6hqhBr_Z2~k70?e z<6rz3!}+|qB2`|REh}q*(P@?qYT%RL7232iAC2Bk`pEwf{{;++=wgIfl?PzVliD;)d7m}| zGcIdYZAu={)Ys5Id@qEW^p4LWMUNqi@m^qjB8K_#Q_G)Fc&f9bkXs3>__@G#hQ5Lv zf!}QV|`R&-h9!9+FtdZ98tMD=;P7mbuF8tKy_${Z0@}4n_UZwq=wZMypz1^1b z93VFuN4-!v(%DR}hRT&rFs!a-K&yU0H^-FCAe^MXA_X5_G4UT#7DmA%xbRqP18v}u zWltqiC9&M0tJQj!fGLDPujELk!=^2DtYhP481V5L(Cn2Rv8yLK@eQ;a?*h%3@_~=! z2x^ay048bK`Wt#*cB+>}@3+{+#4f+?n=a8quz`j}bNiMLF4Vi3Sl}Cn6Kl6{M}RjK z8^uOR{fT7TEhj~0I+!sicXpE^mv>pmQ3H@0&X8efjbUSi81zDBZ=ArMca0{p7MN#W&fSUK<# ziIPhL>t&oG>jlsjTiqZa?HYlUdIViPqyfl2x>u*~gQ@ojbCIS`B4ao$k~kS?j&v3< zLV~1FHdf)G9;-*u{5H}69S{G<{fA(<#6UP(Q(whAMVieR2SjvTWI@0HnPX!+Y^wNDi-W?QY%Ug{G|$*tjS4$CUKw4hQV#nyAQSJ zCC?w;J^3|)g|kS}O=N7zTd?G}5XHz|082q^v$94WI68I2thkFn*z8r> z#1%Jf2E{S`22O8y_8I%>)Al^rjMpqr#;Z-~1H#dCP;+ki7 z+d=5Ko@;~p+r&--vc`DbV;_LP@MxLEnm@Pr{nyUfC-aT7MhZ9hH&4=>wG(>*>D*%0 zduH*{x!3H$l)HNeQz7==xzurKkySOL4kl}9rmy6|Ss7VNXA2p`lg6p%DLYOX5ewET z1Pl}(+-*8fp#LXG5viA$$mnks%JLACtrgdtINuN!z1%F`ISfq7C6 zy!I1)y>|>sp`-jHRKVz)Ip8A@y;)2E;!K&30PxM+B^-fD*!O}yxtzY$dj%^4>Q`Rs z7m@;2EcOu!GemzF7ub~`%pP0$BRBywDX_EI8ZX0*Jf6@>GYE&VCc@qlt8l4NYUqPn z=MNZX=ck!QIE}MJpHdwoG8gvgKz)}k4R2}>(h{8k(oPYyHH6acgSUX!iI=0X04|3- z1_N~Nb3Nr>_g3R@br7Z9g~A`vJE3hsb?0&vyf0t)BA84H#4PL{u?u_L1Q6;3hVB(s zeG^T0N%u!uFp~}pbcDRD$;2$wQOcgCj2NdnOc~>?@hWIKCNYg+9VY~2FdgHZC608- zJEaDhdS(M`4dg8#C`-jq`Xm~Dj}+0KqC9|7g3f8c<)mdn_X$D~FlsfujM_dxtOc-D zG?2c*4L!?#r3SEMzeE{&JHxvD}k6i2@SukvbDSV=t_+IL0YV z8p)?9ME%D|vj4+IX>kA%xS^@B8yYl^T@P>n&(Zd?6*kVaG#bk$N;a8RKwVUPF$=fn z(8BJA5r8c>wVZa_Yq{z%^yM+5dX8om@U1{mP&f>E$5@V*UCFm;LAK9Xl>UMg9YH2^ z{%B*8Jz6?b9z=!ogk5UW`V9ZG4?Bux)(I%+M^6%-NzSV%Y*rIs??HTExGY*H4Orer zSuIM`CCCW%o#Kz7(Xj+i&=k;_UFd#8ck$7Mtn5dkrTq{ebD+z{)&-^nXQBvUveSy~ z@8MHd=-P-6K?`jJ#$$9PqUJF^am4O)y{^ZM1xzr`*!m~`!fy$oVez}(<~gN8mGRDb z2%oungK;e_QiM&Psns{Ai|#m6sSz`N7HyDNL=@T!Lj#D_=n9b(^)1a-(i%Rt;lmnP zhYwn>$SAW90Q3!vqil`?nLIKTVEp52=0(Of9qybKPc`v@An;CO_l((3>b2vwnOdbb MS9`ejbnU5s11VjFivR!s literal 0 HcmV?d00001 diff --git a/cmp/grammalyzer/__pycache__/dtree.cpython-37.pyc b/cmp/grammalyzer/__pycache__/dtree.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7c81bf457508ba1832cf6971cf8a2f33ad270b99 GIT binary patch literal 3791 zcmb_eO>Y}T7@nE^@OqQDp_I}VR3wBDmQW(`O$#MJsYferL3bnT*zj)4 zY$8SfkFW=JHK&2+jmv0TsR@Pfi zv#hh6cKgely4CHrI)gpzk_JjH^#?Xel6J3ck|cnrJVe8Ih~M4|j~lc!*_)CvROp|+ zafV$)XUMkM0XKpSl>Cu68@Bp=)svc})rBU3g_UHU zvr$L1uiBC_ao!-j5 z*~}81Wd>S1txhVW7a*mEnmd2+y$drG8B3V02H9cgXueOdMEr&Ia-*I3vk$eEB*Bg( zdFEdZ9&aO|6$*2&)m2Gi<0R>3a<@bM`6Riw+v*f6x(b1Mo*J@CpQ7f-VArECxG<6L za~efF4kADD+-!=8vJg&JQ1dHj%6#Hde8Z4U$S3^!vgY!MAIqm$&S9k@=j8(aBN@Ok zr)=${Yfm7MPI3rbL}$njkY0zBV94N!Q|FS6U1U*0u(!SoX#q4l*Vk}IN{O2vGuK&4 z9-(xd#P|7=O3cm&!kN>CL>Tt4)Pmb*8=1M$?RQjH^^B5Nwa)Ye@N~}f`DZY99(8j5 z6uy>@8Fi9uo~(m@9`cZQ4$gF@^?Tr|sgvzog1IrDz4%WW9BnHRPNKjyb(gPEjIZ`JotJj^!Gz?;2pA&XZ)eJ&qw}{9|ZU!9Qvk0Gcu6jBaevW!Ofw! z9j&r2KN$u1syYlDy^Qzc`(U5r8?;B?Kw50r!5pNy^+QKV_inATdl%LL6ab{sumQNS zztt3XRyTkAfy%ERfp23so0vgg*@|xUc4QlL+->R2b`P}N)@er(EmQv3pwrq=9UJ6Z zt-h+y+n_&?nX%q#X7qD#g7x}Y--@=h5pfea-THJ*XkrjYgc_G0E0&eq#PU_N_0Yx2 z@@tT7TIr6hq`O)JK-O!^+y;&ir{bqCK+;R7?zUlkkw+rr5q=l=JdgQBeo^e5SuI0M zSJslVwu~Y{sEp$47z|ERY8`^!QH4Z`-DW;B-cGDv|J?CHehL8%mXu^|gcHl@zrs9(pUNIbFPu5p3ulEF2W;5ytJ}&6_6`FDaDd zQ2mr-k=nSCa378EIyvA&@Tq5DcjUC~}o>pcymC>D3 zV(?oG28)GmUx<-6^4D4K91zHXz}E@{f)xZ^;h*7c<*xQi#&fJ9hGHB1vLo{ACV0pn zTpIe|kvG62!FH%6z5{O%o7`()Cen?`%qWBxs(8+Xhk{nY8KUq;LVHOB0$Ajpyt2+qMYoR5$^ z>s{~`&U>FurZD3?U(-yAS{8!Y3hL8BcI{~(OShN-3<$Ji*dp8$*m|0h*G8IN$GMV^ z;a9(d^=U7XrMFSXkew%QO)2vfko^u4{x`^8F}M=KcW+p1oh%sAM_ zC2ZFSw%cM{|Tla;oLPkyM!st0PHX0&pl%u)jIHMS~{kD Z`3Sbr2gNJ;3f+^%OW3PDQ+s9c{NFKV5^n$i literal 0 HcmV?d00001 diff --git a/cmp/grammalyzer/__pycache__/firsts_follows_tools.cpython-37.pyc b/cmp/grammalyzer/__pycache__/firsts_follows_tools.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ecd660df5bf223e103b04fdc244c9a9a1e060d44 GIT binary patch literal 1689 zcmYk6O>g5w7{_PEFL7)qgx#v!EeP>)X(ZGlA)%G1s$G_LS%JD0U2R(nh}_uSIP2Ky zc)BELEFlFrapv4!K-~BQoDc^-!dyA+oztH9kDX-eXr7tpW$elPe>0!7S}wu!{I?Ik zaWMK5a2KuEfQd*%Q!=6fr6gjJ@dF81WJVTxBeJ6gdNXnkNw@g|)uc<6e?QMe zm}D_Oj749+Og}c7gLWUSNMQt-k&;baNr$vFj!3p<62YFie1j7Gix52_89OG@;CCdu zG_DZMKA3Du`YHMPtv)mbFRE17QJ|$v@ga{C}P#=*MFy2WV*Jp&k|mULRn!t9)!xP z++O7bovQ04%X(!O)6r?327X;ud%qLzV>vIMYz^{Jy!9-NpT~UbfalY=FY;pRU@8WA zw)KFAqfyA;zL$mR^gC3{153YNN$)IA)BM|_C-OWkHpf$Sv!9Q~_-DN|?}urxDl_%o zzX?OA%@}oQo4U+IbEyN*M$}=vjeMW#Dm)%q6Rnc%9}E&wQb@xl>yiu!gy@uppwgI8 z3A;_sJ4a-)h8#n#U7CW<2r?!z?<4b*Wc;s)Vg3X)25K@0XbsKM*5Z{7)Y=f$nfe$t zFlqvgcY%ftG=8bk(C;*n(G}aIhD7L@jTtLl$z=1=k?s|J1i;`que|evBXWKha8N*D z>_6V?HdRx^e3W2+iy9C=%d^Lekn$i&bkP?{o)yacB0dw!`Z9Ss5X$*Ho>tscJEpur z$fI5jP1jTO0oS-IyFUoCr*YsczM?$5f9bg61)uAQSq$cxe2d&L)Y8w7rT}Bb1E6inWy2|()n6W&fT6q1*O6!*xKx+oA z4fJNEsn)w)T9u|uTF`Xmh(LX)4gHx`bel~6#DV<}8XJ>85HT_5SEy@O>e@rQbWm9- zJNX%^IWv8nzyAu#m7es54j&@#L3w}Lk*0)_XAE8o9DD>0n&9B?IS05rbUrd};hy>t zRWk-IT8mi=Hl!i_OHZ~cA`ICY`uIj2Yu2&zA-MPq?T)@Uz=jDnUg$&6ZSfAe8VzIj z(H?FI5pr=@ooW8M&fU=FCX8yv*~KX4`rc?gEcRc4#8-5U-eIn9Lf(Msw)v_aSDZBF zCz#(tDDba|Uhp+tbz2*)a1Du5*Y}PUO#-LBQ+g-CB773KHASZ}R;zECYuLQD#HPMA zK1RCOgsHjFw6wv_b#89Jb10)7WHy*)YMt@-Fk`=Ksb+sP-nE;p Zj*47odxT?^#yfhC3%w=2;jB9E{15xbo3H=? literal 0 HcmV?d00001 diff --git a/cmp/grammalyzer/__pycache__/lexer.cpython-37.pyc b/cmp/grammalyzer/__pycache__/lexer.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..83def9791397b5dbea7bdc3eec7a9755cfd329be GIT binary patch literal 2403 zcmZ`)OK%%D5GJ_~trS@{lE6*cBFO8aixuS17N}vQZHfX#VHkCgv_g`_TBH=&`;fWo zR1$W3v3ty+|G+->FY($_&b|56Z@9AJ80{|j9&$L}d^7xZWu?XN-Tgg&eXGIP-!!=R z9CV(bOf4d6pfhlsZ4Fk(v%@{o-3{e1aLp`dqTUkX(ur)_0UE9qFF1W8U|qCw9ELQj{!YB|GIMKjY|QeCnKGCUhmk z5q!Jr8AoM9vl8wdjbj;Vx^!;*MZ30`j*f~fiHa;W&1JXi7&lk((0E0(7c1>U<6lg# zpgI4#_a;kJ?;uuhmG156Y^DZ9miKmM#hWbc4YDlm4U$Q3q@yH>;@KQhF&VQlnVBFA z$LY8TLwJnkbS&dOZ}WM_+PiVFJm9p1FF^57tl>j+My%q~mjw(x=1_8i(0@m3Ugb|eFMUYgtQuuw-_x6b&l!rc5&DOlFIdS>8>M#!ejIja z1o)ioXK-|Dq>3;n_vhWfG*x<(D2q0W*p9Y)3*j?*YMP7#fa zA5A7ImEAzMA*9JH!&B2Lh*DuOn<(R1$7o`;@oS~Vv#kZbt~#`vz@uaG>!_G;`8sd$ z>!JlHJEFtqHx^)C_WKf1x;hn$=mt6k;^UZCAkjXr#B{wBK&n$YKm{mSRBl>~KrbL8 zw(YHS(RHoCwJqzBl%bmB<2ZvkI!g0#F$SmBiY$~0h$ZlQUW^CWbqz}OXH*dk`W970 ztxFa*G5i!Iw=vEG?!&r{n6H0i*%J8yAx|G6Lwl`pB|0#QRiYI8T(6ZP6_QnsLgUpl2bTu|)=JG}3*LL9Vo${GDT z>{rbFf&!?lq$QDInwZ>mtXuUB^iA^_y#2k_neH|$7UXR`PDh$7wle*urA~;rF%DIJ zK1=qp_zFzM3xA8^g9q4_ucM+^>hJ(i3B**u?_ksx^J@#xNOp-71r^a?fRevOHI*fo z{J_x?nFK*_#woNw17LR0)UQik@X|R(V*7(o;)RexIw#0P`_5AY<066j@5H_<8<22o z9G(N6L!7aT`UR5#JOVsv*5;|^w!TBxxCnUiB$b>BQKMw9)<90a&$KA{htnv-af?=0 z7_srl@carq=grNLO4W3tx4xp&=vbG{?=Rr6p*NnZjmGA?$O#ORDB#xrWsz?`WUPE8Y+g2(GdY(m6sfOYwF{Dv>n+unm^qLkc3I4b(j)TWb+8HP1&N!N;#mAC4&B}QqVOVZL5w^^ zqsfZCS5Qj4V#j%FGe!;>WXWXf8%SA)`X3w`!i#YjUh?Ns96BD64pAqc9x1v45}u}d z|C5WO*`;TxUfS-q=m|@sM1`Sgg<+D(qnP^bFg!ep;(A4|;t12G+&vy73h$z{Ia^a| zvTn7v(d3Ow*RU6|37+61w&j%N10HzoPS6ZigN~+^?QX-g@x*Q{@?TUxJWZN9D#mec e@$B1i{iaZ$+pYhl4Ro!|*dpp#mbZ~U+Rnd}Xb~d- literal 0 HcmV?d00001 diff --git a/cmp/grammalyzer/__pycache__/parsing.cpython-37.pyc b/cmp/grammalyzer/__pycache__/parsing.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e670daa71f3cc5c6599d4b2ed4c95b575b2da3dc GIT binary patch literal 7847 zcmbtZOOPAKdG4MU1_LY>``~Ix$uuk_ijj!Blv0V~6wQ$0L#9oy6p}WjsYp{GW_Ahe z0E6wBRj`{u4u(_l!BM$%@OkNjuAE#sywQAoEqcDLgfld`U8NFg*;{*?(>e} z8=QqkXvSv8@~w{T+a1Su6wZnZ9oKg|MZd_|D=f4_=W8rS_McW-3ehIB& z=%MAQ-ZI*yu#9#Yy-R2oHChJUD%xw|I@;^1y@K|c za0Bg)Xa)VN;Zt{6ee*r+g4GRaH4d{xS~t3fo%cAQOu6>puoZ_vEG`Dr*=b}+cZz&* z26<*QvLWIbG^kdZNvC(1MZs=Mq**GLC+#GTlRroQT8zDZa0%8 z-fnh!+k2wX=``Y_V~nD;wYqy-y(2*)SU^b~0N1p*!xiq-nbCT#(4f<278+k;z8RXK zg|`*jI5S6j(=%(56w^a*qHzr+-2ljW&H|PjfIK$=jgaAMzJo)z)2xw2(n*gx50Y5g zO*;CzC9O1ycf~rs7H0s^LB~El39(98oO7$&%7UPZmf94EMh(E_qa1OY8FRVTpR$EH^!cIvh$5s5N^B?4y& zoFg#du&&YO#2UadiX!WB*H)NQtoqHw`}QgE-u`g$j_2fhe*G0%rV?N8CMlx=vV2o1 zqJ|51_B6huZO@7!;ZE)CHxt9j-aeifmbyt7T%(w6|V;mCN-hh##G%p^?P7?LTm zLg;H?=j_CJM76?LYhB4-5iUNLj&>2ENR7g-_7Bo+j;y>~544jRS;!!3JcuJ{t5@C7 z3Qt>K#N{pEQ{~cOZ#-ThtFt=U)8mY$p;Xl7K0t+x&VaVV2iQ*A7?>?Ku=+pCdE30s z-u$X4q>uF z+Z~d%E#7AbFIz10_C4_qhk1jcv-kM;yG!g1^uLaRap(I!EVOf$eFW;I3H6f^^ZU=|OItBw1gFvKMcq)4 z>!v|=CuBdd3=6GCKgEBMEJ=okkBgm_#rAv zK1ee7z|4)dvBw8i$OrZw8#w*%KozVZ5Ba_&{yDcvF@}7fp>Ca6j~HZz=Qd=NG2j|gO5a*B9!Sh1yk_?6XEE_;#y6fPn3yFDG^OVNF&T{9Z zm=~3dd3mv28uEeH-^e{kOJz{P+{L^^y$9bPaoYj6%^g90N|0HqkNEyOsLK+3zsT-t z&u_+2SDL+~C%r7$kGcW*d+FUu?~Tp!(yeqS>5iM?_lPDjL%M>Zp)?AmeW$heFvBF| ztEHm|rCQR|j1+A&_odT36lo%)lN@FUC8e1qJ--a3h`QN5nq9mA0{+^Va4;h+Je?B_ zib9%=I1Yj@UUI4IiF9V;{u9ytK2QPH9@#0%H%OoyMmJ51DM)sM0N(EIurJJUF8zocXSTn z7ZBr9{=j`#=M8>QXAHila|OSovjo2!u7Teha%Cob)iz$*cRzpY<~`}$xpDo=*KSDT z)i2&`(o*Q5HNii(t2OM~Sg7N@vi~K-Q`2|mf zntWFRFE5l$SkzQDnMQzBq`$FhO&6l+Do!T5PRiP(2S!7`E90*UkAyfFQb&KVQ2hAZV?0^xqsUh(MqGr_DjPKN zQT;DuMh+H0*Du2_nF9;GrnsJ2xf$}%II(qZkXvo%Ivavdk)`z<0Ha;wOM!y98fY-Z#W|z$mbu*Fxm%e87vxrdO;@vW;<6lM<6uIz+~j zXOQxt$~F!r=@6G@nhE5%#@0p2`*W=Rpm=F7>PG#Zxcn~BBEl9s{_FzAE^stkm*ND* zCB3{gp(43gKP!mY;s$^$M#yy|fqYDmq)EFcTHQ=q?WEOJnUFMFVPD*&zVfY9r>D2F zsH3cN5WxT&~87;h))Pn^JBg!y)m zI*Z>&pZF63w*XE#b+uUD@~v(XMuO~^v|3n(EKX=E7w%)Z?YTo#I`$2Gl71RM+v!#4 zNDZX|Jt6%;jh{EF{8{Kv1y=hRV*n{XlfEA$T`cZlW+Z9~bTx$mU+GAo4d|0?MvVl~}&mO&?7 zl44+O=*&Ch(_tpz{qy3U3EvMr3~juvgH<)Eux~)#d%1n$YM-7LLBkuAjw|KNn?hj;V*$=Ww4x^Bh#zi z`BGjfu}dr;;rEU7eeB7hJsrG{7_kiVT*TTg=jD89$h%OGd@1DkVti(-y^Nhhr*U#s z?9`+Fvn;RbosM=`RXcn)r+vNyoi#(m(Yv_q$#Hv;t>AWyW?UWVZc)c6@BI&+WAD<1 z3m5Vn;PP>md>C#}YAVRw+S*c~%<kGx4x((|pzEs{hoZy@F~pbfh2|~~PF)|U7~)m*{*-8rT*}r0Yd1FN3;c*^5Oo;2 zNsLe8Da}S0>Tt(IbS$kH4nf^E3cA%2RRU`OzVmh?K8#)*y*A3yzstxe8ZAHygP zx(#amXURIlo^7g(9pZ&-n^Vx)MjbJYiL$z>&!q)G_9Tk)5G?PsNL=+Kw+9 zV$3z~u)YA?zoVoitp@i)+I^IT6*T*W) zgPHSI+^4-4+*Q|cO+h1?D3gZ{;0lUT+-c%9e@R9fFTK0B?~HH9=+Nk)H_@13Bm@pt z312{@3}K^FMRQN!-mfuce1K0+C)t|MUQV%XGHV52YmsmBHmsta*;E;jiUGw}Fyh0Q z`2NfqHfGl_%e}|$%Ad@S9%%lG=#p1JrfmwseC+ctE9Od}*pP8BW zvGd=-uK;sD-l)Tv8px?_NHIHpx7CDQE~vdzUy~N4SL){yVFKlkF9;f`R$V1Cv~=G- z%vy1(?y&V0g9ohgmHO)QJT*T>fUJxXbwOvXrdnjLqJpIjyF^GO_uM0Ezu-zgWFuC46Tl$WAZR+LSKk@9P| zUpu`{{pzRJ^~x@1M;||qYgY9QHSvm`2p2ccziS$t=8!ubW&1LXu+ndl8gv;zEc^3N@GqX>?S$u9Fpk@ zatyh!G6kIzWK3l4A@h@D{I8f{{1i0?YH}!Mjm*l{YE>=N+ECG%1?aWVbHTy~V8I3p zzcei9Z<@&HicQi`A@s=BoK>D=(!Fq`cS)auD0t2r?`;2&oIL~$6ciYH&vv@5az(<& zDK@lhhzRl`f3^rI9~#8x1CbVasmw2uQ=zOc(-%XboX?Y44NARZ${$8N?l+WleMNV< z=3Ci=VU)i}dd^}N<>UL;jyJjfyrM^3Z*{NLfN{k2nN7O{E|3PD8`a2>f#{3F(?OI)XWLFLb4Yw}sBf#vNQtKcZ^Rz(sp8YQcsy zWN_ijc1?sK+oJ$;G%>e{osGc7XJ`-fO#wDcu<=SCf^M64@M_R7wx90cS`ZNz2lXN5 zZ|mGGZEnLTH_6Y(3D*}z`$@U?1|+_uYxE9tef9AcOgH4qx?gkBIxVuS__pMC5b6at zL@)V@uDYv@R=9!0Y3ln&il#lMxkUQMy+!!A=QR|aBv`G!T5e$T)-^WGoF5}yuER9k zXj($BbCa7}@Epo$2bnddnObH1LyXw#TFM=aC+p`Ty*fe7-_&T;6*p$D*HM$}Y>siP SvSdr|ajCZ?Fq~!Q{r>^wWtC?D literal 0 HcmV?d00001 diff --git a/cmp/grammalyzer/__pycache__/utils.cpython-37.pyc b/cmp/grammalyzer/__pycache__/utils.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..636ec69fc19f664741cba274d4851a6b7b30f9c7 GIT binary patch literal 1646 zcmYjRO>Y}T7@nE^@OpP`ObKlo5JE_xSVA!;R6!IKN&*!qjYz8`7GQ0>n|R&zt}{CU z8_h}x!;KTaAh{rM;};-K{Sk9T94fAydg7U#I?Y(~&b%KpJAR+%eLrrse1h?B_t7{1 zGzs}zE6c&Kxr%qy0{Ji03@}us13uN$+u%e4Fsz9xvv}P!wfvZ!Shf z-WwK0)*DWyy;B}dCQ&y39#Q8a&B~4GT)i?ZCR03rkQKuy8`SsPI>E0)5b82UecGlz zvoU?@L33gC7;nQrq&f;Czyt{lHczlgNkx%=Hd~WqOpxtPWeF;+1(lGSeYn$YsHRBxB+a9& zGz1u5w52Eg69%mX;NJ)EO#uJoIq+x)+8vjD8Kfn{i$Jz&3Rto= z4)G0RYZ}|x7)1CC^Nwx>AcGAuJk^Zvws;4N;exgOU%r`%PyWD^<#L;wV zgFJ>frVHGF=21pF@T@aUsx`*n#);joqnhYC8+E6tGiCm!W>+0??d$bBYU+BM6O>Yx QZ0R(YIwhgy-Spo4ALR{@e*gdg literal 0 HcmV?d00001 diff --git a/cmp/grammalyzer/automatas.py b/cmp/grammalyzer/automatas.py new file mode 100644 index 000000000..0c4fb7dcb --- /dev/null +++ b/cmp/grammalyzer/automatas.py @@ -0,0 +1,209 @@ +from cmp.automata import State, multiline_formatter +from cmp.pycompiler import Item +from cmp.utils import ContainerSet + +from .utils import compute_firsts, compute_local_first + + +################ +# SLR AUTOMATA # +################ +def closure_lr0(items): + closure = ContainerSet(*items) + + pending = list(items) + while pending: + current = pending.pop() + symbol = current.NextSymbol + + if current.IsReduceItem or symbol.IsTerminal: + continue + + new_items = [Item(p, 0) for p in symbol.productions if Item(p, 0) not in closure] + pending += new_items + closure.extend(new_items) + return frozenset(closure) + + +def goto_lr0(items, symbol): + return frozenset(item.NextItem() for item in items if item.NextSymbol == symbol) + + +def build_lr0_automaton(G): + assert len(G.startSymbol.productions) == 1, 'Grammar must be augmented' + + start_production = G.startSymbol.productions[0] + start_item = Item(start_production, 0) + start = frozenset([start_item]) + + automaton = State(closure_lr0(start), True) + + pending = [start] + visited = {start: automaton} + + while pending: + current = pending.pop() + current_state = visited[current] + current_closure = current_state.state + for symbol in G.terminals + G.nonTerminals: + kernel = goto_lr0(current_closure, symbol) + + if kernel == frozenset(): + continue + + try: + next_state = visited[kernel] + except KeyError: + next_state = visited[kernel] = State(closure_lr0(kernel), True) + pending.append(kernel) + + current_state.add_transition(symbol.Name, next_state) + automaton.set_formatter(multiline_formatter) + return automaton + + +######################## +# LR1 & LALR1 AUTOMATA # +######################## +def compress(items): + centers = {} + + for item in items: + center = item.Center() + try: + lookaheads = centers[center] + except KeyError: + centers[center] = lookaheads = set() + lookaheads.update(item.lookaheads) + + return {Item(x.production, x.pos, set(lookahead)) for x, lookahead in centers.items()} + + +def expand(item, firsts): + next_symbol = item.NextSymbol + if next_symbol is None or not next_symbol.IsNonTerminal: + return [] + + lookaheads = ContainerSet() + + for preview in item.Preview(): + local_first = compute_local_first(firsts, preview) + lookaheads.update(local_first) + + assert not lookaheads.contains_epsilon + + return [Item(p, 0, lookaheads) for p in next_symbol.productions] + + +def closure_lr1(items, firsts): + closure = ContainerSet(*items) + changed = True + while changed: + new_items = ContainerSet() + for item in closure: + new_items.extend(expand(item, firsts)) + changed = closure.update(new_items) + return compress(closure) + + +def goto_lr1(items, symbol, firsts=None, just_kernel=False): + assert just_kernel or firsts is not None, '`firsts` must be provided if `just_kernel=False`' + items = frozenset(item.NextItem() for item in items if item.NextSymbol == symbol) + return items if just_kernel else closure_lr1(items, firsts) + + +def build_lr1_automaton(G, firsts=None): + assert len(G.startSymbol.productions) == 1, 'Grammar must be augmented' + + if not firsts: + firsts = compute_firsts(G) + firsts[G.EOF] = ContainerSet(G.EOF) + + start_production = G.startSymbol.productions[0] + start_item = Item(start_production, 0, lookaheads=(G.EOF,)) + start = frozenset([start_item]) + + closure = closure_lr1(start, firsts) + automaton = State(frozenset(closure), True) + + pending = [start] + visited = {start: automaton} + + while pending: + current = pending.pop() + current_state = visited[current] + + current_closure = current_state.state + for symbol in G.terminals + G.nonTerminals: + kernel = goto_lr1(current_closure, symbol, just_kernel=True) + + if kernel == frozenset(): + continue + + try: + next_state = visited[kernel] + except KeyError: + goto = closure_lr1(kernel, firsts) + visited[kernel] = next_state = State(frozenset(goto), True) + pending.append(kernel) + current_state.add_transition(symbol.Name, next_state) + + automaton.set_formatter(multiline_formatter) + return automaton + + +def build_larl1_automaton(G, firsts=None): + assert len(G.startSymbol.productions) == 1, 'Grammar must be augmented' + + if not firsts: + firsts = compute_firsts(G) + firsts[G.EOF] = ContainerSet(G.EOF) + + start_production = G.startSymbol.productions[0] + start_item = Item(start_production, 0, lookaheads=ContainerSet(G.EOF)) + start = frozenset([start_item.Center()]) + + closure = closure_lr1([start_item], firsts) + automaton = State(frozenset(closure), True) + + pending = [start] + visited = {start: automaton} + + while pending: + current = pending.pop() + current_state = visited[current] + + current_closure = current_state.state + for symbol in G.terminals + G.nonTerminals: + goto = goto_lr1(current_closure, symbol, just_kernel=True) + closure = closure_lr1(goto, firsts) + center = frozenset(item.Center() for item in goto) + + if center == frozenset(): + continue + + try: + next_state = visited[center] + centers = {item.Center(): item for item in next_state.state} + centers = {item.Center(): (centers[item.Center()], item) for item in closure} + + updated_items = set() + for c, (itemA, itemB) in centers.items(): + item = Item(c.production, c.pos, itemA.lookaheads | itemB.lookaheads) + updated_items.add(item) + + updated_items = frozenset(updated_items) + if next_state.state != updated_items: + pending.append(center) + next_state.state = updated_items + except KeyError: + visited[center] = next_state = State(frozenset(closure), True) + pending.append(center) + + if current_state[symbol.Name] is None: + current_state.add_transition(symbol.Name, next_state) + else: + assert current_state.get(symbol.Name) is next_state, 'Bad build!!!' + + automaton.set_formatter(multiline_formatter) + return automaton diff --git a/cmp/grammalyzer/cleaner.py b/cmp/grammalyzer/cleaner.py new file mode 100644 index 000000000..e0f1995d5 --- /dev/null +++ b/cmp/grammalyzer/cleaner.py @@ -0,0 +1,268 @@ +from cmp.pycompiler import Grammar, Sentence + + +def delete_common_prefix(G: Grammar): + """ + Algoritmo para eliminar los prefijos comunes de las producciones con la misma cabecera + Por cada no terminal busca si dos de sus produciones tiene prefijos comunes + """ + for nonterminal in G.nonTerminals: + change = True + primes = '' + while change: + change = False + for production0 in nonterminal.productions: + _continue = False + for production1 in nonterminal.productions: + if production0 != production1: + lpc = 0 + for i in range((min(len(production0.Right), len(production1.Right)))): + if production0.Right[i] == production1.Right[i]: + lpc += 1 + else: + break + # En caso de que si tengan prefijos comunes se realiza el siguiente cambio: + # E -> aA | aB + # Entonces se cambia por : + # E -> aE' + # E' -> A | B + if lpc > 0: + primes += '\'' + temp = G.NonTerminal(f"{nonterminal.Name}{primes}", False) + nonterminal.productions.remove(production0) + nonterminal.productions.remove(production1) + G.Productions.remove(production0) + G.Productions.remove(production1) + nonterminal %= Sentence(*production0.Right[0:lpc] + (temp,)) + alpha = production0.Right[lpc:] + betha = production1.Right[lpc:] + if len(alpha) == 0: + temp %= G.Epsilon + else: + temp %= Sentence(*alpha) + if len(betha) == 0: + temp %= G.Epsilon + else: + temp %= Sentence(*betha) + change = True + _continue = True + break + if _continue: + continue + return G + + +def delete_immediate_left_recursion(G: Grammar): + """ + Algoritmo para eliminar la recursion izquierda inmediata + """ + + for symbol in G.nonTerminals: + if any(not body.IsEpsilon and body[0] == symbol for _, body in symbol.productions): + last_productions = set(symbol.productions) + A = G.NonTerminal(f"{symbol}'") + + new_sents = [body + A for _, body in symbol.productions if body.IsEpsilon or body[0] != symbol] + for _, body in symbol.productions: + if not body.IsEpsilon and body[0] == symbol: + # A' -> b A' + A %= Sentence(*(body[1:] + (A,))) + A %= G.Epsilon + + for sent in new_sents: + # A -> b A' + symbol %= sent + + symbol.productions = list(set(symbol.productions) - last_productions) + G.Productions = list(set(G.Productions) - last_productions) + + return G + + +#################### +# GrammarCleaner # +#################### +def clean_grammar(G: Grammar): + """ + El algoritmo de limpiar la gramatica esta compuesto por varios pasos, sus nombres son suficientemente descriptivos + """ + G = delete_epsilon(G) + G = delete_unary_productions(G) + G = delete_nonterminal_variables(G) + G = delete_unreachable_variables(G) + return G + + +def delete_epsilon(G: Grammar): + """ + Delete all Epsilon productions in Grammar G + :param G: Grammar + :return: G whithout epsilon productions + """ + + # To eliminate the epsilon productions we find a set of non terminals 'nullables'. + # These non termimnals are those that after one or more productions they become in epsilon. + # + # Example: + # A ->* epsilon => A is nullable + nullable = set() + change = True + while change: + n = len(nullable) + for head, body in G.Productions: + + if head in nullable: + continue + + if len(body) == 0: + nullable.add(head) + else: + if all(symbol in nullable for symbol in body): + nullable.add(head) + change = n != len(nullable) + + # Now we have al non terminals nullables for every production + # then if a production contains a nullable non terminal it will be replaced by the same production + # but without the nullable non terminal. Then we eliminate all epsilon productions. + for nonterminal in G.nonTerminals: + stack = [x for x in nonterminal.productions] + dic = {} + while stack: + production = stack.pop() + if production.Right.IsEpsilon: + G.Productions.remove(production) + nonterminal.productions.remove(production) + else: + _, body = production + for i, symbol in enumerate(body): + if symbol in nullable: + add_production(nonterminal, Sentence(*(body[:i] + body[i + 1:])), dic, stack) + return G + + +def delete_unary_productions(G: Grammar): + """ + For delete every unary production like A -> B where A and B are non terminals all productions of B + will be uploaded one level in the grammar. + + BEFORE : A -> B + + B -> C | D | EF + + AFTER : A -> C | D | EF + + B -> C | D | EF + """ + change = True + while change: + change = False + for production in G.Productions: + head, body = production + if len(body) == 1 and body[0] in G.nonTerminals: + G.Productions.remove(production) + head.productions.remove(production) + for _, right in body[0].productions: + head %= right + change = True + return G + + +def delete_nonterminal_variables(G: Grammar): + # Todas aquellos no terminales que no deriven en algun string terminal tras 1 o mas producciones + # No son necesarias pues las cadenas siempre estaran formadas unicaente por terminales + # y produciones que no generen terminales son inconsistentes con esta verdad + # por tanto no aportan informacion al lenguaje + # Y no son necesarias en la gramatica + + # Computamos el conjunto de las produciones que derivan en terminales tra una o mas produciones + # La demostracion de la correctitud de este algoritmo puede ser inductiva + # buscamos las cadenas que terminen en terminales tras una produccion luego tras dos y asi sucesivamente + derive_to_terminal = set() + change = True + while change: + n = len(derive_to_terminal) + for nonterminal in G.nonTerminals: + for _, body in nonterminal.productions: + if all(symbol in derive_to_terminal for symbol in body if symbol.IsNonTerminal): + derive_to_terminal.add(nonterminal) + change = n != len(derive_to_terminal) + + # Las produciones posean uno de los terminales que no derivan en string terminales son incosistentes + # Pues estas no terminarian en un string terminal + # Ya sea si lo poseen en la cabecera como en el cuerpo de la produccion + # estas producciones inconsistentes son guardadas en Removable + removable = set() + for prod in G.Productions: + head, body = prod + if head in derive_to_terminal: + if any(symbol not in derive_to_terminal for symbol in body if symbol.IsNonTerminal): + removable.add(prod) + else: + removable.add(prod) + + # Son removidas de la gramatica las producciones y no terminales inconsistentes + for production in removable: + G.Productions.remove(production) + production.Left.productions.remove(production) + + for nonterminal in G.nonTerminals: + if not nonterminal.productions: + G.nonTerminals.remove(nonterminal) + + return G + + +def delete_unreachable_variables(G: Grammar): + # Para eliminar mas rapido castearemos las listas a set, + # de esta forma la eliminacion sera O(1) + G.terminals = set(G.terminals) + G.nonTerminals = set(G.nonTerminals) + G.Productions = set(G.Productions) + + # Los elementos que no pueden ser alcanzados por una o mas producciones del caracter inicial + # No son necesarias pues nunca son utilizadas para generar ningun elemento del lenguaje + # estos elementos inalcanzables pueden ser tanto terminales como no terminales + stack = [G.startSymbol] + reacheable_nonterminals = {G.startSymbol} + reacheable_terminals = set() + + # Encontramos los terminales y no terminales alcanzables + while stack: + current = stack.pop() + for _, body in current.productions: + for symbol in body: + if symbol.IsNonTerminal: + if symbol not in reacheable_nonterminals: + reacheable_nonterminals.add(symbol) + stack.append(symbol) + else: + reacheable_terminals.add(symbol) + + # Eliminamos las producciones con elementos no alcanzables + G.Productions -= {production for production in G.Productions if production.Left not in reacheable_nonterminals} + + # Ahora removemos los no terminales no alcanzables + G.nonTerminals -= {nonterminal for nonterminal in G.nonTerminals if nonterminal not in reacheable_nonterminals} + + # Ahora removemos los terminales no alcanzables + G.terminals -= {terminal for terminal in G.terminals if terminal not in reacheable_terminals} + + # Finalmente casteamos a lista otra vez + G.terminals = list(G.terminals) + G.nonTerminals = list(G.nonTerminals) + G.Productions = list(G.Productions) + return G + + +def add_production(head, sentence, dic, stack): + """ + Assistant Method to add new productions to the grammar, queue and dict + """ + try: + dic[sentence] + except KeyError: + dic[sentence] = True + if not sentence.IsEpsilon: + head %= sentence + stack.append(head.productions[-1]) + diff --git a/cmp/grammalyzer/conflict/__init__.py b/cmp/grammalyzer/conflict/__init__.py new file mode 100644 index 000000000..3bad9d509 --- /dev/null +++ b/cmp/grammalyzer/conflict/__init__.py @@ -0,0 +1,2 @@ +from .llconflict import LLConflictStringGenerator +from .lrconflict import LRConflictStringGenerator diff --git a/cmp/grammalyzer/conflict/llconflict.py b/cmp/grammalyzer/conflict/llconflict.py new file mode 100644 index 000000000..e696f086d --- /dev/null +++ b/cmp/grammalyzer/conflict/llconflict.py @@ -0,0 +1,142 @@ +from collections import deque + +from cmp.pycompiler import Sentence, Production + + +def compute_sentence(G): + """ + For each non terminal 'X' in the Grammar G compute a sentence of terminals 'S' where X ->* S + """ + sentence = {t: Sentence(t) for t in G.terminals} + + change = True + while change: + n = len(sentence) + for production in G.Productions: + head, body = production + + if head in sentence: + continue + + if body.IsEpsilon or all(symbol in sentence for symbol in body): + sentence[head] = Sentence(*[sentence[symbol] for symbol in body]) + + change = n != len(sentence) + + return sentence + + +def compute_fixxed_sentence(G, t, sentence_forms): + """ + For each non terminal 'X' in the Grammar G compute a sentence of terminals that start with t 'tS' + where X ->* tS + """ + fixxed_sentence = {t: Sentence(t)} + + change = True + while change: + n = len(fixxed_sentence) + for production in G.Productions: + head, body = production + + if head in fixxed_sentence: + continue + + if not body.IsEpsilon and body[0] in fixxed_sentence: + fixxed_sentence[head] = Sentence( + *([fixxed_sentence[body[0]]] + [sentence_forms[symbol] for symbol in body[1:]])) + + change = n != len(fixxed_sentence) + + return fixxed_sentence + + +def shortest_production_path(G, x): + """ + Compute the shortest poduction path from start symbol of + Grammar G to a sentence form thad Contains the Non Temrinal X + """ + queue = deque([x]) + sentence_form = {x: Sentence(x)} + production_path = {x: [Production(x, Sentence(x))]} # Eliminar esta linea de testeo + + productions = set(G.Productions) + while queue: + current = queue.popleft() + + visited_productions = set() + for production in productions: + + head, body = production + + if head in sentence_form: + continue + + sentence = Sentence() + current_belong = False + for i, symbol in enumerate(body): + if symbol == current: + current_belong = True + sentence += sentence_form[current] + else: + sentence += symbol + + if current_belong: + queue.append(head) + sentence_form[head] = sentence + production_path[head] = [production] + production_path[current] + visited_productions.add(production) + + productions -= visited_productions + + assert G.startSymbol in sentence_form, f'{x} is not reacheable from start symbol {G.startSymbol}' + + return sentence_form[G.startSymbol], production_path[G.startSymbol][:-1] + + +class LLConflictStringGenerator: + def __init__(self, parser): + assert parser.conflict is not None, 'Expected parser with conflict...' + self.G = parser.G + self.table = parser.table + self.conflict = parser.conflict + self.prod1 = None + self.prod2 = None + self.s1, self.s2 = self.__generate_conflict() + + def __generate_conflict(self): + G = self.G + x = self.conflict.nonterminal + s = self.conflict.terminal + table = self.table + + conflict1, conflict2 = table[x, s][0], table[x, s][1] + sentence, _ = shortest_production_path(G, x) + sentence_forms = compute_sentence(G) + sentence_forms_fixxed = compute_fixxed_sentence(G, s, sentence_forms) + + i = tuple(sentence).index(x) + + x1 = conflict1.Right[0] + x2 = conflict2.Right[0] + + s1 = Sentence(*(sentence[:i] + tuple(conflict1.Right) + sentence[i + 1:])) + s2 = Sentence(*(sentence[:i] + tuple(conflict2.Right) + sentence[i + 1:])) + + ss1 = Sentence() + for symbol in s1: + if symbol == x1: + ss1 += sentence_forms_fixxed[symbol] + else: + ss1 += sentence_forms[symbol] + + ss2 = Sentence() + for symbol in s2: + if symbol == x2: + ss2 += sentence_forms_fixxed[symbol] + else: + ss2 += sentence_forms[symbol] + + self.prod1 = conflict1 + self.prod2 = conflict2 + return ss1, ss2 diff --git a/cmp/grammalyzer/conflict/lrconflict.py b/cmp/grammalyzer/conflict/lrconflict.py new file mode 100644 index 000000000..d8d985056 --- /dev/null +++ b/cmp/grammalyzer/conflict/lrconflict.py @@ -0,0 +1,195 @@ +from collections import deque + +from cmp.automata import State +from cmp.pycompiler import Sentence + + +def path_from(s): + """ + Compute path from s to all reacheables states in the automaton from s using a BFS algorithm + Return a dictionary of parents 'p' where p[some_state] has a tuple where it first item is + the parent state and the second item is the symbol of the transition from 'parent_state' to + 'some_state', and if a State s is not reacheable from 's' it doesn't belong to the + returned dictionary. By default the parent of 's' is None. + + The next code can recover the path form s to other reacheable state + + >>> parents = path_from(source) + >>> path = [dest] + >>> s = dest + >>> while parents[s] is not None: + >>> s, symbol = parents[s] + >>> path += [symbol, s] + >>> path.reverse() + >>> return path + + :param s: instance from class State representing the node from where start searching. + + :return: Dict[some_state, Tuple[parent_state, transition_symbol]] where some state is reacheable from state + """ + queue = deque([s]) + + parents = {s: None} + visited = set() + + while queue: + current = queue.popleft() + + if current in visited: + continue + + visited.add(current) + + for symbol in current.transitions: + dest = current.get(symbol) + queue.append(dest) + parents[dest] = current, symbol + + return parents + + +def path_from_to(source, dest): + """ + Compute the path in the automaton from state 'source' to state 'dest'. + + :param source: state representing the begining of the path + + :param dest: state representing the end of the path + + :return: a list following the secuence + 'source state' -> 'transition symbol' -> 'state' -> ... -> 'transition symbol' -> 'dest state' + """ + parents = path_from(source) + + path = [dest] + s = dest + while parents[s] is not None: + s, symbol = parents[s] + path += [symbol, s] + path.reverse() + return path + + +def guided_path(s, guide_sentence): + """ + Compute a path in the autoamta that follows thre secuence + 's' -> 'guide_sentence[0]' -> 'state' -> ... -> 'guide_sentence[-1]' + + :param s: Begining of the path + + :param guide_sentence: Sentence with the symbols for the transitions from state 's' consuming these symbols + + :return: Path from state 's' consuming the symbols of 'guide' + """ + path = [] + node = s + for symbol in guide_sentence: + path += [node, symbol] + node = node.get(symbol.Name) + path.append(node) + + return path + + +def reduce(s, p, state_list, lookahead): + """ + Make a backtrack in the automata from state 's' reducing the production 'p' + + :param s: state from reduce + + :param p: production to reduce + + :param state_list: list with all states in the automata + + :param lookahead: the last symbol to append at the path + + :return: a list following the secuence + 's' -> 'transition symbol' -> 'state' -> ... -> 'transition symbol' -> 'dest state' -> 'lookahead' + """ + states = {s} + stack = list(p.Right) + + while stack: + symbol = stack.pop() + + next_states = set() + for s in state_list: + if s.has_transition(symbol.Name) and s.get(symbol.Name) in states: + next_states.add(s) + states = next_states + reduced_state = states.pop() + + path = guided_path(reduced_state, p.Right) + path.append(lookahead) + return path + + +def sentence_path(init, conflict_state, symbol, p): + """ + Computes the path from init automaton state to 'conflict_state' passing + through state reduced from 'conflict_state' by production 'p' + """ + states = [s for s in init] + rpath = reduce(conflict_state, p, states, symbol) + lpath = path_from_to(init, rpath[0]) + return lpath + rpath[1:] + + +def expand_path(init, path, follows): + """ + Expand the non terminal symbols in the given path until all becomes in terminals + and return a sentence with these sequenced terminals + """ + i = -2 + table = {s: set(s.state) for s in init} + + lookahead = path[-1] + while i >= -len(path): + current = path[i] + symbol = path[i + 1] + + if symbol.IsTerminal: + lookahead = symbol + i -= 2 + continue + + reductors = [item for item in current.state if item.production.Left == current and item in table[current]] + + while reductors: + reductor = reductors.pop() + + subpath = guided_path(current, reductor.production.Right) + + last = subpath.pop() + ritem = [item for item in last.state if item.IsReduceItem and item.production == reductor.production][0] + lookaheads = follows[ritem.Left] if not ritem.lookaheads else ritem.lookaheads + + if lookahead in lookaheads: + table[current].remove(reductor) + path = path[:i] + subpath + path[i + 2:] + break + + return Sentence(*[s for s in path if not isinstance(s, State)]) + + +class LRConflictStringGenerator: + """ + Recieve a cparser with conflicts and compute a Sentence that show the conflict + It can be accessed by the field path + + Example: + >>> g = LRConflictStringGenerator(parser) + >>> g.path + """ + def __init__(self, parser): + assert parser.conflict is not None, 'Expected parser with conflict...' + stateID = parser.state_dict + state = parser.conflict.state + symbol = parser.conflict.symbol + init = parser.automaton + _, production = parser.action[state, symbol].pop() + path = sentence_path(init, stateID[state], symbol, production) + + self.production = production + self.conflict = parser.conflict + self.path = expand_path(init, path, parser.follows) diff --git a/cmp/grammalyzer/dtree.py b/cmp/grammalyzer/dtree.py new file mode 100755 index 000000000..3373cee9a --- /dev/null +++ b/cmp/grammalyzer/dtree.py @@ -0,0 +1,105 @@ +import pydot + + +class DerivationTreeNode: + def __init__(self, symbol, father=None): + self.symbol = symbol + self.father = father + self.childs = [] + + def add_child(self, symbol): + self.childs.append(DerivationTreeNode(symbol, father=self)) + return self.childs[-1] + + def go_root(self): + return self if self.father is None else self.father.go_root() + + def __str__(self): + return str(self.symbol) + + +class DerivationTree: + def __init__(self, productions): + self.root = self._build_tree(productions) + + def _build_tree(self, productions): + raise NotImplementedError + + def _derivation(self, productions, node=None): + raise NotImplementedError + + def graph(self): + G = pydot.Dot(graph_type='graph', rankdir='TD', margin=0.1) + stack = [self.root] + + while stack: + current = stack.pop() + ids = id(current) + G.add_node(pydot.Node(name=ids, label=str(current), shape='circle')) + for child in current.childs: + stack.append(child) + G.add_node(pydot.Node(name=id(child), label=str(child), shape='circle')) + G.add_edge(pydot.Edge(ids, id(child))) + + return G + + # noinspection PyUnresolvedReferences + def _repr_svg_(self): + try: + return self.graph().create_svg().decode('utf8') + except AttributeError: + pass + + def __str__(self): + return str(self.root) + + +class LLDerivationTree(DerivationTree): + def _build_tree(self, productions): + iter_productions = iter(productions) + return self._derivation(iter_productions) + + def _derivation(self, productions, node=None): + try: + head, body = next(productions) + except StopIteration: + return node.go_root() + + if node is None: + node = DerivationTreeNode(head) + + assert node.symbol == head + + for symbol in body: + if symbol.IsTerminal: + node.add_child(symbol) + elif symbol.IsNonTerminal: + next_node = node.add_child(symbol) + self._derivation(productions, next_node) + return node + + +class LRDerivationTree(DerivationTree): + def _build_tree(self, productions): + iter_productions = iter(reversed(productions)) + return self._derivation(iter_productions) + + def _derivation(self, productions, node=None): + try: + head, body = next(productions) + except StopIteration: + return node.go_root() + + if node is None: + node = DerivationTreeNode(head) + + assert node.symbol == head + + for symbol in reversed(body): + if symbol.IsTerminal: + node.add_child(symbol) + elif symbol.IsNonTerminal: + next_node = node.add_child(symbol) + self._derivation(productions, next_node) + node.childs.reverse() + return node diff --git a/cmp/grammalyzer/lexer.py b/cmp/grammalyzer/lexer.py new file mode 100644 index 000000000..236455e3d --- /dev/null +++ b/cmp/grammalyzer/lexer.py @@ -0,0 +1,65 @@ +from cmp.automata import State +from cmp.utils import Token +from cmp.regex import Regex + + +class Lexer: + def __init__(self, table, eof): + self.eof = eof + self.regexs = self._build_regexs(table) + self.automaton = self._build_automaton() + + @staticmethod + def _build_regexs(table): + regexs = [] + for n, (token_type, regex) in enumerate(table): + automaton = Regex.build_automaton(regex) + automaton, states = State.from_nfa(automaton, get_states=True) + + for state in states: + if state.final: + state.tag = (n, token_type) + + regexs.append(automaton) + return regexs + + def _build_automaton(self): + start = State('start') + regexs = self.regexs + + for regex in regexs: + start.add_epsilon_transition(regex) + + return start.to_deterministic() + + def _walk(self, string): + state = self.automaton + final = state if state.final else None + final_lex = lex = '' + + for symbol in string: + try: + state = state[symbol][0] + lex += symbol + final, final_lex = (state, lex) if state.final else (final, final_lex) + except TypeError: + break + + return final, final_lex + + def _tokenize(self, text): + while text != '': + state, lex = self._walk(text) + + if state is not None: + text = text[len(lex):] + token_type = min((s for s in state.state if s.final), key=lambda x: x.tag).tag[1] + yield lex, token_type + + else: + return None + + yield '$', self.eof + + def __call__(self, text): + return [Token(lex, ttype) for lex, ttype in self._tokenize(text)] diff --git a/cmp/grammalyzer/parsing.py b/cmp/grammalyzer/parsing.py new file mode 100755 index 000000000..ef10a17a3 --- /dev/null +++ b/cmp/grammalyzer/parsing.py @@ -0,0 +1,260 @@ +from enum import auto, Enum + +from .automatas import build_lr0_automaton, build_lr1_automaton, build_larl1_automaton +from .utils import compute_firsts, compute_follows + + +class LRConflictType(Enum): + """ + Enum for mark the type of a lr-family parser + """ + ReduceReduce = auto() + ShiftReduce = auto() + + +class LRConflict: + def __init__(self, state, symbol, ctype): + self.state = state + self.symbol = symbol + self.cType = ctype + + def __iter__(self): + yield self.state + yield self.symbol + + +class LLConflictType(Enum): + """ + Enum for mark the type of a ll parser + """ + FirstFirst = auto() + FollowFollow = auto() + + +class LLConflict: + def __init__(self, nontermial, terminal, ctype): + self.nonterminal = nontermial + self.terminal = terminal + self.cType = ctype + + def __iter__(self): + yield self.nonterminal + yield self.terminal + + +class LL1Parser: + def __init__(self, G): + self.G = G + self.firsts = compute_firsts(G) + self.follows = compute_follows(G, self.firsts) + self.conflict = None + self.table = self._build_parsing_table() + + def _build_parsing_table(self): + G = self.G + firsts = self.firsts + follows = self.follows + parsing_table = {} + + # P: X -> alpha + for production in G.Productions: + head, body = production + + contains_epsilon = firsts[body].contains_epsilon + + # working with symbols on First(alpha) ... + if not contains_epsilon: + for symbol in firsts[body]: + try: + parsing_table[head, symbol].append(production) + self.conflict = LLConflict(head, symbol, LLConflictType.FirstFirst) + except KeyError: + parsing_table[head, symbol] = [production] + # working with epsilon... + else: + for symbol in follows[head]: + try: + parsing_table[head, symbol].append(production) + self.conflict = LLConflict(head, symbol, LLConflictType.FollowFollow) + except KeyError: + parsing_table[head, symbol] = [production] + + # parsing table is ready!!! + return parsing_table + + def __call__(self, tokens): + G = self.G + table = self.table + + stack = [G.startSymbol] + cursor = 0 + output = [] + + # parsing w... + while len(stack) > 0 and cursor < len(tokens): + top = stack.pop() + currentToken = tokens[cursor].token_type + # print((top, currentToken)) + if top.IsTerminal: + cursor += 1 + if currentToken != top: + return None + elif top.IsNonTerminal: + try: + production = table[top, currentToken][0] + except KeyError: + return None + + output.append(production) + reversed_production = reversed(production.Right) + + for s in reversed_production: + stack.append(s) + + # left parse is ready!!! + return output + + +class ShiftReduceParser: + SHIFT = 'SHIFT' + REDUCE = 'REDUCE' + OK = 'OK' + + def __init__(self, G, verbose=False): + self.G = G + self.augmented_G = G.AugmentedGrammar(True) + self.firsts = compute_firsts(self.augmented_G) + self.follows = compute_follows(self.augmented_G, self.firsts) + self.automaton = self._build_automaton() + self.state_dict = {} + self.conflict = None + + self.verbose = verbose + self.action = {} + self.goto = {} + self._build_parsing_table() + + if self.conflict is None: + self._clean_tables() + + def _build_parsing_table(self): + G = self.augmented_G + automaton = self.automaton + + for i, node in enumerate(automaton): + if self.verbose: + print(i, '\t', '\n\t '.join(str(x) for x in node.state), '\n') + node.idx = i + self.state_dict[i] = node + + for node in automaton: + idx = node.idx + for item in node.state: + if item.IsReduceItem: + if item.production.Left == G.startSymbol: + self._register(self.action, (idx, G.EOF), (self.OK, None)) + else: + for lookahead in self._lookaheads(item): + self._register(self.action, (idx, lookahead), (self.REDUCE, item.production)) + else: + symbol = item.NextSymbol + idj = node.get(symbol.Name).idx + if symbol.IsTerminal: + self._register(self.action, (idx, symbol), (self.SHIFT, idj)) + else: + self._register(self.goto, (idx, symbol), idj) + + def __call__(self, tokens, get_ast=False): + stack = [0] + cursor = 0 + output = [] + + while True: + state = stack[-1] + lookahead = tokens[cursor] + if self.verbose: + print(stack, '<---||--->', tokens[cursor:]) + + assert (state, lookahead.token_type) in self.action, 'Parsing Error...' + + action, tag = self.action[state, lookahead.token_type] + + if action == self.SHIFT: + stack += [lookahead.token_type, lookahead.lex, tag] + cursor += 1 + elif action == self.REDUCE: + output.append(tag) + + head, body = tag + + try: + attribute = tag.attributes[0] # La gramatica es atributada + except AttributeError: + attribute = None # La gramatica es no atributada + + syn = [None] * (len(body) + 1) + for i, symbol in enumerate(reversed(body), 1): + stack.pop() + syn[-i] = stack.pop() + assert symbol == stack.pop(), 'Bad Reduce...' + syn[0] = attribute(syn) if attribute is not None else None + + state = stack[-1] + goto = self.goto[state, head] + stack += [head, syn[0], goto] + + elif action == self.OK: + return (output, stack[2]) if get_ast else output + else: + raise Exception('Parsing error...') + + def _register(self, table, key, value): + # assert key not in table or table[key] == value, 'Shift-Reduce or Reduce-Reduce conflict!!!' + try: + n = len(table[key]) + table[key].add(value) + if self.conflict is None and n != len(table[key]): + if all(action == self.REDUCE for action, _ in list(table[key])[:2]): + cType = LRConflictType.ReduceReduce + else: + cType = LRConflictType.ShiftReduce + + self.conflict = LRConflict(key[0], key[1], cType) + self.conflict.value1 = list(table[key])[0] + self.conflict.value2 = list(table[key])[1] + + except KeyError: + table[key] = {value} + + def _clean_tables(self): + for key in self.action: + self.action[key] = self.action[key].pop() + for key in self.goto: + self.goto[key] = self.goto[key].pop() + + def _build_automaton(self): + raise NotImplementedError() + + def _lookaheads(self, item): + raise NotImplementedError() + + +class SLR1Parser(ShiftReduceParser): + def _build_automaton(self): + return build_lr0_automaton(self.augmented_G) + + def _lookaheads(self, item): + return self.follows[item.production.Left] + + +class LR1Parser(ShiftReduceParser): + def _build_automaton(self): + return build_lr1_automaton(self.augmented_G, firsts=self.firsts) + + def _lookaheads(self, item): + return item.lookaheads + + +class LALR1Parser(LR1Parser): + def _build_automaton(self): + return build_larl1_automaton(self.augmented_G, firsts=self.firsts) diff --git a/cmp/grammalyzer/utils.py b/cmp/grammalyzer/utils.py new file mode 100644 index 000000000..04d357802 --- /dev/null +++ b/cmp/grammalyzer/utils.py @@ -0,0 +1,93 @@ +from cmp.utils import ContainerSet + + +def compute_local_first(firsts, alpha): + first_alpha = ContainerSet() + + try: + alpha_is_epsilon = alpha.IsEpsilon + except AttributeError: + alpha_is_epsilon = False + + if alpha_is_epsilon: + first_alpha.set_epsilon() + else: + for symbol in alpha: + first_symbol = firsts[symbol] + first_alpha.update(first_symbol) + if not first_symbol.contains_epsilon: + break + else: + first_alpha.set_epsilon() + + return first_alpha + + +def compute_firsts(G): + firsts = {} + change = True + + for terminal in G.terminals: + firsts[terminal] = ContainerSet(terminal) + + for nonterminal in G.nonTerminals: + firsts[nonterminal] = ContainerSet() + + while change: + change = False + + # P: X -> alpha + for production in G.Productions: + X, alpha = production + + first_X = firsts[X] + + try: + first_alpha = firsts[alpha] + except KeyError: + first_alpha = firsts[alpha] = ContainerSet() + + local_first = compute_local_first(firsts, alpha) + + change |= first_alpha.hard_update(local_first) + change |= first_X.hard_update(local_first) + + return firsts + + +def compute_follows(G, firsts): + follows = {} + change = True + + local_firsts = {} + + # init Follow(Vn) + for nonterminal in G.nonTerminals: + follows[nonterminal] = ContainerSet() + follows[G.startSymbol] = ContainerSet(G.EOF) + + while change: + change = False + + # P: X -> alpha + for production in G.Productions: + X = production.Left + alpha = production.Right + + follow_X = follows[X] + + for i, symbol_Y in enumerate(alpha): + # X -> zeta Y beta + if symbol_Y.IsNonTerminal: + follow_Y = follows[symbol_Y] + try: + first_beta = local_firsts[alpha, i] + except KeyError: + first_beta = local_firsts[alpha, i] = compute_local_first(firsts, alpha[i + 1:]) + # First(beta) - { epsilon } subset of Follow(Y) + change |= follow_Y.update(first_beta) + # beta ->* epsilon or X -> zeta Y ? Follow(X) subset of Follow(Y) + if first_beta.contains_epsilon: + change |= follow_Y.update(follow_X) + # Follow(Vn) + return follows diff --git a/cmp/pycompiler.py b/cmp/pycompiler.py new file mode 100755 index 000000000..f73a51cb0 --- /dev/null +++ b/cmp/pycompiler.py @@ -0,0 +1,522 @@ +import json + + +class Symbol(object): + + def __init__(self, name, grammar): + self.Name = name + self.Grammar = grammar + + def __str__(self): + return self.Name + + def __repr__(self): + return repr(self.Name) + + def __add__(self, other): + if isinstance(other, Symbol): + return Sentence(self, other) + + raise TypeError(other) + + def __or__(self, other): + + if isinstance(other, Sentence): + return SentenceList(Sentence(self), other) + + raise TypeError(other) + + @property + def IsEpsilon(self): + return False + + def __len__(self): + return 1 + + +class NonTerminal(Symbol): + + def __init__(self, name, grammar): + super().__init__(name, grammar) + self.productions = [] + + def __imod__(self, other): + + # My modification + if isinstance(other, str): + sentence = Sentence(*(self.Grammar[s] for s in other.split())) + p = Production(self, sentence) + self.Grammar.Add_Production(p) + return self + + if isinstance(other, Sentence): + p = Production(self, other) + self.Grammar.Add_Production(p) + return self + + if isinstance(other, tuple): + assert len(other) > 1 + + if len(other) == 2: + other += (None,) * len(other[0]) + + assert len(other) == len(other[0]) + 2, 'Debe definirse una, y solo una, regla por cada símbolo de la ' \ + 'producción ' + # assert len(other) == 2, "Tiene que ser una Tupla de 2 elementos (sentence, attribute)" + + if isinstance(other[0], Symbol) or isinstance(other[0], Sentence): + p = AttributeProduction(self, other[0], other[1:]) + else: + raise Exception("") + + self.Grammar.Add_Production(p) + return self + + if isinstance(other, Symbol): + p = Production(self, Sentence(other)) + self.Grammar.Add_Production(p) + return self + + if isinstance(other, SentenceList): + + for s in other: + p = Production(self, s) + self.Grammar.Add_Production(p) + + return self + + raise TypeError(other) + + @property + def IsTerminal(self): + return False + + @property + def IsNonTerminal(self): + return True + + @property + def IsEpsilon(self): + return False + + +class Terminal(Symbol): + + def __init__(self, name, grammar): + super().__init__(name, grammar) + + @property + def IsTerminal(self): + return True + + @property + def IsNonTerminal(self): + return False + + @property + def IsEpsilon(self): + return False + + +class EOF(Terminal): + def __init__(self, G): + super().__init__('$', G) + + +class Sentence: + + def __init__(self, *args): + self._symbols = tuple(x for x in args if not x.IsEpsilon) + self.hash = hash(self._symbols) + + def __len__(self): + return len(self._symbols) + + def __add__(self, other): + if isinstance(other, Symbol): + return Sentence(*(self._symbols + (other,))) + + if isinstance(other, Sentence): + return Sentence(*(self._symbols + other._symbols)) + + raise TypeError(other) + + def __or__(self, other): + if isinstance(other, Sentence): + return SentenceList(self, other) + + if isinstance(other, Symbol): + return SentenceList(self, Sentence(other)) + + raise TypeError(other) + + def __repr__(self): + return str(self) + + def __str__(self): + return ("%s " * len(self._symbols) % tuple(self._symbols)).strip() + + def __iter__(self): + return iter(self._symbols) + + def __getitem__(self, index): + return self._symbols[index] + + def __eq__(self, other): + """ + :type other: Sentence + """ + return self._symbols == other._symbols + + def __hash__(self): + return self.hash + + @property + def IsEpsilon(self): + return False + + +class SentenceList: + + def __init__(self, *args): + self._sentences = list(args) + + def Add(self, symbol): + if not symbol and (symbol is None or not symbol.IsEpsilon): + raise ValueError(symbol) + + self._sentences.append(symbol) + + def __iter__(self): + return iter(self._sentences) + + def __or__(self, other): + if isinstance(other, Sentence): + self.Add(other) + return self + + if isinstance(other, Symbol): + return self | Sentence(other) + + +class Epsilon(Terminal, Sentence): + + def __init__(self, grammar): + super().__init__('epsilon', grammar) + + def __str__(self): + return "e" + + def __repr__(self): + return 'epsilon' + + def __iter__(self): + yield from () + + def __len__(self): + return 0 + + def __add__(self, other): + return other + + def __eq__(self, other): + return isinstance(other, (Epsilon,)) + + def __hash__(self): + return hash("") + + @property + def IsEpsilon(self): + return True + + +class Production: + + def __init__(self, nonTerminal, sentence): + self.Left = nonTerminal + self.Right = sentence + + def __str__(self): + return '%s := %s' % (self.Left, self.Right) + + def __repr__(self): + return '%s -> %s' % (self.Left, self.Right) + + def __iter__(self): + yield self.Left + yield self.Right + + def __eq__(self, other): + return isinstance(other, Production) and self.Left == other.Left and self.Right == other.Right + + def __hash__(self): + return hash((self.Left, self.Right)) + + @property + def IsEpsilon(self): + return self.Right.IsEpsilon + + +class AttributeProduction(Production): + + def __init__(self, nonTerminal, sentence, attributes): + if not isinstance(sentence, Sentence) and isinstance(sentence, Symbol): + sentence = Sentence(sentence) + super(AttributeProduction, self).__init__(nonTerminal, sentence) + + self.attributes = attributes + + def __str__(self): + return '%s := %s' % (self.Left, self.Right) + + def __repr__(self): + return '%s -> %s' % (self.Left, self.Right) + + def __iter__(self): + yield self.Left + yield self.Right + + @property + def IsEpsilon(self): + return self.Right.IsEpsilon + + def synthesize(self): + pass + + +class Grammar: + def __init__(self): + self.Productions = [] + self.nonTerminals = [] + self.terminals = [] + self.startSymbol = None + # production type + self.pType = None + self.Epsilon = Epsilon(self) + self.EOF = EOF(self) + + self.symbDict = {'$': self.EOF} + + def NonTerminal(self, name, startSymbol=False): + + name = name.strip() + if not name: + raise Exception("Empty name") + + term = NonTerminal(name, self) + + if startSymbol: + + if self.startSymbol is None: + self.startSymbol = term + else: + raise Exception("Cannot define more than one start symbol.") + + self.nonTerminals.append(term) + self.symbDict[name] = term + return term + + def NonTerminals(self, names): + + ans = tuple((self.NonTerminal(x) for x in names.strip().split())) + + return ans + + def Add_Production(self, production): + + if len(self.Productions) == 0: + self.pType = type(production) + + assert type(production) == self.pType, "The Productions most be of only 1 type." + + production.Left.productions.append(production) + self.Productions.append(production) + + def Terminal(self, name): + + name = name.strip() + if not name: + raise Exception("Empty name") + + term = Terminal(name, self) + self.terminals.append(term) + self.symbDict[name] = term + return term + + def Terminals(self, names): + + ans = tuple((self.Terminal(x) for x in names.strip().split())) + + return ans + + def __str__(self): + + mul = '%s, ' + + ans = 'Non-Terminals:\n\t' + + nonterminals = mul * (len(self.nonTerminals) - 1) + '%s\n' + + ans += nonterminals % tuple(self.nonTerminals) + + ans += 'Terminals:\n\t' + + terminals = mul * (len(self.terminals) - 1) + '%s\n' + + ans += terminals % tuple(self.terminals) + + ans += 'Productions:\n\t' + + ans += str(self.Productions) + + return ans + + def __getitem__(self, name): + try: + return self.symbDict[name] + except KeyError: + return None + + @property + def to_json(self): + + productions = [] + + for p in self.Productions: + head = p.Left.Name + + body = [] + + for s in p.Right: + body.append(s.Name) + + productions.append({'Head': head, 'Body': body}) + + d = {'NonTerminals': [symb.Name for symb in self.nonTerminals], + 'Terminals': [symb.Name for symb in self.terminals], + 'Productions': productions} + + # [{'Head':p.Left.Name, "Body": [s.Name for s in p.Right]} for p in self.Productions] + return json.dumps(d) + + @staticmethod + def from_json(data): + data = json.loads(data) + + G = Grammar() + dic = {'epsilon': G.Epsilon} + + for term in data['Terminals']: + dic[term] = G.Terminal(term) + + for noTerm in data['NonTerminals']: + dic[noTerm] = G.NonTerminal(noTerm) + + for p in data['Productions']: + head = p['Head'] + dic[head] %= Sentence(*[dic[term] for term in p['Body']]) + + return G + + def copy(self): + G = Grammar() + G.Productions = self.Productions.copy() + G.nonTerminals = self.nonTerminals.copy() + G.terminals = self.terminals.copy() + G.pType = self.pType + G.startSymbol = self.startSymbol + G.Epsilon = self.Epsilon + G.EOF = self.EOF + G.symbDict = self.symbDict.copy() + + return G + + @property + def IsAugmentedGrammar(self): + augmented = 0 + for left, _ in self.Productions: + if self.startSymbol == left: + augmented += 1 + if augmented <= 1: + return True + else: + return False + + def AugmentedGrammar(self, force=False): + if not self.IsAugmentedGrammar or force: + + G = self.copy() + # S, self.startSymbol, SS = self.startSymbol, None, self.NonTerminal('S\'', True) + S = G.startSymbol + G.startSymbol = None + SS = G.NonTerminal('S\'', True) + if G.pType is AttributeProduction: + SS %= S + G.Epsilon, lambda x: x + else: + SS %= S + G.Epsilon + + return G + else: + return self.copy() + # endchange + + +class Item: + + def __init__(self, production, pos, lookaheads=None): + if lookaheads is None: + lookaheads = [] + self.production = production + self.pos = pos + self.lookaheads = frozenset(look for look in lookaheads) + + def __str__(self): + s = str(self.production.Left) + " -> " + if len(self.production.Right) > 0: + for i, _ in enumerate(self.production.Right): + if i == self.pos: + s += "." + s += str(self.production.Right[i]) + if self.pos == len(self.production.Right): + s += "." + else: + s += "." + s += ", " + str(self.lookaheads)[10:-1] + return s + + def __repr__(self): + return str(self) + + def __eq__(self, other): + return ( + (self.pos == other.pos) and + (self.production == other.production) and + (set(self.lookaheads) == set(other.lookaheads)) + ) + + def __hash__(self): + return hash((self.production, self.pos, self.lookaheads)) + + @property + def IsReduceItem(self): + return len(self.production.Right) == self.pos + + @property + def NextSymbol(self): + if self.pos < len(self.production.Right): + return self.production.Right[self.pos] + else: + return None + + def NextItem(self): + if self.pos < len(self.production.Right): + return Item(self.production, self.pos + 1, self.lookaheads) + else: + return None + + def Preview(self, skip=1): + unseen = self.production.Right[self.pos + skip:] + return [unseen + (lookahead,) for lookahead in self.lookaheads] + + def Center(self): + return Item(self.production, self.pos) diff --git a/cmp/regex/__init__.py b/cmp/regex/__init__.py new file mode 100644 index 000000000..ea83cbbe2 --- /dev/null +++ b/cmp/regex/__init__.py @@ -0,0 +1,3 @@ +from .regex import Regex +from .automata import NFA, DFA +from .utils import RegularGrammar diff --git a/cmp/regex/__pycache__/__init__.cpython-37.pyc b/cmp/regex/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0f94c207ec9afdd25e82ed87d108b7164a7cd6d4 GIT binary patch literal 272 zcmXv|!A`?43{9G58;Bu(qY_%K91vm%joUOaPB~CTZNw_#WpYzQ|AP~Mz%S*>iC^G^ zJqb&;-+QwCd^ew;3X0E^ zM9!6a%M(;ct+?VIUV{hNTdw*Fx#E1YKVC<6n^fLt)_Z1V=bSU&cg~#6jfI6Gqf7jG z|L03{jQs~8xlDRkqvrojH_0S-S(n?qD{RpXj7rK^hQNL-= z-C;5(^G}$}JI2tkizFAMMY5&kd6MU3k>sMoX}m=8yeyGiasBrnKCk{7kSNb)IJ zCb_KTQzS3R3dt4yewpNDStYru-l}}v* zO)hk;QS;xXo5O4_nJpxj;t8`2X-JcPO_?Ke^WprhUBBacJy_I+MY!;rqqa`XFVig` zETq`x9VU(64SLaRC`?e=2P4e;0a@sW`7LtQ^~3oc6?pBS+OYl(*-!1JAE->;*esuio}Nx8CmV)|IpEJg&F=V0Cvdw46sR zw@<1pTEd5)jPF-7F03XK#(aU5+7}QkU}QgUkUfQ48=GI>y+@B~kp{F~(G5O_g=W(a zRI@oxLZWLqt1BLF)N-NKZ1!4Rr`ZgP&1Tn=eHYKAX7gdc~fA!okc(HFOyzi1QU=P><4|oK!GzNT2 zNYUZa)L`ctFYrnhafMA$CEOP1RuiG&I*%iuh2G7O`$slZZvcGNE;63y`^zKiUV$7a z1T$mo)Em$`5jVZXRj7&iQOPKYAsb@{rfGJ7Q~_xj@`ND<5n!?wAg-KUqQ{wxs;ocB zc%znAFh`xnZ3VXx6A+=9Z5q)5t3vYOIMKl*LZEMq5C(OuQS&d+Eg^(sM4>+96y#B` z=c3GL=VMaLuSZE{j1>ry>06<|O^TTu0?^5r9EFOv>nI9KxD#!=*k8^lS&hdh?>mAI z`~H9riGpWVDR|6mB)g%IF&p^Ti{H0XWMCenEXJd^C^qK}@n2_L*4{AnC0@v9J z!kp@C?*vmoLT>#yHG=PFjCdsz2J9Joo@N)UG(`!Jt7nu{MxKr${wNRBd3xhG@L!;L zA7b?=>^1!8Yg0=v?A{u+lZJh9T~`t(!yieJ0ue`!`T#ebqeh7eoW4peLB29l@^a{r z6O*VPgPqRi2y=yP9y!x+aX zB@%2%Xn0Dh3+OP~J4zqSH8Vr@_c6qKlSqGyhI~W^6Ba+mS18|%+?sUWrJMaGy^}Ei zDOJ`9`=7EuP+N<}A^+qgA#fL#==~eBVYU%)FQX)b-zWgABWGV!<(#M2j+6K<)4Xd? zfgL51@mR<%utx-E^>MMQIcYJ(~jD-M7o)nb|2|xlY8}etybCw)}rothp z>v4ry5ly&4={$)U_o+Wght;g&i3t(FX|hi&gAVz%xC~O@;!6_Y52;rABpTB?TO$0J z(R2EUo@sTEIxY>6-Zr5ilMK-}6B1Y(Zr`6yfMovz%7929Q3WIv7#WwpQz8EaHUmi} z_REQy*Mj?_W5O*{jXa}qwoq?pbS$M_jY9sl%bd?>;U*T(z>K~|tzsAGtACZg_Z7BN zA>b8aG_;a`eCV%C4M+ry4o)4Hs9$w@*Cn&g>k3Dy&LavuQqYo#*|d%ctuLd`_OFl> Ud=w{DepZ-9*(#UfziPSkKSb^`pa1{> literal 0 HcmV?d00001 diff --git a/cmp/regex/__pycache__/automata.cpython-37.pyc b/cmp/regex/__pycache__/automata.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b6b332c11e1d12d135246a95006c09f84cef7ca6 GIT binary patch literal 10003 zcmcIqU2GiJb)GwaJG)%2Xqu)ZR#9X_RlJ5n*=d@(sjAqHtTc(iDv@B>tmXA;?~q(_ zxl7&|$|O6BrlJ5-0c4~tTBJb(P%lLT^r0^;(5DtfANo`jeJbXm4=qr@KvAFp3KZ@` z`+eu`&Mqm+ZsTT&xpQac%)MvsIp;e+m##FyRo?*r}@N{cCy-QcT-%nNHY9+=)8<0nMV^li%L6-E?982cTX*XZ5?26Ux&Jc zbD$$##yQj#Ojgakg{!X^g*RIP8vY_2T$HckNIpQ5smy6OnU7YbZszXs+RHq&e(LTy zI0ss3_nwo6nc7oV9HA&}U&*|K=%I7Px%JZ9?%QrZ=!gAMTFy$^+jEn5(+ZYT-BnpB zb5=`PaN5bjOBii6IGD)7he|n{uimuRRUPnJJK#B7Xpvw3TpVQeI*w!-O&jF5Dt(2s z`W<)EzwZ3VG5jzrr#t^b9wccqjpdFsAH8&OrMDhmTFva=w3l4Gwv(>( zx))o$Ugu(KedD5um*ee=&8@Vz-b|bG8#^CWF6nkFZS~eSE>}4{c?q4}b6C&$Mx)(r zr;Wz^rB1Ka>?D`xN5pxAr{JN{*gf<0?ww|*t!qRGRaX)m|CU} z1y`N5Fqux3hKk))J2l?P)M;4iX()j2r0!b9d{H_4)82LGO{*^c!tUg7ovrjIFrZZm z&wd~I%cF0`JF+Hq*PJFrX-H;2PQL5Ocq3_ddfmp@8b1ZPMDPV4<>IqyYWE~R>loTX zbGa^jN51f%&`F(Dd>M^a`wzUn%G802dmfR7_(HRNAV#qLeSEop5Qt%YR}9PTdwoCi zbZN~s3%b&EGq3LrN5}vMnTvPAwa|2Qwd-QM$p;<{YWr6*ALjXTKPadJPzM9*9~`Cz zO$j_j7%jkTHGSfNFJ_wEbT+>PQyo0le7}rYrt}k*A|tX*FHqB#O><)s=s8;#AaX2(7;pW#fOWka6KFS8lVE=mvNtb4RLjA}U2Sx!c0s;^(3FGLGab zn!;J0_#|f;mvlu>+=F9VjL@&@N$Hn$4SGEVZ8+*g$qE5PB=8P8DIyEHNVr7EfG%=R zC3C5JSK*0gpA7E4z`NFMgW9vyeJ_R0XGB6+cji9~ly%ABE4;5S`)NioW(w3BvspzQk?FLHRAkMHb$ z7T2Xp1#TD)Vf95YuL_kLkG7ajj& z)}V+I>LqyFPA3m#VG~2IW6^@FiK6GF)|N3bgb-LeJH`=@SQLrKdp}1$tP7e`v+gtu zZ?`(m&+(p>BHWn+Rx`+gClznXGXg#B7Cv?U7@sO~xp5V%BoV?l_yv?FBqq-D80q8z zZ2V6AOCw%gHLHBO%d+swr-jG}5!5a*ATEPt6O1tiq~;2M8qWL}R0@Gg2$)_4g(!rh zb}KTG+%A@c`bY`LOfR5gp%TtuF}s1ga$H)|4=(xrN9A+>bjYTY-l z<5lxbHnJLY0azZc2E#bh?k?wkYo%$92rw@jK3ydRp0PQi`u{+frch7TJZ)tsk7(wz3p#^ zPP~e63nr8Kr=5PVa|SRCrz#*GWC%wIo^j|5-X7Dt%$MUZ%ZyS`ko<3t7LR<2+&Y@$x3c<7@82k=_GAyEE^fpKy7QF z5F^gRtqslWNbESYg5x3y)Gh`bB9W*#FWDU6=;XOinm0Kw*=NX4Eq2uz7fbYfGL;C2N8<~6HK6JR;2lRTXA8bFH1u)BV{V)qNZ>?nJLF3zm z5rPN?spC8rfBGg%^-M-ROB-Mskk)likf!KyLeid7!jO0MU+?VLpr6Rf&fxCC24vKA#j zPA7DkX&r=i0~S+VtAO`8Ycu-_w8a~j99Yl|SkMj7UcTwrz|4-`kJ8DsmU*Z@L{K8H zU(U*~vFd`YaL}jlM;UXC#chrvq)cIjkYpZ?kdy@T1A`NZ9|E-^?%2kFgScb&Gb8vN zGrD0k^x=Qw_aT`nB>z+4Xn(}f@e?tQ0>VraVfHC_Ec2m{7u`Pm>3Jn?K(n{R5=N*> z*Y#jD-__mPFz1FddHU(6A7Ma1j%&Y677(9iY86pDTJ>8autR(rwUdTaJaV_qWK1GJ zg2xfVLqUedEztM7LrwsFXOERdL0Uf{HfV#181ErS>+TrM3EpP&1RElkMM|P-?jr;%evJy?3RRO+Bv%chPK7Z4} zn-J$QZxR%OBX44^!JA7GUU@Q>TJ^}qGRlsCA{klcEy>%cgK%a6nMm#^dk1_+2;U-b zJPi==5#hU8*}lK|k1{^I%__LnWzbeKe?!QC^YeFZTG2I;slnR?GjX2EJFIuG)&{)F#KjbJhekkfQMFh3gMSX4zI0|L`lw6oq z%p`n#;Rqi;8u20Jl}|ZQu9g6jYZ&y%Jbyfz=TlB$*5zAF=VK=^pC?slt&lN^O}NA| zrM^i~)+che`67-ljFmeB!JM&FlSLR?6XncyMA{J`Nj_87_mXpHXuUoX z9>heb;XEV98TG6L0#mSPvk98x?bIE&Q}q+rDK`UtGCTE;ym`n@w=XaWf|Z@=!{M&_ zVym>Zh}NqEL4rR35}d;CE4<#D?FS0jdO-IHMSs6vY_i&k5OHeHaJ9-EOX z+Ti7=b|MNr(q$Rqc!i!lekJ}4<2_cftLhA#)2u6sZ9rMrI~`CF<^CHk80BgN{^Je^ z;s2v<$L9{xnA<@#3%7$TOk9Okwr9qihX=O-WwdIzy#iHbvHP8VX=eua5d&KVL=G3- zbh^(W?hKHr{fUh_({K;@3DtT;$=H+S(kwbCWl}(w9!!8^Nh!Q*Rasjl_C$#zQDSf+ zZe^gv{~vDUV>J06D4c<3IX{x0O<|7HVXI!B$7}WSB4Pgb;Cy=g}t z>Ds_c2yRXtW%KX&4bPw{kdv4RrK%#QoI#9p2G}`+m2lWtsYS5rokqkXQ3R8CAQTk~X_7NgHr^9u!(A$mmz7RC$T{)mAkCi{ zD9?AS^6&{_4$w)uGJ|ww<|cNJxfP34DYP|R#2805GmEU`0+>cze0C6;hh`308aKO~ z)6hUY4AaMIq~qbnFijDW(57uH`5Jovj$@dn{4Do6klJpwla+?Vq{*0O4AYguaH&lN zgXeJp2G5W|6m84qlx1+0>^Xzk3uN}k zBW54r;yRzvrAq)NRg%XAU)V+IZEe`GN2|g3>pzDRApW}Wv8z$UU?}4T>DERkwwZw} z@f8eXm>Edz#C#pSdSu??4GHJ(pobl&jZQn2x3IMpuiuW1Z2Xul(vdGL3n?vRi%CpB z%G1AsVz8qsp#&0uY1C1zLCm`5*YUhqERM=Ug8kn^Cv{S0xu~>%0Mx~X9gu4kWfg2D zpfBn!CNQL;A@J$;n}^*<9X?V8Bdl;?6M8F=?;uA-dR}6ZI3{TXnuL>qO66+%(e#{> zMxCL+!wZA_YphT?ruQRBM~3TWrrA`{HvJG?Zc-c-E+-vfTEBzy(;TRB58V6 zTM)i4o67f4yIGZL4gWO)o|b7FHq0pvO8CCBeRp_u>khU>xSi~;dZ-#L(QER5GY$et z0B_(a{)+?kp_0a3)P}--v~!9fT2aplle=k2YB_HJ79;r7KN?hW;5o6qFrXD^d;`$< z26W^l=t%i}2O!Mt=?H-9tX9YyAh(PP82|c9_MH$AJZ{%XwU7Jv14Ez2lzr&f zKar(k^GOO|R}01n<-~=;$W{pEFfv(b_?cBmcC6?OWhF`tahp*iN;5&btK)5pSscxJ znVaZc7-RC;Pg=L47+n*U&QBb67D--?yIZh4)}{q%1#@ROp+F}W)&lRZu_wWW#KN!e z@+zA8#HgTa(e*ogBvqut0dcO(*Z}+}eDiOTSdf{pF literal 0 HcmV?d00001 diff --git a/cmp/regex/__pycache__/regex.cpython-37.pyc b/cmp/regex/__pycache__/regex.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cbbd2e8eee36a315175b946b08e0e95cb66e8842 GIT binary patch literal 29214 zcmcg#378y5b?)xD_tNU#wPkyZZCNW@2eK`Uu_eorRzAd9wpJLAC67nbEornfJFA{q zTUusp;}t<6v10-ugewx5Bn}}!zyt^(4k6r_BZh>|!QpU>fdC=r=KJjYuWD+xx~6+~ zBz0@|o7&ga|NCFnt5?<4v(;TU_4amY_(?xlymw$s)1IRP@e_q`BR-WkBQZ5oFKQ({ zqnC_~QHo?DI^`L~XepM7F*#C^-4 znG23dz_`#;`?qj9>5 zvw*oTTcwCb9#NHn8M@6-GBq~3+!sinM~l<3J5kbV~8Lk-KC z>jXMmRh!o8EEvgkr;IurcM>6gO5Yo;8}$ftmv$1)Lr!-+UQg7M^;Es9-d*ph_tyLB z3+nv{W4#t%4u>z-%$ONJt{pI5p@9kEjS*$`*r0|0CfUkkIT&XI2Ip(hS^}7^R$heV zEkItklGl$sbjGGVhBJGm<7ll5W0g1`1#`E#z;&Fg=_q#!JpHcxo>~m~y~tlE<;TFc zsCA4ms&&=+fa?Nov62scbBU7I#1gl;R60kUf7ytmZy%jXjHZXvThcox&qpiO(yP;} z(nIMA8^hAiJe9sDy)V5ceMNe6o(4+#p}*7#cH>i_sHmbfO?{A3V^Etmz#SQ}6FAeL zjyj~<)VC1QdPNB=CwYA_SK4ppHeCk9ukg{PF5>aj9NX7kUo4{&RyIN4NLM+izp`>r z&*Y_mb%R@H#$bIl&MAiNE0DL6@~=eVqU^M4WE$it{>RV8Do-0{RqP>8O7b-G1PzIz zMW$&;Y4EAOuLr0m2AG&asr*7avh zOp~=ah+pbS?CS*PGrC^SLAfD#%Bwsn1MurLp2RWavhHvmgsMhYXBwiWbtcg;rON}A zO`Qt!gkB<>ry(~I#(&tLE39m=eN?om31Eyy#rcfA%+pvLxvX}VLLg&R%;}o-BdJ+G zNRj4%9BmGXRL=$taYGSqzmpo%{FK#rC~8w&Io%`W@lnghMfr;Sj6DcjHkoyLP_=3y zU$QXoHQD5exlJl2^*@{DpEk{psDoE1!IUbRj2L=Pisk2#)%u~Xaw9$!x@@)X7E zc3+pR=JppYC(e(Y0XODgxms=_q9h~AY3gqiACE@n`C0cDLOy)ejOy)ee6_)TM3p~jJPqM&cx@<0FwiaRZ)6K<$8paEzH?3pJxb(Po5O*yo zFCmxtB9|-30bk^xf;`U`dA@?=W%erP3I%zAFXx2{lKaPt^CAVwz2}8YD@fj6UdW3j zm>g5uK0hcq(#UL40#pP;^kjsUfp85#@y)7 z#z&vkR^65cRhA>prY;cqZELG~I4;8AXiV^Q+W z5(8;@MP|F!jf$36l(uVaQM9}wwq5HcMawIC+qJeTT3(UduC-0k@`~zqt?i1ISA@4~ z4J%qewDpU2tsRoq&8=3x#Uz>6@mBLT$egX4$-EXlOy*_lWwN+x?3C~%3p~jJPqG|Q zuWa@#{N-nmjvyu@=Iv4mNlW&;zt%2AOO)*n#V%~HD;oad%$=+k?3Q#1FGq+MepJEB zCG^7YQSfq9c;R2A;N^Jm!r!IfY@$}vCi5oy1f_xB0+97a)7;vu|` zXIgkm!Tb29g+HL+eZ17dA5`!@zG~qQDR>``weSTAe;BzwF@rPkDEu>~;Qjr>@kIsi z?;nmYDR_VXaQwJ}_xBISmleFfe>i?Z!XKH_KZr8;$5!zE{^9tFg7^0i$5$1+zkfJ> zQo;NChvV;8@c#bc_y;8XQN=%Eyh2aKm~%`)%ARo}rxc{@6F2fT3R3ol8(CA3vLD>Y zx`LEF;6^?uAs#D^6v#97<5zFq6JiWa=zfz~66me(w+-PW|C zCAXA+y^bqda;y1ky-v}RThL$Y*Ay+eHT|_-uV~3F>#ub}()x9@CD-aUN#>>PVX{1O zin$Hq1(E*-g+ca=8~GawlGm%3@$**bGk>!cX}2($vps4)*2;I^Pqnx2Z%I~2tFs7v zT+!+*0^g`;brylYt!Q-?fp1c@I*X+@D_XzPQO|mdqSaXh{;s0cSp>dS()vB0Rz_VB zX>U`IUM^0N$dT_3%)qcSF5#aeMHgnYQc7`rxY!()@;}MsG{Z7UhP_cu4sA1 zL%Y_;6fGdyVxwK_+<<0yE4 z|8V?2DtLeYaQr_hcz^$J{68yrfB$g&zbJTr|8V?wB>Z>h^bev8{`sDQ_xBISe_z4- z`-kJ7Q}F)v<@kS9@c#bf_#Y^EfB$g&4<-DM6#t0v3OyBbzaJ||*)wirLqW0XOnz67t_rcg`6xN#?bSF$FYyskoeoynT zK`S%t>yU^HS{cMZB7@cp3FYQ`AVx$>!bCn>J;f42%;+^Ie&_aWd$w-3ug0-!At5cc zm~TbiJWGx41_fJqGj*kVC4#&bqJ4?vjDAJXCCP}A%;@fwpaInK9>MMCtAj50UcntS z@jgL3qYnkmeXrmSn)tr3h;v~P?-#^2^}^Hk$2?0X^MXBSVlymaD=gvzVG$n;i}+Aj z#D%bk4~IoOCW!5wki_*YPPudin$h>!v`qH2qkNvrQ;7`F8p|1djW9~f{_R&G5gD}T z+`bEm%X*0Gb8Rw6rD~*9tK^Y0UpLE!pwn45JJ~7;jYF>b(<)3>l30g0!^P-5vYau@?rk80Gr;>63IDMh#$jg=H%cgr-G+^P4JYp;3@0DQ$83x z<-@^KzBYKuM+9Y~7m^r**f`eg4AkLln!PpH`g>ZPZqxG)u0U>e&$*v(;*Sl8=bL;V zGA)z{Wey zfsJ8WdbKN45lb@KfHO+e-tY@Q_Iw&61X;`fC`{Qj_rKM)r2hr%NMupqYSX8W{5W1c5V zKO)$JCVna`;*W+!{IRfzKOPqGCj_xgUzePA3({T99HYi31$)rMp9+ik>9B}D9TxFt z!Xo~xAa2m(d#)BdtNF#}1aEMZpAVk$3&B%f3@hI7&xQHt4Z+ zG3Oto+(Sq@Gt^06{f;mc9OZX|r~F>0f1Y+}8a{um?^2A7K&yXIRAl6&CS-heiB9VG;jtSj0175&xecwr_>hpcmALN!5jP zY7B`h#C`93JDF6yK$LA?p`I1xi@{UUs|5otr5-$`5jV9cCE1L3W@-T*M~*CAuQsn!y?`o7V))$ z*sh#OXmnG6`M+KH<%0dRLt`G|>%t=wa(+MzKI z@z$`2w}(Z%BP`-u!Xmy+5H~JYL*uL_13Lw;D=5y2@|D3;js#D6d+?OIf~UMgP&QTt z+U%o(H@IfsBPg*}|6&x@rum3Xw~Uw@(Ru=}Hvwn*vaUA_)3-8}0SZ5z-XHD#yIP<9 z?b6fI(QN)|=+cLN`QP=BE@j6X_1WJp{YrM!ZmCN*pvhBuJ@HD<53$ew5{n;ly-vS$ zR{Zrs&T_4mO1Tkwv*jd=C~tdBHcI93_YP<9(iY6Kf5Y&E@B{bAe4e1P@LEru=l@7% zE0!sKZop?NMH4->dKRyU=8xXCzapAHCfojsXn|K>5iRhuuZZq97vgc=MeKzfi_Il1 zd8xUqB`-GzAoIs?dzj4m2bnB52Z51gjz7=rmhwp!`R7CCc2}4ev@i)KHy`3 zB{@nCQo_DyWe=3@q{C|{$xyPJlDjFni;`DULQfdjSxWAsgoYFQFeUVbmR+V~0tqJ2 zG(^ocFySrpv#&MJAciWNpfT65G}~ePq^SXS@Xi`w@4S!OWWwG|$&Hk-|MTBO(l$zH zwStt;iU9VedD0RuvhPklq&=i9V)>)3y{Wo@AP3WsTzLeQIjGemuh$N+_s<_snvs** zDQz2`8?Q%A?3-l9>T!G$kLyR*(#{Rj`Zn!xeP0^8Dq&Ngnql8sOPw@M!M{f~)Do4w zHEirNX4repL_I+{_Ear$GE$A!QYWwp5WT(N6uuEAMx2dTo(4WO7Oy;3OVy%d3Hu2z z^mrfTVk@82phnuYB=&Q{TieHsdK@e%vl|v)s3mK$0c;Kg`FT&4MN}6z6VvV;GalFN z8>_Js7#y(i5O}6z$XV~nqLc*;9`!r2;V!Kf2S>3QH~VU_w`=b-ru9d3jx`sY&<-cK zCu$LNkp255fN z=c?(6a-~4Kxuxv_(Ae=IR+%Uks!qxppDbB6w$^eIg$mp640{huOjzTlP4#vb7Aje` zDMdDyZSG%@+I}=|O|VVqBHM2t#y$tlwB-%W1Ot}rNQ|iId>R>hTSff;X}X6aK$n( zgNY)IVwVg4w_jgo^x?QGlEnFCkos|DUj(V&7{K-iea0f)CeA$7l78qf^;&i*djkaQ zaE7g{C@`k=G0je6e+ZT{i2X;#jENKcctFE(gdJlyi2)7$ENYKno37ZPc9?c$!BE{i zt2fW$?X$$hG|`*EeSSYZ_`0`#2@jl*|rq%(V|8?}Ox8>KPg)O&97me}^HnG|(DWNah*w_0u4U;x~4`S0D z@9efTY|j=a+1!~g$F_T8TZOP;mNghFnp6c=8L9_1+u}Qy(6kTc}b3+=wwyBAiCEwGezRx)WMF(Xb z6n&rNrqrc*n)$}2wG~x;b5lzq$)xUEr`Z|Ex~UmVV*f>I&5LX>zXI8FYjk$4@^7(rjK4) zTu=JJ;${@w3B=;-BH0eSEJ+t%-_F*Pc+pFeXwmC$Eh>hK!z_%_g{|$PS%_(Nj7h9`XmO~88GXFbj5z6N*H1Goe^=q~S>=qo2h-$GxxDf+e2NsG?+ zg0*4fiW|c1_g&%9Dbk02C#pY>fnt$5w&rWJ!65q61+NRz?~`s|CMt z)RJ|_3F9zxoTsrar4t|%T6lI&efI4OT;Z@e~2{>fau0B`RgTXLxZ8Ub|rZzmtA9`LECUKD3J`wFToT{6Jo@=Lwf{M7B zh`u{vbIE>g$#(6_=Z{d1j6eBkGVdobxL-PNU$)aEw&TRk0?`j+H^O_j!3#gbctV`) zyRhX#9Q(!vo1Co_i%2$ngftNcD@BkEMSQ`&EudT)k}3y#z#idDPCMBk=;R*aDZ%IZ zZMa?w7y*NjJ<_5DfDzfP?f%!DoYg=g;C2`jhHkcNz z(zuFOudR4FsbbbMXsR&Q0~hVviNAfsAqA2P`x>6~DKxBYaZ4lAY4cg-l}*)lK&|tg z*&`mRqG#fsQ`q0Ya|KVj1z#A=6CiDHl^{BBO1P=yQggIH8!%07i^$y2H{hvuT{Lwit{rS=SLN1^MCQ( zK3($gjY_(T!{Bns;XW4^kMf|kB-!9HNw&hWMrjvcJH=%ACg9~Sjl7jL_gb>G&+|5V zZQ0)E6oT%b4u{}vpjPZBHZc207s z{!3L_u&x8xOq?e|mzr}#wMxV(nsG479LR}sN(XQ8BrTyL z>7bzKO&`sz3N&8CBG#BiMPX6lqZ!%^fT+$jK97QEzUt4RKc{K@G@r)r9Ezl!r;h;B zQSK9rA~DE3q<;E$SOPdxrcjj8r%=)YfAowaDT2NW5;X=(hq{$a^qMsH ztbOA8Vu^b9n5=E;;*Y)#Y^(3{c-lwhRQ6HanGcZaX$@h<;MXf`a1LDNAWt1Urt?PD zK!M$mnwtM7p$W!RE;NY(lzm4U_cifTY3#N3*)Q17*(&!fzjn7S^->b(-&EB45o!wv ziFe;)gl&0y+<%p@cdpbG_!gDg`i;C@qV4D(vI*HfhJI6dXY^Ou!sss;9m}U>Cu?kK z*!7;@h?~A4JJ7NDK+ijJx|;cOH8Wk!Ow0Cto_<_W+ZDAfJF*SDoW^-t+fPB~DS1rE zd0ZaH8eLlNGw`(_>&Z%1P0W_EmU7Bta%xkDZO%$7wz9UgcKMhOS#I#o3bh&RJ+CyH zRT|CE8nVf&?7lX*u4YL?nmv|d7N-SC)U1#5`V?6Z`EV7Nm`&@xmi{K2@>{$79eS6d z!?u>+&QFYNc>>b>E$fgZ`K+9k)~24Hkh92^+Ti!#LzkW@cm6Q`UrFLSVIZ=A5cdmF zIUqznD7u2tmIzWn{J4^_>B183D0C)-kJb_qX2>A~XHiJi6=j48q#dA~9V!F~{4hx; z(-kPAZocq^avf|aG1mq(1MyW7LCy8Jm{e?vfO3~df=!rD7#+auBQ7U*p9wtBWr*&) zCkP%0-_`&SZ=QWa!vUgrLAj#cV<;31Iv#{3{pzdQue1Sb=>v?z#Zp^%Ud)0)!Ts_| zzzaS)0KiAhixJWnGTqkFd-O5_WsB{+@EDLCzFaI^j1td{(j|1pyZ;Z_c_llFFeN+O z?(<|97a)rgUVM{!>PCZNh58D{=}IVGMe|!cmE`&#K2l(%e^cor5G zZg-C%PtbH)7^DJj*lxTQl(~fRlz0J6VTM`I$C8aCjK$Z9QoHv0t()KZ?y|~2f=W$w z=`1>z(iAR^mz2qkZl>KQ%A7;VO1wl39c6E-ANqb2l&LB0b;$Uxmj$@s2`^P@Dus($ znaR?EulB4kcKl$iS4)PO>NLQmyy_J^>NTTaH5(5_uO-5@^=jPfAc*dS$uJ$yJB8(~ zle)b|9Q>rZFOo%Z_g2;=!}dCkbNI|7&{7`_YgkBi_-8jqNa4ASBZQsJyI!(Y_f zpmg-6RyR-ble&gf*#V`gcPLrnds1s7Wwx1Y8h%ZChg6<)>+w}wd0phD`hL{Ik&^_ZIR1SF* z{q;eU>Q)SStoBpwt|00%{)(xO0qmfD5mYp&zeJQTsHLCBxu{<(1ziF 0 for origin, symbol in transitions) + + transitions = {key: [value] for key, value in transitions.items()} + NFA.__init__(self, states, finals, transitions, start) + self.current = start + + def _move(self, symbol): + try: + self.current = self.transitions[self.current][symbol][0] + return True + except KeyError: + return False + + def _reset(self): + self.current = self.start + + def recognize(self, string): + self._reset() + for char in string: + if not self._move(char): + return False + return self.current in self.finals + + @staticmethod + def from_nfa(automaton): + return nfa_to_dfa(automaton) + + @staticmethod + def minimize(automaton): + return automata_minimization(automaton) + + +######################### +# NFA -> DFA Convertion # +######################### +def move(automaton, states, symbol): + moves = set() + for state in states: + symbols = automaton.transitions[state] + try: + moves.update({s for s in symbols[symbol]}) + except KeyError: + continue + return moves + + +def epsilon_closure(automaton, states): + pending = list(states) + closure = set(states) + + while pending: + state = pending.pop() + symbols = automaton.epsilon_transitions(state) + + for s in symbols: + if s not in closure: + pending.append(s) + closure.add(s) + + return ContainerSet(*closure) + + +def nfa_to_dfa(automaton): + transitions = {} + + start = epsilon_closure(automaton, [automaton.start]) + start.id = 0 + start.is_final = any(s in automaton.finals for s in start) + states = [start] + + pending = [start] + while pending: + state = pending.pop() + + for symbol in automaton.vocabulary: + state_move = move(automaton, state, symbol) + e_clousure = epsilon_closure(automaton, state_move) + + if e_clousure == set(): + continue + + if e_clousure not in states: + e_clousure.id = states[-1].id + 1 + e_clousure.is_final = any(s in automaton.finals for s in e_clousure) + + states.append(e_clousure) + pending.append(e_clousure) + else: + e_clousure = next(s for s in states if s == e_clousure) + + try: + transitions[state.id, symbol] + assert False, 'Invalid DFA!!!' + except KeyError: + transitions[state.id, symbol] = e_clousure.id + + finals = [state.id for state in states if state.is_final] + dfa = DFA(len(states), finals, transitions) + return dfa + + +####################### +# Automata operations # +####################### +def automata_union(a1, a2): + transitions = {} + + start = 0 + d1 = 1 + d2 = a1.states + d1 + final = a2.states + d2 + + for (origin, symbol), destinations in a1.map.items(): + transitions[origin + d1, symbol] = [d + d1 for d in destinations] + + for (origin, symbol), destinations in a2.map.items(): + transitions[origin + d2, symbol] = [d + d2 for d in destinations] + + transitions[start, ''] = [a1.start + d1, a2.start + d2] + finals = [f + d1 for f in a1.finals] + [f + d2 for f in a2.finals] + for f in finals: + transitions[f, ''] = [final] + + states = a1.states + a2.states + 2 + finals = {final} + + return NFA(states, finals, transitions, start) + + +def automata_concatenation(a1, a2): + transitions = {} + + start = 0 + d1 = 0 + d2 = a1.states + d1 + final = a2.states + d2 + + for (origin, symbol), destinations in a1.map.items(): + transitions[origin + d1, symbol] = [d + d1 for d in destinations] + + for (origin, symbol), destinations in a2.map.items(): + transitions[origin + d2, symbol] = [d + d2 for d in destinations] + + for f in a1.finals: + transitions[f + d1, ''] = [a2.start + d2] + + for f in a2.finals: + transitions[f + d2, ''] = [final] + + states = a1.states + a2.states + 1 + finals = {final} + + return NFA(states, finals, transitions, start) + + +def automata_closure(a1): + transitions = {} + + start = 0 + d1 = 1 + final = a1.states + d1 + + for (origin, symbol), destinations in a1.map.items(): + transitions[origin + d1, symbol] = [d + d1 for d in destinations] + transitions[start, ''] = [a1.start + d1, final] + + for f in a1.finals: + try: + X = transitions[f + d1, ''] + except KeyError: + X = transitions[f + d1, ''] = set() + X.add(final) + X.add(a1.start + d1) + + states = a1.states + 2 + finals = {final} + + return NFA(states, finals, transitions, start) + + +###################### +# Minimize Automaton # +###################### +def distinguish_states(group, automaton, partition): + split = {} + vocabulary = tuple(automaton.vocabulary) + for member in group: + transitions = automaton.transitions[member.value] + destinations = ((transitions[s][0] if s in transitions else None) for s in vocabulary) + representative = tuple((partition[d].representative if d is not None else None) for d in destinations) + try: + split[representative].append(member.value) + except KeyError: + split[representative] = [member.value] + + return [group for group in split.values()] + + +def state_minimization(automaton): + partition = DisjointSet(*range(automaton.states)) + + ## partition = { NON-FINALS | FINALS } + partition.merge(automaton.finals) + partition.merge([x for x in range(automaton.states) if x not in automaton.finals]) + + while True: + new_partition = DisjointSet(*range(automaton.states)) + + for group in partition.groups: + for subgroup in distinguish_states(group, automaton, partition): + new_partition.merge(subgroup) + + if len(new_partition) == len(partition): + break + + partition = new_partition + + return partition + + +def automata_minimization(automaton): + partition = state_minimization(automaton) + + states = [s for s in partition.representatives] + + transitions = {} + + index = {state: i for i, state in enumerate(states)} + + for i, state in enumerate(states): + origin = state.value + + for symbol, destinations in automaton.transitions[origin].items(): + r = partition[destinations[0]].representative + + try: + transitions[i, symbol] + assert False + except KeyError: + transitions[i, symbol] = index[r] + + finals = list({index[partition[f].representative] for f in automaton.finals}) + start = index[partition[automaton.start].representative] + + return DFA(len(states), finals, transitions, start) diff --git a/cmp/regex/regex.py b/cmp/regex/regex.py new file mode 100644 index 000000000..289e9b504 --- /dev/null +++ b/cmp/regex/regex.py @@ -0,0 +1,435 @@ +from cmp.pycompiler import Grammar, AttributeProduction, Sentence +from cmp.utils import Token +from cmp.grammalyzer import ShiftReduceParser + +from .ast import (ClosureNode, ConcatNode, EpsilonNode, PlusNode, QuestionNode, + RangeNode, SymbolNode, UnionNode) +from .automata import DFA + + +class Regex: + def __init__(self, regex, skip_whitespaces=False): + self.regex = regex + self.automaton = self.build_automaton(regex, skip_whitespaces) + + def __call__(self, text): + return self.automaton.recognize(text) + + @staticmethod + def build_automaton(regex, skip_whitespaces=False): + parser = RegexParser(verbose=False) + tokens = regex_tokenizer(regex, parser.G, skip_whitespaces) + _, ast = parser(tokens, get_ast=True) + nfa = ast.evaluate() + dfa = DFA.from_nfa(nfa) + dfa = DFA.minimize(dfa) + return dfa + + @staticmethod + def Grammar(): + G = Grammar() + + E = G.NonTerminal('E', True) + T, F, A, L = G.NonTerminals('T F A L') + pipe, star, opar, cpar, symbol, epsilon, osquare, csquare, minus, plus, question = G.Terminals( + '| * ( ) symbol ε [ ] - + ?') + + E %= E + pipe + T, lambda s: UnionNode(s[1], s[3]) + E %= T, lambda s: s[1] + + T %= T + F, lambda s: ConcatNode(s[1], s[2]) + T %= F, lambda s: s[1] + + F %= A + star, lambda s: ClosureNode(s[1]) + F %= A + plus, lambda s: PlusNode(s[1]) + F %= A + question, lambda s: QuestionNode(s[1]) + F %= A, lambda s: s[1] + + A %= symbol, lambda s: SymbolNode(s[1]) + A %= epsilon, lambda s: EpsilonNode(s[1]) + A %= opar + E + cpar, lambda s: s[2] + A %= osquare + L + csquare, lambda s: s[2] + + L %= symbol, lambda s: SymbolNode(s[1]) + L %= symbol + minus + symbol, lambda s: RangeNode(SymbolNode(s[1]), SymbolNode(s[3])) + L %= symbol + L, lambda s: UnionNode(SymbolNode(s[1]), s[2]) + L %= symbol + minus + symbol + L, lambda s: UnionNode(RangeNode(SymbolNode(s[1]), SymbolNode(s[3])), s[4]) + + return G + + +# noinspection PyAbstractClass +class RegexParser(ShiftReduceParser): + def __init__(self, verbose=False): + G = Grammar() + G.NonTerminal('E', True) + G.NonTerminals('T F A L') + G.Terminals('| * ( ) symbol ε [ ] - + ?') + + self.G = G + self.verbose = verbose + self.action = self.__action_table() + self.goto = self.__goto_table() + + def __action_table(self): + G = self.G + return { + (0, G["ε"]): ("SHIFT", 27), + (0, G["("]): ("SHIFT", 1), + (0, G["["]): ("SHIFT", 28), + (0, G["symbol"]): ("SHIFT", 26), + (1, G["["]): ("SHIFT", 5), + (1, G["symbol"]): ("SHIFT", 3), + (1, G["ε"]): ("SHIFT", 4), + (1, G["("]): ("SHIFT", 2), + (2, G["["]): ("SHIFT", 5), + (2, G["symbol"]): ("SHIFT", 3), + (2, G["ε"]): ("SHIFT", 4), + (2, G["("]): ("SHIFT", 2), + (3, G["|"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), + (3, G["+"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), + (3, G["?"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), + (3, G["*"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), + (3, G["("]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), + (3, G[")"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), + (3, G["symbol"]): ( + "REDUCE", AttributeProduction(G["A"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), + (3, G["ε"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), + (3, G["["]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), + (4, G["|"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["ε"]), [lambda s: EpsilonNode(s[1])])), + (4, G["+"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["ε"]), [lambda s: EpsilonNode(s[1])])), + (4, G["?"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["ε"]), [lambda s: EpsilonNode(s[1])])), + (4, G["*"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["ε"]), [lambda s: EpsilonNode(s[1])])), + (4, G["("]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["ε"]), [lambda s: EpsilonNode(s[1])])), + (4, G[")"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["ε"]), [lambda s: EpsilonNode(s[1])])), + (4, G["symbol"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["ε"]), [lambda s: EpsilonNode(s[1])])), + (4, G["ε"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["ε"]), [lambda s: EpsilonNode(s[1])])), + (4, G["["]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["ε"]), [lambda s: EpsilonNode(s[1])])), + (5, G["symbol"]): ("SHIFT", 6), + (6, G["]"]): ("REDUCE", AttributeProduction(G["L"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), + (6, G["-"]): ("SHIFT", 7), + (6, G["symbol"]): ("SHIFT", 6), + (7, G["symbol"]): ("SHIFT", 8), + (8, G["]"]): ("REDUCE", AttributeProduction(G["L"], Sentence(G["symbol"], G["-"], G["symbol"]), + [lambda s: RangeNode(SymbolNode(s[1]), SymbolNode(s[3]))])), + (8, G["symbol"]): ("SHIFT", 6), + (9, G["]"]): ("REDUCE", AttributeProduction(G["L"], Sentence(G["symbol"], G["-"], G["symbol"], G["L"]), [ + lambda s: UnionNode(RangeNode(SymbolNode(s[1]), SymbolNode(s[3])), s[4])])), + (10, G["]"]): ("REDUCE", AttributeProduction(G["L"], Sentence(G["symbol"], G["L"]), + [lambda s: UnionNode(SymbolNode(s[1]), s[2])])), + (11, G["]"]): ("SHIFT", 12), + (12, G["|"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["["], G["L"], G["]"]), [lambda s: s[2]])), + (12, G["+"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["["], G["L"], G["]"]), [lambda s: s[2]])), + (12, G["?"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["["], G["L"], G["]"]), [lambda s: s[2]])), + (12, G["*"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["["], G["L"], G["]"]), [lambda s: s[2]])), + (12, G["("]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["["], G["L"], G["]"]), [lambda s: s[2]])), + (12, G[")"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["["], G["L"], G["]"]), [lambda s: s[2]])), + (12, G["symbol"]): ( + "REDUCE", AttributeProduction(G["A"], Sentence(G["["], G["L"], G["]"]), [lambda s: s[2]])), + (12, G["ε"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["["], G["L"], G["]"]), [lambda s: s[2]])), + (12, G["["]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["["], G["L"], G["]"]), [lambda s: s[2]])), + (13, G["|"]): ("SHIFT", 14), + (13, G[")"]): ("SHIFT", 22), + (14, G["["]): ("SHIFT", 5), + (14, G["symbol"]): ("SHIFT", 3), + (14, G["ε"]): ("SHIFT", 4), + (14, G["("]): ("SHIFT", 2), + (15, G["["]): ("SHIFT", 5), + (15, G["symbol"]): ("SHIFT", 3), + (15, G["ε"]): ("SHIFT", 4), + (15, G["|"]): ( + "REDUCE", + AttributeProduction(G["E"], Sentence(G["E"], G["|"], G["T"]), [lambda s: UnionNode(s[1], s[3])])), + (15, G[")"]): ( + "REDUCE", + AttributeProduction(G["E"], Sentence(G["E"], G["|"], G["T"]), [lambda s: UnionNode(s[1], s[3])])), + (15, G["("]): ("SHIFT", 2), + (16, G["|"]): ( + "REDUCE", AttributeProduction(G["T"], Sentence(G["T"], G["F"]), [lambda s: ConcatNode(s[1], s[2])])), + (16, G["("]): ( + "REDUCE", AttributeProduction(G["T"], Sentence(G["T"], G["F"]), [lambda s: ConcatNode(s[1], s[2])])), + (16, G[")"]): ( + "REDUCE", AttributeProduction(G["T"], Sentence(G["T"], G["F"]), [lambda s: ConcatNode(s[1], s[2])])), + (16, G["symbol"]): ( + "REDUCE", AttributeProduction(G["T"], Sentence(G["T"], G["F"]), [lambda s: ConcatNode(s[1], s[2])])), + (16, G["ε"]): ( + "REDUCE", AttributeProduction(G["T"], Sentence(G["T"], G["F"]), [lambda s: ConcatNode(s[1], s[2])])), + (16, G["["]): ( + "REDUCE", AttributeProduction(G["T"], Sentence(G["T"], G["F"]), [lambda s: ConcatNode(s[1], s[2])])), + (17, G["*"]): ("SHIFT", 18), + (17, G["|"]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"]), [lambda s: s[1]])), + (17, G["("]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"]), [lambda s: s[1]])), + (17, G[")"]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"]), [lambda s: s[1]])), + (17, G["symbol"]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"]), [lambda s: s[1]])), + (17, G["ε"]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"]), [lambda s: s[1]])), + (17, G["["]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"]), [lambda s: s[1]])), + (17, G["+"]): ("SHIFT", 19), + (17, G["?"]): ("SHIFT", 20), + (18, G["|"]): ( + "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["*"]), [lambda s: ClosureNode(s[1])])), + (18, G["("]): ( + "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["*"]), [lambda s: ClosureNode(s[1])])), + (18, G[")"]): ( + "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["*"]), [lambda s: ClosureNode(s[1])])), + (18, G["symbol"]): ( + "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["*"]), [lambda s: ClosureNode(s[1])])), + (18, G["ε"]): ( + "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["*"]), [lambda s: ClosureNode(s[1])])), + (18, G["["]): ( + "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["*"]), [lambda s: ClosureNode(s[1])])), + (19, G["|"]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["+"]), [lambda s: PlusNode(s[1])])), + (19, G["("]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["+"]), [lambda s: PlusNode(s[1])])), + (19, G[")"]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["+"]), [lambda s: PlusNode(s[1])])), + (19, G["symbol"]): ( + "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["+"]), [lambda s: PlusNode(s[1])])), + (19, G["ε"]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["+"]), [lambda s: PlusNode(s[1])])), + (19, G["["]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["+"]), [lambda s: PlusNode(s[1])])), + (20, G["|"]): ( + "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["?"]), [lambda s: QuestionNode(s[1])])), + (20, G["("]): ( + "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["?"]), [lambda s: QuestionNode(s[1])])), + (20, G[")"]): ( + "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["?"]), [lambda s: QuestionNode(s[1])])), + (20, G["symbol"]): ( + "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["?"]), [lambda s: QuestionNode(s[1])])), + (20, G["ε"]): ( + "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["?"]), [lambda s: QuestionNode(s[1])])), + (20, G["["]): ( + "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["?"]), [lambda s: QuestionNode(s[1])])), + (21, G["|"]): ("REDUCE", AttributeProduction(G["T"], Sentence(G["F"]), [lambda s: s[1]])), + (21, G["("]): ("REDUCE", AttributeProduction(G["T"], Sentence(G["F"]), [lambda s: s[1]])), + (21, G[")"]): ("REDUCE", AttributeProduction(G["T"], Sentence(G["F"]), [lambda s: s[1]])), + (21, G["symbol"]): ("REDUCE", AttributeProduction(G["T"], Sentence(G["F"]), [lambda s: s[1]])), + (21, G["ε"]): ("REDUCE", AttributeProduction(G["T"], Sentence(G["F"]), [lambda s: s[1]])), + (21, G["["]): ("REDUCE", AttributeProduction(G["T"], Sentence(G["F"]), [lambda s: s[1]])), + (22, G["|"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["("], G["E"], G[")"]), [lambda s: s[2]])), + (22, G["+"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["("], G["E"], G[")"]), [lambda s: s[2]])), + (22, G["?"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["("], G["E"], G[")"]), [lambda s: s[2]])), + (22, G["*"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["("], G["E"], G[")"]), [lambda s: s[2]])), + (22, G["("]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["("], G["E"], G[")"]), [lambda s: s[2]])), + (22, G[")"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["("], G["E"], G[")"]), [lambda s: s[2]])), + (22, G["symbol"]): ( + "REDUCE", AttributeProduction(G["A"], Sentence(G["("], G["E"], G[")"]), [lambda s: s[2]])), + (22, G["ε"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["("], G["E"], G[")"]), [lambda s: s[2]])), + (22, G["["]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["("], G["E"], G[")"]), [lambda s: s[2]])), + (23, G["["]): ("SHIFT", 5), + (23, G["symbol"]): ("SHIFT", 3), + (23, G["|"]): ("REDUCE", AttributeProduction(G["E"], Sentence(G["T"]), [lambda s: s[1]])), + (23, G[")"]): ("REDUCE", AttributeProduction(G["E"], Sentence(G["T"]), [lambda s: s[1]])), + (23, G["ε"]): ("SHIFT", 4), + (23, G["("]): ("SHIFT", 2), + (24, G["|"]): ("SHIFT", 14), + (24, G[")"]): ("SHIFT", 25), + (25, G["|"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["("], G["E"], G[")"]), [lambda s: s[2]])), + (25, G["+"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["("], G["E"], G[")"]), [lambda s: s[2]])), + (25, G["?"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["("], G["E"], G[")"]), [lambda s: s[2]])), + (25, G["*"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["("], G["E"], G[")"]), [lambda s: s[2]])), + (25, G["("]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["("], G["E"], G[")"]), [lambda s: s[2]])), + (25, G["symbol"]): ( + "REDUCE", AttributeProduction(G["A"], Sentence(G["("], G["E"], G[")"]), [lambda s: s[2]])), + (25, G["$"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["("], G["E"], G[")"]), [lambda s: s[2]])), + (25, G["ε"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["("], G["E"], G[")"]), [lambda s: s[2]])), + (25, G["["]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["("], G["E"], G[")"]), [lambda s: s[2]])), + (26, G["|"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), + (26, G["+"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), + (26, G["?"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), + (26, G["*"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), + (26, G["("]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), + (26, G["symbol"]): ( + "REDUCE", AttributeProduction(G["A"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), + (26, G["$"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), + (26, G["ε"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), + (26, G["["]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), + (27, G["|"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["ε"]), [lambda s: EpsilonNode(s[1])])), + (27, G["+"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["ε"]), [lambda s: EpsilonNode(s[1])])), + (27, G["?"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["ε"]), [lambda s: EpsilonNode(s[1])])), + (27, G["*"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["ε"]), [lambda s: EpsilonNode(s[1])])), + (27, G["("]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["ε"]), [lambda s: EpsilonNode(s[1])])), + (27, G["symbol"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["ε"]), [lambda s: EpsilonNode(s[1])])), + (27, G["$"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["ε"]), [lambda s: EpsilonNode(s[1])])), + (27, G["ε"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["ε"]), [lambda s: EpsilonNode(s[1])])), + (27, G["["]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["ε"]), [lambda s: EpsilonNode(s[1])])), + (28, G["symbol"]): ("SHIFT", 6), + (29, G["]"]): ("SHIFT", 30), + (30, G["|"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["["], G["L"], G["]"]), [lambda s: s[2]])), + (30, G["+"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["["], G["L"], G["]"]), [lambda s: s[2]])), + (30, G["?"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["["], G["L"], G["]"]), [lambda s: s[2]])), + (30, G["*"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["["], G["L"], G["]"]), [lambda s: s[2]])), + (30, G["("]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["["], G["L"], G["]"]), [lambda s: s[2]])), + (30, G["symbol"]): ( + "REDUCE", AttributeProduction(G["A"], Sentence(G["["], G["L"], G["]"]), [lambda s: s[2]])), + (30, G["ε"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["["], G["L"], G["]"]), [lambda s: s[2]])), + (30, G["$"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["["], G["L"], G["]"]), [lambda s: s[2]])), + (30, G["["]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["["], G["L"], G["]"]), [lambda s: s[2]])), + (31, G["|"]): ("SHIFT", 32), + (31, G["$"]): ("OK", None), + (32, G["ε"]): ("SHIFT", 27), + (32, G["("]): ("SHIFT", 1), + (32, G["["]): ("SHIFT", 28), + (32, G["symbol"]): ("SHIFT", 26), + (33, G["ε"]): ("SHIFT", 27), + (33, G["("]): ("SHIFT", 1), + (33, G["["]): ("SHIFT", 28), + (33, G["|"]): ( + "REDUCE", + AttributeProduction(G["E"], Sentence(G["E"], G["|"], G["T"]), [lambda s: UnionNode(s[1], s[3])])), + (33, G["$"]): ( + "REDUCE", + AttributeProduction(G["E"], Sentence(G["E"], G["|"], G["T"]), [lambda s: UnionNode(s[1], s[3])])), + (33, G["symbol"]): ("SHIFT", 26), + (34, G["|"]): ( + "REDUCE", AttributeProduction(G["T"], Sentence(G["T"], G["F"]), [lambda s: ConcatNode(s[1], s[2])])), + (34, G["("]): ( + "REDUCE", AttributeProduction(G["T"], Sentence(G["T"], G["F"]), [lambda s: ConcatNode(s[1], s[2])])), + (34, G["symbol"]): ( + "REDUCE", AttributeProduction(G["T"], Sentence(G["T"], G["F"]), [lambda s: ConcatNode(s[1], s[2])])), + (34, G["ε"]): ( + "REDUCE", AttributeProduction(G["T"], Sentence(G["T"], G["F"]), [lambda s: ConcatNode(s[1], s[2])])), + (34, G["$"]): ( + "REDUCE", AttributeProduction(G["T"], Sentence(G["T"], G["F"]), [lambda s: ConcatNode(s[1], s[2])])), + (34, G["["]): ( + "REDUCE", AttributeProduction(G["T"], Sentence(G["T"], G["F"]), [lambda s: ConcatNode(s[1], s[2])])), + (35, G["*"]): ("SHIFT", 36), + (35, G["|"]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"]), [lambda s: s[1]])), + (35, G["("]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"]), [lambda s: s[1]])), + (35, G["symbol"]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"]), [lambda s: s[1]])), + (35, G["ε"]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"]), [lambda s: s[1]])), + (35, G["$"]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"]), [lambda s: s[1]])), + (35, G["["]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"]), [lambda s: s[1]])), + (35, G["+"]): ("SHIFT", 37), + (35, G["?"]): ("SHIFT", 38), + (36, G["|"]): ( + "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["*"]), [lambda s: ClosureNode(s[1])])), + (36, G["("]): ( + "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["*"]), [lambda s: ClosureNode(s[1])])), + (36, G["symbol"]): ( + "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["*"]), [lambda s: ClosureNode(s[1])])), + (36, G["ε"]): ( + "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["*"]), [lambda s: ClosureNode(s[1])])), + (36, G["$"]): ( + "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["*"]), [lambda s: ClosureNode(s[1])])), + (36, G["["]): ( + "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["*"]), [lambda s: ClosureNode(s[1])])), + (37, G["|"]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["+"]), [lambda s: PlusNode(s[1])])), + (37, G["("]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["+"]), [lambda s: PlusNode(s[1])])), + (37, G["symbol"]): ( + "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["+"]), [lambda s: PlusNode(s[1])])), + (37, G["ε"]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["+"]), [lambda s: PlusNode(s[1])])), + (37, G["$"]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["+"]), [lambda s: PlusNode(s[1])])), + (37, G["["]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["+"]), [lambda s: PlusNode(s[1])])), + (38, G["|"]): ( + "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["?"]), [lambda s: QuestionNode(s[1])])), + (38, G["("]): ( + "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["?"]), [lambda s: QuestionNode(s[1])])), + (38, G["symbol"]): ( + "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["?"]), [lambda s: QuestionNode(s[1])])), + (38, G["$"]): ( + "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["?"]), [lambda s: QuestionNode(s[1])])), + (38, G["ε"]): ( + "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["?"]), [lambda s: QuestionNode(s[1])])), + (38, G["["]): ( + "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["?"]), [lambda s: QuestionNode(s[1])])), + (39, G["|"]): ("REDUCE", AttributeProduction(G["T"], Sentence(G["F"]), [lambda s: s[1]])), + (39, G["("]): ("REDUCE", AttributeProduction(G["T"], Sentence(G["F"]), [lambda s: s[1]])), + (39, G["symbol"]): ("REDUCE", AttributeProduction(G["T"], Sentence(G["F"]), [lambda s: s[1]])), + (39, G["$"]): ("REDUCE", AttributeProduction(G["T"], Sentence(G["F"]), [lambda s: s[1]])), + (39, G["ε"]): ("REDUCE", AttributeProduction(G["T"], Sentence(G["F"]), [lambda s: s[1]])), + (39, G["["]): ("REDUCE", AttributeProduction(G["T"], Sentence(G["F"]), [lambda s: s[1]])), + (40, G["ε"]): ("SHIFT", 27), + (40, G["("]): ("SHIFT", 1), + (40, G["|"]): ("REDUCE", AttributeProduction(G["E"], Sentence(G["T"]), [lambda s: s[1]])), + (40, G["$"]): ("REDUCE", AttributeProduction(G["E"], Sentence(G["T"]), [lambda s: s[1]])), + (40, G["["]): ("SHIFT", 28), + (40, G["symbol"]): ("SHIFT", 26), + } + + def __goto_table(self): + G = self.G + return { + (0, G["T"]): 40, + (0, G["E"]): 31, + (0, G["A"]): 35, + (0, G["F"]): 39, + (1, G["T"]): 23, + (1, G["F"]): 21, + (1, G["A"]): 17, + (1, G["E"]): 24, + (2, G["T"]): 23, + (2, G["F"]): 21, + (2, G["A"]): 17, + (2, G["E"]): 13, + (5, G["L"]): 11, + (6, G["L"]): 10, + (8, G["L"]): 9, + (14, G["F"]): 21, + (14, G["T"]): 15, + (14, G["A"]): 17, + (15, G["A"]): 17, + (15, G["F"]): 16, + (23, G["A"]): 17, + (23, G["F"]): 16, + (28, G["L"]): 29, + (32, G["A"]): 35, + (32, G["F"]): 39, + (32, G["T"]): 33, + (33, G["F"]): 34, + (33, G["A"]): 35, + (40, G["F"]): 34, + (40, G["A"]): 35, + } + + +def regex_tokenizer(text, G, skip_whitespaces=True): + tokens = [] + fixed_tokens = {lex: Token(lex, G[lex]) for lex in '| * ( ) ε [ ] ? + -'.split()} + open_pos = 0 + inside_squares = False + set_literal = False + for i, char in enumerate(text): + if skip_whitespaces and char.isspace(): + continue + + if not set_literal and char == '\\': + set_literal = True + continue + + if set_literal: + tokens.append(Token(char, G['symbol'])) + set_literal = False + continue + + if not inside_squares: + if char in (']', '-') or char not in fixed_tokens: + tokens.append(Token(char, G['symbol'])) + else: + tokens.append(fixed_tokens[char]) + + open_pos = i + inside_squares = char == '[' + + else: + if char == ']': + if i - open_pos == 1: + tokens.append(Token(char, G['symbol'])) + else: + inside_squares = False + tokens.append(fixed_tokens[char]) + elif char == '-': + if is_minus_a_symbol(G, text, tokens, i, open_pos): + tokens.append(Token(char, G['symbol'])) + else: + tokens.append(fixed_tokens[char]) + else: + tokens.append(Token(char, G['symbol'])) + + if inside_squares: + raise Exception(f'Unterminated character set at position {open_pos}') + + tokens.append(Token('$', G.EOF)) + return tokens + + +def is_minus_a_symbol(G, text, tokens, i, open_pos): + return (i + 1 < len(text) and text[i + 1] == ']') or (text[i - 1] == '[') or \ + (i - 2 > open_pos and tokens[-2].token_type == G['-']) or \ + (i - 1 > open_pos and text[i - 1] == '-') or (i + 1 < len(text) and text[i + 1] == '-') diff --git a/cmp/regex/utils.py b/cmp/regex/utils.py new file mode 100644 index 000000000..f74bc95ef --- /dev/null +++ b/cmp/regex/utils.py @@ -0,0 +1,196 @@ +from .automata import NFA, DFA + +EPSILON = 'ε' + + +def clean_regex(regex): + stack = [] + invalid = [False] * len(regex) + for i, c in enumerate(regex): + if c == '(': + stack.append(i) + if c == ')': + j = stack.pop() + invalid[i] = invalid[j] = (i - j in [1, 2]) or (i - j == 3 and regex[i - 1] == '*') + + s = '' + for i, c in enumerate(regex): + if not invalid[i]: + s += c + return s + + +def process_closure(re): + if len(re) == 1: + return f'{re}*' + else: + return f'({re})*' + + +class RegularGrammar: + def __init__(self, G): + self.valid = self.check(G) + if self.valid: + self.dfa = self.__build_automata(G) + self.regex = self.__dfa_to_regex(self.dfa) + + @staticmethod + def check(G): + """ + Chequea que las producctiones de la gramatica sean de la forma + A -> a B, + A -> a, + A -> ε + donde A, B son no terminales y a es un terminal + :param G: Gramatica para chequear + :return: True si la Gramatica es regular + """ + + productions = G.Productions + start_symbol = G.startSymbol + + for prod in productions: + head, body = prod + if len(body) == 2: + if not (body[0].IsTerminal and body[1].IsNonTerminal): + return False + elif len(body) == 1: + if not body[0].IsTerminal: + return False + elif len(body) == 0: + if not (body.IsEpsilon and head == start_symbol): + return False + else: + return False + return True + + @staticmethod + def __build_automata(G): + """ + Tomando los no terminales como los estados y los terminales cono los simbolos de las transiciones + crearemos el automata finito determinista con un unico estado final y tomando como estado inicial + el simbolo distinguido de la gramatica. + :param G: Gramatica Regular a partir de la cual construiremos el automata + :return: Automata Finito Determinista con una cantidad minima de estados + """ + for i, nonterminal in enumerate(G.nonTerminals): + nonterminal.id = i + + nonTerminals = G.nonTerminals + start = G.startSymbol.id + final = len(nonTerminals) + + transitions = {} + + for head, body in G.Productions: + if len(body) == 2: + symbol, next_state = body + try: + transitions[head.id, symbol.Name].append(next_state.id) + except KeyError: + transitions[head.id, symbol.Name] = [next_state.id] + elif len(body) == 1: + symbol = body[0] + try: + transitions[head.id, symbol.Name].append(final) + except KeyError: + transitions[head.id, symbol.Name] = [final] + else: + try: + transitions[head.id, ''].append(final) + except KeyError: + transitions[head.id, ''] = [final] + + nfa = NFA(len(nonTerminals) + 1, finals=[final], transitions=transitions, start=start) + dfa = DFA.from_nfa(nfa) + return DFA.minimize(dfa) + + @staticmethod + def __dfa_to_regex(dfa): + """ + Convierte un automata finito determinista en una + expresion regular utilizando el algoritmo de eliminacion + de estados intermedios + :param dfa: automata finito determinista + :return string con la expresion regular que reconoce el automata + """ + start = dfa.states + final = dfa.states + 1 + transitions = {} + middle_states = list(range(dfa.states)) + + # Compactar arcos multiples + for x in dfa.transitions: + # Dado el estado x por cada estado destino d se unen + # los simbolos que provocan una transicion de x -> d + compacted_arcs = {} + for regex in dfa.transitions[x]: + d = dfa.transitions[x][regex][0] + try: + compacted_arcs[d].append(regex) + except KeyError: + compacted_arcs[d] = [regex] + + # Compactar los arcos multiples + # etiquetandolos con la union de los simbolos + for d, symbols in compacted_arcs.items(): + transitions[x, d] = '|'.join(symbols) if x != d else f'({"|".join(symbols)})*' + + # Agragamos nuestro estado inicial y final + for f in dfa.finals: + transitions[f, final] = EPSILON + transitions[start, dfa.start] = EPSILON + + # Por cada estado intermedio... + while middle_states: + + x = middle_states.pop() # Estado para eliminacion + + # Computar indegree y outdegree del estado x + # con los arcos compactados para tener un acceso + # mas rapido en cada estado intermedio + in_deg = [(s, regex) for (s, d), regex in transitions.items() if d == x and s != d] + out_deg = [(d, regex) for (s, d), regex in transitions.items() if s == x and d != s] + + # Checkeamos que si el estado x tiene auto-transiciones + try: + mid_regex = transitions[x, x] + del transitions[x, x] + except KeyError: + mid_regex = '' + + # Creamos las nuevas aristas eliminando al estado x del automata + for l, left_regex in in_deg: + for r, right_regex in out_deg: + left_regex = '' if left_regex == EPSILON else f'({left_regex})' + right_regex = '' if right_regex == EPSILON else f'({right_regex})' + mid_regex = '' if not mid_regex else f'({mid_regex})' + + regex = left_regex + mid_regex + right_regex + + try: # Comprobamos si ya existe una transicion entre l y r para compactar la arista + previous_regex = transitions[l, r] # Buscamos la regex de la arista anterior + regex = f'{previous_regex}|{regex}' # Unimos las expresiones regulares de las transiciones + except KeyError: + pass + + transitions[l, r] = regex if r != l else process_closure(regex) # Insertamos en la tablas de transiciones + + # Eliminamos transiciones que entran y salen del estado x + for l, _ in in_deg: + del transitions[l, x] + + for r, _ in out_deg: + del transitions[x, r] + + assert (start, final) in transitions, 'State Elimination Error...' + + regex = transitions[start, final] + + change = True + while change: + new_regex = clean_regex(regex) + change = new_regex != regex + regex = new_regex + + return regex diff --git a/cmp/semantic.py b/cmp/semantic.py new file mode 100755 index 000000000..9f8993fe1 --- /dev/null +++ b/cmp/semantic.py @@ -0,0 +1,223 @@ +import itertools as itt +from collections import OrderedDict + + +class SemanticError(Exception): + @property + def text(self): + return self.args[0] + + +class Attribute: + def __init__(self, name, typex): + self.name = name + self.type = typex + + def __str__(self): + return f'[attrib] {self.name} : {self.type.name};' + + def __repr__(self): + return str(self) + + +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 Type: + def __init__(self, name: str): + self.name = name + self.attributes = [] + self.methods = [] + self.parent = None + + def set_parent(self, parent): + if self.parent is not None: + raise SemanticError(f'Parent type is already set for {self.name}.') + self.parent = parent + + def get_attribute(self, name: str): + try: + return next(attr for attr in self.attributes if attr.name == name) + except StopIteration: + if self.parent is None: + raise SemanticError(f'Attribute "{name}" is not defined in {self.name}.') + try: + return self.parent.get_attribute(name) + except SemanticError: + raise SemanticError(f'Attribute "{name}" is not defined in {self.name}.') + + def define_attribute(self, name: str, typex): + try: + self.get_attribute(name) + except SemanticError: + attribute = Attribute(name, typex) + self.attributes.append(attribute) + return attribute + else: + raise SemanticError(f'Attribute "{name}" is already defined in {self.name}.') + + def get_method(self, name: str): + try: + return next(method for method in self.methods if method.name == name) + except StopIteration: + if self.parent is None: + raise SemanticError(f'Method "{name}" is not defined in {self.name}.') + try: + return self.parent.get_method(name) + except SemanticError: + raise SemanticError(f'Method "{name}" is not defined in {self.name}.') + + def define_method(self, name: str, param_names: list, param_types: list, return_type): + if name in (method.name for method in self.methods): + raise SemanticError(f'Method "{name}" already defined in {self.name}') + + method = Method(name, param_names, param_types, return_type) + self.methods.append(method) + return method + + def all_attributes(self, clean=True): + plain = OrderedDict() if self.parent is None else self.parent.all_attributes(False) + for attr in self.attributes: + 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: + 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) + output += '\n\t' if self.attributes else '' + output += '\n\t'.join(str(x) for x in self.methods) + output += '\n' if self.methods else '' + output += '}\n' + return output + + def __repr__(self): + return str(self) + + +class ErrorType(Type): + def __init__(self): + Type.__init__(self, '') + + def conforms_to(self, other): + return True + + def bypass(self): + return True + + def __eq__(self, other): + return isinstance(other, Type) + + +class VoidType(Type): + def __init__(self): + Type.__init__(self, '') + + def conforms_to(self, other): + raise Exception('Invalid type: void type.') + + def bypass(self): + return True + + def __eq__(self, other): + return isinstance(other, VoidType) + + +class IntType(Type): + def __init__(self): + Type.__init__(self, 'int') + + def __eq__(self, other): + return other.name == self.name or isinstance(other, IntType) + + +class Context: + def __init__(self): + self.types = {} + + def create_type(self, name: str): + if name in self.types: + raise SemanticError(f'Type with the same name ({name}) already in context.') + typex = self.types[name] = Type(name) + return typex + + def get_type(self, name: str): + try: + return self.types[name] + except KeyError: + raise SemanticError(f'Type "{name}" is not defined.') + + 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): + self.name = name + self.type = vtype + + +class Scope: + def __init__(self, parent=None): + self.locals = [] + self.parent = parent + self.children = [] + self.index = 0 if parent is None else len(parent) + + def __len__(self): + return len(self.locals) + + def create_child(self): + child = Scope(self) + self.children.append(child) + return child + + def define_variable(self, vname, vtype): + info = VariableInfo(vname, vtype) + self.locals.append(info) + return info + + def find_variable(self, vname, index=None): + _locals = self.locals if index is None else itt.islice(self.locals, index) + try: + return next(x for x in _locals if x.name == vname) + except StopIteration: + return self.parent.find_variable(vname, self.index) if self.parent is None else None + + def is_defined(self, vname): + 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) diff --git a/cmp/utils.py b/cmp/utils.py new file mode 100755 index 000000000..23691eef9 --- /dev/null +++ b/cmp/utils.py @@ -0,0 +1,236 @@ +from cmp.pycompiler import Production, Sentence, Symbol, EOF, Epsilon + + +class ContainerSet: + def __init__(self, *values, contains_epsilon=False): + self.set = set(values) + self.contains_epsilon = contains_epsilon + + def add(self, value): + n = len(self.set) + self.set.add(value) + return n != len(self.set) + + def extend(self, values): + change = False + for value in values: + change |= self.add(value) + return change + + def set_epsilon(self, value=True): + last = self.contains_epsilon + self.contains_epsilon = value + return last != self.contains_epsilon + + def update(self, other): + """ + Update ContainerSet\n + :rtype: bool\n + :param other: ContainerSet\n + :return: True if size was increased else return false\n + """ + n = len(self.set) + self.set.update(other.set) + return n != len(self.set) + + def epsilon_update(self, other): + return self.set_epsilon(self.contains_epsilon | other.contains_epsilon) + + def hard_update(self, other): + return self.update(other) | self.epsilon_update(other) + + def find_match(self, match): + for item in self.set: + if item == match: + return item + return None + + def __len__(self): + return len(self.set) + int(self.contains_epsilon) + + def __str__(self): + return '%s-%s' % (str(self.set), self.contains_epsilon) + + def __repr__(self): + return str(self) + + def __iter__(self): + return iter(self.set) + + def __nonzero__(self): + return len(self) > 0 + + def __eq__(self, other): + if isinstance(other, set): + return self.set == other + return isinstance(other, + ContainerSet) and self.set == other.set and self.contains_epsilon == other.contains_epsilon + + +def inspect(item, grammar_name='G', mapper=None): + try: + return mapper[item] + except (TypeError, KeyError): + if isinstance(item, dict): + items = ',\n '.join( + f'{inspect(key, grammar_name, mapper)}: {inspect(value, grammar_name, mapper)}' for key, value in + item.items()) + return f'{{\n {items} \n}}' + elif isinstance(item, ContainerSet): + args = f'{", ".join(inspect(x, grammar_name, mapper) for x in item.set)} ,' if item.set else '' + return f'ContainerSet({args} contains_epsilon={item.contains_epsilon})' + elif isinstance(item, EOF): + return f'{grammar_name}.EOF' + elif isinstance(item, Epsilon): + return f'{grammar_name}.Epsilon' + elif isinstance(item, Symbol): + return f"G['{item.Name}']" + elif isinstance(item, Sentence): + items = ', '.join(inspect(s, grammar_name, mapper) for s in item._symbols) + return f'Sentence({items})' + elif isinstance(item, Production): + left = inspect(item.Left, grammar_name, mapper) + right = inspect(item.Right, grammar_name, mapper) + return f'Production({left}, {right})' + elif isinstance(item, tuple) or isinstance(item, list): + ctor = ('(', ')') if isinstance(item, tuple) else ('[', ']') + return f'{ctor[0]} {("%s, " * len(item)) % tuple(inspect(x, grammar_name, mapper) for x in item)}{ctor[1]}' + else: + raise ValueError(f'Invalid: {item}') + + +def pprint(item, header=""): + if header: + print(header) + + if isinstance(item, dict): + for key, value in item.items(): + print(f'{key} ---> {value}') + elif isinstance(item, list): + print('[') + for x in item: + print(f' {repr(x)}') + print(']') + else: + print(item) + + +class Token: + """ + Basic token class. + + Parameters + ---------- + lex : str + Token's lexeme. + token_type : Enum + Token's type. + """ + + def __init__(self, lex, token_type): + self.lex = lex + self.token_type = token_type + + def __str__(self): + return f'{self.token_type}: {self.lex}' + + def __repr__(self): + return str(self) + + @property + def is_valid(self): + return True + + +class UnknownToken(Token): + def __init__(self, lex): + Token.__init__(self, lex, None) + + def transform_to(self, token_type): + return Token(self.lex, token_type) + + @property + def is_valid(self): + return False + + +def tokenizer(G, fixed_tokens): + def decorate(func): + def tokenize_text(text): + tokens = [] + for lex in text.split(): + try: + token = fixed_tokens[lex] + except KeyError: + token = UnknownToken(lex) + try: + token = func(token) + except TypeError: + pass + tokens.append(token) + tokens.append(Token('$', G.EOF)) + return tokens + + if hasattr(func, '__call__'): + return tokenize_text + elif isinstance(func, str): + return tokenize_text(func) + else: + raise TypeError('Argument must be "str" or a callable object.') + + return decorate + + +class DisjointSet: + def __init__(self, *items): + self.nodes = {x: DisjointNode(x) for x in items} + + def merge(self, items): + items = (self.nodes[x] for x in items) + try: + head, *others = items + for other in others: + head.merge(other) + except ValueError: + pass + + @property + def representatives(self): + return {n.representative for n in self.nodes.values()} + + @property + def groups(self): + return [[n for n in self.nodes.values() if n.representative == r] for r in self.representatives] + + def __len__(self): + return len(self.representatives) + + def __getitem__(self, item): + return self.nodes[item] + + def __str__(self): + return str(self.groups) + + def __repr__(self): + return str(self) + + +class DisjointNode: + def __init__(self, value): + self.value = value + self.parent = self + + @property + def representative(self): + if self.parent != self: + self.parent = self.parent.representative + return self.parent + + def merge(self, other): + other.representative.parent = self.representative + + def __str__(self): + return str(self.value) + + def __repr__(self): + return str(self) diff --git a/cmp/visitor.py b/cmp/visitor.py new file mode 100755 index 000000000..20800dca5 --- /dev/null +++ b/cmp/visitor.py @@ -0,0 +1,85 @@ +# 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/main.py b/main.py new file mode 100644 index 000000000..f05dc0f48 --- /dev/null +++ b/main.py @@ -0,0 +1,21 @@ +from productions import * + +def attribute(nonTerminal, sentence): + from cmp.pycompiler import AttributeProduction, Sentence + def decorator(attribute): + G.Add_Production( + AttributeProduction( + G[nonTerminal], + Sentence(*(G[s] for s in sentence.split())), + attribute) + ) + return decorator + +class CoolGrammar: + @attribute('program', 'class-set') + def assignment(s): + pass + + @attribute('assignment', 'id <- expr') + def assignment(s): + pass diff --git a/nonterminals.py b/nonterminals.py new file mode 100644 index 000000000..34ad39b62 --- /dev/null +++ b/nonterminals.py @@ -0,0 +1,24 @@ +from cmp.pycompiler import Grammar + +G = Grammar() + +Program = G.NonTerminal('program', startSymbol=True) +ClassSet = G.NonTerminal('class-set') +ClassDef = G.NonTerminal('class-def') +FeatureList = G.NonTerminal('feature-list') +Attribute = G.NonTerminal('attribute') +Method = G.NonTerminal('method') +ParamVector = G.NonTerminal('param-vector') +Block = G.NonTerminal('block') +Declaration = G.NonTerminal('declaration') +CaseList = G.NonTerminal('case-list') +FunctionCall = G.NonTerminal('function-call') +ExprVector = G.NonTerminal('expr-vector') +BodyExpr = G.NonTerminal('body-expr') +Expr = G.NonTerminal('expr') +CompExpr = G.NonTerminal('comp-expr') +SubExpr = G.NonTerminal('sub-expr') +Term = G.NonTerminal('term') +Fact = G.NonTerminal('fact') +Atom = G.NonTerminal('atom') +Particle = G.NonTerminal('particle') diff --git a/productions.py b/productions.py new file mode 100644 index 000000000..ccad85c93 --- /dev/null +++ b/productions.py @@ -0,0 +1,108 @@ +from terminals import * +from cmp.grammalyzer.parsing import LR1Parser, LALR1Parser + +Program %= 'class-set' + +ClassSet %= 'class-def' +ClassSet %= 'class-set class-def' + +ClassDef %= 'class type { feature-list }' +ClassDef %= 'class type inherits type { feature-list }' + +FeatureList %= 'attribute ;' +FeatureList %= 'method ;' +FeatureList %= 'feature-list attribute ;' +FeatureList %= 'feature-list method ;' + +Attribute %= 'id : type' +Attribute %= 'id : type <- expr' + +Method %= 'id ( ) : type { body-expr }' +Method %= 'id ( param-vector ) : type { body-expr }' + +ParamVector %= 'id : type' +ParamVector %= 'param-vector , id : type' + +#################### +# Body-Expressions # +#################### +BodyExpr %= 'id <- expr' +BodyExpr %= '{ block }' +BodyExpr %= 'if expr then body-expr else body-expr fi' +BodyExpr %= 'while expr loop body-expr pool' +BodyExpr %= 'declaration in body-expr' +BodyExpr %= 'case expr of case-list esac' +BodyExpr %= 'expr' +################### +# end # +################### + + +#################### +# Body-Expressions # +#################### +Expr %= 'not expr' +Expr %= 'comp-expr' +################### +# end # +################### + +CompExpr %= 'comp-expr < sub-expr' +CompExpr %= 'comp-expr <= sub-expr' +CompExpr %= 'comp-expr = sub-expr' +CompExpr %= 'sub-expr' + +SubExpr %= 'sub-expr + term' +SubExpr %= 'sub-expr - term' +SubExpr %= 'term' + +Term %= 'term * fact' +Term %= 'term / fact' +Term %= 'fact' + +Fact %= 'isvoid fact' +Fact %= 'atom' + +Atom %= '~ atom' +Atom %= 'particle' + +Particle %= 'id' +Particle %= 'true' +Particle %= 'false' +Particle %= 'integer' +Particle %= 'string' +Particle %= 'function-call' +Particle %= 'new type' +Particle %= '( expr )' + +Block %= 'body-expr ;' +Block %= 'block body-expr ;' + +Declaration %= 'let id : type' +Declaration %= 'let id : type <- expr' +Declaration %= 'declaration , id : type' +Declaration %= 'declaration , id : type <- expr' + +CaseList %= 'id : type => expr ;' +CaseList %= 'case-list id : type => expr ;' + +FunctionCall %= 'id ( expr-vector )' +FunctionCall %= 'particle . id ( expr-vector )' +FunctionCall %= 'particle @ type . id ( expr-vector )' + +ExprVector %= 'expr' +ExprVector %= 'expr-vector , expr' + + +if __name__ == "__main__": + print(len(G.Productions)) + for p in G.Productions: + print(repr(p)) + print() + + parser = LALR1Parser(G) + print(len(parser.action)) + if parser.conflict is not None: + print(parser.conflict.cType) + for item in parser.state_dict[parser.conflict.state].state: + print(item) diff --git a/productions.txt b/productions.txt new file mode 100644 index 000000000..1c68b603d --- /dev/null +++ b/productions.txt @@ -0,0 +1,60 @@ +59 +program -> class-set +class-set -> class-def +class-set -> class-set class-def +class-def -> class type { feature-list } +class-def -> class type inherits type { feature-list } +feature-list -> attribute ; +feature-list -> method ; +feature-list -> feature-list attribute ; +feature-list -> feature-list method ; +attribute -> id : type +attribute -> id : type <- expr +method -> id ( ) : type { body-expr } +method -> id ( param-vector ) : type { body-expr } +param-vector -> id : type +param-vector -> param-vector , id : type +body-expr -> id <- expr +body-expr -> { block } +body-expr -> if expr then body-expr else body-expr fi +body-expr -> while expr loop body-expr pool +body-expr -> declaration in body-expr +body-expr -> case expr of case-list esac +body-expr -> expr +expr -> not expr +expr -> comp-expr +comp-expr -> comp-expr < sub-expr +comp-expr -> comp-expr <= sub-expr +comp-expr -> comp-expr = sub-expr +comp-expr -> sub-expr +sub-expr -> sub-expr + term +sub-expr -> sub-expr - term +sub-expr -> term +term -> term * fact +term -> term / fact +term -> fact +fact -> isvoid fact +fact -> atom +atom -> ~ atom +atom -> particle +particle -> id +particle -> true +particle -> false +particle -> integer +particle -> string +particle -> function-call +particle -> new type +particle -> ( expr ) +block -> body-expr ; +block -> block body-expr ; +declaration -> let id : type +declaration -> let id : type <- expr +declaration -> declaration , id : type +declaration -> declaration , id : type <- expr +case-list -> id : type => expr ; +case-list -> case-list id : type => expr ; +function-call -> id ( expr-vector ) +function-call -> particle . id ( expr-vector ) +function-call -> particle @ type . id ( expr-vector ) +expr-vector -> expr +expr-vector -> expr-vector , expr diff --git a/terminals.py b/terminals.py new file mode 100644 index 000000000..5a5822efe --- /dev/null +++ b/terminals.py @@ -0,0 +1,65 @@ +from nonterminals import * + +############### +# identifiers # +############### +identifier = G.Terminals('id') +type_name = G.Terminals('type') + +############### +# Basic Types # +############### +string = G.Terminal('string') +integer = G.Terminal('integer') +boolean = G.Terminal('boolean') + +########### +# Symbols # +########### +open_bracket = G.Terminal('{') +close_bracket = G.Terminal('}') +opar = G.Terminal('(') +cpar = G.Terminal(')') +comma = G.Terminal(',') +dot = G.Terminal('.') +arroba = G.Terminal('@') +two_points = G.Terminal(':') +semi_colon = G.Terminal(';') +left_arrow = G.Terminal('<-') +right_arrow = G.Terminal('=>') + +############ +# KeyWords # +############ +keyword_class = G.Terminal('class') +keyword_inherits = G.Terminal('inherits') +keyword_if = G.Terminal('if') +keyword_then = G.Terminal('then') +keyword_else = G.Terminal('else') +keyword_fi = G.Terminal('fi') +keyword_while = G.Terminal('while') +keyword_loop = G.Terminal('loop') +keyword_pool = G.Terminal('pool') +keyword_let = G.Terminal('let') +keyword_in = G.Terminal('in') +keyword_case = G.Terminal('case') +keyword_esac = G.Terminal('esac') +keyword_of = G.Terminal('of') +keyword_new = G.Terminal('new') +keyword_isvoid = G.Terminal('isvoid') +keyword_true = G.Terminal('true') +keyword_false = G.Terminal('false') +keyword_end = G.Terminal('end') + +############# +# Operators # +############# +plus = G.Terminal('+') +minus = G.Terminal('-') +star = G.Terminal('*') +div = G.Terminal('/') +less = G.Terminal('<') +lesse = G.Terminal('<=') +equal = G.Terminal('=') +complement = G.Terminal('~') +not_op = G.Terminal('not') From 014a1a09278b1509d13ba33f3cde9adf885fbf7f Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Mon, 16 Mar 2020 20:05:36 -0400 Subject: [PATCH 002/143] iniciando AST --- .gitignore | 4 +- __pycache__/nonterminals.cpython-37.pyc | Bin 863 -> 2098 bytes __pycache__/productions.cpython-37.pyc | Bin 2340 -> 2355 bytes cmp/__pycache__/ast.cpython-37.pyc | Bin 3162 -> 3282 bytes cmp/__pycache__/automata.cpython-37.pyc | Bin 7888 -> 7910 bytes cmp/__pycache__/pycompiler.cpython-37.pyc | Bin 16739 -> 16554 bytes cmp/ast.py | 5 +- cmp/automata.py | 14 +- cmp/cil.py | 2 +- cmp/pycompiler.py | 11 +- coolast.py | 0 main.py | 425 +++++++++++++++++++++- nonterminals.py | 40 +- productions.py | 83 ++++- productions.txt | 4 + 15 files changed, 545 insertions(+), 43 deletions(-) create mode 100644 coolast.py diff --git a/.gitignore b/.gitignore index c9b5915e6..88fc28409 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ .idea .vscode -resources \ No newline at end of file +resources + +productions.txt \ No newline at end of file diff --git a/__pycache__/nonterminals.cpython-37.pyc b/__pycache__/nonterminals.cpython-37.pyc index a2e04955a97febc89dd3e631d837c2c7960f6e04..4f5e07c448dbe61197702e88d4308b8bd4a0a375 100644 GIT binary patch literal 2098 zcmah~OK;mo5Z)yziF#OeVkfa37d6n64wj0xM*BmO*PkYX-G}+6JuytsArfv|-RapnC@0 z2fA<2CeWrqTR>X|Jpg)O&_key20a3LWY9Lywm~~UI|l6n?HcqL=y9~yXPvM9p(=G8 zU3(#eBnhN$yp&lq4%H}2wc8h|5@{%O^DIkW37L%2AP&i7xom)^c#4M*f_Xe*o)uM0 zF}Y_)4i2g6^&gX5X75C_IOQ}XJ6c2z;Uhf7YlxEHuv>P;OI~a#9`PCfz?D_J38Tut`VAQ98f zQIMvY+K2j%m3z4I&)y~|j< z6S4(R(>j=ULhdvn=l62r?l~if%rU6&TWExM1An4tK4F*5)53yqxzR(w zFKbDBv4>a7hWW&XpgOWXx}N&iVKKIOR*WdL8sjEK0Yh! zvLPeR=%?(GD`#d&PgPdV(OcD9cFbn{Pj+Rg+BGXJ>Z)sY;oj8eeRIwF@HAr|_^&Lr ze!+!dx+lclVHSl$A$*Ug*oG+CZyQ$}F3`F=>@^O5YZ)VsdP>^fv9#6wR`UXS8~VIv zRIbnU!#5%o?{oR&YpAAZ4x9FtB;6sW>-!^+;rrdgI19n}lkOMWP6ItU&V?lI=DT$L z)g%`uQf3(GQ87xj!TO1XN zIQIQj!{Oj>Xp=dZT7}qH_8sZEhD+xS?zLCgN+UL{o0ty@p_ULAz_c|Kff`G35RVF_ z>w&_!55`L9Y9cUg(X^EZ@N)2uMo{X?00dlm%}BtT4Cq3Dx1gBYPuGUy)LfqjU@4w9 ziQR?iv_8n9$pO954oTQ$Np456vpDLv!~l(l4IJ* za1;w^xSO*`w9Y4!rqE1}<}Y*&oKh9Edqj-&g<7CvG1Se|dG0@%)Ss!bDK1n0hABe0&nmRASXOAu~;ArnNY@6eK576OpoXBK2xlbP`P=?GqQ;%*SgBZZH`m!+ z7m|4duUi$dE@o?WlcnXMvrl<>>5L&N=la6fh1AN}w{cP!J1#P1yd1_CNh+sN$b&@X z$N4(RRK7^1)(mbkbi(V?Y&nOWi)EaayY6T8o#+wt^r-x1C!z69RVE%%c}AhQI)cz( N4hzb*w^xom`yV8-bUOe5 diff --git a/__pycache__/productions.cpython-37.pyc b/__pycache__/productions.cpython-37.pyc index c47a8e1f27eb75c24cec1cc17ffdcecba7ba9069..ff63fda66927e27891c62c3e15226a18be363219 100644 GIT binary patch delta 938 zcmYk)NpI6Y6aZk49mjSSXK9+HrH$LLwGyFaZ_Ace9FPiBv=YLHN+IvH3UwBZ9VBwe zAr}xADxbK41P9K&bKoCvwKya31Gw`%aRp;(zV~L{ESBbT{v>a1rqc#==;3Dj65XK_lZB2VJOvL29T$A~G47 z66%m9b=1KW8jv9?1{#p1z`%qkNRT>D zSb(c!0Sj;~@_OVA;WXSNr*Rr?35&2s7O@EHksHF2_}LPc;5OwYEW@26`Mu0JR&WMq z{bji}Dm;_0GM1Qx%17msWLJ^l?3mdWR^aYr469{nEK@}V?$J8y<-(Xn`F+Y3K{+zQ z9F$#Ysqs5}4NELYZa21{uI@Csi=0xn{CH@zoTlqua?v{t;pCV6jj_Q05_?PiWwlEE z6SZyzF^>;0P!F1pi^0h|b)Sufh0Q_R0V~|I-95DS+8wmkhlNJVYxla=gRaNh=vrZ; z(bKA}UiZLhw>+9yU#i)qR;OP-AW5yulFaraeB4%W<2Dbc9#yN3()qqw!?d2 zwXJXI;pKPH3;eoPOa(^6qw`)2JPiCDZJzGk)5_Gp(VUqeNy}g$?&SuoAH+EJdBA9G zQm+_aB|b-|@j3sI{!mRZUDo{%`pR=%XX2aquMZ<5nwwNi^8f26aaa{kFq5TNp2g*G IO`c`hUk~`*_y7O^ delta 911 zcmZ9~OHUI~6bJCR(|PtWeL!1Ek@D8MAm9T;!~{VTlg1DsA-Pe^&~qRyGi{wt4HzSd zUAYo6U%`zgu5fAm1g><~Z{WA^%C>oX<= zD{}cfvoB$(FVPPX!*ZYTikPW1r-n0FX->n&i5Z=ysyP#$J)NP>Y}jqim89m}w)E2C z^K^DT>|V&PoqY*5cBSgWzu|wO$_DIaRUVkN=gT{`*F|rTsBKcA4Xdjk@^8j?@Jabd zYe}upx~48#T=Bgga`nh|y2!73>H#}`R$btxkDl9T(Jn96-Ol2%XS=TLoV`VFu|wbA zXdQboy053u!u1`m9Zqm#%dxxNUG$^0jYmB31Z}_PVXe{ixw+~4UgNOmBM;u`ljB@@ zeA@A7y6tvE(sz4@A_U)chaPg;$Zv5iyd}MoX4m~jyTy%qyLIF=>ONQNduJWw@vd+C z_zGxipo%A<4XTdk4SRU@h;>==6 NmSY-Cgel1i>>s(q*dzb| diff --git a/cmp/__pycache__/ast.cpython-37.pyc b/cmp/__pycache__/ast.cpython-37.pyc index e53e26a0657c368bceda831c9fadfab6f143f270..8b130445f41f4690bdad138b6ffe6fdd774e1cae 100644 GIT binary patch delta 238 zcmca5aY>TTiI}+k&HroqvK2CFOfF}OWt7`|mCcQjQGc=w$9qQO$vm9z7%eCN=A6LjFu8}ToKbHw Z3wJ)F>*Nyd5=Pz0FS&DAIRtnG_yO+SIWqtN delta 166 zcmV;X09pUi8QK^QLJbWH00000h=Xii*aoo2GW0P$IE|Vz&NdrzP z1d|X46_Ydv6q5`C2?hcH000O9lN|%20S}YG1BL+-lSl+<0Tz?81Z4pZlNbfW0UVRv z1)l*RlYItp0VR{~23-LgvrPv^0Rb$NlnCzuFq4D{?g2KFa|)0FJ(C0rcL6Jtd<$;@ ULX+$ZbO9=pVGL{q1rQAo4@=}M8UO$Q diff --git a/cmp/__pycache__/automata.cpython-37.pyc b/cmp/__pycache__/automata.cpython-37.pyc index b962df3506f510eb42617a5f8330283ed825a80b..84d9710cb3057f4572ed7238666f781d3fb92ff6 100644 GIT binary patch delta 1863 zcmZWqOKcoP5Z&IHo&9<2^=}>9Yda+VO^52J3Kh|^DXl>W4p!oY*eoWL0$aG_Apyar@tuW(FDj4x(G_*ZeLma zmEOg=#I*J~>kvO`>{e%YbfC)Mr^)9Mx+%GPlww z`bz(-ebxy>?z=K~oVN}F1Yl{kYl}GR!r4jU$ zRfGvLr=85i&9Kg4n$}tvgrEqUB>fb@s50_=mtTRcxVFsXV#KD**6Kmj1THg}F~oMR zy^mmrQWGbhKeeiy%52nXTnOrTFH-7_V2#^(pI@%3>%vp(wc-LR(lsS>Ee1QpHyul7 z$&*UeHdZ{}!Q(0=t>J_+&MSzGg09J{cJ)l2x3%ufOv0eGvPpA=(={AK6_ zMR?P^Jv~C3HjnD|+Y_y-9a(}wuu~lC+*?sXl~db?5-5X7@oDEzhALBDm1(E=sOxGX zNb2^i*j+j{@u(3D#S=VD?q5WZTHFYM!rS7L(kPn}-KR0oTRU($VPm=FiLUoEOu zrc{-N0h3wYug-UaXQF6leOsJKjOT=na5M zp`TVK2q>ndC&>(wK$U5jR;mJF&6z6BuBy0RzP{H^pIBP`@Fsn}-e;xl zEI9rp*8^!Z9H9DBpV;}Z?s$I8uf#z21%`l;OXB3f!)uBG4PGWi34t2BRp$@rsUTM* zx6Qh9f!AFRo6N8ACaLahSf)&SuDY7cIj&pv0~en~*m8qd>WjF6IW$yGlX0X7cmZXJ zJ$F~RJfa`OpM;EzN>^&08`*k{S5cHm4WE>yOLkasB{Pa)P?T+Q1n0!i;L#;@i)D;p z<=_qcv9$w146jofrwCLrPSeUJcntyHgz5)!g`}J%xe}bC)u7lIoGavTxgWpLPVsPX zU{O!S+NAhcW@ZWi_YZ z30gf#@C<_Npqb#+8a%!jxG+od%^@dqAp{{lnN~6w=SX{i;1I!K0-B$2l;AkQ0)gt> z^Qn}X0+;rjAVW`I+#6mWR+CJp5%r%QhH>#_WuE25AC*1K7n37r*d_7q$U-tI>g^H# zU}R=2K#%we8~7vhCtG1c6KEu6_o{&I@hvlIKUJ*qgAq17$KY+X-5E2haE0A~rL7(^okiyJdFl~gyS^jQ!c6Mg= zo0+}eroNv_Kaox+y6~ASzi{!}FVeS!m{z-@oSB7st5t`Q8K>TCZ%I(Ui<3gDV&u~d z=|hqrLy%RMVmWmuGAS~uXxtb~qfi@l%hJhO&6hzv2%uJjl={gSj`!kX#e_b!XH1E_ znu<2!DH26cbR+taNU6ElV6upnlbSzl+ni48BHayn@Chr)nPY@hpCEKy&Wf;YAB@KLdVpexIny$Y-3sT4M zND$~a3joh{oYy_+Sa@PKs=NJmYsqcmxoIuhayO*zapY!=>41lrjkV-ykt7I%fe~K!Vs-NuBI_C(mKB?g&}H z2BCdi)9Oy2S3Vy~J8GTXq&CRj-p(zG(C=Tl`S?A7to2v#75v!$V$!T_*uEWfqOIP) zyF=Z~tp^;-08Qr!$Z;haMpYmIXT3Y9& z`(PMALy#gqqDy@^ur;kC=c_C4U#I8xW0i>RhPv~rWrH^HhN7yY>eM}6vu-6z)Q4{C2j1ec2oXAO^V!-T&J7$CE2uW>=&mY*JF?WLP417 zy~0e1ReLr8Zw%7hFIgR1cIqvu{wzF#ABc(J$(&*3`f!MS_b;&KD-p2KeQ^s|9+o%_DHS1JxRl!vWSNohQuBvXqEpA)&8Qj_L%;C-)>dUyA zcNTE9;Fj^NSzO=eEaG|*wG~_)aF%ejgsXjyeot(V$< z(Bl1gGjVbTyZ<5zSF7ueRyQ2oF>Y#gQ}woPsb1D|s(1Cg>Q%kq+NwX>dcCOnQZG6C z&~`Pg21>MvcXX0!tv1))u<(M{TwiZ`%Vuc# zZg(xTdUE@Uy8Zi_$ASFd$&*+6>+Z>GUH1#Fck*Sgzv;GuzJK!N&ERUkce2&*cTcv~ z2PX%ct^WF;-F3Z{!DeVT8tq;?Xfz5W#X_O!d40G~5xf%Dwsh8DqPYG z9>r!^_xLHHNfk4=3=55hA9#%hFMM`g(}$I$5vdw$BjFDF7O)k4o8zeX;<*EFuh!5j zKGJAZGR>uZQgtmM0}t@X5s^OCaDw*qK;JgJg#aTm!r4VFFmcqsl8lZOmfC*1=LgMR z%k{{((7x#Q0vDHI@zUnNecto>-m)R=2y^}5s_RYRO4D%~js1AtCpR^{q?e2gXQX;M zrAP62Lg`Xq1dyR^eHUsyN}0!Y!g5R|#owF5t%yi(p3jisnSskU8htSG0PZRZjgnq5 zhO^1ov36|e67e8YMEQ)>^YX=AWTSY&e}3S%yZzn~wj#q~469KKN#$J|xx<$CY6wEu zb$gA*LrF7PA(X1sSFbF8D5DMo7oD25i-2SR&Y4sv>X(pUm?e{LZ-g>*&90w;39UJwRPz2hxb_;?v zGHx5Xb_L4VFk+B0!<@f?{t83F8Fb#+Xa((l&tEnb5ZL&FS46R_hee1=x9R&(&y*8n zg$!9K1jXt~+Ndj{u1{gi6D2qrtLqljwqxG1K(VfaUZ^isItP{hL6D~+ zJNh-tKOGdlqDR-pHN$&rq&p_B9qS-eX+ishwiVT z_}@;h2p@kE6bT=!MG5G5+rW3tEu&`#B`43fr_zZpdH=z_K&3(Jwy{fpX10xQ>E7`h zM@RZ|+M9>BOzFQl`TV!^>-pCd7s?qBE3A4P-8&@a6i=7Nm@46_MUM4j(Lk043{qzYo^&jx|lzPu5*nYW71-)Ol5KIz?u zuPR8hl=KnOLVXbGentz$BGK|exf_iWc*KVX1VaGu)yuktW7R0@3r5X4tRFILobz5q z>dNxeoM9O|0j#OL>C8(j3mk=M}uQQoI$6 zwSlq4(2mD*%==3KmiBiXU}I=Cya!MxeV>A*s%zsY%6`Po)&98I6hNuq+<4?J0Gct< zdkKs1d<`$f5;>oI|3ir5p2EQa?POY5%(Re^lb>7ydznV&GL6LISDY$-QzXwLYNWU_ zCU1|Us>z0E{~&LsNE`1?mp01zG-(q_vLH!jXg>eh^JA{y6d`h8F=(Ylh>X<_^rLX@ zQaOseQT>IO)^Py}NU%VTJ}jfPM0S>QQ+cvS|DWKe;?LQ-$Lk$EKf?#EqKJEbud$Yj zwCZ*gXBAbnhg(T&x&&ZTwD?#IFTXt)x`b+2|0=)fXB*kj}{e{ zmtmPstIF^r@q5hGu@CSg(p8$%k@jYF3xm)BBS-qHP_*lbv!n}NA+R%69t-swspJSm zeNa4g#qGH_2Hxo}@{9ber45h9?s_s9E2p~sR0gbb z53A{2nKXa`EJHR#G1Bw}eYk%|Q%OIG7bHk9gF*vGCmWM_596NqNfgtad~t-ogz8wl zs+qRL^B$9Ij)^pN1}EaX(VsdbBY{9{O+TQ0Gxq8X)I1s2bj+y6%6K{m8gt4GVOK>0 zgw(qQKjPMZ8Lx=ZU~Esg{p^j!?Z^eNFhg0^IA30EB3INH`j6H($WgSrn7|2muE>xk&H z0u%+=6dZ0mCZkHQbLcsX2rX!_hAnEh%-c*S7^_3`m|t7AQn^wBo&z!M!7k)59{UaK zF*(^``mia6c7UK}cX^h?2_9)Qelycxw*UM9924OT9^o-zG8G7YhZr18k|)wuoGobg z9Cs2Q!kI?niW}g&>y5^{nN}Av1DiZByw znbd;k84`EP6}Z^>6==$NiZg196!We zOe2#NL^5R%6Av}Cy2v3RP2xw;;>W3^r}4sseG`N8hqxcB=Y26(nTSfP+nC@ch;bb6 zjdcGI;%M!f?azsUJ*1#hqG;n5>;j|xm^e!X2c=h=-3^tC^Pa;;!hCZuaC=T{8uQ9v zPS6^fh)n;8v{E!ReNMNTk&1dL^x}bpR}^ION`#rC7(<&9Xv6z7?n(30rP`x#{2BIL zS+f&N64ubO;@C*Wa%rU9g5NQg_MoL%iS5ieC|Sy)D(MpY@*>ZuAMpq>a-QIdn3g}s z{lp%YBrqP%k8wt23|E&6Qx!xS5@n!RXIc>H7r|!~|6MjiV+6rxUd&X|i5tmA4si2- z2}LaG*+}hf8T;M5NOwm0k?}oY?IaLx$95)`hi{xeCE!16M?Jn|0M0yW<+`zuHft`kO+V{QB z;O)Iyplk4hObeMVOz{lZ&laC1&^Y?@5YZRWuPBO1g=ClRP@MjnuTSBZ(ww{TOR`^k z^@q6r!%Pzyj_q_`$2c}p^A_sk%D_*vp5ko&?erFQ`j`|s8FN~6rTuGgkz>3Oy}p2| zy|no(>i-UV%(Y4?1UpQ1f^Jkv21(){8mrz%*~nfNTP)q*XPU`K!adsRJrff&pZ}12 z-WcwWdy$yx<;qkb601xx74%h^dNJJO%cOmNjQ0egSfIlX@`j)l+5CO%f&h&469X-0 z9_uOF$;PoegMBQU|6wCvH=1JvMn$uX-cfwB#gB92F&Q+9!!A>dFS%<$n0uvt zr)$UPM!bY)yq`z0i_UZS?qH9lcW$ipohWusjX!$&-WsRa{7a_s@vct+I3hxeFHpkR zab^bCc^+eXeD_Wh=>CnLA=GQSy@Tm{_z4f;jo44<*U&cngbt=XLYXO4 z%8uK~My7HbLzR2+hTK9rHyC+DMe%w{uqLzKGQQaoal;9Z+}W7Va1f)1iD%4w9hNiZ zVh+PA$4G7&fr*5Mwr$+X#dC)v6FIbeEbfJLYDhd!v9}>@zIW1eCGlqw!%o_ca5UN08h{N#W?w?M^PXVe*87g*R#{Vs5 z&5{5SB4XAqBt#h#JSrQH+@HlReRyPAi|M2Hh81aw;1@v5UNa6R9QNcM4eflyhvSh-2Oa?{FF6P0Ue!6`9CGeQEBl?pz?lbRLU?QxIBqib z=Wrsc4pgbfD-eJsrUMvnSV2yfzG#gc=IPPApbY(se4FQmIF9&Pd}-MZXHx9;!*a&k z@xvkvs4R!@!x^mY@dC99CCm-Dq(^)?naY4)ghcyu?N+dhd%{6DL}8#Q<(jJaPZs!8 zqcvR#3Y||Jw-{cf>#yS7k$y|NjfDtEe=G!8Mj(q0V7m#eTjt2{PNAb<#5LP{QUKP( z@&Zg^M9T{-z^^I!0Dx}?iyKa9BNH4qSBItN*9XC7jZ0dF%g;7@y?&tP{oUGn-*aoh z)n>2O@3}SML``K%RuI>p0$JX17Drfoj>Sb5=UKdlA_i<4TB#2$a(2>*Y%eTlnBsqu4YNC%aReU9w5G>$7i6A@*-JQ4eweI` zF+40Mi;{g@QzB_Ux`+NsU`2wZcXFNltwNk?>ge&g=$fgPlMElebk(h8v<-6Q2Q@4& z>90Ysx|_AfYfL(?EZZv4{|X3!q)^o;`racfNS#+>LGg+r+ORZ87n7vUlMKQ!Ja(GA z;C;=gU`gE~%Hd+n5#;VN%T5xWkRJ(8=-uq8dgE)1cm+QP%0&^w{6$8&mh%~nc^u#M zF0n|JCA(DWbyiJui0{0}4$%=z)C9{>pdJa7T#6TR{r~6&X}r5`d@iFKN8{m$DZiUy zc%Nq*5wq$z_kNKDnKh;q#pHt*$24O9js_EhlfyTtIie1n6?OD2U?>nHnWl2gC2aw# zoeyY4-H|M|;I%YBSRGo& z{1dfd70Uf+(wC=8MOm=LnX%HaoV`D+WONMALEvOQRxtTv=#3J%XLv>x!*nR!>Cjx? z=n4<(w1Pow`qa}CGRS!Q^JFI@SPc+uL8;~d(yHVHW6a)Yt#6`N6i6BZVeV0!Y?jbv zXcuR{EKGo2D|ttBID0A-em(ZNAWpO;q5X62rYr)Bbl(%JGC|)NJlQ9GtkiS^x&f6> zj7MhfEE#n2Adfv6^eZs4H_nqbtfxE0LG2(!-ZF9Dx^W0sChk|aaw7|C3v(S=U3mQ{ z*4F8`Hb<7DzpL(*U&CT~$HY1U3@wchTq<>y=M`o#a_^d3`Jiyi9_4Q{2+hla?-$*s z6I$o`&SpX+nMY9KSW1eC?$4VgwZ`DrjO$n%5^Dg3I8s3@6^DN^fg>N3PI115>%ULm zj1@7j4L=$WT+nZH{C+QEpOWW)LV7$0v`vuXxw!XsN(VIi4L;RiA!1sTgE9c@oQl!~ zH$}7wqoGBT!<@6RKJek2NSs*X!#^XnSB0gQ!BX!8Z|Keh8DSyn_6A82N5r(?df1Tg zGG_c2U^*(gZKm=aJ)f|IGDNB4F!|p>5pcb%c3a=V%=R{9iZcQov#ozkyK!U$$v8;) znj^TVHLCBxYMjz2Nm6e{^+?Jn=MD8H>YqdXX}pj1qNblNS&W--Vd=x?V3Jvx;z)}shG6?jb!ZMe&*pYRFF7O zyR9EbR(S`-W1J$l1Vw0-I12>zL~@C)=SXkx+>FlYgj>MeDyA$S2;N}1ieTThY zzzGADvi#Wy)cIF7hUK{LY%S?Fg@Xbw-9C*I2Nn}ckrj9zdIPo-b`ne&acMOc9yNTZln5U!jGYG z@!?AeztIgzhlm{@QC!x}b=#3tGagYYm$Jh?)ord{cABUE0&o8a4`{>VaknS=lm&hD z5>(IUM=2pH#uIfDA(Jc}g)DX@a%+7LKZK!#h5E(1aq;3LG1bWy|1_1l68s1T$n-T+Pf{w^NN5>>ZP0G5yZDKeQN~d9gfi&z5IYMgxx|8`b3u_VFc; z2gFm*@gokVU9{cPF8G0&BwmnSDdJp`FEah3(l1P|@JDe-zNkfy^;z}Px6rzPHAAZ{ z3Jte0&3z0vMvz}fY8h@0Ob!wzkYg9`f+LALFxx8;GBRMy0~ucg8k$7LIMV0<3;6RBLCY2XaHEq? zzlk?)#&7gsB;t1+OXw(|Rjf$o4^0lp&sW53FruhoZcAplLw#jvoT%MlcklcUHU!@i z83>ys*p}ddb8lhM?QN{%_mYSW5(dV(9pz57Jr55~GL_o)Lo!wTDd28ZUxaSk`V!XC zK-=|0SYaG7cxM8fG9dh=SH*tC6GOUC8V7q51IbCbe~d*4`Sy4KqtrG(%8f^AqBOuh z5Y)Mz2vcFlIZ!y)c^(IB%z$(dxTVu$!U`pQ5IK>mI5e5Z2Pc_v7WdvKVMGoMPGwmi z&P1KxF*!#064Gdom2811N{hJ$A_Vg>0-r*yC_rXhve_u%jcC?6Jo(R4*fM2)EaCfH z(l+IqZKs_V;SgD&gh=z#2P7&J*o#z&BIlDJ1C zn&)W2A38wd@muH&kytUYgiawq7a1C-)MMg7Nz>G!3~kax;{Ge480xf$pJOHz^F*3R zoS0bNDf9mEh@+5lnE-}UBEL%eS~hKp;U?hk1bX(J0xnuD0YOCt1YD54OGpqF6F^2_ zklz4EyFH~LBA$#5sFMQx2u2m~zwEhRXuH3h!Tlr>jeuXpf+;9POJ^@ESh4v}+yIN*xV?U~DRv)ZBQ=O~kDj%;Ln0ugdfA#*#uV|0|FYIBsMF0Q* literal 16739 zcmc&*TZ|mpS*}}mSNHUc$1}6z%R0NA#b$RLXPnC>fsNzX>$P`HmdO&EY-o~n+Fdnv zw|lzVRW%z=t0yEoj-81U8XL}CL zn2}e+x!{#N7w4i^_9{4+eAk=vs`rdNvtIV*y#+k0c!x03VqCnovvs52ZLxp;c(!m{ z!VxZ_7?~rZVT>%47!&W98*5hVY&5t0xb$Ms+}dgeYj*5}es?o=dh+i);G&1O zo;`c3zvZ93-SuDdgR`#${T;s*^~1BT>_oTvy|b-;zk9Z|H8?xiY4x`T?XDlJ4|Za= z(P;PDQKL~LC=Lq4ESkeZ3gGp$wq>#gKc0CA3_b<5Hs$ zMnR)NiV8V(!yGQ?L8NMI42>PW5OEZ9kE^Ee68MAQpwTcZHfc2GbHinGQgtl>0}Xg4 z=rX4oE-;=MnR`~S5@AI~xVmOUHqPejdUc$*(hl3bFlzQ%e!wnb_nO~}eB8$6>pKJg zauD=`HA~PD7y8jHKbV4*rsp*pB!Q6FG|Y-wv2vJ^>gkZ4L~{-4(a4HGLwn{7XoCf` z4i2G+t0|Z-w}E#Kod6jeW*ZVyZsCfJMjwb=#Zv{LRWTQ=;k;fu){ZTmCJ$1Ru$r}T zMS7e;8|ACv-ddgO}#wxs87Bx*u${d(Cm-M94U3coaos>>2k#SR?C!Wg0iZj14OlQg&Pj zw=rKqNIZwhd)uw3-S35Kwh{y+>!5^U&5X++m2NW(!JZi=h{~sNB+_TW9IoWR%0y7g zt`slqRN%XdHP=jVKC&{TjLiG?1LFm-#Mg{nD{|g|c-^yh?Kg~0;eK&sKQK+>4Tvsz z8#TcVX#-}T(WbO#eccSIkxN0~*|(kW3sL!XGr4zeTfsL+rdQy-S3HJsSBwuCyGeca z)N_s)x2^EIQQ0d|pm2P)k1Bgs80$Mi^uuTlP)jXJ+cUmwpk`aS>dAUJ=P{jqb$7(P8g z7GTXrWBpvW-)eTl^XvMZfWqocz65m(64RxnrCV|wXomq ztLwnO*=^Pa{h-!rdd*t+z2BwI?&Fmjp9^KT+TZ(5uNE6?heV*pHYBK$s)caSZAWnh ziZ|f^nPj|h5duDY7#E`LLD!FMNE_6JAw&hZMRbMIBFh(}C}`iwrlp)l-RdG!t*W_V z)tnRNam&TEgJVJ3RHfCDIb=!B85ezj_z_l2{qH3H>)rfj=p&8LBt|B@8ac@BA0dlZ-X2UBn~dG4U&>yc`Er$p}c^CJ~M2_=o@@o39yJ9b6CY_ns(L- zQ*m;@{6B!McGB)#GvNKcnO|UoTPV_*KdPIloXonLxR_<{khdtV=3#FM=Q(fLTfw>N z&wGz~tKyC>ct?Q6qoSxZ4RNky_!kMtNfZ%`b$Yrq1z%zOo}$c*WcE<*1w(j!Z346Mn1zm)hC;D06$eBOfwWkoh7 zbcSHVTNT3;2KaQK>8mPZN5FrGpDNDR*YiMEl%skm2lPHyRj(~qjBA_57|ehQbH<|5 zC$BJcvt%=Tag zIP^llkpm~cOm8=^(vIND&8BAw7oka`@msk8^Ydp1ut@|nXu`8bGFcBZ7KZ?{1$~-o ztTaZ_?s@*CWQgY)jhlXiezzKpZ{v9=HS7i$f2euGEs>a}i=SH3`o= zS4;cUwc{Ypijeqs8jWvj*c^nKcMg^s~&!10-8ph}oS2SHR!M4}_-(O+L4eZ zGm%NY{{oJXUR)9wDZ6C}kEjrdtrQum^^Y`m0Y`WS#iMIfkU~Xdj7A(g;vrg*p&5!{ zr3=0Ie65!kmCL zw&AS)5n)xa$R*RwNqvDA4K%JEsvSRqu4MS>R2`5wzRTf=acIYVsM#+}G-_xvYZZBP zWZZ|zK}3vF1xZb_p6Z$B@iaq`j)ewXW^udI6`T?R71i=5XsGpJMf~OA^2AC~y=<(N zrZR{OB+S4lVGi#Z;V+}&I~<0OK=_OX+KM{yK>vsV{=(0pNJ%~Kq&;k(VwM5v&v{}( z!lA2*={*njSdL4HZ!kuo6e$EG%zU^B^E)p2Dy9p}P8#7!IB=RD_vh?1A&13evnEqMX)$a20PKGy+Y7@8?FyO<{^$n*LGz(p|LfckIgIT$U&k;uQoA*( zbEV*?X-_dW|91Ka`)y2;oUA!Dy5jy#n8?bQu#~a;5~>d3=8LHRI~*z27BV8(r>coq z8ILSU|48gZYa=*`d#uWAjV+q)?{mZCDB%%x^?@-7s?UGa-CM)M=`6IWUR#(dh(s&P zo`p!GOmP!0lluAnd?pf#1ty#Ym5Am)!yyuYPQF&qauu+iw5@+!y9+qR_AuVA)9WWY ztB_I2-fHkP`fRat{&?1lMwem6#_G%dW)v4b(Y|>rN&-yrTrb-T3D)syHgV;mQjz}) zj>L1sF6nX>p`9+H2+k$GLQo(eY5cuH3)k zNC|goZ1nvC?2!h4_xVQ~oD}o#xxvS$K1H@s7_|5T^&Kb9cmOBQbE=9TK4}u^f3h2D z9K&??A^iXo;VHb4nh54wsk&B&FOk93ZvGEdPxoU5mqG zYq3v`j4cH~0vZU;rj`1ewuqA4*i(1Wg+2c#H|+Q-93)rBzZen&r^1qyCdT3na-)R# zksb>X|J)R{kimB8qez))vV{;$vKSZOO^(Us(3_&NHLCa=kM)m8! z#26}z!BYWl=7TfnvnAw)3!Zs!urP^iV5c2hbtkZnR>W<(6EMiJlGtRl5z8?4towy@ zvvg!5a#l>qy`;!YA{&%a$}r-1YWuX(Ot*eQkRY44&4UK68{ z;Vjo&vW6$7>>>SxB-A{C;pAY?KRz9dpMa=Z%t0{&8UMF3YncFOnKc81Bv^u`^5dDu zB^}$>)^WyZVggBvAWw}k2LvbbC=^>vbY!Cg%^@!&1iD@Hd zO&?8GWYK|-1DJ#M8OS&ehp*xSCP+z45bkUV3*({wk$o@V2=AdtohEI3yhGB|Or&;6 zdKyx@BrOf8U6PJgFR4T{#M~tX4e4Eycvi2#Ws;;bx=e_-OTrnh7gVxY{SfMpddDON zzvw;T9rqr;XVwpUCm?5@lVG^1ASw)r6w3sBZX(@C?+ia-#jYrf^%RDAmX+gJSzg0`4HH;U^~<}5WkY$!MaXyWS%odHZX2)3@ewn z2GLH9IXuI)OU+)dAE}H0zqZv6{91IY*{k(?eoZh@Q$dn-xb)`$R`6~X4B`gYSo{Ku zD=dByMJlivIg$F}=oIgl(il_6Os|F0Y?Wp* zeERw=zn0@QP*oV!kap7F1X*==YVWNv+PuEzstErp00eYGM!Sy7;9V@l4|sxCB(B7j zjVpsJu_QB{WC@-@v&+N!r!<$$$FVA#0GvDR8K$1mLW4L-plW0ibn7#V(&N%+pkIU$;Xnn{p?0_MBQgfOhdpzZS#6LjUO~>Pz0Hg`-5x|Ta-=<;>-I(U z9!=y`jn+5*IraOc~sD3|_y3ozL5q;0Y6^o^pggm0DaNCu)+|{g}Ta31JEE2clCZ z;Jbj9uMs{zH%tq>0hZUQBe!X$7rlgr>`E{CO(@yBR|p%D|ITqyJ8+P9Z9I4G9><-H z=Zm|AkpsRjbcFNooP3pX!hv#iJo6jsS@qQ<^Pfx0>;V{5_znPfMc!fiqVNrSw-}Y~ zyQAU*x}ZhLZ-2>eda?6--`mkZ5_uF#RIw6UqVe;Y3ax>T@$1$dxA~PP= z$%Gtvt8$JTHB5Iu|Enn@7LDOgr3)AJ8=bJ<%V{Uw{>OwTxB=KEzzJG-_G=j&Pd)hSN9y0V>ww}4 z$Bf+q>I($}DYHc}eQ311sB_tl>AoKZXn5ZvrGnPV8!B!uh!&I++rj5h=sA(>C=i!% z2+IrERhhv`zReMyqQ1l?qV_^wv+cE83eBRBxzG=?g&v+t32rm!Z_OmRpvlfkfrnFE z==PglC_aL+!9|bK9Fxt@wPNgeO_=K+;uAtqFZTMBkpamd*kr*qf}&{insCKsJ^pX# zwTJNu6CG>5lpL;k8sX%95RYMs*t&!xtfOEGAJ`MhfrjVEZ1CDnu4#fh$+ZZ6)Wdh7 zS>Ax>(t$4uAQIcZx?_7AW>%ViP9h@Dn{u%o2B2>9!)p`ggz6lIGikvl=o zgxuUh^KWzZBG=)hROQb_;DmowYgkR^&e8O=2?YsWrp>4%H74?=mGC_NY3NSqNe1>1 zVGODec@{LBc?Y7A*SC?6?ZFH2Aiu<9EGUyvRNVC|5Mx4^D-k@(50*4#k5fZ_3v|T%5HMZMQ8o^yyp2o#hd?u2FCDo zI_*h3<%Pa_39L6@r=$=?Rl;sUWDF<>ktL=?y|CF2@ZAq7EHt{Ra}Kz z8?{?oKE4R^f-Wm%vNG+6w}Q*85NSr_KS|h+;{rTVtt?|_y5i2ETy=}p)#|c4U!7C& z3^dU{vdaY=AqUq%mm~6xpowo*{C#X~+KzHbq!*Ku%f-FAY}-SZ4i!H~ogsQvXsGSYh}LNdMtX=qb2rk+Lz zvVdR9h_qaXv_!kCPrPw2eWS-OYm#?8N8rF0G|WQhcQHrgYa3A;^eAfB*^=$;*jyi4 zXKHV9x^MmnKRDl~a4qOmw$^FhGAIz2{oeMLA2i_`XauH_op-W<*$(<_J%Lnm+usnW zVoyQtE}E<0ZPz?%EYC5#KT;rxP(u2oqlk1I!WqC-HvGFuZ1=yiwOQh~oQDLwtbPnQy*?s2 zCxLrLym_t`?4ctBzOY9tCj}Cz666Rt=(23%kOr?2p_EZGV0H-;f%}n$80@r)uTM3^ zypSQZ5tGt8X+GqD1WxU@jsT+ii0-TTpedG{0)M}t=iHas4d);Z!GdxKn29~ZC8(FR zK!#&b+=h_$drDl0;BTR;5?~a;4`);f{#OG3wYLBHoZQ!*Xd?KPFPIU(GI8rpc)LB2 z?t#NS^sOxYQqp08BXJrAI&sD~+(8I%WQ!WCQTr$cRdHW?6ud}$v;>#>D4wNgwFsbS1!4') + head = G[head[:-1]] + body = Sentence(*(G[symbol] for symbol in body[1:].split())) + G.Add_Production(AttributeProduction(head, body, attr)) + return decorator + +G = Grammar() + +################# +# Non-Terminals # +################# +Program = G.NonTerminal('program', startSymbol=True) +ClassSet = G.NonTerminal('class-set') +ClassDef = G.NonTerminal('class-def') +FeatureList = G.NonTerminal('feature-list') +Attribute = G.NonTerminal('attribute') +Method = G.NonTerminal('method') +ParamVector = G.NonTerminal('param-vector') +Block = G.NonTerminal('block') +Declaration = G.NonTerminal('declaration') +CaseList = G.NonTerminal('case-list') +FunctionCall = G.NonTerminal('function-call') +ExprVector = G.NonTerminal('expr-vector') +BodyExpr = G.NonTerminal('body-expr') +Expr = G.NonTerminal('expr') +CompExpr = G.NonTerminal('comp-expr') +SubExpr = G.NonTerminal('sub-expr') +Term = G.NonTerminal('term') +Fact = G.NonTerminal('fact') +Atom = G.NonTerminal('atom') +Particle = G.NonTerminal('particle') + +############### +# identifiers # +############### +identifier = G.Terminals('id') +type_name = G.Terminals('type') + +############### +# Basic Types # +############### +string = G.Terminal('string') +integer = G.Terminal('integer') +boolean = G.Terminal('boolean') + +########### +# Symbols # +########### +open_bracket = G.Terminal('{') +close_bracket = G.Terminal('}') +opar = G.Terminal('(') +cpar = G.Terminal(')') +comma = G.Terminal(',') +dot = G.Terminal('.') +arroba = G.Terminal('@') +two_points = G.Terminal(':') +semi_colon = G.Terminal(';') +left_arrow = G.Terminal('<-') +right_arrow = G.Terminal('=>') + +############ +# KeyWords # +############ +keyword_class = G.Terminal('class') +keyword_inherits = G.Terminal('inherits') +keyword_if = G.Terminal('if') +keyword_then = G.Terminal('then') +keyword_else = G.Terminal('else') +keyword_fi = G.Terminal('fi') +keyword_while = G.Terminal('while') +keyword_loop = G.Terminal('loop') +keyword_pool = G.Terminal('pool') +keyword_let = G.Terminal('let') +keyword_in = G.Terminal('in') +keyword_case = G.Terminal('case') +keyword_esac = G.Terminal('esac') +keyword_of = G.Terminal('of') +keyword_new = G.Terminal('new') +keyword_isvoid = G.Terminal('isvoid') +keyword_true = G.Terminal('true') +keyword_false = G.Terminal('false') +keyword_end = G.Terminal('end') + +############# +# Operators # +############# +plus = G.Terminal('+') +minus = G.Terminal('-') +star = G.Terminal('*') +div = G.Terminal('/') +less = G.Terminal('<') +lesse = G.Terminal('<=') +equal = G.Terminal('=') +complement = G.Terminal('~') +not_op = G.Terminal('not') + + class CoolGrammar: - @attribute('program', 'class-set') - def assignment(s): + + @staticmethod + @attribute('program -> class-set') + def program(rule): + pass + + @staticmethod + @attribute('class-set -> class-def') + def assignment(rule): + pass + + @staticmethod + @attribute('class-set -> class-set class-def') + def assignment(rule): + pass + + @staticmethod + @attribute('class-def -> class type { feature-list }') + def assignment(rule): + pass + + @staticmethod + @attribute('class-def -> class type inherits type { feature-list }') + def assignment(rule): + pass + + @staticmethod + @attribute('feature-list -> attribute ;') + def assignment(rule): + pass + + @staticmethod + @attribute('feature-list -> method ;') + def assignment(rule): + pass + + @staticmethod + @attribute('feature-list -> feature-list attribute ;') + def assignment(rule): + pass + + @staticmethod + @attribute('feature-list -> feature-list method ;') + def assignment(rule): + pass + + @staticmethod + @attribute('attribute -> id : type') + def assignment(rule): + pass + + @staticmethod + @attribute('attribute -> id : type <- expr') + def assignment(rule): + pass + + @staticmethod + @attribute('method -> id ( ) : type { body-expr }') + def assignment(rule): + pass + + @staticmethod + @attribute('method -> id ( param-vector ) : type { body-expr }') + def assignment(rule): + pass + + @staticmethod + @attribute('param-vector -> id : type') + def assignment(rule): + pass + + @staticmethod + @attribute('param-vector -> param-vector , id : type') + def assignment(rule): + pass + + @staticmethod + @attribute('body-expr -> id <- expr') + def assignment(rule): + pass + + @staticmethod + @attribute('body-expr -> { block }') + def assignment(rule): + pass + + @staticmethod + @attribute('body-expr -> if expr then body-expr else body-expr fi') + def assignment(rule): + pass + + @staticmethod + @attribute('body-expr -> while expr loop body-expr pool') + def assignment(rule): + pass + + @staticmethod + @attribute('body-expr -> declaration in body-expr') + def assignment(rule): + pass + + @staticmethod + @attribute('body-expr -> case expr of case-list esac') + def assignment(rule): + pass + + @staticmethod + @attribute('body-expr -> expr') + def assignment(rule): + pass + + @staticmethod + @attribute('expr -> not expr') + def assignment(rule): + pass + + @staticmethod + @attribute('expr -> comp-expr') + def assignment(rule): + pass + + @staticmethod + @attribute('comp-expr -> comp-expr < sub-expr') + def assignment(rule): + pass + + @staticmethod + @attribute('comp-expr -> comp-expr <= sub-expr') + def assignment(rule): + pass + + @staticmethod + @attribute('comp-expr -> comp-expr = sub-expr') + def assignment(rule): + pass + + @staticmethod + @attribute('comp-expr -> sub-expr') + def assignment(rule): + pass + + @staticmethod + @attribute('sub-expr -> sub-expr + term') + def assignment(rule): + pass + + @staticmethod + @attribute('sub-expr -> sub-expr - term') + def assignment(rule): + pass + + @staticmethod + @attribute('sub-expr -> term') + def assignment(rule): + pass + + @staticmethod + @attribute('term -> term * fact') + def assignment(rule): + pass + + @staticmethod + @attribute('term -> term / fact') + def assignment(rule): + pass + + @staticmethod + @attribute('term -> fact') + def assignment(rule): + pass + + @staticmethod + @attribute('fact -> isvoid fact') + def assignment(rule): + pass + + @staticmethod + @attribute('fact -> atom') + def assignment(rule): + pass + + @staticmethod + @attribute('atom -> ~ atom') + def assignment(rule): + pass + + @staticmethod + @attribute('atom -> particle') + def assignment(rule): + pass + + @staticmethod + @attribute('particle -> id') + def assignment(rule): + pass + + @staticmethod + @attribute('particle -> true') + def assignment(rule): + pass + + @staticmethod + @attribute('particle -> false') + def assignment(rule): + pass + + @staticmethod + @attribute('particle -> integer') + def assignment(rule): + pass + + @staticmethod + @attribute('particle -> string') + def assignment(rule): pass - @attribute('assignment', 'id <- expr') - def assignment(s): + @staticmethod + @attribute('particle -> function-call') + def assignment(rule): pass + + @staticmethod + @attribute('particle -> new type') + def assignment(rule): + pass + + @staticmethod + @attribute('particle -> ( expr )') + def assignment(rule): + pass + + @staticmethod + @attribute('block -> body-expr ;') + def assignment(rule): + pass + + @staticmethod + @attribute('block -> block body-expr ;') + def assignment(rule): + pass + + @staticmethod + @attribute('declaration -> let id : type') + def assignment(rule): + pass + + @staticmethod + @attribute('declaration -> let id : type <- expr') + def assignment(rule): + pass + + @staticmethod + @attribute('declaration -> declaration , id : type') + def assignment(rule): + pass + + @staticmethod + @attribute('declaration -> declaration , id : type <- expr') + def assignment(rule): + pass + + @staticmethod + @attribute('case-list -> id : type => expr ;') + def assignment(rule): + pass + + @staticmethod + @attribute('case-list -> case-list id : type => expr ;') + def assignment(rule): + pass + + @staticmethod + @attribute('function-call -> id ( expr-vector )') + def assignment(rule): + pass + + @staticmethod + @attribute('function-call -> particle . id ( expr-vector )') + def assignment(rule): + pass + + @staticmethod + @attribute('function-call -> particle @ type . id ( expr-vector )') + def assignment(rule): + pass + + @staticmethod + @attribute('expr-vector -> expr') + def assignment(rule): + pass + + @attribute('expr-vector -> expr-vector , expr') + def expr_vector(rule): + pass + + +if __name__ == '__main__': + print('Productions :', len(G.Productions)) + for p in G.Productions: + print(repr(p)) + print() + + t = time.time() + parser = LALR1Parser(G) + print('Build Parsing Time :', time.time() - t) + print('Action Entries :', len(parser.action)) + print('Parsing Conflicts :', parser.conflict is not None) diff --git a/nonterminals.py b/nonterminals.py index 34ad39b62..54c2b6140 100644 --- a/nonterminals.py +++ b/nonterminals.py @@ -1,6 +1,42 @@ -from cmp.pycompiler import Grammar +from cmp.pycompiler import Grammar, Production, Sentence, NonTerminal -G = Grammar() + +class ImprovedGrammar(Grammar): + def NonTerminal(self, name, startSymbol=False): + name = name.strip() + if not name: + raise Exception("Empty name") + + term = ImprovedNonTerminal(name, self) + + if startSymbol: + + if self.startSymbol is None: + self.startSymbol = term + else: + raise Exception("Cannot define more than one start symbol.") + + self.nonTerminals.append(term) + self.symbDict[name] = term + return term + + +class ImprovedNonTerminal(NonTerminal): + def __imod__(self, other): + try: + return super().__imod__(other) + except TypeError: + + if isinstance(other, str): + sentence = Sentence(*(self.Grammar[s] for s in other.split())) + p = Production(self, sentence) + self.Grammar.Add_Production(p) + return self + + raise TypeError() + + +G = ImprovedGrammar() Program = G.NonTerminal('program', startSymbol=True) ClassSet = G.NonTerminal('class-set') diff --git a/productions.py b/productions.py index ccad85c93..5620d5937 100644 --- a/productions.py +++ b/productions.py @@ -1,5 +1,7 @@ +import time + +from cmp.grammalyzer.parsing import LALR1Parser from terminals import * -from cmp.grammalyzer.parsing import LR1Parser, LALR1Parser Program %= 'class-set' @@ -37,7 +39,6 @@ # end # ################### - #################### # Body-Expressions # #################### @@ -47,25 +48,59 @@ # end # ################### +####################### +# Compose-Expressions # +####################### CompExpr %= 'comp-expr < sub-expr' CompExpr %= 'comp-expr <= sub-expr' CompExpr %= 'comp-expr = sub-expr' CompExpr %= 'sub-expr' +################### +# end # +################### +################### +# Sub-Expressions # +################### SubExpr %= 'sub-expr + term' SubExpr %= 'sub-expr - term' SubExpr %= 'term' +################### +# end # +################### +######## +# Term # +######## Term %= 'term * fact' Term %= 'term / fact' Term %= 'fact' +####### +# end # +####### +########## +# Factor # +########## Fact %= 'isvoid fact' Fact %= 'atom' +########## +# end # +########## +######## +# Atom # +######## Atom %= '~ atom' Atom %= 'particle' +################### +# end # +################### + +############ +# Particle # +############ Particle %= 'id' Particle %= 'true' Particle %= 'false' @@ -74,24 +109,59 @@ Particle %= 'function-call' Particle %= 'new type' Particle %= '( expr )' +################### +# end # +################### + +######### +# Block # +######### Block %= 'body-expr ;' Block %= 'block body-expr ;' +######### +# end # +######### +############### +# Declaration # +############### Declaration %= 'let id : type' Declaration %= 'let id : type <- expr' Declaration %= 'declaration , id : type' Declaration %= 'declaration , id : type <- expr' +############### +# end # +############### +############# +# Case-List # +############# CaseList %= 'id : type => expr ;' CaseList %= 'case-list id : type => expr ;' +############# +# end # +############# +################# +# Function-Call # +################# FunctionCall %= 'id ( expr-vector )' FunctionCall %= 'particle . id ( expr-vector )' FunctionCall %= 'particle @ type . id ( expr-vector )' +################# +# end # +################# + +##################### +# Expression-Vector # +##################### ExprVector %= 'expr' ExprVector %= 'expr-vector , expr' +##################### +# end # +##################### if __name__ == "__main__": @@ -100,9 +170,8 @@ print(repr(p)) print() + t = time.time() parser = LALR1Parser(G) - print(len(parser.action)) - if parser.conflict is not None: - print(parser.conflict.cType) - for item in parser.state_dict[parser.conflict.state].state: - print(item) + print('Build Parsing Time :', time.time() - t) + print('Action Entries :', len(parser.action)) + print('Parsing Conflicts :', parser.conflict is not None) diff --git a/productions.txt b/productions.txt index 1c68b603d..16ce929c8 100644 --- a/productions.txt +++ b/productions.txt @@ -58,3 +58,7 @@ function-call -> particle . id ( expr-vector ) function-call -> particle @ type . id ( expr-vector ) expr-vector -> expr expr-vector -> expr-vector , expr + +Build Parsing Time : 5.887415170669556 +Action Entries : 1049 +Parsing Conflicts : False From 7d97cee78dff4927d72eb5b86fa4780206577e86 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Fri, 3 Apr 2020 05:01:43 -0400 Subject: [PATCH 003/143] Serializador de parser terminado. Pediente a definir la prioridad de los operadores de lenguaje cool --- .gitignore | 129 +- MANUAL.md | 9 + coolast.py => __init__.py | 0 __pycache__/nonterminals.cpython-37.pyc | Bin 2098 -> 0 bytes __pycache__/productions.cpython-37.pyc | Bin 2355 -> 0 bytes __pycache__/terminals.cpython-37.pyc | Bin 1406 -> 0 bytes ast.py | 178 +++ build.py | 18 + cmp/__pycache__/automata.cpython-37.pyc | Bin 7910 -> 8009 bytes cmp/__pycache__/pycompiler.cpython-37.pyc | Bin 16554 -> 17315 bytes cmp/automata.py | 27 +- cmp/grammalyzer/__init__.py | 4 - .../__pycache__/__init__.cpython-37.pyc | Bin 507 -> 0 bytes .../__pycache__/cleaner.cpython-37.pyc | Bin 6177 -> 0 bytes .../__pycache__/dtree.cpython-37.pyc | Bin 3791 -> 0 bytes .../__pycache__/lexer.cpython-37.pyc | Bin 2403 -> 0 bytes cmp/grammalyzer/cleaner.py | 268 ---- cmp/grammalyzer/dtree.py | 105 -- cmp/parsing/__init__.py | 2 + .../__pycache__/__init__.cpython-37.pyc | Bin 0 -> 312 bytes .../__pycache__/automatas.cpython-37.pyc | Bin 5663 -> 5663 bytes .../firsts_follows_tools.cpython-37.pyc | Bin cmp/parsing/__pycache__/lexer.cpython-37.pyc | Bin 0 -> 2558 bytes .../__pycache__/parsing.cpython-37.pyc | Bin 7847 -> 7847 bytes .../__pycache__/tools.cpython-37.pyc | Bin .../__pycache__/utils.cpython-37.pyc | Bin cmp/{grammalyzer => parsing}/automatas.py | 0 .../conflict/__init__.py | 0 .../conflict/llconflict.py | 0 .../conflict/lrconflict.py | 0 cmp/{grammalyzer => parsing}/lexer.py | 22 +- cmp/{grammalyzer => parsing}/parsing.py | 6 +- cmp/{grammalyzer => parsing}/utils.py | 0 cmp/pycompiler.py | 90 +- cmp/regex/__init__.py | 3 +- cmp/regex/__pycache__/__init__.cpython-37.pyc | Bin 272 -> 0 bytes cmp/regex/__pycache__/ast.cpython-37.pyc | Bin 4799 -> 0 bytes cmp/regex/__pycache__/automata.cpython-37.pyc | Bin 10003 -> 0 bytes cmp/regex/__pycache__/regex.cpython-37.pyc | Bin 29214 -> 0 bytes cmp/regex/__pycache__/utils.cpython-37.pyc | Bin 4968 -> 0 bytes cmp/regex/automata.py | 20 +- cmp/regex/regex.py | 423 +++--- cmp/regex/utils.py | 196 --- cmp/serializer/__init__.py | 2 + cmp/serializer/lexer_serializer.py | 82 ++ cmp/serializer/parser_serializer.py | 78 ++ definitions.py | 239 ++++ lexer.py | 74 + main.py | 417 +----- nonterminals.py | 60 - parser.py | 1188 +++++++++++++++++ productions.py | 177 --- productions.txt | 64 - terminals.py | 65 - test.py | 61 + 55 files changed, 2303 insertions(+), 1704 deletions(-) create mode 100644 MANUAL.md rename coolast.py => __init__.py (100%) delete mode 100644 __pycache__/nonterminals.cpython-37.pyc delete mode 100644 __pycache__/productions.cpython-37.pyc delete mode 100644 __pycache__/terminals.cpython-37.pyc create mode 100644 ast.py create mode 100644 build.py delete mode 100755 cmp/grammalyzer/__init__.py delete mode 100644 cmp/grammalyzer/__pycache__/__init__.cpython-37.pyc delete mode 100644 cmp/grammalyzer/__pycache__/cleaner.cpython-37.pyc delete mode 100644 cmp/grammalyzer/__pycache__/dtree.cpython-37.pyc delete mode 100644 cmp/grammalyzer/__pycache__/lexer.cpython-37.pyc delete mode 100644 cmp/grammalyzer/cleaner.py delete mode 100755 cmp/grammalyzer/dtree.py create mode 100755 cmp/parsing/__init__.py create mode 100644 cmp/parsing/__pycache__/__init__.cpython-37.pyc rename cmp/{grammalyzer => parsing}/__pycache__/automatas.cpython-37.pyc (89%) rename cmp/{grammalyzer => parsing}/__pycache__/firsts_follows_tools.cpython-37.pyc (100%) create mode 100644 cmp/parsing/__pycache__/lexer.cpython-37.pyc rename cmp/{grammalyzer => parsing}/__pycache__/parsing.cpython-37.pyc (67%) rename cmp/{grammalyzer => parsing}/__pycache__/tools.cpython-37.pyc (100%) rename cmp/{grammalyzer => parsing}/__pycache__/utils.cpython-37.pyc (100%) rename cmp/{grammalyzer => parsing}/automatas.py (100%) rename cmp/{grammalyzer => parsing}/conflict/__init__.py (100%) rename cmp/{grammalyzer => parsing}/conflict/llconflict.py (100%) rename cmp/{grammalyzer => parsing}/conflict/lrconflict.py (100%) rename cmp/{grammalyzer => parsing}/lexer.py (77%) rename cmp/{grammalyzer => parsing}/parsing.py (98%) rename cmp/{grammalyzer => parsing}/utils.py (100%) delete mode 100644 cmp/regex/__pycache__/__init__.cpython-37.pyc delete mode 100644 cmp/regex/__pycache__/ast.cpython-37.pyc delete mode 100644 cmp/regex/__pycache__/automata.cpython-37.pyc delete mode 100644 cmp/regex/__pycache__/regex.cpython-37.pyc delete mode 100644 cmp/regex/__pycache__/utils.cpython-37.pyc delete mode 100644 cmp/regex/utils.py create mode 100644 cmp/serializer/__init__.py create mode 100644 cmp/serializer/lexer_serializer.py create mode 100644 cmp/serializer/parser_serializer.py create mode 100644 definitions.py create mode 100644 lexer.py delete mode 100644 nonterminals.py create mode 100644 parser.py delete mode 100644 productions.py delete mode 100644 productions.txt delete mode 100644 terminals.py create mode 100644 test.py diff --git a/.gitignore b/.gitignore index 88fc28409..803769ed1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,128 @@ +# Created by .ignore support plugin (hsz.mobi) +### Python template +# 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 + +# 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 + +# IPython +profile_default/ +ipython_config.py + +# 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 + +# 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/ + .idea .vscode -resources - -productions.txt \ No newline at end of file diff --git a/MANUAL.md b/MANUAL.md new file mode 100644 index 000000000..e91ca68d1 --- /dev/null +++ b/MANUAL.md @@ -0,0 +1,9 @@ +# Interprete de Cool + +# Manual de Desarrollo + +## Flujo de Trabajo: + +- Todo cambio realizado en la gramatica o al lexer se hara en el archivo `definitions.py`. Para probar si al hacer cambios en la gramatica esta sigue sin dar conflicto tansolo debemos correr el script de la siguiente forma `python3 definitions.py` +- Si ha ocurrido algun cambio significativo en la gramatica o el lexer, ya sea agragar una nueva produccion, terminal, o una nueva expresion regular, se debe recompilar este paquete. Para esta ultima accion tenemos el archivo `build.py`, para correrlo basta con hacer `python3 build.py` y este creara dos archivos nuevo `parser.py` y `lexer.py` que contendran el parser y el lexer de cool serializado con las modificaciones realizadas para no tener que construir el parser cada vez que probemos el programa. +- Al paquete `cmp` se le ha agregado un nuevo subpaquete `serializer`, que contiene tanto al serializador del parser como del lexer. diff --git a/coolast.py b/__init__.py similarity index 100% rename from coolast.py rename to __init__.py diff --git a/__pycache__/nonterminals.cpython-37.pyc b/__pycache__/nonterminals.cpython-37.pyc deleted file mode 100644 index 4f5e07c448dbe61197702e88d4308b8bd4a0a375..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2098 zcmah~OK;mo5Z)yziF#OeVkfa37d6n64wj0xM*BmO*PkYX-G}+6JuytsArfv|-RapnC@0 z2fA<2CeWrqTR>X|Jpg)O&_key20a3LWY9Lywm~~UI|l6n?HcqL=y9~yXPvM9p(=G8 zU3(#eBnhN$yp&lq4%H}2wc8h|5@{%O^DIkW37L%2AP&i7xom)^c#4M*f_Xe*o)uM0 zF}Y_)4i2g6^&gX5X75C_IOQ}XJ6c2z;Uhf7YlxEHuv>P;OI~a#9`PCfz?D_J38Tut`VAQ98f zQIMvY+K2j%m3z4I&)y~|j< z6S4(R(>j=ULhdvn=l62r?l~if%rU6&TWExM1An4tK4F*5)53yqxzR(w zFKbDBv4>a7hWW&XpgOWXx}N&iVKKIOR*WdL8sjEK0Yh! zvLPeR=%?(GD`#d&PgPdV(OcD9cFbn{Pj+Rg+BGXJ>Z)sY;oj8eeRIwF@HAr|_^&Lr ze!+!dx+lclVHSl$A$*Ug*oG+CZyQ$}F3`F=>@^O5YZ)VsdP>^fv9#6wR`UXS8~VIv zRIbnU!#5%o?{oR&YpAAZ4x9FtB;6sW>-!^+;rrdgI19n}lkOMWP6ItU&V?lI=DT$L z)g%`uQf3(GQ87xj!TO1XN zIQIQj!{Oj>Xp=dZT7}qH_8sZEhD+xS?zLCgN+UL{o0ty@p_ULAz_c|Kff`G35RVF_ z>w&_!55`L9Y9cUg(X^EZ@N)2uMo{X?00dlm%}BtT4Cq3Dx1gBYPuGUy)LfqjU@4w9 ziQR?iv_8n9$pO954oTQ$Np456vpDLv!~l(l4IJ* za1;w^xSO*`w9Y4!rqE1}<}Y*&oKh9Edqj-&g<7CvG1Se|dG0@%)SsRH$Aq0ML$(Q*fl4t`P^BtJDSFR|CR&UnXC|WH zk~=j&0gn6}t}1Sv_yJrv@w(Nvm8pqc*7r8O?tcBcy{IkR?F&teX8TZ*2;JmiUaVnMI~MPdO9pa~YCL@Z(v z%90hys-OlnqJ|nw2$o=ySi%xa36_PwjAf{kUd9SEh!x_rWK*&wIU_kMIVV_!d14i- za7VBP3&a}MU{P{Oa#?T!R)`Zg0Zj6);3V85PU0lomwX^N1@922a0=cPtiyZ6I@V!T zumNpi0~_#A@{#14WJhvcvMc$%;52Lyr*RrS5NyJS#3nZ3Bgu~?KM`!fr^FVv;4{G) z_?$R{Gq5SSB{&PbKC?Ir+k$hjbCG$S@qL`fJGk&-@mjs6{eQK{H;A+qqQ zkL)MbLn9pc*s-l3WIspkl+$w0(YM0jme7h3hQ4(=2$5|?nuFoFM=cS}-N=}ZY2EOQ zUMN|>HpLiGeI&B&4#QV{KUyHuDr?IKn((OyR~_!6*{%v_-|!8mbBSi?`L{*R-3VG^ zqk*C_iNnE4l-~Bt3z51fCcwgTbW?+(9biiBS<&*#bIZmg*!H}B%G>umJDLNeqWVT? zc`mb3xo9U0N+#Cg^%z%@ZNR`VDv&ZqmP`@zV)o1DP6Mm2bw40EoD*~Hq(iDOvq$w}1QA6Pc9W4bD+xa_&* zAlr)HXolAd80C(kO<3}mz zknzFw>XGcT18Ot9%(ErK^6I&UgC{3(zE3R~##tNPSp71t(8^#SN*BaxKhF6`b5p~( zz$?Ogn5IFUt81pL;2(;=L`4#h|2Deko`c;B8!yrCQm!k$%%FRGMK`D0HR-PC_QxZv z_pf4Y+o2I{e5_KI;8%K7RV^dFoXJm>9O`+}$KMjkn$#1HpIqYp^!Ls9B$`_bWpzTW NstvWkMCLR6po$GUREaLoEQnnDxUuSZ%-C&|B6t?M zb}NAsPrh+xjy>m0@~+pj4IHno7VZvuvo#nudC;E;PgHL9?tG zXpS`t-DAx`^Q?Q&0&5;xWGz5TtVQTPYYBS5x(_{MJ%Apu9zu^rN?GuBgRgY^u0&f0)pu%1JktQXK0YZKaLZ9#q3HnhX)L%XaU zXpglE?X&iv1J*v|_y-@2zVoN7ZC~VKCvSv)Zf28&@>ZJZFh0xMVVuz!>AZcaR77rE zh_8kCR*3CF^b4_vM4Abr%VtCw#>Ue0T#Pa)bv@ZoLEemMEL&lEsrUi)1?5)YB2wO@ z*e}FxA@+3x%P53Xh(kQcn?m6I9Wzz-q5o2LV}*t2Q5a)dF5b(jld31}(5E;HgOIeG zDpx;<-4V%7H9}j6tno`QbQ_KAs)XXfsdl|{%4E-rR7!Q%REevxfU>nbH5$2j(^r{n zxmv4JSK8TF4HAX4rqWJn6b?KUsaV<(1=*k+G?vpkJR4S>-Z@RiO8bMGq|Q~{D!J0G zuLQDNxlHzLkCR@H3qn~3y(vOHjf+wDxG2+ANEGMJz3xQkV%3wlX!X5RAnO2S5ofAs zH^sbt#0*8feJn2S?MxIITO_(jrG*OO!%Q>ex9NwM*g%B6W|b{Ti@sdAk+hNcB%%?@ zDqGkA1C{(V^hR01vMC&As7BsLKb%iYVj@e4Fyffh2Cg}SSUhHHeTYlfCSFG zsd`|$_BAc4ni|jDEs6=I(Z3s7q+i!AYG8o5qJjBDck^I@y`s4V$Uz?0BIq-kQ}~>e zI#z0&ixyM!ykAdJV}>Vbe&1`gAgJ95cxqnp<7B!{jB9^3B45K_Jj$N_sB4)U+~gK$ zbBx=wdXL6!u%4S>LvF=#b1(r#Xjx%sLMxQW1f*+Fey&3sR8~whMT7R|3_73_zgm!5 z#jhREgo-nr!w+CU@iiUUv@gdl) z@OIt-!|;;AI}zUlBMPs=Uf72Q?STE@;MxVFZ~)hxa1ajR+6`myGOj%^4u^5=g(Gkj z*FKnpSKt`B)DOqu#4v6Rz)5%&*FiW1r*Yi{1q|=m)S5|Z3BMqRs$KGv&h~O@#EEcN z${zk)6Gi!3c5aID{ssQDM`gu4HWAdqJ5ZZ+?Yb}O0e8&Qib+gr&H7O-NDH$K5!RA~ z3na|fnsQjbS`=jzA=(hg@9PKO6czexM}XNiV;; zybj{hMHfl3*WWQn5k!FD2;3CMEmiPpthphh;*3V~y`7cSJXWRco{GZSqT&>^?Ro9ecEh3AHh= zel#a%?5F!F367rXW8*1{w<-RzFfqp?{;(+~Ps-MuIIPUvhbKq`COOV*-lT|V1;Oi$ zxyXOSkH`;lmyhI01rr5awkZ&;xOa;7ONuA81y2@4^x;VUG#krI6Z?to5ZJ0mjN;w| z{#3wCdAPVoeo#1jg1AtfN}jRlw2J#y5$GURM!gX>C(q0MMSuDKQF(b?rRKDV1NbF! z2vRFqXa-!25pFaa%`6EAiGGN{ONz;lfIk!?h&v@!S*pO(Ts>&S3$oHuz5X)N++34K zfH_h^++0?CS-7#OHtut`5b+0|%7QpX;|iVo<4O7ZmcJZcKaCYc0Z$oV49S#CFx|K>ixUBgQsKHSKWaVcD>^yv+UmB)nUh9X zYo?Z;@Gur9km}@IBbu#=R}oKHq^RSR6qxFQ>{!_o;KM_io*zwF8Qmk~AxymyeC!Ml8{muq!`i zz#i)lrcU5fomjTQ#kTzrE}N1 z0--#jihCP>Fq&&%IcZVb^T`mJv9HvR)hdLSp--`cBsF~#-8oT(YrLjFDZ%l11{ zBwI`&NXzHqm<#HFuM5!-n4a~HmfA^8V99MSPy_dtaRpEdNoh z%HHa@L)@x>zal(295ys)-jQ+j(#ZdaBg)3nFzyUA~cfJoW>9F+L}=HT*$nh#69Al0guBR zzWQEAm_@+K{4jioU6baribHB(H^rw3yQl(`S}FiS#c92|#7z|Yp&aZvwd~q}so}6{ zyqH0XlNZ-;agFnhM0^`Dah-rl$PL0=0^dTgxiT<#-=%$(UQ&=LRn=_GiCT017r2?d zURas+>bBldl7H)|vs?0X@95Br%A%MRWqg0m`-A*J@6}_sP=s4}Ah1|G++DjtDs)?u zpXM{Jr13{t>>DW2WuJD~1&2*LL-Lirk!4CuifP5Cj)kaD^}drZdKZad0yMqEUIOC; zP9jKKX%zYOkSFsE5a(!ree|XIrf4*=KP+bBQWUt^@dH2N-ulz_6VgqQ)0hb5#K3ph+w$4Kg{-w? zs>EFqy;YXd^jB#N9$Jo&idQJWB`th&vB^~*RnfNxMwW0yGQC`+A=FR^AyaW1I delta 3421 zcma)8U2I%O6~1%-_U_udUfXNO|8ZK|@j9;KkOrsJaose(O6veAinEe?z446gOYYvg zo_n3x(OMR&5h|sM+EFDW`p~{r2q7fI6CeRk1yNKXkfM1&;-yj~!~^0fLWpzb+G~4p z5xcr)&isAn%=w%7?ab#Fau>7Nj0V3yu<(t)biJGF+P(z6&1R}m;%g=CwiXmjjgfm9 zK1ekD-_ZhnUc0JMofM5(-gEOCAYMq^8|tCmXPlKOkif=i~a$G zX(d86*iCk^%w>aaTh!hm0QF^>rWxQ&+C-ZH)S_9MgVv@kG!Jcxw$e6e9omkHEE8Iw z9k4#lGIWY|(qlX1O;T!tUKj1&(SUCTzK8ZIKFe~nkM=9R1^5AaT=DruI!I3dY%6_+ zJ_~Id9iqd~w$l-M650YCrA25v=omc(Z6_V4&p~^Po~IM^G$_zTC+Qg&>84+zXQAz( z&(m|z_EHC|@`89urimq{^p}YvHuXXAbNyycT2Wk%nY5O@pzMo+G5&R#UJiMs9LJ2q z>}t8nik37Z<}dR!7>}ddcngv|601&Z;H2ZaUf{*9>p(Bc0nv!~uF+3g#K*?Rq*;8; z>>O&smG=Fzzs@3=jacl~Me;1n6>Z)s-Zm!+hrxL#%(aP6P4_G!6m{OJfTGRH-Oz8; zB)3|Q+?bbx$cw!&I3ZkXP`quGt|rpU)hY|9bZ)TC%bbV2Xecz^2aw4@4-1#MGNlLb zhQzo%Dn9G!6l-?R3Dlam?<@6R2;xU}FF7SXvB$)}>~}}eh(%rM6O)oe4VphqPp`0m zZB+TpIq|a;e}4CrG53NMX)A|CiJlEAra4;*R|4-LJ1yp&8>0qFAsmChK?YC3*c6VV zpMLsh=S4D+=)|AF(PxnyM(0B?_5ys74#X6H%?ydVnU|(;6$nutF%IljhCB=bCj)0M zg_Y{e%i?jy+x~w1k2@8W(Be+2@Oet+5X9j&Haf@--%sIjGQ%+>T*t3f5bXYj>@+uAMnHKNuT8zVL2 zlD06gWo~rU%x}WzLT<~dkq`Bn^${W3+O^x-+BAHH+kgZm(4Jc&APs+LSj>)FH-SW0 z$W}rAg0n?xnQ1hln>XT(}-hY0fpXD`sjKU*fp>bv%^ zj><1g$3V>GUn&{W@L8ZrVNz7=BwQw81%DBUG~!BCC21+ks*&f1!ES8UB_;Y{Cal00 zwE@xeocLS*&L9qgH?XWUgt1DmSg_XDMpT8zf`9Z%X$IvA+Ypai@7kF9d`8T+b&e=Z zj07k`(g;F{Ms|MwU&k3%fApUH4mJuzhLfal2EI>waH+yW`j8M)9W4o?r@q8*hpax&}$R_+?k`_Uzu8>xrX*L@aiyh>!_}$lF~Z*f)Sti? z;Tu6C4*WAj-0mK0mNo^WGpba3r~CLtWz;*cikFal1IR(of&mtAT)78f6HzJ>trcFb zuKrN`y?dQ33feO^c$5<}N%%zfSKQx-ANPFKT?CX;`T>Xdb76EZ)@Kp?u)Cy_tct@= zU{X~TjXccV!bjS~-W2S|?3^o-D@8I_>=O&U!`qnP>Vd?uT&o+8pFr*ul5;?0Gu{v0 zQia8|ivd;|&B1L;(GSYwfI{UcmOBmA^;HsDeg#093TX!|nb4i{zeo+Bpwh_9(X}W5eQHTB&0})Rm1}~Ar=ID z-+$`XJ>6q35$TyabvdWb`Okm;`}ynn>FJV&-}d%bKJR~6(|*94_?N@Qc^v*_B>6&Y}ImcYo7PWf*1vmox`|0>{ig%4DJ`4Be*|;+A8jjI*Yhl#N8oBzoso6dk1sVR+g;L zda30HVeyLB>$}}+ZV=ipZw9Six7i7EpYGyf$p}lYcs*xpm5;-@3qjzuZfpf^`f!z< z#Xl1l=W+P2qHwjk?r3$xH67hC?ir5hSa*RuC+FnvYW18`aBQ6O4$yK>7lc^#fy zc8dxLyL!E(5Ky0TW&!?On7_8YaiiA>3om%hjg6)UD6MXD!wm~J)q_>S!5_~Cj*B?_ zDvE(V&>GsnKnd8;o4&%gSMau1ME#N(TE5#^^GG7z6pG)`yb4b5K6~a?Z^J#a-f`b> zy)&5qw!0ei{4=j?2e*3NGpoH`=gjKH=9$gy)!xQttK)jho7Z@ zl0l?uXp96YoM*sM^j*@1LWk#WdIyb$S+Pl@L6pYBrE^ksOL~~=1-D#pRp3EOp1C42 zxf(7oupa2UhBqHzMFzOKrUfR>`kTq>SYfHlt2GP6tM{Vs zI;FcHlDhp>&C=>c@YPf}wbJWecfE}kr0bA;;`(t=pA!qTU2PB4H8AcQx^@$c*)U=` zWrjI_3-c9(gj1M&B$xdqQxSh6w7`2s&`YQ3`(RbUiC}`LJjJm%sHRu+{(J_kR2;<| z%VuO4f$#UQ@Che87Z`7WS5w3c^gZjob_vt|y0&ZVpthac%VQq8uDt~jCT|wN>o?S! zrBlySDA#~z zET;BL#-esa+tH(*^6Q58U#KbYo;~gA^V-Lf`t+%jKccMz2LJJ(JA45K#SU|P(8O3a?_PUG(uzf1EKB@Nfi>)yT!9N z-L89Q(>wP8_Q%dGt^f20L4mUyjpehQ-fFYspIc7e@g7BckFw-P1J8S!{k$K=J_x-f zJbfNV1lv0V5h`x$XK=pc-f(MWW3?Q8OqlVx@{M)Hh}3L(-UQBX)Gl^g!!2f>FAueP;D`q) zTTw_(W}L&r<3x&hspLJ5M&1)FYAi(8kv+W=ES_cY5f;>N;dCU^SKUr0mg}4GF)ienRY5T7o8cWigU?1nH!-nE&0))eo%lRx$STWXptpg@fj(+kP?}*u zsJcV_PD(mTf>CYn;*cePNpUiErIK|RV^2UpEVDbi;Y)PD53O5G|5oI5g;vwM>5mRX zY5OJzA_ZysJY>ecp%NTXW^jrZafob%b(eLUy)&rrsA`7{k(9FNpL~Tcvlsa1)y!Dp z6%7$JmqUg+j|&=-V$dFwMSzRErXSJ19-Gw$%;jg}nzk9$SQ#S_etk~aDC9#~d;#@A zj;VNCZ{ro2F>Qz{tb!{2#>fZ9n(X(UiBAEZ4v6R;rQd`_okP`ca;Rugvjn8#AVUO{ ztSaT4Lx({~XkLq%YeCyH?=#|Ktn|&N{MwS0(v>3c9DL%|<^*u)CVw*nPIj5zYZRyz zz}K8i&thYuNuzN;GhlZ9>;M*vUT0Y=H0N4f#~qan;Z&n> z(+$w?Mx*gtnNjC63!5|;KQM!6YT!1!HxAu@x>SpP&jpAl)g)^5TrKW1sT~H<8y9Lq z9LK%gX#92pn}t|k$|{SBb+=2M8akppArYF7O#=>s?}TnZ*efR0kQ^oQh2H z{g-k0ys!qjvet3tw^9K$&@Zk zEY#5IFos@g_|Yo+ahUHMUdT*JY;!7{Kfn=7i^DNi86-@!+YsR<65|x!8|eNqgbuWI z+n*KPdQ6GVH=&f<#vb$n!!0pzmhu`(uQoedDoW~cDq+64x#@PDST*LA!W@A$G~u!S zAz>wHYWl2hXQaNsiv|g^E{rWC`ux>-Y3zEIOg#Rj$v>i>F*It&QapX;!*eK zMplyQWo4-_mO*47VFrdVGk8x4pYHzeTDLUm+dCKATAg*snUr_3!;G-aBXn8Vi4cBOW0$g)z1Q!Qg63*xJ!AgJ@sG zydsw-C7TJ;xqw&yYW!f4V&)w9<9Y0S`0$|lP|}Au;`wASw%?!~8eyO|n^fnMw{FDz z{M+#(?6*2eaQs@&zhdPMl!^PM+sjLqB-Z7x4DKvm2@%O}FxNvzoNAlOM?kiOk{@}zkXeQUL>D>cKXJrsacF2Q_6d`rrBKEb z!C5n6H`Ek)k{Nq!CV=qhe`kgrUWJ2%3#AxWp{-;y$c>aHHsl0yqnLr26-^P_1eqx& zl4fOT>S099H~}NdKP|+B<^uc>N3@wME`g~^#q6j{encvNLsBK(vz#1Ya|`JvZe%4D z#R4ips!Yr7%&L$ZI_H@O2lJzV2hs#~4gXQBqY*GV^C;|etmKXnn1O}Rg0Yv2H+csp z0%}NtLC5fd3yRDn;32V&ljv2(6B8*cHRBWjAc5Sn{{K$o}zLefP0sM7{s`xDnH)4<{=qwN=pIInBZrg^cvJUu zN$W$_nrk~H+|i%1>P56IIn!v%G(M|dirO-b&teuEllSUnm9|%(b}K4j4_3>JTUF_L zxIW|@a~?svS=2x3JSM^WIp>7)xbwtay*}^MATXX37i?&q68q+POhXb#RH?_wB#<_y z13}-gf}Er>X^mWvkFN4!f#h2Z@)u%Hd1o+}k4A&q-(rG7d4ykAL)+ebSP+!_}KXu2%mBx4Dbd7K%!PM zyK>2*i{%x=#YMjf1$^fUVM7w*SuScDuJ(?J=hmHLxHIv*x|17N;QL%#5=U>Je2sF# zf>O2|{hoSOehuGaI3|)4u(V81z?T>5F3&sckL2!|JNclnXAkoC>CEOO$^S*S>4etv zJ!d-sGM3kLoFr65BkA=LErquBYsPIPoWvYJ12SSkd?ElVW<-v>TRO{~ASVBx`x;Tj zzVllD$#~&{UZd^zx*3I)wEq#|@or+M5pcX)c=jtP9MFNEXR8}5giMQaQhI=sQ{KMF zO(AVkb!ZXfFz0M-Z2GWTL`R6y;Fb$AECi)DfKu=Me4slcV1$Ke+B*bAOcWEDg)mK6 zR*iWml8SDdDSb!n6O_>3C)H8l`rkwmFhN?oukT>bd>1suRG+rl(%;tZJU#$rERw!v zDO{BPK+3IgRwE@zJ-*kGdIWcrS%-QP^_Nh84(}s57xf?7u|RRTMQtaC`dkj*_yl>e zhWK5NjXIm{nC$#hv~Fd6`CoKWud>7E_DB?nBdmD-o`|d^VZl|!E50Z<~qHmpe;Jk8@x87Ynta)bS;7(_3&|MvNz!2v|(5^3OFMb zykX;9jM^g68!LzCOG)8C8BD9a&21&+MZk;cBz8ItJ8@@}ogSG^f}9b#>7(VhIeU@o zaAwN#XT#y=U)kuFUt&4tl;tQY?mC?&p-E0A@-phh=GM&(Zec@2b{PKFqwfY}MzWx@ zSN#idqX_Ena&Bw^ouyZy6~Nip5A7d|XSM&8L~#vS1#NV}*?Fab?tLCRxNtT^MPQzA zR*eSK#h!decHaPN8f`eQ@YY@$P&F9s{1FYA{MKD<&Gj}Ow4d_P=8WZy&^0{*if{3Y_4vJ#A6dm^2PIKdi(>(Vlc=KP-KCr=$?&{XNMmAu_5?;ltRJ$gTA}eEdWT3-xPt;jC9s31Rd>dLrjV8l@>mSwM5D1Cb1-xDS$y!wyCcp~w3w64 z=|@8ADzchZpr+}9h300@4@;e1Z@oz!>kkE+sR~6h(2*N}KfnoPm{Cw^2-|>LP$FA1 z%HV`q6=iUuC8&DDWv6uII*9ob8$Uz&nu-aO4ys#(DYH_tNK1JCuenI<44!(8b4h|U z8RCyW7=hFgPxDJ?9~Pk~@cpUp2Hux(AICkC2J&=tNXCc$oI{FJN~t5EqW<*I&;^Q9?r)>-O#=7MV?wn(E3>GS$z#dqRL@wPDejxPX04@kc zZtTLeA!PWekci=Bh+(u#`@|b}<2Sne5Gi`su>_6+Mg;|`50O-_SSY$GHEh0#(;w=~ zedBcP9ZvV1|G^K=J=sy=@nv3}Vetxzu;_NT@Ih-6P6shOgjQvzwY)7>j4&J7HY8FP zaG^n!54O>5o^dE>3{g~b_M+n{@q37ZYerc|8Uh&S=0~09!A*LN^92e;PN`7PQi_S9gjFg=@rEdZ%JfkP((PJi>JUPEbLr3eAMp9k+ z>;0){^80r0NMAB{id;oo0E*ONt^o*TU07-dZLzUqI<#pg;cr~GdTB(T;52ie*oFp@_n7 z5QD20@R4r=uyp&)P|cG;+g(IX!(zMYNJV!0{s_X~Q?eU9Cbxy9kA zD2Icoe2x+&gqz30CzK6}}5KcI|O7Oqpxo@=GFJ$C?;_1eMKcPN_ zF~x@PtJhnb(minaH4Y${D?}aUITEL#K`cdrD5@G-<%9%@{FE7)Urr<6R7;hx;e_?d zU!*zgmE!3^HYxU3&)Ji%=wW`;SRy%wW~&=`#Eaw@60YpZ7M4 zUuN-j7Qf0O6%Ywc$waL1O%gy-Gt(A$AO)p?wyg4B`v#bCgs* ixd=+dD4Uhz)eF_xYOeB;%8}V8DvwkjseDQM;Qs&*3`f!MS_b;&KD-p2KeQ^s|9+o%_DHS1JxRl!vWSNohQuBvXqEpA)&8Qj_L%;C-)>dUyA zcNTE9;Fj^NSzO=eEaG|*wG~_)aF%ejgsXjyeot(V$< z(Bl1gGjVbTyZ<5zSF7ueRyQ2oF>Y#gQ}woPsb1D|s(1Cg>Q%kq+NwX>dcCOnQZG6C z&~`Pg21>MvcXX0!tv1))u<(M{TwiZ`%Vuc# zZg(xTdUE@Uy8Zi_$ASFd$&*+6>+Z>GUH1#Fck*Sgzv;GuzJK!N&ERUkce2&*cTcv~ z2PX%ct^WF;-F3Z{!DeVT8tq;?Xfz5W#X_O!d40G~5xf%Dwsh8DqPYG z9>r!^_xLHHNfk4=3=55hA9#%hFMM`g(}$I$5vdw$BjFDF7O)k4o8zeX;<*EFuh!5j zKGJAZGR>uZQgtmM0}t@X5s^OCaDw*qK;JgJg#aTm!r4VFFmcqsl8lZOmfC*1=LgMR z%k{{((7x#Q0vDHI@zUnNecto>-m)R=2y^}5s_RYRO4D%~js1AtCpR^{q?e2gXQX;M zrAP62Lg`Xq1dyR^eHUsyN}0!Y!g5R|#owF5t%yi(p3jisnSskU8htSG0PZRZjgnq5 zhO^1ov36|e67e8YMEQ)>^YX=AWTSY&e}3S%yZzn~wj#q~469KKN#$J|xx<$CY6wEu zb$gA*LrF7PA(X1sSFbF8D5DMo7oD25i-2SR&Y4sv>X(pUm?e{LZ-g>*&90w;39UJwRPz2hxb_;?v zGHx5Xb_L4VFk+B0!<@f?{t83F8Fb#+Xa((l&tEnb5ZL&FS46R_hee1=x9R&(&y*8n zg$!9K1jXt~+Ndj{u1{gi6D2qrtLqljwqxG1K(VfaUZ^isItP{hL6D~+ zJNh-tKOGdlqDR-pHN$&rq&p_B9qS-eX+ishwiVT z_}@;h2p@kE6bT=!MG5G5+rW3tEu&`#B`43fr_zZpdH=z_K&3(Jwy{fpX10xQ>E7`h zM@RZ|+M9>BOzFQl`TV!^>-pCd7s?qBE3A4P-8&@a6i=7Nm@46_MUM4j(Lk043{qzYo^&jx|lzPu5*nYW71-)Ol5KIz?u zuPR8hl=KnOLVXbGentz$BGK|exf_iWc*KVX1VaGu)yuktW7R0@3r5X4tRFILobz5q z>dNxeoM9O|0j#OL>C8(j3mk=M}uQQoI$6 zwSlq4(2mD*%==3KmiBiXU}I=Cya!MxeV>A*s%zsY%6`Po)&98I6hNuq+<4?J0Gct< zdkKs1d<`$f5;>oI|3ir5p2EQa?POY5%(Re^lb>7ydznV&GL6LISDY$-QzXwLYNWU_ zCU1|Us>z0E{~&LsNE`1?mp01zG-(q_vLH!jXg>eh^JA{y6d`h8F=(Ylh>X<_^rLX@ zQaOseQT>IO)^Py}NU%VTJ}jfPM0S>QQ+cvS|DWKe;?LQ-$Lk$EKf?#EqKJEbud$Yj zwCZ*gXBAbnhg(T&x&&ZTwD?#IFTXt)x`b+2|0=)fXB*kj}{e{ zmtmPstIF^r@q5hGu@CSg(p8$%k@jYF3xm)BBS-qHP_*lbv!n}NA+R%69t-swspJSm zeNa4g#qGH_2Hxo}@{9ber45h9?s_s9E2p~sR0gbb z53A{2nKXa`EJHR#G1Bw}eYk%|Q%OIG7bHk9gF*vGCmWM_596NqNfgtad~t-ogz8wl zs+qRL^B$9Ij)^pN1}EaX(VsdbBY{9{O+TQ0Gxq8X)I1s2bj+y6%6K{m8gt4GVOK>0 zgw(qQKjPMZ8Lx=ZU~Esg{p^j!?Z^eNFhg0^IA30EB3INH`j6H($WgSrn7|2muE>xk&H z0u%+=6dZ0mCZkHQbLcsX2rX!_hAnEh%-c*S7^_3`m|t7AQn^wBo&z!M!7k)59{UaK zF*(^``mia6c7UK}cX^h?2_9)Qelycxw*UM9924OT9^o-zG8G7YhZr18k|)wuoGobg z9Cs2Q!kI?niW}g&>y5^{nN}Av1DiZByw znbd;k84`EP6}Z^>6==$NiZg196!We zOe2#NL^5R%6Av}Cy2v3RP2xw;;>W3^r}4sseG`N8hqxcB=Y26(nTSfP+nC@ch;bb6 zjdcGI;%M!f?azsUJ*1#hqG;n5>;j|xm^e!X2c=h=-3^tC^Pa;;!hCZuaC=T{8uQ9v zPS6^fh)n;8v{E!ReNMNTk&1dL^x}bpR}^ION`#rC7(<&9Xv6z7?n(30rP`x#{2BIL zS+f&N64ubO;@C*Wa%rU9g5NQg_MoL%iS5ieC|Sy)D(MpY@*>ZuAMpq>a-QIdn3g}s z{lp%YBrqP%k8wt23|E&6Qx!xS5@n!RXIc>H7r|!~|6MjiV+6rxUd&X|i5tmA4si2- z2}LaG*+}hf8T;M5NOwm0k?}oY?IaLx$95)`hi{xeCE!16M?Jn|0M0yW<+`zuHft`kO+V{QB z;O)Iyplk4hObeMVOz{lZ&laC1&^Y?@5YZRWuPBO1g=ClRP@MjnuTSBZ(ww{TOR`^k z^@q6r!%Pzyj_q_`$2c}p^A_sk%D_*vp5ko&?erFQ`j`|s8FN~6rTuGgkz>3Oy}p2| zy|no(>i-UV%(Y4?1UpQ1f^Jkv21(){8mrz%*~nfNTP)q*XPU`K!adsRJrff&pZ}12 z-WcwWdy$yx<;qkb601xx74%h^dNJJO%cOmNjQ0egSfIlX@`j)l+5CO%f&h&469X-0 z9_uOF$;PoegMBQU|6wCvH=1JvMn$uX-cfwB#gB92F&Q+9!!A>dFS%<$n0uvt zr)$UPM!bY)yq`z0i_UZS?qH9lcW$ipohWusjX!$&-WsRa{7a_s@vct+I3hxeFHpkR zab^bCc^+eXeD_Wh=>CnLA=GQSy@Tm{_z4f;jo44<*U&cngbt=XLYXO4 z%8uK~My7HbLzR2+hTK9rHyC+DMe%w{uqLzKGQQaoal;9Z+}W7Va1f)1iD%4w9hNiZ zVh+PA$4G7&fr*5Mwr$+X#dC)v6FIbeEbfJLYDhd!v9}>@zIW1eCGlqw!%o_ca5UN08h{N#W?w?M^PXVe*87g*R#{Vs5 z&5{5SB4XAqBt#h#JSrQH+@HlReRyPAi|M2Hh81aw;1@v5UNa6R9QNcM4eflyhvSh-2Oa?{FF6P0Ue!6`9CGeQEBl?pz?lbRLU?QxIBqib z=Wrsc4pgbfD-eJsrUMvnSV2yfzG#gc=IPPApbY(se4FQmIF9&Pd}-MZXHx9;!*a&k z@xvkvs4R!@!x^mY@dC99CCm-Dq(^)?naY4)ghcyu?N+dhd%{6DL}8#Q<(jJaPZs!8 zqcvR#3Y||Jw-{cf>#yS7k$y|NjfDtEe=G!8Mj(q0V7m#eTjt2{PNAb<#5LP{QUKP( z@&Zg^M9T{-z^^I!0Dx}?iyKa9BNH4qSBItN*9XC7jZ0dF%g;7@y?&tP{oUGn-*aoh z)n>2O@3}SML``K%RuI>p0$JX17Drfoj>Sb5=UKdlA_i<4TB#2$a(2>*Y%eTlnBsqu4YNC%aReU9w5G>$7i6A@*-JQ4eweI` zF+40Mi;{g@QzB_Ux`+NsU`2wZcXFNltwNk?>ge&g=$fgPlMElebk(h8v<-6Q2Q@4& z>90Ysx|_AfYfL(?EZZv4{|X3!q)^o;`racfNS#+>LGg+r+ORZ87n7vUlMKQ!Ja(GA z;C;=gU`gE~%Hd+n5#;VN%T5xWkRJ(8=-uq8dgE)1cm+QP%0&^w{6$8&mh%~nc^u#M zF0n|JCA(DWbyiJui0{0}4$%=z)C9{>pdJa7T#6TR{r~6&X}r5`d@iFKN8{m$DZiUy zc%Nq*5wq$z_kNKDnKh;q#pHt*$24O9js_EhlfyTtIie1n6?OD2U?>nHnWl2gC2aw# zoeyY4-H|M|;I%YBSRGo& z{1dfd70Uf+(wC=8MOm=LnX%HaoV`D+WONMALEvOQRxtTv=#3J%XLv>x!*nR!>Cjx? z=n4<(w1Pow`qa}CGRS!Q^JFI@SPc+uL8;~d(yHVHW6a)Yt#6`N6i6BZVeV0!Y?jbv zXcuR{EKGo2D|ttBID0A-em(ZNAWpO;q5X62rYr)Bbl(%JGC|)NJlQ9GtkiS^x&f6> zj7MhfEE#n2Adfv6^eZs4H_nqbtfxE0LG2(!-ZF9Dx^W0sChk|aaw7|C3v(S=U3mQ{ z*4F8`Hb<7DzpL(*U&CT~$HY1U3@wchTq<>y=M`o#a_^d3`Jiyi9_4Q{2+hla?-$*s z6I$o`&SpX+nMY9KSW1eC?$4VgwZ`DrjO$n%5^Dg3I8s3@6^DN^fg>N3PI115>%ULm zj1@7j4L=$WT+nZH{C+QEpOWW)LV7$0v`vuXxw!XsN(VIi4L;RiA!1sTgE9c@oQl!~ zH$}7wqoGBT!<@6RKJek2NSs*X!#^XnSB0gQ!BX!8Z|Keh8DSyn_6A82N5r(?df1Tg zGG_c2U^*(gZKm=aJ)f|IGDNB4F!|p>5pcb%c3a=V%=R{9iZcQov#ozkyK!U$$v8;) znj^TVHLCBxYMjz2Nm6e{^+?Jn=MD8H>YqdXX}pj1qNblNS&W--Vd=x?V3Jvx;z)}shG6?jb!ZMe&*pYRFF7O zyR9EbR(S`-W1J$l1Vw0-I12>zL~@C)=SXkx+>FlYgj>MeDyA$S2;N}1ieTThY zzzGADvi#Wy)cIF7hUK{LY%S?Fg@Xbw-9C*I2Nn}ckrj9zdIPo-b`ne&acMOc9yNTZln5U!jGYG z@!?AeztIgzhlm{@QC!x}b=#3tGagYYm$Jh?)ord{cABUE0&o8a4`{>VaknS=lm&hD z5>(IUM=2pH#uIfDA(Jc}g)DX@a%+7LKZK!#h5E(1aq;3LG1bWy|1_1l68s1T$n-T+Pf{w^NN5>>ZP0G5yZDKeQN~d9gfi&z5IYMgxx|8`b3u_VFc; z2gFm*@gokVU9{cPF8G0&BwmnSDdJp`FEah3(l1P|@JDe-zNkfy^;z}Px6rzPHAAZ{ z3Jte0&3z0vMvz}fY8h@0Ob!wzkYg9`f+LALFxx8;GBRMy0~ucg8k$7LIMV0<3;6RBLCY2XaHEq? zzlk?)#&7gsB;t1+OXw(|Rjf$o4^0lp&sW53FruhoZcAplLw#jvoT%MlcklcUHU!@i z83>ys*p}ddb8lhM?QN{%_mYSW5(dV(9pz57Jr55~GL_o)Lo!wTDd28ZUxaSk`V!XC zK-=|0SYaG7cxM8fG9dh=SH*tC6GOUC8V7q51IbCbe~d*4`Sy4KqtrG(%8f^AqBOuh z5Y)Mz2vcFlIZ!y)c^(IB%z$(dxTVu$!U`pQ5IK>mI5e5Z2Pc_v7WdvKVMGoMPGwmi z&P1KxF*!#064Gdom2811N{hJ$A_Vg>0-r*yC_rXhve_u%jcC?6Jo(R4*fM2)EaCfH z(l+IqZKs_V;SgD&gh=z#2P7&J*o#z&BIlDJ1C zn&)W2A38wd@muH&kytUYgiawq7a1C-)MMg7Nz>G!3~kax;{Ge480xf$pJOHz^F*3R zoS0bNDf9mEh@+5lnE-}UBEL%eS~hKp;U?hk1bX(J0xnuD0YOCt1YD54OGpqF6F^2_ zklz4EyFH~LBA$#5sFMQx2u2m~zwEhRXuH3h!Tlr>jeuXpf+;9POJ^@ESh4v}+yIN*xV?U~DRv)ZBQ=O~kDj%;Ln0ugdfA#*#uV|0|FYIBsMF0Q* diff --git a/cmp/automata.py b/cmp/automata.py index 8c43ce1d5..a24ff7203 100755 --- a/cmp/automata.py +++ b/cmp/automata.py @@ -1,3 +1,5 @@ +from typing import Any, Dict, Set, Callable, List + try: import pydot except ModuleNotFoundError: @@ -5,14 +7,15 @@ class State: - def __init__(self, state, final=False, formatter=lambda x: str(x), shape='circle'): - self.state = state - self.final = final - self.transitions = {} - self.epsilon_transitions = set() + def __init__(self, state: Any, final: bool = False, formatter: Callable[['State'], str] = lambda x: str(x), + shape: str = 'circle'): + self.state: Any = state + self.final: bool = final + self.transitions: Dict[str, List['State']] = {} + self.epsilon_transitions: Set['State'] = set() self.tag = None self.formatter = formatter - self.shape = shape + self.shape: str = shape # The method name is set this way from compatibility issues. def set_formatter(self, value, attr='formatter', visited=None): @@ -33,18 +36,18 @@ def set_formatter(self, value, attr='formatter', visited=None): def has_transition(self, symbol): return symbol in self.transitions - def add_transition(self, symbol, state): + def add_transition(self, symbol: str, state: 'State'): try: self.transitions[symbol].append(state) except KeyError: self.transitions[symbol] = [state] return self - def add_epsilon_transition(self, state): + def add_epsilon_transition(self, state: 'State'): self.epsilon_transitions.add(state) return self - def recognize(self, string): + def recognize(self, string: str): states = self.epsilon_closure for symbol in string: states = self.move_by_state(symbol, *states) @@ -52,7 +55,7 @@ def recognize(self, string): return any(s.final for s in states) - def to_deterministic(self, formatter=lambda x: str(x)): + def to_deterministic(self, formatter=lambda x: str(x)) -> 'State': closure = self.epsilon_closure start = State(tuple(closure), any(s.final for s in closure), formatter) @@ -82,7 +85,7 @@ def to_deterministic(self, formatter=lambda x: str(x)): return start @staticmethod - def from_nfa(nfa, get_states=False): + def from_nfa(nfa, get_states: bool = False) -> 'State': states = [] for n in range(nfa.states): state = State(n, n in nfa.finals) @@ -102,7 +105,7 @@ def move_by_state(symbol, *states): @staticmethod def epsilon_closure_by_state(*states): - closure = {state for state in states} + closure = set(states) n = 0 while n != len(closure): diff --git a/cmp/grammalyzer/__init__.py b/cmp/grammalyzer/__init__.py deleted file mode 100755 index 37b649957..000000000 --- a/cmp/grammalyzer/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -from .parsing import ShiftReduceParser, LL1Parser, SLR1Parser, LR1Parser, LALR1Parser -from .lexer import Lexer -from .dtree import LLDerivationTree, LRDerivationTree -from .cleaner import delete_common_prefix, delete_immediate_left_recursion, clean_grammar diff --git a/cmp/grammalyzer/__pycache__/__init__.cpython-37.pyc b/cmp/grammalyzer/__pycache__/__init__.cpython-37.pyc deleted file mode 100644 index 51b330d5027a11dbc6b232fe64ca88c758074c79..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 507 zcmY*Wu};G<5RH?jY0{(=i4lo83lTf205L`owM-s}qU73I_~Po4RxK01!!KoJ;ul!J zE(OF%et!3!b$UAAL{VVrx_^<6pZb0?%}?2yT!7QEraQ}}E)9c?RW}TbD7AUs6ahl!&iA~W8RX-4bR;K@z*y&CxkkCS2DnwQ1 zD}uS$c4r4wAVMVy?Ms-qIYGImMvv>FQbJMZ3n~x`x{Hsvx6*+{y&$tIat!ngxCZ(f zxGPOE^7g!Hbs`!V(>H>*AE<5f2{beiYIwCMGTgw&Bv~qiWV?2$ s>ZDXkCMB+t?^JU4tY781s70IS=c`>exI|U0B}~k^81~e0QGl`Z~y=R diff --git a/cmp/grammalyzer/__pycache__/cleaner.cpython-37.pyc b/cmp/grammalyzer/__pycache__/cleaner.cpython-37.pyc deleted file mode 100644 index fc4325eb3aebc2410125eba9ee281f4c8d47b123..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6177 zcmb_gO>i7X74DwD{nes4Lbem5OiW0k;8=+r65|*X%d$*D5U$w7pt7QjcE;AMW_Nab zX6=<~HkB%wM7{(=ai9pHubgJnQEBm_*NVMX-J6xEJYSd8k6#t3h;$Yy`UP5V%iiroG{gc* zD>wVnm3__C`a0UKcv$vMWhU8JN_YJg}Xj>Szo#st}?Md;Vpmut0XzJ%l!8KnH{X$1w5FK?{pl)m!Y9Y~G z3+;L$b}j5zcwZ#?`{D!5)$eHi5=pR&_3lV1^0LKc(I^euvvSrh<1+2;8cE^D8YC!P zmHWke;ziMyELFkf_I{aV8`LT|LwQ?5BD$0Lq=Y-GU{0x3O-fj?%qx^Isxln4e$S{% zHj3|9_D!5~0p~Q;GadXdi_RgWGFk*)X>servW?%F;998sxEb1QM>)0^_)Wj%C_4xv zyRE#deglPi*zC5v$aXzDaHu_WyY;#sQd>Q2q0w&oQPZ*O&YD;El*3D32o)M!$8Lpo z>?v9|u-Cd#-LWIzcCjwji@JmLvgKmmYkBwV%u4=A}9|PW8ZRrRHn?we>iyERCk5#*)+YQcHQw@Vb{)F7VNKz9I`u z3+LLAAB3&hsxqiv!G43oq*i^Mwpg~>%5Qqn^4RvzESFYsHL>67dgJZSF6%+No=Sh& zh`nYzHJzZn?kt;YUcB!7PN@BKv~SI=hfQy8Bk-tSoI9)`hO zz1g0-#?}~YZedhC@SK*Xj-{ye`;|Z6lCgYO zUWM(u+RfsQY-kGt)+$vo)~U8FVH;xC*pcrGSN}k}BX5a!1!icj;hLiveXVyoo4xYf z6<|o8?LWGb7_N0t>_}Mol^qcSDO`XbS>KKrSl=ztxpEnG$W(Yy+!DR11X8S2`{s^J zOti?(Z!U{?C{ZF0K*k-ps!0z!TajZcuijM=6w>y$I$hsW zFbKcZ^jzPGGdmgHA>AFN<8+6QBTK}}3{DEnOtc2TH9VAPuAp;mXs-(?I+`nC%Nkq7 z5}>&Bax~CaJ=Kmrlgic9SPR`v^jXnnb1e*5!_)z+{(0%tH5gm3txkW7cGQp=V(VD0 zJ$^G2(pwF@tMTga97j(DVciL$(?^HX6}|aA#~^KckQRLk*)=-I;n6{&nfw?MfNmt( zj@U1Ls&xz;MeJVjLp$09LXVeT;$xgCUlureI6hqhBr_Z2~k70?e z<6rz3!}+|qB2`|REh}q*(P@?qYT%RL7232iAC2Bk`pEwf{{;++=wgIfl?PzVliD;)d7m}| zGcIdYZAu={)Ys5Id@qEW^p4LWMUNqi@m^qjB8K_#Q_G)Fc&f9bkXs3>__@G#hQ5Lv zf!}QV|`R&-h9!9+FtdZ98tMD=;P7mbuF8tKy_${Z0@}4n_UZwq=wZMypz1^1b z93VFuN4-!v(%DR}hRT&rFs!a-K&yU0H^-FCAe^MXA_X5_G4UT#7DmA%xbRqP18v}u zWltqiC9&M0tJQj!fGLDPujELk!=^2DtYhP481V5L(Cn2Rv8yLK@eQ;a?*h%3@_~=! z2x^ay048bK`Wt#*cB+>}@3+{+#4f+?n=a8quz`j}bNiMLF4Vi3Sl}Cn6Kl6{M}RjK z8^uOR{fT7TEhj~0I+!sicXpE^mv>pmQ3H@0&X8efjbUSi81zDBZ=ArMca0{p7MN#W&fSUK<# ziIPhL>t&oG>jlsjTiqZa?HYlUdIViPqyfl2x>u*~gQ@ojbCIS`B4ao$k~kS?j&v3< zLV~1FHdf)G9;-*u{5H}69S{G<{fA(<#6UP(Q(whAMVieR2SjvTWI@0HnPX!+Y^wNDi-W?QY%Ug{G|$*tjS4$CUKw4hQV#nyAQSJ zCC?w;J^3|)g|kS}O=N7zTd?G}5XHz|082q^v$94WI68I2thkFn*z8r> z#1%Jf2E{S`22O8y_8I%>)Al^rjMpqr#;Z-~1H#dCP;+ki7 z+d=5Ko@;~p+r&--vc`DbV;_LP@MxLEnm@Pr{nyUfC-aT7MhZ9hH&4=>wG(>*>D*%0 zduH*{x!3H$l)HNeQz7==xzurKkySOL4kl}9rmy6|Ss7VNXA2p`lg6p%DLYOX5ewET z1Pl}(+-*8fp#LXG5viA$$mnks%JLACtrgdtINuN!z1%F`ISfq7C6 zy!I1)y>|>sp`-jHRKVz)Ip8A@y;)2E;!K&30PxM+B^-fD*!O}yxtzY$dj%^4>Q`Rs z7m@;2EcOu!GemzF7ub~`%pP0$BRBywDX_EI8ZX0*Jf6@>GYE&VCc@qlt8l4NYUqPn z=MNZX=ck!QIE}MJpHdwoG8gvgKz)}k4R2}>(h{8k(oPYyHH6acgSUX!iI=0X04|3- z1_N~Nb3Nr>_g3R@br7Z9g~A`vJE3hsb?0&vyf0t)BA84H#4PL{u?u_L1Q6;3hVB(s zeG^T0N%u!uFp~}pbcDRD$;2$wQOcgCj2NdnOc~>?@hWIKCNYg+9VY~2FdgHZC608- zJEaDhdS(M`4dg8#C`-jq`Xm~Dj}+0KqC9|7g3f8c<)mdn_X$D~FlsfujM_dxtOc-D zG?2c*4L!?#r3SEMzeE{&JHxvD}k6i2@SukvbDSV=t_+IL0YV z8p)?9ME%D|vj4+IX>kA%xS^@B8yYl^T@P>n&(Zd?6*kVaG#bk$N;a8RKwVUPF$=fn z(8BJA5r8c>wVZa_Yq{z%^yM+5dX8om@U1{mP&f>E$5@V*UCFm;LAK9Xl>UMg9YH2^ z{%B*8Jz6?b9z=!ogk5UW`V9ZG4?Bux)(I%+M^6%-NzSV%Y*rIs??HTExGY*H4Orer zSuIM`CCCW%o#Kz7(Xj+i&=k;_UFd#8ck$7Mtn5dkrTq{ebD+z{)&-^nXQBvUveSy~ z@8MHd=-P-6K?`jJ#$$9PqUJF^am4O)y{^ZM1xzr`*!m~`!fy$oVez}(<~gN8mGRDb z2%oungK;e_QiM&Psns{Ai|#m6sSz`N7HyDNL=@T!Lj#D_=n9b(^)1a-(i%Rt;lmnP zhYwn>$SAW90Q3!vqil`?nLIKTVEp52=0(Of9qybKPc`v@An;CO_l((3>b2vwnOdbb MS9`ejbnU5s11VjFivR!s diff --git a/cmp/grammalyzer/__pycache__/dtree.cpython-37.pyc b/cmp/grammalyzer/__pycache__/dtree.cpython-37.pyc deleted file mode 100644 index 7c81bf457508ba1832cf6971cf8a2f33ad270b99..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3791 zcmb_eO>Y}T7@nE^@OqQDp_I}VR3wBDmQW(`O$#MJsYferL3bnT*zj)4 zY$8SfkFW=JHK&2+jmv0TsR@Pfi zv#hh6cKgely4CHrI)gpzk_JjH^#?Xel6J3ck|cnrJVe8Ih~M4|j~lc!*_)CvROp|+ zafV$)XUMkM0XKpSl>Cu68@Bp=)svc})rBU3g_UHU zvr$L1uiBC_ao!-j5 z*~}81Wd>S1txhVW7a*mEnmd2+y$drG8B3V02H9cgXueOdMEr&Ia-*I3vk$eEB*Bg( zdFEdZ9&aO|6$*2&)m2Gi<0R>3a<@bM`6Riw+v*f6x(b1Mo*J@CpQ7f-VArECxG<6L za~efF4kADD+-!=8vJg&JQ1dHj%6#Hde8Z4U$S3^!vgY!MAIqm$&S9k@=j8(aBN@Ok zr)=${Yfm7MPI3rbL}$njkY0zBV94N!Q|FS6U1U*0u(!SoX#q4l*Vk}IN{O2vGuK&4 z9-(xd#P|7=O3cm&!kN>CL>Tt4)Pmb*8=1M$?RQjH^^B5Nwa)Ye@N~}f`DZY99(8j5 z6uy>@8Fi9uo~(m@9`cZQ4$gF@^?Tr|sgvzog1IrDz4%WW9BnHRPNKjyb(gPEjIZ`JotJj^!Gz?;2pA&XZ)eJ&qw}{9|ZU!9Qvk0Gcu6jBaevW!Ofw! z9j&r2KN$u1syYlDy^Qzc`(U5r8?;B?Kw50r!5pNy^+QKV_inATdl%LL6ab{sumQNS zztt3XRyTkAfy%ERfp23so0vgg*@|xUc4QlL+->R2b`P}N)@er(EmQv3pwrq=9UJ6Z zt-h+y+n_&?nX%q#X7qD#g7x}Y--@=h5pfea-THJ*XkrjYgc_G0E0&eq#PU_N_0Yx2 z@@tT7TIr6hq`O)JK-O!^+y;&ir{bqCK+;R7?zUlkkw+rr5q=l=JdgQBeo^e5SuI0M zSJslVwu~Y{sEp$47z|ERY8`^!QH4Z`-DW;B-cGDv|J?CHehL8%mXu^|gcHl@zrs9(pUNIbFPu5p3ulEF2W;5ytJ}&6_6`FDaDd zQ2mr-k=nSCa378EIyvA&@Tq5DcjUC~}o>pcymC>D3 zV(?oG28)GmUx<-6^4D4K91zHXz}E@{f)xZ^;h*7c<*xQi#&fJ9hGHB1vLo{ACV0pn zTpIe|kvG62!FH%6z5{O%o7`()Cen?`%qWBxs(8+Xhk{nY8KUq;LVHOB0$Ajpyt2+qMYoR5$^ z>s{~`&U>FurZD3?U(-yAS{8!Y3hL8BcI{~(OShN-3<$Ji*dp8$*m|0h*G8IN$GMV^ z;a9(d^=U7XrMFSXkew%QO)2vfko^u4{x`^8F}M=KcW+p1oh%sAM_ zC2ZFSw%cM{|Tla;oLPkyM!st0PHX0&pl%u)jIHMS~{kD Z`3Sbr2gNJ;3f+^%OW3PDQ+s9c{NFKV5^n$i diff --git a/cmp/grammalyzer/__pycache__/lexer.cpython-37.pyc b/cmp/grammalyzer/__pycache__/lexer.cpython-37.pyc deleted file mode 100644 index 83def9791397b5dbea7bdc3eec7a9755cfd329be..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2403 zcmZ`)OK%%D5GJ_~trS@{lE6*cBFO8aixuS17N}vQZHfX#VHkCgv_g`_TBH=&`;fWo zR1$W3v3ty+|G+->FY($_&b|56Z@9AJ80{|j9&$L}d^7xZWu?XN-Tgg&eXGIP-!!=R z9CV(bOf4d6pfhlsZ4Fk(v%@{o-3{e1aLp`dqTUkX(ur)_0UE9qFF1W8U|qCw9ELQj{!YB|GIMKjY|QeCnKGCUhmk z5q!Jr8AoM9vl8wdjbj;Vx^!;*MZ30`j*f~fiHa;W&1JXi7&lk((0E0(7c1>U<6lg# zpgI4#_a;kJ?;uuhmG156Y^DZ9miKmM#hWbc4YDlm4U$Q3q@yH>;@KQhF&VQlnVBFA z$LY8TLwJnkbS&dOZ}WM_+PiVFJm9p1FF^57tl>j+My%q~mjw(x=1_8i(0@m3Ugb|eFMUYgtQuuw-_x6b&l!rc5&DOlFIdS>8>M#!ejIja z1o)ioXK-|Dq>3;n_vhWfG*x<(D2q0W*p9Y)3*j?*YMP7#fa zA5A7ImEAzMA*9JH!&B2Lh*DuOn<(R1$7o`;@oS~Vv#kZbt~#`vz@uaG>!_G;`8sd$ z>!JlHJEFtqHx^)C_WKf1x;hn$=mt6k;^UZCAkjXr#B{wBK&n$YKm{mSRBl>~KrbL8 zw(YHS(RHoCwJqzBl%bmB<2ZvkI!g0#F$SmBiY$~0h$ZlQUW^CWbqz}OXH*dk`W970 ztxFa*G5i!Iw=vEG?!&r{n6H0i*%J8yAx|G6Lwl`pB|0#QRiYI8T(6ZP6_QnsLgUpl2bTu|)=JG}3*LL9Vo${GDT z>{rbFf&!?lq$QDInwZ>mtXuUB^iA^_y#2k_neH|$7UXR`PDh$7wle*urA~;rF%DIJ zK1=qp_zFzM3xA8^g9q4_ucM+^>hJ(i3B**u?_ksx^J@#xNOp-71r^a?fRevOHI*fo z{J_x?nFK*_#woNw17LR0)UQik@X|R(V*7(o;)RexIw#0P`_5AY<066j@5H_<8<22o z9G(N6L!7aT`UR5#JOVsv*5;|^w!TBxxCnUiB$b>BQKMw9)<90a&$KA{htnv-af?=0 z7_srl@carq=grNLO4W3tx4xp&=vbG{?=Rr6p*NnZjmGA?$O#ORDB#xrWsz?`WUPE8Y+g2(GdY(m6sfOYwF{Dv>n+unm^qLkc3I4b(j)TWb+8HP1&N!N;#mAC4&B}QqVOVZL5w^^ zqsfZCS5Qj4V#j%FGe!;>WXWXf8%SA)`X3w`!i#YjUh?Ns96BD64pAqc9x1v45}u}d z|C5WO*`;TxUfS-q=m|@sM1`Sgg<+D(qnP^bFg!ep;(A4|;t12G+&vy73h$z{Ia^a| zvTn7v(d3Ow*RU6|37+61w&j%N10HzoPS6ZigN~+^?QX-g@x*Q{@?TUxJWZN9D#mec e@$B1i{iaZ$+pYhl4Ro!|*dpp#mbZ~U+Rnd}Xb~d- diff --git a/cmp/grammalyzer/cleaner.py b/cmp/grammalyzer/cleaner.py deleted file mode 100644 index e0f1995d5..000000000 --- a/cmp/grammalyzer/cleaner.py +++ /dev/null @@ -1,268 +0,0 @@ -from cmp.pycompiler import Grammar, Sentence - - -def delete_common_prefix(G: Grammar): - """ - Algoritmo para eliminar los prefijos comunes de las producciones con la misma cabecera - Por cada no terminal busca si dos de sus produciones tiene prefijos comunes - """ - for nonterminal in G.nonTerminals: - change = True - primes = '' - while change: - change = False - for production0 in nonterminal.productions: - _continue = False - for production1 in nonterminal.productions: - if production0 != production1: - lpc = 0 - for i in range((min(len(production0.Right), len(production1.Right)))): - if production0.Right[i] == production1.Right[i]: - lpc += 1 - else: - break - # En caso de que si tengan prefijos comunes se realiza el siguiente cambio: - # E -> aA | aB - # Entonces se cambia por : - # E -> aE' - # E' -> A | B - if lpc > 0: - primes += '\'' - temp = G.NonTerminal(f"{nonterminal.Name}{primes}", False) - nonterminal.productions.remove(production0) - nonterminal.productions.remove(production1) - G.Productions.remove(production0) - G.Productions.remove(production1) - nonterminal %= Sentence(*production0.Right[0:lpc] + (temp,)) - alpha = production0.Right[lpc:] - betha = production1.Right[lpc:] - if len(alpha) == 0: - temp %= G.Epsilon - else: - temp %= Sentence(*alpha) - if len(betha) == 0: - temp %= G.Epsilon - else: - temp %= Sentence(*betha) - change = True - _continue = True - break - if _continue: - continue - return G - - -def delete_immediate_left_recursion(G: Grammar): - """ - Algoritmo para eliminar la recursion izquierda inmediata - """ - - for symbol in G.nonTerminals: - if any(not body.IsEpsilon and body[0] == symbol for _, body in symbol.productions): - last_productions = set(symbol.productions) - A = G.NonTerminal(f"{symbol}'") - - new_sents = [body + A for _, body in symbol.productions if body.IsEpsilon or body[0] != symbol] - for _, body in symbol.productions: - if not body.IsEpsilon and body[0] == symbol: - # A' -> b A' - A %= Sentence(*(body[1:] + (A,))) - A %= G.Epsilon - - for sent in new_sents: - # A -> b A' - symbol %= sent - - symbol.productions = list(set(symbol.productions) - last_productions) - G.Productions = list(set(G.Productions) - last_productions) - - return G - - -#################### -# GrammarCleaner # -#################### -def clean_grammar(G: Grammar): - """ - El algoritmo de limpiar la gramatica esta compuesto por varios pasos, sus nombres son suficientemente descriptivos - """ - G = delete_epsilon(G) - G = delete_unary_productions(G) - G = delete_nonterminal_variables(G) - G = delete_unreachable_variables(G) - return G - - -def delete_epsilon(G: Grammar): - """ - Delete all Epsilon productions in Grammar G - :param G: Grammar - :return: G whithout epsilon productions - """ - - # To eliminate the epsilon productions we find a set of non terminals 'nullables'. - # These non termimnals are those that after one or more productions they become in epsilon. - # - # Example: - # A ->* epsilon => A is nullable - nullable = set() - change = True - while change: - n = len(nullable) - for head, body in G.Productions: - - if head in nullable: - continue - - if len(body) == 0: - nullable.add(head) - else: - if all(symbol in nullable for symbol in body): - nullable.add(head) - change = n != len(nullable) - - # Now we have al non terminals nullables for every production - # then if a production contains a nullable non terminal it will be replaced by the same production - # but without the nullable non terminal. Then we eliminate all epsilon productions. - for nonterminal in G.nonTerminals: - stack = [x for x in nonterminal.productions] - dic = {} - while stack: - production = stack.pop() - if production.Right.IsEpsilon: - G.Productions.remove(production) - nonterminal.productions.remove(production) - else: - _, body = production - for i, symbol in enumerate(body): - if symbol in nullable: - add_production(nonterminal, Sentence(*(body[:i] + body[i + 1:])), dic, stack) - return G - - -def delete_unary_productions(G: Grammar): - """ - For delete every unary production like A -> B where A and B are non terminals all productions of B - will be uploaded one level in the grammar. - - BEFORE : A -> B - - B -> C | D | EF - - AFTER : A -> C | D | EF - - B -> C | D | EF - """ - change = True - while change: - change = False - for production in G.Productions: - head, body = production - if len(body) == 1 and body[0] in G.nonTerminals: - G.Productions.remove(production) - head.productions.remove(production) - for _, right in body[0].productions: - head %= right - change = True - return G - - -def delete_nonterminal_variables(G: Grammar): - # Todas aquellos no terminales que no deriven en algun string terminal tras 1 o mas producciones - # No son necesarias pues las cadenas siempre estaran formadas unicaente por terminales - # y produciones que no generen terminales son inconsistentes con esta verdad - # por tanto no aportan informacion al lenguaje - # Y no son necesarias en la gramatica - - # Computamos el conjunto de las produciones que derivan en terminales tra una o mas produciones - # La demostracion de la correctitud de este algoritmo puede ser inductiva - # buscamos las cadenas que terminen en terminales tras una produccion luego tras dos y asi sucesivamente - derive_to_terminal = set() - change = True - while change: - n = len(derive_to_terminal) - for nonterminal in G.nonTerminals: - for _, body in nonterminal.productions: - if all(symbol in derive_to_terminal for symbol in body if symbol.IsNonTerminal): - derive_to_terminal.add(nonterminal) - change = n != len(derive_to_terminal) - - # Las produciones posean uno de los terminales que no derivan en string terminales son incosistentes - # Pues estas no terminarian en un string terminal - # Ya sea si lo poseen en la cabecera como en el cuerpo de la produccion - # estas producciones inconsistentes son guardadas en Removable - removable = set() - for prod in G.Productions: - head, body = prod - if head in derive_to_terminal: - if any(symbol not in derive_to_terminal for symbol in body if symbol.IsNonTerminal): - removable.add(prod) - else: - removable.add(prod) - - # Son removidas de la gramatica las producciones y no terminales inconsistentes - for production in removable: - G.Productions.remove(production) - production.Left.productions.remove(production) - - for nonterminal in G.nonTerminals: - if not nonterminal.productions: - G.nonTerminals.remove(nonterminal) - - return G - - -def delete_unreachable_variables(G: Grammar): - # Para eliminar mas rapido castearemos las listas a set, - # de esta forma la eliminacion sera O(1) - G.terminals = set(G.terminals) - G.nonTerminals = set(G.nonTerminals) - G.Productions = set(G.Productions) - - # Los elementos que no pueden ser alcanzados por una o mas producciones del caracter inicial - # No son necesarias pues nunca son utilizadas para generar ningun elemento del lenguaje - # estos elementos inalcanzables pueden ser tanto terminales como no terminales - stack = [G.startSymbol] - reacheable_nonterminals = {G.startSymbol} - reacheable_terminals = set() - - # Encontramos los terminales y no terminales alcanzables - while stack: - current = stack.pop() - for _, body in current.productions: - for symbol in body: - if symbol.IsNonTerminal: - if symbol not in reacheable_nonterminals: - reacheable_nonterminals.add(symbol) - stack.append(symbol) - else: - reacheable_terminals.add(symbol) - - # Eliminamos las producciones con elementos no alcanzables - G.Productions -= {production for production in G.Productions if production.Left not in reacheable_nonterminals} - - # Ahora removemos los no terminales no alcanzables - G.nonTerminals -= {nonterminal for nonterminal in G.nonTerminals if nonterminal not in reacheable_nonterminals} - - # Ahora removemos los terminales no alcanzables - G.terminals -= {terminal for terminal in G.terminals if terminal not in reacheable_terminals} - - # Finalmente casteamos a lista otra vez - G.terminals = list(G.terminals) - G.nonTerminals = list(G.nonTerminals) - G.Productions = list(G.Productions) - return G - - -def add_production(head, sentence, dic, stack): - """ - Assistant Method to add new productions to the grammar, queue and dict - """ - try: - dic[sentence] - except KeyError: - dic[sentence] = True - if not sentence.IsEpsilon: - head %= sentence - stack.append(head.productions[-1]) - diff --git a/cmp/grammalyzer/dtree.py b/cmp/grammalyzer/dtree.py deleted file mode 100755 index 3373cee9a..000000000 --- a/cmp/grammalyzer/dtree.py +++ /dev/null @@ -1,105 +0,0 @@ -import pydot - - -class DerivationTreeNode: - def __init__(self, symbol, father=None): - self.symbol = symbol - self.father = father - self.childs = [] - - def add_child(self, symbol): - self.childs.append(DerivationTreeNode(symbol, father=self)) - return self.childs[-1] - - def go_root(self): - return self if self.father is None else self.father.go_root() - - def __str__(self): - return str(self.symbol) - - -class DerivationTree: - def __init__(self, productions): - self.root = self._build_tree(productions) - - def _build_tree(self, productions): - raise NotImplementedError - - def _derivation(self, productions, node=None): - raise NotImplementedError - - def graph(self): - G = pydot.Dot(graph_type='graph', rankdir='TD', margin=0.1) - stack = [self.root] - - while stack: - current = stack.pop() - ids = id(current) - G.add_node(pydot.Node(name=ids, label=str(current), shape='circle')) - for child in current.childs: - stack.append(child) - G.add_node(pydot.Node(name=id(child), label=str(child), shape='circle')) - G.add_edge(pydot.Edge(ids, id(child))) - - return G - - # noinspection PyUnresolvedReferences - def _repr_svg_(self): - try: - return self.graph().create_svg().decode('utf8') - except AttributeError: - pass - - def __str__(self): - return str(self.root) - - -class LLDerivationTree(DerivationTree): - def _build_tree(self, productions): - iter_productions = iter(productions) - return self._derivation(iter_productions) - - def _derivation(self, productions, node=None): - try: - head, body = next(productions) - except StopIteration: - return node.go_root() - - if node is None: - node = DerivationTreeNode(head) - - assert node.symbol == head - - for symbol in body: - if symbol.IsTerminal: - node.add_child(symbol) - elif symbol.IsNonTerminal: - next_node = node.add_child(symbol) - self._derivation(productions, next_node) - return node - - -class LRDerivationTree(DerivationTree): - def _build_tree(self, productions): - iter_productions = iter(reversed(productions)) - return self._derivation(iter_productions) - - def _derivation(self, productions, node=None): - try: - head, body = next(productions) - except StopIteration: - return node.go_root() - - if node is None: - node = DerivationTreeNode(head) - - assert node.symbol == head - - for symbol in reversed(body): - if symbol.IsTerminal: - node.add_child(symbol) - elif symbol.IsNonTerminal: - next_node = node.add_child(symbol) - self._derivation(productions, next_node) - node.childs.reverse() - return node diff --git a/cmp/parsing/__init__.py b/cmp/parsing/__init__.py new file mode 100755 index 000000000..cc8a5539b --- /dev/null +++ b/cmp/parsing/__init__.py @@ -0,0 +1,2 @@ +from .parsing import ShiftReduceParser, LL1Parser, SLR1Parser, LR1Parser, LALR1Parser +from .lexer import Lexer diff --git a/cmp/parsing/__pycache__/__init__.cpython-37.pyc b/cmp/parsing/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dae3a045a70d41ed08ebb26f07a4e6b7ae9ef853 GIT binary patch literal 312 zcmYL^!Ait15I~c**>+d<;N2f6EE~Lvhx7>x**XjI#lS0gS$H==9o#63DYUMawR1++ fc96#gvZ}hi3stopra8N|t~nUEp+Ak(`hx!ghKW$; literal 0 HcmV?d00001 diff --git a/cmp/grammalyzer/__pycache__/automatas.cpython-37.pyc b/cmp/parsing/__pycache__/automatas.cpython-37.pyc similarity index 89% rename from cmp/grammalyzer/__pycache__/automatas.cpython-37.pyc rename to cmp/parsing/__pycache__/automatas.cpython-37.pyc index 15b03be660a7a211193a7928a5ecf5712f04a92e..22b8e606728629f32a731ba713a9eceeb1b10100 100644 GIT binary patch delta 75 zcmbQQGhb)JUrxrT$^ST~GP+Hk!c_$%`ME{8Tp1V`inxKqt<8GeU5t#bn|JcKF)_Ms b;!k2_be+U+J$atUeW1QNQ7@p5lcHe&Y7rKK delta 75 zcmbQQGhb)JUrxqblmBr}WptlBg{ulk@^g!FxiK&>6mbKIsLguZU5t!wn|JcKF)_Mr b;!k2_beqI)J$atUeW1QNQ7@p5lcHe&ehL=} diff --git a/cmp/grammalyzer/__pycache__/firsts_follows_tools.cpython-37.pyc b/cmp/parsing/__pycache__/firsts_follows_tools.cpython-37.pyc similarity index 100% rename from cmp/grammalyzer/__pycache__/firsts_follows_tools.cpython-37.pyc rename to cmp/parsing/__pycache__/firsts_follows_tools.cpython-37.pyc diff --git a/cmp/parsing/__pycache__/lexer.cpython-37.pyc b/cmp/parsing/__pycache__/lexer.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..76eb5ba7dd73df444ab57a78aab4b7bff49cbc8f GIT binary patch literal 2558 zcmZ`)&2Jk;6rY*>@Y->lG>rm*sz3nIy~GG1DxoMUr3k62qKHH-SZ!Au&p36mAI|K$ z*wOlwaO?rjJtRl|rM+_MnOjc$-mK%M5nXG>@6EjVc)$01Z|={}HyFM{M}DxF7aq;!|Sp^yHl{fL%*imng^3s}LYo2OZOdz`;WlXf>vqjonQvRNW2Qf|85&%9hYEZu1r1;7g(bcw3?+j&Du@zRCli>zgp{a$16q$WG0myAB~o zDxUBOxOKpR^GYFrT5Dnzgso)|S_VR#SO=8EmbskHecL!+xwH~W8K^+yjjYalrLrArc|k#FE@*M5EE;f{3*>amU{v;ap@mvK`h=;ofBv z$EVnw!sj8K zbsoPBttpP@rr41!0JC#7%4cv9jfoXqwCp9iku136hnAM8H;Dc@hr@8W0C0zO{k-5g zFRT-k%0CDyo(n0Yb&5yl^JV7jPp?5jkL272>* z+Kslg+40&G7L$ss?jSw*#(xbnV>I+laz= zPlo2$e__RrKYRb7Q(Nq09jfsgI_`ph;k)`PNJN9Aw2({{OXy5fw0)-{&>b2u1R^@< zkEwe%x5|2O>FT$b&1jaPjI@Nu7x@}*TAnywxOTr8Pb$!+)ngeet7r0(BNTZ<_Zegs zY=~S2vX3C_QwWzpCKMYg>4i8Ee~Ke}r@APDNU4iF@$skM=fy>1BSJmtrtx6Yq&Qv7 zeH+aHA&i3HN-$^UIDs6;>thO$LF^htc)_am_hD#=!mhkt)zp^XqL(fSV-*BtBM9PD z4kMDAL2xt-qiRM|sn&#orYmYnveH7as){GoH%-;fgx6e5e@E)u8yU%ze-9JXGFsqq z&-t{~s<#$eEls0a{#@zeK|vL)jxvXu^O|_4*QeDoGzWL;G*mr2MC8)w!@M7527j~T X|6KxXt{mMYW@dEovS^~tG_C&tSc@&` literal 0 HcmV?d00001 diff --git a/cmp/grammalyzer/__pycache__/parsing.cpython-37.pyc b/cmp/parsing/__pycache__/parsing.cpython-37.pyc similarity index 67% rename from cmp/grammalyzer/__pycache__/parsing.cpython-37.pyc rename to cmp/parsing/__pycache__/parsing.cpython-37.pyc index e670daa71f3cc5c6599d4b2ed4c95b575b2da3dc..020a8a797ba692509f9464124c96a85a1a7a3c70 100644 GIT binary patch delta 961 zcmZ9K%}*0S7{)u@ruGwQp)IA9h#KO81^mDdYHe$6lPVSgV`Ne5(hg;z?V5KNQ%=Oh z#6)8}%*A*x-Z+s!diLPOn~CTB4?LN8G#;FH3RXGnFSGN!^SmE3JE@)2-U&BR*ogb3 z^Nh`AgAkkd^|e2{pOe#yzi5>7<~<4xt*O>w40V~qashot!Jt)zt$J^faklS$PiES) zz9)ox?fT!5oUmEy$=btdJeI{{Zra>zP*6<@Ikwju+rGhf6<^U-vVeM%AhTDbzeA+AiHv14x2bXb45DpI62b1haI7P--A~H=DSS7L>L5FTzvb|$OMZyA0 z4!j~6_GRFqe+>-|)CWRcWVvWzLR=7*Bqjn;T#X`T5DSO`B7<0Dv%Ue6WZ$AAoL`+$ z<{f-Q((IEIwL^xz7wO&Gq8X-@HUPaV33 zhUP+wr~BxR8owF3@~`na_xtsq@wzZR9*XP3qgywNs8kf0feZNLQHz{QJX?Oq80!F=Awn|I;MVd8f4aPBKU!=Px zT$5`GK+6>-mcU*7SJTT2ki?OvP&JGv`eUk>7$h*_UZMx){lnUhQMJ@EH7)y+F6!MB zIhaFa1vEE=aeUck^PlxaDtUX|C{b8zZu&ncM;XkoB5ojL-L52K6wHcIPXibreR;J? z4`k`qvAA{9gv!poNtxA^JRi5_$I!Hbm_l4fU^}h7xY7qj+CaPJhfUevEs@M$5W6Vo z%!Fy2I)k{4=tUF|twS;OGECs_q=4o6+ecnyhjrM(Oc0U9YY{i~z4r|nNr;H1!aYn# z4Jl}(bvS;E1rW>peP}MA*oC92ATIesVd zlBD>T$U~ojg0t+l%x>`c=)$DDpae?rb|H!wLBtX3h#Vq?*x-xa2$|*IqQin;9Z~M- z+amM)lNwbZ#h>?W2k;@m1A)$B&i)xkThh}IQ+|q%;m(}IsX{{vU-efU^66eVw+086 zgO List[State]: regexs = [] for n, (token_type, regex) in enumerate(table): automaton = Regex.build_automaton(regex) @@ -18,13 +19,14 @@ def _build_regexs(table): for state in states: if state.final: - state.tag = (n, token_type) + state.tag: Tuple[int, Any] = (n, token_type) regexs.append(automaton) + return regexs - def _build_automaton(self): - start = State('start') + def _build_automaton(self) -> State: + start: State = State('start') regexs = self.regexs for regex in regexs: @@ -32,7 +34,7 @@ def _build_automaton(self): return start.to_deterministic() - def _walk(self, string): + def _walk(self, string: str): state = self.automaton final = state if state.final else None final_lex = lex = '' @@ -47,7 +49,7 @@ def _walk(self, string): return final, final_lex - def _tokenize(self, text): + def _tokenize(self, text: str): while text != '': state, lex = self._walk(text) @@ -61,5 +63,5 @@ def _tokenize(self, text): yield '$', self.eof - def __call__(self, text): - return [Token(lex, ttype) for lex, ttype in self._tokenize(text)] + def __call__(self, text: str): + return [Token(lex, token_type) for lex, token_type in self._tokenize(text)] diff --git a/cmp/grammalyzer/parsing.py b/cmp/parsing/parsing.py similarity index 98% rename from cmp/grammalyzer/parsing.py rename to cmp/parsing/parsing.py index ef10a17a3..990c92056 100755 --- a/cmp/grammalyzer/parsing.py +++ b/cmp/parsing/parsing.py @@ -25,15 +25,15 @@ def __iter__(self): class LLConflictType(Enum): """ - Enum for mark the type of a ll parser + Enum for mark the type of ll parser """ FirstFirst = auto() FollowFollow = auto() class LLConflict: - def __init__(self, nontermial, terminal, ctype): - self.nonterminal = nontermial + def __init__(self, nonterminal, terminal, ctype): + self.nonterminal = nonterminal self.terminal = terminal self.cType = ctype diff --git a/cmp/grammalyzer/utils.py b/cmp/parsing/utils.py similarity index 100% rename from cmp/grammalyzer/utils.py rename to cmp/parsing/utils.py diff --git a/cmp/pycompiler.py b/cmp/pycompiler.py index f72300d20..f93cfe87f 100755 --- a/cmp/pycompiler.py +++ b/cmp/pycompiler.py @@ -1,12 +1,14 @@ import json -from typing import Iterable, List +from typing import List, FrozenSet, Optional, Union +ProductionList = List[Union['Production', 'AttributeProduction']] -class Symbol(object): - def __init__(self, name, grammar): - self.Name = name - self.Grammar = grammar +class Symbol: + + def __init__(self, name: str, grammar: 'Grammar'): + self.Name: str = name + self.Grammar: 'Grammar' = grammar def __str__(self): return self.Name @@ -14,7 +16,7 @@ def __str__(self): def __repr__(self): return repr(self.Name) - def __add__(self, other): + def __add__(self, other: 'Symbol'): if isinstance(other, Symbol): return Sentence(self, other) @@ -39,43 +41,49 @@ class NonTerminal(Symbol): def __init__(self, name, grammar): super().__init__(name, grammar) - self.productions = [] + self.productions: ProductionList = [] def __imod__(self, other): + if isinstance(other, str): + p = Production(self, Sentence(*(self.Grammar[s] for s in other.split()))) + self.Grammar.AddProduction(p) + return self + + if isinstance(other, Symbol): + p = Production(self, Sentence(other)) + self.Grammar.AddProduction(p) + return self if isinstance(other, Sentence): p = Production(self, other) - self.Grammar.Add_Production(p) + self.Grammar.AddProduction(p) return self if isinstance(other, tuple): assert len(other) > 1 + if isinstance(other[0], str): + other = (Sentence(*(self.Grammar[s] for s in other[0].split())),) + other[1:] + if len(other) == 2: other += (None,) * len(other[0]) assert len(other) == len(other[0]) + 2, 'Debe definirse una, y solo una, regla por cada símbolo de la ' \ 'producción ' - # assert len(other) == 2, "Tiene que ser una Tupla de 2 elementos (sentence, attribute)" if isinstance(other[0], Symbol) or isinstance(other[0], Sentence): p = AttributeProduction(self, other[0], other[1:]) else: raise Exception("") - self.Grammar.Add_Production(p) - return self - - if isinstance(other, Symbol): - p = Production(self, Sentence(other)) - self.Grammar.Add_Production(p) + self.Grammar.AddProduction(p) return self if isinstance(other, SentenceList): for s in other: p = Production(self, s) - self.Grammar.Add_Production(p) + self.Grammar.AddProduction(p) return self @@ -96,7 +104,7 @@ def IsEpsilon(self): class Terminal(Symbol): - def __init__(self, name, grammar): + def __init__(self, name: str, grammar: 'Grammar'): super().__init__(name, grammar) @property @@ -195,7 +203,7 @@ def __or__(self, other): class Epsilon(Terminal, Sentence): - def __init__(self, grammar): + def __init__(self, grammar: 'Grammar'): super().__init__('epsilon', grammar) def __str__(self): @@ -227,8 +235,8 @@ def IsEpsilon(self): class Production: def __init__(self, nonTerminal, sentence): - self.Left = nonTerminal - self.Right = sentence + self.Left: NonTerminal = nonTerminal + self.Right: Sentence = sentence def __str__(self): return '%s := %s' % (self.Left, self.Right) @@ -280,17 +288,17 @@ def synthesize(self): class Grammar: def __init__(self): - self.Productions = [] - self.nonTerminals = [] - self.terminals = [] - self.startSymbol = None - self.pType = None # production type - self.Epsilon = Epsilon(self) - self.EOF = EOF(self) + self.Productions: ProductionList = [] + self.nonTerminals: List[NonTerminal] = [] + self.terminals: List[Terminal] = [] + self.startSymbol: NonTerminal = None + self.pType: type = None # production type + self.Epsilon: Epsilon = Epsilon(self) + self.EOF: EOF = EOF(self) self.symbDict = {'$': self.EOF} - def NonTerminal(self, name, startSymbol=False): + def NonTerminal(self, name: str, startSymbol: bool = False): name = name.strip() if not name: @@ -309,13 +317,13 @@ def NonTerminal(self, name, startSymbol=False): self.symbDict[name] = term return term - def NonTerminals(self, names): + def NonTerminals(self, names: str): ans = tuple((self.NonTerminal(x) for x in names.strip().split())) return ans - def Add_Production(self, production): + def AddProduction(self, production: Production): if len(self.Productions) == 0: self.pType = type(production) @@ -325,7 +333,7 @@ def Add_Production(self, production): production.Left.productions.append(production) self.Productions.append(production) - def Terminal(self, name): + def Terminal(self, name: str) -> Terminal: name = name.strip() if not name: @@ -336,7 +344,7 @@ def Terminal(self, name): self.symbDict[name] = term return term - def Terminals(self, names): + def Terminals(self, names: str): ans = tuple((self.Terminal(x) for x in names.strip().split())) @@ -456,12 +464,12 @@ def AugmentedGrammar(self, force=False): class Item: - def __init__(self, production, pos, lookaheads=None): + def __init__(self, production: Production, pos: int, lookaheads: List[Symbol] = None): if lookaheads is None: lookaheads = [] - self.production = production - self.pos = pos - self.lookaheads = frozenset(look for look in lookaheads) + self.production: Production = production + self.pos: int = pos + self.lookaheads: FrozenSet[Symbol] = frozenset(look for look in lookaheads) def __str__(self): s = str(self.production.Left) + " -> " @@ -491,25 +499,25 @@ def __hash__(self): return hash((self.production, self.pos, self.lookaheads)) @property - def IsReduceItem(self): + def IsReduceItem(self) -> bool: return len(self.production.Right) == self.pos @property - def NextSymbol(self): + def NextSymbol(self) -> Optional[Symbol]: if self.pos < len(self.production.Right): return self.production.Right[self.pos] else: return None - def NextItem(self): + def NextItem(self) -> Optional['Item']: if self.pos < len(self.production.Right): return Item(self.production, self.pos + 1, self.lookaheads) else: return None - def Preview(self, skip=1): + def Preview(self, skip=1) -> List[Symbol]: unseen = self.production.Right[self.pos + skip:] return [unseen + (lookahead,) for lookahead in self.lookaheads] - def Center(self): + def Center(self) -> 'Item': return Item(self.production, self.pos) diff --git a/cmp/regex/__init__.py b/cmp/regex/__init__.py index ea83cbbe2..e88825276 100644 --- a/cmp/regex/__init__.py +++ b/cmp/regex/__init__.py @@ -1,3 +1,2 @@ -from .regex import Regex from .automata import NFA, DFA -from .utils import RegularGrammar +from .regex import Regex diff --git a/cmp/regex/__pycache__/__init__.cpython-37.pyc b/cmp/regex/__pycache__/__init__.cpython-37.pyc deleted file mode 100644 index 0f94c207ec9afdd25e82ed87d108b7164a7cd6d4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 272 zcmXv|!A`?43{9G58;Bu(qY_%K91vm%joUOaPB~CTZNw_#WpYzQ|AP~Mz%S*>iC^G^ zJqb&;-+QwCd^ew;3X0E^ zM9!6a%M(;ct+?VIUV{hNTdw*Fx#E1YKVC<6n^fLt)_Z1V=bSU&cg~#6jfI6Gqf7jG z|L03{jQs~8xlDRkqvrojH_0S-S(n?qD{RpXj7rK^hQNL-= z-C;5(^G}$}JI2tkizFAMMY5&kd6MU3k>sMoX}m=8yeyGiasBrnKCk{7kSNb)IJ zCb_KTQzS3R3dt4yewpNDStYru-l}}v* zO)hk;QS;xXo5O4_nJpxj;t8`2X-JcPO_?Ke^WprhUBBacJy_I+MY!;rqqa`XFVig` zETq`x9VU(64SLaRC`?e=2P4e;0a@sW`7LtQ^~3oc6?pBS+OYl(*-!1JAE->;*esuio}Nx8CmV)|IpEJg&F=V0Cvdw46sR zw@<1pTEd5)jPF-7F03XK#(aU5+7}QkU}QgUkUfQ48=GI>y+@B~kp{F~(G5O_g=W(a zRI@oxLZWLqt1BLF)N-NKZ1!4Rr`ZgP&1Tn=eHYKAX7gdc~fA!okc(HFOyzi1QU=P><4|oK!GzNT2 zNYUZa)L`ctFYrnhafMA$CEOP1RuiG&I*%iuh2G7O`$slZZvcGNE;63y`^zKiUV$7a z1T$mo)Em$`5jVZXRj7&iQOPKYAsb@{rfGJ7Q~_xj@`ND<5n!?wAg-KUqQ{wxs;ocB zc%znAFh`xnZ3VXx6A+=9Z5q)5t3vYOIMKl*LZEMq5C(OuQS&d+Eg^(sM4>+96y#B` z=c3GL=VMaLuSZE{j1>ry>06<|O^TTu0?^5r9EFOv>nI9KxD#!=*k8^lS&hdh?>mAI z`~H9riGpWVDR|6mB)g%IF&p^Ti{H0XWMCenEXJd^C^qK}@n2_L*4{AnC0@v9J z!kp@C?*vmoLT>#yHG=PFjCdsz2J9Joo@N)UG(`!Jt7nu{MxKr${wNRBd3xhG@L!;L zA7b?=>^1!8Yg0=v?A{u+lZJh9T~`t(!yieJ0ue`!`T#ebqeh7eoW4peLB29l@^a{r z6O*VPgPqRi2y=yP9y!x+aX zB@%2%Xn0Dh3+OP~J4zqSH8Vr@_c6qKlSqGyhI~W^6Ba+mS18|%+?sUWrJMaGy^}Ei zDOJ`9`=7EuP+N<}A^+qgA#fL#==~eBVYU%)FQX)b-zWgABWGV!<(#M2j+6K<)4Xd? zfgL51@mR<%utx-E^>MMQIcYJ(~jD-M7o)nb|2|xlY8}etybCw)}rothp z>v4ry5ly&4={$)U_o+Wght;g&i3t(FX|hi&gAVz%xC~O@;!6_Y52;rABpTB?TO$0J z(R2EUo@sTEIxY>6-Zr5ilMK-}6B1Y(Zr`6yfMovz%7929Q3WIv7#WwpQz8EaHUmi} z_REQy*Mj?_W5O*{jXa}qwoq?pbS$M_jY9sl%bd?>;U*T(z>K~|tzsAGtACZg_Z7BN zA>b8aG_;a`eCV%C4M+ry4o)4Hs9$w@*Cn&g>k3Dy&LavuQqYo#*|d%ctuLd`_OFl> Ud=w{DepZ-9*(#UfziPSkKSb^`pa1{> diff --git a/cmp/regex/__pycache__/automata.cpython-37.pyc b/cmp/regex/__pycache__/automata.cpython-37.pyc deleted file mode 100644 index b6b332c11e1d12d135246a95006c09f84cef7ca6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10003 zcmcIqU2GiJb)GwaJG)%2Xqu)ZR#9X_RlJ5n*=d@(sjAqHtTc(iDv@B>tmXA;?~q(_ zxl7&|$|O6BrlJ5-0c4~tTBJb(P%lLT^r0^;(5DtfANo`jeJbXm4=qr@KvAFp3KZ@` z`+eu`&Mqm+ZsTT&xpQac%)MvsIp;e+m##FyRo?*r}@N{cCy-QcT-%nNHY9+=)8<0nMV^li%L6-E?982cTX*XZ5?26Ux&Jc zbD$$##yQj#Ojgakg{!X^g*RIP8vY_2T$HckNIpQ5smy6OnU7YbZszXs+RHq&e(LTy zI0ss3_nwo6nc7oV9HA&}U&*|K=%I7Px%JZ9?%QrZ=!gAMTFy$^+jEn5(+ZYT-BnpB zb5=`PaN5bjOBii6IGD)7he|n{uimuRRUPnJJK#B7Xpvw3TpVQeI*w!-O&jF5Dt(2s z`W<)EzwZ3VG5jzrr#t^b9wccqjpdFsAH8&OrMDhmTFva=w3l4Gwv(>( zx))o$Ugu(KedD5um*ee=&8@Vz-b|bG8#^CWF6nkFZS~eSE>}4{c?q4}b6C&$Mx)(r zr;Wz^rB1Ka>?D`xN5pxAr{JN{*gf<0?ww|*t!qRGRaX)m|CU} z1y`N5Fqux3hKk))J2l?P)M;4iX()j2r0!b9d{H_4)82LGO{*^c!tUg7ovrjIFrZZm z&wd~I%cF0`JF+Hq*PJFrX-H;2PQL5Ocq3_ddfmp@8b1ZPMDPV4<>IqyYWE~R>loTX zbGa^jN51f%&`F(Dd>M^a`wzUn%G802dmfR7_(HRNAV#qLeSEop5Qt%YR}9PTdwoCi zbZN~s3%b&EGq3LrN5}vMnTvPAwa|2Qwd-QM$p;<{YWr6*ALjXTKPadJPzM9*9~`Cz zO$j_j7%jkTHGSfNFJ_wEbT+>PQyo0le7}rYrt}k*A|tX*FHqB#O><)s=s8;#AaX2(7;pW#fOWka6KFS8lVE=mvNtb4RLjA}U2Sx!c0s;^(3FGLGab zn!;J0_#|f;mvlu>+=F9VjL@&@N$Hn$4SGEVZ8+*g$qE5PB=8P8DIyEHNVr7EfG%=R zC3C5JSK*0gpA7E4z`NFMgW9vyeJ_R0XGB6+cji9~ly%ABE4;5S`)NioW(w3BvspzQk?FLHRAkMHb$ z7T2Xp1#TD)Vf95YuL_kLkG7ajj& z)}V+I>LqyFPA3m#VG~2IW6^@FiK6GF)|N3bgb-LeJH`=@SQLrKdp}1$tP7e`v+gtu zZ?`(m&+(p>BHWn+Rx`+gClznXGXg#B7Cv?U7@sO~xp5V%BoV?l_yv?FBqq-D80q8z zZ2V6AOCw%gHLHBO%d+swr-jG}5!5a*ATEPt6O1tiq~;2M8qWL}R0@Gg2$)_4g(!rh zb}KTG+%A@c`bY`LOfR5gp%TtuF}s1ga$H)|4=(xrN9A+>bjYTY-l z<5lxbHnJLY0azZc2E#bh?k?wkYo%$92rw@jK3ydRp0PQi`u{+frch7TJZ)tsk7(wz3p#^ zPP~e63nr8Kr=5PVa|SRCrz#*GWC%wIo^j|5-X7Dt%$MUZ%ZyS`ko<3t7LR<2+&Y@$x3c<7@82k=_GAyEE^fpKy7QF z5F^gRtqslWNbESYg5x3y)Gh`bB9W*#FWDU6=;XOinm0Kw*=NX4Eq2uz7fbYfGL;C2N8<~6HK6JR;2lRTXA8bFH1u)BV{V)qNZ>?nJLF3zm z5rPN?spC8rfBGg%^-M-ROB-Mskk)likf!KyLeid7!jO0MU+?VLpr6Rf&fxCC24vKA#j zPA7DkX&r=i0~S+VtAO`8Ycu-_w8a~j99Yl|SkMj7UcTwrz|4-`kJ8DsmU*Z@L{K8H zU(U*~vFd`YaL}jlM;UXC#chrvq)cIjkYpZ?kdy@T1A`NZ9|E-^?%2kFgScb&Gb8vN zGrD0k^x=Qw_aT`nB>z+4Xn(}f@e?tQ0>VraVfHC_Ec2m{7u`Pm>3Jn?K(n{R5=N*> z*Y#jD-__mPFz1FddHU(6A7Ma1j%&Y677(9iY86pDTJ>8autR(rwUdTaJaV_qWK1GJ zg2xfVLqUedEztM7LrwsFXOERdL0Uf{HfV#181ErS>+TrM3EpP&1RElkMM|P-?jr;%evJy?3RRO+Bv%chPK7Z4} zn-J$QZxR%OBX44^!JA7GUU@Q>TJ^}qGRlsCA{klcEy>%cgK%a6nMm#^dk1_+2;U-b zJPi==5#hU8*}lK|k1{^I%__LnWzbeKe?!QC^YeFZTG2I;slnR?GjX2EJFIuG)&{)F#KjbJhekkfQMFh3gMSX4zI0|L`lw6oq z%p`n#;Rqi;8u20Jl}|ZQu9g6jYZ&y%Jbyfz=TlB$*5zAF=VK=^pC?slt&lN^O}NA| zrM^i~)+che`67-ljFmeB!JM&FlSLR?6XncyMA{J`Nj_87_mXpHXuUoX z9>heb;XEV98TG6L0#mSPvk98x?bIE&Q}q+rDK`UtGCTE;ym`n@w=XaWf|Z@=!{M&_ zVym>Zh}NqEL4rR35}d;CE4<#D?FS0jdO-IHMSs6vY_i&k5OHeHaJ9-EOX z+Ti7=b|MNr(q$Rqc!i!lekJ}4<2_cftLhA#)2u6sZ9rMrI~`CF<^CHk80BgN{^Je^ z;s2v<$L9{xnA<@#3%7$TOk9Okwr9qihX=O-WwdIzy#iHbvHP8VX=eua5d&KVL=G3- zbh^(W?hKHr{fUh_({K;@3DtT;$=H+S(kwbCWl}(w9!!8^Nh!Q*Rasjl_C$#zQDSf+ zZe^gv{~vDUV>J06D4c<3IX{x0O<|7HVXI!B$7}WSB4Pgb;Cy=g}t z>Ds_c2yRXtW%KX&4bPw{kdv4RrK%#QoI#9p2G}`+m2lWtsYS5rokqkXQ3R8CAQTk~X_7NgHr^9u!(A$mmz7RC$T{)mAkCi{ zD9?AS^6&{_4$w)uGJ|ww<|cNJxfP34DYP|R#2805GmEU`0+>cze0C6;hh`308aKO~ z)6hUY4AaMIq~qbnFijDW(57uH`5Jovj$@dn{4Do6klJpwla+?Vq{*0O4AYguaH&lN zgXeJp2G5W|6m84qlx1+0>^Xzk3uN}k zBW54r;yRzvrAq)NRg%XAU)V+IZEe`GN2|g3>pzDRApW}Wv8z$UU?}4T>DERkwwZw} z@f8eXm>Edz#C#pSdSu??4GHJ(pobl&jZQn2x3IMpuiuW1Z2Xul(vdGL3n?vRi%CpB z%G1AsVz8qsp#&0uY1C1zLCm`5*YUhqERM=Ug8kn^Cv{S0xu~>%0Mx~X9gu4kWfg2D zpfBn!CNQL;A@J$;n}^*<9X?V8Bdl;?6M8F=?;uA-dR}6ZI3{TXnuL>qO66+%(e#{> zMxCL+!wZA_YphT?ruQRBM~3TWrrA`{HvJG?Zc-c-E+-vfTEBzy(;TRB58V6 zTM)i4o67f4yIGZL4gWO)o|b7FHq0pvO8CCBeRp_u>khU>xSi~;dZ-#L(QER5GY$et z0B_(a{)+?kp_0a3)P}--v~!9fT2aplle=k2YB_HJ79;r7KN?hW;5o6qFrXD^d;`$< z26W^l=t%i}2O!Mt=?H-9tX9YyAh(PP82|c9_MH$AJZ{%XwU7Jv14Ez2lzr&f zKar(k^GOO|R}01n<-~=;$W{pEFfv(b_?cBmcC6?OWhF`tahp*iN;5&btK)5pSscxJ znVaZc7-RC;Pg=L47+n*U&QBb67D--?yIZh4)}{q%1#@ROp+F}W)&lRZu_wWW#KN!e z@+zA8#HgTa(e*ogBvqut0dcO(*Z}+}eDiOTSdf{pF diff --git a/cmp/regex/__pycache__/regex.cpython-37.pyc b/cmp/regex/__pycache__/regex.cpython-37.pyc deleted file mode 100644 index cbbd2e8eee36a315175b946b08e0e95cb66e8842..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 29214 zcmcg#378y5b?)xD_tNU#wPkyZZCNW@2eK`Uu_eorRzAd9wpJLAC67nbEornfJFA{q zTUusp;}t<6v10-ugewx5Bn}}!zyt^(4k6r_BZh>|!QpU>fdC=r=KJjYuWD+xx~6+~ zBz0@|o7&ga|NCFnt5?<4v(;TU_4amY_(?xlymw$s)1IRP@e_q`BR-WkBQZ5oFKQ({ zqnC_~QHo?DI^`L~XepM7F*#C^-4 znG23dz_`#;`?qj9>5 zvw*oTTcwCb9#NHn8M@6-GBq~3+!sinM~l<3J5kbV~8Lk-KC z>jXMmRh!o8EEvgkr;IurcM>6gO5Yo;8}$ftmv$1)Lr!-+UQg7M^;Es9-d*ph_tyLB z3+nv{W4#t%4u>z-%$ONJt{pI5p@9kEjS*$`*r0|0CfUkkIT&XI2Ip(hS^}7^R$heV zEkItklGl$sbjGGVhBJGm<7ll5W0g1`1#`E#z;&Fg=_q#!JpHcxo>~m~y~tlE<;TFc zsCA4ms&&=+fa?Nov62scbBU7I#1gl;R60kUf7ytmZy%jXjHZXvThcox&qpiO(yP;} z(nIMA8^hAiJe9sDy)V5ceMNe6o(4+#p}*7#cH>i_sHmbfO?{A3V^Etmz#SQ}6FAeL zjyj~<)VC1QdPNB=CwYA_SK4ppHeCk9ukg{PF5>aj9NX7kUo4{&RyIN4NLM+izp`>r z&*Y_mb%R@H#$bIl&MAiNE0DL6@~=eVqU^M4WE$it{>RV8Do-0{RqP>8O7b-G1PzIz zMW$&;Y4EAOuLr0m2AG&asr*7avh zOp~=ah+pbS?CS*PGrC^SLAfD#%Bwsn1MurLp2RWavhHvmgsMhYXBwiWbtcg;rON}A zO`Qt!gkB<>ry(~I#(&tLE39m=eN?om31Eyy#rcfA%+pvLxvX}VLLg&R%;}o-BdJ+G zNRj4%9BmGXRL=$taYGSqzmpo%{FK#rC~8w&Io%`W@lnghMfr;Sj6DcjHkoyLP_=3y zU$QXoHQD5exlJl2^*@{DpEk{psDoE1!IUbRj2L=Pisk2#)%u~Xaw9$!x@@)X7E zc3+pR=JppYC(e(Y0XODgxms=_q9h~AY3gqiACE@n`C0cDLOy)ejOy)ee6_)TM3p~jJPqM&cx@<0FwiaRZ)6K<$8paEzH?3pJxb(Po5O*yo zFCmxtB9|-30bk^xf;`U`dA@?=W%erP3I%zAFXx2{lKaPt^CAVwz2}8YD@fj6UdW3j zm>g5uK0hcq(#UL40#pP;^kjsUfp85#@y)7 z#z&vkR^65cRhA>prY;cqZELG~I4;8AXiV^Q+W z5(8;@MP|F!jf$36l(uVaQM9}wwq5HcMawIC+qJeTT3(UduC-0k@`~zqt?i1ISA@4~ z4J%qewDpU2tsRoq&8=3x#Uz>6@mBLT$egX4$-EXlOy*_lWwN+x?3C~%3p~jJPqG|Q zuWa@#{N-nmjvyu@=Iv4mNlW&;zt%2AOO)*n#V%~HD;oad%$=+k?3Q#1FGq+MepJEB zCG^7YQSfq9c;R2A;N^Jm!r!IfY@$}vCi5oy1f_xB0+97a)7;vu|` zXIgkm!Tb29g+HL+eZ17dA5`!@zG~qQDR>``weSTAe;BzwF@rPkDEu>~;Qjr>@kIsi z?;nmYDR_VXaQwJ}_xBISmleFfe>i?Z!XKH_KZr8;$5!zE{^9tFg7^0i$5$1+zkfJ> zQo;NChvV;8@c#bc_y;8XQN=%Eyh2aKm~%`)%ARo}rxc{@6F2fT3R3ol8(CA3vLD>Y zx`LEF;6^?uAs#D^6v#97<5zFq6JiWa=zfz~66me(w+-PW|C zCAXA+y^bqda;y1ky-v}RThL$Y*Ay+eHT|_-uV~3F>#ub}()x9@CD-aUN#>>PVX{1O zin$Hq1(E*-g+ca=8~GawlGm%3@$**bGk>!cX}2($vps4)*2;I^Pqnx2Z%I~2tFs7v zT+!+*0^g`;brylYt!Q-?fp1c@I*X+@D_XzPQO|mdqSaXh{;s0cSp>dS()vB0Rz_VB zX>U`IUM^0N$dT_3%)qcSF5#aeMHgnYQc7`rxY!()@;}MsG{Z7UhP_cu4sA1 zL%Y_;6fGdyVxwK_+<<0yE4 z|8V?2DtLeYaQr_hcz^$J{68yrfB$g&zbJTr|8V?wB>Z>h^bev8{`sDQ_xBISe_z4- z`-kJ7Q}F)v<@kS9@c#bf_#Y^EfB$g&4<-DM6#t0v3OyBbzaJ||*)wirLqW0XOnz67t_rcg`6xN#?bSF$FYyskoeoynT zK`S%t>yU^HS{cMZB7@cp3FYQ`AVx$>!bCn>J;f42%;+^Ie&_aWd$w-3ug0-!At5cc zm~TbiJWGx41_fJqGj*kVC4#&bqJ4?vjDAJXCCP}A%;@fwpaInK9>MMCtAj50UcntS z@jgL3qYnkmeXrmSn)tr3h;v~P?-#^2^}^Hk$2?0X^MXBSVlymaD=gvzVG$n;i}+Aj z#D%bk4~IoOCW!5wki_*YPPudin$h>!v`qH2qkNvrQ;7`F8p|1djW9~f{_R&G5gD}T z+`bEm%X*0Gb8Rw6rD~*9tK^Y0UpLE!pwn45JJ~7;jYF>b(<)3>l30g0!^P-5vYau@?rk80Gr;>63IDMh#$jg=H%cgr-G+^P4JYp;3@0DQ$83x z<-@^KzBYKuM+9Y~7m^r**f`eg4AkLln!PpH`g>ZPZqxG)u0U>e&$*v(;*Sl8=bL;V zGA)z{Wey zfsJ8WdbKN45lb@KfHO+e-tY@Q_Iw&61X;`fC`{Qj_rKM)r2hr%NMupqYSX8W{5W1c5V zKO)$JCVna`;*W+!{IRfzKOPqGCj_xgUzePA3({T99HYi31$)rMp9+ik>9B}D9TxFt z!Xo~xAa2m(d#)BdtNF#}1aEMZpAVk$3&B%f3@hI7&xQHt4Z+ zG3Oto+(Sq@Gt^06{f;mc9OZX|r~F>0f1Y+}8a{um?^2A7K&yXIRAl6&CS-heiB9VG;jtSj0175&xecwr_>hpcmALN!5jP zY7B`h#C`93JDF6yK$LA?p`I1xi@{UUs|5otr5-$`5jV9cCE1L3W@-T*M~*CAuQsn!y?`o7V))$ z*sh#OXmnG6`M+KH<%0dRLt`G|>%t=wa(+MzKI z@z$`2w}(Z%BP`-u!Xmy+5H~JYL*uL_13Lw;D=5y2@|D3;js#D6d+?OIf~UMgP&QTt z+U%o(H@IfsBPg*}|6&x@rum3Xw~Uw@(Ru=}Hvwn*vaUA_)3-8}0SZ5z-XHD#yIP<9 z?b6fI(QN)|=+cLN`QP=BE@j6X_1WJp{YrM!ZmCN*pvhBuJ@HD<53$ew5{n;ly-vS$ zR{Zrs&T_4mO1Tkwv*jd=C~tdBHcI93_YP<9(iY6Kf5Y&E@B{bAe4e1P@LEru=l@7% zE0!sKZop?NMH4->dKRyU=8xXCzapAHCfojsXn|K>5iRhuuZZq97vgc=MeKzfi_Il1 zd8xUqB`-GzAoIs?dzj4m2bnB52Z51gjz7=rmhwp!`R7CCc2}4ev@i)KHy`3 zB{@nCQo_DyWe=3@q{C|{$xyPJlDjFni;`DULQfdjSxWAsgoYFQFeUVbmR+V~0tqJ2 zG(^ocFySrpv#&MJAciWNpfT65G}~ePq^SXS@Xi`w@4S!OWWwG|$&Hk-|MTBO(l$zH zwStt;iU9VedD0RuvhPklq&=i9V)>)3y{Wo@AP3WsTzLeQIjGemuh$N+_s<_snvs** zDQz2`8?Q%A?3-l9>T!G$kLyR*(#{Rj`Zn!xeP0^8Dq&Ngnql8sOPw@M!M{f~)Do4w zHEirNX4repL_I+{_Ear$GE$A!QYWwp5WT(N6uuEAMx2dTo(4WO7Oy;3OVy%d3Hu2z z^mrfTVk@82phnuYB=&Q{TieHsdK@e%vl|v)s3mK$0c;Kg`FT&4MN}6z6VvV;GalFN z8>_Js7#y(i5O}6z$XV~nqLc*;9`!r2;V!Kf2S>3QH~VU_w`=b-ru9d3jx`sY&<-cK zCu$LNkp255fN z=c?(6a-~4Kxuxv_(Ae=IR+%Uks!qxppDbB6w$^eIg$mp640{huOjzTlP4#vb7Aje` zDMdDyZSG%@+I}=|O|VVqBHM2t#y$tlwB-%W1Ot}rNQ|iId>R>hTSff;X}X6aK$n( zgNY)IVwVg4w_jgo^x?QGlEnFCkos|DUj(V&7{K-iea0f)CeA$7l78qf^;&i*djkaQ zaE7g{C@`k=G0je6e+ZT{i2X;#jENKcctFE(gdJlyi2)7$ENYKno37ZPc9?c$!BE{i zt2fW$?X$$hG|`*EeSSYZ_`0`#2@jl*|rq%(V|8?}Ox8>KPg)O&97me}^HnG|(DWNah*w_0u4U;x~4`S0D z@9efTY|j=a+1!~g$F_T8TZOP;mNghFnp6c=8L9_1+u}Qy(6kTc}b3+=wwyBAiCEwGezRx)WMF(Xb z6n&rNrqrc*n)$}2wG~x;b5lzq$)xUEr`Z|Ex~UmVV*f>I&5LX>zXI8FYjk$4@^7(rjK4) zTu=JJ;${@w3B=;-BH0eSEJ+t%-_F*Pc+pFeXwmC$Eh>hK!z_%_g{|$PS%_(Nj7h9`XmO~88GXFbj5z6N*H1Goe^=q~S>=qo2h-$GxxDf+e2NsG?+ zg0*4fiW|c1_g&%9Dbk02C#pY>fnt$5w&rWJ!65q61+NRz?~`s|CMt z)RJ|_3F9zxoTsrar4t|%T6lI&efI4OT;Z@e~2{>fau0B`RgTXLxZ8Ub|rZzmtA9`LECUKD3J`wFToT{6Jo@=Lwf{M7B zh`u{vbIE>g$#(6_=Z{d1j6eBkGVdobxL-PNU$)aEw&TRk0?`j+H^O_j!3#gbctV`) zyRhX#9Q(!vo1Co_i%2$ngftNcD@BkEMSQ`&EudT)k}3y#z#idDPCMBk=;R*aDZ%IZ zZMa?w7y*NjJ<_5DfDzfP?f%!DoYg=g;C2`jhHkcNz z(zuFOudR4FsbbbMXsR&Q0~hVviNAfsAqA2P`x>6~DKxBYaZ4lAY4cg-l}*)lK&|tg z*&`mRqG#fsQ`q0Ya|KVj1z#A=6CiDHl^{BBO1P=yQggIH8!%07i^$y2H{hvuT{Lwit{rS=SLN1^MCQ( zK3($gjY_(T!{Bns;XW4^kMf|kB-!9HNw&hWMrjvcJH=%ACg9~Sjl7jL_gb>G&+|5V zZQ0)E6oT%b4u{}vpjPZBHZc207s z{!3L_u&x8xOq?e|mzr}#wMxV(nsG479LR}sN(XQ8BrTyL z>7bzKO&`sz3N&8CBG#BiMPX6lqZ!%^fT+$jK97QEzUt4RKc{K@G@r)r9Ezl!r;h;B zQSK9rA~DE3q<;E$SOPdxrcjj8r%=)YfAowaDT2NW5;X=(hq{$a^qMsH ztbOA8Vu^b9n5=E;;*Y)#Y^(3{c-lwhRQ6HanGcZaX$@h<;MXf`a1LDNAWt1Urt?PD zK!M$mnwtM7p$W!RE;NY(lzm4U_cifTY3#N3*)Q17*(&!fzjn7S^->b(-&EB45o!wv ziFe;)gl&0y+<%p@cdpbG_!gDg`i;C@qV4D(vI*HfhJI6dXY^Ou!sss;9m}U>Cu?kK z*!7;@h?~A4JJ7NDK+ijJx|;cOH8Wk!Ow0Cto_<_W+ZDAfJF*SDoW^-t+fPB~DS1rE zd0ZaH8eLlNGw`(_>&Z%1P0W_EmU7Bta%xkDZO%$7wz9UgcKMhOS#I#o3bh&RJ+CyH zRT|CE8nVf&?7lX*u4YL?nmv|d7N-SC)U1#5`V?6Z`EV7Nm`&@xmi{K2@>{$79eS6d z!?u>+&QFYNc>>b>E$fgZ`K+9k)~24Hkh92^+Ti!#LzkW@cm6Q`UrFLSVIZ=A5cdmF zIUqznD7u2tmIzWn{J4^_>B183D0C)-kJb_qX2>A~XHiJi6=j48q#dA~9V!F~{4hx; z(-kPAZocq^avf|aG1mq(1MyW7LCy8Jm{e?vfO3~df=!rD7#+auBQ7U*p9wtBWr*&) zCkP%0-_`&SZ=QWa!vUgrLAj#cV<;31Iv#{3{pzdQue1Sb=>v?z#Zp^%Ud)0)!Ts_| zzzaS)0KiAhixJWnGTqkFd-O5_WsB{+@EDLCzFaI^j1td{(j|1pyZ;Z_c_llFFeN+O z?(<|97a)rgUVM{!>PCZNh58D{=}IVGMe|!cmE`&#K2l(%e^cor5G zZg-C%PtbH)7^DJj*lxTQl(~fRlz0J6VTM`I$C8aCjK$Z9QoHv0t()KZ?y|~2f=W$w z=`1>z(iAR^mz2qkZl>KQ%A7;VO1wl39c6E-ANqb2l&LB0b;$Uxmj$@s2`^P@Dus($ znaR?EulB4kcKl$iS4)PO>NLQmyy_J^>NTTaH5(5_uO-5@^=jPfAc*dS$uJ$yJB8(~ zle)b|9Q>rZFOo%Z_g2;=!}dCkbNI|7&{7`_YgkBi_-8jqNa4ASBZQsJyI!(Y_f zpmg-6RyR-ble&gf*#V`gcPLrnds1s7Wwx1Y8h%ZChg6<)>+w}wd0phD`hL{Ik&^_ZIR1SF* z{q;eU>Q)SStoBpwt|00%{)(xO0qmfD5mYp&zeJQTsHLCBxu{<(1ziF a B, - A -> a, - A -> ε - donde A, B son no terminales y a es un terminal - :param G: Gramatica para chequear - :return: True si la Gramatica es regular - """ - - productions = G.Productions - start_symbol = G.startSymbol - - for prod in productions: - head, body = prod - if len(body) == 2: - if not (body[0].IsTerminal and body[1].IsNonTerminal): - return False - elif len(body) == 1: - if not body[0].IsTerminal: - return False - elif len(body) == 0: - if not (body.IsEpsilon and head == start_symbol): - return False - else: - return False - return True - - @staticmethod - def __build_automata(G): - """ - Tomando los no terminales como los estados y los terminales cono los simbolos de las transiciones - crearemos el automata finito determinista con un unico estado final y tomando como estado inicial - el simbolo distinguido de la gramatica. - :param G: Gramatica Regular a partir de la cual construiremos el automata - :return: Automata Finito Determinista con una cantidad minima de estados - """ - for i, nonterminal in enumerate(G.nonTerminals): - nonterminal.id = i - - nonTerminals = G.nonTerminals - start = G.startSymbol.id - final = len(nonTerminals) - - transitions = {} - - for head, body in G.Productions: - if len(body) == 2: - symbol, next_state = body - try: - transitions[head.id, symbol.Name].append(next_state.id) - except KeyError: - transitions[head.id, symbol.Name] = [next_state.id] - elif len(body) == 1: - symbol = body[0] - try: - transitions[head.id, symbol.Name].append(final) - except KeyError: - transitions[head.id, symbol.Name] = [final] - else: - try: - transitions[head.id, ''].append(final) - except KeyError: - transitions[head.id, ''] = [final] - - nfa = NFA(len(nonTerminals) + 1, finals=[final], transitions=transitions, start=start) - dfa = DFA.from_nfa(nfa) - return DFA.minimize(dfa) - - @staticmethod - def __dfa_to_regex(dfa): - """ - Convierte un automata finito determinista en una - expresion regular utilizando el algoritmo de eliminacion - de estados intermedios - :param dfa: automata finito determinista - :return string con la expresion regular que reconoce el automata - """ - start = dfa.states - final = dfa.states + 1 - transitions = {} - middle_states = list(range(dfa.states)) - - # Compactar arcos multiples - for x in dfa.transitions: - # Dado el estado x por cada estado destino d se unen - # los simbolos que provocan una transicion de x -> d - compacted_arcs = {} - for regex in dfa.transitions[x]: - d = dfa.transitions[x][regex][0] - try: - compacted_arcs[d].append(regex) - except KeyError: - compacted_arcs[d] = [regex] - - # Compactar los arcos multiples - # etiquetandolos con la union de los simbolos - for d, symbols in compacted_arcs.items(): - transitions[x, d] = '|'.join(symbols) if x != d else f'({"|".join(symbols)})*' - - # Agragamos nuestro estado inicial y final - for f in dfa.finals: - transitions[f, final] = EPSILON - transitions[start, dfa.start] = EPSILON - - # Por cada estado intermedio... - while middle_states: - - x = middle_states.pop() # Estado para eliminacion - - # Computar indegree y outdegree del estado x - # con los arcos compactados para tener un acceso - # mas rapido en cada estado intermedio - in_deg = [(s, regex) for (s, d), regex in transitions.items() if d == x and s != d] - out_deg = [(d, regex) for (s, d), regex in transitions.items() if s == x and d != s] - - # Checkeamos que si el estado x tiene auto-transiciones - try: - mid_regex = transitions[x, x] - del transitions[x, x] - except KeyError: - mid_regex = '' - - # Creamos las nuevas aristas eliminando al estado x del automata - for l, left_regex in in_deg: - for r, right_regex in out_deg: - left_regex = '' if left_regex == EPSILON else f'({left_regex})' - right_regex = '' if right_regex == EPSILON else f'({right_regex})' - mid_regex = '' if not mid_regex else f'({mid_regex})' - - regex = left_regex + mid_regex + right_regex - - try: # Comprobamos si ya existe una transicion entre l y r para compactar la arista - previous_regex = transitions[l, r] # Buscamos la regex de la arista anterior - regex = f'{previous_regex}|{regex}' # Unimos las expresiones regulares de las transiciones - except KeyError: - pass - - transitions[l, r] = regex if r != l else process_closure(regex) # Insertamos en la tablas de transiciones - - # Eliminamos transiciones que entran y salen del estado x - for l, _ in in_deg: - del transitions[l, x] - - for r, _ in out_deg: - del transitions[x, r] - - assert (start, final) in transitions, 'State Elimination Error...' - - regex = transitions[start, final] - - change = True - while change: - new_regex = clean_regex(regex) - change = new_regex != regex - regex = new_regex - - return regex diff --git a/cmp/serializer/__init__.py b/cmp/serializer/__init__.py new file mode 100644 index 000000000..7b15f27d2 --- /dev/null +++ b/cmp/serializer/__init__.py @@ -0,0 +1,2 @@ +from .lexer_serializer import LexerSerializer +from .parser_serializer import LRParserSerializer diff --git a/cmp/serializer/lexer_serializer.py b/cmp/serializer/lexer_serializer.py new file mode 100644 index 000000000..70830f8cb --- /dev/null +++ b/cmp/serializer/lexer_serializer.py @@ -0,0 +1,82 @@ +LEXER_CONTENT = """from cmp.automata import State +from cmp.parsing import Lexer +from cmp.regex import NFA + + +class %s(Lexer): + def __init__(self, G): + self.G = G + self.eof = G.EOF + self.regexs = self._build_regexs(self.__table()) + self.automaton = self._build_automaton() + + def __table(self): + G = self.G + return %s + + def _build_regexs(self, table): + regexs = [] + for n, (token_type, nfa) in enumerate(self.__table()): + automaton, states = State.from_nfa(nfa, get_states=True) + + for state in states: + if state.final: + state.tag = (n, token_type) + + regexs.append(automaton) + + return regexs +""" + + +class LexerSerializer: + @staticmethod + def build(**kwargs): + lexer = kwargs['lexer'] + class_name = kwargs['class'] + file_name = kwargs['file'] + LexerSerializer.__meta(lexer, class_name, file_name) + + @staticmethod + def __meta(table, class_name, file_name): + table = LexerSerializer.__build_lexer_table(table) + content = LEXER_CONTENT % (class_name, table) + try: + with open(file_name, 'x') as f: + f.write(content) + except FileExistsError: + with open(file_name, 'w') as f: + f.write(content) + + @staticmethod + def __build_lexer_table(lexer): + lexer = lexer + formatting = '[\n' + for regex in lexer.regexs: + finals = [] + + count = 0 + tag = None + table = '{' + for s in regex: + symbols = s.transitions + for symbol in symbols: + key_symbol = symbol + if symbol == "\"": + key_symbol = "\\\"" + elif symbol == "\\": + key_symbol = "\\\\" + elif symbol == "\n": + key_symbol = "\\n" + table += f'({s.state}, "{key_symbol}"): {[d.state for d in s.transitions[symbol]]}, ' + + if s.final: + tag = s.tag[1] + finals.append(s.state) + + count += 1 + table += '}' + formatting += f' (G["{tag.Name}"], NFA({count}, {finals}, {table}, start={regex.state})),\n' + formatting += ' ]' + + return formatting diff --git a/cmp/serializer/parser_serializer.py b/cmp/serializer/parser_serializer.py new file mode 100644 index 000000000..636faece4 --- /dev/null +++ b/cmp/serializer/parser_serializer.py @@ -0,0 +1,78 @@ +import inspect + +TEMPLATE = """from abc import ABC +from cmp.parsing import ShiftReduceParser +from cmp.pycompiler import AttributeProduction, Sentence +from ast import * + + +class %s(ShiftReduceParser, ABC): + def __init__(self, G, verbose=False): + self.G = G + self.verbose = verbose + self.action = self.__action_table() + self.goto = self.__goto_table() + + def __action_table(self): + G = self.G + return %s + + def __goto_table(self): + G = self.G + return %s +""" + + +class LRParserSerializer: + @staticmethod + def build(**kwargs): + parser = kwargs['parser'] + class_name = kwargs['class'] + file_name = kwargs['file'] + LRParserSerializer.__meta(parser, class_name, file_name) + + @staticmethod + def __meta(parser, class_name, file_name): + action, goto = LRParserSerializer.__build_parsing_tables(parser) + content = TEMPLATE % (class_name, action, goto) + try: + with open(file_name, 'x') as f: + f.write(content) + except FileExistsError: + with open(file_name, 'w') as f: + f.write(content) + + @staticmethod + def __build_parsing_tables(parser): + parser = parser + G = parser.G + + lambdas = {} + for p in G.Productions: + attr = p.attributes[0] + code: str = 'lambda' + inspect.getsource(attr).replace('\n', '').split('lambda')[1] + repr_p: str = repr(p) + lambdas[repr_p] = code + + s1 = '{\n' + for (state, symbol), (act, tag) in parser.action.items(): + s1 += f' ({state}, G["{symbol}"]): ' + + if act == 'SHIFT': + s1 += f'("{act}", {tag}),\n' + elif act == 'REDUCE': + head, body = tag + body = ', '.join(f'G["{s}"]' for s in body) + s1 += f'("{act}", AttributeProduction(G["{head}"], Sentence({body}), [{lambdas[repr(tag)]}])),\n' + else: + s1 += f'("{act}", None),\n' + + s1 += ' }' + + s2 = '{\n' + for (state, symbol), dest in parser.goto.items(): + s2 += f' ({state}, G["{symbol}"]): {dest},\n' + s2 += ' }' + + return s1, s2 + diff --git a/definitions.py b/definitions.py new file mode 100644 index 000000000..607a3f140 --- /dev/null +++ b/definitions.py @@ -0,0 +1,239 @@ +import time + +from cmp.parsing import LALR1Parser, Lexer +from cmp.pycompiler import Grammar + +G = Grammar() + +################# +# Non-Terminals # +################# +program = G.NonTerminal('program', startSymbol=True) +class_set = G.NonTerminal('class-set') +class_def = G.NonTerminal('class-def') +feature_list = G.NonTerminal('feature-list') +attribute = G.NonTerminal('attribute') +method = G.NonTerminal('method') +param_list = G.NonTerminal('param-list') +block = G.NonTerminal('block') +declaration_list = G.NonTerminal('declaration-list') +case_list = G.NonTerminal('case-list') +function_call = G.NonTerminal('function-call') +expr_list = G.NonTerminal('expr-list') +expr = G.NonTerminal('expr') +comp = G.NonTerminal('comp') +arith = G.NonTerminal('arith') +term = G.NonTerminal('term') +factor = G.NonTerminal('factor') + +############### +# identifiers # +############### +G.Terminal('id') +G.Terminal('type') + +############### +# Basic Types # +############### +G.Terminal('string') +G.Terminal('integer') +G.Terminal('boolean') + +########### +# Symbols # +########### +G.Terminal('{') +G.Terminal('}') +G.Terminal('(') +G.Terminal(')') +G.Terminal(',') +G.Terminal('.') +G.Terminal('@') +G.Terminal(':') +G.Terminal(';') +G.Terminal('<-') +G.Terminal('=>') + +############ +# Keywords # +############ +G.Terminal('class') +G.Terminal('inherits') +G.Terminal('if') +G.Terminal('then') +G.Terminal('else') +G.Terminal('fi') +G.Terminal('while') +G.Terminal('loop') +G.Terminal('pool') +G.Terminal('let') +G.Terminal('in') +G.Terminal('case') +G.Terminal('esac') +G.Terminal('of') +G.Terminal('new') +G.Terminal('isvoid') +G.Terminal('true') +G.Terminal('false') +G.Terminal('end') + +############# +# Operators # +############# +G.Terminal('+') +G.Terminal('-') +G.Terminal('*') +G.Terminal('/') +G.Terminal('<') +G.Terminal('<=') +G.Terminal('=') +G.Terminal('~') +G.Terminal('not') + +############ +# Specials # +############ +G.Terminal('space') +G.Terminal('newline') + +############### +# Productions # +############### +program %= 'class-set', lambda s: None + +class_set %= 'class-def', lambda s: None +class_set %= 'class-def class-set', lambda s: None + +class_def %= 'class type { feature-list }', lambda s: None +class_def %= 'class type inherits type { feature-list }', lambda s: None + +feature_list %= 'attribute ;', lambda s: None +feature_list %= 'method ;', lambda s: None +feature_list %= 'attribute ; feature-list', lambda s: None +feature_list %= 'method ; feature-list', lambda s: None + +attribute %= 'id : type', lambda s: None +attribute %= 'id : type <- expr', lambda s: None + +method %= 'id ( ) : type { expr }', lambda s: None +method %= 'id ( param-list ) : type { expr }', lambda s: None + +param_list %= 'id : type', lambda s: None +param_list %= 'id : type , param-list', lambda s: None + +# TODO: Fix operators precedence +expr %= 'id <- expr', lambda s: None +expr %= '{ block }', lambda s: None +expr %= 'if expr then expr else expr fi', lambda s: None +expr %= 'while expr loop expr pool', lambda s: None +expr %= 'let declaration-list in expr', lambda s: None +expr %= 'case expr of case-list esac', lambda s: None +expr %= 'not expr', lambda s: None +expr %= 'isvoid expr', lambda s: None +expr %= '~ expr', lambda s: None +expr %= 'comp', lambda s: None + +comp %= 'comp < arith', lambda s: None +comp %= 'comp <= arith', lambda s: None +comp %= 'comp = arith', lambda s: None +comp %= 'arith', lambda s: None + +arith %= 'arith + term', lambda s: None +arith %= 'arith - term', lambda s: None +arith %= 'term', lambda s: None + +term %= 'term * factor', lambda s: None +term %= 'term / factor', lambda s: None +term %= 'factor', lambda s: None + +factor %= 'id', lambda s: None +factor %= 'true', lambda s: None +factor %= 'false', lambda s: None +factor %= 'integer', lambda s: None +factor %= 'string', lambda s: None +factor %= 'function-call', lambda s: None +factor %= 'new type', lambda s: None + +block %= 'expr ;', lambda s: None +block %= 'expr ; block', lambda s: None + +declaration_list %= 'id : type', lambda s: None +declaration_list %= 'id : type <- expr', lambda s: None +declaration_list %= 'id : type , declaration-list', lambda s: None +declaration_list %= 'id : type , declaration-list', lambda s: None + +case_list %= 'id : type => expr ;', lambda s: None +case_list %= 'case-list id : type => expr ;', lambda s: None + +function_call %= 'id ( expr-list )', lambda s: None +function_call %= 'factor . id ( expr-list )', lambda s: None +function_call %= 'factor @ type . id ( expr-list )', lambda s: None + +expr_list %= 'expr', lambda s: None +expr_list %= 'expr , expr-list', lambda s: None + + +def cool_grammar(): + return G + + +def cool_parser(): + return LALR1Parser(G) + + +def cool_lexer(): + return Lexer([ + (G['+'], '\+'), + (G['-'], '-'), + (G['*'], '\*'), + (G['/'], '/'), + (G['<='], '<='), + (G['<'], '<'), + (G['='], '='), + (G['~'], '~'), + (G['not'], 'not'), + (G['{'], '{'), + (G['}'], '}'), + (G['('], '\('), + (G[')'], '\)'), + (G[','], ','), + (G['.'], '.'), + (G['@'], '@'), + (G[':'], ':'), + (G[';'], ';'), + (G['<-'], '<-'), + (G['=>'], '=>'), + (G['class'], 'class'), + (G['inherits'], 'inherits'), + (G['if'], 'if'), + (G['then'], 'then'), + (G['else'], 'else'), + (G['fi'], 'fi'), + (G['while'], 'while'), + (G['loop'], 'loop'), + (G['pool'], 'pool'), + (G['let'], 'let'), + (G['in'], 'in'), + (G['case'], 'case'), + (G['esac'], 'esac'), + (G['of'], 'of'), + (G['new'], 'new'), + (G['isvoid'], 'isvoid'), + (G['true'], 'true'), + (G['false'], 'false'), + (G['end'], 'end'), + (G['space'], ' +'), + (G['newline'], '\n+'), + (G['integer'], '-?[1-9][0-9]+'), + (G['type'], '[A-Z][a-zA-Z0-9]*'), + (G['id'], '[a-z][a-zA-Z0-9]*'), + (G['string'], '"[ -~]*"'), + ], G.EOF) + + +if __name__ == '__main__': + t = time.time() + parser = cool_parser() + print('Building Time :', time.time() - t, 'sec') + print('Action Table Entries :', len(parser.action)) + print('Presents Conflicts :', parser.conflict is not None) diff --git a/lexer.py b/lexer.py new file mode 100644 index 000000000..5fc0afd63 --- /dev/null +++ b/lexer.py @@ -0,0 +1,74 @@ +from cmp.automata import State +from cmp.parsing import Lexer +from cmp.regex import NFA + + +class CoolLexer(Lexer): + def __init__(self, G): + self.G = G + self.eof = G.EOF + self.regexs = self._build_regexs(self.__table()) + self.automaton = self._build_automaton() + + def __table(self): + G = self.G + return [ + (G["+"], NFA(2, [1], {(0, "+"): [1], }, start=0)), + (G["-"], NFA(2, [0], {(1, "-"): [0], }, start=1)), + (G["*"], NFA(2, [1], {(0, "*"): [1], }, start=0)), + (G["/"], NFA(2, [1], {(0, "/"): [1], }, start=0)), + (G["<="], NFA(3, [0], {(2, "<"): [1], (1, "="): [0], }, start=2)), + (G["<"], NFA(2, [0], {(1, "<"): [0], }, start=1)), + (G["="], NFA(2, [1], {(0, "="): [1], }, start=0)), + (G["~"], NFA(2, [0], {(1, "~"): [0], }, start=1)), + (G["not"], NFA(4, [3], {(2, "n"): [1], (1, "o"): [0], (0, "t"): [3], }, start=2)), + (G["{"], NFA(2, [1], {(0, "{"): [1], }, start=0)), + (G["}"], NFA(2, [0], {(1, "}"): [0], }, start=1)), + (G["("], NFA(2, [1], {(0, "("): [1], }, start=0)), + (G[")"], NFA(2, [1], {(0, ")"): [1], }, start=0)), + (G[","], NFA(2, [1], {(0, ","): [1], }, start=0)), + (G["."], NFA(2, [1], {(0, "."): [1], }, start=0)), + (G["@"], NFA(2, [1], {(0, "@"): [1], }, start=0)), + (G[":"], NFA(2, [0], {(1, ":"): [0], }, start=1)), + (G[";"], NFA(2, [1], {(0, ";"): [1], }, start=0)), + (G["<-"], NFA(3, [1], {(2, "<"): [0], (0, "-"): [1], }, start=2)), + (G["=>"], NFA(3, [0], {(1, "="): [2], (2, ">"): [0], }, start=1)), + (G["class"], NFA(6, [0], {(3, "c"): [2], (2, "l"): [1], (1, "a"): [4], (4, "s"): [5], (5, "s"): [0], }, start=3)), + (G["inherits"], NFA(9, [7], {(4, "i"): [2], (2, "n"): [3], (3, "h"): [5], (5, "e"): [0], (0, "r"): [8], (8, "i"): [1], (1, "t"): [6], (6, "s"): [7], }, start=4)), + (G["if"], NFA(3, [2], {(0, "i"): [1], (1, "f"): [2], }, start=0)), + (G["then"], NFA(5, [1], {(2, "t"): [3], (3, "h"): [4], (4, "e"): [0], (0, "n"): [1], }, start=2)), + (G["else"], NFA(5, [4], {(0, "e"): [1], (1, "l"): [2], (2, "s"): [3], (3, "e"): [4], }, start=0)), + (G["fi"], NFA(3, [1], {(0, "f"): [2], (2, "i"): [1], }, start=0)), + (G["while"], NFA(6, [5], {(0, "w"): [1], (1, "h"): [2], (2, "i"): [3], (3, "l"): [4], (4, "e"): [5], }, start=0)), + (G["loop"], NFA(5, [1], {(2, "l"): [3], (3, "o"): [4], (4, "o"): [0], (0, "p"): [1], }, start=2)), + (G["pool"], NFA(5, [1], {(4, "p"): [3], (3, "o"): [0], (0, "o"): [2], (2, "l"): [1], }, start=4)), + (G["let"], NFA(4, [1], {(2, "l"): [0], (0, "e"): [3], (3, "t"): [1], }, start=2)), + (G["in"], NFA(3, [1], {(2, "i"): [0], (0, "n"): [1], }, start=2)), + (G["case"], NFA(5, [4], {(0, "c"): [1], (1, "a"): [2], (2, "s"): [3], (3, "e"): [4], }, start=0)), + (G["esac"], NFA(5, [1], {(3, "e"): [4], (4, "s"): [2], (2, "a"): [0], (0, "c"): [1], }, start=3)), + (G["of"], NFA(3, [1], {(2, "o"): [0], (0, "f"): [1], }, start=2)), + (G["new"], NFA(4, [3], {(0, "n"): [1], (1, "e"): [2], (2, "w"): [3], }, start=0)), + (G["isvoid"], NFA(7, [2], {(0, "i"): [4], (4, "s"): [6], (6, "v"): [5], (5, "o"): [3], (3, "i"): [1], (1, "d"): [2], }, start=0)), + (G["true"], NFA(5, [4], {(0, "t"): [1], (1, "r"): [2], (2, "u"): [3], (3, "e"): [4], }, start=0)), + (G["false"], NFA(6, [3], {(4, "f"): [0], (0, "a"): [2], (2, "l"): [1], (1, "s"): [5], (5, "e"): [3], }, start=4)), + (G["end"], NFA(4, [0], {(3, "e"): [1], (1, "n"): [2], (2, "d"): [0], }, start=3)), + (G["space"], NFA(2, [0], {(1, " "): [0], (0, " "): [0], }, start=1)), + (G["newline"], NFA(2, [0], {(1, "\n"): [0], (0, "\n"): [0], }, start=1)), + (G["integer"], NFA(4, [2], {(1, "1"): [3], (1, "5"): [3], (1, "8"): [3], (1, "7"): [3], (1, "6"): [3], (1, "2"): [3], (1, "3"): [3], (1, "9"): [3], (1, "-"): [0], (1, "4"): [3], (3, "1"): [2], (3, "5"): [2], (3, "8"): [2], (3, "7"): [2], (3, "6"): [2], (3, "2"): [2], (3, "3"): [2], (3, "9"): [2], (3, "4"): [2], (3, "0"): [2], (2, "1"): [2], (2, "5"): [2], (2, "8"): [2], (2, "7"): [2], (2, "6"): [2], (2, "2"): [2], (2, "3"): [2], (2, "9"): [2], (2, "4"): [2], (2, "0"): [2], (0, "1"): [3], (0, "5"): [3], (0, "8"): [3], (0, "7"): [3], (0, "6"): [3], (0, "2"): [3], (0, "3"): [3], (0, "9"): [3], (0, "4"): [3], }, start=1)), + (G["type"], NFA(2, [1], {(0, "E"): [1], (0, "D"): [1], (0, "M"): [1], (0, "B"): [1], (0, "I"): [1], (0, "X"): [1], (0, "G"): [1], (0, "W"): [1], (0, "T"): [1], (0, "O"): [1], (0, "C"): [1], (0, "L"): [1], (0, "R"): [1], (0, "A"): [1], (0, "N"): [1], (0, "F"): [1], (0, "J"): [1], (0, "Q"): [1], (0, "S"): [1], (0, "U"): [1], (0, "Y"): [1], (0, "Z"): [1], (0, "V"): [1], (0, "K"): [1], (0, "P"): [1], (0, "H"): [1], (1, "E"): [1], (1, "o"): [1], (1, "y"): [1], (1, "7"): [1], (1, "z"): [1], (1, "D"): [1], (1, "w"): [1], (1, "c"): [1], (1, "M"): [1], (1, "g"): [1], (1, "d"): [1], (1, "u"): [1], (1, "B"): [1], (1, "I"): [1], (1, "e"): [1], (1, "2"): [1], (1, "X"): [1], (1, "k"): [1], (1, "n"): [1], (1, "G"): [1], (1, "p"): [1], (1, "W"): [1], (1, "q"): [1], (1, "8"): [1], (1, "T"): [1], (1, "O"): [1], (1, "C"): [1], (1, "L"): [1], (1, "f"): [1], (1, "i"): [1], (1, "r"): [1], (1, "R"): [1], (1, "A"): [1], (1, "6"): [1], (1, "N"): [1], (1, "s"): [1], (1, "3"): [1], (1, "F"): [1], (1, "m"): [1], (1, "a"): [1], (1, "J"): [1], (1, "9"): [1], (1, "Q"): [1], (1, "S"): [1], (1, "4"): [1], (1, "U"): [1], (1, "h"): [1], (1, "Y"): [1], (1, "l"): [1], (1, "0"): [1], (1, "j"): [1], (1, "1"): [1], (1, "Z"): [1], (1, "5"): [1], (1, "t"): [1], (1, "V"): [1], (1, "K"): [1], (1, "P"): [1], (1, "x"): [1], (1, "b"): [1], (1, "H"): [1], (1, "v"): [1], }, start=0)), + (G["id"], NFA(2, [1], {(0, "o"): [1], (0, "y"): [1], (0, "z"): [1], (0, "w"): [1], (0, "c"): [1], (0, "g"): [1], (0, "d"): [1], (0, "u"): [1], (0, "e"): [1], (0, "k"): [1], (0, "n"): [1], (0, "p"): [1], (0, "q"): [1], (0, "f"): [1], (0, "i"): [1], (0, "s"): [1], (0, "m"): [1], (0, "a"): [1], (0, "h"): [1], (0, "l"): [1], (0, "j"): [1], (0, "t"): [1], (0, "x"): [1], (0, "b"): [1], (0, "r"): [1], (0, "v"): [1], (1, "E"): [1], (1, "o"): [1], (1, "y"): [1], (1, "7"): [1], (1, "z"): [1], (1, "D"): [1], (1, "w"): [1], (1, "c"): [1], (1, "M"): [1], (1, "g"): [1], (1, "d"): [1], (1, "u"): [1], (1, "B"): [1], (1, "I"): [1], (1, "e"): [1], (1, "2"): [1], (1, "X"): [1], (1, "k"): [1], (1, "n"): [1], (1, "p"): [1], (1, "G"): [1], (1, "W"): [1], (1, "q"): [1], (1, "8"): [1], (1, "T"): [1], (1, "f"): [1], (1, "C"): [1], (1, "i"): [1], (1, "L"): [1], (1, "O"): [1], (1, "R"): [1], (1, "A"): [1], (1, "6"): [1], (1, "N"): [1], (1, "s"): [1], (1, "3"): [1], (1, "F"): [1], (1, "m"): [1], (1, "a"): [1], (1, "J"): [1], (1, "9"): [1], (1, "Q"): [1], (1, "S"): [1], (1, "4"): [1], (1, "h"): [1], (1, "l"): [1], (1, "U"): [1], (1, "Y"): [1], (1, "0"): [1], (1, "H"): [1], (1, "j"): [1], (1, "1"): [1], (1, "Z"): [1], (1, "5"): [1], (1, "t"): [1], (1, "V"): [1], (1, "K"): [1], (1, "P"): [1], (1, "x"): [1], (1, "b"): [1], (1, "r"): [1], (1, "v"): [1], }, start=0)), + (G["string"], NFA(3, [1], {(0, "\""): [2], (2, ">"): [2], (2, "D"): [2], (2, "*"): [2], (2, "g"): [2], (2, "@"): [2], (2, "q"): [2], (2, "O"): [2], (2, "L"): [2], (2, "3"): [2], (2, "F"): [2], (2, "="): [2], (2, "Q"): [2], (2, "#"): [2], (2, "("): [2], (2, ","): [2], (2, "Z"): [2], (2, "t"): [2], (2, "V"): [2], (2, "]"): [2], (2, "{"): [2], (2, "~"): [2], (2, "r"): [2], (2, "E"): [2], (2, "z"): [2], (2, "-"): [2], (2, "I"): [2], (2, "2"): [2], (2, "k"): [2], (2, "G"): [2], (2, "&"): [2], (2, "6"): [2], (2, "N"): [2], (2, "+"): [2], (2, "\""): [1], (2, " "): [2], (2, "l"): [2], (2, "Y"): [2], (2, "}"): [2], (2, "j"): [2], (2, "?"): [2], (2, "|"): [2], (2, "."): [2], (2, "`"): [2], (2, "'"): [2], (2, "v"): [2], (2, "y"): [2], (2, ":"): [2], (2, "w"): [2], (2, "M"): [2], (2, "!"): [2], (2, "B"): [2], (2, "n"): [2], (2, "p"): [2], (2, "W"): [2], (2, "8"): [2], (2, "T"): [2], (2, "$"): [2], (2, "C"): [2], (2, "_"): [2], (2, "9"): [2], (2, "<"): [2], (2, "s"): [2], (2, "a"): [2], (2, "J"): [2], (2, "4"): [2], (2, "S"): [2], (2, "5"): [2], (2, "P"): [2], (2, "/"): [2], (2, "x"): [2], (2, "\\"): [2], (2, "d"): [2], (2, "o"): [2], (2, "7"): [2], (2, "c"): [2], (2, "%"): [2], (2, "u"): [2], (2, "e"): [2], (2, "X"): [2], (2, ";"): [2], (2, ")"): [2], (2, "["): [2], (2, "f"): [2], (2, "i"): [2], (2, "R"): [2], (2, "A"): [2], (2, "m"): [2], (2, "U"): [2], (2, "h"): [2], (2, "^"): [2], (2, "0"): [2], (2, "1"): [2], (2, "K"): [2], (2, "b"): [2], (2, "H"): [2], (1, ">"): [2], (1, "D"): [2], (1, "*"): [2], (1, "g"): [2], (1, "@"): [2], (1, "q"): [2], (1, "O"): [2], (1, "L"): [2], (1, "3"): [2], (1, "F"): [2], (1, "="): [2], (1, "Q"): [2], (1, "#"): [2], (1, "("): [2], (1, ","): [2], (1, "Z"): [2], (1, "t"): [2], (1, "V"): [2], (1, "]"): [2], (1, "{"): [2], (1, "~"): [2], (1, "r"): [2], (1, "E"): [2], (1, "z"): [2], (1, "-"): [2], (1, "I"): [2], (1, "2"): [2], (1, "k"): [2], (1, "G"): [2], (1, "&"): [2], (1, "6"): [2], (1, "N"): [2], (1, "+"): [2], (1, "\""): [1], (1, " "): [2], (1, "l"): [2], (1, "Y"): [2], (1, "}"): [2], (1, "j"): [2], (1, "?"): [2], (1, "|"): [2], (1, "."): [2], (1, "`"): [2], (1, "'"): [2], (1, "v"): [2], (1, "y"): [2], (1, ":"): [2], (1, "w"): [2], (1, "M"): [2], (1, "!"): [2], (1, "B"): [2], (1, "n"): [2], (1, "p"): [2], (1, "W"): [2], (1, "8"): [2], (1, "T"): [2], (1, "$"): [2], (1, "C"): [2], (1, "_"): [2], (1, "9"): [2], (1, "<"): [2], (1, "s"): [2], (1, "a"): [2], (1, "J"): [2], (1, "4"): [2], (1, "S"): [2], (1, "5"): [2], (1, "P"): [2], (1, "/"): [2], (1, "x"): [2], (1, "\\"): [2], (1, "d"): [2], (1, "o"): [2], (1, "7"): [2], (1, "c"): [2], (1, "%"): [2], (1, "u"): [2], (1, "e"): [2], (1, "X"): [2], (1, ";"): [2], (1, ")"): [2], (1, "["): [2], (1, "f"): [2], (1, "i"): [2], (1, "R"): [2], (1, "A"): [2], (1, "m"): [2], (1, "U"): [2], (1, "h"): [2], (1, "^"): [2], (1, "0"): [2], (1, "1"): [2], (1, "K"): [2], (1, "b"): [2], (1, "H"): [2], }, start=0)), + ] + + def _build_regexs(self, table): + regexs = [] + for n, (token_type, nfa) in enumerate(self.__table()): + automaton, states = State.from_nfa(nfa, get_states=True) + + for state in states: + if state.final: + state.tag = (n, token_type) + + regexs.append(automaton) + + return regexs diff --git a/main.py b/main.py index eaf15d501..28263efbd 100644 --- a/main.py +++ b/main.py @@ -1,416 +1,9 @@ import time - -from cmp.grammalyzer import LALR1Parser, Lexer - -from cmp.pycompiler import AttributeProduction, Sentence, Grammar - - -def attribute(production: str): - def decorator(attr): - head, body = production.split('->') - head = G[head[:-1]] - body = Sentence(*(G[symbol] for symbol in body[1:].split())) - G.Add_Production(AttributeProduction(head, body, attr)) - - return decorator - - -G = Grammar() - -################# -# Non-Terminals # -################# -Program = G.NonTerminal('program', startSymbol=True) -ClassSet = G.NonTerminal('class-set') -ClassDef = G.NonTerminal('class-def') -FeatureList = G.NonTerminal('feature-list') -Attribute = G.NonTerminal('attribute') -Method = G.NonTerminal('method') -ParamVector = G.NonTerminal('param-vector') -Block = G.NonTerminal('block') -Declaration = G.NonTerminal('declaration') -CaseList = G.NonTerminal('case-list') -FunctionCall = G.NonTerminal('function-call') -ExprVector = G.NonTerminal('expr-vector') -BodyExpr = G.NonTerminal('body-expr') -Expr = G.NonTerminal('expr') -CompExpr = G.NonTerminal('comp-expr') -SubExpr = G.NonTerminal('sub-expr') -Term = G.NonTerminal('term') -Fact = G.NonTerminal('fact') -Atom = G.NonTerminal('atom') -Particle = G.NonTerminal('particle') - -############### -# identifiers # -############### -identifier = G.Terminals('id') -type_name = G.Terminals('type') - -############### -# Basic Types # -############### -string = G.Terminal('string') -integer = G.Terminal('integer') -boolean = G.Terminal('boolean') - -########### -# Symbols # -########### -open_bracket = G.Terminal('{') -close_bracket = G.Terminal('}') -opar = G.Terminal('(') -cpar = G.Terminal(')') -comma = G.Terminal(',') -dot = G.Terminal('.') -arroba = G.Terminal('@') -two_points = G.Terminal(':') -semi_colon = G.Terminal(';') -left_arrow = G.Terminal('<-') -right_arrow = G.Terminal('=>') - -############ -# KeyWords # -############ -keyword_class = G.Terminal('class') -keyword_inherits = G.Terminal('inherits') -keyword_if = G.Terminal('if') -keyword_then = G.Terminal('then') -keyword_else = G.Terminal('else') -keyword_fi = G.Terminal('fi') -keyword_while = G.Terminal('while') -keyword_loop = G.Terminal('loop') -keyword_pool = G.Terminal('pool') -keyword_let = G.Terminal('let') -keyword_in = G.Terminal('in') -keyword_case = G.Terminal('case') -keyword_esac = G.Terminal('esac') -keyword_of = G.Terminal('of') -keyword_new = G.Terminal('new') -keyword_isvoid = G.Terminal('isvoid') -keyword_true = G.Terminal('true') -keyword_false = G.Terminal('false') -keyword_end = G.Terminal('end') - -############# -# Operators # -############# -plus = G.Terminal('+') -minus = G.Terminal('-') -star = G.Terminal('*') -div = G.Terminal('/') -less = G.Terminal('<') -lesse = G.Terminal('<=') -equal = G.Terminal('=') -complement = G.Terminal('~') -not_op = G.Terminal('not') - - -class CoolGrammar: - - @staticmethod - @attribute('program -> class-set') - def program(rule): - pass - - @staticmethod - @attribute('class-set -> class-def') - def assignment(rule): - pass - - @staticmethod - @attribute('class-set -> class-set class-def') - def assignment(rule): - pass - - @staticmethod - @attribute('class-def -> class type { feature-list }') - def assignment(rule): - pass - - @staticmethod - @attribute('class-def -> class type inherits type { feature-list }') - def assignment(rule): - pass - - @staticmethod - @attribute('feature-list -> attribute ;') - def assignment(rule): - pass - - @staticmethod - @attribute('feature-list -> method ;') - def assignment(rule): - pass - - @staticmethod - @attribute('feature-list -> feature-list attribute ;') - def assignment(rule): - pass - - @staticmethod - @attribute('feature-list -> feature-list method ;') - def assignment(rule): - pass - - @staticmethod - @attribute('attribute -> id : type') - def assignment(rule): - pass - - @staticmethod - @attribute('attribute -> id : type <- expr') - def assignment(rule): - pass - - @staticmethod - @attribute('method -> id ( ) : type { body-expr }') - def assignment(rule): - pass - - @staticmethod - @attribute('method -> id ( param-vector ) : type { body-expr }') - def assignment(rule): - pass - - @staticmethod - @attribute('param-vector -> id : type') - def assignment(rule): - pass - - @staticmethod - @attribute('param-vector -> param-vector , id : type') - def assignment(rule): - pass - - @staticmethod - @attribute('body-expr -> id <- expr') - def assignment(rule): - pass - - @staticmethod - @attribute('body-expr -> { block }') - def assignment(rule): - pass - - @staticmethod - @attribute('body-expr -> if expr then body-expr else body-expr fi') - def assignment(rule): - pass - - @staticmethod - @attribute('body-expr -> while expr loop body-expr pool') - def assignment(rule): - pass - - @staticmethod - @attribute('body-expr -> declaration in body-expr') - def assignment(rule): - pass - - @staticmethod - @attribute('body-expr -> case expr of case-list esac') - def assignment(rule): - pass - - @staticmethod - @attribute('body-expr -> expr') - def assignment(rule): - pass - - @staticmethod - @attribute('expr -> not expr') - def assignment(rule): - pass - - @staticmethod - @attribute('expr -> comp-expr') - def assignment(rule): - pass - - @staticmethod - @attribute('comp-expr -> comp-expr < sub-expr') - def assignment(rule): - pass - - @staticmethod - @attribute('comp-expr -> comp-expr <= sub-expr') - def assignment(rule): - pass - - @staticmethod - @attribute('comp-expr -> comp-expr = sub-expr') - def assignment(rule): - pass - - @staticmethod - @attribute('comp-expr -> sub-expr') - def assignment(rule): - pass - - @staticmethod - @attribute('sub-expr -> sub-expr + term') - def assignment(rule): - pass - - @staticmethod - @attribute('sub-expr -> sub-expr - term') - def assignment(rule): - pass - - @staticmethod - @attribute('sub-expr -> term') - def assignment(rule): - pass - - @staticmethod - @attribute('term -> term * fact') - def assignment(rule): - pass - - @staticmethod - @attribute('term -> term / fact') - def assignment(rule): - pass - - @staticmethod - @attribute('term -> fact') - def assignment(rule): - pass - - @staticmethod - @attribute('fact -> isvoid fact') - def assignment(rule): - pass - - @staticmethod - @attribute('fact -> atom') - def assignment(rule): - pass - - @staticmethod - @attribute('atom -> ~ atom') - def assignment(rule): - pass - - @staticmethod - @attribute('atom -> particle') - def assignment(rule): - pass - - @staticmethod - @attribute('particle -> id') - def assignment(rule): - pass - - @staticmethod - @attribute('particle -> true') - def assignment(rule): - pass - - @staticmethod - @attribute('particle -> false') - def assignment(rule): - pass - - @staticmethod - @attribute('particle -> integer') - def assignment(rule): - pass - - @staticmethod - @attribute('particle -> string') - def assignment(rule): - pass - - @staticmethod - @attribute('particle -> function-call') - def assignment(rule): - pass - - @staticmethod - @attribute('particle -> new type') - def assignment(rule): - pass - - @staticmethod - @attribute('particle -> ( expr )') - def assignment(rule): - pass - - @staticmethod - @attribute('block -> body-expr ;') - def assignment(rule): - pass - - @staticmethod - @attribute('block -> block body-expr ;') - def assignment(rule): - pass - - @staticmethod - @attribute('declaration -> let id : type') - def assignment(rule): - pass - - @staticmethod - @attribute('declaration -> let id : type <- expr') - def assignment(rule): - pass - - @staticmethod - @attribute('declaration -> declaration , id : type') - def assignment(rule): - pass - - @staticmethod - @attribute('declaration -> declaration , id : type <- expr') - def assignment(rule): - pass - - @staticmethod - @attribute('case-list -> id : type => expr ;') - def assignment(rule): - pass - - @staticmethod - @attribute('case-list -> case-list id : type => expr ;') - def assignment(rule): - pass - - @staticmethod - @attribute('function-call -> id ( expr-vector )') - def assignment(rule): - pass - - @staticmethod - @attribute('function-call -> particle . id ( expr-vector )') - def assignment(rule): - pass - - @staticmethod - @attribute('function-call -> particle @ type . id ( expr-vector )') - def assignment(rule): - pass - - @staticmethod - @attribute('expr-vector -> expr') - def assignment(rule): - pass - - @attribute('expr-vector -> expr-vector , expr') - def expr_vector(rule): - pass - +from parser import CoolParser +from definitions import cool_grammar if __name__ == '__main__': - print('Productions :', len(G.Productions)) - for p in G.Productions: - print(repr(p)) - print() - + G = cool_grammar() t = time.time() - parser = LALR1Parser(G) - print('Build Parsing Time :', time.time() - t) - print('Action Entries :', len(parser.action)) - print('Parsing Conflicts :', parser.conflict is not None) + parser = CoolParser(G) + print(time.time() - t) diff --git a/nonterminals.py b/nonterminals.py deleted file mode 100644 index 54c2b6140..000000000 --- a/nonterminals.py +++ /dev/null @@ -1,60 +0,0 @@ -from cmp.pycompiler import Grammar, Production, Sentence, NonTerminal - - -class ImprovedGrammar(Grammar): - def NonTerminal(self, name, startSymbol=False): - name = name.strip() - if not name: - raise Exception("Empty name") - - term = ImprovedNonTerminal(name, self) - - if startSymbol: - - if self.startSymbol is None: - self.startSymbol = term - else: - raise Exception("Cannot define more than one start symbol.") - - self.nonTerminals.append(term) - self.symbDict[name] = term - return term - - -class ImprovedNonTerminal(NonTerminal): - def __imod__(self, other): - try: - return super().__imod__(other) - except TypeError: - - if isinstance(other, str): - sentence = Sentence(*(self.Grammar[s] for s in other.split())) - p = Production(self, sentence) - self.Grammar.Add_Production(p) - return self - - raise TypeError() - - -G = ImprovedGrammar() - -Program = G.NonTerminal('program', startSymbol=True) -ClassSet = G.NonTerminal('class-set') -ClassDef = G.NonTerminal('class-def') -FeatureList = G.NonTerminal('feature-list') -Attribute = G.NonTerminal('attribute') -Method = G.NonTerminal('method') -ParamVector = G.NonTerminal('param-vector') -Block = G.NonTerminal('block') -Declaration = G.NonTerminal('declaration') -CaseList = G.NonTerminal('case-list') -FunctionCall = G.NonTerminal('function-call') -ExprVector = G.NonTerminal('expr-vector') -BodyExpr = G.NonTerminal('body-expr') -Expr = G.NonTerminal('expr') -CompExpr = G.NonTerminal('comp-expr') -SubExpr = G.NonTerminal('sub-expr') -Term = G.NonTerminal('term') -Fact = G.NonTerminal('fact') -Atom = G.NonTerminal('atom') -Particle = G.NonTerminal('particle') diff --git a/parser.py b/parser.py new file mode 100644 index 000000000..9feb700d3 --- /dev/null +++ b/parser.py @@ -0,0 +1,1188 @@ +from abc import ABC +from cmp.parsing import ShiftReduceParser +from cmp.pycompiler import AttributeProduction, Sentence +from ast import * + + +class CoolParser(ShiftReduceParser, ABC): + def __init__(self, G, verbose=False): + self.G = G + self.verbose = verbose + self.action = self.__action_table() + self.goto = self.__goto_table() + + def __action_table(self): + G = self.G + return { + (0, G["class"]): ("SHIFT", 1), + (1, G["type"]): ("SHIFT", 2), + (2, G["{"]): ("SHIFT", 3), + (2, G["inherits"]): ("SHIFT", 135), + (3, G["id"]): ("SHIFT", 4), + (4, G[":"]): ("SHIFT", 123), + (4, G["("]): ("SHIFT", 5), + (5, G[")"]): ("SHIFT", 11), + (5, G["id"]): ("SHIFT", 6), + (6, G[":"]): ("SHIFT", 7), + (7, G["type"]): ("SHIFT", 8), + (8, G[")"]): ("REDUCE", AttributeProduction(G["param-list"], Sentence(G["id"], G[":"], G["type"]), [lambda s: None])), + (8, G[","]): ("SHIFT", 9), + (9, G["id"]): ("SHIFT", 6), + (10, G[")"]): ("REDUCE", AttributeProduction(G["param-list"], Sentence(G["id"], G[":"], G["type"], G[","], G["param-list"]), [lambda s: None])), + (11, G[":"]): ("SHIFT", 12), + (12, G["type"]): ("SHIFT", 13), + (13, G["{"]): ("SHIFT", 14), + (14, G["let"]): ("SHIFT", 22), + (14, G["true"]): ("SHIFT", 33), + (14, G["case"]): ("SHIFT", 29), + (14, G["new"]): ("SHIFT", 30), + (14, G["id"]): ("SHIFT", 15), + (14, G["~"]): ("SHIFT", 35), + (14, G["isvoid"]): ("SHIFT", 32), + (14, G["false"]): ("SHIFT", 34), + (14, G["not"]): ("SHIFT", 36), + (14, G["{"]): ("SHIFT", 19), + (14, G["string"]): ("SHIFT", 17), + (14, G["integer"]): ("SHIFT", 18), + (14, G["while"]): ("SHIFT", 21), + (14, G["if"]): ("SHIFT", 20), + (15, G["("]): ("SHIFT", 16), + (15, G["loop"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (15, G["pool"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (15, G["in"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (15, G["of"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (15, G["+"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (15, G["-"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (15, G["*"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (15, G["/"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (15, G["<"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (15, G["<="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (15, G["="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (15, G["}"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (15, G[")"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (15, G[","]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (15, G["."]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (15, G["@"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (15, G[";"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (15, G["then"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (15, G["else"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (15, G["fi"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (15, G["<-"]): ("SHIFT", 112), + (16, G["isvoid"]): ("SHIFT", 32), + (16, G["not"]): ("SHIFT", 36), + (16, G["{"]): ("SHIFT", 19), + (16, G["integer"]): ("SHIFT", 18), + (16, G["let"]): ("SHIFT", 22), + (16, G["case"]): ("SHIFT", 29), + (16, G["string"]): ("SHIFT", 17), + (16, G["id"]): ("SHIFT", 15), + (16, G["false"]): ("SHIFT", 34), + (16, G["while"]): ("SHIFT", 21), + (16, G["new"]): ("SHIFT", 30), + (16, G["if"]): ("SHIFT", 20), + (16, G["true"]): ("SHIFT", 33), + (16, G["~"]): ("SHIFT", 35), + (17, G["loop"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), + (17, G["pool"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), + (17, G["in"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), + (17, G["of"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), + (17, G["+"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), + (17, G["-"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), + (17, G["*"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), + (17, G["/"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), + (17, G["<"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), + (17, G["<="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), + (17, G["="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), + (17, G["}"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), + (17, G[")"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), + (17, G[","]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), + (17, G["."]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), + (17, G["@"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), + (17, G[";"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), + (17, G["then"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), + (17, G["else"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), + (17, G["fi"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), + (18, G["loop"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), + (18, G["pool"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), + (18, G["in"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), + (18, G["of"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), + (18, G["+"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), + (18, G["-"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), + (18, G["*"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), + (18, G["/"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), + (18, G["<"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), + (18, G["<="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), + (18, G["="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), + (18, G["}"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), + (18, G[")"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), + (18, G[","]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), + (18, G["."]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), + (18, G["@"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), + (18, G[";"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), + (18, G["then"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), + (18, G["else"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), + (18, G["fi"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), + (19, G["id"]): ("SHIFT", 15), + (19, G["case"]): ("SHIFT", 29), + (19, G["isvoid"]): ("SHIFT", 32), + (19, G["string"]): ("SHIFT", 17), + (19, G["true"]): ("SHIFT", 33), + (19, G["not"]): ("SHIFT", 36), + (19, G["integer"]): ("SHIFT", 18), + (19, G["let"]): ("SHIFT", 22), + (19, G["if"]): ("SHIFT", 20), + (19, G["~"]): ("SHIFT", 35), + (19, G["while"]): ("SHIFT", 21), + (19, G["false"]): ("SHIFT", 34), + (19, G["{"]): ("SHIFT", 19), + (19, G["new"]): ("SHIFT", 30), + (20, G["not"]): ("SHIFT", 36), + (20, G["false"]): ("SHIFT", 34), + (20, G["string"]): ("SHIFT", 17), + (20, G["true"]): ("SHIFT", 33), + (20, G["id"]): ("SHIFT", 15), + (20, G["integer"]): ("SHIFT", 18), + (20, G["while"]): ("SHIFT", 21), + (20, G["{"]): ("SHIFT", 19), + (20, G["if"]): ("SHIFT", 20), + (20, G["isvoid"]): ("SHIFT", 32), + (20, G["let"]): ("SHIFT", 22), + (20, G["case"]): ("SHIFT", 29), + (20, G["new"]): ("SHIFT", 30), + (20, G["~"]): ("SHIFT", 35), + (21, G["id"]): ("SHIFT", 15), + (21, G["false"]): ("SHIFT", 34), + (21, G["string"]): ("SHIFT", 17), + (21, G["true"]): ("SHIFT", 33), + (21, G["{"]): ("SHIFT", 19), + (21, G["integer"]): ("SHIFT", 18), + (21, G["while"]): ("SHIFT", 21), + (21, G["isvoid"]): ("SHIFT", 32), + (21, G["new"]): ("SHIFT", 30), + (21, G["~"]): ("SHIFT", 35), + (21, G["let"]): ("SHIFT", 22), + (21, G["if"]): ("SHIFT", 20), + (21, G["not"]): ("SHIFT", 36), + (21, G["case"]): ("SHIFT", 29), + (22, G["id"]): ("SHIFT", 23), + (23, G[":"]): ("SHIFT", 24), + (24, G["type"]): ("SHIFT", 25), + (25, G["<-"]): ("SHIFT", 28), + (25, G["in"]): ("REDUCE", AttributeProduction(G["declaration-list"], Sentence(G["id"], G[":"], G["type"]), [lambda s: None])), + (25, G[","]): ("SHIFT", 26), + (26, G["id"]): ("SHIFT", 23), + (27, G["in"]): ("REDUCE", AttributeProduction(G["declaration-list"], Sentence(G["id"], G[":"], G["type"], G[","], G["declaration-list"]), [lambda s: None])), + (28, G["not"]): ("SHIFT", 36), + (28, G["false"]): ("SHIFT", 34), + (28, G["id"]): ("SHIFT", 15), + (28, G["string"]): ("SHIFT", 17), + (28, G["true"]): ("SHIFT", 33), + (28, G["integer"]): ("SHIFT", 18), + (28, G["while"]): ("SHIFT", 21), + (28, G["{"]): ("SHIFT", 19), + (28, G["if"]): ("SHIFT", 20), + (28, G["isvoid"]): ("SHIFT", 32), + (28, G["let"]): ("SHIFT", 22), + (28, G["case"]): ("SHIFT", 29), + (28, G["new"]): ("SHIFT", 30), + (28, G["~"]): ("SHIFT", 35), + (29, G["if"]): ("SHIFT", 20), + (29, G["id"]): ("SHIFT", 15), + (29, G["false"]): ("SHIFT", 34), + (29, G["let"]): ("SHIFT", 22), + (29, G["integer"]): ("SHIFT", 18), + (29, G["~"]): ("SHIFT", 35), + (29, G["new"]): ("SHIFT", 30), + (29, G["{"]): ("SHIFT", 19), + (29, G["isvoid"]): ("SHIFT", 32), + (29, G["while"]): ("SHIFT", 21), + (29, G["not"]): ("SHIFT", 36), + (29, G["true"]): ("SHIFT", 33), + (29, G["string"]): ("SHIFT", 17), + (29, G["case"]): ("SHIFT", 29), + (30, G["type"]): ("SHIFT", 31), + (31, G["loop"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), + (31, G["pool"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), + (31, G["in"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), + (31, G["of"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), + (31, G["+"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), + (31, G["-"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), + (31, G["*"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), + (31, G["/"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), + (31, G["<"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), + (31, G["<="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), + (31, G["="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), + (31, G["}"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), + (31, G[")"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), + (31, G[","]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), + (31, G["."]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), + (31, G["@"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), + (31, G[";"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), + (31, G["then"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), + (31, G["else"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), + (31, G["fi"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), + (32, G["id"]): ("SHIFT", 15), + (32, G["{"]): ("SHIFT", 19), + (32, G["new"]): ("SHIFT", 30), + (32, G["not"]): ("SHIFT", 36), + (32, G["case"]): ("SHIFT", 29), + (32, G["false"]): ("SHIFT", 34), + (32, G["let"]): ("SHIFT", 22), + (32, G["isvoid"]): ("SHIFT", 32), + (32, G["if"]): ("SHIFT", 20), + (32, G["~"]): ("SHIFT", 35), + (32, G["while"]): ("SHIFT", 21), + (32, G["string"]): ("SHIFT", 17), + (32, G["true"]): ("SHIFT", 33), + (32, G["integer"]): ("SHIFT", 18), + (33, G["loop"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), + (33, G["pool"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), + (33, G["in"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), + (33, G["of"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), + (33, G["+"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), + (33, G["-"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), + (33, G["*"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), + (33, G["/"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), + (33, G["<"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), + (33, G["<="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), + (33, G["="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), + (33, G["}"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), + (33, G[")"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), + (33, G[","]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), + (33, G["."]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), + (33, G["@"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), + (33, G[";"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), + (33, G["then"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), + (33, G["else"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), + (33, G["fi"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), + (34, G["loop"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), + (34, G["pool"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), + (34, G["in"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), + (34, G["of"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), + (34, G["+"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), + (34, G["-"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), + (34, G["*"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), + (34, G["/"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), + (34, G["<"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), + (34, G["<="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), + (34, G["="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), + (34, G["}"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), + (34, G[")"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), + (34, G[","]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), + (34, G["."]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), + (34, G["@"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), + (34, G[";"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), + (34, G["then"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), + (34, G["else"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), + (34, G["fi"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), + (35, G["id"]): ("SHIFT", 15), + (35, G["{"]): ("SHIFT", 19), + (35, G["new"]): ("SHIFT", 30), + (35, G["not"]): ("SHIFT", 36), + (35, G["case"]): ("SHIFT", 29), + (35, G["false"]): ("SHIFT", 34), + (35, G["let"]): ("SHIFT", 22), + (35, G["isvoid"]): ("SHIFT", 32), + (35, G["if"]): ("SHIFT", 20), + (35, G["~"]): ("SHIFT", 35), + (35, G["while"]): ("SHIFT", 21), + (35, G["string"]): ("SHIFT", 17), + (35, G["true"]): ("SHIFT", 33), + (35, G["integer"]): ("SHIFT", 18), + (36, G["id"]): ("SHIFT", 15), + (36, G["{"]): ("SHIFT", 19), + (36, G["new"]): ("SHIFT", 30), + (36, G["not"]): ("SHIFT", 36), + (36, G["case"]): ("SHIFT", 29), + (36, G["false"]): ("SHIFT", 34), + (36, G["let"]): ("SHIFT", 22), + (36, G["isvoid"]): ("SHIFT", 32), + (36, G["if"]): ("SHIFT", 20), + (36, G["~"]): ("SHIFT", 35), + (36, G["while"]): ("SHIFT", 21), + (36, G["string"]): ("SHIFT", 17), + (36, G["true"]): ("SHIFT", 33), + (36, G["integer"]): ("SHIFT", 18), + (37, G["loop"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), + (37, G["pool"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), + (37, G["in"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), + (37, G["of"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), + (37, G["+"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), + (37, G["-"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), + (37, G["*"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), + (37, G["/"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), + (37, G["<"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), + (37, G["<="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), + (37, G["="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), + (37, G["}"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), + (37, G[")"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), + (37, G[","]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), + (37, G["."]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), + (37, G["@"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), + (37, G[";"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), + (37, G["then"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), + (37, G["else"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), + (37, G["fi"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), + (38, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: None])), + (38, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: None])), + (38, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: None])), + (38, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: None])), + (38, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: None])), + (38, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: None])), + (38, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: None])), + (38, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: None])), + (38, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: None])), + (38, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: None])), + (38, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: None])), + (39, G["<="]): ("SHIFT", 69), + (39, G["="]): ("SHIFT", 71), + (39, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: None])), + (39, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: None])), + (39, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: None])), + (39, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: None])), + (39, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: None])), + (39, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: None])), + (39, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: None])), + (39, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: None])), + (39, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: None])), + (39, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: None])), + (39, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: None])), + (39, G["<"]): ("SHIFT", 40), + (40, G["integer"]): ("SHIFT", 18), + (40, G["new"]): ("SHIFT", 30), + (40, G["id"]): ("SHIFT", 41), + (40, G["false"]): ("SHIFT", 34), + (40, G["string"]): ("SHIFT", 17), + (40, G["true"]): ("SHIFT", 33), + (41, G["("]): ("SHIFT", 16), + (41, G["loop"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (41, G["pool"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (41, G["in"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (41, G["of"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (41, G["+"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (41, G["-"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (41, G["*"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (41, G["/"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (41, G["<"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (41, G["<="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (41, G["="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (41, G["}"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (41, G[")"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (41, G[","]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (41, G["."]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (41, G["@"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (41, G[";"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (41, G["then"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (41, G["else"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (41, G["fi"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), + (42, G["-"]): ("SHIFT", 56), + (42, G["<="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: None])), + (42, G["="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: None])), + (42, G["loop"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: None])), + (42, G["}"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: None])), + (42, G["fi"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: None])), + (42, G["pool"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: None])), + (42, G[")"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: None])), + (42, G["in"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: None])), + (42, G[","]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: None])), + (42, G["then"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: None])), + (42, G["else"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: None])), + (42, G["of"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: None])), + (42, G["<"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: None])), + (42, G[";"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: None])), + (42, G["+"]): ("SHIFT", 43), + (43, G["id"]): ("SHIFT", 41), + (43, G["false"]): ("SHIFT", 34), + (43, G["new"]): ("SHIFT", 30), + (43, G["string"]): ("SHIFT", 17), + (43, G["true"]): ("SHIFT", 33), + (43, G["integer"]): ("SHIFT", 18), + (44, G["<="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), + (44, G["="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), + (44, G["loop"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), + (44, G["}"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), + (44, G["fi"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), + (44, G["pool"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), + (44, G[")"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), + (44, G["+"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), + (44, G["in"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), + (44, G[","]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), + (44, G["-"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), + (44, G["then"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), + (44, G["else"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), + (44, G["of"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), + (44, G["<"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), + (44, G[";"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), + (44, G["/"]): ("SHIFT", 58), + (44, G["*"]): ("SHIFT", 45), + (45, G["id"]): ("SHIFT", 41), + (45, G["false"]): ("SHIFT", 34), + (45, G["new"]): ("SHIFT", 30), + (45, G["string"]): ("SHIFT", 17), + (45, G["true"]): ("SHIFT", 33), + (45, G["integer"]): ("SHIFT", 18), + (46, G["."]): ("SHIFT", 47), + (46, G["<="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), + (46, G["="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), + (46, G["loop"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), + (46, G["}"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), + (46, G["fi"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), + (46, G["pool"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), + (46, G[")"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), + (46, G["+"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), + (46, G["in"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), + (46, G[","]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), + (46, G["-"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), + (46, G["then"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), + (46, G["*"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), + (46, G["of"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), + (46, G["else"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), + (46, G["/"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), + (46, G["<"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), + (46, G[";"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), + (46, G["@"]): ("SHIFT", 60), + (47, G["id"]): ("SHIFT", 48), + (48, G["("]): ("SHIFT", 49), + (49, G["isvoid"]): ("SHIFT", 32), + (49, G["not"]): ("SHIFT", 36), + (49, G["{"]): ("SHIFT", 19), + (49, G["integer"]): ("SHIFT", 18), + (49, G["let"]): ("SHIFT", 22), + (49, G["case"]): ("SHIFT", 29), + (49, G["string"]): ("SHIFT", 17), + (49, G["id"]): ("SHIFT", 15), + (49, G["false"]): ("SHIFT", 34), + (49, G["while"]): ("SHIFT", 21), + (49, G["new"]): ("SHIFT", 30), + (49, G["if"]): ("SHIFT", 20), + (49, G["true"]): ("SHIFT", 33), + (49, G["~"]): ("SHIFT", 35), + (50, G[")"]): ("SHIFT", 51), + (51, G["loop"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (51, G["pool"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (51, G["in"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (51, G["of"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (51, G["+"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (51, G["-"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (51, G["*"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (51, G["/"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (51, G["<"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (51, G["<="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (51, G["="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (51, G["}"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (51, G[")"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (51, G[","]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (51, G["."]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (51, G["@"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (51, G[";"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (51, G["then"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (51, G["else"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (51, G["fi"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (52, G[")"]): ("REDUCE", AttributeProduction(G["expr-list"], Sentence(G["expr"]), [lambda s: None])), + (52, G[","]): ("SHIFT", 53), + (53, G["isvoid"]): ("SHIFT", 32), + (53, G["not"]): ("SHIFT", 36), + (53, G["{"]): ("SHIFT", 19), + (53, G["integer"]): ("SHIFT", 18), + (53, G["let"]): ("SHIFT", 22), + (53, G["case"]): ("SHIFT", 29), + (53, G["string"]): ("SHIFT", 17), + (53, G["id"]): ("SHIFT", 15), + (53, G["false"]): ("SHIFT", 34), + (53, G["while"]): ("SHIFT", 21), + (53, G["new"]): ("SHIFT", 30), + (53, G["if"]): ("SHIFT", 20), + (53, G["true"]): ("SHIFT", 33), + (53, G["~"]): ("SHIFT", 35), + (54, G[")"]): ("REDUCE", AttributeProduction(G["expr-list"], Sentence(G["expr"], G[","], G["expr-list"]), [lambda s: None])), + (55, G["<="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: None])), + (55, G["="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: None])), + (55, G["loop"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: None])), + (55, G["}"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: None])), + (55, G["pool"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: None])), + (55, G[")"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: None])), + (55, G["in"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: None])), + (55, G[","]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: None])), + (55, G["then"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: None])), + (55, G["else"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: None])), + (55, G["of"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: None])), + (55, G["fi"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: None])), + (55, G["<"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: None])), + (55, G[";"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: None])), + (55, G["-"]): ("SHIFT", 56), + (55, G["+"]): ("SHIFT", 43), + (56, G["id"]): ("SHIFT", 41), + (56, G["false"]): ("SHIFT", 34), + (56, G["new"]): ("SHIFT", 30), + (56, G["string"]): ("SHIFT", 17), + (56, G["true"]): ("SHIFT", 33), + (56, G["integer"]): ("SHIFT", 18), + (57, G["/"]): ("SHIFT", 58), + (57, G["<="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), + (57, G["="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), + (57, G["loop"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), + (57, G["}"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), + (57, G["fi"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), + (57, G["pool"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), + (57, G[")"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), + (57, G["+"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), + (57, G["in"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), + (57, G[","]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), + (57, G["-"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), + (57, G["then"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), + (57, G["else"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), + (57, G["of"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), + (57, G["<"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), + (57, G[";"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), + (57, G["*"]): ("SHIFT", 45), + (58, G["id"]): ("SHIFT", 41), + (58, G["false"]): ("SHIFT", 34), + (58, G["new"]): ("SHIFT", 30), + (58, G["string"]): ("SHIFT", 17), + (58, G["true"]): ("SHIFT", 33), + (58, G["integer"]): ("SHIFT", 18), + (59, G["<="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), + (59, G["="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), + (59, G["loop"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), + (59, G["}"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), + (59, G["fi"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), + (59, G["pool"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), + (59, G[")"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), + (59, G["+"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), + (59, G["in"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), + (59, G[","]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), + (59, G["-"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), + (59, G["then"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), + (59, G["*"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), + (59, G["of"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), + (59, G["else"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), + (59, G["/"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), + (59, G["<"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), + (59, G[";"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), + (59, G["."]): ("SHIFT", 47), + (59, G["@"]): ("SHIFT", 60), + (60, G["type"]): ("SHIFT", 61), + (61, G["."]): ("SHIFT", 62), + (62, G["id"]): ("SHIFT", 63), + (63, G["("]): ("SHIFT", 64), + (64, G["isvoid"]): ("SHIFT", 32), + (64, G["not"]): ("SHIFT", 36), + (64, G["{"]): ("SHIFT", 19), + (64, G["integer"]): ("SHIFT", 18), + (64, G["let"]): ("SHIFT", 22), + (64, G["case"]): ("SHIFT", 29), + (64, G["string"]): ("SHIFT", 17), + (64, G["id"]): ("SHIFT", 15), + (64, G["false"]): ("SHIFT", 34), + (64, G["while"]): ("SHIFT", 21), + (64, G["new"]): ("SHIFT", 30), + (64, G["if"]): ("SHIFT", 20), + (64, G["true"]): ("SHIFT", 33), + (64, G["~"]): ("SHIFT", 35), + (65, G[")"]): ("SHIFT", 66), + (66, G["loop"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (66, G["pool"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (66, G["in"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (66, G["of"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (66, G["+"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (66, G["-"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (66, G["*"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (66, G["/"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (66, G["<"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (66, G["<="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (66, G["="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (66, G["}"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (66, G[")"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (66, G[","]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (66, G["."]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (66, G["@"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (66, G[";"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (66, G["then"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (66, G["else"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (66, G["fi"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (67, G["/"]): ("SHIFT", 58), + (67, G["<="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), + (67, G["="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), + (67, G["loop"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), + (67, G["}"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), + (67, G["fi"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), + (67, G["pool"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), + (67, G[")"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), + (67, G["+"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), + (67, G["in"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), + (67, G[","]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), + (67, G["-"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), + (67, G["then"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), + (67, G["else"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), + (67, G["of"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), + (67, G["<"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), + (67, G[";"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), + (67, G["*"]): ("SHIFT", 45), + (68, G["@"]): ("SHIFT", 60), + (68, G["."]): ("SHIFT", 47), + (68, G["<="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), + (68, G["="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), + (68, G["loop"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), + (68, G["}"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), + (68, G["fi"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), + (68, G["pool"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), + (68, G[")"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), + (68, G["+"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), + (68, G[","]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), + (68, G["in"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), + (68, G["-"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), + (68, G["then"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), + (68, G["*"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), + (68, G["of"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), + (68, G["else"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), + (68, G["/"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), + (68, G["<"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), + (68, G[";"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), + (69, G["integer"]): ("SHIFT", 18), + (69, G["new"]): ("SHIFT", 30), + (69, G["id"]): ("SHIFT", 41), + (69, G["false"]): ("SHIFT", 34), + (69, G["string"]): ("SHIFT", 17), + (69, G["true"]): ("SHIFT", 33), + (70, G["-"]): ("SHIFT", 56), + (70, G["+"]): ("SHIFT", 43), + (70, G["<="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: None])), + (70, G["="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: None])), + (70, G["loop"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: None])), + (70, G["}"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: None])), + (70, G["fi"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: None])), + (70, G["pool"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: None])), + (70, G[")"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: None])), + (70, G["in"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: None])), + (70, G[","]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: None])), + (70, G["then"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: None])), + (70, G["else"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: None])), + (70, G["of"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: None])), + (70, G["<"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: None])), + (70, G[";"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: None])), + (71, G["integer"]): ("SHIFT", 18), + (71, G["new"]): ("SHIFT", 30), + (71, G["id"]): ("SHIFT", 41), + (71, G["false"]): ("SHIFT", 34), + (71, G["string"]): ("SHIFT", 17), + (71, G["true"]): ("SHIFT", 33), + (72, G["<="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: None])), + (72, G["="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: None])), + (72, G["loop"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: None])), + (72, G["}"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: None])), + (72, G["fi"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: None])), + (72, G["pool"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: None])), + (72, G[")"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: None])), + (72, G["in"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: None])), + (72, G[","]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: None])), + (72, G["then"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: None])), + (72, G["else"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: None])), + (72, G["of"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: None])), + (72, G["<"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: None])), + (72, G[";"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: None])), + (72, G["-"]): ("SHIFT", 56), + (72, G["+"]): ("SHIFT", 43), + (73, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["~"], G["expr"]), [lambda s: None])), + (73, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["~"], G["expr"]), [lambda s: None])), + (73, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["~"], G["expr"]), [lambda s: None])), + (73, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["~"], G["expr"]), [lambda s: None])), + (73, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["~"], G["expr"]), [lambda s: None])), + (73, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["~"], G["expr"]), [lambda s: None])), + (73, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["~"], G["expr"]), [lambda s: None])), + (73, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["~"], G["expr"]), [lambda s: None])), + (73, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["~"], G["expr"]), [lambda s: None])), + (73, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["~"], G["expr"]), [lambda s: None])), + (73, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["~"], G["expr"]), [lambda s: None])), + (74, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["isvoid"], G["expr"]), [lambda s: None])), + (74, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["isvoid"], G["expr"]), [lambda s: None])), + (74, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["isvoid"], G["expr"]), [lambda s: None])), + (74, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["isvoid"], G["expr"]), [lambda s: None])), + (74, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["isvoid"], G["expr"]), [lambda s: None])), + (74, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["isvoid"], G["expr"]), [lambda s: None])), + (74, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["isvoid"], G["expr"]), [lambda s: None])), + (74, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["isvoid"], G["expr"]), [lambda s: None])), + (74, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["isvoid"], G["expr"]), [lambda s: None])), + (74, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["isvoid"], G["expr"]), [lambda s: None])), + (74, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["isvoid"], G["expr"]), [lambda s: None])), + (75, G["of"]): ("SHIFT", 76), + (76, G["id"]): ("SHIFT", 77), + (77, G[":"]): ("SHIFT", 78), + (78, G["type"]): ("SHIFT", 79), + (79, G["=>"]): ("SHIFT", 80), + (80, G["not"]): ("SHIFT", 36), + (80, G["id"]): ("SHIFT", 15), + (80, G["integer"]): ("SHIFT", 18), + (80, G["case"]): ("SHIFT", 29), + (80, G["let"]): ("SHIFT", 22), + (80, G["isvoid"]): ("SHIFT", 32), + (80, G["if"]): ("SHIFT", 20), + (80, G["string"]): ("SHIFT", 17), + (80, G["~"]): ("SHIFT", 35), + (80, G["while"]): ("SHIFT", 21), + (80, G["false"]): ("SHIFT", 34), + (80, G["{"]): ("SHIFT", 19), + (80, G["new"]): ("SHIFT", 30), + (80, G["true"]): ("SHIFT", 33), + (81, G[";"]): ("SHIFT", 82), + (82, G["id"]): ("REDUCE", AttributeProduction(G["case-list"], Sentence(G["id"], G[":"], G["type"], G["=>"], G["expr"], G[";"]), [lambda s: None])), + (82, G["esac"]): ("REDUCE", AttributeProduction(G["case-list"], Sentence(G["id"], G[":"], G["type"], G["=>"], G["expr"], G[";"]), [lambda s: None])), + (83, G["id"]): ("SHIFT", 84), + (83, G["esac"]): ("SHIFT", 90), + (84, G[":"]): ("SHIFT", 85), + (85, G["type"]): ("SHIFT", 86), + (86, G["=>"]): ("SHIFT", 87), + (87, G["not"]): ("SHIFT", 36), + (87, G["id"]): ("SHIFT", 15), + (87, G["integer"]): ("SHIFT", 18), + (87, G["case"]): ("SHIFT", 29), + (87, G["let"]): ("SHIFT", 22), + (87, G["isvoid"]): ("SHIFT", 32), + (87, G["if"]): ("SHIFT", 20), + (87, G["string"]): ("SHIFT", 17), + (87, G["~"]): ("SHIFT", 35), + (87, G["while"]): ("SHIFT", 21), + (87, G["false"]): ("SHIFT", 34), + (87, G["{"]): ("SHIFT", 19), + (87, G["new"]): ("SHIFT", 30), + (87, G["true"]): ("SHIFT", 33), + (88, G[";"]): ("SHIFT", 89), + (89, G["id"]): ("REDUCE", AttributeProduction(G["case-list"], Sentence(G["case-list"], G["id"], G[":"], G["type"], G["=>"], G["expr"], G[";"]), [lambda s: None])), + (89, G["esac"]): ("REDUCE", AttributeProduction(G["case-list"], Sentence(G["case-list"], G["id"], G[":"], G["type"], G["=>"], G["expr"], G[";"]), [lambda s: None])), + (90, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: None])), + (90, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: None])), + (90, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: None])), + (90, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: None])), + (90, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: None])), + (90, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: None])), + (90, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: None])), + (90, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: None])), + (90, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: None])), + (90, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: None])), + (90, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: None])), + (91, G["in"]): ("REDUCE", AttributeProduction(G["declaration-list"], Sentence(G["id"], G[":"], G["type"], G["<-"], G["expr"]), [lambda s: None])), + (92, G["in"]): ("SHIFT", 93), + (93, G["id"]): ("SHIFT", 15), + (93, G["{"]): ("SHIFT", 19), + (93, G["new"]): ("SHIFT", 30), + (93, G["not"]): ("SHIFT", 36), + (93, G["case"]): ("SHIFT", 29), + (93, G["false"]): ("SHIFT", 34), + (93, G["let"]): ("SHIFT", 22), + (93, G["isvoid"]): ("SHIFT", 32), + (93, G["if"]): ("SHIFT", 20), + (93, G["~"]): ("SHIFT", 35), + (93, G["while"]): ("SHIFT", 21), + (93, G["string"]): ("SHIFT", 17), + (93, G["true"]): ("SHIFT", 33), + (93, G["integer"]): ("SHIFT", 18), + (94, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: None])), + (94, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: None])), + (94, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: None])), + (94, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: None])), + (94, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: None])), + (94, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: None])), + (94, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: None])), + (94, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: None])), + (94, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: None])), + (94, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: None])), + (94, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: None])), + (95, G["loop"]): ("SHIFT", 96), + (96, G["false"]): ("SHIFT", 34), + (96, G["id"]): ("SHIFT", 15), + (96, G["{"]): ("SHIFT", 19), + (96, G["new"]): ("SHIFT", 30), + (96, G["true"]): ("SHIFT", 33), + (96, G["not"]): ("SHIFT", 36), + (96, G["integer"]): ("SHIFT", 18), + (96, G["case"]): ("SHIFT", 29), + (96, G["let"]): ("SHIFT", 22), + (96, G["isvoid"]): ("SHIFT", 32), + (96, G["if"]): ("SHIFT", 20), + (96, G["string"]): ("SHIFT", 17), + (96, G["~"]): ("SHIFT", 35), + (96, G["while"]): ("SHIFT", 21), + (97, G["pool"]): ("SHIFT", 98), + (98, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: None])), + (98, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: None])), + (98, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: None])), + (98, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: None])), + (98, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: None])), + (98, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: None])), + (98, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: None])), + (98, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: None])), + (98, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: None])), + (98, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: None])), + (98, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: None])), + (99, G["then"]): ("SHIFT", 100), + (100, G["integer"]): ("SHIFT", 18), + (100, G["id"]): ("SHIFT", 15), + (100, G["let"]): ("SHIFT", 22), + (100, G["isvoid"]): ("SHIFT", 32), + (100, G["if"]): ("SHIFT", 20), + (100, G["~"]): ("SHIFT", 35), + (100, G["string"]): ("SHIFT", 17), + (100, G["case"]): ("SHIFT", 29), + (100, G["{"]): ("SHIFT", 19), + (100, G["false"]): ("SHIFT", 34), + (100, G["while"]): ("SHIFT", 21), + (100, G["new"]): ("SHIFT", 30), + (100, G["not"]): ("SHIFT", 36), + (100, G["true"]): ("SHIFT", 33), + (101, G["else"]): ("SHIFT", 102), + (102, G["new"]): ("SHIFT", 30), + (102, G["while"]): ("SHIFT", 21), + (102, G["id"]): ("SHIFT", 15), + (102, G["integer"]): ("SHIFT", 18), + (102, G["not"]): ("SHIFT", 36), + (102, G["true"]): ("SHIFT", 33), + (102, G["if"]): ("SHIFT", 20), + (102, G["~"]): ("SHIFT", 35), + (102, G["string"]): ("SHIFT", 17), + (102, G["let"]): ("SHIFT", 22), + (102, G["isvoid"]): ("SHIFT", 32), + (102, G["case"]): ("SHIFT", 29), + (102, G["{"]): ("SHIFT", 19), + (102, G["false"]): ("SHIFT", 34), + (103, G["fi"]): ("SHIFT", 104), + (104, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: None])), + (104, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: None])), + (104, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: None])), + (104, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: None])), + (104, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: None])), + (104, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: None])), + (104, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: None])), + (104, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: None])), + (104, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: None])), + (104, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: None])), + (104, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: None])), + (105, G["}"]): ("SHIFT", 106), + (106, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: None])), + (106, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: None])), + (106, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: None])), + (106, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: None])), + (106, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: None])), + (106, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: None])), + (106, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: None])), + (106, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: None])), + (106, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: None])), + (106, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: None])), + (106, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: None])), + (107, G[";"]): ("SHIFT", 108), + (108, G["id"]): ("SHIFT", 15), + (108, G["case"]): ("SHIFT", 29), + (108, G["isvoid"]): ("SHIFT", 32), + (108, G["string"]): ("SHIFT", 17), + (108, G["true"]): ("SHIFT", 33), + (108, G["not"]): ("SHIFT", 36), + (108, G["integer"]): ("SHIFT", 18), + (108, G["let"]): ("SHIFT", 22), + (108, G["if"]): ("SHIFT", 20), + (108, G["~"]): ("SHIFT", 35), + (108, G["while"]): ("SHIFT", 21), + (108, G["false"]): ("SHIFT", 34), + (108, G["{"]): ("SHIFT", 19), + (108, G["}"]): ("REDUCE", AttributeProduction(G["block"], Sentence(G["expr"], G[";"]), [lambda s: None])), + (108, G["new"]): ("SHIFT", 30), + (109, G["}"]): ("REDUCE", AttributeProduction(G["block"], Sentence(G["expr"], G[";"], G["block"]), [lambda s: None])), + (110, G[")"]): ("SHIFT", 111), + (111, G["loop"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (111, G["pool"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (111, G["in"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (111, G["of"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (111, G["+"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (111, G["-"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (111, G["*"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (111, G["/"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (111, G["<"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (111, G["<="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (111, G["="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (111, G["}"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (111, G[")"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (111, G[","]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (111, G["."]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (111, G["@"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (111, G[";"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (111, G["then"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (111, G["else"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (111, G["fi"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), + (112, G["id"]): ("SHIFT", 15), + (112, G["{"]): ("SHIFT", 19), + (112, G["new"]): ("SHIFT", 30), + (112, G["not"]): ("SHIFT", 36), + (112, G["case"]): ("SHIFT", 29), + (112, G["false"]): ("SHIFT", 34), + (112, G["let"]): ("SHIFT", 22), + (112, G["isvoid"]): ("SHIFT", 32), + (112, G["if"]): ("SHIFT", 20), + (112, G["~"]): ("SHIFT", 35), + (112, G["while"]): ("SHIFT", 21), + (112, G["string"]): ("SHIFT", 17), + (112, G["true"]): ("SHIFT", 33), + (112, G["integer"]): ("SHIFT", 18), + (113, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: None])), + (113, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: None])), + (113, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: None])), + (113, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: None])), + (113, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: None])), + (113, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: None])), + (113, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: None])), + (113, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: None])), + (113, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: None])), + (113, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: None])), + (113, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: None])), + (114, G["}"]): ("SHIFT", 115), + (115, G[";"]): ("REDUCE", AttributeProduction(G["method"], Sentence(G["id"], G["("], G[")"], G[":"], G["type"], G["{"], G["expr"], G["}"]), [lambda s: None])), + (116, G[")"]): ("SHIFT", 117), + (117, G[":"]): ("SHIFT", 118), + (118, G["type"]): ("SHIFT", 119), + (119, G["{"]): ("SHIFT", 120), + (120, G["let"]): ("SHIFT", 22), + (120, G["true"]): ("SHIFT", 33), + (120, G["case"]): ("SHIFT", 29), + (120, G["new"]): ("SHIFT", 30), + (120, G["id"]): ("SHIFT", 15), + (120, G["~"]): ("SHIFT", 35), + (120, G["isvoid"]): ("SHIFT", 32), + (120, G["false"]): ("SHIFT", 34), + (120, G["not"]): ("SHIFT", 36), + (120, G["{"]): ("SHIFT", 19), + (120, G["string"]): ("SHIFT", 17), + (120, G["integer"]): ("SHIFT", 18), + (120, G["while"]): ("SHIFT", 21), + (120, G["if"]): ("SHIFT", 20), + (121, G["}"]): ("SHIFT", 122), + (122, G[";"]): ("REDUCE", AttributeProduction(G["method"], Sentence(G["id"], G["("], G["param-list"], G[")"], G[":"], G["type"], G["{"], G["expr"], G["}"]), [lambda s: None])), + (123, G["type"]): ("SHIFT", 124), + (124, G["<-"]): ("SHIFT", 125), + (124, G[";"]): ("REDUCE", AttributeProduction(G["attribute"], Sentence(G["id"], G[":"], G["type"]), [lambda s: None])), + (125, G["not"]): ("SHIFT", 36), + (125, G["id"]): ("SHIFT", 15), + (125, G["integer"]): ("SHIFT", 18), + (125, G["case"]): ("SHIFT", 29), + (125, G["let"]): ("SHIFT", 22), + (125, G["isvoid"]): ("SHIFT", 32), + (125, G["if"]): ("SHIFT", 20), + (125, G["string"]): ("SHIFT", 17), + (125, G["~"]): ("SHIFT", 35), + (125, G["while"]): ("SHIFT", 21), + (125, G["false"]): ("SHIFT", 34), + (125, G["{"]): ("SHIFT", 19), + (125, G["new"]): ("SHIFT", 30), + (125, G["true"]): ("SHIFT", 33), + (126, G[";"]): ("REDUCE", AttributeProduction(G["attribute"], Sentence(G["id"], G[":"], G["type"], G["<-"], G["expr"]), [lambda s: None])), + (127, G["}"]): ("SHIFT", 128), + (128, G["class"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["{"], G["feature-list"], G["}"]), [lambda s: None])), + (128, G["$"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["{"], G["feature-list"], G["}"]), [lambda s: None])), + (129, G[";"]): ("SHIFT", 130), + (130, G["id"]): ("SHIFT", 4), + (130, G["}"]): ("REDUCE", AttributeProduction(G["feature-list"], Sentence(G["attribute"], G[";"]), [lambda s: None])), + (131, G["}"]): ("REDUCE", AttributeProduction(G["feature-list"], Sentence(G["attribute"], G[";"], G["feature-list"]), [lambda s: None])), + (132, G[";"]): ("SHIFT", 133), + (133, G["id"]): ("SHIFT", 4), + (133, G["}"]): ("REDUCE", AttributeProduction(G["feature-list"], Sentence(G["method"], G[";"]), [lambda s: None])), + (134, G["}"]): ("REDUCE", AttributeProduction(G["feature-list"], Sentence(G["method"], G[";"], G["feature-list"]), [lambda s: None])), + (135, G["type"]): ("SHIFT", 136), + (136, G["{"]): ("SHIFT", 137), + (137, G["id"]): ("SHIFT", 4), + (138, G["}"]): ("SHIFT", 139), + (139, G["class"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["inherits"], G["type"], G["{"], G["feature-list"], G["}"]), [lambda s: None])), + (139, G["$"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["inherits"], G["type"], G["{"], G["feature-list"], G["}"]), [lambda s: None])), + (140, G["$"]): ("OK", None), + (141, G["$"]): ("REDUCE", AttributeProduction(G["program"], Sentence(G["class-set"]), [lambda s: None])), + (142, G["class"]): ("SHIFT", 1), + (142, G["$"]): ("REDUCE", AttributeProduction(G["class-set"], Sentence(G["class-def"]), [lambda s: None])), + (143, G["$"]): ("REDUCE", AttributeProduction(G["class-set"], Sentence(G["class-def"], G["class-set"]), [lambda s: None])), + } + + def __goto_table(self): + G = self.G + return { + (0, G["class-def"]): 142, + (0, G["program"]): 140, + (0, G["class-set"]): 141, + (3, G["method"]): 132, + (3, G["feature-list"]): 127, + (3, G["attribute"]): 129, + (5, G["param-list"]): 116, + (9, G["param-list"]): 10, + (14, G["arith"]): 55, + (14, G["comp"]): 39, + (14, G["term"]): 67, + (14, G["function-call"]): 37, + (14, G["factor"]): 68, + (14, G["expr"]): 114, + (16, G["comp"]): 39, + (16, G["expr-list"]): 110, + (16, G["term"]): 67, + (16, G["function-call"]): 37, + (16, G["expr"]): 52, + (16, G["factor"]): 68, + (16, G["arith"]): 55, + (19, G["block"]): 105, + (19, G["term"]): 67, + (19, G["arith"]): 55, + (19, G["expr"]): 107, + (19, G["function-call"]): 37, + (19, G["comp"]): 39, + (19, G["factor"]): 68, + (20, G["term"]): 67, + (20, G["arith"]): 55, + (20, G["factor"]): 68, + (20, G["expr"]): 99, + (20, G["comp"]): 39, + (20, G["function-call"]): 37, + (21, G["comp"]): 39, + (21, G["factor"]): 68, + (21, G["arith"]): 55, + (21, G["expr"]): 95, + (21, G["term"]): 67, + (21, G["function-call"]): 37, + (22, G["declaration-list"]): 92, + (26, G["declaration-list"]): 27, + (28, G["term"]): 67, + (28, G["arith"]): 55, + (28, G["factor"]): 68, + (28, G["comp"]): 39, + (28, G["function-call"]): 37, + (28, G["expr"]): 91, + (29, G["expr"]): 75, + (29, G["factor"]): 68, + (29, G["comp"]): 39, + (29, G["function-call"]): 37, + (29, G["term"]): 67, + (29, G["arith"]): 55, + (32, G["arith"]): 55, + (32, G["comp"]): 39, + (32, G["term"]): 67, + (32, G["expr"]): 74, + (32, G["function-call"]): 37, + (32, G["factor"]): 68, + (35, G["arith"]): 55, + (35, G["comp"]): 39, + (35, G["term"]): 67, + (35, G["function-call"]): 37, + (35, G["factor"]): 68, + (35, G["expr"]): 73, + (36, G["arith"]): 55, + (36, G["comp"]): 39, + (36, G["term"]): 67, + (36, G["function-call"]): 37, + (36, G["expr"]): 38, + (36, G["factor"]): 68, + (40, G["arith"]): 42, + (40, G["term"]): 67, + (40, G["function-call"]): 37, + (40, G["factor"]): 68, + (43, G["function-call"]): 37, + (43, G["term"]): 44, + (43, G["factor"]): 68, + (45, G["function-call"]): 37, + (45, G["factor"]): 46, + (49, G["comp"]): 39, + (49, G["term"]): 67, + (49, G["function-call"]): 37, + (49, G["expr"]): 52, + (49, G["factor"]): 68, + (49, G["arith"]): 55, + (49, G["expr-list"]): 50, + (53, G["comp"]): 39, + (53, G["term"]): 67, + (53, G["function-call"]): 37, + (53, G["expr"]): 52, + (53, G["arith"]): 55, + (53, G["factor"]): 68, + (53, G["expr-list"]): 54, + (56, G["term"]): 57, + (56, G["function-call"]): 37, + (56, G["factor"]): 68, + (58, G["factor"]): 59, + (58, G["function-call"]): 37, + (64, G["comp"]): 39, + (64, G["term"]): 67, + (64, G["function-call"]): 37, + (64, G["expr"]): 52, + (64, G["factor"]): 68, + (64, G["expr-list"]): 65, + (64, G["arith"]): 55, + (69, G["arith"]): 70, + (69, G["term"]): 67, + (69, G["function-call"]): 37, + (69, G["factor"]): 68, + (71, G["arith"]): 72, + (71, G["term"]): 67, + (71, G["function-call"]): 37, + (71, G["factor"]): 68, + (76, G["case-list"]): 83, + (80, G["factor"]): 68, + (80, G["arith"]): 55, + (80, G["term"]): 67, + (80, G["expr"]): 81, + (80, G["comp"]): 39, + (80, G["function-call"]): 37, + (87, G["factor"]): 68, + (87, G["arith"]): 55, + (87, G["term"]): 67, + (87, G["comp"]): 39, + (87, G["function-call"]): 37, + (87, G["expr"]): 88, + (93, G["arith"]): 55, + (93, G["comp"]): 39, + (93, G["term"]): 67, + (93, G["function-call"]): 37, + (93, G["expr"]): 94, + (93, G["factor"]): 68, + (96, G["arith"]): 55, + (96, G["comp"]): 39, + (96, G["term"]): 67, + (96, G["function-call"]): 37, + (96, G["factor"]): 68, + (96, G["expr"]): 97, + (100, G["arith"]): 55, + (100, G["factor"]): 68, + (100, G["term"]): 67, + (100, G["comp"]): 39, + (100, G["expr"]): 101, + (100, G["function-call"]): 37, + (102, G["comp"]): 39, + (102, G["arith"]): 55, + (102, G["function-call"]): 37, + (102, G["term"]): 67, + (102, G["factor"]): 68, + (102, G["expr"]): 103, + (108, G["term"]): 67, + (108, G["arith"]): 55, + (108, G["block"]): 109, + (108, G["expr"]): 107, + (108, G["function-call"]): 37, + (108, G["comp"]): 39, + (108, G["factor"]): 68, + (112, G["arith"]): 55, + (112, G["comp"]): 39, + (112, G["term"]): 67, + (112, G["function-call"]): 37, + (112, G["factor"]): 68, + (112, G["expr"]): 113, + (120, G["arith"]): 55, + (120, G["comp"]): 39, + (120, G["term"]): 67, + (120, G["function-call"]): 37, + (120, G["expr"]): 121, + (120, G["factor"]): 68, + (125, G["factor"]): 68, + (125, G["arith"]): 55, + (125, G["term"]): 67, + (125, G["comp"]): 39, + (125, G["function-call"]): 37, + (125, G["expr"]): 126, + (130, G["feature-list"]): 131, + (130, G["method"]): 132, + (130, G["attribute"]): 129, + (133, G["method"]): 132, + (133, G["attribute"]): 129, + (133, G["feature-list"]): 134, + (137, G["method"]): 132, + (137, G["feature-list"]): 138, + (137, G["attribute"]): 129, + (142, G["class-def"]): 142, + (142, G["class-set"]): 143, + } diff --git a/productions.py b/productions.py deleted file mode 100644 index 5620d5937..000000000 --- a/productions.py +++ /dev/null @@ -1,177 +0,0 @@ -import time - -from cmp.grammalyzer.parsing import LALR1Parser -from terminals import * - -Program %= 'class-set' - -ClassSet %= 'class-def' -ClassSet %= 'class-set class-def' - -ClassDef %= 'class type { feature-list }' -ClassDef %= 'class type inherits type { feature-list }' - -FeatureList %= 'attribute ;' -FeatureList %= 'method ;' -FeatureList %= 'feature-list attribute ;' -FeatureList %= 'feature-list method ;' - -Attribute %= 'id : type' -Attribute %= 'id : type <- expr' - -Method %= 'id ( ) : type { body-expr }' -Method %= 'id ( param-vector ) : type { body-expr }' - -ParamVector %= 'id : type' -ParamVector %= 'param-vector , id : type' - -#################### -# Body-Expressions # -#################### -BodyExpr %= 'id <- expr' -BodyExpr %= '{ block }' -BodyExpr %= 'if expr then body-expr else body-expr fi' -BodyExpr %= 'while expr loop body-expr pool' -BodyExpr %= 'declaration in body-expr' -BodyExpr %= 'case expr of case-list esac' -BodyExpr %= 'expr' -################### -# end # -################### - -#################### -# Body-Expressions # -#################### -Expr %= 'not expr' -Expr %= 'comp-expr' -################### -# end # -################### - -####################### -# Compose-Expressions # -####################### -CompExpr %= 'comp-expr < sub-expr' -CompExpr %= 'comp-expr <= sub-expr' -CompExpr %= 'comp-expr = sub-expr' -CompExpr %= 'sub-expr' -################### -# end # -################### - -################### -# Sub-Expressions # -################### -SubExpr %= 'sub-expr + term' -SubExpr %= 'sub-expr - term' -SubExpr %= 'term' -################### -# end # -################### - -######## -# Term # -######## -Term %= 'term * fact' -Term %= 'term / fact' -Term %= 'fact' -####### -# end # -####### - -########## -# Factor # -########## -Fact %= 'isvoid fact' -Fact %= 'atom' -########## -# end # -########## - -######## -# Atom # -######## -Atom %= '~ atom' -Atom %= 'particle' -################### -# end # -################### - - -############ -# Particle # -############ -Particle %= 'id' -Particle %= 'true' -Particle %= 'false' -Particle %= 'integer' -Particle %= 'string' -Particle %= 'function-call' -Particle %= 'new type' -Particle %= '( expr )' -################### -# end # -################### - - -######### -# Block # -######### -Block %= 'body-expr ;' -Block %= 'block body-expr ;' -######### -# end # -######### - -############### -# Declaration # -############### -Declaration %= 'let id : type' -Declaration %= 'let id : type <- expr' -Declaration %= 'declaration , id : type' -Declaration %= 'declaration , id : type <- expr' -############### -# end # -############### - -############# -# Case-List # -############# -CaseList %= 'id : type => expr ;' -CaseList %= 'case-list id : type => expr ;' -############# -# end # -############# - -################# -# Function-Call # -################# -FunctionCall %= 'id ( expr-vector )' -FunctionCall %= 'particle . id ( expr-vector )' -FunctionCall %= 'particle @ type . id ( expr-vector )' -################# -# end # -################# - - -##################### -# Expression-Vector # -##################### -ExprVector %= 'expr' -ExprVector %= 'expr-vector , expr' -##################### -# end # -##################### - - -if __name__ == "__main__": - print(len(G.Productions)) - for p in G.Productions: - print(repr(p)) - print() - - t = time.time() - parser = LALR1Parser(G) - print('Build Parsing Time :', time.time() - t) - print('Action Entries :', len(parser.action)) - print('Parsing Conflicts :', parser.conflict is not None) diff --git a/productions.txt b/productions.txt deleted file mode 100644 index 16ce929c8..000000000 --- a/productions.txt +++ /dev/null @@ -1,64 +0,0 @@ -59 -program -> class-set -class-set -> class-def -class-set -> class-set class-def -class-def -> class type { feature-list } -class-def -> class type inherits type { feature-list } -feature-list -> attribute ; -feature-list -> method ; -feature-list -> feature-list attribute ; -feature-list -> feature-list method ; -attribute -> id : type -attribute -> id : type <- expr -method -> id ( ) : type { body-expr } -method -> id ( param-vector ) : type { body-expr } -param-vector -> id : type -param-vector -> param-vector , id : type -body-expr -> id <- expr -body-expr -> { block } -body-expr -> if expr then body-expr else body-expr fi -body-expr -> while expr loop body-expr pool -body-expr -> declaration in body-expr -body-expr -> case expr of case-list esac -body-expr -> expr -expr -> not expr -expr -> comp-expr -comp-expr -> comp-expr < sub-expr -comp-expr -> comp-expr <= sub-expr -comp-expr -> comp-expr = sub-expr -comp-expr -> sub-expr -sub-expr -> sub-expr + term -sub-expr -> sub-expr - term -sub-expr -> term -term -> term * fact -term -> term / fact -term -> fact -fact -> isvoid fact -fact -> atom -atom -> ~ atom -atom -> particle -particle -> id -particle -> true -particle -> false -particle -> integer -particle -> string -particle -> function-call -particle -> new type -particle -> ( expr ) -block -> body-expr ; -block -> block body-expr ; -declaration -> let id : type -declaration -> let id : type <- expr -declaration -> declaration , id : type -declaration -> declaration , id : type <- expr -case-list -> id : type => expr ; -case-list -> case-list id : type => expr ; -function-call -> id ( expr-vector ) -function-call -> particle . id ( expr-vector ) -function-call -> particle @ type . id ( expr-vector ) -expr-vector -> expr -expr-vector -> expr-vector , expr - -Build Parsing Time : 5.887415170669556 -Action Entries : 1049 -Parsing Conflicts : False diff --git a/terminals.py b/terminals.py deleted file mode 100644 index 5a5822efe..000000000 --- a/terminals.py +++ /dev/null @@ -1,65 +0,0 @@ -from nonterminals import * - -############### -# identifiers # -############### -identifier = G.Terminals('id') -type_name = G.Terminals('type') - -############### -# Basic Types # -############### -string = G.Terminal('string') -integer = G.Terminal('integer') -boolean = G.Terminal('boolean') - -########### -# Symbols # -########### -open_bracket = G.Terminal('{') -close_bracket = G.Terminal('}') -opar = G.Terminal('(') -cpar = G.Terminal(')') -comma = G.Terminal(',') -dot = G.Terminal('.') -arroba = G.Terminal('@') -two_points = G.Terminal(':') -semi_colon = G.Terminal(';') -left_arrow = G.Terminal('<-') -right_arrow = G.Terminal('=>') - -############ -# KeyWords # -############ -keyword_class = G.Terminal('class') -keyword_inherits = G.Terminal('inherits') -keyword_if = G.Terminal('if') -keyword_then = G.Terminal('then') -keyword_else = G.Terminal('else') -keyword_fi = G.Terminal('fi') -keyword_while = G.Terminal('while') -keyword_loop = G.Terminal('loop') -keyword_pool = G.Terminal('pool') -keyword_let = G.Terminal('let') -keyword_in = G.Terminal('in') -keyword_case = G.Terminal('case') -keyword_esac = G.Terminal('esac') -keyword_of = G.Terminal('of') -keyword_new = G.Terminal('new') -keyword_isvoid = G.Terminal('isvoid') -keyword_true = G.Terminal('true') -keyword_false = G.Terminal('false') -keyword_end = G.Terminal('end') - -############# -# Operators # -############# -plus = G.Terminal('+') -minus = G.Terminal('-') -star = G.Terminal('*') -div = G.Terminal('/') -less = G.Terminal('<') -lesse = G.Terminal('<=') -equal = G.Terminal('=') -complement = G.Terminal('~') -not_op = G.Terminal('not') diff --git a/test.py b/test.py new file mode 100644 index 000000000..797cffef3 --- /dev/null +++ b/test.py @@ -0,0 +1,61 @@ +import os +import inspect +import ast as ast + +from cmp.serializer import LexerSerializer, LRParserSerializer +from definitions import cool_parser, cool_lexer + + +def open_or_create(file): + try: + return open(file, 'x') + except FileExistsError: + return open(file, 'w') + + +class LexerInfo: + def __init__(self, lexer, class_name, file_name): + self.lexer = lexer + self.class_name = class_name + self.file_name = file_name + + +class ParserInfo: + def __init__(self, parser, ast_module, class_name, file_name): + self.parser = parser + self.ast_module = ast_module + self.class_name = class_name + self.file_name = file_name + + +class Modularizer: + def __init__(self, module_name, parser_info=None, lexer_info=None): + self.module_name = module_name + self.parser_info = parser_info + self.lexer_info = lexer_info + + def build(self): + os.makedirs(self.module_name, exist_ok=True) + open_or_create(self.module_name + '/__init__.py') + self.build_module() + self.build_ast() + + def build_ast(self): + f = open_or_create(self.module_name + '/ast.py') + f.write(inspect.getsource(self.parser_info.ast_module)) + f.close() + + def build_module(self): + LRParserSerializer.build(self.parser_info.parser, self.parser_info.class_name, + self.module_name + '/' + self.parser_info.file_name) + + LexerSerializer.build(self.lexer_info.lexer, self.lexer_info.class_name, + self.module_name + '/' + self.lexer_info.file_name) + + +if __name__ == '__main__': + Modularizer( + module_name='coolx', + parser_info=ParserInfo(cool_parser(), ast, 'CoolParser', 'parser.py'), + lexer_info=LexerInfo(cool_lexer(), 'CoolLexer', 'lexer.py') + ).build() From 1bc4ccff345bd2ea54611f94081f70055551ea75 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Fri, 3 Apr 2020 21:30:36 -0400 Subject: [PATCH 004/143] parsea el primer programa de cool : Implementar Scope y Semantic Checker --- MANUAL.md | 2 + ast.py => astnodes.py | 30 +- .../__pycache__/parsing.cpython-37.pyc | Bin 7847 -> 7860 bytes cmp/parsing/parsing.py | 3 +- cmp/serializer/lexer_serializer.py | 7 + cmp/serializer/parser_serializer.py | 2 +- definitions.py | 122 +- lexer.py | 65 +- parser.py | 2367 +++++++++-------- scope.py | 25 + scripts/program.cool | 16 + semantic.py | 15 + test.py | 61 - tests.py | 34 + 14 files changed, 1451 insertions(+), 1298 deletions(-) rename ast.py => astnodes.py (84%) create mode 100644 scope.py create mode 100644 scripts/program.cool create mode 100644 semantic.py delete mode 100644 test.py create mode 100644 tests.py diff --git a/MANUAL.md b/MANUAL.md index e91ca68d1..da473ebe2 100644 --- a/MANUAL.md +++ b/MANUAL.md @@ -4,6 +4,8 @@ ## Flujo de Trabajo: +- El archivo `astnodes.py` contiene los nodes del ast de cool, fue renombrado asi para no entrar en conflicto con la libreria `ast` de python - Todo cambio realizado en la gramatica o al lexer se hara en el archivo `definitions.py`. Para probar si al hacer cambios en la gramatica esta sigue sin dar conflicto tansolo debemos correr el script de la siguiente forma `python3 definitions.py` - Si ha ocurrido algun cambio significativo en la gramatica o el lexer, ya sea agragar una nueva produccion, terminal, o una nueva expresion regular, se debe recompilar este paquete. Para esta ultima accion tenemos el archivo `build.py`, para correrlo basta con hacer `python3 build.py` y este creara dos archivos nuevo `parser.py` y `lexer.py` que contendran el parser y el lexer de cool serializado con las modificaciones realizadas para no tener que construir el parser cada vez que probemos el programa. - Al paquete `cmp` se le ha agregado un nuevo subpaquete `serializer`, que contiene tanto al serializador del parser como del lexer. +- Para probar programas tan solo escribalo en un archivo `.cool` en la carpeta `scripts/` y ejecutar el comando en la terminal `python3 test.py `, por ejemplo `python3 test.py tokenize program.cool` o `python3 test.py parse program.cool` \ No newline at end of file diff --git a/ast.py b/astnodes.py similarity index 84% rename from ast.py rename to astnodes.py index 059129d67..9231381a9 100644 --- a/ast.py +++ b/astnodes.py @@ -3,8 +3,8 @@ class Node: class ProgramNode(Node): - def __init__(self, declarations): - self.declarations = declarations + def __init__(self, class_list): + self.class_list = class_list class DeclarationNode(Node): @@ -22,7 +22,7 @@ def __init__(self, idx, features, parent=None): self.features = features -class FuncDeclarationNode(DeclarationNode): +class MethodDeclarationNode(DeclarationNode): def __init__(self, idx, params, return_type, body): self.id = idx self.params = params @@ -80,7 +80,7 @@ def __init__(self, idx, expr): self.expr = expr -class CallNode(ExpressionNode): +class MethodCallNode(ExpressionNode): def __init__(self, idx, args, obj=None, typex=None): self.obj = obj self.id = idx @@ -99,15 +99,11 @@ def __init__(self, left, right): self.right = right -class TernaryNode(ExpressionNode): - def __init__(self, left, center, right): - self.left = left - self.right = right - self.center = center - - -class ConditionalNode(TernaryNode): - pass +class ConditionalNode(ExpressionNode): + def __init__(self, ifx, then, elsex): + self.ifx = ifx + self.then = then + self.elsex = elsex class ConstantNumNode(AtomicNode): @@ -122,15 +118,15 @@ class InstantiateNode(AtomicNode): pass -class StringNode(AtomicNode): +class IntegerNode(AtomicNode): pass -class TrueNode(AtomicNode): +class StringNode(AtomicNode): pass -class FalseNode(AtomicNode): +class BooleanNode(AtomicNode): pass @@ -138,7 +134,7 @@ class NegationNode(AtomicNode): pass -class IntegerComplementNode(AtomicNode): +class ComplementNode(AtomicNode): pass diff --git a/cmp/parsing/__pycache__/parsing.cpython-37.pyc b/cmp/parsing/__pycache__/parsing.cpython-37.pyc index 020a8a797ba692509f9464124c96a85a1a7a3c70..67a195d2352d3de447bac0b3db853eaa884ae946 100644 GIT binary patch delta 726 zcmY*VO=wd=5Z-w|$;)4DU(zONllGmo6{5YgCE6-Tt38NV8tjkMQhdp?O_Q{nC$wST z#eyx05SfFZ7NiJzm3Z*xS*3Up4>@=eK@mJCC|X+QrGh%kezQCCeKWiBXz1xs)2UF% z&&V#nUB5JJJZVZxkj7Ezkaua0m*|ELAeH7yTE)2L3abX&_ zBHb{7uOfreVHtg`osg(?x2{5{PU*5lps>mj9E*kVepJI3Z4sEkcWoQ+2Ce9Gn8&eT zSUpX&4|p zzGJZC*gh*MPT`z%Jn)v#jU^%c!$m4YbfAj&8Hj{DxdMVaTB)iy)omuDBf|(g2J(x zUPnfRUodOdA%mMy13#G|ZNI9kHdSI1xNbA?IUT}OXa;`ZgHRd%QXMqI<9{e$QK)>hj-F2OGxj$HVM-NA>EEriLkjn(9`!dJfvU>@ diff --git a/cmp/parsing/parsing.py b/cmp/parsing/parsing.py index 990c92056..f4370f26f 100755 --- a/cmp/parsing/parsing.py +++ b/cmp/parsing/parsing.py @@ -175,7 +175,8 @@ def __call__(self, tokens, get_ast=False): if self.verbose: print(stack, '<---||--->', tokens[cursor:]) - assert (state, lookahead.token_type) in self.action, 'Parsing Error...' + assert (state, lookahead.token_type) in self.action, f'Parsing Error in ' \ + f'{(state, lookahead.lex, lookahead.token_type)} ' action, tag = self.action[state, lookahead.token_type] diff --git a/cmp/serializer/lexer_serializer.py b/cmp/serializer/lexer_serializer.py index 70830f8cb..fdf4dbcdf 100644 --- a/cmp/serializer/lexer_serializer.py +++ b/cmp/serializer/lexer_serializer.py @@ -62,12 +62,19 @@ def __build_lexer_table(lexer): symbols = s.transitions for symbol in symbols: key_symbol = symbol + if symbol == "\"": key_symbol = "\\\"" + elif symbol == "\\": key_symbol = "\\\\" + elif symbol == "\n": key_symbol = "\\n" + + elif symbol == "\t": + key_symbol = "\\t" + table += f'({s.state}, "{key_symbol}"): {[d.state for d in s.transitions[symbol]]}, ' if s.final: diff --git a/cmp/serializer/parser_serializer.py b/cmp/serializer/parser_serializer.py index 636faece4..8ea9caafe 100644 --- a/cmp/serializer/parser_serializer.py +++ b/cmp/serializer/parser_serializer.py @@ -3,7 +3,7 @@ TEMPLATE = """from abc import ABC from cmp.parsing import ShiftReduceParser from cmp.pycompiler import AttributeProduction, Sentence -from ast import * +from astnodes import * class %s(ShiftReduceParser, ABC): diff --git a/definitions.py b/definitions.py index 607a3f140..5c6d0f695 100644 --- a/definitions.py +++ b/definitions.py @@ -1,5 +1,6 @@ import time +from astnodes import * from cmp.parsing import LALR1Parser, Lexer from cmp.pycompiler import Grammar @@ -25,6 +26,7 @@ arith = G.NonTerminal('arith') term = G.NonTerminal('term') factor = G.NonTerminal('factor') +atom = G.NonTerminal('atom') ############### # identifiers # @@ -93,84 +95,89 @@ ############ # Specials # ############ +G.Terminal('tab') G.Terminal('space') G.Terminal('newline') ############### # Productions # ############### -program %= 'class-set', lambda s: None +program %= 'class-set', lambda s: ProgramNode(s[1]) -class_set %= 'class-def', lambda s: None -class_set %= 'class-def class-set', lambda s: None +class_set %= 'class-def', lambda s: [s[1]] +class_set %= 'class-def class-set', lambda s: [s[1]] + s[2] -class_def %= 'class type { feature-list }', lambda s: None -class_def %= 'class type inherits type { feature-list }', lambda s: None +class_def %= 'class type { }', lambda s: ClassDeclarationNode(s[2], []) +class_def %= 'class type inherits { }', lambda s: ClassDeclarationNode(s[2], [], s[4]) +class_def %= 'class type { feature-list }', lambda s: ClassDeclarationNode(s[2], s[4]) +class_def %= 'class type inherits type { feature-list }', lambda s: ClassDeclarationNode(s[2], s[6], s[4]) -feature_list %= 'attribute ;', lambda s: None -feature_list %= 'method ;', lambda s: None -feature_list %= 'attribute ; feature-list', lambda s: None -feature_list %= 'method ; feature-list', lambda s: None +feature_list %= 'attribute ;', lambda s: [s[1]] +feature_list %= 'method ;', lambda s: [s[1]] +feature_list %= 'attribute ; feature-list', lambda s: [s[1]] + s[3] +feature_list %= 'method ; feature-list', lambda s: [s[1]] + s[3] -attribute %= 'id : type', lambda s: None -attribute %= 'id : type <- expr', lambda s: None +attribute %= 'id : type', lambda s: AttrDeclarationNode(s[1], s[3]) +attribute %= 'id : type <- expr', lambda s: AttrDeclarationNode(s[1], s[3], s[5]) -method %= 'id ( ) : type { expr }', lambda s: None -method %= 'id ( param-list ) : type { expr }', lambda s: None +method %= 'id ( ) : type { expr }', lambda s: MethodDeclarationNode(s[1], [], s[5], s[7]) +method %= 'id ( param-list ) : type { expr }', lambda s: MethodDeclarationNode(s[1], s[3], s[6], s[8]) -param_list %= 'id : type', lambda s: None -param_list %= 'id : type , param-list', lambda s: None +param_list %= 'id : type', lambda s: [ParamNode(s[1], s[3])] +param_list %= 'id : type , param-list', lambda s: [ParamNode(s[1], s[3])] + s[5] -# TODO: Fix operators precedence -expr %= 'id <- expr', lambda s: None -expr %= '{ block }', lambda s: None -expr %= 'if expr then expr else expr fi', lambda s: None -expr %= 'while expr loop expr pool', lambda s: None -expr %= 'let declaration-list in expr', lambda s: None -expr %= 'case expr of case-list esac', lambda s: None -expr %= 'not expr', lambda s: None -expr %= 'isvoid expr', lambda s: None -expr %= '~ expr', lambda s: None -expr %= 'comp', lambda s: None +expr %= 'id <- expr', lambda s: AssignNode(s[1], s[3]) +expr %= '{ block }', lambda s: BlockNode(s[2]) +expr %= 'if expr then expr else expr fi', lambda s: ConditionalNode(s[2], s[4], s[6]) +expr %= 'while expr loop expr pool', lambda s: WhileNode(s[2], s[4]) +expr %= 'let declaration-list in expr', lambda s: LetNode(s[2], s[4]) +expr %= 'case expr of case-list esac', lambda s: CasesNode(s[2], s[4]) +expr %= 'not expr', lambda s: NegationNode(s[2]) +expr %= 'comp', lambda s: s[1] -comp %= 'comp < arith', lambda s: None -comp %= 'comp <= arith', lambda s: None -comp %= 'comp = arith', lambda s: None -comp %= 'arith', lambda s: None +comp %= 'comp < arith', lambda s: LessNode(s[1], s[3]) +comp %= 'comp <= arith', lambda s: LessEqualNode(s[1], s[3]) +comp %= 'comp = arith', lambda s: EqualNode(s[1], s[3]) +comp %= 'arith', lambda s: s[1] -arith %= 'arith + term', lambda s: None -arith %= 'arith - term', lambda s: None -arith %= 'term', lambda s: None +arith %= 'arith + term', lambda s: PlusNode(s[1], s[3]) +arith %= 'arith - term', lambda s: MinusNode(s[1], s[3]) +arith %= 'term', lambda s: s[1] -term %= 'term * factor', lambda s: None -term %= 'term / factor', lambda s: None -term %= 'factor', lambda s: None +term %= 'term * factor', lambda s: StarNode(s[1], s[3]) +term %= 'term / factor', lambda s: DivNode(s[1], s[3]) +term %= 'factor', lambda s: s[1] -factor %= 'id', lambda s: None -factor %= 'true', lambda s: None -factor %= 'false', lambda s: None -factor %= 'integer', lambda s: None -factor %= 'string', lambda s: None -factor %= 'function-call', lambda s: None -factor %= 'new type', lambda s: None +factor %= 'isvoid factor', lambda s: IsVoidNode(s[2]) +factor %= '~ factor', lambda s: IsVoidNode(s[2]) +factor %= 'atom', lambda s: s[1] -block %= 'expr ;', lambda s: None -block %= 'expr ; block', lambda s: None +atom %= 'id', lambda s: VariableNode(s[1]) +atom %= 'true', lambda s: BooleanNode(s[1]) +atom %= 'false', lambda s: BooleanNode(s[1]) +atom %= 'integer', lambda s: IntegerNode(s[1]) +atom %= 'string', lambda s: StringNode(s[1]) +atom %= 'function-call', lambda s: s[1] +atom %= 'new type', lambda s: InstantiateNode(s[2]) +atom %= '( expr )', lambda s: s[2] -declaration_list %= 'id : type', lambda s: None -declaration_list %= 'id : type <- expr', lambda s: None -declaration_list %= 'id : type , declaration-list', lambda s: None -declaration_list %= 'id : type , declaration-list', lambda s: None +block %= 'expr ;', lambda s: [s[1]] +block %= 'expr ; block', lambda s: [s[1]] + s[3] -case_list %= 'id : type => expr ;', lambda s: None -case_list %= 'case-list id : type => expr ;', lambda s: None +declaration_list %= 'id : type', lambda s: [VarDeclarationNode(s[1], s[3])] +declaration_list %= 'id : type <- expr', lambda s: [VarDeclarationNode(s[1], s[3], s[5])] +declaration_list %= 'id : type , declaration-list', lambda s: [VarDeclarationNode(s[1], s[3])] + s[5] +declaration_list %= 'id : type <- expr , declaration-list', lambda s: [VarDeclarationNode(s[1], s[3], s[5])] + s[7] -function_call %= 'id ( expr-list )', lambda s: None -function_call %= 'factor . id ( expr-list )', lambda s: None -function_call %= 'factor @ type . id ( expr-list )', lambda s: None +case_list %= 'id : type => expr ;', lambda s: [SingleCaseNode(s[1], s[3], s[5])] +case_list %= 'id : type => expr ; case-list', lambda s: [SingleCaseNode(s[1], s[3], s[5])] + s[7] -expr_list %= 'expr', lambda s: None -expr_list %= 'expr , expr-list', lambda s: None +function_call %= 'id ( expr-list )', lambda s: MethodCallNode(s[1], s[3]) +function_call %= 'atom . id ( expr-list )', lambda s: MethodCallNode(s[3], s[5], s[1]) +function_call %= 'atom @ type . id ( expr-list )', lambda s: MethodCallNode(s[3], s[5], s[1]) + +expr_list %= 'expr', lambda s: [s[1]] +expr_list %= 'expr , expr-list', lambda s: [s[1]] + s[3] def cool_grammar(): @@ -224,7 +231,8 @@ def cool_lexer(): (G['end'], 'end'), (G['space'], ' +'), (G['newline'], '\n+'), - (G['integer'], '-?[1-9][0-9]+'), + (G['tab'], '\t+'), + (G['integer'], '-?[1-9][0-9]*'), (G['type'], '[A-Z][a-zA-Z0-9]*'), (G['id'], '[a-z][a-zA-Z0-9]*'), (G['string'], '"[ -~]*"'), diff --git a/lexer.py b/lexer.py index 5fc0afd63..447b5d8d4 100644 --- a/lexer.py +++ b/lexer.py @@ -13,51 +13,52 @@ def __init__(self, G): def __table(self): G = self.G return [ - (G["+"], NFA(2, [1], {(0, "+"): [1], }, start=0)), + (G["+"], NFA(2, [0], {(1, "+"): [0], }, start=1)), (G["-"], NFA(2, [0], {(1, "-"): [0], }, start=1)), (G["*"], NFA(2, [1], {(0, "*"): [1], }, start=0)), (G["/"], NFA(2, [1], {(0, "/"): [1], }, start=0)), - (G["<="], NFA(3, [0], {(2, "<"): [1], (1, "="): [0], }, start=2)), - (G["<"], NFA(2, [0], {(1, "<"): [0], }, start=1)), - (G["="], NFA(2, [1], {(0, "="): [1], }, start=0)), + (G["<="], NFA(3, [0], {(1, "<"): [2], (2, "="): [0], }, start=1)), + (G["<"], NFA(2, [1], {(0, "<"): [1], }, start=0)), + (G["="], NFA(2, [0], {(1, "="): [0], }, start=1)), (G["~"], NFA(2, [0], {(1, "~"): [0], }, start=1)), - (G["not"], NFA(4, [3], {(2, "n"): [1], (1, "o"): [0], (0, "t"): [3], }, start=2)), + (G["not"], NFA(4, [2], {(1, "n"): [3], (3, "o"): [0], (0, "t"): [2], }, start=1)), (G["{"], NFA(2, [1], {(0, "{"): [1], }, start=0)), (G["}"], NFA(2, [0], {(1, "}"): [0], }, start=1)), (G["("], NFA(2, [1], {(0, "("): [1], }, start=0)), (G[")"], NFA(2, [1], {(0, ")"): [1], }, start=0)), (G[","], NFA(2, [1], {(0, ","): [1], }, start=0)), - (G["."], NFA(2, [1], {(0, "."): [1], }, start=0)), - (G["@"], NFA(2, [1], {(0, "@"): [1], }, start=0)), - (G[":"], NFA(2, [0], {(1, ":"): [0], }, start=1)), - (G[";"], NFA(2, [1], {(0, ";"): [1], }, start=0)), - (G["<-"], NFA(3, [1], {(2, "<"): [0], (0, "-"): [1], }, start=2)), + (G["."], NFA(2, [0], {(1, "."): [0], }, start=1)), + (G["@"], NFA(2, [0], {(1, "@"): [0], }, start=1)), + (G[":"], NFA(2, [1], {(0, ":"): [1], }, start=0)), + (G[";"], NFA(2, [0], {(1, ";"): [0], }, start=1)), + (G["<-"], NFA(3, [2], {(0, "<"): [1], (1, "-"): [2], }, start=0)), (G["=>"], NFA(3, [0], {(1, "="): [2], (2, ">"): [0], }, start=1)), - (G["class"], NFA(6, [0], {(3, "c"): [2], (2, "l"): [1], (1, "a"): [4], (4, "s"): [5], (5, "s"): [0], }, start=3)), - (G["inherits"], NFA(9, [7], {(4, "i"): [2], (2, "n"): [3], (3, "h"): [5], (5, "e"): [0], (0, "r"): [8], (8, "i"): [1], (1, "t"): [6], (6, "s"): [7], }, start=4)), - (G["if"], NFA(3, [2], {(0, "i"): [1], (1, "f"): [2], }, start=0)), - (G["then"], NFA(5, [1], {(2, "t"): [3], (3, "h"): [4], (4, "e"): [0], (0, "n"): [1], }, start=2)), - (G["else"], NFA(5, [4], {(0, "e"): [1], (1, "l"): [2], (2, "s"): [3], (3, "e"): [4], }, start=0)), - (G["fi"], NFA(3, [1], {(0, "f"): [2], (2, "i"): [1], }, start=0)), - (G["while"], NFA(6, [5], {(0, "w"): [1], (1, "h"): [2], (2, "i"): [3], (3, "l"): [4], (4, "e"): [5], }, start=0)), - (G["loop"], NFA(5, [1], {(2, "l"): [3], (3, "o"): [4], (4, "o"): [0], (0, "p"): [1], }, start=2)), - (G["pool"], NFA(5, [1], {(4, "p"): [3], (3, "o"): [0], (0, "o"): [2], (2, "l"): [1], }, start=4)), - (G["let"], NFA(4, [1], {(2, "l"): [0], (0, "e"): [3], (3, "t"): [1], }, start=2)), - (G["in"], NFA(3, [1], {(2, "i"): [0], (0, "n"): [1], }, start=2)), + (G["class"], NFA(6, [2], {(5, "c"): [0], (0, "l"): [1], (1, "a"): [4], (4, "s"): [3], (3, "s"): [2], }, start=5)), + (G["inherits"], NFA(9, [7], {(0, "i"): [1], (1, "n"): [2], (2, "h"): [4], (4, "e"): [5], (5, "r"): [6], (6, "i"): [8], (8, "t"): [3], (3, "s"): [7], }, start=0)), + (G["if"], NFA(3, [0], {(2, "i"): [1], (1, "f"): [0], }, start=2)), + (G["then"], NFA(5, [4], {(3, "t"): [2], (2, "h"): [1], (1, "e"): [0], (0, "n"): [4], }, start=3)), + (G["else"], NFA(5, [2], {(3, "e"): [4], (4, "l"): [0], (0, "s"): [1], (1, "e"): [2], }, start=3)), + (G["fi"], NFA(3, [2], {(0, "f"): [1], (1, "i"): [2], }, start=0)), + (G["while"], NFA(6, [1], {(2, "w"): [3], (3, "h"): [4], (4, "i"): [5], (5, "l"): [0], (0, "e"): [1], }, start=2)), + (G["loop"], NFA(5, [4], {(0, "l"): [1], (1, "o"): [2], (2, "o"): [3], (3, "p"): [4], }, start=0)), + (G["pool"], NFA(5, [2], {(3, "p"): [4], (4, "o"): [0], (0, "o"): [1], (1, "l"): [2], }, start=3)), + (G["let"], NFA(4, [1], {(0, "l"): [2], (2, "e"): [3], (3, "t"): [1], }, start=0)), + (G["in"], NFA(3, [2], {(1, "i"): [0], (0, "n"): [2], }, start=1)), (G["case"], NFA(5, [4], {(0, "c"): [1], (1, "a"): [2], (2, "s"): [3], (3, "e"): [4], }, start=0)), - (G["esac"], NFA(5, [1], {(3, "e"): [4], (4, "s"): [2], (2, "a"): [0], (0, "c"): [1], }, start=3)), - (G["of"], NFA(3, [1], {(2, "o"): [0], (0, "f"): [1], }, start=2)), - (G["new"], NFA(4, [3], {(0, "n"): [1], (1, "e"): [2], (2, "w"): [3], }, start=0)), - (G["isvoid"], NFA(7, [2], {(0, "i"): [4], (4, "s"): [6], (6, "v"): [5], (5, "o"): [3], (3, "i"): [1], (1, "d"): [2], }, start=0)), + (G["esac"], NFA(5, [3], {(4, "e"): [1], (1, "s"): [0], (0, "a"): [2], (2, "c"): [3], }, start=4)), + (G["of"], NFA(3, [0], {(1, "o"): [2], (2, "f"): [0], }, start=1)), + (G["new"], NFA(4, [1], {(3, "n"): [2], (2, "e"): [0], (0, "w"): [1], }, start=3)), + (G["isvoid"], NFA(7, [2], {(4, "i"): [6], (6, "s"): [5], (5, "v"): [3], (3, "o"): [1], (1, "i"): [0], (0, "d"): [2], }, start=4)), (G["true"], NFA(5, [4], {(0, "t"): [1], (1, "r"): [2], (2, "u"): [3], (3, "e"): [4], }, start=0)), - (G["false"], NFA(6, [3], {(4, "f"): [0], (0, "a"): [2], (2, "l"): [1], (1, "s"): [5], (5, "e"): [3], }, start=4)), - (G["end"], NFA(4, [0], {(3, "e"): [1], (1, "n"): [2], (2, "d"): [0], }, start=3)), + (G["false"], NFA(6, [2], {(0, "f"): [1], (1, "a"): [5], (5, "l"): [3], (3, "s"): [4], (4, "e"): [2], }, start=0)), + (G["end"], NFA(4, [2], {(1, "e"): [3], (3, "n"): [0], (0, "d"): [2], }, start=1)), (G["space"], NFA(2, [0], {(1, " "): [0], (0, " "): [0], }, start=1)), - (G["newline"], NFA(2, [0], {(1, "\n"): [0], (0, "\n"): [0], }, start=1)), - (G["integer"], NFA(4, [2], {(1, "1"): [3], (1, "5"): [3], (1, "8"): [3], (1, "7"): [3], (1, "6"): [3], (1, "2"): [3], (1, "3"): [3], (1, "9"): [3], (1, "-"): [0], (1, "4"): [3], (3, "1"): [2], (3, "5"): [2], (3, "8"): [2], (3, "7"): [2], (3, "6"): [2], (3, "2"): [2], (3, "3"): [2], (3, "9"): [2], (3, "4"): [2], (3, "0"): [2], (2, "1"): [2], (2, "5"): [2], (2, "8"): [2], (2, "7"): [2], (2, "6"): [2], (2, "2"): [2], (2, "3"): [2], (2, "9"): [2], (2, "4"): [2], (2, "0"): [2], (0, "1"): [3], (0, "5"): [3], (0, "8"): [3], (0, "7"): [3], (0, "6"): [3], (0, "2"): [3], (0, "3"): [3], (0, "9"): [3], (0, "4"): [3], }, start=1)), - (G["type"], NFA(2, [1], {(0, "E"): [1], (0, "D"): [1], (0, "M"): [1], (0, "B"): [1], (0, "I"): [1], (0, "X"): [1], (0, "G"): [1], (0, "W"): [1], (0, "T"): [1], (0, "O"): [1], (0, "C"): [1], (0, "L"): [1], (0, "R"): [1], (0, "A"): [1], (0, "N"): [1], (0, "F"): [1], (0, "J"): [1], (0, "Q"): [1], (0, "S"): [1], (0, "U"): [1], (0, "Y"): [1], (0, "Z"): [1], (0, "V"): [1], (0, "K"): [1], (0, "P"): [1], (0, "H"): [1], (1, "E"): [1], (1, "o"): [1], (1, "y"): [1], (1, "7"): [1], (1, "z"): [1], (1, "D"): [1], (1, "w"): [1], (1, "c"): [1], (1, "M"): [1], (1, "g"): [1], (1, "d"): [1], (1, "u"): [1], (1, "B"): [1], (1, "I"): [1], (1, "e"): [1], (1, "2"): [1], (1, "X"): [1], (1, "k"): [1], (1, "n"): [1], (1, "G"): [1], (1, "p"): [1], (1, "W"): [1], (1, "q"): [1], (1, "8"): [1], (1, "T"): [1], (1, "O"): [1], (1, "C"): [1], (1, "L"): [1], (1, "f"): [1], (1, "i"): [1], (1, "r"): [1], (1, "R"): [1], (1, "A"): [1], (1, "6"): [1], (1, "N"): [1], (1, "s"): [1], (1, "3"): [1], (1, "F"): [1], (1, "m"): [1], (1, "a"): [1], (1, "J"): [1], (1, "9"): [1], (1, "Q"): [1], (1, "S"): [1], (1, "4"): [1], (1, "U"): [1], (1, "h"): [1], (1, "Y"): [1], (1, "l"): [1], (1, "0"): [1], (1, "j"): [1], (1, "1"): [1], (1, "Z"): [1], (1, "5"): [1], (1, "t"): [1], (1, "V"): [1], (1, "K"): [1], (1, "P"): [1], (1, "x"): [1], (1, "b"): [1], (1, "H"): [1], (1, "v"): [1], }, start=0)), - (G["id"], NFA(2, [1], {(0, "o"): [1], (0, "y"): [1], (0, "z"): [1], (0, "w"): [1], (0, "c"): [1], (0, "g"): [1], (0, "d"): [1], (0, "u"): [1], (0, "e"): [1], (0, "k"): [1], (0, "n"): [1], (0, "p"): [1], (0, "q"): [1], (0, "f"): [1], (0, "i"): [1], (0, "s"): [1], (0, "m"): [1], (0, "a"): [1], (0, "h"): [1], (0, "l"): [1], (0, "j"): [1], (0, "t"): [1], (0, "x"): [1], (0, "b"): [1], (0, "r"): [1], (0, "v"): [1], (1, "E"): [1], (1, "o"): [1], (1, "y"): [1], (1, "7"): [1], (1, "z"): [1], (1, "D"): [1], (1, "w"): [1], (1, "c"): [1], (1, "M"): [1], (1, "g"): [1], (1, "d"): [1], (1, "u"): [1], (1, "B"): [1], (1, "I"): [1], (1, "e"): [1], (1, "2"): [1], (1, "X"): [1], (1, "k"): [1], (1, "n"): [1], (1, "p"): [1], (1, "G"): [1], (1, "W"): [1], (1, "q"): [1], (1, "8"): [1], (1, "T"): [1], (1, "f"): [1], (1, "C"): [1], (1, "i"): [1], (1, "L"): [1], (1, "O"): [1], (1, "R"): [1], (1, "A"): [1], (1, "6"): [1], (1, "N"): [1], (1, "s"): [1], (1, "3"): [1], (1, "F"): [1], (1, "m"): [1], (1, "a"): [1], (1, "J"): [1], (1, "9"): [1], (1, "Q"): [1], (1, "S"): [1], (1, "4"): [1], (1, "h"): [1], (1, "l"): [1], (1, "U"): [1], (1, "Y"): [1], (1, "0"): [1], (1, "H"): [1], (1, "j"): [1], (1, "1"): [1], (1, "Z"): [1], (1, "5"): [1], (1, "t"): [1], (1, "V"): [1], (1, "K"): [1], (1, "P"): [1], (1, "x"): [1], (1, "b"): [1], (1, "r"): [1], (1, "v"): [1], }, start=0)), - (G["string"], NFA(3, [1], {(0, "\""): [2], (2, ">"): [2], (2, "D"): [2], (2, "*"): [2], (2, "g"): [2], (2, "@"): [2], (2, "q"): [2], (2, "O"): [2], (2, "L"): [2], (2, "3"): [2], (2, "F"): [2], (2, "="): [2], (2, "Q"): [2], (2, "#"): [2], (2, "("): [2], (2, ","): [2], (2, "Z"): [2], (2, "t"): [2], (2, "V"): [2], (2, "]"): [2], (2, "{"): [2], (2, "~"): [2], (2, "r"): [2], (2, "E"): [2], (2, "z"): [2], (2, "-"): [2], (2, "I"): [2], (2, "2"): [2], (2, "k"): [2], (2, "G"): [2], (2, "&"): [2], (2, "6"): [2], (2, "N"): [2], (2, "+"): [2], (2, "\""): [1], (2, " "): [2], (2, "l"): [2], (2, "Y"): [2], (2, "}"): [2], (2, "j"): [2], (2, "?"): [2], (2, "|"): [2], (2, "."): [2], (2, "`"): [2], (2, "'"): [2], (2, "v"): [2], (2, "y"): [2], (2, ":"): [2], (2, "w"): [2], (2, "M"): [2], (2, "!"): [2], (2, "B"): [2], (2, "n"): [2], (2, "p"): [2], (2, "W"): [2], (2, "8"): [2], (2, "T"): [2], (2, "$"): [2], (2, "C"): [2], (2, "_"): [2], (2, "9"): [2], (2, "<"): [2], (2, "s"): [2], (2, "a"): [2], (2, "J"): [2], (2, "4"): [2], (2, "S"): [2], (2, "5"): [2], (2, "P"): [2], (2, "/"): [2], (2, "x"): [2], (2, "\\"): [2], (2, "d"): [2], (2, "o"): [2], (2, "7"): [2], (2, "c"): [2], (2, "%"): [2], (2, "u"): [2], (2, "e"): [2], (2, "X"): [2], (2, ";"): [2], (2, ")"): [2], (2, "["): [2], (2, "f"): [2], (2, "i"): [2], (2, "R"): [2], (2, "A"): [2], (2, "m"): [2], (2, "U"): [2], (2, "h"): [2], (2, "^"): [2], (2, "0"): [2], (2, "1"): [2], (2, "K"): [2], (2, "b"): [2], (2, "H"): [2], (1, ">"): [2], (1, "D"): [2], (1, "*"): [2], (1, "g"): [2], (1, "@"): [2], (1, "q"): [2], (1, "O"): [2], (1, "L"): [2], (1, "3"): [2], (1, "F"): [2], (1, "="): [2], (1, "Q"): [2], (1, "#"): [2], (1, "("): [2], (1, ","): [2], (1, "Z"): [2], (1, "t"): [2], (1, "V"): [2], (1, "]"): [2], (1, "{"): [2], (1, "~"): [2], (1, "r"): [2], (1, "E"): [2], (1, "z"): [2], (1, "-"): [2], (1, "I"): [2], (1, "2"): [2], (1, "k"): [2], (1, "G"): [2], (1, "&"): [2], (1, "6"): [2], (1, "N"): [2], (1, "+"): [2], (1, "\""): [1], (1, " "): [2], (1, "l"): [2], (1, "Y"): [2], (1, "}"): [2], (1, "j"): [2], (1, "?"): [2], (1, "|"): [2], (1, "."): [2], (1, "`"): [2], (1, "'"): [2], (1, "v"): [2], (1, "y"): [2], (1, ":"): [2], (1, "w"): [2], (1, "M"): [2], (1, "!"): [2], (1, "B"): [2], (1, "n"): [2], (1, "p"): [2], (1, "W"): [2], (1, "8"): [2], (1, "T"): [2], (1, "$"): [2], (1, "C"): [2], (1, "_"): [2], (1, "9"): [2], (1, "<"): [2], (1, "s"): [2], (1, "a"): [2], (1, "J"): [2], (1, "4"): [2], (1, "S"): [2], (1, "5"): [2], (1, "P"): [2], (1, "/"): [2], (1, "x"): [2], (1, "\\"): [2], (1, "d"): [2], (1, "o"): [2], (1, "7"): [2], (1, "c"): [2], (1, "%"): [2], (1, "u"): [2], (1, "e"): [2], (1, "X"): [2], (1, ";"): [2], (1, ")"): [2], (1, "["): [2], (1, "f"): [2], (1, "i"): [2], (1, "R"): [2], (1, "A"): [2], (1, "m"): [2], (1, "U"): [2], (1, "h"): [2], (1, "^"): [2], (1, "0"): [2], (1, "1"): [2], (1, "K"): [2], (1, "b"): [2], (1, "H"): [2], }, start=0)), + (G["newline"], NFA(2, [1], {(0, "\n"): [1], (1, "\n"): [1], }, start=0)), + (G["tab"], NFA(2, [0], {(1, "\t"): [0], (0, "\t"): [0], }, start=1)), + (G["integer"], NFA(3, [0], {(1, "4"): [0], (1, "5"): [0], (1, "3"): [0], (1, "8"): [0], (1, "9"): [0], (1, "1"): [0], (1, "-"): [2], (1, "6"): [0], (1, "2"): [0], (1, "7"): [0], (0, "4"): [0], (0, "5"): [0], (0, "0"): [0], (0, "3"): [0], (0, "8"): [0], (0, "9"): [0], (0, "1"): [0], (0, "6"): [0], (0, "2"): [0], (0, "7"): [0], (2, "4"): [0], (2, "5"): [0], (2, "3"): [0], (2, "8"): [0], (2, "9"): [0], (2, "1"): [0], (2, "6"): [0], (2, "2"): [0], (2, "7"): [0], }, start=1)), + (G["type"], NFA(2, [0], {(1, "G"): [0], (1, "A"): [0], (1, "Z"): [0], (1, "C"): [0], (1, "H"): [0], (1, "B"): [0], (1, "N"): [0], (1, "J"): [0], (1, "O"): [0], (1, "Y"): [0], (1, "R"): [0], (1, "L"): [0], (1, "M"): [0], (1, "S"): [0], (1, "V"): [0], (1, "K"): [0], (1, "P"): [0], (1, "U"): [0], (1, "F"): [0], (1, "X"): [0], (1, "T"): [0], (1, "E"): [0], (1, "I"): [0], (1, "Q"): [0], (1, "D"): [0], (1, "W"): [0], (0, "G"): [0], (0, "A"): [0], (0, "Z"): [0], (0, "3"): [0], (0, "C"): [0], (0, "d"): [0], (0, "k"): [0], (0, "9"): [0], (0, "H"): [0], (0, "o"): [0], (0, "1"): [0], (0, "g"): [0], (0, "u"): [0], (0, "B"): [0], (0, "7"): [0], (0, "p"): [0], (0, "i"): [0], (0, "t"): [0], (0, "4"): [0], (0, "N"): [0], (0, "j"): [0], (0, "J"): [0], (0, "c"): [0], (0, "O"): [0], (0, "Y"): [0], (0, "s"): [0], (0, "w"): [0], (0, "R"): [0], (0, "2"): [0], (0, "r"): [0], (0, "L"): [0], (0, "M"): [0], (0, "S"): [0], (0, "V"): [0], (0, "e"): [0], (0, "h"): [0], (0, "n"): [0], (0, "a"): [0], (0, "0"): [0], (0, "8"): [0], (0, "K"): [0], (0, "P"): [0], (0, "6"): [0], (0, "U"): [0], (0, "F"): [0], (0, "f"): [0], (0, "X"): [0], (0, "T"): [0], (0, "l"): [0], (0, "z"): [0], (0, "E"): [0], (0, "5"): [0], (0, "I"): [0], (0, "Q"): [0], (0, "D"): [0], (0, "b"): [0], (0, "y"): [0], (0, "v"): [0], (0, "m"): [0], (0, "q"): [0], (0, "x"): [0], (0, "W"): [0], }, start=1)), + (G["id"], NFA(2, [1], {(0, "d"): [1], (0, "k"): [1], (0, "o"): [1], (0, "g"): [1], (0, "u"): [1], (0, "i"): [1], (0, "t"): [1], (0, "j"): [1], (0, "c"): [1], (0, "s"): [1], (0, "w"): [1], (0, "r"): [1], (0, "h"): [1], (0, "n"): [1], (0, "e"): [1], (0, "a"): [1], (0, "f"): [1], (0, "l"): [1], (0, "z"): [1], (0, "b"): [1], (0, "y"): [1], (0, "v"): [1], (0, "m"): [1], (0, "q"): [1], (0, "x"): [1], (0, "p"): [1], (1, "G"): [1], (1, "A"): [1], (1, "Z"): [1], (1, "3"): [1], (1, "C"): [1], (1, "d"): [1], (1, "k"): [1], (1, "9"): [1], (1, "o"): [1], (1, "H"): [1], (1, "1"): [1], (1, "g"): [1], (1, "u"): [1], (1, "B"): [1], (1, "7"): [1], (1, "i"): [1], (1, "t"): [1], (1, "4"): [1], (1, "N"): [1], (1, "j"): [1], (1, "c"): [1], (1, "s"): [1], (1, "J"): [1], (1, "O"): [1], (1, "w"): [1], (1, "Y"): [1], (1, "R"): [1], (1, "2"): [1], (1, "r"): [1], (1, "L"): [1], (1, "h"): [1], (1, "n"): [1], (1, "e"): [1], (1, "M"): [1], (1, "S"): [1], (1, "V"): [1], (1, "a"): [1], (1, "W"): [1], (1, "0"): [1], (1, "8"): [1], (1, "K"): [1], (1, "P"): [1], (1, "6"): [1], (1, "U"): [1], (1, "F"): [1], (1, "f"): [1], (1, "X"): [1], (1, "l"): [1], (1, "z"): [1], (1, "T"): [1], (1, "E"): [1], (1, "5"): [1], (1, "I"): [1], (1, "Q"): [1], (1, "D"): [1], (1, "b"): [1], (1, "y"): [1], (1, "v"): [1], (1, "m"): [1], (1, "q"): [1], (1, "x"): [1], (1, "p"): [1], }, start=0)), + (G["string"], NFA(3, [0], {(1, "\""): [2], (2, "G"): [2], (2, "Z"): [2], (2, "]"): [2], (2, "o"): [2], (2, "~"): [2], (2, "<"): [2], (2, "+"): [2], (2, "s"): [2], (2, "O"): [2], (2, "R"): [2], (2, "L"): [2], (2, "K"): [2], (2, " "): [2], (2, "&"): [2], (2, "`"): [2], (2, "X"): [2], (2, "T"): [2], (2, "-"): [2], (2, "b"): [2], (2, "}"): [2], (2, "'"): [2], (2, "d"): [2], (2, ";"): [2], (2, "u"): [2], (2, "_"): [2], (2, "\\"): [2], (2, "4"): [2], (2, "%"): [2], (2, "N"): [2], (2, "J"): [2], (2, "c"): [2], (2, "*"): [2], (2, "2"): [2], (2, ","): [2], (2, "n"): [2], (2, "/"): [2], (2, "5"): [2], (2, "Q"): [2], (2, "D"): [2], (2, "$"): [2], (2, "y"): [2], (2, "v"): [2], (2, "m"): [2], (2, "q"): [2], (2, "x"): [2], (2, "{"): [2], (2, "W"): [2], (2, "3"): [2], (2, "k"): [2], (2, "1"): [2], (2, "H"): [2], (2, "i"): [2], (2, "t"): [2], (2, "Y"): [2], (2, "w"): [2], (2, "M"): [2], (2, "h"): [2], (2, "("): [2], (2, "a"): [2], (2, "|"): [2], (2, "0"): [2], (2, "8"): [2], (2, ":"): [2], (2, "^"): [2], (2, "6"): [2], (2, "U"): [2], (2, "F"): [2], (2, "l"): [2], (2, "E"): [2], (2, "I"): [2], (2, "="): [2], (2, ">"): [2], (2, "A"): [2], (2, "C"): [2], (2, "9"): [2], (2, "g"): [2], (2, "B"): [2], (2, "7"): [2], (2, "j"): [2], (2, "!"): [2], (2, "#"): [2], (2, "@"): [2], (2, "r"): [2], (2, "["): [2], (2, "."): [2], (2, "S"): [2], (2, "V"): [2], (2, "e"): [2], (2, "?"): [2], (2, "P"): [2], (2, "f"): [2], (2, "z"): [2], (2, "\""): [0], (2, "p"): [2], (2, ")"): [2], (0, "G"): [2], (0, "Z"): [2], (0, "]"): [2], (0, "o"): [2], (0, "~"): [2], (0, "<"): [2], (0, "+"): [2], (0, "s"): [2], (0, "O"): [2], (0, "R"): [2], (0, "L"): [2], (0, "K"): [2], (0, " "): [2], (0, "&"): [2], (0, "`"): [2], (0, "X"): [2], (0, "T"): [2], (0, "-"): [2], (0, "b"): [2], (0, "}"): [2], (0, "'"): [2], (0, "d"): [2], (0, ";"): [2], (0, "u"): [2], (0, "_"): [2], (0, "\\"): [2], (0, "4"): [2], (0, "%"): [2], (0, "N"): [2], (0, "J"): [2], (0, "c"): [2], (0, "*"): [2], (0, "2"): [2], (0, ","): [2], (0, "n"): [2], (0, "/"): [2], (0, "5"): [2], (0, "Q"): [2], (0, "D"): [2], (0, "$"): [2], (0, "y"): [2], (0, "v"): [2], (0, "m"): [2], (0, "q"): [2], (0, "x"): [2], (0, "{"): [2], (0, "W"): [2], (0, "3"): [2], (0, "k"): [2], (0, "1"): [2], (0, "H"): [2], (0, "i"): [2], (0, "t"): [2], (0, "Y"): [2], (0, "w"): [2], (0, "M"): [2], (0, "h"): [2], (0, "("): [2], (0, "a"): [2], (0, "|"): [2], (0, "0"): [2], (0, "8"): [2], (0, ":"): [2], (0, "^"): [2], (0, "6"): [2], (0, "U"): [2], (0, "F"): [2], (0, "l"): [2], (0, "E"): [2], (0, "I"): [2], (0, "="): [2], (0, ">"): [2], (0, "A"): [2], (0, "C"): [2], (0, "9"): [2], (0, "g"): [2], (0, "B"): [2], (0, "7"): [2], (0, "j"): [2], (0, "!"): [2], (0, "#"): [2], (0, "@"): [2], (0, "r"): [2], (0, "["): [2], (0, "."): [2], (0, "S"): [2], (0, "V"): [2], (0, "e"): [2], (0, "?"): [2], (0, "P"): [2], (0, "f"): [2], (0, "z"): [2], (0, "\""): [0], (0, "p"): [2], (0, ")"): [2], }, start=1)), ] def _build_regexs(self, table): diff --git a/parser.py b/parser.py index 9feb700d3..4c87457b3 100644 --- a/parser.py +++ b/parser.py @@ -1,7 +1,7 @@ from abc import ABC from cmp.parsing import ShiftReduceParser from cmp.pycompiler import AttributeProduction, Sentence -from ast import * +from astnodes import * class CoolParser(ShiftReduceParser, ABC): @@ -16,1173 +16,1282 @@ def __action_table(self): return { (0, G["class"]): ("SHIFT", 1), (1, G["type"]): ("SHIFT", 2), + (2, G["inherits"]): ("SHIFT", 137), (2, G["{"]): ("SHIFT", 3), - (2, G["inherits"]): ("SHIFT", 135), (3, G["id"]): ("SHIFT", 4), - (4, G[":"]): ("SHIFT", 123), + (3, G["}"]): ("SHIFT", 128), (4, G["("]): ("SHIFT", 5), - (5, G[")"]): ("SHIFT", 11), + (4, G[":"]): ("SHIFT", 124), (5, G["id"]): ("SHIFT", 6), + (5, G[")"]): ("SHIFT", 11), (6, G[":"]): ("SHIFT", 7), (7, G["type"]): ("SHIFT", 8), - (8, G[")"]): ("REDUCE", AttributeProduction(G["param-list"], Sentence(G["id"], G[":"], G["type"]), [lambda s: None])), (8, G[","]): ("SHIFT", 9), + (8, G[")"]): ("REDUCE", AttributeProduction(G["param-list"], Sentence(G["id"], G[":"], G["type"]), [lambda s: [ParamNode(s[1], s[3])]])), (9, G["id"]): ("SHIFT", 6), - (10, G[")"]): ("REDUCE", AttributeProduction(G["param-list"], Sentence(G["id"], G[":"], G["type"], G[","], G["param-list"]), [lambda s: None])), + (10, G[")"]): ("REDUCE", AttributeProduction(G["param-list"], Sentence(G["id"], G[":"], G["type"], G[","], G["param-list"]), [lambda s: [ParamNode(s[1], s[3])] + s[5]])), (11, G[":"]): ("SHIFT", 12), (12, G["type"]): ("SHIFT", 13), (13, G["{"]): ("SHIFT", 14), - (14, G["let"]): ("SHIFT", 22), - (14, G["true"]): ("SHIFT", 33), - (14, G["case"]): ("SHIFT", 29), - (14, G["new"]): ("SHIFT", 30), + (14, G["true"]): ("SHIFT", 35), (14, G["id"]): ("SHIFT", 15), - (14, G["~"]): ("SHIFT", 35), - (14, G["isvoid"]): ("SHIFT", 32), - (14, G["false"]): ("SHIFT", 34), - (14, G["not"]): ("SHIFT", 36), (14, G["{"]): ("SHIFT", 19), - (14, G["string"]): ("SHIFT", 17), + (14, G["while"]): ("SHIFT", 22), + (14, G["not"]): ("SHIFT", 44), (14, G["integer"]): ("SHIFT", 18), - (14, G["while"]): ("SHIFT", 21), - (14, G["if"]): ("SHIFT", 20), + (14, G["new"]): ("SHIFT", 31), + (14, G["("]): ("SHIFT", 20), + (14, G["case"]): ("SHIFT", 30), + (14, G["let"]): ("SHIFT", 23), + (14, G["if"]): ("SHIFT", 21), + (14, G["isvoid"]): ("SHIFT", 33), + (14, G["~"]): ("SHIFT", 37), + (14, G["false"]): ("SHIFT", 36), + (14, G["string"]): ("SHIFT", 17), + (15, G["<-"]): ("SHIFT", 113), + (15, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (15, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (15, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (15, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (15, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (15, G["then"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (15, G["else"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (15, G["fi"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (15, G["loop"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (15, G["pool"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (15, G["in"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (15, G["of"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (15, G["+"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (15, G["-"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (15, G["*"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (15, G["/"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (15, G["<"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (15, G["<="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (15, G["="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (15, G["}"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), (15, G["("]): ("SHIFT", 16), - (15, G["loop"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (15, G["pool"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (15, G["in"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (15, G["of"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (15, G["+"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (15, G["-"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (15, G["*"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (15, G["/"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (15, G["<"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (15, G["<="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (15, G["="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (15, G["}"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (15, G[")"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (15, G[","]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (15, G["."]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (15, G["@"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (15, G[";"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (15, G["then"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (15, G["else"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (15, G["fi"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (15, G["<-"]): ("SHIFT", 112), - (16, G["isvoid"]): ("SHIFT", 32), - (16, G["not"]): ("SHIFT", 36), - (16, G["{"]): ("SHIFT", 19), + (16, G["not"]): ("SHIFT", 44), + (16, G["new"]): ("SHIFT", 31), + (16, G["id"]): ("SHIFT", 15), (16, G["integer"]): ("SHIFT", 18), - (16, G["let"]): ("SHIFT", 22), - (16, G["case"]): ("SHIFT", 29), + (16, G["case"]): ("SHIFT", 30), + (16, G["while"]): ("SHIFT", 22), + (16, G["~"]): ("SHIFT", 37), + (16, G["false"]): ("SHIFT", 36), + (16, G["{"]): ("SHIFT", 19), + (16, G["isvoid"]): ("SHIFT", 33), + (16, G["("]): ("SHIFT", 20), (16, G["string"]): ("SHIFT", 17), - (16, G["id"]): ("SHIFT", 15), - (16, G["false"]): ("SHIFT", 34), - (16, G["while"]): ("SHIFT", 21), - (16, G["new"]): ("SHIFT", 30), - (16, G["if"]): ("SHIFT", 20), - (16, G["true"]): ("SHIFT", 33), - (16, G["~"]): ("SHIFT", 35), - (17, G["loop"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), - (17, G["pool"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), - (17, G["in"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), - (17, G["of"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), - (17, G["+"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), - (17, G["-"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), - (17, G["*"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), - (17, G["/"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), - (17, G["<"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), - (17, G["<="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), - (17, G["="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), - (17, G["}"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), - (17, G[")"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), - (17, G[","]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), - (17, G["."]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), - (17, G["@"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), - (17, G[";"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), - (17, G["then"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), - (17, G["else"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), - (17, G["fi"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["string"]), [lambda s: None])), - (18, G["loop"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), - (18, G["pool"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), - (18, G["in"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), - (18, G["of"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), - (18, G["+"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), - (18, G["-"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), - (18, G["*"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), - (18, G["/"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), - (18, G["<"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), - (18, G["<="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), - (18, G["="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), - (18, G["}"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), - (18, G[")"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), - (18, G[","]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), - (18, G["."]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), - (18, G["@"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), - (18, G[";"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), - (18, G["then"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), - (18, G["else"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), - (18, G["fi"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["integer"]), [lambda s: None])), - (19, G["id"]): ("SHIFT", 15), - (19, G["case"]): ("SHIFT", 29), - (19, G["isvoid"]): ("SHIFT", 32), + (16, G["if"]): ("SHIFT", 21), + (16, G["true"]): ("SHIFT", 35), + (16, G["let"]): ("SHIFT", 23), + (17, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), + (17, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), + (17, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), + (17, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), + (17, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), + (17, G["then"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), + (17, G["else"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), + (17, G["fi"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), + (17, G["loop"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), + (17, G["pool"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), + (17, G["in"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), + (17, G["of"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), + (17, G["+"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), + (17, G["-"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), + (17, G["*"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), + (17, G["/"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), + (17, G["<"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), + (17, G["<="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), + (17, G["="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), + (17, G["}"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), + (18, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), + (18, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), + (18, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), + (18, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), + (18, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), + (18, G["then"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), + (18, G["else"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), + (18, G["fi"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), + (18, G["loop"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), + (18, G["pool"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), + (18, G["in"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), + (18, G["of"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), + (18, G["+"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), + (18, G["-"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), + (18, G["*"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), + (18, G["/"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), + (18, G["<"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), + (18, G["<="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), + (18, G["="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), + (18, G["}"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), (19, G["string"]): ("SHIFT", 17), - (19, G["true"]): ("SHIFT", 33), - (19, G["not"]): ("SHIFT", 36), + (19, G["false"]): ("SHIFT", 36), + (19, G["id"]): ("SHIFT", 15), + (19, G["isvoid"]): ("SHIFT", 33), + (19, G["true"]): ("SHIFT", 35), + (19, G["while"]): ("SHIFT", 22), (19, G["integer"]): ("SHIFT", 18), - (19, G["let"]): ("SHIFT", 22), - (19, G["if"]): ("SHIFT", 20), - (19, G["~"]): ("SHIFT", 35), - (19, G["while"]): ("SHIFT", 21), - (19, G["false"]): ("SHIFT", 34), + (19, G["new"]): ("SHIFT", 31), + (19, G["case"]): ("SHIFT", 30), (19, G["{"]): ("SHIFT", 19), - (19, G["new"]): ("SHIFT", 30), - (20, G["not"]): ("SHIFT", 36), - (20, G["false"]): ("SHIFT", 34), - (20, G["string"]): ("SHIFT", 17), - (20, G["true"]): ("SHIFT", 33), + (19, G["("]): ("SHIFT", 20), + (19, G["if"]): ("SHIFT", 21), + (19, G["let"]): ("SHIFT", 23), + (19, G["not"]): ("SHIFT", 44), + (19, G["~"]): ("SHIFT", 37), + (20, G["~"]): ("SHIFT", 37), + (20, G["while"]): ("SHIFT", 22), (20, G["id"]): ("SHIFT", 15), - (20, G["integer"]): ("SHIFT", 18), - (20, G["while"]): ("SHIFT", 21), + (20, G["isvoid"]): ("SHIFT", 33), + (20, G["string"]): ("SHIFT", 17), + (20, G["false"]): ("SHIFT", 36), + (20, G["let"]): ("SHIFT", 23), + (20, G["not"]): ("SHIFT", 44), + (20, G["true"]): ("SHIFT", 35), + (20, G["case"]): ("SHIFT", 30), + (20, G["if"]): ("SHIFT", 21), (20, G["{"]): ("SHIFT", 19), - (20, G["if"]): ("SHIFT", 20), - (20, G["isvoid"]): ("SHIFT", 32), - (20, G["let"]): ("SHIFT", 22), - (20, G["case"]): ("SHIFT", 29), - (20, G["new"]): ("SHIFT", 30), - (20, G["~"]): ("SHIFT", 35), + (20, G["integer"]): ("SHIFT", 18), + (20, G["new"]): ("SHIFT", 31), + (20, G["("]): ("SHIFT", 20), (21, G["id"]): ("SHIFT", 15), - (21, G["false"]): ("SHIFT", 34), (21, G["string"]): ("SHIFT", 17), - (21, G["true"]): ("SHIFT", 33), + (21, G["("]): ("SHIFT", 20), + (21, G["let"]): ("SHIFT", 23), + (21, G["true"]): ("SHIFT", 35), + (21, G["if"]): ("SHIFT", 21), (21, G["{"]): ("SHIFT", 19), (21, G["integer"]): ("SHIFT", 18), - (21, G["while"]): ("SHIFT", 21), - (21, G["isvoid"]): ("SHIFT", 32), - (21, G["new"]): ("SHIFT", 30), - (21, G["~"]): ("SHIFT", 35), - (21, G["let"]): ("SHIFT", 22), - (21, G["if"]): ("SHIFT", 20), - (21, G["not"]): ("SHIFT", 36), - (21, G["case"]): ("SHIFT", 29), - (22, G["id"]): ("SHIFT", 23), - (23, G[":"]): ("SHIFT", 24), - (24, G["type"]): ("SHIFT", 25), - (25, G["<-"]): ("SHIFT", 28), - (25, G["in"]): ("REDUCE", AttributeProduction(G["declaration-list"], Sentence(G["id"], G[":"], G["type"]), [lambda s: None])), - (25, G[","]): ("SHIFT", 26), - (26, G["id"]): ("SHIFT", 23), - (27, G["in"]): ("REDUCE", AttributeProduction(G["declaration-list"], Sentence(G["id"], G[":"], G["type"], G[","], G["declaration-list"]), [lambda s: None])), - (28, G["not"]): ("SHIFT", 36), - (28, G["false"]): ("SHIFT", 34), - (28, G["id"]): ("SHIFT", 15), - (28, G["string"]): ("SHIFT", 17), - (28, G["true"]): ("SHIFT", 33), - (28, G["integer"]): ("SHIFT", 18), - (28, G["while"]): ("SHIFT", 21), - (28, G["{"]): ("SHIFT", 19), - (28, G["if"]): ("SHIFT", 20), - (28, G["isvoid"]): ("SHIFT", 32), - (28, G["let"]): ("SHIFT", 22), - (28, G["case"]): ("SHIFT", 29), - (28, G["new"]): ("SHIFT", 30), - (28, G["~"]): ("SHIFT", 35), - (29, G["if"]): ("SHIFT", 20), + (21, G["new"]): ("SHIFT", 31), + (21, G["isvoid"]): ("SHIFT", 33), + (21, G["false"]): ("SHIFT", 36), + (21, G["~"]): ("SHIFT", 37), + (21, G["while"]): ("SHIFT", 22), + (21, G["not"]): ("SHIFT", 44), + (21, G["case"]): ("SHIFT", 30), + (22, G["while"]): ("SHIFT", 22), + (22, G["not"]): ("SHIFT", 44), + (22, G["false"]): ("SHIFT", 36), + (22, G["{"]): ("SHIFT", 19), + (22, G["id"]): ("SHIFT", 15), + (22, G["integer"]): ("SHIFT", 18), + (22, G["new"]): ("SHIFT", 31), + (22, G["case"]): ("SHIFT", 30), + (22, G["let"]): ("SHIFT", 23), + (22, G["true"]): ("SHIFT", 35), + (22, G["if"]): ("SHIFT", 21), + (22, G["string"]): ("SHIFT", 17), + (22, G["isvoid"]): ("SHIFT", 33), + (22, G["("]): ("SHIFT", 20), + (22, G["~"]): ("SHIFT", 37), + (23, G["id"]): ("SHIFT", 24), + (24, G[":"]): ("SHIFT", 25), + (25, G["type"]): ("SHIFT", 26), + (26, G["<-"]): ("SHIFT", 29), + (26, G["in"]): ("REDUCE", AttributeProduction(G["declaration-list"], Sentence(G["id"], G[":"], G["type"]), [lambda s: [VarDeclarationNode(s[1], s[3])]])), + (26, G[","]): ("SHIFT", 27), + (27, G["id"]): ("SHIFT", 24), + (28, G["in"]): ("REDUCE", AttributeProduction(G["declaration-list"], Sentence(G["id"], G[":"], G["type"], G[","], G["declaration-list"]), [lambda s: [VarDeclarationNode(s[1], s[3])] + s[5]])), + (29, G["("]): ("SHIFT", 20), + (29, G["string"]): ("SHIFT", 17), + (29, G["true"]): ("SHIFT", 35), + (29, G["case"]): ("SHIFT", 30), + (29, G["isvoid"]): ("SHIFT", 33), (29, G["id"]): ("SHIFT", 15), - (29, G["false"]): ("SHIFT", 34), - (29, G["let"]): ("SHIFT", 22), + (29, G["while"]): ("SHIFT", 22), + (29, G["not"]): ("SHIFT", 44), + (29, G["new"]): ("SHIFT", 31), (29, G["integer"]): ("SHIFT", 18), - (29, G["~"]): ("SHIFT", 35), - (29, G["new"]): ("SHIFT", 30), + (29, G["let"]): ("SHIFT", 23), + (29, G["false"]): ("SHIFT", 36), + (29, G["if"]): ("SHIFT", 21), (29, G["{"]): ("SHIFT", 19), - (29, G["isvoid"]): ("SHIFT", 32), - (29, G["while"]): ("SHIFT", 21), - (29, G["not"]): ("SHIFT", 36), - (29, G["true"]): ("SHIFT", 33), - (29, G["string"]): ("SHIFT", 17), - (29, G["case"]): ("SHIFT", 29), - (30, G["type"]): ("SHIFT", 31), - (31, G["loop"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), - (31, G["pool"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), - (31, G["in"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), - (31, G["of"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), - (31, G["+"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), - (31, G["-"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), - (31, G["*"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), - (31, G["/"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), - (31, G["<"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), - (31, G["<="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), - (31, G["="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), - (31, G["}"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), - (31, G[")"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), - (31, G[","]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), - (31, G["."]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), - (31, G["@"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), - (31, G[";"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), - (31, G["then"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), - (31, G["else"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), - (31, G["fi"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["new"], G["type"]), [lambda s: None])), - (32, G["id"]): ("SHIFT", 15), - (32, G["{"]): ("SHIFT", 19), - (32, G["new"]): ("SHIFT", 30), - (32, G["not"]): ("SHIFT", 36), - (32, G["case"]): ("SHIFT", 29), - (32, G["false"]): ("SHIFT", 34), - (32, G["let"]): ("SHIFT", 22), - (32, G["isvoid"]): ("SHIFT", 32), - (32, G["if"]): ("SHIFT", 20), - (32, G["~"]): ("SHIFT", 35), - (32, G["while"]): ("SHIFT", 21), - (32, G["string"]): ("SHIFT", 17), - (32, G["true"]): ("SHIFT", 33), - (32, G["integer"]): ("SHIFT", 18), - (33, G["loop"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), - (33, G["pool"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), - (33, G["in"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), - (33, G["of"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), - (33, G["+"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), - (33, G["-"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), - (33, G["*"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), - (33, G["/"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), - (33, G["<"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), - (33, G["<="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), - (33, G["="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), - (33, G["}"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), - (33, G[")"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), - (33, G[","]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), - (33, G["."]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), - (33, G["@"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), - (33, G[";"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), - (33, G["then"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), - (33, G["else"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), - (33, G["fi"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["true"]), [lambda s: None])), - (34, G["loop"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), - (34, G["pool"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), - (34, G["in"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), - (34, G["of"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), - (34, G["+"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), - (34, G["-"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), - (34, G["*"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), - (34, G["/"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), - (34, G["<"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), - (34, G["<="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), - (34, G["="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), - (34, G["}"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), - (34, G[")"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), - (34, G[","]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), - (34, G["."]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), - (34, G["@"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), - (34, G[";"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), - (34, G["then"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), - (34, G["else"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), - (34, G["fi"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["false"]), [lambda s: None])), - (35, G["id"]): ("SHIFT", 15), - (35, G["{"]): ("SHIFT", 19), - (35, G["new"]): ("SHIFT", 30), - (35, G["not"]): ("SHIFT", 36), - (35, G["case"]): ("SHIFT", 29), - (35, G["false"]): ("SHIFT", 34), - (35, G["let"]): ("SHIFT", 22), - (35, G["isvoid"]): ("SHIFT", 32), - (35, G["if"]): ("SHIFT", 20), - (35, G["~"]): ("SHIFT", 35), - (35, G["while"]): ("SHIFT", 21), - (35, G["string"]): ("SHIFT", 17), - (35, G["true"]): ("SHIFT", 33), - (35, G["integer"]): ("SHIFT", 18), - (36, G["id"]): ("SHIFT", 15), - (36, G["{"]): ("SHIFT", 19), - (36, G["new"]): ("SHIFT", 30), - (36, G["not"]): ("SHIFT", 36), - (36, G["case"]): ("SHIFT", 29), - (36, G["false"]): ("SHIFT", 34), - (36, G["let"]): ("SHIFT", 22), - (36, G["isvoid"]): ("SHIFT", 32), - (36, G["if"]): ("SHIFT", 20), - (36, G["~"]): ("SHIFT", 35), - (36, G["while"]): ("SHIFT", 21), - (36, G["string"]): ("SHIFT", 17), - (36, G["true"]): ("SHIFT", 33), - (36, G["integer"]): ("SHIFT", 18), - (37, G["loop"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), - (37, G["pool"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), - (37, G["in"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), - (37, G["of"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), - (37, G["+"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), - (37, G["-"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), - (37, G["*"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), - (37, G["/"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), - (37, G["<"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), - (37, G["<="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), - (37, G["="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), - (37, G["}"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), - (37, G[")"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), - (37, G[","]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), - (37, G["."]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), - (37, G["@"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), - (37, G[";"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), - (37, G["then"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), - (37, G["else"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), - (37, G["fi"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["function-call"]), [lambda s: None])), - (38, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: None])), - (38, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: None])), - (38, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: None])), - (38, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: None])), - (38, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: None])), - (38, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: None])), - (38, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: None])), - (38, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: None])), - (38, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: None])), - (38, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: None])), - (38, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: None])), - (39, G["<="]): ("SHIFT", 69), - (39, G["="]): ("SHIFT", 71), - (39, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: None])), - (39, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: None])), - (39, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: None])), - (39, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: None])), - (39, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: None])), - (39, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: None])), - (39, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: None])), - (39, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: None])), - (39, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: None])), - (39, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: None])), - (39, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: None])), - (39, G["<"]): ("SHIFT", 40), - (40, G["integer"]): ("SHIFT", 18), - (40, G["new"]): ("SHIFT", 30), - (40, G["id"]): ("SHIFT", 41), - (40, G["false"]): ("SHIFT", 34), - (40, G["string"]): ("SHIFT", 17), - (40, G["true"]): ("SHIFT", 33), - (41, G["("]): ("SHIFT", 16), - (41, G["loop"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (41, G["pool"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (41, G["in"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (41, G["of"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (41, G["+"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (41, G["-"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (41, G["*"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (41, G["/"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (41, G["<"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (41, G["<="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (41, G["="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (41, G["}"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (41, G[")"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (41, G[","]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (41, G["."]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (41, G["@"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (41, G[";"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (41, G["then"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (41, G["else"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (41, G["fi"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["id"]), [lambda s: None])), - (42, G["-"]): ("SHIFT", 56), - (42, G["<="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: None])), - (42, G["="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: None])), - (42, G["loop"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: None])), - (42, G["}"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: None])), - (42, G["fi"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: None])), - (42, G["pool"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: None])), - (42, G[")"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: None])), - (42, G["in"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: None])), - (42, G[","]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: None])), - (42, G["then"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: None])), - (42, G["else"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: None])), - (42, G["of"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: None])), - (42, G["<"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: None])), - (42, G[";"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: None])), - (42, G["+"]): ("SHIFT", 43), - (43, G["id"]): ("SHIFT", 41), - (43, G["false"]): ("SHIFT", 34), - (43, G["new"]): ("SHIFT", 30), - (43, G["string"]): ("SHIFT", 17), - (43, G["true"]): ("SHIFT", 33), + (29, G["~"]): ("SHIFT", 37), + (30, G["id"]): ("SHIFT", 15), + (30, G["false"]): ("SHIFT", 36), + (30, G["if"]): ("SHIFT", 21), + (30, G["new"]): ("SHIFT", 31), + (30, G["let"]): ("SHIFT", 23), + (30, G["case"]): ("SHIFT", 30), + (30, G["integer"]): ("SHIFT", 18), + (30, G["string"]): ("SHIFT", 17), + (30, G["not"]): ("SHIFT", 44), + (30, G["("]): ("SHIFT", 20), + (30, G["{"]): ("SHIFT", 19), + (30, G["~"]): ("SHIFT", 37), + (30, G["true"]): ("SHIFT", 35), + (30, G["isvoid"]): ("SHIFT", 33), + (30, G["while"]): ("SHIFT", 22), + (31, G["type"]): ("SHIFT", 32), + (32, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), + (32, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), + (32, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), + (32, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), + (32, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), + (32, G["then"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), + (32, G["else"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), + (32, G["fi"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), + (32, G["loop"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), + (32, G["pool"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), + (32, G["in"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), + (32, G["of"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), + (32, G["+"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), + (32, G["-"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), + (32, G["*"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), + (32, G["/"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), + (32, G["<"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), + (32, G["<="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), + (32, G["="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), + (32, G["}"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), + (33, G["isvoid"]): ("SHIFT", 33), + (33, G["id"]): ("SHIFT", 34), + (33, G["false"]): ("SHIFT", 36), + (33, G["string"]): ("SHIFT", 17), + (33, G["integer"]): ("SHIFT", 18), + (33, G["true"]): ("SHIFT", 35), + (33, G["~"]): ("SHIFT", 37), + (33, G["new"]): ("SHIFT", 31), + (33, G["("]): ("SHIFT", 20), + (34, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (34, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (34, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (34, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (34, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (34, G["then"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (34, G["else"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (34, G["fi"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (34, G["loop"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (34, G["pool"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (34, G["in"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (34, G["of"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (34, G["+"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (34, G["-"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (34, G["*"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (34, G["/"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (34, G["<"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (34, G["<="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (34, G["="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (34, G["}"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (34, G["("]): ("SHIFT", 16), + (35, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), + (35, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), + (35, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), + (35, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), + (35, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), + (35, G["then"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), + (35, G["else"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), + (35, G["fi"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), + (35, G["loop"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), + (35, G["pool"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), + (35, G["in"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), + (35, G["of"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), + (35, G["+"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), + (35, G["-"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), + (35, G["*"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), + (35, G["/"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), + (35, G["<"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), + (35, G["<="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), + (35, G["="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), + (35, G["}"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), + (36, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), + (36, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), + (36, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), + (36, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), + (36, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), + (36, G["then"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), + (36, G["else"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), + (36, G["fi"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), + (36, G["loop"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), + (36, G["pool"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), + (36, G["in"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), + (36, G["of"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), + (36, G["+"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), + (36, G["-"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), + (36, G["*"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), + (36, G["/"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), + (36, G["<"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), + (36, G["<="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), + (36, G["="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), + (36, G["}"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), + (37, G["isvoid"]): ("SHIFT", 33), + (37, G["id"]): ("SHIFT", 34), + (37, G["false"]): ("SHIFT", 36), + (37, G["string"]): ("SHIFT", 17), + (37, G["integer"]): ("SHIFT", 18), + (37, G["true"]): ("SHIFT", 35), + (37, G["~"]): ("SHIFT", 37), + (37, G["new"]): ("SHIFT", 31), + (37, G["("]): ("SHIFT", 20), + (38, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), + (38, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), + (38, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), + (38, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), + (38, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), + (38, G["then"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), + (38, G["else"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), + (38, G["fi"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), + (38, G["loop"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), + (38, G["pool"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), + (38, G["in"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), + (38, G["of"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), + (38, G["+"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), + (38, G["-"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), + (38, G["*"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), + (38, G["/"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), + (38, G["<"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), + (38, G["<="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), + (38, G["="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), + (38, G["}"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), + (39, G["in"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (39, G[")"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (39, G["+"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (39, G["-"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (39, G[","]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (39, G["*"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (39, G["then"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (39, G["/"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (39, G["of"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (39, G["else"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (39, G["<"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (39, G["fi"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (39, G["<="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (39, G[";"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (39, G["="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (39, G["loop"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (39, G["pool"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (39, G["}"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (40, G["."]): ("SHIFT", 41), + (40, G["in"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), + (40, G[")"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), + (40, G["+"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), + (40, G["-"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), + (40, G[","]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), + (40, G["*"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), + (40, G["then"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), + (40, G["/"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), + (40, G["of"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), + (40, G["else"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), + (40, G["<"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), + (40, G["fi"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), + (40, G["<="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), + (40, G[";"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), + (40, G["="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), + (40, G["loop"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), + (40, G["pool"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), + (40, G["}"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), + (40, G["@"]): ("SHIFT", 69), + (41, G["id"]): ("SHIFT", 42), + (42, G["("]): ("SHIFT", 43), + (43, G["not"]): ("SHIFT", 44), + (43, G["id"]): ("SHIFT", 15), + (43, G["new"]): ("SHIFT", 31), (43, G["integer"]): ("SHIFT", 18), - (44, G["<="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), - (44, G["="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), - (44, G["loop"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), - (44, G["}"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), - (44, G["fi"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), - (44, G["pool"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), - (44, G[")"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), - (44, G["+"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), - (44, G["in"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), - (44, G[","]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), - (44, G["-"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), - (44, G["then"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), - (44, G["else"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), - (44, G["of"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), - (44, G["<"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), - (44, G[";"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: None])), - (44, G["/"]): ("SHIFT", 58), - (44, G["*"]): ("SHIFT", 45), - (45, G["id"]): ("SHIFT", 41), - (45, G["false"]): ("SHIFT", 34), - (45, G["new"]): ("SHIFT", 30), - (45, G["string"]): ("SHIFT", 17), - (45, G["true"]): ("SHIFT", 33), - (45, G["integer"]): ("SHIFT", 18), - (46, G["."]): ("SHIFT", 47), - (46, G["<="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), - (46, G["="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), - (46, G["loop"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), - (46, G["}"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), - (46, G["fi"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), - (46, G["pool"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), - (46, G[")"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), - (46, G["+"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), - (46, G["in"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), - (46, G[","]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), - (46, G["-"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), - (46, G["then"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), - (46, G["*"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), - (46, G["of"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), - (46, G["else"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), - (46, G["/"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), - (46, G["<"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), - (46, G[";"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: None])), - (46, G["@"]): ("SHIFT", 60), - (47, G["id"]): ("SHIFT", 48), - (48, G["("]): ("SHIFT", 49), - (49, G["isvoid"]): ("SHIFT", 32), - (49, G["not"]): ("SHIFT", 36), - (49, G["{"]): ("SHIFT", 19), - (49, G["integer"]): ("SHIFT", 18), - (49, G["let"]): ("SHIFT", 22), - (49, G["case"]): ("SHIFT", 29), + (43, G["case"]): ("SHIFT", 30), + (43, G["while"]): ("SHIFT", 22), + (43, G["~"]): ("SHIFT", 37), + (43, G["false"]): ("SHIFT", 36), + (43, G["{"]): ("SHIFT", 19), + (43, G["isvoid"]): ("SHIFT", 33), + (43, G["("]): ("SHIFT", 20), + (43, G["string"]): ("SHIFT", 17), + (43, G["if"]): ("SHIFT", 21), + (43, G["true"]): ("SHIFT", 35), + (43, G["let"]): ("SHIFT", 23), + (44, G["true"]): ("SHIFT", 35), + (44, G["let"]): ("SHIFT", 23), + (44, G["not"]): ("SHIFT", 44), + (44, G["case"]): ("SHIFT", 30), + (44, G["("]): ("SHIFT", 20), + (44, G["{"]): ("SHIFT", 19), + (44, G["string"]): ("SHIFT", 17), + (44, G["integer"]): ("SHIFT", 18), + (44, G["new"]): ("SHIFT", 31), + (44, G["id"]): ("SHIFT", 15), + (44, G["while"]): ("SHIFT", 22), + (44, G["isvoid"]): ("SHIFT", 33), + (44, G["false"]): ("SHIFT", 36), + (44, G["~"]): ("SHIFT", 37), + (44, G["if"]): ("SHIFT", 21), + (45, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), + (45, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), + (45, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), + (45, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), + (45, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), + (45, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), + (45, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), + (45, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), + (45, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), + (45, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), + (45, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), + (46, G["<="]): ("SHIFT", 59), + (46, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), + (46, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), + (46, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), + (46, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), + (46, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), + (46, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), + (46, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), + (46, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), + (46, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), + (46, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), + (46, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), + (46, G["="]): ("SHIFT", 61), + (46, G["<"]): ("SHIFT", 47), + (47, G["isvoid"]): ("SHIFT", 33), + (47, G["false"]): ("SHIFT", 36), + (47, G["true"]): ("SHIFT", 35), + (47, G["~"]): ("SHIFT", 37), + (47, G["("]): ("SHIFT", 20), + (47, G["id"]): ("SHIFT", 34), + (47, G["string"]): ("SHIFT", 17), + (47, G["integer"]): ("SHIFT", 18), + (47, G["new"]): ("SHIFT", 31), + (48, G["+"]): ("SHIFT", 49), + (48, G["-"]): ("SHIFT", 56), + (48, G["in"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), + (48, G[")"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), + (48, G[","]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), + (48, G["then"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), + (48, G["of"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), + (48, G["else"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), + (48, G["<"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), + (48, G["fi"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), + (48, G["<="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), + (48, G[";"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), + (48, G["="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), + (48, G["loop"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), + (48, G["pool"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), + (48, G["}"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), + (49, G["isvoid"]): ("SHIFT", 33), + (49, G["false"]): ("SHIFT", 36), + (49, G["true"]): ("SHIFT", 35), + (49, G["~"]): ("SHIFT", 37), + (49, G["("]): ("SHIFT", 20), + (49, G["id"]): ("SHIFT", 34), (49, G["string"]): ("SHIFT", 17), - (49, G["id"]): ("SHIFT", 15), - (49, G["false"]): ("SHIFT", 34), - (49, G["while"]): ("SHIFT", 21), - (49, G["new"]): ("SHIFT", 30), - (49, G["if"]): ("SHIFT", 20), - (49, G["true"]): ("SHIFT", 33), - (49, G["~"]): ("SHIFT", 35), - (50, G[")"]): ("SHIFT", 51), - (51, G["loop"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (51, G["pool"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (51, G["in"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (51, G["of"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (51, G["+"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (51, G["-"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (51, G["*"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (51, G["/"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (51, G["<"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (51, G["<="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (51, G["="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (51, G["}"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (51, G[")"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (51, G[","]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (51, G["."]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (51, G["@"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (51, G[";"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (51, G["then"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (51, G["else"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (51, G["fi"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (52, G[")"]): ("REDUCE", AttributeProduction(G["expr-list"], Sentence(G["expr"]), [lambda s: None])), - (52, G[","]): ("SHIFT", 53), - (53, G["isvoid"]): ("SHIFT", 32), - (53, G["not"]): ("SHIFT", 36), - (53, G["{"]): ("SHIFT", 19), - (53, G["integer"]): ("SHIFT", 18), - (53, G["let"]): ("SHIFT", 22), - (53, G["case"]): ("SHIFT", 29), + (49, G["integer"]): ("SHIFT", 18), + (49, G["new"]): ("SHIFT", 31), + (50, G["/"]): ("SHIFT", 53), + (50, G["in"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), + (50, G[")"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), + (50, G["+"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), + (50, G["-"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), + (50, G[","]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), + (50, G["then"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), + (50, G["of"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), + (50, G["else"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), + (50, G["<"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), + (50, G["fi"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), + (50, G["<="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), + (50, G[";"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), + (50, G["="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), + (50, G["loop"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), + (50, G["pool"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), + (50, G["}"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), + (50, G["*"]): ("SHIFT", 51), + (51, G["isvoid"]): ("SHIFT", 33), + (51, G["id"]): ("SHIFT", 34), + (51, G["false"]): ("SHIFT", 36), + (51, G["string"]): ("SHIFT", 17), + (51, G["integer"]): ("SHIFT", 18), + (51, G["true"]): ("SHIFT", 35), + (51, G["~"]): ("SHIFT", 37), + (51, G["new"]): ("SHIFT", 31), + (51, G["("]): ("SHIFT", 20), + (52, G["in"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), + (52, G[")"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), + (52, G["+"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), + (52, G["-"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), + (52, G[","]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), + (52, G["*"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), + (52, G["then"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), + (52, G["/"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), + (52, G["of"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), + (52, G["else"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), + (52, G["<"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), + (52, G["fi"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), + (52, G["<="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), + (52, G[";"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), + (52, G["="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), + (52, G["loop"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), + (52, G["pool"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), + (52, G["}"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), + (53, G["isvoid"]): ("SHIFT", 33), + (53, G["id"]): ("SHIFT", 34), + (53, G["false"]): ("SHIFT", 36), (53, G["string"]): ("SHIFT", 17), - (53, G["id"]): ("SHIFT", 15), - (53, G["false"]): ("SHIFT", 34), - (53, G["while"]): ("SHIFT", 21), - (53, G["new"]): ("SHIFT", 30), - (53, G["if"]): ("SHIFT", 20), - (53, G["true"]): ("SHIFT", 33), - (53, G["~"]): ("SHIFT", 35), - (54, G[")"]): ("REDUCE", AttributeProduction(G["expr-list"], Sentence(G["expr"], G[","], G["expr-list"]), [lambda s: None])), - (55, G["<="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: None])), - (55, G["="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: None])), - (55, G["loop"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: None])), - (55, G["}"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: None])), - (55, G["pool"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: None])), - (55, G[")"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: None])), - (55, G["in"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: None])), - (55, G[","]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: None])), - (55, G["then"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: None])), - (55, G["else"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: None])), - (55, G["of"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: None])), - (55, G["fi"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: None])), - (55, G["<"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: None])), - (55, G[";"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: None])), - (55, G["-"]): ("SHIFT", 56), - (55, G["+"]): ("SHIFT", 43), - (56, G["id"]): ("SHIFT", 41), - (56, G["false"]): ("SHIFT", 34), - (56, G["new"]): ("SHIFT", 30), + (53, G["integer"]): ("SHIFT", 18), + (53, G["true"]): ("SHIFT", 35), + (53, G["~"]): ("SHIFT", 37), + (53, G["new"]): ("SHIFT", 31), + (53, G["("]): ("SHIFT", 20), + (54, G["in"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), + (54, G[")"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), + (54, G["+"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), + (54, G["-"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), + (54, G[","]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), + (54, G["*"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), + (54, G["then"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), + (54, G["/"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), + (54, G["of"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), + (54, G["else"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), + (54, G["<"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), + (54, G["fi"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), + (54, G["<="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), + (54, G[";"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), + (54, G["="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), + (54, G["loop"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), + (54, G["pool"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), + (54, G["}"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), + (55, G["in"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), + (55, G[")"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), + (55, G["+"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), + (55, G["-"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), + (55, G[","]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), + (55, G["*"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), + (55, G["then"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), + (55, G["/"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), + (55, G["of"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), + (55, G["else"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), + (55, G["<"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), + (55, G["fi"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), + (55, G["<="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), + (55, G[";"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), + (55, G["="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), + (55, G["loop"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), + (55, G["pool"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), + (55, G["}"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), + (56, G["isvoid"]): ("SHIFT", 33), + (56, G["false"]): ("SHIFT", 36), + (56, G["true"]): ("SHIFT", 35), + (56, G["~"]): ("SHIFT", 37), + (56, G["("]): ("SHIFT", 20), + (56, G["id"]): ("SHIFT", 34), (56, G["string"]): ("SHIFT", 17), - (56, G["true"]): ("SHIFT", 33), (56, G["integer"]): ("SHIFT", 18), - (57, G["/"]): ("SHIFT", 58), - (57, G["<="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), - (57, G["="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), - (57, G["loop"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), - (57, G["}"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), - (57, G["fi"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), - (57, G["pool"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), - (57, G[")"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), - (57, G["+"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), - (57, G["in"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), - (57, G[","]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), - (57, G["-"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), - (57, G["then"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), - (57, G["else"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), - (57, G["of"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), - (57, G["<"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), - (57, G[";"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: None])), - (57, G["*"]): ("SHIFT", 45), - (58, G["id"]): ("SHIFT", 41), - (58, G["false"]): ("SHIFT", 34), - (58, G["new"]): ("SHIFT", 30), - (58, G["string"]): ("SHIFT", 17), - (58, G["true"]): ("SHIFT", 33), - (58, G["integer"]): ("SHIFT", 18), - (59, G["<="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), - (59, G["="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), - (59, G["loop"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), - (59, G["}"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), - (59, G["fi"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), - (59, G["pool"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), - (59, G[")"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), - (59, G["+"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), - (59, G["in"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), - (59, G[","]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), - (59, G["-"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), - (59, G["then"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), - (59, G["*"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), - (59, G["of"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), - (59, G["else"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), - (59, G["/"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), - (59, G["<"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), - (59, G[";"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: None])), - (59, G["."]): ("SHIFT", 47), - (59, G["@"]): ("SHIFT", 60), - (60, G["type"]): ("SHIFT", 61), - (61, G["."]): ("SHIFT", 62), - (62, G["id"]): ("SHIFT", 63), - (63, G["("]): ("SHIFT", 64), - (64, G["isvoid"]): ("SHIFT", 32), - (64, G["not"]): ("SHIFT", 36), - (64, G["{"]): ("SHIFT", 19), - (64, G["integer"]): ("SHIFT", 18), - (64, G["let"]): ("SHIFT", 22), - (64, G["case"]): ("SHIFT", 29), - (64, G["string"]): ("SHIFT", 17), - (64, G["id"]): ("SHIFT", 15), - (64, G["false"]): ("SHIFT", 34), - (64, G["while"]): ("SHIFT", 21), - (64, G["new"]): ("SHIFT", 30), - (64, G["if"]): ("SHIFT", 20), - (64, G["true"]): ("SHIFT", 33), - (64, G["~"]): ("SHIFT", 35), - (65, G[")"]): ("SHIFT", 66), - (66, G["loop"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (66, G["pool"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (66, G["in"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (66, G["of"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (66, G["+"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (66, G["-"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (66, G["*"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (66, G["/"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (66, G["<"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (66, G["<="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (66, G["="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (66, G["}"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (66, G[")"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (66, G[","]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (66, G["."]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (66, G["@"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (66, G[";"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (66, G["then"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (66, G["else"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (66, G["fi"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["factor"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (67, G["/"]): ("SHIFT", 58), - (67, G["<="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), - (67, G["="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), - (67, G["loop"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), - (67, G["}"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), - (67, G["fi"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), - (67, G["pool"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), - (67, G[")"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), - (67, G["+"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), - (67, G["in"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), - (67, G[","]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), - (67, G["-"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), - (67, G["then"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), - (67, G["else"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), - (67, G["of"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), - (67, G["<"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), - (67, G[";"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: None])), - (67, G["*"]): ("SHIFT", 45), - (68, G["@"]): ("SHIFT", 60), - (68, G["."]): ("SHIFT", 47), - (68, G["<="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), - (68, G["="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), - (68, G["loop"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), - (68, G["}"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), - (68, G["fi"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), - (68, G["pool"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), - (68, G[")"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), - (68, G["+"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), - (68, G[","]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), - (68, G["in"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), - (68, G["-"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), - (68, G["then"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), - (68, G["*"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), - (68, G["of"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), - (68, G["else"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), - (68, G["/"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), - (68, G["<"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), - (68, G[";"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: None])), - (69, G["integer"]): ("SHIFT", 18), - (69, G["new"]): ("SHIFT", 30), - (69, G["id"]): ("SHIFT", 41), - (69, G["false"]): ("SHIFT", 34), - (69, G["string"]): ("SHIFT", 17), - (69, G["true"]): ("SHIFT", 33), - (70, G["-"]): ("SHIFT", 56), - (70, G["+"]): ("SHIFT", 43), - (70, G["<="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: None])), - (70, G["="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: None])), - (70, G["loop"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: None])), - (70, G["}"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: None])), - (70, G["fi"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: None])), - (70, G["pool"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: None])), - (70, G[")"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: None])), - (70, G["in"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: None])), - (70, G[","]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: None])), - (70, G["then"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: None])), - (70, G["else"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: None])), - (70, G["of"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: None])), - (70, G["<"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: None])), - (70, G[";"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: None])), - (71, G["integer"]): ("SHIFT", 18), - (71, G["new"]): ("SHIFT", 30), - (71, G["id"]): ("SHIFT", 41), - (71, G["false"]): ("SHIFT", 34), - (71, G["string"]): ("SHIFT", 17), - (71, G["true"]): ("SHIFT", 33), - (72, G["<="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: None])), - (72, G["="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: None])), - (72, G["loop"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: None])), - (72, G["}"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: None])), - (72, G["fi"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: None])), - (72, G["pool"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: None])), - (72, G[")"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: None])), - (72, G["in"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: None])), - (72, G[","]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: None])), - (72, G["then"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: None])), - (72, G["else"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: None])), - (72, G["of"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: None])), - (72, G["<"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: None])), - (72, G[";"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: None])), - (72, G["-"]): ("SHIFT", 56), - (72, G["+"]): ("SHIFT", 43), - (73, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["~"], G["expr"]), [lambda s: None])), - (73, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["~"], G["expr"]), [lambda s: None])), - (73, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["~"], G["expr"]), [lambda s: None])), - (73, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["~"], G["expr"]), [lambda s: None])), - (73, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["~"], G["expr"]), [lambda s: None])), - (73, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["~"], G["expr"]), [lambda s: None])), - (73, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["~"], G["expr"]), [lambda s: None])), - (73, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["~"], G["expr"]), [lambda s: None])), - (73, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["~"], G["expr"]), [lambda s: None])), - (73, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["~"], G["expr"]), [lambda s: None])), - (73, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["~"], G["expr"]), [lambda s: None])), - (74, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["isvoid"], G["expr"]), [lambda s: None])), - (74, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["isvoid"], G["expr"]), [lambda s: None])), - (74, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["isvoid"], G["expr"]), [lambda s: None])), - (74, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["isvoid"], G["expr"]), [lambda s: None])), - (74, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["isvoid"], G["expr"]), [lambda s: None])), - (74, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["isvoid"], G["expr"]), [lambda s: None])), - (74, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["isvoid"], G["expr"]), [lambda s: None])), - (74, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["isvoid"], G["expr"]), [lambda s: None])), - (74, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["isvoid"], G["expr"]), [lambda s: None])), - (74, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["isvoid"], G["expr"]), [lambda s: None])), - (74, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["isvoid"], G["expr"]), [lambda s: None])), - (75, G["of"]): ("SHIFT", 76), - (76, G["id"]): ("SHIFT", 77), - (77, G[":"]): ("SHIFT", 78), - (78, G["type"]): ("SHIFT", 79), - (79, G["=>"]): ("SHIFT", 80), - (80, G["not"]): ("SHIFT", 36), - (80, G["id"]): ("SHIFT", 15), - (80, G["integer"]): ("SHIFT", 18), - (80, G["case"]): ("SHIFT", 29), - (80, G["let"]): ("SHIFT", 22), - (80, G["isvoid"]): ("SHIFT", 32), - (80, G["if"]): ("SHIFT", 20), - (80, G["string"]): ("SHIFT", 17), - (80, G["~"]): ("SHIFT", 35), - (80, G["while"]): ("SHIFT", 21), - (80, G["false"]): ("SHIFT", 34), - (80, G["{"]): ("SHIFT", 19), - (80, G["new"]): ("SHIFT", 30), - (80, G["true"]): ("SHIFT", 33), - (81, G[";"]): ("SHIFT", 82), - (82, G["id"]): ("REDUCE", AttributeProduction(G["case-list"], Sentence(G["id"], G[":"], G["type"], G["=>"], G["expr"], G[";"]), [lambda s: None])), - (82, G["esac"]): ("REDUCE", AttributeProduction(G["case-list"], Sentence(G["id"], G[":"], G["type"], G["=>"], G["expr"], G[";"]), [lambda s: None])), - (83, G["id"]): ("SHIFT", 84), - (83, G["esac"]): ("SHIFT", 90), - (84, G[":"]): ("SHIFT", 85), - (85, G["type"]): ("SHIFT", 86), - (86, G["=>"]): ("SHIFT", 87), - (87, G["not"]): ("SHIFT", 36), - (87, G["id"]): ("SHIFT", 15), - (87, G["integer"]): ("SHIFT", 18), - (87, G["case"]): ("SHIFT", 29), - (87, G["let"]): ("SHIFT", 22), - (87, G["isvoid"]): ("SHIFT", 32), - (87, G["if"]): ("SHIFT", 20), - (87, G["string"]): ("SHIFT", 17), - (87, G["~"]): ("SHIFT", 35), - (87, G["while"]): ("SHIFT", 21), - (87, G["false"]): ("SHIFT", 34), - (87, G["{"]): ("SHIFT", 19), - (87, G["new"]): ("SHIFT", 30), - (87, G["true"]): ("SHIFT", 33), - (88, G[";"]): ("SHIFT", 89), - (89, G["id"]): ("REDUCE", AttributeProduction(G["case-list"], Sentence(G["case-list"], G["id"], G[":"], G["type"], G["=>"], G["expr"], G[";"]), [lambda s: None])), - (89, G["esac"]): ("REDUCE", AttributeProduction(G["case-list"], Sentence(G["case-list"], G["id"], G[":"], G["type"], G["=>"], G["expr"], G[";"]), [lambda s: None])), - (90, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: None])), - (90, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: None])), - (90, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: None])), - (90, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: None])), - (90, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: None])), - (90, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: None])), - (90, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: None])), - (90, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: None])), - (90, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: None])), - (90, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: None])), - (90, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: None])), - (91, G["in"]): ("REDUCE", AttributeProduction(G["declaration-list"], Sentence(G["id"], G[":"], G["type"], G["<-"], G["expr"]), [lambda s: None])), - (92, G["in"]): ("SHIFT", 93), - (93, G["id"]): ("SHIFT", 15), - (93, G["{"]): ("SHIFT", 19), - (93, G["new"]): ("SHIFT", 30), - (93, G["not"]): ("SHIFT", 36), - (93, G["case"]): ("SHIFT", 29), - (93, G["false"]): ("SHIFT", 34), - (93, G["let"]): ("SHIFT", 22), - (93, G["isvoid"]): ("SHIFT", 32), - (93, G["if"]): ("SHIFT", 20), - (93, G["~"]): ("SHIFT", 35), - (93, G["while"]): ("SHIFT", 21), - (93, G["string"]): ("SHIFT", 17), - (93, G["true"]): ("SHIFT", 33), - (93, G["integer"]): ("SHIFT", 18), - (94, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: None])), - (94, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: None])), - (94, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: None])), - (94, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: None])), - (94, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: None])), - (94, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: None])), - (94, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: None])), - (94, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: None])), - (94, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: None])), - (94, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: None])), - (94, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: None])), - (95, G["loop"]): ("SHIFT", 96), - (96, G["false"]): ("SHIFT", 34), - (96, G["id"]): ("SHIFT", 15), - (96, G["{"]): ("SHIFT", 19), - (96, G["new"]): ("SHIFT", 30), - (96, G["true"]): ("SHIFT", 33), - (96, G["not"]): ("SHIFT", 36), - (96, G["integer"]): ("SHIFT", 18), - (96, G["case"]): ("SHIFT", 29), - (96, G["let"]): ("SHIFT", 22), - (96, G["isvoid"]): ("SHIFT", 32), - (96, G["if"]): ("SHIFT", 20), - (96, G["string"]): ("SHIFT", 17), - (96, G["~"]): ("SHIFT", 35), - (96, G["while"]): ("SHIFT", 21), - (97, G["pool"]): ("SHIFT", 98), - (98, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: None])), - (98, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: None])), - (98, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: None])), - (98, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: None])), - (98, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: None])), - (98, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: None])), - (98, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: None])), - (98, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: None])), - (98, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: None])), - (98, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: None])), - (98, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: None])), - (99, G["then"]): ("SHIFT", 100), - (100, G["integer"]): ("SHIFT", 18), - (100, G["id"]): ("SHIFT", 15), - (100, G["let"]): ("SHIFT", 22), - (100, G["isvoid"]): ("SHIFT", 32), - (100, G["if"]): ("SHIFT", 20), - (100, G["~"]): ("SHIFT", 35), - (100, G["string"]): ("SHIFT", 17), - (100, G["case"]): ("SHIFT", 29), - (100, G["{"]): ("SHIFT", 19), - (100, G["false"]): ("SHIFT", 34), - (100, G["while"]): ("SHIFT", 21), - (100, G["new"]): ("SHIFT", 30), - (100, G["not"]): ("SHIFT", 36), - (100, G["true"]): ("SHIFT", 33), - (101, G["else"]): ("SHIFT", 102), - (102, G["new"]): ("SHIFT", 30), - (102, G["while"]): ("SHIFT", 21), - (102, G["id"]): ("SHIFT", 15), - (102, G["integer"]): ("SHIFT", 18), - (102, G["not"]): ("SHIFT", 36), - (102, G["true"]): ("SHIFT", 33), - (102, G["if"]): ("SHIFT", 20), - (102, G["~"]): ("SHIFT", 35), - (102, G["string"]): ("SHIFT", 17), - (102, G["let"]): ("SHIFT", 22), - (102, G["isvoid"]): ("SHIFT", 32), - (102, G["case"]): ("SHIFT", 29), - (102, G["{"]): ("SHIFT", 19), - (102, G["false"]): ("SHIFT", 34), - (103, G["fi"]): ("SHIFT", 104), - (104, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: None])), - (104, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: None])), - (104, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: None])), - (104, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: None])), - (104, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: None])), - (104, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: None])), - (104, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: None])), - (104, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: None])), - (104, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: None])), - (104, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: None])), - (104, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: None])), - (105, G["}"]): ("SHIFT", 106), - (106, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: None])), - (106, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: None])), - (106, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: None])), - (106, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: None])), - (106, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: None])), - (106, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: None])), - (106, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: None])), - (106, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: None])), - (106, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: None])), - (106, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: None])), - (106, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: None])), - (107, G[";"]): ("SHIFT", 108), - (108, G["id"]): ("SHIFT", 15), - (108, G["case"]): ("SHIFT", 29), - (108, G["isvoid"]): ("SHIFT", 32), - (108, G["string"]): ("SHIFT", 17), - (108, G["true"]): ("SHIFT", 33), - (108, G["not"]): ("SHIFT", 36), - (108, G["integer"]): ("SHIFT", 18), - (108, G["let"]): ("SHIFT", 22), - (108, G["if"]): ("SHIFT", 20), - (108, G["~"]): ("SHIFT", 35), - (108, G["while"]): ("SHIFT", 21), - (108, G["false"]): ("SHIFT", 34), - (108, G["{"]): ("SHIFT", 19), - (108, G["}"]): ("REDUCE", AttributeProduction(G["block"], Sentence(G["expr"], G[";"]), [lambda s: None])), - (108, G["new"]): ("SHIFT", 30), - (109, G["}"]): ("REDUCE", AttributeProduction(G["block"], Sentence(G["expr"], G[";"], G["block"]), [lambda s: None])), - (110, G[")"]): ("SHIFT", 111), - (111, G["loop"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (111, G["pool"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (111, G["in"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (111, G["of"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (111, G["+"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (111, G["-"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (111, G["*"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (111, G["/"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (111, G["<"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (111, G["<="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (111, G["="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (111, G["}"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (111, G[")"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (111, G[","]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (111, G["."]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (111, G["@"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (111, G[";"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (111, G["then"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (111, G["else"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (111, G["fi"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: None])), - (112, G["id"]): ("SHIFT", 15), - (112, G["{"]): ("SHIFT", 19), - (112, G["new"]): ("SHIFT", 30), - (112, G["not"]): ("SHIFT", 36), - (112, G["case"]): ("SHIFT", 29), - (112, G["false"]): ("SHIFT", 34), - (112, G["let"]): ("SHIFT", 22), - (112, G["isvoid"]): ("SHIFT", 32), - (112, G["if"]): ("SHIFT", 20), - (112, G["~"]): ("SHIFT", 35), - (112, G["while"]): ("SHIFT", 21), - (112, G["string"]): ("SHIFT", 17), - (112, G["true"]): ("SHIFT", 33), - (112, G["integer"]): ("SHIFT", 18), - (113, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: None])), - (113, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: None])), - (113, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: None])), - (113, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: None])), - (113, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: None])), - (113, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: None])), - (113, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: None])), - (113, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: None])), - (113, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: None])), - (113, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: None])), - (113, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: None])), - (114, G["}"]): ("SHIFT", 115), - (115, G[";"]): ("REDUCE", AttributeProduction(G["method"], Sentence(G["id"], G["("], G[")"], G[":"], G["type"], G["{"], G["expr"], G["}"]), [lambda s: None])), - (116, G[")"]): ("SHIFT", 117), - (117, G[":"]): ("SHIFT", 118), - (118, G["type"]): ("SHIFT", 119), - (119, G["{"]): ("SHIFT", 120), - (120, G["let"]): ("SHIFT", 22), - (120, G["true"]): ("SHIFT", 33), - (120, G["case"]): ("SHIFT", 29), - (120, G["new"]): ("SHIFT", 30), - (120, G["id"]): ("SHIFT", 15), - (120, G["~"]): ("SHIFT", 35), - (120, G["isvoid"]): ("SHIFT", 32), - (120, G["false"]): ("SHIFT", 34), - (120, G["not"]): ("SHIFT", 36), - (120, G["{"]): ("SHIFT", 19), - (120, G["string"]): ("SHIFT", 17), - (120, G["integer"]): ("SHIFT", 18), - (120, G["while"]): ("SHIFT", 21), - (120, G["if"]): ("SHIFT", 20), - (121, G["}"]): ("SHIFT", 122), - (122, G[";"]): ("REDUCE", AttributeProduction(G["method"], Sentence(G["id"], G["("], G["param-list"], G[")"], G[":"], G["type"], G["{"], G["expr"], G["}"]), [lambda s: None])), - (123, G["type"]): ("SHIFT", 124), - (124, G["<-"]): ("SHIFT", 125), - (124, G[";"]): ("REDUCE", AttributeProduction(G["attribute"], Sentence(G["id"], G[":"], G["type"]), [lambda s: None])), - (125, G["not"]): ("SHIFT", 36), - (125, G["id"]): ("SHIFT", 15), - (125, G["integer"]): ("SHIFT", 18), - (125, G["case"]): ("SHIFT", 29), - (125, G["let"]): ("SHIFT", 22), - (125, G["isvoid"]): ("SHIFT", 32), - (125, G["if"]): ("SHIFT", 20), - (125, G["string"]): ("SHIFT", 17), - (125, G["~"]): ("SHIFT", 35), - (125, G["while"]): ("SHIFT", 21), - (125, G["false"]): ("SHIFT", 34), - (125, G["{"]): ("SHIFT", 19), - (125, G["new"]): ("SHIFT", 30), - (125, G["true"]): ("SHIFT", 33), - (126, G[";"]): ("REDUCE", AttributeProduction(G["attribute"], Sentence(G["id"], G[":"], G["type"], G["<-"], G["expr"]), [lambda s: None])), - (127, G["}"]): ("SHIFT", 128), - (128, G["class"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["{"], G["feature-list"], G["}"]), [lambda s: None])), - (128, G["$"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["{"], G["feature-list"], G["}"]), [lambda s: None])), - (129, G[";"]): ("SHIFT", 130), - (130, G["id"]): ("SHIFT", 4), - (130, G["}"]): ("REDUCE", AttributeProduction(G["feature-list"], Sentence(G["attribute"], G[";"]), [lambda s: None])), - (131, G["}"]): ("REDUCE", AttributeProduction(G["feature-list"], Sentence(G["attribute"], G[";"], G["feature-list"]), [lambda s: None])), - (132, G[";"]): ("SHIFT", 133), - (133, G["id"]): ("SHIFT", 4), - (133, G["}"]): ("REDUCE", AttributeProduction(G["feature-list"], Sentence(G["method"], G[";"]), [lambda s: None])), - (134, G["}"]): ("REDUCE", AttributeProduction(G["feature-list"], Sentence(G["method"], G[";"], G["feature-list"]), [lambda s: None])), - (135, G["type"]): ("SHIFT", 136), - (136, G["{"]): ("SHIFT", 137), - (137, G["id"]): ("SHIFT", 4), - (138, G["}"]): ("SHIFT", 139), - (139, G["class"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["inherits"], G["type"], G["{"], G["feature-list"], G["}"]), [lambda s: None])), - (139, G["$"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["inherits"], G["type"], G["{"], G["feature-list"], G["}"]), [lambda s: None])), - (140, G["$"]): ("OK", None), - (141, G["$"]): ("REDUCE", AttributeProduction(G["program"], Sentence(G["class-set"]), [lambda s: None])), - (142, G["class"]): ("SHIFT", 1), - (142, G["$"]): ("REDUCE", AttributeProduction(G["class-set"], Sentence(G["class-def"]), [lambda s: None])), - (143, G["$"]): ("REDUCE", AttributeProduction(G["class-set"], Sentence(G["class-def"], G["class-set"]), [lambda s: None])), + (56, G["new"]): ("SHIFT", 31), + (57, G["/"]): ("SHIFT", 53), + (57, G["in"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), + (57, G[")"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), + (57, G["+"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), + (57, G["-"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), + (57, G[","]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), + (57, G["then"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), + (57, G["of"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), + (57, G["else"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), + (57, G["<"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), + (57, G["fi"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), + (57, G["<="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), + (57, G[";"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), + (57, G["="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), + (57, G["loop"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), + (57, G["pool"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), + (57, G["}"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), + (57, G["*"]): ("SHIFT", 51), + (58, G["in"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), + (58, G[")"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), + (58, G["+"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), + (58, G["-"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), + (58, G[","]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), + (58, G["then"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), + (58, G["of"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), + (58, G["else"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), + (58, G["<"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), + (58, G["fi"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), + (58, G["<="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), + (58, G[";"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), + (58, G["="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), + (58, G["loop"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), + (58, G["pool"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), + (58, G["}"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), + (58, G["/"]): ("SHIFT", 53), + (58, G["*"]): ("SHIFT", 51), + (59, G["isvoid"]): ("SHIFT", 33), + (59, G["false"]): ("SHIFT", 36), + (59, G["true"]): ("SHIFT", 35), + (59, G["~"]): ("SHIFT", 37), + (59, G["("]): ("SHIFT", 20), + (59, G["id"]): ("SHIFT", 34), + (59, G["string"]): ("SHIFT", 17), + (59, G["integer"]): ("SHIFT", 18), + (59, G["new"]): ("SHIFT", 31), + (60, G["in"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), + (60, G[")"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), + (60, G[","]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), + (60, G["then"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), + (60, G["of"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), + (60, G["else"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), + (60, G["<"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), + (60, G["fi"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), + (60, G["<="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), + (60, G[";"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), + (60, G["="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), + (60, G["loop"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), + (60, G["pool"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), + (60, G["}"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), + (60, G["+"]): ("SHIFT", 49), + (60, G["-"]): ("SHIFT", 56), + (61, G["isvoid"]): ("SHIFT", 33), + (61, G["false"]): ("SHIFT", 36), + (61, G["true"]): ("SHIFT", 35), + (61, G["~"]): ("SHIFT", 37), + (61, G["("]): ("SHIFT", 20), + (61, G["id"]): ("SHIFT", 34), + (61, G["string"]): ("SHIFT", 17), + (61, G["integer"]): ("SHIFT", 18), + (61, G["new"]): ("SHIFT", 31), + (62, G["+"]): ("SHIFT", 49), + (62, G["in"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), + (62, G[")"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), + (62, G[","]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), + (62, G["then"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), + (62, G["of"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), + (62, G["else"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), + (62, G["<"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), + (62, G["fi"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), + (62, G["<="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), + (62, G[";"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), + (62, G["="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), + (62, G["loop"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), + (62, G["pool"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), + (62, G["}"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), + (62, G["-"]): ("SHIFT", 56), + (63, G["+"]): ("SHIFT", 49), + (63, G["-"]): ("SHIFT", 56), + (63, G["in"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), + (63, G[")"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), + (63, G[","]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), + (63, G["then"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), + (63, G["of"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), + (63, G["else"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), + (63, G["<"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), + (63, G["fi"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), + (63, G["<="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), + (63, G[";"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), + (63, G["="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), + (63, G["loop"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), + (63, G["pool"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), + (63, G["}"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), + (64, G[")"]): ("SHIFT", 65), + (65, G[")"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (65, G[","]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (65, G["."]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (65, G["@"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (65, G[";"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (65, G["then"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (65, G["else"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (65, G["fi"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (65, G["loop"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (65, G["pool"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (65, G["in"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (65, G["of"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (65, G["+"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (65, G["-"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (65, G["*"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (65, G["/"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (65, G["<"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (65, G["<="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (65, G["="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (65, G["}"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (66, G[")"]): ("REDUCE", AttributeProduction(G["expr-list"], Sentence(G["expr"]), [lambda s: [s[1]]])), + (66, G[","]): ("SHIFT", 67), + (67, G["not"]): ("SHIFT", 44), + (67, G["id"]): ("SHIFT", 15), + (67, G["new"]): ("SHIFT", 31), + (67, G["integer"]): ("SHIFT", 18), + (67, G["case"]): ("SHIFT", 30), + (67, G["while"]): ("SHIFT", 22), + (67, G["~"]): ("SHIFT", 37), + (67, G["false"]): ("SHIFT", 36), + (67, G["{"]): ("SHIFT", 19), + (67, G["isvoid"]): ("SHIFT", 33), + (67, G["("]): ("SHIFT", 20), + (67, G["string"]): ("SHIFT", 17), + (67, G["if"]): ("SHIFT", 21), + (67, G["true"]): ("SHIFT", 35), + (67, G["let"]): ("SHIFT", 23), + (68, G[")"]): ("REDUCE", AttributeProduction(G["expr-list"], Sentence(G["expr"], G[","], G["expr-list"]), [lambda s: [s[1]] + s[3]])), + (69, G["type"]): ("SHIFT", 70), + (70, G["."]): ("SHIFT", 71), + (71, G["id"]): ("SHIFT", 72), + (72, G["("]): ("SHIFT", 73), + (73, G["not"]): ("SHIFT", 44), + (73, G["id"]): ("SHIFT", 15), + (73, G["new"]): ("SHIFT", 31), + (73, G["integer"]): ("SHIFT", 18), + (73, G["case"]): ("SHIFT", 30), + (73, G["while"]): ("SHIFT", 22), + (73, G["~"]): ("SHIFT", 37), + (73, G["false"]): ("SHIFT", 36), + (73, G["{"]): ("SHIFT", 19), + (73, G["isvoid"]): ("SHIFT", 33), + (73, G["("]): ("SHIFT", 20), + (73, G["string"]): ("SHIFT", 17), + (73, G["if"]): ("SHIFT", 21), + (73, G["true"]): ("SHIFT", 35), + (73, G["let"]): ("SHIFT", 23), + (74, G[")"]): ("SHIFT", 75), + (75, G[")"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (75, G[","]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (75, G["."]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (75, G["@"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (75, G[";"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (75, G["then"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (75, G["else"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (75, G["fi"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (75, G["loop"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (75, G["pool"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (75, G["in"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (75, G["of"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (75, G["+"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (75, G["-"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (75, G["*"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (75, G["/"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (75, G["<"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (75, G["<="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (75, G["="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (75, G["}"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (76, G["in"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (76, G[")"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (76, G["+"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (76, G["-"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (76, G[","]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (76, G["*"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (76, G["then"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (76, G["/"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (76, G["of"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (76, G["else"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (76, G["<"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (76, G["fi"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (76, G["<="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (76, G[";"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (76, G["="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (76, G["loop"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (76, G["pool"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (76, G["}"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (77, G["of"]): ("SHIFT", 78), + (78, G["id"]): ("SHIFT", 79), + (79, G[":"]): ("SHIFT", 80), + (80, G["type"]): ("SHIFT", 81), + (81, G["=>"]): ("SHIFT", 82), + (82, G["string"]): ("SHIFT", 17), + (82, G["false"]): ("SHIFT", 36), + (82, G["id"]): ("SHIFT", 15), + (82, G["isvoid"]): ("SHIFT", 33), + (82, G["true"]): ("SHIFT", 35), + (82, G["while"]): ("SHIFT", 22), + (82, G["integer"]): ("SHIFT", 18), + (82, G["new"]): ("SHIFT", 31), + (82, G["case"]): ("SHIFT", 30), + (82, G["{"]): ("SHIFT", 19), + (82, G["("]): ("SHIFT", 20), + (82, G["if"]): ("SHIFT", 21), + (82, G["let"]): ("SHIFT", 23), + (82, G["not"]): ("SHIFT", 44), + (82, G["~"]): ("SHIFT", 37), + (83, G[";"]): ("SHIFT", 84), + (84, G["id"]): ("SHIFT", 79), + (84, G["esac"]): ("REDUCE", AttributeProduction(G["case-list"], Sentence(G["id"], G[":"], G["type"], G["=>"], G["expr"], G[";"]), [lambda s: [SingleCaseNode(s[1], s[3], s[5])]])), + (85, G["esac"]): ("REDUCE", AttributeProduction(G["case-list"], Sentence(G["id"], G[":"], G["type"], G["=>"], G["expr"], G[";"], G["case-list"]), [lambda s: [SingleCaseNode(s[1], s[3], s[5])] + s[7]])), + (86, G["esac"]): ("SHIFT", 87), + (87, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), + (87, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), + (87, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), + (87, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), + (87, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), + (87, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), + (87, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), + (87, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), + (87, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), + (87, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), + (87, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), + (88, G[","]): ("SHIFT", 89), + (88, G["in"]): ("REDUCE", AttributeProduction(G["declaration-list"], Sentence(G["id"], G[":"], G["type"], G["<-"], G["expr"]), [lambda s: [VarDeclarationNode(s[1], s[3], s[5])]])), + (89, G["id"]): ("SHIFT", 24), + (90, G["in"]): ("REDUCE", AttributeProduction(G["declaration-list"], Sentence(G["id"], G[":"], G["type"], G["<-"], G["expr"], G[","], G["declaration-list"]), [lambda s: [VarDeclarationNode(s[1], s[3], s[5])] + s[7]])), + (91, G["in"]): ("SHIFT", 92), + (92, G["true"]): ("SHIFT", 35), + (92, G["let"]): ("SHIFT", 23), + (92, G["not"]): ("SHIFT", 44), + (92, G["case"]): ("SHIFT", 30), + (92, G["("]): ("SHIFT", 20), + (92, G["{"]): ("SHIFT", 19), + (92, G["string"]): ("SHIFT", 17), + (92, G["integer"]): ("SHIFT", 18), + (92, G["new"]): ("SHIFT", 31), + (92, G["while"]): ("SHIFT", 22), + (92, G["id"]): ("SHIFT", 15), + (92, G["isvoid"]): ("SHIFT", 33), + (92, G["false"]): ("SHIFT", 36), + (92, G["~"]): ("SHIFT", 37), + (92, G["if"]): ("SHIFT", 21), + (93, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), + (93, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), + (93, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), + (93, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), + (93, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), + (93, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), + (93, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), + (93, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), + (93, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), + (93, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), + (93, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), + (94, G["loop"]): ("SHIFT", 95), + (95, G["while"]): ("SHIFT", 22), + (95, G["id"]): ("SHIFT", 15), + (95, G["false"]): ("SHIFT", 36), + (95, G["not"]): ("SHIFT", 44), + (95, G["~"]): ("SHIFT", 37), + (95, G["{"]): ("SHIFT", 19), + (95, G["case"]): ("SHIFT", 30), + (95, G["let"]): ("SHIFT", 23), + (95, G["integer"]): ("SHIFT", 18), + (95, G["new"]): ("SHIFT", 31), + (95, G["if"]): ("SHIFT", 21), + (95, G["string"]): ("SHIFT", 17), + (95, G["isvoid"]): ("SHIFT", 33), + (95, G["("]): ("SHIFT", 20), + (95, G["true"]): ("SHIFT", 35), + (96, G["pool"]): ("SHIFT", 97), + (97, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), + (97, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), + (97, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), + (97, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), + (97, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), + (97, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), + (97, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), + (97, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), + (97, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), + (97, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), + (97, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), + (98, G["then"]): ("SHIFT", 99), + (99, G["integer"]): ("SHIFT", 18), + (99, G["{"]): ("SHIFT", 19), + (99, G["id"]): ("SHIFT", 15), + (99, G["if"]): ("SHIFT", 21), + (99, G["true"]): ("SHIFT", 35), + (99, G["let"]): ("SHIFT", 23), + (99, G["("]): ("SHIFT", 20), + (99, G["string"]): ("SHIFT", 17), + (99, G["isvoid"]): ("SHIFT", 33), + (99, G["case"]): ("SHIFT", 30), + (99, G["not"]): ("SHIFT", 44), + (99, G["while"]): ("SHIFT", 22), + (99, G["false"]): ("SHIFT", 36), + (99, G["~"]): ("SHIFT", 37), + (99, G["new"]): ("SHIFT", 31), + (100, G["else"]): ("SHIFT", 101), + (101, G["string"]): ("SHIFT", 17), + (101, G["false"]): ("SHIFT", 36), + (101, G["id"]): ("SHIFT", 15), + (101, G["{"]): ("SHIFT", 19), + (101, G["if"]): ("SHIFT", 21), + (101, G["let"]): ("SHIFT", 23), + (101, G["case"]): ("SHIFT", 30), + (101, G["("]): ("SHIFT", 20), + (101, G["new"]): ("SHIFT", 31), + (101, G["~"]): ("SHIFT", 37), + (101, G["integer"]): ("SHIFT", 18), + (101, G["not"]): ("SHIFT", 44), + (101, G["isvoid"]): ("SHIFT", 33), + (101, G["while"]): ("SHIFT", 22), + (101, G["true"]): ("SHIFT", 35), + (102, G["fi"]): ("SHIFT", 103), + (103, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), + (103, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), + (103, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), + (103, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), + (103, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), + (103, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), + (103, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), + (103, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), + (103, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), + (103, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), + (103, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), + (104, G[")"]): ("SHIFT", 105), + (105, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), + (105, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), + (105, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), + (105, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), + (105, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), + (105, G["then"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), + (105, G["else"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), + (105, G["fi"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), + (105, G["loop"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), + (105, G["pool"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), + (105, G["in"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), + (105, G["of"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), + (105, G["+"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), + (105, G["-"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), + (105, G["*"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), + (105, G["/"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), + (105, G["<"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), + (105, G["<="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), + (105, G["="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), + (105, G["}"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), + (106, G["}"]): ("SHIFT", 107), + (107, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), + (107, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), + (107, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), + (107, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), + (107, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), + (107, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), + (107, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), + (107, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), + (107, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), + (107, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), + (107, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), + (108, G[";"]): ("SHIFT", 109), + (109, G["string"]): ("SHIFT", 17), + (109, G["false"]): ("SHIFT", 36), + (109, G["id"]): ("SHIFT", 15), + (109, G["isvoid"]): ("SHIFT", 33), + (109, G["true"]): ("SHIFT", 35), + (109, G["while"]): ("SHIFT", 22), + (109, G["}"]): ("REDUCE", AttributeProduction(G["block"], Sentence(G["expr"], G[";"]), [lambda s: [s[1]]])), + (109, G["integer"]): ("SHIFT", 18), + (109, G["new"]): ("SHIFT", 31), + (109, G["case"]): ("SHIFT", 30), + (109, G["{"]): ("SHIFT", 19), + (109, G["("]): ("SHIFT", 20), + (109, G["if"]): ("SHIFT", 21), + (109, G["let"]): ("SHIFT", 23), + (109, G["not"]): ("SHIFT", 44), + (109, G["~"]): ("SHIFT", 37), + (110, G["}"]): ("REDUCE", AttributeProduction(G["block"], Sentence(G["expr"], G[";"], G["block"]), [lambda s: [s[1]] + s[3]])), + (111, G[")"]): ("SHIFT", 112), + (112, G[")"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), + (112, G[","]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), + (112, G["."]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), + (112, G["@"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), + (112, G[";"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), + (112, G["then"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), + (112, G["else"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), + (112, G["fi"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), + (112, G["loop"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), + (112, G["pool"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), + (112, G["in"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), + (112, G["of"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), + (112, G["+"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), + (112, G["-"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), + (112, G["*"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), + (112, G["/"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), + (112, G["<"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), + (112, G["<="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), + (112, G["="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), + (112, G["}"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), + (113, G["true"]): ("SHIFT", 35), + (113, G["let"]): ("SHIFT", 23), + (113, G["not"]): ("SHIFT", 44), + (113, G["case"]): ("SHIFT", 30), + (113, G["("]): ("SHIFT", 20), + (113, G["{"]): ("SHIFT", 19), + (113, G["string"]): ("SHIFT", 17), + (113, G["integer"]): ("SHIFT", 18), + (113, G["new"]): ("SHIFT", 31), + (113, G["while"]): ("SHIFT", 22), + (113, G["id"]): ("SHIFT", 15), + (113, G["isvoid"]): ("SHIFT", 33), + (113, G["false"]): ("SHIFT", 36), + (113, G["~"]): ("SHIFT", 37), + (113, G["if"]): ("SHIFT", 21), + (114, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), + (114, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), + (114, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), + (114, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), + (114, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), + (114, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), + (114, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), + (114, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), + (114, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), + (114, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), + (114, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), + (115, G["}"]): ("SHIFT", 116), + (116, G[";"]): ("REDUCE", AttributeProduction(G["method"], Sentence(G["id"], G["("], G[")"], G[":"], G["type"], G["{"], G["expr"], G["}"]), [lambda s: MethodDeclarationNode(s[1], [], s[5], s[7])])), + (117, G[")"]): ("SHIFT", 118), + (118, G[":"]): ("SHIFT", 119), + (119, G["type"]): ("SHIFT", 120), + (120, G["{"]): ("SHIFT", 121), + (121, G["true"]): ("SHIFT", 35), + (121, G["id"]): ("SHIFT", 15), + (121, G["{"]): ("SHIFT", 19), + (121, G["while"]): ("SHIFT", 22), + (121, G["not"]): ("SHIFT", 44), + (121, G["integer"]): ("SHIFT", 18), + (121, G["new"]): ("SHIFT", 31), + (121, G["("]): ("SHIFT", 20), + (121, G["case"]): ("SHIFT", 30), + (121, G["let"]): ("SHIFT", 23), + (121, G["if"]): ("SHIFT", 21), + (121, G["isvoid"]): ("SHIFT", 33), + (121, G["~"]): ("SHIFT", 37), + (121, G["false"]): ("SHIFT", 36), + (121, G["string"]): ("SHIFT", 17), + (122, G["}"]): ("SHIFT", 123), + (123, G[";"]): ("REDUCE", AttributeProduction(G["method"], Sentence(G["id"], G["("], G["param-list"], G[")"], G[":"], G["type"], G["{"], G["expr"], G["}"]), [lambda s: MethodDeclarationNode(s[1], s[3], s[6], s[8])])), + (124, G["type"]): ("SHIFT", 125), + (125, G["<-"]): ("SHIFT", 126), + (125, G[";"]): ("REDUCE", AttributeProduction(G["attribute"], Sentence(G["id"], G[":"], G["type"]), [lambda s: AttrDeclarationNode(s[1], s[3])])), + (126, G["string"]): ("SHIFT", 17), + (126, G["false"]): ("SHIFT", 36), + (126, G["id"]): ("SHIFT", 15), + (126, G["isvoid"]): ("SHIFT", 33), + (126, G["true"]): ("SHIFT", 35), + (126, G["while"]): ("SHIFT", 22), + (126, G["integer"]): ("SHIFT", 18), + (126, G["new"]): ("SHIFT", 31), + (126, G["case"]): ("SHIFT", 30), + (126, G["{"]): ("SHIFT", 19), + (126, G["("]): ("SHIFT", 20), + (126, G["if"]): ("SHIFT", 21), + (126, G["let"]): ("SHIFT", 23), + (126, G["not"]): ("SHIFT", 44), + (126, G["~"]): ("SHIFT", 37), + (127, G[";"]): ("REDUCE", AttributeProduction(G["attribute"], Sentence(G["id"], G[":"], G["type"], G["<-"], G["expr"]), [lambda s: AttrDeclarationNode(s[1], s[3], s[5])])), + (128, G["class"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["{"], G["}"]), [lambda s: ClassDeclarationNode(s[2], [])])), + (128, G["$"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["{"], G["}"]), [lambda s: ClassDeclarationNode(s[2], [])])), + (129, G["}"]): ("SHIFT", 130), + (130, G["class"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["{"], G["feature-list"], G["}"]), [lambda s: ClassDeclarationNode(s[2], s[4])])), + (130, G["$"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["{"], G["feature-list"], G["}"]), [lambda s: ClassDeclarationNode(s[2], s[4])])), + (131, G[";"]): ("SHIFT", 132), + (132, G["id"]): ("SHIFT", 4), + (132, G["}"]): ("REDUCE", AttributeProduction(G["feature-list"], Sentence(G["attribute"], G[";"]), [lambda s: [s[1]]])), + (133, G["}"]): ("REDUCE", AttributeProduction(G["feature-list"], Sentence(G["attribute"], G[";"], G["feature-list"]), [lambda s: [s[1]] + s[3]])), + (134, G[";"]): ("SHIFT", 135), + (135, G["id"]): ("SHIFT", 4), + (135, G["}"]): ("REDUCE", AttributeProduction(G["feature-list"], Sentence(G["method"], G[";"]), [lambda s: [s[1]]])), + (136, G["}"]): ("REDUCE", AttributeProduction(G["feature-list"], Sentence(G["method"], G[";"], G["feature-list"]), [lambda s: [s[1]] + s[3]])), + (137, G["{"]): ("SHIFT", 142), + (137, G["type"]): ("SHIFT", 138), + (138, G["{"]): ("SHIFT", 139), + (139, G["id"]): ("SHIFT", 4), + (140, G["}"]): ("SHIFT", 141), + (141, G["class"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["inherits"], G["type"], G["{"], G["feature-list"], G["}"]), [lambda s: ClassDeclarationNode(s[2], s[6], s[4])])), + (141, G["$"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["inherits"], G["type"], G["{"], G["feature-list"], G["}"]), [lambda s: ClassDeclarationNode(s[2], s[6], s[4])])), + (142, G["}"]): ("SHIFT", 143), + (143, G["$"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["inherits"], G["{"], G["}"]), [lambda s: ClassDeclarationNode(s[2], [], s[4])])), + (143, G["class"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["inherits"], G["{"], G["}"]), [lambda s: ClassDeclarationNode(s[2], [], s[4])])), + (144, G["$"]): ("OK", None), + (145, G["$"]): ("REDUCE", AttributeProduction(G["program"], Sentence(G["class-set"]), [lambda s: ProgramNode(s[1])])), + (146, G["class"]): ("SHIFT", 1), + (146, G["$"]): ("REDUCE", AttributeProduction(G["class-set"], Sentence(G["class-def"]), [lambda s: [s[1]]])), + (147, G["$"]): ("REDUCE", AttributeProduction(G["class-set"], Sentence(G["class-def"], G["class-set"]), [lambda s: [s[1]] + s[2]])), } def __goto_table(self): G = self.G return { - (0, G["class-def"]): 142, - (0, G["program"]): 140, - (0, G["class-set"]): 141, - (3, G["method"]): 132, - (3, G["feature-list"]): 127, - (3, G["attribute"]): 129, - (5, G["param-list"]): 116, + (0, G["class-def"]): 146, + (0, G["class-set"]): 145, + (0, G["program"]): 144, + (3, G["method"]): 134, + (3, G["attribute"]): 131, + (3, G["feature-list"]): 129, + (5, G["param-list"]): 117, (9, G["param-list"]): 10, - (14, G["arith"]): 55, - (14, G["comp"]): 39, - (14, G["term"]): 67, - (14, G["function-call"]): 37, - (14, G["factor"]): 68, - (14, G["expr"]): 114, - (16, G["comp"]): 39, - (16, G["expr-list"]): 110, - (16, G["term"]): 67, - (16, G["function-call"]): 37, - (16, G["expr"]): 52, - (16, G["factor"]): 68, - (16, G["arith"]): 55, - (19, G["block"]): 105, - (19, G["term"]): 67, - (19, G["arith"]): 55, - (19, G["expr"]): 107, - (19, G["function-call"]): 37, - (19, G["comp"]): 39, - (19, G["factor"]): 68, - (20, G["term"]): 67, - (20, G["arith"]): 55, - (20, G["factor"]): 68, - (20, G["expr"]): 99, - (20, G["comp"]): 39, - (20, G["function-call"]): 37, - (21, G["comp"]): 39, - (21, G["factor"]): 68, - (21, G["arith"]): 55, - (21, G["expr"]): 95, - (21, G["term"]): 67, - (21, G["function-call"]): 37, - (22, G["declaration-list"]): 92, - (26, G["declaration-list"]): 27, - (28, G["term"]): 67, - (28, G["arith"]): 55, - (28, G["factor"]): 68, - (28, G["comp"]): 39, - (28, G["function-call"]): 37, - (28, G["expr"]): 91, - (29, G["expr"]): 75, - (29, G["factor"]): 68, - (29, G["comp"]): 39, - (29, G["function-call"]): 37, - (29, G["term"]): 67, - (29, G["arith"]): 55, - (32, G["arith"]): 55, - (32, G["comp"]): 39, - (32, G["term"]): 67, - (32, G["expr"]): 74, - (32, G["function-call"]): 37, - (32, G["factor"]): 68, - (35, G["arith"]): 55, - (35, G["comp"]): 39, - (35, G["term"]): 67, - (35, G["function-call"]): 37, - (35, G["factor"]): 68, - (35, G["expr"]): 73, - (36, G["arith"]): 55, - (36, G["comp"]): 39, - (36, G["term"]): 67, - (36, G["function-call"]): 37, - (36, G["expr"]): 38, - (36, G["factor"]): 68, - (40, G["arith"]): 42, - (40, G["term"]): 67, - (40, G["function-call"]): 37, - (40, G["factor"]): 68, - (43, G["function-call"]): 37, - (43, G["term"]): 44, - (43, G["factor"]): 68, - (45, G["function-call"]): 37, - (45, G["factor"]): 46, - (49, G["comp"]): 39, - (49, G["term"]): 67, - (49, G["function-call"]): 37, - (49, G["expr"]): 52, - (49, G["factor"]): 68, - (49, G["arith"]): 55, - (49, G["expr-list"]): 50, - (53, G["comp"]): 39, - (53, G["term"]): 67, - (53, G["function-call"]): 37, - (53, G["expr"]): 52, - (53, G["arith"]): 55, - (53, G["factor"]): 68, - (53, G["expr-list"]): 54, + (14, G["comp"]): 46, + (14, G["function-call"]): 38, + (14, G["atom"]): 40, + (14, G["arith"]): 63, + (14, G["term"]): 58, + (14, G["expr"]): 115, + (14, G["factor"]): 55, + (16, G["expr-list"]): 111, + (16, G["term"]): 58, + (16, G["arith"]): 63, + (16, G["comp"]): 46, + (16, G["expr"]): 66, + (16, G["factor"]): 55, + (16, G["atom"]): 40, + (16, G["function-call"]): 38, + (19, G["comp"]): 46, + (19, G["term"]): 58, + (19, G["factor"]): 55, + (19, G["function-call"]): 38, + (19, G["atom"]): 40, + (19, G["block"]): 106, + (19, G["expr"]): 108, + (19, G["arith"]): 63, + (20, G["comp"]): 46, + (20, G["term"]): 58, + (20, G["factor"]): 55, + (20, G["atom"]): 40, + (20, G["expr"]): 104, + (20, G["arith"]): 63, + (20, G["function-call"]): 38, + (21, G["term"]): 58, + (21, G["atom"]): 40, + (21, G["comp"]): 46, + (21, G["expr"]): 98, + (21, G["arith"]): 63, + (21, G["function-call"]): 38, + (21, G["factor"]): 55, + (22, G["expr"]): 94, + (22, G["arith"]): 63, + (22, G["atom"]): 40, + (22, G["function-call"]): 38, + (22, G["comp"]): 46, + (22, G["term"]): 58, + (22, G["factor"]): 55, + (23, G["declaration-list"]): 91, + (27, G["declaration-list"]): 28, + (29, G["arith"]): 63, + (29, G["expr"]): 88, + (29, G["comp"]): 46, + (29, G["term"]): 58, + (29, G["atom"]): 40, + (29, G["factor"]): 55, + (29, G["function-call"]): 38, + (30, G["term"]): 58, + (30, G["factor"]): 55, + (30, G["arith"]): 63, + (30, G["comp"]): 46, + (30, G["atom"]): 40, + (30, G["expr"]): 77, + (30, G["function-call"]): 38, + (33, G["atom"]): 40, + (33, G["function-call"]): 38, + (33, G["factor"]): 76, + (37, G["factor"]): 39, + (37, G["atom"]): 40, + (37, G["function-call"]): 38, + (43, G["term"]): 58, + (43, G["arith"]): 63, + (43, G["comp"]): 46, + (43, G["expr"]): 66, + (43, G["expr-list"]): 64, + (43, G["factor"]): 55, + (43, G["atom"]): 40, + (43, G["function-call"]): 38, + (44, G["term"]): 58, + (44, G["atom"]): 40, + (44, G["arith"]): 63, + (44, G["function-call"]): 38, + (44, G["comp"]): 46, + (44, G["factor"]): 55, + (44, G["expr"]): 45, + (47, G["arith"]): 48, + (47, G["term"]): 58, + (47, G["atom"]): 40, + (47, G["function-call"]): 38, + (47, G["factor"]): 55, + (49, G["atom"]): 40, + (49, G["term"]): 50, + (49, G["function-call"]): 38, + (49, G["factor"]): 55, + (51, G["factor"]): 52, + (51, G["atom"]): 40, + (51, G["function-call"]): 38, + (53, G["factor"]): 54, + (53, G["atom"]): 40, + (53, G["function-call"]): 38, (56, G["term"]): 57, - (56, G["function-call"]): 37, - (56, G["factor"]): 68, - (58, G["factor"]): 59, - (58, G["function-call"]): 37, - (64, G["comp"]): 39, - (64, G["term"]): 67, - (64, G["function-call"]): 37, - (64, G["expr"]): 52, - (64, G["factor"]): 68, - (64, G["expr-list"]): 65, - (64, G["arith"]): 55, - (69, G["arith"]): 70, - (69, G["term"]): 67, - (69, G["function-call"]): 37, - (69, G["factor"]): 68, - (71, G["arith"]): 72, - (71, G["term"]): 67, - (71, G["function-call"]): 37, - (71, G["factor"]): 68, - (76, G["case-list"]): 83, - (80, G["factor"]): 68, - (80, G["arith"]): 55, - (80, G["term"]): 67, - (80, G["expr"]): 81, - (80, G["comp"]): 39, - (80, G["function-call"]): 37, - (87, G["factor"]): 68, - (87, G["arith"]): 55, - (87, G["term"]): 67, - (87, G["comp"]): 39, - (87, G["function-call"]): 37, - (87, G["expr"]): 88, - (93, G["arith"]): 55, - (93, G["comp"]): 39, - (93, G["term"]): 67, - (93, G["function-call"]): 37, - (93, G["expr"]): 94, - (93, G["factor"]): 68, - (96, G["arith"]): 55, - (96, G["comp"]): 39, - (96, G["term"]): 67, - (96, G["function-call"]): 37, - (96, G["factor"]): 68, - (96, G["expr"]): 97, - (100, G["arith"]): 55, - (100, G["factor"]): 68, - (100, G["term"]): 67, - (100, G["comp"]): 39, - (100, G["expr"]): 101, - (100, G["function-call"]): 37, - (102, G["comp"]): 39, - (102, G["arith"]): 55, - (102, G["function-call"]): 37, - (102, G["term"]): 67, - (102, G["factor"]): 68, - (102, G["expr"]): 103, - (108, G["term"]): 67, - (108, G["arith"]): 55, - (108, G["block"]): 109, - (108, G["expr"]): 107, - (108, G["function-call"]): 37, - (108, G["comp"]): 39, - (108, G["factor"]): 68, - (112, G["arith"]): 55, - (112, G["comp"]): 39, - (112, G["term"]): 67, - (112, G["function-call"]): 37, - (112, G["factor"]): 68, - (112, G["expr"]): 113, - (120, G["arith"]): 55, - (120, G["comp"]): 39, - (120, G["term"]): 67, - (120, G["function-call"]): 37, - (120, G["expr"]): 121, - (120, G["factor"]): 68, - (125, G["factor"]): 68, - (125, G["arith"]): 55, - (125, G["term"]): 67, - (125, G["comp"]): 39, - (125, G["function-call"]): 37, - (125, G["expr"]): 126, - (130, G["feature-list"]): 131, - (130, G["method"]): 132, - (130, G["attribute"]): 129, - (133, G["method"]): 132, - (133, G["attribute"]): 129, - (133, G["feature-list"]): 134, - (137, G["method"]): 132, - (137, G["feature-list"]): 138, - (137, G["attribute"]): 129, - (142, G["class-def"]): 142, - (142, G["class-set"]): 143, + (56, G["atom"]): 40, + (56, G["function-call"]): 38, + (56, G["factor"]): 55, + (59, G["term"]): 58, + (59, G["arith"]): 60, + (59, G["atom"]): 40, + (59, G["function-call"]): 38, + (59, G["factor"]): 55, + (61, G["arith"]): 62, + (61, G["term"]): 58, + (61, G["atom"]): 40, + (61, G["function-call"]): 38, + (61, G["factor"]): 55, + (67, G["term"]): 58, + (67, G["expr-list"]): 68, + (67, G["arith"]): 63, + (67, G["comp"]): 46, + (67, G["function-call"]): 38, + (67, G["expr"]): 66, + (67, G["factor"]): 55, + (67, G["atom"]): 40, + (73, G["term"]): 58, + (73, G["arith"]): 63, + (73, G["comp"]): 46, + (73, G["expr"]): 66, + (73, G["factor"]): 55, + (73, G["atom"]): 40, + (73, G["expr-list"]): 74, + (73, G["function-call"]): 38, + (78, G["case-list"]): 86, + (82, G["comp"]): 46, + (82, G["term"]): 58, + (82, G["factor"]): 55, + (82, G["function-call"]): 38, + (82, G["expr"]): 83, + (82, G["atom"]): 40, + (82, G["arith"]): 63, + (84, G["case-list"]): 85, + (89, G["declaration-list"]): 90, + (92, G["expr"]): 93, + (92, G["term"]): 58, + (92, G["atom"]): 40, + (92, G["arith"]): 63, + (92, G["comp"]): 46, + (92, G["factor"]): 55, + (92, G["function-call"]): 38, + (95, G["term"]): 58, + (95, G["arith"]): 63, + (95, G["function-call"]): 38, + (95, G["factor"]): 55, + (95, G["comp"]): 46, + (95, G["atom"]): 40, + (95, G["expr"]): 96, + (99, G["comp"]): 46, + (99, G["function-call"]): 38, + (99, G["arith"]): 63, + (99, G["term"]): 58, + (99, G["atom"]): 40, + (99, G["factor"]): 55, + (99, G["expr"]): 100, + (101, G["atom"]): 40, + (101, G["expr"]): 102, + (101, G["term"]): 58, + (101, G["function-call"]): 38, + (101, G["arith"]): 63, + (101, G["comp"]): 46, + (101, G["factor"]): 55, + (109, G["block"]): 110, + (109, G["comp"]): 46, + (109, G["term"]): 58, + (109, G["factor"]): 55, + (109, G["function-call"]): 38, + (109, G["atom"]): 40, + (109, G["expr"]): 108, + (109, G["arith"]): 63, + (113, G["term"]): 58, + (113, G["atom"]): 40, + (113, G["arith"]): 63, + (113, G["expr"]): 114, + (113, G["comp"]): 46, + (113, G["factor"]): 55, + (113, G["function-call"]): 38, + (121, G["comp"]): 46, + (121, G["function-call"]): 38, + (121, G["expr"]): 122, + (121, G["atom"]): 40, + (121, G["arith"]): 63, + (121, G["term"]): 58, + (121, G["factor"]): 55, + (126, G["comp"]): 46, + (126, G["term"]): 58, + (126, G["factor"]): 55, + (126, G["function-call"]): 38, + (126, G["atom"]): 40, + (126, G["arith"]): 63, + (126, G["expr"]): 127, + (132, G["method"]): 134, + (132, G["attribute"]): 131, + (132, G["feature-list"]): 133, + (135, G["method"]): 134, + (135, G["attribute"]): 131, + (135, G["feature-list"]): 136, + (139, G["method"]): 134, + (139, G["attribute"]): 131, + (139, G["feature-list"]): 140, + (146, G["class-def"]): 146, + (146, G["class-set"]): 147, } diff --git a/scope.py b/scope.py new file mode 100644 index 000000000..bc4f28c86 --- /dev/null +++ b/scope.py @@ -0,0 +1,25 @@ +class VariableInfo: + def __init__(self, name, typex): + self.name = name + self.type = typex + + +class FunctionInfo: + def __init__(self, name, params, return_type, typex=None): + self.name = name + self.params = params + self.return_type = return_type + self.type = typex + + +class ClassInfo: + def __init__(self): + pass + + +class Scope: + def __init__(self, parent=None): + self.variables = {} + self.functions = {} + self.classes = {} + self.parent = parent diff --git a/scripts/program.cool b/scripts/program.cool new file mode 100644 index 000000000..e255c7571 --- /dev/null +++ b/scripts/program.cool @@ -0,0 +1,16 @@ +class A { + a : Int; + suma (a : Int, b : Int) : Int { + a + b + }; + b : Int <- 8; +} + +class B inherits A { + a : A; + f (d : Int, a : A) : Void {{ + let f : Int <- 8, c : A <- new A in + c.suma(5 ,f); + c; + }}; +} diff --git a/semantic.py b/semantic.py new file mode 100644 index 000000000..223e4fb5f --- /dev/null +++ b/semantic.py @@ -0,0 +1,15 @@ +import cmp.visitor as visitor +from ast import ProgramNode + + +class SemanticChecker: + def __init__(self): + pass + + @visitor.on('node') + def visit(self, node, scope): + pass + + @visitor.when(ProgramNode) + def visit(self, node: ProgramNode, scope=None): + pass \ No newline at end of file diff --git a/test.py b/test.py deleted file mode 100644 index 797cffef3..000000000 --- a/test.py +++ /dev/null @@ -1,61 +0,0 @@ -import os -import inspect -import ast as ast - -from cmp.serializer import LexerSerializer, LRParserSerializer -from definitions import cool_parser, cool_lexer - - -def open_or_create(file): - try: - return open(file, 'x') - except FileExistsError: - return open(file, 'w') - - -class LexerInfo: - def __init__(self, lexer, class_name, file_name): - self.lexer = lexer - self.class_name = class_name - self.file_name = file_name - - -class ParserInfo: - def __init__(self, parser, ast_module, class_name, file_name): - self.parser = parser - self.ast_module = ast_module - self.class_name = class_name - self.file_name = file_name - - -class Modularizer: - def __init__(self, module_name, parser_info=None, lexer_info=None): - self.module_name = module_name - self.parser_info = parser_info - self.lexer_info = lexer_info - - def build(self): - os.makedirs(self.module_name, exist_ok=True) - open_or_create(self.module_name + '/__init__.py') - self.build_module() - self.build_ast() - - def build_ast(self): - f = open_or_create(self.module_name + '/ast.py') - f.write(inspect.getsource(self.parser_info.ast_module)) - f.close() - - def build_module(self): - LRParserSerializer.build(self.parser_info.parser, self.parser_info.class_name, - self.module_name + '/' + self.parser_info.file_name) - - LexerSerializer.build(self.lexer_info.lexer, self.lexer_info.class_name, - self.module_name + '/' + self.lexer_info.file_name) - - -if __name__ == '__main__': - Modularizer( - module_name='coolx', - parser_info=ParserInfo(cool_parser(), ast, 'CoolParser', 'parser.py'), - lexer_info=LexerInfo(cool_lexer(), 'CoolLexer', 'lexer.py') - ).build() diff --git a/tests.py b/tests.py new file mode 100644 index 000000000..015c21232 --- /dev/null +++ b/tests.py @@ -0,0 +1,34 @@ +import fire + +from definitions import cool_grammar +from lexer import CoolLexer +from parser import CoolParser + +G = cool_grammar() +lexer = CoolLexer(G) +parser = CoolParser(G) + + +class Tester: + @staticmethod + def tokenize(script, print_tokens=True): + file = f'scripts/{script}' + program = ''.join(open(file, 'r').read()) + + tokens = [t for t in lexer(program) if t.token_type not in (G['space'], G['newline'], G['tab'])] + + if print_tokens: + for t in tokens: + print(t) + + return tokens + + @staticmethod + def parse(script): + tokens = Tester.tokenize(script, print_tokens=False) + _, ast = parser(tokens, get_ast=True) + print(ast) + + +if __name__ == '__main__': + fire.Fire(Tester()) From d505eeaaab1aae75a60f71d59648668519f704ec Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Tue, 14 Apr 2020 21:26:19 -0400 Subject: [PATCH 005/143] testing new lexer --- astnodes.py | 12 +- cmp/__pycache__/pycompiler.cpython-37.pyc | Bin 17315 -> 17384 bytes cmp/parsing/new_lexer.py | 78 ++ cmp/pycompiler.py | 10 +- cmp/serializer/parser_serializer.py | 9 +- definitions.py | 8 +- lexer.py | 60 +- parser.py | 1143 ++++++++++----------- tests.py | 13 +- 9 files changed, 713 insertions(+), 620 deletions(-) create mode 100644 cmp/parsing/new_lexer.py diff --git a/astnodes.py b/astnodes.py index 9231381a9..fd629952d 100644 --- a/astnodes.py +++ b/astnodes.py @@ -3,8 +3,8 @@ class Node: class ProgramNode(Node): - def __init__(self, class_list): - self.class_list = class_list + def __init__(self, declarations): + self.declarations = declarations class DeclarationNode(Node): @@ -31,10 +31,10 @@ def __init__(self, idx, params, return_type, body): class AttrDeclarationNode(DeclarationNode): - def __init__(self, idx, typex, expresion=None): + def __init__(self, idx, typex, expr=None): self.id = idx self.type = typex - self.expresion = expresion + self.expr = expr class ParamNode(DeclarationNode): @@ -44,8 +44,8 @@ def __init__(self, idx, typex): class BlockNode(ExpressionNode): - def __init__(self, exprs): - self.expressions = exprs + def __init__(self, expressions): + self.expressions = expressions class LetNode(ExpressionNode): diff --git a/cmp/__pycache__/pycompiler.cpython-37.pyc b/cmp/__pycache__/pycompiler.cpython-37.pyc index 40dad1701ae44783debc64f3c55ad1b8ce98c38f..973eba12c33aac0cb9bf1315bbb653bce2104afe 100644 GIT binary patch delta 1942 zcmZ`(3v5$W81CQowq4hDUAwkx_g*))Zgkz&Jvzs_2ZN0=8P97-|zqL zIro{ZbZIN;TXi~(jQtF!uxw8CA$^(3c!gxLs4PZN8j*{$VkB0eU6ofF)<@-|vQb$` z2q{P8gN%oSF;z^ymxx8@B~sKZWj%&frrv+=B(a^xd4(7&`#;&qBl7Je9*Am~hJs0} z6_LZyl+DD=1Qj+JH^lahiIsQ*->N1Lg)Iq7D~N@Yg0d}go6IU3q=_QR)jXw|?WuT# zml>gSS=}wg?PySGm2q{XJDL(ykI>&9%-Uk{^|y?$W?0qjQSB%;sWZBC!DKG~&xz4go2F=~@7%^FOSX21&ka|YXK;EjceIi})kb(ktKKY2Gz$M?xWGGKuwU#*(9F0yJ( ze;D^_HtE{_s6ejA4UH|?Kx!(NTiD8;vVoQZDPdXxxppOm5Yl=L)ht0Q;84S% z7B6d?Rn=OBRv|iY)NVtGQi~kjF&e-H-4cO|qVVaL3bl-Fz?eQrF$k$mhD18Ak;$PB zGjr`$FQfhJA5k+<%hQvj!d|2*ZFnkm3sQ{&N(^NrsnhD2Xqctkg6)fqsLalxZP;Xdm>O}+R48Py@FVb;UZKZu$rPf!n3ujRB_ZY+ zZX8W7qJ1pGitFh$ENfVA!*Pp3wJO>t_Vnz>JaapX?l!yVAWoa3jHjA%aJNNGFQCuT zLcWO%4aITB(nE()X6-Vx^5T5-;xrD^@uZ_burT@n4q0ENCY;ML2?n-)6T=xX>cHhMy-TMgTX0qZ# z1{?O|o}eEQ$Qz=c@kL&Ye#Nrg zXt_aZIl>~(W1#jty^cHUF0!c}YBFimQ`Q95E)NEL?_jQXK{_ws6r@Rw3oH7?-afGb zN4#Zp5*NK;Gas8MIa|(I8izK7>N}`79)3 z*|<}>57*%Gb+P*}=yOW<;TJsTo6EGn`)cVo)HH<{A8T^cA2{2zk#T=>9VxN7`CWD( z=d`RMEsnHA*;l%vwOcyk?8C6FwT)fXbFIB*$s7ORiF|6Jje`p_rnZ~f4Mu~YuhCnL Nx%x~)rhZ6P`6su!=mY=& delta 1902 zcmZ`(Yiv_x7(Q>;bJp8R>DrZcm#(|ATf41{UD&1D7=vvAf?NcIGS=xXFvjT-nRd>w zz%UM2_K5rdQ7*ywLs5%Dj6sY)FvLI>ey9bFL==>mfM^gg#_v0w@CTdp$#dTK`QF=k zzjJepj*XGIDJjVyu;0+ouJvL6`{trV^9LjdiVz`%Mm2H`+7mNJb_;#tn^Ht`gh<#e zJP~&%GWSMBvs+LSA~edx!;C*hm%wzpxQ?m*Poo>vOprXN=y{}2LccbAR59!zUPegk zOcc~wuEMA*9+}oi{Tlgi=1t_!Oe2hvO{f%xDeiw{4M`56pG6O6D29-3lpaPE6xIQ= z*H33*eW+DDsTg^!JSM}0kg!w3q9+V%26T!kf6x%0#2lDVnKRV?vj4J3WP~#sS)ZcGEKy zLex}c@iU>E#bFMI3Oq0c$cx&fU#K7X=CvX>4`9r^PORVp{A>=QRZ32F{TR!dzEfE7(9YQ_Eu)S zZZDzZu%;-C@6F24$E0AeduuTG7T!&1q`HTvdOE{B!QeZvIfC>a6vq-vBhT8*VLpcz zTz2HqOZdxin(8rSP8Kc9d>R*KMW_|6PA`3oZO%3+z{RaBu1n+*&M`q6PT8%vZPg>q zwLog;0-f5fi_y<9?rMk|8!_eb(1*C|I-rjwwhV@QH*FcfzEqhm;!;KmW~H^!6uQzn zL1_+LNn567_)7IHOz)r=_NRB!x46f6hnj#_{ylm!TGdWnVhelzf$7)NPw=|ybJQNw zc|m;g(~WYb?$e{C5IdOhOPqA4vcS`?7}wpO(XTj>IYM`k=ZVnoIOYkfCEY`6)}+Lf zKM)Yj>Y%#G>>P<@>VB}ziiMPNO^lZUw%EFC; z>rw+ZlwqncnHJ&4LO+$jS@bE*gW2F@_wjDgT#4_S+yGy36$Q{!d?8m|#TCpN(<(!Q z-STQKDCMw(LoSC!SXJT{OBh{%7fKG<<9WD;UoCl6TvO~V5c%^`tnt2)#94tx&gZ^( z0qc)wq?k6;sdUOU+_ILz8fjq5@@{#vTn<#^ z5OAjAk|RDvE?L75Y2+l%Yt#!7X7mI;ntO$!n5?|PCRv(b!`><#oyUQy6*hjhKvYk} z#HY8&UEOlcWOWgpMRE0joewNNp^co)Tw(bsr=o=lgcmRj~{@xfi! z!ZyCUE=)J^P2H;^U!+@*>z5eo_|YJT5gZO=NHX8N-*CHrS$uq|Ybh2txv{AsiT=Rz z4SkY2*dRtc8PEkxbRYJ>5X-VJP)P#L2QIRee66vUq{$|Q40yI_rMlnjvoO^(pWVuo n<}SNBQ2t3&2P!)`WB0JRHM!AZwTR{lv%~5(r&?0YBSP7~()Z>@ diff --git a/cmp/parsing/new_lexer.py b/cmp/parsing/new_lexer.py new file mode 100644 index 000000000..92a48fdcd --- /dev/null +++ b/cmp/parsing/new_lexer.py @@ -0,0 +1,78 @@ +import re + +from cmp.utils import Token + + +class Lexer: + def __init__(self, table, eof): + self.table = table + self.pattern = self.__build_regex(self.table) + self.eof = eof + + @staticmethod + def __build_regex(table): + r = '|'.join([f'(?P<{alias}>{regex})' for alias, (_, regex) in table.items()]) + return re.compile(r) + + def __tokenize(self, text): + pos = 0 + while pos < len(text): + if text[pos] in (' ', '\n', '\t'): + pos += 1 + else: + match = self.pattern.match(text, pos=pos) + yield match.group(), match.lastgroup + pos = match.end() + yield '$', self.eof + + def __call__(self, text): + return [Token(lex, self.table[alias][0]) for lex, alias in self.__tokenize(text)] + + +if __name__ == '__main__': + def get_lexer(G): + return Lexer({ + 'add': (G['+'], '\+'), + 'sub': (G['-'], '-'), + 'mul': (G['*'], '\*'), + 'div': (G['/'], '/'), + 'le': (G['<='], '<='), + 'lt': (G['<'], '<'), + 'eq': (G['='], '='), + 'comp': (G['~'], '~'), + 'not': (G['not'], 'not'), + 'ocur': (G['{'], '{'), + 'ccur': (G['}'], '}'), + 'opar': (G['('], '\('), + 'cpar': (G[')'], '\)'), + 'coma': (G[','], ','), + 'dot': (G['.'], '.'), + 'arroba': (G['@'], '@'), + 'colon': (G[':'], ':'), + 'semicolon': (G[';'], ';'), + 'assign': (G['<-'], '<-'), + 'arrow': (G['=>'], '=>'), + 'class': (G['class'], 'class'), + 'inherits': (G['inherits'], 'inherits'), + 'if': (G['if'], 'if'), + 'then': (G['then'], 'then'), + 'else': (G['else'], 'else'), + 'fi': (G['fi'], 'fi'), + 'while': (G['while'], 'while'), + 'loop': (G['loop'], 'loop'), + 'pool': (G['pool'], 'pool'), + 'let': (G['let'], 'let'), + 'in': (G['in'], 'in'), + 'case': (G['case'], 'case'), + 'esac': (G['esac'], 'esac'), + 'of': (G['of'], 'of'), + 'new': (G['new'], 'new'), + 'isvoid': (G['isvoid'], 'isvoid'), + 'true': (G['true'], 'true'), + 'false': (G['false'], 'false'), + 'end': (G['end'], 'end'), + 'int': (G['integer'], '-?[1-9][0-9]*'), + 'type': (G['type'], '[A-Z][a-zA-Z0-9]*'), + 'id': (G['id'], '[a-z][a-zA-Z0-9]*'), + 'string': (G['string'], '"[ -~]*"'), + }, G.EOF) diff --git a/cmp/pycompiler.py b/cmp/pycompiler.py index f93cfe87f..4f4de826d 100755 --- a/cmp/pycompiler.py +++ b/cmp/pycompiler.py @@ -45,7 +45,10 @@ def __init__(self, name, grammar): def __imod__(self, other): if isinstance(other, str): - p = Production(self, Sentence(*(self.Grammar[s] for s in other.split()))) + if other: + p = Production(self, Sentence(*(self.Grammar[s] for s in other.split()))) + else: + p = Production(self, self.Grammar.Epsilon) self.Grammar.AddProduction(p) return self @@ -63,7 +66,10 @@ def __imod__(self, other): assert len(other) > 1 if isinstance(other[0], str): - other = (Sentence(*(self.Grammar[s] for s in other[0].split())),) + other[1:] + if other[0]: + other = (Sentence(*(self.Grammar[s] for s in other[0].split())),) + other[1:] + else: + other = (self.Grammar.Epsilon,) + other[1:] if len(other) == 2: other += (None,) * len(other[0]) diff --git a/cmp/serializer/parser_serializer.py b/cmp/serializer/parser_serializer.py index 8ea9caafe..e1e8bba9e 100644 --- a/cmp/serializer/parser_serializer.py +++ b/cmp/serializer/parser_serializer.py @@ -1,5 +1,7 @@ import inspect +from cmp.pycompiler import Epsilon + TEMPLATE = """from abc import ABC from cmp.parsing import ShiftReduceParser from cmp.pycompiler import AttributeProduction, Sentence @@ -62,8 +64,11 @@ def __build_parsing_tables(parser): s1 += f'("{act}", {tag}),\n' elif act == 'REDUCE': head, body = tag - body = ', '.join(f'G["{s}"]' for s in body) - s1 += f'("{act}", AttributeProduction(G["{head}"], Sentence({body}), [{lambdas[repr(tag)]}])),\n' + if isinstance(body, Epsilon): + s1 += f'("{act}", AttributeProduction(G["{head}"], G.Epsilon, [{lambdas[repr(tag)]}])),\n' + else: + body = ', '.join(f'G["{s}"]' for s in body) + s1 += f'("{act}", AttributeProduction(G["{head}"], Sentence({body}), [{lambdas[repr(tag)]}])),\n' else: s1 += f'("{act}", None),\n' diff --git a/definitions.py b/definitions.py index 5c6d0f695..1a2c5dcc4 100644 --- a/definitions.py +++ b/definitions.py @@ -107,13 +107,10 @@ class_set %= 'class-def', lambda s: [s[1]] class_set %= 'class-def class-set', lambda s: [s[1]] + s[2] -class_def %= 'class type { }', lambda s: ClassDeclarationNode(s[2], []) -class_def %= 'class type inherits { }', lambda s: ClassDeclarationNode(s[2], [], s[4]) class_def %= 'class type { feature-list }', lambda s: ClassDeclarationNode(s[2], s[4]) class_def %= 'class type inherits type { feature-list }', lambda s: ClassDeclarationNode(s[2], s[6], s[4]) -feature_list %= 'attribute ;', lambda s: [s[1]] -feature_list %= 'method ;', lambda s: [s[1]] +feature_list %= '', lambda s: [] feature_list %= 'attribute ; feature-list', lambda s: [s[1]] + s[3] feature_list %= 'method ; feature-list', lambda s: [s[1]] + s[3] @@ -149,7 +146,7 @@ term %= 'factor', lambda s: s[1] factor %= 'isvoid factor', lambda s: IsVoidNode(s[2]) -factor %= '~ factor', lambda s: IsVoidNode(s[2]) +factor %= '~ factor', lambda s: ComplementNode(s[2]) factor %= 'atom', lambda s: s[1] atom %= 'id', lambda s: VariableNode(s[1]) @@ -244,4 +241,5 @@ def cool_lexer(): parser = cool_parser() print('Building Time :', time.time() - t, 'sec') print('Action Table Entries :', len(parser.action)) + print('Got Table Entries :', len(parser.goto)) print('Presents Conflicts :', parser.conflict is not None) diff --git a/lexer.py b/lexer.py index 447b5d8d4..8f540613b 100644 --- a/lexer.py +++ b/lexer.py @@ -15,50 +15,50 @@ def __table(self): return [ (G["+"], NFA(2, [0], {(1, "+"): [0], }, start=1)), (G["-"], NFA(2, [0], {(1, "-"): [0], }, start=1)), - (G["*"], NFA(2, [1], {(0, "*"): [1], }, start=0)), + (G["*"], NFA(2, [0], {(1, "*"): [0], }, start=1)), (G["/"], NFA(2, [1], {(0, "/"): [1], }, start=0)), - (G["<="], NFA(3, [0], {(1, "<"): [2], (2, "="): [0], }, start=1)), + (G["<="], NFA(3, [1], {(0, "<"): [2], (2, "="): [1], }, start=0)), (G["<"], NFA(2, [1], {(0, "<"): [1], }, start=0)), - (G["="], NFA(2, [0], {(1, "="): [0], }, start=1)), - (G["~"], NFA(2, [0], {(1, "~"): [0], }, start=1)), - (G["not"], NFA(4, [2], {(1, "n"): [3], (3, "o"): [0], (0, "t"): [2], }, start=1)), + (G["="], NFA(2, [1], {(0, "="): [1], }, start=0)), + (G["~"], NFA(2, [1], {(0, "~"): [1], }, start=0)), + (G["not"], NFA(4, [1], {(2, "n"): [3], (3, "o"): [0], (0, "t"): [1], }, start=2)), (G["{"], NFA(2, [1], {(0, "{"): [1], }, start=0)), (G["}"], NFA(2, [0], {(1, "}"): [0], }, start=1)), - (G["("], NFA(2, [1], {(0, "("): [1], }, start=0)), + (G["("], NFA(2, [0], {(1, "("): [0], }, start=1)), (G[")"], NFA(2, [1], {(0, ")"): [1], }, start=0)), (G[","], NFA(2, [1], {(0, ","): [1], }, start=0)), (G["."], NFA(2, [0], {(1, "."): [0], }, start=1)), - (G["@"], NFA(2, [0], {(1, "@"): [0], }, start=1)), - (G[":"], NFA(2, [1], {(0, ":"): [1], }, start=0)), - (G[";"], NFA(2, [0], {(1, ";"): [0], }, start=1)), - (G["<-"], NFA(3, [2], {(0, "<"): [1], (1, "-"): [2], }, start=0)), - (G["=>"], NFA(3, [0], {(1, "="): [2], (2, ">"): [0], }, start=1)), - (G["class"], NFA(6, [2], {(5, "c"): [0], (0, "l"): [1], (1, "a"): [4], (4, "s"): [3], (3, "s"): [2], }, start=5)), - (G["inherits"], NFA(9, [7], {(0, "i"): [1], (1, "n"): [2], (2, "h"): [4], (4, "e"): [5], (5, "r"): [6], (6, "i"): [8], (8, "t"): [3], (3, "s"): [7], }, start=0)), + (G["@"], NFA(2, [1], {(0, "@"): [1], }, start=0)), + (G[":"], NFA(2, [0], {(1, ":"): [0], }, start=1)), + (G[";"], NFA(2, [1], {(0, ";"): [1], }, start=0)), + (G["<-"], NFA(3, [1], {(0, "<"): [2], (2, "-"): [1], }, start=0)), + (G["=>"], NFA(3, [2], {(0, "="): [1], (1, ">"): [2], }, start=0)), + (G["class"], NFA(6, [5], {(0, "c"): [1], (1, "l"): [2], (2, "a"): [3], (3, "s"): [4], (4, "s"): [5], }, start=0)), + (G["inherits"], NFA(9, [6], {(3, "i"): [7], (7, "n"): [8], (8, "h"): [1], (1, "e"): [2], (2, "r"): [4], (4, "i"): [0], (0, "t"): [5], (5, "s"): [6], }, start=3)), (G["if"], NFA(3, [0], {(2, "i"): [1], (1, "f"): [0], }, start=2)), - (G["then"], NFA(5, [4], {(3, "t"): [2], (2, "h"): [1], (1, "e"): [0], (0, "n"): [4], }, start=3)), - (G["else"], NFA(5, [2], {(3, "e"): [4], (4, "l"): [0], (0, "s"): [1], (1, "e"): [2], }, start=3)), - (G["fi"], NFA(3, [2], {(0, "f"): [1], (1, "i"): [2], }, start=0)), - (G["while"], NFA(6, [1], {(2, "w"): [3], (3, "h"): [4], (4, "i"): [5], (5, "l"): [0], (0, "e"): [1], }, start=2)), - (G["loop"], NFA(5, [4], {(0, "l"): [1], (1, "o"): [2], (2, "o"): [3], (3, "p"): [4], }, start=0)), + (G["then"], NFA(5, [1], {(0, "t"): [3], (3, "h"): [2], (2, "e"): [4], (4, "n"): [1], }, start=0)), + (G["else"], NFA(5, [0], {(2, "e"): [3], (3, "l"): [1], (1, "s"): [4], (4, "e"): [0], }, start=2)), + (G["fi"], NFA(3, [2], {(1, "f"): [0], (0, "i"): [2], }, start=1)), + (G["while"], NFA(6, [0], {(1, "w"): [2], (2, "h"): [3], (3, "i"): [4], (4, "l"): [5], (5, "e"): [0], }, start=1)), + (G["loop"], NFA(5, [2], {(0, "l"): [3], (3, "o"): [4], (4, "o"): [1], (1, "p"): [2], }, start=0)), (G["pool"], NFA(5, [2], {(3, "p"): [4], (4, "o"): [0], (0, "o"): [1], (1, "l"): [2], }, start=3)), - (G["let"], NFA(4, [1], {(0, "l"): [2], (2, "e"): [3], (3, "t"): [1], }, start=0)), + (G["let"], NFA(4, [2], {(1, "l"): [3], (3, "e"): [0], (0, "t"): [2], }, start=1)), (G["in"], NFA(3, [2], {(1, "i"): [0], (0, "n"): [2], }, start=1)), (G["case"], NFA(5, [4], {(0, "c"): [1], (1, "a"): [2], (2, "s"): [3], (3, "e"): [4], }, start=0)), - (G["esac"], NFA(5, [3], {(4, "e"): [1], (1, "s"): [0], (0, "a"): [2], (2, "c"): [3], }, start=4)), - (G["of"], NFA(3, [0], {(1, "o"): [2], (2, "f"): [0], }, start=1)), - (G["new"], NFA(4, [1], {(3, "n"): [2], (2, "e"): [0], (0, "w"): [1], }, start=3)), - (G["isvoid"], NFA(7, [2], {(4, "i"): [6], (6, "s"): [5], (5, "v"): [3], (3, "o"): [1], (1, "i"): [0], (0, "d"): [2], }, start=4)), + (G["esac"], NFA(5, [0], {(1, "e"): [3], (3, "s"): [4], (4, "a"): [2], (2, "c"): [0], }, start=1)), + (G["of"], NFA(3, [1], {(2, "o"): [0], (0, "f"): [1], }, start=2)), + (G["new"], NFA(4, [3], {(0, "n"): [1], (1, "e"): [2], (2, "w"): [3], }, start=0)), + (G["isvoid"], NFA(7, [2], {(4, "i"): [1], (1, "s"): [6], (6, "v"): [5], (5, "o"): [3], (3, "i"): [0], (0, "d"): [2], }, start=4)), (G["true"], NFA(5, [4], {(0, "t"): [1], (1, "r"): [2], (2, "u"): [3], (3, "e"): [4], }, start=0)), - (G["false"], NFA(6, [2], {(0, "f"): [1], (1, "a"): [5], (5, "l"): [3], (3, "s"): [4], (4, "e"): [2], }, start=0)), + (G["false"], NFA(6, [5], {(1, "f"): [3], (3, "a"): [0], (0, "l"): [2], (2, "s"): [4], (4, "e"): [5], }, start=1)), (G["end"], NFA(4, [2], {(1, "e"): [3], (3, "n"): [0], (0, "d"): [2], }, start=1)), - (G["space"], NFA(2, [0], {(1, " "): [0], (0, " "): [0], }, start=1)), + (G["space"], NFA(2, [1], {(0, " "): [1], (1, " "): [1], }, start=0)), (G["newline"], NFA(2, [1], {(0, "\n"): [1], (1, "\n"): [1], }, start=0)), - (G["tab"], NFA(2, [0], {(1, "\t"): [0], (0, "\t"): [0], }, start=1)), - (G["integer"], NFA(3, [0], {(1, "4"): [0], (1, "5"): [0], (1, "3"): [0], (1, "8"): [0], (1, "9"): [0], (1, "1"): [0], (1, "-"): [2], (1, "6"): [0], (1, "2"): [0], (1, "7"): [0], (0, "4"): [0], (0, "5"): [0], (0, "0"): [0], (0, "3"): [0], (0, "8"): [0], (0, "9"): [0], (0, "1"): [0], (0, "6"): [0], (0, "2"): [0], (0, "7"): [0], (2, "4"): [0], (2, "5"): [0], (2, "3"): [0], (2, "8"): [0], (2, "9"): [0], (2, "1"): [0], (2, "6"): [0], (2, "2"): [0], (2, "7"): [0], }, start=1)), - (G["type"], NFA(2, [0], {(1, "G"): [0], (1, "A"): [0], (1, "Z"): [0], (1, "C"): [0], (1, "H"): [0], (1, "B"): [0], (1, "N"): [0], (1, "J"): [0], (1, "O"): [0], (1, "Y"): [0], (1, "R"): [0], (1, "L"): [0], (1, "M"): [0], (1, "S"): [0], (1, "V"): [0], (1, "K"): [0], (1, "P"): [0], (1, "U"): [0], (1, "F"): [0], (1, "X"): [0], (1, "T"): [0], (1, "E"): [0], (1, "I"): [0], (1, "Q"): [0], (1, "D"): [0], (1, "W"): [0], (0, "G"): [0], (0, "A"): [0], (0, "Z"): [0], (0, "3"): [0], (0, "C"): [0], (0, "d"): [0], (0, "k"): [0], (0, "9"): [0], (0, "H"): [0], (0, "o"): [0], (0, "1"): [0], (0, "g"): [0], (0, "u"): [0], (0, "B"): [0], (0, "7"): [0], (0, "p"): [0], (0, "i"): [0], (0, "t"): [0], (0, "4"): [0], (0, "N"): [0], (0, "j"): [0], (0, "J"): [0], (0, "c"): [0], (0, "O"): [0], (0, "Y"): [0], (0, "s"): [0], (0, "w"): [0], (0, "R"): [0], (0, "2"): [0], (0, "r"): [0], (0, "L"): [0], (0, "M"): [0], (0, "S"): [0], (0, "V"): [0], (0, "e"): [0], (0, "h"): [0], (0, "n"): [0], (0, "a"): [0], (0, "0"): [0], (0, "8"): [0], (0, "K"): [0], (0, "P"): [0], (0, "6"): [0], (0, "U"): [0], (0, "F"): [0], (0, "f"): [0], (0, "X"): [0], (0, "T"): [0], (0, "l"): [0], (0, "z"): [0], (0, "E"): [0], (0, "5"): [0], (0, "I"): [0], (0, "Q"): [0], (0, "D"): [0], (0, "b"): [0], (0, "y"): [0], (0, "v"): [0], (0, "m"): [0], (0, "q"): [0], (0, "x"): [0], (0, "W"): [0], }, start=1)), - (G["id"], NFA(2, [1], {(0, "d"): [1], (0, "k"): [1], (0, "o"): [1], (0, "g"): [1], (0, "u"): [1], (0, "i"): [1], (0, "t"): [1], (0, "j"): [1], (0, "c"): [1], (0, "s"): [1], (0, "w"): [1], (0, "r"): [1], (0, "h"): [1], (0, "n"): [1], (0, "e"): [1], (0, "a"): [1], (0, "f"): [1], (0, "l"): [1], (0, "z"): [1], (0, "b"): [1], (0, "y"): [1], (0, "v"): [1], (0, "m"): [1], (0, "q"): [1], (0, "x"): [1], (0, "p"): [1], (1, "G"): [1], (1, "A"): [1], (1, "Z"): [1], (1, "3"): [1], (1, "C"): [1], (1, "d"): [1], (1, "k"): [1], (1, "9"): [1], (1, "o"): [1], (1, "H"): [1], (1, "1"): [1], (1, "g"): [1], (1, "u"): [1], (1, "B"): [1], (1, "7"): [1], (1, "i"): [1], (1, "t"): [1], (1, "4"): [1], (1, "N"): [1], (1, "j"): [1], (1, "c"): [1], (1, "s"): [1], (1, "J"): [1], (1, "O"): [1], (1, "w"): [1], (1, "Y"): [1], (1, "R"): [1], (1, "2"): [1], (1, "r"): [1], (1, "L"): [1], (1, "h"): [1], (1, "n"): [1], (1, "e"): [1], (1, "M"): [1], (1, "S"): [1], (1, "V"): [1], (1, "a"): [1], (1, "W"): [1], (1, "0"): [1], (1, "8"): [1], (1, "K"): [1], (1, "P"): [1], (1, "6"): [1], (1, "U"): [1], (1, "F"): [1], (1, "f"): [1], (1, "X"): [1], (1, "l"): [1], (1, "z"): [1], (1, "T"): [1], (1, "E"): [1], (1, "5"): [1], (1, "I"): [1], (1, "Q"): [1], (1, "D"): [1], (1, "b"): [1], (1, "y"): [1], (1, "v"): [1], (1, "m"): [1], (1, "q"): [1], (1, "x"): [1], (1, "p"): [1], }, start=0)), - (G["string"], NFA(3, [0], {(1, "\""): [2], (2, "G"): [2], (2, "Z"): [2], (2, "]"): [2], (2, "o"): [2], (2, "~"): [2], (2, "<"): [2], (2, "+"): [2], (2, "s"): [2], (2, "O"): [2], (2, "R"): [2], (2, "L"): [2], (2, "K"): [2], (2, " "): [2], (2, "&"): [2], (2, "`"): [2], (2, "X"): [2], (2, "T"): [2], (2, "-"): [2], (2, "b"): [2], (2, "}"): [2], (2, "'"): [2], (2, "d"): [2], (2, ";"): [2], (2, "u"): [2], (2, "_"): [2], (2, "\\"): [2], (2, "4"): [2], (2, "%"): [2], (2, "N"): [2], (2, "J"): [2], (2, "c"): [2], (2, "*"): [2], (2, "2"): [2], (2, ","): [2], (2, "n"): [2], (2, "/"): [2], (2, "5"): [2], (2, "Q"): [2], (2, "D"): [2], (2, "$"): [2], (2, "y"): [2], (2, "v"): [2], (2, "m"): [2], (2, "q"): [2], (2, "x"): [2], (2, "{"): [2], (2, "W"): [2], (2, "3"): [2], (2, "k"): [2], (2, "1"): [2], (2, "H"): [2], (2, "i"): [2], (2, "t"): [2], (2, "Y"): [2], (2, "w"): [2], (2, "M"): [2], (2, "h"): [2], (2, "("): [2], (2, "a"): [2], (2, "|"): [2], (2, "0"): [2], (2, "8"): [2], (2, ":"): [2], (2, "^"): [2], (2, "6"): [2], (2, "U"): [2], (2, "F"): [2], (2, "l"): [2], (2, "E"): [2], (2, "I"): [2], (2, "="): [2], (2, ">"): [2], (2, "A"): [2], (2, "C"): [2], (2, "9"): [2], (2, "g"): [2], (2, "B"): [2], (2, "7"): [2], (2, "j"): [2], (2, "!"): [2], (2, "#"): [2], (2, "@"): [2], (2, "r"): [2], (2, "["): [2], (2, "."): [2], (2, "S"): [2], (2, "V"): [2], (2, "e"): [2], (2, "?"): [2], (2, "P"): [2], (2, "f"): [2], (2, "z"): [2], (2, "\""): [0], (2, "p"): [2], (2, ")"): [2], (0, "G"): [2], (0, "Z"): [2], (0, "]"): [2], (0, "o"): [2], (0, "~"): [2], (0, "<"): [2], (0, "+"): [2], (0, "s"): [2], (0, "O"): [2], (0, "R"): [2], (0, "L"): [2], (0, "K"): [2], (0, " "): [2], (0, "&"): [2], (0, "`"): [2], (0, "X"): [2], (0, "T"): [2], (0, "-"): [2], (0, "b"): [2], (0, "}"): [2], (0, "'"): [2], (0, "d"): [2], (0, ";"): [2], (0, "u"): [2], (0, "_"): [2], (0, "\\"): [2], (0, "4"): [2], (0, "%"): [2], (0, "N"): [2], (0, "J"): [2], (0, "c"): [2], (0, "*"): [2], (0, "2"): [2], (0, ","): [2], (0, "n"): [2], (0, "/"): [2], (0, "5"): [2], (0, "Q"): [2], (0, "D"): [2], (0, "$"): [2], (0, "y"): [2], (0, "v"): [2], (0, "m"): [2], (0, "q"): [2], (0, "x"): [2], (0, "{"): [2], (0, "W"): [2], (0, "3"): [2], (0, "k"): [2], (0, "1"): [2], (0, "H"): [2], (0, "i"): [2], (0, "t"): [2], (0, "Y"): [2], (0, "w"): [2], (0, "M"): [2], (0, "h"): [2], (0, "("): [2], (0, "a"): [2], (0, "|"): [2], (0, "0"): [2], (0, "8"): [2], (0, ":"): [2], (0, "^"): [2], (0, "6"): [2], (0, "U"): [2], (0, "F"): [2], (0, "l"): [2], (0, "E"): [2], (0, "I"): [2], (0, "="): [2], (0, ">"): [2], (0, "A"): [2], (0, "C"): [2], (0, "9"): [2], (0, "g"): [2], (0, "B"): [2], (0, "7"): [2], (0, "j"): [2], (0, "!"): [2], (0, "#"): [2], (0, "@"): [2], (0, "r"): [2], (0, "["): [2], (0, "."): [2], (0, "S"): [2], (0, "V"): [2], (0, "e"): [2], (0, "?"): [2], (0, "P"): [2], (0, "f"): [2], (0, "z"): [2], (0, "\""): [0], (0, "p"): [2], (0, ")"): [2], }, start=1)), + (G["tab"], NFA(2, [1], {(0, "\t"): [1], (1, "\t"): [1], }, start=0)), + (G["integer"], NFA(3, [1], {(2, "2"): [1], (2, "6"): [1], (2, "8"): [1], (2, "9"): [1], (2, "4"): [1], (2, "-"): [0], (2, "3"): [1], (2, "1"): [1], (2, "7"): [1], (2, "5"): [1], (1, "2"): [1], (1, "6"): [1], (1, "8"): [1], (1, "9"): [1], (1, "4"): [1], (1, "0"): [1], (1, "3"): [1], (1, "1"): [1], (1, "7"): [1], (1, "5"): [1], (0, "2"): [1], (0, "6"): [1], (0, "8"): [1], (0, "9"): [1], (0, "4"): [1], (0, "3"): [1], (0, "1"): [1], (0, "7"): [1], (0, "5"): [1], }, start=2)), + (G["type"], NFA(2, [0], {(1, "C"): [0], (1, "L"): [0], (1, "T"): [0], (1, "O"): [0], (1, "V"): [0], (1, "Q"): [0], (1, "I"): [0], (1, "Z"): [0], (1, "H"): [0], (1, "P"): [0], (1, "G"): [0], (1, "A"): [0], (1, "W"): [0], (1, "X"): [0], (1, "M"): [0], (1, "B"): [0], (1, "S"): [0], (1, "E"): [0], (1, "U"): [0], (1, "N"): [0], (1, "R"): [0], (1, "Y"): [0], (1, "K"): [0], (1, "F"): [0], (1, "D"): [0], (1, "J"): [0], (0, "C"): [0], (0, "L"): [0], (0, "T"): [0], (0, "O"): [0], (0, "V"): [0], (0, "d"): [0], (0, "Q"): [0], (0, "y"): [0], (0, "h"): [0], (0, "I"): [0], (0, "t"): [0], (0, "Z"): [0], (0, "a"): [0], (0, "w"): [0], (0, "H"): [0], (0, "z"): [0], (0, "i"): [0], (0, "c"): [0], (0, "8"): [0], (0, "P"): [0], (0, "G"): [0], (0, "q"): [0], (0, "A"): [0], (0, "W"): [0], (0, "n"): [0], (0, "1"): [0], (0, "X"): [0], (0, "2"): [0], (0, "u"): [0], (0, "M"): [0], (0, "B"): [0], (0, "f"): [0], (0, "k"): [0], (0, "4"): [0], (0, "m"): [0], (0, "S"): [0], (0, "E"): [0], (0, "U"): [0], (0, "p"): [0], (0, "N"): [0], (0, "9"): [0], (0, "l"): [0], (0, "R"): [0], (0, "r"): [0], (0, "6"): [0], (0, "e"): [0], (0, "j"): [0], (0, "g"): [0], (0, "o"): [0], (0, "Y"): [0], (0, "b"): [0], (0, "v"): [0], (0, "x"): [0], (0, "K"): [0], (0, "0"): [0], (0, "s"): [0], (0, "3"): [0], (0, "F"): [0], (0, "D"): [0], (0, "J"): [0], (0, "7"): [0], (0, "5"): [0], }, start=1)), + (G["id"], NFA(2, [0], {(1, "d"): [0], (1, "y"): [0], (1, "h"): [0], (1, "t"): [0], (1, "a"): [0], (1, "w"): [0], (1, "z"): [0], (1, "i"): [0], (1, "c"): [0], (1, "q"): [0], (1, "n"): [0], (1, "u"): [0], (1, "f"): [0], (1, "k"): [0], (1, "m"): [0], (1, "p"): [0], (1, "l"): [0], (1, "r"): [0], (1, "e"): [0], (1, "j"): [0], (1, "g"): [0], (1, "o"): [0], (1, "b"): [0], (1, "v"): [0], (1, "x"): [0], (1, "s"): [0], (0, "C"): [0], (0, "L"): [0], (0, "T"): [0], (0, "O"): [0], (0, "V"): [0], (0, "d"): [0], (0, "Q"): [0], (0, "y"): [0], (0, "h"): [0], (0, "t"): [0], (0, "I"): [0], (0, "Z"): [0], (0, "a"): [0], (0, "w"): [0], (0, "H"): [0], (0, "z"): [0], (0, "i"): [0], (0, "c"): [0], (0, "8"): [0], (0, "P"): [0], (0, "G"): [0], (0, "q"): [0], (0, "A"): [0], (0, "W"): [0], (0, "n"): [0], (0, "1"): [0], (0, "X"): [0], (0, "2"): [0], (0, "u"): [0], (0, "M"): [0], (0, "B"): [0], (0, "f"): [0], (0, "k"): [0], (0, "4"): [0], (0, "m"): [0], (0, "S"): [0], (0, "E"): [0], (0, "p"): [0], (0, "U"): [0], (0, "N"): [0], (0, "9"): [0], (0, "l"): [0], (0, "R"): [0], (0, "r"): [0], (0, "6"): [0], (0, "e"): [0], (0, "j"): [0], (0, "g"): [0], (0, "o"): [0], (0, "Y"): [0], (0, "b"): [0], (0, "v"): [0], (0, "x"): [0], (0, "K"): [0], (0, "0"): [0], (0, "s"): [0], (0, "3"): [0], (0, "F"): [0], (0, "D"): [0], (0, "J"): [0], (0, "7"): [0], (0, "5"): [0], }, start=1)), + (G["string"], NFA(3, [2], {(0, "\""): [1], (1, "C"): [1], (1, "%"): [1], (1, "T"): [1], (1, "V"): [1], (1, "Z"): [1], (1, "H"): [1], (1, "?"): [1], (1, "P"): [1], (1, "G"): [1], (1, "q"): [1], (1, "&"): [1], (1, "("): [1], (1, "2"): [1], (1, "M"): [1], (1, "B"): [1], (1, "f"): [1], (1, "k"): [1], (1, "m"): [1], (1, "}"): [1], (1, "E"): [1], (1, "9"): [1], (1, ">"): [1], (1, "j"): [1], (1, "s"): [1], (1, "`"): [1], (1, "'"): [1], (1, "5"): [1], (1, "O"): [1], (1, "d"): [1], (1, "."): [1], (1, "h"): [1], (1, "I"): [1], (1, "a"): [1], (1, ":"): [1], (1, "{"): [1], (1, "i"): [1], (1, "<"): [1], (1, "/"): [1], (1, "W"): [1], (1, "u"): [1], (1, ","): [1], (1, ";"): [1], (1, "]"): [1], (1, "l"): [1], (1, "R"): [1], (1, "6"): [1], (1, "o"): [1], (1, "\\"): [1], (1, ")"): [1], (1, "x"): [1], (1, "@"): [1], (1, "D"): [1], (1, "7"): [1], (1, "|"): [1], (1, "Q"): [1], (1, "#"): [1], (1, "z"): [1], (1, "8"): [1], (1, "A"): [1], (1, "n"): [1], (1, "X"): [1], (1, "S"): [1], (1, "\""): [2], (1, "="): [1], (1, "+"): [1], (1, "g"): [1], (1, "Y"): [1], (1, "b"): [1], (1, "v"): [1], (1, "_"): [1], (1, "3"): [1], (1, "L"): [1], (1, "y"): [1], (1, "t"): [1], (1, "w"): [1], (1, "c"): [1], (1, "*"): [1], (1, " "): [1], (1, "$"): [1], (1, "1"): [1], (1, "!"): [1], (1, "4"): [1], (1, "^"): [1], (1, "U"): [1], (1, "p"): [1], (1, "N"): [1], (1, "r"): [1], (1, "e"): [1], (1, "["): [1], (1, "~"): [1], (1, "-"): [1], (1, "0"): [1], (1, "K"): [1], (1, "F"): [1], (1, "J"): [1], (2, "C"): [1], (2, "%"): [1], (2, "T"): [1], (2, "V"): [1], (2, "Z"): [1], (2, "H"): [1], (2, "?"): [1], (2, "P"): [1], (2, "G"): [1], (2, "q"): [1], (2, "&"): [1], (2, "("): [1], (2, "2"): [1], (2, "M"): [1], (2, "B"): [1], (2, "f"): [1], (2, "k"): [1], (2, "m"): [1], (2, "}"): [1], (2, "E"): [1], (2, "9"): [1], (2, ">"): [1], (2, "j"): [1], (2, "s"): [1], (2, "`"): [1], (2, "'"): [1], (2, "5"): [1], (2, "O"): [1], (2, "d"): [1], (2, "."): [1], (2, "h"): [1], (2, "I"): [1], (2, "a"): [1], (2, ":"): [1], (2, "{"): [1], (2, "i"): [1], (2, "<"): [1], (2, "/"): [1], (2, "W"): [1], (2, "u"): [1], (2, ","): [1], (2, ";"): [1], (2, "]"): [1], (2, "l"): [1], (2, "R"): [1], (2, "6"): [1], (2, "o"): [1], (2, "\\"): [1], (2, ")"): [1], (2, "x"): [1], (2, "@"): [1], (2, "D"): [1], (2, "7"): [1], (2, "|"): [1], (2, "Q"): [1], (2, "#"): [1], (2, "z"): [1], (2, "8"): [1], (2, "A"): [1], (2, "n"): [1], (2, "X"): [1], (2, "S"): [1], (2, "\""): [2], (2, "="): [1], (2, "+"): [1], (2, "g"): [1], (2, "Y"): [1], (2, "b"): [1], (2, "v"): [1], (2, "_"): [1], (2, "3"): [1], (2, "L"): [1], (2, "y"): [1], (2, "t"): [1], (2, "w"): [1], (2, "c"): [1], (2, "*"): [1], (2, " "): [1], (2, "$"): [1], (2, "1"): [1], (2, "!"): [1], (2, "4"): [1], (2, "^"): [1], (2, "U"): [1], (2, "p"): [1], (2, "N"): [1], (2, "r"): [1], (2, "e"): [1], (2, "["): [1], (2, "~"): [1], (2, "-"): [1], (2, "0"): [1], (2, "K"): [1], (2, "F"): [1], (2, "J"): [1], }, start=0)), ] def _build_regexs(self, table): diff --git a/parser.py b/parser.py index 4c87457b3..a904b9b62 100644 --- a/parser.py +++ b/parser.py @@ -16,44 +16,40 @@ def __action_table(self): return { (0, G["class"]): ("SHIFT", 1), (1, G["type"]): ("SHIFT", 2), - (2, G["inherits"]): ("SHIFT", 137), + (2, G["inherits"]): ("SHIFT", 136), (2, G["{"]): ("SHIFT", 3), (3, G["id"]): ("SHIFT", 4), - (3, G["}"]): ("SHIFT", 128), - (4, G["("]): ("SHIFT", 5), + (3, G["}"]): ("REDUCE", AttributeProduction(G["feature-list"], G.Epsilon, [lambda s: []])), (4, G[":"]): ("SHIFT", 124), - (5, G["id"]): ("SHIFT", 6), + (4, G["("]): ("SHIFT", 5), (5, G[")"]): ("SHIFT", 11), + (5, G["id"]): ("SHIFT", 6), (6, G[":"]): ("SHIFT", 7), (7, G["type"]): ("SHIFT", 8), - (8, G[","]): ("SHIFT", 9), (8, G[")"]): ("REDUCE", AttributeProduction(G["param-list"], Sentence(G["id"], G[":"], G["type"]), [lambda s: [ParamNode(s[1], s[3])]])), + (8, G[","]): ("SHIFT", 9), (9, G["id"]): ("SHIFT", 6), (10, G[")"]): ("REDUCE", AttributeProduction(G["param-list"], Sentence(G["id"], G[":"], G["type"], G[","], G["param-list"]), [lambda s: [ParamNode(s[1], s[3])] + s[5]])), (11, G[":"]): ("SHIFT", 12), (12, G["type"]): ("SHIFT", 13), (13, G["{"]): ("SHIFT", 14), (14, G["true"]): ("SHIFT", 35), - (14, G["id"]): ("SHIFT", 15), - (14, G["{"]): ("SHIFT", 19), - (14, G["while"]): ("SHIFT", 22), (14, G["not"]): ("SHIFT", 44), - (14, G["integer"]): ("SHIFT", 18), - (14, G["new"]): ("SHIFT", 31), (14, G["("]): ("SHIFT", 20), - (14, G["case"]): ("SHIFT", 30), - (14, G["let"]): ("SHIFT", 23), + (14, G["{"]): ("SHIFT", 19), (14, G["if"]): ("SHIFT", 21), - (14, G["isvoid"]): ("SHIFT", 33), + (14, G["id"]): ("SHIFT", 15), (14, G["~"]): ("SHIFT", 37), + (14, G["isvoid"]): ("SHIFT", 33), + (14, G["integer"]): ("SHIFT", 18), + (14, G["new"]): ("SHIFT", 31), (14, G["false"]): ("SHIFT", 36), + (14, G["while"]): ("SHIFT", 22), + (14, G["case"]): ("SHIFT", 30), + (14, G["let"]): ("SHIFT", 23), (14, G["string"]): ("SHIFT", 17), (15, G["<-"]): ("SHIFT", 113), - (15, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (15, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (15, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (15, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (15, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (15, G["("]): ("SHIFT", 16), (15, G["then"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), (15, G["else"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), (15, G["fi"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), @@ -69,27 +65,26 @@ def __action_table(self): (15, G["<="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), (15, G["="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), (15, G["}"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (15, G["("]): ("SHIFT", 16), - (16, G["not"]): ("SHIFT", 44), - (16, G["new"]): ("SHIFT", 31), - (16, G["id"]): ("SHIFT", 15), + (15, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (15, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (15, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (15, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (15, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), (16, G["integer"]): ("SHIFT", 18), - (16, G["case"]): ("SHIFT", 30), - (16, G["while"]): ("SHIFT", 22), - (16, G["~"]): ("SHIFT", 37), - (16, G["false"]): ("SHIFT", 36), + (16, G["let"]): ("SHIFT", 23), + (16, G["id"]): ("SHIFT", 15), + (16, G["if"]): ("SHIFT", 21), (16, G["{"]): ("SHIFT", 19), - (16, G["isvoid"]): ("SHIFT", 33), - (16, G["("]): ("SHIFT", 20), (16, G["string"]): ("SHIFT", 17), - (16, G["if"]): ("SHIFT", 21), + (16, G["("]): ("SHIFT", 20), + (16, G["case"]): ("SHIFT", 30), (16, G["true"]): ("SHIFT", 35), - (16, G["let"]): ("SHIFT", 23), - (17, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), - (17, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), - (17, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), - (17, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), - (17, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), + (16, G["isvoid"]): ("SHIFT", 33), + (16, G["not"]): ("SHIFT", 44), + (16, G["new"]): ("SHIFT", 31), + (16, G["while"]): ("SHIFT", 22), + (16, G["false"]): ("SHIFT", 36), + (16, G["~"]): ("SHIFT", 37), (17, G["then"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), (17, G["else"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), (17, G["fi"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), @@ -105,11 +100,11 @@ def __action_table(self): (17, G["<="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), (17, G["="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), (17, G["}"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), - (18, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), - (18, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), - (18, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), - (18, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), - (18, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), + (17, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), + (17, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), + (17, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), + (17, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), + (17, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), (18, G["then"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), (18, G["else"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), (18, G["fi"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), @@ -125,110 +120,110 @@ def __action_table(self): (18, G["<="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), (18, G["="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), (18, G["}"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), - (19, G["string"]): ("SHIFT", 17), - (19, G["false"]): ("SHIFT", 36), + (18, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), + (18, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), + (18, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), + (18, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), + (18, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), + (19, G["let"]): ("SHIFT", 23), + (19, G["{"]): ("SHIFT", 19), + (19, G["if"]): ("SHIFT", 21), (19, G["id"]): ("SHIFT", 15), - (19, G["isvoid"]): ("SHIFT", 33), + (19, G["not"]): ("SHIFT", 44), + (19, G["("]): ("SHIFT", 20), + (19, G["string"]): ("SHIFT", 17), (19, G["true"]): ("SHIFT", 35), - (19, G["while"]): ("SHIFT", 22), + (19, G["isvoid"]): ("SHIFT", 33), + (19, G["false"]): ("SHIFT", 36), + (19, G["~"]): ("SHIFT", 37), (19, G["integer"]): ("SHIFT", 18), (19, G["new"]): ("SHIFT", 31), + (19, G["while"]): ("SHIFT", 22), (19, G["case"]): ("SHIFT", 30), - (19, G["{"]): ("SHIFT", 19), - (19, G["("]): ("SHIFT", 20), - (19, G["if"]): ("SHIFT", 21), - (19, G["let"]): ("SHIFT", 23), - (19, G["not"]): ("SHIFT", 44), - (19, G["~"]): ("SHIFT", 37), - (20, G["~"]): ("SHIFT", 37), - (20, G["while"]): ("SHIFT", 22), - (20, G["id"]): ("SHIFT", 15), - (20, G["isvoid"]): ("SHIFT", 33), - (20, G["string"]): ("SHIFT", 17), + (20, G["new"]): ("SHIFT", 31), (20, G["false"]): ("SHIFT", 36), + (20, G["id"]): ("SHIFT", 15), + (20, G["integer"]): ("SHIFT", 18), + (20, G["{"]): ("SHIFT", 19), + (20, G["if"]): ("SHIFT", 21), + (20, G["while"]): ("SHIFT", 22), (20, G["let"]): ("SHIFT", 23), - (20, G["not"]): ("SHIFT", 44), + (20, G["string"]): ("SHIFT", 17), + (20, G["~"]): ("SHIFT", 37), + (20, G["("]): ("SHIFT", 20), (20, G["true"]): ("SHIFT", 35), + (20, G["not"]): ("SHIFT", 44), + (20, G["isvoid"]): ("SHIFT", 33), (20, G["case"]): ("SHIFT", 30), - (20, G["if"]): ("SHIFT", 21), - (20, G["{"]): ("SHIFT", 19), - (20, G["integer"]): ("SHIFT", 18), - (20, G["new"]): ("SHIFT", 31), - (20, G["("]): ("SHIFT", 20), + (21, G["not"]): ("SHIFT", 44), (21, G["id"]): ("SHIFT", 15), + (21, G["false"]): ("SHIFT", 36), (21, G["string"]): ("SHIFT", 17), + (21, G["true"]): ("SHIFT", 35), + (21, G["case"]): ("SHIFT", 30), (21, G["("]): ("SHIFT", 20), + (21, G["~"]): ("SHIFT", 37), (21, G["let"]): ("SHIFT", 23), - (21, G["true"]): ("SHIFT", 35), + (21, G["new"]): ("SHIFT", 31), (21, G["if"]): ("SHIFT", 21), (21, G["{"]): ("SHIFT", 19), - (21, G["integer"]): ("SHIFT", 18), - (21, G["new"]): ("SHIFT", 31), - (21, G["isvoid"]): ("SHIFT", 33), - (21, G["false"]): ("SHIFT", 36), - (21, G["~"]): ("SHIFT", 37), (21, G["while"]): ("SHIFT", 22), - (21, G["not"]): ("SHIFT", 44), - (21, G["case"]): ("SHIFT", 30), - (22, G["while"]): ("SHIFT", 22), + (21, G["isvoid"]): ("SHIFT", 33), + (21, G["integer"]): ("SHIFT", 18), + (22, G["id"]): ("SHIFT", 15), (22, G["not"]): ("SHIFT", 44), - (22, G["false"]): ("SHIFT", 36), (22, G["{"]): ("SHIFT", 19), - (22, G["id"]): ("SHIFT", 15), - (22, G["integer"]): ("SHIFT", 18), + (22, G["if"]): ("SHIFT", 21), (22, G["new"]): ("SHIFT", 31), - (22, G["case"]): ("SHIFT", 30), (22, G["let"]): ("SHIFT", 23), - (22, G["true"]): ("SHIFT", 35), - (22, G["if"]): ("SHIFT", 21), - (22, G["string"]): ("SHIFT", 17), (22, G["isvoid"]): ("SHIFT", 33), - (22, G["("]): ("SHIFT", 20), + (22, G["string"]): ("SHIFT", 17), (22, G["~"]): ("SHIFT", 37), + (22, G["("]): ("SHIFT", 20), + (22, G["case"]): ("SHIFT", 30), + (22, G["true"]): ("SHIFT", 35), + (22, G["while"]): ("SHIFT", 22), + (22, G["false"]): ("SHIFT", 36), + (22, G["integer"]): ("SHIFT", 18), (23, G["id"]): ("SHIFT", 24), (24, G[":"]): ("SHIFT", 25), (25, G["type"]): ("SHIFT", 26), (26, G["<-"]): ("SHIFT", 29), - (26, G["in"]): ("REDUCE", AttributeProduction(G["declaration-list"], Sentence(G["id"], G[":"], G["type"]), [lambda s: [VarDeclarationNode(s[1], s[3])]])), (26, G[","]): ("SHIFT", 27), + (26, G["in"]): ("REDUCE", AttributeProduction(G["declaration-list"], Sentence(G["id"], G[":"], G["type"]), [lambda s: [VarDeclarationNode(s[1], s[3])]])), (27, G["id"]): ("SHIFT", 24), (28, G["in"]): ("REDUCE", AttributeProduction(G["declaration-list"], Sentence(G["id"], G[":"], G["type"], G[","], G["declaration-list"]), [lambda s: [VarDeclarationNode(s[1], s[3])] + s[5]])), - (29, G["("]): ("SHIFT", 20), - (29, G["string"]): ("SHIFT", 17), - (29, G["true"]): ("SHIFT", 35), - (29, G["case"]): ("SHIFT", 30), (29, G["isvoid"]): ("SHIFT", 33), (29, G["id"]): ("SHIFT", 15), + (29, G["string"]): ("SHIFT", 17), + (29, G["~"]): ("SHIFT", 37), (29, G["while"]): ("SHIFT", 22), - (29, G["not"]): ("SHIFT", 44), - (29, G["new"]): ("SHIFT", 31), - (29, G["integer"]): ("SHIFT", 18), - (29, G["let"]): ("SHIFT", 23), - (29, G["false"]): ("SHIFT", 36), (29, G["if"]): ("SHIFT", 21), + (29, G["integer"]): ("SHIFT", 18), (29, G["{"]): ("SHIFT", 19), - (29, G["~"]): ("SHIFT", 37), - (30, G["id"]): ("SHIFT", 15), + (29, G["false"]): ("SHIFT", 36), + (29, G["new"]): ("SHIFT", 31), + (29, G["let"]): ("SHIFT", 23), + (29, G["case"]): ("SHIFT", 30), + (29, G["not"]): ("SHIFT", 44), + (29, G["true"]): ("SHIFT", 35), + (29, G["("]): ("SHIFT", 20), + (30, G["while"]): ("SHIFT", 22), (30, G["false"]): ("SHIFT", 36), - (30, G["if"]): ("SHIFT", 21), + (30, G["id"]): ("SHIFT", 15), + (30, G["not"]): ("SHIFT", 44), (30, G["new"]): ("SHIFT", 31), + (30, G["if"]): ("SHIFT", 21), (30, G["let"]): ("SHIFT", 23), - (30, G["case"]): ("SHIFT", 30), - (30, G["integer"]): ("SHIFT", 18), - (30, G["string"]): ("SHIFT", 17), - (30, G["not"]): ("SHIFT", 44), - (30, G["("]): ("SHIFT", 20), - (30, G["{"]): ("SHIFT", 19), (30, G["~"]): ("SHIFT", 37), + (30, G["{"]): ("SHIFT", 19), + (30, G["integer"]): ("SHIFT", 18), (30, G["true"]): ("SHIFT", 35), (30, G["isvoid"]): ("SHIFT", 33), - (30, G["while"]): ("SHIFT", 22), + (30, G["string"]): ("SHIFT", 17), + (30, G["("]): ("SHIFT", 20), + (30, G["case"]): ("SHIFT", 30), (31, G["type"]): ("SHIFT", 32), - (32, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), - (32, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), - (32, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), - (32, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), - (32, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), (32, G["then"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), (32, G["else"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), (32, G["fi"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), @@ -244,20 +239,21 @@ def __action_table(self): (32, G["<="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), (32, G["="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), (32, G["}"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), + (32, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), + (32, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), + (32, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), + (32, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), + (32, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), + (33, G["new"]): ("SHIFT", 31), (33, G["isvoid"]): ("SHIFT", 33), + (33, G["("]): ("SHIFT", 20), + (33, G["string"]): ("SHIFT", 17), (33, G["id"]): ("SHIFT", 34), (33, G["false"]): ("SHIFT", 36), - (33, G["string"]): ("SHIFT", 17), + (33, G["~"]): ("SHIFT", 37), (33, G["integer"]): ("SHIFT", 18), (33, G["true"]): ("SHIFT", 35), - (33, G["~"]): ("SHIFT", 37), - (33, G["new"]): ("SHIFT", 31), - (33, G["("]): ("SHIFT", 20), - (34, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (34, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (34, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (34, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (34, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (34, G["("]): ("SHIFT", 16), (34, G["then"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), (34, G["else"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), (34, G["fi"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), @@ -273,12 +269,11 @@ def __action_table(self): (34, G["<="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), (34, G["="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), (34, G["}"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (34, G["("]): ("SHIFT", 16), - (35, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), - (35, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), - (35, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), - (35, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), - (35, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), + (34, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (34, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (34, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (34, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), + (34, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), (35, G["then"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), (35, G["else"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), (35, G["fi"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), @@ -294,11 +289,11 @@ def __action_table(self): (35, G["<="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), (35, G["="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), (35, G["}"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), - (36, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), - (36, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), - (36, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), - (36, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), - (36, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), + (35, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), + (35, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), + (35, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), + (35, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), + (35, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), (36, G["then"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), (36, G["else"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), (36, G["fi"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), @@ -314,20 +309,20 @@ def __action_table(self): (36, G["<="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), (36, G["="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), (36, G["}"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), + (36, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), + (36, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), + (36, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), + (36, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), + (36, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), + (37, G["new"]): ("SHIFT", 31), (37, G["isvoid"]): ("SHIFT", 33), + (37, G["("]): ("SHIFT", 20), + (37, G["string"]): ("SHIFT", 17), (37, G["id"]): ("SHIFT", 34), (37, G["false"]): ("SHIFT", 36), - (37, G["string"]): ("SHIFT", 17), + (37, G["~"]): ("SHIFT", 37), (37, G["integer"]): ("SHIFT", 18), (37, G["true"]): ("SHIFT", 35), - (37, G["~"]): ("SHIFT", 37), - (37, G["new"]): ("SHIFT", 31), - (37, G["("]): ("SHIFT", 20), - (38, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), - (38, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), - (38, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), - (38, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), - (38, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), (38, G["then"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), (38, G["else"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), (38, G["fi"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), @@ -343,118 +338,119 @@ def __action_table(self): (38, G["<="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), (38, G["="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), (38, G["}"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), - (39, G["in"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (39, G[")"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (39, G["+"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (39, G["-"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (39, G[","]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (39, G["*"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (39, G["then"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (39, G["/"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (39, G["of"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (39, G["else"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (39, G["<"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (39, G["fi"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (39, G["<="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (39, G[";"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (39, G["="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (39, G["loop"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (39, G["pool"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (39, G["}"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (40, G["."]): ("SHIFT", 41), - (40, G["in"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), - (40, G[")"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), - (40, G["+"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), + (38, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), + (38, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), + (38, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), + (38, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), + (38, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), + (39, G["-"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), + (39, G[","]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), + (39, G["*"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), + (39, G["then"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), + (39, G["/"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), + (39, G["else"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), + (39, G["of"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), + (39, G["<"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), + (39, G["fi"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), + (39, G["+"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), + (39, G["<="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), + (39, G[";"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), + (39, G["="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), + (39, G["loop"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), + (39, G["pool"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), + (39, G["}"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), + (39, G["in"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), + (39, G[")"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), + (40, G["."]): ("SHIFT", 41), + (40, G["@"]): ("SHIFT", 69), (40, G["-"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), (40, G[","]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), (40, G["*"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), (40, G["then"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), (40, G["/"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), - (40, G["of"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), (40, G["else"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), + (40, G["of"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), (40, G["<"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), (40, G["fi"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), + (40, G["+"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), (40, G["<="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), (40, G[";"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), (40, G["="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), (40, G["loop"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), (40, G["pool"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), (40, G["}"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), - (40, G["@"]): ("SHIFT", 69), + (40, G["in"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), + (40, G[")"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), (41, G["id"]): ("SHIFT", 42), (42, G["("]): ("SHIFT", 43), - (43, G["not"]): ("SHIFT", 44), - (43, G["id"]): ("SHIFT", 15), - (43, G["new"]): ("SHIFT", 31), (43, G["integer"]): ("SHIFT", 18), - (43, G["case"]): ("SHIFT", 30), - (43, G["while"]): ("SHIFT", 22), - (43, G["~"]): ("SHIFT", 37), - (43, G["false"]): ("SHIFT", 36), + (43, G["let"]): ("SHIFT", 23), + (43, G["id"]): ("SHIFT", 15), + (43, G["if"]): ("SHIFT", 21), (43, G["{"]): ("SHIFT", 19), - (43, G["isvoid"]): ("SHIFT", 33), - (43, G["("]): ("SHIFT", 20), (43, G["string"]): ("SHIFT", 17), - (43, G["if"]): ("SHIFT", 21), + (43, G["("]): ("SHIFT", 20), + (43, G["case"]): ("SHIFT", 30), (43, G["true"]): ("SHIFT", 35), - (43, G["let"]): ("SHIFT", 23), + (43, G["isvoid"]): ("SHIFT", 33), + (43, G["not"]): ("SHIFT", 44), + (43, G["new"]): ("SHIFT", 31), + (43, G["while"]): ("SHIFT", 22), + (43, G["false"]): ("SHIFT", 36), + (43, G["~"]): ("SHIFT", 37), + (44, G["string"]): ("SHIFT", 17), (44, G["true"]): ("SHIFT", 35), - (44, G["let"]): ("SHIFT", 23), - (44, G["not"]): ("SHIFT", 44), - (44, G["case"]): ("SHIFT", 30), (44, G["("]): ("SHIFT", 20), + (44, G["not"]): ("SHIFT", 44), (44, G["{"]): ("SHIFT", 19), - (44, G["string"]): ("SHIFT", 17), - (44, G["integer"]): ("SHIFT", 18), - (44, G["new"]): ("SHIFT", 31), - (44, G["id"]): ("SHIFT", 15), - (44, G["while"]): ("SHIFT", 22), - (44, G["isvoid"]): ("SHIFT", 33), + (44, G["if"]): ("SHIFT", 21), (44, G["false"]): ("SHIFT", 36), + (44, G["isvoid"]): ("SHIFT", 33), + (44, G["id"]): ("SHIFT", 15), + (44, G["let"]): ("SHIFT", 23), + (44, G["case"]): ("SHIFT", 30), (44, G["~"]): ("SHIFT", 37), - (44, G["if"]): ("SHIFT", 21), - (45, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), - (45, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), + (44, G["new"]): ("SHIFT", 31), + (44, G["while"]): ("SHIFT", 22), + (44, G["integer"]): ("SHIFT", 18), (45, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), (45, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), - (45, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), (45, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), + (45, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), (45, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), (45, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), (45, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), (45, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), (45, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), + (45, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), + (45, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), + (46, G["="]): ("SHIFT", 61), (46, G["<="]): ("SHIFT", 59), - (46, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), - (46, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), + (46, G["<"]): ("SHIFT", 47), (46, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), (46, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), - (46, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), (46, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), + (46, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), (46, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), (46, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), (46, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), (46, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), (46, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), - (46, G["="]): ("SHIFT", 61), - (46, G["<"]): ("SHIFT", 47), + (46, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), + (46, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), (47, G["isvoid"]): ("SHIFT", 33), - (47, G["false"]): ("SHIFT", 36), - (47, G["true"]): ("SHIFT", 35), + (47, G["string"]): ("SHIFT", 17), + (47, G["id"]): ("SHIFT", 34), (47, G["~"]): ("SHIFT", 37), + (47, G["true"]): ("SHIFT", 35), + (47, G["new"]): ("SHIFT", 31), (47, G["("]): ("SHIFT", 20), - (47, G["id"]): ("SHIFT", 34), - (47, G["string"]): ("SHIFT", 17), + (47, G["false"]): ("SHIFT", 36), (47, G["integer"]): ("SHIFT", 18), - (47, G["new"]): ("SHIFT", 31), - (48, G["+"]): ("SHIFT", 49), - (48, G["-"]): ("SHIFT", 56), - (48, G["in"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), - (48, G[")"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), (48, G[","]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), (48, G["then"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), - (48, G["of"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), (48, G["else"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), + (48, G["of"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), (48, G["<"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), (48, G["fi"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), (48, G["<="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), @@ -463,165 +459,167 @@ def __action_table(self): (48, G["loop"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), (48, G["pool"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), (48, G["}"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), - (49, G["isvoid"]): ("SHIFT", 33), - (49, G["false"]): ("SHIFT", 36), - (49, G["true"]): ("SHIFT", 35), + (48, G["in"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), + (48, G[")"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), + (48, G["-"]): ("SHIFT", 56), + (48, G["+"]): ("SHIFT", 49), + (49, G["string"]): ("SHIFT", 17), + (49, G["id"]): ("SHIFT", 34), (49, G["~"]): ("SHIFT", 37), + (49, G["true"]): ("SHIFT", 35), + (49, G["new"]): ("SHIFT", 31), (49, G["("]): ("SHIFT", 20), - (49, G["id"]): ("SHIFT", 34), - (49, G["string"]): ("SHIFT", 17), + (49, G["false"]): ("SHIFT", 36), + (49, G["isvoid"]): ("SHIFT", 33), (49, G["integer"]): ("SHIFT", 18), - (49, G["new"]): ("SHIFT", 31), - (50, G["/"]): ("SHIFT", 53), - (50, G["in"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), - (50, G[")"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), - (50, G["+"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), + (50, G["*"]): ("SHIFT", 51), (50, G["-"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), (50, G[","]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), (50, G["then"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), - (50, G["of"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), (50, G["else"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), + (50, G["of"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), (50, G["<"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), (50, G["fi"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), + (50, G["+"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), (50, G["<="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), (50, G[";"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), (50, G["="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), (50, G["loop"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), (50, G["pool"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), (50, G["}"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), - (50, G["*"]): ("SHIFT", 51), - (51, G["isvoid"]): ("SHIFT", 33), + (50, G["in"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), + (50, G[")"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), + (50, G["/"]): ("SHIFT", 53), + (51, G["new"]): ("SHIFT", 31), + (51, G["("]): ("SHIFT", 20), + (51, G["string"]): ("SHIFT", 17), (51, G["id"]): ("SHIFT", 34), (51, G["false"]): ("SHIFT", 36), - (51, G["string"]): ("SHIFT", 17), + (51, G["~"]): ("SHIFT", 37), + (51, G["isvoid"]): ("SHIFT", 33), (51, G["integer"]): ("SHIFT", 18), (51, G["true"]): ("SHIFT", 35), - (51, G["~"]): ("SHIFT", 37), - (51, G["new"]): ("SHIFT", 31), - (51, G["("]): ("SHIFT", 20), - (52, G["in"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), - (52, G[")"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), - (52, G["+"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), (52, G["-"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), (52, G[","]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), (52, G["*"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), (52, G["then"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), (52, G["/"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), - (52, G["of"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), (52, G["else"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), + (52, G["of"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), (52, G["<"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), (52, G["fi"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), + (52, G["+"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), (52, G["<="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), (52, G[";"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), (52, G["="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), (52, G["loop"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), (52, G["pool"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), (52, G["}"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), - (53, G["isvoid"]): ("SHIFT", 33), + (52, G["in"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), + (52, G[")"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), + (53, G["new"]): ("SHIFT", 31), + (53, G["("]): ("SHIFT", 20), + (53, G["string"]): ("SHIFT", 17), (53, G["id"]): ("SHIFT", 34), (53, G["false"]): ("SHIFT", 36), - (53, G["string"]): ("SHIFT", 17), + (53, G["~"]): ("SHIFT", 37), + (53, G["isvoid"]): ("SHIFT", 33), (53, G["integer"]): ("SHIFT", 18), (53, G["true"]): ("SHIFT", 35), - (53, G["~"]): ("SHIFT", 37), - (53, G["new"]): ("SHIFT", 31), - (53, G["("]): ("SHIFT", 20), - (54, G["in"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), - (54, G[")"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), - (54, G["+"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), (54, G["-"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), (54, G[","]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), (54, G["*"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), (54, G["then"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), (54, G["/"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), - (54, G["of"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), (54, G["else"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), + (54, G["of"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), (54, G["<"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), (54, G["fi"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), + (54, G["+"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), (54, G["<="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), (54, G[";"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), (54, G["="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), (54, G["loop"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), (54, G["pool"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), (54, G["}"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), - (55, G["in"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), - (55, G[")"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), - (55, G["+"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), + (54, G["in"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), + (54, G[")"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), (55, G["-"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), (55, G[","]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), (55, G["*"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), (55, G["then"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), (55, G["/"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), - (55, G["of"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), (55, G["else"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), + (55, G["of"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), (55, G["<"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), (55, G["fi"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), + (55, G["+"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), (55, G["<="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), (55, G[";"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), (55, G["="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), (55, G["loop"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), (55, G["pool"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), (55, G["}"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), - (56, G["isvoid"]): ("SHIFT", 33), - (56, G["false"]): ("SHIFT", 36), - (56, G["true"]): ("SHIFT", 35), + (55, G["in"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), + (55, G[")"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), + (56, G["string"]): ("SHIFT", 17), + (56, G["id"]): ("SHIFT", 34), (56, G["~"]): ("SHIFT", 37), + (56, G["true"]): ("SHIFT", 35), + (56, G["new"]): ("SHIFT", 31), (56, G["("]): ("SHIFT", 20), - (56, G["id"]): ("SHIFT", 34), - (56, G["string"]): ("SHIFT", 17), + (56, G["false"]): ("SHIFT", 36), + (56, G["isvoid"]): ("SHIFT", 33), (56, G["integer"]): ("SHIFT", 18), - (56, G["new"]): ("SHIFT", 31), - (57, G["/"]): ("SHIFT", 53), - (57, G["in"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), - (57, G[")"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), - (57, G["+"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), + (57, G["*"]): ("SHIFT", 51), (57, G["-"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), (57, G[","]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), (57, G["then"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), - (57, G["of"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), (57, G["else"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), + (57, G["of"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), (57, G["<"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), (57, G["fi"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), + (57, G["+"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), (57, G["<="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), (57, G[";"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), (57, G["="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), (57, G["loop"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), (57, G["pool"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), (57, G["}"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), - (57, G["*"]): ("SHIFT", 51), - (58, G["in"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), - (58, G[")"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), - (58, G["+"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), + (57, G["in"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), + (57, G[")"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), + (57, G["/"]): ("SHIFT", 53), + (58, G["*"]): ("SHIFT", 51), (58, G["-"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), (58, G[","]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), (58, G["then"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), - (58, G["of"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), (58, G["else"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), + (58, G["of"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), (58, G["<"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), (58, G["fi"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), + (58, G["+"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), (58, G["<="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), (58, G[";"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), (58, G["="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), (58, G["loop"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), (58, G["pool"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), (58, G["}"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), + (58, G["in"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), + (58, G[")"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), (58, G["/"]): ("SHIFT", 53), - (58, G["*"]): ("SHIFT", 51), (59, G["isvoid"]): ("SHIFT", 33), - (59, G["false"]): ("SHIFT", 36), - (59, G["true"]): ("SHIFT", 35), + (59, G["string"]): ("SHIFT", 17), + (59, G["id"]): ("SHIFT", 34), (59, G["~"]): ("SHIFT", 37), + (59, G["true"]): ("SHIFT", 35), + (59, G["new"]): ("SHIFT", 31), (59, G["("]): ("SHIFT", 20), - (59, G["id"]): ("SHIFT", 34), - (59, G["string"]): ("SHIFT", 17), + (59, G["false"]): ("SHIFT", 36), (59, G["integer"]): ("SHIFT", 18), - (59, G["new"]): ("SHIFT", 31), - (60, G["in"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), - (60, G[")"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), (60, G[","]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), (60, G["then"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), - (60, G["of"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), (60, G["else"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), + (60, G["of"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), (60, G["<"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), (60, G["fi"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), (60, G["<="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), @@ -630,24 +628,25 @@ def __action_table(self): (60, G["loop"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), (60, G["pool"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), (60, G["}"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), + (60, G["in"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), + (60, G[")"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), (60, G["+"]): ("SHIFT", 49), (60, G["-"]): ("SHIFT", 56), - (61, G["isvoid"]): ("SHIFT", 33), - (61, G["false"]): ("SHIFT", 36), - (61, G["true"]): ("SHIFT", 35), + (61, G["string"]): ("SHIFT", 17), + (61, G["id"]): ("SHIFT", 34), (61, G["~"]): ("SHIFT", 37), + (61, G["true"]): ("SHIFT", 35), + (61, G["new"]): ("SHIFT", 31), (61, G["("]): ("SHIFT", 20), - (61, G["id"]): ("SHIFT", 34), - (61, G["string"]): ("SHIFT", 17), + (61, G["false"]): ("SHIFT", 36), + (61, G["isvoid"]): ("SHIFT", 33), (61, G["integer"]): ("SHIFT", 18), - (61, G["new"]): ("SHIFT", 31), + (62, G["-"]): ("SHIFT", 56), (62, G["+"]): ("SHIFT", 49), - (62, G["in"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), - (62, G[")"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), (62, G[","]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), (62, G["then"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), - (62, G["of"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), (62, G["else"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), + (62, G["of"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), (62, G["<"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), (62, G["fi"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), (62, G["<="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), @@ -656,15 +655,12 @@ def __action_table(self): (62, G["loop"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), (62, G["pool"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), (62, G["}"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), - (62, G["-"]): ("SHIFT", 56), - (63, G["+"]): ("SHIFT", 49), - (63, G["-"]): ("SHIFT", 56), - (63, G["in"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), - (63, G[")"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), + (62, G["in"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), + (62, G[")"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), (63, G[","]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), (63, G["then"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), - (63, G["of"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), (63, G["else"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), + (63, G["of"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), (63, G["<"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), (63, G["fi"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), (63, G["<="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), @@ -673,12 +669,11 @@ def __action_table(self): (63, G["loop"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), (63, G["pool"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), (63, G["}"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), + (63, G["in"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), + (63, G[")"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), + (63, G["-"]): ("SHIFT", 56), + (63, G["+"]): ("SHIFT", 49), (64, G[")"]): ("SHIFT", 65), - (65, G[")"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (65, G[","]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (65, G["."]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (65, G["@"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (65, G[";"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), (65, G["then"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), (65, G["else"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), (65, G["fi"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), @@ -694,49 +689,49 @@ def __action_table(self): (65, G["<="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), (65, G["="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), (65, G["}"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (66, G[")"]): ("REDUCE", AttributeProduction(G["expr-list"], Sentence(G["expr"]), [lambda s: [s[1]]])), + (65, G[")"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (65, G[","]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (65, G["."]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (65, G["@"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (65, G[";"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), (66, G[","]): ("SHIFT", 67), - (67, G["not"]): ("SHIFT", 44), - (67, G["id"]): ("SHIFT", 15), - (67, G["new"]): ("SHIFT", 31), + (66, G[")"]): ("REDUCE", AttributeProduction(G["expr-list"], Sentence(G["expr"]), [lambda s: [s[1]]])), (67, G["integer"]): ("SHIFT", 18), - (67, G["case"]): ("SHIFT", 30), - (67, G["while"]): ("SHIFT", 22), - (67, G["~"]): ("SHIFT", 37), - (67, G["false"]): ("SHIFT", 36), + (67, G["let"]): ("SHIFT", 23), + (67, G["id"]): ("SHIFT", 15), + (67, G["if"]): ("SHIFT", 21), (67, G["{"]): ("SHIFT", 19), - (67, G["isvoid"]): ("SHIFT", 33), - (67, G["("]): ("SHIFT", 20), (67, G["string"]): ("SHIFT", 17), - (67, G["if"]): ("SHIFT", 21), + (67, G["("]): ("SHIFT", 20), + (67, G["case"]): ("SHIFT", 30), (67, G["true"]): ("SHIFT", 35), - (67, G["let"]): ("SHIFT", 23), + (67, G["isvoid"]): ("SHIFT", 33), + (67, G["not"]): ("SHIFT", 44), + (67, G["new"]): ("SHIFT", 31), + (67, G["while"]): ("SHIFT", 22), + (67, G["false"]): ("SHIFT", 36), + (67, G["~"]): ("SHIFT", 37), (68, G[")"]): ("REDUCE", AttributeProduction(G["expr-list"], Sentence(G["expr"], G[","], G["expr-list"]), [lambda s: [s[1]] + s[3]])), (69, G["type"]): ("SHIFT", 70), (70, G["."]): ("SHIFT", 71), (71, G["id"]): ("SHIFT", 72), (72, G["("]): ("SHIFT", 73), - (73, G["not"]): ("SHIFT", 44), - (73, G["id"]): ("SHIFT", 15), - (73, G["new"]): ("SHIFT", 31), (73, G["integer"]): ("SHIFT", 18), - (73, G["case"]): ("SHIFT", 30), - (73, G["while"]): ("SHIFT", 22), - (73, G["~"]): ("SHIFT", 37), - (73, G["false"]): ("SHIFT", 36), + (73, G["let"]): ("SHIFT", 23), + (73, G["id"]): ("SHIFT", 15), + (73, G["if"]): ("SHIFT", 21), (73, G["{"]): ("SHIFT", 19), - (73, G["isvoid"]): ("SHIFT", 33), - (73, G["("]): ("SHIFT", 20), (73, G["string"]): ("SHIFT", 17), - (73, G["if"]): ("SHIFT", 21), + (73, G["("]): ("SHIFT", 20), + (73, G["case"]): ("SHIFT", 30), (73, G["true"]): ("SHIFT", 35), - (73, G["let"]): ("SHIFT", 23), + (73, G["isvoid"]): ("SHIFT", 33), + (73, G["not"]): ("SHIFT", 44), + (73, G["new"]): ("SHIFT", 31), + (73, G["while"]): ("SHIFT", 22), + (73, G["false"]): ("SHIFT", 36), + (73, G["~"]): ("SHIFT", 37), (74, G[")"]): ("SHIFT", 75), - (75, G[")"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (75, G[","]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (75, G["."]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (75, G["@"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (75, G[";"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), (75, G["then"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), (75, G["else"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), (75, G["fi"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), @@ -752,169 +747,169 @@ def __action_table(self): (75, G["<="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), (75, G["="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), (75, G["}"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (76, G["in"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (76, G[")"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (76, G["+"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (75, G[")"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (75, G[","]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (75, G["."]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (75, G["@"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (75, G[";"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), (76, G["-"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), (76, G[","]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), (76, G["*"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), (76, G["then"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), (76, G["/"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (76, G["of"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), (76, G["else"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (76, G["of"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), (76, G["<"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), (76, G["fi"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (76, G["+"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), (76, G["<="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), (76, G[";"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), (76, G["="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), (76, G["loop"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), (76, G["pool"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), (76, G["}"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (76, G["in"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (76, G[")"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), (77, G["of"]): ("SHIFT", 78), (78, G["id"]): ("SHIFT", 79), (79, G[":"]): ("SHIFT", 80), (80, G["type"]): ("SHIFT", 81), (81, G["=>"]): ("SHIFT", 82), - (82, G["string"]): ("SHIFT", 17), - (82, G["false"]): ("SHIFT", 36), + (82, G["let"]): ("SHIFT", 23), (82, G["id"]): ("SHIFT", 15), - (82, G["isvoid"]): ("SHIFT", 33), + (82, G["if"]): ("SHIFT", 21), + (82, G["{"]): ("SHIFT", 19), + (82, G["not"]): ("SHIFT", 44), + (82, G["("]): ("SHIFT", 20), + (82, G["string"]): ("SHIFT", 17), (82, G["true"]): ("SHIFT", 35), - (82, G["while"]): ("SHIFT", 22), + (82, G["isvoid"]): ("SHIFT", 33), + (82, G["false"]): ("SHIFT", 36), + (82, G["~"]): ("SHIFT", 37), (82, G["integer"]): ("SHIFT", 18), (82, G["new"]): ("SHIFT", 31), + (82, G["while"]): ("SHIFT", 22), (82, G["case"]): ("SHIFT", 30), - (82, G["{"]): ("SHIFT", 19), - (82, G["("]): ("SHIFT", 20), - (82, G["if"]): ("SHIFT", 21), - (82, G["let"]): ("SHIFT", 23), - (82, G["not"]): ("SHIFT", 44), - (82, G["~"]): ("SHIFT", 37), (83, G[";"]): ("SHIFT", 84), (84, G["id"]): ("SHIFT", 79), (84, G["esac"]): ("REDUCE", AttributeProduction(G["case-list"], Sentence(G["id"], G[":"], G["type"], G["=>"], G["expr"], G[";"]), [lambda s: [SingleCaseNode(s[1], s[3], s[5])]])), (85, G["esac"]): ("REDUCE", AttributeProduction(G["case-list"], Sentence(G["id"], G[":"], G["type"], G["=>"], G["expr"], G[";"], G["case-list"]), [lambda s: [SingleCaseNode(s[1], s[3], s[5])] + s[7]])), (86, G["esac"]): ("SHIFT", 87), - (87, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), - (87, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), (87, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), (87, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), - (87, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), (87, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), + (87, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), (87, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), (87, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), (87, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), (87, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), (87, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), - (88, G[","]): ("SHIFT", 89), + (87, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), + (87, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), (88, G["in"]): ("REDUCE", AttributeProduction(G["declaration-list"], Sentence(G["id"], G[":"], G["type"], G["<-"], G["expr"]), [lambda s: [VarDeclarationNode(s[1], s[3], s[5])]])), + (88, G[","]): ("SHIFT", 89), (89, G["id"]): ("SHIFT", 24), (90, G["in"]): ("REDUCE", AttributeProduction(G["declaration-list"], Sentence(G["id"], G[":"], G["type"], G["<-"], G["expr"], G[","], G["declaration-list"]), [lambda s: [VarDeclarationNode(s[1], s[3], s[5])] + s[7]])), (91, G["in"]): ("SHIFT", 92), + (92, G["string"]): ("SHIFT", 17), (92, G["true"]): ("SHIFT", 35), - (92, G["let"]): ("SHIFT", 23), - (92, G["not"]): ("SHIFT", 44), - (92, G["case"]): ("SHIFT", 30), (92, G["("]): ("SHIFT", 20), + (92, G["not"]): ("SHIFT", 44), + (92, G["false"]): ("SHIFT", 36), + (92, G["if"]): ("SHIFT", 21), (92, G["{"]): ("SHIFT", 19), - (92, G["string"]): ("SHIFT", 17), - (92, G["integer"]): ("SHIFT", 18), - (92, G["new"]): ("SHIFT", 31), - (92, G["while"]): ("SHIFT", 22), - (92, G["id"]): ("SHIFT", 15), (92, G["isvoid"]): ("SHIFT", 33), - (92, G["false"]): ("SHIFT", 36), + (92, G["id"]): ("SHIFT", 15), + (92, G["let"]): ("SHIFT", 23), + (92, G["case"]): ("SHIFT", 30), (92, G["~"]): ("SHIFT", 37), - (92, G["if"]): ("SHIFT", 21), - (93, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), - (93, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), + (92, G["new"]): ("SHIFT", 31), + (92, G["while"]): ("SHIFT", 22), + (92, G["integer"]): ("SHIFT", 18), (93, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), (93, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), - (93, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), (93, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), + (93, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), (93, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), (93, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), (93, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), (93, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), (93, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), + (93, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), + (93, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), (94, G["loop"]): ("SHIFT", 95), - (95, G["while"]): ("SHIFT", 22), - (95, G["id"]): ("SHIFT", 15), (95, G["false"]): ("SHIFT", 36), - (95, G["not"]): ("SHIFT", 44), + (95, G["isvoid"]): ("SHIFT", 33), + (95, G["while"]): ("SHIFT", 22), + (95, G["new"]): ("SHIFT", 31), (95, G["~"]): ("SHIFT", 37), - (95, G["{"]): ("SHIFT", 19), (95, G["case"]): ("SHIFT", 30), + (95, G["("]): ("SHIFT", 20), + (95, G["true"]): ("SHIFT", 35), + (95, G["string"]): ("SHIFT", 17), (95, G["let"]): ("SHIFT", 23), + (95, G["id"]): ("SHIFT", 15), (95, G["integer"]): ("SHIFT", 18), - (95, G["new"]): ("SHIFT", 31), + (95, G["{"]): ("SHIFT", 19), (95, G["if"]): ("SHIFT", 21), - (95, G["string"]): ("SHIFT", 17), - (95, G["isvoid"]): ("SHIFT", 33), - (95, G["("]): ("SHIFT", 20), - (95, G["true"]): ("SHIFT", 35), + (95, G["not"]): ("SHIFT", 44), (96, G["pool"]): ("SHIFT", 97), - (97, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), - (97, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), (97, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), (97, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), - (97, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), (97, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), + (97, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), (97, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), (97, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), (97, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), (97, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), (97, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), + (97, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), + (97, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), (98, G["then"]): ("SHIFT", 99), - (99, G["integer"]): ("SHIFT", 18), - (99, G["{"]): ("SHIFT", 19), - (99, G["id"]): ("SHIFT", 15), - (99, G["if"]): ("SHIFT", 21), - (99, G["true"]): ("SHIFT", 35), - (99, G["let"]): ("SHIFT", 23), + (99, G["new"]): ("SHIFT", 31), + (99, G["case"]): ("SHIFT", 30), + (99, G["while"]): ("SHIFT", 22), + (99, G["~"]): ("SHIFT", 37), (99, G["("]): ("SHIFT", 20), + (99, G["true"]): ("SHIFT", 35), (99, G["string"]): ("SHIFT", 17), - (99, G["isvoid"]): ("SHIFT", 33), - (99, G["case"]): ("SHIFT", 30), + (99, G["id"]): ("SHIFT", 15), + (99, G["integer"]): ("SHIFT", 18), + (99, G["{"]): ("SHIFT", 19), (99, G["not"]): ("SHIFT", 44), - (99, G["while"]): ("SHIFT", 22), (99, G["false"]): ("SHIFT", 36), - (99, G["~"]): ("SHIFT", 37), - (99, G["new"]): ("SHIFT", 31), + (99, G["isvoid"]): ("SHIFT", 33), + (99, G["if"]): ("SHIFT", 21), + (99, G["let"]): ("SHIFT", 23), (100, G["else"]): ("SHIFT", 101), - (101, G["string"]): ("SHIFT", 17), + (101, G["true"]): ("SHIFT", 35), + (101, G["not"]): ("SHIFT", 44), + (101, G["isvoid"]): ("SHIFT", 33), + (101, G["case"]): ("SHIFT", 30), + (101, G["new"]): ("SHIFT", 31), (101, G["false"]): ("SHIFT", 36), (101, G["id"]): ("SHIFT", 15), - (101, G["{"]): ("SHIFT", 19), + (101, G["integer"]): ("SHIFT", 18), (101, G["if"]): ("SHIFT", 21), + (101, G["{"]): ("SHIFT", 19), + (101, G["while"]): ("SHIFT", 22), (101, G["let"]): ("SHIFT", 23), - (101, G["case"]): ("SHIFT", 30), - (101, G["("]): ("SHIFT", 20), - (101, G["new"]): ("SHIFT", 31), + (101, G["string"]): ("SHIFT", 17), (101, G["~"]): ("SHIFT", 37), - (101, G["integer"]): ("SHIFT", 18), - (101, G["not"]): ("SHIFT", 44), - (101, G["isvoid"]): ("SHIFT", 33), - (101, G["while"]): ("SHIFT", 22), - (101, G["true"]): ("SHIFT", 35), + (101, G["("]): ("SHIFT", 20), (102, G["fi"]): ("SHIFT", 103), - (103, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), - (103, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), (103, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), (103, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), - (103, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), (103, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), + (103, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), (103, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), (103, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), (103, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), (103, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), (103, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), + (103, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), + (103, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), (104, G[")"]): ("SHIFT", 105), - (105, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), - (105, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), - (105, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), - (105, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), - (105, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), (105, G["then"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), (105, G["else"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), (105, G["fi"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), @@ -930,42 +925,42 @@ def __action_table(self): (105, G["<="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), (105, G["="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), (105, G["}"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), + (105, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), + (105, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), + (105, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), + (105, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), + (105, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), (106, G["}"]): ("SHIFT", 107), - (107, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), - (107, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), (107, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), (107, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), - (107, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), (107, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), + (107, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), (107, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), (107, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), (107, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), (107, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), (107, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), + (107, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), + (107, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), (108, G[";"]): ("SHIFT", 109), - (109, G["string"]): ("SHIFT", 17), - (109, G["false"]): ("SHIFT", 36), + (109, G["let"]): ("SHIFT", 23), (109, G["id"]): ("SHIFT", 15), - (109, G["isvoid"]): ("SHIFT", 33), - (109, G["true"]): ("SHIFT", 35), - (109, G["while"]): ("SHIFT", 22), + (109, G["if"]): ("SHIFT", 21), + (109, G["{"]): ("SHIFT", 19), (109, G["}"]): ("REDUCE", AttributeProduction(G["block"], Sentence(G["expr"], G[";"]), [lambda s: [s[1]]])), + (109, G["not"]): ("SHIFT", 44), + (109, G["("]): ("SHIFT", 20), + (109, G["string"]): ("SHIFT", 17), + (109, G["true"]): ("SHIFT", 35), + (109, G["isvoid"]): ("SHIFT", 33), + (109, G["false"]): ("SHIFT", 36), + (109, G["~"]): ("SHIFT", 37), (109, G["integer"]): ("SHIFT", 18), (109, G["new"]): ("SHIFT", 31), + (109, G["while"]): ("SHIFT", 22), (109, G["case"]): ("SHIFT", 30), - (109, G["{"]): ("SHIFT", 19), - (109, G["("]): ("SHIFT", 20), - (109, G["if"]): ("SHIFT", 21), - (109, G["let"]): ("SHIFT", 23), - (109, G["not"]): ("SHIFT", 44), - (109, G["~"]): ("SHIFT", 37), (110, G["}"]): ("REDUCE", AttributeProduction(G["block"], Sentence(G["expr"], G[";"], G["block"]), [lambda s: [s[1]] + s[3]])), (111, G[")"]): ("SHIFT", 112), - (112, G[")"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), - (112, G[","]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), - (112, G["."]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), - (112, G["@"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), - (112, G[";"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), (112, G["then"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), (112, G["else"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), (112, G["fi"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), @@ -981,32 +976,37 @@ def __action_table(self): (112, G["<="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), (112, G["="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), (112, G["}"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), + (112, G[")"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), + (112, G[","]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), + (112, G["."]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), + (112, G["@"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), + (112, G[";"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), + (113, G["string"]): ("SHIFT", 17), (113, G["true"]): ("SHIFT", 35), - (113, G["let"]): ("SHIFT", 23), - (113, G["not"]): ("SHIFT", 44), - (113, G["case"]): ("SHIFT", 30), (113, G["("]): ("SHIFT", 20), + (113, G["not"]): ("SHIFT", 44), + (113, G["false"]): ("SHIFT", 36), + (113, G["if"]): ("SHIFT", 21), (113, G["{"]): ("SHIFT", 19), - (113, G["string"]): ("SHIFT", 17), - (113, G["integer"]): ("SHIFT", 18), - (113, G["new"]): ("SHIFT", 31), - (113, G["while"]): ("SHIFT", 22), - (113, G["id"]): ("SHIFT", 15), (113, G["isvoid"]): ("SHIFT", 33), - (113, G["false"]): ("SHIFT", 36), + (113, G["id"]): ("SHIFT", 15), + (113, G["let"]): ("SHIFT", 23), + (113, G["case"]): ("SHIFT", 30), (113, G["~"]): ("SHIFT", 37), - (113, G["if"]): ("SHIFT", 21), - (114, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), - (114, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), + (113, G["new"]): ("SHIFT", 31), + (113, G["while"]): ("SHIFT", 22), + (113, G["integer"]): ("SHIFT", 18), (114, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), (114, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), - (114, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), (114, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), + (114, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), (114, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), (114, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), (114, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), (114, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), (114, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), + (114, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), + (114, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), (115, G["}"]): ("SHIFT", 116), (116, G[";"]): ("REDUCE", AttributeProduction(G["method"], Sentence(G["id"], G["("], G[")"], G[":"], G["type"], G["{"], G["expr"], G["}"]), [lambda s: MethodDeclarationNode(s[1], [], s[5], s[7])])), (117, G[")"]): ("SHIFT", 118), @@ -1014,284 +1014,279 @@ def __action_table(self): (119, G["type"]): ("SHIFT", 120), (120, G["{"]): ("SHIFT", 121), (121, G["true"]): ("SHIFT", 35), - (121, G["id"]): ("SHIFT", 15), - (121, G["{"]): ("SHIFT", 19), - (121, G["while"]): ("SHIFT", 22), (121, G["not"]): ("SHIFT", 44), - (121, G["integer"]): ("SHIFT", 18), - (121, G["new"]): ("SHIFT", 31), (121, G["("]): ("SHIFT", 20), - (121, G["case"]): ("SHIFT", 30), - (121, G["let"]): ("SHIFT", 23), + (121, G["{"]): ("SHIFT", 19), (121, G["if"]): ("SHIFT", 21), - (121, G["isvoid"]): ("SHIFT", 33), + (121, G["id"]): ("SHIFT", 15), (121, G["~"]): ("SHIFT", 37), + (121, G["isvoid"]): ("SHIFT", 33), + (121, G["integer"]): ("SHIFT", 18), + (121, G["new"]): ("SHIFT", 31), (121, G["false"]): ("SHIFT", 36), + (121, G["while"]): ("SHIFT", 22), + (121, G["case"]): ("SHIFT", 30), + (121, G["let"]): ("SHIFT", 23), (121, G["string"]): ("SHIFT", 17), (122, G["}"]): ("SHIFT", 123), (123, G[";"]): ("REDUCE", AttributeProduction(G["method"], Sentence(G["id"], G["("], G["param-list"], G[")"], G[":"], G["type"], G["{"], G["expr"], G["}"]), [lambda s: MethodDeclarationNode(s[1], s[3], s[6], s[8])])), (124, G["type"]): ("SHIFT", 125), (125, G["<-"]): ("SHIFT", 126), (125, G[";"]): ("REDUCE", AttributeProduction(G["attribute"], Sentence(G["id"], G[":"], G["type"]), [lambda s: AttrDeclarationNode(s[1], s[3])])), - (126, G["string"]): ("SHIFT", 17), - (126, G["false"]): ("SHIFT", 36), (126, G["id"]): ("SHIFT", 15), - (126, G["isvoid"]): ("SHIFT", 33), + (126, G["let"]): ("SHIFT", 23), + (126, G["if"]): ("SHIFT", 21), + (126, G["{"]): ("SHIFT", 19), + (126, G["not"]): ("SHIFT", 44), + (126, G["("]): ("SHIFT", 20), + (126, G["string"]): ("SHIFT", 17), (126, G["true"]): ("SHIFT", 35), - (126, G["while"]): ("SHIFT", 22), + (126, G["isvoid"]): ("SHIFT", 33), + (126, G["false"]): ("SHIFT", 36), + (126, G["~"]): ("SHIFT", 37), (126, G["integer"]): ("SHIFT", 18), (126, G["new"]): ("SHIFT", 31), + (126, G["while"]): ("SHIFT", 22), (126, G["case"]): ("SHIFT", 30), - (126, G["{"]): ("SHIFT", 19), - (126, G["("]): ("SHIFT", 20), - (126, G["if"]): ("SHIFT", 21), - (126, G["let"]): ("SHIFT", 23), - (126, G["not"]): ("SHIFT", 44), - (126, G["~"]): ("SHIFT", 37), (127, G[";"]): ("REDUCE", AttributeProduction(G["attribute"], Sentence(G["id"], G[":"], G["type"], G["<-"], G["expr"]), [lambda s: AttrDeclarationNode(s[1], s[3], s[5])])), - (128, G["class"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["{"], G["}"]), [lambda s: ClassDeclarationNode(s[2], [])])), - (128, G["$"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["{"], G["}"]), [lambda s: ClassDeclarationNode(s[2], [])])), - (129, G["}"]): ("SHIFT", 130), - (130, G["class"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["{"], G["feature-list"], G["}"]), [lambda s: ClassDeclarationNode(s[2], s[4])])), - (130, G["$"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["{"], G["feature-list"], G["}"]), [lambda s: ClassDeclarationNode(s[2], s[4])])), - (131, G[";"]): ("SHIFT", 132), - (132, G["id"]): ("SHIFT", 4), - (132, G["}"]): ("REDUCE", AttributeProduction(G["feature-list"], Sentence(G["attribute"], G[";"]), [lambda s: [s[1]]])), - (133, G["}"]): ("REDUCE", AttributeProduction(G["feature-list"], Sentence(G["attribute"], G[";"], G["feature-list"]), [lambda s: [s[1]] + s[3]])), - (134, G[";"]): ("SHIFT", 135), - (135, G["id"]): ("SHIFT", 4), - (135, G["}"]): ("REDUCE", AttributeProduction(G["feature-list"], Sentence(G["method"], G[";"]), [lambda s: [s[1]]])), - (136, G["}"]): ("REDUCE", AttributeProduction(G["feature-list"], Sentence(G["method"], G[";"], G["feature-list"]), [lambda s: [s[1]] + s[3]])), - (137, G["{"]): ("SHIFT", 142), - (137, G["type"]): ("SHIFT", 138), - (138, G["{"]): ("SHIFT", 139), - (139, G["id"]): ("SHIFT", 4), - (140, G["}"]): ("SHIFT", 141), - (141, G["class"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["inherits"], G["type"], G["{"], G["feature-list"], G["}"]), [lambda s: ClassDeclarationNode(s[2], s[6], s[4])])), - (141, G["$"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["inherits"], G["type"], G["{"], G["feature-list"], G["}"]), [lambda s: ClassDeclarationNode(s[2], s[6], s[4])])), - (142, G["}"]): ("SHIFT", 143), - (143, G["$"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["inherits"], G["{"], G["}"]), [lambda s: ClassDeclarationNode(s[2], [], s[4])])), - (143, G["class"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["inherits"], G["{"], G["}"]), [lambda s: ClassDeclarationNode(s[2], [], s[4])])), - (144, G["$"]): ("OK", None), - (145, G["$"]): ("REDUCE", AttributeProduction(G["program"], Sentence(G["class-set"]), [lambda s: ProgramNode(s[1])])), - (146, G["class"]): ("SHIFT", 1), - (146, G["$"]): ("REDUCE", AttributeProduction(G["class-set"], Sentence(G["class-def"]), [lambda s: [s[1]]])), - (147, G["$"]): ("REDUCE", AttributeProduction(G["class-set"], Sentence(G["class-def"], G["class-set"]), [lambda s: [s[1]] + s[2]])), + (128, G["}"]): ("SHIFT", 129), + (129, G["class"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["{"], G["feature-list"], G["}"]), [lambda s: ClassDeclarationNode(s[2], s[4])])), + (129, G["$"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["{"], G["feature-list"], G["}"]), [lambda s: ClassDeclarationNode(s[2], s[4])])), + (130, G[";"]): ("SHIFT", 131), + (131, G["id"]): ("SHIFT", 4), + (131, G["}"]): ("REDUCE", AttributeProduction(G["feature-list"], G.Epsilon, [lambda s: []])), + (132, G["}"]): ("REDUCE", AttributeProduction(G["feature-list"], Sentence(G["attribute"], G[";"], G["feature-list"]), [lambda s: [s[1]] + s[3]])), + (133, G[";"]): ("SHIFT", 134), + (134, G["id"]): ("SHIFT", 4), + (134, G["}"]): ("REDUCE", AttributeProduction(G["feature-list"], G.Epsilon, [lambda s: []])), + (135, G["}"]): ("REDUCE", AttributeProduction(G["feature-list"], Sentence(G["method"], G[";"], G["feature-list"]), [lambda s: [s[1]] + s[3]])), + (136, G["type"]): ("SHIFT", 137), + (137, G["{"]): ("SHIFT", 138), + (138, G["id"]): ("SHIFT", 4), + (138, G["}"]): ("REDUCE", AttributeProduction(G["feature-list"], G.Epsilon, [lambda s: []])), + (139, G["}"]): ("SHIFT", 140), + (140, G["class"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["inherits"], G["type"], G["{"], G["feature-list"], G["}"]), [lambda s: ClassDeclarationNode(s[2], s[6], s[4])])), + (140, G["$"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["inherits"], G["type"], G["{"], G["feature-list"], G["}"]), [lambda s: ClassDeclarationNode(s[2], s[6], s[4])])), + (141, G["$"]): ("OK", None), + (142, G["$"]): ("REDUCE", AttributeProduction(G["program"], Sentence(G["class-set"]), [lambda s: ProgramNode(s[1])])), + (143, G["class"]): ("SHIFT", 1), + (143, G["$"]): ("REDUCE", AttributeProduction(G["class-set"], Sentence(G["class-def"]), [lambda s: [s[1]]])), + (144, G["$"]): ("REDUCE", AttributeProduction(G["class-set"], Sentence(G["class-def"], G["class-set"]), [lambda s: [s[1]] + s[2]])), } def __goto_table(self): G = self.G return { - (0, G["class-def"]): 146, - (0, G["class-set"]): 145, - (0, G["program"]): 144, - (3, G["method"]): 134, - (3, G["attribute"]): 131, - (3, G["feature-list"]): 129, + (0, G["class-def"]): 143, + (0, G["class-set"]): 142, + (0, G["program"]): 141, + (3, G["attribute"]): 130, + (3, G["method"]): 133, + (3, G["feature-list"]): 128, (5, G["param-list"]): 117, (9, G["param-list"]): 10, - (14, G["comp"]): 46, - (14, G["function-call"]): 38, - (14, G["atom"]): 40, (14, G["arith"]): 63, + (14, G["atom"]): 40, (14, G["term"]): 58, + (14, G["comp"]): 46, (14, G["expr"]): 115, + (14, G["function-call"]): 38, (14, G["factor"]): 55, - (16, G["expr-list"]): 111, - (16, G["term"]): 58, - (16, G["arith"]): 63, - (16, G["comp"]): 46, (16, G["expr"]): 66, - (16, G["factor"]): 55, - (16, G["atom"]): 40, + (16, G["comp"]): 46, (16, G["function-call"]): 38, - (19, G["comp"]): 46, - (19, G["term"]): 58, - (19, G["factor"]): 55, - (19, G["function-call"]): 38, + (16, G["atom"]): 40, + (16, G["arith"]): 63, + (16, G["factor"]): 55, + (16, G["term"]): 58, + (16, G["expr-list"]): 111, (19, G["atom"]): 40, - (19, G["block"]): 106, (19, G["expr"]): 108, + (19, G["term"]): 58, + (19, G["function-call"]): 38, (19, G["arith"]): 63, + (19, G["comp"]): 46, + (19, G["block"]): 106, + (19, G["factor"]): 55, + (20, G["atom"]): 40, + (20, G["function-call"]): 38, (20, G["comp"]): 46, - (20, G["term"]): 58, + (20, G["arith"]): 63, (20, G["factor"]): 55, - (20, G["atom"]): 40, + (20, G["term"]): 58, (20, G["expr"]): 104, - (20, G["arith"]): 63, - (20, G["function-call"]): 38, + (21, G["function-call"]): 38, + (21, G["factor"]): 55, + (21, G["arith"]): 63, + (21, G["comp"]): 46, (21, G["term"]): 58, (21, G["atom"]): 40, - (21, G["comp"]): 46, (21, G["expr"]): 98, - (21, G["arith"]): 63, - (21, G["function-call"]): 38, - (21, G["factor"]): 55, - (22, G["expr"]): 94, + (22, G["comp"]): 46, (22, G["arith"]): 63, + (22, G["factor"]): 55, + (22, G["term"]): 58, (22, G["atom"]): 40, + (22, G["expr"]): 94, (22, G["function-call"]): 38, - (22, G["comp"]): 46, - (22, G["term"]): 58, - (22, G["factor"]): 55, (23, G["declaration-list"]): 91, (27, G["declaration-list"]): 28, - (29, G["arith"]): 63, - (29, G["expr"]): 88, - (29, G["comp"]): 46, (29, G["term"]): 58, + (29, G["expr"]): 88, (29, G["atom"]): 40, - (29, G["factor"]): 55, + (29, G["arith"]): 63, (29, G["function-call"]): 38, + (29, G["factor"]): 55, + (29, G["comp"]): 46, (30, G["term"]): 58, - (30, G["factor"]): 55, - (30, G["arith"]): 63, - (30, G["comp"]): 46, (30, G["atom"]): 40, - (30, G["expr"]): 77, + (30, G["comp"]): 46, (30, G["function-call"]): 38, - (33, G["atom"]): 40, + (30, G["arith"]): 63, + (30, G["expr"]): 77, + (30, G["factor"]): 55, (33, G["function-call"]): 38, + (33, G["atom"]): 40, (33, G["factor"]): 76, - (37, G["factor"]): 39, - (37, G["atom"]): 40, (37, G["function-call"]): 38, - (43, G["term"]): 58, - (43, G["arith"]): 63, - (43, G["comp"]): 46, + (37, G["atom"]): 40, + (37, G["factor"]): 39, (43, G["expr"]): 66, - (43, G["expr-list"]): 64, - (43, G["factor"]): 55, - (43, G["atom"]): 40, + (43, G["comp"]): 46, (43, G["function-call"]): 38, + (43, G["atom"]): 40, + (43, G["arith"]): 63, + (43, G["factor"]): 55, + (43, G["term"]): 58, + (43, G["expr-list"]): 64, + (44, G["function-call"]): 38, + (44, G["factor"]): 55, (44, G["term"]): 58, - (44, G["atom"]): 40, (44, G["arith"]): 63, - (44, G["function-call"]): 38, + (44, G["atom"]): 40, (44, G["comp"]): 46, - (44, G["factor"]): 55, (44, G["expr"]): 45, + (47, G["function-call"]): 38, (47, G["arith"]): 48, + (47, G["factor"]): 55, (47, G["term"]): 58, (47, G["atom"]): 40, - (47, G["function-call"]): 38, - (47, G["factor"]): 55, - (49, G["atom"]): 40, - (49, G["term"]): 50, (49, G["function-call"]): 38, (49, G["factor"]): 55, + (49, G["atom"]): 40, + (49, G["term"]): 50, + (51, G["function-call"]): 38, (51, G["factor"]): 52, (51, G["atom"]): 40, - (51, G["function-call"]): 38, - (53, G["factor"]): 54, - (53, G["atom"]): 40, (53, G["function-call"]): 38, - (56, G["term"]): 57, - (56, G["atom"]): 40, + (53, G["atom"]): 40, + (53, G["factor"]): 54, (56, G["function-call"]): 38, + (56, G["term"]): 57, (56, G["factor"]): 55, - (59, G["term"]): 58, - (59, G["arith"]): 60, - (59, G["atom"]): 40, + (56, G["atom"]): 40, (59, G["function-call"]): 38, + (59, G["arith"]): 60, (59, G["factor"]): 55, - (61, G["arith"]): 62, - (61, G["term"]): 58, - (61, G["atom"]): 40, + (59, G["term"]): 58, + (59, G["atom"]): 40, (61, G["function-call"]): 38, + (61, G["arith"]): 62, (61, G["factor"]): 55, - (67, G["term"]): 58, - (67, G["expr-list"]): 68, - (67, G["arith"]): 63, + (61, G["atom"]): 40, + (61, G["term"]): 58, + (67, G["expr"]): 66, (67, G["comp"]): 46, (67, G["function-call"]): 38, - (67, G["expr"]): 66, - (67, G["factor"]): 55, (67, G["atom"]): 40, - (73, G["term"]): 58, - (73, G["arith"]): 63, - (73, G["comp"]): 46, + (67, G["arith"]): 63, + (67, G["factor"]): 55, + (67, G["term"]): 58, + (67, G["expr-list"]): 68, (73, G["expr"]): 66, - (73, G["factor"]): 55, + (73, G["comp"]): 46, + (73, G["function-call"]): 38, (73, G["atom"]): 40, + (73, G["arith"]): 63, + (73, G["factor"]): 55, + (73, G["term"]): 58, (73, G["expr-list"]): 74, - (73, G["function-call"]): 38, (78, G["case-list"]): 86, - (82, G["comp"]): 46, + (82, G["atom"]): 40, (82, G["term"]): 58, - (82, G["factor"]): 55, - (82, G["function-call"]): 38, (82, G["expr"]): 83, - (82, G["atom"]): 40, + (82, G["function-call"]): 38, (82, G["arith"]): 63, + (82, G["comp"]): 46, + (82, G["factor"]): 55, (84, G["case-list"]): 85, (89, G["declaration-list"]): 90, - (92, G["expr"]): 93, + (92, G["function-call"]): 38, + (92, G["factor"]): 55, (92, G["term"]): 58, - (92, G["atom"]): 40, (92, G["arith"]): 63, + (92, G["atom"]): 40, (92, G["comp"]): 46, - (92, G["factor"]): 55, - (92, G["function-call"]): 38, - (95, G["term"]): 58, + (92, G["expr"]): 93, + (95, G["comp"]): 46, (95, G["arith"]): 63, - (95, G["function-call"]): 38, + (95, G["term"]): 58, (95, G["factor"]): 55, - (95, G["comp"]): 46, (95, G["atom"]): 40, (95, G["expr"]): 96, + (95, G["function-call"]): 38, (99, G["comp"]): 46, - (99, G["function-call"]): 38, - (99, G["arith"]): 63, + (99, G["expr"]): 100, (99, G["term"]): 58, - (99, G["atom"]): 40, (99, G["factor"]): 55, - (99, G["expr"]): 100, - (101, G["atom"]): 40, + (99, G["atom"]): 40, + (99, G["arith"]): 63, + (99, G["function-call"]): 38, (101, G["expr"]): 102, + (101, G["atom"]): 40, + (101, G["comp"]): 46, (101, G["term"]): 58, (101, G["function-call"]): 38, (101, G["arith"]): 63, - (101, G["comp"]): 46, (101, G["factor"]): 55, - (109, G["block"]): 110, - (109, G["comp"]): 46, - (109, G["term"]): 58, - (109, G["factor"]): 55, - (109, G["function-call"]): 38, (109, G["atom"]): 40, (109, G["expr"]): 108, + (109, G["term"]): 58, + (109, G["function-call"]): 38, (109, G["arith"]): 63, + (109, G["comp"]): 46, + (109, G["block"]): 110, + (109, G["factor"]): 55, + (113, G["function-call"]): 38, + (113, G["factor"]): 55, (113, G["term"]): 58, - (113, G["atom"]): 40, (113, G["arith"]): 63, - (113, G["expr"]): 114, + (113, G["atom"]): 40, (113, G["comp"]): 46, - (113, G["factor"]): 55, - (113, G["function-call"]): 38, - (121, G["comp"]): 46, - (121, G["function-call"]): 38, - (121, G["expr"]): 122, - (121, G["atom"]): 40, + (113, G["expr"]): 114, (121, G["arith"]): 63, + (121, G["atom"]): 40, (121, G["term"]): 58, + (121, G["comp"]): 46, + (121, G["function-call"]): 38, (121, G["factor"]): 55, - (126, G["comp"]): 46, + (121, G["expr"]): 122, + (126, G["atom"]): 40, + (126, G["expr"]): 127, (126, G["term"]): 58, - (126, G["factor"]): 55, (126, G["function-call"]): 38, - (126, G["atom"]): 40, (126, G["arith"]): 63, - (126, G["expr"]): 127, - (132, G["method"]): 134, - (132, G["attribute"]): 131, - (132, G["feature-list"]): 133, - (135, G["method"]): 134, - (135, G["attribute"]): 131, - (135, G["feature-list"]): 136, - (139, G["method"]): 134, - (139, G["attribute"]): 131, - (139, G["feature-list"]): 140, - (146, G["class-def"]): 146, - (146, G["class-set"]): 147, + (126, G["comp"]): 46, + (126, G["factor"]): 55, + (131, G["attribute"]): 130, + (131, G["method"]): 133, + (131, G["feature-list"]): 132, + (134, G["attribute"]): 130, + (134, G["method"]): 133, + (134, G["feature-list"]): 135, + (138, G["feature-list"]): 139, + (138, G["attribute"]): 130, + (138, G["method"]): 133, + (143, G["class-def"]): 143, + (143, G["class-set"]): 144, } diff --git a/tests.py b/tests.py index 015c21232..4c45a8bc7 100644 --- a/tests.py +++ b/tests.py @@ -1,5 +1,8 @@ +from typing import List + import fire +from cmp.utils import Token from definitions import cool_grammar from lexer import CoolLexer from parser import CoolParser @@ -11,7 +14,10 @@ class Tester: @staticmethod - def tokenize(script, print_tokens=True): + def tokenize(script: str, print_tokens: bool = True) -> List[Token]: + """ + Method for tokenize a cool program + """ file = f'scripts/{script}' program = ''.join(open(file, 'r').read()) @@ -25,6 +31,11 @@ def tokenize(script, print_tokens=True): @staticmethod def parse(script): + """ + Method for parse a cool program and return an ast + :param script: + :return: + """ tokens = Tester.tokenize(script, print_tokens=False) _, ast = parser(tokens, get_ast=True) print(ast) From 9165a4093113260dfcf725c1fbe4d50f90d0a932 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Wed, 15 Apr 2020 18:00:55 -0400 Subject: [PATCH 006/143] new lexer finished --- astnodes.py | 2 + build.py | 11 +- cmp/parsing/__pycache__/lexer.cpython-37.pyc | Bin 2558 -> 1616 bytes cmp/parsing/lexer.py | 94 ++---- cmp/parsing/new_lexer.py | 78 ----- cmp/parsing/parsing.py | 34 +- .../serializer.py} | 0 cmp/regex/__init__.py | 2 - cmp/regex/ast.py | 104 ------ cmp/regex/automata.py | 297 ----------------- cmp/regex/regex.py | 314 ------------------ cmp/serializer/__init__.py | 2 - cmp/serializer/lexer_serializer.py | 89 ----- cmp/utils.py | 160 +-------- definitions.py | 51 --- lexer.py | 127 ++++--- semantic.py | 4 +- tests.py | 2 +- 18 files changed, 128 insertions(+), 1243 deletions(-) delete mode 100644 cmp/parsing/new_lexer.py rename cmp/{serializer/parser_serializer.py => parsing/serializer.py} (100%) delete mode 100644 cmp/regex/__init__.py delete mode 100644 cmp/regex/ast.py delete mode 100644 cmp/regex/automata.py delete mode 100644 cmp/regex/regex.py delete mode 100644 cmp/serializer/__init__.py delete mode 100644 cmp/serializer/lexer_serializer.py diff --git a/astnodes.py b/astnodes.py index fd629952d..6bc2c58f2 100644 --- a/astnodes.py +++ b/astnodes.py @@ -1,4 +1,6 @@ class Node: + row = 0 + col = 0 pass diff --git a/build.py b/build.py index 2af2f53b5..fd320b307 100644 --- a/build.py +++ b/build.py @@ -1,5 +1,5 @@ -from definitions import cool_parser, cool_lexer -from cmp.serializer import LexerSerializer, LRParserSerializer +from definitions import cool_parser +from cmp.parsing.serializer import LRParserSerializer PARSER_SETTINGS = { 'parser': cool_parser(), @@ -7,12 +7,5 @@ 'file': 'parser.py', } -LEXER_SETTINGS = { - 'lexer': cool_lexer(), - 'class': 'CoolLexer', - 'file': 'lexer.py', -} - if __name__ == '__main__': LRParserSerializer.build(**PARSER_SETTINGS) - LexerSerializer.build(**LEXER_SETTINGS) diff --git a/cmp/parsing/__pycache__/lexer.cpython-37.pyc b/cmp/parsing/__pycache__/lexer.cpython-37.pyc index 76eb5ba7dd73df444ab57a78aab4b7bff49cbc8f..a1ed2dd27eb891258c9bbd43cbc09930ae06134f 100644 GIT binary patch literal 1616 zcmZuxL66%+6rML@C*Ev!NxL9gsVZpI0`4I}TzZKX1V~&^v{EaOEWo&)$*wm}oSpHa zY~-90iC#Ex=>;JrNB#l7Wv-n17xu(^lX|zH9qT=hpP%2G_r34=%e}o8!}b39)lYv5 z#{Qv)df_ws0>ylUN-_yKi|EdC81sk&`-Vv&y%m$*l1DSL6q$Vjn z*6TXpXJ}C@0?8sSTart$f=DP&deUF9B}Be#$mWVg4H?KCyfHp5pJ&Ype-Y1_Q z_pjjS3PM*rLc_bCT0hCN#8`+U-{I%pZPgy;xN7zD%#>*{o*vzyoK!-C%|EUyd<*(+ zKQGcGH%GXszo7=471_l4S*gaxa;Llfo$z)52g~bOxuwrWLuGIM(SMv|4|h zlahTSwJYQ=F$)11xKyZFX*P%-de zAFmegK!-@!se!6puTdhj=!7)?<{qkF*$`(^@>TGXtr4jW5D|$sgKOrIGtJHcee?*G zW8MQ|-onBA5+NmMCA-g-{0;BGp@WD}PS@^G=)1TlSZ11nh2UzwDNnzL)(=r?vK`iy zAiMH7zLjTSJN4h7t{1ZsnEH?uAy{W3V$%q3!+n5HE)#oeaJR2Q7=!_NPLi>TV~e#z8%Ns7fHT-qxUIf+muO}rDKJE52*t*X#z?=CUw(7x1%%Y8dF2Q0knd)AM83S k5`h|HckuVqy(qKXY!Rd{ZVP3D{`O=?L_{|&0dI?c0fk^>{Qv*} literal 2558 zcmZ`)&2Jk;6rY*>@Y->lG>rm*sz3nIy~GG1DxoMUr3k62qKHH-SZ!Au&p36mAI|K$ z*wOlwaO?rjJtRl|rM+_MnOjc$-mK%M5nXG>@6EjVc)$01Z|={}HyFM{M}DxF7aq;!|Sp^yHl{fL%*imng^3s}LYo2OZOdz`;WlXf>vqjonQvRNW2Qf|85&%9hYEZu1r1;7g(bcw3?+j&Du@zRCli>zgp{a$16q$WG0myAB~o zDxUBOxOKpR^GYFrT5Dnzgso)|S_VR#SO=8EmbskHecL!+xwH~W8K^+yjjYalrLrArc|k#FE@*M5EE;f{3*>amU{v;ap@mvK`h=;ofBv z$EVnw!sj8K zbsoPBttpP@rr41!0JC#7%4cv9jfoXqwCp9iku136hnAM8H;Dc@hr@8W0C0zO{k-5g zFRT-k%0CDyo(n0Yb&5yl^JV7jPp?5jkL272>* z+Kslg+40&G7L$ss?jSw*#(xbnV>I+laz= zPlo2$e__RrKYRb7Q(Nq09jfsgI_`ph;k)`PNJN9Aw2({{OXy5fw0)-{&>b2u1R^@< zkEwe%x5|2O>FT$b&1jaPjI@Nu7x@}*TAnywxOTr8Pb$!+)ngeet7r0(BNTZ<_Zegs zY=~S2vX3C_QwWzpCKMYg>4i8Ee~Ke}r@APDNU4iF@$skM=fy>1BSJmtrtx6Yq&Qv7 zeH+aHA&i3HN-$^UIDs6;>thO$LF^htc)_am_hD#=!mhkt)zp^XqL(fSV-*BtBM9PD z4kMDAL2xt-qiRM|sn&#orYmYnveH7as){GoH%-;fgx6e5e@E)u8yU%ze-9JXGFsqq z&-t{~s<#$eEls0a{#@zeK|vL)jxvXu^O|_4*QeDoGzWL;G*mr2MC8)w!@M7527j~T X|6KxXt{mMYW@dEovS^~tG_C&tSc@&` diff --git a/cmp/parsing/lexer.py b/cmp/parsing/lexer.py index 57f10226d..bc94ab0b9 100644 --- a/cmp/parsing/lexer.py +++ b/cmp/parsing/lexer.py @@ -1,67 +1,43 @@ -from typing import Tuple, List, Any +import re -from cmp.automata import State -from cmp.regex import Regex from cmp.utils import Token class Lexer: - def __init__(self, table, eof): + def __init__(self, table, eof, skip_chars=None): + if skip_chars is None: + skip_chars = set() + self.skip_chars = skip_chars + self.table = {**table, **{'$': (eof, '$')}} + self.pattern = self.__build_regex(table) self.eof = eof - self.regexs = self._build_regexs(table) - self.automaton = self._build_automaton() - - def _build_regexs(self, table: List[Tuple[Any, str]]) -> List[State]: - regexs = [] - for n, (token_type, regex) in enumerate(table): - automaton = Regex.build_automaton(regex) - automaton, states = State.from_nfa(automaton, get_states=True) - - for state in states: - if state.final: - state.tag: Tuple[int, Any] = (n, token_type) - - regexs.append(automaton) - - return regexs - - def _build_automaton(self) -> State: - start: State = State('start') - regexs = self.regexs - - for regex in regexs: - start.add_epsilon_transition(regex) - - return start.to_deterministic() - - def _walk(self, string: str): - state = self.automaton - final = state if state.final else None - final_lex = lex = '' - - for symbol in string: - try: - state = state[symbol][0] - lex += symbol - final, final_lex = (state, lex) if state.final else (final, final_lex) - except TypeError: - break - - return final, final_lex - - def _tokenize(self, text: str): - while text != '': - state, lex = self._walk(text) - - if state is not None: - text = text[len(lex):] - token_type = min((s for s in state.state if s.final), key=lambda x: x.tag).tag[1] - yield lex, token_type + @staticmethod + def __build_regex(table): + r = '|'.join([f'(?P<{alias}>{regex})' for alias, (_, regex) in table.items()]) + return re.compile(r) + + def __tokenize(self, text): + row = 0 + col = 0 + pos = 0 + while pos < len(text): + if text[pos] == ' ': + pos += 1 + col += 1 + elif text[pos] == '\t': + pos += 1 + col += 4 + elif text[pos] == '\n': + pos += 1 + row += 1 + col = 0 else: - return None - - yield '$', self.eof - - def __call__(self, text: str): - return [Token(lex, token_type) for lex, token_type in self._tokenize(text)] + match = self.pattern.match(text, pos=pos) + yield match.group(), match.lastgroup, row, col + pos = match.end() + col += len(match.group()) + yield '$', '$' + + def __call__(self, text): + return [Token(lex, self.table[alias][0], row, col) for lex, alias, row, col in self.__tokenize(text)] diff --git a/cmp/parsing/new_lexer.py b/cmp/parsing/new_lexer.py deleted file mode 100644 index 92a48fdcd..000000000 --- a/cmp/parsing/new_lexer.py +++ /dev/null @@ -1,78 +0,0 @@ -import re - -from cmp.utils import Token - - -class Lexer: - def __init__(self, table, eof): - self.table = table - self.pattern = self.__build_regex(self.table) - self.eof = eof - - @staticmethod - def __build_regex(table): - r = '|'.join([f'(?P<{alias}>{regex})' for alias, (_, regex) in table.items()]) - return re.compile(r) - - def __tokenize(self, text): - pos = 0 - while pos < len(text): - if text[pos] in (' ', '\n', '\t'): - pos += 1 - else: - match = self.pattern.match(text, pos=pos) - yield match.group(), match.lastgroup - pos = match.end() - yield '$', self.eof - - def __call__(self, text): - return [Token(lex, self.table[alias][0]) for lex, alias in self.__tokenize(text)] - - -if __name__ == '__main__': - def get_lexer(G): - return Lexer({ - 'add': (G['+'], '\+'), - 'sub': (G['-'], '-'), - 'mul': (G['*'], '\*'), - 'div': (G['/'], '/'), - 'le': (G['<='], '<='), - 'lt': (G['<'], '<'), - 'eq': (G['='], '='), - 'comp': (G['~'], '~'), - 'not': (G['not'], 'not'), - 'ocur': (G['{'], '{'), - 'ccur': (G['}'], '}'), - 'opar': (G['('], '\('), - 'cpar': (G[')'], '\)'), - 'coma': (G[','], ','), - 'dot': (G['.'], '.'), - 'arroba': (G['@'], '@'), - 'colon': (G[':'], ':'), - 'semicolon': (G[';'], ';'), - 'assign': (G['<-'], '<-'), - 'arrow': (G['=>'], '=>'), - 'class': (G['class'], 'class'), - 'inherits': (G['inherits'], 'inherits'), - 'if': (G['if'], 'if'), - 'then': (G['then'], 'then'), - 'else': (G['else'], 'else'), - 'fi': (G['fi'], 'fi'), - 'while': (G['while'], 'while'), - 'loop': (G['loop'], 'loop'), - 'pool': (G['pool'], 'pool'), - 'let': (G['let'], 'let'), - 'in': (G['in'], 'in'), - 'case': (G['case'], 'case'), - 'esac': (G['esac'], 'esac'), - 'of': (G['of'], 'of'), - 'new': (G['new'], 'new'), - 'isvoid': (G['isvoid'], 'isvoid'), - 'true': (G['true'], 'true'), - 'false': (G['false'], 'false'), - 'end': (G['end'], 'end'), - 'int': (G['integer'], '-?[1-9][0-9]*'), - 'type': (G['type'], '[A-Z][a-zA-Z0-9]*'), - 'id': (G['id'], '[a-z][a-zA-Z0-9]*'), - 'string': (G['string'], '"[ -~]*"'), - }, G.EOF) diff --git a/cmp/parsing/parsing.py b/cmp/parsing/parsing.py index f4370f26f..2429a831d 100755 --- a/cmp/parsing/parsing.py +++ b/cmp/parsing/parsing.py @@ -1,4 +1,5 @@ from enum import auto, Enum +from typing import Any, List from .automatas import build_lr0_automaton, build_lr1_automaton, build_larl1_automaton from .utils import compute_firsts, compute_follows @@ -6,7 +7,7 @@ class LRConflictType(Enum): """ - Enum for mark the type of a lr-family parser + Enum for mark the type of lr-family parser """ ReduceReduce = auto() ShiftReduce = auto() @@ -120,7 +121,7 @@ class ShiftReduceParser: REDUCE = 'REDUCE' OK = 'OK' - def __init__(self, G, verbose=False): + def __init__(self, G): self.G = G self.augmented_G = G.AugmentedGrammar(True) self.firsts = compute_firsts(self.augmented_G) @@ -129,7 +130,6 @@ def __init__(self, G, verbose=False): self.state_dict = {} self.conflict = None - self.verbose = verbose self.action = {} self.goto = {} self._build_parsing_table() @@ -142,8 +142,6 @@ def _build_parsing_table(self): automaton = self.automaton for i, node in enumerate(automaton): - if self.verbose: - print(i, '\t', '\n\t '.join(str(x) for x in node.state), '\n') node.idx = i self.state_dict[i] = node @@ -164,16 +162,13 @@ def _build_parsing_table(self): else: self._register(self.goto, (idx, symbol), idj) - def __call__(self, tokens, get_ast=False): - stack = [0] + def __call__(self, tokens): + stack: List[Any] = [0] cursor = 0 - output = [] while True: state = stack[-1] lookahead = tokens[cursor] - if self.verbose: - print(stack, '<---||--->', tokens[cursor:]) assert (state, lookahead.token_type) in self.action, f'Parsing Error in ' \ f'{(state, lookahead.lex, lookahead.token_type)} ' @@ -181,33 +176,30 @@ def __call__(self, tokens, get_ast=False): action, tag = self.action[state, lookahead.token_type] if action == self.SHIFT: - stack += [lookahead.token_type, lookahead.lex, tag] + stack += [lookahead, lookahead.lex, tag] cursor += 1 elif action == self.REDUCE: - output.append(tag) - head, body = tag try: - attribute = tag.attributes[0] # La gramatica es atributada + attribute = tag.attributes[0] # It's an attributed grammar except AttributeError: - attribute = None # La gramatica es no atributada + attribute = None # it's not an attribute grammar syn = [None] * (len(body) + 1) for i, symbol in enumerate(reversed(body), 1): - stack.pop() - syn[-i] = stack.pop() - assert symbol == stack.pop(), 'Bad Reduce...' + state, node, token = stack.pop(), stack.pop(), stack.pop() + syn[-i] = node + assert symbol == token.token_type, 'Bad Reduce...' syn[0] = attribute(syn) if attribute is not None else None state = stack[-1] goto = self.goto[state, head] stack += [head, syn[0], goto] - elif action == self.OK: - return (output, stack[2]) if get_ast else output + return stack[2] else: - raise Exception('Parsing error...') + raise Exception(f'Parsing error: invalid action {action}') def _register(self, table, key, value): # assert key not in table or table[key] == value, 'Shift-Reduce or Reduce-Reduce conflict!!!' diff --git a/cmp/serializer/parser_serializer.py b/cmp/parsing/serializer.py similarity index 100% rename from cmp/serializer/parser_serializer.py rename to cmp/parsing/serializer.py diff --git a/cmp/regex/__init__.py b/cmp/regex/__init__.py deleted file mode 100644 index e88825276..000000000 --- a/cmp/regex/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from .automata import NFA, DFA -from .regex import Regex diff --git a/cmp/regex/ast.py b/cmp/regex/ast.py deleted file mode 100644 index 7801a4b82..000000000 --- a/cmp/regex/ast.py +++ /dev/null @@ -1,104 +0,0 @@ -from cmp.ast import UnaryNode, BinaryNode, AtomicNode -from .automata import DFA, automata_closure, automata_concatenation, automata_union - -EPSILON = 'ε' - - -class EpsilonNode(AtomicNode): - def evaluate(self): - return DFA(states=1, finals=[0], transitions={}) - - def __str__(self): - return EPSILON - - -class SymbolNode(AtomicNode): - def evaluate(self): - s = self.lex - return DFA(states=2, finals=[1], transitions={(0, s): 1}) - - def __str__(self): - return self.lex - - def __repr__(self): - return str(self) - - -class ClosureNode(UnaryNode): - @staticmethod - def operate(value): - return automata_closure(value) - - def __str__(self): - return str(self.node) + '*' - - def __repr__(self): - return str(self) - - -class UnionNode(BinaryNode): - @staticmethod - def operate(lvalue, rvalue): - return automata_union(lvalue, rvalue) - - def __str__(self): - return str(self.left) + "|" + str(self.right) - - def __repr__(self): - return self.__str__() - - -class ConcatNode(BinaryNode): - @staticmethod - def operate(lvalue, rvalue): - return automata_concatenation(lvalue, rvalue) - - def __str__(self): - return str(self.left) + str(self.right) - - def __repr__(self): - return self.__str__() - - -class RangeNode(BinaryNode): - def evaluate(self): - lvalue = self.left.lex - rvalue = self.right.lex - return self.operate(lvalue, rvalue) - - @staticmethod - def operate(lvalue, rvalue): - node = SymbolNode(lvalue) - for n in range(ord(lvalue) + 1, ord(rvalue) + 1): - node = UnionNode(node, SymbolNode(chr(n))) - return node.evaluate() - - def __str__(self): - return f'{str(self.left)}-{str(self.right)}' - - def __repr__(self): - return self.__str__() - - -class QuestionNode(UnaryNode): - @staticmethod - def operate(value): - return automata_union(value, EpsilonNode(EPSILON).evaluate()) - - def __str__(self): - return str(self.node) + '?' - - def __repr__(self): - return self.__str__() - - -class PlusNode(UnaryNode): - @staticmethod - def operate(value): - return automata_concatenation(value, automata_closure(value)) - - def __str__(self): - return str(self.node) + '+' - - def __repr__(self): - return self.__str__() diff --git a/cmp/regex/automata.py b/cmp/regex/automata.py deleted file mode 100644 index 7c5dac5b8..000000000 --- a/cmp/regex/automata.py +++ /dev/null @@ -1,297 +0,0 @@ -import pydot -from cmp.utils import ContainerSet, DisjointSet - - -class NFA: - def __init__(self, states, finals, transitions, start=0): - self.states = states - self.start = start - self.finals = set(finals) - self.map = transitions - self.vocabulary = set() - self.transitions = {state: {} for state in range(states)} - - for (origin, symbol), destinations in transitions.items(): - assert hasattr(destinations, '__iter__'), 'Invalid collection of states' - self.transitions[origin][symbol] = destinations - self.vocabulary.add(symbol) - - self.vocabulary.discard('') - - def epsilon_transitions(self, state): - assert state in self.transitions, 'Invalid state' - try: - return self.transitions[state][''] - except KeyError: - return () - - def graph(self): - G = pydot.Dot(graph_type='digraph', rankdir='LR', margin=0.1) - G.add_node(pydot.Node('start', shape='plaintext', label='', width=0, height=0)) - - for (start, tran), destinations in self.map.items(): - tran = 'ε' if tran == '' else tran - G.add_node(pydot.Node(start, shape='circle', style='bold' if start in self.finals else '')) - for end in destinations: - G.add_node(pydot.Node(end, shape='circle', style='bold' if end in self.finals else '')) - G.add_edge(pydot.Edge(start, end, label=tran, labeldistance=2)) - - G.add_edge(pydot.Edge('start', self.start, label='', style='dashed')) - return G - - def _repr_svg_(self): - try: - return self.graph().create_svg().decode('utf8') - except: - pass - - -class DFA(NFA): - - def __init__(self, states, finals, transitions, start=0): - assert all(isinstance(value, int) for value in transitions.values()) - assert all(len(symbol) > 0 for origin, symbol in transitions) - - transitions = {key: [value] for key, value in transitions.items()} - NFA.__init__(self, states, finals, transitions, start) - self.current = start - - def _move(self, symbol): - try: - self.current = self.transitions[self.current][symbol][0] - return True - except KeyError: - return False - - def _reset(self): - self.current = self.start - - def recognize(self, string): - self._reset() - for char in string: - if not self._move(char): - return False - return self.current in self.finals - - @staticmethod - def from_nfa(automaton): - return nfa_to_dfa(automaton) - - @staticmethod - def minimize(automaton): - return automata_minimization(automaton) - - -######################### -# NFA -> DFA Convertion # -######################### -def move(automaton, states, symbol): - moves = set() - for state in states: - symbols = automaton.transitions[state] - try: - moves.update({s for s in symbols[symbol]}) - except KeyError: - continue - return moves - - -def epsilon_closure(automaton, states): - pending = list(states) - closure = set(states) - - while pending: - state = pending.pop() - symbols = automaton.epsilon_transitions(state) - - for s in symbols: - if s not in closure: - pending.append(s) - closure.add(s) - - return ContainerSet(*closure) - - -def nfa_to_dfa(automaton): - transitions = {} - - start = epsilon_closure(automaton, [automaton.start]) - start.id = 0 - start.is_final = any(s in automaton.finals for s in start) - states = [start] - - pending = [start] - while pending: - state = pending.pop() - - for symbol in automaton.vocabulary: - state_move = move(automaton, state, symbol) - e_closure = epsilon_closure(automaton, state_move) - - if e_closure == set(): - continue - - if e_closure not in states: - e_closure.id = states[-1].id + 1 - e_closure.is_final = any(s in automaton.finals for s in e_closure) - - states.append(e_closure) - pending.append(e_closure) - else: - e_closure = next(s for s in states if s == e_closure) - - try: - var = transitions[state.id, symbol] - assert False, 'Invalid DFA!!!' - except KeyError: - transitions[state.id, symbol] = e_closure.id - - finals = [state.id for state in states if state.is_final] - dfa = DFA(len(states), finals, transitions) - return dfa - - -####################### -# Automata operations # -####################### -def automata_union(a1, a2): - transitions = {} - - start = 0 - d1 = 1 - d2 = a1.states + d1 - final = a2.states + d2 - - for (origin, symbol), destinations in a1.map.items(): - transitions[origin + d1, symbol] = [d + d1 for d in destinations] - - for (origin, symbol), destinations in a2.map.items(): - transitions[origin + d2, symbol] = [d + d2 for d in destinations] - - transitions[start, ''] = [a1.start + d1, a2.start + d2] - finals = [f + d1 for f in a1.finals] + [f + d2 for f in a2.finals] - for f in finals: - transitions[f, ''] = [final] - - states = a1.states + a2.states + 2 - finals = {final} - - return NFA(states, finals, transitions, start) - - -def automata_concatenation(a1, a2): - transitions = {} - - start = 0 - d1 = 0 - d2 = a1.states + d1 - final = a2.states + d2 - - for (origin, symbol), destinations in a1.map.items(): - transitions[origin + d1, symbol] = [d + d1 for d in destinations] - - for (origin, symbol), destinations in a2.map.items(): - transitions[origin + d2, symbol] = [d + d2 for d in destinations] - - for f in a1.finals: - transitions[f + d1, ''] = [a2.start + d2] - - for f in a2.finals: - transitions[f + d2, ''] = [final] - - states = a1.states + a2.states + 1 - finals = {final} - - return NFA(states, finals, transitions, start) - - -def automata_closure(a1): - transitions = {} - - start = 0 - d1 = 1 - final = a1.states + d1 - - for (origin, symbol), destinations in a1.map.items(): - transitions[origin + d1, symbol] = [d + d1 for d in destinations] - transitions[start, ''] = [a1.start + d1, final] - - for f in a1.finals: - try: - X = transitions[f + d1, ''] - except KeyError: - X = transitions[f + d1, ''] = set() - X.add(final) - X.add(a1.start + d1) - - states = a1.states + 2 - finals = {final} - - return NFA(states, finals, transitions, start) - - -###################### -# Minimize Automaton # -###################### -def distinguish_states(group, automaton, partition): - split = {} - vocabulary = tuple(automaton.vocabulary) - for member in group: - transitions = automaton.transitions[member.value] - destinations = ((transitions[s][0] if s in transitions else None) for s in vocabulary) - representative = tuple((partition[d].representative if d is not None else None) for d in destinations) - try: - split[representative].append(member.value) - except KeyError: - split[representative] = [member.value] - - return [group for group in split.values()] - - -def state_minimization(automaton): - partition = DisjointSet(*range(automaton.states)) - - ## partition = { NON-FINALS | FINALS } - partition.merge(automaton.finals) - partition.merge([x for x in range(automaton.states) if x not in automaton.finals]) - - while True: - new_partition = DisjointSet(*range(automaton.states)) - - for group in partition.groups: - for subgroup in distinguish_states(group, automaton, partition): - new_partition.merge(subgroup) - - if len(new_partition) == len(partition): - break - - partition = new_partition - - return partition - - -def automata_minimization(automaton): - partition = state_minimization(automaton) - - states = [s for s in partition.representatives] - - transitions = {} - - index = {state: i for i, state in enumerate(states)} - - for i, state in enumerate(states): - origin = state.value - - for symbol, destinations in automaton.transitions[origin].items(): - r = partition[destinations[0]].representative - - try: - transitions[i, symbol] - assert False - except KeyError: - transitions[i, symbol] = index[r] - - finals = list({index[partition[f].representative] for f in automaton.finals}) - start = index[partition[automaton.start].representative] - - return DFA(len(states), finals, transitions, start) diff --git a/cmp/regex/regex.py b/cmp/regex/regex.py deleted file mode 100644 index 1d63231ec..000000000 --- a/cmp/regex/regex.py +++ /dev/null @@ -1,314 +0,0 @@ -from cmp.pycompiler import Grammar, AttributeProduction, Sentence -from cmp.utils import Token -from cmp.parsing import ShiftReduceParser - -from .ast import (ClosureNode, ConcatNode, EpsilonNode, PlusNode, QuestionNode, - RangeNode, SymbolNode, UnionNode) -from .automata import DFA - - -class Regex: - def __init__(self, regex, skip_whitespaces=False): - self.regex = regex - self.automaton = self.build_automaton(regex, skip_whitespaces) - - def __call__(self, text): - return self.automaton.recognize(text) - - @staticmethod - def build_automaton(regex, skip_whitespaces=False): - parser = RegexParser(verbose=False) - tokens = regex_tokenizer(regex, parser.G, skip_whitespaces) - _, ast = parser(tokens, get_ast=True) - nfa = ast.evaluate() - dfa = DFA.from_nfa(nfa) - dfa = DFA.minimize(dfa) - return dfa - - @staticmethod - def Grammar(): - G = Grammar() - - E = G.NonTerminal('E', True) - T, F, A, L = G.NonTerminals('T F A L') - pipe, star, opar, cpar, symbol, epsilon, osquare, csquare, minus, plus, question = G.Terminals( - '| * ( ) symbol ε [ ] - + ?') - - E %= E + pipe + T, lambda s: UnionNode(s[1], s[3]) - E %= T, lambda s: s[1] - T %= T + F, lambda s: ConcatNode(s[1], s[2]) - T %= F, lambda s: s[1] - F %= A + star, lambda s: ClosureNode(s[1]) - F %= A + plus, lambda s: PlusNode(s[1]) - F %= A + question, lambda s: QuestionNode(s[1]) - F %= A, lambda s: s[1] - A %= symbol, lambda s: SymbolNode(s[1]) - A %= epsilon, lambda s: EpsilonNode(s[1]) - A %= opar + E + cpar, lambda s: s[2] - A %= osquare + L + csquare, lambda s: s[2] - L %= symbol, lambda s: SymbolNode(s[1]) - L %= symbol + minus + symbol, lambda s: RangeNode(SymbolNode(s[1]), SymbolNode(s[3])) - L %= symbol + L, lambda s: UnionNode(SymbolNode(s[1]), s[2]) - L %= symbol + minus + symbol + L, lambda s: UnionNode(RangeNode(SymbolNode(s[1]), SymbolNode(s[3])), s[4]) - - return G - - -# noinspection PyAbstractClass -class RegexParser(ShiftReduceParser): - def __init__(self, verbose=False): - G = Grammar() - G.NonTerminal('E', True) - G.NonTerminals('T F A L') - G.Terminals('| * ( ) symbol ε [ ] - + ?') - - self.G = G - self.verbose = verbose - self.action = self.__action_table() - self.goto = self.__goto_table() - - def __action_table(self): - G = self.G - return { - (0, G["symbol"]): ("SHIFT", 2), - (0, G["["]): ("SHIFT", 4), - (0, G["ε"]): ("SHIFT", 3), - (0, G["("]): ("SHIFT", 1), - (1, G["["]): ("SHIFT", 4), - (1, G["symbol"]): ("SHIFT", 2), - (1, G["("]): ("SHIFT", 1), - (1, G["ε"]): ("SHIFT", 3), - (2, G["$"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), - (2, G["+"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), - (2, G[")"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), - (2, G["|"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), - (2, G["?"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), - (2, G["symbol"]): ( - "REDUCE", AttributeProduction(G["A"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), - (2, G["ε"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), - (2, G["("]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), - (2, G["["]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), - (2, G["*"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), - (3, G["$"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["ε"]), [lambda s: EpsilonNode(s[1])])), - (3, G["+"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["ε"]), [lambda s: EpsilonNode(s[1])])), - (3, G[")"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["ε"]), [lambda s: EpsilonNode(s[1])])), - (3, G["|"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["ε"]), [lambda s: EpsilonNode(s[1])])), - (3, G["?"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["ε"]), [lambda s: EpsilonNode(s[1])])), - (3, G["symbol"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["ε"]), [lambda s: EpsilonNode(s[1])])), - (3, G["ε"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["ε"]), [lambda s: EpsilonNode(s[1])])), - (3, G["("]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["ε"]), [lambda s: EpsilonNode(s[1])])), - (3, G["["]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["ε"]), [lambda s: EpsilonNode(s[1])])), - (3, G["*"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["ε"]), [lambda s: EpsilonNode(s[1])])), - (4, G["symbol"]): ("SHIFT", 5), - (5, G["symbol"]): ("SHIFT", 5), - (5, G["-"]): ("SHIFT", 6), - (5, G["]"]): ("REDUCE", AttributeProduction(G["L"], Sentence(G["symbol"]), [lambda s: SymbolNode(s[1])])), - (6, G["symbol"]): ("SHIFT", 7), - (7, G["symbol"]): ("SHIFT", 5), - (7, G["]"]): ("REDUCE", AttributeProduction(G["L"], Sentence(G["symbol"], G["-"], G["symbol"]), - [lambda s: RangeNode(SymbolNode(s[1]), SymbolNode(s[3]))])), - (8, G["]"]): ("REDUCE", AttributeProduction(G["L"], Sentence(G["symbol"], G["-"], G["symbol"], G["L"]), [ - lambda s: UnionNode(RangeNode(SymbolNode(s[1]), SymbolNode(s[3])), s[4])])), - (9, G["]"]): ("REDUCE", AttributeProduction(G["L"], Sentence(G["symbol"], G["L"]), - [lambda s: UnionNode(SymbolNode(s[1]), s[2])])), - (10, G["]"]): ("SHIFT", 11), - (11, G["$"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["["], G["L"], G["]"]), [lambda s: s[2]])), - (11, G["+"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["["], G["L"], G["]"]), [lambda s: s[2]])), - (11, G[")"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["["], G["L"], G["]"]), [lambda s: s[2]])), - (11, G["|"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["["], G["L"], G["]"]), [lambda s: s[2]])), - (11, G["?"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["["], G["L"], G["]"]), [lambda s: s[2]])), - (11, G["symbol"]): ( - "REDUCE", AttributeProduction(G["A"], Sentence(G["["], G["L"], G["]"]), [lambda s: s[2]])), - (11, G["ε"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["["], G["L"], G["]"]), [lambda s: s[2]])), - (11, G["("]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["["], G["L"], G["]"]), [lambda s: s[2]])), - (11, G["["]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["["], G["L"], G["]"]), [lambda s: s[2]])), - (11, G["*"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["["], G["L"], G["]"]), [lambda s: s[2]])), - (12, G["|"]): ("SHIFT", 13), - (12, G[")"]): ("SHIFT", 21), - (13, G["symbol"]): ("SHIFT", 2), - (13, G["("]): ("SHIFT", 1), - (13, G["["]): ("SHIFT", 4), - (13, G["ε"]): ("SHIFT", 3), - (14, G["$"]): ( - "REDUCE", - AttributeProduction(G["E"], Sentence(G["E"], G["|"], G["T"]), [lambda s: UnionNode(s[1], s[3])])), - (14, G[")"]): ( - "REDUCE", - AttributeProduction(G["E"], Sentence(G["E"], G["|"], G["T"]), [lambda s: UnionNode(s[1], s[3])])), - (14, G["|"]): ( - "REDUCE", - AttributeProduction(G["E"], Sentence(G["E"], G["|"], G["T"]), [lambda s: UnionNode(s[1], s[3])])), - (14, G["symbol"]): ("SHIFT", 2), - (14, G["("]): ("SHIFT", 1), - (14, G["["]): ("SHIFT", 4), - (14, G["ε"]): ("SHIFT", 3), - (15, G["$"]): ( - "REDUCE", AttributeProduction(G["T"], Sentence(G["T"], G["F"]), [lambda s: ConcatNode(s[1], s[2])])), - (15, G["|"]): ( - "REDUCE", AttributeProduction(G["T"], Sentence(G["T"], G["F"]), [lambda s: ConcatNode(s[1], s[2])])), - (15, G[")"]): ( - "REDUCE", AttributeProduction(G["T"], Sentence(G["T"], G["F"]), [lambda s: ConcatNode(s[1], s[2])])), - (15, G["symbol"]): ( - "REDUCE", AttributeProduction(G["T"], Sentence(G["T"], G["F"]), [lambda s: ConcatNode(s[1], s[2])])), - (15, G["["]): ( - "REDUCE", AttributeProduction(G["T"], Sentence(G["T"], G["F"]), [lambda s: ConcatNode(s[1], s[2])])), - (15, G["("]): ( - "REDUCE", AttributeProduction(G["T"], Sentence(G["T"], G["F"]), [lambda s: ConcatNode(s[1], s[2])])), - (15, G["ε"]): ( - "REDUCE", AttributeProduction(G["T"], Sentence(G["T"], G["F"]), [lambda s: ConcatNode(s[1], s[2])])), - (16, G["+"]): ("SHIFT", 18), - (16, G["$"]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"]), [lambda s: s[1]])), - (16, G["|"]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"]), [lambda s: s[1]])), - (16, G[")"]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"]), [lambda s: s[1]])), - (16, G["symbol"]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"]), [lambda s: s[1]])), - (16, G["["]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"]), [lambda s: s[1]])), - (16, G["("]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"]), [lambda s: s[1]])), - (16, G["ε"]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"]), [lambda s: s[1]])), - (16, G["?"]): ("SHIFT", 19), - (16, G["*"]): ("SHIFT", 17), - (17, G["$"]): ( - "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["*"]), [lambda s: ClosureNode(s[1])])), - (17, G["|"]): ( - "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["*"]), [lambda s: ClosureNode(s[1])])), - (17, G[")"]): ( - "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["*"]), [lambda s: ClosureNode(s[1])])), - (17, G["symbol"]): ( - "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["*"]), [lambda s: ClosureNode(s[1])])), - (17, G["["]): ( - "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["*"]), [lambda s: ClosureNode(s[1])])), - (17, G["("]): ( - "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["*"]), [lambda s: ClosureNode(s[1])])), - (17, G["ε"]): ( - "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["*"]), [lambda s: ClosureNode(s[1])])), - (18, G["$"]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["+"]), [lambda s: PlusNode(s[1])])), - (18, G["|"]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["+"]), [lambda s: PlusNode(s[1])])), - (18, G[")"]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["+"]), [lambda s: PlusNode(s[1])])), - (18, G["symbol"]): ( - "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["+"]), [lambda s: PlusNode(s[1])])), - (18, G["["]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["+"]), [lambda s: PlusNode(s[1])])), - (18, G["("]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["+"]), [lambda s: PlusNode(s[1])])), - (18, G["ε"]): ("REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["+"]), [lambda s: PlusNode(s[1])])), - (19, G["$"]): ( - "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["?"]), [lambda s: QuestionNode(s[1])])), - (19, G["|"]): ( - "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["?"]), [lambda s: QuestionNode(s[1])])), - (19, G[")"]): ( - "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["?"]), [lambda s: QuestionNode(s[1])])), - (19, G["symbol"]): ( - "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["?"]), [lambda s: QuestionNode(s[1])])), - (19, G["["]): ( - "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["?"]), [lambda s: QuestionNode(s[1])])), - (19, G["("]): ( - "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["?"]), [lambda s: QuestionNode(s[1])])), - (19, G["ε"]): ( - "REDUCE", AttributeProduction(G["F"], Sentence(G["A"], G["?"]), [lambda s: QuestionNode(s[1])])), - (20, G["$"]): ("REDUCE", AttributeProduction(G["T"], Sentence(G["F"]), [lambda s: s[1]])), - (20, G["|"]): ("REDUCE", AttributeProduction(G["T"], Sentence(G["F"]), [lambda s: s[1]])), - (20, G[")"]): ("REDUCE", AttributeProduction(G["T"], Sentence(G["F"]), [lambda s: s[1]])), - (20, G["symbol"]): ("REDUCE", AttributeProduction(G["T"], Sentence(G["F"]), [lambda s: s[1]])), - (20, G["["]): ("REDUCE", AttributeProduction(G["T"], Sentence(G["F"]), [lambda s: s[1]])), - (20, G["("]): ("REDUCE", AttributeProduction(G["T"], Sentence(G["F"]), [lambda s: s[1]])), - (20, G["ε"]): ("REDUCE", AttributeProduction(G["T"], Sentence(G["F"]), [lambda s: s[1]])), - (21, G["$"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["("], G["E"], G[")"]), [lambda s: s[2]])), - (21, G["+"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["("], G["E"], G[")"]), [lambda s: s[2]])), - (21, G[")"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["("], G["E"], G[")"]), [lambda s: s[2]])), - (21, G["|"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["("], G["E"], G[")"]), [lambda s: s[2]])), - (21, G["?"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["("], G["E"], G[")"]), [lambda s: s[2]])), - (21, G["symbol"]): ( - "REDUCE", AttributeProduction(G["A"], Sentence(G["("], G["E"], G[")"]), [lambda s: s[2]])), - (21, G["ε"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["("], G["E"], G[")"]), [lambda s: s[2]])), - (21, G["("]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["("], G["E"], G[")"]), [lambda s: s[2]])), - (21, G["["]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["("], G["E"], G[")"]), [lambda s: s[2]])), - (21, G["*"]): ("REDUCE", AttributeProduction(G["A"], Sentence(G["("], G["E"], G[")"]), [lambda s: s[2]])), - (22, G["symbol"]): ("SHIFT", 2), - (22, G["("]): ("SHIFT", 1), - (22, G["["]): ("SHIFT", 4), - (22, G["$"]): ("REDUCE", AttributeProduction(G["E"], Sentence(G["T"]), [lambda s: s[1]])), - (22, G[")"]): ("REDUCE", AttributeProduction(G["E"], Sentence(G["T"]), [lambda s: s[1]])), - (22, G["|"]): ("REDUCE", AttributeProduction(G["E"], Sentence(G["T"]), [lambda s: s[1]])), - (22, G["ε"]): ("SHIFT", 3), - (23, G["|"]): ("SHIFT", 13), - (23, G["$"]): ("OK", None), - } - - def __goto_table(self): - G = self.G - return { - (0, G["E"]): 23, - (0, G["T"]): 22, - (0, G["A"]): 16, - (0, G["F"]): 20, - (1, G["A"]): 16, - (1, G["T"]): 22, - (1, G["E"]): 12, - (1, G["F"]): 20, - (4, G["L"]): 10, - (5, G["L"]): 9, - (7, G["L"]): 8, - (13, G["T"]): 14, - (13, G["A"]): 16, - (13, G["F"]): 20, - (14, G["A"]): 16, - (14, G["F"]): 15, - (22, G["A"]): 16, - (22, G["F"]): 15, - } - - -def regex_tokenizer(text, G, skip_whitespaces=True): - tokens = [] - fixed_tokens = {lex: Token(lex, G[lex]) for lex in '| * ( ) ε [ ] ? + -'.split()} - open_pos = 0 - inside_squares = False - set_literal = False - for i, char in enumerate(text): - if skip_whitespaces and char.isspace(): - continue - - if not set_literal and char == '\\': - set_literal = True - continue - - if set_literal: - tokens.append(Token(char, G['symbol'])) - set_literal = False - continue - - ################ - # Squares flow # - ################ - if not inside_squares: - if char in (']', '-') or char not in fixed_tokens: - tokens.append(Token(char, G['symbol'])) - else: - tokens.append(fixed_tokens[char]) - - open_pos = i - inside_squares = char == '[' - - else: - if char == ']': - if i - open_pos == 1: - tokens.append(Token(char, G['symbol'])) - else: - inside_squares = False - tokens.append(fixed_tokens[char]) - elif char == '-': - if is_minus_a_symbol(G, text, tokens, i, open_pos): - tokens.append(Token(char, G['symbol'])) - else: - tokens.append(fixed_tokens[char]) - else: - tokens.append(Token(char, G['symbol'])) - - if inside_squares: - raise Exception(f'Unterminated character set at position {open_pos}') - - tokens.append(Token('$', G.EOF)) - return tokens - - -def is_minus_a_symbol(G, text, tokens, i, open_pos): - return (i + 1 < len(text) and text[i + 1] == ']') or (text[i - 1] == '[') or \ - (i - 2 > open_pos and tokens[-2].token_type == G['-']) or \ - (i - 1 > open_pos and text[i - 1] == '-') or (i + 1 < len(text) and text[i + 1] == '-') diff --git a/cmp/serializer/__init__.py b/cmp/serializer/__init__.py deleted file mode 100644 index 7b15f27d2..000000000 --- a/cmp/serializer/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from .lexer_serializer import LexerSerializer -from .parser_serializer import LRParserSerializer diff --git a/cmp/serializer/lexer_serializer.py b/cmp/serializer/lexer_serializer.py deleted file mode 100644 index fdf4dbcdf..000000000 --- a/cmp/serializer/lexer_serializer.py +++ /dev/null @@ -1,89 +0,0 @@ -LEXER_CONTENT = """from cmp.automata import State -from cmp.parsing import Lexer -from cmp.regex import NFA - - -class %s(Lexer): - def __init__(self, G): - self.G = G - self.eof = G.EOF - self.regexs = self._build_regexs(self.__table()) - self.automaton = self._build_automaton() - - def __table(self): - G = self.G - return %s - - def _build_regexs(self, table): - regexs = [] - for n, (token_type, nfa) in enumerate(self.__table()): - automaton, states = State.from_nfa(nfa, get_states=True) - - for state in states: - if state.final: - state.tag = (n, token_type) - - regexs.append(automaton) - - return regexs -""" - - -class LexerSerializer: - @staticmethod - def build(**kwargs): - lexer = kwargs['lexer'] - class_name = kwargs['class'] - file_name = kwargs['file'] - LexerSerializer.__meta(lexer, class_name, file_name) - - @staticmethod - def __meta(table, class_name, file_name): - table = LexerSerializer.__build_lexer_table(table) - content = LEXER_CONTENT % (class_name, table) - try: - with open(file_name, 'x') as f: - f.write(content) - except FileExistsError: - with open(file_name, 'w') as f: - f.write(content) - - @staticmethod - def __build_lexer_table(lexer): - lexer = lexer - formatting = '[\n' - for regex in lexer.regexs: - finals = [] - - count = 0 - tag = None - table = '{' - for s in regex: - symbols = s.transitions - for symbol in symbols: - key_symbol = symbol - - if symbol == "\"": - key_symbol = "\\\"" - - elif symbol == "\\": - key_symbol = "\\\\" - - elif symbol == "\n": - key_symbol = "\\n" - - elif symbol == "\t": - key_symbol = "\\t" - - table += f'({s.state}, "{key_symbol}"): {[d.state for d in s.transitions[symbol]]}, ' - - if s.final: - tag = s.tag[1] - finals.append(s.state) - - count += 1 - table += '}' - formatting += f' (G["{tag.Name}"], NFA({count}, {finals}, {table}, start={regex.state})),\n' - formatting += ' ]' - - return formatting diff --git a/cmp/utils.py b/cmp/utils.py index 23691eef9..db2c149ed 100755 --- a/cmp/utils.py +++ b/cmp/utils.py @@ -1,135 +1,26 @@ -from cmp.pycompiler import Production, Sentence, Symbol, EOF, Epsilon - - -class ContainerSet: - def __init__(self, *values, contains_epsilon=False): - self.set = set(values) - self.contains_epsilon = contains_epsilon - - def add(self, value): - n = len(self.set) - self.set.add(value) - return n != len(self.set) - - def extend(self, values): - change = False - for value in values: - change |= self.add(value) - return change - - def set_epsilon(self, value=True): - last = self.contains_epsilon - self.contains_epsilon = value - return last != self.contains_epsilon - - def update(self, other): - """ - Update ContainerSet\n - :rtype: bool\n - :param other: ContainerSet\n - :return: True if size was increased else return false\n - """ - n = len(self.set) - self.set.update(other.set) - return n != len(self.set) - - def epsilon_update(self, other): - return self.set_epsilon(self.contains_epsilon | other.contains_epsilon) - - def hard_update(self, other): - return self.update(other) | self.epsilon_update(other) - - def find_match(self, match): - for item in self.set: - if item == match: - return item - return None - - def __len__(self): - return len(self.set) + int(self.contains_epsilon) - - def __str__(self): - return '%s-%s' % (str(self.set), self.contains_epsilon) - - def __repr__(self): - return str(self) - - def __iter__(self): - return iter(self.set) - - def __nonzero__(self): - return len(self) > 0 - - def __eq__(self, other): - if isinstance(other, set): - return self.set == other - return isinstance(other, - ContainerSet) and self.set == other.set and self.contains_epsilon == other.contains_epsilon - - -def inspect(item, grammar_name='G', mapper=None): - try: - return mapper[item] - except (TypeError, KeyError): - if isinstance(item, dict): - items = ',\n '.join( - f'{inspect(key, grammar_name, mapper)}: {inspect(value, grammar_name, mapper)}' for key, value in - item.items()) - return f'{{\n {items} \n}}' - elif isinstance(item, ContainerSet): - args = f'{", ".join(inspect(x, grammar_name, mapper) for x in item.set)} ,' if item.set else '' - return f'ContainerSet({args} contains_epsilon={item.contains_epsilon})' - elif isinstance(item, EOF): - return f'{grammar_name}.EOF' - elif isinstance(item, Epsilon): - return f'{grammar_name}.Epsilon' - elif isinstance(item, Symbol): - return f"G['{item.Name}']" - elif isinstance(item, Sentence): - items = ', '.join(inspect(s, grammar_name, mapper) for s in item._symbols) - return f'Sentence({items})' - elif isinstance(item, Production): - left = inspect(item.Left, grammar_name, mapper) - right = inspect(item.Right, grammar_name, mapper) - return f'Production({left}, {right})' - elif isinstance(item, tuple) or isinstance(item, list): - ctor = ('(', ')') if isinstance(item, tuple) else ('[', ']') - return f'{ctor[0]} {("%s, " * len(item)) % tuple(inspect(x, grammar_name, mapper) for x in item)}{ctor[1]}' - else: - raise ValueError(f'Invalid: {item}') - - -def pprint(item, header=""): - if header: - print(header) - - if isinstance(item, dict): - for key, value in item.items(): - print(f'{key} ---> {value}') - elif isinstance(item, list): - print('[') - for x in item: - print(f' {repr(x)}') - print(']') - else: - print(item) - - class Token: """ - Basic token class. + A Token class. Parameters ---------- - lex : str + lex: str Token's lexeme. - token_type : Enum + token_type: Enum Token's type. """ - def __init__(self, lex, token_type): + def __init__(self, lex, token_type, row=0, col=0): + """ + :param lex: str + :param token_type: Enum + :param row: int + :param col: int + """ self.lex = lex self.token_type = token_type + self.row = row + self.col = col def __str__(self): return f'{self.token_type}: {self.lex}' @@ -154,33 +45,6 @@ def is_valid(self): return False -def tokenizer(G, fixed_tokens): - def decorate(func): - def tokenize_text(text): - tokens = [] - for lex in text.split(): - try: - token = fixed_tokens[lex] - except KeyError: - token = UnknownToken(lex) - try: - token = func(token) - except TypeError: - pass - tokens.append(token) - tokens.append(Token('$', G.EOF)) - return tokens - - if hasattr(func, '__call__'): - return tokenize_text - elif isinstance(func, str): - return tokenize_text(func) - else: - raise TypeError('Argument must be "str" or a callable object.') - - return decorate - - class DisjointSet: def __init__(self, *items): self.nodes = {x: DisjointNode(x) for x in items} diff --git a/definitions.py b/definitions.py index 1a2c5dcc4..0c579321c 100644 --- a/definitions.py +++ b/definitions.py @@ -185,57 +185,6 @@ def cool_parser(): return LALR1Parser(G) -def cool_lexer(): - return Lexer([ - (G['+'], '\+'), - (G['-'], '-'), - (G['*'], '\*'), - (G['/'], '/'), - (G['<='], '<='), - (G['<'], '<'), - (G['='], '='), - (G['~'], '~'), - (G['not'], 'not'), - (G['{'], '{'), - (G['}'], '}'), - (G['('], '\('), - (G[')'], '\)'), - (G[','], ','), - (G['.'], '.'), - (G['@'], '@'), - (G[':'], ':'), - (G[';'], ';'), - (G['<-'], '<-'), - (G['=>'], '=>'), - (G['class'], 'class'), - (G['inherits'], 'inherits'), - (G['if'], 'if'), - (G['then'], 'then'), - (G['else'], 'else'), - (G['fi'], 'fi'), - (G['while'], 'while'), - (G['loop'], 'loop'), - (G['pool'], 'pool'), - (G['let'], 'let'), - (G['in'], 'in'), - (G['case'], 'case'), - (G['esac'], 'esac'), - (G['of'], 'of'), - (G['new'], 'new'), - (G['isvoid'], 'isvoid'), - (G['true'], 'true'), - (G['false'], 'false'), - (G['end'], 'end'), - (G['space'], ' +'), - (G['newline'], '\n+'), - (G['tab'], '\t+'), - (G['integer'], '-?[1-9][0-9]*'), - (G['type'], '[A-Z][a-zA-Z0-9]*'), - (G['id'], '[a-z][a-zA-Z0-9]*'), - (G['string'], '"[ -~]*"'), - ], G.EOF) - - if __name__ == '__main__': t = time.time() parser = cool_parser() diff --git a/lexer.py b/lexer.py index 8f540613b..34752da8a 100644 --- a/lexer.py +++ b/lexer.py @@ -1,75 +1,70 @@ -from cmp.automata import State from cmp.parsing import Lexer -from cmp.regex import NFA class CoolLexer(Lexer): + """ + Specialized lexer for COOL programing language. + + This derived from cmp.parsing.lexer.Lexer + """ def __init__(self, G): + """ + Receive a Grammar to take it terminals as token types + + :param G: cmp.pycompiler.Grammar + """ self.G = G - self.eof = G.EOF - self.regexs = self._build_regexs(self.__table()) - self.automaton = self._build_automaton() + super().__init__(self.__table, G.EOF, self.__skip_characters) + @property + def __skip_characters(self): + return {' ', '\n', '\t'} + + @property def __table(self): G = self.G - return [ - (G["+"], NFA(2, [0], {(1, "+"): [0], }, start=1)), - (G["-"], NFA(2, [0], {(1, "-"): [0], }, start=1)), - (G["*"], NFA(2, [0], {(1, "*"): [0], }, start=1)), - (G["/"], NFA(2, [1], {(0, "/"): [1], }, start=0)), - (G["<="], NFA(3, [1], {(0, "<"): [2], (2, "="): [1], }, start=0)), - (G["<"], NFA(2, [1], {(0, "<"): [1], }, start=0)), - (G["="], NFA(2, [1], {(0, "="): [1], }, start=0)), - (G["~"], NFA(2, [1], {(0, "~"): [1], }, start=0)), - (G["not"], NFA(4, [1], {(2, "n"): [3], (3, "o"): [0], (0, "t"): [1], }, start=2)), - (G["{"], NFA(2, [1], {(0, "{"): [1], }, start=0)), - (G["}"], NFA(2, [0], {(1, "}"): [0], }, start=1)), - (G["("], NFA(2, [0], {(1, "("): [0], }, start=1)), - (G[")"], NFA(2, [1], {(0, ")"): [1], }, start=0)), - (G[","], NFA(2, [1], {(0, ","): [1], }, start=0)), - (G["."], NFA(2, [0], {(1, "."): [0], }, start=1)), - (G["@"], NFA(2, [1], {(0, "@"): [1], }, start=0)), - (G[":"], NFA(2, [0], {(1, ":"): [0], }, start=1)), - (G[";"], NFA(2, [1], {(0, ";"): [1], }, start=0)), - (G["<-"], NFA(3, [1], {(0, "<"): [2], (2, "-"): [1], }, start=0)), - (G["=>"], NFA(3, [2], {(0, "="): [1], (1, ">"): [2], }, start=0)), - (G["class"], NFA(6, [5], {(0, "c"): [1], (1, "l"): [2], (2, "a"): [3], (3, "s"): [4], (4, "s"): [5], }, start=0)), - (G["inherits"], NFA(9, [6], {(3, "i"): [7], (7, "n"): [8], (8, "h"): [1], (1, "e"): [2], (2, "r"): [4], (4, "i"): [0], (0, "t"): [5], (5, "s"): [6], }, start=3)), - (G["if"], NFA(3, [0], {(2, "i"): [1], (1, "f"): [0], }, start=2)), - (G["then"], NFA(5, [1], {(0, "t"): [3], (3, "h"): [2], (2, "e"): [4], (4, "n"): [1], }, start=0)), - (G["else"], NFA(5, [0], {(2, "e"): [3], (3, "l"): [1], (1, "s"): [4], (4, "e"): [0], }, start=2)), - (G["fi"], NFA(3, [2], {(1, "f"): [0], (0, "i"): [2], }, start=1)), - (G["while"], NFA(6, [0], {(1, "w"): [2], (2, "h"): [3], (3, "i"): [4], (4, "l"): [5], (5, "e"): [0], }, start=1)), - (G["loop"], NFA(5, [2], {(0, "l"): [3], (3, "o"): [4], (4, "o"): [1], (1, "p"): [2], }, start=0)), - (G["pool"], NFA(5, [2], {(3, "p"): [4], (4, "o"): [0], (0, "o"): [1], (1, "l"): [2], }, start=3)), - (G["let"], NFA(4, [2], {(1, "l"): [3], (3, "e"): [0], (0, "t"): [2], }, start=1)), - (G["in"], NFA(3, [2], {(1, "i"): [0], (0, "n"): [2], }, start=1)), - (G["case"], NFA(5, [4], {(0, "c"): [1], (1, "a"): [2], (2, "s"): [3], (3, "e"): [4], }, start=0)), - (G["esac"], NFA(5, [0], {(1, "e"): [3], (3, "s"): [4], (4, "a"): [2], (2, "c"): [0], }, start=1)), - (G["of"], NFA(3, [1], {(2, "o"): [0], (0, "f"): [1], }, start=2)), - (G["new"], NFA(4, [3], {(0, "n"): [1], (1, "e"): [2], (2, "w"): [3], }, start=0)), - (G["isvoid"], NFA(7, [2], {(4, "i"): [1], (1, "s"): [6], (6, "v"): [5], (5, "o"): [3], (3, "i"): [0], (0, "d"): [2], }, start=4)), - (G["true"], NFA(5, [4], {(0, "t"): [1], (1, "r"): [2], (2, "u"): [3], (3, "e"): [4], }, start=0)), - (G["false"], NFA(6, [5], {(1, "f"): [3], (3, "a"): [0], (0, "l"): [2], (2, "s"): [4], (4, "e"): [5], }, start=1)), - (G["end"], NFA(4, [2], {(1, "e"): [3], (3, "n"): [0], (0, "d"): [2], }, start=1)), - (G["space"], NFA(2, [1], {(0, " "): [1], (1, " "): [1], }, start=0)), - (G["newline"], NFA(2, [1], {(0, "\n"): [1], (1, "\n"): [1], }, start=0)), - (G["tab"], NFA(2, [1], {(0, "\t"): [1], (1, "\t"): [1], }, start=0)), - (G["integer"], NFA(3, [1], {(2, "2"): [1], (2, "6"): [1], (2, "8"): [1], (2, "9"): [1], (2, "4"): [1], (2, "-"): [0], (2, "3"): [1], (2, "1"): [1], (2, "7"): [1], (2, "5"): [1], (1, "2"): [1], (1, "6"): [1], (1, "8"): [1], (1, "9"): [1], (1, "4"): [1], (1, "0"): [1], (1, "3"): [1], (1, "1"): [1], (1, "7"): [1], (1, "5"): [1], (0, "2"): [1], (0, "6"): [1], (0, "8"): [1], (0, "9"): [1], (0, "4"): [1], (0, "3"): [1], (0, "1"): [1], (0, "7"): [1], (0, "5"): [1], }, start=2)), - (G["type"], NFA(2, [0], {(1, "C"): [0], (1, "L"): [0], (1, "T"): [0], (1, "O"): [0], (1, "V"): [0], (1, "Q"): [0], (1, "I"): [0], (1, "Z"): [0], (1, "H"): [0], (1, "P"): [0], (1, "G"): [0], (1, "A"): [0], (1, "W"): [0], (1, "X"): [0], (1, "M"): [0], (1, "B"): [0], (1, "S"): [0], (1, "E"): [0], (1, "U"): [0], (1, "N"): [0], (1, "R"): [0], (1, "Y"): [0], (1, "K"): [0], (1, "F"): [0], (1, "D"): [0], (1, "J"): [0], (0, "C"): [0], (0, "L"): [0], (0, "T"): [0], (0, "O"): [0], (0, "V"): [0], (0, "d"): [0], (0, "Q"): [0], (0, "y"): [0], (0, "h"): [0], (0, "I"): [0], (0, "t"): [0], (0, "Z"): [0], (0, "a"): [0], (0, "w"): [0], (0, "H"): [0], (0, "z"): [0], (0, "i"): [0], (0, "c"): [0], (0, "8"): [0], (0, "P"): [0], (0, "G"): [0], (0, "q"): [0], (0, "A"): [0], (0, "W"): [0], (0, "n"): [0], (0, "1"): [0], (0, "X"): [0], (0, "2"): [0], (0, "u"): [0], (0, "M"): [0], (0, "B"): [0], (0, "f"): [0], (0, "k"): [0], (0, "4"): [0], (0, "m"): [0], (0, "S"): [0], (0, "E"): [0], (0, "U"): [0], (0, "p"): [0], (0, "N"): [0], (0, "9"): [0], (0, "l"): [0], (0, "R"): [0], (0, "r"): [0], (0, "6"): [0], (0, "e"): [0], (0, "j"): [0], (0, "g"): [0], (0, "o"): [0], (0, "Y"): [0], (0, "b"): [0], (0, "v"): [0], (0, "x"): [0], (0, "K"): [0], (0, "0"): [0], (0, "s"): [0], (0, "3"): [0], (0, "F"): [0], (0, "D"): [0], (0, "J"): [0], (0, "7"): [0], (0, "5"): [0], }, start=1)), - (G["id"], NFA(2, [0], {(1, "d"): [0], (1, "y"): [0], (1, "h"): [0], (1, "t"): [0], (1, "a"): [0], (1, "w"): [0], (1, "z"): [0], (1, "i"): [0], (1, "c"): [0], (1, "q"): [0], (1, "n"): [0], (1, "u"): [0], (1, "f"): [0], (1, "k"): [0], (1, "m"): [0], (1, "p"): [0], (1, "l"): [0], (1, "r"): [0], (1, "e"): [0], (1, "j"): [0], (1, "g"): [0], (1, "o"): [0], (1, "b"): [0], (1, "v"): [0], (1, "x"): [0], (1, "s"): [0], (0, "C"): [0], (0, "L"): [0], (0, "T"): [0], (0, "O"): [0], (0, "V"): [0], (0, "d"): [0], (0, "Q"): [0], (0, "y"): [0], (0, "h"): [0], (0, "t"): [0], (0, "I"): [0], (0, "Z"): [0], (0, "a"): [0], (0, "w"): [0], (0, "H"): [0], (0, "z"): [0], (0, "i"): [0], (0, "c"): [0], (0, "8"): [0], (0, "P"): [0], (0, "G"): [0], (0, "q"): [0], (0, "A"): [0], (0, "W"): [0], (0, "n"): [0], (0, "1"): [0], (0, "X"): [0], (0, "2"): [0], (0, "u"): [0], (0, "M"): [0], (0, "B"): [0], (0, "f"): [0], (0, "k"): [0], (0, "4"): [0], (0, "m"): [0], (0, "S"): [0], (0, "E"): [0], (0, "p"): [0], (0, "U"): [0], (0, "N"): [0], (0, "9"): [0], (0, "l"): [0], (0, "R"): [0], (0, "r"): [0], (0, "6"): [0], (0, "e"): [0], (0, "j"): [0], (0, "g"): [0], (0, "o"): [0], (0, "Y"): [0], (0, "b"): [0], (0, "v"): [0], (0, "x"): [0], (0, "K"): [0], (0, "0"): [0], (0, "s"): [0], (0, "3"): [0], (0, "F"): [0], (0, "D"): [0], (0, "J"): [0], (0, "7"): [0], (0, "5"): [0], }, start=1)), - (G["string"], NFA(3, [2], {(0, "\""): [1], (1, "C"): [1], (1, "%"): [1], (1, "T"): [1], (1, "V"): [1], (1, "Z"): [1], (1, "H"): [1], (1, "?"): [1], (1, "P"): [1], (1, "G"): [1], (1, "q"): [1], (1, "&"): [1], (1, "("): [1], (1, "2"): [1], (1, "M"): [1], (1, "B"): [1], (1, "f"): [1], (1, "k"): [1], (1, "m"): [1], (1, "}"): [1], (1, "E"): [1], (1, "9"): [1], (1, ">"): [1], (1, "j"): [1], (1, "s"): [1], (1, "`"): [1], (1, "'"): [1], (1, "5"): [1], (1, "O"): [1], (1, "d"): [1], (1, "."): [1], (1, "h"): [1], (1, "I"): [1], (1, "a"): [1], (1, ":"): [1], (1, "{"): [1], (1, "i"): [1], (1, "<"): [1], (1, "/"): [1], (1, "W"): [1], (1, "u"): [1], (1, ","): [1], (1, ";"): [1], (1, "]"): [1], (1, "l"): [1], (1, "R"): [1], (1, "6"): [1], (1, "o"): [1], (1, "\\"): [1], (1, ")"): [1], (1, "x"): [1], (1, "@"): [1], (1, "D"): [1], (1, "7"): [1], (1, "|"): [1], (1, "Q"): [1], (1, "#"): [1], (1, "z"): [1], (1, "8"): [1], (1, "A"): [1], (1, "n"): [1], (1, "X"): [1], (1, "S"): [1], (1, "\""): [2], (1, "="): [1], (1, "+"): [1], (1, "g"): [1], (1, "Y"): [1], (1, "b"): [1], (1, "v"): [1], (1, "_"): [1], (1, "3"): [1], (1, "L"): [1], (1, "y"): [1], (1, "t"): [1], (1, "w"): [1], (1, "c"): [1], (1, "*"): [1], (1, " "): [1], (1, "$"): [1], (1, "1"): [1], (1, "!"): [1], (1, "4"): [1], (1, "^"): [1], (1, "U"): [1], (1, "p"): [1], (1, "N"): [1], (1, "r"): [1], (1, "e"): [1], (1, "["): [1], (1, "~"): [1], (1, "-"): [1], (1, "0"): [1], (1, "K"): [1], (1, "F"): [1], (1, "J"): [1], (2, "C"): [1], (2, "%"): [1], (2, "T"): [1], (2, "V"): [1], (2, "Z"): [1], (2, "H"): [1], (2, "?"): [1], (2, "P"): [1], (2, "G"): [1], (2, "q"): [1], (2, "&"): [1], (2, "("): [1], (2, "2"): [1], (2, "M"): [1], (2, "B"): [1], (2, "f"): [1], (2, "k"): [1], (2, "m"): [1], (2, "}"): [1], (2, "E"): [1], (2, "9"): [1], (2, ">"): [1], (2, "j"): [1], (2, "s"): [1], (2, "`"): [1], (2, "'"): [1], (2, "5"): [1], (2, "O"): [1], (2, "d"): [1], (2, "."): [1], (2, "h"): [1], (2, "I"): [1], (2, "a"): [1], (2, ":"): [1], (2, "{"): [1], (2, "i"): [1], (2, "<"): [1], (2, "/"): [1], (2, "W"): [1], (2, "u"): [1], (2, ","): [1], (2, ";"): [1], (2, "]"): [1], (2, "l"): [1], (2, "R"): [1], (2, "6"): [1], (2, "o"): [1], (2, "\\"): [1], (2, ")"): [1], (2, "x"): [1], (2, "@"): [1], (2, "D"): [1], (2, "7"): [1], (2, "|"): [1], (2, "Q"): [1], (2, "#"): [1], (2, "z"): [1], (2, "8"): [1], (2, "A"): [1], (2, "n"): [1], (2, "X"): [1], (2, "S"): [1], (2, "\""): [2], (2, "="): [1], (2, "+"): [1], (2, "g"): [1], (2, "Y"): [1], (2, "b"): [1], (2, "v"): [1], (2, "_"): [1], (2, "3"): [1], (2, "L"): [1], (2, "y"): [1], (2, "t"): [1], (2, "w"): [1], (2, "c"): [1], (2, "*"): [1], (2, " "): [1], (2, "$"): [1], (2, "1"): [1], (2, "!"): [1], (2, "4"): [1], (2, "^"): [1], (2, "U"): [1], (2, "p"): [1], (2, "N"): [1], (2, "r"): [1], (2, "e"): [1], (2, "["): [1], (2, "~"): [1], (2, "-"): [1], (2, "0"): [1], (2, "K"): [1], (2, "F"): [1], (2, "J"): [1], }, start=0)), - ] - - def _build_regexs(self, table): - regexs = [] - for n, (token_type, nfa) in enumerate(self.__table()): - automaton, states = State.from_nfa(nfa, get_states=True) - - for state in states: - if state.final: - state.tag = (n, token_type) - - regexs.append(automaton) - - return regexs + return { + 'int': (G['integer'], '-?[1-9][0-9]*'), + 'add': (G['+'], '\+'), + 'sub': (G['-'], '-'), + 'mul': (G['*'], '\*'), + 'div': (G['/'], '/'), + 'le': (G['<='], '<='), + 'assign': (G['<-'], '<-'), + 'lt': (G['<'], '<'), + 'eq': (G['='], '='), + 'comp': (G['~'], '~'), + 'not': (G['not'], 'not'), + 'ocur': (G['{'], '{'), + 'ccur': (G['}'], '}'), + 'opar': (G['('], '\('), + 'cpar': (G[')'], '\)'), + 'coma': (G[','], ','), + 'dot': (G['.'], '\.'), + 'arroba': (G['@'], '@'), + 'colon': (G[':'], ':'), + 'semicolon': (G[';'], ';'), + 'arrow': (G['=>'], '=>'), + 'class': (G['class'], 'class'), + 'inherits': (G['inherits'], 'inherits'), + 'if': (G['if'], 'if'), + 'then': (G['then'], 'then'), + 'else': (G['else'], 'else'), + 'fi': (G['fi'], 'fi'), + 'while': (G['while'], 'while'), + 'loop': (G['loop'], 'loop'), + 'pool': (G['pool'], 'pool'), + 'let': (G['let'], 'let'), + 'in': (G['in'], 'in'), + 'case': (G['case'], 'case'), + 'esac': (G['esac'], 'esac'), + 'of': (G['of'], 'of'), + 'new': (G['new'], 'new'), + 'isvoid': (G['isvoid'], 'isvoid'), + 'true': (G['true'], 'true'), + 'false': (G['false'], 'false'), + 'end': (G['end'], 'end'), + 'type': (G['type'], '[A-Z][a-zA-Z0-9]*'), + 'id': (G['id'], '[a-z][a-zA-Z0-9]*'), + 'string': (G['string'], '".*"'), + } diff --git a/semantic.py b/semantic.py index 223e4fb5f..0b7c507a3 100644 --- a/semantic.py +++ b/semantic.py @@ -1,5 +1,5 @@ import cmp.visitor as visitor -from ast import ProgramNode +from astnodes import ProgramNode class SemanticChecker: @@ -12,4 +12,4 @@ def visit(self, node, scope): @visitor.when(ProgramNode) def visit(self, node: ProgramNode, scope=None): - pass \ No newline at end of file + pass diff --git a/tests.py b/tests.py index 4c45a8bc7..38600485d 100644 --- a/tests.py +++ b/tests.py @@ -37,7 +37,7 @@ def parse(script): :return: """ tokens = Tester.tokenize(script, print_tokens=False) - _, ast = parser(tokens, get_ast=True) + ast = parser(tokens) print(ast) From b2c8ac4989cb5090658f8309f7808a9f070ee855 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Wed, 15 Apr 2020 18:12:41 -0400 Subject: [PATCH 007/143] merge with new_lexer branch --- cmp/parsing/parsing.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmp/parsing/parsing.py b/cmp/parsing/parsing.py index 2429a831d..3b9f26e8e 100755 --- a/cmp/parsing/parsing.py +++ b/cmp/parsing/parsing.py @@ -1,5 +1,4 @@ from enum import auto, Enum -from typing import Any, List from .automatas import build_lr0_automaton, build_lr1_automaton, build_larl1_automaton from .utils import compute_firsts, compute_follows @@ -163,7 +162,7 @@ def _build_parsing_table(self): self._register(self.goto, (idx, symbol), idj) def __call__(self, tokens): - stack: List[Any] = [0] + stack: list = [0] cursor = 0 while True: From 51b6139517a004f12e655dc75f35702783739db1 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Thu, 16 Apr 2020 10:26:11 -0400 Subject: [PATCH 008/143] preparing cmp module for erro detection --- cmp/__pycache__/automata.cpython-37.pyc | Bin 8009 -> 5391 bytes cmp/__pycache__/pycompiler.cpython-37.pyc | Bin 17384 -> 17507 bytes cmp/__pycache__/utils.cpython-37.pyc | Bin 9679 -> 6961 bytes cmp/automata.py | 84 +---------- cmp/parsing/__init__.py | 2 +- .../__pycache__/__init__.cpython-37.pyc | Bin 312 -> 271 bytes .../__pycache__/automatas.cpython-37.pyc | Bin 5663 -> 4249 bytes cmp/parsing/__pycache__/lexer.cpython-37.pyc | Bin 1616 -> 1773 bytes .../__pycache__/parsing.cpython-37.pyc | Bin 7860 -> 5031 bytes cmp/parsing/automatas.py | 61 +------- cmp/parsing/parsing.py | 104 +------------- cmp/pycompiler.py | 120 +++++++--------- cmp/semantic.py | 9 +- cmp/utils.py | 60 ++++++++ definitions.py | 130 +++++++++--------- main.py | 5 +- semantic.py | 3 +- tests.py | 7 +- 18 files changed, 203 insertions(+), 382 deletions(-) diff --git a/cmp/__pycache__/automata.cpython-37.pyc b/cmp/__pycache__/automata.cpython-37.pyc index 96615e5a56e10f0a3680f1966339670f09b0a926..d9c0bada3bd960ce2c4ca38a2db984d739753752 100644 GIT binary patch literal 5391 zcmbtYO>Z1Y8Lq1SnD%%)nK+JPJ5JV{-3^(LwWF|FB4oVDZZ;bUWCaX3JKE4prrP$z zGu`9rcJPdPK#DC9I3U4^!wT6)Bz^*S{zIRTkdXGqg-cF6Z}oJ0#&#AEJ?^)wx~i+* zkLUd;e>^c!WVrtIgFpQAuNB7rPMz#B(71;?yaOVccjbF{ z&dTfZ8+gvi8?uV$Ww|83DQ_L{+Pu68wcSpvwWuC>533@vLTV+}M$@mi8e|Z<=qYf2 zf;)T{B<3-5Su8+#lYxrJ*r%r{iCU6jUA|hi6{%K{$&>L&)%~y;LHS`~gfPnmuM;*~ zf$xrtMD@+8k(i;^+Bp9DPfP(V?Dd_ct)T5KZMVD^o?3dWg09zyf^g|^H`)sPrA836 zmKyEOQhhfH+V!Zu*y$#Y>o)ynNJR^F)K7d7%%bOe5&fRr&c+P7pbPdnOmMdq+2t1 z4-I0lFZQm-`~iD|`n!Lbfq z8LUFI!zqxMJuUSi{d4vc*lkB-p2M}%z$3-t?SzLXtnqqmdDHW~y^dO0pp|G@ll88p zqAITuZ2HZfx47I28ueDVvY1b=n#s9LV~ti2?kX>tXa_Gm_gU8swe!!M7(X5{>VCIs zra+m)mZUp`i!epa3FD0AY|zx)?~1&_%c6Jg1gm5SZa-jZ8XYrQaNc(S~jGa3<+;u=(Gpw@QNrRWEX|Q=Xnvo68esq620lO zae+uw-1MS!?@$qv@`zbLhjJ_7BYXw2$$riDZbjsu7l{ip@O#SZ`6l8DW6_-5(`z(rk5`1;KQ1&YppQFjM1)l0G!Bchw3Iq ztA(0@wbUZo3HLQH5<5`M&8DxTZc>sS{MN7Qx+-%z&9JUPoQ$21u!5GG2@@fhg76G* zFo#|_FN3nlBmP8YB@>5}AVY@G(Qj1AG?kE`l}xbPA|)?SggAsI*RGik-`k#(}KqqQ17Ap7nUhQ^4O66voMiaRs9bgr)icj<2)vsqU*AS_TVEGBHr3-m>2rC_tHgQ7XY5@ay zP(gc=2MYKuZmkx8;o_Nl=5dg=AqDEKNNmI*9bEbZ1hEfTY>RL%5--t{IQD7h`HDEy zRt4}WTdKPtN%?*ldWyXIRDGV8KrR##EWuU1QxMp1=>WH#k+?N>3G3n?7N>LKUkC`6*TDDbG}MXQleFv*zYZ#$6XY zP+)W2EzAuGEDQn2<^r4|1f5Sg9hx_C1|sEZj>#wkjw|{E%KV~EEZ})L<4&z$7Wl~- z96sM9){A;;_ax$oMFfhJ#ST6nsL?@QJZ3JRF#@pM>ZI2+2n^tblWwHWh8G=7mDf?O z`+|1U=E);*HgxtjgySr|rW*)#KCpz>o$XE zG{tq}q22Pcb~C}gc*g(0DOn1aH8Fna;-$k8s6<^@+aps(j^;}k42U8tF2M2Zy*-%lc(WoAr z!;*s5g(uaA7)eY&kSBp%gXQ%k5-%i2CBLJeiK5RI75Lu_os@Gl4AlFu%JH{ay+TO! z>ut|jcI&NlL=k=y^BMjFqsWFjm8YPj3Ruk&d56gRAW11i&~G-{ z9{z756_po?qLw0CsBaUYOss=*;&fEdK`iX175H~);3FdUiBM2b4~RS@@`#Amk`6w{ zL}wN9PcnIU9mL_21;?lq%4XRqUlII9xn!0mN~U8uj$=DU`qLHvDk?WS>UO9&Cqb1# fgjPy9*1T&eXosP|d>jFt1hth5lzvwMANcXYim8WSJW!IUaeP=U-Bcd!#Gj0@(%1BkEWXB zkn>`7Q|2%|SzyUPG_Ve^1_ER^#)3TNkX(`+atVR}IR!`p1iADzxj5I{e2DXXRnt8) z6s;u447$3etGep1|MC5gd3AQSB=C9sXZL>em*<7}H~z>z0Xi?^iatc6gpw`MmQ~qy zs!rRjx^1uOwF}jP6#W^DIxWBI-w~Y!PlUy-lD;7YzdsZm=RNVJP_FV0g!1;CYM=_r zKM>U^Ra61)CFR@}m8s9Mi>MS*_mxgR^=>sAaq8X<<1~1!-fGqFw!+kVry0eo4bICx zJ~}Vsik_81grX{ys5(k2N4eZ>%?;hq3kyoD%g|qQ&Wq4jh0i?YtKvbST2wbwNlhO} z&@`iFNfX9}Du3pvGivU@18qV*@|jfg>MVXuV{`$(9#xC@HKQKmE^F9Rox{`fY6)x3 zhGq4up@(OWW0hs~#6e+SR?pz+1@+{CKz|PXi|T8p|42BmE~&4Z{#o>&Qcs)yg1W4} z0eT))&!`ISi|SeR9PW>)=hZiHKc}v!72MCOtLj_0FR5$lS8#t^-BjOJ-@%EN)eGvo zc=Ck0uD*x+1@)r(KJHJdDRBFxv~WAF$Ke|d@XdU9cW}LiE28LQk$_svm8%t*x>2lg zle>Q^G*#w{YbzVwcDS2$2? zov0Z%yPXKZ@nar7exOp(Wq6uVavvFRRp$Ksaw;NrmBT}nLk<_CqOa8v*Toy0wMrPzM!j@Z6= zN9-yYTz6MrfW4l&&U3~dTS?)(pfyO<jW8Td7~bU>Bv)9B{J*F zy#>4X9A!kn1BZba#}4xiP!f?ZLOOCmmdViJp(ZC* zq&?3#V|gZX9@+~}gOfu*I@|8v3u|}# zwa7s1xfA1~5x3syS3IjIQ~>f0pd4APIU$^>oQ!KE(dvp1^P7`pXYb4jQgaSH-0^6d z0#s@Ww-Y?kGk8V=(X(bw>gzDx(Vbkdd`z%3g8dJ4tYBjqLwx)4q~H>{??TwHq=A>X zXyGZ)`n!Lg`1;=ypKv)S+CU~LZWbu+L9qMNB!HS645qNUpG-kbFlH2`geS$MWK_mU zyse`C+p)b1<4R-po=&`@z*;z9I7p_Ah4@*oGmr5pjt^#%LNaq+45pLfQ7M_iOn~}! z6<~cGaO}dS{Qrjv>Sw?!U12jRV*Mt(?UFv(1hXHc69V*xMO3o~TUg=kQC@eW!(Zr`HNK!7Fup-JV6f=Q;jOHeWZB znjIDH>Zj4K%vwVvhNi{LmKi4LxEc(9M|uUr)gr+jAZOOB7OlIoW{apD)?c0KgdbV^ z*WbY#CnTNDos=mJEusJfVw4LuUO^kkIk?$*S#kn-0k#g8i{F8>;Os4)t{i~4(mFx_ z&`l)y7FNtHmV9A6Mli5<`6je^_I>AlXW$JA1OHGY9xTSY&w!nP9V7^7_9f!L!VMGTBvSuAX2E99i$k%7 zq$K+VdpZH>)L;fX2GZB5!2oqkhm-!9lWVSFD*PGQmP!Rhrf@8)83}$-y3vBc7@hqP zzcZa3!up!-wricW`j|Q8(+w25dRW>m1P#PW|Jpu ziP9v25zTmv|B&ZNcgd+#0K;3dZG*hMNOU-YIF6;2 zSUb{aZMU=vxJU0gLOG&{W;H-7_>G)gGp021=}18T>VZAck&|Bx;>-0;8t^ zbd_1bqTIXia1wJ4kzG{F*KnDj28k4u@;FP44Ol}3n8BQ+;W<3}i0{#*Kp7rAbmOubIM9sV9BWm}f)mVBJUERREq%#mm@06l|U11cOsBPF+- zXeoAnf?o<%69a&slM_aJU|?jbeicnxekF=R&E)KXydw4Cn}GEv*pj+<_G7#oQU8UB z5cj4mofyf9F0?IwLc!)ZCH}Zh920i!MW6bTIaEN9in^-sa&4OrL#3dZ>?r37++zi zECL~9uGRkJw5{z>ZV3!G=qJq9KjGFWI_4!GX-YmaFZsw($%i@S?p4@{bL5(c=o0+O zGE-HA+%AekaHq#IJHj@-1u}@;3wQ(h&8c(N?&L@H4Pu+D-5S>tNYlT`#*}r2nIjEB zo9N;qdy@uNg}@D;eu=S&`Zr#`@g3H0&M~demB7rNkP4GSnq9PkCI%?j3h*b+$A}q@ z96UkwnN??0oKbWB#JI-T+ZP|Z_r-mA-?{Iud1^|P4uX%JL+21KSMtpQ-t?6h7x@Hl zPpg?vJi66GBI4|7)p_T)*MISIe*XHUic>8jBHL0;UG>|*J;YTEysA^ZR=wGY!`;{z zyG2mXR1MPtD%)WzEqv5e@kZ6(2%GC0aeg+6oZK?e(BGM}u_jCBeCQ&b{F_5o_e>$h zoYUQeI4QbAiBuGUtbResjtLno-Meq$X>c@URN+O0#t5IG9tG zB4NCE0v`bG*%eHZ`3_X%8djQl_HgAvATH^ z&+PnAt>e#x*U?%vEm%3ZO%+u=mUxY_rY=$_R8Qoa29QylWIa+FWzOA&{s61~1+Fp8 zEy>F$kRb_@PeE@3xwmBDYhBlS8>7g_ELZgv@F!Hm18at1l|VDruDZ9nvHk&i`aL#O z0{ufaRW`qiW*k~jrg@*w4T6&@ODRL4v|zUWGjwgW8D4D3@tyhEKrTCb(_`f2sz+Z> zs3s>P#v}u!+I0~1BfMKJHFStAySku;**gVbVGMlSxSO83CU=pabv_t&c zqVy|#PAQpSG!1&X+e1v&x77x7Af_1l*Vz0zo447#!)BGuyKD?_lPUTxn+BT^A4WRQ zT#k?%F(zZB{ZgrPCUED9Wv?78K7sOZdB&TW#pMNsAPD@xwO`CS7x*SwolrEoHzO%} z4JD88ZzBI$OOWO5TX}h_sVwF1WYUdD1Qi}RVtGKc0#2VSt5RbinrCoJJqAT%XQFkO z8qGhWW5kN0>gD!MD{i)$opAIw#mH<&g;kk)o84vyMrabv5vPpJojqlhf68_dQn%61 z4>VzIthDqOPGbY?O^#~*sDpq#_@mML0~4YTBi_QQ-W*?>%p!vgvxr_`)?&siye;|m z7}K29&;RSoFTcdG#yF?9@ZxEV`&X`Px7fSb(pMkKGTp&!1h_5S(y8C+_pIq>!RKjg zoSj(nU$|Qa0sIp}_qgIT5{-V3WIcY;nQ`gwBO31AebcBLn`YhIwCdJouAbY>*Ylf&dO_D*!_7J7lD4GP?dLVea&mVxC%0$R zi@3`>1>6-{(KO4t!vwXn^vx~_xNYx;v5eDMHH@9*Bz~HxTd2!#@mKtI@TRv z)yX;eJ6b*G6dW7pyi;^aI2W8Lr;M}h7M*FQa!1?K>m_H#siJPmnZ-=z!u*w;&1=0* zSa{xRZf-U`z-M)vn{HURt}50E0e?IjI4 zhL-PkHqx4}YTgVUy!-U&8@)~U^v#a@s_UJ`#CP2Fpy!`{aVNOZ>z-ck^*X25H@8l2 z?X34Uw^|+7Tix0T?M9>3Z3T@+5qG(a;zPPRJYqN7464CB#N(dG3~X*l3s) zn=~36J032blX|u;V4wldTnCv`4Hp_4~Vw>rIUjibo282xHALh|sQgS^9$4;u(X z*m1j!1~C^?MM{M7Xl6uV(X4wH$`x1bqnHOL>B~89@iqia9zN)h%j8+uWOc8FM^?_!l|`h_p0k{wjf}K z{5hb6i+em%_h+RlrhfUoe)mquQ?C zT~zZJt&hga-(=5E>R(OnF=zDp zR#4`w*=GvVo(cTg!L(Ck4`VS~k+;8f`@}%MsJ-&wt|{0JbC zTUtv*K`gpI2vQI-9cZsqcR45kTGC#EuDX?wsjf7r5gMychPpo_jmVDg7SCLFyYB5R z@9b0TkDXgu|M3w*ghXgGR?l>L>&=dTb~Sm&dkF14%AoHJJnsqivx4FPgdSPs5{?MA zcL*YM;`Wc=e9^t;)*N>O`rPx~+IF{jsyZMp%6A_PQ%(owv;XMGsj@T2S7E`j+5eNS=!+L6b$T0h;+2QBZ4I z`f;P8mvxK!DLR+rT-K{bRk!t3V-YPDjN@iaUp8!mZOdp~(&r4zI3RCih-4+XtUNB@ z5E*qpimi0nj|J;BzQ@(ljQ(PlpwcGy9P8>3E<|=F0yLby>}R^&$PBlXsb3vxb{V4386$$4be21dY5Ji}$e*t@(qzdX&Y7SbUfTb!9jmX@_;U(}^_%X9-?- zoQ*_pp1>8k#4n-1N?P{QWeYl!_3Jp2AJqhZLpn1y^hG_;*e}0looUDG>P?~dtbsmW zgVIPC)}XQOG`z>~Opr20S*kfFt1QiKaXvyydVe;CBh`?kQvN1U>|sD!qR7BeGc2e7(aPeNt~eo9FW>;T$gLP^HjyZQ;x zVMqh}vnl z;v993iGx1lECH{}qQw%@;_Qjj=Ls4`M*w#P78gthT8i+c;Dgfxr0<#7yXLUXuFsco#H3cuj3o}&iXP@YH`w;NL-fvdkwMSlf>x*aMX zemZ{AHlrt2#$rU&Ag2r(&OxX^fWDXaD=yuectz$;GouQFp-Sg8a`mw|;-ZTYGc*ID zS7t!YNoJ6ZC~#Kv9ZnH;c<-Pxi8PFdoCcUOm1GY0@Y}@?{lzTgCFQu!WFSA_x+hCb zNyep)V=lUP95oZxn9lD$j(Cl;^c00!vPvmgTJnQK7egp&L5o>!QQJ4~GN@#%_07lp z+KQEunIiWbyzkc51aK%Je`H5Ue;pU&apfqoeG-|3-f!)VIR_)caa4>v(UPRNUKMk;=RD)Q5Gci zj37?sBf0vEIDB5%x{U}>rC2FS90;+X3J#^T@HqLAg3jUaPobEoPY;Bzf&Y?{Q!zWn z@doeTaUBXky?jg+%^@!?72H zzYn11pr}Yt^8viUwGl0NY@qGKydWY5u@0mjS&g;Gv#3o`ltg~LPoWoa&*K%O%`$=& zQ5=7Y`b6cyw}$HI&yTDmmB-pjVJw@-K*ACXhh|1d37<~?*EtMTjcrKS(^S-nisVP0 z=Fi_iktOxF^^E&ws(>fK!IWpGVn##sN|3lP zlTGok;Hr2w@H}des~A+|%%AMhs5bQ6d&CSUlOT1Y(A9rf14R1gE6sOhlpYbV*|BQr8-y2e4IuV>+U_UePP#pew<+iUAv0hlC4vL$n~1%@w#pWCpclX!#+pZ^gH@TV#YOM^ zV`i8PCETa}J~T){W%^G^_eOs-vo#ia3Q+-E<2mv|~k|GNJNNDWm>{v!K+GZQ}VCldYcdf+`_e!h?VXtzB6A8^&T} z-`lY7pZQqrF&Y)0MjP)6iU~YVY=0L=%=2?YqaT!F_ci$Y&)(nQB%6QB3_d*dF#?Vf zfkfc*O-`KQ08XCgSUcZ)(xlY?U^fcsHWcyDw8uCY$-Ix_z1V8#)i5@!hPH9jkZYJy zZ8Nt1E#)1P)icX*i0C56{1?F@#le`F9RlirFiAin9Vo+z;A|MNgK3I9$&5WVjX)#| zwO>5!FfI-gE}R-yp{-;y$c>aH_TvO{qnI(1v9LjqnPMVo)>fwON7RfHFrxg^f|wD8 z{thmp4Pm+i_>)pGJDw#!B9*@(sgmw_WsTn8k_;C7Z8F*J&e1^qKD6mwI^Lp5DDsh##z#76?Hnwy6501$I`aVgh*@R^D z{sZH|_&$iLg$xuEkn#U3vyKvgL}pC@Arf9_DnFiiT)-jg`Q91!0S+rN$>={c4*Ln` z4mozosDwD8)#zd^#bH+0g27y@h6;#f7A%s8Wy9 zR3L+pFoDtva*`yaHF7~dy2^`Pl5a7@Ux@vWkD{j)+xr2W!f9AX4LB8&A>)U|^l}R6 zUtXXRmBQQ>v%Zw?$Sn{UQV7alY^?_q6b$XD6I?!ue%e#(+MmLC*Blt$8L$>ma??g;2t~Asj1BC4 zupORQ5a6c77x1i|ALwVafeGB3YyHx5n_Iz7jcHK*l?%;ow->0S1Gl!>^W0i+quH(X zx^7KSQ&W+bRm2InHr@wWoM0i7_$;qJ$>MV;Vv(OrGPH>55i>Nb(l^R3$!X$n5glj{ z{uZJ*CG6*yaONIAA{WPEOpd;|id@1RXW}b#l8*S}IYy~ZH!#4CNt|Z|)arK;fKlm0 zV!w=R3Gr1Q{)MpypQoZYxammz@XT(oS*`#e`?ZX{K?xx z3it0B%`Fim_)MxoS3-bA)HFlekiAM@6p`1R9+f$g4-~xz>AF8V{;_Ki!1pIgM9@3dOyk{ z<*jTY-Ya}GJh`yUwT~s+Cpk+JO2SddqyZ-_WM>*TPUiOgW1DqAc5k-%EN2n1%@gAw z|36@v=`7m(m*Wu`-W@w)qPM7!DJX;x`nYiPT?pV^utLHn<}qyn3H(U%gUB9`O=PER zk;!|;z;JSMR_#ru6(;RLG6PH6qdsY$SMSkAZ|C-Obq7)^to5zO{8P1l6&V=szZz@0 zXG%rMY2zkbsb9|4_bVBWLpzY4Fqa7QCovmEe#d!5hQszN$tg59w>x#S+4bvXNbs0~ zeARlGA|Xn)+@kzBP{90((iz;_8Pw+Nr|JPa@h(pKkFn9^N1w31%| zWgbVe=+~j6Z(ky8$b&q?MQy`F-!)Nh-Co9>iTdhpZeT$QxP=UrSalFB5g+2S1Xw#GQsv#!8Ezi&gM+hQh{8@1>`VRblXgcKWd-giv&iJU^0UF+SNX8(<;+oo8=m1pjCW}oL*HI*MidD-z zDn%X$O_rJIOQz0Hr6SG9q@tpOabh~Hb%kazsYnICl2Sqcv6vb+yx!(Sdh~9vvx3*d zDa>_xO~)5cL>c_+sP$;g$!;w_Vse`B4bHHJP}K9?9*N5%8F;r?P@KU0+UB*GU&Unn zuOw>^TQ(0nqk^D@I&A$UBHjle9>Nr{B_f7KHq#ElyU-l8SqFN9*JgB0^WKWCMJwPr zJS3X@4fsdx0?q}Tk%Zo`aV|z}i_sPbID-k0kx{kY+uBK4L77)#=dZHOGc3f;kK&4g zoDreAgGRr`*^AJJM^u(S?2OA_+31(!xpTB++OfGV(>{w%9H>*|mn+G-{5dFAC{Z9` zfcU3ZhCDQ&{&dPsUf|B~90)hDE_2Gd6#aMg5@ek4FeejvDfMD=`}!ug#34UB z45{nU_Y5*4Szgh<=X1QGG6{sh~;nO9Dpws7eAxORlLxMFXUy$wZ2SV#IGNRTHB54BN(A?_zVX4#W-E30h`a|Jt6D>qe&`=$KTfi4( zSX@wWh=hQ5P$KU$$_0f57UhDXC1`xa*{7`ad2r2QJ83BMQ?Z27NOg-aWmZZQ(n-Af zO)ipBbNw3UlEi&7tPp>m0vW_$`z>2lsIlC21hFqeIT3<)3rN5-yaN zM~d%H4-K8LJ2{*bA!z$`TqqxAv$n_#wC_%qeIR_g@?s%CoTOcDG^FHQ}ES!$W9YVFSJ8 z{Ujfx94G5Y68K9ZRRyD}5b%o-A+~-D$wd$<`m)|HM+iQ+2f)P_{8B7%Uh&@8J(Dm0 zo@4TLxSjC=M$vt##RHyA95TQuTu^t=pvP|DNiGzw5tZqkjGactWZG~Z(;Y%V1<@6n z39a2@hw$43jPg!{?ON9RQ_<^N@1T?CBMOy%h)M9P`2vIE{Y~~!Kl&{t$8!=1e z-V12S&jLr$qP7TOcAZCqguKyEFeD&w6;tvi2q_MPMw)1#b`Ob?ID$4z3t{=P|7jPW zLAspscM?coy9o}mPlv!T(WQX#1THW*6N7;XSqjaoscY8Lm8C!up@iH~OVR2ugcE=( zt+}_Ou=T$ZG_^!?{IGXMz)PPG0hcV3NX}8>=vUrmP3Bdb#7QetEWztksyoLvVM${a`1!Q%>u3#Sx zdufJV#j%i|%P&|m=amKJ{pAroZgsD#&WSBGDix$B)*ZpFXF_C5CRNio!8T&;i91AE zQc3-^UX?*8#;kZ%glrthp?yYumVOpstM7?yy=Iin%KNI%SLdp^%2So2bB|OWs6J5n IDeZ~>1?^{!u>b%7 literal 17384 zcmcgzZH!#kS-xL0b7yvTcD%b@d!00y*iM}_$vSD%7E;$Z@kf#pHfil9WoSAY@4ai! zcy?xe@7>@XW@(!>G(lBc=pR59vJrxU=&wqZ03jh2RpJMK5TfErRFx_r1tFxWKR^Lg zp65OHp1HF-vv#QH?A~)f&bjBj=RNQDdGB-6(UX~O*-t!e7(d`m`pexeo>ejklx7VGzv!1KxOvAVQoM$f@i$*>Fyx}=s?v~-@cC2~1EAZ54Niy+zzD;_iTFUNV-Byo0$J zD@#u7ywnP#xOg$>_5JQ8KZ@O#H=lYOgcFcN7A)r3x%>w+nIDctt{YtMB7oHEA>+8(`P&(b_x*r#=st2otgFl`v z9OrO^RTKkrU^I+@g%Yr#H*cq5R(tCkt&SfoZ*0YGqtWWNqDF(A zhYkwE%$xlgHG}1}cGYAJemwIKfb+N*80`d1GbrPJ$qc4(5|~smgWI^!XoOMFXs|Bi zj19A2(Su0U$QT+aoM*&Q%pKB(LPy|l1pAGKS+Pl@L6oM$4d~>>s=$Mm zJaa{4ay49FU^6mztYALEiVSdd$%t&6%{TSxIB}^Jwz^@|?5_HOi??F;lHZMd+{VSr zTO0m`An1Vx6kg`hU<`7ap4Vv1p)Mp+4YOpHtPFyrdOV!R(OkoMII<#8(2h9)*5Dvo z2MZ|Tatb7QEI5Qm`+=BmG`qO#|Sv#_Vno3Ai!q?WyMVa{o5-GkI zUf2j*onE)bQDjl9el;0ESKf1wcR2EX1A!Jhez(ye=2GGq(xOzYES1R`WZFg}E;SnK zkTD%zmm7^6o6SyAV*_;oi7Yt4f(sZNW^n{X>}~|T4L^vsf(Q8QeJseUnS#tAL{q>; z$V%6$I7mAqRhJ5slb$NEPC{5JCOY%$RMEdxE5iC z>jJKeUg;Kyr0#yvaEy8pd^HtMt@OH={b0QX={h2xxPBZoE%06u^wMdDAy`##BA6g5PjV~{YM2$XKc4|> zD2`H&Wiv92!1u3Mc+Ckb12cFsvfcu}4v{l3?>Kjj^O*XVjU8*->Q>m|Eu)=l=XuYo zI|aok181)jg5?=ffe`qik+S+ma}OglF4>qgUFkv)vX zY(?Jw-p%6!^Str;gWI-X4}Fee@2lpGzj#fp#|-h7$llV576qx`{vb#}$aG-5Uft%P z0BF&86)Nk7CR0->QY*HWpN!3LL>iF@-z}cL>UaH{8^M{U*dIH0jQ)vTgb0byXe^)Z z^j4dl@XWG)CwLI;1InPE47}h3`*{q-9teXaJiUk`f$bfF2-Udxah%WlSNxjiuR*N` zp+D4YNuJ-=moXarq`^6-~I+|l^$NH@wqVVYU|tI?ABsqsj3vl zBj`6EpDERm3pYBgNYEG;5}6%OKkIq0Iue#wiZB;#Zgl+EhD?ns&xRpnAtp&80w~pF1^N8hIY+FX_k~wQR)*f*qL+FL%s`5C8Lqyd5=(W;|VJcUz@I5Y; zVf7cX^fYX8&#^9#;9{sw1S``ohM8{HGQ%xqo-dEIy61@dX>HML?aVj_N5@I1W2qE8 zghs)`ENU!7X~MfPf}<=x#Nxv&s4C;>L^-VboldGCI90I1``L(-4UVB8e}p9zSV_ly zy6iw@^7$$b{S#$^yAhR{TK%FOX!)1lv&wYSbxkD7&?q0TKxYBNr~*w@rxhGWogih5 zu2gd#)siI2v65*P6G57Ws697HvG>FQl3n zXTFI^=D;MgWBbC(7e|bK5;8johm_>O44^3{lw_^EYaWLgKO`pQb;RcLDXgPZ^d>t? zsHlw5GyyH;#xm?a^Zz+?^@X%M*9>^SXXaN+HA2)}4jJk!E@)Yb z$9+T=0lxN{dC2&3YKvR2v7b(B+ICXoWUN922y)73As@=(3#j+;I zE-Al!CIj>y&s?u9hv3?#krgwb^qa7#^lk5QsAN&I1f&8gBLt*Zm2%Fb2O%UhZ=}q% zVBE3qGIV6E^zBE(+LAM*D@EWrIM=O>3E-+!jm95m z2F%W%9l&A{%%BO+8p$+HFn4i8Fk8^4sm4k~bFS6({N0ivo@z9%`VsnFZ#4ciGwOV1 zVReJ?12Y<@25!Th5T+9jqA^%3B@eK`|gP`G% zQ&=}b4-_iGD0CwTR*H)=xF5g9#5*Nhqw!5W%BbK{wd2PjXWoZ-F81cPbpKX=R?k9* zoK}`*#%edlE@g1ICjKCv?9TyBvZOjTd1+qVKBbb2$NL~ z(|F;}};xVYw!X(iSx~k4ZrK9sxhw=<}O%c8=mW56IPO@Va}RvM(PW^ zXrOU*Pwn_DI+5YWQ+4nh>c4|yB5L*u6OEb=;61Hn4iAhwFgb{bL8>6BX_iwx^BkTI zQKUn^!ApdY!arTXF$^vw{kH^@0!#wZ;#K$OcC94U%gRz=EQ82EoUdY#afDB||1WVQ zW;2MLq|T?SIP{O)%wM>MB1`JG&5Q$QC+4G*Y~3W0PHf>Q^RbYak8WZ<78CQa7wie^}fbMD=MLf+5kL(_>Z z{sBiy9M!~88L|xNk3XJyoWmhzT_Wsa)0h4xP#@*fcliqW9h)#S!vXfH&2jw)zlitt z8-a#Gj3XT(GlemB0>R))OYGY-FMwcQz`PQ7X2_}&rbFWT=kbFjO8H*+l2F}#^P!ag zerAXa#`YSsBN!W~9V^xOK{mFp%wR1Wvo~d9ZfP7S*-SDM2(Nr*88};MDyPh0J`I@HJd8yYt};I0l4r0p7~hqQ5qF5 zqfPJ%iU~Z=<@*mDDfP~djJ{Wj-PhnxoVmZjNjC3h1|OaJ7y(C#u*w(6h@3b>1e`q2 zsdm2iq$%kBhuw%KL?C-N()Y0%j^e%4YUtH4HmruWb={I{m{M(9`3Fe3Q1T;>7c$GR zkLV)D!2Zx{abRRE_6U=ar2t4k1HoCdQWw+~d6F4>Y&wBR7AG_8=ql_dTqwmbBnAfO zFq=RqP3*@Ba86gRs%D zlG|2fM-IXY)}36sQ#`N{OhYD(LV7`wnFKqyAj&!_@QMN=E;Z9Uo)9EC&F7zB@kth! zP++OX7)}+g68mF>%f*IH|G_Z{K|du4bx@Ox*?(X>7(WG3bvOgX1Z4dG%B%+nfRl!+PFU|9#`IuQ_+bvBO&#gIZDRKDJ?83b(pQAqrc4|Ck=p>_0Sa#9`C> zlNFTODqwJ#SNqr@WSlaGr%8y7u!4jPxE014Dj)shN}RJP=e-&P#xZfhM%Kv!^yfH@ z=TJx%iYm=CBL&h1xe+LxC@1+)Mk5#HldHT~Ao&&p{Dsuhcm_Q!x$)Fcx`%N&V-JOK z5h_;FW5Rd}>0UvkQj_A`2D7}Bv&dZ!SWXDcpKq;36Eq5C++$oXUNGM-{gbS(YLYdm z<Iw-I3u=ObhTN#X`HJq7W$J+Ok)(0f42br)$M z6vsBwGqCr;cBpY6tZj)Upst-Cn5T__4eZ-1{nCZ?jcBXJoTvWMxn{T9i&TbzUt8}5 zel5Dz?ACf+zb06zsVK`bVghFgHDeaCCoAv=1U2|Li#m!_yzBYJ4zax34@@gvxw_S|i}pQ0`#i$%szRRV?PT?AEBju183 zfPvFp+dq8$gE%tVKW`a#fd9LDwtomWR__E(!D(J+%^3;&aSP~$RCF-SWXvqW$-6)b z#gDV=B**GAxQ^{+SM33%19GgmoWV?Zk%Mw7hV>APnsLJdd!-GX(xFjE<|7)<;Rs(s zp$s`BG?~|}04az`>=5ZZ>WcPdxEwhNt(i=>LYh?)xoVr~wXmYSA|84F#N}&#EyIi; zwJ@q7x23lRTI+1po~kj1y}abAeS=Q{5D*VJ@t1HJJjFs>iAQ-wio;5XEz#hEq1h$t zu#9If5hbKV11TaUNfhZHOc8?^;1HUGBjbGFN1H)cqlReFsG*g#FH>@x(Z1uTd^6_! zwqY-U?MQRj70IyOQa-~=>^FFg#gL7%33k8Cs$J9LJFjwje6AS?nK57-EpRTU>3>{d z{y3GN9={t2rCfq5;fg+P zJaZe;6(U4$etGs`V;*_h>U#fg|nlT({4w z_h@Xlb33NG1Mw7A`p%=_qsy%;ZQ4=`qLT5np!4yf5G1xNy8R>vkSiS zXt_=JlnY^jH;{m;)kWiG8#{FQQL5}w{1LkZXUs%jpx=5KQ=WVWUgs@sfM~Kp(mPdAlp!5n*8a&1arnd`> zxR6YHhoFdwVk4^%rU}ccH4k-CF1&q4Md=UZ-&&^)Qj*l;qaUe9a7USSsJBsn9`$GNJ~DMt|AB1> z6qj2xwsWY@pB(jNtAc;6$Xg4T*FY8yZhEhs0p10RK+6G?;0 zV-AO~ypUa)X}RRv4B;v2OUxu{FBl%S*IHF*7WK@9{`zpC`;Vpsw-)r)Cz4#S#?A^s z3#T~O={3DjdntcSU{dvXtrUeG z|9AD;!!XUme5fD*p$^wPiRknmh(|C*Y>5=1yke3d*b~Zuw&=iY@Y+tUX`VaDwFrLH z!^fe?-hhYGhGEqx;Eas%hKqACXc)?TJ3FYDJd@kUQDM?v-$}ZbZ3;E zo|sO8oLzD=M590B>_x7_nJLSkix3R|%2vOe&Yh#_X{VNjOq<&X9yBJB!Ikhl@)_t( z=t+hM5vvT!5P23foOuJHk=NJF;KLp~6c6%CEXSO(97V-lrqd)e$;l*MM!neFyt>Zq zYlz4W!{27|@qx@p7IgN-@Y%Fc0`;GBZfpUaWmcgTz}eUf?H@^Jwf7aRxJImkHoD;K z0wmxEpT+JioDESCm?xZ7s{wU!M?OZoYk@VbHk?;@YcCC`8mxBykb#7M=a#W%eH7}X zTNys*J%GBFNg>Mn6Lu3Kqv{kQOHGN~S}(vCRHU%jyi~U?UD^#y zb@zyW!4u*^cF zhR8kIGb+pDD6hIG;xb&|sI|K84tkFKGBx-U@Dqg-AE@;|b2?2rj@gQ?qlG ze5F*K!bd<0Zoa%wo^z+mQz{OECi+M6I*TK`gF=UM7JZw696!GZO>tX&5R^j>rTVVX zO*Y4iD)@^{B(*s{&=pZ;#!IK&3g-<20gQr!0#)GDimJISZ4B{lCu^sa- zbM;w#HOad}-eI(ulg;S|V&_Fw2&;j@Z zoKS`t1(k-_1-JzzGBuOzO_)_l_9j|_s&~2Ul&)L{F@I9yXCzlsF@e%Sb%!uzR!SC$ zp8EH=NbC&GM~!pQL7EKlr(cgi>WHWLIkb<9P!#xxHT0w4^SDpr9=d@%-92O#E&qu_ z(p)ttbtF{OpB@=nGdOvg6d`E)16(M_yp0f#hb&5b=_BH_?cm;DS)(rY=kyLWbWBi5Omn7)HBcpLpX|`bL-ED<$uGj=)jCsGvag zy^`t`3q@C@hRru|`eSpsZ#`anhtqxM$N0gyCp#)UzRWA}N?yTLT=ct}_$syur-K+C zL94RUTEQkOb}<{-_WMNY0xk>)^s2c4q2Zc`k@^EMVjeO377hHK}J~G@Cb+dcY+F1 zRcvcoyT|_B4+$6roB?aKZ1$&;$?w^{BYnx-DRLEU0Vq<7y#^penSijV%7>J%)+HPF zlJyXlx`>wlIR-6i0}qB)6Ad(Zqv3F4n_KQf@+JsF90-jFXOU2ZI?_1UC@sY07sF5b z_+-iFl>bXZ0&7ihkgXj7LoX5u4TCeW7nqQxFoK%8=5zX|6i6bJu-)h=S{;RO0&t}j z|7H?n{xLyQOEk;xZf69%Vf_ejdYL%N9^f96XaN@u_SPZR=XPjCr9dLHgDJZR00=3K zLK^%U5&C)7k6qE&B}@b^4_a0bgR2(srLcyW7czu4l2WoKR>PAh2%Op(9sor3jpN(d zI4zc&0)MZd=iKMm4VhaUj*4T_rVyO6hx4I32&A%Du1;GZ=2T{6I7T)5WZf?L4`7dE*p zvx;LrKbxO-WV%bU%GJvw4BYBoRe%vuYC!77dM41t+)f4eF}4xQPCOnGkIKRqFNiah ztu*C02@i|`GMC(AXi+Ez;>4+nWJ_??5+!O^ znq4IlOQ9$vAZZ_3w0UWf6ty4wmlo(#pZXW_)bBfc;VwcrWw z(XZYpx4l|=*^<%>gM}aXRe1Gi^svgHI(QSm2Yh*ZEe_EY5QxX9qpcC4_(vs zQwytSbOUWoKdYO1?o@5mbxY6V&5UmAb7&iSL7zuEs~7cSXq)CCAxqrwnp}e8d;t-VvXZqOSRsy6DRUx!?_(NaU*|lPdZ8c)9&EFkN#zu zI>x?PS=kDA{gs`8|EX_QZkzDP@5N!Xa{DOW3WJqi7!Fo?yL&4Kaeojk?;Rx#&+7;M z*z>q`M73F}sfHKJXIReX^f-wR`DVF=5?x0HzO8L_qK<90_wA8-pcKxMzu$4vb2y1J z@B_oOiPP1(;~3IRYI2N31#*nEn!$h}#CWoZ6{9T>y=o{0Um6@8UKy#k ztdAFuoe{XZZ;hM>>OJe&-f!Lohv3Uzhn9p=#}#%A_t>cSwz|QlZ|2aMU@NKnhp``M z4n+-AmU6+{q8dI{;VqqYr{It0rVNF@OZWq6ffLa+cwsM>l**KyGDJd&JLpF7Bqwvg zMUJcUn3V~tuIg&|M1`5s#0o=XN*Hd+U?CEao7upQtE#H_H z$EmlHJ{QpC!3%x1CuNpyRd7ggQLVz^BL0X90kVK;-m;%)_ZvfmP@v zGoA&MMnNVS*uzQM7COV)2Y#c=7-LpDH>0Y zc{Wvm0#sjl1l4rLbgDG{^o&~VxFY2L;uTLxuW<(1InN8iVCb9B^IpTWT+3B!C`~G? zfx<1U;Ya9zxQY>Pm*-+?c2ID=QMn>71TKZxRP(DPF) z@T&g5uBGmI{=VmtcxEk4TnX-^drN1nchsHEdEUN3ch~p4r0IFPp*|S!f6Mds54wYN z#1JlWIhlF>6E|1*7V{Y2(V?0rSY2U7uV$WN^$aW8ZwXdnRdToTSS-<#s2Zy6HfoJ} zvxeHiuP!zJIfk=(D8)lruc1Ud?l|s3wAGThOCjD$8{9yQba|zEIOVV5F;g*Y*oAT~<*FZc#VkF&{i$}Tx|M12V3{5)RLN<6YTEc+8 z>o3dum?XUTXwSc~^mcHt`_N<#rBe+(aF2ICAGU?fQbOZf+EXJ3(V0DRQ9GJ;Y!CN~ zop0=sZE{g%FMEF`N7=XuKfAF6UpTp6FC0|g6RQZP4wL41%f!L*#KGK7Ep;fo)eU{7 zd5KkrRn@Z!#D0$VDQ;&NJ0N;!i#W%@A3?x}ZDDKajl6Arh3KAE^_BGxhI;U+_KhXn zd_tHkOgDJ}><1XmO?^Hm`W-n?F@}#y1d3Blahg2YEzYGUPSv`8M}#$<`=rs2JVdU2 z{p*5)oy#pBLhvrYlBzRnu3@Tqj@5Nkyw!BrgO?XOFYGsI?3r-SH}R3-HB-{q*nXeK zz)w*k`uIlEwVN%mR=)3{6c4qvh7u70V{6qmvKB||75R~0ODz`mi3|)nY$UA@f}J4z zED)Vkd@YSbBt`wljD27p+IrxqBG#}C`H*Af5s*M}3ii5~m;>NqndTULv_w8^c^o00 z-!gRYCz<=s$O`1Lz)LV#C7ZNj(+#3~q1pA~P-DZK{^bh&@~p~DHw`N9JOV1B#m$0_ zJ*=K{43?P*fTXxs#!B;jR%fDt0m5%kB(g@BM!(H>J(S|1=+;o8JE*=55`YTHn}LeV zf75&G7LYTm=XD!xQ=iidXy^2Kpk^_dd#fL9hj3s>e+!vWZ!GVUI3q$P>8AkATeuLI z?@Ea3tXCG$4BzJhUT}ScOdq$88NngZ9H}queFPSn$dgu1bUoBQ(q()3l|&tu%w`5# zeA8Uj{a)M)clT}v+?O2Ht>H`gVsKnQZh3VO_PT@U=JI$ElKENy0#SzOq{i4enjj-8 z+s*g4)bPTz{R?}dEz$U?o9H&G&#ik(#M4N{bF7Z8kJKkfWsjZ1OCtv{e*4%R+4rrH z%QSoc+Fk3e6ZPEeAdftn&eleBz7Z%c6 zccju)x!=8kS!H3vT$M?UGc*4|KT4(jJ50@`{c8FAnS62Cj?IO$mEWO zSF#ak-o(E$p%=a#A?&d_-Z4KMWg*)p^_0hBypSV6g^LgGTnLhipfGQ7{*-huO~EHA zj>RUK#qSGZNNCE$@|>F#_^_=|LsTfP1$P6oDGn8SpDKyjH*2MNU`@WfYF`B1=51^o67$fj_$%^R3w#IcmGzOhg_ z^d(CALDOc=KX$0XL)G(6mjv&w)KIo7a^UX5LN0{j4lLOxG4Xe@K;a_XD4cC5<3O?IZ~e#uzaD=iYc2nmTbYd`XW_7M=gAP^vggoMOHfy4tsV#R;pCw{-LE?wPe zn@FTb=hUfl`@Zv??_Trf!a~KuuW-=$?w_8ttpDUo`g75^ff77Kr7f*GR#&a5uDxb= zoi(THuDRX9T0vR2ENyG&p{1Pzd#$LC>Y^?^RBI)DOwZ{GT4l_b*Hz4@V#XZa7IY17 zHGl5FS*z$ndhwyPHjn{sHCrof|5#~9 zyASO(M;CMv$hf+s%Xk*_E4rfRafqU>>IL+abWI<^v#b~OVLa#bl0JfGMK9~4c+TV4 z$MLM{6Z#~c3;L8kjb}}t(LaahA$?YV3C~6C;YjDA>RbI@*lhQFbK4K!sjFzQ6?X&; zKRJQ|$}B|RM!AI&ETamop?#o+R>K;y#&NKvTCLlW6ZoMiV@lnL+`#Xw%S%-Jq}kc^ zgFmrM6=Tn@T-oe*{VUrY{}bO_0a5q;R@e`&yuTlA_Ip=a{eI_4tGjb$H*9x;m7V>l z+-S6W?Xb}(5Cw9Gr7CK0G=GMbbWV%7@<+T`-a-k^qXOR6mO4-)o6o2AP(4!$XG#0F zo%kG1kmMSl-0s%sbucqx{0f!mTA9GSo^o^>a~k2E6<1;1lxfLg#r?i#r8Ev1x7E;~ku zI7Duz8HCfA%!4mdz9I)Dget0{8l0FwCO2^cAtEIReHo4P!p0Z5HS;P5KdE@h?^`>% z8TwuxRwWy}YQp^;|EhN%oR{m}X_{u&>xY}Zx%$GDezw+Udg#BqvEj^B7G(3=SvOBGd{ zzSDTCjDoyQvYk+nI|_?I2!?7)y=gsDi2$3U7>n=Jj_>q1J0`(LwM0WSVki`?K!i>W zPUi`{GC6NHHe?6E1~-T&FnR`zQhaz)a{^WUCHTy5HjPe@xsXF~;GX(Xdwsg;#^iuLjWk4itdUDCVRWB7$j+#@Akgh)kG3 zB-2YICDAxYSXY@Zp$8h0ntJ*kU_Xq%17N?912%0v;u*7{antnB32VxY$H#mzR4@gg z{_;zp#xrI^<<-S!)N0!mA{#OV;8AP50PK9D(d+jHzUem_*K&|2r6D&dlLitulLnFs zz*VRYY_p7;hGcF-5~R;Qu=`(+`?k<4Z3nu<;S9P0Zd7Rp?OqTz;UdMnP{M})r)nuS z8vcVuQ4PIy@Ot}>o*!vrP1iZL+h|zZ8RS2Haqc%p$!z{ zX^yZZYA(|)hPu?8VRe?3$LbYUKhKK#&Cu-R*h-{IY(I}h)f#YpS=HQfpegzDH0F;7BxmtG_OQg_VO(6`GW2HQ8MM{`bms^j<3a~CsA77lEjXEBGx;RK6XhW(OYU(MDWk~QB57qQ#n$JS$Y;EW3Lwv@aT^^su# zaEim?1hz-GGPo~T!kq`?pGsT$jnT_E?a@(bh>+nV&vaa$2#->wEL-7`guW+Z{D|Fw zI)+)8eTuW6Kp?|o`t*=(xWk{S?^r$i+p(2618sPT?nNfpykjzes5>g(p>^-#$My)W zA0;Y232>l%+3DL8=R@541H=jx{(*hf1ItGx$kh%!W@uV_<@Lzf_V>m8ga2LKfXC8p z8WD)7*lq6Y_$FpsGVAlXYa4#g-`g?Q-^Huwf7cqEN;X`%*6Fw4pj=;5It9zo#pDS`H{G0y1w9KoR7P-3J3L|%`-|j^PIy!+Uv$2ggWCg?M$50nW z?kW_rA{eEHfWlS083;W!)?}Fgpe_-Ph6DfXaao)CHN&&ma^e~EsI&H!gH>obxGc7YWT;# zGbkLbAznIx(W|zgZr;EKnZe|#S>8ek9-|s6Q>6$TD5z_w@(_m7+}P_tK|55?_fA3N z?U6$vhp;QEx+n1DAmrX%tM|67aj|9?BD=xeQE^AMTSq&fO=Xx_wi#%i05Qub$5h2O)Hp2;r$4gC z4V2*PsK#j#Bts;xgJg)S3rJZYHKI#+7JVc~^xQ+75^0bMRN{P8xYOVEdxPJVQ0~oU z&~AAld%PCH&|oEwwBBbN=ff2XWE!ZF{N%Oc?|D}}@SePZN}lX_A@DHbcl{OVmt7kS z6EXQ_Z@2rI*&K`KW(J-oB-aanETS=vp(nB?02Ecm5R%ZstYU?EkCkZ1v6`ee^C?P_ z3PBKE6P(965K1?Hd=d-6AP)StXzIY5TjV2VJm9*+vOsDC6oJn6EX6PS9So;&!$J!5 z3-Z&&=lXsQKz6DbzBx}Or=r4%4dm(_A=GT_qjEcFh_d@Z2Ek70mJY4f=gb8Rn~SXK zs3HVRy5B+oL81!@1kI?tWBM?z;l824%H7cTn!bsFPf!9ndF6_0mtAoL+22CRe!QU@ zC;`EaB|+QZdPh=(NDcahI7tZZhdkik%2D-Oz3pEAdp)^_Oe>M&GOffr4;fa2_q6rQ zN%RA=b%uDzvCx*VNf>Shul)!U(@Q^^hdE|A0_BfS9!IW*TTv}Bb~s2Pg9NOwSps$j zi$~SaG<(5%-*g*c{|~TF3jgE;{QRuU(33T0vBx_vVGp^*Kg{6RgUNG_8KgADATeLu z!AkQ1s~2*^ZH)eq0B9zW0boeLzUN=G=49hf(b%v? zYHyuM8nIz(BYVG!K*c_3jT~65>j+lVcEx<0g(S;ia(b3Tmc#IAB& z4-w2T+X;JCL#`8VVL=1MErczSpB3kK^|?A~`@@!Rzh@ zp?BZ+&Oxi5^ZLeXdYsd|-|@Zv{Vh2DD>z67~D`0|bVNqKT?0 z(AB>7aUYkkOq}$X(=v8@Ub#jWyVdXRT>lGhO{9v};9|NSNN2is%uM4&2n!26z+jXj zs$4ue**^m!n(EKf-7Pg(p0#_XjwnaWQ1EgBYBlH<73-FmJ|ne%eyF~S2zKP`9UD4u zQ)?r4Xg{@vu88xwyB5>~MW5>78+p;6MOOm)8i6t23#u-Ts0DBtC#~sV(#MQEIVVg$ zdC$C#>aS3Ql8AB7=g*4RWFse&S+t7?x*%ibCIJ-2q>Nm;!fQpz$p>mmR z>vjf^q@d8tdRhTlk8B6&{n)}c0(Yq5Rf*u6P0UIel*ER7s(d1*a*g4xQ2QS-oKpL% z`SWj>{_akm$k`GQK3zRU@Jj+q_!i{f#+#^O(?Kf_=*yoE5cb#_@0cD=6pU#2VvOTI zV2&ICSGe@qoijr6B1lZ(bnX&6hiMMqj=y6}LyQ?!B(!YqFST9l^76tAPZOuldu(~EUSTyRsUEsUA?4;EnAm|bnt$DCNP%>2qFL;pbx7+_dPz~EmbGKDHQOlscQl;AmHLD`z1 z12vkUkP;!YfjRjkPy823Dk+&V5b$DJXPDsyf1!?1QbpQYW diff --git a/cmp/automata.py b/cmp/automata.py index a24ff7203..ddc114818 100755 --- a/cmp/automata.py +++ b/cmp/automata.py @@ -1,37 +1,13 @@ -from typing import Any, Dict, Set, Callable, List - -try: - import pydot -except ModuleNotFoundError: - pass +from typing import Any, Dict, Set, List, Tuple, Union class State: - def __init__(self, state: Any, final: bool = False, formatter: Callable[['State'], str] = lambda x: str(x), - shape: str = 'circle'): + def __init__(self, state: Any, final: bool = False): self.state: Any = state self.final: bool = final self.transitions: Dict[str, List['State']] = {} self.epsilon_transitions: Set['State'] = set() self.tag = None - self.formatter = formatter - self.shape: str = shape - - # The method name is set this way from compatibility issues. - def set_formatter(self, value, attr='formatter', visited=None): - if visited is None: - visited = set() - elif self in visited: - return - - visited.add(self) - self.__setattr__(attr, value) - for destinations in self.transitions.values(): - for node in destinations: - node.set_formatter(value, attr, visited) - for node in self.epsilon_transitions: - node.set_formatter(value, attr, visited) - return self def has_transition(self, symbol): return symbol in self.transitions @@ -55,9 +31,9 @@ def recognize(self, string: str): return any(s.final for s in states) - def to_deterministic(self, formatter=lambda x: str(x)) -> 'State': + def to_deterministic(self) -> 'State': closure = self.epsilon_closure - start = State(tuple(closure), any(s.final for s in closure), formatter) + start = State(tuple(closure), any(s.final for s in closure)) closures = [closure] states = [start] @@ -72,7 +48,7 @@ def to_deterministic(self, formatter=lambda x: str(x)) -> 'State': closure = self.epsilon_closure_by_state(*move) if closure not in closures: - new_state = State(tuple(closure), any(s.final for s in closure), formatter) + new_state = State(tuple(closure), any(s.final for s in closure)) closures.append(closure) states.append(new_state) pending.append(new_state) @@ -85,7 +61,7 @@ def to_deterministic(self, formatter=lambda x: str(x)) -> 'State': return start @staticmethod - def from_nfa(nfa, get_states: bool = False) -> 'State': + def from_nfa(nfa, get_states: bool = False) -> Union['State', Tuple['State', List['State']]]: states = [] for n in range(nfa.states): state = State(n, n in nfa.finals) @@ -120,10 +96,6 @@ def epsilon_closure_by_state(*states): def epsilon_closure(self): return self.epsilon_closure_by_state(self) - @property - def name(self): - return self.formatter(self.state) - def get(self, symbol): target = self.transitions[symbol] assert len(target) == 1 @@ -169,47 +141,3 @@ def __visit(self, visited=None): yield from node.__visit(visited) for node in self.epsilon_transitions: yield from node.__visit(visited) - - def graph(self): - G = pydot.Dot(rankdir='LR', margin=0.1) - G.add_node(pydot.Node('start', shape='plaintext', label='', width=0, height=0)) - - visited = set() - - def visit(start): - ids = id(start) - if ids not in visited: - visited.add(ids) - G.add_node(pydot.Node(ids, label=start.name, shape=self.shape, style='bold' if start.final else '')) - for tran, destinations in start.transitions.items(): - for end in destinations: - visit(end) - G.add_edge(pydot.Edge(ids, id(end), label=tran, labeldistance=2)) - for end in start.epsilon_transitions: - visit(end) - G.add_edge(pydot.Edge(ids, id(end), label='ε', labeldistance=2)) - - visit(self) - G.add_edge(pydot.Edge('start', id(self), label='', style='dashed')) - - return G - - def _repr_svg_(self): - try: - return self.graph().create_svg().decode('utf8') - except AttributeError: - pass - - def write_to(self, name): - return self.graph().write_svg(name) - - -def multiline_formatter(state): - return '\n'.join(str(item) for item in state) - - -def lr0_formatter(state): - try: - return '\n'.join(str(item)[:-2] for item in state) - except TypeError: - return str(state)[:-2] diff --git a/cmp/parsing/__init__.py b/cmp/parsing/__init__.py index cc8a5539b..7ffa0864e 100755 --- a/cmp/parsing/__init__.py +++ b/cmp/parsing/__init__.py @@ -1,2 +1,2 @@ -from .parsing import ShiftReduceParser, LL1Parser, SLR1Parser, LR1Parser, LALR1Parser +from .parsing import ShiftReduceParser, LR1Parser, LALR1Parser from .lexer import Lexer diff --git a/cmp/parsing/__pycache__/__init__.cpython-37.pyc b/cmp/parsing/__pycache__/__init__.cpython-37.pyc index dae3a045a70d41ed08ebb26f07a4e6b7ae9ef853..04c6cae6d7d9aaaf4ce001e758cdd410d7c44fa2 100644 GIT binary patch delta 110 zcmdnN)X&80#LLUY00e=7GvXp9@=6-2068fPDU3M`xr|YaxlB<^xy(__j36av7r-bD5%;a+#x;b6KKTa#^ET z89{PPIc&M?QS3lAb1;J@%S%R}7ERV$g25S?X(d6aDW%D&0f|M$sYSOqeS8d|Os-&` vAj63%nv5J1`y}LxSb=(q*nmV7YffrKYEcn8kiC+jhyx_fF>!YglMEvO>A)ts diff --git a/cmp/parsing/__pycache__/automatas.cpython-37.pyc b/cmp/parsing/__pycache__/automatas.cpython-37.pyc index 22b8e606728629f32a731ba713a9eceeb1b10100..aa6efc8ff7e046e4f2bd84303539469673054440 100644 GIT binary patch delta 1841 zcmah~OK%)S5T2Rcot>S1cw?{a7$We>IL^ez50V({7zZ20BtkMq4wsQ&HQ8=EL*}LG z+4v!l1c6Vy3yQ{jZzptwH+nI0L zjrDrn*6{Po*4Ll>HTa})@hHL()0iG;q3-HB=|*6L1-GE|LQo7#ZVB}wD+Oj)cFUpV zS~xaY`LX6!n8hmiwwcYU_^z@RYp{XGx?5wztjR8*R%at@kPV^MV6|<{8U2$&aCBMP zP77YjpZxw|Hc|fm)>F+XLIIbgoj}Zb-PDgGSx90b3xcOkK^n93Qs0-AAdVk;54gv` zLUSdKZ)S!uHJ*4N{AhR1>!oq%rJk5g4vs4;=-!RPWOXE)wib4!^*%qi4G;rV={U2O zFpNXmr~3+7@>3oPrv$@fQSS06=Y49>)NgT67R_A*$IA*30@>_M7$7 z4Bg5xphgCI;^^l*$?4c$34D=THsk0XhtQ9_0E+10 zmbZXE^7$T=aRfuOakCpospm(c!xP~Lh+Sh%2o40Jx~;69;YwE<&F1a78wBA=MCt}6 z-%q@Vjp4i)M4{=X-q4GNX*6_OZy2@#?d&T%*`YurTBkf>(8hs^1IW=a6>u<4CgpAr ziym-P9(d6%XKp3pdmV)^jFR6eji4f^_8mF_EI8T6)iHfC+pGS(dOuPCNYjeRzK~DwDXWd z!~?Y%f}>V*dUxYArns)7tuRq&dP^VC;VNofgU0x2;#0xrU3|oKUDHzSGws<(eO51H z0hBkPltrb9kNU9R!?%N$PD>U79?7amJ?N7Uui^qwB(nhG$4u+1ER3wyMWOe9%&kq=3*Ev058Fvti zSvs&}z*_d*z?fkfS+joUS*!V6VO8&ARXdMW)*4)zynwFfQ{aW;U<%g{GZ^I8`WgN| z4p@ZD@8(7LMP?7d(SP`1BqO-@S)#!@4!^`l5DBJsSX=klxVmk--F7a)G?~wk_!lI#XsNvx7krSJ}E7fIa8p0-{aJT2lAYzDGF zS}&O%T8ORe@7DGaY@qHKn;VY4NxuQN)(w-{lRllNZ-b_i1L~lDz#;!LsL*6D^#hS7 ze<{~hHK^uC{U&cest^=5Ycxkk_On8vp}I_7#VaBH!32C2OEYhBH66c3)3h2^)2iC0 GJ@pU01f^U6 literal 5663 zcmb_gO^+N$8LsND>FN30*$?m9PO=ULJbZX<6B3X%j_o8)oWRD4tr$jx^?0hip4py{ zt*&)uS2a0gEs;b@WI#d)F0&UTB$N{;!-+FL0QD6vxp3r=1LAqBXJ*G6CqaSHRCRTA zRdrRp&-=Vj^`$}~VE8S+9sTroON{-UZpJ?wg$qdW`^W?nJYsEL<87;Eak{r6yY18* zQ??_w?bSS#9pOfqwqNtx*;*F&p2*x|wLthHi)&5H6Gq{$- zQ86dx@9|n$91{!T2ud^JxL6cRC{;w|8mm6`G3LXnR^nb$brmMF?d?c4qh=>uzulGX zx>BL6^2E8K!Zxn?=er$M$5VMNR3G!SYq8O7_qG*!G-a&fWOjTXbsP04t!+?S`ngE7 z8I)pyOfk(qWbZM>HQVC@-hV}NS<`%I?X!WUt(HBokvnlk+bvg~+p7GG-R6P|>z2_8c-EOqfX!lk&WWC+4M?1S{Ro_-!>~cLm-P`#jSdE&oqTM^c zK(nK%dTjTJ(JR&?dFJ%0+0^(v3gfobtfU1c4%H-fuiHz4wXmuh^(e{pWET%qv)hRi4?V(;NV2zOcQ@?Bp{lxx+eDu@$@K7~+1bEq zx1|g_D)HiU@N6f1Yuz-GdDo)HQH=YR&pnQ0<+)|ep;YAZIG!|U zz4W6i?X$rMby94~=8P=-i+Rx)FB5eovl%3=fQT9JYIGqpP}yOfznWF=+aD z(GePIGTwM>vrYbZ0NMjHD&uk)?L@Df=>v0&l*_D)z$`fY+x%-Wwec64(c6kZ}5SuZS6Gq!0Z1;yYipf9s2OQjP`T} zqxjlyWe3^*E=CTJa!0WHZ?*=3%ImBSFiKA6l)Fb;{Ohf^ck<|$L%;kD)_KZds<0Wz zzj16jXXf3x^xY0xP|H<@_Z4-H{PoAIWBrI}e^}B%tE}_;AjYk?Z?LU5ZZPc(XHvw)O?udc-KCd|C&}gZcC40fh0FErjW*C33gfNUtFwt6g`Ff9tGXPygPcRpqOvP=zKbOkMDL4(F;;w0bccE%nQ8#^WbtKp6rC-Le%a+Rc5 z7h+w>dM9quOA=?T-VT!joa%s9CE>MNNcc-h*-UW#z#Wqytsx+qIY^acM_keE$VHl3 z=57h#kukmqrww>u6)m_hC30k5K}`T>ws;=Syui!W0$RzZ(PIK)qNoXo@8G5hkoK=? z0@TYy^g{;V*?6KlZXC+OB9%CHoM1jpFFFyx;yn`1zd1XD%=)y9cUOlhaY z!TU)z>UKBlcfz_jw6mZOv^3=Y8ohl)?#HM`hH*T_?BjM-FY%ryJWKg?bdldjmU!De zL68h4FNzJjR9$lcMVlV6eB887@8omT-&py;)c*L@FW_NZLB_ZPJNi7e;~eZLFQIlq z%w)p}G2g-sD8U42!8ZMP4q=+diyPQo1xvlh`X@CT+GGcCu}y>o@&WN6NV}sTed-4I zx#h_-~9fKj*-uN{zp3BI+=RT;&n&|5oZe%j)cR@s9U?-AXL(it`mf=;zrwqOW-pb&nd72g-Mkn4S^C8 z(y#=ABU;LH+F(~>k$V;v<*eKM%e9nKFgPCjlJzH(b{Rhj@FSUAjUL z97q@oVg)v$dI)~!0~`btB)^d|j>>BA3E0F{0cu?c3m12ub|7kS1kfHtjo<%+&fMqn zw9X83h%Q;}>nvhR0Ev+w;h8J$eP_jUX^rC=Y=agyse-M$~V&HuUj7>F8R8E zz5spa0^(A6Gr-7;qsWxi1v8tHnN2C34Pq7gAXXLe{ux~$7aB#aU|7-l)~qfXne!23 z&ONx6H=I-R)Jl6mU*^A)IU`EDj_Vazpt>MW;3A)-jJPJXJw?6rm|(y7+T|(1Lk^Ux z9^bWK8Y=q!|usp(W?z1s`pZD(q z#dLD;@M4dl`IeX$jv~Hhqlz4;>7TQjIPduX}*|V|2gIbqV_A z0gh35iVs^4;Ex{~e>|=poA_hlOZnrc;(0cm&`xXn!m-P zm}KZQ6+@hXkW(tABLz|M0t8#YDi405p)iyq%MIp%@7E_cfVm-9bLeh(B$?SFY>^BspUwFnU+n|T#Iw8GN9E+j>EL{tdI|3mf(bWQS0#7F>_;w z3aFHC$WCT+Y+`E+AnrmSt~y z)|xj>8n@g${W8FCq#yxNh|k3+ID8S(w3{{+JSs~vM@Y-0Zi&JL)9f@?L!a903qNe{ zJyotbwU%X=78-|W-f(SIswFyL-_}?5yxO*5$4oH;MYA9)kT+Gi0R?j-Yfiz!qWO>| JSTX1v`~YT$WxD_X delta 368 zcmW+xJxc>Y5S^LbTP3**A%}!Wh(Tj;g`1VUXK~Mlb)%@-JQ+$-R#DnCgt1ef1!H{4^ z<3mFuFgU>h=o5p6YG9y`1En_%CA1A0-78k8FI+bfFO&%*aybPf`rZ|t0y4|hbnZNZ zL^>sbV~D&1jXdYqLDayRxVudw(r$@4L<=)9?A>U^g58y^Q0gMnnH=@TBVBj4hJBK2 zVVNnQ#1h{Em9dPz{gFqTf@SwP1{1O!Z#fXU!bUfE ztV8?i)v#&by}jlttJ-IXaK42OoNY0VyO+aZ9Ix1lYAZKGuiGzGwa;n^i*~B^{{eY= BNL~N{ diff --git a/cmp/parsing/__pycache__/parsing.cpython-37.pyc b/cmp/parsing/__pycache__/parsing.cpython-37.pyc index 67a195d2352d3de447bac0b3db853eaa884ae946..8623138ecf060e50314fccbef66c15c7901a9604 100644 GIT binary patch literal 5031 zcmbVQTaO$^6|U;r^z>YIY_FZQ<2Zu}4g+B~4j@9bSa$4=ZHW*r%)_AICJu^Mi zyVbp6chrMICMXf&V&wslqDbDiz+)Z}KOj#CiMM{p3orODSV-`l>bcpTgoqy1{Z!Sd zbG~!x)Vx|MISk)FuKn?+?;m39pVXLq1}bNfqPLI=)54iKQE?R(Sv}SWQcf#!eij#zudq_kd?zhwkjO1K|bov`2%zMjZCj!{g3| z4CcDAK)D(AwsvCQYqez*N9oeE9R@-8v#3cMO+MP;EK+nFna^Ab@~zuBmcM zXkbuJ%U7?T5Bsg4-HdPUZTW-mIaPebXtfo}YOf)?)%dPojWJjaTh%~*qt)oOgS~2V zJgvIbkdZIdym~E{+Md^M^nA}t9nb59Vke+_(et)<8o_uZ=XoM*dY;t4VOqTIi=C#Q zK40t%Hq{O;P_u;;IJ1OH85u3eMip5KhaXzkiwd^hZ`HN!AiYxcI* zh@W)rBq$l!h=NHY;^zVrvrS z=%bR>IFA$^L6-1@c`VV8^F&9k35MCc4!N6A+=%_uiuQVU!XP!9B>kF^8j&BgBw)?t zGBVd}lH_MnkO$C9GH&RGI+YoMD)xX_>?-8BUi1$9}%5;>GGW06N`3r7@C=0#DIP&%S4mQWT%MI1m` z6bGT8L+ODz3|>?4PR$#aF28m&wXSbm_`&&&RD0v~CMlafDs?2K_&zFQ#q;}I@O=V- z7DN3VZA5h=HmQzej0hT5!tUqxp##ruQ=S);JE~q#c@Y$){Y+1eU|m~w&{L)!r7^93 zv$mA-i*DuI&SuZ=$G*5I8$H-=T4+pqyo-`7Ahj|NB5gF>Tq|=QX~oMt&&(C&XH`dG z)f4a$sXa0K)M_;2Hhh+`8N#o@k)>1fxbrADX*=MQNhvCAlHJEq3Ke8X?c)7B5Gc|GgahJ=fWi@Zw6@u5s0G#c2V6knxSob>%(jZ?+@Y zx_pi%>l<&pCdq}S1uqE0ZsV@s5RrVE#+;m_d+mNBkjFqL zzk;mh%%Mdw%-gBa4}~vlw7Ss-b7_9MMdmMYlFsAUItB7Iq=@)aj#4`aM3sRk!WnA( zgjV4vfwMAN$F;$!1vtwLaNyix{S|}7xvnGs!r@2AlMJ07v%dBt z)HZo+C;1T<=2L8$4GX*1<9zI7JtMM=vske>EG63g0zB7TuEQA)jbVAXl$4V~QY^4_ zmXwmE4(n>sr#PoYr`rDX7E8#J<-y;#5+^B)cpsNzQV<;U6KSzd5oZUM!EpuGs7>QX zSyIVPJ3eJeopOL#xudvVjU;7tQUN&E7vw1_P!(usVL>RaKKGK$Qw@*BHN ze~VVH9Z*J+T8e>4g%!=NYc+Rd6w2%xe+g@4T64_A-&`jV_f z*^zva7%6SB8b!eVEri=j=UPuj-oo zC^2SKU0r?@>+iA_E@i}Yc1-4|<_jkDU!ryaYmK-RvDvYPX5T`Y8=5c$O&EZkCQRh! zNPmwm^x15T(T-kzt`C%|j|}Yu46Oh|`y?~8M8C^v=XEwQH;O3h(q&RPv(< zyS)s1gFi_)7KJ5IthPN3Cb{yhh$*$z7c)I`?~$;L6!tK`zUlY<-7R@$hZZJa8*H$; zz|l?I`RaNQLJiTG)#+6EZA?>!q^zY@l&_#8)f+;{FK4wNNR0s3fr_tXndm8)Q!$)t z!Eko`)8q1`)PCLHQ>d?58IH{?ZqU2_UTP}hl=meCnaZh8j-^6|ucJ3a%0dR9tO!gU z5IH1^H;B* zru)U0k7$q_pVA;P0w;z@fzT%SZ|L2w)nN$~F4uHvqR65;)$!Si{2d4ie1C4=!*l!2R#@;vtYXq<>*P8{e@n}fm~i3fl6n^FfF8QD zC*tHa4@E#pDb*1 zN$q;AoEj9`t3OwyjxKldm}^8CT!`z`+=<&kq+W&UHJEwqgBVhXRw7j^F4{V^*R%h2 W&XA2qx~jUTr{}}7904jFS!e8DsW5#EWVVr#AA$rd;1TO_ zkM}fB<1EkuJ<@xIXY@?Z>{*_r>Wrw=vpu`#cn)W;v%n0jZ?eD&wXyEGD3<~oWqYi7 zWt5!2MafmI6_m?C1?37_mrz;?swh=as-m^4$z9wcNQ516L~ z+|xs2%sf+3E6^}&T~_bjyAk(yqE0(~a5xB$UUlnuX!iA;Sk!whu~$zYhxHVV^?0Y= zsz>6|POI064(o%KNJ61LXf{gH_WgdV7y7<*eZLn62NC5fzQ2FaiY6^3-w)!p?+Xo6 zla+g6aL^8OD$DmDcXrae@K;Q%pobz)zjXO=+zT)7Md7=lxcsJw55smECzszmOdrSn z%k4OhF1LGw%QT-(e|P%c8XO8zzY=(^tn>wA`uR!}I^YlOu47`oN z#C}=Qo$XhfG?*TG6OS86$p%QqGv>2Q1Lc_xss#*R^CmXjOwv{wN-H_+J&Ge~wrSfN zhBT5e+7avcTATqv18waamSpjxwb{J3rhVF^2=vgK60JI+ zAu`rwzl|!qIlZUT(`FNBaPb0qE}B3Z3g4$mCTa(`{mk&HN3&syGO?%-St7DY)s|aR76&8D-+D= z!galf?`YBUN=S7lR`#O{^GnaN9u ziUj#G(n%F8X7&G4!D8gaDya157ijD`?K?5@C)2(QVENLNt%zw8(#oTPaHvq)$wPv)+Y`qw*Zn-MOdO=2wjM>HG}Wu2W z>Jt^k;bvT3C1g2OCrvaT_*GduZ{;rH`0`ZPz*;l<3ztjyWbHrX-0c)~eLEviXNU3*MU)_KVG zUo%+h?z!TRIlLPDo4L!U-(6*Iqx~%;^t&+h;FzsV_A$7Z3+~4g?mzhu?#JMMOxz!` z%*Y*nMW~H^850J`1!?O|LE%Y|TWUAnSV${ANP!-up2h>Of=Utg(+4!V_(d@A)~1a8Ic?#|Db*nG(QZYN?|%&+ zC7%aT`k~p}fQFm{4sbOK)K-v0Q(9taE^1xAs-N^4IiqI7Ivr#cL?9&;ze;2lcT`RV zpUg&dxm~jBg6i5x#iJv)jg&k9nfYn}It^e>hkssI#|Q3N`LV$(0oK!zfqQm- zRPdbqkl?xb@xUwR2LrDXtU=xza%B#&=00AU_rHAS_5*3%yLIzxH*QJot8d(H(^Tl8 zH>Dd$NeVK-iToG}{$%R;$?sF%Na6FlWEh5u0~R7cNkss=Lvg@Salut6v#e?=iY}pF z^+^uy+<@)bVt|@us!@?cYd&byl&*NS>j%3%s6rULE?PZceOYczYy3R6h?g->6!)$URmG`uZqN0C!u;<4I#TPGdphl}mm*3R}>B3PwpopYvw4 zL35HX5XbMKJ|QGUdRM_;4G{_O7g|Su@KF5d+%qy+9HS^!DnVR<(JCJ_iBZF^q*?|M zz}BxJF6ko!t-83G8krvOKsz?`BSB_#t($BN!3E~nK&*kM@=J&|tZQfbRkpwJkPZJa z)4=EN!Ncg5M&|Gb`B(3JZ-m&@b;Lh|y4^BjVP#Jf--VzczHT)$QM0^5!mkBvM|+}k z*1s~$(7uvcPiSs+_`X^1lIpuk-16T0e+$nvKzR+G(Kueu?CzN-9CL7x+jx(Q+T7Rh zh#2Vwimo&gzRNkE#XP9Z$!o#!>ko4!vYJo1bELaYy*Ok{QB6WZQl}ttmOO=)kJTY# zzc>YPsVAwxu~yr?v<4 zjl1DaDhL-z#~0ylCjldIlgj$7uih5dC|CBQINobf#7)Gn6DPMB4vQeL8)CdBPRoMu zpSVio7RZU9t|rSn(&)!QDBeV~G&-1ubPC=ognO87_tYjT8~a0il2D}2{q!nqq>faD zosj(?$1i9#{u1n`3a@=$JG%JsHo0(Vcnf_8 z62lu>+r@$bc5$?(x`6#Y+Q-m4pt(|4Q@W_{S;N*q{PzaCUbp<`^oqqi(uPcyqwDejlsORRfwYBvD8R}7O+8s6# z3sg5&m6eGmTE#0wl&Ms&C%8N!7_9h8;G$t}2V^Y@@OW-3O-1Js?!6LOy*|yW{^BzA z`b{FgMC1w)vY_1joLj?oI3Vtgl{~QgGTLMbcIUU?dkEo*SBZR)2;GSYk4SFDX=_&y zz7Yg7q*F}8)04x#ct|aD|B(+kgD5Ic5p4NOq+}a}3=iN)GbXTTUHhEAPH+f;s{&wT zYZ^?iirgwci#}C;o}UAts`7QM!Z)M?z84XjdH#~7kAJ(moE2DTr4P|y@6IqJSV|s zYk?n}y7~nXM!ZAZ;rOV2w$1J zzo0Nbps~7uQ-EII3lF8KdP&|_7d6V^PgkNAaS!}{jFixg4TEM?phxHUMF1m9+W;It zt5x~Yi_ckFvCsK7Oc2sta2vivej9%6tUAj>y>Jfa1V_8b1MR?bsXpZU@;;DA(Fb|- z`TWG!&_$?{#msD{*AN|ybvl&YM%}+7C8XpGt2&Ex^yvlbm`9YwT1YIEDAuc+jFgSp zH~91#h0C>OoZjgTqA67QpLqzB> z-G{f4KfMnRQ1>55)4@NrVDJJNB+UlDP5(=$Pgn|UC?`uuCBKusNICLcf|N+mj*D#~ zH0Inq)OILk`!zJYi=^(8)d>)8&RwxzbT8Sfwq@&rdbE*>hc;jvNg3|!NOt=Aj4WQd z_wU}D-kZ^;(L-Idx!!d0Xg^WA2xcdyYW<7tK?FoGV6szB~#u zqET>En#h5B?raA?N(eul8~4oIxHAq5e!$qqM;|VOK3e~W*cLLNn#D3$N6WJ|fK4=H z`R?^%J}11`$KU-DxPPqO$HBGO{qu9Y$b6rmJ*@rtX;sX(vk5?RI|oKv&8tR_2$Y>U#7uR7YM$sk)%O lRzoeCleDkqKS^FA-BIV$nzqhsdd;quDOK-OM>V@<{~smac$WYG diff --git a/cmp/parsing/automatas.py b/cmp/parsing/automatas.py index 0c4fb7dcb..8151170e5 100644 --- a/cmp/parsing/automatas.py +++ b/cmp/parsing/automatas.py @@ -1,67 +1,10 @@ -from cmp.automata import State, multiline_formatter +from cmp.automata import State from cmp.pycompiler import Item from cmp.utils import ContainerSet from .utils import compute_firsts, compute_local_first -################ -# SLR AUTOMATA # -################ -def closure_lr0(items): - closure = ContainerSet(*items) - - pending = list(items) - while pending: - current = pending.pop() - symbol = current.NextSymbol - - if current.IsReduceItem or symbol.IsTerminal: - continue - - new_items = [Item(p, 0) for p in symbol.productions if Item(p, 0) not in closure] - pending += new_items - closure.extend(new_items) - return frozenset(closure) - - -def goto_lr0(items, symbol): - return frozenset(item.NextItem() for item in items if item.NextSymbol == symbol) - - -def build_lr0_automaton(G): - assert len(G.startSymbol.productions) == 1, 'Grammar must be augmented' - - start_production = G.startSymbol.productions[0] - start_item = Item(start_production, 0) - start = frozenset([start_item]) - - automaton = State(closure_lr0(start), True) - - pending = [start] - visited = {start: automaton} - - while pending: - current = pending.pop() - current_state = visited[current] - current_closure = current_state.state - for symbol in G.terminals + G.nonTerminals: - kernel = goto_lr0(current_closure, symbol) - - if kernel == frozenset(): - continue - - try: - next_state = visited[kernel] - except KeyError: - next_state = visited[kernel] = State(closure_lr0(kernel), True) - pending.append(kernel) - - current_state.add_transition(symbol.Name, next_state) - automaton.set_formatter(multiline_formatter) - return automaton - - ######################## # LR1 & LALR1 AUTOMATA # ######################## @@ -148,7 +91,6 @@ def build_lr1_automaton(G, firsts=None): pending.append(kernel) current_state.add_transition(symbol.Name, next_state) - automaton.set_formatter(multiline_formatter) return automaton @@ -205,5 +147,4 @@ def build_larl1_automaton(G, firsts=None): else: assert current_state.get(symbol.Name) is next_state, 'Bad build!!!' - automaton.set_formatter(multiline_formatter) return automaton diff --git a/cmp/parsing/parsing.py b/cmp/parsing/parsing.py index 3b9f26e8e..b1737a8ff 100755 --- a/cmp/parsing/parsing.py +++ b/cmp/parsing/parsing.py @@ -1,12 +1,12 @@ from enum import auto, Enum -from .automatas import build_lr0_automaton, build_lr1_automaton, build_larl1_automaton +from .automatas import build_lr1_automaton, build_larl1_automaton from .utils import compute_firsts, compute_follows class LRConflictType(Enum): """ - Enum for mark the type of lr-family parser + Enum for mark the type of lr-family conflict parser """ ReduceReduce = auto() ShiftReduce = auto() @@ -23,98 +23,6 @@ def __iter__(self): yield self.symbol -class LLConflictType(Enum): - """ - Enum for mark the type of ll parser - """ - FirstFirst = auto() - FollowFollow = auto() - - -class LLConflict: - def __init__(self, nonterminal, terminal, ctype): - self.nonterminal = nonterminal - self.terminal = terminal - self.cType = ctype - - def __iter__(self): - yield self.nonterminal - yield self.terminal - - -class LL1Parser: - def __init__(self, G): - self.G = G - self.firsts = compute_firsts(G) - self.follows = compute_follows(G, self.firsts) - self.conflict = None - self.table = self._build_parsing_table() - - def _build_parsing_table(self): - G = self.G - firsts = self.firsts - follows = self.follows - parsing_table = {} - - # P: X -> alpha - for production in G.Productions: - head, body = production - - contains_epsilon = firsts[body].contains_epsilon - - # working with symbols on First(alpha) ... - if not contains_epsilon: - for symbol in firsts[body]: - try: - parsing_table[head, symbol].append(production) - self.conflict = LLConflict(head, symbol, LLConflictType.FirstFirst) - except KeyError: - parsing_table[head, symbol] = [production] - # working with epsilon... - else: - for symbol in follows[head]: - try: - parsing_table[head, symbol].append(production) - self.conflict = LLConflict(head, symbol, LLConflictType.FollowFollow) - except KeyError: - parsing_table[head, symbol] = [production] - - # parsing table is ready!!! - return parsing_table - - def __call__(self, tokens): - G = self.G - table = self.table - - stack = [G.startSymbol] - cursor = 0 - output = [] - - # parsing w... - while len(stack) > 0 and cursor < len(tokens): - top = stack.pop() - currentToken = tokens[cursor].token_type - # print((top, currentToken)) - if top.IsTerminal: - cursor += 1 - if currentToken != top: - return None - elif top.IsNonTerminal: - try: - production = table[top, currentToken][0] - except KeyError: - return None - - output.append(production) - reversed_production = reversed(production.Right) - - for s in reversed_production: - stack.append(s) - - # left parse is ready!!! - return output - - class ShiftReduceParser: SHIFT = 'SHIFT' REDUCE = 'REDUCE' @@ -231,14 +139,6 @@ def _lookaheads(self, item): raise NotImplementedError() -class SLR1Parser(ShiftReduceParser): - def _build_automaton(self): - return build_lr0_automaton(self.augmented_G) - - def _lookaheads(self, item): - return self.follows[item.production.Left] - - class LR1Parser(ShiftReduceParser): def _build_automaton(self): return build_lr1_automaton(self.augmented_G, firsts=self.firsts) diff --git a/cmp/pycompiler.py b/cmp/pycompiler.py index 4f4de826d..a346d9c40 100755 --- a/cmp/pycompiler.py +++ b/cmp/pycompiler.py @@ -1,5 +1,5 @@ import json -from typing import List, FrozenSet, Optional, Union +from typing import List, FrozenSet, Optional, Union, Tuple, Iterable ProductionList = List[Union['Production', 'AttributeProduction']] @@ -7,16 +7,16 @@ class Symbol: def __init__(self, name: str, grammar: 'Grammar'): - self.Name: str = name - self.Grammar: 'Grammar' = grammar + self.name: str = name + self.grammar: 'Grammar' = grammar def __str__(self): - return self.Name + return self.name def __repr__(self): - return repr(self.Name) + return repr(self.name) - def __add__(self, other: 'Symbol'): + def __add__(self, other): if isinstance(other, Symbol): return Sentence(self, other) @@ -46,20 +46,20 @@ def __init__(self, name, grammar): def __imod__(self, other): if isinstance(other, str): if other: - p = Production(self, Sentence(*(self.Grammar[s] for s in other.split()))) + p = Production(self, Sentence(*(self.grammar[s] for s in other.split()))) else: - p = Production(self, self.Grammar.Epsilon) - self.Grammar.AddProduction(p) + p = Production(self, self.grammar.Epsilon) + self.grammar.add_production(p) return self if isinstance(other, Symbol): p = Production(self, Sentence(other)) - self.Grammar.AddProduction(p) + self.grammar.add_production(p) return self if isinstance(other, Sentence): p = Production(self, other) - self.Grammar.AddProduction(p) + self.grammar.add_production(p) return self if isinstance(other, tuple): @@ -67,9 +67,9 @@ def __imod__(self, other): if isinstance(other[0], str): if other[0]: - other = (Sentence(*(self.Grammar[s] for s in other[0].split())),) + other[1:] + other = (Sentence(*(self.grammar[s] for s in other[0].split())),) + other[1:] else: - other = (self.Grammar.Epsilon,) + other[1:] + other = (self.grammar.Epsilon,) + other[1:] if len(other) == 2: other += (None,) * len(other[0]) @@ -82,14 +82,14 @@ def __imod__(self, other): else: raise Exception("") - self.Grammar.AddProduction(p) + self.grammar.add_production(p) return self if isinstance(other, SentenceList): for s in other: p = Production(self, s) - self.Grammar.AddProduction(p) + self.grammar.add_production(p) return self @@ -132,24 +132,23 @@ def __init__(self, G): class Sentence: - def __init__(self, *args): - self._symbols = tuple(x for x in args if not x.IsEpsilon) - self.hash = hash(self._symbols) + self.symbols = tuple(x for x in args if not x.IsEpsilon) + self.hash = hash(self.symbols) def __len__(self): - return len(self._symbols) + return len(self.symbols) - def __add__(self, other): + def __add__(self, other) -> 'Sentence': if isinstance(other, Symbol): - return Sentence(*(self._symbols + (other,))) + return Sentence(*(self.symbols + (other,))) if isinstance(other, Sentence): - return Sentence(*(self._symbols + other._symbols)) + return Sentence(*(self.symbols + other.symbols)) raise TypeError(other) - def __or__(self, other): + def __or__(self, other) -> 'SentenceList': if isinstance(other, Sentence): return SentenceList(self, other) @@ -162,19 +161,16 @@ def __repr__(self): return str(self) def __str__(self): - return ("%s " * len(self._symbols) % tuple(self._symbols)).strip() + return ("%s " * len(self.symbols) % tuple(self.symbols)).strip() def __iter__(self): - return iter(self._symbols) + return iter(self.symbols) def __getitem__(self, index): - return self._symbols[index] + return self.symbols[index] - def __eq__(self, other): - """ - :type other: Sentence - """ - return self._symbols == other._symbols + def __eq__(self, other) -> bool: + return self.symbols == other.symbols def __hash__(self): return self.hash @@ -294,8 +290,8 @@ def synthesize(self): class Grammar: def __init__(self): - self.Productions: ProductionList = [] - self.nonTerminals: List[NonTerminal] = [] + self.productions: ProductionList = [] + self.non_terminals: List[NonTerminal] = [] self.terminals: List[Terminal] = [] self.startSymbol: NonTerminal = None self.pType: type = None # production type @@ -304,8 +300,7 @@ def __init__(self): self.symbDict = {'$': self.EOF} - def NonTerminal(self, name: str, startSymbol: bool = False): - + def add_non_terminal(self, name: str, startSymbol: bool = False) -> NonTerminal: name = name.strip() if not name: raise Exception("Empty name") @@ -319,28 +314,23 @@ def NonTerminal(self, name: str, startSymbol: bool = False): else: raise Exception("Cannot define more than one start symbol.") - self.nonTerminals.append(term) + self.non_terminals.append(term) self.symbDict[name] = term return term - def NonTerminals(self, names: str): - - ans = tuple((self.NonTerminal(x) for x in names.strip().split())) + def add_non_terminals(self, names: str) -> Tuple[NonTerminal, ...]: + return tuple((self.add_non_terminal(x) for x in names.strip().split())) - return ans - - def AddProduction(self, production: Production): - - if len(self.Productions) == 0: + def add_production(self, production: Production): + if len(self.productions) == 0: self.pType = type(production) assert type(production) == self.pType, "The Productions most be of only 1 type." production.Left.productions.append(production) - self.Productions.append(production) - - def Terminal(self, name: str) -> Terminal: + self.productions.append(production) + def add_terminal(self, name: str) -> Terminal: name = name.strip() if not name: raise Exception("Empty name") @@ -350,11 +340,8 @@ def Terminal(self, name: str) -> Terminal: self.symbDict[name] = term return term - def Terminals(self, names: str): - - ans = tuple((self.Terminal(x) for x in names.strip().split())) - - return ans + def add_terminals(self, names: str) -> Tuple[Terminal, ...]: + return tuple(self.add_terminal(x) for x in names.strip().split()) def __str__(self): @@ -362,9 +349,9 @@ def __str__(self): ans = 'Non-Terminals:\n\t' - nonterminals = mul * (len(self.nonTerminals) - 1) + '%s\n' + nonterminals = mul * (len(self.non_terminals) - 1) + '%s\n' - ans += nonterminals % tuple(self.nonTerminals) + ans += nonterminals % tuple(self.non_terminals) ans += 'Terminals:\n\t' @@ -374,7 +361,7 @@ def __str__(self): ans += 'Productions:\n\t' - ans += str(self.Productions) + ans += str(self.productions) return ans @@ -389,8 +376,8 @@ def to_json(self): productions = [] - for p in self.Productions: - head = p.Left.Name + for p in self.productions: + head = p.Left.name body = [] @@ -399,8 +386,8 @@ def to_json(self): productions.append({'Head': head, 'Body': body}) - d = {'NonTerminals': [symb.Name for symb in self.nonTerminals], - 'Terminals': [symb.Name for symb in self.terminals], + d = {'NonTerminals': [symb.name for symb in self.non_terminals], + 'Terminals': [symb.name for symb in self.terminals], 'Productions': productions} # [{'Head':p.Left.Name, "Body": [s.Name for s in p.Right]} for p in self.Productions] @@ -414,10 +401,10 @@ def from_json(data): dic = {'epsilon': G.Epsilon} for term in data['Terminals']: - dic[term] = G.Terminal(term) + dic[term] = G.add_terminal(term) for noTerm in data['NonTerminals']: - dic[noTerm] = G.NonTerminal(noTerm) + dic[noTerm] = G.add_non_terminal(noTerm) for p in data['Productions']: head = p['Head'] @@ -427,8 +414,8 @@ def from_json(data): def copy(self): G = Grammar() - G.Productions = self.Productions.copy() - G.nonTerminals = self.nonTerminals.copy() + G.productions = self.productions.copy() + G.non_terminals = self.non_terminals.copy() G.terminals = self.terminals.copy() G.pType = self.pType G.startSymbol = self.startSymbol @@ -441,7 +428,7 @@ def copy(self): @property def IsAugmentedGrammar(self): augmented = 0 - for left, _ in self.Productions: + for left, _ in self.productions: if self.startSymbol == left: augmented += 1 if augmented <= 1: @@ -456,7 +443,7 @@ def AugmentedGrammar(self, force=False): # S, self.startSymbol, SS = self.startSymbol, None, self.NonTerminal('S\'', True) S = G.startSymbol G.startSymbol = None - SS = G.NonTerminal('S\'', True) + SS = G.add_non_terminal('S\'', True) if G.pType is AttributeProduction: SS %= S + G.Epsilon, lambda x: x else: @@ -469,8 +456,7 @@ def AugmentedGrammar(self, force=False): class Item: - - def __init__(self, production: Production, pos: int, lookaheads: List[Symbol] = None): + def __init__(self, production: Production, pos: int, lookaheads: Iterable[Symbol] = None): if lookaheads is None: lookaheads = [] self.production: Production = production diff --git a/cmp/semantic.py b/cmp/semantic.py index 9f8993fe1..118ec1fd0 100755 --- a/cmp/semantic.py +++ b/cmp/semantic.py @@ -1,5 +1,6 @@ -import itertools as itt +import itertools from collections import OrderedDict +from typing import List class SemanticError(Exception): @@ -40,8 +41,8 @@ def __eq__(self, other): class Type: def __init__(self, name: str): self.name = name - self.attributes = [] - self.methods = [] + self.attributes: List[Attribute] = [] + self.methods: List[Method] = [] self.parent = None def set_parent(self, parent): @@ -210,7 +211,7 @@ def define_variable(self, vname, vtype): return info def find_variable(self, vname, index=None): - _locals = self.locals if index is None else itt.islice(self.locals, index) + _locals = self.locals if index is None else itertools.islice(self.locals, index) try: return next(x for x in _locals if x.name == vname) except StopIteration: diff --git a/cmp/utils.py b/cmp/utils.py index db2c149ed..262095232 100755 --- a/cmp/utils.py +++ b/cmp/utils.py @@ -1,3 +1,63 @@ +class ContainerSet: + def __init__(self, *values, contains_epsilon=False): + self.set = set(values) + self.contains_epsilon = contains_epsilon + + def add(self, value): + n = len(self.set) + self.set.add(value) + return n != len(self.set) + + def extend(self, values): + change = False + for value in values: + change |= self.add(value) + return change + + def set_epsilon(self, value=True): + last = self.contains_epsilon + self.contains_epsilon = value + return last != self.contains_epsilon + + def update(self, other): + n = len(self.set) + self.set.update(other.set) + return n != len(self.set) + + def epsilon_update(self, other): + return self.set_epsilon(self.contains_epsilon | other.contains_epsilon) + + def hard_update(self, other): + return self.update(other) | self.epsilon_update(other) + + def find_match(self, match): + for item in self.set: + if item == match: + return item + return None + + def __len__(self): + return len(self.set) + int(self.contains_epsilon) + + def __str__(self): + return '%s-%s' % (str(self.set), self.contains_epsilon) + + def __repr__(self): + return str(self) + + def __iter__(self): + return iter(self.set) + + def __nonzero__(self): + return len(self) > 0 + + def __eq__(self, other): + if isinstance(other, set): + return self.set == other + return isinstance(other, + ContainerSet) and self.set == other.set and self.contains_epsilon == other.contains_epsilon + + class Token: """ A Token class. diff --git a/definitions.py b/definitions.py index 0c579321c..1291d3734 100644 --- a/definitions.py +++ b/definitions.py @@ -9,95 +9,95 @@ ################# # Non-Terminals # ################# -program = G.NonTerminal('program', startSymbol=True) -class_set = G.NonTerminal('class-set') -class_def = G.NonTerminal('class-def') -feature_list = G.NonTerminal('feature-list') -attribute = G.NonTerminal('attribute') -method = G.NonTerminal('method') -param_list = G.NonTerminal('param-list') -block = G.NonTerminal('block') -declaration_list = G.NonTerminal('declaration-list') -case_list = G.NonTerminal('case-list') -function_call = G.NonTerminal('function-call') -expr_list = G.NonTerminal('expr-list') -expr = G.NonTerminal('expr') -comp = G.NonTerminal('comp') -arith = G.NonTerminal('arith') -term = G.NonTerminal('term') -factor = G.NonTerminal('factor') -atom = G.NonTerminal('atom') +program = G.add_non_terminal('program', startSymbol=True) +class_set = G.add_non_terminal('class-set') +class_def = G.add_non_terminal('class-def') +feature_list = G.add_non_terminal('feature-list') +attribute = G.add_non_terminal('attribute') +method = G.add_non_terminal('method') +param_list = G.add_non_terminal('param-list') +block = G.add_non_terminal('block') +declaration_list = G.add_non_terminal('declaration-list') +case_list = G.add_non_terminal('case-list') +function_call = G.add_non_terminal('function-call') +expr_list = G.add_non_terminal('expr-list') +expr = G.add_non_terminal('expr') +comp = G.add_non_terminal('comp') +arith = G.add_non_terminal('arith') +term = G.add_non_terminal('term') +factor = G.add_non_terminal('factor') +atom = G.add_non_terminal('atom') ############### # identifiers # ############### -G.Terminal('id') -G.Terminal('type') +G.add_terminal('id') +G.add_terminal('type') ############### # Basic Types # ############### -G.Terminal('string') -G.Terminal('integer') -G.Terminal('boolean') +G.add_terminal('string') +G.add_terminal('integer') +G.add_terminal('boolean') ########### # Symbols # ########### -G.Terminal('{') -G.Terminal('}') -G.Terminal('(') -G.Terminal(')') -G.Terminal(',') -G.Terminal('.') -G.Terminal('@') -G.Terminal(':') -G.Terminal(';') -G.Terminal('<-') -G.Terminal('=>') +G.add_terminal('{') +G.add_terminal('}') +G.add_terminal('(') +G.add_terminal(')') +G.add_terminal(',') +G.add_terminal('.') +G.add_terminal('@') +G.add_terminal(':') +G.add_terminal(';') +G.add_terminal('<-') +G.add_terminal('=>') ############ # Keywords # ############ -G.Terminal('class') -G.Terminal('inherits') -G.Terminal('if') -G.Terminal('then') -G.Terminal('else') -G.Terminal('fi') -G.Terminal('while') -G.Terminal('loop') -G.Terminal('pool') -G.Terminal('let') -G.Terminal('in') -G.Terminal('case') -G.Terminal('esac') -G.Terminal('of') -G.Terminal('new') -G.Terminal('isvoid') -G.Terminal('true') -G.Terminal('false') -G.Terminal('end') +G.add_terminal('class') +G.add_terminal('inherits') +G.add_terminal('if') +G.add_terminal('then') +G.add_terminal('else') +G.add_terminal('fi') +G.add_terminal('while') +G.add_terminal('loop') +G.add_terminal('pool') +G.add_terminal('let') +G.add_terminal('in') +G.add_terminal('case') +G.add_terminal('esac') +G.add_terminal('of') +G.add_terminal('new') +G.add_terminal('isvoid') +G.add_terminal('true') +G.add_terminal('false') +G.add_terminal('end') ############# # Operators # ############# -G.Terminal('+') -G.Terminal('-') -G.Terminal('*') -G.Terminal('/') -G.Terminal('<') -G.Terminal('<=') -G.Terminal('=') -G.Terminal('~') -G.Terminal('not') +G.add_terminal('+') +G.add_terminal('-') +G.add_terminal('*') +G.add_terminal('/') +G.add_terminal('<') +G.add_terminal('<=') +G.add_terminal('=') +G.add_terminal('~') +G.add_terminal('not') ############ # Specials # ############ -G.Terminal('tab') -G.Terminal('space') -G.Terminal('newline') +G.add_terminal('tab') +G.add_terminal('space') +G.add_terminal('newline') ############### # Productions # diff --git a/main.py b/main.py index 28263efbd..f5f94e5ef 100644 --- a/main.py +++ b/main.py @@ -1,9 +1,12 @@ import time + +from lexer import CoolLexer from parser import CoolParser from definitions import cool_grammar if __name__ == '__main__': - G = cool_grammar() t = time.time() + G = cool_grammar() parser = CoolParser(G) + lexer = CoolLexer(G) print(time.time() - t) diff --git a/semantic.py b/semantic.py index 0b7c507a3..3fe2cf54a 100644 --- a/semantic.py +++ b/semantic.py @@ -1,5 +1,6 @@ import cmp.visitor as visitor from astnodes import ProgramNode +from cmp.semantic import Scope class SemanticChecker: @@ -11,5 +12,5 @@ def visit(self, node, scope): pass @visitor.when(ProgramNode) - def visit(self, node: ProgramNode, scope=None): + def visit(self, node: ProgramNode, scope: Scope = None): pass diff --git a/tests.py b/tests.py index 38600485d..98ac177e7 100644 --- a/tests.py +++ b/tests.py @@ -17,6 +17,8 @@ class Tester: def tokenize(script: str, print_tokens: bool = True) -> List[Token]: """ Method for tokenize a cool program + :param script: string with the name of the program + :param print_tokens: if true tokens will be printing with the program format """ file = f'scripts/{script}' program = ''.join(open(file, 'r').read()) @@ -30,11 +32,10 @@ def tokenize(script: str, print_tokens: bool = True) -> List[Token]: return tokens @staticmethod - def parse(script): + def parse(script: str): """ Method for parse a cool program and return an ast - :param script: - :return: + :param script: string with the name of the program """ tokens = Tester.tokenize(script, print_tokens=False) ast = parser(tokens) From b492162a557cc4bf59d2b12ef08139e0491dd882 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Thu, 16 Apr 2020 10:30:09 -0400 Subject: [PATCH 009/143] preparing cmp module for erro detection --- cmp/parsing/conflict/__init__.py | 2 - cmp/parsing/conflict/llconflict.py | 142 --------------------- cmp/parsing/conflict/lrconflict.py | 195 ----------------------------- cmp/parsing/parsing.py | 21 ---- 4 files changed, 360 deletions(-) delete mode 100644 cmp/parsing/conflict/__init__.py delete mode 100644 cmp/parsing/conflict/llconflict.py delete mode 100644 cmp/parsing/conflict/lrconflict.py diff --git a/cmp/parsing/conflict/__init__.py b/cmp/parsing/conflict/__init__.py deleted file mode 100644 index 3bad9d509..000000000 --- a/cmp/parsing/conflict/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from .llconflict import LLConflictStringGenerator -from .lrconflict import LRConflictStringGenerator diff --git a/cmp/parsing/conflict/llconflict.py b/cmp/parsing/conflict/llconflict.py deleted file mode 100644 index e696f086d..000000000 --- a/cmp/parsing/conflict/llconflict.py +++ /dev/null @@ -1,142 +0,0 @@ -from collections import deque - -from cmp.pycompiler import Sentence, Production - - -def compute_sentence(G): - """ - For each non terminal 'X' in the Grammar G compute a sentence of terminals 'S' where X ->* S - """ - sentence = {t: Sentence(t) for t in G.terminals} - - change = True - while change: - n = len(sentence) - for production in G.Productions: - head, body = production - - if head in sentence: - continue - - if body.IsEpsilon or all(symbol in sentence for symbol in body): - sentence[head] = Sentence(*[sentence[symbol] for symbol in body]) - - change = n != len(sentence) - - return sentence - - -def compute_fixxed_sentence(G, t, sentence_forms): - """ - For each non terminal 'X' in the Grammar G compute a sentence of terminals that start with t 'tS' - where X ->* tS - """ - fixxed_sentence = {t: Sentence(t)} - - change = True - while change: - n = len(fixxed_sentence) - for production in G.Productions: - head, body = production - - if head in fixxed_sentence: - continue - - if not body.IsEpsilon and body[0] in fixxed_sentence: - fixxed_sentence[head] = Sentence( - *([fixxed_sentence[body[0]]] + [sentence_forms[symbol] for symbol in body[1:]])) - - change = n != len(fixxed_sentence) - - return fixxed_sentence - - -def shortest_production_path(G, x): - """ - Compute the shortest poduction path from start symbol of - Grammar G to a sentence form thad Contains the Non Temrinal X - """ - queue = deque([x]) - sentence_form = {x: Sentence(x)} - production_path = {x: [Production(x, Sentence(x))]} # Eliminar esta linea de testeo - - productions = set(G.Productions) - while queue: - current = queue.popleft() - - visited_productions = set() - for production in productions: - - head, body = production - - if head in sentence_form: - continue - - sentence = Sentence() - current_belong = False - for i, symbol in enumerate(body): - if symbol == current: - current_belong = True - sentence += sentence_form[current] - else: - sentence += symbol - - if current_belong: - queue.append(head) - sentence_form[head] = sentence - production_path[head] = [production] + production_path[current] - visited_productions.add(production) - - productions -= visited_productions - - assert G.startSymbol in sentence_form, f'{x} is not reacheable from start symbol {G.startSymbol}' - - return sentence_form[G.startSymbol], production_path[G.startSymbol][:-1] - - -class LLConflictStringGenerator: - def __init__(self, parser): - assert parser.conflict is not None, 'Expected parser with conflict...' - self.G = parser.G - self.table = parser.table - self.conflict = parser.conflict - self.prod1 = None - self.prod2 = None - self.s1, self.s2 = self.__generate_conflict() - - def __generate_conflict(self): - G = self.G - x = self.conflict.nonterminal - s = self.conflict.terminal - table = self.table - - conflict1, conflict2 = table[x, s][0], table[x, s][1] - sentence, _ = shortest_production_path(G, x) - sentence_forms = compute_sentence(G) - sentence_forms_fixxed = compute_fixxed_sentence(G, s, sentence_forms) - - i = tuple(sentence).index(x) - - x1 = conflict1.Right[0] - x2 = conflict2.Right[0] - - s1 = Sentence(*(sentence[:i] + tuple(conflict1.Right) + sentence[i + 1:])) - s2 = Sentence(*(sentence[:i] + tuple(conflict2.Right) + sentence[i + 1:])) - - ss1 = Sentence() - for symbol in s1: - if symbol == x1: - ss1 += sentence_forms_fixxed[symbol] - else: - ss1 += sentence_forms[symbol] - - ss2 = Sentence() - for symbol in s2: - if symbol == x2: - ss2 += sentence_forms_fixxed[symbol] - else: - ss2 += sentence_forms[symbol] - - self.prod1 = conflict1 - self.prod2 = conflict2 - return ss1, ss2 diff --git a/cmp/parsing/conflict/lrconflict.py b/cmp/parsing/conflict/lrconflict.py deleted file mode 100644 index d8d985056..000000000 --- a/cmp/parsing/conflict/lrconflict.py +++ /dev/null @@ -1,195 +0,0 @@ -from collections import deque - -from cmp.automata import State -from cmp.pycompiler import Sentence - - -def path_from(s): - """ - Compute path from s to all reacheables states in the automaton from s using a BFS algorithm - Return a dictionary of parents 'p' where p[some_state] has a tuple where it first item is - the parent state and the second item is the symbol of the transition from 'parent_state' to - 'some_state', and if a State s is not reacheable from 's' it doesn't belong to the - returned dictionary. By default the parent of 's' is None. - - The next code can recover the path form s to other reacheable state - - >>> parents = path_from(source) - >>> path = [dest] - >>> s = dest - >>> while parents[s] is not None: - >>> s, symbol = parents[s] - >>> path += [symbol, s] - >>> path.reverse() - >>> return path - - :param s: instance from class State representing the node from where start searching. - - :return: Dict[some_state, Tuple[parent_state, transition_symbol]] where some state is reacheable from state - """ - queue = deque([s]) - - parents = {s: None} - visited = set() - - while queue: - current = queue.popleft() - - if current in visited: - continue - - visited.add(current) - - for symbol in current.transitions: - dest = current.get(symbol) - queue.append(dest) - parents[dest] = current, symbol - - return parents - - -def path_from_to(source, dest): - """ - Compute the path in the automaton from state 'source' to state 'dest'. - - :param source: state representing the begining of the path - - :param dest: state representing the end of the path - - :return: a list following the secuence - 'source state' -> 'transition symbol' -> 'state' -> ... -> 'transition symbol' -> 'dest state' - """ - parents = path_from(source) - - path = [dest] - s = dest - while parents[s] is not None: - s, symbol = parents[s] - path += [symbol, s] - path.reverse() - return path - - -def guided_path(s, guide_sentence): - """ - Compute a path in the autoamta that follows thre secuence - 's' -> 'guide_sentence[0]' -> 'state' -> ... -> 'guide_sentence[-1]' - - :param s: Begining of the path - - :param guide_sentence: Sentence with the symbols for the transitions from state 's' consuming these symbols - - :return: Path from state 's' consuming the symbols of 'guide' - """ - path = [] - node = s - for symbol in guide_sentence: - path += [node, symbol] - node = node.get(symbol.Name) - path.append(node) - - return path - - -def reduce(s, p, state_list, lookahead): - """ - Make a backtrack in the automata from state 's' reducing the production 'p' - - :param s: state from reduce - - :param p: production to reduce - - :param state_list: list with all states in the automata - - :param lookahead: the last symbol to append at the path - - :return: a list following the secuence - 's' -> 'transition symbol' -> 'state' -> ... -> 'transition symbol' -> 'dest state' -> 'lookahead' - """ - states = {s} - stack = list(p.Right) - - while stack: - symbol = stack.pop() - - next_states = set() - for s in state_list: - if s.has_transition(symbol.Name) and s.get(symbol.Name) in states: - next_states.add(s) - states = next_states - reduced_state = states.pop() - - path = guided_path(reduced_state, p.Right) - path.append(lookahead) - return path - - -def sentence_path(init, conflict_state, symbol, p): - """ - Computes the path from init automaton state to 'conflict_state' passing - through state reduced from 'conflict_state' by production 'p' - """ - states = [s for s in init] - rpath = reduce(conflict_state, p, states, symbol) - lpath = path_from_to(init, rpath[0]) - return lpath + rpath[1:] - - -def expand_path(init, path, follows): - """ - Expand the non terminal symbols in the given path until all becomes in terminals - and return a sentence with these sequenced terminals - """ - i = -2 - table = {s: set(s.state) for s in init} - - lookahead = path[-1] - while i >= -len(path): - current = path[i] - symbol = path[i + 1] - - if symbol.IsTerminal: - lookahead = symbol - i -= 2 - continue - - reductors = [item for item in current.state if item.production.Left == current and item in table[current]] - - while reductors: - reductor = reductors.pop() - - subpath = guided_path(current, reductor.production.Right) - - last = subpath.pop() - ritem = [item for item in last.state if item.IsReduceItem and item.production == reductor.production][0] - lookaheads = follows[ritem.Left] if not ritem.lookaheads else ritem.lookaheads - - if lookahead in lookaheads: - table[current].remove(reductor) - path = path[:i] + subpath + path[i + 2:] - break - - return Sentence(*[s for s in path if not isinstance(s, State)]) - - -class LRConflictStringGenerator: - """ - Recieve a cparser with conflicts and compute a Sentence that show the conflict - It can be accessed by the field path - - Example: - >>> g = LRConflictStringGenerator(parser) - >>> g.path - """ - def __init__(self, parser): - assert parser.conflict is not None, 'Expected parser with conflict...' - stateID = parser.state_dict - state = parser.conflict.state - symbol = parser.conflict.symbol - init = parser.automaton - _, production = parser.action[state, symbol].pop() - path = sentence_path(init, stateID[state], symbol, production) - - self.production = production - self.conflict = parser.conflict - self.path = expand_path(init, path, parser.follows) diff --git a/cmp/parsing/parsing.py b/cmp/parsing/parsing.py index b1737a8ff..8d9c525a0 100755 --- a/cmp/parsing/parsing.py +++ b/cmp/parsing/parsing.py @@ -1,28 +1,7 @@ -from enum import auto, Enum - from .automatas import build_lr1_automaton, build_larl1_automaton from .utils import compute_firsts, compute_follows -class LRConflictType(Enum): - """ - Enum for mark the type of lr-family conflict parser - """ - ReduceReduce = auto() - ShiftReduce = auto() - - -class LRConflict: - def __init__(self, state, symbol, ctype): - self.state = state - self.symbol = symbol - self.cType = ctype - - def __iter__(self): - yield self.state - yield self.symbol - - class ShiftReduceParser: SHIFT = 'SHIFT' REDUCE = 'REDUCE' From ac53b36d2966b55479b386c766a6d9d3da6a5224 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Fri, 17 Apr 2020 00:25:53 -0400 Subject: [PATCH 010/143] regular save --- cmp/__pycache__/pycompiler.cpython-37.pyc | Bin 17507 -> 18122 bytes cmp/__pycache__/utils.cpython-37.pyc | Bin 6961 -> 6969 bytes .../__pycache__/automatas.cpython-37.pyc | Bin 4249 -> 4269 bytes cmp/parsing/__pycache__/lexer.cpython-37.pyc | Bin 1773 -> 1681 bytes .../__pycache__/parsing.cpython-37.pyc | Bin 5031 -> 5032 bytes cmp/parsing/__pycache__/utils.cpython-37.pyc | Bin 1646 -> 1644 bytes cmp/parsing/automatas.py | 12 +-- cmp/parsing/lexer.py | 36 +++----- cmp/parsing/parsing.py | 25 +++++- cmp/parsing/recovery.py | 2 + cmp/parsing/utils.py | 10 +-- cmp/pycompiler.py | 82 +++++++++--------- cmp/utils.py | 10 +-- definitions.py | 8 +- lexer.py | 18 +++- tests.py | 15 +--- 16 files changed, 116 insertions(+), 102 deletions(-) create mode 100644 cmp/parsing/recovery.py diff --git a/cmp/__pycache__/pycompiler.cpython-37.pyc b/cmp/__pycache__/pycompiler.cpython-37.pyc index e594cefd3c26ad8efd510c2449d20f119cef3ddd..45ed4067d6ae98966ebde7a85a5367f05bd458b4 100644 GIT binary patch delta 4165 zcmai13v8Ul5&rkT`_KQqe&3z%ZTswtpXX;1ha?V;6WcLq65|BB4RCR|T)e-rQ~NI2 zJBK8=HOK~%NT9-0X;XoKqE@I?BU&mXszxakRTO9ukBV|tQD5{)AuXj+D=Kwnf5&!0 zrP{i=-PzgQ*>As@+57Ej_R{^#==XYE3jSSeKY!cD*F9)N+4~PR&Ci?e1zXy?Q{e_L zUsQPcf|@q4=i`3t`LS1yy#TMkUWMs4jRkw!hngS{p(cdme(Z&L1bY$Fk81_6ALTLZ z$8fX)dvRWgy-Mr_IU7|{RevHshEtA`eF#GAo)%N%8h0!z3oPy6Wn5oW(q-JqUHGkY zH}~MTlY6)u7}|RHzS_lna9Pc<3dq>L z&cfiZA8rWajv|7hU4oww`B8sY%DhwKq!Tt7lc@;Jb4ipM=F@wP~_O-A_ zOR*%b8G^Ig#zaX!D)L87Q9LOEG_Qh0h(sI(yrZ?3GoRgK*KPRk&^6(L*7|N3b=>r+ z1R4~T1?4d|$L7?>Ri@mo%qbaFN*h-Y9X6b@m$bqxZXo<Jcrtz5WM7^WCPIU znrN1wtU+U;laTOeg`?9`Md3w7scdlH=&qr?!|e%FKpfVYN7L7P5Moge<&`nG-TN~8EOZ$emIE-dOu$FRAvymzq|0~V{OabKNHudb?A#7<4FF`A5g9J3heVt_`O@ancFM3! z-iy{8Ag_wb94oQ~)w)AfNOWn>Wqx5>0%ZvalOvNck7Y9RICN!Mk6acnj0RE;_(43x zw$cGAwxHFWWNAl%AlSqfavnY`pH@W=v^K=pBAoQ?_V?oW0vVF0IupI{rtd2(0FJTT1qz@Ln3M9=%-cY%A8(s??SWQFLX*444{T%tlFzJCFp zsAyo7@Z*XD)-0ltkZh6jKRJsc>^vL{PG}S~UxgQgo<_E zg0{9oRR--&>h3~OvLDXprvD|b+J|RtWi9PZT;u^vDuAKZqVh1vAL(S&YN~V;^6WwIa{3P&5_av?VDt-!tp3VZ4 zPFMYl5%^h6`+C#PZQL%4$5I*jzeQw2?Vap>c&fGo&t2)*PhJEN{)GB>1s<;9Ta|Ae*4TUINHzW;)6B}Z2)>0}>6!781A0grUP=!{loJY2|Wwy&=0=Nhb}!EsbNVm2}b&yxlmm3PNPbzNTZW z8lG?Ji(lj9iuY+uXLar}hIi}1MRW#xnj6>)aI86qnfTu3&GXiCB<(TnrkDF3R=J-C z7VT*R`#NgMCe)b1b<|hzAnMC`h==i+;NuY<#c#hE;4vPTtf(-9ypmVRc8FK=1dfMs zyoT3GU4%FABww@0(otTA$-7aw70jFPT5Xu^gW*)m7Dusc4j(62sP&?AsfFK1=;Pq* zVHHPQvUsb*c*EQ9NaA`FDK|Wls@>=*6tkk3DV&@+oS!b0uaxsl@g!Dx%Ia8dMn?9I z2%@~88jdOZtyJ@_H3SjSUtx~rf2yS}^^|X?$j;1U1y+iw+*C1>xgli}1ZT-DHyoAw zi5;jJx54&JK^STI(%M1niY^lMBo2}|Kw>Y6Lnu;9^_`XyS%|f^unySKI>2_o>DJ@k zaWYXwGmUNscUuf|b3@zqfLyrU8kEl|4tKOQvF-3^+b^qbBkT1fB*$s5E1@tU(`6@W z2H>gomiciiZuCdrczk65KeFO2J&&xnhUH|*K51sTZ`nlAp&u!W_z!I zCQCZ{AWtbVk`@a5wf$i03P@DH#Tbbdd~DV;N6tJ9vmLc;FP!Um)H{V{S0j^#vCf|V zh0HfP>)5SN{Irv~CH8COF7Wo+b~YyApvW16nsvw6A$V|IN~0Pjp1!oMg|YkK&+GFn zFU^jk`ZS2HEwvI>>5)ulJPx{{ihL^XWa)yPgje8XQtqqM3Zag0QP z#0l>t%@ixy_|*8yV@1$*kHCrR*3ai?yiCmES4o@BXL$jG24_p^5)OiBBHs@5 z%;#B*fF9D&!f8h?Pw!H(fi&ckb)`(4qPBb&IVVJZCUc~a&pkl5M+r<(U8)0#Z(uP= zZG5suA}6m#vP&}A3LRSI5M16^qkSHmk3(?Nd3;!2*wn`^z~xPUKu-RAa}|3YKH9t~ zbT=83nH37s?c1QQJIG3~zq^Y)3un7~F{|M#EVqWt_K=XVBW>xIf-p(QOiw(Pq!W@k z5{e_FqZ^e^4eM!f61ycz48^JO8M8Q<=i+l@Aw7{k-Ama#MyMtU0V?K8Q{*`!MHV|hedHgu`lc(o;?5tZ3 zNeZo_Rfs|*r35Hl4F2=bqYKDx_@Y^q>eL{v5=7*^As#3JDZCt5rQVBjFqL`F*-iGu9d5K*EUo;>Ntv_FwLCgH-?k delta 3587 zcma)9d2o}*7610r^~pLd$+|3CzHQmD@f8j`Hpn)Iv2mC{1BgQi?*|sKEwd7o!yQv> zXj(!Vc+-PPrh&;M(>9q2g&EQoW_nEe59!@Be<*Fz41drGJkO zY4=_G_U&)qTirOrZa&GJeGW&Ff`5%8U*C1Q^Q<$--Z@)8qt2>lza3tu+jPgQG2vRP za1Zy+Dcn1&Cfqpl@e-Vs=943r5>CGc?f4AoOwChq{PAyX3sQo6F1K( z2@|()4ZqFY%8T&Z!fo7+-YGg$%uRoh{ssgu>fNz+id@Q@cD5waGgNb=g0$V}-XcLe@o zYIdn^qh`R5S+m%Uq6m&x`k>c*s4|GEIb~M4z^2)>dQoM{K4n@-s$9W@u#uPn-ZqE8 zVrjNFqGr~JL}AV=eU=$D+D04|iBUOPKa!c;tc!{CWNN%6nM_Y)I2`XSfqz=Z*c#Yb zw6{Sfq6)QzMntB>l${z+=Y#_pdCUCf;C4};Crm0bMaDZRT4^gQ(h8oF$rjLU{b5W{ z5%Z`<^{DT@<>5!R5w-{1_DQxEX6&P;2s+#kx9r0#0-cU#R|C$ogeXn58?{cDa=gzD zz;_bgsPK)j-gBX_sT_4r0}BM;MPH^; zCW=CnITF1zx)&|+pw~nP{WNSSsbyivmTWIrQBsA>owR?@ijeU&u=w|y2rU=j2f+Y* z(Lc<3;VpliiD2{s#zFH-hB8Y!rz0R=Drf~-k^B8XGy4|&F)-|)upYYI8=ZhXsjUUuk3y~3G2tEq8uv7 zXoi<77yPSf8nN33|nNivf@yqHS9D{;lo(1|2htJCBe9oP&wl&b~FR8 zg0{xxGrCc?bLVp^cX9WeG2y_uh8)XYHKcG2`NiCWd?)vEADX#%3HRf-TQBAT9;Akt z@aSG1;$b=V@lqZ^c?rtPc)8^Hc{PvniaC}D@JehjHNuARjAD#K-@w{nj^AYTL1ar{^*P0r9 zHMDy-d1vN3ANaT_Y7q%iibMTFmsR*h?H!l(FP(rki_Pj5am%Mz|!2vmOy)R zKa0bLvJiZ^d8cC+si~rYGdMaGcCW5Y$rxL5eZ>h z?+(&avZyUV&H#L4Nuw3{a`ia$wC-zK44FET*hXYAT0@~_O8uSmv~b!}oF}oE%l5nh zK4^U&{?u$|g+RB$)wV}IEl^{7HQVw+Lp!s{bhOH)prfOiZG-Pr1y}-(bR1wi;C4sM zM5TM`N~p7uv6C?HaE7Jj2KFQS6#Vqzt_rzB8Irt`6m8x(lA6$kbiNJhmR6ec#xXs` zVR&gBI|SLKw@avAig6-O5Sbvd53Op0eE)(YqtC0#l)*9tl9w81nPM9Y%^qLW!#5q8O)`&52kjAuB-nv(0 zCX)NJnaQUhv;11LuniK+W0f!}K#_PmU~om$bOeXb!^Dd7m^({XoV@~rUAOQU+PWj` zhcME;tZ|x@Nv(iG8Kd+^mstiMGs)vkz^mOI>@~RA-HQzbt692=GzN)C97|JrM~dA< zWI-i72?-gQ0Zvm{MCkYmoi>M~ydAGqE3R9TMA%M)bq;_3Cf%USBSJzZMytATo#grB+fO%;^&!0rcN65xf=HGqA*c z*RloWivvO5Gc=Uov}_dmp|t+lPZ<1cV69C$lqNDr&D>8vMT83R)x$j!0Mw7}e{@MK zJw*Z|kuyY|CZZBKM+D@%jNIRVTdONI8pV7f1MW2=(Z$!Oyay7262^obaRN;PaDI)e hB7#$mRj77@v(mlR?Qxr&ZO(uv>MV7aI%kxI{{b823VQ$m diff --git a/cmp/__pycache__/utils.cpython-37.pyc b/cmp/__pycache__/utils.cpython-37.pyc index 2805bee0f0231dced3d01714c6055f223ccf5617..a3f16610cd3dfdc8f0c8dc89526ef0770fffcae2 100644 GIT binary patch delta 64 zcmdmJw$qH)iImo=N5Bve$M6< H+!Of$mqQQ$ diff --git a/cmp/parsing/__pycache__/automatas.cpython-37.pyc b/cmp/parsing/__pycache__/automatas.cpython-37.pyc index aa6efc8ff7e046e4f2bd84303539469673054440..0e5f3632f10df0323d04d1a18e4b6f5ebac075f0 100644 GIT binary patch delta 485 zcmZwEKTpC?5CCuw%AX>Isv+W_g{Gi22pZ9v_y=MFCN3@xQlbPyH7b8wt z+c>k(w%Qn`6u=DALMrIqR_F#`hP{WA+7w-&iWnpWPTybIsiL2@(}c#tq9U77yKC=S z*g3JAZ3lH`h&fPLOVmMSx8gQr*oSxxC9fXY^YP+O(HdmEm}CHySv97#W_c|$>bOmG z8_q@Nu-nFenq!Vy{x%;OOhEXEIU-LKIHtsBYPf%fdWos!c?yqm`hwl;Shzq-|FPxj z30$O@LKKN5Vwq40gIHlwJSh(za)b6sVx5)Z_fTPHq)$ delta 508 zcmZwEOD_Xa6bEoer`0Lb7HP224sB^Y>e-^+iArpcSa>9wMlUJtlsnUnL_}h3;YPxT zu#n*+SV-)w%xCZ!#QoR8#w>n0bMJr7N#;E254yIjX}$*ed~DqBe?4isLXJo&cchC~ z<)TBEH@qEmNfI6&LLCu1?mddxFYXD-cFPk-J>=DMW|++4F$9(0V7#72p!v9FTKN;k z4OZq}M2N>lw5f-Z_G;5LQ9`_XJELKIfR5Y)6p7{a{ln<0D29Ae`fL_ zT>Q;!tq%r`U>Kyp2p9!P@#gQj97EX#CcwDFaUC%$5#p0Lh=4T6fGN-mrojxzf>|&J z=0W{GE~4rL3zA)}c3Lc0te7uZtYSKJu9nmxIrNfJ6u=0u&zCIO!sxhyseFKr{%DTyS!{YhwHCbN0@{SQi<| zX+etIAViT+LCKHcPi#X?kv~Ai%-WF>_B7w_%{PyonLQ1U!thBLE-+j#2cO?GkHU6m z1Ai2&fn+r7B1RJo}y%r z5F`{Vo*@(%w&0Q7EfPZJNcbuNtj-5@+wbyJ?a|j&U-TG_{XWHC3rEA^c!Eq%@oB zduex?!%oQq50;<|-t-rIdq5<*^6G|h>q)Dg8HkN*6I#a^RHmQ!P5-{Fx;p*Ix5wl+ z=jaq5ETUw#C43o1OEcs16*M?n&>|xjrGb)tMUZg7haU=_vjQg2VfwIug5O{TYeUD= zTeQzKq?-VY8MSni9q@e*N!}JjOYxB(h(a7YC#(={7a3yxrt^vcYL0^w^e8ZY+s9Pa zZUUQ(v)JGFUNh-P=c11tl{*{NADUMLM)cF{il!Q(k`amO*+x%yoK>Z%D(xZQka{w5 zbeYahu734TyTi?TD#AgO;c(zt&9uP|-QC4e9(yFqBR*s2xO onNp+MuMYB7l4;6rxpPr$=kTV>c-5_LDhG*rOk=U{F5qSH58{s0F8}}l literal 1773 zcmZuxL2nyH6rMLTYp-1=O`Cw)3#zJ$cA<(9mvXQI0wgZTid0l2tFYScOp=Y)UT1a< zj6c&HE(9;&Ad1Beeb=`H#XV~8-Mxh z_y0=9{-K|`37mX}J%1mCVhU0=ppmCA;sXxsE2e~!XH3Zj9|#3cS>RpZUe*u5df#M2 zJ&x(OZkGl>#ud#5pxA(`w&F^h!9ZxKr1H+#0tTLHsOA|PG?cGeI5wT}8`k?;&$Q{s zcvaVEr2Yl=yoaI`iVc0US+E7GL@7!ZLJ0~=uHb+t@C(Nk?B}9{CE#3^wBjj-m*@Qz zJO~7{C#TjA!(^NkVMum!vc1YWhIUJVlK<}g%ugg* z5p((I)BWBG_Er$M$0Ia+_ao~?X%giY!hz@TbGo(IKp(4iFHQ0y&PJ2HTjZ0T&|ve2 z^$V{+zuQZ*I7;(9oYZHCfa5F~TQ4c}D7V~b+azmAssrw5v0&bEI@oxF(wpR$9?tk3 zm~UU>Ii_1tBXVgcg?aur3I!EL8o~mVoc&qK0^wP}keR>dy>qc-rFTs6Ee_-}2KaaG zEuB}qmD4X^ZU0-QeA?l%pw%}NKP$L*u^w9&^h677%xW>oa>S7qoS;TJy;%ELVc8+8%fpUT( zxPO@hltPpQ+jQtL3YP>Ap34f^u0-WneuWH_92sVJu?m%PAz!BgI5-hB^6erp@XT$T z6LK>{M$JPKk5B~QQ2IY1%saUHA@({G?$>X_&`-ng+9UwGRhOz70rXGs8>;2bdhLm_ zj_S+W+y}KMcBQJURRQz^pLUL;kq$$P{ERX+O=;cMrdnp`4u&Y9e9CDrlIwRo|6R8lNJCWF7S_hyX_2J)8cRBHohj@0);HUu L0CuVD^N#orGjNCS diff --git a/cmp/parsing/__pycache__/parsing.cpython-37.pyc b/cmp/parsing/__pycache__/parsing.cpython-37.pyc index 8623138ecf060e50314fccbef66c15c7901a9604..f3a5e6c6cd9428bdb9178599147ceaa33ccb927d 100644 GIT binary patch delta 695 zcmZWm&ubGw6n1u#WxL6?O}3bJo3xFZrja((7HaVaieO7XT4-_#(y(^Nc4>BJeLIzU z^6tUQfY6(s^r9f~5AZ+mB*L6Zj~)ci9(3Nu;=zUe_RW6p``&x=-qzpM?R&OuT~N=j z=E<)3XrF3CiXYlnV^aNtDZ!l5;8Z^&WJdffIAn70Eqg$o&mwtAfgGXHQAok#RO*3$ z4408{6m;{gWQY1kd$h%AD6JTnI`Du+-OK~}n0NCD_kj13XW=8(mm@u(`$57fKn>OU z{p}5?V1-<-&)A`NKs`T!GIG}D7Cq+ep-|taTxKFKq+P3(bSQ*D`%CBnRdh6NWf zoU^Buxf@Hsfjn%l#$BH;hA-SQeH5`+v=dAO-QQullx zu80#mCX2!veP6;`fZGV^6xwi#?Q{zZ;%xK~bf$po}j_Dl69IG#yN9onK)jL*%C|I9uW?$0w5;8+4bA@G?N;K+ zy9W;)5b>lZy@*Kg5AZ(_M1(mNJqrE}&YPNpyX?1b_I>Yr-<#R@wRbh^wq+UTFoGocUM z5nRMfPC`H3j=Ib}-e>KYd3_^V_|6cDk_c4^bpy_0 zynvt_lYvP1fy=zZlixB_vT`PZ&hZ z6?zzistJ@%%#G9rwy5x?S<2J5JEsqtT#=cLU2=^g6^_+o`Iv2{%E(X+W}z$N7xIa4bV{UPm(SVZL@b5W j|HMAqH>9LAXG2dWUt+DMYN5v$b9YR%tYqan%r*Z4+a#)g diff --git a/cmp/parsing/__pycache__/utils.cpython-37.pyc b/cmp/parsing/__pycache__/utils.cpython-37.pyc index 636ec69fc19f664741cba274d4851a6b7b30f9c7..963023ea69d8ccb6b3532da22b7fc5eff4eaf439 100644 GIT binary patch delta 122 zcmaFI^M;4liI$D3 z+|0bhoZ?&D1(SK1Ef}LFyD?8;l-hio*_e@or?@1ss3g94vM6gFw;0gCB5@EQF}aVm Umr-T144Vv_6i7g2vK^ZN0J91qZ~y=R delta 124 zcmaFE^NxqtiIYJ$Xm$;#=GSlew5J7;jB>W}d<*z4->SF(W&7aYSQT488&H{regex})' for alias, (_, regex) in table.items()]) return re.compile(r) - def __tokenize(self, text): - row = 0 - col = 0 + def _tokenize(self, text): pos = 0 while pos < len(text): - if text[pos] == ' ': + if text[pos] in self.special_symbols: + self.special_symbols[text[pos]](self) pos += 1 - col += 1 - elif text[pos] == '\t': - pos += 1 - col += 4 - elif text[pos] == '\n': - pos += 1 - row += 1 - col = 0 else: match = self.pattern.match(text, pos=pos) - yield match.group(), match.lastgroup, row, col + yield match.group(), match.lastgroup, self.lineno, self.column pos = match.end() - col += len(match.group()) - yield '$', '$' + self.column += len(match.group()) + yield '$', '$', self.lineno, self.column def __call__(self, text): - return [Token(lex, self.table[alias][0], row, col) for lex, alias, row, col in self.__tokenize(text)] + return [Token(lex, self.table[alias][0], row, col) for lex, alias, row, col in self._tokenize(text)] + diff --git a/cmp/parsing/parsing.py b/cmp/parsing/parsing.py index 8d9c525a0..884fd6d19 100755 --- a/cmp/parsing/parsing.py +++ b/cmp/parsing/parsing.py @@ -1,7 +1,28 @@ +from enum import auto, Enum + from .automatas import build_lr1_automaton, build_larl1_automaton from .utils import compute_firsts, compute_follows +class LRConflictType(Enum): + """ + Enum for mark the type of lr-family conflict parser + """ + ReduceReduce = auto() + ShiftReduce = auto() + + +class LRConflict: + def __init__(self, state, symbol, ctype): + self.state = state + self.symbol = symbol + self.cType = ctype + + def __iter__(self): + yield self.state + yield self.symbol + + class ShiftReduceParser: SHIFT = 'SHIFT' REDUCE = 'REDUCE' @@ -35,14 +56,14 @@ def _build_parsing_table(self): idx = node.idx for item in node.state: if item.IsReduceItem: - if item.production.Left == G.startSymbol: + if item.production.Left == G.start_symbol: self._register(self.action, (idx, G.EOF), (self.OK, None)) else: for lookahead in self._lookaheads(item): self._register(self.action, (idx, lookahead), (self.REDUCE, item.production)) else: symbol = item.NextSymbol - idj = node.get(symbol.Name).idx + idj = node.get(symbol.name).idx if symbol.IsTerminal: self._register(self.action, (idx, symbol), (self.SHIFT, idj)) else: diff --git a/cmp/parsing/recovery.py b/cmp/parsing/recovery.py new file mode 100644 index 000000000..5f76bc4b3 --- /dev/null +++ b/cmp/parsing/recovery.py @@ -0,0 +1,2 @@ +class PanicModeRecovery: + pass diff --git a/cmp/parsing/utils.py b/cmp/parsing/utils.py index 04d357802..3bdff5ae2 100644 --- a/cmp/parsing/utils.py +++ b/cmp/parsing/utils.py @@ -30,14 +30,14 @@ def compute_firsts(G): for terminal in G.terminals: firsts[terminal] = ContainerSet(terminal) - for nonterminal in G.nonTerminals: + for nonterminal in G.non_terminals: firsts[nonterminal] = ContainerSet() while change: change = False # P: X -> alpha - for production in G.Productions: + for production in G.productions: X, alpha = production first_X = firsts[X] @@ -62,15 +62,15 @@ def compute_follows(G, firsts): local_firsts = {} # init Follow(Vn) - for nonterminal in G.nonTerminals: + for nonterminal in G.non_terminals: follows[nonterminal] = ContainerSet() - follows[G.startSymbol] = ContainerSet(G.EOF) + follows[G.start_symbol] = ContainerSet(G.EOF) while change: change = False # P: X -> alpha - for production in G.Productions: + for production in G.productions: X = production.Left alpha = production.Right diff --git a/cmp/pycompiler.py b/cmp/pycompiler.py index a346d9c40..3fcf16a88 100755 --- a/cmp/pycompiler.py +++ b/cmp/pycompiler.py @@ -5,11 +5,14 @@ class Symbol: - def __init__(self, name: str, grammar: 'Grammar'): self.name: str = name self.grammar: 'Grammar' = grammar + @property + def IsEpsilon(self): + return False + def __str__(self): return self.name @@ -23,32 +26,26 @@ def __add__(self, other): raise TypeError(other) def __or__(self, other): - if isinstance(other, Sentence): return SentenceList(Sentence(self), other) - raise TypeError(other) - @property - def IsEpsilon(self): - return False - def __len__(self): return 1 class NonTerminal(Symbol): - def __init__(self, name, grammar): super().__init__(name, grammar) self.productions: ProductionList = [] + self.error_productions: ProductionList = [] - def __imod__(self, other): + def __mod__(self, other): if isinstance(other, str): if other: p = Production(self, Sentence(*(self.grammar[s] for s in other.split()))) else: - p = Production(self, self.grammar.Epsilon) + p = Production(self, self.grammar.EPSILON) self.grammar.add_production(p) return self @@ -69,7 +66,7 @@ def __imod__(self, other): if other[0]: other = (Sentence(*(self.grammar[s] for s in other[0].split())),) + other[1:] else: - other = (self.grammar.Epsilon,) + other[1:] + other = (self.grammar.EPSILON,) + other[1:] if len(other) == 2: other += (None,) * len(other[0]) @@ -86,11 +83,9 @@ def __imod__(self, other): return self if isinstance(other, SentenceList): - for s in other: p = Production(self, s) self.grammar.add_production(p) - return self raise TypeError(other) @@ -109,7 +104,6 @@ def IsEpsilon(self): class Terminal(Symbol): - def __init__(self, name: str, grammar: 'Grammar'): super().__init__(name, grammar) @@ -126,6 +120,14 @@ def IsEpsilon(self): return False +class Error(Terminal): + def __init__(self, G): + super().__init__('error', G) + + def __eq__(self, other): + return isinstance(other, Terminal) + + class EOF(Terminal): def __init__(self, G): super().__init__('$', G) @@ -181,7 +183,6 @@ def IsEpsilon(self): class SentenceList: - def __init__(self, *args): self._sentences = list(args) @@ -204,7 +205,6 @@ def __or__(self, other): class Epsilon(Terminal, Sentence): - def __init__(self, grammar: 'Grammar'): super().__init__('epsilon', grammar) @@ -235,11 +235,14 @@ def IsEpsilon(self): class Production: - def __init__(self, nonTerminal, sentence): self.Left: NonTerminal = nonTerminal self.Right: Sentence = sentence + @property + def IsEpsilon(self): + return self.Right.IsEpsilon + def __str__(self): return '%s := %s' % (self.Left, self.Right) @@ -256,13 +259,8 @@ def __eq__(self, other): def __hash__(self): return hash((self.Left, self.Right)) - @property - def IsEpsilon(self): - return self.Right.IsEpsilon - class AttributeProduction(Production): - def __init__(self, nonTerminal, sentence, attributes): if not isinstance(sentence, Sentence) and isinstance(sentence, Symbol): sentence = Sentence(sentence) @@ -293,12 +291,13 @@ def __init__(self): self.productions: ProductionList = [] self.non_terminals: List[NonTerminal] = [] self.terminals: List[Terminal] = [] - self.startSymbol: NonTerminal = None - self.pType: type = None # production type - self.Epsilon: Epsilon = Epsilon(self) + self.start_symbol: NonTerminal = None + self.production_type: type = None + self.ERROR: Error = Error(self) + self.EPSILON: Epsilon = Epsilon(self) self.EOF: EOF = EOF(self) - self.symbDict = {'$': self.EOF} + self.symbDict = {'$': self.EOF, 'error': self.ERROR} def add_non_terminal(self, name: str, startSymbol: bool = False) -> NonTerminal: name = name.strip() @@ -309,8 +308,8 @@ def add_non_terminal(self, name: str, startSymbol: bool = False) -> NonTerminal: if startSymbol: - if self.startSymbol is None: - self.startSymbol = term + if self.start_symbol is None: + self.start_symbol = term else: raise Exception("Cannot define more than one start symbol.") @@ -323,13 +322,16 @@ def add_non_terminals(self, names: str) -> Tuple[NonTerminal, ...]: def add_production(self, production: Production): if len(self.productions) == 0: - self.pType = type(production) + self.production_type = type(production) - assert type(production) == self.pType, "The Productions most be of only 1 type." + assert type(production) == self.production_type, "The Productions most be of only 1 type." production.Left.productions.append(production) self.productions.append(production) + def error(self, head, sentence, rule): + pass + def add_terminal(self, name: str) -> Terminal: name = name.strip() if not name: @@ -398,7 +400,7 @@ def from_json(data): data = json.loads(data) G = Grammar() - dic = {'epsilon': G.Epsilon} + dic = {'epsilon': G.EPSILON} for term in data['Terminals']: dic[term] = G.add_terminal(term) @@ -417,9 +419,9 @@ def copy(self): G.productions = self.productions.copy() G.non_terminals = self.non_terminals.copy() G.terminals = self.terminals.copy() - G.pType = self.pType - G.startSymbol = self.startSymbol - G.Epsilon = self.Epsilon + G.production_type = self.production_type + G.start_symbol = self.start_symbol + G.EPSILON = self.EPSILON G.EOF = self.EOF G.symbDict = self.symbDict.copy() @@ -429,7 +431,7 @@ def copy(self): def IsAugmentedGrammar(self): augmented = 0 for left, _ in self.productions: - if self.startSymbol == left: + if self.start_symbol == left: augmented += 1 if augmented <= 1: return True @@ -441,13 +443,13 @@ def AugmentedGrammar(self, force=False): G = self.copy() # S, self.startSymbol, SS = self.startSymbol, None, self.NonTerminal('S\'', True) - S = G.startSymbol - G.startSymbol = None + S = G.start_symbol + G.start_symbol = None SS = G.add_non_terminal('S\'', True) - if G.pType is AttributeProduction: - SS %= S + G.Epsilon, lambda x: x + if G.production_type is AttributeProduction: + SS %= S + G.EPSILON, lambda x: x else: - SS %= S + G.Epsilon + SS %= S + G.EPSILON return G else: diff --git a/cmp/utils.py b/cmp/utils.py index 262095232..04ff7d7cb 100755 --- a/cmp/utils.py +++ b/cmp/utils.py @@ -70,17 +70,17 @@ class Token: Token's type. """ - def __init__(self, lex, token_type, row=0, col=0): + def __init__(self, lex, token_type, line=0, column=0): """ :param lex: str :param token_type: Enum - :param row: int - :param col: int + :param line: int + :param column: int """ self.lex = lex self.token_type = token_type - self.row = row - self.col = col + self.line = line + self.column = column def __str__(self): return f'{self.token_type}: {self.lex}' diff --git a/definitions.py b/definitions.py index 1291d3734..f81055b59 100644 --- a/definitions.py +++ b/definitions.py @@ -92,12 +92,6 @@ G.add_terminal('~') G.add_terminal('not') -############ -# Specials # -############ -G.add_terminal('tab') -G.add_terminal('space') -G.add_terminal('newline') ############### # Productions # @@ -188,7 +182,7 @@ def cool_parser(): if __name__ == '__main__': t = time.time() parser = cool_parser() - print('Building Time :', time.time() - t, 'sec') + print('Building Time :', time.time() - t, 'seconds') print('Action Table Entries :', len(parser.action)) print('Got Table Entries :', len(parser.goto)) print('Presents Conflicts :', parser.conflict is not None) diff --git a/lexer.py b/lexer.py index 34752da8a..d597d7893 100644 --- a/lexer.py +++ b/lexer.py @@ -14,14 +14,24 @@ def __init__(self, G): :param G: cmp.pycompiler.Grammar """ self.G = G - super().__init__(self.__table, G.EOF, self.__skip_characters) + super().__init__(self._table, G.EOF, self._skip_chars) @property - def __skip_characters(self): - return {' ', '\n', '\t'} + def _skip_chars(self): + def newline(lexer): + lexer.lineno += 1 + lexer.column = 0 + + def whitespace(lexer): + lexer.column += 1 + + def tab(lexer): + lexer.column += 4 + + return {' ': whitespace, '\n': newline, '\t': tab} @property - def __table(self): + def _table(self): G = self.G return { 'int': (G['integer'], '-?[1-9][0-9]*'), diff --git a/tests.py b/tests.py index 98ac177e7..a2cc7960d 100644 --- a/tests.py +++ b/tests.py @@ -14,22 +14,15 @@ class Tester: @staticmethod - def tokenize(script: str, print_tokens: bool = True) -> List[Token]: + def tokenize(script: str) -> List[Token]: """ Method for tokenize a cool program :param script: string with the name of the program - :param print_tokens: if true tokens will be printing with the program format """ file = f'scripts/{script}' - program = ''.join(open(file, 'r').read()) + program = open(file, 'r').read() - tokens = [t for t in lexer(program) if t.token_type not in (G['space'], G['newline'], G['tab'])] - - if print_tokens: - for t in tokens: - print(t) - - return tokens + return [t for t in lexer(program)] @staticmethod def parse(script: str): @@ -37,7 +30,7 @@ def parse(script: str): Method for parse a cool program and return an ast :param script: string with the name of the program """ - tokens = Tester.tokenize(script, print_tokens=False) + tokens = Tester.tokenize(script) ast = parser(tokens) print(ast) From 4eae974ec38de48564b95250aab1aaa7d4e8a510 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Sun, 19 Apr 2020 06:07:54 -0400 Subject: [PATCH 011/143] Fixed up the grammar for operators "=", "<", "<=". Improved Parser Serializer (Need a better inpection analysis) --- astnodes.py | 71 +- build.py | 2 +- cmp/__pycache__/ast.cpython-37.pyc | Bin 3282 -> 0 bytes cmp/__pycache__/pycompiler.cpython-37.pyc | Bin 18122 -> 17385 bytes cmp/__pycache__/utils.cpython-37.pyc | Bin 6969 -> 9008 bytes cmp/__pycache__/visitor.cpython-37.pyc | Bin 2310 -> 2310 bytes cmp/ast.py | 69 - cmp/parsing/__init__.py | 2 +- .../__pycache__/__init__.cpython-37.pyc | Bin 271 -> 288 bytes .../__pycache__/automatas.cpython-37.pyc | Bin 4269 -> 0 bytes cmp/parsing/__pycache__/lexer.cpython-37.pyc | Bin 1681 -> 0 bytes .../__pycache__/parsing.cpython-37.pyc | Bin 5032 -> 10392 bytes cmp/parsing/__pycache__/utils.cpython-37.pyc | Bin 1644 -> 0 bytes cmp/parsing/automatas.py | 150 -- cmp/parsing/lexer.py | 35 - cmp/parsing/lexing.py | 89 + cmp/parsing/parsing.py | 288 ++- cmp/parsing/serializer.py | 17 +- cmp/parsing/utils.py | 93 - cmp/pycompiler.py | 76 +- cmp/utils.py | 175 +- definitions.py => grammar.py | 97 +- lexer.py | 1 - main.py | 12 +- parser.py | 1860 ++++++++--------- scripts/main.cool | 7 + scripts/program.cool | 16 - semantic.py | 713 ++++++- tester.py | 73 + tests.py | 39 - tests/codegen/arith.cl | 430 ++++ tests/codegen/atoi.cl | 121 ++ tests/codegen/atoi2.cl | 92 + tests/codegen/book_list.cl | 132 ++ tests/codegen/cells.cl | 97 + tests/codegen/complex.cl | 52 + tests/codegen/fib.cl | 29 + tests/codegen/graph.cl | 381 ++++ tests/codegen/hairyscary.cl | 67 + tests/codegen/hello_world.cl | 5 + tests/codegen/helloworld.cl | 6 + tests/codegen/io.cl | 103 + tests/codegen/life.cl | 436 ++++ tests/codegen/list.cl | 141 ++ tests/codegen/new_complex.cl | 79 + tests/codegen/palindrome.cl | 25 + tests/codegen/primes.cl | 84 + tests/codegen/print-cool.cl | 9 + tests/codegen/sort-list.cl | 146 ++ tests/codegen/test.cl | 19 + tests/codegen_test.py | 15 + tests/conftest.py | 6 + tests/lexer/comment1.cl | 55 + tests/lexer/comment1_error.txt | 1 + tests/lexer/iis1.cl | 111 + tests/lexer/iis1_error.txt | 1 + tests/lexer/iis2.cl | 120 ++ tests/lexer/iis2_error.txt | 1 + tests/lexer/iis3.cl | 121 ++ tests/lexer/iis3_error.txt | 1 + tests/lexer/iis4.cl | 120 ++ tests/lexer/iis4_error.txt | 1 + tests/lexer/iis5.cl | 121 ++ tests/lexer/iis5_error.txt | 2 + tests/lexer/iis6.cl | 125 ++ tests/lexer/iis6_error.txt | 1 + tests/lexer/mixed1.cl | 14 + tests/lexer/mixed1_error.txt | 1 + tests/lexer/mixed2.cl | 20 + tests/lexer/mixed2_error.txt | 3 + tests/lexer/string1.cl | 6 + tests/lexer/string1_error.txt | 2 + tests/lexer/string2.cl | 19 + tests/lexer/string2_error.txt | 1 + tests/lexer/string3.cl | Bin 0 -> 234 bytes tests/lexer/string3_error.txt | 1 + tests/lexer/string4.cl | 38 + tests/lexer/string4_error.txt | 3 + tests/lexer_test.py | 13 + tests/parser/assignment1.cl | 37 + tests/parser/assignment1_error.txt | 1 + tests/parser/assignment2.cl | 37 + tests/parser/assignment2_error.txt | 1 + tests/parser/assignment3.cl | 37 + tests/parser/assignment3_error.txt | 1 + tests/parser/attribute1.cl | 34 + tests/parser/attribute1_error.txt | 1 + tests/parser/attribute2.cl | 34 + tests/parser/attribute2_error.txt | 1 + tests/parser/attribute3.cl | 34 + tests/parser/attribute3_error.txt | 1 + tests/parser/block1.cl | 87 + tests/parser/block1_error.txt | 1 + tests/parser/block2.cl | 87 + tests/parser/block2_error.txt | 1 + tests/parser/block3.cl | 87 + tests/parser/block3_error.txt | 1 + tests/parser/block4.cl | 88 + tests/parser/block4_error.txt | 1 + tests/parser/case1.cl | 91 + tests/parser/case1_error.txt | 1 + tests/parser/case2.cl | 93 + tests/parser/case2_error.txt | 1 + tests/parser/case3.cl | 93 + tests/parser/case3_error.txt | 1 + tests/parser/case4.cl | 93 + tests/parser/case4_error.txt | 1 + tests/parser/case5.cl | 93 + tests/parser/case5_error.txt | 1 + tests/parser/case6.cl | 93 + tests/parser/case6_error.txt | 1 + tests/parser/class1.cl | 20 + tests/parser/class1_error.txt | 1 + tests/parser/class2.cl | 20 + tests/parser/class2_error.txt | 1 + tests/parser/class3.cl | 34 + tests/parser/class3_error.txt | 1 + tests/parser/class4.cl | 36 + tests/parser/class4_error.txt | 1 + tests/parser/class5.cl | 34 + tests/parser/class5_error.txt | 1 + tests/parser/class6.cl | 34 + tests/parser/class6_error.txt | 1 + tests/parser/conditional1.cl | 69 + tests/parser/conditional1_error.txt | 1 + tests/parser/conditional2.cl | 69 + tests/parser/conditional2_error.txt | 1 + tests/parser/conditional3.cl | 69 + tests/parser/conditional3_error.txt | 1 + tests/parser/conditional4.cl | 73 + tests/parser/conditional4_error.txt | 1 + tests/parser/conditional5.cl | 73 + tests/parser/conditional5_error.txt | 1 + tests/parser/conditional6.cl | 73 + tests/parser/conditional6_error.txt | 1 + tests/parser/dispatch1.cl | 45 + tests/parser/dispatch1_error.txt | 1 + tests/parser/dispatch2.cl | 45 + tests/parser/dispatch2_error.txt | 1 + tests/parser/dispatch3.cl | 45 + tests/parser/dispatch3_error.txt | 1 + tests/parser/dispatch4.cl | 53 + tests/parser/dispatch4_error.txt | 1 + tests/parser/dispatch5.cl | 53 + tests/parser/dispatch5_error.txt | 1 + tests/parser/dispatch6.cl | 57 + tests/parser/dispatch6_error.txt | 1 + tests/parser/dispatch7.cl | 57 + tests/parser/dispatch7_error.txt | 1 + tests/parser/dispatch8.cl | 57 + tests/parser/dispatch8_error.txt | 1 + tests/parser/dispatch9.cl | 61 + tests/parser/dispatch9_error.txt | 1 + tests/parser/let1.cl | 85 + tests/parser/let1_error.txt | 1 + tests/parser/let2.cl | 85 + tests/parser/let2_error.txt | 1 + tests/parser/let3.cl | 85 + tests/parser/let3_error.txt | 1 + tests/parser/let4.cl | 85 + tests/parser/let4_error.txt | 1 + tests/parser/let5.cl | 85 + tests/parser/let5_error.txt | 1 + tests/parser/let6.cl | 74 + tests/parser/let6_error.txt | 1 + tests/parser/let7.cl | 85 + tests/parser/let7_error.txt | 1 + tests/parser/loop1.cl | 78 + tests/parser/loop1_error.txt | 1 + tests/parser/loop2.cl | 78 + tests/parser/loop2_error.txt | 1 + tests/parser/loop3.cl | 78 + tests/parser/loop3_error.txt | 1 + tests/parser/loop4.cl | 78 + tests/parser/loop4_error.txt | 1 + tests/parser/method1.cl | 34 + tests/parser/method1_error.txt | 1 + tests/parser/method2.cl | 34 + tests/parser/method2_error.txt | 1 + tests/parser/method3.cl | 34 + tests/parser/method3_error.txt | 1 + tests/parser/method4.cl | 34 + tests/parser/method4_error.txt | 1 + tests/parser/method5.cl | 34 + tests/parser/method5_error.txt | 1 + tests/parser/method6.cl | 33 + tests/parser/method6_error.txt | 1 + tests/parser/mixed1.cl | 100 + tests/parser/mixed1_error.txt | 1 + tests/parser/mixed2.cl | 14 + tests/parser/mixed2_error.txt | 1 + tests/parser/mixed3.cl | 40 + tests/parser/mixed3_error.txt | 1 + tests/parser/mixed4.cl | 21 + tests/parser/mixed4_error.txt | 1 + tests/parser/mixed5.cl | 20 + tests/parser/mixed5_error.txt | 1 + tests/parser/mixed6.cl | 5 + tests/parser/mixed6_error.txt | 1 + tests/parser/operation1.cl | 101 + tests/parser/operation1_error.txt | 1 + tests/parser/operation2.cl | 101 + tests/parser/operation2_error.txt | 1 + tests/parser/operation3.cl | 101 + tests/parser/operation3_error.txt | 1 + tests/parser/operation4.cl | 101 + tests/parser/operation4_error.txt | 1 + tests/parser/program1.cl | 1 + tests/parser/program1_error.txt | 1 + tests/parser/program2.cl | 20 + tests/parser/program2_error.txt | 1 + tests/parser/program3.cl | 24 + tests/parser/program3_error.txt | 1 + tests/parser_test.py | 13 + tests/semantic/hello_world.cl | 5 + tests/semantic_test.py | 13 + tests/utils/__init__.py | 1 + tests/utils/utils.py | 56 + 218 files changed, 9776 insertions(+), 1584 deletions(-) delete mode 100644 cmp/__pycache__/ast.cpython-37.pyc delete mode 100755 cmp/ast.py delete mode 100644 cmp/parsing/__pycache__/automatas.cpython-37.pyc delete mode 100644 cmp/parsing/__pycache__/lexer.cpython-37.pyc delete mode 100644 cmp/parsing/__pycache__/utils.cpython-37.pyc delete mode 100644 cmp/parsing/automatas.py delete mode 100644 cmp/parsing/lexer.py create mode 100644 cmp/parsing/lexing.py delete mode 100644 cmp/parsing/utils.py rename definitions.py => grammar.py (50%) create mode 100644 scripts/main.cool delete mode 100644 scripts/program.cool create mode 100644 tester.py delete mode 100644 tests.py create mode 100755 tests/codegen/arith.cl create mode 100644 tests/codegen/atoi.cl create mode 100644 tests/codegen/atoi2.cl create mode 100755 tests/codegen/book_list.cl create mode 100755 tests/codegen/cells.cl create mode 100755 tests/codegen/complex.cl create mode 100644 tests/codegen/fib.cl create mode 100755 tests/codegen/graph.cl create mode 100755 tests/codegen/hairyscary.cl create mode 100755 tests/codegen/hello_world.cl create mode 100644 tests/codegen/helloworld.cl create mode 100755 tests/codegen/io.cl create mode 100755 tests/codegen/life.cl create mode 100644 tests/codegen/list.cl create mode 100755 tests/codegen/new_complex.cl create mode 100755 tests/codegen/palindrome.cl create mode 100644 tests/codegen/primes.cl create mode 100644 tests/codegen/print-cool.cl create mode 100644 tests/codegen/sort-list.cl create mode 100755 tests/codegen/test.cl create mode 100644 tests/codegen_test.py create mode 100644 tests/conftest.py create mode 100644 tests/lexer/comment1.cl create mode 100644 tests/lexer/comment1_error.txt create mode 100644 tests/lexer/iis1.cl create mode 100644 tests/lexer/iis1_error.txt create mode 100644 tests/lexer/iis2.cl create mode 100644 tests/lexer/iis2_error.txt create mode 100644 tests/lexer/iis3.cl create mode 100644 tests/lexer/iis3_error.txt create mode 100644 tests/lexer/iis4.cl create mode 100644 tests/lexer/iis4_error.txt create mode 100644 tests/lexer/iis5.cl create mode 100644 tests/lexer/iis5_error.txt create mode 100644 tests/lexer/iis6.cl create mode 100644 tests/lexer/iis6_error.txt create mode 100644 tests/lexer/mixed1.cl create mode 100644 tests/lexer/mixed1_error.txt create mode 100644 tests/lexer/mixed2.cl create mode 100644 tests/lexer/mixed2_error.txt create mode 100644 tests/lexer/string1.cl create mode 100644 tests/lexer/string1_error.txt create mode 100644 tests/lexer/string2.cl create mode 100644 tests/lexer/string2_error.txt create mode 100644 tests/lexer/string3.cl create mode 100644 tests/lexer/string3_error.txt create mode 100644 tests/lexer/string4.cl create mode 100644 tests/lexer/string4_error.txt create mode 100644 tests/lexer_test.py create mode 100644 tests/parser/assignment1.cl create mode 100644 tests/parser/assignment1_error.txt create mode 100644 tests/parser/assignment2.cl create mode 100644 tests/parser/assignment2_error.txt create mode 100644 tests/parser/assignment3.cl create mode 100644 tests/parser/assignment3_error.txt create mode 100644 tests/parser/attribute1.cl create mode 100644 tests/parser/attribute1_error.txt create mode 100644 tests/parser/attribute2.cl create mode 100644 tests/parser/attribute2_error.txt create mode 100644 tests/parser/attribute3.cl create mode 100644 tests/parser/attribute3_error.txt create mode 100644 tests/parser/block1.cl create mode 100644 tests/parser/block1_error.txt create mode 100644 tests/parser/block2.cl create mode 100644 tests/parser/block2_error.txt create mode 100644 tests/parser/block3.cl create mode 100644 tests/parser/block3_error.txt create mode 100644 tests/parser/block4.cl create mode 100644 tests/parser/block4_error.txt create mode 100644 tests/parser/case1.cl create mode 100644 tests/parser/case1_error.txt create mode 100644 tests/parser/case2.cl create mode 100644 tests/parser/case2_error.txt create mode 100644 tests/parser/case3.cl create mode 100644 tests/parser/case3_error.txt create mode 100644 tests/parser/case4.cl create mode 100644 tests/parser/case4_error.txt create mode 100644 tests/parser/case5.cl create mode 100644 tests/parser/case5_error.txt create mode 100644 tests/parser/case6.cl create mode 100644 tests/parser/case6_error.txt create mode 100644 tests/parser/class1.cl create mode 100644 tests/parser/class1_error.txt create mode 100644 tests/parser/class2.cl create mode 100644 tests/parser/class2_error.txt create mode 100644 tests/parser/class3.cl create mode 100644 tests/parser/class3_error.txt create mode 100644 tests/parser/class4.cl create mode 100644 tests/parser/class4_error.txt create mode 100644 tests/parser/class5.cl create mode 100644 tests/parser/class5_error.txt create mode 100644 tests/parser/class6.cl create mode 100644 tests/parser/class6_error.txt create mode 100644 tests/parser/conditional1.cl create mode 100644 tests/parser/conditional1_error.txt create mode 100644 tests/parser/conditional2.cl create mode 100644 tests/parser/conditional2_error.txt create mode 100644 tests/parser/conditional3.cl create mode 100644 tests/parser/conditional3_error.txt create mode 100644 tests/parser/conditional4.cl create mode 100644 tests/parser/conditional4_error.txt create mode 100644 tests/parser/conditional5.cl create mode 100644 tests/parser/conditional5_error.txt create mode 100644 tests/parser/conditional6.cl create mode 100644 tests/parser/conditional6_error.txt create mode 100644 tests/parser/dispatch1.cl create mode 100644 tests/parser/dispatch1_error.txt create mode 100644 tests/parser/dispatch2.cl create mode 100644 tests/parser/dispatch2_error.txt create mode 100644 tests/parser/dispatch3.cl create mode 100644 tests/parser/dispatch3_error.txt create mode 100644 tests/parser/dispatch4.cl create mode 100644 tests/parser/dispatch4_error.txt create mode 100644 tests/parser/dispatch5.cl create mode 100644 tests/parser/dispatch5_error.txt create mode 100644 tests/parser/dispatch6.cl create mode 100644 tests/parser/dispatch6_error.txt create mode 100644 tests/parser/dispatch7.cl create mode 100644 tests/parser/dispatch7_error.txt create mode 100644 tests/parser/dispatch8.cl create mode 100644 tests/parser/dispatch8_error.txt create mode 100644 tests/parser/dispatch9.cl create mode 100644 tests/parser/dispatch9_error.txt create mode 100644 tests/parser/let1.cl create mode 100644 tests/parser/let1_error.txt create mode 100644 tests/parser/let2.cl create mode 100644 tests/parser/let2_error.txt create mode 100644 tests/parser/let3.cl create mode 100644 tests/parser/let3_error.txt create mode 100644 tests/parser/let4.cl create mode 100644 tests/parser/let4_error.txt create mode 100644 tests/parser/let5.cl create mode 100644 tests/parser/let5_error.txt create mode 100644 tests/parser/let6.cl create mode 100644 tests/parser/let6_error.txt create mode 100644 tests/parser/let7.cl create mode 100644 tests/parser/let7_error.txt create mode 100644 tests/parser/loop1.cl create mode 100644 tests/parser/loop1_error.txt create mode 100644 tests/parser/loop2.cl create mode 100644 tests/parser/loop2_error.txt create mode 100644 tests/parser/loop3.cl create mode 100644 tests/parser/loop3_error.txt create mode 100644 tests/parser/loop4.cl create mode 100644 tests/parser/loop4_error.txt create mode 100644 tests/parser/method1.cl create mode 100644 tests/parser/method1_error.txt create mode 100644 tests/parser/method2.cl create mode 100644 tests/parser/method2_error.txt create mode 100644 tests/parser/method3.cl create mode 100644 tests/parser/method3_error.txt create mode 100644 tests/parser/method4.cl create mode 100644 tests/parser/method4_error.txt create mode 100644 tests/parser/method5.cl create mode 100644 tests/parser/method5_error.txt create mode 100644 tests/parser/method6.cl create mode 100644 tests/parser/method6_error.txt create mode 100644 tests/parser/mixed1.cl create mode 100644 tests/parser/mixed1_error.txt create mode 100644 tests/parser/mixed2.cl create mode 100644 tests/parser/mixed2_error.txt create mode 100644 tests/parser/mixed3.cl create mode 100644 tests/parser/mixed3_error.txt create mode 100644 tests/parser/mixed4.cl create mode 100644 tests/parser/mixed4_error.txt create mode 100644 tests/parser/mixed5.cl create mode 100644 tests/parser/mixed5_error.txt create mode 100644 tests/parser/mixed6.cl create mode 100644 tests/parser/mixed6_error.txt create mode 100644 tests/parser/operation1.cl create mode 100644 tests/parser/operation1_error.txt create mode 100644 tests/parser/operation2.cl create mode 100644 tests/parser/operation2_error.txt create mode 100644 tests/parser/operation3.cl create mode 100644 tests/parser/operation3_error.txt create mode 100644 tests/parser/operation4.cl create mode 100644 tests/parser/operation4_error.txt create mode 100644 tests/parser/program1.cl create mode 100644 tests/parser/program1_error.txt create mode 100644 tests/parser/program2.cl create mode 100644 tests/parser/program2_error.txt create mode 100644 tests/parser/program3.cl create mode 100644 tests/parser/program3_error.txt create mode 100644 tests/parser_test.py create mode 100755 tests/semantic/hello_world.cl create mode 100644 tests/semantic_test.py create mode 100644 tests/utils/__init__.py create mode 100644 tests/utils/utils.py diff --git a/astnodes.py b/astnodes.py index 6bc2c58f2..86699abcd 100644 --- a/astnodes.py +++ b/astnodes.py @@ -1,6 +1,4 @@ class Node: - row = 0 - col = 0 pass @@ -13,7 +11,7 @@ class DeclarationNode(Node): pass -class ExpressionNode(Node): +class ExprNode(Node): pass @@ -39,50 +37,57 @@ def __init__(self, idx, typex, expr=None): self.expr = expr -class ParamNode(DeclarationNode): - def __init__(self, idx, typex): - self.id = idx - self.type = typex - - -class BlockNode(ExpressionNode): +class BlockNode(ExprNode): def __init__(self, expressions): self.expressions = expressions -class LetNode(ExpressionNode): +class LetNode(ExprNode): def __init__(self, declarations, expr): self.expr = expr self.declarations = declarations -class CasesNode(ExpressionNode): +class SwitchCaseNode(ExprNode): def __init__(self, expr, cases): self.expr = expr self.cases = cases -class SingleCaseNode(ExpressionNode): +class CaseNode(ExprNode): def __init__(self, idx, typex, expr): - self.idx = idx - self.typex = typex + self.id = idx + self.type = typex self.expr = expr -class VarDeclarationNode(ExpressionNode): +class VarDeclarationNode(ExprNode): def __init__(self, idx, typex, expr=None): self.id = idx self.type = typex self.expr = expr -class AssignNode(ExpressionNode): +class AssignNode(ExprNode): def __init__(self, idx, expr): self.id = idx self.expr = expr -class MethodCallNode(ExpressionNode): +class ConditionalNode(ExprNode): + def __init__(self, ifx, then, elsex): + self.if_expr = ifx + self.then_expr = then + self.else_expr = elsex + + +class WhileNode(ExprNode): + def __init__(self, condition, body): + self.condition = condition + self.body = body + + +class MethodCallNode(ExprNode): def __init__(self, idx, args, obj=None, typex=None): self.obj = obj self.id = idx @@ -90,28 +95,22 @@ def __init__(self, idx, args, obj=None, typex=None): self.type = typex -class AtomicNode(ExpressionNode): +class AtomicNode(ExprNode): def __init__(self, lex): self.lex = lex -class BinaryNode(ExpressionNode): +class UnaryNode(ExprNode): + def __init__(self, obj): + self.obj = obj + + +class BinaryNode(ExprNode): def __init__(self, left, right): self.left = left self.right = right -class ConditionalNode(ExpressionNode): - def __init__(self, ifx, then, elsex): - self.ifx = ifx - self.then = then - self.elsex = elsex - - -class ConstantNumNode(AtomicNode): - pass - - class VariableNode(AtomicNode): pass @@ -132,19 +131,15 @@ class BooleanNode(AtomicNode): pass -class NegationNode(AtomicNode): - pass - - -class ComplementNode(AtomicNode): +class NegationNode(UnaryNode): pass -class IsVoidNode(AtomicNode): +class ComplementNode(UnaryNode): pass -class WhileNode(BinaryNode): +class IsVoidNode(UnaryNode): pass diff --git a/build.py b/build.py index fd320b307..20ab2a99e 100644 --- a/build.py +++ b/build.py @@ -1,4 +1,4 @@ -from definitions import cool_parser +from grammar import cool_parser from cmp.parsing.serializer import LRParserSerializer PARSER_SETTINGS = { diff --git a/cmp/__pycache__/ast.cpython-37.pyc b/cmp/__pycache__/ast.cpython-37.pyc deleted file mode 100644 index 8b130445f41f4690bdad138b6ffe6fdd774e1cae..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3282 zcmb_e&u<$=7@gVKwbzc*rb$W5k3s+mFjDOU5)!D2LaVCcVnwRpU{zhYo=xMh_NKGj z(pb)gL<-!wRh5z>|I&&Zr=Gd>#Cx+|$958EC03f*o!OcB-ur&dcYATMD)2n{bMSDb zEW}?N6pxFK4YcGTIxVz}L|?Y06!(O7v^o@89XM?VBUgJEd7*Ql+6v>6E@ND_V;5sz zS1_*Fu@|b)4ZSU;t9s#3wo6*x7xmgJ$PleA`{Hr%v4NIcMHh;;)S~TZshva7R$5_~ zo4Ku6hh2#UeE4R&gO-q3Dh|Xi*oU>URhQXHD^9=f??z!i9HgPXYfNk~?IvNg^@lJX zw!FUC+>ZNU^QS0$7MkX!iTA>88Yj)oy>vSsG`n#eHM{-YW+zD-yL*`*KI=qJJ88(x z2{8*fTqLYU@uvl#eh>^g{V)i!Y7q2e{WRitEeM`G?L_$>0|Vq3EReh_agL|b8uoZ! z+VT0S`T(oWs!F?18H@xql(On~Y25F1t>P?PY~h=2qPUS9i2z0~6sMx_dEGGtVQTEi z_7oxM^#;8(2&nZ!3oECR8pZ!Nwv|yhsV;Mov(l`h7B3KVs&voz1X*E6ScY3JR`LS= za&1DAzVwyh%#4}|X#*|!0^LPw4n6JZ(xEt@ZtHt4F5w5ICmhiYeAjU9e{qEB?cT%_Xb(PoPhyX-^4J?Wh`>qeaxymx zx6;fry~o=r%w!{xmNZoU6cbB=p8gTq*eE4ATsf6|);$P;2j1b9HFVSNvEx`r0i0t6 zXwHd~yNYY9c$>5=24Wv0%Sw@TmaJqhbec~ojA-dJaGPm_6Th*(jU{~lTV~I*g=1E+ z&Rkdj+li9(#wI6z>?OT4 zHa1&KNRk|lbf4%5b9{eTTNFOa{F1q8=TS0eBIFky+T>JPdJrlw_=qzCv z&;fXmf_dCAd=~~<8#>>v!NX3GvPhYBIYV2Vr~eJikNpi5qV=S?*ZiH5m95jortQQ7 zYs0qt^L98W+?-{DjedJ?%^%mo*QqgxYQmQ#02k^|FFy3))}B zF_Lp}TT3e)1*}3bidT6YtWz@mTT!R~NO#un;)uV|#PG(sQB|zNF{Sv?4r<=IYb&6f z1rbto++INaoJTHF2=6Id(auZb;+zTH YVun**K(8|%ty*g8lDFh9EiPUD2Nq~Q4FCWD diff --git a/cmp/__pycache__/pycompiler.cpython-37.pyc b/cmp/__pycache__/pycompiler.cpython-37.pyc index 45ed4067d6ae98966ebde7a85a5367f05bd458b4..4e050644f4b6cb1b1fc1890f19c11d1369b8d45b 100644 GIT binary patch delta 7051 zcmb6eYiwKP^?vrXef^B{a^mLYq-j&9ZQ6wN-KJ@qv`t$=X$mba)OCGtQ@4Jk-@PqO zC^L{EUPDkF9%6%uZDIm}#zPxJV`Cft#$y^96Vlb#Kx`_VvPz4?|kPw=X~e&-MsTKyK)~3Z1?*;68`=C?Qb8wyZ=(4(WbCV%a-LcN=#vrX44$1 zJuHQ#m|K%I1#wSU8fTj4giVZkcS)+OIxb48W7-z;A?8$Fh`BW1v_0lWTv6SKy9FLV z+@pFC_i6#0uR`3X`VsdFJcxKetwKCsh3u*k4XV|MRwGt}SdChXSgjV&s;A{xEsoTw z^*B+YuoltVlfA)D<0Pk9*@pViD1l zY2u8>bGT;^fRQ8z~b!H=%K3lGhUBIszdAO$1s9v=J!n zD4xiG+>1cLuTCeSu%PUd6+3>Mii3OMuJ$?@a6ZRs;Lpyb%f$f{4=Kt_cRZd-iz+erZfHsxB~^Rq;9Mg1CD_w{Rz$Y3o^SGW{w) zAZ5RDZywjO+W84SunOLGU*~ScLCz4sG57id)?yx|!EOZCtmn&dbO^t?4S_6~QZ&fL zc`rtsy9tPscjy!8l)(e=Cr=Cd&wo6T>nS6c?&0%EZNf<9vb>pyg-^&OpD@{k*jZS! zu)XkeJoQWteQX6T(+A*`ccneTLh!72q-!2u@r>vPHJ(Xj6Y0Yc^bL26( zpIm}ZOYy6d(G=!$C@XyEmz>6v_$~g)_yiC7j|P4CfWcMtP56#81c5+vFR>9KMeUZE zizH}Xu_NtnZA+4$fFpsy`Sd1zQt)PA`+P*CZw6YbhVu(p@C*_PXOe7FH3i%E6mweC z!y`yB%eunRgo!Iym#-&cp-^Gpl2JF{oCaT1J>FfiiIt8_wyUx+ZiknHLo0=Y)9MAX zmv$x|pMpqr(}oC%QRWd_XzUvKO5$zA`Ey`YPv^_US?{{dw64PvKIY%7cpVDbyYlQnmP{#;UYxpZVFeZWFkY~53Hd9o~z4k5JsomED{ReMo$Y=5RvU4 zg6r#-ux8Nfk61h!X{AUug4;qos8~D(uF&2Hd0HU_60jaYul3v{bW4;5^g(hkkeVe3~k|#Xat|iU0Kx9QfU>Hwhm5(TNjI%q{Xw2Uf52g zH9CrEcro0D9`$Z`AD&Xp6QCqt(kyD?{9M7d^@h4i- zzD-r%fUc&SE1t$KBzX%tHN$I7hx&zU3AebBb|tr%C$dHR@GIETynHl5yG*MB)|9w_Oxvg?B=s6Igbf1we9K_hj9SW z`N+wwKZcgbXvNdrgR`H&#mLr$ip^(8SSU8tGhOqnS`(<4GE2>*IOUS>i-b;lTXi12 zzGL15PfET6YWqcO>aVnKXH~GGqp7ZF_)-bJ0!KPVBNRn*90pDO4SwBmqM|uS;4fkK zVs%l4)FayBe@d`#NhADm@y?12NY8)4md@lFaX6x@y9vkm%?K7crhiND`_9`cZcVoO zFKykiKSJ!vBB_)+%1mA|bjety=pykxhqsnApjoL~f1js9_a;*u7q+%mrU|hS<%(mfzq^NoZLw>|b7I_wg%F_XMbsr}jGVMUNkpc9Hg|n7EbD7`>_nmbP`~26{nXv_TM5Jn zl%$^VK+(BtG?gGw3I@SDNW8OX-GcN>p>O4S*xwR@M^@g}bpn?xticAT?b+8ej|SD{ zyXfoT;hsT{jO?j~>oNGKXRjaQO*-W=6uO^ohW1tKl5XBhLU$oR%TMBM{Wik;2#Dk& z)ICOMJ%U1-IY|RoYsy#Q*e3E3azTj&&@V!^0Q14it2Xrtn_C7m<&#=M6)_u=`PsBq z&S(=ZABLvYVHoLqg|)(0eLXh{)33$}E?j3ZJ(18D!DJTGo;jP2*%Mhk=0jr_Y^__= zWrC6q?}o|icI3%7C%Y#-XcfHWhw;8HO9ngb;Y*oB9~`$?=LqHTqhv8^C?saXj|c4*gr)s|?H3kf;_5i# zAow;4o2)V}UwJmC@ik5|mzfwi2SaOaU2*L~K7s7Z*6}kqc00VcW=)>#XdSk2Why7a z%T0MSkJ^gFqJab$vn;!J`l%6kzyz$BwDX;!PnYH2Efcu&ytiqj?uU zhd-txolB@XCuih61SnZ>iZ^j}i8@VLO&AGrixZI>b7pe~Dfbk$vG!*C4q8N8neG!j zmk~PL3AyzzjtTBo@Fa5+lO9%g2gOi?A0(%LF94kZ_Csgz{lutP20_(-$2t9QYm_lIsbR%J;k{Qi7nNvC4 zkS(Q9y*(1YkMNSE#FOw9IxsJ}Uo$>n)9(*@8trv8jrM>CF90FM?F;#86~E6b97j}k zw&fLe5?s}Z z`7!L=uB{dF_2Lp<H6pE~VZ6cLwhd?aB)! zi^nvF)toyhjQKxEPf|c)Q(mE?H6F#boC!6f^*lm5wG$BGO~Go~Q(1$%Xv|AMggm(* z4;>^}x+{nX-b-UZKql}QfyW8Z*8C{~-y%>n+bq+NIzNTW!|e(^MH~4!2=0vLxq?_M zu)o;OihuJsbH`6p;~0RrNxK^cJ`AV3<4&fcmXv`-~bFtg&j rZ)A-90On~uf^-V&wE0-b9%v124OR!0pd-*52-UO(76sjbytMj%;u!Oc literal 18122 zcmcg!dyHJyS--EDxidREJNxk3yK&Nq<2=?l>m&^=OqN3v$N|&EzJ6!d+)jDp7WjWeDCvJKQ}&JGVuH6<6nO5`#)+J|IC~Cm&3(r9Km-{ zc!p=Tj5^O&%UrkW*1BD{*PXhvo~!59^Y#3CpUPs)XaDXP;&s!Cvi9H9mL&1e-eF9;r@^}hx<7^oyOg~ zcOUNV!`+N$UN#mEzk@j&OAGnXd2u!9hQ;%$)AQSx{ch-9+~}@$+Rav&`(zszVeZQ2 zM#~S~3te9|ueSUJD=fXFI^O0o+lAB5cDriz>SotZE0@`O{IhX!8b|OF3g4)ko>8}a z+cQ1uZOgMg=QgkmtmeG@ZDYr*1B;$}+o%`3qF2J%^~St1&P8wBtKeMnCcG-nW8NfY zG8N`8Z>?YLw8Fyks=2=2RDjQEH`o2Ja7|Y%69WEtws4%m5mZt1&A!nv`W8w+h2G4i z1xuCjM2(|ZutO*CTPtbJ?;2_X58i$H#P!a)f8s{Vf8AFnF!3#ax!Va&ytLK5-f5p$ z?sQrwme)5-U&;q!D>6`Hrva-B9x(f*>87! z+=j&~TO0m4r8*!lL3^0%bg%nr82i9V)AJgQS-c()n}%63OI8Lm@_00)N6|ci^ibF8 zf;@N3J)l(_LLEdAmSZr<%jyuSA|TZq+mK>21d?wwIzZ%M)Fu#C%-(pic6>UpbfakS z9ac)Od(%hDZ#NnbavWKhEPcqMrG+wig3Q`zgr!Df9a5#m>vE%UbFC6dQMeG;`;!c5hI zttCY&*vznqHEuP70DP6Ah&X6`if=9`>F8KC!-4i)>&vrK2 z{U+OyWA^B)xMRI#s;_oS?8&olIKdxx$3Aaz9M73EC?oKEO5dsPN3iF(=DIG0e+3H! zDlmS*nlla>+h%)K&tteg8Y_Q;JwJ_i3asI1JLZh>VZ5nZq_tlDpuyI`%iS^0rHo48 z11?bidUB6Bqt~~(WzL#?rZDZ;z^~gK_loRcBxWn}_CMY_+BeS{uO8mE1$*do5PNT# zH^1?UUXKalEs~j~r9?`^0{4R?9txno@oIIOg94yA<7KF^n^sJ_rdF<2Xe~Ywn!$kl zAg8`tJbBG;`?ogKsYUk3&K;xo$RHs?Rx}!mCtIE6W-BtFS2p1%T3uL8fe*=`=MZPkKKtD~=#f34N5ZFE#^ zx#=})!MA>&)=LMk)L1W!yuA9YKWx`RW1*_0{1No4Xf$Yfp9?lxt6jljSUC66%hWFpw7Tbr`&oOU2K~%92L{K9EWw46`T!cK8jA;6P|_=SM232Z#fMmY zm<9D}I36j7Wxv&m6$EDqPI#1!M4ukT)x$Ufno6!&&bd#Op;Hy>mvJONt`vU*x-@nG zL^se0D8FxA>c;D;#?X7#a38H%IkiE}8cQTgaUz105xP>(Iay_Cc7yXF+Z$$YGKM2n zkEBxmc;+!ovHMYxEJhnI#iTl&^#4BSbYH5GmClSXn;9WPKtDKXzMdImDl^EQbSaWf zh;sy8svkplscknvjUU0IHI7Cx>6$aP&?0LGXwgOme*vjT$mGiIbgDr zq}f%F(v$~tfYzGOl(iJ*#0&#frlb{l4(9VQTW9_+uvlkJR|2G=7F2%V<777UL=8S^H`A*~wb48-`ZkrEV9 zgcF`KIAX5L#xK;9c%Ys|0V*32lo6-&m-sS!fy$_6#u8U}!3^`t?{2F00L7DCWYE*N zh*@3D%W5Eev0@%Hz7)Gj7Tlkw<0or&^u);+>GJ|Xw26Wb?>vo*5Bjf=plkm)F$Qkg^rmD<= z0_`5wqH?amT*PNSw9QvmXv>3rz+!0S;p$zk?$N zC%abfH#)c4g)-Zlyd|)SCXL2dGXrMl&kkTy3TDuRXC6WrTt~(n=_tl%ma*bM+iKhM zhvh^#)@WSwyXbel(fB>|5KnU^v#?2n(E~Faq6c1syFFs)QQfLThS?i>&r zTxgjjVBZu2QTN zB{+uwT?L2MSa_WLNIs`=1jkYAsZ3>00cuq5DC9i`;YwOaacTHtM?6IRQFc>EX{DFA z2cgsAE=j2oL{cM&WeyiNGbwS5s9L^(BPPiMF>V>2P1M)`P1s?Regd6@`R2xk-}Yi9nAfUt2-eVk z*7LqeSarm2%5*bQUEoE70a7Eb1XS{EEVVRQTk1UOWcbmvEhO?S4#!@g2X~=nx12~& z^Az6T+DIJ#P~W%%+k%Mb#|n^2WHDAD&!IL&kyyo|I(`zpNNglt!8uk4F{Ttrk^E;k zQmr8ojo$RoN>XzyEfhwwi3}tx!QL_>q{A@c@^ubFJp;mLEZWx8iHhVW77Ffy6%<)g zf7{G>&$iw`t2+^~NAc(PWHr)agp#Y5#rht{Y92sfN$(ZM8AzK{tRuuryRWSe57WX_VDZ-S-{7x_fcnqYmFU zPDF+JFG=@SZ!(@mqQVy{BSn*FYth>xpHhV`4*rnF-pAu5n*Wjj5E9p%;%-{zPw_cv zJNa?#PU9Ge1jZh)@8~@>$e}11;Ju^*U@fW=8eeAT{PCPD8Wr-$U4A4!_$%EocWL$7 z^==gO3&+~&?p)}`%06X6?V?gfeHTZ%gFpRJvj27uK}8~>9k>>G6qb4!HKM}z;Beyh zKRKEZk=2{YjFl|(fQBXl&hQOR9$_ik));Wbnx**(Z^DH)@yy3+57UbIB-#iJdkjxn z`7d@B(ePAe_$UM5{SW^5srNQGY4pD{gAd|)gfyl2S>_8fC^&HjA2@lQV{_o%lO|hy zpWTS+#jZtfaO4s0OoH?ycrP|nIyH<9GiA-XVaYXYw>3NVH5~1WlO!_Bu#cQ1ds64c zYcV;n7P}-@0ut#!TWSPn#fsfoTZC6;?9q-b1%jO!b`Td@k}WNajTAKx;azR{4+))A z)QIv=3j!+){qMMl_UheuuO6;}W_CPFew-(N15zd3bI!!phTH)^N-^RdeVk+@7ElR% zGAj3QC<%kPA(UTjU2X-UEPa7SBK6)uisA_ptY%cjUHN zKjb|GIrWG*Xrp!TOPHkO4e8RDlPw}_ zv0b`!@sb#fYLQ)Y^8^+c!ue-cm%Dq|CN#v3aNTJmF_kj@V>$tn?y6BnXd>~>!_Xs* zgku8JW!WuIXHk<_k0ks=3eh%0%93#xNjiwi%yg0dCFwZO>6Gu=cHdGbfgxb?hKuAL zN_iVeH`qU6J3Miq18fOX;MrQfZ=N*zHkQp^>Xpu|Z*;e6OmgcjoN2b(ovuzC@oVcH z<=48`o9$Ys?big@nnvIv!VTvDmii!zqby!!@lz}=viK~DSZi>ys)-_WxFAE8Y*?jx zm0h?+VsjSl4d@RC!Jv}GR1Q}XHA-ghP>j)CFCvLE$C(5gog#YB4bL%3qtv!kGXu5e zUBq#8MwnP7L)%Jxl@rZuE4^Xd!J6FNwXH-p2Vp*jlRC}otT7`-#WB=A%L!_rddK&g zOtAMBlg9ny>_0NpJX{ZmNRAaw4kIWy9gmE#*W8{XV;`uLa>!`M_eBh#%{ip7nKvwj zRM9A8i3BcvMJqE{>^c!0nndj^m zlfeV&fIpt`n%0cG8PHMMRKn(;-}J;*syhn#q{D+#Y`vISjq!NUc*kD2<}6wz_@_ij zqyjb3zEXjErS=_1r!g|Sd<}LW_?~+VaKAEqkB#<}nLmPl)n{0we4NePyvj!tNg;Gr zCY{By_97=mYcb(oq+Wq*XW|KF8z*!7|6|crKz45yt;b7)-QUMXLH4#6-Q)ejweQ!6Ezjp1BQSzYVraSkgXZ%;3`yC2c$s$c&7Uz$UTaStrDgTUgO4~gT3J!CG~&_0ib>P zPsQ91n))nShwdl*ElFdEMUOD@5PTQVlHx9Mlq@g^vfrmun9^NCw31%|WgbVe=+|Hm z+&WL#kT!dgi@F9Mf7?dAb88-VHtMU}xxND_kXy@9>fSv13Z;ev8^NJHC3WRj@V${| zBi919!C8dh@kNooEAS4xK)JW=?R?k0Q|#yOGG>&Q&m~@fgbSVLI^I@7nM58%)MXrE z5YgCswM4^Z&G=>OCURUe25QRU<3_Gm3K=gx!=W4S5AE)=8e43dniUyx6@b) zI_->_Oxpi|@Td-88v;jdpze(n4x|Q^LGcM;8Ns_{H8i$AjA;~iH z!pYMaqSTZbS#MX-9CncHtuAXcQ_~3%{8mZ?y@z9BTv46%J;_nE*;zqt;uPjuou(Iv zzofkkDkQbcf_sDf8qRCNSvkoXLQ&7RJESd@P=N;2R6RBk4O~pd|5CE{Fq`u*X(|Z8 z=)*OSAwItg;sHz%TOwiT?lMmmtP90K^SEy|cx^}5^dy|-=Y+SD{0JggyeOstj>xLHn6E zAvSq^!&D#g;7oatZDI)Kv>_|%@5*^VEG*2)L=I8C*xbCf&P{xX&lWcT%;@_UnUO5$ z)P>;LxKRZ4*El!I1n4uf3XK8IX14l#JgeQWB<9tC#ju7hI6H+eK-6p4!-oGO>I3tH zLvA&oO76&~k#{YyrnLqK9ggLTeX0#>4c~?6J(3mcqfj;NN?Ol*8koAz1Rp)?@}pN0 zd}A77K8ubZ^0{}8#HN_4Poqk+T#63&WUIM;)oY&m6TJOBG%$L{;%N`#DXS3lOJKd9 zXQ!kP?WhX7y~bMxXM_)9Gb6XsQTX(Z6c(D7>(=GV!@yLBNBlZhMpIo0HUQBpngX_0%@&1s{T$U*v7dPYL3MMIYq!4xPwvKNhl4T*n#jJZoxT3rPH_96*>hIR@nXS$? z9rMeGX^kV+#Tb`^Sa}6C6Mi1Ou$G@Gv$pC_cu*fw$B&hr`lL7SPbKY`jhd@ZBfphz zF(cK9K1RMTbS@x|YYD-b6~G(X8=W95wK|;}O?q;{GAWh60desJD*9j=utyno7xWxr zFJK{*$X1OqSYd}n8LVgtQXdL0P~=i=iMAv$n_$|2V2(C3ACE)NRZ)x6zMZdiX)2<0Gg%}<{>jE2?tLo?Y zAmuq(M;a-AOQeeR1}R@PXCX;k^ANsFf^0G8&0aY|@a~NZF23NG(t-1e_t@^4GWzY9 zcHn%*3m9!luv7kcwsFV+$8kXwLbD#bipRK6xJDePb1Zfp83kH{3z_aT3Mw>rCA4;r zoyPAFuslXHV8WKo-dHsGUHgorF9D5mSko4OBDL5n075hj2>UraO(|cmOEyNAO1_Vy z<-d(Ui{5HPVDBs%B;<{Tf*}Eck>HfP2||hkp%LLM5{gjAK#(v2AS_=9F8TPN*5{P} zBY^}aoZuk)bO4NGksiYU7@Xk<{kfQJvup$(Ofp8ku-9mYV{9x1i_T z$>74=;)PVS7s3qsJ^YZcn5ZCT=Wjwt`)w^XL||;7KMOF5;D>jt1^-LRe|^>e>5SY@ zT;o{qC)B4grr8jV_>I*K=^pF;>*!m%7lo)pl6bU_I2#M1=+VF`CnQL7HDyL-)H8$K z)=QP>mpy1Ke}*=)a^mShHfi?P^*R?`=;6Sy1w{cE+NW6P`|Co*!4`Hj9IXH8b|q9?7e4rMTbRyL~$RlF0tV3 zwP7nBmhi<0xI_1({=W`R0e1b(ziZa4vR!$gdagQIb*s6`la<-22P*T``O4>v{yrU_x2hEO9K^HIKn32qb8QjlAev;nK_bh~#Pue08D z?u?7QT0fu!QIIO}@c>9Xq!JGx!3)nkA|WC156lY>Jn=8|iQn(snc3O(Bt@cY-TA!t zo^#LnosWCQFU-%^9sK^a{oA+xa?)}B&717!;bILfdKrfo9qnlK0PViJ!8=!bxbtwQ zaOdj^?kc!*aaYwdxSPS9hr61d#oa9Kd|kikEYEc?U;guPwT2e`35U?xP}Wr}qs#|Ddu_OYfTc7~amNcMJMB?&^9` zpLpPG%;_b466c0KrBCBLub2vxMI4|h)`ja>x*Dd`N&Wrj2)^Rau zTpRS`cDEmzn_)bBx8B0<=5E;OwtKBkuN_6Ly(rYJ&4Focwfnl)?cZs|TVX5Q??!Rh z?}V+vW-Hu{y1hZa)$O<1ttgE7?B>DFJA+)Fop=zfym}CC4f-pc!JxO&+1Xv$ zi@R9B?mL<>a*T2N2R5^lw2FKl%; zTTyoywtfidcc8pGq0Z;KvfDQ89Xr{T@tp63t+v+1es;nuty}4g)O|M&cVyPdzL2@s z3;TvEO+36?_6%i}RD|b5^+o*lFoPFn4hI@~`4ldoT?ab0Sf#EV ztJ(EsmBLgcWE$w3_%OG4nvXdkI5dM2N7rh>MZ)P%LAlw$%&H2P(B|a~$ui zz+5XZcAgehGj$w+rSdeoL}Gzzcy>Zkll{uMq2h%bhzDmy3wBOfwPRpVZ1f9&E2FnHFXC@?3>?Qsd zJ#(KcT1ow_c&nHQ_U^0GsT}-*U3uMp>Uovb(3CyR1Oa?Q5PY`4%hD7t(&5o;XqBNC zY`B~5DYD_N4=bOFp8Zrr?*sD@(O9TFk`Z(Zf|bWGA{{0e$+c0#FtTw!#ilZ}N|-Zo zJgo)94HNEy*cS@KrlW@KQBIAz&la89g6P{W^U+iR2~hpgW2o95>9PY>x+>8 zgGXE?8F~cSxgh8d`oqu+g5ay@Ru1<%1) z_rA4!f>}Yoy%PpOQV)Wif!^!!8kTo&uiZ=E0QP#&!DIg&WEF-}OVl&RcqML)&Q*Mg zp{*H)4f6yKPx5e#Y?Cf5>&UwjE z)fqmM4F<<~c6WKTH|Vr`(bdc2K_FD=gFuwI~FA(Sajv6kN&7T_uGZVsv zx`|%J;U~_f67kfmcn;OU#gTdoIpm?Ye`@4iryTr|iwNp7o4j}7wsYI*FZoWa?$*uA z3XWYlKXCf)_e;e}LSG~?f)7GnI8^T;=#11E=XDIc=VocPGIZitE8~j!46lpsPeeMq zdME6M`@80C$>f(#hC_Zw&t&C5}X%2hR3^dfVT<44%Y@kP_1AVg2J#}tqd#6$IgLs$aM zQ-I_E0VG-3qU`F2fa13E%LyFL8L#C|L8z6&^70hVN+AI`2Kn-f5O4^w7)cN*ytzNGy$8u=s7I58L-fhHqdk#6!dmUEiJDc2u@^4Hj!X9 zR>&sCJ|Gvb`82w`fEF#_P*X@4W*dIPw~2$i?chcJqq(o4MVxv%VL+WqQU)XkY09vH zY8vWYPBB@4;v41}3@^tB`AGN8a1ezWkKHR*QNMsAg~bVCn6XYFMg$Y$d0MZ*e)(jE z6=nl@L@!4QU5j88J9bG!nTWFD1l(H8y5=muOTo7Xql1b9zn=Um@Qv_nMV*yp{O5YDW*Uyhj1$I zkJD843UsFRn%T;1sjYksBSmYHBYcEi5TKf*C=b|$->A|iEO7BC|K%2O1CMfxI4+jJ zO0cBPs2*E8sH91AHBFjl(xkbTCe5>&X~tqwyJfl|rMG^gL!k4=bM8v%494Z9KrtN- zPaqfyq}JK$_B0GBsdNT={Wz&?cKhw#vTv>G8yI3i zzQ(I5XfZh*qKRl6)T8X*@OZ}a*uuyze>`*8HMEGW0_ssW zmg}W{ho}=Y7%JE9^U3_9_w>Z^0h;V#uzQ)QiSrQ$#CH^0{_}9Ph8DezL+*fNJ3ZdR zr*0_Sy(28!z57gx;_O>g}}^_Dr0UNBp(A@R*%5SwrENx6dQFn)tJ{_ZkQ(nq}uw-t1b!o#b$$m+Lm zxUxsS1aAT^e(avXzU0kQ*eiRe>&jjkuF^l_9D4W8-3H$yFOW*7?`-?p{R-?qb)(+; zEwhS=;YZH}WCC@c_I`I~ZwJ-Zot;5Hzy@!#yKhT8Yv^eh4(#ge4mPQA1IQ0&Nu}G@ z;eO)x;ok*#( z1wF(ECMgV5vB)%uQRX}7mDct*W;5QRL>(z#97D(7b6ygV?_ZV$`w=8JGHPKKO|fdYZlNB%Dp$8@8ivF zC&mU3$dV^8w^Sh_=wvqR?;)wd2Og2Rc^>p_%`&YYyo3kIOlQw9drVZfOzs<}AEDMi zV6ZqTMmt+kU_Ak`<6Mf!QZ(eEq2MT*4(ItU4ykA^i;gZGdIt@N!~+m1ghm<+KWBsC z9cT;!Xg~n&LkI*PB;097>07wTs;^`I*a~fYNSxf;{&~z3qS*e=#U?`EJ zSlSDMf0S@x-{e5y%E`qwc5UI1abevzK8}k6LDm2K$lFfq{hpz#v$cvfTxF@NWMZ%I zmEdC%6B2v>iI=G>V@WUtz&J%&Uv8F$ar#SJy%);2aGNyny&>*)c0&CBfVNtp`fT0) zHC{Ys$4?8IgBA;HrcLdmpAZPk8| SxXMw2_2%=<3(b?w^Zx~pjHu%P delta 2483 zcmZ`4OKcleaNq8FcfDRawiD;$q=}QXNga_ip-n5I^aCvwh1R7%wRKe%%Ws>Q+Uw+b z15I#hszz#s5Hvgqfm%d*LfnctATC7+#07*naM}|UH$(*oBoHTNp5uI4*wvePJ2N}~ zH}BrzFLn<;6AqgaJYN>yf9YXFl77LD#-qaK0IbT<<-xS-kn76w$+6`v!P*iK9Vttw zl$9x=@*P4IsxHY{g$Ag$BxO~qQv+~-_EM9EmPl5k77YVMrxDr&*q~7w101Ar+6>sF zEi?f*L|bVaV2ifX4!~iWq@92xw2N*5+(f%+M-ObGG<8Z!_xaYrvg_pvuES0_9{+}X zLS*jB{rrJ)kiVsjHeq-g27y2#{5z$mhJgiO9fVcc3V@PD`AV`%4oMf|i%M0lN-I)T zxl4{qi}I{_R;tQiOU@il6NdWIDnk_vb!4^tbk3b}SO_U-qz-i0`I>XZb6kq7iUB|( zDlrL(^P+m5g!s4WHWK5%scvr&cuWD{YjZO+=Q(LbnD7H-Z`xtZ;=O&%fhY*H@>_v3 z@g|g)0i@-+D>438ppSI&q;?^WVl2Lic|+?V-TY&1nE$GTCsV+KaHUry2spYZL%`&+ z%nS^3);KFs3Bn~Ah!$O1bETB?^3(6?t>fmUf=g}j*$V=zp;^R$ccE=#K}Oak`Hy;% z=k+8B@~iq78RYl$n`8)JCqHeRAj7;X*vY>#vSbu?Cqe33O9#Ih43nMwz2Kd$7#Mmi zy|(Sl+V*aqF^3?L^XAqR!!(N`u`upLqSg|^n)&zUq1GseCb4 zsf?I{_F|6ZN{;8SiufE}d&Fnaxl)@*RXirXP>0YkSV;lLDLEs8?x79ao1bweQqQ_` zrN@MkRTpL55KSJt6d%OcGNS7-1yxd&Z0K!(q^bavt2GsnLJ79}!rYqbi5YYp-Pr8k zD*b<5YWxSsb0Sr6y+;-1%f-2pyMeVAg3hE>Ujb9Txvtk&i=e~T>OZ6d^`;+yAlM*+ z?FiC%Ncyn>j=-vSrLGZt7a}5+Beq>|3m*SLZy&$|f=A#soPNOMw)CMQPWgg7k%D6- z^bYXZM0flQs>9StWFagR@e{`LZLAY0=Qi-_M)-ZBwT%E-BpL@rJ)fD=Ov9$0@{K~p zel=Gt&TOzS(_HJP%0d1Or-&=NDV8JgVji3VxyJSlGyepb4tUUCCp)cs^mIO zVHiuRhOqh#L!wxZ3}4G*Ik$4De4LeRuS_>M(6PyZRWTuz$GYKz_`hm+Sky3?9s>Rp zta?oH!seLPi>UKI;)&1*NU|poh^ll9!}euZ;!=XCi4{Q_R^+o|Awr1Dk6Sh=@mq-& z{-^`)Ub2gKH|-$vJk#`3cmjkQ)-1jw+D&Ra6FrbdFT||} zs?n8I3xKf4m@u>tb~XNabev4`htYnr$YZhRG;zUALi;BJ?I3WCUyU6Blh@k2BYw!X zryQ@~IVIa(;(x|YlKpt>$PExm@;Bl~$(te%58_*s7)CvllepWD02Q(We6qDKumiS5 z{z7wy*kL;P)#m+hrQC1cnZRq<*I<-6uGeUskhoZ}L*L=uEf=+?QP+g<6O+LCO3V2; z?ig|!f5pUK=*tJZKXDAMa`g8OcsWHr;(sTe3W;Ki|Ms9`YEJkj5xPe%HqR;2G=zIh7n diff --git a/cmp/__pycache__/visitor.cpython-37.pyc b/cmp/__pycache__/visitor.cpython-37.pyc index 303cfda46e1cc0fdb3c89982a37a5a39641d1e78..e36348575d396e2c9279fdc1c8cefe0aca22776a 100644 GIT binary patch delta 43 xcmZn@Y7^pi;^pOH0D{Ojvo~^2VPm|tc>$X{BdZZm=+@*n?3IiLlhZgB008nb3^o7& delta 43 wcmZn@Y7^pi;^pOH0D_L@oQ>R5*chWWFJN {node.__class__.__name__}' - child = self.visit(node.node, tabs + 1) - return f'{ans}\n{child}' - - @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(AtomicNode) - def visit(self, node, tabs=0): - return '\t' * tabs + f'\\__ {node.__class__.__name__}: {node.lex}' - - printer = PrintVisitor() - return lambda ast: printer.visit(ast) diff --git a/cmp/parsing/__init__.py b/cmp/parsing/__init__.py index 7ffa0864e..8e12c7110 100755 --- a/cmp/parsing/__init__.py +++ b/cmp/parsing/__init__.py @@ -1,2 +1,2 @@ from .parsing import ShiftReduceParser, LR1Parser, LALR1Parser -from .lexer import Lexer +from .lexing import Lexer, Token diff --git a/cmp/parsing/__pycache__/__init__.cpython-37.pyc b/cmp/parsing/__pycache__/__init__.cpython-37.pyc index 04c6cae6d7d9aaaf4ce001e758cdd410d7c44fa2..534962959f92f63b330248cc7d946df79d841bc5 100644 GIT binary patch delta 75 zcmeBYTEN8X#LLUY00cJKGvg8_@=7vlOjK87$z_XTo9JOJ#B__*C$%EA=oV{8es*e} cpCR-ncrwu$Q#0K1kHRsaA1 delta 77 zcmZ3$)X&80#LLUY00e=7GvXp9@=7wQOjK8#=wq$Jc#G91wIa31Pm?W*y&$ouI5RK3 ZhzY2&h#5q%0Et_yIUp59tP>9;007CF6UYDn diff --git a/cmp/parsing/__pycache__/automatas.cpython-37.pyc b/cmp/parsing/__pycache__/automatas.cpython-37.pyc deleted file mode 100644 index 0e5f3632f10df0323d04d1a18e4b6f5ebac075f0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4269 zcmb_f&2QYs6`vuwTrT%hpOzdql>;~N7Omu@srwPdb?n$_&_XpTqiTt|YkG&4cEu%E zL&{kRxwF@+GTcAL1t7Cv5e}GR#&;1K{Z7(_X)`L&|z2WXkvE2qJy3!11hV$|G z-uwODn`_mo&G7rn>Yso0&soO)PMyh5N8>6=6rd7JaG&+K!#TAzU+d|PuG+e9^a@S^ zZ9^1%vsZMAJy^ktSBTP%3ZU@_md z<@=n`U#tz8!RY-u-v5FH+Rs^HjPyk78pqJkp1lQq3GE1TMulVSJmmN)ePb#FDYuBS zNkUvewZjs2=iD!~l&4yZWnGS<#n^Jlhx#A1J!6x7!kUJpm6_d_q1bQ7oiNDsei&tX z3u;<2ZwAw#-R$9jaq}3~nB(a9dWQVWNi1eapbzNyXy0SW* z*EBQpx);Qr%&Z@I2REb)r7V;1=6+wmsF^*LGRg`am^W$`RmoeHVndwLNH&95C(LGcN>oT&tV7pc{ z4;%7mX&aUyD?es~3ke(PWWzg4sU90-^`Vv;kJzY?N#5u}4>_PXDR za_hWKyN<1M)*JNQK%BD8bXv2N*&E&<-aP2t3w@{hVYCqjw>{bG1gK7hws(iiy}{w8!G!|gz7!4?ueGKagp6Y|k zi7v0jYzWK_&LtWwI-kOZBOYr>A>l(!VfWQ71`g24wyC~X+hVXeKnVP58@KUMq@4_c z#aY`KucMLZ!Zb}`u6^}Md*JqU>7_y*ki9A-Ked84BE+|QMQ zK=)?uFS)9evzOMlJ$O=IUb#%?(4hvHXgiEUQrszTpUi9O@++8?mF~;%&EIwM(YMKhMqEn3M_{8u zY-6;5GYaULiLuSoBHo!Do?3%Xlj0LDSCitXjL23>tfYjU?Zoa@((>T9*t?2SJ3}0I zm{#I?QcfzOAWWQAO{%dqB=h}k?=!?iE2&~FP!U{3Ol<7h*m-Fj6-!A~NmEzS)N^SN zC$R=`vWD|#k}6?r95LF7eqG+dBgGOgKhyLlR9NE`K21UeA?NUv&4k zdlVbQgd2$pZ-X-~;@O|Jf?JEUH3D%~e9*zZo&b^TONp<~s^dm0m$W|VjtNA$ zv}5Kd&Fq|a)i)XB!_V{1+`avdF9FM8xFcATa@g>aw2Q{<`pXD|pYfUq`rCAuW z(3&L{=9)&)wgHY>M7^lVA7JGa69hBDgyJX*ivIs#VuG3zRE$c;Y>W(>FfztQ`9EXh z2_HNFI*6Q#qsnvWsHSDS|0!VurB3*G!tY!KLK>$L65C_HFT|E83JY0ZbjAmDR{3!ytnrhIRAKz^XmVE^A{pc1m}t@EngxK(mK&;=V{%qCvqX_ zZho0u(^W4BHb>hK&nUspru-3IP@t=2JnvI{M*F`D396+pI|<10D!LC*CTVBonk!b6 zjOWjvZ=RE1$2+Hz^W8X_zl4+JH!$rKCzEnch*^GnDqSDv_7OK-k zj6@K0oD(r!b%=-;ksR85c1*?~Y_w@~3Dj+YoNfGpn$c^ZtZ4EE_C!j1ld>@U*PRM( zf2)&QUmg!@G}J$!J66Z{q_U4wqQU*R<41WkE#z$#Ue#rR(sj8)m5QvCAE|(#jyx58 k)ZH}Ct=4LaWrv1jh0SgGnxBvhE diff --git a/cmp/parsing/__pycache__/lexer.cpython-37.pyc b/cmp/parsing/__pycache__/lexer.cpython-37.pyc deleted file mode 100644 index 480bb5917b9b74ceb735917c3a2544d4bd45f920..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1681 zcmZux&u`>36!x=|Or}g*C`gn&te`5Zjf6UTtAs`c0TLHfRa$;XqlGAqJ#AVinK~J0 zM;QreDzO(1To4i<%^dlceC4$NLQlNsbh-uBk)NIS?Dzb>_t~GUudgv|Urm1dZsalc zH~p-dz{$tht4Am#lc3pBTxpCp>uI)06pBmZq%`X&I(nOHb_f7 z$qVb($+1?p7avbDEn}lj)TQl=le$)>utJq1yIGA@nk71}uJYqjSCMDEO6ig5pjSf} zo7YhM#mqW|+3%m0x$2*5^}RCvBU4_fv@Wau(N%p~7X7p=bwAC={c&QdtT^dwN_=m8 zWy3hmimZ-f@>}&#FbMG5f*#80hC^s?wJ4>WsB!E*b_dlCP9!X_kWySTgawxDGd4$P zW>E7MB!t8}yn*J<0|8AjpJI1}IKiFYK77V!fSu2TWDWdI;0u)ePyZKw;SsP?@9{@R zgBv)wfygC~(D1z{)=zYnR2E|EJ3yVS6&o1iW^JIes!q#%eDDUvq!a=+eRP}Qy;AHA zbeSf)I>5~wdR(WN)QMNDK?lrF0T% zw1_|@j#q!6kTBzyKQ_EZDCTg^%yk0|e+Pj&gY&=)Xlym4n*%Un=suhAivVr>4Ec!~ z@iW5Nh=sRgjX3ksLe|d6`AohiwSq0Zcb!jljJc;d8b?sFy(Ob(i>#u5?tQ>zlOc0~C&~yU)BC)@UYX9@XeM)dTAz8P-EI z-rTz-Ex5-3c|x%rSt8$%D}w6MP!3j@@&_yMg^0l6@G@odHrjWvuQwRJ-mm1&N;hxopSwcyc?SGls`pgq|E5z<|_koUwt&J%9K diff --git a/cmp/parsing/__pycache__/parsing.cpython-37.pyc b/cmp/parsing/__pycache__/parsing.cpython-37.pyc index f3a5e6c6cd9428bdb9178599147ceaa33ccb927d..0e9c9faf680a2f77d2f78febdc366cd5e86d9fb9 100644 GIT binary patch literal 10392 zcmb_iTWlQHd7j(O&R)1&Q4~eVvb>gMMVls+?WDGo%8GoEY}qa?OG;!<>x@=ALu!|M zAKO;O5X02x@EVFeBO87)!Zq+;1}_( z_$9xL_q0FdSMaX-(|#52L;fLu2JadFQU8cP_pa_9_Rsi7{dweO{V(~){NuO7kc^?4LsER4|Xe$54L6KaKL~;26rs z{lnL_`q@wMy;|K!tj2oOPpnJ5^=@5HtXErMgm>>!D>Ep2FQ6l1-u56zoeZ{E@(W2LCh>Kgxi)V`_pj5oB{ zR8Pmowz-4a-eZG>Sbsr#>*Uaiwb(kQ4RdI-;@pm|YjLif3ol&N)-K%CMk8VaA7dhya_<=H4wt=sESa7n4Ya!X+lc|q1_udn*}!lc?vzbhQI)a}Gx zYN;>^lU$>-dZ&?;r07Y(t;)-5jr%8dxY51c@3`f(TUz>CO;xd-d*3*Br{4|Et#pF7 z19k4I>Td+is2`rYx)I&!_s%u@{m!{&clF$ALxrv0^60&=x{(}i_PeXtyw~YB8y!z( zpW^YJK%(ikVdzD@q8AMdPf>SJvQg_8Y6k61oxSiY;VIw|%KQSEmNwLJ`o`dRthF_q zb#-V)dTeg#G1BweTJ@$jm`9s|w#v|o^eqi77Fxc7mb4@5bZwv1shHsZpz9T#`>*T6q0 zIlHB`t2ec^i=e#@nwyI^F4yx(AqrHt)oXM@p?@;f>-W5IT~bZL?~QI&B#iQT-@=q(4XGnyqSVa{=(xI1H_zoAGGH=mOJ4OQU; zr3r!w7o^D{wpB(%l@Z}1s0+^^(R53il>AJ%y_C@#u{l|A+1|$ zgA-oD^E5R9xWNK9d`gzDPpMhFQf4qOy>>Y%hfzaCUMiRB2pXZ~f~CmKU284hiIPG9 z)fXr#gQ+XwV!wAI<0v)9i6~5p$E+wx^@=*myl_f>so&}J-wD+`s@(Df*+X@Vy^b?^ zfQhh)llJ%CNc5KLq#N?ybVt>1y2X@_ZU@*g)yD+mOph5ST~mm@fIcbbkY6g`o|JP^ zJurikqZ@h^EoTjK)p0|S*~Ypdhr(DlP-{~+46erHo0lkk+uDvcG)0%jk8=? zc;h#aOL8sP%CMeOq)U=-O3yH{SPiw34rI@LJ4u|;nxsKUjssOir)TmH%Bm+&JC=P? zj?je%7v4q!$rXL+Yb#DTi__P``DGkY1p53y8=Q_cT3FC^9@^d_y`XKa_q6R?oYLv+ zP3=9cZL7s7e^>v$wgejinnCv44k;!YcT6vy6_5QemnZixlVa7OPHOp>Xv_Q)W6dIk zlt`s6RH_@Qj?Rg`iu&Dypk};RJl_HI;6YsYK4(pr*gOsbHG2L8F~;5Mg`~I`45I5| zf7K%xm12PWRTaG53f|c#y8r}X7%19;)Cy1+fLefrsX)6Wu)|1GxOs4a%tCuB6dP?? zG`XE_Y!i(c#car#W!TWvu*=Zc>M691DaPaCBZB)XGB_&j$C<_+JP95AoM0wva3VH9 zr&(B4Yg>RL^n6)8WlnMq@DaH( zQ(VnXKU`MHE0)$m;>KCi*HxIg}TMd zP4Xpwe2;nbJPNT%&IE@R!r2H2a7(|dM=7rvz6oB-bi zLm5y_`i{0&vl!|((bILvV^@fRQ|^@m0xL|TaaTdBub}uBc*c5UxgYg;UK6Z4(l>Qe zJ&CSKVM+BjgB}!?oE>zT&`4%3vqNd(n?@`st-^xNXo)}Px@0a5gqYLS1?0wz$F5@~ z|1_kLjMs)f-GYd(7~yfNZb_M7tqBe&$awyrcwX6e9Sh3yG0VuR~2~YVbVBp}dwoZ8yLp&){93P0UWvOG<)6GG#^8BRn9G zP6Ssy#5z(@QCNf{6!pBKmK9V(1Gk#wFcC};i7aL)u^X$akoct1@O>{*jb7NIl1r?` zMmMM*nm{bo6bns2*kW2ECW;fQNPPnnCk48N-A06I@|+ybNs@oNg_#3C$*0&Qg#K7p z3SXW~Wf@QQmQ0U|ncfg#aqUz%lVYl7`4x#p9^P*c58qyIb$kksH{QmF*j4y65>20n z%i{=Co)OoF(8d99cKC<9s9)U>@LWY{4iE_7`5MNKrD6sJN`)BEfBt`yijmyx%EfkJ zN6TcRNGZvrqx8AbQHFF(Q93@*2TzN9d;&hL?30h_VHxeSl#mbfw~COF>ZFWB#f!1dFa{M=jnc;gmiVH)yNO=A^twLQ&#KhOjQln}pwB&Ri)sm!Ikp?PJL7UuH5}`L$&BKEolvl>Pt=M}>xi z$at^0(A8JbK4~QOv9*|pe?gy-i8!0Fc|&z382tcyv1dC}3D-Fbx6>MLDBaSZ3F;b| zieIrIU@pJaOflELjrL`0oAqC{ukon+Hbzwyo*HfJ_)ve3s2^u_4DThHS>!)|lTe%I zFhP2FG+v5d`|o%%OgLVY;DY*6h(pT>;+&z^fCujEuIB&{YsO~Vd=9vDFVQBv2lXY) zAgB~}IEATA*QR3h8rl2yK@|OzJ0Mzx^H6@S;n(E!9)9@Y`cd^QPFZ8}1r$E1b&%Fq z&$8h;CZh8NBM?TW+TZFy%c~bqPRwPvJ~O-eUR`Fd7n!`ogqmGlVe&GQSC|lrs^4a^ z$mBI90x@1^?r|npk+@T7pv2EmA_3rtQY2DxK_;cv5QvEM{R2YHfzDsI@Ej zE9x_Fd#Je`ql&x%a9KeJq=-N0aOnIho|>UMu|RX-g}87#T{Ez@ zG&d)y?Gs3vN#)gRh-NNz!235gR)fuFiZ%Qg0j(|dVbvRIr54=@Y7rW1{iRw*eRZkP zZFM$k2o}n)8sl|=l5vZOLOGsCDtKN}^t>)2P95gUp0~E%=wvN<&-43D&r{@;q?3{zVCE5jUqUHgBBZb3=bnJD*TR|sblqA>WDb}sT3WLtlo(7)a#PoT5orulDyIWcq^%=`L>C1;795TWK3n>a1Z=EtdiU%0G8vuVc(DR@T z06%$Ni5s92p(nF{dFinTr|L~k;WGIhCftDXnFw`u6QPrbhTLdc@O4hHW)GE2R9wUp za?VLk^$k$RbaOsv1WMVy?dS2%2To9c6?Fbe7yE3v#q2Jjl-(tiv%7?;>@J}q5&qfa z&;(aq6^2Dz|D`LJZzT4$OD}x;`AdoM+ACv3M9On-&vS1*BpLPL8TmSFEU1qNOd2}W zJWG%cLx|QE`NKwlA-@Bvcn)onSMZq@C0~*hn1%=+xIk+cY10wZ(}-y@+R=rb7Tx7m zpB(|}3~48&F~s&>Od&JTbC?_aJ>CFsZ+#>&T^lgUZs*$$T;BrRr|*FTMT{>o%Fr&uLIZgE+LEzj!uk2{ z!6r!*+dEvf1_y4pcV7BVbGEGaj{v(~M!56g)O?*nE-_pFK&`Njy2veG2~!11Up)=IKFr1%lBD3N zU>WfxMDDt*6kqEOTS~ZJ8Ak}0*+#EleTT`nk+{Vx;f+y5c!{-SntE}9AHh?VN4%vA$1+aCKE9^=Ar|#@_~mkG08e57zn-Cc2@m3p02Hp=zzk%-6+3(h zfn2g%4rq$?=7*YZ{R9_Bh#jEEsP{1q?8(a@=!CWfCc6s@g8nitzid9mK&9#D@J0|z zdgWFOApBc#9wVJ0bjPwD*>Qos`cZ8bQGvnjC=ZWGYPJk8<5l!54a*2o!@rtLP0ipJ z6ys7!gI6&{j|fqYpJVSfJfi%Tj$P;DGE#@>PY~sR&+zk`+Qtk#kP@$+a7Ce?*WkI# z!E-5#=koQ`bIClD(K$g_@YP^hoK^*2$;%BLP`8qPW%hLy`MLA4J^1v0@!LE^eGQ*m0+rvawR*LCdM%AUoJhHRw`JFxubtW~pIWG08m!`$ z5mB+tGDd>w0ZIX5KBb1=Jekd0gDCVBr+&N9Y5BEOBi8EGq$o_|iR~6)kysUC7y~8z zFG3>7R>aUjm^1(y@&%_RmI_uC!UvUuxLM1|{hZBHxuWlwV!{uqm^Da=rzK*#l zVU`3C9OKI-Zq{@J5g=y{q;6h6rGFWqa|Y@gH>r@kS!p>~d8ZRM1wde4L1uWWorlUTe!5b&(tV%P67 zAxd*?NWyyXc=mom+$+S*$)rgxMFr+cu#x1XU!wQaEsiD2jlM-bV+|ENs}vAO7^LnLs)S)5vKfOtWJn2 zBI@XhW%*An%KBpcfyClJUPv@VnP>x8-B<#h)oc| z5dzBo50bvbIiE&+2r<(CUa0D21h(YQcIKR#Q+Fy5$5PQQo-KZ}>QqV^*U-Im!s zXvv;MN}}-xMK)2ZEdx?Ai!828O}ny#$6HE{P<$);5cyf*$|)xFkYCvd9s zP4ELhF0RX->w1^{==Z+gv^xw+j71%Bv>y!gn#JL3NOVQz8V4i#qd(joXZ)ZRII-q0 zx8^)I&eYE>FFF-9R(;2vhhDUYjYx1Jz=@mXjoEfHs8&lX`gY*$!uouLLx1%5z_93J z(WdfvA5|Q3MDj$+LR<616IdnG-_U;}ZJ zNOt4!$D=#L(>v<4i}cVWmHrhR{taw!$s4>YB=0IW_|iww&dsx#tDy)p(WjfoR_4R( zdC}Fo#7EvRIGz@$pPPyv9jnbCf$>^pmBVu?ktk`$_D74BU>%Wz)#?% zzF=$h4)`9Vc=8+?q-iNZtr4r#y0JRv$z?o(Yr$>BUv9%5G9~2 zs{~-EOq-fo_Mvg8;k2ElML67H(a&QC&+n&s+LWa7l{~zNe5}-@gz=Pf-B@+;lqP@+ z7MT*%B?xD0muhau+570bFV^31mXi`!G{nxMTZe}G$d*pkS~AJGdKMKPi!N`yJwQhv zULuklU6H0do#4+7RDaB(>1`Kzf1(&e#V0I^x6KyLB3pT6y)T*Eg__S;G&{cY7H{xk|6lOZuQbsrTrbuD}ppH;1C5 z+Yb(oqDe)841OR1%0xl;2f-*g{ene5ZGXMbHrG+de>(e{EZQ>h)J5|+r`{R#^f`{T zi$;N&=-R~MT70?+|0n*}EE=DDru0Nv#%QJWbNJg=ZML7`8nhnaoT=SW3542qA<}BcX;9tWZ@gEG?`+-HKhQZTN`N%(R*8WG1y; zXe5t>2;4Yvsn|SJbV4iVfD~&kk?e8EHz+Z`1lA)`utTC8en+uO z=L**1y^BpnKOx_|QMrmJ_cc;^@VUynLW0Vhcw&2>oNXVF!6Kc6K-nd;8S{vEOObbalgWL!w0ySd5!$7^5Ar^jX9k8POM{vbR?I?q1njmv4;dz`1=rM$P#%XvDIrReR?<+v<* zqq59aT+EOL z(0o_}#@q0ZsENXeFhKx|%M)xeQc={NU92lIA*ghxawJvGf-1-@a@IK@7i;h__}Y~# z>4L!H!t*XXKPtxmP8iNh#5jnV03q*dR{2!}aXt_W<}r2+?3%#+E#U3~_g^jU<~|o5 z6R|}s1EgoP1*<~ERP)kT;T3%V_CO0>XlMHev-N# zt_oCm!l1Q){QE$@3FMzVM;^Vv_!H+g+Ro32S}-u7wLGyK?CMy^A(sRDD*4NBYWIuuL~8HL>~t)3 zGcC@iDL1X4bzkh2#iQqp;x#t#lP&H8~&XmHeDnveRS<3jU!ZOG3r49C2 z=GZ=P3tB)K?ZC6a46D`|e;X(Ex}I*L=WN!!rY@EJn}%L>#Eq}ldDPquwx)PXdAe=t NEKEsaCs+;M{2yUEj~M^} diff --git a/cmp/parsing/automatas.py b/cmp/parsing/automatas.py deleted file mode 100644 index 45e33c5c8..000000000 --- a/cmp/parsing/automatas.py +++ /dev/null @@ -1,150 +0,0 @@ -from cmp.automata import State -from cmp.pycompiler import Item -from cmp.utils import ContainerSet - -from .utils import compute_firsts, compute_local_first - - -######################## -# LR1 & LALR1 AUTOMATA # -######################## -def compress(items): - centers = {} - - for item in items: - center = item.Center() - try: - lookaheads = centers[center] - except KeyError: - centers[center] = lookaheads = set() - lookaheads.update(item.lookaheads) - - return {Item(x.production, x.pos, set(lookahead)) for x, lookahead in centers.items()} - - -def expand(item, firsts): - next_symbol = item.NextSymbol - if next_symbol is None or not next_symbol.IsNonTerminal: - return [] - - lookaheads = ContainerSet() - - for preview in item.Preview(): - local_first = compute_local_first(firsts, preview) - lookaheads.update(local_first) - - assert not lookaheads.contains_epsilon - - return [Item(p, 0, lookaheads) for p in next_symbol.productions] - - -def closure_lr1(items, firsts): - closure = ContainerSet(*items) - changed = True - while changed: - new_items = ContainerSet() - for item in closure: - new_items.extend(expand(item, firsts)) - changed = closure.update(new_items) - return compress(closure) - - -def goto_lr1(items, symbol, firsts=None, just_kernel=False): - assert just_kernel or firsts is not None, '`firsts` must be provided if `just_kernel=False`' - items = frozenset(item.NextItem() for item in items if item.NextSymbol == symbol) - return items if just_kernel else closure_lr1(items, firsts) - - -def build_lr1_automaton(G, firsts=None): - assert len(G.startSymbol.productions) == 1, 'Grammar must be augmented' - - if not firsts: - firsts = compute_firsts(G) - firsts[G.EOF] = ContainerSet(G.EOF) - - start_production = G.startSymbol.productions[0] - start_item = Item(start_production, 0, lookaheads=(G.EOF,)) - start = frozenset([start_item]) - - closure = closure_lr1(start, firsts) - automaton = State(frozenset(closure), True) - - pending = [start] - visited = {start: automaton} - - while pending: - current = pending.pop() - current_state = visited[current] - - current_closure = current_state.state - for symbol in G.terminals + G.nonTerminals: - kernel = goto_lr1(current_closure, symbol, just_kernel=True) - - if kernel == frozenset(): - continue - - try: - next_state = visited[kernel] - except KeyError: - goto = closure_lr1(kernel, firsts) - visited[kernel] = next_state = State(frozenset(goto), True) - pending.append(kernel) - current_state.add_transition(symbol.Name, next_state) - - return automaton - - -def build_larl1_automaton(G, firsts=None): - assert len(G.start_symbol.productions) == 1, 'Grammar must be augmented' - - if not firsts: - firsts = compute_firsts(G) - firsts[G.EOF] = ContainerSet(G.EOF) - - start_production = G.start_symbol.productions[0] - start_item = Item(start_production, 0, lookaheads=ContainerSet(G.EOF)) - start = frozenset([start_item.Center()]) - - closure = closure_lr1([start_item], firsts) - automaton = State(frozenset(closure), True) - - pending = [start] - visited = {start: automaton} - - while pending: - current = pending.pop() - current_state = visited[current] - - current_closure = current_state.state - for symbol in G.terminals + G.non_terminals: - goto = goto_lr1(current_closure, symbol, just_kernel=True) - closure = closure_lr1(goto, firsts) - center = frozenset(item.Center() for item in goto) - - if center == frozenset(): - continue - - try: - next_state = visited[center] - centers = {item.Center(): item for item in next_state.state} - centers = {item.Center(): (centers[item.Center()], item) for item in closure} - - updated_items = set() - for c, (itemA, itemB) in centers.items(): - item = Item(c.production, c.pos, itemA.lookaheads | itemB.lookaheads) - updated_items.add(item) - - updated_items = frozenset(updated_items) - if next_state.state != updated_items: - pending.append(center) - next_state.state = updated_items - except KeyError: - visited[center] = next_state = State(frozenset(closure), True) - pending.append(center) - - if current_state[symbol.name] is None: - current_state.add_transition(symbol.name, next_state) - else: - assert current_state.get(symbol.name) is next_state, 'Bad build!!!' - - return automaton diff --git a/cmp/parsing/lexer.py b/cmp/parsing/lexer.py deleted file mode 100644 index e255967c6..000000000 --- a/cmp/parsing/lexer.py +++ /dev/null @@ -1,35 +0,0 @@ -import re - -from cmp.utils import Token - - -class Lexer: - def __init__(self, table, eof, special_symbols): - self.lineno = 0 - self.column = 0 - self.table = {**table, **{'$': (eof, '$')}} - self.pattern = self._build_regex(table) - self.eof = eof - self.special_symbols = special_symbols - - @staticmethod - def _build_regex(table): - r = '|'.join([f'(?P<{alias}>{regex})' for alias, (_, regex) in table.items()]) - return re.compile(r) - - def _tokenize(self, text): - pos = 0 - while pos < len(text): - if text[pos] in self.special_symbols: - self.special_symbols[text[pos]](self) - pos += 1 - else: - match = self.pattern.match(text, pos=pos) - yield match.group(), match.lastgroup, self.lineno, self.column - pos = match.end() - self.column += len(match.group()) - yield '$', '$', self.lineno, self.column - - def __call__(self, text): - return [Token(lex, self.table[alias][0], row, col) for lex, alias, row, col in self._tokenize(text)] - diff --git a/cmp/parsing/lexing.py b/cmp/parsing/lexing.py new file mode 100644 index 000000000..5c5b0c84e --- /dev/null +++ b/cmp/parsing/lexing.py @@ -0,0 +1,89 @@ +import re + + +class Token: + """ + A Token class. + + Parameters + ---------- + lex: str + Token's lexeme. + token_type: Enum + Token's type. + """ + + def __init__(self, lex, token_type, line=0, column=0): + """ + :param lex: str + :param token_type: Enum + :param line: int + :param column: int + """ + self.lex = lex + self.token_type = token_type + self.line = line + self.column = column + + def __str__(self): + return f'{self.token_type}: {self.lex}' + + def __repr__(self): + return str(self) + + @property + def is_valid(self): + return True + + +class UnknownToken(Token): + """ + Special class to detect lexical errors. Is derived from cmp.utils.Token + """ + + def __init__(self, lex): + super().__init__(self, lex, None) + + def transform_to(self, token_type): + return Token(self.lex, token_type) + + @property + def is_valid(self): + return False + + +class Lexer: + def __init__(self, table, eof, special_symbols): + self.lineno = 0 + self.column = 0 + self.pos = 0 + self.table = {**table, **{'$': (eof, '$')}} + self.pattern = self._build_regex(table) + self.eof = eof + self.special_symbols = special_symbols + + @staticmethod + def _build_regex(table): + r = '|'.join([f'(?P<{alias}>{regex})' for alias, (_, regex) in table.items()]) + return re.compile(r) + + def _tokenize(self, text): + pos = self.pos + while pos < len(text): + if text[pos] in self.special_symbols: + self.special_symbols[text[pos]](self) + pos += 1 + else: + match = self.pattern.match(text, pos=pos) + + if match is None: + # TODO: Handle bad parsing error + pass + + yield match.group(), match.lastgroup, self.lineno, self.column + pos = match.end() + self.column += len(match.group()) + yield '$', '$', self.lineno, self.column + + def __call__(self, text): + return [Token(lex, self.table[alias][0], row, col) for lex, alias, row, col in self._tokenize(text)] diff --git a/cmp/parsing/parsing.py b/cmp/parsing/parsing.py index 884fd6d19..772c8ec2a 100755 --- a/cmp/parsing/parsing.py +++ b/cmp/parsing/parsing.py @@ -1,9 +1,255 @@ from enum import auto, Enum +from typing import List -from .automatas import build_lr1_automaton, build_larl1_automaton -from .utils import compute_firsts, compute_follows +from cmp.automata import State +from cmp.pycompiler import Item +from cmp.utils import ContainerSet +from cmp.parsing.lexing import Token +############################## +# Compute Firsts and Follows # +############################## +def compute_local_first(firsts, alpha): + first_alpha = ContainerSet() + + try: + alpha_is_epsilon = alpha.IsEpsilon + except AttributeError: + alpha_is_epsilon = False + + if alpha_is_epsilon: + first_alpha.set_epsilon() + else: + for symbol in alpha: + first_symbol = firsts[symbol] + first_alpha.update(first_symbol) + if not first_symbol.contains_epsilon: + break + else: + first_alpha.set_epsilon() + + return first_alpha + + +def compute_firsts(G): + firsts = {} + change = True + + for terminal in G.terminals: + firsts[terminal] = ContainerSet(terminal) + + for nonterminal in G.non_terminals: + firsts[nonterminal] = ContainerSet() + + while change: + change = False + + # P: X -> alpha + for production in G.productions: + X, alpha = production + + first_X = firsts[X] + + try: + first_alpha = firsts[alpha] + except KeyError: + first_alpha = firsts[alpha] = ContainerSet() + + local_first = compute_local_first(firsts, alpha) + + change |= first_alpha.hard_update(local_first) + change |= first_X.hard_update(local_first) + + return firsts + + +def compute_follows(G, firsts): + follows = {} + change = True + + local_firsts = {} + + # init Follow(Vn) + for nonterminal in G.non_terminals: + follows[nonterminal] = ContainerSet() + follows[G.start_symbol] = ContainerSet(G.EOF) + + while change: + change = False + + # P: X -> alpha + for production in G.productions: + X = production.Left + alpha = production.Right + + follow_X = follows[X] + + for i, symbol_Y in enumerate(alpha): + # X -> zeta Y beta + if symbol_Y.IsNonTerminal: + follow_Y = follows[symbol_Y] + try: + first_beta = local_firsts[alpha, i] + except KeyError: + first_beta = local_firsts[alpha, i] = compute_local_first(firsts, alpha[i + 1:]) + # First(beta) - { epsilon } subset of Follow(Y) + change |= follow_Y.update(first_beta) + # beta ->* epsilon or X -> zeta Y ? Follow(X) subset of Follow(Y) + if first_beta.contains_epsilon: + change |= follow_Y.update(follow_X) + # Follow(Vn) + return follows + + +######################## +# LR1 & LALR1 AUTOMATA # +######################## +def compress(items): + centers = {} + + for item in items: + center = item.Center() + try: + lookaheads = centers[center] + except KeyError: + centers[center] = lookaheads = set() + lookaheads.update(item.lookaheads) + + return set(Item(x.production, x.pos, set(lookaheads)) for x, lookaheads in centers.items()) + + +def expand(item, firsts): + next_symbol = item.NextSymbol + if next_symbol is None or not next_symbol.IsNonTerminal: + return [] + + lookaheads = ContainerSet() + + for preview in item.Preview(): + local_first = compute_local_first(firsts, preview) + lookaheads.update(local_first) + + assert not lookaheads.contains_epsilon + + return [Item(p, 0, lookaheads) for p in next_symbol.productions] + + +def closure_lr1(items, firsts): + closure = ContainerSet(*items) + changed = True + while changed: + new_items = ContainerSet() + for item in closure: + new_items.extend(expand(item, firsts)) + changed = closure.update(new_items) + return compress(closure) + + +def goto_lr1(items, symbol, firsts=None, just_kernel=False): + assert just_kernel or firsts is not None, '`firsts` must be provided if `just_kernel=False`' + items = frozenset(item.NextItem() for item in items if item.NextSymbol == symbol) + return items if just_kernel else closure_lr1(items, firsts) + + +def build_lr1_automaton(G, firsts=None): + assert len(G.startSymbol.productions) == 1, 'Grammar must be augmented' + + if not firsts: + firsts = compute_firsts(G) + firsts[G.EOF] = ContainerSet(G.EOF) + + start_production = G.startSymbol.productions[0] + start_item = Item(start_production, 0, lookaheads=(G.EOF,)) + start = frozenset([start_item]) + + closure = closure_lr1(start, firsts) + automaton = State(frozenset(closure), True) + + pending = [start] + visited = {start: automaton} + + symbols = G.terminals + G.non_terminals + while pending: + current = pending.pop() + current_state = visited[current] + + current_closure = current_state.state + for symbol in symbols: + kernel = goto_lr1(current_closure, symbol, just_kernel=True) + + if kernel == frozenset(): + continue + + try: + next_state = visited[kernel] + except KeyError: + goto = closure_lr1(kernel, firsts) + visited[kernel] = next_state = State(frozenset(goto), True) + pending.append(kernel) + current_state.add_transition(symbol.Name, next_state) + + return automaton + + +def build_larl1_automaton(G, firsts=None): + assert len(G.start_symbol.productions) == 1, 'Grammar must be augmented' + + if not firsts: + firsts = compute_firsts(G) + firsts[G.EOF] = ContainerSet(G.EOF) + + start_production = G.start_symbol.productions[0] + start_item = Item(start_production, 0, lookaheads=ContainerSet(G.EOF)) + start = frozenset([start_item.Center()]) + + closure = closure_lr1([start_item], firsts) + automaton = State(frozenset(closure), True) + + pending = [start] + visited = {start: automaton} + + symbols = G.terminals + G.non_terminals + while pending: + current = pending.pop() + current_state = visited[current] + + current_closure = current_state.state + for symbol in symbols: + goto = goto_lr1(current_closure, symbol, just_kernel=True) + closure = closure_lr1(goto, firsts) + center = frozenset(item.Center() for item in goto) + + if center == frozenset(): + continue + + try: + next_state = visited[center] + + centers = {item.Center(): item for item in next_state.state} + centers = {item.Center(): (centers[item.Center()], item) for item in closure} + + updated_items = frozenset( + Item(c.production, c.pos, item_a.lookaheads | item_b.lookaheads) for c, (item_a, item_b) in + centers.items()) + if next_state.state != updated_items: + pending.append(center) + next_state.state = updated_items + except KeyError: + visited[center] = next_state = State(frozenset(closure), True) + pending.append(center) + + if current_state[symbol.name] is None: + current_state.add_transition(symbol.name, next_state) + else: + assert current_state.get(symbol.name) is next_state, 'Bad build!!!' + + return automaton + + +####################### +# LR1 & LALR1 Parsers # +####################### class LRConflictType(Enum): """ Enum for mark the type of lr-family conflict parser @@ -35,13 +281,13 @@ def __init__(self, G): self.follows = compute_follows(self.augmented_G, self.firsts) self.automaton = self._build_automaton() self.state_dict = {} - self.conflict = None + self.conflicts = None self.action = {} self.goto = {} self._build_parsing_table() - if self.conflict is None: + if self.conflicts is None: self._clean_tables() def _build_parsing_table(self): @@ -69,40 +315,38 @@ def _build_parsing_table(self): else: self._register(self.goto, (idx, symbol), idj) - def __call__(self, tokens): - stack: list = [0] + def __call__(self, tokens: List[Token]): + stack: list = [0] # The order in stack is [init state] + [symbol, rule, state, ...] cursor = 0 while True: state = stack[-1] lookahead = tokens[cursor] - assert (state, lookahead.token_type) in self.action, f'Parsing Error in ' \ + assert (state, lookahead.token_type) in self.action, f'ParsingError: in ' \ f'{(state, lookahead.lex, lookahead.token_type)} ' action, tag = self.action[state, lookahead.token_type] if action == self.SHIFT: - stack += [lookahead, lookahead.lex, tag] + stack += [lookahead.token_type, lookahead.lex, tag] cursor += 1 elif action == self.REDUCE: head, body = tag + rules = [None] * (len(body) + 1) + for i, s in enumerate(reversed(body), 1): + state, rules[-i], symbol = stack.pop(), stack.pop(), stack.pop() + assert s == symbol, f'ReduceError: in production "{repr(tag)}". Expected {s} instead of {s}' + try: - attribute = tag.attributes[0] # It's an attributed grammar + rules[0] = tag.attribute(rules) # It's an attributed grammar except AttributeError: - attribute = None # it's not an attribute grammar - - syn = [None] * (len(body) + 1) - for i, symbol in enumerate(reversed(body), 1): - state, node, token = stack.pop(), stack.pop(), stack.pop() - syn[-i] = node - assert symbol == token.token_type, 'Bad Reduce...' - syn[0] = attribute(syn) if attribute is not None else None + pass state = stack[-1] goto = self.goto[state, head] - stack += [head, syn[0], goto] + stack += [head, rules[0], goto] elif action == self.OK: return stack[2] else: @@ -113,15 +357,15 @@ def _register(self, table, key, value): try: n = len(table[key]) table[key].add(value) - if self.conflict is None and n != len(table[key]): + if self.conflicts is None and n != len(table[key]): if all(action == self.REDUCE for action, _ in list(table[key])[:2]): cType = LRConflictType.ReduceReduce else: cType = LRConflictType.ShiftReduce - self.conflict = LRConflict(key[0], key[1], cType) - self.conflict.value1 = list(table[key])[0] - self.conflict.value2 = list(table[key])[1] + self.conflicts = LRConflict(key[0], key[1], cType) + self.conflicts.value1 = list(table[key])[0] + self.conflicts.value2 = list(table[key])[1] except KeyError: table[key] = {value} diff --git a/cmp/parsing/serializer.py b/cmp/parsing/serializer.py index e1e8bba9e..c8fb913df 100644 --- a/cmp/parsing/serializer.py +++ b/cmp/parsing/serializer.py @@ -1,12 +1,8 @@ import inspect -from cmp.pycompiler import Epsilon - TEMPLATE = """from abc import ABC from cmp.parsing import ShiftReduceParser -from cmp.pycompiler import AttributeProduction, Sentence -from astnodes import * - +from %s import G class %s(ShiftReduceParser, ABC): def __init__(self, G, verbose=False): @@ -50,8 +46,8 @@ def __build_parsing_tables(parser): G = parser.G lambdas = {} - for p in G.Productions: - attr = p.attributes[0] + for p in G.productions: + attr = p.attribute code: str = 'lambda' + inspect.getsource(attr).replace('\n', '').split('lambda')[1] repr_p: str = repr(p) lambdas[repr_p] = code @@ -63,12 +59,7 @@ def __build_parsing_tables(parser): if act == 'SHIFT': s1 += f'("{act}", {tag}),\n' elif act == 'REDUCE': - head, body = tag - if isinstance(body, Epsilon): - s1 += f'("{act}", AttributeProduction(G["{head}"], G.Epsilon, [{lambdas[repr(tag)]}])),\n' - else: - body = ', '.join(f'G["{s}"]' for s in body) - s1 += f'("{act}", AttributeProduction(G["{head}"], Sentence({body}), [{lambdas[repr(tag)]}])),\n' + s1 += f'("{act}", G["{repr(tag)}"]),\n' else: s1 += f'("{act}", None),\n' diff --git a/cmp/parsing/utils.py b/cmp/parsing/utils.py deleted file mode 100644 index 3bdff5ae2..000000000 --- a/cmp/parsing/utils.py +++ /dev/null @@ -1,93 +0,0 @@ -from cmp.utils import ContainerSet - - -def compute_local_first(firsts, alpha): - first_alpha = ContainerSet() - - try: - alpha_is_epsilon = alpha.IsEpsilon - except AttributeError: - alpha_is_epsilon = False - - if alpha_is_epsilon: - first_alpha.set_epsilon() - else: - for symbol in alpha: - first_symbol = firsts[symbol] - first_alpha.update(first_symbol) - if not first_symbol.contains_epsilon: - break - else: - first_alpha.set_epsilon() - - return first_alpha - - -def compute_firsts(G): - firsts = {} - change = True - - for terminal in G.terminals: - firsts[terminal] = ContainerSet(terminal) - - for nonterminal in G.non_terminals: - firsts[nonterminal] = ContainerSet() - - while change: - change = False - - # P: X -> alpha - for production in G.productions: - X, alpha = production - - first_X = firsts[X] - - try: - first_alpha = firsts[alpha] - except KeyError: - first_alpha = firsts[alpha] = ContainerSet() - - local_first = compute_local_first(firsts, alpha) - - change |= first_alpha.hard_update(local_first) - change |= first_X.hard_update(local_first) - - return firsts - - -def compute_follows(G, firsts): - follows = {} - change = True - - local_firsts = {} - - # init Follow(Vn) - for nonterminal in G.non_terminals: - follows[nonterminal] = ContainerSet() - follows[G.start_symbol] = ContainerSet(G.EOF) - - while change: - change = False - - # P: X -> alpha - for production in G.productions: - X = production.Left - alpha = production.Right - - follow_X = follows[X] - - for i, symbol_Y in enumerate(alpha): - # X -> zeta Y beta - if symbol_Y.IsNonTerminal: - follow_Y = follows[symbol_Y] - try: - first_beta = local_firsts[alpha, i] - except KeyError: - first_beta = local_firsts[alpha, i] = compute_local_first(firsts, alpha[i + 1:]) - # First(beta) - { epsilon } subset of Follow(Y) - change |= follow_Y.update(first_beta) - # beta ->* epsilon or X -> zeta Y ? Follow(X) subset of Follow(Y) - if first_beta.contains_epsilon: - change |= follow_Y.update(follow_X) - # Follow(Vn) - return follows diff --git a/cmp/pycompiler.py b/cmp/pycompiler.py index 3fcf16a88..6277c92c3 100755 --- a/cmp/pycompiler.py +++ b/cmp/pycompiler.py @@ -1,7 +1,8 @@ import json -from typing import List, FrozenSet, Optional, Union, Tuple, Iterable +from typing import List, FrozenSet, Optional, Union, Tuple, Iterable, Callable ProductionList = List[Union['Production', 'AttributeProduction']] +Rule = Optional[Callable[[List[object]], object]] class Symbol: @@ -68,14 +69,8 @@ def __mod__(self, other): else: other = (self.grammar.EPSILON,) + other[1:] - if len(other) == 2: - other += (None,) * len(other[0]) - - assert len(other) == len(other[0]) + 2, 'Debe definirse una, y solo una, regla por cada símbolo de la ' \ - 'producción ' - if isinstance(other[0], Symbol) or isinstance(other[0], Sentence): - p = AttributeProduction(self, other[0], other[1:]) + p = AttributeProduction(self, other[0], other[1]) else: raise Exception("") @@ -261,29 +256,12 @@ def __hash__(self): class AttributeProduction(Production): - def __init__(self, nonTerminal, sentence, attributes): + def __init__(self, nonTerminal, sentence, attribute): if not isinstance(sentence, Sentence) and isinstance(sentence, Symbol): sentence = Sentence(sentence) - super(AttributeProduction, self).__init__(nonTerminal, sentence) - - self.attributes = attributes + super().__init__(nonTerminal, sentence) - def __str__(self): - return '%s := %s' % (self.Left, self.Right) - - def __repr__(self): - return '%s -> %s' % (self.Left, self.Right) - - def __iter__(self): - yield self.Left - yield self.Right - - @property - def IsEpsilon(self): - return self.Right.IsEpsilon - - def synthesize(self): - pass + self.attribute: Rule = attribute class Grammar: @@ -297,7 +275,21 @@ def __init__(self): self.EPSILON: Epsilon = Epsilon(self) self.EOF: EOF = EOF(self) - self.symbDict = {'$': self.EOF, 'error': self.ERROR} + self.symbol_dict = {'$': self.EOF, 'error': self.ERROR} + self.production_dict = {} + + def add_terminal(self, name: str) -> Terminal: + name = name.strip() + if not name: + raise Exception("Empty name") + + term = Terminal(name, self) + self.terminals.append(term) + self.symbol_dict[name] = term + return term + + def add_terminals(self, names: str) -> Tuple[Terminal, ...]: + return tuple(self.add_terminal(x) for x in names.strip().split()) def add_non_terminal(self, name: str, startSymbol: bool = False) -> NonTerminal: name = name.strip() @@ -314,7 +306,7 @@ def add_non_terminal(self, name: str, startSymbol: bool = False) -> NonTerminal: raise Exception("Cannot define more than one start symbol.") self.non_terminals.append(term) - self.symbDict[name] = term + self.symbol_dict[name] = term return term def add_non_terminals(self, names: str) -> Tuple[NonTerminal, ...]: @@ -328,23 +320,11 @@ def add_production(self, production: Production): production.Left.productions.append(production) self.productions.append(production) + self.production_dict[repr(production)] = production def error(self, head, sentence, rule): pass - def add_terminal(self, name: str) -> Terminal: - name = name.strip() - if not name: - raise Exception("Empty name") - - term = Terminal(name, self) - self.terminals.append(term) - self.symbDict[name] = term - return term - - def add_terminals(self, names: str) -> Tuple[Terminal, ...]: - return tuple(self.add_terminal(x) for x in names.strip().split()) - def __str__(self): mul = '%s, ' @@ -367,9 +347,12 @@ def __str__(self): return ans - def __getitem__(self, name): + def __getitem__(self, item): try: - return self.symbDict[name] + try: + return self.symbol_dict[item] + except KeyError: + return self.production_dict[item] except KeyError: return None @@ -423,7 +406,7 @@ def copy(self): G.start_symbol = self.start_symbol G.EPSILON = self.EPSILON G.EOF = self.EOF - G.symbDict = self.symbDict.copy() + G.symbol_dict = self.symbol_dict.copy() return G @@ -454,7 +437,6 @@ def AugmentedGrammar(self, force=False): return G else: return self.copy() - # endchange class Item: diff --git a/cmp/utils.py b/cmp/utils.py index 04ff7d7cb..6ebe376e0 100755 --- a/cmp/utils.py +++ b/cmp/utils.py @@ -1,40 +1,45 @@ class ContainerSet: - def __init__(self, *values, contains_epsilon=False): - self.set = set(values) - self.contains_epsilon = contains_epsilon + """ + Special class used for handling the existence of epsilon in a set of Symbols. It has all properties of a set + """ + + def __init__(self, *values, contains_epsilon: bool = False): + self.set: set = set(values) + self.contains_epsilon: bool = contains_epsilon - def add(self, value): + def add(self, value) -> bool: + """ + Add a new value to the ContainerSet and return true if size was changed + :param value: value to be added + :return: True if the item was added + """ n = len(self.set) self.set.add(value) return n != len(self.set) - def extend(self, values): - change = False - for value in values: - change |= self.add(value) - return change + def extend(self, values) -> bool: + n = len(self.set) + self.set.update(values) + return n != len(self.set) - def set_epsilon(self, value=True): + def set_epsilon(self, value=True) -> bool: last = self.contains_epsilon self.contains_epsilon = value return last != self.contains_epsilon - def update(self, other): + def update(self, other) -> bool: n = len(self.set) self.set.update(other.set) return n != len(self.set) - def epsilon_update(self, other): + def epsilon_update(self, other) -> bool: return self.set_epsilon(self.contains_epsilon | other.contains_epsilon) def hard_update(self, other): return self.update(other) | self.epsilon_update(other) - def find_match(self, match): - for item in self.set: - if item == match: - return item - return None + def __contains__(self, item): + return item in self.set def __len__(self): return len(self.set) + int(self.contains_epsilon) @@ -58,53 +63,6 @@ def __eq__(self, other): ContainerSet) and self.set == other.set and self.contains_epsilon == other.contains_epsilon -class Token: - """ - A Token class. - - Parameters - ---------- - lex: str - Token's lexeme. - token_type: Enum - Token's type. - """ - - def __init__(self, lex, token_type, line=0, column=0): - """ - :param lex: str - :param token_type: Enum - :param line: int - :param column: int - """ - self.lex = lex - self.token_type = token_type - self.line = line - self.column = column - - def __str__(self): - return f'{self.token_type}: {self.lex}' - - def __repr__(self): - return str(self) - - @property - def is_valid(self): - return True - - -class UnknownToken(Token): - def __init__(self, lex): - Token.__init__(self, lex, None) - - def transform_to(self, token_type): - return Token(self.lex, token_type) - - @property - def is_valid(self): - return False - - class DisjointSet: def __init__(self, *items): self.nodes = {x: DisjointNode(x) for x in items} @@ -158,3 +116,92 @@ def __str__(self): def __repr__(self): return str(self) + + +class TrieNode: + def __init__(self, symbol, parent=None, final=False): + self.symbol = symbol + self.parent = parent + self.children = {} + self.count = 1 + self.final = final + + def add(self, symbol): + try: + self.children[symbol] + except KeyError: + self.children[symbol] = TrieNode(symbol, parent=self) + + def __getitem__(self, item): + return self.children[item] + + def __setitem__(self, key, value): + self.children[key] = value + + def __contains__(self, item): + return item in self.children + + def __iter__(self): + yield from self.children + + def __eq__(self, other): + return self.symbol == other.symbol + + +class Trie: + def __init__(self): + self.root: TrieNode = TrieNode('^') + self.root.count = 0 + + def insert(self, sentence): + index, node = self.__maximum_common_prefix(sentence) + for symbol in sentence[index:]: + node.add(symbol) + node = node[symbol] + node.final = True + self.root.count += 1 + + def extend(self, *sentences): + for s in sentences: + self.insert(s) + + def __maximum_common_prefix(self, sentence): + current: TrieNode = self.root + for i, symbol in enumerate(sentence): + try: + current = current[symbol] + current.count += 1 + except KeyError: + return i, current + return len(sentence), current + + def __from_prefix(self, prefix): + node: TrieNode = self.root + for symbol in prefix: + try: + node = node[symbol] + except KeyError: + return [] + + yield from Trie.__search_from_node(node, prefix) + + @staticmethod + def __search_from_node(node, sentence): + if node.final: + yield sentence + + for child in node: + yield from Trie.__search_from_node(node[child], sentence + child) + + def __len__(self): + return self.root.count + + def __iter__(self): + yield from self.__search_from_node(self.root, "") + + def __call__(self, prefix): + yield from self.__from_prefix(prefix) + + def __contains__(self, item): + i, node = self.__maximum_common_prefix(item) + return i == len(item) and node.final diff --git a/definitions.py b/grammar.py similarity index 50% rename from definitions.py rename to grammar.py index f81055b59..fab09d962 100644 --- a/definitions.py +++ b/grammar.py @@ -1,7 +1,7 @@ +import astnodes as ast import time -from astnodes import * -from cmp.parsing import LALR1Parser, Lexer +from cmp.parsing import LALR1Parser from cmp.pycompiler import Grammar G = Grammar() @@ -10,7 +10,7 @@ # Non-Terminals # ################# program = G.add_non_terminal('program', startSymbol=True) -class_set = G.add_non_terminal('class-set') +class_list = G.add_non_terminal('class-list') class_def = G.add_non_terminal('class-def') feature_list = G.add_non_terminal('feature-list') attribute = G.add_non_terminal('attribute') @@ -77,7 +77,6 @@ G.add_terminal('isvoid') G.add_terminal('true') G.add_terminal('false') -G.add_terminal('end') ############# # Operators # @@ -96,85 +95,81 @@ ############### # Productions # ############### -program %= 'class-set', lambda s: ProgramNode(s[1]) +program %= 'class-list', lambda s: ast.ProgramNode(s[1]) -class_set %= 'class-def', lambda s: [s[1]] -class_set %= 'class-def class-set', lambda s: [s[1]] + s[2] +class_list %= 'class-def', lambda s: [s[1]] +class_list %= 'class-def class-list', lambda s: [s[1]] + s[2] -class_def %= 'class type { feature-list }', lambda s: ClassDeclarationNode(s[2], s[4]) -class_def %= 'class type inherits type { feature-list }', lambda s: ClassDeclarationNode(s[2], s[6], s[4]) +class_def %= 'class type { feature-list }', lambda s: ast.ClassDeclarationNode(s[2], s[4]) +class_def %= 'class type inherits type { feature-list }', lambda s: ast.ClassDeclarationNode(s[2], s[6], s[4]) feature_list %= '', lambda s: [] feature_list %= 'attribute ; feature-list', lambda s: [s[1]] + s[3] feature_list %= 'method ; feature-list', lambda s: [s[1]] + s[3] -attribute %= 'id : type', lambda s: AttrDeclarationNode(s[1], s[3]) -attribute %= 'id : type <- expr', lambda s: AttrDeclarationNode(s[1], s[3], s[5]) +attribute %= 'id : type', lambda s: ast.AttrDeclarationNode(s[1], s[3]) +attribute %= 'id : type <- expr', lambda s: ast.AttrDeclarationNode(s[1], s[3], s[5]) -method %= 'id ( ) : type { expr }', lambda s: MethodDeclarationNode(s[1], [], s[5], s[7]) -method %= 'id ( param-list ) : type { expr }', lambda s: MethodDeclarationNode(s[1], s[3], s[6], s[8]) +method %= 'id ( ) : type { expr }', lambda s: ast.MethodDeclarationNode(s[1], [], s[5], s[7]) +method %= 'id ( param-list ) : type { expr }', lambda s: ast.MethodDeclarationNode(s[1], s[3], s[6], s[8]) -param_list %= 'id : type', lambda s: [ParamNode(s[1], s[3])] -param_list %= 'id : type , param-list', lambda s: [ParamNode(s[1], s[3])] + s[5] +param_list %= 'id : type', lambda s: [(s[1], s[3])] +param_list %= 'id : type , param-list', lambda s: [(s[1], s[3])] + s[5] -expr %= 'id <- expr', lambda s: AssignNode(s[1], s[3]) -expr %= '{ block }', lambda s: BlockNode(s[2]) -expr %= 'if expr then expr else expr fi', lambda s: ConditionalNode(s[2], s[4], s[6]) -expr %= 'while expr loop expr pool', lambda s: WhileNode(s[2], s[4]) -expr %= 'let declaration-list in expr', lambda s: LetNode(s[2], s[4]) -expr %= 'case expr of case-list esac', lambda s: CasesNode(s[2], s[4]) -expr %= 'not expr', lambda s: NegationNode(s[2]) +expr %= 'id <- expr', lambda s: ast.AssignNode(s[1], s[3]) +expr %= '{ block }', lambda s: ast.BlockNode(s[2]) +expr %= 'if expr then expr else expr fi', lambda s: ast.ConditionalNode(s[2], s[4], s[6]) +expr %= 'while expr loop expr pool', lambda s: ast.WhileNode(s[2], s[4]) +expr %= 'let declaration-list in expr', lambda s: ast.LetNode(s[2], s[4]) +expr %= 'case expr of case-list esac', lambda s: ast.SwitchCaseNode(s[2], s[4]) +expr %= 'not expr', lambda s: ast.NegationNode(s[2]) expr %= 'comp', lambda s: s[1] -comp %= 'comp < arith', lambda s: LessNode(s[1], s[3]) -comp %= 'comp <= arith', lambda s: LessEqualNode(s[1], s[3]) -comp %= 'comp = arith', lambda s: EqualNode(s[1], s[3]) +comp %= 'arith < arith', lambda s: ast.LessNode(s[1], s[3]) +comp %= 'arith <= arith', lambda s: ast.LessEqualNode(s[1], s[3]) +comp %= 'arith = arith', lambda s: ast.EqualNode(s[1], s[3]) comp %= 'arith', lambda s: s[1] -arith %= 'arith + term', lambda s: PlusNode(s[1], s[3]) -arith %= 'arith - term', lambda s: MinusNode(s[1], s[3]) +arith %= 'arith + term', lambda s: ast.PlusNode(s[1], s[3]) +arith %= 'arith - term', lambda s: ast.MinusNode(s[1], s[3]) arith %= 'term', lambda s: s[1] -term %= 'term * factor', lambda s: StarNode(s[1], s[3]) -term %= 'term / factor', lambda s: DivNode(s[1], s[3]) +term %= 'term * factor', lambda s: ast.StarNode(s[1], s[3]) +term %= 'term / factor', lambda s: ast.DivNode(s[1], s[3]) term %= 'factor', lambda s: s[1] -factor %= 'isvoid factor', lambda s: IsVoidNode(s[2]) -factor %= '~ factor', lambda s: ComplementNode(s[2]) +factor %= 'isvoid factor', lambda s: ast.IsVoidNode(s[2]) +factor %= '~ factor', lambda s: ast.ComplementNode(s[2]) factor %= 'atom', lambda s: s[1] -atom %= 'id', lambda s: VariableNode(s[1]) -atom %= 'true', lambda s: BooleanNode(s[1]) -atom %= 'false', lambda s: BooleanNode(s[1]) -atom %= 'integer', lambda s: IntegerNode(s[1]) -atom %= 'string', lambda s: StringNode(s[1]) +atom %= 'id', lambda s: ast.VariableNode(s[1]) +atom %= 'true', lambda s: ast.BooleanNode(s[1]) +atom %= 'false', lambda s: ast.BooleanNode(s[1]) +atom %= 'integer', lambda s: ast.IntegerNode(s[1]) +atom %= 'string', lambda s: ast.StringNode(s[1]) atom %= 'function-call', lambda s: s[1] -atom %= 'new type', lambda s: InstantiateNode(s[2]) +atom %= 'new type', lambda s: ast.InstantiateNode(s[2]) atom %= '( expr )', lambda s: s[2] block %= 'expr ;', lambda s: [s[1]] block %= 'expr ; block', lambda s: [s[1]] + s[3] -declaration_list %= 'id : type', lambda s: [VarDeclarationNode(s[1], s[3])] -declaration_list %= 'id : type <- expr', lambda s: [VarDeclarationNode(s[1], s[3], s[5])] -declaration_list %= 'id : type , declaration-list', lambda s: [VarDeclarationNode(s[1], s[3])] + s[5] -declaration_list %= 'id : type <- expr , declaration-list', lambda s: [VarDeclarationNode(s[1], s[3], s[5])] + s[7] +declaration_list %= 'id : type', lambda s: [ast.VarDeclarationNode(s[1], s[3])] +declaration_list %= 'id : type <- expr', lambda s: [ast.VarDeclarationNode(s[1], s[3], s[5])] +declaration_list %= 'id : type , declaration-list', lambda s: [ast.VarDeclarationNode(s[1], s[3])] + s[5] +declaration_list %= 'id : type <- expr , declaration-list', lambda s: [ast.VarDeclarationNode(s[1], s[3], s[5])] + s[7] -case_list %= 'id : type => expr ;', lambda s: [SingleCaseNode(s[1], s[3], s[5])] -case_list %= 'id : type => expr ; case-list', lambda s: [SingleCaseNode(s[1], s[3], s[5])] + s[7] +case_list %= 'id : type => expr ;', lambda s: [ast.CaseNode(s[1], s[3], s[5])] +case_list %= 'id : type => expr ; case-list', lambda s: [ast.CaseNode(s[1], s[3], s[5])] + s[7] -function_call %= 'id ( expr-list )', lambda s: MethodCallNode(s[1], s[3]) -function_call %= 'atom . id ( expr-list )', lambda s: MethodCallNode(s[3], s[5], s[1]) -function_call %= 'atom @ type . id ( expr-list )', lambda s: MethodCallNode(s[3], s[5], s[1]) +function_call %= 'id ( expr-list )', lambda s: ast.MethodCallNode(s[1], s[3]) +function_call %= 'atom . id ( expr-list )', lambda s: ast.MethodCallNode(s[3], s[5], s[1]) +function_call %= 'atom @ type . id ( expr-list )', lambda s: ast.MethodCallNode(s[3], s[5], s[1]) expr_list %= 'expr', lambda s: [s[1]] expr_list %= 'expr , expr-list', lambda s: [s[1]] + s[3] -def cool_grammar(): - return G - - def cool_parser(): return LALR1Parser(G) @@ -185,4 +180,4 @@ def cool_parser(): print('Building Time :', time.time() - t, 'seconds') print('Action Table Entries :', len(parser.action)) print('Got Table Entries :', len(parser.goto)) - print('Presents Conflicts :', parser.conflict is not None) + print('Presents Conflicts :', parser.conflicts is not None) diff --git a/lexer.py b/lexer.py index d597d7893..cec0a6fcb 100644 --- a/lexer.py +++ b/lexer.py @@ -73,7 +73,6 @@ def _table(self): 'isvoid': (G['isvoid'], 'isvoid'), 'true': (G['true'], 'true'), 'false': (G['false'], 'false'), - 'end': (G['end'], 'end'), 'type': (G['type'], '[A-Z][a-zA-Z0-9]*'), 'id': (G['id'], '[a-z][a-zA-Z0-9]*'), 'string': (G['string'], '".*"'), diff --git a/main.py b/main.py index f5f94e5ef..3d6e199c9 100644 --- a/main.py +++ b/main.py @@ -1,12 +1,10 @@ -import time - -from lexer import CoolLexer +from grammar import cool_grammar from parser import CoolParser -from definitions import cool_grammar if __name__ == '__main__': - t = time.time() + import time G = cool_grammar() - parser = CoolParser(G) - lexer = CoolLexer(G) + + t = time.time() + CoolParser(G) print(time.time() - t) diff --git a/parser.py b/parser.py index a904b9b62..191c38472 100644 --- a/parser.py +++ b/parser.py @@ -1,1292 +1,1292 @@ from abc import ABC + from cmp.parsing import ShiftReduceParser -from cmp.pycompiler import AttributeProduction, Sentence -from astnodes import * +from grammar import G class CoolParser(ShiftReduceParser, ABC): - def __init__(self, G, verbose=False): + def __init__(self, verbose=False): self.G = G self.verbose = verbose self.action = self.__action_table() self.goto = self.__goto_table() - def __action_table(self): - G = self.G + @staticmethod + def __action_table(): return { (0, G["class"]): ("SHIFT", 1), (1, G["type"]): ("SHIFT", 2), (2, G["inherits"]): ("SHIFT", 136), (2, G["{"]): ("SHIFT", 3), (3, G["id"]): ("SHIFT", 4), - (3, G["}"]): ("REDUCE", AttributeProduction(G["feature-list"], G.Epsilon, [lambda s: []])), + (3, G["}"]): ("REDUCE", G["feature-list -> e"]), (4, G[":"]): ("SHIFT", 124), (4, G["("]): ("SHIFT", 5), - (5, G[")"]): ("SHIFT", 11), (5, G["id"]): ("SHIFT", 6), + (5, G[")"]): ("SHIFT", 11), (6, G[":"]): ("SHIFT", 7), (7, G["type"]): ("SHIFT", 8), - (8, G[")"]): ("REDUCE", AttributeProduction(G["param-list"], Sentence(G["id"], G[":"], G["type"]), [lambda s: [ParamNode(s[1], s[3])]])), + (8, G[")"]): ("REDUCE", G["param-list -> id : type"]), (8, G[","]): ("SHIFT", 9), (9, G["id"]): ("SHIFT", 6), - (10, G[")"]): ("REDUCE", AttributeProduction(G["param-list"], Sentence(G["id"], G[":"], G["type"], G[","], G["param-list"]), [lambda s: [ParamNode(s[1], s[3])] + s[5]])), + (10, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), (11, G[":"]): ("SHIFT", 12), (12, G["type"]): ("SHIFT", 13), (13, G["{"]): ("SHIFT", 14), - (14, G["true"]): ("SHIFT", 35), - (14, G["not"]): ("SHIFT", 44), - (14, G["("]): ("SHIFT", 20), - (14, G["{"]): ("SHIFT", 19), - (14, G["if"]): ("SHIFT", 21), (14, G["id"]): ("SHIFT", 15), - (14, G["~"]): ("SHIFT", 37), - (14, G["isvoid"]): ("SHIFT", 33), + (14, G["let"]): ("SHIFT", 23), (14, G["integer"]): ("SHIFT", 18), - (14, G["new"]): ("SHIFT", 31), - (14, G["false"]): ("SHIFT", 36), + (14, G["not"]): ("SHIFT", 44), + (14, G["string"]): ("SHIFT", 17), + (14, G["isvoid"]): ("SHIFT", 33), + (14, G["~"]): ("SHIFT", 37), (14, G["while"]): ("SHIFT", 22), + (14, G["false"]): ("SHIFT", 36), + (14, G["if"]): ("SHIFT", 21), + (14, G["new"]): ("SHIFT", 31), + (14, G["true"]): ("SHIFT", 35), + (14, G["("]): ("SHIFT", 20), + (14, G["{"]): ("SHIFT", 19), (14, G["case"]): ("SHIFT", 30), - (14, G["let"]): ("SHIFT", 23), - (14, G["string"]): ("SHIFT", 17), - (15, G["<-"]): ("SHIFT", 113), (15, G["("]): ("SHIFT", 16), - (15, G["then"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (15, G["else"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (15, G["fi"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (15, G["loop"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (15, G["pool"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (15, G["in"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (15, G["of"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (15, G["+"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (15, G["-"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (15, G["*"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (15, G["/"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (15, G["<"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (15, G["<="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (15, G["="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (15, G["}"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (15, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (15, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (15, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (15, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (15, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (16, G["integer"]): ("SHIFT", 18), - (16, G["let"]): ("SHIFT", 23), + (15, G["loop"]): ("REDUCE", G["atom -> id"]), + (15, G["pool"]): ("REDUCE", G["atom -> id"]), + (15, G["in"]): ("REDUCE", G["atom -> id"]), + (15, G["of"]): ("REDUCE", G["atom -> id"]), + (15, G["+"]): ("REDUCE", G["atom -> id"]), + (15, G["-"]): ("REDUCE", G["atom -> id"]), + (15, G["*"]): ("REDUCE", G["atom -> id"]), + (15, G["/"]): ("REDUCE", G["atom -> id"]), + (15, G["<"]): ("REDUCE", G["atom -> id"]), + (15, G["<="]): ("REDUCE", G["atom -> id"]), + (15, G["="]): ("REDUCE", G["atom -> id"]), + (15, G["}"]): ("REDUCE", G["atom -> id"]), + (15, G[")"]): ("REDUCE", G["atom -> id"]), + (15, G[","]): ("REDUCE", G["atom -> id"]), + (15, G["."]): ("REDUCE", G["atom -> id"]), + (15, G["@"]): ("REDUCE", G["atom -> id"]), + (15, G[";"]): ("REDUCE", G["atom -> id"]), + (15, G["then"]): ("REDUCE", G["atom -> id"]), + (15, G["else"]): ("REDUCE", G["atom -> id"]), + (15, G["fi"]): ("REDUCE", G["atom -> id"]), + (15, G["<-"]): ("SHIFT", 113), + (16, G["true"]): ("SHIFT", 35), + (16, G["{"]): ("SHIFT", 19), (16, G["id"]): ("SHIFT", 15), + (16, G["false"]): ("SHIFT", 36), + (16, G["~"]): ("SHIFT", 37), + (16, G["new"]): ("SHIFT", 31), (16, G["if"]): ("SHIFT", 21), - (16, G["{"]): ("SHIFT", 19), + (16, G["let"]): ("SHIFT", 23), (16, G["string"]): ("SHIFT", 17), (16, G["("]): ("SHIFT", 20), - (16, G["case"]): ("SHIFT", 30), - (16, G["true"]): ("SHIFT", 35), - (16, G["isvoid"]): ("SHIFT", 33), - (16, G["not"]): ("SHIFT", 44), - (16, G["new"]): ("SHIFT", 31), (16, G["while"]): ("SHIFT", 22), - (16, G["false"]): ("SHIFT", 36), - (16, G["~"]): ("SHIFT", 37), - (17, G["then"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), - (17, G["else"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), - (17, G["fi"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), - (17, G["loop"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), - (17, G["pool"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), - (17, G["in"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), - (17, G["of"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), - (17, G["+"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), - (17, G["-"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), - (17, G["*"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), - (17, G["/"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), - (17, G["<"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), - (17, G["<="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), - (17, G["="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), - (17, G["}"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), - (17, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), - (17, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), - (17, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), - (17, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), - (17, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["string"]), [lambda s: StringNode(s[1])])), - (18, G["then"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), - (18, G["else"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), - (18, G["fi"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), - (18, G["loop"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), - (18, G["pool"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), - (18, G["in"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), - (18, G["of"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), - (18, G["+"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), - (18, G["-"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), - (18, G["*"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), - (18, G["/"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), - (18, G["<"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), - (18, G["<="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), - (18, G["="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), - (18, G["}"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), - (18, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), - (18, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), - (18, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), - (18, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), - (18, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["integer"]), [lambda s: IntegerNode(s[1])])), - (19, G["let"]): ("SHIFT", 23), + (16, G["not"]): ("SHIFT", 44), + (16, G["isvoid"]): ("SHIFT", 33), + (16, G["case"]): ("SHIFT", 30), + (16, G["integer"]): ("SHIFT", 18), + (17, G["loop"]): ("REDUCE", G["atom -> string"]), + (17, G["pool"]): ("REDUCE", G["atom -> string"]), + (17, G["in"]): ("REDUCE", G["atom -> string"]), + (17, G["of"]): ("REDUCE", G["atom -> string"]), + (17, G["+"]): ("REDUCE", G["atom -> string"]), + (17, G["-"]): ("REDUCE", G["atom -> string"]), + (17, G["*"]): ("REDUCE", G["atom -> string"]), + (17, G["/"]): ("REDUCE", G["atom -> string"]), + (17, G["<"]): ("REDUCE", G["atom -> string"]), + (17, G["<="]): ("REDUCE", G["atom -> string"]), + (17, G["="]): ("REDUCE", G["atom -> string"]), + (17, G["}"]): ("REDUCE", G["atom -> string"]), + (17, G[")"]): ("REDUCE", G["atom -> string"]), + (17, G[","]): ("REDUCE", G["atom -> string"]), + (17, G["."]): ("REDUCE", G["atom -> string"]), + (17, G["@"]): ("REDUCE", G["atom -> string"]), + (17, G[";"]): ("REDUCE", G["atom -> string"]), + (17, G["then"]): ("REDUCE", G["atom -> string"]), + (17, G["else"]): ("REDUCE", G["atom -> string"]), + (17, G["fi"]): ("REDUCE", G["atom -> string"]), + (18, G["loop"]): ("REDUCE", G["atom -> integer"]), + (18, G["pool"]): ("REDUCE", G["atom -> integer"]), + (18, G["in"]): ("REDUCE", G["atom -> integer"]), + (18, G["of"]): ("REDUCE", G["atom -> integer"]), + (18, G["+"]): ("REDUCE", G["atom -> integer"]), + (18, G["-"]): ("REDUCE", G["atom -> integer"]), + (18, G["*"]): ("REDUCE", G["atom -> integer"]), + (18, G["/"]): ("REDUCE", G["atom -> integer"]), + (18, G["<"]): ("REDUCE", G["atom -> integer"]), + (18, G["<="]): ("REDUCE", G["atom -> integer"]), + (18, G["="]): ("REDUCE", G["atom -> integer"]), + (18, G["}"]): ("REDUCE", G["atom -> integer"]), + (18, G[")"]): ("REDUCE", G["atom -> integer"]), + (18, G[","]): ("REDUCE", G["atom -> integer"]), + (18, G["."]): ("REDUCE", G["atom -> integer"]), + (18, G["@"]): ("REDUCE", G["atom -> integer"]), + (18, G[";"]): ("REDUCE", G["atom -> integer"]), + (18, G["then"]): ("REDUCE", G["atom -> integer"]), + (18, G["else"]): ("REDUCE", G["atom -> integer"]), + (18, G["fi"]): ("REDUCE", G["atom -> integer"]), + (19, G["string"]): ("SHIFT", 17), + (19, G["integer"]): ("SHIFT", 18), (19, G["{"]): ("SHIFT", 19), + (19, G["new"]): ("SHIFT", 31), + (19, G["~"]): ("SHIFT", 37), + (19, G["isvoid"]): ("SHIFT", 33), (19, G["if"]): ("SHIFT", 21), + (19, G["false"]): ("SHIFT", 36), (19, G["id"]): ("SHIFT", 15), + (19, G["while"]): ("SHIFT", 22), (19, G["not"]): ("SHIFT", 44), (19, G["("]): ("SHIFT", 20), - (19, G["string"]): ("SHIFT", 17), (19, G["true"]): ("SHIFT", 35), - (19, G["isvoid"]): ("SHIFT", 33), - (19, G["false"]): ("SHIFT", 36), - (19, G["~"]): ("SHIFT", 37), - (19, G["integer"]): ("SHIFT", 18), - (19, G["new"]): ("SHIFT", 31), - (19, G["while"]): ("SHIFT", 22), + (19, G["let"]): ("SHIFT", 23), (19, G["case"]): ("SHIFT", 30), - (20, G["new"]): ("SHIFT", 31), - (20, G["false"]): ("SHIFT", 36), (20, G["id"]): ("SHIFT", 15), (20, G["integer"]): ("SHIFT", 18), - (20, G["{"]): ("SHIFT", 19), - (20, G["if"]): ("SHIFT", 21), - (20, G["while"]): ("SHIFT", 22), - (20, G["let"]): ("SHIFT", 23), + (20, G["not"]): ("SHIFT", 44), (20, G["string"]): ("SHIFT", 17), + (20, G["case"]): ("SHIFT", 30), + (20, G["while"]): ("SHIFT", 22), (20, G["~"]): ("SHIFT", 37), + (20, G["new"]): ("SHIFT", 31), + (20, G["isvoid"]): ("SHIFT", 33), + (20, G["false"]): ("SHIFT", 36), + (20, G["{"]): ("SHIFT", 19), (20, G["("]): ("SHIFT", 20), + (20, G["if"]): ("SHIFT", 21), + (20, G["let"]): ("SHIFT", 23), (20, G["true"]): ("SHIFT", 35), - (20, G["not"]): ("SHIFT", 44), - (20, G["isvoid"]): ("SHIFT", 33), - (20, G["case"]): ("SHIFT", 30), - (21, G["not"]): ("SHIFT", 44), - (21, G["id"]): ("SHIFT", 15), + (21, G["{"]): ("SHIFT", 19), + (21, G["isvoid"]): ("SHIFT", 33), + (21, G["case"]): ("SHIFT", 30), + (21, G["integer"]): ("SHIFT", 18), (21, G["false"]): ("SHIFT", 36), + (21, G["~"]): ("SHIFT", 37), (21, G["string"]): ("SHIFT", 17), - (21, G["true"]): ("SHIFT", 35), - (21, G["case"]): ("SHIFT", 30), + (21, G["not"]): ("SHIFT", 44), + (21, G["if"]): ("SHIFT", 21), + (21, G["id"]): ("SHIFT", 15), + (21, G["while"]): ("SHIFT", 22), (21, G["("]): ("SHIFT", 20), - (21, G["~"]): ("SHIFT", 37), + (21, G["true"]): ("SHIFT", 35), (21, G["let"]): ("SHIFT", 23), (21, G["new"]): ("SHIFT", 31), - (21, G["if"]): ("SHIFT", 21), - (21, G["{"]): ("SHIFT", 19), - (21, G["while"]): ("SHIFT", 22), - (21, G["isvoid"]): ("SHIFT", 33), - (21, G["integer"]): ("SHIFT", 18), - (22, G["id"]): ("SHIFT", 15), - (22, G["not"]): ("SHIFT", 44), - (22, G["{"]): ("SHIFT", 19), - (22, G["if"]): ("SHIFT", 21), - (22, G["new"]): ("SHIFT", 31), (22, G["let"]): ("SHIFT", 23), (22, G["isvoid"]): ("SHIFT", 33), + (22, G["not"]): ("SHIFT", 44), + (22, G["while"]): ("SHIFT", 22), + (22, G["id"]): ("SHIFT", 15), (22, G["string"]): ("SHIFT", 17), - (22, G["~"]): ("SHIFT", 37), + (22, G["if"]): ("SHIFT", 21), (22, G["("]): ("SHIFT", 20), - (22, G["case"]): ("SHIFT", 30), - (22, G["true"]): ("SHIFT", 35), - (22, G["while"]): ("SHIFT", 22), (22, G["false"]): ("SHIFT", 36), + (22, G["~"]): ("SHIFT", 37), + (22, G["new"]): ("SHIFT", 31), + (22, G["true"]): ("SHIFT", 35), + (22, G["{"]): ("SHIFT", 19), (22, G["integer"]): ("SHIFT", 18), + (22, G["case"]): ("SHIFT", 30), (23, G["id"]): ("SHIFT", 24), (24, G[":"]): ("SHIFT", 25), (25, G["type"]): ("SHIFT", 26), (26, G["<-"]): ("SHIFT", 29), (26, G[","]): ("SHIFT", 27), - (26, G["in"]): ("REDUCE", AttributeProduction(G["declaration-list"], Sentence(G["id"], G[":"], G["type"]), [lambda s: [VarDeclarationNode(s[1], s[3])]])), + (26, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), (27, G["id"]): ("SHIFT", 24), - (28, G["in"]): ("REDUCE", AttributeProduction(G["declaration-list"], Sentence(G["id"], G[":"], G["type"], G[","], G["declaration-list"]), [lambda s: [VarDeclarationNode(s[1], s[3])] + s[5]])), - (29, G["isvoid"]): ("SHIFT", 33), - (29, G["id"]): ("SHIFT", 15), - (29, G["string"]): ("SHIFT", 17), - (29, G["~"]): ("SHIFT", 37), - (29, G["while"]): ("SHIFT", 22), - (29, G["if"]): ("SHIFT", 21), - (29, G["integer"]): ("SHIFT", 18), + (28, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), (29, G["{"]): ("SHIFT", 19), - (29, G["false"]): ("SHIFT", 36), - (29, G["new"]): ("SHIFT", 31), + (29, G["integer"]): ("SHIFT", 18), + (29, G["if"]): ("SHIFT", 21), (29, G["let"]): ("SHIFT", 23), + (29, G["~"]): ("SHIFT", 37), + (29, G["("]): ("SHIFT", 20), + (29, G["string"]): ("SHIFT", 17), + (29, G["id"]): ("SHIFT", 15), + (29, G["false"]): ("SHIFT", 36), + (29, G["while"]): ("SHIFT", 22), (29, G["case"]): ("SHIFT", 30), (29, G["not"]): ("SHIFT", 44), + (29, G["isvoid"]): ("SHIFT", 33), + (29, G["new"]): ("SHIFT", 31), (29, G["true"]): ("SHIFT", 35), - (29, G["("]): ("SHIFT", 20), + (30, G["case"]): ("SHIFT", 30), + (30, G["("]): ("SHIFT", 20), + (30, G["new"]): ("SHIFT", 31), + (30, G["string"]): ("SHIFT", 17), + (30, G["let"]): ("SHIFT", 23), + (30, G["isvoid"]): ("SHIFT", 33), (30, G["while"]): ("SHIFT", 22), - (30, G["false"]): ("SHIFT", 36), - (30, G["id"]): ("SHIFT", 15), (30, G["not"]): ("SHIFT", 44), - (30, G["new"]): ("SHIFT", 31), + (30, G["true"]): ("SHIFT", 35), + (30, G["integer"]): ("SHIFT", 18), + (30, G["id"]): ("SHIFT", 15), (30, G["if"]): ("SHIFT", 21), - (30, G["let"]): ("SHIFT", 23), + (30, G["false"]): ("SHIFT", 36), (30, G["~"]): ("SHIFT", 37), (30, G["{"]): ("SHIFT", 19), - (30, G["integer"]): ("SHIFT", 18), - (30, G["true"]): ("SHIFT", 35), - (30, G["isvoid"]): ("SHIFT", 33), - (30, G["string"]): ("SHIFT", 17), - (30, G["("]): ("SHIFT", 20), - (30, G["case"]): ("SHIFT", 30), (31, G["type"]): ("SHIFT", 32), - (32, G["then"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), - (32, G["else"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), - (32, G["fi"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), - (32, G["loop"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), - (32, G["pool"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), - (32, G["in"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), - (32, G["of"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), - (32, G["+"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), - (32, G["-"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), - (32, G["*"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), - (32, G["/"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), - (32, G["<"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), - (32, G["<="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), - (32, G["="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), - (32, G["}"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), - (32, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), - (32, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), - (32, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), - (32, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), - (32, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["new"], G["type"]), [lambda s: InstantiateNode(s[2])])), - (33, G["new"]): ("SHIFT", 31), + (32, G["loop"]): ("REDUCE", G["atom -> new type"]), + (32, G["pool"]): ("REDUCE", G["atom -> new type"]), + (32, G["in"]): ("REDUCE", G["atom -> new type"]), + (32, G["of"]): ("REDUCE", G["atom -> new type"]), + (32, G["+"]): ("REDUCE", G["atom -> new type"]), + (32, G["-"]): ("REDUCE", G["atom -> new type"]), + (32, G["*"]): ("REDUCE", G["atom -> new type"]), + (32, G["/"]): ("REDUCE", G["atom -> new type"]), + (32, G["<"]): ("REDUCE", G["atom -> new type"]), + (32, G["<="]): ("REDUCE", G["atom -> new type"]), + (32, G["="]): ("REDUCE", G["atom -> new type"]), + (32, G["}"]): ("REDUCE", G["atom -> new type"]), + (32, G[")"]): ("REDUCE", G["atom -> new type"]), + (32, G[","]): ("REDUCE", G["atom -> new type"]), + (32, G["."]): ("REDUCE", G["atom -> new type"]), + (32, G["@"]): ("REDUCE", G["atom -> new type"]), + (32, G[";"]): ("REDUCE", G["atom -> new type"]), + (32, G["then"]): ("REDUCE", G["atom -> new type"]), + (32, G["else"]): ("REDUCE", G["atom -> new type"]), + (32, G["fi"]): ("REDUCE", G["atom -> new type"]), + (33, G["false"]): ("SHIFT", 36), (33, G["isvoid"]): ("SHIFT", 33), (33, G["("]): ("SHIFT", 20), - (33, G["string"]): ("SHIFT", 17), (33, G["id"]): ("SHIFT", 34), - (33, G["false"]): ("SHIFT", 36), - (33, G["~"]): ("SHIFT", 37), (33, G["integer"]): ("SHIFT", 18), + (33, G["string"]): ("SHIFT", 17), + (33, G["new"]): ("SHIFT", 31), + (33, G["~"]): ("SHIFT", 37), (33, G["true"]): ("SHIFT", 35), (34, G["("]): ("SHIFT", 16), - (34, G["then"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (34, G["else"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (34, G["fi"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (34, G["loop"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (34, G["pool"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (34, G["in"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (34, G["of"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (34, G["+"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (34, G["-"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (34, G["*"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (34, G["/"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (34, G["<"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (34, G["<="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (34, G["="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (34, G["}"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (34, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (34, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (34, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (34, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (34, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["id"]), [lambda s: VariableNode(s[1])])), - (35, G["then"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), - (35, G["else"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), - (35, G["fi"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), - (35, G["loop"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), - (35, G["pool"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), - (35, G["in"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), - (35, G["of"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), - (35, G["+"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), - (35, G["-"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), - (35, G["*"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), - (35, G["/"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), - (35, G["<"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), - (35, G["<="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), - (35, G["="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), - (35, G["}"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), - (35, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), - (35, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), - (35, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), - (35, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), - (35, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["true"]), [lambda s: BooleanNode(s[1])])), - (36, G["then"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), - (36, G["else"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), - (36, G["fi"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), - (36, G["loop"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), - (36, G["pool"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), - (36, G["in"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), - (36, G["of"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), - (36, G["+"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), - (36, G["-"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), - (36, G["*"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), - (36, G["/"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), - (36, G["<"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), - (36, G["<="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), - (36, G["="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), - (36, G["}"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), - (36, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), - (36, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), - (36, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), - (36, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), - (36, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["false"]), [lambda s: BooleanNode(s[1])])), - (37, G["new"]): ("SHIFT", 31), + (34, G["loop"]): ("REDUCE", G["atom -> id"]), + (34, G["pool"]): ("REDUCE", G["atom -> id"]), + (34, G["in"]): ("REDUCE", G["atom -> id"]), + (34, G["of"]): ("REDUCE", G["atom -> id"]), + (34, G["+"]): ("REDUCE", G["atom -> id"]), + (34, G["-"]): ("REDUCE", G["atom -> id"]), + (34, G["*"]): ("REDUCE", G["atom -> id"]), + (34, G["/"]): ("REDUCE", G["atom -> id"]), + (34, G["<"]): ("REDUCE", G["atom -> id"]), + (34, G["<="]): ("REDUCE", G["atom -> id"]), + (34, G["="]): ("REDUCE", G["atom -> id"]), + (34, G["}"]): ("REDUCE", G["atom -> id"]), + (34, G[")"]): ("REDUCE", G["atom -> id"]), + (34, G[","]): ("REDUCE", G["atom -> id"]), + (34, G["."]): ("REDUCE", G["atom -> id"]), + (34, G["@"]): ("REDUCE", G["atom -> id"]), + (34, G[";"]): ("REDUCE", G["atom -> id"]), + (34, G["then"]): ("REDUCE", G["atom -> id"]), + (34, G["else"]): ("REDUCE", G["atom -> id"]), + (34, G["fi"]): ("REDUCE", G["atom -> id"]), + (35, G["loop"]): ("REDUCE", G["atom -> true"]), + (35, G["pool"]): ("REDUCE", G["atom -> true"]), + (35, G["in"]): ("REDUCE", G["atom -> true"]), + (35, G["of"]): ("REDUCE", G["atom -> true"]), + (35, G["+"]): ("REDUCE", G["atom -> true"]), + (35, G["-"]): ("REDUCE", G["atom -> true"]), + (35, G["*"]): ("REDUCE", G["atom -> true"]), + (35, G["/"]): ("REDUCE", G["atom -> true"]), + (35, G["<"]): ("REDUCE", G["atom -> true"]), + (35, G["<="]): ("REDUCE", G["atom -> true"]), + (35, G["="]): ("REDUCE", G["atom -> true"]), + (35, G["}"]): ("REDUCE", G["atom -> true"]), + (35, G[")"]): ("REDUCE", G["atom -> true"]), + (35, G[","]): ("REDUCE", G["atom -> true"]), + (35, G["."]): ("REDUCE", G["atom -> true"]), + (35, G["@"]): ("REDUCE", G["atom -> true"]), + (35, G[";"]): ("REDUCE", G["atom -> true"]), + (35, G["then"]): ("REDUCE", G["atom -> true"]), + (35, G["else"]): ("REDUCE", G["atom -> true"]), + (35, G["fi"]): ("REDUCE", G["atom -> true"]), + (36, G["loop"]): ("REDUCE", G["atom -> false"]), + (36, G["pool"]): ("REDUCE", G["atom -> false"]), + (36, G["in"]): ("REDUCE", G["atom -> false"]), + (36, G["of"]): ("REDUCE", G["atom -> false"]), + (36, G["+"]): ("REDUCE", G["atom -> false"]), + (36, G["-"]): ("REDUCE", G["atom -> false"]), + (36, G["*"]): ("REDUCE", G["atom -> false"]), + (36, G["/"]): ("REDUCE", G["atom -> false"]), + (36, G["<"]): ("REDUCE", G["atom -> false"]), + (36, G["<="]): ("REDUCE", G["atom -> false"]), + (36, G["="]): ("REDUCE", G["atom -> false"]), + (36, G["}"]): ("REDUCE", G["atom -> false"]), + (36, G[")"]): ("REDUCE", G["atom -> false"]), + (36, G[","]): ("REDUCE", G["atom -> false"]), + (36, G["."]): ("REDUCE", G["atom -> false"]), + (36, G["@"]): ("REDUCE", G["atom -> false"]), + (36, G[";"]): ("REDUCE", G["atom -> false"]), + (36, G["then"]): ("REDUCE", G["atom -> false"]), + (36, G["else"]): ("REDUCE", G["atom -> false"]), + (36, G["fi"]): ("REDUCE", G["atom -> false"]), + (37, G["false"]): ("SHIFT", 36), (37, G["isvoid"]): ("SHIFT", 33), (37, G["("]): ("SHIFT", 20), - (37, G["string"]): ("SHIFT", 17), (37, G["id"]): ("SHIFT", 34), - (37, G["false"]): ("SHIFT", 36), - (37, G["~"]): ("SHIFT", 37), (37, G["integer"]): ("SHIFT", 18), + (37, G["string"]): ("SHIFT", 17), + (37, G["new"]): ("SHIFT", 31), + (37, G["~"]): ("SHIFT", 37), (37, G["true"]): ("SHIFT", 35), - (38, G["then"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), - (38, G["else"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), - (38, G["fi"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), - (38, G["loop"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), - (38, G["pool"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), - (38, G["in"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), - (38, G["of"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), - (38, G["+"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), - (38, G["-"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), - (38, G["*"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), - (38, G["/"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), - (38, G["<"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), - (38, G["<="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), - (38, G["="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), - (38, G["}"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), - (38, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), - (38, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), - (38, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), - (38, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), - (38, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["function-call"]), [lambda s: s[1]])), - (39, G["-"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), - (39, G[","]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), - (39, G["*"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), - (39, G["then"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), - (39, G["/"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), - (39, G["else"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), - (39, G["of"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), - (39, G["<"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), - (39, G["fi"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), - (39, G["+"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), - (39, G["<="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), - (39, G[";"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), - (39, G["="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), - (39, G["loop"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), - (39, G["pool"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), - (39, G["}"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), - (39, G["in"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), - (39, G[")"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["~"], G["factor"]), [lambda s: ComplementNode(s[2])])), - (40, G["."]): ("SHIFT", 41), + (38, G["loop"]): ("REDUCE", G["atom -> function-call"]), + (38, G["pool"]): ("REDUCE", G["atom -> function-call"]), + (38, G["in"]): ("REDUCE", G["atom -> function-call"]), + (38, G["of"]): ("REDUCE", G["atom -> function-call"]), + (38, G["+"]): ("REDUCE", G["atom -> function-call"]), + (38, G["-"]): ("REDUCE", G["atom -> function-call"]), + (38, G["*"]): ("REDUCE", G["atom -> function-call"]), + (38, G["/"]): ("REDUCE", G["atom -> function-call"]), + (38, G["<"]): ("REDUCE", G["atom -> function-call"]), + (38, G["<="]): ("REDUCE", G["atom -> function-call"]), + (38, G["="]): ("REDUCE", G["atom -> function-call"]), + (38, G["}"]): ("REDUCE", G["atom -> function-call"]), + (38, G[")"]): ("REDUCE", G["atom -> function-call"]), + (38, G[","]): ("REDUCE", G["atom -> function-call"]), + (38, G["."]): ("REDUCE", G["atom -> function-call"]), + (38, G["@"]): ("REDUCE", G["atom -> function-call"]), + (38, G[";"]): ("REDUCE", G["atom -> function-call"]), + (38, G["then"]): ("REDUCE", G["atom -> function-call"]), + (38, G["else"]): ("REDUCE", G["atom -> function-call"]), + (38, G["fi"]): ("REDUCE", G["atom -> function-call"]), + (39, G["="]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["}"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["+"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G[")"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["-"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["in"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G[","]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["*"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["then"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["/"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["else"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["of"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["<="]): ("REDUCE", G["factor -> ~ factor"]), + (39, G[";"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["<"]): ("REDUCE", G["factor -> ~ factor"]), + (40, G["="]): ("REDUCE", G["factor -> atom"]), + (40, G["loop"]): ("REDUCE", G["factor -> atom"]), + (40, G["}"]): ("REDUCE", G["factor -> atom"]), + (40, G["fi"]): ("REDUCE", G["factor -> atom"]), + (40, G["pool"]): ("REDUCE", G["factor -> atom"]), + (40, G["+"]): ("REDUCE", G["factor -> atom"]), + (40, G[")"]): ("REDUCE", G["factor -> atom"]), + (40, G["-"]): ("REDUCE", G["factor -> atom"]), + (40, G["in"]): ("REDUCE", G["factor -> atom"]), + (40, G[","]): ("REDUCE", G["factor -> atom"]), + (40, G["*"]): ("REDUCE", G["factor -> atom"]), + (40, G["then"]): ("REDUCE", G["factor -> atom"]), + (40, G["/"]): ("REDUCE", G["factor -> atom"]), + (40, G["else"]): ("REDUCE", G["factor -> atom"]), + (40, G["of"]): ("REDUCE", G["factor -> atom"]), + (40, G["<="]): ("REDUCE", G["factor -> atom"]), + (40, G[";"]): ("REDUCE", G["factor -> atom"]), + (40, G["<"]): ("REDUCE", G["factor -> atom"]), (40, G["@"]): ("SHIFT", 69), - (40, G["-"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), - (40, G[","]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), - (40, G["*"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), - (40, G["then"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), - (40, G["/"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), - (40, G["else"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), - (40, G["of"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), - (40, G["<"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), - (40, G["fi"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), - (40, G["+"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), - (40, G["<="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), - (40, G[";"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), - (40, G["="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), - (40, G["loop"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), - (40, G["pool"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), - (40, G["}"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), - (40, G["in"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), - (40, G[")"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["atom"]), [lambda s: s[1]])), + (40, G["."]): ("SHIFT", 41), (41, G["id"]): ("SHIFT", 42), (42, G["("]): ("SHIFT", 43), - (43, G["integer"]): ("SHIFT", 18), - (43, G["let"]): ("SHIFT", 23), + (43, G["true"]): ("SHIFT", 35), + (43, G["{"]): ("SHIFT", 19), (43, G["id"]): ("SHIFT", 15), + (43, G["false"]): ("SHIFT", 36), + (43, G["~"]): ("SHIFT", 37), + (43, G["new"]): ("SHIFT", 31), (43, G["if"]): ("SHIFT", 21), - (43, G["{"]): ("SHIFT", 19), + (43, G["let"]): ("SHIFT", 23), (43, G["string"]): ("SHIFT", 17), (43, G["("]): ("SHIFT", 20), - (43, G["case"]): ("SHIFT", 30), - (43, G["true"]): ("SHIFT", 35), - (43, G["isvoid"]): ("SHIFT", 33), - (43, G["not"]): ("SHIFT", 44), - (43, G["new"]): ("SHIFT", 31), (43, G["while"]): ("SHIFT", 22), - (43, G["false"]): ("SHIFT", 36), - (43, G["~"]): ("SHIFT", 37), - (44, G["string"]): ("SHIFT", 17), - (44, G["true"]): ("SHIFT", 35), - (44, G["("]): ("SHIFT", 20), - (44, G["not"]): ("SHIFT", 44), - (44, G["{"]): ("SHIFT", 19), - (44, G["if"]): ("SHIFT", 21), + (43, G["not"]): ("SHIFT", 44), + (43, G["isvoid"]): ("SHIFT", 33), + (43, G["case"]): ("SHIFT", 30), + (43, G["integer"]): ("SHIFT", 18), (44, G["false"]): ("SHIFT", 36), (44, G["isvoid"]): ("SHIFT", 33), - (44, G["id"]): ("SHIFT", 15), + (44, G["not"]): ("SHIFT", 44), + (44, G["while"]): ("SHIFT", 22), + (44, G["new"]): ("SHIFT", 31), + (44, G["true"]): ("SHIFT", 35), + (44, G["("]): ("SHIFT", 20), (44, G["let"]): ("SHIFT", 23), (44, G["case"]): ("SHIFT", 30), - (44, G["~"]): ("SHIFT", 37), - (44, G["new"]): ("SHIFT", 31), - (44, G["while"]): ("SHIFT", 22), + (44, G["id"]): ("SHIFT", 15), + (44, G["{"]): ("SHIFT", 19), (44, G["integer"]): ("SHIFT", 18), - (45, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), - (45, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), - (45, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), - (45, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), - (45, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), - (45, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), - (45, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), - (45, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), - (45, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), - (45, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), - (45, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["not"], G["expr"]), [lambda s: NegationNode(s[2])])), + (44, G["if"]): ("SHIFT", 21), + (44, G["string"]): ("SHIFT", 17), + (44, G["~"]): ("SHIFT", 37), + (45, G["loop"]): ("REDUCE", G["expr -> not expr"]), + (45, G["}"]): ("REDUCE", G["expr -> not expr"]), + (45, G["fi"]): ("REDUCE", G["expr -> not expr"]), + (45, G["pool"]): ("REDUCE", G["expr -> not expr"]), + (45, G[")"]): ("REDUCE", G["expr -> not expr"]), + (45, G["in"]): ("REDUCE", G["expr -> not expr"]), + (45, G[","]): ("REDUCE", G["expr -> not expr"]), + (45, G["then"]): ("REDUCE", G["expr -> not expr"]), + (45, G["else"]): ("REDUCE", G["expr -> not expr"]), + (45, G["of"]): ("REDUCE", G["expr -> not expr"]), + (45, G[";"]): ("REDUCE", G["expr -> not expr"]), (46, G["="]): ("SHIFT", 61), - (46, G["<="]): ("SHIFT", 59), (46, G["<"]): ("SHIFT", 47), - (46, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), - (46, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), - (46, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), - (46, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), - (46, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), - (46, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), - (46, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), - (46, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), - (46, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), - (46, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), - (46, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["comp"]), [lambda s: s[1]])), + (46, G["loop"]): ("REDUCE", G["expr -> comp"]), + (46, G["}"]): ("REDUCE", G["expr -> comp"]), + (46, G["pool"]): ("REDUCE", G["expr -> comp"]), + (46, G[")"]): ("REDUCE", G["expr -> comp"]), + (46, G[","]): ("REDUCE", G["expr -> comp"]), + (46, G["in"]): ("REDUCE", G["expr -> comp"]), + (46, G["then"]): ("REDUCE", G["expr -> comp"]), + (46, G["else"]): ("REDUCE", G["expr -> comp"]), + (46, G["fi"]): ("REDUCE", G["expr -> comp"]), + (46, G[";"]): ("REDUCE", G["expr -> comp"]), + (46, G["of"]): ("REDUCE", G["expr -> comp"]), + (46, G["<="]): ("SHIFT", 59), + (47, G["false"]): ("SHIFT", 36), (47, G["isvoid"]): ("SHIFT", 33), - (47, G["string"]): ("SHIFT", 17), - (47, G["id"]): ("SHIFT", 34), - (47, G["~"]): ("SHIFT", 37), - (47, G["true"]): ("SHIFT", 35), (47, G["new"]): ("SHIFT", 31), + (47, G["true"]): ("SHIFT", 35), (47, G["("]): ("SHIFT", 20), - (47, G["false"]): ("SHIFT", 36), + (47, G["id"]): ("SHIFT", 34), (47, G["integer"]): ("SHIFT", 18), - (48, G[","]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), - (48, G["then"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), - (48, G["else"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), - (48, G["of"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), - (48, G["<"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), - (48, G["fi"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), - (48, G["<="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), - (48, G[";"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), - (48, G["="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), - (48, G["loop"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), - (48, G["pool"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), - (48, G["}"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), - (48, G["in"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), - (48, G[")"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<"], G["arith"]), [lambda s: LessNode(s[1], s[3])])), + (47, G["string"]): ("SHIFT", 17), + (47, G["~"]): ("SHIFT", 37), (48, G["-"]): ("SHIFT", 56), + (48, G["="]): ("REDUCE", G["comp -> comp < arith"]), + (48, G["loop"]): ("REDUCE", G["comp -> comp < arith"]), + (48, G["}"]): ("REDUCE", G["comp -> comp < arith"]), + (48, G["fi"]): ("REDUCE", G["comp -> comp < arith"]), + (48, G["pool"]): ("REDUCE", G["comp -> comp < arith"]), + (48, G[")"]): ("REDUCE", G["comp -> comp < arith"]), + (48, G[","]): ("REDUCE", G["comp -> comp < arith"]), + (48, G["in"]): ("REDUCE", G["comp -> comp < arith"]), + (48, G["then"]): ("REDUCE", G["comp -> comp < arith"]), + (48, G["else"]): ("REDUCE", G["comp -> comp < arith"]), + (48, G["of"]): ("REDUCE", G["comp -> comp < arith"]), + (48, G["<="]): ("REDUCE", G["comp -> comp < arith"]), + (48, G[";"]): ("REDUCE", G["comp -> comp < arith"]), + (48, G["<"]): ("REDUCE", G["comp -> comp < arith"]), (48, G["+"]): ("SHIFT", 49), - (49, G["string"]): ("SHIFT", 17), - (49, G["id"]): ("SHIFT", 34), - (49, G["~"]): ("SHIFT", 37), - (49, G["true"]): ("SHIFT", 35), - (49, G["new"]): ("SHIFT", 31), - (49, G["("]): ("SHIFT", 20), (49, G["false"]): ("SHIFT", 36), + (49, G["id"]): ("SHIFT", 34), (49, G["isvoid"]): ("SHIFT", 33), + (49, G["("]): ("SHIFT", 20), (49, G["integer"]): ("SHIFT", 18), + (49, G["string"]): ("SHIFT", 17), + (49, G["new"]): ("SHIFT", 31), + (49, G["~"]): ("SHIFT", 37), + (49, G["true"]): ("SHIFT", 35), (50, G["*"]): ("SHIFT", 51), - (50, G["-"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), - (50, G[","]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), - (50, G["then"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), - (50, G["else"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), - (50, G["of"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), - (50, G["<"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), - (50, G["fi"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), - (50, G["+"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), - (50, G["<="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), - (50, G[";"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), - (50, G["="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), - (50, G["loop"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), - (50, G["pool"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), - (50, G["}"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), - (50, G["in"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), - (50, G[")"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["+"], G["term"]), [lambda s: PlusNode(s[1], s[3])])), + (50, G["="]): ("REDUCE", G["arith -> arith + term"]), + (50, G["loop"]): ("REDUCE", G["arith -> arith + term"]), + (50, G["}"]): ("REDUCE", G["arith -> arith + term"]), + (50, G["fi"]): ("REDUCE", G["arith -> arith + term"]), + (50, G["pool"]): ("REDUCE", G["arith -> arith + term"]), + (50, G["+"]): ("REDUCE", G["arith -> arith + term"]), + (50, G[")"]): ("REDUCE", G["arith -> arith + term"]), + (50, G["-"]): ("REDUCE", G["arith -> arith + term"]), + (50, G[","]): ("REDUCE", G["arith -> arith + term"]), + (50, G["in"]): ("REDUCE", G["arith -> arith + term"]), + (50, G["then"]): ("REDUCE", G["arith -> arith + term"]), + (50, G["else"]): ("REDUCE", G["arith -> arith + term"]), + (50, G["of"]): ("REDUCE", G["arith -> arith + term"]), + (50, G["<="]): ("REDUCE", G["arith -> arith + term"]), + (50, G[";"]): ("REDUCE", G["arith -> arith + term"]), + (50, G["<"]): ("REDUCE", G["arith -> arith + term"]), (50, G["/"]): ("SHIFT", 53), - (51, G["new"]): ("SHIFT", 31), - (51, G["("]): ("SHIFT", 20), - (51, G["string"]): ("SHIFT", 17), - (51, G["id"]): ("SHIFT", 34), (51, G["false"]): ("SHIFT", 36), - (51, G["~"]): ("SHIFT", 37), (51, G["isvoid"]): ("SHIFT", 33), + (51, G["("]): ("SHIFT", 20), (51, G["integer"]): ("SHIFT", 18), + (51, G["id"]): ("SHIFT", 34), + (51, G["string"]): ("SHIFT", 17), + (51, G["new"]): ("SHIFT", 31), + (51, G["~"]): ("SHIFT", 37), (51, G["true"]): ("SHIFT", 35), - (52, G["-"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), - (52, G[","]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), - (52, G["*"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), - (52, G["then"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), - (52, G["/"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), - (52, G["else"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), - (52, G["of"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), - (52, G["<"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), - (52, G["fi"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), - (52, G["+"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), - (52, G["<="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), - (52, G[";"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), - (52, G["="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), - (52, G["loop"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), - (52, G["pool"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), - (52, G["}"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), - (52, G["in"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), - (52, G[")"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["*"], G["factor"]), [lambda s: StarNode(s[1], s[3])])), - (53, G["new"]): ("SHIFT", 31), - (53, G["("]): ("SHIFT", 20), - (53, G["string"]): ("SHIFT", 17), - (53, G["id"]): ("SHIFT", 34), + (52, G["="]): ("REDUCE", G["term -> term * factor"]), + (52, G["loop"]): ("REDUCE", G["term -> term * factor"]), + (52, G["}"]): ("REDUCE", G["term -> term * factor"]), + (52, G["fi"]): ("REDUCE", G["term -> term * factor"]), + (52, G["pool"]): ("REDUCE", G["term -> term * factor"]), + (52, G["+"]): ("REDUCE", G["term -> term * factor"]), + (52, G[")"]): ("REDUCE", G["term -> term * factor"]), + (52, G["-"]): ("REDUCE", G["term -> term * factor"]), + (52, G[","]): ("REDUCE", G["term -> term * factor"]), + (52, G["in"]): ("REDUCE", G["term -> term * factor"]), + (52, G["*"]): ("REDUCE", G["term -> term * factor"]), + (52, G["then"]): ("REDUCE", G["term -> term * factor"]), + (52, G["/"]): ("REDUCE", G["term -> term * factor"]), + (52, G["else"]): ("REDUCE", G["term -> term * factor"]), + (52, G["of"]): ("REDUCE", G["term -> term * factor"]), + (52, G["<="]): ("REDUCE", G["term -> term * factor"]), + (52, G[";"]): ("REDUCE", G["term -> term * factor"]), + (52, G["<"]): ("REDUCE", G["term -> term * factor"]), (53, G["false"]): ("SHIFT", 36), - (53, G["~"]): ("SHIFT", 37), (53, G["isvoid"]): ("SHIFT", 33), + (53, G["("]): ("SHIFT", 20), (53, G["integer"]): ("SHIFT", 18), + (53, G["id"]): ("SHIFT", 34), + (53, G["string"]): ("SHIFT", 17), + (53, G["new"]): ("SHIFT", 31), + (53, G["~"]): ("SHIFT", 37), (53, G["true"]): ("SHIFT", 35), - (54, G["-"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), - (54, G[","]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), - (54, G["*"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), - (54, G["then"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), - (54, G["/"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), - (54, G["else"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), - (54, G["of"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), - (54, G["<"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), - (54, G["fi"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), - (54, G["+"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), - (54, G["<="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), - (54, G[";"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), - (54, G["="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), - (54, G["loop"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), - (54, G["pool"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), - (54, G["}"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), - (54, G["in"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), - (54, G[")"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["term"], G["/"], G["factor"]), [lambda s: DivNode(s[1], s[3])])), - (55, G["-"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), - (55, G[","]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), - (55, G["*"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), - (55, G["then"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), - (55, G["/"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), - (55, G["else"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), - (55, G["of"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), - (55, G["<"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), - (55, G["fi"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), - (55, G["+"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), - (55, G["<="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), - (55, G[";"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), - (55, G["="]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), - (55, G["loop"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), - (55, G["pool"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), - (55, G["}"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), - (55, G["in"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), - (55, G[")"]): ("REDUCE", AttributeProduction(G["term"], Sentence(G["factor"]), [lambda s: s[1]])), - (56, G["string"]): ("SHIFT", 17), - (56, G["id"]): ("SHIFT", 34), - (56, G["~"]): ("SHIFT", 37), - (56, G["true"]): ("SHIFT", 35), - (56, G["new"]): ("SHIFT", 31), - (56, G["("]): ("SHIFT", 20), + (54, G["="]): ("REDUCE", G["term -> term / factor"]), + (54, G["loop"]): ("REDUCE", G["term -> term / factor"]), + (54, G["}"]): ("REDUCE", G["term -> term / factor"]), + (54, G["fi"]): ("REDUCE", G["term -> term / factor"]), + (54, G["pool"]): ("REDUCE", G["term -> term / factor"]), + (54, G["+"]): ("REDUCE", G["term -> term / factor"]), + (54, G[")"]): ("REDUCE", G["term -> term / factor"]), + (54, G["-"]): ("REDUCE", G["term -> term / factor"]), + (54, G[","]): ("REDUCE", G["term -> term / factor"]), + (54, G["in"]): ("REDUCE", G["term -> term / factor"]), + (54, G["*"]): ("REDUCE", G["term -> term / factor"]), + (54, G["then"]): ("REDUCE", G["term -> term / factor"]), + (54, G["/"]): ("REDUCE", G["term -> term / factor"]), + (54, G["else"]): ("REDUCE", G["term -> term / factor"]), + (54, G["of"]): ("REDUCE", G["term -> term / factor"]), + (54, G["<="]): ("REDUCE", G["term -> term / factor"]), + (54, G[";"]): ("REDUCE", G["term -> term / factor"]), + (54, G["<"]): ("REDUCE", G["term -> term / factor"]), + (55, G["="]): ("REDUCE", G["term -> factor"]), + (55, G["loop"]): ("REDUCE", G["term -> factor"]), + (55, G["}"]): ("REDUCE", G["term -> factor"]), + (55, G["fi"]): ("REDUCE", G["term -> factor"]), + (55, G["pool"]): ("REDUCE", G["term -> factor"]), + (55, G["+"]): ("REDUCE", G["term -> factor"]), + (55, G[")"]): ("REDUCE", G["term -> factor"]), + (55, G["-"]): ("REDUCE", G["term -> factor"]), + (55, G["in"]): ("REDUCE", G["term -> factor"]), + (55, G[","]): ("REDUCE", G["term -> factor"]), + (55, G["*"]): ("REDUCE", G["term -> factor"]), + (55, G["then"]): ("REDUCE", G["term -> factor"]), + (55, G["/"]): ("REDUCE", G["term -> factor"]), + (55, G["else"]): ("REDUCE", G["term -> factor"]), + (55, G["of"]): ("REDUCE", G["term -> factor"]), + (55, G["<="]): ("REDUCE", G["term -> factor"]), + (55, G[";"]): ("REDUCE", G["term -> factor"]), + (55, G["<"]): ("REDUCE", G["term -> factor"]), (56, G["false"]): ("SHIFT", 36), + (56, G["id"]): ("SHIFT", 34), (56, G["isvoid"]): ("SHIFT", 33), + (56, G["("]): ("SHIFT", 20), (56, G["integer"]): ("SHIFT", 18), + (56, G["string"]): ("SHIFT", 17), + (56, G["new"]): ("SHIFT", 31), + (56, G["~"]): ("SHIFT", 37), + (56, G["true"]): ("SHIFT", 35), + (57, G["="]): ("REDUCE", G["arith -> arith - term"]), + (57, G["loop"]): ("REDUCE", G["arith -> arith - term"]), + (57, G["}"]): ("REDUCE", G["arith -> arith - term"]), + (57, G["fi"]): ("REDUCE", G["arith -> arith - term"]), + (57, G["pool"]): ("REDUCE", G["arith -> arith - term"]), + (57, G["+"]): ("REDUCE", G["arith -> arith - term"]), + (57, G[")"]): ("REDUCE", G["arith -> arith - term"]), + (57, G["-"]): ("REDUCE", G["arith -> arith - term"]), + (57, G[","]): ("REDUCE", G["arith -> arith - term"]), + (57, G["in"]): ("REDUCE", G["arith -> arith - term"]), + (57, G["then"]): ("REDUCE", G["arith -> arith - term"]), + (57, G["else"]): ("REDUCE", G["arith -> arith - term"]), + (57, G["of"]): ("REDUCE", G["arith -> arith - term"]), + (57, G["<="]): ("REDUCE", G["arith -> arith - term"]), + (57, G[";"]): ("REDUCE", G["arith -> arith - term"]), + (57, G["<"]): ("REDUCE", G["arith -> arith - term"]), (57, G["*"]): ("SHIFT", 51), - (57, G["-"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), - (57, G[","]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), - (57, G["then"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), - (57, G["else"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), - (57, G["of"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), - (57, G["<"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), - (57, G["fi"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), - (57, G["+"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), - (57, G["<="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), - (57, G[";"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), - (57, G["="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), - (57, G["loop"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), - (57, G["pool"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), - (57, G["}"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), - (57, G["in"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), - (57, G[")"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["arith"], G["-"], G["term"]), [lambda s: MinusNode(s[1], s[3])])), (57, G["/"]): ("SHIFT", 53), (58, G["*"]): ("SHIFT", 51), - (58, G["-"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), - (58, G[","]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), - (58, G["then"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), - (58, G["else"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), - (58, G["of"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), - (58, G["<"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), - (58, G["fi"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), - (58, G["+"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), - (58, G["<="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), - (58, G[";"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), - (58, G["="]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), - (58, G["loop"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), - (58, G["pool"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), - (58, G["}"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), - (58, G["in"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), - (58, G[")"]): ("REDUCE", AttributeProduction(G["arith"], Sentence(G["term"]), [lambda s: s[1]])), (58, G["/"]): ("SHIFT", 53), + (58, G["="]): ("REDUCE", G["arith -> term"]), + (58, G["loop"]): ("REDUCE", G["arith -> term"]), + (58, G["}"]): ("REDUCE", G["arith -> term"]), + (58, G["fi"]): ("REDUCE", G["arith -> term"]), + (58, G["pool"]): ("REDUCE", G["arith -> term"]), + (58, G["+"]): ("REDUCE", G["arith -> term"]), + (58, G[")"]): ("REDUCE", G["arith -> term"]), + (58, G["-"]): ("REDUCE", G["arith -> term"]), + (58, G[","]): ("REDUCE", G["arith -> term"]), + (58, G["in"]): ("REDUCE", G["arith -> term"]), + (58, G["then"]): ("REDUCE", G["arith -> term"]), + (58, G["else"]): ("REDUCE", G["arith -> term"]), + (58, G["of"]): ("REDUCE", G["arith -> term"]), + (58, G["<="]): ("REDUCE", G["arith -> term"]), + (58, G[";"]): ("REDUCE", G["arith -> term"]), + (58, G["<"]): ("REDUCE", G["arith -> term"]), + (59, G["false"]): ("SHIFT", 36), (59, G["isvoid"]): ("SHIFT", 33), - (59, G["string"]): ("SHIFT", 17), - (59, G["id"]): ("SHIFT", 34), - (59, G["~"]): ("SHIFT", 37), - (59, G["true"]): ("SHIFT", 35), (59, G["new"]): ("SHIFT", 31), + (59, G["true"]): ("SHIFT", 35), (59, G["("]): ("SHIFT", 20), - (59, G["false"]): ("SHIFT", 36), + (59, G["id"]): ("SHIFT", 34), (59, G["integer"]): ("SHIFT", 18), - (60, G[","]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), - (60, G["then"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), - (60, G["else"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), - (60, G["of"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), - (60, G["<"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), - (60, G["fi"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), - (60, G["<="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), - (60, G[";"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), - (60, G["="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), - (60, G["loop"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), - (60, G["pool"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), - (60, G["}"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), - (60, G["in"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), - (60, G[")"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["<="], G["arith"]), [lambda s: LessEqualNode(s[1], s[3])])), - (60, G["+"]): ("SHIFT", 49), + (59, G["string"]): ("SHIFT", 17), + (59, G["~"]): ("SHIFT", 37), (60, G["-"]): ("SHIFT", 56), - (61, G["string"]): ("SHIFT", 17), - (61, G["id"]): ("SHIFT", 34), - (61, G["~"]): ("SHIFT", 37), - (61, G["true"]): ("SHIFT", 35), - (61, G["new"]): ("SHIFT", 31), - (61, G["("]): ("SHIFT", 20), + (60, G["+"]): ("SHIFT", 49), + (60, G["="]): ("REDUCE", G["comp -> comp <= arith"]), + (60, G["loop"]): ("REDUCE", G["comp -> comp <= arith"]), + (60, G["}"]): ("REDUCE", G["comp -> comp <= arith"]), + (60, G["fi"]): ("REDUCE", G["comp -> comp <= arith"]), + (60, G["pool"]): ("REDUCE", G["comp -> comp <= arith"]), + (60, G[")"]): ("REDUCE", G["comp -> comp <= arith"]), + (60, G[","]): ("REDUCE", G["comp -> comp <= arith"]), + (60, G["in"]): ("REDUCE", G["comp -> comp <= arith"]), + (60, G["then"]): ("REDUCE", G["comp -> comp <= arith"]), + (60, G["else"]): ("REDUCE", G["comp -> comp <= arith"]), + (60, G["of"]): ("REDUCE", G["comp -> comp <= arith"]), + (60, G["<="]): ("REDUCE", G["comp -> comp <= arith"]), + (60, G[";"]): ("REDUCE", G["comp -> comp <= arith"]), + (60, G["<"]): ("REDUCE", G["comp -> comp <= arith"]), (61, G["false"]): ("SHIFT", 36), (61, G["isvoid"]): ("SHIFT", 33), + (61, G["new"]): ("SHIFT", 31), + (61, G["true"]): ("SHIFT", 35), + (61, G["("]): ("SHIFT", 20), + (61, G["id"]): ("SHIFT", 34), (61, G["integer"]): ("SHIFT", 18), + (61, G["string"]): ("SHIFT", 17), + (61, G["~"]): ("SHIFT", 37), + (62, G["="]): ("REDUCE", G["comp -> comp = arith"]), + (62, G["loop"]): ("REDUCE", G["comp -> comp = arith"]), + (62, G["}"]): ("REDUCE", G["comp -> comp = arith"]), + (62, G["fi"]): ("REDUCE", G["comp -> comp = arith"]), + (62, G["pool"]): ("REDUCE", G["comp -> comp = arith"]), + (62, G[")"]): ("REDUCE", G["comp -> comp = arith"]), + (62, G[","]): ("REDUCE", G["comp -> comp = arith"]), + (62, G["in"]): ("REDUCE", G["comp -> comp = arith"]), + (62, G["then"]): ("REDUCE", G["comp -> comp = arith"]), + (62, G["else"]): ("REDUCE", G["comp -> comp = arith"]), + (62, G["of"]): ("REDUCE", G["comp -> comp = arith"]), + (62, G["<="]): ("REDUCE", G["comp -> comp = arith"]), + (62, G[";"]): ("REDUCE", G["comp -> comp = arith"]), + (62, G["<"]): ("REDUCE", G["comp -> comp = arith"]), (62, G["-"]): ("SHIFT", 56), (62, G["+"]): ("SHIFT", 49), - (62, G[","]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), - (62, G["then"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), - (62, G["else"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), - (62, G["of"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), - (62, G["<"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), - (62, G["fi"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), - (62, G["<="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), - (62, G[";"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), - (62, G["="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), - (62, G["loop"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), - (62, G["pool"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), - (62, G["}"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), - (62, G["in"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), - (62, G[")"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["comp"], G["="], G["arith"]), [lambda s: EqualNode(s[1], s[3])])), - (63, G[","]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), - (63, G["then"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), - (63, G["else"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), - (63, G["of"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), - (63, G["<"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), - (63, G["fi"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), - (63, G["<="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), - (63, G[";"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), - (63, G["="]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), - (63, G["loop"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), - (63, G["pool"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), - (63, G["}"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), - (63, G["in"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), - (63, G[")"]): ("REDUCE", AttributeProduction(G["comp"], Sentence(G["arith"]), [lambda s: s[1]])), + (63, G["="]): ("REDUCE", G["comp -> arith"]), + (63, G["loop"]): ("REDUCE", G["comp -> arith"]), + (63, G["}"]): ("REDUCE", G["comp -> arith"]), + (63, G["pool"]): ("REDUCE", G["comp -> arith"]), + (63, G[")"]): ("REDUCE", G["comp -> arith"]), + (63, G["in"]): ("REDUCE", G["comp -> arith"]), + (63, G[","]): ("REDUCE", G["comp -> arith"]), + (63, G["then"]): ("REDUCE", G["comp -> arith"]), + (63, G["else"]): ("REDUCE", G["comp -> arith"]), + (63, G["fi"]): ("REDUCE", G["comp -> arith"]), + (63, G["<="]): ("REDUCE", G["comp -> arith"]), + (63, G[";"]): ("REDUCE", G["comp -> arith"]), + (63, G["of"]): ("REDUCE", G["comp -> arith"]), + (63, G["<"]): ("REDUCE", G["comp -> arith"]), (63, G["-"]): ("SHIFT", 56), (63, G["+"]): ("SHIFT", 49), (64, G[")"]): ("SHIFT", 65), - (65, G["then"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (65, G["else"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (65, G["fi"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (65, G["loop"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (65, G["pool"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (65, G["in"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (65, G["of"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (65, G["+"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (65, G["-"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (65, G["*"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (65, G["/"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (65, G["<"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (65, G["<="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (65, G["="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (65, G["}"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (65, G[")"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (65, G[","]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (65, G["."]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (65, G["@"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (65, G[";"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), + (65, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (66, G[")"]): ("REDUCE", G["expr-list -> expr"]), (66, G[","]): ("SHIFT", 67), - (66, G[")"]): ("REDUCE", AttributeProduction(G["expr-list"], Sentence(G["expr"]), [lambda s: [s[1]]])), - (67, G["integer"]): ("SHIFT", 18), - (67, G["let"]): ("SHIFT", 23), + (67, G["true"]): ("SHIFT", 35), + (67, G["{"]): ("SHIFT", 19), (67, G["id"]): ("SHIFT", 15), + (67, G["false"]): ("SHIFT", 36), + (67, G["~"]): ("SHIFT", 37), + (67, G["new"]): ("SHIFT", 31), (67, G["if"]): ("SHIFT", 21), - (67, G["{"]): ("SHIFT", 19), + (67, G["let"]): ("SHIFT", 23), (67, G["string"]): ("SHIFT", 17), (67, G["("]): ("SHIFT", 20), - (67, G["case"]): ("SHIFT", 30), - (67, G["true"]): ("SHIFT", 35), - (67, G["isvoid"]): ("SHIFT", 33), - (67, G["not"]): ("SHIFT", 44), - (67, G["new"]): ("SHIFT", 31), (67, G["while"]): ("SHIFT", 22), - (67, G["false"]): ("SHIFT", 36), - (67, G["~"]): ("SHIFT", 37), - (68, G[")"]): ("REDUCE", AttributeProduction(G["expr-list"], Sentence(G["expr"], G[","], G["expr-list"]), [lambda s: [s[1]] + s[3]])), + (67, G["not"]): ("SHIFT", 44), + (67, G["isvoid"]): ("SHIFT", 33), + (67, G["case"]): ("SHIFT", 30), + (67, G["integer"]): ("SHIFT", 18), + (68, G[")"]): ("REDUCE", G["expr-list -> expr , expr-list"]), (69, G["type"]): ("SHIFT", 70), (70, G["."]): ("SHIFT", 71), (71, G["id"]): ("SHIFT", 72), (72, G["("]): ("SHIFT", 73), - (73, G["integer"]): ("SHIFT", 18), - (73, G["let"]): ("SHIFT", 23), + (73, G["true"]): ("SHIFT", 35), + (73, G["{"]): ("SHIFT", 19), (73, G["id"]): ("SHIFT", 15), + (73, G["false"]): ("SHIFT", 36), + (73, G["~"]): ("SHIFT", 37), + (73, G["new"]): ("SHIFT", 31), (73, G["if"]): ("SHIFT", 21), - (73, G["{"]): ("SHIFT", 19), + (73, G["let"]): ("SHIFT", 23), (73, G["string"]): ("SHIFT", 17), (73, G["("]): ("SHIFT", 20), - (73, G["case"]): ("SHIFT", 30), - (73, G["true"]): ("SHIFT", 35), - (73, G["isvoid"]): ("SHIFT", 33), - (73, G["not"]): ("SHIFT", 44), - (73, G["new"]): ("SHIFT", 31), (73, G["while"]): ("SHIFT", 22), - (73, G["false"]): ("SHIFT", 36), - (73, G["~"]): ("SHIFT", 37), + (73, G["not"]): ("SHIFT", 44), + (73, G["isvoid"]): ("SHIFT", 33), + (73, G["case"]): ("SHIFT", 30), + (73, G["integer"]): ("SHIFT", 18), (74, G[")"]): ("SHIFT", 75), - (75, G["then"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (75, G["else"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (75, G["fi"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (75, G["loop"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (75, G["pool"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (75, G["in"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (75, G["of"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (75, G["+"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (75, G["-"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (75, G["*"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (75, G["/"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (75, G["<"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (75, G["<="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (75, G["="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (75, G["}"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (75, G[")"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (75, G[","]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (75, G["."]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (75, G["@"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (75, G[";"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["atom"], G["@"], G["type"], G["."], G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[3], s[5], s[1])])), - (76, G["-"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (76, G[","]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (76, G["*"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (76, G["then"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (76, G["/"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (76, G["else"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (76, G["of"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (76, G["<"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (76, G["fi"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (76, G["+"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (76, G["<="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (76, G[";"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (76, G["="]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (76, G["loop"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (76, G["pool"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (76, G["}"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (76, G["in"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), - (76, G[")"]): ("REDUCE", AttributeProduction(G["factor"], Sentence(G["isvoid"], G["factor"]), [lambda s: IsVoidNode(s[2])])), + (75, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), (77, G["of"]): ("SHIFT", 78), (78, G["id"]): ("SHIFT", 79), (79, G[":"]): ("SHIFT", 80), (80, G["type"]): ("SHIFT", 81), (81, G["=>"]): ("SHIFT", 82), - (82, G["let"]): ("SHIFT", 23), - (82, G["id"]): ("SHIFT", 15), - (82, G["if"]): ("SHIFT", 21), - (82, G["{"]): ("SHIFT", 19), - (82, G["not"]): ("SHIFT", 44), - (82, G["("]): ("SHIFT", 20), (82, G["string"]): ("SHIFT", 17), - (82, G["true"]): ("SHIFT", 35), - (82, G["isvoid"]): ("SHIFT", 33), - (82, G["false"]): ("SHIFT", 36), - (82, G["~"]): ("SHIFT", 37), (82, G["integer"]): ("SHIFT", 18), + (82, G["{"]): ("SHIFT", 19), (82, G["new"]): ("SHIFT", 31), + (82, G["~"]): ("SHIFT", 37), + (82, G["isvoid"]): ("SHIFT", 33), + (82, G["if"]): ("SHIFT", 21), + (82, G["false"]): ("SHIFT", 36), + (82, G["id"]): ("SHIFT", 15), (82, G["while"]): ("SHIFT", 22), + (82, G["not"]): ("SHIFT", 44), + (82, G["("]): ("SHIFT", 20), + (82, G["true"]): ("SHIFT", 35), + (82, G["let"]): ("SHIFT", 23), (82, G["case"]): ("SHIFT", 30), (83, G[";"]): ("SHIFT", 84), (84, G["id"]): ("SHIFT", 79), - (84, G["esac"]): ("REDUCE", AttributeProduction(G["case-list"], Sentence(G["id"], G[":"], G["type"], G["=>"], G["expr"], G[";"]), [lambda s: [SingleCaseNode(s[1], s[3], s[5])]])), - (85, G["esac"]): ("REDUCE", AttributeProduction(G["case-list"], Sentence(G["id"], G[":"], G["type"], G["=>"], G["expr"], G[";"], G["case-list"]), [lambda s: [SingleCaseNode(s[1], s[3], s[5])] + s[7]])), + (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), + (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), (86, G["esac"]): ("SHIFT", 87), - (87, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), - (87, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), - (87, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), - (87, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), - (87, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), - (87, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), - (87, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), - (87, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), - (87, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), - (87, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), - (87, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["case"], G["expr"], G["of"], G["case-list"], G["esac"]), [lambda s: CasesNode(s[2], s[4])])), - (88, G["in"]): ("REDUCE", AttributeProduction(G["declaration-list"], Sentence(G["id"], G[":"], G["type"], G["<-"], G["expr"]), [lambda s: [VarDeclarationNode(s[1], s[3], s[5])]])), + (87, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), (88, G[","]): ("SHIFT", 89), (89, G["id"]): ("SHIFT", 24), - (90, G["in"]): ("REDUCE", AttributeProduction(G["declaration-list"], Sentence(G["id"], G[":"], G["type"], G["<-"], G["expr"], G[","], G["declaration-list"]), [lambda s: [VarDeclarationNode(s[1], s[3], s[5])] + s[7]])), + (90, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), (91, G["in"]): ("SHIFT", 92), - (92, G["string"]): ("SHIFT", 17), - (92, G["true"]): ("SHIFT", 35), - (92, G["("]): ("SHIFT", 20), - (92, G["not"]): ("SHIFT", 44), (92, G["false"]): ("SHIFT", 36), - (92, G["if"]): ("SHIFT", 21), - (92, G["{"]): ("SHIFT", 19), (92, G["isvoid"]): ("SHIFT", 33), - (92, G["id"]): ("SHIFT", 15), + (92, G["not"]): ("SHIFT", 44), + (92, G["while"]): ("SHIFT", 22), + (92, G["new"]): ("SHIFT", 31), + (92, G["true"]): ("SHIFT", 35), + (92, G["("]): ("SHIFT", 20), (92, G["let"]): ("SHIFT", 23), (92, G["case"]): ("SHIFT", 30), - (92, G["~"]): ("SHIFT", 37), - (92, G["new"]): ("SHIFT", 31), - (92, G["while"]): ("SHIFT", 22), + (92, G["id"]): ("SHIFT", 15), + (92, G["{"]): ("SHIFT", 19), (92, G["integer"]): ("SHIFT", 18), - (93, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), - (93, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), - (93, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), - (93, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), - (93, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), - (93, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), - (93, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), - (93, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), - (93, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), - (93, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), - (93, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["let"], G["declaration-list"], G["in"], G["expr"]), [lambda s: LetNode(s[2], s[4])])), + (92, G["if"]): ("SHIFT", 21), + (92, G["string"]): ("SHIFT", 17), + (92, G["~"]): ("SHIFT", 37), + (93, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["loop"]): ("SHIFT", 95), - (95, G["false"]): ("SHIFT", 36), - (95, G["isvoid"]): ("SHIFT", 33), - (95, G["while"]): ("SHIFT", 22), - (95, G["new"]): ("SHIFT", 31), - (95, G["~"]): ("SHIFT", 37), - (95, G["case"]): ("SHIFT", 30), - (95, G["("]): ("SHIFT", 20), - (95, G["true"]): ("SHIFT", 35), + (95, G["not"]): ("SHIFT", 44), (95, G["string"]): ("SHIFT", 17), - (95, G["let"]): ("SHIFT", 23), + (95, G["("]): ("SHIFT", 20), (95, G["id"]): ("SHIFT", 15), - (95, G["integer"]): ("SHIFT", 18), + (95, G["while"]): ("SHIFT", 22), (95, G["{"]): ("SHIFT", 19), + (95, G["integer"]): ("SHIFT", 18), + (95, G["let"]): ("SHIFT", 23), + (95, G["~"]): ("SHIFT", 37), + (95, G["true"]): ("SHIFT", 35), + (95, G["case"]): ("SHIFT", 30), + (95, G["isvoid"]): ("SHIFT", 33), + (95, G["false"]): ("SHIFT", 36), + (95, G["new"]): ("SHIFT", 31), (95, G["if"]): ("SHIFT", 21), - (95, G["not"]): ("SHIFT", 44), (96, G["pool"]): ("SHIFT", 97), - (97, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), - (97, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), - (97, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), - (97, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), - (97, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), - (97, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), - (97, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), - (97, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), - (97, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), - (97, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), - (97, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["while"], G["expr"], G["loop"], G["expr"], G["pool"]), [lambda s: WhileNode(s[2], s[4])])), + (97, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["then"]): ("SHIFT", 99), - (99, G["new"]): ("SHIFT", 31), (99, G["case"]): ("SHIFT", 30), - (99, G["while"]): ("SHIFT", 22), - (99, G["~"]): ("SHIFT", 37), - (99, G["("]): ("SHIFT", 20), (99, G["true"]): ("SHIFT", 35), - (99, G["string"]): ("SHIFT", 17), + (99, G["new"]): ("SHIFT", 31), + (99, G["isvoid"]): ("SHIFT", 33), (99, G["id"]): ("SHIFT", 15), - (99, G["integer"]): ("SHIFT", 18), - (99, G["{"]): ("SHIFT", 19), - (99, G["not"]): ("SHIFT", 44), (99, G["false"]): ("SHIFT", 36), - (99, G["isvoid"]): ("SHIFT", 33), + (99, G["not"]): ("SHIFT", 44), + (99, G["("]): ("SHIFT", 20), (99, G["if"]): ("SHIFT", 21), + (99, G["string"]): ("SHIFT", 17), + (99, G["while"]): ("SHIFT", 22), + (99, G["integer"]): ("SHIFT", 18), + (99, G["~"]): ("SHIFT", 37), (99, G["let"]): ("SHIFT", 23), + (99, G["{"]): ("SHIFT", 19), (100, G["else"]): ("SHIFT", 101), - (101, G["true"]): ("SHIFT", 35), - (101, G["not"]): ("SHIFT", 44), - (101, G["isvoid"]): ("SHIFT", 33), - (101, G["case"]): ("SHIFT", 30), (101, G["new"]): ("SHIFT", 31), + (101, G["case"]): ("SHIFT", 30), + (101, G["isvoid"]): ("SHIFT", 33), (101, G["false"]): ("SHIFT", 36), (101, G["id"]): ("SHIFT", 15), - (101, G["integer"]): ("SHIFT", 18), - (101, G["if"]): ("SHIFT", 21), - (101, G["{"]): ("SHIFT", 19), (101, G["while"]): ("SHIFT", 22), + (101, G["not"]): ("SHIFT", 44), + (101, G["true"]): ("SHIFT", 35), + (101, G["if"]): ("SHIFT", 21), + (101, G["integer"]): ("SHIFT", 18), (101, G["let"]): ("SHIFT", 23), - (101, G["string"]): ("SHIFT", 17), (101, G["~"]): ("SHIFT", 37), + (101, G["{"]): ("SHIFT", 19), (101, G["("]): ("SHIFT", 20), + (101, G["string"]): ("SHIFT", 17), (102, G["fi"]): ("SHIFT", 103), - (103, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), - (103, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), - (103, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), - (103, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), - (103, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), - (103, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), - (103, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), - (103, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), - (103, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), - (103, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), - (103, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["if"], G["expr"], G["then"], G["expr"], G["else"], G["expr"], G["fi"]), [lambda s: ConditionalNode(s[2], s[4], s[6])])), + (103, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G[")"]): ("SHIFT", 105), - (105, G["then"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), - (105, G["else"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), - (105, G["fi"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), - (105, G["loop"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), - (105, G["pool"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), - (105, G["in"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), - (105, G["of"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), - (105, G["+"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), - (105, G["-"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), - (105, G["*"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), - (105, G["/"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), - (105, G["<"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), - (105, G["<="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), - (105, G["="]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), - (105, G["}"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), - (105, G[")"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), - (105, G[","]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), - (105, G["."]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), - (105, G["@"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), - (105, G[";"]): ("REDUCE", AttributeProduction(G["atom"], Sentence(G["("], G["expr"], G[")"]), [lambda s: s[2]])), + (105, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["in"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["of"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["+"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["-"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["*"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["/"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["<"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["<="]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["="]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["}"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G[")"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G[","]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["."]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["@"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G[";"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["then"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["else"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["}"]): ("SHIFT", 107), - (107, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), - (107, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), - (107, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), - (107, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), - (107, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), - (107, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), - (107, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), - (107, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), - (107, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), - (107, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), - (107, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["{"], G["block"], G["}"]), [lambda s: BlockNode(s[2])])), + (107, G["loop"]): ("REDUCE", G["expr -> { block }"]), + (107, G["}"]): ("REDUCE", G["expr -> { block }"]), + (107, G["fi"]): ("REDUCE", G["expr -> { block }"]), + (107, G["pool"]): ("REDUCE", G["expr -> { block }"]), + (107, G[")"]): ("REDUCE", G["expr -> { block }"]), + (107, G[","]): ("REDUCE", G["expr -> { block }"]), + (107, G["in"]): ("REDUCE", G["expr -> { block }"]), + (107, G["then"]): ("REDUCE", G["expr -> { block }"]), + (107, G["else"]): ("REDUCE", G["expr -> { block }"]), + (107, G["of"]): ("REDUCE", G["expr -> { block }"]), + (107, G[";"]): ("REDUCE", G["expr -> { block }"]), (108, G[";"]): ("SHIFT", 109), - (109, G["let"]): ("SHIFT", 23), - (109, G["id"]): ("SHIFT", 15), - (109, G["if"]): ("SHIFT", 21), - (109, G["{"]): ("SHIFT", 19), - (109, G["}"]): ("REDUCE", AttributeProduction(G["block"], Sentence(G["expr"], G[";"]), [lambda s: [s[1]]])), - (109, G["not"]): ("SHIFT", 44), - (109, G["("]): ("SHIFT", 20), (109, G["string"]): ("SHIFT", 17), - (109, G["true"]): ("SHIFT", 35), - (109, G["isvoid"]): ("SHIFT", 33), - (109, G["false"]): ("SHIFT", 36), - (109, G["~"]): ("SHIFT", 37), (109, G["integer"]): ("SHIFT", 18), + (109, G["{"]): ("SHIFT", 19), (109, G["new"]): ("SHIFT", 31), + (109, G["~"]): ("SHIFT", 37), + (109, G["isvoid"]): ("SHIFT", 33), + (109, G["if"]): ("SHIFT", 21), + (109, G["}"]): ("REDUCE", G["block -> expr ;"]), + (109, G["false"]): ("SHIFT", 36), + (109, G["id"]): ("SHIFT", 15), (109, G["while"]): ("SHIFT", 22), + (109, G["not"]): ("SHIFT", 44), + (109, G["("]): ("SHIFT", 20), + (109, G["true"]): ("SHIFT", 35), + (109, G["let"]): ("SHIFT", 23), (109, G["case"]): ("SHIFT", 30), - (110, G["}"]): ("REDUCE", AttributeProduction(G["block"], Sentence(G["expr"], G[";"], G["block"]), [lambda s: [s[1]] + s[3]])), + (110, G["}"]): ("REDUCE", G["block -> expr ; block"]), (111, G[")"]): ("SHIFT", 112), - (112, G["then"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), - (112, G["else"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), - (112, G["fi"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), - (112, G["loop"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), - (112, G["pool"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), - (112, G["in"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), - (112, G["of"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), - (112, G["+"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), - (112, G["-"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), - (112, G["*"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), - (112, G["/"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), - (112, G["<"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), - (112, G["<="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), - (112, G["="]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), - (112, G["}"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), - (112, G[")"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), - (112, G[","]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), - (112, G["."]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), - (112, G["@"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), - (112, G[";"]): ("REDUCE", AttributeProduction(G["function-call"], Sentence(G["id"], G["("], G["expr-list"], G[")"]), [lambda s: MethodCallNode(s[1], s[3])])), - (113, G["string"]): ("SHIFT", 17), - (113, G["true"]): ("SHIFT", 35), - (113, G["("]): ("SHIFT", 20), - (113, G["not"]): ("SHIFT", 44), + (112, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (113, G["false"]): ("SHIFT", 36), - (113, G["if"]): ("SHIFT", 21), - (113, G["{"]): ("SHIFT", 19), (113, G["isvoid"]): ("SHIFT", 33), - (113, G["id"]): ("SHIFT", 15), + (113, G["not"]): ("SHIFT", 44), + (113, G["while"]): ("SHIFT", 22), + (113, G["new"]): ("SHIFT", 31), + (113, G["true"]): ("SHIFT", 35), + (113, G["("]): ("SHIFT", 20), (113, G["let"]): ("SHIFT", 23), (113, G["case"]): ("SHIFT", 30), - (113, G["~"]): ("SHIFT", 37), - (113, G["new"]): ("SHIFT", 31), - (113, G["while"]): ("SHIFT", 22), + (113, G["id"]): ("SHIFT", 15), + (113, G["{"]): ("SHIFT", 19), (113, G["integer"]): ("SHIFT", 18), - (114, G[","]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), - (114, G["then"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), - (114, G["else"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), - (114, G["of"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), - (114, G["fi"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), - (114, G[";"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), - (114, G["loop"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), - (114, G["pool"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), - (114, G["}"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), - (114, G["in"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), - (114, G[")"]): ("REDUCE", AttributeProduction(G["expr"], Sentence(G["id"], G["<-"], G["expr"]), [lambda s: AssignNode(s[1], s[3])])), + (113, G["if"]): ("SHIFT", 21), + (113, G["string"]): ("SHIFT", 17), + (113, G["~"]): ("SHIFT", 37), + (114, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["}"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G[")"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G[","]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["in"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["then"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["else"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["of"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G[";"]): ("REDUCE", G["expr -> id <- expr"]), (115, G["}"]): ("SHIFT", 116), - (116, G[";"]): ("REDUCE", AttributeProduction(G["method"], Sentence(G["id"], G["("], G[")"], G[":"], G["type"], G["{"], G["expr"], G["}"]), [lambda s: MethodDeclarationNode(s[1], [], s[5], s[7])])), + (116, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), (117, G[")"]): ("SHIFT", 118), (118, G[":"]): ("SHIFT", 119), (119, G["type"]): ("SHIFT", 120), (120, G["{"]): ("SHIFT", 121), - (121, G["true"]): ("SHIFT", 35), - (121, G["not"]): ("SHIFT", 44), - (121, G["("]): ("SHIFT", 20), - (121, G["{"]): ("SHIFT", 19), - (121, G["if"]): ("SHIFT", 21), (121, G["id"]): ("SHIFT", 15), - (121, G["~"]): ("SHIFT", 37), - (121, G["isvoid"]): ("SHIFT", 33), + (121, G["let"]): ("SHIFT", 23), (121, G["integer"]): ("SHIFT", 18), - (121, G["new"]): ("SHIFT", 31), - (121, G["false"]): ("SHIFT", 36), + (121, G["not"]): ("SHIFT", 44), + (121, G["string"]): ("SHIFT", 17), + (121, G["isvoid"]): ("SHIFT", 33), + (121, G["~"]): ("SHIFT", 37), (121, G["while"]): ("SHIFT", 22), + (121, G["false"]): ("SHIFT", 36), + (121, G["if"]): ("SHIFT", 21), + (121, G["new"]): ("SHIFT", 31), + (121, G["true"]): ("SHIFT", 35), + (121, G["("]): ("SHIFT", 20), + (121, G["{"]): ("SHIFT", 19), (121, G["case"]): ("SHIFT", 30), - (121, G["let"]): ("SHIFT", 23), - (121, G["string"]): ("SHIFT", 17), (122, G["}"]): ("SHIFT", 123), - (123, G[";"]): ("REDUCE", AttributeProduction(G["method"], Sentence(G["id"], G["("], G["param-list"], G[")"], G[":"], G["type"], G["{"], G["expr"], G["}"]), [lambda s: MethodDeclarationNode(s[1], s[3], s[6], s[8])])), + (123, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (124, G["type"]): ("SHIFT", 125), (125, G["<-"]): ("SHIFT", 126), - (125, G[";"]): ("REDUCE", AttributeProduction(G["attribute"], Sentence(G["id"], G[":"], G["type"]), [lambda s: AttrDeclarationNode(s[1], s[3])])), - (126, G["id"]): ("SHIFT", 15), - (126, G["let"]): ("SHIFT", 23), - (126, G["if"]): ("SHIFT", 21), - (126, G["{"]): ("SHIFT", 19), - (126, G["not"]): ("SHIFT", 44), - (126, G["("]): ("SHIFT", 20), + (125, G[";"]): ("REDUCE", G["attribute -> id : type"]), (126, G["string"]): ("SHIFT", 17), - (126, G["true"]): ("SHIFT", 35), - (126, G["isvoid"]): ("SHIFT", 33), - (126, G["false"]): ("SHIFT", 36), - (126, G["~"]): ("SHIFT", 37), (126, G["integer"]): ("SHIFT", 18), + (126, G["{"]): ("SHIFT", 19), (126, G["new"]): ("SHIFT", 31), + (126, G["~"]): ("SHIFT", 37), + (126, G["isvoid"]): ("SHIFT", 33), + (126, G["if"]): ("SHIFT", 21), + (126, G["false"]): ("SHIFT", 36), + (126, G["id"]): ("SHIFT", 15), (126, G["while"]): ("SHIFT", 22), + (126, G["not"]): ("SHIFT", 44), + (126, G["("]): ("SHIFT", 20), + (126, G["true"]): ("SHIFT", 35), + (126, G["let"]): ("SHIFT", 23), (126, G["case"]): ("SHIFT", 30), - (127, G[";"]): ("REDUCE", AttributeProduction(G["attribute"], Sentence(G["id"], G[":"], G["type"], G["<-"], G["expr"]), [lambda s: AttrDeclarationNode(s[1], s[3], s[5])])), + (127, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), (128, G["}"]): ("SHIFT", 129), - (129, G["class"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["{"], G["feature-list"], G["}"]), [lambda s: ClassDeclarationNode(s[2], s[4])])), - (129, G["$"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["{"], G["feature-list"], G["}"]), [lambda s: ClassDeclarationNode(s[2], s[4])])), + (129, G["class"]): ("REDUCE", G["class-def -> class type { feature-list }"]), + (129, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), (130, G[";"]): ("SHIFT", 131), (131, G["id"]): ("SHIFT", 4), - (131, G["}"]): ("REDUCE", AttributeProduction(G["feature-list"], G.Epsilon, [lambda s: []])), - (132, G["}"]): ("REDUCE", AttributeProduction(G["feature-list"], Sentence(G["attribute"], G[";"], G["feature-list"]), [lambda s: [s[1]] + s[3]])), + (131, G["}"]): ("REDUCE", G["feature-list -> e"]), + (132, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), (133, G[";"]): ("SHIFT", 134), (134, G["id"]): ("SHIFT", 4), - (134, G["}"]): ("REDUCE", AttributeProduction(G["feature-list"], G.Epsilon, [lambda s: []])), - (135, G["}"]): ("REDUCE", AttributeProduction(G["feature-list"], Sentence(G["method"], G[";"], G["feature-list"]), [lambda s: [s[1]] + s[3]])), + (134, G["}"]): ("REDUCE", G["feature-list -> e"]), + (135, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), (136, G["type"]): ("SHIFT", 137), (137, G["{"]): ("SHIFT", 138), (138, G["id"]): ("SHIFT", 4), - (138, G["}"]): ("REDUCE", AttributeProduction(G["feature-list"], G.Epsilon, [lambda s: []])), + (138, G["}"]): ("REDUCE", G["feature-list -> e"]), (139, G["}"]): ("SHIFT", 140), - (140, G["class"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["inherits"], G["type"], G["{"], G["feature-list"], G["}"]), [lambda s: ClassDeclarationNode(s[2], s[6], s[4])])), - (140, G["$"]): ("REDUCE", AttributeProduction(G["class-def"], Sentence(G["class"], G["type"], G["inherits"], G["type"], G["{"], G["feature-list"], G["}"]), [lambda s: ClassDeclarationNode(s[2], s[6], s[4])])), + (140, G["class"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), + (140, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), (141, G["$"]): ("OK", None), - (142, G["$"]): ("REDUCE", AttributeProduction(G["program"], Sentence(G["class-set"]), [lambda s: ProgramNode(s[1])])), + (142, G["$"]): ("REDUCE", G["program -> class-list"]), (143, G["class"]): ("SHIFT", 1), - (143, G["$"]): ("REDUCE", AttributeProduction(G["class-set"], Sentence(G["class-def"]), [lambda s: [s[1]]])), - (144, G["$"]): ("REDUCE", AttributeProduction(G["class-set"], Sentence(G["class-def"], G["class-set"]), [lambda s: [s[1]] + s[2]])), + (143, G["$"]): ("REDUCE", G["class-list -> class-def"]), + (144, G["$"]): ("REDUCE", G["class-list -> class-def class-list"]), } - def __goto_table(self): - G = self.G + @staticmethod + def __goto_table(): return { - (0, G["class-def"]): 143, - (0, G["class-set"]): 142, (0, G["program"]): 141, + (0, G["class-def"]): 143, + (0, G["class-list"]): 142, + (3, G["feature-list"]): 128, (3, G["attribute"]): 130, (3, G["method"]): 133, - (3, G["feature-list"]): 128, (5, G["param-list"]): 117, (9, G["param-list"]): 10, (14, G["arith"]): 63, (14, G["atom"]): 40, (14, G["term"]): 58, + (14, G["function-call"]): 38, (14, G["comp"]): 46, (14, G["expr"]): 115, - (14, G["function-call"]): 38, (14, G["factor"]): 55, - (16, G["expr"]): 66, - (16, G["comp"]): 46, - (16, G["function-call"]): 38, (16, G["atom"]): 40, - (16, G["arith"]): 63, + (16, G["comp"]): 46, (16, G["factor"]): 55, + (16, G["expr"]): 66, + (16, G["arith"]): 63, (16, G["term"]): 58, + (16, G["function-call"]): 38, (16, G["expr-list"]): 111, - (19, G["atom"]): 40, - (19, G["expr"]): 108, - (19, G["term"]): 58, + (19, G["comp"]): 46, + (19, G["factor"]): 55, (19, G["function-call"]): 38, + (19, G["atom"]): 40, (19, G["arith"]): 63, - (19, G["comp"]): 46, + (19, G["term"]): 58, + (19, G["expr"]): 108, (19, G["block"]): 106, - (19, G["factor"]): 55, - (20, G["atom"]): 40, - (20, G["function-call"]): 38, - (20, G["comp"]): 46, - (20, G["arith"]): 63, (20, G["factor"]): 55, (20, G["term"]): 58, + (20, G["comp"]): 46, + (20, G["atom"]): 40, + (20, G["function-call"]): 38, (20, G["expr"]): 104, + (20, G["arith"]): 63, + (21, G["atom"]): 40, (21, G["function-call"]): 38, - (21, G["factor"]): 55, - (21, G["arith"]): 63, (21, G["comp"]): 46, - (21, G["term"]): 58, - (21, G["atom"]): 40, + (21, G["factor"]): 55, (21, G["expr"]): 98, - (22, G["comp"]): 46, + (21, G["term"]): 58, + (21, G["arith"]): 63, + (22, G["atom"]): 40, (22, G["arith"]): 63, - (22, G["factor"]): 55, + (22, G["comp"]): 46, (22, G["term"]): 58, - (22, G["atom"]): 40, - (22, G["expr"]): 94, (22, G["function-call"]): 38, + (22, G["expr"]): 94, + (22, G["factor"]): 55, (23, G["declaration-list"]): 91, (27, G["declaration-list"]): 28, + (29, G["comp"]): 46, (29, G["term"]): 58, - (29, G["expr"]): 88, (29, G["atom"]): 40, + (29, G["factor"]): 55, (29, G["arith"]): 63, (29, G["function-call"]): 38, - (29, G["factor"]): 55, - (29, G["comp"]): 46, + (29, G["expr"]): 88, (30, G["term"]): 58, (30, G["atom"]): 40, - (30, G["comp"]): 46, (30, G["function-call"]): 38, + (30, G["comp"]): 46, (30, G["arith"]): 63, (30, G["expr"]): 77, (30, G["factor"]): 55, - (33, G["function-call"]): 38, (33, G["atom"]): 40, (33, G["factor"]): 76, - (37, G["function-call"]): 38, + (33, G["function-call"]): 38, (37, G["atom"]): 40, + (37, G["function-call"]): 38, (37, G["factor"]): 39, - (43, G["expr"]): 66, - (43, G["comp"]): 46, - (43, G["function-call"]): 38, (43, G["atom"]): 40, - (43, G["arith"]): 63, + (43, G["comp"]): 46, (43, G["factor"]): 55, + (43, G["expr"]): 66, + (43, G["arith"]): 63, (43, G["term"]): 58, + (43, G["function-call"]): 38, (43, G["expr-list"]): 64, - (44, G["function-call"]): 38, - (44, G["factor"]): 55, - (44, G["term"]): 58, - (44, G["arith"]): 63, (44, G["atom"]): 40, + (44, G["arith"]): 63, (44, G["comp"]): 46, (44, G["expr"]): 45, - (47, G["function-call"]): 38, + (44, G["term"]): 58, + (44, G["factor"]): 55, + (44, G["function-call"]): 38, + (47, G["atom"]): 40, (47, G["arith"]): 48, (47, G["factor"]): 55, (47, G["term"]): 58, - (47, G["atom"]): 40, - (49, G["function-call"]): 38, - (49, G["factor"]): 55, + (47, G["function-call"]): 38, (49, G["atom"]): 40, + (49, G["factor"]): 55, (49, G["term"]): 50, + (49, G["function-call"]): 38, + (51, G["atom"]): 40, (51, G["function-call"]): 38, (51, G["factor"]): 52, - (51, G["atom"]): 40, - (53, G["function-call"]): 38, (53, G["atom"]): 40, (53, G["factor"]): 54, - (56, G["function-call"]): 38, - (56, G["term"]): 57, - (56, G["factor"]): 55, + (53, G["function-call"]): 38, (56, G["atom"]): 40, - (59, G["function-call"]): 38, + (56, G["factor"]): 55, + (56, G["term"]): 57, + (56, G["function-call"]): 38, + (59, G["atom"]): 40, (59, G["arith"]): 60, (59, G["factor"]): 55, (59, G["term"]): 58, - (59, G["atom"]): 40, - (61, G["function-call"]): 38, + (59, G["function-call"]): 38, (61, G["arith"]): 62, - (61, G["factor"]): 55, (61, G["atom"]): 40, + (61, G["factor"]): 55, (61, G["term"]): 58, - (67, G["expr"]): 66, - (67, G["comp"]): 46, - (67, G["function-call"]): 38, + (61, G["function-call"]): 38, (67, G["atom"]): 40, - (67, G["arith"]): 63, + (67, G["comp"]): 46, (67, G["factor"]): 55, + (67, G["expr"]): 66, + (67, G["arith"]): 63, (67, G["term"]): 58, + (67, G["function-call"]): 38, (67, G["expr-list"]): 68, - (73, G["expr"]): 66, - (73, G["comp"]): 46, - (73, G["function-call"]): 38, + (73, G["expr-list"]): 74, (73, G["atom"]): 40, - (73, G["arith"]): 63, + (73, G["comp"]): 46, (73, G["factor"]): 55, + (73, G["expr"]): 66, + (73, G["arith"]): 63, (73, G["term"]): 58, - (73, G["expr-list"]): 74, + (73, G["function-call"]): 38, (78, G["case-list"]): 86, + (82, G["comp"]): 46, + (82, G["factor"]): 55, + (82, G["function-call"]): 38, (82, G["atom"]): 40, - (82, G["term"]): 58, (82, G["expr"]): 83, - (82, G["function-call"]): 38, (82, G["arith"]): 63, - (82, G["comp"]): 46, - (82, G["factor"]): 55, + (82, G["term"]): 58, (84, G["case-list"]): 85, (89, G["declaration-list"]): 90, - (92, G["function-call"]): 38, - (92, G["factor"]): 55, - (92, G["term"]): 58, - (92, G["arith"]): 63, (92, G["atom"]): 40, + (92, G["arith"]): 63, (92, G["comp"]): 46, (92, G["expr"]): 93, - (95, G["comp"]): 46, - (95, G["arith"]): 63, + (92, G["factor"]): 55, + (92, G["term"]): 58, + (92, G["function-call"]): 38, (95, G["term"]): 58, - (95, G["factor"]): 55, (95, G["atom"]): 40, - (95, G["expr"]): 96, + (95, G["arith"]): 63, (95, G["function-call"]): 38, + (95, G["comp"]): 46, + (95, G["factor"]): 55, + (95, G["expr"]): 96, (99, G["comp"]): 46, - (99, G["expr"]): 100, (99, G["term"]): 58, - (99, G["factor"]): 55, (99, G["atom"]): 40, (99, G["arith"]): 63, (99, G["function-call"]): 38, - (101, G["expr"]): 102, - (101, G["atom"]): 40, - (101, G["comp"]): 46, + (99, G["factor"]): 55, + (99, G["expr"]): 100, (101, G["term"]): 58, - (101, G["function-call"]): 38, (101, G["arith"]): 63, + (101, G["comp"]): 46, + (101, G["atom"]): 40, + (101, G["expr"]): 102, (101, G["factor"]): 55, - (109, G["atom"]): 40, - (109, G["expr"]): 108, - (109, G["term"]): 58, + (101, G["function-call"]): 38, + (109, G["comp"]): 46, + (109, G["factor"]): 55, (109, G["function-call"]): 38, + (109, G["atom"]): 40, (109, G["arith"]): 63, - (109, G["comp"]): 46, + (109, G["term"]): 58, (109, G["block"]): 110, - (109, G["factor"]): 55, - (113, G["function-call"]): 38, - (113, G["factor"]): 55, - (113, G["term"]): 58, - (113, G["arith"]): 63, + (109, G["expr"]): 108, (113, G["atom"]): 40, + (113, G["arith"]): 63, (113, G["comp"]): 46, + (113, G["factor"]): 55, + (113, G["term"]): 58, (113, G["expr"]): 114, + (113, G["function-call"]): 38, (121, G["arith"]): 63, (121, G["atom"]): 40, (121, G["term"]): 58, - (121, G["comp"]): 46, (121, G["function-call"]): 38, - (121, G["factor"]): 55, + (121, G["comp"]): 46, (121, G["expr"]): 122, + (121, G["factor"]): 55, + (126, G["comp"]): 46, + (126, G["factor"]): 55, + (126, G["function-call"]): 38, (126, G["atom"]): 40, (126, G["expr"]): 127, - (126, G["term"]): 58, - (126, G["function-call"]): 38, (126, G["arith"]): 63, - (126, G["comp"]): 46, - (126, G["factor"]): 55, + (126, G["term"]): 58, + (131, G["feature-list"]): 132, (131, G["attribute"]): 130, (131, G["method"]): 133, - (131, G["feature-list"]): 132, + (134, G["feature-list"]): 135, (134, G["attribute"]): 130, (134, G["method"]): 133, - (134, G["feature-list"]): 135, (138, G["feature-list"]): 139, (138, G["attribute"]): 130, (138, G["method"]): 133, (143, G["class-def"]): 143, - (143, G["class-set"]): 144, + (143, G["class-list"]): 144, } diff --git a/scripts/main.cool b/scripts/main.cool new file mode 100644 index 000000000..f1c14d05a --- /dev/null +++ b/scripts/main.cool @@ -0,0 +1,7 @@ +class Main { + main ( msg : String ) : Void { + let a: Int <- 25, b: Int <- 15 in { + a + b; + } + }; +} diff --git a/scripts/program.cool b/scripts/program.cool deleted file mode 100644 index e255c7571..000000000 --- a/scripts/program.cool +++ /dev/null @@ -1,16 +0,0 @@ -class A { - a : Int; - suma (a : Int, b : Int) : Int { - a + b - }; - b : Int <- 8; -} - -class B inherits A { - a : A; - f (d : Int, a : A) : Void {{ - let f : Int <- 8, c : A <- new A in - c.suma(5 ,f); - c; - }}; -} diff --git a/semantic.py b/semantic.py index 3fe2cf54a..db53d1108 100644 --- a/semantic.py +++ b/semantic.py @@ -1,16 +1,715 @@ +""" +This module contains definitions of classes for make different travels through the AST of a cool program. +All classes defined here follows the visitor pattern using the module cmp.visitor, with this we can get a +more decoupled inspection. +""" +import astnodes as ast import cmp.visitor as visitor -from astnodes import ProgramNode -from cmp.semantic import Scope -class SemanticChecker: - def __init__(self): +class Formatter: + @visitor.on('node') + def visit(self, node, tabs): pass + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode, tabs: int = 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(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode, tabs: int = 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(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode, tabs: int = 0): + ans = '\t' * tabs + f'\\__AttrDeclarationNode: {node.id} : {node.type}' + return f'{ans}' + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode, tabs: int = 0): + params = ', '.join(':'.join(param) for param in node.params) + ans = '\t' * tabs + f'\\__FuncDeclarationNode: {node.id}({params}) : {node.type} -> ' + body = self.visit(node.body, tabs + 1) + return f'{ans}\n{body}' + + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode, tabs: int = 0): + declarations = '\n'.join(self.visit(declaration, tabs + 1) for declaration in node.declarations) + ans = '\t' * tabs + f'\\__LetNode: let' + expr = self.visit(node.expr, tabs + 2) + return f'{ans}\n {declarations}\n' + '\t' * (tabs + 1) + 'in\n' + f'{expr}' + + @visitor.when(ast.VarDeclarationNode) + def visit(self, node: ast.VarDeclarationNode, tabs: int = 0): + if node.expr is not None: + return '\t' * tabs + f'\\__VarDeclarationNode: {node.id}: {node.type} <-\n{self.visit(node.expr, tabs + 1)}' + else: + return '\t' * tabs + f'\\__VarDeclarationNode: {node.id} : {node.type}' + + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode, tabs: int = 0): + ans = '\t' * tabs + f'\\__AssignNode: {node.id} <- ' + expr = self.visit(node.expr, tabs + 1) + return f'{ans}\n{expr}' + + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode, tabs: int = 0): + ans = '\t' * tabs + f'\\__BlockNode:' + body = '\n'.join(self.visit(child, tabs + 1) for child in node.expressions) + return f'{ans}\n{body}' + + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode, tabs: int = 0): + ifx = self.visit(node.if_expr, tabs + 2) + then = self.visit(node.then_expr, tabs + 2) + elsex = self.visit(node.else_expr, tabs + 2) + + return '\n'.join([ + '\t' * tabs + f'\\__IfThenElseNode: if then else fi', + '\t' * (tabs + 1) + f'\\__if \n{ifx}', + '\t' * (tabs + 1) + f'\\__then \n{then}', + '\t' * (tabs + 1) + f'\\__else \n{elsex}', + ]) + + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode, tabs: int = 0): + condition = self.visit(node.condition, tabs + 2) + body = self.visit(node.body, tabs + 2) + + return '\n'.join([ + '\t' * tabs + f'\\__WhileNode: while loop pool', + '\t' * (tabs + 1) + f'\\__while \n{condition}', + '\t' * (tabs + 1) + f'\\__loop \n{body}', + ]) + + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode, tabs: int = 0): + expr = self.visit(node.expr, tabs + 2) + cases = '\n'.join(self.visit(case, tabs + 3) for case in node.cases) + + return '\n'.join([ + '\t' * tabs + f'\\__SwitchCaseNode: case of [ ... ] esac', + '\t' * (tabs + 1) + f'\\__case \n{expr} of', + ]) + '\n' + cases + + @visitor.when(ast.CaseNode) + def visit(self, node: ast.CaseNode, tabs: int = 0): + expr = self.visit(node.expr, tabs + 1) + return '\t' * tabs + f'\\__CaseNode: {node.id} : {node.type} =>\n{expr}' + + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode, tabs: int = 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(ast.BinaryNode) + def visit(self, node: ast.BinaryNode, tabs: int = 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(ast.AtomicNode) + def visit(self, node: ast.AtomicNode, tabs: int = 0): + return '\t' * tabs + f'\\__ {node.__class__.__name__}: {node.lex}' + + @visitor.when(ast.InstantiateNode) + def visit(self, node: ast.InstantiateNode, tabs: int = 0): + return '\t' * tabs + f'\\__ InstantiateNode: new {node.lex}()' + + +class ClassCollector: @visitor.on('node') - def visit(self, node, scope): + def visit(self, node, tabs): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode): + pass + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode): + pass + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode): + pass + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode): + pass + + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode): + pass + + @visitor.when(ast.VarDeclarationNode) + def visit(self, node: ast.VarDeclarationNode): + pass + + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode): + pass + + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode): + pass + + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode): + pass + + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode): + pass + + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode): + pass + + @visitor.when(ast.CaseNode) + def visit(self, node: ast.CaseNode): + pass + + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode): + pass + + @visitor.when(ast.IntegerNode) + def visit(self, node: ast.IntegerNode): + pass + + @visitor.when(ast.StringNode) + def visit(self, node: ast.StringNode): + pass + + @visitor.when(ast.BooleanNode) + def visit(self, node: ast.BooleanNode): + pass + + @visitor.when(ast.VariableNode) + def visit(self, node: ast.VariableNode): + pass + + @visitor.when(ast.InstantiateNode) + def visit(self, node: ast.InstantiateNode): + pass + + @visitor.when(ast.NegationNode) + def visit(self, node: ast.NegationNode): + pass + + @visitor.when(ast.ComplementNode) + def visit(self, node: ast.ComplementNode): + pass + + @visitor.when(ast.IsVoidNode) + def visit(self, node: ast.IsVoidNode): + pass + + @visitor.when(ast.PlusNode) + def visit(self, node: ast.PlusNode): + pass + + @visitor.when(ast.MinusNode) + def visit(self, node: ast.MinusNode): + pass + + @visitor.when(ast.StarNode) + def visit(self, node: ast.StarNode): + pass + + @visitor.when(ast.DivNode) + def visit(self, node: ast.DivNode): + pass + + @visitor.when(ast.LessEqualNode) + def visit(self, node: ast.LessEqualNode): + pass + + @visitor.when(ast.LessNode) + def visit(self, node: ast.LessNode): + pass + + @visitor.when(ast.EqualNode) + def visit(self, node: ast.EqualNode): + pass + + +class TypeBuilder: + @visitor.on('node') + def visit(self, node, tabs): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode): + pass + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode): + pass + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode): + pass + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode): + pass + + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode): + pass + + @visitor.when(ast.VarDeclarationNode) + def visit(self, node: ast.VarDeclarationNode): + pass + + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode): + pass + + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode): + pass + + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode): + pass + + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode): + pass + + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode): + pass + + @visitor.when(ast.CaseNode) + def visit(self, node: ast.CaseNode): + pass + + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode): + pass + + @visitor.when(ast.IntegerNode) + def visit(self, node: ast.IntegerNode): + pass + + @visitor.when(ast.StringNode) + def visit(self, node: ast.StringNode): + pass + + @visitor.when(ast.BooleanNode) + def visit(self, node: ast.BooleanNode): + pass + + @visitor.when(ast.VariableNode) + def visit(self, node: ast.VariableNode): + pass + + @visitor.when(ast.InstantiateNode) + def visit(self, node: ast.InstantiateNode): + pass + + @visitor.when(ast.NegationNode) + def visit(self, node: ast.NegationNode): + pass + + @visitor.when(ast.ComplementNode) + def visit(self, node: ast.ComplementNode): + pass + + @visitor.when(ast.IsVoidNode) + def visit(self, node: ast.IsVoidNode): + pass + + @visitor.when(ast.PlusNode) + def visit(self, node: ast.PlusNode): + pass + + @visitor.when(ast.MinusNode) + def visit(self, node: ast.MinusNode): + pass + + @visitor.when(ast.StarNode) + def visit(self, node: ast.StarNode): + pass + + @visitor.when(ast.DivNode) + def visit(self, node: ast.DivNode): + pass + + @visitor.when(ast.LessEqualNode) + def visit(self, node: ast.LessEqualNode): + pass + + @visitor.when(ast.LessNode) + def visit(self, node: ast.LessNode): + pass + + @visitor.when(ast.EqualNode) + def visit(self, node: ast.EqualNode): + pass + + +class TypeChecker: + @visitor.on('node') + def visit(self, node, tabs): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode): + pass + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode): + pass + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode): + pass + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode): + pass + + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode): + pass + + @visitor.when(ast.VarDeclarationNode) + def visit(self, node: ast.VarDeclarationNode): + pass + + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode): + pass + + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode): + pass + + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode): + pass + + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode): + pass + + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode): + pass + + @visitor.when(ast.CaseNode) + def visit(self, node: ast.CaseNode): + pass + + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode): + pass + + @visitor.when(ast.IntegerNode) + def visit(self, node: ast.IntegerNode): + pass + + @visitor.when(ast.StringNode) + def visit(self, node: ast.StringNode): + pass + + @visitor.when(ast.BooleanNode) + def visit(self, node: ast.BooleanNode): + pass + + @visitor.when(ast.VariableNode) + def visit(self, node: ast.VariableNode): + pass + + @visitor.when(ast.InstantiateNode) + def visit(self, node: ast.InstantiateNode): + pass + + @visitor.when(ast.NegationNode) + def visit(self, node: ast.NegationNode): + pass + + @visitor.when(ast.ComplementNode) + def visit(self, node: ast.ComplementNode): + pass + + @visitor.when(ast.IsVoidNode) + def visit(self, node: ast.IsVoidNode): + pass + + @visitor.when(ast.PlusNode) + def visit(self, node: ast.PlusNode): + pass + + @visitor.when(ast.MinusNode) + def visit(self, node: ast.MinusNode): + pass + + @visitor.when(ast.StarNode) + def visit(self, node: ast.StarNode): + pass + + @visitor.when(ast.DivNode) + def visit(self, node: ast.DivNode): + pass + + @visitor.when(ast.LessEqualNode) + def visit(self, node: ast.LessEqualNode): + pass + + @visitor.when(ast.LessNode) + def visit(self, node: ast.LessNode): + pass + + @visitor.when(ast.EqualNode) + def visit(self, node: ast.EqualNode): + pass + + +class InferenceTypeChecker: + @visitor.on('node') + def visit(self, node, tabs): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode): + pass + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode): + pass + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode): + pass + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode): + pass + + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode): + pass + + @visitor.when(ast.VarDeclarationNode) + def visit(self, node: ast.VarDeclarationNode): + pass + + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode): + pass + + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode): + pass + + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode): + pass + + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode): + pass + + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode): + pass + + @visitor.when(ast.CaseNode) + def visit(self, node: ast.CaseNode): + pass + + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode): + pass + + @visitor.when(ast.IntegerNode) + def visit(self, node: ast.IntegerNode): + pass + + @visitor.when(ast.StringNode) + def visit(self, node: ast.StringNode): + pass + + @visitor.when(ast.BooleanNode) + def visit(self, node: ast.BooleanNode): + pass + + @visitor.when(ast.VariableNode) + def visit(self, node: ast.VariableNode): + pass + + @visitor.when(ast.InstantiateNode) + def visit(self, node: ast.InstantiateNode): + pass + + @visitor.when(ast.NegationNode) + def visit(self, node: ast.NegationNode): + pass + + @visitor.when(ast.ComplementNode) + def visit(self, node: ast.ComplementNode): + pass + + @visitor.when(ast.IsVoidNode) + def visit(self, node: ast.IsVoidNode): + pass + + @visitor.when(ast.PlusNode) + def visit(self, node: ast.PlusNode): + pass + + @visitor.when(ast.MinusNode) + def visit(self, node: ast.MinusNode): + pass + + @visitor.when(ast.StarNode) + def visit(self, node: ast.StarNode): + pass + + @visitor.when(ast.DivNode) + def visit(self, node: ast.DivNode): + pass + + @visitor.when(ast.LessEqualNode) + def visit(self, node: ast.LessEqualNode): + pass + + @visitor.when(ast.LessNode) + def visit(self, node: ast.LessNode): + pass + + @visitor.when(ast.EqualNode) + def visit(self, node: ast.EqualNode): + pass + + +class SemanticChecker: + @visitor.on('node') + def visit(self, node, tabs): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode): + pass + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode): + pass + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode): + pass + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode): + pass + + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode): + pass + + @visitor.when(ast.VarDeclarationNode) + def visit(self, node: ast.VarDeclarationNode): + pass + + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode): + pass + + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode): + pass + + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode): + pass + + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode): + pass + + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode): + pass + + @visitor.when(ast.CaseNode) + def visit(self, node: ast.CaseNode): + pass + + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode): + pass + + @visitor.when(ast.IntegerNode) + def visit(self, node: ast.IntegerNode): + pass + + @visitor.when(ast.StringNode) + def visit(self, node: ast.StringNode): + pass + + @visitor.when(ast.BooleanNode) + def visit(self, node: ast.BooleanNode): + pass + + @visitor.when(ast.VariableNode) + def visit(self, node: ast.VariableNode): + pass + + @visitor.when(ast.InstantiateNode) + def visit(self, node: ast.InstantiateNode): + pass + + @visitor.when(ast.NegationNode) + def visit(self, node: ast.NegationNode): + pass + + @visitor.when(ast.ComplementNode) + def visit(self, node: ast.ComplementNode): + pass + + @visitor.when(ast.IsVoidNode) + def visit(self, node: ast.IsVoidNode): + pass + + @visitor.when(ast.PlusNode) + def visit(self, node: ast.PlusNode): + pass + + @visitor.when(ast.MinusNode) + def visit(self, node: ast.MinusNode): + pass + + @visitor.when(ast.StarNode) + def visit(self, node: ast.StarNode): + pass + + @visitor.when(ast.DivNode) + def visit(self, node: ast.DivNode): + pass + + @visitor.when(ast.LessEqualNode) + def visit(self, node: ast.LessEqualNode): + pass + + @visitor.when(ast.LessNode) + def visit(self, node: ast.LessNode): pass - @visitor.when(ProgramNode) - def visit(self, node: ProgramNode, scope: Scope = None): + @visitor.when(ast.EqualNode) + def visit(self, node: ast.EqualNode): pass diff --git a/tester.py b/tester.py new file mode 100644 index 000000000..88edd433b --- /dev/null +++ b/tester.py @@ -0,0 +1,73 @@ +import time +from typing import List + +import fire + +from cmp.parsing import Token +from grammar import G +from lexer import CoolLexer +from parser import CoolParser +from semantic import Formatter + +lexer = CoolLexer(G) +parser = CoolParser() + +formatter = Formatter() + + +def pprint_tokens(text: str, tokens: List[Token]) -> str: + formatting = '' + + cursor = 0 + while cursor < len(tokens) - 1: + token = tokens[cursor] + + if text.startswith(token.lex): + formatting += token.token_type.name + text = text[len(token.lex):] + cursor += 1 + else: + formatting += text[0] + text = text[1:] + + return formatting + + +class Tester: + @staticmethod + def tokenize(script: str) -> str: + """ + Method for tokenize a cool program + :param script: string with the name of the program + """ + file = f'scripts/{script}' + program = open(file, 'r').read() + + return pprint_tokens(program, lexer(program)) + + @staticmethod + def parse(script: str) -> str: + """ + Method for parse a cool program and return an ast + :param script: string with the name of the program + """ + file = f'scripts/{script}' + program = open(file, 'r').read() + + tokens = [t for t in lexer(program)] + + ast = parser(tokens) + return str(ast) + + def timeit(self, command: str, *args): + if hasattr(self, command): + attr = getattr(self, command) + t = time.time() + out = attr(*args) + t = time.time() - t + print(out) + return f'Time : {t}' + + +if __name__ == '__main__': + fire.Fire(Tester()) diff --git a/tests.py b/tests.py deleted file mode 100644 index a2cc7960d..000000000 --- a/tests.py +++ /dev/null @@ -1,39 +0,0 @@ -from typing import List - -import fire - -from cmp.utils import Token -from definitions import cool_grammar -from lexer import CoolLexer -from parser import CoolParser - -G = cool_grammar() -lexer = CoolLexer(G) -parser = CoolParser(G) - - -class Tester: - @staticmethod - def tokenize(script: str) -> List[Token]: - """ - Method for tokenize a cool program - :param script: string with the name of the program - """ - file = f'scripts/{script}' - program = open(file, 'r').read() - - return [t for t in lexer(program)] - - @staticmethod - def parse(script: str): - """ - Method for parse a cool program and return an ast - :param script: string with the name of the program - """ - tokens = Tester.tokenize(script) - ast = parser(tokens) - print(ast) - - -if __name__ == '__main__': - fire.Fire(Tester()) diff --git a/tests/codegen/arith.cl b/tests/codegen/arith.cl new file mode 100755 index 000000000..af5951cf7 --- /dev/null +++ b/tests/codegen/arith.cl @@ -0,0 +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; + } + }; + +}; + diff --git a/tests/codegen/atoi.cl b/tests/codegen/atoi.cl new file mode 100644 index 000000000..fd8b2ea42 --- /dev/null +++ b/tests/codegen/atoi.cl @@ -0,0 +1,121 @@ +(* + 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 { + main () : Object { + let a : Int <- (new A2I).a2i("678987"), + b : String <- (new A2I).i2a(678987) in + { + out_int(a) ; + out_string(" == ") ; + out_string(b) ; + out_string("\n"); + } + } ; +} ; diff --git a/tests/codegen/atoi2.cl b/tests/codegen/atoi2.cl new file mode 100644 index 000000000..577aa29fd --- /dev/null +++ b/tests/codegen/atoi2.cl @@ -0,0 +1,92 @@ +class JustThere { -- class can have no features. +}; + +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; } -- Here the formal list is optional. + fi fi fi fi fi fi fi fi fi fi + }; + + + 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(); ""; } -- demonstrates an expression block + fi fi fi fi fi fi fi fi fi fi + }; + + 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(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)); -- demonstrates dispatch + i <- i + 1; + } + pool + ) + ); + int; + } + ) + }; + + 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(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 { + main () : Object { + let a : Int <- (new A2I).a2i("678987"), + b : String <- (new A2I).i2a(678987) in -- the let expression. Translated to let a: ... in let b: ... in expr. + { + out_int(a) ; + out_string(" == ") ; + out_string(b) ; + out_string("\n"); + } + } ; +} ; diff --git a/tests/codegen/book_list.cl b/tests/codegen/book_list.cl new file mode 100755 index 000000000..025ea1695 --- /dev/null +++ b/tests/codegen/book_list.cl @@ -0,0 +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 + }; +}; diff --git a/tests/codegen/cells.cl b/tests/codegen/cells.cl new file mode 100755 index 000000000..9fd6741bb --- /dev/null +++ b/tests/codegen/cells.cl @@ -0,0 +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; + } + }; +}; diff --git a/tests/codegen/complex.cl b/tests/codegen/complex.cl new file mode 100755 index 000000000..0b7aa44e9 --- /dev/null +++ b/tests/codegen/complex.cl @@ -0,0 +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; + } + }; +}; diff --git a/tests/codegen/fib.cl b/tests/codegen/fib.cl new file mode 100644 index 000000000..08ceaede8 --- /dev/null +++ b/tests/codegen/fib.cl @@ -0,0 +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; + } + }; + +}; diff --git a/tests/codegen/graph.cl b/tests/codegen/graph.cl new file mode 100755 index 000000000..8e511358c --- /dev/null +++ b/tests/codegen/graph.cl @@ -0,0 +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" }; + +}; + + + + + diff --git a/tests/codegen/hello_world.cl b/tests/codegen/hello_world.cl new file mode 100755 index 000000000..0c818f908 --- /dev/null +++ b/tests/codegen/hello_world.cl @@ -0,0 +1,5 @@ +class Main inherits IO { + main(): IO { + out_string("Hello, World.\n") + }; +}; diff --git a/tests/codegen/helloworld.cl b/tests/codegen/helloworld.cl new file mode 100644 index 000000000..61d421080 --- /dev/null +++ b/tests/codegen/helloworld.cl @@ -0,0 +1,6 @@ +class Main { + main():IO { + new IO.out_string("Hello world!\n") + }; +}; + diff --git a/tests/codegen/io.cl b/tests/codegen/io.cl new file mode 100755 index 000000000..7f0de869e --- /dev/null +++ b/tests/codegen/io.cl @@ -0,0 +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"); + } + }; + +}; diff --git a/tests/codegen/life.cl b/tests/codegen/life.cl new file mode 100755 index 000000000..b83d97957 --- /dev/null +++ b/tests/codegen/life.cl @@ -0,0 +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; + } ) ); } + }; +}; + diff --git a/tests/codegen/list.cl b/tests/codegen/list.cl new file mode 100644 index 000000000..b384dac62 --- /dev/null +++ b/tests/codegen/list.cl @@ -0,0 +1,141 @@ +(* + * This file shows how to implement a list data type for lists of integers. + * It makes use of INHERITANCE and DYNAMIC DISPATCH. + * + * The List class has 4 operations defined on List objects. If 'l' is + * a list, then the methods dispatched on 'l' have the following effects: + * + * isNil() : Bool Returns true if 'l' is empty, false otherwise. + * head() : Int Returns the integer at the head of 'l'. + * If 'l' is empty, execution aborts. + * tail() : List Returns the remainder of the 'l', + * i.e. without the first element. + * cons(i : Int) : List Return a new list containing i as the + * first element, followed by the + * elements in 'l'. + * + * There are 2 kinds of lists, the empty list and a non-empty + * list. We can think of the non-empty list as a specialization of + * the empty list. + * The class List defines the operations on empty list. The class + * Cons inherits from List and redefines things to handle non-empty + * lists. + *) + + +class List { + -- Define operations on empty lists. + + isNil() : Bool { true }; + + -- Since abort() has return type Object and head() has return type + -- Int, we need to have an Int as the result of the method body, + -- even though abort() never returns. + + head() : Int { { abort(); 0; } }; + + -- As for head(), the self is just to make sure the return type of + -- tail() is correct. + + tail() : List { { abort(); self; } }; + + -- When we cons and element onto the empty list we get a non-empty + -- list. The (new Cons) expression creates a new list cell of class + -- Cons, which is initialized by a dispatch to init(). + -- The result of init() is an element of class Cons, but it + -- conforms to the return type List, because Cons is a subclass of + -- List. + + cons(i : Int) : List { + (new Cons).init(i, self) + }; + +}; + + +(* + * Cons inherits all operations from List. We can reuse only the cons + * method though, because adding an element to the front of an emtpy + * list is the same as adding it to the front of a non empty + * list. All other methods have to be redefined, since the behaviour + * for them is different from the empty list. + * + * Cons needs two attributes to hold the integer of this list + * cell and to hold the rest of the list. + * + * The init() method is used by the cons() method to initialize the + * cell. + *) + +class Cons inherits List { + + car : Int; -- The element in this list cell + + cdr : List; -- The rest of the list + + isNil() : Bool { false }; + + head() : Int { car }; + + tail() : List { cdr }; + + init(i : Int, rest : List) : List { + { + car <- i; + cdr <- rest; + self; + } + }; + +}; + + + +(* + * The Main class shows how to use the List class. It creates a small + * list and then repeatedly prints out its elements and takes off the + * first element of the list. + *) + +class Main inherits IO { + + mylist : List; + + -- Print all elements of the list. Calls itself recursively with + -- the tail of the list, until the end of the list is reached. + + print_list(l : List) : Object { + if l.isNil() then out_string("\n") + else { + out_int(l.head()); + out_string(" "); + print_list(l.tail()); + } + fi + }; + + -- Note how the dynamic dispatch mechanism is responsible to end + -- the while loop. As long as mylist is bound to an object of + -- dynamic type Cons, the dispatch to isNil calls the isNil method of + -- the Cons class, which returns false. However when we reach the + -- end of the list, mylist gets bound to the object that was + -- created by the (new List) expression. This object is of dynamic type + -- List, and thus the method isNil in the List class is called and + -- returns true. + + main() : Object { + { + mylist <- new List.cons(1).cons(2).cons(3).cons(4).cons(5); + while (not mylist.isNil()) loop + { + print_list(mylist); + mylist <- mylist.tail(); + } + pool; + } + }; + +}; + + + diff --git a/tests/codegen/new_complex.cl b/tests/codegen/new_complex.cl new file mode 100755 index 000000000..a4fe714ce --- /dev/null +++ b/tests/codegen/new_complex.cl @@ -0,0 +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 + }; +}; diff --git a/tests/codegen/palindrome.cl b/tests/codegen/palindrome.cl new file mode 100755 index 000000000..7f24789f9 --- /dev/null +++ b/tests/codegen/palindrome.cl @@ -0,0 +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; + } + }; +}; diff --git a/tests/codegen/primes.cl b/tests/codegen/primes.cl new file mode 100644 index 000000000..8b9254d58 --- /dev/null +++ b/tests/codegen/primes.cl @@ -0,0 +1,84 @@ + +(* + * methodless-primes.cl + * + * Designed by Jesse H. Willett, jhw@cory, 11103234, with + * Istvan Siposs, isiposs@cory, 12342921. + * + * This program generates primes in order without using any methods. + * Actually, it does use three methods: those of IO to print out each + * prime, and abort() to halt the program. These methods are incidental, + * however, to the information-processing functionality of the program. We + * could regard the attribute 'out's sequential values as our output, and + * the string "halt" as our terminate signal. + * + * Naturally, using Cool this way is a real waste, basically reducing it + * to assembly without the benefit of compilation. + * + * There could even be a subroutine-like construction, in that different + * code could be in the assign fields of attributes of other classes, + * and it could be executed by calling 'new Sub', but no parameters + * could be passed to the subroutine, and it could only return itself. + * but returning itself would be useless since we couldn't call methods + * and the only operators we have are for Int and Bool, which do nothing + * interesting when we initialize them! + *) + +class Main inherits IO { + + main() : Int { -- main() is an atrophied method so we can parse. + 0 + }; + + out : Int <- -- out is our 'output'. Its values are the primes. + { + out_string("2 is trivially prime.\n"); + 2; + }; + + testee : Int <- out; -- testee is a number to be tested for primeness. + + divisor : Int; -- divisor is a number which may factor testee. + + stop : Int <- 500; -- stop is an arbitrary value limiting testee. + + m : Object <- -- m supplants the main method. + while true loop + { + + testee <- testee + 1; + divisor <- 2; + + while + if testee < divisor * divisor + then false -- can stop if divisor > sqrt(testee). + else if testee - divisor*(testee/divisor) = 0 + then false -- can stop if divisor divides testee. + else true + fi fi + loop + divisor <- divisor + 1 + pool; + + if testee < divisor * divisor -- which reason did we stop for? + then -- testee has no factors less than sqrt(testee). + { + out <- testee; -- we could think of out itself as the output. + out_int(out); + out_string(" is prime.\n"); + } + else -- the loop halted on testee/divisor = 0, testee isn't prime. + 0 -- testee isn't prime, do nothing. + fi; + + if stop <= testee then + "halt".abort() -- we could think of "halt" as SIGTERM. + else + "continue" + fi; + + } + pool; + +}; (* end of Main *) + diff --git a/tests/codegen/print-cool.cl b/tests/codegen/print-cool.cl new file mode 100644 index 000000000..76194e966 --- /dev/null +++ b/tests/codegen/print-cool.cl @@ -0,0 +1,9 @@ +class Main inherits IO { + main() : IO { + { + out_string((new Object).type_name().substr(4,1)). + out_string((isvoid self).type_name().substr(1,3)); -- demonstrates the dispatch rules. + out_string("\n"); + } + }; +}; diff --git a/tests/codegen/sort-list.cl b/tests/codegen/sort-list.cl new file mode 100644 index 000000000..7cf7b20a3 --- /dev/null +++ b/tests/codegen/sort-list.cl @@ -0,0 +1,146 @@ +(* + This file presents a fairly large example of Cool programming. The +class List defines the names of standard list operations ala Scheme: +car, cdr, cons, isNil, rev, sort, rcons (add an element to the end of +the list), and print_list. In the List class most of these functions +are just stubs that abort if ever called. The classes Nil and Cons +inherit from List and define the same operations, but now as +appropriate to the empty list (for the Nil class) and for cons cells (for +the Cons class). + +The Main class puts all of this code through the following silly +test exercise: + + 1. prompt for a number N + 2. generate a list of numbers 0..N-1 + 3. reverse the list + 4. sort the list + 5. print the sorted list + +Because the sort used is a quadratic space insertion sort, sorting +moderately large lists can be quite slow. +*) + +Class List inherits IO { + (* Since abort() returns Object, we need something of + type Bool at the end of the block to satisfy the typechecker. + This code is unreachable, since abort() halts the program. *) + isNil() : Bool { { abort(); true; } }; + + cons(hd : Int) : 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 Int here to satisfy the typechecker. + This code is, of course, unreachable. + *) + car() : Int { { abort(); new Int; } }; + + cdr() : List { { abort(); new List; } }; + + rev() : List { cdr() }; + + sort() : List { cdr() }; + + insert(i : Int) : List { cdr() }; + + rcons(i : Int) : List { cdr() }; + + print_list() : Object { abort() }; +}; + +Class Cons inherits List { + xcar : Int; -- We keep the car in cdr in attributes. + xcdr : List; + + isNil() : Bool { false }; + + init(hd : Int, tl : List) : Cons { + { + xcar <- hd; + xcdr <- tl; + self; + } + }; + + car() : Int { xcar }; + + cdr() : List { xcdr }; + + rev() : List { (xcdr.rev()).rcons(xcar) }; + + sort() : List { (xcdr.sort()).insert(xcar) }; + + insert(i : Int) : List { + if i < xcar then + (new Cons).init(i,self) + else + (new Cons).init(xcar,xcdr.insert(i)) + fi + }; + + + rcons(i : Int) : List { (new Cons).init(xcar, xcdr.rcons(i)) }; + + print_list() : Object { + { + out_int(xcar); + out_string("\n"); + xcdr.print_list(); + } + }; +}; + +Class Nil inherits List { + isNil() : Bool { true }; + + rev() : List { self }; + + sort() : List { self }; + + insert(i : Int) : List { rcons(i) }; + + rcons(i : Int) : List { (new Cons).init(i,self) }; + + print_list() : Object { true }; + +}; + + +Class Main inherits IO { + + l : List; + + (* iota maps its integer argument n into the list 0..n-1 *) + iota(i : Int) : List { + { + l <- new Nil; + (let j : Int <- 0 in + while j < i + loop + { + l <- (new Cons).init(j,l); + j <- j + 1; + } + pool + ); + l; + } + }; + + main() : Object { + { + out_string("How many numbers to sort? "); + iota(in_int()).rev().sort().print_list(); + } + }; +}; + + + + + diff --git a/tests/codegen/test.cl b/tests/codegen/test.cl new file mode 100755 index 000000000..9c2e0fd8d --- /dev/null +++ b/tests/codegen/test.cl @@ -0,0 +1,19 @@ +class Main inherits IO { + + main () : Object { + { + let x:A <- new B in out_string( x.f().m() ); + let x:A <- new A in out_string( x.f().m() ); + } + + }; +}; + +class A { + m () : String { "A" }; + f () : A { new A }; +}; + +class B inherits A { + m () : String { "B" }; +}; diff --git a/tests/codegen_test.py b/tests/codegen_test.py new file mode 100644 index 000000000..6d864cb06 --- /dev/null +++ b/tests/codegen_test.py @@ -0,0 +1,15 @@ +import pytest +import os +from utils import compare_errors + +tests_dir = __file__.rpartition('/')[0] + '/codegen/' +tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] + +# @pytest.mark.lexer +# @pytest.mark.parser +# @pytest.mark.semantic +@pytest.mark.ok +@pytest.mark.run(order=4) +@pytest.mark.parametrize("cool_file", tests) +def test_codegen(compiler_path, cool_file): + compare_errors(compiler_path, tests_dir + cool_file, None) \ No newline at end of file diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 000000000..1f44eeb72 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,6 @@ +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/comment1.cl b/tests/lexer/comment1.cl new file mode 100644 index 000000000..69533f23c --- /dev/null +++ b/tests/lexer/comment1.cl @@ -0,0 +1,55 @@ +--Any characters between two dashes “--” and the next newline +--(or EOF, if there is no next newline) are treated as comments + +(*(*(* +Comments may also be written by enclosing +text in (∗ . . . ∗). The latter form of comment may be nested. +Comments cannot cross file boundaries. +*)*)*) + +class Error() { + + (* There was once a comment, + that was quite long. + But, the reader soon discovered that + the comment was indeed longer than + previously assumed. Now, the reader + was in a real dilemma; is the comment + ever gonna end? If I stop reading, will + it end? + He started imagining all sorts of things. + He thought about heisenberg's cat and how + how that relates to the end of the sentence. + He thought to himself "I'm gonna stop reading". + "If I keep reading this comment, I'm gonna know + the fate of this sentence; That will be disastorous." + He knew that such a comment was gonna extend to + another file. It was too awesome to be contained in + a single file. And he would have kept reading too... + if only... + cool wasn't a super-duper-fab-awesomest language; + but cool is that language; + "This comment shall go not cross this file" said cool. + Alas! The reader could read no more. + There was once a comment, + that was quite long. + But, the reader soon discovered that + the comment was indeed longer than + previously assumed. Now, the reader + was in a real dilemma; is the comment + ever gonna end? If I stop reading, will + it end? + He started imagining all sorts of things. + He thought about heisenberg's cat and how + how that relates to the end of the sentence. + He thought to himself "I'm gonna stop reading". + "If I keep reading this comment, I'm gonna know + the fate of this sentence; That will be disastorous." + He knew that such a comment was gonna extend to + another file. It was too awesome to be contained in + a single file. And he would have kept reading too... + if only... + cool wasn't a super-duper-fab-awesomest language; + but cool is that language; + "This comment shall go not cross this file" said cool. + Alas! The reader could read no more. \ No newline at end of file diff --git a/tests/lexer/comment1_error.txt b/tests/lexer/comment1_error.txt new file mode 100644 index 000000000..9fd7b8d67 --- /dev/null +++ b/tests/lexer/comment1_error.txt @@ -0,0 +1 @@ +(55, 46) - LexicographicError: EOF in comment diff --git a/tests/lexer/iis1.cl b/tests/lexer/iis1.cl new file mode 100644 index 000000000..12cb52beb --- /dev/null +++ b/tests/lexer/iis1.cl @@ -0,0 +1,111 @@ +(* Integers, Identifiers, and Special Notation *) + +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ +5! = 120, 2 + 2 = 5 or E = mc2; p + 1 @ p = 1: for x in range(len(b)) +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) +class Class if then else fi testing Testing ~007agent_bond james_007B0N3SS___ +loop pool while tRuE or noT faLsE let in case of ESAC + +(* +#3 INT_CONST 0007 +#3 INT_CONST 123 +#3 '+' +#3 INT_CONST 1 +#3 '-' +#3 INT_CONST 1 +#3 '+' +#3 INT_CONST 90 +#3 '-' +#3 INT_CONST 09 +#3 '+' +#3 INT_CONST 11113 +#3 '-' +#3 INT_CONST 4 +#3 OBJECTID r +#3 '*' +#3 OBJECTID a +#3 '*' +#3 OBJECTID self +#3 '*' +#3 OBJECTID c +#3 '+' +#3 '+' +#4 INT_CONST 5 +#4 ERROR "!" +#4 '=' +#4 INT_CONST 120 +#4 ',' +#4 INT_CONST 2 +#4 '+' +#4 INT_CONST 2 +#4 '=' +#4 INT_CONST 5 +#4 OBJECTID or +#4 TYPEID E +#4 '=' +#4 OBJECTID mc2 +#4 ';' +#4 OBJECTID p +#4 '+' +#4 INT_CONST 1 +#4 '@' +#4 OBJECTID p +#4 '=' +#4 INT_CONST 1 +#4 ':' +#4 OBJECTID for +#4 OBJECTID x +#4 IN +#4 OBJECTID range +#4 '(' +#4 OBJECTID len +#4 '(' +#4 OBJECTID b +#4 ')' +#4 ')' +#5 NEW +#5 '/' +#5 ASSIGN +#5 '<' +#5 LE +#5 DARROW +#5 '{' +#5 '(' +#5 TYPEID Int +#5 ':' +#5 TYPEID Objet +#5 ',' +#5 TYPEID Bool +#5 ';' +#5 TYPEID String +#5 '.' +#5 OBJECTID string +#5 TYPEID SELF_TYPE +#5 ISVOID +#5 '}' +#5 ')' +#6 CLASS +#6 CLASS +#6 IF +#6 THEN +#6 ELSE +#6 FI +#6 OBJECTID testing +#6 TYPEID Testing +#6 '~' +#6 INT_CONST 007 +#6 OBJECTID agent_bond +#6 OBJECTID james_007B0N3SS___ +#7 LOOP +#7 POOL +#7 WHILE +#7 BOOL_CONST true +#7 OBJECTID or +#7 NOT +#7 BOOL_CONST false +#7 LET +#7 IN +#7 CASE +#7 OF +#7 ESAC +*) \ No newline at end of file diff --git a/tests/lexer/iis1_error.txt b/tests/lexer/iis1_error.txt new file mode 100644 index 000000000..9e6d66cac --- /dev/null +++ b/tests/lexer/iis1_error.txt @@ -0,0 +1 @@ +(4, 2) - LexicographicError: ERROR "!" diff --git a/tests/lexer/iis2.cl b/tests/lexer/iis2.cl new file mode 100644 index 000000000..9b25715d4 --- /dev/null +++ b/tests/lexer/iis2.cl @@ -0,0 +1,120 @@ +(* Integers, Identifiers, and Special Notation *) + +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ +class Class if then else fi testing Testing ~007agent_bond james_007bones___ + + +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) +loop pool while tRuE or noT faLsE let in case of ESAC + +factorial(5) = 120, 2 + 2 = 5? or E = mc2; p + 1 resto p = 1: (@ for x in range(len(b))) + +(* +#3 INT_CONST 0007 +#3 INT_CONST 123 +#3 '+' +#3 INT_CONST 1 +#3 '-' +#3 INT_CONST 1 +#3 '+' +#3 INT_CONST 90 +#3 '-' +#3 INT_CONST 09 +#3 '+' +#3 INT_CONST 11113 +#3 '-' +#3 INT_CONST 4 +#3 OBJECTID r +#3 '*' +#3 OBJECTID a +#3 '*' +#3 OBJECTID self +#3 '*' +#3 OBJECTID c +#3 '+' +#3 '+' +#4 CLASS +#4 CLASS +#4 IF +#4 THEN +#4 ELSE +#4 FI +#4 OBJECTID testing +#4 TYPEID Testing +#4 '~' +#4 INT_CONST 007 +#4 OBJECTID agent_bond +#4 OBJECTID james_007bones___ +#7 NEW +#7 '/' +#7 ASSIGN +#7 '<' +#7 LE +#7 DARROW +#7 '{' +#7 '(' +#7 TYPEID Int +#7 ':' +#7 TYPEID Objet +#7 ',' +#7 TYPEID Bool +#7 ';' +#7 TYPEID String +#7 '.' +#7 OBJECTID string +#7 TYPEID SELF_TYPE +#7 ISVOID +#7 '}' +#7 ')' +#8 LOOP +#8 POOL +#8 WHILE +#8 BOOL_CONST true +#8 OBJECTID or +#8 NOT +#8 BOOL_CONST false +#8 LET +#8 IN +#8 CASE +#8 OF +#8 ESAC +#10 OBJECTID factorial +#10 '(' +#10 INT_CONST 5 +#10 ')' +#10 '=' +#10 INT_CONST 120 +#10 ',' +#10 INT_CONST 2 +#10 '+' +#10 INT_CONST 2 +#10 '=' +#10 INT_CONST 5 +#10 ERROR "?" +#10 OBJECTID or +#10 TYPEID E +#10 '=' +#10 OBJECTID mc2 +#10 ';' +#10 OBJECTID p +#10 '+' +#10 INT_CONST 1 +#10 OBJECTID resto +#10 OBJECTID p +#10 '=' +#10 INT_CONST 1 +#10 ':' +#10 '(' +#10 '@' +#10 OBJECTID for +#10 OBJECTID x +#10 IN +#10 OBJECTID range +#10 '(' +#10 OBJECTID len +#10 '(' +#10 OBJECTID b +#10 ')' +#10 ')' +#10 ')' +*) \ No newline at end of file diff --git a/tests/lexer/iis2_error.txt b/tests/lexer/iis2_error.txt new file mode 100644 index 000000000..922391a9d --- /dev/null +++ b/tests/lexer/iis2_error.txt @@ -0,0 +1 @@ +(10, 30) - LexicographicError: ERROR "?" diff --git a/tests/lexer/iis3.cl b/tests/lexer/iis3.cl new file mode 100644 index 000000000..0b965ddea --- /dev/null +++ b/tests/lexer/iis3.cl @@ -0,0 +1,121 @@ +(* Integers, Identifiers, and Special Notation *) + +factorial(5) = 120, 2 + 2 = 5 or E = mc^2; p + 1 @ p = 1: z for x in range(len(b))) + +loop pool while tRuE or noT faLsE let in case of ESAC + +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) + + +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ +class Class if then else fi testing Testing ~007agent_bond james_007bones___ + +(* +#3 OBJECTID factorial +#3 '(' +#3 INT_CONST 5 +#3 ')' +#3 '=' +#3 INT_CONST 120 +#3 ',' +#3 INT_CONST 2 +#3 '+' +#3 INT_CONST 2 +#3 '=' +#3 INT_CONST 5 +#3 OBJECTID or +#3 TYPEID E +#3 '=' +#3 OBJECTID mc +#3 ERROR "^" +#3 INT_CONST 2 +#3 ';' +#3 OBJECTID p +#3 '+' +#3 INT_CONST 1 +#3 '@' +#3 OBJECTID p +#3 '=' +#3 INT_CONST 1 +#3 ':' +#3 OBJECTID z +#3 OBJECTID for +#3 OBJECTID x +#3 IN +#3 OBJECTID range +#3 '(' +#3 OBJECTID len +#3 '(' +#3 OBJECTID b +#3 ')' +#3 ')' +#3 ')' +#5 LOOP +#5 POOL +#5 WHILE +#5 BOOL_CONST true +#5 OBJECTID or +#5 NOT +#5 BOOL_CONST false +#5 LET +#5 IN +#5 CASE +#5 OF +#5 ESAC +#7 NEW +#7 '/' +#7 ASSIGN +#7 '<' +#7 LE +#7 DARROW +#7 '{' +#7 '(' +#7 TYPEID Int +#7 ':' +#7 TYPEID Objet +#7 ',' +#7 TYPEID Bool +#7 ';' +#7 TYPEID String +#7 '.' +#7 OBJECTID string +#7 TYPEID SELF_TYPE +#7 ISVOID +#7 '}' +#7 ')' +#10 INT_CONST 0007 +#10 INT_CONST 123 +#10 '+' +#10 INT_CONST 1 +#10 '-' +#10 INT_CONST 1 +#10 '+' +#10 INT_CONST 90 +#10 '-' +#10 INT_CONST 09 +#10 '+' +#10 INT_CONST 11113 +#10 '-' +#10 INT_CONST 4 +#10 OBJECTID r +#10 '*' +#10 OBJECTID a +#10 '*' +#10 OBJECTID self +#10 '*' +#10 OBJECTID c +#10 '+' +#10 '+' +#11 CLASS +#11 CLASS +#11 IF +#11 THEN +#11 ELSE +#11 FI +#11 OBJECTID testing +#11 TYPEID Testing +#11 '~' +#11 INT_CONST 007 +#11 OBJECTID agent_bond +#11 OBJECTID james_007bones___ +*) \ No newline at end of file diff --git a/tests/lexer/iis3_error.txt b/tests/lexer/iis3_error.txt new file mode 100644 index 000000000..b001b6a71 --- /dev/null +++ b/tests/lexer/iis3_error.txt @@ -0,0 +1 @@ +(3, 40) - LexicographicError: ERROR "^" diff --git a/tests/lexer/iis4.cl b/tests/lexer/iis4.cl new file mode 100644 index 000000000..9e7a9cb62 --- /dev/null +++ b/tests/lexer/iis4.cl @@ -0,0 +1,120 @@ +(* Integers, Identifiers, and Special Notation *) + +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ + +factorial(5) = 120, 2 + 2 = 5 or E = mc2; p + 1 % p = 1: @.@ for x in range(len(b))~ + + +loop pool while tRuE or noT faLsE let in case of ESAC +class Class if then else fi testing Testing ~007agent_bond james_007bones___ + +(* +#3 NEW +#3 '/' +#3 ASSIGN +#3 '<' +#3 LE +#3 DARROW +#3 '{' +#3 '(' +#3 TYPEID Int +#3 ':' +#3 TYPEID Objet +#3 ',' +#3 TYPEID Bool +#3 ';' +#3 TYPEID String +#3 '.' +#3 OBJECTID string +#3 TYPEID SELF_TYPE +#3 ISVOID +#3 '}' +#3 ')' +#4 INT_CONST 0007 +#4 INT_CONST 123 +#4 '+' +#4 INT_CONST 1 +#4 '-' +#4 INT_CONST 1 +#4 '+' +#4 INT_CONST 90 +#4 '-' +#4 INT_CONST 09 +#4 '+' +#4 INT_CONST 11113 +#4 '-' +#4 INT_CONST 4 +#4 OBJECTID r +#4 '*' +#4 OBJECTID a +#4 '*' +#4 OBJECTID self +#4 '*' +#4 OBJECTID c +#4 '+' +#4 '+' +#6 OBJECTID factorial +#6 '(' +#6 INT_CONST 5 +#6 ')' +#6 '=' +#6 INT_CONST 120 +#6 ',' +#6 INT_CONST 2 +#6 '+' +#6 INT_CONST 2 +#6 '=' +#6 INT_CONST 5 +#6 OBJECTID or +#6 TYPEID E +#6 '=' +#6 OBJECTID mc2 +#6 ';' +#6 OBJECTID p +#6 '+' +#6 INT_CONST 1 +#6 ERROR "%" +#6 OBJECTID p +#6 '=' +#6 INT_CONST 1 +#6 ':' +#6 '@' +#6 '.' +#6 '@' +#6 OBJECTID for +#6 OBJECTID x +#6 IN +#6 OBJECTID range +#6 '(' +#6 OBJECTID len +#6 '(' +#6 OBJECTID b +#6 ')' +#6 ')' +#6 '~' +#9 LOOP +#9 POOL +#9 WHILE +#9 BOOL_CONST true +#9 OBJECTID or +#9 NOT +#9 BOOL_CONST false +#9 LET +#9 IN +#9 CASE +#9 OF +#9 ESAC +#10 CLASS +#10 CLASS +#10 IF +#10 THEN +#10 ELSE +#10 FI +#10 OBJECTID testing +#10 TYPEID Testing +#10 '~' +#10 INT_CONST 007 +#10 OBJECTID agent_bond +#10 OBJECTID james_007bones___ +*) \ No newline at end of file diff --git a/tests/lexer/iis4_error.txt b/tests/lexer/iis4_error.txt new file mode 100644 index 000000000..f24076a8c --- /dev/null +++ b/tests/lexer/iis4_error.txt @@ -0,0 +1 @@ +(6, 49) - LexicographicError: ERROR "!" diff --git a/tests/lexer/iis5.cl b/tests/lexer/iis5.cl new file mode 100644 index 000000000..d146c0547 --- /dev/null +++ b/tests/lexer/iis5.cl @@ -0,0 +1,121 @@ +(* Integers, Identifiers, and Special Notation *) + + +loop pool while tRuE or noT faLsE let in case of ESAC +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) +class Class if then else fi testing Testing ~007agent_bond james_007bones___ + +factorial(5) = 120, 2 + 2 = 5 or E = mc2; p + 1 resto p = 1: [@.@ for x in range(len(b))] + +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ + +(* +#4 LOOP +#4 POOL +#4 WHILE +#4 BOOL_CONST true +#4 OBJECTID or +#4 NOT +#4 BOOL_CONST false +#4 LET +#4 IN +#4 CASE +#4 OF +#4 ESAC +#5 NEW +#5 '/' +#5 ASSIGN +#5 '<' +#5 LE +#5 DARROW +#5 '{' +#5 '(' +#5 TYPEID Int +#5 ':' +#5 TYPEID Objet +#5 ',' +#5 TYPEID Bool +#5 ';' +#5 TYPEID String +#5 '.' +#5 OBJECTID string +#5 TYPEID SELF_TYPE +#5 ISVOID +#5 '}' +#5 ')' +#6 CLASS +#6 CLASS +#6 IF +#6 THEN +#6 ELSE +#6 FI +#6 OBJECTID testing +#6 TYPEID Testing +#6 '~' +#6 INT_CONST 007 +#6 OBJECTID agent_bond +#6 OBJECTID james_007bones___ +#8 OBJECTID factorial +#8 '(' +#8 INT_CONST 5 +#8 ')' +#8 '=' +#8 INT_CONST 120 +#8 ',' +#8 INT_CONST 2 +#8 '+' +#8 INT_CONST 2 +#8 '=' +#8 INT_CONST 5 +#8 OBJECTID or +#8 TYPEID E +#8 '=' +#8 OBJECTID mc2 +#8 ';' +#8 OBJECTID p +#8 '+' +#8 INT_CONST 1 +#8 OBJECTID resto +#8 OBJECTID p +#8 '=' +#8 INT_CONST 1 +#8 ':' +#8 ERROR "[" +#8 '@' +#8 '.' +#8 '@' +#8 OBJECTID for +#8 OBJECTID x +#8 IN +#8 OBJECTID range +#8 '(' +#8 OBJECTID len +#8 '(' +#8 OBJECTID b +#8 ')' +#8 ')' +#8 ERROR "]" +#10 INT_CONST 0007 +#10 INT_CONST 123 +#10 '+' +#10 INT_CONST 1 +#10 '-' +#10 INT_CONST 1 +#10 '+' +#10 INT_CONST 90 +#10 '-' +#10 INT_CONST 09 +#10 '+' +#10 INT_CONST 11113 +#10 '-' +#10 INT_CONST 4 +#10 OBJECTID r +#10 '*' +#10 OBJECTID a +#10 '*' +#10 OBJECTID self +#10 '*' +#10 OBJECTID c +#10 '+' +#10 '+' +*) diff --git a/tests/lexer/iis5_error.txt b/tests/lexer/iis5_error.txt new file mode 100644 index 000000000..b3dbadcb6 --- /dev/null +++ b/tests/lexer/iis5_error.txt @@ -0,0 +1,2 @@ +(8, 62) - LexicographicError: ERROR "[" +(8, 89) - LexicographicError: ERROR "]" diff --git a/tests/lexer/iis6.cl b/tests/lexer/iis6.cl new file mode 100644 index 000000000..1042f132b --- /dev/null +++ b/tests/lexer/iis6.cl @@ -0,0 +1,125 @@ +(* Integers, Identifiers, and Special Notation *) + +factorial(5) = 120, 2 + 2 = 5 or E = mc2; p + 1 resto p = 1: {@.@ for x in range(len(b))} + +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) + + +class Class if then else fi testing Testing ~007agent_bond _james_007bones___ + + + +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ +loop pool while tRuE or noT faLsE let in case of ESAC + +(* +#3 OBJECTID factorial +#3 '(' +#3 INT_CONST 5 +#3 ')' +#3 '=' +#3 INT_CONST 120 +#3 ',' +#3 INT_CONST 2 +#3 '+' +#3 INT_CONST 2 +#3 '=' +#3 INT_CONST 5 +#3 OBJECTID or +#3 TYPEID E +#3 '=' +#3 OBJECTID mc2 +#3 ';' +#3 OBJECTID p +#3 '+' +#3 INT_CONST 1 +#3 OBJECTID resto +#3 OBJECTID p +#3 '=' +#3 INT_CONST 1 +#3 ':' +#3 '{' +#3 '@' +#3 '.' +#3 '@' +#3 OBJECTID for +#3 OBJECTID x +#3 IN +#3 OBJECTID range +#3 '(' +#3 OBJECTID len +#3 '(' +#3 OBJECTID b +#3 ')' +#3 ')' +#3 '}' +#5 NEW +#5 '/' +#5 ASSIGN +#5 '<' +#5 LE +#5 DARROW +#5 '{' +#5 '(' +#5 TYPEID Int +#5 ':' +#5 TYPEID Objet +#5 ',' +#5 TYPEID Bool +#5 ';' +#5 TYPEID String +#5 '.' +#5 OBJECTID string +#5 TYPEID SELF_TYPE +#5 ISVOID +#5 '}' +#5 ')' +#8 CLASS +#8 CLASS +#8 IF +#8 THEN +#8 ELSE +#8 FI +#8 OBJECTID testing +#8 TYPEID Testing +#8 '~' +#8 INT_CONST 007 +#8 OBJECTID agent_bond +#8 ERROR "_" +#8 OBJECTID james_007bones___ +#12 INT_CONST 0007 +#12 INT_CONST 123 +#12 '+' +#12 INT_CONST 1 +#12 '-' +#12 INT_CONST 1 +#12 '+' +#12 INT_CONST 90 +#12 '-' +#12 INT_CONST 09 +#12 '+' +#12 INT_CONST 11113 +#12 '-' +#12 INT_CONST 4 +#12 OBJECTID r +#12 '*' +#12 OBJECTID a +#12 '*' +#12 OBJECTID self +#12 '*' +#12 OBJECTID c +#12 '+' +#12 '+' +#13 LOOP +#13 POOL +#13 WHILE +#13 BOOL_CONST true +#13 OBJECTID or +#13 NOT +#13 BOOL_CONST false +#13 LET +#13 IN +#13 CASE +#13 OF +#13 ESAC +*) \ No newline at end of file diff --git a/tests/lexer/iis6_error.txt b/tests/lexer/iis6_error.txt new file mode 100644 index 000000000..d7fad9c79 --- /dev/null +++ b/tests/lexer/iis6_error.txt @@ -0,0 +1 @@ +(8, 60) - LexicographicError: ERROR "_" diff --git a/tests/lexer/mixed1.cl b/tests/lexer/mixed1.cl new file mode 100644 index 000000000..803d58ef5 --- /dev/null +++ b/tests/lexer/mixed1.cl @@ -0,0 +1,14 @@ +"lkjdsafkljdsalfj\u0000dsafdsaf\u0000djafslkjdsalf\nsdajf\" lkjfdsasdkjfl"123 +adsfasklj# +LKldsajf iNhERITS +"lkdsajf" + +(* +#1 STR_CONST "lkjdsafkljdsalfju0000dsafdsafu0000djafslkjdsalf\nsdajf\" lkjfdsasdkjfl" +#1 INT_CONST 123 +#2 OBJECTID adsfasklj +#2 ERROR "#" +#3 TYPEID LKldsajf +#3 INHERITS +#4 STR_CONST "lkdsajf" +*) \ No newline at end of file diff --git a/tests/lexer/mixed1_error.txt b/tests/lexer/mixed1_error.txt new file mode 100644 index 000000000..99af5fbdc --- /dev/null +++ b/tests/lexer/mixed1_error.txt @@ -0,0 +1 @@ +(2, 10) - LexicographicError: ERROR "#" diff --git a/tests/lexer/mixed2.cl b/tests/lexer/mixed2.cl new file mode 100644 index 000000000..12039e123 --- /dev/null +++ b/tests/lexer/mixed2.cl @@ -0,0 +1,20 @@ +"kjas\"lnnsdj\nfljrdsaf" +@.$.@ +@*%*@ +"alkjfldajf""dasfadsf + +(* +#1 STR_CONST "kjas\"lnnsdj\nfljrdsaf" +#2 '@' +#2 '.' +#2 ERROR "$" +#2 '.' +#2 '@' +#3 '@' +#3 '*' +#3 ERROR "%" +#3 '*' +#3 '@' +#4 STR_CONST "alkjfldajf" +#4 ERROR "Unterminated string constant" +*) \ No newline at end of file diff --git a/tests/lexer/mixed2_error.txt b/tests/lexer/mixed2_error.txt new file mode 100644 index 000000000..097dc2a07 --- /dev/null +++ b/tests/lexer/mixed2_error.txt @@ -0,0 +1,3 @@ +(2, 3) - LexicographicError: ERROR "$" +(3, 3) - LexicographicError: ERROR "%" +(4, 22) - LexicographicError: Unterminated string constant diff --git a/tests/lexer/string1.cl b/tests/lexer/string1.cl new file mode 100644 index 000000000..6c3c00833 --- /dev/null +++ b/tests/lexer/string1.cl @@ -0,0 +1,6 @@ +(* A non-escaped newline character may not appear in a string *) + +"This \ +is OK" +"This is not +OK" \ No newline at end of file diff --git a/tests/lexer/string1_error.txt b/tests/lexer/string1_error.txt new file mode 100644 index 000000000..078c12bbb --- /dev/null +++ b/tests/lexer/string1_error.txt @@ -0,0 +1,2 @@ +(5, 13) - LexicographicError: Unterminated string constant +(6, 4) - LexicographicError: EOF in string constant \ No newline at end of file diff --git a/tests/lexer/string2.cl b/tests/lexer/string2.cl new file mode 100644 index 000000000..3704b6ae7 --- /dev/null +++ b/tests/lexer/string2.cl @@ -0,0 +1,19 @@ +(* A string may not contain EOF *) + +" May the Triforce \ + 0 \ + 0v0 \ + 0vvv0 \ + 0vvvvv0 \ + 0vvvvvvv0 \ + 0vvvvvvvvv0 \ + 0vvvvvvvvvvv0 \ + 000000000000000 \ + 0v0 0v0 \ + 0vvv0 0vvv0 \ + 0vvvvv0 0vvvvv0 \ + 0vvvvvvv0 0vvvvvvv0 \ + 0vvvvvvvvv0 0vvvvvvvvv0 \ + 0vvvvvvvvvvv0 0vvvvvvvvvvv0 \ + 00000000000000000000000000000 \ + be with you! \ No newline at end of file diff --git a/tests/lexer/string2_error.txt b/tests/lexer/string2_error.txt new file mode 100644 index 000000000..7fbbcb526 --- /dev/null +++ b/tests/lexer/string2_error.txt @@ -0,0 +1 @@ +(19, 29) - LexicographicError: EOF in string constant \ No newline at end of file diff --git a/tests/lexer/string3.cl b/tests/lexer/string3.cl new file mode 100644 index 0000000000000000000000000000000000000000..78abc4972e218bca373ba1750c99a3450cef4ea3 GIT binary patch literal 234 zcmX|4yAH!34D8HToS2dhRoZ?*=Jpd<90*B>0}_xSe_!a!lI8Q=*(aJadZZi|KVhQ- zK4j?NGc6u@9^rRpGmYcJ^ifl$K@ Mi{IIrdU_-I0>Lp*mH+?% literal 0 HcmV?d00001 diff --git a/tests/lexer/string3_error.txt b/tests/lexer/string3_error.txt new file mode 100644 index 000000000..35695d07e --- /dev/null +++ b/tests/lexer/string3_error.txt @@ -0,0 +1 @@ +(8, 4) - LexicographicError: String contains null character \ No newline at end of file diff --git a/tests/lexer/string4.cl b/tests/lexer/string4.cl new file mode 100644 index 000000000..f4d39c027 --- /dev/null +++ b/tests/lexer/string4.cl @@ -0,0 +1,38 @@ +class Main { + str <- "The big brown fox + jumped over the fence"; + main() : Object { + { + out_string("Yay! This is the newest shites ); + } + }; +}; + +(* +#1 CLASS +#1 TYPEID Main +#1 '{' +#2 OBJECTID str +#2 ASSIGN +#3 ERROR "Unterminated string constant" +#3 OBJECTID jumped +#3 OBJECTID over +#3 OBJECTID the +#3 OBJECTID fence +#4 ERROR "Unterminated string constant" +#4 OBJECTID main +#4 '(' +#4 ')' +#4 ':' +#4 TYPEID Object +#4 '{' +#5 '{' +#6 OBJECTID out_string +#6 '(' +#7 ERROR "Unterminated string constant" +#7 '}' +#8 '}' +#8 ';' +#9 '}' +#9 ';' +*) \ No newline at end of file diff --git a/tests/lexer/string4_error.txt b/tests/lexer/string4_error.txt new file mode 100644 index 000000000..5ab0ea847 --- /dev/null +++ b/tests/lexer/string4_error.txt @@ -0,0 +1,3 @@ +(2, 30) - LexicographicError: Unterminated string constant +(3, 36) - LexicographicError: Unterminated string constant +(6, 58) - LexicographicError: Unterminated string constant \ No newline at end of file diff --git a/tests/lexer_test.py b/tests/lexer_test.py new file mode 100644 index 000000000..2a27223d3 --- /dev/null +++ b/tests/lexer_test.py @@ -0,0 +1,13 @@ +import pytest +import os +from utils import compare_errors + +tests_dir = __file__.rpartition('/')[0] + '/lexer/' +tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] + +@pytest.mark.lexer +@pytest.mark.error +@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 diff --git a/tests/parser/assignment1.cl b/tests/parser/assignment1.cl new file mode 100644 index 000000000..75b4c5bbd --- /dev/null +++ b/tests/parser/assignment1.cl @@ -0,0 +1,37 @@ +(* An assignment has the form <- *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(): String { + Test1 <- "Hello World" -- Identifiers begin with a lower case letter + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/assignment1_error.txt b/tests/parser/assignment1_error.txt new file mode 100644 index 000000000..cef0d3946 --- /dev/null +++ b/tests/parser/assignment1_error.txt @@ -0,0 +1 @@ +(29, 9) - SyntacticError: ERROR at or near "Test1" \ No newline at end of file diff --git a/tests/parser/assignment2.cl b/tests/parser/assignment2.cl new file mode 100644 index 000000000..4efb96487 --- /dev/null +++ b/tests/parser/assignment2.cl @@ -0,0 +1,37 @@ +(* An assignment has the form <- *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 - 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(): Int { + test1 <-- ~(1 + 2 + 3 + 4 + 5) -- The left side must be an expression + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/assignment2_error.txt b/tests/parser/assignment2_error.txt new file mode 100644 index 000000000..dc611c159 --- /dev/null +++ b/tests/parser/assignment2_error.txt @@ -0,0 +1 @@ +(29, 17) - SyntacticError: ERROR at or near "-" \ No newline at end of file diff --git a/tests/parser/assignment3.cl b/tests/parser/assignment3.cl new file mode 100644 index 000000000..ff633f331 --- /dev/null +++ b/tests/parser/assignment3.cl @@ -0,0 +1,37 @@ +(* An assignment has the form <- *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(): Bool { + test1 <- true++ -- The left side must be an expression + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/assignment3_error.txt b/tests/parser/assignment3_error.txt new file mode 100644 index 000000000..a69ac3a81 --- /dev/null +++ b/tests/parser/assignment3_error.txt @@ -0,0 +1 @@ +(29, 23) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/attribute1.cl b/tests/parser/attribute1.cl new file mode 100644 index 000000000..063a02c02 --- /dev/null +++ b/tests/parser/attribute1.cl @@ -0,0 +1,34 @@ +(* An attribute of class A specifies a variable that is part of the state of objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + -- Attributes names must begin with lowercase letters + Test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/attribute1_error.txt b/tests/parser/attribute1_error.txt new file mode 100644 index 000000000..a4e9eb060 --- /dev/null +++ b/tests/parser/attribute1_error.txt @@ -0,0 +1 @@ +(17, 5) - SyntacticError: ERROR at or near "Test2" \ No newline at end of file diff --git a/tests/parser/attribute2.cl b/tests/parser/attribute2.cl new file mode 100644 index 000000000..c05211483 --- /dev/null +++ b/tests/parser/attribute2.cl @@ -0,0 +1,34 @@ +(* An attribute of class A specifies a variable that is part of the state of objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + -- Type names must begin with uppercase letters + test3: string <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/attribute2_error.txt b/tests/parser/attribute2_error.txt new file mode 100644 index 000000000..b02a52ee1 --- /dev/null +++ b/tests/parser/attribute2_error.txt @@ -0,0 +1 @@ +(19, 12) - SyntacticError: ERROR at or near "string" \ No newline at end of file diff --git a/tests/parser/attribute3.cl b/tests/parser/attribute3.cl new file mode 100644 index 000000000..d858ae47c --- /dev/null +++ b/tests/parser/attribute3.cl @@ -0,0 +1,34 @@ +(* An attribute of class A specifies a variable that is part of the state of objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + -- Expected '<-' not '<=' + test3: String <= "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/attribute3_error.txt b/tests/parser/attribute3_error.txt new file mode 100644 index 000000000..71f5bc0b7 --- /dev/null +++ b/tests/parser/attribute3_error.txt @@ -0,0 +1 @@ +(19, 19) - SyntacticError: ERROR at or near "<=" \ No newline at end of file diff --git a/tests/parser/block1.cl b/tests/parser/block1.cl new file mode 100644 index 000000000..3613d9268 --- /dev/null +++ b/tests/parser/block1.cl @@ -0,0 +1,87 @@ +(* A block has the form { ; ... ; } *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + pow: Int <- 1; + count: Int <- 0; + + testing6(a: Int): IO { + { + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2 -- Missing ";" + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/block1_error.txt b/tests/parser/block1_error.txt new file mode 100644 index 000000000..c78fb0b96 --- /dev/null +++ b/tests/parser/block1_error.txt @@ -0,0 +1 @@ +(56, 17) - SyntacticError: ERROR at or near "}" \ No newline at end of file diff --git a/tests/parser/block2.cl b/tests/parser/block2.cl new file mode 100644 index 000000000..f485dd0b1 --- /dev/null +++ b/tests/parser/block2.cl @@ -0,0 +1,87 @@ +(* A block has the form { ; ... ; } *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + pow: Int <- 1; + count: Int <- 0; + + testing6(a: Int): IO { + -- Missing "{" + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/block2_error.txt b/tests/parser/block2_error.txt new file mode 100644 index 000000000..f85f4303c --- /dev/null +++ b/tests/parser/block2_error.txt @@ -0,0 +1 @@ +(49, 23) - SyntacticError: ERROR at or near ";" \ No newline at end of file diff --git a/tests/parser/block3.cl b/tests/parser/block3.cl new file mode 100644 index 000000000..ae1598c3b --- /dev/null +++ b/tests/parser/block3.cl @@ -0,0 +1,87 @@ +(* A block has the form { ; ... ; } *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + pow: Int <- 1; + count: Int <- 0; + + testing6(a: Int): IO { + { + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + -- Missing "}" + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/block3_error.txt b/tests/parser/block3_error.txt new file mode 100644 index 000000000..cda9949a2 --- /dev/null +++ b/tests/parser/block3_error.txt @@ -0,0 +1 @@ +(57, 13) - SyntacticError: ERROR at or near "pool" \ No newline at end of file diff --git a/tests/parser/block4.cl b/tests/parser/block4.cl new file mode 100644 index 000000000..8fd883d02 --- /dev/null +++ b/tests/parser/block4.cl @@ -0,0 +1,88 @@ +(* A block has the form { ; ... ; } *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + pow: Int <- 1; + count: Int <- 0; + + testing6(a: Int): IO { + { + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + true++; -- Only expressions + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/block4_error.txt b/tests/parser/block4_error.txt new file mode 100644 index 000000000..ddbeb32ef --- /dev/null +++ b/tests/parser/block4_error.txt @@ -0,0 +1 @@ +(56, 26) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/case1.cl b/tests/parser/case1.cl new file mode 100644 index 000000000..c2f508809 --- /dev/null +++ b/tests/parser/case1.cl @@ -0,0 +1,91 @@ +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + -- Every case expression must have at least one branch + esac + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/case1_error.txt b/tests/parser/case1_error.txt new file mode 100644 index 000000000..61fca14f7 --- /dev/null +++ b/tests/parser/case1_error.txt @@ -0,0 +1 @@ +(63, 9) - SyntacticError: ERROR at or near ESAC \ No newline at end of file diff --git a/tests/parser/case2.cl b/tests/parser/case2.cl new file mode 100644 index 000000000..f9162e49f --- /dev/null +++ b/tests/parser/case2.cl @@ -0,0 +1,93 @@ +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case "2 + 2" of + x: Int => new IO.out_string("Es un entero!") -- Missing ";" + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/case2_error.txt b/tests/parser/case2_error.txt new file mode 100644 index 000000000..40b030dd9 --- /dev/null +++ b/tests/parser/case2_error.txt @@ -0,0 +1 @@ +(63, 13) - SyntacticError: ERROR at or near "y" \ No newline at end of file diff --git a/tests/parser/case3.cl b/tests/parser/case3.cl new file mode 100644 index 000000000..a7eedc18b --- /dev/null +++ b/tests/parser/case3.cl @@ -0,0 +1,93 @@ +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + false of + x: Int => new IO.out_string("Es un entero!"); + y: string => new IO.out_string("Es una cadena!"); -- Type identifiers starts with a uppercase letter + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/case3_error.txt b/tests/parser/case3_error.txt new file mode 100644 index 000000000..f25c5c563 --- /dev/null +++ b/tests/parser/case3_error.txt @@ -0,0 +1 @@ +(63, 16) - SyntacticError: ERROR at or near "string" \ No newline at end of file diff --git a/tests/parser/case4.cl b/tests/parser/case4.cl new file mode 100644 index 000000000..25ca3858f --- /dev/null +++ b/tests/parser/case4.cl @@ -0,0 +1,93 @@ +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case true of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + Mazinger_Z: Bool => new IO.out_string("Es un booleano!"); -- Identifiers starts with a lowercase letter + esac + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/case4_error.txt b/tests/parser/case4_error.txt new file mode 100644 index 000000000..c5a16ddec --- /dev/null +++ b/tests/parser/case4_error.txt @@ -0,0 +1 @@ +(64, 13) - SyntacticError: ERROR at or near "Mazinger_Z" \ No newline at end of file diff --git a/tests/parser/case5.cl b/tests/parser/case5.cl new file mode 100644 index 000000000..b36c663e1 --- /dev/null +++ b/tests/parser/case5.cl @@ -0,0 +1,93 @@ +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case test2 of + x: Int <- new IO.out_string("Es un entero!"); -- Must be '=>' not '<-'; + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/case5_error.txt b/tests/parser/case5_error.txt new file mode 100644 index 000000000..fc6ec0eda --- /dev/null +++ b/tests/parser/case5_error.txt @@ -0,0 +1 @@ +(62, 20) - SyntacticError: ERROR at or near ASSIGN \ No newline at end of file diff --git a/tests/parser/case6.cl b/tests/parser/case6.cl new file mode 100644 index 000000000..66e7df2ab --- /dev/null +++ b/tests/parser/case6.cl @@ -0,0 +1,93 @@ +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 -- Missing "of" + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/case6_error.txt b/tests/parser/case6_error.txt new file mode 100644 index 000000000..2ae2f723b --- /dev/null +++ b/tests/parser/case6_error.txt @@ -0,0 +1 @@ +(62, 13) - SyntacticError: ERROR at or near "x" \ No newline at end of file diff --git a/tests/parser/class1.cl b/tests/parser/class1.cl new file mode 100644 index 000000000..f4815e3f4 --- /dev/null +++ b/tests/parser/class1.cl @@ -0,0 +1,20 @@ +(* A class is a list of features *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + testing(): Int { + 2 + 2 + }; +}; + +-- Class names must begin with uppercase letters +class alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/class1_error.txt b/tests/parser/class1_error.txt new file mode 100644 index 000000000..acaa52a6e --- /dev/null +++ b/tests/parser/class1_error.txt @@ -0,0 +1 @@ +(16, 7) - SyntacticError: ERROR at or near "alpha" \ No newline at end of file diff --git a/tests/parser/class2.cl b/tests/parser/class2.cl new file mode 100644 index 000000000..f363b032a --- /dev/null +++ b/tests/parser/class2.cl @@ -0,0 +1,20 @@ +(* A class is a list of features *) + +CLaSS Main { + main(): Object { + (new Alpha).print() + }; +}; + +CLaSS Test { + testing(): Int { + 2 + 2 + }; +}; + +-- Type names must begin with uppercase letters +CLaSS Alpha iNHeRiTS iO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/class2_error.txt b/tests/parser/class2_error.txt new file mode 100644 index 000000000..59d065913 --- /dev/null +++ b/tests/parser/class2_error.txt @@ -0,0 +1 @@ +(16, 22) - SyntacticError: ERROR at or near "iO" \ No newline at end of file diff --git a/tests/parser/class3.cl b/tests/parser/class3.cl new file mode 100644 index 000000000..0c801372a --- /dev/null +++ b/tests/parser/class3.cl @@ -0,0 +1,34 @@ +(* A class is a list of features *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + -- Missing semicolon + testing2(a: Alpha, b: Int): Int { + 2 + 2 + } + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/class3_error.txt b/tests/parser/class3_error.txt new file mode 100644 index 000000000..bc2f946b2 --- /dev/null +++ b/tests/parser/class3_error.txt @@ -0,0 +1 @@ +(25, 5) - SyntacticError: ERROR at or near "testing3" \ No newline at end of file diff --git a/tests/parser/class4.cl b/tests/parser/class4.cl new file mode 100644 index 000000000..5c286b5e6 --- /dev/null +++ b/tests/parser/class4.cl @@ -0,0 +1,36 @@ +(* A class is a list of features *) + +CLaSS Main { + main(): Object { + (new Alpha).print() + }; +}; + +CLaSS Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + -- Only features + 2 + 2; + + testing3(): String { + "2 + 2" + }; +}; + +CLaSS Alpha iNHeRiTS IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/class4_error.txt b/tests/parser/class4_error.txt new file mode 100644 index 000000000..1007f033d --- /dev/null +++ b/tests/parser/class4_error.txt @@ -0,0 +1 @@ +(25, 5) - SyntacticError: ERROR at or near "2" \ No newline at end of file diff --git a/tests/parser/class5.cl b/tests/parser/class5.cl new file mode 100644 index 000000000..3f40c36eb --- /dev/null +++ b/tests/parser/class5.cl @@ -0,0 +1,34 @@ +(* A class is a list of features *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +-- Missing '{' +class Test + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/class5_error.txt b/tests/parser/class5_error.txt new file mode 100644 index 000000000..400e4d614 --- /dev/null +++ b/tests/parser/class5_error.txt @@ -0,0 +1 @@ +(11, 5) - SyntacticError: ERROR at or near "test1" \ No newline at end of file diff --git a/tests/parser/class6.cl b/tests/parser/class6.cl new file mode 100644 index 000000000..8501d2593 --- /dev/null +++ b/tests/parser/class6.cl @@ -0,0 +1,34 @@ +(* A class is a list of features *) + +CLaSS Main { + main(): Object { + (new Alpha).print() + }; +}; + +-- Missing '}' +CLaSS Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +; + +CLaSS Alpha iNHeRiTS IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/class6_error.txt b/tests/parser/class6_error.txt new file mode 100644 index 000000000..73574c94c --- /dev/null +++ b/tests/parser/class6_error.txt @@ -0,0 +1 @@ +(28, 1) - SyntacticError: ERROR at or near ";" \ No newline at end of file diff --git a/tests/parser/conditional1.cl b/tests/parser/conditional1.cl new file mode 100644 index 000000000..4d546fc44 --- /dev/null +++ b/tests/parser/conditional1.cl @@ -0,0 +1,69 @@ +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + if a.length() < b.length() -- Mising "then" + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + else + if a.length() = b.length() then + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + else + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fi + fi + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/conditional1_error.txt b/tests/parser/conditional1_error.txt new file mode 100644 index 000000000..ee533fd84 --- /dev/null +++ b/tests/parser/conditional1_error.txt @@ -0,0 +1 @@ +(34, 13) - SyntacticError: ERROR at or near NEW \ No newline at end of file diff --git a/tests/parser/conditional2.cl b/tests/parser/conditional2.cl new file mode 100644 index 000000000..4f10c2957 --- /dev/null +++ b/tests/parser/conditional2.cl @@ -0,0 +1,69 @@ +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + if a.length() < b.length() then + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + else + if a.length() = b.length() then + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + else + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + -- Missing "fi" + fi + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/conditional2_error.txt b/tests/parser/conditional2_error.txt new file mode 100644 index 000000000..c72f78d7e --- /dev/null +++ b/tests/parser/conditional2_error.txt @@ -0,0 +1 @@ +(42, 5) - SyntacticError: ERROR at or near "}" \ No newline at end of file diff --git a/tests/parser/conditional3.cl b/tests/parser/conditional3.cl new file mode 100644 index 000000000..67e991ade --- /dev/null +++ b/tests/parser/conditional3.cl @@ -0,0 +1,69 @@ +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + iF a.length() < b.length() tHen + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + elsE + if a.length() = b.length() then + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + eLseif -- elseif isn't a keyword + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/conditional3_error.txt b/tests/parser/conditional3_error.txt new file mode 100644 index 000000000..ad95552b5 --- /dev/null +++ b/tests/parser/conditional3_error.txt @@ -0,0 +1 @@ +(38, 13) - SyntacticError: ERROR at or near "eLseif" \ No newline at end of file diff --git a/tests/parser/conditional4.cl b/tests/parser/conditional4.cl new file mode 100644 index 000000000..0792fdc85 --- /dev/null +++ b/tests/parser/conditional4.cl @@ -0,0 +1,73 @@ +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(): Int { + if true++ then 1 else 0 -- Condition must be an expression + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/conditional4_error.txt b/tests/parser/conditional4_error.txt new file mode 100644 index 000000000..f5511445b --- /dev/null +++ b/tests/parser/conditional4_error.txt @@ -0,0 +1 @@ +(45, 17) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/conditional5.cl b/tests/parser/conditional5.cl new file mode 100644 index 000000000..0c1e1aad0 --- /dev/null +++ b/tests/parser/conditional5.cl @@ -0,0 +1,73 @@ +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(): Int { + if true then true++ else 0 -- If branch must be an expression + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/conditional5_error.txt b/tests/parser/conditional5_error.txt new file mode 100644 index 000000000..b3214010d --- /dev/null +++ b/tests/parser/conditional5_error.txt @@ -0,0 +1 @@ +(45, 27) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/conditional6.cl b/tests/parser/conditional6.cl new file mode 100644 index 000000000..02310404a --- /dev/null +++ b/tests/parser/conditional6.cl @@ -0,0 +1,73 @@ +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(): Int { + if true then 1 else false++ -- Else branch must be an expression + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/conditional6_error.txt b/tests/parser/conditional6_error.txt new file mode 100644 index 000000000..968b78ad9 --- /dev/null +++ b/tests/parser/conditional6_error.txt @@ -0,0 +1 @@ +(45, 35) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/dispatch1.cl b/tests/parser/dispatch1.cl new file mode 100644 index 000000000..2ca394716 --- /dev/null +++ b/tests/parser/dispatch1.cl @@ -0,0 +1,45 @@ +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + Test1.testing4(1, 2).testing4(3, 4).testing4(5, 6) -- Objet identifiers begin with a lower case letter + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/dispatch1_error.txt b/tests/parser/dispatch1_error.txt new file mode 100644 index 000000000..ba8e9e84c --- /dev/null +++ b/tests/parser/dispatch1_error.txt @@ -0,0 +1 @@ +(37, 9) - SyntacticError: ERROR at or near "Test1" \ No newline at end of file diff --git a/tests/parser/dispatch2.cl b/tests/parser/dispatch2.cl new file mode 100644 index 000000000..0b57467a1 --- /dev/null +++ b/tests/parser/dispatch2.cl @@ -0,0 +1,45 @@ +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13,) -- Extra comma + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/dispatch2_error.txt b/tests/parser/dispatch2_error.txt new file mode 100644 index 000000000..134e266b2 --- /dev/null +++ b/tests/parser/dispatch2_error.txt @@ -0,0 +1 @@ +(37, 84) - SyntacticError: ERROR at or near ")" \ No newline at end of file diff --git a/tests/parser/dispatch3.cl b/tests/parser/dispatch3.cl new file mode 100644 index 000000000..9f1a5afff --- /dev/null +++ b/tests/parser/dispatch3.cl @@ -0,0 +1,45 @@ +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).Testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) -- Identifiers begin with a lower case letter + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/dispatch3_error.txt b/tests/parser/dispatch3_error.txt new file mode 100644 index 000000000..86d2d5142 --- /dev/null +++ b/tests/parser/dispatch3_error.txt @@ -0,0 +1 @@ +(37, 38) - SyntacticError: ERROR at or near "Testing4" \ No newline at end of file diff --git a/tests/parser/dispatch4.cl b/tests/parser/dispatch4.cl new file mode 100644 index 000000000..d1efc469d --- /dev/null +++ b/tests/parser/dispatch4.cl @@ -0,0 +1,53 @@ +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + self.testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true++) -- Arguments must be expressions + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/dispatch4_error.txt b/tests/parser/dispatch4_error.txt new file mode 100644 index 000000000..d03bb4c53 --- /dev/null +++ b/tests/parser/dispatch4_error.txt @@ -0,0 +1 @@ +(45, 81) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/dispatch5.cl b/tests/parser/dispatch5.cl new file mode 100644 index 000000000..63a5afa79 --- /dev/null +++ b/tests/parser/dispatch5.cl @@ -0,0 +1,53 @@ +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, ,true + fALSE) -- Extra comma + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/dispatch5_error.txt b/tests/parser/dispatch5_error.txt new file mode 100644 index 000000000..3fc39c625 --- /dev/null +++ b/tests/parser/dispatch5_error.txt @@ -0,0 +1 @@ +(45, 71) - SyntacticError: ERROR at or near "," \ No newline at end of file diff --git a/tests/parser/dispatch6.cl b/tests/parser/dispatch6.cl new file mode 100644 index 000000000..0a953e2e6 --- /dev/null +++ b/tests/parser/dispatch6.cl @@ -0,0 +1,57 @@ +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@object.copy() -- Type identifiers begin with a upper case letter + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/dispatch6_error.txt b/tests/parser/dispatch6_error.txt new file mode 100644 index 000000000..543f3a38c --- /dev/null +++ b/tests/parser/dispatch6_error.txt @@ -0,0 +1 @@ +(49, 15) - SyntacticError: ERROR at or near "object" \ No newline at end of file diff --git a/tests/parser/dispatch7.cl b/tests/parser/dispatch7.cl new file mode 100644 index 000000000..3ecac4d0f --- /dev/null +++ b/tests/parser/dispatch7.cl @@ -0,0 +1,57 @@ +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.Copy() -- Identifiers begin with a lower case letter + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/dispatch7_error.txt b/tests/parser/dispatch7_error.txt new file mode 100644 index 000000000..27235d118 --- /dev/null +++ b/tests/parser/dispatch7_error.txt @@ -0,0 +1 @@ +(49, 22) - SyntacticError: ERROR at or near "Copy" \ No newline at end of file diff --git a/tests/parser/dispatch8.cl b/tests/parser/dispatch8.cl new file mode 100644 index 000000000..eef0455ef --- /dev/null +++ b/tests/parser/dispatch8.cl @@ -0,0 +1,57 @@ +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy(,) -- Extra comma + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/dispatch8_error.txt b/tests/parser/dispatch8_error.txt new file mode 100644 index 000000000..04704520a --- /dev/null +++ b/tests/parser/dispatch8_error.txt @@ -0,0 +1 @@ +(49, 27) - SyntacticError: ERROR at or near "," \ No newline at end of file diff --git a/tests/parser/dispatch9.cl b/tests/parser/dispatch9.cl new file mode 100644 index 000000000..5fdef22d6 --- /dev/null +++ b/tests/parser/dispatch9.cl @@ -0,0 +1,61 @@ +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; + + testing5(): Object { + test1:Object.copy() -- Must be '@' not ':' + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/dispatch9_error.txt b/tests/parser/dispatch9_error.txt new file mode 100644 index 000000000..eb0b3397d --- /dev/null +++ b/tests/parser/dispatch9_error.txt @@ -0,0 +1 @@ +(53, 14) - SyntacticError: ERROR at or near ":" \ No newline at end of file diff --git a/tests/parser/let1.cl b/tests/parser/let1.cl new file mode 100644 index 000000000..576ae383c --- /dev/null +++ b/tests/parser/let1.cl @@ -0,0 +1,85 @@ +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let Count: Int <- 0, pow: Int <- 1 -- Object identifiers starts with a lowercase letter + in { + -- count <- 0; + -- pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/let1_error.txt b/tests/parser/let1_error.txt new file mode 100644 index 000000000..8b7fe63d1 --- /dev/null +++ b/tests/parser/let1_error.txt @@ -0,0 +1 @@ +(45, 13) - SyntacticError: ERROR at or near "Count" \ No newline at end of file diff --git a/tests/parser/let2.cl b/tests/parser/let2.cl new file mode 100644 index 000000000..4cfaef0f8 --- /dev/null +++ b/tests/parser/let2.cl @@ -0,0 +1,85 @@ +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int, pow: int <- 1 -- Type identifiers starts with a uppercase letter + in { + count <- 0; + -- pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/let2_error.txt b/tests/parser/let2_error.txt new file mode 100644 index 000000000..6fb3f8e9c --- /dev/null +++ b/tests/parser/let2_error.txt @@ -0,0 +1 @@ +(45, 30) - SyntacticError: ERROR at or near "int" \ No newline at end of file diff --git a/tests/parser/let3.cl b/tests/parser/let3.cl new file mode 100644 index 000000000..91e567fd8 --- /dev/null +++ b/tests/parser/let3.cl @@ -0,0 +1,85 @@ +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int, pow: Int, -- Extra comma + in { + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/let3_error.txt b/tests/parser/let3_error.txt new file mode 100644 index 000000000..71fa08812 --- /dev/null +++ b/tests/parser/let3_error.txt @@ -0,0 +1 @@ +(46, 9) - SyntacticError: ERROR at or near IN \ No newline at end of file diff --git a/tests/parser/let4.cl b/tests/parser/let4.cl new file mode 100644 index 000000000..a716c332d --- /dev/null +++ b/tests/parser/let4.cl @@ -0,0 +1,85 @@ +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- true++, pow: Int <- 1 -- Initialization must be an expression + in { + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/let4_error.txt b/tests/parser/let4_error.txt new file mode 100644 index 000000000..e12c7478c --- /dev/null +++ b/tests/parser/let4_error.txt @@ -0,0 +1 @@ +(45, 32) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/let5.cl b/tests/parser/let5.cl new file mode 100644 index 000000000..d974cc138 --- /dev/null +++ b/tests/parser/let5.cl @@ -0,0 +1,85 @@ +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int = 0, pow: Int -- Must be '<-' not '=' + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/let5_error.txt b/tests/parser/let5_error.txt new file mode 100644 index 000000000..e561f846c --- /dev/null +++ b/tests/parser/let5_error.txt @@ -0,0 +1 @@ +(45, 24) - SyntacticError: ERROR at or near "=" \ No newline at end of file diff --git a/tests/parser/let6.cl b/tests/parser/let6.cl new file mode 100644 index 000000000..b6e51d7e1 --- /dev/null +++ b/tests/parser/let6.cl @@ -0,0 +1,74 @@ +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int <- 1 + in false++ -- Let body must be an expression + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/let6_error.txt b/tests/parser/let6_error.txt new file mode 100644 index 000000000..7a77928b9 --- /dev/null +++ b/tests/parser/let6_error.txt @@ -0,0 +1 @@ +(46, 18) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/let7.cl b/tests/parser/let7.cl new file mode 100644 index 000000000..6fd63e6a7 --- /dev/null +++ b/tests/parser/let7.cl @@ -0,0 +1,85 @@ +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + (* Missing "in" *) { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/let7_error.txt b/tests/parser/let7_error.txt new file mode 100644 index 000000000..654b1ce60 --- /dev/null +++ b/tests/parser/let7_error.txt @@ -0,0 +1 @@ +(46, 28) - SyntacticError: ERROR at or near "{" \ No newline at end of file diff --git a/tests/parser/loop1.cl b/tests/parser/loop1.cl new file mode 100644 index 000000000..7d0d7688f --- /dev/null +++ b/tests/parser/loop1.cl @@ -0,0 +1,78 @@ +(* A loop has the form while loop pool *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + count: Int <- 1; + + testing6(): Object { + while count < 1024*1024 + -- Missing "loop" + count <- count * 2 + pool + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/loop1_error.txt b/tests/parser/loop1_error.txt new file mode 100644 index 000000000..94248ff00 --- /dev/null +++ b/tests/parser/loop1_error.txt @@ -0,0 +1 @@ +(49, 13) - SyntacticError: ERROR at or near "count" \ No newline at end of file diff --git a/tests/parser/loop2.cl b/tests/parser/loop2.cl new file mode 100644 index 000000000..a9613c487 --- /dev/null +++ b/tests/parser/loop2.cl @@ -0,0 +1,78 @@ +(* A loop has the form while loop pool *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + count: Int <- 1; + + testing6(): Object { + while count < 1024*1024 + loop + count <- count * 2 + -- Missing "pool" + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/loop2_error.txt b/tests/parser/loop2_error.txt new file mode 100644 index 000000000..6447101f8 --- /dev/null +++ b/tests/parser/loop2_error.txt @@ -0,0 +1 @@ +(51, 5) - SyntacticError: ERROR at or near "}" \ No newline at end of file diff --git a/tests/parser/loop3.cl b/tests/parser/loop3.cl new file mode 100644 index 000000000..860adb4d1 --- /dev/null +++ b/tests/parser/loop3.cl @@ -0,0 +1,78 @@ +(* A loop has the form while loop pool *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + count: Int <- 1; + + testing6(): Object { + while count => 1024*1024 -- Condition must be an expression + loop + count <- count * 2 + pool + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/loop3_error.txt b/tests/parser/loop3_error.txt new file mode 100644 index 000000000..3da8bcde0 --- /dev/null +++ b/tests/parser/loop3_error.txt @@ -0,0 +1 @@ +(47, 21) - SyntacticError: ERROR at or near DARROW \ No newline at end of file diff --git a/tests/parser/loop4.cl b/tests/parser/loop4.cl new file mode 100644 index 000000000..0a1194e82 --- /dev/null +++ b/tests/parser/loop4.cl @@ -0,0 +1,78 @@ +(* A loop has the form while loop pool *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + count: Int <- 1; + + testing6(): Object { + while count < 1024*1024 + loop + count <- true++ -- While body must be an expression + pool + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/loop4_error.txt b/tests/parser/loop4_error.txt new file mode 100644 index 000000000..c39f35fe1 --- /dev/null +++ b/tests/parser/loop4_error.txt @@ -0,0 +1 @@ +(49, 27) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/method1.cl b/tests/parser/method1.cl new file mode 100644 index 000000000..fcfbbcd30 --- /dev/null +++ b/tests/parser/method1.cl @@ -0,0 +1,34 @@ +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + -- Method names must begin with lowercase letters + Testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/method1_error.txt b/tests/parser/method1_error.txt new file mode 100644 index 000000000..0eff41999 --- /dev/null +++ b/tests/parser/method1_error.txt @@ -0,0 +1 @@ +(21, 5) - SyntacticError: ERROR at or near "Testing2" \ No newline at end of file diff --git a/tests/parser/method2.cl b/tests/parser/method2.cl new file mode 100644 index 000000000..d5bdfd85c --- /dev/null +++ b/tests/parser/method2.cl @@ -0,0 +1,34 @@ +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + -- Parameter names must begin with lowercase letters + testing2(a: Alpha, B: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/method2_error.txt b/tests/parser/method2_error.txt new file mode 100644 index 000000000..1843fb7b4 --- /dev/null +++ b/tests/parser/method2_error.txt @@ -0,0 +1 @@ +(21, 24) - SyntacticError: ERROR at or near "B" \ No newline at end of file diff --git a/tests/parser/method3.cl b/tests/parser/method3.cl new file mode 100644 index 000000000..1e5c9eb53 --- /dev/null +++ b/tests/parser/method3.cl @@ -0,0 +1,34 @@ +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + -- Type names must begin with uppercase letters + testing2(a: Alpha, b: int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/method3_error.txt b/tests/parser/method3_error.txt new file mode 100644 index 000000000..dbecf552e --- /dev/null +++ b/tests/parser/method3_error.txt @@ -0,0 +1 @@ +(21, 27) - SyntacticError: ERROR at or near "int" \ No newline at end of file diff --git a/tests/parser/method4.cl b/tests/parser/method4.cl new file mode 100644 index 000000000..019ada276 --- /dev/null +++ b/tests/parser/method4.cl @@ -0,0 +1,34 @@ +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + -- Missing paremeter + testing3(x: Int,): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/method4_error.txt b/tests/parser/method4_error.txt new file mode 100644 index 000000000..6421cee2b --- /dev/null +++ b/tests/parser/method4_error.txt @@ -0,0 +1 @@ +(25, 21) - SyntacticError: ERROR at or near ")" \ No newline at end of file diff --git a/tests/parser/method5.cl b/tests/parser/method5.cl new file mode 100644 index 000000000..13127f664 --- /dev/null +++ b/tests/parser/method5.cl @@ -0,0 +1,34 @@ +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + -- Type names must begin with uppercase letters + testing3(): string { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/method5_error.txt b/tests/parser/method5_error.txt new file mode 100644 index 000000000..9bda07041 --- /dev/null +++ b/tests/parser/method5_error.txt @@ -0,0 +1 @@ +(25, 17) - SyntacticError: ERROR at or near "string" \ No newline at end of file diff --git a/tests/parser/method6.cl b/tests/parser/method6.cl new file mode 100644 index 000000000..d48cd1293 --- /dev/null +++ b/tests/parser/method6.cl @@ -0,0 +1,33 @@ +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + -- Body can't be empty + testing2(a: Alpha, b: Int): Int { + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/method6_error.txt b/tests/parser/method6_error.txt new file mode 100644 index 000000000..e7d5de400 --- /dev/null +++ b/tests/parser/method6_error.txt @@ -0,0 +1 @@ +(22, 5) - SyntacticError: ERROR at or near "}" \ No newline at end of file diff --git a/tests/parser/mixed1.cl b/tests/parser/mixed1.cl new file mode 100644 index 000000000..a27879513 --- /dev/null +++ b/tests/parser/mixed1.cl @@ -0,0 +1,100 @@ +(* Cool has four binary arithmetic operations: +, -, *, /. *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; + + a: Int <- 1; + + testing8(x: Int, y: Int): Bool { + let z: Int <- 3, w: Int <- 4 + in isvoid (3 + a * (x / w + new Int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) + }; +}-- Mising ";" + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/mixed1_error.txt b/tests/parser/mixed1_error.txt new file mode 100644 index 000000000..d5b0ff8bb --- /dev/null +++ b/tests/parser/mixed1_error.txt @@ -0,0 +1 @@ +(76, 1) - SyntacticError: ERROR at or near CLASS \ No newline at end of file diff --git a/tests/parser/mixed2.cl b/tests/parser/mixed2.cl new file mode 100644 index 000000000..f5477e0bb --- /dev/null +++ b/tests/parser/mixed2.cl @@ -0,0 +1,14 @@ +class Main { + main(): Object { + (new Alpha).print() + }; + +}; + +(* Class names must begin with uppercase letters *) +class alpha inherits IO { + print() : Object { + out_string("reached!!\n"); + }; +}; + diff --git a/tests/parser/mixed2_error.txt b/tests/parser/mixed2_error.txt new file mode 100644 index 000000000..b5613c52a --- /dev/null +++ b/tests/parser/mixed2_error.txt @@ -0,0 +1 @@ +(9, 7) - SyntacticError: ERROR at or near "alpha" \ No newline at end of file diff --git a/tests/parser/mixed3.cl b/tests/parser/mixed3.cl new file mode 100644 index 000000000..1bdcad743 --- /dev/null +++ b/tests/parser/mixed3.cl @@ -0,0 +1,40 @@ +class Main inherits IO { + main() : Object { + { + out_string("Enter a number to check if number is prime\n"); + let i : Int <- in_int() in { + if(i <= 1) then { + out_string("Invalid Input\n"); + abort(); + } else { + if (isPrime(i) = 1) then + out_string("Number is prime\n") + else + out_string("Number is composite\n") + fi; + } + fi; + }; + } + }; + + mod(i : Int, ) : Int { -- Formal list must be comma separated. A comma does not terminate a list of formals. + i - (i/k)*k + }; + + isPrime(i : Int) : Int { + { + let x : Int <- 2, + c : Int <- 1 in + { + while (not (x = i)) loop + if (mod(i, x) = 0) then { + c <- 0; + x <- i; + } else x <- x + 1 fi + pool; + c; + }; + } + }; +}; diff --git a/tests/parser/mixed3_error.txt b/tests/parser/mixed3_error.txt new file mode 100644 index 000000000..159bdca63 --- /dev/null +++ b/tests/parser/mixed3_error.txt @@ -0,0 +1 @@ +(21, 18) - SyntacticError: ERROR at or near ")" \ No newline at end of file diff --git a/tests/parser/mixed4.cl b/tests/parser/mixed4.cl new file mode 100644 index 000000000..e752253be --- /dev/null +++ b/tests/parser/mixed4.cl @@ -0,0 +1,21 @@ +class Main inherits IO { + main() : Object { + { + out_string("Enter number of numbers to multiply\n"); + out_int(prod(in_int())); + out_string("\n"); + } + }; + + prod(i : Int) : Int { + let y : Int <- 1 in { + while (not (i = 0) ) loop { + out_string("Enter Number: "); + y <- y * in_int(Main : Int); -- the parser correctly catches the error here + i <- i - 1; + } + pool; + y; + } + }; +}; diff --git a/tests/parser/mixed4_error.txt b/tests/parser/mixed4_error.txt new file mode 100644 index 000000000..2349f28a5 --- /dev/null +++ b/tests/parser/mixed4_error.txt @@ -0,0 +1 @@ +(14, 41) - SyntacticError: ERROR at or near "Main" \ No newline at end of file diff --git a/tests/parser/mixed5.cl b/tests/parser/mixed5.cl new file mode 100644 index 000000000..c9176a890 --- /dev/null +++ b/tests/parser/mixed5.cl @@ -0,0 +1,20 @@ +class Main inherits IO { + str <- "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; + main() : Object { + { + out_string("Enter number of numbers to multiply\n"); + out_int(prod(in_int())); + out_string("\n"); + } + }; + prod(i : Int) : Int { + let y : Int <- 1 in { + while (not (i = 0) ) loop { + out_string("Enter Number: "); + y <- y * in_int(); + i <- i - 1; + } + y; + } + }; +} diff --git a/tests/parser/mixed5_error.txt b/tests/parser/mixed5_error.txt new file mode 100644 index 000000000..443037eca --- /dev/null +++ b/tests/parser/mixed5_error.txt @@ -0,0 +1 @@ +(2, 9) - SyntacticError: ERROR at or near ASSIGN \ No newline at end of file diff --git a/tests/parser/mixed6.cl b/tests/parser/mixed6.cl new file mode 100644 index 000000000..5da80da31 --- /dev/null +++ b/tests/parser/mixed6.cl @@ -0,0 +1,5 @@ +classs Doom { + i : Int <- 0; + main() : Object { + if i = 0 then out_string("This is da real *h*t") + diff --git a/tests/parser/mixed6_error.txt b/tests/parser/mixed6_error.txt new file mode 100644 index 000000000..af75ca925 --- /dev/null +++ b/tests/parser/mixed6_error.txt @@ -0,0 +1 @@ +(1, 1) - SyntacticError: ERROR at or near "classs" \ No newline at end of file diff --git a/tests/parser/operation1.cl b/tests/parser/operation1.cl new file mode 100644 index 000000000..d38eb72d0 --- /dev/null +++ b/tests/parser/operation1.cl @@ -0,0 +1,101 @@ +(* Cool has four binary arithmetic operations: +, -, *, /. *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; + + a: Int <- 1; + + testing8(x: Int, y: Int): Bool { + let z: Int <- 3, w: Int <- 4 + -- Missing ')' + in isvoid (3 + a * (x / w + new Int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a)/(0)*(((4 * 4))))) + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/operation1_error.txt b/tests/parser/operation1_error.txt new file mode 100644 index 000000000..b30202399 --- /dev/null +++ b/tests/parser/operation1_error.txt @@ -0,0 +1 @@ +(74, 5) - SyntacticError: ERROR at or near "}" \ No newline at end of file diff --git a/tests/parser/operation2.cl b/tests/parser/operation2.cl new file mode 100644 index 000000000..2dc628359 --- /dev/null +++ b/tests/parser/operation2.cl @@ -0,0 +1,101 @@ +(* Cool has four binary arithmetic operations: +, -, *, /. *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; + + a: Int <- 1; + + testing8(x: Int, y: Int): Bool { + let z: Int <- 3, w: Int <- 4 + -- Type identifiers starts with a uppercase letter + in isvoid (3 + a * (x / w + new int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/operation2_error.txt b/tests/parser/operation2_error.txt new file mode 100644 index 000000000..37b458f3a --- /dev/null +++ b/tests/parser/operation2_error.txt @@ -0,0 +1 @@ +(73, 41) - SyntacticError: ERROR at or near "int" \ No newline at end of file diff --git a/tests/parser/operation3.cl b/tests/parser/operation3.cl new file mode 100644 index 000000000..61d6cbfa8 --- /dev/null +++ b/tests/parser/operation3.cl @@ -0,0 +1,101 @@ +(* Cool has four binary arithmetic operations: +, -, *, /. *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; + + a: Int <- 1; + + testing8(x: Int, y: Int): Bool { + let z: Int <- 3, w: Int <- 4 + -- Object identifiers starts with a lowercase letter + in isvoid (3 + a * (x / w + new Int) - y - (((if tRue = not faLSe then ~Mazinger_Z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/operation3_error.txt b/tests/parser/operation3_error.txt new file mode 100644 index 000000000..6b266f3f3 --- /dev/null +++ b/tests/parser/operation3_error.txt @@ -0,0 +1 @@ +(73, 81) - SyntacticError: ERROR at or near "Mazinger_Z" \ No newline at end of file diff --git a/tests/parser/operation4.cl b/tests/parser/operation4.cl new file mode 100644 index 000000000..bae7de5b5 --- /dev/null +++ b/tests/parser/operation4.cl @@ -0,0 +1,101 @@ +(* Cool has four binary arithmetic operations: +, -, *, /. *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; + + a: Int <- 1; + + testing8(x: Int, y: Int): Bool { + let z: Int <- 3, w: Int <- 4 + -- Double "+" + in isvoid (3 + a * (x / w++ new Int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/operation4_error.txt b/tests/parser/operation4_error.txt new file mode 100644 index 000000000..e0ebb0985 --- /dev/null +++ b/tests/parser/operation4_error.txt @@ -0,0 +1 @@ +(73, 35) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/program1.cl b/tests/parser/program1.cl new file mode 100644 index 000000000..8e5cf617f --- /dev/null +++ b/tests/parser/program1.cl @@ -0,0 +1 @@ +(* A Cool program can't be empty *) \ No newline at end of file diff --git a/tests/parser/program1_error.txt b/tests/parser/program1_error.txt new file mode 100644 index 000000000..de00ac46b --- /dev/null +++ b/tests/parser/program1_error.txt @@ -0,0 +1 @@ +(0, 0) - SyntacticError: ERROR at or near EOF \ No newline at end of file diff --git a/tests/parser/program2.cl b/tests/parser/program2.cl new file mode 100644 index 000000000..f8b16779c --- /dev/null +++ b/tests/parser/program2.cl @@ -0,0 +1,20 @@ +(* Cool programs are sets of classes *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +-- Missing semicolon +class Test { + testing(): Int { + 2 + 2 + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/program2_error.txt b/tests/parser/program2_error.txt new file mode 100644 index 000000000..94ba8df65 --- /dev/null +++ b/tests/parser/program2_error.txt @@ -0,0 +1 @@ +(16, 1) - SyntacticError: ERROR at or near CLASS \ No newline at end of file diff --git a/tests/parser/program3.cl b/tests/parser/program3.cl new file mode 100644 index 000000000..e27889c57 --- /dev/null +++ b/tests/parser/program3.cl @@ -0,0 +1,24 @@ +(* Cool programs are sets of classes *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + testing(): Int { + 2 + 2 + }; +}; + +-- Only classes +suma(a: Int, b: Int) int { + a + b +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/program3_error.txt b/tests/parser/program3_error.txt new file mode 100644 index 000000000..dd3b3947a --- /dev/null +++ b/tests/parser/program3_error.txt @@ -0,0 +1 @@ +(16, 1) - SyntacticError: ERROR at or near "suma" \ No newline at end of file diff --git a/tests/parser_test.py b/tests/parser_test.py new file mode 100644 index 000000000..129c0f20a --- /dev/null +++ b/tests/parser_test.py @@ -0,0 +1,13 @@ +import pytest +import os +from utils import compare_errors + +tests_dir = __file__.rpartition('/')[0] + '/parser/' +tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] + +@pytest.mark.parser +@pytest.mark.error +@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 diff --git a/tests/semantic/hello_world.cl b/tests/semantic/hello_world.cl new file mode 100755 index 000000000..0c818f908 --- /dev/null +++ b/tests/semantic/hello_world.cl @@ -0,0 +1,5 @@ +class Main inherits IO { + main(): IO { + out_string("Hello, World.\n") + }; +}; diff --git a/tests/semantic_test.py b/tests/semantic_test.py new file mode 100644 index 000000000..6c71f8963 --- /dev/null +++ b/tests/semantic_test.py @@ -0,0 +1,13 @@ +import pytest +import os +from utils import compare_errors + +tests_dir = __file__.rpartition('/')[0] + '/semantic/' +tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] + +@pytest.mark.semantic +@pytest.mark.error +@pytest.mark.run(order=3) +@pytest.mark.parametrize("cool_file", []) +def test_semantic_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 diff --git a/tests/utils/__init__.py b/tests/utils/__init__.py new file mode 100644 index 000000000..90f60fdd8 --- /dev/null +++ b/tests/utils/__init__.py @@ -0,0 +1 @@ +from .utils import * \ No newline at end of file diff --git a/tests/utils/utils.py b/tests/utils/utils.py new file mode 100644 index 000000000..9d58ac3f5 --- /dev/null +++ b/tests/utils/utils.py @@ -0,0 +1,56 @@ +import subprocess +import re + + +COMPILER_TIMEOUT = 'El compilador tarda mucho en responder.' +TEST_MUST_FAIL = 'El test %s debe fallar al compilar' +TEST_MUST_COMPILE = 'El test %s debe compilar' +BAD_ERROR_FORMAT = '''El error no esta en formato: (,) - : + o no se encuentra en la 3ra linea''' +UNEXPECTED_ERROR = 'Se esperaba un %s en (%d, %d). Su error fue un %s en (%d, %d)' + +ERROR_FORMAT = r'^\s*\(\s*(\d+)\s*,\s*(\d+)\s*\)\s*-\s*(\w+)\s*:(.*)$' + +def parse_error(error: str): + merror = re.fullmatch(ERROR_FORMAT, error) + assert merror, BAD_ERROR_FORMAT + + return (t(x) for t, x in zip([int, int, str, str], merror.groups())) + + +def first_error(compiler_output: list, errors: list): + line, column, error_type, _ = parse_error(errors[0]) + + oline, ocolumn, oerror_type, _ = parse_error(compiler_output[0]) + + assert line == oline and column == ocolumn and error_type == oerror_type,\ + UNEXPECTED_ERROR % (error_type, line, column, oerror_type, oline, ocolumn) + + +def get_file_name(path: str): + try: + return path[path.rindex('/') + 1:] + except ValueError: + return path + +def compare_errors(compiler_path: str, cool_file_path: str, error_file_path: str, cmp=first_error, timeout=100): + try: + sp = subprocess.run(['bash', compiler_path, cool_file_path], capture_output=True, timeout=timeout) + return_code, output = sp.returncode, sp.stdout.decode() + except TimeoutError: + assert False, COMPILER_TIMEOUT + + compiler_output = output.split('\n') + + if error_file_path: + assert return_code == 1, TEST_MUST_FAIL % get_file_name(cool_file_path) + + fd = open(error_file_path, 'r') + errors = fd.read().split('\n') + fd.close() + + # checking the errors of compiler + cmp(compiler_output[2:], errors) + else: + print(return_code, output) + assert return_code == 0, TEST_MUST_COMPILE % get_file_name(cool_file_path) \ No newline at end of file From 8622d9490bab2731d1a924fe644f748e0fc23411 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Fri, 24 Apr 2020 10:44:51 -0400 Subject: [PATCH 012/143] Lexical error detection functional; Improved parser generation process; Better serialization of lexer and parser; Improved grammar API; --- .gitignore | 5 +- build.py | 11 - cmp/__pycache__/automata.cpython-37.pyc | Bin 5391 -> 5391 bytes cmp/__pycache__/pycompiler.cpython-37.pyc | Bin 17385 -> 21851 bytes cmp/parsing/__init__.py | 2 - .../__pycache__/__init__.cpython-37.pyc | Bin 288 -> 145 bytes .../__pycache__/parsing.cpython-37.pyc | Bin 10392 -> 10862 bytes cmp/parsing/lexing.py | 115 +- cmp/parsing/parsing.py | 299 +-- cmp/parsing/serialization.py | 113 ++ cmp/parsing/serializer.py | 74 - cmp/pycompiler.py | 337 ++-- grammar.py | 109 +- lexer.py | 93 +- main.py | 10 - output.txt | 2 + parser.py | 1659 ++++++++--------- scripts/{main.cool => main.cl} | 0 tester.py | 5 +- tests/codegen_test.py | 4 +- tests/conftest.py | 3 +- tests/lexer_test.py | 9 +- tests/parser_test.py | 9 +- tests/semantic_test.py | 9 +- 24 files changed, 1490 insertions(+), 1378 deletions(-) delete mode 100644 build.py create mode 100644 cmp/parsing/serialization.py delete mode 100644 cmp/parsing/serializer.py create mode 100644 output.txt rename scripts/{main.cool => main.cl} (100%) diff --git a/.gitignore b/.gitignore index 803769ed1..4b22d3092 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ ### Python template # Byte-compiled / optimized / DLL files __pycache__/ -*.py[cod] *$py.class # C extensions @@ -126,3 +125,7 @@ dmypy.json .idea .vscode +tests +scripts +Sera borrado Untitled.ipynb +Sera borrado output.txt diff --git a/build.py b/build.py deleted file mode 100644 index 20ab2a99e..000000000 --- a/build.py +++ /dev/null @@ -1,11 +0,0 @@ -from grammar import cool_parser -from cmp.parsing.serializer import LRParserSerializer - -PARSER_SETTINGS = { - 'parser': cool_parser(), - 'class': 'CoolParser', - 'file': 'parser.py', -} - -if __name__ == '__main__': - LRParserSerializer.build(**PARSER_SETTINGS) diff --git a/cmp/__pycache__/automata.cpython-37.pyc b/cmp/__pycache__/automata.cpython-37.pyc index d9c0bada3bd960ce2c4ca38a2db984d739753752..c8a8ac1793006248c238ae686e4e8c0507fb77a5 100644 GIT binary patch delta 158 zcmeCz>eu3S;^pOH0D^-G^EYxUa5CQ7ti#E}#Hhd7k~@xx(Qxt%-c&}@&Hs4S85u1% ztMNNCGTKkh68OmIyg5ejDWkLpP-_t{kkDi);s;W<*vm4DGfPraip(d+2v1>jp8Qc* qm{D&stB4|_#bk96Srt2w4hIn71R`8Oge!<}2N9ki!eerV$Z`O~O(aPG delta 158 zcmeCz>eu3S;^pOH0D`Z9Gd6N7a56@1*5Tw~V$|Dg$sNbUXfSyOZz`k7=6}5EjEokW z)%cwm8SN%#34CO9+8iVJlu_CpsI`a}NNBPY@dK$_>}8q7nI)+yMP`#@gr_h%P5vk> q%&0q=RYZ}|e6qTTtcop2hdqdJ1QE_4!UaUQfd~%};XXM-WH|t@RwNVv diff --git a/cmp/__pycache__/pycompiler.cpython-37.pyc b/cmp/__pycache__/pycompiler.cpython-37.pyc index 4e050644f4b6cb1b1fc1890f19c11d1369b8d45b..ce919ec9992b80488556eedc7d8914dc734ba029 100644 GIT binary patch literal 21851 zcmcJ1dyE`MdSAchxwEsg%jJ?wQq+i|M6Qln%4gkO!sGEMQKZDPydt=SbRJtb8gBP4 zXLlaU>RySQ4CC{WjwHvC?-0OGIkyag7=9%V4sa6NK#%|d{I4AZ2s%K3Jdoh>j~xW? z9|D5p_xq|}GdoL4Cuhj6?&_+puj;GsRbPFzFHcXG4g7BYuYdTh@4svq|CO2em&3zF zT>dfBFkHhmJ4Qp_&4!7*)v>yE!|pl_r<-f!y7@-FTWA!z#YVAPYLraYwL9hRRAZ`J zX;dWdbf&x2MzuTBm@$o44L9fJ9~f@ltKGL7v&a|RBJ#!iR$~sil3PZu?9HL{0P<6A z1^J5P=aHXwtH@Wqd6XYSe#WgKUz7X-^0V$7@^fhI5ON3HdF1AiJB-{xcLBKtZ{9m} z-)Su3%^~+N-W*2x5#$!#Bgh>=?kI9c-DAidL+%)IPq@dCJC58FuDNO~J^4f8Y-Ons zIBy7wN_#C>vclZ! z-W^Y&W`E1;AwT!}^=mEVdur8F?N+BfK;ewkNnflHbo{fU2mcrzJcHBJu--S;P1kg- z2gQc{zTp@R2VJ(q%B!l??Y7iqrTS_OQ!GCVDO)Mv@{b@1jQhr}IW!-drZGf2i^kAs zTCRaMtQE!2&{odh*+$=r&1SpT4w}u-3A{TTk>h)v_0Val4S&fDOU>q5r{(+2=5HIH zymUi&Z>g+Yuzw509egEvWyTPq~@9bK?-#NS1-9Ed0cdg&uZg)JjynR>A z03b=$caRun#T*>Wj$=9Q!BURB>9x8ZdQ)yTyM1@3!{%qP`j@x;cBkKCfneCM2DJ!AQaBk%9-j=2&1hJri~=(^2~MHe z^aIsw9!{W`gK9DoDH?&1AdwUo5Q=%9{7&?Rj`FtEqo9HQSf$xKngN$0PM56_27kPB z;skMZJOG{|A8+Y?N$s{^qx$U=me$eWzd5Y{B7FWGq;2|59Zrt7W zgu5}>L`RtG2e&*mHoGCP(sJEq^Ej&b#HL}E&9arjj1*7q=}A;idU`mp0+8B$h>MB6 zRVPqeJ&h!+#NDL8RBR>cqL$_P5Bc&@bO=mz zyk4`pL^v`rS^AKom8FVWU^9o9kdQ(f1JHt`xUKq-gTY-zT&gFTJjLW$Ca0M^$0Qw{ zJc)ea$PaUsd9_FQ#8Nj!4biep;F>tACIrxYrl+YCikXSsWo7B|FJsyh5?vXZ z>V?4i0IZbaYiRB|4~66m=4X@|j*;W_6%=Xy0V+@`hB^uZS&F1p?PJgY{ z@h>bVpD6Obm^PoUcj_$Lc>&3u4yqr++n>M{ckRNPuS zN(;MFXYdq>_)~RMJO%M{YN@Ja>le^uSiY8UoEEk@f4kET1ZQF4^0n2gufMSpRw>m} z7+QPe0x?o;$hxrlk`L39d@D*sgtR)v(Ks62l+>ZQEh8KetDFL=6+y5}=mor?T5-%1 zRuxv8W0lSLUY2~ttXVa)Xr8ueR^42%iWX~CsEW)vJPi&^n7m|uDA{>k!X;M9r!hOq zSN&MnHTj)L4{NZH1(a5KEUX(NI7nr@U}O5KpJ{e218y<%etEPON5tQcGCEN~8~8XL z*1=IYk-@c89#dx`wADF$sLn9?DwFd}M5itCDH&TVt3`u7k0M?^t)-$_$raC3pv4s5 zalpxs(wV;z?G;354`>Cj(?I17u%n zq(IXo`5CG4YxuB3XhkGNbKVwOXDjQu4v^_{pmjGg&CW537>tQFhU;yW=Kc5G9- za9e$Bx>&zsMW1tvlA|^4U`;PBDy-?nHH9_3xTLVA7grS4^x}kSOnDXgicTn}F|A!s zjjA`}irWcRdCffvi~N}A?}Y703nbWA*~ODc0xYj#1j0h1@rrd97WiB(a-EvEY3xxW zi;eiaQX^|Tlrj0w#*{1|mLxMY!M1`pr9~DN zeDP-Zp>wO{--$6|v$7}@@SIfZCYeO^4D=*kly%ECavMqf%~GGcCIH7|zT$OtIH zWCVXBJA$n90b~|%HFJi2$3h=OCd>TEJ%5_rr@5%dKyr!}JI!VvVG!ZR$ zn$n){S>-2FO(74gg9)^I##B@s`^@oED0)ax(Hv*#De}sYj`-s}nOgeCTrSFlzvhjY z(-w?f`yu^L*2=(s#;?OZPRLACdk!{wdwZYm&`t1EW1yqL#v>p{E5S*SbM2n%jSHx7s@dG|0(Pp|{QV5%`3&Tw!eqb|e8vG<x}2p?IsR4s|8jNUT4ic2d^)JlFN;fuI@w!W`km(3_> zbn%iwm(wR!)`BvY2Qfd02BslLQLpuGvUUia4mW|yO+S)cek}L)Q*VF5uCZw-oP;gt z7)>$%LNScn0^= zTz`r>spb;*#^6BAEYVC-dtr}oBDV-2;f&J+DFmM;vb?4${bPcmt^?`QHEe6@#Eaxd z*5=P&N0KG=kIl@|+Sc1p4JRV@$Q}H61J;|;CM-qkL&3g!PH10gen38o0gxyIT=kZWEB(Y}UpMN7<- zZ1x!r3G6@e^9lIUyu>l^$NR+b@a3b%Ly`2KaK#`p7!&h(geXQJ47KT|8{c2Kica~@ zlOc#@I|6|uCv#3kuI0hH7_E8>R5<-D6g`T+shj>Au6Rh*lnC}{aw1mXkx98a6NA)R z38}{S*XE-7{znEzh73NX9)F|jr|l0L^yGF zwNfWi#ufG>ybi?ipWzbrFPd|rt5dD5SWd!Deg!;T#O2>al8CW6&-SpV<>g&#!}JR4 z)}pb9Ad`>bFLZMca*d)_l65)O0a$An-O>XC`{!kM3ipazai?*|%G{m7z3SH7S=?vD z5IUf!F;>Fjb%Y5}U^7CZ*Y7pK7qT4|7GrgeonO>hiv=z3$+Q!P+1>V`oh-v)IodD{ zy!9Z=srJULKz$39V_*8u;90%Rgl|($PB-BH67RL*wes8nJCJ($A0zKbi?k{?HBxWT(vxfa}&mv@j}SVRY_m^=D`dHBm?U zun%}r-6sinb1;_yA8p}(cHqxn_;kQY?f)kOd=$?UgfgWVY1gM>;=t)f;oy0Xt%}DF znhZvn8~HhkduI3%*3Joh8e2R4I$*=v*|fGSd4>tNX~&BfN3pIDduAFQA#Ta&4!cDf zhkZIbG8cOU;0PU{OF#p=vu?#Jb6dn<26lGuE>-PZ3luV7M`uCHM9T2mxY*)ugErpC zn2K^F%=d3@BDg5yM<#)1_UA>or6Mi0ywVO)Jp2VNy+3cA$VL0}Sb+#ON2C`y?jkFn z!4MMZC9XR75x)o-CQ{5RK#JwOBKK=4$soO)k0Ht2JY-opGR>w?w}O%q>$qja64A#< zui=lQgg(P6D3gz)#u@i{d4AGecF&@`?!Msu817HGHcZK{hy^*B zyD1|j&OoQ8jy!NdWKBD8B<{p$=7N0mR0xXEQ&H-a+N@cYbP7a?(#@P}e$23_N@PMo zIK2!g>g!0BrqwcT;dE9F_+cs52!2>W;Ef8J(PHTWE9Wj>zy8K`(P!#Kw)7I;9_)B` z+Sp}o${qj~?mZXrY+*HSs!5IFhcnyB#%gt0kbm%< zF@{Iy2DK<;EYTAyP&@QyK@)i!aGZP#&*}=2M61ygK?b^n%O4^^j0Bu!_u%#O=L5t6 zat~jeLDp8mUk+>+BIh@ti+|IW-F@etGql{?R#CkcIJ-G6zV2CW{+@&BfkZ%jKo00H z>=uVPS(Y(}7S1zD%^BM3(3_hj$>%^7h1Op}{FLj_?~?Lbfmd(UWBkdEIbxgYQ7Byf zy>@V`-VXe_^89VEe*0Yyj~hFkmZ~!>!1I0VYnPK2uddg7{eV@xJN33--@pgGI$D%u z!l!`H>C|s}tW(G4I$}CIb%x{B`|I-VMr1dPz+mM`FkG*`-9i+fZlT-v12)~Nzbioj z+Y%93Z@cg(wAb67O51!1orsa(>ruC4BzgcER@_wtdv1Adz2(>6iF)k6QwJ&Pakc|J zrduuGs#U)Q6U9>qLTL9@JGfhK_Y!2ukQu3pv8?qs5b+6I)>}9G_>g51W#*rWn?^0f z5xfh?z8As3;QYP{@apDWjX|%sff= zi7~jo)05DnwCcGO)930~#qB8(r0r9L#?RH`HtRvZu31^e&{C?63F9C@nGE5ryE_Wq zj7BID00`}`f%-B~^=`tsdO|TVnGedByW2oL$!buFi|d1<^;QQQ;1U(T9BL z-K6s)qG=j6pT805yGM(smBG@bR*$MS!dJJC(6#_lwBGMQDbSvZ@V2~E)YQ2J8c8LX zgcB(ttD7vK=!zH7DaG|!L@L&a&~S}3oVDeyl8g_dk}(yFsxpLC8A6NEXJvD6I7{5w zPe+_gq-Ik0|6gGc0K(&i!A8uQ5C&)V>-}GYK$smzroSFThEQ1C7cx$Plv68r4;n=% zaFd2x8JlM6wa+|L6VTp=33@(RU+46Sk_NlhX1DlMM-mIRcllzJB-EGiuFZba+%+U3 zaj=l>`-HA?rjr?e7MTEh;jX!Xz>CNqWzp6CK71b%F;cl_4Y_leYjpuB;h^ghLjY-$ zwI*EHQ%ak*T@S}#XqvTBn+amb)xn`Y?T9F>fIS9F zGBQlkinM21LC{*eC1Nb@3_wOkR4Tk;6D7LS>WkXP(pO7bxk)vYBT&Tkl zb6$%^9~L2dOG8jB_V;eVlCJyPEtp6bPG!av%cOnKMfmAB5*(|a#`Hjs(S}LP3(g;} z1Gs$B%Lm3TJXR0QpFzwtqL#6$*@X&Ul(o*#;`0#e^RFTwEfNRT^A|u>)S4oppzFj+ za&EyWzpU4g7_5#FbiQTtG6!FIoa=4h6?NgF_0QW2I5@;?iSW}by`_?)Z zg0B6ba?c)8)jF;6UnkMW8d*qQ6f4bao{O7cS7((V2_#;frOU<)f$7ST>Cf7F=@czU zVz`+Pel&_4Cq^Jguq(t!TlWKN7X%3+G#=Wi_s~>g3TjG@O)D|aM+r=k1U}?EN9OI* z@hrz9m_$@ghNwztK$Ve<=u`ofl2>Hgr5zCBF2*o^HYK#vcIteHi=hGvkq2Z%{aF;Y_lcc;2-ceD~0Trvn}flsSjs|3KujmKN}TtfCEm8Er1- zRtDDUsT+wT;^gyM#U+e6q_5muk+FeN*pu;b7SDHD-J5Rf!mr`W|BVX9;0y5_w{|wV z3^{O{8`{`RCp-QM$0Fz3esfRF&{^x_bfrs(G&IC_g%~s;FNTY%i%3FqwPCHUj`wMH zPjlZR{%iOGA!x9r=!U8wrXNxKsbw(U*#s@5gM=0u$Z)$Djwi7PAdJnXSO8pO;hCnr z6FtKRxCvKNlg=c#nVRqfZWeGa;EsbbO?v!FQC&Ef1ld?E9|a6?^{JoZ(@iF8OavV- z@`(#fapj328WZA0z8y0u*u?iae7>hYt|I@iVK4tG)*wE3yDTWbh+2u)jr2!TL}-u= z1hVi2Ggw&3IH^Fe6gM=(+|8YK$BkGuEbGIylyl*Mhy>z;uk!L>{PNuv&J*JdvK){d z8$mb&Z;d`}jMH%N^86l0!wG?5cPOT{u{uA>2&T}YdVplf3GiYjQ>6(?=>f@CX!YZK21iJ%dHb7Q)u7D_T_UrBQ!r$07xo6|ObLR*++Q$1D zJeAI_Gt6y@r}Fm6x42>@$2)W$bA5Tc@)nN6L+w#!zlTnZbw_=KcmF2s2X|Pp za=Z~O9N}3{AE&M*=B*D76|-J;4aGothmGGr5;`j&_LO5ohvNxz?oM~xN2ra6FZuXy z@{{+N++p$pKQ`U59)^WLW8??yr8v|fvnp5*GObzjIJ;Cunx! zKR}|z5?uO-fu(F_D9@(dHa|4(93O%e7RgX^U??&QSOkY3t@8$1N6KM0N;!5Wu{8h} z4a#klzk>1$_#OukQT|0LRyPMjJcsgJ4kme!7f%~Q?~5qI#u?e`Bjc;+8oqalMKD)s zMaSKI7hP4q#N>NS{w|VaOyo1pmRMetGs0&To;c)r!wjbhkwko^=vaX5U}Jkm6OWkJ zAK~qPNhy1fSo7lINnUXg-ICkeCpXFA~FunBwdUO}~PN zyU*P%lcI^IRUk1ix60~S6Sj;=0f<@W`)?X=8NK3`&7<)><=zmWr*|hMF#|Ue<1_$B+WP*N^$sV!oDEY~jE|?J!?d&pK39fzE zm^T>pVxP8Om4y>sdFIC!pgvT z2D>AJ8iZfsHuKMwOTy)hATJLpi73STK{X={k%yE1E5y!CCSPW<#^ei3C?6ubEwsBk zorc}Qv1>-M1hJgewMi=(3TDW~Ul6r?4a(=MDMPM*U9%(ofC zJbkKYAGYV8IBZvQ)!Ew2VY^l>PM2-Vtk}ham8r^sVoC2{hb7Nu5kc|nOK8=`v#!^E~V$u(7B43d4wwol0$pD z?}z11zrWR@gTo)O^(Y)fFg%NgA=XCl#aCcIL9}CAox8dEND?>(Pbdcfgl#x_{)msT z1d)TkmV?bf^$_`Z;VBc$3i5Vb6p*G003HS1(tpcU#$cLVPxiSJ0YJjzEJ#=XF&;GA zZz3$k#nGI5IM_llunEjT3p?uDcU}&-ijX(dMUm#la5nSM+^-EG0Kn4Fdr?ae0*hk! z9ijj*Z!bd^p>EnPzWN~ks>fsd(f4jnS||WA^xDs(72SepvLb{99cFSGJv5g;G3x{C zO#O#t4B?0W7e6@3h3^GhVj+oWcn9TS$?NUFI)Zym?IJ&d-4|HFY^z^kK}!5W_ml-y z;&uTK2E=R4T!5f0n#XVw8|yjq2u|WfcotERpc%}PF5RdzIJ7wO=dovUju9pa3JZ;R z9;0|Gc^fru<1X_keqzx>Je<*gj`IaO#N=}eaQ}G7cd3FL?;s7YU zwMMk_H-dhy9U|HUm9q;e4unRe1Mi@gP{-sBgq5rQbq|hak3(KcdIEz%aF8t>p@L+R zP6Ggd^Sl@^AyZ+fx_;(+nhKN(sbtt?mqvTIPv^=j_$yPZvdi{-Iz@AGY)rbBmXCBU znI>|XmCZ?mnQ(~Zx%;%q<4)qwUM=A}XyFMxRo`dtMUG9J(Xhxqv2!mbJqA}T zSP{j?r2=Ba1S3Xyi8f;AbY$HSU33kKjSq1$W*y=T2SVxSz}j`c?Psxh$=qV|R<+H` zBZ~W2yDj1{RogLH;%6z1#NQo3y%&<^MbQP-9Urrr8i{ z*{$}rG>>`zC#*uT6c(Ze&k+)*(12Kq1W{BpGRp}GR#7!&MjlzD3bOT7C2Y74jpZ-V zrKT>#!-H(n?62RmB~#PG!Ew8X#!6_ndx4_t(8nOf7NUUFe;8UWv^9uq(})E_YUXG~HlAx|Q;NqBkok~^A3^KhY9MSyjo2-~EFYd$}hpLb-;Yp9U? z*z!eO{_98*+k`}vJ@UNgXq4C_g~%o;M#r5?(Q)Up{*z_0{gP}Xa5@O=5`oo_WG#f4 z`>n=o^E$S(7=hhvY9~)PlX*plM!f0qAsRsh8>;&mj0iG_=1W9|rV|(jvvIR~je`-f zNzJN>C6?FF_IRg$fMha_NNoJ8gvRlKKt^DJcpiD65}d3TOq!GgOr(##LAdE$%gAW5 zej@{GJ~OWLFe8!8AMd;b>Er_%WCWP*oSJ%MdLt>cx4gSy4q;3?`e2L(FZ_q&lu(#$ zh^}VyC-><=Qei}N5y8>}&PFuV(r~=kBkhe1G|YDp+SKb`%Rrh*#;VIk*nNK>lLc|X z-&tcM)@lYoEddY}em)5AwNww=tZz<)5EXtN2ok3HQ<>JQN&h9#bY*F3TqcS9xk_}) z+UKA1>0dDUmrVYM$=8{rRF_JapGLvUghuYgdPx6)vgjy>-fKNB&J5K-g)omlW`xme z*+nAMLQNKUA`t11RkRYrIsBo=WpX>}FLR#;pCv2A#$vWK_U^VAbf~7-M1{!~lW8VL zm^{x!0^I0@)2{oc`E-iOTTEmvDZYQv*&N-ZVTZ-@`j1D#hk>!5L_$~oN&K~t+wpFvPno?8+Q9zUw*+oKBLPAJ@5C{Yne}RNRAR%3;5~%+)e}H&NNC5%A z-*@h7W@p!qin!~0?mdrt9^d)i=NmseK3*|!{n7V+{pj7Hgad>8r3oN>kU zE31~2jy-31j#s#4c!eFSQAMukm5?j>)g8Mrj=bxYkuOWWhJ3{vLw?M!p?(7SsyB}O zxa8}|*SrbjC(zp@a&>PKxk==vkel+Rk(>5w{^X9+m`2HrcK{^^P(Op*talK(gZ>Qq zK7jloZw~o6)XpL|@7;&oeaId3%!|h2;dcn1<;7Cud}b{Oqw+b`?fIRHei*qgY=&#y zPOBXiKHI@dRJe3wv+YOj`OsIb%X~ZCYPb2eXhoG5RoA<*!Y`ufXTngeUA__eS>X!D zNiG{Nr*H=^BJque=@|{nw>{Id-nKm3b8cZL0QG`byk+c|4ZzcLZyAk}SN1A+y55*q z#k1^nx>-S#jTCY-F8%ZPPH~RS_<=XI;{;qDqYb9E1Ur@J}um* zaR+rIeY0;gjlP8xvqEp?@}i~2QKM=|7VXFh{Pt>A@?AsmyLX>Fezm*dAHUZ2U-#8< zEPTsf3A@4Z7q`Nz-OllqZnu4WWn=UB=GIDgV{@(TtEJ7Y$Za;)I%{FGSw8`DnY`;{64|JHJ~+D>thKuxt|Q=j4Xam= z$4Dzj4^l+qzOf#I!jy&YF;1!33_{gxa!@^r*{h{1k*a|)QoxgHLyltZ5Ge`r$Wi{L z+HW*~j!l})ncQ$0;B?)JEEWy;p zO4AwE%-(pqcdQ-Qx=}dz4hyB%z44>%cbd%yIF4*g9zUdNd9g~GAh9-^QKi}309R@A zz1nPEztL*PH8xhIrqEC1ZmRC4ufi=g&Ebg*YL>};Ot>WVekR$H<&8KhJL=*kAZfd1 z-KjdRjlZH>kh&EVrx&q@SMWTNglT=%ST)JEZn+Ix7?&}~xWL4Ob%BYM@Gk5N@9tL( z2kZ;DJ{FBFcRQDSwXp_PJHVGn-W)WzA4zEJ7`L(Ued~^88dpFpO-oWc;Zjai2yOrp z8Z2V~OU#dh#w1Fyg}I_dTXTwxv6)dBd)#gX0q80N5n=o=C!sO7M(#9|n{mdX5=!H= z*;uCj9pFTYzsr47Jr-JTg3dCy_08MP9penJ`WwcMwQY53Z1JYCURW-}jGk7A+W4;*c`LN0vb9DAM zXYAO3iyMx6MRKQ+5UI(Rzj*UV-#lZydU)HGRinSbRlj9kS1)TgPH??3uPZI5)SWQO z4|CJWOZvvE^=%G{$;=rqLHt~|5}Y%&P_!az>9NQR2I!s?_HOya6~E)(+*Buzvp;t3 z7`=xE5ePKiY%ZN>cUM~N;N(*Ji6Y`Fa+M!#c50FR97D2eg6e}PJ%c-*T4XHNH5+}9 z-%u)RhFSu47#qfI-H>1sdb$gIu?t%MCY|D_8Jm$MAe!HFUUM>~L`Uo3|s5*+bhj0f(A=j)H+()Yr zSBm8;xYLX5m)C%pN_1;syVS3%?^#T_$-b&8de7^`qlFgNJSemhreP^AM1V3v4Cyrw z3ZPZ4M^MS^O(yfmBoDEa*IpRA9~Q}Gtl{GXRj1Sb-vgfRi#6Qojob*cxe;;*^rNHZ z_1qv+xk2{COW|>XoFnj3eGJ`YYSREVejHUkN2B)SnlrZGB1;Ew(MAEUfZgw>GKo4= zfI3u&3c@J|v|*w&y9zR#@*ruc2nkME%TYlz9AIUJTCq}YK9|gV5U0Mt4r83E$(R{J zNipjA5%$pfG zYpFu*=PT@pJwh=%l9-L@&WupYz_cG@ccnnQEJ5U4Z3S0j3W%JRx)KbJL&Ckqafqvi zIRiGnYoruJWaFGqp6c?h0rfa4)iX$dWh49@V(-0)>IBv5xv|8`Tr{Ji^1~adGl20V z7a8;vUJ_DQ^RgT846K?5jc+6thy}~y$)sl8j%%EpP7N{<#+_i)jFFJqta01ELnoKD+_R4c3yV&MW*XfKa5=1P?lB#@ z9d6@Jrjy^R_v-js3n9$*MsM*MqDiy)Yq{LS1bd0^_=(c_TZ?!hV&HUGEL{;l3r3bxewx(vH> z0ZoRj2Ju~Gt}O9viI0l{M4d+xIhWyER-!I^iiJm*kniWXaHji^q<3%!?8-G=c)V)m zT3P&F@O{;AYl(&G^dkD4!X41^+*6o}yB=axJL`)c{aY2yq_{P_*b#3LfAqSMNok>% zng@~7=21kY8N^&8NVF?%Zf;Rx7*VwRF7AZ#4kWOp=Q9;!12}1;x!}n$y!6dr9$psX znj65!10g!Ex#Am;zU$U)@O^rolF2#RWUIW?YTwY#U-jeYBr3KxH~o&62*IKjjYD&d z>}Ndh_c>Q0r~w^FB%M>8et_p** z)@M@wkQBb$V7`Q$CQm}7g9=?k#;z(8`Uzr>vkFp&+g zTPlv~UtPr4`;9;@_Sd-)a!VMY25_A#Y)yE0=2;-^^H`UluC<(@%^u4kg8eN&9|12- zOLv2pcr*7~5BdGy<%Y;XOjOqaq!@r$U#m^J^L>;w3X^E`2%=REjF9pJif_#iR)_81 z3#i(UzA2f$pBu22A;B&Yp7J}b40@0apbu;f1rK)RS^XHL^;7o!J?;^kbB{87Uq2BA z>JQTHt=?p^id2Lz)<&`>k=7!&g+FBiop4b@68mE;OZg)f{0Iv~&=Jgkj$1f@YfkZ? zD)*;YPuxx~?%gTe1D?Rd0`?t!Tm?Q9pR?b~DLeL}E>7_kcFv2>bkjKTkq79AF7Q{w zsBmHJ%GEG-`bA@%?BFYM6JejNUN4(G>K)v%>4@W}=@-+Zt-CNPA`x}Y_1L1Y)JrH4 z5xxh7bC>^-qj60*B%jHRm2UKageCw^^9wE>ZYk>47;x2^jjah6*2GhvSU5^8=Cf!c zbJ$~e;>y3UGa26OP34A<57*!O;2%19Z-Wy@|2;SOAe={VQ?j2Ge!yvS;dDN5@q8xg zz}**3viJ{nBcd1Q6~jBckDBrTzDv}U?gGY!nzC+Pv*aDR+q#|D8jiNb%lII-4g2s( zlIMSNTJc^?4(!D)&NYAsm=eIi>8x6bIcp2^%8fnRc|nHo-??E2cR_Qq<;Ag)tmX*5 z)0+Pf)5%y(%3Cy@31=Zpe#jvy6=@R0$KWsxG_j*Ny|_+Z_ux~MamJJ=9N&+@G=KMQAbcy_7Pn6wk;uL zg~ph)t>oG=v<&V_f849X)k#;T)2Ml(k~St{CuUu{FcCH|<;{8XqO4B)Gv0mPVR=8` zz0bQJGn+;I`@IDzJLnztKHxoY%WNF-9)y^9NHp2e%!*7{Vi$C3>SzWJG}E*tb;5## zxfso2Sc>1=upGbPxz4-jnQt>rtFp!~$6_T8T=tXbUpA=e>{<`;HB2V9d^h2uR_< zK0I6CKnwr?tZWdIgitWDZN1PpPk{JDv+7mOZfu5I3kF?5+tv z;Vyq<)Ix&2UFI6PA7bCJ;90@Dz%Ut%<3!_mzyuE_Bf>&EFml9m*qCvCI40F|3PRaHD0?}N zP`$;|txl&KE_nXxTE}15=qi69yxQt4bdi(EE@(Phf?=QG-cd|YeU3?kNrr$iSLb4t z&!oj96KVp!I>DDG`G*KWsy8VjTJ$iu5)lD}Jd}rO{=<~w{{OI$Zil;L;l~r402V&F z*X;ifFmZAil)=Z6k%5hKdyb3~mP*DnmO?~i?SQq3D6p5s*zP@i>8ihw>23j#FbEee`wQJwU}1Y} z;qe9X`lZFP_V|m$aD@H8iW#aWn26#oX!shl2aqHre3b=*7^se;>}djuX0w5?oC-p4 z7@X6a&4VllA<`!=KJj7B(W2e-nn`H%$AO#Q@W#_XUdWjyY?5)IdASE67u~w;4Z|wuiv! zJJKHIY5Su7E_BdOVaL=t@Qu=P&p8@Ay3ngHcRL@tl*sC*DrJcR zAE&@JbjqWx1hk2HMoz(tPuiaX+%tIDI<{58qQQ81^5Wp|?OH{FGw~1Q06NQGF^I-Ey?&vO-87F(tTDO@w_xO>yt z{IdfbA|S64?jr6KL9Rf@xOtANK#<`HBEUM#t!*3S&dqt`Y?Rlx3w;OrMq#}`GQED} zWeOVyLd2oQCS}!^@yiR(#<4eq#~FA-q1@_Ri8(mr3vb)o#n8Q7?icUSd@o8+`13&g z$a%KwZKYUDK-;)4;uhZs)yY>YREE}#pR=wbyg?IB9J?MLhC7ryLy&s6a)L(>4A4LM zdO|-%qxWC}q_Epu54xS4giqW5i1SgKnEudo)OD17A)5!HG^(JEln4-lp3q4&mLmon zx)9+t(-KihfiF@ta+aZDX&NDUL=M*z6}%f8n*l^HDMWuv3r(#{lgj|NI>uMi8=7KN zia~OP(-aYFGsMsZr7-+(23)UZx^_k_Y!^^pDB#yUVNvu-{&vSjoy&F%N`4ws!}lJs7-uBz_Fp6IB$?5w0- z$0I7VyDcvei%eTEm)S8j4LRytEJlvkf+57n9nq*7#ZH&FrBW==6E)ROvkB)FmDBOJ z)4jJURuQtUW=_SoYaWBEbk~drAVp{ihtUcF_Z(coq*mWIn|!z9cdD9B{4N3n^{^DF zem0AEmhgnVxDGX->EcVBI0%CRSsR7UN_TTBqXZ?wUUbgX$kRqotf~uehUCMS z(A!&Fy~qccb5;3+4@Lf}RpCJTFP(!h5c=n0Vn0Zu+`4gPgXgJWpKbbL%{a0y}kDhh$ z;Y%sJu?*3wL`D$!JjO%>LW0$&P^3vN1BZK}-P*Y9wNCyvzWz5fFnY(5We>wCFA(%c zAiX!(DKSJ_GD2>GWOV-s9VRMCVYRF910!NsWL|7o7cUM^ranC4Z)8|kfj&Y<0&VL< zRt=mtGiZiCLsZQ<{+m+^oWuv1Jivsm35mDScE2zPvS#Hm`7{$T%48K+m=#Yd6IUIiH>o3htUFrG+wV9vS+3a z*|iD|JZ9Z;b+$U~j#tODiwTX=i#T@*cW@g?>PMUN#fRn>;V-k`8)E=;0Y4_x@d|Ey zgj_tV|eLn z!@LT;3vv$LFOU#Y_M?P`arVXTYcu3Cn4>=?$ zNZay6{NDJ$&?(iE(1{TOw(sCYTbt|fVR(q;+eRcDdF(oN5j@pV{hKH0c+@3O5|&~< zOq-_&KKwj*uT4Ij*hlN&Jot4Etr+wA5_mJ(Wqsm{Tgew4{#Gdd)^lVYC5#FT)V~$d zy<($i2QA>lMr_x}TC%^zO1Rw**y2rRtc!%Sldn_?C={8u0xtSgM2q*}y$WC$X zE{8sU!-H zT1F$lqECI`B0PfzDSD$}cJxZp$k3Zp$Y3BiA}I3`S_yU}?#4k}h^ps<3qF1}=yS>6 zPiF!ZPGFF)9hioVegzVb;01#-vJ{YztuWMrerGvNTrwnKN{I1vG_DTLaF5AVmi?Qd z_HF({wnbACU@Ftg>IWv5Zj*4%;mJKBt_W@#l(2)Gd|`*GRWeD$9^8*b!Mh-+G&ocB zH3C!^*vK7?T+WG;`(Zj`P}QszV|-F8L!_D$X^If#9guW6Ienbi#}xJN3%_RM+~C-5 zGW^|)o@<|GHzaPcLTcIyVKDO^c1ToCMGym}Z-7br9nCd_VO&R7|D50ktYgjiUsV3< zYyKBuZ>z_H?K>d5L}ljVUoY4X?QI%rk!;lQv4MSUo;*E*pp;Z2`R zidIGLpnsB_9m5`BnP^o%&o{15eUr&AFd+h{UuNdvlop diff --git a/cmp/parsing/__init__.py b/cmp/parsing/__init__.py index 8e12c7110..e69de29bb 100755 --- a/cmp/parsing/__init__.py +++ b/cmp/parsing/__init__.py @@ -1,2 +0,0 @@ -from .parsing import ShiftReduceParser, LR1Parser, LALR1Parser -from .lexing import Lexer, Token diff --git a/cmp/parsing/__pycache__/__init__.cpython-37.pyc b/cmp/parsing/__pycache__/__init__.cpython-37.pyc index 534962959f92f63b330248cc7d946df79d841bc5..e4001fed82fdb19f05e14741f42002c91ac497ab 100644 GIT binary patch delta 77 zcmZ3$G?CHXiIBk@r3@`y14nSP20VGlwQW$d>av7r-bD5%;a+#x; z89`!9IV`!XQLMRaQEWgyb1;J@%S%R}a!ux2g25S?X(d6aDW%D&0f|M$sYSOqeS!?3 zOl}`XpCDf-Pm}2ut50eLPz7s9es*e}pC)@0djU{SW?p&`$Qebcp1WTy6nq1J|MQ>Q-#quLhVdVi82#CZoWm3TI|6A) z(K4#^Hd|uVteS%2R?AwotM;l>bvSLe+|^7qgSaEzcZ{khGt$F5E3?wa+m|_+$2%tr zvWRzH9+M?G`HrX-ak$|rd6Fm`f>RL(ob;u0MbY0lSn@q96@?Akr`f0;_NK55-2)z*?6ERwQC;Q^W|*7`@UB zqd$u>6J^DL9f?f?B{oW)M#wmWAYx zK=L*u|Dl#V^=G4mYMe2&4nz*6HqC(_n{jr_js0!$8uSM#Zzt8ea>MAIgX~FJt@-O0 zE14u41!}d?uD3##e^O|7+O;$<$#qpnt}R53PCHDzuLbL@3cNzq+;UyXn%09#E)lON zTBpQaSgyC1g2Ws3lH|~5n(%jeOvFt^=uypR(ce_G*hy|oV5|i?C{kH*Bvft@K8n2X zC;~&+!Z!1wgr{h_!nX3lgDg#fw3s%1vnXav^$=>NdyYD!;aRfx5P@V(NY=vJW(ksX zivx!xXvPjCIDNx_tRY)S+a&p&G5UXx9r$xd)aw5wa%{Buc;Lov(}6tQraSOZlV#ce zew2y5P1>Ko19|&{T%2oqs)_O(WSw6x#dhq){-TLg0g`_flFvf&KN(6MXh7xCIsoYW zUDVn%p$UaitC2RuR-E6;#Rb*@D=swi7(?e}bzZLtO?Va0^MnM@1{>P&DXDy=peFIs z%3xi1?P8J-qq>S}dS9w36ee~nSd0=!HI|m6BpbBXRs%&~P`DJ%ciPv78m0D8N3@w# zh62L3N>NQyoHZr0*lD#oZ-;6>va0zpv4`pa)taT?AO)-@o~~cJnTST!(-W$_Q5|K! zQT4SR-3~Bgf{!u9nMf5!kNFac!#M<6b4Xu`&>pQh8V9D3@`Nc$C^=@5Rvj|c6KIiQ z1EIEshc##sk;sURO)(I|x7ojp-To%9R%{ysE4G>@aM@~F;Z$rlZS_oVDgu&A^BrJy z(>af}Xbr@Uv7cuR-oYYv@D{x(Xr3FRocC@z1u`IHXG3~uy(}`dxK)jk?tRZ#=Tl>V#_wV5&~eonc9ZXXnzY z01^ws0oy_UQkW_SD^hk*bvA-Fn!;>24cN*s$qa`| zGTopp0qV$EQz~djDvuc@*>>=DjjQgOdXgKPWRoU8gTNph0J7r&Hkjr#5FszrS5T57 z!Dta_VYpFbe8*S>%0n_<3=|-_Jh<*u{a2_-83ERPb^sI5G~P2-Ol8J`gg#t<1C7Nz zMDP@9CLS#iEeJ9Qyb_x}2ZEvR+tFEdjJw?t!b3})sPl^?AQWjcdOSg$q&Rw zYl)QDjzxGmashZYTG}Xc+CCK6*74Y05&%gMlZF6H8ci&7GkXB04Je1dU|M`B z340Ld_@Bsm7z#I1K}vn0j3l(k6J+hKz`Ozd`j zHK4O%0<_oHqRwhP>a^7<8aH#NfsO;2WHk7O z>KV!|4EJY^ry{ zzE*-g$BstY<9}0}?_+n9y)TIw#_}1VE}>ltmBepT)h3QjOs;>0_V-(_5?9(X2&I{O zky_hB?j>M>&krrIN!$xo7xJrBWP<$ZR$OhDc)ihp zKSIrr@E^99nfH*T!Tze(keh-LNsNpe&fHXW4XSNEk4nCc~U>oS< zRvhF(L9$Fi3K56_=mVTq7_k@^Badmw&w8K0o_KK)Z6;t(&Vh!Mn1&o4T9j;Dlb{VI3}zSb(Lg+WZn7_9s8ZAe!CS6jSca~A<5K| zWkW;~tK#Ga>PHoJi)}^*;2Q8l;kXBX-H5{A@M?tQFE9YsvyhGp*%T2c$*6B2KZOxO z9}f>p<>C-Vh={!pR~xwgEV*qMI_RVVh9yDaAS<|VhA@J(w55ZixJguCU`cl@Wy9Tv z{I{k69XPcBDlBYU8qg(M0c%bN}@?qyAfF5PLNy zSJ64}J`XVSEPC|fEXf+VM~CjA3`X(e9BTkTY*d4tIGNtxLE0bV`9ruBPx9=J4V?ZF zxOrXlF^h9i7Hyn3PwnxQ`5MkYJp(O%juvHZF^liXMmcJuO>^wjaQ^BY9Xf`*`4LdC zBBl0;l!$f#ZTRqU1P$UwhxG{4iE zWJAD~WMe_Ir5RF&AzP{pPYU&x8r$e&#w%^L_k@W`@q`bh6D|%+&^vhbc28IE>^^U% z>P>WcU}uUKD|tSBu*-1_NJ(koKLZ8SAI-exCNed;@^)h*TNndO2FEH@dV>Pq%I7Gy z9|62xs2#bJcArurt@EKtMIABpT79;SzZQ5Djt;)qm*AE9bXtLo@oS9P)9 zGPsk$eUHrI?MdAA;GLCuS-{(uMLB_YPL_aflgZ?@<;G&9y-Qc%{tpzcU0%I(@p|H3 zy>R~PFJDN^*S?nG1I>aoj`87-5Fu=>A>0yDY*U<0T-vc~)NCdggbwfrpv(nYV^<^Q z(HWqY<fx{wdPizCc&_1g^ib~DNttqA?g+B(y{J&d_1fPE;@#k;0Qp-mpZ_098iE@MPRU{4=OdQHv`1{ zH%82#;d0=g$iAb_kLl{B>8OthKbyF|X?pNIDab#I{(NQvq6z#)DlZM#ZwnUVUjJRx zDA1)G`ZxkkFkTfY_&zo&ZnCG)pSEuYQK>PsTQgVWzonTQsdxEVH&%ydavD9)4fz86llv9zT$Z$Y6tTo?NR2i`60|%1OB5qfB-xq@mH=cB<`QKx zQM^qhxiK5A>QqL4PxWOAZc%W90%jVdH5E^_DT6G%9-IscoL3zv3Sm}~O*z5XNhY-t zs);(6$5q5NHNVS4J&K}imc-+%D#y%?qkE``R`vUIb%D--^hZW61&)u9fH@Z+XWt`R zaS-Re6>AiS!q`vAu7FiQA?MJ73(;{G>o{fk0SlW?_q}z`s zNe^#7+J|)0eHTVSpZP_yZ@v>^_6=S@TeRbcs_mkGqHAR0`$c*x(QEF?g!BVLC23*i)kV0oqG}vnLGV!1_S+zlF0a zWK8b!n0%0=O->WQ0UZ!488vrb+6`~Q+en@i2S*O7XK4d7a?p=zA2gtwbiWL!Y1+`o z523}V&+Rfx)^p@lv!sJJs2bODR!p3G7vl_Cf}p}VZb)}YXy?0h4j9w8UK;rQ+mQ#F z35PtLqycAFP(L@w!2d_e{TG_xr%cQ4K(%u@IR zQ0cp(_frtj48YS}$zncda30Rn?KW;f1$NVDwTvd;f)dfi=^MA+RE`~0)ZaGzrXqjS z23p|^53k{b%*8H7;tP!)t_dWaqw^cmFAx8iSd^pXpuE($6ST|MJ1ar^GC$k0O?M@F50ZT$0^#iLHXJs@e)aa$y#r*a&1V z^cR9IT|?jkf_72j>NVoqg@u)>i+h5wqqKpEXaqJRZ&Ov9T-b?yyCc`D4s{$Vwh1EC z27t`QE`TDofFF9aYPCDGE6I6aWI$1wzItZKI&R^20CeyNgYe8*94L=~y3+3j2*U`^ zJacabp}U>0%TCMJbWa?rJk_m3u9nQCwmr%&m;4^Uehcsd81vq>t9b;}cjZATns-}Y$ zk-(6k<8-M=dy}q9EvBM7wBz&8_(x+?*grOf9Tc92Mf?uNQtwglT?)vCXnE`YNv!Tx$Bl6{`W8@V@?a7M7jpITnOGQJSQ2#xFLD ze?GPrhtg3$TO4RIWW|U;6eE+&PN2_Q{J$6*aR1nV|BuE0Jxt@z?pu7y*?aMclsu^U z&?7s^U4AK@&wV=o#h0B9wO?r2|9Wf{4v&rdz{1bNi@uj8?xlp^$LN1G>ev&C(iL%$ zf3}Bhg8v8A3i7IX{1k3(cw(!wlNLXiLRNR3?wcBbXYI(P53gpaWG!k8fBB{Fk{&_{ z|Heh%JM#@Q?|!F2XozQ+>Rz`AY@S&e!iMNL$G4U+-g15vwqk;1*KFJ7=As`oQ gN#tE1T-mF5lb-D#1J;#1-*^3|yrO@!*eN0Te-Ga)$p8QV literal 10392 zcmb_iTWlQHd7j(O&R)1&Q4~eVvb>gMMVls+?WDGo%8GoEY}qa?OG;!<>x@=ALu!|M zAKO;O5X02x@EVFeBO87)!Zq+;1}_( z_$9xL_q0FdSMaX-(|#52L;fLu2JadFQU8cP_pa_9_Rsi7{dweO{V(~){NuO7kc^?4LsER4|Xe$54L6KaKL~;26rs z{lnL_`q@wMy;|K!tj2oOPpnJ5^=@5HtXErMgm>>!D>Ep2FQ6l1-u56zoeZ{E@(W2LCh>Kgxi)V`_pj5oB{ zR8Pmowz-4a-eZG>Sbsr#>*Uaiwb(kQ4RdI-;@pm|YjLif3ol&N)-K%CMk8VaA7dhya_<=H4wt=sESa7n4Ya!X+lc|q1_udn*}!lc?vzbhQI)a}Gx zYN;>^lU$>-dZ&?;r07Y(t;)-5jr%8dxY51c@3`f(TUz>CO;xd-d*3*Br{4|Et#pF7 z19k4I>Td+is2`rYx)I&!_s%u@{m!{&clF$ALxrv0^60&=x{(}i_PeXtyw~YB8y!z( zpW^YJK%(ikVdzD@q8AMdPf>SJvQg_8Y6k61oxSiY;VIw|%KQSEmNwLJ`o`dRthF_q zb#-V)dTeg#G1BweTJ@$jm`9s|w#v|o^eqi77Fxc7mb4@5bZwv1shHsZpz9T#`>*T6q0 zIlHB`t2ec^i=e#@nwyI^F4yx(AqrHt)oXM@p?@;f>-W5IT~bZL?~QI&B#iQT-@=q(4XGnyqSVa{=(xI1H_zoAGGH=mOJ4OQU; zr3r!w7o^D{wpB(%l@Z}1s0+^^(R53il>AJ%y_C@#u{l|A+1|$ zgA-oD^E5R9xWNK9d`gzDPpMhFQf4qOy>>Y%hfzaCUMiRB2pXZ~f~CmKU284hiIPG9 z)fXr#gQ+XwV!wAI<0v)9i6~5p$E+wx^@=*myl_f>so&}J-wD+`s@(Df*+X@Vy^b?^ zfQhh)llJ%CNc5KLq#N?ybVt>1y2X@_ZU@*g)yD+mOph5ST~mm@fIcbbkY6g`o|JP^ zJurikqZ@h^EoTjK)p0|S*~Ypdhr(DlP-{~+46erHo0lkk+uDvcG)0%jk8=? zc;h#aOL8sP%CMeOq)U=-O3yH{SPiw34rI@LJ4u|;nxsKUjssOir)TmH%Bm+&JC=P? zj?je%7v4q!$rXL+Yb#DTi__P``DGkY1p53y8=Q_cT3FC^9@^d_y`XKa_q6R?oYLv+ zP3=9cZL7s7e^>v$wgejinnCv44k;!YcT6vy6_5QemnZixlVa7OPHOp>Xv_Q)W6dIk zlt`s6RH_@Qj?Rg`iu&Dypk};RJl_HI;6YsYK4(pr*gOsbHG2L8F~;5Mg`~I`45I5| zf7K%xm12PWRTaG53f|c#y8r}X7%19;)Cy1+fLefrsX)6Wu)|1GxOs4a%tCuB6dP?? zG`XE_Y!i(c#car#W!TWvu*=Zc>M691DaPaCBZB)XGB_&j$C<_+JP95AoM0wva3VH9 zr&(B4Yg>RL^n6)8WlnMq@DaH( zQ(VnXKU`MHE0)$m;>KCi*HxIg}TMd zP4Xpwe2;nbJPNT%&IE@R!r2H2a7(|dM=7rvz6oB-bi zLm5y_`i{0&vl!|((bILvV^@fRQ|^@m0xL|TaaTdBub}uBc*c5UxgYg;UK6Z4(l>Qe zJ&CSKVM+BjgB}!?oE>zT&`4%3vqNd(n?@`st-^xNXo)}Px@0a5gqYLS1?0wz$F5@~ z|1_kLjMs)f-GYd(7~yfNZb_M7tqBe&$awyrcwX6e9Sh3yG0VuR~2~YVbVBp}dwoZ8yLp&){93P0UWvOG<)6GG#^8BRn9G zP6Ssy#5z(@QCNf{6!pBKmK9V(1Gk#wFcC};i7aL)u^X$akoct1@O>{*jb7NIl1r?` zMmMM*nm{bo6bns2*kW2ECW;fQNPPnnCk48N-A06I@|+ybNs@oNg_#3C$*0&Qg#K7p z3SXW~Wf@QQmQ0U|ncfg#aqUz%lVYl7`4x#p9^P*c58qyIb$kksH{QmF*j4y65>20n z%i{=Co)OoF(8d99cKC<9s9)U>@LWY{4iE_7`5MNKrD6sJN`)BEfBt`yijmyx%EfkJ zN6TcRNGZvrqx8AbQHFF(Q93@*2TzN9d;&hL?30h_VHxeSl#mbfw~COF>ZFWB#f!1dFa{M=jnc;gmiVH)yNO=A^twLQ&#KhOjQln}pwB&Ri)sm!Ikp?PJL7UuH5}`L$&BKEolvl>Pt=M}>xi z$at^0(A8JbK4~QOv9*|pe?gy-i8!0Fc|&z382tcyv1dC}3D-Fbx6>MLDBaSZ3F;b| zieIrIU@pJaOflELjrL`0oAqC{ukon+Hbzwyo*HfJ_)ve3s2^u_4DThHS>!)|lTe%I zFhP2FG+v5d`|o%%OgLVY;DY*6h(pT>;+&z^fCujEuIB&{YsO~Vd=9vDFVQBv2lXY) zAgB~}IEATA*QR3h8rl2yK@|OzJ0Mzx^H6@S;n(E!9)9@Y`cd^QPFZ8}1r$E1b&%Fq z&$8h;CZh8NBM?TW+TZFy%c~bqPRwPvJ~O-eUR`Fd7n!`ogqmGlVe&GQSC|lrs^4a^ z$mBI90x@1^?r|npk+@T7pv2EmA_3rtQY2DxK_;cv5QvEM{R2YHfzDsI@Ej zE9x_Fd#Je`ql&x%a9KeJq=-N0aOnIho|>UMu|RX-g}87#T{Ez@ zG&d)y?Gs3vN#)gRh-NNz!235gR)fuFiZ%Qg0j(|dVbvRIr54=@Y7rW1{iRw*eRZkP zZFM$k2o}n)8sl|=l5vZOLOGsCDtKN}^t>)2P95gUp0~E%=wvN<&-43D&r{@;q?3{zVCE5jUqUHgBBZb3=bnJD*TR|sblqA>WDb}sT3WLtlo(7)a#PoT5orulDyIWcq^%=`L>C1;795TWK3n>a1Z=EtdiU%0G8vuVc(DR@T z06%$Ni5s92p(nF{dFinTr|L~k;WGIhCftDXnFw`u6QPrbhTLdc@O4hHW)GE2R9wUp za?VLk^$k$RbaOsv1WMVy?dS2%2To9c6?Fbe7yE3v#q2Jjl-(tiv%7?;>@J}q5&qfa z&;(aq6^2Dz|D`LJZzT4$OD}x;`AdoM+ACv3M9On-&vS1*BpLPL8TmSFEU1qNOd2}W zJWG%cLx|QE`NKwlA-@Bvcn)onSMZq@C0~*hn1%=+xIk+cY10wZ(}-y@+R=rb7Tx7m zpB(|}3~48&F~s&>Od&JTbC?_aJ>CFsZ+#>&T^lgUZs*$$T;BrRr|*FTMT{>o%Fr&uLIZgE+LEzj!uk2{ z!6r!*+dEvf1_y4pcV7BVbGEGaj{v(~M!56g)O?*nE-_pFK&`Njy2veG2~!11Up)=IKFr1%lBD3N zU>WfxMDDt*6kqEOTS~ZJ8Ak}0*+#EleTT`nk+{Vx;f+y5c!{-SntE}9AHh?VN4%vA$1+aCKE9^=Ar|#@_~mkG08e57zn-Cc2@m3p02Hp=zzk%-6+3(h zfn2g%4rq$?=7*YZ{R9_Bh#jEEsP{1q?8(a@=!CWfCc6s@g8nitzid9mK&9#D@J0|z zdgWFOApBc#9wVJ0bjPwD*>Qos`cZ8bQGvnjC=ZWGYPJk8<5l!54a*2o!@rtLP0ipJ z6ys7!gI6&{j|fqYpJVSfJfi%Tj$P;DGE#@>PY~sR&+zk`+Qtk#kP@$+a7Ce?*WkI# z!E-5#=koQ`bIClD(K$g_@YP^hoK^*2$;%BLP`8qPW%hLy`MLA4J^1v0@!LE^eGQ*m0+rvawR*LCdM%AUoJhHRw`JFxubtW~pIWG08m!`$ z5mB+tGDd>w0ZIX5KBb1=Jekd0gDCVBr+&N9Y5BEOBi8EGq$o_|iR~6)kysUC7y~8z zFG3>7R>aUjm^1(y@&%_RmI_uC!UvUuxLM1|{hZBHxuWlwV!{uqm^Da=rzK*#l zVU`3C9OKI-Zq{@J5g=y{q;6h6rGFWqa|Y@gH>r@kS!p>~d8ZRM1wde4L1uWWorlUTe!5b&(tV%P67 zAxd*?NWyyXc=mom+$+S*$)rgxMFr+cu#x1XU!wQaEsiD2jlM-bV+|ENs}vAO7^LnLs)S)5vKfOtWJn2 zBI@XhW%*An%KBpcfyClJUPv@VnP>x8-B<#h)oc| z5dzBo50bvbIiE&+2r<(CUa0D21h(YQcIKR#Q+Fy5$5PQQo-KZ}>QqV Generator[Token, None, None]: + while self.position < len(text): + match = self.pattern.match(text, pos=self.position) + + if match is None: + self.contain_errors = True + self.token = Token(text[self.position], None, self.lineno, self.column) + self.error_handler(self) + continue + + lexeme = match.group() + token_type = match.lastgroup if match.lastgroup is not None else match.group() + self.token = Token(lexeme, token_type, self.lineno, self.column) + + if token_type in self.token_rules: + token = self.token_rules[token_type](self) + if token is None or not isinstance(token, Token): + continue + yield token + + yield self.token + + self.position = match.end() + self.column += len(match.string) + yield Token('$', self.eof, self.lineno, self.column) + @staticmethod + def print_error(error_msg): + sys.stderr(error_msg) -class Lexer: - def __init__(self, table, eof, special_symbols): - self.lineno = 0 - self.column = 0 - self.pos = 0 - self.table = {**table, **{'$': (eof, '$')}} - self.pattern = self._build_regex(table) - self.eof = eof - self.special_symbols = special_symbols + @staticmethod + def error(lexer: 'Lexer') -> None: + lexer.print_error(f'LexerError: Unexpected symbol "{lexer.token.lex}"\n') + lexer.position += 1 + lexer.column += 1 @staticmethod - def _build_regex(table): - r = '|'.join([f'(?P<{alias}>{regex})' for alias, (_, regex) in table.items()]) - return re.compile(r) - - def _tokenize(self, text): - pos = self.pos - while pos < len(text): - if text[pos] in self.special_symbols: - self.special_symbols[text[pos]](self) - pos += 1 - else: - match = self.pattern.match(text, pos=pos) - - if match is None: - # TODO: Handle bad parsing error - pass - - yield match.group(), match.lastgroup, self.lineno, self.column - pos = match.end() - self.column += len(match.group()) - yield '$', '$', self.lineno, self.column - - def __call__(self, text): - return [Token(lex, self.table[alias][0], row, col) for lex, alias, row, col in self._tokenize(text)] + def _build_regex(table: List[Tuple[str, str]]) -> Pattern: + return re.compile('|'.join(['(?P<%s>%s)' % (name, regex) for name, regex in table])) + + def __call__(self, text: str) -> List[Token]: + return list(self.tokenize(text)) diff --git a/cmp/parsing/parsing.py b/cmp/parsing/parsing.py index 772c8ec2a..3a2784634 100755 --- a/cmp/parsing/parsing.py +++ b/cmp/parsing/parsing.py @@ -1,10 +1,8 @@ -from enum import auto, Enum -from typing import List +import sys from cmp.automata import State -from cmp.pycompiler import Item +from cmp.pycompiler import Item, RuleList from cmp.utils import ContainerSet -from cmp.parsing.lexing import Token ############################## @@ -80,8 +78,8 @@ def compute_follows(G, firsts): # P: X -> alpha for production in G.productions: - X = production.Left - alpha = production.Right + X = production.left + alpha = production.right follow_X = follows[X] @@ -102,9 +100,70 @@ def compute_follows(G, firsts): return follows -######################## -# LR1 & LALR1 AUTOMATA # -######################## +######################### +# LR0 AUTOMATA BUILDING # +######################### +def closure_lr0(items): + closure = set(items) + + pending = set(items) + while pending: + current = pending.pop() + symbol = current.NextSymbol + + if current.IsReduceItem or symbol.IsTerminal: + continue + + new_items = set(Item(p, 0) for p in symbol.productions) # if Item(p, 0) not in closure] + pending |= new_items - closure + closure |= new_items + return frozenset(closure) + + +def goto_lr0(items, symbol): + return frozenset(item.NextItem() for item in items if item.NextSymbol == symbol) + + +def build_lr0_automaton(G, just_kernel=False): + assert len(G.start_symbol.productions) == 1, 'Grammar must be augmented' + + start_production = G.start_symbol.productions[0] + start_item = Item(start_production, 0) + start = frozenset([start_item]) + + if not just_kernel: + automaton = State(closure_lr0(start), True) + else: + automaton = State(start, True) + + pending = [start] + visited = {start: automaton} + + symbols = G.terminals + G.non_terminals + while pending: + current = pending.pop() + current_state = visited[current] + current_closure = current_state.state if not just_kernel else closure_lr0(current) + for symbol in symbols: + kernel = goto_lr0(current_closure, symbol) + + if kernel == frozenset(): + continue + + try: + next_state = visited[kernel] + except KeyError: + next_state = visited[kernel] = State(closure_lr0(kernel), True) if not just_kernel else State(kernel, + True) + pending.append(kernel) + + current_state.add_transition(symbol.name, next_state) + return automaton + + +######################### +# LR1 AUTOMATA BUILDING # +######################### def compress(items): centers = {} @@ -136,13 +195,12 @@ def expand(item, firsts): def closure_lr1(items, firsts): - closure = ContainerSet(*items) - changed = True - while changed: - new_items = ContainerSet() - for item in closure: - new_items.extend(expand(item, firsts)) - changed = closure.update(new_items) + closure = set(items) + pending = set(items) + while pending: + new_items = set(expand(pending.pop(), firsts)) + pending |= new_items - closure + closure |= new_items return compress(closure) @@ -153,13 +211,13 @@ def goto_lr1(items, symbol, firsts=None, just_kernel=False): def build_lr1_automaton(G, firsts=None): - assert len(G.startSymbol.productions) == 1, 'Grammar must be augmented' + assert len(G.start_symbol.productions) == 1, 'Grammar must be augmented' if not firsts: firsts = compute_firsts(G) firsts[G.EOF] = ContainerSet(G.EOF) - start_production = G.startSymbol.productions[0] + start_production = G.start_symbol.productions[0] start_item = Item(start_production, 0, lookaheads=(G.EOF,)) start = frozenset([start_item]) @@ -187,88 +245,66 @@ def build_lr1_automaton(G, firsts=None): goto = closure_lr1(kernel, firsts) visited[kernel] = next_state = State(frozenset(goto), True) pending.append(kernel) - current_state.add_transition(symbol.Name, next_state) + current_state.add_transition(symbol.name, next_state) return automaton -def build_larl1_automaton(G, firsts=None): - assert len(G.start_symbol.productions) == 1, 'Grammar must be augmented' +########################### +# LALR1 AUTOMATA BUILDING # +########################### +def determining_lookaheads(state, propagate, table, firsts): + for item_kernel in state.state: + closure = closure_lr1([Item(item_kernel.production, item_kernel.pos, ('#',))], firsts) + for item in closure: + if item.IsReduceItem: + continue - if not firsts: - firsts = compute_firsts(G) - firsts[G.EOF] = ContainerSet(G.EOF) + next_state = state.get(item.NextSymbol.name) + next_item = item.NextItem().Center() + if '#' in item.lookaheads: + propagate[state, item_kernel].append((next_state, next_item)) + table[next_state, next_item].extend(item.lookaheads - {'#'}) - start_production = G.start_symbol.productions[0] - start_item = Item(start_production, 0, lookaheads=ContainerSet(G.EOF)) - start = frozenset([start_item.Center()]) - closure = closure_lr1([start_item], firsts) - automaton = State(frozenset(closure), True) +def build_lalr1_automaton(G, firsts=None): + automaton = build_lr0_automaton(G, just_kernel=True) - pending = [start] - visited = {start: automaton} + if not firsts: + firsts = compute_firsts(G) + firsts['#'] = ContainerSet('#') + firsts[G.EOF] = ContainerSet(G.EOF) - symbols = G.terminals + G.non_terminals - while pending: - current = pending.pop() - current_state = visited[current] + table = {(state, item): ContainerSet() for state in automaton for item in state.state} + propagate = {(state, item): [] for state in automaton for item in state.state} - current_closure = current_state.state - for symbol in symbols: - goto = goto_lr1(current_closure, symbol, just_kernel=True) - closure = closure_lr1(goto, firsts) - center = frozenset(item.Center() for item in goto) + for state in automaton: + determining_lookaheads(state, propagate, table, firsts) + del firsts['#'] - if center == frozenset(): - continue + start_item = list(automaton.state).pop() + table[automaton, start_item] = ContainerSet(G.EOF) - try: - next_state = visited[center] + change = True + while change: + change = False + for from_state, from_item in propagate: + for to_state, to_item in propagate[from_state, from_item]: + change |= table[to_state, to_item].extend(table[from_state, from_item]) - centers = {item.Center(): item for item in next_state.state} - centers = {item.Center(): (centers[item.Center()], item) for item in closure} + for state in automaton: + for item in state.state: + item.lookaheads = frozenset(table[state, item]) - updated_items = frozenset( - Item(c.production, c.pos, item_a.lookaheads | item_b.lookaheads) for c, (item_a, item_b) in - centers.items()) - if next_state.state != updated_items: - pending.append(center) - next_state.state = updated_items - except KeyError: - visited[center] = next_state = State(frozenset(closure), True) - pending.append(center) - - if current_state[symbol.name] is None: - current_state.add_transition(symbol.name, next_state) - else: - assert current_state.get(symbol.name) is next_state, 'Bad build!!!' + for state in automaton: + state.state = frozenset(closure_lr1(state.state, firsts)) return automaton -####################### -# LR1 & LALR1 Parsers # -####################### -class LRConflictType(Enum): - """ - Enum for mark the type of lr-family conflict parser - """ - ReduceReduce = auto() - ShiftReduce = auto() - - -class LRConflict: - def __init__(self, state, symbol, ctype): - self.state = state - self.symbol = symbol - self.cType = ctype - - def __iter__(self): - yield self.state - yield self.symbol - - +############################# +# SLR & LR1 & LALR1 Parsers # +############################# class ShiftReduceParser: SHIFT = 'SHIFT' REDUCE = 'REDUCE' @@ -276,46 +312,72 @@ class ShiftReduceParser: def __init__(self, G): self.G = G - self.augmented_G = G.AugmentedGrammar(True) + self.augmented_G = G.augmented_grammar(True) self.firsts = compute_firsts(self.augmented_G) self.follows = compute_follows(self.augmented_G, self.firsts) self.automaton = self._build_automaton() - self.state_dict = {} - self.conflicts = None + self.conflicts = [] + self.errors = [] self.action = {} self.goto = {} + self.sr = 0 + self.rr = 0 self._build_parsing_table() - if self.conflicts is None: - self._clean_tables() + if self.conflicts: + sys.stderr.write(f"Warning: {self.sr} Shift-Reduce Conflicts\n") + sys.stderr.write(f"Warning: {self.rr} Reduce-Reduce Conflicts\n") def _build_parsing_table(self): G = self.augmented_G automaton = self.automaton for i, node in enumerate(automaton): - node.idx = i - self.state_dict[i] = node + node.id = i for node in automaton: - idx = node.idx for item in node.state: if item.IsReduceItem: - if item.production.Left == G.start_symbol: - self._register(self.action, (idx, G.EOF), (self.OK, None)) + if item.production.left == G.start_symbol: + self._register(self.action, (node.id, G.EOF), (self.OK, None)) else: for lookahead in self._lookaheads(item): - self._register(self.action, (idx, lookahead), (self.REDUCE, item.production)) + self._register(self.action, (node.id, lookahead), (self.REDUCE, item.production)) else: symbol = item.NextSymbol - idj = node.get(symbol.name).idx if symbol.IsTerminal: - self._register(self.action, (idx, symbol), (self.SHIFT, idj)) + self._register(self.action, (node.id, symbol), (self.SHIFT, node.get(symbol.name).id)) else: - self._register(self.goto, (idx, symbol), idj) + self._register(self.goto, (node.id, symbol), node.get(symbol.name).id) + + def _register(self, table, key, value): + if key in table and table[key] != value: + action, tag = table[key] + if action != value[0]: + if action == self.SHIFT: + table[key] = value # By default shifting if exists a Shift-Reduce Conflict + self.sr += 1 + self.conflicts.append(('SR', value[1], tag)) + else: + self.rr += 1 + self.conflicts.append(('RR', value[1], tag)) + else: + table[key] = value + + def _build_automaton(self): + raise NotImplementedError() + + def _lookaheads(self, item): + raise NotImplementedError() - def __call__(self, tokens: List[Token]): + def __call__(self, tokens): + """ + Parse the given TokenList + + :param tokens: List[Token] + :return: Any + """ stack: list = [0] # The order in stack is [init state] + [symbol, rule, state, ...] cursor = 0 @@ -323,6 +385,9 @@ def __call__(self, tokens: List[Token]): state = stack[-1] lookahead = tokens[cursor] + if (state, lookahead.token_type) not in self.action: + pass + assert (state, lookahead.token_type) in self.action, f'ParsingError: in ' \ f'{(state, lookahead.lex, lookahead.token_type)} ' @@ -334,15 +399,13 @@ def __call__(self, tokens: List[Token]): elif action == self.REDUCE: head, body = tag - rules = [None] * (len(body) + 1) + rules = RuleList(self, [None] * (len(body) + 1)) for i, s in enumerate(reversed(body), 1): state, rules[-i], symbol = stack.pop(), stack.pop(), stack.pop() assert s == symbol, f'ReduceError: in production "{repr(tag)}". Expected {s} instead of {s}' - try: - rules[0] = tag.attribute(rules) # It's an attributed grammar - except AttributeError: - pass + if tag.rule is not None: + rules[0] = tag.rule(rules) state = stack[-1] goto = self.goto[state, head] @@ -350,37 +413,15 @@ def __call__(self, tokens: List[Token]): elif action == self.OK: return stack[2] else: - raise Exception(f'Parsing error: invalid action {action}') - - def _register(self, table, key, value): - # assert key not in table or table[key] == value, 'Shift-Reduce or Reduce-Reduce conflict!!!' - try: - n = len(table[key]) - table[key].add(value) - if self.conflicts is None and n != len(table[key]): - if all(action == self.REDUCE for action, _ in list(table[key])[:2]): - cType = LRConflictType.ReduceReduce - else: - cType = LRConflictType.ShiftReduce + raise Exception(f'ParsingError: invalid action {action}') - self.conflicts = LRConflict(key[0], key[1], cType) - self.conflicts.value1 = list(table[key])[0] - self.conflicts.value2 = list(table[key])[1] - - except KeyError: - table[key] = {value} - - def _clean_tables(self): - for key in self.action: - self.action[key] = self.action[key].pop() - for key in self.goto: - self.goto[key] = self.goto[key].pop() +class SLRParser(ShiftReduceParser): def _build_automaton(self): - raise NotImplementedError() + return build_lr0_automaton(self.augmented_G) def _lookaheads(self, item): - raise NotImplementedError() + return self.follows[item.production.left] class LR1Parser(ShiftReduceParser): @@ -393,4 +434,4 @@ def _lookaheads(self, item): class LALR1Parser(LR1Parser): def _build_automaton(self): - return build_larl1_automaton(self.augmented_G, firsts=self.firsts) + return build_lalr1_automaton(self.augmented_G, firsts=self.firsts) diff --git a/cmp/parsing/serialization.py b/cmp/parsing/serialization.py new file mode 100644 index 000000000..c8cac0ef8 --- /dev/null +++ b/cmp/parsing/serialization.py @@ -0,0 +1,113 @@ +import re + +PARSER_TEMPLATE = """from abc import ABC +from cmp.parsing.parsing import ShiftReduceParser +from %s import %s + + +class %s(ShiftReduceParser, ABC): + def __init__(self, verbose=False): + self.G = G + self.verbose = verbose + self.action = self.__action_table() + self.goto = self.__goto_table() + + def __action_table(self): + G = self.G + return %s + + def __goto_table(self): + G = self.G + return %s +""" + +LEXER_TEMPLATE = """import re + +from cmp.parsing.lexing import Token, Lexer +from %s import %s + + +class %s(Lexer): + def __init__(self): + self.lineno = 0 + self.column = 0 + self.position = 0 + self.token = Token('', '', 0, 0) + self.pattern = re.compile(r'%s') + self.token_rules = %s + self.error_handler = %s + self.contain_errors = False + self.eof = '%s' + + def __call__(self, text): + return %s +""" + + +class LRParserSerializer: + @staticmethod + def build(parser, parser_class_name, grammar_module_name, grammar_variable_name): + action, goto = LRParserSerializer._build_parsing_tables(parser, grammar_variable_name) + content = PARSER_TEMPLATE % (grammar_module_name, grammar_variable_name, parser_class_name, action, goto) + try: + with open('parser.py', 'x') as f: + f.write(content) + except FileExistsError: + with open('parser.py', 'w') as f: + f.write(content) + + @staticmethod + def _build_parsing_tables(parser, variable_name): + s1 = '{\n' + for (state, symbol), (act, tag) in parser.action.items(): + s1 += f' ({state}, {variable_name}["{symbol}"]): ' + + if act == 'SHIFT': + s1 += f'("{act}", {tag}),\n' + elif act == 'REDUCE': + s1 += f'("{act}", {variable_name}["{repr(tag)}"]),\n' + else: + s1 += f'("{act}", None),\n' + + s1 += ' }' + + s2 = '{\n' + for (state, symbol), dest in parser.goto.items(): + s2 += f' ({state}, {variable_name}["{symbol}"]): {dest},\n' + s2 += ' }' + + return s1, s2 + + +class LexerSerializer: + @staticmethod + def build(grammar, lexer_class_name, grammar_module_name, grammar_variable_name): + items = grammar.terminal_rules.items() + values = grammar.terminal_rules.values() + + pattern = re.compile('|'.join( + ['(?P<%s>%s)' % (name, regex) for name, (regex, _, rule) in items if rule is not None] + + sorted(['(%s)' % regex for regex, literal, _ in values if literal], key=lambda x: len(x), reverse=True) + + ['(?P<%s>%s)' % (name, regex) for name, (regex, literal, rule) in items if not literal and rule is None] + )).pattern + + token_rules = f"{{key: rule for key, (_, _, rule) in {grammar_variable_name}.terminal_rules.items() if rule " \ + f"is not None}}" + + error_handler = f"{grammar_variable_name}.lexical_error_handler if "\ + f"{grammar_variable_name}.lexical_error_handler is not None else self.error " + + call_return = f"[Token(t.lex, {grammar_variable_name}[t.token_type], t.line, t.column) for t in " \ + f"self.tokenize(text)] " + + content = LEXER_TEMPLATE % ( + grammar_module_name, grammar_variable_name, lexer_class_name, pattern, token_rules, error_handler, + grammar.EOF.name, call_return, + ) + + try: + with open('lexer.py', 'x') as f: + f.write(content) + except FileExistsError: + with open('lexer.py', 'w') as f: + f.write(content) diff --git a/cmp/parsing/serializer.py b/cmp/parsing/serializer.py deleted file mode 100644 index c8fb913df..000000000 --- a/cmp/parsing/serializer.py +++ /dev/null @@ -1,74 +0,0 @@ -import inspect - -TEMPLATE = """from abc import ABC -from cmp.parsing import ShiftReduceParser -from %s import G - -class %s(ShiftReduceParser, ABC): - def __init__(self, G, verbose=False): - self.G = G - self.verbose = verbose - self.action = self.__action_table() - self.goto = self.__goto_table() - - def __action_table(self): - G = self.G - return %s - - def __goto_table(self): - G = self.G - return %s -""" - - -class LRParserSerializer: - @staticmethod - def build(**kwargs): - parser = kwargs['parser'] - class_name = kwargs['class'] - file_name = kwargs['file'] - LRParserSerializer.__meta(parser, class_name, file_name) - - @staticmethod - def __meta(parser, class_name, file_name): - action, goto = LRParserSerializer.__build_parsing_tables(parser) - content = TEMPLATE % (class_name, action, goto) - try: - with open(file_name, 'x') as f: - f.write(content) - except FileExistsError: - with open(file_name, 'w') as f: - f.write(content) - - @staticmethod - def __build_parsing_tables(parser): - parser = parser - G = parser.G - - lambdas = {} - for p in G.productions: - attr = p.attribute - code: str = 'lambda' + inspect.getsource(attr).replace('\n', '').split('lambda')[1] - repr_p: str = repr(p) - lambdas[repr_p] = code - - s1 = '{\n' - for (state, symbol), (act, tag) in parser.action.items(): - s1 += f' ({state}, G["{symbol}"]): ' - - if act == 'SHIFT': - s1 += f'("{act}", {tag}),\n' - elif act == 'REDUCE': - s1 += f'("{act}", G["{repr(tag)}"]),\n' - else: - s1 += f'("{act}", None),\n' - - s1 += ' }' - - s2 = '{\n' - for (state, symbol), dest in parser.goto.items(): - s2 += f' ({state}, G["{symbol}"]): {dest},\n' - s2 += ' }' - - return s1, s2 - diff --git a/cmp/pycompiler.py b/cmp/pycompiler.py index 6277c92c3..c894c75b4 100755 --- a/cmp/pycompiler.py +++ b/cmp/pycompiler.py @@ -1,8 +1,15 @@ import json -from typing import List, FrozenSet, Optional, Union, Tuple, Iterable, Callable +import re +from typing import List, FrozenSet, Optional, Tuple, Iterable, Callable, Dict -ProductionList = List[Union['Production', 'AttributeProduction']] -Rule = Optional[Callable[[List[object]], object]] +from cmp.parsing.lexing import Lexer, Token +from cmp.parsing.serialization import LRParserSerializer, LexerSerializer + + +class GrammarError(Exception): + def __init__(self, *args): + super().__init__(args) + self.text = args[0] class Symbol: @@ -38,8 +45,8 @@ def __len__(self): class NonTerminal(Symbol): def __init__(self, name, grammar): super().__init__(name, grammar) - self.productions: ProductionList = [] - self.error_productions: ProductionList = [] + self.productions: List['Production'] = [] + self.error_productions: List['Production'] = [] def __mod__(self, other): if isinstance(other, str): @@ -65,14 +72,14 @@ def __mod__(self, other): if isinstance(other[0], str): if other[0]: - other = (Sentence(*(self.grammar[s] for s in other[0].split())),) + other[1:] + other = Sentence(*(self.grammar[s] for s in other[0].split())), other[1] else: - other = (self.grammar.EPSILON,) + other[1:] + other = self.grammar.EPSILON, other[1] if isinstance(other[0], Symbol) or isinstance(other[0], Sentence): - p = AttributeProduction(self, other[0], other[1]) + p = Production(self, other[0], other[1]) else: - raise Exception("") + raise TypeError("Valid types for a production are 'Symbol', 'Sentence' or 'str'") self.grammar.add_production(p) return self @@ -115,13 +122,10 @@ def IsEpsilon(self): return False -class Error(Terminal): +class ErrorTerminal(Terminal): def __init__(self, G): super().__init__('error', G) - def __eq__(self, other): - return isinstance(other, Terminal) - class EOF(Terminal): def __init__(self, G): @@ -163,6 +167,9 @@ def __str__(self): def __iter__(self): return iter(self.symbols) + def __contains__(self, item): + return item in self.symbols + def __getitem__(self, index): return self.symbols[index] @@ -230,76 +237,115 @@ def IsEpsilon(self): class Production: - def __init__(self, nonTerminal, sentence): - self.Left: NonTerminal = nonTerminal - self.Right: Sentence = sentence + def __init__(self, non_terminal: NonTerminal, sentence: Sentence, + rule: Optional[Callable[['RuleList'], object]] = None): + self.left: NonTerminal = non_terminal + self.right: Sentence = sentence + self.rule: Optional[Callable[['RuleList'], object]] = rule @property def IsEpsilon(self): - return self.Right.IsEpsilon + return self.right.IsEpsilon def __str__(self): - return '%s := %s' % (self.Left, self.Right) + return '%s := %s' % (self.left, self.right) def __repr__(self): - return '%s -> %s' % (self.Left, self.Right) + return '%s -> %s' % (self.left, self.right) def __iter__(self): - yield self.Left - yield self.Right + yield self.left + yield self.right def __eq__(self, other): - return isinstance(other, Production) and self.Left == other.Left and self.Right == other.Right + return isinstance(other, Production) and self.left == other.left and self.right == other.right def __hash__(self): - return hash((self.Left, self.Right)) - - -class AttributeProduction(Production): - def __init__(self, nonTerminal, sentence, attribute): - if not isinstance(sentence, Sentence) and isinstance(sentence, Symbol): - sentence = Sentence(sentence) - super().__init__(nonTerminal, sentence) - - self.attribute: Rule = attribute + return hash((self.left, self.right)) class Grammar: def __init__(self): - self.productions: ProductionList = [] + self.productions: List[Production] = [] self.non_terminals: List[NonTerminal] = [] self.terminals: List[Terminal] = [] self.start_symbol: NonTerminal = None - self.production_type: type = None - self.ERROR: Error = Error(self) + + self.ERROR: ErrorTerminal = ErrorTerminal(self) self.EPSILON: Epsilon = Epsilon(self) self.EOF: EOF = EOF(self) - self.symbol_dict = {'$': self.EOF, 'error': self.ERROR} - self.production_dict = {} + self.lexical_error_handler = None # type: Optional[Callable[[Lexer], None]] + self.terminal_rules = {} # type: Dict[str, Tuple[str, bool, Optional[Callable[[Lexer], Optional[Token]]]]] + self.production_dict = {} # type: Dict[str, Production] + self.symbol_dict = {'$': self.EOF, 'error': self.ERROR} # type: Dict[str, Symbol] - def add_terminal(self, name: str) -> Terminal: + def add_terminal(self, name: str, regex: str = None, + rule: Optional[Callable[[Lexer], Optional[Token]]] = None) -> Terminal: + """ + Create a terminal for the grammar with its respective regular expression + + If not regex is given then the regular expression will be the literal name of the Terminal + + If the regex is given then de param name most be a valid python identifier + + All terminals with a not given regex will be marked as `literals` and then it will have a higher priority in + the lexer recognition above the others, and the reserved set will be sorted by the length of the regular + expression by descending + + The given rule must be a function + + :param name: str + + :param regex: str + + :param rule: function to handle the arrival of a token during the lexical process + + :return: Terminal + """ name = name.strip() if not name: raise Exception("Empty name") + assert name not in self.symbol_dict, f'Terminal {name} already defined in grammar' + + literal = False + if regex is None: + regex = re.escape(name) + literal = True + term = Terminal(name, self) self.terminals.append(term) self.symbol_dict[name] = term + self.terminal_rules[name] = regex, literal, rule return term + def add_terminal_error(self): + self.terminals.append(self.ERROR) + def add_terminals(self, names: str) -> Tuple[Terminal, ...]: return tuple(self.add_terminal(x) for x in names.strip().split()) - def add_non_terminal(self, name: str, startSymbol: bool = False) -> NonTerminal: + def add_non_terminal(self, name: str, start_symbol: bool = False) -> NonTerminal: + """ + Add and return a new non-terminal, use the start_symbol parameter for define the started symbol in th grammar, + if two non-terminal are marked as started symbol an AssertionError will be raised + + :param name: str + + :param start_symbol: bool + + :return: NonTerminal created + """ name = name.strip() if not name: raise Exception("Empty name") - term = NonTerminal(name, self) + assert name not in self.symbol_dict, f'Non-Terminal {name} already defined in grammar' - if startSymbol: + term = NonTerminal(name, self) + if start_symbol: if self.start_symbol is None: self.start_symbol = term else: @@ -313,60 +359,89 @@ def add_non_terminals(self, names: str) -> Tuple[NonTerminal, ...]: return tuple((self.add_non_terminal(x) for x in names.strip().split())) def add_production(self, production: Production): - if len(self.productions) == 0: - self.production_type = type(production) - - assert type(production) == self.production_type, "The Productions most be of only 1 type." - - production.Left.productions.append(production) + production.left.productions.append(production) self.productions.append(production) self.production_dict[repr(production)] = production - def error(self, head, sentence, rule): - pass + def production(self, production: str): + """ + Return a function to decorate a method that will be used for as production rule - def __str__(self): + :param production: is a string representing the production to attach the decorated function, + the string has the form ' -> ' - mul = '%s, ' + :return: a function to decorate the production + """ - ans = 'Non-Terminals:\n\t' + def decorator(rule: Optional[Callable[['RuleList'], object]]): + head, body = production.split('->') + head = self[head.strip()] + head %= body.strip(), rule - nonterminals = mul * (len(self.non_terminals) - 1) + '%s\n' + return decorator - ans += nonterminals % tuple(self.non_terminals) + def terminal(self, name: str, regex: str): + """ + Return a function to decorate a method that will be used for as terminal rule in tokenizer process - ans += 'Terminals:\n\t' + :param name: the name of a terminal - terminals = mul * (len(self.terminals) - 1) + '%s\n' + :param regex: the regex of the terminal - ans += terminals % tuple(self.terminals) + :return: a function to decorate the production + """ + def decorator(rule: Optional[Callable[[Lexer], Optional[Token]]]): + self.add_terminal(name, regex, rule) - ans += 'Productions:\n\t' + return decorator - ans += str(self.productions) + def lexical_error(self, handler: Callable[[Lexer], None]): + self.lexical_error_handler = handler - return ans + def augmented_grammar(self, force: bool = False): + if not self.is_augmented_grammar or force: - def __getitem__(self, item): - try: - try: - return self.symbol_dict[item] - except KeyError: - return self.production_dict[item] - except KeyError: - return None + G = self.copy() + # S, self.startSymbol, SS = self.startSymbol, None, self.NonTerminal('S\'', True) + S = G.start_symbol + G.start_symbol = None + SS = G.add_non_terminal('S\'', True) + SS %= S + G.EPSILON, lambda x: x + + return G + else: + return self.copy() + + def copy(self): + G = Grammar() + G.productions = self.productions.copy() + G.non_terminals = self.non_terminals.copy() + G.terminals = self.terminals.copy() + G.start_symbol = self.start_symbol + G.EPSILON = self.EPSILON + G.ERROR = self.ERROR + G.EOF = self.EOF + G.symbol_dict = self.symbol_dict.copy() + + return G + + def serialize_lexer(self, class_name, grammar_module_name, grammar_variable_name='G'): + LexerSerializer.build(self, class_name, grammar_module_name, grammar_variable_name) + + @staticmethod + def serialize_parser(parser, class_name, grammar_module_name, grammar_variable_name='G'): + LRParserSerializer.build(parser, class_name, grammar_module_name, grammar_variable_name) - @property def to_json(self): productions = [] for p in self.productions: - head = p.Left.name + head = p.left.name body = [] - for s in p.Right: + for s in p.right: body.append(s.Name) productions.append({'Head': head, 'Body': body}) @@ -378,6 +453,17 @@ def to_json(self): # [{'Head':p.Left.Name, "Body": [s.Name for s in p.Right]} for p in self.Productions] return json.dumps(d) + @property + def is_augmented_grammar(self): + augmented = 0 + for left, _ in self.productions: + if self.start_symbol == left: + augmented += 1 + if augmented <= 1: + return True + else: + return False + @staticmethod def from_json(data): data = json.loads(data) @@ -397,46 +483,36 @@ def from_json(data): return G - def copy(self): - G = Grammar() - G.productions = self.productions.copy() - G.non_terminals = self.non_terminals.copy() - G.terminals = self.terminals.copy() - G.production_type = self.production_type - G.start_symbol = self.start_symbol - G.EPSILON = self.EPSILON - G.EOF = self.EOF - G.symbol_dict = self.symbol_dict.copy() + def __getitem__(self, item): + try: + try: + return self.symbol_dict[item] + except KeyError: + return self.production_dict[item] + except KeyError: + return None - return G + def __str__(self): - @property - def IsAugmentedGrammar(self): - augmented = 0 - for left, _ in self.productions: - if self.start_symbol == left: - augmented += 1 - if augmented <= 1: - return True - else: - return False + mul = '%s, ' - def AugmentedGrammar(self, force=False): - if not self.IsAugmentedGrammar or force: + ans = 'Non-Terminals:\n\t' - G = self.copy() - # S, self.startSymbol, SS = self.startSymbol, None, self.NonTerminal('S\'', True) - S = G.start_symbol - G.start_symbol = None - SS = G.add_non_terminal('S\'', True) - if G.production_type is AttributeProduction: - SS %= S + G.EPSILON, lambda x: x - else: - SS %= S + G.EPSILON + nonterminals = mul * (len(self.non_terminals) - 1) + '%s\n' - return G - else: - return self.copy() + ans += nonterminals % tuple(self.non_terminals) + + ans += 'Terminals:\n\t' + + terminals = mul * (len(self.terminals) - 1) + '%s\n' + + ans += terminals % tuple(self.terminals) + + ans += 'Productions:\n\t' + + ans += str(self.productions) + + return ans class Item: @@ -445,16 +521,16 @@ def __init__(self, production: Production, pos: int, lookaheads: Iterable[Symbol lookaheads = [] self.production: Production = production self.pos: int = pos - self.lookaheads: FrozenSet[Symbol] = frozenset(look for look in lookaheads) + self.lookaheads: FrozenSet[Symbol] = frozenset(lookaheads) def __str__(self): - s = str(self.production.Left) + " -> " - if len(self.production.Right) > 0: - for i, _ in enumerate(self.production.Right): + s = str(self.production.left) + " -> " + if len(self.production.right) > 0: + for i, _ in enumerate(self.production.right): if i == self.pos: s += "." - s += str(self.production.Right[i]) - if self.pos == len(self.production.Right): + s += str(self.production.right[i]) + " " + if self.pos == len(self.production.right): s += "." else: s += "." @@ -476,24 +552,51 @@ def __hash__(self): @property def IsReduceItem(self) -> bool: - return len(self.production.Right) == self.pos + return len(self.production.right) == self.pos @property def NextSymbol(self) -> Optional[Symbol]: - if self.pos < len(self.production.Right): - return self.production.Right[self.pos] + if self.pos < len(self.production.right): + return self.production.right[self.pos] else: return None def NextItem(self) -> Optional['Item']: - if self.pos < len(self.production.Right): + if self.pos < len(self.production.right): return Item(self.production, self.pos + 1, self.lookaheads) else: return None def Preview(self, skip=1) -> List[Symbol]: - unseen = self.production.Right[self.pos + skip:] + unseen = self.production.right[self.pos + skip:] return [unseen + (lookahead,) for lookahead in self.lookaheads] def Center(self) -> 'Item': return Item(self.production, self.pos) + + +class RuleList: + def __init__(self, parser, rules): + self.__parser = parser + self.__list = rules + + def __iter__(self): + return iter(self.__list) + + def __getitem__(self, item): + return self.__list[item] + + def __setitem__(self, key, value): + self.__list[key] = value + + def lineno(self, index): + pass + + def success(self): + pass + + def warning(self): + pass + + def error(self): + pass diff --git a/grammar.py b/grammar.py index fab09d962..54a972704 100644 --- a/grammar.py +++ b/grammar.py @@ -1,7 +1,7 @@ -import astnodes as ast -import time +import inspect -from cmp.parsing import LALR1Parser +import astnodes as ast +from cmp.parsing.parsing import LALR1Parser from cmp.pycompiler import Grammar G = Grammar() @@ -9,7 +9,7 @@ ################# # Non-Terminals # ################# -program = G.add_non_terminal('program', startSymbol=True) +program = G.add_non_terminal('program', start_symbol=True) class_list = G.add_non_terminal('class-list') class_def = G.add_non_terminal('class-def') feature_list = G.add_non_terminal('feature-list') @@ -31,65 +31,59 @@ ############### # identifiers # ############### -G.add_terminal('id') -G.add_terminal('type') +G.add_terminal('id', regex=r'[a-z][a-zA-Z0-9_]*') +G.add_terminal('type', regex=r'[A-Z][a-zA-Z0-9_]*') ############### # Basic Types # ############### -G.add_terminal('string') -G.add_terminal('integer') -G.add_terminal('boolean') +G.add_terminal('string', regex=r'\"[^\"]*\"') +G.add_terminal('integer', regex=r'-?\d+') +G.add_terminal('char', regex=r'\'[^\']*\'') ########### # Symbols # ########### -G.add_terminal('{') -G.add_terminal('}') -G.add_terminal('(') -G.add_terminal(')') -G.add_terminal(',') -G.add_terminal('.') -G.add_terminal('@') -G.add_terminal(':') -G.add_terminal(';') -G.add_terminal('<-') -G.add_terminal('=>') +G.add_terminals('{ } ( ) . , : ; @ <- =>') ############ # Keywords # ############ -G.add_terminal('class') -G.add_terminal('inherits') -G.add_terminal('if') -G.add_terminal('then') -G.add_terminal('else') -G.add_terminal('fi') -G.add_terminal('while') -G.add_terminal('loop') -G.add_terminal('pool') -G.add_terminal('let') -G.add_terminal('in') -G.add_terminal('case') -G.add_terminal('esac') -G.add_terminal('of') -G.add_terminal('new') -G.add_terminal('isvoid') -G.add_terminal('true') -G.add_terminal('false') +G.add_terminals('class inherits if then else fi while loop pool let in case of esac new isvoid true false') ############# # Operators # ############# -G.add_terminal('+') -G.add_terminal('-') -G.add_terminal('*') -G.add_terminal('/') -G.add_terminal('<') -G.add_terminal('<=') -G.add_terminal('=') -G.add_terminal('~') -G.add_terminal('not') +G.add_terminals('+ - * / < <= = ~ not') + + +################## +# Ignored Tokens # +################## +@G.terminal('newline', r'\n+') +def newline(lexer): + lexer.lineno += len(lexer.token.lex) + lexer.position += len(lexer.token.lex) + lexer.column = 0 + + +@G.terminal('whitespace', r' +') +def whitespace(lexer): + lexer.column += len(lexer.token.lex) + lexer.position += len(lexer.token.lex) + + +@G.terminal('tabulation', r'\t+') +def tab(lexer): + lexer.column += 4 * len(lexer.token.lex) + lexer.position += len(lexer.token.lex) + + +@G.lexical_error +def lexical_error(lexer): + lexer.print_error(f'{lexer.lineno, lexer.column} -LexicographicError: ERROR "{lexer.token.lex}"\n') + lexer.position += 1 + lexer.column += 1 ############### @@ -169,15 +163,22 @@ expr_list %= 'expr', lambda s: [s[1]] expr_list %= 'expr , expr-list', lambda s: [s[1]] + s[3] +##################### +# Error Productions # +##################### +G.add_terminal_error() + -def cool_parser(): - return LALR1Parser(G) +@G.production("attribute -> id : type error") +def attribute_error(s): + s.error(f"{s[3].line, s[3].column} - SyntacticError: Expected ';' instead of '{s[3].lex}'") + return ast.AttrDeclarationNode(s[1], s[3]) if __name__ == '__main__': + import time + t = time.time() - parser = cool_parser() - print('Building Time :', time.time() - t, 'seconds') - print('Action Table Entries :', len(parser.action)) - print('Got Table Entries :', len(parser.goto)) - print('Presents Conflicts :', parser.conflicts is not None) + G.serialize_lexer('CoolLexer', inspect.getmodulename(__file__)) + G.serialize_parser(LALR1Parser(G), 'CoolParser', inspect.getmodulename(__file__)) + print(time.time() - t) diff --git a/lexer.py b/lexer.py index cec0a6fcb..5b48f6bdc 100644 --- a/lexer.py +++ b/lexer.py @@ -1,79 +1,20 @@ -from cmp.parsing import Lexer +import re +from cmp.parsing.lexing import Token, Lexer +from grammar import G -class CoolLexer(Lexer): - """ - Specialized lexer for COOL programing language. - - This derived from cmp.parsing.lexer.Lexer - """ - def __init__(self, G): - """ - Receive a Grammar to take it terminals as token types - - :param G: cmp.pycompiler.Grammar - """ - self.G = G - super().__init__(self._table, G.EOF, self._skip_chars) - - @property - def _skip_chars(self): - def newline(lexer): - lexer.lineno += 1 - lexer.column = 0 - def whitespace(lexer): - lexer.column += 1 - - def tab(lexer): - lexer.column += 4 - - return {' ': whitespace, '\n': newline, '\t': tab} - - @property - def _table(self): - G = self.G - return { - 'int': (G['integer'], '-?[1-9][0-9]*'), - 'add': (G['+'], '\+'), - 'sub': (G['-'], '-'), - 'mul': (G['*'], '\*'), - 'div': (G['/'], '/'), - 'le': (G['<='], '<='), - 'assign': (G['<-'], '<-'), - 'lt': (G['<'], '<'), - 'eq': (G['='], '='), - 'comp': (G['~'], '~'), - 'not': (G['not'], 'not'), - 'ocur': (G['{'], '{'), - 'ccur': (G['}'], '}'), - 'opar': (G['('], '\('), - 'cpar': (G[')'], '\)'), - 'coma': (G[','], ','), - 'dot': (G['.'], '\.'), - 'arroba': (G['@'], '@'), - 'colon': (G[':'], ':'), - 'semicolon': (G[';'], ';'), - 'arrow': (G['=>'], '=>'), - 'class': (G['class'], 'class'), - 'inherits': (G['inherits'], 'inherits'), - 'if': (G['if'], 'if'), - 'then': (G['then'], 'then'), - 'else': (G['else'], 'else'), - 'fi': (G['fi'], 'fi'), - 'while': (G['while'], 'while'), - 'loop': (G['loop'], 'loop'), - 'pool': (G['pool'], 'pool'), - 'let': (G['let'], 'let'), - 'in': (G['in'], 'in'), - 'case': (G['case'], 'case'), - 'esac': (G['esac'], 'esac'), - 'of': (G['of'], 'of'), - 'new': (G['new'], 'new'), - 'isvoid': (G['isvoid'], 'isvoid'), - 'true': (G['true'], 'true'), - 'false': (G['false'], 'false'), - 'type': (G['type'], '[A-Z][a-zA-Z0-9]*'), - 'id': (G['id'], '[a-z][a-zA-Z0-9]*'), - 'string': (G['string'], '".*"'), - } +class CoolLexer(Lexer): + def __init__(self): + self.lineno = 0 + self.column = 0 + self.position = 0 + self.token = Token('', '', 0, 0) + self.pattern = re.compile(r'(?P\n+)|(?P +)|(?P\t+)|(inherits)|(isvoid)|(class)|(while)|(false)|(then)|(else)|(loop)|(pool)|(case)|(esac)|(true)|(<\-)|(let)|(new)|(not)|(\{)|(\})|(\()|(\))|(\.)|(=>)|(if)|(fi)|(in)|(of)|(\+)|(\-)|(\*)|(<=)|(\~)|(,)|(:)|(;)|(@)|(/)|(<)|(=)|(?P[a-z][a-zA-Z0-9_]*)|(?P[A-Z][a-zA-Z0-9_]*)|(?P\"[^\"]*\")|(?P-?\d+)|(?P\'[^\']*\')') + self.token_rules = {key: rule for key, (_, _, rule) in G.terminal_rules.items() if rule is not None} + self.error_handler = G.lexical_error_handler if G.lexical_error_handler is not None else self.error + self.contain_errors = False + self.eof = '$' + + def __call__(self, text): + return [Token(t.lex, G[t.token_type], t.line, t.column) for t in self.tokenize(text)] diff --git a/main.py b/main.py index 3d6e199c9..e69de29bb 100644 --- a/main.py +++ b/main.py @@ -1,10 +0,0 @@ -from grammar import cool_grammar -from parser import CoolParser - -if __name__ == '__main__': - import time - G = cool_grammar() - - t = time.time() - CoolParser(G) - print(time.time() - t) diff --git a/output.txt b/output.txt new file mode 100644 index 000000000..1399e1914 --- /dev/null +++ b/output.txt @@ -0,0 +1,2 @@ +\'[^\'\']\' +\'[^\'\']\' diff --git a/parser.py b/parser.py index 191c38472..ac619aca3 100644 --- a/parser.py +++ b/parser.py @@ -1,6 +1,5 @@ from abc import ABC - -from cmp.parsing import ShiftReduceParser +from cmp.parsing.parsing import ShiftReduceParser from grammar import G @@ -11,19 +10,19 @@ def __init__(self, verbose=False): self.action = self.__action_table() self.goto = self.__goto_table() - @staticmethod - def __action_table(): + def __action_table(self): + G = self.G return { (0, G["class"]): ("SHIFT", 1), (1, G["type"]): ("SHIFT", 2), - (2, G["inherits"]): ("SHIFT", 136), (2, G["{"]): ("SHIFT", 3), + (2, G["inherits"]): ("SHIFT", 137), (3, G["id"]): ("SHIFT", 4), (3, G["}"]): ("REDUCE", G["feature-list -> e"]), (4, G[":"]): ("SHIFT", 124), (4, G["("]): ("SHIFT", 5), - (5, G["id"]): ("SHIFT", 6), (5, G[")"]): ("SHIFT", 11), + (5, G["id"]): ("SHIFT", 6), (6, G[":"]): ("SHIFT", 7), (7, G["type"]): ("SHIFT", 8), (8, G[")"]): ("REDUCE", G["param-list -> id : type"]), @@ -35,978 +34,966 @@ def __action_table(): (13, G["{"]): ("SHIFT", 14), (14, G["id"]): ("SHIFT", 15), (14, G["let"]): ("SHIFT", 23), - (14, G["integer"]): ("SHIFT", 18), - (14, G["not"]): ("SHIFT", 44), - (14, G["string"]): ("SHIFT", 17), - (14, G["isvoid"]): ("SHIFT", 33), (14, G["~"]): ("SHIFT", 37), - (14, G["while"]): ("SHIFT", 22), - (14, G["false"]): ("SHIFT", 36), - (14, G["if"]): ("SHIFT", 21), + (14, G["not"]): ("SHIFT", 44), (14, G["new"]): ("SHIFT", 31), - (14, G["true"]): ("SHIFT", 35), - (14, G["("]): ("SHIFT", 20), - (14, G["{"]): ("SHIFT", 19), + (14, G["false"]): ("SHIFT", 36), + (14, G["while"]): ("SHIFT", 22), (14, G["case"]): ("SHIFT", 30), - (15, G["("]): ("SHIFT", 16), + (14, G["{"]): ("SHIFT", 19), + (14, G["("]): ("SHIFT", 20), + (14, G["true"]): ("SHIFT", 35), + (14, G["integer"]): ("SHIFT", 18), + (14, G["string"]): ("SHIFT", 17), + (14, G["if"]): ("SHIFT", 21), + (14, G["isvoid"]): ("SHIFT", 33), + (15, G[";"]): ("REDUCE", G["atom -> id"]), + (15, G["@"]): ("REDUCE", G["atom -> id"]), (15, G["loop"]): ("REDUCE", G["atom -> id"]), (15, G["pool"]): ("REDUCE", G["atom -> id"]), - (15, G["in"]): ("REDUCE", G["atom -> id"]), - (15, G["of"]): ("REDUCE", G["atom -> id"]), + (15, G["<="]): ("REDUCE", G["atom -> id"]), (15, G["+"]): ("REDUCE", G["atom -> id"]), + (15, G["in"]): ("REDUCE", G["atom -> id"]), (15, G["-"]): ("REDUCE", G["atom -> id"]), + (15, G["}"]): ("REDUCE", G["atom -> id"]), + (15, G["then"]): ("REDUCE", G["atom -> id"]), (15, G["*"]): ("REDUCE", G["atom -> id"]), + (15, G["of"]): ("REDUCE", G["atom -> id"]), + (15, G[","]): ("REDUCE", G["atom -> id"]), (15, G["/"]): ("REDUCE", G["atom -> id"]), + (15, G["else"]): ("REDUCE", G["atom -> id"]), (15, G["<"]): ("REDUCE", G["atom -> id"]), - (15, G["<="]): ("REDUCE", G["atom -> id"]), - (15, G["="]): ("REDUCE", G["atom -> id"]), - (15, G["}"]): ("REDUCE", G["atom -> id"]), (15, G[")"]): ("REDUCE", G["atom -> id"]), - (15, G[","]): ("REDUCE", G["atom -> id"]), - (15, G["."]): ("REDUCE", G["atom -> id"]), - (15, G["@"]): ("REDUCE", G["atom -> id"]), - (15, G[";"]): ("REDUCE", G["atom -> id"]), - (15, G["then"]): ("REDUCE", G["atom -> id"]), - (15, G["else"]): ("REDUCE", G["atom -> id"]), (15, G["fi"]): ("REDUCE", G["atom -> id"]), + (15, G["."]): ("REDUCE", G["atom -> id"]), + (15, G["="]): ("REDUCE", G["atom -> id"]), (15, G["<-"]): ("SHIFT", 113), - (16, G["true"]): ("SHIFT", 35), + (15, G["("]): ("SHIFT", 16), + (16, G["case"]): ("SHIFT", 30), (16, G["{"]): ("SHIFT", 19), + (16, G["new"]): ("SHIFT", 31), (16, G["id"]): ("SHIFT", 15), (16, G["false"]): ("SHIFT", 36), - (16, G["~"]): ("SHIFT", 37), - (16, G["new"]): ("SHIFT", 31), - (16, G["if"]): ("SHIFT", 21), - (16, G["let"]): ("SHIFT", 23), - (16, G["string"]): ("SHIFT", 17), - (16, G["("]): ("SHIFT", 20), (16, G["while"]): ("SHIFT", 22), - (16, G["not"]): ("SHIFT", 44), + (16, G["let"]): ("SHIFT", 23), (16, G["isvoid"]): ("SHIFT", 33), - (16, G["case"]): ("SHIFT", 30), + (16, G["~"]): ("SHIFT", 37), + (16, G["string"]): ("SHIFT", 17), + (16, G["if"]): ("SHIFT", 21), + (16, G["true"]): ("SHIFT", 35), (16, G["integer"]): ("SHIFT", 18), + (16, G["not"]): ("SHIFT", 44), + (16, G["("]): ("SHIFT", 20), + (17, G[";"]): ("REDUCE", G["atom -> string"]), + (17, G["@"]): ("REDUCE", G["atom -> string"]), (17, G["loop"]): ("REDUCE", G["atom -> string"]), (17, G["pool"]): ("REDUCE", G["atom -> string"]), - (17, G["in"]): ("REDUCE", G["atom -> string"]), - (17, G["of"]): ("REDUCE", G["atom -> string"]), + (17, G["<="]): ("REDUCE", G["atom -> string"]), (17, G["+"]): ("REDUCE", G["atom -> string"]), + (17, G["in"]): ("REDUCE", G["atom -> string"]), + (17, G["}"]): ("REDUCE", G["atom -> string"]), (17, G["-"]): ("REDUCE", G["atom -> string"]), + (17, G["then"]): ("REDUCE", G["atom -> string"]), (17, G["*"]): ("REDUCE", G["atom -> string"]), + (17, G["of"]): ("REDUCE", G["atom -> string"]), + (17, G[","]): ("REDUCE", G["atom -> string"]), (17, G["/"]): ("REDUCE", G["atom -> string"]), + (17, G["else"]): ("REDUCE", G["atom -> string"]), (17, G["<"]): ("REDUCE", G["atom -> string"]), - (17, G["<="]): ("REDUCE", G["atom -> string"]), - (17, G["="]): ("REDUCE", G["atom -> string"]), - (17, G["}"]): ("REDUCE", G["atom -> string"]), (17, G[")"]): ("REDUCE", G["atom -> string"]), - (17, G[","]): ("REDUCE", G["atom -> string"]), - (17, G["."]): ("REDUCE", G["atom -> string"]), - (17, G["@"]): ("REDUCE", G["atom -> string"]), - (17, G[";"]): ("REDUCE", G["atom -> string"]), - (17, G["then"]): ("REDUCE", G["atom -> string"]), - (17, G["else"]): ("REDUCE", G["atom -> string"]), (17, G["fi"]): ("REDUCE", G["atom -> string"]), + (17, G["."]): ("REDUCE", G["atom -> string"]), + (17, G["="]): ("REDUCE", G["atom -> string"]), + (18, G[";"]): ("REDUCE", G["atom -> integer"]), + (18, G["@"]): ("REDUCE", G["atom -> integer"]), (18, G["loop"]): ("REDUCE", G["atom -> integer"]), (18, G["pool"]): ("REDUCE", G["atom -> integer"]), - (18, G["in"]): ("REDUCE", G["atom -> integer"]), - (18, G["of"]): ("REDUCE", G["atom -> integer"]), + (18, G["."]): ("REDUCE", G["atom -> integer"]), (18, G["+"]): ("REDUCE", G["atom -> integer"]), + (18, G["in"]): ("REDUCE", G["atom -> integer"]), (18, G["-"]): ("REDUCE", G["atom -> integer"]), + (18, G["}"]): ("REDUCE", G["atom -> integer"]), + (18, G["then"]): ("REDUCE", G["atom -> integer"]), (18, G["*"]): ("REDUCE", G["atom -> integer"]), + (18, G["of"]): ("REDUCE", G["atom -> integer"]), + (18, G[","]): ("REDUCE", G["atom -> integer"]), (18, G["/"]): ("REDUCE", G["atom -> integer"]), + (18, G["else"]): ("REDUCE", G["atom -> integer"]), (18, G["<"]): ("REDUCE", G["atom -> integer"]), - (18, G["<="]): ("REDUCE", G["atom -> integer"]), - (18, G["="]): ("REDUCE", G["atom -> integer"]), - (18, G["}"]): ("REDUCE", G["atom -> integer"]), (18, G[")"]): ("REDUCE", G["atom -> integer"]), - (18, G[","]): ("REDUCE", G["atom -> integer"]), - (18, G["."]): ("REDUCE", G["atom -> integer"]), - (18, G["@"]): ("REDUCE", G["atom -> integer"]), - (18, G[";"]): ("REDUCE", G["atom -> integer"]), - (18, G["then"]): ("REDUCE", G["atom -> integer"]), - (18, G["else"]): ("REDUCE", G["atom -> integer"]), (18, G["fi"]): ("REDUCE", G["atom -> integer"]), + (18, G["<="]): ("REDUCE", G["atom -> integer"]), + (18, G["="]): ("REDUCE", G["atom -> integer"]), (19, G["string"]): ("SHIFT", 17), - (19, G["integer"]): ("SHIFT", 18), - (19, G["{"]): ("SHIFT", 19), - (19, G["new"]): ("SHIFT", 31), - (19, G["~"]): ("SHIFT", 37), - (19, G["isvoid"]): ("SHIFT", 33), - (19, G["if"]): ("SHIFT", 21), - (19, G["false"]): ("SHIFT", 36), (19, G["id"]): ("SHIFT", 15), - (19, G["while"]): ("SHIFT", 22), + (19, G["true"]): ("SHIFT", 35), + (19, G["integer"]): ("SHIFT", 18), (19, G["not"]): ("SHIFT", 44), + (19, G["if"]): ("SHIFT", 21), (19, G["("]): ("SHIFT", 20), - (19, G["true"]): ("SHIFT", 35), + (19, G["new"]): ("SHIFT", 31), (19, G["let"]): ("SHIFT", 23), + (19, G["{"]): ("SHIFT", 19), (19, G["case"]): ("SHIFT", 30), - (20, G["id"]): ("SHIFT", 15), - (20, G["integer"]): ("SHIFT", 18), - (20, G["not"]): ("SHIFT", 44), - (20, G["string"]): ("SHIFT", 17), - (20, G["case"]): ("SHIFT", 30), + (19, G["false"]): ("SHIFT", 36), + (19, G["isvoid"]): ("SHIFT", 33), + (19, G["while"]): ("SHIFT", 22), + (19, G["~"]): ("SHIFT", 37), + (20, G["false"]): ("SHIFT", 36), (20, G["while"]): ("SHIFT", 22), - (20, G["~"]): ("SHIFT", 37), + (20, G["let"]): ("SHIFT", 23), + (20, G["case"]): ("SHIFT", 30), + (20, G["id"]): ("SHIFT", 15), (20, G["new"]): ("SHIFT", 31), - (20, G["isvoid"]): ("SHIFT", 33), - (20, G["false"]): ("SHIFT", 36), (20, G["{"]): ("SHIFT", 19), - (20, G["("]): ("SHIFT", 20), (20, G["if"]): ("SHIFT", 21), - (20, G["let"]): ("SHIFT", 23), + (20, G["integer"]): ("SHIFT", 18), (20, G["true"]): ("SHIFT", 35), - (21, G["{"]): ("SHIFT", 19), + (20, G["isvoid"]): ("SHIFT", 33), + (20, G["("]): ("SHIFT", 20), + (20, G["not"]): ("SHIFT", 44), + (20, G["~"]): ("SHIFT", 37), + (20, G["string"]): ("SHIFT", 17), (21, G["isvoid"]): ("SHIFT", 33), - (21, G["case"]): ("SHIFT", 30), - (21, G["integer"]): ("SHIFT", 18), - (21, G["false"]): ("SHIFT", 36), - (21, G["~"]): ("SHIFT", 37), (21, G["string"]): ("SHIFT", 17), - (21, G["not"]): ("SHIFT", 44), (21, G["if"]): ("SHIFT", 21), - (21, G["id"]): ("SHIFT", 15), - (21, G["while"]): ("SHIFT", 22), (21, G["("]): ("SHIFT", 20), + (21, G["id"]): ("SHIFT", 15), (21, G["true"]): ("SHIFT", 35), - (21, G["let"]): ("SHIFT", 23), + (21, G["integer"]): ("SHIFT", 18), + (21, G["{"]): ("SHIFT", 19), + (21, G["not"]): ("SHIFT", 44), + (21, G["while"]): ("SHIFT", 22), + (21, G["case"]): ("SHIFT", 30), + (21, G["~"]): ("SHIFT", 37), (21, G["new"]): ("SHIFT", 31), - (22, G["let"]): ("SHIFT", 23), + (21, G["false"]): ("SHIFT", 36), + (21, G["let"]): ("SHIFT", 23), + (22, G["id"]): ("SHIFT", 15), (22, G["isvoid"]): ("SHIFT", 33), + (22, G["("]): ("SHIFT", 20), (22, G["not"]): ("SHIFT", 44), - (22, G["while"]): ("SHIFT", 22), - (22, G["id"]): ("SHIFT", 15), - (22, G["string"]): ("SHIFT", 17), + (22, G["~"]): ("SHIFT", 37), (22, G["if"]): ("SHIFT", 21), - (22, G["("]): ("SHIFT", 20), + (22, G["string"]): ("SHIFT", 17), (22, G["false"]): ("SHIFT", 36), - (22, G["~"]): ("SHIFT", 37), + (22, G["while"]): ("SHIFT", 22), + (22, G["let"]): ("SHIFT", 23), + (22, G["case"]): ("SHIFT", 30), (22, G["new"]): ("SHIFT", 31), - (22, G["true"]): ("SHIFT", 35), (22, G["{"]): ("SHIFT", 19), (22, G["integer"]): ("SHIFT", 18), - (22, G["case"]): ("SHIFT", 30), + (22, G["true"]): ("SHIFT", 35), (23, G["id"]): ("SHIFT", 24), (24, G[":"]): ("SHIFT", 25), (25, G["type"]): ("SHIFT", 26), (26, G["<-"]): ("SHIFT", 29), - (26, G[","]): ("SHIFT", 27), (26, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), + (26, G[","]): ("SHIFT", 27), (27, G["id"]): ("SHIFT", 24), (28, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), - (29, G["{"]): ("SHIFT", 19), + (29, G["new"]): ("SHIFT", 31), + (29, G["string"]): ("SHIFT", 17), + (29, G["true"]): ("SHIFT", 35), (29, G["integer"]): ("SHIFT", 18), - (29, G["if"]): ("SHIFT", 21), (29, G["let"]): ("SHIFT", 23), - (29, G["~"]): ("SHIFT", 37), - (29, G["("]): ("SHIFT", 20), - (29, G["string"]): ("SHIFT", 17), + (29, G["{"]): ("SHIFT", 19), + (29, G["case"]): ("SHIFT", 30), (29, G["id"]): ("SHIFT", 15), - (29, G["false"]): ("SHIFT", 36), (29, G["while"]): ("SHIFT", 22), - (29, G["case"]): ("SHIFT", 30), (29, G["not"]): ("SHIFT", 44), + (29, G["if"]): ("SHIFT", 21), (29, G["isvoid"]): ("SHIFT", 33), - (29, G["new"]): ("SHIFT", 31), - (29, G["true"]): ("SHIFT", 35), - (30, G["case"]): ("SHIFT", 30), - (30, G["("]): ("SHIFT", 20), - (30, G["new"]): ("SHIFT", 31), - (30, G["string"]): ("SHIFT", 17), + (29, G["~"]): ("SHIFT", 37), + (29, G["("]): ("SHIFT", 20), + (29, G["false"]): ("SHIFT", 36), (30, G["let"]): ("SHIFT", 23), - (30, G["isvoid"]): ("SHIFT", 33), - (30, G["while"]): ("SHIFT", 22), - (30, G["not"]): ("SHIFT", 44), (30, G["true"]): ("SHIFT", 35), (30, G["integer"]): ("SHIFT", 18), + (30, G["not"]): ("SHIFT", 44), + (30, G["~"]): ("SHIFT", 37), (30, G["id"]): ("SHIFT", 15), - (30, G["if"]): ("SHIFT", 21), + (30, G["isvoid"]): ("SHIFT", 33), + (30, G["string"]): ("SHIFT", 17), + (30, G["new"]): ("SHIFT", 31), + (30, G["("]): ("SHIFT", 20), (30, G["false"]): ("SHIFT", 36), - (30, G["~"]): ("SHIFT", 37), (30, G["{"]): ("SHIFT", 19), + (30, G["while"]): ("SHIFT", 22), + (30, G["case"]): ("SHIFT", 30), + (30, G["if"]): ("SHIFT", 21), (31, G["type"]): ("SHIFT", 32), + (32, G[";"]): ("REDUCE", G["atom -> new type"]), + (32, G["@"]): ("REDUCE", G["atom -> new type"]), (32, G["loop"]): ("REDUCE", G["atom -> new type"]), (32, G["pool"]): ("REDUCE", G["atom -> new type"]), - (32, G["in"]): ("REDUCE", G["atom -> new type"]), - (32, G["of"]): ("REDUCE", G["atom -> new type"]), + (32, G["<="]): ("REDUCE", G["atom -> new type"]), (32, G["+"]): ("REDUCE", G["atom -> new type"]), + (32, G["in"]): ("REDUCE", G["atom -> new type"]), + (32, G["}"]): ("REDUCE", G["atom -> new type"]), (32, G["-"]): ("REDUCE", G["atom -> new type"]), + (32, G["="]): ("REDUCE", G["atom -> new type"]), + (32, G["then"]): ("REDUCE", G["atom -> new type"]), (32, G["*"]): ("REDUCE", G["atom -> new type"]), + (32, G["of"]): ("REDUCE", G["atom -> new type"]), (32, G["/"]): ("REDUCE", G["atom -> new type"]), + (32, G["else"]): ("REDUCE", G["atom -> new type"]), (32, G["<"]): ("REDUCE", G["atom -> new type"]), - (32, G["<="]): ("REDUCE", G["atom -> new type"]), - (32, G["="]): ("REDUCE", G["atom -> new type"]), - (32, G["}"]): ("REDUCE", G["atom -> new type"]), (32, G[")"]): ("REDUCE", G["atom -> new type"]), - (32, G[","]): ("REDUCE", G["atom -> new type"]), - (32, G["."]): ("REDUCE", G["atom -> new type"]), - (32, G["@"]): ("REDUCE", G["atom -> new type"]), - (32, G[";"]): ("REDUCE", G["atom -> new type"]), - (32, G["then"]): ("REDUCE", G["atom -> new type"]), - (32, G["else"]): ("REDUCE", G["atom -> new type"]), (32, G["fi"]): ("REDUCE", G["atom -> new type"]), - (33, G["false"]): ("SHIFT", 36), + (32, G["."]): ("REDUCE", G["atom -> new type"]), + (32, G[","]): ("REDUCE", G["atom -> new type"]), + (33, G["~"]): ("SHIFT", 37), (33, G["isvoid"]): ("SHIFT", 33), - (33, G["("]): ("SHIFT", 20), (33, G["id"]): ("SHIFT", 34), (33, G["integer"]): ("SHIFT", 18), + (33, G["true"]): ("SHIFT", 35), + (33, G["false"]): ("SHIFT", 36), + (33, G["("]): ("SHIFT", 20), (33, G["string"]): ("SHIFT", 17), (33, G["new"]): ("SHIFT", 31), - (33, G["~"]): ("SHIFT", 37), - (33, G["true"]): ("SHIFT", 35), - (34, G["("]): ("SHIFT", 16), + (34, G[";"]): ("REDUCE", G["atom -> id"]), + (34, G["@"]): ("REDUCE", G["atom -> id"]), (34, G["loop"]): ("REDUCE", G["atom -> id"]), (34, G["pool"]): ("REDUCE", G["atom -> id"]), - (34, G["in"]): ("REDUCE", G["atom -> id"]), - (34, G["of"]): ("REDUCE", G["atom -> id"]), + (34, G["<="]): ("REDUCE", G["atom -> id"]), (34, G["+"]): ("REDUCE", G["atom -> id"]), + (34, G["in"]): ("REDUCE", G["atom -> id"]), (34, G["-"]): ("REDUCE", G["atom -> id"]), + (34, G["}"]): ("REDUCE", G["atom -> id"]), + (34, G["="]): ("REDUCE", G["atom -> id"]), + (34, G["then"]): ("REDUCE", G["atom -> id"]), (34, G["*"]): ("REDUCE", G["atom -> id"]), + (34, G["of"]): ("REDUCE", G["atom -> id"]), (34, G["/"]): ("REDUCE", G["atom -> id"]), + (34, G["else"]): ("REDUCE", G["atom -> id"]), (34, G["<"]): ("REDUCE", G["atom -> id"]), - (34, G["<="]): ("REDUCE", G["atom -> id"]), - (34, G["="]): ("REDUCE", G["atom -> id"]), - (34, G["}"]): ("REDUCE", G["atom -> id"]), (34, G[")"]): ("REDUCE", G["atom -> id"]), - (34, G[","]): ("REDUCE", G["atom -> id"]), - (34, G["."]): ("REDUCE", G["atom -> id"]), - (34, G["@"]): ("REDUCE", G["atom -> id"]), - (34, G[";"]): ("REDUCE", G["atom -> id"]), - (34, G["then"]): ("REDUCE", G["atom -> id"]), - (34, G["else"]): ("REDUCE", G["atom -> id"]), (34, G["fi"]): ("REDUCE", G["atom -> id"]), + (34, G["."]): ("REDUCE", G["atom -> id"]), + (34, G[","]): ("REDUCE", G["atom -> id"]), + (34, G["("]): ("SHIFT", 16), + (35, G[";"]): ("REDUCE", G["atom -> true"]), + (35, G["@"]): ("REDUCE", G["atom -> true"]), (35, G["loop"]): ("REDUCE", G["atom -> true"]), (35, G["pool"]): ("REDUCE", G["atom -> true"]), - (35, G["in"]): ("REDUCE", G["atom -> true"]), - (35, G["of"]): ("REDUCE", G["atom -> true"]), + (35, G["<="]): ("REDUCE", G["atom -> true"]), (35, G["+"]): ("REDUCE", G["atom -> true"]), + (35, G["in"]): ("REDUCE", G["atom -> true"]), (35, G["-"]): ("REDUCE", G["atom -> true"]), + (35, G["}"]): ("REDUCE", G["atom -> true"]), + (35, G["then"]): ("REDUCE", G["atom -> true"]), (35, G["*"]): ("REDUCE", G["atom -> true"]), + (35, G["of"]): ("REDUCE", G["atom -> true"]), + (35, G[","]): ("REDUCE", G["atom -> true"]), (35, G["/"]): ("REDUCE", G["atom -> true"]), + (35, G["else"]): ("REDUCE", G["atom -> true"]), (35, G["<"]): ("REDUCE", G["atom -> true"]), - (35, G["<="]): ("REDUCE", G["atom -> true"]), - (35, G["="]): ("REDUCE", G["atom -> true"]), - (35, G["}"]): ("REDUCE", G["atom -> true"]), (35, G[")"]): ("REDUCE", G["atom -> true"]), - (35, G[","]): ("REDUCE", G["atom -> true"]), - (35, G["."]): ("REDUCE", G["atom -> true"]), - (35, G["@"]): ("REDUCE", G["atom -> true"]), - (35, G[";"]): ("REDUCE", G["atom -> true"]), - (35, G["then"]): ("REDUCE", G["atom -> true"]), - (35, G["else"]): ("REDUCE", G["atom -> true"]), (35, G["fi"]): ("REDUCE", G["atom -> true"]), + (35, G["."]): ("REDUCE", G["atom -> true"]), + (35, G["="]): ("REDUCE", G["atom -> true"]), + (36, G[";"]): ("REDUCE", G["atom -> false"]), + (36, G["@"]): ("REDUCE", G["atom -> false"]), (36, G["loop"]): ("REDUCE", G["atom -> false"]), (36, G["pool"]): ("REDUCE", G["atom -> false"]), - (36, G["in"]): ("REDUCE", G["atom -> false"]), - (36, G["of"]): ("REDUCE", G["atom -> false"]), + (36, G["<="]): ("REDUCE", G["atom -> false"]), (36, G["+"]): ("REDUCE", G["atom -> false"]), + (36, G["in"]): ("REDUCE", G["atom -> false"]), (36, G["-"]): ("REDUCE", G["atom -> false"]), + (36, G["}"]): ("REDUCE", G["atom -> false"]), + (36, G["then"]): ("REDUCE", G["atom -> false"]), (36, G["*"]): ("REDUCE", G["atom -> false"]), + (36, G["of"]): ("REDUCE", G["atom -> false"]), + (36, G[","]): ("REDUCE", G["atom -> false"]), (36, G["/"]): ("REDUCE", G["atom -> false"]), + (36, G["else"]): ("REDUCE", G["atom -> false"]), (36, G["<"]): ("REDUCE", G["atom -> false"]), - (36, G["<="]): ("REDUCE", G["atom -> false"]), - (36, G["="]): ("REDUCE", G["atom -> false"]), - (36, G["}"]): ("REDUCE", G["atom -> false"]), (36, G[")"]): ("REDUCE", G["atom -> false"]), - (36, G[","]): ("REDUCE", G["atom -> false"]), - (36, G["."]): ("REDUCE", G["atom -> false"]), - (36, G["@"]): ("REDUCE", G["atom -> false"]), - (36, G[";"]): ("REDUCE", G["atom -> false"]), - (36, G["then"]): ("REDUCE", G["atom -> false"]), - (36, G["else"]): ("REDUCE", G["atom -> false"]), (36, G["fi"]): ("REDUCE", G["atom -> false"]), - (37, G["false"]): ("SHIFT", 36), + (36, G["."]): ("REDUCE", G["atom -> false"]), + (36, G["="]): ("REDUCE", G["atom -> false"]), + (37, G["~"]): ("SHIFT", 37), (37, G["isvoid"]): ("SHIFT", 33), - (37, G["("]): ("SHIFT", 20), (37, G["id"]): ("SHIFT", 34), (37, G["integer"]): ("SHIFT", 18), + (37, G["true"]): ("SHIFT", 35), + (37, G["false"]): ("SHIFT", 36), + (37, G["("]): ("SHIFT", 20), (37, G["string"]): ("SHIFT", 17), (37, G["new"]): ("SHIFT", 31), - (37, G["~"]): ("SHIFT", 37), - (37, G["true"]): ("SHIFT", 35), + (38, G[";"]): ("REDUCE", G["atom -> function-call"]), + (38, G["@"]): ("REDUCE", G["atom -> function-call"]), (38, G["loop"]): ("REDUCE", G["atom -> function-call"]), (38, G["pool"]): ("REDUCE", G["atom -> function-call"]), - (38, G["in"]): ("REDUCE", G["atom -> function-call"]), - (38, G["of"]): ("REDUCE", G["atom -> function-call"]), + (38, G["."]): ("REDUCE", G["atom -> function-call"]), (38, G["+"]): ("REDUCE", G["atom -> function-call"]), + (38, G["in"]): ("REDUCE", G["atom -> function-call"]), (38, G["-"]): ("REDUCE", G["atom -> function-call"]), + (38, G["}"]): ("REDUCE", G["atom -> function-call"]), + (38, G["then"]): ("REDUCE", G["atom -> function-call"]), (38, G["*"]): ("REDUCE", G["atom -> function-call"]), + (38, G["of"]): ("REDUCE", G["atom -> function-call"]), + (38, G[","]): ("REDUCE", G["atom -> function-call"]), (38, G["/"]): ("REDUCE", G["atom -> function-call"]), + (38, G["else"]): ("REDUCE", G["atom -> function-call"]), (38, G["<"]): ("REDUCE", G["atom -> function-call"]), - (38, G["<="]): ("REDUCE", G["atom -> function-call"]), - (38, G["="]): ("REDUCE", G["atom -> function-call"]), - (38, G["}"]): ("REDUCE", G["atom -> function-call"]), (38, G[")"]): ("REDUCE", G["atom -> function-call"]), - (38, G[","]): ("REDUCE", G["atom -> function-call"]), - (38, G["."]): ("REDUCE", G["atom -> function-call"]), - (38, G["@"]): ("REDUCE", G["atom -> function-call"]), - (38, G[";"]): ("REDUCE", G["atom -> function-call"]), - (38, G["then"]): ("REDUCE", G["atom -> function-call"]), - (38, G["else"]): ("REDUCE", G["atom -> function-call"]), (38, G["fi"]): ("REDUCE", G["atom -> function-call"]), - (39, G["="]): ("REDUCE", G["factor -> ~ factor"]), + (38, G["<="]): ("REDUCE", G["atom -> function-call"]), + (38, G["="]): ("REDUCE", G["atom -> function-call"]), + (39, G[";"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["}"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["+"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G[")"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["-"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["in"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G[","]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["*"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["}"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["-"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["="]): ("REDUCE", G["factor -> ~ factor"]), (39, G["then"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["*"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["of"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["/"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["else"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["of"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["<="]): ("REDUCE", G["factor -> ~ factor"]), - (39, G[";"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["<"]): ("REDUCE", G["factor -> ~ factor"]), - (40, G["="]): ("REDUCE", G["factor -> atom"]), + (39, G[")"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["<="]): ("REDUCE", G["factor -> ~ factor"]), + (39, G[","]): ("REDUCE", G["factor -> ~ factor"]), + (40, G["."]): ("SHIFT", 41), + (40, G[";"]): ("REDUCE", G["factor -> atom"]), (40, G["loop"]): ("REDUCE", G["factor -> atom"]), - (40, G["}"]): ("REDUCE", G["factor -> atom"]), - (40, G["fi"]): ("REDUCE", G["factor -> atom"]), (40, G["pool"]): ("REDUCE", G["factor -> atom"]), (40, G["+"]): ("REDUCE", G["factor -> atom"]), - (40, G[")"]): ("REDUCE", G["factor -> atom"]), - (40, G["-"]): ("REDUCE", G["factor -> atom"]), (40, G["in"]): ("REDUCE", G["factor -> atom"]), - (40, G[","]): ("REDUCE", G["factor -> atom"]), - (40, G["*"]): ("REDUCE", G["factor -> atom"]), + (40, G["}"]): ("REDUCE", G["factor -> atom"]), + (40, G["-"]): ("REDUCE", G["factor -> atom"]), (40, G["then"]): ("REDUCE", G["factor -> atom"]), + (40, G["*"]): ("REDUCE", G["factor -> atom"]), + (40, G["of"]): ("REDUCE", G["factor -> atom"]), + (40, G[","]): ("REDUCE", G["factor -> atom"]), (40, G["/"]): ("REDUCE", G["factor -> atom"]), (40, G["else"]): ("REDUCE", G["factor -> atom"]), - (40, G["of"]): ("REDUCE", G["factor -> atom"]), - (40, G["<="]): ("REDUCE", G["factor -> atom"]), - (40, G[";"]): ("REDUCE", G["factor -> atom"]), (40, G["<"]): ("REDUCE", G["factor -> atom"]), + (40, G[")"]): ("REDUCE", G["factor -> atom"]), + (40, G["fi"]): ("REDUCE", G["factor -> atom"]), + (40, G["<="]): ("REDUCE", G["factor -> atom"]), + (40, G["="]): ("REDUCE", G["factor -> atom"]), (40, G["@"]): ("SHIFT", 69), - (40, G["."]): ("SHIFT", 41), (41, G["id"]): ("SHIFT", 42), (42, G["("]): ("SHIFT", 43), - (43, G["true"]): ("SHIFT", 35), + (43, G["case"]): ("SHIFT", 30), (43, G["{"]): ("SHIFT", 19), + (43, G["new"]): ("SHIFT", 31), (43, G["id"]): ("SHIFT", 15), (43, G["false"]): ("SHIFT", 36), - (43, G["~"]): ("SHIFT", 37), - (43, G["new"]): ("SHIFT", 31), - (43, G["if"]): ("SHIFT", 21), - (43, G["let"]): ("SHIFT", 23), - (43, G["string"]): ("SHIFT", 17), - (43, G["("]): ("SHIFT", 20), (43, G["while"]): ("SHIFT", 22), - (43, G["not"]): ("SHIFT", 44), + (43, G["let"]): ("SHIFT", 23), (43, G["isvoid"]): ("SHIFT", 33), - (43, G["case"]): ("SHIFT", 30), + (43, G["~"]): ("SHIFT", 37), + (43, G["string"]): ("SHIFT", 17), + (43, G["if"]): ("SHIFT", 21), + (43, G["true"]): ("SHIFT", 35), (43, G["integer"]): ("SHIFT", 18), + (43, G["not"]): ("SHIFT", 44), + (43, G["("]): ("SHIFT", 20), + (44, G["~"]): ("SHIFT", 37), + (44, G["let"]): ("SHIFT", 23), + (44, G["id"]): ("SHIFT", 15), (44, G["false"]): ("SHIFT", 36), + (44, G["case"]): ("SHIFT", 30), + (44, G["("]): ("SHIFT", 20), + (44, G["new"]): ("SHIFT", 31), (44, G["isvoid"]): ("SHIFT", 33), - (44, G["not"]): ("SHIFT", 44), (44, G["while"]): ("SHIFT", 22), - (44, G["new"]): ("SHIFT", 31), - (44, G["true"]): ("SHIFT", 35), - (44, G["("]): ("SHIFT", 20), - (44, G["let"]): ("SHIFT", 23), - (44, G["case"]): ("SHIFT", 30), - (44, G["id"]): ("SHIFT", 15), (44, G["{"]): ("SHIFT", 19), + (44, G["not"]): ("SHIFT", 44), (44, G["integer"]): ("SHIFT", 18), - (44, G["if"]): ("SHIFT", 21), + (44, G["true"]): ("SHIFT", 35), (44, G["string"]): ("SHIFT", 17), - (44, G["~"]): ("SHIFT", 37), - (45, G["loop"]): ("REDUCE", G["expr -> not expr"]), + (44, G["if"]): ("SHIFT", 21), + (45, G["in"]): ("REDUCE", G["expr -> not expr"]), + (45, G[";"]): ("REDUCE", G["expr -> not expr"]), (45, G["}"]): ("REDUCE", G["expr -> not expr"]), - (45, G["fi"]): ("REDUCE", G["expr -> not expr"]), + (45, G["loop"]): ("REDUCE", G["expr -> not expr"]), + (45, G["then"]): ("REDUCE", G["expr -> not expr"]), + (45, G["of"]): ("REDUCE", G["expr -> not expr"]), (45, G["pool"]): ("REDUCE", G["expr -> not expr"]), + (45, G["else"]): ("REDUCE", G["expr -> not expr"]), (45, G[")"]): ("REDUCE", G["expr -> not expr"]), - (45, G["in"]): ("REDUCE", G["expr -> not expr"]), + (45, G["fi"]): ("REDUCE", G["expr -> not expr"]), (45, G[","]): ("REDUCE", G["expr -> not expr"]), - (45, G["then"]): ("REDUCE", G["expr -> not expr"]), - (45, G["else"]): ("REDUCE", G["expr -> not expr"]), - (45, G["of"]): ("REDUCE", G["expr -> not expr"]), - (45, G[";"]): ("REDUCE", G["expr -> not expr"]), - (46, G["="]): ("SHIFT", 61), - (46, G["<"]): ("SHIFT", 47), - (46, G["loop"]): ("REDUCE", G["expr -> comp"]), - (46, G["}"]): ("REDUCE", G["expr -> comp"]), - (46, G["pool"]): ("REDUCE", G["expr -> comp"]), - (46, G[")"]): ("REDUCE", G["expr -> comp"]), - (46, G[","]): ("REDUCE", G["expr -> comp"]), (46, G["in"]): ("REDUCE", G["expr -> comp"]), + (46, G["}"]): ("REDUCE", G["expr -> comp"]), + (46, G[";"]): ("REDUCE", G["expr -> comp"]), + (46, G["loop"]): ("REDUCE", G["expr -> comp"]), (46, G["then"]): ("REDUCE", G["expr -> comp"]), + (46, G["of"]): ("REDUCE", G["expr -> comp"]), + (46, G["pool"]): ("REDUCE", G["expr -> comp"]), (46, G["else"]): ("REDUCE", G["expr -> comp"]), + (46, G[")"]): ("REDUCE", G["expr -> comp"]), (46, G["fi"]): ("REDUCE", G["expr -> comp"]), - (46, G[";"]): ("REDUCE", G["expr -> comp"]), - (46, G["of"]): ("REDUCE", G["expr -> comp"]), - (46, G["<="]): ("SHIFT", 59), - (47, G["false"]): ("SHIFT", 36), - (47, G["isvoid"]): ("SHIFT", 33), - (47, G["new"]): ("SHIFT", 31), - (47, G["true"]): ("SHIFT", 35), - (47, G["("]): ("SHIFT", 20), - (47, G["id"]): ("SHIFT", 34), - (47, G["integer"]): ("SHIFT", 18), - (47, G["string"]): ("SHIFT", 17), - (47, G["~"]): ("SHIFT", 37), - (48, G["-"]): ("SHIFT", 56), - (48, G["="]): ("REDUCE", G["comp -> comp < arith"]), - (48, G["loop"]): ("REDUCE", G["comp -> comp < arith"]), - (48, G["}"]): ("REDUCE", G["comp -> comp < arith"]), - (48, G["fi"]): ("REDUCE", G["comp -> comp < arith"]), - (48, G["pool"]): ("REDUCE", G["comp -> comp < arith"]), - (48, G[")"]): ("REDUCE", G["comp -> comp < arith"]), - (48, G[","]): ("REDUCE", G["comp -> comp < arith"]), - (48, G["in"]): ("REDUCE", G["comp -> comp < arith"]), - (48, G["then"]): ("REDUCE", G["comp -> comp < arith"]), - (48, G["else"]): ("REDUCE", G["comp -> comp < arith"]), - (48, G["of"]): ("REDUCE", G["comp -> comp < arith"]), - (48, G["<="]): ("REDUCE", G["comp -> comp < arith"]), - (48, G[";"]): ("REDUCE", G["comp -> comp < arith"]), - (48, G["<"]): ("REDUCE", G["comp -> comp < arith"]), - (48, G["+"]): ("SHIFT", 49), - (49, G["false"]): ("SHIFT", 36), - (49, G["id"]): ("SHIFT", 34), - (49, G["isvoid"]): ("SHIFT", 33), - (49, G["("]): ("SHIFT", 20), - (49, G["integer"]): ("SHIFT", 18), - (49, G["string"]): ("SHIFT", 17), - (49, G["new"]): ("SHIFT", 31), - (49, G["~"]): ("SHIFT", 37), - (49, G["true"]): ("SHIFT", 35), - (50, G["*"]): ("SHIFT", 51), - (50, G["="]): ("REDUCE", G["arith -> arith + term"]), - (50, G["loop"]): ("REDUCE", G["arith -> arith + term"]), - (50, G["}"]): ("REDUCE", G["arith -> arith + term"]), - (50, G["fi"]): ("REDUCE", G["arith -> arith + term"]), - (50, G["pool"]): ("REDUCE", G["arith -> arith + term"]), - (50, G["+"]): ("REDUCE", G["arith -> arith + term"]), - (50, G[")"]): ("REDUCE", G["arith -> arith + term"]), - (50, G["-"]): ("REDUCE", G["arith -> arith + term"]), - (50, G[","]): ("REDUCE", G["arith -> arith + term"]), - (50, G["in"]): ("REDUCE", G["arith -> arith + term"]), - (50, G["then"]): ("REDUCE", G["arith -> arith + term"]), - (50, G["else"]): ("REDUCE", G["arith -> arith + term"]), - (50, G["of"]): ("REDUCE", G["arith -> arith + term"]), - (50, G["<="]): ("REDUCE", G["arith -> arith + term"]), - (50, G[";"]): ("REDUCE", G["arith -> arith + term"]), - (50, G["<"]): ("REDUCE", G["arith -> arith + term"]), - (50, G["/"]): ("SHIFT", 53), - (51, G["false"]): ("SHIFT", 36), - (51, G["isvoid"]): ("SHIFT", 33), - (51, G["("]): ("SHIFT", 20), - (51, G["integer"]): ("SHIFT", 18), - (51, G["id"]): ("SHIFT", 34), - (51, G["string"]): ("SHIFT", 17), - (51, G["new"]): ("SHIFT", 31), - (51, G["~"]): ("SHIFT", 37), - (51, G["true"]): ("SHIFT", 35), - (52, G["="]): ("REDUCE", G["term -> term * factor"]), - (52, G["loop"]): ("REDUCE", G["term -> term * factor"]), - (52, G["}"]): ("REDUCE", G["term -> term * factor"]), - (52, G["fi"]): ("REDUCE", G["term -> term * factor"]), - (52, G["pool"]): ("REDUCE", G["term -> term * factor"]), - (52, G["+"]): ("REDUCE", G["term -> term * factor"]), - (52, G[")"]): ("REDUCE", G["term -> term * factor"]), - (52, G["-"]): ("REDUCE", G["term -> term * factor"]), - (52, G[","]): ("REDUCE", G["term -> term * factor"]), - (52, G["in"]): ("REDUCE", G["term -> term * factor"]), - (52, G["*"]): ("REDUCE", G["term -> term * factor"]), - (52, G["then"]): ("REDUCE", G["term -> term * factor"]), - (52, G["/"]): ("REDUCE", G["term -> term * factor"]), - (52, G["else"]): ("REDUCE", G["term -> term * factor"]), - (52, G["of"]): ("REDUCE", G["term -> term * factor"]), - (52, G["<="]): ("REDUCE", G["term -> term * factor"]), - (52, G[";"]): ("REDUCE", G["term -> term * factor"]), - (52, G["<"]): ("REDUCE", G["term -> term * factor"]), - (53, G["false"]): ("SHIFT", 36), - (53, G["isvoid"]): ("SHIFT", 33), - (53, G["("]): ("SHIFT", 20), - (53, G["integer"]): ("SHIFT", 18), - (53, G["id"]): ("SHIFT", 34), - (53, G["string"]): ("SHIFT", 17), - (53, G["new"]): ("SHIFT", 31), - (53, G["~"]): ("SHIFT", 37), - (53, G["true"]): ("SHIFT", 35), - (54, G["="]): ("REDUCE", G["term -> term / factor"]), - (54, G["loop"]): ("REDUCE", G["term -> term / factor"]), - (54, G["}"]): ("REDUCE", G["term -> term / factor"]), - (54, G["fi"]): ("REDUCE", G["term -> term / factor"]), - (54, G["pool"]): ("REDUCE", G["term -> term / factor"]), - (54, G["+"]): ("REDUCE", G["term -> term / factor"]), - (54, G[")"]): ("REDUCE", G["term -> term / factor"]), - (54, G["-"]): ("REDUCE", G["term -> term / factor"]), - (54, G[","]): ("REDUCE", G["term -> term / factor"]), - (54, G["in"]): ("REDUCE", G["term -> term / factor"]), - (54, G["*"]): ("REDUCE", G["term -> term / factor"]), - (54, G["then"]): ("REDUCE", G["term -> term / factor"]), - (54, G["/"]): ("REDUCE", G["term -> term / factor"]), - (54, G["else"]): ("REDUCE", G["term -> term / factor"]), - (54, G["of"]): ("REDUCE", G["term -> term / factor"]), - (54, G["<="]): ("REDUCE", G["term -> term / factor"]), - (54, G[";"]): ("REDUCE", G["term -> term / factor"]), - (54, G["<"]): ("REDUCE", G["term -> term / factor"]), - (55, G["="]): ("REDUCE", G["term -> factor"]), - (55, G["loop"]): ("REDUCE", G["term -> factor"]), - (55, G["}"]): ("REDUCE", G["term -> factor"]), - (55, G["fi"]): ("REDUCE", G["term -> factor"]), - (55, G["pool"]): ("REDUCE", G["term -> factor"]), - (55, G["+"]): ("REDUCE", G["term -> factor"]), - (55, G[")"]): ("REDUCE", G["term -> factor"]), - (55, G["-"]): ("REDUCE", G["term -> factor"]), - (55, G["in"]): ("REDUCE", G["term -> factor"]), - (55, G[","]): ("REDUCE", G["term -> factor"]), - (55, G["*"]): ("REDUCE", G["term -> factor"]), - (55, G["then"]): ("REDUCE", G["term -> factor"]), - (55, G["/"]): ("REDUCE", G["term -> factor"]), - (55, G["else"]): ("REDUCE", G["term -> factor"]), - (55, G["of"]): ("REDUCE", G["term -> factor"]), - (55, G["<="]): ("REDUCE", G["term -> factor"]), - (55, G[";"]): ("REDUCE", G["term -> factor"]), - (55, G["<"]): ("REDUCE", G["term -> factor"]), - (56, G["false"]): ("SHIFT", 36), - (56, G["id"]): ("SHIFT", 34), - (56, G["isvoid"]): ("SHIFT", 33), - (56, G["("]): ("SHIFT", 20), - (56, G["integer"]): ("SHIFT", 18), - (56, G["string"]): ("SHIFT", 17), - (56, G["new"]): ("SHIFT", 31), - (56, G["~"]): ("SHIFT", 37), - (56, G["true"]): ("SHIFT", 35), - (57, G["="]): ("REDUCE", G["arith -> arith - term"]), - (57, G["loop"]): ("REDUCE", G["arith -> arith - term"]), - (57, G["}"]): ("REDUCE", G["arith -> arith - term"]), - (57, G["fi"]): ("REDUCE", G["arith -> arith - term"]), - (57, G["pool"]): ("REDUCE", G["arith -> arith - term"]), - (57, G["+"]): ("REDUCE", G["arith -> arith - term"]), - (57, G[")"]): ("REDUCE", G["arith -> arith - term"]), - (57, G["-"]): ("REDUCE", G["arith -> arith - term"]), - (57, G[","]): ("REDUCE", G["arith -> arith - term"]), - (57, G["in"]): ("REDUCE", G["arith -> arith - term"]), - (57, G["then"]): ("REDUCE", G["arith -> arith - term"]), - (57, G["else"]): ("REDUCE", G["arith -> arith - term"]), - (57, G["of"]): ("REDUCE", G["arith -> arith - term"]), - (57, G["<="]): ("REDUCE", G["arith -> arith - term"]), - (57, G[";"]): ("REDUCE", G["arith -> arith - term"]), - (57, G["<"]): ("REDUCE", G["arith -> arith - term"]), - (57, G["*"]): ("SHIFT", 51), - (57, G["/"]): ("SHIFT", 53), - (58, G["*"]): ("SHIFT", 51), - (58, G["/"]): ("SHIFT", 53), - (58, G["="]): ("REDUCE", G["arith -> term"]), - (58, G["loop"]): ("REDUCE", G["arith -> term"]), - (58, G["}"]): ("REDUCE", G["arith -> term"]), - (58, G["fi"]): ("REDUCE", G["arith -> term"]), - (58, G["pool"]): ("REDUCE", G["arith -> term"]), - (58, G["+"]): ("REDUCE", G["arith -> term"]), - (58, G[")"]): ("REDUCE", G["arith -> term"]), - (58, G["-"]): ("REDUCE", G["arith -> term"]), - (58, G[","]): ("REDUCE", G["arith -> term"]), - (58, G["in"]): ("REDUCE", G["arith -> term"]), - (58, G["then"]): ("REDUCE", G["arith -> term"]), - (58, G["else"]): ("REDUCE", G["arith -> term"]), - (58, G["of"]): ("REDUCE", G["arith -> term"]), - (58, G["<="]): ("REDUCE", G["arith -> term"]), - (58, G[";"]): ("REDUCE", G["arith -> term"]), - (58, G["<"]): ("REDUCE", G["arith -> term"]), - (59, G["false"]): ("SHIFT", 36), - (59, G["isvoid"]): ("SHIFT", 33), - (59, G["new"]): ("SHIFT", 31), - (59, G["true"]): ("SHIFT", 35), - (59, G["("]): ("SHIFT", 20), - (59, G["id"]): ("SHIFT", 34), - (59, G["integer"]): ("SHIFT", 18), - (59, G["string"]): ("SHIFT", 17), - (59, G["~"]): ("SHIFT", 37), - (60, G["-"]): ("SHIFT", 56), - (60, G["+"]): ("SHIFT", 49), - (60, G["="]): ("REDUCE", G["comp -> comp <= arith"]), - (60, G["loop"]): ("REDUCE", G["comp -> comp <= arith"]), - (60, G["}"]): ("REDUCE", G["comp -> comp <= arith"]), - (60, G["fi"]): ("REDUCE", G["comp -> comp <= arith"]), - (60, G["pool"]): ("REDUCE", G["comp -> comp <= arith"]), - (60, G[")"]): ("REDUCE", G["comp -> comp <= arith"]), - (60, G[","]): ("REDUCE", G["comp -> comp <= arith"]), - (60, G["in"]): ("REDUCE", G["comp -> comp <= arith"]), - (60, G["then"]): ("REDUCE", G["comp -> comp <= arith"]), - (60, G["else"]): ("REDUCE", G["comp -> comp <= arith"]), - (60, G["of"]): ("REDUCE", G["comp -> comp <= arith"]), - (60, G["<="]): ("REDUCE", G["comp -> comp <= arith"]), - (60, G[";"]): ("REDUCE", G["comp -> comp <= arith"]), - (60, G["<"]): ("REDUCE", G["comp -> comp <= arith"]), - (61, G["false"]): ("SHIFT", 36), - (61, G["isvoid"]): ("SHIFT", 33), - (61, G["new"]): ("SHIFT", 31), - (61, G["true"]): ("SHIFT", 35), - (61, G["("]): ("SHIFT", 20), - (61, G["id"]): ("SHIFT", 34), - (61, G["integer"]): ("SHIFT", 18), - (61, G["string"]): ("SHIFT", 17), - (61, G["~"]): ("SHIFT", 37), - (62, G["="]): ("REDUCE", G["comp -> comp = arith"]), - (62, G["loop"]): ("REDUCE", G["comp -> comp = arith"]), - (62, G["}"]): ("REDUCE", G["comp -> comp = arith"]), - (62, G["fi"]): ("REDUCE", G["comp -> comp = arith"]), - (62, G["pool"]): ("REDUCE", G["comp -> comp = arith"]), - (62, G[")"]): ("REDUCE", G["comp -> comp = arith"]), - (62, G[","]): ("REDUCE", G["comp -> comp = arith"]), - (62, G["in"]): ("REDUCE", G["comp -> comp = arith"]), - (62, G["then"]): ("REDUCE", G["comp -> comp = arith"]), - (62, G["else"]): ("REDUCE", G["comp -> comp = arith"]), - (62, G["of"]): ("REDUCE", G["comp -> comp = arith"]), - (62, G["<="]): ("REDUCE", G["comp -> comp = arith"]), - (62, G[";"]): ("REDUCE", G["comp -> comp = arith"]), - (62, G["<"]): ("REDUCE", G["comp -> comp = arith"]), - (62, G["-"]): ("SHIFT", 56), - (62, G["+"]): ("SHIFT", 49), - (63, G["="]): ("REDUCE", G["comp -> arith"]), - (63, G["loop"]): ("REDUCE", G["comp -> arith"]), - (63, G["}"]): ("REDUCE", G["comp -> arith"]), - (63, G["pool"]): ("REDUCE", G["comp -> arith"]), - (63, G[")"]): ("REDUCE", G["comp -> arith"]), - (63, G["in"]): ("REDUCE", G["comp -> arith"]), - (63, G[","]): ("REDUCE", G["comp -> arith"]), - (63, G["then"]): ("REDUCE", G["comp -> arith"]), - (63, G["else"]): ("REDUCE", G["comp -> arith"]), - (63, G["fi"]): ("REDUCE", G["comp -> arith"]), - (63, G["<="]): ("REDUCE", G["comp -> arith"]), - (63, G[";"]): ("REDUCE", G["comp -> arith"]), - (63, G["of"]): ("REDUCE", G["comp -> arith"]), - (63, G["<"]): ("REDUCE", G["comp -> arith"]), - (63, G["-"]): ("SHIFT", 56), - (63, G["+"]): ("SHIFT", 49), + (46, G[","]): ("REDUCE", G["expr -> comp"]), + (47, G["-"]): ("SHIFT", 55), + (47, G["in"]): ("REDUCE", G["comp -> arith"]), + (47, G["}"]): ("REDUCE", G["comp -> arith"]), + (47, G[";"]): ("REDUCE", G["comp -> arith"]), + (47, G["loop"]): ("REDUCE", G["comp -> arith"]), + (47, G["then"]): ("REDUCE", G["comp -> arith"]), + (47, G["of"]): ("REDUCE", G["comp -> arith"]), + (47, G["pool"]): ("REDUCE", G["comp -> arith"]), + (47, G["else"]): ("REDUCE", G["comp -> arith"]), + (47, G[")"]): ("REDUCE", G["comp -> arith"]), + (47, G["fi"]): ("REDUCE", G["comp -> arith"]), + (47, G[","]): ("REDUCE", G["comp -> arith"]), + (47, G["<"]): ("SHIFT", 57), + (47, G["<="]): ("SHIFT", 60), + (47, G["+"]): ("SHIFT", 48), + (47, G["="]): ("SHIFT", 62), + (48, G["~"]): ("SHIFT", 37), + (48, G["isvoid"]): ("SHIFT", 33), + (48, G["integer"]): ("SHIFT", 18), + (48, G["true"]): ("SHIFT", 35), + (48, G["id"]): ("SHIFT", 34), + (48, G["string"]): ("SHIFT", 17), + (48, G["false"]): ("SHIFT", 36), + (48, G["("]): ("SHIFT", 20), + (48, G["new"]): ("SHIFT", 31), + (49, G["*"]): ("SHIFT", 50), + (49, G["/"]): ("SHIFT", 52), + (49, G[";"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["loop"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["pool"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["+"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["in"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["-"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["}"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["then"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["of"]): ("REDUCE", G["arith -> arith + term"]), + (49, G[","]): ("REDUCE", G["arith -> arith + term"]), + (49, G["else"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["<"]): ("REDUCE", G["arith -> arith + term"]), + (49, G[")"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["fi"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["<="]): ("REDUCE", G["arith -> arith + term"]), + (49, G["="]): ("REDUCE", G["arith -> arith + term"]), + (50, G["~"]): ("SHIFT", 37), + (50, G["isvoid"]): ("SHIFT", 33), + (50, G["id"]): ("SHIFT", 34), + (50, G["integer"]): ("SHIFT", 18), + (50, G["true"]): ("SHIFT", 35), + (50, G["false"]): ("SHIFT", 36), + (50, G["("]): ("SHIFT", 20), + (50, G["string"]): ("SHIFT", 17), + (50, G["new"]): ("SHIFT", 31), + (51, G[";"]): ("REDUCE", G["term -> term * factor"]), + (51, G["loop"]): ("REDUCE", G["term -> term * factor"]), + (51, G["pool"]): ("REDUCE", G["term -> term * factor"]), + (51, G["+"]): ("REDUCE", G["term -> term * factor"]), + (51, G["in"]): ("REDUCE", G["term -> term * factor"]), + (51, G["-"]): ("REDUCE", G["term -> term * factor"]), + (51, G["}"]): ("REDUCE", G["term -> term * factor"]), + (51, G["then"]): ("REDUCE", G["term -> term * factor"]), + (51, G["*"]): ("REDUCE", G["term -> term * factor"]), + (51, G["of"]): ("REDUCE", G["term -> term * factor"]), + (51, G[","]): ("REDUCE", G["term -> term * factor"]), + (51, G["/"]): ("REDUCE", G["term -> term * factor"]), + (51, G["else"]): ("REDUCE", G["term -> term * factor"]), + (51, G["<"]): ("REDUCE", G["term -> term * factor"]), + (51, G[")"]): ("REDUCE", G["term -> term * factor"]), + (51, G["fi"]): ("REDUCE", G["term -> term * factor"]), + (51, G["<="]): ("REDUCE", G["term -> term * factor"]), + (51, G["="]): ("REDUCE", G["term -> term * factor"]), + (52, G["~"]): ("SHIFT", 37), + (52, G["isvoid"]): ("SHIFT", 33), + (52, G["id"]): ("SHIFT", 34), + (52, G["integer"]): ("SHIFT", 18), + (52, G["true"]): ("SHIFT", 35), + (52, G["false"]): ("SHIFT", 36), + (52, G["("]): ("SHIFT", 20), + (52, G["string"]): ("SHIFT", 17), + (52, G["new"]): ("SHIFT", 31), + (53, G[";"]): ("REDUCE", G["term -> term / factor"]), + (53, G["loop"]): ("REDUCE", G["term -> term / factor"]), + (53, G["pool"]): ("REDUCE", G["term -> term / factor"]), + (53, G["+"]): ("REDUCE", G["term -> term / factor"]), + (53, G["in"]): ("REDUCE", G["term -> term / factor"]), + (53, G["-"]): ("REDUCE", G["term -> term / factor"]), + (53, G["}"]): ("REDUCE", G["term -> term / factor"]), + (53, G["then"]): ("REDUCE", G["term -> term / factor"]), + (53, G["*"]): ("REDUCE", G["term -> term / factor"]), + (53, G["of"]): ("REDUCE", G["term -> term / factor"]), + (53, G[","]): ("REDUCE", G["term -> term / factor"]), + (53, G["/"]): ("REDUCE", G["term -> term / factor"]), + (53, G["else"]): ("REDUCE", G["term -> term / factor"]), + (53, G["<"]): ("REDUCE", G["term -> term / factor"]), + (53, G[")"]): ("REDUCE", G["term -> term / factor"]), + (53, G["fi"]): ("REDUCE", G["term -> term / factor"]), + (53, G["<="]): ("REDUCE", G["term -> term / factor"]), + (53, G["="]): ("REDUCE", G["term -> term / factor"]), + (54, G[";"]): ("REDUCE", G["term -> factor"]), + (54, G["loop"]): ("REDUCE", G["term -> factor"]), + (54, G["pool"]): ("REDUCE", G["term -> factor"]), + (54, G["+"]): ("REDUCE", G["term -> factor"]), + (54, G["in"]): ("REDUCE", G["term -> factor"]), + (54, G["-"]): ("REDUCE", G["term -> factor"]), + (54, G["}"]): ("REDUCE", G["term -> factor"]), + (54, G["then"]): ("REDUCE", G["term -> factor"]), + (54, G["*"]): ("REDUCE", G["term -> factor"]), + (54, G["of"]): ("REDUCE", G["term -> factor"]), + (54, G[","]): ("REDUCE", G["term -> factor"]), + (54, G["/"]): ("REDUCE", G["term -> factor"]), + (54, G["else"]): ("REDUCE", G["term -> factor"]), + (54, G["<"]): ("REDUCE", G["term -> factor"]), + (54, G[")"]): ("REDUCE", G["term -> factor"]), + (54, G["fi"]): ("REDUCE", G["term -> factor"]), + (54, G["<="]): ("REDUCE", G["term -> factor"]), + (54, G["="]): ("REDUCE", G["term -> factor"]), + (55, G["~"]): ("SHIFT", 37), + (55, G["isvoid"]): ("SHIFT", 33), + (55, G["integer"]): ("SHIFT", 18), + (55, G["true"]): ("SHIFT", 35), + (55, G["id"]): ("SHIFT", 34), + (55, G["string"]): ("SHIFT", 17), + (55, G["false"]): ("SHIFT", 36), + (55, G["("]): ("SHIFT", 20), + (55, G["new"]): ("SHIFT", 31), + (56, G["*"]): ("SHIFT", 50), + (56, G[";"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["loop"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["pool"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["+"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["in"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["}"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["-"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["then"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["of"]): ("REDUCE", G["arith -> arith - term"]), + (56, G[","]): ("REDUCE", G["arith -> arith - term"]), + (56, G["else"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["<"]): ("REDUCE", G["arith -> arith - term"]), + (56, G[")"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["fi"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["<="]): ("REDUCE", G["arith -> arith - term"]), + (56, G["="]): ("REDUCE", G["arith -> arith - term"]), + (56, G["/"]): ("SHIFT", 52), + (57, G["string"]): ("SHIFT", 17), + (57, G["new"]): ("SHIFT", 31), + (57, G["("]): ("SHIFT", 20), + (57, G["false"]): ("SHIFT", 36), + (57, G["id"]): ("SHIFT", 34), + (57, G["isvoid"]): ("SHIFT", 33), + (57, G["~"]): ("SHIFT", 37), + (57, G["integer"]): ("SHIFT", 18), + (57, G["true"]): ("SHIFT", 35), + (58, G["+"]): ("SHIFT", 48), + (58, G["in"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G["}"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G[";"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G["then"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G["of"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G["else"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G[")"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G[","]): ("REDUCE", G["comp -> arith < arith"]), + (58, G["-"]): ("SHIFT", 55), + (59, G["*"]): ("SHIFT", 50), + (59, G["/"]): ("SHIFT", 52), + (59, G[";"]): ("REDUCE", G["arith -> term"]), + (59, G["loop"]): ("REDUCE", G["arith -> term"]), + (59, G["pool"]): ("REDUCE", G["arith -> term"]), + (59, G["+"]): ("REDUCE", G["arith -> term"]), + (59, G["in"]): ("REDUCE", G["arith -> term"]), + (59, G["-"]): ("REDUCE", G["arith -> term"]), + (59, G["}"]): ("REDUCE", G["arith -> term"]), + (59, G["then"]): ("REDUCE", G["arith -> term"]), + (59, G["of"]): ("REDUCE", G["arith -> term"]), + (59, G[","]): ("REDUCE", G["arith -> term"]), + (59, G["else"]): ("REDUCE", G["arith -> term"]), + (59, G["<"]): ("REDUCE", G["arith -> term"]), + (59, G[")"]): ("REDUCE", G["arith -> term"]), + (59, G["fi"]): ("REDUCE", G["arith -> term"]), + (59, G["<="]): ("REDUCE", G["arith -> term"]), + (59, G["="]): ("REDUCE", G["arith -> term"]), + (60, G["string"]): ("SHIFT", 17), + (60, G["new"]): ("SHIFT", 31), + (60, G["("]): ("SHIFT", 20), + (60, G["false"]): ("SHIFT", 36), + (60, G["id"]): ("SHIFT", 34), + (60, G["isvoid"]): ("SHIFT", 33), + (60, G["~"]): ("SHIFT", 37), + (60, G["integer"]): ("SHIFT", 18), + (60, G["true"]): ("SHIFT", 35), + (61, G["+"]): ("SHIFT", 48), + (61, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G[","]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G["-"]): ("SHIFT", 55), + (62, G["string"]): ("SHIFT", 17), + (62, G["new"]): ("SHIFT", 31), + (62, G["("]): ("SHIFT", 20), + (62, G["false"]): ("SHIFT", 36), + (62, G["id"]): ("SHIFT", 34), + (62, G["isvoid"]): ("SHIFT", 33), + (62, G["~"]): ("SHIFT", 37), + (62, G["integer"]): ("SHIFT", 18), + (62, G["true"]): ("SHIFT", 35), + (63, G["+"]): ("SHIFT", 48), + (63, G["in"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G["}"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G[";"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G["then"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G["of"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G["else"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G[")"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G[","]): ("REDUCE", G["comp -> arith = arith"]), + (63, G["-"]): ("SHIFT", 55), (64, G[")"]): ("SHIFT", 65), + (65, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (66, G[")"]): ("REDUCE", G["expr-list -> expr"]), + (65, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (66, G[","]): ("SHIFT", 67), - (67, G["true"]): ("SHIFT", 35), + (66, G[")"]): ("REDUCE", G["expr-list -> expr"]), + (67, G["case"]): ("SHIFT", 30), (67, G["{"]): ("SHIFT", 19), + (67, G["new"]): ("SHIFT", 31), (67, G["id"]): ("SHIFT", 15), (67, G["false"]): ("SHIFT", 36), - (67, G["~"]): ("SHIFT", 37), - (67, G["new"]): ("SHIFT", 31), - (67, G["if"]): ("SHIFT", 21), - (67, G["let"]): ("SHIFT", 23), - (67, G["string"]): ("SHIFT", 17), - (67, G["("]): ("SHIFT", 20), (67, G["while"]): ("SHIFT", 22), - (67, G["not"]): ("SHIFT", 44), + (67, G["let"]): ("SHIFT", 23), (67, G["isvoid"]): ("SHIFT", 33), - (67, G["case"]): ("SHIFT", 30), + (67, G["~"]): ("SHIFT", 37), + (67, G["string"]): ("SHIFT", 17), + (67, G["if"]): ("SHIFT", 21), + (67, G["true"]): ("SHIFT", 35), (67, G["integer"]): ("SHIFT", 18), + (67, G["not"]): ("SHIFT", 44), + (67, G["("]): ("SHIFT", 20), (68, G[")"]): ("REDUCE", G["expr-list -> expr , expr-list"]), (69, G["type"]): ("SHIFT", 70), (70, G["."]): ("SHIFT", 71), (71, G["id"]): ("SHIFT", 72), (72, G["("]): ("SHIFT", 73), - (73, G["true"]): ("SHIFT", 35), + (73, G["case"]): ("SHIFT", 30), (73, G["{"]): ("SHIFT", 19), + (73, G["new"]): ("SHIFT", 31), (73, G["id"]): ("SHIFT", 15), (73, G["false"]): ("SHIFT", 36), - (73, G["~"]): ("SHIFT", 37), - (73, G["new"]): ("SHIFT", 31), - (73, G["if"]): ("SHIFT", 21), - (73, G["let"]): ("SHIFT", 23), - (73, G["string"]): ("SHIFT", 17), - (73, G["("]): ("SHIFT", 20), (73, G["while"]): ("SHIFT", 22), - (73, G["not"]): ("SHIFT", 44), + (73, G["let"]): ("SHIFT", 23), (73, G["isvoid"]): ("SHIFT", 33), - (73, G["case"]): ("SHIFT", 30), + (73, G["~"]): ("SHIFT", 37), + (73, G["string"]): ("SHIFT", 17), + (73, G["if"]): ("SHIFT", 21), + (73, G["true"]): ("SHIFT", 35), (73, G["integer"]): ("SHIFT", 18), + (73, G["not"]): ("SHIFT", 44), + (73, G["("]): ("SHIFT", 20), (74, G[")"]): ("SHIFT", 75), + (75, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), + (75, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), (77, G["of"]): ("SHIFT", 78), (78, G["id"]): ("SHIFT", 79), (79, G[":"]): ("SHIFT", 80), (80, G["type"]): ("SHIFT", 81), (81, G["=>"]): ("SHIFT", 82), (82, G["string"]): ("SHIFT", 17), - (82, G["integer"]): ("SHIFT", 18), - (82, G["{"]): ("SHIFT", 19), - (82, G["new"]): ("SHIFT", 31), - (82, G["~"]): ("SHIFT", 37), - (82, G["isvoid"]): ("SHIFT", 33), - (82, G["if"]): ("SHIFT", 21), - (82, G["false"]): ("SHIFT", 36), (82, G["id"]): ("SHIFT", 15), - (82, G["while"]): ("SHIFT", 22), + (82, G["true"]): ("SHIFT", 35), + (82, G["integer"]): ("SHIFT", 18), (82, G["not"]): ("SHIFT", 44), + (82, G["if"]): ("SHIFT", 21), (82, G["("]): ("SHIFT", 20), - (82, G["true"]): ("SHIFT", 35), + (82, G["new"]): ("SHIFT", 31), (82, G["let"]): ("SHIFT", 23), + (82, G["{"]): ("SHIFT", 19), (82, G["case"]): ("SHIFT", 30), + (82, G["false"]): ("SHIFT", 36), + (82, G["isvoid"]): ("SHIFT", 33), + (82, G["while"]): ("SHIFT", 22), + (82, G["~"]): ("SHIFT", 37), (83, G[";"]): ("SHIFT", 84), - (84, G["id"]): ("SHIFT", 79), (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), + (84, G["id"]): ("SHIFT", 79), (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), (86, G["esac"]): ("SHIFT", 87), - (87, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (87, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (87, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (87, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (87, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), (88, G[","]): ("SHIFT", 89), (89, G["id"]): ("SHIFT", 24), (90, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), (91, G["in"]): ("SHIFT", 92), + (92, G["~"]): ("SHIFT", 37), + (92, G["let"]): ("SHIFT", 23), + (92, G["id"]): ("SHIFT", 15), (92, G["false"]): ("SHIFT", 36), + (92, G["case"]): ("SHIFT", 30), + (92, G["("]): ("SHIFT", 20), + (92, G["new"]): ("SHIFT", 31), (92, G["isvoid"]): ("SHIFT", 33), - (92, G["not"]): ("SHIFT", 44), (92, G["while"]): ("SHIFT", 22), - (92, G["new"]): ("SHIFT", 31), - (92, G["true"]): ("SHIFT", 35), - (92, G["("]): ("SHIFT", 20), - (92, G["let"]): ("SHIFT", 23), - (92, G["case"]): ("SHIFT", 30), - (92, G["id"]): ("SHIFT", 15), (92, G["{"]): ("SHIFT", 19), + (92, G["not"]): ("SHIFT", 44), (92, G["integer"]): ("SHIFT", 18), - (92, G["if"]): ("SHIFT", 21), + (92, G["true"]): ("SHIFT", 35), (92, G["string"]): ("SHIFT", 17), - (92, G["~"]): ("SHIFT", 37), - (93, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (92, G["if"]): ("SHIFT", 21), + (93, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (93, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (93, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (93, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (93, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["loop"]): ("SHIFT", 95), - (95, G["not"]): ("SHIFT", 44), (95, G["string"]): ("SHIFT", 17), - (95, G["("]): ("SHIFT", 20), + (95, G["new"]): ("SHIFT", 31), + (95, G["false"]): ("SHIFT", 36), (95, G["id"]): ("SHIFT", 15), - (95, G["while"]): ("SHIFT", 22), + (95, G["let"]): ("SHIFT", 23), (95, G["{"]): ("SHIFT", 19), + (95, G["while"]): ("SHIFT", 22), (95, G["integer"]): ("SHIFT", 18), - (95, G["let"]): ("SHIFT", 23), - (95, G["~"]): ("SHIFT", 37), (95, G["true"]): ("SHIFT", 35), + (95, G["not"]): ("SHIFT", 44), (95, G["case"]): ("SHIFT", 30), - (95, G["isvoid"]): ("SHIFT", 33), - (95, G["false"]): ("SHIFT", 36), - (95, G["new"]): ("SHIFT", 31), (95, G["if"]): ("SHIFT", 21), + (95, G["~"]): ("SHIFT", 37), + (95, G["("]): ("SHIFT", 20), + (95, G["isvoid"]): ("SHIFT", 33), (96, G["pool"]): ("SHIFT", 97), - (97, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (97, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (97, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (97, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (97, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["then"]): ("SHIFT", 99), - (99, G["case"]): ("SHIFT", 30), - (99, G["true"]): ("SHIFT", 35), - (99, G["new"]): ("SHIFT", 31), - (99, G["isvoid"]): ("SHIFT", 33), - (99, G["id"]): ("SHIFT", 15), - (99, G["false"]): ("SHIFT", 36), - (99, G["not"]): ("SHIFT", 44), (99, G["("]): ("SHIFT", 20), (99, G["if"]): ("SHIFT", 21), - (99, G["string"]): ("SHIFT", 17), + (99, G["new"]): ("SHIFT", 31), (99, G["while"]): ("SHIFT", 22), (99, G["integer"]): ("SHIFT", 18), - (99, G["~"]): ("SHIFT", 37), + (99, G["true"]): ("SHIFT", 35), (99, G["let"]): ("SHIFT", 23), + (99, G["case"]): ("SHIFT", 30), (99, G["{"]): ("SHIFT", 19), + (99, G["~"]): ("SHIFT", 37), + (99, G["string"]): ("SHIFT", 17), + (99, G["isvoid"]): ("SHIFT", 33), + (99, G["id"]): ("SHIFT", 15), + (99, G["not"]): ("SHIFT", 44), + (99, G["false"]): ("SHIFT", 36), (100, G["else"]): ("SHIFT", 101), + (101, G["~"]): ("SHIFT", 37), + (101, G["if"]): ("SHIFT", 21), (101, G["new"]): ("SHIFT", 31), - (101, G["case"]): ("SHIFT", 30), - (101, G["isvoid"]): ("SHIFT", 33), - (101, G["false"]): ("SHIFT", 36), - (101, G["id"]): ("SHIFT", 15), - (101, G["while"]): ("SHIFT", 22), + (101, G["let"]): ("SHIFT", 23), (101, G["not"]): ("SHIFT", 44), + (101, G["id"]): ("SHIFT", 15), + (101, G["isvoid"]): ("SHIFT", 33), (101, G["true"]): ("SHIFT", 35), - (101, G["if"]): ("SHIFT", 21), (101, G["integer"]): ("SHIFT", 18), - (101, G["let"]): ("SHIFT", 23), - (101, G["~"]): ("SHIFT", 37), + (101, G["while"]): ("SHIFT", 22), + (101, G["case"]): ("SHIFT", 30), (101, G["{"]): ("SHIFT", 19), - (101, G["("]): ("SHIFT", 20), (101, G["string"]): ("SHIFT", 17), + (101, G["false"]): ("SHIFT", 36), + (101, G["("]): ("SHIFT", 20), (102, G["fi"]): ("SHIFT", 103), - (103, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (103, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (103, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (103, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (103, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G[")"]): ("SHIFT", 105), + (105, G[";"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["@"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["in"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["of"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["."]): ("REDUCE", G["atom -> ( expr )"]), (105, G["+"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["in"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["-"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["}"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["then"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["*"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["of"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G[","]): ("REDUCE", G["atom -> ( expr )"]), (105, G["/"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["else"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["<"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["<="]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["="]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["}"]): ("REDUCE", G["atom -> ( expr )"]), (105, G[")"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G[","]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["."]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["@"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G[";"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["then"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["else"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["<="]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["="]): ("REDUCE", G["atom -> ( expr )"]), (106, G["}"]): ("SHIFT", 107), - (107, G["loop"]): ("REDUCE", G["expr -> { block }"]), + (107, G["in"]): ("REDUCE", G["expr -> { block }"]), (107, G["}"]): ("REDUCE", G["expr -> { block }"]), - (107, G["fi"]): ("REDUCE", G["expr -> { block }"]), + (107, G[";"]): ("REDUCE", G["expr -> { block }"]), + (107, G["loop"]): ("REDUCE", G["expr -> { block }"]), + (107, G["then"]): ("REDUCE", G["expr -> { block }"]), + (107, G["of"]): ("REDUCE", G["expr -> { block }"]), (107, G["pool"]): ("REDUCE", G["expr -> { block }"]), + (107, G["else"]): ("REDUCE", G["expr -> { block }"]), (107, G[")"]): ("REDUCE", G["expr -> { block }"]), + (107, G["fi"]): ("REDUCE", G["expr -> { block }"]), (107, G[","]): ("REDUCE", G["expr -> { block }"]), - (107, G["in"]): ("REDUCE", G["expr -> { block }"]), - (107, G["then"]): ("REDUCE", G["expr -> { block }"]), - (107, G["else"]): ("REDUCE", G["expr -> { block }"]), - (107, G["of"]): ("REDUCE", G["expr -> { block }"]), - (107, G[";"]): ("REDUCE", G["expr -> { block }"]), (108, G[";"]): ("SHIFT", 109), - (109, G["string"]): ("SHIFT", 17), - (109, G["integer"]): ("SHIFT", 18), - (109, G["{"]): ("SHIFT", 19), - (109, G["new"]): ("SHIFT", 31), - (109, G["~"]): ("SHIFT", 37), - (109, G["isvoid"]): ("SHIFT", 33), - (109, G["if"]): ("SHIFT", 21), (109, G["}"]): ("REDUCE", G["block -> expr ;"]), - (109, G["false"]): ("SHIFT", 36), + (109, G["string"]): ("SHIFT", 17), (109, G["id"]): ("SHIFT", 15), - (109, G["while"]): ("SHIFT", 22), + (109, G["true"]): ("SHIFT", 35), + (109, G["integer"]): ("SHIFT", 18), (109, G["not"]): ("SHIFT", 44), + (109, G["if"]): ("SHIFT", 21), (109, G["("]): ("SHIFT", 20), - (109, G["true"]): ("SHIFT", 35), + (109, G["new"]): ("SHIFT", 31), (109, G["let"]): ("SHIFT", 23), + (109, G["{"]): ("SHIFT", 19), (109, G["case"]): ("SHIFT", 30), + (109, G["false"]): ("SHIFT", 36), + (109, G["isvoid"]): ("SHIFT", 33), + (109, G["while"]): ("SHIFT", 22), + (109, G["~"]): ("SHIFT", 37), (110, G["}"]): ("REDUCE", G["block -> expr ; block"]), (111, G[")"]): ("SHIFT", 112), + (112, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (113, G["~"]): ("SHIFT", 37), + (113, G["let"]): ("SHIFT", 23), + (113, G["id"]): ("SHIFT", 15), (113, G["false"]): ("SHIFT", 36), + (113, G["case"]): ("SHIFT", 30), + (113, G["("]): ("SHIFT", 20), + (113, G["new"]): ("SHIFT", 31), (113, G["isvoid"]): ("SHIFT", 33), - (113, G["not"]): ("SHIFT", 44), (113, G["while"]): ("SHIFT", 22), - (113, G["new"]): ("SHIFT", 31), - (113, G["true"]): ("SHIFT", 35), - (113, G["("]): ("SHIFT", 20), - (113, G["let"]): ("SHIFT", 23), - (113, G["case"]): ("SHIFT", 30), - (113, G["id"]): ("SHIFT", 15), (113, G["{"]): ("SHIFT", 19), + (113, G["not"]): ("SHIFT", 44), (113, G["integer"]): ("SHIFT", 18), - (113, G["if"]): ("SHIFT", 21), + (113, G["true"]): ("SHIFT", 35), (113, G["string"]): ("SHIFT", 17), - (113, G["~"]): ("SHIFT", 37), - (114, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), + (113, G["if"]): ("SHIFT", 21), + (114, G["in"]): ("REDUCE", G["expr -> id <- expr"]), (114, G["}"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G[";"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["then"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["of"]): ("REDUCE", G["expr -> id <- expr"]), (114, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["else"]): ("REDUCE", G["expr -> id <- expr"]), (114, G[")"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), (114, G[","]): ("REDUCE", G["expr -> id <- expr"]), - (114, G["in"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G["then"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G["else"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G["of"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G[";"]): ("REDUCE", G["expr -> id <- expr"]), (115, G["}"]): ("SHIFT", 116), (116, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), (117, G[")"]): ("SHIFT", 118), @@ -1015,278 +1002,280 @@ def __action_table(): (120, G["{"]): ("SHIFT", 121), (121, G["id"]): ("SHIFT", 15), (121, G["let"]): ("SHIFT", 23), - (121, G["integer"]): ("SHIFT", 18), - (121, G["not"]): ("SHIFT", 44), - (121, G["string"]): ("SHIFT", 17), - (121, G["isvoid"]): ("SHIFT", 33), (121, G["~"]): ("SHIFT", 37), - (121, G["while"]): ("SHIFT", 22), - (121, G["false"]): ("SHIFT", 36), - (121, G["if"]): ("SHIFT", 21), + (121, G["not"]): ("SHIFT", 44), (121, G["new"]): ("SHIFT", 31), - (121, G["true"]): ("SHIFT", 35), - (121, G["("]): ("SHIFT", 20), - (121, G["{"]): ("SHIFT", 19), + (121, G["false"]): ("SHIFT", 36), + (121, G["while"]): ("SHIFT", 22), (121, G["case"]): ("SHIFT", 30), + (121, G["{"]): ("SHIFT", 19), + (121, G["("]): ("SHIFT", 20), + (121, G["true"]): ("SHIFT", 35), + (121, G["integer"]): ("SHIFT", 18), + (121, G["string"]): ("SHIFT", 17), + (121, G["if"]): ("SHIFT", 21), + (121, G["isvoid"]): ("SHIFT", 33), (122, G["}"]): ("SHIFT", 123), (123, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (124, G["type"]): ("SHIFT", 125), (125, G["<-"]): ("SHIFT", 126), (125, G[";"]): ("REDUCE", G["attribute -> id : type"]), + (125, G["error"]): ("SHIFT", 128), (126, G["string"]): ("SHIFT", 17), - (126, G["integer"]): ("SHIFT", 18), - (126, G["{"]): ("SHIFT", 19), - (126, G["new"]): ("SHIFT", 31), - (126, G["~"]): ("SHIFT", 37), - (126, G["isvoid"]): ("SHIFT", 33), - (126, G["if"]): ("SHIFT", 21), - (126, G["false"]): ("SHIFT", 36), (126, G["id"]): ("SHIFT", 15), - (126, G["while"]): ("SHIFT", 22), + (126, G["true"]): ("SHIFT", 35), + (126, G["integer"]): ("SHIFT", 18), (126, G["not"]): ("SHIFT", 44), + (126, G["if"]): ("SHIFT", 21), (126, G["("]): ("SHIFT", 20), - (126, G["true"]): ("SHIFT", 35), + (126, G["new"]): ("SHIFT", 31), (126, G["let"]): ("SHIFT", 23), + (126, G["{"]): ("SHIFT", 19), (126, G["case"]): ("SHIFT", 30), + (126, G["false"]): ("SHIFT", 36), + (126, G["isvoid"]): ("SHIFT", 33), + (126, G["while"]): ("SHIFT", 22), + (126, G["~"]): ("SHIFT", 37), (127, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), - (128, G["}"]): ("SHIFT", 129), - (129, G["class"]): ("REDUCE", G["class-def -> class type { feature-list }"]), - (129, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), - (130, G[";"]): ("SHIFT", 131), - (131, G["id"]): ("SHIFT", 4), - (131, G["}"]): ("REDUCE", G["feature-list -> e"]), - (132, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), - (133, G[";"]): ("SHIFT", 134), - (134, G["id"]): ("SHIFT", 4), - (134, G["}"]): ("REDUCE", G["feature-list -> e"]), - (135, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), - (136, G["type"]): ("SHIFT", 137), - (137, G["{"]): ("SHIFT", 138), - (138, G["id"]): ("SHIFT", 4), - (138, G["}"]): ("REDUCE", G["feature-list -> e"]), - (139, G["}"]): ("SHIFT", 140), - (140, G["class"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), - (140, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), - (141, G["$"]): ("OK", None), - (142, G["$"]): ("REDUCE", G["program -> class-list"]), - (143, G["class"]): ("SHIFT", 1), - (143, G["$"]): ("REDUCE", G["class-list -> class-def"]), - (144, G["$"]): ("REDUCE", G["class-list -> class-def class-list"]), + (128, G[";"]): ("REDUCE", G["attribute -> id : type error"]), + (129, G["}"]): ("SHIFT", 130), + (130, G["class"]): ("REDUCE", G["class-def -> class type { feature-list }"]), + (130, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), + (131, G[";"]): ("SHIFT", 132), + (132, G["id"]): ("SHIFT", 4), + (132, G["}"]): ("REDUCE", G["feature-list -> e"]), + (133, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), + (134, G[";"]): ("SHIFT", 135), + (135, G["id"]): ("SHIFT", 4), + (135, G["}"]): ("REDUCE", G["feature-list -> e"]), + (136, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), + (137, G["type"]): ("SHIFT", 138), + (138, G["{"]): ("SHIFT", 139), + (139, G["id"]): ("SHIFT", 4), + (139, G["}"]): ("REDUCE", G["feature-list -> e"]), + (140, G["}"]): ("SHIFT", 141), + (141, G["class"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), + (141, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), + (142, G["$"]): ("OK", None), + (143, G["$"]): ("REDUCE", G["program -> class-list"]), + (144, G["$"]): ("REDUCE", G["class-list -> class-def"]), + (144, G["class"]): ("SHIFT", 1), + (145, G["$"]): ("REDUCE", G["class-list -> class-def class-list"]), } - @staticmethod - def __goto_table(): + def __goto_table(self): + G = self.G return { - (0, G["program"]): 141, - (0, G["class-def"]): 143, - (0, G["class-list"]): 142, - (3, G["feature-list"]): 128, - (3, G["attribute"]): 130, - (3, G["method"]): 133, + (0, G["program"]): 142, + (0, G["class-def"]): 144, + (0, G["class-list"]): 143, + (3, G["attribute"]): 131, + (3, G["method"]): 134, + (3, G["feature-list"]): 129, (5, G["param-list"]): 117, (9, G["param-list"]): 10, - (14, G["arith"]): 63, + (14, G["arith"]): 47, + (14, G["factor"]): 54, (14, G["atom"]): 40, - (14, G["term"]): 58, + (14, G["term"]): 59, (14, G["function-call"]): 38, - (14, G["comp"]): 46, (14, G["expr"]): 115, - (14, G["factor"]): 55, + (14, G["comp"]): 46, (16, G["atom"]): 40, - (16, G["comp"]): 46, - (16, G["factor"]): 55, + (16, G["expr-list"]): 111, + (16, G["arith"]): 47, + (16, G["term"]): 59, (16, G["expr"]): 66, - (16, G["arith"]): 63, - (16, G["term"]): 58, + (16, G["factor"]): 54, + (16, G["comp"]): 46, (16, G["function-call"]): 38, - (16, G["expr-list"]): 111, - (19, G["comp"]): 46, - (19, G["factor"]): 55, - (19, G["function-call"]): 38, + (19, G["arith"]): 47, (19, G["atom"]): 40, - (19, G["arith"]): 63, - (19, G["term"]): 58, + (19, G["term"]): 59, (19, G["expr"]): 108, + (19, G["factor"]): 54, + (19, G["comp"]): 46, + (19, G["function-call"]): 38, (19, G["block"]): 106, - (20, G["factor"]): 55, - (20, G["term"]): 58, + (20, G["arith"]): 47, (20, G["comp"]): 46, - (20, G["atom"]): 40, (20, G["function-call"]): 38, + (20, G["term"]): 59, + (20, G["factor"]): 54, + (20, G["atom"]): 40, (20, G["expr"]): 104, - (20, G["arith"]): 63, + (21, G["term"]): 59, (21, G["atom"]): 40, - (21, G["function-call"]): 38, + (21, G["arith"]): 47, (21, G["comp"]): 46, - (21, G["factor"]): 55, (21, G["expr"]): 98, - (21, G["term"]): 58, - (21, G["arith"]): 63, + (21, G["function-call"]): 38, + (21, G["factor"]): 54, (22, G["atom"]): 40, - (22, G["arith"]): 63, + (22, G["arith"]): 47, + (22, G["term"]): 59, + (22, G["expr"]): 94, (22, G["comp"]): 46, - (22, G["term"]): 58, (22, G["function-call"]): 38, - (22, G["expr"]): 94, - (22, G["factor"]): 55, + (22, G["factor"]): 54, (23, G["declaration-list"]): 91, (27, G["declaration-list"]): 28, - (29, G["comp"]): 46, - (29, G["term"]): 58, + (29, G["term"]): 59, + (29, G["factor"]): 54, (29, G["atom"]): 40, - (29, G["factor"]): 55, - (29, G["arith"]): 63, - (29, G["function-call"]): 38, (29, G["expr"]): 88, - (30, G["term"]): 58, + (29, G["arith"]): 47, + (29, G["comp"]): 46, + (29, G["function-call"]): 38, + (30, G["term"]): 59, + (30, G["arith"]): 47, + (30, G["expr"]): 77, (30, G["atom"]): 40, (30, G["function-call"]): 38, + (30, G["factor"]): 54, (30, G["comp"]): 46, - (30, G["arith"]): 63, - (30, G["expr"]): 77, - (30, G["factor"]): 55, (33, G["atom"]): 40, (33, G["factor"]): 76, (33, G["function-call"]): 38, (37, G["atom"]): 40, - (37, G["function-call"]): 38, (37, G["factor"]): 39, + (37, G["function-call"]): 38, (43, G["atom"]): 40, - (43, G["comp"]): 46, - (43, G["factor"]): 55, + (43, G["expr-list"]): 64, + (43, G["arith"]): 47, + (43, G["term"]): 59, (43, G["expr"]): 66, - (43, G["arith"]): 63, - (43, G["term"]): 58, + (43, G["factor"]): 54, + (43, G["comp"]): 46, (43, G["function-call"]): 38, - (43, G["expr-list"]): 64, + (44, G["term"]): 59, + (44, G["arith"]): 47, (44, G["atom"]): 40, - (44, G["arith"]): 63, - (44, G["comp"]): 46, - (44, G["expr"]): 45, - (44, G["term"]): 58, - (44, G["factor"]): 55, + (44, G["factor"]): 54, (44, G["function-call"]): 38, - (47, G["atom"]): 40, - (47, G["arith"]): 48, - (47, G["factor"]): 55, - (47, G["term"]): 58, - (47, G["function-call"]): 38, - (49, G["atom"]): 40, - (49, G["factor"]): 55, - (49, G["term"]): 50, - (49, G["function-call"]): 38, - (51, G["atom"]): 40, - (51, G["function-call"]): 38, - (51, G["factor"]): 52, - (53, G["atom"]): 40, - (53, G["factor"]): 54, - (53, G["function-call"]): 38, - (56, G["atom"]): 40, - (56, G["factor"]): 55, - (56, G["term"]): 57, - (56, G["function-call"]): 38, - (59, G["atom"]): 40, - (59, G["arith"]): 60, - (59, G["factor"]): 55, - (59, G["term"]): 58, - (59, G["function-call"]): 38, - (61, G["arith"]): 62, - (61, G["atom"]): 40, - (61, G["factor"]): 55, - (61, G["term"]): 58, - (61, G["function-call"]): 38, + (44, G["expr"]): 45, + (44, G["comp"]): 46, + (48, G["term"]): 49, + (48, G["atom"]): 40, + (48, G["factor"]): 54, + (48, G["function-call"]): 38, + (50, G["atom"]): 40, + (50, G["factor"]): 51, + (50, G["function-call"]): 38, + (52, G["factor"]): 53, + (52, G["atom"]): 40, + (52, G["function-call"]): 38, + (55, G["term"]): 56, + (55, G["atom"]): 40, + (55, G["factor"]): 54, + (55, G["function-call"]): 38, + (57, G["arith"]): 58, + (57, G["factor"]): 54, + (57, G["term"]): 59, + (57, G["atom"]): 40, + (57, G["function-call"]): 38, + (60, G["arith"]): 61, + (60, G["factor"]): 54, + (60, G["term"]): 59, + (60, G["atom"]): 40, + (60, G["function-call"]): 38, + (62, G["arith"]): 63, + (62, G["factor"]): 54, + (62, G["term"]): 59, + (62, G["atom"]): 40, + (62, G["function-call"]): 38, (67, G["atom"]): 40, - (67, G["comp"]): 46, - (67, G["factor"]): 55, + (67, G["expr-list"]): 68, + (67, G["arith"]): 47, + (67, G["term"]): 59, (67, G["expr"]): 66, - (67, G["arith"]): 63, - (67, G["term"]): 58, + (67, G["factor"]): 54, + (67, G["comp"]): 46, (67, G["function-call"]): 38, - (67, G["expr-list"]): 68, - (73, G["expr-list"]): 74, (73, G["atom"]): 40, - (73, G["comp"]): 46, - (73, G["factor"]): 55, + (73, G["expr-list"]): 74, + (73, G["arith"]): 47, + (73, G["term"]): 59, (73, G["expr"]): 66, - (73, G["arith"]): 63, - (73, G["term"]): 58, + (73, G["factor"]): 54, + (73, G["comp"]): 46, (73, G["function-call"]): 38, (78, G["case-list"]): 86, - (82, G["comp"]): 46, - (82, G["factor"]): 55, - (82, G["function-call"]): 38, + (82, G["arith"]): 47, (82, G["atom"]): 40, + (82, G["term"]): 59, + (82, G["factor"]): 54, + (82, G["comp"]): 46, (82, G["expr"]): 83, - (82, G["arith"]): 63, - (82, G["term"]): 58, + (82, G["function-call"]): 38, (84, G["case-list"]): 85, (89, G["declaration-list"]): 90, + (92, G["term"]): 59, + (92, G["arith"]): 47, (92, G["atom"]): 40, - (92, G["arith"]): 63, - (92, G["comp"]): 46, + (92, G["factor"]): 54, (92, G["expr"]): 93, - (92, G["factor"]): 55, - (92, G["term"]): 58, (92, G["function-call"]): 38, - (95, G["term"]): 58, + (92, G["comp"]): 46, + (95, G["expr"]): 96, + (95, G["arith"]): 47, + (95, G["factor"]): 54, (95, G["atom"]): 40, - (95, G["arith"]): 63, (95, G["function-call"]): 38, + (95, G["term"]): 59, (95, G["comp"]): 46, - (95, G["factor"]): 55, - (95, G["expr"]): 96, - (99, G["comp"]): 46, - (99, G["term"]): 58, + (99, G["expr"]): 100, (99, G["atom"]): 40, - (99, G["arith"]): 63, + (99, G["arith"]): 47, + (99, G["term"]): 59, + (99, G["comp"]): 46, + (99, G["factor"]): 54, (99, G["function-call"]): 38, - (99, G["factor"]): 55, - (99, G["expr"]): 100, - (101, G["term"]): 58, - (101, G["arith"]): 63, (101, G["comp"]): 46, + (101, G["term"]): 59, (101, G["atom"]): 40, + (101, G["arith"]): 47, (101, G["expr"]): 102, - (101, G["factor"]): 55, + (101, G["factor"]): 54, (101, G["function-call"]): 38, - (109, G["comp"]): 46, - (109, G["factor"]): 55, - (109, G["function-call"]): 38, + (109, G["arith"]): 47, (109, G["atom"]): 40, - (109, G["arith"]): 63, - (109, G["term"]): 58, - (109, G["block"]): 110, + (109, G["term"]): 59, (109, G["expr"]): 108, + (109, G["factor"]): 54, + (109, G["comp"]): 46, + (109, G["block"]): 110, + (109, G["function-call"]): 38, + (113, G["term"]): 59, + (113, G["arith"]): 47, (113, G["atom"]): 40, - (113, G["arith"]): 63, - (113, G["comp"]): 46, - (113, G["factor"]): 55, - (113, G["term"]): 58, - (113, G["expr"]): 114, + (113, G["factor"]): 54, (113, G["function-call"]): 38, - (121, G["arith"]): 63, + (113, G["expr"]): 114, + (113, G["comp"]): 46, + (121, G["arith"]): 47, + (121, G["factor"]): 54, (121, G["atom"]): 40, - (121, G["term"]): 58, + (121, G["term"]): 59, (121, G["function-call"]): 38, - (121, G["comp"]): 46, (121, G["expr"]): 122, - (121, G["factor"]): 55, - (126, G["comp"]): 46, - (126, G["factor"]): 55, - (126, G["function-call"]): 38, + (121, G["comp"]): 46, + (126, G["arith"]): 47, (126, G["atom"]): 40, + (126, G["term"]): 59, (126, G["expr"]): 127, - (126, G["arith"]): 63, - (126, G["term"]): 58, - (131, G["feature-list"]): 132, - (131, G["attribute"]): 130, - (131, G["method"]): 133, - (134, G["feature-list"]): 135, - (134, G["attribute"]): 130, - (134, G["method"]): 133, - (138, G["feature-list"]): 139, - (138, G["attribute"]): 130, - (138, G["method"]): 133, - (143, G["class-def"]): 143, - (143, G["class-list"]): 144, + (126, G["factor"]): 54, + (126, G["comp"]): 46, + (126, G["function-call"]): 38, + (132, G["attribute"]): 131, + (132, G["method"]): 134, + (132, G["feature-list"]): 133, + (135, G["attribute"]): 131, + (135, G["method"]): 134, + (135, G["feature-list"]): 136, + (139, G["feature-list"]): 140, + (139, G["attribute"]): 131, + (139, G["method"]): 134, + (144, G["class-def"]): 144, + (144, G["class-list"]): 145, } diff --git a/scripts/main.cool b/scripts/main.cl similarity index 100% rename from scripts/main.cool rename to scripts/main.cl diff --git a/tester.py b/tester.py index 88edd433b..bbe0e144b 100644 --- a/tester.py +++ b/tester.py @@ -3,13 +3,12 @@ import fire -from cmp.parsing import Token -from grammar import G +from cmp.parsing.lexing import Token from lexer import CoolLexer from parser import CoolParser from semantic import Formatter -lexer = CoolLexer(G) +lexer = CoolLexer() parser = CoolParser() formatter = Formatter() diff --git a/tests/codegen_test.py b/tests/codegen_test.py index 6d864cb06..b6099c030 100644 --- a/tests/codegen_test.py +++ b/tests/codegen_test.py @@ -1,9 +1,9 @@ import pytest import os -from utils import compare_errors +from .utils import compare_errors tests_dir = __file__.rpartition('/')[0] + '/codegen/' -tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] +tests = [file for file in os.listdir(tests_dir) if file.endswith('.cl')] # @pytest.mark.lexer # @pytest.mark.parser diff --git a/tests/conftest.py b/tests/conftest.py index 1f44eeb72..151114848 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,6 +1,7 @@ import pytest import os + @pytest.fixture def compiler_path(): - return os.path.abspath('./coolc.sh') \ No newline at end of file + return os.path.abspath('./coolc.sh') diff --git a/tests/lexer_test.py b/tests/lexer_test.py index 2a27223d3..d673fa6a4 100644 --- a/tests/lexer_test.py +++ b/tests/lexer_test.py @@ -1,13 +1,14 @@ import pytest import os -from utils import compare_errors +from .utils import compare_errors tests_dir = __file__.rpartition('/')[0] + '/lexer/' -tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] +tests = [file for file in os.listdir(tests_dir) if file.endswith('.cl')] + @pytest.mark.lexer -@pytest.mark.error +@pytest.mark.add_error_production @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_test.py b/tests/parser_test.py index 129c0f20a..505be03c7 100644 --- a/tests/parser_test.py +++ b/tests/parser_test.py @@ -1,13 +1,14 @@ import pytest import os -from utils import compare_errors +from .utils import compare_errors tests_dir = __file__.rpartition('/')[0] + '/parser/' -tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] +tests = [file for file in os.listdir(tests_dir) if file.endswith('.cl')] + @pytest.mark.parser -@pytest.mark.error +@pytest.mark.add_error_production @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_test.py b/tests/semantic_test.py index 6c71f8963..34488149c 100644 --- a/tests/semantic_test.py +++ b/tests/semantic_test.py @@ -1,13 +1,14 @@ import pytest import os -from utils import compare_errors +from .utils import compare_errors tests_dir = __file__.rpartition('/')[0] + '/semantic/' -tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] +tests = [file for file in os.listdir(tests_dir) if file.endswith('.cl')] + @pytest.mark.semantic -@pytest.mark.error +@pytest.mark.add_error_production @pytest.mark.run(order=3) @pytest.mark.parametrize("cool_file", []) def test_semantic_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') From a9bdd3d451554fce046ca37b23ec9dfc4140e669 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Fri, 24 Apr 2020 17:50:50 -0400 Subject: [PATCH 013/143] merge with branch error_detections --- cmp/__pycache__/automata.cpython-37.pyc | Bin 5391 -> 5391 bytes cmp/__pycache__/pycompiler.cpython-37.pyc | Bin 21851 -> 21851 bytes cmp/__pycache__/utils.cpython-37.pyc | Bin 9008 -> 9008 bytes .../__pycache__/__init__.cpython-37.pyc | Bin 145 -> 145 bytes .../__pycache__/parsing.cpython-37.pyc | Bin 10862 -> 10862 bytes grammar.py | 4 +- lexer.py | 2 +- parser.py | 1282 ++++++++--------- 8 files changed, 644 insertions(+), 644 deletions(-) diff --git a/cmp/__pycache__/automata.cpython-37.pyc b/cmp/__pycache__/automata.cpython-37.pyc index c8a8ac1793006248c238ae686e4e8c0507fb77a5..1f8f63a71a8b4aadc785e1ec25c0a70e69cf8e6a 100644 GIT binary patch delta 20 acmeCz>eu3S;^pOH0D{uri#BqzhynmG+yu)2 delta 20 acmeCz>eu3S;^pOH0D^-G^EYy{hynmDzXUk| diff --git a/cmp/__pycache__/pycompiler.cpython-37.pyc b/cmp/__pycache__/pycompiler.cpython-37.pyc index ce919ec9992b80488556eedc7d8914dc734ba029..37b547845eb743761fa94d1a6a6540a11cbe9bc7 100644 GIT binary patch delta 21 bcmcb;it+X;MlL5_UM>b8DE+;WD=-uQONs_g delta 21 bcmcb;it+X;MlL5_UM>b8Ncy;uD=-uQO6CSJ diff --git a/cmp/__pycache__/utils.cpython-37.pyc b/cmp/__pycache__/utils.cpython-37.pyc index fd687f80a003a07479d9df6a83ccf1f6b59f08d5..64c29a1eaa6fbaa94a40251b5df74c01a646415e 100644 GIT binary patch delta 647 zcmXX@O-~b16!k(GkfE`aehkx=cG?9_;>xDBwWS|~DUu>6iMTRK>LhjnO`p@m#)To# zHPO3u;TIb>V(JfI$wq&`#En0IxN&1#;5)C*;>^AGoO|BA?;W>}Tlz{cID0{UgTL>; z=x0IlM}LC$1m!swdZ}NRgqQ{tc@!#BfzLvHi3bsrhv9Ej;(m0I-OHat1&B%j15oB_ zEIVq=7f7oh&!a_}zKPt|@+eeB=aFlq-B9F*VvMN5rFc%SDH70RD?87__=_AI>`76V zKYym}4jmzSLR3+m5CLdwN}D%sQJoKrG?n?Cu`T1@#~$IY)1843?!MG|Ac&SYV1zd0It7CZ zDd@WBSqUx_?Z%Cj_yAqH(FYg=@d1h(H(k~H-8hTioO{0S9L~A-z&&vF%i-|EDf#_+ z{N{^(6sEg_hn?%W56XIL>6d{k0L$E-I&S!=yxh{FFwQGxzCX~m`Z>F zl)0M758SDF(keI?Q6ihZjos6VNK^(Vu_9>;O8iht5LLLGEa){Q0uEdGDefm<6wtvw zEtcdj7;k$0t3q^zSVVS2gy5|y??vM}E%C0Ar82)a)@A(Hcs9)N-t=umG4r*#Mm27k z_q8%AukcrMmKOP^nHojM_N!=|qp44mI0PZl?fRmw_WhmOqbm2(w(g+N1?s$?&dYY+ z(od<$%bCM^Ri^Dxr3Pob?VT-8Z2F$4!@UgPvZX0o;&~m!h;4)^g9a{}bVD_H%bM7=$}qIm9`uLpS+kJi+g* z2i7%cm_#@dc4#-eTrHi^iMEB%< zYD&UAK;~jb28Lo5AcKREgSn_@a)E~AU)98R->rz1*$(QfMhPn@RZ56 msuF^IK;~wUVkWTRMSYXYG-q>ztSkbV1LWJPicdDyvIYP=`Ysm$ delta 190 zcmaDC@-BqiiI- zH6`ILAagMz14A(jkio&o!Ccfexj;j5a=)s|Vgq$d_1!>at5MW<1J$1uKr$C(c*$Q&TwR#kkmv6eLe0KzV6 diff --git a/grammar.py b/grammar.py index 54a972704..71f53c8ce 100644 --- a/grammar.py +++ b/grammar.py @@ -38,7 +38,7 @@ # Basic Types # ############### G.add_terminal('string', regex=r'\"[^\"]*\"') -G.add_terminal('integer', regex=r'-?\d+') +G.add_terminal('int', regex=r'\d+') G.add_terminal('char', regex=r'\'[^\']*\'') ########### @@ -139,7 +139,7 @@ def lexical_error(lexer): atom %= 'id', lambda s: ast.VariableNode(s[1]) atom %= 'true', lambda s: ast.BooleanNode(s[1]) atom %= 'false', lambda s: ast.BooleanNode(s[1]) -atom %= 'integer', lambda s: ast.IntegerNode(s[1]) +atom %= 'int', lambda s: ast.IntegerNode(s[1]) atom %= 'string', lambda s: ast.StringNode(s[1]) atom %= 'function-call', lambda s: s[1] atom %= 'new type', lambda s: ast.InstantiateNode(s[2]) diff --git a/lexer.py b/lexer.py index 5b48f6bdc..fde21a4e6 100644 --- a/lexer.py +++ b/lexer.py @@ -10,7 +10,7 @@ def __init__(self): self.column = 0 self.position = 0 self.token = Token('', '', 0, 0) - self.pattern = re.compile(r'(?P\n+)|(?P +)|(?P\t+)|(inherits)|(isvoid)|(class)|(while)|(false)|(then)|(else)|(loop)|(pool)|(case)|(esac)|(true)|(<\-)|(let)|(new)|(not)|(\{)|(\})|(\()|(\))|(\.)|(=>)|(if)|(fi)|(in)|(of)|(\+)|(\-)|(\*)|(<=)|(\~)|(,)|(:)|(;)|(@)|(/)|(<)|(=)|(?P[a-z][a-zA-Z0-9_]*)|(?P[A-Z][a-zA-Z0-9_]*)|(?P\"[^\"]*\")|(?P-?\d+)|(?P\'[^\']*\')') + self.pattern = re.compile(r'(?P\n+)|(?P +)|(?P\t+)|(inherits)|(isvoid)|(class)|(while)|(false)|(then)|(else)|(loop)|(pool)|(case)|(esac)|(true)|(<\-)|(let)|(new)|(not)|(\{)|(\})|(\()|(\))|(\.)|(=>)|(if)|(fi)|(in)|(of)|(\+)|(\-)|(\*)|(<=)|(\~)|(,)|(:)|(;)|(@)|(/)|(<)|(=)|(?P[a-z][a-zA-Z0-9_]*)|(?P[A-Z][a-zA-Z0-9_]*)|(?P\"[^\"]*\")|(?P\d+)|(?P\'[^\']*\')') self.token_rules = {key: rule for key, (_, _, rule) in G.terminal_rules.items() if rule is not None} self.error_handler = G.lexical_error_handler if G.lexical_error_handler is not None else self.error self.contain_errors = False diff --git a/parser.py b/parser.py index ac619aca3..7273cee04 100644 --- a/parser.py +++ b/parser.py @@ -17,1033 +17,1033 @@ def __action_table(self): (1, G["type"]): ("SHIFT", 2), (2, G["{"]): ("SHIFT", 3), (2, G["inherits"]): ("SHIFT", 137), - (3, G["id"]): ("SHIFT", 4), (3, G["}"]): ("REDUCE", G["feature-list -> e"]), + (3, G["id"]): ("SHIFT", 4), (4, G[":"]): ("SHIFT", 124), (4, G["("]): ("SHIFT", 5), - (5, G[")"]): ("SHIFT", 11), (5, G["id"]): ("SHIFT", 6), + (5, G[")"]): ("SHIFT", 11), (6, G[":"]): ("SHIFT", 7), (7, G["type"]): ("SHIFT", 8), - (8, G[")"]): ("REDUCE", G["param-list -> id : type"]), (8, G[","]): ("SHIFT", 9), + (8, G[")"]): ("REDUCE", G["param-list -> id : type"]), (9, G["id"]): ("SHIFT", 6), (10, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), (11, G[":"]): ("SHIFT", 12), (12, G["type"]): ("SHIFT", 13), (13, G["{"]): ("SHIFT", 14), - (14, G["id"]): ("SHIFT", 15), - (14, G["let"]): ("SHIFT", 23), (14, G["~"]): ("SHIFT", 37), - (14, G["not"]): ("SHIFT", 44), - (14, G["new"]): ("SHIFT", 31), - (14, G["false"]): ("SHIFT", 36), - (14, G["while"]): ("SHIFT", 22), + (14, G["if"]): ("SHIFT", 21), (14, G["case"]): ("SHIFT", 30), + (14, G["isvoid"]): ("SHIFT", 33), + (14, G["id"]): ("SHIFT", 15), + (14, G["string"]): ("SHIFT", 17), + (14, G["false"]): ("SHIFT", 36), (14, G["{"]): ("SHIFT", 19), + (14, G["not"]): ("SHIFT", 44), + (14, G["let"]): ("SHIFT", 23), + (14, G["while"]): ("SHIFT", 22), (14, G["("]): ("SHIFT", 20), (14, G["true"]): ("SHIFT", 35), - (14, G["integer"]): ("SHIFT", 18), - (14, G["string"]): ("SHIFT", 17), - (14, G["if"]): ("SHIFT", 21), - (14, G["isvoid"]): ("SHIFT", 33), - (15, G[";"]): ("REDUCE", G["atom -> id"]), - (15, G["@"]): ("REDUCE", G["atom -> id"]), - (15, G["loop"]): ("REDUCE", G["atom -> id"]), - (15, G["pool"]): ("REDUCE", G["atom -> id"]), - (15, G["<="]): ("REDUCE", G["atom -> id"]), - (15, G["+"]): ("REDUCE", G["atom -> id"]), - (15, G["in"]): ("REDUCE", G["atom -> id"]), + (14, G["int"]): ("SHIFT", 18), + (14, G["new"]): ("SHIFT", 31), (15, G["-"]): ("REDUCE", G["atom -> id"]), (15, G["}"]): ("REDUCE", G["atom -> id"]), - (15, G["then"]): ("REDUCE", G["atom -> id"]), (15, G["*"]): ("REDUCE", G["atom -> id"]), (15, G["of"]): ("REDUCE", G["atom -> id"]), - (15, G[","]): ("REDUCE", G["atom -> id"]), + (15, G["then"]): ("REDUCE", G["atom -> id"]), (15, G["/"]): ("REDUCE", G["atom -> id"]), - (15, G["else"]): ("REDUCE", G["atom -> id"]), (15, G["<"]): ("REDUCE", G["atom -> id"]), (15, G[")"]): ("REDUCE", G["atom -> id"]), - (15, G["fi"]): ("REDUCE", G["atom -> id"]), + (15, G["else"]): ("REDUCE", G["atom -> id"]), + (15, G["<="]): ("REDUCE", G["atom -> id"]), (15, G["."]): ("REDUCE", G["atom -> id"]), + (15, G["fi"]): ("REDUCE", G["atom -> id"]), + (15, G[","]): ("REDUCE", G["atom -> id"]), (15, G["="]): ("REDUCE", G["atom -> id"]), + (15, G[";"]): ("REDUCE", G["atom -> id"]), + (15, G["@"]): ("REDUCE", G["atom -> id"]), + (15, G["loop"]): ("REDUCE", G["atom -> id"]), + (15, G["pool"]): ("REDUCE", G["atom -> id"]), + (15, G["+"]): ("REDUCE", G["atom -> id"]), + (15, G["in"]): ("REDUCE", G["atom -> id"]), (15, G["<-"]): ("SHIFT", 113), (15, G["("]): ("SHIFT", 16), - (16, G["case"]): ("SHIFT", 30), - (16, G["{"]): ("SHIFT", 19), - (16, G["new"]): ("SHIFT", 31), - (16, G["id"]): ("SHIFT", 15), - (16, G["false"]): ("SHIFT", 36), + (16, G["("]): ("SHIFT", 20), + (16, G["isvoid"]): ("SHIFT", 33), (16, G["while"]): ("SHIFT", 22), + (16, G["id"]): ("SHIFT", 15), (16, G["let"]): ("SHIFT", 23), - (16, G["isvoid"]): ("SHIFT", 33), + (16, G["not"]): ("SHIFT", 44), (16, G["~"]): ("SHIFT", 37), - (16, G["string"]): ("SHIFT", 17), + (16, G["{"]): ("SHIFT", 19), + (16, G["new"]): ("SHIFT", 31), + (16, G["case"]): ("SHIFT", 30), (16, G["if"]): ("SHIFT", 21), + (16, G["int"]): ("SHIFT", 18), (16, G["true"]): ("SHIFT", 35), - (16, G["integer"]): ("SHIFT", 18), - (16, G["not"]): ("SHIFT", 44), - (16, G["("]): ("SHIFT", 20), - (17, G[";"]): ("REDUCE", G["atom -> string"]), - (17, G["@"]): ("REDUCE", G["atom -> string"]), - (17, G["loop"]): ("REDUCE", G["atom -> string"]), - (17, G["pool"]): ("REDUCE", G["atom -> string"]), - (17, G["<="]): ("REDUCE", G["atom -> string"]), - (17, G["+"]): ("REDUCE", G["atom -> string"]), - (17, G["in"]): ("REDUCE", G["atom -> string"]), - (17, G["}"]): ("REDUCE", G["atom -> string"]), + (16, G["false"]): ("SHIFT", 36), + (16, G["string"]): ("SHIFT", 17), (17, G["-"]): ("REDUCE", G["atom -> string"]), - (17, G["then"]): ("REDUCE", G["atom -> string"]), + (17, G["}"]): ("REDUCE", G["atom -> string"]), (17, G["*"]): ("REDUCE", G["atom -> string"]), (17, G["of"]): ("REDUCE", G["atom -> string"]), - (17, G[","]): ("REDUCE", G["atom -> string"]), + (17, G["then"]): ("REDUCE", G["atom -> string"]), (17, G["/"]): ("REDUCE", G["atom -> string"]), - (17, G["else"]): ("REDUCE", G["atom -> string"]), (17, G["<"]): ("REDUCE", G["atom -> string"]), (17, G[")"]): ("REDUCE", G["atom -> string"]), - (17, G["fi"]): ("REDUCE", G["atom -> string"]), + (17, G["else"]): ("REDUCE", G["atom -> string"]), + (17, G["<="]): ("REDUCE", G["atom -> string"]), (17, G["."]): ("REDUCE", G["atom -> string"]), + (17, G["fi"]): ("REDUCE", G["atom -> string"]), + (17, G[","]): ("REDUCE", G["atom -> string"]), (17, G["="]): ("REDUCE", G["atom -> string"]), - (18, G[";"]): ("REDUCE", G["atom -> integer"]), - (18, G["@"]): ("REDUCE", G["atom -> integer"]), - (18, G["loop"]): ("REDUCE", G["atom -> integer"]), - (18, G["pool"]): ("REDUCE", G["atom -> integer"]), - (18, G["."]): ("REDUCE", G["atom -> integer"]), - (18, G["+"]): ("REDUCE", G["atom -> integer"]), - (18, G["in"]): ("REDUCE", G["atom -> integer"]), - (18, G["-"]): ("REDUCE", G["atom -> integer"]), - (18, G["}"]): ("REDUCE", G["atom -> integer"]), - (18, G["then"]): ("REDUCE", G["atom -> integer"]), - (18, G["*"]): ("REDUCE", G["atom -> integer"]), - (18, G["of"]): ("REDUCE", G["atom -> integer"]), - (18, G[","]): ("REDUCE", G["atom -> integer"]), - (18, G["/"]): ("REDUCE", G["atom -> integer"]), - (18, G["else"]): ("REDUCE", G["atom -> integer"]), - (18, G["<"]): ("REDUCE", G["atom -> integer"]), - (18, G[")"]): ("REDUCE", G["atom -> integer"]), - (18, G["fi"]): ("REDUCE", G["atom -> integer"]), - (18, G["<="]): ("REDUCE", G["atom -> integer"]), - (18, G["="]): ("REDUCE", G["atom -> integer"]), - (19, G["string"]): ("SHIFT", 17), - (19, G["id"]): ("SHIFT", 15), + (17, G[";"]): ("REDUCE", G["atom -> string"]), + (17, G["@"]): ("REDUCE", G["atom -> string"]), + (17, G["loop"]): ("REDUCE", G["atom -> string"]), + (17, G["pool"]): ("REDUCE", G["atom -> string"]), + (17, G["+"]): ("REDUCE", G["atom -> string"]), + (17, G["in"]): ("REDUCE", G["atom -> string"]), + (18, G["}"]): ("REDUCE", G["atom -> int"]), + (18, G["-"]): ("REDUCE", G["atom -> int"]), + (18, G["*"]): ("REDUCE", G["atom -> int"]), + (18, G["of"]): ("REDUCE", G["atom -> int"]), + (18, G["then"]): ("REDUCE", G["atom -> int"]), + (18, G["/"]): ("REDUCE", G["atom -> int"]), + (18, G["<"]): ("REDUCE", G["atom -> int"]), + (18, G[")"]): ("REDUCE", G["atom -> int"]), + (18, G["else"]): ("REDUCE", G["atom -> int"]), + (18, G["<="]): ("REDUCE", G["atom -> int"]), + (18, G["."]): ("REDUCE", G["atom -> int"]), + (18, G["fi"]): ("REDUCE", G["atom -> int"]), + (18, G[","]): ("REDUCE", G["atom -> int"]), + (18, G["="]): ("REDUCE", G["atom -> int"]), + (18, G[";"]): ("REDUCE", G["atom -> int"]), + (18, G["@"]): ("REDUCE", G["atom -> int"]), + (18, G["loop"]): ("REDUCE", G["atom -> int"]), + (18, G["pool"]): ("REDUCE", G["atom -> int"]), + (18, G["+"]): ("REDUCE", G["atom -> int"]), + (18, G["in"]): ("REDUCE", G["atom -> int"]), + (19, G["isvoid"]): ("SHIFT", 33), + (19, G["int"]): ("SHIFT", 18), (19, G["true"]): ("SHIFT", 35), - (19, G["integer"]): ("SHIFT", 18), - (19, G["not"]): ("SHIFT", 44), + (19, G["id"]): ("SHIFT", 15), + (19, G["new"]): ("SHIFT", 31), + (19, G["while"]): ("SHIFT", 22), + (19, G["case"]): ("SHIFT", 30), (19, G["if"]): ("SHIFT", 21), (19, G["("]): ("SHIFT", 20), - (19, G["new"]): ("SHIFT", 31), - (19, G["let"]): ("SHIFT", 23), (19, G["{"]): ("SHIFT", 19), - (19, G["case"]): ("SHIFT", 30), - (19, G["false"]): ("SHIFT", 36), - (19, G["isvoid"]): ("SHIFT", 33), - (19, G["while"]): ("SHIFT", 22), + (19, G["let"]): ("SHIFT", 23), (19, G["~"]): ("SHIFT", 37), - (20, G["false"]): ("SHIFT", 36), - (20, G["while"]): ("SHIFT", 22), - (20, G["let"]): ("SHIFT", 23), - (20, G["case"]): ("SHIFT", 30), - (20, G["id"]): ("SHIFT", 15), + (19, G["false"]): ("SHIFT", 36), + (19, G["string"]): ("SHIFT", 17), + (19, G["not"]): ("SHIFT", 44), + (20, G["isvoid"]): ("SHIFT", 33), (20, G["new"]): ("SHIFT", 31), - (20, G["{"]): ("SHIFT", 19), - (20, G["if"]): ("SHIFT", 21), - (20, G["integer"]): ("SHIFT", 18), (20, G["true"]): ("SHIFT", 35), - (20, G["isvoid"]): ("SHIFT", 33), - (20, G["("]): ("SHIFT", 20), - (20, G["not"]): ("SHIFT", 44), + (20, G["int"]): ("SHIFT", 18), + (20, G["id"]): ("SHIFT", 15), + (20, G["false"]): ("SHIFT", 36), (20, G["~"]): ("SHIFT", 37), (20, G["string"]): ("SHIFT", 17), + (20, G["{"]): ("SHIFT", 19), + (20, G["if"]): ("SHIFT", 21), + (20, G["let"]): ("SHIFT", 23), + (20, G["not"]): ("SHIFT", 44), + (20, G["("]): ("SHIFT", 20), + (20, G["while"]): ("SHIFT", 22), + (20, G["case"]): ("SHIFT", 30), + (21, G["~"]): ("SHIFT", 37), + (21, G["id"]): ("SHIFT", 15), (21, G["isvoid"]): ("SHIFT", 33), - (21, G["string"]): ("SHIFT", 17), (21, G["if"]): ("SHIFT", 21), + (21, G["case"]): ("SHIFT", 30), + (21, G["false"]): ("SHIFT", 36), + (21, G["{"]): ("SHIFT", 19), + (21, G["string"]): ("SHIFT", 17), (21, G["("]): ("SHIFT", 20), - (21, G["id"]): ("SHIFT", 15), + (21, G["new"]): ("SHIFT", 31), (21, G["true"]): ("SHIFT", 35), - (21, G["integer"]): ("SHIFT", 18), - (21, G["{"]): ("SHIFT", 19), + (21, G["int"]): ("SHIFT", 18), (21, G["not"]): ("SHIFT", 44), - (21, G["while"]): ("SHIFT", 22), - (21, G["case"]): ("SHIFT", 30), - (21, G["~"]): ("SHIFT", 37), - (21, G["new"]): ("SHIFT", 31), - (21, G["false"]): ("SHIFT", 36), (21, G["let"]): ("SHIFT", 23), + (21, G["while"]): ("SHIFT", 22), (22, G["id"]): ("SHIFT", 15), - (22, G["isvoid"]): ("SHIFT", 33), - (22, G["("]): ("SHIFT", 20), + (22, G["true"]): ("SHIFT", 35), + (22, G["int"]): ("SHIFT", 18), + (22, G["new"]): ("SHIFT", 31), (22, G["not"]): ("SHIFT", 44), + (22, G["let"]): ("SHIFT", 23), (22, G["~"]): ("SHIFT", 37), - (22, G["if"]): ("SHIFT", 21), + (22, G["("]): ("SHIFT", 20), (22, G["string"]): ("SHIFT", 17), (22, G["false"]): ("SHIFT", 36), - (22, G["while"]): ("SHIFT", 22), - (22, G["let"]): ("SHIFT", 23), - (22, G["case"]): ("SHIFT", 30), - (22, G["new"]): ("SHIFT", 31), (22, G["{"]): ("SHIFT", 19), - (22, G["integer"]): ("SHIFT", 18), - (22, G["true"]): ("SHIFT", 35), + (22, G["if"]): ("SHIFT", 21), + (22, G["case"]): ("SHIFT", 30), + (22, G["while"]): ("SHIFT", 22), + (22, G["isvoid"]): ("SHIFT", 33), (23, G["id"]): ("SHIFT", 24), (24, G[":"]): ("SHIFT", 25), (25, G["type"]): ("SHIFT", 26), + (26, G[","]): ("SHIFT", 27), (26, G["<-"]): ("SHIFT", 29), (26, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), - (26, G[","]): ("SHIFT", 27), (27, G["id"]): ("SHIFT", 24), (28, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), - (29, G["new"]): ("SHIFT", 31), - (29, G["string"]): ("SHIFT", 17), - (29, G["true"]): ("SHIFT", 35), - (29, G["integer"]): ("SHIFT", 18), - (29, G["let"]): ("SHIFT", 23), - (29, G["{"]): ("SHIFT", 19), + (29, G["if"]): ("SHIFT", 21), (29, G["case"]): ("SHIFT", 30), - (29, G["id"]): ("SHIFT", 15), + (29, G["string"]): ("SHIFT", 17), + (29, G["("]): ("SHIFT", 20), (29, G["while"]): ("SHIFT", 22), - (29, G["not"]): ("SHIFT", 44), - (29, G["if"]): ("SHIFT", 21), (29, G["isvoid"]): ("SHIFT", 33), + (29, G["not"]): ("SHIFT", 44), + (29, G["id"]): ("SHIFT", 15), (29, G["~"]): ("SHIFT", 37), - (29, G["("]): ("SHIFT", 20), + (29, G["let"]): ("SHIFT", 23), + (29, G["new"]): ("SHIFT", 31), + (29, G["int"]): ("SHIFT", 18), + (29, G["true"]): ("SHIFT", 35), + (29, G["{"]): ("SHIFT", 19), (29, G["false"]): ("SHIFT", 36), - (30, G["let"]): ("SHIFT", 23), - (30, G["true"]): ("SHIFT", 35), - (30, G["integer"]): ("SHIFT", 18), + (30, G["case"]): ("SHIFT", 30), + (30, G["if"]): ("SHIFT", 21), + (30, G["while"]): ("SHIFT", 22), + (30, G["("]): ("SHIFT", 20), (30, G["not"]): ("SHIFT", 44), + (30, G["let"]): ("SHIFT", 23), + (30, G["isvoid"]): ("SHIFT", 33), (30, G["~"]): ("SHIFT", 37), (30, G["id"]): ("SHIFT", 15), - (30, G["isvoid"]): ("SHIFT", 33), + (30, G["{"]): ("SHIFT", 19), (30, G["string"]): ("SHIFT", 17), - (30, G["new"]): ("SHIFT", 31), - (30, G["("]): ("SHIFT", 20), (30, G["false"]): ("SHIFT", 36), - (30, G["{"]): ("SHIFT", 19), - (30, G["while"]): ("SHIFT", 22), - (30, G["case"]): ("SHIFT", 30), - (30, G["if"]): ("SHIFT", 21), + (30, G["true"]): ("SHIFT", 35), + (30, G["int"]): ("SHIFT", 18), + (30, G["new"]): ("SHIFT", 31), (31, G["type"]): ("SHIFT", 32), - (32, G[";"]): ("REDUCE", G["atom -> new type"]), - (32, G["@"]): ("REDUCE", G["atom -> new type"]), - (32, G["loop"]): ("REDUCE", G["atom -> new type"]), - (32, G["pool"]): ("REDUCE", G["atom -> new type"]), - (32, G["<="]): ("REDUCE", G["atom -> new type"]), - (32, G["+"]): ("REDUCE", G["atom -> new type"]), - (32, G["in"]): ("REDUCE", G["atom -> new type"]), (32, G["}"]): ("REDUCE", G["atom -> new type"]), (32, G["-"]): ("REDUCE", G["atom -> new type"]), - (32, G["="]): ("REDUCE", G["atom -> new type"]), - (32, G["then"]): ("REDUCE", G["atom -> new type"]), (32, G["*"]): ("REDUCE", G["atom -> new type"]), (32, G["of"]): ("REDUCE", G["atom -> new type"]), + (32, G["then"]): ("REDUCE", G["atom -> new type"]), (32, G["/"]): ("REDUCE", G["atom -> new type"]), - (32, G["else"]): ("REDUCE", G["atom -> new type"]), (32, G["<"]): ("REDUCE", G["atom -> new type"]), (32, G[")"]): ("REDUCE", G["atom -> new type"]), - (32, G["fi"]): ("REDUCE", G["atom -> new type"]), + (32, G["else"]): ("REDUCE", G["atom -> new type"]), + (32, G["<="]): ("REDUCE", G["atom -> new type"]), (32, G["."]): ("REDUCE", G["atom -> new type"]), + (32, G["fi"]): ("REDUCE", G["atom -> new type"]), (32, G[","]): ("REDUCE", G["atom -> new type"]), - (33, G["~"]): ("SHIFT", 37), - (33, G["isvoid"]): ("SHIFT", 33), + (32, G["="]): ("REDUCE", G["atom -> new type"]), + (32, G[";"]): ("REDUCE", G["atom -> new type"]), + (32, G["@"]): ("REDUCE", G["atom -> new type"]), + (32, G["loop"]): ("REDUCE", G["atom -> new type"]), + (32, G["pool"]): ("REDUCE", G["atom -> new type"]), + (32, G["+"]): ("REDUCE", G["atom -> new type"]), + (32, G["in"]): ("REDUCE", G["atom -> new type"]), (33, G["id"]): ("SHIFT", 34), - (33, G["integer"]): ("SHIFT", 18), - (33, G["true"]): ("SHIFT", 35), (33, G["false"]): ("SHIFT", 36), - (33, G["("]): ("SHIFT", 20), (33, G["string"]): ("SHIFT", 17), (33, G["new"]): ("SHIFT", 31), - (34, G[";"]): ("REDUCE", G["atom -> id"]), - (34, G["@"]): ("REDUCE", G["atom -> id"]), - (34, G["loop"]): ("REDUCE", G["atom -> id"]), - (34, G["pool"]): ("REDUCE", G["atom -> id"]), - (34, G["<="]): ("REDUCE", G["atom -> id"]), - (34, G["+"]): ("REDUCE", G["atom -> id"]), - (34, G["in"]): ("REDUCE", G["atom -> id"]), + (33, G["~"]): ("SHIFT", 37), + (33, G["isvoid"]): ("SHIFT", 33), + (33, G["("]): ("SHIFT", 20), + (33, G["true"]): ("SHIFT", 35), + (33, G["int"]): ("SHIFT", 18), (34, G["-"]): ("REDUCE", G["atom -> id"]), (34, G["}"]): ("REDUCE", G["atom -> id"]), - (34, G["="]): ("REDUCE", G["atom -> id"]), - (34, G["then"]): ("REDUCE", G["atom -> id"]), (34, G["*"]): ("REDUCE", G["atom -> id"]), (34, G["of"]): ("REDUCE", G["atom -> id"]), + (34, G["then"]): ("REDUCE", G["atom -> id"]), (34, G["/"]): ("REDUCE", G["atom -> id"]), - (34, G["else"]): ("REDUCE", G["atom -> id"]), (34, G["<"]): ("REDUCE", G["atom -> id"]), (34, G[")"]): ("REDUCE", G["atom -> id"]), - (34, G["fi"]): ("REDUCE", G["atom -> id"]), + (34, G["else"]): ("REDUCE", G["atom -> id"]), + (34, G["<="]): ("REDUCE", G["atom -> id"]), (34, G["."]): ("REDUCE", G["atom -> id"]), + (34, G["fi"]): ("REDUCE", G["atom -> id"]), (34, G[","]): ("REDUCE", G["atom -> id"]), + (34, G["="]): ("REDUCE", G["atom -> id"]), + (34, G[";"]): ("REDUCE", G["atom -> id"]), + (34, G["@"]): ("REDUCE", G["atom -> id"]), + (34, G["loop"]): ("REDUCE", G["atom -> id"]), + (34, G["pool"]): ("REDUCE", G["atom -> id"]), + (34, G["+"]): ("REDUCE", G["atom -> id"]), + (34, G["in"]): ("REDUCE", G["atom -> id"]), (34, G["("]): ("SHIFT", 16), - (35, G[";"]): ("REDUCE", G["atom -> true"]), - (35, G["@"]): ("REDUCE", G["atom -> true"]), - (35, G["loop"]): ("REDUCE", G["atom -> true"]), - (35, G["pool"]): ("REDUCE", G["atom -> true"]), - (35, G["<="]): ("REDUCE", G["atom -> true"]), - (35, G["+"]): ("REDUCE", G["atom -> true"]), - (35, G["in"]): ("REDUCE", G["atom -> true"]), - (35, G["-"]): ("REDUCE", G["atom -> true"]), (35, G["}"]): ("REDUCE", G["atom -> true"]), - (35, G["then"]): ("REDUCE", G["atom -> true"]), + (35, G["-"]): ("REDUCE", G["atom -> true"]), (35, G["*"]): ("REDUCE", G["atom -> true"]), (35, G["of"]): ("REDUCE", G["atom -> true"]), - (35, G[","]): ("REDUCE", G["atom -> true"]), + (35, G["then"]): ("REDUCE", G["atom -> true"]), (35, G["/"]): ("REDUCE", G["atom -> true"]), - (35, G["else"]): ("REDUCE", G["atom -> true"]), (35, G["<"]): ("REDUCE", G["atom -> true"]), (35, G[")"]): ("REDUCE", G["atom -> true"]), - (35, G["fi"]): ("REDUCE", G["atom -> true"]), + (35, G["else"]): ("REDUCE", G["atom -> true"]), + (35, G["<="]): ("REDUCE", G["atom -> true"]), (35, G["."]): ("REDUCE", G["atom -> true"]), + (35, G["fi"]): ("REDUCE", G["atom -> true"]), + (35, G[","]): ("REDUCE", G["atom -> true"]), (35, G["="]): ("REDUCE", G["atom -> true"]), - (36, G[";"]): ("REDUCE", G["atom -> false"]), - (36, G["@"]): ("REDUCE", G["atom -> false"]), - (36, G["loop"]): ("REDUCE", G["atom -> false"]), - (36, G["pool"]): ("REDUCE", G["atom -> false"]), - (36, G["<="]): ("REDUCE", G["atom -> false"]), - (36, G["+"]): ("REDUCE", G["atom -> false"]), - (36, G["in"]): ("REDUCE", G["atom -> false"]), + (35, G[";"]): ("REDUCE", G["atom -> true"]), + (35, G["@"]): ("REDUCE", G["atom -> true"]), + (35, G["loop"]): ("REDUCE", G["atom -> true"]), + (35, G["pool"]): ("REDUCE", G["atom -> true"]), + (35, G["+"]): ("REDUCE", G["atom -> true"]), + (35, G["in"]): ("REDUCE", G["atom -> true"]), (36, G["-"]): ("REDUCE", G["atom -> false"]), (36, G["}"]): ("REDUCE", G["atom -> false"]), - (36, G["then"]): ("REDUCE", G["atom -> false"]), (36, G["*"]): ("REDUCE", G["atom -> false"]), (36, G["of"]): ("REDUCE", G["atom -> false"]), - (36, G[","]): ("REDUCE", G["atom -> false"]), + (36, G["then"]): ("REDUCE", G["atom -> false"]), (36, G["/"]): ("REDUCE", G["atom -> false"]), - (36, G["else"]): ("REDUCE", G["atom -> false"]), (36, G["<"]): ("REDUCE", G["atom -> false"]), (36, G[")"]): ("REDUCE", G["atom -> false"]), - (36, G["fi"]): ("REDUCE", G["atom -> false"]), + (36, G["else"]): ("REDUCE", G["atom -> false"]), + (36, G["<="]): ("REDUCE", G["atom -> false"]), (36, G["."]): ("REDUCE", G["atom -> false"]), + (36, G["fi"]): ("REDUCE", G["atom -> false"]), + (36, G[","]): ("REDUCE", G["atom -> false"]), (36, G["="]): ("REDUCE", G["atom -> false"]), - (37, G["~"]): ("SHIFT", 37), - (37, G["isvoid"]): ("SHIFT", 33), + (36, G[";"]): ("REDUCE", G["atom -> false"]), + (36, G["@"]): ("REDUCE", G["atom -> false"]), + (36, G["loop"]): ("REDUCE", G["atom -> false"]), + (36, G["pool"]): ("REDUCE", G["atom -> false"]), + (36, G["+"]): ("REDUCE", G["atom -> false"]), + (36, G["in"]): ("REDUCE", G["atom -> false"]), (37, G["id"]): ("SHIFT", 34), - (37, G["integer"]): ("SHIFT", 18), - (37, G["true"]): ("SHIFT", 35), (37, G["false"]): ("SHIFT", 36), - (37, G["("]): ("SHIFT", 20), (37, G["string"]): ("SHIFT", 17), (37, G["new"]): ("SHIFT", 31), - (38, G[";"]): ("REDUCE", G["atom -> function-call"]), - (38, G["@"]): ("REDUCE", G["atom -> function-call"]), - (38, G["loop"]): ("REDUCE", G["atom -> function-call"]), - (38, G["pool"]): ("REDUCE", G["atom -> function-call"]), - (38, G["."]): ("REDUCE", G["atom -> function-call"]), - (38, G["+"]): ("REDUCE", G["atom -> function-call"]), - (38, G["in"]): ("REDUCE", G["atom -> function-call"]), - (38, G["-"]): ("REDUCE", G["atom -> function-call"]), + (37, G["~"]): ("SHIFT", 37), + (37, G["isvoid"]): ("SHIFT", 33), + (37, G["("]): ("SHIFT", 20), + (37, G["true"]): ("SHIFT", 35), + (37, G["int"]): ("SHIFT", 18), (38, G["}"]): ("REDUCE", G["atom -> function-call"]), - (38, G["then"]): ("REDUCE", G["atom -> function-call"]), + (38, G["-"]): ("REDUCE", G["atom -> function-call"]), (38, G["*"]): ("REDUCE", G["atom -> function-call"]), (38, G["of"]): ("REDUCE", G["atom -> function-call"]), - (38, G[","]): ("REDUCE", G["atom -> function-call"]), + (38, G["then"]): ("REDUCE", G["atom -> function-call"]), (38, G["/"]): ("REDUCE", G["atom -> function-call"]), - (38, G["else"]): ("REDUCE", G["atom -> function-call"]), (38, G["<"]): ("REDUCE", G["atom -> function-call"]), (38, G[")"]): ("REDUCE", G["atom -> function-call"]), - (38, G["fi"]): ("REDUCE", G["atom -> function-call"]), + (38, G["else"]): ("REDUCE", G["atom -> function-call"]), (38, G["<="]): ("REDUCE", G["atom -> function-call"]), + (38, G["."]): ("REDUCE", G["atom -> function-call"]), + (38, G["fi"]): ("REDUCE", G["atom -> function-call"]), + (38, G[","]): ("REDUCE", G["atom -> function-call"]), (38, G["="]): ("REDUCE", G["atom -> function-call"]), - (39, G[";"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["+"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["in"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["}"]): ("REDUCE", G["factor -> ~ factor"]), + (38, G[";"]): ("REDUCE", G["atom -> function-call"]), + (38, G["@"]): ("REDUCE", G["atom -> function-call"]), + (38, G["loop"]): ("REDUCE", G["atom -> function-call"]), + (38, G["pool"]): ("REDUCE", G["atom -> function-call"]), + (38, G["+"]): ("REDUCE", G["atom -> function-call"]), + (38, G["in"]): ("REDUCE", G["atom -> function-call"]), (39, G["-"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["="]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["then"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["}"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["*"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["of"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["then"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["/"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["else"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["<"]): ("REDUCE", G["factor -> ~ factor"]), (39, G[")"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["else"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["<="]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), (39, G[","]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["="]): ("REDUCE", G["factor -> ~ factor"]), + (39, G[";"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["+"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["in"]): ("REDUCE", G["factor -> ~ factor"]), (40, G["."]): ("SHIFT", 41), - (40, G[";"]): ("REDUCE", G["factor -> atom"]), - (40, G["loop"]): ("REDUCE", G["factor -> atom"]), - (40, G["pool"]): ("REDUCE", G["factor -> atom"]), - (40, G["+"]): ("REDUCE", G["factor -> atom"]), - (40, G["in"]): ("REDUCE", G["factor -> atom"]), (40, G["}"]): ("REDUCE", G["factor -> atom"]), (40, G["-"]): ("REDUCE", G["factor -> atom"]), - (40, G["then"]): ("REDUCE", G["factor -> atom"]), (40, G["*"]): ("REDUCE", G["factor -> atom"]), (40, G["of"]): ("REDUCE", G["factor -> atom"]), - (40, G[","]): ("REDUCE", G["factor -> atom"]), + (40, G["then"]): ("REDUCE", G["factor -> atom"]), (40, G["/"]): ("REDUCE", G["factor -> atom"]), - (40, G["else"]): ("REDUCE", G["factor -> atom"]), (40, G["<"]): ("REDUCE", G["factor -> atom"]), (40, G[")"]): ("REDUCE", G["factor -> atom"]), - (40, G["fi"]): ("REDUCE", G["factor -> atom"]), + (40, G["else"]): ("REDUCE", G["factor -> atom"]), (40, G["<="]): ("REDUCE", G["factor -> atom"]), + (40, G["fi"]): ("REDUCE", G["factor -> atom"]), + (40, G[","]): ("REDUCE", G["factor -> atom"]), (40, G["="]): ("REDUCE", G["factor -> atom"]), + (40, G[";"]): ("REDUCE", G["factor -> atom"]), + (40, G["loop"]): ("REDUCE", G["factor -> atom"]), + (40, G["pool"]): ("REDUCE", G["factor -> atom"]), + (40, G["+"]): ("REDUCE", G["factor -> atom"]), + (40, G["in"]): ("REDUCE", G["factor -> atom"]), (40, G["@"]): ("SHIFT", 69), (41, G["id"]): ("SHIFT", 42), (42, G["("]): ("SHIFT", 43), - (43, G["case"]): ("SHIFT", 30), - (43, G["{"]): ("SHIFT", 19), - (43, G["new"]): ("SHIFT", 31), - (43, G["id"]): ("SHIFT", 15), - (43, G["false"]): ("SHIFT", 36), + (43, G["("]): ("SHIFT", 20), + (43, G["isvoid"]): ("SHIFT", 33), (43, G["while"]): ("SHIFT", 22), + (43, G["id"]): ("SHIFT", 15), (43, G["let"]): ("SHIFT", 23), - (43, G["isvoid"]): ("SHIFT", 33), + (43, G["not"]): ("SHIFT", 44), (43, G["~"]): ("SHIFT", 37), - (43, G["string"]): ("SHIFT", 17), + (43, G["{"]): ("SHIFT", 19), + (43, G["new"]): ("SHIFT", 31), + (43, G["case"]): ("SHIFT", 30), (43, G["if"]): ("SHIFT", 21), + (43, G["int"]): ("SHIFT", 18), (43, G["true"]): ("SHIFT", 35), - (43, G["integer"]): ("SHIFT", 18), - (43, G["not"]): ("SHIFT", 44), - (43, G["("]): ("SHIFT", 20), + (43, G["false"]): ("SHIFT", 36), + (43, G["string"]): ("SHIFT", 17), + (44, G["id"]): ("SHIFT", 15), + (44, G["not"]): ("SHIFT", 44), (44, G["~"]): ("SHIFT", 37), (44, G["let"]): ("SHIFT", 23), - (44, G["id"]): ("SHIFT", 15), - (44, G["false"]): ("SHIFT", 36), - (44, G["case"]): ("SHIFT", 30), - (44, G["("]): ("SHIFT", 20), - (44, G["new"]): ("SHIFT", 31), (44, G["isvoid"]): ("SHIFT", 33), - (44, G["while"]): ("SHIFT", 22), - (44, G["{"]): ("SHIFT", 19), - (44, G["not"]): ("SHIFT", 44), - (44, G["integer"]): ("SHIFT", 18), + (44, G["new"]): ("SHIFT", 31), (44, G["true"]): ("SHIFT", 35), + (44, G["int"]): ("SHIFT", 18), (44, G["string"]): ("SHIFT", 17), + (44, G["{"]): ("SHIFT", 19), + (44, G["("]): ("SHIFT", 20), (44, G["if"]): ("SHIFT", 21), - (45, G["in"]): ("REDUCE", G["expr -> not expr"]), + (44, G["case"]): ("SHIFT", 30), + (44, G["false"]): ("SHIFT", 36), + (44, G["while"]): ("SHIFT", 22), (45, G[";"]): ("REDUCE", G["expr -> not expr"]), (45, G["}"]): ("REDUCE", G["expr -> not expr"]), (45, G["loop"]): ("REDUCE", G["expr -> not expr"]), - (45, G["then"]): ("REDUCE", G["expr -> not expr"]), (45, G["of"]): ("REDUCE", G["expr -> not expr"]), + (45, G["then"]): ("REDUCE", G["expr -> not expr"]), (45, G["pool"]): ("REDUCE", G["expr -> not expr"]), - (45, G["else"]): ("REDUCE", G["expr -> not expr"]), (45, G[")"]): ("REDUCE", G["expr -> not expr"]), + (45, G["else"]): ("REDUCE", G["expr -> not expr"]), (45, G["fi"]): ("REDUCE", G["expr -> not expr"]), (45, G[","]): ("REDUCE", G["expr -> not expr"]), - (46, G["in"]): ("REDUCE", G["expr -> comp"]), - (46, G["}"]): ("REDUCE", G["expr -> comp"]), + (45, G["in"]): ("REDUCE", G["expr -> not expr"]), (46, G[";"]): ("REDUCE", G["expr -> comp"]), + (46, G["}"]): ("REDUCE", G["expr -> comp"]), (46, G["loop"]): ("REDUCE", G["expr -> comp"]), - (46, G["then"]): ("REDUCE", G["expr -> comp"]), (46, G["of"]): ("REDUCE", G["expr -> comp"]), + (46, G["then"]): ("REDUCE", G["expr -> comp"]), (46, G["pool"]): ("REDUCE", G["expr -> comp"]), - (46, G["else"]): ("REDUCE", G["expr -> comp"]), (46, G[")"]): ("REDUCE", G["expr -> comp"]), + (46, G["else"]): ("REDUCE", G["expr -> comp"]), (46, G["fi"]): ("REDUCE", G["expr -> comp"]), (46, G[","]): ("REDUCE", G["expr -> comp"]), - (47, G["-"]): ("SHIFT", 55), - (47, G["in"]): ("REDUCE", G["comp -> arith"]), - (47, G["}"]): ("REDUCE", G["comp -> arith"]), + (46, G["in"]): ("REDUCE", G["expr -> comp"]), + (47, G["+"]): ("SHIFT", 48), + (47, G["<"]): ("SHIFT", 57), + (47, G["="]): ("SHIFT", 62), (47, G[";"]): ("REDUCE", G["comp -> arith"]), + (47, G["}"]): ("REDUCE", G["comp -> arith"]), (47, G["loop"]): ("REDUCE", G["comp -> arith"]), - (47, G["then"]): ("REDUCE", G["comp -> arith"]), (47, G["of"]): ("REDUCE", G["comp -> arith"]), + (47, G["then"]): ("REDUCE", G["comp -> arith"]), (47, G["pool"]): ("REDUCE", G["comp -> arith"]), - (47, G["else"]): ("REDUCE", G["comp -> arith"]), (47, G[")"]): ("REDUCE", G["comp -> arith"]), + (47, G["else"]): ("REDUCE", G["comp -> arith"]), (47, G["fi"]): ("REDUCE", G["comp -> arith"]), (47, G[","]): ("REDUCE", G["comp -> arith"]), - (47, G["<"]): ("SHIFT", 57), + (47, G["in"]): ("REDUCE", G["comp -> arith"]), (47, G["<="]): ("SHIFT", 60), - (47, G["+"]): ("SHIFT", 48), - (47, G["="]): ("SHIFT", 62), + (47, G["-"]): ("SHIFT", 55), + (48, G["id"]): ("SHIFT", 34), + (48, G["false"]): ("SHIFT", 36), (48, G["~"]): ("SHIFT", 37), (48, G["isvoid"]): ("SHIFT", 33), - (48, G["integer"]): ("SHIFT", 18), + (48, G["new"]): ("SHIFT", 31), (48, G["true"]): ("SHIFT", 35), - (48, G["id"]): ("SHIFT", 34), + (48, G["int"]): ("SHIFT", 18), (48, G["string"]): ("SHIFT", 17), - (48, G["false"]): ("SHIFT", 36), (48, G["("]): ("SHIFT", 20), - (48, G["new"]): ("SHIFT", 31), - (49, G["*"]): ("SHIFT", 50), - (49, G["/"]): ("SHIFT", 52), - (49, G[";"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["loop"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["pool"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["+"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["in"]): ("REDUCE", G["arith -> arith + term"]), (49, G["-"]): ("REDUCE", G["arith -> arith + term"]), (49, G["}"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["then"]): ("REDUCE", G["arith -> arith + term"]), (49, G["of"]): ("REDUCE", G["arith -> arith + term"]), - (49, G[","]): ("REDUCE", G["arith -> arith + term"]), - (49, G["else"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["then"]): ("REDUCE", G["arith -> arith + term"]), (49, G["<"]): ("REDUCE", G["arith -> arith + term"]), (49, G[")"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["fi"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["else"]): ("REDUCE", G["arith -> arith + term"]), (49, G["<="]): ("REDUCE", G["arith -> arith + term"]), + (49, G["fi"]): ("REDUCE", G["arith -> arith + term"]), + (49, G[","]): ("REDUCE", G["arith -> arith + term"]), (49, G["="]): ("REDUCE", G["arith -> arith + term"]), - (50, G["~"]): ("SHIFT", 37), - (50, G["isvoid"]): ("SHIFT", 33), + (49, G[";"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["loop"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["pool"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["+"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["in"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["*"]): ("SHIFT", 50), + (49, G["/"]): ("SHIFT", 52), (50, G["id"]): ("SHIFT", 34), - (50, G["integer"]): ("SHIFT", 18), - (50, G["true"]): ("SHIFT", 35), (50, G["false"]): ("SHIFT", 36), - (50, G["("]): ("SHIFT", 20), (50, G["string"]): ("SHIFT", 17), (50, G["new"]): ("SHIFT", 31), - (51, G[";"]): ("REDUCE", G["term -> term * factor"]), - (51, G["loop"]): ("REDUCE", G["term -> term * factor"]), - (51, G["pool"]): ("REDUCE", G["term -> term * factor"]), - (51, G["+"]): ("REDUCE", G["term -> term * factor"]), - (51, G["in"]): ("REDUCE", G["term -> term * factor"]), - (51, G["-"]): ("REDUCE", G["term -> term * factor"]), + (50, G["~"]): ("SHIFT", 37), + (50, G["isvoid"]): ("SHIFT", 33), + (50, G["("]): ("SHIFT", 20), + (50, G["true"]): ("SHIFT", 35), + (50, G["int"]): ("SHIFT", 18), (51, G["}"]): ("REDUCE", G["term -> term * factor"]), - (51, G["then"]): ("REDUCE", G["term -> term * factor"]), + (51, G["-"]): ("REDUCE", G["term -> term * factor"]), (51, G["*"]): ("REDUCE", G["term -> term * factor"]), (51, G["of"]): ("REDUCE", G["term -> term * factor"]), - (51, G[","]): ("REDUCE", G["term -> term * factor"]), + (51, G["then"]): ("REDUCE", G["term -> term * factor"]), (51, G["/"]): ("REDUCE", G["term -> term * factor"]), - (51, G["else"]): ("REDUCE", G["term -> term * factor"]), (51, G["<"]): ("REDUCE", G["term -> term * factor"]), (51, G[")"]): ("REDUCE", G["term -> term * factor"]), - (51, G["fi"]): ("REDUCE", G["term -> term * factor"]), + (51, G["else"]): ("REDUCE", G["term -> term * factor"]), (51, G["<="]): ("REDUCE", G["term -> term * factor"]), + (51, G["fi"]): ("REDUCE", G["term -> term * factor"]), + (51, G[","]): ("REDUCE", G["term -> term * factor"]), (51, G["="]): ("REDUCE", G["term -> term * factor"]), - (52, G["~"]): ("SHIFT", 37), - (52, G["isvoid"]): ("SHIFT", 33), + (51, G[";"]): ("REDUCE", G["term -> term * factor"]), + (51, G["loop"]): ("REDUCE", G["term -> term * factor"]), + (51, G["pool"]): ("REDUCE", G["term -> term * factor"]), + (51, G["+"]): ("REDUCE", G["term -> term * factor"]), + (51, G["in"]): ("REDUCE", G["term -> term * factor"]), (52, G["id"]): ("SHIFT", 34), - (52, G["integer"]): ("SHIFT", 18), - (52, G["true"]): ("SHIFT", 35), (52, G["false"]): ("SHIFT", 36), - (52, G["("]): ("SHIFT", 20), (52, G["string"]): ("SHIFT", 17), (52, G["new"]): ("SHIFT", 31), - (53, G[";"]): ("REDUCE", G["term -> term / factor"]), - (53, G["loop"]): ("REDUCE", G["term -> term / factor"]), - (53, G["pool"]): ("REDUCE", G["term -> term / factor"]), - (53, G["+"]): ("REDUCE", G["term -> term / factor"]), - (53, G["in"]): ("REDUCE", G["term -> term / factor"]), - (53, G["-"]): ("REDUCE", G["term -> term / factor"]), + (52, G["~"]): ("SHIFT", 37), + (52, G["isvoid"]): ("SHIFT", 33), + (52, G["("]): ("SHIFT", 20), + (52, G["true"]): ("SHIFT", 35), + (52, G["int"]): ("SHIFT", 18), (53, G["}"]): ("REDUCE", G["term -> term / factor"]), - (53, G["then"]): ("REDUCE", G["term -> term / factor"]), + (53, G["-"]): ("REDUCE", G["term -> term / factor"]), (53, G["*"]): ("REDUCE", G["term -> term / factor"]), (53, G["of"]): ("REDUCE", G["term -> term / factor"]), - (53, G[","]): ("REDUCE", G["term -> term / factor"]), + (53, G["then"]): ("REDUCE", G["term -> term / factor"]), (53, G["/"]): ("REDUCE", G["term -> term / factor"]), - (53, G["else"]): ("REDUCE", G["term -> term / factor"]), (53, G["<"]): ("REDUCE", G["term -> term / factor"]), (53, G[")"]): ("REDUCE", G["term -> term / factor"]), - (53, G["fi"]): ("REDUCE", G["term -> term / factor"]), + (53, G["else"]): ("REDUCE", G["term -> term / factor"]), (53, G["<="]): ("REDUCE", G["term -> term / factor"]), + (53, G["fi"]): ("REDUCE", G["term -> term / factor"]), + (53, G[","]): ("REDUCE", G["term -> term / factor"]), (53, G["="]): ("REDUCE", G["term -> term / factor"]), - (54, G[";"]): ("REDUCE", G["term -> factor"]), - (54, G["loop"]): ("REDUCE", G["term -> factor"]), - (54, G["pool"]): ("REDUCE", G["term -> factor"]), - (54, G["+"]): ("REDUCE", G["term -> factor"]), - (54, G["in"]): ("REDUCE", G["term -> factor"]), + (53, G[";"]): ("REDUCE", G["term -> term / factor"]), + (53, G["loop"]): ("REDUCE", G["term -> term / factor"]), + (53, G["pool"]): ("REDUCE", G["term -> term / factor"]), + (53, G["+"]): ("REDUCE", G["term -> term / factor"]), + (53, G["in"]): ("REDUCE", G["term -> term / factor"]), (54, G["-"]): ("REDUCE", G["term -> factor"]), (54, G["}"]): ("REDUCE", G["term -> factor"]), - (54, G["then"]): ("REDUCE", G["term -> factor"]), (54, G["*"]): ("REDUCE", G["term -> factor"]), (54, G["of"]): ("REDUCE", G["term -> factor"]), - (54, G[","]): ("REDUCE", G["term -> factor"]), + (54, G["then"]): ("REDUCE", G["term -> factor"]), (54, G["/"]): ("REDUCE", G["term -> factor"]), - (54, G["else"]): ("REDUCE", G["term -> factor"]), (54, G["<"]): ("REDUCE", G["term -> factor"]), (54, G[")"]): ("REDUCE", G["term -> factor"]), - (54, G["fi"]): ("REDUCE", G["term -> factor"]), + (54, G["else"]): ("REDUCE", G["term -> factor"]), (54, G["<="]): ("REDUCE", G["term -> factor"]), + (54, G["fi"]): ("REDUCE", G["term -> factor"]), + (54, G[","]): ("REDUCE", G["term -> factor"]), (54, G["="]): ("REDUCE", G["term -> factor"]), + (54, G[";"]): ("REDUCE", G["term -> factor"]), + (54, G["loop"]): ("REDUCE", G["term -> factor"]), + (54, G["pool"]): ("REDUCE", G["term -> factor"]), + (54, G["+"]): ("REDUCE", G["term -> factor"]), + (54, G["in"]): ("REDUCE", G["term -> factor"]), + (55, G["id"]): ("SHIFT", 34), + (55, G["false"]): ("SHIFT", 36), (55, G["~"]): ("SHIFT", 37), (55, G["isvoid"]): ("SHIFT", 33), - (55, G["integer"]): ("SHIFT", 18), + (55, G["new"]): ("SHIFT", 31), (55, G["true"]): ("SHIFT", 35), - (55, G["id"]): ("SHIFT", 34), + (55, G["int"]): ("SHIFT", 18), (55, G["string"]): ("SHIFT", 17), - (55, G["false"]): ("SHIFT", 36), (55, G["("]): ("SHIFT", 20), - (55, G["new"]): ("SHIFT", 31), (56, G["*"]): ("SHIFT", 50), - (56, G[";"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["loop"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["pool"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["+"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["in"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["/"]): ("SHIFT", 52), (56, G["}"]): ("REDUCE", G["arith -> arith - term"]), (56, G["-"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["then"]): ("REDUCE", G["arith -> arith - term"]), (56, G["of"]): ("REDUCE", G["arith -> arith - term"]), - (56, G[","]): ("REDUCE", G["arith -> arith - term"]), - (56, G["else"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["then"]): ("REDUCE", G["arith -> arith - term"]), (56, G["<"]): ("REDUCE", G["arith -> arith - term"]), (56, G[")"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["fi"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["else"]): ("REDUCE", G["arith -> arith - term"]), (56, G["<="]): ("REDUCE", G["arith -> arith - term"]), + (56, G["fi"]): ("REDUCE", G["arith -> arith - term"]), + (56, G[","]): ("REDUCE", G["arith -> arith - term"]), (56, G["="]): ("REDUCE", G["arith -> arith - term"]), - (56, G["/"]): ("SHIFT", 52), - (57, G["string"]): ("SHIFT", 17), - (57, G["new"]): ("SHIFT", 31), + (56, G[";"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["loop"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["pool"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["+"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["in"]): ("REDUCE", G["arith -> arith - term"]), (57, G["("]): ("SHIFT", 20), - (57, G["false"]): ("SHIFT", 36), (57, G["id"]): ("SHIFT", 34), - (57, G["isvoid"]): ("SHIFT", 33), + (57, G["string"]): ("SHIFT", 17), + (57, G["false"]): ("SHIFT", 36), (57, G["~"]): ("SHIFT", 37), - (57, G["integer"]): ("SHIFT", 18), + (57, G["int"]): ("SHIFT", 18), (57, G["true"]): ("SHIFT", 35), - (58, G["+"]): ("SHIFT", 48), - (58, G["in"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G["}"]): ("REDUCE", G["comp -> arith < arith"]), + (57, G["isvoid"]): ("SHIFT", 33), + (57, G["new"]): ("SHIFT", 31), (58, G[";"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G["}"]): ("REDUCE", G["comp -> arith < arith"]), (58, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G["then"]): ("REDUCE", G["comp -> arith < arith"]), (58, G["of"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G["then"]): ("REDUCE", G["comp -> arith < arith"]), (58, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G["else"]): ("REDUCE", G["comp -> arith < arith"]), (58, G[")"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G["else"]): ("REDUCE", G["comp -> arith < arith"]), (58, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), (58, G[","]): ("REDUCE", G["comp -> arith < arith"]), + (58, G["in"]): ("REDUCE", G["comp -> arith < arith"]), (58, G["-"]): ("SHIFT", 55), + (58, G["+"]): ("SHIFT", 48), (59, G["*"]): ("SHIFT", 50), (59, G["/"]): ("SHIFT", 52), - (59, G[";"]): ("REDUCE", G["arith -> term"]), - (59, G["loop"]): ("REDUCE", G["arith -> term"]), - (59, G["pool"]): ("REDUCE", G["arith -> term"]), - (59, G["+"]): ("REDUCE", G["arith -> term"]), - (59, G["in"]): ("REDUCE", G["arith -> term"]), (59, G["-"]): ("REDUCE", G["arith -> term"]), (59, G["}"]): ("REDUCE", G["arith -> term"]), - (59, G["then"]): ("REDUCE", G["arith -> term"]), (59, G["of"]): ("REDUCE", G["arith -> term"]), - (59, G[","]): ("REDUCE", G["arith -> term"]), - (59, G["else"]): ("REDUCE", G["arith -> term"]), + (59, G["then"]): ("REDUCE", G["arith -> term"]), (59, G["<"]): ("REDUCE", G["arith -> term"]), (59, G[")"]): ("REDUCE", G["arith -> term"]), - (59, G["fi"]): ("REDUCE", G["arith -> term"]), + (59, G["else"]): ("REDUCE", G["arith -> term"]), (59, G["<="]): ("REDUCE", G["arith -> term"]), + (59, G["fi"]): ("REDUCE", G["arith -> term"]), + (59, G[","]): ("REDUCE", G["arith -> term"]), (59, G["="]): ("REDUCE", G["arith -> term"]), - (60, G["string"]): ("SHIFT", 17), - (60, G["new"]): ("SHIFT", 31), + (59, G[";"]): ("REDUCE", G["arith -> term"]), + (59, G["loop"]): ("REDUCE", G["arith -> term"]), + (59, G["pool"]): ("REDUCE", G["arith -> term"]), + (59, G["+"]): ("REDUCE", G["arith -> term"]), + (59, G["in"]): ("REDUCE", G["arith -> term"]), (60, G["("]): ("SHIFT", 20), - (60, G["false"]): ("SHIFT", 36), (60, G["id"]): ("SHIFT", 34), - (60, G["isvoid"]): ("SHIFT", 33), + (60, G["string"]): ("SHIFT", 17), + (60, G["false"]): ("SHIFT", 36), (60, G["~"]): ("SHIFT", 37), - (60, G["integer"]): ("SHIFT", 18), + (60, G["int"]): ("SHIFT", 18), (60, G["true"]): ("SHIFT", 35), - (61, G["+"]): ("SHIFT", 48), - (61, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), + (60, G["isvoid"]): ("SHIFT", 33), + (60, G["new"]): ("SHIFT", 31), + (61, G["-"]): ("SHIFT", 55), (61, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), (61, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), (61, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), (61, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), (61, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), (61, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), (61, G[","]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G["-"]): ("SHIFT", 55), - (62, G["string"]): ("SHIFT", 17), - (62, G["new"]): ("SHIFT", 31), + (61, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G["+"]): ("SHIFT", 48), (62, G["("]): ("SHIFT", 20), - (62, G["false"]): ("SHIFT", 36), (62, G["id"]): ("SHIFT", 34), - (62, G["isvoid"]): ("SHIFT", 33), + (62, G["string"]): ("SHIFT", 17), + (62, G["false"]): ("SHIFT", 36), (62, G["~"]): ("SHIFT", 37), - (62, G["integer"]): ("SHIFT", 18), + (62, G["int"]): ("SHIFT", 18), (62, G["true"]): ("SHIFT", 35), - (63, G["+"]): ("SHIFT", 48), - (63, G["in"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G["}"]): ("REDUCE", G["comp -> arith = arith"]), + (62, G["isvoid"]): ("SHIFT", 33), + (62, G["new"]): ("SHIFT", 31), (63, G[";"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G["}"]): ("REDUCE", G["comp -> arith = arith"]), (63, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G["then"]): ("REDUCE", G["comp -> arith = arith"]), (63, G["of"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G["then"]): ("REDUCE", G["comp -> arith = arith"]), (63, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G["else"]): ("REDUCE", G["comp -> arith = arith"]), (63, G[")"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G["else"]): ("REDUCE", G["comp -> arith = arith"]), (63, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), (63, G[","]): ("REDUCE", G["comp -> arith = arith"]), + (63, G["in"]): ("REDUCE", G["comp -> arith = arith"]), (63, G["-"]): ("SHIFT", 55), + (63, G["+"]): ("SHIFT", 48), (64, G[")"]): ("SHIFT", 65), - (65, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (66, G[","]): ("SHIFT", 67), (66, G[")"]): ("REDUCE", G["expr-list -> expr"]), - (67, G["case"]): ("SHIFT", 30), - (67, G["{"]): ("SHIFT", 19), - (67, G["new"]): ("SHIFT", 31), - (67, G["id"]): ("SHIFT", 15), - (67, G["false"]): ("SHIFT", 36), + (67, G["("]): ("SHIFT", 20), + (67, G["isvoid"]): ("SHIFT", 33), (67, G["while"]): ("SHIFT", 22), + (67, G["id"]): ("SHIFT", 15), (67, G["let"]): ("SHIFT", 23), - (67, G["isvoid"]): ("SHIFT", 33), + (67, G["not"]): ("SHIFT", 44), (67, G["~"]): ("SHIFT", 37), - (67, G["string"]): ("SHIFT", 17), + (67, G["{"]): ("SHIFT", 19), + (67, G["new"]): ("SHIFT", 31), + (67, G["case"]): ("SHIFT", 30), (67, G["if"]): ("SHIFT", 21), + (67, G["int"]): ("SHIFT", 18), (67, G["true"]): ("SHIFT", 35), - (67, G["integer"]): ("SHIFT", 18), - (67, G["not"]): ("SHIFT", 44), - (67, G["("]): ("SHIFT", 20), + (67, G["false"]): ("SHIFT", 36), + (67, G["string"]): ("SHIFT", 17), (68, G[")"]): ("REDUCE", G["expr-list -> expr , expr-list"]), (69, G["type"]): ("SHIFT", 70), (70, G["."]): ("SHIFT", 71), (71, G["id"]): ("SHIFT", 72), (72, G["("]): ("SHIFT", 73), - (73, G["case"]): ("SHIFT", 30), - (73, G["{"]): ("SHIFT", 19), - (73, G["new"]): ("SHIFT", 31), - (73, G["id"]): ("SHIFT", 15), - (73, G["false"]): ("SHIFT", 36), + (73, G["("]): ("SHIFT", 20), + (73, G["isvoid"]): ("SHIFT", 33), (73, G["while"]): ("SHIFT", 22), + (73, G["id"]): ("SHIFT", 15), (73, G["let"]): ("SHIFT", 23), - (73, G["isvoid"]): ("SHIFT", 33), + (73, G["not"]): ("SHIFT", 44), (73, G["~"]): ("SHIFT", 37), - (73, G["string"]): ("SHIFT", 17), + (73, G["{"]): ("SHIFT", 19), + (73, G["new"]): ("SHIFT", 31), + (73, G["case"]): ("SHIFT", 30), (73, G["if"]): ("SHIFT", 21), + (73, G["int"]): ("SHIFT", 18), (73, G["true"]): ("SHIFT", 35), - (73, G["integer"]): ("SHIFT", 18), - (73, G["not"]): ("SHIFT", 44), - (73, G["("]): ("SHIFT", 20), + (73, G["false"]): ("SHIFT", 36), + (73, G["string"]): ("SHIFT", 17), (74, G[")"]): ("SHIFT", 75), - (75, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), + (75, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), (77, G["of"]): ("SHIFT", 78), (78, G["id"]): ("SHIFT", 79), (79, G[":"]): ("SHIFT", 80), (80, G["type"]): ("SHIFT", 81), (81, G["=>"]): ("SHIFT", 82), - (82, G["string"]): ("SHIFT", 17), - (82, G["id"]): ("SHIFT", 15), + (82, G["isvoid"]): ("SHIFT", 33), + (82, G["int"]): ("SHIFT", 18), (82, G["true"]): ("SHIFT", 35), - (82, G["integer"]): ("SHIFT", 18), - (82, G["not"]): ("SHIFT", 44), + (82, G["id"]): ("SHIFT", 15), + (82, G["new"]): ("SHIFT", 31), + (82, G["while"]): ("SHIFT", 22), + (82, G["case"]): ("SHIFT", 30), (82, G["if"]): ("SHIFT", 21), (82, G["("]): ("SHIFT", 20), - (82, G["new"]): ("SHIFT", 31), - (82, G["let"]): ("SHIFT", 23), (82, G["{"]): ("SHIFT", 19), - (82, G["case"]): ("SHIFT", 30), - (82, G["false"]): ("SHIFT", 36), - (82, G["isvoid"]): ("SHIFT", 33), - (82, G["while"]): ("SHIFT", 22), + (82, G["let"]): ("SHIFT", 23), (82, G["~"]): ("SHIFT", 37), + (82, G["false"]): ("SHIFT", 36), + (82, G["string"]): ("SHIFT", 17), + (82, G["not"]): ("SHIFT", 44), (83, G[";"]): ("SHIFT", 84), - (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), (84, G["id"]): ("SHIFT", 79), + (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), (86, G["esac"]): ("SHIFT", 87), - (87, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (87, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (87, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (87, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (87, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (87, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (87, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (87, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), + (87, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G[","]): ("SHIFT", 89), + (88, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), (89, G["id"]): ("SHIFT", 24), (90, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), (91, G["in"]): ("SHIFT", 92), + (92, G["id"]): ("SHIFT", 15), + (92, G["not"]): ("SHIFT", 44), (92, G["~"]): ("SHIFT", 37), (92, G["let"]): ("SHIFT", 23), - (92, G["id"]): ("SHIFT", 15), - (92, G["false"]): ("SHIFT", 36), - (92, G["case"]): ("SHIFT", 30), - (92, G["("]): ("SHIFT", 20), - (92, G["new"]): ("SHIFT", 31), (92, G["isvoid"]): ("SHIFT", 33), - (92, G["while"]): ("SHIFT", 22), - (92, G["{"]): ("SHIFT", 19), - (92, G["not"]): ("SHIFT", 44), - (92, G["integer"]): ("SHIFT", 18), + (92, G["new"]): ("SHIFT", 31), (92, G["true"]): ("SHIFT", 35), + (92, G["int"]): ("SHIFT", 18), (92, G["string"]): ("SHIFT", 17), + (92, G["{"]): ("SHIFT", 19), + (92, G["("]): ("SHIFT", 20), (92, G["if"]): ("SHIFT", 21), - (93, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (92, G["case"]): ("SHIFT", 30), + (92, G["false"]): ("SHIFT", 36), + (92, G["while"]): ("SHIFT", 22), (93, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (93, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (93, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (93, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (93, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (93, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (93, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (93, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["loop"]): ("SHIFT", 95), - (95, G["string"]): ("SHIFT", 17), - (95, G["new"]): ("SHIFT", 31), + (95, G["not"]): ("SHIFT", 44), (95, G["false"]): ("SHIFT", 36), - (95, G["id"]): ("SHIFT", 15), - (95, G["let"]): ("SHIFT", 23), - (95, G["{"]): ("SHIFT", 19), + (95, G["isvoid"]): ("SHIFT", 33), (95, G["while"]): ("SHIFT", 22), - (95, G["integer"]): ("SHIFT", 18), - (95, G["true"]): ("SHIFT", 35), - (95, G["not"]): ("SHIFT", 44), - (95, G["case"]): ("SHIFT", 30), + (95, G["id"]): ("SHIFT", 15), (95, G["if"]): ("SHIFT", 21), + (95, G["case"]): ("SHIFT", 30), + (95, G["{"]): ("SHIFT", 19), (95, G["~"]): ("SHIFT", 37), + (95, G["new"]): ("SHIFT", 31), + (95, G["int"]): ("SHIFT", 18), + (95, G["true"]): ("SHIFT", 35), + (95, G["string"]): ("SHIFT", 17), (95, G["("]): ("SHIFT", 20), - (95, G["isvoid"]): ("SHIFT", 33), + (95, G["let"]): ("SHIFT", 23), (96, G["pool"]): ("SHIFT", 97), - (97, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (97, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (97, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (97, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (97, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (97, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (97, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (97, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["then"]): ("SHIFT", 99), - (99, G["("]): ("SHIFT", 20), - (99, G["if"]): ("SHIFT", 21), + (99, G["~"]): ("SHIFT", 37), + (99, G["{"]): ("SHIFT", 19), + (99, G["false"]): ("SHIFT", 36), + (99, G["isvoid"]): ("SHIFT", 33), + (99, G["id"]): ("SHIFT", 15), (99, G["new"]): ("SHIFT", 31), - (99, G["while"]): ("SHIFT", 22), - (99, G["integer"]): ("SHIFT", 18), (99, G["true"]): ("SHIFT", 35), - (99, G["let"]): ("SHIFT", 23), + (99, G["int"]): ("SHIFT", 18), + (99, G["if"]): ("SHIFT", 21), (99, G["case"]): ("SHIFT", 30), - (99, G["{"]): ("SHIFT", 19), - (99, G["~"]): ("SHIFT", 37), + (99, G["while"]): ("SHIFT", 22), + (99, G["let"]): ("SHIFT", 23), (99, G["string"]): ("SHIFT", 17), - (99, G["isvoid"]): ("SHIFT", 33), - (99, G["id"]): ("SHIFT", 15), (99, G["not"]): ("SHIFT", 44), - (99, G["false"]): ("SHIFT", 36), + (99, G["("]): ("SHIFT", 20), (100, G["else"]): ("SHIFT", 101), - (101, G["~"]): ("SHIFT", 37), - (101, G["if"]): ("SHIFT", 21), - (101, G["new"]): ("SHIFT", 31), (101, G["let"]): ("SHIFT", 23), (101, G["not"]): ("SHIFT", 44), - (101, G["id"]): ("SHIFT", 15), - (101, G["isvoid"]): ("SHIFT", 33), - (101, G["true"]): ("SHIFT", 35), - (101, G["integer"]): ("SHIFT", 18), + (101, G["~"]): ("SHIFT", 37), + (101, G["("]): ("SHIFT", 20), (101, G["while"]): ("SHIFT", 22), (101, G["case"]): ("SHIFT", 30), - (101, G["{"]): ("SHIFT", 19), - (101, G["string"]): ("SHIFT", 17), + (101, G["if"]): ("SHIFT", 21), + (101, G["new"]): ("SHIFT", 31), + (101, G["int"]): ("SHIFT", 18), + (101, G["true"]): ("SHIFT", 35), + (101, G["id"]): ("SHIFT", 15), (101, G["false"]): ("SHIFT", 36), - (101, G["("]): ("SHIFT", 20), + (101, G["string"]): ("SHIFT", 17), + (101, G["{"]): ("SHIFT", 19), + (101, G["isvoid"]): ("SHIFT", 33), (102, G["fi"]): ("SHIFT", 103), - (103, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (103, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (103, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (103, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (103, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (103, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (103, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (103, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G[")"]): ("SHIFT", 105), - (105, G[";"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["@"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["."]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["+"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["in"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["-"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["}"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["then"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["-"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["*"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["of"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G[","]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["then"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["/"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["else"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["<"]): ("REDUCE", G["atom -> ( expr )"]), (105, G[")"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["else"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["<="]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["."]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G[","]): ("REDUCE", G["atom -> ( expr )"]), (105, G["="]): ("REDUCE", G["atom -> ( expr )"]), + (105, G[";"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["@"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["+"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["in"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["}"]): ("SHIFT", 107), - (107, G["in"]): ("REDUCE", G["expr -> { block }"]), - (107, G["}"]): ("REDUCE", G["expr -> { block }"]), (107, G[";"]): ("REDUCE", G["expr -> { block }"]), + (107, G["}"]): ("REDUCE", G["expr -> { block }"]), (107, G["loop"]): ("REDUCE", G["expr -> { block }"]), - (107, G["then"]): ("REDUCE", G["expr -> { block }"]), (107, G["of"]): ("REDUCE", G["expr -> { block }"]), + (107, G["then"]): ("REDUCE", G["expr -> { block }"]), (107, G["pool"]): ("REDUCE", G["expr -> { block }"]), - (107, G["else"]): ("REDUCE", G["expr -> { block }"]), (107, G[")"]): ("REDUCE", G["expr -> { block }"]), + (107, G["else"]): ("REDUCE", G["expr -> { block }"]), (107, G["fi"]): ("REDUCE", G["expr -> { block }"]), (107, G[","]): ("REDUCE", G["expr -> { block }"]), + (107, G["in"]): ("REDUCE", G["expr -> { block }"]), (108, G[";"]): ("SHIFT", 109), - (109, G["}"]): ("REDUCE", G["block -> expr ;"]), - (109, G["string"]): ("SHIFT", 17), - (109, G["id"]): ("SHIFT", 15), + (109, G["isvoid"]): ("SHIFT", 33), + (109, G["int"]): ("SHIFT", 18), (109, G["true"]): ("SHIFT", 35), - (109, G["integer"]): ("SHIFT", 18), - (109, G["not"]): ("SHIFT", 44), + (109, G["id"]): ("SHIFT", 15), + (109, G["new"]): ("SHIFT", 31), + (109, G["while"]): ("SHIFT", 22), + (109, G["case"]): ("SHIFT", 30), (109, G["if"]): ("SHIFT", 21), (109, G["("]): ("SHIFT", 20), - (109, G["new"]): ("SHIFT", 31), - (109, G["let"]): ("SHIFT", 23), + (109, G["}"]): ("REDUCE", G["block -> expr ;"]), (109, G["{"]): ("SHIFT", 19), - (109, G["case"]): ("SHIFT", 30), - (109, G["false"]): ("SHIFT", 36), - (109, G["isvoid"]): ("SHIFT", 33), - (109, G["while"]): ("SHIFT", 22), + (109, G["let"]): ("SHIFT", 23), (109, G["~"]): ("SHIFT", 37), + (109, G["false"]): ("SHIFT", 36), + (109, G["string"]): ("SHIFT", 17), + (109, G["not"]): ("SHIFT", 44), (110, G["}"]): ("REDUCE", G["block -> expr ; block"]), (111, G[")"]): ("SHIFT", 112), - (112, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (113, G["id"]): ("SHIFT", 15), + (113, G["not"]): ("SHIFT", 44), (113, G["~"]): ("SHIFT", 37), (113, G["let"]): ("SHIFT", 23), - (113, G["id"]): ("SHIFT", 15), - (113, G["false"]): ("SHIFT", 36), - (113, G["case"]): ("SHIFT", 30), - (113, G["("]): ("SHIFT", 20), - (113, G["new"]): ("SHIFT", 31), (113, G["isvoid"]): ("SHIFT", 33), - (113, G["while"]): ("SHIFT", 22), - (113, G["{"]): ("SHIFT", 19), - (113, G["not"]): ("SHIFT", 44), - (113, G["integer"]): ("SHIFT", 18), + (113, G["new"]): ("SHIFT", 31), (113, G["true"]): ("SHIFT", 35), + (113, G["int"]): ("SHIFT", 18), (113, G["string"]): ("SHIFT", 17), + (113, G["{"]): ("SHIFT", 19), + (113, G["("]): ("SHIFT", 20), (113, G["if"]): ("SHIFT", 21), - (114, G["in"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G["}"]): ("REDUCE", G["expr -> id <- expr"]), + (113, G["case"]): ("SHIFT", 30), + (113, G["false"]): ("SHIFT", 36), + (113, G["while"]): ("SHIFT", 22), (114, G[";"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["}"]): ("REDUCE", G["expr -> id <- expr"]), (114, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G["then"]): ("REDUCE", G["expr -> id <- expr"]), (114, G["of"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["then"]): ("REDUCE", G["expr -> id <- expr"]), (114, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G["else"]): ("REDUCE", G["expr -> id <- expr"]), (114, G[")"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["else"]): ("REDUCE", G["expr -> id <- expr"]), (114, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), (114, G[","]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["in"]): ("REDUCE", G["expr -> id <- expr"]), (115, G["}"]): ("SHIFT", 116), (116, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), (117, G[")"]): ("SHIFT", 118), (118, G[":"]): ("SHIFT", 119), (119, G["type"]): ("SHIFT", 120), (120, G["{"]): ("SHIFT", 121), - (121, G["id"]): ("SHIFT", 15), - (121, G["let"]): ("SHIFT", 23), (121, G["~"]): ("SHIFT", 37), - (121, G["not"]): ("SHIFT", 44), - (121, G["new"]): ("SHIFT", 31), - (121, G["false"]): ("SHIFT", 36), - (121, G["while"]): ("SHIFT", 22), + (121, G["if"]): ("SHIFT", 21), (121, G["case"]): ("SHIFT", 30), + (121, G["isvoid"]): ("SHIFT", 33), + (121, G["id"]): ("SHIFT", 15), + (121, G["string"]): ("SHIFT", 17), + (121, G["false"]): ("SHIFT", 36), (121, G["{"]): ("SHIFT", 19), + (121, G["not"]): ("SHIFT", 44), + (121, G["let"]): ("SHIFT", 23), + (121, G["while"]): ("SHIFT", 22), (121, G["("]): ("SHIFT", 20), (121, G["true"]): ("SHIFT", 35), - (121, G["integer"]): ("SHIFT", 18), - (121, G["string"]): ("SHIFT", 17), - (121, G["if"]): ("SHIFT", 21), - (121, G["isvoid"]): ("SHIFT", 33), + (121, G["int"]): ("SHIFT", 18), + (121, G["new"]): ("SHIFT", 31), (122, G["}"]): ("SHIFT", 123), (123, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (124, G["type"]): ("SHIFT", 125), (125, G["<-"]): ("SHIFT", 126), (125, G[";"]): ("REDUCE", G["attribute -> id : type"]), (125, G["error"]): ("SHIFT", 128), - (126, G["string"]): ("SHIFT", 17), - (126, G["id"]): ("SHIFT", 15), + (126, G["isvoid"]): ("SHIFT", 33), + (126, G["int"]): ("SHIFT", 18), (126, G["true"]): ("SHIFT", 35), - (126, G["integer"]): ("SHIFT", 18), - (126, G["not"]): ("SHIFT", 44), + (126, G["id"]): ("SHIFT", 15), + (126, G["new"]): ("SHIFT", 31), + (126, G["while"]): ("SHIFT", 22), + (126, G["case"]): ("SHIFT", 30), (126, G["if"]): ("SHIFT", 21), (126, G["("]): ("SHIFT", 20), - (126, G["new"]): ("SHIFT", 31), - (126, G["let"]): ("SHIFT", 23), (126, G["{"]): ("SHIFT", 19), - (126, G["case"]): ("SHIFT", 30), - (126, G["false"]): ("SHIFT", 36), - (126, G["isvoid"]): ("SHIFT", 33), - (126, G["while"]): ("SHIFT", 22), + (126, G["let"]): ("SHIFT", 23), (126, G["~"]): ("SHIFT", 37), + (126, G["false"]): ("SHIFT", 36), + (126, G["string"]): ("SHIFT", 17), + (126, G["not"]): ("SHIFT", 44), (127, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), (128, G[";"]): ("REDUCE", G["attribute -> id : type error"]), (129, G["}"]): ("SHIFT", 130), - (130, G["class"]): ("REDUCE", G["class-def -> class type { feature-list }"]), (130, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), + (130, G["class"]): ("REDUCE", G["class-def -> class type { feature-list }"]), (131, G[";"]): ("SHIFT", 132), - (132, G["id"]): ("SHIFT", 4), (132, G["}"]): ("REDUCE", G["feature-list -> e"]), + (132, G["id"]): ("SHIFT", 4), (133, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), (134, G[";"]): ("SHIFT", 135), (135, G["id"]): ("SHIFT", 4), @@ -1051,11 +1051,11 @@ def __action_table(self): (136, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), (137, G["type"]): ("SHIFT", 138), (138, G["{"]): ("SHIFT", 139), - (139, G["id"]): ("SHIFT", 4), (139, G["}"]): ("REDUCE", G["feature-list -> e"]), + (139, G["id"]): ("SHIFT", 4), (140, G["}"]): ("SHIFT", 141), - (141, G["class"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), (141, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), + (141, G["class"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), (142, G["$"]): ("OK", None), (143, G["$"]): ("REDUCE", G["program -> class-list"]), (144, G["$"]): ("REDUCE", G["class-list -> class-def"]), @@ -1069,213 +1069,213 @@ def __goto_table(self): (0, G["program"]): 142, (0, G["class-def"]): 144, (0, G["class-list"]): 143, - (3, G["attribute"]): 131, - (3, G["method"]): 134, (3, G["feature-list"]): 129, + (3, G["method"]): 134, + (3, G["attribute"]): 131, (5, G["param-list"]): 117, (9, G["param-list"]): 10, + (14, G["atom"]): 40, (14, G["arith"]): 47, + (14, G["expr"]): 115, (14, G["factor"]): 54, - (14, G["atom"]): 40, (14, G["term"]): 59, (14, G["function-call"]): 38, - (14, G["expr"]): 115, (14, G["comp"]): 46, (16, G["atom"]): 40, - (16, G["expr-list"]): 111, - (16, G["arith"]): 47, - (16, G["term"]): 59, (16, G["expr"]): 66, - (16, G["factor"]): 54, + (16, G["arith"]): 47, (16, G["comp"]): 46, (16, G["function-call"]): 38, - (19, G["arith"]): 47, + (16, G["term"]): 59, + (16, G["expr-list"]): 111, + (16, G["factor"]): 54, (19, G["atom"]): 40, - (19, G["term"]): 59, - (19, G["expr"]): 108, - (19, G["factor"]): 54, (19, G["comp"]): 46, + (19, G["term"]): 59, (19, G["function-call"]): 38, + (19, G["arith"]): 47, + (19, G["expr"]): 108, (19, G["block"]): 106, + (19, G["factor"]): 54, + (20, G["atom"]): 40, (20, G["arith"]): 47, - (20, G["comp"]): 46, - (20, G["function-call"]): 38, (20, G["term"]): 59, - (20, G["factor"]): 54, - (20, G["atom"]): 40, (20, G["expr"]): 104, + (20, G["factor"]): 54, + (20, G["function-call"]): 38, + (20, G["comp"]): 46, (21, G["term"]): 59, + (21, G["comp"]): 46, (21, G["atom"]): 40, + (21, G["factor"]): 54, (21, G["arith"]): 47, - (21, G["comp"]): 46, (21, G["expr"]): 98, (21, G["function-call"]): 38, - (21, G["factor"]): 54, + (22, G["factor"]): 54, (22, G["atom"]): 40, (22, G["arith"]): 47, (22, G["term"]): 59, + (22, G["function-call"]): 38, (22, G["expr"]): 94, (22, G["comp"]): 46, - (22, G["function-call"]): 38, - (22, G["factor"]): 54, (23, G["declaration-list"]): 91, (27, G["declaration-list"]): 28, - (29, G["term"]): 59, + (29, G["arith"]): 47, (29, G["factor"]): 54, (29, G["atom"]): 40, - (29, G["expr"]): 88, - (29, G["arith"]): 47, (29, G["comp"]): 46, + (29, G["expr"]): 88, + (29, G["term"]): 59, (29, G["function-call"]): 38, - (30, G["term"]): 59, + (30, G["comp"]): 46, (30, G["arith"]): 47, - (30, G["expr"]): 77, - (30, G["atom"]): 40, + (30, G["term"]): 59, (30, G["function-call"]): 38, + (30, G["atom"]): 40, + (30, G["expr"]): 77, (30, G["factor"]): 54, - (30, G["comp"]): 46, (33, G["atom"]): 40, (33, G["factor"]): 76, (33, G["function-call"]): 38, - (37, G["atom"]): 40, (37, G["factor"]): 39, + (37, G["atom"]): 40, (37, G["function-call"]): 38, (43, G["atom"]): 40, - (43, G["expr-list"]): 64, - (43, G["arith"]): 47, - (43, G["term"]): 59, (43, G["expr"]): 66, - (43, G["factor"]): 54, + (43, G["arith"]): 47, (43, G["comp"]): 46, + (43, G["expr-list"]): 64, (43, G["function-call"]): 38, - (44, G["term"]): 59, - (44, G["arith"]): 47, + (43, G["term"]): 59, + (43, G["factor"]): 54, (44, G["atom"]): 40, - (44, G["factor"]): 54, + (44, G["arith"]): 47, (44, G["function-call"]): 38, - (44, G["expr"]): 45, + (44, G["factor"]): 54, + (44, G["term"]): 59, (44, G["comp"]): 46, - (48, G["term"]): 49, - (48, G["atom"]): 40, + (44, G["expr"]): 45, (48, G["factor"]): 54, + (48, G["atom"]): 40, + (48, G["term"]): 49, (48, G["function-call"]): 38, - (50, G["atom"]): 40, (50, G["factor"]): 51, + (50, G["atom"]): 40, (50, G["function-call"]): 38, (52, G["factor"]): 53, (52, G["atom"]): 40, (52, G["function-call"]): 38, + (55, G["factor"]): 54, (55, G["term"]): 56, (55, G["atom"]): 40, - (55, G["factor"]): 54, (55, G["function-call"]): 38, - (57, G["arith"]): 58, + (57, G["function-call"]): 38, (57, G["factor"]): 54, - (57, G["term"]): 59, (57, G["atom"]): 40, - (57, G["function-call"]): 38, - (60, G["arith"]): 61, + (57, G["term"]): 59, + (57, G["arith"]): 58, + (60, G["function-call"]): 38, (60, G["factor"]): 54, - (60, G["term"]): 59, (60, G["atom"]): 40, - (60, G["function-call"]): 38, - (62, G["arith"]): 63, + (60, G["arith"]): 61, + (60, G["term"]): 59, + (62, G["function-call"]): 38, (62, G["factor"]): 54, - (62, G["term"]): 59, (62, G["atom"]): 40, - (62, G["function-call"]): 38, + (62, G["term"]): 59, + (62, G["arith"]): 63, (67, G["atom"]): 40, + (67, G["expr"]): 66, (67, G["expr-list"]): 68, (67, G["arith"]): 47, - (67, G["term"]): 59, - (67, G["expr"]): 66, - (67, G["factor"]): 54, (67, G["comp"]): 46, (67, G["function-call"]): 38, + (67, G["term"]): 59, + (67, G["factor"]): 54, (73, G["atom"]): 40, - (73, G["expr-list"]): 74, - (73, G["arith"]): 47, - (73, G["term"]): 59, (73, G["expr"]): 66, - (73, G["factor"]): 54, + (73, G["arith"]): 47, (73, G["comp"]): 46, (73, G["function-call"]): 38, + (73, G["term"]): 59, + (73, G["expr-list"]): 74, + (73, G["factor"]): 54, (78, G["case-list"]): 86, - (82, G["arith"]): 47, (82, G["atom"]): 40, - (82, G["term"]): 59, - (82, G["factor"]): 54, (82, G["comp"]): 46, - (82, G["expr"]): 83, + (82, G["term"]): 59, (82, G["function-call"]): 38, + (82, G["arith"]): 47, + (82, G["expr"]): 83, + (82, G["factor"]): 54, (84, G["case-list"]): 85, (89, G["declaration-list"]): 90, - (92, G["term"]): 59, - (92, G["arith"]): 47, (92, G["atom"]): 40, - (92, G["factor"]): 54, - (92, G["expr"]): 93, + (92, G["arith"]): 47, (92, G["function-call"]): 38, + (92, G["factor"]): 54, + (92, G["term"]): 59, (92, G["comp"]): 46, - (95, G["expr"]): 96, - (95, G["arith"]): 47, - (95, G["factor"]): 54, + (92, G["expr"]): 93, + (95, G["comp"]): 46, (95, G["atom"]): 40, - (95, G["function-call"]): 38, + (95, G["arith"]): 47, (95, G["term"]): 59, - (95, G["comp"]): 46, - (99, G["expr"]): 100, + (95, G["expr"]): 96, + (95, G["function-call"]): 38, + (95, G["factor"]): 54, (99, G["atom"]): 40, (99, G["arith"]): 47, - (99, G["term"]): 59, - (99, G["comp"]): 46, - (99, G["factor"]): 54, + (99, G["expr"]): 100, (99, G["function-call"]): 38, - (101, G["comp"]): 46, + (99, G["factor"]): 54, + (99, G["comp"]): 46, + (99, G["term"]): 59, (101, G["term"]): 59, - (101, G["atom"]): 40, (101, G["arith"]): 47, - (101, G["expr"]): 102, + (101, G["comp"]): 46, (101, G["factor"]): 54, + (101, G["expr"]): 102, + (101, G["atom"]): 40, (101, G["function-call"]): 38, - (109, G["arith"]): 47, (109, G["atom"]): 40, + (109, G["comp"]): 46, (109, G["term"]): 59, + (109, G["function-call"]): 38, + (109, G["arith"]): 47, (109, G["expr"]): 108, (109, G["factor"]): 54, - (109, G["comp"]): 46, (109, G["block"]): 110, - (109, G["function-call"]): 38, - (113, G["term"]): 59, - (113, G["arith"]): 47, (113, G["atom"]): 40, - (113, G["factor"]): 54, + (113, G["arith"]): 47, (113, G["function-call"]): 38, (113, G["expr"]): 114, + (113, G["factor"]): 54, + (113, G["term"]): 59, (113, G["comp"]): 46, + (121, G["atom"]): 40, (121, G["arith"]): 47, (121, G["factor"]): 54, - (121, G["atom"]): 40, (121, G["term"]): 59, (121, G["function-call"]): 38, (121, G["expr"]): 122, (121, G["comp"]): 46, - (126, G["arith"]): 47, (126, G["atom"]): 40, + (126, G["comp"]): 46, (126, G["term"]): 59, + (126, G["function-call"]): 38, + (126, G["arith"]): 47, (126, G["expr"]): 127, (126, G["factor"]): 54, - (126, G["comp"]): 46, - (126, G["function-call"]): 38, - (132, G["attribute"]): 131, - (132, G["method"]): 134, (132, G["feature-list"]): 133, - (135, G["attribute"]): 131, + (132, G["method"]): 134, + (132, G["attribute"]): 131, (135, G["method"]): 134, + (135, G["attribute"]): 131, (135, G["feature-list"]): 136, (139, G["feature-list"]): 140, - (139, G["attribute"]): 131, (139, G["method"]): 134, - (144, G["class-def"]): 144, + (139, G["attribute"]): 131, (144, G["class-list"]): 145, + (144, G["class-def"]): 144, } From 5fc945caa583673f6dc112395a95d119b5d747a3 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Sat, 25 Apr 2020 13:37:41 -0400 Subject: [PATCH 014/143] First stage of Recovery Mode working good --- .../__pycache__/parsing.cpython-37.pyc | Bin 10862 -> 11093 bytes cmp/parsing/lexing.py | 16 +- cmp/parsing/parsing.py | 25 +- cmp/parsing/serialization.py | 12 +- grammar.py | 12 +- lexer.py | 4 +- main.py | 11 + parser.py | 1206 ++++++++--------- scripts/main.cl | 2 +- 9 files changed, 659 insertions(+), 629 deletions(-) diff --git a/cmp/parsing/__pycache__/parsing.cpython-37.pyc b/cmp/parsing/__pycache__/parsing.cpython-37.pyc index 1a59b8bb552c4f938e461548fb7fe9f4dc76cc1b..12a9b2b2d451e12152e518389754b2c53ea80b6e 100644 GIT binary patch delta 902 zcmZ`&&1(};5P$RbGn)^SHa3Y0rfHL=MWqM9Ds2U8FJ8npv?|&*c9YN~O`6xOr1dR@ z1_Z6Pg?G|YNWp(VQ1IXyP z?E74sCY*AuNKjO66qHlMrChP4RwhX;pb|$bS?miC`8s;hXquSoL9z05o7k$XM6K

SlEFUxZpRhJ%b@`!jeW57al(NsG2&{q<|Mg-RF_f2c4utWSE5_M zqW>SP7T`Lz_wVKX;0CT_x*jLMiLDm^Sv(D}l?Vxw26e4^-Z|g|_hSuuo?OphzSs3} z+6?XD`hQR%l(^~?x473!28rwEKE6k?m~q-{!)fP618`T9`w%@6ck~9V!4}jqlY|?^ zu&tLoIQ)BVG{fB51#a0eh$J?Cc~_poL9w3b3U%PWT1yvpL0T$aTXD>Pw=nXZ|MXv=b{rCep&SzgGo z0(M|wgsa+KO-m`~>a1NxOA^Ww<`G(Id9IRc>9f`H(tL#t$oPzetOQkj>xxizT0r-M zvllQz3>{Ref(fP;1WG%=f;R9$fF@9zXsM{F7N$Pb7WyWQLKG5kLcHm|1$V?y@*_MI z-qadA6C0_d_panwmvB$KOeM7YXg(1)(mi4`*)95e=HP{R*s}nyg*W|AcKZfqKL@<{ zDjGPH!ZyT0x(V+@sP|a#uilctM)GKA6V11>1b-DQVVmM+@3vRcGT9CNp=2c3G6(0Y X_EI@FjHzU?PmJ`Xj8y_bGid$-+1A!E delta 627 zcmZWm&1(}u6rVSRhn#UvPsl~AX-uI^Wd$bs8Byz+3k`iQq6q#A9s(Y``_24*^WN`0X1<;Kel~e5kuZo{ z*MB{~d}QDIq*WNxB|R>~>j5D)xDZeq0@j1hZ9H8Vuk8_vP#a{93etdP#Jk{An+-KK z)Y%%bm8Yx=%YftN=#tW;{IQ_noeU;4m+dD370g!U&K8m)BAwJG?E#+?+C>`ZLDZL; z9dW_eM6?UGIzlp}O9P{G)z|&#AFWGIkV{iCKNiFVT{oVQzmXA20!0}3*-YwQUk<7H zG5l)gG7J6lL}-n;9ce~o&qG36kK?A9g#>1c#dLBw$)cdPF-p!5e+!-}-Wgj=Pt9_# z-f~ZJ-sT7M^;Z5TVZ z6eJ9E?%Z&==h(c8{hd$Bd!MAoc0crf5W+*uSIliI^7ul2q!)IUmW;39bm=f=tvbBLC2Jnu;fD2J zo%%?ozrio%GPWvr;UoU2?E1%hcXda4RpxvMz3I@Kui|udEf#j>S diff --git a/cmp/parsing/lexing.py b/cmp/parsing/lexing.py index f78a61361..29425020f 100644 --- a/cmp/parsing/lexing.py +++ b/cmp/parsing/lexing.py @@ -48,8 +48,8 @@ def __init__(self, table: List[Tuple[str, str]], eof: str, if error_handler is None: error_handler = self.error - self.lineno: int = 0 # Current line number - self.column: int = 0 # Current column in the line + self.lineno: int = 1 # Current line number + self.column: int = 1 # Current column in the line self.position: int = 0 # Current position in recognition self.token: Token = Token('', '', 0, 0) # Current token in recognition self.pattern: Pattern = self._build_regex(table) @@ -74,23 +74,23 @@ def tokenize(self, text: str) -> Generator[Token, None, None]: if token_type in self.token_rules: token = self.token_rules[token_type](self) - if token is None or not isinstance(token, Token): - continue - yield token + if token is not None and isinstance(token, Token): + yield token + continue yield self.token self.position = match.end() - self.column += len(match.string) + self.column += len(match.group()) yield Token('$', self.eof, self.lineno, self.column) @staticmethod def print_error(error_msg): - sys.stderr(error_msg) + sys.stderr.write(error_msg + '\n') @staticmethod def error(lexer: 'Lexer') -> None: - lexer.print_error(f'LexerError: Unexpected symbol "{lexer.token.lex}"\n') + lexer.print_error(f'LexerError: Unexpected symbol "{lexer.token.lex}"') lexer.position += 1 lexer.column += 1 diff --git a/cmp/parsing/parsing.py b/cmp/parsing/parsing.py index 3a2784634..e466273d8 100755 --- a/cmp/parsing/parsing.py +++ b/cmp/parsing/parsing.py @@ -385,11 +385,28 @@ def __call__(self, tokens): state = stack[-1] lookahead = tokens[cursor] + ########################## + # Error Handling Section # + ########################## if (state, lookahead.token_type) not in self.action: - pass - - assert (state, lookahead.token_type) in self.action, f'ParsingError: in ' \ - f'{(state, lookahead.lex, lookahead.token_type)} ' + try: + # Try to insert an error token into the stack + action, tag = self.action[state, self.G.ERROR] + lookahead.token_type = self.G.ERROR + stack += [lookahead.token_type, lookahead.lex, tag] + cursor += 1 + except KeyError: + # If en error insertion fails then the parsing process enter into a panic mode recovery + sys.stderr.write(f'{lookahead.line, lookahead.column} - SyntacticError: ERROR at or near "{lookahead.lex}"\n') + while (state, lookahead.token_type) not in self.action: + cursor += 1 + if cursor >= len(tokens): + return None + lookahead = tokens[cursor] + continue + ####### + # End # + ####### action, tag = self.action[state, lookahead.token_type] diff --git a/cmp/parsing/serialization.py b/cmp/parsing/serialization.py index c8cac0ef8..6008cb093 100644 --- a/cmp/parsing/serialization.py +++ b/cmp/parsing/serialization.py @@ -12,12 +12,12 @@ def __init__(self, verbose=False): self.action = self.__action_table() self.goto = self.__goto_table() - def __action_table(self): - G = self.G + @staticmethod + def __action_table(): return %s - def __goto_table(self): - G = self.G + @staticmethod + def __goto_table(): return %s """ @@ -29,8 +29,8 @@ def __goto_table(self): class %s(Lexer): def __init__(self): - self.lineno = 0 - self.column = 0 + self.lineno = 1 + self.column = 1 self.position = 0 self.token = Token('', '', 0, 0) self.pattern = re.compile(r'%s') diff --git a/grammar.py b/grammar.py index 71f53c8ce..4db70523b 100644 --- a/grammar.py +++ b/grammar.py @@ -1,9 +1,11 @@ import inspect +import time import astnodes as ast from cmp.parsing.parsing import LALR1Parser from cmp.pycompiler import Grammar +t = time.time() G = Grammar() ################# @@ -64,7 +66,7 @@ def newline(lexer): lexer.lineno += len(lexer.token.lex) lexer.position += len(lexer.token.lex) - lexer.column = 0 + lexer.column = 1 @G.terminal('whitespace', r' +') @@ -81,9 +83,9 @@ def tab(lexer): @G.lexical_error def lexical_error(lexer): - lexer.print_error(f'{lexer.lineno, lexer.column} -LexicographicError: ERROR "{lexer.token.lex}"\n') - lexer.position += 1 + lexer.print_error(f'{lexer.lineno, lexer.column} -LexicographicError: ERROR "{lexer.token.lex}"') lexer.column += 1 + lexer.position += 1 ############### @@ -175,9 +177,9 @@ def attribute_error(s): return ast.AttrDeclarationNode(s[1], s[3]) -if __name__ == '__main__': - import time +print('Build G :', time.time() - t) +if __name__ == '__main__': t = time.time() G.serialize_lexer('CoolLexer', inspect.getmodulename(__file__)) G.serialize_parser(LALR1Parser(G), 'CoolParser', inspect.getmodulename(__file__)) diff --git a/lexer.py b/lexer.py index fde21a4e6..1c3a05d00 100644 --- a/lexer.py +++ b/lexer.py @@ -6,8 +6,8 @@ class CoolLexer(Lexer): def __init__(self): - self.lineno = 0 - self.column = 0 + self.lineno = 1 + self.column = 1 self.position = 0 self.token = Token('', '', 0, 0) self.pattern = re.compile(r'(?P\n+)|(?P +)|(?P\t+)|(inherits)|(isvoid)|(class)|(while)|(false)|(then)|(else)|(loop)|(pool)|(case)|(esac)|(true)|(<\-)|(let)|(new)|(not)|(\{)|(\})|(\()|(\))|(\.)|(=>)|(if)|(fi)|(in)|(of)|(\+)|(\-)|(\*)|(<=)|(\~)|(,)|(:)|(;)|(@)|(/)|(<)|(=)|(?P[a-z][a-zA-Z0-9_]*)|(?P[A-Z][a-zA-Z0-9_]*)|(?P\"[^\"]*\")|(?P\d+)|(?P\'[^\']*\')') diff --git a/main.py b/main.py index e69de29bb..d6214fb06 100644 --- a/main.py +++ b/main.py @@ -0,0 +1,11 @@ +import time + +from lexer import CoolLexer +from parser import CoolParser + + +if __name__ == '__main__': + t = time.time() + CoolLexer() + CoolParser() + print('Create :', time.time() - t) diff --git a/parser.py b/parser.py index 7273cee04..5ab542aba 100644 --- a/parser.py +++ b/parser.py @@ -10,13 +10,13 @@ def __init__(self, verbose=False): self.action = self.__action_table() self.goto = self.__goto_table() - def __action_table(self): - G = self.G + @staticmethod + def __action_table(): return { (0, G["class"]): ("SHIFT", 1), (1, G["type"]): ("SHIFT", 2), - (2, G["{"]): ("SHIFT", 3), (2, G["inherits"]): ("SHIFT", 137), + (2, G["{"]): ("SHIFT", 3), (3, G["}"]): ("REDUCE", G["feature-list -> e"]), (3, G["id"]): ("SHIFT", 4), (4, G[":"]): ("SHIFT", 124), @@ -32,158 +32,158 @@ def __action_table(self): (11, G[":"]): ("SHIFT", 12), (12, G["type"]): ("SHIFT", 13), (13, G["{"]): ("SHIFT", 14), - (14, G["~"]): ("SHIFT", 37), + (14, G["{"]): ("SHIFT", 19), (14, G["if"]): ("SHIFT", 21), + (14, G["not"]): ("SHIFT", 44), + (14, G["~"]): ("SHIFT", 37), + (14, G["false"]): ("SHIFT", 36), (14, G["case"]): ("SHIFT", 30), - (14, G["isvoid"]): ("SHIFT", 33), (14, G["id"]): ("SHIFT", 15), + (14, G["new"]): ("SHIFT", 31), + (14, G["isvoid"]): ("SHIFT", 33), + (14, G["true"]): ("SHIFT", 35), (14, G["string"]): ("SHIFT", 17), - (14, G["false"]): ("SHIFT", 36), - (14, G["{"]): ("SHIFT", 19), - (14, G["not"]): ("SHIFT", 44), - (14, G["let"]): ("SHIFT", 23), - (14, G["while"]): ("SHIFT", 22), (14, G["("]): ("SHIFT", 20), - (14, G["true"]): ("SHIFT", 35), + (14, G["while"]): ("SHIFT", 22), (14, G["int"]): ("SHIFT", 18), - (14, G["new"]): ("SHIFT", 31), - (15, G["-"]): ("REDUCE", G["atom -> id"]), + (14, G["let"]): ("SHIFT", 23), + (15, G["("]): ("SHIFT", 16), + (15, G["pool"]): ("REDUCE", G["atom -> id"]), + (15, G["+"]): ("REDUCE", G["atom -> id"]), + (15, G["in"]): ("REDUCE", G["atom -> id"]), (15, G["}"]): ("REDUCE", G["atom -> id"]), + (15, G["-"]): ("REDUCE", G["atom -> id"]), + (15, G["then"]): ("REDUCE", G["atom -> id"]), (15, G["*"]): ("REDUCE", G["atom -> id"]), (15, G["of"]): ("REDUCE", G["atom -> id"]), - (15, G["then"]): ("REDUCE", G["atom -> id"]), (15, G["/"]): ("REDUCE", G["atom -> id"]), + (15, G["else"]): ("REDUCE", G["atom -> id"]), (15, G["<"]): ("REDUCE", G["atom -> id"]), (15, G[")"]): ("REDUCE", G["atom -> id"]), - (15, G["else"]): ("REDUCE", G["atom -> id"]), + (15, G["fi"]): ("REDUCE", G["atom -> id"]), (15, G["<="]): ("REDUCE", G["atom -> id"]), (15, G["."]): ("REDUCE", G["atom -> id"]), - (15, G["fi"]): ("REDUCE", G["atom -> id"]), - (15, G[","]): ("REDUCE", G["atom -> id"]), (15, G["="]): ("REDUCE", G["atom -> id"]), + (15, G[","]): ("REDUCE", G["atom -> id"]), (15, G[";"]): ("REDUCE", G["atom -> id"]), - (15, G["@"]): ("REDUCE", G["atom -> id"]), (15, G["loop"]): ("REDUCE", G["atom -> id"]), - (15, G["pool"]): ("REDUCE", G["atom -> id"]), - (15, G["+"]): ("REDUCE", G["atom -> id"]), - (15, G["in"]): ("REDUCE", G["atom -> id"]), + (15, G["@"]): ("REDUCE", G["atom -> id"]), (15, G["<-"]): ("SHIFT", 113), - (15, G["("]): ("SHIFT", 16), - (16, G["("]): ("SHIFT", 20), - (16, G["isvoid"]): ("SHIFT", 33), - (16, G["while"]): ("SHIFT", 22), - (16, G["id"]): ("SHIFT", 15), - (16, G["let"]): ("SHIFT", 23), - (16, G["not"]): ("SHIFT", 44), - (16, G["~"]): ("SHIFT", 37), - (16, G["{"]): ("SHIFT", 19), - (16, G["new"]): ("SHIFT", 31), - (16, G["case"]): ("SHIFT", 30), - (16, G["if"]): ("SHIFT", 21), (16, G["int"]): ("SHIFT", 18), (16, G["true"]): ("SHIFT", 35), + (16, G["id"]): ("SHIFT", 15), + (16, G["new"]): ("SHIFT", 31), (16, G["false"]): ("SHIFT", 36), + (16, G["if"]): ("SHIFT", 21), + (16, G["("]): ("SHIFT", 20), (16, G["string"]): ("SHIFT", 17), + (16, G["while"]): ("SHIFT", 22), + (16, G["isvoid"]): ("SHIFT", 33), + (16, G["{"]): ("SHIFT", 19), + (16, G["let"]): ("SHIFT", 23), + (16, G["case"]): ("SHIFT", 30), + (16, G["~"]): ("SHIFT", 37), + (16, G["not"]): ("SHIFT", 44), + (17, G["pool"]): ("REDUCE", G["atom -> string"]), + (17, G["+"]): ("REDUCE", G["atom -> string"]), + (17, G["in"]): ("REDUCE", G["atom -> string"]), (17, G["-"]): ("REDUCE", G["atom -> string"]), (17, G["}"]): ("REDUCE", G["atom -> string"]), + (17, G["then"]): ("REDUCE", G["atom -> string"]), (17, G["*"]): ("REDUCE", G["atom -> string"]), (17, G["of"]): ("REDUCE", G["atom -> string"]), - (17, G["then"]): ("REDUCE", G["atom -> string"]), (17, G["/"]): ("REDUCE", G["atom -> string"]), + (17, G["else"]): ("REDUCE", G["atom -> string"]), (17, G["<"]): ("REDUCE", G["atom -> string"]), (17, G[")"]): ("REDUCE", G["atom -> string"]), - (17, G["else"]): ("REDUCE", G["atom -> string"]), - (17, G["<="]): ("REDUCE", G["atom -> string"]), - (17, G["."]): ("REDUCE", G["atom -> string"]), (17, G["fi"]): ("REDUCE", G["atom -> string"]), - (17, G[","]): ("REDUCE", G["atom -> string"]), + (17, G["."]): ("REDUCE", G["atom -> string"]), + (17, G["<="]): ("REDUCE", G["atom -> string"]), (17, G["="]): ("REDUCE", G["atom -> string"]), + (17, G[","]): ("REDUCE", G["atom -> string"]), (17, G[";"]): ("REDUCE", G["atom -> string"]), - (17, G["@"]): ("REDUCE", G["atom -> string"]), (17, G["loop"]): ("REDUCE", G["atom -> string"]), - (17, G["pool"]): ("REDUCE", G["atom -> string"]), - (17, G["+"]): ("REDUCE", G["atom -> string"]), - (17, G["in"]): ("REDUCE", G["atom -> string"]), + (17, G["@"]): ("REDUCE", G["atom -> string"]), + (18, G["pool"]): ("REDUCE", G["atom -> int"]), + (18, G["+"]): ("REDUCE", G["atom -> int"]), + (18, G["in"]): ("REDUCE", G["atom -> int"]), (18, G["}"]): ("REDUCE", G["atom -> int"]), (18, G["-"]): ("REDUCE", G["atom -> int"]), + (18, G["then"]): ("REDUCE", G["atom -> int"]), (18, G["*"]): ("REDUCE", G["atom -> int"]), (18, G["of"]): ("REDUCE", G["atom -> int"]), - (18, G["then"]): ("REDUCE", G["atom -> int"]), (18, G["/"]): ("REDUCE", G["atom -> int"]), + (18, G["else"]): ("REDUCE", G["atom -> int"]), (18, G["<"]): ("REDUCE", G["atom -> int"]), (18, G[")"]): ("REDUCE", G["atom -> int"]), - (18, G["else"]): ("REDUCE", G["atom -> int"]), - (18, G["<="]): ("REDUCE", G["atom -> int"]), - (18, G["."]): ("REDUCE", G["atom -> int"]), (18, G["fi"]): ("REDUCE", G["atom -> int"]), - (18, G[","]): ("REDUCE", G["atom -> int"]), + (18, G["."]): ("REDUCE", G["atom -> int"]), + (18, G["<="]): ("REDUCE", G["atom -> int"]), (18, G["="]): ("REDUCE", G["atom -> int"]), + (18, G[","]): ("REDUCE", G["atom -> int"]), (18, G[";"]): ("REDUCE", G["atom -> int"]), - (18, G["@"]): ("REDUCE", G["atom -> int"]), (18, G["loop"]): ("REDUCE", G["atom -> int"]), - (18, G["pool"]): ("REDUCE", G["atom -> int"]), - (18, G["+"]): ("REDUCE", G["atom -> int"]), - (18, G["in"]): ("REDUCE", G["atom -> int"]), + (18, G["@"]): ("REDUCE", G["atom -> int"]), + (19, G["case"]): ("SHIFT", 30), + (19, G["not"]): ("SHIFT", 44), + (19, G["id"]): ("SHIFT", 15), + (19, G["~"]): ("SHIFT", 37), (19, G["isvoid"]): ("SHIFT", 33), - (19, G["int"]): ("SHIFT", 18), (19, G["true"]): ("SHIFT", 35), - (19, G["id"]): ("SHIFT", 15), - (19, G["new"]): ("SHIFT", 31), - (19, G["while"]): ("SHIFT", 22), - (19, G["case"]): ("SHIFT", 30), + (19, G["int"]): ("SHIFT", 18), (19, G["if"]): ("SHIFT", 21), - (19, G["("]): ("SHIFT", 20), (19, G["{"]): ("SHIFT", 19), (19, G["let"]): ("SHIFT", 23), - (19, G["~"]): ("SHIFT", 37), + (19, G["new"]): ("SHIFT", 31), (19, G["false"]): ("SHIFT", 36), (19, G["string"]): ("SHIFT", 17), - (19, G["not"]): ("SHIFT", 44), - (20, G["isvoid"]): ("SHIFT", 33), + (19, G["("]): ("SHIFT", 20), + (19, G["while"]): ("SHIFT", 22), + (20, G["{"]): ("SHIFT", 19), + (20, G["let"]): ("SHIFT", 23), (20, G["new"]): ("SHIFT", 31), + (20, G["string"]): ("SHIFT", 17), (20, G["true"]): ("SHIFT", 35), (20, G["int"]): ("SHIFT", 18), (20, G["id"]): ("SHIFT", 15), - (20, G["false"]): ("SHIFT", 36), + (20, G["while"]): ("SHIFT", 22), (20, G["~"]): ("SHIFT", 37), - (20, G["string"]): ("SHIFT", 17), - (20, G["{"]): ("SHIFT", 19), - (20, G["if"]): ("SHIFT", 21), - (20, G["let"]): ("SHIFT", 23), - (20, G["not"]): ("SHIFT", 44), (20, G["("]): ("SHIFT", 20), - (20, G["while"]): ("SHIFT", 22), (20, G["case"]): ("SHIFT", 30), - (21, G["~"]): ("SHIFT", 37), - (21, G["id"]): ("SHIFT", 15), - (21, G["isvoid"]): ("SHIFT", 33), - (21, G["if"]): ("SHIFT", 21), - (21, G["case"]): ("SHIFT", 30), + (20, G["not"]): ("SHIFT", 44), + (20, G["false"]): ("SHIFT", 36), + (20, G["isvoid"]): ("SHIFT", 33), + (20, G["if"]): ("SHIFT", 21), + (21, G["int"]): ("SHIFT", 18), + (21, G["true"]): ("SHIFT", 35), + (21, G["while"]): ("SHIFT", 22), (21, G["false"]): ("SHIFT", 36), - (21, G["{"]): ("SHIFT", 19), + (21, G["new"]): ("SHIFT", 31), (21, G["string"]): ("SHIFT", 17), + (21, G["let"]): ("SHIFT", 23), (21, G["("]): ("SHIFT", 20), - (21, G["new"]): ("SHIFT", 31), - (21, G["true"]): ("SHIFT", 35), - (21, G["int"]): ("SHIFT", 18), (21, G["not"]): ("SHIFT", 44), - (21, G["let"]): ("SHIFT", 23), - (21, G["while"]): ("SHIFT", 22), - (22, G["id"]): ("SHIFT", 15), - (22, G["true"]): ("SHIFT", 35), - (22, G["int"]): ("SHIFT", 18), - (22, G["new"]): ("SHIFT", 31), - (22, G["not"]): ("SHIFT", 44), - (22, G["let"]): ("SHIFT", 23), + (21, G["{"]): ("SHIFT", 19), + (21, G["id"]): ("SHIFT", 15), + (21, G["~"]): ("SHIFT", 37), + (21, G["if"]): ("SHIFT", 21), + (21, G["case"]): ("SHIFT", 30), + (21, G["isvoid"]): ("SHIFT", 33), + (22, G["{"]): ("SHIFT", 19), (22, G["~"]): ("SHIFT", 37), - (22, G["("]): ("SHIFT", 20), + (22, G["id"]): ("SHIFT", 15), (22, G["string"]): ("SHIFT", 17), - (22, G["false"]): ("SHIFT", 36), - (22, G["{"]): ("SHIFT", 19), - (22, G["if"]): ("SHIFT", 21), - (22, G["case"]): ("SHIFT", 30), + (22, G["("]): ("SHIFT", 20), (22, G["while"]): ("SHIFT", 22), (22, G["isvoid"]): ("SHIFT", 33), + (22, G["not"]): ("SHIFT", 44), + (22, G["false"]): ("SHIFT", 36), + (22, G["new"]): ("SHIFT", 31), + (22, G["case"]): ("SHIFT", 30), + (22, G["int"]): ("SHIFT", 18), + (22, G["true"]): ("SHIFT", 35), + (22, G["let"]): ("SHIFT", 23), + (22, G["if"]): ("SHIFT", 21), (23, G["id"]): ("SHIFT", 24), (24, G[":"]): ("SHIFT", 25), (25, G["type"]): ("SHIFT", 26), @@ -192,850 +192,850 @@ def __action_table(self): (26, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), (27, G["id"]): ("SHIFT", 24), (28, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), - (29, G["if"]): ("SHIFT", 21), - (29, G["case"]): ("SHIFT", 30), - (29, G["string"]): ("SHIFT", 17), - (29, G["("]): ("SHIFT", 20), - (29, G["while"]): ("SHIFT", 22), (29, G["isvoid"]): ("SHIFT", 33), - (29, G["not"]): ("SHIFT", 44), + (29, G["while"]): ("SHIFT", 22), (29, G["id"]): ("SHIFT", 15), (29, G["~"]): ("SHIFT", 37), (29, G["let"]): ("SHIFT", 23), - (29, G["new"]): ("SHIFT", 31), - (29, G["int"]): ("SHIFT", 18), - (29, G["true"]): ("SHIFT", 35), + (29, G["string"]): ("SHIFT", 17), + (29, G["("]): ("SHIFT", 20), (29, G["{"]): ("SHIFT", 19), + (29, G["if"]): ("SHIFT", 21), + (29, G["true"]): ("SHIFT", 35), + (29, G["not"]): ("SHIFT", 44), + (29, G["case"]): ("SHIFT", 30), (29, G["false"]): ("SHIFT", 36), - (30, G["case"]): ("SHIFT", 30), - (30, G["if"]): ("SHIFT", 21), - (30, G["while"]): ("SHIFT", 22), - (30, G["("]): ("SHIFT", 20), - (30, G["not"]): ("SHIFT", 44), - (30, G["let"]): ("SHIFT", 23), - (30, G["isvoid"]): ("SHIFT", 33), - (30, G["~"]): ("SHIFT", 37), + (29, G["new"]): ("SHIFT", 31), + (29, G["int"]): ("SHIFT", 18), (30, G["id"]): ("SHIFT", 15), - (30, G["{"]): ("SHIFT", 19), + (30, G["int"]): ("SHIFT", 18), + (30, G["true"]): ("SHIFT", 35), (30, G["string"]): ("SHIFT", 17), + (30, G["if"]): ("SHIFT", 21), + (30, G["~"]): ("SHIFT", 37), + (30, G["isvoid"]): ("SHIFT", 33), + (30, G["not"]): ("SHIFT", 44), (30, G["false"]): ("SHIFT", 36), - (30, G["true"]): ("SHIFT", 35), - (30, G["int"]): ("SHIFT", 18), (30, G["new"]): ("SHIFT", 31), + (30, G["case"]): ("SHIFT", 30), + (30, G["let"]): ("SHIFT", 23), + (30, G["("]): ("SHIFT", 20), + (30, G["{"]): ("SHIFT", 19), + (30, G["while"]): ("SHIFT", 22), (31, G["type"]): ("SHIFT", 32), - (32, G["}"]): ("REDUCE", G["atom -> new type"]), + (32, G["pool"]): ("REDUCE", G["atom -> new type"]), + (32, G["+"]): ("REDUCE", G["atom -> new type"]), + (32, G["in"]): ("REDUCE", G["atom -> new type"]), (32, G["-"]): ("REDUCE", G["atom -> new type"]), + (32, G["}"]): ("REDUCE", G["atom -> new type"]), + (32, G["then"]): ("REDUCE", G["atom -> new type"]), (32, G["*"]): ("REDUCE", G["atom -> new type"]), (32, G["of"]): ("REDUCE", G["atom -> new type"]), - (32, G["then"]): ("REDUCE", G["atom -> new type"]), (32, G["/"]): ("REDUCE", G["atom -> new type"]), + (32, G["else"]): ("REDUCE", G["atom -> new type"]), (32, G["<"]): ("REDUCE", G["atom -> new type"]), (32, G[")"]): ("REDUCE", G["atom -> new type"]), - (32, G["else"]): ("REDUCE", G["atom -> new type"]), - (32, G["<="]): ("REDUCE", G["atom -> new type"]), - (32, G["."]): ("REDUCE", G["atom -> new type"]), (32, G["fi"]): ("REDUCE", G["atom -> new type"]), - (32, G[","]): ("REDUCE", G["atom -> new type"]), + (32, G["."]): ("REDUCE", G["atom -> new type"]), + (32, G["<="]): ("REDUCE", G["atom -> new type"]), (32, G["="]): ("REDUCE", G["atom -> new type"]), + (32, G[","]): ("REDUCE", G["atom -> new type"]), (32, G[";"]): ("REDUCE", G["atom -> new type"]), - (32, G["@"]): ("REDUCE", G["atom -> new type"]), (32, G["loop"]): ("REDUCE", G["atom -> new type"]), - (32, G["pool"]): ("REDUCE", G["atom -> new type"]), - (32, G["+"]): ("REDUCE", G["atom -> new type"]), - (32, G["in"]): ("REDUCE", G["atom -> new type"]), - (33, G["id"]): ("SHIFT", 34), + (32, G["@"]): ("REDUCE", G["atom -> new type"]), (33, G["false"]): ("SHIFT", 36), - (33, G["string"]): ("SHIFT", 17), - (33, G["new"]): ("SHIFT", 31), - (33, G["~"]): ("SHIFT", 37), - (33, G["isvoid"]): ("SHIFT", 33), (33, G["("]): ("SHIFT", 20), + (33, G["~"]): ("SHIFT", 37), + (33, G["id"]): ("SHIFT", 34), (33, G["true"]): ("SHIFT", 35), + (33, G["string"]): ("SHIFT", 17), (33, G["int"]): ("SHIFT", 18), + (33, G["isvoid"]): ("SHIFT", 33), + (33, G["new"]): ("SHIFT", 31), + (34, G["("]): ("SHIFT", 16), + (34, G["pool"]): ("REDUCE", G["atom -> id"]), + (34, G["+"]): ("REDUCE", G["atom -> id"]), + (34, G["in"]): ("REDUCE", G["atom -> id"]), (34, G["-"]): ("REDUCE", G["atom -> id"]), (34, G["}"]): ("REDUCE", G["atom -> id"]), + (34, G["then"]): ("REDUCE", G["atom -> id"]), (34, G["*"]): ("REDUCE", G["atom -> id"]), (34, G["of"]): ("REDUCE", G["atom -> id"]), - (34, G["then"]): ("REDUCE", G["atom -> id"]), (34, G["/"]): ("REDUCE", G["atom -> id"]), + (34, G["else"]): ("REDUCE", G["atom -> id"]), (34, G["<"]): ("REDUCE", G["atom -> id"]), (34, G[")"]): ("REDUCE", G["atom -> id"]), - (34, G["else"]): ("REDUCE", G["atom -> id"]), - (34, G["<="]): ("REDUCE", G["atom -> id"]), - (34, G["."]): ("REDUCE", G["atom -> id"]), (34, G["fi"]): ("REDUCE", G["atom -> id"]), - (34, G[","]): ("REDUCE", G["atom -> id"]), + (34, G["."]): ("REDUCE", G["atom -> id"]), + (34, G["<="]): ("REDUCE", G["atom -> id"]), (34, G["="]): ("REDUCE", G["atom -> id"]), + (34, G[","]): ("REDUCE", G["atom -> id"]), (34, G[";"]): ("REDUCE", G["atom -> id"]), - (34, G["@"]): ("REDUCE", G["atom -> id"]), (34, G["loop"]): ("REDUCE", G["atom -> id"]), - (34, G["pool"]): ("REDUCE", G["atom -> id"]), - (34, G["+"]): ("REDUCE", G["atom -> id"]), - (34, G["in"]): ("REDUCE", G["atom -> id"]), - (34, G["("]): ("SHIFT", 16), + (34, G["@"]): ("REDUCE", G["atom -> id"]), + (35, G["pool"]): ("REDUCE", G["atom -> true"]), + (35, G["+"]): ("REDUCE", G["atom -> true"]), + (35, G["in"]): ("REDUCE", G["atom -> true"]), (35, G["}"]): ("REDUCE", G["atom -> true"]), (35, G["-"]): ("REDUCE", G["atom -> true"]), + (35, G["then"]): ("REDUCE", G["atom -> true"]), (35, G["*"]): ("REDUCE", G["atom -> true"]), (35, G["of"]): ("REDUCE", G["atom -> true"]), - (35, G["then"]): ("REDUCE", G["atom -> true"]), (35, G["/"]): ("REDUCE", G["atom -> true"]), + (35, G["else"]): ("REDUCE", G["atom -> true"]), (35, G["<"]): ("REDUCE", G["atom -> true"]), (35, G[")"]): ("REDUCE", G["atom -> true"]), - (35, G["else"]): ("REDUCE", G["atom -> true"]), - (35, G["<="]): ("REDUCE", G["atom -> true"]), - (35, G["."]): ("REDUCE", G["atom -> true"]), (35, G["fi"]): ("REDUCE", G["atom -> true"]), - (35, G[","]): ("REDUCE", G["atom -> true"]), + (35, G["."]): ("REDUCE", G["atom -> true"]), + (35, G["<="]): ("REDUCE", G["atom -> true"]), (35, G["="]): ("REDUCE", G["atom -> true"]), + (35, G[","]): ("REDUCE", G["atom -> true"]), (35, G[";"]): ("REDUCE", G["atom -> true"]), - (35, G["@"]): ("REDUCE", G["atom -> true"]), (35, G["loop"]): ("REDUCE", G["atom -> true"]), - (35, G["pool"]): ("REDUCE", G["atom -> true"]), - (35, G["+"]): ("REDUCE", G["atom -> true"]), - (35, G["in"]): ("REDUCE", G["atom -> true"]), + (35, G["@"]): ("REDUCE", G["atom -> true"]), + (36, G["pool"]): ("REDUCE", G["atom -> false"]), + (36, G["+"]): ("REDUCE", G["atom -> false"]), + (36, G["in"]): ("REDUCE", G["atom -> false"]), (36, G["-"]): ("REDUCE", G["atom -> false"]), (36, G["}"]): ("REDUCE", G["atom -> false"]), + (36, G["then"]): ("REDUCE", G["atom -> false"]), (36, G["*"]): ("REDUCE", G["atom -> false"]), (36, G["of"]): ("REDUCE", G["atom -> false"]), - (36, G["then"]): ("REDUCE", G["atom -> false"]), (36, G["/"]): ("REDUCE", G["atom -> false"]), + (36, G["else"]): ("REDUCE", G["atom -> false"]), (36, G["<"]): ("REDUCE", G["atom -> false"]), (36, G[")"]): ("REDUCE", G["atom -> false"]), - (36, G["else"]): ("REDUCE", G["atom -> false"]), - (36, G["<="]): ("REDUCE", G["atom -> false"]), - (36, G["."]): ("REDUCE", G["atom -> false"]), (36, G["fi"]): ("REDUCE", G["atom -> false"]), - (36, G[","]): ("REDUCE", G["atom -> false"]), + (36, G["."]): ("REDUCE", G["atom -> false"]), + (36, G["<="]): ("REDUCE", G["atom -> false"]), (36, G["="]): ("REDUCE", G["atom -> false"]), + (36, G[","]): ("REDUCE", G["atom -> false"]), (36, G[";"]): ("REDUCE", G["atom -> false"]), - (36, G["@"]): ("REDUCE", G["atom -> false"]), (36, G["loop"]): ("REDUCE", G["atom -> false"]), - (36, G["pool"]): ("REDUCE", G["atom -> false"]), - (36, G["+"]): ("REDUCE", G["atom -> false"]), - (36, G["in"]): ("REDUCE", G["atom -> false"]), - (37, G["id"]): ("SHIFT", 34), + (36, G["@"]): ("REDUCE", G["atom -> false"]), (37, G["false"]): ("SHIFT", 36), - (37, G["string"]): ("SHIFT", 17), - (37, G["new"]): ("SHIFT", 31), - (37, G["~"]): ("SHIFT", 37), - (37, G["isvoid"]): ("SHIFT", 33), (37, G["("]): ("SHIFT", 20), + (37, G["~"]): ("SHIFT", 37), + (37, G["id"]): ("SHIFT", 34), (37, G["true"]): ("SHIFT", 35), + (37, G["string"]): ("SHIFT", 17), (37, G["int"]): ("SHIFT", 18), - (38, G["}"]): ("REDUCE", G["atom -> function-call"]), + (37, G["isvoid"]): ("SHIFT", 33), + (37, G["new"]): ("SHIFT", 31), + (38, G["pool"]): ("REDUCE", G["atom -> function-call"]), + (38, G["+"]): ("REDUCE", G["atom -> function-call"]), + (38, G["in"]): ("REDUCE", G["atom -> function-call"]), (38, G["-"]): ("REDUCE", G["atom -> function-call"]), + (38, G["}"]): ("REDUCE", G["atom -> function-call"]), + (38, G["then"]): ("REDUCE", G["atom -> function-call"]), (38, G["*"]): ("REDUCE", G["atom -> function-call"]), (38, G["of"]): ("REDUCE", G["atom -> function-call"]), - (38, G["then"]): ("REDUCE", G["atom -> function-call"]), (38, G["/"]): ("REDUCE", G["atom -> function-call"]), + (38, G["else"]): ("REDUCE", G["atom -> function-call"]), (38, G["<"]): ("REDUCE", G["atom -> function-call"]), (38, G[")"]): ("REDUCE", G["atom -> function-call"]), - (38, G["else"]): ("REDUCE", G["atom -> function-call"]), - (38, G["<="]): ("REDUCE", G["atom -> function-call"]), - (38, G["."]): ("REDUCE", G["atom -> function-call"]), (38, G["fi"]): ("REDUCE", G["atom -> function-call"]), - (38, G[","]): ("REDUCE", G["atom -> function-call"]), + (38, G["."]): ("REDUCE", G["atom -> function-call"]), + (38, G["<="]): ("REDUCE", G["atom -> function-call"]), (38, G["="]): ("REDUCE", G["atom -> function-call"]), + (38, G[","]): ("REDUCE", G["atom -> function-call"]), (38, G[";"]): ("REDUCE", G["atom -> function-call"]), - (38, G["@"]): ("REDUCE", G["atom -> function-call"]), (38, G["loop"]): ("REDUCE", G["atom -> function-call"]), - (38, G["pool"]): ("REDUCE", G["atom -> function-call"]), - (38, G["+"]): ("REDUCE", G["atom -> function-call"]), - (38, G["in"]): ("REDUCE", G["atom -> function-call"]), - (39, G["-"]): ("REDUCE", G["factor -> ~ factor"]), + (38, G["@"]): ("REDUCE", G["atom -> function-call"]), + (39, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["+"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["in"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["}"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["-"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["then"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["*"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["of"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["then"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["/"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["else"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["<"]): ("REDUCE", G["factor -> ~ factor"]), (39, G[")"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["else"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["<="]): ("REDUCE", G["factor -> ~ factor"]), (39, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G[","]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["<="]): ("REDUCE", G["factor -> ~ factor"]), (39, G["="]): ("REDUCE", G["factor -> ~ factor"]), + (39, G[","]): ("REDUCE", G["factor -> ~ factor"]), (39, G[";"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["+"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["in"]): ("REDUCE", G["factor -> ~ factor"]), - (40, G["."]): ("SHIFT", 41), - (40, G["}"]): ("REDUCE", G["factor -> atom"]), + (40, G["@"]): ("SHIFT", 69), + (40, G["pool"]): ("REDUCE", G["factor -> atom"]), + (40, G["+"]): ("REDUCE", G["factor -> atom"]), + (40, G["in"]): ("REDUCE", G["factor -> atom"]), (40, G["-"]): ("REDUCE", G["factor -> atom"]), + (40, G["}"]): ("REDUCE", G["factor -> atom"]), + (40, G["then"]): ("REDUCE", G["factor -> atom"]), (40, G["*"]): ("REDUCE", G["factor -> atom"]), (40, G["of"]): ("REDUCE", G["factor -> atom"]), - (40, G["then"]): ("REDUCE", G["factor -> atom"]), (40, G["/"]): ("REDUCE", G["factor -> atom"]), + (40, G["else"]): ("REDUCE", G["factor -> atom"]), (40, G["<"]): ("REDUCE", G["factor -> atom"]), (40, G[")"]): ("REDUCE", G["factor -> atom"]), - (40, G["else"]): ("REDUCE", G["factor -> atom"]), - (40, G["<="]): ("REDUCE", G["factor -> atom"]), (40, G["fi"]): ("REDUCE", G["factor -> atom"]), - (40, G[","]): ("REDUCE", G["factor -> atom"]), + (40, G["<="]): ("REDUCE", G["factor -> atom"]), (40, G["="]): ("REDUCE", G["factor -> atom"]), + (40, G[","]): ("REDUCE", G["factor -> atom"]), (40, G[";"]): ("REDUCE", G["factor -> atom"]), (40, G["loop"]): ("REDUCE", G["factor -> atom"]), - (40, G["pool"]): ("REDUCE", G["factor -> atom"]), - (40, G["+"]): ("REDUCE", G["factor -> atom"]), - (40, G["in"]): ("REDUCE", G["factor -> atom"]), - (40, G["@"]): ("SHIFT", 69), + (40, G["."]): ("SHIFT", 41), (41, G["id"]): ("SHIFT", 42), (42, G["("]): ("SHIFT", 43), - (43, G["("]): ("SHIFT", 20), - (43, G["isvoid"]): ("SHIFT", 33), - (43, G["while"]): ("SHIFT", 22), - (43, G["id"]): ("SHIFT", 15), - (43, G["let"]): ("SHIFT", 23), - (43, G["not"]): ("SHIFT", 44), - (43, G["~"]): ("SHIFT", 37), - (43, G["{"]): ("SHIFT", 19), - (43, G["new"]): ("SHIFT", 31), - (43, G["case"]): ("SHIFT", 30), - (43, G["if"]): ("SHIFT", 21), (43, G["int"]): ("SHIFT", 18), (43, G["true"]): ("SHIFT", 35), + (43, G["id"]): ("SHIFT", 15), + (43, G["new"]): ("SHIFT", 31), (43, G["false"]): ("SHIFT", 36), + (43, G["if"]): ("SHIFT", 21), + (43, G["("]): ("SHIFT", 20), (43, G["string"]): ("SHIFT", 17), - (44, G["id"]): ("SHIFT", 15), - (44, G["not"]): ("SHIFT", 44), - (44, G["~"]): ("SHIFT", 37), + (43, G["while"]): ("SHIFT", 22), + (43, G["isvoid"]): ("SHIFT", 33), + (43, G["{"]): ("SHIFT", 19), + (43, G["let"]): ("SHIFT", 23), + (43, G["case"]): ("SHIFT", 30), + (43, G["~"]): ("SHIFT", 37), + (43, G["not"]): ("SHIFT", 44), + (44, G["false"]): ("SHIFT", 36), (44, G["let"]): ("SHIFT", 23), - (44, G["isvoid"]): ("SHIFT", 33), - (44, G["new"]): ("SHIFT", 31), + (44, G["id"]): ("SHIFT", 15), + (44, G["string"]): ("SHIFT", 17), (44, G["true"]): ("SHIFT", 35), (44, G["int"]): ("SHIFT", 18), - (44, G["string"]): ("SHIFT", 17), + (44, G["while"]): ("SHIFT", 22), (44, G["{"]): ("SHIFT", 19), + (44, G["not"]): ("SHIFT", 44), + (44, G["case"]): ("SHIFT", 30), + (44, G["isvoid"]): ("SHIFT", 33), (44, G["("]): ("SHIFT", 20), (44, G["if"]): ("SHIFT", 21), - (44, G["case"]): ("SHIFT", 30), - (44, G["false"]): ("SHIFT", 36), - (44, G["while"]): ("SHIFT", 22), - (45, G[";"]): ("REDUCE", G["expr -> not expr"]), - (45, G["}"]): ("REDUCE", G["expr -> not expr"]), - (45, G["loop"]): ("REDUCE", G["expr -> not expr"]), - (45, G["of"]): ("REDUCE", G["expr -> not expr"]), + (44, G["~"]): ("SHIFT", 37), + (44, G["new"]): ("SHIFT", 31), (45, G["then"]): ("REDUCE", G["expr -> not expr"]), + (45, G["of"]): ("REDUCE", G["expr -> not expr"]), (45, G["pool"]): ("REDUCE", G["expr -> not expr"]), - (45, G[")"]): ("REDUCE", G["expr -> not expr"]), (45, G["else"]): ("REDUCE", G["expr -> not expr"]), + (45, G[")"]): ("REDUCE", G["expr -> not expr"]), (45, G["fi"]): ("REDUCE", G["expr -> not expr"]), (45, G[","]): ("REDUCE", G["expr -> not expr"]), (45, G["in"]): ("REDUCE", G["expr -> not expr"]), - (46, G[";"]): ("REDUCE", G["expr -> comp"]), - (46, G["}"]): ("REDUCE", G["expr -> comp"]), - (46, G["loop"]): ("REDUCE", G["expr -> comp"]), - (46, G["of"]): ("REDUCE", G["expr -> comp"]), + (45, G[";"]): ("REDUCE", G["expr -> not expr"]), + (45, G["}"]): ("REDUCE", G["expr -> not expr"]), + (45, G["loop"]): ("REDUCE", G["expr -> not expr"]), (46, G["then"]): ("REDUCE", G["expr -> comp"]), + (46, G["of"]): ("REDUCE", G["expr -> comp"]), (46, G["pool"]): ("REDUCE", G["expr -> comp"]), - (46, G[")"]): ("REDUCE", G["expr -> comp"]), (46, G["else"]): ("REDUCE", G["expr -> comp"]), + (46, G[")"]): ("REDUCE", G["expr -> comp"]), (46, G["fi"]): ("REDUCE", G["expr -> comp"]), (46, G[","]): ("REDUCE", G["expr -> comp"]), (46, G["in"]): ("REDUCE", G["expr -> comp"]), - (47, G["+"]): ("SHIFT", 48), - (47, G["<"]): ("SHIFT", 57), - (47, G["="]): ("SHIFT", 62), - (47, G[";"]): ("REDUCE", G["comp -> arith"]), - (47, G["}"]): ("REDUCE", G["comp -> arith"]), - (47, G["loop"]): ("REDUCE", G["comp -> arith"]), - (47, G["of"]): ("REDUCE", G["comp -> arith"]), + (46, G[";"]): ("REDUCE", G["expr -> comp"]), + (46, G["}"]): ("REDUCE", G["expr -> comp"]), + (46, G["loop"]): ("REDUCE", G["expr -> comp"]), + (47, G["+"]): ("SHIFT", 48), (47, G["then"]): ("REDUCE", G["comp -> arith"]), + (47, G["of"]): ("REDUCE", G["comp -> arith"]), (47, G["pool"]): ("REDUCE", G["comp -> arith"]), - (47, G[")"]): ("REDUCE", G["comp -> arith"]), (47, G["else"]): ("REDUCE", G["comp -> arith"]), + (47, G[")"]): ("REDUCE", G["comp -> arith"]), (47, G["fi"]): ("REDUCE", G["comp -> arith"]), (47, G[","]): ("REDUCE", G["comp -> arith"]), (47, G["in"]): ("REDUCE", G["comp -> arith"]), - (47, G["<="]): ("SHIFT", 60), + (47, G[";"]): ("REDUCE", G["comp -> arith"]), + (47, G["}"]): ("REDUCE", G["comp -> arith"]), + (47, G["loop"]): ("REDUCE", G["comp -> arith"]), + (47, G["="]): ("SHIFT", 62), + (47, G["<"]): ("SHIFT", 57), (47, G["-"]): ("SHIFT", 55), - (48, G["id"]): ("SHIFT", 34), + (47, G["<="]): ("SHIFT", 60), (48, G["false"]): ("SHIFT", 36), - (48, G["~"]): ("SHIFT", 37), - (48, G["isvoid"]): ("SHIFT", 33), - (48, G["new"]): ("SHIFT", 31), - (48, G["true"]): ("SHIFT", 35), - (48, G["int"]): ("SHIFT", 18), + (48, G["id"]): ("SHIFT", 34), (48, G["string"]): ("SHIFT", 17), + (48, G["int"]): ("SHIFT", 18), + (48, G["true"]): ("SHIFT", 35), + (48, G["isvoid"]): ("SHIFT", 33), (48, G["("]): ("SHIFT", 20), - (49, G["-"]): ("REDUCE", G["arith -> arith + term"]), + (48, G["~"]): ("SHIFT", 37), + (48, G["new"]): ("SHIFT", 31), + (49, G["*"]): ("SHIFT", 50), + (49, G["/"]): ("SHIFT", 52), + (49, G["pool"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["+"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["in"]): ("REDUCE", G["arith -> arith + term"]), (49, G["}"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["of"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["-"]): ("REDUCE", G["arith -> arith + term"]), (49, G["then"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["of"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["else"]): ("REDUCE", G["arith -> arith + term"]), (49, G["<"]): ("REDUCE", G["arith -> arith + term"]), (49, G[")"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["else"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["<="]): ("REDUCE", G["arith -> arith + term"]), (49, G["fi"]): ("REDUCE", G["arith -> arith + term"]), - (49, G[","]): ("REDUCE", G["arith -> arith + term"]), + (49, G["<="]): ("REDUCE", G["arith -> arith + term"]), (49, G["="]): ("REDUCE", G["arith -> arith + term"]), + (49, G[","]): ("REDUCE", G["arith -> arith + term"]), (49, G[";"]): ("REDUCE", G["arith -> arith + term"]), (49, G["loop"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["pool"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["+"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["in"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["*"]): ("SHIFT", 50), - (49, G["/"]): ("SHIFT", 52), - (50, G["id"]): ("SHIFT", 34), (50, G["false"]): ("SHIFT", 36), - (50, G["string"]): ("SHIFT", 17), - (50, G["new"]): ("SHIFT", 31), - (50, G["~"]): ("SHIFT", 37), - (50, G["isvoid"]): ("SHIFT", 33), (50, G["("]): ("SHIFT", 20), + (50, G["~"]): ("SHIFT", 37), + (50, G["id"]): ("SHIFT", 34), (50, G["true"]): ("SHIFT", 35), + (50, G["string"]): ("SHIFT", 17), (50, G["int"]): ("SHIFT", 18), + (50, G["isvoid"]): ("SHIFT", 33), + (50, G["new"]): ("SHIFT", 31), + (51, G["pool"]): ("REDUCE", G["term -> term * factor"]), + (51, G["+"]): ("REDUCE", G["term -> term * factor"]), + (51, G["in"]): ("REDUCE", G["term -> term * factor"]), (51, G["}"]): ("REDUCE", G["term -> term * factor"]), (51, G["-"]): ("REDUCE", G["term -> term * factor"]), + (51, G["then"]): ("REDUCE", G["term -> term * factor"]), (51, G["*"]): ("REDUCE", G["term -> term * factor"]), (51, G["of"]): ("REDUCE", G["term -> term * factor"]), - (51, G["then"]): ("REDUCE", G["term -> term * factor"]), (51, G["/"]): ("REDUCE", G["term -> term * factor"]), + (51, G["else"]): ("REDUCE", G["term -> term * factor"]), (51, G["<"]): ("REDUCE", G["term -> term * factor"]), (51, G[")"]): ("REDUCE", G["term -> term * factor"]), - (51, G["else"]): ("REDUCE", G["term -> term * factor"]), - (51, G["<="]): ("REDUCE", G["term -> term * factor"]), (51, G["fi"]): ("REDUCE", G["term -> term * factor"]), - (51, G[","]): ("REDUCE", G["term -> term * factor"]), + (51, G["<="]): ("REDUCE", G["term -> term * factor"]), (51, G["="]): ("REDUCE", G["term -> term * factor"]), + (51, G[","]): ("REDUCE", G["term -> term * factor"]), (51, G[";"]): ("REDUCE", G["term -> term * factor"]), (51, G["loop"]): ("REDUCE", G["term -> term * factor"]), - (51, G["pool"]): ("REDUCE", G["term -> term * factor"]), - (51, G["+"]): ("REDUCE", G["term -> term * factor"]), - (51, G["in"]): ("REDUCE", G["term -> term * factor"]), - (52, G["id"]): ("SHIFT", 34), (52, G["false"]): ("SHIFT", 36), - (52, G["string"]): ("SHIFT", 17), - (52, G["new"]): ("SHIFT", 31), - (52, G["~"]): ("SHIFT", 37), - (52, G["isvoid"]): ("SHIFT", 33), (52, G["("]): ("SHIFT", 20), + (52, G["~"]): ("SHIFT", 37), + (52, G["id"]): ("SHIFT", 34), (52, G["true"]): ("SHIFT", 35), + (52, G["string"]): ("SHIFT", 17), (52, G["int"]): ("SHIFT", 18), + (52, G["isvoid"]): ("SHIFT", 33), + (52, G["new"]): ("SHIFT", 31), + (53, G["pool"]): ("REDUCE", G["term -> term / factor"]), + (53, G["+"]): ("REDUCE", G["term -> term / factor"]), + (53, G["in"]): ("REDUCE", G["term -> term / factor"]), (53, G["}"]): ("REDUCE", G["term -> term / factor"]), (53, G["-"]): ("REDUCE", G["term -> term / factor"]), + (53, G["then"]): ("REDUCE", G["term -> term / factor"]), (53, G["*"]): ("REDUCE", G["term -> term / factor"]), (53, G["of"]): ("REDUCE", G["term -> term / factor"]), - (53, G["then"]): ("REDUCE", G["term -> term / factor"]), (53, G["/"]): ("REDUCE", G["term -> term / factor"]), + (53, G["else"]): ("REDUCE", G["term -> term / factor"]), (53, G["<"]): ("REDUCE", G["term -> term / factor"]), (53, G[")"]): ("REDUCE", G["term -> term / factor"]), - (53, G["else"]): ("REDUCE", G["term -> term / factor"]), - (53, G["<="]): ("REDUCE", G["term -> term / factor"]), (53, G["fi"]): ("REDUCE", G["term -> term / factor"]), - (53, G[","]): ("REDUCE", G["term -> term / factor"]), + (53, G["<="]): ("REDUCE", G["term -> term / factor"]), (53, G["="]): ("REDUCE", G["term -> term / factor"]), + (53, G[","]): ("REDUCE", G["term -> term / factor"]), (53, G[";"]): ("REDUCE", G["term -> term / factor"]), (53, G["loop"]): ("REDUCE", G["term -> term / factor"]), - (53, G["pool"]): ("REDUCE", G["term -> term / factor"]), - (53, G["+"]): ("REDUCE", G["term -> term / factor"]), - (53, G["in"]): ("REDUCE", G["term -> term / factor"]), - (54, G["-"]): ("REDUCE", G["term -> factor"]), + (54, G["pool"]): ("REDUCE", G["term -> factor"]), + (54, G["+"]): ("REDUCE", G["term -> factor"]), + (54, G["in"]): ("REDUCE", G["term -> factor"]), (54, G["}"]): ("REDUCE", G["term -> factor"]), + (54, G["-"]): ("REDUCE", G["term -> factor"]), + (54, G["then"]): ("REDUCE", G["term -> factor"]), (54, G["*"]): ("REDUCE", G["term -> factor"]), (54, G["of"]): ("REDUCE", G["term -> factor"]), - (54, G["then"]): ("REDUCE", G["term -> factor"]), (54, G["/"]): ("REDUCE", G["term -> factor"]), + (54, G["else"]): ("REDUCE", G["term -> factor"]), (54, G["<"]): ("REDUCE", G["term -> factor"]), (54, G[")"]): ("REDUCE", G["term -> factor"]), - (54, G["else"]): ("REDUCE", G["term -> factor"]), - (54, G["<="]): ("REDUCE", G["term -> factor"]), (54, G["fi"]): ("REDUCE", G["term -> factor"]), - (54, G[","]): ("REDUCE", G["term -> factor"]), + (54, G["<="]): ("REDUCE", G["term -> factor"]), (54, G["="]): ("REDUCE", G["term -> factor"]), + (54, G[","]): ("REDUCE", G["term -> factor"]), (54, G[";"]): ("REDUCE", G["term -> factor"]), (54, G["loop"]): ("REDUCE", G["term -> factor"]), - (54, G["pool"]): ("REDUCE", G["term -> factor"]), - (54, G["+"]): ("REDUCE", G["term -> factor"]), - (54, G["in"]): ("REDUCE", G["term -> factor"]), - (55, G["id"]): ("SHIFT", 34), (55, G["false"]): ("SHIFT", 36), - (55, G["~"]): ("SHIFT", 37), - (55, G["isvoid"]): ("SHIFT", 33), - (55, G["new"]): ("SHIFT", 31), - (55, G["true"]): ("SHIFT", 35), - (55, G["int"]): ("SHIFT", 18), + (55, G["id"]): ("SHIFT", 34), (55, G["string"]): ("SHIFT", 17), + (55, G["int"]): ("SHIFT", 18), + (55, G["true"]): ("SHIFT", 35), + (55, G["isvoid"]): ("SHIFT", 33), (55, G["("]): ("SHIFT", 20), + (55, G["~"]): ("SHIFT", 37), + (55, G["new"]): ("SHIFT", 31), (56, G["*"]): ("SHIFT", 50), (56, G["/"]): ("SHIFT", 52), - (56, G["}"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["pool"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["+"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["in"]): ("REDUCE", G["arith -> arith - term"]), (56, G["-"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["of"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["}"]): ("REDUCE", G["arith -> arith - term"]), (56, G["then"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["of"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["else"]): ("REDUCE", G["arith -> arith - term"]), (56, G["<"]): ("REDUCE", G["arith -> arith - term"]), (56, G[")"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["else"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["<="]): ("REDUCE", G["arith -> arith - term"]), (56, G["fi"]): ("REDUCE", G["arith -> arith - term"]), - (56, G[","]): ("REDUCE", G["arith -> arith - term"]), + (56, G["<="]): ("REDUCE", G["arith -> arith - term"]), (56, G["="]): ("REDUCE", G["arith -> arith - term"]), + (56, G[","]): ("REDUCE", G["arith -> arith - term"]), (56, G[";"]): ("REDUCE", G["arith -> arith - term"]), (56, G["loop"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["pool"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["+"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["in"]): ("REDUCE", G["arith -> arith - term"]), (57, G["("]): ("SHIFT", 20), - (57, G["id"]): ("SHIFT", 34), (57, G["string"]): ("SHIFT", 17), - (57, G["false"]): ("SHIFT", 36), - (57, G["~"]): ("SHIFT", 37), (57, G["int"]): ("SHIFT", 18), - (57, G["true"]): ("SHIFT", 35), (57, G["isvoid"]): ("SHIFT", 33), + (57, G["true"]): ("SHIFT", 35), + (57, G["id"]): ("SHIFT", 34), + (57, G["~"]): ("SHIFT", 37), (57, G["new"]): ("SHIFT", 31), - (58, G[";"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G["}"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G["of"]): ("REDUCE", G["comp -> arith < arith"]), + (57, G["false"]): ("SHIFT", 36), + (58, G["+"]): ("SHIFT", 48), + (58, G["-"]): ("SHIFT", 55), (58, G["then"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G["of"]): ("REDUCE", G["comp -> arith < arith"]), (58, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G[")"]): ("REDUCE", G["comp -> arith < arith"]), (58, G["else"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G[")"]): ("REDUCE", G["comp -> arith < arith"]), (58, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), (58, G[","]): ("REDUCE", G["comp -> arith < arith"]), (58, G["in"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G["-"]): ("SHIFT", 55), - (58, G["+"]): ("SHIFT", 48), + (58, G[";"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G["}"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), (59, G["*"]): ("SHIFT", 50), - (59, G["/"]): ("SHIFT", 52), - (59, G["-"]): ("REDUCE", G["arith -> term"]), + (59, G["pool"]): ("REDUCE", G["arith -> term"]), + (59, G["+"]): ("REDUCE", G["arith -> term"]), + (59, G["in"]): ("REDUCE", G["arith -> term"]), (59, G["}"]): ("REDUCE", G["arith -> term"]), - (59, G["of"]): ("REDUCE", G["arith -> term"]), + (59, G["-"]): ("REDUCE", G["arith -> term"]), (59, G["then"]): ("REDUCE", G["arith -> term"]), + (59, G["of"]): ("REDUCE", G["arith -> term"]), + (59, G["else"]): ("REDUCE", G["arith -> term"]), (59, G["<"]): ("REDUCE", G["arith -> term"]), (59, G[")"]): ("REDUCE", G["arith -> term"]), - (59, G["else"]): ("REDUCE", G["arith -> term"]), - (59, G["<="]): ("REDUCE", G["arith -> term"]), (59, G["fi"]): ("REDUCE", G["arith -> term"]), - (59, G[","]): ("REDUCE", G["arith -> term"]), + (59, G["<="]): ("REDUCE", G["arith -> term"]), (59, G["="]): ("REDUCE", G["arith -> term"]), + (59, G[","]): ("REDUCE", G["arith -> term"]), (59, G[";"]): ("REDUCE", G["arith -> term"]), (59, G["loop"]): ("REDUCE", G["arith -> term"]), - (59, G["pool"]): ("REDUCE", G["arith -> term"]), - (59, G["+"]): ("REDUCE", G["arith -> term"]), - (59, G["in"]): ("REDUCE", G["arith -> term"]), + (59, G["/"]): ("SHIFT", 52), (60, G["("]): ("SHIFT", 20), - (60, G["id"]): ("SHIFT", 34), (60, G["string"]): ("SHIFT", 17), - (60, G["false"]): ("SHIFT", 36), - (60, G["~"]): ("SHIFT", 37), (60, G["int"]): ("SHIFT", 18), - (60, G["true"]): ("SHIFT", 35), (60, G["isvoid"]): ("SHIFT", 33), + (60, G["true"]): ("SHIFT", 35), + (60, G["id"]): ("SHIFT", 34), + (60, G["~"]): ("SHIFT", 37), (60, G["new"]): ("SHIFT", 31), + (60, G["false"]): ("SHIFT", 36), + (61, G["+"]): ("SHIFT", 48), (61, G["-"]): ("SHIFT", 55), - (61, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), (61, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), (61, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), (61, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), (61, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), (61, G[","]): ("REDUCE", G["comp -> arith <= arith"]), (61, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G["+"]): ("SHIFT", 48), + (61, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), (62, G["("]): ("SHIFT", 20), - (62, G["id"]): ("SHIFT", 34), (62, G["string"]): ("SHIFT", 17), - (62, G["false"]): ("SHIFT", 36), - (62, G["~"]): ("SHIFT", 37), (62, G["int"]): ("SHIFT", 18), - (62, G["true"]): ("SHIFT", 35), (62, G["isvoid"]): ("SHIFT", 33), + (62, G["true"]): ("SHIFT", 35), + (62, G["id"]): ("SHIFT", 34), + (62, G["~"]): ("SHIFT", 37), (62, G["new"]): ("SHIFT", 31), - (63, G[";"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G["}"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G["of"]): ("REDUCE", G["comp -> arith = arith"]), + (62, G["false"]): ("SHIFT", 36), + (63, G["+"]): ("SHIFT", 48), + (63, G["-"]): ("SHIFT", 55), (63, G["then"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G["of"]): ("REDUCE", G["comp -> arith = arith"]), (63, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G[")"]): ("REDUCE", G["comp -> arith = arith"]), (63, G["else"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G[")"]): ("REDUCE", G["comp -> arith = arith"]), (63, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), (63, G[","]): ("REDUCE", G["comp -> arith = arith"]), (63, G["in"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G["-"]): ("SHIFT", 55), - (63, G["+"]): ("SHIFT", 48), + (63, G[";"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G["}"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), (64, G[")"]): ("SHIFT", 65), - (65, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (66, G[","]): ("SHIFT", 67), (66, G[")"]): ("REDUCE", G["expr-list -> expr"]), - (67, G["("]): ("SHIFT", 20), - (67, G["isvoid"]): ("SHIFT", 33), - (67, G["while"]): ("SHIFT", 22), - (67, G["id"]): ("SHIFT", 15), - (67, G["let"]): ("SHIFT", 23), - (67, G["not"]): ("SHIFT", 44), - (67, G["~"]): ("SHIFT", 37), - (67, G["{"]): ("SHIFT", 19), - (67, G["new"]): ("SHIFT", 31), - (67, G["case"]): ("SHIFT", 30), - (67, G["if"]): ("SHIFT", 21), (67, G["int"]): ("SHIFT", 18), (67, G["true"]): ("SHIFT", 35), + (67, G["id"]): ("SHIFT", 15), + (67, G["new"]): ("SHIFT", 31), (67, G["false"]): ("SHIFT", 36), + (67, G["if"]): ("SHIFT", 21), + (67, G["("]): ("SHIFT", 20), (67, G["string"]): ("SHIFT", 17), + (67, G["while"]): ("SHIFT", 22), + (67, G["isvoid"]): ("SHIFT", 33), + (67, G["{"]): ("SHIFT", 19), + (67, G["let"]): ("SHIFT", 23), + (67, G["case"]): ("SHIFT", 30), + (67, G["~"]): ("SHIFT", 37), + (67, G["not"]): ("SHIFT", 44), (68, G[")"]): ("REDUCE", G["expr-list -> expr , expr-list"]), (69, G["type"]): ("SHIFT", 70), (70, G["."]): ("SHIFT", 71), (71, G["id"]): ("SHIFT", 72), (72, G["("]): ("SHIFT", 73), - (73, G["("]): ("SHIFT", 20), - (73, G["isvoid"]): ("SHIFT", 33), - (73, G["while"]): ("SHIFT", 22), - (73, G["id"]): ("SHIFT", 15), - (73, G["let"]): ("SHIFT", 23), - (73, G["not"]): ("SHIFT", 44), - (73, G["~"]): ("SHIFT", 37), - (73, G["{"]): ("SHIFT", 19), - (73, G["new"]): ("SHIFT", 31), - (73, G["case"]): ("SHIFT", 30), - (73, G["if"]): ("SHIFT", 21), (73, G["int"]): ("SHIFT", 18), (73, G["true"]): ("SHIFT", 35), + (73, G["id"]): ("SHIFT", 15), + (73, G["new"]): ("SHIFT", 31), (73, G["false"]): ("SHIFT", 36), + (73, G["if"]): ("SHIFT", 21), + (73, G["("]): ("SHIFT", 20), (73, G["string"]): ("SHIFT", 17), + (73, G["while"]): ("SHIFT", 22), + (73, G["isvoid"]): ("SHIFT", 33), + (73, G["{"]): ("SHIFT", 19), + (73, G["let"]): ("SHIFT", 23), + (73, G["case"]): ("SHIFT", 30), + (73, G["~"]): ("SHIFT", 37), + (73, G["not"]): ("SHIFT", 44), (74, G[")"]): ("SHIFT", 75), + (75, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), (77, G["of"]): ("SHIFT", 78), (78, G["id"]): ("SHIFT", 79), (79, G[":"]): ("SHIFT", 80), (80, G["type"]): ("SHIFT", 81), (81, G["=>"]): ("SHIFT", 82), + (82, G["case"]): ("SHIFT", 30), + (82, G["not"]): ("SHIFT", 44), + (82, G["id"]): ("SHIFT", 15), + (82, G["~"]): ("SHIFT", 37), (82, G["isvoid"]): ("SHIFT", 33), - (82, G["int"]): ("SHIFT", 18), (82, G["true"]): ("SHIFT", 35), - (82, G["id"]): ("SHIFT", 15), - (82, G["new"]): ("SHIFT", 31), - (82, G["while"]): ("SHIFT", 22), - (82, G["case"]): ("SHIFT", 30), + (82, G["int"]): ("SHIFT", 18), (82, G["if"]): ("SHIFT", 21), - (82, G["("]): ("SHIFT", 20), (82, G["{"]): ("SHIFT", 19), (82, G["let"]): ("SHIFT", 23), - (82, G["~"]): ("SHIFT", 37), + (82, G["new"]): ("SHIFT", 31), (82, G["false"]): ("SHIFT", 36), (82, G["string"]): ("SHIFT", 17), - (82, G["not"]): ("SHIFT", 44), + (82, G["("]): ("SHIFT", 20), + (82, G["while"]): ("SHIFT", 22), (83, G[";"]): ("SHIFT", 84), (84, G["id"]): ("SHIFT", 79), (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), (86, G["esac"]): ("SHIFT", 87), - (87, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (87, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (87, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (87, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (87, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (87, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), (87, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G[","]): ("SHIFT", 89), + (87, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), + (88, G[","]): ("SHIFT", 89), (89, G["id"]): ("SHIFT", 24), (90, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), (91, G["in"]): ("SHIFT", 92), - (92, G["id"]): ("SHIFT", 15), - (92, G["not"]): ("SHIFT", 44), - (92, G["~"]): ("SHIFT", 37), + (92, G["false"]): ("SHIFT", 36), (92, G["let"]): ("SHIFT", 23), - (92, G["isvoid"]): ("SHIFT", 33), - (92, G["new"]): ("SHIFT", 31), + (92, G["id"]): ("SHIFT", 15), + (92, G["string"]): ("SHIFT", 17), (92, G["true"]): ("SHIFT", 35), (92, G["int"]): ("SHIFT", 18), - (92, G["string"]): ("SHIFT", 17), + (92, G["while"]): ("SHIFT", 22), (92, G["{"]): ("SHIFT", 19), + (92, G["not"]): ("SHIFT", 44), + (92, G["case"]): ("SHIFT", 30), + (92, G["isvoid"]): ("SHIFT", 33), (92, G["("]): ("SHIFT", 20), (92, G["if"]): ("SHIFT", 21), - (92, G["case"]): ("SHIFT", 30), - (92, G["false"]): ("SHIFT", 36), - (92, G["while"]): ("SHIFT", 22), - (93, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (92, G["~"]): ("SHIFT", 37), + (92, G["new"]): ("SHIFT", 31), (93, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (93, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (93, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (93, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (93, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), (93, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["loop"]): ("SHIFT", 95), - (95, G["not"]): ("SHIFT", 44), - (95, G["false"]): ("SHIFT", 36), - (95, G["isvoid"]): ("SHIFT", 33), - (95, G["while"]): ("SHIFT", 22), + (95, G["true"]): ("SHIFT", 35), + (95, G["int"]): ("SHIFT", 18), (95, G["id"]): ("SHIFT", 15), - (95, G["if"]): ("SHIFT", 21), - (95, G["case"]): ("SHIFT", 30), + (95, G["let"]): ("SHIFT", 23), (95, G["{"]): ("SHIFT", 19), - (95, G["~"]): ("SHIFT", 37), - (95, G["new"]): ("SHIFT", 31), - (95, G["int"]): ("SHIFT", 18), - (95, G["true"]): ("SHIFT", 35), + (95, G["while"]): ("SHIFT", 22), (95, G["string"]): ("SHIFT", 17), (95, G["("]): ("SHIFT", 20), - (95, G["let"]): ("SHIFT", 23), + (95, G["new"]): ("SHIFT", 31), + (95, G["~"]): ("SHIFT", 37), + (95, G["isvoid"]): ("SHIFT", 33), + (95, G["not"]): ("SHIFT", 44), + (95, G["false"]): ("SHIFT", 36), + (95, G["if"]): ("SHIFT", 21), + (95, G["case"]): ("SHIFT", 30), (96, G["pool"]): ("SHIFT", 97), - (97, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (97, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (97, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (97, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (97, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (97, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), (97, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["then"]): ("SHIFT", 99), - (99, G["~"]): ("SHIFT", 37), - (99, G["{"]): ("SHIFT", 19), (99, G["false"]): ("SHIFT", 36), - (99, G["isvoid"]): ("SHIFT", 33), - (99, G["id"]): ("SHIFT", 15), (99, G["new"]): ("SHIFT", 31), - (99, G["true"]): ("SHIFT", 35), + (99, G["id"]): ("SHIFT", 15), + (99, G["string"]): ("SHIFT", 17), (99, G["int"]): ("SHIFT", 18), - (99, G["if"]): ("SHIFT", 21), - (99, G["case"]): ("SHIFT", 30), - (99, G["while"]): ("SHIFT", 22), + (99, G["true"]): ("SHIFT", 35), (99, G["let"]): ("SHIFT", 23), - (99, G["string"]): ("SHIFT", 17), (99, G["not"]): ("SHIFT", 44), + (99, G["{"]): ("SHIFT", 19), + (99, G["while"]): ("SHIFT", 22), + (99, G["case"]): ("SHIFT", 30), + (99, G["isvoid"]): ("SHIFT", 33), (99, G["("]): ("SHIFT", 20), + (99, G["~"]): ("SHIFT", 37), + (99, G["if"]): ("SHIFT", 21), (100, G["else"]): ("SHIFT", 101), - (101, G["let"]): ("SHIFT", 23), - (101, G["not"]): ("SHIFT", 44), - (101, G["~"]): ("SHIFT", 37), + (101, G["id"]): ("SHIFT", 15), (101, G["("]): ("SHIFT", 20), - (101, G["while"]): ("SHIFT", 22), - (101, G["case"]): ("SHIFT", 30), (101, G["if"]): ("SHIFT", 21), - (101, G["new"]): ("SHIFT", 31), + (101, G["~"]): ("SHIFT", 37), (101, G["int"]): ("SHIFT", 18), (101, G["true"]): ("SHIFT", 35), - (101, G["id"]): ("SHIFT", 15), - (101, G["false"]): ("SHIFT", 36), (101, G["string"]): ("SHIFT", 17), + (101, G["while"]): ("SHIFT", 22), (101, G["{"]): ("SHIFT", 19), + (101, G["let"]): ("SHIFT", 23), (101, G["isvoid"]): ("SHIFT", 33), + (101, G["case"]): ("SHIFT", 30), + (101, G["new"]): ("SHIFT", 31), + (101, G["false"]): ("SHIFT", 36), + (101, G["not"]): ("SHIFT", 44), (102, G["fi"]): ("SHIFT", 103), - (103, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (103, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (103, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (103, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (103, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (103, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (103, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G[")"]): ("SHIFT", 105), - (105, G["}"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["+"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["in"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["-"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["}"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["then"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["*"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["of"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["then"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["/"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["else"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["<"]): ("REDUCE", G["atom -> ( expr )"]), (105, G[")"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["else"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["<="]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["."]): ("REDUCE", G["atom -> ( expr )"]), (105, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G[","]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["."]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["<="]): ("REDUCE", G["atom -> ( expr )"]), (105, G["="]): ("REDUCE", G["atom -> ( expr )"]), + (105, G[","]): ("REDUCE", G["atom -> ( expr )"]), (105, G[";"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["@"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["+"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["in"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["@"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["}"]): ("SHIFT", 107), - (107, G[";"]): ("REDUCE", G["expr -> { block }"]), - (107, G["}"]): ("REDUCE", G["expr -> { block }"]), - (107, G["loop"]): ("REDUCE", G["expr -> { block }"]), - (107, G["of"]): ("REDUCE", G["expr -> { block }"]), (107, G["then"]): ("REDUCE", G["expr -> { block }"]), + (107, G["of"]): ("REDUCE", G["expr -> { block }"]), (107, G["pool"]): ("REDUCE", G["expr -> { block }"]), - (107, G[")"]): ("REDUCE", G["expr -> { block }"]), (107, G["else"]): ("REDUCE", G["expr -> { block }"]), + (107, G[")"]): ("REDUCE", G["expr -> { block }"]), (107, G["fi"]): ("REDUCE", G["expr -> { block }"]), (107, G[","]): ("REDUCE", G["expr -> { block }"]), (107, G["in"]): ("REDUCE", G["expr -> { block }"]), + (107, G[";"]): ("REDUCE", G["expr -> { block }"]), + (107, G["}"]): ("REDUCE", G["expr -> { block }"]), + (107, G["loop"]): ("REDUCE", G["expr -> { block }"]), (108, G[";"]): ("SHIFT", 109), + (109, G["case"]): ("SHIFT", 30), + (109, G["not"]): ("SHIFT", 44), + (109, G["id"]): ("SHIFT", 15), + (109, G["~"]): ("SHIFT", 37), (109, G["isvoid"]): ("SHIFT", 33), - (109, G["int"]): ("SHIFT", 18), (109, G["true"]): ("SHIFT", 35), - (109, G["id"]): ("SHIFT", 15), - (109, G["new"]): ("SHIFT", 31), - (109, G["while"]): ("SHIFT", 22), - (109, G["case"]): ("SHIFT", 30), + (109, G["int"]): ("SHIFT", 18), (109, G["if"]): ("SHIFT", 21), - (109, G["("]): ("SHIFT", 20), - (109, G["}"]): ("REDUCE", G["block -> expr ;"]), (109, G["{"]): ("SHIFT", 19), (109, G["let"]): ("SHIFT", 23), - (109, G["~"]): ("SHIFT", 37), + (109, G["new"]): ("SHIFT", 31), (109, G["false"]): ("SHIFT", 36), (109, G["string"]): ("SHIFT", 17), - (109, G["not"]): ("SHIFT", 44), + (109, G["}"]): ("REDUCE", G["block -> expr ;"]), + (109, G["("]): ("SHIFT", 20), + (109, G["while"]): ("SHIFT", 22), (110, G["}"]): ("REDUCE", G["block -> expr ; block"]), (111, G[")"]): ("SHIFT", 112), + (112, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (113, G["id"]): ("SHIFT", 15), - (113, G["not"]): ("SHIFT", 44), - (113, G["~"]): ("SHIFT", 37), + (112, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (113, G["false"]): ("SHIFT", 36), (113, G["let"]): ("SHIFT", 23), - (113, G["isvoid"]): ("SHIFT", 33), - (113, G["new"]): ("SHIFT", 31), + (113, G["id"]): ("SHIFT", 15), + (113, G["string"]): ("SHIFT", 17), (113, G["true"]): ("SHIFT", 35), (113, G["int"]): ("SHIFT", 18), - (113, G["string"]): ("SHIFT", 17), + (113, G["while"]): ("SHIFT", 22), (113, G["{"]): ("SHIFT", 19), + (113, G["not"]): ("SHIFT", 44), + (113, G["case"]): ("SHIFT", 30), + (113, G["isvoid"]): ("SHIFT", 33), (113, G["("]): ("SHIFT", 20), (113, G["if"]): ("SHIFT", 21), - (113, G["case"]): ("SHIFT", 30), - (113, G["false"]): ("SHIFT", 36), - (113, G["while"]): ("SHIFT", 22), - (114, G[";"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G["}"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G["of"]): ("REDUCE", G["expr -> id <- expr"]), + (113, G["~"]): ("SHIFT", 37), + (113, G["new"]): ("SHIFT", 31), (114, G["then"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["of"]): ("REDUCE", G["expr -> id <- expr"]), (114, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G[")"]): ("REDUCE", G["expr -> id <- expr"]), (114, G["else"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G[")"]): ("REDUCE", G["expr -> id <- expr"]), (114, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), (114, G[","]): ("REDUCE", G["expr -> id <- expr"]), (114, G["in"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G[";"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["}"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), (115, G["}"]): ("SHIFT", 116), (116, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), (117, G[")"]): ("SHIFT", 118), (118, G[":"]): ("SHIFT", 119), (119, G["type"]): ("SHIFT", 120), (120, G["{"]): ("SHIFT", 121), - (121, G["~"]): ("SHIFT", 37), + (121, G["{"]): ("SHIFT", 19), (121, G["if"]): ("SHIFT", 21), + (121, G["not"]): ("SHIFT", 44), + (121, G["~"]): ("SHIFT", 37), + (121, G["false"]): ("SHIFT", 36), (121, G["case"]): ("SHIFT", 30), - (121, G["isvoid"]): ("SHIFT", 33), (121, G["id"]): ("SHIFT", 15), + (121, G["new"]): ("SHIFT", 31), + (121, G["isvoid"]): ("SHIFT", 33), + (121, G["true"]): ("SHIFT", 35), (121, G["string"]): ("SHIFT", 17), - (121, G["false"]): ("SHIFT", 36), - (121, G["{"]): ("SHIFT", 19), - (121, G["not"]): ("SHIFT", 44), - (121, G["let"]): ("SHIFT", 23), - (121, G["while"]): ("SHIFT", 22), (121, G["("]): ("SHIFT", 20), - (121, G["true"]): ("SHIFT", 35), + (121, G["while"]): ("SHIFT", 22), (121, G["int"]): ("SHIFT", 18), - (121, G["new"]): ("SHIFT", 31), + (121, G["let"]): ("SHIFT", 23), (122, G["}"]): ("SHIFT", 123), (123, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (124, G["type"]): ("SHIFT", 125), - (125, G["<-"]): ("SHIFT", 126), (125, G[";"]): ("REDUCE", G["attribute -> id : type"]), (125, G["error"]): ("SHIFT", 128), + (125, G["<-"]): ("SHIFT", 126), + (126, G["case"]): ("SHIFT", 30), + (126, G["not"]): ("SHIFT", 44), + (126, G["id"]): ("SHIFT", 15), + (126, G["~"]): ("SHIFT", 37), (126, G["isvoid"]): ("SHIFT", 33), - (126, G["int"]): ("SHIFT", 18), (126, G["true"]): ("SHIFT", 35), - (126, G["id"]): ("SHIFT", 15), - (126, G["new"]): ("SHIFT", 31), - (126, G["while"]): ("SHIFT", 22), - (126, G["case"]): ("SHIFT", 30), + (126, G["int"]): ("SHIFT", 18), (126, G["if"]): ("SHIFT", 21), - (126, G["("]): ("SHIFT", 20), (126, G["{"]): ("SHIFT", 19), (126, G["let"]): ("SHIFT", 23), - (126, G["~"]): ("SHIFT", 37), + (126, G["new"]): ("SHIFT", 31), (126, G["false"]): ("SHIFT", 36), (126, G["string"]): ("SHIFT", 17), - (126, G["not"]): ("SHIFT", 44), + (126, G["("]): ("SHIFT", 20), + (126, G["while"]): ("SHIFT", 22), (127, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), (128, G[";"]): ("REDUCE", G["attribute -> id : type error"]), (129, G["}"]): ("SHIFT", 130), @@ -1046,8 +1046,8 @@ def __action_table(self): (132, G["id"]): ("SHIFT", 4), (133, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), (134, G[";"]): ("SHIFT", 135), - (135, G["id"]): ("SHIFT", 4), (135, G["}"]): ("REDUCE", G["feature-list -> e"]), + (135, G["id"]): ("SHIFT", 4), (136, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), (137, G["type"]): ("SHIFT", 138), (138, G["{"]): ("SHIFT", 139), @@ -1058,224 +1058,224 @@ def __action_table(self): (141, G["class"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), (142, G["$"]): ("OK", None), (143, G["$"]): ("REDUCE", G["program -> class-list"]), - (144, G["$"]): ("REDUCE", G["class-list -> class-def"]), (144, G["class"]): ("SHIFT", 1), + (144, G["$"]): ("REDUCE", G["class-list -> class-def"]), (145, G["$"]): ("REDUCE", G["class-list -> class-def class-list"]), } - def __goto_table(self): - G = self.G + @staticmethod + def __goto_table(): return { - (0, G["program"]): 142, (0, G["class-def"]): 144, (0, G["class-list"]): 143, - (3, G["feature-list"]): 129, - (3, G["method"]): 134, + (0, G["program"]): 142, (3, G["attribute"]): 131, + (3, G["method"]): 134, + (3, G["feature-list"]): 129, (5, G["param-list"]): 117, (9, G["param-list"]): 10, - (14, G["atom"]): 40, - (14, G["arith"]): 47, - (14, G["expr"]): 115, - (14, G["factor"]): 54, (14, G["term"]): 59, (14, G["function-call"]): 38, + (14, G["arith"]): 47, (14, G["comp"]): 46, - (16, G["atom"]): 40, - (16, G["expr"]): 66, + (14, G["atom"]): 40, + (14, G["expr"]): 115, + (14, G["factor"]): 54, (16, G["arith"]): 47, (16, G["comp"]): 46, + (16, G["factor"]): 54, + (16, G["atom"]): 40, (16, G["function-call"]): 38, + (16, G["expr"]): 66, (16, G["term"]): 59, (16, G["expr-list"]): 111, - (16, G["factor"]): 54, - (19, G["atom"]): 40, - (19, G["comp"]): 46, (19, G["term"]): 59, - (19, G["function-call"]): 38, (19, G["arith"]): 47, + (19, G["atom"]): 40, (19, G["expr"]): 108, - (19, G["block"]): 106, (19, G["factor"]): 54, - (20, G["atom"]): 40, + (19, G["function-call"]): 38, + (19, G["block"]): 106, + (19, G["comp"]): 46, (20, G["arith"]): 47, - (20, G["term"]): 59, - (20, G["expr"]): 104, - (20, G["factor"]): 54, (20, G["function-call"]): 38, + (20, G["expr"]): 104, + (20, G["term"]): 59, + (20, G["atom"]): 40, (20, G["comp"]): 46, + (20, G["factor"]): 54, + (21, G["arith"]): 47, (21, G["term"]): 59, - (21, G["comp"]): 46, (21, G["atom"]): 40, + (21, G["function-call"]): 38, (21, G["factor"]): 54, - (21, G["arith"]): 47, (21, G["expr"]): 98, - (21, G["function-call"]): 38, - (22, G["factor"]): 54, - (22, G["atom"]): 40, - (22, G["arith"]): 47, + (21, G["comp"]): 46, (22, G["term"]): 59, - (22, G["function-call"]): 38, - (22, G["expr"]): 94, + (22, G["arith"]): 47, + (22, G["atom"]): 40, (22, G["comp"]): 46, + (22, G["expr"]): 94, + (22, G["function-call"]): 38, + (22, G["factor"]): 54, (23, G["declaration-list"]): 91, (27, G["declaration-list"]): 28, + (29, G["term"]): 59, (29, G["arith"]): 47, (29, G["factor"]): 54, (29, G["atom"]): 40, - (29, G["comp"]): 46, - (29, G["expr"]): 88, - (29, G["term"]): 59, (29, G["function-call"]): 38, - (30, G["comp"]): 46, + (29, G["expr"]): 88, + (29, G["comp"]): 46, (30, G["arith"]): 47, - (30, G["term"]): 59, - (30, G["function-call"]): 38, (30, G["atom"]): 40, (30, G["expr"]): 77, + (30, G["term"]): 59, + (30, G["comp"]): 46, + (30, G["function-call"]): 38, (30, G["factor"]): 54, (33, G["atom"]): 40, (33, G["factor"]): 76, (33, G["function-call"]): 38, - (37, G["factor"]): 39, (37, G["atom"]): 40, (37, G["function-call"]): 38, - (43, G["atom"]): 40, - (43, G["expr"]): 66, + (37, G["factor"]): 39, (43, G["arith"]): 47, - (43, G["comp"]): 46, (43, G["expr-list"]): 64, + (43, G["comp"]): 46, + (43, G["factor"]): 54, + (43, G["atom"]): 40, (43, G["function-call"]): 38, + (43, G["expr"]): 66, (43, G["term"]): 59, - (43, G["factor"]): 54, - (44, G["atom"]): 40, - (44, G["arith"]): 47, (44, G["function-call"]): 38, + (44, G["arith"]): 47, + (44, G["expr"]): 45, (44, G["factor"]): 54, + (44, G["atom"]): 40, (44, G["term"]): 59, (44, G["comp"]): 46, - (44, G["expr"]): 45, + (48, G["function-call"]): 38, (48, G["factor"]): 54, (48, G["atom"]): 40, (48, G["term"]): 49, - (48, G["function-call"]): 38, - (50, G["factor"]): 51, (50, G["atom"]): 40, (50, G["function-call"]): 38, - (52, G["factor"]): 53, + (50, G["factor"]): 51, (52, G["atom"]): 40, (52, G["function-call"]): 38, + (52, G["factor"]): 53, + (55, G["function-call"]): 38, (55, G["factor"]): 54, (55, G["term"]): 56, (55, G["atom"]): 40, - (55, G["function-call"]): 38, - (57, G["function-call"]): 38, - (57, G["factor"]): 54, + (57, G["arith"]): 58, (57, G["atom"]): 40, + (57, G["function-call"]): 38, (57, G["term"]): 59, - (57, G["arith"]): 58, - (60, G["function-call"]): 38, - (60, G["factor"]): 54, - (60, G["atom"]): 40, + (57, G["factor"]): 54, (60, G["arith"]): 61, + (60, G["atom"]): 40, + (60, G["function-call"]): 38, (60, G["term"]): 59, - (62, G["function-call"]): 38, - (62, G["factor"]): 54, + (60, G["factor"]): 54, + (62, G["arith"]): 63, (62, G["atom"]): 40, + (62, G["function-call"]): 38, (62, G["term"]): 59, - (62, G["arith"]): 63, - (67, G["atom"]): 40, - (67, G["expr"]): 66, - (67, G["expr-list"]): 68, + (62, G["factor"]): 54, (67, G["arith"]): 47, (67, G["comp"]): 46, + (67, G["factor"]): 54, + (67, G["atom"]): 40, (67, G["function-call"]): 38, + (67, G["expr"]): 66, (67, G["term"]): 59, - (67, G["factor"]): 54, - (73, G["atom"]): 40, - (73, G["expr"]): 66, + (67, G["expr-list"]): 68, (73, G["arith"]): 47, (73, G["comp"]): 46, + (73, G["factor"]): 54, + (73, G["atom"]): 40, (73, G["function-call"]): 38, - (73, G["term"]): 59, (73, G["expr-list"]): 74, - (73, G["factor"]): 54, + (73, G["expr"]): 66, + (73, G["term"]): 59, (78, G["case-list"]): 86, - (82, G["atom"]): 40, - (82, G["comp"]): 46, (82, G["term"]): 59, - (82, G["function-call"]): 38, (82, G["arith"]): 47, - (82, G["expr"]): 83, + (82, G["atom"]): 40, (82, G["factor"]): 54, + (82, G["expr"]): 83, + (82, G["function-call"]): 38, + (82, G["comp"]): 46, (84, G["case-list"]): 85, (89, G["declaration-list"]): 90, - (92, G["atom"]): 40, - (92, G["arith"]): 47, (92, G["function-call"]): 38, + (92, G["arith"]): 47, (92, G["factor"]): 54, + (92, G["expr"]): 93, + (92, G["atom"]): 40, (92, G["term"]): 59, (92, G["comp"]): 46, - (92, G["expr"]): 93, - (95, G["comp"]): 46, - (95, G["atom"]): 40, + (95, G["expr"]): 96, (95, G["arith"]): 47, + (95, G["atom"]): 40, (95, G["term"]): 59, - (95, G["expr"]): 96, (95, G["function-call"]): 38, + (95, G["comp"]): 46, (95, G["factor"]): 54, - (99, G["atom"]): 40, - (99, G["arith"]): 47, (99, G["expr"]): 100, (99, G["function-call"]): 38, (99, G["factor"]): 54, + (99, G["atom"]): 40, + (99, G["arith"]): 47, (99, G["comp"]): 46, (99, G["term"]): 59, - (101, G["term"]): 59, (101, G["arith"]): 47, (101, G["comp"]): 46, + (101, G["atom"]): 40, (101, G["factor"]): 54, + (101, G["term"]): 59, (101, G["expr"]): 102, - (101, G["atom"]): 40, (101, G["function-call"]): 38, - (109, G["atom"]): 40, - (109, G["comp"]): 46, (109, G["term"]): 59, - (109, G["function-call"]): 38, (109, G["arith"]): 47, + (109, G["atom"]): 40, (109, G["expr"]): 108, (109, G["factor"]): 54, (109, G["block"]): 110, - (113, G["atom"]): 40, - (113, G["arith"]): 47, - (113, G["function-call"]): 38, + (109, G["function-call"]): 38, + (109, G["comp"]): 46, (113, G["expr"]): 114, + (113, G["function-call"]): 38, + (113, G["arith"]): 47, (113, G["factor"]): 54, + (113, G["atom"]): 40, (113, G["term"]): 59, (113, G["comp"]): 46, - (121, G["atom"]): 40, - (121, G["arith"]): 47, - (121, G["factor"]): 54, (121, G["term"]): 59, (121, G["function-call"]): 38, - (121, G["expr"]): 122, + (121, G["arith"]): 47, (121, G["comp"]): 46, - (126, G["atom"]): 40, - (126, G["comp"]): 46, + (121, G["atom"]): 40, + (121, G["expr"]): 122, + (121, G["factor"]): 54, (126, G["term"]): 59, - (126, G["function-call"]): 38, (126, G["arith"]): 47, - (126, G["expr"]): 127, + (126, G["atom"]): 40, (126, G["factor"]): 54, - (132, G["feature-list"]): 133, - (132, G["method"]): 134, + (126, G["function-call"]): 38, + (126, G["expr"]): 127, + (126, G["comp"]): 46, (132, G["attribute"]): 131, - (135, G["method"]): 134, + (132, G["method"]): 134, + (132, G["feature-list"]): 133, (135, G["attribute"]): 131, + (135, G["method"]): 134, (135, G["feature-list"]): 136, - (139, G["feature-list"]): 140, - (139, G["method"]): 134, (139, G["attribute"]): 131, - (144, G["class-list"]): 145, + (139, G["method"]): 134, + (139, G["feature-list"]): 140, (144, G["class-def"]): 144, + (144, G["class-list"]): 145, } diff --git a/scripts/main.cl b/scripts/main.cl index f1c14d05a..ff1de46f7 100644 --- a/scripts/main.cl +++ b/scripts/main.cl @@ -1,7 +1,7 @@ class Main { main ( msg : String ) : Void { let a: Int <- 25, b: Int <- 15 in { - a + b; + a + +; } }; } From caa1e4e76391bbbe6ab900e5a13b402ff131ef37 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Sat, 25 Apr 2020 14:43:48 -0400 Subject: [PATCH 015/143] Implemented class TypeCollector --- cmp/__pycache__/visitor.cpython-37.pyc | Bin 2310 -> 0 bytes cmp/cil.py | 266 ------------------ cmp/{parsing => }/lexing.py | 0 cmp/{parsing => }/parsing.py | 4 +- cmp/parsing/__init__.py | 0 .../__pycache__/__init__.cpython-37.pyc | Bin 145 -> 0 bytes .../firsts_follows_tools.cpython-37.pyc | Bin 1689 -> 0 bytes .../__pycache__/parsing.cpython-37.pyc | Bin 11093 -> 0 bytes cmp/parsing/__pycache__/tools.cpython-37.pyc | Bin 1674 -> 0 bytes cmp/pycompiler.py | 4 +- cmp/{parsing => }/recovery.py | 0 cmp/semantic.py | 224 --------------- cmp/{parsing => }/serialization.py | 4 +- cmp/utils.py | 55 ---- grammar.py | 2 +- lexer.py | 8 +- main.py | 11 - output.txt | 2 - parser.py | 2 +- scope.py | 233 +++++++++++++-- semantic.py | 132 ++------- tester.py | 2 +- cmp/visitor.py => visitor.py | 4 +- 23 files changed, 255 insertions(+), 698 deletions(-) delete mode 100644 cmp/__pycache__/visitor.cpython-37.pyc delete mode 100755 cmp/cil.py rename cmp/{parsing => }/lexing.py (100%) rename cmp/{parsing => }/parsing.py (98%) delete mode 100755 cmp/parsing/__init__.py delete mode 100644 cmp/parsing/__pycache__/__init__.cpython-37.pyc delete mode 100644 cmp/parsing/__pycache__/firsts_follows_tools.cpython-37.pyc delete mode 100644 cmp/parsing/__pycache__/parsing.cpython-37.pyc delete mode 100644 cmp/parsing/__pycache__/tools.cpython-37.pyc rename cmp/{parsing => }/recovery.py (100%) delete mode 100755 cmp/semantic.py rename cmp/{parsing => }/serialization.py (97%) delete mode 100644 main.py delete mode 100644 output.txt rename cmp/visitor.py => visitor.py (98%) diff --git a/cmp/__pycache__/visitor.cpython-37.pyc b/cmp/__pycache__/visitor.cpython-37.pyc deleted file mode 100644 index e36348575d396e2c9279fdc1c8cefe0aca22776a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2310 zcmah~O>f&q5Zw<_qG;J^6SqxLw*~rvf(2@&MbTaiBWMHUQm6rPs(^-|xs)x5B9$eb z)CPUB0n3*HJ@+CV`f%2g6~`IxDOYF;qaOq_Gsa}|He0`C>x zWL+cj%s4NPk}T%rz$Gx`VifOSa>@E!ajfZ`@rvG+-M518Ag|88Dc{kw3 ze>5m2Q5hd4IuJ(mGvlkZ2hS&wj>cgYjg!CG>u)+o`8er}(&R;=J5O|elEh_Rbe^1) zM|swX^E~au<4Nbmpcs_7-kqEn-v5ZcPgP;u=ck)_w!4?+ag-MOyM67!9SGgTO;b&4 z2d^D1a?qZ4FcwR+owqhf75U$4Py#e;HJ)KovKgPVA*!KxDNz?bYUrJc4V}z^bf#wkioAoUUp0kF(g8F2?ul zwFK}J{3~d`gh<8zAn15^Q4Qln`miu!^fKVOfgtPGR1F~1|C-*Vg&05mkmzx(p4X=R zV8b*ASup`brX3$^on&PnU?!%~4-cYvWTYBs4gNCYg*MMHG+sZf(J?+i%!)F~;zU#B zY%0c&lnP5En3RE|U3%HItJ;M$@r-Cy)22L`B+ETmFlozQU=+7uh!1x$eBR(~(UuK< zdh5o1mi)Mj=r{Ob9d=1V|8tBbKekrIhSRF$Aw7KnlQ1Zd)JKYe`jk`-?he%0z}-!t zMde+93caRk0TSPCJf=_3MZ2Z>PZ-4>%#uT3k*ws9hBFdp;Lpsh#2oyYH7h;`Q$nvI z+Zq7x&{xdj9c<`ZSVfbP^}A%YVZfX4FwGC35VIYw^%;gl3&5${6y**wmHcit>Pp)` zRyC$sqf-Q~af&4E*IJ_7^#?G$R+&#iQgB-HiX>Q*3oIC9gE9<%fXmX8@iumj?xhWv`uBxZ8z%sEv_u~AEZRY5CLLA)=WD^zAEuH;nC z+&MdQF4-l&6qoYS>7yZ1bE}+30Oiar8R=E8is3quHSh@-97L$H96A?!#ItKA`CV4 zO(UT*QX)QY{l*z3Cxww|k{LP4CqYAhj5wR-B0q)Bfruz8YW386(4SHm?LdDJRD7>ShfW*2r9jphQv#+@ zbM*!hH6`&g#?+L=9YyuCWfed-= len(tokens): diff --git a/cmp/parsing/__init__.py b/cmp/parsing/__init__.py deleted file mode 100755 index e69de29bb..000000000 diff --git a/cmp/parsing/__pycache__/__init__.cpython-37.pyc b/cmp/parsing/__pycache__/__init__.cpython-37.pyc deleted file mode 100644 index 21bab1d3c58b626dd33b6663c0a6436e81147a1e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 145 zcmZ?b<>g`kg3{lM;z0Cc5CH>>K!yVl7qb9~6oz01O-8?!3`HPe1o6vCKO;XkRX;l? zwJfzrKcFbTGBvp*zgRz@vLquvPd_<7KSw_~w?Mxjv8XsRFI_)AJ~J<~BtBlRpz;=n SO>TZlX-=vg$jr|`%m4sBgCofR diff --git a/cmp/parsing/__pycache__/firsts_follows_tools.cpython-37.pyc b/cmp/parsing/__pycache__/firsts_follows_tools.cpython-37.pyc deleted file mode 100644 index ecd660df5bf223e103b04fdc244c9a9a1e060d44..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1689 zcmYk6O>g5w7{_PEFL7)qgx#v!EeP>)X(ZGlA)%G1s$G_LS%JD0U2R(nh}_uSIP2Ky zc)BELEFlFrapv4!K-~BQoDc^-!dyA+oztH9kDX-eXr7tpW$elPe>0!7S}wu!{I?Ik zaWMK5a2KuEfQd*%Q!=6fr6gjJ@dF81WJVTxBeJ6gdNXnkNw@g|)uc<6e?QMe zm}D_Oj749+Og}c7gLWUSNMQt-k&;baNr$vFj!3p<62YFie1j7Gix52_89OG@;CCdu zG_DZMKA3Du`YHMPtv)mbFRE17QJ|$v@ga{C}P#=*MFy2WV*Jp&k|mULRn!t9)!xP z++O7bovQ04%X(!O)6r?327X;ud%qLzV>vIMYz^{Jy!9-NpT~UbfalY=FY;pRU@8WA zw)KFAqfyA;zL$mR^gC3{153YNN$)IA)BM|_C-OWkHpf$Sv!9Q~_-DN|?}urxDl_%o zzX?OA%@}oQo4U+IbEyN*M$}=vjeMW#Dm)%q6Rnc%9}E&wQb@xl>yiu!gy@uppwgI8 z3A;_sJ4a-)h8#n#U7CW<2r?!z?<4b*Wc;s)Vg3X)25K@0XbsKM*5Z{7)Y=f$nfe$t zFlqvgcY%ftG=8bk(C;*n(G}aIhD7L@jTtLl$z=1=k?s|J1i;`que|evBXWKha8N*D z>_6V?HdRx^e3W2+iy9C=%d^Lekn$i&bkP?{o)yacB0dw!`Z9Ss5X$*Ho>tscJEpur z$fI5jP1jTO0oS-IyFUoCr*YsczM?$5f9bg61)uAQSq$cxe2d&L)Y8w7rT}Bb1E6inWy2|()n6W&fT6q1*O6!*xKx+oA z4fJNEsn)w)T9u|uTF`Xmh(LX)4gHx`bel~6#DV<}8XJ>85HT_5SEy@O>e@rQbWm9- zJNX%^IWv8nzyAu#m7es54j&@#L3w}Lk*0)_XAE8o9DD>0n&9B?IS05rbUrd};hy>t zRWk-IT8mi=Hl!i_OHZ~cA`ICY`uIj2Yu2&zA-MPq?T)@Uz=jDnUg$&6ZSfAe8VzIj z(H?FI5pr=@ooW8M&fU=FCX8yv*~KX4`rc?gEcRc4#8-5U-eIn9Lf(Msw)v_aSDZBF zCz#(tDDba|Uhp+tbz2*)a1Du5*Y}PUO#-LBQ+g-CB773KHASZ}R;zECYuLQD#HPMA zK1RCOgsHjFw6wv_b#89Jb10)7WHy*)YMt@-Fk`=Ksb+sP-nE;p Zj*47odxT?^#yfhC3%w=2;jB9E{15xbo3H=? diff --git a/cmp/parsing/__pycache__/parsing.cpython-37.pyc b/cmp/parsing/__pycache__/parsing.cpython-37.pyc deleted file mode 100644 index 12a9b2b2d451e12152e518389754b2c53ea80b6e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11093 zcmbtaTWlQHd7k^u&R)2rD2lq+SuOSx-MW8Edr20;G%DZ(Evq}7Dmw+MPHg0C=d+#)IPcBLmz@Z=%xMs z|I7|o6n#NTY0jMcIdlI1eE)a;vtKO~JPm*U6aMJin=feEe^6rhXCZPHPw?*ugeLTs zR;9Pm(%VMW&?#=V%(hjv+IH3EwAFIjnQ8`cTR3lPRaaz$i+5IJg@?B%aw3m+P838D z@4PrFN@DzNy;=|xVh?hPVp8nIdrVA;eR!8dMNEtRs4*^%i38#wViV$!cnD>C#FOG- z@fGAuzM_e;c;szOJhEX__ab#zJc`t#{@x9d^v96TsrUSsYRxIAu=}2E#!7i^k*Xd zy!Ph911r)ZYri(IQD#N;!A=+uc?*ud1okpKG#!>D+tq_)@p+A75_ycYJyLs_d@$^IUNILce}0Q^X--6D|Hz(I*Y^i%*tB4XTIBB!Q^YL?tHyfo+rx$h4 zu<&@gi3~L>k&a$LbsX1CiF$u-2u48S0U_p+^W$YrWD9 ztv`)217*d573v!rN-UH-g_66GAwL!d+J~rPqD~VsvfnTU&LD$&4rJ!8A_tj>pxZYPM{ulsAP3cNzq+)`bNn$m+xF4kX> zv`(=zzf|um`msCgCC;JGG~sRc80$ABp+_~NM1ND#V#m1=fw2~-ph#uKp-{O+@CfpP zBM3Cz(k&yem+%w~N4Lzp?n0J^jX{1VeSKT z{tjww7|?{mu+>l-A~VWw=Ar`YfEg8@$>Qjp_# zDP=G(T)7zMgRm~cn%b9g0)?^F@)yF`mW{=wFwXj&)wVAQ3<{Tm*>2~0qET`Wbwry< zW+)(hs}$uV#aUA_3*A<$`&J+q z*Q=h=quV}aOz<(HIAf{es4>r>IG918G>7!12<=gtqi|pXDOWf25=xF5q*VtD`8Zmn z*g&Xl;$aP1KqS;6Z9^aE$=m2(#%_NDSgUVo12Zz425{MIn!!Y5H7)r}Zz2Se3*&8I zb<;kNwrCB+j`?XRsZV`&$qh4ssxzI6Emk-Qo)&- zv?_qagms9`mF`OH&HDZD8iRVAzZA^*01%(;pm!-qm4g*2yCA#keg{oqHtYs$We{hQ zq2kPn-w^^ z9yU!j%0yX=0q6_fkGy8CLw#m3Lau)|asj35gM65ea#0>*6rw_CZ_xVxb#D_!G!qrj zwg@Oa4=61xd+6CyV2b|!ljm1Z^Xs^nU4do?NG(#!(;DVbBpB5bGaGrEV^O|Yii%rc zuf0tGs04u8kgh!|iC3)ee?`{Y?YboH#|!JcDBBkl6P3C{PhyUE^{^eM*jDP3MdyA&#k-=?Zf9GjS2|0?b8H(w>Lw5btF zGxs93wi528!vddAEU-b`3sx9*e_$p2+uAfEqiK-<|z;n})vtj10K7#Q^6Hu}n#*>_g$FOZ(BuS;# z^&M@){6nK>5w`Q@PE9L|Lq36K$l6{C!r*(}=@t%xv=nFlj`}5OINJIFnB00tjL0Ib zR>`v2kcUxI9nvyarGKa4zqNy0$rq^xEi8mX;$WIp&8Z!yPFWdSN%LbFg)X4CKN^fBBwzRkTZ}1*-uhoJZCU zX7SI+O0ggz1}8`KZ%6}yF05BG)CDb9#Twxl1gP>11&J>4NUTdkwsG>GP#n-k()3AS zv%H2_szKvOq^SJD=MfG)cno_QyA<@+1`;@Y;>H_>dX$W0h>TD<7@YO42_$fbq$JEj z>!5)+(|O3XVft;PKtw=CKvg0KbcCo#4o@C*B-{T{lmTgYCdzCUU>!Uo}2{@DKQN>lvtE(ROA_zct#~P zBiIMb& z5+!XqDKpr}hbTs>s7MKEfMO>1lM;D~3P`ldWc(V%Xb;Jk5LCvu&wcXODfcV|bP7|O z_^TA-olH<7&r|RW1s5o|NC9isD-fO^Hm9JrnICismSa>W;K3abbMe->G zvAO7n%F2+m7(wK3Q0y`VB+D44Aq2;SHKMNKERbxazDUP@JFMSs`H8V1{+N(VC0RB^ zB(W+^ZlHctVW-%pgb%I(KNOC8@Yf9~3=XeaK>h*^U_A}#IFL;dagvPu7V=XVA@p(a zuv9K4FhWG^UAWr7^{2^g!_Yw|6)-FT3I|!ig_FPt(!vrpj^YMUfq^NUk(32@AM)Rv z0CeEg0;n*tZ7oo~*T|tJ%$GEPl0l%fnE_BZY2RetoCO2DL(cuzqKy16kwNU$h+IWy z!TVgm%ya0`jj|+b(!iY-l%G9+xNlAILkEjhB$M~qk6YWE2fmEs8>NGDtz7@&9X>g}Aa&a?ZXnaVfN z<-YAHUaaK#^uaF25g;X{h5rl`P<=G>nw!W}=*ruTjcj2AFc}=HROxjJcq^Z!*j@zi zddY5Eov5nhP-*iPtGe(N@G+~JL5z3ZE-M`G-E}F8^d-cuu=5x*$+cP}0tnNS`|m6D*OmlOPEz#?YgRi{g%O< z4DNeG7H?PJt_Sa|$cqBro+yejymO)ibQ_PyuPrqeLgih$3irP+aqaTzrHj{NXYRuJ zZ@zpXHm-a<#Rr-NX&mFjpCCfmT0^+03w?{?bmCHuU9Dy@!60;iKLBM8&>FiMF_+E& zwJe7osZcG)VIHWh)e0OIQG09);Dz>C`9WA}j&DvdB`N$VFy@CQVf9FE5xKU?W#o2d zuk(3gJ$s`r2@+40*Qd+;xlgO_E#netp@p3hcUipds4Xh*M4a2s zdPS)y6S>E+F!E6ZajB;CB0Y#pQo=Zk>mD^Q>;c^h1@Jxa^?*}OmJ_*yuHN6z=6qD z|6IhT^z{P|=)}yhixddRN_co!6C895DZvqdkS}$B+c=;A!HU3OQyo-lW^W3J`Ey3h zpW$-gAIZL>&c}3h)3oJ>gr7}Z-!xtLo+RX-MSmVM0lf+QMk+5f*l!aS<6i%}s8OIx zIrMQDoM5y*Yz1l;smG-LZvnASAw343kZG1=d|&+x*B_585W`G!&z9aalXj<)dXqd4 zsy9-HXL1TX&m?>S{>iYJ{}qanDB^5Q`ilTE2y>A#nJC_- zlH7<5mvt&5zo&eff?E{apn#bMX-&nI9m*g}uLdWB0_Rm1ib9wbXH!lva*|3^|DdYA7fQHYOEjGMMadV->0kdbPl9HGIA+!e1HVZxejvneX$ z_deIMl3LUU)uMh!YITSZaGwksa6n=OH1h%l=wy->J7&eHLYGhV{iA98LC6^ENHAB4o;sPWProz&<_e2X|T8p^Bv2k0wbE zZ$H|HbkltoMnRqV^?1*0H@wtdY5B@+dVx>|XBD39{rDgSny=852;DV({qQam*a2hr z8HCT9hwP(EoT7Q$T@0s`C=W&ke`uG%Q?(7!aqn}mAHc+gj&fE!iMhWTyJh?wG;9410@A&_;MfmTmbD z0_V@+jL9wjI!3yQCz&gMK{`{wT{FLI;8Z>R*>go(s#oB8{~cxUm7vKXdKAv0j*)Q% zK=+`Nxa1mm{e^HWEUCN=qUqOBKR3w3r#lX_JrbJOcUWDJ>YRr2b%9RpG)8beoDi9C z4{p(Qe7zgx5oRg;At?P_9hCSwC~>AaDV*gj=Kcvz=96^Kj{8_0`+6uht+^K~hNBv! zSH$GHKT{7MCeeV+HuXB^5J#kus6GYNRf}ER-;qizEMDx z{Nb7Mh5ibDvjLCSdcNG~z+BWtxw}yQl=kfUL-bi-IB9!;P(zdzr6^aXV~@Y47Ot%* zXi|*E=IPK)N?&;!meHAPQP4&}1iRzI8QpEIwmZtdaf=G;6cDm2^X9@A>Vr87>YyF(E3HPp~D;M>f_UAu&H@DwNzIWddI zVZ2?$EW8bSQh7I!c8zJAnh)zU$SL9y6hDOE+}&xC8g90dr?KhYs8)-;TCI)Wf3zr` zuhn|1^_D78c7>Od)<gEPdMqA};1mKj3ipxKnP? zHCexKD$F*jMyDQC-(XC z)$An{GXMD;WAkI0F!cgsb08gKW+zup!Jew7gBFp%kN`@$Ii+n+cfuy~?QL%LMJDI3 zMy9ZLWD47+W)^1u`xs099tA(3fDEOQ$8Mr{7o~qm-O|p0cifbe^UE*(<++o)EIxJ4 zi%)(-b*qfkfZ=;r{R9omPG=A-2)Wx76XlH0w*7xIvK9x@Q9oZCXp&HWL?DVG?_f{Y z7cKtBBLnUo8SwwH_`i>7{N%pHr<~mvpP1K!nh!m);@stP>3r_f`7gihbaMYv%l^}m zRX8*rd&G;ud2`~!^s_rs1|T~fNDU*z8=Vw>Rqen}`_&ExleGs&^E&Yo!e zDhydGYjmmB0BkF7HGOzBOC_seBl&rox-dJ468<5Nx?JaLbl&|}sNfqEu%ncn*{qD@ zwPDW&!xC=~Nn+wz?gnqMds+eK8GMo!978~U=8~RwfN*8E;*PtPcNADxay`%So^*@e Mk>YnWy@ZVa1Cg~}TmS$7 diff --git a/cmp/parsing/__pycache__/tools.cpython-37.pyc b/cmp/parsing/__pycache__/tools.cpython-37.pyc deleted file mode 100644 index e557b01cf531b29a9a1ac00d354edfffec0e2b29..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1674 zcmYk6&2QX97{+JDAM39*OBJpIjyF^GO_uM0Ezu-zgWFuC46Tl$WAZR+LSKk@9P| zUpu`{{pzRJ^~x@1M;||qYgY9QHSvm`2p2ccziS$t=8!ubW&1LXu+ndl8gv;zEc^3N@GqX>?S$u9Fpk@ zatyh!G6kIzWK3l4A@h@D{I8f{{1i0?YH}!Mjm*l{YE>=N+ECG%1?aWVbHTy~V8I3p zzcei9Z<@&HicQi`A@s=BoK>D=(!Fq`cS)auD0t2r?`;2&oIL~$6ciYH&vv@5az(<& zDK@lhhzRl`f3^rI9~#8x1CbVasmw2uQ=zOc(-%XboX?Y44NARZ${$8N?l+WleMNV< z=3Ci=VU)i}dd^}N<>UL;jyJjfyrM^3Z*{NLfN{k2nN7O{E|3PD8`a2>f#{3F(?OI)XWLFLb4Yw}sBf#vNQtKcZ^Rz(sp8YQcsy zWN_ijc1?sK+oJ$;G%>e{osGc7XJ`-fO#wDcu<=SCf^M64@M_R7wx90cS`ZNz2lXN5 zZ|mGGZEnLTH_6Y(3D*}z`$@U?1|+_uYxE9tef9AcOgH4qx?gkBIxVuS__pMC5b6at zL@)V@uDYv@R=9!0Y3ln&il#lMxkUQMy+!!A=QR|aBv`G!T5e$T)-^WGoF5}yuER9k zXj($BbCa7}@Epo$2bnddnObH1LyXw#TFM=aC+p`Ty*fe7-_&T;6*p$D*HM$}Y>siP SvSdr|ajCZ?Fq~!Q{r>^wWtC?D diff --git a/cmp/pycompiler.py b/cmp/pycompiler.py index c894c75b4..6fd05f085 100755 --- a/cmp/pycompiler.py +++ b/cmp/pycompiler.py @@ -2,8 +2,8 @@ import re from typing import List, FrozenSet, Optional, Tuple, Iterable, Callable, Dict -from cmp.parsing.lexing import Lexer, Token -from cmp.parsing.serialization import LRParserSerializer, LexerSerializer +from cmp.lexing import Lexer, Token +from cmp.serialization import LRParserSerializer, LexerSerializer class GrammarError(Exception): diff --git a/cmp/parsing/recovery.py b/cmp/recovery.py similarity index 100% rename from cmp/parsing/recovery.py rename to cmp/recovery.py diff --git a/cmp/semantic.py b/cmp/semantic.py deleted file mode 100755 index 118ec1fd0..000000000 --- a/cmp/semantic.py +++ /dev/null @@ -1,224 +0,0 @@ -import itertools -from collections import OrderedDict -from typing import List - - -class SemanticError(Exception): - @property - def text(self): - return self.args[0] - - -class Attribute: - def __init__(self, name, typex): - self.name = name - self.type = typex - - def __str__(self): - return f'[attrib] {self.name} : {self.type.name};' - - def __repr__(self): - return str(self) - - -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 Type: - def __init__(self, name: str): - self.name = name - self.attributes: List[Attribute] = [] - self.methods: List[Method] = [] - self.parent = None - - def set_parent(self, parent): - if self.parent is not None: - raise SemanticError(f'Parent type is already set for {self.name}.') - self.parent = parent - - def get_attribute(self, name: str): - try: - return next(attr for attr in self.attributes if attr.name == name) - except StopIteration: - if self.parent is None: - raise SemanticError(f'Attribute "{name}" is not defined in {self.name}.') - try: - return self.parent.get_attribute(name) - except SemanticError: - raise SemanticError(f'Attribute "{name}" is not defined in {self.name}.') - - def define_attribute(self, name: str, typex): - try: - self.get_attribute(name) - except SemanticError: - attribute = Attribute(name, typex) - self.attributes.append(attribute) - return attribute - else: - raise SemanticError(f'Attribute "{name}" is already defined in {self.name}.') - - def get_method(self, name: str): - try: - return next(method for method in self.methods if method.name == name) - except StopIteration: - if self.parent is None: - raise SemanticError(f'Method "{name}" is not defined in {self.name}.') - try: - return self.parent.get_method(name) - except SemanticError: - raise SemanticError(f'Method "{name}" is not defined in {self.name}.') - - def define_method(self, name: str, param_names: list, param_types: list, return_type): - if name in (method.name for method in self.methods): - raise SemanticError(f'Method "{name}" already defined in {self.name}') - - method = Method(name, param_names, param_types, return_type) - self.methods.append(method) - return method - - def all_attributes(self, clean=True): - plain = OrderedDict() if self.parent is None else self.parent.all_attributes(False) - for attr in self.attributes: - 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: - 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) - output += '\n\t' if self.attributes else '' - output += '\n\t'.join(str(x) for x in self.methods) - output += '\n' if self.methods else '' - output += '}\n' - return output - - def __repr__(self): - return str(self) - - -class ErrorType(Type): - def __init__(self): - Type.__init__(self, '') - - def conforms_to(self, other): - return True - - def bypass(self): - return True - - def __eq__(self, other): - return isinstance(other, Type) - - -class VoidType(Type): - def __init__(self): - Type.__init__(self, '') - - def conforms_to(self, other): - raise Exception('Invalid type: void type.') - - def bypass(self): - return True - - def __eq__(self, other): - return isinstance(other, VoidType) - - -class IntType(Type): - def __init__(self): - Type.__init__(self, 'int') - - def __eq__(self, other): - return other.name == self.name or isinstance(other, IntType) - - -class Context: - def __init__(self): - self.types = {} - - def create_type(self, name: str): - if name in self.types: - raise SemanticError(f'Type with the same name ({name}) already in context.') - typex = self.types[name] = Type(name) - return typex - - def get_type(self, name: str): - try: - return self.types[name] - except KeyError: - raise SemanticError(f'Type "{name}" is not defined.') - - 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): - self.name = name - self.type = vtype - - -class Scope: - def __init__(self, parent=None): - self.locals = [] - self.parent = parent - self.children = [] - self.index = 0 if parent is None else len(parent) - - def __len__(self): - return len(self.locals) - - def create_child(self): - child = Scope(self) - self.children.append(child) - return child - - def define_variable(self, vname, vtype): - info = VariableInfo(vname, vtype) - self.locals.append(info) - return info - - def find_variable(self, vname, index=None): - _locals = self.locals if index is None else itertools.islice(self.locals, index) - try: - return next(x for x in _locals if x.name == vname) - except StopIteration: - return self.parent.find_variable(vname, self.index) if self.parent is None else None - - def is_defined(self, vname): - 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) diff --git a/cmp/parsing/serialization.py b/cmp/serialization.py similarity index 97% rename from cmp/parsing/serialization.py rename to cmp/serialization.py index 6008cb093..baf58dd54 100644 --- a/cmp/parsing/serialization.py +++ b/cmp/serialization.py @@ -1,7 +1,7 @@ import re PARSER_TEMPLATE = """from abc import ABC -from cmp.parsing.parsing import ShiftReduceParser +from cmp.parsing import ShiftReduceParser from %s import %s @@ -23,7 +23,7 @@ def __goto_table(): LEXER_TEMPLATE = """import re -from cmp.parsing.lexing import Token, Lexer +from cmp.lexing import Token, Lexer from %s import %s diff --git a/cmp/utils.py b/cmp/utils.py index 6ebe376e0..fec953cac 100755 --- a/cmp/utils.py +++ b/cmp/utils.py @@ -63,61 +63,6 @@ def __eq__(self, other): ContainerSet) and self.set == other.set and self.contains_epsilon == other.contains_epsilon -class DisjointSet: - def __init__(self, *items): - self.nodes = {x: DisjointNode(x) for x in items} - - def merge(self, items): - items = (self.nodes[x] for x in items) - try: - head, *others = items - for other in others: - head.merge(other) - except ValueError: - pass - - @property - def representatives(self): - return {n.representative for n in self.nodes.values()} - - @property - def groups(self): - return [[n for n in self.nodes.values() if n.representative == r] for r in self.representatives] - - def __len__(self): - return len(self.representatives) - - def __getitem__(self, item): - return self.nodes[item] - - def __str__(self): - return str(self.groups) - - def __repr__(self): - return str(self) - - -class DisjointNode: - def __init__(self, value): - self.value = value - self.parent = self - - @property - def representative(self): - if self.parent != self: - self.parent = self.parent.representative - return self.parent - - def merge(self, other): - other.representative.parent = self.representative - - def __str__(self): - return str(self.value) - - def __repr__(self): - return str(self) - - class TrieNode: def __init__(self, symbol, parent=None, final=False): self.symbol = symbol diff --git a/grammar.py b/grammar.py index 4db70523b..9939f880d 100644 --- a/grammar.py +++ b/grammar.py @@ -2,7 +2,7 @@ import time import astnodes as ast -from cmp.parsing.parsing import LALR1Parser +from cmp.parsing import LALR1Parser from cmp.pycompiler import Grammar t = time.time() diff --git a/lexer.py b/lexer.py index 1c3a05d00..8919d9a87 100644 --- a/lexer.py +++ b/lexer.py @@ -1,6 +1,6 @@ import re -from cmp.parsing.lexing import Token, Lexer +from cmp.lexing import Token, Lexer from grammar import G @@ -12,9 +12,9 @@ def __init__(self): self.token = Token('', '', 0, 0) self.pattern = re.compile(r'(?P\n+)|(?P +)|(?P\t+)|(inherits)|(isvoid)|(class)|(while)|(false)|(then)|(else)|(loop)|(pool)|(case)|(esac)|(true)|(<\-)|(let)|(new)|(not)|(\{)|(\})|(\()|(\))|(\.)|(=>)|(if)|(fi)|(in)|(of)|(\+)|(\-)|(\*)|(<=)|(\~)|(,)|(:)|(;)|(@)|(/)|(<)|(=)|(?P[a-z][a-zA-Z0-9_]*)|(?P[A-Z][a-zA-Z0-9_]*)|(?P\"[^\"]*\")|(?P\d+)|(?P\'[^\']*\')') self.token_rules = {key: rule for key, (_, _, rule) in G.terminal_rules.items() if rule is not None} - self.error_handler = G.lexical_error_handler if G.lexical_error_handler is not None else self.error + self.error_handler = G.lexical_error_handler if G.lexical_error_handler is not None else self.error self.contain_errors = False self.eof = '$' - + def __call__(self, text): - return [Token(t.lex, G[t.token_type], t.line, t.column) for t in self.tokenize(text)] + return [Token(t.lex, G[t.token_type], t.line, t.column) for t in self.tokenize(text)] diff --git a/main.py b/main.py deleted file mode 100644 index d6214fb06..000000000 --- a/main.py +++ /dev/null @@ -1,11 +0,0 @@ -import time - -from lexer import CoolLexer -from parser import CoolParser - - -if __name__ == '__main__': - t = time.time() - CoolLexer() - CoolParser() - print('Create :', time.time() - t) diff --git a/output.txt b/output.txt deleted file mode 100644 index 1399e1914..000000000 --- a/output.txt +++ /dev/null @@ -1,2 +0,0 @@ -\'[^\'\']\' -\'[^\'\']\' diff --git a/parser.py b/parser.py index 5ab542aba..6f4588308 100644 --- a/parser.py +++ b/parser.py @@ -1,5 +1,5 @@ from abc import ABC -from cmp.parsing.parsing import ShiftReduceParser +from cmp.parsing import ShiftReduceParser from grammar import G diff --git a/scope.py b/scope.py index bc4f28c86..d097c9d2a 100644 --- a/scope.py +++ b/scope.py @@ -1,25 +1,226 @@ -class VariableInfo: +import itertools +from collections import OrderedDict +from typing import List, Optional, Iterable, Dict + + +class SemanticError(Exception): + @property + def text(self): + return self.args[0] + + +class Attribute: def __init__(self, name, typex): - self.name = name - self.type = typex + self.name: str = name + self.type: 'Type' = typex + + 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: str = name + self.param_names: List[str] = param_names + self.param_types: List['Type'] = params_types + self.return_type: '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 Type: + def __init__(self, name: str): + self.name: str = name + self.attributes: List[Attribute] = [] + self.methods: List[Method] = [] + self.parent: Optional['Type'] = None + + def set_parent(self, parent: 'Type') -> None: + if self.parent is not None: + raise SemanticError(f'Parent type is already set for {self.name}.') + self.parent = parent + + def get_attribute(self, name: str) -> Attribute: + try: + return next(attr for attr in self.attributes if attr.name == name) + except StopIteration: + if self.parent is None: + raise SemanticError(f'Attribute "{name}" is not defined in {self.name}.') + try: + return self.parent.get_attribute(name) + except SemanticError: + raise SemanticError(f'Attribute "{name}" is not defined in {self.name}.') + + def define_attribute(self, name: str, typex: 'Type') -> Attribute: + try: + self.get_attribute(name) + except SemanticError: + attribute = Attribute(name, typex) + self.attributes.append(attribute) + return attribute + else: + raise SemanticError(f'Attribute "{name}" is already defined in {self.name}.') + + def get_method(self, name: str) -> Method: + try: + return next(method for method in self.methods if method.name == name) + except StopIteration: + if self.parent is None: + raise SemanticError(f'Method "{name}" is not defined in {self.name}.') + try: + return self.parent.get_method(name) + except SemanticError: + raise SemanticError(f'Method "{name}" is not defined in {self.name}.') + + def define_method(self, name: str, + param_names: List[str], + param_types: List['Type'], + return_type: 'Type') -> Method: + if name in (method.name for method in self.methods): + raise SemanticError(f'Method "{name}" already defined in {self.name}') + + method = Method(name, param_names, param_types, return_type) + self.methods.append(method) + return method + + def all_attributes(self, clean: bool = True): + plain = OrderedDict() if self.parent is None else self.parent.all_attributes(False) + for attr in self.attributes: + plain[attr.name] = (attr, self) + return plain.values() if clean else plain + + def all_methods(self, clean: bool = True): + plain = OrderedDict() if self.parent is None else self.parent.all_methods(False) + for method in self.methods: + plain[method.name] = (method, self) + return plain.values() if clean else plain + + def conforms_to(self, other: 'Type') -> bool: + return other.bypass() or self == other or self.parent is not None and self.parent.conforms_to(other) + + def bypass(self) -> bool: + 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) + output += '\n\t' if self.attributes else '' + output += '\n\t'.join(str(x) for x in self.methods) + output += '\n' if self.methods else '' + output += '}\n' + return output + + def __repr__(self): + return str(self) + +class ErrorType(Type): + def __init__(self): + super().__init__('') + + def conforms_to(self, other): + return True + + def bypass(self): + return True + + def __eq__(self, other): + return isinstance(other, Type) + + +class VoidType(Type): + def __init__(self): + super().__init__('') -class FunctionInfo: - def __init__(self, name, params, return_type, typex=None): - self.name = name - self.params = params - self.return_type = return_type - self.type = typex + def conforms_to(self, other): + raise Exception('Invalid type: void type.') + def bypass(self): + return True -class ClassInfo: + def __eq__(self, other): + return isinstance(other, VoidType) + + +class IntType(Type): def __init__(self): - pass + super().__init__('int') + + def __eq__(self, other): + return other.name == self.name or isinstance(other, IntType) + + +class Context: + def __init__(self): + self.types: Dict[str, Type] = {} + + def create_type(self, name: str) -> Type: + if name in self.types: + raise SemanticError(f'Type with the same name ({name}) already in context.') + typex = self.types[name] = Type(name) + return typex + + def get_type(self, name: str) -> Type: + try: + return self.types[name] + except KeyError: + raise SemanticError(f'Type "{name}" is not defined.') + + 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): + self.name: str = name + self.type: Type = vtype class Scope: - def __init__(self, parent=None): - self.variables = {} - self.functions = {} - self.classes = {} - self.parent = parent + def __init__(self, parent: Optional['Scope'] = None): + self.locals: Dict[str, VariableInfo] = {} + self.parent: Optional['Scope'] = parent + self.children: List[Scope] = [] + self.index: int = 0 if parent is None else len(parent) + + def create_child(self) -> 'Scope': + child = Scope(self) + self.children.append(child) + return child + + def define_variable(self, vname: str, vtype: Type) -> VariableInfo: + info = VariableInfo(vname, vtype) + self.locals[vname] = info + return info + + def find_variable(self, vname: str) -> Optional[VariableInfo]: + try: + return self.locals[vname] + except StopIteration: + return self.parent.find_variable(vname, self.index) if self.parent is None else None + + def is_defined(self, vname) -> bool: + return self.find_variable(vname) is not None + + def is_local(self, vname: str) -> bool: + return vname in self.locals + + def __len__(self): + return len(self.locals) diff --git a/semantic.py b/semantic.py index db53d1108..4afb03b8f 100644 --- a/semantic.py +++ b/semantic.py @@ -3,8 +3,12 @@ All classes defined here follows the visitor pattern using the module cmp.visitor, with this we can get a more decoupled inspection. """ +from typing import List + import astnodes as ast -import cmp.visitor as visitor +import visitor as visitor + +from scope import Context, SemanticError class Formatter: @@ -125,122 +129,30 @@ def visit(self, node: ast.InstantiateNode, tabs: int = 0): return '\t' * tabs + f'\\__ InstantiateNode: new {node.lex}()' +# noinspection PyDefaultArgument class ClassCollector: + def __init__(self, context: Context = Context(), errors: List[str] = []): + self.errors: List[str] = errors + self.context: Context = context + @visitor.on('node') - def visit(self, node, tabs): + def visit(self, node): pass @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode): - pass + def visit(self, node): + self.context = Context() + self.context.create_type('int') + self.context.create_type('void') + for declaration in node.declarations: + self.visit(declaration) @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode): - pass - - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode): - pass - - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode): - pass - - @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode): - pass - - @visitor.when(ast.VarDeclarationNode) - def visit(self, node: ast.VarDeclarationNode): - pass - - @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode): - pass - - @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode): - pass - - @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode): - pass - - @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode): - pass - - @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode): - pass - - @visitor.when(ast.CaseNode) - def visit(self, node: ast.CaseNode): - pass - - @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode): - pass - - @visitor.when(ast.IntegerNode) - def visit(self, node: ast.IntegerNode): - pass - - @visitor.when(ast.StringNode) - def visit(self, node: ast.StringNode): - pass - - @visitor.when(ast.BooleanNode) - def visit(self, node: ast.BooleanNode): - pass - - @visitor.when(ast.VariableNode) - def visit(self, node: ast.VariableNode): - pass - - @visitor.when(ast.InstantiateNode) - def visit(self, node: ast.InstantiateNode): - pass - - @visitor.when(ast.NegationNode) - def visit(self, node: ast.NegationNode): - pass - - @visitor.when(ast.ComplementNode) - def visit(self, node: ast.ComplementNode): - pass - - @visitor.when(ast.IsVoidNode) - def visit(self, node: ast.IsVoidNode): - pass - - @visitor.when(ast.PlusNode) - def visit(self, node: ast.PlusNode): - pass - - @visitor.when(ast.MinusNode) - def visit(self, node: ast.MinusNode): - pass - - @visitor.when(ast.StarNode) - def visit(self, node: ast.StarNode): - pass - - @visitor.when(ast.DivNode) - def visit(self, node: ast.DivNode): - pass - - @visitor.when(ast.LessEqualNode) - def visit(self, node: ast.LessEqualNode): - pass - - @visitor.when(ast.LessNode) - def visit(self, node: ast.LessNode): - pass - - @visitor.when(ast.EqualNode) - def visit(self, node: ast.EqualNode): - pass + def visit(self, node): + try: + self.context.create_type(node.id) + except SemanticError as e: + self.errors.append(e.text) class TypeBuilder: diff --git a/tester.py b/tester.py index bbe0e144b..50e7de48d 100644 --- a/tester.py +++ b/tester.py @@ -3,7 +3,7 @@ import fire -from cmp.parsing.lexing import Token +from cmp.lexing import Token from lexer import CoolLexer from parser import CoolParser from semantic import Formatter diff --git a/cmp/visitor.py b/visitor.py similarity index 98% rename from cmp/visitor.py rename to visitor.py index 20800dca5..eba985fdd 100755 --- a/cmp/visitor.py +++ b/visitor.py @@ -1,9 +1,9 @@ # The MIT License (MIT) # -# Copyright (c) 2013 Curtis Schlak +# Copyright © 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 +# 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 From d2145cccb866a30dfc51b5f1eea40795b0347c6f Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Sat, 25 Apr 2020 14:44:06 -0400 Subject: [PATCH 016/143] Implemented class TypeCollector --- semantic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/semantic.py b/semantic.py index 4afb03b8f..8aa4e58b4 100644 --- a/semantic.py +++ b/semantic.py @@ -130,7 +130,7 @@ def visit(self, node: ast.InstantiateNode, tabs: int = 0): # noinspection PyDefaultArgument -class ClassCollector: +class TypeCollector: def __init__(self, context: Context = Context(), errors: List[str] = []): self.errors: List[str] = errors self.context: Context = context From 6f29f23eff32052d0ef442c296557b50b81adaa9 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Sat, 25 Apr 2020 18:22:02 -0400 Subject: [PATCH 017/143] Type Builder finished --- Instructions.md | 29 +++++ MANUAL.md | 11 -- README.md | 1 + astnodes.py | 87 +++++++------ grammar.py | 8 +- main.py | 34 +++++ scope.py | 4 +- semantic.py | 337 ++++++++++++++++++++---------------------------- 8 files changed, 260 insertions(+), 251 deletions(-) create mode 100644 Instructions.md delete mode 100644 MANUAL.md create mode 100644 README.md create mode 100644 main.py diff --git a/Instructions.md b/Instructions.md new file mode 100644 index 000000000..ea994b6f9 --- /dev/null +++ b/Instructions.md @@ -0,0 +1,29 @@ +# Interprete de Cool + +# Manual de Desarrollo + +## Flujo de Trabajo: + +- El archivo `astnodes.py` contiene los nodos del ast de cool, fue renombrado asi para no entrar en conflicto con la libreria `ast` de python + +- Todo cambio realizado en la gramatica o al lexer se hara en el archivo `grammar.py`. Para probar si al hacer cambios en la gramatica esta sigue sin dar conflicto tansolo debemos correr el script de la siguiente forma `python3 grammar.py` + +- Si ha ocurrido algun cambio significativo en la gramatica o el lexer, ya sea agragar una nueva produccion, terminal, o una nueva expresion regular, se debe ejecutar este modulo. Para esta ultima accion tenemos el archivo `grammar.py`, para correrlo basta con hacer `python3 grammar.py` y este creara dos archivos nuevo `parser.py` y `lexer.py` que contendran el parser y el lexer de cool serializado con las modificaciones realizadas para no tener que construir el parser cada vez que probemos el programa. + +- Al paquete `cmp` se le han hecho varias modificaciones: + + - Se han eliminado todos los archivos y clases innecesarios para el proceso de parsing y lexing. + + - El archivo `lexing.py` contiene las clases `Token` y `Lexer`. + + - El archivo `parsing.py` contiene los metodos y funciones necesarios para el proceso de creacion de los parser SLR, LR(1), LALR(1). Se han hecho varias mejoras al proceso de de creacion de los parsers. + + - El archivo `pycompiler.py` se mantine con las definiciones de la gramatica, y se ha modificado para que casi todo sea manejado desde la clase `Grammar` (Tanto la creacion del lexer como el parser) + + - El archivo `serialization.py` contiene los serializers de las tablas de lexer y parsing. + + - El archivo `utils.py` contiene la clase `ContainerSet` (Posible eliminacion) + +- Para probar programas tan solo escribalo en un archivo `.cl` en la carpeta `scripts/` y ejecutar el comando en la terminal `python3 test.py `, por ejemplo `python3 test.py tokenize program.cl` o `python3 test.py parse program.cl` + +- En el archivo `main.py` hay un pipeline de como es el proceso completo. diff --git a/MANUAL.md b/MANUAL.md deleted file mode 100644 index da473ebe2..000000000 --- a/MANUAL.md +++ /dev/null @@ -1,11 +0,0 @@ -# Interprete de Cool - -# Manual de Desarrollo - -## Flujo de Trabajo: - -- El archivo `astnodes.py` contiene los nodes del ast de cool, fue renombrado asi para no entrar en conflicto con la libreria `ast` de python -- Todo cambio realizado en la gramatica o al lexer se hara en el archivo `definitions.py`. Para probar si al hacer cambios en la gramatica esta sigue sin dar conflicto tansolo debemos correr el script de la siguiente forma `python3 definitions.py` -- Si ha ocurrido algun cambio significativo en la gramatica o el lexer, ya sea agragar una nueva produccion, terminal, o una nueva expresion regular, se debe recompilar este paquete. Para esta ultima accion tenemos el archivo `build.py`, para correrlo basta con hacer `python3 build.py` y este creara dos archivos nuevo `parser.py` y `lexer.py` que contendran el parser y el lexer de cool serializado con las modificaciones realizadas para no tener que construir el parser cada vez que probemos el programa. -- Al paquete `cmp` se le ha agregado un nuevo subpaquete `serializer`, que contiene tanto al serializador del parser como del lexer. -- Para probar programas tan solo escribalo en un archivo `.cool` en la carpeta `scripts/` y ejecutar el comando en la terminal `python3 test.py `, por ejemplo `python3 test.py tokenize program.cool` o `python3 test.py parse program.cool` \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 000000000..80f1e0355 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# Cool Interpreter for compiling class diff --git a/astnodes.py b/astnodes.py index 86699abcd..f550427e8 100644 --- a/astnodes.py +++ b/astnodes.py @@ -1,114 +1,119 @@ +from typing import List, Union, Tuple + +Feature = Union['MethodDeclarationNode', 'AttrDeclarationNode'] + + class Node: pass class ProgramNode(Node): def __init__(self, declarations): - self.declarations = declarations + self.declarations: List[ClassDeclarationNode] = declarations class DeclarationNode(Node): pass -class ExprNode(Node): - pass - - class ClassDeclarationNode(DeclarationNode): def __init__(self, idx, features, parent=None): - self.id = idx - self.parent = parent - self.features = features + self.id: str = idx + self.parent: str = parent + self.features: List[Feature] = features class MethodDeclarationNode(DeclarationNode): def __init__(self, idx, params, return_type, body): - self.id = idx - self.params = params - self.type = return_type - self.body = body + self.id: str = idx + self.params: List[Tuple[str, str]] = params + self.type: str = return_type + self.body: ExprNode = body class AttrDeclarationNode(DeclarationNode): def __init__(self, idx, typex, expr=None): - self.id = idx - self.type = typex - self.expr = expr + self.id: str = idx + self.type: str = typex + self.expr: ExprNode = expr + + +class ExprNode(Node): + pass class BlockNode(ExprNode): def __init__(self, expressions): - self.expressions = expressions + self.expressions: List[ExprNode] = expressions class LetNode(ExprNode): def __init__(self, declarations, expr): - self.expr = expr - self.declarations = declarations + self.declarations: List[VarDeclarationNode] = declarations + self.expr: ExprNode = expr class SwitchCaseNode(ExprNode): def __init__(self, expr, cases): - self.expr = expr - self.cases = cases + self.expr: ExprNode = expr + self.cases: List[CaseNode] = cases class CaseNode(ExprNode): def __init__(self, idx, typex, expr): - self.id = idx - self.type = typex - self.expr = expr + self.id: str = idx + self.type: str = typex + self.expr: ExprNode = expr class VarDeclarationNode(ExprNode): def __init__(self, idx, typex, expr=None): - self.id = idx - self.type = typex - self.expr = expr + self.id: str = idx + self.type: str = typex + self.expr: ExprNode = expr class AssignNode(ExprNode): def __init__(self, idx, expr): - self.id = idx - self.expr = expr + self.id: str = idx + self.expr: ExprNode = expr class ConditionalNode(ExprNode): def __init__(self, ifx, then, elsex): - self.if_expr = ifx - self.then_expr = then - self.else_expr = elsex + self.if_expr: ExprNode = ifx + self.then_expr: ExprNode = then + self.else_expr: ExprNode = elsex class WhileNode(ExprNode): def __init__(self, condition, body): - self.condition = condition - self.body = body + self.condition: ExprNode = condition + self.body: ExprNode = body class MethodCallNode(ExprNode): def __init__(self, idx, args, obj=None, typex=None): - self.obj = obj - self.id = idx - self.args = args - self.type = typex + self.obj: ExprNode = obj + self.id: str = idx + self.args: List[ExprNode] = args + self.type: str = typex class AtomicNode(ExprNode): def __init__(self, lex): - self.lex = lex + self.lex: str = lex class UnaryNode(ExprNode): def __init__(self, obj): - self.obj = obj + self.obj: ExprNode = obj class BinaryNode(ExprNode): def __init__(self, left, right): - self.left = left - self.right = right + self.left: ExprNode = left + self.right: ExprNode = right class VariableNode(AtomicNode): diff --git a/grammar.py b/grammar.py index 9939f880d..4ad37d9ff 100644 --- a/grammar.py +++ b/grammar.py @@ -171,12 +171,18 @@ def lexical_error(lexer): G.add_terminal_error() -@G.production("attribute -> id : type error") +@G.production("feature-list -> attribute error feature-list") def attribute_error(s): s.error(f"{s[3].line, s[3].column} - SyntacticError: Expected ';' instead of '{s[3].lex}'") return ast.AttrDeclarationNode(s[1], s[3]) +@G.production("feature-list -> method error feature-list") +def attribute_error(s): + s.error(f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") + return s[1] + + print('Build G :', time.time() - t) if __name__ == '__main__': diff --git a/main.py b/main.py new file mode 100644 index 000000000..8f4d49272 --- /dev/null +++ b/main.py @@ -0,0 +1,34 @@ +from lexer import CoolLexer +from parser import CoolParser +from scope import Context +from semantic import TypeCollector, TypeBuilder, TypeChecker, InferenceTypeChecker, Executor + +program = """ +class Main { + main ( msg : String ) : Void { + let a: Int <- 25, b: Int <- 15 in { + a + +; + } + }; +} +""" + +lexer = CoolLexer() +parser = CoolParser() + +if __name__ == '__main__': + tokens = lexer(program) + ast = parser(tokens) + + context = Context() + errors = [] + + TypeCollector(context, errors).visit(ast) + TypeBuilder(context, errors).visit(ast) + scope = TypeChecker(context, errors).visit(ast) + InferenceTypeChecker(context, errors).visit(ast, scope) + Executor(context, errors).visit(ast, scope) + + for error in errors: + print(error) + print("Done!") diff --git a/scope.py b/scope.py index d097c9d2a..5c70e55d1 100644 --- a/scope.py +++ b/scope.py @@ -213,8 +213,8 @@ def define_variable(self, vname: str, vtype: Type) -> VariableInfo: def find_variable(self, vname: str) -> Optional[VariableInfo]: try: return self.locals[vname] - except StopIteration: - return self.parent.find_variable(vname, self.index) if self.parent is None else None + except KeyError: + return self.parent.find_variable(vname) if self.parent is not None else None def is_defined(self, vname) -> bool: return self.find_variable(vname) is not None diff --git a/semantic.py b/semantic.py index 8aa4e58b4..00bea3189 100644 --- a/semantic.py +++ b/semantic.py @@ -1,14 +1,12 @@ -""" -This module contains definitions of classes for make different travels through the AST of a cool program. -All classes defined here follows the visitor pattern using the module cmp.visitor, with this we can get a -more decoupled inspection. -""" -from typing import List +"""This module contains definitions of classes for make different travels through the AST of a cool program. All +classes defined here follows the visitor pattern using the module cmp.visitor, with this we can get a more decoupled +inspection. """ +from typing import List, Optional import astnodes as ast import visitor as visitor -from scope import Context, SemanticError +from scope import Context, SemanticError, Type, Scope, Method class Formatter: @@ -129,7 +127,6 @@ def visit(self, node: ast.InstantiateNode, tabs: int = 0): return '\t' * tabs + f'\\__ InstantiateNode: new {node.lex}()' -# noinspection PyDefaultArgument class TypeCollector: def __init__(self, context: Context = Context(), errors: List[str] = []): self.errors: List[str] = errors @@ -142,8 +139,8 @@ def visit(self, node): @visitor.when(ast.ProgramNode) def visit(self, node): self.context = Context() - self.context.create_type('int') - self.context.create_type('void') + self.context.create_type('Int') + self.context.create_type('Void') for declaration in node.declarations: self.visit(declaration) @@ -156,472 +153,420 @@ def visit(self, node): class TypeBuilder: + def __init__(self, context: Context, errors: List[str] = []): + self.context: Context = context + self.current_type: Optional[Type] = None + self.errors: List[str] = errors + @visitor.on('node') - def visit(self, node, tabs): + def visit(self, node): pass @visitor.when(ast.ProgramNode) def visit(self, node: ast.ProgramNode): - pass + for declaration in node.declarations: + self.visit(declaration) @visitor.when(ast.ClassDeclarationNode) def visit(self, node: ast.ClassDeclarationNode): - pass + try: + self.current_type = self.context.get_type(node.id) + if node.parent is not None: + self.current_type.set_parent(self.context.get_type(node.parent)) + except SemanticError as e: + self.errors.append(e.text) + + for feature in node.features: + self.visit(feature) @visitor.when(ast.AttrDeclarationNode) def visit(self, node: ast.AttrDeclarationNode): - pass + try: + name = node.id + typex = self.context.get_type(node.type) + self.current_type.define_attribute(name, typex) + except SemanticError as e: + self.errors.append(e.text) @visitor.when(ast.MethodDeclarationNode) def visit(self, node: ast.MethodDeclarationNode): - pass - - @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode): - pass - - @visitor.when(ast.VarDeclarationNode) - def visit(self, node: ast.VarDeclarationNode): - pass - - @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode): - pass - - @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode): - pass - - @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode): - pass - - @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode): - pass - - @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode): - pass - - @visitor.when(ast.CaseNode) - def visit(self, node: ast.CaseNode): - pass - - @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode): - pass - - @visitor.when(ast.IntegerNode) - def visit(self, node: ast.IntegerNode): - pass - - @visitor.when(ast.StringNode) - def visit(self, node: ast.StringNode): - pass - - @visitor.when(ast.BooleanNode) - def visit(self, node: ast.BooleanNode): - pass - - @visitor.when(ast.VariableNode) - def visit(self, node: ast.VariableNode): - pass - - @visitor.when(ast.InstantiateNode) - def visit(self, node: ast.InstantiateNode): - pass - - @visitor.when(ast.NegationNode) - def visit(self, node: ast.NegationNode): - pass - - @visitor.when(ast.ComplementNode) - def visit(self, node: ast.ComplementNode): - pass - - @visitor.when(ast.IsVoidNode) - def visit(self, node: ast.IsVoidNode): - pass - - @visitor.when(ast.PlusNode) - def visit(self, node: ast.PlusNode): - pass - - @visitor.when(ast.MinusNode) - def visit(self, node: ast.MinusNode): - pass - - @visitor.when(ast.StarNode) - def visit(self, node: ast.StarNode): - pass - - @visitor.when(ast.DivNode) - def visit(self, node: ast.DivNode): - pass - - @visitor.when(ast.LessEqualNode) - def visit(self, node: ast.LessEqualNode): - pass - - @visitor.when(ast.LessNode) - def visit(self, node: ast.LessNode): - pass - - @visitor.when(ast.EqualNode) - def visit(self, node: ast.EqualNode): - pass + try: + name = node.id + param_names = [p[0] for p in node.params] + param_types = [self.context.get_type(p[1]) for p in node.params] + return_type = self.context.get_type(node.type) + self.current_type.define_method(name, param_names, param_types, return_type) + except SemanticError as e: + self.errors.append(e.text) class TypeChecker: + def __init__(self, context: Context, errors: List[str] = []): + self.context: Context = context + self.errors: List[str] = errors + self.current_type: Type = None + self.current_method: Method = None + @visitor.on('node') def visit(self, node, tabs): pass @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode): + def visit(self, node: ast.ProgramNode, scope: Scope = None): pass @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode): + def visit(self, node: ast.ClassDeclarationNode, scope: Scope): pass @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode): + def visit(self, node: ast.AttrDeclarationNode, scope: Scope): pass @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode): + def visit(self, node: ast.MethodDeclarationNode, scope: Scope): pass @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode): + def visit(self, node: ast.LetNode, scope: Scope): pass @visitor.when(ast.VarDeclarationNode) - def visit(self, node: ast.VarDeclarationNode): + def visit(self, node: ast.VarDeclarationNode, scope: Scope): pass @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode): + def visit(self, node: ast.AssignNode, scope: Scope): pass @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode): + def visit(self, node: ast.BlockNode, scope: Scope): pass @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode): + def visit(self, node: ast.ConditionalNode, scope: Scope): pass @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode): + def visit(self, node: ast.WhileNode, scope: Scope): pass @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode): + def visit(self, node: ast.SwitchCaseNode, scope: Scope): pass @visitor.when(ast.CaseNode) - def visit(self, node: ast.CaseNode): + def visit(self, node: ast.CaseNode, scope: Scope): pass @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode): + def visit(self, node: ast.MethodCallNode, scope: Scope): pass @visitor.when(ast.IntegerNode) - def visit(self, node: ast.IntegerNode): + def visit(self, node: ast.IntegerNode, scope: Scope): pass @visitor.when(ast.StringNode) - def visit(self, node: ast.StringNode): + def visit(self, node: ast.StringNode, scope: Scope): pass @visitor.when(ast.BooleanNode) - def visit(self, node: ast.BooleanNode): + def visit(self, node: ast.BooleanNode, scope: Scope): pass @visitor.when(ast.VariableNode) - def visit(self, node: ast.VariableNode): + def visit(self, node: ast.VariableNode, scope: Scope): pass @visitor.when(ast.InstantiateNode) - def visit(self, node: ast.InstantiateNode): + def visit(self, node: ast.InstantiateNode, scope: Scope): pass @visitor.when(ast.NegationNode) - def visit(self, node: ast.NegationNode): + def visit(self, node: ast.NegationNode, scope: Scope): pass @visitor.when(ast.ComplementNode) - def visit(self, node: ast.ComplementNode): + def visit(self, node: ast.ComplementNode, scope: Scope): pass @visitor.when(ast.IsVoidNode) - def visit(self, node: ast.IsVoidNode): + def visit(self, node: ast.IsVoidNode, scope: Scope): pass @visitor.when(ast.PlusNode) - def visit(self, node: ast.PlusNode): + def visit(self, node: ast.PlusNode, scope: Scope): pass @visitor.when(ast.MinusNode) - def visit(self, node: ast.MinusNode): + def visit(self, node: ast.MinusNode, scope: Scope): pass @visitor.when(ast.StarNode) - def visit(self, node: ast.StarNode): + def visit(self, node: ast.StarNode, scope: Scope): pass @visitor.when(ast.DivNode) - def visit(self, node: ast.DivNode): + def visit(self, node: ast.DivNode, scope: Scope): pass @visitor.when(ast.LessEqualNode) - def visit(self, node: ast.LessEqualNode): + def visit(self, node: ast.LessEqualNode, scope: Scope): pass @visitor.when(ast.LessNode) - def visit(self, node: ast.LessNode): + def visit(self, node: ast.LessNode, scope: Scope): pass @visitor.when(ast.EqualNode) - def visit(self, node: ast.EqualNode): + def visit(self, node: ast.EqualNode, scope: Scope): pass class InferenceTypeChecker: + def __init__(self, context: Context, errors: List[str] = []): + self.context: Context = context + self.errors: List[str] = errors + self.current_type: Type = None + self.current_method: Method = None + @visitor.on('node') def visit(self, node, tabs): pass @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode): + def visit(self, node: ast.ProgramNode, scope: Scope = None): pass @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode): + def visit(self, node: ast.ClassDeclarationNode, scope: Scope): pass @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode): + def visit(self, node: ast.AttrDeclarationNode, scope: Scope): pass @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode): + def visit(self, node: ast.MethodDeclarationNode, scope: Scope): pass @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode): + def visit(self, node: ast.LetNode, scope: Scope): pass @visitor.when(ast.VarDeclarationNode) - def visit(self, node: ast.VarDeclarationNode): + def visit(self, node: ast.VarDeclarationNode, scope: Scope): pass @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode): + def visit(self, node: ast.AssignNode, scope: Scope): pass @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode): + def visit(self, node: ast.BlockNode, scope: Scope): pass @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode): + def visit(self, node: ast.ConditionalNode, scope: Scope): pass @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode): + def visit(self, node: ast.WhileNode, scope: Scope): pass @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode): + def visit(self, node: ast.SwitchCaseNode, scope: Scope): pass @visitor.when(ast.CaseNode) - def visit(self, node: ast.CaseNode): + def visit(self, node: ast.CaseNode, scope: Scope): pass @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode): + def visit(self, node: ast.MethodCallNode, scope: Scope): pass @visitor.when(ast.IntegerNode) - def visit(self, node: ast.IntegerNode): + def visit(self, node: ast.IntegerNode, scope: Scope): pass @visitor.when(ast.StringNode) - def visit(self, node: ast.StringNode): + def visit(self, node: ast.StringNode, scope: Scope): pass @visitor.when(ast.BooleanNode) - def visit(self, node: ast.BooleanNode): + def visit(self, node: ast.BooleanNode, scope: Scope): pass @visitor.when(ast.VariableNode) - def visit(self, node: ast.VariableNode): + def visit(self, node: ast.VariableNode, scope: Scope): pass @visitor.when(ast.InstantiateNode) - def visit(self, node: ast.InstantiateNode): + def visit(self, node: ast.InstantiateNode, scope: Scope): pass @visitor.when(ast.NegationNode) - def visit(self, node: ast.NegationNode): + def visit(self, node: ast.NegationNode, scope: Scope): pass @visitor.when(ast.ComplementNode) - def visit(self, node: ast.ComplementNode): + def visit(self, node: ast.ComplementNode, scope: Scope): pass @visitor.when(ast.IsVoidNode) - def visit(self, node: ast.IsVoidNode): + def visit(self, node: ast.IsVoidNode, scope: Scope): pass @visitor.when(ast.PlusNode) - def visit(self, node: ast.PlusNode): + def visit(self, node: ast.PlusNode, scope: Scope): pass @visitor.when(ast.MinusNode) - def visit(self, node: ast.MinusNode): + def visit(self, node: ast.MinusNode, scope: Scope): pass @visitor.when(ast.StarNode) - def visit(self, node: ast.StarNode): + def visit(self, node: ast.StarNode, scope: Scope): pass @visitor.when(ast.DivNode) - def visit(self, node: ast.DivNode): + def visit(self, node: ast.DivNode, scope: Scope): pass @visitor.when(ast.LessEqualNode) - def visit(self, node: ast.LessEqualNode): + def visit(self, node: ast.LessEqualNode, scope: Scope): pass @visitor.when(ast.LessNode) - def visit(self, node: ast.LessNode): + def visit(self, node: ast.LessNode, scope: Scope): pass @visitor.when(ast.EqualNode) - def visit(self, node: ast.EqualNode): + def visit(self, node: ast.EqualNode, scope: Scope): pass -class SemanticChecker: +class Executor: + def __init__(self, context: Context, errors: List[str] = []): + self.context: Context = context + self.errors: List[str] = errors + self.current_type: Type = None + self.current_method: Method = None + @visitor.on('node') def visit(self, node, tabs): pass @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode): + def visit(self, node: ast.ProgramNode, scope: Scope = None): pass @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode): + def visit(self, node: ast.ClassDeclarationNode, scope: Scope): pass @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode): + def visit(self, node: ast.AttrDeclarationNode, scope: Scope): pass @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode): + def visit(self, node: ast.MethodDeclarationNode, scope: Scope): pass @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode): + def visit(self, node: ast.LetNode, scope: Scope): pass @visitor.when(ast.VarDeclarationNode) - def visit(self, node: ast.VarDeclarationNode): + def visit(self, node: ast.VarDeclarationNode, scope: Scope): pass @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode): + def visit(self, node: ast.AssignNode, scope: Scope): pass @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode): + def visit(self, node: ast.BlockNode, scope: Scope): pass @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode): + def visit(self, node: ast.ConditionalNode, scope: Scope): pass @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode): + def visit(self, node: ast.WhileNode, scope: Scope): pass @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode): + def visit(self, node: ast.SwitchCaseNode, scope: Scope): pass @visitor.when(ast.CaseNode) - def visit(self, node: ast.CaseNode): + def visit(self, node: ast.CaseNode, scope: Scope): pass @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode): + def visit(self, node: ast.MethodCallNode, scope: Scope): pass @visitor.when(ast.IntegerNode) - def visit(self, node: ast.IntegerNode): + def visit(self, node: ast.IntegerNode, scope: Scope): pass @visitor.when(ast.StringNode) - def visit(self, node: ast.StringNode): + def visit(self, node: ast.StringNode, scope: Scope): pass @visitor.when(ast.BooleanNode) - def visit(self, node: ast.BooleanNode): + def visit(self, node: ast.BooleanNode, scope: Scope): pass @visitor.when(ast.VariableNode) - def visit(self, node: ast.VariableNode): + def visit(self, node: ast.VariableNode, scope: Scope): pass @visitor.when(ast.InstantiateNode) - def visit(self, node: ast.InstantiateNode): + def visit(self, node: ast.InstantiateNode, scope: Scope): pass @visitor.when(ast.NegationNode) - def visit(self, node: ast.NegationNode): + def visit(self, node: ast.NegationNode, scope: Scope): pass @visitor.when(ast.ComplementNode) - def visit(self, node: ast.ComplementNode): + def visit(self, node: ast.ComplementNode, scope: Scope): pass @visitor.when(ast.IsVoidNode) - def visit(self, node: ast.IsVoidNode): + def visit(self, node: ast.IsVoidNode, scope: Scope): pass @visitor.when(ast.PlusNode) - def visit(self, node: ast.PlusNode): + def visit(self, node: ast.PlusNode, scope: Scope): pass @visitor.when(ast.MinusNode) - def visit(self, node: ast.MinusNode): + def visit(self, node: ast.MinusNode, scope: Scope): pass @visitor.when(ast.StarNode) - def visit(self, node: ast.StarNode): + def visit(self, node: ast.StarNode, scope: Scope): pass @visitor.when(ast.DivNode) - def visit(self, node: ast.DivNode): + def visit(self, node: ast.DivNode, scope: Scope): pass @visitor.when(ast.LessEqualNode) - def visit(self, node: ast.LessEqualNode): + def visit(self, node: ast.LessEqualNode, scope: Scope): pass @visitor.when(ast.LessNode) - def visit(self, node: ast.LessNode): + def visit(self, node: ast.LessNode, scope: Scope): pass @visitor.when(ast.EqualNode) - def visit(self, node: ast.EqualNode): + def visit(self, node: ast.EqualNode, scope: Scope): pass From 4c3221bf8cc7601a3166659c6c7a23e69eb315d8 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Sat, 25 Apr 2020 18:25:20 -0400 Subject: [PATCH 018/143] Added examples in tests folder --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 4b22d3092..aa556c4f6 100644 --- a/.gitignore +++ b/.gitignore @@ -125,7 +125,9 @@ dmypy.json .idea .vscode -tests +tests/*.py +tests/*/*.py +tests/codegen scripts Sera borrado Untitled.ipynb Sera borrado output.txt From ccdcc7bc53a5138f34aee571aab3f4f4f5a37a76 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Sat, 25 Apr 2020 18:40:10 -0400 Subject: [PATCH 019/143] Added examples in tests folder --- tests/codegen/arith.cl | 430 --------------------------- tests/codegen/atoi.cl | 121 -------- tests/codegen/atoi2.cl | 92 ------ tests/codegen/book_list.cl | 132 --------- tests/codegen/cells.cl | 97 ------- tests/codegen/complex.cl | 52 ---- tests/codegen/fib.cl | 29 -- tests/codegen/graph.cl | 381 ------------------------ tests/codegen/hairyscary.cl | 67 ----- tests/codegen/hello_world.cl | 5 - tests/codegen/helloworld.cl | 6 - tests/codegen/io.cl | 103 ------- tests/codegen/life.cl | 436 ---------------------------- tests/codegen/list.cl | 141 --------- tests/codegen/new_complex.cl | 79 ----- tests/codegen/palindrome.cl | 25 -- tests/codegen/primes.cl | 84 ------ tests/codegen/print-cool.cl | 9 - tests/codegen/sort-list.cl | 146 ---------- tests/codegen/test.cl | 19 -- tests/codegen_test.py | 15 - tests/conftest.py | 7 - tests/lexer/comment1.cl | 55 ---- tests/lexer/comment1_error.txt | 1 - tests/lexer/iis1.cl | 111 ------- tests/lexer/iis1_error.txt | 1 - tests/lexer/iis2.cl | 120 -------- tests/lexer/iis2_error.txt | 1 - tests/lexer/iis3.cl | 121 -------- tests/lexer/iis3_error.txt | 1 - tests/lexer/iis4.cl | 120 -------- tests/lexer/iis4_error.txt | 1 - tests/lexer/iis5.cl | 121 -------- tests/lexer/iis5_error.txt | 2 - tests/lexer/iis6.cl | 125 -------- tests/lexer/iis6_error.txt | 1 - tests/lexer/mixed1.cl | 14 - tests/lexer/mixed1_error.txt | 1 - tests/lexer/mixed2.cl | 20 -- tests/lexer/mixed2_error.txt | 3 - tests/lexer/string1.cl | 6 - tests/lexer/string1_error.txt | 2 - tests/lexer/string2.cl | 19 -- tests/lexer/string2_error.txt | 1 - tests/lexer/string3.cl | Bin 234 -> 0 bytes tests/lexer/string3_error.txt | 1 - tests/lexer/string4.cl | 38 --- tests/lexer/string4_error.txt | 3 - tests/lexer_test.py | 14 - tests/parser/assignment1.cl | 37 --- tests/parser/assignment1_error.txt | 1 - tests/parser/assignment2.cl | 37 --- tests/parser/assignment2_error.txt | 1 - tests/parser/assignment3.cl | 37 --- tests/parser/assignment3_error.txt | 1 - tests/parser/attribute1.cl | 34 --- tests/parser/attribute1_error.txt | 1 - tests/parser/attribute2.cl | 34 --- tests/parser/attribute2_error.txt | 1 - tests/parser/attribute3.cl | 34 --- tests/parser/attribute3_error.txt | 1 - tests/parser/block1.cl | 87 ------ tests/parser/block1_error.txt | 1 - tests/parser/block2.cl | 87 ------ tests/parser/block2_error.txt | 1 - tests/parser/block3.cl | 87 ------ tests/parser/block3_error.txt | 1 - tests/parser/block4.cl | 88 ------ tests/parser/block4_error.txt | 1 - tests/parser/case1.cl | 91 ------ tests/parser/case1_error.txt | 1 - tests/parser/case2.cl | 93 ------ tests/parser/case2_error.txt | 1 - tests/parser/case3.cl | 93 ------ tests/parser/case3_error.txt | 1 - tests/parser/case4.cl | 93 ------ tests/parser/case4_error.txt | 1 - tests/parser/case5.cl | 93 ------ tests/parser/case5_error.txt | 1 - tests/parser/case6.cl | 93 ------ tests/parser/case6_error.txt | 1 - tests/parser/class1.cl | 20 -- tests/parser/class1_error.txt | 1 - tests/parser/class2.cl | 20 -- tests/parser/class2_error.txt | 1 - tests/parser/class3.cl | 34 --- tests/parser/class3_error.txt | 1 - tests/parser/class4.cl | 36 --- tests/parser/class4_error.txt | 1 - tests/parser/class5.cl | 34 --- tests/parser/class5_error.txt | 1 - tests/parser/class6.cl | 34 --- tests/parser/class6_error.txt | 1 - tests/parser/conditional1.cl | 69 ----- tests/parser/conditional1_error.txt | 1 - tests/parser/conditional2.cl | 69 ----- tests/parser/conditional2_error.txt | 1 - tests/parser/conditional3.cl | 69 ----- tests/parser/conditional3_error.txt | 1 - tests/parser/conditional4.cl | 73 ----- tests/parser/conditional4_error.txt | 1 - tests/parser/conditional5.cl | 73 ----- tests/parser/conditional5_error.txt | 1 - tests/parser/conditional6.cl | 73 ----- tests/parser/conditional6_error.txt | 1 - tests/parser/dispatch1.cl | 45 --- tests/parser/dispatch1_error.txt | 1 - tests/parser/dispatch2.cl | 45 --- tests/parser/dispatch2_error.txt | 1 - tests/parser/dispatch3.cl | 45 --- tests/parser/dispatch3_error.txt | 1 - tests/parser/dispatch4.cl | 53 ---- tests/parser/dispatch4_error.txt | 1 - tests/parser/dispatch5.cl | 53 ---- tests/parser/dispatch5_error.txt | 1 - tests/parser/dispatch6.cl | 57 ---- tests/parser/dispatch6_error.txt | 1 - tests/parser/dispatch7.cl | 57 ---- tests/parser/dispatch7_error.txt | 1 - tests/parser/dispatch8.cl | 57 ---- tests/parser/dispatch8_error.txt | 1 - tests/parser/dispatch9.cl | 61 ---- tests/parser/dispatch9_error.txt | 1 - tests/parser/let1.cl | 85 ------ tests/parser/let1_error.txt | 1 - tests/parser/let2.cl | 85 ------ tests/parser/let2_error.txt | 1 - tests/parser/let3.cl | 85 ------ tests/parser/let3_error.txt | 1 - tests/parser/let4.cl | 85 ------ tests/parser/let4_error.txt | 1 - tests/parser/let5.cl | 85 ------ tests/parser/let5_error.txt | 1 - tests/parser/let6.cl | 74 ----- tests/parser/let6_error.txt | 1 - tests/parser/let7.cl | 85 ------ tests/parser/let7_error.txt | 1 - tests/parser/loop1.cl | 78 ----- tests/parser/loop1_error.txt | 1 - tests/parser/loop2.cl | 78 ----- tests/parser/loop2_error.txt | 1 - tests/parser/loop3.cl | 78 ----- tests/parser/loop3_error.txt | 1 - tests/parser/loop4.cl | 78 ----- tests/parser/loop4_error.txt | 1 - tests/parser/method1.cl | 34 --- tests/parser/method1_error.txt | 1 - tests/parser/method2.cl | 34 --- tests/parser/method2_error.txt | 1 - tests/parser/method3.cl | 34 --- tests/parser/method3_error.txt | 1 - tests/parser/method4.cl | 34 --- tests/parser/method4_error.txt | 1 - tests/parser/method5.cl | 34 --- tests/parser/method5_error.txt | 1 - tests/parser/method6.cl | 33 --- tests/parser/method6_error.txt | 1 - tests/parser/mixed1.cl | 100 ------- tests/parser/mixed1_error.txt | 1 - tests/parser/mixed2.cl | 14 - tests/parser/mixed2_error.txt | 1 - tests/parser/mixed3.cl | 40 --- tests/parser/mixed3_error.txt | 1 - tests/parser/mixed4.cl | 21 -- tests/parser/mixed4_error.txt | 1 - tests/parser/mixed5.cl | 20 -- tests/parser/mixed5_error.txt | 1 - tests/parser/mixed6.cl | 5 - tests/parser/mixed6_error.txt | 1 - tests/parser/operation1.cl | 101 ------- tests/parser/operation1_error.txt | 1 - tests/parser/operation2.cl | 101 ------- tests/parser/operation2_error.txt | 1 - tests/parser/operation3.cl | 101 ------- tests/parser/operation3_error.txt | 1 - tests/parser/operation4.cl | 101 ------- tests/parser/operation4_error.txt | 1 - tests/parser/program1.cl | 1 - tests/parser/program1_error.txt | 1 - tests/parser/program2.cl | 20 -- tests/parser/program2_error.txt | 1 - tests/parser/program3.cl | 24 -- tests/parser/program3_error.txt | 1 - tests/parser_test.py | 14 - tests/semantic/hello_world.cl | 5 - tests/semantic_test.py | 14 - tests/utils/__init__.py | 1 - tests/utils/utils.py | 56 ---- 188 files changed, 7479 deletions(-) delete mode 100755 tests/codegen/arith.cl delete mode 100644 tests/codegen/atoi.cl delete mode 100644 tests/codegen/atoi2.cl delete mode 100755 tests/codegen/book_list.cl delete mode 100755 tests/codegen/cells.cl delete mode 100755 tests/codegen/complex.cl delete mode 100644 tests/codegen/fib.cl delete mode 100755 tests/codegen/graph.cl delete mode 100755 tests/codegen/hairyscary.cl delete mode 100755 tests/codegen/hello_world.cl delete mode 100644 tests/codegen/helloworld.cl delete mode 100755 tests/codegen/io.cl delete mode 100755 tests/codegen/life.cl delete mode 100644 tests/codegen/list.cl delete mode 100755 tests/codegen/new_complex.cl delete mode 100755 tests/codegen/palindrome.cl delete mode 100644 tests/codegen/primes.cl delete mode 100644 tests/codegen/print-cool.cl delete mode 100644 tests/codegen/sort-list.cl delete mode 100755 tests/codegen/test.cl delete mode 100644 tests/codegen_test.py delete mode 100644 tests/conftest.py delete mode 100644 tests/lexer/comment1.cl delete mode 100644 tests/lexer/comment1_error.txt delete mode 100644 tests/lexer/iis1.cl delete mode 100644 tests/lexer/iis1_error.txt delete mode 100644 tests/lexer/iis2.cl delete mode 100644 tests/lexer/iis2_error.txt delete mode 100644 tests/lexer/iis3.cl delete mode 100644 tests/lexer/iis3_error.txt delete mode 100644 tests/lexer/iis4.cl delete mode 100644 tests/lexer/iis4_error.txt delete mode 100644 tests/lexer/iis5.cl delete mode 100644 tests/lexer/iis5_error.txt delete mode 100644 tests/lexer/iis6.cl delete mode 100644 tests/lexer/iis6_error.txt delete mode 100644 tests/lexer/mixed1.cl delete mode 100644 tests/lexer/mixed1_error.txt delete mode 100644 tests/lexer/mixed2.cl delete mode 100644 tests/lexer/mixed2_error.txt delete mode 100644 tests/lexer/string1.cl delete mode 100644 tests/lexer/string1_error.txt delete mode 100644 tests/lexer/string2.cl delete mode 100644 tests/lexer/string2_error.txt delete mode 100644 tests/lexer/string3.cl delete mode 100644 tests/lexer/string3_error.txt delete mode 100644 tests/lexer/string4.cl delete mode 100644 tests/lexer/string4_error.txt delete mode 100644 tests/lexer_test.py delete mode 100644 tests/parser/assignment1.cl delete mode 100644 tests/parser/assignment1_error.txt delete mode 100644 tests/parser/assignment2.cl delete mode 100644 tests/parser/assignment2_error.txt delete mode 100644 tests/parser/assignment3.cl delete mode 100644 tests/parser/assignment3_error.txt delete mode 100644 tests/parser/attribute1.cl delete mode 100644 tests/parser/attribute1_error.txt delete mode 100644 tests/parser/attribute2.cl delete mode 100644 tests/parser/attribute2_error.txt delete mode 100644 tests/parser/attribute3.cl delete mode 100644 tests/parser/attribute3_error.txt delete mode 100644 tests/parser/block1.cl delete mode 100644 tests/parser/block1_error.txt delete mode 100644 tests/parser/block2.cl delete mode 100644 tests/parser/block2_error.txt delete mode 100644 tests/parser/block3.cl delete mode 100644 tests/parser/block3_error.txt delete mode 100644 tests/parser/block4.cl delete mode 100644 tests/parser/block4_error.txt delete mode 100644 tests/parser/case1.cl delete mode 100644 tests/parser/case1_error.txt delete mode 100644 tests/parser/case2.cl delete mode 100644 tests/parser/case2_error.txt delete mode 100644 tests/parser/case3.cl delete mode 100644 tests/parser/case3_error.txt delete mode 100644 tests/parser/case4.cl delete mode 100644 tests/parser/case4_error.txt delete mode 100644 tests/parser/case5.cl delete mode 100644 tests/parser/case5_error.txt delete mode 100644 tests/parser/case6.cl delete mode 100644 tests/parser/case6_error.txt delete mode 100644 tests/parser/class1.cl delete mode 100644 tests/parser/class1_error.txt delete mode 100644 tests/parser/class2.cl delete mode 100644 tests/parser/class2_error.txt delete mode 100644 tests/parser/class3.cl delete mode 100644 tests/parser/class3_error.txt delete mode 100644 tests/parser/class4.cl delete mode 100644 tests/parser/class4_error.txt delete mode 100644 tests/parser/class5.cl delete mode 100644 tests/parser/class5_error.txt delete mode 100644 tests/parser/class6.cl delete mode 100644 tests/parser/class6_error.txt delete mode 100644 tests/parser/conditional1.cl delete mode 100644 tests/parser/conditional1_error.txt delete mode 100644 tests/parser/conditional2.cl delete mode 100644 tests/parser/conditional2_error.txt delete mode 100644 tests/parser/conditional3.cl delete mode 100644 tests/parser/conditional3_error.txt delete mode 100644 tests/parser/conditional4.cl delete mode 100644 tests/parser/conditional4_error.txt delete mode 100644 tests/parser/conditional5.cl delete mode 100644 tests/parser/conditional5_error.txt delete mode 100644 tests/parser/conditional6.cl delete mode 100644 tests/parser/conditional6_error.txt delete mode 100644 tests/parser/dispatch1.cl delete mode 100644 tests/parser/dispatch1_error.txt delete mode 100644 tests/parser/dispatch2.cl delete mode 100644 tests/parser/dispatch2_error.txt delete mode 100644 tests/parser/dispatch3.cl delete mode 100644 tests/parser/dispatch3_error.txt delete mode 100644 tests/parser/dispatch4.cl delete mode 100644 tests/parser/dispatch4_error.txt delete mode 100644 tests/parser/dispatch5.cl delete mode 100644 tests/parser/dispatch5_error.txt delete mode 100644 tests/parser/dispatch6.cl delete mode 100644 tests/parser/dispatch6_error.txt delete mode 100644 tests/parser/dispatch7.cl delete mode 100644 tests/parser/dispatch7_error.txt delete mode 100644 tests/parser/dispatch8.cl delete mode 100644 tests/parser/dispatch8_error.txt delete mode 100644 tests/parser/dispatch9.cl delete mode 100644 tests/parser/dispatch9_error.txt delete mode 100644 tests/parser/let1.cl delete mode 100644 tests/parser/let1_error.txt delete mode 100644 tests/parser/let2.cl delete mode 100644 tests/parser/let2_error.txt delete mode 100644 tests/parser/let3.cl delete mode 100644 tests/parser/let3_error.txt delete mode 100644 tests/parser/let4.cl delete mode 100644 tests/parser/let4_error.txt delete mode 100644 tests/parser/let5.cl delete mode 100644 tests/parser/let5_error.txt delete mode 100644 tests/parser/let6.cl delete mode 100644 tests/parser/let6_error.txt delete mode 100644 tests/parser/let7.cl delete mode 100644 tests/parser/let7_error.txt delete mode 100644 tests/parser/loop1.cl delete mode 100644 tests/parser/loop1_error.txt delete mode 100644 tests/parser/loop2.cl delete mode 100644 tests/parser/loop2_error.txt delete mode 100644 tests/parser/loop3.cl delete mode 100644 tests/parser/loop3_error.txt delete mode 100644 tests/parser/loop4.cl delete mode 100644 tests/parser/loop4_error.txt delete mode 100644 tests/parser/method1.cl delete mode 100644 tests/parser/method1_error.txt delete mode 100644 tests/parser/method2.cl delete mode 100644 tests/parser/method2_error.txt delete mode 100644 tests/parser/method3.cl delete mode 100644 tests/parser/method3_error.txt delete mode 100644 tests/parser/method4.cl delete mode 100644 tests/parser/method4_error.txt delete mode 100644 tests/parser/method5.cl delete mode 100644 tests/parser/method5_error.txt delete mode 100644 tests/parser/method6.cl delete mode 100644 tests/parser/method6_error.txt delete mode 100644 tests/parser/mixed1.cl delete mode 100644 tests/parser/mixed1_error.txt delete mode 100644 tests/parser/mixed2.cl delete mode 100644 tests/parser/mixed2_error.txt delete mode 100644 tests/parser/mixed3.cl delete mode 100644 tests/parser/mixed3_error.txt delete mode 100644 tests/parser/mixed4.cl delete mode 100644 tests/parser/mixed4_error.txt delete mode 100644 tests/parser/mixed5.cl delete mode 100644 tests/parser/mixed5_error.txt delete mode 100644 tests/parser/mixed6.cl delete mode 100644 tests/parser/mixed6_error.txt delete mode 100644 tests/parser/operation1.cl delete mode 100644 tests/parser/operation1_error.txt delete mode 100644 tests/parser/operation2.cl delete mode 100644 tests/parser/operation2_error.txt delete mode 100644 tests/parser/operation3.cl delete mode 100644 tests/parser/operation3_error.txt delete mode 100644 tests/parser/operation4.cl delete mode 100644 tests/parser/operation4_error.txt delete mode 100644 tests/parser/program1.cl delete mode 100644 tests/parser/program1_error.txt delete mode 100644 tests/parser/program2.cl delete mode 100644 tests/parser/program2_error.txt delete mode 100644 tests/parser/program3.cl delete mode 100644 tests/parser/program3_error.txt delete mode 100644 tests/parser_test.py delete mode 100755 tests/semantic/hello_world.cl delete mode 100644 tests/semantic_test.py delete mode 100644 tests/utils/__init__.py delete mode 100644 tests/utils/utils.py diff --git a/tests/codegen/arith.cl b/tests/codegen/arith.cl deleted file mode 100755 index af5951cf7..000000000 --- a/tests/codegen/arith.cl +++ /dev/null @@ -1,430 +0,0 @@ -(* - * 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/atoi.cl b/tests/codegen/atoi.cl deleted file mode 100644 index fd8b2ea42..000000000 --- a/tests/codegen/atoi.cl +++ /dev/null @@ -1,121 +0,0 @@ -(* - 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 { - main () : Object { - let a : Int <- (new A2I).a2i("678987"), - b : String <- (new A2I).i2a(678987) in - { - out_int(a) ; - out_string(" == ") ; - out_string(b) ; - out_string("\n"); - } - } ; -} ; diff --git a/tests/codegen/atoi2.cl b/tests/codegen/atoi2.cl deleted file mode 100644 index 577aa29fd..000000000 --- a/tests/codegen/atoi2.cl +++ /dev/null @@ -1,92 +0,0 @@ -class JustThere { -- class can have no features. -}; - -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; } -- Here the formal list is optional. - fi fi fi fi fi fi fi fi fi fi - }; - - - 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(); ""; } -- demonstrates an expression block - fi fi fi fi fi fi fi fi fi fi - }; - - 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(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)); -- demonstrates dispatch - i <- i + 1; - } - pool - ) - ); - int; - } - ) - }; - - 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(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 { - main () : Object { - let a : Int <- (new A2I).a2i("678987"), - b : String <- (new A2I).i2a(678987) in -- the let expression. Translated to let a: ... in let b: ... in expr. - { - out_int(a) ; - out_string(" == ") ; - out_string(b) ; - out_string("\n"); - } - } ; -} ; diff --git a/tests/codegen/book_list.cl b/tests/codegen/book_list.cl deleted file mode 100755 index 025ea1695..000000000 --- a/tests/codegen/book_list.cl +++ /dev/null @@ -1,132 +0,0 @@ --- 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/cells.cl b/tests/codegen/cells.cl deleted file mode 100755 index 9fd6741bb..000000000 --- a/tests/codegen/cells.cl +++ /dev/null @@ -1,97 +0,0 @@ -(* 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/complex.cl b/tests/codegen/complex.cl deleted file mode 100755 index 0b7aa44e9..000000000 --- a/tests/codegen/complex.cl +++ /dev/null @@ -1,52 +0,0 @@ -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/fib.cl b/tests/codegen/fib.cl deleted file mode 100644 index 08ceaede8..000000000 --- a/tests/codegen/fib.cl +++ /dev/null @@ -1,29 +0,0 @@ -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/graph.cl b/tests/codegen/graph.cl deleted file mode 100755 index 8e511358c..000000000 --- a/tests/codegen/graph.cl +++ /dev/null @@ -1,381 +0,0 @@ -(* - * 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" }; - -}; - - - - - diff --git a/tests/codegen/hello_world.cl b/tests/codegen/hello_world.cl deleted file mode 100755 index 0c818f908..000000000 --- a/tests/codegen/hello_world.cl +++ /dev/null @@ -1,5 +0,0 @@ -class Main inherits IO { - main(): IO { - out_string("Hello, World.\n") - }; -}; diff --git a/tests/codegen/helloworld.cl b/tests/codegen/helloworld.cl deleted file mode 100644 index 61d421080..000000000 --- a/tests/codegen/helloworld.cl +++ /dev/null @@ -1,6 +0,0 @@ -class Main { - main():IO { - new IO.out_string("Hello world!\n") - }; -}; - diff --git a/tests/codegen/io.cl b/tests/codegen/io.cl deleted file mode 100755 index 7f0de869e..000000000 --- a/tests/codegen/io.cl +++ /dev/null @@ -1,103 +0,0 @@ -(* - * 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/life.cl b/tests/codegen/life.cl deleted file mode 100755 index b83d97957..000000000 --- a/tests/codegen/life.cl +++ /dev/null @@ -1,436 +0,0 @@ -(* 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/list.cl b/tests/codegen/list.cl deleted file mode 100644 index b384dac62..000000000 --- a/tests/codegen/list.cl +++ /dev/null @@ -1,141 +0,0 @@ -(* - * This file shows how to implement a list data type for lists of integers. - * It makes use of INHERITANCE and DYNAMIC DISPATCH. - * - * The List class has 4 operations defined on List objects. If 'l' is - * a list, then the methods dispatched on 'l' have the following effects: - * - * isNil() : Bool Returns true if 'l' is empty, false otherwise. - * head() : Int Returns the integer at the head of 'l'. - * If 'l' is empty, execution aborts. - * tail() : List Returns the remainder of the 'l', - * i.e. without the first element. - * cons(i : Int) : List Return a new list containing i as the - * first element, followed by the - * elements in 'l'. - * - * There are 2 kinds of lists, the empty list and a non-empty - * list. We can think of the non-empty list as a specialization of - * the empty list. - * The class List defines the operations on empty list. The class - * Cons inherits from List and redefines things to handle non-empty - * lists. - *) - - -class List { - -- Define operations on empty lists. - - isNil() : Bool { true }; - - -- Since abort() has return type Object and head() has return type - -- Int, we need to have an Int as the result of the method body, - -- even though abort() never returns. - - head() : Int { { abort(); 0; } }; - - -- As for head(), the self is just to make sure the return type of - -- tail() is correct. - - tail() : List { { abort(); self; } }; - - -- When we cons and element onto the empty list we get a non-empty - -- list. The (new Cons) expression creates a new list cell of class - -- Cons, which is initialized by a dispatch to init(). - -- The result of init() is an element of class Cons, but it - -- conforms to the return type List, because Cons is a subclass of - -- List. - - cons(i : Int) : List { - (new Cons).init(i, self) - }; - -}; - - -(* - * Cons inherits all operations from List. We can reuse only the cons - * method though, because adding an element to the front of an emtpy - * list is the same as adding it to the front of a non empty - * list. All other methods have to be redefined, since the behaviour - * for them is different from the empty list. - * - * Cons needs two attributes to hold the integer of this list - * cell and to hold the rest of the list. - * - * The init() method is used by the cons() method to initialize the - * cell. - *) - -class Cons inherits List { - - car : Int; -- The element in this list cell - - cdr : List; -- The rest of the list - - isNil() : Bool { false }; - - head() : Int { car }; - - tail() : List { cdr }; - - init(i : Int, rest : List) : List { - { - car <- i; - cdr <- rest; - self; - } - }; - -}; - - - -(* - * The Main class shows how to use the List class. It creates a small - * list and then repeatedly prints out its elements and takes off the - * first element of the list. - *) - -class Main inherits IO { - - mylist : List; - - -- Print all elements of the list. Calls itself recursively with - -- the tail of the list, until the end of the list is reached. - - print_list(l : List) : Object { - if l.isNil() then out_string("\n") - else { - out_int(l.head()); - out_string(" "); - print_list(l.tail()); - } - fi - }; - - -- Note how the dynamic dispatch mechanism is responsible to end - -- the while loop. As long as mylist is bound to an object of - -- dynamic type Cons, the dispatch to isNil calls the isNil method of - -- the Cons class, which returns false. However when we reach the - -- end of the list, mylist gets bound to the object that was - -- created by the (new List) expression. This object is of dynamic type - -- List, and thus the method isNil in the List class is called and - -- returns true. - - main() : Object { - { - mylist <- new List.cons(1).cons(2).cons(3).cons(4).cons(5); - while (not mylist.isNil()) loop - { - print_list(mylist); - mylist <- mylist.tail(); - } - pool; - } - }; - -}; - - - diff --git a/tests/codegen/new_complex.cl b/tests/codegen/new_complex.cl deleted file mode 100755 index a4fe714ce..000000000 --- a/tests/codegen/new_complex.cl +++ /dev/null @@ -1,79 +0,0 @@ -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/palindrome.cl b/tests/codegen/palindrome.cl deleted file mode 100755 index 7f24789f9..000000000 --- a/tests/codegen/palindrome.cl +++ /dev/null @@ -1,25 +0,0 @@ -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/primes.cl b/tests/codegen/primes.cl deleted file mode 100644 index 8b9254d58..000000000 --- a/tests/codegen/primes.cl +++ /dev/null @@ -1,84 +0,0 @@ - -(* - * methodless-primes.cl - * - * Designed by Jesse H. Willett, jhw@cory, 11103234, with - * Istvan Siposs, isiposs@cory, 12342921. - * - * This program generates primes in order without using any methods. - * Actually, it does use three methods: those of IO to print out each - * prime, and abort() to halt the program. These methods are incidental, - * however, to the information-processing functionality of the program. We - * could regard the attribute 'out's sequential values as our output, and - * the string "halt" as our terminate signal. - * - * Naturally, using Cool this way is a real waste, basically reducing it - * to assembly without the benefit of compilation. - * - * There could even be a subroutine-like construction, in that different - * code could be in the assign fields of attributes of other classes, - * and it could be executed by calling 'new Sub', but no parameters - * could be passed to the subroutine, and it could only return itself. - * but returning itself would be useless since we couldn't call methods - * and the only operators we have are for Int and Bool, which do nothing - * interesting when we initialize them! - *) - -class Main inherits IO { - - main() : Int { -- main() is an atrophied method so we can parse. - 0 - }; - - out : Int <- -- out is our 'output'. Its values are the primes. - { - out_string("2 is trivially prime.\n"); - 2; - }; - - testee : Int <- out; -- testee is a number to be tested for primeness. - - divisor : Int; -- divisor is a number which may factor testee. - - stop : Int <- 500; -- stop is an arbitrary value limiting testee. - - m : Object <- -- m supplants the main method. - while true loop - { - - testee <- testee + 1; - divisor <- 2; - - while - if testee < divisor * divisor - then false -- can stop if divisor > sqrt(testee). - else if testee - divisor*(testee/divisor) = 0 - then false -- can stop if divisor divides testee. - else true - fi fi - loop - divisor <- divisor + 1 - pool; - - if testee < divisor * divisor -- which reason did we stop for? - then -- testee has no factors less than sqrt(testee). - { - out <- testee; -- we could think of out itself as the output. - out_int(out); - out_string(" is prime.\n"); - } - else -- the loop halted on testee/divisor = 0, testee isn't prime. - 0 -- testee isn't prime, do nothing. - fi; - - if stop <= testee then - "halt".abort() -- we could think of "halt" as SIGTERM. - else - "continue" - fi; - - } - pool; - -}; (* end of Main *) - diff --git a/tests/codegen/print-cool.cl b/tests/codegen/print-cool.cl deleted file mode 100644 index 76194e966..000000000 --- a/tests/codegen/print-cool.cl +++ /dev/null @@ -1,9 +0,0 @@ -class Main inherits IO { - main() : IO { - { - out_string((new Object).type_name().substr(4,1)). - out_string((isvoid self).type_name().substr(1,3)); -- demonstrates the dispatch rules. - out_string("\n"); - } - }; -}; diff --git a/tests/codegen/sort-list.cl b/tests/codegen/sort-list.cl deleted file mode 100644 index 7cf7b20a3..000000000 --- a/tests/codegen/sort-list.cl +++ /dev/null @@ -1,146 +0,0 @@ -(* - This file presents a fairly large example of Cool programming. The -class List defines the names of standard list operations ala Scheme: -car, cdr, cons, isNil, rev, sort, rcons (add an element to the end of -the list), and print_list. In the List class most of these functions -are just stubs that abort if ever called. The classes Nil and Cons -inherit from List and define the same operations, but now as -appropriate to the empty list (for the Nil class) and for cons cells (for -the Cons class). - -The Main class puts all of this code through the following silly -test exercise: - - 1. prompt for a number N - 2. generate a list of numbers 0..N-1 - 3. reverse the list - 4. sort the list - 5. print the sorted list - -Because the sort used is a quadratic space insertion sort, sorting -moderately large lists can be quite slow. -*) - -Class List inherits IO { - (* Since abort() returns Object, we need something of - type Bool at the end of the block to satisfy the typechecker. - This code is unreachable, since abort() halts the program. *) - isNil() : Bool { { abort(); true; } }; - - cons(hd : Int) : 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 Int here to satisfy the typechecker. - This code is, of course, unreachable. - *) - car() : Int { { abort(); new Int; } }; - - cdr() : List { { abort(); new List; } }; - - rev() : List { cdr() }; - - sort() : List { cdr() }; - - insert(i : Int) : List { cdr() }; - - rcons(i : Int) : List { cdr() }; - - print_list() : Object { abort() }; -}; - -Class Cons inherits List { - xcar : Int; -- We keep the car in cdr in attributes. - xcdr : List; - - isNil() : Bool { false }; - - init(hd : Int, tl : List) : Cons { - { - xcar <- hd; - xcdr <- tl; - self; - } - }; - - car() : Int { xcar }; - - cdr() : List { xcdr }; - - rev() : List { (xcdr.rev()).rcons(xcar) }; - - sort() : List { (xcdr.sort()).insert(xcar) }; - - insert(i : Int) : List { - if i < xcar then - (new Cons).init(i,self) - else - (new Cons).init(xcar,xcdr.insert(i)) - fi - }; - - - rcons(i : Int) : List { (new Cons).init(xcar, xcdr.rcons(i)) }; - - print_list() : Object { - { - out_int(xcar); - out_string("\n"); - xcdr.print_list(); - } - }; -}; - -Class Nil inherits List { - isNil() : Bool { true }; - - rev() : List { self }; - - sort() : List { self }; - - insert(i : Int) : List { rcons(i) }; - - rcons(i : Int) : List { (new Cons).init(i,self) }; - - print_list() : Object { true }; - -}; - - -Class Main inherits IO { - - l : List; - - (* iota maps its integer argument n into the list 0..n-1 *) - iota(i : Int) : List { - { - l <- new Nil; - (let j : Int <- 0 in - while j < i - loop - { - l <- (new Cons).init(j,l); - j <- j + 1; - } - pool - ); - l; - } - }; - - main() : Object { - { - out_string("How many numbers to sort? "); - iota(in_int()).rev().sort().print_list(); - } - }; -}; - - - - - diff --git a/tests/codegen/test.cl b/tests/codegen/test.cl deleted file mode 100755 index 9c2e0fd8d..000000000 --- a/tests/codegen/test.cl +++ /dev/null @@ -1,19 +0,0 @@ -class Main inherits IO { - - main () : Object { - { - let x:A <- new B in out_string( x.f().m() ); - let x:A <- new A in out_string( x.f().m() ); - } - - }; -}; - -class A { - m () : String { "A" }; - f () : A { new A }; -}; - -class B inherits A { - m () : String { "B" }; -}; diff --git a/tests/codegen_test.py b/tests/codegen_test.py deleted file mode 100644 index b6099c030..000000000 --- a/tests/codegen_test.py +++ /dev/null @@ -1,15 +0,0 @@ -import pytest -import os -from .utils import compare_errors - -tests_dir = __file__.rpartition('/')[0] + '/codegen/' -tests = [file for file in os.listdir(tests_dir) if file.endswith('.cl')] - -# @pytest.mark.lexer -# @pytest.mark.parser -# @pytest.mark.semantic -@pytest.mark.ok -@pytest.mark.run(order=4) -@pytest.mark.parametrize("cool_file", tests) -def test_codegen(compiler_path, cool_file): - compare_errors(compiler_path, tests_dir + cool_file, None) \ No newline at end of file diff --git a/tests/conftest.py b/tests/conftest.py deleted file mode 100644 index 151114848..000000000 --- a/tests/conftest.py +++ /dev/null @@ -1,7 +0,0 @@ -import pytest -import os - - -@pytest.fixture -def compiler_path(): - return os.path.abspath('./coolc.sh') diff --git a/tests/lexer/comment1.cl b/tests/lexer/comment1.cl deleted file mode 100644 index 69533f23c..000000000 --- a/tests/lexer/comment1.cl +++ /dev/null @@ -1,55 +0,0 @@ ---Any characters between two dashes “--” and the next newline ---(or EOF, if there is no next newline) are treated as comments - -(*(*(* -Comments may also be written by enclosing -text in (∗ . . . ∗). The latter form of comment may be nested. -Comments cannot cross file boundaries. -*)*)*) - -class Error() { - - (* There was once a comment, - that was quite long. - But, the reader soon discovered that - the comment was indeed longer than - previously assumed. Now, the reader - was in a real dilemma; is the comment - ever gonna end? If I stop reading, will - it end? - He started imagining all sorts of things. - He thought about heisenberg's cat and how - how that relates to the end of the sentence. - He thought to himself "I'm gonna stop reading". - "If I keep reading this comment, I'm gonna know - the fate of this sentence; That will be disastorous." - He knew that such a comment was gonna extend to - another file. It was too awesome to be contained in - a single file. And he would have kept reading too... - if only... - cool wasn't a super-duper-fab-awesomest language; - but cool is that language; - "This comment shall go not cross this file" said cool. - Alas! The reader could read no more. - There was once a comment, - that was quite long. - But, the reader soon discovered that - the comment was indeed longer than - previously assumed. Now, the reader - was in a real dilemma; is the comment - ever gonna end? If I stop reading, will - it end? - He started imagining all sorts of things. - He thought about heisenberg's cat and how - how that relates to the end of the sentence. - He thought to himself "I'm gonna stop reading". - "If I keep reading this comment, I'm gonna know - the fate of this sentence; That will be disastorous." - He knew that such a comment was gonna extend to - another file. It was too awesome to be contained in - a single file. And he would have kept reading too... - if only... - cool wasn't a super-duper-fab-awesomest language; - but cool is that language; - "This comment shall go not cross this file" said cool. - Alas! The reader could read no more. \ No newline at end of file diff --git a/tests/lexer/comment1_error.txt b/tests/lexer/comment1_error.txt deleted file mode 100644 index 9fd7b8d67..000000000 --- a/tests/lexer/comment1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(55, 46) - LexicographicError: EOF in comment diff --git a/tests/lexer/iis1.cl b/tests/lexer/iis1.cl deleted file mode 100644 index 12cb52beb..000000000 --- a/tests/lexer/iis1.cl +++ /dev/null @@ -1,111 +0,0 @@ -(* Integers, Identifiers, and Special Notation *) - -0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ -5! = 120, 2 + 2 = 5 or E = mc2; p + 1 @ p = 1: for x in range(len(b)) -new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) -class Class if then else fi testing Testing ~007agent_bond james_007B0N3SS___ -loop pool while tRuE or noT faLsE let in case of ESAC - -(* -#3 INT_CONST 0007 -#3 INT_CONST 123 -#3 '+' -#3 INT_CONST 1 -#3 '-' -#3 INT_CONST 1 -#3 '+' -#3 INT_CONST 90 -#3 '-' -#3 INT_CONST 09 -#3 '+' -#3 INT_CONST 11113 -#3 '-' -#3 INT_CONST 4 -#3 OBJECTID r -#3 '*' -#3 OBJECTID a -#3 '*' -#3 OBJECTID self -#3 '*' -#3 OBJECTID c -#3 '+' -#3 '+' -#4 INT_CONST 5 -#4 ERROR "!" -#4 '=' -#4 INT_CONST 120 -#4 ',' -#4 INT_CONST 2 -#4 '+' -#4 INT_CONST 2 -#4 '=' -#4 INT_CONST 5 -#4 OBJECTID or -#4 TYPEID E -#4 '=' -#4 OBJECTID mc2 -#4 ';' -#4 OBJECTID p -#4 '+' -#4 INT_CONST 1 -#4 '@' -#4 OBJECTID p -#4 '=' -#4 INT_CONST 1 -#4 ':' -#4 OBJECTID for -#4 OBJECTID x -#4 IN -#4 OBJECTID range -#4 '(' -#4 OBJECTID len -#4 '(' -#4 OBJECTID b -#4 ')' -#4 ')' -#5 NEW -#5 '/' -#5 ASSIGN -#5 '<' -#5 LE -#5 DARROW -#5 '{' -#5 '(' -#5 TYPEID Int -#5 ':' -#5 TYPEID Objet -#5 ',' -#5 TYPEID Bool -#5 ';' -#5 TYPEID String -#5 '.' -#5 OBJECTID string -#5 TYPEID SELF_TYPE -#5 ISVOID -#5 '}' -#5 ')' -#6 CLASS -#6 CLASS -#6 IF -#6 THEN -#6 ELSE -#6 FI -#6 OBJECTID testing -#6 TYPEID Testing -#6 '~' -#6 INT_CONST 007 -#6 OBJECTID agent_bond -#6 OBJECTID james_007B0N3SS___ -#7 LOOP -#7 POOL -#7 WHILE -#7 BOOL_CONST true -#7 OBJECTID or -#7 NOT -#7 BOOL_CONST false -#7 LET -#7 IN -#7 CASE -#7 OF -#7 ESAC -*) \ No newline at end of file diff --git a/tests/lexer/iis1_error.txt b/tests/lexer/iis1_error.txt deleted file mode 100644 index 9e6d66cac..000000000 --- a/tests/lexer/iis1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(4, 2) - LexicographicError: ERROR "!" diff --git a/tests/lexer/iis2.cl b/tests/lexer/iis2.cl deleted file mode 100644 index 9b25715d4..000000000 --- a/tests/lexer/iis2.cl +++ /dev/null @@ -1,120 +0,0 @@ -(* Integers, Identifiers, and Special Notation *) - -0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ -class Class if then else fi testing Testing ~007agent_bond james_007bones___ - - -new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) -loop pool while tRuE or noT faLsE let in case of ESAC - -factorial(5) = 120, 2 + 2 = 5? or E = mc2; p + 1 resto p = 1: (@ for x in range(len(b))) - -(* -#3 INT_CONST 0007 -#3 INT_CONST 123 -#3 '+' -#3 INT_CONST 1 -#3 '-' -#3 INT_CONST 1 -#3 '+' -#3 INT_CONST 90 -#3 '-' -#3 INT_CONST 09 -#3 '+' -#3 INT_CONST 11113 -#3 '-' -#3 INT_CONST 4 -#3 OBJECTID r -#3 '*' -#3 OBJECTID a -#3 '*' -#3 OBJECTID self -#3 '*' -#3 OBJECTID c -#3 '+' -#3 '+' -#4 CLASS -#4 CLASS -#4 IF -#4 THEN -#4 ELSE -#4 FI -#4 OBJECTID testing -#4 TYPEID Testing -#4 '~' -#4 INT_CONST 007 -#4 OBJECTID agent_bond -#4 OBJECTID james_007bones___ -#7 NEW -#7 '/' -#7 ASSIGN -#7 '<' -#7 LE -#7 DARROW -#7 '{' -#7 '(' -#7 TYPEID Int -#7 ':' -#7 TYPEID Objet -#7 ',' -#7 TYPEID Bool -#7 ';' -#7 TYPEID String -#7 '.' -#7 OBJECTID string -#7 TYPEID SELF_TYPE -#7 ISVOID -#7 '}' -#7 ')' -#8 LOOP -#8 POOL -#8 WHILE -#8 BOOL_CONST true -#8 OBJECTID or -#8 NOT -#8 BOOL_CONST false -#8 LET -#8 IN -#8 CASE -#8 OF -#8 ESAC -#10 OBJECTID factorial -#10 '(' -#10 INT_CONST 5 -#10 ')' -#10 '=' -#10 INT_CONST 120 -#10 ',' -#10 INT_CONST 2 -#10 '+' -#10 INT_CONST 2 -#10 '=' -#10 INT_CONST 5 -#10 ERROR "?" -#10 OBJECTID or -#10 TYPEID E -#10 '=' -#10 OBJECTID mc2 -#10 ';' -#10 OBJECTID p -#10 '+' -#10 INT_CONST 1 -#10 OBJECTID resto -#10 OBJECTID p -#10 '=' -#10 INT_CONST 1 -#10 ':' -#10 '(' -#10 '@' -#10 OBJECTID for -#10 OBJECTID x -#10 IN -#10 OBJECTID range -#10 '(' -#10 OBJECTID len -#10 '(' -#10 OBJECTID b -#10 ')' -#10 ')' -#10 ')' -*) \ No newline at end of file diff --git a/tests/lexer/iis2_error.txt b/tests/lexer/iis2_error.txt deleted file mode 100644 index 922391a9d..000000000 --- a/tests/lexer/iis2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(10, 30) - LexicographicError: ERROR "?" diff --git a/tests/lexer/iis3.cl b/tests/lexer/iis3.cl deleted file mode 100644 index 0b965ddea..000000000 --- a/tests/lexer/iis3.cl +++ /dev/null @@ -1,121 +0,0 @@ -(* Integers, Identifiers, and Special Notation *) - -factorial(5) = 120, 2 + 2 = 5 or E = mc^2; p + 1 @ p = 1: z for x in range(len(b))) - -loop pool while tRuE or noT faLsE let in case of ESAC - -new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) - - -0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ -class Class if then else fi testing Testing ~007agent_bond james_007bones___ - -(* -#3 OBJECTID factorial -#3 '(' -#3 INT_CONST 5 -#3 ')' -#3 '=' -#3 INT_CONST 120 -#3 ',' -#3 INT_CONST 2 -#3 '+' -#3 INT_CONST 2 -#3 '=' -#3 INT_CONST 5 -#3 OBJECTID or -#3 TYPEID E -#3 '=' -#3 OBJECTID mc -#3 ERROR "^" -#3 INT_CONST 2 -#3 ';' -#3 OBJECTID p -#3 '+' -#3 INT_CONST 1 -#3 '@' -#3 OBJECTID p -#3 '=' -#3 INT_CONST 1 -#3 ':' -#3 OBJECTID z -#3 OBJECTID for -#3 OBJECTID x -#3 IN -#3 OBJECTID range -#3 '(' -#3 OBJECTID len -#3 '(' -#3 OBJECTID b -#3 ')' -#3 ')' -#3 ')' -#5 LOOP -#5 POOL -#5 WHILE -#5 BOOL_CONST true -#5 OBJECTID or -#5 NOT -#5 BOOL_CONST false -#5 LET -#5 IN -#5 CASE -#5 OF -#5 ESAC -#7 NEW -#7 '/' -#7 ASSIGN -#7 '<' -#7 LE -#7 DARROW -#7 '{' -#7 '(' -#7 TYPEID Int -#7 ':' -#7 TYPEID Objet -#7 ',' -#7 TYPEID Bool -#7 ';' -#7 TYPEID String -#7 '.' -#7 OBJECTID string -#7 TYPEID SELF_TYPE -#7 ISVOID -#7 '}' -#7 ')' -#10 INT_CONST 0007 -#10 INT_CONST 123 -#10 '+' -#10 INT_CONST 1 -#10 '-' -#10 INT_CONST 1 -#10 '+' -#10 INT_CONST 90 -#10 '-' -#10 INT_CONST 09 -#10 '+' -#10 INT_CONST 11113 -#10 '-' -#10 INT_CONST 4 -#10 OBJECTID r -#10 '*' -#10 OBJECTID a -#10 '*' -#10 OBJECTID self -#10 '*' -#10 OBJECTID c -#10 '+' -#10 '+' -#11 CLASS -#11 CLASS -#11 IF -#11 THEN -#11 ELSE -#11 FI -#11 OBJECTID testing -#11 TYPEID Testing -#11 '~' -#11 INT_CONST 007 -#11 OBJECTID agent_bond -#11 OBJECTID james_007bones___ -*) \ No newline at end of file diff --git a/tests/lexer/iis3_error.txt b/tests/lexer/iis3_error.txt deleted file mode 100644 index b001b6a71..000000000 --- a/tests/lexer/iis3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(3, 40) - LexicographicError: ERROR "^" diff --git a/tests/lexer/iis4.cl b/tests/lexer/iis4.cl deleted file mode 100644 index 9e7a9cb62..000000000 --- a/tests/lexer/iis4.cl +++ /dev/null @@ -1,120 +0,0 @@ -(* Integers, Identifiers, and Special Notation *) - -new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) -0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ - -factorial(5) = 120, 2 + 2 = 5 or E = mc2; p + 1 % p = 1: @.@ for x in range(len(b))~ - - -loop pool while tRuE or noT faLsE let in case of ESAC -class Class if then else fi testing Testing ~007agent_bond james_007bones___ - -(* -#3 NEW -#3 '/' -#3 ASSIGN -#3 '<' -#3 LE -#3 DARROW -#3 '{' -#3 '(' -#3 TYPEID Int -#3 ':' -#3 TYPEID Objet -#3 ',' -#3 TYPEID Bool -#3 ';' -#3 TYPEID String -#3 '.' -#3 OBJECTID string -#3 TYPEID SELF_TYPE -#3 ISVOID -#3 '}' -#3 ')' -#4 INT_CONST 0007 -#4 INT_CONST 123 -#4 '+' -#4 INT_CONST 1 -#4 '-' -#4 INT_CONST 1 -#4 '+' -#4 INT_CONST 90 -#4 '-' -#4 INT_CONST 09 -#4 '+' -#4 INT_CONST 11113 -#4 '-' -#4 INT_CONST 4 -#4 OBJECTID r -#4 '*' -#4 OBJECTID a -#4 '*' -#4 OBJECTID self -#4 '*' -#4 OBJECTID c -#4 '+' -#4 '+' -#6 OBJECTID factorial -#6 '(' -#6 INT_CONST 5 -#6 ')' -#6 '=' -#6 INT_CONST 120 -#6 ',' -#6 INT_CONST 2 -#6 '+' -#6 INT_CONST 2 -#6 '=' -#6 INT_CONST 5 -#6 OBJECTID or -#6 TYPEID E -#6 '=' -#6 OBJECTID mc2 -#6 ';' -#6 OBJECTID p -#6 '+' -#6 INT_CONST 1 -#6 ERROR "%" -#6 OBJECTID p -#6 '=' -#6 INT_CONST 1 -#6 ':' -#6 '@' -#6 '.' -#6 '@' -#6 OBJECTID for -#6 OBJECTID x -#6 IN -#6 OBJECTID range -#6 '(' -#6 OBJECTID len -#6 '(' -#6 OBJECTID b -#6 ')' -#6 ')' -#6 '~' -#9 LOOP -#9 POOL -#9 WHILE -#9 BOOL_CONST true -#9 OBJECTID or -#9 NOT -#9 BOOL_CONST false -#9 LET -#9 IN -#9 CASE -#9 OF -#9 ESAC -#10 CLASS -#10 CLASS -#10 IF -#10 THEN -#10 ELSE -#10 FI -#10 OBJECTID testing -#10 TYPEID Testing -#10 '~' -#10 INT_CONST 007 -#10 OBJECTID agent_bond -#10 OBJECTID james_007bones___ -*) \ No newline at end of file diff --git a/tests/lexer/iis4_error.txt b/tests/lexer/iis4_error.txt deleted file mode 100644 index f24076a8c..000000000 --- a/tests/lexer/iis4_error.txt +++ /dev/null @@ -1 +0,0 @@ -(6, 49) - LexicographicError: ERROR "!" diff --git a/tests/lexer/iis5.cl b/tests/lexer/iis5.cl deleted file mode 100644 index d146c0547..000000000 --- a/tests/lexer/iis5.cl +++ /dev/null @@ -1,121 +0,0 @@ -(* Integers, Identifiers, and Special Notation *) - - -loop pool while tRuE or noT faLsE let in case of ESAC -new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) -class Class if then else fi testing Testing ~007agent_bond james_007bones___ - -factorial(5) = 120, 2 + 2 = 5 or E = mc2; p + 1 resto p = 1: [@.@ for x in range(len(b))] - -0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ - -(* -#4 LOOP -#4 POOL -#4 WHILE -#4 BOOL_CONST true -#4 OBJECTID or -#4 NOT -#4 BOOL_CONST false -#4 LET -#4 IN -#4 CASE -#4 OF -#4 ESAC -#5 NEW -#5 '/' -#5 ASSIGN -#5 '<' -#5 LE -#5 DARROW -#5 '{' -#5 '(' -#5 TYPEID Int -#5 ':' -#5 TYPEID Objet -#5 ',' -#5 TYPEID Bool -#5 ';' -#5 TYPEID String -#5 '.' -#5 OBJECTID string -#5 TYPEID SELF_TYPE -#5 ISVOID -#5 '}' -#5 ')' -#6 CLASS -#6 CLASS -#6 IF -#6 THEN -#6 ELSE -#6 FI -#6 OBJECTID testing -#6 TYPEID Testing -#6 '~' -#6 INT_CONST 007 -#6 OBJECTID agent_bond -#6 OBJECTID james_007bones___ -#8 OBJECTID factorial -#8 '(' -#8 INT_CONST 5 -#8 ')' -#8 '=' -#8 INT_CONST 120 -#8 ',' -#8 INT_CONST 2 -#8 '+' -#8 INT_CONST 2 -#8 '=' -#8 INT_CONST 5 -#8 OBJECTID or -#8 TYPEID E -#8 '=' -#8 OBJECTID mc2 -#8 ';' -#8 OBJECTID p -#8 '+' -#8 INT_CONST 1 -#8 OBJECTID resto -#8 OBJECTID p -#8 '=' -#8 INT_CONST 1 -#8 ':' -#8 ERROR "[" -#8 '@' -#8 '.' -#8 '@' -#8 OBJECTID for -#8 OBJECTID x -#8 IN -#8 OBJECTID range -#8 '(' -#8 OBJECTID len -#8 '(' -#8 OBJECTID b -#8 ')' -#8 ')' -#8 ERROR "]" -#10 INT_CONST 0007 -#10 INT_CONST 123 -#10 '+' -#10 INT_CONST 1 -#10 '-' -#10 INT_CONST 1 -#10 '+' -#10 INT_CONST 90 -#10 '-' -#10 INT_CONST 09 -#10 '+' -#10 INT_CONST 11113 -#10 '-' -#10 INT_CONST 4 -#10 OBJECTID r -#10 '*' -#10 OBJECTID a -#10 '*' -#10 OBJECTID self -#10 '*' -#10 OBJECTID c -#10 '+' -#10 '+' -*) diff --git a/tests/lexer/iis5_error.txt b/tests/lexer/iis5_error.txt deleted file mode 100644 index b3dbadcb6..000000000 --- a/tests/lexer/iis5_error.txt +++ /dev/null @@ -1,2 +0,0 @@ -(8, 62) - LexicographicError: ERROR "[" -(8, 89) - LexicographicError: ERROR "]" diff --git a/tests/lexer/iis6.cl b/tests/lexer/iis6.cl deleted file mode 100644 index 1042f132b..000000000 --- a/tests/lexer/iis6.cl +++ /dev/null @@ -1,125 +0,0 @@ -(* Integers, Identifiers, and Special Notation *) - -factorial(5) = 120, 2 + 2 = 5 or E = mc2; p + 1 resto p = 1: {@.@ for x in range(len(b))} - -new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) - - -class Class if then else fi testing Testing ~007agent_bond _james_007bones___ - - - -0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ -loop pool while tRuE or noT faLsE let in case of ESAC - -(* -#3 OBJECTID factorial -#3 '(' -#3 INT_CONST 5 -#3 ')' -#3 '=' -#3 INT_CONST 120 -#3 ',' -#3 INT_CONST 2 -#3 '+' -#3 INT_CONST 2 -#3 '=' -#3 INT_CONST 5 -#3 OBJECTID or -#3 TYPEID E -#3 '=' -#3 OBJECTID mc2 -#3 ';' -#3 OBJECTID p -#3 '+' -#3 INT_CONST 1 -#3 OBJECTID resto -#3 OBJECTID p -#3 '=' -#3 INT_CONST 1 -#3 ':' -#3 '{' -#3 '@' -#3 '.' -#3 '@' -#3 OBJECTID for -#3 OBJECTID x -#3 IN -#3 OBJECTID range -#3 '(' -#3 OBJECTID len -#3 '(' -#3 OBJECTID b -#3 ')' -#3 ')' -#3 '}' -#5 NEW -#5 '/' -#5 ASSIGN -#5 '<' -#5 LE -#5 DARROW -#5 '{' -#5 '(' -#5 TYPEID Int -#5 ':' -#5 TYPEID Objet -#5 ',' -#5 TYPEID Bool -#5 ';' -#5 TYPEID String -#5 '.' -#5 OBJECTID string -#5 TYPEID SELF_TYPE -#5 ISVOID -#5 '}' -#5 ')' -#8 CLASS -#8 CLASS -#8 IF -#8 THEN -#8 ELSE -#8 FI -#8 OBJECTID testing -#8 TYPEID Testing -#8 '~' -#8 INT_CONST 007 -#8 OBJECTID agent_bond -#8 ERROR "_" -#8 OBJECTID james_007bones___ -#12 INT_CONST 0007 -#12 INT_CONST 123 -#12 '+' -#12 INT_CONST 1 -#12 '-' -#12 INT_CONST 1 -#12 '+' -#12 INT_CONST 90 -#12 '-' -#12 INT_CONST 09 -#12 '+' -#12 INT_CONST 11113 -#12 '-' -#12 INT_CONST 4 -#12 OBJECTID r -#12 '*' -#12 OBJECTID a -#12 '*' -#12 OBJECTID self -#12 '*' -#12 OBJECTID c -#12 '+' -#12 '+' -#13 LOOP -#13 POOL -#13 WHILE -#13 BOOL_CONST true -#13 OBJECTID or -#13 NOT -#13 BOOL_CONST false -#13 LET -#13 IN -#13 CASE -#13 OF -#13 ESAC -*) \ No newline at end of file diff --git a/tests/lexer/iis6_error.txt b/tests/lexer/iis6_error.txt deleted file mode 100644 index d7fad9c79..000000000 --- a/tests/lexer/iis6_error.txt +++ /dev/null @@ -1 +0,0 @@ -(8, 60) - LexicographicError: ERROR "_" diff --git a/tests/lexer/mixed1.cl b/tests/lexer/mixed1.cl deleted file mode 100644 index 803d58ef5..000000000 --- a/tests/lexer/mixed1.cl +++ /dev/null @@ -1,14 +0,0 @@ -"lkjdsafkljdsalfj\u0000dsafdsaf\u0000djafslkjdsalf\nsdajf\" lkjfdsasdkjfl"123 -adsfasklj# -LKldsajf iNhERITS -"lkdsajf" - -(* -#1 STR_CONST "lkjdsafkljdsalfju0000dsafdsafu0000djafslkjdsalf\nsdajf\" lkjfdsasdkjfl" -#1 INT_CONST 123 -#2 OBJECTID adsfasklj -#2 ERROR "#" -#3 TYPEID LKldsajf -#3 INHERITS -#4 STR_CONST "lkdsajf" -*) \ No newline at end of file diff --git a/tests/lexer/mixed1_error.txt b/tests/lexer/mixed1_error.txt deleted file mode 100644 index 99af5fbdc..000000000 --- a/tests/lexer/mixed1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(2, 10) - LexicographicError: ERROR "#" diff --git a/tests/lexer/mixed2.cl b/tests/lexer/mixed2.cl deleted file mode 100644 index 12039e123..000000000 --- a/tests/lexer/mixed2.cl +++ /dev/null @@ -1,20 +0,0 @@ -"kjas\"lnnsdj\nfljrdsaf" -@.$.@ -@*%*@ -"alkjfldajf""dasfadsf - -(* -#1 STR_CONST "kjas\"lnnsdj\nfljrdsaf" -#2 '@' -#2 '.' -#2 ERROR "$" -#2 '.' -#2 '@' -#3 '@' -#3 '*' -#3 ERROR "%" -#3 '*' -#3 '@' -#4 STR_CONST "alkjfldajf" -#4 ERROR "Unterminated string constant" -*) \ No newline at end of file diff --git a/tests/lexer/mixed2_error.txt b/tests/lexer/mixed2_error.txt deleted file mode 100644 index 097dc2a07..000000000 --- a/tests/lexer/mixed2_error.txt +++ /dev/null @@ -1,3 +0,0 @@ -(2, 3) - LexicographicError: ERROR "$" -(3, 3) - LexicographicError: ERROR "%" -(4, 22) - LexicographicError: Unterminated string constant diff --git a/tests/lexer/string1.cl b/tests/lexer/string1.cl deleted file mode 100644 index 6c3c00833..000000000 --- a/tests/lexer/string1.cl +++ /dev/null @@ -1,6 +0,0 @@ -(* A non-escaped newline character may not appear in a string *) - -"This \ -is OK" -"This is not -OK" \ No newline at end of file diff --git a/tests/lexer/string1_error.txt b/tests/lexer/string1_error.txt deleted file mode 100644 index 078c12bbb..000000000 --- a/tests/lexer/string1_error.txt +++ /dev/null @@ -1,2 +0,0 @@ -(5, 13) - LexicographicError: Unterminated string constant -(6, 4) - LexicographicError: EOF in string constant \ No newline at end of file diff --git a/tests/lexer/string2.cl b/tests/lexer/string2.cl deleted file mode 100644 index 3704b6ae7..000000000 --- a/tests/lexer/string2.cl +++ /dev/null @@ -1,19 +0,0 @@ -(* A string may not contain EOF *) - -" May the Triforce \ - 0 \ - 0v0 \ - 0vvv0 \ - 0vvvvv0 \ - 0vvvvvvv0 \ - 0vvvvvvvvv0 \ - 0vvvvvvvvvvv0 \ - 000000000000000 \ - 0v0 0v0 \ - 0vvv0 0vvv0 \ - 0vvvvv0 0vvvvv0 \ - 0vvvvvvv0 0vvvvvvv0 \ - 0vvvvvvvvv0 0vvvvvvvvv0 \ - 0vvvvvvvvvvv0 0vvvvvvvvvvv0 \ - 00000000000000000000000000000 \ - be with you! \ No newline at end of file diff --git a/tests/lexer/string2_error.txt b/tests/lexer/string2_error.txt deleted file mode 100644 index 7fbbcb526..000000000 --- a/tests/lexer/string2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(19, 29) - LexicographicError: EOF in string constant \ No newline at end of file diff --git a/tests/lexer/string3.cl b/tests/lexer/string3.cl deleted file mode 100644 index 78abc4972e218bca373ba1750c99a3450cef4ea3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 234 zcmX|4yAH!34D8HToS2dhRoZ?*=Jpd<90*B>0}_xSe_!a!lI8Q=*(aJadZZi|KVhQ- zK4j?NGc6u@9^rRpGmYcJ^ifl$K@ Mi{IIrdU_-I0>Lp*mH+?% diff --git a/tests/lexer/string3_error.txt b/tests/lexer/string3_error.txt deleted file mode 100644 index 35695d07e..000000000 --- a/tests/lexer/string3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(8, 4) - LexicographicError: String contains null character \ No newline at end of file diff --git a/tests/lexer/string4.cl b/tests/lexer/string4.cl deleted file mode 100644 index f4d39c027..000000000 --- a/tests/lexer/string4.cl +++ /dev/null @@ -1,38 +0,0 @@ -class Main { - str <- "The big brown fox - jumped over the fence"; - main() : Object { - { - out_string("Yay! This is the newest shites ); - } - }; -}; - -(* -#1 CLASS -#1 TYPEID Main -#1 '{' -#2 OBJECTID str -#2 ASSIGN -#3 ERROR "Unterminated string constant" -#3 OBJECTID jumped -#3 OBJECTID over -#3 OBJECTID the -#3 OBJECTID fence -#4 ERROR "Unterminated string constant" -#4 OBJECTID main -#4 '(' -#4 ')' -#4 ':' -#4 TYPEID Object -#4 '{' -#5 '{' -#6 OBJECTID out_string -#6 '(' -#7 ERROR "Unterminated string constant" -#7 '}' -#8 '}' -#8 ';' -#9 '}' -#9 ';' -*) \ No newline at end of file diff --git a/tests/lexer/string4_error.txt b/tests/lexer/string4_error.txt deleted file mode 100644 index 5ab0ea847..000000000 --- a/tests/lexer/string4_error.txt +++ /dev/null @@ -1,3 +0,0 @@ -(2, 30) - LexicographicError: Unterminated string constant -(3, 36) - LexicographicError: Unterminated string constant -(6, 58) - LexicographicError: Unterminated string constant \ No newline at end of file diff --git a/tests/lexer_test.py b/tests/lexer_test.py deleted file mode 100644 index d673fa6a4..000000000 --- a/tests/lexer_test.py +++ /dev/null @@ -1,14 +0,0 @@ -import pytest -import os -from .utils import compare_errors - -tests_dir = __file__.rpartition('/')[0] + '/lexer/' -tests = [file for file in os.listdir(tests_dir) if file.endswith('.cl')] - - -@pytest.mark.lexer -@pytest.mark.add_error_production -@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') diff --git a/tests/parser/assignment1.cl b/tests/parser/assignment1.cl deleted file mode 100644 index 75b4c5bbd..000000000 --- a/tests/parser/assignment1.cl +++ /dev/null @@ -1,37 +0,0 @@ -(* An assignment has the form <- *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(): String { - Test1 <- "Hello World" -- Identifiers begin with a lower case letter - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/assignment1_error.txt b/tests/parser/assignment1_error.txt deleted file mode 100644 index cef0d3946..000000000 --- a/tests/parser/assignment1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(29, 9) - SyntacticError: ERROR at or near "Test1" \ No newline at end of file diff --git a/tests/parser/assignment2.cl b/tests/parser/assignment2.cl deleted file mode 100644 index 4efb96487..000000000 --- a/tests/parser/assignment2.cl +++ /dev/null @@ -1,37 +0,0 @@ -(* An assignment has the form <- *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 - 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(): Int { - test1 <-- ~(1 + 2 + 3 + 4 + 5) -- The left side must be an expression - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/assignment2_error.txt b/tests/parser/assignment2_error.txt deleted file mode 100644 index dc611c159..000000000 --- a/tests/parser/assignment2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(29, 17) - SyntacticError: ERROR at or near "-" \ No newline at end of file diff --git a/tests/parser/assignment3.cl b/tests/parser/assignment3.cl deleted file mode 100644 index ff633f331..000000000 --- a/tests/parser/assignment3.cl +++ /dev/null @@ -1,37 +0,0 @@ -(* An assignment has the form <- *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(): Bool { - test1 <- true++ -- The left side must be an expression - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/assignment3_error.txt b/tests/parser/assignment3_error.txt deleted file mode 100644 index a69ac3a81..000000000 --- a/tests/parser/assignment3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(29, 23) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/attribute1.cl b/tests/parser/attribute1.cl deleted file mode 100644 index 063a02c02..000000000 --- a/tests/parser/attribute1.cl +++ /dev/null @@ -1,34 +0,0 @@ -(* An attribute of class A specifies a variable that is part of the state of objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - -- Attributes names must begin with lowercase letters - Test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/attribute1_error.txt b/tests/parser/attribute1_error.txt deleted file mode 100644 index a4e9eb060..000000000 --- a/tests/parser/attribute1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(17, 5) - SyntacticError: ERROR at or near "Test2" \ No newline at end of file diff --git a/tests/parser/attribute2.cl b/tests/parser/attribute2.cl deleted file mode 100644 index c05211483..000000000 --- a/tests/parser/attribute2.cl +++ /dev/null @@ -1,34 +0,0 @@ -(* An attribute of class A specifies a variable that is part of the state of objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - -- Type names must begin with uppercase letters - test3: string <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/attribute2_error.txt b/tests/parser/attribute2_error.txt deleted file mode 100644 index b02a52ee1..000000000 --- a/tests/parser/attribute2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(19, 12) - SyntacticError: ERROR at or near "string" \ No newline at end of file diff --git a/tests/parser/attribute3.cl b/tests/parser/attribute3.cl deleted file mode 100644 index d858ae47c..000000000 --- a/tests/parser/attribute3.cl +++ /dev/null @@ -1,34 +0,0 @@ -(* An attribute of class A specifies a variable that is part of the state of objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - -- Expected '<-' not '<=' - test3: String <= "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/attribute3_error.txt b/tests/parser/attribute3_error.txt deleted file mode 100644 index 71f5bc0b7..000000000 --- a/tests/parser/attribute3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(19, 19) - SyntacticError: ERROR at or near "<=" \ No newline at end of file diff --git a/tests/parser/block1.cl b/tests/parser/block1.cl deleted file mode 100644 index 3613d9268..000000000 --- a/tests/parser/block1.cl +++ /dev/null @@ -1,87 +0,0 @@ -(* A block has the form { ; ... ; } *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - pow: Int <- 1; - count: Int <- 0; - - testing6(a: Int): IO { - { - count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2 -- Missing ";" - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/block1_error.txt b/tests/parser/block1_error.txt deleted file mode 100644 index c78fb0b96..000000000 --- a/tests/parser/block1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(56, 17) - SyntacticError: ERROR at or near "}" \ No newline at end of file diff --git a/tests/parser/block2.cl b/tests/parser/block2.cl deleted file mode 100644 index f485dd0b1..000000000 --- a/tests/parser/block2.cl +++ /dev/null @@ -1,87 +0,0 @@ -(* A block has the form { ; ... ; } *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - pow: Int <- 1; - count: Int <- 0; - - testing6(a: Int): IO { - -- Missing "{" - count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/block2_error.txt b/tests/parser/block2_error.txt deleted file mode 100644 index f85f4303c..000000000 --- a/tests/parser/block2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(49, 23) - SyntacticError: ERROR at or near ";" \ No newline at end of file diff --git a/tests/parser/block3.cl b/tests/parser/block3.cl deleted file mode 100644 index ae1598c3b..000000000 --- a/tests/parser/block3.cl +++ /dev/null @@ -1,87 +0,0 @@ -(* A block has the form { ; ... ; } *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - pow: Int <- 1; - count: Int <- 0; - - testing6(a: Int): IO { - { - count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - -- Missing "}" - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/block3_error.txt b/tests/parser/block3_error.txt deleted file mode 100644 index cda9949a2..000000000 --- a/tests/parser/block3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(57, 13) - SyntacticError: ERROR at or near "pool" \ No newline at end of file diff --git a/tests/parser/block4.cl b/tests/parser/block4.cl deleted file mode 100644 index 8fd883d02..000000000 --- a/tests/parser/block4.cl +++ /dev/null @@ -1,88 +0,0 @@ -(* A block has the form { ; ... ; } *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - pow: Int <- 1; - count: Int <- 0; - - testing6(a: Int): IO { - { - count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - true++; -- Only expressions - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/block4_error.txt b/tests/parser/block4_error.txt deleted file mode 100644 index ddbeb32ef..000000000 --- a/tests/parser/block4_error.txt +++ /dev/null @@ -1 +0,0 @@ -(56, 26) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/case1.cl b/tests/parser/case1.cl deleted file mode 100644 index c2f508809..000000000 --- a/tests/parser/case1.cl +++ /dev/null @@ -1,91 +0,0 @@ -(* Case expressions provide runtime type tests on objects *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + 2 of - -- Every case expression must have at least one branch - esac - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/case1_error.txt b/tests/parser/case1_error.txt deleted file mode 100644 index 61fca14f7..000000000 --- a/tests/parser/case1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(63, 9) - SyntacticError: ERROR at or near ESAC \ No newline at end of file diff --git a/tests/parser/case2.cl b/tests/parser/case2.cl deleted file mode 100644 index f9162e49f..000000000 --- a/tests/parser/case2.cl +++ /dev/null @@ -1,93 +0,0 @@ -(* Case expressions provide runtime type tests on objects *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case "2 + 2" of - x: Int => new IO.out_string("Es un entero!") -- Missing ";" - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/case2_error.txt b/tests/parser/case2_error.txt deleted file mode 100644 index 40b030dd9..000000000 --- a/tests/parser/case2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(63, 13) - SyntacticError: ERROR at or near "y" \ No newline at end of file diff --git a/tests/parser/case3.cl b/tests/parser/case3.cl deleted file mode 100644 index a7eedc18b..000000000 --- a/tests/parser/case3.cl +++ /dev/null @@ -1,93 +0,0 @@ -(* Case expressions provide runtime type tests on objects *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + false of - x: Int => new IO.out_string("Es un entero!"); - y: string => new IO.out_string("Es una cadena!"); -- Type identifiers starts with a uppercase letter - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/case3_error.txt b/tests/parser/case3_error.txt deleted file mode 100644 index f25c5c563..000000000 --- a/tests/parser/case3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(63, 16) - SyntacticError: ERROR at or near "string" \ No newline at end of file diff --git a/tests/parser/case4.cl b/tests/parser/case4.cl deleted file mode 100644 index 25ca3858f..000000000 --- a/tests/parser/case4.cl +++ /dev/null @@ -1,93 +0,0 @@ -(* Case expressions provide runtime type tests on objects *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case true of - x: Int => new IO.out_string("Es un entero!"); - y: String => new IO.out_string("Es una cadena!"); - Mazinger_Z: Bool => new IO.out_string("Es un booleano!"); -- Identifiers starts with a lowercase letter - esac - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/case4_error.txt b/tests/parser/case4_error.txt deleted file mode 100644 index c5a16ddec..000000000 --- a/tests/parser/case4_error.txt +++ /dev/null @@ -1 +0,0 @@ -(64, 13) - SyntacticError: ERROR at or near "Mazinger_Z" \ No newline at end of file diff --git a/tests/parser/case5.cl b/tests/parser/case5.cl deleted file mode 100644 index b36c663e1..000000000 --- a/tests/parser/case5.cl +++ /dev/null @@ -1,93 +0,0 @@ -(* Case expressions provide runtime type tests on objects *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case test2 of - x: Int <- new IO.out_string("Es un entero!"); -- Must be '=>' not '<-'; - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/case5_error.txt b/tests/parser/case5_error.txt deleted file mode 100644 index fc6ec0eda..000000000 --- a/tests/parser/case5_error.txt +++ /dev/null @@ -1 +0,0 @@ -(62, 20) - SyntacticError: ERROR at or near ASSIGN \ No newline at end of file diff --git a/tests/parser/case6.cl b/tests/parser/case6.cl deleted file mode 100644 index 66e7df2ab..000000000 --- a/tests/parser/case6.cl +++ /dev/null @@ -1,93 +0,0 @@ -(* Case expressions provide runtime type tests on objects *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + 2 -- Missing "of" - x: Int => new IO.out_string("Es un entero!"); - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/case6_error.txt b/tests/parser/case6_error.txt deleted file mode 100644 index 2ae2f723b..000000000 --- a/tests/parser/case6_error.txt +++ /dev/null @@ -1 +0,0 @@ -(62, 13) - SyntacticError: ERROR at or near "x" \ No newline at end of file diff --git a/tests/parser/class1.cl b/tests/parser/class1.cl deleted file mode 100644 index f4815e3f4..000000000 --- a/tests/parser/class1.cl +++ /dev/null @@ -1,20 +0,0 @@ -(* A class is a list of features *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - testing(): Int { - 2 + 2 - }; -}; - --- Class names must begin with uppercase letters -class alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; diff --git a/tests/parser/class1_error.txt b/tests/parser/class1_error.txt deleted file mode 100644 index acaa52a6e..000000000 --- a/tests/parser/class1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(16, 7) - SyntacticError: ERROR at or near "alpha" \ No newline at end of file diff --git a/tests/parser/class2.cl b/tests/parser/class2.cl deleted file mode 100644 index f363b032a..000000000 --- a/tests/parser/class2.cl +++ /dev/null @@ -1,20 +0,0 @@ -(* A class is a list of features *) - -CLaSS Main { - main(): Object { - (new Alpha).print() - }; -}; - -CLaSS Test { - testing(): Int { - 2 + 2 - }; -}; - --- Type names must begin with uppercase letters -CLaSS Alpha iNHeRiTS iO { - print() : Object { - out_string("reached!!\n") - }; -}; diff --git a/tests/parser/class2_error.txt b/tests/parser/class2_error.txt deleted file mode 100644 index 59d065913..000000000 --- a/tests/parser/class2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(16, 22) - SyntacticError: ERROR at or near "iO" \ No newline at end of file diff --git a/tests/parser/class3.cl b/tests/parser/class3.cl deleted file mode 100644 index 0c801372a..000000000 --- a/tests/parser/class3.cl +++ /dev/null @@ -1,34 +0,0 @@ -(* A class is a list of features *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - -- Missing semicolon - testing2(a: Alpha, b: Int): Int { - 2 + 2 - } - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; diff --git a/tests/parser/class3_error.txt b/tests/parser/class3_error.txt deleted file mode 100644 index bc2f946b2..000000000 --- a/tests/parser/class3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(25, 5) - SyntacticError: ERROR at or near "testing3" \ No newline at end of file diff --git a/tests/parser/class4.cl b/tests/parser/class4.cl deleted file mode 100644 index 5c286b5e6..000000000 --- a/tests/parser/class4.cl +++ /dev/null @@ -1,36 +0,0 @@ -(* A class is a list of features *) - -CLaSS Main { - main(): Object { - (new Alpha).print() - }; -}; - -CLaSS Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - -- Only features - 2 + 2; - - testing3(): String { - "2 + 2" - }; -}; - -CLaSS Alpha iNHeRiTS IO { - print() : Object { - out_string("reached!!\n") - }; -}; diff --git a/tests/parser/class4_error.txt b/tests/parser/class4_error.txt deleted file mode 100644 index 1007f033d..000000000 --- a/tests/parser/class4_error.txt +++ /dev/null @@ -1 +0,0 @@ -(25, 5) - SyntacticError: ERROR at or near "2" \ No newline at end of file diff --git a/tests/parser/class5.cl b/tests/parser/class5.cl deleted file mode 100644 index 3f40c36eb..000000000 --- a/tests/parser/class5.cl +++ /dev/null @@ -1,34 +0,0 @@ -(* A class is a list of features *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - --- Missing '{' -class Test - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; diff --git a/tests/parser/class5_error.txt b/tests/parser/class5_error.txt deleted file mode 100644 index 400e4d614..000000000 --- a/tests/parser/class5_error.txt +++ /dev/null @@ -1 +0,0 @@ -(11, 5) - SyntacticError: ERROR at or near "test1" \ No newline at end of file diff --git a/tests/parser/class6.cl b/tests/parser/class6.cl deleted file mode 100644 index 8501d2593..000000000 --- a/tests/parser/class6.cl +++ /dev/null @@ -1,34 +0,0 @@ -(* A class is a list of features *) - -CLaSS Main { - main(): Object { - (new Alpha).print() - }; -}; - --- Missing '}' -CLaSS Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -; - -CLaSS Alpha iNHeRiTS IO { - print() : Object { - out_string("reached!!\n") - }; -}; diff --git a/tests/parser/class6_error.txt b/tests/parser/class6_error.txt deleted file mode 100644 index 73574c94c..000000000 --- a/tests/parser/class6_error.txt +++ /dev/null @@ -1 +0,0 @@ -(28, 1) - SyntacticError: ERROR at or near ";" \ No newline at end of file diff --git a/tests/parser/conditional1.cl b/tests/parser/conditional1.cl deleted file mode 100644 index 4d546fc44..000000000 --- a/tests/parser/conditional1.cl +++ /dev/null @@ -1,69 +0,0 @@ -(* A conditional has the form if then else fi *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - if a.length() < b.length() -- Mising "then" - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - else - if a.length() = b.length() then - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - else - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fi - fi - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/conditional1_error.txt b/tests/parser/conditional1_error.txt deleted file mode 100644 index ee533fd84..000000000 --- a/tests/parser/conditional1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(34, 13) - SyntacticError: ERROR at or near NEW \ No newline at end of file diff --git a/tests/parser/conditional2.cl b/tests/parser/conditional2.cl deleted file mode 100644 index 4f10c2957..000000000 --- a/tests/parser/conditional2.cl +++ /dev/null @@ -1,69 +0,0 @@ -(* A conditional has the form if then else fi *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - if a.length() < b.length() then - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - else - if a.length() = b.length() then - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - else - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - -- Missing "fi" - fi - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/conditional2_error.txt b/tests/parser/conditional2_error.txt deleted file mode 100644 index c72f78d7e..000000000 --- a/tests/parser/conditional2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(42, 5) - SyntacticError: ERROR at or near "}" \ No newline at end of file diff --git a/tests/parser/conditional3.cl b/tests/parser/conditional3.cl deleted file mode 100644 index 67e991ade..000000000 --- a/tests/parser/conditional3.cl +++ /dev/null @@ -1,69 +0,0 @@ -(* A conditional has the form if then else fi *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - iF a.length() < b.length() tHen - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - elsE - if a.length() = b.length() then - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - eLseif -- elseif isn't a keyword - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/conditional3_error.txt b/tests/parser/conditional3_error.txt deleted file mode 100644 index ad95552b5..000000000 --- a/tests/parser/conditional3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(38, 13) - SyntacticError: ERROR at or near "eLseif" \ No newline at end of file diff --git a/tests/parser/conditional4.cl b/tests/parser/conditional4.cl deleted file mode 100644 index 0792fdc85..000000000 --- a/tests/parser/conditional4.cl +++ /dev/null @@ -1,73 +0,0 @@ -(* A conditional has the form if then else fi *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(): Int { - if true++ then 1 else 0 -- Condition must be an expression - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/conditional4_error.txt b/tests/parser/conditional4_error.txt deleted file mode 100644 index f5511445b..000000000 --- a/tests/parser/conditional4_error.txt +++ /dev/null @@ -1 +0,0 @@ -(45, 17) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/conditional5.cl b/tests/parser/conditional5.cl deleted file mode 100644 index 0c1e1aad0..000000000 --- a/tests/parser/conditional5.cl +++ /dev/null @@ -1,73 +0,0 @@ -(* A conditional has the form if then else fi *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(): Int { - if true then true++ else 0 -- If branch must be an expression - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/conditional5_error.txt b/tests/parser/conditional5_error.txt deleted file mode 100644 index b3214010d..000000000 --- a/tests/parser/conditional5_error.txt +++ /dev/null @@ -1 +0,0 @@ -(45, 27) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/conditional6.cl b/tests/parser/conditional6.cl deleted file mode 100644 index 02310404a..000000000 --- a/tests/parser/conditional6.cl +++ /dev/null @@ -1,73 +0,0 @@ -(* A conditional has the form if then else fi *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(): Int { - if true then 1 else false++ -- Else branch must be an expression - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/conditional6_error.txt b/tests/parser/conditional6_error.txt deleted file mode 100644 index 968b78ad9..000000000 --- a/tests/parser/conditional6_error.txt +++ /dev/null @@ -1 +0,0 @@ -(45, 35) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/dispatch1.cl b/tests/parser/dispatch1.cl deleted file mode 100644 index 2ca394716..000000000 --- a/tests/parser/dispatch1.cl +++ /dev/null @@ -1,45 +0,0 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - Test1.testing4(1, 2).testing4(3, 4).testing4(5, 6) -- Objet identifiers begin with a lower case letter - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/dispatch1_error.txt b/tests/parser/dispatch1_error.txt deleted file mode 100644 index ba8e9e84c..000000000 --- a/tests/parser/dispatch1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(37, 9) - SyntacticError: ERROR at or near "Test1" \ No newline at end of file diff --git a/tests/parser/dispatch2.cl b/tests/parser/dispatch2.cl deleted file mode 100644 index 0b57467a1..000000000 --- a/tests/parser/dispatch2.cl +++ /dev/null @@ -1,45 +0,0 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13,) -- Extra comma - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/dispatch2_error.txt b/tests/parser/dispatch2_error.txt deleted file mode 100644 index 134e266b2..000000000 --- a/tests/parser/dispatch2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(37, 84) - SyntacticError: ERROR at or near ")" \ No newline at end of file diff --git a/tests/parser/dispatch3.cl b/tests/parser/dispatch3.cl deleted file mode 100644 index 9f1a5afff..000000000 --- a/tests/parser/dispatch3.cl +++ /dev/null @@ -1,45 +0,0 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).Testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) -- Identifiers begin with a lower case letter - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/dispatch3_error.txt b/tests/parser/dispatch3_error.txt deleted file mode 100644 index 86d2d5142..000000000 --- a/tests/parser/dispatch3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(37, 38) - SyntacticError: ERROR at or near "Testing4" \ No newline at end of file diff --git a/tests/parser/dispatch4.cl b/tests/parser/dispatch4.cl deleted file mode 100644 index d1efc469d..000000000 --- a/tests/parser/dispatch4.cl +++ /dev/null @@ -1,53 +0,0 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - self.testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true++) -- Arguments must be expressions - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/dispatch4_error.txt b/tests/parser/dispatch4_error.txt deleted file mode 100644 index d03bb4c53..000000000 --- a/tests/parser/dispatch4_error.txt +++ /dev/null @@ -1 +0,0 @@ -(45, 81) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/dispatch5.cl b/tests/parser/dispatch5.cl deleted file mode 100644 index 63a5afa79..000000000 --- a/tests/parser/dispatch5.cl +++ /dev/null @@ -1,53 +0,0 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, ,true + fALSE) -- Extra comma - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/dispatch5_error.txt b/tests/parser/dispatch5_error.txt deleted file mode 100644 index 3fc39c625..000000000 --- a/tests/parser/dispatch5_error.txt +++ /dev/null @@ -1 +0,0 @@ -(45, 71) - SyntacticError: ERROR at or near "," \ No newline at end of file diff --git a/tests/parser/dispatch6.cl b/tests/parser/dispatch6.cl deleted file mode 100644 index 0a953e2e6..000000000 --- a/tests/parser/dispatch6.cl +++ /dev/null @@ -1,57 +0,0 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@object.copy() -- Type identifiers begin with a upper case letter - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/dispatch6_error.txt b/tests/parser/dispatch6_error.txt deleted file mode 100644 index 543f3a38c..000000000 --- a/tests/parser/dispatch6_error.txt +++ /dev/null @@ -1 +0,0 @@ -(49, 15) - SyntacticError: ERROR at or near "object" \ No newline at end of file diff --git a/tests/parser/dispatch7.cl b/tests/parser/dispatch7.cl deleted file mode 100644 index 3ecac4d0f..000000000 --- a/tests/parser/dispatch7.cl +++ /dev/null @@ -1,57 +0,0 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.Copy() -- Identifiers begin with a lower case letter - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/dispatch7_error.txt b/tests/parser/dispatch7_error.txt deleted file mode 100644 index 27235d118..000000000 --- a/tests/parser/dispatch7_error.txt +++ /dev/null @@ -1 +0,0 @@ -(49, 22) - SyntacticError: ERROR at or near "Copy" \ No newline at end of file diff --git a/tests/parser/dispatch8.cl b/tests/parser/dispatch8.cl deleted file mode 100644 index eef0455ef..000000000 --- a/tests/parser/dispatch8.cl +++ /dev/null @@ -1,57 +0,0 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy(,) -- Extra comma - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/dispatch8_error.txt b/tests/parser/dispatch8_error.txt deleted file mode 100644 index 04704520a..000000000 --- a/tests/parser/dispatch8_error.txt +++ /dev/null @@ -1 +0,0 @@ -(49, 27) - SyntacticError: ERROR at or near "," \ No newline at end of file diff --git a/tests/parser/dispatch9.cl b/tests/parser/dispatch9.cl deleted file mode 100644 index 5fdef22d6..000000000 --- a/tests/parser/dispatch9.cl +++ /dev/null @@ -1,61 +0,0 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; - - testing5(): Object { - test1:Object.copy() -- Must be '@' not ':' - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/dispatch9_error.txt b/tests/parser/dispatch9_error.txt deleted file mode 100644 index eb0b3397d..000000000 --- a/tests/parser/dispatch9_error.txt +++ /dev/null @@ -1 +0,0 @@ -(53, 14) - SyntacticError: ERROR at or near ":" \ No newline at end of file diff --git a/tests/parser/let1.cl b/tests/parser/let1.cl deleted file mode 100644 index 576ae383c..000000000 --- a/tests/parser/let1.cl +++ /dev/null @@ -1,85 +0,0 @@ -(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let Count: Int <- 0, pow: Int <- 1 -- Object identifiers starts with a lowercase letter - in { - -- count <- 0; - -- pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/let1_error.txt b/tests/parser/let1_error.txt deleted file mode 100644 index 8b7fe63d1..000000000 --- a/tests/parser/let1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(45, 13) - SyntacticError: ERROR at or near "Count" \ No newline at end of file diff --git a/tests/parser/let2.cl b/tests/parser/let2.cl deleted file mode 100644 index 4cfaef0f8..000000000 --- a/tests/parser/let2.cl +++ /dev/null @@ -1,85 +0,0 @@ -(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int, pow: int <- 1 -- Type identifiers starts with a uppercase letter - in { - count <- 0; - -- pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/let2_error.txt b/tests/parser/let2_error.txt deleted file mode 100644 index 6fb3f8e9c..000000000 --- a/tests/parser/let2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(45, 30) - SyntacticError: ERROR at or near "int" \ No newline at end of file diff --git a/tests/parser/let3.cl b/tests/parser/let3.cl deleted file mode 100644 index 91e567fd8..000000000 --- a/tests/parser/let3.cl +++ /dev/null @@ -1,85 +0,0 @@ -(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int, pow: Int, -- Extra comma - in { - count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/let3_error.txt b/tests/parser/let3_error.txt deleted file mode 100644 index 71fa08812..000000000 --- a/tests/parser/let3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(46, 9) - SyntacticError: ERROR at or near IN \ No newline at end of file diff --git a/tests/parser/let4.cl b/tests/parser/let4.cl deleted file mode 100644 index a716c332d..000000000 --- a/tests/parser/let4.cl +++ /dev/null @@ -1,85 +0,0 @@ -(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- true++, pow: Int <- 1 -- Initialization must be an expression - in { - count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/let4_error.txt b/tests/parser/let4_error.txt deleted file mode 100644 index e12c7478c..000000000 --- a/tests/parser/let4_error.txt +++ /dev/null @@ -1 +0,0 @@ -(45, 32) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/let5.cl b/tests/parser/let5.cl deleted file mode 100644 index d974cc138..000000000 --- a/tests/parser/let5.cl +++ /dev/null @@ -1,85 +0,0 @@ -(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int = 0, pow: Int -- Must be '<-' not '=' - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/let5_error.txt b/tests/parser/let5_error.txt deleted file mode 100644 index e561f846c..000000000 --- a/tests/parser/let5_error.txt +++ /dev/null @@ -1 +0,0 @@ -(45, 24) - SyntacticError: ERROR at or near "=" \ No newline at end of file diff --git a/tests/parser/let6.cl b/tests/parser/let6.cl deleted file mode 100644 index b6e51d7e1..000000000 --- a/tests/parser/let6.cl +++ /dev/null @@ -1,74 +0,0 @@ -(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int <- 1 - in false++ -- Let body must be an expression - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/let6_error.txt b/tests/parser/let6_error.txt deleted file mode 100644 index 7a77928b9..000000000 --- a/tests/parser/let6_error.txt +++ /dev/null @@ -1 +0,0 @@ -(46, 18) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/let7.cl b/tests/parser/let7.cl deleted file mode 100644 index 6fd63e6a7..000000000 --- a/tests/parser/let7.cl +++ /dev/null @@ -1,85 +0,0 @@ -(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - (* Missing "in" *) { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/let7_error.txt b/tests/parser/let7_error.txt deleted file mode 100644 index 654b1ce60..000000000 --- a/tests/parser/let7_error.txt +++ /dev/null @@ -1 +0,0 @@ -(46, 28) - SyntacticError: ERROR at or near "{" \ No newline at end of file diff --git a/tests/parser/loop1.cl b/tests/parser/loop1.cl deleted file mode 100644 index 7d0d7688f..000000000 --- a/tests/parser/loop1.cl +++ /dev/null @@ -1,78 +0,0 @@ -(* A loop has the form while loop pool *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - count: Int <- 1; - - testing6(): Object { - while count < 1024*1024 - -- Missing "loop" - count <- count * 2 - pool - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/loop1_error.txt b/tests/parser/loop1_error.txt deleted file mode 100644 index 94248ff00..000000000 --- a/tests/parser/loop1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(49, 13) - SyntacticError: ERROR at or near "count" \ No newline at end of file diff --git a/tests/parser/loop2.cl b/tests/parser/loop2.cl deleted file mode 100644 index a9613c487..000000000 --- a/tests/parser/loop2.cl +++ /dev/null @@ -1,78 +0,0 @@ -(* A loop has the form while loop pool *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - count: Int <- 1; - - testing6(): Object { - while count < 1024*1024 - loop - count <- count * 2 - -- Missing "pool" - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/loop2_error.txt b/tests/parser/loop2_error.txt deleted file mode 100644 index 6447101f8..000000000 --- a/tests/parser/loop2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(51, 5) - SyntacticError: ERROR at or near "}" \ No newline at end of file diff --git a/tests/parser/loop3.cl b/tests/parser/loop3.cl deleted file mode 100644 index 860adb4d1..000000000 --- a/tests/parser/loop3.cl +++ /dev/null @@ -1,78 +0,0 @@ -(* A loop has the form while loop pool *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - count: Int <- 1; - - testing6(): Object { - while count => 1024*1024 -- Condition must be an expression - loop - count <- count * 2 - pool - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/loop3_error.txt b/tests/parser/loop3_error.txt deleted file mode 100644 index 3da8bcde0..000000000 --- a/tests/parser/loop3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(47, 21) - SyntacticError: ERROR at or near DARROW \ No newline at end of file diff --git a/tests/parser/loop4.cl b/tests/parser/loop4.cl deleted file mode 100644 index 0a1194e82..000000000 --- a/tests/parser/loop4.cl +++ /dev/null @@ -1,78 +0,0 @@ -(* A loop has the form while loop pool *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - count: Int <- 1; - - testing6(): Object { - while count < 1024*1024 - loop - count <- true++ -- While body must be an expression - pool - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/loop4_error.txt b/tests/parser/loop4_error.txt deleted file mode 100644 index c39f35fe1..000000000 --- a/tests/parser/loop4_error.txt +++ /dev/null @@ -1 +0,0 @@ -(49, 27) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/method1.cl b/tests/parser/method1.cl deleted file mode 100644 index fcfbbcd30..000000000 --- a/tests/parser/method1.cl +++ /dev/null @@ -1,34 +0,0 @@ -(* A method of class A is a procedure that may manipulate the variables and objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - -- Method names must begin with lowercase letters - Testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/method1_error.txt b/tests/parser/method1_error.txt deleted file mode 100644 index 0eff41999..000000000 --- a/tests/parser/method1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(21, 5) - SyntacticError: ERROR at or near "Testing2" \ No newline at end of file diff --git a/tests/parser/method2.cl b/tests/parser/method2.cl deleted file mode 100644 index d5bdfd85c..000000000 --- a/tests/parser/method2.cl +++ /dev/null @@ -1,34 +0,0 @@ -(* A method of class A is a procedure that may manipulate the variables and objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - -- Parameter names must begin with lowercase letters - testing2(a: Alpha, B: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/method2_error.txt b/tests/parser/method2_error.txt deleted file mode 100644 index 1843fb7b4..000000000 --- a/tests/parser/method2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(21, 24) - SyntacticError: ERROR at or near "B" \ No newline at end of file diff --git a/tests/parser/method3.cl b/tests/parser/method3.cl deleted file mode 100644 index 1e5c9eb53..000000000 --- a/tests/parser/method3.cl +++ /dev/null @@ -1,34 +0,0 @@ -(* A method of class A is a procedure that may manipulate the variables and objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - -- Type names must begin with uppercase letters - testing2(a: Alpha, b: int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/method3_error.txt b/tests/parser/method3_error.txt deleted file mode 100644 index dbecf552e..000000000 --- a/tests/parser/method3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(21, 27) - SyntacticError: ERROR at or near "int" \ No newline at end of file diff --git a/tests/parser/method4.cl b/tests/parser/method4.cl deleted file mode 100644 index 019ada276..000000000 --- a/tests/parser/method4.cl +++ /dev/null @@ -1,34 +0,0 @@ -(* A method of class A is a procedure that may manipulate the variables and objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - -- Missing paremeter - testing3(x: Int,): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/method4_error.txt b/tests/parser/method4_error.txt deleted file mode 100644 index 6421cee2b..000000000 --- a/tests/parser/method4_error.txt +++ /dev/null @@ -1 +0,0 @@ -(25, 21) - SyntacticError: ERROR at or near ")" \ No newline at end of file diff --git a/tests/parser/method5.cl b/tests/parser/method5.cl deleted file mode 100644 index 13127f664..000000000 --- a/tests/parser/method5.cl +++ /dev/null @@ -1,34 +0,0 @@ -(* A method of class A is a procedure that may manipulate the variables and objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - -- Type names must begin with uppercase letters - testing3(): string { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/method5_error.txt b/tests/parser/method5_error.txt deleted file mode 100644 index 9bda07041..000000000 --- a/tests/parser/method5_error.txt +++ /dev/null @@ -1 +0,0 @@ -(25, 17) - SyntacticError: ERROR at or near "string" \ No newline at end of file diff --git a/tests/parser/method6.cl b/tests/parser/method6.cl deleted file mode 100644 index d48cd1293..000000000 --- a/tests/parser/method6.cl +++ /dev/null @@ -1,33 +0,0 @@ -(* A method of class A is a procedure that may manipulate the variables and objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - -- Body can't be empty - testing2(a: Alpha, b: Int): Int { - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/method6_error.txt b/tests/parser/method6_error.txt deleted file mode 100644 index e7d5de400..000000000 --- a/tests/parser/method6_error.txt +++ /dev/null @@ -1 +0,0 @@ -(22, 5) - SyntacticError: ERROR at or near "}" \ No newline at end of file diff --git a/tests/parser/mixed1.cl b/tests/parser/mixed1.cl deleted file mode 100644 index a27879513..000000000 --- a/tests/parser/mixed1.cl +++ /dev/null @@ -1,100 +0,0 @@ -(* Cool has four binary arithmetic operations: +, -, *, /. *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + 2 of - x: Int => new IO.out_string("Es un entero!"); - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; - - a: Int <- 1; - - testing8(x: Int, y: Int): Bool { - let z: Int <- 3, w: Int <- 4 - in isvoid (3 + a * (x / w + new Int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) - }; -}-- Mising ";" - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/mixed1_error.txt b/tests/parser/mixed1_error.txt deleted file mode 100644 index d5b0ff8bb..000000000 --- a/tests/parser/mixed1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(76, 1) - SyntacticError: ERROR at or near CLASS \ No newline at end of file diff --git a/tests/parser/mixed2.cl b/tests/parser/mixed2.cl deleted file mode 100644 index f5477e0bb..000000000 --- a/tests/parser/mixed2.cl +++ /dev/null @@ -1,14 +0,0 @@ -class Main { - main(): Object { - (new Alpha).print() - }; - -}; - -(* Class names must begin with uppercase letters *) -class alpha inherits IO { - print() : Object { - out_string("reached!!\n"); - }; -}; - diff --git a/tests/parser/mixed2_error.txt b/tests/parser/mixed2_error.txt deleted file mode 100644 index b5613c52a..000000000 --- a/tests/parser/mixed2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(9, 7) - SyntacticError: ERROR at or near "alpha" \ No newline at end of file diff --git a/tests/parser/mixed3.cl b/tests/parser/mixed3.cl deleted file mode 100644 index 1bdcad743..000000000 --- a/tests/parser/mixed3.cl +++ /dev/null @@ -1,40 +0,0 @@ -class Main inherits IO { - main() : Object { - { - out_string("Enter a number to check if number is prime\n"); - let i : Int <- in_int() in { - if(i <= 1) then { - out_string("Invalid Input\n"); - abort(); - } else { - if (isPrime(i) = 1) then - out_string("Number is prime\n") - else - out_string("Number is composite\n") - fi; - } - fi; - }; - } - }; - - mod(i : Int, ) : Int { -- Formal list must be comma separated. A comma does not terminate a list of formals. - i - (i/k)*k - }; - - isPrime(i : Int) : Int { - { - let x : Int <- 2, - c : Int <- 1 in - { - while (not (x = i)) loop - if (mod(i, x) = 0) then { - c <- 0; - x <- i; - } else x <- x + 1 fi - pool; - c; - }; - } - }; -}; diff --git a/tests/parser/mixed3_error.txt b/tests/parser/mixed3_error.txt deleted file mode 100644 index 159bdca63..000000000 --- a/tests/parser/mixed3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(21, 18) - SyntacticError: ERROR at or near ")" \ No newline at end of file diff --git a/tests/parser/mixed4.cl b/tests/parser/mixed4.cl deleted file mode 100644 index e752253be..000000000 --- a/tests/parser/mixed4.cl +++ /dev/null @@ -1,21 +0,0 @@ -class Main inherits IO { - main() : Object { - { - out_string("Enter number of numbers to multiply\n"); - out_int(prod(in_int())); - out_string("\n"); - } - }; - - prod(i : Int) : Int { - let y : Int <- 1 in { - while (not (i = 0) ) loop { - out_string("Enter Number: "); - y <- y * in_int(Main : Int); -- the parser correctly catches the error here - i <- i - 1; - } - pool; - y; - } - }; -}; diff --git a/tests/parser/mixed4_error.txt b/tests/parser/mixed4_error.txt deleted file mode 100644 index 2349f28a5..000000000 --- a/tests/parser/mixed4_error.txt +++ /dev/null @@ -1 +0,0 @@ -(14, 41) - SyntacticError: ERROR at or near "Main" \ No newline at end of file diff --git a/tests/parser/mixed5.cl b/tests/parser/mixed5.cl deleted file mode 100644 index c9176a890..000000000 --- a/tests/parser/mixed5.cl +++ /dev/null @@ -1,20 +0,0 @@ -class Main inherits IO { - str <- "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; - main() : Object { - { - out_string("Enter number of numbers to multiply\n"); - out_int(prod(in_int())); - out_string("\n"); - } - }; - prod(i : Int) : Int { - let y : Int <- 1 in { - while (not (i = 0) ) loop { - out_string("Enter Number: "); - y <- y * in_int(); - i <- i - 1; - } - y; - } - }; -} diff --git a/tests/parser/mixed5_error.txt b/tests/parser/mixed5_error.txt deleted file mode 100644 index 443037eca..000000000 --- a/tests/parser/mixed5_error.txt +++ /dev/null @@ -1 +0,0 @@ -(2, 9) - SyntacticError: ERROR at or near ASSIGN \ No newline at end of file diff --git a/tests/parser/mixed6.cl b/tests/parser/mixed6.cl deleted file mode 100644 index 5da80da31..000000000 --- a/tests/parser/mixed6.cl +++ /dev/null @@ -1,5 +0,0 @@ -classs Doom { - i : Int <- 0; - main() : Object { - if i = 0 then out_string("This is da real *h*t") - diff --git a/tests/parser/mixed6_error.txt b/tests/parser/mixed6_error.txt deleted file mode 100644 index af75ca925..000000000 --- a/tests/parser/mixed6_error.txt +++ /dev/null @@ -1 +0,0 @@ -(1, 1) - SyntacticError: ERROR at or near "classs" \ No newline at end of file diff --git a/tests/parser/operation1.cl b/tests/parser/operation1.cl deleted file mode 100644 index d38eb72d0..000000000 --- a/tests/parser/operation1.cl +++ /dev/null @@ -1,101 +0,0 @@ -(* Cool has four binary arithmetic operations: +, -, *, /. *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + 2 of - x: Int => new IO.out_string("Es un entero!"); - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; - - a: Int <- 1; - - testing8(x: Int, y: Int): Bool { - let z: Int <- 3, w: Int <- 4 - -- Missing ')' - in isvoid (3 + a * (x / w + new Int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a)/(0)*(((4 * 4))))) - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/operation1_error.txt b/tests/parser/operation1_error.txt deleted file mode 100644 index b30202399..000000000 --- a/tests/parser/operation1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(74, 5) - SyntacticError: ERROR at or near "}" \ No newline at end of file diff --git a/tests/parser/operation2.cl b/tests/parser/operation2.cl deleted file mode 100644 index 2dc628359..000000000 --- a/tests/parser/operation2.cl +++ /dev/null @@ -1,101 +0,0 @@ -(* Cool has four binary arithmetic operations: +, -, *, /. *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + 2 of - x: Int => new IO.out_string("Es un entero!"); - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; - - a: Int <- 1; - - testing8(x: Int, y: Int): Bool { - let z: Int <- 3, w: Int <- 4 - -- Type identifiers starts with a uppercase letter - in isvoid (3 + a * (x / w + new int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/operation2_error.txt b/tests/parser/operation2_error.txt deleted file mode 100644 index 37b458f3a..000000000 --- a/tests/parser/operation2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(73, 41) - SyntacticError: ERROR at or near "int" \ No newline at end of file diff --git a/tests/parser/operation3.cl b/tests/parser/operation3.cl deleted file mode 100644 index 61d6cbfa8..000000000 --- a/tests/parser/operation3.cl +++ /dev/null @@ -1,101 +0,0 @@ -(* Cool has four binary arithmetic operations: +, -, *, /. *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + 2 of - x: Int => new IO.out_string("Es un entero!"); - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; - - a: Int <- 1; - - testing8(x: Int, y: Int): Bool { - let z: Int <- 3, w: Int <- 4 - -- Object identifiers starts with a lowercase letter - in isvoid (3 + a * (x / w + new Int) - y - (((if tRue = not faLSe then ~Mazinger_Z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/operation3_error.txt b/tests/parser/operation3_error.txt deleted file mode 100644 index 6b266f3f3..000000000 --- a/tests/parser/operation3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(73, 81) - SyntacticError: ERROR at or near "Mazinger_Z" \ No newline at end of file diff --git a/tests/parser/operation4.cl b/tests/parser/operation4.cl deleted file mode 100644 index bae7de5b5..000000000 --- a/tests/parser/operation4.cl +++ /dev/null @@ -1,101 +0,0 @@ -(* Cool has four binary arithmetic operations: +, -, *, /. *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + 2 of - x: Int => new IO.out_string("Es un entero!"); - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; - - a: Int <- 1; - - testing8(x: Int, y: Int): Bool { - let z: Int <- 3, w: Int <- 4 - -- Double "+" - in isvoid (3 + a * (x / w++ new Int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/operation4_error.txt b/tests/parser/operation4_error.txt deleted file mode 100644 index e0ebb0985..000000000 --- a/tests/parser/operation4_error.txt +++ /dev/null @@ -1 +0,0 @@ -(73, 35) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/program1.cl b/tests/parser/program1.cl deleted file mode 100644 index 8e5cf617f..000000000 --- a/tests/parser/program1.cl +++ /dev/null @@ -1 +0,0 @@ -(* A Cool program can't be empty *) \ No newline at end of file diff --git a/tests/parser/program1_error.txt b/tests/parser/program1_error.txt deleted file mode 100644 index de00ac46b..000000000 --- a/tests/parser/program1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(0, 0) - SyntacticError: ERROR at or near EOF \ No newline at end of file diff --git a/tests/parser/program2.cl b/tests/parser/program2.cl deleted file mode 100644 index f8b16779c..000000000 --- a/tests/parser/program2.cl +++ /dev/null @@ -1,20 +0,0 @@ -(* Cool programs are sets of classes *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - --- Missing semicolon -class Test { - testing(): Int { - 2 + 2 - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; diff --git a/tests/parser/program2_error.txt b/tests/parser/program2_error.txt deleted file mode 100644 index 94ba8df65..000000000 --- a/tests/parser/program2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(16, 1) - SyntacticError: ERROR at or near CLASS \ No newline at end of file diff --git a/tests/parser/program3.cl b/tests/parser/program3.cl deleted file mode 100644 index e27889c57..000000000 --- a/tests/parser/program3.cl +++ /dev/null @@ -1,24 +0,0 @@ -(* Cool programs are sets of classes *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - testing(): Int { - 2 + 2 - }; -}; - --- Only classes -suma(a: Int, b: Int) int { - a + b -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; diff --git a/tests/parser/program3_error.txt b/tests/parser/program3_error.txt deleted file mode 100644 index dd3b3947a..000000000 --- a/tests/parser/program3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(16, 1) - SyntacticError: ERROR at or near "suma" \ No newline at end of file diff --git a/tests/parser_test.py b/tests/parser_test.py deleted file mode 100644 index 505be03c7..000000000 --- a/tests/parser_test.py +++ /dev/null @@ -1,14 +0,0 @@ -import pytest -import os -from .utils import compare_errors - -tests_dir = __file__.rpartition('/')[0] + '/parser/' -tests = [file for file in os.listdir(tests_dir) if file.endswith('.cl')] - - -@pytest.mark.parser -@pytest.mark.add_error_production -@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') diff --git a/tests/semantic/hello_world.cl b/tests/semantic/hello_world.cl deleted file mode 100755 index 0c818f908..000000000 --- a/tests/semantic/hello_world.cl +++ /dev/null @@ -1,5 +0,0 @@ -class Main inherits IO { - main(): IO { - out_string("Hello, World.\n") - }; -}; diff --git a/tests/semantic_test.py b/tests/semantic_test.py deleted file mode 100644 index 34488149c..000000000 --- a/tests/semantic_test.py +++ /dev/null @@ -1,14 +0,0 @@ -import pytest -import os -from .utils import compare_errors - -tests_dir = __file__.rpartition('/')[0] + '/semantic/' -tests = [file for file in os.listdir(tests_dir) if file.endswith('.cl')] - - -@pytest.mark.semantic -@pytest.mark.add_error_production -@pytest.mark.run(order=3) -@pytest.mark.parametrize("cool_file", []) -def test_semantic_errors(compiler_path, cool_file): - compare_errors(compiler_path, tests_dir + cool_file, tests_dir + cool_file[:-3] + '_error.txt') diff --git a/tests/utils/__init__.py b/tests/utils/__init__.py deleted file mode 100644 index 90f60fdd8..000000000 --- a/tests/utils/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .utils import * \ No newline at end of file diff --git a/tests/utils/utils.py b/tests/utils/utils.py deleted file mode 100644 index 9d58ac3f5..000000000 --- a/tests/utils/utils.py +++ /dev/null @@ -1,56 +0,0 @@ -import subprocess -import re - - -COMPILER_TIMEOUT = 'El compilador tarda mucho en responder.' -TEST_MUST_FAIL = 'El test %s debe fallar al compilar' -TEST_MUST_COMPILE = 'El test %s debe compilar' -BAD_ERROR_FORMAT = '''El error no esta en formato: (,) - : - o no se encuentra en la 3ra linea''' -UNEXPECTED_ERROR = 'Se esperaba un %s en (%d, %d). Su error fue un %s en (%d, %d)' - -ERROR_FORMAT = r'^\s*\(\s*(\d+)\s*,\s*(\d+)\s*\)\s*-\s*(\w+)\s*:(.*)$' - -def parse_error(error: str): - merror = re.fullmatch(ERROR_FORMAT, error) - assert merror, BAD_ERROR_FORMAT - - return (t(x) for t, x in zip([int, int, str, str], merror.groups())) - - -def first_error(compiler_output: list, errors: list): - line, column, error_type, _ = parse_error(errors[0]) - - oline, ocolumn, oerror_type, _ = parse_error(compiler_output[0]) - - assert line == oline and column == ocolumn and error_type == oerror_type,\ - UNEXPECTED_ERROR % (error_type, line, column, oerror_type, oline, ocolumn) - - -def get_file_name(path: str): - try: - return path[path.rindex('/') + 1:] - except ValueError: - return path - -def compare_errors(compiler_path: str, cool_file_path: str, error_file_path: str, cmp=first_error, timeout=100): - try: - sp = subprocess.run(['bash', compiler_path, cool_file_path], capture_output=True, timeout=timeout) - return_code, output = sp.returncode, sp.stdout.decode() - except TimeoutError: - assert False, COMPILER_TIMEOUT - - compiler_output = output.split('\n') - - if error_file_path: - assert return_code == 1, TEST_MUST_FAIL % get_file_name(cool_file_path) - - fd = open(error_file_path, 'r') - errors = fd.read().split('\n') - fd.close() - - # checking the errors of compiler - cmp(compiler_output[2:], errors) - else: - print(return_code, output) - assert return_code == 0, TEST_MUST_COMPILE % get_file_name(cool_file_path) \ No newline at end of file From c6065703baee4e8d785ef7cf3d61655d160eefd3 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Sat, 25 Apr 2020 18:41:48 -0400 Subject: [PATCH 020/143] Added examples in tests folder --- tests/lexer/comment1.cl | 55 ++++++++++++ tests/lexer/comment1_error.txt | 1 + tests/lexer/iis1.cl | 111 ++++++++++++++++++++++++ tests/lexer/iis1_error.txt | 1 + tests/lexer/iis2.cl | 120 ++++++++++++++++++++++++++ tests/lexer/iis2_error.txt | 1 + tests/lexer/iis3.cl | 121 +++++++++++++++++++++++++++ tests/lexer/iis3_error.txt | 1 + tests/lexer/iis4.cl | 120 ++++++++++++++++++++++++++ tests/lexer/iis4_error.txt | 1 + tests/lexer/iis5.cl | 121 +++++++++++++++++++++++++++ tests/lexer/iis5_error.txt | 2 + tests/lexer/iis6.cl | 125 ++++++++++++++++++++++++++++ tests/lexer/iis6_error.txt | 1 + tests/lexer/mixed1.cl | 14 ++++ tests/lexer/mixed1_error.txt | 1 + tests/lexer/mixed2.cl | 20 +++++ tests/lexer/mixed2_error.txt | 3 + tests/lexer/string1.cl | 6 ++ tests/lexer/string1_error.txt | 2 + tests/lexer/string2.cl | 19 +++++ tests/lexer/string2_error.txt | 1 + tests/lexer/string3.cl | Bin 0 -> 234 bytes tests/lexer/string3_error.txt | 1 + tests/lexer/string4.cl | 38 +++++++++ tests/lexer/string4_error.txt | 3 + tests/parser/assignment1.cl | 37 ++++++++ tests/parser/assignment1_error.txt | 1 + tests/parser/assignment2.cl | 37 ++++++++ tests/parser/assignment2_error.txt | 1 + tests/parser/assignment3.cl | 37 ++++++++ tests/parser/assignment3_error.txt | 1 + tests/parser/attribute1.cl | 34 ++++++++ tests/parser/attribute1_error.txt | 1 + tests/parser/attribute2.cl | 34 ++++++++ tests/parser/attribute2_error.txt | 1 + tests/parser/attribute3.cl | 34 ++++++++ tests/parser/attribute3_error.txt | 1 + tests/parser/block1.cl | 87 +++++++++++++++++++ tests/parser/block1_error.txt | 1 + tests/parser/block2.cl | 87 +++++++++++++++++++ tests/parser/block2_error.txt | 1 + tests/parser/block3.cl | 87 +++++++++++++++++++ tests/parser/block3_error.txt | 1 + tests/parser/block4.cl | 88 ++++++++++++++++++++ tests/parser/block4_error.txt | 1 + tests/parser/case1.cl | 91 ++++++++++++++++++++ tests/parser/case1_error.txt | 1 + tests/parser/case2.cl | 93 +++++++++++++++++++++ tests/parser/case2_error.txt | 1 + tests/parser/case3.cl | 93 +++++++++++++++++++++ tests/parser/case3_error.txt | 1 + tests/parser/case4.cl | 93 +++++++++++++++++++++ tests/parser/case4_error.txt | 1 + tests/parser/case5.cl | 93 +++++++++++++++++++++ tests/parser/case5_error.txt | 1 + tests/parser/case6.cl | 93 +++++++++++++++++++++ tests/parser/case6_error.txt | 1 + tests/parser/class1.cl | 20 +++++ tests/parser/class1_error.txt | 1 + tests/parser/class2.cl | 20 +++++ tests/parser/class2_error.txt | 1 + tests/parser/class3.cl | 34 ++++++++ tests/parser/class3_error.txt | 1 + tests/parser/class4.cl | 36 ++++++++ tests/parser/class4_error.txt | 1 + tests/parser/class5.cl | 34 ++++++++ tests/parser/class5_error.txt | 1 + tests/parser/class6.cl | 34 ++++++++ tests/parser/class6_error.txt | 1 + tests/parser/conditional1.cl | 69 +++++++++++++++ tests/parser/conditional1_error.txt | 1 + tests/parser/conditional2.cl | 69 +++++++++++++++ tests/parser/conditional2_error.txt | 1 + tests/parser/conditional3.cl | 69 +++++++++++++++ tests/parser/conditional3_error.txt | 1 + tests/parser/conditional4.cl | 73 ++++++++++++++++ tests/parser/conditional4_error.txt | 1 + tests/parser/conditional5.cl | 73 ++++++++++++++++ tests/parser/conditional5_error.txt | 1 + tests/parser/conditional6.cl | 73 ++++++++++++++++ tests/parser/conditional6_error.txt | 1 + tests/parser/dispatch1.cl | 45 ++++++++++ tests/parser/dispatch1_error.txt | 1 + tests/parser/dispatch2.cl | 45 ++++++++++ tests/parser/dispatch2_error.txt | 1 + tests/parser/dispatch3.cl | 45 ++++++++++ tests/parser/dispatch3_error.txt | 1 + tests/parser/dispatch4.cl | 53 ++++++++++++ tests/parser/dispatch4_error.txt | 1 + tests/parser/dispatch5.cl | 53 ++++++++++++ tests/parser/dispatch5_error.txt | 1 + tests/parser/dispatch6.cl | 57 +++++++++++++ tests/parser/dispatch6_error.txt | 1 + tests/parser/dispatch7.cl | 57 +++++++++++++ tests/parser/dispatch7_error.txt | 1 + tests/parser/dispatch8.cl | 57 +++++++++++++ tests/parser/dispatch8_error.txt | 1 + tests/parser/dispatch9.cl | 61 ++++++++++++++ tests/parser/dispatch9_error.txt | 1 + tests/parser/let1.cl | 85 +++++++++++++++++++ tests/parser/let1_error.txt | 1 + tests/parser/let2.cl | 85 +++++++++++++++++++ tests/parser/let2_error.txt | 1 + tests/parser/let3.cl | 85 +++++++++++++++++++ tests/parser/let3_error.txt | 1 + tests/parser/let4.cl | 85 +++++++++++++++++++ tests/parser/let4_error.txt | 1 + tests/parser/let5.cl | 85 +++++++++++++++++++ tests/parser/let5_error.txt | 1 + tests/parser/let6.cl | 74 ++++++++++++++++ tests/parser/let6_error.txt | 1 + tests/parser/let7.cl | 85 +++++++++++++++++++ tests/parser/let7_error.txt | 1 + tests/parser/loop1.cl | 78 +++++++++++++++++ tests/parser/loop1_error.txt | 1 + tests/parser/loop2.cl | 78 +++++++++++++++++ tests/parser/loop2_error.txt | 1 + tests/parser/loop3.cl | 78 +++++++++++++++++ tests/parser/loop3_error.txt | 1 + tests/parser/loop4.cl | 78 +++++++++++++++++ tests/parser/loop4_error.txt | 1 + tests/parser/method1.cl | 34 ++++++++ tests/parser/method1_error.txt | 1 + tests/parser/method2.cl | 34 ++++++++ tests/parser/method2_error.txt | 1 + tests/parser/method3.cl | 34 ++++++++ tests/parser/method3_error.txt | 1 + tests/parser/method4.cl | 34 ++++++++ tests/parser/method4_error.txt | 1 + tests/parser/method5.cl | 34 ++++++++ tests/parser/method5_error.txt | 1 + tests/parser/method6.cl | 33 ++++++++ tests/parser/method6_error.txt | 1 + tests/parser/mixed1.cl | 100 ++++++++++++++++++++++ tests/parser/mixed1_error.txt | 1 + tests/parser/mixed2.cl | 14 ++++ tests/parser/mixed2_error.txt | 1 + tests/parser/mixed3.cl | 40 +++++++++ tests/parser/mixed3_error.txt | 1 + tests/parser/mixed4.cl | 21 +++++ tests/parser/mixed4_error.txt | 1 + tests/parser/mixed5.cl | 20 +++++ tests/parser/mixed5_error.txt | 1 + tests/parser/mixed6.cl | 5 ++ tests/parser/mixed6_error.txt | 1 + tests/parser/operation1.cl | 101 ++++++++++++++++++++++ tests/parser/operation1_error.txt | 1 + tests/parser/operation2.cl | 101 ++++++++++++++++++++++ tests/parser/operation2_error.txt | 1 + tests/parser/operation3.cl | 101 ++++++++++++++++++++++ tests/parser/operation3_error.txt | 1 + tests/parser/operation4.cl | 101 ++++++++++++++++++++++ tests/parser/operation4_error.txt | 1 + tests/parser/program1.cl | 1 + tests/parser/program1_error.txt | 1 + tests/parser/program2.cl | 20 +++++ tests/parser/program2_error.txt | 1 + tests/parser/program3.cl | 24 ++++++ tests/parser/program3_error.txt | 1 + tests/semantic/hello_world.cl | 5 ++ 161 files changed, 4904 insertions(+) create mode 100644 tests/lexer/comment1.cl create mode 100644 tests/lexer/comment1_error.txt create mode 100644 tests/lexer/iis1.cl create mode 100644 tests/lexer/iis1_error.txt create mode 100644 tests/lexer/iis2.cl create mode 100644 tests/lexer/iis2_error.txt create mode 100644 tests/lexer/iis3.cl create mode 100644 tests/lexer/iis3_error.txt create mode 100644 tests/lexer/iis4.cl create mode 100644 tests/lexer/iis4_error.txt create mode 100644 tests/lexer/iis5.cl create mode 100644 tests/lexer/iis5_error.txt create mode 100644 tests/lexer/iis6.cl create mode 100644 tests/lexer/iis6_error.txt create mode 100644 tests/lexer/mixed1.cl create mode 100644 tests/lexer/mixed1_error.txt create mode 100644 tests/lexer/mixed2.cl create mode 100644 tests/lexer/mixed2_error.txt create mode 100644 tests/lexer/string1.cl create mode 100644 tests/lexer/string1_error.txt create mode 100644 tests/lexer/string2.cl create mode 100644 tests/lexer/string2_error.txt create mode 100644 tests/lexer/string3.cl create mode 100644 tests/lexer/string3_error.txt create mode 100644 tests/lexer/string4.cl create mode 100644 tests/lexer/string4_error.txt create mode 100644 tests/parser/assignment1.cl create mode 100644 tests/parser/assignment1_error.txt create mode 100644 tests/parser/assignment2.cl create mode 100644 tests/parser/assignment2_error.txt create mode 100644 tests/parser/assignment3.cl create mode 100644 tests/parser/assignment3_error.txt create mode 100644 tests/parser/attribute1.cl create mode 100644 tests/parser/attribute1_error.txt create mode 100644 tests/parser/attribute2.cl create mode 100644 tests/parser/attribute2_error.txt create mode 100644 tests/parser/attribute3.cl create mode 100644 tests/parser/attribute3_error.txt create mode 100644 tests/parser/block1.cl create mode 100644 tests/parser/block1_error.txt create mode 100644 tests/parser/block2.cl create mode 100644 tests/parser/block2_error.txt create mode 100644 tests/parser/block3.cl create mode 100644 tests/parser/block3_error.txt create mode 100644 tests/parser/block4.cl create mode 100644 tests/parser/block4_error.txt create mode 100644 tests/parser/case1.cl create mode 100644 tests/parser/case1_error.txt create mode 100644 tests/parser/case2.cl create mode 100644 tests/parser/case2_error.txt create mode 100644 tests/parser/case3.cl create mode 100644 tests/parser/case3_error.txt create mode 100644 tests/parser/case4.cl create mode 100644 tests/parser/case4_error.txt create mode 100644 tests/parser/case5.cl create mode 100644 tests/parser/case5_error.txt create mode 100644 tests/parser/case6.cl create mode 100644 tests/parser/case6_error.txt create mode 100644 tests/parser/class1.cl create mode 100644 tests/parser/class1_error.txt create mode 100644 tests/parser/class2.cl create mode 100644 tests/parser/class2_error.txt create mode 100644 tests/parser/class3.cl create mode 100644 tests/parser/class3_error.txt create mode 100644 tests/parser/class4.cl create mode 100644 tests/parser/class4_error.txt create mode 100644 tests/parser/class5.cl create mode 100644 tests/parser/class5_error.txt create mode 100644 tests/parser/class6.cl create mode 100644 tests/parser/class6_error.txt create mode 100644 tests/parser/conditional1.cl create mode 100644 tests/parser/conditional1_error.txt create mode 100644 tests/parser/conditional2.cl create mode 100644 tests/parser/conditional2_error.txt create mode 100644 tests/parser/conditional3.cl create mode 100644 tests/parser/conditional3_error.txt create mode 100644 tests/parser/conditional4.cl create mode 100644 tests/parser/conditional4_error.txt create mode 100644 tests/parser/conditional5.cl create mode 100644 tests/parser/conditional5_error.txt create mode 100644 tests/parser/conditional6.cl create mode 100644 tests/parser/conditional6_error.txt create mode 100644 tests/parser/dispatch1.cl create mode 100644 tests/parser/dispatch1_error.txt create mode 100644 tests/parser/dispatch2.cl create mode 100644 tests/parser/dispatch2_error.txt create mode 100644 tests/parser/dispatch3.cl create mode 100644 tests/parser/dispatch3_error.txt create mode 100644 tests/parser/dispatch4.cl create mode 100644 tests/parser/dispatch4_error.txt create mode 100644 tests/parser/dispatch5.cl create mode 100644 tests/parser/dispatch5_error.txt create mode 100644 tests/parser/dispatch6.cl create mode 100644 tests/parser/dispatch6_error.txt create mode 100644 tests/parser/dispatch7.cl create mode 100644 tests/parser/dispatch7_error.txt create mode 100644 tests/parser/dispatch8.cl create mode 100644 tests/parser/dispatch8_error.txt create mode 100644 tests/parser/dispatch9.cl create mode 100644 tests/parser/dispatch9_error.txt create mode 100644 tests/parser/let1.cl create mode 100644 tests/parser/let1_error.txt create mode 100644 tests/parser/let2.cl create mode 100644 tests/parser/let2_error.txt create mode 100644 tests/parser/let3.cl create mode 100644 tests/parser/let3_error.txt create mode 100644 tests/parser/let4.cl create mode 100644 tests/parser/let4_error.txt create mode 100644 tests/parser/let5.cl create mode 100644 tests/parser/let5_error.txt create mode 100644 tests/parser/let6.cl create mode 100644 tests/parser/let6_error.txt create mode 100644 tests/parser/let7.cl create mode 100644 tests/parser/let7_error.txt create mode 100644 tests/parser/loop1.cl create mode 100644 tests/parser/loop1_error.txt create mode 100644 tests/parser/loop2.cl create mode 100644 tests/parser/loop2_error.txt create mode 100644 tests/parser/loop3.cl create mode 100644 tests/parser/loop3_error.txt create mode 100644 tests/parser/loop4.cl create mode 100644 tests/parser/loop4_error.txt create mode 100644 tests/parser/method1.cl create mode 100644 tests/parser/method1_error.txt create mode 100644 tests/parser/method2.cl create mode 100644 tests/parser/method2_error.txt create mode 100644 tests/parser/method3.cl create mode 100644 tests/parser/method3_error.txt create mode 100644 tests/parser/method4.cl create mode 100644 tests/parser/method4_error.txt create mode 100644 tests/parser/method5.cl create mode 100644 tests/parser/method5_error.txt create mode 100644 tests/parser/method6.cl create mode 100644 tests/parser/method6_error.txt create mode 100644 tests/parser/mixed1.cl create mode 100644 tests/parser/mixed1_error.txt create mode 100644 tests/parser/mixed2.cl create mode 100644 tests/parser/mixed2_error.txt create mode 100644 tests/parser/mixed3.cl create mode 100644 tests/parser/mixed3_error.txt create mode 100644 tests/parser/mixed4.cl create mode 100644 tests/parser/mixed4_error.txt create mode 100644 tests/parser/mixed5.cl create mode 100644 tests/parser/mixed5_error.txt create mode 100644 tests/parser/mixed6.cl create mode 100644 tests/parser/mixed6_error.txt create mode 100644 tests/parser/operation1.cl create mode 100644 tests/parser/operation1_error.txt create mode 100644 tests/parser/operation2.cl create mode 100644 tests/parser/operation2_error.txt create mode 100644 tests/parser/operation3.cl create mode 100644 tests/parser/operation3_error.txt create mode 100644 tests/parser/operation4.cl create mode 100644 tests/parser/operation4_error.txt create mode 100644 tests/parser/program1.cl create mode 100644 tests/parser/program1_error.txt create mode 100644 tests/parser/program2.cl create mode 100644 tests/parser/program2_error.txt create mode 100644 tests/parser/program3.cl create mode 100644 tests/parser/program3_error.txt create mode 100755 tests/semantic/hello_world.cl diff --git a/tests/lexer/comment1.cl b/tests/lexer/comment1.cl new file mode 100644 index 000000000..69533f23c --- /dev/null +++ b/tests/lexer/comment1.cl @@ -0,0 +1,55 @@ +--Any characters between two dashes “--” and the next newline +--(or EOF, if there is no next newline) are treated as comments + +(*(*(* +Comments may also be written by enclosing +text in (∗ . . . ∗). The latter form of comment may be nested. +Comments cannot cross file boundaries. +*)*)*) + +class Error() { + + (* There was once a comment, + that was quite long. + But, the reader soon discovered that + the comment was indeed longer than + previously assumed. Now, the reader + was in a real dilemma; is the comment + ever gonna end? If I stop reading, will + it end? + He started imagining all sorts of things. + He thought about heisenberg's cat and how + how that relates to the end of the sentence. + He thought to himself "I'm gonna stop reading". + "If I keep reading this comment, I'm gonna know + the fate of this sentence; That will be disastorous." + He knew that such a comment was gonna extend to + another file. It was too awesome to be contained in + a single file. And he would have kept reading too... + if only... + cool wasn't a super-duper-fab-awesomest language; + but cool is that language; + "This comment shall go not cross this file" said cool. + Alas! The reader could read no more. + There was once a comment, + that was quite long. + But, the reader soon discovered that + the comment was indeed longer than + previously assumed. Now, the reader + was in a real dilemma; is the comment + ever gonna end? If I stop reading, will + it end? + He started imagining all sorts of things. + He thought about heisenberg's cat and how + how that relates to the end of the sentence. + He thought to himself "I'm gonna stop reading". + "If I keep reading this comment, I'm gonna know + the fate of this sentence; That will be disastorous." + He knew that such a comment was gonna extend to + another file. It was too awesome to be contained in + a single file. And he would have kept reading too... + if only... + cool wasn't a super-duper-fab-awesomest language; + but cool is that language; + "This comment shall go not cross this file" said cool. + Alas! The reader could read no more. \ No newline at end of file diff --git a/tests/lexer/comment1_error.txt b/tests/lexer/comment1_error.txt new file mode 100644 index 000000000..9fd7b8d67 --- /dev/null +++ b/tests/lexer/comment1_error.txt @@ -0,0 +1 @@ +(55, 46) - LexicographicError: EOF in comment diff --git a/tests/lexer/iis1.cl b/tests/lexer/iis1.cl new file mode 100644 index 000000000..12cb52beb --- /dev/null +++ b/tests/lexer/iis1.cl @@ -0,0 +1,111 @@ +(* Integers, Identifiers, and Special Notation *) + +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ +5! = 120, 2 + 2 = 5 or E = mc2; p + 1 @ p = 1: for x in range(len(b)) +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) +class Class if then else fi testing Testing ~007agent_bond james_007B0N3SS___ +loop pool while tRuE or noT faLsE let in case of ESAC + +(* +#3 INT_CONST 0007 +#3 INT_CONST 123 +#3 '+' +#3 INT_CONST 1 +#3 '-' +#3 INT_CONST 1 +#3 '+' +#3 INT_CONST 90 +#3 '-' +#3 INT_CONST 09 +#3 '+' +#3 INT_CONST 11113 +#3 '-' +#3 INT_CONST 4 +#3 OBJECTID r +#3 '*' +#3 OBJECTID a +#3 '*' +#3 OBJECTID self +#3 '*' +#3 OBJECTID c +#3 '+' +#3 '+' +#4 INT_CONST 5 +#4 ERROR "!" +#4 '=' +#4 INT_CONST 120 +#4 ',' +#4 INT_CONST 2 +#4 '+' +#4 INT_CONST 2 +#4 '=' +#4 INT_CONST 5 +#4 OBJECTID or +#4 TYPEID E +#4 '=' +#4 OBJECTID mc2 +#4 ';' +#4 OBJECTID p +#4 '+' +#4 INT_CONST 1 +#4 '@' +#4 OBJECTID p +#4 '=' +#4 INT_CONST 1 +#4 ':' +#4 OBJECTID for +#4 OBJECTID x +#4 IN +#4 OBJECTID range +#4 '(' +#4 OBJECTID len +#4 '(' +#4 OBJECTID b +#4 ')' +#4 ')' +#5 NEW +#5 '/' +#5 ASSIGN +#5 '<' +#5 LE +#5 DARROW +#5 '{' +#5 '(' +#5 TYPEID Int +#5 ':' +#5 TYPEID Objet +#5 ',' +#5 TYPEID Bool +#5 ';' +#5 TYPEID String +#5 '.' +#5 OBJECTID string +#5 TYPEID SELF_TYPE +#5 ISVOID +#5 '}' +#5 ')' +#6 CLASS +#6 CLASS +#6 IF +#6 THEN +#6 ELSE +#6 FI +#6 OBJECTID testing +#6 TYPEID Testing +#6 '~' +#6 INT_CONST 007 +#6 OBJECTID agent_bond +#6 OBJECTID james_007B0N3SS___ +#7 LOOP +#7 POOL +#7 WHILE +#7 BOOL_CONST true +#7 OBJECTID or +#7 NOT +#7 BOOL_CONST false +#7 LET +#7 IN +#7 CASE +#7 OF +#7 ESAC +*) \ No newline at end of file diff --git a/tests/lexer/iis1_error.txt b/tests/lexer/iis1_error.txt new file mode 100644 index 000000000..9e6d66cac --- /dev/null +++ b/tests/lexer/iis1_error.txt @@ -0,0 +1 @@ +(4, 2) - LexicographicError: ERROR "!" diff --git a/tests/lexer/iis2.cl b/tests/lexer/iis2.cl new file mode 100644 index 000000000..9b25715d4 --- /dev/null +++ b/tests/lexer/iis2.cl @@ -0,0 +1,120 @@ +(* Integers, Identifiers, and Special Notation *) + +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ +class Class if then else fi testing Testing ~007agent_bond james_007bones___ + + +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) +loop pool while tRuE or noT faLsE let in case of ESAC + +factorial(5) = 120, 2 + 2 = 5? or E = mc2; p + 1 resto p = 1: (@ for x in range(len(b))) + +(* +#3 INT_CONST 0007 +#3 INT_CONST 123 +#3 '+' +#3 INT_CONST 1 +#3 '-' +#3 INT_CONST 1 +#3 '+' +#3 INT_CONST 90 +#3 '-' +#3 INT_CONST 09 +#3 '+' +#3 INT_CONST 11113 +#3 '-' +#3 INT_CONST 4 +#3 OBJECTID r +#3 '*' +#3 OBJECTID a +#3 '*' +#3 OBJECTID self +#3 '*' +#3 OBJECTID c +#3 '+' +#3 '+' +#4 CLASS +#4 CLASS +#4 IF +#4 THEN +#4 ELSE +#4 FI +#4 OBJECTID testing +#4 TYPEID Testing +#4 '~' +#4 INT_CONST 007 +#4 OBJECTID agent_bond +#4 OBJECTID james_007bones___ +#7 NEW +#7 '/' +#7 ASSIGN +#7 '<' +#7 LE +#7 DARROW +#7 '{' +#7 '(' +#7 TYPEID Int +#7 ':' +#7 TYPEID Objet +#7 ',' +#7 TYPEID Bool +#7 ';' +#7 TYPEID String +#7 '.' +#7 OBJECTID string +#7 TYPEID SELF_TYPE +#7 ISVOID +#7 '}' +#7 ')' +#8 LOOP +#8 POOL +#8 WHILE +#8 BOOL_CONST true +#8 OBJECTID or +#8 NOT +#8 BOOL_CONST false +#8 LET +#8 IN +#8 CASE +#8 OF +#8 ESAC +#10 OBJECTID factorial +#10 '(' +#10 INT_CONST 5 +#10 ')' +#10 '=' +#10 INT_CONST 120 +#10 ',' +#10 INT_CONST 2 +#10 '+' +#10 INT_CONST 2 +#10 '=' +#10 INT_CONST 5 +#10 ERROR "?" +#10 OBJECTID or +#10 TYPEID E +#10 '=' +#10 OBJECTID mc2 +#10 ';' +#10 OBJECTID p +#10 '+' +#10 INT_CONST 1 +#10 OBJECTID resto +#10 OBJECTID p +#10 '=' +#10 INT_CONST 1 +#10 ':' +#10 '(' +#10 '@' +#10 OBJECTID for +#10 OBJECTID x +#10 IN +#10 OBJECTID range +#10 '(' +#10 OBJECTID len +#10 '(' +#10 OBJECTID b +#10 ')' +#10 ')' +#10 ')' +*) \ No newline at end of file diff --git a/tests/lexer/iis2_error.txt b/tests/lexer/iis2_error.txt new file mode 100644 index 000000000..922391a9d --- /dev/null +++ b/tests/lexer/iis2_error.txt @@ -0,0 +1 @@ +(10, 30) - LexicographicError: ERROR "?" diff --git a/tests/lexer/iis3.cl b/tests/lexer/iis3.cl new file mode 100644 index 000000000..0b965ddea --- /dev/null +++ b/tests/lexer/iis3.cl @@ -0,0 +1,121 @@ +(* Integers, Identifiers, and Special Notation *) + +factorial(5) = 120, 2 + 2 = 5 or E = mc^2; p + 1 @ p = 1: z for x in range(len(b))) + +loop pool while tRuE or noT faLsE let in case of ESAC + +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) + + +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ +class Class if then else fi testing Testing ~007agent_bond james_007bones___ + +(* +#3 OBJECTID factorial +#3 '(' +#3 INT_CONST 5 +#3 ')' +#3 '=' +#3 INT_CONST 120 +#3 ',' +#3 INT_CONST 2 +#3 '+' +#3 INT_CONST 2 +#3 '=' +#3 INT_CONST 5 +#3 OBJECTID or +#3 TYPEID E +#3 '=' +#3 OBJECTID mc +#3 ERROR "^" +#3 INT_CONST 2 +#3 ';' +#3 OBJECTID p +#3 '+' +#3 INT_CONST 1 +#3 '@' +#3 OBJECTID p +#3 '=' +#3 INT_CONST 1 +#3 ':' +#3 OBJECTID z +#3 OBJECTID for +#3 OBJECTID x +#3 IN +#3 OBJECTID range +#3 '(' +#3 OBJECTID len +#3 '(' +#3 OBJECTID b +#3 ')' +#3 ')' +#3 ')' +#5 LOOP +#5 POOL +#5 WHILE +#5 BOOL_CONST true +#5 OBJECTID or +#5 NOT +#5 BOOL_CONST false +#5 LET +#5 IN +#5 CASE +#5 OF +#5 ESAC +#7 NEW +#7 '/' +#7 ASSIGN +#7 '<' +#7 LE +#7 DARROW +#7 '{' +#7 '(' +#7 TYPEID Int +#7 ':' +#7 TYPEID Objet +#7 ',' +#7 TYPEID Bool +#7 ';' +#7 TYPEID String +#7 '.' +#7 OBJECTID string +#7 TYPEID SELF_TYPE +#7 ISVOID +#7 '}' +#7 ')' +#10 INT_CONST 0007 +#10 INT_CONST 123 +#10 '+' +#10 INT_CONST 1 +#10 '-' +#10 INT_CONST 1 +#10 '+' +#10 INT_CONST 90 +#10 '-' +#10 INT_CONST 09 +#10 '+' +#10 INT_CONST 11113 +#10 '-' +#10 INT_CONST 4 +#10 OBJECTID r +#10 '*' +#10 OBJECTID a +#10 '*' +#10 OBJECTID self +#10 '*' +#10 OBJECTID c +#10 '+' +#10 '+' +#11 CLASS +#11 CLASS +#11 IF +#11 THEN +#11 ELSE +#11 FI +#11 OBJECTID testing +#11 TYPEID Testing +#11 '~' +#11 INT_CONST 007 +#11 OBJECTID agent_bond +#11 OBJECTID james_007bones___ +*) \ No newline at end of file diff --git a/tests/lexer/iis3_error.txt b/tests/lexer/iis3_error.txt new file mode 100644 index 000000000..b001b6a71 --- /dev/null +++ b/tests/lexer/iis3_error.txt @@ -0,0 +1 @@ +(3, 40) - LexicographicError: ERROR "^" diff --git a/tests/lexer/iis4.cl b/tests/lexer/iis4.cl new file mode 100644 index 000000000..9e7a9cb62 --- /dev/null +++ b/tests/lexer/iis4.cl @@ -0,0 +1,120 @@ +(* Integers, Identifiers, and Special Notation *) + +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ + +factorial(5) = 120, 2 + 2 = 5 or E = mc2; p + 1 % p = 1: @.@ for x in range(len(b))~ + + +loop pool while tRuE or noT faLsE let in case of ESAC +class Class if then else fi testing Testing ~007agent_bond james_007bones___ + +(* +#3 NEW +#3 '/' +#3 ASSIGN +#3 '<' +#3 LE +#3 DARROW +#3 '{' +#3 '(' +#3 TYPEID Int +#3 ':' +#3 TYPEID Objet +#3 ',' +#3 TYPEID Bool +#3 ';' +#3 TYPEID String +#3 '.' +#3 OBJECTID string +#3 TYPEID SELF_TYPE +#3 ISVOID +#3 '}' +#3 ')' +#4 INT_CONST 0007 +#4 INT_CONST 123 +#4 '+' +#4 INT_CONST 1 +#4 '-' +#4 INT_CONST 1 +#4 '+' +#4 INT_CONST 90 +#4 '-' +#4 INT_CONST 09 +#4 '+' +#4 INT_CONST 11113 +#4 '-' +#4 INT_CONST 4 +#4 OBJECTID r +#4 '*' +#4 OBJECTID a +#4 '*' +#4 OBJECTID self +#4 '*' +#4 OBJECTID c +#4 '+' +#4 '+' +#6 OBJECTID factorial +#6 '(' +#6 INT_CONST 5 +#6 ')' +#6 '=' +#6 INT_CONST 120 +#6 ',' +#6 INT_CONST 2 +#6 '+' +#6 INT_CONST 2 +#6 '=' +#6 INT_CONST 5 +#6 OBJECTID or +#6 TYPEID E +#6 '=' +#6 OBJECTID mc2 +#6 ';' +#6 OBJECTID p +#6 '+' +#6 INT_CONST 1 +#6 ERROR "%" +#6 OBJECTID p +#6 '=' +#6 INT_CONST 1 +#6 ':' +#6 '@' +#6 '.' +#6 '@' +#6 OBJECTID for +#6 OBJECTID x +#6 IN +#6 OBJECTID range +#6 '(' +#6 OBJECTID len +#6 '(' +#6 OBJECTID b +#6 ')' +#6 ')' +#6 '~' +#9 LOOP +#9 POOL +#9 WHILE +#9 BOOL_CONST true +#9 OBJECTID or +#9 NOT +#9 BOOL_CONST false +#9 LET +#9 IN +#9 CASE +#9 OF +#9 ESAC +#10 CLASS +#10 CLASS +#10 IF +#10 THEN +#10 ELSE +#10 FI +#10 OBJECTID testing +#10 TYPEID Testing +#10 '~' +#10 INT_CONST 007 +#10 OBJECTID agent_bond +#10 OBJECTID james_007bones___ +*) \ No newline at end of file diff --git a/tests/lexer/iis4_error.txt b/tests/lexer/iis4_error.txt new file mode 100644 index 000000000..f24076a8c --- /dev/null +++ b/tests/lexer/iis4_error.txt @@ -0,0 +1 @@ +(6, 49) - LexicographicError: ERROR "!" diff --git a/tests/lexer/iis5.cl b/tests/lexer/iis5.cl new file mode 100644 index 000000000..d146c0547 --- /dev/null +++ b/tests/lexer/iis5.cl @@ -0,0 +1,121 @@ +(* Integers, Identifiers, and Special Notation *) + + +loop pool while tRuE or noT faLsE let in case of ESAC +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) +class Class if then else fi testing Testing ~007agent_bond james_007bones___ + +factorial(5) = 120, 2 + 2 = 5 or E = mc2; p + 1 resto p = 1: [@.@ for x in range(len(b))] + +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ + +(* +#4 LOOP +#4 POOL +#4 WHILE +#4 BOOL_CONST true +#4 OBJECTID or +#4 NOT +#4 BOOL_CONST false +#4 LET +#4 IN +#4 CASE +#4 OF +#4 ESAC +#5 NEW +#5 '/' +#5 ASSIGN +#5 '<' +#5 LE +#5 DARROW +#5 '{' +#5 '(' +#5 TYPEID Int +#5 ':' +#5 TYPEID Objet +#5 ',' +#5 TYPEID Bool +#5 ';' +#5 TYPEID String +#5 '.' +#5 OBJECTID string +#5 TYPEID SELF_TYPE +#5 ISVOID +#5 '}' +#5 ')' +#6 CLASS +#6 CLASS +#6 IF +#6 THEN +#6 ELSE +#6 FI +#6 OBJECTID testing +#6 TYPEID Testing +#6 '~' +#6 INT_CONST 007 +#6 OBJECTID agent_bond +#6 OBJECTID james_007bones___ +#8 OBJECTID factorial +#8 '(' +#8 INT_CONST 5 +#8 ')' +#8 '=' +#8 INT_CONST 120 +#8 ',' +#8 INT_CONST 2 +#8 '+' +#8 INT_CONST 2 +#8 '=' +#8 INT_CONST 5 +#8 OBJECTID or +#8 TYPEID E +#8 '=' +#8 OBJECTID mc2 +#8 ';' +#8 OBJECTID p +#8 '+' +#8 INT_CONST 1 +#8 OBJECTID resto +#8 OBJECTID p +#8 '=' +#8 INT_CONST 1 +#8 ':' +#8 ERROR "[" +#8 '@' +#8 '.' +#8 '@' +#8 OBJECTID for +#8 OBJECTID x +#8 IN +#8 OBJECTID range +#8 '(' +#8 OBJECTID len +#8 '(' +#8 OBJECTID b +#8 ')' +#8 ')' +#8 ERROR "]" +#10 INT_CONST 0007 +#10 INT_CONST 123 +#10 '+' +#10 INT_CONST 1 +#10 '-' +#10 INT_CONST 1 +#10 '+' +#10 INT_CONST 90 +#10 '-' +#10 INT_CONST 09 +#10 '+' +#10 INT_CONST 11113 +#10 '-' +#10 INT_CONST 4 +#10 OBJECTID r +#10 '*' +#10 OBJECTID a +#10 '*' +#10 OBJECTID self +#10 '*' +#10 OBJECTID c +#10 '+' +#10 '+' +*) diff --git a/tests/lexer/iis5_error.txt b/tests/lexer/iis5_error.txt new file mode 100644 index 000000000..b3dbadcb6 --- /dev/null +++ b/tests/lexer/iis5_error.txt @@ -0,0 +1,2 @@ +(8, 62) - LexicographicError: ERROR "[" +(8, 89) - LexicographicError: ERROR "]" diff --git a/tests/lexer/iis6.cl b/tests/lexer/iis6.cl new file mode 100644 index 000000000..1042f132b --- /dev/null +++ b/tests/lexer/iis6.cl @@ -0,0 +1,125 @@ +(* Integers, Identifiers, and Special Notation *) + +factorial(5) = 120, 2 + 2 = 5 or E = mc2; p + 1 resto p = 1: {@.@ for x in range(len(b))} + +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) + + +class Class if then else fi testing Testing ~007agent_bond _james_007bones___ + + + +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ +loop pool while tRuE or noT faLsE let in case of ESAC + +(* +#3 OBJECTID factorial +#3 '(' +#3 INT_CONST 5 +#3 ')' +#3 '=' +#3 INT_CONST 120 +#3 ',' +#3 INT_CONST 2 +#3 '+' +#3 INT_CONST 2 +#3 '=' +#3 INT_CONST 5 +#3 OBJECTID or +#3 TYPEID E +#3 '=' +#3 OBJECTID mc2 +#3 ';' +#3 OBJECTID p +#3 '+' +#3 INT_CONST 1 +#3 OBJECTID resto +#3 OBJECTID p +#3 '=' +#3 INT_CONST 1 +#3 ':' +#3 '{' +#3 '@' +#3 '.' +#3 '@' +#3 OBJECTID for +#3 OBJECTID x +#3 IN +#3 OBJECTID range +#3 '(' +#3 OBJECTID len +#3 '(' +#3 OBJECTID b +#3 ')' +#3 ')' +#3 '}' +#5 NEW +#5 '/' +#5 ASSIGN +#5 '<' +#5 LE +#5 DARROW +#5 '{' +#5 '(' +#5 TYPEID Int +#5 ':' +#5 TYPEID Objet +#5 ',' +#5 TYPEID Bool +#5 ';' +#5 TYPEID String +#5 '.' +#5 OBJECTID string +#5 TYPEID SELF_TYPE +#5 ISVOID +#5 '}' +#5 ')' +#8 CLASS +#8 CLASS +#8 IF +#8 THEN +#8 ELSE +#8 FI +#8 OBJECTID testing +#8 TYPEID Testing +#8 '~' +#8 INT_CONST 007 +#8 OBJECTID agent_bond +#8 ERROR "_" +#8 OBJECTID james_007bones___ +#12 INT_CONST 0007 +#12 INT_CONST 123 +#12 '+' +#12 INT_CONST 1 +#12 '-' +#12 INT_CONST 1 +#12 '+' +#12 INT_CONST 90 +#12 '-' +#12 INT_CONST 09 +#12 '+' +#12 INT_CONST 11113 +#12 '-' +#12 INT_CONST 4 +#12 OBJECTID r +#12 '*' +#12 OBJECTID a +#12 '*' +#12 OBJECTID self +#12 '*' +#12 OBJECTID c +#12 '+' +#12 '+' +#13 LOOP +#13 POOL +#13 WHILE +#13 BOOL_CONST true +#13 OBJECTID or +#13 NOT +#13 BOOL_CONST false +#13 LET +#13 IN +#13 CASE +#13 OF +#13 ESAC +*) \ No newline at end of file diff --git a/tests/lexer/iis6_error.txt b/tests/lexer/iis6_error.txt new file mode 100644 index 000000000..d7fad9c79 --- /dev/null +++ b/tests/lexer/iis6_error.txt @@ -0,0 +1 @@ +(8, 60) - LexicographicError: ERROR "_" diff --git a/tests/lexer/mixed1.cl b/tests/lexer/mixed1.cl new file mode 100644 index 000000000..803d58ef5 --- /dev/null +++ b/tests/lexer/mixed1.cl @@ -0,0 +1,14 @@ +"lkjdsafkljdsalfj\u0000dsafdsaf\u0000djafslkjdsalf\nsdajf\" lkjfdsasdkjfl"123 +adsfasklj# +LKldsajf iNhERITS +"lkdsajf" + +(* +#1 STR_CONST "lkjdsafkljdsalfju0000dsafdsafu0000djafslkjdsalf\nsdajf\" lkjfdsasdkjfl" +#1 INT_CONST 123 +#2 OBJECTID adsfasklj +#2 ERROR "#" +#3 TYPEID LKldsajf +#3 INHERITS +#4 STR_CONST "lkdsajf" +*) \ No newline at end of file diff --git a/tests/lexer/mixed1_error.txt b/tests/lexer/mixed1_error.txt new file mode 100644 index 000000000..99af5fbdc --- /dev/null +++ b/tests/lexer/mixed1_error.txt @@ -0,0 +1 @@ +(2, 10) - LexicographicError: ERROR "#" diff --git a/tests/lexer/mixed2.cl b/tests/lexer/mixed2.cl new file mode 100644 index 000000000..12039e123 --- /dev/null +++ b/tests/lexer/mixed2.cl @@ -0,0 +1,20 @@ +"kjas\"lnnsdj\nfljrdsaf" +@.$.@ +@*%*@ +"alkjfldajf""dasfadsf + +(* +#1 STR_CONST "kjas\"lnnsdj\nfljrdsaf" +#2 '@' +#2 '.' +#2 ERROR "$" +#2 '.' +#2 '@' +#3 '@' +#3 '*' +#3 ERROR "%" +#3 '*' +#3 '@' +#4 STR_CONST "alkjfldajf" +#4 ERROR "Unterminated string constant" +*) \ No newline at end of file diff --git a/tests/lexer/mixed2_error.txt b/tests/lexer/mixed2_error.txt new file mode 100644 index 000000000..097dc2a07 --- /dev/null +++ b/tests/lexer/mixed2_error.txt @@ -0,0 +1,3 @@ +(2, 3) - LexicographicError: ERROR "$" +(3, 3) - LexicographicError: ERROR "%" +(4, 22) - LexicographicError: Unterminated string constant diff --git a/tests/lexer/string1.cl b/tests/lexer/string1.cl new file mode 100644 index 000000000..6c3c00833 --- /dev/null +++ b/tests/lexer/string1.cl @@ -0,0 +1,6 @@ +(* A non-escaped newline character may not appear in a string *) + +"This \ +is OK" +"This is not +OK" \ No newline at end of file diff --git a/tests/lexer/string1_error.txt b/tests/lexer/string1_error.txt new file mode 100644 index 000000000..078c12bbb --- /dev/null +++ b/tests/lexer/string1_error.txt @@ -0,0 +1,2 @@ +(5, 13) - LexicographicError: Unterminated string constant +(6, 4) - LexicographicError: EOF in string constant \ No newline at end of file diff --git a/tests/lexer/string2.cl b/tests/lexer/string2.cl new file mode 100644 index 000000000..3704b6ae7 --- /dev/null +++ b/tests/lexer/string2.cl @@ -0,0 +1,19 @@ +(* A string may not contain EOF *) + +" May the Triforce \ + 0 \ + 0v0 \ + 0vvv0 \ + 0vvvvv0 \ + 0vvvvvvv0 \ + 0vvvvvvvvv0 \ + 0vvvvvvvvvvv0 \ + 000000000000000 \ + 0v0 0v0 \ + 0vvv0 0vvv0 \ + 0vvvvv0 0vvvvv0 \ + 0vvvvvvv0 0vvvvvvv0 \ + 0vvvvvvvvv0 0vvvvvvvvv0 \ + 0vvvvvvvvvvv0 0vvvvvvvvvvv0 \ + 00000000000000000000000000000 \ + be with you! \ No newline at end of file diff --git a/tests/lexer/string2_error.txt b/tests/lexer/string2_error.txt new file mode 100644 index 000000000..7fbbcb526 --- /dev/null +++ b/tests/lexer/string2_error.txt @@ -0,0 +1 @@ +(19, 29) - LexicographicError: EOF in string constant \ No newline at end of file diff --git a/tests/lexer/string3.cl b/tests/lexer/string3.cl new file mode 100644 index 0000000000000000000000000000000000000000..78abc4972e218bca373ba1750c99a3450cef4ea3 GIT binary patch literal 234 zcmX|4yAH!34D8HToS2dhRoZ?*=Jpd<90*B>0}_xSe_!a!lI8Q=*(aJadZZi|KVhQ- zK4j?NGc6u@9^rRpGmYcJ^ifl$K@ Mi{IIrdU_-I0>Lp*mH+?% literal 0 HcmV?d00001 diff --git a/tests/lexer/string3_error.txt b/tests/lexer/string3_error.txt new file mode 100644 index 000000000..35695d07e --- /dev/null +++ b/tests/lexer/string3_error.txt @@ -0,0 +1 @@ +(8, 4) - LexicographicError: String contains null character \ No newline at end of file diff --git a/tests/lexer/string4.cl b/tests/lexer/string4.cl new file mode 100644 index 000000000..f4d39c027 --- /dev/null +++ b/tests/lexer/string4.cl @@ -0,0 +1,38 @@ +class Main { + str <- "The big brown fox + jumped over the fence"; + main() : Object { + { + out_string("Yay! This is the newest shites ); + } + }; +}; + +(* +#1 CLASS +#1 TYPEID Main +#1 '{' +#2 OBJECTID str +#2 ASSIGN +#3 ERROR "Unterminated string constant" +#3 OBJECTID jumped +#3 OBJECTID over +#3 OBJECTID the +#3 OBJECTID fence +#4 ERROR "Unterminated string constant" +#4 OBJECTID main +#4 '(' +#4 ')' +#4 ':' +#4 TYPEID Object +#4 '{' +#5 '{' +#6 OBJECTID out_string +#6 '(' +#7 ERROR "Unterminated string constant" +#7 '}' +#8 '}' +#8 ';' +#9 '}' +#9 ';' +*) \ No newline at end of file diff --git a/tests/lexer/string4_error.txt b/tests/lexer/string4_error.txt new file mode 100644 index 000000000..5ab0ea847 --- /dev/null +++ b/tests/lexer/string4_error.txt @@ -0,0 +1,3 @@ +(2, 30) - LexicographicError: Unterminated string constant +(3, 36) - LexicographicError: Unterminated string constant +(6, 58) - LexicographicError: Unterminated string constant \ No newline at end of file diff --git a/tests/parser/assignment1.cl b/tests/parser/assignment1.cl new file mode 100644 index 000000000..75b4c5bbd --- /dev/null +++ b/tests/parser/assignment1.cl @@ -0,0 +1,37 @@ +(* An assignment has the form <- *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(): String { + Test1 <- "Hello World" -- Identifiers begin with a lower case letter + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/assignment1_error.txt b/tests/parser/assignment1_error.txt new file mode 100644 index 000000000..cef0d3946 --- /dev/null +++ b/tests/parser/assignment1_error.txt @@ -0,0 +1 @@ +(29, 9) - SyntacticError: ERROR at or near "Test1" \ No newline at end of file diff --git a/tests/parser/assignment2.cl b/tests/parser/assignment2.cl new file mode 100644 index 000000000..4efb96487 --- /dev/null +++ b/tests/parser/assignment2.cl @@ -0,0 +1,37 @@ +(* An assignment has the form <- *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 - 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(): Int { + test1 <-- ~(1 + 2 + 3 + 4 + 5) -- The left side must be an expression + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/assignment2_error.txt b/tests/parser/assignment2_error.txt new file mode 100644 index 000000000..dc611c159 --- /dev/null +++ b/tests/parser/assignment2_error.txt @@ -0,0 +1 @@ +(29, 17) - SyntacticError: ERROR at or near "-" \ No newline at end of file diff --git a/tests/parser/assignment3.cl b/tests/parser/assignment3.cl new file mode 100644 index 000000000..ff633f331 --- /dev/null +++ b/tests/parser/assignment3.cl @@ -0,0 +1,37 @@ +(* An assignment has the form <- *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(): Bool { + test1 <- true++ -- The left side must be an expression + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/assignment3_error.txt b/tests/parser/assignment3_error.txt new file mode 100644 index 000000000..a69ac3a81 --- /dev/null +++ b/tests/parser/assignment3_error.txt @@ -0,0 +1 @@ +(29, 23) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/attribute1.cl b/tests/parser/attribute1.cl new file mode 100644 index 000000000..063a02c02 --- /dev/null +++ b/tests/parser/attribute1.cl @@ -0,0 +1,34 @@ +(* An attribute of class A specifies a variable that is part of the state of objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + -- Attributes names must begin with lowercase letters + Test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/attribute1_error.txt b/tests/parser/attribute1_error.txt new file mode 100644 index 000000000..a4e9eb060 --- /dev/null +++ b/tests/parser/attribute1_error.txt @@ -0,0 +1 @@ +(17, 5) - SyntacticError: ERROR at or near "Test2" \ No newline at end of file diff --git a/tests/parser/attribute2.cl b/tests/parser/attribute2.cl new file mode 100644 index 000000000..c05211483 --- /dev/null +++ b/tests/parser/attribute2.cl @@ -0,0 +1,34 @@ +(* An attribute of class A specifies a variable that is part of the state of objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + -- Type names must begin with uppercase letters + test3: string <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/attribute2_error.txt b/tests/parser/attribute2_error.txt new file mode 100644 index 000000000..b02a52ee1 --- /dev/null +++ b/tests/parser/attribute2_error.txt @@ -0,0 +1 @@ +(19, 12) - SyntacticError: ERROR at or near "string" \ No newline at end of file diff --git a/tests/parser/attribute3.cl b/tests/parser/attribute3.cl new file mode 100644 index 000000000..d858ae47c --- /dev/null +++ b/tests/parser/attribute3.cl @@ -0,0 +1,34 @@ +(* An attribute of class A specifies a variable that is part of the state of objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + -- Expected '<-' not '<=' + test3: String <= "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/attribute3_error.txt b/tests/parser/attribute3_error.txt new file mode 100644 index 000000000..71f5bc0b7 --- /dev/null +++ b/tests/parser/attribute3_error.txt @@ -0,0 +1 @@ +(19, 19) - SyntacticError: ERROR at or near "<=" \ No newline at end of file diff --git a/tests/parser/block1.cl b/tests/parser/block1.cl new file mode 100644 index 000000000..3613d9268 --- /dev/null +++ b/tests/parser/block1.cl @@ -0,0 +1,87 @@ +(* A block has the form { ; ... ; } *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + pow: Int <- 1; + count: Int <- 0; + + testing6(a: Int): IO { + { + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2 -- Missing ";" + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/block1_error.txt b/tests/parser/block1_error.txt new file mode 100644 index 000000000..c78fb0b96 --- /dev/null +++ b/tests/parser/block1_error.txt @@ -0,0 +1 @@ +(56, 17) - SyntacticError: ERROR at or near "}" \ No newline at end of file diff --git a/tests/parser/block2.cl b/tests/parser/block2.cl new file mode 100644 index 000000000..f485dd0b1 --- /dev/null +++ b/tests/parser/block2.cl @@ -0,0 +1,87 @@ +(* A block has the form { ; ... ; } *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + pow: Int <- 1; + count: Int <- 0; + + testing6(a: Int): IO { + -- Missing "{" + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/block2_error.txt b/tests/parser/block2_error.txt new file mode 100644 index 000000000..f85f4303c --- /dev/null +++ b/tests/parser/block2_error.txt @@ -0,0 +1 @@ +(49, 23) - SyntacticError: ERROR at or near ";" \ No newline at end of file diff --git a/tests/parser/block3.cl b/tests/parser/block3.cl new file mode 100644 index 000000000..ae1598c3b --- /dev/null +++ b/tests/parser/block3.cl @@ -0,0 +1,87 @@ +(* A block has the form { ; ... ; } *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + pow: Int <- 1; + count: Int <- 0; + + testing6(a: Int): IO { + { + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + -- Missing "}" + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/block3_error.txt b/tests/parser/block3_error.txt new file mode 100644 index 000000000..cda9949a2 --- /dev/null +++ b/tests/parser/block3_error.txt @@ -0,0 +1 @@ +(57, 13) - SyntacticError: ERROR at or near "pool" \ No newline at end of file diff --git a/tests/parser/block4.cl b/tests/parser/block4.cl new file mode 100644 index 000000000..8fd883d02 --- /dev/null +++ b/tests/parser/block4.cl @@ -0,0 +1,88 @@ +(* A block has the form { ; ... ; } *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + pow: Int <- 1; + count: Int <- 0; + + testing6(a: Int): IO { + { + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + true++; -- Only expressions + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/block4_error.txt b/tests/parser/block4_error.txt new file mode 100644 index 000000000..ddbeb32ef --- /dev/null +++ b/tests/parser/block4_error.txt @@ -0,0 +1 @@ +(56, 26) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/case1.cl b/tests/parser/case1.cl new file mode 100644 index 000000000..c2f508809 --- /dev/null +++ b/tests/parser/case1.cl @@ -0,0 +1,91 @@ +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + -- Every case expression must have at least one branch + esac + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/case1_error.txt b/tests/parser/case1_error.txt new file mode 100644 index 000000000..61fca14f7 --- /dev/null +++ b/tests/parser/case1_error.txt @@ -0,0 +1 @@ +(63, 9) - SyntacticError: ERROR at or near ESAC \ No newline at end of file diff --git a/tests/parser/case2.cl b/tests/parser/case2.cl new file mode 100644 index 000000000..f9162e49f --- /dev/null +++ b/tests/parser/case2.cl @@ -0,0 +1,93 @@ +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case "2 + 2" of + x: Int => new IO.out_string("Es un entero!") -- Missing ";" + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/case2_error.txt b/tests/parser/case2_error.txt new file mode 100644 index 000000000..40b030dd9 --- /dev/null +++ b/tests/parser/case2_error.txt @@ -0,0 +1 @@ +(63, 13) - SyntacticError: ERROR at or near "y" \ No newline at end of file diff --git a/tests/parser/case3.cl b/tests/parser/case3.cl new file mode 100644 index 000000000..a7eedc18b --- /dev/null +++ b/tests/parser/case3.cl @@ -0,0 +1,93 @@ +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + false of + x: Int => new IO.out_string("Es un entero!"); + y: string => new IO.out_string("Es una cadena!"); -- Type identifiers starts with a uppercase letter + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/case3_error.txt b/tests/parser/case3_error.txt new file mode 100644 index 000000000..f25c5c563 --- /dev/null +++ b/tests/parser/case3_error.txt @@ -0,0 +1 @@ +(63, 16) - SyntacticError: ERROR at or near "string" \ No newline at end of file diff --git a/tests/parser/case4.cl b/tests/parser/case4.cl new file mode 100644 index 000000000..25ca3858f --- /dev/null +++ b/tests/parser/case4.cl @@ -0,0 +1,93 @@ +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case true of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + Mazinger_Z: Bool => new IO.out_string("Es un booleano!"); -- Identifiers starts with a lowercase letter + esac + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/case4_error.txt b/tests/parser/case4_error.txt new file mode 100644 index 000000000..c5a16ddec --- /dev/null +++ b/tests/parser/case4_error.txt @@ -0,0 +1 @@ +(64, 13) - SyntacticError: ERROR at or near "Mazinger_Z" \ No newline at end of file diff --git a/tests/parser/case5.cl b/tests/parser/case5.cl new file mode 100644 index 000000000..b36c663e1 --- /dev/null +++ b/tests/parser/case5.cl @@ -0,0 +1,93 @@ +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case test2 of + x: Int <- new IO.out_string("Es un entero!"); -- Must be '=>' not '<-'; + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/case5_error.txt b/tests/parser/case5_error.txt new file mode 100644 index 000000000..fc6ec0eda --- /dev/null +++ b/tests/parser/case5_error.txt @@ -0,0 +1 @@ +(62, 20) - SyntacticError: ERROR at or near ASSIGN \ No newline at end of file diff --git a/tests/parser/case6.cl b/tests/parser/case6.cl new file mode 100644 index 000000000..66e7df2ab --- /dev/null +++ b/tests/parser/case6.cl @@ -0,0 +1,93 @@ +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 -- Missing "of" + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/case6_error.txt b/tests/parser/case6_error.txt new file mode 100644 index 000000000..2ae2f723b --- /dev/null +++ b/tests/parser/case6_error.txt @@ -0,0 +1 @@ +(62, 13) - SyntacticError: ERROR at or near "x" \ No newline at end of file diff --git a/tests/parser/class1.cl b/tests/parser/class1.cl new file mode 100644 index 000000000..f4815e3f4 --- /dev/null +++ b/tests/parser/class1.cl @@ -0,0 +1,20 @@ +(* A class is a list of features *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + testing(): Int { + 2 + 2 + }; +}; + +-- Class names must begin with uppercase letters +class alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/class1_error.txt b/tests/parser/class1_error.txt new file mode 100644 index 000000000..acaa52a6e --- /dev/null +++ b/tests/parser/class1_error.txt @@ -0,0 +1 @@ +(16, 7) - SyntacticError: ERROR at or near "alpha" \ No newline at end of file diff --git a/tests/parser/class2.cl b/tests/parser/class2.cl new file mode 100644 index 000000000..f363b032a --- /dev/null +++ b/tests/parser/class2.cl @@ -0,0 +1,20 @@ +(* A class is a list of features *) + +CLaSS Main { + main(): Object { + (new Alpha).print() + }; +}; + +CLaSS Test { + testing(): Int { + 2 + 2 + }; +}; + +-- Type names must begin with uppercase letters +CLaSS Alpha iNHeRiTS iO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/class2_error.txt b/tests/parser/class2_error.txt new file mode 100644 index 000000000..59d065913 --- /dev/null +++ b/tests/parser/class2_error.txt @@ -0,0 +1 @@ +(16, 22) - SyntacticError: ERROR at or near "iO" \ No newline at end of file diff --git a/tests/parser/class3.cl b/tests/parser/class3.cl new file mode 100644 index 000000000..0c801372a --- /dev/null +++ b/tests/parser/class3.cl @@ -0,0 +1,34 @@ +(* A class is a list of features *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + -- Missing semicolon + testing2(a: Alpha, b: Int): Int { + 2 + 2 + } + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/class3_error.txt b/tests/parser/class3_error.txt new file mode 100644 index 000000000..bc2f946b2 --- /dev/null +++ b/tests/parser/class3_error.txt @@ -0,0 +1 @@ +(25, 5) - SyntacticError: ERROR at or near "testing3" \ No newline at end of file diff --git a/tests/parser/class4.cl b/tests/parser/class4.cl new file mode 100644 index 000000000..5c286b5e6 --- /dev/null +++ b/tests/parser/class4.cl @@ -0,0 +1,36 @@ +(* A class is a list of features *) + +CLaSS Main { + main(): Object { + (new Alpha).print() + }; +}; + +CLaSS Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + -- Only features + 2 + 2; + + testing3(): String { + "2 + 2" + }; +}; + +CLaSS Alpha iNHeRiTS IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/class4_error.txt b/tests/parser/class4_error.txt new file mode 100644 index 000000000..1007f033d --- /dev/null +++ b/tests/parser/class4_error.txt @@ -0,0 +1 @@ +(25, 5) - SyntacticError: ERROR at or near "2" \ No newline at end of file diff --git a/tests/parser/class5.cl b/tests/parser/class5.cl new file mode 100644 index 000000000..3f40c36eb --- /dev/null +++ b/tests/parser/class5.cl @@ -0,0 +1,34 @@ +(* A class is a list of features *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +-- Missing '{' +class Test + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/class5_error.txt b/tests/parser/class5_error.txt new file mode 100644 index 000000000..400e4d614 --- /dev/null +++ b/tests/parser/class5_error.txt @@ -0,0 +1 @@ +(11, 5) - SyntacticError: ERROR at or near "test1" \ No newline at end of file diff --git a/tests/parser/class6.cl b/tests/parser/class6.cl new file mode 100644 index 000000000..8501d2593 --- /dev/null +++ b/tests/parser/class6.cl @@ -0,0 +1,34 @@ +(* A class is a list of features *) + +CLaSS Main { + main(): Object { + (new Alpha).print() + }; +}; + +-- Missing '}' +CLaSS Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +; + +CLaSS Alpha iNHeRiTS IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/class6_error.txt b/tests/parser/class6_error.txt new file mode 100644 index 000000000..73574c94c --- /dev/null +++ b/tests/parser/class6_error.txt @@ -0,0 +1 @@ +(28, 1) - SyntacticError: ERROR at or near ";" \ No newline at end of file diff --git a/tests/parser/conditional1.cl b/tests/parser/conditional1.cl new file mode 100644 index 000000000..4d546fc44 --- /dev/null +++ b/tests/parser/conditional1.cl @@ -0,0 +1,69 @@ +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + if a.length() < b.length() -- Mising "then" + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + else + if a.length() = b.length() then + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + else + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fi + fi + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/conditional1_error.txt b/tests/parser/conditional1_error.txt new file mode 100644 index 000000000..ee533fd84 --- /dev/null +++ b/tests/parser/conditional1_error.txt @@ -0,0 +1 @@ +(34, 13) - SyntacticError: ERROR at or near NEW \ No newline at end of file diff --git a/tests/parser/conditional2.cl b/tests/parser/conditional2.cl new file mode 100644 index 000000000..4f10c2957 --- /dev/null +++ b/tests/parser/conditional2.cl @@ -0,0 +1,69 @@ +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + if a.length() < b.length() then + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + else + if a.length() = b.length() then + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + else + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + -- Missing "fi" + fi + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/conditional2_error.txt b/tests/parser/conditional2_error.txt new file mode 100644 index 000000000..c72f78d7e --- /dev/null +++ b/tests/parser/conditional2_error.txt @@ -0,0 +1 @@ +(42, 5) - SyntacticError: ERROR at or near "}" \ No newline at end of file diff --git a/tests/parser/conditional3.cl b/tests/parser/conditional3.cl new file mode 100644 index 000000000..67e991ade --- /dev/null +++ b/tests/parser/conditional3.cl @@ -0,0 +1,69 @@ +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + iF a.length() < b.length() tHen + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + elsE + if a.length() = b.length() then + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + eLseif -- elseif isn't a keyword + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/conditional3_error.txt b/tests/parser/conditional3_error.txt new file mode 100644 index 000000000..ad95552b5 --- /dev/null +++ b/tests/parser/conditional3_error.txt @@ -0,0 +1 @@ +(38, 13) - SyntacticError: ERROR at or near "eLseif" \ No newline at end of file diff --git a/tests/parser/conditional4.cl b/tests/parser/conditional4.cl new file mode 100644 index 000000000..0792fdc85 --- /dev/null +++ b/tests/parser/conditional4.cl @@ -0,0 +1,73 @@ +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(): Int { + if true++ then 1 else 0 -- Condition must be an expression + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/conditional4_error.txt b/tests/parser/conditional4_error.txt new file mode 100644 index 000000000..f5511445b --- /dev/null +++ b/tests/parser/conditional4_error.txt @@ -0,0 +1 @@ +(45, 17) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/conditional5.cl b/tests/parser/conditional5.cl new file mode 100644 index 000000000..0c1e1aad0 --- /dev/null +++ b/tests/parser/conditional5.cl @@ -0,0 +1,73 @@ +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(): Int { + if true then true++ else 0 -- If branch must be an expression + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/conditional5_error.txt b/tests/parser/conditional5_error.txt new file mode 100644 index 000000000..b3214010d --- /dev/null +++ b/tests/parser/conditional5_error.txt @@ -0,0 +1 @@ +(45, 27) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/conditional6.cl b/tests/parser/conditional6.cl new file mode 100644 index 000000000..02310404a --- /dev/null +++ b/tests/parser/conditional6.cl @@ -0,0 +1,73 @@ +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(): Int { + if true then 1 else false++ -- Else branch must be an expression + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/conditional6_error.txt b/tests/parser/conditional6_error.txt new file mode 100644 index 000000000..968b78ad9 --- /dev/null +++ b/tests/parser/conditional6_error.txt @@ -0,0 +1 @@ +(45, 35) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/dispatch1.cl b/tests/parser/dispatch1.cl new file mode 100644 index 000000000..2ca394716 --- /dev/null +++ b/tests/parser/dispatch1.cl @@ -0,0 +1,45 @@ +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + Test1.testing4(1, 2).testing4(3, 4).testing4(5, 6) -- Objet identifiers begin with a lower case letter + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/dispatch1_error.txt b/tests/parser/dispatch1_error.txt new file mode 100644 index 000000000..ba8e9e84c --- /dev/null +++ b/tests/parser/dispatch1_error.txt @@ -0,0 +1 @@ +(37, 9) - SyntacticError: ERROR at or near "Test1" \ No newline at end of file diff --git a/tests/parser/dispatch2.cl b/tests/parser/dispatch2.cl new file mode 100644 index 000000000..0b57467a1 --- /dev/null +++ b/tests/parser/dispatch2.cl @@ -0,0 +1,45 @@ +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13,) -- Extra comma + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/dispatch2_error.txt b/tests/parser/dispatch2_error.txt new file mode 100644 index 000000000..134e266b2 --- /dev/null +++ b/tests/parser/dispatch2_error.txt @@ -0,0 +1 @@ +(37, 84) - SyntacticError: ERROR at or near ")" \ No newline at end of file diff --git a/tests/parser/dispatch3.cl b/tests/parser/dispatch3.cl new file mode 100644 index 000000000..9f1a5afff --- /dev/null +++ b/tests/parser/dispatch3.cl @@ -0,0 +1,45 @@ +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).Testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) -- Identifiers begin with a lower case letter + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/dispatch3_error.txt b/tests/parser/dispatch3_error.txt new file mode 100644 index 000000000..86d2d5142 --- /dev/null +++ b/tests/parser/dispatch3_error.txt @@ -0,0 +1 @@ +(37, 38) - SyntacticError: ERROR at or near "Testing4" \ No newline at end of file diff --git a/tests/parser/dispatch4.cl b/tests/parser/dispatch4.cl new file mode 100644 index 000000000..d1efc469d --- /dev/null +++ b/tests/parser/dispatch4.cl @@ -0,0 +1,53 @@ +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + self.testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true++) -- Arguments must be expressions + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/dispatch4_error.txt b/tests/parser/dispatch4_error.txt new file mode 100644 index 000000000..d03bb4c53 --- /dev/null +++ b/tests/parser/dispatch4_error.txt @@ -0,0 +1 @@ +(45, 81) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/dispatch5.cl b/tests/parser/dispatch5.cl new file mode 100644 index 000000000..63a5afa79 --- /dev/null +++ b/tests/parser/dispatch5.cl @@ -0,0 +1,53 @@ +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, ,true + fALSE) -- Extra comma + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/dispatch5_error.txt b/tests/parser/dispatch5_error.txt new file mode 100644 index 000000000..3fc39c625 --- /dev/null +++ b/tests/parser/dispatch5_error.txt @@ -0,0 +1 @@ +(45, 71) - SyntacticError: ERROR at or near "," \ No newline at end of file diff --git a/tests/parser/dispatch6.cl b/tests/parser/dispatch6.cl new file mode 100644 index 000000000..0a953e2e6 --- /dev/null +++ b/tests/parser/dispatch6.cl @@ -0,0 +1,57 @@ +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@object.copy() -- Type identifiers begin with a upper case letter + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/dispatch6_error.txt b/tests/parser/dispatch6_error.txt new file mode 100644 index 000000000..543f3a38c --- /dev/null +++ b/tests/parser/dispatch6_error.txt @@ -0,0 +1 @@ +(49, 15) - SyntacticError: ERROR at or near "object" \ No newline at end of file diff --git a/tests/parser/dispatch7.cl b/tests/parser/dispatch7.cl new file mode 100644 index 000000000..3ecac4d0f --- /dev/null +++ b/tests/parser/dispatch7.cl @@ -0,0 +1,57 @@ +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.Copy() -- Identifiers begin with a lower case letter + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/dispatch7_error.txt b/tests/parser/dispatch7_error.txt new file mode 100644 index 000000000..27235d118 --- /dev/null +++ b/tests/parser/dispatch7_error.txt @@ -0,0 +1 @@ +(49, 22) - SyntacticError: ERROR at or near "Copy" \ No newline at end of file diff --git a/tests/parser/dispatch8.cl b/tests/parser/dispatch8.cl new file mode 100644 index 000000000..eef0455ef --- /dev/null +++ b/tests/parser/dispatch8.cl @@ -0,0 +1,57 @@ +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy(,) -- Extra comma + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/dispatch8_error.txt b/tests/parser/dispatch8_error.txt new file mode 100644 index 000000000..04704520a --- /dev/null +++ b/tests/parser/dispatch8_error.txt @@ -0,0 +1 @@ +(49, 27) - SyntacticError: ERROR at or near "," \ No newline at end of file diff --git a/tests/parser/dispatch9.cl b/tests/parser/dispatch9.cl new file mode 100644 index 000000000..5fdef22d6 --- /dev/null +++ b/tests/parser/dispatch9.cl @@ -0,0 +1,61 @@ +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; + + testing5(): Object { + test1:Object.copy() -- Must be '@' not ':' + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/dispatch9_error.txt b/tests/parser/dispatch9_error.txt new file mode 100644 index 000000000..eb0b3397d --- /dev/null +++ b/tests/parser/dispatch9_error.txt @@ -0,0 +1 @@ +(53, 14) - SyntacticError: ERROR at or near ":" \ No newline at end of file diff --git a/tests/parser/let1.cl b/tests/parser/let1.cl new file mode 100644 index 000000000..576ae383c --- /dev/null +++ b/tests/parser/let1.cl @@ -0,0 +1,85 @@ +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let Count: Int <- 0, pow: Int <- 1 -- Object identifiers starts with a lowercase letter + in { + -- count <- 0; + -- pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/let1_error.txt b/tests/parser/let1_error.txt new file mode 100644 index 000000000..8b7fe63d1 --- /dev/null +++ b/tests/parser/let1_error.txt @@ -0,0 +1 @@ +(45, 13) - SyntacticError: ERROR at or near "Count" \ No newline at end of file diff --git a/tests/parser/let2.cl b/tests/parser/let2.cl new file mode 100644 index 000000000..4cfaef0f8 --- /dev/null +++ b/tests/parser/let2.cl @@ -0,0 +1,85 @@ +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int, pow: int <- 1 -- Type identifiers starts with a uppercase letter + in { + count <- 0; + -- pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/let2_error.txt b/tests/parser/let2_error.txt new file mode 100644 index 000000000..6fb3f8e9c --- /dev/null +++ b/tests/parser/let2_error.txt @@ -0,0 +1 @@ +(45, 30) - SyntacticError: ERROR at or near "int" \ No newline at end of file diff --git a/tests/parser/let3.cl b/tests/parser/let3.cl new file mode 100644 index 000000000..91e567fd8 --- /dev/null +++ b/tests/parser/let3.cl @@ -0,0 +1,85 @@ +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int, pow: Int, -- Extra comma + in { + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/let3_error.txt b/tests/parser/let3_error.txt new file mode 100644 index 000000000..71fa08812 --- /dev/null +++ b/tests/parser/let3_error.txt @@ -0,0 +1 @@ +(46, 9) - SyntacticError: ERROR at or near IN \ No newline at end of file diff --git a/tests/parser/let4.cl b/tests/parser/let4.cl new file mode 100644 index 000000000..a716c332d --- /dev/null +++ b/tests/parser/let4.cl @@ -0,0 +1,85 @@ +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- true++, pow: Int <- 1 -- Initialization must be an expression + in { + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/let4_error.txt b/tests/parser/let4_error.txt new file mode 100644 index 000000000..e12c7478c --- /dev/null +++ b/tests/parser/let4_error.txt @@ -0,0 +1 @@ +(45, 32) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/let5.cl b/tests/parser/let5.cl new file mode 100644 index 000000000..d974cc138 --- /dev/null +++ b/tests/parser/let5.cl @@ -0,0 +1,85 @@ +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int = 0, pow: Int -- Must be '<-' not '=' + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/let5_error.txt b/tests/parser/let5_error.txt new file mode 100644 index 000000000..e561f846c --- /dev/null +++ b/tests/parser/let5_error.txt @@ -0,0 +1 @@ +(45, 24) - SyntacticError: ERROR at or near "=" \ No newline at end of file diff --git a/tests/parser/let6.cl b/tests/parser/let6.cl new file mode 100644 index 000000000..b6e51d7e1 --- /dev/null +++ b/tests/parser/let6.cl @@ -0,0 +1,74 @@ +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int <- 1 + in false++ -- Let body must be an expression + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/let6_error.txt b/tests/parser/let6_error.txt new file mode 100644 index 000000000..7a77928b9 --- /dev/null +++ b/tests/parser/let6_error.txt @@ -0,0 +1 @@ +(46, 18) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/let7.cl b/tests/parser/let7.cl new file mode 100644 index 000000000..6fd63e6a7 --- /dev/null +++ b/tests/parser/let7.cl @@ -0,0 +1,85 @@ +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + (* Missing "in" *) { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/let7_error.txt b/tests/parser/let7_error.txt new file mode 100644 index 000000000..654b1ce60 --- /dev/null +++ b/tests/parser/let7_error.txt @@ -0,0 +1 @@ +(46, 28) - SyntacticError: ERROR at or near "{" \ No newline at end of file diff --git a/tests/parser/loop1.cl b/tests/parser/loop1.cl new file mode 100644 index 000000000..7d0d7688f --- /dev/null +++ b/tests/parser/loop1.cl @@ -0,0 +1,78 @@ +(* A loop has the form while loop pool *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + count: Int <- 1; + + testing6(): Object { + while count < 1024*1024 + -- Missing "loop" + count <- count * 2 + pool + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/loop1_error.txt b/tests/parser/loop1_error.txt new file mode 100644 index 000000000..94248ff00 --- /dev/null +++ b/tests/parser/loop1_error.txt @@ -0,0 +1 @@ +(49, 13) - SyntacticError: ERROR at or near "count" \ No newline at end of file diff --git a/tests/parser/loop2.cl b/tests/parser/loop2.cl new file mode 100644 index 000000000..a9613c487 --- /dev/null +++ b/tests/parser/loop2.cl @@ -0,0 +1,78 @@ +(* A loop has the form while loop pool *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + count: Int <- 1; + + testing6(): Object { + while count < 1024*1024 + loop + count <- count * 2 + -- Missing "pool" + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/loop2_error.txt b/tests/parser/loop2_error.txt new file mode 100644 index 000000000..6447101f8 --- /dev/null +++ b/tests/parser/loop2_error.txt @@ -0,0 +1 @@ +(51, 5) - SyntacticError: ERROR at or near "}" \ No newline at end of file diff --git a/tests/parser/loop3.cl b/tests/parser/loop3.cl new file mode 100644 index 000000000..860adb4d1 --- /dev/null +++ b/tests/parser/loop3.cl @@ -0,0 +1,78 @@ +(* A loop has the form while loop pool *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + count: Int <- 1; + + testing6(): Object { + while count => 1024*1024 -- Condition must be an expression + loop + count <- count * 2 + pool + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/loop3_error.txt b/tests/parser/loop3_error.txt new file mode 100644 index 000000000..3da8bcde0 --- /dev/null +++ b/tests/parser/loop3_error.txt @@ -0,0 +1 @@ +(47, 21) - SyntacticError: ERROR at or near DARROW \ No newline at end of file diff --git a/tests/parser/loop4.cl b/tests/parser/loop4.cl new file mode 100644 index 000000000..0a1194e82 --- /dev/null +++ b/tests/parser/loop4.cl @@ -0,0 +1,78 @@ +(* A loop has the form while loop pool *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + count: Int <- 1; + + testing6(): Object { + while count < 1024*1024 + loop + count <- true++ -- While body must be an expression + pool + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/loop4_error.txt b/tests/parser/loop4_error.txt new file mode 100644 index 000000000..c39f35fe1 --- /dev/null +++ b/tests/parser/loop4_error.txt @@ -0,0 +1 @@ +(49, 27) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/method1.cl b/tests/parser/method1.cl new file mode 100644 index 000000000..fcfbbcd30 --- /dev/null +++ b/tests/parser/method1.cl @@ -0,0 +1,34 @@ +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + -- Method names must begin with lowercase letters + Testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/method1_error.txt b/tests/parser/method1_error.txt new file mode 100644 index 000000000..0eff41999 --- /dev/null +++ b/tests/parser/method1_error.txt @@ -0,0 +1 @@ +(21, 5) - SyntacticError: ERROR at or near "Testing2" \ No newline at end of file diff --git a/tests/parser/method2.cl b/tests/parser/method2.cl new file mode 100644 index 000000000..d5bdfd85c --- /dev/null +++ b/tests/parser/method2.cl @@ -0,0 +1,34 @@ +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + -- Parameter names must begin with lowercase letters + testing2(a: Alpha, B: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/method2_error.txt b/tests/parser/method2_error.txt new file mode 100644 index 000000000..1843fb7b4 --- /dev/null +++ b/tests/parser/method2_error.txt @@ -0,0 +1 @@ +(21, 24) - SyntacticError: ERROR at or near "B" \ No newline at end of file diff --git a/tests/parser/method3.cl b/tests/parser/method3.cl new file mode 100644 index 000000000..1e5c9eb53 --- /dev/null +++ b/tests/parser/method3.cl @@ -0,0 +1,34 @@ +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + -- Type names must begin with uppercase letters + testing2(a: Alpha, b: int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/method3_error.txt b/tests/parser/method3_error.txt new file mode 100644 index 000000000..dbecf552e --- /dev/null +++ b/tests/parser/method3_error.txt @@ -0,0 +1 @@ +(21, 27) - SyntacticError: ERROR at or near "int" \ No newline at end of file diff --git a/tests/parser/method4.cl b/tests/parser/method4.cl new file mode 100644 index 000000000..019ada276 --- /dev/null +++ b/tests/parser/method4.cl @@ -0,0 +1,34 @@ +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + -- Missing paremeter + testing3(x: Int,): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/method4_error.txt b/tests/parser/method4_error.txt new file mode 100644 index 000000000..6421cee2b --- /dev/null +++ b/tests/parser/method4_error.txt @@ -0,0 +1 @@ +(25, 21) - SyntacticError: ERROR at or near ")" \ No newline at end of file diff --git a/tests/parser/method5.cl b/tests/parser/method5.cl new file mode 100644 index 000000000..13127f664 --- /dev/null +++ b/tests/parser/method5.cl @@ -0,0 +1,34 @@ +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + -- Type names must begin with uppercase letters + testing3(): string { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/method5_error.txt b/tests/parser/method5_error.txt new file mode 100644 index 000000000..9bda07041 --- /dev/null +++ b/tests/parser/method5_error.txt @@ -0,0 +1 @@ +(25, 17) - SyntacticError: ERROR at or near "string" \ No newline at end of file diff --git a/tests/parser/method6.cl b/tests/parser/method6.cl new file mode 100644 index 000000000..d48cd1293 --- /dev/null +++ b/tests/parser/method6.cl @@ -0,0 +1,33 @@ +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + -- Body can't be empty + testing2(a: Alpha, b: Int): Int { + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/method6_error.txt b/tests/parser/method6_error.txt new file mode 100644 index 000000000..e7d5de400 --- /dev/null +++ b/tests/parser/method6_error.txt @@ -0,0 +1 @@ +(22, 5) - SyntacticError: ERROR at or near "}" \ No newline at end of file diff --git a/tests/parser/mixed1.cl b/tests/parser/mixed1.cl new file mode 100644 index 000000000..a27879513 --- /dev/null +++ b/tests/parser/mixed1.cl @@ -0,0 +1,100 @@ +(* Cool has four binary arithmetic operations: +, -, *, /. *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; + + a: Int <- 1; + + testing8(x: Int, y: Int): Bool { + let z: Int <- 3, w: Int <- 4 + in isvoid (3 + a * (x / w + new Int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) + }; +}-- Mising ";" + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/mixed1_error.txt b/tests/parser/mixed1_error.txt new file mode 100644 index 000000000..d5b0ff8bb --- /dev/null +++ b/tests/parser/mixed1_error.txt @@ -0,0 +1 @@ +(76, 1) - SyntacticError: ERROR at or near CLASS \ No newline at end of file diff --git a/tests/parser/mixed2.cl b/tests/parser/mixed2.cl new file mode 100644 index 000000000..f5477e0bb --- /dev/null +++ b/tests/parser/mixed2.cl @@ -0,0 +1,14 @@ +class Main { + main(): Object { + (new Alpha).print() + }; + +}; + +(* Class names must begin with uppercase letters *) +class alpha inherits IO { + print() : Object { + out_string("reached!!\n"); + }; +}; + diff --git a/tests/parser/mixed2_error.txt b/tests/parser/mixed2_error.txt new file mode 100644 index 000000000..b5613c52a --- /dev/null +++ b/tests/parser/mixed2_error.txt @@ -0,0 +1 @@ +(9, 7) - SyntacticError: ERROR at or near "alpha" \ No newline at end of file diff --git a/tests/parser/mixed3.cl b/tests/parser/mixed3.cl new file mode 100644 index 000000000..1bdcad743 --- /dev/null +++ b/tests/parser/mixed3.cl @@ -0,0 +1,40 @@ +class Main inherits IO { + main() : Object { + { + out_string("Enter a number to check if number is prime\n"); + let i : Int <- in_int() in { + if(i <= 1) then { + out_string("Invalid Input\n"); + abort(); + } else { + if (isPrime(i) = 1) then + out_string("Number is prime\n") + else + out_string("Number is composite\n") + fi; + } + fi; + }; + } + }; + + mod(i : Int, ) : Int { -- Formal list must be comma separated. A comma does not terminate a list of formals. + i - (i/k)*k + }; + + isPrime(i : Int) : Int { + { + let x : Int <- 2, + c : Int <- 1 in + { + while (not (x = i)) loop + if (mod(i, x) = 0) then { + c <- 0; + x <- i; + } else x <- x + 1 fi + pool; + c; + }; + } + }; +}; diff --git a/tests/parser/mixed3_error.txt b/tests/parser/mixed3_error.txt new file mode 100644 index 000000000..159bdca63 --- /dev/null +++ b/tests/parser/mixed3_error.txt @@ -0,0 +1 @@ +(21, 18) - SyntacticError: ERROR at or near ")" \ No newline at end of file diff --git a/tests/parser/mixed4.cl b/tests/parser/mixed4.cl new file mode 100644 index 000000000..e752253be --- /dev/null +++ b/tests/parser/mixed4.cl @@ -0,0 +1,21 @@ +class Main inherits IO { + main() : Object { + { + out_string("Enter number of numbers to multiply\n"); + out_int(prod(in_int())); + out_string("\n"); + } + }; + + prod(i : Int) : Int { + let y : Int <- 1 in { + while (not (i = 0) ) loop { + out_string("Enter Number: "); + y <- y * in_int(Main : Int); -- the parser correctly catches the error here + i <- i - 1; + } + pool; + y; + } + }; +}; diff --git a/tests/parser/mixed4_error.txt b/tests/parser/mixed4_error.txt new file mode 100644 index 000000000..2349f28a5 --- /dev/null +++ b/tests/parser/mixed4_error.txt @@ -0,0 +1 @@ +(14, 41) - SyntacticError: ERROR at or near "Main" \ No newline at end of file diff --git a/tests/parser/mixed5.cl b/tests/parser/mixed5.cl new file mode 100644 index 000000000..c9176a890 --- /dev/null +++ b/tests/parser/mixed5.cl @@ -0,0 +1,20 @@ +class Main inherits IO { + str <- "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; + main() : Object { + { + out_string("Enter number of numbers to multiply\n"); + out_int(prod(in_int())); + out_string("\n"); + } + }; + prod(i : Int) : Int { + let y : Int <- 1 in { + while (not (i = 0) ) loop { + out_string("Enter Number: "); + y <- y * in_int(); + i <- i - 1; + } + y; + } + }; +} diff --git a/tests/parser/mixed5_error.txt b/tests/parser/mixed5_error.txt new file mode 100644 index 000000000..443037eca --- /dev/null +++ b/tests/parser/mixed5_error.txt @@ -0,0 +1 @@ +(2, 9) - SyntacticError: ERROR at or near ASSIGN \ No newline at end of file diff --git a/tests/parser/mixed6.cl b/tests/parser/mixed6.cl new file mode 100644 index 000000000..5da80da31 --- /dev/null +++ b/tests/parser/mixed6.cl @@ -0,0 +1,5 @@ +classs Doom { + i : Int <- 0; + main() : Object { + if i = 0 then out_string("This is da real *h*t") + diff --git a/tests/parser/mixed6_error.txt b/tests/parser/mixed6_error.txt new file mode 100644 index 000000000..af75ca925 --- /dev/null +++ b/tests/parser/mixed6_error.txt @@ -0,0 +1 @@ +(1, 1) - SyntacticError: ERROR at or near "classs" \ No newline at end of file diff --git a/tests/parser/operation1.cl b/tests/parser/operation1.cl new file mode 100644 index 000000000..d38eb72d0 --- /dev/null +++ b/tests/parser/operation1.cl @@ -0,0 +1,101 @@ +(* Cool has four binary arithmetic operations: +, -, *, /. *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; + + a: Int <- 1; + + testing8(x: Int, y: Int): Bool { + let z: Int <- 3, w: Int <- 4 + -- Missing ')' + in isvoid (3 + a * (x / w + new Int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a)/(0)*(((4 * 4))))) + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/operation1_error.txt b/tests/parser/operation1_error.txt new file mode 100644 index 000000000..b30202399 --- /dev/null +++ b/tests/parser/operation1_error.txt @@ -0,0 +1 @@ +(74, 5) - SyntacticError: ERROR at or near "}" \ No newline at end of file diff --git a/tests/parser/operation2.cl b/tests/parser/operation2.cl new file mode 100644 index 000000000..2dc628359 --- /dev/null +++ b/tests/parser/operation2.cl @@ -0,0 +1,101 @@ +(* Cool has four binary arithmetic operations: +, -, *, /. *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; + + a: Int <- 1; + + testing8(x: Int, y: Int): Bool { + let z: Int <- 3, w: Int <- 4 + -- Type identifiers starts with a uppercase letter + in isvoid (3 + a * (x / w + new int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/operation2_error.txt b/tests/parser/operation2_error.txt new file mode 100644 index 000000000..37b458f3a --- /dev/null +++ b/tests/parser/operation2_error.txt @@ -0,0 +1 @@ +(73, 41) - SyntacticError: ERROR at or near "int" \ No newline at end of file diff --git a/tests/parser/operation3.cl b/tests/parser/operation3.cl new file mode 100644 index 000000000..61d6cbfa8 --- /dev/null +++ b/tests/parser/operation3.cl @@ -0,0 +1,101 @@ +(* Cool has four binary arithmetic operations: +, -, *, /. *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; + + a: Int <- 1; + + testing8(x: Int, y: Int): Bool { + let z: Int <- 3, w: Int <- 4 + -- Object identifiers starts with a lowercase letter + in isvoid (3 + a * (x / w + new Int) - y - (((if tRue = not faLSe then ~Mazinger_Z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/operation3_error.txt b/tests/parser/operation3_error.txt new file mode 100644 index 000000000..6b266f3f3 --- /dev/null +++ b/tests/parser/operation3_error.txt @@ -0,0 +1 @@ +(73, 81) - SyntacticError: ERROR at or near "Mazinger_Z" \ No newline at end of file diff --git a/tests/parser/operation4.cl b/tests/parser/operation4.cl new file mode 100644 index 000000000..bae7de5b5 --- /dev/null +++ b/tests/parser/operation4.cl @@ -0,0 +1,101 @@ +(* Cool has four binary arithmetic operations: +, -, *, /. *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; + + a: Int <- 1; + + testing8(x: Int, y: Int): Bool { + let z: Int <- 3, w: Int <- 4 + -- Double "+" + in isvoid (3 + a * (x / w++ new Int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; \ No newline at end of file diff --git a/tests/parser/operation4_error.txt b/tests/parser/operation4_error.txt new file mode 100644 index 000000000..e0ebb0985 --- /dev/null +++ b/tests/parser/operation4_error.txt @@ -0,0 +1 @@ +(73, 35) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/program1.cl b/tests/parser/program1.cl new file mode 100644 index 000000000..8e5cf617f --- /dev/null +++ b/tests/parser/program1.cl @@ -0,0 +1 @@ +(* A Cool program can't be empty *) \ No newline at end of file diff --git a/tests/parser/program1_error.txt b/tests/parser/program1_error.txt new file mode 100644 index 000000000..de00ac46b --- /dev/null +++ b/tests/parser/program1_error.txt @@ -0,0 +1 @@ +(0, 0) - SyntacticError: ERROR at or near EOF \ No newline at end of file diff --git a/tests/parser/program2.cl b/tests/parser/program2.cl new file mode 100644 index 000000000..f8b16779c --- /dev/null +++ b/tests/parser/program2.cl @@ -0,0 +1,20 @@ +(* Cool programs are sets of classes *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +-- Missing semicolon +class Test { + testing(): Int { + 2 + 2 + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/program2_error.txt b/tests/parser/program2_error.txt new file mode 100644 index 000000000..94ba8df65 --- /dev/null +++ b/tests/parser/program2_error.txt @@ -0,0 +1 @@ +(16, 1) - SyntacticError: ERROR at or near CLASS \ No newline at end of file diff --git a/tests/parser/program3.cl b/tests/parser/program3.cl new file mode 100644 index 000000000..e27889c57 --- /dev/null +++ b/tests/parser/program3.cl @@ -0,0 +1,24 @@ +(* Cool programs are sets of classes *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + testing(): Int { + 2 + 2 + }; +}; + +-- Only classes +suma(a: Int, b: Int) int { + a + b +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/program3_error.txt b/tests/parser/program3_error.txt new file mode 100644 index 000000000..dd3b3947a --- /dev/null +++ b/tests/parser/program3_error.txt @@ -0,0 +1 @@ +(16, 1) - SyntacticError: ERROR at or near "suma" \ No newline at end of file diff --git a/tests/semantic/hello_world.cl b/tests/semantic/hello_world.cl new file mode 100755 index 000000000..0c818f908 --- /dev/null +++ b/tests/semantic/hello_world.cl @@ -0,0 +1,5 @@ +class Main inherits IO { + main(): IO { + out_string("Hello, World.\n") + }; +}; From 5ca901f915df08d9db96f223fbef1ae1556e4967 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Sat, 25 Apr 2020 21:57:35 -0400 Subject: [PATCH 021/143] added new error productions to the grammar --- cmp/__pycache__/pycompiler.cpython-37.pyc | Bin 21851 -> 21835 bytes cmp/__pycache__/utils.cpython-37.pyc | Bin 9008 -> 6094 bytes grammar.py | 38 +- lexer.py | 8 +- main.py | 12 +- parser.py | 1163 +++++++++++---------- scripts/main.cl | 9 + 7 files changed, 658 insertions(+), 572 deletions(-) diff --git a/cmp/__pycache__/pycompiler.cpython-37.pyc b/cmp/__pycache__/pycompiler.cpython-37.pyc index 37b547845eb743761fa94d1a6a6540a11cbe9bc7..916e36d4cfeac3d4204c3a2418dadca7523db80a 100644 GIT binary patch delta 56 zcmcb;it+R+MqVdgUM>b8kl(Q+u74wMRfu#HS8{HFUQTL7W?p&`Cs3*gq##NVC^~sl G$Vvd)AP~F& delta 72 zcmX@Tit+X;MqVdgUM>b8DE+-CZvIBzsu1m4Ldm%WdIgC^#hH2OdO4{TK&prnsH6y_ NFiH|hcJiW-l>lmn7&ia_ diff --git a/cmp/__pycache__/utils.cpython-37.pyc b/cmp/__pycache__/utils.cpython-37.pyc index 64c29a1eaa6fbaa94a40251b5df74c01a646415e..65482478142b81515a16b33b84c5986c6e243205 100644 GIT binary patch delta 709 zcmXX^&ubGw6z-U0GG^1Xk~X{9=GP`jx@OaANZW*>wJ8>Dp|utS!5TxeXuu@)Wh;oF zD0mSB>l4o+)hPwtFR|Q@ao08&YO0Z`R2`=@0O4V%wRJI#WHX6?GZct`N59}zDj%)KEK}rx98!ap3`hehcg6awDR$gkl_kG)}It8 zX$PPrCts|)4=(}q0g9A80YN!|trVIJ*RW<>W+i-TWMaP7Y~FFbj^}op&8v85Y{-qj z##y$Fr;}@nlno`M=sLbhZqa(ed~F8V4GfuAn2noef!)M`xyWbfl5_aQEQaXX2L3d4 zY{yMJH8qS<#t%Zj?}0-{DCaHwJ@tZ3<6g?v%A~FmICz-Kr&Oh!)(XO;=bhfb1<%D_ zsU23w<+Q`P*h}NmwA{5rO75R@d;47%TAm9I$!7?t&yt|}FfU_2yt@z7RiAZaV=iV& zY!B~c-fPN%l2kC6b$E@`Hm+wa_6WP#XS(uPq3i`ZGXRP)k33gq&#{`@;>Sf$k%pwa z#9{6lCo)uznm3M)wZoS1pGe?4i!(&aisLtH)tVy~c?G)04jvhvq{MlGn*4-1dyDn_ z!a|)AV+2aokdYr9crCB9+jYIW{kAd)WC79yD+CGr6EWt<|7|%26A}ayK_TRbh)7h3 d0KGtr4OtzNv-*pmB9%H$7RCg1F}57b{0D$Knf?F( delta 3002 zcma)8O>7%Q6rNeH*K2!i$BCVvrb$Q|HFcY$EmdiushgIh>7PQ=KuRsO+sL~lP7~Xi z-Jm9NWI-dfR6>x>0S-N+6+(y;^jwgTK$VaR;)Jw9f(thg;)Dbj-kbG0n^ZzLn%UW% z_cQN%-+Pnq_J4LdekvA=5cnLl%JlrvV)si;3-%H4^~EEcseIo zu+0UF$F#O88Y6TiBW$%wVV$w zm~6)Mf#+#JR)S*BiA+t;FPWo^l~^X|x)=aUjy!8l8;(-4XH90YMm&a_URMTF$o9i@ z8io~ziO@zWQI$sEnU2$yq#t|Xiw}f$RBL2|s5j^Xf|T>fhBh`~5?n*Kvj|jV6<9V$ z?rq^&oS9{2T4vFnwhM0p(_FM-ptPNA;UNnu0Jt`qoq%nRY=izYZnb9lP^;-?!2_m+ z1^FUGlGvv3if5QeEA9VbxL$}@kjMzZKP<#e{vj)##Re6Sv`sLqYA?()2+q!TTumtC zHT4d_ppFmv5tw16rLrH03U@vb_7=FsOovz{r^0Hk;ATK zY!+U4VvTV)ihD@GJB$Ic*!ZmFI+T>}3v2ueq}rch?I3pDC%UaeBBgbGJfrd9L^^}@?Wko|Dx1t+7Vxp7@Qq>nVlU!^ zu30eXu?S!)ky@rD{M8YqBQu`-$$CQOzVdYLJ}dwt!r~l#PHPiwmuG&E?=` z#49f6yWpTbXlxIt^FL$FvuL^^Zm9}TUk7`z4-Hdd8tgbqd742#fLD=N{I;zXFzomy z3=1U)Rp?6EgBtIvLHC+Kp!Z^M73|OCMu4SoHCJ;zS9g01WY{6h!$F3%Qh;G$rzBDY zdf{d#5XQH*42-A~d#7*$h3k(8jj?0=`(S6UXtX7G_h?lorZDO@*Y0q$j~N=CXqTHF zpJF}TwNN*yu~$%I$tSxV7LOZYJf1isvc$)OPLV7F4Pjvb4`fXNE(FB){CYCY z4@N%@G6atQ9DQzA7WD;;Cvk{f$vowp4 zE36xB@vg)%MeuxtUr+RPqqAig;=+TgE~JXcM0B_(qWdE8sfI6(%t|Gj4Wo5M(C$Ni zui-8|&O4HssEBn8#6Vyo*#mB=+N3Ilq6M{fpTC#9N-yx=ll}A~zN3+!I1Z9CHi}>IsszM^#996*H9#NpUs4lF?bwJKG(7q>pGsd+P?(Lm!FIs< z34fZNrI#?Qh^p)G-`l*df6FJEuXLY5QPDNgS4MV=HH}~K-!OKbKW%QIPx-ISN1nfc z9}+kTE$sY`X5o#WUoh?2k|9p%b|iGmrucYEM-b2d0WY_7bl_?nkfFHQhtnRMFhgt< S8rN attribute error feature-list") def attribute_error(s): - s.error(f"{s[3].line, s[3].column} - SyntacticError: Expected ';' instead of '{s[3].lex}'") + s.error(f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") return ast.AttrDeclarationNode(s[1], s[3]) @@ -183,10 +209,14 @@ def attribute_error(s): return s[1] -print('Build G :', time.time() - t) +@G.production("case-list -> id : type => expr ;") +def case_list_error(s): + s.error(f"{s[5].line, s[5].column} - SyntacticError: Expected ';' instead of '{s[5].lex}'") + return [ast.CaseNode(s[1], s[3], s[5])] + if __name__ == '__main__': t = time.time() G.serialize_lexer('CoolLexer', inspect.getmodulename(__file__)) G.serialize_parser(LALR1Parser(G), 'CoolParser', inspect.getmodulename(__file__)) - print(time.time() - t) + print('Serialization Time :', time.time() - t, 'seconds') diff --git a/lexer.py b/lexer.py index 8919d9a87..72f44a5da 100644 --- a/lexer.py +++ b/lexer.py @@ -10,11 +10,11 @@ def __init__(self): self.column = 1 self.position = 0 self.token = Token('', '', 0, 0) - self.pattern = re.compile(r'(?P\n+)|(?P +)|(?P\t+)|(inherits)|(isvoid)|(class)|(while)|(false)|(then)|(else)|(loop)|(pool)|(case)|(esac)|(true)|(<\-)|(let)|(new)|(not)|(\{)|(\})|(\()|(\))|(\.)|(=>)|(if)|(fi)|(in)|(of)|(\+)|(\-)|(\*)|(<=)|(\~)|(,)|(:)|(;)|(@)|(/)|(<)|(=)|(?P[a-z][a-zA-Z0-9_]*)|(?P[A-Z][a-zA-Z0-9_]*)|(?P\"[^\"]*\")|(?P\d+)|(?P\'[^\']*\')') + self.pattern = re.compile(r'(?P(\(\*[^$]*\*\))|--.*)|(?P\(\*(.|\n)*$)|(?P\n+)|(?P +)|(?P\t+)|(inherits)|(isvoid)|(class)|(while)|(false)|(then)|(else)|(loop)|(pool)|(case)|(esac)|(true)|(<\-)|(let)|(new)|(not)|(\{)|(\})|(\()|(\))|(\.)|(=>)|(if)|(fi)|(in)|(of)|(\+)|(\-)|(\*)|(<=)|(\~)|(,)|(:)|(;)|(@)|(/)|(<)|(=)|(?P[a-z][a-zA-Z0-9_]*)|(?P[A-Z][a-zA-Z0-9_]*)|(?P\"[^\"]*\")|(?P\d+)|(?P\'[^\']*\')') self.token_rules = {key: rule for key, (_, _, rule) in G.terminal_rules.items() if rule is not None} - self.error_handler = G.lexical_error_handler if G.lexical_error_handler is not None else self.error + self.error_handler = G.lexical_error_handler if G.lexical_error_handler is not None else self.error self.contain_errors = False self.eof = '$' - + def __call__(self, text): - return [Token(t.lex, G[t.token_type], t.line, t.column) for t in self.tokenize(text)] + return [Token(t.lex, G[t.token_type], t.line, t.column) for t in self.tokenize(text)] diff --git a/main.py b/main.py index 8f4d49272..fd0c054dc 100644 --- a/main.py +++ b/main.py @@ -3,14 +3,12 @@ from scope import Context from semantic import TypeCollector, TypeBuilder, TypeChecker, InferenceTypeChecker, Executor -program = """ -class Main { - main ( msg : String ) : Void { - let a: Int <- 25, b: Int <- 15 in { - a + +; - } +program = r""" +class Main inherits IO { + main(): IO { + out_string("Hello, World.\n") }; -} +}; """ lexer = CoolLexer() diff --git a/parser.py b/parser.py index 6f4588308..aa91de92a 100644 --- a/parser.py +++ b/parser.py @@ -15,88 +15,89 @@ def __action_table(): return { (0, G["class"]): ("SHIFT", 1), (1, G["type"]): ("SHIFT", 2), - (2, G["inherits"]): ("SHIFT", 137), (2, G["{"]): ("SHIFT", 3), - (3, G["}"]): ("REDUCE", G["feature-list -> e"]), + (2, G["inherits"]): ("SHIFT", 140), (3, G["id"]): ("SHIFT", 4), + (3, G["}"]): ("REDUCE", G["feature-list -> e"]), (4, G[":"]): ("SHIFT", 124), (4, G["("]): ("SHIFT", 5), - (5, G["id"]): ("SHIFT", 6), (5, G[")"]): ("SHIFT", 11), + (5, G["id"]): ("SHIFT", 6), (6, G[":"]): ("SHIFT", 7), (7, G["type"]): ("SHIFT", 8), - (8, G[","]): ("SHIFT", 9), (8, G[")"]): ("REDUCE", G["param-list -> id : type"]), + (8, G[","]): ("SHIFT", 9), (9, G["id"]): ("SHIFT", 6), (10, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), (11, G[":"]): ("SHIFT", 12), (12, G["type"]): ("SHIFT", 13), (13, G["{"]): ("SHIFT", 14), + (14, G["new"]): ("SHIFT", 31), + (14, G["("]): ("SHIFT", 20), + (14, G["id"]): ("SHIFT", 15), (14, G["{"]): ("SHIFT", 19), + (14, G["case"]): ("SHIFT", 30), + (14, G["~"]): ("SHIFT", 37), (14, G["if"]): ("SHIFT", 21), (14, G["not"]): ("SHIFT", 44), - (14, G["~"]): ("SHIFT", 37), (14, G["false"]): ("SHIFT", 36), - (14, G["case"]): ("SHIFT", 30), - (14, G["id"]): ("SHIFT", 15), - (14, G["new"]): ("SHIFT", 31), - (14, G["isvoid"]): ("SHIFT", 33), - (14, G["true"]): ("SHIFT", 35), - (14, G["string"]): ("SHIFT", 17), - (14, G["("]): ("SHIFT", 20), (14, G["while"]): ("SHIFT", 22), (14, G["int"]): ("SHIFT", 18), + (14, G["true"]): ("SHIFT", 35), + (14, G["isvoid"]): ("SHIFT", 33), + (14, G["string"]): ("SHIFT", 17), (14, G["let"]): ("SHIFT", 23), - (15, G["("]): ("SHIFT", 16), - (15, G["pool"]): ("REDUCE", G["atom -> id"]), - (15, G["+"]): ("REDUCE", G["atom -> id"]), + (15, G["<-"]): ("SHIFT", 113), (15, G["in"]): ("REDUCE", G["atom -> id"]), + (15, G["+"]): ("REDUCE", G["atom -> id"]), (15, G["}"]): ("REDUCE", G["atom -> id"]), (15, G["-"]): ("REDUCE", G["atom -> id"]), + (15, G["of"]): ("REDUCE", G["atom -> id"]), (15, G["then"]): ("REDUCE", G["atom -> id"]), (15, G["*"]): ("REDUCE", G["atom -> id"]), - (15, G["of"]): ("REDUCE", G["atom -> id"]), (15, G["/"]): ("REDUCE", G["atom -> id"]), (15, G["else"]): ("REDUCE", G["atom -> id"]), - (15, G["<"]): ("REDUCE", G["atom -> id"]), (15, G[")"]): ("REDUCE", G["atom -> id"]), + (15, G["<"]): ("REDUCE", G["atom -> id"]), (15, G["fi"]): ("REDUCE", G["atom -> id"]), - (15, G["<="]): ("REDUCE", G["atom -> id"]), + (15, G["error"]): ("REDUCE", G["atom -> id"]), (15, G["."]): ("REDUCE", G["atom -> id"]), + (15, G["<="]): ("REDUCE", G["atom -> id"]), (15, G["="]): ("REDUCE", G["atom -> id"]), (15, G[","]): ("REDUCE", G["atom -> id"]), (15, G[";"]): ("REDUCE", G["atom -> id"]), (15, G["loop"]): ("REDUCE", G["atom -> id"]), (15, G["@"]): ("REDUCE", G["atom -> id"]), - (15, G["<-"]): ("SHIFT", 113), - (16, G["int"]): ("SHIFT", 18), - (16, G["true"]): ("SHIFT", 35), - (16, G["id"]): ("SHIFT", 15), - (16, G["new"]): ("SHIFT", 31), + (15, G["pool"]): ("REDUCE", G["atom -> id"]), + (15, G["("]): ("SHIFT", 16), + (16, G["case"]): ("SHIFT", 30), (16, G["false"]): ("SHIFT", 36), + (16, G["~"]): ("SHIFT", 37), (16, G["if"]): ("SHIFT", 21), - (16, G["("]): ("SHIFT", 20), - (16, G["string"]): ("SHIFT", 17), + (16, G["id"]): ("SHIFT", 15), + (16, G["true"]): ("SHIFT", 35), + (16, G["int"]): ("SHIFT", 18), + (16, G["let"]): ("SHIFT", 23), (16, G["while"]): ("SHIFT", 22), (16, G["isvoid"]): ("SHIFT", 33), - (16, G["{"]): ("SHIFT", 19), - (16, G["let"]): ("SHIFT", 23), - (16, G["case"]): ("SHIFT", 30), - (16, G["~"]): ("SHIFT", 37), + (16, G["string"]): ("SHIFT", 17), (16, G["not"]): ("SHIFT", 44), - (17, G["pool"]): ("REDUCE", G["atom -> string"]), - (17, G["+"]): ("REDUCE", G["atom -> string"]), + (16, G["("]): ("SHIFT", 20), + (16, G["new"]): ("SHIFT", 31), + (16, G["{"]): ("SHIFT", 19), (17, G["in"]): ("REDUCE", G["atom -> string"]), - (17, G["-"]): ("REDUCE", G["atom -> string"]), + (17, G["+"]): ("REDUCE", G["atom -> string"]), (17, G["}"]): ("REDUCE", G["atom -> string"]), + (17, G["-"]): ("REDUCE", G["atom -> string"]), + (17, G["of"]): ("REDUCE", G["atom -> string"]), (17, G["then"]): ("REDUCE", G["atom -> string"]), (17, G["*"]): ("REDUCE", G["atom -> string"]), - (17, G["of"]): ("REDUCE", G["atom -> string"]), (17, G["/"]): ("REDUCE", G["atom -> string"]), (17, G["else"]): ("REDUCE", G["atom -> string"]), - (17, G["<"]): ("REDUCE", G["atom -> string"]), (17, G[")"]): ("REDUCE", G["atom -> string"]), + (17, G["<"]): ("REDUCE", G["atom -> string"]), (17, G["fi"]): ("REDUCE", G["atom -> string"]), + (17, G["error"]): ("REDUCE", G["atom -> string"]), (17, G["."]): ("REDUCE", G["atom -> string"]), (17, G["<="]): ("REDUCE", G["atom -> string"]), (17, G["="]): ("REDUCE", G["atom -> string"]), @@ -104,86 +105,88 @@ def __action_table(): (17, G[";"]): ("REDUCE", G["atom -> string"]), (17, G["loop"]): ("REDUCE", G["atom -> string"]), (17, G["@"]): ("REDUCE", G["atom -> string"]), - (18, G["pool"]): ("REDUCE", G["atom -> int"]), - (18, G["+"]): ("REDUCE", G["atom -> int"]), + (17, G["pool"]): ("REDUCE", G["atom -> string"]), (18, G["in"]): ("REDUCE", G["atom -> int"]), + (18, G["+"]): ("REDUCE", G["atom -> int"]), (18, G["}"]): ("REDUCE", G["atom -> int"]), (18, G["-"]): ("REDUCE", G["atom -> int"]), + (18, G["of"]): ("REDUCE", G["atom -> int"]), (18, G["then"]): ("REDUCE", G["atom -> int"]), (18, G["*"]): ("REDUCE", G["atom -> int"]), - (18, G["of"]): ("REDUCE", G["atom -> int"]), (18, G["/"]): ("REDUCE", G["atom -> int"]), (18, G["else"]): ("REDUCE", G["atom -> int"]), - (18, G["<"]): ("REDUCE", G["atom -> int"]), (18, G[")"]): ("REDUCE", G["atom -> int"]), + (18, G["<"]): ("REDUCE", G["atom -> int"]), (18, G["fi"]): ("REDUCE", G["atom -> int"]), - (18, G["."]): ("REDUCE", G["atom -> int"]), + (18, G["error"]): ("REDUCE", G["atom -> int"]), (18, G["<="]): ("REDUCE", G["atom -> int"]), + (18, G["."]): ("REDUCE", G["atom -> int"]), (18, G["="]): ("REDUCE", G["atom -> int"]), (18, G[","]): ("REDUCE", G["atom -> int"]), (18, G[";"]): ("REDUCE", G["atom -> int"]), (18, G["loop"]): ("REDUCE", G["atom -> int"]), (18, G["@"]): ("REDUCE", G["atom -> int"]), - (19, G["case"]): ("SHIFT", 30), - (19, G["not"]): ("SHIFT", 44), - (19, G["id"]): ("SHIFT", 15), + (18, G["pool"]): ("REDUCE", G["atom -> int"]), (19, G["~"]): ("SHIFT", 37), - (19, G["isvoid"]): ("SHIFT", 33), - (19, G["true"]): ("SHIFT", 35), - (19, G["int"]): ("SHIFT", 18), (19, G["if"]): ("SHIFT", 21), - (19, G["{"]): ("SHIFT", 19), - (19, G["let"]): ("SHIFT", 23), - (19, G["new"]): ("SHIFT", 31), + (19, G["id"]): ("SHIFT", 15), + (19, G["not"]): ("SHIFT", 44), (19, G["false"]): ("SHIFT", 36), + (19, G["while"]): ("SHIFT", 22), + (19, G["int"]): ("SHIFT", 18), + (19, G["true"]): ("SHIFT", 35), + (19, G["isvoid"]): ("SHIFT", 33), (19, G["string"]): ("SHIFT", 17), + (19, G["let"]): ("SHIFT", 23), + (19, G["new"]): ("SHIFT", 31), (19, G["("]): ("SHIFT", 20), - (19, G["while"]): ("SHIFT", 22), - (20, G["{"]): ("SHIFT", 19), - (20, G["let"]): ("SHIFT", 23), - (20, G["new"]): ("SHIFT", 31), - (20, G["string"]): ("SHIFT", 17), - (20, G["true"]): ("SHIFT", 35), - (20, G["int"]): ("SHIFT", 18), + (19, G["{"]): ("SHIFT", 19), + (19, G["case"]): ("SHIFT", 30), (20, G["id"]): ("SHIFT", 15), - (20, G["while"]): ("SHIFT", 22), + (20, G["isvoid"]): ("SHIFT", 33), (20, G["~"]): ("SHIFT", 37), - (20, G["("]): ("SHIFT", 20), + (20, G["string"]): ("SHIFT", 17), (20, G["case"]): ("SHIFT", 30), - (20, G["not"]): ("SHIFT", 44), + (20, G["{"]): ("SHIFT", 19), + (20, G["let"]): ("SHIFT", 23), + (20, G["("]): ("SHIFT", 20), (20, G["false"]): ("SHIFT", 36), - (20, G["isvoid"]): ("SHIFT", 33), + (20, G["not"]): ("SHIFT", 44), + (20, G["while"]): ("SHIFT", 22), (20, G["if"]): ("SHIFT", 21), - (21, G["int"]): ("SHIFT", 18), - (21, G["true"]): ("SHIFT", 35), - (21, G["while"]): ("SHIFT", 22), - (21, G["false"]): ("SHIFT", 36), - (21, G["new"]): ("SHIFT", 31), - (21, G["string"]): ("SHIFT", 17), + (20, G["int"]): ("SHIFT", 18), + (20, G["new"]): ("SHIFT", 31), + (20, G["true"]): ("SHIFT", 35), + (21, G["~"]): ("SHIFT", 37), + (21, G["id"]): ("SHIFT", 15), (21, G["let"]): ("SHIFT", 23), + (21, G["if"]): ("SHIFT", 21), + (21, G["string"]): ("SHIFT", 17), (21, G["("]): ("SHIFT", 20), - (21, G["not"]): ("SHIFT", 44), (21, G["{"]): ("SHIFT", 19), - (21, G["id"]): ("SHIFT", 15), - (21, G["~"]): ("SHIFT", 37), - (21, G["if"]): ("SHIFT", 21), (21, G["case"]): ("SHIFT", 30), + (21, G["new"]): ("SHIFT", 31), + (21, G["true"]): ("SHIFT", 35), + (21, G["int"]): ("SHIFT", 18), + (21, G["not"]): ("SHIFT", 44), + (21, G["false"]): ("SHIFT", 36), (21, G["isvoid"]): ("SHIFT", 33), - (22, G["{"]): ("SHIFT", 19), - (22, G["~"]): ("SHIFT", 37), - (22, G["id"]): ("SHIFT", 15), - (22, G["string"]): ("SHIFT", 17), - (22, G["("]): ("SHIFT", 20), - (22, G["while"]): ("SHIFT", 22), - (22, G["isvoid"]): ("SHIFT", 33), - (22, G["not"]): ("SHIFT", 44), - (22, G["false"]): ("SHIFT", 36), + (21, G["while"]): ("SHIFT", 22), (22, G["new"]): ("SHIFT", 31), - (22, G["case"]): ("SHIFT", 30), (22, G["int"]): ("SHIFT", 18), (22, G["true"]): ("SHIFT", 35), - (22, G["let"]): ("SHIFT", 23), (22, G["if"]): ("SHIFT", 21), + (22, G["not"]): ("SHIFT", 44), + (22, G["id"]): ("SHIFT", 15), + (22, G["isvoid"]): ("SHIFT", 33), + (22, G["while"]): ("SHIFT", 22), + (22, G["~"]): ("SHIFT", 37), + (22, G["false"]): ("SHIFT", 36), + (22, G["let"]): ("SHIFT", 23), + (22, G["{"]): ("SHIFT", 19), + (22, G["case"]): ("SHIFT", 30), + (22, G["("]): ("SHIFT", 20), + (22, G["string"]): ("SHIFT", 17), (23, G["id"]): ("SHIFT", 24), (24, G[":"]): ("SHIFT", 25), (25, G["type"]): ("SHIFT", 26), @@ -192,80 +195,80 @@ def __action_table(): (26, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), (27, G["id"]): ("SHIFT", 24), (28, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), - (29, G["isvoid"]): ("SHIFT", 33), - (29, G["while"]): ("SHIFT", 22), + (29, G["false"]): ("SHIFT", 36), (29, G["id"]): ("SHIFT", 15), - (29, G["~"]): ("SHIFT", 37), (29, G["let"]): ("SHIFT", 23), - (29, G["string"]): ("SHIFT", 17), - (29, G["("]): ("SHIFT", 20), + (29, G["~"]): ("SHIFT", 37), (29, G["{"]): ("SHIFT", 19), - (29, G["if"]): ("SHIFT", 21), - (29, G["true"]): ("SHIFT", 35), - (29, G["not"]): ("SHIFT", 44), (29, G["case"]): ("SHIFT", 30), - (29, G["false"]): ("SHIFT", 36), + (29, G["string"]): ("SHIFT", 17), + (29, G["isvoid"]): ("SHIFT", 33), (29, G["new"]): ("SHIFT", 31), (29, G["int"]): ("SHIFT", 18), - (30, G["id"]): ("SHIFT", 15), - (30, G["int"]): ("SHIFT", 18), - (30, G["true"]): ("SHIFT", 35), + (29, G["true"]): ("SHIFT", 35), + (29, G["if"]): ("SHIFT", 21), + (29, G["("]): ("SHIFT", 20), + (29, G["while"]): ("SHIFT", 22), + (29, G["not"]): ("SHIFT", 44), + (30, G["{"]): ("SHIFT", 19), (30, G["string"]): ("SHIFT", 17), + (30, G["id"]): ("SHIFT", 15), + (30, G["not"]): ("SHIFT", 44), + (30, G["let"]): ("SHIFT", 23), + (30, G["while"]): ("SHIFT", 22), (30, G["if"]): ("SHIFT", 21), + (30, G["true"]): ("SHIFT", 35), + (30, G["int"]): ("SHIFT", 18), + (30, G["new"]): ("SHIFT", 31), + (30, G["("]): ("SHIFT", 20), (30, G["~"]): ("SHIFT", 37), - (30, G["isvoid"]): ("SHIFT", 33), - (30, G["not"]): ("SHIFT", 44), (30, G["false"]): ("SHIFT", 36), - (30, G["new"]): ("SHIFT", 31), + (30, G["isvoid"]): ("SHIFT", 33), (30, G["case"]): ("SHIFT", 30), - (30, G["let"]): ("SHIFT", 23), - (30, G["("]): ("SHIFT", 20), - (30, G["{"]): ("SHIFT", 19), - (30, G["while"]): ("SHIFT", 22), (31, G["type"]): ("SHIFT", 32), - (32, G["pool"]): ("REDUCE", G["atom -> new type"]), - (32, G["+"]): ("REDUCE", G["atom -> new type"]), (32, G["in"]): ("REDUCE", G["atom -> new type"]), - (32, G["-"]): ("REDUCE", G["atom -> new type"]), + (32, G["+"]): ("REDUCE", G["atom -> new type"]), (32, G["}"]): ("REDUCE", G["atom -> new type"]), + (32, G["-"]): ("REDUCE", G["atom -> new type"]), + (32, G["of"]): ("REDUCE", G["atom -> new type"]), (32, G["then"]): ("REDUCE", G["atom -> new type"]), (32, G["*"]): ("REDUCE", G["atom -> new type"]), - (32, G["of"]): ("REDUCE", G["atom -> new type"]), (32, G["/"]): ("REDUCE", G["atom -> new type"]), (32, G["else"]): ("REDUCE", G["atom -> new type"]), (32, G["<"]): ("REDUCE", G["atom -> new type"]), (32, G[")"]): ("REDUCE", G["atom -> new type"]), (32, G["fi"]): ("REDUCE", G["atom -> new type"]), - (32, G["."]): ("REDUCE", G["atom -> new type"]), + (32, G["error"]): ("REDUCE", G["atom -> new type"]), (32, G["<="]): ("REDUCE", G["atom -> new type"]), + (32, G["."]): ("REDUCE", G["atom -> new type"]), (32, G["="]): ("REDUCE", G["atom -> new type"]), (32, G[","]): ("REDUCE", G["atom -> new type"]), (32, G[";"]): ("REDUCE", G["atom -> new type"]), (32, G["loop"]): ("REDUCE", G["atom -> new type"]), (32, G["@"]): ("REDUCE", G["atom -> new type"]), - (33, G["false"]): ("SHIFT", 36), - (33, G["("]): ("SHIFT", 20), - (33, G["~"]): ("SHIFT", 37), + (32, G["pool"]): ("REDUCE", G["atom -> new type"]), (33, G["id"]): ("SHIFT", 34), - (33, G["true"]): ("SHIFT", 35), + (33, G["("]): ("SHIFT", 20), (33, G["string"]): ("SHIFT", 17), - (33, G["int"]): ("SHIFT", 18), + (33, G["false"]): ("SHIFT", 36), (33, G["isvoid"]): ("SHIFT", 33), + (33, G["true"]): ("SHIFT", 35), + (33, G["int"]): ("SHIFT", 18), (33, G["new"]): ("SHIFT", 31), - (34, G["("]): ("SHIFT", 16), - (34, G["pool"]): ("REDUCE", G["atom -> id"]), - (34, G["+"]): ("REDUCE", G["atom -> id"]), + (33, G["~"]): ("SHIFT", 37), (34, G["in"]): ("REDUCE", G["atom -> id"]), - (34, G["-"]): ("REDUCE", G["atom -> id"]), + (34, G["+"]): ("REDUCE", G["atom -> id"]), (34, G["}"]): ("REDUCE", G["atom -> id"]), + (34, G["-"]): ("REDUCE", G["atom -> id"]), + (34, G["of"]): ("REDUCE", G["atom -> id"]), (34, G["then"]): ("REDUCE", G["atom -> id"]), (34, G["*"]): ("REDUCE", G["atom -> id"]), - (34, G["of"]): ("REDUCE", G["atom -> id"]), (34, G["/"]): ("REDUCE", G["atom -> id"]), (34, G["else"]): ("REDUCE", G["atom -> id"]), - (34, G["<"]): ("REDUCE", G["atom -> id"]), (34, G[")"]): ("REDUCE", G["atom -> id"]), + (34, G["<"]): ("REDUCE", G["atom -> id"]), (34, G["fi"]): ("REDUCE", G["atom -> id"]), + (34, G["error"]): ("REDUCE", G["atom -> id"]), (34, G["."]): ("REDUCE", G["atom -> id"]), (34, G["<="]): ("REDUCE", G["atom -> id"]), (34, G["="]): ("REDUCE", G["atom -> id"]), @@ -273,39 +276,42 @@ def __action_table(): (34, G[";"]): ("REDUCE", G["atom -> id"]), (34, G["loop"]): ("REDUCE", G["atom -> id"]), (34, G["@"]): ("REDUCE", G["atom -> id"]), - (35, G["pool"]): ("REDUCE", G["atom -> true"]), - (35, G["+"]): ("REDUCE", G["atom -> true"]), + (34, G["pool"]): ("REDUCE", G["atom -> id"]), + (34, G["("]): ("SHIFT", 16), (35, G["in"]): ("REDUCE", G["atom -> true"]), - (35, G["}"]): ("REDUCE", G["atom -> true"]), + (35, G["+"]): ("REDUCE", G["atom -> true"]), (35, G["-"]): ("REDUCE", G["atom -> true"]), + (35, G["}"]): ("REDUCE", G["atom -> true"]), + (35, G["of"]): ("REDUCE", G["atom -> true"]), (35, G["then"]): ("REDUCE", G["atom -> true"]), (35, G["*"]): ("REDUCE", G["atom -> true"]), - (35, G["of"]): ("REDUCE", G["atom -> true"]), (35, G["/"]): ("REDUCE", G["atom -> true"]), (35, G["else"]): ("REDUCE", G["atom -> true"]), - (35, G["<"]): ("REDUCE", G["atom -> true"]), (35, G[")"]): ("REDUCE", G["atom -> true"]), + (35, G["<"]): ("REDUCE", G["atom -> true"]), (35, G["fi"]): ("REDUCE", G["atom -> true"]), - (35, G["."]): ("REDUCE", G["atom -> true"]), + (35, G["error"]): ("REDUCE", G["atom -> true"]), (35, G["<="]): ("REDUCE", G["atom -> true"]), + (35, G["."]): ("REDUCE", G["atom -> true"]), (35, G["="]): ("REDUCE", G["atom -> true"]), (35, G[","]): ("REDUCE", G["atom -> true"]), (35, G[";"]): ("REDUCE", G["atom -> true"]), (35, G["loop"]): ("REDUCE", G["atom -> true"]), (35, G["@"]): ("REDUCE", G["atom -> true"]), - (36, G["pool"]): ("REDUCE", G["atom -> false"]), - (36, G["+"]): ("REDUCE", G["atom -> false"]), + (35, G["pool"]): ("REDUCE", G["atom -> true"]), (36, G["in"]): ("REDUCE", G["atom -> false"]), - (36, G["-"]): ("REDUCE", G["atom -> false"]), + (36, G["+"]): ("REDUCE", G["atom -> false"]), (36, G["}"]): ("REDUCE", G["atom -> false"]), + (36, G["-"]): ("REDUCE", G["atom -> false"]), + (36, G["of"]): ("REDUCE", G["atom -> false"]), (36, G["then"]): ("REDUCE", G["atom -> false"]), (36, G["*"]): ("REDUCE", G["atom -> false"]), - (36, G["of"]): ("REDUCE", G["atom -> false"]), (36, G["/"]): ("REDUCE", G["atom -> false"]), (36, G["else"]): ("REDUCE", G["atom -> false"]), - (36, G["<"]): ("REDUCE", G["atom -> false"]), (36, G[")"]): ("REDUCE", G["atom -> false"]), + (36, G["<"]): ("REDUCE", G["atom -> false"]), (36, G["fi"]): ("REDUCE", G["atom -> false"]), + (36, G["error"]): ("REDUCE", G["atom -> false"]), (36, G["."]): ("REDUCE", G["atom -> false"]), (36, G["<="]): ("REDUCE", G["atom -> false"]), (36, G["="]): ("REDUCE", G["atom -> false"]), @@ -313,28 +319,29 @@ def __action_table(): (36, G[";"]): ("REDUCE", G["atom -> false"]), (36, G["loop"]): ("REDUCE", G["atom -> false"]), (36, G["@"]): ("REDUCE", G["atom -> false"]), - (37, G["false"]): ("SHIFT", 36), - (37, G["("]): ("SHIFT", 20), - (37, G["~"]): ("SHIFT", 37), + (36, G["pool"]): ("REDUCE", G["atom -> false"]), (37, G["id"]): ("SHIFT", 34), - (37, G["true"]): ("SHIFT", 35), + (37, G["("]): ("SHIFT", 20), (37, G["string"]): ("SHIFT", 17), - (37, G["int"]): ("SHIFT", 18), + (37, G["false"]): ("SHIFT", 36), (37, G["isvoid"]): ("SHIFT", 33), + (37, G["true"]): ("SHIFT", 35), + (37, G["int"]): ("SHIFT", 18), (37, G["new"]): ("SHIFT", 31), - (38, G["pool"]): ("REDUCE", G["atom -> function-call"]), - (38, G["+"]): ("REDUCE", G["atom -> function-call"]), + (37, G["~"]): ("SHIFT", 37), (38, G["in"]): ("REDUCE", G["atom -> function-call"]), - (38, G["-"]): ("REDUCE", G["atom -> function-call"]), + (38, G["+"]): ("REDUCE", G["atom -> function-call"]), (38, G["}"]): ("REDUCE", G["atom -> function-call"]), + (38, G["-"]): ("REDUCE", G["atom -> function-call"]), + (38, G["of"]): ("REDUCE", G["atom -> function-call"]), (38, G["then"]): ("REDUCE", G["atom -> function-call"]), (38, G["*"]): ("REDUCE", G["atom -> function-call"]), - (38, G["of"]): ("REDUCE", G["atom -> function-call"]), (38, G["/"]): ("REDUCE", G["atom -> function-call"]), (38, G["else"]): ("REDUCE", G["atom -> function-call"]), - (38, G["<"]): ("REDUCE", G["atom -> function-call"]), (38, G[")"]): ("REDUCE", G["atom -> function-call"]), + (38, G["<"]): ("REDUCE", G["atom -> function-call"]), (38, G["fi"]): ("REDUCE", G["atom -> function-call"]), + (38, G["error"]): ("REDUCE", G["atom -> function-call"]), (38, G["."]): ("REDUCE", G["atom -> function-call"]), (38, G["<="]): ("REDUCE", G["atom -> function-call"]), (38, G["="]): ("REDUCE", G["atom -> function-call"]), @@ -342,338 +349,353 @@ def __action_table(): (38, G[";"]): ("REDUCE", G["atom -> function-call"]), (38, G["loop"]): ("REDUCE", G["atom -> function-call"]), (38, G["@"]): ("REDUCE", G["atom -> function-call"]), - (39, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["+"]): ("REDUCE", G["factor -> ~ factor"]), + (38, G["pool"]): ("REDUCE", G["atom -> function-call"]), (39, G["in"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["}"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["+"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["-"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["}"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["of"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["then"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["*"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["of"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["/"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["else"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["<"]): ("REDUCE", G["factor -> ~ factor"]), (39, G[")"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["<"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["error"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["<="]): ("REDUCE", G["factor -> ~ factor"]), (39, G["="]): ("REDUCE", G["factor -> ~ factor"]), (39, G[","]): ("REDUCE", G["factor -> ~ factor"]), (39, G[";"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), (40, G["@"]): ("SHIFT", 69), - (40, G["pool"]): ("REDUCE", G["factor -> atom"]), - (40, G["+"]): ("REDUCE", G["factor -> atom"]), (40, G["in"]): ("REDUCE", G["factor -> atom"]), - (40, G["-"]): ("REDUCE", G["factor -> atom"]), + (40, G["+"]): ("REDUCE", G["factor -> atom"]), (40, G["}"]): ("REDUCE", G["factor -> atom"]), + (40, G["-"]): ("REDUCE", G["factor -> atom"]), + (40, G["of"]): ("REDUCE", G["factor -> atom"]), (40, G["then"]): ("REDUCE", G["factor -> atom"]), (40, G["*"]): ("REDUCE", G["factor -> atom"]), - (40, G["of"]): ("REDUCE", G["factor -> atom"]), (40, G["/"]): ("REDUCE", G["factor -> atom"]), (40, G["else"]): ("REDUCE", G["factor -> atom"]), (40, G["<"]): ("REDUCE", G["factor -> atom"]), (40, G[")"]): ("REDUCE", G["factor -> atom"]), (40, G["fi"]): ("REDUCE", G["factor -> atom"]), + (40, G["error"]): ("REDUCE", G["factor -> atom"]), (40, G["<="]): ("REDUCE", G["factor -> atom"]), (40, G["="]): ("REDUCE", G["factor -> atom"]), (40, G[","]): ("REDUCE", G["factor -> atom"]), (40, G[";"]): ("REDUCE", G["factor -> atom"]), (40, G["loop"]): ("REDUCE", G["factor -> atom"]), + (40, G["pool"]): ("REDUCE", G["factor -> atom"]), (40, G["."]): ("SHIFT", 41), (41, G["id"]): ("SHIFT", 42), (42, G["("]): ("SHIFT", 43), - (43, G["int"]): ("SHIFT", 18), - (43, G["true"]): ("SHIFT", 35), - (43, G["id"]): ("SHIFT", 15), - (43, G["new"]): ("SHIFT", 31), + (43, G["case"]): ("SHIFT", 30), (43, G["false"]): ("SHIFT", 36), + (43, G["~"]): ("SHIFT", 37), (43, G["if"]): ("SHIFT", 21), - (43, G["("]): ("SHIFT", 20), - (43, G["string"]): ("SHIFT", 17), + (43, G["id"]): ("SHIFT", 15), + (43, G["true"]): ("SHIFT", 35), + (43, G["int"]): ("SHIFT", 18), + (43, G["let"]): ("SHIFT", 23), (43, G["while"]): ("SHIFT", 22), (43, G["isvoid"]): ("SHIFT", 33), - (43, G["{"]): ("SHIFT", 19), - (43, G["let"]): ("SHIFT", 23), - (43, G["case"]): ("SHIFT", 30), - (43, G["~"]): ("SHIFT", 37), + (43, G["string"]): ("SHIFT", 17), (43, G["not"]): ("SHIFT", 44), - (44, G["false"]): ("SHIFT", 36), - (44, G["let"]): ("SHIFT", 23), - (44, G["id"]): ("SHIFT", 15), + (43, G["("]): ("SHIFT", 20), + (43, G["new"]): ("SHIFT", 31), + (43, G["{"]): ("SHIFT", 19), (44, G["string"]): ("SHIFT", 17), - (44, G["true"]): ("SHIFT", 35), + (44, G["if"]): ("SHIFT", 21), + (44, G["isvoid"]): ("SHIFT", 33), (44, G["int"]): ("SHIFT", 18), - (44, G["while"]): ("SHIFT", 22), + (44, G["true"]): ("SHIFT", 35), (44, G["{"]): ("SHIFT", 19), - (44, G["not"]): ("SHIFT", 44), + (44, G["false"]): ("SHIFT", 36), + (44, G["id"]): ("SHIFT", 15), (44, G["case"]): ("SHIFT", 30), - (44, G["isvoid"]): ("SHIFT", 33), - (44, G["("]): ("SHIFT", 20), - (44, G["if"]): ("SHIFT", 21), + (44, G["let"]): ("SHIFT", 23), (44, G["~"]): ("SHIFT", 37), + (44, G["not"]): ("SHIFT", 44), + (44, G["while"]): ("SHIFT", 22), + (44, G["("]): ("SHIFT", 20), (44, G["new"]): ("SHIFT", 31), - (45, G["then"]): ("REDUCE", G["expr -> not expr"]), - (45, G["of"]): ("REDUCE", G["expr -> not expr"]), - (45, G["pool"]): ("REDUCE", G["expr -> not expr"]), - (45, G["else"]): ("REDUCE", G["expr -> not expr"]), - (45, G[")"]): ("REDUCE", G["expr -> not expr"]), (45, G["fi"]): ("REDUCE", G["expr -> not expr"]), - (45, G[","]): ("REDUCE", G["expr -> not expr"]), + (45, G["error"]): ("REDUCE", G["expr -> not expr"]), (45, G["in"]): ("REDUCE", G["expr -> not expr"]), + (45, G[","]): ("REDUCE", G["expr -> not expr"]), (45, G[";"]): ("REDUCE", G["expr -> not expr"]), (45, G["}"]): ("REDUCE", G["expr -> not expr"]), (45, G["loop"]): ("REDUCE", G["expr -> not expr"]), - (46, G["then"]): ("REDUCE", G["expr -> comp"]), - (46, G["of"]): ("REDUCE", G["expr -> comp"]), - (46, G["pool"]): ("REDUCE", G["expr -> comp"]), - (46, G["else"]): ("REDUCE", G["expr -> comp"]), - (46, G[")"]): ("REDUCE", G["expr -> comp"]), + (45, G["of"]): ("REDUCE", G["expr -> not expr"]), + (45, G["then"]): ("REDUCE", G["expr -> not expr"]), + (45, G["pool"]): ("REDUCE", G["expr -> not expr"]), + (45, G["else"]): ("REDUCE", G["expr -> not expr"]), + (45, G[")"]): ("REDUCE", G["expr -> not expr"]), (46, G["fi"]): ("REDUCE", G["expr -> comp"]), - (46, G[","]): ("REDUCE", G["expr -> comp"]), + (46, G["error"]): ("REDUCE", G["expr -> comp"]), (46, G["in"]): ("REDUCE", G["expr -> comp"]), + (46, G[","]): ("REDUCE", G["expr -> comp"]), (46, G[";"]): ("REDUCE", G["expr -> comp"]), (46, G["}"]): ("REDUCE", G["expr -> comp"]), (46, G["loop"]): ("REDUCE", G["expr -> comp"]), - (47, G["+"]): ("SHIFT", 48), - (47, G["then"]): ("REDUCE", G["comp -> arith"]), - (47, G["of"]): ("REDUCE", G["comp -> arith"]), - (47, G["pool"]): ("REDUCE", G["comp -> arith"]), - (47, G["else"]): ("REDUCE", G["comp -> arith"]), - (47, G[")"]): ("REDUCE", G["comp -> arith"]), + (46, G["of"]): ("REDUCE", G["expr -> comp"]), + (46, G["then"]): ("REDUCE", G["expr -> comp"]), + (46, G["pool"]): ("REDUCE", G["expr -> comp"]), + (46, G["else"]): ("REDUCE", G["expr -> comp"]), + (46, G[")"]): ("REDUCE", G["expr -> comp"]), + (47, G["<"]): ("SHIFT", 57), + (47, G["<="]): ("SHIFT", 60), + (47, G["-"]): ("SHIFT", 55), + (47, G["="]): ("SHIFT", 62), (47, G["fi"]): ("REDUCE", G["comp -> arith"]), - (47, G[","]): ("REDUCE", G["comp -> arith"]), + (47, G["error"]): ("REDUCE", G["comp -> arith"]), (47, G["in"]): ("REDUCE", G["comp -> arith"]), + (47, G[","]): ("REDUCE", G["comp -> arith"]), (47, G[";"]): ("REDUCE", G["comp -> arith"]), (47, G["}"]): ("REDUCE", G["comp -> arith"]), (47, G["loop"]): ("REDUCE", G["comp -> arith"]), - (47, G["="]): ("SHIFT", 62), - (47, G["<"]): ("SHIFT", 57), - (47, G["-"]): ("SHIFT", 55), - (47, G["<="]): ("SHIFT", 60), - (48, G["false"]): ("SHIFT", 36), - (48, G["id"]): ("SHIFT", 34), + (47, G["of"]): ("REDUCE", G["comp -> arith"]), + (47, G["then"]): ("REDUCE", G["comp -> arith"]), + (47, G["pool"]): ("REDUCE", G["comp -> arith"]), + (47, G["else"]): ("REDUCE", G["comp -> arith"]), + (47, G[")"]): ("REDUCE", G["comp -> arith"]), + (47, G["+"]): ("SHIFT", 48), (48, G["string"]): ("SHIFT", 17), - (48, G["int"]): ("SHIFT", 18), - (48, G["true"]): ("SHIFT", 35), (48, G["isvoid"]): ("SHIFT", 33), + (48, G["true"]): ("SHIFT", 35), + (48, G["int"]): ("SHIFT", 18), + (48, G["id"]): ("SHIFT", 34), (48, G["("]): ("SHIFT", 20), - (48, G["~"]): ("SHIFT", 37), + (48, G["false"]): ("SHIFT", 36), (48, G["new"]): ("SHIFT", 31), - (49, G["*"]): ("SHIFT", 50), - (49, G["/"]): ("SHIFT", 52), - (49, G["pool"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["+"]): ("REDUCE", G["arith -> arith + term"]), + (48, G["~"]): ("SHIFT", 37), (49, G["in"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["}"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["+"]): ("REDUCE", G["arith -> arith + term"]), (49, G["-"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["then"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["}"]): ("REDUCE", G["arith -> arith + term"]), (49, G["of"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["then"]): ("REDUCE", G["arith -> arith + term"]), (49, G["else"]): ("REDUCE", G["arith -> arith + term"]), (49, G["<"]): ("REDUCE", G["arith -> arith + term"]), (49, G[")"]): ("REDUCE", G["arith -> arith + term"]), (49, G["fi"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["error"]): ("REDUCE", G["arith -> arith + term"]), (49, G["<="]): ("REDUCE", G["arith -> arith + term"]), (49, G["="]): ("REDUCE", G["arith -> arith + term"]), (49, G[","]): ("REDUCE", G["arith -> arith + term"]), (49, G[";"]): ("REDUCE", G["arith -> arith + term"]), (49, G["loop"]): ("REDUCE", G["arith -> arith + term"]), - (50, G["false"]): ("SHIFT", 36), - (50, G["("]): ("SHIFT", 20), - (50, G["~"]): ("SHIFT", 37), + (49, G["pool"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["*"]): ("SHIFT", 50), + (49, G["/"]): ("SHIFT", 52), (50, G["id"]): ("SHIFT", 34), - (50, G["true"]): ("SHIFT", 35), + (50, G["("]): ("SHIFT", 20), (50, G["string"]): ("SHIFT", 17), - (50, G["int"]): ("SHIFT", 18), + (50, G["false"]): ("SHIFT", 36), (50, G["isvoid"]): ("SHIFT", 33), + (50, G["true"]): ("SHIFT", 35), + (50, G["int"]): ("SHIFT", 18), (50, G["new"]): ("SHIFT", 31), - (51, G["pool"]): ("REDUCE", G["term -> term * factor"]), - (51, G["+"]): ("REDUCE", G["term -> term * factor"]), + (50, G["~"]): ("SHIFT", 37), (51, G["in"]): ("REDUCE", G["term -> term * factor"]), + (51, G["+"]): ("REDUCE", G["term -> term * factor"]), (51, G["}"]): ("REDUCE", G["term -> term * factor"]), (51, G["-"]): ("REDUCE", G["term -> term * factor"]), + (51, G["of"]): ("REDUCE", G["term -> term * factor"]), (51, G["then"]): ("REDUCE", G["term -> term * factor"]), (51, G["*"]): ("REDUCE", G["term -> term * factor"]), - (51, G["of"]): ("REDUCE", G["term -> term * factor"]), (51, G["/"]): ("REDUCE", G["term -> term * factor"]), (51, G["else"]): ("REDUCE", G["term -> term * factor"]), (51, G["<"]): ("REDUCE", G["term -> term * factor"]), (51, G[")"]): ("REDUCE", G["term -> term * factor"]), (51, G["fi"]): ("REDUCE", G["term -> term * factor"]), + (51, G["error"]): ("REDUCE", G["term -> term * factor"]), (51, G["<="]): ("REDUCE", G["term -> term * factor"]), (51, G["="]): ("REDUCE", G["term -> term * factor"]), (51, G[","]): ("REDUCE", G["term -> term * factor"]), (51, G[";"]): ("REDUCE", G["term -> term * factor"]), (51, G["loop"]): ("REDUCE", G["term -> term * factor"]), - (52, G["false"]): ("SHIFT", 36), - (52, G["("]): ("SHIFT", 20), - (52, G["~"]): ("SHIFT", 37), + (51, G["pool"]): ("REDUCE", G["term -> term * factor"]), (52, G["id"]): ("SHIFT", 34), - (52, G["true"]): ("SHIFT", 35), + (52, G["("]): ("SHIFT", 20), (52, G["string"]): ("SHIFT", 17), - (52, G["int"]): ("SHIFT", 18), + (52, G["false"]): ("SHIFT", 36), (52, G["isvoid"]): ("SHIFT", 33), + (52, G["true"]): ("SHIFT", 35), + (52, G["int"]): ("SHIFT", 18), (52, G["new"]): ("SHIFT", 31), - (53, G["pool"]): ("REDUCE", G["term -> term / factor"]), - (53, G["+"]): ("REDUCE", G["term -> term / factor"]), + (52, G["~"]): ("SHIFT", 37), (53, G["in"]): ("REDUCE", G["term -> term / factor"]), + (53, G["+"]): ("REDUCE", G["term -> term / factor"]), (53, G["}"]): ("REDUCE", G["term -> term / factor"]), (53, G["-"]): ("REDUCE", G["term -> term / factor"]), + (53, G["of"]): ("REDUCE", G["term -> term / factor"]), (53, G["then"]): ("REDUCE", G["term -> term / factor"]), (53, G["*"]): ("REDUCE", G["term -> term / factor"]), - (53, G["of"]): ("REDUCE", G["term -> term / factor"]), (53, G["/"]): ("REDUCE", G["term -> term / factor"]), (53, G["else"]): ("REDUCE", G["term -> term / factor"]), (53, G["<"]): ("REDUCE", G["term -> term / factor"]), (53, G[")"]): ("REDUCE", G["term -> term / factor"]), (53, G["fi"]): ("REDUCE", G["term -> term / factor"]), + (53, G["error"]): ("REDUCE", G["term -> term / factor"]), (53, G["<="]): ("REDUCE", G["term -> term / factor"]), (53, G["="]): ("REDUCE", G["term -> term / factor"]), (53, G[","]): ("REDUCE", G["term -> term / factor"]), (53, G[";"]): ("REDUCE", G["term -> term / factor"]), (53, G["loop"]): ("REDUCE", G["term -> term / factor"]), - (54, G["pool"]): ("REDUCE", G["term -> factor"]), - (54, G["+"]): ("REDUCE", G["term -> factor"]), + (53, G["pool"]): ("REDUCE", G["term -> term / factor"]), (54, G["in"]): ("REDUCE", G["term -> factor"]), - (54, G["}"]): ("REDUCE", G["term -> factor"]), + (54, G["+"]): ("REDUCE", G["term -> factor"]), (54, G["-"]): ("REDUCE", G["term -> factor"]), + (54, G["}"]): ("REDUCE", G["term -> factor"]), + (54, G["of"]): ("REDUCE", G["term -> factor"]), (54, G["then"]): ("REDUCE", G["term -> factor"]), (54, G["*"]): ("REDUCE", G["term -> factor"]), - (54, G["of"]): ("REDUCE", G["term -> factor"]), (54, G["/"]): ("REDUCE", G["term -> factor"]), (54, G["else"]): ("REDUCE", G["term -> factor"]), (54, G["<"]): ("REDUCE", G["term -> factor"]), (54, G[")"]): ("REDUCE", G["term -> factor"]), (54, G["fi"]): ("REDUCE", G["term -> factor"]), + (54, G["error"]): ("REDUCE", G["term -> factor"]), (54, G["<="]): ("REDUCE", G["term -> factor"]), (54, G["="]): ("REDUCE", G["term -> factor"]), (54, G[","]): ("REDUCE", G["term -> factor"]), (54, G[";"]): ("REDUCE", G["term -> factor"]), (54, G["loop"]): ("REDUCE", G["term -> factor"]), - (55, G["false"]): ("SHIFT", 36), - (55, G["id"]): ("SHIFT", 34), + (54, G["pool"]): ("REDUCE", G["term -> factor"]), (55, G["string"]): ("SHIFT", 17), - (55, G["int"]): ("SHIFT", 18), - (55, G["true"]): ("SHIFT", 35), (55, G["isvoid"]): ("SHIFT", 33), + (55, G["true"]): ("SHIFT", 35), + (55, G["int"]): ("SHIFT", 18), + (55, G["id"]): ("SHIFT", 34), (55, G["("]): ("SHIFT", 20), - (55, G["~"]): ("SHIFT", 37), + (55, G["false"]): ("SHIFT", 36), (55, G["new"]): ("SHIFT", 31), - (56, G["*"]): ("SHIFT", 50), - (56, G["/"]): ("SHIFT", 52), - (56, G["pool"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["+"]): ("REDUCE", G["arith -> arith - term"]), + (55, G["~"]): ("SHIFT", 37), (56, G["in"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["-"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["+"]): ("REDUCE", G["arith -> arith - term"]), (56, G["}"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["then"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["-"]): ("REDUCE", G["arith -> arith - term"]), (56, G["of"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["then"]): ("REDUCE", G["arith -> arith - term"]), (56, G["else"]): ("REDUCE", G["arith -> arith - term"]), (56, G["<"]): ("REDUCE", G["arith -> arith - term"]), (56, G[")"]): ("REDUCE", G["arith -> arith - term"]), (56, G["fi"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["error"]): ("REDUCE", G["arith -> arith - term"]), (56, G["<="]): ("REDUCE", G["arith -> arith - term"]), (56, G["="]): ("REDUCE", G["arith -> arith - term"]), (56, G[","]): ("REDUCE", G["arith -> arith - term"]), (56, G[";"]): ("REDUCE", G["arith -> arith - term"]), (56, G["loop"]): ("REDUCE", G["arith -> arith - term"]), - (57, G["("]): ("SHIFT", 20), - (57, G["string"]): ("SHIFT", 17), - (57, G["int"]): ("SHIFT", 18), - (57, G["isvoid"]): ("SHIFT", 33), - (57, G["true"]): ("SHIFT", 35), + (56, G["pool"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["*"]): ("SHIFT", 50), + (56, G["/"]): ("SHIFT", 52), (57, G["id"]): ("SHIFT", 34), (57, G["~"]): ("SHIFT", 37), + (57, G["int"]): ("SHIFT", 18), + (57, G["true"]): ("SHIFT", 35), + (57, G["string"]): ("SHIFT", 17), (57, G["new"]): ("SHIFT", 31), + (57, G["isvoid"]): ("SHIFT", 33), + (57, G["("]): ("SHIFT", 20), (57, G["false"]): ("SHIFT", 36), (58, G["+"]): ("SHIFT", 48), (58, G["-"]): ("SHIFT", 55), - (58, G["then"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G["of"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G["else"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G[")"]): ("REDUCE", G["comp -> arith < arith"]), (58, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G[","]): ("REDUCE", G["comp -> arith < arith"]), + (58, G["error"]): ("REDUCE", G["comp -> arith < arith"]), (58, G["in"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G[","]): ("REDUCE", G["comp -> arith < arith"]), (58, G[";"]): ("REDUCE", G["comp -> arith < arith"]), (58, G["}"]): ("REDUCE", G["comp -> arith < arith"]), (58, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), - (59, G["*"]): ("SHIFT", 50), - (59, G["pool"]): ("REDUCE", G["arith -> term"]), - (59, G["+"]): ("REDUCE", G["arith -> term"]), + (58, G["of"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G["then"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G["else"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G[")"]): ("REDUCE", G["comp -> arith < arith"]), (59, G["in"]): ("REDUCE", G["arith -> term"]), - (59, G["}"]): ("REDUCE", G["arith -> term"]), + (59, G["+"]): ("REDUCE", G["arith -> term"]), (59, G["-"]): ("REDUCE", G["arith -> term"]), - (59, G["then"]): ("REDUCE", G["arith -> term"]), + (59, G["}"]): ("REDUCE", G["arith -> term"]), (59, G["of"]): ("REDUCE", G["arith -> term"]), + (59, G["then"]): ("REDUCE", G["arith -> term"]), (59, G["else"]): ("REDUCE", G["arith -> term"]), (59, G["<"]): ("REDUCE", G["arith -> term"]), (59, G[")"]): ("REDUCE", G["arith -> term"]), (59, G["fi"]): ("REDUCE", G["arith -> term"]), + (59, G["error"]): ("REDUCE", G["arith -> term"]), (59, G["<="]): ("REDUCE", G["arith -> term"]), (59, G["="]): ("REDUCE", G["arith -> term"]), (59, G[","]): ("REDUCE", G["arith -> term"]), (59, G[";"]): ("REDUCE", G["arith -> term"]), (59, G["loop"]): ("REDUCE", G["arith -> term"]), + (59, G["pool"]): ("REDUCE", G["arith -> term"]), + (59, G["*"]): ("SHIFT", 50), (59, G["/"]): ("SHIFT", 52), - (60, G["("]): ("SHIFT", 20), - (60, G["string"]): ("SHIFT", 17), - (60, G["int"]): ("SHIFT", 18), - (60, G["isvoid"]): ("SHIFT", 33), - (60, G["true"]): ("SHIFT", 35), (60, G["id"]): ("SHIFT", 34), (60, G["~"]): ("SHIFT", 37), + (60, G["int"]): ("SHIFT", 18), + (60, G["true"]): ("SHIFT", 35), + (60, G["string"]): ("SHIFT", 17), (60, G["new"]): ("SHIFT", 31), + (60, G["isvoid"]): ("SHIFT", 33), + (60, G["("]): ("SHIFT", 20), (60, G["false"]): ("SHIFT", 36), - (61, G["+"]): ("SHIFT", 48), - (61, G["-"]): ("SHIFT", 55), - (61, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), (61, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G[","]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), (61, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G[","]): ("REDUCE", G["comp -> arith <= arith"]), (61, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), (61, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), (61, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), - (62, G["("]): ("SHIFT", 20), - (62, G["string"]): ("SHIFT", 17), - (62, G["int"]): ("SHIFT", 18), - (62, G["isvoid"]): ("SHIFT", 33), - (62, G["true"]): ("SHIFT", 35), + (61, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G["+"]): ("SHIFT", 48), + (61, G["-"]): ("SHIFT", 55), (62, G["id"]): ("SHIFT", 34), (62, G["~"]): ("SHIFT", 37), + (62, G["int"]): ("SHIFT", 18), + (62, G["true"]): ("SHIFT", 35), + (62, G["string"]): ("SHIFT", 17), (62, G["new"]): ("SHIFT", 31), + (62, G["isvoid"]): ("SHIFT", 33), + (62, G["("]): ("SHIFT", 20), (62, G["false"]): ("SHIFT", 36), (63, G["+"]): ("SHIFT", 48), - (63, G["-"]): ("SHIFT", 55), - (63, G["then"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G["of"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G["else"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G[")"]): ("REDUCE", G["comp -> arith = arith"]), (63, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G[","]): ("REDUCE", G["comp -> arith = arith"]), + (63, G["error"]): ("REDUCE", G["comp -> arith = arith"]), (63, G["in"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G[","]): ("REDUCE", G["comp -> arith = arith"]), (63, G[";"]): ("REDUCE", G["comp -> arith = arith"]), (63, G["}"]): ("REDUCE", G["comp -> arith = arith"]), (63, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G["of"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G["then"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G["else"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G[")"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G["-"]): ("SHIFT", 55), (64, G[")"]): ("SHIFT", 65), - (65, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), @@ -681,57 +703,58 @@ def __action_table(): (65, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (66, G[","]): ("SHIFT", 67), + (65, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (66, G[")"]): ("REDUCE", G["expr-list -> expr"]), - (67, G["int"]): ("SHIFT", 18), - (67, G["true"]): ("SHIFT", 35), - (67, G["id"]): ("SHIFT", 15), - (67, G["new"]): ("SHIFT", 31), + (66, G[","]): ("SHIFT", 67), + (67, G["case"]): ("SHIFT", 30), (67, G["false"]): ("SHIFT", 36), + (67, G["~"]): ("SHIFT", 37), (67, G["if"]): ("SHIFT", 21), - (67, G["("]): ("SHIFT", 20), - (67, G["string"]): ("SHIFT", 17), + (67, G["id"]): ("SHIFT", 15), + (67, G["true"]): ("SHIFT", 35), + (67, G["int"]): ("SHIFT", 18), + (67, G["let"]): ("SHIFT", 23), (67, G["while"]): ("SHIFT", 22), (67, G["isvoid"]): ("SHIFT", 33), - (67, G["{"]): ("SHIFT", 19), - (67, G["let"]): ("SHIFT", 23), - (67, G["case"]): ("SHIFT", 30), - (67, G["~"]): ("SHIFT", 37), + (67, G["string"]): ("SHIFT", 17), (67, G["not"]): ("SHIFT", 44), + (67, G["("]): ("SHIFT", 20), + (67, G["new"]): ("SHIFT", 31), + (67, G["{"]): ("SHIFT", 19), (68, G[")"]): ("REDUCE", G["expr-list -> expr , expr-list"]), (69, G["type"]): ("SHIFT", 70), (70, G["."]): ("SHIFT", 71), (71, G["id"]): ("SHIFT", 72), (72, G["("]): ("SHIFT", 73), - (73, G["int"]): ("SHIFT", 18), - (73, G["true"]): ("SHIFT", 35), - (73, G["id"]): ("SHIFT", 15), - (73, G["new"]): ("SHIFT", 31), + (73, G["case"]): ("SHIFT", 30), (73, G["false"]): ("SHIFT", 36), + (73, G["~"]): ("SHIFT", 37), (73, G["if"]): ("SHIFT", 21), - (73, G["("]): ("SHIFT", 20), - (73, G["string"]): ("SHIFT", 17), + (73, G["id"]): ("SHIFT", 15), + (73, G["true"]): ("SHIFT", 35), + (73, G["int"]): ("SHIFT", 18), + (73, G["let"]): ("SHIFT", 23), (73, G["while"]): ("SHIFT", 22), (73, G["isvoid"]): ("SHIFT", 33), - (73, G["{"]): ("SHIFT", 19), - (73, G["let"]): ("SHIFT", 23), - (73, G["case"]): ("SHIFT", 30), - (73, G["~"]): ("SHIFT", 37), + (73, G["string"]): ("SHIFT", 17), (73, G["not"]): ("SHIFT", 44), + (73, G["("]): ("SHIFT", 20), + (73, G["new"]): ("SHIFT", 31), + (73, G["{"]): ("SHIFT", 19), (74, G[")"]): ("SHIFT", 75), - (75, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), @@ -739,177 +762,183 @@ def __action_table(): (75, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), + (75, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), (77, G["of"]): ("SHIFT", 78), (78, G["id"]): ("SHIFT", 79), (79, G[":"]): ("SHIFT", 80), (80, G["type"]): ("SHIFT", 81), (81, G["=>"]): ("SHIFT", 82), - (82, G["case"]): ("SHIFT", 30), - (82, G["not"]): ("SHIFT", 44), - (82, G["id"]): ("SHIFT", 15), (82, G["~"]): ("SHIFT", 37), - (82, G["isvoid"]): ("SHIFT", 33), - (82, G["true"]): ("SHIFT", 35), - (82, G["int"]): ("SHIFT", 18), (82, G["if"]): ("SHIFT", 21), - (82, G["{"]): ("SHIFT", 19), - (82, G["let"]): ("SHIFT", 23), - (82, G["new"]): ("SHIFT", 31), + (82, G["id"]): ("SHIFT", 15), + (82, G["not"]): ("SHIFT", 44), (82, G["false"]): ("SHIFT", 36), + (82, G["while"]): ("SHIFT", 22), + (82, G["int"]): ("SHIFT", 18), + (82, G["true"]): ("SHIFT", 35), + (82, G["isvoid"]): ("SHIFT", 33), (82, G["string"]): ("SHIFT", 17), + (82, G["let"]): ("SHIFT", 23), + (82, G["new"]): ("SHIFT", 31), (82, G["("]): ("SHIFT", 20), - (82, G["while"]): ("SHIFT", 22), + (82, G["{"]): ("SHIFT", 19), + (82, G["case"]): ("SHIFT", 30), (83, G[";"]): ("SHIFT", 84), (84, G["id"]): ("SHIFT", 79), (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), (86, G["esac"]): ("SHIFT", 87), - (87, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (87, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (87, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), (87, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (87, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (87, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), + (87, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G[","]): ("SHIFT", 89), + (88, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), (89, G["id"]): ("SHIFT", 24), (90, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), (91, G["in"]): ("SHIFT", 92), - (92, G["false"]): ("SHIFT", 36), - (92, G["let"]): ("SHIFT", 23), - (92, G["id"]): ("SHIFT", 15), (92, G["string"]): ("SHIFT", 17), - (92, G["true"]): ("SHIFT", 35), + (92, G["if"]): ("SHIFT", 21), + (92, G["isvoid"]): ("SHIFT", 33), (92, G["int"]): ("SHIFT", 18), - (92, G["while"]): ("SHIFT", 22), + (92, G["true"]): ("SHIFT", 35), (92, G["{"]): ("SHIFT", 19), - (92, G["not"]): ("SHIFT", 44), + (92, G["false"]): ("SHIFT", 36), + (92, G["id"]): ("SHIFT", 15), (92, G["case"]): ("SHIFT", 30), - (92, G["isvoid"]): ("SHIFT", 33), - (92, G["("]): ("SHIFT", 20), - (92, G["if"]): ("SHIFT", 21), + (92, G["let"]): ("SHIFT", 23), (92, G["~"]): ("SHIFT", 37), + (92, G["not"]): ("SHIFT", 44), + (92, G["while"]): ("SHIFT", 22), + (92, G["("]): ("SHIFT", 20), (92, G["new"]): ("SHIFT", 31), - (93, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (93, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (93, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), (93, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (93, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (93, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["loop"]): ("SHIFT", 95), - (95, G["true"]): ("SHIFT", 35), - (95, G["int"]): ("SHIFT", 18), (95, G["id"]): ("SHIFT", 15), - (95, G["let"]): ("SHIFT", 23), - (95, G["{"]): ("SHIFT", 19), - (95, G["while"]): ("SHIFT", 22), + (95, G["isvoid"]): ("SHIFT", 33), + (95, G["case"]): ("SHIFT", 30), (95, G["string"]): ("SHIFT", 17), - (95, G["("]): ("SHIFT", 20), + (95, G["{"]): ("SHIFT", 19), + (95, G["if"]): ("SHIFT", 21), + (95, G["false"]): ("SHIFT", 36), + (95, G["true"]): ("SHIFT", 35), + (95, G["int"]): ("SHIFT", 18), (95, G["new"]): ("SHIFT", 31), - (95, G["~"]): ("SHIFT", 37), - (95, G["isvoid"]): ("SHIFT", 33), + (95, G["("]): ("SHIFT", 20), (95, G["not"]): ("SHIFT", 44), - (95, G["false"]): ("SHIFT", 36), - (95, G["if"]): ("SHIFT", 21), - (95, G["case"]): ("SHIFT", 30), + (95, G["while"]): ("SHIFT", 22), + (95, G["let"]): ("SHIFT", 23), + (95, G["~"]): ("SHIFT", 37), (96, G["pool"]): ("SHIFT", 97), - (97, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (97, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (97, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), (97, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (97, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (97, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["then"]): ("SHIFT", 99), - (99, G["false"]): ("SHIFT", 36), (99, G["new"]): ("SHIFT", 31), - (99, G["id"]): ("SHIFT", 15), - (99, G["string"]): ("SHIFT", 17), - (99, G["int"]): ("SHIFT", 18), (99, G["true"]): ("SHIFT", 35), - (99, G["let"]): ("SHIFT", 23), + (99, G["int"]): ("SHIFT", 18), + (99, G["if"]): ("SHIFT", 21), (99, G["not"]): ("SHIFT", 44), - (99, G["{"]): ("SHIFT", 19), + (99, G["id"]): ("SHIFT", 15), + (99, G["isvoid"]): ("SHIFT", 33), (99, G["while"]): ("SHIFT", 22), + (99, G["~"]): ("SHIFT", 37), + (99, G["false"]): ("SHIFT", 36), + (99, G["let"]): ("SHIFT", 23), + (99, G["{"]): ("SHIFT", 19), (99, G["case"]): ("SHIFT", 30), - (99, G["isvoid"]): ("SHIFT", 33), (99, G["("]): ("SHIFT", 20), - (99, G["~"]): ("SHIFT", 37), - (99, G["if"]): ("SHIFT", 21), + (99, G["string"]): ("SHIFT", 17), (100, G["else"]): ("SHIFT", 101), + (101, G["while"]): ("SHIFT", 22), + (101, G["let"]): ("SHIFT", 23), (101, G["id"]): ("SHIFT", 15), (101, G["("]): ("SHIFT", 20), - (101, G["if"]): ("SHIFT", 21), (101, G["~"]): ("SHIFT", 37), - (101, G["int"]): ("SHIFT", 18), + (101, G["false"]): ("SHIFT", 36), (101, G["true"]): ("SHIFT", 35), - (101, G["string"]): ("SHIFT", 17), - (101, G["while"]): ("SHIFT", 22), + (101, G["int"]): ("SHIFT", 18), + (101, G["if"]): ("SHIFT", 21), + (101, G["new"]): ("SHIFT", 31), + (101, G["case"]): ("SHIFT", 30), (101, G["{"]): ("SHIFT", 19), - (101, G["let"]): ("SHIFT", 23), (101, G["isvoid"]): ("SHIFT", 33), - (101, G["case"]): ("SHIFT", 30), - (101, G["new"]): ("SHIFT", 31), - (101, G["false"]): ("SHIFT", 36), + (101, G["string"]): ("SHIFT", 17), (101, G["not"]): ("SHIFT", 44), (102, G["fi"]): ("SHIFT", 103), - (103, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (103, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (103, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (103, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (103, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (103, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G[")"]): ("SHIFT", 105), - (105, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["+"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["in"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["+"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["-"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["}"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["of"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["then"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["*"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["of"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["/"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["else"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["<"]): ("REDUCE", G["atom -> ( expr )"]), (105, G[")"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["<"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["error"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["."]): ("REDUCE", G["atom -> ( expr )"]), (105, G["<="]): ("REDUCE", G["atom -> ( expr )"]), (105, G["="]): ("REDUCE", G["atom -> ( expr )"]), @@ -917,50 +946,52 @@ def __action_table(): (105, G[";"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["@"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["}"]): ("SHIFT", 107), - (107, G["then"]): ("REDUCE", G["expr -> { block }"]), - (107, G["of"]): ("REDUCE", G["expr -> { block }"]), - (107, G["pool"]): ("REDUCE", G["expr -> { block }"]), - (107, G["else"]): ("REDUCE", G["expr -> { block }"]), - (107, G[")"]): ("REDUCE", G["expr -> { block }"]), (107, G["fi"]): ("REDUCE", G["expr -> { block }"]), - (107, G[","]): ("REDUCE", G["expr -> { block }"]), + (107, G["error"]): ("REDUCE", G["expr -> { block }"]), (107, G["in"]): ("REDUCE", G["expr -> { block }"]), + (107, G[","]): ("REDUCE", G["expr -> { block }"]), (107, G[";"]): ("REDUCE", G["expr -> { block }"]), (107, G["}"]): ("REDUCE", G["expr -> { block }"]), (107, G["loop"]): ("REDUCE", G["expr -> { block }"]), + (107, G["of"]): ("REDUCE", G["expr -> { block }"]), + (107, G["then"]): ("REDUCE", G["expr -> { block }"]), + (107, G["pool"]): ("REDUCE", G["expr -> { block }"]), + (107, G["else"]): ("REDUCE", G["expr -> { block }"]), + (107, G[")"]): ("REDUCE", G["expr -> { block }"]), (108, G[";"]): ("SHIFT", 109), - (109, G["case"]): ("SHIFT", 30), - (109, G["not"]): ("SHIFT", 44), + (109, G["~"]): ("SHIFT", 37), + (109, G["if"]): ("SHIFT", 21), (109, G["id"]): ("SHIFT", 15), - (109, G["~"]): ("SHIFT", 37), - (109, G["isvoid"]): ("SHIFT", 33), - (109, G["true"]): ("SHIFT", 35), + (109, G["not"]): ("SHIFT", 44), + (109, G["false"]): ("SHIFT", 36), + (109, G["while"]): ("SHIFT", 22), (109, G["int"]): ("SHIFT", 18), - (109, G["if"]): ("SHIFT", 21), - (109, G["{"]): ("SHIFT", 19), + (109, G["true"]): ("SHIFT", 35), + (109, G["isvoid"]): ("SHIFT", 33), + (109, G["string"]): ("SHIFT", 17), (109, G["let"]): ("SHIFT", 23), (109, G["new"]): ("SHIFT", 31), - (109, G["false"]): ("SHIFT", 36), - (109, G["string"]): ("SHIFT", 17), - (109, G["}"]): ("REDUCE", G["block -> expr ;"]), (109, G["("]): ("SHIFT", 20), - (109, G["while"]): ("SHIFT", 22), + (109, G["{"]): ("SHIFT", 19), + (109, G["}"]): ("REDUCE", G["block -> expr ;"]), + (109, G["case"]): ("SHIFT", 30), (110, G["}"]): ("REDUCE", G["block -> expr ; block"]), (111, G[")"]): ("SHIFT", 112), - (112, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), @@ -968,314 +999,332 @@ def __action_table(): (112, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (113, G["false"]): ("SHIFT", 36), - (113, G["let"]): ("SHIFT", 23), - (113, G["id"]): ("SHIFT", 15), + (112, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (113, G["string"]): ("SHIFT", 17), - (113, G["true"]): ("SHIFT", 35), + (113, G["if"]): ("SHIFT", 21), + (113, G["isvoid"]): ("SHIFT", 33), (113, G["int"]): ("SHIFT", 18), - (113, G["while"]): ("SHIFT", 22), + (113, G["true"]): ("SHIFT", 35), (113, G["{"]): ("SHIFT", 19), - (113, G["not"]): ("SHIFT", 44), + (113, G["false"]): ("SHIFT", 36), + (113, G["id"]): ("SHIFT", 15), (113, G["case"]): ("SHIFT", 30), - (113, G["isvoid"]): ("SHIFT", 33), - (113, G["("]): ("SHIFT", 20), - (113, G["if"]): ("SHIFT", 21), + (113, G["let"]): ("SHIFT", 23), (113, G["~"]): ("SHIFT", 37), + (113, G["not"]): ("SHIFT", 44), + (113, G["while"]): ("SHIFT", 22), + (113, G["("]): ("SHIFT", 20), (113, G["new"]): ("SHIFT", 31), - (114, G["then"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G["of"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G["else"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G[")"]): ("REDUCE", G["expr -> id <- expr"]), (114, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G[","]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["error"]): ("REDUCE", G["expr -> id <- expr"]), (114, G["in"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G[","]): ("REDUCE", G["expr -> id <- expr"]), (114, G[";"]): ("REDUCE", G["expr -> id <- expr"]), (114, G["}"]): ("REDUCE", G["expr -> id <- expr"]), (114, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["of"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["then"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["else"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G[")"]): ("REDUCE", G["expr -> id <- expr"]), (115, G["}"]): ("SHIFT", 116), + (116, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), (116, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), (117, G[")"]): ("SHIFT", 118), (118, G[":"]): ("SHIFT", 119), (119, G["type"]): ("SHIFT", 120), (120, G["{"]): ("SHIFT", 121), + (121, G["new"]): ("SHIFT", 31), + (121, G["("]): ("SHIFT", 20), + (121, G["id"]): ("SHIFT", 15), (121, G["{"]): ("SHIFT", 19), + (121, G["case"]): ("SHIFT", 30), + (121, G["~"]): ("SHIFT", 37), (121, G["if"]): ("SHIFT", 21), (121, G["not"]): ("SHIFT", 44), - (121, G["~"]): ("SHIFT", 37), (121, G["false"]): ("SHIFT", 36), - (121, G["case"]): ("SHIFT", 30), - (121, G["id"]): ("SHIFT", 15), - (121, G["new"]): ("SHIFT", 31), - (121, G["isvoid"]): ("SHIFT", 33), - (121, G["true"]): ("SHIFT", 35), - (121, G["string"]): ("SHIFT", 17), - (121, G["("]): ("SHIFT", 20), (121, G["while"]): ("SHIFT", 22), (121, G["int"]): ("SHIFT", 18), + (121, G["true"]): ("SHIFT", 35), + (121, G["isvoid"]): ("SHIFT", 33), + (121, G["string"]): ("SHIFT", 17), (121, G["let"]): ("SHIFT", 23), (122, G["}"]): ("SHIFT", 123), + (123, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (123, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (124, G["type"]): ("SHIFT", 125), - (125, G[";"]): ("REDUCE", G["attribute -> id : type"]), - (125, G["error"]): ("SHIFT", 128), (125, G["<-"]): ("SHIFT", 126), - (126, G["case"]): ("SHIFT", 30), + (125, G["error"]): ("REDUCE", G["attribute -> id : type"]), + (125, G[";"]): ("REDUCE", G["attribute -> id : type"]), + (126, G["string"]): ("SHIFT", 17), (126, G["not"]): ("SHIFT", 44), + (126, G["("]): ("SHIFT", 20), + (126, G["new"]): ("SHIFT", 31), (126, G["id"]): ("SHIFT", 15), + (126, G["{"]): ("SHIFT", 19), + (126, G["case"]): ("SHIFT", 30), + (126, G["false"]): ("SHIFT", 36), (126, G["~"]): ("SHIFT", 37), - (126, G["isvoid"]): ("SHIFT", 33), - (126, G["true"]): ("SHIFT", 35), - (126, G["int"]): ("SHIFT", 18), (126, G["if"]): ("SHIFT", 21), - (126, G["{"]): ("SHIFT", 19), + (126, G["int"]): ("SHIFT", 18), + (126, G["true"]): ("SHIFT", 35), (126, G["let"]): ("SHIFT", 23), - (126, G["new"]): ("SHIFT", 31), - (126, G["false"]): ("SHIFT", 36), - (126, G["string"]): ("SHIFT", 17), - (126, G["("]): ("SHIFT", 20), (126, G["while"]): ("SHIFT", 22), + (126, G["isvoid"]): ("SHIFT", 33), + (127, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), (127, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), - (128, G[";"]): ("REDUCE", G["attribute -> id : type error"]), - (129, G["}"]): ("SHIFT", 130), - (130, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), - (130, G["class"]): ("REDUCE", G["class-def -> class type { feature-list }"]), - (131, G[";"]): ("SHIFT", 132), - (132, G["}"]): ("REDUCE", G["feature-list -> e"]), - (132, G["id"]): ("SHIFT", 4), - (133, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), - (134, G[";"]): ("SHIFT", 135), - (135, G["}"]): ("REDUCE", G["feature-list -> e"]), - (135, G["id"]): ("SHIFT", 4), - (136, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), - (137, G["type"]): ("SHIFT", 138), - (138, G["{"]): ("SHIFT", 139), - (139, G["}"]): ("REDUCE", G["feature-list -> e"]), - (139, G["id"]): ("SHIFT", 4), - (140, G["}"]): ("SHIFT", 141), - (141, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), - (141, G["class"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), - (142, G["$"]): ("OK", None), - (143, G["$"]): ("REDUCE", G["program -> class-list"]), - (144, G["class"]): ("SHIFT", 1), - (144, G["$"]): ("REDUCE", G["class-list -> class-def"]), - (145, G["$"]): ("REDUCE", G["class-list -> class-def class-list"]), + (128, G["}"]): ("SHIFT", 129), + (129, G["class"]): ("REDUCE", G["class-def -> class type { feature-list }"]), + (129, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), + (130, G["error"]): ("SHIFT", 138), + (130, G[";"]): ("SHIFT", 131), + (131, G["id"]): ("SHIFT", 4), + (131, G["}"]): ("REDUCE", G["feature-list -> e"]), + (132, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), + (133, G[";"]): ("SHIFT", 134), + (133, G["error"]): ("SHIFT", 136), + (134, G["id"]): ("SHIFT", 4), + (134, G["}"]): ("REDUCE", G["feature-list -> e"]), + (135, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), + (136, G["id"]): ("SHIFT", 4), + (136, G["}"]): ("REDUCE", G["feature-list -> e"]), + (137, G["}"]): ("REDUCE", G["feature-list -> method error feature-list"]), + (138, G["id"]): ("SHIFT", 4), + (138, G["}"]): ("REDUCE", G["feature-list -> e"]), + (139, G["}"]): ("REDUCE", G["feature-list -> attribute error feature-list"]), + (140, G["type"]): ("SHIFT", 141), + (141, G["{"]): ("SHIFT", 142), + (142, G["id"]): ("SHIFT", 4), + (142, G["}"]): ("REDUCE", G["feature-list -> e"]), + (143, G["}"]): ("SHIFT", 144), + (144, G["class"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), + (144, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), + (145, G["$"]): ("OK", None), + (146, G["$"]): ("REDUCE", G["program -> class-list"]), + (147, G["class"]): ("SHIFT", 1), + (147, G["$"]): ("REDUCE", G["class-list -> class-def"]), + (148, G["$"]): ("REDUCE", G["class-list -> class-def class-list"]), } @staticmethod def __goto_table(): return { - (0, G["class-def"]): 144, - (0, G["class-list"]): 143, - (0, G["program"]): 142, - (3, G["attribute"]): 131, - (3, G["method"]): 134, - (3, G["feature-list"]): 129, + (0, G["class-list"]): 146, + (0, G["class-def"]): 147, + (0, G["program"]): 145, + (3, G["method"]): 133, + (3, G["feature-list"]): 128, + (3, G["attribute"]): 130, (5, G["param-list"]): 117, (9, G["param-list"]): 10, (14, G["term"]): 59, - (14, G["function-call"]): 38, (14, G["arith"]): 47, - (14, G["comp"]): 46, + (14, G["factor"]): 54, (14, G["atom"]): 40, + (14, G["function-call"]): 38, + (14, G["comp"]): 46, (14, G["expr"]): 115, - (14, G["factor"]): 54, (16, G["arith"]): 47, + (16, G["expr-list"]): 111, + (16, G["expr"]): 66, + (16, G["term"]): 59, (16, G["comp"]): 46, (16, G["factor"]): 54, (16, G["atom"]): 40, (16, G["function-call"]): 38, - (16, G["expr"]): 66, - (16, G["term"]): 59, - (16, G["expr-list"]): 111, - (19, G["term"]): 59, - (19, G["arith"]): 47, (19, G["atom"]): 40, + (19, G["arith"]): 47, (19, G["expr"]): 108, + (19, G["term"]): 59, (19, G["factor"]): 54, - (19, G["function-call"]): 38, (19, G["block"]): 106, + (19, G["function-call"]): 38, (19, G["comp"]): 46, + (20, G["comp"]): 46, + (20, G["term"]): 59, (20, G["arith"]): 47, - (20, G["function-call"]): 38, (20, G["expr"]): 104, - (20, G["term"]): 59, (20, G["atom"]): 40, - (20, G["comp"]): 46, (20, G["factor"]): 54, + (20, G["function-call"]): 38, (21, G["arith"]): 47, - (21, G["term"]): 59, + (21, G["comp"]): 46, (21, G["atom"]): 40, - (21, G["function-call"]): 38, (21, G["factor"]): 54, (21, G["expr"]): 98, - (21, G["comp"]): 46, - (22, G["term"]): 59, - (22, G["arith"]): 47, + (21, G["term"]): 59, + (21, G["function-call"]): 38, (22, G["atom"]): 40, - (22, G["comp"]): 46, + (22, G["arith"]): 47, + (22, G["term"]): 59, (22, G["expr"]): 94, (22, G["function-call"]): 38, + (22, G["comp"]): 46, (22, G["factor"]): 54, (23, G["declaration-list"]): 91, (27, G["declaration-list"]): 28, - (29, G["term"]): 59, + (29, G["function-call"]): 38, (29, G["arith"]): 47, - (29, G["factor"]): 54, + (29, G["term"]): 59, + (29, G["comp"]): 46, (29, G["atom"]): 40, - (29, G["function-call"]): 38, + (29, G["factor"]): 54, (29, G["expr"]): 88, - (29, G["comp"]): 46, (30, G["arith"]): 47, - (30, G["atom"]): 40, (30, G["expr"]): 77, + (30, G["atom"]): 40, + (30, G["factor"]): 54, (30, G["term"]): 59, - (30, G["comp"]): 46, (30, G["function-call"]): 38, - (30, G["factor"]): 54, + (30, G["comp"]): 46, + (33, G["function-call"]): 38, (33, G["atom"]): 40, (33, G["factor"]): 76, - (33, G["function-call"]): 38, - (37, G["atom"]): 40, - (37, G["function-call"]): 38, (37, G["factor"]): 39, + (37, G["function-call"]): 38, + (37, G["atom"]): 40, (43, G["arith"]): 47, + (43, G["expr"]): 66, (43, G["expr-list"]): 64, + (43, G["term"]): 59, (43, G["comp"]): 46, (43, G["factor"]): 54, (43, G["atom"]): 40, (43, G["function-call"]): 38, - (43, G["expr"]): 66, - (43, G["term"]): 59, - (44, G["function-call"]): 38, - (44, G["arith"]): 47, - (44, G["expr"]): 45, - (44, G["factor"]): 54, (44, G["atom"]): 40, (44, G["term"]): 59, + (44, G["arith"]): 47, + (44, G["function-call"]): 38, + (44, G["factor"]): 54, (44, G["comp"]): 46, + (44, G["expr"]): 45, (48, G["function-call"]): 38, - (48, G["factor"]): 54, (48, G["atom"]): 40, (48, G["term"]): 49, - (50, G["atom"]): 40, - (50, G["function-call"]): 38, + (48, G["factor"]): 54, (50, G["factor"]): 51, - (52, G["atom"]): 40, + (50, G["function-call"]): 38, + (50, G["atom"]): 40, (52, G["function-call"]): 38, (52, G["factor"]): 53, + (52, G["atom"]): 40, (55, G["function-call"]): 38, - (55, G["factor"]): 54, (55, G["term"]): 56, (55, G["atom"]): 40, - (57, G["arith"]): 58, + (55, G["factor"]): 54, + (57, G["term"]): 59, (57, G["atom"]): 40, + (57, G["arith"]): 58, (57, G["function-call"]): 38, - (57, G["term"]): 59, (57, G["factor"]): 54, - (60, G["arith"]): 61, + (60, G["term"]): 59, (60, G["atom"]): 40, + (60, G["arith"]): 61, (60, G["function-call"]): 38, - (60, G["term"]): 59, (60, G["factor"]): 54, - (62, G["arith"]): 63, + (62, G["term"]): 59, (62, G["atom"]): 40, + (62, G["arith"]): 63, (62, G["function-call"]): 38, - (62, G["term"]): 59, (62, G["factor"]): 54, (67, G["arith"]): 47, + (67, G["expr"]): 66, + (67, G["term"]): 59, (67, G["comp"]): 46, (67, G["factor"]): 54, + (67, G["expr-list"]): 68, (67, G["atom"]): 40, (67, G["function-call"]): 38, - (67, G["expr"]): 66, - (67, G["term"]): 59, - (67, G["expr-list"]): 68, (73, G["arith"]): 47, + (73, G["expr"]): 66, + (73, G["term"]): 59, (73, G["comp"]): 46, (73, G["factor"]): 54, + (73, G["expr-list"]): 74, (73, G["atom"]): 40, (73, G["function-call"]): 38, - (73, G["expr-list"]): 74, - (73, G["expr"]): 66, - (73, G["term"]): 59, (78, G["case-list"]): 86, - (82, G["term"]): 59, - (82, G["arith"]): 47, + (82, G["expr"]): 83, (82, G["atom"]): 40, + (82, G["arith"]): 47, + (82, G["term"]): 59, (82, G["factor"]): 54, - (82, G["expr"]): 83, (82, G["function-call"]): 38, (82, G["comp"]): 46, (84, G["case-list"]): 85, (89, G["declaration-list"]): 90, - (92, G["function-call"]): 38, - (92, G["arith"]): 47, - (92, G["factor"]): 54, - (92, G["expr"]): 93, (92, G["atom"]): 40, (92, G["term"]): 59, + (92, G["arith"]): 47, + (92, G["function-call"]): 38, + (92, G["expr"]): 93, + (92, G["factor"]): 54, (92, G["comp"]): 46, - (95, G["expr"]): 96, (95, G["arith"]): 47, - (95, G["atom"]): 40, (95, G["term"]): 59, - (95, G["function-call"]): 38, - (95, G["comp"]): 46, (95, G["factor"]): 54, - (99, G["expr"]): 100, - (99, G["function-call"]): 38, - (99, G["factor"]): 54, + (95, G["expr"]): 96, + (95, G["comp"]): 46, + (95, G["atom"]): 40, + (95, G["function-call"]): 38, (99, G["atom"]): 40, (99, G["arith"]): 47, - (99, G["comp"]): 46, (99, G["term"]): 59, - (101, G["arith"]): 47, + (99, G["expr"]): 100, + (99, G["function-call"]): 38, + (99, G["comp"]): 46, + (99, G["factor"]): 54, + (101, G["term"]): 59, + (101, G["function-call"]): 38, (101, G["comp"]): 46, - (101, G["atom"]): 40, + (101, G["arith"]): 47, (101, G["factor"]): 54, - (101, G["term"]): 59, + (101, G["atom"]): 40, (101, G["expr"]): 102, - (101, G["function-call"]): 38, - (109, G["term"]): 59, - (109, G["arith"]): 47, (109, G["atom"]): 40, + (109, G["arith"]): 47, + (109, G["block"]): 110, (109, G["expr"]): 108, + (109, G["term"]): 59, (109, G["factor"]): 54, - (109, G["block"]): 110, (109, G["function-call"]): 38, (109, G["comp"]): 46, + (113, G["atom"]): 40, + (113, G["term"]): 59, + (113, G["arith"]): 47, (113, G["expr"]): 114, (113, G["function-call"]): 38, - (113, G["arith"]): 47, (113, G["factor"]): 54, - (113, G["atom"]): 40, - (113, G["term"]): 59, (113, G["comp"]): 46, (121, G["term"]): 59, - (121, G["function-call"]): 38, (121, G["arith"]): 47, - (121, G["comp"]): 46, + (121, G["factor"]): 54, (121, G["atom"]): 40, + (121, G["function-call"]): 38, + (121, G["comp"]): 46, (121, G["expr"]): 122, - (121, G["factor"]): 54, - (126, G["term"]): 59, (126, G["arith"]): 47, - (126, G["atom"]): 40, (126, G["factor"]): 54, + (126, G["term"]): 59, + (126, G["atom"]): 40, (126, G["function-call"]): 38, - (126, G["expr"]): 127, (126, G["comp"]): 46, - (132, G["attribute"]): 131, - (132, G["method"]): 134, - (132, G["feature-list"]): 133, - (135, G["attribute"]): 131, - (135, G["method"]): 134, - (135, G["feature-list"]): 136, - (139, G["attribute"]): 131, - (139, G["method"]): 134, - (139, G["feature-list"]): 140, - (144, G["class-def"]): 144, - (144, G["class-list"]): 145, + (126, G["expr"]): 127, + (131, G["feature-list"]): 132, + (131, G["method"]): 133, + (131, G["attribute"]): 130, + (134, G["method"]): 133, + (134, G["attribute"]): 130, + (134, G["feature-list"]): 135, + (136, G["method"]): 133, + (136, G["attribute"]): 130, + (136, G["feature-list"]): 137, + (138, G["method"]): 133, + (138, G["attribute"]): 130, + (138, G["feature-list"]): 139, + (142, G["method"]): 133, + (142, G["feature-list"]): 143, + (142, G["attribute"]): 130, + (147, G["class-def"]): 147, + (147, G["class-list"]): 148, } diff --git a/scripts/main.cl b/scripts/main.cl index ff1de46f7..abedfd347 100644 --- a/scripts/main.cl +++ b/scripts/main.cl @@ -1,3 +1,12 @@ +--Any characters between two dashes “--” and the next newline +--(or EOF, if there is no next newline) are treated as comments + +(*(*(* +Comments may also be written by enclosing +text in (∗ . . . ∗). The latter form of comment may be nested. +Comments cannot cross file boundaries. +*)*)*) + class Main { main ( msg : String ) : Void { let a: Int <- 25, b: Int <- 15 in { From 61e29e7fb2b16c08415d98d9c9cd83fc52654cb5 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Sun, 26 Apr 2020 00:11:47 -0400 Subject: [PATCH 022/143] Created Cool Base Class Hierarchy --- cmp/parsing.py | 3 +-- semantic.py | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/cmp/parsing.py b/cmp/parsing.py index 9deec7d07..4e8e4ade8 100755 --- a/cmp/parsing.py +++ b/cmp/parsing.py @@ -398,8 +398,7 @@ def __call__(self, tokens): except KeyError: # If en error insertion fails then the parsing process enter into a panic mode recovery sys.stderr.write( - f'{lookahead.line, lookahead.column} - SyntacticError: ERROR at or near "{lookahead.lex}"\n' - ) + f'{lookahead.line, lookahead.column} - SyntacticError: ERROR at or near "{lookahead.lex}"\n') while (state, lookahead.token_type) not in self.action: cursor += 1 if cursor >= len(tokens): diff --git a/semantic.py b/semantic.py index 00bea3189..82918a52c 100644 --- a/semantic.py +++ b/semantic.py @@ -8,6 +8,30 @@ from scope import Context, SemanticError, Type, Scope, Method +""" +Object + abort() : Object + type_name() : String + copy() : SELF_TYPE + +IO + out_string(x : String) : SELF_TYPE + out_int(x : Int) : SELF_TYPE + in_string() : String + in_int() : Int + +Int (Sealed) + default -> 0 + +Bool (Sealed) + default -> False + +String + length() : Int + concat(s : String) : String + substr(i : Int, l : Int) : String +""" + class Formatter: @visitor.on('node') @@ -139,8 +163,27 @@ def visit(self, node): @visitor.when(ast.ProgramNode) def visit(self, node): self.context = Context() + object_type = self.context.create_type('Object') + io_type = self.context.create_type('IO') + string_type = self.context.create_type('String') self.context.create_type('Int') - self.context.create_type('Void') + self.context.create_type('Bool') + + object_type.define_method('abort', [], [], self.context.get_type('Object')) + object_type.define_method('get_type', [], [], self.context.get_type('String')) + object_type.define_method('abort', [], [], self.context.get_type('SELF_TYPE')) + + io_type.define_method('out_string', ['x'], [self.context.get_type('String')], + self.context.get_type('SELF_TYPE')) + io_type.define_method('out_int', ['x'], [self.context.get_type('Int')], self.context.get_type('SELF_TYPE')) + io_type.define_method('in_string', [], [], self.context.get_type('String')) + io_type.define_method('in_int', [], [], self.context.get_type('Int')) + + string_type.define_method('length', [], [], self.context.get_type('Int')) + string_type.define_method('concat', ['s'], [self.context.get_type('String')], self.context.get_type('String')) + string_type.define_method('substr', ['i', 'l'], [self.context.get_type('Int'), self.context.get_type('int')], + self.context.get_type('Int')) + for declaration in node.declarations: self.visit(declaration) @@ -172,7 +215,11 @@ def visit(self, node: ast.ClassDeclarationNode): try: self.current_type = self.context.get_type(node.id) if node.parent is not None: + if node.parent in ('Int', 'Bool'): + self.errors.append(f'Cannot inherit from type "{node.parent}"') self.current_type.set_parent(self.context.get_type(node.parent)) + else: + self.current_type.set_parent(self.context.get_type('Object')) except SemanticError as e: self.errors.append(e.text) From 746db0d5c12135c09f96eb96537347c91acf6ffc Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Sun, 26 Apr 2020 00:14:33 -0400 Subject: [PATCH 023/143] Added AUTO_TYPE and SELF_TYPE to cool base class hierarchy --- semantic.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/semantic.py b/semantic.py index 82918a52c..7c3fd1b10 100644 --- a/semantic.py +++ b/semantic.py @@ -163,6 +163,8 @@ def visit(self, node): @visitor.when(ast.ProgramNode) def visit(self, node): self.context = Context() + self.context.create_type('SELF_TYPE') + self.context.create_type('AUTO_TYPE') object_type = self.context.create_type('Object') io_type = self.context.create_type('IO') string_type = self.context.create_type('String') From 494d8bb90825d5ef934e99ae09faa00d04018970 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Sun, 26 Apr 2020 00:39:02 -0400 Subject: [PATCH 024/143] Changed types of the parameters `attribues` and `methods` in class Type for a Dict[str, Attribute] and a Dict[str, Method] instead of list, respectively --- scope.py | 37 +++++++++++-------------------------- semantic.py | 2 +- 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/scope.py b/scope.py index 5c70e55d1..f9050f0a4 100644 --- a/scope.py +++ b/scope.py @@ -1,6 +1,5 @@ -import itertools from collections import OrderedDict -from typing import List, Optional, Iterable, Dict +from typing import List, Optional, Dict class SemanticError(Exception): @@ -41,8 +40,8 @@ def __eq__(self, other): class Type: def __init__(self, name: str): self.name: str = name - self.attributes: List[Attribute] = [] - self.methods: List[Method] = [] + self.attributes: Dict[str, Attribute] = [] + self.methods: Dict[str, Method] = [] self.parent: Optional['Type'] = None def set_parent(self, parent: 'Type') -> None: @@ -52,8 +51,8 @@ def set_parent(self, parent: 'Type') -> None: def get_attribute(self, name: str) -> Attribute: try: - return next(attr for attr in self.attributes if attr.name == name) - except StopIteration: + return self.methods[name] + except KeyError: if self.parent is None: raise SemanticError(f'Attribute "{name}" is not defined in {self.name}.') try: @@ -66,14 +65,14 @@ def define_attribute(self, name: str, typex: 'Type') -> Attribute: self.get_attribute(name) except SemanticError: attribute = Attribute(name, typex) - self.attributes.append(attribute) + self.attributes[name] = attribute return attribute else: raise SemanticError(f'Attribute "{name}" is already defined in {self.name}.') def get_method(self, name: str) -> Method: try: - return next(method for method in self.methods if method.name == name) + return self.methods[name] except StopIteration: if self.parent is None: raise SemanticError(f'Method "{name}" is not defined in {self.name}.') @@ -86,22 +85,22 @@ def define_method(self, name: str, param_names: List[str], param_types: List['Type'], return_type: 'Type') -> Method: - if name in (method.name for method in self.methods): + if name in self.methods: raise SemanticError(f'Method "{name}" already defined in {self.name}') method = Method(name, param_names, param_types, return_type) - self.methods.append(method) + self.methods[name] = method return method def all_attributes(self, clean: bool = True): plain = OrderedDict() if self.parent is None else self.parent.all_attributes(False) - for attr in self.attributes: + for attr in self.attributes.values(): plain[attr.name] = (attr, self) return plain.values() if clean else plain def all_methods(self, clean: bool = True): plain = OrderedDict() if self.parent is None else self.parent.all_methods(False) - for method in self.methods: + for method in self.methods.values(): plain[method.name] = (method, self) return plain.values() if clean else plain @@ -142,20 +141,6 @@ def __eq__(self, other): return isinstance(other, Type) -class VoidType(Type): - def __init__(self): - super().__init__('') - - def conforms_to(self, other): - raise Exception('Invalid type: void type.') - - def bypass(self): - return True - - def __eq__(self, other): - return isinstance(other, VoidType) - - class IntType(Type): def __init__(self): super().__init__('int') diff --git a/semantic.py b/semantic.py index 7c3fd1b10..b0dd0611e 100644 --- a/semantic.py +++ b/semantic.py @@ -184,7 +184,7 @@ def visit(self, node): string_type.define_method('length', [], [], self.context.get_type('Int')) string_type.define_method('concat', ['s'], [self.context.get_type('String')], self.context.get_type('String')) string_type.define_method('substr', ['i', 'l'], [self.context.get_type('Int'), self.context.get_type('int')], - self.context.get_type('Int')) + self.context.get_type('String')) for declaration in node.declarations: self.visit(declaration) From f6189554f2e1a1523ee4ce7408f234cde89b1f6d Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Mon, 27 Apr 2020 21:20:34 -0400 Subject: [PATCH 025/143] save --- cmp/pycompiler.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmp/pycompiler.py b/cmp/pycompiler.py index 6fd05f085..5a76f940b 100755 --- a/cmp/pycompiler.py +++ b/cmp/pycompiler.py @@ -377,6 +377,7 @@ def decorator(rule: Optional[Callable[['RuleList'], object]]): head, body = production.split('->') head = self[head.strip()] head %= body.strip(), rule + return rule return decorator @@ -392,6 +393,7 @@ def terminal(self, name: str, regex: str): """ def decorator(rule: Optional[Callable[[Lexer], Optional[Token]]]): self.add_terminal(name, regex, rule) + return rule return decorator From 04963bea14620bbb26db24b1fa59940e3b6990db Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Tue, 28 Apr 2020 13:54:05 -0400 Subject: [PATCH 026/143] Fixed up decorator for productions, terminals and errors --- .gitignore | 0 Instructions.md | 0 README.md | 0 __init__.py | 0 astnodes.py | 0 cmp/__pycache__/__init__.cpython-37.pyc | Bin cmp/__pycache__/automata.cpython-37.pyc | Bin cmp/__pycache__/pycompiler.cpython-37.pyc | Bin cmp/__pycache__/utils.cpython-37.pyc | Bin cmp/lexing.py | 0 cmp/pycompiler.py | 16 +- cmp/recovery.py | 0 cmp/serialization.py | 0 grammar.py | 0 lexer.py | 0 main.py | 0 parser.py | 1348 ++++++++++----------- scope.py | 0 scripts/main.cl | 0 semantic.py | 0 tester.py | 0 tests/lexer/comment1.cl | 0 tests/lexer/comment1_error.txt | 0 tests/lexer/iis1.cl | 0 tests/lexer/iis1_error.txt | 0 tests/lexer/iis2.cl | 0 tests/lexer/iis2_error.txt | 0 tests/lexer/iis3.cl | 0 tests/lexer/iis3_error.txt | 0 tests/lexer/iis4.cl | 0 tests/lexer/iis4_error.txt | 0 tests/lexer/iis5.cl | 0 tests/lexer/iis5_error.txt | 0 tests/lexer/iis6.cl | 0 tests/lexer/iis6_error.txt | 0 tests/lexer/mixed1.cl | 0 tests/lexer/mixed1_error.txt | 0 tests/lexer/mixed2.cl | 0 tests/lexer/mixed2_error.txt | 0 tests/lexer/string1.cl | 0 tests/lexer/string1_error.txt | 0 tests/lexer/string2.cl | 0 tests/lexer/string2_error.txt | 0 tests/lexer/string3.cl | Bin tests/lexer/string3_error.txt | 0 tests/lexer/string4.cl | 0 tests/lexer/string4_error.txt | 0 tests/parser/assignment1.cl | 0 tests/parser/assignment1_error.txt | 0 tests/parser/assignment2.cl | 0 tests/parser/assignment2_error.txt | 0 tests/parser/assignment3.cl | 0 tests/parser/assignment3_error.txt | 0 tests/parser/attribute1.cl | 0 tests/parser/attribute1_error.txt | 0 tests/parser/attribute2.cl | 0 tests/parser/attribute2_error.txt | 0 tests/parser/attribute3.cl | 0 tests/parser/attribute3_error.txt | 0 tests/parser/block1.cl | 0 tests/parser/block1_error.txt | 0 tests/parser/block2.cl | 0 tests/parser/block2_error.txt | 0 tests/parser/block3.cl | 0 tests/parser/block3_error.txt | 0 tests/parser/block4.cl | 0 tests/parser/block4_error.txt | 0 tests/parser/case1.cl | 0 tests/parser/case1_error.txt | 0 tests/parser/case2.cl | 0 tests/parser/case2_error.txt | 0 tests/parser/case3.cl | 0 tests/parser/case3_error.txt | 0 tests/parser/case4.cl | 0 tests/parser/case4_error.txt | 0 tests/parser/case5.cl | 0 tests/parser/case5_error.txt | 0 tests/parser/case6.cl | 0 tests/parser/case6_error.txt | 0 tests/parser/class1.cl | 0 tests/parser/class1_error.txt | 0 tests/parser/class2.cl | 0 tests/parser/class2_error.txt | 0 tests/parser/class3.cl | 0 tests/parser/class3_error.txt | 0 tests/parser/class4.cl | 0 tests/parser/class4_error.txt | 0 tests/parser/class5.cl | 0 tests/parser/class5_error.txt | 0 tests/parser/class6.cl | 0 tests/parser/class6_error.txt | 0 tests/parser/conditional1.cl | 0 tests/parser/conditional1_error.txt | 0 tests/parser/conditional2.cl | 0 tests/parser/conditional2_error.txt | 0 tests/parser/conditional3.cl | 0 tests/parser/conditional3_error.txt | 0 tests/parser/conditional4.cl | 0 tests/parser/conditional4_error.txt | 0 tests/parser/conditional5.cl | 0 tests/parser/conditional5_error.txt | 0 tests/parser/conditional6.cl | 0 tests/parser/conditional6_error.txt | 0 tests/parser/dispatch1.cl | 0 tests/parser/dispatch1_error.txt | 0 tests/parser/dispatch2.cl | 0 tests/parser/dispatch2_error.txt | 0 tests/parser/dispatch3.cl | 0 tests/parser/dispatch3_error.txt | 0 tests/parser/dispatch4.cl | 0 tests/parser/dispatch4_error.txt | 0 tests/parser/dispatch5.cl | 0 tests/parser/dispatch5_error.txt | 0 tests/parser/dispatch6.cl | 0 tests/parser/dispatch6_error.txt | 0 tests/parser/dispatch7.cl | 0 tests/parser/dispatch7_error.txt | 0 tests/parser/dispatch8.cl | 0 tests/parser/dispatch8_error.txt | 0 tests/parser/dispatch9.cl | 0 tests/parser/dispatch9_error.txt | 0 tests/parser/let1.cl | 0 tests/parser/let1_error.txt | 0 tests/parser/let2.cl | 0 tests/parser/let2_error.txt | 0 tests/parser/let3.cl | 0 tests/parser/let3_error.txt | 0 tests/parser/let4.cl | 0 tests/parser/let4_error.txt | 0 tests/parser/let5.cl | 0 tests/parser/let5_error.txt | 0 tests/parser/let6.cl | 0 tests/parser/let6_error.txt | 0 tests/parser/let7.cl | 0 tests/parser/let7_error.txt | 0 tests/parser/loop1.cl | 0 tests/parser/loop1_error.txt | 0 tests/parser/loop2.cl | 0 tests/parser/loop2_error.txt | 0 tests/parser/loop3.cl | 0 tests/parser/loop3_error.txt | 0 tests/parser/loop4.cl | 0 tests/parser/loop4_error.txt | 0 tests/parser/method1.cl | 0 tests/parser/method1_error.txt | 0 tests/parser/method2.cl | 0 tests/parser/method2_error.txt | 0 tests/parser/method3.cl | 0 tests/parser/method3_error.txt | 0 tests/parser/method4.cl | 0 tests/parser/method4_error.txt | 0 tests/parser/method5.cl | 0 tests/parser/method5_error.txt | 0 tests/parser/method6.cl | 0 tests/parser/method6_error.txt | 0 tests/parser/mixed1.cl | 0 tests/parser/mixed1_error.txt | 0 tests/parser/mixed2.cl | 0 tests/parser/mixed2_error.txt | 0 tests/parser/mixed3.cl | 0 tests/parser/mixed3_error.txt | 0 tests/parser/mixed4.cl | 0 tests/parser/mixed4_error.txt | 0 tests/parser/mixed5.cl | 0 tests/parser/mixed5_error.txt | 0 tests/parser/mixed6.cl | 0 tests/parser/mixed6_error.txt | 0 tests/parser/operation1.cl | 0 tests/parser/operation1_error.txt | 0 tests/parser/operation2.cl | 0 tests/parser/operation2_error.txt | 0 tests/parser/operation3.cl | 0 tests/parser/operation3_error.txt | 0 tests/parser/operation4.cl | 0 tests/parser/operation4_error.txt | 0 tests/parser/program1.cl | 0 tests/parser/program1_error.txt | 0 tests/parser/program2.cl | 0 tests/parser/program2_error.txt | 0 tests/parser/program3.cl | 0 tests/parser/program3_error.txt | 0 181 files changed, 684 insertions(+), 680 deletions(-) mode change 100644 => 100755 .gitignore mode change 100644 => 100755 Instructions.md mode change 100644 => 100755 README.md mode change 100644 => 100755 __init__.py mode change 100644 => 100755 astnodes.py mode change 100644 => 100755 cmp/__pycache__/__init__.cpython-37.pyc mode change 100644 => 100755 cmp/__pycache__/automata.cpython-37.pyc mode change 100644 => 100755 cmp/__pycache__/pycompiler.cpython-37.pyc mode change 100644 => 100755 cmp/__pycache__/utils.cpython-37.pyc mode change 100644 => 100755 cmp/lexing.py mode change 100644 => 100755 cmp/recovery.py mode change 100644 => 100755 cmp/serialization.py mode change 100644 => 100755 grammar.py mode change 100644 => 100755 lexer.py mode change 100644 => 100755 main.py mode change 100644 => 100755 parser.py mode change 100644 => 100755 scope.py mode change 100644 => 100755 scripts/main.cl mode change 100644 => 100755 semantic.py mode change 100644 => 100755 tester.py mode change 100644 => 100755 tests/lexer/comment1.cl mode change 100644 => 100755 tests/lexer/comment1_error.txt mode change 100644 => 100755 tests/lexer/iis1.cl mode change 100644 => 100755 tests/lexer/iis1_error.txt mode change 100644 => 100755 tests/lexer/iis2.cl mode change 100644 => 100755 tests/lexer/iis2_error.txt mode change 100644 => 100755 tests/lexer/iis3.cl mode change 100644 => 100755 tests/lexer/iis3_error.txt mode change 100644 => 100755 tests/lexer/iis4.cl mode change 100644 => 100755 tests/lexer/iis4_error.txt mode change 100644 => 100755 tests/lexer/iis5.cl mode change 100644 => 100755 tests/lexer/iis5_error.txt mode change 100644 => 100755 tests/lexer/iis6.cl mode change 100644 => 100755 tests/lexer/iis6_error.txt mode change 100644 => 100755 tests/lexer/mixed1.cl mode change 100644 => 100755 tests/lexer/mixed1_error.txt mode change 100644 => 100755 tests/lexer/mixed2.cl mode change 100644 => 100755 tests/lexer/mixed2_error.txt mode change 100644 => 100755 tests/lexer/string1.cl mode change 100644 => 100755 tests/lexer/string1_error.txt mode change 100644 => 100755 tests/lexer/string2.cl mode change 100644 => 100755 tests/lexer/string2_error.txt mode change 100644 => 100755 tests/lexer/string3.cl mode change 100644 => 100755 tests/lexer/string3_error.txt mode change 100644 => 100755 tests/lexer/string4.cl mode change 100644 => 100755 tests/lexer/string4_error.txt mode change 100644 => 100755 tests/parser/assignment1.cl mode change 100644 => 100755 tests/parser/assignment1_error.txt mode change 100644 => 100755 tests/parser/assignment2.cl mode change 100644 => 100755 tests/parser/assignment2_error.txt mode change 100644 => 100755 tests/parser/assignment3.cl mode change 100644 => 100755 tests/parser/assignment3_error.txt mode change 100644 => 100755 tests/parser/attribute1.cl mode change 100644 => 100755 tests/parser/attribute1_error.txt mode change 100644 => 100755 tests/parser/attribute2.cl mode change 100644 => 100755 tests/parser/attribute2_error.txt mode change 100644 => 100755 tests/parser/attribute3.cl mode change 100644 => 100755 tests/parser/attribute3_error.txt mode change 100644 => 100755 tests/parser/block1.cl mode change 100644 => 100755 tests/parser/block1_error.txt mode change 100644 => 100755 tests/parser/block2.cl mode change 100644 => 100755 tests/parser/block2_error.txt mode change 100644 => 100755 tests/parser/block3.cl mode change 100644 => 100755 tests/parser/block3_error.txt mode change 100644 => 100755 tests/parser/block4.cl mode change 100644 => 100755 tests/parser/block4_error.txt mode change 100644 => 100755 tests/parser/case1.cl mode change 100644 => 100755 tests/parser/case1_error.txt mode change 100644 => 100755 tests/parser/case2.cl mode change 100644 => 100755 tests/parser/case2_error.txt mode change 100644 => 100755 tests/parser/case3.cl mode change 100644 => 100755 tests/parser/case3_error.txt mode change 100644 => 100755 tests/parser/case4.cl mode change 100644 => 100755 tests/parser/case4_error.txt mode change 100644 => 100755 tests/parser/case5.cl mode change 100644 => 100755 tests/parser/case5_error.txt mode change 100644 => 100755 tests/parser/case6.cl mode change 100644 => 100755 tests/parser/case6_error.txt mode change 100644 => 100755 tests/parser/class1.cl mode change 100644 => 100755 tests/parser/class1_error.txt mode change 100644 => 100755 tests/parser/class2.cl mode change 100644 => 100755 tests/parser/class2_error.txt mode change 100644 => 100755 tests/parser/class3.cl mode change 100644 => 100755 tests/parser/class3_error.txt mode change 100644 => 100755 tests/parser/class4.cl mode change 100644 => 100755 tests/parser/class4_error.txt mode change 100644 => 100755 tests/parser/class5.cl mode change 100644 => 100755 tests/parser/class5_error.txt mode change 100644 => 100755 tests/parser/class6.cl mode change 100644 => 100755 tests/parser/class6_error.txt mode change 100644 => 100755 tests/parser/conditional1.cl mode change 100644 => 100755 tests/parser/conditional1_error.txt mode change 100644 => 100755 tests/parser/conditional2.cl mode change 100644 => 100755 tests/parser/conditional2_error.txt mode change 100644 => 100755 tests/parser/conditional3.cl mode change 100644 => 100755 tests/parser/conditional3_error.txt mode change 100644 => 100755 tests/parser/conditional4.cl mode change 100644 => 100755 tests/parser/conditional4_error.txt mode change 100644 => 100755 tests/parser/conditional5.cl mode change 100644 => 100755 tests/parser/conditional5_error.txt mode change 100644 => 100755 tests/parser/conditional6.cl mode change 100644 => 100755 tests/parser/conditional6_error.txt mode change 100644 => 100755 tests/parser/dispatch1.cl mode change 100644 => 100755 tests/parser/dispatch1_error.txt mode change 100644 => 100755 tests/parser/dispatch2.cl mode change 100644 => 100755 tests/parser/dispatch2_error.txt mode change 100644 => 100755 tests/parser/dispatch3.cl mode change 100644 => 100755 tests/parser/dispatch3_error.txt mode change 100644 => 100755 tests/parser/dispatch4.cl mode change 100644 => 100755 tests/parser/dispatch4_error.txt mode change 100644 => 100755 tests/parser/dispatch5.cl mode change 100644 => 100755 tests/parser/dispatch5_error.txt mode change 100644 => 100755 tests/parser/dispatch6.cl mode change 100644 => 100755 tests/parser/dispatch6_error.txt mode change 100644 => 100755 tests/parser/dispatch7.cl mode change 100644 => 100755 tests/parser/dispatch7_error.txt mode change 100644 => 100755 tests/parser/dispatch8.cl mode change 100644 => 100755 tests/parser/dispatch8_error.txt mode change 100644 => 100755 tests/parser/dispatch9.cl mode change 100644 => 100755 tests/parser/dispatch9_error.txt mode change 100644 => 100755 tests/parser/let1.cl mode change 100644 => 100755 tests/parser/let1_error.txt mode change 100644 => 100755 tests/parser/let2.cl mode change 100644 => 100755 tests/parser/let2_error.txt mode change 100644 => 100755 tests/parser/let3.cl mode change 100644 => 100755 tests/parser/let3_error.txt mode change 100644 => 100755 tests/parser/let4.cl mode change 100644 => 100755 tests/parser/let4_error.txt mode change 100644 => 100755 tests/parser/let5.cl mode change 100644 => 100755 tests/parser/let5_error.txt mode change 100644 => 100755 tests/parser/let6.cl mode change 100644 => 100755 tests/parser/let6_error.txt mode change 100644 => 100755 tests/parser/let7.cl mode change 100644 => 100755 tests/parser/let7_error.txt mode change 100644 => 100755 tests/parser/loop1.cl mode change 100644 => 100755 tests/parser/loop1_error.txt mode change 100644 => 100755 tests/parser/loop2.cl mode change 100644 => 100755 tests/parser/loop2_error.txt mode change 100644 => 100755 tests/parser/loop3.cl mode change 100644 => 100755 tests/parser/loop3_error.txt mode change 100644 => 100755 tests/parser/loop4.cl mode change 100644 => 100755 tests/parser/loop4_error.txt mode change 100644 => 100755 tests/parser/method1.cl mode change 100644 => 100755 tests/parser/method1_error.txt mode change 100644 => 100755 tests/parser/method2.cl mode change 100644 => 100755 tests/parser/method2_error.txt mode change 100644 => 100755 tests/parser/method3.cl mode change 100644 => 100755 tests/parser/method3_error.txt mode change 100644 => 100755 tests/parser/method4.cl mode change 100644 => 100755 tests/parser/method4_error.txt mode change 100644 => 100755 tests/parser/method5.cl mode change 100644 => 100755 tests/parser/method5_error.txt mode change 100644 => 100755 tests/parser/method6.cl mode change 100644 => 100755 tests/parser/method6_error.txt mode change 100644 => 100755 tests/parser/mixed1.cl mode change 100644 => 100755 tests/parser/mixed1_error.txt mode change 100644 => 100755 tests/parser/mixed2.cl mode change 100644 => 100755 tests/parser/mixed2_error.txt mode change 100644 => 100755 tests/parser/mixed3.cl mode change 100644 => 100755 tests/parser/mixed3_error.txt mode change 100644 => 100755 tests/parser/mixed4.cl mode change 100644 => 100755 tests/parser/mixed4_error.txt mode change 100644 => 100755 tests/parser/mixed5.cl mode change 100644 => 100755 tests/parser/mixed5_error.txt mode change 100644 => 100755 tests/parser/mixed6.cl mode change 100644 => 100755 tests/parser/mixed6_error.txt mode change 100644 => 100755 tests/parser/operation1.cl mode change 100644 => 100755 tests/parser/operation1_error.txt mode change 100644 => 100755 tests/parser/operation2.cl mode change 100644 => 100755 tests/parser/operation2_error.txt mode change 100644 => 100755 tests/parser/operation3.cl mode change 100644 => 100755 tests/parser/operation3_error.txt mode change 100644 => 100755 tests/parser/operation4.cl mode change 100644 => 100755 tests/parser/operation4_error.txt mode change 100644 => 100755 tests/parser/program1.cl mode change 100644 => 100755 tests/parser/program1_error.txt mode change 100644 => 100755 tests/parser/program2.cl mode change 100644 => 100755 tests/parser/program2_error.txt mode change 100644 => 100755 tests/parser/program3.cl mode change 100644 => 100755 tests/parser/program3_error.txt diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/Instructions.md b/Instructions.md old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/__init__.py b/__init__.py old mode 100644 new mode 100755 diff --git a/astnodes.py b/astnodes.py old mode 100644 new mode 100755 diff --git a/cmp/__pycache__/__init__.cpython-37.pyc b/cmp/__pycache__/__init__.cpython-37.pyc old mode 100644 new mode 100755 diff --git a/cmp/__pycache__/automata.cpython-37.pyc b/cmp/__pycache__/automata.cpython-37.pyc old mode 100644 new mode 100755 diff --git a/cmp/__pycache__/pycompiler.cpython-37.pyc b/cmp/__pycache__/pycompiler.cpython-37.pyc old mode 100644 new mode 100755 diff --git a/cmp/__pycache__/utils.cpython-37.pyc b/cmp/__pycache__/utils.cpython-37.pyc old mode 100644 new mode 100755 diff --git a/cmp/lexing.py b/cmp/lexing.py old mode 100644 new mode 100755 diff --git a/cmp/pycompiler.py b/cmp/pycompiler.py index 5a76f940b..85cc7c08b 100755 --- a/cmp/pycompiler.py +++ b/cmp/pycompiler.py @@ -2,8 +2,8 @@ import re from typing import List, FrozenSet, Optional, Tuple, Iterable, Callable, Dict -from cmp.lexing import Lexer, Token -from cmp.serialization import LRParserSerializer, LexerSerializer +from .lexing import Lexer, Token +from .serialization import LRParserSerializer, LexerSerializer class GrammarError(Exception): @@ -43,7 +43,7 @@ def __len__(self): class NonTerminal(Symbol): - def __init__(self, name, grammar): + def __init__(self, name: str, grammar: 'Grammar'): super().__init__(name, grammar) self.productions: List['Production'] = [] self.error_productions: List['Production'] = [] @@ -76,7 +76,10 @@ def __mod__(self, other): else: other = self.grammar.EPSILON, other[1] - if isinstance(other[0], Symbol) or isinstance(other[0], Sentence): + if isinstance(other[0], Symbol) and not isinstance(other[0], Sentence): + other[0] = Sentence(other[0]) + + if isinstance(other[0], Sentence): p = Production(self, other[0], other[1]) else: raise TypeError("Valid types for a production are 'Symbol', 'Sentence' or 'str'") @@ -269,7 +272,7 @@ def __init__(self): self.productions: List[Production] = [] self.non_terminals: List[NonTerminal] = [] self.terminals: List[Terminal] = [] - self.start_symbol: NonTerminal = None + self.start_symbol: Optional[NonTerminal] = None self.ERROR: ErrorTerminal = ErrorTerminal(self) self.EPSILON: Epsilon = Epsilon(self) @@ -356,7 +359,7 @@ def add_non_terminal(self, name: str, start_symbol: bool = False) -> NonTerminal return term def add_non_terminals(self, names: str) -> Tuple[NonTerminal, ...]: - return tuple((self.add_non_terminal(x) for x in names.strip().split())) + return tuple(self.add_non_terminal(x) for x in names.strip().split()) def add_production(self, production: Production): production.left.productions.append(production) @@ -399,6 +402,7 @@ def decorator(rule: Optional[Callable[[Lexer], Optional[Token]]]): def lexical_error(self, handler: Callable[[Lexer], None]): self.lexical_error_handler = handler + return handler def augmented_grammar(self, force: bool = False): if not self.is_augmented_grammar or force: diff --git a/cmp/recovery.py b/cmp/recovery.py old mode 100644 new mode 100755 diff --git a/cmp/serialization.py b/cmp/serialization.py old mode 100644 new mode 100755 diff --git a/grammar.py b/grammar.py old mode 100644 new mode 100755 diff --git a/lexer.py b/lexer.py old mode 100644 new mode 100755 diff --git a/main.py b/main.py old mode 100644 new mode 100755 diff --git a/parser.py b/parser.py old mode 100644 new mode 100755 index aa91de92a..35e37dad3 --- a/parser.py +++ b/parser.py @@ -15,1087 +15,1087 @@ def __action_table(): return { (0, G["class"]): ("SHIFT", 1), (1, G["type"]): ("SHIFT", 2), - (2, G["{"]): ("SHIFT", 3), (2, G["inherits"]): ("SHIFT", 140), - (3, G["id"]): ("SHIFT", 4), + (2, G["{"]): ("SHIFT", 3), (3, G["}"]): ("REDUCE", G["feature-list -> e"]), + (3, G["id"]): ("SHIFT", 4), (4, G[":"]): ("SHIFT", 124), (4, G["("]): ("SHIFT", 5), - (5, G[")"]): ("SHIFT", 11), (5, G["id"]): ("SHIFT", 6), + (5, G[")"]): ("SHIFT", 11), (6, G[":"]): ("SHIFT", 7), (7, G["type"]): ("SHIFT", 8), - (8, G[")"]): ("REDUCE", G["param-list -> id : type"]), (8, G[","]): ("SHIFT", 9), + (8, G[")"]): ("REDUCE", G["param-list -> id : type"]), (9, G["id"]): ("SHIFT", 6), (10, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), (11, G[":"]): ("SHIFT", 12), (12, G["type"]): ("SHIFT", 13), (13, G["{"]): ("SHIFT", 14), - (14, G["new"]): ("SHIFT", 31), + (14, G["case"]): ("SHIFT", 30), (14, G["("]): ("SHIFT", 20), + (14, G["let"]): ("SHIFT", 23), (14, G["id"]): ("SHIFT", 15), (14, G["{"]): ("SHIFT", 19), - (14, G["case"]): ("SHIFT", 30), - (14, G["~"]): ("SHIFT", 37), - (14, G["if"]): ("SHIFT", 21), - (14, G["not"]): ("SHIFT", 44), + (14, G["string"]): ("SHIFT", 17), (14, G["false"]): ("SHIFT", 36), + (14, G["~"]): ("SHIFT", 37), + (14, G["new"]): ("SHIFT", 31), (14, G["while"]): ("SHIFT", 22), + (14, G["if"]): ("SHIFT", 21), + (14, G["isvoid"]): ("SHIFT", 33), (14, G["int"]): ("SHIFT", 18), + (14, G["not"]): ("SHIFT", 44), (14, G["true"]): ("SHIFT", 35), - (14, G["isvoid"]): ("SHIFT", 33), - (14, G["string"]): ("SHIFT", 17), - (14, G["let"]): ("SHIFT", 23), - (15, G["<-"]): ("SHIFT", 113), - (15, G["in"]): ("REDUCE", G["atom -> id"]), + (15, G["("]): ("SHIFT", 16), + (15, G["loop"]): ("REDUCE", G["atom -> id"]), + (15, G["pool"]): ("REDUCE", G["atom -> id"]), + (15, G["@"]): ("REDUCE", G["atom -> id"]), (15, G["+"]): ("REDUCE", G["atom -> id"]), - (15, G["}"]): ("REDUCE", G["atom -> id"]), + (15, G["error"]): ("REDUCE", G["atom -> id"]), (15, G["-"]): ("REDUCE", G["atom -> id"]), - (15, G["of"]): ("REDUCE", G["atom -> id"]), - (15, G["then"]): ("REDUCE", G["atom -> id"]), + (15, G["in"]): ("REDUCE", G["atom -> id"]), (15, G["*"]): ("REDUCE", G["atom -> id"]), + (15, G["}"]): ("REDUCE", G["atom -> id"]), (15, G["/"]): ("REDUCE", G["atom -> id"]), - (15, G["else"]): ("REDUCE", G["atom -> id"]), - (15, G[")"]): ("REDUCE", G["atom -> id"]), (15, G["<"]): ("REDUCE", G["atom -> id"]), - (15, G["fi"]): ("REDUCE", G["atom -> id"]), - (15, G["error"]): ("REDUCE", G["atom -> id"]), - (15, G["."]): ("REDUCE", G["atom -> id"]), + (15, G["of"]): ("REDUCE", G["atom -> id"]), + (15, G[")"]): ("REDUCE", G["atom -> id"]), (15, G["<="]): ("REDUCE", G["atom -> id"]), + (15, G["."]): ("REDUCE", G["atom -> id"]), (15, G["="]): ("REDUCE", G["atom -> id"]), + (15, G["then"]): ("REDUCE", G["atom -> id"]), (15, G[","]): ("REDUCE", G["atom -> id"]), + (15, G["else"]): ("REDUCE", G["atom -> id"]), + (15, G["fi"]): ("REDUCE", G["atom -> id"]), (15, G[";"]): ("REDUCE", G["atom -> id"]), - (15, G["loop"]): ("REDUCE", G["atom -> id"]), - (15, G["@"]): ("REDUCE", G["atom -> id"]), - (15, G["pool"]): ("REDUCE", G["atom -> id"]), - (15, G["("]): ("SHIFT", 16), - (16, G["case"]): ("SHIFT", 30), + (15, G["<-"]): ("SHIFT", 113), + (16, G["let"]): ("SHIFT", 23), (16, G["false"]): ("SHIFT", 36), - (16, G["~"]): ("SHIFT", 37), - (16, G["if"]): ("SHIFT", 21), + (16, G["case"]): ("SHIFT", 30), + (16, G["new"]): ("SHIFT", 31), (16, G["id"]): ("SHIFT", 15), - (16, G["true"]): ("SHIFT", 35), + (16, G["{"]): ("SHIFT", 19), (16, G["int"]): ("SHIFT", 18), - (16, G["let"]): ("SHIFT", 23), + (16, G["true"]): ("SHIFT", 35), + (16, G["("]): ("SHIFT", 20), + (16, G["~"]): ("SHIFT", 37), (16, G["while"]): ("SHIFT", 22), - (16, G["isvoid"]): ("SHIFT", 33), (16, G["string"]): ("SHIFT", 17), + (16, G["if"]): ("SHIFT", 21), (16, G["not"]): ("SHIFT", 44), - (16, G["("]): ("SHIFT", 20), - (16, G["new"]): ("SHIFT", 31), - (16, G["{"]): ("SHIFT", 19), - (17, G["in"]): ("REDUCE", G["atom -> string"]), + (16, G["isvoid"]): ("SHIFT", 33), + (17, G["loop"]): ("REDUCE", G["atom -> string"]), + (17, G["pool"]): ("REDUCE", G["atom -> string"]), + (17, G["@"]): ("REDUCE", G["atom -> string"]), (17, G["+"]): ("REDUCE", G["atom -> string"]), - (17, G["}"]): ("REDUCE", G["atom -> string"]), + (17, G["error"]): ("REDUCE", G["atom -> string"]), (17, G["-"]): ("REDUCE", G["atom -> string"]), - (17, G["of"]): ("REDUCE", G["atom -> string"]), - (17, G["then"]): ("REDUCE", G["atom -> string"]), + (17, G["in"]): ("REDUCE", G["atom -> string"]), (17, G["*"]): ("REDUCE", G["atom -> string"]), + (17, G["}"]): ("REDUCE", G["atom -> string"]), (17, G["/"]): ("REDUCE", G["atom -> string"]), - (17, G["else"]): ("REDUCE", G["atom -> string"]), - (17, G[")"]): ("REDUCE", G["atom -> string"]), (17, G["<"]): ("REDUCE", G["atom -> string"]), - (17, G["fi"]): ("REDUCE", G["atom -> string"]), - (17, G["error"]): ("REDUCE", G["atom -> string"]), - (17, G["."]): ("REDUCE", G["atom -> string"]), + (17, G["of"]): ("REDUCE", G["atom -> string"]), + (17, G[")"]): ("REDUCE", G["atom -> string"]), (17, G["<="]): ("REDUCE", G["atom -> string"]), + (17, G["."]): ("REDUCE", G["atom -> string"]), (17, G["="]): ("REDUCE", G["atom -> string"]), + (17, G["then"]): ("REDUCE", G["atom -> string"]), (17, G[","]): ("REDUCE", G["atom -> string"]), + (17, G["else"]): ("REDUCE", G["atom -> string"]), + (17, G["fi"]): ("REDUCE", G["atom -> string"]), (17, G[";"]): ("REDUCE", G["atom -> string"]), - (17, G["loop"]): ("REDUCE", G["atom -> string"]), - (17, G["@"]): ("REDUCE", G["atom -> string"]), - (17, G["pool"]): ("REDUCE", G["atom -> string"]), - (18, G["in"]): ("REDUCE", G["atom -> int"]), + (18, G["loop"]): ("REDUCE", G["atom -> int"]), + (18, G["pool"]): ("REDUCE", G["atom -> int"]), + (18, G["@"]): ("REDUCE", G["atom -> int"]), (18, G["+"]): ("REDUCE", G["atom -> int"]), - (18, G["}"]): ("REDUCE", G["atom -> int"]), + (18, G["error"]): ("REDUCE", G["atom -> int"]), (18, G["-"]): ("REDUCE", G["atom -> int"]), - (18, G["of"]): ("REDUCE", G["atom -> int"]), - (18, G["then"]): ("REDUCE", G["atom -> int"]), + (18, G["in"]): ("REDUCE", G["atom -> int"]), (18, G["*"]): ("REDUCE", G["atom -> int"]), + (18, G["}"]): ("REDUCE", G["atom -> int"]), (18, G["/"]): ("REDUCE", G["atom -> int"]), - (18, G["else"]): ("REDUCE", G["atom -> int"]), - (18, G[")"]): ("REDUCE", G["atom -> int"]), (18, G["<"]): ("REDUCE", G["atom -> int"]), - (18, G["fi"]): ("REDUCE", G["atom -> int"]), - (18, G["error"]): ("REDUCE", G["atom -> int"]), + (18, G["of"]): ("REDUCE", G["atom -> int"]), + (18, G[")"]): ("REDUCE", G["atom -> int"]), (18, G["<="]): ("REDUCE", G["atom -> int"]), (18, G["."]): ("REDUCE", G["atom -> int"]), (18, G["="]): ("REDUCE", G["atom -> int"]), + (18, G["then"]): ("REDUCE", G["atom -> int"]), (18, G[","]): ("REDUCE", G["atom -> int"]), + (18, G["else"]): ("REDUCE", G["atom -> int"]), + (18, G["fi"]): ("REDUCE", G["atom -> int"]), (18, G[";"]): ("REDUCE", G["atom -> int"]), - (18, G["loop"]): ("REDUCE", G["atom -> int"]), - (18, G["@"]): ("REDUCE", G["atom -> int"]), - (18, G["pool"]): ("REDUCE", G["atom -> int"]), - (19, G["~"]): ("SHIFT", 37), - (19, G["if"]): ("SHIFT", 21), - (19, G["id"]): ("SHIFT", 15), - (19, G["not"]): ("SHIFT", 44), (19, G["false"]): ("SHIFT", 36), + (19, G["new"]): ("SHIFT", 31), + (19, G["id"]): ("SHIFT", 15), (19, G["while"]): ("SHIFT", 22), (19, G["int"]): ("SHIFT", 18), + (19, G["if"]): ("SHIFT", 21), + (19, G["~"]): ("SHIFT", 37), (19, G["true"]): ("SHIFT", 35), - (19, G["isvoid"]): ("SHIFT", 33), - (19, G["string"]): ("SHIFT", 17), + (19, G["not"]): ("SHIFT", 44), (19, G["let"]): ("SHIFT", 23), - (19, G["new"]): ("SHIFT", 31), + (19, G["isvoid"]): ("SHIFT", 33), + (19, G["case"]): ("SHIFT", 30), (19, G["("]): ("SHIFT", 20), + (19, G["string"]): ("SHIFT", 17), (19, G["{"]): ("SHIFT", 19), - (19, G["case"]): ("SHIFT", 30), - (20, G["id"]): ("SHIFT", 15), - (20, G["isvoid"]): ("SHIFT", 33), + (20, G["not"]): ("SHIFT", 44), (20, G["~"]): ("SHIFT", 37), - (20, G["string"]): ("SHIFT", 17), - (20, G["case"]): ("SHIFT", 30), - (20, G["{"]): ("SHIFT", 19), (20, G["let"]): ("SHIFT", 23), (20, G["("]): ("SHIFT", 20), + (20, G["case"]): ("SHIFT", 30), + (20, G["id"]): ("SHIFT", 15), + (20, G["string"]): ("SHIFT", 17), + (20, G["isvoid"]): ("SHIFT", 33), + (20, G["{"]): ("SHIFT", 19), (20, G["false"]): ("SHIFT", 36), - (20, G["not"]): ("SHIFT", 44), + (20, G["new"]): ("SHIFT", 31), (20, G["while"]): ("SHIFT", 22), - (20, G["if"]): ("SHIFT", 21), (20, G["int"]): ("SHIFT", 18), - (20, G["new"]): ("SHIFT", 31), + (20, G["if"]): ("SHIFT", 21), (20, G["true"]): ("SHIFT", 35), + (21, G["new"]): ("SHIFT", 31), (21, G["~"]): ("SHIFT", 37), (21, G["id"]): ("SHIFT", 15), - (21, G["let"]): ("SHIFT", 23), + (21, G["while"]): ("SHIFT", 22), + (21, G["int"]): ("SHIFT", 18), + (21, G["isvoid"]): ("SHIFT", 33), (21, G["if"]): ("SHIFT", 21), - (21, G["string"]): ("SHIFT", 17), + (21, G["not"]): ("SHIFT", 44), + (21, G["true"]): ("SHIFT", 35), + (21, G["let"]): ("SHIFT", 23), + (21, G["case"]): ("SHIFT", 30), (21, G["("]): ("SHIFT", 20), + (21, G["string"]): ("SHIFT", 17), (21, G["{"]): ("SHIFT", 19), - (21, G["case"]): ("SHIFT", 30), - (21, G["new"]): ("SHIFT", 31), - (21, G["true"]): ("SHIFT", 35), - (21, G["int"]): ("SHIFT", 18), - (21, G["not"]): ("SHIFT", 44), (21, G["false"]): ("SHIFT", 36), - (21, G["isvoid"]): ("SHIFT", 33), - (21, G["while"]): ("SHIFT", 22), - (22, G["new"]): ("SHIFT", 31), - (22, G["int"]): ("SHIFT", 18), - (22, G["true"]): ("SHIFT", 35), - (22, G["if"]): ("SHIFT", 21), - (22, G["not"]): ("SHIFT", 44), - (22, G["id"]): ("SHIFT", 15), - (22, G["isvoid"]): ("SHIFT", 33), (22, G["while"]): ("SHIFT", 22), (22, G["~"]): ("SHIFT", 37), + (22, G["if"]): ("SHIFT", 21), (22, G["false"]): ("SHIFT", 36), + (22, G["not"]): ("SHIFT", 44), + (22, G["new"]): ("SHIFT", 31), (22, G["let"]): ("SHIFT", 23), - (22, G["{"]): ("SHIFT", 19), + (22, G["isvoid"]): ("SHIFT", 33), + (22, G["id"]): ("SHIFT", 15), (22, G["case"]): ("SHIFT", 30), + (22, G["int"]): ("SHIFT", 18), + (22, G["true"]): ("SHIFT", 35), + (22, G["{"]): ("SHIFT", 19), (22, G["("]): ("SHIFT", 20), (22, G["string"]): ("SHIFT", 17), (23, G["id"]): ("SHIFT", 24), (24, G[":"]): ("SHIFT", 25), (25, G["type"]): ("SHIFT", 26), - (26, G[","]): ("SHIFT", 27), (26, G["<-"]): ("SHIFT", 29), (26, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), + (26, G[","]): ("SHIFT", 27), (27, G["id"]): ("SHIFT", 24), (28, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), - (29, G["false"]): ("SHIFT", 36), (29, G["id"]): ("SHIFT", 15), - (29, G["let"]): ("SHIFT", 23), - (29, G["~"]): ("SHIFT", 37), (29, G["{"]): ("SHIFT", 19), - (29, G["case"]): ("SHIFT", 30), - (29, G["string"]): ("SHIFT", 17), (29, G["isvoid"]): ("SHIFT", 33), + (29, G["false"]): ("SHIFT", 36), (29, G["new"]): ("SHIFT", 31), (29, G["int"]): ("SHIFT", 18), - (29, G["true"]): ("SHIFT", 35), - (29, G["if"]): ("SHIFT", 21), - (29, G["("]): ("SHIFT", 20), (29, G["while"]): ("SHIFT", 22), + (29, G["if"]): ("SHIFT", 21), + (29, G["true"]): ("SHIFT", 35), (29, G["not"]): ("SHIFT", 44), - (30, G["{"]): ("SHIFT", 19), - (30, G["string"]): ("SHIFT", 17), - (30, G["id"]): ("SHIFT", 15), + (29, G["let"]): ("SHIFT", 23), + (29, G["("]): ("SHIFT", 20), + (29, G["case"]): ("SHIFT", 30), + (29, G["~"]): ("SHIFT", 37), + (29, G["string"]): ("SHIFT", 17), (30, G["not"]): ("SHIFT", 44), + (30, G["id"]): ("SHIFT", 15), + (30, G["string"]): ("SHIFT", 17), (30, G["let"]): ("SHIFT", 23), - (30, G["while"]): ("SHIFT", 22), - (30, G["if"]): ("SHIFT", 21), - (30, G["true"]): ("SHIFT", 35), - (30, G["int"]): ("SHIFT", 18), + (30, G["case"]): ("SHIFT", 30), + (30, G["false"]): ("SHIFT", 36), (30, G["new"]): ("SHIFT", 31), - (30, G["("]): ("SHIFT", 20), + (30, G["{"]): ("SHIFT", 19), (30, G["~"]): ("SHIFT", 37), - (30, G["false"]): ("SHIFT", 36), + (30, G["int"]): ("SHIFT", 18), + (30, G["true"]): ("SHIFT", 35), (30, G["isvoid"]): ("SHIFT", 33), - (30, G["case"]): ("SHIFT", 30), + (30, G["while"]): ("SHIFT", 22), + (30, G["if"]): ("SHIFT", 21), + (30, G["("]): ("SHIFT", 20), (31, G["type"]): ("SHIFT", 32), - (32, G["in"]): ("REDUCE", G["atom -> new type"]), + (32, G["loop"]): ("REDUCE", G["atom -> new type"]), + (32, G["pool"]): ("REDUCE", G["atom -> new type"]), + (32, G["@"]): ("REDUCE", G["atom -> new type"]), (32, G["+"]): ("REDUCE", G["atom -> new type"]), - (32, G["}"]): ("REDUCE", G["atom -> new type"]), + (32, G["error"]): ("REDUCE", G["atom -> new type"]), (32, G["-"]): ("REDUCE", G["atom -> new type"]), - (32, G["of"]): ("REDUCE", G["atom -> new type"]), - (32, G["then"]): ("REDUCE", G["atom -> new type"]), + (32, G["in"]): ("REDUCE", G["atom -> new type"]), (32, G["*"]): ("REDUCE", G["atom -> new type"]), + (32, G["}"]): ("REDUCE", G["atom -> new type"]), (32, G["/"]): ("REDUCE", G["atom -> new type"]), - (32, G["else"]): ("REDUCE", G["atom -> new type"]), (32, G["<"]): ("REDUCE", G["atom -> new type"]), + (32, G["of"]): ("REDUCE", G["atom -> new type"]), (32, G[")"]): ("REDUCE", G["atom -> new type"]), - (32, G["fi"]): ("REDUCE", G["atom -> new type"]), - (32, G["error"]): ("REDUCE", G["atom -> new type"]), (32, G["<="]): ("REDUCE", G["atom -> new type"]), (32, G["."]): ("REDUCE", G["atom -> new type"]), (32, G["="]): ("REDUCE", G["atom -> new type"]), + (32, G["then"]): ("REDUCE", G["atom -> new type"]), (32, G[","]): ("REDUCE", G["atom -> new type"]), + (32, G["else"]): ("REDUCE", G["atom -> new type"]), + (32, G["fi"]): ("REDUCE", G["atom -> new type"]), (32, G[";"]): ("REDUCE", G["atom -> new type"]), - (32, G["loop"]): ("REDUCE", G["atom -> new type"]), - (32, G["@"]): ("REDUCE", G["atom -> new type"]), - (32, G["pool"]): ("REDUCE", G["atom -> new type"]), - (33, G["id"]): ("SHIFT", 34), (33, G["("]): ("SHIFT", 20), - (33, G["string"]): ("SHIFT", 17), + (33, G["id"]): ("SHIFT", 34), + (33, G["true"]): ("SHIFT", 35), + (33, G["~"]): ("SHIFT", 37), (33, G["false"]): ("SHIFT", 36), (33, G["isvoid"]): ("SHIFT", 33), - (33, G["true"]): ("SHIFT", 35), + (33, G["string"]): ("SHIFT", 17), (33, G["int"]): ("SHIFT", 18), (33, G["new"]): ("SHIFT", 31), - (33, G["~"]): ("SHIFT", 37), - (34, G["in"]): ("REDUCE", G["atom -> id"]), + (34, G["loop"]): ("REDUCE", G["atom -> id"]), + (34, G["pool"]): ("REDUCE", G["atom -> id"]), + (34, G["@"]): ("REDUCE", G["atom -> id"]), (34, G["+"]): ("REDUCE", G["atom -> id"]), - (34, G["}"]): ("REDUCE", G["atom -> id"]), + (34, G["error"]): ("REDUCE", G["atom -> id"]), (34, G["-"]): ("REDUCE", G["atom -> id"]), - (34, G["of"]): ("REDUCE", G["atom -> id"]), - (34, G["then"]): ("REDUCE", G["atom -> id"]), + (34, G["in"]): ("REDUCE", G["atom -> id"]), (34, G["*"]): ("REDUCE", G["atom -> id"]), + (34, G["}"]): ("REDUCE", G["atom -> id"]), (34, G["/"]): ("REDUCE", G["atom -> id"]), - (34, G["else"]): ("REDUCE", G["atom -> id"]), - (34, G[")"]): ("REDUCE", G["atom -> id"]), (34, G["<"]): ("REDUCE", G["atom -> id"]), - (34, G["fi"]): ("REDUCE", G["atom -> id"]), - (34, G["error"]): ("REDUCE", G["atom -> id"]), - (34, G["."]): ("REDUCE", G["atom -> id"]), + (34, G["of"]): ("REDUCE", G["atom -> id"]), + (34, G[")"]): ("REDUCE", G["atom -> id"]), (34, G["<="]): ("REDUCE", G["atom -> id"]), + (34, G["."]): ("REDUCE", G["atom -> id"]), (34, G["="]): ("REDUCE", G["atom -> id"]), + (34, G["then"]): ("REDUCE", G["atom -> id"]), (34, G[","]): ("REDUCE", G["atom -> id"]), + (34, G["else"]): ("REDUCE", G["atom -> id"]), + (34, G["fi"]): ("REDUCE", G["atom -> id"]), (34, G[";"]): ("REDUCE", G["atom -> id"]), - (34, G["loop"]): ("REDUCE", G["atom -> id"]), - (34, G["@"]): ("REDUCE", G["atom -> id"]), - (34, G["pool"]): ("REDUCE", G["atom -> id"]), (34, G["("]): ("SHIFT", 16), - (35, G["in"]): ("REDUCE", G["atom -> true"]), + (35, G["loop"]): ("REDUCE", G["atom -> true"]), + (35, G["pool"]): ("REDUCE", G["atom -> true"]), + (35, G["@"]): ("REDUCE", G["atom -> true"]), (35, G["+"]): ("REDUCE", G["atom -> true"]), + (35, G["error"]): ("REDUCE", G["atom -> true"]), (35, G["-"]): ("REDUCE", G["atom -> true"]), - (35, G["}"]): ("REDUCE", G["atom -> true"]), - (35, G["of"]): ("REDUCE", G["atom -> true"]), - (35, G["then"]): ("REDUCE", G["atom -> true"]), + (35, G["in"]): ("REDUCE", G["atom -> true"]), (35, G["*"]): ("REDUCE", G["atom -> true"]), + (35, G["}"]): ("REDUCE", G["atom -> true"]), (35, G["/"]): ("REDUCE", G["atom -> true"]), - (35, G["else"]): ("REDUCE", G["atom -> true"]), - (35, G[")"]): ("REDUCE", G["atom -> true"]), (35, G["<"]): ("REDUCE", G["atom -> true"]), - (35, G["fi"]): ("REDUCE", G["atom -> true"]), - (35, G["error"]): ("REDUCE", G["atom -> true"]), + (35, G["of"]): ("REDUCE", G["atom -> true"]), + (35, G[")"]): ("REDUCE", G["atom -> true"]), (35, G["<="]): ("REDUCE", G["atom -> true"]), (35, G["."]): ("REDUCE", G["atom -> true"]), (35, G["="]): ("REDUCE", G["atom -> true"]), + (35, G["then"]): ("REDUCE", G["atom -> true"]), (35, G[","]): ("REDUCE", G["atom -> true"]), + (35, G["else"]): ("REDUCE", G["atom -> true"]), + (35, G["fi"]): ("REDUCE", G["atom -> true"]), (35, G[";"]): ("REDUCE", G["atom -> true"]), - (35, G["loop"]): ("REDUCE", G["atom -> true"]), - (35, G["@"]): ("REDUCE", G["atom -> true"]), - (35, G["pool"]): ("REDUCE", G["atom -> true"]), - (36, G["in"]): ("REDUCE", G["atom -> false"]), + (36, G["loop"]): ("REDUCE", G["atom -> false"]), + (36, G["pool"]): ("REDUCE", G["atom -> false"]), + (36, G["@"]): ("REDUCE", G["atom -> false"]), (36, G["+"]): ("REDUCE", G["atom -> false"]), - (36, G["}"]): ("REDUCE", G["atom -> false"]), + (36, G["error"]): ("REDUCE", G["atom -> false"]), (36, G["-"]): ("REDUCE", G["atom -> false"]), - (36, G["of"]): ("REDUCE", G["atom -> false"]), - (36, G["then"]): ("REDUCE", G["atom -> false"]), + (36, G["in"]): ("REDUCE", G["atom -> false"]), (36, G["*"]): ("REDUCE", G["atom -> false"]), + (36, G["}"]): ("REDUCE", G["atom -> false"]), (36, G["/"]): ("REDUCE", G["atom -> false"]), - (36, G["else"]): ("REDUCE", G["atom -> false"]), - (36, G[")"]): ("REDUCE", G["atom -> false"]), (36, G["<"]): ("REDUCE", G["atom -> false"]), - (36, G["fi"]): ("REDUCE", G["atom -> false"]), - (36, G["error"]): ("REDUCE", G["atom -> false"]), - (36, G["."]): ("REDUCE", G["atom -> false"]), + (36, G["of"]): ("REDUCE", G["atom -> false"]), + (36, G[")"]): ("REDUCE", G["atom -> false"]), (36, G["<="]): ("REDUCE", G["atom -> false"]), + (36, G["."]): ("REDUCE", G["atom -> false"]), (36, G["="]): ("REDUCE", G["atom -> false"]), + (36, G["then"]): ("REDUCE", G["atom -> false"]), (36, G[","]): ("REDUCE", G["atom -> false"]), + (36, G["else"]): ("REDUCE", G["atom -> false"]), + (36, G["fi"]): ("REDUCE", G["atom -> false"]), (36, G[";"]): ("REDUCE", G["atom -> false"]), - (36, G["loop"]): ("REDUCE", G["atom -> false"]), - (36, G["@"]): ("REDUCE", G["atom -> false"]), - (36, G["pool"]): ("REDUCE", G["atom -> false"]), - (37, G["id"]): ("SHIFT", 34), (37, G["("]): ("SHIFT", 20), - (37, G["string"]): ("SHIFT", 17), + (37, G["id"]): ("SHIFT", 34), + (37, G["true"]): ("SHIFT", 35), + (37, G["~"]): ("SHIFT", 37), (37, G["false"]): ("SHIFT", 36), (37, G["isvoid"]): ("SHIFT", 33), - (37, G["true"]): ("SHIFT", 35), + (37, G["string"]): ("SHIFT", 17), (37, G["int"]): ("SHIFT", 18), (37, G["new"]): ("SHIFT", 31), - (37, G["~"]): ("SHIFT", 37), - (38, G["in"]): ("REDUCE", G["atom -> function-call"]), + (38, G["loop"]): ("REDUCE", G["atom -> function-call"]), + (38, G["pool"]): ("REDUCE", G["atom -> function-call"]), + (38, G["@"]): ("REDUCE", G["atom -> function-call"]), (38, G["+"]): ("REDUCE", G["atom -> function-call"]), - (38, G["}"]): ("REDUCE", G["atom -> function-call"]), + (38, G["error"]): ("REDUCE", G["atom -> function-call"]), (38, G["-"]): ("REDUCE", G["atom -> function-call"]), - (38, G["of"]): ("REDUCE", G["atom -> function-call"]), - (38, G["then"]): ("REDUCE", G["atom -> function-call"]), + (38, G["in"]): ("REDUCE", G["atom -> function-call"]), (38, G["*"]): ("REDUCE", G["atom -> function-call"]), + (38, G["}"]): ("REDUCE", G["atom -> function-call"]), (38, G["/"]): ("REDUCE", G["atom -> function-call"]), - (38, G["else"]): ("REDUCE", G["atom -> function-call"]), - (38, G[")"]): ("REDUCE", G["atom -> function-call"]), (38, G["<"]): ("REDUCE", G["atom -> function-call"]), - (38, G["fi"]): ("REDUCE", G["atom -> function-call"]), - (38, G["error"]): ("REDUCE", G["atom -> function-call"]), - (38, G["."]): ("REDUCE", G["atom -> function-call"]), + (38, G["of"]): ("REDUCE", G["atom -> function-call"]), + (38, G[")"]): ("REDUCE", G["atom -> function-call"]), (38, G["<="]): ("REDUCE", G["atom -> function-call"]), + (38, G["."]): ("REDUCE", G["atom -> function-call"]), (38, G["="]): ("REDUCE", G["atom -> function-call"]), + (38, G["then"]): ("REDUCE", G["atom -> function-call"]), (38, G[","]): ("REDUCE", G["atom -> function-call"]), + (38, G["else"]): ("REDUCE", G["atom -> function-call"]), + (38, G["fi"]): ("REDUCE", G["atom -> function-call"]), (38, G[";"]): ("REDUCE", G["atom -> function-call"]), - (38, G["loop"]): ("REDUCE", G["atom -> function-call"]), - (38, G["@"]): ("REDUCE", G["atom -> function-call"]), - (38, G["pool"]): ("REDUCE", G["atom -> function-call"]), - (39, G["in"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["+"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["error"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["-"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["}"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["of"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["then"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["in"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["*"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["}"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["/"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["else"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G[")"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["<"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["error"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["of"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G[")"]): ("REDUCE", G["factor -> ~ factor"]), (39, G["<="]): ("REDUCE", G["factor -> ~ factor"]), (39, G["="]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["then"]): ("REDUCE", G["factor -> ~ factor"]), (39, G[","]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["else"]): ("REDUCE", G["factor -> ~ factor"]), + (39, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), (39, G[";"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), - (40, G["@"]): ("SHIFT", 69), - (40, G["in"]): ("REDUCE", G["factor -> atom"]), + (40, G["loop"]): ("REDUCE", G["factor -> atom"]), + (40, G["pool"]): ("REDUCE", G["factor -> atom"]), (40, G["+"]): ("REDUCE", G["factor -> atom"]), - (40, G["}"]): ("REDUCE", G["factor -> atom"]), + (40, G["error"]): ("REDUCE", G["factor -> atom"]), (40, G["-"]): ("REDUCE", G["factor -> atom"]), - (40, G["of"]): ("REDUCE", G["factor -> atom"]), - (40, G["then"]): ("REDUCE", G["factor -> atom"]), + (40, G["in"]): ("REDUCE", G["factor -> atom"]), (40, G["*"]): ("REDUCE", G["factor -> atom"]), + (40, G["}"]): ("REDUCE", G["factor -> atom"]), (40, G["/"]): ("REDUCE", G["factor -> atom"]), - (40, G["else"]): ("REDUCE", G["factor -> atom"]), (40, G["<"]): ("REDUCE", G["factor -> atom"]), + (40, G["of"]): ("REDUCE", G["factor -> atom"]), (40, G[")"]): ("REDUCE", G["factor -> atom"]), - (40, G["fi"]): ("REDUCE", G["factor -> atom"]), - (40, G["error"]): ("REDUCE", G["factor -> atom"]), (40, G["<="]): ("REDUCE", G["factor -> atom"]), (40, G["="]): ("REDUCE", G["factor -> atom"]), + (40, G["then"]): ("REDUCE", G["factor -> atom"]), (40, G[","]): ("REDUCE", G["factor -> atom"]), + (40, G["else"]): ("REDUCE", G["factor -> atom"]), + (40, G["fi"]): ("REDUCE", G["factor -> atom"]), (40, G[";"]): ("REDUCE", G["factor -> atom"]), - (40, G["loop"]): ("REDUCE", G["factor -> atom"]), - (40, G["pool"]): ("REDUCE", G["factor -> atom"]), (40, G["."]): ("SHIFT", 41), + (40, G["@"]): ("SHIFT", 69), (41, G["id"]): ("SHIFT", 42), (42, G["("]): ("SHIFT", 43), - (43, G["case"]): ("SHIFT", 30), + (43, G["let"]): ("SHIFT", 23), (43, G["false"]): ("SHIFT", 36), - (43, G["~"]): ("SHIFT", 37), - (43, G["if"]): ("SHIFT", 21), + (43, G["case"]): ("SHIFT", 30), + (43, G["new"]): ("SHIFT", 31), (43, G["id"]): ("SHIFT", 15), - (43, G["true"]): ("SHIFT", 35), + (43, G["{"]): ("SHIFT", 19), (43, G["int"]): ("SHIFT", 18), - (43, G["let"]): ("SHIFT", 23), + (43, G["true"]): ("SHIFT", 35), + (43, G["("]): ("SHIFT", 20), + (43, G["~"]): ("SHIFT", 37), (43, G["while"]): ("SHIFT", 22), - (43, G["isvoid"]): ("SHIFT", 33), (43, G["string"]): ("SHIFT", 17), + (43, G["if"]): ("SHIFT", 21), (43, G["not"]): ("SHIFT", 44), - (43, G["("]): ("SHIFT", 20), - (43, G["new"]): ("SHIFT", 31), - (43, G["{"]): ("SHIFT", 19), - (44, G["string"]): ("SHIFT", 17), - (44, G["if"]): ("SHIFT", 21), + (43, G["isvoid"]): ("SHIFT", 33), + (44, G["("]): ("SHIFT", 20), + (44, G["case"]): ("SHIFT", 30), + (44, G["id"]): ("SHIFT", 15), (44, G["isvoid"]): ("SHIFT", 33), - (44, G["int"]): ("SHIFT", 18), - (44, G["true"]): ("SHIFT", 35), + (44, G["string"]): ("SHIFT", 17), (44, G["{"]): ("SHIFT", 19), (44, G["false"]): ("SHIFT", 36), - (44, G["id"]): ("SHIFT", 15), - (44, G["case"]): ("SHIFT", 30), + (44, G["new"]): ("SHIFT", 31), + (44, G["int"]): ("SHIFT", 18), + (44, G["while"]): ("SHIFT", 22), + (44, G["if"]): ("SHIFT", 21), + (44, G["true"]): ("SHIFT", 35), + (44, G["not"]): ("SHIFT", 44), (44, G["let"]): ("SHIFT", 23), (44, G["~"]): ("SHIFT", 37), - (44, G["not"]): ("SHIFT", 44), - (44, G["while"]): ("SHIFT", 22), - (44, G["("]): ("SHIFT", 20), - (44, G["new"]): ("SHIFT", 31), - (45, G["fi"]): ("REDUCE", G["expr -> not expr"]), - (45, G["error"]): ("REDUCE", G["expr -> not expr"]), - (45, G["in"]): ("REDUCE", G["expr -> not expr"]), - (45, G[","]): ("REDUCE", G["expr -> not expr"]), - (45, G[";"]): ("REDUCE", G["expr -> not expr"]), - (45, G["}"]): ("REDUCE", G["expr -> not expr"]), - (45, G["loop"]): ("REDUCE", G["expr -> not expr"]), (45, G["of"]): ("REDUCE", G["expr -> not expr"]), - (45, G["then"]): ("REDUCE", G["expr -> not expr"]), + (45, G["loop"]): ("REDUCE", G["expr -> not expr"]), + (45, G[")"]): ("REDUCE", G["expr -> not expr"]), (45, G["pool"]): ("REDUCE", G["expr -> not expr"]), + (45, G["then"]): ("REDUCE", G["expr -> not expr"]), + (45, G["error"]): ("REDUCE", G["expr -> not expr"]), + (45, G[","]): ("REDUCE", G["expr -> not expr"]), + (45, G["in"]): ("REDUCE", G["expr -> not expr"]), (45, G["else"]): ("REDUCE", G["expr -> not expr"]), - (45, G[")"]): ("REDUCE", G["expr -> not expr"]), - (46, G["fi"]): ("REDUCE", G["expr -> comp"]), - (46, G["error"]): ("REDUCE", G["expr -> comp"]), - (46, G["in"]): ("REDUCE", G["expr -> comp"]), - (46, G[","]): ("REDUCE", G["expr -> comp"]), - (46, G[";"]): ("REDUCE", G["expr -> comp"]), - (46, G["}"]): ("REDUCE", G["expr -> comp"]), - (46, G["loop"]): ("REDUCE", G["expr -> comp"]), + (45, G["fi"]): ("REDUCE", G["expr -> not expr"]), + (45, G["}"]): ("REDUCE", G["expr -> not expr"]), + (45, G[";"]): ("REDUCE", G["expr -> not expr"]), (46, G["of"]): ("REDUCE", G["expr -> comp"]), - (46, G["then"]): ("REDUCE", G["expr -> comp"]), + (46, G["loop"]): ("REDUCE", G["expr -> comp"]), + (46, G[")"]): ("REDUCE", G["expr -> comp"]), (46, G["pool"]): ("REDUCE", G["expr -> comp"]), + (46, G["then"]): ("REDUCE", G["expr -> comp"]), + (46, G["error"]): ("REDUCE", G["expr -> comp"]), + (46, G[","]): ("REDUCE", G["expr -> comp"]), + (46, G["in"]): ("REDUCE", G["expr -> comp"]), (46, G["else"]): ("REDUCE", G["expr -> comp"]), - (46, G[")"]): ("REDUCE", G["expr -> comp"]), - (47, G["<"]): ("SHIFT", 57), - (47, G["<="]): ("SHIFT", 60), + (46, G["fi"]): ("REDUCE", G["expr -> comp"]), + (46, G["}"]): ("REDUCE", G["expr -> comp"]), + (46, G[";"]): ("REDUCE", G["expr -> comp"]), (47, G["-"]): ("SHIFT", 55), + (47, G["<="]): ("SHIFT", 60), (47, G["="]): ("SHIFT", 62), - (47, G["fi"]): ("REDUCE", G["comp -> arith"]), - (47, G["error"]): ("REDUCE", G["comp -> arith"]), - (47, G["in"]): ("REDUCE", G["comp -> arith"]), - (47, G[","]): ("REDUCE", G["comp -> arith"]), - (47, G[";"]): ("REDUCE", G["comp -> arith"]), - (47, G["}"]): ("REDUCE", G["comp -> arith"]), - (47, G["loop"]): ("REDUCE", G["comp -> arith"]), + (47, G["<"]): ("SHIFT", 57), + (47, G["+"]): ("SHIFT", 48), (47, G["of"]): ("REDUCE", G["comp -> arith"]), - (47, G["then"]): ("REDUCE", G["comp -> arith"]), + (47, G["loop"]): ("REDUCE", G["comp -> arith"]), + (47, G[")"]): ("REDUCE", G["comp -> arith"]), (47, G["pool"]): ("REDUCE", G["comp -> arith"]), + (47, G["then"]): ("REDUCE", G["comp -> arith"]), + (47, G["error"]): ("REDUCE", G["comp -> arith"]), + (47, G[","]): ("REDUCE", G["comp -> arith"]), + (47, G["in"]): ("REDUCE", G["comp -> arith"]), (47, G["else"]): ("REDUCE", G["comp -> arith"]), - (47, G[")"]): ("REDUCE", G["comp -> arith"]), - (47, G["+"]): ("SHIFT", 48), - (48, G["string"]): ("SHIFT", 17), + (47, G["fi"]): ("REDUCE", G["comp -> arith"]), + (47, G["}"]): ("REDUCE", G["comp -> arith"]), + (47, G[";"]): ("REDUCE", G["comp -> arith"]), + (48, G["("]): ("SHIFT", 20), + (48, G["id"]): ("SHIFT", 34), (48, G["isvoid"]): ("SHIFT", 33), - (48, G["true"]): ("SHIFT", 35), + (48, G["string"]): ("SHIFT", 17), (48, G["int"]): ("SHIFT", 18), - (48, G["id"]): ("SHIFT", 34), - (48, G["("]): ("SHIFT", 20), + (48, G["true"]): ("SHIFT", 35), (48, G["false"]): ("SHIFT", 36), - (48, G["new"]): ("SHIFT", 31), (48, G["~"]): ("SHIFT", 37), - (49, G["in"]): ("REDUCE", G["arith -> arith + term"]), + (48, G["new"]): ("SHIFT", 31), + (49, G["*"]): ("SHIFT", 50), + (49, G["/"]): ("SHIFT", 52), + (49, G["loop"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["pool"]): ("REDUCE", G["arith -> arith + term"]), (49, G["+"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["error"]): ("REDUCE", G["arith -> arith + term"]), (49, G["-"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["in"]): ("REDUCE", G["arith -> arith + term"]), (49, G["}"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["of"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["then"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["else"]): ("REDUCE", G["arith -> arith + term"]), (49, G["<"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["of"]): ("REDUCE", G["arith -> arith + term"]), (49, G[")"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["fi"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["error"]): ("REDUCE", G["arith -> arith + term"]), (49, G["<="]): ("REDUCE", G["arith -> arith + term"]), (49, G["="]): ("REDUCE", G["arith -> arith + term"]), + (49, G["then"]): ("REDUCE", G["arith -> arith + term"]), (49, G[","]): ("REDUCE", G["arith -> arith + term"]), + (49, G["else"]): ("REDUCE", G["arith -> arith + term"]), + (49, G["fi"]): ("REDUCE", G["arith -> arith + term"]), (49, G[";"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["loop"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["pool"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["*"]): ("SHIFT", 50), - (49, G["/"]): ("SHIFT", 52), - (50, G["id"]): ("SHIFT", 34), (50, G["("]): ("SHIFT", 20), - (50, G["string"]): ("SHIFT", 17), + (50, G["id"]): ("SHIFT", 34), + (50, G["true"]): ("SHIFT", 35), + (50, G["~"]): ("SHIFT", 37), (50, G["false"]): ("SHIFT", 36), (50, G["isvoid"]): ("SHIFT", 33), - (50, G["true"]): ("SHIFT", 35), + (50, G["string"]): ("SHIFT", 17), (50, G["int"]): ("SHIFT", 18), (50, G["new"]): ("SHIFT", 31), - (50, G["~"]): ("SHIFT", 37), - (51, G["in"]): ("REDUCE", G["term -> term * factor"]), + (51, G["loop"]): ("REDUCE", G["term -> term * factor"]), + (51, G["pool"]): ("REDUCE", G["term -> term * factor"]), (51, G["+"]): ("REDUCE", G["term -> term * factor"]), - (51, G["}"]): ("REDUCE", G["term -> term * factor"]), + (51, G["error"]): ("REDUCE", G["term -> term * factor"]), (51, G["-"]): ("REDUCE", G["term -> term * factor"]), - (51, G["of"]): ("REDUCE", G["term -> term * factor"]), - (51, G["then"]): ("REDUCE", G["term -> term * factor"]), + (51, G["in"]): ("REDUCE", G["term -> term * factor"]), (51, G["*"]): ("REDUCE", G["term -> term * factor"]), + (51, G["}"]): ("REDUCE", G["term -> term * factor"]), (51, G["/"]): ("REDUCE", G["term -> term * factor"]), - (51, G["else"]): ("REDUCE", G["term -> term * factor"]), (51, G["<"]): ("REDUCE", G["term -> term * factor"]), + (51, G["of"]): ("REDUCE", G["term -> term * factor"]), (51, G[")"]): ("REDUCE", G["term -> term * factor"]), - (51, G["fi"]): ("REDUCE", G["term -> term * factor"]), - (51, G["error"]): ("REDUCE", G["term -> term * factor"]), (51, G["<="]): ("REDUCE", G["term -> term * factor"]), (51, G["="]): ("REDUCE", G["term -> term * factor"]), + (51, G["then"]): ("REDUCE", G["term -> term * factor"]), (51, G[","]): ("REDUCE", G["term -> term * factor"]), + (51, G["else"]): ("REDUCE", G["term -> term * factor"]), + (51, G["fi"]): ("REDUCE", G["term -> term * factor"]), (51, G[";"]): ("REDUCE", G["term -> term * factor"]), - (51, G["loop"]): ("REDUCE", G["term -> term * factor"]), - (51, G["pool"]): ("REDUCE", G["term -> term * factor"]), - (52, G["id"]): ("SHIFT", 34), (52, G["("]): ("SHIFT", 20), - (52, G["string"]): ("SHIFT", 17), + (52, G["id"]): ("SHIFT", 34), + (52, G["true"]): ("SHIFT", 35), + (52, G["~"]): ("SHIFT", 37), (52, G["false"]): ("SHIFT", 36), (52, G["isvoid"]): ("SHIFT", 33), - (52, G["true"]): ("SHIFT", 35), + (52, G["string"]): ("SHIFT", 17), (52, G["int"]): ("SHIFT", 18), (52, G["new"]): ("SHIFT", 31), - (52, G["~"]): ("SHIFT", 37), - (53, G["in"]): ("REDUCE", G["term -> term / factor"]), + (53, G["loop"]): ("REDUCE", G["term -> term / factor"]), + (53, G["pool"]): ("REDUCE", G["term -> term / factor"]), (53, G["+"]): ("REDUCE", G["term -> term / factor"]), - (53, G["}"]): ("REDUCE", G["term -> term / factor"]), + (53, G["error"]): ("REDUCE", G["term -> term / factor"]), (53, G["-"]): ("REDUCE", G["term -> term / factor"]), - (53, G["of"]): ("REDUCE", G["term -> term / factor"]), - (53, G["then"]): ("REDUCE", G["term -> term / factor"]), + (53, G["in"]): ("REDUCE", G["term -> term / factor"]), (53, G["*"]): ("REDUCE", G["term -> term / factor"]), + (53, G["}"]): ("REDUCE", G["term -> term / factor"]), (53, G["/"]): ("REDUCE", G["term -> term / factor"]), - (53, G["else"]): ("REDUCE", G["term -> term / factor"]), (53, G["<"]): ("REDUCE", G["term -> term / factor"]), + (53, G["of"]): ("REDUCE", G["term -> term / factor"]), (53, G[")"]): ("REDUCE", G["term -> term / factor"]), - (53, G["fi"]): ("REDUCE", G["term -> term / factor"]), - (53, G["error"]): ("REDUCE", G["term -> term / factor"]), (53, G["<="]): ("REDUCE", G["term -> term / factor"]), (53, G["="]): ("REDUCE", G["term -> term / factor"]), + (53, G["then"]): ("REDUCE", G["term -> term / factor"]), (53, G[","]): ("REDUCE", G["term -> term / factor"]), + (53, G["else"]): ("REDUCE", G["term -> term / factor"]), + (53, G["fi"]): ("REDUCE", G["term -> term / factor"]), (53, G[";"]): ("REDUCE", G["term -> term / factor"]), - (53, G["loop"]): ("REDUCE", G["term -> term / factor"]), - (53, G["pool"]): ("REDUCE", G["term -> term / factor"]), - (54, G["in"]): ("REDUCE", G["term -> factor"]), + (54, G["loop"]): ("REDUCE", G["term -> factor"]), + (54, G["pool"]): ("REDUCE", G["term -> factor"]), (54, G["+"]): ("REDUCE", G["term -> factor"]), + (54, G["error"]): ("REDUCE", G["term -> factor"]), (54, G["-"]): ("REDUCE", G["term -> factor"]), - (54, G["}"]): ("REDUCE", G["term -> factor"]), - (54, G["of"]): ("REDUCE", G["term -> factor"]), - (54, G["then"]): ("REDUCE", G["term -> factor"]), + (54, G["in"]): ("REDUCE", G["term -> factor"]), (54, G["*"]): ("REDUCE", G["term -> factor"]), + (54, G["}"]): ("REDUCE", G["term -> factor"]), (54, G["/"]): ("REDUCE", G["term -> factor"]), - (54, G["else"]): ("REDUCE", G["term -> factor"]), (54, G["<"]): ("REDUCE", G["term -> factor"]), + (54, G["of"]): ("REDUCE", G["term -> factor"]), (54, G[")"]): ("REDUCE", G["term -> factor"]), - (54, G["fi"]): ("REDUCE", G["term -> factor"]), - (54, G["error"]): ("REDUCE", G["term -> factor"]), (54, G["<="]): ("REDUCE", G["term -> factor"]), (54, G["="]): ("REDUCE", G["term -> factor"]), + (54, G["then"]): ("REDUCE", G["term -> factor"]), (54, G[","]): ("REDUCE", G["term -> factor"]), + (54, G["else"]): ("REDUCE", G["term -> factor"]), + (54, G["fi"]): ("REDUCE", G["term -> factor"]), (54, G[";"]): ("REDUCE", G["term -> factor"]), - (54, G["loop"]): ("REDUCE", G["term -> factor"]), - (54, G["pool"]): ("REDUCE", G["term -> factor"]), - (55, G["string"]): ("SHIFT", 17), + (55, G["("]): ("SHIFT", 20), + (55, G["id"]): ("SHIFT", 34), (55, G["isvoid"]): ("SHIFT", 33), - (55, G["true"]): ("SHIFT", 35), + (55, G["string"]): ("SHIFT", 17), (55, G["int"]): ("SHIFT", 18), - (55, G["id"]): ("SHIFT", 34), - (55, G["("]): ("SHIFT", 20), - (55, G["false"]): ("SHIFT", 36), (55, G["new"]): ("SHIFT", 31), + (55, G["true"]): ("SHIFT", 35), + (55, G["false"]): ("SHIFT", 36), (55, G["~"]): ("SHIFT", 37), - (56, G["in"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["loop"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["pool"]): ("REDUCE", G["arith -> arith - term"]), (56, G["+"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["}"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["error"]): ("REDUCE", G["arith -> arith - term"]), (56, G["-"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["of"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["then"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["else"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["in"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["}"]): ("REDUCE", G["arith -> arith - term"]), (56, G["<"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["of"]): ("REDUCE", G["arith -> arith - term"]), (56, G[")"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["fi"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["error"]): ("REDUCE", G["arith -> arith - term"]), (56, G["<="]): ("REDUCE", G["arith -> arith - term"]), (56, G["="]): ("REDUCE", G["arith -> arith - term"]), + (56, G["then"]): ("REDUCE", G["arith -> arith - term"]), (56, G[","]): ("REDUCE", G["arith -> arith - term"]), + (56, G["else"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["fi"]): ("REDUCE", G["arith -> arith - term"]), (56, G[";"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["loop"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["pool"]): ("REDUCE", G["arith -> arith - term"]), (56, G["*"]): ("SHIFT", 50), (56, G["/"]): ("SHIFT", 52), - (57, G["id"]): ("SHIFT", 34), - (57, G["~"]): ("SHIFT", 37), (57, G["int"]): ("SHIFT", 18), - (57, G["true"]): ("SHIFT", 35), (57, G["string"]): ("SHIFT", 17), + (57, G["true"]): ("SHIFT", 35), + (57, G["false"]): ("SHIFT", 36), + (57, G["~"]): ("SHIFT", 37), (57, G["new"]): ("SHIFT", 31), - (57, G["isvoid"]): ("SHIFT", 33), (57, G["("]): ("SHIFT", 20), - (57, G["false"]): ("SHIFT", 36), - (58, G["+"]): ("SHIFT", 48), - (58, G["-"]): ("SHIFT", 55), - (58, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G["error"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G["in"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G[","]): ("REDUCE", G["comp -> arith < arith"]), - (58, G[";"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G["}"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), + (57, G["id"]): ("SHIFT", 34), + (57, G["isvoid"]): ("SHIFT", 33), (58, G["of"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G["then"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G[")"]): ("REDUCE", G["comp -> arith < arith"]), (58, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G["then"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G["error"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G[","]): ("REDUCE", G["comp -> arith < arith"]), + (58, G["in"]): ("REDUCE", G["comp -> arith < arith"]), (58, G["else"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G[")"]): ("REDUCE", G["comp -> arith < arith"]), - (59, G["in"]): ("REDUCE", G["arith -> term"]), + (58, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G["}"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G[";"]): ("REDUCE", G["comp -> arith < arith"]), + (58, G["+"]): ("SHIFT", 48), + (58, G["-"]): ("SHIFT", 55), + (59, G["*"]): ("SHIFT", 50), + (59, G["/"]): ("SHIFT", 52), + (59, G["loop"]): ("REDUCE", G["arith -> term"]), + (59, G["pool"]): ("REDUCE", G["arith -> term"]), (59, G["+"]): ("REDUCE", G["arith -> term"]), + (59, G["error"]): ("REDUCE", G["arith -> term"]), (59, G["-"]): ("REDUCE", G["arith -> term"]), + (59, G["in"]): ("REDUCE", G["arith -> term"]), (59, G["}"]): ("REDUCE", G["arith -> term"]), - (59, G["of"]): ("REDUCE", G["arith -> term"]), - (59, G["then"]): ("REDUCE", G["arith -> term"]), - (59, G["else"]): ("REDUCE", G["arith -> term"]), (59, G["<"]): ("REDUCE", G["arith -> term"]), + (59, G["of"]): ("REDUCE", G["arith -> term"]), (59, G[")"]): ("REDUCE", G["arith -> term"]), - (59, G["fi"]): ("REDUCE", G["arith -> term"]), - (59, G["error"]): ("REDUCE", G["arith -> term"]), (59, G["<="]): ("REDUCE", G["arith -> term"]), (59, G["="]): ("REDUCE", G["arith -> term"]), + (59, G["then"]): ("REDUCE", G["arith -> term"]), (59, G[","]): ("REDUCE", G["arith -> term"]), + (59, G["else"]): ("REDUCE", G["arith -> term"]), + (59, G["fi"]): ("REDUCE", G["arith -> term"]), (59, G[";"]): ("REDUCE", G["arith -> term"]), - (59, G["loop"]): ("REDUCE", G["arith -> term"]), - (59, G["pool"]): ("REDUCE", G["arith -> term"]), - (59, G["*"]): ("SHIFT", 50), - (59, G["/"]): ("SHIFT", 52), - (60, G["id"]): ("SHIFT", 34), - (60, G["~"]): ("SHIFT", 37), (60, G["int"]): ("SHIFT", 18), - (60, G["true"]): ("SHIFT", 35), (60, G["string"]): ("SHIFT", 17), + (60, G["true"]): ("SHIFT", 35), + (60, G["false"]): ("SHIFT", 36), + (60, G["~"]): ("SHIFT", 37), (60, G["new"]): ("SHIFT", 31), - (60, G["isvoid"]): ("SHIFT", 33), (60, G["("]): ("SHIFT", 20), - (60, G["false"]): ("SHIFT", 36), - (61, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G[","]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), + (60, G["id"]): ("SHIFT", 34), + (60, G["isvoid"]): ("SHIFT", 33), (61, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), (61, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G[","]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), (61, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), + (61, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), (61, G["+"]): ("SHIFT", 48), (61, G["-"]): ("SHIFT", 55), - (62, G["id"]): ("SHIFT", 34), - (62, G["~"]): ("SHIFT", 37), (62, G["int"]): ("SHIFT", 18), - (62, G["true"]): ("SHIFT", 35), (62, G["string"]): ("SHIFT", 17), + (62, G["true"]): ("SHIFT", 35), + (62, G["false"]): ("SHIFT", 36), + (62, G["~"]): ("SHIFT", 37), (62, G["new"]): ("SHIFT", 31), - (62, G["isvoid"]): ("SHIFT", 33), (62, G["("]): ("SHIFT", 20), - (62, G["false"]): ("SHIFT", 36), + (62, G["id"]): ("SHIFT", 34), + (62, G["isvoid"]): ("SHIFT", 33), (63, G["+"]): ("SHIFT", 48), - (63, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G["error"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G["in"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G[","]): ("REDUCE", G["comp -> arith = arith"]), - (63, G[";"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G["}"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), (63, G["of"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G["then"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G[")"]): ("REDUCE", G["comp -> arith = arith"]), (63, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G["then"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G["error"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G[","]): ("REDUCE", G["comp -> arith = arith"]), + (63, G["in"]): ("REDUCE", G["comp -> arith = arith"]), (63, G["else"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G[")"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G["}"]): ("REDUCE", G["comp -> arith = arith"]), + (63, G[";"]): ("REDUCE", G["comp -> arith = arith"]), (63, G["-"]): ("SHIFT", 55), (64, G[")"]): ("SHIFT", 65), - (65, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (65, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (66, G[")"]): ("REDUCE", G["expr-list -> expr"]), (66, G[","]): ("SHIFT", 67), - (67, G["case"]): ("SHIFT", 30), + (66, G[")"]): ("REDUCE", G["expr-list -> expr"]), + (67, G["let"]): ("SHIFT", 23), (67, G["false"]): ("SHIFT", 36), - (67, G["~"]): ("SHIFT", 37), - (67, G["if"]): ("SHIFT", 21), + (67, G["case"]): ("SHIFT", 30), + (67, G["new"]): ("SHIFT", 31), (67, G["id"]): ("SHIFT", 15), - (67, G["true"]): ("SHIFT", 35), + (67, G["{"]): ("SHIFT", 19), (67, G["int"]): ("SHIFT", 18), - (67, G["let"]): ("SHIFT", 23), + (67, G["true"]): ("SHIFT", 35), + (67, G["("]): ("SHIFT", 20), + (67, G["~"]): ("SHIFT", 37), (67, G["while"]): ("SHIFT", 22), - (67, G["isvoid"]): ("SHIFT", 33), (67, G["string"]): ("SHIFT", 17), + (67, G["if"]): ("SHIFT", 21), (67, G["not"]): ("SHIFT", 44), - (67, G["("]): ("SHIFT", 20), - (67, G["new"]): ("SHIFT", 31), - (67, G["{"]): ("SHIFT", 19), + (67, G["isvoid"]): ("SHIFT", 33), (68, G[")"]): ("REDUCE", G["expr-list -> expr , expr-list"]), (69, G["type"]): ("SHIFT", 70), (70, G["."]): ("SHIFT", 71), (71, G["id"]): ("SHIFT", 72), (72, G["("]): ("SHIFT", 73), - (73, G["case"]): ("SHIFT", 30), + (73, G["let"]): ("SHIFT", 23), (73, G["false"]): ("SHIFT", 36), - (73, G["~"]): ("SHIFT", 37), - (73, G["if"]): ("SHIFT", 21), + (73, G["case"]): ("SHIFT", 30), + (73, G["new"]): ("SHIFT", 31), (73, G["id"]): ("SHIFT", 15), - (73, G["true"]): ("SHIFT", 35), + (73, G["{"]): ("SHIFT", 19), (73, G["int"]): ("SHIFT", 18), - (73, G["let"]): ("SHIFT", 23), + (73, G["true"]): ("SHIFT", 35), + (73, G["("]): ("SHIFT", 20), + (73, G["~"]): ("SHIFT", 37), (73, G["while"]): ("SHIFT", 22), - (73, G["isvoid"]): ("SHIFT", 33), (73, G["string"]): ("SHIFT", 17), + (73, G["if"]): ("SHIFT", 21), (73, G["not"]): ("SHIFT", 44), - (73, G["("]): ("SHIFT", 20), - (73, G["new"]): ("SHIFT", 31), - (73, G["{"]): ("SHIFT", 19), + (73, G["isvoid"]): ("SHIFT", 33), (74, G[")"]): ("SHIFT", 75), - (75, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (75, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), (77, G["of"]): ("SHIFT", 78), (78, G["id"]): ("SHIFT", 79), (79, G[":"]): ("SHIFT", 80), (80, G["type"]): ("SHIFT", 81), (81, G["=>"]): ("SHIFT", 82), - (82, G["~"]): ("SHIFT", 37), - (82, G["if"]): ("SHIFT", 21), - (82, G["id"]): ("SHIFT", 15), - (82, G["not"]): ("SHIFT", 44), (82, G["false"]): ("SHIFT", 36), + (82, G["new"]): ("SHIFT", 31), + (82, G["id"]): ("SHIFT", 15), (82, G["while"]): ("SHIFT", 22), (82, G["int"]): ("SHIFT", 18), + (82, G["if"]): ("SHIFT", 21), + (82, G["~"]): ("SHIFT", 37), (82, G["true"]): ("SHIFT", 35), - (82, G["isvoid"]): ("SHIFT", 33), - (82, G["string"]): ("SHIFT", 17), + (82, G["not"]): ("SHIFT", 44), (82, G["let"]): ("SHIFT", 23), - (82, G["new"]): ("SHIFT", 31), + (82, G["isvoid"]): ("SHIFT", 33), + (82, G["case"]): ("SHIFT", 30), (82, G["("]): ("SHIFT", 20), + (82, G["string"]): ("SHIFT", 17), (82, G["{"]): ("SHIFT", 19), - (82, G["case"]): ("SHIFT", 30), (83, G[";"]): ("SHIFT", 84), (84, G["id"]): ("SHIFT", 79), (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), (86, G["esac"]): ("SHIFT", 87), - (87, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (87, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (87, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (87, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G[","]): ("SHIFT", 89), (88, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), (89, G["id"]): ("SHIFT", 24), (90, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), (91, G["in"]): ("SHIFT", 92), - (92, G["string"]): ("SHIFT", 17), - (92, G["if"]): ("SHIFT", 21), + (92, G["("]): ("SHIFT", 20), + (92, G["case"]): ("SHIFT", 30), + (92, G["id"]): ("SHIFT", 15), (92, G["isvoid"]): ("SHIFT", 33), - (92, G["int"]): ("SHIFT", 18), - (92, G["true"]): ("SHIFT", 35), + (92, G["string"]): ("SHIFT", 17), (92, G["{"]): ("SHIFT", 19), (92, G["false"]): ("SHIFT", 36), - (92, G["id"]): ("SHIFT", 15), - (92, G["case"]): ("SHIFT", 30), + (92, G["new"]): ("SHIFT", 31), + (92, G["int"]): ("SHIFT", 18), + (92, G["while"]): ("SHIFT", 22), + (92, G["if"]): ("SHIFT", 21), + (92, G["true"]): ("SHIFT", 35), + (92, G["not"]): ("SHIFT", 44), (92, G["let"]): ("SHIFT", 23), (92, G["~"]): ("SHIFT", 37), - (92, G["not"]): ("SHIFT", 44), - (92, G["while"]): ("SHIFT", 22), - (92, G["("]): ("SHIFT", 20), - (92, G["new"]): ("SHIFT", 31), - (93, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (93, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (93, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (93, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["loop"]): ("SHIFT", 95), + (95, G["new"]): ("SHIFT", 31), (95, G["id"]): ("SHIFT", 15), - (95, G["isvoid"]): ("SHIFT", 33), + (95, G["let"]): ("SHIFT", 23), (95, G["case"]): ("SHIFT", 30), - (95, G["string"]): ("SHIFT", 17), + (95, G["int"]): ("SHIFT", 18), + (95, G["true"]): ("SHIFT", 35), (95, G["{"]): ("SHIFT", 19), + (95, G["~"]): ("SHIFT", 37), + (95, G["("]): ("SHIFT", 20), + (95, G["string"]): ("SHIFT", 17), + (95, G["isvoid"]): ("SHIFT", 33), + (95, G["while"]): ("SHIFT", 22), (95, G["if"]): ("SHIFT", 21), (95, G["false"]): ("SHIFT", 36), - (95, G["true"]): ("SHIFT", 35), - (95, G["int"]): ("SHIFT", 18), - (95, G["new"]): ("SHIFT", 31), - (95, G["("]): ("SHIFT", 20), (95, G["not"]): ("SHIFT", 44), - (95, G["while"]): ("SHIFT", 22), - (95, G["let"]): ("SHIFT", 23), - (95, G["~"]): ("SHIFT", 37), (96, G["pool"]): ("SHIFT", 97), - (97, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (97, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (97, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (97, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["then"]): ("SHIFT", 99), - (99, G["new"]): ("SHIFT", 31), - (99, G["true"]): ("SHIFT", 35), - (99, G["int"]): ("SHIFT", 18), (99, G["if"]): ("SHIFT", 21), - (99, G["not"]): ("SHIFT", 44), (99, G["id"]): ("SHIFT", 15), - (99, G["isvoid"]): ("SHIFT", 33), - (99, G["while"]): ("SHIFT", 22), - (99, G["~"]): ("SHIFT", 37), - (99, G["false"]): ("SHIFT", 36), + (99, G["not"]): ("SHIFT", 44), + (99, G["int"]): ("SHIFT", 18), (99, G["let"]): ("SHIFT", 23), - (99, G["{"]): ("SHIFT", 19), (99, G["case"]): ("SHIFT", 30), + (99, G["true"]): ("SHIFT", 35), + (99, G["~"]): ("SHIFT", 37), + (99, G["{"]): ("SHIFT", 19), (99, G["("]): ("SHIFT", 20), (99, G["string"]): ("SHIFT", 17), + (99, G["isvoid"]): ("SHIFT", 33), + (99, G["false"]): ("SHIFT", 36), + (99, G["while"]): ("SHIFT", 22), + (99, G["new"]): ("SHIFT", 31), (100, G["else"]): ("SHIFT", 101), - (101, G["while"]): ("SHIFT", 22), - (101, G["let"]): ("SHIFT", 23), - (101, G["id"]): ("SHIFT", 15), + (101, G["case"]): ("SHIFT", 30), (101, G["("]): ("SHIFT", 20), + (101, G["id"]): ("SHIFT", 15), (101, G["~"]): ("SHIFT", 37), - (101, G["false"]): ("SHIFT", 36), - (101, G["true"]): ("SHIFT", 35), - (101, G["int"]): ("SHIFT", 18), - (101, G["if"]): ("SHIFT", 21), - (101, G["new"]): ("SHIFT", 31), - (101, G["case"]): ("SHIFT", 30), (101, G["{"]): ("SHIFT", 19), - (101, G["isvoid"]): ("SHIFT", 33), (101, G["string"]): ("SHIFT", 17), + (101, G["isvoid"]): ("SHIFT", 33), + (101, G["false"]): ("SHIFT", 36), + (101, G["new"]): ("SHIFT", 31), + (101, G["while"]): ("SHIFT", 22), + (101, G["if"]): ("SHIFT", 21), (101, G["not"]): ("SHIFT", 44), + (101, G["int"]): ("SHIFT", 18), + (101, G["true"]): ("SHIFT", 35), + (101, G["let"]): ("SHIFT", 23), (102, G["fi"]): ("SHIFT", 103), - (103, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (103, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (103, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (103, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G[")"]): ("SHIFT", 105), - (105, G["in"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["@"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["+"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["error"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["-"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["}"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["of"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["then"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["in"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["*"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["}"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["/"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["else"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G[")"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["<"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["error"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["."]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["of"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G[")"]): ("REDUCE", G["atom -> ( expr )"]), (105, G["<="]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["."]): ("REDUCE", G["atom -> ( expr )"]), (105, G["="]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["then"]): ("REDUCE", G["atom -> ( expr )"]), (105, G[","]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["else"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), (105, G[";"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["@"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["}"]): ("SHIFT", 107), - (107, G["fi"]): ("REDUCE", G["expr -> { block }"]), - (107, G["error"]): ("REDUCE", G["expr -> { block }"]), - (107, G["in"]): ("REDUCE", G["expr -> { block }"]), - (107, G[","]): ("REDUCE", G["expr -> { block }"]), - (107, G[";"]): ("REDUCE", G["expr -> { block }"]), - (107, G["}"]): ("REDUCE", G["expr -> { block }"]), - (107, G["loop"]): ("REDUCE", G["expr -> { block }"]), (107, G["of"]): ("REDUCE", G["expr -> { block }"]), - (107, G["then"]): ("REDUCE", G["expr -> { block }"]), + (107, G["loop"]): ("REDUCE", G["expr -> { block }"]), + (107, G[")"]): ("REDUCE", G["expr -> { block }"]), (107, G["pool"]): ("REDUCE", G["expr -> { block }"]), + (107, G["then"]): ("REDUCE", G["expr -> { block }"]), + (107, G["error"]): ("REDUCE", G["expr -> { block }"]), + (107, G[","]): ("REDUCE", G["expr -> { block }"]), + (107, G["in"]): ("REDUCE", G["expr -> { block }"]), (107, G["else"]): ("REDUCE", G["expr -> { block }"]), - (107, G[")"]): ("REDUCE", G["expr -> { block }"]), + (107, G["fi"]): ("REDUCE", G["expr -> { block }"]), + (107, G["}"]): ("REDUCE", G["expr -> { block }"]), + (107, G[";"]): ("REDUCE", G["expr -> { block }"]), (108, G[";"]): ("SHIFT", 109), - (109, G["~"]): ("SHIFT", 37), - (109, G["if"]): ("SHIFT", 21), - (109, G["id"]): ("SHIFT", 15), - (109, G["not"]): ("SHIFT", 44), (109, G["false"]): ("SHIFT", 36), + (109, G["new"]): ("SHIFT", 31), + (109, G["id"]): ("SHIFT", 15), (109, G["while"]): ("SHIFT", 22), (109, G["int"]): ("SHIFT", 18), + (109, G["if"]): ("SHIFT", 21), + (109, G["~"]): ("SHIFT", 37), (109, G["true"]): ("SHIFT", 35), - (109, G["isvoid"]): ("SHIFT", 33), - (109, G["string"]): ("SHIFT", 17), + (109, G["}"]): ("REDUCE", G["block -> expr ;"]), + (109, G["not"]): ("SHIFT", 44), (109, G["let"]): ("SHIFT", 23), - (109, G["new"]): ("SHIFT", 31), + (109, G["isvoid"]): ("SHIFT", 33), + (109, G["case"]): ("SHIFT", 30), (109, G["("]): ("SHIFT", 20), + (109, G["string"]): ("SHIFT", 17), (109, G["{"]): ("SHIFT", 19), - (109, G["}"]): ("REDUCE", G["block -> expr ;"]), - (109, G["case"]): ("SHIFT", 30), (110, G["}"]): ("REDUCE", G["block -> expr ; block"]), (111, G[")"]): ("SHIFT", 112), - (112, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (112, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (112, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (113, G["string"]): ("SHIFT", 17), - (113, G["if"]): ("SHIFT", 21), + (113, G["("]): ("SHIFT", 20), + (113, G["case"]): ("SHIFT", 30), + (113, G["id"]): ("SHIFT", 15), (113, G["isvoid"]): ("SHIFT", 33), - (113, G["int"]): ("SHIFT", 18), - (113, G["true"]): ("SHIFT", 35), + (113, G["string"]): ("SHIFT", 17), (113, G["{"]): ("SHIFT", 19), - (113, G["false"]): ("SHIFT", 36), - (113, G["id"]): ("SHIFT", 15), - (113, G["case"]): ("SHIFT", 30), - (113, G["let"]): ("SHIFT", 23), - (113, G["~"]): ("SHIFT", 37), - (113, G["not"]): ("SHIFT", 44), - (113, G["while"]): ("SHIFT", 22), - (113, G["("]): ("SHIFT", 20), - (113, G["new"]): ("SHIFT", 31), - (114, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G["error"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G["in"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G[","]): ("REDUCE", G["expr -> id <- expr"]), - (114, G[";"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G["}"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), + (113, G["false"]): ("SHIFT", 36), + (113, G["new"]): ("SHIFT", 31), + (113, G["int"]): ("SHIFT", 18), + (113, G["while"]): ("SHIFT", 22), + (113, G["if"]): ("SHIFT", 21), + (113, G["true"]): ("SHIFT", 35), + (113, G["not"]): ("SHIFT", 44), + (113, G["let"]): ("SHIFT", 23), + (113, G["~"]): ("SHIFT", 37), (114, G["of"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G["then"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G[")"]): ("REDUCE", G["expr -> id <- expr"]), (114, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["then"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["error"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G[","]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["in"]): ("REDUCE", G["expr -> id <- expr"]), (114, G["else"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G[")"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G["}"]): ("REDUCE", G["expr -> id <- expr"]), + (114, G[";"]): ("REDUCE", G["expr -> id <- expr"]), (115, G["}"]): ("SHIFT", 116), - (116, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), (116, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (116, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), (117, G[")"]): ("SHIFT", 118), (118, G[":"]): ("SHIFT", 119), (119, G["type"]): ("SHIFT", 120), (120, G["{"]): ("SHIFT", 121), - (121, G["new"]): ("SHIFT", 31), + (121, G["case"]): ("SHIFT", 30), (121, G["("]): ("SHIFT", 20), + (121, G["let"]): ("SHIFT", 23), (121, G["id"]): ("SHIFT", 15), (121, G["{"]): ("SHIFT", 19), - (121, G["case"]): ("SHIFT", 30), - (121, G["~"]): ("SHIFT", 37), - (121, G["if"]): ("SHIFT", 21), - (121, G["not"]): ("SHIFT", 44), + (121, G["string"]): ("SHIFT", 17), (121, G["false"]): ("SHIFT", 36), + (121, G["~"]): ("SHIFT", 37), + (121, G["new"]): ("SHIFT", 31), (121, G["while"]): ("SHIFT", 22), + (121, G["if"]): ("SHIFT", 21), + (121, G["isvoid"]): ("SHIFT", 33), (121, G["int"]): ("SHIFT", 18), + (121, G["not"]): ("SHIFT", 44), (121, G["true"]): ("SHIFT", 35), - (121, G["isvoid"]): ("SHIFT", 33), - (121, G["string"]): ("SHIFT", 17), - (121, G["let"]): ("SHIFT", 23), (122, G["}"]): ("SHIFT", 123), - (123, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (123, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (123, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (124, G["type"]): ("SHIFT", 125), - (125, G["<-"]): ("SHIFT", 126), - (125, G["error"]): ("REDUCE", G["attribute -> id : type"]), (125, G[";"]): ("REDUCE", G["attribute -> id : type"]), - (126, G["string"]): ("SHIFT", 17), - (126, G["not"]): ("SHIFT", 44), - (126, G["("]): ("SHIFT", 20), - (126, G["new"]): ("SHIFT", 31), + (125, G["error"]): ("REDUCE", G["attribute -> id : type"]), + (125, G["<-"]): ("SHIFT", 126), + (126, G["if"]): ("SHIFT", 21), (126, G["id"]): ("SHIFT", 15), - (126, G["{"]): ("SHIFT", 19), + (126, G["not"]): ("SHIFT", 44), + (126, G["string"]): ("SHIFT", 17), + (126, G["let"]): ("SHIFT", 23), (126, G["case"]): ("SHIFT", 30), (126, G["false"]): ("SHIFT", 36), + (126, G["new"]): ("SHIFT", 31), + (126, G["{"]): ("SHIFT", 19), (126, G["~"]): ("SHIFT", 37), - (126, G["if"]): ("SHIFT", 21), (126, G["int"]): ("SHIFT", 18), (126, G["true"]): ("SHIFT", 35), - (126, G["let"]): ("SHIFT", 23), - (126, G["while"]): ("SHIFT", 22), (126, G["isvoid"]): ("SHIFT", 33), - (127, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (126, G["while"]): ("SHIFT", 22), + (126, G["("]): ("SHIFT", 20), (127, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (127, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), (128, G["}"]): ("SHIFT", 129), (129, G["class"]): ("REDUCE", G["class-def -> class type { feature-list }"]), (129, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), (130, G["error"]): ("SHIFT", 138), (130, G[";"]): ("SHIFT", 131), - (131, G["id"]): ("SHIFT", 4), (131, G["}"]): ("REDUCE", G["feature-list -> e"]), + (131, G["id"]): ("SHIFT", 4), (132, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), - (133, G[";"]): ("SHIFT", 134), (133, G["error"]): ("SHIFT", 136), - (134, G["id"]): ("SHIFT", 4), + (133, G[";"]): ("SHIFT", 134), (134, G["}"]): ("REDUCE", G["feature-list -> e"]), + (134, G["id"]): ("SHIFT", 4), (135, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), - (136, G["id"]): ("SHIFT", 4), (136, G["}"]): ("REDUCE", G["feature-list -> e"]), + (136, G["id"]): ("SHIFT", 4), (137, G["}"]): ("REDUCE", G["feature-list -> method error feature-list"]), - (138, G["id"]): ("SHIFT", 4), (138, G["}"]): ("REDUCE", G["feature-list -> e"]), + (138, G["id"]): ("SHIFT", 4), (139, G["}"]): ("REDUCE", G["feature-list -> attribute error feature-list"]), (140, G["type"]): ("SHIFT", 141), (141, G["{"]): ("SHIFT", 142), - (142, G["id"]): ("SHIFT", 4), (142, G["}"]): ("REDUCE", G["feature-list -> e"]), + (142, G["id"]): ("SHIFT", 4), (143, G["}"]): ("SHIFT", 144), (144, G["class"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), (144, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), @@ -1109,109 +1109,109 @@ def __action_table(): @staticmethod def __goto_table(): return { - (0, G["class-list"]): 146, (0, G["class-def"]): 147, (0, G["program"]): 145, + (0, G["class-list"]): 146, + (3, G["attribute"]): 130, (3, G["method"]): 133, (3, G["feature-list"]): 128, - (3, G["attribute"]): 130, (5, G["param-list"]): 117, (9, G["param-list"]): 10, - (14, G["term"]): 59, (14, G["arith"]): 47, - (14, G["factor"]): 54, - (14, G["atom"]): 40, - (14, G["function-call"]): 38, (14, G["comp"]): 46, + (14, G["function-call"]): 38, + (14, G["atom"]): 40, (14, G["expr"]): 115, - (16, G["arith"]): 47, - (16, G["expr-list"]): 111, - (16, G["expr"]): 66, + (14, G["factor"]): 54, + (14, G["term"]): 59, + (16, G["atom"]): 40, (16, G["term"]): 59, + (16, G["function-call"]): 38, + (16, G["expr"]): 66, (16, G["comp"]): 46, + (16, G["arith"]): 47, + (16, G["expr-list"]): 111, (16, G["factor"]): 54, - (16, G["atom"]): 40, - (16, G["function-call"]): 38, - (19, G["atom"]): 40, + (19, G["function-call"]): 38, (19, G["arith"]): 47, - (19, G["expr"]): 108, + (19, G["atom"]): 40, (19, G["term"]): 59, + (19, G["expr"]): 108, (19, G["factor"]): 54, (19, G["block"]): 106, - (19, G["function-call"]): 38, (19, G["comp"]): 46, - (20, G["comp"]): 46, - (20, G["term"]): 59, - (20, G["arith"]): 47, - (20, G["expr"]): 104, (20, G["atom"]): 40, + (20, G["arith"]): 47, + (20, G["term"]): 59, (20, G["factor"]): 54, + (20, G["comp"]): 46, + (20, G["expr"]): 104, (20, G["function-call"]): 38, - (21, G["arith"]): 47, - (21, G["comp"]): 46, + (21, G["function-call"]): 38, (21, G["atom"]): 40, + (21, G["arith"]): 47, + (21, G["term"]): 59, (21, G["factor"]): 54, (21, G["expr"]): 98, - (21, G["term"]): 59, - (21, G["function-call"]): 38, - (22, G["atom"]): 40, + (21, G["comp"]): 46, (22, G["arith"]): 47, - (22, G["term"]): 59, - (22, G["expr"]): 94, + (22, G["factor"]): 54, (22, G["function-call"]): 38, + (22, G["atom"]): 40, + (22, G["expr"]): 94, + (22, G["term"]): 59, (22, G["comp"]): 46, - (22, G["factor"]): 54, (23, G["declaration-list"]): 91, (27, G["declaration-list"]): 28, - (29, G["function-call"]): 38, (29, G["arith"]): 47, - (29, G["term"]): 59, - (29, G["comp"]): 46, - (29, G["atom"]): 40, (29, G["factor"]): 54, + (29, G["function-call"]): 38, + (29, G["atom"]): 40, + (29, G["term"]): 59, (29, G["expr"]): 88, + (29, G["comp"]): 46, (30, G["arith"]): 47, - (30, G["expr"]): 77, - (30, G["atom"]): 40, - (30, G["factor"]): 54, (30, G["term"]): 59, (30, G["function-call"]): 38, (30, G["comp"]): 46, - (33, G["function-call"]): 38, + (30, G["atom"]): 40, + (30, G["expr"]): 77, + (30, G["factor"]): 54, (33, G["atom"]): 40, (33, G["factor"]): 76, + (33, G["function-call"]): 38, + (37, G["atom"]): 40, (37, G["factor"]): 39, (37, G["function-call"]): 38, - (37, G["atom"]): 40, - (43, G["arith"]): 47, - (43, G["expr"]): 66, (43, G["expr-list"]): 64, + (43, G["atom"]): 40, (43, G["term"]): 59, + (43, G["function-call"]): 38, + (43, G["expr"]): 66, (43, G["comp"]): 46, + (43, G["arith"]): 47, (43, G["factor"]): 54, - (43, G["atom"]): 40, - (43, G["function-call"]): 38, + (44, G["factor"]): 54, + (44, G["comp"]): 46, + (44, G["expr"]): 45, (44, G["atom"]): 40, (44, G["term"]): 59, (44, G["arith"]): 47, (44, G["function-call"]): 38, - (44, G["factor"]): 54, - (44, G["comp"]): 46, - (44, G["expr"]): 45, - (48, G["function-call"]): 38, (48, G["atom"]): 40, - (48, G["term"]): 49, (48, G["factor"]): 54, + (48, G["term"]): 49, + (48, G["function-call"]): 38, (50, G["factor"]): 51, - (50, G["function-call"]): 38, (50, G["atom"]): 40, + (50, G["function-call"]): 38, + (52, G["atom"]): 40, (52, G["function-call"]): 38, (52, G["factor"]): 53, - (52, G["atom"]): 40, - (55, G["function-call"]): 38, - (55, G["term"]): 56, (55, G["atom"]): 40, (55, G["factor"]): 54, + (55, G["term"]): 56, + (55, G["function-call"]): 38, (57, G["term"]): 59, (57, G["atom"]): 40, (57, G["arith"]): 58, @@ -1227,104 +1227,104 @@ def __goto_table(): (62, G["arith"]): 63, (62, G["function-call"]): 38, (62, G["factor"]): 54, - (67, G["arith"]): 47, - (67, G["expr"]): 66, + (67, G["atom"]): 40, (67, G["term"]): 59, + (67, G["function-call"]): 38, + (67, G["expr"]): 66, (67, G["comp"]): 46, - (67, G["factor"]): 54, + (67, G["arith"]): 47, (67, G["expr-list"]): 68, - (67, G["atom"]): 40, - (67, G["function-call"]): 38, - (73, G["arith"]): 47, - (73, G["expr"]): 66, + (67, G["factor"]): 54, + (73, G["atom"]): 40, (73, G["term"]): 59, + (73, G["function-call"]): 38, + (73, G["expr"]): 66, (73, G["comp"]): 46, - (73, G["factor"]): 54, + (73, G["arith"]): 47, (73, G["expr-list"]): 74, - (73, G["atom"]): 40, - (73, G["function-call"]): 38, + (73, G["factor"]): 54, (78, G["case-list"]): 86, - (82, G["expr"]): 83, - (82, G["atom"]): 40, + (82, G["function-call"]): 38, (82, G["arith"]): 47, + (82, G["atom"]): 40, (82, G["term"]): 59, + (82, G["expr"]): 83, (82, G["factor"]): 54, - (82, G["function-call"]): 38, (82, G["comp"]): 46, (84, G["case-list"]): 85, (89, G["declaration-list"]): 90, + (92, G["factor"]): 54, + (92, G["comp"]): 46, (92, G["atom"]): 40, (92, G["term"]): 59, (92, G["arith"]): 47, (92, G["function-call"]): 38, (92, G["expr"]): 93, - (92, G["factor"]): 54, - (92, G["comp"]): 46, + (95, G["atom"]): 40, + (95, G["comp"]): 46, (95, G["arith"]): 47, - (95, G["term"]): 59, - (95, G["factor"]): 54, (95, G["expr"]): 96, - (95, G["comp"]): 46, - (95, G["atom"]): 40, + (95, G["factor"]): 54, + (95, G["term"]): 59, (95, G["function-call"]): 38, - (99, G["atom"]): 40, (99, G["arith"]): 47, (99, G["term"]): 59, - (99, G["expr"]): 100, - (99, G["function-call"]): 38, + (99, G["atom"]): 40, (99, G["comp"]): 46, (99, G["factor"]): 54, + (99, G["expr"]): 100, + (99, G["function-call"]): 38, + (101, G["arith"]): 47, (101, G["term"]): 59, - (101, G["function-call"]): 38, (101, G["comp"]): 46, - (101, G["arith"]): 47, (101, G["factor"]): 54, - (101, G["atom"]): 40, + (101, G["function-call"]): 38, (101, G["expr"]): 102, - (109, G["atom"]): 40, + (101, G["atom"]): 40, + (109, G["function-call"]): 38, (109, G["arith"]): 47, - (109, G["block"]): 110, - (109, G["expr"]): 108, + (109, G["atom"]): 40, (109, G["term"]): 59, + (109, G["expr"]): 108, (109, G["factor"]): 54, - (109, G["function-call"]): 38, + (109, G["block"]): 110, (109, G["comp"]): 46, + (113, G["factor"]): 54, + (113, G["comp"]): 46, (113, G["atom"]): 40, (113, G["term"]): 59, (113, G["arith"]): 47, (113, G["expr"]): 114, (113, G["function-call"]): 38, - (113, G["factor"]): 54, - (113, G["comp"]): 46, - (121, G["term"]): 59, (121, G["arith"]): 47, - (121, G["factor"]): 54, - (121, G["atom"]): 40, - (121, G["function-call"]): 38, (121, G["comp"]): 46, (121, G["expr"]): 122, - (126, G["arith"]): 47, - (126, G["factor"]): 54, + (121, G["function-call"]): 38, + (121, G["atom"]): 40, + (121, G["factor"]): 54, + (121, G["term"]): 59, (126, G["term"]): 59, - (126, G["atom"]): 40, + (126, G["arith"]): 47, (126, G["function-call"]): 38, (126, G["comp"]): 46, + (126, G["atom"]): 40, + (126, G["factor"]): 54, (126, G["expr"]): 127, + (131, G["attribute"]): 130, (131, G["feature-list"]): 132, (131, G["method"]): 133, - (131, G["attribute"]): 130, - (134, G["method"]): 133, (134, G["attribute"]): 130, (134, G["feature-list"]): 135, - (136, G["method"]): 133, + (134, G["method"]): 133, (136, G["attribute"]): 130, (136, G["feature-list"]): 137, - (138, G["method"]): 133, + (136, G["method"]): 133, (138, G["attribute"]): 130, (138, G["feature-list"]): 139, + (138, G["method"]): 133, + (142, G["attribute"]): 130, (142, G["method"]): 133, (142, G["feature-list"]): 143, - (142, G["attribute"]): 130, (147, G["class-def"]): 147, (147, G["class-list"]): 148, } diff --git a/scope.py b/scope.py old mode 100644 new mode 100755 diff --git a/scripts/main.cl b/scripts/main.cl old mode 100644 new mode 100755 diff --git a/semantic.py b/semantic.py old mode 100644 new mode 100755 diff --git a/tester.py b/tester.py old mode 100644 new mode 100755 diff --git a/tests/lexer/comment1.cl b/tests/lexer/comment1.cl old mode 100644 new mode 100755 diff --git a/tests/lexer/comment1_error.txt b/tests/lexer/comment1_error.txt old mode 100644 new mode 100755 diff --git a/tests/lexer/iis1.cl b/tests/lexer/iis1.cl old mode 100644 new mode 100755 diff --git a/tests/lexer/iis1_error.txt b/tests/lexer/iis1_error.txt old mode 100644 new mode 100755 diff --git a/tests/lexer/iis2.cl b/tests/lexer/iis2.cl old mode 100644 new mode 100755 diff --git a/tests/lexer/iis2_error.txt b/tests/lexer/iis2_error.txt old mode 100644 new mode 100755 diff --git a/tests/lexer/iis3.cl b/tests/lexer/iis3.cl old mode 100644 new mode 100755 diff --git a/tests/lexer/iis3_error.txt b/tests/lexer/iis3_error.txt old mode 100644 new mode 100755 diff --git a/tests/lexer/iis4.cl b/tests/lexer/iis4.cl old mode 100644 new mode 100755 diff --git a/tests/lexer/iis4_error.txt b/tests/lexer/iis4_error.txt old mode 100644 new mode 100755 diff --git a/tests/lexer/iis5.cl b/tests/lexer/iis5.cl old mode 100644 new mode 100755 diff --git a/tests/lexer/iis5_error.txt b/tests/lexer/iis5_error.txt old mode 100644 new mode 100755 diff --git a/tests/lexer/iis6.cl b/tests/lexer/iis6.cl old mode 100644 new mode 100755 diff --git a/tests/lexer/iis6_error.txt b/tests/lexer/iis6_error.txt old mode 100644 new mode 100755 diff --git a/tests/lexer/mixed1.cl b/tests/lexer/mixed1.cl old mode 100644 new mode 100755 diff --git a/tests/lexer/mixed1_error.txt b/tests/lexer/mixed1_error.txt old mode 100644 new mode 100755 diff --git a/tests/lexer/mixed2.cl b/tests/lexer/mixed2.cl old mode 100644 new mode 100755 diff --git a/tests/lexer/mixed2_error.txt b/tests/lexer/mixed2_error.txt old mode 100644 new mode 100755 diff --git a/tests/lexer/string1.cl b/tests/lexer/string1.cl old mode 100644 new mode 100755 diff --git a/tests/lexer/string1_error.txt b/tests/lexer/string1_error.txt old mode 100644 new mode 100755 diff --git a/tests/lexer/string2.cl b/tests/lexer/string2.cl old mode 100644 new mode 100755 diff --git a/tests/lexer/string2_error.txt b/tests/lexer/string2_error.txt old mode 100644 new mode 100755 diff --git a/tests/lexer/string3.cl b/tests/lexer/string3.cl old mode 100644 new mode 100755 diff --git a/tests/lexer/string3_error.txt b/tests/lexer/string3_error.txt old mode 100644 new mode 100755 diff --git a/tests/lexer/string4.cl b/tests/lexer/string4.cl old mode 100644 new mode 100755 diff --git a/tests/lexer/string4_error.txt b/tests/lexer/string4_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/assignment1.cl b/tests/parser/assignment1.cl old mode 100644 new mode 100755 diff --git a/tests/parser/assignment1_error.txt b/tests/parser/assignment1_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/assignment2.cl b/tests/parser/assignment2.cl old mode 100644 new mode 100755 diff --git a/tests/parser/assignment2_error.txt b/tests/parser/assignment2_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/assignment3.cl b/tests/parser/assignment3.cl old mode 100644 new mode 100755 diff --git a/tests/parser/assignment3_error.txt b/tests/parser/assignment3_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/attribute1.cl b/tests/parser/attribute1.cl old mode 100644 new mode 100755 diff --git a/tests/parser/attribute1_error.txt b/tests/parser/attribute1_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/attribute2.cl b/tests/parser/attribute2.cl old mode 100644 new mode 100755 diff --git a/tests/parser/attribute2_error.txt b/tests/parser/attribute2_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/attribute3.cl b/tests/parser/attribute3.cl old mode 100644 new mode 100755 diff --git a/tests/parser/attribute3_error.txt b/tests/parser/attribute3_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/block1.cl b/tests/parser/block1.cl old mode 100644 new mode 100755 diff --git a/tests/parser/block1_error.txt b/tests/parser/block1_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/block2.cl b/tests/parser/block2.cl old mode 100644 new mode 100755 diff --git a/tests/parser/block2_error.txt b/tests/parser/block2_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/block3.cl b/tests/parser/block3.cl old mode 100644 new mode 100755 diff --git a/tests/parser/block3_error.txt b/tests/parser/block3_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/block4.cl b/tests/parser/block4.cl old mode 100644 new mode 100755 diff --git a/tests/parser/block4_error.txt b/tests/parser/block4_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/case1.cl b/tests/parser/case1.cl old mode 100644 new mode 100755 diff --git a/tests/parser/case1_error.txt b/tests/parser/case1_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/case2.cl b/tests/parser/case2.cl old mode 100644 new mode 100755 diff --git a/tests/parser/case2_error.txt b/tests/parser/case2_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/case3.cl b/tests/parser/case3.cl old mode 100644 new mode 100755 diff --git a/tests/parser/case3_error.txt b/tests/parser/case3_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/case4.cl b/tests/parser/case4.cl old mode 100644 new mode 100755 diff --git a/tests/parser/case4_error.txt b/tests/parser/case4_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/case5.cl b/tests/parser/case5.cl old mode 100644 new mode 100755 diff --git a/tests/parser/case5_error.txt b/tests/parser/case5_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/case6.cl b/tests/parser/case6.cl old mode 100644 new mode 100755 diff --git a/tests/parser/case6_error.txt b/tests/parser/case6_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/class1.cl b/tests/parser/class1.cl old mode 100644 new mode 100755 diff --git a/tests/parser/class1_error.txt b/tests/parser/class1_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/class2.cl b/tests/parser/class2.cl old mode 100644 new mode 100755 diff --git a/tests/parser/class2_error.txt b/tests/parser/class2_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/class3.cl b/tests/parser/class3.cl old mode 100644 new mode 100755 diff --git a/tests/parser/class3_error.txt b/tests/parser/class3_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/class4.cl b/tests/parser/class4.cl old mode 100644 new mode 100755 diff --git a/tests/parser/class4_error.txt b/tests/parser/class4_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/class5.cl b/tests/parser/class5.cl old mode 100644 new mode 100755 diff --git a/tests/parser/class5_error.txt b/tests/parser/class5_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/class6.cl b/tests/parser/class6.cl old mode 100644 new mode 100755 diff --git a/tests/parser/class6_error.txt b/tests/parser/class6_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/conditional1.cl b/tests/parser/conditional1.cl old mode 100644 new mode 100755 diff --git a/tests/parser/conditional1_error.txt b/tests/parser/conditional1_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/conditional2.cl b/tests/parser/conditional2.cl old mode 100644 new mode 100755 diff --git a/tests/parser/conditional2_error.txt b/tests/parser/conditional2_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/conditional3.cl b/tests/parser/conditional3.cl old mode 100644 new mode 100755 diff --git a/tests/parser/conditional3_error.txt b/tests/parser/conditional3_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/conditional4.cl b/tests/parser/conditional4.cl old mode 100644 new mode 100755 diff --git a/tests/parser/conditional4_error.txt b/tests/parser/conditional4_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/conditional5.cl b/tests/parser/conditional5.cl old mode 100644 new mode 100755 diff --git a/tests/parser/conditional5_error.txt b/tests/parser/conditional5_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/conditional6.cl b/tests/parser/conditional6.cl old mode 100644 new mode 100755 diff --git a/tests/parser/conditional6_error.txt b/tests/parser/conditional6_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch1.cl b/tests/parser/dispatch1.cl old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch1_error.txt b/tests/parser/dispatch1_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch2.cl b/tests/parser/dispatch2.cl old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch2_error.txt b/tests/parser/dispatch2_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch3.cl b/tests/parser/dispatch3.cl old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch3_error.txt b/tests/parser/dispatch3_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch4.cl b/tests/parser/dispatch4.cl old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch4_error.txt b/tests/parser/dispatch4_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch5.cl b/tests/parser/dispatch5.cl old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch5_error.txt b/tests/parser/dispatch5_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch6.cl b/tests/parser/dispatch6.cl old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch6_error.txt b/tests/parser/dispatch6_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch7.cl b/tests/parser/dispatch7.cl old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch7_error.txt b/tests/parser/dispatch7_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch8.cl b/tests/parser/dispatch8.cl old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch8_error.txt b/tests/parser/dispatch8_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch9.cl b/tests/parser/dispatch9.cl old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch9_error.txt b/tests/parser/dispatch9_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/let1.cl b/tests/parser/let1.cl old mode 100644 new mode 100755 diff --git a/tests/parser/let1_error.txt b/tests/parser/let1_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/let2.cl b/tests/parser/let2.cl old mode 100644 new mode 100755 diff --git a/tests/parser/let2_error.txt b/tests/parser/let2_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/let3.cl b/tests/parser/let3.cl old mode 100644 new mode 100755 diff --git a/tests/parser/let3_error.txt b/tests/parser/let3_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/let4.cl b/tests/parser/let4.cl old mode 100644 new mode 100755 diff --git a/tests/parser/let4_error.txt b/tests/parser/let4_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/let5.cl b/tests/parser/let5.cl old mode 100644 new mode 100755 diff --git a/tests/parser/let5_error.txt b/tests/parser/let5_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/let6.cl b/tests/parser/let6.cl old mode 100644 new mode 100755 diff --git a/tests/parser/let6_error.txt b/tests/parser/let6_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/let7.cl b/tests/parser/let7.cl old mode 100644 new mode 100755 diff --git a/tests/parser/let7_error.txt b/tests/parser/let7_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/loop1.cl b/tests/parser/loop1.cl old mode 100644 new mode 100755 diff --git a/tests/parser/loop1_error.txt b/tests/parser/loop1_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/loop2.cl b/tests/parser/loop2.cl old mode 100644 new mode 100755 diff --git a/tests/parser/loop2_error.txt b/tests/parser/loop2_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/loop3.cl b/tests/parser/loop3.cl old mode 100644 new mode 100755 diff --git a/tests/parser/loop3_error.txt b/tests/parser/loop3_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/loop4.cl b/tests/parser/loop4.cl old mode 100644 new mode 100755 diff --git a/tests/parser/loop4_error.txt b/tests/parser/loop4_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/method1.cl b/tests/parser/method1.cl old mode 100644 new mode 100755 diff --git a/tests/parser/method1_error.txt b/tests/parser/method1_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/method2.cl b/tests/parser/method2.cl old mode 100644 new mode 100755 diff --git a/tests/parser/method2_error.txt b/tests/parser/method2_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/method3.cl b/tests/parser/method3.cl old mode 100644 new mode 100755 diff --git a/tests/parser/method3_error.txt b/tests/parser/method3_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/method4.cl b/tests/parser/method4.cl old mode 100644 new mode 100755 diff --git a/tests/parser/method4_error.txt b/tests/parser/method4_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/method5.cl b/tests/parser/method5.cl old mode 100644 new mode 100755 diff --git a/tests/parser/method5_error.txt b/tests/parser/method5_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/method6.cl b/tests/parser/method6.cl old mode 100644 new mode 100755 diff --git a/tests/parser/method6_error.txt b/tests/parser/method6_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/mixed1.cl b/tests/parser/mixed1.cl old mode 100644 new mode 100755 diff --git a/tests/parser/mixed1_error.txt b/tests/parser/mixed1_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/mixed2.cl b/tests/parser/mixed2.cl old mode 100644 new mode 100755 diff --git a/tests/parser/mixed2_error.txt b/tests/parser/mixed2_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/mixed3.cl b/tests/parser/mixed3.cl old mode 100644 new mode 100755 diff --git a/tests/parser/mixed3_error.txt b/tests/parser/mixed3_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/mixed4.cl b/tests/parser/mixed4.cl old mode 100644 new mode 100755 diff --git a/tests/parser/mixed4_error.txt b/tests/parser/mixed4_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/mixed5.cl b/tests/parser/mixed5.cl old mode 100644 new mode 100755 diff --git a/tests/parser/mixed5_error.txt b/tests/parser/mixed5_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/mixed6.cl b/tests/parser/mixed6.cl old mode 100644 new mode 100755 diff --git a/tests/parser/mixed6_error.txt b/tests/parser/mixed6_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/operation1.cl b/tests/parser/operation1.cl old mode 100644 new mode 100755 diff --git a/tests/parser/operation1_error.txt b/tests/parser/operation1_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/operation2.cl b/tests/parser/operation2.cl old mode 100644 new mode 100755 diff --git a/tests/parser/operation2_error.txt b/tests/parser/operation2_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/operation3.cl b/tests/parser/operation3.cl old mode 100644 new mode 100755 diff --git a/tests/parser/operation3_error.txt b/tests/parser/operation3_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/operation4.cl b/tests/parser/operation4.cl old mode 100644 new mode 100755 diff --git a/tests/parser/operation4_error.txt b/tests/parser/operation4_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/program1.cl b/tests/parser/program1.cl old mode 100644 new mode 100755 diff --git a/tests/parser/program1_error.txt b/tests/parser/program1_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/program2.cl b/tests/parser/program2.cl old mode 100644 new mode 100755 diff --git a/tests/parser/program2_error.txt b/tests/parser/program2_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/program3.cl b/tests/parser/program3.cl old mode 100644 new mode 100755 diff --git a/tests/parser/program3_error.txt b/tests/parser/program3_error.txt old mode 100644 new mode 100755 From 7a69abf50e521e0f49145ba81eae5e5897926156 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Wed, 29 Apr 2020 10:44:44 -0400 Subject: [PATCH 027/143] Added basic COOL Types --- astnodes.py | 2 +- cmp/recovery.py | 2 - grammar.py | 6 +- main.py | 2 +- scope.py | 56 ++- semantic.py | 43 ++- temp/Fixing_Self_Type.py | 56 +++ temp/main.py | 51 +++ temp/semantic.py | 749 +++++++++++++++++++++++++++++++++++++++ 9 files changed, 949 insertions(+), 18 deletions(-) delete mode 100755 cmp/recovery.py create mode 100644 temp/Fixing_Self_Type.py create mode 100644 temp/main.py create mode 100644 temp/semantic.py diff --git a/astnodes.py b/astnodes.py index f550427e8..0d5999aa0 100755 --- a/astnodes.py +++ b/astnodes.py @@ -164,7 +164,7 @@ class DivNode(BinaryNode): pass -class LessNode(BinaryNode): +class LessThanNode(BinaryNode): pass diff --git a/cmp/recovery.py b/cmp/recovery.py deleted file mode 100755 index 5f76bc4b3..000000000 --- a/cmp/recovery.py +++ /dev/null @@ -1,2 +0,0 @@ -class PanicModeRecovery: - pass diff --git a/grammar.py b/grammar.py index 218639dff..1d7d61eba 100755 --- a/grammar.py +++ b/grammar.py @@ -147,7 +147,7 @@ def lexical_error(lexer): expr %= 'not expr', lambda s: ast.NegationNode(s[2]) expr %= 'comp', lambda s: s[1] -comp %= 'arith < arith', lambda s: ast.LessNode(s[1], s[3]) +comp %= 'arith < arith', lambda s: ast.LessThanNode(s[1], s[3]) comp %= 'arith <= arith', lambda s: ast.LessEqualNode(s[1], s[3]) comp %= 'arith = arith', lambda s: ast.EqualNode(s[1], s[3]) comp %= 'arith', lambda s: s[1] @@ -197,13 +197,13 @@ def lexical_error(lexer): G.add_terminal_error() -@G.production("feature-list -> attribute error feature-list") +@G.production("feature-list -> attribute error feature-list") def attribute_error(s): s.error(f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") return ast.AttrDeclarationNode(s[1], s[3]) -@G.production("feature-list -> method error feature-list") +@G.production("feature-list -> method error feature-list") def attribute_error(s): s.error(f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") return s[1] diff --git a/main.py b/main.py index fd0c054dc..9059c69d2 100755 --- a/main.py +++ b/main.py @@ -8,7 +8,7 @@ class Main inherits IO { main(): IO { out_string("Hello, World.\n") }; -}; +} """ lexer = CoolLexer() diff --git a/scope.py b/scope.py index f9050f0a4..363adc2be 100755 --- a/scope.py +++ b/scope.py @@ -40,8 +40,8 @@ def __eq__(self, other): class Type: def __init__(self, name: str): self.name: str = name - self.attributes: Dict[str, Attribute] = [] - self.methods: Dict[str, Method] = [] + self.attributes: Dict[str, Attribute] = {} + self.methods: Dict[str, Method] = {} self.parent: Optional['Type'] = None def set_parent(self, parent: 'Type') -> None: @@ -51,7 +51,7 @@ def set_parent(self, parent: 'Type') -> None: def get_attribute(self, name: str) -> Attribute: try: - return self.methods[name] + return self.attributes[name] except KeyError: if self.parent is None: raise SemanticError(f'Attribute "{name}" is not defined in {self.name}.') @@ -143,12 +143,60 @@ def __eq__(self, other): class IntType(Type): def __init__(self): - super().__init__('int') + super().__init__('Int') def __eq__(self, other): return other.name == self.name or isinstance(other, IntType) +class StringType(Type): + def __init__(self): + super().__init__('String') + + def __eq__(self, other): + return other.name == self.name or isinstance(other, StringType) + + +class ObjectType(Type): + def __init__(self): + super().__init__('Object') + + def __eq__(self, other): + return other.name == self.name or isinstance(other, ObjectType) + + +class IOType(Type): + def __init__(self): + super().__init__('IO') + + def __eq__(self, other): + return other.name == self.name or isinstance(other, IOType) + + +class BoolType(Type): + def __init__(self): + super().__init__('Bool') + + def __eq__(self, other): + return other.name == self.name or isinstance(other, BoolType) + + +class SelfType(Type): + def __init__(self): + super().__init__('SELF_TYPE') + + def __eq__(self, other): + return other.name == self.name or isinstance(other, SelfType) + + +class AutoType(Type): + def __init__(self): + super(AutoType, self).__init__('AUTO_TYPE') + + def __eq__(self, other): + return other.name == self.name or isinstance(other, AutoType) + + class Context: def __init__(self): self.types: Dict[str, Type] = {} diff --git a/semantic.py b/semantic.py index b0dd0611e..48aa54a2d 100755 --- a/semantic.py +++ b/semantic.py @@ -1,7 +1,7 @@ """This module contains definitions of classes for make different travels through the AST of a cool program. All classes defined here follows the visitor pattern using the module cmp.visitor, with this we can get a more decoupled inspection. """ -from typing import List, Optional +from typing import List, Optional, Dict import astnodes as ast import visitor as visitor @@ -33,6 +33,25 @@ """ +def topological_order(context: Context): + types = context.types + + graph: Dict[str, List[str]] = {} + + for name, typex in types.items(): + if name == 'Object': + continue + + parent = typex.parent + if parent is None: + pass + + try: + graph[parent.name].append(name) + except KeyError: + graph[parent.name] = [] + + class Formatter: @visitor.on('node') def visit(self, node, tabs): @@ -152,6 +171,16 @@ def visit(self, node: ast.InstantiateNode, tabs: int = 0): class TypeCollector: + """Visitor to collect the class in the program, and the basic classes as Object, Int, String, IO and Bool + + Params + ---------- + errors: List[str] + is a list of errors detected in the ast travel + context: Context + the context for keeping the classes + """ + def __init__(self, context: Context = Context(), errors: List[str] = []): self.errors: List[str] = errors self.context: Context = context @@ -364,8 +393,8 @@ def visit(self, node: ast.DivNode, scope: Scope): def visit(self, node: ast.LessEqualNode, scope: Scope): pass - @visitor.when(ast.LessNode) - def visit(self, node: ast.LessNode, scope: Scope): + @visitor.when(ast.LessThanNode) + def visit(self, node: ast.LessThanNode, scope: Scope): pass @visitor.when(ast.EqualNode) @@ -488,8 +517,8 @@ def visit(self, node: ast.DivNode, scope: Scope): def visit(self, node: ast.LessEqualNode, scope: Scope): pass - @visitor.when(ast.LessNode) - def visit(self, node: ast.LessNode, scope: Scope): + @visitor.when(ast.LessThanNode) + def visit(self, node: ast.LessThanNode, scope: Scope): pass @visitor.when(ast.EqualNode) @@ -612,8 +641,8 @@ def visit(self, node: ast.DivNode, scope: Scope): def visit(self, node: ast.LessEqualNode, scope: Scope): pass - @visitor.when(ast.LessNode) - def visit(self, node: ast.LessNode, scope: Scope): + @visitor.when(ast.LessThanNode) + def visit(self, node: ast.LessThanNode, scope: Scope): pass @visitor.when(ast.EqualNode) diff --git a/temp/Fixing_Self_Type.py b/temp/Fixing_Self_Type.py new file mode 100644 index 000000000..0d5729711 --- /dev/null +++ b/temp/Fixing_Self_Type.py @@ -0,0 +1,56 @@ +from scope import Context + + +def fix_self_type(context: Context, errors=[]): + types = [a[1] for a in context.types.items()] + ts = [] + visited = set() + for v in types: + if v not in visited: + visit(v, ts, visited) + # Checking circular dependencies in the topological sort + visited = set() + for v in ts: + if v.parent is not None and v.parent not in visited: + errors.append(f'Not valid parent for class "{v.name}".') + visited.add(v) + # Setting all self_type methods and attributes + self_type = context.get_type('SELF_TYPE') + self_typed_methods = {t: [] for t in types} + self_typed_attributes = {t: [] for t in types} + for t in ts: + for att in t.attributes: + if att.type == self_type: + self_typed_attributes[t].append(att) + for func in t.methods: + if func.return_type == self_type: + self_typed_methods[t].append(func) + else: + for item2 in func.param_types: + if item2 == self_type: + self_typed_attributes[t].append(func) + break + if t.parent is not None: + for item in self_typed_methods[t.parent]: + t.define_method(item.name, item.param_names, item.param_types, item.return_type) + for item in self_typed_attributes[t.parent]: + t.define_attribute(item.name, item.type) + # replacing self_type + for t in ts: + for method in t.methods: + for i, item2 in enumerate(method.param_types): + if item2 == self_type: + method.param_types[i] = t + if method.return_type == self_type: + method.return_type = t + for att in t.attributes: + if att.type == self_type: + att.type = t + + +def visit(v, ts, visited): + visited.add(v) + if v.parent is not None and v.parent not in visited: + visit(v.parent, ts, visited) + ts.append(v) + diff --git a/temp/main.py b/temp/main.py new file mode 100644 index 000000000..f3b88d766 --- /dev/null +++ b/temp/main.py @@ -0,0 +1,51 @@ +from lexer import CoolLexer +from parser import CoolParser +from scope import Context +from semantic import TypeCollector, TypeBuilder, TypeChecker, InferenceTypeChecker, Executor +from Fixing_Self_Type import * + +program = """ +class Main { + main ( msg : String ) : Object { + let a: Int <- 25, b: Int <- 15 in { + a <- a + 1; + } + }; + testing6(a: Int): IO { + let count: Int <- 1, pow: Int <- 1 + in { + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de a es algo"); + } + }; +} +""" + +lexer = CoolLexer() +parser = CoolParser() + +if __name__ == '__main__': + tokens = lexer(program) + ast = parser(tokens) + + context = Context() + errors = [] + + TypeCollector(context, errors).visit(ast) + TypeBuilder(context, errors).visit(ast) + fix_self_type(context, errors) + scope = TypeChecker(context, errors).visit(ast) + InferenceTypeChecker(context, errors).visit(ast, scope) + Executor(context, errors).visit(ast, scope) + + for error in errors: + print(error) + print("Done!") diff --git a/temp/semantic.py b/temp/semantic.py new file mode 100644 index 000000000..21900b294 --- /dev/null +++ b/temp/semantic.py @@ -0,0 +1,749 @@ +"""This module contains definitions of classes for make different travels through the AST of a cool program. All +classes defined here follows the visitor pattern using the module cmp.visitor, with this we can get a more decoupled +inspection. """ +from typing import List, Optional + +import astnodes as ast +import visitor as visitor + +from scope import Context, SemanticError, Type, Scope, Method, AutoType, IntType, BoolType, StringType, ErrorType, \ + SelfType + +""" +Object + abort() : Object + type_name() : String + copy() : SELF_TYPE + +IO + out_string(x : String) : SELF_TYPE + out_int(x : Int) : SELF_TYPE + in_string() : String + in_int() : Int + +Int (Sealed) + default -> 0 + +Bool (Sealed) + default -> False + +String + length() : Int + concat(s : String) : String + substr(i : Int, l : Int) : String +""" +WRONG_SIGNATURE = 'Method "%s" already defined in "%s" with a different signature.' +SELF_IS_READONLY = 'Variable "self" is read-only.' +LOCAL_ALREADY_DEFINED = 'Variable "%s" is already defined in method "%s".' +INCOMPATIBLE_TYPES = 'Cannot convert "%s" into "%s".' +VARIABLE_NOT_DEFINED = 'Variable "%s" is not defined in "%s".' +INVALID_BINARY_OPERATION = 'Operation "%s" is not defined between "%s" and "%s".' +INVALID_UNARY_OPERATION = 'Operation "%s" is not defined for "%s".' + + +class Formatter: + @visitor.on('node') + def visit(self, node, tabs): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode, tabs: int = 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(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode, tabs: int = 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(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode, tabs: int = 0): + ans = '\t' * tabs + f'\\__AttrDeclarationNode: {node.id} : {node.type}' + return f'{ans}' + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode, tabs: int = 0): + params = ', '.join(':'.join(param) for param in node.params) + ans = '\t' * tabs + f'\\__FuncDeclarationNode: {node.id}({params}) : {node.type} -> ' + body = self.visit(node.body, tabs + 1) + return f'{ans}\n{body}' + + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode, tabs: int = 0): + declarations = '\n'.join(self.visit(declaration, tabs + 1) for declaration in node.declarations) + ans = '\t' * tabs + f'\\__LetNode: let' + expr = self.visit(node.expr, tabs + 2) + return f'{ans}\n {declarations}\n' + '\t' * (tabs + 1) + 'in\n' + f'{expr}' + + @visitor.when(ast.VarDeclarationNode) + def visit(self, node: ast.VarDeclarationNode, tabs: int = 0): + if node.expr is not None: + return '\t' * tabs + f'\\__VarDeclarationNode: {node.id}: {node.type} <-\n{self.visit(node.expr, tabs + 1)}' + else: + return '\t' * tabs + f'\\__VarDeclarationNode: {node.id} : {node.type}' + + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode, tabs: int = 0): + ans = '\t' * tabs + f'\\__AssignNode: {node.id} <- ' + expr = self.visit(node.expr, tabs + 1) + return f'{ans}\n{expr}' + + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode, tabs: int = 0): + ans = '\t' * tabs + f'\\__BlockNode:' + body = '\n'.join(self.visit(child, tabs + 1) for child in node.expressions) + return f'{ans}\n{body}' + + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode, tabs: int = 0): + ifx = self.visit(node.if_expr, tabs + 2) + then = self.visit(node.then_expr, tabs + 2) + elsex = self.visit(node.else_expr, tabs + 2) + + return '\n'.join([ + '\t' * tabs + f'\\__IfThenElseNode: if then else fi', + '\t' * (tabs + 1) + f'\\__if \n{ifx}', + '\t' * (tabs + 1) + f'\\__then \n{then}', + '\t' * (tabs + 1) + f'\\__else \n{elsex}', + ]) + + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode, tabs: int = 0): + condition = self.visit(node.condition, tabs + 2) + body = self.visit(node.body, tabs + 2) + + return '\n'.join([ + '\t' * tabs + f'\\__WhileNode: while loop pool', + '\t' * (tabs + 1) + f'\\__while \n{condition}', + '\t' * (tabs + 1) + f'\\__loop \n{body}', + ]) + + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode, tabs: int = 0): + expr = self.visit(node.expr, tabs + 2) + cases = '\n'.join(self.visit(case, tabs + 3) for case in node.cases) + + return '\n'.join([ + '\t' * tabs + f'\\__SwitchCaseNode: case of [ ... ] esac', + '\t' * (tabs + 1) + f'\\__case \n{expr} of', + ]) + '\n' + cases + + @visitor.when(ast.CaseNode) + def visit(self, node: ast.CaseNode, tabs: int = 0): + expr = self.visit(node.expr, tabs + 1) + return '\t' * tabs + f'\\__CaseNode: {node.id} : {node.type} =>\n{expr}' + + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode, tabs: int = 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(ast.BinaryNode) + def visit(self, node: ast.BinaryNode, tabs: int = 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(ast.AtomicNode) + def visit(self, node: ast.AtomicNode, tabs: int = 0): + return '\t' * tabs + f'\\__ {node.__class__.__name__}: {node.lex}' + + @visitor.when(ast.InstantiateNode) + def visit(self, node: ast.InstantiateNode, tabs: int = 0): + return '\t' * tabs + f'\\__ InstantiateNode: new {node.lex}()' + + +class TypeCollector: + def __init__(self, context: Context = Context(), errors: List[str] = []): + self.errors: List[str] = errors + self.context: Context = context + + @visitor.on('node') + def visit(self, node): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node): + self_type = self.context.create_type('SELF_TYPE') + self.context.types['AUTO_TYPE'] = AutoType() + object_type = self.context.create_type('Object') + io_type = self.context.create_type('IO') + string_type = self.context.create_type('String') + int_type = self.context.create_type('Int') + bool_type = self.context.create_type('Bool') + + io_type.parent = object_type + string_type.parent = object_type + int_type.parent = object_type + bool_type.parent = object_type + + object_type.define_method('abort', ['self'], [object_type], object_type) + object_type.define_method('get_type', ['self'], [object_type], string_type) + object_type.define_method('copy', ['self'], [object_type], self_type) + + io_type.define_method('out_string', ['self', 'x'], [io_type, string_type], self_type) + io_type.define_method('out_int', ['self', 'x'], [io_type, int_type], self_type) + io_type.define_method('in_string', ['self'], [io_type], string_type) + io_type.define_method('in_int', ['self'], [io_type], int_type) + + string_type.define_method('length', ['self'], [string_type], int_type) + string_type.define_method('concat', ['self', 's'], [string_type, string_type], string_type) + string_type.define_method('substr', ['self', 'i', 'l'], [string_type, int_type, int_type], string_type) + + for declaration in node.declarations: + self.visit(declaration) + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node): + try: + self.context.create_type(node.id) + except SemanticError as e: + self.errors.append(e.text) + + +class TypeBuilder: + def __init__(self, context: Context, errors: List[str] = []): + self.context: Context = context + self.current_type: Optional[Type] = None + self.errors: List[str] = errors + + @visitor.on('node') + def visit(self, node): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode): + for declaration in node.declarations: + self.visit(declaration) + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode): + try: + self.current_type = self.context.get_type(node.id) + if node.parent is not None: + if node.parent in (IntType(), BoolType(), StringType()): + self.errors.append(f'Cannot inherit from type "{node.parent}"') + self.current_type.set_parent(self.context.get_type(node.parent)) + else: + self.current_type.set_parent(self.context.get_type('Object')) + except SemanticError as e: + self.errors.append(e.text) + + for feature in node.features: + self.visit(feature) + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode): + try: + name = node.id + typex = self.context.get_type(node.type) + self.current_type.define_attribute(name, typex) + except SemanticError as e: + # Todo: Fix up Object Assignment (Most be error) + # self.current_type.define_attribute(node.id, self.context.get_type('Object')) + self.errors.append(e.text) + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode): + name = node.id + param_names = ['self'] + param_types = [self.current_type] + for name, typex in node.params: + param_names.append(name) + try: + param_types.append(self.context.get_type(name)) + except SemanticError as e: + # param_types.append(self.context.get_type('Object')) + self.errors.append(e.text) + try: + return_type = self.context.get_type(node.type) + self.current_type.define_method(name, param_names, param_types, return_type) + except SemanticError as e: + # self.current_type.define_method(name, param_names, param_types, self.context.get_type('Object')) + self.errors.append(e.text) + + +class TypeChecker: + def __init__(self, context: Context, errors: List[str] = []): + self.context: Context = context + self.errors: List[str] = errors + self.current_type: Type = None + self.current_method: Method = None + + @visitor.on('node') + def visit(self, node, tabs): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode, scope: Scope = None): + if scope is None: + scope = Scope() + + for elem in node.declarations: + self.visit(elem, scope) + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode, scope: Scope): + self.current_type = self.context.get_type(node.id) + for elem in node.features: + self.visit(elem, scope) + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode, scope: Scope): + expected_type = self.context.get_type(node.type) + if node.expr is not None: + typex = self.visit(node.expr, scope) + if not typex.conforms_to(expected_type): + self.errors.append(INCOMPATIBLE_TYPES % (node.type, expected_type.name)) + scope.define_variable(node.id, expected_type) + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode, scope: Scope): + self.current_method = self.current_type.get_method(node.id) + for i, param in enumerate(node.params): + if scope.is_local(param[0]): + self.errors.append(LOCAL_ALREADY_DEFINED % (param[0], self.current_method.name)) + else: + scope.define_variable(param[0], self.context.get_type(param[1])) + tipo = self.visit(node.body, scope.create_child()) + expected_type = self.context.get_type(node.type) + if not tipo.conforms_to(expected_type): + self.errors.append(INCOMPATIBLE_TYPES % (tipo.name, expected_type.name)) + + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode, scope: Scope): + for elem in node.declarations: + self.visit(elem, scope) + return self.visit(node.expr, scope) + + @visitor.when(ast.VarDeclarationNode) + def visit(self, node: ast.VarDeclarationNode, scope: Scope): + try: + expected_type = self.context.get_type(node.type) + if expected_type.name == 'SELF_TYPE': + expected_type = self.current_type + except SemanticError as e: + expected_type = self.context.get_type('Object') + self.errors.append(e.text) + if scope.is_local(node.id): + self.errors.append(LOCAL_ALREADY_DEFINED % (node.id, self.current_method.name)) + else: + scope.define_variable(node.id, expected_type) + if node.expr is not None: + tipo = self.visit(node.expr, scope) + if not (tipo.conforms_to(expected_type)): + self.errors.append(INCOMPATIBLE_TYPES % (tipo.name, expected_type.name)) + + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode, scope: Scope): + return_type = self.visit(node.expr, scope) + var = scope.find_variable(node.id) + if var is None: + self.errors.append(VARIABLE_NOT_DEFINED % (node.id, self.current_method.name)) + else: + if not return_type.conforms_to(var.type): + self.errors.append(INCOMPATIBLE_TYPES % (return_type.name, var.type.name)) + return var.type if var.type.name != 'SELF_TYPE' else self.current_type + + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode, scope: Scope): + return_type = ErrorType() + for inst in node.expressions: + return_type = self.visit(inst, scope) + return return_type + + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode, scope: Scope): + if_type = self.visit(node.if_expr, scope) + then_type = self.visit(node.then_expr, scope) + else_type = self.visit(node.else_expr, scope) + if if_type.name != 'Bool': + self.errors.append(INCOMPATIBLE_TYPES % (if_type.name, 'Bool')) + if then_type.conforms_to(else_type): + return then_type + if else_type.conforms_to(then_type): + return then_type + return self.context.get_type('Object') + + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode, scope: Scope): + condition = self.visit(node.condition, scope) + if condition.name != 'Bool': + self.errors.append(INCOMPATIBLE_TYPES % (condition.name, 'Bool')) + return self.visit(node.body, scope) + + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode, scope: Scope): + self.visit(node.expr, scope) + for item in node.cases: + self.visit(item, scope.create_child()) + return self.context.get_type('Object') + + @visitor.when(ast.CaseNode) + def visit(self, node: ast.CaseNode, scope: Scope): + try: + v = scope.define_variable(node.id, self.context.get_type(node.type)) + except SemanticError as e: + v = scope.define_variable(node.id, self.context.get_type('Object')) + self.errors.append(e.text) + self.visit(node.expr, scope) + return v.type if v.type.name != 'SELF_TYPE' else self.current_type + + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode, scope: Scope): + typex = self.visit(node.obj, scope) + try: + method = typex.get_method(node.id) + except SemanticError: + self.errors.append(f'Method "{node.id}" is not defined in {node.type}.') + method = None + if method is not None and len(node.args) + 1 != len(method.param_names): + self.errors.append(WRONG_SIGNATURE % (method.name, typex.name)) + for i, var in enumerate(node.args): + var_type = self.visit(var, scope) + if method is not None: + expected_return_type = method.param_types[i + 1] + if not var_type.conforms_to(expected_return_type): + self.errors.append(INCOMPATIBLE_TYPES % (var_type.name, expected_return_type.name)) + return self.context.get_type('Object') if method is None else method.return_type + + @visitor.when(ast.IntegerNode) + def visit(self, node: ast.IntegerNode, scope: Scope): + return IntType() + + @visitor.when(ast.StringNode) + def visit(self, node: ast.StringNode, scope: Scope): + return StringType() + + @visitor.when(ast.BooleanNode) + def visit(self, node: ast.BooleanNode, scope: Scope): + return BoolType() + + @visitor.when(ast.VariableNode) + def visit(self, node: ast.VariableNode, scope: Scope): + var = scope.find_variable(node.lex) + if var is None: + var = self.context.get_type('Object') + self.errors.append(VARIABLE_NOT_DEFINED % (node.lex, self.current_method.name)) + return var.type if var.name != 'SELF_TYPE' else self.current_type + + @visitor.when(ast.InstantiateNode) + def visit(self, node: ast.InstantiateNode, scope: Scope): + try: + return self.context.get_type(node.lex) + except SemanticError as e: + self.errors.append(e.text) + return ErrorType() + + @visitor.when(ast.NegationNode) + def visit(self, node: ast.NegationNode, scope: Scope): + return self._check_unary_operation(node, scope, 'not', BoolType()) + + @visitor.when(ast.ComplementNode) + def visit(self, node: ast.ComplementNode, scope: Scope): + return self._check_unary_operation(node, scope, '~', IntType()) + + @visitor.when(ast.IsVoidNode) + def visit(self, node: ast.IsVoidNode, scope: Scope): + self.visit(node.obj, scope) + return BoolType() + + @visitor.when(ast.PlusNode) + def visit(self, node: ast.PlusNode, scope: Scope): + return self._check_int_binary_operation(node, scope, '+', IntType()) + + @visitor.when(ast.MinusNode) + def visit(self, node: ast.MinusNode, scope: Scope): + return self._check_int_binary_operation(node, scope, '-', IntType()) + + @visitor.when(ast.StarNode) + def visit(self, node: ast.StarNode, scope: Scope): + return self._check_int_binary_operation(node, scope, '*', IntType()) + + @visitor.when(ast.DivNode) + def visit(self, node: ast.DivNode, scope: Scope): + return self._check_int_binary_operation(node, scope, '/', IntType()) + + @visitor.when(ast.LessEqualNode) + def visit(self, node: ast.LessEqualNode, scope: Scope): + return self._check_int_binary_operation(node, scope, '<=', BoolType()) + + @visitor.when(ast.LessThanNode) + def visit(self, node: ast.LessThanNode, scope: Scope): + return self._check_int_binary_operation(node, scope, '<', BoolType()) + + @visitor.when(ast.EqualNode) + def visit(self, node: ast.EqualNode, scope: Scope): + self.visit(node.left, scope) + self.visit(node.right, scope) + return BoolType() + + def _check_int_binary_operation(self, node: ast.BinaryNode, scope: Scope, operation: str, return_type: Type): + left_type = self.visit(node.left, scope) + right_type = self.visit(node.right, scope) + + if left_type == right_type == IntType(): + return return_type + self.errors.append(INVALID_BINARY_OPERATION % (operation, left_type.name, right_type.name)) + return ErrorType() + + def _check_unary_operation(self, node: ast.UnaryNode, scope: Scope, operation: str, expected_type: Type): + typex = self.visit(node.obj, scope) + if typex == expected_type: + return typex + self.errors.append(INVALID_UNARY_OPERATION % (operation, typex.name)) + return ErrorType() + + +class InferenceTypeChecker: + def __init__(self, context: Context, errors: List[str] = []): + self.context: Context = context + self.errors: List[str] = errors + self.current_type: Type = None + self.current_method: Method = None + + @visitor.on('node') + def visit(self, node, tabs): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode, scope: Scope = None): + pass + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode, scope: Scope): + pass + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode, scope: Scope): + pass + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode, scope: Scope): + pass + + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode, scope: Scope): + pass + + @visitor.when(ast.VarDeclarationNode) + def visit(self, node: ast.VarDeclarationNode, scope: Scope): + pass + + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode, scope: Scope): + pass + + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode, scope: Scope): + pass + + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode, scope: Scope): + pass + + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode, scope: Scope): + pass + + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode, scope: Scope): + pass + + @visitor.when(ast.CaseNode) + def visit(self, node: ast.CaseNode, scope: Scope): + pass + + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode, scope: Scope): + pass + + @visitor.when(ast.IntegerNode) + def visit(self, node: ast.IntegerNode, scope: Scope): + pass + + @visitor.when(ast.StringNode) + def visit(self, node: ast.StringNode, scope: Scope): + pass + + @visitor.when(ast.BooleanNode) + def visit(self, node: ast.BooleanNode, scope: Scope): + pass + + @visitor.when(ast.VariableNode) + def visit(self, node: ast.VariableNode, scope: Scope): + pass + + @visitor.when(ast.InstantiateNode) + def visit(self, node: ast.InstantiateNode, scope: Scope): + pass + + @visitor.when(ast.NegationNode) + def visit(self, node: ast.NegationNode, scope: Scope): + pass + + @visitor.when(ast.ComplementNode) + def visit(self, node: ast.ComplementNode, scope: Scope): + pass + + @visitor.when(ast.IsVoidNode) + def visit(self, node: ast.IsVoidNode, scope: Scope): + pass + + @visitor.when(ast.PlusNode) + def visit(self, node: ast.PlusNode, scope: Scope): + pass + + @visitor.when(ast.MinusNode) + def visit(self, node: ast.MinusNode, scope: Scope): + pass + + @visitor.when(ast.StarNode) + def visit(self, node: ast.StarNode, scope: Scope): + pass + + @visitor.when(ast.DivNode) + def visit(self, node: ast.DivNode, scope: Scope): + pass + + @visitor.when(ast.LessEqualNode) + def visit(self, node: ast.LessEqualNode, scope: Scope): + pass + + @visitor.when(ast.LessThanNode) + def visit(self, node: ast.LessThanNode, scope: Scope): + pass + + @visitor.when(ast.EqualNode) + def visit(self, node: ast.EqualNode, scope: Scope): + pass + + +class Executor: + def __init__(self, context: Context, errors: List[str] = []): + self.context: Context = context + self.errors: List[str] = errors + self.current_type: Type = None + self.current_method: Method = None + + @visitor.on('node') + def visit(self, node, tabs): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode, scope: Scope = None): + pass + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode, scope: Scope): + pass + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode, scope: Scope): + pass + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode, scope: Scope): + pass + + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode, scope: Scope): + pass + + @visitor.when(ast.VarDeclarationNode) + def visit(self, node: ast.VarDeclarationNode, scope: Scope): + pass + + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode, scope: Scope): + pass + + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode, scope: Scope): + pass + + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode, scope: Scope): + pass + + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode, scope: Scope): + pass + + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode, scope: Scope): + pass + + @visitor.when(ast.CaseNode) + def visit(self, node: ast.CaseNode, scope: Scope): + pass + + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode, scope: Scope): + pass + + @visitor.when(ast.IntegerNode) + def visit(self, node: ast.IntegerNode, scope: Scope): + pass + + @visitor.when(ast.StringNode) + def visit(self, node: ast.StringNode, scope: Scope): + pass + + @visitor.when(ast.BooleanNode) + def visit(self, node: ast.BooleanNode, scope: Scope): + pass + + @visitor.when(ast.VariableNode) + def visit(self, node: ast.VariableNode, scope: Scope): + pass + + @visitor.when(ast.InstantiateNode) + def visit(self, node: ast.InstantiateNode, scope: Scope): + pass + + @visitor.when(ast.NegationNode) + def visit(self, node: ast.NegationNode, scope: Scope): + pass + + @visitor.when(ast.ComplementNode) + def visit(self, node: ast.ComplementNode, scope: Scope): + pass + + @visitor.when(ast.IsVoidNode) + def visit(self, node: ast.IsVoidNode, scope: Scope): + pass + + @visitor.when(ast.PlusNode) + def visit(self, node: ast.PlusNode, scope: Scope): + pass + + @visitor.when(ast.MinusNode) + def visit(self, node: ast.MinusNode, scope: Scope): + pass + + @visitor.when(ast.StarNode) + def visit(self, node: ast.StarNode, scope: Scope): + pass + + @visitor.when(ast.DivNode) + def visit(self, node: ast.DivNode, scope: Scope): + pass + + @visitor.when(ast.LessEqualNode) + def visit(self, node: ast.LessEqualNode, scope: Scope): + pass + + @visitor.when(ast.LessThanNode) + def visit(self, node: ast.LessThanNode, scope: Scope): + pass + + @visitor.when(ast.EqualNode) + def visit(self, node: ast.EqualNode, scope: Scope): + pass From 57369a11fd4a6524e3e3fa002a39fffb43d8ffea Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Wed, 29 Apr 2020 22:12:25 -0400 Subject: [PATCH 028/143] Type chequer review --- scope.py | 3 +-- temp/semantic.py | 30 ++++++++++++++++++------------ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/scope.py b/scope.py index 363adc2be..6bebfd9ce 100755 --- a/scope.py +++ b/scope.py @@ -1,5 +1,5 @@ from collections import OrderedDict -from typing import List, Optional, Dict +from typing import List, Optional, Dict, Any class SemanticError(Exception): @@ -231,7 +231,6 @@ def __init__(self, parent: Optional['Scope'] = None): self.locals: Dict[str, VariableInfo] = {} self.parent: Optional['Scope'] = parent self.children: List[Scope] = [] - self.index: int = 0 if parent is None else len(parent) def create_child(self) -> 'Scope': child = Scope(self) diff --git a/temp/semantic.py b/temp/semantic.py index 21900b294..f5389cac3 100644 --- a/temp/semantic.py +++ b/temp/semantic.py @@ -4,7 +4,7 @@ from typing import List, Optional import astnodes as ast -import visitor as visitor +import visitor from scope import Context, SemanticError, Type, Scope, Method, AutoType, IntType, BoolType, StringType, ErrorType, \ SelfType @@ -286,19 +286,25 @@ def visit(self, node: ast.ProgramNode, scope: Scope = None): scope = Scope() for elem in node.declarations: - self.visit(elem, scope) + self.visit(elem, scope.create_child()) @visitor.when(ast.ClassDeclarationNode) def visit(self, node: ast.ClassDeclarationNode, scope: Scope): self.current_type = self.context.get_type(node.id) - for elem in node.features: - self.visit(elem, scope) + attrs = [feature for feature in node.features if isinstance(feature, ast.AttrDeclarationNode)] + methods = [feature for feature in node.features if isinstance(feature, ast.MethodDeclarationNode)] + + for attr in attrs: + self.visit(attr, scope) + + for method in methods: + self.visit(method, scope.create_child()) @visitor.when(ast.AttrDeclarationNode) def visit(self, node: ast.AttrDeclarationNode, scope: Scope): expected_type = self.context.get_type(node.type) if node.expr is not None: - typex = self.visit(node.expr, scope) + typex = self.visit(node.expr, scope.create_child()) if not typex.conforms_to(expected_type): self.errors.append(INCOMPATIBLE_TYPES % (node.type, expected_type.name)) scope.define_variable(node.id, expected_type) @@ -311,22 +317,22 @@ def visit(self, node: ast.MethodDeclarationNode, scope: Scope): self.errors.append(LOCAL_ALREADY_DEFINED % (param[0], self.current_method.name)) else: scope.define_variable(param[0], self.context.get_type(param[1])) - tipo = self.visit(node.body, scope.create_child()) + typex = self.visit(node.body, scope.create_child()) expected_type = self.context.get_type(node.type) - if not tipo.conforms_to(expected_type): - self.errors.append(INCOMPATIBLE_TYPES % (tipo.name, expected_type.name)) + if not typex.conforms_to(expected_type): + self.errors.append(INCOMPATIBLE_TYPES % (typex.name, expected_type.name)) @visitor.when(ast.LetNode) def visit(self, node: ast.LetNode, scope: Scope): for elem in node.declarations: self.visit(elem, scope) - return self.visit(node.expr, scope) + return self.visit(node.expr, scope.create_child()) @visitor.when(ast.VarDeclarationNode) def visit(self, node: ast.VarDeclarationNode, scope: Scope): try: expected_type = self.context.get_type(node.type) - if expected_type.name == 'SELF_TYPE': + if expected_type == SelfType(): expected_type = self.current_type except SemanticError as e: expected_type = self.context.get_type('Object') @@ -429,9 +435,9 @@ def visit(self, node: ast.BooleanNode, scope: Scope): def visit(self, node: ast.VariableNode, scope: Scope): var = scope.find_variable(node.lex) if var is None: - var = self.context.get_type('Object') self.errors.append(VARIABLE_NOT_DEFINED % (node.lex, self.current_method.name)) - return var.type if var.name != 'SELF_TYPE' else self.current_type + return ErrorType() + return var.type @visitor.when(ast.InstantiateNode) def visit(self, node: ast.InstantiateNode, scope: Scope): From 760a36585751973175d867a1570a1503f93932b3 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Fri, 1 May 2020 12:17:30 -0400 Subject: [PATCH 029/143] Setting "Object" as default parent solved in type building time --- astnodes.py | 10 + main.py | 8 +- scope.py | 28 +- semantic.py | 330 ++++++++++++++++----- temp/semantic.py | 755 ----------------------------------------------- 5 files changed, 281 insertions(+), 850 deletions(-) mode change 100755 => 100644 semantic.py delete mode 100644 temp/semantic.py diff --git a/astnodes.py b/astnodes.py index 0d5999aa0..8780b71e1 100755 --- a/astnodes.py +++ b/astnodes.py @@ -79,6 +79,12 @@ def __init__(self, idx, expr): self.expr: ExprNode = expr +class SetAttributeNode(ExprNode): + def __init__(self, idx, expr): + self.id: str = idx + self.expr: ExprNode = expr + + class ConditionalNode(ExprNode): def __init__(self, ifx, then, elsex): self.if_expr: ExprNode = ifx @@ -116,6 +122,10 @@ def __init__(self, left, right): self.right: ExprNode = right +class GetAttributeNode(AtomicNode): + pass + + class VariableNode(AtomicNode): pass diff --git a/main.py b/main.py index 9059c69d2..ac57dc5e2 100755 --- a/main.py +++ b/main.py @@ -1,7 +1,7 @@ from lexer import CoolLexer from parser import CoolParser from scope import Context -from semantic import TypeCollector, TypeBuilder, TypeChecker, InferenceTypeChecker, Executor +from semantic import TypeCollector, TypeBuilder, TypeChecker, InferenceTypeChecker, Executor, topological_order program = r""" class Main inherits IO { @@ -22,9 +22,15 @@ class Main inherits IO { errors = [] TypeCollector(context, errors).visit(ast) + TypeBuilder(context, errors).visit(ast) + + topological_order(ast, context) + scope = TypeChecker(context, errors).visit(ast) + InferenceTypeChecker(context, errors).visit(ast, scope) + Executor(context, errors).visit(ast, scope) for error in errors: diff --git a/scope.py b/scope.py index 6bebfd9ce..d01b09516 100755 --- a/scope.py +++ b/scope.py @@ -1,5 +1,5 @@ from collections import OrderedDict -from typing import List, Optional, Dict, Any +from typing import List, Optional, Dict, Any, Tuple class SemanticError(Exception): @@ -70,6 +70,9 @@ def define_attribute(self, name: str, typex: 'Type') -> Attribute: else: raise SemanticError(f'Attribute "{name}" is already defined in {self.name}.') + def contains_attribute(self, name: str) -> bool: + return name in self.attributes + def get_method(self, name: str) -> Method: try: return self.methods[name] @@ -92,17 +95,18 @@ def define_method(self, name: str, self.methods[name] = method return method - def all_attributes(self, clean: bool = 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: bool = 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 contains_method(self, name) -> bool: + return name in self.methods + + def all_attributes(self) -> List[Tuple[Attribute, 'Type']]: + attributes = [] if self.parent is None else self.parent.all_attributes() + attributes += [(a, self) for a in self.attributes.values()] + return attributes + + def all_methods(self) -> List[Tuple[Method, 'Type']]: + methods = [] if self.parent is None else self.parent.all_methods() + methods += [(m, self) for m in self.methods.values()] + return methods def conforms_to(self, other: 'Type') -> bool: return other.bypass() or self == other or self.parent is not None and self.parent.conforms_to(other) diff --git a/semantic.py b/semantic.py old mode 100755 new mode 100644 index 48aa54a2d..efd30fd0d --- a/semantic.py +++ b/semantic.py @@ -4,9 +4,9 @@ from typing import List, Optional, Dict import astnodes as ast -import visitor as visitor - -from scope import Context, SemanticError, Type, Scope, Method +import visitor +from scope import Context, SemanticError, Type, Scope, Method, AutoType, IntType, BoolType, StringType, ErrorType, \ + SelfType, ObjectType, IOType """ Object @@ -32,24 +32,56 @@ substr(i : Int, l : Int) : String """ +WRONG_SIGNATURE = 'Method "%s" already defined in "%s" with a different signature.' +SELF_IS_READONLY = 'Variable "self" is read-only.' +LOCAL_ALREADY_DEFINED = 'Variable "%s" is already defined in method "%s".' +INCOMPATIBLE_TYPES = 'Cannot convert "%s" into "%s".' +VARIABLE_NOT_DEFINED = 'Variable "%s" is not defined in "%s".' +INVALID_BINARY_OPERATION = 'Operation "%s" is not defined between "%s" and "%s".' +INVALID_UNARY_OPERATION = 'Operation "%s" is not defined for "%s".' + + +def topological_order(program_node: ast.ProgramNode, context: Context): + """ + Set an order in the program node of de ast such that for all class A with parent B, class B is before A in the + list, if in the process is detected a cycle, or exist a class derived from "Int", "String" or "Bool" then an + assertion error is throw. + + :param program_node: Root of the first AST of the program + + :param context: Context With all collected and building types -def topological_order(context: Context): + :return: a List[str] "l" where l[i] contains the name of the Type number i in the topological order + """ types = context.types - graph: Dict[str, List[str]] = {} + graph: Dict[str, List[str]] = {name: [] for name in types} for name, typex in types.items(): if name == 'Object': continue + graph[typex.parent.name].append(name) - parent = typex.parent - if parent is None: - pass + assert graph['Int'] == graph['String'] == graph['Bool'] == [], 'Can not inherits from "Int", "String", "Bool".' - try: - graph[parent.name].append(name) - except KeyError: - graph[parent.name] = [] + order = [] + visited = {name: False for name in graph} + stack = ['Object'] + + while stack: + current_name = stack.pop() + + assert not visited[current_name], f'Cyclic class hierarchy in class {current_name}.' + + visited[current_name] = True + stack += graph[current_name] + order.append(current_name) + + declarations = {d.id: d for d in program_node.declarations} + program_node.declarations = [declarations[name] for name in order if + name not in ('Object', 'Int', 'IO', 'String', 'Bool')] + + return order class Formatter: @@ -175,11 +207,8 @@ class TypeCollector: Params ---------- - errors: List[str] - is a list of errors detected in the ast travel - context: Context - the context for keeping the classes - """ + - errors: List[str] is a list of errors detected in the ast travel + - context: Context the context for keeping the classes""" def __init__(self, context: Context = Context(), errors: List[str] = []): self.errors: List[str] = errors @@ -191,29 +220,31 @@ def visit(self, node): @visitor.when(ast.ProgramNode) def visit(self, node): - self.context = Context() - self.context.create_type('SELF_TYPE') - self.context.create_type('AUTO_TYPE') - object_type = self.context.create_type('Object') - io_type = self.context.create_type('IO') - string_type = self.context.create_type('String') - self.context.create_type('Int') - self.context.create_type('Bool') - - object_type.define_method('abort', [], [], self.context.get_type('Object')) - object_type.define_method('get_type', [], [], self.context.get_type('String')) - object_type.define_method('abort', [], [], self.context.get_type('SELF_TYPE')) - - io_type.define_method('out_string', ['x'], [self.context.get_type('String')], - self.context.get_type('SELF_TYPE')) - io_type.define_method('out_int', ['x'], [self.context.get_type('Int')], self.context.get_type('SELF_TYPE')) - io_type.define_method('in_string', [], [], self.context.get_type('String')) - io_type.define_method('in_int', [], [], self.context.get_type('Int')) - - string_type.define_method('length', [], [], self.context.get_type('Int')) - string_type.define_method('concat', ['s'], [self.context.get_type('String')], self.context.get_type('String')) - string_type.define_method('substr', ['i', 'l'], [self.context.get_type('Int'), self.context.get_type('int')], - self.context.get_type('String')) + self.context.types['AUTO_TYPE'] = AutoType() + self_type = self.context.types['SELF_TYPE'] = SelfType() + object_type = self.context.types['Object'] = ObjectType() + io_type = self.context.types['IO'] = IOType() + string_type = self.context.types['String'] = StringType() + int_type = self.context.types['Int'] = IntType() + bool_type = self.context.types['Bool'] = BoolType() + + io_type.set_parent(object_type) + string_type.set_parent(object_type) + int_type.set_parent(object_type) + bool_type.set_parent(object_type) + + object_type.define_method('abort', [], [], object_type) + object_type.define_method('get_type', [], [], string_type) + object_type.define_method('copy', [], [], self_type) + + io_type.define_method('out_string', ['x'], [string_type], self_type) + io_type.define_method('out_int', ['x'], [int_type], self_type) + io_type.define_method('in_string', [], [], string_type) + io_type.define_method('in_int', [], [], int_type) + + string_type.define_method('length', [], [], int_type) + string_type.define_method('concat', ['s'], [string_type], string_type) + string_type.define_method('substr', ['i', 'l'], [int_type, int_type], string_type) for declaration in node.declarations: self.visit(declaration) @@ -243,16 +274,15 @@ def visit(self, node: ast.ProgramNode): @visitor.when(ast.ClassDeclarationNode) def visit(self, node: ast.ClassDeclarationNode): - try: - self.current_type = self.context.get_type(node.id) - if node.parent is not None: - if node.parent in ('Int', 'Bool'): - self.errors.append(f'Cannot inherit from type "{node.parent}"') - self.current_type.set_parent(self.context.get_type(node.parent)) - else: - self.current_type.set_parent(self.context.get_type('Object')) - except SemanticError as e: - self.errors.append(e.text) + self.current_type = self.context.get_type(node.id) + + if node.parent is not None: + try: + self.current_type.set_parent(node.parent) + except SemanticError as e: + self.errors.append(e.text) + else: + self.current_type.set_parent(ObjectType()) for feature in node.features: self.visit(feature) @@ -268,15 +298,33 @@ def visit(self, node: ast.AttrDeclarationNode): @visitor.when(ast.MethodDeclarationNode) def visit(self, node: ast.MethodDeclarationNode): + name = node.id + param_names = [] + param_types = [] + for name, typex in node.params: + param_names.append(name) + try: + param_types.append(self.context.get_type(name)) + except SemanticError as e: + param_types.append(ErrorType()) + self.errors.append(e.text) + try: - name = node.id - param_names = [p[0] for p in node.params] - param_types = [self.context.get_type(p[1]) for p in node.params] return_type = self.context.get_type(node.type) - self.current_type.define_method(name, param_names, param_types, return_type) except SemanticError as e: + return_type = ErrorType() self.errors.append(e.text) + self.current_type.define_method(name, param_names, param_types, return_type) + + +class SetterGetterCreator: + def __init__(self, context: Context, errors: List[str] = []): + self.context: Context = context + self.errors: List[str] = errors + self.current_type: Type = None + self.current_method: Method = None + class TypeChecker: def __init__(self, context: Context, errors: List[str] = []): @@ -291,115 +339,233 @@ def visit(self, node, tabs): @visitor.when(ast.ProgramNode) def visit(self, node: ast.ProgramNode, scope: Scope = None): - pass + if scope is None: + scope = Scope() + + for elem in node.declarations: + self.visit(elem, scope.create_child()) @visitor.when(ast.ClassDeclarationNode) def visit(self, node: ast.ClassDeclarationNode, scope: Scope): - pass + self.current_type = self.context.get_type(node.id) + attrs = [feature for feature in node.features if isinstance(feature, ast.AttrDeclarationNode)] + methods = [feature for feature in node.features if isinstance(feature, ast.MethodDeclarationNode)] + + for attr in attrs: + self.visit(attr, scope) + + for method in methods: + self.visit(method, scope.create_child()) @visitor.when(ast.AttrDeclarationNode) def visit(self, node: ast.AttrDeclarationNode, scope: Scope): - pass + expected_type = self.context.get_type(node.type) + if node.expr is not None: + typex = self.visit(node.expr, scope.create_child()) + if not typex.conforms_to(expected_type): + self.errors.append(INCOMPATIBLE_TYPES % (node.type, expected_type.name)) + scope.define_variable(node.id, expected_type) @visitor.when(ast.MethodDeclarationNode) def visit(self, node: ast.MethodDeclarationNode, scope: Scope): - pass + self.current_method = self.current_type.get_method(node.id) + + for i, (name, typex) in enumerate(node.params): + if scope.is_defined(name): + self.errors.append(LOCAL_ALREADY_DEFINED % (name, self.current_method.name)) + else: + scope.define_variable(name, self.context.get_type(typex)) + + typex = self.visit(node.body, scope.create_child()) + expected_type = self.context.get_type(node.type) + if not typex.conforms_to(expected_type): + self.errors.append(INCOMPATIBLE_TYPES % (typex.name, expected_type.name)) @visitor.when(ast.LetNode) def visit(self, node: ast.LetNode, scope: Scope): - pass + for elem in node.declarations: + self.visit(elem, scope) + return self.visit(node.expr, scope.create_child()) @visitor.when(ast.VarDeclarationNode) def visit(self, node: ast.VarDeclarationNode, scope: Scope): - pass + try: + expected_type = self.context.get_type(node.type) + except SemanticError as e: + expected_type = ErrorType() + self.errors.append(e.text) + + if scope.is_local(node.id): + self.errors.append(LOCAL_ALREADY_DEFINED % (node.id, self.current_method.name)) + else: + scope.define_variable(node.id, expected_type) + + if node.expr is not None: + typex = self.visit(node.expr, scope) + if not (typex.conforms_to(expected_type)): + self.errors.append(INCOMPATIBLE_TYPES % (typex.name, expected_type.name)) + + return expected_type @visitor.when(ast.AssignNode) def visit(self, node: ast.AssignNode, scope: Scope): - pass + return_type = self.visit(node.expr, scope) + var = scope.find_variable(node.id) + if var is None: + self.errors.append(VARIABLE_NOT_DEFINED % (node.id, self.current_method.name)) + else: + if not return_type.conforms_to(var.type): + self.errors.append(INCOMPATIBLE_TYPES % (return_type.name, var.type.name)) + return var.type @visitor.when(ast.BlockNode) def visit(self, node: ast.BlockNode, scope: Scope): - pass + return_type = ErrorType() + for expr in node.expressions: + return_type = self.visit(expr, scope) + return return_type @visitor.when(ast.ConditionalNode) def visit(self, node: ast.ConditionalNode, scope: Scope): - pass + if_type = self.visit(node.if_expr, scope) + then_type = self.visit(node.then_expr, scope) + else_type = self.visit(node.else_expr, scope) + if if_type != BoolType: + self.errors.append(INCOMPATIBLE_TYPES % (if_type.name, 'Bool')) + if then_type.conforms_to(else_type): + return then_type + if else_type.conforms_to(then_type): + return then_type + return ErrorType() @visitor.when(ast.WhileNode) def visit(self, node: ast.WhileNode, scope: Scope): - pass + condition = self.visit(node.condition, scope) + if condition != BoolType(): + self.errors.append(INCOMPATIBLE_TYPES % (condition.name, 'Bool')) + return self.visit(node.body, scope) @visitor.when(ast.SwitchCaseNode) def visit(self, node: ast.SwitchCaseNode, scope: Scope): - pass + self.visit(node.expr, scope) + for item in node.cases: + self.visit(item, scope.create_child()) + return self.context.get_type('Object') @visitor.when(ast.CaseNode) def visit(self, node: ast.CaseNode, scope: Scope): - pass + try: + v = scope.define_variable(node.id, self.context.get_type(node.type)) + except SemanticError as e: + v = scope.define_variable(node.id, self.context.get_type('Object')) + self.errors.append(e.text) + self.visit(node.expr, scope) + return v.type if v.type.name != 'SELF_TYPE' else self.current_type @visitor.when(ast.MethodCallNode) def visit(self, node: ast.MethodCallNode, scope: Scope): - pass + typex = self.visit(node.obj, scope) + try: + method = typex.get_method(node.id) + except SemanticError: + self.errors.append(f'Method "{node.id}" is not defined in {node.type}.') + method = None + if method is not None and len(node.args) + 1 != len(method.param_names): + self.errors.append(WRONG_SIGNATURE % (method.name, typex.name)) + for i, var in enumerate(node.args): + var_type = self.visit(var, scope) + if method is not None: + expected_return_type = method.param_types[i + 1] + if not var_type.conforms_to(expected_return_type): + self.errors.append(INCOMPATIBLE_TYPES % (var_type.name, expected_return_type.name)) + return self.context.get_type('Object') if method is None else method.return_type @visitor.when(ast.IntegerNode) def visit(self, node: ast.IntegerNode, scope: Scope): - pass + return IntType() @visitor.when(ast.StringNode) def visit(self, node: ast.StringNode, scope: Scope): - pass + return StringType() @visitor.when(ast.BooleanNode) def visit(self, node: ast.BooleanNode, scope: Scope): - pass + return BoolType() @visitor.when(ast.VariableNode) def visit(self, node: ast.VariableNode, scope: Scope): - pass + var = scope.find_variable(node.lex) + if var is None: + self.errors.append(VARIABLE_NOT_DEFINED % (node.lex, self.current_method.name)) + return ErrorType() + return var.type @visitor.when(ast.InstantiateNode) def visit(self, node: ast.InstantiateNode, scope: Scope): - pass + try: + return self.context.get_type(node.lex) + except SemanticError as e: + self.errors.append(e.text) + return ErrorType() @visitor.when(ast.NegationNode) def visit(self, node: ast.NegationNode, scope: Scope): - pass + return self._check_unary_operation(node, scope, 'not', BoolType()) @visitor.when(ast.ComplementNode) def visit(self, node: ast.ComplementNode, scope: Scope): - pass + return self._check_unary_operation(node, scope, '~', IntType()) @visitor.when(ast.IsVoidNode) def visit(self, node: ast.IsVoidNode, scope: Scope): - pass + self.visit(node.obj, scope) + return BoolType() @visitor.when(ast.PlusNode) def visit(self, node: ast.PlusNode, scope: Scope): - pass + return self._check_int_binary_operation(node, scope, '+', IntType()) @visitor.when(ast.MinusNode) def visit(self, node: ast.MinusNode, scope: Scope): - pass + return self._check_int_binary_operation(node, scope, '-', IntType()) @visitor.when(ast.StarNode) def visit(self, node: ast.StarNode, scope: Scope): - pass + return self._check_int_binary_operation(node, scope, '*', IntType()) @visitor.when(ast.DivNode) def visit(self, node: ast.DivNode, scope: Scope): - pass + return self._check_int_binary_operation(node, scope, '/', IntType()) @visitor.when(ast.LessEqualNode) def visit(self, node: ast.LessEqualNode, scope: Scope): - pass + return self._check_int_binary_operation(node, scope, '<=', BoolType()) @visitor.when(ast.LessThanNode) def visit(self, node: ast.LessThanNode, scope: Scope): - pass + return self._check_int_binary_operation(node, scope, '<', BoolType()) @visitor.when(ast.EqualNode) def visit(self, node: ast.EqualNode, scope: Scope): - pass + self.visit(node.left, scope) + self.visit(node.right, scope) + return BoolType() + + def _check_int_binary_operation(self, node: ast.BinaryNode, scope: Scope, operation: str, return_type: Type): + left_type = self.visit(node.left, scope) + right_type = self.visit(node.right, scope) + + if left_type == right_type == IntType(): + return return_type + self.errors.append(INVALID_BINARY_OPERATION % (operation, left_type.name, right_type.name)) + return ErrorType() + + def _check_unary_operation(self, node: ast.UnaryNode, scope: Scope, operation: str, expected_type: Type): + typex = self.visit(node.obj, scope) + if typex == expected_type: + return typex + self.errors.append(INVALID_UNARY_OPERATION % (operation, typex.name)) + return ErrorType() class InferenceTypeChecker: diff --git a/temp/semantic.py b/temp/semantic.py deleted file mode 100644 index f5389cac3..000000000 --- a/temp/semantic.py +++ /dev/null @@ -1,755 +0,0 @@ -"""This module contains definitions of classes for make different travels through the AST of a cool program. All -classes defined here follows the visitor pattern using the module cmp.visitor, with this we can get a more decoupled -inspection. """ -from typing import List, Optional - -import astnodes as ast -import visitor - -from scope import Context, SemanticError, Type, Scope, Method, AutoType, IntType, BoolType, StringType, ErrorType, \ - SelfType - -""" -Object - abort() : Object - type_name() : String - copy() : SELF_TYPE - -IO - out_string(x : String) : SELF_TYPE - out_int(x : Int) : SELF_TYPE - in_string() : String - in_int() : Int - -Int (Sealed) - default -> 0 - -Bool (Sealed) - default -> False - -String - length() : Int - concat(s : String) : String - substr(i : Int, l : Int) : String -""" -WRONG_SIGNATURE = 'Method "%s" already defined in "%s" with a different signature.' -SELF_IS_READONLY = 'Variable "self" is read-only.' -LOCAL_ALREADY_DEFINED = 'Variable "%s" is already defined in method "%s".' -INCOMPATIBLE_TYPES = 'Cannot convert "%s" into "%s".' -VARIABLE_NOT_DEFINED = 'Variable "%s" is not defined in "%s".' -INVALID_BINARY_OPERATION = 'Operation "%s" is not defined between "%s" and "%s".' -INVALID_UNARY_OPERATION = 'Operation "%s" is not defined for "%s".' - - -class Formatter: - @visitor.on('node') - def visit(self, node, tabs): - pass - - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode, tabs: int = 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(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode, tabs: int = 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(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode, tabs: int = 0): - ans = '\t' * tabs + f'\\__AttrDeclarationNode: {node.id} : {node.type}' - return f'{ans}' - - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode, tabs: int = 0): - params = ', '.join(':'.join(param) for param in node.params) - ans = '\t' * tabs + f'\\__FuncDeclarationNode: {node.id}({params}) : {node.type} -> ' - body = self.visit(node.body, tabs + 1) - return f'{ans}\n{body}' - - @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode, tabs: int = 0): - declarations = '\n'.join(self.visit(declaration, tabs + 1) for declaration in node.declarations) - ans = '\t' * tabs + f'\\__LetNode: let' - expr = self.visit(node.expr, tabs + 2) - return f'{ans}\n {declarations}\n' + '\t' * (tabs + 1) + 'in\n' + f'{expr}' - - @visitor.when(ast.VarDeclarationNode) - def visit(self, node: ast.VarDeclarationNode, tabs: int = 0): - if node.expr is not None: - return '\t' * tabs + f'\\__VarDeclarationNode: {node.id}: {node.type} <-\n{self.visit(node.expr, tabs + 1)}' - else: - return '\t' * tabs + f'\\__VarDeclarationNode: {node.id} : {node.type}' - - @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode, tabs: int = 0): - ans = '\t' * tabs + f'\\__AssignNode: {node.id} <- ' - expr = self.visit(node.expr, tabs + 1) - return f'{ans}\n{expr}' - - @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode, tabs: int = 0): - ans = '\t' * tabs + f'\\__BlockNode:' - body = '\n'.join(self.visit(child, tabs + 1) for child in node.expressions) - return f'{ans}\n{body}' - - @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode, tabs: int = 0): - ifx = self.visit(node.if_expr, tabs + 2) - then = self.visit(node.then_expr, tabs + 2) - elsex = self.visit(node.else_expr, tabs + 2) - - return '\n'.join([ - '\t' * tabs + f'\\__IfThenElseNode: if then else fi', - '\t' * (tabs + 1) + f'\\__if \n{ifx}', - '\t' * (tabs + 1) + f'\\__then \n{then}', - '\t' * (tabs + 1) + f'\\__else \n{elsex}', - ]) - - @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode, tabs: int = 0): - condition = self.visit(node.condition, tabs + 2) - body = self.visit(node.body, tabs + 2) - - return '\n'.join([ - '\t' * tabs + f'\\__WhileNode: while loop pool', - '\t' * (tabs + 1) + f'\\__while \n{condition}', - '\t' * (tabs + 1) + f'\\__loop \n{body}', - ]) - - @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode, tabs: int = 0): - expr = self.visit(node.expr, tabs + 2) - cases = '\n'.join(self.visit(case, tabs + 3) for case in node.cases) - - return '\n'.join([ - '\t' * tabs + f'\\__SwitchCaseNode: case of [ ... ] esac', - '\t' * (tabs + 1) + f'\\__case \n{expr} of', - ]) + '\n' + cases - - @visitor.when(ast.CaseNode) - def visit(self, node: ast.CaseNode, tabs: int = 0): - expr = self.visit(node.expr, tabs + 1) - return '\t' * tabs + f'\\__CaseNode: {node.id} : {node.type} =>\n{expr}' - - @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode, tabs: int = 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(ast.BinaryNode) - def visit(self, node: ast.BinaryNode, tabs: int = 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(ast.AtomicNode) - def visit(self, node: ast.AtomicNode, tabs: int = 0): - return '\t' * tabs + f'\\__ {node.__class__.__name__}: {node.lex}' - - @visitor.when(ast.InstantiateNode) - def visit(self, node: ast.InstantiateNode, tabs: int = 0): - return '\t' * tabs + f'\\__ InstantiateNode: new {node.lex}()' - - -class TypeCollector: - def __init__(self, context: Context = Context(), errors: List[str] = []): - self.errors: List[str] = errors - self.context: Context = context - - @visitor.on('node') - def visit(self, node): - pass - - @visitor.when(ast.ProgramNode) - def visit(self, node): - self_type = self.context.create_type('SELF_TYPE') - self.context.types['AUTO_TYPE'] = AutoType() - object_type = self.context.create_type('Object') - io_type = self.context.create_type('IO') - string_type = self.context.create_type('String') - int_type = self.context.create_type('Int') - bool_type = self.context.create_type('Bool') - - io_type.parent = object_type - string_type.parent = object_type - int_type.parent = object_type - bool_type.parent = object_type - - object_type.define_method('abort', ['self'], [object_type], object_type) - object_type.define_method('get_type', ['self'], [object_type], string_type) - object_type.define_method('copy', ['self'], [object_type], self_type) - - io_type.define_method('out_string', ['self', 'x'], [io_type, string_type], self_type) - io_type.define_method('out_int', ['self', 'x'], [io_type, int_type], self_type) - io_type.define_method('in_string', ['self'], [io_type], string_type) - io_type.define_method('in_int', ['self'], [io_type], int_type) - - string_type.define_method('length', ['self'], [string_type], int_type) - string_type.define_method('concat', ['self', 's'], [string_type, string_type], string_type) - string_type.define_method('substr', ['self', 'i', 'l'], [string_type, int_type, int_type], string_type) - - for declaration in node.declarations: - self.visit(declaration) - - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node): - try: - self.context.create_type(node.id) - except SemanticError as e: - self.errors.append(e.text) - - -class TypeBuilder: - def __init__(self, context: Context, errors: List[str] = []): - self.context: Context = context - self.current_type: Optional[Type] = None - self.errors: List[str] = errors - - @visitor.on('node') - def visit(self, node): - pass - - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode): - for declaration in node.declarations: - self.visit(declaration) - - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode): - try: - self.current_type = self.context.get_type(node.id) - if node.parent is not None: - if node.parent in (IntType(), BoolType(), StringType()): - self.errors.append(f'Cannot inherit from type "{node.parent}"') - self.current_type.set_parent(self.context.get_type(node.parent)) - else: - self.current_type.set_parent(self.context.get_type('Object')) - except SemanticError as e: - self.errors.append(e.text) - - for feature in node.features: - self.visit(feature) - - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode): - try: - name = node.id - typex = self.context.get_type(node.type) - self.current_type.define_attribute(name, typex) - except SemanticError as e: - # Todo: Fix up Object Assignment (Most be error) - # self.current_type.define_attribute(node.id, self.context.get_type('Object')) - self.errors.append(e.text) - - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode): - name = node.id - param_names = ['self'] - param_types = [self.current_type] - for name, typex in node.params: - param_names.append(name) - try: - param_types.append(self.context.get_type(name)) - except SemanticError as e: - # param_types.append(self.context.get_type('Object')) - self.errors.append(e.text) - try: - return_type = self.context.get_type(node.type) - self.current_type.define_method(name, param_names, param_types, return_type) - except SemanticError as e: - # self.current_type.define_method(name, param_names, param_types, self.context.get_type('Object')) - self.errors.append(e.text) - - -class TypeChecker: - def __init__(self, context: Context, errors: List[str] = []): - self.context: Context = context - self.errors: List[str] = errors - self.current_type: Type = None - self.current_method: Method = None - - @visitor.on('node') - def visit(self, node, tabs): - pass - - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode, scope: Scope = None): - if scope is None: - scope = Scope() - - for elem in node.declarations: - self.visit(elem, scope.create_child()) - - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode, scope: Scope): - self.current_type = self.context.get_type(node.id) - attrs = [feature for feature in node.features if isinstance(feature, ast.AttrDeclarationNode)] - methods = [feature for feature in node.features if isinstance(feature, ast.MethodDeclarationNode)] - - for attr in attrs: - self.visit(attr, scope) - - for method in methods: - self.visit(method, scope.create_child()) - - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode, scope: Scope): - expected_type = self.context.get_type(node.type) - if node.expr is not None: - typex = self.visit(node.expr, scope.create_child()) - if not typex.conforms_to(expected_type): - self.errors.append(INCOMPATIBLE_TYPES % (node.type, expected_type.name)) - scope.define_variable(node.id, expected_type) - - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode, scope: Scope): - self.current_method = self.current_type.get_method(node.id) - for i, param in enumerate(node.params): - if scope.is_local(param[0]): - self.errors.append(LOCAL_ALREADY_DEFINED % (param[0], self.current_method.name)) - else: - scope.define_variable(param[0], self.context.get_type(param[1])) - typex = self.visit(node.body, scope.create_child()) - expected_type = self.context.get_type(node.type) - if not typex.conforms_to(expected_type): - self.errors.append(INCOMPATIBLE_TYPES % (typex.name, expected_type.name)) - - @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode, scope: Scope): - for elem in node.declarations: - self.visit(elem, scope) - return self.visit(node.expr, scope.create_child()) - - @visitor.when(ast.VarDeclarationNode) - def visit(self, node: ast.VarDeclarationNode, scope: Scope): - try: - expected_type = self.context.get_type(node.type) - if expected_type == SelfType(): - expected_type = self.current_type - except SemanticError as e: - expected_type = self.context.get_type('Object') - self.errors.append(e.text) - if scope.is_local(node.id): - self.errors.append(LOCAL_ALREADY_DEFINED % (node.id, self.current_method.name)) - else: - scope.define_variable(node.id, expected_type) - if node.expr is not None: - tipo = self.visit(node.expr, scope) - if not (tipo.conforms_to(expected_type)): - self.errors.append(INCOMPATIBLE_TYPES % (tipo.name, expected_type.name)) - - @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode, scope: Scope): - return_type = self.visit(node.expr, scope) - var = scope.find_variable(node.id) - if var is None: - self.errors.append(VARIABLE_NOT_DEFINED % (node.id, self.current_method.name)) - else: - if not return_type.conforms_to(var.type): - self.errors.append(INCOMPATIBLE_TYPES % (return_type.name, var.type.name)) - return var.type if var.type.name != 'SELF_TYPE' else self.current_type - - @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode, scope: Scope): - return_type = ErrorType() - for inst in node.expressions: - return_type = self.visit(inst, scope) - return return_type - - @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode, scope: Scope): - if_type = self.visit(node.if_expr, scope) - then_type = self.visit(node.then_expr, scope) - else_type = self.visit(node.else_expr, scope) - if if_type.name != 'Bool': - self.errors.append(INCOMPATIBLE_TYPES % (if_type.name, 'Bool')) - if then_type.conforms_to(else_type): - return then_type - if else_type.conforms_to(then_type): - return then_type - return self.context.get_type('Object') - - @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode, scope: Scope): - condition = self.visit(node.condition, scope) - if condition.name != 'Bool': - self.errors.append(INCOMPATIBLE_TYPES % (condition.name, 'Bool')) - return self.visit(node.body, scope) - - @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode, scope: Scope): - self.visit(node.expr, scope) - for item in node.cases: - self.visit(item, scope.create_child()) - return self.context.get_type('Object') - - @visitor.when(ast.CaseNode) - def visit(self, node: ast.CaseNode, scope: Scope): - try: - v = scope.define_variable(node.id, self.context.get_type(node.type)) - except SemanticError as e: - v = scope.define_variable(node.id, self.context.get_type('Object')) - self.errors.append(e.text) - self.visit(node.expr, scope) - return v.type if v.type.name != 'SELF_TYPE' else self.current_type - - @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode, scope: Scope): - typex = self.visit(node.obj, scope) - try: - method = typex.get_method(node.id) - except SemanticError: - self.errors.append(f'Method "{node.id}" is not defined in {node.type}.') - method = None - if method is not None and len(node.args) + 1 != len(method.param_names): - self.errors.append(WRONG_SIGNATURE % (method.name, typex.name)) - for i, var in enumerate(node.args): - var_type = self.visit(var, scope) - if method is not None: - expected_return_type = method.param_types[i + 1] - if not var_type.conforms_to(expected_return_type): - self.errors.append(INCOMPATIBLE_TYPES % (var_type.name, expected_return_type.name)) - return self.context.get_type('Object') if method is None else method.return_type - - @visitor.when(ast.IntegerNode) - def visit(self, node: ast.IntegerNode, scope: Scope): - return IntType() - - @visitor.when(ast.StringNode) - def visit(self, node: ast.StringNode, scope: Scope): - return StringType() - - @visitor.when(ast.BooleanNode) - def visit(self, node: ast.BooleanNode, scope: Scope): - return BoolType() - - @visitor.when(ast.VariableNode) - def visit(self, node: ast.VariableNode, scope: Scope): - var = scope.find_variable(node.lex) - if var is None: - self.errors.append(VARIABLE_NOT_DEFINED % (node.lex, self.current_method.name)) - return ErrorType() - return var.type - - @visitor.when(ast.InstantiateNode) - def visit(self, node: ast.InstantiateNode, scope: Scope): - try: - return self.context.get_type(node.lex) - except SemanticError as e: - self.errors.append(e.text) - return ErrorType() - - @visitor.when(ast.NegationNode) - def visit(self, node: ast.NegationNode, scope: Scope): - return self._check_unary_operation(node, scope, 'not', BoolType()) - - @visitor.when(ast.ComplementNode) - def visit(self, node: ast.ComplementNode, scope: Scope): - return self._check_unary_operation(node, scope, '~', IntType()) - - @visitor.when(ast.IsVoidNode) - def visit(self, node: ast.IsVoidNode, scope: Scope): - self.visit(node.obj, scope) - return BoolType() - - @visitor.when(ast.PlusNode) - def visit(self, node: ast.PlusNode, scope: Scope): - return self._check_int_binary_operation(node, scope, '+', IntType()) - - @visitor.when(ast.MinusNode) - def visit(self, node: ast.MinusNode, scope: Scope): - return self._check_int_binary_operation(node, scope, '-', IntType()) - - @visitor.when(ast.StarNode) - def visit(self, node: ast.StarNode, scope: Scope): - return self._check_int_binary_operation(node, scope, '*', IntType()) - - @visitor.when(ast.DivNode) - def visit(self, node: ast.DivNode, scope: Scope): - return self._check_int_binary_operation(node, scope, '/', IntType()) - - @visitor.when(ast.LessEqualNode) - def visit(self, node: ast.LessEqualNode, scope: Scope): - return self._check_int_binary_operation(node, scope, '<=', BoolType()) - - @visitor.when(ast.LessThanNode) - def visit(self, node: ast.LessThanNode, scope: Scope): - return self._check_int_binary_operation(node, scope, '<', BoolType()) - - @visitor.when(ast.EqualNode) - def visit(self, node: ast.EqualNode, scope: Scope): - self.visit(node.left, scope) - self.visit(node.right, scope) - return BoolType() - - def _check_int_binary_operation(self, node: ast.BinaryNode, scope: Scope, operation: str, return_type: Type): - left_type = self.visit(node.left, scope) - right_type = self.visit(node.right, scope) - - if left_type == right_type == IntType(): - return return_type - self.errors.append(INVALID_BINARY_OPERATION % (operation, left_type.name, right_type.name)) - return ErrorType() - - def _check_unary_operation(self, node: ast.UnaryNode, scope: Scope, operation: str, expected_type: Type): - typex = self.visit(node.obj, scope) - if typex == expected_type: - return typex - self.errors.append(INVALID_UNARY_OPERATION % (operation, typex.name)) - return ErrorType() - - -class InferenceTypeChecker: - def __init__(self, context: Context, errors: List[str] = []): - self.context: Context = context - self.errors: List[str] = errors - self.current_type: Type = None - self.current_method: Method = None - - @visitor.on('node') - def visit(self, node, tabs): - pass - - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode, scope: Scope = None): - pass - - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode, scope: Scope): - pass - - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode, scope: Scope): - pass - - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode, scope: Scope): - pass - - @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode, scope: Scope): - pass - - @visitor.when(ast.VarDeclarationNode) - def visit(self, node: ast.VarDeclarationNode, scope: Scope): - pass - - @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode, scope: Scope): - pass - - @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode, scope: Scope): - pass - - @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode, scope: Scope): - pass - - @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode, scope: Scope): - pass - - @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode, scope: Scope): - pass - - @visitor.when(ast.CaseNode) - def visit(self, node: ast.CaseNode, scope: Scope): - pass - - @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode, scope: Scope): - pass - - @visitor.when(ast.IntegerNode) - def visit(self, node: ast.IntegerNode, scope: Scope): - pass - - @visitor.when(ast.StringNode) - def visit(self, node: ast.StringNode, scope: Scope): - pass - - @visitor.when(ast.BooleanNode) - def visit(self, node: ast.BooleanNode, scope: Scope): - pass - - @visitor.when(ast.VariableNode) - def visit(self, node: ast.VariableNode, scope: Scope): - pass - - @visitor.when(ast.InstantiateNode) - def visit(self, node: ast.InstantiateNode, scope: Scope): - pass - - @visitor.when(ast.NegationNode) - def visit(self, node: ast.NegationNode, scope: Scope): - pass - - @visitor.when(ast.ComplementNode) - def visit(self, node: ast.ComplementNode, scope: Scope): - pass - - @visitor.when(ast.IsVoidNode) - def visit(self, node: ast.IsVoidNode, scope: Scope): - pass - - @visitor.when(ast.PlusNode) - def visit(self, node: ast.PlusNode, scope: Scope): - pass - - @visitor.when(ast.MinusNode) - def visit(self, node: ast.MinusNode, scope: Scope): - pass - - @visitor.when(ast.StarNode) - def visit(self, node: ast.StarNode, scope: Scope): - pass - - @visitor.when(ast.DivNode) - def visit(self, node: ast.DivNode, scope: Scope): - pass - - @visitor.when(ast.LessEqualNode) - def visit(self, node: ast.LessEqualNode, scope: Scope): - pass - - @visitor.when(ast.LessThanNode) - def visit(self, node: ast.LessThanNode, scope: Scope): - pass - - @visitor.when(ast.EqualNode) - def visit(self, node: ast.EqualNode, scope: Scope): - pass - - -class Executor: - def __init__(self, context: Context, errors: List[str] = []): - self.context: Context = context - self.errors: List[str] = errors - self.current_type: Type = None - self.current_method: Method = None - - @visitor.on('node') - def visit(self, node, tabs): - pass - - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode, scope: Scope = None): - pass - - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode, scope: Scope): - pass - - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode, scope: Scope): - pass - - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode, scope: Scope): - pass - - @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode, scope: Scope): - pass - - @visitor.when(ast.VarDeclarationNode) - def visit(self, node: ast.VarDeclarationNode, scope: Scope): - pass - - @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode, scope: Scope): - pass - - @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode, scope: Scope): - pass - - @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode, scope: Scope): - pass - - @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode, scope: Scope): - pass - - @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode, scope: Scope): - pass - - @visitor.when(ast.CaseNode) - def visit(self, node: ast.CaseNode, scope: Scope): - pass - - @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode, scope: Scope): - pass - - @visitor.when(ast.IntegerNode) - def visit(self, node: ast.IntegerNode, scope: Scope): - pass - - @visitor.when(ast.StringNode) - def visit(self, node: ast.StringNode, scope: Scope): - pass - - @visitor.when(ast.BooleanNode) - def visit(self, node: ast.BooleanNode, scope: Scope): - pass - - @visitor.when(ast.VariableNode) - def visit(self, node: ast.VariableNode, scope: Scope): - pass - - @visitor.when(ast.InstantiateNode) - def visit(self, node: ast.InstantiateNode, scope: Scope): - pass - - @visitor.when(ast.NegationNode) - def visit(self, node: ast.NegationNode, scope: Scope): - pass - - @visitor.when(ast.ComplementNode) - def visit(self, node: ast.ComplementNode, scope: Scope): - pass - - @visitor.when(ast.IsVoidNode) - def visit(self, node: ast.IsVoidNode, scope: Scope): - pass - - @visitor.when(ast.PlusNode) - def visit(self, node: ast.PlusNode, scope: Scope): - pass - - @visitor.when(ast.MinusNode) - def visit(self, node: ast.MinusNode, scope: Scope): - pass - - @visitor.when(ast.StarNode) - def visit(self, node: ast.StarNode, scope: Scope): - pass - - @visitor.when(ast.DivNode) - def visit(self, node: ast.DivNode, scope: Scope): - pass - - @visitor.when(ast.LessEqualNode) - def visit(self, node: ast.LessEqualNode, scope: Scope): - pass - - @visitor.when(ast.LessThanNode) - def visit(self, node: ast.LessThanNode, scope: Scope): - pass - - @visitor.when(ast.EqualNode) - def visit(self, node: ast.EqualNode, scope: Scope): - pass From c1ac4cf16162b5cb87744e2d113cb32c140c7ffb Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Sat, 2 May 2020 05:24:40 -0400 Subject: [PATCH 030/143] SelfTypeReplacement in process --- astnodes.py | 6 +- main.py | 12 +- scope.py | 25 ++- semantic.py | 361 ++++++++++++++++++++++++++++++--------- temp/Fixing_Self_Type.py | 8 +- visitor.py | 5 +- 6 files changed, 315 insertions(+), 102 deletions(-) diff --git a/astnodes.py b/astnodes.py index 8780b71e1..af2de1320 100755 --- a/astnodes.py +++ b/astnodes.py @@ -27,7 +27,7 @@ class MethodDeclarationNode(DeclarationNode): def __init__(self, idx, params, return_type, body): self.id: str = idx self.params: List[Tuple[str, str]] = params - self.type: str = return_type + self.return_type: str = return_type self.body: ExprNode = body @@ -112,8 +112,8 @@ def __init__(self, lex): class UnaryNode(ExprNode): - def __init__(self, obj): - self.obj: ExprNode = obj + def __init__(self, expr): + self.expr: ExprNode = expr class BinaryNode(ExprNode): diff --git a/main.py b/main.py index ac57dc5e2..7e3b47516 100755 --- a/main.py +++ b/main.py @@ -1,7 +1,8 @@ from lexer import CoolLexer from parser import CoolParser from scope import Context -from semantic import TypeCollector, TypeBuilder, TypeChecker, InferenceTypeChecker, Executor, topological_order +from semantic import (TypeCollector, TypeBuilder, OverriddenMethodChecker, SelfTypeReplacement, TypeChecker, + InferenceTypeChecker, Executor, topological_ordering) program = r""" class Main inherits IO { @@ -22,15 +23,12 @@ class Main inherits IO { errors = [] TypeCollector(context, errors).visit(ast) - TypeBuilder(context, errors).visit(ast) - - topological_order(ast, context) - + ast = topological_ordering(ast, context, errors) + OverriddenMethodChecker(context, errors).visit(ast) + ast = SelfTypeReplacement(context, errors).visit(ast) scope = TypeChecker(context, errors).visit(ast) - InferenceTypeChecker(context, errors).visit(ast, scope) - Executor(context, errors).visit(ast, scope) for error in errors: diff --git a/scope.py b/scope.py index d01b09516..116721033 100755 --- a/scope.py +++ b/scope.py @@ -1,5 +1,5 @@ from collections import OrderedDict -from typing import List, Optional, Dict, Any, Tuple +from typing import List, Optional, Dict, Any, Tuple, Union class SemanticError(Exception): @@ -71,16 +71,29 @@ def define_attribute(self, name: str, typex: 'Type') -> Attribute: raise SemanticError(f'Attribute "{name}" is already defined in {self.name}.') def contains_attribute(self, name: str) -> bool: - return name in self.attributes + return name in self.attributes or (self.parent is not None and self.parent.contains_attribute(name)) - def get_method(self, name: str) -> Method: + def get_method(self, name: str, get_owner: bool = False) -> Union[Method, Tuple[Method, 'Type']]: + """ + Search the innermost declaration of the method with the given name and return the method, if "get_owner" has + value "True" the returned object is a tuple (method, type) where type is the innermost `Type` in th Type + Hierarchy where the methods is defined. If the method does not exist in the hierarchy then a SemanticError is + raised + + :param name: str, name of the method + + :param get_owner: bool, if has value "True" then a tuple (method, type) is returned else only the method is + returned + + :return: the desired method and it's optional type owner. + """ try: - return self.methods[name] + return self.methods[name] if not get_owner else (self.methods[name], self) except StopIteration: if self.parent is None: raise SemanticError(f'Method "{name}" is not defined in {self.name}.') try: - return self.parent.get_method(name) + return self.parent.get_method(name, get_owner) except SemanticError: raise SemanticError(f'Method "{name}" is not defined in {self.name}.') @@ -96,7 +109,7 @@ def define_method(self, name: str, return method def contains_method(self, name) -> bool: - return name in self.methods + return name in self.methods or (self.parent is not None and self.parent.contains_method(name)) def all_attributes(self) -> List[Tuple[Attribute, 'Type']]: attributes = [] if self.parent is None else self.parent.all_attributes() diff --git a/semantic.py b/semantic.py index efd30fd0d..cd06f85a8 100644 --- a/semantic.py +++ b/semantic.py @@ -26,7 +26,7 @@ Bool (Sealed) default -> False -String +String (Sealed) length() : Int concat(s : String) : String substr(i : Int, l : Int) : String @@ -34,6 +34,10 @@ WRONG_SIGNATURE = 'Method "%s" already defined in "%s" with a different signature.' SELF_IS_READONLY = 'Variable "self" is read-only.' +SELF_INVALID_ATTRIBUTE_ID = 'Cannot set "self" as attribute of a class.' +SELF_INVALID_PARAM_ID = 'Cannot set "self" as parameter of a method.' +INVALID_INHERIT_CLASS = 'Can not inherits from "Int", "String", "Bool".' +OVERRIDE_ATTRIBUTE_ID = 'Attributes cannot be override in derived class' LOCAL_ALREADY_DEFINED = 'Variable "%s" is already defined in method "%s".' INCOMPATIBLE_TYPES = 'Cannot convert "%s" into "%s".' VARIABLE_NOT_DEFINED = 'Variable "%s" is not defined in "%s".' @@ -41,49 +45,6 @@ INVALID_UNARY_OPERATION = 'Operation "%s" is not defined for "%s".' -def topological_order(program_node: ast.ProgramNode, context: Context): - """ - Set an order in the program node of de ast such that for all class A with parent B, class B is before A in the - list, if in the process is detected a cycle, or exist a class derived from "Int", "String" or "Bool" then an - assertion error is throw. - - :param program_node: Root of the first AST of the program - - :param context: Context With all collected and building types - - :return: a List[str] "l" where l[i] contains the name of the Type number i in the topological order - """ - types = context.types - - graph: Dict[str, List[str]] = {name: [] for name in types} - - for name, typex in types.items(): - if name == 'Object': - continue - graph[typex.parent.name].append(name) - - assert graph['Int'] == graph['String'] == graph['Bool'] == [], 'Can not inherits from "Int", "String", "Bool".' - - order = [] - visited = {name: False for name in graph} - stack = ['Object'] - - while stack: - current_name = stack.pop() - - assert not visited[current_name], f'Cyclic class hierarchy in class {current_name}.' - - visited[current_name] = True - stack += graph[current_name] - order.append(current_name) - - declarations = {d.id: d for d in program_node.declarations} - program_node.declarations = [declarations[name] for name in order if - name not in ('Object', 'Int', 'IO', 'String', 'Bool')] - - return order - - class Formatter: @visitor.on('node') def visit(self, node, tabs): @@ -110,7 +71,7 @@ def visit(self, node: ast.AttrDeclarationNode, tabs: int = 0): @visitor.when(ast.MethodDeclarationNode) def visit(self, node: ast.MethodDeclarationNode, tabs: int = 0): params = ', '.join(':'.join(param) for param in node.params) - ans = '\t' * tabs + f'\\__FuncDeclarationNode: {node.id}({params}) : {node.type} -> ' + ans = '\t' * tabs + f'\\__FuncDeclarationNode: {node.id}({params}) : {node.return_type} -> ' body = self.visit(node.body, tabs + 1) return f'{ans}\n{body}' @@ -233,18 +194,18 @@ def visit(self, node): int_type.set_parent(object_type) bool_type.set_parent(object_type) - object_type.define_method('abort', [], [], object_type) - object_type.define_method('get_type', [], [], string_type) - object_type.define_method('copy', [], [], self_type) + object_type.define_method('abort', ['self'], [self_type], object_type) + object_type.define_method('get_type', ['self'], [self_type], string_type) + object_type.define_method('copy', ['self'], [self_type], self_type) - io_type.define_method('out_string', ['x'], [string_type], self_type) - io_type.define_method('out_int', ['x'], [int_type], self_type) - io_type.define_method('in_string', [], [], string_type) - io_type.define_method('in_int', [], [], int_type) + io_type.define_method('out_string', ['self', 'x'], [self_type, string_type], self_type) + io_type.define_method('out_int', ['self', 'x'], [self_type, string_type], self_type) + io_type.define_method('in_string', ['self'], [self_type], string_type) + io_type.define_method('in_int', ['self'], [self_type], int_type) - string_type.define_method('length', [], [], int_type) - string_type.define_method('concat', ['s'], [string_type], string_type) - string_type.define_method('substr', ['i', 'l'], [int_type, int_type], string_type) + string_type.define_method('length', ['self'], [self_type], int_type) + string_type.define_method('concat', ['self', 's'], [self_type, string_type], string_type) + string_type.define_method('substr', ['self', 'i', 'l'], [self_type, int_type, int_type], string_type) for declaration in node.declarations: self.visit(declaration) @@ -258,7 +219,15 @@ def visit(self, node): class TypeBuilder: - def __init__(self, context: Context, errors: List[str] = []): + """This visitor collect all the attributes and methods in classes and set the parent to the current class + + Params + ------ + - errors: List[str] is a list of errors detected in the ast travel + - context: Context the context for keeping the classes + - current_type: Optional[Type] is the current type in the building process""" + + def __init__(self, context: Context, errors: List[str]): self.context: Context = context self.current_type: Optional[Type] = None self.errors: List[str] = errors @@ -277,6 +246,9 @@ def visit(self, node: ast.ClassDeclarationNode): self.current_type = self.context.get_type(node.id) if node.parent is not None: + if node.parent in ("Int", "String", "Bool", "SELF_TYPE"): + self.errors.append('Can not inherits from "Int", "String" or "Bool".') + try: self.current_type.set_parent(node.parent) except SemanticError as e: @@ -299,8 +271,8 @@ def visit(self, node: ast.AttrDeclarationNode): @visitor.when(ast.MethodDeclarationNode) def visit(self, node: ast.MethodDeclarationNode): name = node.id - param_names = [] - param_types = [] + param_names = ['self'] + param_types = [SelfType()] for name, typex in node.params: param_names.append(name) try: @@ -310,7 +282,7 @@ def visit(self, node: ast.MethodDeclarationNode): self.errors.append(e.text) try: - return_type = self.context.get_type(node.type) + return_type = self.context.get_type(node.return_type) except SemanticError as e: return_type = ErrorType() self.errors.append(e.text) @@ -318,16 +290,234 @@ def visit(self, node: ast.MethodDeclarationNode): self.current_type.define_method(name, param_names, param_types, return_type) -class SetterGetterCreator: - def __init__(self, context: Context, errors: List[str] = []): +def topological_ordering(program_node: ast.ProgramNode, + context: Context, + errors: List[str]) -> ast.ProgramNode: + """Set an order in the program node of de ast such that for all class A with parent B, class B is before A in the + list, if in the process is detected a cycle an error is added to the `error` parameter + + :param program_node: Root of the first AST of the program + + :param context: Context With all collected and building types + + :param errors: The error list + + :return: a new AST where all declared class are in topological order""" + + types = context.types + + graph: Dict[str, List[str]] = {name: [] for name in types} + + for name, typex in types.items(): + if name == 'Object': + continue + graph[typex.parent.name].append(name) + + order = [] + visited = {name: False for name in graph} + stack = ['Object'] + + while stack: + current_name = stack.pop() + + if visited[current_name]: + errors.append(f'Cyclic class hierarchy in class {current_name}.') + + visited[current_name] = True + stack += graph[current_name] + order.append(current_name) + + declarations = {d.id: d for d in program_node.declarations} + program_node.declarations = [declarations[name] for name in order if + name not in ('Object', 'Int', 'IO', 'String', 'Bool')] + + return program_node + + +class OverriddenMethodChecker: + """This visitor for validate the signature of the overridden methods + + Params + ------ + - errors: List[str] is a list of errors detected in the ast travel + - context: Context the context for keeping the classes + - current_type: Optional[Type] is the current type in the building process""" + + def __init__(self, context: Context, errors: List[str]): self.context: Context = context + self.current_type: Optional[Type] = None self.errors: List[str] = errors - self.current_type: Type = None - self.current_method: Method = None + + @visitor.on('node') + def visit(self, node): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode): + for declaration in node.declarations: + self.visit(declaration) + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode): + self.current_type = self.context.get_type(node.id) + + for feature in node.features: + if isinstance(feature, ast.MethodDeclarationNode): + self.visit(feature) + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode): + # At this point all class has defined a parent and they are visited in topological order + method, owner = self.current_type.parent.get_method(node.id, get_owner=True) + + if len(method.param_types) != len(node.params): + self.errors.append(WRONG_SIGNATURE % (method.name, owner.name)) + + for parent_param_type, (_, current_param_type_name) in zip(method.param_types, node.params): + if parent_param_type != self.context.get_type(current_param_type_name): + self.errors.append(WRONG_SIGNATURE % (method.name, owner.name)) + break + + if method.return_type != self.context.get_type(node.return_type): + self.errors.append(WRONG_SIGNATURE % (method.name, owner.name)) + + +class SelfTypeReplacement: + """Check that `SELF_TYPE` is used correctly and replace every match with the correspondent class type. + + The principal method visit return a new AST with all the SELF_TYPE replaced by it's correspondent class name, + all the definitions of SELF_TYPE in the Type definition where be overridden. + Params + ------ + - errors: List[str] is a list of errors detected in the ast travel + - context: Context the context for keeping the classes + - current_type: Optional[Type] is the current type in the building process""" + + def __init__(self, context: Context, errors: List[str]): + self.context: Context = context + self.errors: List[str] = errors + self.current_type: Optional[Type] = None + self.current_method: Optional[Method] = None + + @visitor.on('node') + def visit(self, node): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode): + return ast.ProgramNode([self.visit(declaration) for declaration in node.declarations]) + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode): + self.current_type = self.context.get_type(node.id) + + if node.parent is not None and node.parent == 'SELF_TYPE': + self.errors.append(f'Invalid use of "SELF_TYPE" as parent of class "{node.id}"') + + features = [self.visit(feature) for feature in node.features] + + return ast.ClassDeclarationNode(node.id, features, node.parent) + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode): + typex = node.type + if typex == 'SELF_TYPE': + typex = self.current_type.name + self.current_type.get_attribute(node.id).type = self.current_type + + expr = self.visit(node.expr) if node.expr is not None else None + + return ast.AttrDeclarationNode(node.id, typex, expr) + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode): + self.current_method = self.current_type.get_method(node.id) + + self.current_method.param_types[0] = self.current_type + + for i, (_, param_type) in enumerate(node.params, 1): + if param_type == 'SELF_TYPE': + self.errors.append('The static type of a param cannot be "SELF_TYPE"') + self.current_method.param_types[i] = ErrorType() # Change the static type to "ErrorType" + + if node.return_type == 'SELF_TYPE': + self.current_method.return_type = self.current_type + + expr = self.visit(node.body) + + return ast.MethodDeclarationNode(node.id, node.params, self.current_method.return_type.name, expr) + + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode): + return ast.LetNode([self.visit(declaration) for declaration in node.declarations], self.visit(node.expr)) + + @visitor.when(ast.VarDeclarationNode) + def visit(self, node: ast.VarDeclarationNode): + # TODO + pass + + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode): + return ast.AssignNode(node.id, self.visit(node.expr)) + + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode): + return ast.BlockNode([self.visit(expr) for expr in node.expressions]) + + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode): + return ast.ConditionalNode(self.visit(node.if_expr), self.visit(node.then_expr), self.visit(node.else_expr)) + + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode): + return ast.WhileNode(self.visit(node.condition), self.visit(node.body)) + + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode): + # TODO + pass + + @visitor.when(ast.CaseNode) + def visit(self, node: ast.CaseNode): + # TODO + pass + + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode): + # TODO + pass + + @visitor.when(ast.IntegerNode) + def visit(self, node: ast.IntegerNode): + return node + + @visitor.when(ast.StringNode) + def visit(self, node: ast.StringNode): + return node + + @visitor.when(ast.BooleanNode) + def visit(self, node: ast.BooleanNode): + return node + + @visitor.when(ast.VariableNode) + def visit(self, node: ast.VariableNode): + return node + + @visitor.when(ast.InstantiateNode) + def visit(self, node: ast.InstantiateNode): + return node + + @visitor.when(ast.UnaryNode) + def visit(self, node: ast.UnaryNode): + return type(node)(self.visit(node.expr)) + + @visitor.when(ast.BinaryNode) + def visit(self, node: ast.BinaryNode): + return type(node)(self.visit(node.left), self.visit(node.right)) class TypeChecker: - def __init__(self, context: Context, errors: List[str] = []): + def __init__(self, context: Context, errors: List[str]): self.context: Context = context self.errors: List[str] = errors self.current_type: Type = None @@ -359,27 +549,40 @@ def visit(self, node: ast.ClassDeclarationNode, scope: Scope): @visitor.when(ast.AttrDeclarationNode) def visit(self, node: ast.AttrDeclarationNode, scope: Scope): - expected_type = self.context.get_type(node.type) + if node.id == 'self': + self.errors.append(SELF_INVALID_ATTRIBUTE_ID) + + attr_type = self.context.get_type(node.type) + if node.expr is not None: - typex = self.visit(node.expr, scope.create_child()) - if not typex.conforms_to(expected_type): - self.errors.append(INCOMPATIBLE_TYPES % (node.type, expected_type.name)) - scope.define_variable(node.id, expected_type) + expr_type = self.visit(node.expr, scope.create_child()) + if not expr_type.conforms_to(attr_type): + self.errors.append(INCOMPATIBLE_TYPES % (expr_type.name, attr_type.name)) + + scope.define_variable(node.id, attr_type) @visitor.when(ast.MethodDeclarationNode) def visit(self, node: ast.MethodDeclarationNode, scope: Scope): self.current_method = self.current_type.get_method(node.id) - for i, (name, typex) in enumerate(node.params): - if scope.is_defined(name): - self.errors.append(LOCAL_ALREADY_DEFINED % (name, self.current_method.name)) + # Defining parameters in the scope. Parameters can hide the attribute declaration, that's why we are not + # checking if there is defined, instead we are checking for local declaration + for i, (name, expr_body_type) in enumerate(node.params): + if not scope.is_local(name): + scope.define_variable(name, self.context.get_type(expr_body_type)) else: - scope.define_variable(name, self.context.get_type(typex)) + self.errors.append(LOCAL_ALREADY_DEFINED % (name, self.current_method.name)) - typex = self.visit(node.body, scope.create_child()) - expected_type = self.context.get_type(node.type) - if not typex.conforms_to(expected_type): - self.errors.append(INCOMPATIBLE_TYPES % (typex.name, expected_type.name)) + return_type = self.context.get_type(node.return_type) + + # Check overriding method + self.current_type.get_method(node.id) + pass + + expr_body_type = self.visit(node.body, scope) + + if not expr_body_type.conforms_to(return_type): + self.errors.append(INCOMPATIBLE_TYPES % (expr_body_type.name, return_type.name)) @visitor.when(ast.LetNode) def visit(self, node: ast.LetNode, scope: Scope): @@ -518,7 +721,7 @@ def visit(self, node: ast.ComplementNode, scope: Scope): @visitor.when(ast.IsVoidNode) def visit(self, node: ast.IsVoidNode, scope: Scope): - self.visit(node.obj, scope) + self.visit(node.expr, scope) return BoolType() @visitor.when(ast.PlusNode) @@ -561,7 +764,7 @@ def _check_int_binary_operation(self, node: ast.BinaryNode, scope: Scope, operat return ErrorType() def _check_unary_operation(self, node: ast.UnaryNode, scope: Scope, operation: str, expected_type: Type): - typex = self.visit(node.obj, scope) + typex = self.visit(node.expr, scope) if typex == expected_type: return typex self.errors.append(INVALID_UNARY_OPERATION % (operation, typex.name)) diff --git a/temp/Fixing_Self_Type.py b/temp/Fixing_Self_Type.py index 0d5729711..85c967305 100644 --- a/temp/Fixing_Self_Type.py +++ b/temp/Fixing_Self_Type.py @@ -20,7 +20,7 @@ def fix_self_type(context: Context, errors=[]): self_typed_attributes = {t: [] for t in types} for t in ts: for att in t.attributes: - if att.type == self_type: + if att.return_type == self_type: self_typed_attributes[t].append(att) for func in t.methods: if func.return_type == self_type: @@ -34,7 +34,7 @@ def fix_self_type(context: Context, errors=[]): for item in self_typed_methods[t.parent]: t.define_method(item.name, item.param_names, item.param_types, item.return_type) for item in self_typed_attributes[t.parent]: - t.define_attribute(item.name, item.type) + t.define_attribute(item.name, item.return_type) # replacing self_type for t in ts: for method in t.methods: @@ -44,8 +44,8 @@ def fix_self_type(context: Context, errors=[]): if method.return_type == self_type: method.return_type = t for att in t.attributes: - if att.type == self_type: - att.type = t + if att.return_type == self_type: + att.return_type = t def visit(v, ts, visited): diff --git a/visitor.py b/visitor.py index eba985fdd..5e3b2526a 100755 --- a/visitor.py +++ b/visitor.py @@ -54,7 +54,7 @@ def ff(*args, **kw): 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.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 = {} @@ -65,10 +65,9 @@ def __call__(self, *args, **kw): 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)] + ans = [t[k](*args, **kw) for k in ks if issubclass(typ, k)] if len(ans) == 1: return ans.pop() return ans From f1716be2b323fe5690c3337f360fe1aba1f1af2c Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Sat, 2 May 2020 22:03:00 -0400 Subject: [PATCH 031/143] StaticType Checker fixed up --- scope.py | 22 ++++++++ semantic.py | 157 ++++++++++++++++++++++++++-------------------------- 2 files changed, 99 insertions(+), 80 deletions(-) diff --git a/scope.py b/scope.py index 116721033..f6b4492c7 100755 --- a/scope.py +++ b/scope.py @@ -124,9 +124,31 @@ def all_methods(self) -> List[Tuple[Method, 'Type']]: def conforms_to(self, other: 'Type') -> bool: return other.bypass() or self == other or self.parent is not None and self.parent.conforms_to(other) + def join(self, other: 'Type') -> 'Type': + self_ancestors = set(self.get_ancestors()) + + current_type = other + while current_type is not None: + if current_type in self_ancestors: + return current_type + current_type = current_type.parent + return None + + @staticmethod + def multi_join(types: List['Type']): + static_type = types[0] + for t in types[1:]: + static_type = static_type.join(t) + return static_type + def bypass(self) -> bool: return False + def get_ancestors(self): + if self.parent is None: + return [self] + return [self] + self.parent.get_ancestors() + def __str__(self): output = f'type {self.name}' parent = '' if self.parent is None else f' : {self.parent.name}' diff --git a/semantic.py b/semantic.py index cd06f85a8..f4688614a 100644 --- a/semantic.py +++ b/semantic.py @@ -8,30 +8,6 @@ from scope import Context, SemanticError, Type, Scope, Method, AutoType, IntType, BoolType, StringType, ErrorType, \ SelfType, ObjectType, IOType -""" -Object - abort() : Object - type_name() : String - copy() : SELF_TYPE - -IO - out_string(x : String) : SELF_TYPE - out_int(x : Int) : SELF_TYPE - in_string() : String - in_int() : Int - -Int (Sealed) - default -> 0 - -Bool (Sealed) - default -> False - -String (Sealed) - length() : Int - concat(s : String) : String - substr(i : Int, l : Int) : String -""" - WRONG_SIGNATURE = 'Method "%s" already defined in "%s" with a different signature.' SELF_IS_READONLY = 'Variable "self" is read-only.' SELF_INVALID_ATTRIBUTE_ID = 'Cannot set "self" as attribute of a class.' @@ -43,6 +19,7 @@ VARIABLE_NOT_DEFINED = 'Variable "%s" is not defined in "%s".' INVALID_BINARY_OPERATION = 'Operation "%s" is not defined between "%s" and "%s".' INVALID_UNARY_OPERATION = 'Operation "%s" is not defined for "%s".' +INVALID_ANCESTOR = 'Class "%s" has no an ancestor class "%s".' class Formatter: @@ -453,8 +430,9 @@ def visit(self, node: ast.LetNode): @visitor.when(ast.VarDeclarationNode) def visit(self, node: ast.VarDeclarationNode): - # TODO - pass + typex = self.current_type.name if node.type == 'SELF_TYPE' else node.type + expr = self.visit(node.expr) if node.expr is not None else None + return ast.VarDeclarationNode(node.id, typex, expr) @visitor.when(ast.AssignNode) def visit(self, node: ast.AssignNode): @@ -474,18 +452,21 @@ def visit(self, node: ast.WhileNode): @visitor.when(ast.SwitchCaseNode) def visit(self, node: ast.SwitchCaseNode): - # TODO - pass + expr = self.visit(node.expr) + cases = [self.visit(case) for case in node.cases] + return ast.SwitchCaseNode(expr, cases) @visitor.when(ast.CaseNode) def visit(self, node: ast.CaseNode): - # TODO - pass + if node.type == 'SELF_TYPE': + self.errors.append('SELF_TYPE cannot be used as branch type in a case expression') + return ast.CaseNode(node.id, node.type, self.visit(node.expr)) @visitor.when(ast.MethodCallNode) def visit(self, node: ast.MethodCallNode): - # TODO - pass + obj = self.visit(node.obj) if node.obj is not None else ast.VariableNode('self') + args = [self.visit(arg) for arg in node.args] + return ast.MethodCallNode(node.id, args, obj, node.type) @visitor.when(ast.IntegerNode) def visit(self, node: ast.IntegerNode): @@ -505,6 +486,7 @@ def visit(self, node: ast.VariableNode): @visitor.when(ast.InstantiateNode) def visit(self, node: ast.InstantiateNode): + node.lex = node.lex if node.lex != 'SELF_TYPE' else self.current_type.name return node @visitor.when(ast.UnaryNode) @@ -524,7 +506,7 @@ def __init__(self, context: Context, errors: List[str]): self.current_method: Method = None @visitor.on('node') - def visit(self, node, tabs): + def visit(self, node, scope): pass @visitor.when(ast.ProgramNode) @@ -535,9 +517,12 @@ def visit(self, node: ast.ProgramNode, scope: Scope = None): for elem in node.declarations: self.visit(elem, scope.create_child()) + return scope + @visitor.when(ast.ClassDeclarationNode) def visit(self, node: ast.ClassDeclarationNode, scope: Scope): self.current_type = self.context.get_type(node.id) + attrs = [feature for feature in node.features if isinstance(feature, ast.AttrDeclarationNode)] methods = [feature for feature in node.features if isinstance(feature, ast.MethodDeclarationNode)] @@ -575,10 +560,6 @@ def visit(self, node: ast.MethodDeclarationNode, scope: Scope): return_type = self.context.get_type(node.return_type) - # Check overriding method - self.current_type.get_method(node.id) - pass - expr_body_type = self.visit(node.body, scope) if not expr_body_type.conforms_to(return_type): @@ -593,33 +574,34 @@ def visit(self, node: ast.LetNode, scope: Scope): @visitor.when(ast.VarDeclarationNode) def visit(self, node: ast.VarDeclarationNode, scope: Scope): try: - expected_type = self.context.get_type(node.type) + var_static_type = self.context.get_type(node.type) except SemanticError as e: - expected_type = ErrorType() + var_static_type = ErrorType() self.errors.append(e.text) if scope.is_local(node.id): self.errors.append(LOCAL_ALREADY_DEFINED % (node.id, self.current_method.name)) else: - scope.define_variable(node.id, expected_type) + scope.define_variable(node.id, var_static_type) if node.expr is not None: - typex = self.visit(node.expr, scope) - if not (typex.conforms_to(expected_type)): - self.errors.append(INCOMPATIBLE_TYPES % (typex.name, expected_type.name)) + expr_type = self.visit(node.expr, scope) + if not (expr_type.conforms_to(var_static_type)): + self.errors.append(INCOMPATIBLE_TYPES % (expr_type.name, var_static_type.name)) - return expected_type + return var_static_type @visitor.when(ast.AssignNode) def visit(self, node: ast.AssignNode, scope: Scope): - return_type = self.visit(node.expr, scope) - var = scope.find_variable(node.id) - if var is None: + expr_type = self.visit(node.expr, scope) + var_info = scope.find_variable(node.id) + if var_info is None: self.errors.append(VARIABLE_NOT_DEFINED % (node.id, self.current_method.name)) + return ErrorType() else: - if not return_type.conforms_to(var.type): - self.errors.append(INCOMPATIBLE_TYPES % (return_type.name, var.type.name)) - return var.type + if not expr_type.conforms_to(var_info.type): + self.errors.append(INCOMPATIBLE_TYPES % (expr_type.name, var_info.type.name)) + return var_info.type @visitor.when(ast.BlockNode) def visit(self, node: ast.BlockNode, scope: Scope): @@ -635,53 +617,68 @@ def visit(self, node: ast.ConditionalNode, scope: Scope): else_type = self.visit(node.else_expr, scope) if if_type != BoolType: self.errors.append(INCOMPATIBLE_TYPES % (if_type.name, 'Bool')) - if then_type.conforms_to(else_type): - return then_type - if else_type.conforms_to(then_type): - return then_type - return ErrorType() + return then_type.join(else_type) @visitor.when(ast.WhileNode) def visit(self, node: ast.WhileNode, scope: Scope): condition = self.visit(node.condition, scope) if condition != BoolType(): self.errors.append(INCOMPATIBLE_TYPES % (condition.name, 'Bool')) - return self.visit(node.body, scope) + + self.visit(node.body) + return ObjectType() @visitor.when(ast.SwitchCaseNode) def visit(self, node: ast.SwitchCaseNode, scope: Scope): self.visit(node.expr, scope) - for item in node.cases: - self.visit(item, scope.create_child()) - return self.context.get_type('Object') + return Type.multi_join([self.visit(case, scope.create_child()) for case in node.cases]) @visitor.when(ast.CaseNode) def visit(self, node: ast.CaseNode, scope: Scope): try: - v = scope.define_variable(node.id, self.context.get_type(node.type)) + scope.define_variable(node.id, self.context.get_type(node.type)) except SemanticError as e: - v = scope.define_variable(node.id, self.context.get_type('Object')) + scope.define_variable(node.id, ErrorType()) self.errors.append(e.text) - self.visit(node.expr, scope) - return v.type if v.type.name != 'SELF_TYPE' else self.current_type + + return self.visit(node.expr, scope) @visitor.when(ast.MethodCallNode) def visit(self, node: ast.MethodCallNode, scope: Scope): - typex = self.visit(node.obj, scope) + obj_type = self.visit(node.obj, scope) + + if node.type is not None: + try: + ancestor_type = self.context.get_type(node.type) + except SemanticError as e: + ancestor_type = ErrorType() + self.errors.append(e.text) + + if not obj_type.conforms_to(ancestor_type): + self.errors.append(INVALID_ANCESTOR % (obj_type.name, ancestor_type.name)) + else: + ancestor_type = obj_type + try: - method = typex.get_method(node.id) - except SemanticError: - self.errors.append(f'Method "{node.id}" is not defined in {node.type}.') - method = None - if method is not None and len(node.args) + 1 != len(method.param_names): - self.errors.append(WRONG_SIGNATURE % (method.name, typex.name)) - for i, var in enumerate(node.args): - var_type = self.visit(var, scope) - if method is not None: - expected_return_type = method.param_types[i + 1] - if not var_type.conforms_to(expected_return_type): - self.errors.append(INCOMPATIBLE_TYPES % (var_type.name, expected_return_type.name)) - return self.context.get_type('Object') if method is None else method.return_type + method = ancestor_type.get_method(node.id) + except SemanticError as e: + self.errors.append(e.text) + for arg in node.args: + self.visit(arg, scope) + return ErrorType() + + if len(node.args) + 1 != len(method.param_names): + self.errors.append(WRONG_SIGNATURE % (method.name, obj_type.name)) + + if not obj_type.conforms_to(method.param_types[0]): + self.errors.append(INCOMPATIBLE_TYPES % (obj_type.name, method.param_types[0].name)) + + for i, arg in enumerate(node.args, 1): + arg_type = self.visit(arg, scope) + if not arg_type.conforms_to(method.param_types[i]): + self.errors.append(INCOMPATIBLE_TYPES % (arg_type.name, method.param_types[i].name)) + + return method.return_type @visitor.when(ast.IntegerNode) def visit(self, node: ast.IntegerNode, scope: Scope): @@ -697,11 +694,11 @@ def visit(self, node: ast.BooleanNode, scope: Scope): @visitor.when(ast.VariableNode) def visit(self, node: ast.VariableNode, scope: Scope): - var = scope.find_variable(node.lex) - if var is None: + variable = scope.find_variable(node.lex) + if variable is None: self.errors.append(VARIABLE_NOT_DEFINED % (node.lex, self.current_method.name)) return ErrorType() - return var.type + return variable.type @visitor.when(ast.InstantiateNode) def visit(self, node: ast.InstantiateNode, scope: Scope): From 7877f724ad51584dc10bb84b75b3ba6aa6eb38a8 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Sat, 2 May 2020 22:10:30 -0400 Subject: [PATCH 032/143] Deleted "temp/ folder" --- semantic.py | 6 ++--- temp/Fixing_Self_Type.py | 56 ---------------------------------------- temp/main.py | 51 ------------------------------------ 3 files changed, 3 insertions(+), 110 deletions(-) delete mode 100644 temp/Fixing_Self_Type.py delete mode 100644 temp/main.py diff --git a/semantic.py b/semantic.py index f4688614a..0c1c7bcc2 100644 --- a/semantic.py +++ b/semantic.py @@ -1,12 +1,12 @@ """This module contains definitions of classes for make different travels through the AST of a cool program. All -classes defined here follows the visitor pattern using the module cmp.visitor, with this we can get a more decoupled +classes defined here follows the visitor pattern using the module visitor, with this we can get a more decoupled inspection. """ from typing import List, Optional, Dict import astnodes as ast import visitor -from scope import Context, SemanticError, Type, Scope, Method, AutoType, IntType, BoolType, StringType, ErrorType, \ - SelfType, ObjectType, IOType +from scope import (Context, SemanticError, Type, Scope, Method, AutoType, IntType, BoolType, StringType, ErrorType, + SelfType, ObjectType, IOType) WRONG_SIGNATURE = 'Method "%s" already defined in "%s" with a different signature.' SELF_IS_READONLY = 'Variable "self" is read-only.' diff --git a/temp/Fixing_Self_Type.py b/temp/Fixing_Self_Type.py deleted file mode 100644 index 85c967305..000000000 --- a/temp/Fixing_Self_Type.py +++ /dev/null @@ -1,56 +0,0 @@ -from scope import Context - - -def fix_self_type(context: Context, errors=[]): - types = [a[1] for a in context.types.items()] - ts = [] - visited = set() - for v in types: - if v not in visited: - visit(v, ts, visited) - # Checking circular dependencies in the topological sort - visited = set() - for v in ts: - if v.parent is not None and v.parent not in visited: - errors.append(f'Not valid parent for class "{v.name}".') - visited.add(v) - # Setting all self_type methods and attributes - self_type = context.get_type('SELF_TYPE') - self_typed_methods = {t: [] for t in types} - self_typed_attributes = {t: [] for t in types} - for t in ts: - for att in t.attributes: - if att.return_type == self_type: - self_typed_attributes[t].append(att) - for func in t.methods: - if func.return_type == self_type: - self_typed_methods[t].append(func) - else: - for item2 in func.param_types: - if item2 == self_type: - self_typed_attributes[t].append(func) - break - if t.parent is not None: - for item in self_typed_methods[t.parent]: - t.define_method(item.name, item.param_names, item.param_types, item.return_type) - for item in self_typed_attributes[t.parent]: - t.define_attribute(item.name, item.return_type) - # replacing self_type - for t in ts: - for method in t.methods: - for i, item2 in enumerate(method.param_types): - if item2 == self_type: - method.param_types[i] = t - if method.return_type == self_type: - method.return_type = t - for att in t.attributes: - if att.return_type == self_type: - att.return_type = t - - -def visit(v, ts, visited): - visited.add(v) - if v.parent is not None and v.parent not in visited: - visit(v.parent, ts, visited) - ts.append(v) - diff --git a/temp/main.py b/temp/main.py deleted file mode 100644 index f3b88d766..000000000 --- a/temp/main.py +++ /dev/null @@ -1,51 +0,0 @@ -from lexer import CoolLexer -from parser import CoolParser -from scope import Context -from semantic import TypeCollector, TypeBuilder, TypeChecker, InferenceTypeChecker, Executor -from Fixing_Self_Type import * - -program = """ -class Main { - main ( msg : String ) : Object { - let a: Int <- 25, b: Int <- 15 in { - a <- a + 1; - } - }; - testing6(a: Int): IO { - let count: Int <- 1, pow: Int <- 1 - in { - count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de a es algo"); - } - }; -} -""" - -lexer = CoolLexer() -parser = CoolParser() - -if __name__ == '__main__': - tokens = lexer(program) - ast = parser(tokens) - - context = Context() - errors = [] - - TypeCollector(context, errors).visit(ast) - TypeBuilder(context, errors).visit(ast) - fix_self_type(context, errors) - scope = TypeChecker(context, errors).visit(ast) - InferenceTypeChecker(context, errors).visit(ast, scope) - Executor(context, errors).visit(ast, scope) - - for error in errors: - print(error) - print("Done!") From 4ad4359b14a7cd60b383f8a300411273457e0d4a Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Sun, 3 May 2020 21:53:25 -0400 Subject: [PATCH 033/143] refractoring the project --- Instructions.md => docs/Instructions.md | 0 grammar.py | 2 +- main.py | 15 +- scripts/main.cl | 16 - semantic.py | 1016 ----------------------- semantics/__init__.py | 10 + astnodes.py => semantics/astnodes.py | 0 semantics/builder.py | 77 ++ semantics/collector.py | 60 ++ semantics/formatter.py | 120 +++ semantics/overridden.py | 101 +++ semantics/progam_executor.py | 129 +++ scope.py => semantics/scope.py | 2 +- semantics/selftype.py | 144 ++++ semantics/semantic_errors.py | 12 + semantics/type_checker.py | 276 ++++++ semantics/type_inference.py | 129 +++ visitor.py => semantics/visitor.py | 0 tester.py | 2 +- 19 files changed, 1071 insertions(+), 1040 deletions(-) rename Instructions.md => docs/Instructions.md (100%) delete mode 100755 scripts/main.cl delete mode 100644 semantic.py create mode 100644 semantics/__init__.py rename astnodes.py => semantics/astnodes.py (100%) create mode 100644 semantics/builder.py create mode 100644 semantics/collector.py create mode 100644 semantics/formatter.py create mode 100644 semantics/overridden.py create mode 100644 semantics/progam_executor.py rename scope.py => semantics/scope.py (99%) create mode 100644 semantics/selftype.py create mode 100644 semantics/semantic_errors.py create mode 100644 semantics/type_checker.py create mode 100644 semantics/type_inference.py rename visitor.py => semantics/visitor.py (100%) diff --git a/Instructions.md b/docs/Instructions.md similarity index 100% rename from Instructions.md rename to docs/Instructions.md diff --git a/grammar.py b/grammar.py index 1d7d61eba..db383ee03 100755 --- a/grammar.py +++ b/grammar.py @@ -1,7 +1,7 @@ import inspect import time -import astnodes as ast +from semantics import astnodes as ast from cmp.parsing import LALR1Parser from cmp.pycompiler import Grammar diff --git a/main.py b/main.py index 7e3b47516..373c9594b 100755 --- a/main.py +++ b/main.py @@ -1,14 +1,18 @@ from lexer import CoolLexer from parser import CoolParser -from scope import Context -from semantic import (TypeCollector, TypeBuilder, OverriddenMethodChecker, SelfTypeReplacement, TypeChecker, - InferenceTypeChecker, Executor, topological_ordering) +from semantics.scope import Context +from semantics import (TypeCollector, TypeBuilder, OverriddenMethodChecker, SelfTypeReplacement, TypeChecker, + topological_ordering, Formatter) program = r""" class Main inherits IO { main(): IO { out_string("Hello, World.\n") }; + + function(): SELF_TYPE { + 0 + }; } """ @@ -28,8 +32,9 @@ class Main inherits IO { OverriddenMethodChecker(context, errors).visit(ast) ast = SelfTypeReplacement(context, errors).visit(ast) scope = TypeChecker(context, errors).visit(ast) - InferenceTypeChecker(context, errors).visit(ast, scope) - Executor(context, errors).visit(ast, scope) + print(Formatter().visit(ast)) + # InferenceTypeChecker(context, errors).visit(ast, scope) + # Executor(context, errors).visit(ast, scope) for error in errors: print(error) diff --git a/scripts/main.cl b/scripts/main.cl deleted file mode 100755 index abedfd347..000000000 --- a/scripts/main.cl +++ /dev/null @@ -1,16 +0,0 @@ ---Any characters between two dashes “--” and the next newline ---(or EOF, if there is no next newline) are treated as comments - -(*(*(* -Comments may also be written by enclosing -text in (∗ . . . ∗). The latter form of comment may be nested. -Comments cannot cross file boundaries. -*)*)*) - -class Main { - main ( msg : String ) : Void { - let a: Int <- 25, b: Int <- 15 in { - a + +; - } - }; -} diff --git a/semantic.py b/semantic.py deleted file mode 100644 index 0c1c7bcc2..000000000 --- a/semantic.py +++ /dev/null @@ -1,1016 +0,0 @@ -"""This module contains definitions of classes for make different travels through the AST of a cool program. All -classes defined here follows the visitor pattern using the module visitor, with this we can get a more decoupled -inspection. """ -from typing import List, Optional, Dict - -import astnodes as ast -import visitor -from scope import (Context, SemanticError, Type, Scope, Method, AutoType, IntType, BoolType, StringType, ErrorType, - SelfType, ObjectType, IOType) - -WRONG_SIGNATURE = 'Method "%s" already defined in "%s" with a different signature.' -SELF_IS_READONLY = 'Variable "self" is read-only.' -SELF_INVALID_ATTRIBUTE_ID = 'Cannot set "self" as attribute of a class.' -SELF_INVALID_PARAM_ID = 'Cannot set "self" as parameter of a method.' -INVALID_INHERIT_CLASS = 'Can not inherits from "Int", "String", "Bool".' -OVERRIDE_ATTRIBUTE_ID = 'Attributes cannot be override in derived class' -LOCAL_ALREADY_DEFINED = 'Variable "%s" is already defined in method "%s".' -INCOMPATIBLE_TYPES = 'Cannot convert "%s" into "%s".' -VARIABLE_NOT_DEFINED = 'Variable "%s" is not defined in "%s".' -INVALID_BINARY_OPERATION = 'Operation "%s" is not defined between "%s" and "%s".' -INVALID_UNARY_OPERATION = 'Operation "%s" is not defined for "%s".' -INVALID_ANCESTOR = 'Class "%s" has no an ancestor class "%s".' - - -class Formatter: - @visitor.on('node') - def visit(self, node, tabs): - pass - - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode, tabs: int = 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(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode, tabs: int = 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(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode, tabs: int = 0): - ans = '\t' * tabs + f'\\__AttrDeclarationNode: {node.id} : {node.type}' - return f'{ans}' - - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode, tabs: int = 0): - params = ', '.join(':'.join(param) for param in node.params) - ans = '\t' * tabs + f'\\__FuncDeclarationNode: {node.id}({params}) : {node.return_type} -> ' - body = self.visit(node.body, tabs + 1) - return f'{ans}\n{body}' - - @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode, tabs: int = 0): - declarations = '\n'.join(self.visit(declaration, tabs + 1) for declaration in node.declarations) - ans = '\t' * tabs + f'\\__LetNode: let' - expr = self.visit(node.expr, tabs + 2) - return f'{ans}\n {declarations}\n' + '\t' * (tabs + 1) + 'in\n' + f'{expr}' - - @visitor.when(ast.VarDeclarationNode) - def visit(self, node: ast.VarDeclarationNode, tabs: int = 0): - if node.expr is not None: - return '\t' * tabs + f'\\__VarDeclarationNode: {node.id}: {node.type} <-\n{self.visit(node.expr, tabs + 1)}' - else: - return '\t' * tabs + f'\\__VarDeclarationNode: {node.id} : {node.type}' - - @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode, tabs: int = 0): - ans = '\t' * tabs + f'\\__AssignNode: {node.id} <- ' - expr = self.visit(node.expr, tabs + 1) - return f'{ans}\n{expr}' - - @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode, tabs: int = 0): - ans = '\t' * tabs + f'\\__BlockNode:' - body = '\n'.join(self.visit(child, tabs + 1) for child in node.expressions) - return f'{ans}\n{body}' - - @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode, tabs: int = 0): - ifx = self.visit(node.if_expr, tabs + 2) - then = self.visit(node.then_expr, tabs + 2) - elsex = self.visit(node.else_expr, tabs + 2) - - return '\n'.join([ - '\t' * tabs + f'\\__IfThenElseNode: if then else fi', - '\t' * (tabs + 1) + f'\\__if \n{ifx}', - '\t' * (tabs + 1) + f'\\__then \n{then}', - '\t' * (tabs + 1) + f'\\__else \n{elsex}', - ]) - - @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode, tabs: int = 0): - condition = self.visit(node.condition, tabs + 2) - body = self.visit(node.body, tabs + 2) - - return '\n'.join([ - '\t' * tabs + f'\\__WhileNode: while loop pool', - '\t' * (tabs + 1) + f'\\__while \n{condition}', - '\t' * (tabs + 1) + f'\\__loop \n{body}', - ]) - - @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode, tabs: int = 0): - expr = self.visit(node.expr, tabs + 2) - cases = '\n'.join(self.visit(case, tabs + 3) for case in node.cases) - - return '\n'.join([ - '\t' * tabs + f'\\__SwitchCaseNode: case of [ ... ] esac', - '\t' * (tabs + 1) + f'\\__case \n{expr} of', - ]) + '\n' + cases - - @visitor.when(ast.CaseNode) - def visit(self, node: ast.CaseNode, tabs: int = 0): - expr = self.visit(node.expr, tabs + 1) - return '\t' * tabs + f'\\__CaseNode: {node.id} : {node.type} =>\n{expr}' - - @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode, tabs: int = 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(ast.BinaryNode) - def visit(self, node: ast.BinaryNode, tabs: int = 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(ast.AtomicNode) - def visit(self, node: ast.AtomicNode, tabs: int = 0): - return '\t' * tabs + f'\\__ {node.__class__.__name__}: {node.lex}' - - @visitor.when(ast.InstantiateNode) - def visit(self, node: ast.InstantiateNode, tabs: int = 0): - return '\t' * tabs + f'\\__ InstantiateNode: new {node.lex}()' - - -class TypeCollector: - """Visitor to collect the class in the program, and the basic classes as Object, Int, String, IO and Bool - - Params - ---------- - - errors: List[str] is a list of errors detected in the ast travel - - context: Context the context for keeping the classes""" - - def __init__(self, context: Context = Context(), errors: List[str] = []): - self.errors: List[str] = errors - self.context: Context = context - - @visitor.on('node') - def visit(self, node): - pass - - @visitor.when(ast.ProgramNode) - def visit(self, node): - self.context.types['AUTO_TYPE'] = AutoType() - self_type = self.context.types['SELF_TYPE'] = SelfType() - object_type = self.context.types['Object'] = ObjectType() - io_type = self.context.types['IO'] = IOType() - string_type = self.context.types['String'] = StringType() - int_type = self.context.types['Int'] = IntType() - bool_type = self.context.types['Bool'] = BoolType() - - io_type.set_parent(object_type) - string_type.set_parent(object_type) - int_type.set_parent(object_type) - bool_type.set_parent(object_type) - - object_type.define_method('abort', ['self'], [self_type], object_type) - object_type.define_method('get_type', ['self'], [self_type], string_type) - object_type.define_method('copy', ['self'], [self_type], self_type) - - io_type.define_method('out_string', ['self', 'x'], [self_type, string_type], self_type) - io_type.define_method('out_int', ['self', 'x'], [self_type, string_type], self_type) - io_type.define_method('in_string', ['self'], [self_type], string_type) - io_type.define_method('in_int', ['self'], [self_type], int_type) - - string_type.define_method('length', ['self'], [self_type], int_type) - string_type.define_method('concat', ['self', 's'], [self_type, string_type], string_type) - string_type.define_method('substr', ['self', 'i', 'l'], [self_type, int_type, int_type], string_type) - - for declaration in node.declarations: - self.visit(declaration) - - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node): - try: - self.context.create_type(node.id) - except SemanticError as e: - self.errors.append(e.text) - - -class TypeBuilder: - """This visitor collect all the attributes and methods in classes and set the parent to the current class - - Params - ------ - - errors: List[str] is a list of errors detected in the ast travel - - context: Context the context for keeping the classes - - current_type: Optional[Type] is the current type in the building process""" - - def __init__(self, context: Context, errors: List[str]): - self.context: Context = context - self.current_type: Optional[Type] = None - self.errors: List[str] = errors - - @visitor.on('node') - def visit(self, node): - pass - - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode): - for declaration in node.declarations: - self.visit(declaration) - - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode): - self.current_type = self.context.get_type(node.id) - - if node.parent is not None: - if node.parent in ("Int", "String", "Bool", "SELF_TYPE"): - self.errors.append('Can not inherits from "Int", "String" or "Bool".') - - try: - self.current_type.set_parent(node.parent) - except SemanticError as e: - self.errors.append(e.text) - else: - self.current_type.set_parent(ObjectType()) - - for feature in node.features: - self.visit(feature) - - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode): - try: - name = node.id - typex = self.context.get_type(node.type) - self.current_type.define_attribute(name, typex) - except SemanticError as e: - self.errors.append(e.text) - - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode): - name = node.id - param_names = ['self'] - param_types = [SelfType()] - for name, typex in node.params: - param_names.append(name) - try: - param_types.append(self.context.get_type(name)) - except SemanticError as e: - param_types.append(ErrorType()) - self.errors.append(e.text) - - try: - return_type = self.context.get_type(node.return_type) - except SemanticError as e: - return_type = ErrorType() - self.errors.append(e.text) - - self.current_type.define_method(name, param_names, param_types, return_type) - - -def topological_ordering(program_node: ast.ProgramNode, - context: Context, - errors: List[str]) -> ast.ProgramNode: - """Set an order in the program node of de ast such that for all class A with parent B, class B is before A in the - list, if in the process is detected a cycle an error is added to the `error` parameter - - :param program_node: Root of the first AST of the program - - :param context: Context With all collected and building types - - :param errors: The error list - - :return: a new AST where all declared class are in topological order""" - - types = context.types - - graph: Dict[str, List[str]] = {name: [] for name in types} - - for name, typex in types.items(): - if name == 'Object': - continue - graph[typex.parent.name].append(name) - - order = [] - visited = {name: False for name in graph} - stack = ['Object'] - - while stack: - current_name = stack.pop() - - if visited[current_name]: - errors.append(f'Cyclic class hierarchy in class {current_name}.') - - visited[current_name] = True - stack += graph[current_name] - order.append(current_name) - - declarations = {d.id: d for d in program_node.declarations} - program_node.declarations = [declarations[name] for name in order if - name not in ('Object', 'Int', 'IO', 'String', 'Bool')] - - return program_node - - -class OverriddenMethodChecker: - """This visitor for validate the signature of the overridden methods - - Params - ------ - - errors: List[str] is a list of errors detected in the ast travel - - context: Context the context for keeping the classes - - current_type: Optional[Type] is the current type in the building process""" - - def __init__(self, context: Context, errors: List[str]): - self.context: Context = context - self.current_type: Optional[Type] = None - self.errors: List[str] = errors - - @visitor.on('node') - def visit(self, node): - pass - - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode): - for declaration in node.declarations: - self.visit(declaration) - - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode): - self.current_type = self.context.get_type(node.id) - - for feature in node.features: - if isinstance(feature, ast.MethodDeclarationNode): - self.visit(feature) - - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode): - # At this point all class has defined a parent and they are visited in topological order - method, owner = self.current_type.parent.get_method(node.id, get_owner=True) - - if len(method.param_types) != len(node.params): - self.errors.append(WRONG_SIGNATURE % (method.name, owner.name)) - - for parent_param_type, (_, current_param_type_name) in zip(method.param_types, node.params): - if parent_param_type != self.context.get_type(current_param_type_name): - self.errors.append(WRONG_SIGNATURE % (method.name, owner.name)) - break - - if method.return_type != self.context.get_type(node.return_type): - self.errors.append(WRONG_SIGNATURE % (method.name, owner.name)) - - -class SelfTypeReplacement: - """Check that `SELF_TYPE` is used correctly and replace every match with the correspondent class type. - - The principal method visit return a new AST with all the SELF_TYPE replaced by it's correspondent class name, - all the definitions of SELF_TYPE in the Type definition where be overridden. - Params - ------ - - errors: List[str] is a list of errors detected in the ast travel - - context: Context the context for keeping the classes - - current_type: Optional[Type] is the current type in the building process""" - - def __init__(self, context: Context, errors: List[str]): - self.context: Context = context - self.errors: List[str] = errors - self.current_type: Optional[Type] = None - self.current_method: Optional[Method] = None - - @visitor.on('node') - def visit(self, node): - pass - - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode): - return ast.ProgramNode([self.visit(declaration) for declaration in node.declarations]) - - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode): - self.current_type = self.context.get_type(node.id) - - if node.parent is not None and node.parent == 'SELF_TYPE': - self.errors.append(f'Invalid use of "SELF_TYPE" as parent of class "{node.id}"') - - features = [self.visit(feature) for feature in node.features] - - return ast.ClassDeclarationNode(node.id, features, node.parent) - - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode): - typex = node.type - if typex == 'SELF_TYPE': - typex = self.current_type.name - self.current_type.get_attribute(node.id).type = self.current_type - - expr = self.visit(node.expr) if node.expr is not None else None - - return ast.AttrDeclarationNode(node.id, typex, expr) - - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode): - self.current_method = self.current_type.get_method(node.id) - - self.current_method.param_types[0] = self.current_type - - for i, (_, param_type) in enumerate(node.params, 1): - if param_type == 'SELF_TYPE': - self.errors.append('The static type of a param cannot be "SELF_TYPE"') - self.current_method.param_types[i] = ErrorType() # Change the static type to "ErrorType" - - if node.return_type == 'SELF_TYPE': - self.current_method.return_type = self.current_type - - expr = self.visit(node.body) - - return ast.MethodDeclarationNode(node.id, node.params, self.current_method.return_type.name, expr) - - @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode): - return ast.LetNode([self.visit(declaration) for declaration in node.declarations], self.visit(node.expr)) - - @visitor.when(ast.VarDeclarationNode) - def visit(self, node: ast.VarDeclarationNode): - typex = self.current_type.name if node.type == 'SELF_TYPE' else node.type - expr = self.visit(node.expr) if node.expr is not None else None - return ast.VarDeclarationNode(node.id, typex, expr) - - @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode): - return ast.AssignNode(node.id, self.visit(node.expr)) - - @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode): - return ast.BlockNode([self.visit(expr) for expr in node.expressions]) - - @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode): - return ast.ConditionalNode(self.visit(node.if_expr), self.visit(node.then_expr), self.visit(node.else_expr)) - - @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode): - return ast.WhileNode(self.visit(node.condition), self.visit(node.body)) - - @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode): - expr = self.visit(node.expr) - cases = [self.visit(case) for case in node.cases] - return ast.SwitchCaseNode(expr, cases) - - @visitor.when(ast.CaseNode) - def visit(self, node: ast.CaseNode): - if node.type == 'SELF_TYPE': - self.errors.append('SELF_TYPE cannot be used as branch type in a case expression') - return ast.CaseNode(node.id, node.type, self.visit(node.expr)) - - @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode): - obj = self.visit(node.obj) if node.obj is not None else ast.VariableNode('self') - args = [self.visit(arg) for arg in node.args] - return ast.MethodCallNode(node.id, args, obj, node.type) - - @visitor.when(ast.IntegerNode) - def visit(self, node: ast.IntegerNode): - return node - - @visitor.when(ast.StringNode) - def visit(self, node: ast.StringNode): - return node - - @visitor.when(ast.BooleanNode) - def visit(self, node: ast.BooleanNode): - return node - - @visitor.when(ast.VariableNode) - def visit(self, node: ast.VariableNode): - return node - - @visitor.when(ast.InstantiateNode) - def visit(self, node: ast.InstantiateNode): - node.lex = node.lex if node.lex != 'SELF_TYPE' else self.current_type.name - return node - - @visitor.when(ast.UnaryNode) - def visit(self, node: ast.UnaryNode): - return type(node)(self.visit(node.expr)) - - @visitor.when(ast.BinaryNode) - def visit(self, node: ast.BinaryNode): - return type(node)(self.visit(node.left), self.visit(node.right)) - - -class TypeChecker: - def __init__(self, context: Context, errors: List[str]): - self.context: Context = context - self.errors: List[str] = errors - self.current_type: Type = None - self.current_method: Method = None - - @visitor.on('node') - def visit(self, node, scope): - pass - - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode, scope: Scope = None): - if scope is None: - scope = Scope() - - for elem in node.declarations: - self.visit(elem, scope.create_child()) - - return scope - - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode, scope: Scope): - self.current_type = self.context.get_type(node.id) - - attrs = [feature for feature in node.features if isinstance(feature, ast.AttrDeclarationNode)] - methods = [feature for feature in node.features if isinstance(feature, ast.MethodDeclarationNode)] - - for attr in attrs: - self.visit(attr, scope) - - for method in methods: - self.visit(method, scope.create_child()) - - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode, scope: Scope): - if node.id == 'self': - self.errors.append(SELF_INVALID_ATTRIBUTE_ID) - - attr_type = self.context.get_type(node.type) - - if node.expr is not None: - expr_type = self.visit(node.expr, scope.create_child()) - if not expr_type.conforms_to(attr_type): - self.errors.append(INCOMPATIBLE_TYPES % (expr_type.name, attr_type.name)) - - scope.define_variable(node.id, attr_type) - - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode, scope: Scope): - self.current_method = self.current_type.get_method(node.id) - - # Defining parameters in the scope. Parameters can hide the attribute declaration, that's why we are not - # checking if there is defined, instead we are checking for local declaration - for i, (name, expr_body_type) in enumerate(node.params): - if not scope.is_local(name): - scope.define_variable(name, self.context.get_type(expr_body_type)) - else: - self.errors.append(LOCAL_ALREADY_DEFINED % (name, self.current_method.name)) - - return_type = self.context.get_type(node.return_type) - - expr_body_type = self.visit(node.body, scope) - - if not expr_body_type.conforms_to(return_type): - self.errors.append(INCOMPATIBLE_TYPES % (expr_body_type.name, return_type.name)) - - @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode, scope: Scope): - for elem in node.declarations: - self.visit(elem, scope) - return self.visit(node.expr, scope.create_child()) - - @visitor.when(ast.VarDeclarationNode) - def visit(self, node: ast.VarDeclarationNode, scope: Scope): - try: - var_static_type = self.context.get_type(node.type) - except SemanticError as e: - var_static_type = ErrorType() - self.errors.append(e.text) - - if scope.is_local(node.id): - self.errors.append(LOCAL_ALREADY_DEFINED % (node.id, self.current_method.name)) - else: - scope.define_variable(node.id, var_static_type) - - if node.expr is not None: - expr_type = self.visit(node.expr, scope) - if not (expr_type.conforms_to(var_static_type)): - self.errors.append(INCOMPATIBLE_TYPES % (expr_type.name, var_static_type.name)) - - return var_static_type - - @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode, scope: Scope): - expr_type = self.visit(node.expr, scope) - var_info = scope.find_variable(node.id) - if var_info is None: - self.errors.append(VARIABLE_NOT_DEFINED % (node.id, self.current_method.name)) - return ErrorType() - else: - if not expr_type.conforms_to(var_info.type): - self.errors.append(INCOMPATIBLE_TYPES % (expr_type.name, var_info.type.name)) - return var_info.type - - @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode, scope: Scope): - return_type = ErrorType() - for expr in node.expressions: - return_type = self.visit(expr, scope) - return return_type - - @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode, scope: Scope): - if_type = self.visit(node.if_expr, scope) - then_type = self.visit(node.then_expr, scope) - else_type = self.visit(node.else_expr, scope) - if if_type != BoolType: - self.errors.append(INCOMPATIBLE_TYPES % (if_type.name, 'Bool')) - return then_type.join(else_type) - - @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode, scope: Scope): - condition = self.visit(node.condition, scope) - if condition != BoolType(): - self.errors.append(INCOMPATIBLE_TYPES % (condition.name, 'Bool')) - - self.visit(node.body) - return ObjectType() - - @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode, scope: Scope): - self.visit(node.expr, scope) - return Type.multi_join([self.visit(case, scope.create_child()) for case in node.cases]) - - @visitor.when(ast.CaseNode) - def visit(self, node: ast.CaseNode, scope: Scope): - try: - scope.define_variable(node.id, self.context.get_type(node.type)) - except SemanticError as e: - scope.define_variable(node.id, ErrorType()) - self.errors.append(e.text) - - return self.visit(node.expr, scope) - - @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode, scope: Scope): - obj_type = self.visit(node.obj, scope) - - if node.type is not None: - try: - ancestor_type = self.context.get_type(node.type) - except SemanticError as e: - ancestor_type = ErrorType() - self.errors.append(e.text) - - if not obj_type.conforms_to(ancestor_type): - self.errors.append(INVALID_ANCESTOR % (obj_type.name, ancestor_type.name)) - else: - ancestor_type = obj_type - - try: - method = ancestor_type.get_method(node.id) - except SemanticError as e: - self.errors.append(e.text) - for arg in node.args: - self.visit(arg, scope) - return ErrorType() - - if len(node.args) + 1 != len(method.param_names): - self.errors.append(WRONG_SIGNATURE % (method.name, obj_type.name)) - - if not obj_type.conforms_to(method.param_types[0]): - self.errors.append(INCOMPATIBLE_TYPES % (obj_type.name, method.param_types[0].name)) - - for i, arg in enumerate(node.args, 1): - arg_type = self.visit(arg, scope) - if not arg_type.conforms_to(method.param_types[i]): - self.errors.append(INCOMPATIBLE_TYPES % (arg_type.name, method.param_types[i].name)) - - return method.return_type - - @visitor.when(ast.IntegerNode) - def visit(self, node: ast.IntegerNode, scope: Scope): - return IntType() - - @visitor.when(ast.StringNode) - def visit(self, node: ast.StringNode, scope: Scope): - return StringType() - - @visitor.when(ast.BooleanNode) - def visit(self, node: ast.BooleanNode, scope: Scope): - return BoolType() - - @visitor.when(ast.VariableNode) - def visit(self, node: ast.VariableNode, scope: Scope): - variable = scope.find_variable(node.lex) - if variable is None: - self.errors.append(VARIABLE_NOT_DEFINED % (node.lex, self.current_method.name)) - return ErrorType() - return variable.type - - @visitor.when(ast.InstantiateNode) - def visit(self, node: ast.InstantiateNode, scope: Scope): - try: - return self.context.get_type(node.lex) - except SemanticError as e: - self.errors.append(e.text) - return ErrorType() - - @visitor.when(ast.NegationNode) - def visit(self, node: ast.NegationNode, scope: Scope): - return self._check_unary_operation(node, scope, 'not', BoolType()) - - @visitor.when(ast.ComplementNode) - def visit(self, node: ast.ComplementNode, scope: Scope): - return self._check_unary_operation(node, scope, '~', IntType()) - - @visitor.when(ast.IsVoidNode) - def visit(self, node: ast.IsVoidNode, scope: Scope): - self.visit(node.expr, scope) - return BoolType() - - @visitor.when(ast.PlusNode) - def visit(self, node: ast.PlusNode, scope: Scope): - return self._check_int_binary_operation(node, scope, '+', IntType()) - - @visitor.when(ast.MinusNode) - def visit(self, node: ast.MinusNode, scope: Scope): - return self._check_int_binary_operation(node, scope, '-', IntType()) - - @visitor.when(ast.StarNode) - def visit(self, node: ast.StarNode, scope: Scope): - return self._check_int_binary_operation(node, scope, '*', IntType()) - - @visitor.when(ast.DivNode) - def visit(self, node: ast.DivNode, scope: Scope): - return self._check_int_binary_operation(node, scope, '/', IntType()) - - @visitor.when(ast.LessEqualNode) - def visit(self, node: ast.LessEqualNode, scope: Scope): - return self._check_int_binary_operation(node, scope, '<=', BoolType()) - - @visitor.when(ast.LessThanNode) - def visit(self, node: ast.LessThanNode, scope: Scope): - return self._check_int_binary_operation(node, scope, '<', BoolType()) - - @visitor.when(ast.EqualNode) - def visit(self, node: ast.EqualNode, scope: Scope): - self.visit(node.left, scope) - self.visit(node.right, scope) - return BoolType() - - def _check_int_binary_operation(self, node: ast.BinaryNode, scope: Scope, operation: str, return_type: Type): - left_type = self.visit(node.left, scope) - right_type = self.visit(node.right, scope) - - if left_type == right_type == IntType(): - return return_type - self.errors.append(INVALID_BINARY_OPERATION % (operation, left_type.name, right_type.name)) - return ErrorType() - - def _check_unary_operation(self, node: ast.UnaryNode, scope: Scope, operation: str, expected_type: Type): - typex = self.visit(node.expr, scope) - if typex == expected_type: - return typex - self.errors.append(INVALID_UNARY_OPERATION % (operation, typex.name)) - return ErrorType() - - -class InferenceTypeChecker: - def __init__(self, context: Context, errors: List[str] = []): - self.context: Context = context - self.errors: List[str] = errors - self.current_type: Type = None - self.current_method: Method = None - - @visitor.on('node') - def visit(self, node, tabs): - pass - - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode, scope: Scope = None): - pass - - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode, scope: Scope): - pass - - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode, scope: Scope): - pass - - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode, scope: Scope): - pass - - @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode, scope: Scope): - pass - - @visitor.when(ast.VarDeclarationNode) - def visit(self, node: ast.VarDeclarationNode, scope: Scope): - pass - - @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode, scope: Scope): - pass - - @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode, scope: Scope): - pass - - @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode, scope: Scope): - pass - - @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode, scope: Scope): - pass - - @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode, scope: Scope): - pass - - @visitor.when(ast.CaseNode) - def visit(self, node: ast.CaseNode, scope: Scope): - pass - - @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode, scope: Scope): - pass - - @visitor.when(ast.IntegerNode) - def visit(self, node: ast.IntegerNode, scope: Scope): - pass - - @visitor.when(ast.StringNode) - def visit(self, node: ast.StringNode, scope: Scope): - pass - - @visitor.when(ast.BooleanNode) - def visit(self, node: ast.BooleanNode, scope: Scope): - pass - - @visitor.when(ast.VariableNode) - def visit(self, node: ast.VariableNode, scope: Scope): - pass - - @visitor.when(ast.InstantiateNode) - def visit(self, node: ast.InstantiateNode, scope: Scope): - pass - - @visitor.when(ast.NegationNode) - def visit(self, node: ast.NegationNode, scope: Scope): - pass - - @visitor.when(ast.ComplementNode) - def visit(self, node: ast.ComplementNode, scope: Scope): - pass - - @visitor.when(ast.IsVoidNode) - def visit(self, node: ast.IsVoidNode, scope: Scope): - pass - - @visitor.when(ast.PlusNode) - def visit(self, node: ast.PlusNode, scope: Scope): - pass - - @visitor.when(ast.MinusNode) - def visit(self, node: ast.MinusNode, scope: Scope): - pass - - @visitor.when(ast.StarNode) - def visit(self, node: ast.StarNode, scope: Scope): - pass - - @visitor.when(ast.DivNode) - def visit(self, node: ast.DivNode, scope: Scope): - pass - - @visitor.when(ast.LessEqualNode) - def visit(self, node: ast.LessEqualNode, scope: Scope): - pass - - @visitor.when(ast.LessThanNode) - def visit(self, node: ast.LessThanNode, scope: Scope): - pass - - @visitor.when(ast.EqualNode) - def visit(self, node: ast.EqualNode, scope: Scope): - pass - - -class Executor: - def __init__(self, context: Context, errors: List[str] = []): - self.context: Context = context - self.errors: List[str] = errors - self.current_type: Type = None - self.current_method: Method = None - - @visitor.on('node') - def visit(self, node, tabs): - pass - - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode, scope: Scope = None): - pass - - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode, scope: Scope): - pass - - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode, scope: Scope): - pass - - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode, scope: Scope): - pass - - @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode, scope: Scope): - pass - - @visitor.when(ast.VarDeclarationNode) - def visit(self, node: ast.VarDeclarationNode, scope: Scope): - pass - - @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode, scope: Scope): - pass - - @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode, scope: Scope): - pass - - @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode, scope: Scope): - pass - - @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode, scope: Scope): - pass - - @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode, scope: Scope): - pass - - @visitor.when(ast.CaseNode) - def visit(self, node: ast.CaseNode, scope: Scope): - pass - - @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode, scope: Scope): - pass - - @visitor.when(ast.IntegerNode) - def visit(self, node: ast.IntegerNode, scope: Scope): - pass - - @visitor.when(ast.StringNode) - def visit(self, node: ast.StringNode, scope: Scope): - pass - - @visitor.when(ast.BooleanNode) - def visit(self, node: ast.BooleanNode, scope: Scope): - pass - - @visitor.when(ast.VariableNode) - def visit(self, node: ast.VariableNode, scope: Scope): - pass - - @visitor.when(ast.InstantiateNode) - def visit(self, node: ast.InstantiateNode, scope: Scope): - pass - - @visitor.when(ast.NegationNode) - def visit(self, node: ast.NegationNode, scope: Scope): - pass - - @visitor.when(ast.ComplementNode) - def visit(self, node: ast.ComplementNode, scope: Scope): - pass - - @visitor.when(ast.IsVoidNode) - def visit(self, node: ast.IsVoidNode, scope: Scope): - pass - - @visitor.when(ast.PlusNode) - def visit(self, node: ast.PlusNode, scope: Scope): - pass - - @visitor.when(ast.MinusNode) - def visit(self, node: ast.MinusNode, scope: Scope): - pass - - @visitor.when(ast.StarNode) - def visit(self, node: ast.StarNode, scope: Scope): - pass - - @visitor.when(ast.DivNode) - def visit(self, node: ast.DivNode, scope: Scope): - pass - - @visitor.when(ast.LessEqualNode) - def visit(self, node: ast.LessEqualNode, scope: Scope): - pass - - @visitor.when(ast.LessThanNode) - def visit(self, node: ast.LessThanNode, scope: Scope): - pass - - @visitor.when(ast.EqualNode) - def visit(self, node: ast.EqualNode, scope: Scope): - pass diff --git a/semantics/__init__.py b/semantics/__init__.py new file mode 100644 index 000000000..10d20b45c --- /dev/null +++ b/semantics/__init__.py @@ -0,0 +1,10 @@ +"""This module contains definitions of classes for make different travels through the AST of a cool program. All +classes defined here follows the visitor pattern using the module visitor, with this we can get a more decoupled +inspection. """ + +from semantics.collector import TypeCollector +from semantics.builder import TypeBuilder +from semantics.overridden import OverriddenMethodChecker, topological_ordering +from semantics.selftype import SelfTypeReplacement +from semantics.type_checker import TypeChecker +from semantics.formatter import Formatter diff --git a/astnodes.py b/semantics/astnodes.py similarity index 100% rename from astnodes.py rename to semantics/astnodes.py diff --git a/semantics/builder.py b/semantics/builder.py new file mode 100644 index 000000000..77c30ce98 --- /dev/null +++ b/semantics/builder.py @@ -0,0 +1,77 @@ +from typing import List, Optional + +import semantics.astnodes as ast +import semantics.visitor as visitor +from semantics.scope import Context, SemanticError, Type, ErrorType + + +class TypeBuilder: + """This visitor collect all the attributes and methods in classes and set the parent to the current class + + Params + ------ + - errors: List[str] is a list of errors detected in the ast travel + - context: Context the context for keeping the classes + - current_type: Optional[Type] is the current type in the building process""" + + def __init__(self, context: Context, errors: List[str]): + self.context: Context = context + self.current_type: Optional[Type] = None + self.errors: List[str] = errors + + @visitor.on('node') + def visit(self, node): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode): + for declaration in node.declarations: + self.visit(declaration) + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode): + self.current_type = self.context.get_type(node.id) + + if node.parent is not None: + if node.parent in ("Int", "String", "Bool", "SELF_TYPE"): + self.errors.append('Can not inherits from "Int", "String" or "Bool".') + + try: + self.current_type.set_parent(self.context.get_type(node.parent)) + except SemanticError as e: + self.errors.append(e.text) + else: + self.current_type.set_parent(self.context.get_type('Object')) + + for feature in node.features: + self.visit(feature) + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode): + try: + name = node.id + typex = self.context.get_type(node.type) + self.current_type.define_attribute(name, typex) + except SemanticError as e: + self.errors.append(e.text) + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode): + name = node.id + param_names = ['self'] + param_types = [self.current_type] + for name, typex in node.params: + param_names.append(name) + try: + param_types.append(self.context.get_type(name)) + except SemanticError as e: + param_types.append(ErrorType()) + self.errors.append(e.text) + + try: + return_type = self.context.get_type(node.return_type) + except SemanticError as e: + return_type = ErrorType() + self.errors.append(e.text) + + self.current_type.define_method(name, param_names, param_types, return_type) diff --git a/semantics/collector.py b/semantics/collector.py new file mode 100644 index 000000000..4a8d3bafa --- /dev/null +++ b/semantics/collector.py @@ -0,0 +1,60 @@ +from typing import List + +import semantics.astnodes as ast +import semantics.visitor as visitor +from semantics.scope import Context, SemanticError + + +class TypeCollector: + """Visitor to collect the class in the program, and the basic classes as Object, Int, String, IO and Bool + + Params + ---------- + - errors: List[str] is a list of errors detected in the ast travel + - context: Context the context for keeping the classes""" + + def __init__(self, context: Context = Context(), errors: List[str] = []): + self.errors: List[str] = errors + self.context: Context = context + + @visitor.on('node') + def visit(self, node): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node): + self.context.create_type('AUTO_TYPE') + self_type = self.context.create_type('SELF_TYPE') + object_type = self.context.create_type('Object') + io_type = self.context.create_type('IO') + string_type = self.context.create_type('String') + int_type = self.context.create_type('Int') + bool_type = self.context.create_type('Bool') + + io_type.set_parent(object_type) + string_type.set_parent(object_type) + int_type.set_parent(object_type) + bool_type.set_parent(object_type) + + object_type.define_method('abort', ['self'], [self_type], object_type) + object_type.define_method('get_type', ['self'], [self_type], string_type) + object_type.define_method('copy', ['self'], [self_type], self_type) + + io_type.define_method('out_string', ['self', 'x'], [self_type, string_type], self_type) + io_type.define_method('out_int', ['self', 'x'], [self_type, string_type], self_type) + io_type.define_method('in_string', ['self'], [self_type], string_type) + io_type.define_method('in_int', ['self'], [self_type], int_type) + + string_type.define_method('length', ['self'], [self_type], int_type) + string_type.define_method('concat', ['self', 's'], [self_type, string_type], string_type) + string_type.define_method('substr', ['self', 'i', 'l'], [self_type, int_type, int_type], string_type) + + for declaration in node.declarations: + self.visit(declaration) + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node): + try: + self.context.create_type(node.id) + except SemanticError as e: + self.errors.append(e.text) diff --git a/semantics/formatter.py b/semantics/formatter.py new file mode 100644 index 000000000..870d5b0f8 --- /dev/null +++ b/semantics/formatter.py @@ -0,0 +1,120 @@ +import semantics.astnodes as ast +import semantics.visitor as visitor + + +class Formatter: + @visitor.on('node') + def visit(self, node, tabs): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode, tabs: int = 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(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode, tabs: int = 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(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode, tabs: int = 0): + ans = '\t' * tabs + f'\\__AttrDeclarationNode: {node.id} : {node.type}' + return f'{ans}' + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode, tabs: int = 0): + params = ', '.join(':'.join(param) for param in node.params) + ans = '\t' * tabs + f'\\__FuncDeclarationNode: {node.id}({params}) : {node.return_type} -> ' + body = self.visit(node.body, tabs + 1) + return f'{ans}\n{body}' + + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode, tabs: int = 0): + declarations = '\n'.join(self.visit(declaration, tabs + 1) for declaration in node.declarations) + ans = '\t' * tabs + f'\\__LetNode: let' + expr = self.visit(node.expr, tabs + 2) + return f'{ans}\n {declarations}\n' + '\t' * (tabs + 1) + 'in\n' + f'{expr}' + + @visitor.when(ast.VarDeclarationNode) + def visit(self, node: ast.VarDeclarationNode, tabs: int = 0): + if node.expr is not None: + return '\t' * tabs + f'\\__VarDeclarationNode: {node.id}: {node.type} <-\n{self.visit(node.expr, tabs + 1)}' + else: + return '\t' * tabs + f'\\__VarDeclarationNode: {node.id} : {node.type}' + + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode, tabs: int = 0): + ans = '\t' * tabs + f'\\__AssignNode: {node.id} <- ' + expr = self.visit(node.expr, tabs + 1) + return f'{ans}\n{expr}' + + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode, tabs: int = 0): + ans = '\t' * tabs + f'\\__BlockNode:' + body = '\n'.join(self.visit(child, tabs + 1) for child in node.expressions) + return f'{ans}\n{body}' + + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode, tabs: int = 0): + ifx = self.visit(node.if_expr, tabs + 2) + then = self.visit(node.then_expr, tabs + 2) + elsex = self.visit(node.else_expr, tabs + 2) + + return '\n'.join([ + '\t' * tabs + f'\\__IfThenElseNode: if then else fi', + '\t' * (tabs + 1) + f'\\__if \n{ifx}', + '\t' * (tabs + 1) + f'\\__then \n{then}', + '\t' * (tabs + 1) + f'\\__else \n{elsex}', + ]) + + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode, tabs: int = 0): + condition = self.visit(node.condition, tabs + 2) + body = self.visit(node.body, tabs + 2) + + return '\n'.join([ + '\t' * tabs + f'\\__WhileNode: while loop pool', + '\t' * (tabs + 1) + f'\\__while \n{condition}', + '\t' * (tabs + 1) + f'\\__loop \n{body}', + ]) + + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode, tabs: int = 0): + expr = self.visit(node.expr, tabs + 2) + cases = '\n'.join(self.visit(case, tabs + 3) for case in node.cases) + + return '\n'.join([ + '\t' * tabs + f'\\__SwitchCaseNode: case of [ ... ] esac', + '\t' * (tabs + 1) + f'\\__case \n{expr} of', + ]) + '\n' + cases + + @visitor.when(ast.CaseNode) + def visit(self, node: ast.CaseNode, tabs: int = 0): + expr = self.visit(node.expr, tabs + 1) + return '\t' * tabs + f'\\__CaseNode: {node.id} : {node.type} =>\n{expr}' + + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode, tabs: int = 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(ast.BinaryNode) + def visit(self, node: ast.BinaryNode, tabs: int = 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(ast.AtomicNode) + def visit(self, node: ast.AtomicNode, tabs: int = 0): + return '\t' * tabs + f'\\__ {node.__class__.__name__}: {node.lex}' + + @visitor.when(ast.InstantiateNode) + def visit(self, node: ast.InstantiateNode, tabs: int = 0): + return '\t' * tabs + f'\\__ InstantiateNode: new {node.lex}()' diff --git a/semantics/overridden.py b/semantics/overridden.py new file mode 100644 index 000000000..d9db87b83 --- /dev/null +++ b/semantics/overridden.py @@ -0,0 +1,101 @@ +from typing import List, Dict, Optional + +import semantics.astnodes as ast +import semantics.visitor as visitor +from semantics.scope import Context, Type + + +def topological_ordering(program_node: ast.ProgramNode, + context: Context, + errors: List[str]) -> ast.ProgramNode: + """Set an order in the program node of de ast such that for all class A with parent B, class B is before A in the + list, if in the process is detected a cycle an error is added to the `error` parameter + + :param program_node: Root of the first AST of the program + + :param context: Context With all collected and building types + + :param errors: The error list + + :return: a new AST where all declared class are in topological order""" + + types = context.types + + graph: Dict[str, List[str]] = {name: [] for name in types} + + for name, typex in types.items(): + if name in ('Object', 'SELF_TYPE', 'AUTO_TYPE'): + continue + graph[typex.parent.name].append(name) + + order = [] + visited = {name: False for name in graph} + stack = ['Object'] + + while stack: + current_name = stack.pop() + + if visited[current_name]: + errors.append(f'Cyclic class hierarchy in class {current_name}.') + + visited[current_name] = True + stack += graph[current_name] + order.append(current_name) + + declarations = {d.id: d for d in program_node.declarations} + program_node.declarations = [declarations[name] for name in order if + name not in ('Object', 'Int', 'IO', 'String', 'Bool')] + + return program_node + + +class OverriddenMethodChecker: + """This visitor for validate the signature of the overridden methods + + Params + ------ + - errors: List[str] is a list of errors detected in the ast travel + - context: Context the context for keeping the classes + - current_type: Optional[Type] is the current type in the building process""" + + def __init__(self, context: Context, errors: List[str]): + self.context: Context = context + self.current_type: Optional[Type] = None + self.errors: List[str] = errors + + @visitor.on('node') + def visit(self, node): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode): + for declaration in node.declarations: + self.visit(declaration) + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode): + self.current_type = self.context.get_type(node.id) + + for feature in node.features: + if isinstance(feature, ast.MethodDeclarationNode): + self.visit(feature) + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode): + # At this point all class has defined a parent and they are visited in topological order + + method, owner = self.current_type.get_method(node.id, get_owner=True) + + if owner == self.current_type: + return + + if len(method.param_types) != len(node.params) + 1: + self.errors.append(WRONG_SIGNATURE % (method.name, owner.name)) + + for parent_param_type, (_, current_param_type_name) in zip(method.param_types[1:], node.params): + if parent_param_type != self.context.get_type(current_param_type_name): + self.errors.append(WRONG_SIGNATURE % (method.name, owner.name)) + break + + if method.return_type != self.context.get_type(node.return_type): + self.errors.append(WRONG_SIGNATURE % (method.name, owner.name)) diff --git a/semantics/progam_executor.py b/semantics/progam_executor.py new file mode 100644 index 000000000..509fca29e --- /dev/null +++ b/semantics/progam_executor.py @@ -0,0 +1,129 @@ +from typing import List + +import semantics.astnodes as ast +import semantics.visitor as visitor +from semantics.scope import Context, Type, Method, Scope + + +class Executor: + def __init__(self, context: Context, errors: List[str] = []): + self.context: Context = context + self.errors: List[str] = errors + self.current_type: Type = None + self.current_method: Method = None + + @visitor.on('node') + def visit(self, node, tabs): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode, scope: Scope = None): + pass + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode, scope: Scope): + pass + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode, scope: Scope): + pass + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode, scope: Scope): + pass + + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode, scope: Scope): + pass + + @visitor.when(ast.VarDeclarationNode) + def visit(self, node: ast.VarDeclarationNode, scope: Scope): + pass + + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode, scope: Scope): + pass + + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode, scope: Scope): + pass + + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode, scope: Scope): + pass + + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode, scope: Scope): + pass + + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode, scope: Scope): + pass + + @visitor.when(ast.CaseNode) + def visit(self, node: ast.CaseNode, scope: Scope): + pass + + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode, scope: Scope): + pass + + @visitor.when(ast.IntegerNode) + def visit(self, node: ast.IntegerNode, scope: Scope): + pass + + @visitor.when(ast.StringNode) + def visit(self, node: ast.StringNode, scope: Scope): + pass + + @visitor.when(ast.BooleanNode) + def visit(self, node: ast.BooleanNode, scope: Scope): + pass + + @visitor.when(ast.VariableNode) + def visit(self, node: ast.VariableNode, scope: Scope): + pass + + @visitor.when(ast.InstantiateNode) + def visit(self, node: ast.InstantiateNode, scope: Scope): + pass + + @visitor.when(ast.NegationNode) + def visit(self, node: ast.NegationNode, scope: Scope): + pass + + @visitor.when(ast.ComplementNode) + def visit(self, node: ast.ComplementNode, scope: Scope): + pass + + @visitor.when(ast.IsVoidNode) + def visit(self, node: ast.IsVoidNode, scope: Scope): + pass + + @visitor.when(ast.PlusNode) + def visit(self, node: ast.PlusNode, scope: Scope): + pass + + @visitor.when(ast.MinusNode) + def visit(self, node: ast.MinusNode, scope: Scope): + pass + + @visitor.when(ast.StarNode) + def visit(self, node: ast.StarNode, scope: Scope): + pass + + @visitor.when(ast.DivNode) + def visit(self, node: ast.DivNode, scope: Scope): + pass + + @visitor.when(ast.LessEqualNode) + def visit(self, node: ast.LessEqualNode, scope: Scope): + pass + + @visitor.when(ast.LessThanNode) + def visit(self, node: ast.LessThanNode, scope: Scope): + pass + + @visitor.when(ast.EqualNode) + def visit(self, node: ast.EqualNode, scope: Scope): + pass diff --git a/scope.py b/semantics/scope.py similarity index 99% rename from scope.py rename to semantics/scope.py index f6b4492c7..12ed82cbb 100755 --- a/scope.py +++ b/semantics/scope.py @@ -89,7 +89,7 @@ def get_method(self, name: str, get_owner: bool = False) -> Union[Method, Tuple[ """ try: return self.methods[name] if not get_owner else (self.methods[name], self) - except StopIteration: + except KeyError: if self.parent is None: raise SemanticError(f'Method "{name}" is not defined in {self.name}.') try: diff --git a/semantics/selftype.py b/semantics/selftype.py new file mode 100644 index 000000000..1a585cb61 --- /dev/null +++ b/semantics/selftype.py @@ -0,0 +1,144 @@ +from typing import List, Optional + +import semantics.astnodes as ast +import semantics.visitor as visitor +from semantics.scope import Context, Type, Method, ErrorType + + +class SelfTypeReplacement: + """Check that `SELF_TYPE` is used correctly and replace every match with the correspondent class type. + + The principal method visit return a new AST with all the SELF_TYPE replaced by it's correspondent class name, + all the definitions of SELF_TYPE in the Type definition where be overridden. + Params + ------ + - errors: List[str] is a list of errors detected in the ast travel + - context: Context the context for keeping the classes + - current_type: Optional[Type] is the current type in the building process""" + + def __init__(self, context: Context, errors: List[str]): + self.context: Context = context + self.errors: List[str] = errors + self.current_type: Optional[Type] = None + self.current_method: Optional[Method] = None + + @visitor.on('node') + def visit(self, node): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode): + return ast.ProgramNode([self.visit(declaration) for declaration in node.declarations]) + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode): + self.current_type = self.context.get_type(node.id) + + if node.parent is not None and node.parent == 'SELF_TYPE': + self.errors.append(f'Invalid use of "SELF_TYPE" as parent of class "{node.id}"') + + features = [self.visit(feature) for feature in node.features] + + return ast.ClassDeclarationNode(node.id, features, node.parent) + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode): + typex = node.type + if typex == 'SELF_TYPE': + typex = self.current_type.name + self.current_type.get_attribute(node.id).type = self.current_type + + expr = self.visit(node.expr) if node.expr is not None else None + + return ast.AttrDeclarationNode(node.id, typex, expr) + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode): + self.current_method = self.current_type.get_method(node.id) + + self.current_method.param_types[0] = self.current_type + + for i, (_, param_type) in enumerate(node.params, 1): + if param_type == 'SELF_TYPE': + self.errors.append('The static type of a param cannot be "SELF_TYPE"') + self.current_method.param_types[i] = ErrorType() # Change the static type to "ErrorType" + + if node.return_type == 'SELF_TYPE': + self.current_method.return_type = self.current_type + + expr = self.visit(node.body) + + return ast.MethodDeclarationNode(node.id, node.params, self.current_method.return_type.name, expr) + + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode): + return ast.LetNode([self.visit(declaration) for declaration in node.declarations], self.visit(node.expr)) + + @visitor.when(ast.VarDeclarationNode) + def visit(self, node: ast.VarDeclarationNode): + typex = self.current_type.name if node.type == 'SELF_TYPE' else node.type + expr = self.visit(node.expr) if node.expr is not None else None + return ast.VarDeclarationNode(node.id, typex, expr) + + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode): + return ast.AssignNode(node.id, self.visit(node.expr)) + + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode): + return ast.BlockNode([self.visit(expr) for expr in node.expressions]) + + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode): + return ast.ConditionalNode(self.visit(node.if_expr), self.visit(node.then_expr), self.visit(node.else_expr)) + + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode): + return ast.WhileNode(self.visit(node.condition), self.visit(node.body)) + + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode): + expr = self.visit(node.expr) + cases = [self.visit(case) for case in node.cases] + return ast.SwitchCaseNode(expr, cases) + + @visitor.when(ast.CaseNode) + def visit(self, node: ast.CaseNode): + if node.type == 'SELF_TYPE': + self.errors.append('SELF_TYPE cannot be used as branch type in a case expression') + return ast.CaseNode(node.id, node.type, self.visit(node.expr)) + + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode): + obj = self.visit(node.obj) if node.obj is not None else ast.VariableNode('self') + args = [self.visit(arg) for arg in node.args] + return ast.MethodCallNode(node.id, args, obj, node.type) + + @visitor.when(ast.IntegerNode) + def visit(self, node: ast.IntegerNode): + return node + + @visitor.when(ast.StringNode) + def visit(self, node: ast.StringNode): + return node + + @visitor.when(ast.BooleanNode) + def visit(self, node: ast.BooleanNode): + return node + + @visitor.when(ast.VariableNode) + def visit(self, node: ast.VariableNode): + return node + + @visitor.when(ast.InstantiateNode) + def visit(self, node: ast.InstantiateNode): + node.lex = node.lex if node.lex != 'SELF_TYPE' else self.current_type.name + return node + + @visitor.when(ast.UnaryNode) + def visit(self, node: ast.UnaryNode): + return type(node)(self.visit(node.expr)) + + @visitor.when(ast.BinaryNode) + def visit(self, node: ast.BinaryNode): + return type(node)(self.visit(node.left), self.visit(node.right)) diff --git a/semantics/semantic_errors.py b/semantics/semantic_errors.py new file mode 100644 index 000000000..b6af16f06 --- /dev/null +++ b/semantics/semantic_errors.py @@ -0,0 +1,12 @@ +WRONG_SIGNATURE = 'Method "%s" already defined in "%s" with a different signature.' +SELF_IS_READONLY = 'Variable "self" is read-only.' +SELF_INVALID_ATTRIBUTE_ID = 'Cannot set "self" as attribute of a class.' +SELF_INVALID_PARAM_ID = 'Cannot set "self" as parameter of a method.' +INVALID_INHERIT_CLASS = 'Can not inherits from "Int", "String", "Bool".' +OVERRIDE_ATTRIBUTE_ID = 'Attributes cannot be override in derived class' +LOCAL_ALREADY_DEFINED = 'Variable "%s" is already defined in method "%s".' +INCOMPATIBLE_TYPES = 'Cannot convert "%s" into "%s".' +VARIABLE_NOT_DEFINED = 'Variable "%s" is not defined in "%s".' +INVALID_BINARY_OPERATION = 'Operation "%s" is not defined between "%s" and "%s".' +INVALID_UNARY_OPERATION = 'Operation "%s" is not defined for "%s".' +INVALID_ANCESTOR = 'Class "%s" has no an ancestor class "%s".' diff --git a/semantics/type_checker.py b/semantics/type_checker.py new file mode 100644 index 000000000..bd8c4e691 --- /dev/null +++ b/semantics/type_checker.py @@ -0,0 +1,276 @@ +from typing import List + +import semantics.astnodes as ast +import semantics.semantic_errors as err +import semantics.visitor as visitor +from semantics.scope import Context, SemanticError, Type, Method, Scope, ErrorType + + +class TypeChecker: + def __init__(self, context: Context, errors: List[str]): + self.context: Context = context + self.errors: List[str] = errors + self.current_type: Type = None + self.current_method: Method = None + + @visitor.on('node') + def visit(self, node, scope): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode, scope: Scope = None): + if scope is None: + scope = Scope() + + for elem in node.declarations: + self.visit(elem, scope.create_child()) + + return scope + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode, scope: Scope): + self.current_type = self.context.get_type(node.id) + + attrs = [feature for feature in node.features if isinstance(feature, ast.AttrDeclarationNode)] + methods = [feature for feature in node.features if isinstance(feature, ast.MethodDeclarationNode)] + + for attr in attrs: + self.visit(attr, scope) + + for method in methods: + self.visit(method, scope.create_child()) + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode, scope: Scope): + if node.id == 'self': + self.errors.append(err.SELF_INVALID_ATTRIBUTE_ID) + + attr_type = self.context.get_type(node.type) + + if node.expr is not None: + expr_type = self.visit(node.expr, scope.create_child()) + if not expr_type.conforms_to(attr_type): + self.errors.append(err.INCOMPATIBLE_TYPES % (expr_type.name, attr_type.name)) + + scope.define_variable(node.id, attr_type) + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode, scope: Scope): + self.current_method = self.current_type.get_method(node.id) + + # Defining parameters in the scope. Parameters can hide the attribute declaration, that's why we are not + # checking if there is defined, instead we are checking for local declaration + for i, (name, expr_body_type) in enumerate(node.params): + if not scope.is_local(name): + scope.define_variable(name, self.context.get_type(expr_body_type)) + else: + self.errors.append(err.LOCAL_ALREADY_DEFINED % (name, self.current_method.name)) + + return_type = self.context.get_type(node.return_type) + + expr_body_type = self.visit(node.body, scope) + + if not expr_body_type.conforms_to(return_type): + self.errors.append(err.INCOMPATIBLE_TYPES % (expr_body_type.name, return_type.name)) + + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode, scope: Scope): + for elem in node.declarations: + self.visit(elem, scope) + return self.visit(node.expr, scope.create_child()) + + @visitor.when(ast.VarDeclarationNode) + def visit(self, node: ast.VarDeclarationNode, scope: Scope): + try: + var_static_type = self.context.get_type(node.type) + except SemanticError as e: + var_static_type = ErrorType() + self.errors.append(e.text) + + if scope.is_local(node.id): + self.errors.append(err.LOCAL_ALREADY_DEFINED % (node.id, self.current_method.name)) + else: + scope.define_variable(node.id, var_static_type) + + if node.expr is not None: + expr_type = self.visit(node.expr, scope) + if not (expr_type.conforms_to(var_static_type)): + self.errors.append(err.INCOMPATIBLE_TYPES % (expr_type.name, var_static_type.name)) + + return var_static_type + + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode, scope: Scope): + expr_type = self.visit(node.expr, scope) + var_info = scope.find_variable(node.id) + if var_info is None: + self.errors.append(err.VARIABLE_NOT_DEFINED % (node.id, self.current_method.name)) + return ErrorType() + else: + if not expr_type.conforms_to(var_info.type): + self.errors.append(err.INCOMPATIBLE_TYPES % (expr_type.name, var_info.type.name)) + return var_info.type + + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode, scope: Scope): + return_type = ErrorType() + for expr in node.expressions: + return_type = self.visit(expr, scope) + return return_type + + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode, scope: Scope): + if_type = self.visit(node.if_expr, scope) + then_type = self.visit(node.then_expr, scope) + else_type = self.visit(node.else_expr, scope) + if if_type != self.context.get_type('Bool'): + self.errors.append(err.INCOMPATIBLE_TYPES % (if_type.name, 'Bool')) + return then_type.join(else_type) + + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode, scope: Scope): + condition = self.visit(node.condition, scope) + if condition != self.context.get_type('Bool'): + self.errors.append(err.INCOMPATIBLE_TYPES % (condition.name, 'Bool')) + + self.visit(node.body) + return self.context.get_type('Object') + + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode, scope: Scope): + self.visit(node.expr, scope) + return Type.multi_join([self.visit(case, scope.create_child()) for case in node.cases]) + + @visitor.when(ast.CaseNode) + def visit(self, node: ast.CaseNode, scope: Scope): + try: + scope.define_variable(node.id, self.context.get_type(node.type)) + except SemanticError as e: + scope.define_variable(node.id, ErrorType()) + self.errors.append(e.text) + + return self.visit(node.expr, scope) + + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode, scope: Scope): + obj_type = self.visit(node.obj, scope) + + if node.type is not None: + try: + ancestor_type = self.context.get_type(node.type) + except SemanticError as e: + ancestor_type = ErrorType() + self.errors.append(e.text) + + if not obj_type.conforms_to(ancestor_type): + self.errors.append(err.INVALID_ANCESTOR % (obj_type.name, ancestor_type.name)) + else: + ancestor_type = obj_type + + try: + method = ancestor_type.get_method(node.id) + except SemanticError as e: + self.errors.append(e.text) + for arg in node.args: + self.visit(arg, scope) + return ErrorType() + + if len(node.args) + 1 != len(method.param_names): + self.errors.append(err.WRONG_SIGNATURE % (method.name, obj_type.name)) + + if not obj_type.conforms_to(method.param_types[0]): + self.errors.append(err.INCOMPATIBLE_TYPES % (obj_type.name, method.param_types[0].name)) + + for i, arg in enumerate(node.args, 1): + arg_type = self.visit(arg, scope) + if not arg_type.conforms_to(method.param_types[i]): + self.errors.append(err.INCOMPATIBLE_TYPES % (arg_type.name, method.param_types[i].name)) + + return method.return_type + + @visitor.when(ast.IntegerNode) + def visit(self, node: ast.IntegerNode, scope: Scope): + return self.context.get_type('Int') + + @visitor.when(ast.StringNode) + def visit(self, node: ast.StringNode, scope: Scope): + return self.context.get_type('String') + + @visitor.when(ast.BooleanNode) + def visit(self, node: ast.BooleanNode, scope: Scope): + return self.context.get_type('Bool') + + @visitor.when(ast.VariableNode) + def visit(self, node: ast.VariableNode, scope: Scope): + variable = scope.find_variable(node.lex) + if variable is None: + self.errors.append(err.VARIABLE_NOT_DEFINED % (node.lex, self.current_method.name)) + return ErrorType() + return variable.type + + @visitor.when(ast.InstantiateNode) + def visit(self, node: ast.InstantiateNode, scope: Scope): + try: + return self.context.get_type(node.lex) + except SemanticError as e: + self.errors.append(e.text) + return ErrorType() + + @visitor.when(ast.NegationNode) + def visit(self, node: ast.NegationNode, scope: Scope): + return self._check_unary_operation(node, scope, 'not', self.context.get_type('Bool')) + + @visitor.when(ast.ComplementNode) + def visit(self, node: ast.ComplementNode, scope: Scope): + return self._check_unary_operation(node, scope, '~', self.context.get_type('Int')) + + @visitor.when(ast.IsVoidNode) + def visit(self, node: ast.IsVoidNode, scope: Scope): + self.visit(node.expr, scope) + return self.context.get_type('Bool') + + @visitor.when(ast.PlusNode) + def visit(self, node: ast.PlusNode, scope: Scope): + return self._check_int_binary_operation(node, scope, '+', self.context.get_type('Int')) + + @visitor.when(ast.MinusNode) + def visit(self, node: ast.MinusNode, scope: Scope): + return self._check_int_binary_operation(node, scope, '-', self.context.get_type('Int')) + + @visitor.when(ast.StarNode) + def visit(self, node: ast.StarNode, scope: Scope): + return self._check_int_binary_operation(node, scope, '*', self.context.get_type('Int')) + + @visitor.when(ast.DivNode) + def visit(self, node: ast.DivNode, scope: Scope): + return self._check_int_binary_operation(node, scope, '/', self.context.get_type('Int')) + + @visitor.when(ast.LessEqualNode) + def visit(self, node: ast.LessEqualNode, scope: Scope): + return self._check_int_binary_operation(node, scope, '<=', self.context.get_type('Bool')) + + @visitor.when(ast.LessThanNode) + def visit(self, node: ast.LessThanNode, scope: Scope): + return self._check_int_binary_operation(node, scope, '<', self.context.get_type('Bool')) + + @visitor.when(ast.EqualNode) + def visit(self, node: ast.EqualNode, scope: Scope): + self.visit(node.left, scope) + self.visit(node.right, scope) + return self.context.get_type('Bool') + + def _check_int_binary_operation(self, node: ast.BinaryNode, scope: Scope, operation: str, return_type: Type): + left_type = self.visit(node.left, scope) + right_type = self.visit(node.right, scope) + + if left_type == right_type == self.context.get_type('Int'): + return return_type + self.errors.append(err.INVALID_BINARY_OPERATION % (operation, left_type.name, right_type.name)) + return ErrorType() + + def _check_unary_operation(self, node: ast.UnaryNode, scope: Scope, operation: str, expected_type: Type): + typex = self.visit(node.expr, scope) + if typex == expected_type: + return typex + self.errors.append(err.INVALID_UNARY_OPERATION % (operation, typex.name)) + return ErrorType() diff --git a/semantics/type_inference.py b/semantics/type_inference.py new file mode 100644 index 000000000..33be9b1d4 --- /dev/null +++ b/semantics/type_inference.py @@ -0,0 +1,129 @@ +from typing import List + +import semantics.astnodes as ast +import semantics.visitor as visitor +from semantics.scope import Context, Type, Method, Scope + + +class InferenceTypeChecker: + def __init__(self, context: Context, errors: List[str] = []): + self.context: Context = context + self.errors: List[str] = errors + self.current_type: Type = None + self.current_method: Method = None + + @visitor.on('node') + def visit(self, node, tabs): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode, scope: Scope = None): + pass + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode, scope: Scope): + pass + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode, scope: Scope): + pass + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode, scope: Scope): + pass + + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode, scope: Scope): + pass + + @visitor.when(ast.VarDeclarationNode) + def visit(self, node: ast.VarDeclarationNode, scope: Scope): + pass + + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode, scope: Scope): + pass + + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode, scope: Scope): + pass + + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode, scope: Scope): + pass + + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode, scope: Scope): + pass + + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode, scope: Scope): + pass + + @visitor.when(ast.CaseNode) + def visit(self, node: ast.CaseNode, scope: Scope): + pass + + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode, scope: Scope): + pass + + @visitor.when(ast.IntegerNode) + def visit(self, node: ast.IntegerNode, scope: Scope): + pass + + @visitor.when(ast.StringNode) + def visit(self, node: ast.StringNode, scope: Scope): + pass + + @visitor.when(ast.BooleanNode) + def visit(self, node: ast.BooleanNode, scope: Scope): + pass + + @visitor.when(ast.VariableNode) + def visit(self, node: ast.VariableNode, scope: Scope): + pass + + @visitor.when(ast.InstantiateNode) + def visit(self, node: ast.InstantiateNode, scope: Scope): + pass + + @visitor.when(ast.NegationNode) + def visit(self, node: ast.NegationNode, scope: Scope): + pass + + @visitor.when(ast.ComplementNode) + def visit(self, node: ast.ComplementNode, scope: Scope): + pass + + @visitor.when(ast.IsVoidNode) + def visit(self, node: ast.IsVoidNode, scope: Scope): + pass + + @visitor.when(ast.PlusNode) + def visit(self, node: ast.PlusNode, scope: Scope): + pass + + @visitor.when(ast.MinusNode) + def visit(self, node: ast.MinusNode, scope: Scope): + pass + + @visitor.when(ast.StarNode) + def visit(self, node: ast.StarNode, scope: Scope): + pass + + @visitor.when(ast.DivNode) + def visit(self, node: ast.DivNode, scope: Scope): + pass + + @visitor.when(ast.LessEqualNode) + def visit(self, node: ast.LessEqualNode, scope: Scope): + pass + + @visitor.when(ast.LessThanNode) + def visit(self, node: ast.LessThanNode, scope: Scope): + pass + + @visitor.when(ast.EqualNode) + def visit(self, node: ast.EqualNode, scope: Scope): + pass diff --git a/visitor.py b/semantics/visitor.py similarity index 100% rename from visitor.py rename to semantics/visitor.py diff --git a/tester.py b/tester.py index 50e7de48d..e1d8f7045 100755 --- a/tester.py +++ b/tester.py @@ -6,7 +6,7 @@ from cmp.lexing import Token from lexer import CoolLexer from parser import CoolParser -from semantic import Formatter +from semantics.semantic import Formatter lexer = CoolLexer() parser = CoolParser() From 6f8925b87429dbbf91edf4ca53419def00e09d25 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Sun, 3 May 2020 22:27:14 -0400 Subject: [PATCH 034/143] security save --- main.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/main.py b/main.py index 373c9594b..d4c76cf64 100755 --- a/main.py +++ b/main.py @@ -10,9 +10,7 @@ class Main inherits IO { out_string("Hello, World.\n") }; - function(): SELF_TYPE { - 0 - }; + function(): SELF_TYPE { 0 }; } """ From a10705580f5bf0661e4d05695df14cd9ee894dbe Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Mon, 4 May 2020 02:38:09 -0400 Subject: [PATCH 035/143] Created "methods_list" and "attribute_list" fields in class "Type" --- semantics/scope.py | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/semantics/scope.py b/semantics/scope.py index 12ed82cbb..55d8aaab2 100755 --- a/semantics/scope.py +++ b/semantics/scope.py @@ -40,8 +40,10 @@ def __eq__(self, other): class Type: def __init__(self, name: str): self.name: str = name - self.attributes: Dict[str, Attribute] = {} - self.methods: Dict[str, Method] = {} + self.attributes_list: List[Attribute] = [] + self.methods_list: List[Method] = [] + self.attributes_dict: Dict[str, Attribute] = {} + self.methods_dict: Dict[str, Method] = {} self.parent: Optional['Type'] = None def set_parent(self, parent: 'Type') -> None: @@ -51,7 +53,7 @@ def set_parent(self, parent: 'Type') -> None: def get_attribute(self, name: str) -> Attribute: try: - return self.attributes[name] + return self.attributes_dict[name] except KeyError: if self.parent is None: raise SemanticError(f'Attribute "{name}" is not defined in {self.name}.') @@ -65,13 +67,14 @@ def define_attribute(self, name: str, typex: 'Type') -> Attribute: self.get_attribute(name) except SemanticError: attribute = Attribute(name, typex) - self.attributes[name] = attribute + self.attributes_list.append(attribute) + self.attributes_dict[name] = attribute return attribute else: raise SemanticError(f'Attribute "{name}" is already defined in {self.name}.') def contains_attribute(self, name: str) -> bool: - return name in self.attributes or (self.parent is not None and self.parent.contains_attribute(name)) + return name in self.attributes_dict or self.parent is not None and self.parent.contains_attribute(name) def get_method(self, name: str, get_owner: bool = False) -> Union[Method, Tuple[Method, 'Type']]: """ @@ -88,7 +91,7 @@ def get_method(self, name: str, get_owner: bool = False) -> Union[Method, Tuple[ :return: the desired method and it's optional type owner. """ try: - return self.methods[name] if not get_owner else (self.methods[name], self) + return self.methods_dict[name] if not get_owner else (self.methods_dict[name], self) except KeyError: if self.parent is None: raise SemanticError(f'Method "{name}" is not defined in {self.name}.') @@ -101,24 +104,25 @@ def define_method(self, name: str, param_names: List[str], param_types: List['Type'], return_type: 'Type') -> Method: - if name in self.methods: + if name in self.methods_dict: raise SemanticError(f'Method "{name}" already defined in {self.name}') method = Method(name, param_names, param_types, return_type) - self.methods[name] = method + self.methods_list.append(method) + self.methods_dict[name] = method return method def contains_method(self, name) -> bool: - return name in self.methods or (self.parent is not None and self.parent.contains_method(name)) + return name in self.methods_dict or (self.parent is not None and self.parent.contains_method(name)) def all_attributes(self) -> List[Tuple[Attribute, 'Type']]: attributes = [] if self.parent is None else self.parent.all_attributes() - attributes += [(a, self) for a in self.attributes.values()] + attributes += [(x, self) for x in self.attributes_list] return attributes def all_methods(self) -> List[Tuple[Method, 'Type']]: methods = [] if self.parent is None else self.parent.all_methods() - methods += [(m, self) for m in self.methods.values()] + methods += [(x, self) for x in self.methods_list] return methods def conforms_to(self, other: 'Type') -> bool: @@ -154,11 +158,11 @@ def __str__(self): parent = '' if self.parent is None else f' : {self.parent.name}' output += parent output += ' {' - output += '\n\t' if self.attributes or self.methods else '' - output += '\n\t'.join(str(x) for x in self.attributes) - output += '\n\t' if self.attributes else '' - output += '\n\t'.join(str(x) for x in self.methods) - output += '\n' if self.methods else '' + output += '\n\t' if self.attributes_dict or self.methods_dict else '' + output += '\n\t'.join(str(x) for x in self.attributes_dict) + output += '\n\t' if self.attributes_dict else '' + output += '\n\t'.join(str(x) for x in self.methods_dict) + output += '\n' if self.methods_dict else '' output += '}\n' return output From e8d76657181c594775f9c99999707225aa5eaaed Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Tue, 5 May 2020 12:47:44 -0400 Subject: [PATCH 036/143] TypeChecker in beta version --- cmp/serialization.py | 21 +- grammar.py | 42 +- lexer.py | 2 +- main.py | 22 +- parser.py | 2470 +++++++++++++++++----------------- semantics/__init__.py | 5 +- semantics/builder.py | 10 +- semantics/collector.py | 24 +- semantics/overridden.py | 37 +- semantics/scope.py | 89 +- semantics/selftype.py | 144 -- semantics/semantic_errors.py | 12 +- semantics/type_checker.py | 52 +- 13 files changed, 1392 insertions(+), 1538 deletions(-) delete mode 100644 semantics/selftype.py diff --git a/cmp/serialization.py b/cmp/serialization.py index baf58dd54..26dcda38d 100755 --- a/cmp/serialization.py +++ b/cmp/serialization.py @@ -82,23 +82,28 @@ def _build_parsing_tables(parser, variable_name): class LexerSerializer: @staticmethod def build(grammar, lexer_class_name, grammar_module_name, grammar_variable_name): - items = grammar.terminal_rules.items() - values = grammar.terminal_rules.values() + f1 = filter(lambda x: x[1][2] is not None, grammar.terminal_rules.items()) + f2 = filter(lambda x: x[1][2] is None and not x[1][1], grammar.terminal_rules.items()) + f3 = filter(lambda x: x[1][2] is None and x[1][1], grammar.terminal_rules.items()) + + ruled_tokens = list(f1) + not_literal_tokens = sorted(f2, key=lambda x: len(x[1][0]), reverse=True) + literal_tokens = sorted(f3, key=lambda x: len(x[1][0]), reverse=True) pattern = re.compile('|'.join( - ['(?P<%s>%s)' % (name, regex) for name, (regex, _, rule) in items if rule is not None] + - sorted(['(%s)' % regex for regex, literal, _ in values if literal], key=lambda x: len(x), reverse=True) + - ['(?P<%s>%s)' % (name, regex) for name, (regex, literal, rule) in items if not literal and rule is None] + ['(?P<%s>%s)' % (name, regex) for name, (regex, _, _) in ruled_tokens] + + ['(?P<%s>%s)' % (name, regex) for name, (regex, _, _) in not_literal_tokens] + + ['(%s)' % regex for _, (regex, _, _) in literal_tokens] )).pattern token_rules = f"{{key: rule for key, (_, _, rule) in {grammar_variable_name}.terminal_rules.items() if rule " \ - f"is not None}}" + f"is not None}}" - error_handler = f"{grammar_variable_name}.lexical_error_handler if "\ + error_handler = f"{grammar_variable_name}.lexical_error_handler if " \ f"{grammar_variable_name}.lexical_error_handler is not None else self.error " call_return = f"[Token(t.lex, {grammar_variable_name}[t.token_type], t.line, t.column) for t in " \ - f"self.tokenize(text)] " + f"self.tokenize(text)] " content = LEXER_TEMPLATE % ( grammar_module_name, grammar_variable_name, lexer_class_name, pattern, token_rules, error_handler, diff --git a/grammar.py b/grammar.py index db383ee03..edc57a268 100755 --- a/grammar.py +++ b/grammar.py @@ -29,19 +29,6 @@ factor = G.add_non_terminal('factor') atom = G.add_non_terminal('atom') -############### -# identifiers # -############### -G.add_terminal('id', regex=r'[a-z][a-zA-Z0-9_]*') -G.add_terminal('type', regex=r'[A-Z][a-zA-Z0-9_]*') - -############### -# Basic Types # -############### -G.add_terminal('string', regex=r'\"[^\"]*\"') -G.add_terminal('int', regex=r'\d+') -G.add_terminal('char', regex=r'\'[^\']*\'') - ########### # Symbols # ########### @@ -50,12 +37,35 @@ ############ # Keywords # ############ -G.add_terminals('class inherits if then else fi while loop pool let in case of esac new isvoid true false') +keywords = G.add_terminals( + 'class inherits if then else fi while loop pool let in case of esac new isvoid true false not') +keywords_names = {x.name for x in keywords} ############# -# Operators # +# Symbols # ############# -G.add_terminals('+ - * / < <= = ~ not') +G.add_terminals('+ - * / < <= = ~') + + +############### +# Identifiers # +############### +@G.terminal('id', r'[a-z][a-zA-Z0-9_]*') +def id_terminal(lexer): + lexer.column += len(lexer.token.lex) + 1 + lexer.position += len(lexer.token.lex) + lexer.token.token_type = lexer.token.lex if lexer.token.lex in keywords_names else lexer.token.token_type + return lexer.token + + +G.add_terminal('type', regex=r'[A-Z][a-zA-Z0-9_]*') + +############### +# Basic Types # +############### +G.add_terminal('string', regex=r'\"[^\"]*\"') +G.add_terminal('int', regex=r'\d+') +G.add_terminal('char', regex=r'\'[^\']*\'') ############ diff --git a/lexer.py b/lexer.py index 72f44a5da..9b9a87ec1 100755 --- a/lexer.py +++ b/lexer.py @@ -10,7 +10,7 @@ def __init__(self): self.column = 1 self.position = 0 self.token = Token('', '', 0, 0) - self.pattern = re.compile(r'(?P(\(\*[^$]*\*\))|--.*)|(?P\(\*(.|\n)*$)|(?P\n+)|(?P +)|(?P\t+)|(inherits)|(isvoid)|(class)|(while)|(false)|(then)|(else)|(loop)|(pool)|(case)|(esac)|(true)|(<\-)|(let)|(new)|(not)|(\{)|(\})|(\()|(\))|(\.)|(=>)|(if)|(fi)|(in)|(of)|(\+)|(\-)|(\*)|(<=)|(\~)|(,)|(:)|(;)|(@)|(/)|(<)|(=)|(?P[a-z][a-zA-Z0-9_]*)|(?P[A-Z][a-zA-Z0-9_]*)|(?P\"[^\"]*\")|(?P\d+)|(?P\'[^\']*\')') + self.pattern = re.compile(r'(?P[a-z][a-zA-Z0-9_]*)|(?P(\(\*[^$]*\*\))|--.*)|(?P\(\*(.|\n)*$)|(?P\n+)|(?P +)|(?P\t+)|(?P[A-Z][a-zA-Z0-9_]*)|(?P\"[^\"]*\")|(?P\'[^\']*\')|(?P\d+)|(inherits)|(isvoid)|(class)|(while)|(false)|(then)|(else)|(loop)|(pool)|(case)|(esac)|(true)|(<\-)|(let)|(new)|(not)|(\{)|(\})|(\()|(\))|(\.)|(=>)|(if)|(fi)|(in)|(of)|(\+)|(\-)|(\*)|(<=)|(\~)|(,)|(:)|(;)|(@)|(/)|(<)|(=)') self.token_rules = {key: rule for key, (_, _, rule) in G.terminal_rules.items() if rule is not None} self.error_handler = G.lexical_error_handler if G.lexical_error_handler is not None else self.error self.contain_errors = False diff --git a/main.py b/main.py index d4c76cf64..b7c4fe1be 100755 --- a/main.py +++ b/main.py @@ -1,16 +1,17 @@ from lexer import CoolLexer from parser import CoolParser -from semantics.scope import Context -from semantics import (TypeCollector, TypeBuilder, OverriddenMethodChecker, SelfTypeReplacement, TypeChecker, - topological_ordering, Formatter) +from semantics import (TypeCollector, TypeBuilder, OverriddenMethodChecker, TypeChecker, topological_ordering) +from semantics.scope import Context, Scope program = r""" class Main inherits IO { main(): IO { out_string("Hello, World.\n") }; - - function(): SELF_TYPE { 0 }; + + fibonacci(n: Int): Int { + if n <= 2 then 0 else fibonacci(n - 1) + fibonacci(n - 2) fi + }; } """ @@ -21,17 +22,18 @@ class Main inherits IO { tokens = lexer(program) ast = parser(tokens) + # for t in tokens: + # print(t) + context = Context() errors = [] + scope = Scope() TypeCollector(context, errors).visit(ast) TypeBuilder(context, errors).visit(ast) - ast = topological_ordering(ast, context, errors) + topological_ordering(ast, context, errors) OverriddenMethodChecker(context, errors).visit(ast) - ast = SelfTypeReplacement(context, errors).visit(ast) - scope = TypeChecker(context, errors).visit(ast) - print(Formatter().visit(ast)) - # InferenceTypeChecker(context, errors).visit(ast, scope) + TypeChecker(context, errors).visit(ast, scope) # Executor(context, errors).visit(ast, scope) for error in errors: diff --git a/parser.py b/parser.py index 35e37dad3..657f38c4e 100755 --- a/parser.py +++ b/parser.py @@ -19,1036 +19,1036 @@ def __action_table(): (2, G["{"]): ("SHIFT", 3), (3, G["}"]): ("REDUCE", G["feature-list -> e"]), (3, G["id"]): ("SHIFT", 4), - (4, G[":"]): ("SHIFT", 124), (4, G["("]): ("SHIFT", 5), - (5, G["id"]): ("SHIFT", 6), - (5, G[")"]): ("SHIFT", 11), + (4, G[":"]): ("SHIFT", 124), + (5, G["id"]): ("SHIFT", 112), + (5, G[")"]): ("SHIFT", 6), (6, G[":"]): ("SHIFT", 7), (7, G["type"]): ("SHIFT", 8), - (8, G[","]): ("SHIFT", 9), - (8, G[")"]): ("REDUCE", G["param-list -> id : type"]), - (9, G["id"]): ("SHIFT", 6), - (10, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), - (11, G[":"]): ("SHIFT", 12), - (12, G["type"]): ("SHIFT", 13), - (13, G["{"]): ("SHIFT", 14), - (14, G["case"]): ("SHIFT", 30), - (14, G["("]): ("SHIFT", 20), - (14, G["let"]): ("SHIFT", 23), + (8, G["{"]): ("SHIFT", 9), + (9, G["false"]): ("SHIFT", 26), + (9, G["while"]): ("SHIFT", 13), + (9, G["id"]): ("SHIFT", 31), + (9, G["not"]): ("SHIFT", 30), + (9, G["string"]): ("SHIFT", 33), + (9, G["true"]): ("SHIFT", 25), + (9, G["isvoid"]): ("SHIFT", 24), + (9, G["if"]): ("SHIFT", 12), + (9, G["new"]): ("SHIFT", 22), + (9, G["("]): ("SHIFT", 11), + (9, G["{"]): ("SHIFT", 10), + (9, G["~"]): ("SHIFT", 27), + (9, G["int"]): ("SHIFT", 34), + (9, G["case"]): ("SHIFT", 21), + (9, G["let"]): ("SHIFT", 14), + (10, G["new"]): ("SHIFT", 22), + (10, G["("]): ("SHIFT", 11), + (10, G["~"]): ("SHIFT", 27), + (10, G["case"]): ("SHIFT", 21), + (10, G["let"]): ("SHIFT", 14), + (10, G["while"]): ("SHIFT", 13), + (10, G["not"]): ("SHIFT", 30), + (10, G["if"]): ("SHIFT", 12), + (10, G["int"]): ("SHIFT", 34), + (10, G["isvoid"]): ("SHIFT", 24), + (10, G["{"]): ("SHIFT", 10), + (10, G["id"]): ("SHIFT", 31), + (10, G["false"]): ("SHIFT", 26), + (10, G["string"]): ("SHIFT", 33), + (10, G["true"]): ("SHIFT", 25), + (11, G["{"]): ("SHIFT", 10), + (11, G["if"]): ("SHIFT", 12), + (11, G["id"]): ("SHIFT", 31), + (11, G["int"]): ("SHIFT", 34), + (11, G["isvoid"]): ("SHIFT", 24), + (11, G["false"]): ("SHIFT", 26), + (11, G["string"]): ("SHIFT", 33), + (11, G["true"]): ("SHIFT", 25), + (11, G["new"]): ("SHIFT", 22), + (11, G["("]): ("SHIFT", 11), + (11, G["case"]): ("SHIFT", 21), + (11, G["let"]): ("SHIFT", 14), + (11, G["while"]): ("SHIFT", 13), + (11, G["~"]): ("SHIFT", 27), + (11, G["not"]): ("SHIFT", 30), + (12, G["id"]): ("SHIFT", 31), + (12, G["string"]): ("SHIFT", 33), + (12, G["isvoid"]): ("SHIFT", 24), + (12, G["true"]): ("SHIFT", 25), + (12, G["case"]): ("SHIFT", 21), + (12, G["let"]): ("SHIFT", 14), + (12, G["new"]): ("SHIFT", 22), + (12, G["("]): ("SHIFT", 11), + (12, G["while"]): ("SHIFT", 13), + (12, G["not"]): ("SHIFT", 30), + (12, G["~"]): ("SHIFT", 27), + (12, G["{"]): ("SHIFT", 10), + (12, G["if"]): ("SHIFT", 12), + (12, G["int"]): ("SHIFT", 34), + (12, G["false"]): ("SHIFT", 26), + (13, G["false"]): ("SHIFT", 26), + (13, G["let"]): ("SHIFT", 14), + (13, G["case"]): ("SHIFT", 21), + (13, G["id"]): ("SHIFT", 31), + (13, G["string"]): ("SHIFT", 33), + (13, G["while"]): ("SHIFT", 13), + (13, G["not"]): ("SHIFT", 30), + (13, G["~"]): ("SHIFT", 27), + (13, G["true"]): ("SHIFT", 25), + (13, G["new"]): ("SHIFT", 22), + (13, G["("]): ("SHIFT", 11), + (13, G["{"]): ("SHIFT", 10), + (13, G["if"]): ("SHIFT", 12), + (13, G["isvoid"]): ("SHIFT", 24), + (13, G["int"]): ("SHIFT", 34), (14, G["id"]): ("SHIFT", 15), - (14, G["{"]): ("SHIFT", 19), - (14, G["string"]): ("SHIFT", 17), - (14, G["false"]): ("SHIFT", 36), - (14, G["~"]): ("SHIFT", 37), - (14, G["new"]): ("SHIFT", 31), - (14, G["while"]): ("SHIFT", 22), - (14, G["if"]): ("SHIFT", 21), - (14, G["isvoid"]): ("SHIFT", 33), - (14, G["int"]): ("SHIFT", 18), - (14, G["not"]): ("SHIFT", 44), - (14, G["true"]): ("SHIFT", 35), - (15, G["("]): ("SHIFT", 16), - (15, G["loop"]): ("REDUCE", G["atom -> id"]), - (15, G["pool"]): ("REDUCE", G["atom -> id"]), - (15, G["@"]): ("REDUCE", G["atom -> id"]), - (15, G["+"]): ("REDUCE", G["atom -> id"]), - (15, G["error"]): ("REDUCE", G["atom -> id"]), - (15, G["-"]): ("REDUCE", G["atom -> id"]), - (15, G["in"]): ("REDUCE", G["atom -> id"]), - (15, G["*"]): ("REDUCE", G["atom -> id"]), - (15, G["}"]): ("REDUCE", G["atom -> id"]), - (15, G["/"]): ("REDUCE", G["atom -> id"]), - (15, G["<"]): ("REDUCE", G["atom -> id"]), - (15, G["of"]): ("REDUCE", G["atom -> id"]), - (15, G[")"]): ("REDUCE", G["atom -> id"]), - (15, G["<="]): ("REDUCE", G["atom -> id"]), - (15, G["."]): ("REDUCE", G["atom -> id"]), - (15, G["="]): ("REDUCE", G["atom -> id"]), - (15, G["then"]): ("REDUCE", G["atom -> id"]), - (15, G[","]): ("REDUCE", G["atom -> id"]), - (15, G["else"]): ("REDUCE", G["atom -> id"]), - (15, G["fi"]): ("REDUCE", G["atom -> id"]), - (15, G[";"]): ("REDUCE", G["atom -> id"]), - (15, G["<-"]): ("SHIFT", 113), - (16, G["let"]): ("SHIFT", 23), - (16, G["false"]): ("SHIFT", 36), - (16, G["case"]): ("SHIFT", 30), - (16, G["new"]): ("SHIFT", 31), - (16, G["id"]): ("SHIFT", 15), - (16, G["{"]): ("SHIFT", 19), - (16, G["int"]): ("SHIFT", 18), - (16, G["true"]): ("SHIFT", 35), - (16, G["("]): ("SHIFT", 20), - (16, G["~"]): ("SHIFT", 37), - (16, G["while"]): ("SHIFT", 22), - (16, G["string"]): ("SHIFT", 17), - (16, G["if"]): ("SHIFT", 21), - (16, G["not"]): ("SHIFT", 44), - (16, G["isvoid"]): ("SHIFT", 33), - (17, G["loop"]): ("REDUCE", G["atom -> string"]), - (17, G["pool"]): ("REDUCE", G["atom -> string"]), - (17, G["@"]): ("REDUCE", G["atom -> string"]), - (17, G["+"]): ("REDUCE", G["atom -> string"]), - (17, G["error"]): ("REDUCE", G["atom -> string"]), - (17, G["-"]): ("REDUCE", G["atom -> string"]), - (17, G["in"]): ("REDUCE", G["atom -> string"]), - (17, G["*"]): ("REDUCE", G["atom -> string"]), - (17, G["}"]): ("REDUCE", G["atom -> string"]), - (17, G["/"]): ("REDUCE", G["atom -> string"]), - (17, G["<"]): ("REDUCE", G["atom -> string"]), - (17, G["of"]): ("REDUCE", G["atom -> string"]), - (17, G[")"]): ("REDUCE", G["atom -> string"]), - (17, G["<="]): ("REDUCE", G["atom -> string"]), - (17, G["."]): ("REDUCE", G["atom -> string"]), - (17, G["="]): ("REDUCE", G["atom -> string"]), - (17, G["then"]): ("REDUCE", G["atom -> string"]), - (17, G[","]): ("REDUCE", G["atom -> string"]), - (17, G["else"]): ("REDUCE", G["atom -> string"]), - (17, G["fi"]): ("REDUCE", G["atom -> string"]), - (17, G[";"]): ("REDUCE", G["atom -> string"]), - (18, G["loop"]): ("REDUCE", G["atom -> int"]), - (18, G["pool"]): ("REDUCE", G["atom -> int"]), - (18, G["@"]): ("REDUCE", G["atom -> int"]), - (18, G["+"]): ("REDUCE", G["atom -> int"]), - (18, G["error"]): ("REDUCE", G["atom -> int"]), - (18, G["-"]): ("REDUCE", G["atom -> int"]), - (18, G["in"]): ("REDUCE", G["atom -> int"]), - (18, G["*"]): ("REDUCE", G["atom -> int"]), - (18, G["}"]): ("REDUCE", G["atom -> int"]), - (18, G["/"]): ("REDUCE", G["atom -> int"]), - (18, G["<"]): ("REDUCE", G["atom -> int"]), - (18, G["of"]): ("REDUCE", G["atom -> int"]), - (18, G[")"]): ("REDUCE", G["atom -> int"]), - (18, G["<="]): ("REDUCE", G["atom -> int"]), - (18, G["."]): ("REDUCE", G["atom -> int"]), - (18, G["="]): ("REDUCE", G["atom -> int"]), - (18, G["then"]): ("REDUCE", G["atom -> int"]), - (18, G[","]): ("REDUCE", G["atom -> int"]), - (18, G["else"]): ("REDUCE", G["atom -> int"]), - (18, G["fi"]): ("REDUCE", G["atom -> int"]), - (18, G[";"]): ("REDUCE", G["atom -> int"]), - (19, G["false"]): ("SHIFT", 36), - (19, G["new"]): ("SHIFT", 31), - (19, G["id"]): ("SHIFT", 15), - (19, G["while"]): ("SHIFT", 22), - (19, G["int"]): ("SHIFT", 18), - (19, G["if"]): ("SHIFT", 21), - (19, G["~"]): ("SHIFT", 37), - (19, G["true"]): ("SHIFT", 35), - (19, G["not"]): ("SHIFT", 44), - (19, G["let"]): ("SHIFT", 23), - (19, G["isvoid"]): ("SHIFT", 33), - (19, G["case"]): ("SHIFT", 30), - (19, G["("]): ("SHIFT", 20), - (19, G["string"]): ("SHIFT", 17), - (19, G["{"]): ("SHIFT", 19), - (20, G["not"]): ("SHIFT", 44), - (20, G["~"]): ("SHIFT", 37), - (20, G["let"]): ("SHIFT", 23), - (20, G["("]): ("SHIFT", 20), - (20, G["case"]): ("SHIFT", 30), - (20, G["id"]): ("SHIFT", 15), - (20, G["string"]): ("SHIFT", 17), - (20, G["isvoid"]): ("SHIFT", 33), - (20, G["{"]): ("SHIFT", 19), - (20, G["false"]): ("SHIFT", 36), - (20, G["new"]): ("SHIFT", 31), - (20, G["while"]): ("SHIFT", 22), - (20, G["int"]): ("SHIFT", 18), - (20, G["if"]): ("SHIFT", 21), - (20, G["true"]): ("SHIFT", 35), - (21, G["new"]): ("SHIFT", 31), - (21, G["~"]): ("SHIFT", 37), - (21, G["id"]): ("SHIFT", 15), - (21, G["while"]): ("SHIFT", 22), - (21, G["int"]): ("SHIFT", 18), - (21, G["isvoid"]): ("SHIFT", 33), - (21, G["if"]): ("SHIFT", 21), - (21, G["not"]): ("SHIFT", 44), - (21, G["true"]): ("SHIFT", 35), - (21, G["let"]): ("SHIFT", 23), - (21, G["case"]): ("SHIFT", 30), - (21, G["("]): ("SHIFT", 20), - (21, G["string"]): ("SHIFT", 17), - (21, G["{"]): ("SHIFT", 19), - (21, G["false"]): ("SHIFT", 36), - (22, G["while"]): ("SHIFT", 22), - (22, G["~"]): ("SHIFT", 37), - (22, G["if"]): ("SHIFT", 21), - (22, G["false"]): ("SHIFT", 36), - (22, G["not"]): ("SHIFT", 44), - (22, G["new"]): ("SHIFT", 31), - (22, G["let"]): ("SHIFT", 23), - (22, G["isvoid"]): ("SHIFT", 33), - (22, G["id"]): ("SHIFT", 15), - (22, G["case"]): ("SHIFT", 30), - (22, G["int"]): ("SHIFT", 18), - (22, G["true"]): ("SHIFT", 35), - (22, G["{"]): ("SHIFT", 19), - (22, G["("]): ("SHIFT", 20), - (22, G["string"]): ("SHIFT", 17), - (23, G["id"]): ("SHIFT", 24), - (24, G[":"]): ("SHIFT", 25), - (25, G["type"]): ("SHIFT", 26), - (26, G["<-"]): ("SHIFT", 29), - (26, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), - (26, G[","]): ("SHIFT", 27), - (27, G["id"]): ("SHIFT", 24), - (28, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), - (29, G["id"]): ("SHIFT", 15), - (29, G["{"]): ("SHIFT", 19), - (29, G["isvoid"]): ("SHIFT", 33), - (29, G["false"]): ("SHIFT", 36), - (29, G["new"]): ("SHIFT", 31), - (29, G["int"]): ("SHIFT", 18), - (29, G["while"]): ("SHIFT", 22), - (29, G["if"]): ("SHIFT", 21), - (29, G["true"]): ("SHIFT", 35), - (29, G["not"]): ("SHIFT", 44), - (29, G["let"]): ("SHIFT", 23), - (29, G["("]): ("SHIFT", 20), - (29, G["case"]): ("SHIFT", 30), - (29, G["~"]): ("SHIFT", 37), - (29, G["string"]): ("SHIFT", 17), - (30, G["not"]): ("SHIFT", 44), - (30, G["id"]): ("SHIFT", 15), - (30, G["string"]): ("SHIFT", 17), - (30, G["let"]): ("SHIFT", 23), - (30, G["case"]): ("SHIFT", 30), - (30, G["false"]): ("SHIFT", 36), - (30, G["new"]): ("SHIFT", 31), - (30, G["{"]): ("SHIFT", 19), - (30, G["~"]): ("SHIFT", 37), - (30, G["int"]): ("SHIFT", 18), - (30, G["true"]): ("SHIFT", 35), - (30, G["isvoid"]): ("SHIFT", 33), - (30, G["while"]): ("SHIFT", 22), - (30, G["if"]): ("SHIFT", 21), - (30, G["("]): ("SHIFT", 20), - (31, G["type"]): ("SHIFT", 32), - (32, G["loop"]): ("REDUCE", G["atom -> new type"]), - (32, G["pool"]): ("REDUCE", G["atom -> new type"]), - (32, G["@"]): ("REDUCE", G["atom -> new type"]), - (32, G["+"]): ("REDUCE", G["atom -> new type"]), - (32, G["error"]): ("REDUCE", G["atom -> new type"]), - (32, G["-"]): ("REDUCE", G["atom -> new type"]), - (32, G["in"]): ("REDUCE", G["atom -> new type"]), - (32, G["*"]): ("REDUCE", G["atom -> new type"]), - (32, G["}"]): ("REDUCE", G["atom -> new type"]), - (32, G["/"]): ("REDUCE", G["atom -> new type"]), - (32, G["<"]): ("REDUCE", G["atom -> new type"]), - (32, G["of"]): ("REDUCE", G["atom -> new type"]), - (32, G[")"]): ("REDUCE", G["atom -> new type"]), - (32, G["<="]): ("REDUCE", G["atom -> new type"]), - (32, G["."]): ("REDUCE", G["atom -> new type"]), - (32, G["="]): ("REDUCE", G["atom -> new type"]), - (32, G["then"]): ("REDUCE", G["atom -> new type"]), - (32, G[","]): ("REDUCE", G["atom -> new type"]), - (32, G["else"]): ("REDUCE", G["atom -> new type"]), - (32, G["fi"]): ("REDUCE", G["atom -> new type"]), - (32, G[";"]): ("REDUCE", G["atom -> new type"]), - (33, G["("]): ("SHIFT", 20), - (33, G["id"]): ("SHIFT", 34), - (33, G["true"]): ("SHIFT", 35), - (33, G["~"]): ("SHIFT", 37), - (33, G["false"]): ("SHIFT", 36), - (33, G["isvoid"]): ("SHIFT", 33), - (33, G["string"]): ("SHIFT", 17), - (33, G["int"]): ("SHIFT", 18), - (33, G["new"]): ("SHIFT", 31), - (34, G["loop"]): ("REDUCE", G["atom -> id"]), - (34, G["pool"]): ("REDUCE", G["atom -> id"]), - (34, G["@"]): ("REDUCE", G["atom -> id"]), - (34, G["+"]): ("REDUCE", G["atom -> id"]), - (34, G["error"]): ("REDUCE", G["atom -> id"]), - (34, G["-"]): ("REDUCE", G["atom -> id"]), - (34, G["in"]): ("REDUCE", G["atom -> id"]), - (34, G["*"]): ("REDUCE", G["atom -> id"]), - (34, G["}"]): ("REDUCE", G["atom -> id"]), - (34, G["/"]): ("REDUCE", G["atom -> id"]), - (34, G["<"]): ("REDUCE", G["atom -> id"]), - (34, G["of"]): ("REDUCE", G["atom -> id"]), - (34, G[")"]): ("REDUCE", G["atom -> id"]), - (34, G["<="]): ("REDUCE", G["atom -> id"]), - (34, G["."]): ("REDUCE", G["atom -> id"]), - (34, G["="]): ("REDUCE", G["atom -> id"]), - (34, G["then"]): ("REDUCE", G["atom -> id"]), - (34, G[","]): ("REDUCE", G["atom -> id"]), - (34, G["else"]): ("REDUCE", G["atom -> id"]), - (34, G["fi"]): ("REDUCE", G["atom -> id"]), - (34, G[";"]): ("REDUCE", G["atom -> id"]), - (34, G["("]): ("SHIFT", 16), - (35, G["loop"]): ("REDUCE", G["atom -> true"]), - (35, G["pool"]): ("REDUCE", G["atom -> true"]), - (35, G["@"]): ("REDUCE", G["atom -> true"]), - (35, G["+"]): ("REDUCE", G["atom -> true"]), - (35, G["error"]): ("REDUCE", G["atom -> true"]), - (35, G["-"]): ("REDUCE", G["atom -> true"]), - (35, G["in"]): ("REDUCE", G["atom -> true"]), - (35, G["*"]): ("REDUCE", G["atom -> true"]), - (35, G["}"]): ("REDUCE", G["atom -> true"]), - (35, G["/"]): ("REDUCE", G["atom -> true"]), - (35, G["<"]): ("REDUCE", G["atom -> true"]), - (35, G["of"]): ("REDUCE", G["atom -> true"]), - (35, G[")"]): ("REDUCE", G["atom -> true"]), - (35, G["<="]): ("REDUCE", G["atom -> true"]), - (35, G["."]): ("REDUCE", G["atom -> true"]), - (35, G["="]): ("REDUCE", G["atom -> true"]), - (35, G["then"]): ("REDUCE", G["atom -> true"]), - (35, G[","]): ("REDUCE", G["atom -> true"]), - (35, G["else"]): ("REDUCE", G["atom -> true"]), - (35, G["fi"]): ("REDUCE", G["atom -> true"]), - (35, G[";"]): ("REDUCE", G["atom -> true"]), - (36, G["loop"]): ("REDUCE", G["atom -> false"]), - (36, G["pool"]): ("REDUCE", G["atom -> false"]), - (36, G["@"]): ("REDUCE", G["atom -> false"]), - (36, G["+"]): ("REDUCE", G["atom -> false"]), - (36, G["error"]): ("REDUCE", G["atom -> false"]), - (36, G["-"]): ("REDUCE", G["atom -> false"]), - (36, G["in"]): ("REDUCE", G["atom -> false"]), - (36, G["*"]): ("REDUCE", G["atom -> false"]), - (36, G["}"]): ("REDUCE", G["atom -> false"]), - (36, G["/"]): ("REDUCE", G["atom -> false"]), - (36, G["<"]): ("REDUCE", G["atom -> false"]), - (36, G["of"]): ("REDUCE", G["atom -> false"]), - (36, G[")"]): ("REDUCE", G["atom -> false"]), - (36, G["<="]): ("REDUCE", G["atom -> false"]), - (36, G["."]): ("REDUCE", G["atom -> false"]), - (36, G["="]): ("REDUCE", G["atom -> false"]), - (36, G["then"]): ("REDUCE", G["atom -> false"]), - (36, G[","]): ("REDUCE", G["atom -> false"]), - (36, G["else"]): ("REDUCE", G["atom -> false"]), - (36, G["fi"]): ("REDUCE", G["atom -> false"]), - (36, G[";"]): ("REDUCE", G["atom -> false"]), - (37, G["("]): ("SHIFT", 20), - (37, G["id"]): ("SHIFT", 34), - (37, G["true"]): ("SHIFT", 35), - (37, G["~"]): ("SHIFT", 37), - (37, G["false"]): ("SHIFT", 36), - (37, G["isvoid"]): ("SHIFT", 33), - (37, G["string"]): ("SHIFT", 17), - (37, G["int"]): ("SHIFT", 18), - (37, G["new"]): ("SHIFT", 31), - (38, G["loop"]): ("REDUCE", G["atom -> function-call"]), - (38, G["pool"]): ("REDUCE", G["atom -> function-call"]), - (38, G["@"]): ("REDUCE", G["atom -> function-call"]), - (38, G["+"]): ("REDUCE", G["atom -> function-call"]), - (38, G["error"]): ("REDUCE", G["atom -> function-call"]), - (38, G["-"]): ("REDUCE", G["atom -> function-call"]), - (38, G["in"]): ("REDUCE", G["atom -> function-call"]), - (38, G["*"]): ("REDUCE", G["atom -> function-call"]), - (38, G["}"]): ("REDUCE", G["atom -> function-call"]), - (38, G["/"]): ("REDUCE", G["atom -> function-call"]), - (38, G["<"]): ("REDUCE", G["atom -> function-call"]), - (38, G["of"]): ("REDUCE", G["atom -> function-call"]), - (38, G[")"]): ("REDUCE", G["atom -> function-call"]), - (38, G["<="]): ("REDUCE", G["atom -> function-call"]), - (38, G["."]): ("REDUCE", G["atom -> function-call"]), - (38, G["="]): ("REDUCE", G["atom -> function-call"]), - (38, G["then"]): ("REDUCE", G["atom -> function-call"]), - (38, G[","]): ("REDUCE", G["atom -> function-call"]), - (38, G["else"]): ("REDUCE", G["atom -> function-call"]), - (38, G["fi"]): ("REDUCE", G["atom -> function-call"]), - (38, G[";"]): ("REDUCE", G["atom -> function-call"]), - (39, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["+"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["error"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["-"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["in"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["*"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["}"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["/"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["<"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["of"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G[")"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["<="]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["="]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["then"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G[","]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["else"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), - (39, G[";"]): ("REDUCE", G["factor -> ~ factor"]), - (40, G["loop"]): ("REDUCE", G["factor -> atom"]), - (40, G["pool"]): ("REDUCE", G["factor -> atom"]), - (40, G["+"]): ("REDUCE", G["factor -> atom"]), - (40, G["error"]): ("REDUCE", G["factor -> atom"]), - (40, G["-"]): ("REDUCE", G["factor -> atom"]), - (40, G["in"]): ("REDUCE", G["factor -> atom"]), - (40, G["*"]): ("REDUCE", G["factor -> atom"]), - (40, G["}"]): ("REDUCE", G["factor -> atom"]), - (40, G["/"]): ("REDUCE", G["factor -> atom"]), - (40, G["<"]): ("REDUCE", G["factor -> atom"]), - (40, G["of"]): ("REDUCE", G["factor -> atom"]), - (40, G[")"]): ("REDUCE", G["factor -> atom"]), - (40, G["<="]): ("REDUCE", G["factor -> atom"]), - (40, G["="]): ("REDUCE", G["factor -> atom"]), - (40, G["then"]): ("REDUCE", G["factor -> atom"]), - (40, G[","]): ("REDUCE", G["factor -> atom"]), - (40, G["else"]): ("REDUCE", G["factor -> atom"]), - (40, G["fi"]): ("REDUCE", G["factor -> atom"]), - (40, G[";"]): ("REDUCE", G["factor -> atom"]), - (40, G["."]): ("SHIFT", 41), - (40, G["@"]): ("SHIFT", 69), - (41, G["id"]): ("SHIFT", 42), - (42, G["("]): ("SHIFT", 43), - (43, G["let"]): ("SHIFT", 23), - (43, G["false"]): ("SHIFT", 36), - (43, G["case"]): ("SHIFT", 30), - (43, G["new"]): ("SHIFT", 31), - (43, G["id"]): ("SHIFT", 15), - (43, G["{"]): ("SHIFT", 19), - (43, G["int"]): ("SHIFT", 18), - (43, G["true"]): ("SHIFT", 35), - (43, G["("]): ("SHIFT", 20), - (43, G["~"]): ("SHIFT", 37), - (43, G["while"]): ("SHIFT", 22), - (43, G["string"]): ("SHIFT", 17), - (43, G["if"]): ("SHIFT", 21), - (43, G["not"]): ("SHIFT", 44), - (43, G["isvoid"]): ("SHIFT", 33), - (44, G["("]): ("SHIFT", 20), - (44, G["case"]): ("SHIFT", 30), - (44, G["id"]): ("SHIFT", 15), - (44, G["isvoid"]): ("SHIFT", 33), - (44, G["string"]): ("SHIFT", 17), - (44, G["{"]): ("SHIFT", 19), - (44, G["false"]): ("SHIFT", 36), - (44, G["new"]): ("SHIFT", 31), - (44, G["int"]): ("SHIFT", 18), - (44, G["while"]): ("SHIFT", 22), - (44, G["if"]): ("SHIFT", 21), - (44, G["true"]): ("SHIFT", 35), - (44, G["not"]): ("SHIFT", 44), - (44, G["let"]): ("SHIFT", 23), - (44, G["~"]): ("SHIFT", 37), - (45, G["of"]): ("REDUCE", G["expr -> not expr"]), - (45, G["loop"]): ("REDUCE", G["expr -> not expr"]), - (45, G[")"]): ("REDUCE", G["expr -> not expr"]), - (45, G["pool"]): ("REDUCE", G["expr -> not expr"]), - (45, G["then"]): ("REDUCE", G["expr -> not expr"]), - (45, G["error"]): ("REDUCE", G["expr -> not expr"]), - (45, G[","]): ("REDUCE", G["expr -> not expr"]), - (45, G["in"]): ("REDUCE", G["expr -> not expr"]), - (45, G["else"]): ("REDUCE", G["expr -> not expr"]), - (45, G["fi"]): ("REDUCE", G["expr -> not expr"]), - (45, G["}"]): ("REDUCE", G["expr -> not expr"]), - (45, G[";"]): ("REDUCE", G["expr -> not expr"]), - (46, G["of"]): ("REDUCE", G["expr -> comp"]), - (46, G["loop"]): ("REDUCE", G["expr -> comp"]), - (46, G[")"]): ("REDUCE", G["expr -> comp"]), - (46, G["pool"]): ("REDUCE", G["expr -> comp"]), - (46, G["then"]): ("REDUCE", G["expr -> comp"]), - (46, G["error"]): ("REDUCE", G["expr -> comp"]), - (46, G[","]): ("REDUCE", G["expr -> comp"]), - (46, G["in"]): ("REDUCE", G["expr -> comp"]), - (46, G["else"]): ("REDUCE", G["expr -> comp"]), - (46, G["fi"]): ("REDUCE", G["expr -> comp"]), - (46, G["}"]): ("REDUCE", G["expr -> comp"]), - (46, G[";"]): ("REDUCE", G["expr -> comp"]), - (47, G["-"]): ("SHIFT", 55), - (47, G["<="]): ("SHIFT", 60), - (47, G["="]): ("SHIFT", 62), - (47, G["<"]): ("SHIFT", 57), - (47, G["+"]): ("SHIFT", 48), - (47, G["of"]): ("REDUCE", G["comp -> arith"]), - (47, G["loop"]): ("REDUCE", G["comp -> arith"]), - (47, G[")"]): ("REDUCE", G["comp -> arith"]), - (47, G["pool"]): ("REDUCE", G["comp -> arith"]), - (47, G["then"]): ("REDUCE", G["comp -> arith"]), - (47, G["error"]): ("REDUCE", G["comp -> arith"]), - (47, G[","]): ("REDUCE", G["comp -> arith"]), - (47, G["in"]): ("REDUCE", G["comp -> arith"]), - (47, G["else"]): ("REDUCE", G["comp -> arith"]), - (47, G["fi"]): ("REDUCE", G["comp -> arith"]), - (47, G["}"]): ("REDUCE", G["comp -> arith"]), - (47, G[";"]): ("REDUCE", G["comp -> arith"]), - (48, G["("]): ("SHIFT", 20), - (48, G["id"]): ("SHIFT", 34), - (48, G["isvoid"]): ("SHIFT", 33), - (48, G["string"]): ("SHIFT", 17), - (48, G["int"]): ("SHIFT", 18), - (48, G["true"]): ("SHIFT", 35), - (48, G["false"]): ("SHIFT", 36), - (48, G["~"]): ("SHIFT", 37), - (48, G["new"]): ("SHIFT", 31), - (49, G["*"]): ("SHIFT", 50), - (49, G["/"]): ("SHIFT", 52), - (49, G["loop"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["pool"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["+"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["error"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["-"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["in"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["}"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["<"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["of"]): ("REDUCE", G["arith -> arith + term"]), - (49, G[")"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["<="]): ("REDUCE", G["arith -> arith + term"]), - (49, G["="]): ("REDUCE", G["arith -> arith + term"]), - (49, G["then"]): ("REDUCE", G["arith -> arith + term"]), - (49, G[","]): ("REDUCE", G["arith -> arith + term"]), - (49, G["else"]): ("REDUCE", G["arith -> arith + term"]), - (49, G["fi"]): ("REDUCE", G["arith -> arith + term"]), - (49, G[";"]): ("REDUCE", G["arith -> arith + term"]), - (50, G["("]): ("SHIFT", 20), - (50, G["id"]): ("SHIFT", 34), - (50, G["true"]): ("SHIFT", 35), - (50, G["~"]): ("SHIFT", 37), - (50, G["false"]): ("SHIFT", 36), - (50, G["isvoid"]): ("SHIFT", 33), - (50, G["string"]): ("SHIFT", 17), - (50, G["int"]): ("SHIFT", 18), - (50, G["new"]): ("SHIFT", 31), - (51, G["loop"]): ("REDUCE", G["term -> term * factor"]), - (51, G["pool"]): ("REDUCE", G["term -> term * factor"]), - (51, G["+"]): ("REDUCE", G["term -> term * factor"]), - (51, G["error"]): ("REDUCE", G["term -> term * factor"]), - (51, G["-"]): ("REDUCE", G["term -> term * factor"]), - (51, G["in"]): ("REDUCE", G["term -> term * factor"]), - (51, G["*"]): ("REDUCE", G["term -> term * factor"]), - (51, G["}"]): ("REDUCE", G["term -> term * factor"]), - (51, G["/"]): ("REDUCE", G["term -> term * factor"]), - (51, G["<"]): ("REDUCE", G["term -> term * factor"]), - (51, G["of"]): ("REDUCE", G["term -> term * factor"]), - (51, G[")"]): ("REDUCE", G["term -> term * factor"]), - (51, G["<="]): ("REDUCE", G["term -> term * factor"]), - (51, G["="]): ("REDUCE", G["term -> term * factor"]), - (51, G["then"]): ("REDUCE", G["term -> term * factor"]), - (51, G[","]): ("REDUCE", G["term -> term * factor"]), - (51, G["else"]): ("REDUCE", G["term -> term * factor"]), - (51, G["fi"]): ("REDUCE", G["term -> term * factor"]), - (51, G[";"]): ("REDUCE", G["term -> term * factor"]), - (52, G["("]): ("SHIFT", 20), - (52, G["id"]): ("SHIFT", 34), - (52, G["true"]): ("SHIFT", 35), - (52, G["~"]): ("SHIFT", 37), - (52, G["false"]): ("SHIFT", 36), - (52, G["isvoid"]): ("SHIFT", 33), - (52, G["string"]): ("SHIFT", 17), - (52, G["int"]): ("SHIFT", 18), - (52, G["new"]): ("SHIFT", 31), - (53, G["loop"]): ("REDUCE", G["term -> term / factor"]), - (53, G["pool"]): ("REDUCE", G["term -> term / factor"]), - (53, G["+"]): ("REDUCE", G["term -> term / factor"]), - (53, G["error"]): ("REDUCE", G["term -> term / factor"]), - (53, G["-"]): ("REDUCE", G["term -> term / factor"]), - (53, G["in"]): ("REDUCE", G["term -> term / factor"]), - (53, G["*"]): ("REDUCE", G["term -> term / factor"]), - (53, G["}"]): ("REDUCE", G["term -> term / factor"]), - (53, G["/"]): ("REDUCE", G["term -> term / factor"]), - (53, G["<"]): ("REDUCE", G["term -> term / factor"]), - (53, G["of"]): ("REDUCE", G["term -> term / factor"]), - (53, G[")"]): ("REDUCE", G["term -> term / factor"]), - (53, G["<="]): ("REDUCE", G["term -> term / factor"]), - (53, G["="]): ("REDUCE", G["term -> term / factor"]), - (53, G["then"]): ("REDUCE", G["term -> term / factor"]), - (53, G[","]): ("REDUCE", G["term -> term / factor"]), - (53, G["else"]): ("REDUCE", G["term -> term / factor"]), - (53, G["fi"]): ("REDUCE", G["term -> term / factor"]), - (53, G[";"]): ("REDUCE", G["term -> term / factor"]), - (54, G["loop"]): ("REDUCE", G["term -> factor"]), - (54, G["pool"]): ("REDUCE", G["term -> factor"]), - (54, G["+"]): ("REDUCE", G["term -> factor"]), - (54, G["error"]): ("REDUCE", G["term -> factor"]), - (54, G["-"]): ("REDUCE", G["term -> factor"]), - (54, G["in"]): ("REDUCE", G["term -> factor"]), - (54, G["*"]): ("REDUCE", G["term -> factor"]), - (54, G["}"]): ("REDUCE", G["term -> factor"]), - (54, G["/"]): ("REDUCE", G["term -> factor"]), - (54, G["<"]): ("REDUCE", G["term -> factor"]), - (54, G["of"]): ("REDUCE", G["term -> factor"]), - (54, G[")"]): ("REDUCE", G["term -> factor"]), - (54, G["<="]): ("REDUCE", G["term -> factor"]), - (54, G["="]): ("REDUCE", G["term -> factor"]), - (54, G["then"]): ("REDUCE", G["term -> factor"]), - (54, G[","]): ("REDUCE", G["term -> factor"]), - (54, G["else"]): ("REDUCE", G["term -> factor"]), - (54, G["fi"]): ("REDUCE", G["term -> factor"]), - (54, G[";"]): ("REDUCE", G["term -> factor"]), - (55, G["("]): ("SHIFT", 20), - (55, G["id"]): ("SHIFT", 34), - (55, G["isvoid"]): ("SHIFT", 33), - (55, G["string"]): ("SHIFT", 17), - (55, G["int"]): ("SHIFT", 18), - (55, G["new"]): ("SHIFT", 31), - (55, G["true"]): ("SHIFT", 35), - (55, G["false"]): ("SHIFT", 36), - (55, G["~"]): ("SHIFT", 37), - (56, G["loop"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["pool"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["+"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["error"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["-"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["in"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["}"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["<"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["of"]): ("REDUCE", G["arith -> arith - term"]), - (56, G[")"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["<="]): ("REDUCE", G["arith -> arith - term"]), - (56, G["="]): ("REDUCE", G["arith -> arith - term"]), - (56, G["then"]): ("REDUCE", G["arith -> arith - term"]), - (56, G[","]): ("REDUCE", G["arith -> arith - term"]), - (56, G["else"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["fi"]): ("REDUCE", G["arith -> arith - term"]), - (56, G[";"]): ("REDUCE", G["arith -> arith - term"]), - (56, G["*"]): ("SHIFT", 50), - (56, G["/"]): ("SHIFT", 52), - (57, G["int"]): ("SHIFT", 18), - (57, G["string"]): ("SHIFT", 17), - (57, G["true"]): ("SHIFT", 35), - (57, G["false"]): ("SHIFT", 36), - (57, G["~"]): ("SHIFT", 37), - (57, G["new"]): ("SHIFT", 31), - (57, G["("]): ("SHIFT", 20), - (57, G["id"]): ("SHIFT", 34), - (57, G["isvoid"]): ("SHIFT", 33), - (58, G["of"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G[")"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G["then"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G["error"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G[","]): ("REDUCE", G["comp -> arith < arith"]), - (58, G["in"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G["else"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G["}"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G[";"]): ("REDUCE", G["comp -> arith < arith"]), - (58, G["+"]): ("SHIFT", 48), - (58, G["-"]): ("SHIFT", 55), - (59, G["*"]): ("SHIFT", 50), - (59, G["/"]): ("SHIFT", 52), - (59, G["loop"]): ("REDUCE", G["arith -> term"]), - (59, G["pool"]): ("REDUCE", G["arith -> term"]), - (59, G["+"]): ("REDUCE", G["arith -> term"]), - (59, G["error"]): ("REDUCE", G["arith -> term"]), - (59, G["-"]): ("REDUCE", G["arith -> term"]), - (59, G["in"]): ("REDUCE", G["arith -> term"]), - (59, G["}"]): ("REDUCE", G["arith -> term"]), - (59, G["<"]): ("REDUCE", G["arith -> term"]), - (59, G["of"]): ("REDUCE", G["arith -> term"]), - (59, G[")"]): ("REDUCE", G["arith -> term"]), - (59, G["<="]): ("REDUCE", G["arith -> term"]), - (59, G["="]): ("REDUCE", G["arith -> term"]), - (59, G["then"]): ("REDUCE", G["arith -> term"]), - (59, G[","]): ("REDUCE", G["arith -> term"]), - (59, G["else"]): ("REDUCE", G["arith -> term"]), - (59, G["fi"]): ("REDUCE", G["arith -> term"]), - (59, G[";"]): ("REDUCE", G["arith -> term"]), - (60, G["int"]): ("SHIFT", 18), - (60, G["string"]): ("SHIFT", 17), - (60, G["true"]): ("SHIFT", 35), - (60, G["false"]): ("SHIFT", 36), - (60, G["~"]): ("SHIFT", 37), - (60, G["new"]): ("SHIFT", 31), - (60, G["("]): ("SHIFT", 20), - (60, G["id"]): ("SHIFT", 34), - (60, G["isvoid"]): ("SHIFT", 33), - (61, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G[","]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), - (61, G["+"]): ("SHIFT", 48), - (61, G["-"]): ("SHIFT", 55), - (62, G["int"]): ("SHIFT", 18), - (62, G["string"]): ("SHIFT", 17), - (62, G["true"]): ("SHIFT", 35), - (62, G["false"]): ("SHIFT", 36), - (62, G["~"]): ("SHIFT", 37), - (62, G["new"]): ("SHIFT", 31), - (62, G["("]): ("SHIFT", 20), - (62, G["id"]): ("SHIFT", 34), - (62, G["isvoid"]): ("SHIFT", 33), - (63, G["+"]): ("SHIFT", 48), - (63, G["of"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G[")"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G["then"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G["error"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G[","]): ("REDUCE", G["comp -> arith = arith"]), - (63, G["in"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G["else"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G["}"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G[";"]): ("REDUCE", G["comp -> arith = arith"]), - (63, G["-"]): ("SHIFT", 55), - (64, G[")"]): ("SHIFT", 65), - (65, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (65, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (66, G[","]): ("SHIFT", 67), - (66, G[")"]): ("REDUCE", G["expr-list -> expr"]), - (67, G["let"]): ("SHIFT", 23), - (67, G["false"]): ("SHIFT", 36), - (67, G["case"]): ("SHIFT", 30), - (67, G["new"]): ("SHIFT", 31), - (67, G["id"]): ("SHIFT", 15), - (67, G["{"]): ("SHIFT", 19), - (67, G["int"]): ("SHIFT", 18), - (67, G["true"]): ("SHIFT", 35), - (67, G["("]): ("SHIFT", 20), - (67, G["~"]): ("SHIFT", 37), - (67, G["while"]): ("SHIFT", 22), - (67, G["string"]): ("SHIFT", 17), - (67, G["if"]): ("SHIFT", 21), - (67, G["not"]): ("SHIFT", 44), - (67, G["isvoid"]): ("SHIFT", 33), - (68, G[")"]): ("REDUCE", G["expr-list -> expr , expr-list"]), - (69, G["type"]): ("SHIFT", 70), - (70, G["."]): ("SHIFT", 71), - (71, G["id"]): ("SHIFT", 72), - (72, G["("]): ("SHIFT", 73), - (73, G["let"]): ("SHIFT", 23), - (73, G["false"]): ("SHIFT", 36), - (73, G["case"]): ("SHIFT", 30), - (73, G["new"]): ("SHIFT", 31), - (73, G["id"]): ("SHIFT", 15), - (73, G["{"]): ("SHIFT", 19), - (73, G["int"]): ("SHIFT", 18), - (73, G["true"]): ("SHIFT", 35), - (73, G["("]): ("SHIFT", 20), - (73, G["~"]): ("SHIFT", 37), - (73, G["while"]): ("SHIFT", 22), - (73, G["string"]): ("SHIFT", 17), - (73, G["if"]): ("SHIFT", 21), - (73, G["not"]): ("SHIFT", 44), - (73, G["isvoid"]): ("SHIFT", 33), - (74, G[")"]): ("SHIFT", 75), - (75, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), - (77, G["of"]): ("SHIFT", 78), - (78, G["id"]): ("SHIFT", 79), - (79, G[":"]): ("SHIFT", 80), - (80, G["type"]): ("SHIFT", 81), - (81, G["=>"]): ("SHIFT", 82), - (82, G["false"]): ("SHIFT", 36), - (82, G["new"]): ("SHIFT", 31), - (82, G["id"]): ("SHIFT", 15), - (82, G["while"]): ("SHIFT", 22), - (82, G["int"]): ("SHIFT", 18), - (82, G["if"]): ("SHIFT", 21), - (82, G["~"]): ("SHIFT", 37), - (82, G["true"]): ("SHIFT", 35), - (82, G["not"]): ("SHIFT", 44), - (82, G["let"]): ("SHIFT", 23), - (82, G["isvoid"]): ("SHIFT", 33), - (82, G["case"]): ("SHIFT", 30), - (82, G["("]): ("SHIFT", 20), - (82, G["string"]): ("SHIFT", 17), - (82, G["{"]): ("SHIFT", 19), - (83, G[";"]): ("SHIFT", 84), - (84, G["id"]): ("SHIFT", 79), - (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), - (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), - (86, G["esac"]): ("SHIFT", 87), - (87, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G[","]): ("SHIFT", 89), - (88, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), - (89, G["id"]): ("SHIFT", 24), - (90, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), - (91, G["in"]): ("SHIFT", 92), - (92, G["("]): ("SHIFT", 20), - (92, G["case"]): ("SHIFT", 30), - (92, G["id"]): ("SHIFT", 15), - (92, G["isvoid"]): ("SHIFT", 33), - (92, G["string"]): ("SHIFT", 17), - (92, G["{"]): ("SHIFT", 19), - (92, G["false"]): ("SHIFT", 36), - (92, G["new"]): ("SHIFT", 31), - (92, G["int"]): ("SHIFT", 18), - (92, G["while"]): ("SHIFT", 22), - (92, G["if"]): ("SHIFT", 21), - (92, G["true"]): ("SHIFT", 35), - (92, G["not"]): ("SHIFT", 44), - (92, G["let"]): ("SHIFT", 23), - (92, G["~"]): ("SHIFT", 37), - (93, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G["loop"]): ("SHIFT", 95), - (95, G["new"]): ("SHIFT", 31), - (95, G["id"]): ("SHIFT", 15), - (95, G["let"]): ("SHIFT", 23), - (95, G["case"]): ("SHIFT", 30), - (95, G["int"]): ("SHIFT", 18), - (95, G["true"]): ("SHIFT", 35), - (95, G["{"]): ("SHIFT", 19), - (95, G["~"]): ("SHIFT", 37), - (95, G["("]): ("SHIFT", 20), - (95, G["string"]): ("SHIFT", 17), - (95, G["isvoid"]): ("SHIFT", 33), - (95, G["while"]): ("SHIFT", 22), - (95, G["if"]): ("SHIFT", 21), - (95, G["false"]): ("SHIFT", 36), - (95, G["not"]): ("SHIFT", 44), - (96, G["pool"]): ("SHIFT", 97), - (97, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G["then"]): ("SHIFT", 99), - (99, G["if"]): ("SHIFT", 21), - (99, G["id"]): ("SHIFT", 15), - (99, G["not"]): ("SHIFT", 44), - (99, G["int"]): ("SHIFT", 18), - (99, G["let"]): ("SHIFT", 23), - (99, G["case"]): ("SHIFT", 30), - (99, G["true"]): ("SHIFT", 35), - (99, G["~"]): ("SHIFT", 37), - (99, G["{"]): ("SHIFT", 19), - (99, G["("]): ("SHIFT", 20), - (99, G["string"]): ("SHIFT", 17), - (99, G["isvoid"]): ("SHIFT", 33), - (99, G["false"]): ("SHIFT", 36), - (99, G["while"]): ("SHIFT", 22), - (99, G["new"]): ("SHIFT", 31), - (100, G["else"]): ("SHIFT", 101), - (101, G["case"]): ("SHIFT", 30), - (101, G["("]): ("SHIFT", 20), - (101, G["id"]): ("SHIFT", 15), - (101, G["~"]): ("SHIFT", 37), - (101, G["{"]): ("SHIFT", 19), - (101, G["string"]): ("SHIFT", 17), - (101, G["isvoid"]): ("SHIFT", 33), - (101, G["false"]): ("SHIFT", 36), - (101, G["new"]): ("SHIFT", 31), - (101, G["while"]): ("SHIFT", 22), - (101, G["if"]): ("SHIFT", 21), - (101, G["not"]): ("SHIFT", 44), - (101, G["int"]): ("SHIFT", 18), - (101, G["true"]): ("SHIFT", 35), - (101, G["let"]): ("SHIFT", 23), - (102, G["fi"]): ("SHIFT", 103), - (103, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G[")"]): ("SHIFT", 105), - (105, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["@"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["+"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["error"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["-"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["in"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["*"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["}"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["/"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["<"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["of"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G[")"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["<="]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["."]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["="]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["then"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G[","]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["else"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G[";"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["}"]): ("SHIFT", 107), - (107, G["of"]): ("REDUCE", G["expr -> { block }"]), - (107, G["loop"]): ("REDUCE", G["expr -> { block }"]), - (107, G[")"]): ("REDUCE", G["expr -> { block }"]), - (107, G["pool"]): ("REDUCE", G["expr -> { block }"]), - (107, G["then"]): ("REDUCE", G["expr -> { block }"]), - (107, G["error"]): ("REDUCE", G["expr -> { block }"]), - (107, G[","]): ("REDUCE", G["expr -> { block }"]), - (107, G["in"]): ("REDUCE", G["expr -> { block }"]), - (107, G["else"]): ("REDUCE", G["expr -> { block }"]), - (107, G["fi"]): ("REDUCE", G["expr -> { block }"]), - (107, G["}"]): ("REDUCE", G["expr -> { block }"]), - (107, G[";"]): ("REDUCE", G["expr -> { block }"]), - (108, G[";"]): ("SHIFT", 109), - (109, G["false"]): ("SHIFT", 36), - (109, G["new"]): ("SHIFT", 31), - (109, G["id"]): ("SHIFT", 15), - (109, G["while"]): ("SHIFT", 22), - (109, G["int"]): ("SHIFT", 18), - (109, G["if"]): ("SHIFT", 21), - (109, G["~"]): ("SHIFT", 37), - (109, G["true"]): ("SHIFT", 35), - (109, G["}"]): ("REDUCE", G["block -> expr ;"]), - (109, G["not"]): ("SHIFT", 44), - (109, G["let"]): ("SHIFT", 23), - (109, G["isvoid"]): ("SHIFT", 33), - (109, G["case"]): ("SHIFT", 30), - (109, G["("]): ("SHIFT", 20), - (109, G["string"]): ("SHIFT", 17), - (109, G["{"]): ("SHIFT", 19), - (110, G["}"]): ("REDUCE", G["block -> expr ; block"]), - (111, G[")"]): ("SHIFT", 112), - (112, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (112, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (113, G["("]): ("SHIFT", 20), - (113, G["case"]): ("SHIFT", 30), - (113, G["id"]): ("SHIFT", 15), - (113, G["isvoid"]): ("SHIFT", 33), - (113, G["string"]): ("SHIFT", 17), - (113, G["{"]): ("SHIFT", 19), - (113, G["false"]): ("SHIFT", 36), - (113, G["new"]): ("SHIFT", 31), - (113, G["int"]): ("SHIFT", 18), - (113, G["while"]): ("SHIFT", 22), - (113, G["if"]): ("SHIFT", 21), - (113, G["true"]): ("SHIFT", 35), - (113, G["not"]): ("SHIFT", 44), - (113, G["let"]): ("SHIFT", 23), - (113, G["~"]): ("SHIFT", 37), - (114, G["of"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G[")"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G["then"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G["error"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G[","]): ("REDUCE", G["expr -> id <- expr"]), - (114, G["in"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G["else"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G["}"]): ("REDUCE", G["expr -> id <- expr"]), - (114, G[";"]): ("REDUCE", G["expr -> id <- expr"]), - (115, G["}"]): ("SHIFT", 116), - (116, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), - (116, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (15, G[":"]): ("SHIFT", 16), + (16, G["type"]): ("SHIFT", 17), + (17, G["<-"]): ("SHIFT", 20), + (17, G[","]): ("SHIFT", 18), + (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), + (18, G["id"]): ("SHIFT", 15), + (19, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), + (20, G["("]): ("SHIFT", 11), + (20, G["isvoid"]): ("SHIFT", 24), + (20, G["case"]): ("SHIFT", 21), + (20, G["let"]): ("SHIFT", 14), + (20, G["while"]): ("SHIFT", 13), + (20, G["int"]): ("SHIFT", 34), + (20, G["false"]): ("SHIFT", 26), + (20, G["not"]): ("SHIFT", 30), + (20, G["id"]): ("SHIFT", 31), + (20, G["string"]): ("SHIFT", 33), + (20, G["if"]): ("SHIFT", 12), + (20, G["~"]): ("SHIFT", 27), + (20, G["{"]): ("SHIFT", 10), + (20, G["true"]): ("SHIFT", 25), + (20, G["new"]): ("SHIFT", 22), + (21, G["new"]): ("SHIFT", 22), + (21, G["("]): ("SHIFT", 11), + (21, G["~"]): ("SHIFT", 27), + (21, G["case"]): ("SHIFT", 21), + (21, G["let"]): ("SHIFT", 14), + (21, G["while"]): ("SHIFT", 13), + (21, G["not"]): ("SHIFT", 30), + (21, G["int"]): ("SHIFT", 34), + (21, G["isvoid"]): ("SHIFT", 24), + (21, G["false"]): ("SHIFT", 26), + (21, G["if"]): ("SHIFT", 12), + (21, G["id"]): ("SHIFT", 31), + (21, G["{"]): ("SHIFT", 10), + (21, G["string"]): ("SHIFT", 33), + (21, G["true"]): ("SHIFT", 25), + (22, G["type"]): ("SHIFT", 23), + (23, G[";"]): ("REDUCE", G["atom -> new type"]), + (23, G["loop"]): ("REDUCE", G["atom -> new type"]), + (23, G["@"]): ("REDUCE", G["atom -> new type"]), + (23, G["pool"]): ("REDUCE", G["atom -> new type"]), + (23, G["+"]): ("REDUCE", G["atom -> new type"]), + (23, G["-"]): ("REDUCE", G["atom -> new type"]), + (23, G["in"]): ("REDUCE", G["atom -> new type"]), + (23, G["*"]): ("REDUCE", G["atom -> new type"]), + (23, G["}"]): ("REDUCE", G["atom -> new type"]), + (23, G["/"]): ("REDUCE", G["atom -> new type"]), + (23, G["of"]): ("REDUCE", G["atom -> new type"]), + (23, G["<"]): ("REDUCE", G["atom -> new type"]), + (23, G[")"]): ("REDUCE", G["atom -> new type"]), + (23, G["<="]): ("REDUCE", G["atom -> new type"]), + (23, G["then"]): ("REDUCE", G["atom -> new type"]), + (23, G["."]): ("REDUCE", G["atom -> new type"]), + (23, G["="]): ("REDUCE", G["atom -> new type"]), + (23, G["else"]): ("REDUCE", G["atom -> new type"]), + (23, G["error"]): ("REDUCE", G["atom -> new type"]), + (23, G[","]): ("REDUCE", G["atom -> new type"]), + (23, G["fi"]): ("REDUCE", G["atom -> new type"]), + (24, G["false"]): ("SHIFT", 26), + (24, G["true"]): ("SHIFT", 25), + (24, G["id"]): ("SHIFT", 28), + (24, G["string"]): ("SHIFT", 33), + (24, G["int"]): ("SHIFT", 34), + (24, G["isvoid"]): ("SHIFT", 24), + (24, G["new"]): ("SHIFT", 22), + (24, G["("]): ("SHIFT", 11), + (24, G["~"]): ("SHIFT", 27), + (25, G[";"]): ("REDUCE", G["atom -> true"]), + (25, G["loop"]): ("REDUCE", G["atom -> true"]), + (25, G["@"]): ("REDUCE", G["atom -> true"]), + (25, G["pool"]): ("REDUCE", G["atom -> true"]), + (25, G["+"]): ("REDUCE", G["atom -> true"]), + (25, G["-"]): ("REDUCE", G["atom -> true"]), + (25, G["in"]): ("REDUCE", G["atom -> true"]), + (25, G["*"]): ("REDUCE", G["atom -> true"]), + (25, G["}"]): ("REDUCE", G["atom -> true"]), + (25, G["/"]): ("REDUCE", G["atom -> true"]), + (25, G["of"]): ("REDUCE", G["atom -> true"]), + (25, G["<"]): ("REDUCE", G["atom -> true"]), + (25, G[")"]): ("REDUCE", G["atom -> true"]), + (25, G["<="]): ("REDUCE", G["atom -> true"]), + (25, G["then"]): ("REDUCE", G["atom -> true"]), + (25, G["."]): ("REDUCE", G["atom -> true"]), + (25, G["="]): ("REDUCE", G["atom -> true"]), + (25, G["else"]): ("REDUCE", G["atom -> true"]), + (25, G["error"]): ("REDUCE", G["atom -> true"]), + (25, G[","]): ("REDUCE", G["atom -> true"]), + (25, G["fi"]): ("REDUCE", G["atom -> true"]), + (26, G[";"]): ("REDUCE", G["atom -> false"]), + (26, G["loop"]): ("REDUCE", G["atom -> false"]), + (26, G["@"]): ("REDUCE", G["atom -> false"]), + (26, G["pool"]): ("REDUCE", G["atom -> false"]), + (26, G["+"]): ("REDUCE", G["atom -> false"]), + (26, G["-"]): ("REDUCE", G["atom -> false"]), + (26, G["in"]): ("REDUCE", G["atom -> false"]), + (26, G["*"]): ("REDUCE", G["atom -> false"]), + (26, G["}"]): ("REDUCE", G["atom -> false"]), + (26, G["/"]): ("REDUCE", G["atom -> false"]), + (26, G["of"]): ("REDUCE", G["atom -> false"]), + (26, G["<"]): ("REDUCE", G["atom -> false"]), + (26, G[")"]): ("REDUCE", G["atom -> false"]), + (26, G["<="]): ("REDUCE", G["atom -> false"]), + (26, G["then"]): ("REDUCE", G["atom -> false"]), + (26, G["."]): ("REDUCE", G["atom -> false"]), + (26, G["="]): ("REDUCE", G["atom -> false"]), + (26, G["else"]): ("REDUCE", G["atom -> false"]), + (26, G["error"]): ("REDUCE", G["atom -> false"]), + (26, G[","]): ("REDUCE", G["atom -> false"]), + (26, G["fi"]): ("REDUCE", G["atom -> false"]), + (27, G["false"]): ("SHIFT", 26), + (27, G["true"]): ("SHIFT", 25), + (27, G["id"]): ("SHIFT", 28), + (27, G["string"]): ("SHIFT", 33), + (27, G["int"]): ("SHIFT", 34), + (27, G["isvoid"]): ("SHIFT", 24), + (27, G["new"]): ("SHIFT", 22), + (27, G["("]): ("SHIFT", 11), + (27, G["~"]): ("SHIFT", 27), + (28, G[";"]): ("REDUCE", G["atom -> id"]), + (28, G["loop"]): ("REDUCE", G["atom -> id"]), + (28, G["@"]): ("REDUCE", G["atom -> id"]), + (28, G["pool"]): ("REDUCE", G["atom -> id"]), + (28, G["+"]): ("REDUCE", G["atom -> id"]), + (28, G["-"]): ("REDUCE", G["atom -> id"]), + (28, G["in"]): ("REDUCE", G["atom -> id"]), + (28, G["*"]): ("REDUCE", G["atom -> id"]), + (28, G["}"]): ("REDUCE", G["atom -> id"]), + (28, G["/"]): ("REDUCE", G["atom -> id"]), + (28, G["of"]): ("REDUCE", G["atom -> id"]), + (28, G["<"]): ("REDUCE", G["atom -> id"]), + (28, G[")"]): ("REDUCE", G["atom -> id"]), + (28, G["<="]): ("REDUCE", G["atom -> id"]), + (28, G["then"]): ("REDUCE", G["atom -> id"]), + (28, G["."]): ("REDUCE", G["atom -> id"]), + (28, G["="]): ("REDUCE", G["atom -> id"]), + (28, G["else"]): ("REDUCE", G["atom -> id"]), + (28, G["error"]): ("REDUCE", G["atom -> id"]), + (28, G[","]): ("REDUCE", G["atom -> id"]), + (28, G["fi"]): ("REDUCE", G["atom -> id"]), + (28, G["("]): ("SHIFT", 29), + (29, G["isvoid"]): ("SHIFT", 24), + (29, G["int"]): ("SHIFT", 34), + (29, G["false"]): ("SHIFT", 26), + (29, G["let"]): ("SHIFT", 14), + (29, G["case"]): ("SHIFT", 21), + (29, G["id"]): ("SHIFT", 31), + (29, G["string"]): ("SHIFT", 33), + (29, G["while"]): ("SHIFT", 13), + (29, G["not"]): ("SHIFT", 30), + (29, G["true"]): ("SHIFT", 25), + (29, G["new"]): ("SHIFT", 22), + (29, G["("]): ("SHIFT", 11), + (29, G["if"]): ("SHIFT", 12), + (29, G["~"]): ("SHIFT", 27), + (29, G["{"]): ("SHIFT", 10), + (30, G["int"]): ("SHIFT", 34), + (30, G["isvoid"]): ("SHIFT", 24), + (30, G["case"]): ("SHIFT", 21), + (30, G["let"]): ("SHIFT", 14), + (30, G["false"]): ("SHIFT", 26), + (30, G["while"]): ("SHIFT", 13), + (30, G["id"]): ("SHIFT", 31), + (30, G["string"]): ("SHIFT", 33), + (30, G["not"]): ("SHIFT", 30), + (30, G["true"]): ("SHIFT", 25), + (30, G["new"]): ("SHIFT", 22), + (30, G["("]): ("SHIFT", 11), + (30, G["if"]): ("SHIFT", 12), + (30, G["{"]): ("SHIFT", 10), + (30, G["~"]): ("SHIFT", 27), + (31, G[";"]): ("REDUCE", G["atom -> id"]), + (31, G["loop"]): ("REDUCE", G["atom -> id"]), + (31, G["@"]): ("REDUCE", G["atom -> id"]), + (31, G["pool"]): ("REDUCE", G["atom -> id"]), + (31, G["+"]): ("REDUCE", G["atom -> id"]), + (31, G["-"]): ("REDUCE", G["atom -> id"]), + (31, G["in"]): ("REDUCE", G["atom -> id"]), + (31, G["*"]): ("REDUCE", G["atom -> id"]), + (31, G["}"]): ("REDUCE", G["atom -> id"]), + (31, G["/"]): ("REDUCE", G["atom -> id"]), + (31, G["of"]): ("REDUCE", G["atom -> id"]), + (31, G["<"]): ("REDUCE", G["atom -> id"]), + (31, G[")"]): ("REDUCE", G["atom -> id"]), + (31, G["<="]): ("REDUCE", G["atom -> id"]), + (31, G["then"]): ("REDUCE", G["atom -> id"]), + (31, G["."]): ("REDUCE", G["atom -> id"]), + (31, G["="]): ("REDUCE", G["atom -> id"]), + (31, G["else"]): ("REDUCE", G["atom -> id"]), + (31, G["error"]): ("REDUCE", G["atom -> id"]), + (31, G[","]): ("REDUCE", G["atom -> id"]), + (31, G["fi"]): ("REDUCE", G["atom -> id"]), + (31, G["<-"]): ("SHIFT", 32), + (31, G["("]): ("SHIFT", 29), + (32, G["int"]): ("SHIFT", 34), + (32, G["isvoid"]): ("SHIFT", 24), + (32, G["case"]): ("SHIFT", 21), + (32, G["let"]): ("SHIFT", 14), + (32, G["false"]): ("SHIFT", 26), + (32, G["while"]): ("SHIFT", 13), + (32, G["id"]): ("SHIFT", 31), + (32, G["string"]): ("SHIFT", 33), + (32, G["not"]): ("SHIFT", 30), + (32, G["true"]): ("SHIFT", 25), + (32, G["new"]): ("SHIFT", 22), + (32, G["("]): ("SHIFT", 11), + (32, G["if"]): ("SHIFT", 12), + (32, G["{"]): ("SHIFT", 10), + (32, G["~"]): ("SHIFT", 27), + (33, G[";"]): ("REDUCE", G["atom -> string"]), + (33, G["loop"]): ("REDUCE", G["atom -> string"]), + (33, G["@"]): ("REDUCE", G["atom -> string"]), + (33, G["pool"]): ("REDUCE", G["atom -> string"]), + (33, G["+"]): ("REDUCE", G["atom -> string"]), + (33, G["-"]): ("REDUCE", G["atom -> string"]), + (33, G["in"]): ("REDUCE", G["atom -> string"]), + (33, G["*"]): ("REDUCE", G["atom -> string"]), + (33, G["}"]): ("REDUCE", G["atom -> string"]), + (33, G["/"]): ("REDUCE", G["atom -> string"]), + (33, G["of"]): ("REDUCE", G["atom -> string"]), + (33, G["<"]): ("REDUCE", G["atom -> string"]), + (33, G[")"]): ("REDUCE", G["atom -> string"]), + (33, G["<="]): ("REDUCE", G["atom -> string"]), + (33, G["then"]): ("REDUCE", G["atom -> string"]), + (33, G["."]): ("REDUCE", G["atom -> string"]), + (33, G["="]): ("REDUCE", G["atom -> string"]), + (33, G["else"]): ("REDUCE", G["atom -> string"]), + (33, G["error"]): ("REDUCE", G["atom -> string"]), + (33, G[","]): ("REDUCE", G["atom -> string"]), + (33, G["fi"]): ("REDUCE", G["atom -> string"]), + (34, G[";"]): ("REDUCE", G["atom -> int"]), + (34, G["loop"]): ("REDUCE", G["atom -> int"]), + (34, G["@"]): ("REDUCE", G["atom -> int"]), + (34, G["pool"]): ("REDUCE", G["atom -> int"]), + (34, G["+"]): ("REDUCE", G["atom -> int"]), + (34, G["-"]): ("REDUCE", G["atom -> int"]), + (34, G["in"]): ("REDUCE", G["atom -> int"]), + (34, G["*"]): ("REDUCE", G["atom -> int"]), + (34, G["}"]): ("REDUCE", G["atom -> int"]), + (34, G["/"]): ("REDUCE", G["atom -> int"]), + (34, G["of"]): ("REDUCE", G["atom -> int"]), + (34, G["<"]): ("REDUCE", G["atom -> int"]), + (34, G[")"]): ("REDUCE", G["atom -> int"]), + (34, G["<="]): ("REDUCE", G["atom -> int"]), + (34, G["then"]): ("REDUCE", G["atom -> int"]), + (34, G["."]): ("REDUCE", G["atom -> int"]), + (34, G["="]): ("REDUCE", G["atom -> int"]), + (34, G["else"]): ("REDUCE", G["atom -> int"]), + (34, G["error"]): ("REDUCE", G["atom -> int"]), + (34, G[","]): ("REDUCE", G["atom -> int"]), + (34, G["fi"]): ("REDUCE", G["atom -> int"]), + (35, G[";"]): ("REDUCE", G["atom -> function-call"]), + (35, G["loop"]): ("REDUCE", G["atom -> function-call"]), + (35, G["@"]): ("REDUCE", G["atom -> function-call"]), + (35, G["pool"]): ("REDUCE", G["atom -> function-call"]), + (35, G["+"]): ("REDUCE", G["atom -> function-call"]), + (35, G["-"]): ("REDUCE", G["atom -> function-call"]), + (35, G["in"]): ("REDUCE", G["atom -> function-call"]), + (35, G["*"]): ("REDUCE", G["atom -> function-call"]), + (35, G["}"]): ("REDUCE", G["atom -> function-call"]), + (35, G["/"]): ("REDUCE", G["atom -> function-call"]), + (35, G["of"]): ("REDUCE", G["atom -> function-call"]), + (35, G["<"]): ("REDUCE", G["atom -> function-call"]), + (35, G[")"]): ("REDUCE", G["atom -> function-call"]), + (35, G["<="]): ("REDUCE", G["atom -> function-call"]), + (35, G["then"]): ("REDUCE", G["atom -> function-call"]), + (35, G["."]): ("REDUCE", G["atom -> function-call"]), + (35, G["="]): ("REDUCE", G["atom -> function-call"]), + (35, G["else"]): ("REDUCE", G["atom -> function-call"]), + (35, G["error"]): ("REDUCE", G["atom -> function-call"]), + (35, G[","]): ("REDUCE", G["atom -> function-call"]), + (35, G["fi"]): ("REDUCE", G["atom -> function-call"]), + (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["else"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["in"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["}"]): ("REDUCE", G["expr -> id <- expr"]), + (37, G[";"]): ("REDUCE", G["expr -> comp"]), + (37, G["of"]): ("REDUCE", G["expr -> comp"]), + (37, G["loop"]): ("REDUCE", G["expr -> comp"]), + (37, G[")"]): ("REDUCE", G["expr -> comp"]), + (37, G["pool"]): ("REDUCE", G["expr -> comp"]), + (37, G["then"]): ("REDUCE", G["expr -> comp"]), + (37, G["else"]): ("REDUCE", G["expr -> comp"]), + (37, G["error"]): ("REDUCE", G["expr -> comp"]), + (37, G[","]): ("REDUCE", G["expr -> comp"]), + (37, G["in"]): ("REDUCE", G["expr -> comp"]), + (37, G["fi"]): ("REDUCE", G["expr -> comp"]), + (37, G["}"]): ("REDUCE", G["expr -> comp"]), + (38, G["<="]): ("SHIFT", 67), + (38, G["+"]): ("SHIFT", 39), + (38, G[";"]): ("REDUCE", G["comp -> arith"]), + (38, G["of"]): ("REDUCE", G["comp -> arith"]), + (38, G["loop"]): ("REDUCE", G["comp -> arith"]), + (38, G[")"]): ("REDUCE", G["comp -> arith"]), + (38, G["pool"]): ("REDUCE", G["comp -> arith"]), + (38, G["then"]): ("REDUCE", G["comp -> arith"]), + (38, G["else"]): ("REDUCE", G["comp -> arith"]), + (38, G["error"]): ("REDUCE", G["comp -> arith"]), + (38, G[","]): ("REDUCE", G["comp -> arith"]), + (38, G["in"]): ("REDUCE", G["comp -> arith"]), + (38, G["fi"]): ("REDUCE", G["comp -> arith"]), + (38, G["}"]): ("REDUCE", G["comp -> arith"]), + (38, G["-"]): ("SHIFT", 63), + (38, G["<"]): ("SHIFT", 65), + (38, G["="]): ("SHIFT", 69), + (39, G["false"]): ("SHIFT", 26), + (39, G["id"]): ("SHIFT", 28), + (39, G["string"]): ("SHIFT", 33), + (39, G["true"]): ("SHIFT", 25), + (39, G["int"]): ("SHIFT", 34), + (39, G["isvoid"]): ("SHIFT", 24), + (39, G["new"]): ("SHIFT", 22), + (39, G["("]): ("SHIFT", 11), + (39, G["~"]): ("SHIFT", 27), + (40, G[";"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["+"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["of"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["<"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["<="]): ("REDUCE", G["arith -> arith + term"]), + (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["then"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["="]): ("REDUCE", G["arith -> arith + term"]), + (40, G["else"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), + (40, G[","]): ("REDUCE", G["arith -> arith + term"]), + (40, G["fi"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["/"]): ("SHIFT", 53), + (40, G["*"]): ("SHIFT", 41), + (41, G["false"]): ("SHIFT", 26), + (41, G["true"]): ("SHIFT", 25), + (41, G["id"]): ("SHIFT", 28), + (41, G["string"]): ("SHIFT", 33), + (41, G["int"]): ("SHIFT", 34), + (41, G["isvoid"]): ("SHIFT", 24), + (41, G["new"]): ("SHIFT", 22), + (41, G["("]): ("SHIFT", 11), + (41, G["~"]): ("SHIFT", 27), + (42, G[";"]): ("REDUCE", G["term -> term * factor"]), + (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), + (42, G["pool"]): ("REDUCE", G["term -> term * factor"]), + (42, G["+"]): ("REDUCE", G["term -> term * factor"]), + (42, G["-"]): ("REDUCE", G["term -> term * factor"]), + (42, G["in"]): ("REDUCE", G["term -> term * factor"]), + (42, G["*"]): ("REDUCE", G["term -> term * factor"]), + (42, G["}"]): ("REDUCE", G["term -> term * factor"]), + (42, G["/"]): ("REDUCE", G["term -> term * factor"]), + (42, G["of"]): ("REDUCE", G["term -> term * factor"]), + (42, G["<"]): ("REDUCE", G["term -> term * factor"]), + (42, G[")"]): ("REDUCE", G["term -> term * factor"]), + (42, G["<="]): ("REDUCE", G["term -> term * factor"]), + (42, G["then"]): ("REDUCE", G["term -> term * factor"]), + (42, G["="]): ("REDUCE", G["term -> term * factor"]), + (42, G["else"]): ("REDUCE", G["term -> term * factor"]), + (42, G["error"]): ("REDUCE", G["term -> term * factor"]), + (42, G[","]): ("REDUCE", G["term -> term * factor"]), + (42, G["fi"]): ("REDUCE", G["term -> term * factor"]), + (43, G[";"]): ("REDUCE", G["factor -> atom"]), + (43, G["loop"]): ("REDUCE", G["factor -> atom"]), + (43, G["pool"]): ("REDUCE", G["factor -> atom"]), + (43, G["+"]): ("REDUCE", G["factor -> atom"]), + (43, G["-"]): ("REDUCE", G["factor -> atom"]), + (43, G["in"]): ("REDUCE", G["factor -> atom"]), + (43, G["*"]): ("REDUCE", G["factor -> atom"]), + (43, G["}"]): ("REDUCE", G["factor -> atom"]), + (43, G["/"]): ("REDUCE", G["factor -> atom"]), + (43, G["of"]): ("REDUCE", G["factor -> atom"]), + (43, G["<"]): ("REDUCE", G["factor -> atom"]), + (43, G[")"]): ("REDUCE", G["factor -> atom"]), + (43, G["<="]): ("REDUCE", G["factor -> atom"]), + (43, G["then"]): ("REDUCE", G["factor -> atom"]), + (43, G["="]): ("REDUCE", G["factor -> atom"]), + (43, G["else"]): ("REDUCE", G["factor -> atom"]), + (43, G["error"]): ("REDUCE", G["factor -> atom"]), + (43, G[","]): ("REDUCE", G["factor -> atom"]), + (43, G["fi"]): ("REDUCE", G["factor -> atom"]), + (43, G["."]): ("SHIFT", 44), + (43, G["@"]): ("SHIFT", 56), + (44, G["id"]): ("SHIFT", 45), + (45, G["("]): ("SHIFT", 46), + (46, G["isvoid"]): ("SHIFT", 24), + (46, G["int"]): ("SHIFT", 34), + (46, G["false"]): ("SHIFT", 26), + (46, G["let"]): ("SHIFT", 14), + (46, G["case"]): ("SHIFT", 21), + (46, G["id"]): ("SHIFT", 31), + (46, G["string"]): ("SHIFT", 33), + (46, G["while"]): ("SHIFT", 13), + (46, G["not"]): ("SHIFT", 30), + (46, G["true"]): ("SHIFT", 25), + (46, G["new"]): ("SHIFT", 22), + (46, G["("]): ("SHIFT", 11), + (46, G["if"]): ("SHIFT", 12), + (46, G["~"]): ("SHIFT", 27), + (46, G["{"]): ("SHIFT", 10), + (47, G[")"]): ("SHIFT", 48), + (48, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (49, G[","]): ("SHIFT", 50), + (49, G[")"]): ("REDUCE", G["expr-list -> expr"]), + (50, G["isvoid"]): ("SHIFT", 24), + (50, G["int"]): ("SHIFT", 34), + (50, G["false"]): ("SHIFT", 26), + (50, G["let"]): ("SHIFT", 14), + (50, G["case"]): ("SHIFT", 21), + (50, G["id"]): ("SHIFT", 31), + (50, G["string"]): ("SHIFT", 33), + (50, G["while"]): ("SHIFT", 13), + (50, G["not"]): ("SHIFT", 30), + (50, G["true"]): ("SHIFT", 25), + (50, G["new"]): ("SHIFT", 22), + (50, G["("]): ("SHIFT", 11), + (50, G["if"]): ("SHIFT", 12), + (50, G["~"]): ("SHIFT", 27), + (50, G["{"]): ("SHIFT", 10), + (51, G[")"]): ("REDUCE", G["expr-list -> expr , expr-list"]), + (52, G[";"]): ("REDUCE", G["arith -> term"]), + (52, G["loop"]): ("REDUCE", G["arith -> term"]), + (52, G["pool"]): ("REDUCE", G["arith -> term"]), + (52, G["+"]): ("REDUCE", G["arith -> term"]), + (52, G["-"]): ("REDUCE", G["arith -> term"]), + (52, G["in"]): ("REDUCE", G["arith -> term"]), + (52, G["}"]): ("REDUCE", G["arith -> term"]), + (52, G["of"]): ("REDUCE", G["arith -> term"]), + (52, G["<"]): ("REDUCE", G["arith -> term"]), + (52, G["<="]): ("REDUCE", G["arith -> term"]), + (52, G[")"]): ("REDUCE", G["arith -> term"]), + (52, G["then"]): ("REDUCE", G["arith -> term"]), + (52, G["="]): ("REDUCE", G["arith -> term"]), + (52, G["else"]): ("REDUCE", G["arith -> term"]), + (52, G["error"]): ("REDUCE", G["arith -> term"]), + (52, G[","]): ("REDUCE", G["arith -> term"]), + (52, G["fi"]): ("REDUCE", G["arith -> term"]), + (52, G["/"]): ("SHIFT", 53), + (52, G["*"]): ("SHIFT", 41), + (53, G["false"]): ("SHIFT", 26), + (53, G["true"]): ("SHIFT", 25), + (53, G["id"]): ("SHIFT", 28), + (53, G["string"]): ("SHIFT", 33), + (53, G["int"]): ("SHIFT", 34), + (53, G["isvoid"]): ("SHIFT", 24), + (53, G["new"]): ("SHIFT", 22), + (53, G["("]): ("SHIFT", 11), + (53, G["~"]): ("SHIFT", 27), + (54, G[";"]): ("REDUCE", G["term -> term / factor"]), + (54, G["loop"]): ("REDUCE", G["term -> term / factor"]), + (54, G["pool"]): ("REDUCE", G["term -> term / factor"]), + (54, G["+"]): ("REDUCE", G["term -> term / factor"]), + (54, G["-"]): ("REDUCE", G["term -> term / factor"]), + (54, G["in"]): ("REDUCE", G["term -> term / factor"]), + (54, G["*"]): ("REDUCE", G["term -> term / factor"]), + (54, G["}"]): ("REDUCE", G["term -> term / factor"]), + (54, G["/"]): ("REDUCE", G["term -> term / factor"]), + (54, G["of"]): ("REDUCE", G["term -> term / factor"]), + (54, G["<"]): ("REDUCE", G["term -> term / factor"]), + (54, G[")"]): ("REDUCE", G["term -> term / factor"]), + (54, G["<="]): ("REDUCE", G["term -> term / factor"]), + (54, G["then"]): ("REDUCE", G["term -> term / factor"]), + (54, G["="]): ("REDUCE", G["term -> term / factor"]), + (54, G["else"]): ("REDUCE", G["term -> term / factor"]), + (54, G["error"]): ("REDUCE", G["term -> term / factor"]), + (54, G[","]): ("REDUCE", G["term -> term / factor"]), + (54, G["fi"]): ("REDUCE", G["term -> term / factor"]), + (55, G[";"]): ("REDUCE", G["term -> factor"]), + (55, G["loop"]): ("REDUCE", G["term -> factor"]), + (55, G["pool"]): ("REDUCE", G["term -> factor"]), + (55, G["+"]): ("REDUCE", G["term -> factor"]), + (55, G["-"]): ("REDUCE", G["term -> factor"]), + (55, G["in"]): ("REDUCE", G["term -> factor"]), + (55, G["*"]): ("REDUCE", G["term -> factor"]), + (55, G["}"]): ("REDUCE", G["term -> factor"]), + (55, G["/"]): ("REDUCE", G["term -> factor"]), + (55, G["of"]): ("REDUCE", G["term -> factor"]), + (55, G["<"]): ("REDUCE", G["term -> factor"]), + (55, G[")"]): ("REDUCE", G["term -> factor"]), + (55, G["<="]): ("REDUCE", G["term -> factor"]), + (55, G["then"]): ("REDUCE", G["term -> factor"]), + (55, G["="]): ("REDUCE", G["term -> factor"]), + (55, G["else"]): ("REDUCE", G["term -> factor"]), + (55, G["error"]): ("REDUCE", G["term -> factor"]), + (55, G[","]): ("REDUCE", G["term -> factor"]), + (55, G["fi"]): ("REDUCE", G["term -> factor"]), + (56, G["type"]): ("SHIFT", 57), + (57, G["."]): ("SHIFT", 58), + (58, G["id"]): ("SHIFT", 59), + (59, G["("]): ("SHIFT", 60), + (60, G["isvoid"]): ("SHIFT", 24), + (60, G["int"]): ("SHIFT", 34), + (60, G["false"]): ("SHIFT", 26), + (60, G["let"]): ("SHIFT", 14), + (60, G["case"]): ("SHIFT", 21), + (60, G["id"]): ("SHIFT", 31), + (60, G["string"]): ("SHIFT", 33), + (60, G["while"]): ("SHIFT", 13), + (60, G["not"]): ("SHIFT", 30), + (60, G["true"]): ("SHIFT", 25), + (60, G["new"]): ("SHIFT", 22), + (60, G["("]): ("SHIFT", 11), + (60, G["if"]): ("SHIFT", 12), + (60, G["~"]): ("SHIFT", 27), + (60, G["{"]): ("SHIFT", 10), + (61, G[")"]): ("SHIFT", 62), + (62, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (62, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (62, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (62, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (62, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (62, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (62, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (62, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (62, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (62, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (62, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (62, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (62, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (62, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (62, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (62, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (62, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (62, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (62, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (62, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (62, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["false"]): ("SHIFT", 26), + (63, G["id"]): ("SHIFT", 28), + (63, G["string"]): ("SHIFT", 33), + (63, G["true"]): ("SHIFT", 25), + (63, G["int"]): ("SHIFT", 34), + (63, G["isvoid"]): ("SHIFT", 24), + (63, G["new"]): ("SHIFT", 22), + (63, G["("]): ("SHIFT", 11), + (63, G["~"]): ("SHIFT", 27), + (64, G[";"]): ("REDUCE", G["arith -> arith - term"]), + (64, G["loop"]): ("REDUCE", G["arith -> arith - term"]), + (64, G["pool"]): ("REDUCE", G["arith -> arith - term"]), + (64, G["+"]): ("REDUCE", G["arith -> arith - term"]), + (64, G["-"]): ("REDUCE", G["arith -> arith - term"]), + (64, G["in"]): ("REDUCE", G["arith -> arith - term"]), + (64, G["}"]): ("REDUCE", G["arith -> arith - term"]), + (64, G["of"]): ("REDUCE", G["arith -> arith - term"]), + (64, G["<"]): ("REDUCE", G["arith -> arith - term"]), + (64, G["<="]): ("REDUCE", G["arith -> arith - term"]), + (64, G[")"]): ("REDUCE", G["arith -> arith - term"]), + (64, G["then"]): ("REDUCE", G["arith -> arith - term"]), + (64, G["="]): ("REDUCE", G["arith -> arith - term"]), + (64, G["else"]): ("REDUCE", G["arith -> arith - term"]), + (64, G["error"]): ("REDUCE", G["arith -> arith - term"]), + (64, G[","]): ("REDUCE", G["arith -> arith - term"]), + (64, G["fi"]): ("REDUCE", G["arith -> arith - term"]), + (64, G["/"]): ("SHIFT", 53), + (64, G["*"]): ("SHIFT", 41), + (65, G["~"]): ("SHIFT", 27), + (65, G["false"]): ("SHIFT", 26), + (65, G["id"]): ("SHIFT", 28), + (65, G["string"]): ("SHIFT", 33), + (65, G["true"]): ("SHIFT", 25), + (65, G["new"]): ("SHIFT", 22), + (65, G["isvoid"]): ("SHIFT", 24), + (65, G["int"]): ("SHIFT", 34), + (65, G["("]): ("SHIFT", 11), + (66, G["+"]): ("SHIFT", 39), + (66, G["-"]): ("SHIFT", 63), + (66, G[";"]): ("REDUCE", G["comp -> arith < arith"]), + (66, G["of"]): ("REDUCE", G["comp -> arith < arith"]), + (66, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), + (66, G[")"]): ("REDUCE", G["comp -> arith < arith"]), + (66, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), + (66, G["then"]): ("REDUCE", G["comp -> arith < arith"]), + (66, G["else"]): ("REDUCE", G["comp -> arith < arith"]), + (66, G["error"]): ("REDUCE", G["comp -> arith < arith"]), + (66, G[","]): ("REDUCE", G["comp -> arith < arith"]), + (66, G["in"]): ("REDUCE", G["comp -> arith < arith"]), + (66, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), + (66, G["}"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["~"]): ("SHIFT", 27), + (67, G["false"]): ("SHIFT", 26), + (67, G["id"]): ("SHIFT", 28), + (67, G["string"]): ("SHIFT", 33), + (67, G["true"]): ("SHIFT", 25), + (67, G["new"]): ("SHIFT", 22), + (67, G["isvoid"]): ("SHIFT", 24), + (67, G["int"]): ("SHIFT", 34), + (67, G["("]): ("SHIFT", 11), + (68, G["+"]): ("SHIFT", 39), + (68, G["-"]): ("SHIFT", 63), + (68, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), + (68, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), + (68, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), + (68, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), + (68, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), + (68, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), + (68, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), + (68, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), + (68, G[","]): ("REDUCE", G["comp -> arith <= arith"]), + (68, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), + (68, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), + (68, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["~"]): ("SHIFT", 27), + (69, G["false"]): ("SHIFT", 26), + (69, G["id"]): ("SHIFT", 28), + (69, G["string"]): ("SHIFT", 33), + (69, G["true"]): ("SHIFT", 25), + (69, G["new"]): ("SHIFT", 22), + (69, G["isvoid"]): ("SHIFT", 24), + (69, G["int"]): ("SHIFT", 34), + (69, G["("]): ("SHIFT", 11), + (70, G["+"]): ("SHIFT", 39), + (70, G[";"]): ("REDUCE", G["comp -> arith = arith"]), + (70, G["of"]): ("REDUCE", G["comp -> arith = arith"]), + (70, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), + (70, G[")"]): ("REDUCE", G["comp -> arith = arith"]), + (70, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), + (70, G["then"]): ("REDUCE", G["comp -> arith = arith"]), + (70, G["else"]): ("REDUCE", G["comp -> arith = arith"]), + (70, G["error"]): ("REDUCE", G["comp -> arith = arith"]), + (70, G[","]): ("REDUCE", G["comp -> arith = arith"]), + (70, G["in"]): ("REDUCE", G["comp -> arith = arith"]), + (70, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), + (70, G["}"]): ("REDUCE", G["comp -> arith = arith"]), + (70, G["-"]): ("SHIFT", 63), + (71, G[";"]): ("REDUCE", G["expr -> not expr"]), + (71, G["of"]): ("REDUCE", G["expr -> not expr"]), + (71, G["loop"]): ("REDUCE", G["expr -> not expr"]), + (71, G[")"]): ("REDUCE", G["expr -> not expr"]), + (71, G["pool"]): ("REDUCE", G["expr -> not expr"]), + (71, G["then"]): ("REDUCE", G["expr -> not expr"]), + (71, G["else"]): ("REDUCE", G["expr -> not expr"]), + (71, G["error"]): ("REDUCE", G["expr -> not expr"]), + (71, G[","]): ("REDUCE", G["expr -> not expr"]), + (71, G["in"]): ("REDUCE", G["expr -> not expr"]), + (71, G["fi"]): ("REDUCE", G["expr -> not expr"]), + (71, G["}"]): ("REDUCE", G["expr -> not expr"]), + (72, G[")"]): ("SHIFT", 73), + (73, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (73, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (73, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (73, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (73, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (73, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (73, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (73, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (73, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (73, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (73, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (73, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (73, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (73, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (73, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (73, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (73, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (73, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (73, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (73, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (73, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G[";"]): ("REDUCE", G["factor -> ~ factor"]), + (74, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), + (74, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), + (74, G["+"]): ("REDUCE", G["factor -> ~ factor"]), + (74, G["-"]): ("REDUCE", G["factor -> ~ factor"]), + (74, G["in"]): ("REDUCE", G["factor -> ~ factor"]), + (74, G["*"]): ("REDUCE", G["factor -> ~ factor"]), + (74, G["}"]): ("REDUCE", G["factor -> ~ factor"]), + (74, G["/"]): ("REDUCE", G["factor -> ~ factor"]), + (74, G["of"]): ("REDUCE", G["factor -> ~ factor"]), + (74, G["<"]): ("REDUCE", G["factor -> ~ factor"]), + (74, G[")"]): ("REDUCE", G["factor -> ~ factor"]), + (74, G["<="]): ("REDUCE", G["factor -> ~ factor"]), + (74, G["then"]): ("REDUCE", G["factor -> ~ factor"]), + (74, G["="]): ("REDUCE", G["factor -> ~ factor"]), + (74, G["else"]): ("REDUCE", G["factor -> ~ factor"]), + (74, G["error"]): ("REDUCE", G["factor -> ~ factor"]), + (74, G[","]): ("REDUCE", G["factor -> ~ factor"]), + (74, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), + (75, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), + (75, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), + (75, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), + (75, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), + (75, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), + (75, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), + (75, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), + (75, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), + (75, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), + (75, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), + (75, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), + (75, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), + (75, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), + (75, G["="]): ("REDUCE", G["factor -> isvoid factor"]), + (75, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), + (75, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), + (75, G[","]): ("REDUCE", G["factor -> isvoid factor"]), + (75, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["of"]): ("SHIFT", 77), + (77, G["id"]): ("SHIFT", 78), + (78, G[":"]): ("SHIFT", 79), + (79, G["type"]): ("SHIFT", 80), + (80, G["=>"]): ("SHIFT", 81), + (81, G["new"]): ("SHIFT", 22), + (81, G["("]): ("SHIFT", 11), + (81, G["~"]): ("SHIFT", 27), + (81, G["case"]): ("SHIFT", 21), + (81, G["let"]): ("SHIFT", 14), + (81, G["while"]): ("SHIFT", 13), + (81, G["not"]): ("SHIFT", 30), + (81, G["if"]): ("SHIFT", 12), + (81, G["int"]): ("SHIFT", 34), + (81, G["isvoid"]): ("SHIFT", 24), + (81, G["{"]): ("SHIFT", 10), + (81, G["id"]): ("SHIFT", 31), + (81, G["false"]): ("SHIFT", 26), + (81, G["string"]): ("SHIFT", 33), + (81, G["true"]): ("SHIFT", 25), + (82, G[";"]): ("SHIFT", 83), + (83, G["id"]): ("SHIFT", 78), + (83, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), + (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), + (85, G["esac"]): ("SHIFT", 86), + (86, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (86, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (86, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (86, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (86, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (86, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (86, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (86, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (86, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (86, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (86, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (86, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (87, G[","]): ("SHIFT", 88), + (87, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), + (88, G["id"]): ("SHIFT", 15), + (89, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), + (90, G["in"]): ("SHIFT", 91), + (91, G["int"]): ("SHIFT", 34), + (91, G["isvoid"]): ("SHIFT", 24), + (91, G["case"]): ("SHIFT", 21), + (91, G["let"]): ("SHIFT", 14), + (91, G["false"]): ("SHIFT", 26), + (91, G["while"]): ("SHIFT", 13), + (91, G["id"]): ("SHIFT", 31), + (91, G["string"]): ("SHIFT", 33), + (91, G["not"]): ("SHIFT", 30), + (91, G["true"]): ("SHIFT", 25), + (91, G["new"]): ("SHIFT", 22), + (91, G["("]): ("SHIFT", 11), + (91, G["if"]): ("SHIFT", 12), + (91, G["{"]): ("SHIFT", 10), + (91, G["~"]): ("SHIFT", 27), + (92, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (92, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (92, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (92, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (92, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (92, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (92, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (92, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (92, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (92, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (92, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (92, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["loop"]): ("SHIFT", 94), + (94, G["not"]): ("SHIFT", 30), + (94, G["int"]): ("SHIFT", 34), + (94, G["false"]): ("SHIFT", 26), + (94, G["id"]): ("SHIFT", 31), + (94, G["string"]): ("SHIFT", 33), + (94, G["{"]): ("SHIFT", 10), + (94, G["if"]): ("SHIFT", 12), + (94, G["true"]): ("SHIFT", 25), + (94, G["~"]): ("SHIFT", 27), + (94, G["new"]): ("SHIFT", 22), + (94, G["("]): ("SHIFT", 11), + (94, G["let"]): ("SHIFT", 14), + (94, G["case"]): ("SHIFT", 21), + (94, G["isvoid"]): ("SHIFT", 24), + (94, G["while"]): ("SHIFT", 13), + (95, G["pool"]): ("SHIFT", 96), + (96, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (96, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (96, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (96, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (96, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (96, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (96, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (96, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (96, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (96, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (96, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (96, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (97, G["then"]): ("SHIFT", 98), + (98, G["isvoid"]): ("SHIFT", 24), + (98, G["if"]): ("SHIFT", 12), + (98, G["id"]): ("SHIFT", 31), + (98, G["{"]): ("SHIFT", 10), + (98, G["true"]): ("SHIFT", 25), + (98, G["new"]): ("SHIFT", 22), + (98, G["("]): ("SHIFT", 11), + (98, G["~"]): ("SHIFT", 27), + (98, G["case"]): ("SHIFT", 21), + (98, G["let"]): ("SHIFT", 14), + (98, G["int"]): ("SHIFT", 34), + (98, G["while"]): ("SHIFT", 13), + (98, G["not"]): ("SHIFT", 30), + (98, G["false"]): ("SHIFT", 26), + (98, G["string"]): ("SHIFT", 33), + (99, G["else"]): ("SHIFT", 100), + (100, G["false"]): ("SHIFT", 26), + (100, G["id"]): ("SHIFT", 31), + (100, G["string"]): ("SHIFT", 33), + (100, G["let"]): ("SHIFT", 14), + (100, G["case"]): ("SHIFT", 21), + (100, G["isvoid"]): ("SHIFT", 24), + (100, G["true"]): ("SHIFT", 25), + (100, G["while"]): ("SHIFT", 13), + (100, G["not"]): ("SHIFT", 30), + (100, G["new"]): ("SHIFT", 22), + (100, G["("]): ("SHIFT", 11), + (100, G["if"]): ("SHIFT", 12), + (100, G["{"]): ("SHIFT", 10), + (100, G["~"]): ("SHIFT", 27), + (100, G["int"]): ("SHIFT", 34), + (101, G["fi"]): ("SHIFT", 102), + (102, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (102, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (102, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (102, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (102, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (102, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (102, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (102, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (102, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (102, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (102, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (102, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (103, G[")"]): ("SHIFT", 104), + (104, G[";"]): ("REDUCE", G["atom -> ( expr )"]), + (104, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), + (104, G["@"]): ("REDUCE", G["atom -> ( expr )"]), + (104, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), + (104, G["+"]): ("REDUCE", G["atom -> ( expr )"]), + (104, G["-"]): ("REDUCE", G["atom -> ( expr )"]), + (104, G["in"]): ("REDUCE", G["atom -> ( expr )"]), + (104, G["*"]): ("REDUCE", G["atom -> ( expr )"]), + (104, G["}"]): ("REDUCE", G["atom -> ( expr )"]), + (104, G["/"]): ("REDUCE", G["atom -> ( expr )"]), + (104, G["of"]): ("REDUCE", G["atom -> ( expr )"]), + (104, G["<"]): ("REDUCE", G["atom -> ( expr )"]), + (104, G[")"]): ("REDUCE", G["atom -> ( expr )"]), + (104, G["<="]): ("REDUCE", G["atom -> ( expr )"]), + (104, G["then"]): ("REDUCE", G["atom -> ( expr )"]), + (104, G["."]): ("REDUCE", G["atom -> ( expr )"]), + (104, G["="]): ("REDUCE", G["atom -> ( expr )"]), + (104, G["else"]): ("REDUCE", G["atom -> ( expr )"]), + (104, G["error"]): ("REDUCE", G["atom -> ( expr )"]), + (104, G[","]): ("REDUCE", G["atom -> ( expr )"]), + (104, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), + (105, G["}"]): ("SHIFT", 106), + (106, G[";"]): ("REDUCE", G["expr -> { block }"]), + (106, G["of"]): ("REDUCE", G["expr -> { block }"]), + (106, G["loop"]): ("REDUCE", G["expr -> { block }"]), + (106, G[")"]): ("REDUCE", G["expr -> { block }"]), + (106, G["pool"]): ("REDUCE", G["expr -> { block }"]), + (106, G["then"]): ("REDUCE", G["expr -> { block }"]), + (106, G["else"]): ("REDUCE", G["expr -> { block }"]), + (106, G["error"]): ("REDUCE", G["expr -> { block }"]), + (106, G[","]): ("REDUCE", G["expr -> { block }"]), + (106, G["in"]): ("REDUCE", G["expr -> { block }"]), + (106, G["fi"]): ("REDUCE", G["expr -> { block }"]), + (106, G["}"]): ("REDUCE", G["expr -> { block }"]), + (107, G[";"]): ("SHIFT", 108), + (108, G["new"]): ("SHIFT", 22), + (108, G["("]): ("SHIFT", 11), + (108, G["~"]): ("SHIFT", 27), + (108, G["case"]): ("SHIFT", 21), + (108, G["let"]): ("SHIFT", 14), + (108, G["while"]): ("SHIFT", 13), + (108, G["not"]): ("SHIFT", 30), + (108, G["if"]): ("SHIFT", 12), + (108, G["int"]): ("SHIFT", 34), + (108, G["isvoid"]): ("SHIFT", 24), + (108, G["{"]): ("SHIFT", 10), + (108, G["id"]): ("SHIFT", 31), + (108, G["false"]): ("SHIFT", 26), + (108, G["string"]): ("SHIFT", 33), + (108, G["true"]): ("SHIFT", 25), + (108, G["}"]): ("REDUCE", G["block -> expr ;"]), + (109, G["}"]): ("REDUCE", G["block -> expr ; block"]), + (110, G["}"]): ("SHIFT", 111), + (111, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (111, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (112, G[":"]): ("SHIFT", 113), + (113, G["type"]): ("SHIFT", 114), + (114, G[","]): ("SHIFT", 115), + (114, G[")"]): ("REDUCE", G["param-list -> id : type"]), + (115, G["id"]): ("SHIFT", 112), + (116, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), (117, G[")"]): ("SHIFT", 118), (118, G[":"]): ("SHIFT", 119), (119, G["type"]): ("SHIFT", 120), (120, G["{"]): ("SHIFT", 121), - (121, G["case"]): ("SHIFT", 30), - (121, G["("]): ("SHIFT", 20), - (121, G["let"]): ("SHIFT", 23), - (121, G["id"]): ("SHIFT", 15), - (121, G["{"]): ("SHIFT", 19), - (121, G["string"]): ("SHIFT", 17), - (121, G["false"]): ("SHIFT", 36), - (121, G["~"]): ("SHIFT", 37), - (121, G["new"]): ("SHIFT", 31), - (121, G["while"]): ("SHIFT", 22), - (121, G["if"]): ("SHIFT", 21), - (121, G["isvoid"]): ("SHIFT", 33), - (121, G["int"]): ("SHIFT", 18), - (121, G["not"]): ("SHIFT", 44), - (121, G["true"]): ("SHIFT", 35), + (121, G["false"]): ("SHIFT", 26), + (121, G["while"]): ("SHIFT", 13), + (121, G["id"]): ("SHIFT", 31), + (121, G["not"]): ("SHIFT", 30), + (121, G["string"]): ("SHIFT", 33), + (121, G["true"]): ("SHIFT", 25), + (121, G["isvoid"]): ("SHIFT", 24), + (121, G["if"]): ("SHIFT", 12), + (121, G["new"]): ("SHIFT", 22), + (121, G["("]): ("SHIFT", 11), + (121, G["{"]): ("SHIFT", 10), + (121, G["~"]): ("SHIFT", 27), + (121, G["int"]): ("SHIFT", 34), + (121, G["case"]): ("SHIFT", 21), + (121, G["let"]): ("SHIFT", 14), (122, G["}"]): ("SHIFT", 123), (123, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (123, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), @@ -1056,21 +1056,21 @@ def __action_table(): (125, G[";"]): ("REDUCE", G["attribute -> id : type"]), (125, G["error"]): ("REDUCE", G["attribute -> id : type"]), (125, G["<-"]): ("SHIFT", 126), - (126, G["if"]): ("SHIFT", 21), - (126, G["id"]): ("SHIFT", 15), - (126, G["not"]): ("SHIFT", 44), - (126, G["string"]): ("SHIFT", 17), - (126, G["let"]): ("SHIFT", 23), - (126, G["case"]): ("SHIFT", 30), - (126, G["false"]): ("SHIFT", 36), - (126, G["new"]): ("SHIFT", 31), - (126, G["{"]): ("SHIFT", 19), - (126, G["~"]): ("SHIFT", 37), - (126, G["int"]): ("SHIFT", 18), - (126, G["true"]): ("SHIFT", 35), - (126, G["isvoid"]): ("SHIFT", 33), - (126, G["while"]): ("SHIFT", 22), - (126, G["("]): ("SHIFT", 20), + (126, G["if"]): ("SHIFT", 12), + (126, G["id"]): ("SHIFT", 31), + (126, G["{"]): ("SHIFT", 10), + (126, G["int"]): ("SHIFT", 34), + (126, G["false"]): ("SHIFT", 26), + (126, G["~"]): ("SHIFT", 27), + (126, G["string"]): ("SHIFT", 33), + (126, G["true"]): ("SHIFT", 25), + (126, G["new"]): ("SHIFT", 22), + (126, G["("]): ("SHIFT", 11), + (126, G["let"]): ("SHIFT", 14), + (126, G["case"]): ("SHIFT", 21), + (126, G["isvoid"]): ("SHIFT", 24), + (126, G["while"]): ("SHIFT", 13), + (126, G["not"]): ("SHIFT", 30), (127, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), (127, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), (128, G["}"]): ("SHIFT", 129), @@ -1081,8 +1081,8 @@ def __action_table(): (131, G["}"]): ("REDUCE", G["feature-list -> e"]), (131, G["id"]): ("SHIFT", 4), (132, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), - (133, G["error"]): ("SHIFT", 136), (133, G[";"]): ("SHIFT", 134), + (133, G["error"]): ("SHIFT", 136), (134, G["}"]): ("REDUCE", G["feature-list -> e"]), (134, G["id"]): ("SHIFT", 4), (135, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), @@ -1116,215 +1116,215 @@ def __goto_table(): (3, G["method"]): 133, (3, G["feature-list"]): 128, (5, G["param-list"]): 117, - (9, G["param-list"]): 10, - (14, G["arith"]): 47, - (14, G["comp"]): 46, - (14, G["function-call"]): 38, - (14, G["atom"]): 40, - (14, G["expr"]): 115, - (14, G["factor"]): 54, - (14, G["term"]): 59, - (16, G["atom"]): 40, - (16, G["term"]): 59, - (16, G["function-call"]): 38, - (16, G["expr"]): 66, - (16, G["comp"]): 46, - (16, G["arith"]): 47, - (16, G["expr-list"]): 111, - (16, G["factor"]): 54, - (19, G["function-call"]): 38, - (19, G["arith"]): 47, - (19, G["atom"]): 40, - (19, G["term"]): 59, - (19, G["expr"]): 108, - (19, G["factor"]): 54, - (19, G["block"]): 106, - (19, G["comp"]): 46, - (20, G["atom"]): 40, - (20, G["arith"]): 47, - (20, G["term"]): 59, - (20, G["factor"]): 54, - (20, G["comp"]): 46, - (20, G["expr"]): 104, - (20, G["function-call"]): 38, - (21, G["function-call"]): 38, - (21, G["atom"]): 40, - (21, G["arith"]): 47, - (21, G["term"]): 59, - (21, G["factor"]): 54, - (21, G["expr"]): 98, - (21, G["comp"]): 46, - (22, G["arith"]): 47, - (22, G["factor"]): 54, - (22, G["function-call"]): 38, - (22, G["atom"]): 40, - (22, G["expr"]): 94, - (22, G["term"]): 59, - (22, G["comp"]): 46, - (23, G["declaration-list"]): 91, - (27, G["declaration-list"]): 28, - (29, G["arith"]): 47, - (29, G["factor"]): 54, - (29, G["function-call"]): 38, - (29, G["atom"]): 40, - (29, G["term"]): 59, - (29, G["expr"]): 88, - (29, G["comp"]): 46, - (30, G["arith"]): 47, - (30, G["term"]): 59, - (30, G["function-call"]): 38, - (30, G["comp"]): 46, - (30, G["atom"]): 40, - (30, G["expr"]): 77, - (30, G["factor"]): 54, - (33, G["atom"]): 40, - (33, G["factor"]): 76, - (33, G["function-call"]): 38, - (37, G["atom"]): 40, - (37, G["factor"]): 39, - (37, G["function-call"]): 38, - (43, G["expr-list"]): 64, - (43, G["atom"]): 40, - (43, G["term"]): 59, - (43, G["function-call"]): 38, - (43, G["expr"]): 66, - (43, G["comp"]): 46, - (43, G["arith"]): 47, - (43, G["factor"]): 54, - (44, G["factor"]): 54, - (44, G["comp"]): 46, - (44, G["expr"]): 45, - (44, G["atom"]): 40, - (44, G["term"]): 59, - (44, G["arith"]): 47, - (44, G["function-call"]): 38, - (48, G["atom"]): 40, - (48, G["factor"]): 54, - (48, G["term"]): 49, - (48, G["function-call"]): 38, - (50, G["factor"]): 51, - (50, G["atom"]): 40, - (50, G["function-call"]): 38, - (52, G["atom"]): 40, - (52, G["function-call"]): 38, - (52, G["factor"]): 53, - (55, G["atom"]): 40, - (55, G["factor"]): 54, - (55, G["term"]): 56, - (55, G["function-call"]): 38, - (57, G["term"]): 59, - (57, G["atom"]): 40, - (57, G["arith"]): 58, - (57, G["function-call"]): 38, - (57, G["factor"]): 54, - (60, G["term"]): 59, - (60, G["atom"]): 40, - (60, G["arith"]): 61, - (60, G["function-call"]): 38, - (60, G["factor"]): 54, - (62, G["term"]): 59, - (62, G["atom"]): 40, - (62, G["arith"]): 63, - (62, G["function-call"]): 38, - (62, G["factor"]): 54, - (67, G["atom"]): 40, - (67, G["term"]): 59, - (67, G["function-call"]): 38, - (67, G["expr"]): 66, - (67, G["comp"]): 46, - (67, G["arith"]): 47, - (67, G["expr-list"]): 68, - (67, G["factor"]): 54, - (73, G["atom"]): 40, - (73, G["term"]): 59, - (73, G["function-call"]): 38, - (73, G["expr"]): 66, - (73, G["comp"]): 46, - (73, G["arith"]): 47, - (73, G["expr-list"]): 74, - (73, G["factor"]): 54, - (78, G["case-list"]): 86, - (82, G["function-call"]): 38, - (82, G["arith"]): 47, - (82, G["atom"]): 40, - (82, G["term"]): 59, - (82, G["expr"]): 83, - (82, G["factor"]): 54, - (82, G["comp"]): 46, - (84, G["case-list"]): 85, - (89, G["declaration-list"]): 90, - (92, G["factor"]): 54, - (92, G["comp"]): 46, - (92, G["atom"]): 40, - (92, G["term"]): 59, - (92, G["arith"]): 47, - (92, G["function-call"]): 38, - (92, G["expr"]): 93, - (95, G["atom"]): 40, - (95, G["comp"]): 46, - (95, G["arith"]): 47, - (95, G["expr"]): 96, - (95, G["factor"]): 54, - (95, G["term"]): 59, - (95, G["function-call"]): 38, - (99, G["arith"]): 47, - (99, G["term"]): 59, - (99, G["atom"]): 40, - (99, G["comp"]): 46, - (99, G["factor"]): 54, - (99, G["expr"]): 100, - (99, G["function-call"]): 38, - (101, G["arith"]): 47, - (101, G["term"]): 59, - (101, G["comp"]): 46, - (101, G["factor"]): 54, - (101, G["function-call"]): 38, - (101, G["expr"]): 102, - (101, G["atom"]): 40, - (109, G["function-call"]): 38, - (109, G["arith"]): 47, - (109, G["atom"]): 40, - (109, G["term"]): 59, - (109, G["expr"]): 108, - (109, G["factor"]): 54, - (109, G["block"]): 110, - (109, G["comp"]): 46, - (113, G["factor"]): 54, - (113, G["comp"]): 46, - (113, G["atom"]): 40, - (113, G["term"]): 59, - (113, G["arith"]): 47, - (113, G["expr"]): 114, - (113, G["function-call"]): 38, - (121, G["arith"]): 47, - (121, G["comp"]): 46, + (9, G["atom"]): 43, + (9, G["arith"]): 38, + (9, G["expr"]): 110, + (9, G["term"]): 52, + (9, G["comp"]): 37, + (9, G["function-call"]): 35, + (9, G["factor"]): 55, + (10, G["factor"]): 55, + (10, G["term"]): 52, + (10, G["arith"]): 38, + (10, G["function-call"]): 35, + (10, G["atom"]): 43, + (10, G["block"]): 105, + (10, G["comp"]): 37, + (10, G["expr"]): 107, + (11, G["atom"]): 43, + (11, G["arith"]): 38, + (11, G["term"]): 52, + (11, G["comp"]): 37, + (11, G["expr"]): 103, + (11, G["function-call"]): 35, + (11, G["factor"]): 55, + (12, G["term"]): 52, + (12, G["atom"]): 43, + (12, G["arith"]): 38, + (12, G["expr"]): 97, + (12, G["function-call"]): 35, + (12, G["factor"]): 55, + (12, G["comp"]): 37, + (13, G["atom"]): 43, + (13, G["term"]): 52, + (13, G["arith"]): 38, + (13, G["factor"]): 55, + (13, G["comp"]): 37, + (13, G["function-call"]): 35, + (13, G["expr"]): 93, + (14, G["declaration-list"]): 90, + (18, G["declaration-list"]): 19, + (20, G["comp"]): 37, + (20, G["arith"]): 38, + (20, G["term"]): 52, + (20, G["atom"]): 43, + (20, G["function-call"]): 35, + (20, G["expr"]): 87, + (20, G["factor"]): 55, + (21, G["comp"]): 37, + (21, G["expr"]): 76, + (21, G["term"]): 52, + (21, G["arith"]): 38, + (21, G["factor"]): 55, + (21, G["function-call"]): 35, + (21, G["atom"]): 43, + (24, G["atom"]): 43, + (24, G["factor"]): 75, + (24, G["function-call"]): 35, + (27, G["atom"]): 43, + (27, G["factor"]): 74, + (27, G["function-call"]): 35, + (29, G["arith"]): 38, + (29, G["atom"]): 43, + (29, G["term"]): 52, + (29, G["expr"]): 49, + (29, G["factor"]): 55, + (29, G["expr-list"]): 72, + (29, G["comp"]): 37, + (29, G["function-call"]): 35, + (30, G["arith"]): 38, + (30, G["factor"]): 55, + (30, G["term"]): 52, + (30, G["comp"]): 37, + (30, G["function-call"]): 35, + (30, G["atom"]): 43, + (30, G["expr"]): 71, + (32, G["arith"]): 38, + (32, G["factor"]): 55, + (32, G["term"]): 52, + (32, G["comp"]): 37, + (32, G["function-call"]): 35, + (32, G["atom"]): 43, + (32, G["expr"]): 36, + (39, G["atom"]): 43, + (39, G["factor"]): 55, + (39, G["function-call"]): 35, + (39, G["term"]): 40, + (41, G["atom"]): 43, + (41, G["factor"]): 42, + (41, G["function-call"]): 35, + (46, G["arith"]): 38, + (46, G["atom"]): 43, + (46, G["term"]): 52, + (46, G["expr"]): 49, + (46, G["expr-list"]): 47, + (46, G["factor"]): 55, + (46, G["comp"]): 37, + (46, G["function-call"]): 35, + (50, G["arith"]): 38, + (50, G["atom"]): 43, + (50, G["term"]): 52, + (50, G["expr"]): 49, + (50, G["expr-list"]): 51, + (50, G["factor"]): 55, + (50, G["comp"]): 37, + (50, G["function-call"]): 35, + (53, G["atom"]): 43, + (53, G["factor"]): 54, + (53, G["function-call"]): 35, + (60, G["arith"]): 38, + (60, G["atom"]): 43, + (60, G["term"]): 52, + (60, G["expr"]): 49, + (60, G["factor"]): 55, + (60, G["expr-list"]): 61, + (60, G["comp"]): 37, + (60, G["function-call"]): 35, + (63, G["atom"]): 43, + (63, G["term"]): 64, + (63, G["factor"]): 55, + (63, G["function-call"]): 35, + (65, G["atom"]): 43, + (65, G["arith"]): 66, + (65, G["factor"]): 55, + (65, G["function-call"]): 35, + (65, G["term"]): 52, + (67, G["atom"]): 43, + (67, G["arith"]): 68, + (67, G["factor"]): 55, + (67, G["function-call"]): 35, + (67, G["term"]): 52, + (69, G["atom"]): 43, + (69, G["arith"]): 70, + (69, G["factor"]): 55, + (69, G["function-call"]): 35, + (69, G["term"]): 52, + (77, G["case-list"]): 85, + (81, G["factor"]): 55, + (81, G["expr"]): 82, + (81, G["term"]): 52, + (81, G["arith"]): 38, + (81, G["function-call"]): 35, + (81, G["atom"]): 43, + (81, G["comp"]): 37, + (83, G["case-list"]): 84, + (88, G["declaration-list"]): 89, + (91, G["arith"]): 38, + (91, G["expr"]): 92, + (91, G["factor"]): 55, + (91, G["term"]): 52, + (91, G["comp"]): 37, + (91, G["function-call"]): 35, + (91, G["atom"]): 43, + (94, G["arith"]): 38, + (94, G["expr"]): 95, + (94, G["atom"]): 43, + (94, G["term"]): 52, + (94, G["comp"]): 37, + (94, G["factor"]): 55, + (94, G["function-call"]): 35, + (98, G["term"]): 52, + (98, G["arith"]): 38, + (98, G["atom"]): 43, + (98, G["comp"]): 37, + (98, G["expr"]): 99, + (98, G["function-call"]): 35, + (98, G["factor"]): 55, + (100, G["atom"]): 43, + (100, G["arith"]): 38, + (100, G["term"]): 52, + (100, G["function-call"]): 35, + (100, G["expr"]): 101, + (100, G["comp"]): 37, + (100, G["factor"]): 55, + (108, G["factor"]): 55, + (108, G["term"]): 52, + (108, G["arith"]): 38, + (108, G["function-call"]): 35, + (108, G["atom"]): 43, + (108, G["block"]): 109, + (108, G["comp"]): 37, + (108, G["expr"]): 107, + (115, G["param-list"]): 116, + (121, G["atom"]): 43, + (121, G["arith"]): 38, + (121, G["term"]): 52, (121, G["expr"]): 122, - (121, G["function-call"]): 38, - (121, G["atom"]): 40, - (121, G["factor"]): 54, - (121, G["term"]): 59, - (126, G["term"]): 59, - (126, G["arith"]): 47, - (126, G["function-call"]): 38, - (126, G["comp"]): 46, - (126, G["atom"]): 40, - (126, G["factor"]): 54, + (121, G["comp"]): 37, + (121, G["function-call"]): 35, + (121, G["factor"]): 55, + (126, G["term"]): 52, + (126, G["arith"]): 38, + (126, G["function-call"]): 35, + (126, G["atom"]): 43, + (126, G["comp"]): 37, + (126, G["factor"]): 55, (126, G["expr"]): 127, (131, G["attribute"]): 130, - (131, G["feature-list"]): 132, (131, G["method"]): 133, + (131, G["feature-list"]): 132, (134, G["attribute"]): 130, - (134, G["feature-list"]): 135, (134, G["method"]): 133, + (134, G["feature-list"]): 135, (136, G["attribute"]): 130, - (136, G["feature-list"]): 137, (136, G["method"]): 133, + (136, G["feature-list"]): 137, (138, G["attribute"]): 130, - (138, G["feature-list"]): 139, (138, G["method"]): 133, + (138, G["feature-list"]): 139, (142, G["attribute"]): 130, (142, G["method"]): 133, (142, G["feature-list"]): 143, - (147, G["class-def"]): 147, (147, G["class-list"]): 148, + (147, G["class-def"]): 147, } diff --git a/semantics/__init__.py b/semantics/__init__.py index 10d20b45c..283d392de 100644 --- a/semantics/__init__.py +++ b/semantics/__init__.py @@ -2,9 +2,8 @@ classes defined here follows the visitor pattern using the module visitor, with this we can get a more decoupled inspection. """ -from semantics.collector import TypeCollector from semantics.builder import TypeBuilder +from semantics.collector import TypeCollector +from semantics.formatter import Formatter from semantics.overridden import OverriddenMethodChecker, topological_ordering -from semantics.selftype import SelfTypeReplacement from semantics.type_checker import TypeChecker -from semantics.formatter import Formatter diff --git a/semantics/builder.py b/semantics/builder.py index 77c30ce98..5dc9a7883 100644 --- a/semantics/builder.py +++ b/semantics/builder.py @@ -49,21 +49,19 @@ def visit(self, node: ast.ClassDeclarationNode): @visitor.when(ast.AttrDeclarationNode) def visit(self, node: ast.AttrDeclarationNode): try: - name = node.id - typex = self.context.get_type(node.type) - self.current_type.define_attribute(name, typex) + self.current_type.define_attribute(node.id, self.context.get_type(node.type)) except SemanticError as e: self.errors.append(e.text) + self.current_type.define_attribute(node.id, ErrorType()) @visitor.when(ast.MethodDeclarationNode) def visit(self, node: ast.MethodDeclarationNode): - name = node.id param_names = ['self'] param_types = [self.current_type] for name, typex in node.params: param_names.append(name) try: - param_types.append(self.context.get_type(name)) + param_types.append(self.context.get_type(typex)) except SemanticError as e: param_types.append(ErrorType()) self.errors.append(e.text) @@ -74,4 +72,4 @@ def visit(self, node: ast.MethodDeclarationNode): return_type = ErrorType() self.errors.append(e.text) - self.current_type.define_method(name, param_names, param_types, return_type) + self.current_type.define_method(node.id, param_names, param_types, return_type) diff --git a/semantics/collector.py b/semantics/collector.py index 4a8d3bafa..460b41a68 100644 --- a/semantics/collector.py +++ b/semantics/collector.py @@ -36,18 +36,18 @@ def visit(self, node): int_type.set_parent(object_type) bool_type.set_parent(object_type) - object_type.define_method('abort', ['self'], [self_type], object_type) - object_type.define_method('get_type', ['self'], [self_type], string_type) - object_type.define_method('copy', ['self'], [self_type], self_type) - - io_type.define_method('out_string', ['self', 'x'], [self_type, string_type], self_type) - io_type.define_method('out_int', ['self', 'x'], [self_type, string_type], self_type) - io_type.define_method('in_string', ['self'], [self_type], string_type) - io_type.define_method('in_int', ['self'], [self_type], int_type) - - string_type.define_method('length', ['self'], [self_type], int_type) - string_type.define_method('concat', ['self', 's'], [self_type, string_type], string_type) - string_type.define_method('substr', ['self', 'i', 'l'], [self_type, int_type, int_type], string_type) + object_type.define_method('abort', ['self'], [object_type], object_type) + object_type.define_method('get_type', ['self'], [object_type], string_type) + object_type.define_method('copy', ['self'], [object_type], self_type) + + io_type.define_method('out_string', ['self', 'x'], [io_type, string_type], self_type) + io_type.define_method('out_int', ['self', 'x'], [io_type, string_type], self_type) + io_type.define_method('in_string', ['self'], [io_type], string_type) + io_type.define_method('in_int', ['self'], [io_type], int_type) + + string_type.define_method('length', ['self'], [string_type], int_type) + string_type.define_method('concat', ['self', 's'], [string_type, string_type], string_type) + string_type.define_method('substr', ['self', 'i', 'l'], [string_type, int_type, int_type], string_type) for declaration in node.declarations: self.visit(declaration) diff --git a/semantics/overridden.py b/semantics/overridden.py index d9db87b83..a6e062539 100644 --- a/semantics/overridden.py +++ b/semantics/overridden.py @@ -1,8 +1,9 @@ from typing import List, Dict, Optional import semantics.astnodes as ast +import semantics.semantic_errors as err import semantics.visitor as visitor -from semantics.scope import Context, Type +from semantics.scope import Context, Type, SemanticError def topological_ordering(program_node: ast.ProgramNode, @@ -80,22 +81,28 @@ def visit(self, node: ast.ClassDeclarationNode): if isinstance(feature, ast.MethodDeclarationNode): self.visit(feature) + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode): + try: + attribute, owner = self.current_type.parent.get_attribute(node.id) + self.errors.append(err.ATTRIBUTE_OVERRIDE_ERROR % (attribute.name, owner.name)) + except SemanticError: + pass + @visitor.when(ast.MethodDeclarationNode) def visit(self, node: ast.MethodDeclarationNode): - # At this point all class has defined a parent and they are visited in topological order - - method, owner = self.current_type.get_method(node.id, get_owner=True) - - if owner == self.current_type: - return + try: + method, owner = self.current_type.parent.get_method(node.id, get_owner=True) - if len(method.param_types) != len(node.params) + 1: - self.errors.append(WRONG_SIGNATURE % (method.name, owner.name)) + if len(method.param_types) != len(node.params) + 1: + self.errors.append(err.METHOD_OVERRIDE_ERROR % (method.name, owner.name)) - for parent_param_type, (_, current_param_type_name) in zip(method.param_types[1:], node.params): - if parent_param_type != self.context.get_type(current_param_type_name): - self.errors.append(WRONG_SIGNATURE % (method.name, owner.name)) - break + for parent_param_type, (_, current_param_type_name) in zip(method.param_types[1:], node.params): + if parent_param_type != self.context.get_type(current_param_type_name): + self.errors.append(err.METHOD_OVERRIDE_ERROR % (method.name, owner.name)) + break - if method.return_type != self.context.get_type(node.return_type): - self.errors.append(WRONG_SIGNATURE % (method.name, owner.name)) + if method.return_type != self.context.get_type(node.return_type): + self.errors.append(err.METHOD_OVERRIDE_ERROR % (method.name, owner.name)) + except SemanticError: + pass diff --git a/semantics/scope.py b/semantics/scope.py index 55d8aaab2..07aaa4cb5 100755 --- a/semantics/scope.py +++ b/semantics/scope.py @@ -28,7 +28,7 @@ def __init__(self, name, param_names, params_types, return_type): self.return_type: 'Type' = return_type def __str__(self): - params = ', '.join(f'{n}:{t.name}' for n, t in zip(self.param_names, self.param_types)) + 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): @@ -51,14 +51,27 @@ def set_parent(self, parent: 'Type') -> None: raise SemanticError(f'Parent type is already set for {self.name}.') self.parent = parent - def get_attribute(self, name: str) -> Attribute: + def get_attribute(self, name: str, get_owner: bool = False) -> Union[Attribute, Tuple[Attribute, 'Type']]: + """ + Search the innermost declaration of the attribute with the given name and return it, if "get_owner" has + value "True" the returned object is a tuple (attribute, type) where type is the innermost `Type` in th Type + Hierarchy where the attribute is defined. If the method does not exist in the hierarchy then a SemanticError is + raised. + + :param name: str, name of the attribute + + :param get_owner: bool, if has value "True" then a tuple (attribute, type) is returned else only the method is + returned + + :return: the desired attribute and it's optional type owner. + """ try: - return self.attributes_dict[name] + return self.attributes_dict[name] if not get_owner else (self.attributes_dict[name], self) except KeyError: if self.parent is None: raise SemanticError(f'Attribute "{name}" is not defined in {self.name}.') try: - return self.parent.get_attribute(name) + return self.parent.get_attribute(name, get_owner) except SemanticError: raise SemanticError(f'Attribute "{name}" is not defined in {self.name}.') @@ -78,7 +91,7 @@ def contains_attribute(self, name: str) -> bool: def get_method(self, name: str, get_owner: bool = False) -> Union[Method, Tuple[Method, 'Type']]: """ - Search the innermost declaration of the method with the given name and return the method, if "get_owner" has + Search the innermost declaration of the method with the given name and return it, if "get_owner" has value "True" the returned object is a tuple (method, type) where type is the innermost `Type` in th Type Hierarchy where the methods is defined. If the method does not exist in the hierarchy then a SemanticError is raised @@ -134,9 +147,9 @@ def join(self, other: 'Type') -> 'Type': current_type = other while current_type is not None: if current_type in self_ancestors: - return current_type + break current_type = current_type.parent - return None + return current_type @staticmethod def multi_join(types: List['Type']): @@ -158,10 +171,10 @@ def __str__(self): parent = '' if self.parent is None else f' : {self.parent.name}' output += parent output += ' {' - output += '\n\t' if self.attributes_dict or self.methods_dict else '' - output += '\n\t'.join(str(x) for x in self.attributes_dict) + output += '\n\t' if self.attributes_list or self.methods_list else '' + output += '\n\t'.join(str(x) for x in self.attributes_list) output += '\n\t' if self.attributes_dict else '' - output += '\n\t'.join(str(x) for x in self.methods_dict) + output += '\n\t'.join(str(x) for x in self.methods_list) output += '\n' if self.methods_dict else '' output += '}\n' return output @@ -184,62 +197,6 @@ def __eq__(self, other): return isinstance(other, Type) -class IntType(Type): - def __init__(self): - super().__init__('Int') - - def __eq__(self, other): - return other.name == self.name or isinstance(other, IntType) - - -class StringType(Type): - def __init__(self): - super().__init__('String') - - def __eq__(self, other): - return other.name == self.name or isinstance(other, StringType) - - -class ObjectType(Type): - def __init__(self): - super().__init__('Object') - - def __eq__(self, other): - return other.name == self.name or isinstance(other, ObjectType) - - -class IOType(Type): - def __init__(self): - super().__init__('IO') - - def __eq__(self, other): - return other.name == self.name or isinstance(other, IOType) - - -class BoolType(Type): - def __init__(self): - super().__init__('Bool') - - def __eq__(self, other): - return other.name == self.name or isinstance(other, BoolType) - - -class SelfType(Type): - def __init__(self): - super().__init__('SELF_TYPE') - - def __eq__(self, other): - return other.name == self.name or isinstance(other, SelfType) - - -class AutoType(Type): - def __init__(self): - super(AutoType, self).__init__('AUTO_TYPE') - - def __eq__(self, other): - return other.name == self.name or isinstance(other, AutoType) - - class Context: def __init__(self): self.types: Dict[str, Type] = {} diff --git a/semantics/selftype.py b/semantics/selftype.py deleted file mode 100644 index 1a585cb61..000000000 --- a/semantics/selftype.py +++ /dev/null @@ -1,144 +0,0 @@ -from typing import List, Optional - -import semantics.astnodes as ast -import semantics.visitor as visitor -from semantics.scope import Context, Type, Method, ErrorType - - -class SelfTypeReplacement: - """Check that `SELF_TYPE` is used correctly and replace every match with the correspondent class type. - - The principal method visit return a new AST with all the SELF_TYPE replaced by it's correspondent class name, - all the definitions of SELF_TYPE in the Type definition where be overridden. - Params - ------ - - errors: List[str] is a list of errors detected in the ast travel - - context: Context the context for keeping the classes - - current_type: Optional[Type] is the current type in the building process""" - - def __init__(self, context: Context, errors: List[str]): - self.context: Context = context - self.errors: List[str] = errors - self.current_type: Optional[Type] = None - self.current_method: Optional[Method] = None - - @visitor.on('node') - def visit(self, node): - pass - - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode): - return ast.ProgramNode([self.visit(declaration) for declaration in node.declarations]) - - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode): - self.current_type = self.context.get_type(node.id) - - if node.parent is not None and node.parent == 'SELF_TYPE': - self.errors.append(f'Invalid use of "SELF_TYPE" as parent of class "{node.id}"') - - features = [self.visit(feature) for feature in node.features] - - return ast.ClassDeclarationNode(node.id, features, node.parent) - - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode): - typex = node.type - if typex == 'SELF_TYPE': - typex = self.current_type.name - self.current_type.get_attribute(node.id).type = self.current_type - - expr = self.visit(node.expr) if node.expr is not None else None - - return ast.AttrDeclarationNode(node.id, typex, expr) - - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode): - self.current_method = self.current_type.get_method(node.id) - - self.current_method.param_types[0] = self.current_type - - for i, (_, param_type) in enumerate(node.params, 1): - if param_type == 'SELF_TYPE': - self.errors.append('The static type of a param cannot be "SELF_TYPE"') - self.current_method.param_types[i] = ErrorType() # Change the static type to "ErrorType" - - if node.return_type == 'SELF_TYPE': - self.current_method.return_type = self.current_type - - expr = self.visit(node.body) - - return ast.MethodDeclarationNode(node.id, node.params, self.current_method.return_type.name, expr) - - @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode): - return ast.LetNode([self.visit(declaration) for declaration in node.declarations], self.visit(node.expr)) - - @visitor.when(ast.VarDeclarationNode) - def visit(self, node: ast.VarDeclarationNode): - typex = self.current_type.name if node.type == 'SELF_TYPE' else node.type - expr = self.visit(node.expr) if node.expr is not None else None - return ast.VarDeclarationNode(node.id, typex, expr) - - @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode): - return ast.AssignNode(node.id, self.visit(node.expr)) - - @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode): - return ast.BlockNode([self.visit(expr) for expr in node.expressions]) - - @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode): - return ast.ConditionalNode(self.visit(node.if_expr), self.visit(node.then_expr), self.visit(node.else_expr)) - - @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode): - return ast.WhileNode(self.visit(node.condition), self.visit(node.body)) - - @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode): - expr = self.visit(node.expr) - cases = [self.visit(case) for case in node.cases] - return ast.SwitchCaseNode(expr, cases) - - @visitor.when(ast.CaseNode) - def visit(self, node: ast.CaseNode): - if node.type == 'SELF_TYPE': - self.errors.append('SELF_TYPE cannot be used as branch type in a case expression') - return ast.CaseNode(node.id, node.type, self.visit(node.expr)) - - @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode): - obj = self.visit(node.obj) if node.obj is not None else ast.VariableNode('self') - args = [self.visit(arg) for arg in node.args] - return ast.MethodCallNode(node.id, args, obj, node.type) - - @visitor.when(ast.IntegerNode) - def visit(self, node: ast.IntegerNode): - return node - - @visitor.when(ast.StringNode) - def visit(self, node: ast.StringNode): - return node - - @visitor.when(ast.BooleanNode) - def visit(self, node: ast.BooleanNode): - return node - - @visitor.when(ast.VariableNode) - def visit(self, node: ast.VariableNode): - return node - - @visitor.when(ast.InstantiateNode) - def visit(self, node: ast.InstantiateNode): - node.lex = node.lex if node.lex != 'SELF_TYPE' else self.current_type.name - return node - - @visitor.when(ast.UnaryNode) - def visit(self, node: ast.UnaryNode): - return type(node)(self.visit(node.expr)) - - @visitor.when(ast.BinaryNode) - def visit(self, node: ast.BinaryNode): - return type(node)(self.visit(node.left), self.visit(node.right)) diff --git a/semantics/semantic_errors.py b/semantics/semantic_errors.py index b6af16f06..48909873c 100644 --- a/semantics/semantic_errors.py +++ b/semantics/semantic_errors.py @@ -1,12 +1,20 @@ -WRONG_SIGNATURE = 'Method "%s" already defined in "%s" with a different signature.' +ATTRIBUTE_OVERRIDE_ERROR = 'OverrideError: Attribute "%s" already defined in "%s", attributes cannot be overridden' +METHOD_OVERRIDE_ERROR = 'OverrideError: Method "%s" already defined in "%s" with a different signature.' + +INCOMPATIBLE_TYPES = 'TypeError: Cannot convert "%s" into "%s".' +INVALID_PARAM_TYPE = 'TypeError: "%s" cannot be a static type of a parameter' +INVALID_CASE_TYPE = 'TypeError: "%s" cannot be a static type of a case branch' +INVALID_PARENT_TYPE = 'TypeError: Class "%s" cannot inherits from "%s"' + SELF_IS_READONLY = 'Variable "self" is read-only.' SELF_INVALID_ATTRIBUTE_ID = 'Cannot set "self" as attribute of a class.' SELF_INVALID_PARAM_ID = 'Cannot set "self" as parameter of a method.' INVALID_INHERIT_CLASS = 'Can not inherits from "Int", "String", "Bool".' OVERRIDE_ATTRIBUTE_ID = 'Attributes cannot be override in derived class' LOCAL_ALREADY_DEFINED = 'Variable "%s" is already defined in method "%s".' -INCOMPATIBLE_TYPES = 'Cannot convert "%s" into "%s".' VARIABLE_NOT_DEFINED = 'Variable "%s" is not defined in "%s".' INVALID_BINARY_OPERATION = 'Operation "%s" is not defined between "%s" and "%s".' INVALID_UNARY_OPERATION = 'Operation "%s" is not defined for "%s".' INVALID_ANCESTOR = 'Class "%s" has no an ancestor class "%s".' + + diff --git a/semantics/type_checker.py b/semantics/type_checker.py index bd8c4e691..18aa24b84 100644 --- a/semantics/type_checker.py +++ b/semantics/type_checker.py @@ -31,6 +31,9 @@ def visit(self, node: ast.ProgramNode, scope: Scope = None): def visit(self, node: ast.ClassDeclarationNode, scope: Scope): self.current_type = self.context.get_type(node.id) + if node.parent is not None and node.parent == 'SELF_TYPE': + self.errors.append(err.INVALID_PARENT_TYPE % (node.id, node.parent)) + attrs = [feature for feature in node.features if isinstance(feature, ast.AttrDeclarationNode)] methods = [feature for feature in node.features if isinstance(feature, ast.MethodDeclarationNode)] @@ -45,7 +48,7 @@ def visit(self, node: ast.AttrDeclarationNode, scope: Scope): if node.id == 'self': self.errors.append(err.SELF_INVALID_ATTRIBUTE_ID) - attr_type = self.context.get_type(node.type) + attr_type = self.context.get_type(node.type) if node.type != 'SELF_TYPE' else self.current_type if node.expr is not None: expr_type = self.visit(node.expr, scope.create_child()) @@ -58,20 +61,25 @@ def visit(self, node: ast.AttrDeclarationNode, scope: Scope): def visit(self, node: ast.MethodDeclarationNode, scope: Scope): self.current_method = self.current_type.get_method(node.id) - # Defining parameters in the scope. Parameters can hide the attribute declaration, that's why we are not - # checking if there is defined, instead we are checking for local declaration - for i, (name, expr_body_type) in enumerate(node.params): - if not scope.is_local(name): - scope.define_variable(name, self.context.get_type(expr_body_type)) + # Parameters can hide the attribute declaration, that's why we are not checking if there is defined, + # instead we are checking for local declaration. Also it is checked that the static type of a parameter is + # different of SELF_TYPE. + for (param_name, param_type) in zip(self.current_method.param_names, self.current_method.param_types): + if not scope.is_local(param_name): + if param_type.name == 'SELF_TYPE': + self.errors.append(err.INVALID_PARAM_TYPE % 'SELF_TYPE') + scope.define_variable(param_name, ErrorType()) + else: + scope.define_variable(param_name, self.context.get_type(param_type.name)) else: - self.errors.append(err.LOCAL_ALREADY_DEFINED % (name, self.current_method.name)) + self.errors.append(err.LOCAL_ALREADY_DEFINED % (param_name, self.current_method.name)) - return_type = self.context.get_type(node.return_type) + return_type = self.context.get_type(node.return_type) if node.return_type != 'SELF_TYPE' else self.current_type - expr_body_type = self.visit(node.body, scope) + expr_type = self.visit(node.body, scope) - if not expr_body_type.conforms_to(return_type): - self.errors.append(err.INCOMPATIBLE_TYPES % (expr_body_type.name, return_type.name)) + if not expr_type.conforms_to(return_type): + self.errors.append(err.INCOMPATIBLE_TYPES % (expr_type.name, return_type.name)) @visitor.when(ast.LetNode) def visit(self, node: ast.LetNode, scope: Scope): @@ -82,7 +90,7 @@ def visit(self, node: ast.LetNode, scope: Scope): @visitor.when(ast.VarDeclarationNode) def visit(self, node: ast.VarDeclarationNode, scope: Scope): try: - var_static_type = self.context.get_type(node.type) + var_static_type = self.context.get_type(node.type) if node.type != 'SELF_TYPE' else self.current_type except SemanticError as e: var_static_type = ErrorType() self.errors.append(e.text) @@ -92,10 +100,9 @@ def visit(self, node: ast.VarDeclarationNode, scope: Scope): else: scope.define_variable(node.id, var_static_type) - if node.expr is not None: - expr_type = self.visit(node.expr, scope) - if not (expr_type.conforms_to(var_static_type)): - self.errors.append(err.INCOMPATIBLE_TYPES % (expr_type.name, var_static_type.name)) + expr_type = self.visit(node.expr, scope.create_child()) if node.expr is not None else None + if expr_type is not None and not expr_type.conforms_to(var_static_type): + self.errors.append(err.INCOMPATIBLE_TYPES % (expr_type.name, var_static_type.name)) return var_static_type @@ -144,7 +151,10 @@ def visit(self, node: ast.SwitchCaseNode, scope: Scope): @visitor.when(ast.CaseNode) def visit(self, node: ast.CaseNode, scope: Scope): try: - scope.define_variable(node.id, self.context.get_type(node.type)) + if node.type != 'SELF_TYPE': + scope.define_variable(node.id, self.context.get_type(node.type)) + else: + self.errors.append(err.INVALID_CASE_TYPE % node.type) except SemanticError as e: scope.define_variable(node.id, ErrorType()) self.errors.append(e.text) @@ -153,6 +163,8 @@ def visit(self, node: ast.CaseNode, scope: Scope): @visitor.when(ast.MethodCallNode) def visit(self, node: ast.MethodCallNode, scope: Scope): + if node.obj is None: + node.obj = ast.VariableNode('self') obj_type = self.visit(node.obj, scope) if node.type is not None: @@ -176,7 +188,7 @@ def visit(self, node: ast.MethodCallNode, scope: Scope): return ErrorType() if len(node.args) + 1 != len(method.param_names): - self.errors.append(err.WRONG_SIGNATURE % (method.name, obj_type.name)) + self.errors.append(err.METHOD_OVERRIDE_ERROR % (method.name, obj_type.name)) if not obj_type.conforms_to(method.param_types[0]): self.errors.append(err.INCOMPATIBLE_TYPES % (obj_type.name, method.param_types[0].name)) @@ -186,7 +198,7 @@ def visit(self, node: ast.MethodCallNode, scope: Scope): if not arg_type.conforms_to(method.param_types[i]): self.errors.append(err.INCOMPATIBLE_TYPES % (arg_type.name, method.param_types[i].name)) - return method.return_type + return method.return_type if method.return_type.name != 'SELF_TYPE' else ancestor_type @visitor.when(ast.IntegerNode) def visit(self, node: ast.IntegerNode, scope: Scope): @@ -211,7 +223,7 @@ def visit(self, node: ast.VariableNode, scope: Scope): @visitor.when(ast.InstantiateNode) def visit(self, node: ast.InstantiateNode, scope: Scope): try: - return self.context.get_type(node.lex) + return self.context.get_type(node.lex) if node.lex != 'SELF_TYPE' else self.current_type except SemanticError as e: self.errors.append(e.text) return ErrorType() From 4128c9842245fd53317498653138d9c1d7b463ce Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Sat, 9 May 2020 02:53:47 -0400 Subject: [PATCH 037/143] improving inference type algorithms --- grammar.py | 2 +- main.py | 65 ++- semantics/__init__.py | 4 +- semantics/astnodes.py | 10 - semantics/errors.py | 22 + semantics/overridden.py | 19 +- semantics/scope.py | 29 +- semantics/semantic_errors.py | 20 - semantics/temp/Informe.md | 182 +++++++ semantics/temp/type_inference.py | 455 ++++++++++++++++++ semantics/{builder.py => type_builder.py} | 7 +- semantics/type_checker.py | 9 +- semantics/{collector.py => type_collector.py} | 0 semantics/type_inference.py | 162 ++++++- 14 files changed, 899 insertions(+), 87 deletions(-) create mode 100644 semantics/errors.py delete mode 100644 semantics/semantic_errors.py create mode 100644 semantics/temp/Informe.md create mode 100644 semantics/temp/type_inference.py rename semantics/{builder.py => type_builder.py} (94%) rename semantics/{collector.py => type_collector.py} (100%) diff --git a/grammar.py b/grammar.py index edc57a268..53ced754a 100755 --- a/grammar.py +++ b/grammar.py @@ -83,7 +83,7 @@ def comment(lexer): @G.terminal('comment_error', r'\(\*(.|\n)*$') -def comment(lexer): +def comment_error(lexer): lexer.contain_errors = True lex = lexer.token.lex for s in lex: diff --git a/main.py b/main.py index b7c4fe1be..c376eabab 100755 --- a/main.py +++ b/main.py @@ -9,7 +9,7 @@ class Main inherits IO { out_string("Hello, World.\n") }; - fibonacci(n: Int): Int { + fibonacci(n: AUTO_TYPE): Int { if n <= 2 then 0 else fibonacci(n - 1) + fibonacci(n - 2) fi }; } @@ -19,23 +19,46 @@ class Main inherits IO { parser = CoolParser() if __name__ == '__main__': - tokens = lexer(program) - ast = parser(tokens) - - # for t in tokens: - # print(t) - - context = Context() - errors = [] - scope = Scope() - - TypeCollector(context, errors).visit(ast) - TypeBuilder(context, errors).visit(ast) - topological_ordering(ast, context, errors) - OverriddenMethodChecker(context, errors).visit(ast) - TypeChecker(context, errors).visit(ast, scope) - # Executor(context, errors).visit(ast, scope) - - for error in errors: - print(error) - print("Done!") + # tokens = lexer(program) + # ast = parser(tokens) + # + # context = Context() + # errors = [] + # scope = Scope() + # + # TypeCollector(context, errors).visit(ast) + # TypeBuilder(context, errors).visit(ast) + # topological_ordering(ast, context, errors) + # OverriddenMethodChecker(context, errors).visit(ast) + # TypeChecker(context, errors).visit(ast, scope) + # # Executor(context, errors).visit(ast, scope) + # + # for error in errors: + # print(error) + # print("Done!") + + class MyClass: + def __init__(self, name): + self.name = name + + def __hash__(self): + return id(self) + + def __str__(self): + return self.name + + def __repr__(self): + return self.name + + a = MyClass('Item0') + b = MyClass('Item1') + c = MyClass('Item2') + d = MyClass('Item3') + e = MyClass('Item4') + + objects = {(0, a), (1, b), (2, c), (3, d), (4, e)} + + print((4, e) in objects) + e.name = 'NewItem' + print((4, e) in objects) + print(objects) diff --git a/semantics/__init__.py b/semantics/__init__.py index 283d392de..118bfeaf7 100644 --- a/semantics/__init__.py +++ b/semantics/__init__.py @@ -2,8 +2,8 @@ classes defined here follows the visitor pattern using the module visitor, with this we can get a more decoupled inspection. """ -from semantics.builder import TypeBuilder -from semantics.collector import TypeCollector +from semantics.type_builder import TypeBuilder +from semantics.type_collector import TypeCollector from semantics.formatter import Formatter from semantics.overridden import OverriddenMethodChecker, topological_ordering from semantics.type_checker import TypeChecker diff --git a/semantics/astnodes.py b/semantics/astnodes.py index af2de1320..d0e58853c 100755 --- a/semantics/astnodes.py +++ b/semantics/astnodes.py @@ -79,12 +79,6 @@ def __init__(self, idx, expr): self.expr: ExprNode = expr -class SetAttributeNode(ExprNode): - def __init__(self, idx, expr): - self.id: str = idx - self.expr: ExprNode = expr - - class ConditionalNode(ExprNode): def __init__(self, ifx, then, elsex): self.if_expr: ExprNode = ifx @@ -122,10 +116,6 @@ def __init__(self, left, right): self.right: ExprNode = right -class GetAttributeNode(AtomicNode): - pass - - class VariableNode(AtomicNode): pass diff --git a/semantics/errors.py b/semantics/errors.py new file mode 100644 index 000000000..8f00a0e65 --- /dev/null +++ b/semantics/errors.py @@ -0,0 +1,22 @@ +ATTRIBUTE_OVERRIDE_ERROR = 'OverrideError: Attribute "%s" already defined in "%s", attributes cannot be overridden' +METHOD_OVERRIDE_ERROR = 'OverrideError: Method "%s" already defined in "%s" with a different signature.' + +INCOMPATIBLE_TYPES = 'TypeError: Cannot convert "%s" into "%s".' +INVALID_PARAM_TYPE = 'TypeError: "%s" cannot be a static type of a parameter.' +INVALID_CASE_TYPE = 'TypeError: "%s" cannot be a static type of a case branch.' +INVALID_PARENT_TYPE = 'TypeError: Class "%s" cannot inherits from "%s"' +INVALID_ANCESTOR = 'TypeError: Class "%s" has no an ancestor class "%s".' + +INVALID_BINARY_OPERATION = 'OperationError: Operation "%s" is not defined between "%s" and "%s".' +INVALID_UNARY_OPERATION = 'OperationError: Operation "%s" is not defined for "%s".' + +SELF_IS_READONLY = 'IdentifierError: Variable "self" is read-only.' +SELF_INVALID_ATTRIBUTE_ID = 'IdentifierError: Cannot set "self" as attribute of a class.' +SELF_INVALID_PARAM_ID = 'IdentifierError: Cannot set "self" as parameter of a method.' +LOCAL_ALREADY_DEFINED = 'IdentifierError: Variable "%s" is already defined in method "%s".' +VARIABLE_NOT_DEFINED = 'IdentifierError: Variable "%s" is not defined in "%s".' + +INFERENCE_ERROR_ATTRIBUTE = 'InferenceError: Cannot infer type for attribute "%s".' +INFERENCE_ERROR_PARAMETER = 'InferenceError: Cannot infer type for parameter "%s".' +INFERENCE_ERROR_VARIABLE = 'InferenceError: Cannot infer type for variable "%s".' +INFERENCE_ERROR_METHOD = 'InferenceError: Cannot infer return type for method "%s".' diff --git a/semantics/overridden.py b/semantics/overridden.py index a6e062539..48f58cf6d 100644 --- a/semantics/overridden.py +++ b/semantics/overridden.py @@ -1,7 +1,7 @@ from typing import List, Dict, Optional import semantics.astnodes as ast -import semantics.semantic_errors as err +import semantics.errors as err import semantics.visitor as visitor from semantics.scope import Context, Type, SemanticError @@ -37,7 +37,7 @@ def topological_ordering(program_node: ast.ProgramNode, current_name = stack.pop() if visited[current_name]: - errors.append(f'Cyclic class hierarchy in class {current_name}.') + errors.append(f'DependencyError: Circular class dependency involving class {current_name}.') visited[current_name] = True stack += graph[current_name] @@ -91,18 +91,11 @@ def visit(self, node: ast.AttrDeclarationNode): @visitor.when(ast.MethodDeclarationNode) def visit(self, node: ast.MethodDeclarationNode): + # TODO: Change the comparison overriding + current_method = self.current_type.get_method(node.id) try: method, owner = self.current_type.parent.get_method(node.id, get_owner=True) - - if len(method.param_types) != len(node.params) + 1: - self.errors.append(err.METHOD_OVERRIDE_ERROR % (method.name, owner.name)) - - for parent_param_type, (_, current_param_type_name) in zip(method.param_types[1:], node.params): - if parent_param_type != self.context.get_type(current_param_type_name): - self.errors.append(err.METHOD_OVERRIDE_ERROR % (method.name, owner.name)) - break - - if method.return_type != self.context.get_type(node.return_type): - self.errors.append(err.METHOD_OVERRIDE_ERROR % (method.name, owner.name)) + if method != current_method: + self.errors.append(err.METHOD_OVERRIDE_ERROR % (node.id, owner.name)) except SemanticError: pass diff --git a/semantics/scope.py b/semantics/scope.py index 07aaa4cb5..2b0a9d677 100755 --- a/semantics/scope.py +++ b/semantics/scope.py @@ -1,5 +1,4 @@ -from collections import OrderedDict -from typing import List, Optional, Dict, Any, Tuple, Union +from typing import List, Optional, Dict, Tuple, Union class SemanticError(Exception): @@ -32,20 +31,31 @@ def __str__(self): 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 + return (other.name == self.name and + other.return_type == self.return_type and + tuple(other.param_types) == tuple(self.param_types)) + + # def __hash__(self): + # return hash((self.name, tuple(self.param_names), tuple(self.param_types), self.return_type)) class Type: def __init__(self, name: str): self.name: str = name self.attributes_list: List[Attribute] = [] - self.methods_list: List[Method] = [] self.attributes_dict: Dict[str, Attribute] = {} + self.methods_list: List[Method] = [] self.methods_dict: Dict[str, Method] = {} self.parent: Optional['Type'] = None + @property + def attributes(self): + return self.attributes_list + + @property + def methods(self): + return self.methods_list + def set_parent(self, parent: 'Type') -> None: if self.parent is not None: raise SemanticError(f'Parent type is already set for {self.name}.') @@ -152,7 +162,7 @@ def join(self, other: 'Type') -> 'Type': return current_type @staticmethod - def multi_join(types: List['Type']): + def multi_join(types: List['Type']) -> 'Type': static_type = types[0] for t in types[1:]: static_type = static_type.join(t) @@ -185,7 +195,7 @@ def __repr__(self): class ErrorType(Type): def __init__(self): - super().__init__('') + super().__init__('Error') def conforms_to(self, other): return True @@ -219,6 +229,9 @@ def __str__(self): def __repr__(self): return str(self) + def __iter__(self): + return iter(self.types.values()) + class VariableInfo: def __init__(self, name, vtype): diff --git a/semantics/semantic_errors.py b/semantics/semantic_errors.py deleted file mode 100644 index 48909873c..000000000 --- a/semantics/semantic_errors.py +++ /dev/null @@ -1,20 +0,0 @@ -ATTRIBUTE_OVERRIDE_ERROR = 'OverrideError: Attribute "%s" already defined in "%s", attributes cannot be overridden' -METHOD_OVERRIDE_ERROR = 'OverrideError: Method "%s" already defined in "%s" with a different signature.' - -INCOMPATIBLE_TYPES = 'TypeError: Cannot convert "%s" into "%s".' -INVALID_PARAM_TYPE = 'TypeError: "%s" cannot be a static type of a parameter' -INVALID_CASE_TYPE = 'TypeError: "%s" cannot be a static type of a case branch' -INVALID_PARENT_TYPE = 'TypeError: Class "%s" cannot inherits from "%s"' - -SELF_IS_READONLY = 'Variable "self" is read-only.' -SELF_INVALID_ATTRIBUTE_ID = 'Cannot set "self" as attribute of a class.' -SELF_INVALID_PARAM_ID = 'Cannot set "self" as parameter of a method.' -INVALID_INHERIT_CLASS = 'Can not inherits from "Int", "String", "Bool".' -OVERRIDE_ATTRIBUTE_ID = 'Attributes cannot be override in derived class' -LOCAL_ALREADY_DEFINED = 'Variable "%s" is already defined in method "%s".' -VARIABLE_NOT_DEFINED = 'Variable "%s" is not defined in "%s".' -INVALID_BINARY_OPERATION = 'Operation "%s" is not defined between "%s" and "%s".' -INVALID_UNARY_OPERATION = 'Operation "%s" is not defined for "%s".' -INVALID_ANCESTOR = 'Class "%s" has no an ancestor class "%s".' - - diff --git a/semantics/temp/Informe.md b/semantics/temp/Informe.md new file mode 100644 index 000000000..b18b8e5ff --- /dev/null +++ b/semantics/temp/Informe.md @@ -0,0 +1,182 @@ +# Cool Interpreter for compiling class Type Inference + +La inferencia de tipos de nuestro proyecto detecta para cada atributo variable +o retorno de funcion el primer tipo que le puede ser asignado, +cambiando en el arbol de sintaxis abstracta el string AUTO_TYPE por +el nombre del tipo correspondiente. + +## Casos factibles: + + +Funcionamdo de manera analoga, tanto para atributos, varibales, parametros +y retorno de funciones. Explicado de forma recursiva puede ser visto como: + +Un AUTO_TYPE sera sustituido por su tipo correspodiente si este forma +parte de una operacion que permita saber su tipo; o es asignado a +una expresion de la cual es posible determinar su tipo. + +Es importante senalar en que contexto estas dependencias son tomadas en cuenta: + + - Para los atributos marcados como autotype su tipo podra ser determinado dentro del cuerpo de cualquiera de las funciones de la clase o si es detectable el tipo de la expresion de inicializacion. + + - Para las variables su tipo sera determinado dentro del scope donde estas + son validas. + + . Para los parametros, su tipo sera determinado solo dentro del cuerpo de la funcion. + + . Para los retornos de funciones, su tipo sera determinado con su expresion y los llamados a dicha + funcion. + + Ejemplos de casos Factibles para la Inferencia: + - + + ```text +class Main inherits IO { + function(a: AUTO_TYPE, b: AUTO_TYPE, c: AUTO_TYPE, d: AUTO_TYPE): AUTO_TYPE { + { + a<-b; + b<-c; + c<-d; + d<-a; + d+1; + if a< 10 then a else b fi; + } + }; +} +``` + + ```text +class Main inherits IO { + function(a: AUTO_TYPE): AUTO_TYPE { + { + if a< 10 then f(a) else f(b) fi; + } + }; + + f(a :AUTO_TYPE): AUTO_TYPE{ + if a<3 then 1 else f(a-1) + f(a-2) fi + }; +} +``` + +```text +class Main inherits IO { + + b: AUTO_TYPE; + c: AUTO_TYPE <-"1"; + d: AUTO_TYPE; + function(a: AUTO_TYPE): AUTO_TYPE { + { + b<-a; + d+1; + if a< 10 then f(a) else f(b) fi; + } + }; + + f(a: AUTO_TYPE): AUTO_TYPE{ + if a<3 then 1 else f(a-1) + f(a-2) fi + }; +} +``` + Casos No factibles: + - + No es posible determinar el tipo de una variable, atributo, parametro, + o retorno de funcion si para este se cumple el Caso general y su caso + especifico correspondiente. + + Caso general: + - + + El tipo es utilizado en expresiones que no permiten determinar su tipo, + o solo se logra determinar que poseen el mismo tipo que otras variables, + atributos, parametros o retorno de funciones de las cuales tampoco se + puede determinar el mismo. + + ```text +class Main inherits IO { + + b: AUTO_TYPE; + c: AUTO_TYPE; + function(a: AUTO_TYPE, d: AUTO_TYPE): AUTO_TYPE { + { + b<-a; + d<-c; + f(a); + } + }; + + f(a: AUTO_TYPE): AUTO_TYPE{ + if a<3 then 1 else f(a-1) fi + }; +} +``` +En este ejemplo solo es posible inferir el typo del parametro 'a' de la +funcion f. + + Casos Particulares: + - + . Para variables: si estas no son utilizadas en el ambito en que son validas. + ```text +class Main inherits IO { + function(): int { + let a:AUTOTYPE, b:AUTO_TYPE in { + 1; + } + }; +} +``` + + . Para argumentos: si dentro del cuerpo de la funcion estas no son utilizadas. + ```text +class Main inherits IO { + function(a: Int): Int { + f(a) + }; + + f(a: AUTO_TYPE): Int{ + 1 + }; +} +``` + + . Para atributos: si no es posible determinar el tipo de la expresion de + inicializacion o si dentro del cuerpo de todas las funciones de su clase + correspondiente este no son utilizadas. + ```text +class Main inherits IO { + + b: AUTO_TYPE <- c; + c: AUTO_TYPE <- b; + + f(a: AUTO_TYPE): AUTO_TYPE{ + if a<3 then 1 else f(a-1) + f(a-2) fi + }; +} +``` + + . Para el retorno de funciones: si no es posible determinar el tipo de su expresion. + ```text +class Main inherits IO { + f(a: Int): AUTO_TYPE{ + if a<3 then a else f(a-3) fi + }; +} +``` + + Expresiones de las cuales es posible determinar su tipo: + - + + .Valores Constantes. + + .Operaciones aritmeticas. + + .Operaciones logicas. + + .Llamdos a funciones con valor de retorno conocido. + + .Instancias de clases. + + .Variables de las cuales se conoce su tipo. + + .Bloques donde se puede determinar el tipo de la ultima expresion. + \ No newline at end of file diff --git a/semantics/temp/type_inference.py b/semantics/temp/type_inference.py new file mode 100644 index 000000000..122f6a253 --- /dev/null +++ b/semantics/temp/type_inference.py @@ -0,0 +1,455 @@ +from typing import List + +import semantics.astnodes as ast +import semantics.errors as err +import semantics.visitor as visitor +from semantics.scope import Context, Attribute, Method, Type, ErrorType, VariableInfo, Scope, SemanticError + + +class InferenceTypeChecker: + def __init__(self, context: Context, errors: List[str] = []): + self.context: Context = context + self.errors: List[str] = errors + self.current_type: Type = None + self.current_method: Method = None + self.dependencies = {} + + @visitor.on('node') + def visit(self, node, tabs): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode, scope: Scope = None): + if scope is None: + scope = Scope() + for elem in node.declarations: + self.visit(elem, scope.create_child()) + return InferenceTypeSubstitute(self.context, self.errors).visit(node, scope) + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode, scope: Scope): + self.current_type = self.context.get_type(node.id) + + attrs = [feature for feature in node.features if isinstance(feature, ast.AttrDeclarationNode)] + methods = [feature for feature in node.features if isinstance(feature, ast.MethodDeclarationNode)] + + for attr in attrs: + self.visit(attr, scope) + + for i, method in enumerate(methods): + self.visit(method, scope.create_child()) + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode, scope: Scope): + attr_type = self.context.get_type(node.type) + var = scope.define_variable(node.id, attr_type) + if node.expr is not None: + expr_type = self.visit(node.expr, scope.create_child()) + if attr_type == self.context.get_type('AUTO_TYPE'): + if isinstance(expr_type, VariableInfo) or isinstance(expr_type, Method): + try: + self.dependencies[expr_type].append(var) + except KeyError: + self.dependencies[expr_type] = [var] + else: + self._update_dependencies(var, expr_type) + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode, scope: Scope): + self.current_method = self.current_type.get_method(node.id) + return_type = self.context.get_type(node.return_type) + + scope.define_variable('self', self.current_type) + for i, (name, expr_body_type) in enumerate(node.params): + if not scope.is_local(name): + scope.define_variable(name, self.context.get_type(expr_body_type)) + + expr_body_type = self.visit(node.body, scope) + if return_type == self.context.get_type('AUTO_TYPE'): + if isinstance(expr_body_type, VariableInfo) or isinstance(expr_body_type, Method): + try: + self.dependencies[expr_body_type].append(self.current_method) + except KeyError: + self.dependencies[expr_body_type] = [self.current_method] + else: + self._update_dependencies(self.current_method, expr_body_type) + + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode, scope: Scope): + for elem in node.declarations: + self.visit(elem, scope) + return self.visit(node.expr, scope.create_child()) + + @visitor.when(ast.VarDeclarationNode) + def visit(self, node: ast.VarDeclarationNode, scope: Scope): + var = scope.define_variable(node.id, self.context.get_type(node.type)) + + if node.expr is not None: + expr_type = self.visit(node.expr, scope) + if node.type == 'AUTO_TYPE': + if isinstance(expr_type, VariableInfo) or isinstance(expr_type, Method): + try: + self.dependencies[expr_type].append(var) + except KeyError: + self.dependencies[expr_type] = [var] + else: + var.type = expr_type + + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode, scope: Scope): + expr_type = self.visit(node.expr, scope) + var_info = scope.find_variable(node.id) + + if var_info is not None: + if var_info.type == self.context.get_type('AUTO_TYPE'): + if isinstance(expr_type, VariableInfo) or isinstance(expr_type, Method): + try: + self.dependencies[expr_type].append(var_info) + except KeyError: + self.dependencies[expr_type] = [var_info] + else: + self._update_dependencies(var_info, expr_type) + else: + if isinstance(expr_type, VariableInfo) or isinstance(expr_type, Method): + self._update_dependencies(expr_type, var_info.type) + + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode, scope: Scope): + return_type = ErrorType() + + for expr in node.expressions: + return_type = self.visit(expr, scope.create_child()) + + return return_type + + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode, scope: Scope): + if_type = self.visit(node.if_expr, scope) + then_type = self.visit(node.then_expr, scope) + else_type = self.visit(node.else_expr, scope) + + if isinstance(if_type, VariableInfo): + if_type.type = self.context.get_type('BOOL_TYPE') + + if isinstance(if_type, Method): + if_type.return_type = self.context.get_type('BOOL_TYPE') + + if isinstance(then_type, VariableInfo) or isinstance(then_type, Method): + return then_type + + if isinstance(else_type, VariableInfo) or isinstance(else_type, Method): + return else_type + + return then_type.join(else_type) + + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode, scope: Scope): + condition = self.visit(node.condition, scope) + if isinstance(condition, VariableInfo) or isinstance(condition, Method): + self._update_dependencies(condition, self.context.get_type('Bool')) + + self.visit(node.body, scope) + return self.context.get_type('Object') + + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode, scope: Scope): + # TODO: Esta mal la inferencia de tipo, no se esta aplicando el join de los tipos en lo branch del case + self.visit(node.expr, scope) + + for case in node.cases: + self.visit(case, scope.create_child()) + + return self.context.get_type('Object') + + @visitor.when(ast.CaseNode) + def visit(self, node: ast.CaseNode, scope: Scope): + try: + var = scope.define_variable(node.id, self.context.get_type(node.type)) + except SemanticError: + var = scope.find_variable('ERROR_TYPE') + + self.visit(node.expr, scope) + return var.type + + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode, scope: Scope): + obj_type = self.visit(node.obj, scope) + if isinstance(obj_type, VariableInfo) or isinstance(obj_type, Method): + obj_type = self.context.get_type('AUTO_TYPE') + + if node.type is not None: + try: + ancestor_type = self.context.get_type(node.type) + except SemanticError: + ancestor_type = ErrorType() + else: + ancestor_type = obj_type + + try: + method = ancestor_type.get_method(node.id) + except SemanticError: + for arg in node.args: + self.visit(arg, scope) + return ErrorType() + + for i, arg in enumerate(node.args, 1): + arg_type = self.visit(arg, scope) + if isinstance(arg_type, VariableInfo) or isinstance(arg_type, VariableInfo): + if method.param_types[i].name != 'AUTO_TYPE': + self._update_dependencies(arg_type, method.param_types[i]) + + if method.return_type != self.context.get_type('AUTO_TYPE'): + return method.return_type + return method + + @visitor.when(ast.IntegerNode) + def visit(self, node: ast.IntegerNode, scope: Scope): + return self.context.get_type('Int') + + @visitor.when(ast.StringNode) + def visit(self, node: ast.StringNode, scope: Scope): + return self.context.get_type('String') + + @visitor.when(ast.BooleanNode) + def visit(self, node: ast.BooleanNode, scope: Scope): + return self.context.get_type('Bool') + + @visitor.when(ast.VariableNode) + def visit(self, node: ast.VariableNode, scope: Scope): + try: + var = scope.find_variable(node.lex) + if var.type == self.context.get_type('AUTO_TYPE'): + return var + return var.type + except SemanticError: + return self.context.get_type('ERROR_TYPE') + + @visitor.when(ast.InstantiateNode) + def visit(self, node: ast.InstantiateNode, scope: Scope): + try: + return self.context.get_type(node.lex) + except SemanticError: + return self.context.get_type('Object') + + @visitor.when(ast.NegationNode) + def visit(self, node: ast.NegationNode, scope: Scope): + a = self.visit(node.expr, scope) + if isinstance(a, VariableInfo) or isinstance(a, Method): + self._update_dependencies(a, self.context.get_type('Bool')) + + @visitor.when(ast.ComplementNode) + def visit(self, node: ast.ComplementNode, scope: Scope): + a = self.visit(node.expr, scope) + if isinstance(a, VariableInfo) or isinstance(a, Method): + self._update_dependencies(a, self.context.get_type('Int')) + + @visitor.when(ast.IsVoidNode) + def visit(self, node: ast.IsVoidNode, scope: Scope): + a = self.visit(node.expr, scope) + return self.context.get_type('BOOL_TYPE') + + @visitor.when(ast.PlusNode) + def visit(self, node: ast.PlusNode, scope: Scope): + return self._visit_binary_operation(node, scope, self.context.get_type('Int')) + + @visitor.when(ast.MinusNode) + def visit(self, node: ast.MinusNode, scope: Scope): + return self._visit_binary_operation(node, scope, self.context.get_type('Int')) + + @visitor.when(ast.StarNode) + def visit(self, node: ast.StarNode, scope: Scope): + return self._visit_binary_operation(node, scope, self.context.get_type('Int')) + + @visitor.when(ast.DivNode) + def visit(self, node: ast.DivNode, scope: Scope): + return self._visit_binary_operation(node, scope, self.context.get_type('Int')) + + @visitor.when(ast.LessEqualNode) + def visit(self, node: ast.LessEqualNode, scope: Scope): + return self._visit_binary_operation(node, scope, self.context.get_type('Bool')) + + @visitor.when(ast.LessThanNode) + def visit(self, node: ast.LessThanNode, scope: Scope): + return self._visit_binary_operation(node, scope, self.context.get_type('Bool')) + + @visitor.when(ast.EqualNode) + def visit(self, node: ast.EqualNode, scope: Scope): + self.visit(node.left, scope) + self.visit(node.right, scope) + return self.context.get_type('Bool') + + def _visit_binary_operation(self, node: ast.BinaryNode, scope: Scope, return_type: Type): + left_type = self.visit(node.left, scope) + right_type = self.visit(node.right, scope) + if isinstance(left_type, VariableInfo) or isinstance(left_type, VariableInfo): + self._update_dependencies(left_type, self.context.get_type('Int')) + if isinstance(right_type, VariableInfo) or isinstance(right_type, VariableInfo): + self._update_dependencies(right_type, self.context.get_type('Int')) + return return_type + + def _update_dependencies(self, info, typex): + try: + stack = self.dependencies[info] + [info] + self.dependencies[info] = [] + except KeyError: + stack = [info] + + visited = set(stack) + while stack: + item = stack.pop() + if isinstance(item, VariableInfo): + item.type = typex if item.type.name == 'AUTO_TYPE' else item.type.join(typex) + else: + item.return_type = typex if item.return_type.name == 'AUTO_TYPE' else item.return_type.join(typex) + + try: + Q2 = self.dependencies[item] + self.dependencies[item] = [] + for item2 in Q2: + if item2 not in visited: + stack.append(item2) + visited.add(item2) + except KeyError: + continue + + +class InferenceTypeSubstitute: + def __init__(self, context: Context, errors: List[str] = []): + self.context: Context = context + self.errors: List[str] = errors + self.current_type: Type = None + self.current_method: Method = None + self.dependencies = {} + + @visitor.on('node') + def visit(self, node, tabs): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode, scope: Scope = None): + if scope is not None: + for elem in node.declarations: + self.visit(elem, scope.children[0]) + return scope + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode, scope: Scope): + self.current_type = self.context.get_type(node.id) + + attrs = [feature for feature in node.features if isinstance(feature, ast.AttrDeclarationNode)] + methods = [feature for feature in node.features if isinstance(feature, ast.MethodDeclarationNode)] + + for attr in attrs: + self.visit(attr, scope) + + for i, method in enumerate(methods): + self.visit(method, scope.children[i]) + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode, scope: Scope): + attr_type = self.context.get_type(node.type) + var_info = scope.find_variable(node.id) + + if node.expr is not None: + self.visit(node.expr, scope.create_child()) + + if attr_type == self.context.get_type('AUTO_TYPE'): + if var_info.type == self.context.get_type('AUTO_TYPE'): + self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % node.id) + node.type = var_info.type.name + self.current_type.get_attribute(node.id).type = var_info.type + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode, scope: Scope): + self.current_method = self.current_type.get_method(node.id) + return_type = self.context.get_type(node.return_type) + + for i, (name, expr_body_type) in enumerate(node.params): + var = scope.find_variable(name) + if var.type == self.context.get_type('AUTO_TYPE'): + self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % name) + node.params[i] = (name, var.type.name) + self.current_method.param_types[i + 1] = var.type + + self.visit(node.body, scope) + + if return_type == self.context.get_type('AUTO_TYPE'): + if self.current_method.return_type == self.context.get_type('AUTO_TYPE'): + self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % node.id) + node.return_type = self.current_method.return_type.name + + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode, scope: Scope): + scope_child = scope.children[0] + + for elem in node.declarations: + self.visit(elem, scope) + + self.visit(node.expr, scope_child) + + @visitor.when(ast.VarDeclarationNode) + def visit(self, node: ast.VarDeclarationNode, scope: Scope): + var = scope.find_variable(node.id) + + if node.expr is not None: + self.visit(node.expr, scope) + + if node.type == 'AUTO_TYPE': + if var.type == self.context.get_type('AUTO_TYPE'): + self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % node.id) + node.type = var.type.name + + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode, scope: Scope): + self.visit(node.expr, scope) + + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode, scope: Scope): + for i, expr in enumerate(node.expressions): + self.visit(expr, scope.children[i]) + + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode, scope: Scope): + self.visit(node.if_expr, scope) + self.visit(node.then_expr, scope) + self.visit(node.else_expr, scope) + + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode, scope: Scope): + self.visit(node.condition, scope) + self.visit(node.body, scope) + + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode, scope: Scope): + self.visit(node.expr, scope) + for i, case in enumerate(node.cases): + self.visit(case, scope.children[i]) + + @visitor.when(ast.CaseNode) + def visit(self, node: ast.CaseNode, scope: Scope): + var_info = scope.find_variable(node.id) + if node.type == 'AUTO_TYPE': + if var_info.type == self.context.get_type('AUTO_TYPE'): + self.errors.append(err.INFERENCE_ERROR_VARIABLE % node.id) + node.type = var_info.type.name + self.visit(node.expr, scope) + + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode, scope: Scope): + self.visit(node.obj, scope) + + for arg in node.args: + self.visit(arg, scope) + + @visitor.when(ast.AtomicNode) + def visit(self, node: ast.AtomicNode, scope: Scope): + pass + + @visitor.when(ast.UnaryNode) + def visit(self, node: ast.UnaryNode, scope: Scope): + self.visit(node.expr, scope) + + @visitor.when(ast.BinaryNode) + def visit(self, node: ast.BinaryNode, scope: Scope): + self.visit(node.left, scope) + self.visit(node.right, scope) diff --git a/semantics/builder.py b/semantics/type_builder.py similarity index 94% rename from semantics/builder.py rename to semantics/type_builder.py index 5dc9a7883..4f4445eda 100644 --- a/semantics/builder.py +++ b/semantics/type_builder.py @@ -1,6 +1,7 @@ from typing import List, Optional import semantics.astnodes as ast +import semantics.errors as err import semantics.visitor as visitor from semantics.scope import Context, SemanticError, Type, ErrorType @@ -34,7 +35,7 @@ def visit(self, node: ast.ClassDeclarationNode): if node.parent is not None: if node.parent in ("Int", "String", "Bool", "SELF_TYPE"): - self.errors.append('Can not inherits from "Int", "String" or "Bool".') + self.errors.append(err.INVALID_PARENT_TYPE) try: self.current_type.set_parent(self.context.get_type(node.parent)) @@ -56,8 +57,8 @@ def visit(self, node: ast.AttrDeclarationNode): @visitor.when(ast.MethodDeclarationNode) def visit(self, node: ast.MethodDeclarationNode): - param_names = ['self'] - param_types = [self.current_type] + param_names = [] + param_types = [] for name, typex in node.params: param_names.append(name) try: diff --git a/semantics/type_checker.py b/semantics/type_checker.py index 18aa24b84..bb6747e3d 100644 --- a/semantics/type_checker.py +++ b/semantics/type_checker.py @@ -1,7 +1,7 @@ from typing import List import semantics.astnodes as ast -import semantics.semantic_errors as err +import semantics.errors as err import semantics.visitor as visitor from semantics.scope import Context, SemanticError, Type, Method, Scope, ErrorType @@ -37,6 +37,10 @@ def visit(self, node: ast.ClassDeclarationNode, scope: Scope): attrs = [feature for feature in node.features if isinstance(feature, ast.AttrDeclarationNode)] methods = [feature for feature in node.features if isinstance(feature, ast.MethodDeclarationNode)] + for attr, attr_owner in self.current_type.all_attributes(): + if attr_owner != self.current_type: + scope.define_variable(attr.name, attr.type) + for attr in attrs: self.visit(attr, scope) @@ -64,6 +68,9 @@ def visit(self, node: ast.MethodDeclarationNode, scope: Scope): # Parameters can hide the attribute declaration, that's why we are not checking if there is defined, # instead we are checking for local declaration. Also it is checked that the static type of a parameter is # different of SELF_TYPE. + + scope.define_variable('self', self.current_type) + for (param_name, param_type) in zip(self.current_method.param_names, self.current_method.param_types): if not scope.is_local(param_name): if param_type.name == 'SELF_TYPE': diff --git a/semantics/collector.py b/semantics/type_collector.py similarity index 100% rename from semantics/collector.py rename to semantics/type_collector.py diff --git a/semantics/type_inference.py b/semantics/type_inference.py index 33be9b1d4..a112001d8 100644 --- a/semantics/type_inference.py +++ b/semantics/type_inference.py @@ -1,35 +1,181 @@ -from typing import List +from typing import Dict, List, Tuple import semantics.astnodes as ast import semantics.visitor as visitor -from semantics.scope import Context, Type, Method, Scope +from semantics.scope import Type, Attribute, Method, Scope, Context -class InferenceTypeChecker: - def __init__(self, context: Context, errors: List[str] = []): +class DependencyNode: + def update(self, typex): + raise NotImplementedError() + + +class AtomNode(DependencyNode): + def __init__(self, typex): + self.type = typex + + def update(self, typex): + pass + + +class VariableInfoNode(DependencyNode): + def __init__(self, var_type, variable_info): + self.type: Type = var_type + self.variable_info: str = variable_info + + def update(self, typex): + self.type = self.variable_info.type = typex + + +class AttributeNode(DependencyNode): + def __init__(self, var_type, attribute): + self.type: Type = var_type + self.attribute: Attribute = attribute + + def update(self, typex): + self.type = self.attribute.type = typex + + +class ParameterNode(DependencyNode): + def __init__(self, param_type, method, index): + self.type: Type = param_type + self.method: Method = method + self.index: int = index + + def update(self, typex): + self.type = self.method.param_types[self.index] = typex + + +class ReturnTypeNode(DependencyNode): + def __init__(self, typex, method): + self.type: Type = typex + self.method: Method = method + + def update(self, typex): + self.type = self.method.return_type = typex + + +class DependencyGraph: + def __init__(self): + self.dependencies: Dict[DependencyNode, List[DependencyNode]] = {} + + def add_node(self, node: DependencyNode): + if node not in self.dependencies: + self.dependencies[node] = [] + + def add_edge(self, node: DependencyNode, other: DependencyNode): + try: + self.dependencies[node].append(other) + except KeyError: + self.dependencies[node] = [other] + + if other not in self.dependencies: + self.dependencies[other] = [] + + def update_dependencies(self, node: DependencyNode, typex: Type): + visited = set() + stack = self.dependencies[node] + [node] + while stack: + current_node = stack.pop() + + if current_node in visited: + continue + + current_node.update(typex) + visited.add(current_node) + stack += self.dependencies[current_node] + + +class InferenceChecker: + def __init__(self, context, errors): self.context: Context = context self.errors: List[str] = errors self.current_type: Type = None self.current_method: Method = None + self.variables = {} + self.attributes = self.build_attributes_reference(context) + self.methods = self.build_methods_reference(context) + self.dependencies = DependencyGraph() + + @staticmethod + def build_attributes_reference(context: Context) -> Dict[Tuple[str, str], AttributeNode]: + attributes = {} + + for typex in context: + for attr in typex.attributes: + attributes[typex.name, attr.name] = AttributeNode(attr.type, attr) + + return attributes + + @staticmethod + def build_methods_reference(context: Context) -> Dict[Tuple[str, str], Tuple[List[ParameterNode], ReturnTypeNode]]: + methods = {} + + for typex in context: + for method in typex.methods: + methods[typex.name, method.name] = ( + [ParameterNode(t, method, i) for i, t in enumerate(method.param_types)], + ReturnTypeNode(method.return_type, method)) + + return methods + @visitor.on('node') - def visit(self, node, tabs): + def visit(self, node, scope): pass @visitor.when(ast.ProgramNode) def visit(self, node: ast.ProgramNode, scope: Scope = None): - pass + if scope is None: + scope = Scope() + + for item in node.declarations: + self.visit(item, scope.create_child()) @visitor.when(ast.ClassDeclarationNode) def visit(self, node: ast.ClassDeclarationNode, scope: Scope): - pass + self.current_type = self.context.get_type(node.id) + + for node in node.features: + if isinstance(node, ast.AttrDeclarationNode): + self.visit(node, scope) + else: + self.visit(node, scope.create_child()) @visitor.when(ast.AttrDeclarationNode) def visit(self, node: ast.AttrDeclarationNode, scope: Scope): - pass + # Define attribute in the scope + var_info = scope.define_variable(node.id, self.context.get_type(node.type)) + + # Solve the expression of the attribute + expr_node = self.visit(node.expr, scope) if node.expr is not None else None + + # Set and get the reference to the variable info node + var_info_node = self.variables[var_info] = VariableInfoNode(self.context.get_type('AUTO_TYPE'), var_info) + + if node.type == 'AUTO_TYPE': + # Get the reference to the attribute node + attr_node = self.attributes[self.current_type.name, node.id] + + # If the expression node is not None then two edges are creates in the graph + if expr_node is not None: + self.dependencies.add_edge(expr_node, var_info_node) + self.dependencies.add_edge(expr_node, attr_node) + + # Finally a cycle is of two nodes are created between var_info_node and attr_node + self.dependencies.add_edge(var_info_node, attr_node) + self.dependencies.add_edge(attr_node, var_info_node) @visitor.when(ast.MethodDeclarationNode) def visit(self, node: ast.MethodDeclarationNode, scope: Scope): + self.current_method = self.current_type.get_method(node.id) + + self_var = scope.define_variable('self', self.current_type) + self.variables[self_var] = VariableInfoNode(self.current_type, self_var) + + for param_name, param_type in zip(self.current_method.param_names, self.current_method.param_types): + pass + pass @visitor.when(ast.LetNode) From 3f41e687467b9459d3e2fb785ab80db2f2e05621 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Sat, 9 May 2020 06:09:45 -0400 Subject: [PATCH 038/143] Type inference of AttrDeclarationNode and MethodDeclarationNode written --- semantics/type_checker.py | 2 +- semantics/type_inference.py | 42 +++++++++++++++++++++++++++++-------- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/semantics/type_checker.py b/semantics/type_checker.py index bb6747e3d..cd31ceb2b 100644 --- a/semantics/type_checker.py +++ b/semantics/type_checker.py @@ -71,7 +71,7 @@ def visit(self, node: ast.MethodDeclarationNode, scope: Scope): scope.define_variable('self', self.current_type) - for (param_name, param_type) in zip(self.current_method.param_names, self.current_method.param_types): + for param_name, param_type in zip(self.current_method.param_names, self.current_method.param_types): if not scope.is_local(param_name): if param_type.name == 'SELF_TYPE': self.errors.append(err.INVALID_PARAM_TYPE % 'SELF_TYPE') diff --git a/semantics/type_inference.py b/semantics/type_inference.py index a112001d8..3b8955981 100644 --- a/semantics/type_inference.py +++ b/semantics/type_inference.py @@ -96,7 +96,7 @@ def __init__(self, context, errors): self.variables = {} self.attributes = self.build_attributes_reference(context) self.methods = self.build_methods_reference(context) - self.dependencies = DependencyGraph() + self.graph = DependencyGraph() @staticmethod def build_attributes_reference(context: Context) -> Dict[Tuple[str, str], AttributeNode]: @@ -159,24 +159,48 @@ def visit(self, node: ast.AttrDeclarationNode, scope: Scope): # If the expression node is not None then two edges are creates in the graph if expr_node is not None: - self.dependencies.add_edge(expr_node, var_info_node) - self.dependencies.add_edge(expr_node, attr_node) + self.graph.add_edge(expr_node, var_info_node) + self.graph.add_edge(expr_node, attr_node) - # Finally a cycle is of two nodes are created between var_info_node and attr_node - self.dependencies.add_edge(var_info_node, attr_node) - self.dependencies.add_edge(attr_node, var_info_node) + # Finally a cycle of two nodes is created between var_info_node and attr_node + self.graph.add_edge(var_info_node, attr_node) + self.graph.add_edge(attr_node, var_info_node) @visitor.when(ast.MethodDeclarationNode) def visit(self, node: ast.MethodDeclarationNode, scope: Scope): self.current_method = self.current_type.get_method(node.id) + # Define 'self' as a variable in the scope self_var = scope.define_variable('self', self.current_type) + + # Set the reference of 'self' variable info node self.variables[self_var] = VariableInfoNode(self.current_type, self_var) - for param_name, param_type in zip(self.current_method.param_names, self.current_method.param_types): - pass + param_names = self.current_method.param_names + param_types = self.current_method.param_types - pass + for i, (param_name, param_type) in enumerate(zip(param_names, param_types)): + # Define parameter as local variable in current scope + param_var_info = scope.define_variable(param_name, param_type) + + # Set the reference to the variable info node + param_var_info_node = self.variables[param_var_info] = VariableInfoNode(param_type, param_var_info) + + if param_type.name == 'AUTO_TYPE': + # Get the parameter node + parameter_node = self.methods[self.current_type.name, self.current_method.name][0][i] + + # Create the cycle of two nodes between param_var_info_node and parameter_node + self.graph.add_edge(param_var_info_node, parameter_node) + self.graph.add_edge(parameter_node, param_var_info_node) + + # Solve the body of the method + body_node = self.visit(node.body, scope) + + if self.current_method.return_type.name == 'AUTO_TYPE': + # Get the return type node and add an edge body_node -> return_type_node + return_type_node = self.methods[self.current_type.name, self.current_method.name][1] + self.graph.add_edge(body_node, return_type_node) @visitor.when(ast.LetNode) def visit(self, node: ast.LetNode, scope: Scope): From 583f042c5883b5035328340c135bfeb061ea94a7 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Mon, 18 May 2020 09:55:37 -0400 Subject: [PATCH 039/143] Type inference working with inner recursion --- grammar.py | 22 +- main.py | 116 +- parser.py | 2450 +++++++++++++++--------------- semantics/astnodes.py | 3 +- semantics/formatter.py | 99 ++ semantics/temp/type_inference.py | 455 ------ semantics/type_checker.py | 12 +- semantics/type_inference.py | 336 +++- 8 files changed, 1754 insertions(+), 1739 deletions(-) delete mode 100644 semantics/temp/type_inference.py diff --git a/grammar.py b/grammar.py index 53ced754a..7c2d67c5b 100755 --- a/grammar.py +++ b/grammar.py @@ -157,17 +157,17 @@ def lexical_error(lexer): expr %= 'not expr', lambda s: ast.NegationNode(s[2]) expr %= 'comp', lambda s: s[1] -comp %= 'arith < arith', lambda s: ast.LessThanNode(s[1], s[3]) -comp %= 'arith <= arith', lambda s: ast.LessEqualNode(s[1], s[3]) -comp %= 'arith = arith', lambda s: ast.EqualNode(s[1], s[3]) +comp %= 'arith < arith', lambda s: ast.LessThanNode(s[1], s[2], s[3]) +comp %= 'arith <= arith', lambda s: ast.LessEqualNode(s[1], s[2], s[3]) +comp %= 'arith = arith', lambda s: ast.EqualNode(s[1], s[2], s[3]) comp %= 'arith', lambda s: s[1] -arith %= 'arith + term', lambda s: ast.PlusNode(s[1], s[3]) -arith %= 'arith - term', lambda s: ast.MinusNode(s[1], s[3]) +arith %= 'arith + term', lambda s: ast.PlusNode(s[1], s[2], s[3]) +arith %= 'arith - term', lambda s: ast.MinusNode(s[1], s[2], s[3]) arith %= 'term', lambda s: s[1] -term %= 'term * factor', lambda s: ast.StarNode(s[1], s[3]) -term %= 'term / factor', lambda s: ast.DivNode(s[1], s[3]) +term %= 'term * factor', lambda s: ast.StarNode(s[1], s[2], s[3]) +term %= 'term / factor', lambda s: ast.DivNode(s[1], s[2], s[3]) term %= 'factor', lambda s: s[1] factor %= 'isvoid factor', lambda s: ast.IsVoidNode(s[2]) @@ -196,7 +196,11 @@ def lexical_error(lexer): function_call %= 'id ( expr-list )', lambda s: ast.MethodCallNode(s[1], s[3]) function_call %= 'atom . id ( expr-list )', lambda s: ast.MethodCallNode(s[3], s[5], s[1]) -function_call %= 'atom @ type . id ( expr-list )', lambda s: ast.MethodCallNode(s[3], s[5], s[1]) +function_call %= 'atom @ type . id ( expr-list )', lambda s: ast.MethodCallNode(s[5], s[7], s[1], s[3]) + +function_call %= 'id ( )', lambda s: ast.MethodCallNode(s[1], []) +function_call %= 'atom . id ( )', lambda s: ast.MethodCallNode(s[3], [], s[1]) +function_call %= 'atom @ type . id ( )', lambda s: ast.MethodCallNode(s[5], [], s[1], s[3]) expr_list %= 'expr', lambda s: [s[1]] expr_list %= 'expr , expr-list', lambda s: [s[1]] + s[3] @@ -219,7 +223,7 @@ def attribute_error(s): return s[1] -@G.production("case-list -> id : type => expr ;") +@G.production("case-list -> id : type => expr error") def case_list_error(s): s.error(f"{s[5].line, s[5].column} - SyntacticError: Expected ';' instead of '{s[5].lex}'") return [ast.CaseNode(s[1], s[3], s[5])] diff --git a/main.py b/main.py index c376eabab..a0622414b 100755 --- a/main.py +++ b/main.py @@ -1,64 +1,92 @@ from lexer import CoolLexer from parser import CoolParser from semantics import (TypeCollector, TypeBuilder, OverriddenMethodChecker, TypeChecker, topological_ordering) +from semantics.formatter import CodeBuilder from semantics.scope import Context, Scope +from semantics.type_inference import InferenceChecker program = r""" class Main inherits IO { - main(): IO { - out_string("Hello, World.\n") - }; + a: Int; + + main(): IO {{ + let a: Int <- 2 in a; + + a <- 2; + + new IO; + + while true loop + 0 + pool; + + case a of + x: Int => + x + 2;n + x: String => + x.concat(" is a String\n"); + esac; + + out_string("Hello, World.\n"); + }}; fibonacci(n: AUTO_TYPE): Int { - if n <= 2 then 0 else fibonacci(n - 1) + fibonacci(n - 2) fi + if n <= 2 + then + 0 + else + fibonacci(n - 1) + fibonacci(n - 2) fi }; } """ -lexer = CoolLexer() -parser = CoolParser() - -if __name__ == '__main__': - # tokens = lexer(program) - # ast = parser(tokens) - # - # context = Context() - # errors = [] - # scope = Scope() - # - # TypeCollector(context, errors).visit(ast) - # TypeBuilder(context, errors).visit(ast) - # topological_ordering(ast, context, errors) - # OverriddenMethodChecker(context, errors).visit(ast) - # TypeChecker(context, errors).visit(ast, scope) - # # Executor(context, errors).visit(ast, scope) - # - # for error in errors: - # print(error) - # print("Done!") +inference_program_01 = r""" +class Point { + a: AUTO_TYPE; + b: AUTO_TYPE; - class MyClass: - def __init__(self, name): - self.name = name + init(x: AUTO_TYPE, y: AUTO_TYPE): AUTO_TYPE {{ + a <- b; + b <- x + y; + create_point(); + }}; + + create_point(): AUTO_TYPE { new Point }; +} +""" - def __hash__(self): - return id(self) +inference_program_02 = r""" +class Ackermann { + ackermann(m: AUTO_TYPE, n: AUTO_TYPE): AUTO_TYPE { + if m = 0 then n + 1 else + if n = 0 then ackermann(m - 1, 1) else + ackermann(m - 1, ackermann(m, n - 1)) + fi + fi + }; +} +""" - def __str__(self): - return self.name +lexer = CoolLexer() +parser = CoolParser() - def __repr__(self): - return self.name +if __name__ == '__main__': + tokens = lexer(inference_program_02) + ast = parser(tokens) - a = MyClass('Item0') - b = MyClass('Item1') - c = MyClass('Item2') - d = MyClass('Item3') - e = MyClass('Item4') + context = Context() + errors = [] + scope = Scope() - objects = {(0, a), (1, b), (2, c), (3, d), (4, e)} + TypeCollector(context, errors).visit(ast) + TypeBuilder(context, errors).visit(ast) + topological_ordering(ast, context, errors) + OverriddenMethodChecker(context, errors).visit(ast) + InferenceChecker(context, errors).visit(ast, scope) + # TypeChecker(context, errors).visit(ast, scope) + # Executor(context, errors).visit(ast, scope) - print((4, e) in objects) - e.name = 'NewItem' - print((4, e) in objects) - print(objects) + print(CodeBuilder().visit(ast)) + for error in errors: + print(error) + print("Done!") diff --git a/parser.py b/parser.py index 657f38c4e..373008467 100755 --- a/parser.py +++ b/parser.py @@ -15,1316 +15,1384 @@ def __action_table(): return { (0, G["class"]): ("SHIFT", 1), (1, G["type"]): ("SHIFT", 2), - (2, G["inherits"]): ("SHIFT", 140), (2, G["{"]): ("SHIFT", 3), + (2, G["inherits"]): ("SHIFT", 144), (3, G["}"]): ("REDUCE", G["feature-list -> e"]), (3, G["id"]): ("SHIFT", 4), + (4, G[":"]): ("SHIFT", 128), (4, G["("]): ("SHIFT", 5), - (4, G[":"]): ("SHIFT", 124), - (5, G["id"]): ("SHIFT", 112), (5, G[")"]): ("SHIFT", 6), + (5, G["id"]): ("SHIFT", 116), (6, G[":"]): ("SHIFT", 7), (7, G["type"]): ("SHIFT", 8), (8, G["{"]): ("SHIFT", 9), - (9, G["false"]): ("SHIFT", 26), + (9, G["string"]): ("SHIFT", 34), + (9, G["id"]): ("SHIFT", 32), + (9, G["let"]): ("SHIFT", 14), + (9, G["int"]): ("SHIFT", 35), (9, G["while"]): ("SHIFT", 13), - (9, G["id"]): ("SHIFT", 31), - (9, G["not"]): ("SHIFT", 30), - (9, G["string"]): ("SHIFT", 33), - (9, G["true"]): ("SHIFT", 25), (9, G["isvoid"]): ("SHIFT", 24), + (9, G["not"]): ("SHIFT", 31), (9, G["if"]): ("SHIFT", 12), (9, G["new"]): ("SHIFT", 22), - (9, G["("]): ("SHIFT", 11), (9, G["{"]): ("SHIFT", 10), - (9, G["~"]): ("SHIFT", 27), - (9, G["int"]): ("SHIFT", 34), (9, G["case"]): ("SHIFT", 21), - (9, G["let"]): ("SHIFT", 14), - (10, G["new"]): ("SHIFT", 22), - (10, G["("]): ("SHIFT", 11), - (10, G["~"]): ("SHIFT", 27), - (10, G["case"]): ("SHIFT", 21), + (9, G["("]): ("SHIFT", 11), + (9, G["~"]): ("SHIFT", 27), + (9, G["true"]): ("SHIFT", 25), + (9, G["false"]): ("SHIFT", 26), + (10, G["true"]): ("SHIFT", 25), + (10, G["false"]): ("SHIFT", 26), + (10, G["id"]): ("SHIFT", 32), + (10, G["string"]): ("SHIFT", 34), (10, G["let"]): ("SHIFT", 14), (10, G["while"]): ("SHIFT", 13), - (10, G["not"]): ("SHIFT", 30), - (10, G["if"]): ("SHIFT", 12), - (10, G["int"]): ("SHIFT", 34), (10, G["isvoid"]): ("SHIFT", 24), + (10, G["if"]): ("SHIFT", 12), + (10, G["not"]): ("SHIFT", 31), + (10, G["int"]): ("SHIFT", 35), (10, G["{"]): ("SHIFT", 10), - (10, G["id"]): ("SHIFT", 31), - (10, G["false"]): ("SHIFT", 26), - (10, G["string"]): ("SHIFT", 33), - (10, G["true"]): ("SHIFT", 25), - (11, G["{"]): ("SHIFT", 10), - (11, G["if"]): ("SHIFT", 12), - (11, G["id"]): ("SHIFT", 31), - (11, G["int"]): ("SHIFT", 34), + (10, G["case"]): ("SHIFT", 21), + (10, G["new"]): ("SHIFT", 22), + (10, G["~"]): ("SHIFT", 27), + (10, G["("]): ("SHIFT", 11), (11, G["isvoid"]): ("SHIFT", 24), - (11, G["false"]): ("SHIFT", 26), - (11, G["string"]): ("SHIFT", 33), - (11, G["true"]): ("SHIFT", 25), + (11, G["int"]): ("SHIFT", 35), (11, G["new"]): ("SHIFT", 22), + (11, G["~"]): ("SHIFT", 27), (11, G["("]): ("SHIFT", 11), - (11, G["case"]): ("SHIFT", 21), + (11, G["id"]): ("SHIFT", 32), (11, G["let"]): ("SHIFT", 14), (11, G["while"]): ("SHIFT", 13), - (11, G["~"]): ("SHIFT", 27), - (11, G["not"]): ("SHIFT", 30), - (12, G["id"]): ("SHIFT", 31), - (12, G["string"]): ("SHIFT", 33), + (11, G["not"]): ("SHIFT", 31), + (11, G["if"]): ("SHIFT", 12), + (11, G["true"]): ("SHIFT", 25), + (11, G["{"]): ("SHIFT", 10), + (11, G["false"]): ("SHIFT", 26), + (11, G["case"]): ("SHIFT", 21), + (11, G["string"]): ("SHIFT", 34), + (12, G["("]): ("SHIFT", 11), (12, G["isvoid"]): ("SHIFT", 24), (12, G["true"]): ("SHIFT", 25), - (12, G["case"]): ("SHIFT", 21), + (12, G["id"]): ("SHIFT", 32), + (12, G["false"]): ("SHIFT", 26), (12, G["let"]): ("SHIFT", 14), - (12, G["new"]): ("SHIFT", 22), - (12, G["("]): ("SHIFT", 11), - (12, G["while"]): ("SHIFT", 13), - (12, G["not"]): ("SHIFT", 30), (12, G["~"]): ("SHIFT", 27), - (12, G["{"]): ("SHIFT", 10), + (12, G["string"]): ("SHIFT", 34), + (12, G["while"]): ("SHIFT", 13), (12, G["if"]): ("SHIFT", 12), - (12, G["int"]): ("SHIFT", 34), - (12, G["false"]): ("SHIFT", 26), - (13, G["false"]): ("SHIFT", 26), + (12, G["not"]): ("SHIFT", 31), + (12, G["{"]): ("SHIFT", 10), + (12, G["int"]): ("SHIFT", 35), + (12, G["case"]): ("SHIFT", 21), + (12, G["new"]): ("SHIFT", 22), + (13, G["id"]): ("SHIFT", 32), + (13, G["int"]): ("SHIFT", 35), (13, G["let"]): ("SHIFT", 14), - (13, G["case"]): ("SHIFT", 21), - (13, G["id"]): ("SHIFT", 31), - (13, G["string"]): ("SHIFT", 33), (13, G["while"]): ("SHIFT", 13), - (13, G["not"]): ("SHIFT", 30), - (13, G["~"]): ("SHIFT", 27), - (13, G["true"]): ("SHIFT", 25), (13, G["new"]): ("SHIFT", 22), + (13, G["if"]): ("SHIFT", 12), + (13, G["not"]): ("SHIFT", 31), + (13, G["~"]): ("SHIFT", 27), (13, G["("]): ("SHIFT", 11), (13, G["{"]): ("SHIFT", 10), - (13, G["if"]): ("SHIFT", 12), + (13, G["case"]): ("SHIFT", 21), + (13, G["true"]): ("SHIFT", 25), + (13, G["false"]): ("SHIFT", 26), + (13, G["string"]): ("SHIFT", 34), (13, G["isvoid"]): ("SHIFT", 24), - (13, G["int"]): ("SHIFT", 34), (14, G["id"]): ("SHIFT", 15), (15, G[":"]): ("SHIFT", 16), (16, G["type"]): ("SHIFT", 17), (17, G["<-"]): ("SHIFT", 20), - (17, G[","]): ("SHIFT", 18), (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), + (17, G[","]): ("SHIFT", 18), (18, G["id"]): ("SHIFT", 15), (19, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), + (20, G["new"]): ("SHIFT", 22), (20, G["("]): ("SHIFT", 11), - (20, G["isvoid"]): ("SHIFT", 24), - (20, G["case"]): ("SHIFT", 21), + (20, G["id"]): ("SHIFT", 32), (20, G["let"]): ("SHIFT", 14), (20, G["while"]): ("SHIFT", 13), - (20, G["int"]): ("SHIFT", 34), - (20, G["false"]): ("SHIFT", 26), - (20, G["not"]): ("SHIFT", 30), - (20, G["id"]): ("SHIFT", 31), - (20, G["string"]): ("SHIFT", 33), + (20, G["isvoid"]): ("SHIFT", 24), + (20, G["not"]): ("SHIFT", 31), + (20, G["true"]): ("SHIFT", 25), (20, G["if"]): ("SHIFT", 12), - (20, G["~"]): ("SHIFT", 27), (20, G["{"]): ("SHIFT", 10), - (20, G["true"]): ("SHIFT", 25), - (20, G["new"]): ("SHIFT", 22), - (21, G["new"]): ("SHIFT", 22), - (21, G["("]): ("SHIFT", 11), + (20, G["false"]): ("SHIFT", 26), + (20, G["case"]): ("SHIFT", 21), + (20, G["string"]): ("SHIFT", 34), + (20, G["~"]): ("SHIFT", 27), + (20, G["int"]): ("SHIFT", 35), (21, G["~"]): ("SHIFT", 27), - (21, G["case"]): ("SHIFT", 21), + (21, G["true"]): ("SHIFT", 25), + (21, G["id"]): ("SHIFT", 32), (21, G["let"]): ("SHIFT", 14), - (21, G["while"]): ("SHIFT", 13), - (21, G["not"]): ("SHIFT", 30), - (21, G["int"]): ("SHIFT", 34), - (21, G["isvoid"]): ("SHIFT", 24), (21, G["false"]): ("SHIFT", 26), + (21, G["string"]): ("SHIFT", 34), + (21, G["while"]): ("SHIFT", 13), + (21, G["not"]): ("SHIFT", 31), (21, G["if"]): ("SHIFT", 12), - (21, G["id"]): ("SHIFT", 31), (21, G["{"]): ("SHIFT", 10), - (21, G["string"]): ("SHIFT", 33), - (21, G["true"]): ("SHIFT", 25), + (21, G["int"]): ("SHIFT", 35), + (21, G["case"]): ("SHIFT", 21), + (21, G["isvoid"]): ("SHIFT", 24), + (21, G["new"]): ("SHIFT", 22), + (21, G["("]): ("SHIFT", 11), (22, G["type"]): ("SHIFT", 23), + (23, G["<"]): ("REDUCE", G["atom -> new type"]), + (23, G[")"]): ("REDUCE", G["atom -> new type"]), + (23, G["then"]): ("REDUCE", G["atom -> new type"]), + (23, G["<="]): ("REDUCE", G["atom -> new type"]), + (23, G["."]): ("REDUCE", G["atom -> new type"]), + (23, G["else"]): ("REDUCE", G["atom -> new type"]), + (23, G["="]): ("REDUCE", G["atom -> new type"]), + (23, G[","]): ("REDUCE", G["atom -> new type"]), + (23, G["/"]): ("REDUCE", G["atom -> new type"]), + (23, G["fi"]): ("REDUCE", G["atom -> new type"]), (23, G[";"]): ("REDUCE", G["atom -> new type"]), (23, G["loop"]): ("REDUCE", G["atom -> new type"]), (23, G["@"]): ("REDUCE", G["atom -> new type"]), (23, G["pool"]): ("REDUCE", G["atom -> new type"]), (23, G["+"]): ("REDUCE", G["atom -> new type"]), (23, G["-"]): ("REDUCE", G["atom -> new type"]), + (23, G["error"]): ("REDUCE", G["atom -> new type"]), (23, G["in"]): ("REDUCE", G["atom -> new type"]), (23, G["*"]): ("REDUCE", G["atom -> new type"]), (23, G["}"]): ("REDUCE", G["atom -> new type"]), - (23, G["/"]): ("REDUCE", G["atom -> new type"]), (23, G["of"]): ("REDUCE", G["atom -> new type"]), - (23, G["<"]): ("REDUCE", G["atom -> new type"]), - (23, G[")"]): ("REDUCE", G["atom -> new type"]), - (23, G["<="]): ("REDUCE", G["atom -> new type"]), - (23, G["then"]): ("REDUCE", G["atom -> new type"]), - (23, G["."]): ("REDUCE", G["atom -> new type"]), - (23, G["="]): ("REDUCE", G["atom -> new type"]), - (23, G["else"]): ("REDUCE", G["atom -> new type"]), - (23, G["error"]): ("REDUCE", G["atom -> new type"]), - (23, G[","]): ("REDUCE", G["atom -> new type"]), - (23, G["fi"]): ("REDUCE", G["atom -> new type"]), - (24, G["false"]): ("SHIFT", 26), (24, G["true"]): ("SHIFT", 25), - (24, G["id"]): ("SHIFT", 28), - (24, G["string"]): ("SHIFT", 33), - (24, G["int"]): ("SHIFT", 34), - (24, G["isvoid"]): ("SHIFT", 24), (24, G["new"]): ("SHIFT", 22), - (24, G["("]): ("SHIFT", 11), + (24, G["false"]): ("SHIFT", 26), (24, G["~"]): ("SHIFT", 27), + (24, G["string"]): ("SHIFT", 34), + (24, G["id"]): ("SHIFT", 28), + (24, G["("]): ("SHIFT", 11), + (24, G["isvoid"]): ("SHIFT", 24), + (24, G["int"]): ("SHIFT", 35), + (25, G["<"]): ("REDUCE", G["atom -> true"]), + (25, G[")"]): ("REDUCE", G["atom -> true"]), + (25, G["then"]): ("REDUCE", G["atom -> true"]), + (25, G["<="]): ("REDUCE", G["atom -> true"]), + (25, G["."]): ("REDUCE", G["atom -> true"]), + (25, G["else"]): ("REDUCE", G["atom -> true"]), + (25, G["="]): ("REDUCE", G["atom -> true"]), + (25, G[","]): ("REDUCE", G["atom -> true"]), + (25, G["/"]): ("REDUCE", G["atom -> true"]), + (25, G["fi"]): ("REDUCE", G["atom -> true"]), (25, G[";"]): ("REDUCE", G["atom -> true"]), (25, G["loop"]): ("REDUCE", G["atom -> true"]), (25, G["@"]): ("REDUCE", G["atom -> true"]), (25, G["pool"]): ("REDUCE", G["atom -> true"]), (25, G["+"]): ("REDUCE", G["atom -> true"]), (25, G["-"]): ("REDUCE", G["atom -> true"]), + (25, G["error"]): ("REDUCE", G["atom -> true"]), (25, G["in"]): ("REDUCE", G["atom -> true"]), (25, G["*"]): ("REDUCE", G["atom -> true"]), (25, G["}"]): ("REDUCE", G["atom -> true"]), - (25, G["/"]): ("REDUCE", G["atom -> true"]), (25, G["of"]): ("REDUCE", G["atom -> true"]), - (25, G["<"]): ("REDUCE", G["atom -> true"]), - (25, G[")"]): ("REDUCE", G["atom -> true"]), - (25, G["<="]): ("REDUCE", G["atom -> true"]), - (25, G["then"]): ("REDUCE", G["atom -> true"]), - (25, G["."]): ("REDUCE", G["atom -> true"]), - (25, G["="]): ("REDUCE", G["atom -> true"]), - (25, G["else"]): ("REDUCE", G["atom -> true"]), - (25, G["error"]): ("REDUCE", G["atom -> true"]), - (25, G[","]): ("REDUCE", G["atom -> true"]), - (25, G["fi"]): ("REDUCE", G["atom -> true"]), + (26, G["<"]): ("REDUCE", G["atom -> false"]), + (26, G[")"]): ("REDUCE", G["atom -> false"]), + (26, G["then"]): ("REDUCE", G["atom -> false"]), + (26, G["<="]): ("REDUCE", G["atom -> false"]), + (26, G["."]): ("REDUCE", G["atom -> false"]), + (26, G["else"]): ("REDUCE", G["atom -> false"]), + (26, G["="]): ("REDUCE", G["atom -> false"]), + (26, G[","]): ("REDUCE", G["atom -> false"]), + (26, G["/"]): ("REDUCE", G["atom -> false"]), + (26, G["fi"]): ("REDUCE", G["atom -> false"]), (26, G[";"]): ("REDUCE", G["atom -> false"]), (26, G["loop"]): ("REDUCE", G["atom -> false"]), (26, G["@"]): ("REDUCE", G["atom -> false"]), (26, G["pool"]): ("REDUCE", G["atom -> false"]), (26, G["+"]): ("REDUCE", G["atom -> false"]), (26, G["-"]): ("REDUCE", G["atom -> false"]), + (26, G["error"]): ("REDUCE", G["atom -> false"]), (26, G["in"]): ("REDUCE", G["atom -> false"]), (26, G["*"]): ("REDUCE", G["atom -> false"]), (26, G["}"]): ("REDUCE", G["atom -> false"]), - (26, G["/"]): ("REDUCE", G["atom -> false"]), (26, G["of"]): ("REDUCE", G["atom -> false"]), - (26, G["<"]): ("REDUCE", G["atom -> false"]), - (26, G[")"]): ("REDUCE", G["atom -> false"]), - (26, G["<="]): ("REDUCE", G["atom -> false"]), - (26, G["then"]): ("REDUCE", G["atom -> false"]), - (26, G["."]): ("REDUCE", G["atom -> false"]), - (26, G["="]): ("REDUCE", G["atom -> false"]), - (26, G["else"]): ("REDUCE", G["atom -> false"]), - (26, G["error"]): ("REDUCE", G["atom -> false"]), - (26, G[","]): ("REDUCE", G["atom -> false"]), - (26, G["fi"]): ("REDUCE", G["atom -> false"]), - (27, G["false"]): ("SHIFT", 26), (27, G["true"]): ("SHIFT", 25), - (27, G["id"]): ("SHIFT", 28), - (27, G["string"]): ("SHIFT", 33), - (27, G["int"]): ("SHIFT", 34), - (27, G["isvoid"]): ("SHIFT", 24), (27, G["new"]): ("SHIFT", 22), - (27, G["("]): ("SHIFT", 11), + (27, G["false"]): ("SHIFT", 26), (27, G["~"]): ("SHIFT", 27), + (27, G["string"]): ("SHIFT", 34), + (27, G["id"]): ("SHIFT", 28), + (27, G["("]): ("SHIFT", 11), + (27, G["isvoid"]): ("SHIFT", 24), + (27, G["int"]): ("SHIFT", 35), + (28, G["("]): ("SHIFT", 29), + (28, G["<"]): ("REDUCE", G["atom -> id"]), + (28, G[")"]): ("REDUCE", G["atom -> id"]), + (28, G["then"]): ("REDUCE", G["atom -> id"]), + (28, G["<="]): ("REDUCE", G["atom -> id"]), + (28, G["."]): ("REDUCE", G["atom -> id"]), + (28, G["else"]): ("REDUCE", G["atom -> id"]), + (28, G["="]): ("REDUCE", G["atom -> id"]), + (28, G[","]): ("REDUCE", G["atom -> id"]), + (28, G["/"]): ("REDUCE", G["atom -> id"]), + (28, G["fi"]): ("REDUCE", G["atom -> id"]), (28, G[";"]): ("REDUCE", G["atom -> id"]), (28, G["loop"]): ("REDUCE", G["atom -> id"]), (28, G["@"]): ("REDUCE", G["atom -> id"]), (28, G["pool"]): ("REDUCE", G["atom -> id"]), (28, G["+"]): ("REDUCE", G["atom -> id"]), (28, G["-"]): ("REDUCE", G["atom -> id"]), + (28, G["error"]): ("REDUCE", G["atom -> id"]), (28, G["in"]): ("REDUCE", G["atom -> id"]), (28, G["*"]): ("REDUCE", G["atom -> id"]), (28, G["}"]): ("REDUCE", G["atom -> id"]), - (28, G["/"]): ("REDUCE", G["atom -> id"]), (28, G["of"]): ("REDUCE", G["atom -> id"]), - (28, G["<"]): ("REDUCE", G["atom -> id"]), - (28, G[")"]): ("REDUCE", G["atom -> id"]), - (28, G["<="]): ("REDUCE", G["atom -> id"]), - (28, G["then"]): ("REDUCE", G["atom -> id"]), - (28, G["."]): ("REDUCE", G["atom -> id"]), - (28, G["="]): ("REDUCE", G["atom -> id"]), - (28, G["else"]): ("REDUCE", G["atom -> id"]), - (28, G["error"]): ("REDUCE", G["atom -> id"]), - (28, G[","]): ("REDUCE", G["atom -> id"]), - (28, G["fi"]): ("REDUCE", G["atom -> id"]), - (28, G["("]): ("SHIFT", 29), - (29, G["isvoid"]): ("SHIFT", 24), - (29, G["int"]): ("SHIFT", 34), - (29, G["false"]): ("SHIFT", 26), - (29, G["let"]): ("SHIFT", 14), - (29, G["case"]): ("SHIFT", 21), - (29, G["id"]): ("SHIFT", 31), - (29, G["string"]): ("SHIFT", 33), + (29, G["id"]): ("SHIFT", 32), (29, G["while"]): ("SHIFT", 13), - (29, G["not"]): ("SHIFT", 30), - (29, G["true"]): ("SHIFT", 25), - (29, G["new"]): ("SHIFT", 22), - (29, G["("]): ("SHIFT", 11), + (29, G["not"]): ("SHIFT", 31), + (29, G[")"]): ("SHIFT", 30), (29, G["if"]): ("SHIFT", 12), (29, G["~"]): ("SHIFT", 27), + (29, G["int"]): ("SHIFT", 35), (29, G["{"]): ("SHIFT", 10), - (30, G["int"]): ("SHIFT", 34), - (30, G["isvoid"]): ("SHIFT", 24), - (30, G["case"]): ("SHIFT", 21), - (30, G["let"]): ("SHIFT", 14), - (30, G["false"]): ("SHIFT", 26), - (30, G["while"]): ("SHIFT", 13), - (30, G["id"]): ("SHIFT", 31), - (30, G["string"]): ("SHIFT", 33), - (30, G["not"]): ("SHIFT", 30), - (30, G["true"]): ("SHIFT", 25), - (30, G["new"]): ("SHIFT", 22), - (30, G["("]): ("SHIFT", 11), - (30, G["if"]): ("SHIFT", 12), - (30, G["{"]): ("SHIFT", 10), - (30, G["~"]): ("SHIFT", 27), - (31, G[";"]): ("REDUCE", G["atom -> id"]), - (31, G["loop"]): ("REDUCE", G["atom -> id"]), - (31, G["@"]): ("REDUCE", G["atom -> id"]), - (31, G["pool"]): ("REDUCE", G["atom -> id"]), - (31, G["+"]): ("REDUCE", G["atom -> id"]), - (31, G["-"]): ("REDUCE", G["atom -> id"]), - (31, G["in"]): ("REDUCE", G["atom -> id"]), - (31, G["*"]): ("REDUCE", G["atom -> id"]), - (31, G["}"]): ("REDUCE", G["atom -> id"]), - (31, G["/"]): ("REDUCE", G["atom -> id"]), - (31, G["of"]): ("REDUCE", G["atom -> id"]), - (31, G["<"]): ("REDUCE", G["atom -> id"]), - (31, G[")"]): ("REDUCE", G["atom -> id"]), - (31, G["<="]): ("REDUCE", G["atom -> id"]), - (31, G["then"]): ("REDUCE", G["atom -> id"]), - (31, G["."]): ("REDUCE", G["atom -> id"]), - (31, G["="]): ("REDUCE", G["atom -> id"]), - (31, G["else"]): ("REDUCE", G["atom -> id"]), - (31, G["error"]): ("REDUCE", G["atom -> id"]), - (31, G[","]): ("REDUCE", G["atom -> id"]), - (31, G["fi"]): ("REDUCE", G["atom -> id"]), - (31, G["<-"]): ("SHIFT", 32), - (31, G["("]): ("SHIFT", 29), - (32, G["int"]): ("SHIFT", 34), - (32, G["isvoid"]): ("SHIFT", 24), - (32, G["case"]): ("SHIFT", 21), - (32, G["let"]): ("SHIFT", 14), - (32, G["false"]): ("SHIFT", 26), - (32, G["while"]): ("SHIFT", 13), - (32, G["id"]): ("SHIFT", 31), - (32, G["string"]): ("SHIFT", 33), - (32, G["not"]): ("SHIFT", 30), - (32, G["true"]): ("SHIFT", 25), - (32, G["new"]): ("SHIFT", 22), - (32, G["("]): ("SHIFT", 11), - (32, G["if"]): ("SHIFT", 12), - (32, G["{"]): ("SHIFT", 10), - (32, G["~"]): ("SHIFT", 27), - (33, G[";"]): ("REDUCE", G["atom -> string"]), - (33, G["loop"]): ("REDUCE", G["atom -> string"]), - (33, G["@"]): ("REDUCE", G["atom -> string"]), - (33, G["pool"]): ("REDUCE", G["atom -> string"]), - (33, G["+"]): ("REDUCE", G["atom -> string"]), - (33, G["-"]): ("REDUCE", G["atom -> string"]), - (33, G["in"]): ("REDUCE", G["atom -> string"]), - (33, G["*"]): ("REDUCE", G["atom -> string"]), - (33, G["}"]): ("REDUCE", G["atom -> string"]), - (33, G["/"]): ("REDUCE", G["atom -> string"]), - (33, G["of"]): ("REDUCE", G["atom -> string"]), - (33, G["<"]): ("REDUCE", G["atom -> string"]), - (33, G[")"]): ("REDUCE", G["atom -> string"]), - (33, G["<="]): ("REDUCE", G["atom -> string"]), - (33, G["then"]): ("REDUCE", G["atom -> string"]), - (33, G["."]): ("REDUCE", G["atom -> string"]), - (33, G["="]): ("REDUCE", G["atom -> string"]), - (33, G["else"]): ("REDUCE", G["atom -> string"]), - (33, G["error"]): ("REDUCE", G["atom -> string"]), - (33, G[","]): ("REDUCE", G["atom -> string"]), - (33, G["fi"]): ("REDUCE", G["atom -> string"]), - (34, G[";"]): ("REDUCE", G["atom -> int"]), - (34, G["loop"]): ("REDUCE", G["atom -> int"]), - (34, G["@"]): ("REDUCE", G["atom -> int"]), - (34, G["pool"]): ("REDUCE", G["atom -> int"]), - (34, G["+"]): ("REDUCE", G["atom -> int"]), - (34, G["-"]): ("REDUCE", G["atom -> int"]), - (34, G["in"]): ("REDUCE", G["atom -> int"]), - (34, G["*"]): ("REDUCE", G["atom -> int"]), - (34, G["}"]): ("REDUCE", G["atom -> int"]), - (34, G["/"]): ("REDUCE", G["atom -> int"]), - (34, G["of"]): ("REDUCE", G["atom -> int"]), - (34, G["<"]): ("REDUCE", G["atom -> int"]), - (34, G[")"]): ("REDUCE", G["atom -> int"]), - (34, G["<="]): ("REDUCE", G["atom -> int"]), - (34, G["then"]): ("REDUCE", G["atom -> int"]), - (34, G["."]): ("REDUCE", G["atom -> int"]), - (34, G["="]): ("REDUCE", G["atom -> int"]), - (34, G["else"]): ("REDUCE", G["atom -> int"]), - (34, G["error"]): ("REDUCE", G["atom -> int"]), - (34, G[","]): ("REDUCE", G["atom -> int"]), - (34, G["fi"]): ("REDUCE", G["atom -> int"]), - (35, G[";"]): ("REDUCE", G["atom -> function-call"]), - (35, G["loop"]): ("REDUCE", G["atom -> function-call"]), - (35, G["@"]): ("REDUCE", G["atom -> function-call"]), - (35, G["pool"]): ("REDUCE", G["atom -> function-call"]), - (35, G["+"]): ("REDUCE", G["atom -> function-call"]), - (35, G["-"]): ("REDUCE", G["atom -> function-call"]), - (35, G["in"]): ("REDUCE", G["atom -> function-call"]), - (35, G["*"]): ("REDUCE", G["atom -> function-call"]), - (35, G["}"]): ("REDUCE", G["atom -> function-call"]), - (35, G["/"]): ("REDUCE", G["atom -> function-call"]), - (35, G["of"]): ("REDUCE", G["atom -> function-call"]), - (35, G["<"]): ("REDUCE", G["atom -> function-call"]), - (35, G[")"]): ("REDUCE", G["atom -> function-call"]), - (35, G["<="]): ("REDUCE", G["atom -> function-call"]), - (35, G["then"]): ("REDUCE", G["atom -> function-call"]), - (35, G["."]): ("REDUCE", G["atom -> function-call"]), - (35, G["="]): ("REDUCE", G["atom -> function-call"]), - (35, G["else"]): ("REDUCE", G["atom -> function-call"]), - (35, G["error"]): ("REDUCE", G["atom -> function-call"]), - (35, G[","]): ("REDUCE", G["atom -> function-call"]), - (35, G["fi"]): ("REDUCE", G["atom -> function-call"]), - (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["else"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["in"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["}"]): ("REDUCE", G["expr -> id <- expr"]), - (37, G[";"]): ("REDUCE", G["expr -> comp"]), - (37, G["of"]): ("REDUCE", G["expr -> comp"]), - (37, G["loop"]): ("REDUCE", G["expr -> comp"]), - (37, G[")"]): ("REDUCE", G["expr -> comp"]), - (37, G["pool"]): ("REDUCE", G["expr -> comp"]), - (37, G["then"]): ("REDUCE", G["expr -> comp"]), - (37, G["else"]): ("REDUCE", G["expr -> comp"]), - (37, G["error"]): ("REDUCE", G["expr -> comp"]), - (37, G[","]): ("REDUCE", G["expr -> comp"]), - (37, G["in"]): ("REDUCE", G["expr -> comp"]), - (37, G["fi"]): ("REDUCE", G["expr -> comp"]), - (37, G["}"]): ("REDUCE", G["expr -> comp"]), - (38, G["<="]): ("SHIFT", 67), - (38, G["+"]): ("SHIFT", 39), - (38, G[";"]): ("REDUCE", G["comp -> arith"]), - (38, G["of"]): ("REDUCE", G["comp -> arith"]), - (38, G["loop"]): ("REDUCE", G["comp -> arith"]), - (38, G[")"]): ("REDUCE", G["comp -> arith"]), - (38, G["pool"]): ("REDUCE", G["comp -> arith"]), - (38, G["then"]): ("REDUCE", G["comp -> arith"]), - (38, G["else"]): ("REDUCE", G["comp -> arith"]), - (38, G["error"]): ("REDUCE", G["comp -> arith"]), - (38, G[","]): ("REDUCE", G["comp -> arith"]), - (38, G["in"]): ("REDUCE", G["comp -> arith"]), - (38, G["fi"]): ("REDUCE", G["comp -> arith"]), - (38, G["}"]): ("REDUCE", G["comp -> arith"]), - (38, G["-"]): ("SHIFT", 63), - (38, G["<"]): ("SHIFT", 65), - (38, G["="]): ("SHIFT", 69), - (39, G["false"]): ("SHIFT", 26), - (39, G["id"]): ("SHIFT", 28), - (39, G["string"]): ("SHIFT", 33), - (39, G["true"]): ("SHIFT", 25), - (39, G["int"]): ("SHIFT", 34), - (39, G["isvoid"]): ("SHIFT", 24), - (39, G["new"]): ("SHIFT", 22), - (39, G["("]): ("SHIFT", 11), - (39, G["~"]): ("SHIFT", 27), - (40, G[";"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["+"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["of"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["<"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["<="]): ("REDUCE", G["arith -> arith + term"]), - (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["then"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["="]): ("REDUCE", G["arith -> arith + term"]), - (40, G["else"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), - (40, G[","]): ("REDUCE", G["arith -> arith + term"]), - (40, G["fi"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["/"]): ("SHIFT", 53), - (40, G["*"]): ("SHIFT", 41), - (41, G["false"]): ("SHIFT", 26), - (41, G["true"]): ("SHIFT", 25), - (41, G["id"]): ("SHIFT", 28), - (41, G["string"]): ("SHIFT", 33), - (41, G["int"]): ("SHIFT", 34), - (41, G["isvoid"]): ("SHIFT", 24), - (41, G["new"]): ("SHIFT", 22), - (41, G["("]): ("SHIFT", 11), - (41, G["~"]): ("SHIFT", 27), - (42, G[";"]): ("REDUCE", G["term -> term * factor"]), - (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), - (42, G["pool"]): ("REDUCE", G["term -> term * factor"]), - (42, G["+"]): ("REDUCE", G["term -> term * factor"]), - (42, G["-"]): ("REDUCE", G["term -> term * factor"]), - (42, G["in"]): ("REDUCE", G["term -> term * factor"]), - (42, G["*"]): ("REDUCE", G["term -> term * factor"]), - (42, G["}"]): ("REDUCE", G["term -> term * factor"]), - (42, G["/"]): ("REDUCE", G["term -> term * factor"]), - (42, G["of"]): ("REDUCE", G["term -> term * factor"]), - (42, G["<"]): ("REDUCE", G["term -> term * factor"]), - (42, G[")"]): ("REDUCE", G["term -> term * factor"]), - (42, G["<="]): ("REDUCE", G["term -> term * factor"]), - (42, G["then"]): ("REDUCE", G["term -> term * factor"]), - (42, G["="]): ("REDUCE", G["term -> term * factor"]), - (42, G["else"]): ("REDUCE", G["term -> term * factor"]), - (42, G["error"]): ("REDUCE", G["term -> term * factor"]), - (42, G[","]): ("REDUCE", G["term -> term * factor"]), - (42, G["fi"]): ("REDUCE", G["term -> term * factor"]), - (43, G[";"]): ("REDUCE", G["factor -> atom"]), - (43, G["loop"]): ("REDUCE", G["factor -> atom"]), - (43, G["pool"]): ("REDUCE", G["factor -> atom"]), - (43, G["+"]): ("REDUCE", G["factor -> atom"]), - (43, G["-"]): ("REDUCE", G["factor -> atom"]), - (43, G["in"]): ("REDUCE", G["factor -> atom"]), - (43, G["*"]): ("REDUCE", G["factor -> atom"]), - (43, G["}"]): ("REDUCE", G["factor -> atom"]), - (43, G["/"]): ("REDUCE", G["factor -> atom"]), - (43, G["of"]): ("REDUCE", G["factor -> atom"]), - (43, G["<"]): ("REDUCE", G["factor -> atom"]), - (43, G[")"]): ("REDUCE", G["factor -> atom"]), - (43, G["<="]): ("REDUCE", G["factor -> atom"]), - (43, G["then"]): ("REDUCE", G["factor -> atom"]), - (43, G["="]): ("REDUCE", G["factor -> atom"]), - (43, G["else"]): ("REDUCE", G["factor -> atom"]), - (43, G["error"]): ("REDUCE", G["factor -> atom"]), - (43, G[","]): ("REDUCE", G["factor -> atom"]), - (43, G["fi"]): ("REDUCE", G["factor -> atom"]), - (43, G["."]): ("SHIFT", 44), - (43, G["@"]): ("SHIFT", 56), - (44, G["id"]): ("SHIFT", 45), - (45, G["("]): ("SHIFT", 46), - (46, G["isvoid"]): ("SHIFT", 24), - (46, G["int"]): ("SHIFT", 34), - (46, G["false"]): ("SHIFT", 26), - (46, G["let"]): ("SHIFT", 14), - (46, G["case"]): ("SHIFT", 21), - (46, G["id"]): ("SHIFT", 31), - (46, G["string"]): ("SHIFT", 33), - (46, G["while"]): ("SHIFT", 13), - (46, G["not"]): ("SHIFT", 30), - (46, G["true"]): ("SHIFT", 25), - (46, G["new"]): ("SHIFT", 22), - (46, G["("]): ("SHIFT", 11), - (46, G["if"]): ("SHIFT", 12), - (46, G["~"]): ("SHIFT", 27), - (46, G["{"]): ("SHIFT", 10), + (29, G["case"]): ("SHIFT", 21), + (29, G["new"]): ("SHIFT", 22), + (29, G["("]): ("SHIFT", 11), + (29, G["true"]): ("SHIFT", 25), + (29, G["isvoid"]): ("SHIFT", 24), + (29, G["false"]): ("SHIFT", 26), + (29, G["string"]): ("SHIFT", 34), + (29, G["let"]): ("SHIFT", 14), + (30, G["<"]): ("REDUCE", G["function-call -> id ( )"]), + (30, G[")"]): ("REDUCE", G["function-call -> id ( )"]), + (30, G["then"]): ("REDUCE", G["function-call -> id ( )"]), + (30, G["<="]): ("REDUCE", G["function-call -> id ( )"]), + (30, G["."]): ("REDUCE", G["function-call -> id ( )"]), + (30, G["else"]): ("REDUCE", G["function-call -> id ( )"]), + (30, G["="]): ("REDUCE", G["function-call -> id ( )"]), + (30, G[","]): ("REDUCE", G["function-call -> id ( )"]), + (30, G["/"]): ("REDUCE", G["function-call -> id ( )"]), + (30, G["fi"]): ("REDUCE", G["function-call -> id ( )"]), + (30, G[";"]): ("REDUCE", G["function-call -> id ( )"]), + (30, G["loop"]): ("REDUCE", G["function-call -> id ( )"]), + (30, G["@"]): ("REDUCE", G["function-call -> id ( )"]), + (30, G["pool"]): ("REDUCE", G["function-call -> id ( )"]), + (30, G["+"]): ("REDUCE", G["function-call -> id ( )"]), + (30, G["-"]): ("REDUCE", G["function-call -> id ( )"]), + (30, G["error"]): ("REDUCE", G["function-call -> id ( )"]), + (30, G["in"]): ("REDUCE", G["function-call -> id ( )"]), + (30, G["*"]): ("REDUCE", G["function-call -> id ( )"]), + (30, G["}"]): ("REDUCE", G["function-call -> id ( )"]), + (30, G["of"]): ("REDUCE", G["function-call -> id ( )"]), + (31, G["true"]): ("SHIFT", 25), + (31, G["if"]): ("SHIFT", 12), + (31, G["false"]): ("SHIFT", 26), + (31, G["{"]): ("SHIFT", 10), + (31, G["string"]): ("SHIFT", 34), + (31, G["id"]): ("SHIFT", 32), + (31, G["case"]): ("SHIFT", 21), + (31, G["isvoid"]): ("SHIFT", 24), + (31, G["int"]): ("SHIFT", 35), + (31, G["new"]): ("SHIFT", 22), + (31, G["~"]): ("SHIFT", 27), + (31, G["("]): ("SHIFT", 11), + (31, G["let"]): ("SHIFT", 14), + (31, G["while"]): ("SHIFT", 13), + (31, G["not"]): ("SHIFT", 31), + (32, G["("]): ("SHIFT", 29), + (32, G["<"]): ("REDUCE", G["atom -> id"]), + (32, G[")"]): ("REDUCE", G["atom -> id"]), + (32, G["then"]): ("REDUCE", G["atom -> id"]), + (32, G["<="]): ("REDUCE", G["atom -> id"]), + (32, G["."]): ("REDUCE", G["atom -> id"]), + (32, G["else"]): ("REDUCE", G["atom -> id"]), + (32, G["="]): ("REDUCE", G["atom -> id"]), + (32, G[","]): ("REDUCE", G["atom -> id"]), + (32, G["/"]): ("REDUCE", G["atom -> id"]), + (32, G["fi"]): ("REDUCE", G["atom -> id"]), + (32, G[";"]): ("REDUCE", G["atom -> id"]), + (32, G["loop"]): ("REDUCE", G["atom -> id"]), + (32, G["@"]): ("REDUCE", G["atom -> id"]), + (32, G["pool"]): ("REDUCE", G["atom -> id"]), + (32, G["+"]): ("REDUCE", G["atom -> id"]), + (32, G["-"]): ("REDUCE", G["atom -> id"]), + (32, G["error"]): ("REDUCE", G["atom -> id"]), + (32, G["in"]): ("REDUCE", G["atom -> id"]), + (32, G["*"]): ("REDUCE", G["atom -> id"]), + (32, G["}"]): ("REDUCE", G["atom -> id"]), + (32, G["of"]): ("REDUCE", G["atom -> id"]), + (32, G["<-"]): ("SHIFT", 33), + (33, G["true"]): ("SHIFT", 25), + (33, G["if"]): ("SHIFT", 12), + (33, G["false"]): ("SHIFT", 26), + (33, G["{"]): ("SHIFT", 10), + (33, G["string"]): ("SHIFT", 34), + (33, G["id"]): ("SHIFT", 32), + (33, G["case"]): ("SHIFT", 21), + (33, G["isvoid"]): ("SHIFT", 24), + (33, G["int"]): ("SHIFT", 35), + (33, G["new"]): ("SHIFT", 22), + (33, G["~"]): ("SHIFT", 27), + (33, G["("]): ("SHIFT", 11), + (33, G["let"]): ("SHIFT", 14), + (33, G["while"]): ("SHIFT", 13), + (33, G["not"]): ("SHIFT", 31), + (34, G["<"]): ("REDUCE", G["atom -> string"]), + (34, G[")"]): ("REDUCE", G["atom -> string"]), + (34, G["then"]): ("REDUCE", G["atom -> string"]), + (34, G["<="]): ("REDUCE", G["atom -> string"]), + (34, G["."]): ("REDUCE", G["atom -> string"]), + (34, G["else"]): ("REDUCE", G["atom -> string"]), + (34, G["="]): ("REDUCE", G["atom -> string"]), + (34, G[","]): ("REDUCE", G["atom -> string"]), + (34, G["/"]): ("REDUCE", G["atom -> string"]), + (34, G["fi"]): ("REDUCE", G["atom -> string"]), + (34, G[";"]): ("REDUCE", G["atom -> string"]), + (34, G["loop"]): ("REDUCE", G["atom -> string"]), + (34, G["@"]): ("REDUCE", G["atom -> string"]), + (34, G["pool"]): ("REDUCE", G["atom -> string"]), + (34, G["+"]): ("REDUCE", G["atom -> string"]), + (34, G["-"]): ("REDUCE", G["atom -> string"]), + (34, G["error"]): ("REDUCE", G["atom -> string"]), + (34, G["in"]): ("REDUCE", G["atom -> string"]), + (34, G["*"]): ("REDUCE", G["atom -> string"]), + (34, G["}"]): ("REDUCE", G["atom -> string"]), + (34, G["of"]): ("REDUCE", G["atom -> string"]), + (35, G["<"]): ("REDUCE", G["atom -> int"]), + (35, G[")"]): ("REDUCE", G["atom -> int"]), + (35, G["then"]): ("REDUCE", G["atom -> int"]), + (35, G["<="]): ("REDUCE", G["atom -> int"]), + (35, G["."]): ("REDUCE", G["atom -> int"]), + (35, G["else"]): ("REDUCE", G["atom -> int"]), + (35, G["="]): ("REDUCE", G["atom -> int"]), + (35, G[","]): ("REDUCE", G["atom -> int"]), + (35, G["/"]): ("REDUCE", G["atom -> int"]), + (35, G["fi"]): ("REDUCE", G["atom -> int"]), + (35, G[";"]): ("REDUCE", G["atom -> int"]), + (35, G["loop"]): ("REDUCE", G["atom -> int"]), + (35, G["@"]): ("REDUCE", G["atom -> int"]), + (35, G["pool"]): ("REDUCE", G["atom -> int"]), + (35, G["+"]): ("REDUCE", G["atom -> int"]), + (35, G["-"]): ("REDUCE", G["atom -> int"]), + (35, G["error"]): ("REDUCE", G["atom -> int"]), + (35, G["in"]): ("REDUCE", G["atom -> int"]), + (35, G["*"]): ("REDUCE", G["atom -> int"]), + (35, G["}"]): ("REDUCE", G["atom -> int"]), + (35, G["of"]): ("REDUCE", G["atom -> int"]), + (36, G["<"]): ("REDUCE", G["atom -> function-call"]), + (36, G[")"]): ("REDUCE", G["atom -> function-call"]), + (36, G["then"]): ("REDUCE", G["atom -> function-call"]), + (36, G["<="]): ("REDUCE", G["atom -> function-call"]), + (36, G["."]): ("REDUCE", G["atom -> function-call"]), + (36, G["else"]): ("REDUCE", G["atom -> function-call"]), + (36, G["="]): ("REDUCE", G["atom -> function-call"]), + (36, G[","]): ("REDUCE", G["atom -> function-call"]), + (36, G["/"]): ("REDUCE", G["atom -> function-call"]), + (36, G["fi"]): ("REDUCE", G["atom -> function-call"]), + (36, G[";"]): ("REDUCE", G["atom -> function-call"]), + (36, G["loop"]): ("REDUCE", G["atom -> function-call"]), + (36, G["@"]): ("REDUCE", G["atom -> function-call"]), + (36, G["pool"]): ("REDUCE", G["atom -> function-call"]), + (36, G["+"]): ("REDUCE", G["atom -> function-call"]), + (36, G["-"]): ("REDUCE", G["atom -> function-call"]), + (36, G["error"]): ("REDUCE", G["atom -> function-call"]), + (36, G["in"]): ("REDUCE", G["atom -> function-call"]), + (36, G["*"]): ("REDUCE", G["atom -> function-call"]), + (36, G["}"]): ("REDUCE", G["atom -> function-call"]), + (36, G["of"]): ("REDUCE", G["atom -> function-call"]), + (37, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), + (37, G["of"]): ("REDUCE", G["expr -> id <- expr"]), + (37, G[")"]): ("REDUCE", G["expr -> id <- expr"]), + (37, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), + (37, G["then"]): ("REDUCE", G["expr -> id <- expr"]), + (37, G["else"]): ("REDUCE", G["expr -> id <- expr"]), + (37, G["error"]): ("REDUCE", G["expr -> id <- expr"]), + (37, G[","]): ("REDUCE", G["expr -> id <- expr"]), + (37, G["in"]): ("REDUCE", G["expr -> id <- expr"]), + (37, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), + (37, G["}"]): ("REDUCE", G["expr -> id <- expr"]), + (37, G[";"]): ("REDUCE", G["expr -> id <- expr"]), + (38, G["loop"]): ("REDUCE", G["expr -> comp"]), + (38, G["of"]): ("REDUCE", G["expr -> comp"]), + (38, G[")"]): ("REDUCE", G["expr -> comp"]), + (38, G["pool"]): ("REDUCE", G["expr -> comp"]), + (38, G["then"]): ("REDUCE", G["expr -> comp"]), + (38, G["else"]): ("REDUCE", G["expr -> comp"]), + (38, G["error"]): ("REDUCE", G["expr -> comp"]), + (38, G[","]): ("REDUCE", G["expr -> comp"]), + (38, G["in"]): ("REDUCE", G["expr -> comp"]), + (38, G["fi"]): ("REDUCE", G["expr -> comp"]), + (38, G["}"]): ("REDUCE", G["expr -> comp"]), + (38, G[";"]): ("REDUCE", G["expr -> comp"]), + (39, G["+"]): ("SHIFT", 40), + (39, G["-"]): ("SHIFT", 66), + (39, G["loop"]): ("REDUCE", G["comp -> arith"]), + (39, G["of"]): ("REDUCE", G["comp -> arith"]), + (39, G[")"]): ("REDUCE", G["comp -> arith"]), + (39, G["pool"]): ("REDUCE", G["comp -> arith"]), + (39, G["then"]): ("REDUCE", G["comp -> arith"]), + (39, G["else"]): ("REDUCE", G["comp -> arith"]), + (39, G["error"]): ("REDUCE", G["comp -> arith"]), + (39, G[","]): ("REDUCE", G["comp -> arith"]), + (39, G["in"]): ("REDUCE", G["comp -> arith"]), + (39, G["fi"]): ("REDUCE", G["comp -> arith"]), + (39, G["}"]): ("REDUCE", G["comp -> arith"]), + (39, G[";"]): ("REDUCE", G["comp -> arith"]), + (39, G["="]): ("SHIFT", 72), + (39, G["<"]): ("SHIFT", 68), + (39, G["<="]): ("SHIFT", 70), + (40, G["true"]): ("SHIFT", 25), + (40, G["new"]): ("SHIFT", 22), + (40, G["false"]): ("SHIFT", 26), + (40, G["~"]): ("SHIFT", 27), + (40, G["string"]): ("SHIFT", 34), + (40, G["id"]): ("SHIFT", 28), + (40, G["("]): ("SHIFT", 11), + (40, G["isvoid"]): ("SHIFT", 24), + (40, G["int"]): ("SHIFT", 35), + (41, G["/"]): ("SHIFT", 55), + (41, G["*"]): ("SHIFT", 42), + (41, G["<"]): ("REDUCE", G["arith -> arith + term"]), + (41, G[")"]): ("REDUCE", G["arith -> arith + term"]), + (41, G["then"]): ("REDUCE", G["arith -> arith + term"]), + (41, G["<="]): ("REDUCE", G["arith -> arith + term"]), + (41, G["else"]): ("REDUCE", G["arith -> arith + term"]), + (41, G["="]): ("REDUCE", G["arith -> arith + term"]), + (41, G[","]): ("REDUCE", G["arith -> arith + term"]), + (41, G["fi"]): ("REDUCE", G["arith -> arith + term"]), + (41, G[";"]): ("REDUCE", G["arith -> arith + term"]), + (41, G["loop"]): ("REDUCE", G["arith -> arith + term"]), + (41, G["pool"]): ("REDUCE", G["arith -> arith + term"]), + (41, G["+"]): ("REDUCE", G["arith -> arith + term"]), + (41, G["-"]): ("REDUCE", G["arith -> arith + term"]), + (41, G["error"]): ("REDUCE", G["arith -> arith + term"]), + (41, G["in"]): ("REDUCE", G["arith -> arith + term"]), + (41, G["}"]): ("REDUCE", G["arith -> arith + term"]), + (41, G["of"]): ("REDUCE", G["arith -> arith + term"]), + (42, G["true"]): ("SHIFT", 25), + (42, G["new"]): ("SHIFT", 22), + (42, G["false"]): ("SHIFT", 26), + (42, G["~"]): ("SHIFT", 27), + (42, G["string"]): ("SHIFT", 34), + (42, G["id"]): ("SHIFT", 28), + (42, G["("]): ("SHIFT", 11), + (42, G["isvoid"]): ("SHIFT", 24), + (42, G["int"]): ("SHIFT", 35), + (43, G["<"]): ("REDUCE", G["term -> term * factor"]), + (43, G[")"]): ("REDUCE", G["term -> term * factor"]), + (43, G["then"]): ("REDUCE", G["term -> term * factor"]), + (43, G["<="]): ("REDUCE", G["term -> term * factor"]), + (43, G["else"]): ("REDUCE", G["term -> term * factor"]), + (43, G["="]): ("REDUCE", G["term -> term * factor"]), + (43, G[","]): ("REDUCE", G["term -> term * factor"]), + (43, G["/"]): ("REDUCE", G["term -> term * factor"]), + (43, G["fi"]): ("REDUCE", G["term -> term * factor"]), + (43, G[";"]): ("REDUCE", G["term -> term * factor"]), + (43, G["loop"]): ("REDUCE", G["term -> term * factor"]), + (43, G["pool"]): ("REDUCE", G["term -> term * factor"]), + (43, G["+"]): ("REDUCE", G["term -> term * factor"]), + (43, G["-"]): ("REDUCE", G["term -> term * factor"]), + (43, G["error"]): ("REDUCE", G["term -> term * factor"]), + (43, G["in"]): ("REDUCE", G["term -> term * factor"]), + (43, G["*"]): ("REDUCE", G["term -> term * factor"]), + (43, G["}"]): ("REDUCE", G["term -> term * factor"]), + (43, G["of"]): ("REDUCE", G["term -> term * factor"]), + (44, G["."]): ("SHIFT", 45), + (44, G["@"]): ("SHIFT", 58), + (44, G["<"]): ("REDUCE", G["factor -> atom"]), + (44, G[")"]): ("REDUCE", G["factor -> atom"]), + (44, G["then"]): ("REDUCE", G["factor -> atom"]), + (44, G["<="]): ("REDUCE", G["factor -> atom"]), + (44, G["else"]): ("REDUCE", G["factor -> atom"]), + (44, G["="]): ("REDUCE", G["factor -> atom"]), + (44, G[","]): ("REDUCE", G["factor -> atom"]), + (44, G["/"]): ("REDUCE", G["factor -> atom"]), + (44, G["fi"]): ("REDUCE", G["factor -> atom"]), + (44, G[";"]): ("REDUCE", G["factor -> atom"]), + (44, G["loop"]): ("REDUCE", G["factor -> atom"]), + (44, G["pool"]): ("REDUCE", G["factor -> atom"]), + (44, G["+"]): ("REDUCE", G["factor -> atom"]), + (44, G["-"]): ("REDUCE", G["factor -> atom"]), + (44, G["error"]): ("REDUCE", G["factor -> atom"]), + (44, G["in"]): ("REDUCE", G["factor -> atom"]), + (44, G["*"]): ("REDUCE", G["factor -> atom"]), + (44, G["}"]): ("REDUCE", G["factor -> atom"]), + (44, G["of"]): ("REDUCE", G["factor -> atom"]), + (45, G["id"]): ("SHIFT", 46), + (46, G["("]): ("SHIFT", 47), + (47, G["id"]): ("SHIFT", 32), + (47, G["while"]): ("SHIFT", 13), (47, G[")"]): ("SHIFT", 48), - (48, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (49, G[","]): ("SHIFT", 50), - (49, G[")"]): ("REDUCE", G["expr-list -> expr"]), - (50, G["isvoid"]): ("SHIFT", 24), - (50, G["int"]): ("SHIFT", 34), - (50, G["false"]): ("SHIFT", 26), - (50, G["let"]): ("SHIFT", 14), - (50, G["case"]): ("SHIFT", 21), - (50, G["id"]): ("SHIFT", 31), - (50, G["string"]): ("SHIFT", 33), - (50, G["while"]): ("SHIFT", 13), - (50, G["not"]): ("SHIFT", 30), - (50, G["true"]): ("SHIFT", 25), - (50, G["new"]): ("SHIFT", 22), - (50, G["("]): ("SHIFT", 11), - (50, G["if"]): ("SHIFT", 12), - (50, G["~"]): ("SHIFT", 27), - (50, G["{"]): ("SHIFT", 10), - (51, G[")"]): ("REDUCE", G["expr-list -> expr , expr-list"]), - (52, G[";"]): ("REDUCE", G["arith -> term"]), - (52, G["loop"]): ("REDUCE", G["arith -> term"]), - (52, G["pool"]): ("REDUCE", G["arith -> term"]), - (52, G["+"]): ("REDUCE", G["arith -> term"]), - (52, G["-"]): ("REDUCE", G["arith -> term"]), - (52, G["in"]): ("REDUCE", G["arith -> term"]), - (52, G["}"]): ("REDUCE", G["arith -> term"]), - (52, G["of"]): ("REDUCE", G["arith -> term"]), - (52, G["<"]): ("REDUCE", G["arith -> term"]), - (52, G["<="]): ("REDUCE", G["arith -> term"]), - (52, G[")"]): ("REDUCE", G["arith -> term"]), - (52, G["then"]): ("REDUCE", G["arith -> term"]), - (52, G["="]): ("REDUCE", G["arith -> term"]), - (52, G["else"]): ("REDUCE", G["arith -> term"]), - (52, G["error"]): ("REDUCE", G["arith -> term"]), - (52, G[","]): ("REDUCE", G["arith -> term"]), - (52, G["fi"]): ("REDUCE", G["arith -> term"]), - (52, G["/"]): ("SHIFT", 53), - (52, G["*"]): ("SHIFT", 41), - (53, G["false"]): ("SHIFT", 26), - (53, G["true"]): ("SHIFT", 25), - (53, G["id"]): ("SHIFT", 28), - (53, G["string"]): ("SHIFT", 33), - (53, G["int"]): ("SHIFT", 34), - (53, G["isvoid"]): ("SHIFT", 24), - (53, G["new"]): ("SHIFT", 22), - (53, G["("]): ("SHIFT", 11), - (53, G["~"]): ("SHIFT", 27), - (54, G[";"]): ("REDUCE", G["term -> term / factor"]), - (54, G["loop"]): ("REDUCE", G["term -> term / factor"]), - (54, G["pool"]): ("REDUCE", G["term -> term / factor"]), - (54, G["+"]): ("REDUCE", G["term -> term / factor"]), - (54, G["-"]): ("REDUCE", G["term -> term / factor"]), - (54, G["in"]): ("REDUCE", G["term -> term / factor"]), - (54, G["*"]): ("REDUCE", G["term -> term / factor"]), - (54, G["}"]): ("REDUCE", G["term -> term / factor"]), - (54, G["/"]): ("REDUCE", G["term -> term / factor"]), - (54, G["of"]): ("REDUCE", G["term -> term / factor"]), - (54, G["<"]): ("REDUCE", G["term -> term / factor"]), - (54, G[")"]): ("REDUCE", G["term -> term / factor"]), - (54, G["<="]): ("REDUCE", G["term -> term / factor"]), - (54, G["then"]): ("REDUCE", G["term -> term / factor"]), - (54, G["="]): ("REDUCE", G["term -> term / factor"]), - (54, G["else"]): ("REDUCE", G["term -> term / factor"]), - (54, G["error"]): ("REDUCE", G["term -> term / factor"]), - (54, G[","]): ("REDUCE", G["term -> term / factor"]), - (54, G["fi"]): ("REDUCE", G["term -> term / factor"]), - (55, G[";"]): ("REDUCE", G["term -> factor"]), - (55, G["loop"]): ("REDUCE", G["term -> factor"]), - (55, G["pool"]): ("REDUCE", G["term -> factor"]), - (55, G["+"]): ("REDUCE", G["term -> factor"]), - (55, G["-"]): ("REDUCE", G["term -> factor"]), - (55, G["in"]): ("REDUCE", G["term -> factor"]), - (55, G["*"]): ("REDUCE", G["term -> factor"]), - (55, G["}"]): ("REDUCE", G["term -> factor"]), - (55, G["/"]): ("REDUCE", G["term -> factor"]), - (55, G["of"]): ("REDUCE", G["term -> factor"]), - (55, G["<"]): ("REDUCE", G["term -> factor"]), - (55, G[")"]): ("REDUCE", G["term -> factor"]), - (55, G["<="]): ("REDUCE", G["term -> factor"]), - (55, G["then"]): ("REDUCE", G["term -> factor"]), - (55, G["="]): ("REDUCE", G["term -> factor"]), - (55, G["else"]): ("REDUCE", G["term -> factor"]), - (55, G["error"]): ("REDUCE", G["term -> factor"]), - (55, G[","]): ("REDUCE", G["term -> factor"]), - (55, G["fi"]): ("REDUCE", G["term -> factor"]), - (56, G["type"]): ("SHIFT", 57), - (57, G["."]): ("SHIFT", 58), - (58, G["id"]): ("SHIFT", 59), - (59, G["("]): ("SHIFT", 60), - (60, G["isvoid"]): ("SHIFT", 24), - (60, G["int"]): ("SHIFT", 34), - (60, G["false"]): ("SHIFT", 26), - (60, G["let"]): ("SHIFT", 14), - (60, G["case"]): ("SHIFT", 21), - (60, G["id"]): ("SHIFT", 31), - (60, G["string"]): ("SHIFT", 33), - (60, G["while"]): ("SHIFT", 13), - (60, G["not"]): ("SHIFT", 30), - (60, G["true"]): ("SHIFT", 25), - (60, G["new"]): ("SHIFT", 22), - (60, G["("]): ("SHIFT", 11), - (60, G["if"]): ("SHIFT", 12), - (60, G["~"]): ("SHIFT", 27), - (60, G["{"]): ("SHIFT", 10), - (61, G[")"]): ("SHIFT", 62), - (62, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (62, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (62, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (62, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (62, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (62, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (62, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (62, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (62, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (62, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (62, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (62, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (62, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (62, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (62, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (62, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (62, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (62, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (62, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (62, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (62, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["false"]): ("SHIFT", 26), - (63, G["id"]): ("SHIFT", 28), - (63, G["string"]): ("SHIFT", 33), - (63, G["true"]): ("SHIFT", 25), - (63, G["int"]): ("SHIFT", 34), - (63, G["isvoid"]): ("SHIFT", 24), - (63, G["new"]): ("SHIFT", 22), - (63, G["("]): ("SHIFT", 11), - (63, G["~"]): ("SHIFT", 27), - (64, G[";"]): ("REDUCE", G["arith -> arith - term"]), - (64, G["loop"]): ("REDUCE", G["arith -> arith - term"]), - (64, G["pool"]): ("REDUCE", G["arith -> arith - term"]), - (64, G["+"]): ("REDUCE", G["arith -> arith - term"]), - (64, G["-"]): ("REDUCE", G["arith -> arith - term"]), - (64, G["in"]): ("REDUCE", G["arith -> arith - term"]), - (64, G["}"]): ("REDUCE", G["arith -> arith - term"]), - (64, G["of"]): ("REDUCE", G["arith -> arith - term"]), - (64, G["<"]): ("REDUCE", G["arith -> arith - term"]), - (64, G["<="]): ("REDUCE", G["arith -> arith - term"]), - (64, G[")"]): ("REDUCE", G["arith -> arith - term"]), - (64, G["then"]): ("REDUCE", G["arith -> arith - term"]), - (64, G["="]): ("REDUCE", G["arith -> arith - term"]), - (64, G["else"]): ("REDUCE", G["arith -> arith - term"]), - (64, G["error"]): ("REDUCE", G["arith -> arith - term"]), - (64, G[","]): ("REDUCE", G["arith -> arith - term"]), - (64, G["fi"]): ("REDUCE", G["arith -> arith - term"]), - (64, G["/"]): ("SHIFT", 53), - (64, G["*"]): ("SHIFT", 41), - (65, G["~"]): ("SHIFT", 27), - (65, G["false"]): ("SHIFT", 26), - (65, G["id"]): ("SHIFT", 28), - (65, G["string"]): ("SHIFT", 33), - (65, G["true"]): ("SHIFT", 25), - (65, G["new"]): ("SHIFT", 22), - (65, G["isvoid"]): ("SHIFT", 24), - (65, G["int"]): ("SHIFT", 34), - (65, G["("]): ("SHIFT", 11), - (66, G["+"]): ("SHIFT", 39), - (66, G["-"]): ("SHIFT", 63), - (66, G[";"]): ("REDUCE", G["comp -> arith < arith"]), - (66, G["of"]): ("REDUCE", G["comp -> arith < arith"]), - (66, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), - (66, G[")"]): ("REDUCE", G["comp -> arith < arith"]), - (66, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), - (66, G["then"]): ("REDUCE", G["comp -> arith < arith"]), - (66, G["else"]): ("REDUCE", G["comp -> arith < arith"]), - (66, G["error"]): ("REDUCE", G["comp -> arith < arith"]), - (66, G[","]): ("REDUCE", G["comp -> arith < arith"]), - (66, G["in"]): ("REDUCE", G["comp -> arith < arith"]), - (66, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), - (66, G["}"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["~"]): ("SHIFT", 27), - (67, G["false"]): ("SHIFT", 26), - (67, G["id"]): ("SHIFT", 28), - (67, G["string"]): ("SHIFT", 33), - (67, G["true"]): ("SHIFT", 25), - (67, G["new"]): ("SHIFT", 22), - (67, G["isvoid"]): ("SHIFT", 24), - (67, G["int"]): ("SHIFT", 34), - (67, G["("]): ("SHIFT", 11), - (68, G["+"]): ("SHIFT", 39), - (68, G["-"]): ("SHIFT", 63), - (68, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), - (68, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), - (68, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), - (68, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), - (68, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), - (68, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), - (68, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), - (68, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), - (68, G[","]): ("REDUCE", G["comp -> arith <= arith"]), - (68, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), - (68, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), - (68, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["~"]): ("SHIFT", 27), - (69, G["false"]): ("SHIFT", 26), - (69, G["id"]): ("SHIFT", 28), - (69, G["string"]): ("SHIFT", 33), - (69, G["true"]): ("SHIFT", 25), - (69, G["new"]): ("SHIFT", 22), - (69, G["isvoid"]): ("SHIFT", 24), - (69, G["int"]): ("SHIFT", 34), - (69, G["("]): ("SHIFT", 11), - (70, G["+"]): ("SHIFT", 39), - (70, G[";"]): ("REDUCE", G["comp -> arith = arith"]), - (70, G["of"]): ("REDUCE", G["comp -> arith = arith"]), - (70, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), - (70, G[")"]): ("REDUCE", G["comp -> arith = arith"]), - (70, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), - (70, G["then"]): ("REDUCE", G["comp -> arith = arith"]), - (70, G["else"]): ("REDUCE", G["comp -> arith = arith"]), - (70, G["error"]): ("REDUCE", G["comp -> arith = arith"]), - (70, G[","]): ("REDUCE", G["comp -> arith = arith"]), - (70, G["in"]): ("REDUCE", G["comp -> arith = arith"]), - (70, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), - (70, G["}"]): ("REDUCE", G["comp -> arith = arith"]), - (70, G["-"]): ("SHIFT", 63), - (71, G[";"]): ("REDUCE", G["expr -> not expr"]), - (71, G["of"]): ("REDUCE", G["expr -> not expr"]), - (71, G["loop"]): ("REDUCE", G["expr -> not expr"]), - (71, G[")"]): ("REDUCE", G["expr -> not expr"]), - (71, G["pool"]): ("REDUCE", G["expr -> not expr"]), - (71, G["then"]): ("REDUCE", G["expr -> not expr"]), - (71, G["else"]): ("REDUCE", G["expr -> not expr"]), - (71, G["error"]): ("REDUCE", G["expr -> not expr"]), - (71, G[","]): ("REDUCE", G["expr -> not expr"]), - (71, G["in"]): ("REDUCE", G["expr -> not expr"]), - (71, G["fi"]): ("REDUCE", G["expr -> not expr"]), - (71, G["}"]): ("REDUCE", G["expr -> not expr"]), - (72, G[")"]): ("SHIFT", 73), - (73, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (73, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (73, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (73, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (73, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (73, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (73, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (73, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (73, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (73, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (73, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (73, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (73, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (73, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (73, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (73, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (73, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (73, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (73, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (73, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (73, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G[";"]): ("REDUCE", G["factor -> ~ factor"]), - (74, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), - (74, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), - (74, G["+"]): ("REDUCE", G["factor -> ~ factor"]), - (74, G["-"]): ("REDUCE", G["factor -> ~ factor"]), - (74, G["in"]): ("REDUCE", G["factor -> ~ factor"]), - (74, G["*"]): ("REDUCE", G["factor -> ~ factor"]), - (74, G["}"]): ("REDUCE", G["factor -> ~ factor"]), - (74, G["/"]): ("REDUCE", G["factor -> ~ factor"]), - (74, G["of"]): ("REDUCE", G["factor -> ~ factor"]), - (74, G["<"]): ("REDUCE", G["factor -> ~ factor"]), - (74, G[")"]): ("REDUCE", G["factor -> ~ factor"]), - (74, G["<="]): ("REDUCE", G["factor -> ~ factor"]), - (74, G["then"]): ("REDUCE", G["factor -> ~ factor"]), - (74, G["="]): ("REDUCE", G["factor -> ~ factor"]), - (74, G["else"]): ("REDUCE", G["factor -> ~ factor"]), - (74, G["error"]): ("REDUCE", G["factor -> ~ factor"]), - (74, G[","]): ("REDUCE", G["factor -> ~ factor"]), - (74, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), - (75, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), - (75, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), - (75, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), - (75, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), - (75, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), - (75, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), - (75, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), - (75, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), - (75, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), - (75, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), - (75, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), - (75, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), - (75, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), - (75, G["="]): ("REDUCE", G["factor -> isvoid factor"]), - (75, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), - (75, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), - (75, G[","]): ("REDUCE", G["factor -> isvoid factor"]), - (75, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["of"]): ("SHIFT", 77), - (77, G["id"]): ("SHIFT", 78), - (78, G[":"]): ("SHIFT", 79), - (79, G["type"]): ("SHIFT", 80), - (80, G["=>"]): ("SHIFT", 81), - (81, G["new"]): ("SHIFT", 22), - (81, G["("]): ("SHIFT", 11), - (81, G["~"]): ("SHIFT", 27), - (81, G["case"]): ("SHIFT", 21), - (81, G["let"]): ("SHIFT", 14), - (81, G["while"]): ("SHIFT", 13), - (81, G["not"]): ("SHIFT", 30), - (81, G["if"]): ("SHIFT", 12), - (81, G["int"]): ("SHIFT", 34), - (81, G["isvoid"]): ("SHIFT", 24), - (81, G["{"]): ("SHIFT", 10), - (81, G["id"]): ("SHIFT", 31), - (81, G["false"]): ("SHIFT", 26), - (81, G["string"]): ("SHIFT", 33), - (81, G["true"]): ("SHIFT", 25), - (82, G[";"]): ("SHIFT", 83), - (83, G["id"]): ("SHIFT", 78), - (83, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), - (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), - (85, G["esac"]): ("SHIFT", 86), - (86, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (86, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (86, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (86, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (86, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (86, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (86, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (86, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (86, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (86, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (86, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (86, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (87, G[","]): ("SHIFT", 88), - (87, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), - (88, G["id"]): ("SHIFT", 15), - (89, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), - (90, G["in"]): ("SHIFT", 91), - (91, G["int"]): ("SHIFT", 34), - (91, G["isvoid"]): ("SHIFT", 24), - (91, G["case"]): ("SHIFT", 21), - (91, G["let"]): ("SHIFT", 14), - (91, G["false"]): ("SHIFT", 26), - (91, G["while"]): ("SHIFT", 13), - (91, G["id"]): ("SHIFT", 31), - (91, G["string"]): ("SHIFT", 33), - (91, G["not"]): ("SHIFT", 30), - (91, G["true"]): ("SHIFT", 25), - (91, G["new"]): ("SHIFT", 22), - (91, G["("]): ("SHIFT", 11), - (91, G["if"]): ("SHIFT", 12), - (91, G["{"]): ("SHIFT", 10), - (91, G["~"]): ("SHIFT", 27), - (92, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (92, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (92, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (92, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (92, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (92, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (92, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (92, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (92, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (92, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (92, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (92, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (93, G["loop"]): ("SHIFT", 94), - (94, G["not"]): ("SHIFT", 30), - (94, G["int"]): ("SHIFT", 34), - (94, G["false"]): ("SHIFT", 26), - (94, G["id"]): ("SHIFT", 31), - (94, G["string"]): ("SHIFT", 33), - (94, G["{"]): ("SHIFT", 10), - (94, G["if"]): ("SHIFT", 12), - (94, G["true"]): ("SHIFT", 25), - (94, G["~"]): ("SHIFT", 27), - (94, G["new"]): ("SHIFT", 22), - (94, G["("]): ("SHIFT", 11), - (94, G["let"]): ("SHIFT", 14), - (94, G["case"]): ("SHIFT", 21), - (94, G["isvoid"]): ("SHIFT", 24), - (94, G["while"]): ("SHIFT", 13), - (95, G["pool"]): ("SHIFT", 96), - (96, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (96, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (96, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (96, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (96, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (96, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (96, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (96, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (96, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (96, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (96, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (96, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (97, G["then"]): ("SHIFT", 98), + (47, G["not"]): ("SHIFT", 31), + (47, G["if"]): ("SHIFT", 12), + (47, G["~"]): ("SHIFT", 27), + (47, G["int"]): ("SHIFT", 35), + (47, G["{"]): ("SHIFT", 10), + (47, G["case"]): ("SHIFT", 21), + (47, G["new"]): ("SHIFT", 22), + (47, G["("]): ("SHIFT", 11), + (47, G["true"]): ("SHIFT", 25), + (47, G["isvoid"]): ("SHIFT", 24), + (47, G["false"]): ("SHIFT", 26), + (47, G["string"]): ("SHIFT", 34), + (47, G["let"]): ("SHIFT", 14), + (48, G["<"]): ("REDUCE", G["function-call -> atom . id ( )"]), + (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( )"]), + (48, G["then"]): ("REDUCE", G["function-call -> atom . id ( )"]), + (48, G["<="]): ("REDUCE", G["function-call -> atom . id ( )"]), + (48, G["."]): ("REDUCE", G["function-call -> atom . id ( )"]), + (48, G["else"]): ("REDUCE", G["function-call -> atom . id ( )"]), + (48, G["="]): ("REDUCE", G["function-call -> atom . id ( )"]), + (48, G[","]): ("REDUCE", G["function-call -> atom . id ( )"]), + (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( )"]), + (48, G["fi"]): ("REDUCE", G["function-call -> atom . id ( )"]), + (48, G[";"]): ("REDUCE", G["function-call -> atom . id ( )"]), + (48, G["loop"]): ("REDUCE", G["function-call -> atom . id ( )"]), + (48, G["@"]): ("REDUCE", G["function-call -> atom . id ( )"]), + (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( )"]), + (48, G["+"]): ("REDUCE", G["function-call -> atom . id ( )"]), + (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( )"]), + (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( )"]), + (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( )"]), + (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( )"]), + (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( )"]), + (48, G["of"]): ("REDUCE", G["function-call -> atom . id ( )"]), + (49, G[")"]): ("SHIFT", 50), + (50, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (50, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (50, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (50, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (50, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (50, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (50, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (50, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (50, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (50, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (50, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (50, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (50, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (50, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (50, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (50, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (50, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (50, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (50, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (50, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (50, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (51, G[","]): ("SHIFT", 52), + (51, G[")"]): ("REDUCE", G["expr-list -> expr"]), + (52, G["id"]): ("SHIFT", 32), + (52, G["while"]): ("SHIFT", 13), + (52, G["not"]): ("SHIFT", 31), + (52, G["if"]): ("SHIFT", 12), + (52, G["~"]): ("SHIFT", 27), + (52, G["int"]): ("SHIFT", 35), + (52, G["{"]): ("SHIFT", 10), + (52, G["case"]): ("SHIFT", 21), + (52, G["new"]): ("SHIFT", 22), + (52, G["("]): ("SHIFT", 11), + (52, G["true"]): ("SHIFT", 25), + (52, G["isvoid"]): ("SHIFT", 24), + (52, G["false"]): ("SHIFT", 26), + (52, G["string"]): ("SHIFT", 34), + (52, G["let"]): ("SHIFT", 14), + (53, G[")"]): ("REDUCE", G["expr-list -> expr , expr-list"]), + (54, G["<"]): ("REDUCE", G["arith -> term"]), + (54, G[")"]): ("REDUCE", G["arith -> term"]), + (54, G["then"]): ("REDUCE", G["arith -> term"]), + (54, G["<="]): ("REDUCE", G["arith -> term"]), + (54, G["else"]): ("REDUCE", G["arith -> term"]), + (54, G["="]): ("REDUCE", G["arith -> term"]), + (54, G[","]): ("REDUCE", G["arith -> term"]), + (54, G["fi"]): ("REDUCE", G["arith -> term"]), + (54, G[";"]): ("REDUCE", G["arith -> term"]), + (54, G["loop"]): ("REDUCE", G["arith -> term"]), + (54, G["pool"]): ("REDUCE", G["arith -> term"]), + (54, G["+"]): ("REDUCE", G["arith -> term"]), + (54, G["-"]): ("REDUCE", G["arith -> term"]), + (54, G["error"]): ("REDUCE", G["arith -> term"]), + (54, G["in"]): ("REDUCE", G["arith -> term"]), + (54, G["}"]): ("REDUCE", G["arith -> term"]), + (54, G["of"]): ("REDUCE", G["arith -> term"]), + (54, G["/"]): ("SHIFT", 55), + (54, G["*"]): ("SHIFT", 42), + (55, G["true"]): ("SHIFT", 25), + (55, G["new"]): ("SHIFT", 22), + (55, G["false"]): ("SHIFT", 26), + (55, G["~"]): ("SHIFT", 27), + (55, G["string"]): ("SHIFT", 34), + (55, G["id"]): ("SHIFT", 28), + (55, G["("]): ("SHIFT", 11), + (55, G["isvoid"]): ("SHIFT", 24), + (55, G["int"]): ("SHIFT", 35), + (56, G["<"]): ("REDUCE", G["term -> term / factor"]), + (56, G[")"]): ("REDUCE", G["term -> term / factor"]), + (56, G["then"]): ("REDUCE", G["term -> term / factor"]), + (56, G["<="]): ("REDUCE", G["term -> term / factor"]), + (56, G["else"]): ("REDUCE", G["term -> term / factor"]), + (56, G["="]): ("REDUCE", G["term -> term / factor"]), + (56, G[","]): ("REDUCE", G["term -> term / factor"]), + (56, G["/"]): ("REDUCE", G["term -> term / factor"]), + (56, G["fi"]): ("REDUCE", G["term -> term / factor"]), + (56, G[";"]): ("REDUCE", G["term -> term / factor"]), + (56, G["loop"]): ("REDUCE", G["term -> term / factor"]), + (56, G["pool"]): ("REDUCE", G["term -> term / factor"]), + (56, G["+"]): ("REDUCE", G["term -> term / factor"]), + (56, G["-"]): ("REDUCE", G["term -> term / factor"]), + (56, G["error"]): ("REDUCE", G["term -> term / factor"]), + (56, G["in"]): ("REDUCE", G["term -> term / factor"]), + (56, G["*"]): ("REDUCE", G["term -> term / factor"]), + (56, G["}"]): ("REDUCE", G["term -> term / factor"]), + (56, G["of"]): ("REDUCE", G["term -> term / factor"]), + (57, G["<"]): ("REDUCE", G["term -> factor"]), + (57, G[")"]): ("REDUCE", G["term -> factor"]), + (57, G["then"]): ("REDUCE", G["term -> factor"]), + (57, G["<="]): ("REDUCE", G["term -> factor"]), + (57, G["else"]): ("REDUCE", G["term -> factor"]), + (57, G["="]): ("REDUCE", G["term -> factor"]), + (57, G[","]): ("REDUCE", G["term -> factor"]), + (57, G["/"]): ("REDUCE", G["term -> factor"]), + (57, G["fi"]): ("REDUCE", G["term -> factor"]), + (57, G[";"]): ("REDUCE", G["term -> factor"]), + (57, G["loop"]): ("REDUCE", G["term -> factor"]), + (57, G["pool"]): ("REDUCE", G["term -> factor"]), + (57, G["+"]): ("REDUCE", G["term -> factor"]), + (57, G["-"]): ("REDUCE", G["term -> factor"]), + (57, G["error"]): ("REDUCE", G["term -> factor"]), + (57, G["in"]): ("REDUCE", G["term -> factor"]), + (57, G["*"]): ("REDUCE", G["term -> factor"]), + (57, G["}"]): ("REDUCE", G["term -> factor"]), + (57, G["of"]): ("REDUCE", G["term -> factor"]), + (58, G["type"]): ("SHIFT", 59), + (59, G["."]): ("SHIFT", 60), + (60, G["id"]): ("SHIFT", 61), + (61, G["("]): ("SHIFT", 62), + (62, G["id"]): ("SHIFT", 32), + (62, G["while"]): ("SHIFT", 13), + (62, G["not"]): ("SHIFT", 31), + (62, G["if"]): ("SHIFT", 12), + (62, G["~"]): ("SHIFT", 27), + (62, G["int"]): ("SHIFT", 35), + (62, G["{"]): ("SHIFT", 10), + (62, G["case"]): ("SHIFT", 21), + (62, G["new"]): ("SHIFT", 22), + (62, G[")"]): ("SHIFT", 63), + (62, G["("]): ("SHIFT", 11), + (62, G["true"]): ("SHIFT", 25), + (62, G["isvoid"]): ("SHIFT", 24), + (62, G["false"]): ("SHIFT", 26), + (62, G["string"]): ("SHIFT", 34), + (62, G["let"]): ("SHIFT", 14), + (63, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), + (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), + (63, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), + (63, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), + (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), + (63, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), + (63, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), + (63, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), + (63, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), + (63, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), + (63, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), + (63, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), + (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), + (63, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), + (63, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), + (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), + (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), + (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), + (63, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), + (63, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), + (63, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), + (64, G[")"]): ("SHIFT", 65), + (65, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (65, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (65, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (65, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (65, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (65, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (65, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (65, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (65, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (65, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (65, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (65, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (65, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (65, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (65, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (65, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (65, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (65, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (65, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (65, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (65, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (66, G["true"]): ("SHIFT", 25), + (66, G["new"]): ("SHIFT", 22), + (66, G["false"]): ("SHIFT", 26), + (66, G["~"]): ("SHIFT", 27), + (66, G["string"]): ("SHIFT", 34), + (66, G["id"]): ("SHIFT", 28), + (66, G["("]): ("SHIFT", 11), + (66, G["isvoid"]): ("SHIFT", 24), + (66, G["int"]): ("SHIFT", 35), + (67, G["/"]): ("SHIFT", 55), + (67, G["*"]): ("SHIFT", 42), + (67, G["<"]): ("REDUCE", G["arith -> arith - term"]), + (67, G[")"]): ("REDUCE", G["arith -> arith - term"]), + (67, G["then"]): ("REDUCE", G["arith -> arith - term"]), + (67, G["<="]): ("REDUCE", G["arith -> arith - term"]), + (67, G["else"]): ("REDUCE", G["arith -> arith - term"]), + (67, G["="]): ("REDUCE", G["arith -> arith - term"]), + (67, G[","]): ("REDUCE", G["arith -> arith - term"]), + (67, G["fi"]): ("REDUCE", G["arith -> arith - term"]), + (67, G[";"]): ("REDUCE", G["arith -> arith - term"]), + (67, G["loop"]): ("REDUCE", G["arith -> arith - term"]), + (67, G["pool"]): ("REDUCE", G["arith -> arith - term"]), + (67, G["+"]): ("REDUCE", G["arith -> arith - term"]), + (67, G["-"]): ("REDUCE", G["arith -> arith - term"]), + (67, G["error"]): ("REDUCE", G["arith -> arith - term"]), + (67, G["in"]): ("REDUCE", G["arith -> arith - term"]), + (67, G["}"]): ("REDUCE", G["arith -> arith - term"]), + (67, G["of"]): ("REDUCE", G["arith -> arith - term"]), + (68, G["isvoid"]): ("SHIFT", 24), + (68, G["id"]): ("SHIFT", 28), + (68, G["("]): ("SHIFT", 11), + (68, G["int"]): ("SHIFT", 35), + (68, G["true"]): ("SHIFT", 25), + (68, G["~"]): ("SHIFT", 27), + (68, G["false"]): ("SHIFT", 26), + (68, G["new"]): ("SHIFT", 22), + (68, G["string"]): ("SHIFT", 34), + (69, G["+"]): ("SHIFT", 40), + (69, G["-"]): ("SHIFT", 66), + (69, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), + (69, G["of"]): ("REDUCE", G["comp -> arith < arith"]), + (69, G[")"]): ("REDUCE", G["comp -> arith < arith"]), + (69, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), + (69, G["then"]): ("REDUCE", G["comp -> arith < arith"]), + (69, G["else"]): ("REDUCE", G["comp -> arith < arith"]), + (69, G["error"]): ("REDUCE", G["comp -> arith < arith"]), + (69, G[","]): ("REDUCE", G["comp -> arith < arith"]), + (69, G["in"]): ("REDUCE", G["comp -> arith < arith"]), + (69, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), + (69, G["}"]): ("REDUCE", G["comp -> arith < arith"]), + (69, G[";"]): ("REDUCE", G["comp -> arith < arith"]), + (70, G["isvoid"]): ("SHIFT", 24), + (70, G["id"]): ("SHIFT", 28), + (70, G["("]): ("SHIFT", 11), + (70, G["int"]): ("SHIFT", 35), + (70, G["true"]): ("SHIFT", 25), + (70, G["~"]): ("SHIFT", 27), + (70, G["false"]): ("SHIFT", 26), + (70, G["new"]): ("SHIFT", 22), + (70, G["string"]): ("SHIFT", 34), + (71, G["+"]): ("SHIFT", 40), + (71, G["-"]): ("SHIFT", 66), + (71, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), + (71, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), + (71, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), + (71, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), + (71, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), + (71, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), + (71, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), + (71, G[","]): ("REDUCE", G["comp -> arith <= arith"]), + (71, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), + (71, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), + (71, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), + (71, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), + (72, G["isvoid"]): ("SHIFT", 24), + (72, G["id"]): ("SHIFT", 28), + (72, G["("]): ("SHIFT", 11), + (72, G["int"]): ("SHIFT", 35), + (72, G["true"]): ("SHIFT", 25), + (72, G["~"]): ("SHIFT", 27), + (72, G["false"]): ("SHIFT", 26), + (72, G["new"]): ("SHIFT", 22), + (72, G["string"]): ("SHIFT", 34), + (73, G["+"]): ("SHIFT", 40), + (73, G["-"]): ("SHIFT", 66), + (73, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), + (73, G["of"]): ("REDUCE", G["comp -> arith = arith"]), + (73, G[")"]): ("REDUCE", G["comp -> arith = arith"]), + (73, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), + (73, G["then"]): ("REDUCE", G["comp -> arith = arith"]), + (73, G["else"]): ("REDUCE", G["comp -> arith = arith"]), + (73, G["error"]): ("REDUCE", G["comp -> arith = arith"]), + (73, G[","]): ("REDUCE", G["comp -> arith = arith"]), + (73, G["in"]): ("REDUCE", G["comp -> arith = arith"]), + (73, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), + (73, G["}"]): ("REDUCE", G["comp -> arith = arith"]), + (73, G[";"]): ("REDUCE", G["comp -> arith = arith"]), + (74, G["loop"]): ("REDUCE", G["expr -> not expr"]), + (74, G[";"]): ("REDUCE", G["expr -> not expr"]), + (74, G[")"]): ("REDUCE", G["expr -> not expr"]), + (74, G["pool"]): ("REDUCE", G["expr -> not expr"]), + (74, G["then"]): ("REDUCE", G["expr -> not expr"]), + (74, G["else"]): ("REDUCE", G["expr -> not expr"]), + (74, G["error"]): ("REDUCE", G["expr -> not expr"]), + (74, G[","]): ("REDUCE", G["expr -> not expr"]), + (74, G["in"]): ("REDUCE", G["expr -> not expr"]), + (74, G["fi"]): ("REDUCE", G["expr -> not expr"]), + (74, G["}"]): ("REDUCE", G["expr -> not expr"]), + (74, G["of"]): ("REDUCE", G["expr -> not expr"]), + (75, G[")"]): ("SHIFT", 76), + (76, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (76, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (76, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (76, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (76, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (76, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (76, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (76, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (76, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (76, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (76, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (76, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (76, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (76, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (76, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (76, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (76, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (76, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (76, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (76, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (76, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (77, G["<"]): ("REDUCE", G["factor -> ~ factor"]), + (77, G[")"]): ("REDUCE", G["factor -> ~ factor"]), + (77, G["then"]): ("REDUCE", G["factor -> ~ factor"]), + (77, G["<="]): ("REDUCE", G["factor -> ~ factor"]), + (77, G["else"]): ("REDUCE", G["factor -> ~ factor"]), + (77, G["="]): ("REDUCE", G["factor -> ~ factor"]), + (77, G[","]): ("REDUCE", G["factor -> ~ factor"]), + (77, G["/"]): ("REDUCE", G["factor -> ~ factor"]), + (77, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), + (77, G[";"]): ("REDUCE", G["factor -> ~ factor"]), + (77, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), + (77, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), + (77, G["+"]): ("REDUCE", G["factor -> ~ factor"]), + (77, G["-"]): ("REDUCE", G["factor -> ~ factor"]), + (77, G["error"]): ("REDUCE", G["factor -> ~ factor"]), + (77, G["in"]): ("REDUCE", G["factor -> ~ factor"]), + (77, G["*"]): ("REDUCE", G["factor -> ~ factor"]), + (77, G["}"]): ("REDUCE", G["factor -> ~ factor"]), + (77, G["of"]): ("REDUCE", G["factor -> ~ factor"]), + (78, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), + (78, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), + (78, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), + (78, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), + (78, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), + (78, G["="]): ("REDUCE", G["factor -> isvoid factor"]), + (78, G[","]): ("REDUCE", G["factor -> isvoid factor"]), + (78, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), + (78, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), + (78, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), + (78, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), + (78, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), + (78, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), + (78, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), + (78, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), + (78, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), + (78, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), + (78, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), + (78, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), + (79, G["of"]): ("SHIFT", 80), + (80, G["id"]): ("SHIFT", 81), + (81, G[":"]): ("SHIFT", 82), + (82, G["type"]): ("SHIFT", 83), + (83, G["=>"]): ("SHIFT", 84), + (84, G["id"]): ("SHIFT", 32), + (84, G["let"]): ("SHIFT", 14), + (84, G["while"]): ("SHIFT", 13), + (84, G["~"]): ("SHIFT", 27), + (84, G["true"]): ("SHIFT", 25), + (84, G["not"]): ("SHIFT", 31), + (84, G["if"]): ("SHIFT", 12), + (84, G["false"]): ("SHIFT", 26), + (84, G["{"]): ("SHIFT", 10), + (84, G["string"]): ("SHIFT", 34), + (84, G["case"]): ("SHIFT", 21), + (84, G["int"]): ("SHIFT", 35), + (84, G["new"]): ("SHIFT", 22), + (84, G["isvoid"]): ("SHIFT", 24), + (84, G["("]): ("SHIFT", 11), + (85, G["error"]): ("SHIFT", 88), + (85, G[";"]): ("SHIFT", 86), + (86, G["id"]): ("SHIFT", 81), + (86, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), + (87, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), + (88, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), + (89, G["esac"]): ("SHIFT", 90), + (90, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (90, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (90, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (90, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (90, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (90, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (90, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (90, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (90, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (90, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (90, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (90, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (91, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), + (91, G[","]): ("SHIFT", 92), + (92, G["id"]): ("SHIFT", 15), + (93, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), + (94, G["in"]): ("SHIFT", 95), + (95, G["true"]): ("SHIFT", 25), + (95, G["if"]): ("SHIFT", 12), + (95, G["false"]): ("SHIFT", 26), + (95, G["{"]): ("SHIFT", 10), + (95, G["string"]): ("SHIFT", 34), + (95, G["id"]): ("SHIFT", 32), + (95, G["case"]): ("SHIFT", 21), + (95, G["isvoid"]): ("SHIFT", 24), + (95, G["int"]): ("SHIFT", 35), + (95, G["new"]): ("SHIFT", 22), + (95, G["~"]): ("SHIFT", 27), + (95, G["("]): ("SHIFT", 11), + (95, G["let"]): ("SHIFT", 14), + (95, G["while"]): ("SHIFT", 13), + (95, G["not"]): ("SHIFT", 31), + (96, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (96, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (96, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (96, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (96, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (96, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (96, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (96, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (96, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (96, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (96, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (96, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (97, G["loop"]): ("SHIFT", 98), + (98, G["string"]): ("SHIFT", 34), + (98, G["id"]): ("SHIFT", 32), (98, G["isvoid"]): ("SHIFT", 24), - (98, G["if"]): ("SHIFT", 12), - (98, G["id"]): ("SHIFT", 31), - (98, G["{"]): ("SHIFT", 10), - (98, G["true"]): ("SHIFT", 25), + (98, G["int"]): ("SHIFT", 35), + (98, G["let"]): ("SHIFT", 14), (98, G["new"]): ("SHIFT", 22), - (98, G["("]): ("SHIFT", 11), + (98, G["while"]): ("SHIFT", 13), (98, G["~"]): ("SHIFT", 27), + (98, G["not"]): ("SHIFT", 31), + (98, G["("]): ("SHIFT", 11), + (98, G["if"]): ("SHIFT", 12), + (98, G["{"]): ("SHIFT", 10), (98, G["case"]): ("SHIFT", 21), - (98, G["let"]): ("SHIFT", 14), - (98, G["int"]): ("SHIFT", 34), - (98, G["while"]): ("SHIFT", 13), - (98, G["not"]): ("SHIFT", 30), + (98, G["true"]): ("SHIFT", 25), (98, G["false"]): ("SHIFT", 26), - (98, G["string"]): ("SHIFT", 33), - (99, G["else"]): ("SHIFT", 100), - (100, G["false"]): ("SHIFT", 26), - (100, G["id"]): ("SHIFT", 31), - (100, G["string"]): ("SHIFT", 33), - (100, G["let"]): ("SHIFT", 14), - (100, G["case"]): ("SHIFT", 21), - (100, G["isvoid"]): ("SHIFT", 24), - (100, G["true"]): ("SHIFT", 25), - (100, G["while"]): ("SHIFT", 13), - (100, G["not"]): ("SHIFT", 30), - (100, G["new"]): ("SHIFT", 22), - (100, G["("]): ("SHIFT", 11), - (100, G["if"]): ("SHIFT", 12), - (100, G["{"]): ("SHIFT", 10), - (100, G["~"]): ("SHIFT", 27), - (100, G["int"]): ("SHIFT", 34), - (101, G["fi"]): ("SHIFT", 102), - (102, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (102, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (102, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (102, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (102, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (102, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (102, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (102, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (102, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (102, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (102, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (102, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (103, G[")"]): ("SHIFT", 104), - (104, G[";"]): ("REDUCE", G["atom -> ( expr )"]), - (104, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), - (104, G["@"]): ("REDUCE", G["atom -> ( expr )"]), - (104, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), - (104, G["+"]): ("REDUCE", G["atom -> ( expr )"]), - (104, G["-"]): ("REDUCE", G["atom -> ( expr )"]), - (104, G["in"]): ("REDUCE", G["atom -> ( expr )"]), - (104, G["*"]): ("REDUCE", G["atom -> ( expr )"]), - (104, G["}"]): ("REDUCE", G["atom -> ( expr )"]), - (104, G["/"]): ("REDUCE", G["atom -> ( expr )"]), - (104, G["of"]): ("REDUCE", G["atom -> ( expr )"]), - (104, G["<"]): ("REDUCE", G["atom -> ( expr )"]), - (104, G[")"]): ("REDUCE", G["atom -> ( expr )"]), - (104, G["<="]): ("REDUCE", G["atom -> ( expr )"]), - (104, G["then"]): ("REDUCE", G["atom -> ( expr )"]), - (104, G["."]): ("REDUCE", G["atom -> ( expr )"]), - (104, G["="]): ("REDUCE", G["atom -> ( expr )"]), - (104, G["else"]): ("REDUCE", G["atom -> ( expr )"]), - (104, G["error"]): ("REDUCE", G["atom -> ( expr )"]), - (104, G[","]): ("REDUCE", G["atom -> ( expr )"]), - (104, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), - (105, G["}"]): ("SHIFT", 106), - (106, G[";"]): ("REDUCE", G["expr -> { block }"]), - (106, G["of"]): ("REDUCE", G["expr -> { block }"]), - (106, G["loop"]): ("REDUCE", G["expr -> { block }"]), - (106, G[")"]): ("REDUCE", G["expr -> { block }"]), - (106, G["pool"]): ("REDUCE", G["expr -> { block }"]), - (106, G["then"]): ("REDUCE", G["expr -> { block }"]), - (106, G["else"]): ("REDUCE", G["expr -> { block }"]), - (106, G["error"]): ("REDUCE", G["expr -> { block }"]), - (106, G[","]): ("REDUCE", G["expr -> { block }"]), - (106, G["in"]): ("REDUCE", G["expr -> { block }"]), - (106, G["fi"]): ("REDUCE", G["expr -> { block }"]), - (106, G["}"]): ("REDUCE", G["expr -> { block }"]), - (107, G[";"]): ("SHIFT", 108), - (108, G["new"]): ("SHIFT", 22), - (108, G["("]): ("SHIFT", 11), - (108, G["~"]): ("SHIFT", 27), - (108, G["case"]): ("SHIFT", 21), - (108, G["let"]): ("SHIFT", 14), - (108, G["while"]): ("SHIFT", 13), - (108, G["not"]): ("SHIFT", 30), - (108, G["if"]): ("SHIFT", 12), - (108, G["int"]): ("SHIFT", 34), - (108, G["isvoid"]): ("SHIFT", 24), - (108, G["{"]): ("SHIFT", 10), - (108, G["id"]): ("SHIFT", 31), - (108, G["false"]): ("SHIFT", 26), - (108, G["string"]): ("SHIFT", 33), - (108, G["true"]): ("SHIFT", 25), - (108, G["}"]): ("REDUCE", G["block -> expr ;"]), - (109, G["}"]): ("REDUCE", G["block -> expr ; block"]), - (110, G["}"]): ("SHIFT", 111), - (111, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), - (111, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), - (112, G[":"]): ("SHIFT", 113), - (113, G["type"]): ("SHIFT", 114), - (114, G[","]): ("SHIFT", 115), - (114, G[")"]): ("REDUCE", G["param-list -> id : type"]), - (115, G["id"]): ("SHIFT", 112), - (116, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), - (117, G[")"]): ("SHIFT", 118), - (118, G[":"]): ("SHIFT", 119), - (119, G["type"]): ("SHIFT", 120), - (120, G["{"]): ("SHIFT", 121), - (121, G["false"]): ("SHIFT", 26), - (121, G["while"]): ("SHIFT", 13), - (121, G["id"]): ("SHIFT", 31), - (121, G["not"]): ("SHIFT", 30), - (121, G["string"]): ("SHIFT", 33), - (121, G["true"]): ("SHIFT", 25), - (121, G["isvoid"]): ("SHIFT", 24), - (121, G["if"]): ("SHIFT", 12), - (121, G["new"]): ("SHIFT", 22), - (121, G["("]): ("SHIFT", 11), - (121, G["{"]): ("SHIFT", 10), - (121, G["~"]): ("SHIFT", 27), - (121, G["int"]): ("SHIFT", 34), - (121, G["case"]): ("SHIFT", 21), - (121, G["let"]): ("SHIFT", 14), - (122, G["}"]): ("SHIFT", 123), - (123, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), - (123, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), - (124, G["type"]): ("SHIFT", 125), - (125, G[";"]): ("REDUCE", G["attribute -> id : type"]), - (125, G["error"]): ("REDUCE", G["attribute -> id : type"]), - (125, G["<-"]): ("SHIFT", 126), - (126, G["if"]): ("SHIFT", 12), - (126, G["id"]): ("SHIFT", 31), - (126, G["{"]): ("SHIFT", 10), - (126, G["int"]): ("SHIFT", 34), - (126, G["false"]): ("SHIFT", 26), - (126, G["~"]): ("SHIFT", 27), - (126, G["string"]): ("SHIFT", 33), - (126, G["true"]): ("SHIFT", 25), - (126, G["new"]): ("SHIFT", 22), - (126, G["("]): ("SHIFT", 11), - (126, G["let"]): ("SHIFT", 14), - (126, G["case"]): ("SHIFT", 21), - (126, G["isvoid"]): ("SHIFT", 24), - (126, G["while"]): ("SHIFT", 13), - (126, G["not"]): ("SHIFT", 30), - (127, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), - (127, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), - (128, G["}"]): ("SHIFT", 129), - (129, G["class"]): ("REDUCE", G["class-def -> class type { feature-list }"]), - (129, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), - (130, G["error"]): ("SHIFT", 138), - (130, G[";"]): ("SHIFT", 131), - (131, G["}"]): ("REDUCE", G["feature-list -> e"]), - (131, G["id"]): ("SHIFT", 4), - (132, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), - (133, G[";"]): ("SHIFT", 134), - (133, G["error"]): ("SHIFT", 136), - (134, G["}"]): ("REDUCE", G["feature-list -> e"]), - (134, G["id"]): ("SHIFT", 4), - (135, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), - (136, G["}"]): ("REDUCE", G["feature-list -> e"]), - (136, G["id"]): ("SHIFT", 4), - (137, G["}"]): ("REDUCE", G["feature-list -> method error feature-list"]), + (99, G["pool"]): ("SHIFT", 100), + (100, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (100, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (100, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (100, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (100, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (100, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (100, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (100, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (100, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (100, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (100, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (100, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (101, G["then"]): ("SHIFT", 102), + (102, G["{"]): ("SHIFT", 10), + (102, G["~"]): ("SHIFT", 27), + (102, G["case"]): ("SHIFT", 21), + (102, G["true"]): ("SHIFT", 25), + (102, G["false"]): ("SHIFT", 26), + (102, G["id"]): ("SHIFT", 32), + (102, G["string"]): ("SHIFT", 34), + (102, G["int"]): ("SHIFT", 35), + (102, G["isvoid"]): ("SHIFT", 24), + (102, G["new"]): ("SHIFT", 22), + (102, G["let"]): ("SHIFT", 14), + (102, G["while"]): ("SHIFT", 13), + (102, G["if"]): ("SHIFT", 12), + (102, G["not"]): ("SHIFT", 31), + (102, G["("]): ("SHIFT", 11), + (103, G["else"]): ("SHIFT", 104), + (104, G["if"]): ("SHIFT", 12), + (104, G["{"]): ("SHIFT", 10), + (104, G["int"]): ("SHIFT", 35), + (104, G["case"]): ("SHIFT", 21), + (104, G["new"]): ("SHIFT", 22), + (104, G["isvoid"]): ("SHIFT", 24), + (104, G["("]): ("SHIFT", 11), + (104, G["true"]): ("SHIFT", 25), + (104, G["~"]): ("SHIFT", 27), + (104, G["not"]): ("SHIFT", 31), + (104, G["id"]): ("SHIFT", 32), + (104, G["false"]): ("SHIFT", 26), + (104, G["string"]): ("SHIFT", 34), + (104, G["let"]): ("SHIFT", 14), + (104, G["while"]): ("SHIFT", 13), + (105, G["fi"]): ("SHIFT", 106), + (106, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (106, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (106, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (106, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (106, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (106, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (106, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (106, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (106, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (106, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (106, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (106, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (107, G[")"]): ("SHIFT", 108), + (108, G["<"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G[")"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["then"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["<="]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["."]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["else"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["="]): ("REDUCE", G["atom -> ( expr )"]), + (108, G[","]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["/"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G[";"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["@"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["+"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["-"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["error"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["in"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["*"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["}"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["of"]): ("REDUCE", G["atom -> ( expr )"]), + (109, G["}"]): ("SHIFT", 110), + (110, G["loop"]): ("REDUCE", G["expr -> { block }"]), + (110, G["of"]): ("REDUCE", G["expr -> { block }"]), + (110, G[")"]): ("REDUCE", G["expr -> { block }"]), + (110, G["pool"]): ("REDUCE", G["expr -> { block }"]), + (110, G["then"]): ("REDUCE", G["expr -> { block }"]), + (110, G["else"]): ("REDUCE", G["expr -> { block }"]), + (110, G["error"]): ("REDUCE", G["expr -> { block }"]), + (110, G[","]): ("REDUCE", G["expr -> { block }"]), + (110, G["in"]): ("REDUCE", G["expr -> { block }"]), + (110, G["fi"]): ("REDUCE", G["expr -> { block }"]), + (110, G["}"]): ("REDUCE", G["expr -> { block }"]), + (110, G[";"]): ("REDUCE", G["expr -> { block }"]), + (111, G[";"]): ("SHIFT", 112), + (112, G["true"]): ("SHIFT", 25), + (112, G["false"]): ("SHIFT", 26), + (112, G["id"]): ("SHIFT", 32), + (112, G["string"]): ("SHIFT", 34), + (112, G["let"]): ("SHIFT", 14), + (112, G["while"]): ("SHIFT", 13), + (112, G["}"]): ("REDUCE", G["block -> expr ;"]), + (112, G["isvoid"]): ("SHIFT", 24), + (112, G["if"]): ("SHIFT", 12), + (112, G["not"]): ("SHIFT", 31), + (112, G["int"]): ("SHIFT", 35), + (112, G["{"]): ("SHIFT", 10), + (112, G["case"]): ("SHIFT", 21), + (112, G["new"]): ("SHIFT", 22), + (112, G["~"]): ("SHIFT", 27), + (112, G["("]): ("SHIFT", 11), + (113, G["}"]): ("REDUCE", G["block -> expr ; block"]), + (114, G["}"]): ("SHIFT", 115), + (115, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (115, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (116, G[":"]): ("SHIFT", 117), + (117, G["type"]): ("SHIFT", 118), + (118, G[")"]): ("REDUCE", G["param-list -> id : type"]), + (118, G[","]): ("SHIFT", 119), + (119, G["id"]): ("SHIFT", 116), + (120, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), + (121, G[")"]): ("SHIFT", 122), + (122, G[":"]): ("SHIFT", 123), + (123, G["type"]): ("SHIFT", 124), + (124, G["{"]): ("SHIFT", 125), + (125, G["string"]): ("SHIFT", 34), + (125, G["id"]): ("SHIFT", 32), + (125, G["let"]): ("SHIFT", 14), + (125, G["int"]): ("SHIFT", 35), + (125, G["while"]): ("SHIFT", 13), + (125, G["isvoid"]): ("SHIFT", 24), + (125, G["not"]): ("SHIFT", 31), + (125, G["if"]): ("SHIFT", 12), + (125, G["new"]): ("SHIFT", 22), + (125, G["{"]): ("SHIFT", 10), + (125, G["case"]): ("SHIFT", 21), + (125, G["("]): ("SHIFT", 11), + (125, G["~"]): ("SHIFT", 27), + (125, G["true"]): ("SHIFT", 25), + (125, G["false"]): ("SHIFT", 26), + (126, G["}"]): ("SHIFT", 127), + (127, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (127, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (128, G["type"]): ("SHIFT", 129), + (129, G[";"]): ("REDUCE", G["attribute -> id : type"]), + (129, G["error"]): ("REDUCE", G["attribute -> id : type"]), + (129, G["<-"]): ("SHIFT", 130), + (130, G["id"]): ("SHIFT", 32), + (130, G["let"]): ("SHIFT", 14), + (130, G["~"]): ("SHIFT", 27), + (130, G["while"]): ("SHIFT", 13), + (130, G["true"]): ("SHIFT", 25), + (130, G["not"]): ("SHIFT", 31), + (130, G["if"]): ("SHIFT", 12), + (130, G["false"]): ("SHIFT", 26), + (130, G["{"]): ("SHIFT", 10), + (130, G["string"]): ("SHIFT", 34), + (130, G["case"]): ("SHIFT", 21), + (130, G["int"]): ("SHIFT", 35), + (130, G["new"]): ("SHIFT", 22), + (130, G["isvoid"]): ("SHIFT", 24), + (130, G["("]): ("SHIFT", 11), + (131, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (131, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (132, G["}"]): ("SHIFT", 133), + (133, G["class"]): ("REDUCE", G["class-def -> class type { feature-list }"]), + (133, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), + (134, G["error"]): ("SHIFT", 142), + (134, G[";"]): ("SHIFT", 135), + (135, G["}"]): ("REDUCE", G["feature-list -> e"]), + (135, G["id"]): ("SHIFT", 4), + (136, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), + (137, G["error"]): ("SHIFT", 140), + (137, G[";"]): ("SHIFT", 138), (138, G["}"]): ("REDUCE", G["feature-list -> e"]), (138, G["id"]): ("SHIFT", 4), - (139, G["}"]): ("REDUCE", G["feature-list -> attribute error feature-list"]), - (140, G["type"]): ("SHIFT", 141), - (141, G["{"]): ("SHIFT", 142), + (139, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), + (140, G["}"]): ("REDUCE", G["feature-list -> e"]), + (140, G["id"]): ("SHIFT", 4), + (141, G["}"]): ("REDUCE", G["feature-list -> method error feature-list"]), (142, G["}"]): ("REDUCE", G["feature-list -> e"]), (142, G["id"]): ("SHIFT", 4), - (143, G["}"]): ("SHIFT", 144), - (144, G["class"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), - (144, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), - (145, G["$"]): ("OK", None), - (146, G["$"]): ("REDUCE", G["program -> class-list"]), - (147, G["class"]): ("SHIFT", 1), - (147, G["$"]): ("REDUCE", G["class-list -> class-def"]), - (148, G["$"]): ("REDUCE", G["class-list -> class-def class-list"]), + (143, G["}"]): ("REDUCE", G["feature-list -> attribute error feature-list"]), + (144, G["type"]): ("SHIFT", 145), + (145, G["{"]): ("SHIFT", 146), + (146, G["}"]): ("REDUCE", G["feature-list -> e"]), + (146, G["id"]): ("SHIFT", 4), + (147, G["}"]): ("SHIFT", 148), + (148, G["class"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), + (148, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), + (149, G["$"]): ("OK", None), + (150, G["$"]): ("REDUCE", G["program -> class-list"]), + (151, G["class"]): ("SHIFT", 1), + (151, G["$"]): ("REDUCE", G["class-list -> class-def"]), + (152, G["$"]): ("REDUCE", G["class-list -> class-def class-list"]), } @staticmethod def __goto_table(): return { - (0, G["class-def"]): 147, - (0, G["program"]): 145, - (0, G["class-list"]): 146, - (3, G["attribute"]): 130, - (3, G["method"]): 133, - (3, G["feature-list"]): 128, - (5, G["param-list"]): 117, - (9, G["atom"]): 43, - (9, G["arith"]): 38, - (9, G["expr"]): 110, - (9, G["term"]): 52, - (9, G["comp"]): 37, - (9, G["function-call"]): 35, - (9, G["factor"]): 55, - (10, G["factor"]): 55, - (10, G["term"]): 52, - (10, G["arith"]): 38, - (10, G["function-call"]): 35, - (10, G["atom"]): 43, - (10, G["block"]): 105, - (10, G["comp"]): 37, - (10, G["expr"]): 107, - (11, G["atom"]): 43, - (11, G["arith"]): 38, - (11, G["term"]): 52, - (11, G["comp"]): 37, - (11, G["expr"]): 103, - (11, G["function-call"]): 35, - (11, G["factor"]): 55, - (12, G["term"]): 52, - (12, G["atom"]): 43, - (12, G["arith"]): 38, - (12, G["expr"]): 97, - (12, G["function-call"]): 35, - (12, G["factor"]): 55, - (12, G["comp"]): 37, - (13, G["atom"]): 43, - (13, G["term"]): 52, - (13, G["arith"]): 38, - (13, G["factor"]): 55, - (13, G["comp"]): 37, - (13, G["function-call"]): 35, - (13, G["expr"]): 93, - (14, G["declaration-list"]): 90, + (0, G["class-list"]): 150, + (0, G["class-def"]): 151, + (0, G["program"]): 149, + (3, G["method"]): 137, + (3, G["attribute"]): 134, + (3, G["feature-list"]): 132, + (5, G["param-list"]): 121, + (9, G["term"]): 54, + (9, G["arith"]): 39, + (9, G["function-call"]): 36, + (9, G["comp"]): 38, + (9, G["atom"]): 44, + (9, G["expr"]): 114, + (9, G["factor"]): 57, + (10, G["term"]): 54, + (10, G["expr"]): 111, + (10, G["atom"]): 44, + (10, G["arith"]): 39, + (10, G["comp"]): 38, + (10, G["function-call"]): 36, + (10, G["block"]): 109, + (10, G["factor"]): 57, + (11, G["arith"]): 39, + (11, G["function-call"]): 36, + (11, G["term"]): 54, + (11, G["expr"]): 107, + (11, G["atom"]): 44, + (11, G["factor"]): 57, + (11, G["comp"]): 38, + (12, G["arith"]): 39, + (12, G["atom"]): 44, + (12, G["term"]): 54, + (12, G["factor"]): 57, + (12, G["expr"]): 101, + (12, G["comp"]): 38, + (12, G["function-call"]): 36, + (13, G["term"]): 54, + (13, G["function-call"]): 36, + (13, G["arith"]): 39, + (13, G["atom"]): 44, + (13, G["comp"]): 38, + (13, G["factor"]): 57, + (13, G["expr"]): 97, + (14, G["declaration-list"]): 94, (18, G["declaration-list"]): 19, - (20, G["comp"]): 37, - (20, G["arith"]): 38, - (20, G["term"]): 52, - (20, G["atom"]): 43, - (20, G["function-call"]): 35, - (20, G["expr"]): 87, - (20, G["factor"]): 55, - (21, G["comp"]): 37, - (21, G["expr"]): 76, - (21, G["term"]): 52, - (21, G["arith"]): 38, - (21, G["factor"]): 55, - (21, G["function-call"]): 35, - (21, G["atom"]): 43, - (24, G["atom"]): 43, - (24, G["factor"]): 75, - (24, G["function-call"]): 35, - (27, G["atom"]): 43, - (27, G["factor"]): 74, - (27, G["function-call"]): 35, - (29, G["arith"]): 38, - (29, G["atom"]): 43, - (29, G["term"]): 52, - (29, G["expr"]): 49, - (29, G["factor"]): 55, - (29, G["expr-list"]): 72, - (29, G["comp"]): 37, - (29, G["function-call"]): 35, - (30, G["arith"]): 38, - (30, G["factor"]): 55, - (30, G["term"]): 52, - (30, G["comp"]): 37, - (30, G["function-call"]): 35, - (30, G["atom"]): 43, - (30, G["expr"]): 71, - (32, G["arith"]): 38, - (32, G["factor"]): 55, - (32, G["term"]): 52, - (32, G["comp"]): 37, - (32, G["function-call"]): 35, - (32, G["atom"]): 43, - (32, G["expr"]): 36, - (39, G["atom"]): 43, - (39, G["factor"]): 55, - (39, G["function-call"]): 35, - (39, G["term"]): 40, - (41, G["atom"]): 43, - (41, G["factor"]): 42, - (41, G["function-call"]): 35, - (46, G["arith"]): 38, - (46, G["atom"]): 43, - (46, G["term"]): 52, - (46, G["expr"]): 49, - (46, G["expr-list"]): 47, - (46, G["factor"]): 55, - (46, G["comp"]): 37, - (46, G["function-call"]): 35, - (50, G["arith"]): 38, - (50, G["atom"]): 43, - (50, G["term"]): 52, - (50, G["expr"]): 49, - (50, G["expr-list"]): 51, - (50, G["factor"]): 55, - (50, G["comp"]): 37, - (50, G["function-call"]): 35, - (53, G["atom"]): 43, - (53, G["factor"]): 54, - (53, G["function-call"]): 35, - (60, G["arith"]): 38, - (60, G["atom"]): 43, - (60, G["term"]): 52, - (60, G["expr"]): 49, - (60, G["factor"]): 55, - (60, G["expr-list"]): 61, - (60, G["comp"]): 37, - (60, G["function-call"]): 35, - (63, G["atom"]): 43, - (63, G["term"]): 64, - (63, G["factor"]): 55, - (63, G["function-call"]): 35, - (65, G["atom"]): 43, - (65, G["arith"]): 66, - (65, G["factor"]): 55, - (65, G["function-call"]): 35, - (65, G["term"]): 52, - (67, G["atom"]): 43, - (67, G["arith"]): 68, - (67, G["factor"]): 55, - (67, G["function-call"]): 35, - (67, G["term"]): 52, - (69, G["atom"]): 43, - (69, G["arith"]): 70, - (69, G["factor"]): 55, - (69, G["function-call"]): 35, - (69, G["term"]): 52, - (77, G["case-list"]): 85, - (81, G["factor"]): 55, - (81, G["expr"]): 82, - (81, G["term"]): 52, - (81, G["arith"]): 38, - (81, G["function-call"]): 35, - (81, G["atom"]): 43, - (81, G["comp"]): 37, - (83, G["case-list"]): 84, - (88, G["declaration-list"]): 89, - (91, G["arith"]): 38, - (91, G["expr"]): 92, - (91, G["factor"]): 55, - (91, G["term"]): 52, - (91, G["comp"]): 37, - (91, G["function-call"]): 35, - (91, G["atom"]): 43, - (94, G["arith"]): 38, - (94, G["expr"]): 95, - (94, G["atom"]): 43, - (94, G["term"]): 52, - (94, G["comp"]): 37, - (94, G["factor"]): 55, - (94, G["function-call"]): 35, - (98, G["term"]): 52, - (98, G["arith"]): 38, - (98, G["atom"]): 43, - (98, G["comp"]): 37, + (20, G["function-call"]): 36, + (20, G["arith"]): 39, + (20, G["term"]): 54, + (20, G["atom"]): 44, + (20, G["expr"]): 91, + (20, G["comp"]): 38, + (20, G["factor"]): 57, + (21, G["atom"]): 44, + (21, G["arith"]): 39, + (21, G["term"]): 54, + (21, G["factor"]): 57, + (21, G["comp"]): 38, + (21, G["function-call"]): 36, + (21, G["expr"]): 79, + (24, G["atom"]): 44, + (24, G["function-call"]): 36, + (24, G["factor"]): 78, + (27, G["atom"]): 44, + (27, G["function-call"]): 36, + (27, G["factor"]): 77, + (29, G["term"]): 54, + (29, G["expr"]): 51, + (29, G["arith"]): 39, + (29, G["expr-list"]): 75, + (29, G["comp"]): 38, + (29, G["function-call"]): 36, + (29, G["factor"]): 57, + (29, G["atom"]): 44, + (31, G["atom"]): 44, + (31, G["arith"]): 39, + (31, G["comp"]): 38, + (31, G["term"]): 54, + (31, G["expr"]): 74, + (31, G["function-call"]): 36, + (31, G["factor"]): 57, + (33, G["atom"]): 44, + (33, G["expr"]): 37, + (33, G["arith"]): 39, + (33, G["comp"]): 38, + (33, G["term"]): 54, + (33, G["function-call"]): 36, + (33, G["factor"]): 57, + (40, G["atom"]): 44, + (40, G["term"]): 41, + (40, G["function-call"]): 36, + (40, G["factor"]): 57, + (42, G["atom"]): 44, + (42, G["function-call"]): 36, + (42, G["factor"]): 43, + (47, G["term"]): 54, + (47, G["expr"]): 51, + (47, G["arith"]): 39, + (47, G["comp"]): 38, + (47, G["function-call"]): 36, + (47, G["expr-list"]): 49, + (47, G["factor"]): 57, + (47, G["atom"]): 44, + (52, G["term"]): 54, + (52, G["expr"]): 51, + (52, G["arith"]): 39, + (52, G["comp"]): 38, + (52, G["expr-list"]): 53, + (52, G["function-call"]): 36, + (52, G["factor"]): 57, + (52, G["atom"]): 44, + (55, G["atom"]): 44, + (55, G["function-call"]): 36, + (55, G["factor"]): 56, + (62, G["expr-list"]): 64, + (62, G["term"]): 54, + (62, G["expr"]): 51, + (62, G["arith"]): 39, + (62, G["comp"]): 38, + (62, G["function-call"]): 36, + (62, G["factor"]): 57, + (62, G["atom"]): 44, + (66, G["atom"]): 44, + (66, G["term"]): 67, + (66, G["function-call"]): 36, + (66, G["factor"]): 57, + (68, G["term"]): 54, + (68, G["arith"]): 69, + (68, G["atom"]): 44, + (68, G["factor"]): 57, + (68, G["function-call"]): 36, + (70, G["term"]): 54, + (70, G["arith"]): 71, + (70, G["atom"]): 44, + (70, G["factor"]): 57, + (70, G["function-call"]): 36, + (72, G["term"]): 54, + (72, G["arith"]): 73, + (72, G["atom"]): 44, + (72, G["factor"]): 57, + (72, G["function-call"]): 36, + (80, G["case-list"]): 89, + (84, G["atom"]): 44, + (84, G["expr"]): 85, + (84, G["term"]): 54, + (84, G["arith"]): 39, + (84, G["factor"]): 57, + (84, G["comp"]): 38, + (84, G["function-call"]): 36, + (86, G["case-list"]): 87, + (92, G["declaration-list"]): 93, + (95, G["atom"]): 44, + (95, G["arith"]): 39, + (95, G["comp"]): 38, + (95, G["term"]): 54, + (95, G["expr"]): 96, + (95, G["function-call"]): 36, + (95, G["factor"]): 57, + (98, G["atom"]): 44, + (98, G["arith"]): 39, + (98, G["term"]): 54, + (98, G["function-call"]): 36, (98, G["expr"]): 99, - (98, G["function-call"]): 35, - (98, G["factor"]): 55, - (100, G["atom"]): 43, - (100, G["arith"]): 38, - (100, G["term"]): 52, - (100, G["function-call"]): 35, - (100, G["expr"]): 101, - (100, G["comp"]): 37, - (100, G["factor"]): 55, - (108, G["factor"]): 55, - (108, G["term"]): 52, - (108, G["arith"]): 38, - (108, G["function-call"]): 35, - (108, G["atom"]): 43, - (108, G["block"]): 109, - (108, G["comp"]): 37, - (108, G["expr"]): 107, - (115, G["param-list"]): 116, - (121, G["atom"]): 43, - (121, G["arith"]): 38, - (121, G["term"]): 52, - (121, G["expr"]): 122, - (121, G["comp"]): 37, - (121, G["function-call"]): 35, - (121, G["factor"]): 55, - (126, G["term"]): 52, - (126, G["arith"]): 38, - (126, G["function-call"]): 35, - (126, G["atom"]): 43, - (126, G["comp"]): 37, - (126, G["factor"]): 55, - (126, G["expr"]): 127, - (131, G["attribute"]): 130, - (131, G["method"]): 133, - (131, G["feature-list"]): 132, - (134, G["attribute"]): 130, - (134, G["method"]): 133, - (134, G["feature-list"]): 135, - (136, G["attribute"]): 130, - (136, G["method"]): 133, - (136, G["feature-list"]): 137, - (138, G["attribute"]): 130, - (138, G["method"]): 133, + (98, G["factor"]): 57, + (98, G["comp"]): 38, + (102, G["atom"]): 44, + (102, G["arith"]): 39, + (102, G["comp"]): 38, + (102, G["factor"]): 57, + (102, G["term"]): 54, + (102, G["expr"]): 103, + (102, G["function-call"]): 36, + (104, G["arith"]): 39, + (104, G["comp"]): 38, + (104, G["function-call"]): 36, + (104, G["atom"]): 44, + (104, G["term"]): 54, + (104, G["expr"]): 105, + (104, G["factor"]): 57, + (112, G["term"]): 54, + (112, G["expr"]): 111, + (112, G["atom"]): 44, + (112, G["arith"]): 39, + (112, G["comp"]): 38, + (112, G["block"]): 113, + (112, G["function-call"]): 36, + (112, G["factor"]): 57, + (119, G["param-list"]): 120, + (125, G["term"]): 54, + (125, G["arith"]): 39, + (125, G["function-call"]): 36, + (125, G["expr"]): 126, + (125, G["comp"]): 38, + (125, G["atom"]): 44, + (125, G["factor"]): 57, + (130, G["atom"]): 44, + (130, G["term"]): 54, + (130, G["arith"]): 39, + (130, G["factor"]): 57, + (130, G["comp"]): 38, + (130, G["expr"]): 131, + (130, G["function-call"]): 36, + (135, G["feature-list"]): 136, + (135, G["method"]): 137, + (135, G["attribute"]): 134, (138, G["feature-list"]): 139, - (142, G["attribute"]): 130, - (142, G["method"]): 133, + (138, G["method"]): 137, + (138, G["attribute"]): 134, + (140, G["method"]): 137, + (140, G["attribute"]): 134, + (140, G["feature-list"]): 141, + (142, G["method"]): 137, + (142, G["attribute"]): 134, (142, G["feature-list"]): 143, - (147, G["class-list"]): 148, - (147, G["class-def"]): 147, + (146, G["feature-list"]): 147, + (146, G["method"]): 137, + (146, G["attribute"]): 134, + (151, G["class-def"]): 151, + (151, G["class-list"]): 152, } diff --git a/semantics/astnodes.py b/semantics/astnodes.py index d0e58853c..43f8018ac 100755 --- a/semantics/astnodes.py +++ b/semantics/astnodes.py @@ -111,8 +111,9 @@ def __init__(self, expr): class BinaryNode(ExprNode): - def __init__(self, left, right): + def __init__(self, left, operation, right): self.left: ExprNode = left + self.operation: str = operation self.right: ExprNode = right diff --git a/semantics/formatter.py b/semantics/formatter.py index 870d5b0f8..849d69031 100644 --- a/semantics/formatter.py +++ b/semantics/formatter.py @@ -2,6 +2,105 @@ import semantics.visitor as visitor +class CodeBuilder: + @visitor.on('node') + def visit(self, node, tabs): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode, tabs: int = 0): + return '\n\n'.join(self.visit(child, tabs) for child in node.declarations) + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode, tabs: int = 0): + parent = '' if node.parent is None else f"inherits {node.parent} " + return (f'class {node.id} {parent}{{\n' + + '\n\n'.join(self.visit(child, tabs + 1) for child in node.features) + + '\n}') + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode, tabs: int = 0): + expr = f' <- {self.visit(node.expr, tabs)}' if node.expr is not None else '' + return '\t' * tabs + f'{node.id}: {node.type}{expr};' + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode, tabs: int = 0): + params = ', '.join(': '.join(param) for param in node.params) + ans = '\t' * tabs + f'{node.id} ({params}): {node.return_type}' + body = self.visit(node.body, tabs + 1) + return f'{ans} {{\n{body}\n\t}};' + + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode, tabs: int = 0): + declarations = '\n'.join(self.visit(declaration, 0) for declaration in node.declarations) + return '\t' * tabs + f'let {declarations} in \n{self.visit(node.expr, tabs + 1)}' + + @visitor.when(ast.VarDeclarationNode) + def visit(self, node: ast.VarDeclarationNode, tabs: int = 0): + if node.expr is not None: + return f'{node.id}: {node.type} <- {self.visit(node.expr)}' + else: + return f'{node.id} : {node.type}' + + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode, tabs: int = 0): + return '\t' * tabs + f'{node.id} <- {self.visit(node.expr)}' + + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode, tabs: int = 0): + body = ';\n'.join(self.visit(child, tabs + 1) for child in node.expressions) + return '\t' * tabs + f'{{\n{body};\n' + '\t' * tabs + '}' + + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode, tabs: int = 0): + ifx = self.visit(node.if_expr) + then = self.visit(node.then_expr, tabs + 1) + elsex = self.visit(node.else_expr, tabs + 1) + + return ('\t' * tabs + f'if {ifx}\n' + + '\t' * tabs + f'then\n{then}\n' + + '\t' * tabs + f'else\n{elsex}\n' + + '\t' * tabs + 'fi') + + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode, tabs: int = 0): + condition = self.visit(node.condition, 0) + body = self.visit(node.body, tabs + 1) + + return '\t' * tabs + f'while {condition} loop\n {body}\n' + '\t' * tabs + 'pool' + + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode, tabs: int = 0): + expr = self.visit(node.expr) + cases = '\n'.join(self.visit(case, tabs + 1) for case in node.cases) + + return '\t' * tabs + f'case {expr} of \n{cases}\n' + '\t' * tabs + 'esac' + + @visitor.when(ast.CaseNode) + def visit(self, node: ast.CaseNode, tabs: int = 0): + expr = self.visit(node.expr, tabs + 1) + return '\t' * tabs + f'{node.id} : {node.type} =>\n{expr};' + + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode, tabs: int = 0): + obj = f'{self.visit(node.obj, 0)}.' if node.obj is not None else '' + return '\t' * tabs + f'{obj}{node.id}({", ".join(self.visit(arg, 0) for arg in node.args)})' + + @visitor.when(ast.BinaryNode) + def visit(self, node: ast.BinaryNode, tabs: int = 0): + left = self.visit(node.left) if isinstance(node.left, ast.BinaryNode) else self.visit(node.left, tabs) + right = self.visit(node.right) + return f'{left} {node.operation} {right}' + + @visitor.when(ast.AtomicNode) + def visit(self, node: ast.AtomicNode, tabs: int = 0): + return '\t' * tabs + f'{node.lex}' + + @visitor.when(ast.InstantiateNode) + def visit(self, node: ast.InstantiateNode, tabs: int = 0): + return '\t' * tabs + f'new {node.lex}' + + class Formatter: @visitor.on('node') def visit(self, node, tabs): diff --git a/semantics/temp/type_inference.py b/semantics/temp/type_inference.py deleted file mode 100644 index 122f6a253..000000000 --- a/semantics/temp/type_inference.py +++ /dev/null @@ -1,455 +0,0 @@ -from typing import List - -import semantics.astnodes as ast -import semantics.errors as err -import semantics.visitor as visitor -from semantics.scope import Context, Attribute, Method, Type, ErrorType, VariableInfo, Scope, SemanticError - - -class InferenceTypeChecker: - def __init__(self, context: Context, errors: List[str] = []): - self.context: Context = context - self.errors: List[str] = errors - self.current_type: Type = None - self.current_method: Method = None - self.dependencies = {} - - @visitor.on('node') - def visit(self, node, tabs): - pass - - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode, scope: Scope = None): - if scope is None: - scope = Scope() - for elem in node.declarations: - self.visit(elem, scope.create_child()) - return InferenceTypeSubstitute(self.context, self.errors).visit(node, scope) - - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode, scope: Scope): - self.current_type = self.context.get_type(node.id) - - attrs = [feature for feature in node.features if isinstance(feature, ast.AttrDeclarationNode)] - methods = [feature for feature in node.features if isinstance(feature, ast.MethodDeclarationNode)] - - for attr in attrs: - self.visit(attr, scope) - - for i, method in enumerate(methods): - self.visit(method, scope.create_child()) - - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode, scope: Scope): - attr_type = self.context.get_type(node.type) - var = scope.define_variable(node.id, attr_type) - if node.expr is not None: - expr_type = self.visit(node.expr, scope.create_child()) - if attr_type == self.context.get_type('AUTO_TYPE'): - if isinstance(expr_type, VariableInfo) or isinstance(expr_type, Method): - try: - self.dependencies[expr_type].append(var) - except KeyError: - self.dependencies[expr_type] = [var] - else: - self._update_dependencies(var, expr_type) - - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode, scope: Scope): - self.current_method = self.current_type.get_method(node.id) - return_type = self.context.get_type(node.return_type) - - scope.define_variable('self', self.current_type) - for i, (name, expr_body_type) in enumerate(node.params): - if not scope.is_local(name): - scope.define_variable(name, self.context.get_type(expr_body_type)) - - expr_body_type = self.visit(node.body, scope) - if return_type == self.context.get_type('AUTO_TYPE'): - if isinstance(expr_body_type, VariableInfo) or isinstance(expr_body_type, Method): - try: - self.dependencies[expr_body_type].append(self.current_method) - except KeyError: - self.dependencies[expr_body_type] = [self.current_method] - else: - self._update_dependencies(self.current_method, expr_body_type) - - @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode, scope: Scope): - for elem in node.declarations: - self.visit(elem, scope) - return self.visit(node.expr, scope.create_child()) - - @visitor.when(ast.VarDeclarationNode) - def visit(self, node: ast.VarDeclarationNode, scope: Scope): - var = scope.define_variable(node.id, self.context.get_type(node.type)) - - if node.expr is not None: - expr_type = self.visit(node.expr, scope) - if node.type == 'AUTO_TYPE': - if isinstance(expr_type, VariableInfo) or isinstance(expr_type, Method): - try: - self.dependencies[expr_type].append(var) - except KeyError: - self.dependencies[expr_type] = [var] - else: - var.type = expr_type - - @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode, scope: Scope): - expr_type = self.visit(node.expr, scope) - var_info = scope.find_variable(node.id) - - if var_info is not None: - if var_info.type == self.context.get_type('AUTO_TYPE'): - if isinstance(expr_type, VariableInfo) or isinstance(expr_type, Method): - try: - self.dependencies[expr_type].append(var_info) - except KeyError: - self.dependencies[expr_type] = [var_info] - else: - self._update_dependencies(var_info, expr_type) - else: - if isinstance(expr_type, VariableInfo) or isinstance(expr_type, Method): - self._update_dependencies(expr_type, var_info.type) - - @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode, scope: Scope): - return_type = ErrorType() - - for expr in node.expressions: - return_type = self.visit(expr, scope.create_child()) - - return return_type - - @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode, scope: Scope): - if_type = self.visit(node.if_expr, scope) - then_type = self.visit(node.then_expr, scope) - else_type = self.visit(node.else_expr, scope) - - if isinstance(if_type, VariableInfo): - if_type.type = self.context.get_type('BOOL_TYPE') - - if isinstance(if_type, Method): - if_type.return_type = self.context.get_type('BOOL_TYPE') - - if isinstance(then_type, VariableInfo) or isinstance(then_type, Method): - return then_type - - if isinstance(else_type, VariableInfo) or isinstance(else_type, Method): - return else_type - - return then_type.join(else_type) - - @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode, scope: Scope): - condition = self.visit(node.condition, scope) - if isinstance(condition, VariableInfo) or isinstance(condition, Method): - self._update_dependencies(condition, self.context.get_type('Bool')) - - self.visit(node.body, scope) - return self.context.get_type('Object') - - @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode, scope: Scope): - # TODO: Esta mal la inferencia de tipo, no se esta aplicando el join de los tipos en lo branch del case - self.visit(node.expr, scope) - - for case in node.cases: - self.visit(case, scope.create_child()) - - return self.context.get_type('Object') - - @visitor.when(ast.CaseNode) - def visit(self, node: ast.CaseNode, scope: Scope): - try: - var = scope.define_variable(node.id, self.context.get_type(node.type)) - except SemanticError: - var = scope.find_variable('ERROR_TYPE') - - self.visit(node.expr, scope) - return var.type - - @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode, scope: Scope): - obj_type = self.visit(node.obj, scope) - if isinstance(obj_type, VariableInfo) or isinstance(obj_type, Method): - obj_type = self.context.get_type('AUTO_TYPE') - - if node.type is not None: - try: - ancestor_type = self.context.get_type(node.type) - except SemanticError: - ancestor_type = ErrorType() - else: - ancestor_type = obj_type - - try: - method = ancestor_type.get_method(node.id) - except SemanticError: - for arg in node.args: - self.visit(arg, scope) - return ErrorType() - - for i, arg in enumerate(node.args, 1): - arg_type = self.visit(arg, scope) - if isinstance(arg_type, VariableInfo) or isinstance(arg_type, VariableInfo): - if method.param_types[i].name != 'AUTO_TYPE': - self._update_dependencies(arg_type, method.param_types[i]) - - if method.return_type != self.context.get_type('AUTO_TYPE'): - return method.return_type - return method - - @visitor.when(ast.IntegerNode) - def visit(self, node: ast.IntegerNode, scope: Scope): - return self.context.get_type('Int') - - @visitor.when(ast.StringNode) - def visit(self, node: ast.StringNode, scope: Scope): - return self.context.get_type('String') - - @visitor.when(ast.BooleanNode) - def visit(self, node: ast.BooleanNode, scope: Scope): - return self.context.get_type('Bool') - - @visitor.when(ast.VariableNode) - def visit(self, node: ast.VariableNode, scope: Scope): - try: - var = scope.find_variable(node.lex) - if var.type == self.context.get_type('AUTO_TYPE'): - return var - return var.type - except SemanticError: - return self.context.get_type('ERROR_TYPE') - - @visitor.when(ast.InstantiateNode) - def visit(self, node: ast.InstantiateNode, scope: Scope): - try: - return self.context.get_type(node.lex) - except SemanticError: - return self.context.get_type('Object') - - @visitor.when(ast.NegationNode) - def visit(self, node: ast.NegationNode, scope: Scope): - a = self.visit(node.expr, scope) - if isinstance(a, VariableInfo) or isinstance(a, Method): - self._update_dependencies(a, self.context.get_type('Bool')) - - @visitor.when(ast.ComplementNode) - def visit(self, node: ast.ComplementNode, scope: Scope): - a = self.visit(node.expr, scope) - if isinstance(a, VariableInfo) or isinstance(a, Method): - self._update_dependencies(a, self.context.get_type('Int')) - - @visitor.when(ast.IsVoidNode) - def visit(self, node: ast.IsVoidNode, scope: Scope): - a = self.visit(node.expr, scope) - return self.context.get_type('BOOL_TYPE') - - @visitor.when(ast.PlusNode) - def visit(self, node: ast.PlusNode, scope: Scope): - return self._visit_binary_operation(node, scope, self.context.get_type('Int')) - - @visitor.when(ast.MinusNode) - def visit(self, node: ast.MinusNode, scope: Scope): - return self._visit_binary_operation(node, scope, self.context.get_type('Int')) - - @visitor.when(ast.StarNode) - def visit(self, node: ast.StarNode, scope: Scope): - return self._visit_binary_operation(node, scope, self.context.get_type('Int')) - - @visitor.when(ast.DivNode) - def visit(self, node: ast.DivNode, scope: Scope): - return self._visit_binary_operation(node, scope, self.context.get_type('Int')) - - @visitor.when(ast.LessEqualNode) - def visit(self, node: ast.LessEqualNode, scope: Scope): - return self._visit_binary_operation(node, scope, self.context.get_type('Bool')) - - @visitor.when(ast.LessThanNode) - def visit(self, node: ast.LessThanNode, scope: Scope): - return self._visit_binary_operation(node, scope, self.context.get_type('Bool')) - - @visitor.when(ast.EqualNode) - def visit(self, node: ast.EqualNode, scope: Scope): - self.visit(node.left, scope) - self.visit(node.right, scope) - return self.context.get_type('Bool') - - def _visit_binary_operation(self, node: ast.BinaryNode, scope: Scope, return_type: Type): - left_type = self.visit(node.left, scope) - right_type = self.visit(node.right, scope) - if isinstance(left_type, VariableInfo) or isinstance(left_type, VariableInfo): - self._update_dependencies(left_type, self.context.get_type('Int')) - if isinstance(right_type, VariableInfo) or isinstance(right_type, VariableInfo): - self._update_dependencies(right_type, self.context.get_type('Int')) - return return_type - - def _update_dependencies(self, info, typex): - try: - stack = self.dependencies[info] + [info] - self.dependencies[info] = [] - except KeyError: - stack = [info] - - visited = set(stack) - while stack: - item = stack.pop() - if isinstance(item, VariableInfo): - item.type = typex if item.type.name == 'AUTO_TYPE' else item.type.join(typex) - else: - item.return_type = typex if item.return_type.name == 'AUTO_TYPE' else item.return_type.join(typex) - - try: - Q2 = self.dependencies[item] - self.dependencies[item] = [] - for item2 in Q2: - if item2 not in visited: - stack.append(item2) - visited.add(item2) - except KeyError: - continue - - -class InferenceTypeSubstitute: - def __init__(self, context: Context, errors: List[str] = []): - self.context: Context = context - self.errors: List[str] = errors - self.current_type: Type = None - self.current_method: Method = None - self.dependencies = {} - - @visitor.on('node') - def visit(self, node, tabs): - pass - - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode, scope: Scope = None): - if scope is not None: - for elem in node.declarations: - self.visit(elem, scope.children[0]) - return scope - - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode, scope: Scope): - self.current_type = self.context.get_type(node.id) - - attrs = [feature for feature in node.features if isinstance(feature, ast.AttrDeclarationNode)] - methods = [feature for feature in node.features if isinstance(feature, ast.MethodDeclarationNode)] - - for attr in attrs: - self.visit(attr, scope) - - for i, method in enumerate(methods): - self.visit(method, scope.children[i]) - - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode, scope: Scope): - attr_type = self.context.get_type(node.type) - var_info = scope.find_variable(node.id) - - if node.expr is not None: - self.visit(node.expr, scope.create_child()) - - if attr_type == self.context.get_type('AUTO_TYPE'): - if var_info.type == self.context.get_type('AUTO_TYPE'): - self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % node.id) - node.type = var_info.type.name - self.current_type.get_attribute(node.id).type = var_info.type - - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode, scope: Scope): - self.current_method = self.current_type.get_method(node.id) - return_type = self.context.get_type(node.return_type) - - for i, (name, expr_body_type) in enumerate(node.params): - var = scope.find_variable(name) - if var.type == self.context.get_type('AUTO_TYPE'): - self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % name) - node.params[i] = (name, var.type.name) - self.current_method.param_types[i + 1] = var.type - - self.visit(node.body, scope) - - if return_type == self.context.get_type('AUTO_TYPE'): - if self.current_method.return_type == self.context.get_type('AUTO_TYPE'): - self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % node.id) - node.return_type = self.current_method.return_type.name - - @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode, scope: Scope): - scope_child = scope.children[0] - - for elem in node.declarations: - self.visit(elem, scope) - - self.visit(node.expr, scope_child) - - @visitor.when(ast.VarDeclarationNode) - def visit(self, node: ast.VarDeclarationNode, scope: Scope): - var = scope.find_variable(node.id) - - if node.expr is not None: - self.visit(node.expr, scope) - - if node.type == 'AUTO_TYPE': - if var.type == self.context.get_type('AUTO_TYPE'): - self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % node.id) - node.type = var.type.name - - @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode, scope: Scope): - self.visit(node.expr, scope) - - @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode, scope: Scope): - for i, expr in enumerate(node.expressions): - self.visit(expr, scope.children[i]) - - @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode, scope: Scope): - self.visit(node.if_expr, scope) - self.visit(node.then_expr, scope) - self.visit(node.else_expr, scope) - - @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode, scope: Scope): - self.visit(node.condition, scope) - self.visit(node.body, scope) - - @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode, scope: Scope): - self.visit(node.expr, scope) - for i, case in enumerate(node.cases): - self.visit(case, scope.children[i]) - - @visitor.when(ast.CaseNode) - def visit(self, node: ast.CaseNode, scope: Scope): - var_info = scope.find_variable(node.id) - if node.type == 'AUTO_TYPE': - if var_info.type == self.context.get_type('AUTO_TYPE'): - self.errors.append(err.INFERENCE_ERROR_VARIABLE % node.id) - node.type = var_info.type.name - self.visit(node.expr, scope) - - @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode, scope: Scope): - self.visit(node.obj, scope) - - for arg in node.args: - self.visit(arg, scope) - - @visitor.when(ast.AtomicNode) - def visit(self, node: ast.AtomicNode, scope: Scope): - pass - - @visitor.when(ast.UnaryNode) - def visit(self, node: ast.UnaryNode, scope: Scope): - self.visit(node.expr, scope) - - @visitor.when(ast.BinaryNode) - def visit(self, node: ast.BinaryNode, scope: Scope): - self.visit(node.left, scope) - self.visit(node.right, scope) diff --git a/semantics/type_checker.py b/semantics/type_checker.py index cd31ceb2b..ddb6d04a8 100644 --- a/semantics/type_checker.py +++ b/semantics/type_checker.py @@ -99,8 +99,8 @@ def visit(self, node: ast.VarDeclarationNode, scope: Scope): try: var_static_type = self.context.get_type(node.type) if node.type != 'SELF_TYPE' else self.current_type except SemanticError as e: - var_static_type = ErrorType() self.errors.append(e.text) + var_static_type = ErrorType() if scope.is_local(node.id): self.errors.append(err.LOCAL_ALREADY_DEFINED % (node.id, self.current_method.name)) @@ -115,15 +115,17 @@ def visit(self, node: ast.VarDeclarationNode, scope: Scope): @visitor.when(ast.AssignNode) def visit(self, node: ast.AssignNode, scope: Scope): - expr_type = self.visit(node.expr, scope) var_info = scope.find_variable(node.id) + + expr_type = self.visit(node.expr, scope.create_child()) + if var_info is None: self.errors.append(err.VARIABLE_NOT_DEFINED % (node.id, self.current_method.name)) - return ErrorType() else: if not expr_type.conforms_to(var_info.type): self.errors.append(err.INCOMPATIBLE_TYPES % (expr_type.name, var_info.type.name)) - return var_info.type + + return expr_type @visitor.when(ast.BlockNode) def visit(self, node: ast.BlockNode, scope: Scope): @@ -147,7 +149,7 @@ def visit(self, node: ast.WhileNode, scope: Scope): if condition != self.context.get_type('Bool'): self.errors.append(err.INCOMPATIBLE_TYPES % (condition.name, 'Bool')) - self.visit(node.body) + self.visit(node.body, scope.create_child()) return self.context.get_type('Object') @visitor.when(ast.SwitchCaseNode) diff --git a/semantics/type_inference.py b/semantics/type_inference.py index 3b8955981..06fb23374 100644 --- a/semantics/type_inference.py +++ b/semantics/type_inference.py @@ -1,14 +1,19 @@ -from typing import Dict, List, Tuple +from collections import deque +from typing import Dict, List, Tuple, Set import semantics.astnodes as ast +import semantics.errors as err import semantics.visitor as visitor -from semantics.scope import Type, Attribute, Method, Scope, Context +from semantics.scope import Type, Attribute, Method, Scope, Context, SemanticError, ErrorType, VariableInfo class DependencyNode: def update(self, typex): raise NotImplementedError() + def __repr__(self): + return str(self) + class AtomNode(DependencyNode): def __init__(self, typex): @@ -17,15 +22,21 @@ def __init__(self, typex): def update(self, typex): pass + def __str__(self): + return f'Atom({self.type.name})' + class VariableInfoNode(DependencyNode): def __init__(self, var_type, variable_info): self.type: Type = var_type - self.variable_info: str = variable_info + self.variable_info: VariableInfo = variable_info def update(self, typex): self.type = self.variable_info.type = typex + def __str__(self): + return f'VarInfo({self.variable_info.name}, {self.type.name})' + class AttributeNode(DependencyNode): def __init__(self, var_type, attribute): @@ -35,6 +46,9 @@ def __init__(self, var_type, attribute): def update(self, typex): self.type = self.attribute.type = typex + def __str__(self): + return f'Attr({self.attribute.name}, {self.type.name})' + class ParameterNode(DependencyNode): def __init__(self, param_type, method, index): @@ -45,6 +59,9 @@ def __init__(self, param_type, method, index): def update(self, typex): self.type = self.method.param_types[self.index] = typex + def __str__(self): + return f'Param({self.method.name}, {self.index}, {self.type.name})' + class ReturnTypeNode(DependencyNode): def __init__(self, typex, method): @@ -54,36 +71,52 @@ def __init__(self, typex, method): def update(self, typex): self.type = self.method.return_type = typex + def __str__(self): + return f'Return({self.method.name}, {self.type.name})' + class DependencyGraph: def __init__(self): self.dependencies: Dict[DependencyNode, List[DependencyNode]] = {} + self.nodes: List[DependencyNode] = [] def add_node(self, node: DependencyNode): if node not in self.dependencies: self.dependencies[node] = [] + self.nodes.append(node) def add_edge(self, node: DependencyNode, other: DependencyNode): try: self.dependencies[node].append(other) except KeyError: self.dependencies[node] = [other] + self.nodes.append(node) + self.add_node(other) - if other not in self.dependencies: - self.dependencies[other] = [] - - def update_dependencies(self, node: DependencyNode, typex: Type): + def update_dependencies(self): + queue = deque(key for key in self.nodes if isinstance(key, AtomNode)) visited = set() - stack = self.dependencies[node] + [node] - while stack: - current_node = stack.pop() + + while queue: + current_node = queue.popleft() + if current_node in visited: + continue + self.update_dependencies_of(current_node, current_node.type, visited) + + def update_dependencies_of(self, node: DependencyNode, typex: Type, visited: Set[DependencyNode]): + queue = deque([node] + self.dependencies[node]) + while queue: + current_node = queue.popleft() if current_node in visited: continue current_node.update(typex) visited.add(current_node) - stack += self.dependencies[current_node] + queue.extend(self.dependencies[current_node]) + + def __str__(self): + return '\n'.join(f'{key}: {value}' for key, value in self.dependencies.items()) class InferenceChecker: @@ -132,6 +165,10 @@ def visit(self, node: ast.ProgramNode, scope: Scope = None): for item in node.declarations: self.visit(item, scope.create_child()) + # print(self.graph) + self.graph.update_dependencies() + InferenceTypeSubstitute(self.context, self.errors).visit(node, scope) + @visitor.when(ast.ClassDeclarationNode) def visit(self, node: ast.ClassDeclarationNode, scope: Scope): self.current_type = self.context.get_type(node.id) @@ -204,96 +241,327 @@ def visit(self, node: ast.MethodDeclarationNode, scope: Scope): @visitor.when(ast.LetNode) def visit(self, node: ast.LetNode, scope: Scope): - pass + for item in node.declarations: + self.visit(item, scope) + + return self.visit(node.expr, scope.create_child()) @visitor.when(ast.VarDeclarationNode) def visit(self, node: ast.VarDeclarationNode, scope: Scope): - pass + try: + var_info = scope.define_variable(node.id, self.context.get_type(node.type)) + except SemanticError: + var_info = scope.define_variable(node.id, ErrorType()) + var_info_node = self.variables[var_info] = VariableInfoNode(var_info.name, var_info) + + expr_node = self.visit(node.expr, scope.create_child()) if node.expr is not None else None + + if var_info.type.name == 'AUTO_TYPE': + self.graph.add_edge(expr_node, var_info_node) @visitor.when(ast.AssignNode) def visit(self, node: ast.AssignNode, scope: Scope): - pass + var_info = scope.find_variable(node.id) + + expr_node = self.visit(node.expr, scope.create_child()) + + if var_info is not None: + self.graph.add_edge(expr_node, self.variables[var_info]) + else: + # Maybe some error + pass + + return expr_node @visitor.when(ast.BlockNode) def visit(self, node: ast.BlockNode, scope: Scope): - pass + result_node = None + for expr in node.expressions: + result_node = self.visit(expr, scope) + return result_node @visitor.when(ast.ConditionalNode) def visit(self, node: ast.ConditionalNode, scope: Scope): - pass + if_node = self.visit(node.if_expr, scope) + + if not isinstance(if_node, AtomNode): + self.graph.add_edge(AtomNode(self.context.get_type('Bool')), if_node) + + then_node = self.visit(node.then_expr, scope) + else_node = self.visit(node.else_expr, scope) + + if isinstance(then_node, AtomNode) and isinstance(else_node, AtomNode): + return AtomNode(then_node.type.join(else_node.type)) + + return AtomNode(self.context.get_type('Object')) # For now @visitor.when(ast.WhileNode) def visit(self, node: ast.WhileNode, scope: Scope): - pass + self.visit(node.condition, scope) + self.visit(node.body, scope.create_child()) + return AtomNode(self.context.get_type('Object')) @visitor.when(ast.SwitchCaseNode) def visit(self, node: ast.SwitchCaseNode, scope: Scope): - pass + self.visit(node.expr, scope) + for case in node.cases: + self.visit(case, scope.create_child()) + return AtomNode(self.context.get_type('Object')) # For now @visitor.when(ast.CaseNode) def visit(self, node: ast.CaseNode, scope: Scope): - pass + var_info = scope.define_variable(node.id, self.context.get_type(node.type)) + self.variables[var_info] = VariableInfoNode(var_info.type, var_info) + return self.visit(node.expr, scope) @visitor.when(ast.MethodCallNode) def visit(self, node: ast.MethodCallNode, scope: Scope): - pass + if node.obj is None: + node.obj = ast.VariableNode('self') + obj_node = self.visit(node.obj, scope) + + if isinstance(obj_node, AtomNode): + method = obj_node.type.get_method(node.id) + param_nodes, return_node = self.methods[obj_node.type.name, method.name] + for i, arg in enumerate(node.args): + arg_node = self.visit(arg, scope) + if isinstance(arg_node, AtomNode): + if param_nodes[i].type.name == 'AUTO_TYPE': + self.graph.add_edge(arg_node, param_nodes[i]) + else: + continue + else: + if param_nodes[i].type.name != 'AUTO_TYPE': + self.graph.add_edge(param_nodes[i], arg_node) + else: + self.graph.add_edge(param_nodes[i], arg_node) + self.graph.add_edge(arg_node, param_nodes[i]) + return return_node if return_node.type.name == 'AUTO_TYPE' else AtomNode(return_node.type) + + for arg in node.args: + self.visit(arg, scope) + return AtomNode(self.context.get_type('Object')) @visitor.when(ast.IntegerNode) def visit(self, node: ast.IntegerNode, scope: Scope): - pass + return AtomNode(self.context.get_type('Int')) @visitor.when(ast.StringNode) def visit(self, node: ast.StringNode, scope: Scope): - pass + return AtomNode(self.context.get_type('String')) @visitor.when(ast.BooleanNode) def visit(self, node: ast.BooleanNode, scope: Scope): - pass + return AtomNode(self.context.get_type('Bool')) @visitor.when(ast.VariableNode) def visit(self, node: ast.VariableNode, scope: Scope): - pass + var_info = scope.find_variable(node.lex) + + if var_info is not None: + if var_info.type.name == 'AUTO_TYPE': + return self.variables[var_info] + else: + return AtomNode(var_info.type) + else: + pass @visitor.when(ast.InstantiateNode) def visit(self, node: ast.InstantiateNode, scope: Scope): - pass + return AtomNode(self.context.get_type(node.lex)) @visitor.when(ast.NegationNode) def visit(self, node: ast.NegationNode, scope: Scope): - pass + self.visit(node.expr, scope) + return AtomNode(self.context.get_type('Bool')) @visitor.when(ast.ComplementNode) def visit(self, node: ast.ComplementNode, scope: Scope): - pass + self.visit(node.expr, scope) + return AtomNode(self.context.get_type('Int')) @visitor.when(ast.IsVoidNode) def visit(self, node: ast.IsVoidNode, scope: Scope): - pass + self.visit(node.expr, scope) + return AtomNode(self.context.get_type('Bool')) @visitor.when(ast.PlusNode) def visit(self, node: ast.PlusNode, scope: Scope): - pass + return self._visit_arithmetic_node(node, scope, self.context.get_type('Int'), self.context.get_type('Int')) @visitor.when(ast.MinusNode) def visit(self, node: ast.MinusNode, scope: Scope): - pass + return self._visit_arithmetic_node(node, scope, self.context.get_type('Int'), self.context.get_type('Int')) @visitor.when(ast.StarNode) def visit(self, node: ast.StarNode, scope: Scope): - pass + return self._visit_arithmetic_node(node, scope, self.context.get_type('Int'), self.context.get_type('Int')) @visitor.when(ast.DivNode) def visit(self, node: ast.DivNode, scope: Scope): - pass + return self._visit_arithmetic_node(node, scope, self.context.get_type('Int'), self.context.get_type('Int')) @visitor.when(ast.LessEqualNode) def visit(self, node: ast.LessEqualNode, scope: Scope): - pass + return self._visit_arithmetic_node(node, scope, self.context.get_type('Int'), self.context.get_type('Bool')) @visitor.when(ast.LessThanNode) def visit(self, node: ast.LessThanNode, scope: Scope): - pass + return self._visit_arithmetic_node(node, scope, self.context.get_type('Int'), self.context.get_type('Bool')) @visitor.when(ast.EqualNode) def visit(self, node: ast.EqualNode, scope: Scope): + self.visit(node.left, scope) + self.visit(node.right, scope) + return AtomNode(self.context.get_type('Bool')) + + def _visit_arithmetic_node(self, node: ast.BinaryNode, scope: Scope, member_types: Type, return_type: Type): + left = self.visit(node.left, scope) + right = self.visit(node.right, scope) + + if not isinstance(left, AtomNode): + self.graph.add_edge(AtomNode(member_types), left) + + if not isinstance(right, AtomNode): + self.graph.add_edge(AtomNode(member_types), right) + + return AtomNode(return_type) + + +class InferenceTypeSubstitute: + def __init__(self, context: Context, errors: List[str] = []): + self.context: Context = context + self.errors: List[str] = errors + self.current_type: Type = None + self.current_method: Method = None + + @visitor.on('node') + def visit(self, node, tabs): pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode, scope: Scope = None): + if scope is not None: + for elem in node.declarations: + self.visit(elem, scope.children[0]) + return scope + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode, scope: Scope): + self.current_type = self.context.get_type(node.id) + + attrs = [feature for feature in node.features if isinstance(feature, ast.AttrDeclarationNode)] + methods = [feature for feature in node.features if isinstance(feature, ast.MethodDeclarationNode)] + + for attr in attrs: + self.visit(attr, scope) + + for i, method in enumerate(methods): + self.visit(method, scope.children[i]) + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode, scope: Scope): + attr_type = self.context.get_type(node.type) + var_info = scope.find_variable(node.id) + + if node.expr is not None: + self.visit(node.expr, scope.create_child()) + + if attr_type == self.context.get_type('AUTO_TYPE'): + if var_info.type == self.context.get_type('AUTO_TYPE'): + self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % node.id) + node.type = var_info.type.name + self.current_type.get_attribute(node.id).type = var_info.type + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode, scope: Scope): + self.current_method = self.current_type.get_method(node.id) + return_type = self.context.get_type(node.return_type) + + for i, (name, expr_body_type) in enumerate(node.params): + variable_info = scope.find_variable(name) + if variable_info.type == self.context.get_type('AUTO_TYPE'): + self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % name) + node.params[i] = (name, variable_info.type.name) + self.current_method.param_types[i] = variable_info.type + + self.visit(node.body, scope) + + if return_type == self.context.get_type('AUTO_TYPE'): + if self.current_method.return_type == self.context.get_type('AUTO_TYPE'): + self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % node.id) + node.return_type = self.current_method.return_type.name + + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode, scope: Scope): + for elem in node.declarations: + self.visit(elem, scope) + + self.visit(node.expr, scope.children[0]) + + @visitor.when(ast.VarDeclarationNode) + def visit(self, node: ast.VarDeclarationNode, scope: Scope): + variable_info = scope.find_variable(node.id) + + if node.expr is not None: + self.visit(node.expr, scope) + + if node.type == 'AUTO_TYPE': + if variable_info.type == self.context.get_type('AUTO_TYPE'): + self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % node.id) + node.type = variable_info.type.name + + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode, scope: Scope): + self.visit(node.expr, scope) + + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode, scope: Scope): + for i, expr in enumerate(node.expressions): + self.visit(expr, scope) + + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode, scope: Scope): + self.visit(node.if_expr, scope) + self.visit(node.then_expr, scope) + self.visit(node.else_expr, scope) + + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode, scope: Scope): + self.visit(node.condition, scope) + self.visit(node.body, scope.children[0]) + + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode, scope: Scope): + self.visit(node.expr, scope) + for i, case in enumerate(node.cases): + self.visit(case, scope.children[i]) + + @visitor.when(ast.CaseNode) + def visit(self, node: ast.CaseNode, scope: Scope): + var_info = scope.find_variable(node.id) + if node.type == 'AUTO_TYPE': + if var_info.type == self.context.get_type('AUTO_TYPE'): + self.errors.append(err.INFERENCE_ERROR_VARIABLE % node.id) + node.type = var_info.type.name + self.visit(node.expr, scope) + + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode, scope: Scope): + self.visit(node.obj, scope) + + for arg in node.args: + self.visit(arg, scope) + + @visitor.when(ast.AtomicNode) + def visit(self, node: ast.AtomicNode, scope: Scope): + pass + + @visitor.when(ast.UnaryNode) + def visit(self, node: ast.UnaryNode, scope: Scope): + self.visit(node.expr, scope) + + @visitor.when(ast.BinaryNode) + def visit(self, node: ast.BinaryNode, scope: Scope): + self.visit(node.left, scope) + self.visit(node.right, scope) From d0a954e9de56fb209d412b5d8e20868a14a4e380 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Mon, 18 May 2020 10:09:32 -0400 Subject: [PATCH 040/143] "self" is not a parameter no more --- main.py | 2 +- semantics/type_checker.py | 4 ++-- semantics/type_collector.py | 24 ++++++++++++------------ 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/main.py b/main.py index a0622414b..88b46ab86 100755 --- a/main.py +++ b/main.py @@ -83,7 +83,7 @@ class Ackermann { topological_ordering(ast, context, errors) OverriddenMethodChecker(context, errors).visit(ast) InferenceChecker(context, errors).visit(ast, scope) - # TypeChecker(context, errors).visit(ast, scope) + TypeChecker(context, errors).visit(ast, scope) # Executor(context, errors).visit(ast, scope) print(CodeBuilder().visit(ast)) diff --git a/semantics/type_checker.py b/semantics/type_checker.py index ddb6d04a8..7b5ce1541 100644 --- a/semantics/type_checker.py +++ b/semantics/type_checker.py @@ -196,13 +196,13 @@ def visit(self, node: ast.MethodCallNode, scope: Scope): self.visit(arg, scope) return ErrorType() - if len(node.args) + 1 != len(method.param_names): + if len(node.args) != len(method.param_names): self.errors.append(err.METHOD_OVERRIDE_ERROR % (method.name, obj_type.name)) if not obj_type.conforms_to(method.param_types[0]): self.errors.append(err.INCOMPATIBLE_TYPES % (obj_type.name, method.param_types[0].name)) - for i, arg in enumerate(node.args, 1): + for i, arg in enumerate(node.args): arg_type = self.visit(arg, scope) if not arg_type.conforms_to(method.param_types[i]): self.errors.append(err.INCOMPATIBLE_TYPES % (arg_type.name, method.param_types[i].name)) diff --git a/semantics/type_collector.py b/semantics/type_collector.py index 460b41a68..883f694e5 100644 --- a/semantics/type_collector.py +++ b/semantics/type_collector.py @@ -36,18 +36,18 @@ def visit(self, node): int_type.set_parent(object_type) bool_type.set_parent(object_type) - object_type.define_method('abort', ['self'], [object_type], object_type) - object_type.define_method('get_type', ['self'], [object_type], string_type) - object_type.define_method('copy', ['self'], [object_type], self_type) - - io_type.define_method('out_string', ['self', 'x'], [io_type, string_type], self_type) - io_type.define_method('out_int', ['self', 'x'], [io_type, string_type], self_type) - io_type.define_method('in_string', ['self'], [io_type], string_type) - io_type.define_method('in_int', ['self'], [io_type], int_type) - - string_type.define_method('length', ['self'], [string_type], int_type) - string_type.define_method('concat', ['self', 's'], [string_type, string_type], string_type) - string_type.define_method('substr', ['self', 'i', 'l'], [string_type, int_type, int_type], string_type) + object_type.define_method('abort', [], [], object_type) + object_type.define_method('get_type', [], [], string_type) + object_type.define_method('copy', [], [], self_type) + + io_type.define_method('out_string', ['x'], [string_type], self_type) + io_type.define_method('out_int', ['x'], [string_type], self_type) + io_type.define_method('in_string', [], [], string_type) + io_type.define_method('in_int', [], [], int_type) + + string_type.define_method('length', [], [], int_type) + string_type.define_method('concat', ['s'], [string_type], string_type) + string_type.define_method('substr', ['i', 'l'], [int_type, int_type], string_type) for declaration in node.declarations: self.visit(declaration) From fd57cbd3f0e6cbd5d3bfc5160ec68a5ee66a6d82 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Mon, 18 May 2020 10:16:49 -0400 Subject: [PATCH 041/143] Pipeline Connected until type checker --- semantics/type_checker.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/semantics/type_checker.py b/semantics/type_checker.py index 7b5ce1541..025b2a95c 100644 --- a/semantics/type_checker.py +++ b/semantics/type_checker.py @@ -199,9 +199,6 @@ def visit(self, node: ast.MethodCallNode, scope: Scope): if len(node.args) != len(method.param_names): self.errors.append(err.METHOD_OVERRIDE_ERROR % (method.name, obj_type.name)) - if not obj_type.conforms_to(method.param_types[0]): - self.errors.append(err.INCOMPATIBLE_TYPES % (obj_type.name, method.param_types[0].name)) - for i, arg in enumerate(node.args): arg_type = self.visit(arg, scope) if not arg_type.conforms_to(method.param_types[i]): From b9c0e7e1a0546c566aaa40cb42e7eec019592f0f Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Mon, 18 May 2020 12:53:29 -0400 Subject: [PATCH 042/143] Using "OrderedDict" instead of dict in "DependencyGraph". --- semantics/type_inference.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/semantics/type_inference.py b/semantics/type_inference.py index 06fb23374..2dcc7e96a 100644 --- a/semantics/type_inference.py +++ b/semantics/type_inference.py @@ -1,5 +1,16 @@ -from collections import deque -from typing import Dict, List, Tuple, Set +"""The type inference algorithm consist in a dependency di-graph with special nodes to handle the behavior of the +updates of components in the code and solve it in the `context`. For that we crate an structure called +DependencyGraph where we can create nodes as an structure called DependencyNode and arcs between them, and arc e = + where x and y are dependency nodes means that the type of node y in inferred by the type of node x, +so for solve the type of y we need first to infer the type of x. For this operation we need some basic nodes that +only contains the type of the node called AtomNode and in the digraph formation an AtomNode is never inferred from +another node. The DependencyGraph consist in a dictionary[node, adjacency list] this adjacency has an declaration +order an this is fundamental for the inference solution algorithm. If we have a case {x : [y, z]} where x, y, +z are nodes then the algorithm will determinate the type of y and all it dependencies before to start with z (a +simple BFS). The order in the adjacency list is the appearance order in the program. The Dependency graph has a list +of nodes in it's order of declaration""" +from collections import deque, OrderedDict +from typing import Dict, List, Tuple, Set, OrderedDict as OrderedDictionary import semantics.astnodes as ast import semantics.errors as err @@ -77,24 +88,21 @@ def __str__(self): class DependencyGraph: def __init__(self): - self.dependencies: Dict[DependencyNode, List[DependencyNode]] = {} - self.nodes: List[DependencyNode] = [] + self.dependencies: OrderedDictionary[DependencyNode, List[DependencyNode]] = OrderedDict() def add_node(self, node: DependencyNode): if node not in self.dependencies: self.dependencies[node] = [] - self.nodes.append(node) def add_edge(self, node: DependencyNode, other: DependencyNode): try: self.dependencies[node].append(other) except KeyError: self.dependencies[node] = [other] - self.nodes.append(node) self.add_node(other) def update_dependencies(self): - queue = deque(key for key in self.nodes if isinstance(key, AtomNode)) + queue = deque(key for key in self.dependencies if isinstance(key, AtomNode)) visited = set() while queue: From 8c35b5f172483d1f5a398ca57679b02544acf5ac Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Mon, 18 May 2020 14:08:49 -0400 Subject: [PATCH 043/143] Using "OrderedDict" instead of dict in "Type" class. --- main.py | 2 +- semantics/scope.py | 26 ++++++++++---------------- semantics/type_inference.py | 10 +++++----- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/main.py b/main.py index 88b46ab86..95b47d248 100755 --- a/main.py +++ b/main.py @@ -71,7 +71,7 @@ class Ackermann { parser = CoolParser() if __name__ == '__main__': - tokens = lexer(inference_program_02) + tokens = lexer(inference_program_01) ast = parser(tokens) context = Context() diff --git a/semantics/scope.py b/semantics/scope.py index 2b0a9d677..d7864847a 100755 --- a/semantics/scope.py +++ b/semantics/scope.py @@ -1,3 +1,4 @@ +from collections import OrderedDict from typing import List, Optional, Dict, Tuple, Union @@ -35,26 +36,21 @@ def __eq__(self, other): other.return_type == self.return_type and tuple(other.param_types) == tuple(self.param_types)) - # def __hash__(self): - # return hash((self.name, tuple(self.param_names), tuple(self.param_types), self.return_type)) - class Type: def __init__(self, name: str): self.name: str = name - self.attributes_list: List[Attribute] = [] - self.attributes_dict: Dict[str, Attribute] = {} - self.methods_list: List[Method] = [] - self.methods_dict: Dict[str, Method] = {} + self.attributes_dict: OrderedDict[str, Attribute] = OrderedDict() + self.methods_dict: OrderedDict[str, Method] = OrderedDict() self.parent: Optional['Type'] = None @property def attributes(self): - return self.attributes_list + return [x for _, x in self.attributes_dict.items()] @property def methods(self): - return self.methods_list + return [x for _, x in self.methods_dict.items()] def set_parent(self, parent: 'Type') -> None: if self.parent is not None: @@ -90,7 +86,6 @@ def define_attribute(self, name: str, typex: 'Type') -> Attribute: self.get_attribute(name) except SemanticError: attribute = Attribute(name, typex) - self.attributes_list.append(attribute) self.attributes_dict[name] = attribute return attribute else: @@ -131,7 +126,6 @@ def define_method(self, name: str, raise SemanticError(f'Method "{name}" already defined in {self.name}') method = Method(name, param_names, param_types, return_type) - self.methods_list.append(method) self.methods_dict[name] = method return method @@ -140,12 +134,12 @@ def contains_method(self, name) -> bool: def all_attributes(self) -> List[Tuple[Attribute, 'Type']]: attributes = [] if self.parent is None else self.parent.all_attributes() - attributes += [(x, self) for x in self.attributes_list] + attributes += [(x, self) for x in self.attributes] return attributes def all_methods(self) -> List[Tuple[Method, 'Type']]: methods = [] if self.parent is None else self.parent.all_methods() - methods += [(x, self) for x in self.methods_list] + methods += [(x, self) for x in self.methods] return methods def conforms_to(self, other: 'Type') -> bool: @@ -181,10 +175,10 @@ def __str__(self): parent = '' if self.parent is None else f' : {self.parent.name}' output += parent output += ' {' - output += '\n\t' if self.attributes_list or self.methods_list else '' - output += '\n\t'.join(str(x) for x in self.attributes_list) + output += '\n\t' if self.attributes or self.methods else '' + output += '\n\t'.join(str(x) for x in self.attributes) output += '\n\t' if self.attributes_dict else '' - output += '\n\t'.join(str(x) for x in self.methods_list) + output += '\n\t'.join(str(x) for x in self.methods) output += '\n' if self.methods_dict else '' output += '}\n' return output diff --git a/semantics/type_inference.py b/semantics/type_inference.py index 2dcc7e96a..3762316bb 100644 --- a/semantics/type_inference.py +++ b/semantics/type_inference.py @@ -7,10 +7,10 @@ another node. The DependencyGraph consist in a dictionary[node, adjacency list] this adjacency has an declaration order an this is fundamental for the inference solution algorithm. If we have a case {x : [y, z]} where x, y, z are nodes then the algorithm will determinate the type of y and all it dependencies before to start with z (a -simple BFS). The order in the adjacency list is the appearance order in the program. The Dependency graph has a list -of nodes in it's order of declaration""" +simple BFS). The order in the adjacency list is the same appearance order in the program. At the end of the algorithm +all node that cannot solve it type will be tagged as `Object`""" from collections import deque, OrderedDict -from typing import Dict, List, Tuple, Set, OrderedDict as OrderedDictionary +from typing import Dict, List, Tuple, Set import semantics.astnodes as ast import semantics.errors as err @@ -88,7 +88,7 @@ def __str__(self): class DependencyGraph: def __init__(self): - self.dependencies: OrderedDictionary[DependencyNode, List[DependencyNode]] = OrderedDict() + self.dependencies: OrderedDict[DependencyNode, List[DependencyNode]] = OrderedDict() def add_node(self, node: DependencyNode): if node not in self.dependencies: @@ -124,7 +124,7 @@ def update_dependencies_of(self, node: DependencyNode, typex: Type, visited: Set queue.extend(self.dependencies[current_node]) def __str__(self): - return '\n'.join(f'{key}: {value}' for key, value in self.dependencies.items()) + return '{\n' + '\n'.join(f'{key}: {value}' for key, value in self.dependencies.items()) + '}' class InferenceChecker: From 01feb144291564d8800e5534c5e169ce0a0b7226 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Mon, 18 May 2020 23:11:19 -0400 Subject: [PATCH 044/143] Default type inference created, Paper Updated --- docs/Informe.md | 239 ++++++++++++++++++++++++++++++++++++ main.py | 30 ++++- semantics/temp/Informe.md | 182 --------------------------- semantics/type_inference.py | 40 +++++- 4 files changed, 303 insertions(+), 188 deletions(-) create mode 100644 docs/Informe.md delete mode 100644 semantics/temp/Informe.md diff --git a/docs/Informe.md b/docs/Informe.md new file mode 100644 index 000000000..488b74feb --- /dev/null +++ b/docs/Informe.md @@ -0,0 +1,239 @@ +

+ +# Segundo Proyecto de Programacion + +## Inferencia de tipos en el lenguaje de programacion *COOL*, una aproximacion a traves de grafos + +
+ +El lenguaje de programacion COOL es un lenguaje de programacion estaticamente tipado, y aunque el lenguaje no presenta inferencia de tipos esta es una caracteristica muy util que incorporaremos en un nuestro interprete. + +Nuestro algoritmo de inferencia de tipos se apoya en el uso basico de la teoria de grafos y en el uso del patron de diseno visitor. + +La inferencia de tipos de nuestro proyecto detecta para cada atributo, variable, parametro de funcion o retorno de funcion el primer tipo que le puede ser asignado, modificando en el arbol de sintaxis abstracta el string `AUTO_TYPE` por el nombre del tipo correspondiente y asignando los tipos correspondientes en el contexto y el ambito en que seon declarados. + +### El algoritmo + +***Entrada :*** Un arbol de sintaxis abstracta, un contexto con todos los tipos declarados en el programa de COOL. + +***Salida :*** Un Arbol de Sintaxis Abstracta, Un Contexto y un Scope con tipos bien tagueados. + +***Algoritmo :*** Durante el recorrido del AST sera construido un grafo dirigido cuyos nodo encerraran el concepto de las expresiones marcadas com `AUTO_TYPE` y las aristas representan las dependencias entre las expresiones de estos nodos para inferir su tipo. Sea E1 una expresion cuyo tipo estatico es marcado como AUTO_TYPE, y sea E2 una expresion a partir de a cual se puede inferir el tipo de estatico de E1 entonces en el grafo existira la arista . Una vez construido el arbol Se comenzara una cadena de expansion de tipos estaticos de la forma E1, E2, ..., En donde Ej se infiere de Ei con `1 < j = i + 1 <= n` y E1 es una expresion con tipo estatico definido, al cual llamaremos atomo. Cuando todos los atomos se hayan propagado a traves del grafo los nodos que no hayan podido ser resueltos seran marcados como tipos `Object` al ser esta la clase mas general del lenguaje. + +### Sistemas de nodos + +Cada nodo del grafo sera una abstraccion de un concepto en el que se use un tagueo explicito de `AUTO_TYPE` y tendra las referencias a las partes del proceso de semantica del programa, ademas de que cada nodo contara con un metodo `update(type)` el cual actualiza el tipo estatico de estos conceptos. + +### Jerarquia de nodos + +```python +class DependencyNode: + pass + +class AtomNode(DependencyNode): + """Nodo base el cual es creado a partir de expresiones que + contienen tipo estatico u operaciones aritmeticas""" + pass + +class AttributeNode(DependencyNode): + """Atributo de una clase""" + pass + +class ParameterNode(DependencyNode): + """Parametro de una funcion""" + pass + +class ReturnTypeNode(DependencyNode): + """Tipo de retorno de una funcion""" + pass + +class VariableInfoNode(DependencyNode): + """Variables declaradas en el scope.""" + pass +``` + +### Casos factibles + +Funcionando de manera analoga para atributos, variables, parametros y retorno de funciones. Explicado de forma recursiva puede ser visto como: + +- Un `AUTO_TYPE` sera sustituido por su tipo correspodiente si este forma parte de una operacion que permita saber su tipo, o es asignado a una expresion de la cual es posible determinar su tipo. + +- Es importante senalar en que contexto estas dependencias son tomadas en cuenta: + + - Para los atributos marcados como autotype su tipo podra ser determinado dentro del cuerpo de cualquiera de las funciones de la clase o si es detectable el tipo de la expresion de inicializacion. + + - Para las variables su tipo sera determinado dentro del scope donde estas son validas. + +- Para los parametros su tipo sera determinado dentro del cuerpo de la funcion o cuando esta sea funcion sea llamada a traves de una operacion de dispatch. + +- Para los retornos de funciones, su tipo sera determinado con su expresion y los llamados a dicha funcion a traves de una operacion de dispatch. + +### Ejemplos de casos Factibles para la Inferencia + +```csharp +class Main inherits IO { + function(a: AUTO_TYPE, b: AUTO_TYPE, c: AUTO_TYPE, d: AUTO_TYPE): AUTO_TYPE { + { + a <- b; + b <- c; + c <- d; + d <- a; + d + 1; + if a < 10 then a else b fi; + } + }; +} +``` + +```csharp +class Point { + a: AUTO_TYPE; + b: AUTO_TYPE; + + init(x: AUTO_TYPE, y: AUTO_TYPE): AUTO_TYPE {{ + a <- b; + b <- x + y; + create_point(); + }}; + + create_point(): AUTO_TYPE { new Point }; +} +``` + +```csharp +class Main inherits IO { + function(a: AUTO_TYPE): AUTO_TYPE { + if a < 10 then f(a) else f(b) fi; + }; + + f(a :AUTO_TYPE): AUTO_TYPE{ + if a < 3 then 1 else f(a - 1) + f(a - 2) fi + }; +} +``` + +```csharp +class Main inherits IO { + + b: AUTO_TYPE; + c: AUTO_TYPE <- "1"; + d: AUTO_TYPE; + + function(a: AUTO_TYPE): AUTO_TYPE { + { + b <- a; + d + 1; + if a < 10 then f(a) else f(b) fi; + } + }; + + f(a: AUTO_TYPE): AUTO_TYPE { + if a < 3 then 1 else f(a - 1) + f(a - 2) fi + }; +} +``` + +```csharp +class Ackermann { + ackermann(m: AUTO_TYPE, n: AUTO_TYPE): AUTO_TYPE { + if m = 0 then n + 1 else + if n = 0 then ackermann(m - 1, 1) else + ackermann(m - 1, ackermann(m, n - 1)) + fi + fi + }; +} +``` + +### Casos No factibles + +No es posible determinar el tipo de una variable, atributo, parametro, o retorno de funcion si para este se cumple el Caso general y su caso especifico correspondiente. En caso de no poderse determinar el tipo por defecto sera tagueado como `AUTO_TYPE`. + +### Caso general + +El tipo es utilizado en expresiones que no permiten determinar su tipo, o solo se logra determinar que poseen el mismo tipo que otras variables, atributos, parametros o retorno de funciones de las cuales tampoco se puede determinar el mismo. + +```csharp +class Main inherits IO { + b: AUTO_TYPE; + c: AUTO_TYPE; + + function(a: AUTO_TYPE, d: AUTO_TYPE): AUTO_TYPE { + { + b <- a; + d <- c; + f(a); + } + }; + + f(a: AUTO_TYPE): AUTO_TYPE { + if a < 3 then 1 else f(a - 1) fi + }; +} +``` + +En este ejemplo solo es posible inferir el typo del parametro `a` de la funcion `f`, el resto sera marcado como `Object`. + +### Casos Particulares + +***Para variables:*** si estas no son utilizadas en el ambito en que son marcadas como `Object`. + +```csharp +class Main inherits IO { + function(): Int { + let a:AUTOTYPE, b:AUTO_TYPE in { + 1; + } + }; +} +``` + +***Para parametros:*** si dentro del cuerpo de la funcion estas no son utilizadas y no existe otra funcion que llame a esta con argumetnos con tipado estatico definidos seran marcadas como `Object`: + +```csharp +class Main inherits IO { + f(a: AUTO_TYPE): Int{ + 1 + }; +} +``` + +***Para atributos:*** si no es posible determinar el tipo de la expresion de inicializacion o si dentro del cuerpo de todas las funciones de su clase correspondiente este no son utilizadas, seran marcadas como `Objects`. + +```csharp +class Main inherits IO { + + b: AUTO_TYPE <- c; + c: AUTO_TYPE <- b; + + f(a: AUTO_TYPE): AUTO_TYPE{ + if a < 3 then 1 else f(a - 1) + f(a - 2) fi + }; +} +``` + +***Para el retorno de funciones:*** si no es posible determinar el tipo de su expresion. + +```csharp +class Main inherits IO { + f(a: Int): AUTO_TYPE{ + if a<3 then a else f(a-3) fi + }; +} +``` + +#### Expresiones de las cuales es posible determinar su tipo + +- Valores Constantes. + +- Operaciones aritmeticas. + +- Operaciones logicas. + +- Llamdos a funciones con valor de retorno conocido. + +- Instancias de clases. + +- Variables de las cuales se conoce su tipo. + +- Bloques donde se puede determinar el tipo de la ultima expresion. diff --git a/main.py b/main.py index 95b47d248..09d14a535 100755 --- a/main.py +++ b/main.py @@ -67,11 +67,39 @@ class Ackermann { } """ +inference_program_03 = r""" +class Main { + f(a: AUTO_TYPE, b: AUTO_TYPE): AUTO_TYPE { + if a = 1 then b else + g(a + 1, b / 1) + fi + }; + + g(a: AUTO_TYPE, b: AUTO_TYPE): AUTO_TYPE { + if b = 1 then a else + f(a / 2, b + 1) + fi + }; +} +""" + +inference_program_04 = r""" +class Main inherits IO { + f(a: Int): Int { + f(a) + }; + + g(a: AUTO_TYPE): Int{ + 1 + }; +} +""" + lexer = CoolLexer() parser = CoolParser() if __name__ == '__main__': - tokens = lexer(inference_program_01) + tokens = lexer(inference_program_04) ast = parser(tokens) context = Context() diff --git a/semantics/temp/Informe.md b/semantics/temp/Informe.md deleted file mode 100644 index b18b8e5ff..000000000 --- a/semantics/temp/Informe.md +++ /dev/null @@ -1,182 +0,0 @@ -# Cool Interpreter for compiling class Type Inference - -La inferencia de tipos de nuestro proyecto detecta para cada atributo variable -o retorno de funcion el primer tipo que le puede ser asignado, -cambiando en el arbol de sintaxis abstracta el string AUTO_TYPE por -el nombre del tipo correspondiente. - -## Casos factibles: - - -Funcionamdo de manera analoga, tanto para atributos, varibales, parametros -y retorno de funciones. Explicado de forma recursiva puede ser visto como: - -Un AUTO_TYPE sera sustituido por su tipo correspodiente si este forma -parte de una operacion que permita saber su tipo; o es asignado a -una expresion de la cual es posible determinar su tipo. - -Es importante senalar en que contexto estas dependencias son tomadas en cuenta: - - - Para los atributos marcados como autotype su tipo podra ser determinado dentro del cuerpo de cualquiera de las funciones de la clase o si es detectable el tipo de la expresion de inicializacion. - - - Para las variables su tipo sera determinado dentro del scope donde estas - son validas. - - . Para los parametros, su tipo sera determinado solo dentro del cuerpo de la funcion. - - . Para los retornos de funciones, su tipo sera determinado con su expresion y los llamados a dicha - funcion. - - Ejemplos de casos Factibles para la Inferencia: - - - - ```text -class Main inherits IO { - function(a: AUTO_TYPE, b: AUTO_TYPE, c: AUTO_TYPE, d: AUTO_TYPE): AUTO_TYPE { - { - a<-b; - b<-c; - c<-d; - d<-a; - d+1; - if a< 10 then a else b fi; - } - }; -} -``` - - ```text -class Main inherits IO { - function(a: AUTO_TYPE): AUTO_TYPE { - { - if a< 10 then f(a) else f(b) fi; - } - }; - - f(a :AUTO_TYPE): AUTO_TYPE{ - if a<3 then 1 else f(a-1) + f(a-2) fi - }; -} -``` - -```text -class Main inherits IO { - - b: AUTO_TYPE; - c: AUTO_TYPE <-"1"; - d: AUTO_TYPE; - function(a: AUTO_TYPE): AUTO_TYPE { - { - b<-a; - d+1; - if a< 10 then f(a) else f(b) fi; - } - }; - - f(a: AUTO_TYPE): AUTO_TYPE{ - if a<3 then 1 else f(a-1) + f(a-2) fi - }; -} -``` - Casos No factibles: - - - No es posible determinar el tipo de una variable, atributo, parametro, - o retorno de funcion si para este se cumple el Caso general y su caso - especifico correspondiente. - - Caso general: - - - - El tipo es utilizado en expresiones que no permiten determinar su tipo, - o solo se logra determinar que poseen el mismo tipo que otras variables, - atributos, parametros o retorno de funciones de las cuales tampoco se - puede determinar el mismo. - - ```text -class Main inherits IO { - - b: AUTO_TYPE; - c: AUTO_TYPE; - function(a: AUTO_TYPE, d: AUTO_TYPE): AUTO_TYPE { - { - b<-a; - d<-c; - f(a); - } - }; - - f(a: AUTO_TYPE): AUTO_TYPE{ - if a<3 then 1 else f(a-1) fi - }; -} -``` -En este ejemplo solo es posible inferir el typo del parametro 'a' de la -funcion f. - - Casos Particulares: - - - . Para variables: si estas no son utilizadas en el ambito en que son validas. - ```text -class Main inherits IO { - function(): int { - let a:AUTOTYPE, b:AUTO_TYPE in { - 1; - } - }; -} -``` - - . Para argumentos: si dentro del cuerpo de la funcion estas no son utilizadas. - ```text -class Main inherits IO { - function(a: Int): Int { - f(a) - }; - - f(a: AUTO_TYPE): Int{ - 1 - }; -} -``` - - . Para atributos: si no es posible determinar el tipo de la expresion de - inicializacion o si dentro del cuerpo de todas las funciones de su clase - correspondiente este no son utilizadas. - ```text -class Main inherits IO { - - b: AUTO_TYPE <- c; - c: AUTO_TYPE <- b; - - f(a: AUTO_TYPE): AUTO_TYPE{ - if a<3 then 1 else f(a-1) + f(a-2) fi - }; -} -``` - - . Para el retorno de funciones: si no es posible determinar el tipo de su expresion. - ```text -class Main inherits IO { - f(a: Int): AUTO_TYPE{ - if a<3 then a else f(a-3) fi - }; -} -``` - - Expresiones de las cuales es posible determinar su tipo: - - - - .Valores Constantes. - - .Operaciones aritmeticas. - - .Operaciones logicas. - - .Llamdos a funciones con valor de retorno conocido. - - .Instancias de clases. - - .Variables de las cuales se conoce su tipo. - - .Bloques donde se puede determinar el tipo de la ultima expresion. - \ No newline at end of file diff --git a/semantics/type_inference.py b/semantics/type_inference.py index 3762316bb..32963514c 100644 --- a/semantics/type_inference.py +++ b/semantics/type_inference.py @@ -8,7 +8,32 @@ order an this is fundamental for the inference solution algorithm. If we have a case {x : [y, z]} where x, y, z are nodes then the algorithm will determinate the type of y and all it dependencies before to start with z (a simple BFS). The order in the adjacency list is the same appearance order in the program. At the end of the algorithm -all node that cannot solve it type will be tagged as `Object`""" +all node that cannot solve it type will be tagged as `Object`. + +DependencyNode hierarchy + AtomNode + - type : Node type + + VariableInfoNode + - type: Node type + - variable_type : Reference to the variable info of the scope + + AttributeNode + - type : Node type + - attribute : Reference to the attribute of the class + + ParameterNode + - type : Node type + - method : Reference to the method of the class + - index : Index of the parameter of the method + + ReturnTypeNode + - type : Node type + - method : Reference to the method of the class + +All nodes has an implementation of the method update that handle how to update the type by it's dependencies + +""" from collections import deque, OrderedDict from typing import Dict, List, Tuple, Set @@ -101,7 +126,7 @@ def add_edge(self, node: DependencyNode, other: DependencyNode): self.dependencies[node] = [other] self.add_node(other) - def update_dependencies(self): + def update_dependencies(self, default_type: Type = None): queue = deque(key for key in self.dependencies if isinstance(key, AtomNode)) visited = set() @@ -111,6 +136,11 @@ def update_dependencies(self): continue self.update_dependencies_of(current_node, current_node.type, visited) + if default_type is not None: + for node in self.dependencies: + if node not in visited: + node.update(default_type) + def update_dependencies_of(self, node: DependencyNode, typex: Type, visited: Set[DependencyNode]): queue = deque([node] + self.dependencies[node]) while queue: @@ -173,8 +203,7 @@ def visit(self, node: ast.ProgramNode, scope: Scope = None): for item in node.declarations: self.visit(item, scope.create_child()) - # print(self.graph) - self.graph.update_dependencies() + self.graph.update_dependencies(default_type=self.context.get_type('Object')) InferenceTypeSubstitute(self.context, self.errors).visit(node, scope) @visitor.when(ast.ClassDeclarationNode) @@ -257,6 +286,7 @@ def visit(self, node: ast.LetNode, scope: Scope): @visitor.when(ast.VarDeclarationNode) def visit(self, node: ast.VarDeclarationNode, scope: Scope): try: + # Define and get the var_info var_info = scope.define_variable(node.id, self.context.get_type(node.type)) except SemanticError: var_info = scope.define_variable(node.id, ErrorType()) @@ -265,6 +295,7 @@ def visit(self, node: ast.VarDeclarationNode, scope: Scope): expr_node = self.visit(node.expr, scope.create_child()) if node.expr is not None else None if var_info.type.name == 'AUTO_TYPE': + # Create an edge only if is AutoType self.graph.add_edge(expr_node, var_info_node) @visitor.when(ast.AssignNode) @@ -276,7 +307,6 @@ def visit(self, node: ast.AssignNode, scope: Scope): if var_info is not None: self.graph.add_edge(expr_node, self.variables[var_info]) else: - # Maybe some error pass return expr_node From eef219018f757d1a3b23f1231b591bdf3d917678 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Mon, 18 May 2020 23:14:01 -0400 Subject: [PATCH 045/143] README.md updated --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 80f1e0355..18f6cbf3d 100755 --- a/README.md +++ b/README.md @@ -1 +1,7 @@ -# Cool Interpreter for compiling class +# Cool Interpreter with type inference for compiling class + +## University of Havana, Faculty of Matcom, Computer Science, 3rd year + +### Students + - Alejandro Klever Clemente + - Miguel Angel Gonzalez Calles From 826d6a94411cd3d0ee103767a75241c1ed1e0ce5 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Mon, 18 May 2020 23:17:31 -0400 Subject: [PATCH 046/143] README.md updated --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 18f6cbf3d..f7d622591 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # Cool Interpreter with type inference for compiling class -## University of Havana, Faculty of Matcom, Computer Science, 3rd year +## University of Havana, Matcom Faculty, Computer Science, 3rd year ### Students - - Alejandro Klever Clemente - - Miguel Angel Gonzalez Calles + + - Alejandro Klever Clemente C-311 + - Miguel Angel Gonzalez Calles C-311 From 401592b7d5efb1e4efe94fddaa64dafcbf5f05d7 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Mon, 18 May 2020 23:40:19 -0400 Subject: [PATCH 047/143] added non terminal "not-empty-expr-list" to the grammar --- grammar.py | 11 +- main.py | 2 +- parser.py | 2401 +++++++++++++++++++++++++--------------------------- 3 files changed, 1177 insertions(+), 1237 deletions(-) diff --git a/grammar.py b/grammar.py index 7c2d67c5b..c77df5714 100755 --- a/grammar.py +++ b/grammar.py @@ -22,6 +22,7 @@ case_list = G.add_non_terminal('case-list') function_call = G.add_non_terminal('function-call') expr_list = G.add_non_terminal('expr-list') +not_empty_expr_list = G.add_non_terminal('not-empty-expr-list') expr = G.add_non_terminal('expr') comp = G.add_non_terminal('comp') arith = G.add_non_terminal('arith') @@ -198,12 +199,10 @@ def lexical_error(lexer): function_call %= 'atom . id ( expr-list )', lambda s: ast.MethodCallNode(s[3], s[5], s[1]) function_call %= 'atom @ type . id ( expr-list )', lambda s: ast.MethodCallNode(s[5], s[7], s[1], s[3]) -function_call %= 'id ( )', lambda s: ast.MethodCallNode(s[1], []) -function_call %= 'atom . id ( )', lambda s: ast.MethodCallNode(s[3], [], s[1]) -function_call %= 'atom @ type . id ( )', lambda s: ast.MethodCallNode(s[5], [], s[1], s[3]) - -expr_list %= 'expr', lambda s: [s[1]] -expr_list %= 'expr , expr-list', lambda s: [s[1]] + s[3] +expr_list %= '', lambda s: [] +expr_list %= 'not-empty-expr-list', lambda s: s[1] +not_empty_expr_list %= 'expr', lambda s: [s[1]] +not_empty_expr_list %= 'expr , not-empty-expr-list', lambda s: [s[1]] + s[3] ##################### # Error Productions # diff --git a/main.py b/main.py index 09d14a535..94281d3b1 100755 --- a/main.py +++ b/main.py @@ -86,7 +86,7 @@ class Main { inference_program_04 = r""" class Main inherits IO { f(a: Int): Int { - f(a) + g(a) }; g(a: AUTO_TYPE): Int{ diff --git a/parser.py b/parser.py index 373008467..f716c554f 100755 --- a/parser.py +++ b/parser.py @@ -16,130 +16,133 @@ def __action_table(): (0, G["class"]): ("SHIFT", 1), (1, G["type"]): ("SHIFT", 2), (2, G["{"]): ("SHIFT", 3), - (2, G["inherits"]): ("SHIFT", 144), - (3, G["}"]): ("REDUCE", G["feature-list -> e"]), + (2, G["inherits"]): ("SHIFT", 142), (3, G["id"]): ("SHIFT", 4), - (4, G[":"]): ("SHIFT", 128), + (3, G["}"]): ("REDUCE", G["feature-list -> e"]), + (4, G[":"]): ("SHIFT", 126), (4, G["("]): ("SHIFT", 5), + (5, G["id"]): ("SHIFT", 114), (5, G[")"]): ("SHIFT", 6), - (5, G["id"]): ("SHIFT", 116), (6, G[":"]): ("SHIFT", 7), (7, G["type"]): ("SHIFT", 8), (8, G["{"]): ("SHIFT", 9), - (9, G["string"]): ("SHIFT", 34), - (9, G["id"]): ("SHIFT", 32), - (9, G["let"]): ("SHIFT", 14), - (9, G["int"]): ("SHIFT", 35), - (9, G["while"]): ("SHIFT", 13), - (9, G["isvoid"]): ("SHIFT", 24), - (9, G["not"]): ("SHIFT", 31), - (9, G["if"]): ("SHIFT", 12), - (9, G["new"]): ("SHIFT", 22), + (9, G["false"]): ("SHIFT", 26), + (9, G["not"]): ("SHIFT", 30), (9, G["{"]): ("SHIFT", 10), - (9, G["case"]): ("SHIFT", 21), + (9, G["id"]): ("SHIFT", 31), + (9, G["true"]): ("SHIFT", 25), + (9, G["string"]): ("SHIFT", 33), (9, G["("]): ("SHIFT", 11), + (9, G["new"]): ("SHIFT", 22), + (9, G["if"]): ("SHIFT", 12), + (9, G["while"]): ("SHIFT", 13), + (9, G["let"]): ("SHIFT", 14), + (9, G["int"]): ("SHIFT", 34), (9, G["~"]): ("SHIFT", 27), - (9, G["true"]): ("SHIFT", 25), - (9, G["false"]): ("SHIFT", 26), - (10, G["true"]): ("SHIFT", 25), - (10, G["false"]): ("SHIFT", 26), - (10, G["id"]): ("SHIFT", 32), - (10, G["string"]): ("SHIFT", 34), - (10, G["let"]): ("SHIFT", 14), - (10, G["while"]): ("SHIFT", 13), - (10, G["isvoid"]): ("SHIFT", 24), + (9, G["isvoid"]): ("SHIFT", 24), + (9, G["case"]): ("SHIFT", 21), + (10, G["("]): ("SHIFT", 11), + (10, G["new"]): ("SHIFT", 22), (10, G["if"]): ("SHIFT", 12), - (10, G["not"]): ("SHIFT", 31), - (10, G["int"]): ("SHIFT", 35), - (10, G["{"]): ("SHIFT", 10), + (10, G["while"]): ("SHIFT", 13), + (10, G["let"]): ("SHIFT", 14), + (10, G["int"]): ("SHIFT", 34), + (10, G["id"]): ("SHIFT", 31), (10, G["case"]): ("SHIFT", 21), - (10, G["new"]): ("SHIFT", 22), + (10, G["false"]): ("SHIFT", 26), + (10, G["not"]): ("SHIFT", 30), + (10, G["{"]): ("SHIFT", 10), + (10, G["true"]): ("SHIFT", 25), + (10, G["string"]): ("SHIFT", 33), (10, G["~"]): ("SHIFT", 27), - (10, G["("]): ("SHIFT", 11), - (11, G["isvoid"]): ("SHIFT", 24), - (11, G["int"]): ("SHIFT", 35), - (11, G["new"]): ("SHIFT", 22), - (11, G["~"]): ("SHIFT", 27), - (11, G["("]): ("SHIFT", 11), - (11, G["id"]): ("SHIFT", 32), + (10, G["isvoid"]): ("SHIFT", 24), (11, G["let"]): ("SHIFT", 14), - (11, G["while"]): ("SHIFT", 13), - (11, G["not"]): ("SHIFT", 31), - (11, G["if"]): ("SHIFT", 12), - (11, G["true"]): ("SHIFT", 25), + (11, G["id"]): ("SHIFT", 31), + (11, G["string"]): ("SHIFT", 33), + (11, G["case"]): ("SHIFT", 21), + (11, G["not"]): ("SHIFT", 30), (11, G["{"]): ("SHIFT", 10), + (11, G["("]): ("SHIFT", 11), + (11, G["new"]): ("SHIFT", 22), + (11, G["int"]): ("SHIFT", 34), (11, G["false"]): ("SHIFT", 26), - (11, G["case"]): ("SHIFT", 21), - (11, G["string"]): ("SHIFT", 34), + (11, G["~"]): ("SHIFT", 27), + (11, G["isvoid"]): ("SHIFT", 24), + (11, G["true"]): ("SHIFT", 25), + (11, G["if"]): ("SHIFT", 12), + (11, G["while"]): ("SHIFT", 13), + (12, G["let"]): ("SHIFT", 14), + (12, G["id"]): ("SHIFT", 31), + (12, G["case"]): ("SHIFT", 21), + (12, G["not"]): ("SHIFT", 30), + (12, G["{"]): ("SHIFT", 10), + (12, G["string"]): ("SHIFT", 33), (12, G["("]): ("SHIFT", 11), + (12, G["new"]): ("SHIFT", 22), + (12, G["~"]): ("SHIFT", 27), + (12, G["int"]): ("SHIFT", 34), (12, G["isvoid"]): ("SHIFT", 24), - (12, G["true"]): ("SHIFT", 25), - (12, G["id"]): ("SHIFT", 32), (12, G["false"]): ("SHIFT", 26), - (12, G["let"]): ("SHIFT", 14), - (12, G["~"]): ("SHIFT", 27), - (12, G["string"]): ("SHIFT", 34), - (12, G["while"]): ("SHIFT", 13), (12, G["if"]): ("SHIFT", 12), - (12, G["not"]): ("SHIFT", 31), - (12, G["{"]): ("SHIFT", 10), - (12, G["int"]): ("SHIFT", 35), - (12, G["case"]): ("SHIFT", 21), - (12, G["new"]): ("SHIFT", 22), - (13, G["id"]): ("SHIFT", 32), - (13, G["int"]): ("SHIFT", 35), - (13, G["let"]): ("SHIFT", 14), + (12, G["while"]): ("SHIFT", 13), + (12, G["true"]): ("SHIFT", 25), + (13, G["false"]): ("SHIFT", 26), + (13, G["~"]): ("SHIFT", 27), + (13, G["isvoid"]): ("SHIFT", 24), + (13, G["id"]): ("SHIFT", 31), + (13, G["true"]): ("SHIFT", 25), + (13, G["string"]): ("SHIFT", 33), (13, G["while"]): ("SHIFT", 13), - (13, G["new"]): ("SHIFT", 22), (13, G["if"]): ("SHIFT", 12), - (13, G["not"]): ("SHIFT", 31), - (13, G["~"]): ("SHIFT", 27), + (13, G["let"]): ("SHIFT", 14), (13, G["("]): ("SHIFT", 11), - (13, G["{"]): ("SHIFT", 10), + (13, G["new"]): ("SHIFT", 22), (13, G["case"]): ("SHIFT", 21), - (13, G["true"]): ("SHIFT", 25), - (13, G["false"]): ("SHIFT", 26), - (13, G["string"]): ("SHIFT", 34), - (13, G["isvoid"]): ("SHIFT", 24), + (13, G["not"]): ("SHIFT", 30), + (13, G["{"]): ("SHIFT", 10), + (13, G["int"]): ("SHIFT", 34), (14, G["id"]): ("SHIFT", 15), (15, G[":"]): ("SHIFT", 16), (16, G["type"]): ("SHIFT", 17), (17, G["<-"]): ("SHIFT", 20), - (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), (17, G[","]): ("SHIFT", 18), + (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), (18, G["id"]): ("SHIFT", 15), (19, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), - (20, G["new"]): ("SHIFT", 22), - (20, G["("]): ("SHIFT", 11), - (20, G["id"]): ("SHIFT", 32), - (20, G["let"]): ("SHIFT", 14), + (20, G["~"]): ("SHIFT", 27), + (20, G["if"]): ("SHIFT", 12), (20, G["while"]): ("SHIFT", 13), + (20, G["("]): ("SHIFT", 11), (20, G["isvoid"]): ("SHIFT", 24), - (20, G["not"]): ("SHIFT", 31), - (20, G["true"]): ("SHIFT", 25), - (20, G["if"]): ("SHIFT", 12), + (20, G["new"]): ("SHIFT", 22), + (20, G["let"]): ("SHIFT", 14), + (20, G["id"]): ("SHIFT", 31), + (20, G["case"]): ("SHIFT", 21), + (20, G["int"]): ("SHIFT", 34), + (20, G["not"]): ("SHIFT", 30), (20, G["{"]): ("SHIFT", 10), (20, G["false"]): ("SHIFT", 26), - (20, G["case"]): ("SHIFT", 21), - (20, G["string"]): ("SHIFT", 34), - (20, G["~"]): ("SHIFT", 27), - (20, G["int"]): ("SHIFT", 35), - (21, G["~"]): ("SHIFT", 27), - (21, G["true"]): ("SHIFT", 25), - (21, G["id"]): ("SHIFT", 32), + (20, G["true"]): ("SHIFT", 25), + (20, G["string"]): ("SHIFT", 33), (21, G["let"]): ("SHIFT", 14), - (21, G["false"]): ("SHIFT", 26), - (21, G["string"]): ("SHIFT", 34), - (21, G["while"]): ("SHIFT", 13), - (21, G["not"]): ("SHIFT", 31), - (21, G["if"]): ("SHIFT", 12), - (21, G["{"]): ("SHIFT", 10), - (21, G["int"]): ("SHIFT", 35), + (21, G["id"]): ("SHIFT", 31), (21, G["case"]): ("SHIFT", 21), - (21, G["isvoid"]): ("SHIFT", 24), - (21, G["new"]): ("SHIFT", 22), (21, G["("]): ("SHIFT", 11), + (21, G["not"]): ("SHIFT", 30), + (21, G["{"]): ("SHIFT", 10), + (21, G["new"]): ("SHIFT", 22), + (21, G["int"]): ("SHIFT", 34), + (21, G["false"]): ("SHIFT", 26), + (21, G["true"]): ("SHIFT", 25), + (21, G["~"]): ("SHIFT", 27), + (21, G["isvoid"]): ("SHIFT", 24), + (21, G["if"]): ("SHIFT", 12), + (21, G["while"]): ("SHIFT", 13), + (21, G["string"]): ("SHIFT", 33), (22, G["type"]): ("SHIFT", 23), + (23, G["}"]): ("REDUCE", G["atom -> new type"]), + (23, G["/"]): ("REDUCE", G["atom -> new type"]), + (23, G["of"]): ("REDUCE", G["atom -> new type"]), (23, G["<"]): ("REDUCE", G["atom -> new type"]), (23, G[")"]): ("REDUCE", G["atom -> new type"]), (23, G["then"]): ("REDUCE", G["atom -> new type"]), @@ -148,28 +151,28 @@ def __action_table(): (23, G["else"]): ("REDUCE", G["atom -> new type"]), (23, G["="]): ("REDUCE", G["atom -> new type"]), (23, G[","]): ("REDUCE", G["atom -> new type"]), - (23, G["/"]): ("REDUCE", G["atom -> new type"]), (23, G["fi"]): ("REDUCE", G["atom -> new type"]), (23, G[";"]): ("REDUCE", G["atom -> new type"]), (23, G["loop"]): ("REDUCE", G["atom -> new type"]), (23, G["@"]): ("REDUCE", G["atom -> new type"]), + (23, G["error"]): ("REDUCE", G["atom -> new type"]), (23, G["pool"]): ("REDUCE", G["atom -> new type"]), (23, G["+"]): ("REDUCE", G["atom -> new type"]), (23, G["-"]): ("REDUCE", G["atom -> new type"]), - (23, G["error"]): ("REDUCE", G["atom -> new type"]), (23, G["in"]): ("REDUCE", G["atom -> new type"]), (23, G["*"]): ("REDUCE", G["atom -> new type"]), - (23, G["}"]): ("REDUCE", G["atom -> new type"]), - (23, G["of"]): ("REDUCE", G["atom -> new type"]), + (24, G["string"]): ("SHIFT", 33), + (24, G["isvoid"]): ("SHIFT", 24), (24, G["true"]): ("SHIFT", 25), (24, G["new"]): ("SHIFT", 22), + (24, G["("]): ("SHIFT", 11), (24, G["false"]): ("SHIFT", 26), (24, G["~"]): ("SHIFT", 27), - (24, G["string"]): ("SHIFT", 34), (24, G["id"]): ("SHIFT", 28), - (24, G["("]): ("SHIFT", 11), - (24, G["isvoid"]): ("SHIFT", 24), - (24, G["int"]): ("SHIFT", 35), + (24, G["int"]): ("SHIFT", 34), + (25, G["}"]): ("REDUCE", G["atom -> true"]), + (25, G["/"]): ("REDUCE", G["atom -> true"]), + (25, G["of"]): ("REDUCE", G["atom -> true"]), (25, G["<"]): ("REDUCE", G["atom -> true"]), (25, G[")"]): ("REDUCE", G["atom -> true"]), (25, G["then"]): ("REDUCE", G["atom -> true"]), @@ -178,19 +181,19 @@ def __action_table(): (25, G["else"]): ("REDUCE", G["atom -> true"]), (25, G["="]): ("REDUCE", G["atom -> true"]), (25, G[","]): ("REDUCE", G["atom -> true"]), - (25, G["/"]): ("REDUCE", G["atom -> true"]), (25, G["fi"]): ("REDUCE", G["atom -> true"]), (25, G[";"]): ("REDUCE", G["atom -> true"]), (25, G["loop"]): ("REDUCE", G["atom -> true"]), (25, G["@"]): ("REDUCE", G["atom -> true"]), + (25, G["error"]): ("REDUCE", G["atom -> true"]), (25, G["pool"]): ("REDUCE", G["atom -> true"]), (25, G["+"]): ("REDUCE", G["atom -> true"]), (25, G["-"]): ("REDUCE", G["atom -> true"]), - (25, G["error"]): ("REDUCE", G["atom -> true"]), (25, G["in"]): ("REDUCE", G["atom -> true"]), (25, G["*"]): ("REDUCE", G["atom -> true"]), - (25, G["}"]): ("REDUCE", G["atom -> true"]), - (25, G["of"]): ("REDUCE", G["atom -> true"]), + (26, G["}"]): ("REDUCE", G["atom -> false"]), + (26, G["/"]): ("REDUCE", G["atom -> false"]), + (26, G["of"]): ("REDUCE", G["atom -> false"]), (26, G["<"]): ("REDUCE", G["atom -> false"]), (26, G[")"]): ("REDUCE", G["atom -> false"]), (26, G["then"]): ("REDUCE", G["atom -> false"]), @@ -199,29 +202,28 @@ def __action_table(): (26, G["else"]): ("REDUCE", G["atom -> false"]), (26, G["="]): ("REDUCE", G["atom -> false"]), (26, G[","]): ("REDUCE", G["atom -> false"]), - (26, G["/"]): ("REDUCE", G["atom -> false"]), (26, G["fi"]): ("REDUCE", G["atom -> false"]), (26, G[";"]): ("REDUCE", G["atom -> false"]), (26, G["loop"]): ("REDUCE", G["atom -> false"]), (26, G["@"]): ("REDUCE", G["atom -> false"]), + (26, G["error"]): ("REDUCE", G["atom -> false"]), (26, G["pool"]): ("REDUCE", G["atom -> false"]), (26, G["+"]): ("REDUCE", G["atom -> false"]), (26, G["-"]): ("REDUCE", G["atom -> false"]), - (26, G["error"]): ("REDUCE", G["atom -> false"]), (26, G["in"]): ("REDUCE", G["atom -> false"]), (26, G["*"]): ("REDUCE", G["atom -> false"]), - (26, G["}"]): ("REDUCE", G["atom -> false"]), - (26, G["of"]): ("REDUCE", G["atom -> false"]), + (27, G["string"]): ("SHIFT", 33), + (27, G["isvoid"]): ("SHIFT", 24), (27, G["true"]): ("SHIFT", 25), (27, G["new"]): ("SHIFT", 22), + (27, G["("]): ("SHIFT", 11), (27, G["false"]): ("SHIFT", 26), (27, G["~"]): ("SHIFT", 27), - (27, G["string"]): ("SHIFT", 34), (27, G["id"]): ("SHIFT", 28), - (27, G["("]): ("SHIFT", 11), - (27, G["isvoid"]): ("SHIFT", 24), - (27, G["int"]): ("SHIFT", 35), - (28, G["("]): ("SHIFT", 29), + (27, G["int"]): ("SHIFT", 34), + (28, G["}"]): ("REDUCE", G["atom -> id"]), + (28, G["/"]): ("REDUCE", G["atom -> id"]), + (28, G["of"]): ("REDUCE", G["atom -> id"]), (28, G["<"]): ("REDUCE", G["atom -> id"]), (28, G[")"]): ("REDUCE", G["atom -> id"]), (28, G["then"]): ("REDUCE", G["atom -> id"]), @@ -230,1169 +232,1108 @@ def __action_table(): (28, G["else"]): ("REDUCE", G["atom -> id"]), (28, G["="]): ("REDUCE", G["atom -> id"]), (28, G[","]): ("REDUCE", G["atom -> id"]), - (28, G["/"]): ("REDUCE", G["atom -> id"]), (28, G["fi"]): ("REDUCE", G["atom -> id"]), (28, G[";"]): ("REDUCE", G["atom -> id"]), (28, G["loop"]): ("REDUCE", G["atom -> id"]), (28, G["@"]): ("REDUCE", G["atom -> id"]), + (28, G["error"]): ("REDUCE", G["atom -> id"]), (28, G["pool"]): ("REDUCE", G["atom -> id"]), (28, G["+"]): ("REDUCE", G["atom -> id"]), (28, G["-"]): ("REDUCE", G["atom -> id"]), - (28, G["error"]): ("REDUCE", G["atom -> id"]), (28, G["in"]): ("REDUCE", G["atom -> id"]), (28, G["*"]): ("REDUCE", G["atom -> id"]), - (28, G["}"]): ("REDUCE", G["atom -> id"]), - (28, G["of"]): ("REDUCE", G["atom -> id"]), - (29, G["id"]): ("SHIFT", 32), - (29, G["while"]): ("SHIFT", 13), - (29, G["not"]): ("SHIFT", 31), - (29, G[")"]): ("SHIFT", 30), - (29, G["if"]): ("SHIFT", 12), - (29, G["~"]): ("SHIFT", 27), - (29, G["int"]): ("SHIFT", 35), - (29, G["{"]): ("SHIFT", 10), - (29, G["case"]): ("SHIFT", 21), - (29, G["new"]): ("SHIFT", 22), - (29, G["("]): ("SHIFT", 11), + (28, G["("]): ("SHIFT", 29), + (29, G["false"]): ("SHIFT", 26), + (29, G["id"]): ("SHIFT", 31), (29, G["true"]): ("SHIFT", 25), + (29, G[")"]): ("REDUCE", G["expr-list -> e"]), + (29, G["string"]): ("SHIFT", 33), + (29, G["~"]): ("SHIFT", 27), + (29, G["if"]): ("SHIFT", 12), + (29, G["while"]): ("SHIFT", 13), (29, G["isvoid"]): ("SHIFT", 24), - (29, G["false"]): ("SHIFT", 26), - (29, G["string"]): ("SHIFT", 34), + (29, G["("]): ("SHIFT", 11), + (29, G["new"]): ("SHIFT", 22), (29, G["let"]): ("SHIFT", 14), - (30, G["<"]): ("REDUCE", G["function-call -> id ( )"]), - (30, G[")"]): ("REDUCE", G["function-call -> id ( )"]), - (30, G["then"]): ("REDUCE", G["function-call -> id ( )"]), - (30, G["<="]): ("REDUCE", G["function-call -> id ( )"]), - (30, G["."]): ("REDUCE", G["function-call -> id ( )"]), - (30, G["else"]): ("REDUCE", G["function-call -> id ( )"]), - (30, G["="]): ("REDUCE", G["function-call -> id ( )"]), - (30, G[","]): ("REDUCE", G["function-call -> id ( )"]), - (30, G["/"]): ("REDUCE", G["function-call -> id ( )"]), - (30, G["fi"]): ("REDUCE", G["function-call -> id ( )"]), - (30, G[";"]): ("REDUCE", G["function-call -> id ( )"]), - (30, G["loop"]): ("REDUCE", G["function-call -> id ( )"]), - (30, G["@"]): ("REDUCE", G["function-call -> id ( )"]), - (30, G["pool"]): ("REDUCE", G["function-call -> id ( )"]), - (30, G["+"]): ("REDUCE", G["function-call -> id ( )"]), - (30, G["-"]): ("REDUCE", G["function-call -> id ( )"]), - (30, G["error"]): ("REDUCE", G["function-call -> id ( )"]), - (30, G["in"]): ("REDUCE", G["function-call -> id ( )"]), - (30, G["*"]): ("REDUCE", G["function-call -> id ( )"]), - (30, G["}"]): ("REDUCE", G["function-call -> id ( )"]), - (30, G["of"]): ("REDUCE", G["function-call -> id ( )"]), - (31, G["true"]): ("SHIFT", 25), - (31, G["if"]): ("SHIFT", 12), - (31, G["false"]): ("SHIFT", 26), - (31, G["{"]): ("SHIFT", 10), - (31, G["string"]): ("SHIFT", 34), - (31, G["id"]): ("SHIFT", 32), - (31, G["case"]): ("SHIFT", 21), - (31, G["isvoid"]): ("SHIFT", 24), - (31, G["int"]): ("SHIFT", 35), - (31, G["new"]): ("SHIFT", 22), - (31, G["~"]): ("SHIFT", 27), - (31, G["("]): ("SHIFT", 11), - (31, G["let"]): ("SHIFT", 14), - (31, G["while"]): ("SHIFT", 13), - (31, G["not"]): ("SHIFT", 31), - (32, G["("]): ("SHIFT", 29), - (32, G["<"]): ("REDUCE", G["atom -> id"]), - (32, G[")"]): ("REDUCE", G["atom -> id"]), - (32, G["then"]): ("REDUCE", G["atom -> id"]), - (32, G["<="]): ("REDUCE", G["atom -> id"]), - (32, G["."]): ("REDUCE", G["atom -> id"]), - (32, G["else"]): ("REDUCE", G["atom -> id"]), - (32, G["="]): ("REDUCE", G["atom -> id"]), - (32, G[","]): ("REDUCE", G["atom -> id"]), - (32, G["/"]): ("REDUCE", G["atom -> id"]), - (32, G["fi"]): ("REDUCE", G["atom -> id"]), - (32, G[";"]): ("REDUCE", G["atom -> id"]), - (32, G["loop"]): ("REDUCE", G["atom -> id"]), - (32, G["@"]): ("REDUCE", G["atom -> id"]), - (32, G["pool"]): ("REDUCE", G["atom -> id"]), - (32, G["+"]): ("REDUCE", G["atom -> id"]), - (32, G["-"]): ("REDUCE", G["atom -> id"]), - (32, G["error"]): ("REDUCE", G["atom -> id"]), - (32, G["in"]): ("REDUCE", G["atom -> id"]), - (32, G["*"]): ("REDUCE", G["atom -> id"]), - (32, G["}"]): ("REDUCE", G["atom -> id"]), - (32, G["of"]): ("REDUCE", G["atom -> id"]), - (32, G["<-"]): ("SHIFT", 33), - (33, G["true"]): ("SHIFT", 25), - (33, G["if"]): ("SHIFT", 12), - (33, G["false"]): ("SHIFT", 26), - (33, G["{"]): ("SHIFT", 10), - (33, G["string"]): ("SHIFT", 34), - (33, G["id"]): ("SHIFT", 32), - (33, G["case"]): ("SHIFT", 21), - (33, G["isvoid"]): ("SHIFT", 24), - (33, G["int"]): ("SHIFT", 35), - (33, G["new"]): ("SHIFT", 22), - (33, G["~"]): ("SHIFT", 27), - (33, G["("]): ("SHIFT", 11), - (33, G["let"]): ("SHIFT", 14), - (33, G["while"]): ("SHIFT", 13), - (33, G["not"]): ("SHIFT", 31), - (34, G["<"]): ("REDUCE", G["atom -> string"]), - (34, G[")"]): ("REDUCE", G["atom -> string"]), - (34, G["then"]): ("REDUCE", G["atom -> string"]), - (34, G["<="]): ("REDUCE", G["atom -> string"]), - (34, G["."]): ("REDUCE", G["atom -> string"]), - (34, G["else"]): ("REDUCE", G["atom -> string"]), - (34, G["="]): ("REDUCE", G["atom -> string"]), - (34, G[","]): ("REDUCE", G["atom -> string"]), - (34, G["/"]): ("REDUCE", G["atom -> string"]), - (34, G["fi"]): ("REDUCE", G["atom -> string"]), - (34, G[";"]): ("REDUCE", G["atom -> string"]), - (34, G["loop"]): ("REDUCE", G["atom -> string"]), - (34, G["@"]): ("REDUCE", G["atom -> string"]), - (34, G["pool"]): ("REDUCE", G["atom -> string"]), - (34, G["+"]): ("REDUCE", G["atom -> string"]), - (34, G["-"]): ("REDUCE", G["atom -> string"]), - (34, G["error"]): ("REDUCE", G["atom -> string"]), - (34, G["in"]): ("REDUCE", G["atom -> string"]), - (34, G["*"]): ("REDUCE", G["atom -> string"]), - (34, G["}"]): ("REDUCE", G["atom -> string"]), - (34, G["of"]): ("REDUCE", G["atom -> string"]), - (35, G["<"]): ("REDUCE", G["atom -> int"]), - (35, G[")"]): ("REDUCE", G["atom -> int"]), - (35, G["then"]): ("REDUCE", G["atom -> int"]), - (35, G["<="]): ("REDUCE", G["atom -> int"]), - (35, G["."]): ("REDUCE", G["atom -> int"]), - (35, G["else"]): ("REDUCE", G["atom -> int"]), - (35, G["="]): ("REDUCE", G["atom -> int"]), - (35, G[","]): ("REDUCE", G["atom -> int"]), - (35, G["/"]): ("REDUCE", G["atom -> int"]), - (35, G["fi"]): ("REDUCE", G["atom -> int"]), - (35, G[";"]): ("REDUCE", G["atom -> int"]), - (35, G["loop"]): ("REDUCE", G["atom -> int"]), - (35, G["@"]): ("REDUCE", G["atom -> int"]), - (35, G["pool"]): ("REDUCE", G["atom -> int"]), - (35, G["+"]): ("REDUCE", G["atom -> int"]), - (35, G["-"]): ("REDUCE", G["atom -> int"]), - (35, G["error"]): ("REDUCE", G["atom -> int"]), - (35, G["in"]): ("REDUCE", G["atom -> int"]), - (35, G["*"]): ("REDUCE", G["atom -> int"]), - (35, G["}"]): ("REDUCE", G["atom -> int"]), - (35, G["of"]): ("REDUCE", G["atom -> int"]), - (36, G["<"]): ("REDUCE", G["atom -> function-call"]), - (36, G[")"]): ("REDUCE", G["atom -> function-call"]), - (36, G["then"]): ("REDUCE", G["atom -> function-call"]), - (36, G["<="]): ("REDUCE", G["atom -> function-call"]), - (36, G["."]): ("REDUCE", G["atom -> function-call"]), - (36, G["else"]): ("REDUCE", G["atom -> function-call"]), - (36, G["="]): ("REDUCE", G["atom -> function-call"]), - (36, G[","]): ("REDUCE", G["atom -> function-call"]), - (36, G["/"]): ("REDUCE", G["atom -> function-call"]), - (36, G["fi"]): ("REDUCE", G["atom -> function-call"]), - (36, G[";"]): ("REDUCE", G["atom -> function-call"]), - (36, G["loop"]): ("REDUCE", G["atom -> function-call"]), - (36, G["@"]): ("REDUCE", G["atom -> function-call"]), - (36, G["pool"]): ("REDUCE", G["atom -> function-call"]), - (36, G["+"]): ("REDUCE", G["atom -> function-call"]), - (36, G["-"]): ("REDUCE", G["atom -> function-call"]), - (36, G["error"]): ("REDUCE", G["atom -> function-call"]), - (36, G["in"]): ("REDUCE", G["atom -> function-call"]), - (36, G["*"]): ("REDUCE", G["atom -> function-call"]), - (36, G["}"]): ("REDUCE", G["atom -> function-call"]), - (36, G["of"]): ("REDUCE", G["atom -> function-call"]), - (37, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), - (37, G["of"]): ("REDUCE", G["expr -> id <- expr"]), - (37, G[")"]): ("REDUCE", G["expr -> id <- expr"]), - (37, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), - (37, G["then"]): ("REDUCE", G["expr -> id <- expr"]), - (37, G["else"]): ("REDUCE", G["expr -> id <- expr"]), - (37, G["error"]): ("REDUCE", G["expr -> id <- expr"]), - (37, G[","]): ("REDUCE", G["expr -> id <- expr"]), - (37, G["in"]): ("REDUCE", G["expr -> id <- expr"]), - (37, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), - (37, G["}"]): ("REDUCE", G["expr -> id <- expr"]), - (37, G[";"]): ("REDUCE", G["expr -> id <- expr"]), - (38, G["loop"]): ("REDUCE", G["expr -> comp"]), - (38, G["of"]): ("REDUCE", G["expr -> comp"]), - (38, G[")"]): ("REDUCE", G["expr -> comp"]), - (38, G["pool"]): ("REDUCE", G["expr -> comp"]), - (38, G["then"]): ("REDUCE", G["expr -> comp"]), - (38, G["else"]): ("REDUCE", G["expr -> comp"]), - (38, G["error"]): ("REDUCE", G["expr -> comp"]), - (38, G[","]): ("REDUCE", G["expr -> comp"]), - (38, G["in"]): ("REDUCE", G["expr -> comp"]), - (38, G["fi"]): ("REDUCE", G["expr -> comp"]), - (38, G["}"]): ("REDUCE", G["expr -> comp"]), - (38, G[";"]): ("REDUCE", G["expr -> comp"]), - (39, G["+"]): ("SHIFT", 40), - (39, G["-"]): ("SHIFT", 66), - (39, G["loop"]): ("REDUCE", G["comp -> arith"]), - (39, G["of"]): ("REDUCE", G["comp -> arith"]), - (39, G[")"]): ("REDUCE", G["comp -> arith"]), - (39, G["pool"]): ("REDUCE", G["comp -> arith"]), - (39, G["then"]): ("REDUCE", G["comp -> arith"]), - (39, G["else"]): ("REDUCE", G["comp -> arith"]), - (39, G["error"]): ("REDUCE", G["comp -> arith"]), - (39, G[","]): ("REDUCE", G["comp -> arith"]), - (39, G["in"]): ("REDUCE", G["comp -> arith"]), - (39, G["fi"]): ("REDUCE", G["comp -> arith"]), - (39, G["}"]): ("REDUCE", G["comp -> arith"]), - (39, G[";"]): ("REDUCE", G["comp -> arith"]), - (39, G["="]): ("SHIFT", 72), - (39, G["<"]): ("SHIFT", 68), - (39, G["<="]): ("SHIFT", 70), - (40, G["true"]): ("SHIFT", 25), - (40, G["new"]): ("SHIFT", 22), - (40, G["false"]): ("SHIFT", 26), - (40, G["~"]): ("SHIFT", 27), - (40, G["string"]): ("SHIFT", 34), - (40, G["id"]): ("SHIFT", 28), - (40, G["("]): ("SHIFT", 11), - (40, G["isvoid"]): ("SHIFT", 24), - (40, G["int"]): ("SHIFT", 35), - (41, G["/"]): ("SHIFT", 55), - (41, G["*"]): ("SHIFT", 42), - (41, G["<"]): ("REDUCE", G["arith -> arith + term"]), - (41, G[")"]): ("REDUCE", G["arith -> arith + term"]), - (41, G["then"]): ("REDUCE", G["arith -> arith + term"]), - (41, G["<="]): ("REDUCE", G["arith -> arith + term"]), - (41, G["else"]): ("REDUCE", G["arith -> arith + term"]), - (41, G["="]): ("REDUCE", G["arith -> arith + term"]), - (41, G[","]): ("REDUCE", G["arith -> arith + term"]), - (41, G["fi"]): ("REDUCE", G["arith -> arith + term"]), - (41, G[";"]): ("REDUCE", G["arith -> arith + term"]), - (41, G["loop"]): ("REDUCE", G["arith -> arith + term"]), - (41, G["pool"]): ("REDUCE", G["arith -> arith + term"]), - (41, G["+"]): ("REDUCE", G["arith -> arith + term"]), - (41, G["-"]): ("REDUCE", G["arith -> arith + term"]), - (41, G["error"]): ("REDUCE", G["arith -> arith + term"]), - (41, G["in"]): ("REDUCE", G["arith -> arith + term"]), - (41, G["}"]): ("REDUCE", G["arith -> arith + term"]), - (41, G["of"]): ("REDUCE", G["arith -> arith + term"]), - (42, G["true"]): ("SHIFT", 25), - (42, G["new"]): ("SHIFT", 22), - (42, G["false"]): ("SHIFT", 26), - (42, G["~"]): ("SHIFT", 27), - (42, G["string"]): ("SHIFT", 34), - (42, G["id"]): ("SHIFT", 28), - (42, G["("]): ("SHIFT", 11), - (42, G["isvoid"]): ("SHIFT", 24), - (42, G["int"]): ("SHIFT", 35), - (43, G["<"]): ("REDUCE", G["term -> term * factor"]), - (43, G[")"]): ("REDUCE", G["term -> term * factor"]), - (43, G["then"]): ("REDUCE", G["term -> term * factor"]), - (43, G["<="]): ("REDUCE", G["term -> term * factor"]), - (43, G["else"]): ("REDUCE", G["term -> term * factor"]), - (43, G["="]): ("REDUCE", G["term -> term * factor"]), - (43, G[","]): ("REDUCE", G["term -> term * factor"]), - (43, G["/"]): ("REDUCE", G["term -> term * factor"]), - (43, G["fi"]): ("REDUCE", G["term -> term * factor"]), - (43, G[";"]): ("REDUCE", G["term -> term * factor"]), - (43, G["loop"]): ("REDUCE", G["term -> term * factor"]), - (43, G["pool"]): ("REDUCE", G["term -> term * factor"]), - (43, G["+"]): ("REDUCE", G["term -> term * factor"]), - (43, G["-"]): ("REDUCE", G["term -> term * factor"]), - (43, G["error"]): ("REDUCE", G["term -> term * factor"]), - (43, G["in"]): ("REDUCE", G["term -> term * factor"]), - (43, G["*"]): ("REDUCE", G["term -> term * factor"]), - (43, G["}"]): ("REDUCE", G["term -> term * factor"]), - (43, G["of"]): ("REDUCE", G["term -> term * factor"]), - (44, G["."]): ("SHIFT", 45), - (44, G["@"]): ("SHIFT", 58), - (44, G["<"]): ("REDUCE", G["factor -> atom"]), - (44, G[")"]): ("REDUCE", G["factor -> atom"]), - (44, G["then"]): ("REDUCE", G["factor -> atom"]), - (44, G["<="]): ("REDUCE", G["factor -> atom"]), - (44, G["else"]): ("REDUCE", G["factor -> atom"]), - (44, G["="]): ("REDUCE", G["factor -> atom"]), - (44, G[","]): ("REDUCE", G["factor -> atom"]), - (44, G["/"]): ("REDUCE", G["factor -> atom"]), - (44, G["fi"]): ("REDUCE", G["factor -> atom"]), - (44, G[";"]): ("REDUCE", G["factor -> atom"]), - (44, G["loop"]): ("REDUCE", G["factor -> atom"]), - (44, G["pool"]): ("REDUCE", G["factor -> atom"]), - (44, G["+"]): ("REDUCE", G["factor -> atom"]), - (44, G["-"]): ("REDUCE", G["factor -> atom"]), - (44, G["error"]): ("REDUCE", G["factor -> atom"]), - (44, G["in"]): ("REDUCE", G["factor -> atom"]), - (44, G["*"]): ("REDUCE", G["factor -> atom"]), - (44, G["}"]): ("REDUCE", G["factor -> atom"]), - (44, G["of"]): ("REDUCE", G["factor -> atom"]), - (45, G["id"]): ("SHIFT", 46), - (46, G["("]): ("SHIFT", 47), - (47, G["id"]): ("SHIFT", 32), - (47, G["while"]): ("SHIFT", 13), + (29, G["int"]): ("SHIFT", 34), + (29, G["case"]): ("SHIFT", 21), + (29, G["{"]): ("SHIFT", 10), + (29, G["not"]): ("SHIFT", 30), + (30, G["not"]): ("SHIFT", 30), + (30, G["{"]): ("SHIFT", 10), + (30, G["true"]): ("SHIFT", 25), + (30, G["~"]): ("SHIFT", 27), + (30, G["string"]): ("SHIFT", 33), + (30, G["isvoid"]): ("SHIFT", 24), + (30, G["("]): ("SHIFT", 11), + (30, G["new"]): ("SHIFT", 22), + (30, G["if"]): ("SHIFT", 12), + (30, G["int"]): ("SHIFT", 34), + (30, G["while"]): ("SHIFT", 13), + (30, G["let"]): ("SHIFT", 14), + (30, G["false"]): ("SHIFT", 26), + (30, G["id"]): ("SHIFT", 31), + (30, G["case"]): ("SHIFT", 21), + (31, G["}"]): ("REDUCE", G["atom -> id"]), + (31, G["/"]): ("REDUCE", G["atom -> id"]), + (31, G["of"]): ("REDUCE", G["atom -> id"]), + (31, G["<"]): ("REDUCE", G["atom -> id"]), + (31, G[")"]): ("REDUCE", G["atom -> id"]), + (31, G["then"]): ("REDUCE", G["atom -> id"]), + (31, G["<="]): ("REDUCE", G["atom -> id"]), + (31, G["."]): ("REDUCE", G["atom -> id"]), + (31, G["else"]): ("REDUCE", G["atom -> id"]), + (31, G["="]): ("REDUCE", G["atom -> id"]), + (31, G[","]): ("REDUCE", G["atom -> id"]), + (31, G["fi"]): ("REDUCE", G["atom -> id"]), + (31, G[";"]): ("REDUCE", G["atom -> id"]), + (31, G["loop"]): ("REDUCE", G["atom -> id"]), + (31, G["@"]): ("REDUCE", G["atom -> id"]), + (31, G["error"]): ("REDUCE", G["atom -> id"]), + (31, G["pool"]): ("REDUCE", G["atom -> id"]), + (31, G["+"]): ("REDUCE", G["atom -> id"]), + (31, G["-"]): ("REDUCE", G["atom -> id"]), + (31, G["in"]): ("REDUCE", G["atom -> id"]), + (31, G["*"]): ("REDUCE", G["atom -> id"]), + (31, G["<-"]): ("SHIFT", 32), + (31, G["("]): ("SHIFT", 29), + (32, G["not"]): ("SHIFT", 30), + (32, G["{"]): ("SHIFT", 10), + (32, G["true"]): ("SHIFT", 25), + (32, G["~"]): ("SHIFT", 27), + (32, G["string"]): ("SHIFT", 33), + (32, G["isvoid"]): ("SHIFT", 24), + (32, G["("]): ("SHIFT", 11), + (32, G["new"]): ("SHIFT", 22), + (32, G["if"]): ("SHIFT", 12), + (32, G["int"]): ("SHIFT", 34), + (32, G["while"]): ("SHIFT", 13), + (32, G["let"]): ("SHIFT", 14), + (32, G["false"]): ("SHIFT", 26), + (32, G["id"]): ("SHIFT", 31), + (32, G["case"]): ("SHIFT", 21), + (33, G["}"]): ("REDUCE", G["atom -> string"]), + (33, G["/"]): ("REDUCE", G["atom -> string"]), + (33, G["of"]): ("REDUCE", G["atom -> string"]), + (33, G["<"]): ("REDUCE", G["atom -> string"]), + (33, G[")"]): ("REDUCE", G["atom -> string"]), + (33, G["then"]): ("REDUCE", G["atom -> string"]), + (33, G["<="]): ("REDUCE", G["atom -> string"]), + (33, G["."]): ("REDUCE", G["atom -> string"]), + (33, G["else"]): ("REDUCE", G["atom -> string"]), + (33, G["="]): ("REDUCE", G["atom -> string"]), + (33, G[","]): ("REDUCE", G["atom -> string"]), + (33, G["fi"]): ("REDUCE", G["atom -> string"]), + (33, G[";"]): ("REDUCE", G["atom -> string"]), + (33, G["loop"]): ("REDUCE", G["atom -> string"]), + (33, G["@"]): ("REDUCE", G["atom -> string"]), + (33, G["error"]): ("REDUCE", G["atom -> string"]), + (33, G["pool"]): ("REDUCE", G["atom -> string"]), + (33, G["+"]): ("REDUCE", G["atom -> string"]), + (33, G["-"]): ("REDUCE", G["atom -> string"]), + (33, G["in"]): ("REDUCE", G["atom -> string"]), + (33, G["*"]): ("REDUCE", G["atom -> string"]), + (34, G["}"]): ("REDUCE", G["atom -> int"]), + (34, G["/"]): ("REDUCE", G["atom -> int"]), + (34, G["of"]): ("REDUCE", G["atom -> int"]), + (34, G["<"]): ("REDUCE", G["atom -> int"]), + (34, G[")"]): ("REDUCE", G["atom -> int"]), + (34, G["then"]): ("REDUCE", G["atom -> int"]), + (34, G["<="]): ("REDUCE", G["atom -> int"]), + (34, G["."]): ("REDUCE", G["atom -> int"]), + (34, G["else"]): ("REDUCE", G["atom -> int"]), + (34, G["="]): ("REDUCE", G["atom -> int"]), + (34, G[","]): ("REDUCE", G["atom -> int"]), + (34, G["fi"]): ("REDUCE", G["atom -> int"]), + (34, G[";"]): ("REDUCE", G["atom -> int"]), + (34, G["loop"]): ("REDUCE", G["atom -> int"]), + (34, G["@"]): ("REDUCE", G["atom -> int"]), + (34, G["error"]): ("REDUCE", G["atom -> int"]), + (34, G["pool"]): ("REDUCE", G["atom -> int"]), + (34, G["+"]): ("REDUCE", G["atom -> int"]), + (34, G["-"]): ("REDUCE", G["atom -> int"]), + (34, G["in"]): ("REDUCE", G["atom -> int"]), + (34, G["*"]): ("REDUCE", G["atom -> int"]), + (35, G["}"]): ("REDUCE", G["atom -> function-call"]), + (35, G["/"]): ("REDUCE", G["atom -> function-call"]), + (35, G["of"]): ("REDUCE", G["atom -> function-call"]), + (35, G["<"]): ("REDUCE", G["atom -> function-call"]), + (35, G[")"]): ("REDUCE", G["atom -> function-call"]), + (35, G["then"]): ("REDUCE", G["atom -> function-call"]), + (35, G["<="]): ("REDUCE", G["atom -> function-call"]), + (35, G["."]): ("REDUCE", G["atom -> function-call"]), + (35, G["else"]): ("REDUCE", G["atom -> function-call"]), + (35, G["="]): ("REDUCE", G["atom -> function-call"]), + (35, G[","]): ("REDUCE", G["atom -> function-call"]), + (35, G["fi"]): ("REDUCE", G["atom -> function-call"]), + (35, G[";"]): ("REDUCE", G["atom -> function-call"]), + (35, G["loop"]): ("REDUCE", G["atom -> function-call"]), + (35, G["@"]): ("REDUCE", G["atom -> function-call"]), + (35, G["error"]): ("REDUCE", G["atom -> function-call"]), + (35, G["pool"]): ("REDUCE", G["atom -> function-call"]), + (35, G["+"]): ("REDUCE", G["atom -> function-call"]), + (35, G["-"]): ("REDUCE", G["atom -> function-call"]), + (35, G["in"]): ("REDUCE", G["atom -> function-call"]), + (35, G["*"]): ("REDUCE", G["atom -> function-call"]), + (36, G["}"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), + (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["else"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["in"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), + (37, G["}"]): ("REDUCE", G["expr -> comp"]), + (37, G["of"]): ("REDUCE", G["expr -> comp"]), + (37, G[";"]): ("REDUCE", G["expr -> comp"]), + (37, G["loop"]): ("REDUCE", G["expr -> comp"]), + (37, G[","]): ("REDUCE", G["expr -> comp"]), + (37, G[")"]): ("REDUCE", G["expr -> comp"]), + (37, G["error"]): ("REDUCE", G["expr -> comp"]), + (37, G["then"]): ("REDUCE", G["expr -> comp"]), + (37, G["pool"]): ("REDUCE", G["expr -> comp"]), + (37, G["else"]): ("REDUCE", G["expr -> comp"]), + (37, G["in"]): ("REDUCE", G["expr -> comp"]), + (37, G["fi"]): ("REDUCE", G["expr -> comp"]), + (38, G["<"]): ("SHIFT", 66), + (38, G["<="]): ("SHIFT", 68), + (38, G["+"]): ("SHIFT", 39), + (38, G["-"]): ("SHIFT", 64), + (38, G["="]): ("SHIFT", 70), + (38, G["}"]): ("REDUCE", G["comp -> arith"]), + (38, G["of"]): ("REDUCE", G["comp -> arith"]), + (38, G[";"]): ("REDUCE", G["comp -> arith"]), + (38, G["loop"]): ("REDUCE", G["comp -> arith"]), + (38, G[","]): ("REDUCE", G["comp -> arith"]), + (38, G[")"]): ("REDUCE", G["comp -> arith"]), + (38, G["error"]): ("REDUCE", G["comp -> arith"]), + (38, G["then"]): ("REDUCE", G["comp -> arith"]), + (38, G["pool"]): ("REDUCE", G["comp -> arith"]), + (38, G["else"]): ("REDUCE", G["comp -> arith"]), + (38, G["in"]): ("REDUCE", G["comp -> arith"]), + (38, G["fi"]): ("REDUCE", G["comp -> arith"]), + (39, G["true"]): ("SHIFT", 25), + (39, G["new"]): ("SHIFT", 22), + (39, G["id"]): ("SHIFT", 28), + (39, G["~"]): ("SHIFT", 27), + (39, G["int"]): ("SHIFT", 34), + (39, G["string"]): ("SHIFT", 33), + (39, G["isvoid"]): ("SHIFT", 24), + (39, G["false"]): ("SHIFT", 26), + (39, G["("]): ("SHIFT", 11), + (40, G["*"]): ("SHIFT", 41), + (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["of"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["<"]): ("REDUCE", G["arith -> arith + term"]), + (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["then"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["<="]): ("REDUCE", G["arith -> arith + term"]), + (40, G["else"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["="]): ("REDUCE", G["arith -> arith + term"]), + (40, G[","]): ("REDUCE", G["arith -> arith + term"]), + (40, G["fi"]): ("REDUCE", G["arith -> arith + term"]), + (40, G[";"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["+"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["/"]): ("SHIFT", 54), + (41, G["string"]): ("SHIFT", 33), + (41, G["isvoid"]): ("SHIFT", 24), + (41, G["true"]): ("SHIFT", 25), + (41, G["new"]): ("SHIFT", 22), + (41, G["("]): ("SHIFT", 11), + (41, G["false"]): ("SHIFT", 26), + (41, G["~"]): ("SHIFT", 27), + (41, G["id"]): ("SHIFT", 28), + (41, G["int"]): ("SHIFT", 34), + (42, G["}"]): ("REDUCE", G["term -> term * factor"]), + (42, G["/"]): ("REDUCE", G["term -> term * factor"]), + (42, G["of"]): ("REDUCE", G["term -> term * factor"]), + (42, G["<"]): ("REDUCE", G["term -> term * factor"]), + (42, G[")"]): ("REDUCE", G["term -> term * factor"]), + (42, G["then"]): ("REDUCE", G["term -> term * factor"]), + (42, G["<="]): ("REDUCE", G["term -> term * factor"]), + (42, G["else"]): ("REDUCE", G["term -> term * factor"]), + (42, G["="]): ("REDUCE", G["term -> term * factor"]), + (42, G[","]): ("REDUCE", G["term -> term * factor"]), + (42, G["fi"]): ("REDUCE", G["term -> term * factor"]), + (42, G[";"]): ("REDUCE", G["term -> term * factor"]), + (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), + (42, G["error"]): ("REDUCE", G["term -> term * factor"]), + (42, G["pool"]): ("REDUCE", G["term -> term * factor"]), + (42, G["+"]): ("REDUCE", G["term -> term * factor"]), + (42, G["-"]): ("REDUCE", G["term -> term * factor"]), + (42, G["in"]): ("REDUCE", G["term -> term * factor"]), + (42, G["*"]): ("REDUCE", G["term -> term * factor"]), + (43, G["@"]): ("SHIFT", 57), + (43, G["."]): ("SHIFT", 44), + (43, G["}"]): ("REDUCE", G["factor -> atom"]), + (43, G["/"]): ("REDUCE", G["factor -> atom"]), + (43, G["of"]): ("REDUCE", G["factor -> atom"]), + (43, G["<"]): ("REDUCE", G["factor -> atom"]), + (43, G[")"]): ("REDUCE", G["factor -> atom"]), + (43, G["then"]): ("REDUCE", G["factor -> atom"]), + (43, G["<="]): ("REDUCE", G["factor -> atom"]), + (43, G["else"]): ("REDUCE", G["factor -> atom"]), + (43, G["="]): ("REDUCE", G["factor -> atom"]), + (43, G[","]): ("REDUCE", G["factor -> atom"]), + (43, G["fi"]): ("REDUCE", G["factor -> atom"]), + (43, G[";"]): ("REDUCE", G["factor -> atom"]), + (43, G["loop"]): ("REDUCE", G["factor -> atom"]), + (43, G["error"]): ("REDUCE", G["factor -> atom"]), + (43, G["pool"]): ("REDUCE", G["factor -> atom"]), + (43, G["+"]): ("REDUCE", G["factor -> atom"]), + (43, G["-"]): ("REDUCE", G["factor -> atom"]), + (43, G["in"]): ("REDUCE", G["factor -> atom"]), + (43, G["*"]): ("REDUCE", G["factor -> atom"]), + (44, G["id"]): ("SHIFT", 45), + (45, G["("]): ("SHIFT", 46), + (46, G["false"]): ("SHIFT", 26), + (46, G["id"]): ("SHIFT", 31), + (46, G["true"]): ("SHIFT", 25), + (46, G[")"]): ("REDUCE", G["expr-list -> e"]), + (46, G["string"]): ("SHIFT", 33), + (46, G["~"]): ("SHIFT", 27), + (46, G["if"]): ("SHIFT", 12), + (46, G["while"]): ("SHIFT", 13), + (46, G["isvoid"]): ("SHIFT", 24), + (46, G["("]): ("SHIFT", 11), + (46, G["new"]): ("SHIFT", 22), + (46, G["let"]): ("SHIFT", 14), + (46, G["int"]): ("SHIFT", 34), + (46, G["case"]): ("SHIFT", 21), + (46, G["{"]): ("SHIFT", 10), + (46, G["not"]): ("SHIFT", 30), (47, G[")"]): ("SHIFT", 48), - (47, G["not"]): ("SHIFT", 31), - (47, G["if"]): ("SHIFT", 12), - (47, G["~"]): ("SHIFT", 27), - (47, G["int"]): ("SHIFT", 35), - (47, G["{"]): ("SHIFT", 10), - (47, G["case"]): ("SHIFT", 21), - (47, G["new"]): ("SHIFT", 22), - (47, G["("]): ("SHIFT", 11), - (47, G["true"]): ("SHIFT", 25), - (47, G["isvoid"]): ("SHIFT", 24), - (47, G["false"]): ("SHIFT", 26), - (47, G["string"]): ("SHIFT", 34), - (47, G["let"]): ("SHIFT", 14), - (48, G["<"]): ("REDUCE", G["function-call -> atom . id ( )"]), - (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( )"]), - (48, G["then"]): ("REDUCE", G["function-call -> atom . id ( )"]), - (48, G["<="]): ("REDUCE", G["function-call -> atom . id ( )"]), - (48, G["."]): ("REDUCE", G["function-call -> atom . id ( )"]), - (48, G["else"]): ("REDUCE", G["function-call -> atom . id ( )"]), - (48, G["="]): ("REDUCE", G["function-call -> atom . id ( )"]), - (48, G[","]): ("REDUCE", G["function-call -> atom . id ( )"]), - (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( )"]), - (48, G["fi"]): ("REDUCE", G["function-call -> atom . id ( )"]), - (48, G[";"]): ("REDUCE", G["function-call -> atom . id ( )"]), - (48, G["loop"]): ("REDUCE", G["function-call -> atom . id ( )"]), - (48, G["@"]): ("REDUCE", G["function-call -> atom . id ( )"]), - (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( )"]), - (48, G["+"]): ("REDUCE", G["function-call -> atom . id ( )"]), - (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( )"]), - (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( )"]), - (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( )"]), - (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( )"]), - (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( )"]), - (48, G["of"]): ("REDUCE", G["function-call -> atom . id ( )"]), - (49, G[")"]): ("SHIFT", 50), - (50, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (50, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (50, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (50, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (50, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (50, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (50, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (50, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (50, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (50, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (50, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (50, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (50, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (50, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (50, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (50, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (50, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (50, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (50, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (50, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (50, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (51, G[","]): ("SHIFT", 52), - (51, G[")"]): ("REDUCE", G["expr-list -> expr"]), - (52, G["id"]): ("SHIFT", 32), - (52, G["while"]): ("SHIFT", 13), - (52, G["not"]): ("SHIFT", 31), - (52, G["if"]): ("SHIFT", 12), - (52, G["~"]): ("SHIFT", 27), - (52, G["int"]): ("SHIFT", 35), - (52, G["{"]): ("SHIFT", 10), - (52, G["case"]): ("SHIFT", 21), - (52, G["new"]): ("SHIFT", 22), - (52, G["("]): ("SHIFT", 11), - (52, G["true"]): ("SHIFT", 25), - (52, G["isvoid"]): ("SHIFT", 24), - (52, G["false"]): ("SHIFT", 26), - (52, G["string"]): ("SHIFT", 34), - (52, G["let"]): ("SHIFT", 14), - (53, G[")"]): ("REDUCE", G["expr-list -> expr , expr-list"]), - (54, G["<"]): ("REDUCE", G["arith -> term"]), - (54, G[")"]): ("REDUCE", G["arith -> term"]), - (54, G["then"]): ("REDUCE", G["arith -> term"]), - (54, G["<="]): ("REDUCE", G["arith -> term"]), - (54, G["else"]): ("REDUCE", G["arith -> term"]), - (54, G["="]): ("REDUCE", G["arith -> term"]), - (54, G[","]): ("REDUCE", G["arith -> term"]), - (54, G["fi"]): ("REDUCE", G["arith -> term"]), - (54, G[";"]): ("REDUCE", G["arith -> term"]), - (54, G["loop"]): ("REDUCE", G["arith -> term"]), - (54, G["pool"]): ("REDUCE", G["arith -> term"]), - (54, G["+"]): ("REDUCE", G["arith -> term"]), - (54, G["-"]): ("REDUCE", G["arith -> term"]), - (54, G["error"]): ("REDUCE", G["arith -> term"]), - (54, G["in"]): ("REDUCE", G["arith -> term"]), - (54, G["}"]): ("REDUCE", G["arith -> term"]), - (54, G["of"]): ("REDUCE", G["arith -> term"]), - (54, G["/"]): ("SHIFT", 55), - (54, G["*"]): ("SHIFT", 42), - (55, G["true"]): ("SHIFT", 25), - (55, G["new"]): ("SHIFT", 22), - (55, G["false"]): ("SHIFT", 26), - (55, G["~"]): ("SHIFT", 27), - (55, G["string"]): ("SHIFT", 34), - (55, G["id"]): ("SHIFT", 28), - (55, G["("]): ("SHIFT", 11), - (55, G["isvoid"]): ("SHIFT", 24), - (55, G["int"]): ("SHIFT", 35), - (56, G["<"]): ("REDUCE", G["term -> term / factor"]), - (56, G[")"]): ("REDUCE", G["term -> term / factor"]), - (56, G["then"]): ("REDUCE", G["term -> term / factor"]), - (56, G["<="]): ("REDUCE", G["term -> term / factor"]), - (56, G["else"]): ("REDUCE", G["term -> term / factor"]), - (56, G["="]): ("REDUCE", G["term -> term / factor"]), - (56, G[","]): ("REDUCE", G["term -> term / factor"]), - (56, G["/"]): ("REDUCE", G["term -> term / factor"]), - (56, G["fi"]): ("REDUCE", G["term -> term / factor"]), - (56, G[";"]): ("REDUCE", G["term -> term / factor"]), - (56, G["loop"]): ("REDUCE", G["term -> term / factor"]), - (56, G["pool"]): ("REDUCE", G["term -> term / factor"]), - (56, G["+"]): ("REDUCE", G["term -> term / factor"]), - (56, G["-"]): ("REDUCE", G["term -> term / factor"]), - (56, G["error"]): ("REDUCE", G["term -> term / factor"]), - (56, G["in"]): ("REDUCE", G["term -> term / factor"]), - (56, G["*"]): ("REDUCE", G["term -> term / factor"]), - (56, G["}"]): ("REDUCE", G["term -> term / factor"]), - (56, G["of"]): ("REDUCE", G["term -> term / factor"]), - (57, G["<"]): ("REDUCE", G["term -> factor"]), - (57, G[")"]): ("REDUCE", G["term -> factor"]), - (57, G["then"]): ("REDUCE", G["term -> factor"]), - (57, G["<="]): ("REDUCE", G["term -> factor"]), - (57, G["else"]): ("REDUCE", G["term -> factor"]), - (57, G["="]): ("REDUCE", G["term -> factor"]), - (57, G[","]): ("REDUCE", G["term -> factor"]), - (57, G["/"]): ("REDUCE", G["term -> factor"]), - (57, G["fi"]): ("REDUCE", G["term -> factor"]), - (57, G[";"]): ("REDUCE", G["term -> factor"]), - (57, G["loop"]): ("REDUCE", G["term -> factor"]), - (57, G["pool"]): ("REDUCE", G["term -> factor"]), - (57, G["+"]): ("REDUCE", G["term -> factor"]), - (57, G["-"]): ("REDUCE", G["term -> factor"]), - (57, G["error"]): ("REDUCE", G["term -> factor"]), - (57, G["in"]): ("REDUCE", G["term -> factor"]), - (57, G["*"]): ("REDUCE", G["term -> factor"]), - (57, G["}"]): ("REDUCE", G["term -> factor"]), - (57, G["of"]): ("REDUCE", G["term -> factor"]), - (58, G["type"]): ("SHIFT", 59), - (59, G["."]): ("SHIFT", 60), - (60, G["id"]): ("SHIFT", 61), - (61, G["("]): ("SHIFT", 62), - (62, G["id"]): ("SHIFT", 32), - (62, G["while"]): ("SHIFT", 13), - (62, G["not"]): ("SHIFT", 31), - (62, G["if"]): ("SHIFT", 12), - (62, G["~"]): ("SHIFT", 27), - (62, G["int"]): ("SHIFT", 35), - (62, G["{"]): ("SHIFT", 10), - (62, G["case"]): ("SHIFT", 21), - (62, G["new"]): ("SHIFT", 22), + (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (49, G[")"]): ("REDUCE", G["expr-list -> not-empty-expr-list"]), + (50, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), + (50, G[","]): ("SHIFT", 51), + (51, G["false"]): ("SHIFT", 26), + (51, G["id"]): ("SHIFT", 31), + (51, G["true"]): ("SHIFT", 25), + (51, G["string"]): ("SHIFT", 33), + (51, G["~"]): ("SHIFT", 27), + (51, G["if"]): ("SHIFT", 12), + (51, G["while"]): ("SHIFT", 13), + (51, G["("]): ("SHIFT", 11), + (51, G["isvoid"]): ("SHIFT", 24), + (51, G["new"]): ("SHIFT", 22), + (51, G["let"]): ("SHIFT", 14), + (51, G["int"]): ("SHIFT", 34), + (51, G["case"]): ("SHIFT", 21), + (51, G["{"]): ("SHIFT", 10), + (51, G["not"]): ("SHIFT", 30), + (52, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr , not-empty-expr-list"]), + (53, G["}"]): ("REDUCE", G["arith -> term"]), + (53, G["of"]): ("REDUCE", G["arith -> term"]), + (53, G["<"]): ("REDUCE", G["arith -> term"]), + (53, G[")"]): ("REDUCE", G["arith -> term"]), + (53, G["then"]): ("REDUCE", G["arith -> term"]), + (53, G["<="]): ("REDUCE", G["arith -> term"]), + (53, G["else"]): ("REDUCE", G["arith -> term"]), + (53, G["="]): ("REDUCE", G["arith -> term"]), + (53, G[","]): ("REDUCE", G["arith -> term"]), + (53, G["fi"]): ("REDUCE", G["arith -> term"]), + (53, G[";"]): ("REDUCE", G["arith -> term"]), + (53, G["loop"]): ("REDUCE", G["arith -> term"]), + (53, G["error"]): ("REDUCE", G["arith -> term"]), + (53, G["pool"]): ("REDUCE", G["arith -> term"]), + (53, G["+"]): ("REDUCE", G["arith -> term"]), + (53, G["-"]): ("REDUCE", G["arith -> term"]), + (53, G["in"]): ("REDUCE", G["arith -> term"]), + (53, G["*"]): ("SHIFT", 41), + (53, G["/"]): ("SHIFT", 54), + (54, G["string"]): ("SHIFT", 33), + (54, G["isvoid"]): ("SHIFT", 24), + (54, G["true"]): ("SHIFT", 25), + (54, G["new"]): ("SHIFT", 22), + (54, G["("]): ("SHIFT", 11), + (54, G["false"]): ("SHIFT", 26), + (54, G["~"]): ("SHIFT", 27), + (54, G["id"]): ("SHIFT", 28), + (54, G["int"]): ("SHIFT", 34), + (55, G["}"]): ("REDUCE", G["term -> term / factor"]), + (55, G["/"]): ("REDUCE", G["term -> term / factor"]), + (55, G["of"]): ("REDUCE", G["term -> term / factor"]), + (55, G["<"]): ("REDUCE", G["term -> term / factor"]), + (55, G[")"]): ("REDUCE", G["term -> term / factor"]), + (55, G["then"]): ("REDUCE", G["term -> term / factor"]), + (55, G["<="]): ("REDUCE", G["term -> term / factor"]), + (55, G["else"]): ("REDUCE", G["term -> term / factor"]), + (55, G["="]): ("REDUCE", G["term -> term / factor"]), + (55, G[","]): ("REDUCE", G["term -> term / factor"]), + (55, G["fi"]): ("REDUCE", G["term -> term / factor"]), + (55, G[";"]): ("REDUCE", G["term -> term / factor"]), + (55, G["loop"]): ("REDUCE", G["term -> term / factor"]), + (55, G["error"]): ("REDUCE", G["term -> term / factor"]), + (55, G["pool"]): ("REDUCE", G["term -> term / factor"]), + (55, G["+"]): ("REDUCE", G["term -> term / factor"]), + (55, G["-"]): ("REDUCE", G["term -> term / factor"]), + (55, G["in"]): ("REDUCE", G["term -> term / factor"]), + (55, G["*"]): ("REDUCE", G["term -> term / factor"]), + (56, G["}"]): ("REDUCE", G["term -> factor"]), + (56, G["/"]): ("REDUCE", G["term -> factor"]), + (56, G["of"]): ("REDUCE", G["term -> factor"]), + (56, G["<"]): ("REDUCE", G["term -> factor"]), + (56, G[")"]): ("REDUCE", G["term -> factor"]), + (56, G["then"]): ("REDUCE", G["term -> factor"]), + (56, G["<="]): ("REDUCE", G["term -> factor"]), + (56, G["else"]): ("REDUCE", G["term -> factor"]), + (56, G["="]): ("REDUCE", G["term -> factor"]), + (56, G[","]): ("REDUCE", G["term -> factor"]), + (56, G["fi"]): ("REDUCE", G["term -> factor"]), + (56, G[";"]): ("REDUCE", G["term -> factor"]), + (56, G["loop"]): ("REDUCE", G["term -> factor"]), + (56, G["error"]): ("REDUCE", G["term -> factor"]), + (56, G["pool"]): ("REDUCE", G["term -> factor"]), + (56, G["+"]): ("REDUCE", G["term -> factor"]), + (56, G["-"]): ("REDUCE", G["term -> factor"]), + (56, G["in"]): ("REDUCE", G["term -> factor"]), + (56, G["*"]): ("REDUCE", G["term -> factor"]), + (57, G["type"]): ("SHIFT", 58), + (58, G["."]): ("SHIFT", 59), + (59, G["id"]): ("SHIFT", 60), + (60, G["("]): ("SHIFT", 61), + (61, G["false"]): ("SHIFT", 26), + (61, G["id"]): ("SHIFT", 31), + (61, G["true"]): ("SHIFT", 25), + (61, G[")"]): ("REDUCE", G["expr-list -> e"]), + (61, G["string"]): ("SHIFT", 33), + (61, G["~"]): ("SHIFT", 27), + (61, G["if"]): ("SHIFT", 12), + (61, G["while"]): ("SHIFT", 13), + (61, G["isvoid"]): ("SHIFT", 24), + (61, G["("]): ("SHIFT", 11), + (61, G["new"]): ("SHIFT", 22), + (61, G["let"]): ("SHIFT", 14), + (61, G["int"]): ("SHIFT", 34), + (61, G["case"]): ("SHIFT", 21), + (61, G["{"]): ("SHIFT", 10), + (61, G["not"]): ("SHIFT", 30), (62, G[")"]): ("SHIFT", 63), - (62, G["("]): ("SHIFT", 11), - (62, G["true"]): ("SHIFT", 25), - (62, G["isvoid"]): ("SHIFT", 24), - (62, G["false"]): ("SHIFT", 26), - (62, G["string"]): ("SHIFT", 34), - (62, G["let"]): ("SHIFT", 14), - (63, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), - (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), - (63, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), - (63, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), - (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), - (63, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), - (63, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), - (63, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), - (63, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), - (63, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), - (63, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), - (63, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), - (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), - (63, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), - (63, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), - (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), - (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), - (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), - (63, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), - (63, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), - (63, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( )"]), - (64, G[")"]): ("SHIFT", 65), - (65, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (65, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (65, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (65, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (65, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (65, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (65, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (65, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (65, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (65, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (65, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (65, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (65, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (65, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (65, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (65, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (65, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (65, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (65, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (65, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (65, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (66, G["true"]): ("SHIFT", 25), - (66, G["new"]): ("SHIFT", 22), + (63, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (64, G["true"]): ("SHIFT", 25), + (64, G["new"]): ("SHIFT", 22), + (64, G["id"]): ("SHIFT", 28), + (64, G["~"]): ("SHIFT", 27), + (64, G["int"]): ("SHIFT", 34), + (64, G["string"]): ("SHIFT", 33), + (64, G["isvoid"]): ("SHIFT", 24), + (64, G["false"]): ("SHIFT", 26), + (64, G["("]): ("SHIFT", 11), + (65, G["*"]): ("SHIFT", 41), + (65, G["}"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["of"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["<"]): ("REDUCE", G["arith -> arith - term"]), + (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["then"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["<="]): ("REDUCE", G["arith -> arith - term"]), + (65, G["else"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["="]): ("REDUCE", G["arith -> arith - term"]), + (65, G[","]): ("REDUCE", G["arith -> arith - term"]), + (65, G["fi"]): ("REDUCE", G["arith -> arith - term"]), + (65, G[";"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["loop"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["error"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["pool"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["+"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["-"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["/"]): ("SHIFT", 54), + (66, G["string"]): ("SHIFT", 33), (66, G["false"]): ("SHIFT", 26), - (66, G["~"]): ("SHIFT", 27), - (66, G["string"]): ("SHIFT", 34), (66, G["id"]): ("SHIFT", 28), (66, G["("]): ("SHIFT", 11), + (66, G["new"]): ("SHIFT", 22), + (66, G["true"]): ("SHIFT", 25), + (66, G["~"]): ("SHIFT", 27), (66, G["isvoid"]): ("SHIFT", 24), - (66, G["int"]): ("SHIFT", 35), - (67, G["/"]): ("SHIFT", 55), - (67, G["*"]): ("SHIFT", 42), - (67, G["<"]): ("REDUCE", G["arith -> arith - term"]), - (67, G[")"]): ("REDUCE", G["arith -> arith - term"]), - (67, G["then"]): ("REDUCE", G["arith -> arith - term"]), - (67, G["<="]): ("REDUCE", G["arith -> arith - term"]), - (67, G["else"]): ("REDUCE", G["arith -> arith - term"]), - (67, G["="]): ("REDUCE", G["arith -> arith - term"]), - (67, G[","]): ("REDUCE", G["arith -> arith - term"]), - (67, G["fi"]): ("REDUCE", G["arith -> arith - term"]), - (67, G[";"]): ("REDUCE", G["arith -> arith - term"]), - (67, G["loop"]): ("REDUCE", G["arith -> arith - term"]), - (67, G["pool"]): ("REDUCE", G["arith -> arith - term"]), - (67, G["+"]): ("REDUCE", G["arith -> arith - term"]), - (67, G["-"]): ("REDUCE", G["arith -> arith - term"]), - (67, G["error"]): ("REDUCE", G["arith -> arith - term"]), - (67, G["in"]): ("REDUCE", G["arith -> arith - term"]), - (67, G["}"]): ("REDUCE", G["arith -> arith - term"]), - (67, G["of"]): ("REDUCE", G["arith -> arith - term"]), - (68, G["isvoid"]): ("SHIFT", 24), + (66, G["int"]): ("SHIFT", 34), + (67, G["-"]): ("SHIFT", 64), + (67, G["+"]): ("SHIFT", 39), + (67, G["}"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), + (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["else"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["in"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), + (68, G["string"]): ("SHIFT", 33), + (68, G["false"]): ("SHIFT", 26), (68, G["id"]): ("SHIFT", 28), (68, G["("]): ("SHIFT", 11), - (68, G["int"]): ("SHIFT", 35), + (68, G["new"]): ("SHIFT", 22), (68, G["true"]): ("SHIFT", 25), (68, G["~"]): ("SHIFT", 27), - (68, G["false"]): ("SHIFT", 26), - (68, G["new"]): ("SHIFT", 22), - (68, G["string"]): ("SHIFT", 34), - (69, G["+"]): ("SHIFT", 40), - (69, G["-"]): ("SHIFT", 66), - (69, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), - (69, G["of"]): ("REDUCE", G["comp -> arith < arith"]), - (69, G[")"]): ("REDUCE", G["comp -> arith < arith"]), - (69, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), - (69, G["then"]): ("REDUCE", G["comp -> arith < arith"]), - (69, G["else"]): ("REDUCE", G["comp -> arith < arith"]), - (69, G["error"]): ("REDUCE", G["comp -> arith < arith"]), - (69, G[","]): ("REDUCE", G["comp -> arith < arith"]), - (69, G["in"]): ("REDUCE", G["comp -> arith < arith"]), - (69, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), - (69, G["}"]): ("REDUCE", G["comp -> arith < arith"]), - (69, G[";"]): ("REDUCE", G["comp -> arith < arith"]), - (70, G["isvoid"]): ("SHIFT", 24), + (68, G["isvoid"]): ("SHIFT", 24), + (68, G["int"]): ("SHIFT", 34), + (69, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["-"]): ("SHIFT", 64), + (69, G["+"]): ("SHIFT", 39), + (70, G["string"]): ("SHIFT", 33), + (70, G["false"]): ("SHIFT", 26), (70, G["id"]): ("SHIFT", 28), (70, G["("]): ("SHIFT", 11), - (70, G["int"]): ("SHIFT", 35), + (70, G["new"]): ("SHIFT", 22), (70, G["true"]): ("SHIFT", 25), (70, G["~"]): ("SHIFT", 27), - (70, G["false"]): ("SHIFT", 26), - (70, G["new"]): ("SHIFT", 22), - (70, G["string"]): ("SHIFT", 34), - (71, G["+"]): ("SHIFT", 40), - (71, G["-"]): ("SHIFT", 66), - (71, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), - (71, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), - (71, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), - (71, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), - (71, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), - (71, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), - (71, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), - (71, G[","]): ("REDUCE", G["comp -> arith <= arith"]), - (71, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), - (71, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), - (71, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), - (71, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), - (72, G["isvoid"]): ("SHIFT", 24), - (72, G["id"]): ("SHIFT", 28), - (72, G["("]): ("SHIFT", 11), - (72, G["int"]): ("SHIFT", 35), - (72, G["true"]): ("SHIFT", 25), - (72, G["~"]): ("SHIFT", 27), - (72, G["false"]): ("SHIFT", 26), - (72, G["new"]): ("SHIFT", 22), - (72, G["string"]): ("SHIFT", 34), - (73, G["+"]): ("SHIFT", 40), - (73, G["-"]): ("SHIFT", 66), - (73, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), - (73, G["of"]): ("REDUCE", G["comp -> arith = arith"]), - (73, G[")"]): ("REDUCE", G["comp -> arith = arith"]), - (73, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), - (73, G["then"]): ("REDUCE", G["comp -> arith = arith"]), - (73, G["else"]): ("REDUCE", G["comp -> arith = arith"]), - (73, G["error"]): ("REDUCE", G["comp -> arith = arith"]), - (73, G[","]): ("REDUCE", G["comp -> arith = arith"]), - (73, G["in"]): ("REDUCE", G["comp -> arith = arith"]), - (73, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), - (73, G["}"]): ("REDUCE", G["comp -> arith = arith"]), - (73, G[";"]): ("REDUCE", G["comp -> arith = arith"]), - (74, G["loop"]): ("REDUCE", G["expr -> not expr"]), - (74, G[";"]): ("REDUCE", G["expr -> not expr"]), - (74, G[")"]): ("REDUCE", G["expr -> not expr"]), - (74, G["pool"]): ("REDUCE", G["expr -> not expr"]), - (74, G["then"]): ("REDUCE", G["expr -> not expr"]), - (74, G["else"]): ("REDUCE", G["expr -> not expr"]), - (74, G["error"]): ("REDUCE", G["expr -> not expr"]), - (74, G[","]): ("REDUCE", G["expr -> not expr"]), - (74, G["in"]): ("REDUCE", G["expr -> not expr"]), - (74, G["fi"]): ("REDUCE", G["expr -> not expr"]), - (74, G["}"]): ("REDUCE", G["expr -> not expr"]), - (74, G["of"]): ("REDUCE", G["expr -> not expr"]), - (75, G[")"]): ("SHIFT", 76), - (76, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (76, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (76, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (76, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (76, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (76, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (76, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (76, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (76, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (76, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (76, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (76, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (76, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (76, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (76, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (76, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (76, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (76, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (76, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (76, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (76, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (77, G["<"]): ("REDUCE", G["factor -> ~ factor"]), - (77, G[")"]): ("REDUCE", G["factor -> ~ factor"]), - (77, G["then"]): ("REDUCE", G["factor -> ~ factor"]), - (77, G["<="]): ("REDUCE", G["factor -> ~ factor"]), - (77, G["else"]): ("REDUCE", G["factor -> ~ factor"]), - (77, G["="]): ("REDUCE", G["factor -> ~ factor"]), - (77, G[","]): ("REDUCE", G["factor -> ~ factor"]), - (77, G["/"]): ("REDUCE", G["factor -> ~ factor"]), - (77, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), - (77, G[";"]): ("REDUCE", G["factor -> ~ factor"]), - (77, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), - (77, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), - (77, G["+"]): ("REDUCE", G["factor -> ~ factor"]), - (77, G["-"]): ("REDUCE", G["factor -> ~ factor"]), - (77, G["error"]): ("REDUCE", G["factor -> ~ factor"]), - (77, G["in"]): ("REDUCE", G["factor -> ~ factor"]), - (77, G["*"]): ("REDUCE", G["factor -> ~ factor"]), - (77, G["}"]): ("REDUCE", G["factor -> ~ factor"]), - (77, G["of"]): ("REDUCE", G["factor -> ~ factor"]), - (78, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), - (78, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), - (78, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), - (78, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), - (78, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), - (78, G["="]): ("REDUCE", G["factor -> isvoid factor"]), - (78, G[","]): ("REDUCE", G["factor -> isvoid factor"]), - (78, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), - (78, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), - (78, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), - (78, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), - (78, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), - (78, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), - (78, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), - (78, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), - (78, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), - (78, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), - (78, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), - (78, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), - (79, G["of"]): ("SHIFT", 80), - (80, G["id"]): ("SHIFT", 81), - (81, G[":"]): ("SHIFT", 82), - (82, G["type"]): ("SHIFT", 83), - (83, G["=>"]): ("SHIFT", 84), - (84, G["id"]): ("SHIFT", 32), - (84, G["let"]): ("SHIFT", 14), - (84, G["while"]): ("SHIFT", 13), - (84, G["~"]): ("SHIFT", 27), - (84, G["true"]): ("SHIFT", 25), - (84, G["not"]): ("SHIFT", 31), - (84, G["if"]): ("SHIFT", 12), - (84, G["false"]): ("SHIFT", 26), - (84, G["{"]): ("SHIFT", 10), - (84, G["string"]): ("SHIFT", 34), - (84, G["case"]): ("SHIFT", 21), - (84, G["int"]): ("SHIFT", 35), - (84, G["new"]): ("SHIFT", 22), - (84, G["isvoid"]): ("SHIFT", 24), - (84, G["("]): ("SHIFT", 11), - (85, G["error"]): ("SHIFT", 88), - (85, G[";"]): ("SHIFT", 86), - (86, G["id"]): ("SHIFT", 81), - (86, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), - (87, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), - (88, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), - (89, G["esac"]): ("SHIFT", 90), - (90, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (91, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), - (91, G[","]): ("SHIFT", 92), - (92, G["id"]): ("SHIFT", 15), - (93, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), - (94, G["in"]): ("SHIFT", 95), - (95, G["true"]): ("SHIFT", 25), - (95, G["if"]): ("SHIFT", 12), - (95, G["false"]): ("SHIFT", 26), - (95, G["{"]): ("SHIFT", 10), - (95, G["string"]): ("SHIFT", 34), - (95, G["id"]): ("SHIFT", 32), - (95, G["case"]): ("SHIFT", 21), - (95, G["isvoid"]): ("SHIFT", 24), - (95, G["int"]): ("SHIFT", 35), - (95, G["new"]): ("SHIFT", 22), - (95, G["~"]): ("SHIFT", 27), - (95, G["("]): ("SHIFT", 11), - (95, G["let"]): ("SHIFT", 14), - (95, G["while"]): ("SHIFT", 13), - (95, G["not"]): ("SHIFT", 31), - (96, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (96, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (96, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (96, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (96, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (96, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (96, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (96, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (96, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (96, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (96, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (96, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (97, G["loop"]): ("SHIFT", 98), - (98, G["string"]): ("SHIFT", 34), - (98, G["id"]): ("SHIFT", 32), - (98, G["isvoid"]): ("SHIFT", 24), - (98, G["int"]): ("SHIFT", 35), - (98, G["let"]): ("SHIFT", 14), - (98, G["new"]): ("SHIFT", 22), - (98, G["while"]): ("SHIFT", 13), - (98, G["~"]): ("SHIFT", 27), - (98, G["not"]): ("SHIFT", 31), - (98, G["("]): ("SHIFT", 11), - (98, G["if"]): ("SHIFT", 12), - (98, G["{"]): ("SHIFT", 10), - (98, G["case"]): ("SHIFT", 21), - (98, G["true"]): ("SHIFT", 25), - (98, G["false"]): ("SHIFT", 26), - (99, G["pool"]): ("SHIFT", 100), - (100, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (100, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (100, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (100, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (100, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (100, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (100, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (100, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (100, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (100, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (100, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (100, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (101, G["then"]): ("SHIFT", 102), + (70, G["isvoid"]): ("SHIFT", 24), + (70, G["int"]): ("SHIFT", 34), + (71, G["-"]): ("SHIFT", 64), + (71, G["}"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[";"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["error"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["else"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["in"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["+"]): ("SHIFT", 39), + (72, G["}"]): ("REDUCE", G["expr -> not expr"]), + (72, G[";"]): ("REDUCE", G["expr -> not expr"]), + (72, G["of"]): ("REDUCE", G["expr -> not expr"]), + (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), + (72, G["in"]): ("REDUCE", G["expr -> not expr"]), + (72, G[")"]): ("REDUCE", G["expr -> not expr"]), + (72, G["error"]): ("REDUCE", G["expr -> not expr"]), + (72, G["then"]): ("REDUCE", G["expr -> not expr"]), + (72, G["pool"]): ("REDUCE", G["expr -> not expr"]), + (72, G["else"]): ("REDUCE", G["expr -> not expr"]), + (72, G[","]): ("REDUCE", G["expr -> not expr"]), + (72, G["fi"]): ("REDUCE", G["expr -> not expr"]), + (73, G[")"]): ("SHIFT", 74), + (74, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G["}"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["/"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["of"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["<"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G[")"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["then"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["<="]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["else"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["="]): ("REDUCE", G["factor -> ~ factor"]), + (75, G[","]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G[";"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["+"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["-"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["*"]): ("REDUCE", G["factor -> ~ factor"]), + (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), + (77, G["of"]): ("SHIFT", 78), + (78, G["id"]): ("SHIFT", 79), + (79, G[":"]): ("SHIFT", 80), + (80, G["type"]): ("SHIFT", 81), + (81, G["=>"]): ("SHIFT", 82), + (82, G["new"]): ("SHIFT", 22), + (82, G["int"]): ("SHIFT", 34), + (82, G["false"]): ("SHIFT", 26), + (82, G["if"]): ("SHIFT", 12), + (82, G["id"]): ("SHIFT", 31), + (82, G["~"]): ("SHIFT", 27), + (82, G["while"]): ("SHIFT", 13), + (82, G["isvoid"]): ("SHIFT", 24), + (82, G["true"]): ("SHIFT", 25), + (82, G["let"]): ("SHIFT", 14), + (82, G["case"]): ("SHIFT", 21), + (82, G["{"]): ("SHIFT", 10), + (82, G["string"]): ("SHIFT", 33), + (82, G["not"]): ("SHIFT", 30), + (82, G["("]): ("SHIFT", 11), + (83, G["error"]): ("SHIFT", 86), + (83, G[";"]): ("SHIFT", 84), + (84, G["id"]): ("SHIFT", 79), + (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), + (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), + (86, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), + (87, G["esac"]): ("SHIFT", 88), + (88, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), + (89, G[","]): ("SHIFT", 90), + (90, G["id"]): ("SHIFT", 15), + (91, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), + (92, G["in"]): ("SHIFT", 93), + (93, G["not"]): ("SHIFT", 30), + (93, G["{"]): ("SHIFT", 10), + (93, G["true"]): ("SHIFT", 25), + (93, G["~"]): ("SHIFT", 27), + (93, G["string"]): ("SHIFT", 33), + (93, G["isvoid"]): ("SHIFT", 24), + (93, G["("]): ("SHIFT", 11), + (93, G["new"]): ("SHIFT", 22), + (93, G["if"]): ("SHIFT", 12), + (93, G["int"]): ("SHIFT", 34), + (93, G["while"]): ("SHIFT", 13), + (93, G["let"]): ("SHIFT", 14), + (93, G["false"]): ("SHIFT", 26), + (93, G["id"]): ("SHIFT", 31), + (93, G["case"]): ("SHIFT", 21), + (94, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["loop"]): ("SHIFT", 96), + (96, G["not"]): ("SHIFT", 30), + (96, G["true"]): ("SHIFT", 25), + (96, G["string"]): ("SHIFT", 33), + (96, G["id"]): ("SHIFT", 31), + (96, G["("]): ("SHIFT", 11), + (96, G["new"]): ("SHIFT", 22), + (96, G["~"]): ("SHIFT", 27), + (96, G["int"]): ("SHIFT", 34), + (96, G["isvoid"]): ("SHIFT", 24), + (96, G["while"]): ("SHIFT", 13), + (96, G["if"]): ("SHIFT", 12), + (96, G["let"]): ("SHIFT", 14), + (96, G["false"]): ("SHIFT", 26), + (96, G["case"]): ("SHIFT", 21), + (96, G["{"]): ("SHIFT", 10), + (97, G["pool"]): ("SHIFT", 98), + (98, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["then"]): ("SHIFT", 100), + (100, G["let"]): ("SHIFT", 14), + (100, G["case"]): ("SHIFT", 21), + (100, G["~"]): ("SHIFT", 27), + (100, G["{"]): ("SHIFT", 10), + (100, G["not"]): ("SHIFT", 30), + (100, G["isvoid"]): ("SHIFT", 24), + (100, G["string"]): ("SHIFT", 33), + (100, G["("]): ("SHIFT", 11), + (100, G["new"]): ("SHIFT", 22), + (100, G["int"]): ("SHIFT", 34), + (100, G["id"]): ("SHIFT", 31), + (100, G["false"]): ("SHIFT", 26), + (100, G["if"]): ("SHIFT", 12), + (100, G["while"]): ("SHIFT", 13), + (100, G["true"]): ("SHIFT", 25), + (101, G["else"]): ("SHIFT", 102), + (102, G["if"]): ("SHIFT", 12), + (102, G["string"]): ("SHIFT", 33), + (102, G["while"]): ("SHIFT", 13), + (102, G["id"]): ("SHIFT", 31), + (102, G["let"]): ("SHIFT", 14), + (102, G["("]): ("SHIFT", 11), + (102, G["case"]): ("SHIFT", 21), + (102, G["new"]): ("SHIFT", 22), + (102, G["not"]): ("SHIFT", 30), (102, G["{"]): ("SHIFT", 10), (102, G["~"]): ("SHIFT", 27), - (102, G["case"]): ("SHIFT", 21), - (102, G["true"]): ("SHIFT", 25), - (102, G["false"]): ("SHIFT", 26), - (102, G["id"]): ("SHIFT", 32), - (102, G["string"]): ("SHIFT", 34), - (102, G["int"]): ("SHIFT", 35), + (102, G["int"]): ("SHIFT", 34), (102, G["isvoid"]): ("SHIFT", 24), - (102, G["new"]): ("SHIFT", 22), - (102, G["let"]): ("SHIFT", 14), - (102, G["while"]): ("SHIFT", 13), - (102, G["if"]): ("SHIFT", 12), - (102, G["not"]): ("SHIFT", 31), - (102, G["("]): ("SHIFT", 11), - (103, G["else"]): ("SHIFT", 104), - (104, G["if"]): ("SHIFT", 12), - (104, G["{"]): ("SHIFT", 10), - (104, G["int"]): ("SHIFT", 35), - (104, G["case"]): ("SHIFT", 21), - (104, G["new"]): ("SHIFT", 22), - (104, G["isvoid"]): ("SHIFT", 24), - (104, G["("]): ("SHIFT", 11), - (104, G["true"]): ("SHIFT", 25), - (104, G["~"]): ("SHIFT", 27), - (104, G["not"]): ("SHIFT", 31), - (104, G["id"]): ("SHIFT", 32), - (104, G["false"]): ("SHIFT", 26), - (104, G["string"]): ("SHIFT", 34), - (104, G["let"]): ("SHIFT", 14), - (104, G["while"]): ("SHIFT", 13), - (105, G["fi"]): ("SHIFT", 106), - (106, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (106, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (106, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (106, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (106, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (106, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (106, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (106, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (106, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (106, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (106, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (106, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (107, G[")"]): ("SHIFT", 108), - (108, G["<"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G[")"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["then"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["<="]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["."]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["else"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["="]): ("REDUCE", G["atom -> ( expr )"]), - (108, G[","]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["/"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G[";"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["@"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["+"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["-"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["error"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["in"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["*"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["}"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["of"]): ("REDUCE", G["atom -> ( expr )"]), - (109, G["}"]): ("SHIFT", 110), - (110, G["loop"]): ("REDUCE", G["expr -> { block }"]), - (110, G["of"]): ("REDUCE", G["expr -> { block }"]), - (110, G[")"]): ("REDUCE", G["expr -> { block }"]), - (110, G["pool"]): ("REDUCE", G["expr -> { block }"]), - (110, G["then"]): ("REDUCE", G["expr -> { block }"]), - (110, G["else"]): ("REDUCE", G["expr -> { block }"]), - (110, G["error"]): ("REDUCE", G["expr -> { block }"]), - (110, G[","]): ("REDUCE", G["expr -> { block }"]), - (110, G["in"]): ("REDUCE", G["expr -> { block }"]), - (110, G["fi"]): ("REDUCE", G["expr -> { block }"]), - (110, G["}"]): ("REDUCE", G["expr -> { block }"]), - (110, G[";"]): ("REDUCE", G["expr -> { block }"]), - (111, G[";"]): ("SHIFT", 112), - (112, G["true"]): ("SHIFT", 25), - (112, G["false"]): ("SHIFT", 26), - (112, G["id"]): ("SHIFT", 32), - (112, G["string"]): ("SHIFT", 34), - (112, G["let"]): ("SHIFT", 14), - (112, G["while"]): ("SHIFT", 13), - (112, G["}"]): ("REDUCE", G["block -> expr ;"]), - (112, G["isvoid"]): ("SHIFT", 24), - (112, G["if"]): ("SHIFT", 12), - (112, G["not"]): ("SHIFT", 31), - (112, G["int"]): ("SHIFT", 35), - (112, G["{"]): ("SHIFT", 10), - (112, G["case"]): ("SHIFT", 21), - (112, G["new"]): ("SHIFT", 22), - (112, G["~"]): ("SHIFT", 27), - (112, G["("]): ("SHIFT", 11), - (113, G["}"]): ("REDUCE", G["block -> expr ; block"]), - (114, G["}"]): ("SHIFT", 115), - (115, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), - (115, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), - (116, G[":"]): ("SHIFT", 117), - (117, G["type"]): ("SHIFT", 118), - (118, G[")"]): ("REDUCE", G["param-list -> id : type"]), - (118, G[","]): ("SHIFT", 119), - (119, G["id"]): ("SHIFT", 116), - (120, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), - (121, G[")"]): ("SHIFT", 122), - (122, G[":"]): ("SHIFT", 123), - (123, G["type"]): ("SHIFT", 124), - (124, G["{"]): ("SHIFT", 125), - (125, G["string"]): ("SHIFT", 34), - (125, G["id"]): ("SHIFT", 32), - (125, G["let"]): ("SHIFT", 14), - (125, G["int"]): ("SHIFT", 35), - (125, G["while"]): ("SHIFT", 13), - (125, G["isvoid"]): ("SHIFT", 24), - (125, G["not"]): ("SHIFT", 31), - (125, G["if"]): ("SHIFT", 12), - (125, G["new"]): ("SHIFT", 22), - (125, G["{"]): ("SHIFT", 10), - (125, G["case"]): ("SHIFT", 21), - (125, G["("]): ("SHIFT", 11), - (125, G["~"]): ("SHIFT", 27), - (125, G["true"]): ("SHIFT", 25), - (125, G["false"]): ("SHIFT", 26), - (126, G["}"]): ("SHIFT", 127), - (127, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), - (127, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), - (128, G["type"]): ("SHIFT", 129), - (129, G[";"]): ("REDUCE", G["attribute -> id : type"]), - (129, G["error"]): ("REDUCE", G["attribute -> id : type"]), - (129, G["<-"]): ("SHIFT", 130), - (130, G["id"]): ("SHIFT", 32), - (130, G["let"]): ("SHIFT", 14), - (130, G["~"]): ("SHIFT", 27), - (130, G["while"]): ("SHIFT", 13), - (130, G["true"]): ("SHIFT", 25), - (130, G["not"]): ("SHIFT", 31), - (130, G["if"]): ("SHIFT", 12), - (130, G["false"]): ("SHIFT", 26), - (130, G["{"]): ("SHIFT", 10), - (130, G["string"]): ("SHIFT", 34), - (130, G["case"]): ("SHIFT", 21), - (130, G["int"]): ("SHIFT", 35), - (130, G["new"]): ("SHIFT", 22), - (130, G["isvoid"]): ("SHIFT", 24), - (130, G["("]): ("SHIFT", 11), - (131, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), - (131, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), - (132, G["}"]): ("SHIFT", 133), - (133, G["class"]): ("REDUCE", G["class-def -> class type { feature-list }"]), - (133, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), - (134, G["error"]): ("SHIFT", 142), - (134, G[";"]): ("SHIFT", 135), - (135, G["}"]): ("REDUCE", G["feature-list -> e"]), - (135, G["id"]): ("SHIFT", 4), - (136, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), - (137, G["error"]): ("SHIFT", 140), - (137, G[";"]): ("SHIFT", 138), - (138, G["}"]): ("REDUCE", G["feature-list -> e"]), + (102, G["false"]): ("SHIFT", 26), + (102, G["true"]): ("SHIFT", 25), + (103, G["fi"]): ("SHIFT", 104), + (104, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G[")"]): ("SHIFT", 106), + (106, G["}"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["/"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["of"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["<"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G[")"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["then"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["<="]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["."]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["else"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["="]): ("REDUCE", G["atom -> ( expr )"]), + (106, G[","]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G[";"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["@"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["error"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["+"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["-"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["in"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["*"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["}"]): ("SHIFT", 108), + (108, G["}"]): ("REDUCE", G["expr -> { block }"]), + (108, G["of"]): ("REDUCE", G["expr -> { block }"]), + (108, G[";"]): ("REDUCE", G["expr -> { block }"]), + (108, G["loop"]): ("REDUCE", G["expr -> { block }"]), + (108, G[","]): ("REDUCE", G["expr -> { block }"]), + (108, G[")"]): ("REDUCE", G["expr -> { block }"]), + (108, G["error"]): ("REDUCE", G["expr -> { block }"]), + (108, G["then"]): ("REDUCE", G["expr -> { block }"]), + (108, G["pool"]): ("REDUCE", G["expr -> { block }"]), + (108, G["else"]): ("REDUCE", G["expr -> { block }"]), + (108, G["in"]): ("REDUCE", G["expr -> { block }"]), + (108, G["fi"]): ("REDUCE", G["expr -> { block }"]), + (109, G[";"]): ("SHIFT", 110), + (110, G["("]): ("SHIFT", 11), + (110, G["new"]): ("SHIFT", 22), + (110, G["if"]): ("SHIFT", 12), + (110, G["while"]): ("SHIFT", 13), + (110, G["let"]): ("SHIFT", 14), + (110, G["int"]): ("SHIFT", 34), + (110, G["id"]): ("SHIFT", 31), + (110, G["case"]): ("SHIFT", 21), + (110, G["false"]): ("SHIFT", 26), + (110, G["not"]): ("SHIFT", 30), + (110, G["{"]): ("SHIFT", 10), + (110, G["true"]): ("SHIFT", 25), + (110, G["}"]): ("REDUCE", G["block -> expr ;"]), + (110, G["string"]): ("SHIFT", 33), + (110, G["~"]): ("SHIFT", 27), + (110, G["isvoid"]): ("SHIFT", 24), + (111, G["}"]): ("REDUCE", G["block -> expr ; block"]), + (112, G["}"]): ("SHIFT", 113), + (113, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (113, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (114, G[":"]): ("SHIFT", 115), + (115, G["type"]): ("SHIFT", 116), + (116, G[")"]): ("REDUCE", G["param-list -> id : type"]), + (116, G[","]): ("SHIFT", 117), + (117, G["id"]): ("SHIFT", 114), + (118, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), + (119, G[")"]): ("SHIFT", 120), + (120, G[":"]): ("SHIFT", 121), + (121, G["type"]): ("SHIFT", 122), + (122, G["{"]): ("SHIFT", 123), + (123, G["false"]): ("SHIFT", 26), + (123, G["not"]): ("SHIFT", 30), + (123, G["{"]): ("SHIFT", 10), + (123, G["id"]): ("SHIFT", 31), + (123, G["true"]): ("SHIFT", 25), + (123, G["string"]): ("SHIFT", 33), + (123, G["("]): ("SHIFT", 11), + (123, G["new"]): ("SHIFT", 22), + (123, G["if"]): ("SHIFT", 12), + (123, G["while"]): ("SHIFT", 13), + (123, G["let"]): ("SHIFT", 14), + (123, G["int"]): ("SHIFT", 34), + (123, G["~"]): ("SHIFT", 27), + (123, G["isvoid"]): ("SHIFT", 24), + (123, G["case"]): ("SHIFT", 21), + (124, G["}"]): ("SHIFT", 125), + (125, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (125, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (126, G["type"]): ("SHIFT", 127), + (127, G["<-"]): ("SHIFT", 128), + (127, G["error"]): ("REDUCE", G["attribute -> id : type"]), + (127, G[";"]): ("REDUCE", G["attribute -> id : type"]), + (128, G["new"]): ("SHIFT", 22), + (128, G["int"]): ("SHIFT", 34), + (128, G["false"]): ("SHIFT", 26), + (128, G["if"]): ("SHIFT", 12), + (128, G["id"]): ("SHIFT", 31), + (128, G["while"]): ("SHIFT", 13), + (128, G["~"]): ("SHIFT", 27), + (128, G["isvoid"]): ("SHIFT", 24), + (128, G["true"]): ("SHIFT", 25), + (128, G["let"]): ("SHIFT", 14), + (128, G["case"]): ("SHIFT", 21), + (128, G["{"]): ("SHIFT", 10), + (128, G["string"]): ("SHIFT", 33), + (128, G["not"]): ("SHIFT", 30), + (128, G["("]): ("SHIFT", 11), + (129, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (129, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (130, G["}"]): ("SHIFT", 131), + (131, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), + (131, G["class"]): ("REDUCE", G["class-def -> class type { feature-list }"]), + (132, G[";"]): ("SHIFT", 133), + (132, G["error"]): ("SHIFT", 140), + (133, G["id"]): ("SHIFT", 4), + (133, G["}"]): ("REDUCE", G["feature-list -> e"]), + (134, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), + (135, G["error"]): ("SHIFT", 138), + (135, G[";"]): ("SHIFT", 136), + (136, G["id"]): ("SHIFT", 4), + (136, G["}"]): ("REDUCE", G["feature-list -> e"]), + (137, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), (138, G["id"]): ("SHIFT", 4), - (139, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), - (140, G["}"]): ("REDUCE", G["feature-list -> e"]), + (138, G["}"]): ("REDUCE", G["feature-list -> e"]), + (139, G["}"]): ("REDUCE", G["feature-list -> method error feature-list"]), (140, G["id"]): ("SHIFT", 4), - (141, G["}"]): ("REDUCE", G["feature-list -> method error feature-list"]), - (142, G["}"]): ("REDUCE", G["feature-list -> e"]), - (142, G["id"]): ("SHIFT", 4), - (143, G["}"]): ("REDUCE", G["feature-list -> attribute error feature-list"]), - (144, G["type"]): ("SHIFT", 145), - (145, G["{"]): ("SHIFT", 146), - (146, G["}"]): ("REDUCE", G["feature-list -> e"]), - (146, G["id"]): ("SHIFT", 4), - (147, G["}"]): ("SHIFT", 148), - (148, G["class"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), - (148, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), - (149, G["$"]): ("OK", None), - (150, G["$"]): ("REDUCE", G["program -> class-list"]), - (151, G["class"]): ("SHIFT", 1), - (151, G["$"]): ("REDUCE", G["class-list -> class-def"]), - (152, G["$"]): ("REDUCE", G["class-list -> class-def class-list"]), + (140, G["}"]): ("REDUCE", G["feature-list -> e"]), + (141, G["}"]): ("REDUCE", G["feature-list -> attribute error feature-list"]), + (142, G["type"]): ("SHIFT", 143), + (143, G["{"]): ("SHIFT", 144), + (144, G["id"]): ("SHIFT", 4), + (144, G["}"]): ("REDUCE", G["feature-list -> e"]), + (145, G["}"]): ("SHIFT", 146), + (146, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), + (146, G["class"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), + (147, G["$"]): ("OK", None), + (148, G["$"]): ("REDUCE", G["program -> class-list"]), + (149, G["$"]): ("REDUCE", G["class-list -> class-def"]), + (149, G["class"]): ("SHIFT", 1), + (150, G["$"]): ("REDUCE", G["class-list -> class-def class-list"]), } @staticmethod def __goto_table(): return { - (0, G["class-list"]): 150, - (0, G["class-def"]): 151, - (0, G["program"]): 149, - (3, G["method"]): 137, - (3, G["attribute"]): 134, - (3, G["feature-list"]): 132, - (5, G["param-list"]): 121, - (9, G["term"]): 54, - (9, G["arith"]): 39, - (9, G["function-call"]): 36, - (9, G["comp"]): 38, - (9, G["atom"]): 44, - (9, G["expr"]): 114, - (9, G["factor"]): 57, - (10, G["term"]): 54, - (10, G["expr"]): 111, - (10, G["atom"]): 44, - (10, G["arith"]): 39, - (10, G["comp"]): 38, - (10, G["function-call"]): 36, - (10, G["block"]): 109, - (10, G["factor"]): 57, - (11, G["arith"]): 39, - (11, G["function-call"]): 36, - (11, G["term"]): 54, - (11, G["expr"]): 107, - (11, G["atom"]): 44, - (11, G["factor"]): 57, - (11, G["comp"]): 38, - (12, G["arith"]): 39, - (12, G["atom"]): 44, - (12, G["term"]): 54, - (12, G["factor"]): 57, - (12, G["expr"]): 101, - (12, G["comp"]): 38, - (12, G["function-call"]): 36, - (13, G["term"]): 54, - (13, G["function-call"]): 36, - (13, G["arith"]): 39, - (13, G["atom"]): 44, - (13, G["comp"]): 38, - (13, G["factor"]): 57, - (13, G["expr"]): 97, - (14, G["declaration-list"]): 94, + (0, G["class-def"]): 149, + (0, G["class-list"]): 148, + (0, G["program"]): 147, + (3, G["feature-list"]): 130, + (3, G["method"]): 135, + (3, G["attribute"]): 132, + (5, G["param-list"]): 119, + (9, G["arith"]): 38, + (9, G["term"]): 53, + (9, G["factor"]): 56, + (9, G["expr"]): 112, + (9, G["comp"]): 37, + (9, G["atom"]): 43, + (9, G["function-call"]): 35, + (10, G["arith"]): 38, + (10, G["atom"]): 43, + (10, G["term"]): 53, + (10, G["factor"]): 56, + (10, G["expr"]): 109, + (10, G["block"]): 107, + (10, G["comp"]): 37, + (10, G["function-call"]): 35, + (11, G["factor"]): 56, + (11, G["function-call"]): 35, + (11, G["atom"]): 43, + (11, G["arith"]): 38, + (11, G["term"]): 53, + (11, G["comp"]): 37, + (11, G["expr"]): 105, + (12, G["factor"]): 56, + (12, G["arith"]): 38, + (12, G["expr"]): 99, + (12, G["atom"]): 43, + (12, G["term"]): 53, + (12, G["function-call"]): 35, + (12, G["comp"]): 37, + (13, G["comp"]): 37, + (13, G["expr"]): 95, + (13, G["arith"]): 38, + (13, G["term"]): 53, + (13, G["factor"]): 56, + (13, G["atom"]): 43, + (13, G["function-call"]): 35, + (14, G["declaration-list"]): 92, (18, G["declaration-list"]): 19, - (20, G["function-call"]): 36, - (20, G["arith"]): 39, - (20, G["term"]): 54, - (20, G["atom"]): 44, - (20, G["expr"]): 91, - (20, G["comp"]): 38, - (20, G["factor"]): 57, - (21, G["atom"]): 44, - (21, G["arith"]): 39, - (21, G["term"]): 54, - (21, G["factor"]): 57, - (21, G["comp"]): 38, - (21, G["function-call"]): 36, - (21, G["expr"]): 79, - (24, G["atom"]): 44, - (24, G["function-call"]): 36, - (24, G["factor"]): 78, - (27, G["atom"]): 44, - (27, G["function-call"]): 36, - (27, G["factor"]): 77, - (29, G["term"]): 54, - (29, G["expr"]): 51, - (29, G["arith"]): 39, - (29, G["expr-list"]): 75, - (29, G["comp"]): 38, - (29, G["function-call"]): 36, - (29, G["factor"]): 57, - (29, G["atom"]): 44, - (31, G["atom"]): 44, - (31, G["arith"]): 39, - (31, G["comp"]): 38, - (31, G["term"]): 54, - (31, G["expr"]): 74, - (31, G["function-call"]): 36, - (31, G["factor"]): 57, - (33, G["atom"]): 44, - (33, G["expr"]): 37, - (33, G["arith"]): 39, - (33, G["comp"]): 38, - (33, G["term"]): 54, - (33, G["function-call"]): 36, - (33, G["factor"]): 57, - (40, G["atom"]): 44, - (40, G["term"]): 41, - (40, G["function-call"]): 36, - (40, G["factor"]): 57, - (42, G["atom"]): 44, - (42, G["function-call"]): 36, - (42, G["factor"]): 43, - (47, G["term"]): 54, - (47, G["expr"]): 51, - (47, G["arith"]): 39, - (47, G["comp"]): 38, - (47, G["function-call"]): 36, - (47, G["expr-list"]): 49, - (47, G["factor"]): 57, - (47, G["atom"]): 44, - (52, G["term"]): 54, - (52, G["expr"]): 51, - (52, G["arith"]): 39, - (52, G["comp"]): 38, - (52, G["expr-list"]): 53, - (52, G["function-call"]): 36, - (52, G["factor"]): 57, - (52, G["atom"]): 44, - (55, G["atom"]): 44, - (55, G["function-call"]): 36, - (55, G["factor"]): 56, - (62, G["expr-list"]): 64, - (62, G["term"]): 54, - (62, G["expr"]): 51, - (62, G["arith"]): 39, - (62, G["comp"]): 38, - (62, G["function-call"]): 36, - (62, G["factor"]): 57, - (62, G["atom"]): 44, - (66, G["atom"]): 44, - (66, G["term"]): 67, - (66, G["function-call"]): 36, - (66, G["factor"]): 57, - (68, G["term"]): 54, + (20, G["atom"]): 43, + (20, G["function-call"]): 35, + (20, G["arith"]): 38, + (20, G["expr"]): 89, + (20, G["term"]): 53, + (20, G["factor"]): 56, + (20, G["comp"]): 37, + (21, G["atom"]): 43, + (21, G["function-call"]): 35, + (21, G["term"]): 53, + (21, G["factor"]): 56, + (21, G["arith"]): 38, + (21, G["expr"]): 77, + (21, G["comp"]): 37, + (24, G["atom"]): 43, + (24, G["function-call"]): 35, + (24, G["factor"]): 76, + (27, G["atom"]): 43, + (27, G["function-call"]): 35, + (27, G["factor"]): 75, + (29, G["arith"]): 38, + (29, G["factor"]): 56, + (29, G["expr-list"]): 73, + (29, G["expr"]): 50, + (29, G["atom"]): 43, + (29, G["term"]): 53, + (29, G["comp"]): 37, + (29, G["not-empty-expr-list"]): 49, + (29, G["function-call"]): 35, + (30, G["term"]): 53, + (30, G["arith"]): 38, + (30, G["atom"]): 43, + (30, G["function-call"]): 35, + (30, G["comp"]): 37, + (30, G["expr"]): 72, + (30, G["factor"]): 56, + (32, G["term"]): 53, + (32, G["arith"]): 38, + (32, G["atom"]): 43, + (32, G["function-call"]): 35, + (32, G["comp"]): 37, + (32, G["factor"]): 56, + (32, G["expr"]): 36, + (39, G["term"]): 40, + (39, G["atom"]): 43, + (39, G["factor"]): 56, + (39, G["function-call"]): 35, + (41, G["factor"]): 42, + (41, G["atom"]): 43, + (41, G["function-call"]): 35, + (46, G["arith"]): 38, + (46, G["factor"]): 56, + (46, G["expr"]): 50, + (46, G["atom"]): 43, + (46, G["term"]): 53, + (46, G["comp"]): 37, + (46, G["not-empty-expr-list"]): 49, + (46, G["function-call"]): 35, + (46, G["expr-list"]): 47, + (51, G["arith"]): 38, + (51, G["factor"]): 56, + (51, G["expr"]): 50, + (51, G["atom"]): 43, + (51, G["term"]): 53, + (51, G["comp"]): 37, + (51, G["function-call"]): 35, + (51, G["not-empty-expr-list"]): 52, + (54, G["atom"]): 43, + (54, G["function-call"]): 35, + (54, G["factor"]): 55, + (61, G["arith"]): 38, + (61, G["factor"]): 56, + (61, G["expr"]): 50, + (61, G["atom"]): 43, + (61, G["term"]): 53, + (61, G["comp"]): 37, + (61, G["expr-list"]): 62, + (61, G["not-empty-expr-list"]): 49, + (61, G["function-call"]): 35, + (64, G["term"]): 65, + (64, G["atom"]): 43, + (64, G["factor"]): 56, + (64, G["function-call"]): 35, + (66, G["atom"]): 43, + (66, G["term"]): 53, + (66, G["function-call"]): 35, + (66, G["arith"]): 67, + (66, G["factor"]): 56, + (68, G["atom"]): 43, + (68, G["term"]): 53, + (68, G["function-call"]): 35, (68, G["arith"]): 69, - (68, G["atom"]): 44, - (68, G["factor"]): 57, - (68, G["function-call"]): 36, - (70, G["term"]): 54, + (68, G["factor"]): 56, + (70, G["atom"]): 43, + (70, G["term"]): 53, + (70, G["function-call"]): 35, (70, G["arith"]): 71, - (70, G["atom"]): 44, - (70, G["factor"]): 57, - (70, G["function-call"]): 36, - (72, G["term"]): 54, - (72, G["arith"]): 73, - (72, G["atom"]): 44, - (72, G["factor"]): 57, - (72, G["function-call"]): 36, - (80, G["case-list"]): 89, - (84, G["atom"]): 44, - (84, G["expr"]): 85, - (84, G["term"]): 54, - (84, G["arith"]): 39, - (84, G["factor"]): 57, - (84, G["comp"]): 38, - (84, G["function-call"]): 36, - (86, G["case-list"]): 87, - (92, G["declaration-list"]): 93, - (95, G["atom"]): 44, - (95, G["arith"]): 39, - (95, G["comp"]): 38, - (95, G["term"]): 54, - (95, G["expr"]): 96, - (95, G["function-call"]): 36, - (95, G["factor"]): 57, - (98, G["atom"]): 44, - (98, G["arith"]): 39, - (98, G["term"]): 54, - (98, G["function-call"]): 36, - (98, G["expr"]): 99, - (98, G["factor"]): 57, - (98, G["comp"]): 38, - (102, G["atom"]): 44, - (102, G["arith"]): 39, - (102, G["comp"]): 38, - (102, G["factor"]): 57, - (102, G["term"]): 54, + (70, G["factor"]): 56, + (78, G["case-list"]): 87, + (82, G["atom"]): 43, + (82, G["comp"]): 37, + (82, G["expr"]): 83, + (82, G["term"]): 53, + (82, G["arith"]): 38, + (82, G["function-call"]): 35, + (82, G["factor"]): 56, + (84, G["case-list"]): 85, + (90, G["declaration-list"]): 91, + (93, G["term"]): 53, + (93, G["arith"]): 38, + (93, G["atom"]): 43, + (93, G["function-call"]): 35, + (93, G["expr"]): 94, + (93, G["comp"]): 37, + (93, G["factor"]): 56, + (96, G["factor"]): 56, + (96, G["arith"]): 38, + (96, G["atom"]): 43, + (96, G["expr"]): 97, + (96, G["term"]): 53, + (96, G["function-call"]): 35, + (96, G["comp"]): 37, + (100, G["term"]): 53, + (100, G["arith"]): 38, + (100, G["function-call"]): 35, + (100, G["atom"]): 43, + (100, G["expr"]): 101, + (100, G["factor"]): 56, + (100, G["comp"]): 37, + (102, G["arith"]): 38, + (102, G["atom"]): 43, + (102, G["function-call"]): 35, + (102, G["term"]): 53, (102, G["expr"]): 103, - (102, G["function-call"]): 36, - (104, G["arith"]): 39, - (104, G["comp"]): 38, - (104, G["function-call"]): 36, - (104, G["atom"]): 44, - (104, G["term"]): 54, - (104, G["expr"]): 105, - (104, G["factor"]): 57, - (112, G["term"]): 54, - (112, G["expr"]): 111, - (112, G["atom"]): 44, - (112, G["arith"]): 39, - (112, G["comp"]): 38, - (112, G["block"]): 113, - (112, G["function-call"]): 36, - (112, G["factor"]): 57, - (119, G["param-list"]): 120, - (125, G["term"]): 54, - (125, G["arith"]): 39, - (125, G["function-call"]): 36, - (125, G["expr"]): 126, - (125, G["comp"]): 38, - (125, G["atom"]): 44, - (125, G["factor"]): 57, - (130, G["atom"]): 44, - (130, G["term"]): 54, - (130, G["arith"]): 39, - (130, G["factor"]): 57, - (130, G["comp"]): 38, - (130, G["expr"]): 131, - (130, G["function-call"]): 36, - (135, G["feature-list"]): 136, - (135, G["method"]): 137, - (135, G["attribute"]): 134, + (102, G["comp"]): 37, + (102, G["factor"]): 56, + (110, G["arith"]): 38, + (110, G["atom"]): 43, + (110, G["term"]): 53, + (110, G["factor"]): 56, + (110, G["expr"]): 109, + (110, G["block"]): 111, + (110, G["comp"]): 37, + (110, G["function-call"]): 35, + (117, G["param-list"]): 118, + (123, G["expr"]): 124, + (123, G["arith"]): 38, + (123, G["term"]): 53, + (123, G["factor"]): 56, + (123, G["comp"]): 37, + (123, G["atom"]): 43, + (123, G["function-call"]): 35, + (128, G["atom"]): 43, + (128, G["comp"]): 37, + (128, G["term"]): 53, + (128, G["arith"]): 38, + (128, G["expr"]): 129, + (128, G["function-call"]): 35, + (128, G["factor"]): 56, + (133, G["feature-list"]): 134, + (133, G["method"]): 135, + (133, G["attribute"]): 132, + (136, G["feature-list"]): 137, + (136, G["method"]): 135, + (136, G["attribute"]): 132, + (138, G["method"]): 135, + (138, G["attribute"]): 132, (138, G["feature-list"]): 139, - (138, G["method"]): 137, - (138, G["attribute"]): 134, - (140, G["method"]): 137, - (140, G["attribute"]): 134, + (140, G["method"]): 135, + (140, G["attribute"]): 132, (140, G["feature-list"]): 141, - (142, G["method"]): 137, - (142, G["attribute"]): 134, - (142, G["feature-list"]): 143, - (146, G["feature-list"]): 147, - (146, G["method"]): 137, - (146, G["attribute"]): 134, - (151, G["class-def"]): 151, - (151, G["class-list"]): 152, + (144, G["method"]): 135, + (144, G["attribute"]): 132, + (144, G["feature-list"]): 145, + (149, G["class-def"]): 149, + (149, G["class-list"]): 150, } From 2c61af6fff5cb6edc4a4acdc0d4d59169b4b9ff7 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Mon, 18 May 2020 23:46:59 -0400 Subject: [PATCH 048/143] deleted terminal "char" from the grammar --- grammar.py | 3 +- lexer.py | 2 +- parser.py | 752 ++++++++++++++++++++++++++--------------------------- 3 files changed, 378 insertions(+), 379 deletions(-) diff --git a/grammar.py b/grammar.py index c77df5714..f0de94173 100755 --- a/grammar.py +++ b/grammar.py @@ -66,7 +66,6 @@ def id_terminal(lexer): ############### G.add_terminal('string', regex=r'\"[^\"]*\"') G.add_terminal('int', regex=r'\d+') -G.add_terminal('char', regex=r'\'[^\']*\'') ############ @@ -84,7 +83,7 @@ def comment(lexer): @G.terminal('comment_error', r'\(\*(.|\n)*$') -def comment_error(lexer): +def comment_eof_error(lexer): lexer.contain_errors = True lex = lexer.token.lex for s in lex: diff --git a/lexer.py b/lexer.py index 9b9a87ec1..d8535b91b 100755 --- a/lexer.py +++ b/lexer.py @@ -10,7 +10,7 @@ def __init__(self): self.column = 1 self.position = 0 self.token = Token('', '', 0, 0) - self.pattern = re.compile(r'(?P[a-z][a-zA-Z0-9_]*)|(?P(\(\*[^$]*\*\))|--.*)|(?P\(\*(.|\n)*$)|(?P\n+)|(?P +)|(?P\t+)|(?P[A-Z][a-zA-Z0-9_]*)|(?P\"[^\"]*\")|(?P\'[^\']*\')|(?P\d+)|(inherits)|(isvoid)|(class)|(while)|(false)|(then)|(else)|(loop)|(pool)|(case)|(esac)|(true)|(<\-)|(let)|(new)|(not)|(\{)|(\})|(\()|(\))|(\.)|(=>)|(if)|(fi)|(in)|(of)|(\+)|(\-)|(\*)|(<=)|(\~)|(,)|(:)|(;)|(@)|(/)|(<)|(=)') + self.pattern = re.compile(r'(?P[a-z][a-zA-Z0-9_]*)|(?P(\(\*[^$]*\*\))|--.*)|(?P\(\*(.|\n)*$)|(?P\n+)|(?P +)|(?P\t+)|(?P[A-Z][a-zA-Z0-9_]*)|(?P\"[^\"]*\")|(?P\d+)|(inherits)|(isvoid)|(class)|(while)|(false)|(then)|(else)|(loop)|(pool)|(case)|(esac)|(true)|(<\-)|(let)|(new)|(not)|(\{)|(\})|(\()|(\))|(\.)|(=>)|(if)|(fi)|(in)|(of)|(\+)|(\-)|(\*)|(<=)|(\~)|(,)|(:)|(;)|(@)|(/)|(<)|(=)') self.token_rules = {key: rule for key, (_, _, rule) in G.terminal_rules.items() if rule is not None} self.error_handler = G.lexical_error_handler if G.lexical_error_handler is not None else self.error self.contain_errors = False diff --git a/parser.py b/parser.py index f716c554f..ec1914432 100755 --- a/parser.py +++ b/parser.py @@ -15,8 +15,8 @@ def __action_table(): return { (0, G["class"]): ("SHIFT", 1), (1, G["type"]): ("SHIFT", 2), - (2, G["{"]): ("SHIFT", 3), (2, G["inherits"]): ("SHIFT", 142), + (2, G["{"]): ("SHIFT", 3), (3, G["id"]): ("SHIFT", 4), (3, G["}"]): ("REDUCE", G["feature-list -> e"]), (4, G[":"]): ("SHIFT", 126), @@ -26,119 +26,119 @@ def __action_table(): (6, G[":"]): ("SHIFT", 7), (7, G["type"]): ("SHIFT", 8), (8, G["{"]): ("SHIFT", 9), - (9, G["false"]): ("SHIFT", 26), - (9, G["not"]): ("SHIFT", 30), + (9, G["new"]): ("SHIFT", 22), (9, G["{"]): ("SHIFT", 10), (9, G["id"]): ("SHIFT", 31), (9, G["true"]): ("SHIFT", 25), - (9, G["string"]): ("SHIFT", 33), - (9, G["("]): ("SHIFT", 11), - (9, G["new"]): ("SHIFT", 22), + (9, G["int"]): ("SHIFT", 34), (9, G["if"]): ("SHIFT", 12), - (9, G["while"]): ("SHIFT", 13), + (9, G["not"]): ("SHIFT", 30), + (9, G["("]): ("SHIFT", 11), + (9, G["false"]): ("SHIFT", 26), + (9, G["string"]): ("SHIFT", 33), + (9, G["isvoid"]): ("SHIFT", 24), (9, G["let"]): ("SHIFT", 14), - (9, G["int"]): ("SHIFT", 34), + (9, G["while"]): ("SHIFT", 13), (9, G["~"]): ("SHIFT", 27), - (9, G["isvoid"]): ("SHIFT", 24), (9, G["case"]): ("SHIFT", 21), - (10, G["("]): ("SHIFT", 11), + (10, G["false"]): ("SHIFT", 26), + (10, G["case"]): ("SHIFT", 21), + (10, G["string"]): ("SHIFT", 33), + (10, G["id"]): ("SHIFT", 31), + (10, G["{"]): ("SHIFT", 10), + (10, G["isvoid"]): ("SHIFT", 24), (10, G["new"]): ("SHIFT", 22), + (10, G["~"]): ("SHIFT", 27), (10, G["if"]): ("SHIFT", 12), - (10, G["while"]): ("SHIFT", 13), - (10, G["let"]): ("SHIFT", 14), - (10, G["int"]): ("SHIFT", 34), - (10, G["id"]): ("SHIFT", 31), - (10, G["case"]): ("SHIFT", 21), - (10, G["false"]): ("SHIFT", 26), (10, G["not"]): ("SHIFT", 30), - (10, G["{"]): ("SHIFT", 10), (10, G["true"]): ("SHIFT", 25), - (10, G["string"]): ("SHIFT", 33), - (10, G["~"]): ("SHIFT", 27), - (10, G["isvoid"]): ("SHIFT", 24), - (11, G["let"]): ("SHIFT", 14), - (11, G["id"]): ("SHIFT", 31), + (10, G["int"]): ("SHIFT", 34), + (10, G["let"]): ("SHIFT", 14), + (10, G["("]): ("SHIFT", 11), + (10, G["while"]): ("SHIFT", 13), + (11, G["isvoid"]): ("SHIFT", 24), + (11, G["{"]): ("SHIFT", 10), (11, G["string"]): ("SHIFT", 33), - (11, G["case"]): ("SHIFT", 21), + (11, G["id"]): ("SHIFT", 31), + (11, G["~"]): ("SHIFT", 27), + (11, G["if"]): ("SHIFT", 12), (11, G["not"]): ("SHIFT", 30), - (11, G["{"]): ("SHIFT", 10), - (11, G["("]): ("SHIFT", 11), (11, G["new"]): ("SHIFT", 22), - (11, G["int"]): ("SHIFT", 34), - (11, G["false"]): ("SHIFT", 26), - (11, G["~"]): ("SHIFT", 27), - (11, G["isvoid"]): ("SHIFT", 24), + (11, G["let"]): ("SHIFT", 14), (11, G["true"]): ("SHIFT", 25), - (11, G["if"]): ("SHIFT", 12), (11, G["while"]): ("SHIFT", 13), - (12, G["let"]): ("SHIFT", 14), + (11, G["int"]): ("SHIFT", 34), + (11, G["case"]): ("SHIFT", 21), + (11, G["("]): ("SHIFT", 11), + (11, G["false"]): ("SHIFT", 26), (12, G["id"]): ("SHIFT", 31), - (12, G["case"]): ("SHIFT", 21), + (12, G["if"]): ("SHIFT", 12), (12, G["not"]): ("SHIFT", 30), - (12, G["{"]): ("SHIFT", 10), - (12, G["string"]): ("SHIFT", 33), - (12, G["("]): ("SHIFT", 11), + (12, G["isvoid"]): ("SHIFT", 24), (12, G["new"]): ("SHIFT", 22), + (12, G["let"]): ("SHIFT", 14), (12, G["~"]): ("SHIFT", 27), + (12, G["true"]): ("SHIFT", 25), + (12, G["while"]): ("SHIFT", 13), (12, G["int"]): ("SHIFT", 34), - (12, G["isvoid"]): ("SHIFT", 24), + (12, G["case"]): ("SHIFT", 21), + (12, G["("]): ("SHIFT", 11), (12, G["false"]): ("SHIFT", 26), - (12, G["if"]): ("SHIFT", 12), - (12, G["while"]): ("SHIFT", 13), - (12, G["true"]): ("SHIFT", 25), - (13, G["false"]): ("SHIFT", 26), + (12, G["{"]): ("SHIFT", 10), + (12, G["string"]): ("SHIFT", 33), (13, G["~"]): ("SHIFT", 27), - (13, G["isvoid"]): ("SHIFT", 24), (13, G["id"]): ("SHIFT", 31), - (13, G["true"]): ("SHIFT", 25), - (13, G["string"]): ("SHIFT", 33), - (13, G["while"]): ("SHIFT", 13), (13, G["if"]): ("SHIFT", 12), - (13, G["let"]): ("SHIFT", 14), - (13, G["("]): ("SHIFT", 11), + (13, G["not"]): ("SHIFT", 30), (13, G["new"]): ("SHIFT", 22), + (13, G["let"]): ("SHIFT", 14), + (13, G["true"]): ("SHIFT", 25), + (13, G["int"]): ("SHIFT", 34), + (13, G["while"]): ("SHIFT", 13), (13, G["case"]): ("SHIFT", 21), - (13, G["not"]): ("SHIFT", 30), + (13, G["("]): ("SHIFT", 11), + (13, G["false"]): ("SHIFT", 26), + (13, G["string"]): ("SHIFT", 33), + (13, G["isvoid"]): ("SHIFT", 24), (13, G["{"]): ("SHIFT", 10), - (13, G["int"]): ("SHIFT", 34), (14, G["id"]): ("SHIFT", 15), (15, G[":"]): ("SHIFT", 16), (16, G["type"]): ("SHIFT", 17), - (17, G["<-"]): ("SHIFT", 20), (17, G[","]): ("SHIFT", 18), + (17, G["<-"]): ("SHIFT", 20), (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), (18, G["id"]): ("SHIFT", 15), (19, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), - (20, G["~"]): ("SHIFT", 27), - (20, G["if"]): ("SHIFT", 12), - (20, G["while"]): ("SHIFT", 13), (20, G["("]): ("SHIFT", 11), + (20, G["false"]): ("SHIFT", 26), + (20, G["string"]): ("SHIFT", 33), + (20, G["{"]): ("SHIFT", 10), (20, G["isvoid"]): ("SHIFT", 24), - (20, G["new"]): ("SHIFT", 22), - (20, G["let"]): ("SHIFT", 14), (20, G["id"]): ("SHIFT", 31), - (20, G["case"]): ("SHIFT", 21), - (20, G["int"]): ("SHIFT", 34), + (20, G["~"]): ("SHIFT", 27), (20, G["not"]): ("SHIFT", 30), - (20, G["{"]): ("SHIFT", 10), - (20, G["false"]): ("SHIFT", 26), + (20, G["if"]): ("SHIFT", 12), + (20, G["new"]): ("SHIFT", 22), + (20, G["let"]): ("SHIFT", 14), (20, G["true"]): ("SHIFT", 25), - (20, G["string"]): ("SHIFT", 33), - (21, G["let"]): ("SHIFT", 14), + (20, G["int"]): ("SHIFT", 34), + (20, G["while"]): ("SHIFT", 13), + (20, G["case"]): ("SHIFT", 21), + (21, G["{"]): ("SHIFT", 10), + (21, G["true"]): ("SHIFT", 25), + (21, G["int"]): ("SHIFT", 34), (21, G["id"]): ("SHIFT", 31), - (21, G["case"]): ("SHIFT", 21), + (21, G["isvoid"]): ("SHIFT", 24), (21, G["("]): ("SHIFT", 11), (21, G["not"]): ("SHIFT", 30), - (21, G["{"]): ("SHIFT", 10), - (21, G["new"]): ("SHIFT", 22), - (21, G["int"]): ("SHIFT", 34), + (21, G["if"]): ("SHIFT", 12), (21, G["false"]): ("SHIFT", 26), - (21, G["true"]): ("SHIFT", 25), + (21, G["string"]): ("SHIFT", 33), (21, G["~"]): ("SHIFT", 27), - (21, G["isvoid"]): ("SHIFT", 24), - (21, G["if"]): ("SHIFT", 12), + (21, G["let"]): ("SHIFT", 14), (21, G["while"]): ("SHIFT", 13), - (21, G["string"]): ("SHIFT", 33), + (21, G["case"]): ("SHIFT", 21), + (21, G["new"]): ("SHIFT", 22), (22, G["type"]): ("SHIFT", 23), (23, G["}"]): ("REDUCE", G["atom -> new type"]), (23, G["/"]): ("REDUCE", G["atom -> new type"]), @@ -161,15 +161,15 @@ def __action_table(): (23, G["-"]): ("REDUCE", G["atom -> new type"]), (23, G["in"]): ("REDUCE", G["atom -> new type"]), (23, G["*"]): ("REDUCE", G["atom -> new type"]), - (24, G["string"]): ("SHIFT", 33), - (24, G["isvoid"]): ("SHIFT", 24), (24, G["true"]): ("SHIFT", 25), - (24, G["new"]): ("SHIFT", 22), (24, G["("]): ("SHIFT", 11), - (24, G["false"]): ("SHIFT", 26), - (24, G["~"]): ("SHIFT", 27), (24, G["id"]): ("SHIFT", 28), + (24, G["new"]): ("SHIFT", 22), (24, G["int"]): ("SHIFT", 34), + (24, G["false"]): ("SHIFT", 26), + (24, G["string"]): ("SHIFT", 33), + (24, G["~"]): ("SHIFT", 27), + (24, G["isvoid"]): ("SHIFT", 24), (25, G["}"]): ("REDUCE", G["atom -> true"]), (25, G["/"]): ("REDUCE", G["atom -> true"]), (25, G["of"]): ("REDUCE", G["atom -> true"]), @@ -212,15 +212,16 @@ def __action_table(): (26, G["-"]): ("REDUCE", G["atom -> false"]), (26, G["in"]): ("REDUCE", G["atom -> false"]), (26, G["*"]): ("REDUCE", G["atom -> false"]), - (27, G["string"]): ("SHIFT", 33), - (27, G["isvoid"]): ("SHIFT", 24), (27, G["true"]): ("SHIFT", 25), - (27, G["new"]): ("SHIFT", 22), (27, G["("]): ("SHIFT", 11), - (27, G["false"]): ("SHIFT", 26), - (27, G["~"]): ("SHIFT", 27), (27, G["id"]): ("SHIFT", 28), + (27, G["new"]): ("SHIFT", 22), (27, G["int"]): ("SHIFT", 34), + (27, G["false"]): ("SHIFT", 26), + (27, G["string"]): ("SHIFT", 33), + (27, G["~"]): ("SHIFT", 27), + (27, G["isvoid"]): ("SHIFT", 24), + (28, G["("]): ("SHIFT", 29), (28, G["}"]): ("REDUCE", G["atom -> id"]), (28, G["/"]): ("REDUCE", G["atom -> id"]), (28, G["of"]): ("REDUCE", G["atom -> id"]), @@ -242,38 +243,38 @@ def __action_table(): (28, G["-"]): ("REDUCE", G["atom -> id"]), (28, G["in"]): ("REDUCE", G["atom -> id"]), (28, G["*"]): ("REDUCE", G["atom -> id"]), - (28, G["("]): ("SHIFT", 29), - (29, G["false"]): ("SHIFT", 26), - (29, G["id"]): ("SHIFT", 31), - (29, G["true"]): ("SHIFT", 25), - (29, G[")"]): ("REDUCE", G["expr-list -> e"]), - (29, G["string"]): ("SHIFT", 33), (29, G["~"]): ("SHIFT", 27), - (29, G["if"]): ("SHIFT", 12), - (29, G["while"]): ("SHIFT", 13), - (29, G["isvoid"]): ("SHIFT", 24), - (29, G["("]): ("SHIFT", 11), (29, G["new"]): ("SHIFT", 22), (29, G["let"]): ("SHIFT", 14), - (29, G["int"]): ("SHIFT", 34), + (29, G["if"]): ("SHIFT", 12), + (29, G["id"]): ("SHIFT", 31), + (29, G["while"]): ("SHIFT", 13), (29, G["case"]): ("SHIFT", 21), + (29, G["true"]): ("SHIFT", 25), + (29, G["int"]): ("SHIFT", 34), + (29, G[")"]): ("REDUCE", G["expr-list -> e"]), + (29, G["("]): ("SHIFT", 11), (29, G["{"]): ("SHIFT", 10), + (29, G["false"]): ("SHIFT", 26), + (29, G["string"]): ("SHIFT", 33), (29, G["not"]): ("SHIFT", 30), - (30, G["not"]): ("SHIFT", 30), - (30, G["{"]): ("SHIFT", 10), + (29, G["isvoid"]): ("SHIFT", 24), (30, G["true"]): ("SHIFT", 25), + (30, G["not"]): ("SHIFT", 30), + (30, G["int"]): ("SHIFT", 34), + (30, G["if"]): ("SHIFT", 12), (30, G["~"]): ("SHIFT", 27), - (30, G["string"]): ("SHIFT", 33), - (30, G["isvoid"]): ("SHIFT", 24), (30, G["("]): ("SHIFT", 11), - (30, G["new"]): ("SHIFT", 22), - (30, G["if"]): ("SHIFT", 12), - (30, G["int"]): ("SHIFT", 34), - (30, G["while"]): ("SHIFT", 13), (30, G["let"]): ("SHIFT", 14), (30, G["false"]): ("SHIFT", 26), - (30, G["id"]): ("SHIFT", 31), + (30, G["string"]): ("SHIFT", 33), + (30, G["while"]): ("SHIFT", 13), (30, G["case"]): ("SHIFT", 21), + (30, G["id"]): ("SHIFT", 31), + (30, G["{"]): ("SHIFT", 10), + (30, G["new"]): ("SHIFT", 22), + (30, G["isvoid"]): ("SHIFT", 24), + (31, G["("]): ("SHIFT", 29), (31, G["}"]): ("REDUCE", G["atom -> id"]), (31, G["/"]): ("REDUCE", G["atom -> id"]), (31, G["of"]): ("REDUCE", G["atom -> id"]), @@ -296,22 +297,21 @@ def __action_table(): (31, G["in"]): ("REDUCE", G["atom -> id"]), (31, G["*"]): ("REDUCE", G["atom -> id"]), (31, G["<-"]): ("SHIFT", 32), - (31, G["("]): ("SHIFT", 29), - (32, G["not"]): ("SHIFT", 30), - (32, G["{"]): ("SHIFT", 10), (32, G["true"]): ("SHIFT", 25), + (32, G["not"]): ("SHIFT", 30), + (32, G["int"]): ("SHIFT", 34), + (32, G["if"]): ("SHIFT", 12), (32, G["~"]): ("SHIFT", 27), - (32, G["string"]): ("SHIFT", 33), - (32, G["isvoid"]): ("SHIFT", 24), (32, G["("]): ("SHIFT", 11), - (32, G["new"]): ("SHIFT", 22), - (32, G["if"]): ("SHIFT", 12), - (32, G["int"]): ("SHIFT", 34), - (32, G["while"]): ("SHIFT", 13), (32, G["let"]): ("SHIFT", 14), (32, G["false"]): ("SHIFT", 26), - (32, G["id"]): ("SHIFT", 31), + (32, G["string"]): ("SHIFT", 33), + (32, G["while"]): ("SHIFT", 13), (32, G["case"]): ("SHIFT", 21), + (32, G["id"]): ("SHIFT", 31), + (32, G["{"]): ("SHIFT", 10), + (32, G["new"]): ("SHIFT", 22), + (32, G["isvoid"]): ("SHIFT", 24), (33, G["}"]): ("REDUCE", G["atom -> string"]), (33, G["/"]): ("REDUCE", G["atom -> string"]), (33, G["of"]): ("REDUCE", G["atom -> string"]), @@ -375,11 +375,11 @@ def __action_table(): (35, G["-"]): ("REDUCE", G["atom -> function-call"]), (35, G["in"]): ("REDUCE", G["atom -> function-call"]), (35, G["*"]): ("REDUCE", G["atom -> function-call"]), + (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), (36, G["}"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), @@ -387,11 +387,11 @@ def __action_table(): (36, G["else"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["in"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), + (37, G[","]): ("REDUCE", G["expr -> comp"]), (37, G["}"]): ("REDUCE", G["expr -> comp"]), - (37, G["of"]): ("REDUCE", G["expr -> comp"]), (37, G[";"]): ("REDUCE", G["expr -> comp"]), + (37, G["of"]): ("REDUCE", G["expr -> comp"]), (37, G["loop"]): ("REDUCE", G["expr -> comp"]), - (37, G[","]): ("REDUCE", G["expr -> comp"]), (37, G[")"]): ("REDUCE", G["expr -> comp"]), (37, G["error"]): ("REDUCE", G["expr -> comp"]), (37, G["then"]): ("REDUCE", G["expr -> comp"]), @@ -399,16 +399,14 @@ def __action_table(): (37, G["else"]): ("REDUCE", G["expr -> comp"]), (37, G["in"]): ("REDUCE", G["expr -> comp"]), (37, G["fi"]): ("REDUCE", G["expr -> comp"]), - (38, G["<"]): ("SHIFT", 66), - (38, G["<="]): ("SHIFT", 68), (38, G["+"]): ("SHIFT", 39), - (38, G["-"]): ("SHIFT", 64), + (38, G["<"]): ("SHIFT", 66), (38, G["="]): ("SHIFT", 70), + (38, G[","]): ("REDUCE", G["comp -> arith"]), (38, G["}"]): ("REDUCE", G["comp -> arith"]), - (38, G["of"]): ("REDUCE", G["comp -> arith"]), (38, G[";"]): ("REDUCE", G["comp -> arith"]), + (38, G["of"]): ("REDUCE", G["comp -> arith"]), (38, G["loop"]): ("REDUCE", G["comp -> arith"]), - (38, G[","]): ("REDUCE", G["comp -> arith"]), (38, G[")"]): ("REDUCE", G["comp -> arith"]), (38, G["error"]): ("REDUCE", G["comp -> arith"]), (38, G["then"]): ("REDUCE", G["comp -> arith"]), @@ -416,15 +414,17 @@ def __action_table(): (38, G["else"]): ("REDUCE", G["comp -> arith"]), (38, G["in"]): ("REDUCE", G["comp -> arith"]), (38, G["fi"]): ("REDUCE", G["comp -> arith"]), + (38, G["<="]): ("SHIFT", 68), + (38, G["-"]): ("SHIFT", 64), (39, G["true"]): ("SHIFT", 25), - (39, G["new"]): ("SHIFT", 22), (39, G["id"]): ("SHIFT", 28), - (39, G["~"]): ("SHIFT", 27), (39, G["int"]): ("SHIFT", 34), + (39, G["~"]): ("SHIFT", 27), + (39, G["("]): ("SHIFT", 11), + (39, G["new"]): ("SHIFT", 22), + (39, G["false"]): ("SHIFT", 26), (39, G["string"]): ("SHIFT", 33), (39, G["isvoid"]): ("SHIFT", 24), - (39, G["false"]): ("SHIFT", 26), - (39, G["("]): ("SHIFT", 11), (40, G["*"]): ("SHIFT", 41), (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), (40, G["of"]): ("REDUCE", G["arith -> arith + term"]), @@ -444,15 +444,15 @@ def __action_table(): (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), (40, G["/"]): ("SHIFT", 54), - (41, G["string"]): ("SHIFT", 33), - (41, G["isvoid"]): ("SHIFT", 24), (41, G["true"]): ("SHIFT", 25), - (41, G["new"]): ("SHIFT", 22), (41, G["("]): ("SHIFT", 11), - (41, G["false"]): ("SHIFT", 26), - (41, G["~"]): ("SHIFT", 27), (41, G["id"]): ("SHIFT", 28), + (41, G["new"]): ("SHIFT", 22), (41, G["int"]): ("SHIFT", 34), + (41, G["false"]): ("SHIFT", 26), + (41, G["string"]): ("SHIFT", 33), + (41, G["~"]): ("SHIFT", 27), + (41, G["isvoid"]): ("SHIFT", 24), (42, G["}"]): ("REDUCE", G["term -> term * factor"]), (42, G["/"]): ("REDUCE", G["term -> term * factor"]), (42, G["of"]): ("REDUCE", G["term -> term * factor"]), @@ -472,8 +472,6 @@ def __action_table(): (42, G["-"]): ("REDUCE", G["term -> term * factor"]), (42, G["in"]): ("REDUCE", G["term -> term * factor"]), (42, G["*"]): ("REDUCE", G["term -> term * factor"]), - (43, G["@"]): ("SHIFT", 57), - (43, G["."]): ("SHIFT", 44), (43, G["}"]): ("REDUCE", G["factor -> atom"]), (43, G["/"]): ("REDUCE", G["factor -> atom"]), (43, G["of"]): ("REDUCE", G["factor -> atom"]), @@ -493,24 +491,26 @@ def __action_table(): (43, G["-"]): ("REDUCE", G["factor -> atom"]), (43, G["in"]): ("REDUCE", G["factor -> atom"]), (43, G["*"]): ("REDUCE", G["factor -> atom"]), + (43, G["@"]): ("SHIFT", 57), + (43, G["."]): ("SHIFT", 44), (44, G["id"]): ("SHIFT", 45), (45, G["("]): ("SHIFT", 46), - (46, G["false"]): ("SHIFT", 26), - (46, G["id"]): ("SHIFT", 31), - (46, G["true"]): ("SHIFT", 25), - (46, G[")"]): ("REDUCE", G["expr-list -> e"]), - (46, G["string"]): ("SHIFT", 33), (46, G["~"]): ("SHIFT", 27), - (46, G["if"]): ("SHIFT", 12), - (46, G["while"]): ("SHIFT", 13), - (46, G["isvoid"]): ("SHIFT", 24), - (46, G["("]): ("SHIFT", 11), (46, G["new"]): ("SHIFT", 22), (46, G["let"]): ("SHIFT", 14), - (46, G["int"]): ("SHIFT", 34), + (46, G["if"]): ("SHIFT", 12), + (46, G["id"]): ("SHIFT", 31), + (46, G["while"]): ("SHIFT", 13), (46, G["case"]): ("SHIFT", 21), + (46, G["true"]): ("SHIFT", 25), + (46, G["int"]): ("SHIFT", 34), + (46, G[")"]): ("REDUCE", G["expr-list -> e"]), + (46, G["("]): ("SHIFT", 11), (46, G["{"]): ("SHIFT", 10), + (46, G["false"]): ("SHIFT", 26), + (46, G["string"]): ("SHIFT", 33), (46, G["not"]): ("SHIFT", 30), + (46, G["isvoid"]): ("SHIFT", 24), (47, G[")"]): ("SHIFT", 48), (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), @@ -534,24 +534,26 @@ def __action_table(): (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (49, G[")"]): ("REDUCE", G["expr-list -> not-empty-expr-list"]), - (50, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), (50, G[","]): ("SHIFT", 51), - (51, G["false"]): ("SHIFT", 26), - (51, G["id"]): ("SHIFT", 31), - (51, G["true"]): ("SHIFT", 25), - (51, G["string"]): ("SHIFT", 33), + (50, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), (51, G["~"]): ("SHIFT", 27), - (51, G["if"]): ("SHIFT", 12), - (51, G["while"]): ("SHIFT", 13), - (51, G["("]): ("SHIFT", 11), - (51, G["isvoid"]): ("SHIFT", 24), (51, G["new"]): ("SHIFT", 22), (51, G["let"]): ("SHIFT", 14), - (51, G["int"]): ("SHIFT", 34), + (51, G["if"]): ("SHIFT", 12), + (51, G["id"]): ("SHIFT", 31), + (51, G["while"]): ("SHIFT", 13), (51, G["case"]): ("SHIFT", 21), + (51, G["true"]): ("SHIFT", 25), + (51, G["int"]): ("SHIFT", 34), + (51, G["("]): ("SHIFT", 11), (51, G["{"]): ("SHIFT", 10), + (51, G["false"]): ("SHIFT", 26), + (51, G["string"]): ("SHIFT", 33), (51, G["not"]): ("SHIFT", 30), + (51, G["isvoid"]): ("SHIFT", 24), (52, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr , not-empty-expr-list"]), + (53, G["/"]): ("SHIFT", 54), + (53, G["*"]): ("SHIFT", 41), (53, G["}"]): ("REDUCE", G["arith -> term"]), (53, G["of"]): ("REDUCE", G["arith -> term"]), (53, G["<"]): ("REDUCE", G["arith -> term"]), @@ -569,17 +571,15 @@ def __action_table(): (53, G["+"]): ("REDUCE", G["arith -> term"]), (53, G["-"]): ("REDUCE", G["arith -> term"]), (53, G["in"]): ("REDUCE", G["arith -> term"]), - (53, G["*"]): ("SHIFT", 41), - (53, G["/"]): ("SHIFT", 54), - (54, G["string"]): ("SHIFT", 33), - (54, G["isvoid"]): ("SHIFT", 24), (54, G["true"]): ("SHIFT", 25), - (54, G["new"]): ("SHIFT", 22), (54, G["("]): ("SHIFT", 11), - (54, G["false"]): ("SHIFT", 26), - (54, G["~"]): ("SHIFT", 27), (54, G["id"]): ("SHIFT", 28), + (54, G["new"]): ("SHIFT", 22), (54, G["int"]): ("SHIFT", 34), + (54, G["false"]): ("SHIFT", 26), + (54, G["string"]): ("SHIFT", 33), + (54, G["~"]): ("SHIFT", 27), + (54, G["isvoid"]): ("SHIFT", 24), (55, G["}"]): ("REDUCE", G["term -> term / factor"]), (55, G["/"]): ("REDUCE", G["term -> term / factor"]), (55, G["of"]): ("REDUCE", G["term -> term / factor"]), @@ -622,22 +622,22 @@ def __action_table(): (58, G["."]): ("SHIFT", 59), (59, G["id"]): ("SHIFT", 60), (60, G["("]): ("SHIFT", 61), - (61, G["false"]): ("SHIFT", 26), - (61, G["id"]): ("SHIFT", 31), - (61, G["true"]): ("SHIFT", 25), - (61, G[")"]): ("REDUCE", G["expr-list -> e"]), - (61, G["string"]): ("SHIFT", 33), (61, G["~"]): ("SHIFT", 27), - (61, G["if"]): ("SHIFT", 12), - (61, G["while"]): ("SHIFT", 13), - (61, G["isvoid"]): ("SHIFT", 24), - (61, G["("]): ("SHIFT", 11), (61, G["new"]): ("SHIFT", 22), (61, G["let"]): ("SHIFT", 14), - (61, G["int"]): ("SHIFT", 34), + (61, G["if"]): ("SHIFT", 12), + (61, G["id"]): ("SHIFT", 31), + (61, G["while"]): ("SHIFT", 13), (61, G["case"]): ("SHIFT", 21), + (61, G["true"]): ("SHIFT", 25), + (61, G["int"]): ("SHIFT", 34), + (61, G[")"]): ("REDUCE", G["expr-list -> e"]), + (61, G["("]): ("SHIFT", 11), (61, G["{"]): ("SHIFT", 10), + (61, G["false"]): ("SHIFT", 26), + (61, G["string"]): ("SHIFT", 33), (61, G["not"]): ("SHIFT", 30), + (61, G["isvoid"]): ("SHIFT", 24), (62, G[")"]): ("SHIFT", 63), (63, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), @@ -661,14 +661,14 @@ def __action_table(): (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (64, G["true"]): ("SHIFT", 25), - (64, G["new"]): ("SHIFT", 22), (64, G["id"]): ("SHIFT", 28), - (64, G["~"]): ("SHIFT", 27), (64, G["int"]): ("SHIFT", 34), + (64, G["~"]): ("SHIFT", 27), + (64, G["("]): ("SHIFT", 11), + (64, G["new"]): ("SHIFT", 22), + (64, G["false"]): ("SHIFT", 26), (64, G["string"]): ("SHIFT", 33), (64, G["isvoid"]): ("SHIFT", 24), - (64, G["false"]): ("SHIFT", 26), - (64, G["("]): ("SHIFT", 11), (65, G["*"]): ("SHIFT", 41), (65, G["}"]): ("REDUCE", G["arith -> arith - term"]), (65, G["of"]): ("REDUCE", G["arith -> arith - term"]), @@ -688,22 +688,20 @@ def __action_table(): (65, G["-"]): ("REDUCE", G["arith -> arith - term"]), (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), (65, G["/"]): ("SHIFT", 54), - (66, G["string"]): ("SHIFT", 33), - (66, G["false"]): ("SHIFT", 26), - (66, G["id"]): ("SHIFT", 28), (66, G["("]): ("SHIFT", 11), + (66, G["isvoid"]): ("SHIFT", 24), (66, G["new"]): ("SHIFT", 22), - (66, G["true"]): ("SHIFT", 25), + (66, G["false"]): ("SHIFT", 26), + (66, G["string"]): ("SHIFT", 33), + (66, G["id"]): ("SHIFT", 28), (66, G["~"]): ("SHIFT", 27), - (66, G["isvoid"]): ("SHIFT", 24), + (66, G["true"]): ("SHIFT", 25), (66, G["int"]): ("SHIFT", 34), - (67, G["-"]): ("SHIFT", 64), - (67, G["+"]): ("SHIFT", 39), + (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), (67, G["}"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), @@ -711,20 +709,23 @@ def __action_table(): (67, G["else"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["in"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), - (68, G["string"]): ("SHIFT", 33), - (68, G["false"]): ("SHIFT", 26), - (68, G["id"]): ("SHIFT", 28), + (67, G["+"]): ("SHIFT", 39), + (67, G["-"]): ("SHIFT", 64), (68, G["("]): ("SHIFT", 11), + (68, G["isvoid"]): ("SHIFT", 24), (68, G["new"]): ("SHIFT", 22), - (68, G["true"]): ("SHIFT", 25), + (68, G["false"]): ("SHIFT", 26), + (68, G["string"]): ("SHIFT", 33), + (68, G["id"]): ("SHIFT", 28), (68, G["~"]): ("SHIFT", 27), - (68, G["isvoid"]): ("SHIFT", 24), + (68, G["true"]): ("SHIFT", 25), (68, G["int"]): ("SHIFT", 34), + (69, G["+"]): ("SHIFT", 39), + (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), @@ -733,22 +734,21 @@ def __action_table(): (69, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["-"]): ("SHIFT", 64), - (69, G["+"]): ("SHIFT", 39), - (70, G["string"]): ("SHIFT", 33), - (70, G["false"]): ("SHIFT", 26), - (70, G["id"]): ("SHIFT", 28), (70, G["("]): ("SHIFT", 11), + (70, G["isvoid"]): ("SHIFT", 24), (70, G["new"]): ("SHIFT", 22), - (70, G["true"]): ("SHIFT", 25), + (70, G["false"]): ("SHIFT", 26), + (70, G["string"]): ("SHIFT", 33), + (70, G["id"]): ("SHIFT", 28), (70, G["~"]): ("SHIFT", 27), - (70, G["isvoid"]): ("SHIFT", 24), + (70, G["true"]): ("SHIFT", 25), (70, G["int"]): ("SHIFT", 34), - (71, G["-"]): ("SHIFT", 64), + (71, G["+"]): ("SHIFT", 39), + (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), (71, G["}"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), (71, G[";"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["error"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), @@ -756,12 +756,12 @@ def __action_table(): (71, G["else"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["in"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["+"]): ("SHIFT", 39), + (71, G["-"]): ("SHIFT", 64), (72, G["}"]): ("REDUCE", G["expr -> not expr"]), - (72, G[";"]): ("REDUCE", G["expr -> not expr"]), + (72, G["in"]): ("REDUCE", G["expr -> not expr"]), (72, G["of"]): ("REDUCE", G["expr -> not expr"]), + (72, G[";"]): ("REDUCE", G["expr -> not expr"]), (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), - (72, G["in"]): ("REDUCE", G["expr -> not expr"]), (72, G[")"]): ("REDUCE", G["expr -> not expr"]), (72, G["error"]): ("REDUCE", G["expr -> not expr"]), (72, G["then"]): ("REDUCE", G["expr -> not expr"]), @@ -834,33 +834,33 @@ def __action_table(): (79, G[":"]): ("SHIFT", 80), (80, G["type"]): ("SHIFT", 81), (81, G["=>"]): ("SHIFT", 82), - (82, G["new"]): ("SHIFT", 22), - (82, G["int"]): ("SHIFT", 34), - (82, G["false"]): ("SHIFT", 26), - (82, G["if"]): ("SHIFT", 12), - (82, G["id"]): ("SHIFT", 31), - (82, G["~"]): ("SHIFT", 27), - (82, G["while"]): ("SHIFT", 13), (82, G["isvoid"]): ("SHIFT", 24), + (82, G["id"]): ("SHIFT", 31), (82, G["true"]): ("SHIFT", 25), - (82, G["let"]): ("SHIFT", 14), - (82, G["case"]): ("SHIFT", 21), + (82, G["~"]): ("SHIFT", 27), + (82, G["int"]): ("SHIFT", 34), (82, G["{"]): ("SHIFT", 10), + (82, G["("]): ("SHIFT", 11), + (82, G["false"]): ("SHIFT", 26), (82, G["string"]): ("SHIFT", 33), + (82, G["if"]): ("SHIFT", 12), (82, G["not"]): ("SHIFT", 30), - (82, G["("]): ("SHIFT", 11), - (83, G["error"]): ("SHIFT", 86), + (82, G["let"]): ("SHIFT", 14), + (82, G["new"]): ("SHIFT", 22), + (82, G["while"]): ("SHIFT", 13), + (82, G["case"]): ("SHIFT", 21), (83, G[";"]): ("SHIFT", 84), - (84, G["id"]): ("SHIFT", 79), + (83, G["error"]): ("SHIFT", 86), (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), + (84, G["id"]): ("SHIFT", 79), (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), (86, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), (87, G["esac"]): ("SHIFT", 88), + (88, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), @@ -873,26 +873,26 @@ def __action_table(): (90, G["id"]): ("SHIFT", 15), (91, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), (92, G["in"]): ("SHIFT", 93), - (93, G["not"]): ("SHIFT", 30), - (93, G["{"]): ("SHIFT", 10), (93, G["true"]): ("SHIFT", 25), + (93, G["not"]): ("SHIFT", 30), + (93, G["int"]): ("SHIFT", 34), + (93, G["if"]): ("SHIFT", 12), (93, G["~"]): ("SHIFT", 27), - (93, G["string"]): ("SHIFT", 33), - (93, G["isvoid"]): ("SHIFT", 24), (93, G["("]): ("SHIFT", 11), - (93, G["new"]): ("SHIFT", 22), - (93, G["if"]): ("SHIFT", 12), - (93, G["int"]): ("SHIFT", 34), - (93, G["while"]): ("SHIFT", 13), (93, G["let"]): ("SHIFT", 14), (93, G["false"]): ("SHIFT", 26), - (93, G["id"]): ("SHIFT", 31), + (93, G["string"]): ("SHIFT", 33), + (93, G["while"]): ("SHIFT", 13), (93, G["case"]): ("SHIFT", 21), + (93, G["id"]): ("SHIFT", 31), + (93, G["{"]): ("SHIFT", 10), + (93, G["new"]): ("SHIFT", 22), + (93, G["isvoid"]): ("SHIFT", 24), + (94, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), @@ -901,27 +901,27 @@ def __action_table(): (94, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["loop"]): ("SHIFT", 96), - (96, G["not"]): ("SHIFT", 30), - (96, G["true"]): ("SHIFT", 25), - (96, G["string"]): ("SHIFT", 33), (96, G["id"]): ("SHIFT", 31), - (96, G["("]): ("SHIFT", 11), - (96, G["new"]): ("SHIFT", 22), + (96, G["true"]): ("SHIFT", 25), (96, G["~"]): ("SHIFT", 27), (96, G["int"]): ("SHIFT", 34), - (96, G["isvoid"]): ("SHIFT", 24), - (96, G["while"]): ("SHIFT", 13), (96, G["if"]): ("SHIFT", 12), - (96, G["let"]): ("SHIFT", 14), + (96, G["not"]): ("SHIFT", 30), + (96, G["("]): ("SHIFT", 11), (96, G["false"]): ("SHIFT", 26), + (96, G["string"]): ("SHIFT", 33), + (96, G["let"]): ("SHIFT", 14), (96, G["case"]): ("SHIFT", 21), + (96, G["while"]): ("SHIFT", 13), + (96, G["new"]): ("SHIFT", 22), (96, G["{"]): ("SHIFT", 10), + (96, G["isvoid"]): ("SHIFT", 24), (97, G["pool"]): ("SHIFT", 98), + (98, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), @@ -930,43 +930,43 @@ def __action_table(): (98, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["then"]): ("SHIFT", 100), - (100, G["let"]): ("SHIFT", 14), - (100, G["case"]): ("SHIFT", 21), - (100, G["~"]): ("SHIFT", 27), - (100, G["{"]): ("SHIFT", 10), - (100, G["not"]): ("SHIFT", 30), - (100, G["isvoid"]): ("SHIFT", 24), - (100, G["string"]): ("SHIFT", 33), (100, G["("]): ("SHIFT", 11), - (100, G["new"]): ("SHIFT", 22), - (100, G["int"]): ("SHIFT", 34), - (100, G["id"]): ("SHIFT", 31), (100, G["false"]): ("SHIFT", 26), + (100, G["string"]): ("SHIFT", 33), + (100, G["id"]): ("SHIFT", 31), (100, G["if"]): ("SHIFT", 12), + (100, G["not"]): ("SHIFT", 30), + (100, G["isvoid"]): ("SHIFT", 24), + (100, G["~"]): ("SHIFT", 27), + (100, G["let"]): ("SHIFT", 14), + (100, G["new"]): ("SHIFT", 22), (100, G["while"]): ("SHIFT", 13), + (100, G["case"]): ("SHIFT", 21), (100, G["true"]): ("SHIFT", 25), + (100, G["int"]): ("SHIFT", 34), + (100, G["{"]): ("SHIFT", 10), (101, G["else"]): ("SHIFT", 102), - (102, G["if"]): ("SHIFT", 12), - (102, G["string"]): ("SHIFT", 33), - (102, G["while"]): ("SHIFT", 13), + (102, G["int"]): ("SHIFT", 34), + (102, G["~"]): ("SHIFT", 27), + (102, G["{"]): ("SHIFT", 10), + (102, G["("]): ("SHIFT", 11), (102, G["id"]): ("SHIFT", 31), + (102, G["false"]): ("SHIFT", 26), + (102, G["string"]): ("SHIFT", 33), + (102, G["if"]): ("SHIFT", 12), + (102, G["not"]): ("SHIFT", 30), (102, G["let"]): ("SHIFT", 14), - (102, G["("]): ("SHIFT", 11), - (102, G["case"]): ("SHIFT", 21), (102, G["new"]): ("SHIFT", 22), - (102, G["not"]): ("SHIFT", 30), - (102, G["{"]): ("SHIFT", 10), - (102, G["~"]): ("SHIFT", 27), - (102, G["int"]): ("SHIFT", 34), + (102, G["while"]): ("SHIFT", 13), (102, G["isvoid"]): ("SHIFT", 24), - (102, G["false"]): ("SHIFT", 26), + (102, G["case"]): ("SHIFT", 21), (102, G["true"]): ("SHIFT", 25), (103, G["fi"]): ("SHIFT", 104), + (104, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), @@ -997,11 +997,11 @@ def __action_table(): (106, G["in"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["*"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["}"]): ("SHIFT", 108), + (108, G[","]): ("REDUCE", G["expr -> { block }"]), (108, G["}"]): ("REDUCE", G["expr -> { block }"]), - (108, G["of"]): ("REDUCE", G["expr -> { block }"]), (108, G[";"]): ("REDUCE", G["expr -> { block }"]), + (108, G["of"]): ("REDUCE", G["expr -> { block }"]), (108, G["loop"]): ("REDUCE", G["expr -> { block }"]), - (108, G[","]): ("REDUCE", G["expr -> { block }"]), (108, G[")"]): ("REDUCE", G["expr -> { block }"]), (108, G["error"]): ("REDUCE", G["expr -> { block }"]), (108, G["then"]): ("REDUCE", G["expr -> { block }"]), @@ -1010,73 +1010,73 @@ def __action_table(): (108, G["in"]): ("REDUCE", G["expr -> { block }"]), (108, G["fi"]): ("REDUCE", G["expr -> { block }"]), (109, G[";"]): ("SHIFT", 110), - (110, G["("]): ("SHIFT", 11), - (110, G["new"]): ("SHIFT", 22), - (110, G["if"]): ("SHIFT", 12), - (110, G["while"]): ("SHIFT", 13), - (110, G["let"]): ("SHIFT", 14), - (110, G["int"]): ("SHIFT", 34), - (110, G["id"]): ("SHIFT", 31), - (110, G["case"]): ("SHIFT", 21), (110, G["false"]): ("SHIFT", 26), - (110, G["not"]): ("SHIFT", 30), - (110, G["{"]): ("SHIFT", 10), - (110, G["true"]): ("SHIFT", 25), + (110, G["case"]): ("SHIFT", 21), (110, G["}"]): ("REDUCE", G["block -> expr ;"]), (110, G["string"]): ("SHIFT", 33), - (110, G["~"]): ("SHIFT", 27), + (110, G["id"]): ("SHIFT", 31), + (110, G["{"]): ("SHIFT", 10), (110, G["isvoid"]): ("SHIFT", 24), + (110, G["new"]): ("SHIFT", 22), + (110, G["~"]): ("SHIFT", 27), + (110, G["if"]): ("SHIFT", 12), + (110, G["not"]): ("SHIFT", 30), + (110, G["true"]): ("SHIFT", 25), + (110, G["int"]): ("SHIFT", 34), + (110, G["let"]): ("SHIFT", 14), + (110, G["("]): ("SHIFT", 11), + (110, G["while"]): ("SHIFT", 13), (111, G["}"]): ("REDUCE", G["block -> expr ; block"]), (112, G["}"]): ("SHIFT", 113), (113, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), (113, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), (114, G[":"]): ("SHIFT", 115), (115, G["type"]): ("SHIFT", 116), - (116, G[")"]): ("REDUCE", G["param-list -> id : type"]), (116, G[","]): ("SHIFT", 117), + (116, G[")"]): ("REDUCE", G["param-list -> id : type"]), (117, G["id"]): ("SHIFT", 114), (118, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), (119, G[")"]): ("SHIFT", 120), (120, G[":"]): ("SHIFT", 121), (121, G["type"]): ("SHIFT", 122), (122, G["{"]): ("SHIFT", 123), - (123, G["false"]): ("SHIFT", 26), - (123, G["not"]): ("SHIFT", 30), + (123, G["new"]): ("SHIFT", 22), (123, G["{"]): ("SHIFT", 10), (123, G["id"]): ("SHIFT", 31), (123, G["true"]): ("SHIFT", 25), - (123, G["string"]): ("SHIFT", 33), - (123, G["("]): ("SHIFT", 11), - (123, G["new"]): ("SHIFT", 22), + (123, G["int"]): ("SHIFT", 34), (123, G["if"]): ("SHIFT", 12), - (123, G["while"]): ("SHIFT", 13), + (123, G["not"]): ("SHIFT", 30), + (123, G["("]): ("SHIFT", 11), + (123, G["false"]): ("SHIFT", 26), + (123, G["string"]): ("SHIFT", 33), + (123, G["isvoid"]): ("SHIFT", 24), (123, G["let"]): ("SHIFT", 14), - (123, G["int"]): ("SHIFT", 34), + (123, G["while"]): ("SHIFT", 13), (123, G["~"]): ("SHIFT", 27), - (123, G["isvoid"]): ("SHIFT", 24), (123, G["case"]): ("SHIFT", 21), (124, G["}"]): ("SHIFT", 125), - (125, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (125, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (125, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (126, G["type"]): ("SHIFT", 127), (127, G["<-"]): ("SHIFT", 128), - (127, G["error"]): ("REDUCE", G["attribute -> id : type"]), (127, G[";"]): ("REDUCE", G["attribute -> id : type"]), - (128, G["new"]): ("SHIFT", 22), - (128, G["int"]): ("SHIFT", 34), - (128, G["false"]): ("SHIFT", 26), - (128, G["if"]): ("SHIFT", 12), - (128, G["id"]): ("SHIFT", 31), - (128, G["while"]): ("SHIFT", 13), - (128, G["~"]): ("SHIFT", 27), + (127, G["error"]): ("REDUCE", G["attribute -> id : type"]), (128, G["isvoid"]): ("SHIFT", 24), + (128, G["id"]): ("SHIFT", 31), (128, G["true"]): ("SHIFT", 25), - (128, G["let"]): ("SHIFT", 14), - (128, G["case"]): ("SHIFT", 21), + (128, G["~"]): ("SHIFT", 27), + (128, G["int"]): ("SHIFT", 34), (128, G["{"]): ("SHIFT", 10), + (128, G["("]): ("SHIFT", 11), + (128, G["false"]): ("SHIFT", 26), (128, G["string"]): ("SHIFT", 33), (128, G["not"]): ("SHIFT", 30), - (128, G["("]): ("SHIFT", 11), + (128, G["if"]): ("SHIFT", 12), + (128, G["let"]): ("SHIFT", 14), + (128, G["new"]): ("SHIFT", 22), + (128, G["while"]): ("SHIFT", 13), + (128, G["case"]): ("SHIFT", 21), (129, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), (129, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), (130, G["}"]): ("SHIFT", 131), @@ -1107,233 +1107,233 @@ def __action_table(): (146, G["class"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), (147, G["$"]): ("OK", None), (148, G["$"]): ("REDUCE", G["program -> class-list"]), - (149, G["$"]): ("REDUCE", G["class-list -> class-def"]), (149, G["class"]): ("SHIFT", 1), + (149, G["$"]): ("REDUCE", G["class-list -> class-def"]), (150, G["$"]): ("REDUCE", G["class-list -> class-def class-list"]), } @staticmethod def __goto_table(): return { - (0, G["class-def"]): 149, (0, G["class-list"]): 148, (0, G["program"]): 147, - (3, G["feature-list"]): 130, + (0, G["class-def"]): 149, (3, G["method"]): 135, + (3, G["feature-list"]): 130, (3, G["attribute"]): 132, (5, G["param-list"]): 119, (9, G["arith"]): 38, (9, G["term"]): 53, - (9, G["factor"]): 56, (9, G["expr"]): 112, - (9, G["comp"]): 37, (9, G["atom"]): 43, (9, G["function-call"]): 35, + (9, G["factor"]): 56, + (9, G["comp"]): 37, (10, G["arith"]): 38, - (10, G["atom"]): 43, - (10, G["term"]): 53, - (10, G["factor"]): 56, + (10, G["function-call"]): 35, (10, G["expr"]): 109, - (10, G["block"]): 107, (10, G["comp"]): 37, - (10, G["function-call"]): 35, - (11, G["factor"]): 56, - (11, G["function-call"]): 35, - (11, G["atom"]): 43, + (10, G["term"]): 53, + (10, G["block"]): 107, + (10, G["atom"]): 43, + (10, G["factor"]): 56, (11, G["arith"]): 38, (11, G["term"]): 53, - (11, G["comp"]): 37, + (11, G["atom"]): 43, (11, G["expr"]): 105, - (12, G["factor"]): 56, + (11, G["comp"]): 37, + (11, G["factor"]): 56, + (11, G["function-call"]): 35, (12, G["arith"]): 38, - (12, G["expr"]): 99, (12, G["atom"]): 43, + (12, G["factor"]): 56, (12, G["term"]): 53, - (12, G["function-call"]): 35, + (12, G["expr"]): 99, (12, G["comp"]): 37, - (13, G["comp"]): 37, - (13, G["expr"]): 95, + (12, G["function-call"]): 35, (13, G["arith"]): 38, + (13, G["expr"]): 95, (13, G["term"]): 53, - (13, G["factor"]): 56, - (13, G["atom"]): 43, (13, G["function-call"]): 35, + (13, G["atom"]): 43, + (13, G["comp"]): 37, + (13, G["factor"]): 56, (14, G["declaration-list"]): 92, (18, G["declaration-list"]): 19, - (20, G["atom"]): 43, + (20, G["term"]): 53, (20, G["function-call"]): 35, - (20, G["arith"]): 38, + (20, G["comp"]): 37, + (20, G["atom"]): 43, (20, G["expr"]): 89, - (20, G["term"]): 53, + (20, G["arith"]): 38, (20, G["factor"]): 56, - (20, G["comp"]): 37, + (21, G["arith"]): 38, (21, G["atom"]): 43, - (21, G["function-call"]): 35, - (21, G["term"]): 53, (21, G["factor"]): 56, - (21, G["arith"]): 38, - (21, G["expr"]): 77, + (21, G["term"]): 53, + (21, G["function-call"]): 35, (21, G["comp"]): 37, - (24, G["atom"]): 43, + (21, G["expr"]): 77, (24, G["function-call"]): 35, + (24, G["atom"]): 43, (24, G["factor"]): 76, - (27, G["atom"]): 43, (27, G["function-call"]): 35, + (27, G["atom"]): 43, (27, G["factor"]): 75, (29, G["arith"]): 38, - (29, G["factor"]): 56, - (29, G["expr-list"]): 73, + (29, G["term"]): 53, (29, G["expr"]): 50, + (29, G["not-empty-expr-list"]): 49, (29, G["atom"]): 43, - (29, G["term"]): 53, (29, G["comp"]): 37, - (29, G["not-empty-expr-list"]): 49, (29, G["function-call"]): 35, + (29, G["factor"]): 56, + (29, G["expr-list"]): 73, (30, G["term"]): 53, + (30, G["function-call"]): 35, (30, G["arith"]): 38, (30, G["atom"]): 43, - (30, G["function-call"]): 35, (30, G["comp"]): 37, (30, G["expr"]): 72, (30, G["factor"]): 56, (32, G["term"]): 53, + (32, G["function-call"]): 35, (32, G["arith"]): 38, (32, G["atom"]): 43, - (32, G["function-call"]): 35, (32, G["comp"]): 37, (32, G["factor"]): 56, (32, G["expr"]): 36, - (39, G["term"]): 40, (39, G["atom"]): 43, - (39, G["factor"]): 56, + (39, G["term"]): 40, (39, G["function-call"]): 35, - (41, G["factor"]): 42, - (41, G["atom"]): 43, + (39, G["factor"]): 56, (41, G["function-call"]): 35, + (41, G["atom"]): 43, + (41, G["factor"]): 42, (46, G["arith"]): 38, - (46, G["factor"]): 56, + (46, G["term"]): 53, (46, G["expr"]): 50, + (46, G["not-empty-expr-list"]): 49, (46, G["atom"]): 43, - (46, G["term"]): 53, (46, G["comp"]): 37, - (46, G["not-empty-expr-list"]): 49, (46, G["function-call"]): 35, (46, G["expr-list"]): 47, + (46, G["factor"]): 56, (51, G["arith"]): 38, - (51, G["factor"]): 56, + (51, G["term"]): 53, (51, G["expr"]): 50, (51, G["atom"]): 43, - (51, G["term"]): 53, (51, G["comp"]): 37, (51, G["function-call"]): 35, (51, G["not-empty-expr-list"]): 52, - (54, G["atom"]): 43, + (51, G["factor"]): 56, (54, G["function-call"]): 35, + (54, G["atom"]): 43, (54, G["factor"]): 55, (61, G["arith"]): 38, - (61, G["factor"]): 56, + (61, G["term"]): 53, (61, G["expr"]): 50, + (61, G["not-empty-expr-list"]): 49, (61, G["atom"]): 43, - (61, G["term"]): 53, (61, G["comp"]): 37, (61, G["expr-list"]): 62, - (61, G["not-empty-expr-list"]): 49, (61, G["function-call"]): 35, - (64, G["term"]): 65, + (61, G["factor"]): 56, (64, G["atom"]): 43, - (64, G["factor"]): 56, + (64, G["term"]): 65, (64, G["function-call"]): 35, - (66, G["atom"]): 43, + (64, G["factor"]): 56, + (66, G["factor"]): 56, (66, G["term"]): 53, (66, G["function-call"]): 35, (66, G["arith"]): 67, - (66, G["factor"]): 56, - (68, G["atom"]): 43, + (66, G["atom"]): 43, + (68, G["factor"]): 56, + (68, G["arith"]): 69, (68, G["term"]): 53, (68, G["function-call"]): 35, - (68, G["arith"]): 69, - (68, G["factor"]): 56, - (70, G["atom"]): 43, + (68, G["atom"]): 43, + (70, G["factor"]): 56, (70, G["term"]): 53, (70, G["function-call"]): 35, (70, G["arith"]): 71, - (70, G["factor"]): 56, + (70, G["atom"]): 43, (78, G["case-list"]): 87, - (82, G["atom"]): 43, - (82, G["comp"]): 37, - (82, G["expr"]): 83, (82, G["term"]): 53, + (82, G["comp"]): 37, (82, G["arith"]): 38, + (82, G["expr"]): 83, (82, G["function-call"]): 35, + (82, G["atom"]): 43, (82, G["factor"]): 56, (84, G["case-list"]): 85, (90, G["declaration-list"]): 91, (93, G["term"]): 53, + (93, G["function-call"]): 35, (93, G["arith"]): 38, (93, G["atom"]): 43, - (93, G["function-call"]): 35, - (93, G["expr"]): 94, (93, G["comp"]): 37, + (93, G["expr"]): 94, (93, G["factor"]): 56, - (96, G["factor"]): 56, - (96, G["arith"]): 38, - (96, G["atom"]): 43, - (96, G["expr"]): 97, (96, G["term"]): 53, + (96, G["expr"]): 97, (96, G["function-call"]): 35, + (96, G["arith"]): 38, + (96, G["atom"]): 43, (96, G["comp"]): 37, - (100, G["term"]): 53, + (96, G["factor"]): 56, (100, G["arith"]): 38, (100, G["function-call"]): 35, + (100, G["term"]): 53, (100, G["atom"]): 43, - (100, G["expr"]): 101, (100, G["factor"]): 56, + (100, G["expr"]): 101, (100, G["comp"]): 37, (102, G["arith"]): 38, - (102, G["atom"]): 43, (102, G["function-call"]): 35, + (102, G["atom"]): 43, (102, G["term"]): 53, + (102, G["factor"]): 56, (102, G["expr"]): 103, (102, G["comp"]): 37, - (102, G["factor"]): 56, (110, G["arith"]): 38, - (110, G["atom"]): 43, + (110, G["function-call"]): 35, + (110, G["expr"]): 109, + (110, G["comp"]): 37, (110, G["term"]): 53, + (110, G["atom"]): 43, (110, G["factor"]): 56, - (110, G["expr"]): 109, (110, G["block"]): 111, - (110, G["comp"]): 37, - (110, G["function-call"]): 35, (117, G["param-list"]): 118, - (123, G["expr"]): 124, (123, G["arith"]): 38, (123, G["term"]): 53, - (123, G["factor"]): 56, - (123, G["comp"]): 37, (123, G["atom"]): 43, (123, G["function-call"]): 35, - (128, G["atom"]): 43, - (128, G["comp"]): 37, + (123, G["factor"]): 56, + (123, G["expr"]): 124, + (123, G["comp"]): 37, (128, G["term"]): 53, + (128, G["comp"]): 37, (128, G["arith"]): 38, - (128, G["expr"]): 129, (128, G["function-call"]): 35, + (128, G["atom"]): 43, + (128, G["expr"]): 129, (128, G["factor"]): 56, - (133, G["feature-list"]): 134, (133, G["method"]): 135, (133, G["attribute"]): 132, - (136, G["feature-list"]): 137, + (133, G["feature-list"]): 134, (136, G["method"]): 135, + (136, G["feature-list"]): 137, (136, G["attribute"]): 132, (138, G["method"]): 135, (138, G["attribute"]): 132, (138, G["feature-list"]): 139, (140, G["method"]): 135, - (140, G["attribute"]): 132, (140, G["feature-list"]): 141, + (140, G["attribute"]): 132, (144, G["method"]): 135, - (144, G["attribute"]): 132, (144, G["feature-list"]): 145, - (149, G["class-def"]): 149, + (144, G["attribute"]): 132, (149, G["class-list"]): 150, + (149, G["class-def"]): 149, } From 03487b41898cf716f14a0c08b0286de6e4740d35 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Mon, 18 May 2020 23:53:16 -0400 Subject: [PATCH 049/143] Refractoring semantic module --- grammar.py | 2 +- main.py | 2 +- semantics/formatter.py | 2 +- semantics/overridden.py | 6 +++--- semantics/progam_executor.py | 4 ++-- semantics/type_builder.py | 6 +++--- semantics/type_checker.py | 6 +++--- semantics/type_collector.py | 4 ++-- semantics/type_inference.py | 6 +++--- semantics/utils/__init__.py | 0 semantics/{ => utils}/astnodes.py | 0 semantics/{ => utils}/errors.py | 0 semantics/{ => utils}/scope.py | 0 13 files changed, 19 insertions(+), 19 deletions(-) create mode 100644 semantics/utils/__init__.py rename semantics/{ => utils}/astnodes.py (100%) rename semantics/{ => utils}/errors.py (100%) rename semantics/{ => utils}/scope.py (100%) diff --git a/grammar.py b/grammar.py index f0de94173..5150be8c9 100755 --- a/grammar.py +++ b/grammar.py @@ -1,7 +1,7 @@ import inspect import time -from semantics import astnodes as ast +from semantics.utils import astnodes as ast from cmp.parsing import LALR1Parser from cmp.pycompiler import Grammar diff --git a/main.py b/main.py index 94281d3b1..205765685 100755 --- a/main.py +++ b/main.py @@ -2,7 +2,7 @@ from parser import CoolParser from semantics import (TypeCollector, TypeBuilder, OverriddenMethodChecker, TypeChecker, topological_ordering) from semantics.formatter import CodeBuilder -from semantics.scope import Context, Scope +from semantics.utils.scope import Context, Scope from semantics.type_inference import InferenceChecker program = r""" diff --git a/semantics/formatter.py b/semantics/formatter.py index 849d69031..3861be0b9 100644 --- a/semantics/formatter.py +++ b/semantics/formatter.py @@ -1,4 +1,4 @@ -import semantics.astnodes as ast +import semantics.utils.astnodes as ast import semantics.visitor as visitor diff --git a/semantics/overridden.py b/semantics/overridden.py index 48f58cf6d..e48d46331 100644 --- a/semantics/overridden.py +++ b/semantics/overridden.py @@ -1,9 +1,9 @@ from typing import List, Dict, Optional -import semantics.astnodes as ast -import semantics.errors as err +import semantics.utils.astnodes as ast +import semantics.utils.errors as err import semantics.visitor as visitor -from semantics.scope import Context, Type, SemanticError +from semantics.utils.scope import Context, Type, SemanticError def topological_ordering(program_node: ast.ProgramNode, diff --git a/semantics/progam_executor.py b/semantics/progam_executor.py index 509fca29e..2cc165962 100644 --- a/semantics/progam_executor.py +++ b/semantics/progam_executor.py @@ -1,8 +1,8 @@ from typing import List -import semantics.astnodes as ast +import semantics.utils.astnodes as ast import semantics.visitor as visitor -from semantics.scope import Context, Type, Method, Scope +from semantics.utils.scope import Context, Type, Method, Scope class Executor: diff --git a/semantics/type_builder.py b/semantics/type_builder.py index 4f4445eda..7d5fa9a7c 100644 --- a/semantics/type_builder.py +++ b/semantics/type_builder.py @@ -1,9 +1,9 @@ from typing import List, Optional -import semantics.astnodes as ast -import semantics.errors as err +import semantics.utils.astnodes as ast +import semantics.utils.errors as err import semantics.visitor as visitor -from semantics.scope import Context, SemanticError, Type, ErrorType +from semantics.utils.scope import Context, SemanticError, Type, ErrorType class TypeBuilder: diff --git a/semantics/type_checker.py b/semantics/type_checker.py index 025b2a95c..1149e7ed7 100644 --- a/semantics/type_checker.py +++ b/semantics/type_checker.py @@ -1,9 +1,9 @@ from typing import List -import semantics.astnodes as ast -import semantics.errors as err +import semantics.utils.astnodes as ast +import semantics.utils.errors as err import semantics.visitor as visitor -from semantics.scope import Context, SemanticError, Type, Method, Scope, ErrorType +from semantics.utils.scope import Context, SemanticError, Type, Method, Scope, ErrorType class TypeChecker: diff --git a/semantics/type_collector.py b/semantics/type_collector.py index 883f694e5..baac3977c 100644 --- a/semantics/type_collector.py +++ b/semantics/type_collector.py @@ -1,8 +1,8 @@ from typing import List -import semantics.astnodes as ast +import semantics.utils.astnodes as ast import semantics.visitor as visitor -from semantics.scope import Context, SemanticError +from semantics.utils.scope import Context, SemanticError class TypeCollector: diff --git a/semantics/type_inference.py b/semantics/type_inference.py index 32963514c..256574065 100644 --- a/semantics/type_inference.py +++ b/semantics/type_inference.py @@ -37,10 +37,10 @@ from collections import deque, OrderedDict from typing import Dict, List, Tuple, Set -import semantics.astnodes as ast -import semantics.errors as err +import semantics.utils.astnodes as ast +import semantics.utils.errors as err import semantics.visitor as visitor -from semantics.scope import Type, Attribute, Method, Scope, Context, SemanticError, ErrorType, VariableInfo +from semantics.utils.scope import Type, Attribute, Method, Scope, Context, SemanticError, ErrorType, VariableInfo class DependencyNode: diff --git a/semantics/utils/__init__.py b/semantics/utils/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/semantics/astnodes.py b/semantics/utils/astnodes.py similarity index 100% rename from semantics/astnodes.py rename to semantics/utils/astnodes.py diff --git a/semantics/errors.py b/semantics/utils/errors.py similarity index 100% rename from semantics/errors.py rename to semantics/utils/errors.py diff --git a/semantics/scope.py b/semantics/utils/scope.py similarity index 100% rename from semantics/scope.py rename to semantics/utils/scope.py From e1e89815474beff46091b8f553b44bc282e4af9e Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Tue, 19 May 2020 20:46:52 -0400 Subject: [PATCH 050/143] Fixed up visitor for "MethodCallNode" --- semantics/progam_executor.py | 6 ++++-- semantics/type_inference.py | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/semantics/progam_executor.py b/semantics/progam_executor.py index 2cc165962..79b1de572 100644 --- a/semantics/progam_executor.py +++ b/semantics/progam_executor.py @@ -1,4 +1,4 @@ -from typing import List +from typing import List, Tuple, Dict import semantics.utils.astnodes as ast import semantics.visitor as visitor @@ -11,6 +11,7 @@ def __init__(self, context: Context, errors: List[str] = []): self.errors: List[str] = errors self.current_type: Type = None self.current_method: Method = None + self.methods: Dict[Tuple[str, str], ast.MethodDeclarationNode] @visitor.on('node') def visit(self, node, tabs): @@ -18,7 +19,8 @@ def visit(self, node, tabs): @visitor.when(ast.ProgramNode) def visit(self, node: ast.ProgramNode, scope: Scope = None): - pass + execution_node = ast.MethodCallNode('main', [], ast.InstantiateNode('Main')) + self.visit(execution_node) @visitor.when(ast.ClassDeclarationNode) def visit(self, node: ast.ClassDeclarationNode, scope: Scope): diff --git a/semantics/type_inference.py b/semantics/type_inference.py index 256574065..6d7389d6c 100644 --- a/semantics/type_inference.py +++ b/semantics/type_inference.py @@ -359,8 +359,8 @@ def visit(self, node: ast.MethodCallNode, scope: Scope): obj_node = self.visit(node.obj, scope) if isinstance(obj_node, AtomNode): - method = obj_node.type.get_method(node.id) - param_nodes, return_node = self.methods[obj_node.type.name, method.name] + method, owner = obj_node.type.get_method(node.id, get_owner=True) + param_nodes, return_node = self.methods[owner.name, method.name] for i, arg in enumerate(node.args): arg_node = self.visit(arg, scope) if isinstance(arg_node, AtomNode): From cf4adccd1991f0cfd4b59b1c778d477c65641b87 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Sat, 23 May 2020 18:13:39 -0400 Subject: [PATCH 051/143] Succesfull execution of a COOL Hello World program --- main.py | 26 ++++- semantics/progam_executor.py | 215 ++++++++++++++++++++++++++++++----- semantics/type_collector.py | 2 +- semantics/utils/astnodes.py | 5 + semantics/utils/scope.py | 2 + 5 files changed, 219 insertions(+), 31 deletions(-) diff --git a/main.py b/main.py index 205765685..ea912d9cf 100755 --- a/main.py +++ b/main.py @@ -2,6 +2,7 @@ from parser import CoolParser from semantics import (TypeCollector, TypeBuilder, OverriddenMethodChecker, TypeChecker, topological_ordering) from semantics.formatter import CodeBuilder +from semantics.progam_executor import Executor from semantics.utils.scope import Context, Scope from semantics.type_inference import InferenceChecker @@ -95,11 +96,26 @@ class Main inherits IO { } """ +hello_world = r""" +class Main inherits IO { + x : AUTO_TYPE <- 5 + 5; + + main () : IO {{ + out_int(x); + out_string("\n"); + }}; + + get_x () : AUTO_TYPE { + x + }; +} +""" + lexer = CoolLexer() parser = CoolParser() if __name__ == '__main__': - tokens = lexer(inference_program_04) + tokens = lexer(hello_world) ast = parser(tokens) context = Context() @@ -112,9 +128,13 @@ class Main inherits IO { OverriddenMethodChecker(context, errors).visit(ast) InferenceChecker(context, errors).visit(ast, scope) TypeChecker(context, errors).visit(ast, scope) - # Executor(context, errors).visit(ast, scope) print(CodeBuilder().visit(ast)) + + if not errors: + print() + Executor(context, errors).visit(ast, Scope()) + print('Program finished...') + for error in errors: print(error) - print("Done!") diff --git a/semantics/progam_executor.py b/semantics/progam_executor.py index 79b1de572..909034cce 100644 --- a/semantics/progam_executor.py +++ b/semantics/progam_executor.py @@ -1,17 +1,103 @@ -from typing import List, Tuple, Dict +from typing import List, Dict, Any import semantics.utils.astnodes as ast import semantics.visitor as visitor from semantics.utils.scope import Context, Type, Method, Scope +def abort(obj, context): + print('Aborting Program') + exit() + + +def ccopy(obj, context) -> None: + x_copy = Instance(obj.type, obj.value if obj.type.name in ('Int', 'String', 'Bool') else None) + x_copy.attribute_values = obj.attribute_values + return x_copy + + +def type_name(obj, context): + return Instance(context.get_type('String'), obj.type.name) + + +def out_string(obj, s, context): + print(s.value, end='') + return obj + + +def out_int(obj, s, context): + print(s.value, end='') + return obj + + +def in_string(obj, context): + return Instance(context.get_type('Int'), input()) + + +def in_int(obj, context): + return Instance(context.get_type('Int'), int(input())) + + +def length(obj, context): + return Instance(context.get_type('Int'), len(obj.value)) + + +def concat(obj, s, context): + return Instance(context.get_type('String'), obj.value + s.value) + + +def substr(obj, i, l, context): + return Instance(context.get_type('String'), obj.value[i: i + l]) + + +defaults = { + ('Object', 'abort'): abort, + ('Object', 'copy'): ccopy, + ('Object', 'type_name'): type_name, + ('IO', 'out_string'): out_string, + ('IO', 'out_int'): out_int, + ('IO', 'in_string'): in_string, + ('IO', 'in_int'): in_int, + ('String', 'length'): length, + ('String', 'concat'): concat, + ('String', 'substr'): substr, +} + + +class Instance: + def __init__(self, typex: Type, value: Any = None): + if value is None: + value = id(self) + + self.type: Type = typex + self.value: Any = value + self.attribute_values: Dict[str, Instance] = {} + + def set_attribute_value(self, name: str, value: 'Instance') -> None: + self.attribute_values[name] = value + + def get_attribute_value(self, name: str) -> 'Instance': + return self.attribute_values[name] + + def get_method(self, name: str) -> Method: + return self.type.get_method(name) + + +class VoidInstance(Instance): + def __init__(self): + super(VoidInstance, self).__init__(None, None) + + def __eq__(self, other): + return isinstance(other, VoidInstance) + + class Executor: def __init__(self, context: Context, errors: List[str] = []): self.context: Context = context self.errors: List[str] = errors self.current_type: Type = None - self.current_method: Method = None - self.methods: Dict[Tuple[str, str], ast.MethodDeclarationNode] + self.current_instance: Instance = None + self.call_stack: list = [] @visitor.on('node') def visit(self, node, tabs): @@ -19,36 +105,59 @@ def visit(self, node, tabs): @visitor.when(ast.ProgramNode) def visit(self, node: ast.ProgramNode, scope: Scope = None): + for i, declaration in enumerate(node.declarations): + self.visit(declaration, None) + execution_node = ast.MethodCallNode('main', [], ast.InstantiateNode('Main')) - self.visit(execution_node) + self.visit(execution_node, scope) @visitor.when(ast.ClassDeclarationNode) def visit(self, node: ast.ClassDeclarationNode, scope: Scope): - pass + self.current_type = self.context.get_type(node.id) + + attrs = [f for f in node.features if isinstance(f, ast.AttrDeclarationNode)] + methods = [f for f in node.features if isinstance(f, ast.MethodDeclarationNode)] + + for attr in attrs: + self.visit(attr, None) + + for method in methods: + self.visit(method, None) @visitor.when(ast.AttrDeclarationNode) def visit(self, node: ast.AttrDeclarationNode, scope: Scope): - pass + self.current_type.get_attribute(node.id).expr = node.expr @visitor.when(ast.MethodDeclarationNode) def visit(self, node: ast.MethodDeclarationNode, scope: Scope): - pass + self.current_type.get_method(node.id).expr = node.body @visitor.when(ast.LetNode) def visit(self, node: ast.LetNode, scope: Scope): - pass + for x in node.declarations: + self.visit(x, scope) + return self.visit(node.expr, scope.create_child()) @visitor.when(ast.VarDeclarationNode) def visit(self, node: ast.VarDeclarationNode, scope: Scope): - pass + variable_info = scope.define_variable(node.id, self.context.types) + if node.expr is not None: + variable_info.instance = self.visit(node.expr, scope) + else: + variable_info.instance = VoidInstance() @visitor.when(ast.AssignNode) def visit(self, node: ast.AssignNode, scope: Scope): - pass + variable_info = scope.find_variable(node.id) + variable_info.value = self.visit(node.expr, scope) + return variable_info.value @visitor.when(ast.BlockNode) def visit(self, node: ast.BlockNode, scope: Scope): - pass + instance = None + for expr in node.expressions: + instance = self.visit(expr, scope) + return instance @visitor.when(ast.ConditionalNode) def visit(self, node: ast.ConditionalNode, scope: Scope): @@ -68,64 +177,116 @@ def visit(self, node: ast.CaseNode, scope: Scope): @visitor.when(ast.MethodCallNode) def visit(self, node: ast.MethodCallNode, scope: Scope): - pass + obj_instance = self.visit(node.obj, scope) + + if obj_instance.type.conforms_to(self.context.get_type('Object')) and ('Object', node.id) in defaults: + args = (obj_instance,) + tuple(self.visit(arg, scope) for arg in node.args) + (self.context,) + return defaults['Object', node.id](*args) + + if obj_instance.type.conforms_to(self.context.get_type('IO')) and ('IO', node.id) in defaults: + args = (obj_instance,) + tuple(self.visit(arg, scope) for arg in node.args) + (self.context,) + return defaults['IO', node.id](*args) + + if obj_instance.type.conforms_to(self.context.get_type('String')) and ('String', node.id) in defaults: + args = (obj_instance,) + tuple(self.visit(arg, scope) for arg in node.args) + (self.context,) + return defaults['String', node.id](*args) + + new_scope = Scope() + + new_scope.define_variable('self', obj_instance.type).instance = obj_instance + method = obj_instance.get_method(node.id) + for name, typex, arg in zip(method.param_names, method.param_types, node.args): + new_scope.define_variable(name, typex).instance = self.visit(arg, scope) + + self.call_stack.append(self.current_instance) + self.current_instance = obj_instance + self.visit(method.expr, new_scope) + self.current_instance = self.call_stack.pop() @visitor.when(ast.IntegerNode) def visit(self, node: ast.IntegerNode, scope: Scope): - pass + return Instance(self.context.get_type('Int'), int(node.lex)) @visitor.when(ast.StringNode) def visit(self, node: ast.StringNode, scope: Scope): - pass + return Instance(self.context.get_type('String'), str(node.lex[1:-1].replace('\\n', '\n'))) @visitor.when(ast.BooleanNode) def visit(self, node: ast.BooleanNode, scope: Scope): - pass + return Instance(self.context.get_type('Bool'), True if node.lex == 'true' else False) @visitor.when(ast.VariableNode) def visit(self, node: ast.VariableNode, scope: Scope): - pass + variable_info = scope.find_variable(node.lex) + if variable_info is not None: + return variable_info.instance + else: + return self.current_instance.get_attribute_value(node.lex) @visitor.when(ast.InstantiateNode) def visit(self, node: ast.InstantiateNode, scope: Scope): - pass + default = None + if node.lex == 'String': + default = '' + elif node.lex == 'Int': + default = 0 + elif node.lex == 'Bool': + default = False + + instance = Instance(self.context.get_type(node.lex), default) + self.call_stack.append(self.current_instance) + self.current_instance = instance + for attribute, _ in instance.type.all_attributes(): + instance.set_attribute_value(attribute.name, self.visit(attribute.expr, Scope())) + self.current_instance = self.call_stack.pop() + return instance @visitor.when(ast.NegationNode) def visit(self, node: ast.NegationNode, scope: Scope): - pass + value = not self.visit(node.expr, scope).value + return Instance(self.context.get_type('Bool'), value) @visitor.when(ast.ComplementNode) def visit(self, node: ast.ComplementNode, scope: Scope): - pass + value = ~ self.visit(node.expr, scope).value + return Instance(self.context.get_type('Int'), value) @visitor.when(ast.IsVoidNode) def visit(self, node: ast.IsVoidNode, scope: Scope): - pass + value = isinstance(self.visit(node.expr, scope), VoidInstance) + return Instance(self.context.get_type('Bool'), value) @visitor.when(ast.PlusNode) def visit(self, node: ast.PlusNode, scope: Scope): - pass + value = self.visit(node.left, scope).value + self.visit(node.right, scope).value + return Instance(self.context.get_type('Int'), value) @visitor.when(ast.MinusNode) def visit(self, node: ast.MinusNode, scope: Scope): - pass + value = self.visit(node.left, scope).value - self.visit(node.right, scope).value + return Instance(self.context.get_type('Int'), value) @visitor.when(ast.StarNode) def visit(self, node: ast.StarNode, scope: Scope): - pass + value = self.visit(node.left, scope).value * self.visit(node.right, scope).value + return Instance(self.context.get_type('Int'), value) @visitor.when(ast.DivNode) def visit(self, node: ast.DivNode, scope: Scope): - pass + value = self.visit(node.left, scope).value / self.visit(node.right, scope).value + return Instance(self.context.get_type('Int'), value) @visitor.when(ast.LessEqualNode) def visit(self, node: ast.LessEqualNode, scope: Scope): - pass + value = self.visit(node.left, scope).value <= self.visit(node.right, scope).value + return Instance(self.context.get_type('Bool'), value) @visitor.when(ast.LessThanNode) def visit(self, node: ast.LessThanNode, scope: Scope): - pass + value = self.visit(node.left, scope).value < self.visit(node.right, scope).value + return Instance(self.context.get_type('Bool'), value) @visitor.when(ast.EqualNode) def visit(self, node: ast.EqualNode, scope: Scope): - pass + value = self.visit(node.left, scope).value == self.visit(node.right, scope).value + return Instance(self.context.get_type('Bool'), value) diff --git a/semantics/type_collector.py b/semantics/type_collector.py index baac3977c..dbc000eba 100644 --- a/semantics/type_collector.py +++ b/semantics/type_collector.py @@ -41,7 +41,7 @@ def visit(self, node): object_type.define_method('copy', [], [], self_type) io_type.define_method('out_string', ['x'], [string_type], self_type) - io_type.define_method('out_int', ['x'], [string_type], self_type) + io_type.define_method('out_int', ['x'], [int_type], self_type) io_type.define_method('in_string', [], [], string_type) io_type.define_method('in_int', [], [], int_type) diff --git a/semantics/utils/astnodes.py b/semantics/utils/astnodes.py index 43f8018ac..03988c7b2 100755 --- a/semantics/utils/astnodes.py +++ b/semantics/utils/astnodes.py @@ -42,6 +42,11 @@ class ExprNode(Node): pass +class ParenthesisExpr(ExprNode): + def __init__(self, expr): + self.expr = expr + + class BlockNode(ExprNode): def __init__(self, expressions): self.expressions: List[ExprNode] = expressions diff --git a/semantics/utils/scope.py b/semantics/utils/scope.py index d7864847a..c424d10d7 100755 --- a/semantics/utils/scope.py +++ b/semantics/utils/scope.py @@ -1,3 +1,5 @@ +from enum import Enum, auto + from collections import OrderedDict from typing import List, Optional, Dict, Tuple, Union From 1d1107b04e47730fa942adaf612b09122dd8d3d4 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Sun, 24 May 2020 04:28:39 -0400 Subject: [PATCH 052/143] security save --- main.py | 42 ++++++++++++++++++++++-------------- semantics/formatter.py | 2 +- semantics/progam_executor.py | 18 ++++++++++++---- semantics/type_checker.py | 3 ++- semantics/type_inference.py | 42 ++++++++++++++++++++---------------- 5 files changed, 66 insertions(+), 41 deletions(-) diff --git a/main.py b/main.py index ea912d9cf..316d024c7 100755 --- a/main.py +++ b/main.py @@ -6,7 +6,7 @@ from semantics.utils.scope import Context, Scope from semantics.type_inference import InferenceChecker -program = r""" +some_program = r""" class Main inherits IO { a: Int; @@ -23,7 +23,7 @@ class Main inherits IO { case a of x: Int => - x + 2;n + x + 2; x: String => x.concat(" is a String\n"); esac; @@ -43,16 +43,14 @@ class Main inherits IO { inference_program_01 = r""" class Point { - a: AUTO_TYPE; - b: AUTO_TYPE; + x: AUTO_TYPE; + y: AUTO_TYPE; - init(x: AUTO_TYPE, y: AUTO_TYPE): AUTO_TYPE {{ - a <- b; - b <- x + y; - create_point(); + init(x0: Int, y0: Int): AUTO_TYPE {{ + x <- x0; + y <- y0; + self; }}; - - create_point(): AUTO_TYPE { new Point }; } """ @@ -98,15 +96,27 @@ class Main inherits IO { hello_world = r""" class Main inherits IO { - x : AUTO_TYPE <- 5 + 5; - - main () : IO {{ - out_int(x); + main () : AUTO_TYPE {{ + --out_int(iterative_fibonacci(5)); + --out_string("\n"); + out_int(fibonacci(5)); out_string("\n"); }}; - get_x () : AUTO_TYPE { - x + fibonacci (n: AUTO_TYPE) : AUTO_TYPE { + if n <= 2 then 1 else fibonacci(n - 1) + fibonacci(n - 2) fi + }; + + iterative_fibonacci(n: AUTO_TYPE) : AUTO_TYPE { + let i: Int <- 1, n1: Int <- 1, n2: Int <- 1, temp: Int in { + while i < n loop { + temp <- n2; + n2 <- n2 + n1; + n1 <- temp; + i <- i + 1; + } pool; + n2; + } }; } """ diff --git a/semantics/formatter.py b/semantics/formatter.py index 3861be0b9..a9c1f915f 100644 --- a/semantics/formatter.py +++ b/semantics/formatter.py @@ -20,7 +20,7 @@ def visit(self, node: ast.ClassDeclarationNode, tabs: int = 0): @visitor.when(ast.AttrDeclarationNode) def visit(self, node: ast.AttrDeclarationNode, tabs: int = 0): - expr = f' <- {self.visit(node.expr, tabs)}' if node.expr is not None else '' + expr = f' <- {self.visit(node.expr, 0)}' if node.expr is not None else '' return '\t' * tabs + f'{node.id}: {node.type}{expr};' @visitor.when(ast.MethodDeclarationNode) diff --git a/semantics/progam_executor.py b/semantics/progam_executor.py index 909034cce..68d4c1064 100644 --- a/semantics/progam_executor.py +++ b/semantics/progam_executor.py @@ -82,6 +82,9 @@ def get_attribute_value(self, name: str) -> 'Instance': def get_method(self, name: str) -> Method: return self.type.get_method(name) + def __str__(self): + return f'{self.type.name} {self.value}' + class VoidInstance(Instance): def __init__(self): @@ -161,11 +164,17 @@ def visit(self, node: ast.BlockNode, scope: Scope): @visitor.when(ast.ConditionalNode) def visit(self, node: ast.ConditionalNode, scope: Scope): - pass + if_instance = self.visit(node.if_expr, scope) + + if if_instance.value: + return self.visit(node.then_expr, scope.create_child()) + return self.visit(node.else_expr, scope.create_child()) @visitor.when(ast.WhileNode) def visit(self, node: ast.WhileNode, scope: Scope): - pass + while self.visit(node.condition, scope).value: + self.visit(node.body, scope.create_child()) + return VoidInstance() @visitor.when(ast.SwitchCaseNode) def visit(self, node: ast.SwitchCaseNode, scope: Scope): @@ -193,15 +202,16 @@ def visit(self, node: ast.MethodCallNode, scope: Scope): new_scope = Scope() - new_scope.define_variable('self', obj_instance.type).instance = obj_instance method = obj_instance.get_method(node.id) + new_scope.define_variable('self', obj_instance.type).instance = obj_instance for name, typex, arg in zip(method.param_names, method.param_types, node.args): new_scope.define_variable(name, typex).instance = self.visit(arg, scope) self.call_stack.append(self.current_instance) self.current_instance = obj_instance - self.visit(method.expr, new_scope) + output = self.visit(method.expr, new_scope) self.current_instance = self.call_stack.pop() + return output @visitor.when(ast.IntegerNode) def visit(self, node: ast.IntegerNode, scope: Scope): diff --git a/semantics/type_checker.py b/semantics/type_checker.py index 1149e7ed7..098d5ccb1 100644 --- a/semantics/type_checker.py +++ b/semantics/type_checker.py @@ -129,9 +129,10 @@ def visit(self, node: ast.AssignNode, scope: Scope): @visitor.when(ast.BlockNode) def visit(self, node: ast.BlockNode, scope: Scope): + child_scope = scope.create_child() return_type = ErrorType() for expr in node.expressions: - return_type = self.visit(expr, scope) + return_type = self.visit(expr, child_scope) return return_type @visitor.when(ast.ConditionalNode) diff --git a/semantics/type_inference.py b/semantics/type_inference.py index 6d7389d6c..f900ab11a 100644 --- a/semantics/type_inference.py +++ b/semantics/type_inference.py @@ -210,11 +210,14 @@ def visit(self, node: ast.ProgramNode, scope: Scope = None): def visit(self, node: ast.ClassDeclarationNode, scope: Scope): self.current_type = self.context.get_type(node.id) - for node in node.features: - if isinstance(node, ast.AttrDeclarationNode): - self.visit(node, scope) - else: - self.visit(node, scope.create_child()) + attrs = [feature for feature in node.features if isinstance(feature, ast.AttrDeclarationNode)] + methods = [feature for feature in node.features if isinstance(feature, ast.MethodDeclarationNode)] + + for attr in attrs: + self.visit(attr, scope) + + for i, method in enumerate(methods): + self.visit(method, scope.create_child()) @visitor.when(ast.AttrDeclarationNode) def visit(self, node: ast.AttrDeclarationNode, scope: Scope): @@ -222,7 +225,7 @@ def visit(self, node: ast.AttrDeclarationNode, scope: Scope): var_info = scope.define_variable(node.id, self.context.get_type(node.type)) # Solve the expression of the attribute - expr_node = self.visit(node.expr, scope) if node.expr is not None else None + expr_node = self.visit(node.expr, scope.create_child()) if node.expr is not None else None # Set and get the reference to the variable info node var_info_node = self.variables[var_info] = VariableInfoNode(self.context.get_type('AUTO_TYPE'), var_info) @@ -313,9 +316,10 @@ def visit(self, node: ast.AssignNode, scope: Scope): @visitor.when(ast.BlockNode) def visit(self, node: ast.BlockNode, scope: Scope): + child_scope = scope.create_child() result_node = None for expr in node.expressions: - result_node = self.visit(expr, scope) + result_node = self.visit(expr, child_scope) return result_node @visitor.when(ast.ConditionalNode) @@ -325,8 +329,8 @@ def visit(self, node: ast.ConditionalNode, scope: Scope): if not isinstance(if_node, AtomNode): self.graph.add_edge(AtomNode(self.context.get_type('Bool')), if_node) - then_node = self.visit(node.then_expr, scope) - else_node = self.visit(node.else_expr, scope) + then_node = self.visit(node.then_expr, scope.create_child()) + else_node = self.visit(node.else_expr, scope.create_child()) if isinstance(then_node, AtomNode) and isinstance(else_node, AtomNode): return AtomNode(then_node.type.join(else_node.type)) @@ -478,10 +482,9 @@ def visit(self, node, tabs): pass @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode, scope: Scope = None): - if scope is not None: - for elem in node.declarations: - self.visit(elem, scope.children[0]) + def visit(self, node: ast.ProgramNode, scope: Scope): + for i, elem in enumerate(node.declarations): + self.visit(elem, scope.children[i]) return scope @visitor.when(ast.ClassDeclarationNode) @@ -503,7 +506,7 @@ def visit(self, node: ast.AttrDeclarationNode, scope: Scope): var_info = scope.find_variable(node.id) if node.expr is not None: - self.visit(node.expr, scope.create_child()) + self.visit(node.expr, scope.children[0]) if attr_type == self.context.get_type('AUTO_TYPE'): if var_info.type == self.context.get_type('AUTO_TYPE'): @@ -542,7 +545,7 @@ def visit(self, node: ast.VarDeclarationNode, scope: Scope): variable_info = scope.find_variable(node.id) if node.expr is not None: - self.visit(node.expr, scope) + self.visit(node.expr, scope.children[0]) if node.type == 'AUTO_TYPE': if variable_info.type == self.context.get_type('AUTO_TYPE'): @@ -551,18 +554,19 @@ def visit(self, node: ast.VarDeclarationNode, scope: Scope): @visitor.when(ast.AssignNode) def visit(self, node: ast.AssignNode, scope: Scope): - self.visit(node.expr, scope) + self.visit(node.expr, scope.children[0]) @visitor.when(ast.BlockNode) def visit(self, node: ast.BlockNode, scope: Scope): + child_scope = scope.children[0] for i, expr in enumerate(node.expressions): - self.visit(expr, scope) + self.visit(expr, child_scope) @visitor.when(ast.ConditionalNode) def visit(self, node: ast.ConditionalNode, scope: Scope): self.visit(node.if_expr, scope) - self.visit(node.then_expr, scope) - self.visit(node.else_expr, scope) + self.visit(node.then_expr, scope.children[0]) + self.visit(node.else_expr, scope.children[1]) @visitor.when(ast.WhileNode) def visit(self, node: ast.WhileNode, scope: Scope): From 833bc33cf426e834d0774ce4fd03dbc075395b3e Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Sun, 24 May 2020 06:02:21 -0400 Subject: [PATCH 053/143] While loops working great --- grammar.py | 8 +- main.py | 14 +- parser.py | 1296 +++++++++++++++++----------------- semantics/formatter.py | 41 +- semantics/progam_executor.py | 37 +- semantics/type_checker.py | 50 +- semantics/type_inference.py | 93 ++- semantics/utils/astnodes.py | 4 +- 8 files changed, 804 insertions(+), 739 deletions(-) diff --git a/grammar.py b/grammar.py index 5150be8c9..762d74b82 100755 --- a/grammar.py +++ b/grammar.py @@ -186,10 +186,10 @@ def lexical_error(lexer): block %= 'expr ;', lambda s: [s[1]] block %= 'expr ; block', lambda s: [s[1]] + s[3] -declaration_list %= 'id : type', lambda s: [ast.VarDeclarationNode(s[1], s[3])] -declaration_list %= 'id : type <- expr', lambda s: [ast.VarDeclarationNode(s[1], s[3], s[5])] -declaration_list %= 'id : type , declaration-list', lambda s: [ast.VarDeclarationNode(s[1], s[3])] + s[5] -declaration_list %= 'id : type <- expr , declaration-list', lambda s: [ast.VarDeclarationNode(s[1], s[3], s[5])] + s[7] +declaration_list %= 'id : type', lambda s: [(s[1], s[3], None)] +declaration_list %= 'id : type <- expr', lambda s: [(s[1], s[3], s[5])] +declaration_list %= 'id : type , declaration-list', lambda s: [(s[1], s[3], None)] + s[5] +declaration_list %= 'id : type <- expr , declaration-list', lambda s: [(s[1], s[3], s[5])] + s[7] case_list %= 'id : type => expr ;', lambda s: [ast.CaseNode(s[1], s[3], s[5])] case_list %= 'id : type => expr ; case-list', lambda s: [ast.CaseNode(s[1], s[3], s[5])] + s[7] diff --git a/main.py b/main.py index 316d024c7..f84336a4f 100755 --- a/main.py +++ b/main.py @@ -97,18 +97,20 @@ class Main inherits IO { hello_world = r""" class Main inherits IO { main () : AUTO_TYPE {{ - --out_int(iterative_fibonacci(5)); - --out_string("\n"); - out_int(fibonacci(5)); + out_string("Iterative Fibonacci : "); + out_int(iterative_fibonacci(5)); + out_string("\n"); + out_string("Recursive Fibonacci : "); + out_int(recursive_fibonacci(5)); out_string("\n"); }}; - fibonacci (n: AUTO_TYPE) : AUTO_TYPE { - if n <= 2 then 1 else fibonacci(n - 1) + fibonacci(n - 2) fi + recursive_fibonacci (n: AUTO_TYPE) : AUTO_TYPE { + if n <= 2 then 1 else recursive_fibonacci(n - 1) + recursive_fibonacci(n - 2) fi }; iterative_fibonacci(n: AUTO_TYPE) : AUTO_TYPE { - let i: Int <- 1, n1: Int <- 1, n2: Int <- 1, temp: Int in { + let i: Int <- 2, n1: Int <- 1, n2: Int <- 1, temp: Int in { while i < n loop { temp <- n2; n2 <- n2 + n1; diff --git a/parser.py b/parser.py index ec1914432..2f1508adc 100755 --- a/parser.py +++ b/parser.py @@ -15,1017 +15,1017 @@ def __action_table(): return { (0, G["class"]): ("SHIFT", 1), (1, G["type"]): ("SHIFT", 2), - (2, G["inherits"]): ("SHIFT", 142), (2, G["{"]): ("SHIFT", 3), + (2, G["inherits"]): ("SHIFT", 142), (3, G["id"]): ("SHIFT", 4), (3, G["}"]): ("REDUCE", G["feature-list -> e"]), - (4, G[":"]): ("SHIFT", 126), (4, G["("]): ("SHIFT", 5), + (4, G[":"]): ("SHIFT", 126), (5, G["id"]): ("SHIFT", 114), (5, G[")"]): ("SHIFT", 6), (6, G[":"]): ("SHIFT", 7), (7, G["type"]): ("SHIFT", 8), (8, G["{"]): ("SHIFT", 9), - (9, G["new"]): ("SHIFT", 22), - (9, G["{"]): ("SHIFT", 10), + (9, G["false"]): ("SHIFT", 26), (9, G["id"]): ("SHIFT", 31), - (9, G["true"]): ("SHIFT", 25), - (9, G["int"]): ("SHIFT", 34), - (9, G["if"]): ("SHIFT", 12), - (9, G["not"]): ("SHIFT", 30), (9, G["("]): ("SHIFT", 11), - (9, G["false"]): ("SHIFT", 26), - (9, G["string"]): ("SHIFT", 33), + (9, G["not"]): ("SHIFT", 30), (9, G["isvoid"]): ("SHIFT", 24), - (9, G["let"]): ("SHIFT", 14), + (9, G["string"]): ("SHIFT", 33), (9, G["while"]): ("SHIFT", 13), - (9, G["~"]): ("SHIFT", 27), + (9, G["new"]): ("SHIFT", 22), + (9, G["{"]): ("SHIFT", 10), + (9, G["if"]): ("SHIFT", 12), + (9, G["true"]): ("SHIFT", 25), (9, G["case"]): ("SHIFT", 21), - (10, G["false"]): ("SHIFT", 26), - (10, G["case"]): ("SHIFT", 21), - (10, G["string"]): ("SHIFT", 33), + (9, G["let"]): ("SHIFT", 14), + (9, G["int"]): ("SHIFT", 34), + (9, G["~"]): ("SHIFT", 27), (10, G["id"]): ("SHIFT", 31), - (10, G["{"]): ("SHIFT", 10), - (10, G["isvoid"]): ("SHIFT", 24), - (10, G["new"]): ("SHIFT", 22), - (10, G["~"]): ("SHIFT", 27), - (10, G["if"]): ("SHIFT", 12), (10, G["not"]): ("SHIFT", 30), + (10, G["string"]): ("SHIFT", 33), + (10, G["new"]): ("SHIFT", 22), + (10, G["while"]): ("SHIFT", 13), + (10, G["isvoid"]): ("SHIFT", 24), + (10, G["{"]): ("SHIFT", 10), (10, G["true"]): ("SHIFT", 25), - (10, G["int"]): ("SHIFT", 34), + (10, G["if"]): ("SHIFT", 12), + (10, G["case"]): ("SHIFT", 21), (10, G["let"]): ("SHIFT", 14), + (10, G["int"]): ("SHIFT", 34), + (10, G["false"]): ("SHIFT", 26), + (10, G["~"]): ("SHIFT", 27), (10, G["("]): ("SHIFT", 11), - (10, G["while"]): ("SHIFT", 13), - (11, G["isvoid"]): ("SHIFT", 24), - (11, G["{"]): ("SHIFT", 10), - (11, G["string"]): ("SHIFT", 33), - (11, G["id"]): ("SHIFT", 31), (11, G["~"]): ("SHIFT", 27), - (11, G["if"]): ("SHIFT", 12), + (11, G["("]): ("SHIFT", 11), + (11, G["id"]): ("SHIFT", 31), + (11, G["string"]): ("SHIFT", 33), (11, G["not"]): ("SHIFT", 30), (11, G["new"]): ("SHIFT", 22), - (11, G["let"]): ("SHIFT", 14), - (11, G["true"]): ("SHIFT", 25), + (11, G["isvoid"]): ("SHIFT", 24), (11, G["while"]): ("SHIFT", 13), - (11, G["int"]): ("SHIFT", 34), + (11, G["true"]): ("SHIFT", 25), + (11, G["{"]): ("SHIFT", 10), + (11, G["if"]): ("SHIFT", 12), (11, G["case"]): ("SHIFT", 21), - (11, G["("]): ("SHIFT", 11), + (11, G["let"]): ("SHIFT", 14), + (11, G["int"]): ("SHIFT", 34), (11, G["false"]): ("SHIFT", 26), - (12, G["id"]): ("SHIFT", 31), - (12, G["if"]): ("SHIFT", 12), (12, G["not"]): ("SHIFT", 30), + (12, G["("]): ("SHIFT", 11), (12, G["isvoid"]): ("SHIFT", 24), + (12, G["id"]): ("SHIFT", 31), + (12, G["while"]): ("SHIFT", 13), + (12, G["string"]): ("SHIFT", 33), + (12, G["{"]): ("SHIFT", 10), + (12, G["if"]): ("SHIFT", 12), + (12, G["case"]): ("SHIFT", 21), (12, G["new"]): ("SHIFT", 22), (12, G["let"]): ("SHIFT", 14), - (12, G["~"]): ("SHIFT", 27), (12, G["true"]): ("SHIFT", 25), - (12, G["while"]): ("SHIFT", 13), + (12, G["~"]): ("SHIFT", 27), (12, G["int"]): ("SHIFT", 34), - (12, G["case"]): ("SHIFT", 21), - (12, G["("]): ("SHIFT", 11), (12, G["false"]): ("SHIFT", 26), - (12, G["{"]): ("SHIFT", 10), - (12, G["string"]): ("SHIFT", 33), - (13, G["~"]): ("SHIFT", 27), + (13, G["isvoid"]): ("SHIFT", 24), (13, G["id"]): ("SHIFT", 31), - (13, G["if"]): ("SHIFT", 12), - (13, G["not"]): ("SHIFT", 30), - (13, G["new"]): ("SHIFT", 22), - (13, G["let"]): ("SHIFT", 14), (13, G["true"]): ("SHIFT", 25), + (13, G["not"]): ("SHIFT", 30), (13, G["int"]): ("SHIFT", 34), + (13, G["false"]): ("SHIFT", 26), (13, G["while"]): ("SHIFT", 13), - (13, G["case"]): ("SHIFT", 21), + (13, G["{"]): ("SHIFT", 10), + (13, G["~"]): ("SHIFT", 27), (13, G["("]): ("SHIFT", 11), - (13, G["false"]): ("SHIFT", 26), + (13, G["if"]): ("SHIFT", 12), + (13, G["let"]): ("SHIFT", 14), + (13, G["case"]): ("SHIFT", 21), (13, G["string"]): ("SHIFT", 33), - (13, G["isvoid"]): ("SHIFT", 24), - (13, G["{"]): ("SHIFT", 10), + (13, G["new"]): ("SHIFT", 22), (14, G["id"]): ("SHIFT", 15), (15, G[":"]): ("SHIFT", 16), (16, G["type"]): ("SHIFT", 17), (17, G[","]): ("SHIFT", 18), - (17, G["<-"]): ("SHIFT", 20), (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), + (17, G["<-"]): ("SHIFT", 20), (18, G["id"]): ("SHIFT", 15), (19, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), - (20, G["("]): ("SHIFT", 11), - (20, G["false"]): ("SHIFT", 26), - (20, G["string"]): ("SHIFT", 33), - (20, G["{"]): ("SHIFT", 10), (20, G["isvoid"]): ("SHIFT", 24), - (20, G["id"]): ("SHIFT", 31), - (20, G["~"]): ("SHIFT", 27), - (20, G["not"]): ("SHIFT", 30), - (20, G["if"]): ("SHIFT", 12), (20, G["new"]): ("SHIFT", 22), (20, G["let"]): ("SHIFT", 14), + (20, G["case"]): ("SHIFT", 21), (20, G["true"]): ("SHIFT", 25), + (20, G["id"]): ("SHIFT", 31), (20, G["int"]): ("SHIFT", 34), + (20, G["false"]): ("SHIFT", 26), + (20, G["~"]): ("SHIFT", 27), + (20, G["("]): ("SHIFT", 11), + (20, G["not"]): ("SHIFT", 30), (20, G["while"]): ("SHIFT", 13), - (20, G["case"]): ("SHIFT", 21), - (21, G["{"]): ("SHIFT", 10), - (21, G["true"]): ("SHIFT", 25), - (21, G["int"]): ("SHIFT", 34), + (20, G["{"]): ("SHIFT", 10), + (20, G["string"]): ("SHIFT", 33), + (20, G["if"]): ("SHIFT", 12), + (21, G["while"]): ("SHIFT", 13), (21, G["id"]): ("SHIFT", 31), - (21, G["isvoid"]): ("SHIFT", 24), - (21, G["("]): ("SHIFT", 11), - (21, G["not"]): ("SHIFT", 30), - (21, G["if"]): ("SHIFT", 12), + (21, G["int"]): ("SHIFT", 34), (21, G["false"]): ("SHIFT", 26), - (21, G["string"]): ("SHIFT", 33), - (21, G["~"]): ("SHIFT", 27), - (21, G["let"]): ("SHIFT", 14), - (21, G["while"]): ("SHIFT", 13), + (21, G["{"]): ("SHIFT", 10), + (21, G["if"]): ("SHIFT", 12), (21, G["case"]): ("SHIFT", 21), + (21, G["let"]): ("SHIFT", 14), + (21, G["("]): ("SHIFT", 11), + (21, G["~"]): ("SHIFT", 27), + (21, G["string"]): ("SHIFT", 33), (21, G["new"]): ("SHIFT", 22), + (21, G["not"]): ("SHIFT", 30), + (21, G["true"]): ("SHIFT", 25), + (21, G["isvoid"]): ("SHIFT", 24), (22, G["type"]): ("SHIFT", 23), + (23, G["loop"]): ("REDUCE", G["atom -> new type"]), + (23, G["@"]): ("REDUCE", G["atom -> new type"]), + (23, G["error"]): ("REDUCE", G["atom -> new type"]), + (23, G[")"]): ("REDUCE", G["atom -> new type"]), + (23, G["+"]): ("REDUCE", G["atom -> new type"]), + (23, G["pool"]): ("REDUCE", G["atom -> new type"]), + (23, G["-"]): ("REDUCE", G["atom -> new type"]), + (23, G["*"]): ("REDUCE", G["atom -> new type"]), (23, G["}"]): ("REDUCE", G["atom -> new type"]), + (23, G["in"]): ("REDUCE", G["atom -> new type"]), (23, G["/"]): ("REDUCE", G["atom -> new type"]), (23, G["of"]): ("REDUCE", G["atom -> new type"]), + (23, G["."]): ("REDUCE", G["atom -> new type"]), (23, G["<"]): ("REDUCE", G["atom -> new type"]), - (23, G[")"]): ("REDUCE", G["atom -> new type"]), (23, G["then"]): ("REDUCE", G["atom -> new type"]), + (23, G[","]): ("REDUCE", G["atom -> new type"]), (23, G["<="]): ("REDUCE", G["atom -> new type"]), - (23, G["."]): ("REDUCE", G["atom -> new type"]), (23, G["else"]): ("REDUCE", G["atom -> new type"]), (23, G["="]): ("REDUCE", G["atom -> new type"]), - (23, G[","]): ("REDUCE", G["atom -> new type"]), (23, G["fi"]): ("REDUCE", G["atom -> new type"]), (23, G[";"]): ("REDUCE", G["atom -> new type"]), - (23, G["loop"]): ("REDUCE", G["atom -> new type"]), - (23, G["@"]): ("REDUCE", G["atom -> new type"]), - (23, G["error"]): ("REDUCE", G["atom -> new type"]), - (23, G["pool"]): ("REDUCE", G["atom -> new type"]), - (23, G["+"]): ("REDUCE", G["atom -> new type"]), - (23, G["-"]): ("REDUCE", G["atom -> new type"]), - (23, G["in"]): ("REDUCE", G["atom -> new type"]), - (23, G["*"]): ("REDUCE", G["atom -> new type"]), (24, G["true"]): ("SHIFT", 25), - (24, G["("]): ("SHIFT", 11), (24, G["id"]): ("SHIFT", 28), + (24, G["false"]): ("SHIFT", 26), (24, G["new"]): ("SHIFT", 22), + (24, G["("]): ("SHIFT", 11), + (24, G["isvoid"]): ("SHIFT", 24), + (24, G["~"]): ("SHIFT", 27), (24, G["int"]): ("SHIFT", 34), - (24, G["false"]): ("SHIFT", 26), (24, G["string"]): ("SHIFT", 33), - (24, G["~"]): ("SHIFT", 27), - (24, G["isvoid"]): ("SHIFT", 24), + (25, G["loop"]): ("REDUCE", G["atom -> true"]), + (25, G["@"]): ("REDUCE", G["atom -> true"]), + (25, G["error"]): ("REDUCE", G["atom -> true"]), + (25, G[")"]): ("REDUCE", G["atom -> true"]), + (25, G["+"]): ("REDUCE", G["atom -> true"]), + (25, G["pool"]): ("REDUCE", G["atom -> true"]), + (25, G["-"]): ("REDUCE", G["atom -> true"]), + (25, G["*"]): ("REDUCE", G["atom -> true"]), (25, G["}"]): ("REDUCE", G["atom -> true"]), + (25, G["in"]): ("REDUCE", G["atom -> true"]), (25, G["/"]): ("REDUCE", G["atom -> true"]), (25, G["of"]): ("REDUCE", G["atom -> true"]), + (25, G["."]): ("REDUCE", G["atom -> true"]), (25, G["<"]): ("REDUCE", G["atom -> true"]), - (25, G[")"]): ("REDUCE", G["atom -> true"]), (25, G["then"]): ("REDUCE", G["atom -> true"]), + (25, G[","]): ("REDUCE", G["atom -> true"]), (25, G["<="]): ("REDUCE", G["atom -> true"]), - (25, G["."]): ("REDUCE", G["atom -> true"]), (25, G["else"]): ("REDUCE", G["atom -> true"]), (25, G["="]): ("REDUCE", G["atom -> true"]), - (25, G[","]): ("REDUCE", G["atom -> true"]), (25, G["fi"]): ("REDUCE", G["atom -> true"]), (25, G[";"]): ("REDUCE", G["atom -> true"]), - (25, G["loop"]): ("REDUCE", G["atom -> true"]), - (25, G["@"]): ("REDUCE", G["atom -> true"]), - (25, G["error"]): ("REDUCE", G["atom -> true"]), - (25, G["pool"]): ("REDUCE", G["atom -> true"]), - (25, G["+"]): ("REDUCE", G["atom -> true"]), - (25, G["-"]): ("REDUCE", G["atom -> true"]), - (25, G["in"]): ("REDUCE", G["atom -> true"]), - (25, G["*"]): ("REDUCE", G["atom -> true"]), + (26, G["loop"]): ("REDUCE", G["atom -> false"]), + (26, G["@"]): ("REDUCE", G["atom -> false"]), + (26, G["error"]): ("REDUCE", G["atom -> false"]), + (26, G[")"]): ("REDUCE", G["atom -> false"]), + (26, G["+"]): ("REDUCE", G["atom -> false"]), + (26, G["pool"]): ("REDUCE", G["atom -> false"]), + (26, G["-"]): ("REDUCE", G["atom -> false"]), + (26, G["*"]): ("REDUCE", G["atom -> false"]), (26, G["}"]): ("REDUCE", G["atom -> false"]), + (26, G["in"]): ("REDUCE", G["atom -> false"]), (26, G["/"]): ("REDUCE", G["atom -> false"]), (26, G["of"]): ("REDUCE", G["atom -> false"]), + (26, G["."]): ("REDUCE", G["atom -> false"]), (26, G["<"]): ("REDUCE", G["atom -> false"]), - (26, G[")"]): ("REDUCE", G["atom -> false"]), (26, G["then"]): ("REDUCE", G["atom -> false"]), + (26, G[","]): ("REDUCE", G["atom -> false"]), (26, G["<="]): ("REDUCE", G["atom -> false"]), - (26, G["."]): ("REDUCE", G["atom -> false"]), (26, G["else"]): ("REDUCE", G["atom -> false"]), (26, G["="]): ("REDUCE", G["atom -> false"]), - (26, G[","]): ("REDUCE", G["atom -> false"]), (26, G["fi"]): ("REDUCE", G["atom -> false"]), (26, G[";"]): ("REDUCE", G["atom -> false"]), - (26, G["loop"]): ("REDUCE", G["atom -> false"]), - (26, G["@"]): ("REDUCE", G["atom -> false"]), - (26, G["error"]): ("REDUCE", G["atom -> false"]), - (26, G["pool"]): ("REDUCE", G["atom -> false"]), - (26, G["+"]): ("REDUCE", G["atom -> false"]), - (26, G["-"]): ("REDUCE", G["atom -> false"]), - (26, G["in"]): ("REDUCE", G["atom -> false"]), - (26, G["*"]): ("REDUCE", G["atom -> false"]), (27, G["true"]): ("SHIFT", 25), - (27, G["("]): ("SHIFT", 11), (27, G["id"]): ("SHIFT", 28), + (27, G["false"]): ("SHIFT", 26), (27, G["new"]): ("SHIFT", 22), + (27, G["("]): ("SHIFT", 11), + (27, G["isvoid"]): ("SHIFT", 24), + (27, G["~"]): ("SHIFT", 27), (27, G["int"]): ("SHIFT", 34), - (27, G["false"]): ("SHIFT", 26), (27, G["string"]): ("SHIFT", 33), - (27, G["~"]): ("SHIFT", 27), - (27, G["isvoid"]): ("SHIFT", 24), - (28, G["("]): ("SHIFT", 29), + (28, G["loop"]): ("REDUCE", G["atom -> id"]), + (28, G["@"]): ("REDUCE", G["atom -> id"]), + (28, G["error"]): ("REDUCE", G["atom -> id"]), + (28, G[")"]): ("REDUCE", G["atom -> id"]), + (28, G["+"]): ("REDUCE", G["atom -> id"]), + (28, G["pool"]): ("REDUCE", G["atom -> id"]), + (28, G["-"]): ("REDUCE", G["atom -> id"]), + (28, G["*"]): ("REDUCE", G["atom -> id"]), (28, G["}"]): ("REDUCE", G["atom -> id"]), + (28, G["in"]): ("REDUCE", G["atom -> id"]), (28, G["/"]): ("REDUCE", G["atom -> id"]), (28, G["of"]): ("REDUCE", G["atom -> id"]), + (28, G["."]): ("REDUCE", G["atom -> id"]), (28, G["<"]): ("REDUCE", G["atom -> id"]), - (28, G[")"]): ("REDUCE", G["atom -> id"]), (28, G["then"]): ("REDUCE", G["atom -> id"]), + (28, G[","]): ("REDUCE", G["atom -> id"]), (28, G["<="]): ("REDUCE", G["atom -> id"]), - (28, G["."]): ("REDUCE", G["atom -> id"]), (28, G["else"]): ("REDUCE", G["atom -> id"]), (28, G["="]): ("REDUCE", G["atom -> id"]), - (28, G[","]): ("REDUCE", G["atom -> id"]), (28, G["fi"]): ("REDUCE", G["atom -> id"]), (28, G[";"]): ("REDUCE", G["atom -> id"]), - (28, G["loop"]): ("REDUCE", G["atom -> id"]), - (28, G["@"]): ("REDUCE", G["atom -> id"]), - (28, G["error"]): ("REDUCE", G["atom -> id"]), - (28, G["pool"]): ("REDUCE", G["atom -> id"]), - (28, G["+"]): ("REDUCE", G["atom -> id"]), - (28, G["-"]): ("REDUCE", G["atom -> id"]), - (28, G["in"]): ("REDUCE", G["atom -> id"]), - (28, G["*"]): ("REDUCE", G["atom -> id"]), - (29, G["~"]): ("SHIFT", 27), + (28, G["("]): ("SHIFT", 29), (29, G["new"]): ("SHIFT", 22), - (29, G["let"]): ("SHIFT", 14), - (29, G["if"]): ("SHIFT", 12), (29, G["id"]): ("SHIFT", 31), - (29, G["while"]): ("SHIFT", 13), - (29, G["case"]): ("SHIFT", 21), (29, G["true"]): ("SHIFT", 25), - (29, G["int"]): ("SHIFT", 34), + (29, G["isvoid"]): ("SHIFT", 24), (29, G[")"]): ("REDUCE", G["expr-list -> e"]), + (29, G["not"]): ("SHIFT", 30), + (29, G["int"]): ("SHIFT", 34), + (29, G["false"]): ("SHIFT", 26), + (29, G["while"]): ("SHIFT", 13), (29, G["("]): ("SHIFT", 11), (29, G["{"]): ("SHIFT", 10), - (29, G["false"]): ("SHIFT", 26), + (29, G["if"]): ("SHIFT", 12), + (29, G["~"]): ("SHIFT", 27), + (29, G["case"]): ("SHIFT", 21), + (29, G["let"]): ("SHIFT", 14), (29, G["string"]): ("SHIFT", 33), - (29, G["not"]): ("SHIFT", 30), - (29, G["isvoid"]): ("SHIFT", 24), - (30, G["true"]): ("SHIFT", 25), + (30, G["false"]): ("SHIFT", 26), + (30, G["("]): ("SHIFT", 11), + (30, G["id"]): ("SHIFT", 31), + (30, G["isvoid"]): ("SHIFT", 24), + (30, G["string"]): ("SHIFT", 33), (30, G["not"]): ("SHIFT", 30), + (30, G["new"]): ("SHIFT", 22), + (30, G["while"]): ("SHIFT", 13), + (30, G["true"]): ("SHIFT", 25), (30, G["int"]): ("SHIFT", 34), + (30, G["{"]): ("SHIFT", 10), (30, G["if"]): ("SHIFT", 12), - (30, G["~"]): ("SHIFT", 27), - (30, G["("]): ("SHIFT", 11), (30, G["let"]): ("SHIFT", 14), - (30, G["false"]): ("SHIFT", 26), - (30, G["string"]): ("SHIFT", 33), - (30, G["while"]): ("SHIFT", 13), + (30, G["~"]): ("SHIFT", 27), (30, G["case"]): ("SHIFT", 21), - (30, G["id"]): ("SHIFT", 31), - (30, G["{"]): ("SHIFT", 10), - (30, G["new"]): ("SHIFT", 22), - (30, G["isvoid"]): ("SHIFT", 24), - (31, G["("]): ("SHIFT", 29), + (31, G["<-"]): ("SHIFT", 32), + (31, G["loop"]): ("REDUCE", G["atom -> id"]), + (31, G["@"]): ("REDUCE", G["atom -> id"]), + (31, G["error"]): ("REDUCE", G["atom -> id"]), + (31, G[")"]): ("REDUCE", G["atom -> id"]), + (31, G["+"]): ("REDUCE", G["atom -> id"]), + (31, G["pool"]): ("REDUCE", G["atom -> id"]), + (31, G["-"]): ("REDUCE", G["atom -> id"]), + (31, G["*"]): ("REDUCE", G["atom -> id"]), (31, G["}"]): ("REDUCE", G["atom -> id"]), + (31, G["in"]): ("REDUCE", G["atom -> id"]), (31, G["/"]): ("REDUCE", G["atom -> id"]), (31, G["of"]): ("REDUCE", G["atom -> id"]), + (31, G["."]): ("REDUCE", G["atom -> id"]), (31, G["<"]): ("REDUCE", G["atom -> id"]), - (31, G[")"]): ("REDUCE", G["atom -> id"]), (31, G["then"]): ("REDUCE", G["atom -> id"]), + (31, G[","]): ("REDUCE", G["atom -> id"]), (31, G["<="]): ("REDUCE", G["atom -> id"]), - (31, G["."]): ("REDUCE", G["atom -> id"]), (31, G["else"]): ("REDUCE", G["atom -> id"]), (31, G["="]): ("REDUCE", G["atom -> id"]), - (31, G[","]): ("REDUCE", G["atom -> id"]), (31, G["fi"]): ("REDUCE", G["atom -> id"]), (31, G[";"]): ("REDUCE", G["atom -> id"]), - (31, G["loop"]): ("REDUCE", G["atom -> id"]), - (31, G["@"]): ("REDUCE", G["atom -> id"]), - (31, G["error"]): ("REDUCE", G["atom -> id"]), - (31, G["pool"]): ("REDUCE", G["atom -> id"]), - (31, G["+"]): ("REDUCE", G["atom -> id"]), - (31, G["-"]): ("REDUCE", G["atom -> id"]), - (31, G["in"]): ("REDUCE", G["atom -> id"]), - (31, G["*"]): ("REDUCE", G["atom -> id"]), - (31, G["<-"]): ("SHIFT", 32), - (32, G["true"]): ("SHIFT", 25), + (31, G["("]): ("SHIFT", 29), + (32, G["false"]): ("SHIFT", 26), + (32, G["("]): ("SHIFT", 11), + (32, G["id"]): ("SHIFT", 31), + (32, G["isvoid"]): ("SHIFT", 24), + (32, G["string"]): ("SHIFT", 33), (32, G["not"]): ("SHIFT", 30), + (32, G["new"]): ("SHIFT", 22), + (32, G["while"]): ("SHIFT", 13), + (32, G["true"]): ("SHIFT", 25), (32, G["int"]): ("SHIFT", 34), + (32, G["{"]): ("SHIFT", 10), (32, G["if"]): ("SHIFT", 12), - (32, G["~"]): ("SHIFT", 27), - (32, G["("]): ("SHIFT", 11), (32, G["let"]): ("SHIFT", 14), - (32, G["false"]): ("SHIFT", 26), - (32, G["string"]): ("SHIFT", 33), - (32, G["while"]): ("SHIFT", 13), + (32, G["~"]): ("SHIFT", 27), (32, G["case"]): ("SHIFT", 21), - (32, G["id"]): ("SHIFT", 31), - (32, G["{"]): ("SHIFT", 10), - (32, G["new"]): ("SHIFT", 22), - (32, G["isvoid"]): ("SHIFT", 24), + (33, G["loop"]): ("REDUCE", G["atom -> string"]), + (33, G["@"]): ("REDUCE", G["atom -> string"]), + (33, G["error"]): ("REDUCE", G["atom -> string"]), + (33, G[")"]): ("REDUCE", G["atom -> string"]), + (33, G["+"]): ("REDUCE", G["atom -> string"]), + (33, G["pool"]): ("REDUCE", G["atom -> string"]), + (33, G["-"]): ("REDUCE", G["atom -> string"]), + (33, G["*"]): ("REDUCE", G["atom -> string"]), (33, G["}"]): ("REDUCE", G["atom -> string"]), + (33, G["in"]): ("REDUCE", G["atom -> string"]), (33, G["/"]): ("REDUCE", G["atom -> string"]), (33, G["of"]): ("REDUCE", G["atom -> string"]), + (33, G["."]): ("REDUCE", G["atom -> string"]), (33, G["<"]): ("REDUCE", G["atom -> string"]), - (33, G[")"]): ("REDUCE", G["atom -> string"]), (33, G["then"]): ("REDUCE", G["atom -> string"]), + (33, G[","]): ("REDUCE", G["atom -> string"]), (33, G["<="]): ("REDUCE", G["atom -> string"]), - (33, G["."]): ("REDUCE", G["atom -> string"]), (33, G["else"]): ("REDUCE", G["atom -> string"]), (33, G["="]): ("REDUCE", G["atom -> string"]), - (33, G[","]): ("REDUCE", G["atom -> string"]), (33, G["fi"]): ("REDUCE", G["atom -> string"]), (33, G[";"]): ("REDUCE", G["atom -> string"]), - (33, G["loop"]): ("REDUCE", G["atom -> string"]), - (33, G["@"]): ("REDUCE", G["atom -> string"]), - (33, G["error"]): ("REDUCE", G["atom -> string"]), - (33, G["pool"]): ("REDUCE", G["atom -> string"]), - (33, G["+"]): ("REDUCE", G["atom -> string"]), - (33, G["-"]): ("REDUCE", G["atom -> string"]), - (33, G["in"]): ("REDUCE", G["atom -> string"]), - (33, G["*"]): ("REDUCE", G["atom -> string"]), + (34, G["loop"]): ("REDUCE", G["atom -> int"]), + (34, G["@"]): ("REDUCE", G["atom -> int"]), + (34, G["error"]): ("REDUCE", G["atom -> int"]), + (34, G[")"]): ("REDUCE", G["atom -> int"]), + (34, G["+"]): ("REDUCE", G["atom -> int"]), + (34, G["pool"]): ("REDUCE", G["atom -> int"]), + (34, G["-"]): ("REDUCE", G["atom -> int"]), + (34, G["*"]): ("REDUCE", G["atom -> int"]), (34, G["}"]): ("REDUCE", G["atom -> int"]), + (34, G["in"]): ("REDUCE", G["atom -> int"]), (34, G["/"]): ("REDUCE", G["atom -> int"]), (34, G["of"]): ("REDUCE", G["atom -> int"]), + (34, G["."]): ("REDUCE", G["atom -> int"]), (34, G["<"]): ("REDUCE", G["atom -> int"]), - (34, G[")"]): ("REDUCE", G["atom -> int"]), (34, G["then"]): ("REDUCE", G["atom -> int"]), + (34, G[","]): ("REDUCE", G["atom -> int"]), (34, G["<="]): ("REDUCE", G["atom -> int"]), - (34, G["."]): ("REDUCE", G["atom -> int"]), (34, G["else"]): ("REDUCE", G["atom -> int"]), (34, G["="]): ("REDUCE", G["atom -> int"]), - (34, G[","]): ("REDUCE", G["atom -> int"]), (34, G["fi"]): ("REDUCE", G["atom -> int"]), (34, G[";"]): ("REDUCE", G["atom -> int"]), - (34, G["loop"]): ("REDUCE", G["atom -> int"]), - (34, G["@"]): ("REDUCE", G["atom -> int"]), - (34, G["error"]): ("REDUCE", G["atom -> int"]), - (34, G["pool"]): ("REDUCE", G["atom -> int"]), - (34, G["+"]): ("REDUCE", G["atom -> int"]), - (34, G["-"]): ("REDUCE", G["atom -> int"]), - (34, G["in"]): ("REDUCE", G["atom -> int"]), - (34, G["*"]): ("REDUCE", G["atom -> int"]), + (35, G["loop"]): ("REDUCE", G["atom -> function-call"]), + (35, G["@"]): ("REDUCE", G["atom -> function-call"]), + (35, G["error"]): ("REDUCE", G["atom -> function-call"]), + (35, G[")"]): ("REDUCE", G["atom -> function-call"]), + (35, G["+"]): ("REDUCE", G["atom -> function-call"]), + (35, G["pool"]): ("REDUCE", G["atom -> function-call"]), + (35, G["-"]): ("REDUCE", G["atom -> function-call"]), + (35, G["*"]): ("REDUCE", G["atom -> function-call"]), (35, G["}"]): ("REDUCE", G["atom -> function-call"]), + (35, G["in"]): ("REDUCE", G["atom -> function-call"]), (35, G["/"]): ("REDUCE", G["atom -> function-call"]), (35, G["of"]): ("REDUCE", G["atom -> function-call"]), + (35, G["."]): ("REDUCE", G["atom -> function-call"]), (35, G["<"]): ("REDUCE", G["atom -> function-call"]), - (35, G[")"]): ("REDUCE", G["atom -> function-call"]), (35, G["then"]): ("REDUCE", G["atom -> function-call"]), + (35, G[","]): ("REDUCE", G["atom -> function-call"]), (35, G["<="]): ("REDUCE", G["atom -> function-call"]), - (35, G["."]): ("REDUCE", G["atom -> function-call"]), (35, G["else"]): ("REDUCE", G["atom -> function-call"]), (35, G["="]): ("REDUCE", G["atom -> function-call"]), - (35, G[","]): ("REDUCE", G["atom -> function-call"]), (35, G["fi"]): ("REDUCE", G["atom -> function-call"]), (35, G[";"]): ("REDUCE", G["atom -> function-call"]), - (35, G["loop"]): ("REDUCE", G["atom -> function-call"]), - (35, G["@"]): ("REDUCE", G["atom -> function-call"]), - (35, G["error"]): ("REDUCE", G["atom -> function-call"]), - (35, G["pool"]): ("REDUCE", G["atom -> function-call"]), - (35, G["+"]): ("REDUCE", G["atom -> function-call"]), - (35, G["-"]): ("REDUCE", G["atom -> function-call"]), - (35, G["in"]): ("REDUCE", G["atom -> function-call"]), - (35, G["*"]): ("REDUCE", G["atom -> function-call"]), - (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["}"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["in"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), (36, G["else"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["in"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), - (37, G[","]): ("REDUCE", G["expr -> comp"]), - (37, G["}"]): ("REDUCE", G["expr -> comp"]), - (37, G[";"]): ("REDUCE", G["expr -> comp"]), - (37, G["of"]): ("REDUCE", G["expr -> comp"]), + (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["}"]): ("REDUCE", G["expr -> id <- expr"]), + (37, G["in"]): ("REDUCE", G["expr -> comp"]), (37, G["loop"]): ("REDUCE", G["expr -> comp"]), - (37, G[")"]): ("REDUCE", G["expr -> comp"]), + (37, G["of"]): ("REDUCE", G["expr -> comp"]), (37, G["error"]): ("REDUCE", G["expr -> comp"]), - (37, G["then"]): ("REDUCE", G["expr -> comp"]), + (37, G[")"]): ("REDUCE", G["expr -> comp"]), (37, G["pool"]): ("REDUCE", G["expr -> comp"]), + (37, G["then"]): ("REDUCE", G["expr -> comp"]), + (37, G[","]): ("REDUCE", G["expr -> comp"]), (37, G["else"]): ("REDUCE", G["expr -> comp"]), - (37, G["in"]): ("REDUCE", G["expr -> comp"]), (37, G["fi"]): ("REDUCE", G["expr -> comp"]), - (38, G["+"]): ("SHIFT", 39), - (38, G["<"]): ("SHIFT", 66), + (37, G[";"]): ("REDUCE", G["expr -> comp"]), + (37, G["}"]): ("REDUCE", G["expr -> comp"]), (38, G["="]): ("SHIFT", 70), - (38, G[","]): ("REDUCE", G["comp -> arith"]), - (38, G["}"]): ("REDUCE", G["comp -> arith"]), - (38, G[";"]): ("REDUCE", G["comp -> arith"]), - (38, G["of"]): ("REDUCE", G["comp -> arith"]), + (38, G["-"]): ("SHIFT", 64), + (38, G["+"]): ("SHIFT", 39), + (38, G["in"]): ("REDUCE", G["comp -> arith"]), (38, G["loop"]): ("REDUCE", G["comp -> arith"]), - (38, G[")"]): ("REDUCE", G["comp -> arith"]), + (38, G["of"]): ("REDUCE", G["comp -> arith"]), (38, G["error"]): ("REDUCE", G["comp -> arith"]), - (38, G["then"]): ("REDUCE", G["comp -> arith"]), + (38, G[")"]): ("REDUCE", G["comp -> arith"]), (38, G["pool"]): ("REDUCE", G["comp -> arith"]), + (38, G["then"]): ("REDUCE", G["comp -> arith"]), + (38, G[","]): ("REDUCE", G["comp -> arith"]), (38, G["else"]): ("REDUCE", G["comp -> arith"]), - (38, G["in"]): ("REDUCE", G["comp -> arith"]), (38, G["fi"]): ("REDUCE", G["comp -> arith"]), + (38, G[";"]): ("REDUCE", G["comp -> arith"]), + (38, G["}"]): ("REDUCE", G["comp -> arith"]), + (38, G["<"]): ("SHIFT", 66), (38, G["<="]): ("SHIFT", 68), - (38, G["-"]): ("SHIFT", 64), + (39, G["false"]): ("SHIFT", 26), + (39, G["new"]): ("SHIFT", 22), + (39, G["("]): ("SHIFT", 11), (39, G["true"]): ("SHIFT", 25), - (39, G["id"]): ("SHIFT", 28), (39, G["int"]): ("SHIFT", 34), + (39, G["id"]): ("SHIFT", 28), + (39, G["isvoid"]): ("SHIFT", 24), (39, G["~"]): ("SHIFT", 27), - (39, G["("]): ("SHIFT", 11), - (39, G["new"]): ("SHIFT", 22), - (39, G["false"]): ("SHIFT", 26), (39, G["string"]): ("SHIFT", 33), - (39, G["isvoid"]): ("SHIFT", 24), - (40, G["*"]): ("SHIFT", 41), + (40, G["/"]): ("SHIFT", 54), + (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), + (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["+"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), (40, G["of"]): ("REDUCE", G["arith -> arith + term"]), (40, G["<"]): ("REDUCE", G["arith -> arith + term"]), - (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), (40, G["then"]): ("REDUCE", G["arith -> arith + term"]), + (40, G[","]): ("REDUCE", G["arith -> arith + term"]), (40, G["<="]): ("REDUCE", G["arith -> arith + term"]), (40, G["else"]): ("REDUCE", G["arith -> arith + term"]), (40, G["="]): ("REDUCE", G["arith -> arith + term"]), - (40, G[","]): ("REDUCE", G["arith -> arith + term"]), (40, G["fi"]): ("REDUCE", G["arith -> arith + term"]), (40, G[";"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["+"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["/"]): ("SHIFT", 54), + (40, G["*"]): ("SHIFT", 41), (41, G["true"]): ("SHIFT", 25), - (41, G["("]): ("SHIFT", 11), (41, G["id"]): ("SHIFT", 28), + (41, G["false"]): ("SHIFT", 26), (41, G["new"]): ("SHIFT", 22), + (41, G["("]): ("SHIFT", 11), + (41, G["isvoid"]): ("SHIFT", 24), + (41, G["~"]): ("SHIFT", 27), (41, G["int"]): ("SHIFT", 34), - (41, G["false"]): ("SHIFT", 26), (41, G["string"]): ("SHIFT", 33), - (41, G["~"]): ("SHIFT", 27), - (41, G["isvoid"]): ("SHIFT", 24), + (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), + (42, G["error"]): ("REDUCE", G["term -> term * factor"]), + (42, G[")"]): ("REDUCE", G["term -> term * factor"]), + (42, G["+"]): ("REDUCE", G["term -> term * factor"]), + (42, G["pool"]): ("REDUCE", G["term -> term * factor"]), + (42, G["-"]): ("REDUCE", G["term -> term * factor"]), + (42, G["*"]): ("REDUCE", G["term -> term * factor"]), (42, G["}"]): ("REDUCE", G["term -> term * factor"]), + (42, G["in"]): ("REDUCE", G["term -> term * factor"]), (42, G["/"]): ("REDUCE", G["term -> term * factor"]), (42, G["of"]): ("REDUCE", G["term -> term * factor"]), (42, G["<"]): ("REDUCE", G["term -> term * factor"]), - (42, G[")"]): ("REDUCE", G["term -> term * factor"]), (42, G["then"]): ("REDUCE", G["term -> term * factor"]), + (42, G[","]): ("REDUCE", G["term -> term * factor"]), (42, G["<="]): ("REDUCE", G["term -> term * factor"]), (42, G["else"]): ("REDUCE", G["term -> term * factor"]), (42, G["="]): ("REDUCE", G["term -> term * factor"]), - (42, G[","]): ("REDUCE", G["term -> term * factor"]), (42, G["fi"]): ("REDUCE", G["term -> term * factor"]), (42, G[";"]): ("REDUCE", G["term -> term * factor"]), - (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), - (42, G["error"]): ("REDUCE", G["term -> term * factor"]), - (42, G["pool"]): ("REDUCE", G["term -> term * factor"]), - (42, G["+"]): ("REDUCE", G["term -> term * factor"]), - (42, G["-"]): ("REDUCE", G["term -> term * factor"]), - (42, G["in"]): ("REDUCE", G["term -> term * factor"]), - (42, G["*"]): ("REDUCE", G["term -> term * factor"]), + (43, G["@"]): ("SHIFT", 57), + (43, G["."]): ("SHIFT", 44), + (43, G["loop"]): ("REDUCE", G["factor -> atom"]), + (43, G["error"]): ("REDUCE", G["factor -> atom"]), + (43, G[")"]): ("REDUCE", G["factor -> atom"]), + (43, G["+"]): ("REDUCE", G["factor -> atom"]), + (43, G["pool"]): ("REDUCE", G["factor -> atom"]), + (43, G["-"]): ("REDUCE", G["factor -> atom"]), + (43, G["*"]): ("REDUCE", G["factor -> atom"]), (43, G["}"]): ("REDUCE", G["factor -> atom"]), + (43, G["in"]): ("REDUCE", G["factor -> atom"]), (43, G["/"]): ("REDUCE", G["factor -> atom"]), (43, G["of"]): ("REDUCE", G["factor -> atom"]), (43, G["<"]): ("REDUCE", G["factor -> atom"]), - (43, G[")"]): ("REDUCE", G["factor -> atom"]), (43, G["then"]): ("REDUCE", G["factor -> atom"]), + (43, G[","]): ("REDUCE", G["factor -> atom"]), (43, G["<="]): ("REDUCE", G["factor -> atom"]), (43, G["else"]): ("REDUCE", G["factor -> atom"]), (43, G["="]): ("REDUCE", G["factor -> atom"]), - (43, G[","]): ("REDUCE", G["factor -> atom"]), (43, G["fi"]): ("REDUCE", G["factor -> atom"]), (43, G[";"]): ("REDUCE", G["factor -> atom"]), - (43, G["loop"]): ("REDUCE", G["factor -> atom"]), - (43, G["error"]): ("REDUCE", G["factor -> atom"]), - (43, G["pool"]): ("REDUCE", G["factor -> atom"]), - (43, G["+"]): ("REDUCE", G["factor -> atom"]), - (43, G["-"]): ("REDUCE", G["factor -> atom"]), - (43, G["in"]): ("REDUCE", G["factor -> atom"]), - (43, G["*"]): ("REDUCE", G["factor -> atom"]), - (43, G["@"]): ("SHIFT", 57), - (43, G["."]): ("SHIFT", 44), (44, G["id"]): ("SHIFT", 45), (45, G["("]): ("SHIFT", 46), - (46, G["~"]): ("SHIFT", 27), (46, G["new"]): ("SHIFT", 22), - (46, G["let"]): ("SHIFT", 14), - (46, G["if"]): ("SHIFT", 12), (46, G["id"]): ("SHIFT", 31), - (46, G["while"]): ("SHIFT", 13), - (46, G["case"]): ("SHIFT", 21), (46, G["true"]): ("SHIFT", 25), + (46, G["isvoid"]): ("SHIFT", 24), + (46, G[")"]): ("REDUCE", G["expr-list -> e"]), + (46, G["not"]): ("SHIFT", 30), (46, G["int"]): ("SHIFT", 34), - (46, G[")"]): ("REDUCE", G["expr-list -> e"]), + (46, G["false"]): ("SHIFT", 26), + (46, G["while"]): ("SHIFT", 13), (46, G["("]): ("SHIFT", 11), (46, G["{"]): ("SHIFT", 10), - (46, G["false"]): ("SHIFT", 26), + (46, G["if"]): ("SHIFT", 12), + (46, G["~"]): ("SHIFT", 27), + (46, G["case"]): ("SHIFT", 21), + (46, G["let"]): ("SHIFT", 14), (46, G["string"]): ("SHIFT", 33), - (46, G["not"]): ("SHIFT", 30), - (46, G["isvoid"]): ("SHIFT", 24), (47, G[")"]): ("SHIFT", 48), + (48, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (49, G[")"]): ("REDUCE", G["expr-list -> not-empty-expr-list"]), (50, G[","]): ("SHIFT", 51), (50, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), - (51, G["~"]): ("SHIFT", 27), (51, G["new"]): ("SHIFT", 22), - (51, G["let"]): ("SHIFT", 14), - (51, G["if"]): ("SHIFT", 12), (51, G["id"]): ("SHIFT", 31), - (51, G["while"]): ("SHIFT", 13), - (51, G["case"]): ("SHIFT", 21), (51, G["true"]): ("SHIFT", 25), + (51, G["isvoid"]): ("SHIFT", 24), + (51, G["not"]): ("SHIFT", 30), (51, G["int"]): ("SHIFT", 34), + (51, G["false"]): ("SHIFT", 26), + (51, G["while"]): ("SHIFT", 13), (51, G["("]): ("SHIFT", 11), (51, G["{"]): ("SHIFT", 10), - (51, G["false"]): ("SHIFT", 26), + (51, G["if"]): ("SHIFT", 12), + (51, G["~"]): ("SHIFT", 27), + (51, G["case"]): ("SHIFT", 21), + (51, G["let"]): ("SHIFT", 14), (51, G["string"]): ("SHIFT", 33), - (51, G["not"]): ("SHIFT", 30), - (51, G["isvoid"]): ("SHIFT", 24), (52, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr , not-empty-expr-list"]), (53, G["/"]): ("SHIFT", 54), - (53, G["*"]): ("SHIFT", 41), + (53, G["loop"]): ("REDUCE", G["arith -> term"]), + (53, G["error"]): ("REDUCE", G["arith -> term"]), + (53, G[")"]): ("REDUCE", G["arith -> term"]), + (53, G["pool"]): ("REDUCE", G["arith -> term"]), + (53, G["+"]): ("REDUCE", G["arith -> term"]), + (53, G["-"]): ("REDUCE", G["arith -> term"]), (53, G["}"]): ("REDUCE", G["arith -> term"]), + (53, G["in"]): ("REDUCE", G["arith -> term"]), (53, G["of"]): ("REDUCE", G["arith -> term"]), (53, G["<"]): ("REDUCE", G["arith -> term"]), - (53, G[")"]): ("REDUCE", G["arith -> term"]), (53, G["then"]): ("REDUCE", G["arith -> term"]), + (53, G[","]): ("REDUCE", G["arith -> term"]), (53, G["<="]): ("REDUCE", G["arith -> term"]), (53, G["else"]): ("REDUCE", G["arith -> term"]), (53, G["="]): ("REDUCE", G["arith -> term"]), - (53, G[","]): ("REDUCE", G["arith -> term"]), (53, G["fi"]): ("REDUCE", G["arith -> term"]), (53, G[";"]): ("REDUCE", G["arith -> term"]), - (53, G["loop"]): ("REDUCE", G["arith -> term"]), - (53, G["error"]): ("REDUCE", G["arith -> term"]), - (53, G["pool"]): ("REDUCE", G["arith -> term"]), - (53, G["+"]): ("REDUCE", G["arith -> term"]), - (53, G["-"]): ("REDUCE", G["arith -> term"]), - (53, G["in"]): ("REDUCE", G["arith -> term"]), + (53, G["*"]): ("SHIFT", 41), (54, G["true"]): ("SHIFT", 25), - (54, G["("]): ("SHIFT", 11), (54, G["id"]): ("SHIFT", 28), + (54, G["false"]): ("SHIFT", 26), (54, G["new"]): ("SHIFT", 22), + (54, G["("]): ("SHIFT", 11), + (54, G["isvoid"]): ("SHIFT", 24), + (54, G["~"]): ("SHIFT", 27), (54, G["int"]): ("SHIFT", 34), - (54, G["false"]): ("SHIFT", 26), (54, G["string"]): ("SHIFT", 33), - (54, G["~"]): ("SHIFT", 27), - (54, G["isvoid"]): ("SHIFT", 24), + (55, G["loop"]): ("REDUCE", G["term -> term / factor"]), + (55, G["error"]): ("REDUCE", G["term -> term / factor"]), + (55, G[")"]): ("REDUCE", G["term -> term / factor"]), + (55, G["+"]): ("REDUCE", G["term -> term / factor"]), + (55, G["pool"]): ("REDUCE", G["term -> term / factor"]), + (55, G["-"]): ("REDUCE", G["term -> term / factor"]), + (55, G["*"]): ("REDUCE", G["term -> term / factor"]), (55, G["}"]): ("REDUCE", G["term -> term / factor"]), + (55, G["in"]): ("REDUCE", G["term -> term / factor"]), (55, G["/"]): ("REDUCE", G["term -> term / factor"]), (55, G["of"]): ("REDUCE", G["term -> term / factor"]), (55, G["<"]): ("REDUCE", G["term -> term / factor"]), - (55, G[")"]): ("REDUCE", G["term -> term / factor"]), (55, G["then"]): ("REDUCE", G["term -> term / factor"]), + (55, G[","]): ("REDUCE", G["term -> term / factor"]), (55, G["<="]): ("REDUCE", G["term -> term / factor"]), (55, G["else"]): ("REDUCE", G["term -> term / factor"]), (55, G["="]): ("REDUCE", G["term -> term / factor"]), - (55, G[","]): ("REDUCE", G["term -> term / factor"]), (55, G["fi"]): ("REDUCE", G["term -> term / factor"]), (55, G[";"]): ("REDUCE", G["term -> term / factor"]), - (55, G["loop"]): ("REDUCE", G["term -> term / factor"]), - (55, G["error"]): ("REDUCE", G["term -> term / factor"]), - (55, G["pool"]): ("REDUCE", G["term -> term / factor"]), - (55, G["+"]): ("REDUCE", G["term -> term / factor"]), - (55, G["-"]): ("REDUCE", G["term -> term / factor"]), - (55, G["in"]): ("REDUCE", G["term -> term / factor"]), - (55, G["*"]): ("REDUCE", G["term -> term / factor"]), + (56, G["loop"]): ("REDUCE", G["term -> factor"]), + (56, G["error"]): ("REDUCE", G["term -> factor"]), + (56, G[")"]): ("REDUCE", G["term -> factor"]), + (56, G["+"]): ("REDUCE", G["term -> factor"]), + (56, G["pool"]): ("REDUCE", G["term -> factor"]), + (56, G["-"]): ("REDUCE", G["term -> factor"]), + (56, G["*"]): ("REDUCE", G["term -> factor"]), (56, G["}"]): ("REDUCE", G["term -> factor"]), + (56, G["in"]): ("REDUCE", G["term -> factor"]), (56, G["/"]): ("REDUCE", G["term -> factor"]), (56, G["of"]): ("REDUCE", G["term -> factor"]), (56, G["<"]): ("REDUCE", G["term -> factor"]), - (56, G[")"]): ("REDUCE", G["term -> factor"]), (56, G["then"]): ("REDUCE", G["term -> factor"]), + (56, G[","]): ("REDUCE", G["term -> factor"]), (56, G["<="]): ("REDUCE", G["term -> factor"]), (56, G["else"]): ("REDUCE", G["term -> factor"]), (56, G["="]): ("REDUCE", G["term -> factor"]), - (56, G[","]): ("REDUCE", G["term -> factor"]), (56, G["fi"]): ("REDUCE", G["term -> factor"]), (56, G[";"]): ("REDUCE", G["term -> factor"]), - (56, G["loop"]): ("REDUCE", G["term -> factor"]), - (56, G["error"]): ("REDUCE", G["term -> factor"]), - (56, G["pool"]): ("REDUCE", G["term -> factor"]), - (56, G["+"]): ("REDUCE", G["term -> factor"]), - (56, G["-"]): ("REDUCE", G["term -> factor"]), - (56, G["in"]): ("REDUCE", G["term -> factor"]), - (56, G["*"]): ("REDUCE", G["term -> factor"]), (57, G["type"]): ("SHIFT", 58), (58, G["."]): ("SHIFT", 59), (59, G["id"]): ("SHIFT", 60), (60, G["("]): ("SHIFT", 61), - (61, G["~"]): ("SHIFT", 27), (61, G["new"]): ("SHIFT", 22), - (61, G["let"]): ("SHIFT", 14), - (61, G["if"]): ("SHIFT", 12), (61, G["id"]): ("SHIFT", 31), - (61, G["while"]): ("SHIFT", 13), - (61, G["case"]): ("SHIFT", 21), (61, G["true"]): ("SHIFT", 25), - (61, G["int"]): ("SHIFT", 34), + (61, G["isvoid"]): ("SHIFT", 24), (61, G[")"]): ("REDUCE", G["expr-list -> e"]), + (61, G["not"]): ("SHIFT", 30), + (61, G["int"]): ("SHIFT", 34), + (61, G["false"]): ("SHIFT", 26), + (61, G["while"]): ("SHIFT", 13), (61, G["("]): ("SHIFT", 11), (61, G["{"]): ("SHIFT", 10), - (61, G["false"]): ("SHIFT", 26), + (61, G["if"]): ("SHIFT", 12), + (61, G["~"]): ("SHIFT", 27), + (61, G["case"]): ("SHIFT", 21), + (61, G["let"]): ("SHIFT", 14), (61, G["string"]): ("SHIFT", 33), - (61, G["not"]): ("SHIFT", 30), - (61, G["isvoid"]): ("SHIFT", 24), (62, G[")"]): ("SHIFT", 63), + (63, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (64, G["false"]): ("SHIFT", 26), + (64, G["new"]): ("SHIFT", 22), + (64, G["("]): ("SHIFT", 11), (64, G["true"]): ("SHIFT", 25), - (64, G["id"]): ("SHIFT", 28), (64, G["int"]): ("SHIFT", 34), + (64, G["id"]): ("SHIFT", 28), + (64, G["isvoid"]): ("SHIFT", 24), (64, G["~"]): ("SHIFT", 27), - (64, G["("]): ("SHIFT", 11), - (64, G["new"]): ("SHIFT", 22), - (64, G["false"]): ("SHIFT", 26), (64, G["string"]): ("SHIFT", 33), - (64, G["isvoid"]): ("SHIFT", 24), - (65, G["*"]): ("SHIFT", 41), + (65, G["/"]): ("SHIFT", 54), + (65, G["loop"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["error"]): ("REDUCE", G["arith -> arith - term"]), + (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["pool"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["+"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["-"]): ("REDUCE", G["arith -> arith - term"]), (65, G["}"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), (65, G["of"]): ("REDUCE", G["arith -> arith - term"]), (65, G["<"]): ("REDUCE", G["arith -> arith - term"]), - (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), (65, G["then"]): ("REDUCE", G["arith -> arith - term"]), + (65, G[","]): ("REDUCE", G["arith -> arith - term"]), (65, G["<="]): ("REDUCE", G["arith -> arith - term"]), (65, G["else"]): ("REDUCE", G["arith -> arith - term"]), (65, G["="]): ("REDUCE", G["arith -> arith - term"]), - (65, G[","]): ("REDUCE", G["arith -> arith - term"]), (65, G["fi"]): ("REDUCE", G["arith -> arith - term"]), (65, G[";"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["loop"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["error"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["pool"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["+"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["-"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["/"]): ("SHIFT", 54), - (66, G["("]): ("SHIFT", 11), - (66, G["isvoid"]): ("SHIFT", 24), - (66, G["new"]): ("SHIFT", 22), + (65, G["*"]): ("SHIFT", 41), (66, G["false"]): ("SHIFT", 26), - (66, G["string"]): ("SHIFT", 33), + (66, G["new"]): ("SHIFT", 22), + (66, G["("]): ("SHIFT", 11), + (66, G["true"]): ("SHIFT", 25), (66, G["id"]): ("SHIFT", 28), (66, G["~"]): ("SHIFT", 27), - (66, G["true"]): ("SHIFT", 25), + (66, G["isvoid"]): ("SHIFT", 24), (66, G["int"]): ("SHIFT", 34), - (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["}"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), + (66, G["string"]): ("SHIFT", 33), + (67, G["in"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), (67, G["else"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["in"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["+"]): ("SHIFT", 39), + (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["}"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["-"]): ("SHIFT", 64), - (68, G["("]): ("SHIFT", 11), - (68, G["isvoid"]): ("SHIFT", 24), - (68, G["new"]): ("SHIFT", 22), + (67, G["+"]): ("SHIFT", 39), (68, G["false"]): ("SHIFT", 26), - (68, G["string"]): ("SHIFT", 33), + (68, G["new"]): ("SHIFT", 22), + (68, G["("]): ("SHIFT", 11), + (68, G["true"]): ("SHIFT", 25), (68, G["id"]): ("SHIFT", 28), (68, G["~"]): ("SHIFT", 27), - (68, G["true"]): ("SHIFT", 25), + (68, G["isvoid"]): ("SHIFT", 24), (68, G["int"]): ("SHIFT", 34), - (69, G["+"]): ("SHIFT", 39), - (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), + (68, G["string"]): ("SHIFT", 33), + (69, G["-"]): ("SHIFT", 64), + (69, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["-"]): ("SHIFT", 64), - (70, G["("]): ("SHIFT", 11), - (70, G["isvoid"]): ("SHIFT", 24), - (70, G["new"]): ("SHIFT", 22), + (69, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["+"]): ("SHIFT", 39), (70, G["false"]): ("SHIFT", 26), - (70, G["string"]): ("SHIFT", 33), + (70, G["new"]): ("SHIFT", 22), + (70, G["("]): ("SHIFT", 11), + (70, G["true"]): ("SHIFT", 25), (70, G["id"]): ("SHIFT", 28), (70, G["~"]): ("SHIFT", 27), - (70, G["true"]): ("SHIFT", 25), + (70, G["isvoid"]): ("SHIFT", 24), (70, G["int"]): ("SHIFT", 34), - (71, G["+"]): ("SHIFT", 39), - (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["}"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[";"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), + (70, G["string"]): ("SHIFT", 33), + (71, G["in"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["error"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), (71, G["else"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["in"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[";"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["}"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["-"]): ("SHIFT", 64), - (72, G["}"]): ("REDUCE", G["expr -> not expr"]), + (71, G["+"]): ("SHIFT", 39), (72, G["in"]): ("REDUCE", G["expr -> not expr"]), - (72, G["of"]): ("REDUCE", G["expr -> not expr"]), - (72, G[";"]): ("REDUCE", G["expr -> not expr"]), (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), - (72, G[")"]): ("REDUCE", G["expr -> not expr"]), + (72, G["of"]): ("REDUCE", G["expr -> not expr"]), (72, G["error"]): ("REDUCE", G["expr -> not expr"]), - (72, G["then"]): ("REDUCE", G["expr -> not expr"]), + (72, G[")"]): ("REDUCE", G["expr -> not expr"]), (72, G["pool"]): ("REDUCE", G["expr -> not expr"]), - (72, G["else"]): ("REDUCE", G["expr -> not expr"]), + (72, G["then"]): ("REDUCE", G["expr -> not expr"]), (72, G[","]): ("REDUCE", G["expr -> not expr"]), + (72, G["else"]): ("REDUCE", G["expr -> not expr"]), (72, G["fi"]): ("REDUCE", G["expr -> not expr"]), + (72, G[";"]): ("REDUCE", G["expr -> not expr"]), + (72, G["}"]): ("REDUCE", G["expr -> not expr"]), (73, G[")"]): ("SHIFT", 74), + (74, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G[")"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["+"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["-"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["*"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["}"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["/"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["of"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["<"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G[")"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["then"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G[","]): ("REDUCE", G["factor -> ~ factor"]), (75, G["<="]): ("REDUCE", G["factor -> ~ factor"]), (75, G["else"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["="]): ("REDUCE", G["factor -> ~ factor"]), - (75, G[","]): ("REDUCE", G["factor -> ~ factor"]), (75, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), (75, G[";"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["+"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["-"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["*"]): ("REDUCE", G["factor -> ~ factor"]), + (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), (77, G["of"]): ("SHIFT", 78), (78, G["id"]): ("SHIFT", 79), (79, G[":"]): ("SHIFT", 80), (80, G["type"]): ("SHIFT", 81), (81, G["=>"]): ("SHIFT", 82), + (82, G["new"]): ("SHIFT", 22), + (82, G["true"]): ("SHIFT", 25), (82, G["isvoid"]): ("SHIFT", 24), (82, G["id"]): ("SHIFT", 31), - (82, G["true"]): ("SHIFT", 25), - (82, G["~"]): ("SHIFT", 27), (82, G["int"]): ("SHIFT", 34), - (82, G["{"]): ("SHIFT", 10), - (82, G["("]): ("SHIFT", 11), (82, G["false"]): ("SHIFT", 26), - (82, G["string"]): ("SHIFT", 33), - (82, G["if"]): ("SHIFT", 12), (82, G["not"]): ("SHIFT", 30), - (82, G["let"]): ("SHIFT", 14), - (82, G["new"]): ("SHIFT", 22), + (82, G["("]): ("SHIFT", 11), (82, G["while"]): ("SHIFT", 13), + (82, G["~"]): ("SHIFT", 27), + (82, G["{"]): ("SHIFT", 10), + (82, G["if"]): ("SHIFT", 12), + (82, G["string"]): ("SHIFT", 33), (82, G["case"]): ("SHIFT", 21), + (82, G["let"]): ("SHIFT", 14), (83, G[";"]): ("SHIFT", 84), (83, G["error"]): ("SHIFT", 86), - (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), (84, G["id"]): ("SHIFT", 79), + (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), (86, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), (87, G["esac"]): ("SHIFT", 88), - (88, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), + (88, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G[","]): ("SHIFT", 90), + (89, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), (90, G["id"]): ("SHIFT", 15), (91, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), (92, G["in"]): ("SHIFT", 93), - (93, G["true"]): ("SHIFT", 25), + (93, G["false"]): ("SHIFT", 26), + (93, G["("]): ("SHIFT", 11), + (93, G["id"]): ("SHIFT", 31), + (93, G["isvoid"]): ("SHIFT", 24), + (93, G["string"]): ("SHIFT", 33), (93, G["not"]): ("SHIFT", 30), + (93, G["new"]): ("SHIFT", 22), + (93, G["while"]): ("SHIFT", 13), + (93, G["true"]): ("SHIFT", 25), (93, G["int"]): ("SHIFT", 34), + (93, G["{"]): ("SHIFT", 10), (93, G["if"]): ("SHIFT", 12), - (93, G["~"]): ("SHIFT", 27), - (93, G["("]): ("SHIFT", 11), (93, G["let"]): ("SHIFT", 14), - (93, G["false"]): ("SHIFT", 26), - (93, G["string"]): ("SHIFT", 33), - (93, G["while"]): ("SHIFT", 13), + (93, G["~"]): ("SHIFT", 27), (93, G["case"]): ("SHIFT", 21), - (93, G["id"]): ("SHIFT", 31), - (93, G["{"]): ("SHIFT", 10), - (93, G["new"]): ("SHIFT", 22), - (93, G["isvoid"]): ("SHIFT", 24), - (94, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["loop"]): ("SHIFT", 96), - (96, G["id"]): ("SHIFT", 31), - (96, G["true"]): ("SHIFT", 25), - (96, G["~"]): ("SHIFT", 27), - (96, G["int"]): ("SHIFT", 34), - (96, G["if"]): ("SHIFT", 12), - (96, G["not"]): ("SHIFT", 30), - (96, G["("]): ("SHIFT", 11), - (96, G["false"]): ("SHIFT", 26), (96, G["string"]): ("SHIFT", 33), - (96, G["let"]): ("SHIFT", 14), - (96, G["case"]): ("SHIFT", 21), - (96, G["while"]): ("SHIFT", 13), + (96, G["not"]): ("SHIFT", 30), (96, G["new"]): ("SHIFT", 22), + (96, G["while"]): ("SHIFT", 13), + (96, G["~"]): ("SHIFT", 27), + (96, G["true"]): ("SHIFT", 25), (96, G["{"]): ("SHIFT", 10), + (96, G["if"]): ("SHIFT", 12), + (96, G["id"]): ("SHIFT", 31), + (96, G["case"]): ("SHIFT", 21), + (96, G["int"]): ("SHIFT", 34), + (96, G["let"]): ("SHIFT", 14), + (96, G["false"]): ("SHIFT", 26), (96, G["isvoid"]): ("SHIFT", 24), + (96, G["("]): ("SHIFT", 11), (97, G["pool"]): ("SHIFT", 98), - (98, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["then"]): ("SHIFT", 100), + (100, G["~"]): ("SHIFT", 27), (100, G["("]): ("SHIFT", 11), - (100, G["false"]): ("SHIFT", 26), - (100, G["string"]): ("SHIFT", 33), (100, G["id"]): ("SHIFT", 31), - (100, G["if"]): ("SHIFT", 12), + (100, G["string"]): ("SHIFT", 33), + (100, G["new"]): ("SHIFT", 22), (100, G["not"]): ("SHIFT", 30), (100, G["isvoid"]): ("SHIFT", 24), - (100, G["~"]): ("SHIFT", 27), - (100, G["let"]): ("SHIFT", 14), - (100, G["new"]): ("SHIFT", 22), - (100, G["while"]): ("SHIFT", 13), - (100, G["case"]): ("SHIFT", 21), (100, G["true"]): ("SHIFT", 25), + (100, G["while"]): ("SHIFT", 13), (100, G["int"]): ("SHIFT", 34), (100, G["{"]): ("SHIFT", 10), + (100, G["if"]): ("SHIFT", 12), + (100, G["false"]): ("SHIFT", 26), + (100, G["let"]): ("SHIFT", 14), + (100, G["case"]): ("SHIFT", 21), (101, G["else"]): ("SHIFT", 102), - (102, G["int"]): ("SHIFT", 34), - (102, G["~"]): ("SHIFT", 27), - (102, G["{"]): ("SHIFT", 10), - (102, G["("]): ("SHIFT", 11), - (102, G["id"]): ("SHIFT", 31), - (102, G["false"]): ("SHIFT", 26), (102, G["string"]): ("SHIFT", 33), + (102, G["while"]): ("SHIFT", 13), + (102, G["new"]): ("SHIFT", 22), + (102, G["{"]): ("SHIFT", 10), (102, G["if"]): ("SHIFT", 12), - (102, G["not"]): ("SHIFT", 30), + (102, G["~"]): ("SHIFT", 27), + (102, G["true"]): ("SHIFT", 25), + (102, G["case"]): ("SHIFT", 21), (102, G["let"]): ("SHIFT", 14), - (102, G["new"]): ("SHIFT", 22), - (102, G["while"]): ("SHIFT", 13), + (102, G["id"]): ("SHIFT", 31), + (102, G["int"]): ("SHIFT", 34), + (102, G["false"]): ("SHIFT", 26), (102, G["isvoid"]): ("SHIFT", 24), - (102, G["case"]): ("SHIFT", 21), - (102, G["true"]): ("SHIFT", 25), + (102, G["("]): ("SHIFT", 11), + (102, G["not"]): ("SHIFT", 30), (103, G["fi"]): ("SHIFT", 104), - (104, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G[")"]): ("SHIFT", 106), - (106, G["}"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["/"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["of"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["<"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G[")"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["then"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["<="]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["."]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["else"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["="]): ("REDUCE", G["atom -> ( expr )"]), - (106, G[","]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G[";"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["@"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["error"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G[")"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["+"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["-"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["in"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["*"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["}"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["in"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["/"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["of"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["."]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["<"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["then"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G[","]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["<="]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["else"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["="]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G[";"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["}"]): ("SHIFT", 108), - (108, G[","]): ("REDUCE", G["expr -> { block }"]), - (108, G["}"]): ("REDUCE", G["expr -> { block }"]), - (108, G[";"]): ("REDUCE", G["expr -> { block }"]), - (108, G["of"]): ("REDUCE", G["expr -> { block }"]), + (108, G["in"]): ("REDUCE", G["expr -> { block }"]), (108, G["loop"]): ("REDUCE", G["expr -> { block }"]), - (108, G[")"]): ("REDUCE", G["expr -> { block }"]), + (108, G["of"]): ("REDUCE", G["expr -> { block }"]), (108, G["error"]): ("REDUCE", G["expr -> { block }"]), - (108, G["then"]): ("REDUCE", G["expr -> { block }"]), + (108, G[")"]): ("REDUCE", G["expr -> { block }"]), (108, G["pool"]): ("REDUCE", G["expr -> { block }"]), + (108, G["then"]): ("REDUCE", G["expr -> { block }"]), + (108, G[","]): ("REDUCE", G["expr -> { block }"]), (108, G["else"]): ("REDUCE", G["expr -> { block }"]), - (108, G["in"]): ("REDUCE", G["expr -> { block }"]), (108, G["fi"]): ("REDUCE", G["expr -> { block }"]), + (108, G[";"]): ("REDUCE", G["expr -> { block }"]), + (108, G["}"]): ("REDUCE", G["expr -> { block }"]), (109, G[";"]): ("SHIFT", 110), - (110, G["false"]): ("SHIFT", 26), - (110, G["case"]): ("SHIFT", 21), - (110, G["}"]): ("REDUCE", G["block -> expr ;"]), - (110, G["string"]): ("SHIFT", 33), (110, G["id"]): ("SHIFT", 31), - (110, G["{"]): ("SHIFT", 10), - (110, G["isvoid"]): ("SHIFT", 24), - (110, G["new"]): ("SHIFT", 22), - (110, G["~"]): ("SHIFT", 27), - (110, G["if"]): ("SHIFT", 12), (110, G["not"]): ("SHIFT", 30), + (110, G["string"]): ("SHIFT", 33), + (110, G["new"]): ("SHIFT", 22), + (110, G["while"]): ("SHIFT", 13), + (110, G["isvoid"]): ("SHIFT", 24), + (110, G["{"]): ("SHIFT", 10), (110, G["true"]): ("SHIFT", 25), - (110, G["int"]): ("SHIFT", 34), + (110, G["if"]): ("SHIFT", 12), + (110, G["case"]): ("SHIFT", 21), (110, G["let"]): ("SHIFT", 14), + (110, G["int"]): ("SHIFT", 34), + (110, G["false"]): ("SHIFT", 26), + (110, G["}"]): ("REDUCE", G["block -> expr ;"]), + (110, G["~"]): ("SHIFT", 27), (110, G["("]): ("SHIFT", 11), - (110, G["while"]): ("SHIFT", 13), (111, G["}"]): ("REDUCE", G["block -> expr ; block"]), (112, G["}"]): ("SHIFT", 113), (113, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), @@ -1040,50 +1040,50 @@ def __action_table(): (120, G[":"]): ("SHIFT", 121), (121, G["type"]): ("SHIFT", 122), (122, G["{"]): ("SHIFT", 123), - (123, G["new"]): ("SHIFT", 22), - (123, G["{"]): ("SHIFT", 10), + (123, G["false"]): ("SHIFT", 26), (123, G["id"]): ("SHIFT", 31), - (123, G["true"]): ("SHIFT", 25), - (123, G["int"]): ("SHIFT", 34), - (123, G["if"]): ("SHIFT", 12), - (123, G["not"]): ("SHIFT", 30), (123, G["("]): ("SHIFT", 11), - (123, G["false"]): ("SHIFT", 26), - (123, G["string"]): ("SHIFT", 33), + (123, G["not"]): ("SHIFT", 30), (123, G["isvoid"]): ("SHIFT", 24), - (123, G["let"]): ("SHIFT", 14), + (123, G["string"]): ("SHIFT", 33), (123, G["while"]): ("SHIFT", 13), - (123, G["~"]): ("SHIFT", 27), + (123, G["new"]): ("SHIFT", 22), + (123, G["{"]): ("SHIFT", 10), + (123, G["if"]): ("SHIFT", 12), + (123, G["true"]): ("SHIFT", 25), (123, G["case"]): ("SHIFT", 21), + (123, G["let"]): ("SHIFT", 14), + (123, G["int"]): ("SHIFT", 34), + (123, G["~"]): ("SHIFT", 27), (124, G["}"]): ("SHIFT", 125), - (125, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (125, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (125, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (126, G["type"]): ("SHIFT", 127), (127, G["<-"]): ("SHIFT", 128), - (127, G[";"]): ("REDUCE", G["attribute -> id : type"]), (127, G["error"]): ("REDUCE", G["attribute -> id : type"]), + (127, G[";"]): ("REDUCE", G["attribute -> id : type"]), + (128, G["new"]): ("SHIFT", 22), + (128, G["true"]): ("SHIFT", 25), (128, G["isvoid"]): ("SHIFT", 24), (128, G["id"]): ("SHIFT", 31), - (128, G["true"]): ("SHIFT", 25), - (128, G["~"]): ("SHIFT", 27), (128, G["int"]): ("SHIFT", 34), - (128, G["{"]): ("SHIFT", 10), - (128, G["("]): ("SHIFT", 11), (128, G["false"]): ("SHIFT", 26), - (128, G["string"]): ("SHIFT", 33), (128, G["not"]): ("SHIFT", 30), - (128, G["if"]): ("SHIFT", 12), - (128, G["let"]): ("SHIFT", 14), - (128, G["new"]): ("SHIFT", 22), + (128, G["("]): ("SHIFT", 11), (128, G["while"]): ("SHIFT", 13), + (128, G["~"]): ("SHIFT", 27), + (128, G["{"]): ("SHIFT", 10), + (128, G["if"]): ("SHIFT", 12), + (128, G["string"]): ("SHIFT", 33), (128, G["case"]): ("SHIFT", 21), - (129, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (128, G["let"]): ("SHIFT", 14), (129, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (129, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), (130, G["}"]): ("SHIFT", 131), (131, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), (131, G["class"]): ("REDUCE", G["class-def -> class type { feature-list }"]), - (132, G[";"]): ("SHIFT", 133), (132, G["error"]): ("SHIFT", 140), + (132, G[";"]): ("SHIFT", 133), (133, G["id"]): ("SHIFT", 4), (133, G["}"]): ("REDUCE", G["feature-list -> e"]), (134, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), @@ -1107,233 +1107,233 @@ def __action_table(): (146, G["class"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), (147, G["$"]): ("OK", None), (148, G["$"]): ("REDUCE", G["program -> class-list"]), - (149, G["class"]): ("SHIFT", 1), (149, G["$"]): ("REDUCE", G["class-list -> class-def"]), + (149, G["class"]): ("SHIFT", 1), (150, G["$"]): ("REDUCE", G["class-list -> class-def class-list"]), } @staticmethod def __goto_table(): return { - (0, G["class-list"]): 148, (0, G["program"]): 147, + (0, G["class-list"]): 148, (0, G["class-def"]): 149, - (3, G["method"]): 135, - (3, G["feature-list"]): 130, (3, G["attribute"]): 132, + (3, G["feature-list"]): 130, + (3, G["method"]): 135, (5, G["param-list"]): 119, - (9, G["arith"]): 38, (9, G["term"]): 53, - (9, G["expr"]): 112, (9, G["atom"]): 43, (9, G["function-call"]): 35, - (9, G["factor"]): 56, + (9, G["expr"]): 112, (9, G["comp"]): 37, - (10, G["arith"]): 38, + (9, G["arith"]): 38, + (9, G["factor"]): 56, (10, G["function-call"]): 35, - (10, G["expr"]): 109, - (10, G["comp"]): 37, (10, G["term"]): 53, (10, G["block"]): 107, + (10, G["comp"]): 37, (10, G["atom"]): 43, + (10, G["arith"]): 38, + (10, G["expr"]): 109, (10, G["factor"]): 56, (11, G["arith"]): 38, + (11, G["factor"]): 56, (11, G["term"]): 53, + (11, G["function-call"]): 35, + (11, G["comp"]): 37, (11, G["atom"]): 43, (11, G["expr"]): 105, - (11, G["comp"]): 37, - (11, G["factor"]): 56, - (11, G["function-call"]): 35, - (12, G["arith"]): 38, - (12, G["atom"]): 43, - (12, G["factor"]): 56, (12, G["term"]): 53, - (12, G["expr"]): 99, - (12, G["comp"]): 37, (12, G["function-call"]): 35, - (13, G["arith"]): 38, - (13, G["expr"]): 95, + (12, G["atom"]): 43, + (12, G["comp"]): 37, + (12, G["arith"]): 38, + (12, G["expr"]): 99, + (12, G["factor"]): 56, (13, G["term"]): 53, - (13, G["function-call"]): 35, (13, G["atom"]): 43, + (13, G["expr"]): 95, (13, G["comp"]): 37, + (13, G["arith"]): 38, (13, G["factor"]): 56, + (13, G["function-call"]): 35, (14, G["declaration-list"]): 92, (18, G["declaration-list"]): 19, - (20, G["term"]): 53, - (20, G["function-call"]): 35, - (20, G["comp"]): 37, (20, G["atom"]): 43, (20, G["expr"]): 89, (20, G["arith"]): 38, + (20, G["term"]): 53, (20, G["factor"]): 56, + (20, G["function-call"]): 35, + (20, G["comp"]): 37, + (21, G["comp"]): 37, (21, G["arith"]): 38, (21, G["atom"]): 43, (21, G["factor"]): 56, - (21, G["term"]): 53, (21, G["function-call"]): 35, - (21, G["comp"]): 37, (21, G["expr"]): 77, + (21, G["term"]): 53, (24, G["function-call"]): 35, (24, G["atom"]): 43, (24, G["factor"]): 76, (27, G["function-call"]): 35, - (27, G["atom"]): 43, (27, G["factor"]): 75, - (29, G["arith"]): 38, - (29, G["term"]): 53, + (27, G["atom"]): 43, (29, G["expr"]): 50, - (29, G["not-empty-expr-list"]): 49, (29, G["atom"]): 43, + (29, G["not-empty-expr-list"]): 49, (29, G["comp"]): 37, + (29, G["arith"]): 38, + (29, G["expr-list"]): 73, (29, G["function-call"]): 35, (29, G["factor"]): 56, - (29, G["expr-list"]): 73, + (29, G["term"]): 53, + (30, G["expr"]): 72, (30, G["term"]): 53, - (30, G["function-call"]): 35, (30, G["arith"]): 38, + (30, G["function-call"]): 35, (30, G["atom"]): 43, (30, G["comp"]): 37, - (30, G["expr"]): 72, (30, G["factor"]): 56, (32, G["term"]): 53, - (32, G["function-call"]): 35, (32, G["arith"]): 38, + (32, G["function-call"]): 35, (32, G["atom"]): 43, + (32, G["expr"]): 36, (32, G["comp"]): 37, (32, G["factor"]): 56, - (32, G["expr"]): 36, - (39, G["atom"]): 43, (39, G["term"]): 40, (39, G["function-call"]): 35, + (39, G["atom"]): 43, (39, G["factor"]): 56, (41, G["function-call"]): 35, - (41, G["atom"]): 43, (41, G["factor"]): 42, - (46, G["arith"]): 38, - (46, G["term"]): 53, + (41, G["atom"]): 43, + (46, G["expr-list"]): 47, (46, G["expr"]): 50, - (46, G["not-empty-expr-list"]): 49, (46, G["atom"]): 43, + (46, G["not-empty-expr-list"]): 49, (46, G["comp"]): 37, + (46, G["arith"]): 38, (46, G["function-call"]): 35, - (46, G["expr-list"]): 47, (46, G["factor"]): 56, - (51, G["arith"]): 38, - (51, G["term"]): 53, + (46, G["term"]): 53, (51, G["expr"]): 50, (51, G["atom"]): 43, + (51, G["not-empty-expr-list"]): 52, (51, G["comp"]): 37, + (51, G["arith"]): 38, (51, G["function-call"]): 35, - (51, G["not-empty-expr-list"]): 52, (51, G["factor"]): 56, + (51, G["term"]): 53, (54, G["function-call"]): 35, - (54, G["atom"]): 43, (54, G["factor"]): 55, - (61, G["arith"]): 38, - (61, G["term"]): 53, + (54, G["atom"]): 43, (61, G["expr"]): 50, - (61, G["not-empty-expr-list"]): 49, (61, G["atom"]): 43, - (61, G["comp"]): 37, (61, G["expr-list"]): 62, + (61, G["not-empty-expr-list"]): 49, + (61, G["comp"]): 37, + (61, G["arith"]): 38, (61, G["function-call"]): 35, (61, G["factor"]): 56, - (64, G["atom"]): 43, + (61, G["term"]): 53, (64, G["term"]): 65, (64, G["function-call"]): 35, + (64, G["atom"]): 43, (64, G["factor"]): 56, - (66, G["factor"]): 56, (66, G["term"]): 53, (66, G["function-call"]): 35, + (66, G["factor"]): 56, (66, G["arith"]): 67, (66, G["atom"]): 43, - (68, G["factor"]): 56, - (68, G["arith"]): 69, (68, G["term"]): 53, + (68, G["arith"]): 69, (68, G["function-call"]): 35, + (68, G["factor"]): 56, (68, G["atom"]): 43, - (70, G["factor"]): 56, (70, G["term"]): 53, (70, G["function-call"]): 35, + (70, G["factor"]): 56, (70, G["arith"]): 71, (70, G["atom"]): 43, (78, G["case-list"]): 87, - (82, G["term"]): 53, - (82, G["comp"]): 37, (82, G["arith"]): 38, + (82, G["atom"]): 43, + (82, G["comp"]): 37, (82, G["expr"]): 83, (82, G["function-call"]): 35, - (82, G["atom"]): 43, + (82, G["term"]): 53, (82, G["factor"]): 56, (84, G["case-list"]): 85, (90, G["declaration-list"]): 91, (93, G["term"]): 53, - (93, G["function-call"]): 35, (93, G["arith"]): 38, + (93, G["function-call"]): 35, (93, G["atom"]): 43, (93, G["comp"]): 37, (93, G["expr"]): 94, (93, G["factor"]): 56, - (96, G["term"]): 53, - (96, G["expr"]): 97, - (96, G["function-call"]): 35, (96, G["arith"]): 38, - (96, G["atom"]): 43, (96, G["comp"]): 37, (96, G["factor"]): 56, - (100, G["arith"]): 38, + (96, G["expr"]): 97, + (96, G["term"]): 53, + (96, G["atom"]): 43, + (96, G["function-call"]): 35, (100, G["function-call"]): 35, + (100, G["arith"]): 38, (100, G["term"]): 53, (100, G["atom"]): 43, - (100, G["factor"]): 56, (100, G["expr"]): 101, (100, G["comp"]): 37, + (100, G["factor"]): 56, + (102, G["comp"]): 37, (102, G["arith"]): 38, - (102, G["function-call"]): 35, - (102, G["atom"]): 43, - (102, G["term"]): 53, (102, G["factor"]): 56, + (102, G["term"]): 53, + (102, G["atom"]): 43, (102, G["expr"]): 103, - (102, G["comp"]): 37, - (110, G["arith"]): 38, + (102, G["function-call"]): 35, (110, G["function-call"]): 35, - (110, G["expr"]): 109, - (110, G["comp"]): 37, (110, G["term"]): 53, + (110, G["comp"]): 37, (110, G["atom"]): 43, - (110, G["factor"]): 56, + (110, G["arith"]): 38, + (110, G["expr"]): 109, (110, G["block"]): 111, + (110, G["factor"]): 56, (117, G["param-list"]): 118, - (123, G["arith"]): 38, (123, G["term"]): 53, (123, G["atom"]): 43, (123, G["function-call"]): 35, - (123, G["factor"]): 56, - (123, G["expr"]): 124, (123, G["comp"]): 37, - (128, G["term"]): 53, - (128, G["comp"]): 37, + (123, G["arith"]): 38, + (123, G["expr"]): 124, + (123, G["factor"]): 56, (128, G["arith"]): 38, - (128, G["function-call"]): 35, (128, G["atom"]): 43, (128, G["expr"]): 129, + (128, G["comp"]): 37, + (128, G["function-call"]): 35, + (128, G["term"]): 53, (128, G["factor"]): 56, - (133, G["method"]): 135, (133, G["attribute"]): 132, (133, G["feature-list"]): 134, - (136, G["method"]): 135, - (136, G["feature-list"]): 137, + (133, G["method"]): 135, (136, G["attribute"]): 132, - (138, G["method"]): 135, + (136, G["feature-list"]): 137, + (136, G["method"]): 135, (138, G["attribute"]): 132, + (138, G["method"]): 135, (138, G["feature-list"]): 139, - (140, G["method"]): 135, - (140, G["feature-list"]): 141, (140, G["attribute"]): 132, + (140, G["feature-list"]): 141, + (140, G["method"]): 135, + (144, G["attribute"]): 132, (144, G["method"]): 135, (144, G["feature-list"]): 145, - (144, G["attribute"]): 132, - (149, G["class-list"]): 150, (149, G["class-def"]): 149, + (149, G["class-list"]): 150, } diff --git a/semantics/formatter.py b/semantics/formatter.py index a9c1f915f..6749fe88a 100644 --- a/semantics/formatter.py +++ b/semantics/formatter.py @@ -32,15 +32,21 @@ def visit(self, node: ast.MethodDeclarationNode, tabs: int = 0): @visitor.when(ast.LetNode) def visit(self, node: ast.LetNode, tabs: int = 0): - declarations = '\n'.join(self.visit(declaration, 0) for declaration in node.declarations) + declarations = [] + for _id, _type, _expr in node.declarations: + if _expr is not None: + declarations.append(f'{_id}: {_type} <- {self.visit(_expr)}') + else: + declarations.append(f'{_id} : {_type}') + declarations = ('\n' + '\t' * (tabs + 1)).join(declarations) return '\t' * tabs + f'let {declarations} in \n{self.visit(node.expr, tabs + 1)}' - @visitor.when(ast.VarDeclarationNode) - def visit(self, node: ast.VarDeclarationNode, tabs: int = 0): - if node.expr is not None: - return f'{node.id}: {node.type} <- {self.visit(node.expr)}' - else: - return f'{node.id} : {node.type}' + # @visitor.when(ast.VarDeclarationNode) + # def visit(self, node: ast.VarDeclarationNode, tabs: int = 0): + # if node.expr is not None: + # return f'{node.id}: {node.type} <- {self.visit(node.expr)}' + # else: + # return f'{node.id} : {node.type}' @visitor.when(ast.AssignNode) def visit(self, node: ast.AssignNode, tabs: int = 0): @@ -133,17 +139,24 @@ def visit(self, node: ast.MethodDeclarationNode, tabs: int = 0): @visitor.when(ast.LetNode) def visit(self, node: ast.LetNode, tabs: int = 0): - declarations = '\n'.join(self.visit(declaration, tabs + 1) for declaration in node.declarations) + declarations = [] + for _id, _type, _expr in node.declarations: + if _expr is not None: + declarations.append('\t' * tabs + f'\\__VarDeclarationNode: {_id}: {_type} <-\n{self.visit(_expr, tabs + 1)}') + else: + declarations.append('\t' * tabs + f'\\__VarDeclarationNode: {_id} : {_type}') + + declarations = '\n'.join(declarations) ans = '\t' * tabs + f'\\__LetNode: let' expr = self.visit(node.expr, tabs + 2) return f'{ans}\n {declarations}\n' + '\t' * (tabs + 1) + 'in\n' + f'{expr}' - @visitor.when(ast.VarDeclarationNode) - def visit(self, node: ast.VarDeclarationNode, tabs: int = 0): - if node.expr is not None: - return '\t' * tabs + f'\\__VarDeclarationNode: {node.id}: {node.type} <-\n{self.visit(node.expr, tabs + 1)}' - else: - return '\t' * tabs + f'\\__VarDeclarationNode: {node.id} : {node.type}' + # @visitor.when(ast.VarDeclarationNode) + # def visit(self, node: ast.VarDeclarationNode, tabs: int = 0): + # if node.expr is not None: + # return '\t' * tabs + f'\\__VarDeclarationNode: {node.id}: {node.type} <-\n{self.visit(node.expr, tabs + 1)}' + # else: + # return '\t' * tabs + f'\\__VarDeclarationNode: {node.id} : {node.type}' @visitor.when(ast.AssignNode) def visit(self, node: ast.AssignNode, tabs: int = 0): diff --git a/semantics/progam_executor.py b/semantics/progam_executor.py index 68d4c1064..5b204755c 100644 --- a/semantics/progam_executor.py +++ b/semantics/progam_executor.py @@ -73,10 +73,10 @@ def __init__(self, typex: Type, value: Any = None): self.value: Any = value self.attribute_values: Dict[str, Instance] = {} - def set_attribute_value(self, name: str, value: 'Instance') -> None: + def set_attribute_instance(self, name: str, value: 'Instance') -> None: self.attribute_values[name] = value - def get_attribute_value(self, name: str) -> 'Instance': + def get_attribute_instance(self, name: str) -> 'Instance': return self.attribute_values[name] def get_method(self, name: str) -> Method: @@ -137,29 +137,34 @@ def visit(self, node: ast.MethodDeclarationNode, scope: Scope): @visitor.when(ast.LetNode) def visit(self, node: ast.LetNode, scope: Scope): - for x in node.declarations: - self.visit(x, scope) + for _id, _type, _expr in node.declarations: + variable_info = scope.define_variable(_id, self.context.get_type(_type)) + if _expr is not None: + variable_info.instance = self.visit(_expr, scope.create_child()) + else: + variable_info.instance = VoidInstance() return self.visit(node.expr, scope.create_child()) - @visitor.when(ast.VarDeclarationNode) - def visit(self, node: ast.VarDeclarationNode, scope: Scope): - variable_info = scope.define_variable(node.id, self.context.types) - if node.expr is not None: - variable_info.instance = self.visit(node.expr, scope) - else: - variable_info.instance = VoidInstance() + # @visitor.when(ast.VarDeclarationNode) + # def visit(self, node: ast.VarDeclarationNode, scope: Scope): + # variable_info = scope.define_variable(node.id, self.context.types) + # if node.expr is not None: + # variable_info.instance = self.visit(node.expr, scope) + # else: + # variable_info.instance = VoidInstance() @visitor.when(ast.AssignNode) def visit(self, node: ast.AssignNode, scope: Scope): variable_info = scope.find_variable(node.id) - variable_info.value = self.visit(node.expr, scope) - return variable_info.value + variable_info.instance = self.visit(node.expr, scope) + return variable_info.instance @visitor.when(ast.BlockNode) def visit(self, node: ast.BlockNode, scope: Scope): + child_scope = scope.create_child() instance = None for expr in node.expressions: - instance = self.visit(expr, scope) + instance = self.visit(expr, child_scope) return instance @visitor.when(ast.ConditionalNode) @@ -231,7 +236,7 @@ def visit(self, node: ast.VariableNode, scope: Scope): if variable_info is not None: return variable_info.instance else: - return self.current_instance.get_attribute_value(node.lex) + return self.current_instance.get_attribute_instance(node.lex) @visitor.when(ast.InstantiateNode) def visit(self, node: ast.InstantiateNode, scope: Scope): @@ -247,7 +252,7 @@ def visit(self, node: ast.InstantiateNode, scope: Scope): self.call_stack.append(self.current_instance) self.current_instance = instance for attribute, _ in instance.type.all_attributes(): - instance.set_attribute_value(attribute.name, self.visit(attribute.expr, Scope())) + instance.set_attribute_instance(attribute.name, self.visit(attribute.expr, Scope())) self.current_instance = self.call_stack.pop() return instance diff --git a/semantics/type_checker.py b/semantics/type_checker.py index 098d5ccb1..d387fc731 100644 --- a/semantics/type_checker.py +++ b/semantics/type_checker.py @@ -90,28 +90,42 @@ def visit(self, node: ast.MethodDeclarationNode, scope: Scope): @visitor.when(ast.LetNode) def visit(self, node: ast.LetNode, scope: Scope): - for elem in node.declarations: - self.visit(elem, scope) - return self.visit(node.expr, scope.create_child()) + for _id, _type, _expr in node.declarations: + try: + var_static_type = self.context.get_type(_type) if _type != 'SELF_TYPE' else self.current_type + except SemanticError as e: + self.errors.append(e.text) + var_static_type = ErrorType() - @visitor.when(ast.VarDeclarationNode) - def visit(self, node: ast.VarDeclarationNode, scope: Scope): - try: - var_static_type = self.context.get_type(node.type) if node.type != 'SELF_TYPE' else self.current_type - except SemanticError as e: - self.errors.append(e.text) - var_static_type = ErrorType() + if scope.is_local(_id): + self.errors.append(err.LOCAL_ALREADY_DEFINED % (_id, self.current_method.name)) + else: + scope.define_variable(_id, var_static_type) - if scope.is_local(node.id): - self.errors.append(err.LOCAL_ALREADY_DEFINED % (node.id, self.current_method.name)) - else: - scope.define_variable(node.id, var_static_type) + expr_type = self.visit(_expr, scope.create_child()) if _expr is not None else None + if expr_type is not None and not expr_type.conforms_to(var_static_type): + self.errors.append(err.INCOMPATIBLE_TYPES % (expr_type.name, var_static_type.name)) - expr_type = self.visit(node.expr, scope.create_child()) if node.expr is not None else None - if expr_type is not None and not expr_type.conforms_to(var_static_type): - self.errors.append(err.INCOMPATIBLE_TYPES % (expr_type.name, var_static_type.name)) + return self.visit(node.expr, scope.create_child()) - return var_static_type + # @visitor.when(ast.VarDeclarationNode) + # def visit(self, node: ast.VarDeclarationNode, scope: Scope): + # try: + # var_static_type = self.context.get_type(node.type) if node.type != 'SELF_TYPE' else self.current_type + # except SemanticError as e: + # self.errors.append(e.text) + # var_static_type = ErrorType() + # + # if scope.is_local(node.id): + # self.errors.append(err.LOCAL_ALREADY_DEFINED % (node.id, self.current_method.name)) + # else: + # scope.define_variable(node.id, var_static_type) + # + # expr_type = self.visit(node.expr, scope.create_child()) if node.expr is not None else None + # if expr_type is not None and not expr_type.conforms_to(var_static_type): + # self.errors.append(err.INCOMPATIBLE_TYPES % (expr_type.name, var_static_type.name)) + # + # return var_static_type @visitor.when(ast.AssignNode) def visit(self, node: ast.AssignNode, scope: Scope): diff --git a/semantics/type_inference.py b/semantics/type_inference.py index f900ab11a..1de289e52 100644 --- a/semantics/type_inference.py +++ b/semantics/type_inference.py @@ -120,6 +120,9 @@ def add_node(self, node: DependencyNode): self.dependencies[node] = [] def add_edge(self, node: DependencyNode, other: DependencyNode): + if node is None: + print('Cheese') + try: self.dependencies[node].append(other) except KeyError: @@ -149,6 +152,7 @@ def update_dependencies_of(self, node: DependencyNode, typex: Type, visited: Set if current_node in visited: continue + print(current_node) current_node.update(typex) visited.add(current_node) queue.extend(self.dependencies[current_node]) @@ -203,6 +207,9 @@ def visit(self, node: ast.ProgramNode, scope: Scope = None): for item in node.declarations: self.visit(item, scope.create_child()) + for i, (k, v) in enumerate(self.graph.dependencies.items()): + print(f'{i} : {k} -> {v}') + print() self.graph.update_dependencies(default_type=self.context.get_type('Object')) InferenceTypeSubstitute(self.context, self.errors).visit(node, scope) @@ -281,25 +288,39 @@ def visit(self, node: ast.MethodDeclarationNode, scope: Scope): @visitor.when(ast.LetNode) def visit(self, node: ast.LetNode, scope: Scope): - for item in node.declarations: - self.visit(item, scope) + for _id, _type, _expr in node.declarations: + try: + # Define and get the var_info + var_info = scope.define_variable(_id, self.context.get_type(_type)) + except SemanticError: + var_info = scope.define_variable(_id, ErrorType()) + var_info_node = self.variables[var_info] = VariableInfoNode(var_info.type, var_info) - return self.visit(node.expr, scope.create_child()) + expr_node = self.visit(_expr, scope.create_child()) if _expr is not None else None - @visitor.when(ast.VarDeclarationNode) - def visit(self, node: ast.VarDeclarationNode, scope: Scope): - try: - # Define and get the var_info - var_info = scope.define_variable(node.id, self.context.get_type(node.type)) - except SemanticError: - var_info = scope.define_variable(node.id, ErrorType()) - var_info_node = self.variables[var_info] = VariableInfoNode(var_info.name, var_info) + if var_info.type.name == 'AUTO_TYPE': + if expr_node is not None: + # Create an edge only if is AutoType + self.graph.add_edge(expr_node, var_info_node) + else: + self.graph.add_node(var_info_node) - expr_node = self.visit(node.expr, scope.create_child()) if node.expr is not None else None + return self.visit(node.expr, scope.create_child()) - if var_info.type.name == 'AUTO_TYPE': - # Create an edge only if is AutoType - self.graph.add_edge(expr_node, var_info_node) + # @visitor.when(ast.VarDeclarationNode) + # def visit(self, node: ast.VarDeclarationNode, scope: Scope): + # try: + # # Define and get the var_info + # var_info = scope.define_variable(node.id, self.context.get_type(node.type)) + # except SemanticError: + # var_info = scope.define_variable(node.id, ErrorType()) + # var_info_node = self.variables[var_info] = VariableInfoNode(var_info.name, var_info) + # + # expr_node = self.visit(node.expr, scope.create_child()) if node.expr is not None else None + # + # if var_info.type.name == 'AUTO_TYPE': + # # Create an edge only if is AutoType + # self.graph.add_edge(expr_node, var_info_node) @visitor.when(ast.AssignNode) def visit(self, node: ast.AssignNode, scope: Scope): @@ -535,22 +556,32 @@ def visit(self, node: ast.MethodDeclarationNode, scope: Scope): @visitor.when(ast.LetNode) def visit(self, node: ast.LetNode, scope: Scope): - for elem in node.declarations: - self.visit(elem, scope) - - self.visit(node.expr, scope.children[0]) - - @visitor.when(ast.VarDeclarationNode) - def visit(self, node: ast.VarDeclarationNode, scope: Scope): - variable_info = scope.find_variable(node.id) - - if node.expr is not None: - self.visit(node.expr, scope.children[0]) - - if node.type == 'AUTO_TYPE': - if variable_info.type == self.context.get_type('AUTO_TYPE'): - self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % node.id) - node.type = variable_info.type.name + child_index = 0 + for i, (_id, _type, _expr) in enumerate(node.declarations): + variable_info = scope.find_variable(_id) + + if _expr is not None: + self.visit(_expr, scope.children[child_index]) + child_index += 1 + + if _type == 'AUTO_TYPE': + if variable_info.type == self.context.get_type('AUTO_TYPE'): + self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % _id) + node.declarations[i] = (_id, variable_info.type.name, _expr) + + self.visit(node.expr, scope.children[child_index]) + # + # @visitor.when(ast.VarDeclarationNode) + # def visit(self, node: ast.VarDeclarationNode, scope: Scope): + # variable_info = scope.find_variable(node.id) + # + # if node.expr is not None: + # self.visit(node.expr, scope.children[0]) + # + # if node.type == 'AUTO_TYPE': + # if variable_info.type == self.context.get_type('AUTO_TYPE'): + # self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % node.id) + # node.type = variable_info.type.name @visitor.when(ast.AssignNode) def visit(self, node: ast.AssignNode, scope: Scope): diff --git a/semantics/utils/astnodes.py b/semantics/utils/astnodes.py index 03988c7b2..c0ccbd43e 100755 --- a/semantics/utils/astnodes.py +++ b/semantics/utils/astnodes.py @@ -1,4 +1,4 @@ -from typing import List, Union, Tuple +from typing import List, Union, Tuple, Optional Feature = Union['MethodDeclarationNode', 'AttrDeclarationNode'] @@ -54,7 +54,7 @@ def __init__(self, expressions): class LetNode(ExprNode): def __init__(self, declarations, expr): - self.declarations: List[VarDeclarationNode] = declarations + self.declarations: List[Tuple[str, str, Optional[ExprNode]]] = declarations self.expr: ExprNode = expr From 1e10987c326de1005eb83fe896346cb6fcd36d7b Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Sun, 24 May 2020 06:23:49 -0400 Subject: [PATCH 054/143] Security Save --- main.py | 17 ++++++++++++++++- semantics/formatter.py | 14 -------------- semantics/progam_executor.py | 18 ++++-------------- semantics/type_checker.py | 19 ------------------- semantics/type_inference.py | 22 ---------------------- semantics/utils/astnodes.py | 7 ------- 6 files changed, 20 insertions(+), 77 deletions(-) diff --git a/main.py b/main.py index f84336a4f..fdb545afb 100755 --- a/main.py +++ b/main.py @@ -95,11 +95,26 @@ class Main inherits IO { """ hello_world = r""" +class A { } + +class B inherits A { } + +class C inherits A { } + class Main inherits IO { - main () : AUTO_TYPE {{ + main () : Object { + let a: A <- new C in + case a of + x: C => out_string("Is type C.\n"); + x: B => out_string("Is type B.\n"); + esac + }; + + testing_fibonacci(n: Int) : IO {{ out_string("Iterative Fibonacci : "); out_int(iterative_fibonacci(5)); out_string("\n"); + out_string("Recursive Fibonacci : "); out_int(recursive_fibonacci(5)); out_string("\n"); diff --git a/semantics/formatter.py b/semantics/formatter.py index 6749fe88a..5cc13673d 100644 --- a/semantics/formatter.py +++ b/semantics/formatter.py @@ -41,13 +41,6 @@ def visit(self, node: ast.LetNode, tabs: int = 0): declarations = ('\n' + '\t' * (tabs + 1)).join(declarations) return '\t' * tabs + f'let {declarations} in \n{self.visit(node.expr, tabs + 1)}' - # @visitor.when(ast.VarDeclarationNode) - # def visit(self, node: ast.VarDeclarationNode, tabs: int = 0): - # if node.expr is not None: - # return f'{node.id}: {node.type} <- {self.visit(node.expr)}' - # else: - # return f'{node.id} : {node.type}' - @visitor.when(ast.AssignNode) def visit(self, node: ast.AssignNode, tabs: int = 0): return '\t' * tabs + f'{node.id} <- {self.visit(node.expr)}' @@ -151,13 +144,6 @@ def visit(self, node: ast.LetNode, tabs: int = 0): expr = self.visit(node.expr, tabs + 2) return f'{ans}\n {declarations}\n' + '\t' * (tabs + 1) + 'in\n' + f'{expr}' - # @visitor.when(ast.VarDeclarationNode) - # def visit(self, node: ast.VarDeclarationNode, tabs: int = 0): - # if node.expr is not None: - # return '\t' * tabs + f'\\__VarDeclarationNode: {node.id}: {node.type} <-\n{self.visit(node.expr, tabs + 1)}' - # else: - # return '\t' * tabs + f'\\__VarDeclarationNode: {node.id} : {node.type}' - @visitor.when(ast.AssignNode) def visit(self, node: ast.AssignNode, tabs: int = 0): ans = '\t' * tabs + f'\\__AssignNode: {node.id} <- ' diff --git a/semantics/progam_executor.py b/semantics/progam_executor.py index 5b204755c..939190b65 100644 --- a/semantics/progam_executor.py +++ b/semantics/progam_executor.py @@ -137,21 +137,11 @@ def visit(self, node: ast.MethodDeclarationNode, scope: Scope): @visitor.when(ast.LetNode) def visit(self, node: ast.LetNode, scope: Scope): - for _id, _type, _expr in node.declarations: - variable_info = scope.define_variable(_id, self.context.get_type(_type)) - if _expr is not None: - variable_info.instance = self.visit(_expr, scope.create_child()) - else: - variable_info.instance = VoidInstance() - return self.visit(node.expr, scope.create_child()) + for _id, _, _expr in node.declarations: + instance = self.visit(_expr, scope.create_child()) if _expr is not None else VoidInstance() + scope.define_variable(_id, instance.type).instance = instance - # @visitor.when(ast.VarDeclarationNode) - # def visit(self, node: ast.VarDeclarationNode, scope: Scope): - # variable_info = scope.define_variable(node.id, self.context.types) - # if node.expr is not None: - # variable_info.instance = self.visit(node.expr, scope) - # else: - # variable_info.instance = VoidInstance() + return self.visit(node.expr, scope.create_child()) @visitor.when(ast.AssignNode) def visit(self, node: ast.AssignNode, scope: Scope): diff --git a/semantics/type_checker.py b/semantics/type_checker.py index d387fc731..048ad6e2b 100644 --- a/semantics/type_checker.py +++ b/semantics/type_checker.py @@ -108,25 +108,6 @@ def visit(self, node: ast.LetNode, scope: Scope): return self.visit(node.expr, scope.create_child()) - # @visitor.when(ast.VarDeclarationNode) - # def visit(self, node: ast.VarDeclarationNode, scope: Scope): - # try: - # var_static_type = self.context.get_type(node.type) if node.type != 'SELF_TYPE' else self.current_type - # except SemanticError as e: - # self.errors.append(e.text) - # var_static_type = ErrorType() - # - # if scope.is_local(node.id): - # self.errors.append(err.LOCAL_ALREADY_DEFINED % (node.id, self.current_method.name)) - # else: - # scope.define_variable(node.id, var_static_type) - # - # expr_type = self.visit(node.expr, scope.create_child()) if node.expr is not None else None - # if expr_type is not None and not expr_type.conforms_to(var_static_type): - # self.errors.append(err.INCOMPATIBLE_TYPES % (expr_type.name, var_static_type.name)) - # - # return var_static_type - @visitor.when(ast.AssignNode) def visit(self, node: ast.AssignNode, scope: Scope): var_info = scope.find_variable(node.id) diff --git a/semantics/type_inference.py b/semantics/type_inference.py index 1de289e52..425b7aae5 100644 --- a/semantics/type_inference.py +++ b/semantics/type_inference.py @@ -120,9 +120,6 @@ def add_node(self, node: DependencyNode): self.dependencies[node] = [] def add_edge(self, node: DependencyNode, other: DependencyNode): - if node is None: - print('Cheese') - try: self.dependencies[node].append(other) except KeyError: @@ -152,7 +149,6 @@ def update_dependencies_of(self, node: DependencyNode, typex: Type, visited: Set if current_node in visited: continue - print(current_node) current_node.update(typex) visited.add(current_node) queue.extend(self.dependencies[current_node]) @@ -207,9 +203,6 @@ def visit(self, node: ast.ProgramNode, scope: Scope = None): for item in node.declarations: self.visit(item, scope.create_child()) - for i, (k, v) in enumerate(self.graph.dependencies.items()): - print(f'{i} : {k} -> {v}') - print() self.graph.update_dependencies(default_type=self.context.get_type('Object')) InferenceTypeSubstitute(self.context, self.errors).visit(node, scope) @@ -307,21 +300,6 @@ def visit(self, node: ast.LetNode, scope: Scope): return self.visit(node.expr, scope.create_child()) - # @visitor.when(ast.VarDeclarationNode) - # def visit(self, node: ast.VarDeclarationNode, scope: Scope): - # try: - # # Define and get the var_info - # var_info = scope.define_variable(node.id, self.context.get_type(node.type)) - # except SemanticError: - # var_info = scope.define_variable(node.id, ErrorType()) - # var_info_node = self.variables[var_info] = VariableInfoNode(var_info.name, var_info) - # - # expr_node = self.visit(node.expr, scope.create_child()) if node.expr is not None else None - # - # if var_info.type.name == 'AUTO_TYPE': - # # Create an edge only if is AutoType - # self.graph.add_edge(expr_node, var_info_node) - @visitor.when(ast.AssignNode) def visit(self, node: ast.AssignNode, scope: Scope): var_info = scope.find_variable(node.id) diff --git a/semantics/utils/astnodes.py b/semantics/utils/astnodes.py index c0ccbd43e..15a5be0de 100755 --- a/semantics/utils/astnodes.py +++ b/semantics/utils/astnodes.py @@ -71,13 +71,6 @@ def __init__(self, idx, typex, expr): self.expr: ExprNode = expr -class VarDeclarationNode(ExprNode): - def __init__(self, idx, typex, expr=None): - self.id: str = idx - self.type: str = typex - self.expr: ExprNode = expr - - class AssignNode(ExprNode): def __init__(self, idx, expr): self.id: str = idx From d7c99b4edd1dbb78cde3b6d029646594b049b038 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Sun, 24 May 2020 07:02:09 -0400 Subject: [PATCH 055/143] case expressions working --- grammar.py | 6 +++--- main.py | 2 +- semantics/formatter.py | 22 ++++++++++------------ semantics/progam_executor.py | 25 +++++++++++++++++++++---- semantics/type_checker.py | 25 +++++++++++++------------ semantics/type_inference.py | 26 +++++++------------------- semantics/utils/astnodes.py | 12 ++++++------ 7 files changed, 61 insertions(+), 57 deletions(-) diff --git a/grammar.py b/grammar.py index 762d74b82..8d3e1c1be 100755 --- a/grammar.py +++ b/grammar.py @@ -191,8 +191,8 @@ def lexical_error(lexer): declaration_list %= 'id : type , declaration-list', lambda s: [(s[1], s[3], None)] + s[5] declaration_list %= 'id : type <- expr , declaration-list', lambda s: [(s[1], s[3], s[5])] + s[7] -case_list %= 'id : type => expr ;', lambda s: [ast.CaseNode(s[1], s[3], s[5])] -case_list %= 'id : type => expr ; case-list', lambda s: [ast.CaseNode(s[1], s[3], s[5])] + s[7] +case_list %= 'id : type => expr ;', lambda s: [(s[1], s[3], s[5])] +case_list %= 'id : type => expr ; case-list', lambda s: [(s[1], s[3], s[5])] + s[7] function_call %= 'id ( expr-list )', lambda s: ast.MethodCallNode(s[1], s[3]) function_call %= 'atom . id ( expr-list )', lambda s: ast.MethodCallNode(s[3], s[5], s[1]) @@ -224,7 +224,7 @@ def attribute_error(s): @G.production("case-list -> id : type => expr error") def case_list_error(s): s.error(f"{s[5].line, s[5].column} - SyntacticError: Expected ';' instead of '{s[5].lex}'") - return [ast.CaseNode(s[1], s[3], s[5])] + return [(s[1], s[3], s[5])] if __name__ == '__main__': diff --git a/main.py b/main.py index fdb545afb..e8adb28ad 100755 --- a/main.py +++ b/main.py @@ -103,7 +103,7 @@ class C inherits A { } class Main inherits IO { main () : Object { - let a: A <- new C in + let a: A <- new B in case a of x: C => out_string("Is type C.\n"); x: B => out_string("Is type B.\n"); diff --git a/semantics/formatter.py b/semantics/formatter.py index 5cc13673d..f7c7112a0 100644 --- a/semantics/formatter.py +++ b/semantics/formatter.py @@ -70,16 +70,15 @@ def visit(self, node: ast.WhileNode, tabs: int = 0): @visitor.when(ast.SwitchCaseNode) def visit(self, node: ast.SwitchCaseNode, tabs: int = 0): + cases = [] + for _id, _type, _expr in node.cases: + expr = self.visit(_expr, tabs + 2) + cases.append('\t' * (tabs + 1) + f'{_id} : {_type} =>\n{expr};') expr = self.visit(node.expr) - cases = '\n'.join(self.visit(case, tabs + 1) for case in node.cases) + cases = '\n'.join(cases) return '\t' * tabs + f'case {expr} of \n{cases}\n' + '\t' * tabs + 'esac' - @visitor.when(ast.CaseNode) - def visit(self, node: ast.CaseNode, tabs: int = 0): - expr = self.visit(node.expr, tabs + 1) - return '\t' * tabs + f'{node.id} : {node.type} =>\n{expr};' - @visitor.when(ast.MethodCallNode) def visit(self, node: ast.MethodCallNode, tabs: int = 0): obj = f'{self.visit(node.obj, 0)}.' if node.obj is not None else '' @@ -182,19 +181,18 @@ def visit(self, node: ast.WhileNode, tabs: int = 0): @visitor.when(ast.SwitchCaseNode) def visit(self, node: ast.SwitchCaseNode, tabs: int = 0): + cases = [] + for _id, _type, _expr in node.cases: + expr = self.visit(_expr, tabs + 3) + cases.append('\t' * tabs + f'\\__CaseNode: {_id} : {_type} =>\n{expr}') expr = self.visit(node.expr, tabs + 2) - cases = '\n'.join(self.visit(case, tabs + 3) for case in node.cases) + cases = '\n'.join(cases) return '\n'.join([ '\t' * tabs + f'\\__SwitchCaseNode: case of [ ... ] esac', '\t' * (tabs + 1) + f'\\__case \n{expr} of', ]) + '\n' + cases - @visitor.when(ast.CaseNode) - def visit(self, node: ast.CaseNode, tabs: int = 0): - expr = self.visit(node.expr, tabs + 1) - return '\t' * tabs + f'\\__CaseNode: {node.id} : {node.type} =>\n{expr}' - @visitor.when(ast.MethodCallNode) def visit(self, node: ast.MethodCallNode, tabs: int = 0): obj = self.visit(node.obj, tabs + 1) diff --git a/semantics/progam_executor.py b/semantics/progam_executor.py index 939190b65..fb9b2d9a0 100644 --- a/semantics/progam_executor.py +++ b/semantics/progam_executor.py @@ -173,11 +173,28 @@ def visit(self, node: ast.WhileNode, scope: Scope): @visitor.when(ast.SwitchCaseNode) def visit(self, node: ast.SwitchCaseNode, scope: Scope): - pass + instance = self.visit(node.expr, scope) - @visitor.when(ast.CaseNode) - def visit(self, node: ast.CaseNode, scope: Scope): - pass + if isinstance(instance, VoidInstance): + # RuntimeError + pass + + types = [(i, self.context.get_type(t)) for i, (_, t, _) in enumerate(node.cases) + if instance.type.conforms_to(self.context.get_type(t))] + + if not types: + # Runtime Error + pass + + (index, most_conformable_type), *types = types + for i, t in types: + if t.conforms_to(most_conformable_type): + index, most_conformable_type = i, t + + child_scope = scope.create_child() + name, typex, expr = node.cases[index] + child_scope.define_variable(name, self.context.get_type(typex)).instance = instance + return self.visit(expr, child_scope) @visitor.when(ast.MethodCallNode) def visit(self, node: ast.MethodCallNode, scope: Scope): diff --git a/semantics/type_checker.py b/semantics/type_checker.py index 048ad6e2b..a33d661fe 100644 --- a/semantics/type_checker.py +++ b/semantics/type_checker.py @@ -151,20 +151,21 @@ def visit(self, node: ast.WhileNode, scope: Scope): @visitor.when(ast.SwitchCaseNode) def visit(self, node: ast.SwitchCaseNode, scope: Scope): self.visit(node.expr, scope) - return Type.multi_join([self.visit(case, scope.create_child()) for case in node.cases]) + types = [] + for _id, _type, _expr in node.cases: + new_scope = scope.create_child() + try: + if _type != 'SELF_TYPE': + new_scope.define_variable(_id, self.context.get_type(_type)) + else: + self.errors.append(err.INVALID_CASE_TYPE % _type) + except SemanticError as e: + new_scope.define_variable(_id, ErrorType()) + self.errors.append(e.text) - @visitor.when(ast.CaseNode) - def visit(self, node: ast.CaseNode, scope: Scope): - try: - if node.type != 'SELF_TYPE': - scope.define_variable(node.id, self.context.get_type(node.type)) - else: - self.errors.append(err.INVALID_CASE_TYPE % node.type) - except SemanticError as e: - scope.define_variable(node.id, ErrorType()) - self.errors.append(e.text) + types.append(self.visit(_expr, new_scope)) - return self.visit(node.expr, scope) + return Type.multi_join(types) @visitor.when(ast.MethodCallNode) def visit(self, node: ast.MethodCallNode, scope: Scope): diff --git a/semantics/type_inference.py b/semantics/type_inference.py index 425b7aae5..d6c09391c 100644 --- a/semantics/type_inference.py +++ b/semantics/type_inference.py @@ -345,16 +345,13 @@ def visit(self, node: ast.WhileNode, scope: Scope): @visitor.when(ast.SwitchCaseNode) def visit(self, node: ast.SwitchCaseNode, scope: Scope): self.visit(node.expr, scope) - for case in node.cases: - self.visit(case, scope.create_child()) + for _id, _type, _expr in node.cases: + new_scope = scope.create_child() + var_info = new_scope.define_variable(_id, self.context.get_type(_type)) + self.variables[var_info] = VariableInfoNode(var_info.type, var_info) + self.visit(_expr, new_scope) return AtomNode(self.context.get_type('Object')) # For now - @visitor.when(ast.CaseNode) - def visit(self, node: ast.CaseNode, scope: Scope): - var_info = scope.define_variable(node.id, self.context.get_type(node.type)) - self.variables[var_info] = VariableInfoNode(var_info.type, var_info) - return self.visit(node.expr, scope) - @visitor.when(ast.MethodCallNode) def visit(self, node: ast.MethodCallNode, scope: Scope): if node.obj is None: @@ -585,17 +582,8 @@ def visit(self, node: ast.WhileNode, scope: Scope): @visitor.when(ast.SwitchCaseNode) def visit(self, node: ast.SwitchCaseNode, scope: Scope): self.visit(node.expr, scope) - for i, case in enumerate(node.cases): - self.visit(case, scope.children[i]) - - @visitor.when(ast.CaseNode) - def visit(self, node: ast.CaseNode, scope: Scope): - var_info = scope.find_variable(node.id) - if node.type == 'AUTO_TYPE': - if var_info.type == self.context.get_type('AUTO_TYPE'): - self.errors.append(err.INFERENCE_ERROR_VARIABLE % node.id) - node.type = var_info.type.name - self.visit(node.expr, scope) + for i, (_id, _type, _expr) in enumerate(node.cases): + self.visit(_expr, scope.children[i]) @visitor.when(ast.MethodCallNode) def visit(self, node: ast.MethodCallNode, scope: Scope): diff --git a/semantics/utils/astnodes.py b/semantics/utils/astnodes.py index 15a5be0de..539666efa 100755 --- a/semantics/utils/astnodes.py +++ b/semantics/utils/astnodes.py @@ -61,14 +61,14 @@ def __init__(self, declarations, expr): class SwitchCaseNode(ExprNode): def __init__(self, expr, cases): self.expr: ExprNode = expr - self.cases: List[CaseNode] = cases + self.cases: List[Tuple[str, str, ExprNode]] = cases -class CaseNode(ExprNode): - def __init__(self, idx, typex, expr): - self.id: str = idx - self.type: str = typex - self.expr: ExprNode = expr +# class CaseNode(ExprNode): +# def __init__(self, idx, typex, expr): +# self.id: str = idx +# self.type: str = typex +# self.expr: ExprNode = expr class AssignNode(ExprNode): From 6a7229732ee3c88177d934e21c5a24ff56faac2b Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Sun, 24 May 2020 10:17:47 -0400 Subject: [PATCH 056/143] Fixed scoping bugs --- main.py | 6 ++++-- semantics/progam_executor.py | 5 ++++- semantics/type_inference.py | 13 ++++++++----- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/main.py b/main.py index e8adb28ad..028ffdd40 100755 --- a/main.py +++ b/main.py @@ -102,11 +102,13 @@ class B inherits A { } class C inherits A { } class Main inherits IO { + number: Int <- 5; + main () : Object { - let a: A <- new B in + let a: A <- new C in case a of - x: C => out_string("Is type C.\n"); x: B => out_string("Is type B.\n"); + x: C => out_string("Is type C.\n"); esac }; diff --git a/semantics/progam_executor.py b/semantics/progam_executor.py index fb9b2d9a0..1e3cc521d 100644 --- a/semantics/progam_executor.py +++ b/semantics/progam_executor.py @@ -258,8 +258,11 @@ def visit(self, node: ast.InstantiateNode, scope: Scope): instance = Instance(self.context.get_type(node.lex), default) self.call_stack.append(self.current_instance) self.current_instance = instance + fake_scope = Scope() for attribute, _ in instance.type.all_attributes(): - instance.set_attribute_instance(attribute.name, self.visit(attribute.expr, Scope())) + attr_instance = self.visit(attribute.expr, fake_scope) + fake_scope.define_variable(attribute.name, attribute.type).instance = attr_instance + attr_instance.set_attribute_instance(attribute.name, attr_instance) self.current_instance = self.call_stack.pop() return instance diff --git a/semantics/type_inference.py b/semantics/type_inference.py index d6c09391c..988356e3a 100644 --- a/semantics/type_inference.py +++ b/semantics/type_inference.py @@ -292,8 +292,8 @@ def visit(self, node: ast.LetNode, scope: Scope): expr_node = self.visit(_expr, scope.create_child()) if _expr is not None else None if var_info.type.name == 'AUTO_TYPE': + # Create an edge or add an new node only if it is AutoType if expr_node is not None: - # Create an edge only if is AutoType self.graph.add_edge(expr_node, var_info_node) else: self.graph.add_node(var_info_node) @@ -490,11 +490,16 @@ def visit(self, node: ast.ClassDeclarationNode, scope: Scope): attrs = [feature for feature in node.features if isinstance(feature, ast.AttrDeclarationNode)] methods = [feature for feature in node.features if isinstance(feature, ast.MethodDeclarationNode)] + i = 0 for attr in attrs: + if attr.expr is not None: + attr.index = i + i += 1 self.visit(attr, scope) - for i, method in enumerate(methods): + for method in methods: self.visit(method, scope.children[i]) + i += 1 @visitor.when(ast.AttrDeclarationNode) def visit(self, node: ast.AttrDeclarationNode, scope: Scope): @@ -502,13 +507,12 @@ def visit(self, node: ast.AttrDeclarationNode, scope: Scope): var_info = scope.find_variable(node.id) if node.expr is not None: - self.visit(node.expr, scope.children[0]) + self.visit(node.expr, scope.children[node.index]) if attr_type == self.context.get_type('AUTO_TYPE'): if var_info.type == self.context.get_type('AUTO_TYPE'): self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % node.id) node.type = var_info.type.name - self.current_type.get_attribute(node.id).type = var_info.type @visitor.when(ast.MethodDeclarationNode) def visit(self, node: ast.MethodDeclarationNode, scope: Scope): @@ -520,7 +524,6 @@ def visit(self, node: ast.MethodDeclarationNode, scope: Scope): if variable_info.type == self.context.get_type('AUTO_TYPE'): self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % name) node.params[i] = (name, variable_info.type.name) - self.current_method.param_types[i] = variable_info.type self.visit(node.body, scope) From 648ac564861d0ffe7142d8cd62dc8545acdf24de Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Mon, 25 May 2020 03:40:30 -0400 Subject: [PATCH 057/143] Renamed cmp library to pyjapt --- cmp/__pycache__/__init__.cpython-36.pyc | Bin 145 -> 0 bytes cmp/__pycache__/__init__.cpython-37.pyc | Bin 149 -> 0 bytes cmp/__pycache__/automata.cpython-36.pyc | Bin 7850 -> 0 bytes cmp/__pycache__/automata.cpython-37.pyc | Bin 5391 -> 0 bytes cmp/__pycache__/pycompiler.cpython-36.pyc | Bin 16363 -> 0 bytes cmp/__pycache__/pycompiler.cpython-37.pyc | Bin 21835 -> 0 bytes cmp/__pycache__/utils.cpython-36.pyc | Bin 9536 -> 0 bytes cmp/__pycache__/utils.cpython-37.pyc | Bin 6094 -> 0 bytes cool.sh | 9 + docs/Informe.md | 185 ++- grammar.py | 8 +- lexer.py | 2 +- main.py | 17 +- parser.py | 1356 ++++++++++----------- {cmp => pyjapt}/__init__.py | 0 {cmp => pyjapt}/automata.py | 0 cmp/pycompiler.py => pyjapt/grammar.py | 0 {cmp => pyjapt}/lexing.py | 0 {cmp => pyjapt}/parsing.py | 6 +- {cmp => pyjapt}/serialization.py | 4 +- {cmp => pyjapt}/utils.py | 0 semantics/type_inference.py | 15 +- semantics/utils/scope.py | 3 + tester.py | 4 +- 24 files changed, 884 insertions(+), 725 deletions(-) delete mode 100755 cmp/__pycache__/__init__.cpython-36.pyc delete mode 100755 cmp/__pycache__/__init__.cpython-37.pyc delete mode 100755 cmp/__pycache__/automata.cpython-36.pyc delete mode 100755 cmp/__pycache__/automata.cpython-37.pyc delete mode 100755 cmp/__pycache__/pycompiler.cpython-36.pyc delete mode 100755 cmp/__pycache__/pycompiler.cpython-37.pyc delete mode 100755 cmp/__pycache__/utils.cpython-36.pyc delete mode 100755 cmp/__pycache__/utils.cpython-37.pyc create mode 100755 cool.sh rename {cmp => pyjapt}/__init__.py (100%) rename {cmp => pyjapt}/automata.py (100%) rename cmp/pycompiler.py => pyjapt/grammar.py (100%) rename {cmp => pyjapt}/lexing.py (100%) rename {cmp => pyjapt}/parsing.py (99%) rename {cmp => pyjapt}/serialization.py (97%) rename {cmp => pyjapt}/utils.py (100%) diff --git a/cmp/__pycache__/__init__.cpython-36.pyc b/cmp/__pycache__/__init__.cpython-36.pyc deleted file mode 100755 index 298b492880ca16a58b13cecf8758cd70e29e0dd6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 145 zcmXr!<>gvrb}p6y2p)q77+?f49Dul(1xTbY1T$zd`mJOr0tq9CUv~N#`MIh3**U3Y zsYUt$MfsJf$tC&4`T>tjYlLd diff --git a/cmp/__pycache__/__init__.cpython-37.pyc b/cmp/__pycache__/__init__.cpython-37.pyc deleted file mode 100755 index 6376b86b689ed7af1d5b227d6d75f1f98856b7ff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 149 zcmZ?b<>g`kf<>K!yVl7qb9~6oz01O-8?!3`HPe1o6vGKO;XkRX;l? zwJfzrKcFbTGBvp*zgRz@vLquvPv5;LF*i4{NWn2LF{iQ$s3JMHKtDb{GcU6wK3=b& V@)n0pZhlH>PO2Tq+|NMF005cdB)tFt diff --git a/cmp/__pycache__/automata.cpython-36.pyc b/cmp/__pycache__/automata.cpython-36.pyc deleted file mode 100755 index 420458d5d256d1e09acbfedbc7760e0dcc9bcbaa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7850 zcmbtZ%a0sK8Sm=u>FJ%F9dFhf$KE)OV-hD5f^9+`CNd@=Pe@o0MsXNoO~zBbyE8kl zt?qSpmL5P^BX1-Ui3kb7fde-#+&Ca1gg799Q2v0r!X+Fz=0N!Us-}BqCleFIjJmp} zo?m^B-}luwUszZu{pyMLul@eGD_dsx98S`^kw0uQ*&h?i+FodTyd)52Ux*bZL-WhJ}OV+iT{Nnaxjy##CR=# z&65Qg+!R>h2{|WAsQGeUma%3*F31YrfjlA?@h-|c$p5|(?PwA`ii{U)EAV`4Gx9TdFUkAm z19%^mXXS%L1Nh+DX7I*v04?{ixY*H*!i`i3h4dt^7)N^ zH#)!BiEc#d{5Ms97&ViAeEyrmWTW3Z|DtMiyA5^vnO>ta+{K7ycW}P3o%Fknq;YOA z)ZwL0qkCO8E*H5W9%r{=NII8w=%CqB%}&(he*EyAlXw9?Qjt1!Cv{PZ7Rar;iMPkM zFIg5+4`q=0D2vjuM+tQy=E-$otp(cje4-k?xRtc}y%?vA5`8op#H~)hS3lH~G}iUp zT3>RohH5c!_MDN|E2n7L4Ae;;H1*nG&7KfoL)!&|#GWgh zopbo*wf#NkIp^Bxk-xK&`lv093TdHT05jdx+w+98_0m;m>+)4+=Oo4lGe@+qVr9$F zqAG(L?KPy-^YuD72o9-wUCpyOxY6irN3mW&dp&2LT0mblPGcL|H6~k~oIYL@9YecM$qI=A~nZz999v`>2hcPWS znhzQ7p0r$?Jv1ka!}%C)K8*^=8o4`XQvnq|H3AlZNN)|C{iXXZdhi>j!P-{&s*}K3 zNcSettZ&>v+B~DbUx2^*-DYkktr6O|&l#oiR9RW;gQB>UBBU9AoOuD@b zQB?P;P?XUWTNEMj32ueQ$t6mV$RY2a_+cfQhy-%m6Vnod0(y`#>}2Gp9!lUp%3$X= zX`ud*1_ZuQQF_vcl#A^G^ew>ETkDH@8tRAFu&=2$(4Jo0en3jyLxT(KcRDYb< zyD+IOX7BmbZ->@y0jOa*Zww;HYP}`&&#`}0P77)Igfp7QUZr#nBLUA_HNfsg0ILTR z3jPn>Q}=;a>I{p+f>kv3i+D1{t6EVe{kn|c)w*y{0Nv&c{mX?+DN=-2xC}vN17f+h zY;6II3}IOAd)`)M%fDjxhs@~;089sT8FV^K9Bcy^-RySo{qH1ZvvLyu zXJefp>@ZD+VJ~LX_)c|R-H%_2JLp2PJ?KR0LDs!Ne_#Rb0rsC|amoy8^<=c8?nS-2 zV3C;-f-Yu8%xFXmiI})N#r+kq639EW%+fiIN+NQ?PJ2Py7zuWq0@3Y~{$!lSWH+Q6u7g6zk60&dwu@ z8`}U-1G+9vl>u5CvB{o0^7frJjFX13wTKAgB6ZDoXWv=|IQ;BS z++0l!2jQ!zq*_R5EhS<3N)-CAbg2XDFbeuQR~swn7`)e1zgzFEH70B)A6`Y!i70bD zvP*JeEimC{Y_-JeHU_$YxThN{2Da5=&BI!?(mJ9hC`f_`O7yHU1bx+7Z}lv2uVAnx zd`vDW)nP`AF;coK$Mpf;gzw`J`3injL>6#ngAdscg-QX(ODHD90I^Q{#tab*i>YB7 zWbtW>2>TeW{1ogy!KgDshn1Y|;PXA0lc9qNq|dNHOt>bVN_`fE#FH`ptkus$PH=+z z87yRSHIS2wG+W-ROq;!)t?am2$arYwCi=~XGpJDp7S>Q1#|=0hkX=X*F~@4^!VF*p zo1S{Z)<&+qoH820I1h1&XH3N3IS#)-bE&{%3B)7?V;&5`FX35+N8mMV$|I2LM!bx` z497!q{Jq%>m4E>}qVis@d@;|0GIa$Wm3|XIGXNr=xCT4)wNaIPg zbtlMr^iz{{U~r!HI#F*T1`Vv~oyWRbbhMXr2WIoyLUvqZX4ABs#dyltn1SO~jNybZ z9$qqziQQATr!8j<`9!mSmTNJd0#@P4@7Km-Kqq;fnWljrC+5Qipq+Ql+;jF;yqejq z2+3J!ZtkeGwAnjqzt`wSZ=yfjvShbpa}NJh!2C#*quB?TI&u?pdy!((jaL%)E&P)1 z30@4m)ep!C#R3-3us~f#p)1eCainw2q3wH^8&hc<6P)hO zSvt{^lSvY}kKsHoSt&fqrmHF>_lh%QkO#XVdA^glnKz2e+_^GvfWipav6`> zyH@yeG_-`;tKkGx<$BD^FbE;2*XuvT)R@BHH8sFZt3&|4!;(8O?$F(k95!S#k{FY{ zNM~AidL`pjLHMPNMD+qj!GGmcPBKy5h0bXX+S|G%kp6qjN!+8|1JVGacEoH23o-9d zrYH;ZXJ|50ASxOlH}EcZGwPgsp{#56HZ++mu*kHS>@m3Z30ho4GJ=VSpG<7Fka67f zeCoZlk1PDf?KZ>FIHX?x>BMg1gjUw|vF(~1O9x9`+;g6XC||;DGQUgepl;G3pKw5C zln}Mo>pz>dr|rt^fG&%V+4C*#iJWJiKN2Q?B=Y=`fK33Mc%SF}cIN^pblXU-!A+fk zgFDGpJCQo4D;7*XHR#{My$G28> zf(<6vxtld(WVxl8;lDt8%#6@vA}DZ~2s+LrLU}BC!_Y&LpbAr$V*0`aXh4T9y?5NV z5mUC|$lJIwG9N69_=fKo_nhD|`L=h zjr{RDzU_kwFRW_!m2a*8;^+MQ?#orTRz!%nDO*YhNSrdlV-QzLDf-BYz0;CNBGvIU8llC}H2jW%dvI%o1kQB6Uhh zQfm7G7hy!!>Io@&fNt=@(7p2#TEq67(SoNCt0SI=W-yF-XyotXiab7f32V)#0tSl~ zfIqlrS1?!HR}l9$(IM$dKaWd>g9}rXkf^4rX z81_g6?TubD+Gf}LzpXB4w5wTUW)^i}FqHj7`>RYdK9enKGrGo0J%u(qK9cK^ z_Mb;-HMC&lq`j7mYd%xPMo+cJT%51Pi#F|2FnVY8_&{+RSoJq}CKR_M&LRzmE10++ zY8#5(6|1=GsxjC&2*J#9I*`DeNRAJzUd2+?P}T6NdC&C|^&QmIcUjQ)C|+CCH5RX- zm_!xW*&A#(s7s&NH{1JAXBo8!_#C{DV&^AqIdsz?7$)q56C%=l%v z1c3wM5QV^`B$Vz7VCCR%oXpMo+sWERI4+`8t<+Qzu0Hkn2GUg$$uSvC(ri({kXW*Q z1q17UPJX%(59F{I4Bseq@X1iU7b@b>|u zp(!NNp&gg>|BNwH9xm&`3Jk#TugVMjZ{;N2BG;V$wwcY609z`!< z65i&vWbz5>G}|6#@i+=yhMpsN(~a;4j8tD@`vWY_vNIg0{s0ly&?Yd9ia*cZmsot2 z#n)K8%;M`TzQMu(F*%^tSP&s6j(niVz6SG3GTq+$2y|5ViVYqmYE6SC!UtYlD zhlMZ<1N50MM%@(#CY^FfcRZ|Ogu=V4M3UA1F_)S*HuGgkRawu>Xw7V7zdXh36Z5wE*AoPif&tCfpuJ zufeM7O|DI5F%mG$GNGk&?O4Vv%yv0@f@$8Wx{Bc+{QIMiKEl~1*r)nvpE{@E-uqnM z?z4Nkqb}T*Z)SC+Fa?G`z)R14dpL+pe4Ry;vlzN?XyLzc%gpYVfl(^qioQWZqhW@_ grgehkT!rz6q&2Oga4SD>o(sMI00Y4~4*&oF diff --git a/cmp/__pycache__/automata.cpython-37.pyc b/cmp/__pycache__/automata.cpython-37.pyc deleted file mode 100755 index 1f8f63a71a8b4aadc785e1ec25c0a70e69cf8e6a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5391 zcmbtY&2Jn@6|buPnD%%)nK+JPJ5JV{-3^%#>=3>JvO+eS>;{3X2m{WJHZ+r|wmtDo z&$zlBJXQ}#YfA(UNN`>un;Q~;0(bt0J|Q6??TvG|@OxF$?HSuyK=im@S9Mj_`})0C zul!(QqR4RV{OgZD{cDA>zf&i>EHv)pj_!a+CV7jsd5yP4O|-3=)wXMP+o?Hix8`#8 z5tBk%2TWS~qE?XhDyur5<2zP$Q|tY(m)Z}TjX1SdgE+N+(2U~L`O!|d6{OCO!)7OJ z(A4Z2L*qW~=${|~t8vL{LVhK%0$YmDz((2!U@RT!9#woVAnkKil1>g zE=%Z*VRQn$vOI@g5n~nf&dW*k#)Fbv4D4V+vY?FnoMf|XU6@;5z=~7y;(@czYZc6# zmX{6~+UL=pk+Zrz8C;Na^0IDE$$5DN@?4ZxWkTw2B}FGJ#&@m8&dfN+j5O! zT#e&hRj6}#q;Aw}Kku}(h=!b}*X7N6G^ASz?;^cE-6xOF5(r={>Ne;8VQJCv&AnCsw)9XV|cWC#?_pl(c~+oHWU# z6lww^sfDEmHa1Y8`9lVtCRV3GG>uu24Z?Vd@68)ipFOq8;k;Ni!;ReY^da3^!24*B zfPJxhJ>d`8v#WgzeV$nBF#aFJZ!vb{y#-o{mbKa5HKVEu z8l8=>xfd)hw>ph_E4sIsPp{hPxy)jXRwvp~K|0ayybS#3JwMXHKXYRIc*LrQy{c`1 zG6$AqJEV)qpyq^g#&R)eY94n*Ug2f2ckYC!=FUxqk4+QrA5i-~pU4KQq@Rn%y9vQ{{W@i7|jk0*9A zKFj*W#62t~G*iIuPuJM?H`f3fz{UMP;G!6P#VP_n$?~zRE@XpW|ytuu++`!M>JBW3%eGx{98nT%0;Fl@jW0YFph- z*JP)+XncXlMH+CLp$vA_CA6z0vr!bXkfVK8#WioxkJL5#qChzrxkxXU7R;_IN|yl{u}PbSEtv(M*O7Z(ita57groQAElv3Xjk8B7PDX03S@)*n(f|-DPR$pI%^69E&bRFYs*EbTCdolomdnm z+m$u8dlw_lp?kzI`{pO&6VbQ(PTzgS5*xu{|B9`1omaiYrO-tXIm>MO9zuqzUtku3 zb(XzCF|`V6dZ#llftTQ?Gw%k07r7VHv6uc%_!a+J3lRABv=WdeuuER6!eoS<=IYHCNYKk-?1Bu6F^PIA}-eCPu4; znuWF0651&b4KUn}YHl<`opsZa3=p?rUDs7v&}o5n4dP|ud>1Qdy_v9)f+-2l00(pE zmGd$vn>-Rvl!FyWp*aPZ4bf4hPOn=>gc4QwLvVWE)GSBMOa;Ij?lf4wh@JhBa z6MGlVSh<05ebMej>VAYf`WXm89{UQQih^M!5iu0s=UbMlnO0wzLkpD>m}jA=uylCX zyEBRX0wu$q76H>T0y9*H#LJUP5|1@RkYPN^myFvY8h%1+42z;5yrbZ zpJ_)dVDb-fYt%8}X`Fh%DsmN{=6hGaSj5~yWG;f`2eg(hYF4B+@{mq0eFB2m2Q0QkG#86c(UUm#>EQXCB-CC7 z@M*VH-v&v`??+LfD5_7@=c$X$1IhS=xT%GA4SX9BE*T6};d^67WEvsS=%OcO9xWyv zwG%CvDwDXYtXISn_#yEIr;1zVR6(`rQ>H6av651pQk8CGrkXn|)sKTUcV{~8`;dVW zo9}O8ZbV>VNI)(ZkQ6ECypeQh-pCn$%*&Z{iqakA$psuf z-=xmVdTZw-;z&d!3L|0{pAXFFVP8BJE}t<1u-xlpSCa$=@WM$qR%gSD4yG#TD&K!e z+_Zc0Oq>m!&4zHCZLfxrP-GmvKfHlk0qVtI)*E6rk=b02{MWov8wc0TFJcDOXo~MA zL)`MSwi!Cbu0eBYlSvSwN9+-t`51?y{795e_*z~Vtcialyg^So?jxP}{x8pBZH89z zV4#wKQn=>*De=ZXf3`eTiP=6%|FD$c&6ca?NeU!p9IMSim5yt>w-GAh(9%`QHKhD` zI`yF$` zTLe;l3nQr=cH~K5*Wh_QiPVcIP$}-{XQSwIMFsIULnq}N4FmIjSmpRzsa_$ZhV^#f z`)Sel+a0;nqISvmw|D9-GolE;sr?-Pfl=f`y_FkKQU$DLiM&H(5hN`|Nczo2JHY>K zq@wadQPxuA3w4(W?Zi4cr(Rcey2yn+Q-R;3f%`-r5P3-C5fR#k)%S>KE9vBOO!Tfo z@kuU^u7h}dvfx>jLfI~Rv*u5%Q*YTA?jGfP9qkL&zX5y`Q;Prq diff --git a/cmp/__pycache__/pycompiler.cpython-36.pyc b/cmp/__pycache__/pycompiler.cpython-36.pyc deleted file mode 100755 index b84e01d1023193a6ee2b5bba0bc13d3a69536fa4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16363 zcmc&*eQaD;R)1eJ^JYADCbnZIX_^jgvaLhv^t;ezL)tWHvs=8S3GJ@g?sVe!oOm*x zncVl>jYngU>MZT@$Fd+H@v*GLN(iwM64Jsy2<;!N5Fl2SkdTlbAR&-IMFJrKLKLCp z_dEC9H*f5*lM1nn{qFm|=iGD8`Q3BwJ@3iM$;vmL`QWYR9Odk5PE zY*7uxz#do)Yv7;+O}t|-EjWp{)Lajf(#xv3zTQ*|ZsJ8@do}Soa{0Qx{F|2YQNu^) z&)n#)hi7iK!*@b;<~7yb3|HcAbmq0q_(r#LCat9YLZ{i@?Bj`*_1>A@=1O)l|Z&EsmLaciU5)^`-uQcbX!WHHTR7DeLsRJRwZcvDeiYM#YV zq;fg@jc(gU(qjBJ-N4n%h`_)@;8D}?^&z1;FLeasj#4t3V2k+v7i-> zOE?z9!m8LLZ?4Zc=z&!#}nzf#_w$l5Kw!;$KK8er=$ErI!pHB#Wx@yV zq6Bn&$w9sDmecX$N>Je2WBEi)>fhKFm^66ZcJ^q`#J2NQTb;UnVqm{yy>)EMmG-+k zpZ}_TtN5mtLNy0sr6n~75q?OyDw@v5WfU)k*TQ-bu3}VBQCQ#TG*8zz>ruDe)yFEl z-fq@=T~%Lc2F-f(o!{ap*TpM!UYGt~S^LhnI*EYwWDa;L7@$(^Q0&BH>IHz`@M2Pk zH+tKI-^5=CvugSCyxx9naaNrc&Kq zQEFc(tXz(aJ-$x9QY@Uy8^rLDyVAP49~w?xj&jw$kt25`cYSf>sk>6#uXTcm%Q-rS zM(L!3z(Pe4b<`0SM_CBivY*s_EKaj{lm#I+nM^@tC2Y41un=7^+C0FA1a3L9JcKP` zUA|i__zzb-KrOGYV9S0)J^rHeD2zLphuYB7P9dPQfManC1#Z0|+zQ0{fY@^4oBkY+ zuN*i=@zo%!qwdE&Y5N!`)lC}((YNuu@vROTvP1l&iSx%jH^I-`7`>meh|DP`qmeUN z{U1Xe_f-yd==B_hxg3R@p8W4M@Mez4bdHEozw%i18>4w@5j72QWklc3;MNyNh+PB( zaYfsBb-cDw565YnXp#p_aufIBXD;pX1gWmkP>BNZ|7^r)c*R-z$UXtzZm37v85Qs~ z+>WZyEmkL>WB03|mub&JVXRd4kpLmJYpU}d#q(WlKhFnlpfGK}*T74MUCVwNbd`ex zK}~|MgTXZR6TwU{i+wem3=Rcz5}-{5^AO5mae^}~Vp}Q0m&wQp6fs;@#(o@9G4wJ< zvpK9X{>U63cWI;oRuXX|ZVjxrYFp@r76du4-+-yz%Dg385DQVBv-ntI-yZ6YfYe9j zv)98;c)O?0eUY`XTF>gAF#dYh8H;Dz-IZoLI=7g;0Ei&>@LeMbJEO$A(Tr}G@WX4W z>pO=)ftGhjh#+9uvv&XBE>c-Li5O()0yY6rcslu@Or69H^)!m{UcPw3eZI_E5dGD1 zw8Zt^rQ1U4JRTP3jSkgO=?O$)tMyEmcpMJ1sZ8*BwfUtVE z=tuneExaNvW^h&$=U{~S-60y~Da`*+p80$*3H6HMr>WCq+jx2KQpYoWfJ}>TBkYTV zlbZ6FkWJ!{pUyK~q4(k-s88clDAKN|E$dqX0{hm4+jin2Ox&YW8T|Y#Nu`~dSD-Y? z&JR1ZG!YEpE}-iyDl}^u3!8)6zOAvV@1Bh63*Jz#w1OAF%vx^`b{LTTe2$&Gj(yxY zhP4<`&EEPfGbebY(fEZN!F>B!0bCQ23?AV=6EeLJv>j@2gsp{s+M1S`E?DaX;ZA%= zCK`?FVT^j$8;xJgQJu|oZ1%u-!kiG%gjBwrx=;j;3%?a#*i0bXr>RnVdSkY zl0&w^^x|H_#<$2OyHh42CG73bj7UZg9ZL(Pu|^_<#2`2smXrHX`8kgLI=0j^mPs#H zYbdT}KT3eV=xr26-SctS-KOUE@({y`Kzu~RY*q2DC((~HNhx*zN3@hoaNFC%PD-Jk zx`bqR`Pn7B3Z0NBbSMCd_uH(L9YRMar93ngY8-#ubGv{|oU|0;5<3*p?xAl)r9a>+ zDS-n+0=oynarG-g!+sPv?EhhoLaqs8Mt!oe!lwx~tJX!R=qqSfs;K+Xp(gz?-y9<< zZ8Ucil}v2yM}n~ar#TWiVeR%xM}#%d>k+#0ecUmQ86S+Nu-kQ{wn=w$pw@=J3eVR- z4JD{9q1exmISl<7HY2sEVgK(MsVP{YNBv~%BW|Cwq<#SB(67A*Y#HeOJVz#{1ot>p z?>pnb(ep2|>Ye^U(~4}QUYHt-K{6;)L-oi!9Jj{}&m4ZF2aS#lr;I4(-zNj?K!osm zhCUsiF+%e`)jIpJ@6KZznWg`@0d1JBBLbe%l|=O*>Re&v{BfUk8Y6){mJweKSL3Ac z`r7pyaXNjJOmv2`{fTcz_F?PwOc~+nud(T<(7|Hh%y6=GJVueH3w(wAUpAxgzR@1MW$PTSR{r zy@v(mZATn&9&?g~E;;&g%ZXjgR9M?it6)|I2QDVZibml}Ip342qg^9X)a!(mrdh{{ z;K~?V3n_dNEcxS}+XZaWpC8|3CrDOM$?4xePWqYcj>K^pRdRfH2Q(>1n@H)1 z*H*$>M$jHlFnjXeu;M;2Ah@KKc(jinLbLe~Y!O{T_#q{kAt+P}+Jtd2`_X*QV~g&f zFhNu1f!r_oSvInnBrgluOp=d|O-W4*MB-?7af{;n_tQaz3LS1sK za6F~+tCkPo{^8(=OtRO4AZ8jnlTgK$VWohT_IT#z(}D49Uc zj*4}5NmA%BRY!a|S)qVmg!%KA)>h&@+!MM-ho}o2<1DyG@`t@7?$pwhs|Bf3VKdi5JRalR2G&}WfC#;Jk>Uxr7 z5h48#gDv$43r^6g*IB&Af=sKcC=6T|d4cy6kCNT#MDq0qDJ9NuS&naem}9A6(Y%5^ z7t|~8aEz?-t9xS7c!ip5Bo;l0lh_)Ld61lqloV&%(rYwGk6?tfV^xM#Jc%v0D)T-) zQwVzJstnnMYx)Fsim#0Hy$sn;;p(#n0H^D=_S>iP@<Xp8B?+ke4`00z)^pYdy^7*GGDo_rP^|W5{qcGXyINfE_5A&3 z*d~vc)D;}6Pq4Vm;y4ScR~peKmEJH*WQX7M5FR^ASc7IOymsvl!PGTK=3DNsMot2-LRcV1?L z=m=(Jf;fSrEdxy$nwQFkCoR9x+yWBM16B`C;V zKM%ysJ&y#lfhTKMxSl;<)bG(nZXwA_pFw#_OMUNTbh_TJ!MGpI+VWhbEQwfL@T&By z`Ro0uoQ>f*DBMZ3L1Xd>9*M$Hr4>yKtDJ0b;;wJBMTW~91!FVx>8E$-Ag4<{M{zQO zwE)o`jA|MntxK*O8u6w%yqR55A^Expm+Wj-&}3K_7qvXBYu>D=<2GD99SVQecwA5? zjwOlz>2OoByHeX%GOFz0k1H!(^2h6z?Z7r*^4Z{#TN2AUy@UrThpf}DW0<{tiM%0C z?kqbMxQ0O%*S*_EapvNBZL2WwkTY1oz=Ev7TPKh+XXD%*c!B*jeXaUtn)J@D<=~@J z;Bi*u8I~}-uen>rxYY6oMTvR~lGOc5*bEZy#cr^fF-hUM*ocQR#YFe#t%^<^_&Mhm zl0J+D@UhecmpzWwJ8!)e=IxX~l0QyFtogzk&cq`rB=FkkZGb3*DB|h^Q3vrXvNwu52Kq=&U zW*w)$nrS`ahpPPfw*IR+{iGfJJ<{g7)QP?74ag_#zs~#-vXEa=E#2eVxmqz^=B;Co9e; z?`TjmeK~r;JeYF+O}0-vHJ)7qWW%ztn%F;TTDJR@Y*ZnZu&vV0HV)XrD#G7^t=?w) z(Ah+Av=&jK)8MhoAQxd12ILl^MubdD10uK6D$e5rC4R)S>O2p$?@SG^^PFCtt}~NL z-?{Se)lBMWh|E<8Op`5UlOtin==PJiv{NAd*>-dNTF^ZAZHfU8Sp8F`;X5Uj$7KBy z%&*5vsV6!FV|b!fO{UPOYG$M_tacT?KcSu__LXJl%9WkW)OJ$*-J$MPG0Zc5rNepH znF99q5AVe&QdBPSe|qdpsIVxw_7IsBq!6s5f1tA?WX9t<8LcAj#GJ}{h_93a#V*#3 zm1f609h!_B38GQ>Gvxg!4iH67R%ZN?KY_oJKj#;#hpIFFWOYJMIN*`&N2589Eoz}K zvm)2c*Aw>e>xp~$$_rn7$#-6QeMXWFCxUsIAHnR1o*P-74CbIDhZFBIa&>l1vWjA# z05AEan>hXEYyejz%{zp8qm~^}ErE|JB`$+;7)Ih*t(kgofZcYxH*?|?Nj`=5ze`E7 zG6b`AvYAa;x>mW_axG%!&I3PIMp(bjH{|4`9O=Swwt%gaL5#)Zq3xP8aDb7|Rz^ zKx6<{1R%Zw5OfKM#`C8iz|TAcBp3OCM5{Qg6K~uxZ*(v=n0EtD_$YxYzOUg29rN;; zh>R9KJp4M=nj}b0?8Uxwy8a>CtiQDQ9)5_3#a$OUUFNNmEIx%IDTken^-wk8uxAo9 z6E3ItfW4O3=^#I}3tHF*l&OrSK-(HJS}@OIAGW74uKM;-0Hx ztFeVo6Mqd2QZ#515C4_XAmlKZK1}DDSt)l6D=G>g*z3DgDM55Fgis zZ0kQ}EWnSF#^>*57KW#Wz4Hi8*gII_fe54zELGRXyv~r0cqEu48CcRYqa5zRTxBV| zoldy^^RREGB_~zb8{QvbF6$rqRlAsbL;`H~7CfPO-Y;y^zcEZ=UYHhvn0XAR>K)wD z+B9}uF!9L~nfv#QW0=z%zI@C$=7EsNToY&1{}QUyK7J{!@V`ij&ERTXia_bDkzURKg8t&r z3Qf|BtGg<*zddxUc!7?p`krYXKuO!ZzRm<&(T2O_j1WL_Ih^nEbeqK;7VoimpT!Um z=Lcfp^+$}ZMx@bO2q|bx#~GEq36AQr&g~$UprVU)E=+RPd`vQRy#KJQ`Xb} E1D{fb4*&oF diff --git a/cmp/__pycache__/pycompiler.cpython-37.pyc b/cmp/__pycache__/pycompiler.cpython-37.pyc deleted file mode 100755 index 916e36d4cfeac3d4204c3a2418dadca7523db80a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 21835 zcmcJ1dyE`MdSAchxwEsg%jNPZYD7^YS4S=7v+ge8@pzOdQsP-&5hNj9#@3C7)4j{t zoyW4eS0X3F_xj3ux^Ca{Jsx~h86wXPV^hKMXJ8Jwnu^}exYx~6MA zC^qc(4aaCW=&~JFURAALuca<2HBfC#vHUEgY^8w9Ka3%Hr#GgsB%uGbC*{+X+HgIk0Cnf74NJ=5-Oo!PqE9`v?4T~DoS-Boh{ zNRss(B!*crhx@bRSc!YEoMUhLt)7S8l$*`oz}@chxzcRj-fneui8L3^M%`+A-EOm~ z7SXUI%ck1L=lx7(k(6-x#8AIo#vwwmX2@*+in9y^iFb|R$b&EcHxOoHx&en=3!1UBbL z7{pq=9Ai`((47Qsjgrvu63laa9z4a<~KVCJU5DKwjY zpqkBt2^4c!O-3R`V=xjVlHvkFG4GS#iN4TL-j;e4G|(TbG@C~<;8MitvNmDx$2%uZ z5Ld?o;F*DW-%^VKCT@hM>qcPXZhj}3L?k%X1Fn-rLetwfzv&#=w}f#jRb0T9V*Ne`>$a5kAcmX1x`G#dONUp|Tsfr+ly zZ#I_+Mc~_t z1l9*&r4(NybH{mTyaK}g$hdFav-(xm_`ul6ZRDBf(@p`yg%11xf<{_{k)qz!Es-hr ztY@R%ud^PRVvn{;_pR@l>PApzORl}?_I(MEmD-F9}h9bKeFoib2KAQ|L^^!mNDx^LI{+ z%vX%JkKVJT4YW5t((jqK*WS{&t8k2w2rH~6OdHF;ALm4quSUk(wR;4L&Kxq{gjTt& z%??OkQ|m1&v{qgSO_&xLaZhggq;ziG>w9;$)cG&7JvQzb!)M2d1~x&nxpJ;MXt%ol z`IY1oMgAAl=JWMVonbpKAlcPH^<#MZ6S(58oqrSdom&qevi<<(DW zVR!O0o+1%{vW|);A%0FSSG8>Y0-6lVR}+rY!Zzn`bvuFJEG%5Qdi~1lZ>)w@O7#?m z)*iV)j8q%4F08)f!}KKIiV_hatxj?@jz%{nb!cwM2*<=Kr+{ij5G)gV9&e~t9P_wU zh1KR*Wi!5)C0{XXR?RG$r>vS)H&6%kQW-DUn7!g>nr&ym9m>348L!0=@%N*QPE^o3K8}aA ze;iI^a4nZ7)R_ovbrv70(@eg~Tx_mK<02h z?nkPa9ygPZq8*unt)zW$Lel^U=7?^AFgsh^CgtU?+sNoSVwNkKj^D;(Kw!SjRH|BV)wA^v31S zh=)(i6H{=YE}$FJv2Z``tYHo-fcH7Z{t}w{PTU;E⁢iUtk5+itTFgofr)}wy9mX ztv)tgtlzPs&$&g((VBL!rWY3#*7V|VIk3Y#kva%e6AL`PEFi2_PCM7 zMtokWku@?mKxiX#(#RsmVzOw)gyx-8>}#(8O_&ea5L<+Gbs{!Pk{Oy}TS1)CA`1(? zcr*Oaxz+M-MVz3>J(FN){eOTfay~3VzU~5)V2E;--MPpQrmWi4S5Tl{K{95NrF_Tr z*)Q;8wgQT)Wnk&Gp&90t7i_Ek7~ykT1n31k$oc>_yE-hBfkpe8dBFH6UO8AOc`+{8 zu%i+uV;953&8g#PNvtv<0_pVQ7Rs{F{4TzevD4tH!O*JFmlBzbm>XHmiy=2Q0*Wvh z!QaV_AnSYpnFUpM$OG$O0_~nL6&1%GbNm#F9uibE$60!cyfUOC{&-KOmi{r9i!$M_MI+|4 zC1b~aNdJ?yI<%kh>#&a#GSk$agN@$V+M_#k6Z{UYxI5Xo!gmvnjbzAEs5^8z0kq8C z^irhAT*ffC^`t&2=wer<%=wl7YOKft*yB4!DBPIABW1O*r7_ z`ZG0x^`Q51S9!Oa%|FV(%#tz7#v~T0OjwUT3xbOQT|$03)o>;$Ih)NNWT0ecQkPDL zHp~xx^{Ex;#JC1fd|!_`RNDRvcni_{62J`bi|Aa}$n!waWY( zOvKEi;>i$FDxN7+-p3`%t7sPCBdeCGCGnKeTV_{rX{Cu;$&Vy_0hiC#_tfjM83m0l zUNY!%`ozjwP{#5g<_FQhG~_7iwcbtE4x!WKCQ!NQN0Q5r<=$TE?ccC#Y#ItDVGBA& z6HPisorypqjz^|{7~UFVv*<5~9zU!l^LNOo)(&(Jy;gDO9GTLv3~$4>_6@6RXe7+H zwzj;!8+A0yYwetw0$Ie`FS+i&MfJ!Lw_p}Cnnn7H3S$()a;g332MHG?-Dh9aAfSjypb)eSP4^+t;A~VWxP#Mbe#PnrKvZW&@&s);9i>R z&rm1TT;kps?u(fvnn`Le>=91o76Bxjaf%>?;L}8w*Hoqdnqa8wK>BnI+nPG@BKeWE z`SaJ1WJ&#FGqbd|^)^()iHJRN2S46`^=7mQ3lp^>j^kM{$$og1^!|-rd29FF7|pU< zoE)D#pcmbf3#5Xl+W@X7mq^;(7j4I-(txJne_*2#fz+a2q-+!OE$_U97BkW>G(AD~ z9u!D{^%ofcb18t`nt59L>YMobQ4pR&`Cn!rWQH)s6yZ4AtW5;D<|PpAYZzCw#7xO% zkKvHO{u4i+f-lWW90Py6PaO|mK59G^N&gvF3?hRuF`vhXVhqAan{K-Cy_Kuzl>agv zf>^d=5J++|=Tzic9;}Jcs<%Le)89hTqxhS;>A&NOhg408V3#H*Vg(+Vl&do_NUhb7 zYJ6{PE~@W;W?*E<;8W`HM|zN`PybiayfvJUhmfdoIFOf6A>G!}P8ZSGPq9FR6K7W| zbs}X_VL!s_Kpg)$E@A(oxgfea)!K^XB<$o@z|#d>{!Ju_7+dgc4|`f(-nG_Eudrqv zG7cfgWG` z7KAy~S-%yiZ=rJROaEy+tGAi(ZOX~%2K-;+y;i(do;zUsQZN5w*#cdgzb z3=+j2f`UbVgG-aVHC)WVN=Rl*(I<>n!)K7}w3z{L&02~UMnx=)&VH@_42_{C>PR2< z08gs>Bmr*@7c$_ZE&R_8{Q2{r4mhd(|73uV<9UiurW7OX`czCDINc~5Jnykp@%TZL z!67iIj&B=F4sya=~cq@|Wu+98UEzrv;W=dI(pXn!6n5W(h{^diSyVCB;o zLL$AyRR=%f7a_w$ig^V{v7A@rek~;#q?hwCB$=CsEGtK**$nDdP*P$Yw~SaK`WWdo z{Be}fXIO>&qn|O?s7c+qOkMgN9c;TVxclIwtB@eabx!`FYU&l6%5^=7HHb^|$B zd;qoAIO3jimr;Jyd%}Ir{lWvvU(SnR<~ey~MZsyWX7+ zcA1;92Y`ip-$guISdE)%Qlt3c+*Y!2+jJ2U7|!UXC9{XDqz#PNO2en>F`yXaAADzw z;nBHaEeaV+^u#LE4!v2>MBX|aC*Q)ex{M^zYV<^qfiB|mM@SGO0jJqLc>Vmv0C9la z!xv|ewOR020^5bi`3>me-?U|S-?`_EEH}4VRIdfjPL7MOdzPEO=U{pu5fC4c1NsX) z#ZgX{Wz3<4bBt1RM)n%?=0-{KIZ#ER_16$T<$CnHsJvF-)m!x#f3jna*rs|E3Ri!x z6WpqI0>7?2e+#VNdDp|^`gXUa>I@6;d>{MT<)pIR- zL`2p*F8m3dwT`FKHeW&~VkG!_)GZl_9)N}wcNM{&o1R;5`So|A9{caqL5g~uoj{N2 zRtval)o;N>@f3m(Is?@S?$$f~1X(g*fF-vP`1P{L^vMsD(I! zcLCY=A{ZE)KTrW)-Mp(Y==IkzV-fD6nMwerGsgO^=eOaj==9f9Jlx>i%bbyu>b>n4 zgKOJ;2|Y@yo=q`*wvJWYt`b4o9z|&UY&~wX9t`T5m1PVqr8<}}4g!?P5Z=1GtUI6wEVruE=K0e;b~pb)m9MXnIrCfEgIzu0OFmZ(Z&_U!;OWK znGfM@(&1!c^i1r(@zY&FPCJmV4|naqZJ{bO(iz;;MLuV3C2{RSHOzEX!gXw#Pc_s#iD;XhDd+qREU?c&nGnGvN_Q#L>GS?KQ9i*=LkQW zW`UyD`okVs>P-+u&UK(=R%NA?L$sRd=0rCc8+pX+*`i&jO|*8QjgfDC4FgD|%S$d~ zBBY?^!#d=r_a0G(#YyIbXj|7o+NTq+ z9q5Vo24jFE&MTGD6YaG6_3?$M@WfNO_!y%Z}r0ogVni$FV%h1b)=pqH*1% z^JAiE7B!#05$U@}i>KA$^2Ju4sy4z`Z-CIY08+F*=tC*co{I3cvRu^Exd|FcC76U0 zDIu$yETHI$7ttxj4Om1f)``$?jWnFK<*ty752BJW6N{=cgjE?ri_vFgb9gXI+}TgZ zoJ^!{ieBVNJQdr zDckocUFA$CGyW_x0rtXOa~**fkw40!tNnfWJ|tqKa?cuZ=P=jm0aC(2*Cd7j(k5$7 zxUi>`Hf?(zj=|70Yo#_5#E`3lLw(v2QB-xECQpWcHS?$CXKB#3z*}OA(18Ja43=bM zn4}eH&$NP|)xITSEba_IMn+UBykZk2y3^{5+Q-sdzD5jduYU3zm?n{JiIwEs zf>Fi|P4_N}h2G{_M~F^DP$|OcK;4<3x@TglONWta?c^&!BI$`&L$&aP7Xm_n-Hm~b zK__78OrIe6xlulz8!qeyh|dzcuT2#3#}9J2n3wHSl6wI6EAA3#E-qM8ll=SE8Ww`C z{h)Hs9#Pdgt@7U{(Z?EDNL~~x&1{~Fn_^dIl^_WuUY(`O#teb!%8}{M+Ir~}El6Ux znGb$6iku`yAV;t(#7JBB18WBa2_iHe+Nt-@RALHhN{&q{G0(>dOpydWUr3+W_05t3Y_&=_r4SpGIF6UN< z*7cJ&5=q3#=XD*IFy@H9a&uM221;R1CdXMk*KPG~x~=oShA;m&Dj35r#B6xX_$wTXT@0Y1%u{ zGkky>a5XjQOoE%K2~Xfg0rvv#I4IMk$FCICg>y-ejn(oIzz|oT`dL2RWYT6L=y;J& zTwsbTPYltR5HIlUgh|0Bew)MRd-~%l@(&yK@~>hI6pe2H8L$ z3tupUg_Vqx3It1WLo>|X-0pPUh*iU~K3q#V7w(HlAU^miFZahU-)-SMG0q^%0ojQW zgmduL=+nkH4F@mJA96ID5Eym`Vp^N1^P`Ml1}&-wNS2*25BZBG)z9(WKVAHr_jT4uhj@ysyDi z>FhY8+=h56Z=ZOJD^_y6L+3Hqm$xf#;W#|h9%V+Jp}5$O)VTt4h|kG=Y~RZV#hub9 z|B!^2mm{RFiNWwP42GnWM6``dgaS1Jz1(k?>3H2RzHi-ju4}YFK2TYM6zLwoL2E2F zC-C)2`CJz}nLIvy{@=xz${WK}DGZt${-B=~6LI~|*&p?b=+s1a)JJ&t@6hZQTw z8_~iMp7r!`=4xWz`ruG8>t)wa43u}+_zfhXvkGEQIW}}So-pTb_qKe5+KBj)kN++| zd5_5*CNJ<~)1ByHSO_#me!yOeLme`!g7qNNnze|tOI1YP4Ci7ti0UWUA_H^wgn`fF z!8Ji*Cn6F%3=gNf2&{0347C7;BBOvsaQM+WXOMNI9Co9WV`mau18~ux z+(!8;C_j(yaR3qJU!-Dnb1=knD9`0!k_UP5v@!I)h%#)Pk-a`LzKX8ldzV-QbCp(g z+|BpURrOsa-)HiVkR)RwpK-Rt@}is(KCAG=AP8h_0gf93nzuLP)+y3?pKSvoAFL3Lfr0 zcehN6CZ4VXiGjIUR?nKSWlRb{%sStH(|F71FGi*3bt!53o5`Bp7G)Y1f5N*fr&|=) z?6GeB2A(I_Qvyc+M?%S_g?~IoSi?2k7Y`s4^qWlfm~BVNPquWyjEHDwm*Glq?SsZ5 zNbi6F28FgwgS)|?u=d=X+;x5Iab@a*#7B;f=f7_*8BzVbzH?)810G481928sht4zD z9U0aj{1UgBf3{o_E@uRJd00tAA>I$G8EJ?-ob+EIc5X8HGLtrwFEF8ei0rn|?rnD) zb_>U@8OajFa#q(Stz;;eAs2r|)bc%q1pX~q3$WdE%0T=S!4mt1Xm`XyUzYzum7u%} z_;&gDA)S!d{7h%FY}X2PjbK9j3VWII3L(>9YYGWik{S@Ciz)riS` zCO^yM10=FD8+6**iK2d0ei~B1xm3_sM-oeHv$&X{YfXm-Ol7s^sii4T3 zt#4rqpG$`vjt=QCe=#V$-&SD#$VN4D-)vI_j=jG7~-!iC) zZ)*q)U~m-QVe=mw`19^zZy~A2qer>MJ{)FZ4gT#LgaWvfo<~CG3S#CFt|Ukf?X7_y zmb-(&W{VCEf6UgSa1g=pEFMN!8^IS}f&B#0j%{`B=ISF!;21oi8~_lu;pq7zKEe`2 z4*psWHV4&1OfW0R+euMCnkoQz6m(1fEms-CS#~|y=S~Cw36HZNUHx4=Xtv)# zSc;3IIrng|g<@a>n1dE})VJ@v9B>sOZ>WnR&5hw~Hez0$qfe%Jp2;~%m?S7HG~#)T z;;rOu)VPhi%%k{;MGx_C#^5>57wiy|&#^eh9hS*`yo(8M2cJiTosisP;-8*m$7lo@ zFaz-?hi0O|?}~mRnMv1(QB4@=6p02A4KW@Z9RW2?-w>W+tWHeD8))a*DQJlUp!C)n z(azr(`nh(9XcJVoAWuK3qHIGQ~Uc{%9`3R#skgYb1`jTfms*iUsc|_9q+wqtIJsazk?4o76oIP4Y8Kp z>}*N%nD>9mDilj$A!_g}A#n-~h^0snMMYz?oRDA@Ra0iU=yr$R^GH`aN4RH9hQ~w0mf*gm$MND9R3f3{q?%3RwMzfmZoMCfAmUm^^>LEXSw* zF_S-J0_cYNBPRcxNh&4eNu)LjFV9|bN3&=iEEKB7NJQBq&%2IBiA_?7Y?5Mh+_@ATcP{HcSti>r$wmUFgTO8lSPeJvzkq0Wl$$G)0NlCy&`sf>ko6fb2j3(Z#hGFh1r4V zYBqmzj~*ly#zYqpEIr_CL{lvd$BRAE-o!w|d>5fj{lV1?q`73Qx@?Ty_XaXu5EuOI zHY2gFX8_a^08!!RgYaHU^|8(R=2Qq#;pc%MVXA*G(|R@OzXY1DF3(KLB#}Q?h;CW? z{0lz)36p=xvdLtY$zdkXGm(Hc zdfl|E{%Jm)WbzghSv!iaUvxA_Gi{h*@tpo+k?>hytS6Arb$&8CbG_cS@n+q`9&fTCpk2o}@!A%F%r3FB4zuf&+I?$g zdZs_dw`!J|rdvXpL2HB%33*KX!V^It(;G%@A*FWoKy4G!b0WGzWVdW|8Ul_{>RGwT=Z|_3XafdORJ96RqLv2uiIT` z-RZjPZnv;rP}Y4*+uAv@v~y^$7xgJ!)TJY}Uec%aoUWi(#*BGg#f&Ou%;9N4*YH&H z=MJ6qieA)9N7nj0#!u*Fj4xwW6;CJi3Z7Q*w4e(Qtj3vN028ZGh$`=!zTRtv?S3yR zKk$2@-)s3%@xej&Nxu_0ci+1gmG15a?M}bf;*#{|pmQ6SkmOtIN?Yr;R@(lF(vEhI z>~%*MbP>q7x}?jv7xX1v(eogpsH=JbBPCtai@2Bdl0Jd^oL<%^aj)nVeG2z^kbMUC zsy?gF;l7~H>sN5E=?nT*+!ysl{Tl8|x(<>qN7Xz1Uf68+eDlB$?=@7k)QSfJ&re8D zK$#cOw{hLa6|A5Mt)YFWhL&dy*@7Hwsn!~HcW!L;yZ()xj{mW5Zh)x=ek<$;H{L%8xB9&s_f50gZJPSmd(F-@VbL5xPk^WSljAQjcnex?IHRK zbfx1vPE3;%IUT=e=CCAknp!s;Q(?a#Bt@zxB*o1FUYI2`}~qy z1Rkc)ii-X|)KwG3faqDu1#Zh~aB>2-c-F%VKk|$`6#P!3LwvxqSo(rp$|;oyK1PT* zL~f@UgwvSJLq}2_JBe8dql&7i24^Rb$xWOr7FaMa+*yS=`&z z&Ct)J*$=mTW0v`zDw>n$89c&ArD#@EZJKBCRvCt5SB4>X6cIwnhH6`V!#Y%nu^6&5 z=9wMyj9{j~N43Nny%@@?m=cImtHCQ1%$l4x8ygz0U;_@}4vY?gQHl>KHRsSYj=^Vs zt7&wCOdWGmWF{q-o0MTfo@9LCQm8qU35vc1*+HdtY*VIsKP^9kiQiZ$t_h+vxMT{{L5nJ|G!X7^+z(MVNSnL0+`f#?aRqeD! z(C!6c6X8g#3ngs$f4Y{U=lM@P@7IWTdRXBkojefYIcp8|uyKNCZ?D<)Juj+wUKg=Y zhyAMOJ>6?|;y0#7&^!bUy-n=oGS6bpbBs>RyvF7do6Br?CY#sUyuoH{Nz#*(l|<2j z1Q*bhRn09I%Ed|nt%JX!wCp*CGb43>t;Om5QG>aMEdMvi^`QI=9`GEj$px1~wPEj6 zexS@hDR=^9(da{jmFC-8ZM&aXpWwX&n`OwMa0s7u2+uh}>^5|MZ0W*t1PijJh&4aK zoRT@x#cX8>VJcUa;&oV2es1?{JvVZ7W$5C09&gLISDz!`l%3|V)6bq+7+ZKwO&~@U zjQxv@)v~d9jQzJ>#QG}cE@hZ39NM5~DTl?01dCdR{jy+R&DJc+ns0_n*zLqK>zO)q zMg@6VPM(VT!t7T#`#H=pJgqMb*+<~{ef2w5&;D+FM!W`Jc&$>e*E6%GjHv)` z;R@bFGqfIG{m336u%bQ1lmG`>mz_R6cRqmJpCT%!=@0C;>rnZq1gqLbYzjYXuf7>M zJN|(LSBP}0n{kvX1`!pz&D~uD5Sg;Rn7g^@_x$}`bL$TApt-x&;C!;->dj8S)$9bf zR5r;$8<$9AT#G;jLW(Jedva1)uIxzWeZ?F5Q*?bqz&CYsKNR1c$U?4J1Rwqgo02Ecm5Rx3j z(8HMb*@!dGJh}unA7ebJIUrlD3C`nU11+9E-id`^kY<3Qc}OX!dlFvqkb%VrC<2`w zVoHcK!0R-WUPys{P64}wU!xp=jH($yIw=#X=xpM%a_yloYBu&!xgB`o0DnJ&V5fXb zU#&If%vHQL%#+M7qhaQx`z>S=5=~y>_+^flcTFGXY%(21|D1W?@91#t- zqFa*mK1mT0u%c!O*cmDwRYTM41si?S^};?~YYP9|1pNH0?98WX%uU0oylnh^bT+M#+TVZ}Ejh#1NA^J#Ig5SH8aX(%ZXs_`I~DU$ma*XE8abF_vs@^1 zRxroGoDbqTanu~Q$RClr$Qf8eQ4vpJK?B8YWH1~h@~AVsP*)nIs1WRS+Myx2!aVa1 zdQp)fZ%@Yx%>x;Us2iey7!}2<2BO)BGI%t=yMB?2svGTnUqibvhB#tluh)vLSPr!X z8E+4KkNf-(3jzkbJlkpr9vB*wlRNvUUVb@UVa6e~_FH{};@)^9og~{bi$(0+@w~yc zuba)iE(-be?p_eqpZN95@T!;VeN%7NIj8xgTRBDR2Y3_ENG-LrSdlVp*&e)-;y8nl*n(mX%EqRN)$wQ! zoDn#4*+zdtK-4Qs)lQoyxVQL_{;2i0aRs!8&*J~!3+3wsd|^pGvG8kzd|<)X2>G-! z{-~l)K!28_`FGm^gVzur876Fqc66V>SI~&K4w||IJ8kAbwKxaD z67?hdDRRWb(L~i0=vrUF$;qtjyXyb4Roz*77NwfG!%oMa8})=FdnSTp6nG zA( zUb%r8d3H`5`P4m0D*uX`k&{SwujFY(Ub309$t>|jGF^~&<{kkQ#;lB7hQjMbDb5Fm z7$!1~=LpPAjQ%CAfM=!!pTH!8aWLxiCq4x~Q$ik9#PSZVyb^+Td_O?+FU8I&B_y*% z3F)b~$gawWWqs>UCls*8$jJ}jSDIn_<4gs)Xj%p5ZsH?{XyD%vkwgPm^LS5g7UUE$ zT?(O4Hu4c@LMWN4M~hRt{B;V=g6la3+62EyJ}=?dSTU(DpXL`COl_6}?Fu@ZFOzl)4?Qs$E|}WamA*KULMdFJ{utHu`}K= zB~Ba+H9jiFIQ}jALIOm%{OO%DMowrtcZq|;w3u(lA2g;R#)>Ky#!BtqXTVS(&I3!o zU{GBA@y<)^iqIIr(3{{qK>VvjQ^7wWM=A`H{xU*IebWzF>+rmP#QK;-e8QQ8n$7v_ zbk?z(>7hwvHD!yEY5j8!;uM{qXTJ5XIWSWPLY#H2HL5d1UV6JYVtyq5 zyO4_wAoHrxSe~746Y4=clH?p}l1t8|?12(T)4+$O$|9wZF`|GeaKIA{rwGbG%(pLI0hg$Pd_sTa|A~qPXDu7col5#VDy! zi)#396#O3wPmy*9WjboK6kMeMo2$o`_~IIyZ?Rcp!%$lyaWOZ6Fw0b<^3C|`+ATV7 XvDXWB?VZZ2mBrfmrTOx?+NJ*mO(a7m diff --git a/cmp/__pycache__/utils.cpython-37.pyc b/cmp/__pycache__/utils.cpython-37.pyc deleted file mode 100755 index 65482478142b81515a16b33b84c5986c6e243205..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6094 zcmbtY&2QYs73YxL)oQg`OR_9kwqrB4<96FdY6~}QT{m^?#!k~hFd!pN7HOC@XJk>{ zC8Z(dNZZv(&M`oN0zLKM0J*ei@BLeN?J564PW`<%B=^HB_fRfohC@EiywBfzvv=p` z>lUsn|NiE)e=Jzme`r!%4sPzCCF|%OSkjW>1=@+-rkO1r%pA-FX0EJYR>91c)h(+v z6X2Wja&dPDE%_%pWwnL0KquM`t@1aaT?n98u#KT?SzriTPp28uY0(*_EZpdx?a%jB#C#BDCup-+S}v%;>M%@F6$Q$Rw>`C&gxxsu!pQ4*iAw3&)=}?C+)dWK-=+96@jBhEx2NMh zrPEL)M8TxI;r*7#76QXa;^(Uc0@|cThO*Hfpe4)bQfpwJh=Ju>1L~n}h$1#ycIIGn zO|&g1a}(9w=1Eq4-sv8w$h!f(EiwwMq|k6c8tLkp$H4p(WSR zK>}-6oQPwa#+UX$d@Tf|DxN=cNTU9~SUY5r_oVbXUZlS8SQIaf*$Sf!crcG=Huh3| zpuBL~OTxbLzJT@v81Jc)<$AaFI=a&{i`^Qo`9yggDM#tdg15X!`HE!wFjYNXb(|JD zce*OlBx&a0UCYs=tE|F2XCh+tn{Ea#^c*@0(1i4ARqLW5`U|5ntz(t{SBslqgEldI zRS))LCsjFXxQ94 z)|RpCW=rI5${NxQ&}J^eEuG|J4jx@Z#M+RVs;G+o`7vfj2*(&Ab1*|Ua8o$g(D8Ps zy55-5bQ52e#*EKW?;SK$QX!Sao74<-2!J=QhgRAt=I4~ zx6{!wXNGiNFf(qp5u!0pN&&HaoYY0b_k#jY{np6lYh#)i zrDD7VWr?|Ll^kywty1z}=R~aLdT>YL$_b+!d4;jiL_E#-KCr>}e>B3&@&qqTa5@`O z6y6Iq>}`96*swSImA8_&-%1F55I(FL<0_{z0y5v=Fvdt}jT$~9HcoQi6q=$E zCLuqbv;y*mR(sg&rz4w9W(`9zeK)dwA#@%KY;Pmx>AS)uu6~qQR^&K1yQG`d_SxEelL~>UAjl)?H_cy`5U;si~~G&pP;JHv@~ZueTMEB)(Bh~ zOEkrrrnI5YQ+I*7i`2bA-4*KIq;42me8;J@D3%fe;F{yw%WkvYtSnTTm8Mf0`)Q&L z(8`OHe+MnOkFG3W7o{WJ7gWYpWECZ&%SEfzu1G3Zt#(z;$p*$5IWLV|4#jgc+b08?Kd#XLWs3U@k1+C1jD}E6)4_aohUDitLYZ)Zmyx z91(L!tUtt%)qbyz-q$+T`g`;=Pb@6M1m{#XeTbHOs*OC0Oxq~=9xa+k*`>ls(t=?V zFM{_jHamy+6Kcv3)=yPRImY)N(x$YUCHl+db|VA^hYv~}6xDjZbzUPn z&(sl@K~wfeWn=c=!a~#bFA2shH7@o<1|^lhMr;nlk4CmTHzMvZv%Z3#0eym#Cad{< zSo#C_!Gy$9a|OrvCnFn(bm0iBjZIM?)L87lwcb&Q+d{Oq)KcSBCiUI0WY$AWYiTeVvq6UJmZ=pe3K9 zE3rsO8_41?A`uc9M5^S7RLv1-M%4@^od}?iL8W?*N^^2iE@6#^JS&$m&dYNMftAc9 z$zQSKJ>q~wOX)8GLL_iNi3j*Z(d%q}CqC1JwFqC5FLQMqr<%%}>G_eB*TL)I`Ej1M zeidctOhP!xJW$9Lb?B$|v3=|u-T$lb)SB~9*gZk9v6Qnb6*Q{e_|I%ad zJ#c)k*j#JZmG;kp1398Pn~(JOu`nR@l21$^e{~MS-a!vlW3LxS{+?Fb;h{-Y44yYZ zZltR)xMsBk2uyzfWR)M(O7Ks`I&WC&N0ka6r+SRx^JwE$O3e4fG~W{#C$C`vPs z6OalXpe2{k9j*)ngl*EfUm_=hNP^eIl9ovT=q$o&Eh?(24hjZ*6T>!R`*6o1}O(TD?rtQbp{sQuW zgM9Fz$p^@3C|kFzkMZWQmAbT!d4h1u4WdcW*{q5VdP?J<$~xEUcxY-bqka7jQOyJg zn)9Ftr|G@DdWu>1@iBuGWxXX~iyC^)A(wKGoazmwYDjUUnt;~%1G-!_>ujSN$Iej$ zDsf09P(mY5ia$0=cnXU_0Szd?ehG!(U}aANrOR3{Qd8-it>#{usE!VH{B0fgP;5$- zXL=L_#$T!KoT`d>-+W}~{zQxu7?A?%P(TCX*X{mNE|gGECY)QDQfK11m`5hZh6igM)~w4MRn;{Xhjm{nga;->dB3K zgjGeKaLi&GIcaNqGov&`DqxeJ0-cmz{)|>^TLR~+d6CS-`%*Do0OzECiEJr%s1ZvS z>GC)DZ~`-^)DQ3nrtkk{3K!;0=_n*QadD4GJ#+;Z2EOqp9|H(ZFP8_-Zl19nO@}pe zo+i94N?5MQeoe2~KgNB6bMIgAGKVr0fm}7fAj1-6v(=oM#tARYDTH^X{G2s#Zc4+T zr|>_hG*%(=nezw9W3v5_3%;A77v##HqwycKHBobGHMDxI-l&;e&lL2x61g9zOnx$= W>2k5GcH11M-X&TVuK8Z`@_zv?qLj4& diff --git a/cool.sh b/cool.sh new file mode 100755 index 000000000..7cf4723e8 --- /dev/null +++ b/cool.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +echo "Hello World" + +for i in {1..5} ; do + if [ $i ]; then + echo $i + fi +done \ No newline at end of file diff --git a/docs/Informe.md b/docs/Informe.md index 488b74feb..0b9024dd8 100644 --- a/docs/Informe.md +++ b/docs/Informe.md @@ -1,12 +1,167 @@ -
+
# Segundo Proyecto de Programacion ## Inferencia de tipos en el lenguaje de programacion *COOL*, una aproximacion a traves de grafos -
+ -El lenguaje de programacion COOL es un lenguaje de programacion estaticamente tipado, y aunque el lenguaje no presenta inferencia de tipos esta es una caracteristica muy util que incorporaremos en un nuestro interprete. +## Indice + +- 0 Estructura del proyecto. +- 1 Analisis Lexicografico y Sintactico. + - 1.1 Generador de lexers y parsers LR "PyJapt". + - 1.2 Manejo de errores lexicograficos y sintacticos. +- 2 Inferencia de tipos. + - 2.1 Grafo de dependencias. + - 2.2 Casos factibles. +- 3 Ejecucion. + +## 1 Analisis Lexicografico y Sintactico + +### 1.1 Generador de lexers y parsers LR "PyJapt" + +PyJapt es un generador de lexer y parser desarrolado por los autores del proyecto que pretende dar una solucion no solo a la creacion de estas piezas del proceso de compilacion, sino tambien permitir una interfaz de manejo de errores sintacticos y lexicograficos personalizados. Para su construccion nos hemos basado en las construcciones realizadas en las clases practicas y nos hemos inspirado en otros generadores de parser para las nuevas funcionalidades como yacc, bison, ply y antlr por ejemplo. + +PyJapt gira alrededor del concepto de gramatica. + +Para definir los no terminales de la gramatiga utilizamos el metodo `add_non_terminal()` de la clase `Grammar`. + +```python +from pyjapt.grammar import Grammar + +G = Grammar() + +expr = G.add_non_terminal('expr', start_symbol=True) +term = G.add_non_terminal('term') +fact = G.add_non_terminal('fact') +``` + +Para definir los terminales de nuestra gramatica usaremos el metodo `add_terminal()` de la clase `Grammar`. Este metodo recibe como primer parametro el nombre del no terminal y como parametro opcional una expresion regular para el analizador lexicografico. En caso de el segundo parametro no se provea la expresion regular sera el nombre literal del terminal. + +```python +plus = G.add_terminals('+') +minus = G.add_terminals('-') +star = G.add_terminals('*') +div = G.add_terminals('/') + +num = G.add_terminal('int', regex=r'\d+') +``` + +Si tenemos un conjunto de terminales cuya expression regular coincide con su propio nombre podemos encapsularlos con las expression`add_terminals()` de la clase `Grammar` + +```python +plus, minus, star, div = G.add_terminals('+ - * /') +num = G.add_terminal('int', regex=r'\d+') +``` + +Puede darse el caso tambien de que querramos aplicar una regla cuando un terminal especifico sea encontrado, para esto PyJapt nos brinda el decorador de funciones `terminal()` de la clase `Grammar` que recibe el nombre y la expresion regular del terminal. La funcion decorada debe recibir como parametro uan referencia al lexer para poder modificar parametros tales como la fila y la columna de los terminales o la posicion de lectura del parser y retornar un `Token`, en caso de no retornar este token sera ignorado. + +```python +@G.terminal('int', r'\d+') +def id_terminal(lexer): + lexer.column += len(lexer.token.lex) + lexer.position += len(lexer.token.lex) + lexer.token.lex = int(lexer.token.lex) + return lexer.token +``` + +Tambien podemos usar esta forma de definicion de terminales para saltarnos ciertos caracteres o tokens. + +```python +################## +# Ignored Tokens # +################## +@G.terminal('newline', r'\n+') +def newline(lexer): + lexer.lineno += len(lexer.token.lex) + lexer.position += len(lexer.token.lex) + lexer.column = 1 + + +@G.terminal('whitespace', r' +') +def whitespace(lexer): + lexer.column += len(lexer.token.lex) + lexer.position += len(lexer.token.lex) + + +@G.terminal('tabulation', r'\t+') +def tab(lexer): + lexer.column += 4 * len(lexer.token.lex) + lexer.position += len(lexer.token.lex) +``` + +Para definir las producciones de nuestra gramatica podemos usar una forma attributada o no atributada: + +```python +# Esta es una gramatica no atributada usando las variable previamente declaradas +expr %= expr + plus + term +expr %= expr + minus + term +expr %= term + +term %= term + star + fact +term %= term + div + fact +term %= fact + +fact %= num + +# Un poco mas sencillo... +# Cada simbolo del string de la produccion debe estar separado por un espacio en blanco +expr %= 'expr + term' +expr %= 'expr - term' +expr %= 'term' + +term %= 'term * factor' +term %= 'term / factor' +term %= 'fact' + +fact %= 'int' + +# Esta es una gramatica atributada +expr %= 'expr + term', lambda s: s[1] + s[3] +expr %= 'expr - term', lambda s: s[1] + s[3] +expr %= 'term', lambda s: s[1] + +term %= 'term * factor', lambda s: s[1] + s[3] +term %= 'term / factor', lambda s: s[1] + s[3] +term %= 'fact', lambda s: s[1] + +fact %= 'int', lambda s: int(s[1]) + +# Tambien podemos atributar una funcion para definir una regla semantica +# Esta funcion debe recibir como parametro `s` que es una referencia a una +# lista con las reglas semanticas de cada simbolo de la produccion. +# Para separar el simbolo de la cabecera del cuerpo de la expresion +# usamos como segundo simbolo `->` +@G.production('expr -> expr + term') +def expr_prod(s): + print('Estas sumando una expresion y un termino ;)') + return s[1] + s[3] +``` + +### 1.2 Manejo de errores lexicograficos y sintacticos + +Una parte importante del proceso de parsing es manejar los errores. Para esto podemos hacer el parser a mano e insertar el reporte de errores, ya que los las tecnicas como `Panic Recovery Mode` la cual implementa `PyJapt` solo permiten que no se detenga la ejecucion de nuestro parser, para dar reportes de errores especificos `PyJapt` ofrece la creacion de producciones erroneas y para reportar errores comunes en un lenguaje de programacion como la falta de un `;` un operador desconocido etc. para esto nuestra gramatica debe activar el flag de terminal de error. + +```python +G.add_terminal_error() # Agrega el terminal de error a la gramatica. + +# Ejemplo de una posible produccion de error +@G.production("instruction -> let id = expr error") +def attribute_error(s): + # Con esta linea reportamos el mensaje del error + # Como la regla semantica de s es el propio token entonces tenemos acceso + # a su lexema, tipo de token, line y columna. + s.error(f"{s[5].line, s[5].column} - SyntacticError: Expected ';' instead of '{s[5].lex}'") + + # Con esta linea permitimos que se siga creando una nodo del ast para + # poder detectar errores semanticos a pesar de haber errores sintacticos + return LetInstruction(s[2], s[4]) +``` + +## 2 Inferencia de Tipos + +COOL es un lenguaje de programacion estaticamente tipado, y aunque el lenguaje no presenta inferencia de tipos esta es una caracteristica muy util que incorporaremos en un nuestro interprete. Nuestro algoritmo de inferencia de tipos se apoya en el uso basico de la teoria de grafos y en el uso del patron de diseno visitor. @@ -18,7 +173,7 @@ La inferencia de tipos de nuestro proyecto detecta para cada atributo, variable, ***Salida :*** Un Arbol de Sintaxis Abstracta, Un Contexto y un Scope con tipos bien tagueados. -***Algoritmo :*** Durante el recorrido del AST sera construido un grafo dirigido cuyos nodo encerraran el concepto de las expresiones marcadas com `AUTO_TYPE` y las aristas representan las dependencias entre las expresiones de estos nodos para inferir su tipo. Sea E1 una expresion cuyo tipo estatico es marcado como AUTO_TYPE, y sea E2 una expresion a partir de a cual se puede inferir el tipo de estatico de E1 entonces en el grafo existira la arista . Una vez construido el arbol Se comenzara una cadena de expansion de tipos estaticos de la forma E1, E2, ..., En donde Ej se infiere de Ei con `1 < j = i + 1 <= n` y E1 es una expresion con tipo estatico definido, al cual llamaremos atomo. Cuando todos los atomos se hayan propagado a traves del grafo los nodos que no hayan podido ser resueltos seran marcados como tipos `Object` al ser esta la clase mas general del lenguaje. +***Algoritmo :*** Durante el recorrido del AST sera construido un grafo dirigido cuyos nodos encerraran el concepto de las expresiones marcadas como `AUTO_TYPE` y las aristas representan las dependencias entre las expresiones de estos nodos para inferir su tipo. Sea `E1` una expresion cuyo tipo estatico es marcado como `AUTO_TYPE`, y sea `E2` una expresion a partir de a cual se puede inferir el tipo de estatico de E1 entonces en el grafo existira la arista ``. Una vez construido el arbol se comenzara una cadena de expansion de tipos estaticos de la forma `E1, E2, ..., En` donde `Ej` se infiere de `Ei` con `1 < j = i + 1 <= n` y `E1` es una expresion con tipo estatico definido, al cual llamaremos atomo. Cuando todos los atomos se hayan propagado a traves del grafo los nodos que no hayan podido ser resueltos seran marcados como tipos `Object` al ser esta la clase mas general del lenguaje. ### Sistemas de nodos @@ -70,7 +225,7 @@ Funcionando de manera analoga para atributos, variables, parametros y retorno de ### Ejemplos de casos Factibles para la Inferencia -```csharp +```typescript class Main inherits IO { function(a: AUTO_TYPE, b: AUTO_TYPE, c: AUTO_TYPE, d: AUTO_TYPE): AUTO_TYPE { { @@ -85,7 +240,7 @@ class Main inherits IO { } ``` -```csharp +```typescript class Point { a: AUTO_TYPE; b: AUTO_TYPE; @@ -100,9 +255,9 @@ class Point { } ``` -```csharp +```typescript class Main inherits IO { - function(a: AUTO_TYPE): AUTO_TYPE { + g(a: AUTO_TYPE): AUTO_TYPE { if a < 10 then f(a) else f(b) fi; }; @@ -112,14 +267,14 @@ class Main inherits IO { } ``` -```csharp +```typescript class Main inherits IO { b: AUTO_TYPE; c: AUTO_TYPE <- "1"; d: AUTO_TYPE; - function(a: AUTO_TYPE): AUTO_TYPE { + g(a: AUTO_TYPE): AUTO_TYPE { { b <- a; d + 1; @@ -133,7 +288,7 @@ class Main inherits IO { } ``` -```csharp +```typescript class Ackermann { ackermann(m: AUTO_TYPE, n: AUTO_TYPE): AUTO_TYPE { if m = 0 then n + 1 else @@ -147,7 +302,7 @@ class Ackermann { ### Casos No factibles -No es posible determinar el tipo de una variable, atributo, parametro, o retorno de funcion si para este se cumple el Caso general y su caso especifico correspondiente. En caso de no poderse determinar el tipo por defecto sera tagueado como `AUTO_TYPE`. +No es posible determinar el tipo de una variable, atributo, parametro, o retorno de funcion si para este se cumple el caso general y su caso especifico correspondiente. ### Caso general @@ -172,7 +327,7 @@ class Main inherits IO { } ``` -En este ejemplo solo es posible inferir el typo del parametro `a` de la funcion `f`, el resto sera marcado como `Object`. +En este ejemplo solo es posible inferir el typo del parametro `a` de la funcion `f` y el atributo `b`, el resto sera marcado como `Object`. ### Casos Particulares @@ -222,7 +377,7 @@ class Main inherits IO { } ``` -#### Expresiones de las cuales es posible determinar su tipo +#### Expresiones atomicas - Valores Constantes. @@ -237,3 +392,5 @@ class Main inherits IO { - Variables de las cuales se conoce su tipo. - Bloques donde se puede determinar el tipo de la ultima expresion. + +## 3 Ejecucion diff --git a/grammar.py b/grammar.py index 8d3e1c1be..5abb01704 100755 --- a/grammar.py +++ b/grammar.py @@ -2,8 +2,8 @@ import time from semantics.utils import astnodes as ast -from cmp.parsing import LALR1Parser -from cmp.pycompiler import Grammar +from pyjapt.parsing import LALR1Parser +from pyjapt.grammar import Grammar G = Grammar() @@ -53,7 +53,7 @@ ############### @G.terminal('id', r'[a-z][a-zA-Z0-9_]*') def id_terminal(lexer): - lexer.column += len(lexer.token.lex) + 1 + lexer.column += len(lexer.token.lex) lexer.position += len(lexer.token.lex) lexer.token.token_type = lexer.token.lex if lexer.token.lex in keywords_names else lexer.token.token_type return lexer.token @@ -78,7 +78,7 @@ def comment(lexer): if s == '\n': lexer.lineno += 1 lexer.column = 0 - lexer.column = 1 + lexer.column += 1 lexer.position += len(lex) diff --git a/lexer.py b/lexer.py index d8535b91b..d1c480735 100755 --- a/lexer.py +++ b/lexer.py @@ -1,6 +1,6 @@ import re -from cmp.lexing import Token, Lexer +from pyjapt.lexing import Token, Lexer from grammar import G diff --git a/main.py b/main.py index 028ffdd40..81fd7e83a 100755 --- a/main.py +++ b/main.py @@ -128,18 +128,20 @@ class Main inherits IO { iterative_fibonacci(n: AUTO_TYPE) : AUTO_TYPE { let i: Int <- 2, n1: Int <- 1, n2: Int <- 1, temp: Int in { - while i < n loop { - temp <- n2; - n2 <- n2 + n1; - n1 <- temp; - i <- i + 1; - } pool; + while i < n loop + let temp: Int <- n2 in { + n2 <- n2 + n1; + n1 <- temp; + i <- i + 1; + } + pool; n2; } }; } """ +verbose = False lexer = CoolLexer() parser = CoolParser() @@ -158,7 +160,8 @@ class Main inherits IO { InferenceChecker(context, errors).visit(ast, scope) TypeChecker(context, errors).visit(ast, scope) - print(CodeBuilder().visit(ast)) + if verbose: + print(CodeBuilder().visit(ast)) if not errors: print() diff --git a/parser.py b/parser.py index 2f1508adc..45467481d 100755 --- a/parser.py +++ b/parser.py @@ -1,5 +1,5 @@ from abc import ABC -from cmp.parsing import ShiftReduceParser +from pyjapt.parsing import ShiftReduceParser from grammar import G @@ -26,1010 +26,1010 @@ def __action_table(): (6, G[":"]): ("SHIFT", 7), (7, G["type"]): ("SHIFT", 8), (8, G["{"]): ("SHIFT", 9), - (9, G["false"]): ("SHIFT", 26), + (9, G["true"]): ("SHIFT", 25), (9, G["id"]): ("SHIFT", 31), - (9, G["("]): ("SHIFT", 11), - (9, G["not"]): ("SHIFT", 30), - (9, G["isvoid"]): ("SHIFT", 24), - (9, G["string"]): ("SHIFT", 33), (9, G["while"]): ("SHIFT", 13), - (9, G["new"]): ("SHIFT", 22), (9, G["{"]): ("SHIFT", 10), - (9, G["if"]): ("SHIFT", 12), - (9, G["true"]): ("SHIFT", 25), + (9, G["~"]): ("SHIFT", 27), + (9, G["int"]): ("SHIFT", 34), + (9, G["new"]): ("SHIFT", 22), (9, G["case"]): ("SHIFT", 21), + (9, G["not"]): ("SHIFT", 30), + (9, G["false"]): ("SHIFT", 26), + (9, G["("]): ("SHIFT", 11), + (9, G["string"]): ("SHIFT", 33), + (9, G["isvoid"]): ("SHIFT", 24), + (9, G["if"]): ("SHIFT", 12), (9, G["let"]): ("SHIFT", 14), - (9, G["int"]): ("SHIFT", 34), - (9, G["~"]): ("SHIFT", 27), - (10, G["id"]): ("SHIFT", 31), - (10, G["not"]): ("SHIFT", 30), - (10, G["string"]): ("SHIFT", 33), - (10, G["new"]): ("SHIFT", 22), (10, G["while"]): ("SHIFT", 13), - (10, G["isvoid"]): ("SHIFT", 24), (10, G["{"]): ("SHIFT", 10), - (10, G["true"]): ("SHIFT", 25), - (10, G["if"]): ("SHIFT", 12), - (10, G["case"]): ("SHIFT", 21), - (10, G["let"]): ("SHIFT", 14), + (10, G["~"]): ("SHIFT", 27), (10, G["int"]): ("SHIFT", 34), + (10, G["case"]): ("SHIFT", 21), + (10, G["not"]): ("SHIFT", 30), + (10, G["new"]): ("SHIFT", 22), + (10, G["id"]): ("SHIFT", 31), (10, G["false"]): ("SHIFT", 26), - (10, G["~"]): ("SHIFT", 27), (10, G["("]): ("SHIFT", 11), + (10, G["string"]): ("SHIFT", 33), + (10, G["if"]): ("SHIFT", 12), + (10, G["isvoid"]): ("SHIFT", 24), + (10, G["let"]): ("SHIFT", 14), + (10, G["true"]): ("SHIFT", 25), + (11, G["case"]): ("SHIFT", 21), + (11, G["not"]): ("SHIFT", 30), + (11, G["int"]): ("SHIFT", 34), (11, G["~"]): ("SHIFT", 27), - (11, G["("]): ("SHIFT", 11), + (11, G["new"]): ("SHIFT", 22), + (11, G["if"]): ("SHIFT", 12), (11, G["id"]): ("SHIFT", 31), + (11, G["false"]): ("SHIFT", 26), + (11, G["("]): ("SHIFT", 11), (11, G["string"]): ("SHIFT", 33), - (11, G["not"]): ("SHIFT", 30), - (11, G["new"]): ("SHIFT", 22), - (11, G["isvoid"]): ("SHIFT", 24), + (11, G["let"]): ("SHIFT", 14), (11, G["while"]): ("SHIFT", 13), - (11, G["true"]): ("SHIFT", 25), (11, G["{"]): ("SHIFT", 10), - (11, G["if"]): ("SHIFT", 12), - (11, G["case"]): ("SHIFT", 21), - (11, G["let"]): ("SHIFT", 14), - (11, G["int"]): ("SHIFT", 34), - (11, G["false"]): ("SHIFT", 26), - (12, G["not"]): ("SHIFT", 30), - (12, G["("]): ("SHIFT", 11), - (12, G["isvoid"]): ("SHIFT", 24), - (12, G["id"]): ("SHIFT", 31), - (12, G["while"]): ("SHIFT", 13), - (12, G["string"]): ("SHIFT", 33), - (12, G["{"]): ("SHIFT", 10), + (11, G["isvoid"]): ("SHIFT", 24), + (11, G["true"]): ("SHIFT", 25), + (12, G["true"]): ("SHIFT", 25), (12, G["if"]): ("SHIFT", 12), - (12, G["case"]): ("SHIFT", 21), - (12, G["new"]): ("SHIFT", 22), + (12, G["int"]): ("SHIFT", 34), (12, G["let"]): ("SHIFT", 14), - (12, G["true"]): ("SHIFT", 25), (12, G["~"]): ("SHIFT", 27), - (12, G["int"]): ("SHIFT", 34), + (12, G["new"]): ("SHIFT", 22), + (12, G["id"]): ("SHIFT", 31), + (12, G["while"]): ("SHIFT", 13), (12, G["false"]): ("SHIFT", 26), - (13, G["isvoid"]): ("SHIFT", 24), - (13, G["id"]): ("SHIFT", 31), + (12, G["("]): ("SHIFT", 11), + (12, G["{"]): ("SHIFT", 10), + (12, G["string"]): ("SHIFT", 33), + (12, G["case"]): ("SHIFT", 21), + (12, G["not"]): ("SHIFT", 30), + (12, G["isvoid"]): ("SHIFT", 24), (13, G["true"]): ("SHIFT", 25), - (13, G["not"]): ("SHIFT", 30), + (13, G["if"]): ("SHIFT", 12), + (13, G["let"]): ("SHIFT", 14), (13, G["int"]): ("SHIFT", 34), - (13, G["false"]): ("SHIFT", 26), + (13, G["id"]): ("SHIFT", 31), (13, G["while"]): ("SHIFT", 13), - (13, G["{"]): ("SHIFT", 10), + (13, G["new"]): ("SHIFT", 22), (13, G["~"]): ("SHIFT", 27), + (13, G["{"]): ("SHIFT", 10), + (13, G["false"]): ("SHIFT", 26), (13, G["("]): ("SHIFT", 11), - (13, G["if"]): ("SHIFT", 12), - (13, G["let"]): ("SHIFT", 14), - (13, G["case"]): ("SHIFT", 21), (13, G["string"]): ("SHIFT", 33), - (13, G["new"]): ("SHIFT", 22), + (13, G["case"]): ("SHIFT", 21), + (13, G["not"]): ("SHIFT", 30), + (13, G["isvoid"]): ("SHIFT", 24), (14, G["id"]): ("SHIFT", 15), (15, G[":"]): ("SHIFT", 16), (16, G["type"]): ("SHIFT", 17), (17, G[","]): ("SHIFT", 18), - (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), (17, G["<-"]): ("SHIFT", 20), + (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), (18, G["id"]): ("SHIFT", 15), (19, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), - (20, G["isvoid"]): ("SHIFT", 24), - (20, G["new"]): ("SHIFT", 22), (20, G["let"]): ("SHIFT", 14), - (20, G["case"]): ("SHIFT", 21), - (20, G["true"]): ("SHIFT", 25), - (20, G["id"]): ("SHIFT", 31), (20, G["int"]): ("SHIFT", 34), - (20, G["false"]): ("SHIFT", 26), (20, G["~"]): ("SHIFT", 27), - (20, G["("]): ("SHIFT", 11), - (20, G["not"]): ("SHIFT", 30), + (20, G["id"]): ("SHIFT", 31), + (20, G["new"]): ("SHIFT", 22), (20, G["while"]): ("SHIFT", 13), (20, G["{"]): ("SHIFT", 10), + (20, G["false"]): ("SHIFT", 26), + (20, G["("]): ("SHIFT", 11), (20, G["string"]): ("SHIFT", 33), + (20, G["case"]): ("SHIFT", 21), (20, G["if"]): ("SHIFT", 12), - (21, G["while"]): ("SHIFT", 13), - (21, G["id"]): ("SHIFT", 31), - (21, G["int"]): ("SHIFT", 34), - (21, G["false"]): ("SHIFT", 26), - (21, G["{"]): ("SHIFT", 10), - (21, G["if"]): ("SHIFT", 12), + (20, G["not"]): ("SHIFT", 30), + (20, G["isvoid"]): ("SHIFT", 24), + (20, G["true"]): ("SHIFT", 25), (21, G["case"]): ("SHIFT", 21), + (21, G["not"]): ("SHIFT", 30), + (21, G["isvoid"]): ("SHIFT", 24), + (21, G["true"]): ("SHIFT", 25), + (21, G["if"]): ("SHIFT", 12), + (21, G["int"]): ("SHIFT", 34), (21, G["let"]): ("SHIFT", 14), - (21, G["("]): ("SHIFT", 11), (21, G["~"]): ("SHIFT", 27), - (21, G["string"]): ("SHIFT", 33), (21, G["new"]): ("SHIFT", 22), - (21, G["not"]): ("SHIFT", 30), - (21, G["true"]): ("SHIFT", 25), - (21, G["isvoid"]): ("SHIFT", 24), + (21, G["id"]): ("SHIFT", 31), + (21, G["while"]): ("SHIFT", 13), + (21, G["false"]): ("SHIFT", 26), + (21, G["("]): ("SHIFT", 11), + (21, G["string"]): ("SHIFT", 33), + (21, G["{"]): ("SHIFT", 10), (22, G["type"]): ("SHIFT", 23), - (23, G["loop"]): ("REDUCE", G["atom -> new type"]), - (23, G["@"]): ("REDUCE", G["atom -> new type"]), - (23, G["error"]): ("REDUCE", G["atom -> new type"]), - (23, G[")"]): ("REDUCE", G["atom -> new type"]), - (23, G["+"]): ("REDUCE", G["atom -> new type"]), - (23, G["pool"]): ("REDUCE", G["atom -> new type"]), - (23, G["-"]): ("REDUCE", G["atom -> new type"]), - (23, G["*"]): ("REDUCE", G["atom -> new type"]), - (23, G["}"]): ("REDUCE", G["atom -> new type"]), - (23, G["in"]): ("REDUCE", G["atom -> new type"]), - (23, G["/"]): ("REDUCE", G["atom -> new type"]), (23, G["of"]): ("REDUCE", G["atom -> new type"]), - (23, G["."]): ("REDUCE", G["atom -> new type"]), (23, G["<"]): ("REDUCE", G["atom -> new type"]), + (23, G["error"]): ("REDUCE", G["atom -> new type"]), + (23, G[")"]): ("REDUCE", G["atom -> new type"]), (23, G["then"]): ("REDUCE", G["atom -> new type"]), - (23, G[","]): ("REDUCE", G["atom -> new type"]), (23, G["<="]): ("REDUCE", G["atom -> new type"]), + (23, G["."]): ("REDUCE", G["atom -> new type"]), (23, G["else"]): ("REDUCE", G["atom -> new type"]), (23, G["="]): ("REDUCE", G["atom -> new type"]), + (23, G[","]): ("REDUCE", G["atom -> new type"]), (23, G["fi"]): ("REDUCE", G["atom -> new type"]), (23, G[";"]): ("REDUCE", G["atom -> new type"]), - (24, G["true"]): ("SHIFT", 25), - (24, G["id"]): ("SHIFT", 28), - (24, G["false"]): ("SHIFT", 26), + (23, G["loop"]): ("REDUCE", G["atom -> new type"]), + (23, G["@"]): ("REDUCE", G["atom -> new type"]), + (23, G["pool"]): ("REDUCE", G["atom -> new type"]), + (23, G["/"]): ("REDUCE", G["atom -> new type"]), + (23, G["+"]): ("REDUCE", G["atom -> new type"]), + (23, G["-"]): ("REDUCE", G["atom -> new type"]), + (23, G["in"]): ("REDUCE", G["atom -> new type"]), + (23, G["*"]): ("REDUCE", G["atom -> new type"]), + (23, G["}"]): ("REDUCE", G["atom -> new type"]), (24, G["new"]): ("SHIFT", 22), + (24, G["int"]): ("SHIFT", 34), + (24, G["false"]): ("SHIFT", 26), + (24, G["true"]): ("SHIFT", 25), + (24, G["~"]): ("SHIFT", 27), (24, G["("]): ("SHIFT", 11), (24, G["isvoid"]): ("SHIFT", 24), - (24, G["~"]): ("SHIFT", 27), - (24, G["int"]): ("SHIFT", 34), + (24, G["id"]): ("SHIFT", 28), (24, G["string"]): ("SHIFT", 33), - (25, G["loop"]): ("REDUCE", G["atom -> true"]), - (25, G["@"]): ("REDUCE", G["atom -> true"]), - (25, G["error"]): ("REDUCE", G["atom -> true"]), - (25, G[")"]): ("REDUCE", G["atom -> true"]), - (25, G["+"]): ("REDUCE", G["atom -> true"]), - (25, G["pool"]): ("REDUCE", G["atom -> true"]), - (25, G["-"]): ("REDUCE", G["atom -> true"]), - (25, G["*"]): ("REDUCE", G["atom -> true"]), - (25, G["}"]): ("REDUCE", G["atom -> true"]), - (25, G["in"]): ("REDUCE", G["atom -> true"]), - (25, G["/"]): ("REDUCE", G["atom -> true"]), (25, G["of"]): ("REDUCE", G["atom -> true"]), - (25, G["."]): ("REDUCE", G["atom -> true"]), (25, G["<"]): ("REDUCE", G["atom -> true"]), + (25, G["error"]): ("REDUCE", G["atom -> true"]), + (25, G[")"]): ("REDUCE", G["atom -> true"]), (25, G["then"]): ("REDUCE", G["atom -> true"]), - (25, G[","]): ("REDUCE", G["atom -> true"]), (25, G["<="]): ("REDUCE", G["atom -> true"]), + (25, G["."]): ("REDUCE", G["atom -> true"]), (25, G["else"]): ("REDUCE", G["atom -> true"]), (25, G["="]): ("REDUCE", G["atom -> true"]), + (25, G[","]): ("REDUCE", G["atom -> true"]), (25, G["fi"]): ("REDUCE", G["atom -> true"]), (25, G[";"]): ("REDUCE", G["atom -> true"]), - (26, G["loop"]): ("REDUCE", G["atom -> false"]), - (26, G["@"]): ("REDUCE", G["atom -> false"]), - (26, G["error"]): ("REDUCE", G["atom -> false"]), - (26, G[")"]): ("REDUCE", G["atom -> false"]), - (26, G["+"]): ("REDUCE", G["atom -> false"]), - (26, G["pool"]): ("REDUCE", G["atom -> false"]), - (26, G["-"]): ("REDUCE", G["atom -> false"]), - (26, G["*"]): ("REDUCE", G["atom -> false"]), - (26, G["}"]): ("REDUCE", G["atom -> false"]), - (26, G["in"]): ("REDUCE", G["atom -> false"]), - (26, G["/"]): ("REDUCE", G["atom -> false"]), + (25, G["loop"]): ("REDUCE", G["atom -> true"]), + (25, G["@"]): ("REDUCE", G["atom -> true"]), + (25, G["pool"]): ("REDUCE", G["atom -> true"]), + (25, G["/"]): ("REDUCE", G["atom -> true"]), + (25, G["+"]): ("REDUCE", G["atom -> true"]), + (25, G["-"]): ("REDUCE", G["atom -> true"]), + (25, G["in"]): ("REDUCE", G["atom -> true"]), + (25, G["*"]): ("REDUCE", G["atom -> true"]), + (25, G["}"]): ("REDUCE", G["atom -> true"]), (26, G["of"]): ("REDUCE", G["atom -> false"]), - (26, G["."]): ("REDUCE", G["atom -> false"]), (26, G["<"]): ("REDUCE", G["atom -> false"]), + (26, G["error"]): ("REDUCE", G["atom -> false"]), + (26, G[")"]): ("REDUCE", G["atom -> false"]), (26, G["then"]): ("REDUCE", G["atom -> false"]), - (26, G[","]): ("REDUCE", G["atom -> false"]), (26, G["<="]): ("REDUCE", G["atom -> false"]), + (26, G["."]): ("REDUCE", G["atom -> false"]), (26, G["else"]): ("REDUCE", G["atom -> false"]), (26, G["="]): ("REDUCE", G["atom -> false"]), + (26, G[","]): ("REDUCE", G["atom -> false"]), (26, G["fi"]): ("REDUCE", G["atom -> false"]), (26, G[";"]): ("REDUCE", G["atom -> false"]), - (27, G["true"]): ("SHIFT", 25), - (27, G["id"]): ("SHIFT", 28), - (27, G["false"]): ("SHIFT", 26), + (26, G["loop"]): ("REDUCE", G["atom -> false"]), + (26, G["@"]): ("REDUCE", G["atom -> false"]), + (26, G["pool"]): ("REDUCE", G["atom -> false"]), + (26, G["/"]): ("REDUCE", G["atom -> false"]), + (26, G["+"]): ("REDUCE", G["atom -> false"]), + (26, G["-"]): ("REDUCE", G["atom -> false"]), + (26, G["in"]): ("REDUCE", G["atom -> false"]), + (26, G["*"]): ("REDUCE", G["atom -> false"]), + (26, G["}"]): ("REDUCE", G["atom -> false"]), (27, G["new"]): ("SHIFT", 22), + (27, G["int"]): ("SHIFT", 34), + (27, G["false"]): ("SHIFT", 26), + (27, G["true"]): ("SHIFT", 25), + (27, G["~"]): ("SHIFT", 27), (27, G["("]): ("SHIFT", 11), (27, G["isvoid"]): ("SHIFT", 24), - (27, G["~"]): ("SHIFT", 27), - (27, G["int"]): ("SHIFT", 34), + (27, G["id"]): ("SHIFT", 28), (27, G["string"]): ("SHIFT", 33), - (28, G["loop"]): ("REDUCE", G["atom -> id"]), - (28, G["@"]): ("REDUCE", G["atom -> id"]), - (28, G["error"]): ("REDUCE", G["atom -> id"]), - (28, G[")"]): ("REDUCE", G["atom -> id"]), - (28, G["+"]): ("REDUCE", G["atom -> id"]), - (28, G["pool"]): ("REDUCE", G["atom -> id"]), - (28, G["-"]): ("REDUCE", G["atom -> id"]), - (28, G["*"]): ("REDUCE", G["atom -> id"]), - (28, G["}"]): ("REDUCE", G["atom -> id"]), - (28, G["in"]): ("REDUCE", G["atom -> id"]), - (28, G["/"]): ("REDUCE", G["atom -> id"]), (28, G["of"]): ("REDUCE", G["atom -> id"]), - (28, G["."]): ("REDUCE", G["atom -> id"]), (28, G["<"]): ("REDUCE", G["atom -> id"]), + (28, G["error"]): ("REDUCE", G["atom -> id"]), + (28, G[")"]): ("REDUCE", G["atom -> id"]), (28, G["then"]): ("REDUCE", G["atom -> id"]), - (28, G[","]): ("REDUCE", G["atom -> id"]), (28, G["<="]): ("REDUCE", G["atom -> id"]), + (28, G["."]): ("REDUCE", G["atom -> id"]), (28, G["else"]): ("REDUCE", G["atom -> id"]), (28, G["="]): ("REDUCE", G["atom -> id"]), + (28, G[","]): ("REDUCE", G["atom -> id"]), (28, G["fi"]): ("REDUCE", G["atom -> id"]), (28, G[";"]): ("REDUCE", G["atom -> id"]), + (28, G["loop"]): ("REDUCE", G["atom -> id"]), + (28, G["@"]): ("REDUCE", G["atom -> id"]), + (28, G["pool"]): ("REDUCE", G["atom -> id"]), + (28, G["/"]): ("REDUCE", G["atom -> id"]), + (28, G["+"]): ("REDUCE", G["atom -> id"]), + (28, G["-"]): ("REDUCE", G["atom -> id"]), + (28, G["in"]): ("REDUCE", G["atom -> id"]), + (28, G["*"]): ("REDUCE", G["atom -> id"]), + (28, G["}"]): ("REDUCE", G["atom -> id"]), (28, G["("]): ("SHIFT", 29), (29, G["new"]): ("SHIFT", 22), + (29, G["if"]): ("SHIFT", 12), + (29, G["~"]): ("SHIFT", 27), (29, G["id"]): ("SHIFT", 31), - (29, G["true"]): ("SHIFT", 25), - (29, G["isvoid"]): ("SHIFT", 24), - (29, G[")"]): ("REDUCE", G["expr-list -> e"]), - (29, G["not"]): ("SHIFT", 30), - (29, G["int"]): ("SHIFT", 34), (29, G["false"]): ("SHIFT", 26), - (29, G["while"]): ("SHIFT", 13), + (29, G["let"]): ("SHIFT", 14), (29, G["("]): ("SHIFT", 11), + (29, G["string"]): ("SHIFT", 33), + (29, G[")"]): ("REDUCE", G["expr-list -> e"]), + (29, G["while"]): ("SHIFT", 13), (29, G["{"]): ("SHIFT", 10), - (29, G["if"]): ("SHIFT", 12), - (29, G["~"]): ("SHIFT", 27), + (29, G["isvoid"]): ("SHIFT", 24), + (29, G["true"]): ("SHIFT", 25), + (29, G["not"]): ("SHIFT", 30), (29, G["case"]): ("SHIFT", 21), - (29, G["let"]): ("SHIFT", 14), - (29, G["string"]): ("SHIFT", 33), - (30, G["false"]): ("SHIFT", 26), - (30, G["("]): ("SHIFT", 11), - (30, G["id"]): ("SHIFT", 31), - (30, G["isvoid"]): ("SHIFT", 24), - (30, G["string"]): ("SHIFT", 33), - (30, G["not"]): ("SHIFT", 30), - (30, G["new"]): ("SHIFT", 22), - (30, G["while"]): ("SHIFT", 13), + (29, G["int"]): ("SHIFT", 34), (30, G["true"]): ("SHIFT", 25), - (30, G["int"]): ("SHIFT", 34), - (30, G["{"]): ("SHIFT", 10), (30, G["if"]): ("SHIFT", 12), (30, G["let"]): ("SHIFT", 14), + (30, G["int"]): ("SHIFT", 34), (30, G["~"]): ("SHIFT", 27), + (30, G["id"]): ("SHIFT", 31), + (30, G["while"]): ("SHIFT", 13), + (30, G["new"]): ("SHIFT", 22), + (30, G["{"]): ("SHIFT", 10), + (30, G["false"]): ("SHIFT", 26), + (30, G["("]): ("SHIFT", 11), + (30, G["string"]): ("SHIFT", 33), (30, G["case"]): ("SHIFT", 21), + (30, G["not"]): ("SHIFT", 30), + (30, G["isvoid"]): ("SHIFT", 24), (31, G["<-"]): ("SHIFT", 32), - (31, G["loop"]): ("REDUCE", G["atom -> id"]), - (31, G["@"]): ("REDUCE", G["atom -> id"]), - (31, G["error"]): ("REDUCE", G["atom -> id"]), - (31, G[")"]): ("REDUCE", G["atom -> id"]), - (31, G["+"]): ("REDUCE", G["atom -> id"]), - (31, G["pool"]): ("REDUCE", G["atom -> id"]), - (31, G["-"]): ("REDUCE", G["atom -> id"]), - (31, G["*"]): ("REDUCE", G["atom -> id"]), - (31, G["}"]): ("REDUCE", G["atom -> id"]), - (31, G["in"]): ("REDUCE", G["atom -> id"]), - (31, G["/"]): ("REDUCE", G["atom -> id"]), (31, G["of"]): ("REDUCE", G["atom -> id"]), - (31, G["."]): ("REDUCE", G["atom -> id"]), (31, G["<"]): ("REDUCE", G["atom -> id"]), + (31, G["error"]): ("REDUCE", G["atom -> id"]), + (31, G[")"]): ("REDUCE", G["atom -> id"]), (31, G["then"]): ("REDUCE", G["atom -> id"]), - (31, G[","]): ("REDUCE", G["atom -> id"]), (31, G["<="]): ("REDUCE", G["atom -> id"]), + (31, G["."]): ("REDUCE", G["atom -> id"]), (31, G["else"]): ("REDUCE", G["atom -> id"]), (31, G["="]): ("REDUCE", G["atom -> id"]), + (31, G[","]): ("REDUCE", G["atom -> id"]), (31, G["fi"]): ("REDUCE", G["atom -> id"]), (31, G[";"]): ("REDUCE", G["atom -> id"]), + (31, G["loop"]): ("REDUCE", G["atom -> id"]), + (31, G["@"]): ("REDUCE", G["atom -> id"]), + (31, G["pool"]): ("REDUCE", G["atom -> id"]), + (31, G["/"]): ("REDUCE", G["atom -> id"]), + (31, G["+"]): ("REDUCE", G["atom -> id"]), + (31, G["-"]): ("REDUCE", G["atom -> id"]), + (31, G["in"]): ("REDUCE", G["atom -> id"]), + (31, G["*"]): ("REDUCE", G["atom -> id"]), + (31, G["}"]): ("REDUCE", G["atom -> id"]), (31, G["("]): ("SHIFT", 29), - (32, G["false"]): ("SHIFT", 26), - (32, G["("]): ("SHIFT", 11), - (32, G["id"]): ("SHIFT", 31), - (32, G["isvoid"]): ("SHIFT", 24), - (32, G["string"]): ("SHIFT", 33), - (32, G["not"]): ("SHIFT", 30), - (32, G["new"]): ("SHIFT", 22), - (32, G["while"]): ("SHIFT", 13), (32, G["true"]): ("SHIFT", 25), - (32, G["int"]): ("SHIFT", 34), - (32, G["{"]): ("SHIFT", 10), (32, G["if"]): ("SHIFT", 12), (32, G["let"]): ("SHIFT", 14), + (32, G["int"]): ("SHIFT", 34), (32, G["~"]): ("SHIFT", 27), + (32, G["id"]): ("SHIFT", 31), + (32, G["while"]): ("SHIFT", 13), + (32, G["new"]): ("SHIFT", 22), + (32, G["{"]): ("SHIFT", 10), + (32, G["false"]): ("SHIFT", 26), + (32, G["("]): ("SHIFT", 11), + (32, G["string"]): ("SHIFT", 33), (32, G["case"]): ("SHIFT", 21), - (33, G["loop"]): ("REDUCE", G["atom -> string"]), - (33, G["@"]): ("REDUCE", G["atom -> string"]), - (33, G["error"]): ("REDUCE", G["atom -> string"]), - (33, G[")"]): ("REDUCE", G["atom -> string"]), - (33, G["+"]): ("REDUCE", G["atom -> string"]), - (33, G["pool"]): ("REDUCE", G["atom -> string"]), - (33, G["-"]): ("REDUCE", G["atom -> string"]), - (33, G["*"]): ("REDUCE", G["atom -> string"]), - (33, G["}"]): ("REDUCE", G["atom -> string"]), - (33, G["in"]): ("REDUCE", G["atom -> string"]), - (33, G["/"]): ("REDUCE", G["atom -> string"]), + (32, G["not"]): ("SHIFT", 30), + (32, G["isvoid"]): ("SHIFT", 24), (33, G["of"]): ("REDUCE", G["atom -> string"]), - (33, G["."]): ("REDUCE", G["atom -> string"]), (33, G["<"]): ("REDUCE", G["atom -> string"]), + (33, G["error"]): ("REDUCE", G["atom -> string"]), + (33, G[")"]): ("REDUCE", G["atom -> string"]), (33, G["then"]): ("REDUCE", G["atom -> string"]), - (33, G[","]): ("REDUCE", G["atom -> string"]), (33, G["<="]): ("REDUCE", G["atom -> string"]), + (33, G["."]): ("REDUCE", G["atom -> string"]), (33, G["else"]): ("REDUCE", G["atom -> string"]), (33, G["="]): ("REDUCE", G["atom -> string"]), + (33, G[","]): ("REDUCE", G["atom -> string"]), (33, G["fi"]): ("REDUCE", G["atom -> string"]), (33, G[";"]): ("REDUCE", G["atom -> string"]), - (34, G["loop"]): ("REDUCE", G["atom -> int"]), - (34, G["@"]): ("REDUCE", G["atom -> int"]), - (34, G["error"]): ("REDUCE", G["atom -> int"]), - (34, G[")"]): ("REDUCE", G["atom -> int"]), - (34, G["+"]): ("REDUCE", G["atom -> int"]), - (34, G["pool"]): ("REDUCE", G["atom -> int"]), - (34, G["-"]): ("REDUCE", G["atom -> int"]), - (34, G["*"]): ("REDUCE", G["atom -> int"]), - (34, G["}"]): ("REDUCE", G["atom -> int"]), - (34, G["in"]): ("REDUCE", G["atom -> int"]), - (34, G["/"]): ("REDUCE", G["atom -> int"]), + (33, G["loop"]): ("REDUCE", G["atom -> string"]), + (33, G["@"]): ("REDUCE", G["atom -> string"]), + (33, G["pool"]): ("REDUCE", G["atom -> string"]), + (33, G["/"]): ("REDUCE", G["atom -> string"]), + (33, G["+"]): ("REDUCE", G["atom -> string"]), + (33, G["-"]): ("REDUCE", G["atom -> string"]), + (33, G["in"]): ("REDUCE", G["atom -> string"]), + (33, G["*"]): ("REDUCE", G["atom -> string"]), + (33, G["}"]): ("REDUCE", G["atom -> string"]), (34, G["of"]): ("REDUCE", G["atom -> int"]), - (34, G["."]): ("REDUCE", G["atom -> int"]), (34, G["<"]): ("REDUCE", G["atom -> int"]), + (34, G["error"]): ("REDUCE", G["atom -> int"]), + (34, G[")"]): ("REDUCE", G["atom -> int"]), (34, G["then"]): ("REDUCE", G["atom -> int"]), - (34, G[","]): ("REDUCE", G["atom -> int"]), (34, G["<="]): ("REDUCE", G["atom -> int"]), + (34, G["."]): ("REDUCE", G["atom -> int"]), (34, G["else"]): ("REDUCE", G["atom -> int"]), (34, G["="]): ("REDUCE", G["atom -> int"]), + (34, G[","]): ("REDUCE", G["atom -> int"]), (34, G["fi"]): ("REDUCE", G["atom -> int"]), (34, G[";"]): ("REDUCE", G["atom -> int"]), - (35, G["loop"]): ("REDUCE", G["atom -> function-call"]), - (35, G["@"]): ("REDUCE", G["atom -> function-call"]), - (35, G["error"]): ("REDUCE", G["atom -> function-call"]), - (35, G[")"]): ("REDUCE", G["atom -> function-call"]), - (35, G["+"]): ("REDUCE", G["atom -> function-call"]), - (35, G["pool"]): ("REDUCE", G["atom -> function-call"]), - (35, G["-"]): ("REDUCE", G["atom -> function-call"]), - (35, G["*"]): ("REDUCE", G["atom -> function-call"]), - (35, G["}"]): ("REDUCE", G["atom -> function-call"]), - (35, G["in"]): ("REDUCE", G["atom -> function-call"]), - (35, G["/"]): ("REDUCE", G["atom -> function-call"]), + (34, G["loop"]): ("REDUCE", G["atom -> int"]), + (34, G["@"]): ("REDUCE", G["atom -> int"]), + (34, G["pool"]): ("REDUCE", G["atom -> int"]), + (34, G["/"]): ("REDUCE", G["atom -> int"]), + (34, G["+"]): ("REDUCE", G["atom -> int"]), + (34, G["-"]): ("REDUCE", G["atom -> int"]), + (34, G["in"]): ("REDUCE", G["atom -> int"]), + (34, G["*"]): ("REDUCE", G["atom -> int"]), + (34, G["}"]): ("REDUCE", G["atom -> int"]), (35, G["of"]): ("REDUCE", G["atom -> function-call"]), - (35, G["."]): ("REDUCE", G["atom -> function-call"]), (35, G["<"]): ("REDUCE", G["atom -> function-call"]), + (35, G["error"]): ("REDUCE", G["atom -> function-call"]), + (35, G[")"]): ("REDUCE", G["atom -> function-call"]), (35, G["then"]): ("REDUCE", G["atom -> function-call"]), - (35, G[","]): ("REDUCE", G["atom -> function-call"]), (35, G["<="]): ("REDUCE", G["atom -> function-call"]), + (35, G["."]): ("REDUCE", G["atom -> function-call"]), (35, G["else"]): ("REDUCE", G["atom -> function-call"]), (35, G["="]): ("REDUCE", G["atom -> function-call"]), + (35, G[","]): ("REDUCE", G["atom -> function-call"]), (35, G["fi"]): ("REDUCE", G["atom -> function-call"]), (35, G[";"]): ("REDUCE", G["atom -> function-call"]), - (36, G["in"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), + (35, G["loop"]): ("REDUCE", G["atom -> function-call"]), + (35, G["@"]): ("REDUCE", G["atom -> function-call"]), + (35, G["pool"]): ("REDUCE", G["atom -> function-call"]), + (35, G["/"]): ("REDUCE", G["atom -> function-call"]), + (35, G["+"]): ("REDUCE", G["atom -> function-call"]), + (35, G["-"]): ("REDUCE", G["atom -> function-call"]), + (35, G["in"]): ("REDUCE", G["atom -> function-call"]), + (35, G["*"]): ("REDUCE", G["atom -> function-call"]), + (35, G["}"]): ("REDUCE", G["atom -> function-call"]), + (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), (36, G["else"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["in"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["}"]): ("REDUCE", G["expr -> id <- expr"]), - (37, G["in"]): ("REDUCE", G["expr -> comp"]), - (37, G["loop"]): ("REDUCE", G["expr -> comp"]), + (37, G[";"]): ("REDUCE", G["expr -> comp"]), (37, G["of"]): ("REDUCE", G["expr -> comp"]), + (37, G["loop"]): ("REDUCE", G["expr -> comp"]), (37, G["error"]): ("REDUCE", G["expr -> comp"]), (37, G[")"]): ("REDUCE", G["expr -> comp"]), (37, G["pool"]): ("REDUCE", G["expr -> comp"]), (37, G["then"]): ("REDUCE", G["expr -> comp"]), - (37, G[","]): ("REDUCE", G["expr -> comp"]), (37, G["else"]): ("REDUCE", G["expr -> comp"]), + (37, G[","]): ("REDUCE", G["expr -> comp"]), + (37, G["in"]): ("REDUCE", G["expr -> comp"]), (37, G["fi"]): ("REDUCE", G["expr -> comp"]), - (37, G[";"]): ("REDUCE", G["expr -> comp"]), (37, G["}"]): ("REDUCE", G["expr -> comp"]), - (38, G["="]): ("SHIFT", 70), + (38, G["<="]): ("SHIFT", 68), + (38, G["<"]): ("SHIFT", 66), (38, G["-"]): ("SHIFT", 64), - (38, G["+"]): ("SHIFT", 39), - (38, G["in"]): ("REDUCE", G["comp -> arith"]), - (38, G["loop"]): ("REDUCE", G["comp -> arith"]), + (38, G[";"]): ("REDUCE", G["comp -> arith"]), (38, G["of"]): ("REDUCE", G["comp -> arith"]), + (38, G["loop"]): ("REDUCE", G["comp -> arith"]), (38, G["error"]): ("REDUCE", G["comp -> arith"]), (38, G[")"]): ("REDUCE", G["comp -> arith"]), (38, G["pool"]): ("REDUCE", G["comp -> arith"]), (38, G["then"]): ("REDUCE", G["comp -> arith"]), - (38, G[","]): ("REDUCE", G["comp -> arith"]), (38, G["else"]): ("REDUCE", G["comp -> arith"]), + (38, G[","]): ("REDUCE", G["comp -> arith"]), + (38, G["in"]): ("REDUCE", G["comp -> arith"]), (38, G["fi"]): ("REDUCE", G["comp -> arith"]), - (38, G[";"]): ("REDUCE", G["comp -> arith"]), (38, G["}"]): ("REDUCE", G["comp -> arith"]), - (38, G["<"]): ("SHIFT", 66), - (38, G["<="]): ("SHIFT", 68), - (39, G["false"]): ("SHIFT", 26), + (38, G["+"]): ("SHIFT", 39), + (38, G["="]): ("SHIFT", 70), (39, G["new"]): ("SHIFT", 22), - (39, G["("]): ("SHIFT", 11), + (39, G["false"]): ("SHIFT", 26), (39, G["true"]): ("SHIFT", 25), - (39, G["int"]): ("SHIFT", 34), + (39, G["("]): ("SHIFT", 11), (39, G["id"]): ("SHIFT", 28), - (39, G["isvoid"]): ("SHIFT", 24), - (39, G["~"]): ("SHIFT", 27), (39, G["string"]): ("SHIFT", 33), + (39, G["int"]): ("SHIFT", 34), + (39, G["~"]): ("SHIFT", 27), + (39, G["isvoid"]): ("SHIFT", 24), (40, G["/"]): ("SHIFT", 54), - (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), - (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["+"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["*"]): ("SHIFT", 41), (40, G["of"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), (40, G["<"]): ("REDUCE", G["arith -> arith + term"]), + (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), (40, G["then"]): ("REDUCE", G["arith -> arith + term"]), - (40, G[","]): ("REDUCE", G["arith -> arith + term"]), (40, G["<="]): ("REDUCE", G["arith -> arith + term"]), (40, G["else"]): ("REDUCE", G["arith -> arith + term"]), (40, G["="]): ("REDUCE", G["arith -> arith + term"]), + (40, G[","]): ("REDUCE", G["arith -> arith + term"]), (40, G["fi"]): ("REDUCE", G["arith -> arith + term"]), (40, G[";"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["*"]): ("SHIFT", 41), - (41, G["true"]): ("SHIFT", 25), - (41, G["id"]): ("SHIFT", 28), - (41, G["false"]): ("SHIFT", 26), + (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["+"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), (41, G["new"]): ("SHIFT", 22), + (41, G["int"]): ("SHIFT", 34), + (41, G["false"]): ("SHIFT", 26), + (41, G["true"]): ("SHIFT", 25), + (41, G["~"]): ("SHIFT", 27), (41, G["("]): ("SHIFT", 11), (41, G["isvoid"]): ("SHIFT", 24), - (41, G["~"]): ("SHIFT", 27), - (41, G["int"]): ("SHIFT", 34), + (41, G["id"]): ("SHIFT", 28), (41, G["string"]): ("SHIFT", 33), - (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), - (42, G["error"]): ("REDUCE", G["term -> term * factor"]), - (42, G[")"]): ("REDUCE", G["term -> term * factor"]), - (42, G["+"]): ("REDUCE", G["term -> term * factor"]), - (42, G["pool"]): ("REDUCE", G["term -> term * factor"]), - (42, G["-"]): ("REDUCE", G["term -> term * factor"]), - (42, G["*"]): ("REDUCE", G["term -> term * factor"]), - (42, G["}"]): ("REDUCE", G["term -> term * factor"]), - (42, G["in"]): ("REDUCE", G["term -> term * factor"]), - (42, G["/"]): ("REDUCE", G["term -> term * factor"]), (42, G["of"]): ("REDUCE", G["term -> term * factor"]), (42, G["<"]): ("REDUCE", G["term -> term * factor"]), + (42, G["error"]): ("REDUCE", G["term -> term * factor"]), + (42, G[")"]): ("REDUCE", G["term -> term * factor"]), (42, G["then"]): ("REDUCE", G["term -> term * factor"]), - (42, G[","]): ("REDUCE", G["term -> term * factor"]), (42, G["<="]): ("REDUCE", G["term -> term * factor"]), (42, G["else"]): ("REDUCE", G["term -> term * factor"]), (42, G["="]): ("REDUCE", G["term -> term * factor"]), + (42, G[","]): ("REDUCE", G["term -> term * factor"]), (42, G["fi"]): ("REDUCE", G["term -> term * factor"]), (42, G[";"]): ("REDUCE", G["term -> term * factor"]), + (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), + (42, G["pool"]): ("REDUCE", G["term -> term * factor"]), + (42, G["/"]): ("REDUCE", G["term -> term * factor"]), + (42, G["+"]): ("REDUCE", G["term -> term * factor"]), + (42, G["-"]): ("REDUCE", G["term -> term * factor"]), + (42, G["in"]): ("REDUCE", G["term -> term * factor"]), + (42, G["*"]): ("REDUCE", G["term -> term * factor"]), + (42, G["}"]): ("REDUCE", G["term -> term * factor"]), (43, G["@"]): ("SHIFT", 57), - (43, G["."]): ("SHIFT", 44), - (43, G["loop"]): ("REDUCE", G["factor -> atom"]), - (43, G["error"]): ("REDUCE", G["factor -> atom"]), - (43, G[")"]): ("REDUCE", G["factor -> atom"]), - (43, G["+"]): ("REDUCE", G["factor -> atom"]), - (43, G["pool"]): ("REDUCE", G["factor -> atom"]), - (43, G["-"]): ("REDUCE", G["factor -> atom"]), - (43, G["*"]): ("REDUCE", G["factor -> atom"]), - (43, G["}"]): ("REDUCE", G["factor -> atom"]), - (43, G["in"]): ("REDUCE", G["factor -> atom"]), - (43, G["/"]): ("REDUCE", G["factor -> atom"]), (43, G["of"]): ("REDUCE", G["factor -> atom"]), (43, G["<"]): ("REDUCE", G["factor -> atom"]), + (43, G["error"]): ("REDUCE", G["factor -> atom"]), + (43, G[")"]): ("REDUCE", G["factor -> atom"]), (43, G["then"]): ("REDUCE", G["factor -> atom"]), - (43, G[","]): ("REDUCE", G["factor -> atom"]), (43, G["<="]): ("REDUCE", G["factor -> atom"]), (43, G["else"]): ("REDUCE", G["factor -> atom"]), (43, G["="]): ("REDUCE", G["factor -> atom"]), + (43, G[","]): ("REDUCE", G["factor -> atom"]), (43, G["fi"]): ("REDUCE", G["factor -> atom"]), (43, G[";"]): ("REDUCE", G["factor -> atom"]), + (43, G["loop"]): ("REDUCE", G["factor -> atom"]), + (43, G["pool"]): ("REDUCE", G["factor -> atom"]), + (43, G["/"]): ("REDUCE", G["factor -> atom"]), + (43, G["+"]): ("REDUCE", G["factor -> atom"]), + (43, G["-"]): ("REDUCE", G["factor -> atom"]), + (43, G["in"]): ("REDUCE", G["factor -> atom"]), + (43, G["*"]): ("REDUCE", G["factor -> atom"]), + (43, G["}"]): ("REDUCE", G["factor -> atom"]), + (43, G["."]): ("SHIFT", 44), (44, G["id"]): ("SHIFT", 45), (45, G["("]): ("SHIFT", 46), (46, G["new"]): ("SHIFT", 22), + (46, G["if"]): ("SHIFT", 12), + (46, G["~"]): ("SHIFT", 27), (46, G["id"]): ("SHIFT", 31), - (46, G["true"]): ("SHIFT", 25), - (46, G["isvoid"]): ("SHIFT", 24), - (46, G[")"]): ("REDUCE", G["expr-list -> e"]), - (46, G["not"]): ("SHIFT", 30), - (46, G["int"]): ("SHIFT", 34), (46, G["false"]): ("SHIFT", 26), - (46, G["while"]): ("SHIFT", 13), + (46, G["let"]): ("SHIFT", 14), (46, G["("]): ("SHIFT", 11), + (46, G["string"]): ("SHIFT", 33), + (46, G[")"]): ("REDUCE", G["expr-list -> e"]), + (46, G["while"]): ("SHIFT", 13), (46, G["{"]): ("SHIFT", 10), - (46, G["if"]): ("SHIFT", 12), - (46, G["~"]): ("SHIFT", 27), + (46, G["isvoid"]): ("SHIFT", 24), + (46, G["true"]): ("SHIFT", 25), + (46, G["not"]): ("SHIFT", 30), (46, G["case"]): ("SHIFT", 21), - (46, G["let"]): ("SHIFT", 14), - (46, G["string"]): ("SHIFT", 33), + (46, G["int"]): ("SHIFT", 34), (47, G[")"]): ("SHIFT", 48), - (48, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (49, G[")"]): ("REDUCE", G["expr-list -> not-empty-expr-list"]), (50, G[","]): ("SHIFT", 51), (50, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), (51, G["new"]): ("SHIFT", 22), + (51, G["if"]): ("SHIFT", 12), + (51, G["~"]): ("SHIFT", 27), (51, G["id"]): ("SHIFT", 31), - (51, G["true"]): ("SHIFT", 25), - (51, G["isvoid"]): ("SHIFT", 24), - (51, G["not"]): ("SHIFT", 30), - (51, G["int"]): ("SHIFT", 34), (51, G["false"]): ("SHIFT", 26), - (51, G["while"]): ("SHIFT", 13), + (51, G["let"]): ("SHIFT", 14), (51, G["("]): ("SHIFT", 11), + (51, G["string"]): ("SHIFT", 33), + (51, G["while"]): ("SHIFT", 13), (51, G["{"]): ("SHIFT", 10), - (51, G["if"]): ("SHIFT", 12), - (51, G["~"]): ("SHIFT", 27), + (51, G["isvoid"]): ("SHIFT", 24), + (51, G["true"]): ("SHIFT", 25), + (51, G["not"]): ("SHIFT", 30), (51, G["case"]): ("SHIFT", 21), - (51, G["let"]): ("SHIFT", 14), - (51, G["string"]): ("SHIFT", 33), + (51, G["int"]): ("SHIFT", 34), (52, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr , not-empty-expr-list"]), - (53, G["/"]): ("SHIFT", 54), - (53, G["loop"]): ("REDUCE", G["arith -> term"]), - (53, G["error"]): ("REDUCE", G["arith -> term"]), - (53, G[")"]): ("REDUCE", G["arith -> term"]), - (53, G["pool"]): ("REDUCE", G["arith -> term"]), - (53, G["+"]): ("REDUCE", G["arith -> term"]), - (53, G["-"]): ("REDUCE", G["arith -> term"]), - (53, G["}"]): ("REDUCE", G["arith -> term"]), - (53, G["in"]): ("REDUCE", G["arith -> term"]), (53, G["of"]): ("REDUCE", G["arith -> term"]), + (53, G["error"]): ("REDUCE", G["arith -> term"]), (53, G["<"]): ("REDUCE", G["arith -> term"]), + (53, G[")"]): ("REDUCE", G["arith -> term"]), (53, G["then"]): ("REDUCE", G["arith -> term"]), - (53, G[","]): ("REDUCE", G["arith -> term"]), (53, G["<="]): ("REDUCE", G["arith -> term"]), (53, G["else"]): ("REDUCE", G["arith -> term"]), (53, G["="]): ("REDUCE", G["arith -> term"]), + (53, G[","]): ("REDUCE", G["arith -> term"]), (53, G["fi"]): ("REDUCE", G["arith -> term"]), (53, G[";"]): ("REDUCE", G["arith -> term"]), + (53, G["loop"]): ("REDUCE", G["arith -> term"]), + (53, G["pool"]): ("REDUCE", G["arith -> term"]), + (53, G["+"]): ("REDUCE", G["arith -> term"]), + (53, G["-"]): ("REDUCE", G["arith -> term"]), + (53, G["in"]): ("REDUCE", G["arith -> term"]), + (53, G["}"]): ("REDUCE", G["arith -> term"]), (53, G["*"]): ("SHIFT", 41), - (54, G["true"]): ("SHIFT", 25), - (54, G["id"]): ("SHIFT", 28), - (54, G["false"]): ("SHIFT", 26), + (53, G["/"]): ("SHIFT", 54), (54, G["new"]): ("SHIFT", 22), + (54, G["int"]): ("SHIFT", 34), + (54, G["false"]): ("SHIFT", 26), + (54, G["true"]): ("SHIFT", 25), + (54, G["~"]): ("SHIFT", 27), (54, G["("]): ("SHIFT", 11), (54, G["isvoid"]): ("SHIFT", 24), - (54, G["~"]): ("SHIFT", 27), - (54, G["int"]): ("SHIFT", 34), + (54, G["id"]): ("SHIFT", 28), (54, G["string"]): ("SHIFT", 33), - (55, G["loop"]): ("REDUCE", G["term -> term / factor"]), - (55, G["error"]): ("REDUCE", G["term -> term / factor"]), - (55, G[")"]): ("REDUCE", G["term -> term / factor"]), - (55, G["+"]): ("REDUCE", G["term -> term / factor"]), - (55, G["pool"]): ("REDUCE", G["term -> term / factor"]), - (55, G["-"]): ("REDUCE", G["term -> term / factor"]), - (55, G["*"]): ("REDUCE", G["term -> term / factor"]), - (55, G["}"]): ("REDUCE", G["term -> term / factor"]), - (55, G["in"]): ("REDUCE", G["term -> term / factor"]), - (55, G["/"]): ("REDUCE", G["term -> term / factor"]), (55, G["of"]): ("REDUCE", G["term -> term / factor"]), (55, G["<"]): ("REDUCE", G["term -> term / factor"]), + (55, G["error"]): ("REDUCE", G["term -> term / factor"]), + (55, G[")"]): ("REDUCE", G["term -> term / factor"]), (55, G["then"]): ("REDUCE", G["term -> term / factor"]), - (55, G[","]): ("REDUCE", G["term -> term / factor"]), (55, G["<="]): ("REDUCE", G["term -> term / factor"]), (55, G["else"]): ("REDUCE", G["term -> term / factor"]), (55, G["="]): ("REDUCE", G["term -> term / factor"]), + (55, G[","]): ("REDUCE", G["term -> term / factor"]), (55, G["fi"]): ("REDUCE", G["term -> term / factor"]), (55, G[";"]): ("REDUCE", G["term -> term / factor"]), - (56, G["loop"]): ("REDUCE", G["term -> factor"]), - (56, G["error"]): ("REDUCE", G["term -> factor"]), - (56, G[")"]): ("REDUCE", G["term -> factor"]), - (56, G["+"]): ("REDUCE", G["term -> factor"]), - (56, G["pool"]): ("REDUCE", G["term -> factor"]), - (56, G["-"]): ("REDUCE", G["term -> factor"]), - (56, G["*"]): ("REDUCE", G["term -> factor"]), - (56, G["}"]): ("REDUCE", G["term -> factor"]), - (56, G["in"]): ("REDUCE", G["term -> factor"]), - (56, G["/"]): ("REDUCE", G["term -> factor"]), + (55, G["loop"]): ("REDUCE", G["term -> term / factor"]), + (55, G["pool"]): ("REDUCE", G["term -> term / factor"]), + (55, G["/"]): ("REDUCE", G["term -> term / factor"]), + (55, G["+"]): ("REDUCE", G["term -> term / factor"]), + (55, G["-"]): ("REDUCE", G["term -> term / factor"]), + (55, G["in"]): ("REDUCE", G["term -> term / factor"]), + (55, G["*"]): ("REDUCE", G["term -> term / factor"]), + (55, G["}"]): ("REDUCE", G["term -> term / factor"]), (56, G["of"]): ("REDUCE", G["term -> factor"]), (56, G["<"]): ("REDUCE", G["term -> factor"]), + (56, G["error"]): ("REDUCE", G["term -> factor"]), + (56, G[")"]): ("REDUCE", G["term -> factor"]), (56, G["then"]): ("REDUCE", G["term -> factor"]), - (56, G[","]): ("REDUCE", G["term -> factor"]), (56, G["<="]): ("REDUCE", G["term -> factor"]), (56, G["else"]): ("REDUCE", G["term -> factor"]), (56, G["="]): ("REDUCE", G["term -> factor"]), + (56, G[","]): ("REDUCE", G["term -> factor"]), (56, G["fi"]): ("REDUCE", G["term -> factor"]), (56, G[";"]): ("REDUCE", G["term -> factor"]), + (56, G["loop"]): ("REDUCE", G["term -> factor"]), + (56, G["pool"]): ("REDUCE", G["term -> factor"]), + (56, G["/"]): ("REDUCE", G["term -> factor"]), + (56, G["+"]): ("REDUCE", G["term -> factor"]), + (56, G["-"]): ("REDUCE", G["term -> factor"]), + (56, G["in"]): ("REDUCE", G["term -> factor"]), + (56, G["*"]): ("REDUCE", G["term -> factor"]), + (56, G["}"]): ("REDUCE", G["term -> factor"]), (57, G["type"]): ("SHIFT", 58), (58, G["."]): ("SHIFT", 59), (59, G["id"]): ("SHIFT", 60), (60, G["("]): ("SHIFT", 61), (61, G["new"]): ("SHIFT", 22), + (61, G["if"]): ("SHIFT", 12), + (61, G["~"]): ("SHIFT", 27), (61, G["id"]): ("SHIFT", 31), - (61, G["true"]): ("SHIFT", 25), - (61, G["isvoid"]): ("SHIFT", 24), - (61, G[")"]): ("REDUCE", G["expr-list -> e"]), - (61, G["not"]): ("SHIFT", 30), - (61, G["int"]): ("SHIFT", 34), (61, G["false"]): ("SHIFT", 26), - (61, G["while"]): ("SHIFT", 13), + (61, G["let"]): ("SHIFT", 14), (61, G["("]): ("SHIFT", 11), + (61, G["string"]): ("SHIFT", 33), + (61, G[")"]): ("REDUCE", G["expr-list -> e"]), + (61, G["while"]): ("SHIFT", 13), (61, G["{"]): ("SHIFT", 10), - (61, G["if"]): ("SHIFT", 12), - (61, G["~"]): ("SHIFT", 27), + (61, G["isvoid"]): ("SHIFT", 24), + (61, G["true"]): ("SHIFT", 25), + (61, G["not"]): ("SHIFT", 30), (61, G["case"]): ("SHIFT", 21), - (61, G["let"]): ("SHIFT", 14), - (61, G["string"]): ("SHIFT", 33), + (61, G["int"]): ("SHIFT", 34), (62, G[")"]): ("SHIFT", 63), - (63, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (64, G["false"]): ("SHIFT", 26), + (63, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (64, G["new"]): ("SHIFT", 22), - (64, G["("]): ("SHIFT", 11), + (64, G["false"]): ("SHIFT", 26), (64, G["true"]): ("SHIFT", 25), - (64, G["int"]): ("SHIFT", 34), + (64, G["("]): ("SHIFT", 11), (64, G["id"]): ("SHIFT", 28), - (64, G["isvoid"]): ("SHIFT", 24), - (64, G["~"]): ("SHIFT", 27), (64, G["string"]): ("SHIFT", 33), + (64, G["int"]): ("SHIFT", 34), + (64, G["~"]): ("SHIFT", 27), + (64, G["isvoid"]): ("SHIFT", 24), (65, G["/"]): ("SHIFT", 54), - (65, G["loop"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["error"]): ("REDUCE", G["arith -> arith - term"]), - (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["pool"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["+"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["-"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["}"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["*"]): ("SHIFT", 41), (65, G["of"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["error"]): ("REDUCE", G["arith -> arith - term"]), (65, G["<"]): ("REDUCE", G["arith -> arith - term"]), + (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), (65, G["then"]): ("REDUCE", G["arith -> arith - term"]), - (65, G[","]): ("REDUCE", G["arith -> arith - term"]), (65, G["<="]): ("REDUCE", G["arith -> arith - term"]), (65, G["else"]): ("REDUCE", G["arith -> arith - term"]), (65, G["="]): ("REDUCE", G["arith -> arith - term"]), + (65, G[","]): ("REDUCE", G["arith -> arith - term"]), (65, G["fi"]): ("REDUCE", G["arith -> arith - term"]), (65, G[";"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["*"]): ("SHIFT", 41), + (65, G["loop"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["pool"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["+"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["-"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["}"]): ("REDUCE", G["arith -> arith - term"]), + (66, G["~"]): ("SHIFT", 27), + (66, G["isvoid"]): ("SHIFT", 24), (66, G["false"]): ("SHIFT", 26), - (66, G["new"]): ("SHIFT", 22), - (66, G["("]): ("SHIFT", 11), (66, G["true"]): ("SHIFT", 25), + (66, G["("]): ("SHIFT", 11), (66, G["id"]): ("SHIFT", 28), - (66, G["~"]): ("SHIFT", 27), - (66, G["isvoid"]): ("SHIFT", 24), - (66, G["int"]): ("SHIFT", 34), (66, G["string"]): ("SHIFT", 33), - (67, G["in"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), + (66, G["int"]): ("SHIFT", 34), + (66, G["new"]): ("SHIFT", 22), + (67, G["-"]): ("SHIFT", 64), + (67, G["+"]): ("SHIFT", 39), + (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), (67, G["else"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["in"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["}"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["-"]): ("SHIFT", 64), - (67, G["+"]): ("SHIFT", 39), + (68, G["~"]): ("SHIFT", 27), + (68, G["isvoid"]): ("SHIFT", 24), (68, G["false"]): ("SHIFT", 26), - (68, G["new"]): ("SHIFT", 22), - (68, G["("]): ("SHIFT", 11), (68, G["true"]): ("SHIFT", 25), + (68, G["("]): ("SHIFT", 11), (68, G["id"]): ("SHIFT", 28), - (68, G["~"]): ("SHIFT", 27), - (68, G["isvoid"]): ("SHIFT", 24), - (68, G["int"]): ("SHIFT", 34), (68, G["string"]): ("SHIFT", 33), - (69, G["-"]): ("SHIFT", 64), - (69, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), + (68, G["int"]): ("SHIFT", 34), + (68, G["new"]): ("SHIFT", 22), + (69, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["-"]): ("SHIFT", 64), (69, G["+"]): ("SHIFT", 39), + (70, G["~"]): ("SHIFT", 27), + (70, G["isvoid"]): ("SHIFT", 24), (70, G["false"]): ("SHIFT", 26), - (70, G["new"]): ("SHIFT", 22), - (70, G["("]): ("SHIFT", 11), (70, G["true"]): ("SHIFT", 25), + (70, G["("]): ("SHIFT", 11), (70, G["id"]): ("SHIFT", 28), - (70, G["~"]): ("SHIFT", 27), - (70, G["isvoid"]): ("SHIFT", 24), - (70, G["int"]): ("SHIFT", 34), (70, G["string"]): ("SHIFT", 33), - (71, G["in"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), + (70, G["int"]): ("SHIFT", 34), + (70, G["new"]): ("SHIFT", 22), + (71, G[";"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["error"]): ("REDUCE", G["comp -> arith = arith"]), (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), (71, G["else"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["in"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[";"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["}"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["-"]): ("SHIFT", 64), (71, G["+"]): ("SHIFT", 39), - (72, G["in"]): ("REDUCE", G["expr -> not expr"]), - (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), + (71, G["-"]): ("SHIFT", 64), + (72, G[";"]): ("REDUCE", G["expr -> not expr"]), (72, G["of"]): ("REDUCE", G["expr -> not expr"]), + (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), (72, G["error"]): ("REDUCE", G["expr -> not expr"]), (72, G[")"]): ("REDUCE", G["expr -> not expr"]), (72, G["pool"]): ("REDUCE", G["expr -> not expr"]), (72, G["then"]): ("REDUCE", G["expr -> not expr"]), - (72, G[","]): ("REDUCE", G["expr -> not expr"]), (72, G["else"]): ("REDUCE", G["expr -> not expr"]), - (72, G["fi"]): ("REDUCE", G["expr -> not expr"]), - (72, G[";"]): ("REDUCE", G["expr -> not expr"]), - (72, G["}"]): ("REDUCE", G["expr -> not expr"]), - (73, G[")"]): ("SHIFT", 74), - (74, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (72, G[","]): ("REDUCE", G["expr -> not expr"]), + (72, G["in"]): ("REDUCE", G["expr -> not expr"]), + (72, G["fi"]): ("REDUCE", G["expr -> not expr"]), + (72, G["}"]): ("REDUCE", G["expr -> not expr"]), + (73, G[")"]): ("SHIFT", 74), (74, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G[")"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["+"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["-"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["*"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["}"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["/"]): ("REDUCE", G["factor -> ~ factor"]), + (74, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (75, G["of"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["<"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G[")"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["then"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G[","]): ("REDUCE", G["factor -> ~ factor"]), (75, G["<="]): ("REDUCE", G["factor -> ~ factor"]), (75, G["else"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["="]): ("REDUCE", G["factor -> ~ factor"]), + (75, G[","]): ("REDUCE", G["factor -> ~ factor"]), (75, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), (75, G[";"]): ("REDUCE", G["factor -> ~ factor"]), - (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), + (75, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["/"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["+"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["-"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["*"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["}"]): ("REDUCE", G["factor -> ~ factor"]), (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), (77, G["of"]): ("SHIFT", 78), (78, G["id"]): ("SHIFT", 79), (79, G[":"]): ("SHIFT", 80), (80, G["type"]): ("SHIFT", 81), (81, G["=>"]): ("SHIFT", 82), + (82, G["~"]): ("SHIFT", 27), (82, G["new"]): ("SHIFT", 22), - (82, G["true"]): ("SHIFT", 25), - (82, G["isvoid"]): ("SHIFT", 24), (82, G["id"]): ("SHIFT", 31), - (82, G["int"]): ("SHIFT", 34), (82, G["false"]): ("SHIFT", 26), - (82, G["not"]): ("SHIFT", 30), + (82, G["case"]): ("SHIFT", 21), (82, G["("]): ("SHIFT", 11), - (82, G["while"]): ("SHIFT", 13), - (82, G["~"]): ("SHIFT", 27), - (82, G["{"]): ("SHIFT", 10), - (82, G["if"]): ("SHIFT", 12), (82, G["string"]): ("SHIFT", 33), - (82, G["case"]): ("SHIFT", 21), + (82, G["not"]): ("SHIFT", 30), + (82, G["if"]): ("SHIFT", 12), + (82, G["isvoid"]): ("SHIFT", 24), (82, G["let"]): ("SHIFT", 14), - (83, G[";"]): ("SHIFT", 84), + (82, G["true"]): ("SHIFT", 25), + (82, G["while"]): ("SHIFT", 13), + (82, G["int"]): ("SHIFT", 34), + (82, G["{"]): ("SHIFT", 10), (83, G["error"]): ("SHIFT", 86), + (83, G[";"]): ("SHIFT", 84), (84, G["id"]): ("SHIFT", 79), (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), (86, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), (87, G["esac"]): ("SHIFT", 88), - (88, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G[","]): ("SHIFT", 90), (89, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), (90, G["id"]): ("SHIFT", 15), (91, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), (92, G["in"]): ("SHIFT", 93), - (93, G["false"]): ("SHIFT", 26), - (93, G["("]): ("SHIFT", 11), - (93, G["id"]): ("SHIFT", 31), - (93, G["isvoid"]): ("SHIFT", 24), - (93, G["string"]): ("SHIFT", 33), - (93, G["not"]): ("SHIFT", 30), - (93, G["new"]): ("SHIFT", 22), - (93, G["while"]): ("SHIFT", 13), (93, G["true"]): ("SHIFT", 25), - (93, G["int"]): ("SHIFT", 34), - (93, G["{"]): ("SHIFT", 10), (93, G["if"]): ("SHIFT", 12), (93, G["let"]): ("SHIFT", 14), + (93, G["int"]): ("SHIFT", 34), (93, G["~"]): ("SHIFT", 27), + (93, G["id"]): ("SHIFT", 31), + (93, G["while"]): ("SHIFT", 13), + (93, G["new"]): ("SHIFT", 22), + (93, G["{"]): ("SHIFT", 10), + (93, G["false"]): ("SHIFT", 26), + (93, G["("]): ("SHIFT", 11), + (93, G["string"]): ("SHIFT", 33), (93, G["case"]): ("SHIFT", 21), - (94, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["not"]): ("SHIFT", 30), + (93, G["isvoid"]): ("SHIFT", 24), + (94, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["loop"]): ("SHIFT", 96), - (96, G["string"]): ("SHIFT", 33), - (96, G["not"]): ("SHIFT", 30), - (96, G["new"]): ("SHIFT", 22), - (96, G["while"]): ("SHIFT", 13), - (96, G["~"]): ("SHIFT", 27), - (96, G["true"]): ("SHIFT", 25), - (96, G["{"]): ("SHIFT", 10), (96, G["if"]): ("SHIFT", 12), - (96, G["id"]): ("SHIFT", 31), - (96, G["case"]): ("SHIFT", 21), - (96, G["int"]): ("SHIFT", 34), + (96, G["true"]): ("SHIFT", 25), (96, G["let"]): ("SHIFT", 14), - (96, G["false"]): ("SHIFT", 26), (96, G["isvoid"]): ("SHIFT", 24), + (96, G["int"]): ("SHIFT", 34), + (96, G["id"]): ("SHIFT", 31), + (96, G["while"]): ("SHIFT", 13), + (96, G["{"]): ("SHIFT", 10), + (96, G["new"]): ("SHIFT", 22), + (96, G["false"]): ("SHIFT", 26), (96, G["("]): ("SHIFT", 11), + (96, G["~"]): ("SHIFT", 27), + (96, G["string"]): ("SHIFT", 33), + (96, G["case"]): ("SHIFT", 21), + (96, G["not"]): ("SHIFT", 30), (97, G["pool"]): ("SHIFT", 98), - (98, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["then"]): ("SHIFT", 100), + (100, G["if"]): ("SHIFT", 12), (100, G["~"]): ("SHIFT", 27), - (100, G["("]): ("SHIFT", 11), + (100, G["new"]): ("SHIFT", 22), + (100, G["let"]): ("SHIFT", 14), (100, G["id"]): ("SHIFT", 31), + (100, G["false"]): ("SHIFT", 26), + (100, G["("]): ("SHIFT", 11), (100, G["string"]): ("SHIFT", 33), - (100, G["new"]): ("SHIFT", 22), - (100, G["not"]): ("SHIFT", 30), - (100, G["isvoid"]): ("SHIFT", 24), - (100, G["true"]): ("SHIFT", 25), (100, G["while"]): ("SHIFT", 13), - (100, G["int"]): ("SHIFT", 34), (100, G["{"]): ("SHIFT", 10), - (100, G["if"]): ("SHIFT", 12), - (100, G["false"]): ("SHIFT", 26), - (100, G["let"]): ("SHIFT", 14), + (100, G["isvoid"]): ("SHIFT", 24), + (100, G["true"]): ("SHIFT", 25), + (100, G["not"]): ("SHIFT", 30), (100, G["case"]): ("SHIFT", 21), + (100, G["int"]): ("SHIFT", 34), (101, G["else"]): ("SHIFT", 102), - (102, G["string"]): ("SHIFT", 33), - (102, G["while"]): ("SHIFT", 13), - (102, G["new"]): ("SHIFT", 22), - (102, G["{"]): ("SHIFT", 10), - (102, G["if"]): ("SHIFT", 12), + (102, G["let"]): ("SHIFT", 14), (102, G["~"]): ("SHIFT", 27), (102, G["true"]): ("SHIFT", 25), - (102, G["case"]): ("SHIFT", 21), - (102, G["let"]): ("SHIFT", 14), (102, G["id"]): ("SHIFT", 31), + (102, G["while"]): ("SHIFT", 13), + (102, G["{"]): ("SHIFT", 10), (102, G["int"]): ("SHIFT", 34), + (102, G["new"]): ("SHIFT", 22), + (102, G["case"]): ("SHIFT", 21), + (102, G["not"]): ("SHIFT", 30), (102, G["false"]): ("SHIFT", 26), (102, G["isvoid"]): ("SHIFT", 24), (102, G["("]): ("SHIFT", 11), - (102, G["not"]): ("SHIFT", 30), + (102, G["string"]): ("SHIFT", 33), + (102, G["if"]): ("SHIFT", 12), (103, G["fi"]): ("SHIFT", 104), - (104, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G[")"]): ("SHIFT", 106), - (106, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["@"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["error"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G[")"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["+"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["-"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["*"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["}"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["in"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["/"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["of"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["."]): ("REDUCE", G["atom -> ( expr )"]), (106, G["<"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["error"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G[")"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["then"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G[","]): ("REDUCE", G["atom -> ( expr )"]), (106, G["<="]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["."]): ("REDUCE", G["atom -> ( expr )"]), (106, G["else"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["="]): ("REDUCE", G["atom -> ( expr )"]), + (106, G[","]): ("REDUCE", G["atom -> ( expr )"]), (106, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), (106, G[";"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["@"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["/"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["+"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["-"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["in"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["*"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["}"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["}"]): ("SHIFT", 108), - (108, G["in"]): ("REDUCE", G["expr -> { block }"]), - (108, G["loop"]): ("REDUCE", G["expr -> { block }"]), + (108, G[";"]): ("REDUCE", G["expr -> { block }"]), (108, G["of"]): ("REDUCE", G["expr -> { block }"]), + (108, G["loop"]): ("REDUCE", G["expr -> { block }"]), (108, G["error"]): ("REDUCE", G["expr -> { block }"]), (108, G[")"]): ("REDUCE", G["expr -> { block }"]), (108, G["pool"]): ("REDUCE", G["expr -> { block }"]), (108, G["then"]): ("REDUCE", G["expr -> { block }"]), - (108, G[","]): ("REDUCE", G["expr -> { block }"]), (108, G["else"]): ("REDUCE", G["expr -> { block }"]), + (108, G[","]): ("REDUCE", G["expr -> { block }"]), + (108, G["in"]): ("REDUCE", G["expr -> { block }"]), (108, G["fi"]): ("REDUCE", G["expr -> { block }"]), - (108, G[";"]): ("REDUCE", G["expr -> { block }"]), (108, G["}"]): ("REDUCE", G["expr -> { block }"]), (109, G[";"]): ("SHIFT", 110), - (110, G["id"]): ("SHIFT", 31), - (110, G["not"]): ("SHIFT", 30), - (110, G["string"]): ("SHIFT", 33), - (110, G["new"]): ("SHIFT", 22), (110, G["while"]): ("SHIFT", 13), - (110, G["isvoid"]): ("SHIFT", 24), (110, G["{"]): ("SHIFT", 10), - (110, G["true"]): ("SHIFT", 25), - (110, G["if"]): ("SHIFT", 12), - (110, G["case"]): ("SHIFT", 21), - (110, G["let"]): ("SHIFT", 14), + (110, G["~"]): ("SHIFT", 27), (110, G["int"]): ("SHIFT", 34), + (110, G["case"]): ("SHIFT", 21), + (110, G["not"]): ("SHIFT", 30), + (110, G["new"]): ("SHIFT", 22), + (110, G["id"]): ("SHIFT", 31), (110, G["false"]): ("SHIFT", 26), (110, G["}"]): ("REDUCE", G["block -> expr ;"]), - (110, G["~"]): ("SHIFT", 27), (110, G["("]): ("SHIFT", 11), + (110, G["string"]): ("SHIFT", 33), + (110, G["if"]): ("SHIFT", 12), + (110, G["isvoid"]): ("SHIFT", 24), + (110, G["let"]): ("SHIFT", 14), + (110, G["true"]): ("SHIFT", 25), (111, G["}"]): ("REDUCE", G["block -> expr ; block"]), (112, G["}"]): ("SHIFT", 113), - (113, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), (113, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (113, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), (114, G[":"]): ("SHIFT", 115), (115, G["type"]): ("SHIFT", 116), (116, G[","]): ("SHIFT", 117), @@ -1040,55 +1040,55 @@ def __action_table(): (120, G[":"]): ("SHIFT", 121), (121, G["type"]): ("SHIFT", 122), (122, G["{"]): ("SHIFT", 123), + (123, G["true"]): ("SHIFT", 25), + (123, G["id"]): ("SHIFT", 31), + (123, G["while"]): ("SHIFT", 13), + (123, G["{"]): ("SHIFT", 10), + (123, G["~"]): ("SHIFT", 27), + (123, G["int"]): ("SHIFT", 34), + (123, G["new"]): ("SHIFT", 22), + (123, G["case"]): ("SHIFT", 21), + (123, G["not"]): ("SHIFT", 30), (123, G["false"]): ("SHIFT", 26), - (123, G["id"]): ("SHIFT", 31), (123, G["("]): ("SHIFT", 11), - (123, G["not"]): ("SHIFT", 30), - (123, G["isvoid"]): ("SHIFT", 24), (123, G["string"]): ("SHIFT", 33), - (123, G["while"]): ("SHIFT", 13), - (123, G["new"]): ("SHIFT", 22), - (123, G["{"]): ("SHIFT", 10), + (123, G["isvoid"]): ("SHIFT", 24), (123, G["if"]): ("SHIFT", 12), - (123, G["true"]): ("SHIFT", 25), - (123, G["case"]): ("SHIFT", 21), (123, G["let"]): ("SHIFT", 14), - (123, G["int"]): ("SHIFT", 34), - (123, G["~"]): ("SHIFT", 27), (124, G["}"]): ("SHIFT", 125), - (125, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (125, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (125, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (126, G["type"]): ("SHIFT", 127), (127, G["<-"]): ("SHIFT", 128), - (127, G["error"]): ("REDUCE", G["attribute -> id : type"]), (127, G[";"]): ("REDUCE", G["attribute -> id : type"]), + (127, G["error"]): ("REDUCE", G["attribute -> id : type"]), + (128, G["~"]): ("SHIFT", 27), (128, G["new"]): ("SHIFT", 22), - (128, G["true"]): ("SHIFT", 25), - (128, G["isvoid"]): ("SHIFT", 24), (128, G["id"]): ("SHIFT", 31), - (128, G["int"]): ("SHIFT", 34), (128, G["false"]): ("SHIFT", 26), - (128, G["not"]): ("SHIFT", 30), (128, G["("]): ("SHIFT", 11), - (128, G["while"]): ("SHIFT", 13), - (128, G["~"]): ("SHIFT", 27), - (128, G["{"]): ("SHIFT", 10), - (128, G["if"]): ("SHIFT", 12), - (128, G["string"]): ("SHIFT", 33), (128, G["case"]): ("SHIFT", 21), + (128, G["string"]): ("SHIFT", 33), + (128, G["not"]): ("SHIFT", 30), + (128, G["if"]): ("SHIFT", 12), + (128, G["isvoid"]): ("SHIFT", 24), (128, G["let"]): ("SHIFT", 14), - (129, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (128, G["true"]): ("SHIFT", 25), + (128, G["while"]): ("SHIFT", 13), + (128, G["int"]): ("SHIFT", 34), + (128, G["{"]): ("SHIFT", 10), (129, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (129, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), (130, G["}"]): ("SHIFT", 131), - (131, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), (131, G["class"]): ("REDUCE", G["class-def -> class type { feature-list }"]), - (132, G["error"]): ("SHIFT", 140), + (131, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), (132, G[";"]): ("SHIFT", 133), + (132, G["error"]): ("SHIFT", 140), (133, G["id"]): ("SHIFT", 4), (133, G["}"]): ("REDUCE", G["feature-list -> e"]), (134, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), - (135, G["error"]): ("SHIFT", 138), (135, G[";"]): ("SHIFT", 136), + (135, G["error"]): ("SHIFT", 138), (136, G["id"]): ("SHIFT", 4), (136, G["}"]): ("REDUCE", G["feature-list -> e"]), (137, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), @@ -1103,237 +1103,237 @@ def __action_table(): (144, G["id"]): ("SHIFT", 4), (144, G["}"]): ("REDUCE", G["feature-list -> e"]), (145, G["}"]): ("SHIFT", 146), - (146, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), (146, G["class"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), + (146, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), (147, G["$"]): ("OK", None), (148, G["$"]): ("REDUCE", G["program -> class-list"]), - (149, G["$"]): ("REDUCE", G["class-list -> class-def"]), (149, G["class"]): ("SHIFT", 1), + (149, G["$"]): ("REDUCE", G["class-list -> class-def"]), (150, G["$"]): ("REDUCE", G["class-list -> class-def class-list"]), } @staticmethod def __goto_table(): return { - (0, G["program"]): 147, (0, G["class-list"]): 148, + (0, G["program"]): 147, (0, G["class-def"]): 149, (3, G["attribute"]): 132, - (3, G["feature-list"]): 130, (3, G["method"]): 135, + (3, G["feature-list"]): 130, (5, G["param-list"]): 119, + (9, G["arith"]): 38, (9, G["term"]): 53, + (9, G["comp"]): 37, (9, G["atom"]): 43, (9, G["function-call"]): 35, (9, G["expr"]): 112, - (9, G["comp"]): 37, - (9, G["arith"]): 38, (9, G["factor"]): 56, - (10, G["function-call"]): 35, + (10, G["arith"]): 38, (10, G["term"]): 53, (10, G["block"]): 107, - (10, G["comp"]): 37, (10, G["atom"]): 43, - (10, G["arith"]): 38, (10, G["expr"]): 109, + (10, G["function-call"]): 35, (10, G["factor"]): 56, + (10, G["comp"]): 37, (11, G["arith"]): 38, (11, G["factor"]): 56, + (11, G["expr"]): 105, (11, G["term"]): 53, + (11, G["atom"]): 43, (11, G["function-call"]): 35, (11, G["comp"]): 37, - (11, G["atom"]): 43, - (11, G["expr"]): 105, (12, G["term"]): 53, - (12, G["function-call"]): 35, - (12, G["atom"]): 43, - (12, G["comp"]): 37, + (12, G["factor"]): 56, (12, G["arith"]): 38, + (12, G["comp"]): 37, + (12, G["atom"]): 43, + (12, G["function-call"]): 35, (12, G["expr"]): 99, - (12, G["factor"]): 56, - (13, G["term"]): 53, - (13, G["atom"]): 43, (13, G["expr"]): 95, - (13, G["comp"]): 37, - (13, G["arith"]): 38, + (13, G["term"]): 53, (13, G["factor"]): 56, + (13, G["arith"]): 38, + (13, G["comp"]): 37, + (13, G["atom"]): 43, (13, G["function-call"]): 35, (14, G["declaration-list"]): 92, (18, G["declaration-list"]): 19, - (20, G["atom"]): 43, - (20, G["expr"]): 89, (20, G["arith"]): 38, + (20, G["expr"]): 89, (20, G["term"]): 53, - (20, G["factor"]): 56, - (20, G["function-call"]): 35, (20, G["comp"]): 37, - (21, G["comp"]): 37, + (20, G["atom"]): 43, + (20, G["function-call"]): 35, + (20, G["factor"]): 56, (21, G["arith"]): 38, - (21, G["atom"]): 43, + (21, G["term"]): 53, (21, G["factor"]): 56, - (21, G["function-call"]): 35, (21, G["expr"]): 77, - (21, G["term"]): 53, - (24, G["function-call"]): 35, + (21, G["comp"]): 37, + (21, G["atom"]): 43, + (21, G["function-call"]): 35, (24, G["atom"]): 43, (24, G["factor"]): 76, - (27, G["function-call"]): 35, - (27, G["factor"]): 75, + (24, G["function-call"]): 35, (27, G["atom"]): 43, - (29, G["expr"]): 50, - (29, G["atom"]): 43, - (29, G["not-empty-expr-list"]): 49, - (29, G["comp"]): 37, + (27, G["factor"]): 75, + (27, G["function-call"]): 35, (29, G["arith"]): 38, - (29, G["expr-list"]): 73, + (29, G["term"]): 53, + (29, G["atom"]): 43, (29, G["function-call"]): 35, + (29, G["comp"]): 37, + (29, G["not-empty-expr-list"]): 49, + (29, G["expr"]): 50, (29, G["factor"]): 56, - (29, G["term"]): 53, - (30, G["expr"]): 72, + (29, G["expr-list"]): 73, (30, G["term"]): 53, + (30, G["factor"]): 56, (30, G["arith"]): 38, - (30, G["function-call"]): 35, - (30, G["atom"]): 43, + (30, G["expr"]): 72, (30, G["comp"]): 37, - (30, G["factor"]): 56, + (30, G["atom"]): 43, + (30, G["function-call"]): 35, (32, G["term"]): 53, + (32, G["factor"]): 56, (32, G["arith"]): 38, - (32, G["function-call"]): 35, + (32, G["comp"]): 37, (32, G["atom"]): 43, (32, G["expr"]): 36, - (32, G["comp"]): 37, - (32, G["factor"]): 56, + (32, G["function-call"]): 35, (39, G["term"]): 40, - (39, G["function-call"]): 35, - (39, G["atom"]): 43, (39, G["factor"]): 56, - (41, G["function-call"]): 35, - (41, G["factor"]): 42, + (39, G["atom"]): 43, + (39, G["function-call"]): 35, (41, G["atom"]): 43, - (46, G["expr-list"]): 47, - (46, G["expr"]): 50, - (46, G["atom"]): 43, - (46, G["not-empty-expr-list"]): 49, - (46, G["comp"]): 37, + (41, G["factor"]): 42, + (41, G["function-call"]): 35, (46, G["arith"]): 38, + (46, G["term"]): 53, + (46, G["atom"]): 43, (46, G["function-call"]): 35, + (46, G["comp"]): 37, + (46, G["not-empty-expr-list"]): 49, + (46, G["expr"]): 50, (46, G["factor"]): 56, - (46, G["term"]): 53, - (51, G["expr"]): 50, - (51, G["atom"]): 43, - (51, G["not-empty-expr-list"]): 52, - (51, G["comp"]): 37, + (46, G["expr-list"]): 47, (51, G["arith"]): 38, + (51, G["term"]): 53, + (51, G["atom"]): 43, (51, G["function-call"]): 35, + (51, G["comp"]): 37, + (51, G["expr"]): 50, (51, G["factor"]): 56, - (51, G["term"]): 53, - (54, G["function-call"]): 35, + (51, G["not-empty-expr-list"]): 52, (54, G["factor"]): 55, (54, G["atom"]): 43, - (61, G["expr"]): 50, - (61, G["atom"]): 43, - (61, G["expr-list"]): 62, - (61, G["not-empty-expr-list"]): 49, - (61, G["comp"]): 37, + (54, G["function-call"]): 35, (61, G["arith"]): 38, + (61, G["term"]): 53, + (61, G["atom"]): 43, (61, G["function-call"]): 35, + (61, G["comp"]): 37, + (61, G["not-empty-expr-list"]): 49, + (61, G["expr"]): 50, (61, G["factor"]): 56, - (61, G["term"]): 53, + (61, G["expr-list"]): 62, (64, G["term"]): 65, - (64, G["function-call"]): 35, - (64, G["atom"]): 43, (64, G["factor"]): 56, + (64, G["atom"]): 43, + (64, G["function-call"]): 35, + (66, G["atom"]): 43, + (66, G["arith"]): 67, (66, G["term"]): 53, - (66, G["function-call"]): 35, (66, G["factor"]): 56, - (66, G["arith"]): 67, - (66, G["atom"]): 43, - (68, G["term"]): 53, + (66, G["function-call"]): 35, + (68, G["atom"]): 43, (68, G["arith"]): 69, - (68, G["function-call"]): 35, + (68, G["term"]): 53, (68, G["factor"]): 56, - (68, G["atom"]): 43, + (68, G["function-call"]): 35, + (70, G["atom"]): 43, + (70, G["arith"]): 71, (70, G["term"]): 53, - (70, G["function-call"]): 35, (70, G["factor"]): 56, - (70, G["arith"]): 71, - (70, G["atom"]): 43, + (70, G["function-call"]): 35, (78, G["case-list"]): 87, - (82, G["arith"]): 38, - (82, G["atom"]): 43, - (82, G["comp"]): 37, + (82, G["term"]): 53, (82, G["expr"]): 83, + (82, G["atom"]): 43, + (82, G["arith"]): 38, (82, G["function-call"]): 35, - (82, G["term"]): 53, (82, G["factor"]): 56, + (82, G["comp"]): 37, (84, G["case-list"]): 85, (90, G["declaration-list"]): 91, (93, G["term"]): 53, + (93, G["factor"]): 56, (93, G["arith"]): 38, - (93, G["function-call"]): 35, - (93, G["atom"]): 43, - (93, G["comp"]): 37, (93, G["expr"]): 94, - (93, G["factor"]): 56, + (93, G["comp"]): 37, + (93, G["atom"]): 43, + (93, G["function-call"]): 35, + (96, G["expr"]): 97, (96, G["arith"]): 38, (96, G["comp"]): 37, - (96, G["factor"]): 56, - (96, G["expr"]): 97, (96, G["term"]): 53, + (96, G["factor"]): 56, (96, G["atom"]): 43, (96, G["function-call"]): 35, - (100, G["function-call"]): 35, - (100, G["arith"]): 38, (100, G["term"]): 53, + (100, G["arith"]): 38, (100, G["atom"]): 43, - (100, G["expr"]): 101, + (100, G["function-call"]): 35, (100, G["comp"]): 37, (100, G["factor"]): 56, - (102, G["comp"]): 37, + (100, G["expr"]): 101, (102, G["arith"]): 38, - (102, G["factor"]): 56, (102, G["term"]): 53, + (102, G["comp"]): 37, (102, G["atom"]): 43, - (102, G["expr"]): 103, (102, G["function-call"]): 35, - (110, G["function-call"]): 35, + (102, G["factor"]): 56, + (102, G["expr"]): 103, + (110, G["arith"]): 38, (110, G["term"]): 53, - (110, G["comp"]): 37, (110, G["atom"]): 43, - (110, G["arith"]): 38, (110, G["expr"]): 109, + (110, G["function-call"]): 35, (110, G["block"]): 111, (110, G["factor"]): 56, + (110, G["comp"]): 37, (117, G["param-list"]): 118, + (123, G["arith"]): 38, (123, G["term"]): 53, - (123, G["atom"]): 43, - (123, G["function-call"]): 35, (123, G["comp"]): 37, - (123, G["arith"]): 38, (123, G["expr"]): 124, + (123, G["atom"]): 43, + (123, G["function-call"]): 35, (123, G["factor"]): 56, - (128, G["arith"]): 38, + (128, G["term"]): 53, (128, G["atom"]): 43, - (128, G["expr"]): 129, - (128, G["comp"]): 37, + (128, G["arith"]): 38, (128, G["function-call"]): 35, - (128, G["term"]): 53, + (128, G["expr"]): 129, (128, G["factor"]): 56, + (128, G["comp"]): 37, (133, G["attribute"]): 132, - (133, G["feature-list"]): 134, (133, G["method"]): 135, - (136, G["attribute"]): 132, + (133, G["feature-list"]): 134, (136, G["feature-list"]): 137, + (136, G["attribute"]): 132, (136, G["method"]): 135, (138, G["attribute"]): 132, - (138, G["method"]): 135, (138, G["feature-list"]): 139, + (138, G["method"]): 135, (140, G["attribute"]): 132, (140, G["feature-list"]): 141, (140, G["method"]): 135, + (144, G["feature-list"]): 145, (144, G["attribute"]): 132, (144, G["method"]): 135, - (144, G["feature-list"]): 145, - (149, G["class-def"]): 149, (149, G["class-list"]): 150, + (149, G["class-def"]): 149, } diff --git a/cmp/__init__.py b/pyjapt/__init__.py similarity index 100% rename from cmp/__init__.py rename to pyjapt/__init__.py diff --git a/cmp/automata.py b/pyjapt/automata.py similarity index 100% rename from cmp/automata.py rename to pyjapt/automata.py diff --git a/cmp/pycompiler.py b/pyjapt/grammar.py similarity index 100% rename from cmp/pycompiler.py rename to pyjapt/grammar.py diff --git a/cmp/lexing.py b/pyjapt/lexing.py similarity index 100% rename from cmp/lexing.py rename to pyjapt/lexing.py diff --git a/cmp/parsing.py b/pyjapt/parsing.py similarity index 99% rename from cmp/parsing.py rename to pyjapt/parsing.py index 4e8e4ade8..a12d3043a 100755 --- a/cmp/parsing.py +++ b/pyjapt/parsing.py @@ -1,8 +1,8 @@ import sys -from cmp.automata import State -from cmp.pycompiler import Item, RuleList -from cmp.utils import ContainerSet +from pyjapt.automata import State +from pyjapt.grammar import Item, RuleList +from pyjapt.utils import ContainerSet ############################## diff --git a/cmp/serialization.py b/pyjapt/serialization.py similarity index 97% rename from cmp/serialization.py rename to pyjapt/serialization.py index 26dcda38d..b4f5542d8 100755 --- a/cmp/serialization.py +++ b/pyjapt/serialization.py @@ -1,7 +1,7 @@ import re PARSER_TEMPLATE = """from abc import ABC -from cmp.parsing import ShiftReduceParser +from pyjapt.parsing import ShiftReduceParser from %s import %s @@ -23,7 +23,7 @@ def __goto_table(): LEXER_TEMPLATE = """import re -from cmp.lexing import Token, Lexer +from pyjapt.lexing import Token, Lexer from %s import %s diff --git a/cmp/utils.py b/pyjapt/utils.py similarity index 100% rename from cmp/utils.py rename to pyjapt/utils.py diff --git a/semantics/type_inference.py b/semantics/type_inference.py index 988356e3a..9c9156021 100644 --- a/semantics/type_inference.py +++ b/semantics/type_inference.py @@ -497,9 +497,8 @@ def visit(self, node: ast.ClassDeclarationNode, scope: Scope): i += 1 self.visit(attr, scope) - for method in methods: + for i, method in enumerate(methods, i): self.visit(method, scope.children[i]) - i += 1 @visitor.when(ast.AttrDeclarationNode) def visit(self, node: ast.AttrDeclarationNode, scope: Scope): @@ -548,18 +547,6 @@ def visit(self, node: ast.LetNode, scope: Scope): node.declarations[i] = (_id, variable_info.type.name, _expr) self.visit(node.expr, scope.children[child_index]) - # - # @visitor.when(ast.VarDeclarationNode) - # def visit(self, node: ast.VarDeclarationNode, scope: Scope): - # variable_info = scope.find_variable(node.id) - # - # if node.expr is not None: - # self.visit(node.expr, scope.children[0]) - # - # if node.type == 'AUTO_TYPE': - # if variable_info.type == self.context.get_type('AUTO_TYPE'): - # self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % node.id) - # node.type = variable_info.type.name @visitor.when(ast.AssignNode) def visit(self, node: ast.AssignNode, scope: Scope): diff --git a/semantics/utils/scope.py b/semantics/utils/scope.py index c424d10d7..5eb851086 100755 --- a/semantics/utils/scope.py +++ b/semantics/utils/scope.py @@ -263,5 +263,8 @@ def is_defined(self, vname) -> bool: def is_local(self, vname: str) -> bool: return vname in self.locals + def clear(self): + self.children = [] + def __len__(self): return len(self.locals) diff --git a/tester.py b/tester.py index e1d8f7045..bc0952bc5 100755 --- a/tester.py +++ b/tester.py @@ -3,10 +3,10 @@ import fire -from cmp.lexing import Token +from pyjapt.lexing import Token from lexer import CoolLexer from parser import CoolParser -from semantics.semantic import Formatter +from semantics.formatter import Formatter lexer = CoolLexer() parser = CoolParser() From ea66c43f743d77086ecd64bf1929e245ed0c7b02 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Mon, 25 May 2020 03:57:51 -0400 Subject: [PATCH 058/143] Updated Informe.md --- docs/Informe.md | 4 ++-- main.py | 4 ++++ pyjapt/parsing.py | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/Informe.md b/docs/Informe.md index 0b9024dd8..11b1e144f 100644 --- a/docs/Informe.md +++ b/docs/Informe.md @@ -23,7 +23,7 @@ PyJapt es un generador de lexer y parser desarrolado por los autores del proyecto que pretende dar una solucion no solo a la creacion de estas piezas del proceso de compilacion, sino tambien permitir una interfaz de manejo de errores sintacticos y lexicograficos personalizados. Para su construccion nos hemos basado en las construcciones realizadas en las clases practicas y nos hemos inspirado en otros generadores de parser para las nuevas funcionalidades como yacc, bison, ply y antlr por ejemplo. -PyJapt gira alrededor del concepto de gramatica. +PyJapt gira alrededor del concepto de gramatica. Para definir los no terminales de la gramatiga utilizamos el metodo `add_non_terminal()` de la clase `Grammar`. @@ -150,7 +150,7 @@ G.add_terminal_error() # Agrega el terminal de error a la gramatica. @G.production("instruction -> let id = expr error") def attribute_error(s): # Con esta linea reportamos el mensaje del error - # Como la regla semantica de s es el propio token entonces tenemos acceso + # Como la regla semantica de s[5] es el propio token (por ser un terminal) entonces tenemos acceso # a su lexema, tipo de token, line y columna. s.error(f"{s[5].line, s[5].column} - SyntacticError: Expected ';' instead of '{s[5].lex}'") diff --git a/main.py b/main.py index 81fd7e83a..981e24086 100755 --- a/main.py +++ b/main.py @@ -105,6 +105,10 @@ class Main inherits IO { number: Int <- 5; main () : Object { + 0 + }; + + testing_case() : IO { let a: A <- new C in case a of x: B => out_string("Is type B.\n"); diff --git a/pyjapt/parsing.py b/pyjapt/parsing.py index a12d3043a..1af80a8db 100755 --- a/pyjapt/parsing.py +++ b/pyjapt/parsing.py @@ -396,7 +396,7 @@ def __call__(self, tokens): stack += [lookahead.token_type, lookahead.lex, tag] cursor += 1 except KeyError: - # If en error insertion fails then the parsing process enter into a panic mode recovery + # If an error insertion fails then the parsing process enter into a panic mode recovery sys.stderr.write( f'{lookahead.line, lookahead.column} - SyntacticError: ERROR at or near "{lookahead.lex}"\n') while (state, lookahead.token_type) not in self.action: From 72cfc64d3d68527d755b4ae7bb7c443fcbefaec9 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Mon, 25 May 2020 16:16:14 -0400 Subject: [PATCH 059/143] Updated Readme.md --- __init__.py | 0 docs/Informe.md | 124 +++++++++++++++++++---------------- grammar.py | 4 +- main.py | 2 +- semantics/progam_executor.py | 2 +- semantics/type_inference.py | 4 +- tests/parser/assignment1.cl | 2 +- 7 files changed, 75 insertions(+), 63 deletions(-) delete mode 100755 __init__.py diff --git a/__init__.py b/__init__.py deleted file mode 100755 index e69de29bb..000000000 diff --git a/docs/Informe.md b/docs/Informe.md index 11b1e144f..34114b61d 100644 --- a/docs/Informe.md +++ b/docs/Informe.md @@ -13,9 +13,14 @@ - 1.1 Generador de lexers y parsers LR "PyJapt". - 1.2 Manejo de errores lexicograficos y sintacticos. - 2 Inferencia de tipos. - - 2.1 Grafo de dependencias. - - 2.2 Casos factibles. -- 3 Ejecucion. + - 2.1 Algoritmo y Grafo de Dependecias. + - 2.2 Nodos de Dependencia. + - 2.3 Casos factibles. + - 2.3.1 Ejemplos de casos Factibles para la Inferencia. + - 2.4 Casos No factibles. + - 2.4.1 Casos Generales. + - 2.4.2 Casos Particulares. + - 2.5 Expresiones atomicas. ## 1 Analisis Lexicografico y Sintactico @@ -48,7 +53,7 @@ div = G.add_terminals('/') num = G.add_terminal('int', regex=r'\d+') ``` -Si tenemos un conjunto de terminales cuya expression regular coincide con su propio nombre podemos encapsularlos con las expression`add_terminals()` de la clase `Grammar` +Si tenemos un conjunto de terminales cuya expresion regular coincide con su propio nombre podemos encapsularlos con la funcion `add_terminals()` de la clase `Grammar` ```python plus, minus, star, div = G.add_terminals('+ - * /') @@ -159,6 +164,32 @@ def attribute_error(s): return LetInstruction(s[2], s[4]) ``` +Para reportar errores lexicograficos el procedimiento es bastante similar solo definimos un token que contenga un error, en este ejemplo un comentario multiliena que contiene un final de cadena. + +```python +@G.terminal('comment_error', r'\(\*(.|\n)*$') +def comment_eof_error(lexer): + lexer.contain_errors = True + lex = lexer.token.lex + for s in lex: + if s == '\n': + lexer.lineno += 1 + lexer.column = 0 + lexer.column = 1 + lexer.position += len(lex) + lexer.print_error(f'{lexer.lineno, lexer.column} -LexicographicError: EOF in comment') +``` + +Y para reportar errores generales durante el proceso de tokenizacion podemos usar el decorador `lexical_error` + +```python +@G.lexical_error +def lexical_error(lexer): + lexer.print_error(f'{lexer.lineno, lexer.column} -LexicographicError: ERROR "{lexer.token.lex}"') + lexer.column += 1 + lexer.position += 1 +``` + ## 2 Inferencia de Tipos COOL es un lenguaje de programacion estaticamente tipado, y aunque el lenguaje no presenta inferencia de tipos esta es una caracteristica muy util que incorporaremos en un nuestro interprete. @@ -167,7 +198,7 @@ Nuestro algoritmo de inferencia de tipos se apoya en el uso basico de la teoria La inferencia de tipos de nuestro proyecto detecta para cada atributo, variable, parametro de funcion o retorno de funcion el primer tipo que le puede ser asignado, modificando en el arbol de sintaxis abstracta el string `AUTO_TYPE` por el nombre del tipo correspondiente y asignando los tipos correspondientes en el contexto y el ambito en que seon declarados. -### El algoritmo +### 2.1 Algoritmo y Grafo de Dependecias ***Entrada :*** Un arbol de sintaxis abstracta, un contexto con todos los tipos declarados en el programa de COOL. @@ -175,12 +206,10 @@ La inferencia de tipos de nuestro proyecto detecta para cada atributo, variable, ***Algoritmo :*** Durante el recorrido del AST sera construido un grafo dirigido cuyos nodos encerraran el concepto de las expresiones marcadas como `AUTO_TYPE` y las aristas representan las dependencias entre las expresiones de estos nodos para inferir su tipo. Sea `E1` una expresion cuyo tipo estatico es marcado como `AUTO_TYPE`, y sea `E2` una expresion a partir de a cual se puede inferir el tipo de estatico de E1 entonces en el grafo existira la arista ``. Una vez construido el arbol se comenzara una cadena de expansion de tipos estaticos de la forma `E1, E2, ..., En` donde `Ej` se infiere de `Ei` con `1 < j = i + 1 <= n` y `E1` es una expresion con tipo estatico definido, al cual llamaremos atomo. Cuando todos los atomos se hayan propagado a traves del grafo los nodos que no hayan podido ser resueltos seran marcados como tipos `Object` al ser esta la clase mas general del lenguaje. -### Sistemas de nodos +### 2.2 Nodos de Dependencia Cada nodo del grafo sera una abstraccion de un concepto en el que se use un tagueo explicito de `AUTO_TYPE` y tendra las referencias a las partes del proceso de semantica del programa, ademas de que cada nodo contara con un metodo `update(type)` el cual actualiza el tipo estatico de estos conceptos. -### Jerarquia de nodos - ```python class DependencyNode: pass @@ -207,7 +236,7 @@ class VariableInfoNode(DependencyNode): pass ``` -### Casos factibles +### 2.3 Casos factibles Funcionando de manera analoga para atributos, variables, parametros y retorno de funciones. Explicado de forma recursiva puede ser visto como: @@ -223,10 +252,14 @@ Funcionando de manera analoga para atributos, variables, parametros y retorno de - Para los retornos de funciones, su tipo sera determinado con su expresion y los llamados a dicha funcion a traves de una operacion de dispatch. -### Ejemplos de casos Factibles para la Inferencia +- En las expresiones if-then-else o case-of asignan automaticamente el tipo `Object` por el momento debido a la complejidad que supone la operacion `join` en el los case y en las clausulas then-else. + +### 2.3.1 Ejemplos de casos Factibles para la Inferencia + +En este caso la expresion `d + 1` desambigua a `d` en un `Int` y luego `c` se infiere de `d`, `b` se infiere de `c`, `a` se infiere de `b` y el retorno de la funcion de infiere de `a`. Quedando todos los parametros y el retorno de la funcion marcados como `Int`. ```typescript -class Main inherits IO { +class Main { function(a: AUTO_TYPE, b: AUTO_TYPE, c: AUTO_TYPE, d: AUTO_TYPE): AUTO_TYPE { { a <- b; @@ -234,12 +267,14 @@ class Main inherits IO { c <- d; d <- a; d + 1; - if a < 10 then a else b fi; + a; } }; } ``` +Similar al caso anterior pero enesta ocacion incluyendo atributos, la expresion los `x + y` infiere a los parametros `x` y `y` como `Int` y tambien al atributo `b`, `a` se infiere de `b`. El tipo de retorno de `create_point()` se infiere de su porpia cuerpo con la expression `new Point` y esta a su vez infiere el tipo de retorno de `init()`. + ```typescript class Point { a: AUTO_TYPE; @@ -255,41 +290,20 @@ class Point { } ``` -```typescript -class Main inherits IO { - g(a: AUTO_TYPE): AUTO_TYPE { - if a < 10 then f(a) else f(b) fi; - }; - - f(a :AUTO_TYPE): AUTO_TYPE{ - if a < 3 then 1 else f(a - 1) + f(a - 2) fi - }; -} -``` +Probando con funciones recursivas tenemos el caso de fibonacci tipo de `n` se infiere al ser usado en las expresiones `n <= 2`, `n - 1`, `n - 2`, las cuales lo marcan como `Int`, `fibonacci(n - 1) + fibonacci(n - 2)` marca al retorno de la funcion como `Int` y y la expresion if-then-else lo marca como `Object`. en este ultimo caso la expresion `fibonacci(n - 1) + fibonacci(n - 2)` termina de analizarse primero que la expresion if-then-else por lo cual el tipo de retorno sera `Int` el cual fue el primero que se definio, lo cual demuestra que el orden en el que se analizan las inferencias importan de las inferencias importan. ```typescript -class Main inherits IO { - - b: AUTO_TYPE; - c: AUTO_TYPE <- "1"; - d: AUTO_TYPE; - - g(a: AUTO_TYPE): AUTO_TYPE { - { - b <- a; - d + 1; - if a < 10 then f(a) else f(b) fi; - } - }; - - f(a: AUTO_TYPE): AUTO_TYPE { - if a < 3 then 1 else f(a - 1) + f(a - 2) fi +class Main { + fibonacci(n: AUTO_TYPE): AUTO_TYPE { + if n <= 2 then 1 else fibonacci(n - 1) + fibonacci(n - 2) fi }; } ``` +El caso de Ackerman es bastante interesante, en nuestro algoritmo importa el orden en el que fueron definidas las dependencias. `m` y `n` son inferibles como `Int` a partir de las expresiones `n + 1` y `m - 1` respectivamente, y el tipo de retorno de `ackermann` en inferible por `n` al ser usado como segundo parametro en un llamado de si mismo, por lo cual sera `Int`. La influencia de la expresion if-then-else se ve anulada por el orden de inferencia. + ```typescript -class Ackermann { +class Main { ackermann(m: AUTO_TYPE, n: AUTO_TYPE): AUTO_TYPE { if m = 0 then n + 1 else if n = 0 then ackermann(m - 1, 1) else @@ -300,16 +314,16 @@ class Ackermann { } ``` -### Casos No factibles +### 2.4 Casos No factibles No es posible determinar el tipo de una variable, atributo, parametro, o retorno de funcion si para este se cumple el caso general y su caso especifico correspondiente. -### Caso general +### 2.4.1 Casos generales El tipo es utilizado en expresiones que no permiten determinar su tipo, o solo se logra determinar que poseen el mismo tipo que otras variables, atributos, parametros o retorno de funciones de las cuales tampoco se puede determinar el mismo. -```csharp -class Main inherits IO { +```typescript +class Main { b: AUTO_TYPE; c: AUTO_TYPE; @@ -321,19 +335,19 @@ class Main inherits IO { } }; - f(a: AUTO_TYPE): AUTO_TYPE { - if a < 3 then 1 else f(a - 1) fi + factorial(n: AUTO_TYPE): AUTO_TYPE { + if n = 1 then 1 else n * factorial(n - 1) fi }; } ``` -En este ejemplo solo es posible inferir el typo del parametro `a` de la funcion `f` y el atributo `b`, el resto sera marcado como `Object`. +En este ejemplo solo es posible inferir el typo del parametro `n` de la funcion `factorial`, su tipo de retorno, el parametro `a` de la funcion `function`, su tipo de retorno y el atributo `b` de la clase `Main`, el resto sera marcado como `Object`. -### Casos Particulares +### 2.4.2 Casos Particulares ***Para variables:*** si estas no son utilizadas en el ambito en que son marcadas como `Object`. -```csharp +```typescript class Main inherits IO { function(): Int { let a:AUTOTYPE, b:AUTO_TYPE in { @@ -343,9 +357,9 @@ class Main inherits IO { } ``` -***Para parametros:*** si dentro del cuerpo de la funcion estas no son utilizadas y no existe otra funcion que llame a esta con argumetnos con tipado estatico definidos seran marcadas como `Object`: +***Para parametros:*** si dentro del cuerpo de la funcion estas no son utilizadas y no existe otra funcion que llame a esta con argumentos con tipado estatico definidos seran marcadas como `Object`: -```csharp +```typescript class Main inherits IO { f(a: AUTO_TYPE): Int{ 1 @@ -355,7 +369,7 @@ class Main inherits IO { ***Para atributos:*** si no es posible determinar el tipo de la expresion de inicializacion o si dentro del cuerpo de todas las funciones de su clase correspondiente este no son utilizadas, seran marcadas como `Objects`. -```csharp +```typescript class Main inherits IO { b: AUTO_TYPE <- c; @@ -369,7 +383,7 @@ class Main inherits IO { ***Para el retorno de funciones:*** si no es posible determinar el tipo de su expresion. -```csharp +```typescript class Main inherits IO { f(a: Int): AUTO_TYPE{ if a<3 then a else f(a-3) fi @@ -377,7 +391,7 @@ class Main inherits IO { } ``` -#### Expresiones atomicas +### 2.5 Expresiones atomicas - Valores Constantes. @@ -392,5 +406,3 @@ class Main inherits IO { - Variables de las cuales se conoce su tipo. - Bloques donde se puede determinar el tipo de la ultima expresion. - -## 3 Ejecucion diff --git a/grammar.py b/grammar.py index 5abb01704..b50291099 100755 --- a/grammar.py +++ b/grammar.py @@ -210,13 +210,13 @@ def lexical_error(lexer): @G.production("feature-list -> attribute error feature-list") -def attribute_error(s): +def feature_attribute_error(s): s.error(f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") return ast.AttrDeclarationNode(s[1], s[3]) @G.production("feature-list -> method error feature-list") -def attribute_error(s): +def feature_method_error(s): s.error(f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") return s[1] diff --git a/main.py b/main.py index 981e24086..2e7c88046 100755 --- a/main.py +++ b/main.py @@ -165,7 +165,7 @@ class Main inherits IO { TypeChecker(context, errors).visit(ast, scope) if verbose: - print(CodeBuilder().visit(ast)) + print(CodeBuilder().visit(ast, 0)) if not errors: print() diff --git a/semantics/progam_executor.py b/semantics/progam_executor.py index 1e3cc521d..2ece448bb 100644 --- a/semantics/progam_executor.py +++ b/semantics/progam_executor.py @@ -108,7 +108,7 @@ def visit(self, node, tabs): @visitor.when(ast.ProgramNode) def visit(self, node: ast.ProgramNode, scope: Scope = None): - for i, declaration in enumerate(node.declarations): + for declaration in node.declarations: self.visit(declaration, None) execution_node = ast.MethodCallNode('main', [], ast.InstantiateNode('Main')) diff --git a/semantics/type_inference.py b/semantics/type_inference.py index 9c9156021..fdd5d23cd 100644 --- a/semantics/type_inference.py +++ b/semantics/type_inference.py @@ -113,7 +113,7 @@ def __str__(self): class DependencyGraph: def __init__(self): - self.dependencies: OrderedDict[DependencyNode, List[DependencyNode]] = OrderedDict() + self.dependencies: Dict[DependencyNode, List[DependencyNode]] = OrderedDict() def add_node(self, node: DependencyNode): if node not in self.dependencies: @@ -128,7 +128,7 @@ def add_edge(self, node: DependencyNode, other: DependencyNode): def update_dependencies(self, default_type: Type = None): queue = deque(key for key in self.dependencies if isinstance(key, AtomNode)) - visited = set() + visited: Set[DependencyNode] = set() while queue: current_node = queue.popleft() diff --git a/tests/parser/assignment1.cl b/tests/parser/assignment1.cl index 75b4c5bbd..f01b0b531 100755 --- a/tests/parser/assignment1.cl +++ b/tests/parser/assignment1.cl @@ -8,7 +8,7 @@ class Main { class Test { test1: Object; - + testing1(): Int { 2 + 2 }; From 45b7e60c33aeed8563121d715da73b031591d18f Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Tue, 26 May 2020 03:38:34 -0400 Subject: [PATCH 060/143] Minor Bug Fixes --- grammar.py | 7 +- main.py | 102 ++-- parser.py | 1082 +++++++++++++++++----------------- pyjapt/grammar.py | 5 +- pyjapt/parsing.py | 12 +- semantics/progam_executor.py | 8 +- semantics/type_builder.py | 2 +- semantics/type_checker.py | 3 - semantics/type_inference.py | 2 +- 9 files changed, 605 insertions(+), 618 deletions(-) diff --git a/grammar.py b/grammar.py index b50291099..a7377706e 100755 --- a/grammar.py +++ b/grammar.py @@ -90,7 +90,7 @@ def comment_eof_error(lexer): if s == '\n': lexer.lineno += 1 lexer.column = 0 - lexer.column = 1 + lexer.column += 1 lexer.position += len(lex) lexer.print_error(f'{lexer.lineno, lexer.column} -LexicographicError: EOF in comment') @@ -226,6 +226,11 @@ def case_list_error(s): s.error(f"{s[5].line, s[5].column} - SyntacticError: Expected ';' instead of '{s[5].lex}'") return [(s[1], s[3], s[5])] +@G.production("block -> expr error") +def block_single_error(s): + s.error(f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") + return [s[1]] + if __name__ == '__main__': t = time.time() diff --git a/main.py b/main.py index 2e7c88046..425408c5d 100755 --- a/main.py +++ b/main.py @@ -1,47 +1,32 @@ from lexer import CoolLexer from parser import CoolParser -from semantics import (TypeCollector, TypeBuilder, OverriddenMethodChecker, TypeChecker, topological_ordering) +from semantics import (TypeCollector, TypeBuilder, OverriddenMethodChecker, TypeChecker, topological_ordering, Formatter) from semantics.formatter import CodeBuilder from semantics.progam_executor import Executor from semantics.utils.scope import Context, Scope from semantics.type_inference import InferenceChecker -some_program = r""" -class Main inherits IO { - a: Int; - - main(): IO {{ - let a: Int <- 2 in a; - - a <- 2; - - new IO; - - while true loop - 0 - pool; - - case a of - x: Int => - x + 2; - x: String => - x.concat(" is a String\n"); - esac; - - out_string("Hello, World.\n"); - }}; +detecting_errors = r""" +class A { + a (n: Int) : Int { 0 }; +} + +class B inherits A { + a (x: String) : String { 1 }; +} - fibonacci(n: AUTO_TYPE): Int { - if n <= 2 - then - 0 - else - fibonacci(n - 1) + fibonacci(n - 2) fi +class Main { + x: Int; + + main (): Object { + 0 }; } """ inference_program_01 = r""" +class Main { main (): Object { 0 }; } + class Point { x: AUTO_TYPE; y: AUTO_TYPE; @@ -55,6 +40,8 @@ class Point { """ inference_program_02 = r""" +class Main { main (): Object { 0 }; } + class Ackermann { ackermann(m: AUTO_TYPE, n: AUTO_TYPE): AUTO_TYPE { if m = 0 then n + 1 else @@ -68,6 +55,8 @@ class Ackermann { inference_program_03 = r""" class Main { + main (): Object { 0 }; + f(a: AUTO_TYPE, b: AUTO_TYPE): AUTO_TYPE { if a = 1 then b else g(a + 1, b / 1) @@ -82,19 +71,7 @@ class Main { } """ -inference_program_04 = r""" -class Main inherits IO { - f(a: Int): Int { - g(a) - }; - - g(a: AUTO_TYPE): Int{ - 1 - }; -} -""" - -hello_world = r""" +execution_program_01 = r""" class A { } class B inherits A { } @@ -150,27 +127,28 @@ class Main inherits IO { parser = CoolParser() if __name__ == '__main__': - tokens = lexer(hello_world) + tokens = lexer(detecting_errors) ast = parser(tokens) - context = Context() - errors = [] - scope = Scope() + if ast is not None: + context = Context() + errors = [] + scope = Scope() - TypeCollector(context, errors).visit(ast) - TypeBuilder(context, errors).visit(ast) - topological_ordering(ast, context, errors) - OverriddenMethodChecker(context, errors).visit(ast) - InferenceChecker(context, errors).visit(ast, scope) - TypeChecker(context, errors).visit(ast, scope) + TypeCollector(context, errors).visit(ast) + TypeBuilder(context, errors).visit(ast) + topological_ordering(ast, context, errors) + OverriddenMethodChecker(context, errors).visit(ast) + InferenceChecker(context, errors).visit(ast, scope) + TypeChecker(context, errors).visit(ast, scope) - if verbose: - print(CodeBuilder().visit(ast, 0)) + if verbose: + print(CodeBuilder().visit(ast, 0)) - if not errors: - print() - Executor(context, errors).visit(ast, Scope()) - print('Program finished...') + if not errors: + print() + Executor(context, errors).visit(ast, Scope()) + print('Program finished...') - for error in errors: - print(error) + for error in errors: + print(error) diff --git a/parser.py b/parser.py index 45467481d..d2c15dbd5 100755 --- a/parser.py +++ b/parser.py @@ -15,134 +15,133 @@ def __action_table(): return { (0, G["class"]): ("SHIFT", 1), (1, G["type"]): ("SHIFT", 2), + (2, G["inherits"]): ("SHIFT", 143), (2, G["{"]): ("SHIFT", 3), - (2, G["inherits"]): ("SHIFT", 142), (3, G["id"]): ("SHIFT", 4), (3, G["}"]): ("REDUCE", G["feature-list -> e"]), + (4, G[":"]): ("SHIFT", 127), (4, G["("]): ("SHIFT", 5), - (4, G[":"]): ("SHIFT", 126), - (5, G["id"]): ("SHIFT", 114), + (5, G["id"]): ("SHIFT", 115), (5, G[")"]): ("SHIFT", 6), (6, G[":"]): ("SHIFT", 7), (7, G["type"]): ("SHIFT", 8), (8, G["{"]): ("SHIFT", 9), (9, G["true"]): ("SHIFT", 25), + (9, G["if"]): ("SHIFT", 12), (9, G["id"]): ("SHIFT", 31), + (9, G["string"]): ("SHIFT", 33), (9, G["while"]): ("SHIFT", 13), - (9, G["{"]): ("SHIFT", 10), + (9, G["case"]): ("SHIFT", 21), (9, G["~"]): ("SHIFT", 27), - (9, G["int"]): ("SHIFT", 34), (9, G["new"]): ("SHIFT", 22), - (9, G["case"]): ("SHIFT", 21), + (9, G["let"]): ("SHIFT", 14), + (9, G["{"]): ("SHIFT", 10), (9, G["not"]): ("SHIFT", 30), (9, G["false"]): ("SHIFT", 26), - (9, G["("]): ("SHIFT", 11), - (9, G["string"]): ("SHIFT", 33), + (9, G["int"]): ("SHIFT", 34), (9, G["isvoid"]): ("SHIFT", 24), - (9, G["if"]): ("SHIFT", 12), - (9, G["let"]): ("SHIFT", 14), - (10, G["while"]): ("SHIFT", 13), + (9, G["("]): ("SHIFT", 11), + (10, G["true"]): ("SHIFT", 25), + (10, G["("]): ("SHIFT", 11), (10, G["{"]): ("SHIFT", 10), - (10, G["~"]): ("SHIFT", 27), - (10, G["int"]): ("SHIFT", 34), - (10, G["case"]): ("SHIFT", 21), - (10, G["not"]): ("SHIFT", 30), - (10, G["new"]): ("SHIFT", 22), (10, G["id"]): ("SHIFT", 31), - (10, G["false"]): ("SHIFT", 26), - (10, G["("]): ("SHIFT", 11), + (10, G["not"]): ("SHIFT", 30), (10, G["string"]): ("SHIFT", 33), - (10, G["if"]): ("SHIFT", 12), - (10, G["isvoid"]): ("SHIFT", 24), (10, G["let"]): ("SHIFT", 14), - (10, G["true"]): ("SHIFT", 25), - (11, G["case"]): ("SHIFT", 21), + (10, G["isvoid"]): ("SHIFT", 24), + (10, G["new"]): ("SHIFT", 22), + (10, G["if"]): ("SHIFT", 12), + (10, G["case"]): ("SHIFT", 21), + (10, G["while"]): ("SHIFT", 13), + (10, G["~"]): ("SHIFT", 27), + (10, G["false"]): ("SHIFT", 26), + (10, G["int"]): ("SHIFT", 34), + (11, G["new"]): ("SHIFT", 22), (11, G["not"]): ("SHIFT", 30), + (11, G["let"]): ("SHIFT", 14), + (11, G["false"]): ("SHIFT", 26), (11, G["int"]): ("SHIFT", 34), - (11, G["~"]): ("SHIFT", 27), - (11, G["new"]): ("SHIFT", 22), - (11, G["if"]): ("SHIFT", 12), (11, G["id"]): ("SHIFT", 31), - (11, G["false"]): ("SHIFT", 26), + (11, G["if"]): ("SHIFT", 12), + (11, G["~"]): ("SHIFT", 27), (11, G["("]): ("SHIFT", 11), - (11, G["string"]): ("SHIFT", 33), - (11, G["let"]): ("SHIFT", 14), + (11, G["true"]): ("SHIFT", 25), (11, G["while"]): ("SHIFT", 13), + (11, G["case"]): ("SHIFT", 21), + (11, G["string"]): ("SHIFT", 33), (11, G["{"]): ("SHIFT", 10), (11, G["isvoid"]): ("SHIFT", 24), - (11, G["true"]): ("SHIFT", 25), + (12, G["id"]): ("SHIFT", 31), + (12, G["{"]): ("SHIFT", 10), + (12, G["("]): ("SHIFT", 11), + (12, G["not"]): ("SHIFT", 30), (12, G["true"]): ("SHIFT", 25), - (12, G["if"]): ("SHIFT", 12), - (12, G["int"]): ("SHIFT", 34), - (12, G["let"]): ("SHIFT", 14), + (12, G["false"]): ("SHIFT", 26), (12, G["~"]): ("SHIFT", 27), + (12, G["let"]): ("SHIFT", 14), + (12, G["string"]): ("SHIFT", 33), + (12, G["if"]): ("SHIFT", 12), (12, G["new"]): ("SHIFT", 22), - (12, G["id"]): ("SHIFT", 31), (12, G["while"]): ("SHIFT", 13), - (12, G["false"]): ("SHIFT", 26), - (12, G["("]): ("SHIFT", 11), - (12, G["{"]): ("SHIFT", 10), - (12, G["string"]): ("SHIFT", 33), (12, G["case"]): ("SHIFT", 21), - (12, G["not"]): ("SHIFT", 30), (12, G["isvoid"]): ("SHIFT", 24), + (12, G["int"]): ("SHIFT", 34), + (13, G["("]): ("SHIFT", 11), + (13, G["{"]): ("SHIFT", 10), (13, G["true"]): ("SHIFT", 25), - (13, G["if"]): ("SHIFT", 12), - (13, G["let"]): ("SHIFT", 14), - (13, G["int"]): ("SHIFT", 34), + (13, G["not"]): ("SHIFT", 30), (13, G["id"]): ("SHIFT", 31), - (13, G["while"]): ("SHIFT", 13), + (13, G["string"]): ("SHIFT", 33), + (13, G["isvoid"]): ("SHIFT", 24), + (13, G["let"]): ("SHIFT", 14), + (13, G["if"]): ("SHIFT", 12), (13, G["new"]): ("SHIFT", 22), + (13, G["while"]): ("SHIFT", 13), + (13, G["case"]): ("SHIFT", 21), (13, G["~"]): ("SHIFT", 27), - (13, G["{"]): ("SHIFT", 10), (13, G["false"]): ("SHIFT", 26), - (13, G["("]): ("SHIFT", 11), - (13, G["string"]): ("SHIFT", 33), - (13, G["case"]): ("SHIFT", 21), - (13, G["not"]): ("SHIFT", 30), - (13, G["isvoid"]): ("SHIFT", 24), + (13, G["int"]): ("SHIFT", 34), (14, G["id"]): ("SHIFT", 15), (15, G[":"]): ("SHIFT", 16), (16, G["type"]): ("SHIFT", 17), - (17, G[","]): ("SHIFT", 18), - (17, G["<-"]): ("SHIFT", 20), (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), + (17, G["<-"]): ("SHIFT", 20), + (17, G[","]): ("SHIFT", 18), (18, G["id"]): ("SHIFT", 15), (19, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), - (20, G["let"]): ("SHIFT", 14), - (20, G["int"]): ("SHIFT", 34), - (20, G["~"]): ("SHIFT", 27), - (20, G["id"]): ("SHIFT", 31), (20, G["new"]): ("SHIFT", 22), - (20, G["while"]): ("SHIFT", 13), + (20, G["isvoid"]): ("SHIFT", 24), (20, G["{"]): ("SHIFT", 10), + (20, G["not"]): ("SHIFT", 30), + (20, G["int"]): ("SHIFT", 34), (20, G["false"]): ("SHIFT", 26), + (20, G["let"]): ("SHIFT", 14), + (20, G["id"]): ("SHIFT", 31), + (20, G["~"]): ("SHIFT", 27), (20, G["("]): ("SHIFT", 11), - (20, G["string"]): ("SHIFT", 33), - (20, G["case"]): ("SHIFT", 21), (20, G["if"]): ("SHIFT", 12), - (20, G["not"]): ("SHIFT", 30), - (20, G["isvoid"]): ("SHIFT", 24), (20, G["true"]): ("SHIFT", 25), - (21, G["case"]): ("SHIFT", 21), - (21, G["not"]): ("SHIFT", 30), - (21, G["isvoid"]): ("SHIFT", 24), - (21, G["true"]): ("SHIFT", 25), - (21, G["if"]): ("SHIFT", 12), + (20, G["while"]): ("SHIFT", 13), + (20, G["case"]): ("SHIFT", 21), + (20, G["string"]): ("SHIFT", 33), + (21, G["false"]): ("SHIFT", 26), (21, G["int"]): ("SHIFT", 34), - (21, G["let"]): ("SHIFT", 14), - (21, G["~"]): ("SHIFT", 27), - (21, G["new"]): ("SHIFT", 22), (21, G["id"]): ("SHIFT", 31), - (21, G["while"]): ("SHIFT", 13), - (21, G["false"]): ("SHIFT", 26), + (21, G["if"]): ("SHIFT", 12), (21, G["("]): ("SHIFT", 11), + (21, G["true"]): ("SHIFT", 25), + (21, G["case"]): ("SHIFT", 21), + (21, G["while"]): ("SHIFT", 13), (21, G["string"]): ("SHIFT", 33), + (21, G["isvoid"]): ("SHIFT", 24), (21, G["{"]): ("SHIFT", 10), + (21, G["new"]): ("SHIFT", 22), + (21, G["not"]): ("SHIFT", 30), + (21, G["~"]): ("SHIFT", 27), + (21, G["let"]): ("SHIFT", 14), (22, G["type"]): ("SHIFT", 23), (23, G["of"]): ("REDUCE", G["atom -> new type"]), (23, G["<"]): ("REDUCE", G["atom -> new type"]), - (23, G["error"]): ("REDUCE", G["atom -> new type"]), (23, G[")"]): ("REDUCE", G["atom -> new type"]), (23, G["then"]): ("REDUCE", G["atom -> new type"]), (23, G["<="]): ("REDUCE", G["atom -> new type"]), @@ -151,28 +150,28 @@ def __action_table(): (23, G["="]): ("REDUCE", G["atom -> new type"]), (23, G[","]): ("REDUCE", G["atom -> new type"]), (23, G["fi"]): ("REDUCE", G["atom -> new type"]), + (23, G["error"]): ("REDUCE", G["atom -> new type"]), (23, G[";"]): ("REDUCE", G["atom -> new type"]), (23, G["loop"]): ("REDUCE", G["atom -> new type"]), (23, G["@"]): ("REDUCE", G["atom -> new type"]), (23, G["pool"]): ("REDUCE", G["atom -> new type"]), - (23, G["/"]): ("REDUCE", G["atom -> new type"]), (23, G["+"]): ("REDUCE", G["atom -> new type"]), (23, G["-"]): ("REDUCE", G["atom -> new type"]), (23, G["in"]): ("REDUCE", G["atom -> new type"]), (23, G["*"]): ("REDUCE", G["atom -> new type"]), (23, G["}"]): ("REDUCE", G["atom -> new type"]), + (23, G["/"]): ("REDUCE", G["atom -> new type"]), + (24, G["("]): ("SHIFT", 11), + (24, G["string"]): ("SHIFT", 33), (24, G["new"]): ("SHIFT", 22), - (24, G["int"]): ("SHIFT", 34), - (24, G["false"]): ("SHIFT", 26), (24, G["true"]): ("SHIFT", 25), + (24, G["false"]): ("SHIFT", 26), + (24, G["int"]): ("SHIFT", 34), + (24, G["id"]): ("SHIFT", 28), (24, G["~"]): ("SHIFT", 27), - (24, G["("]): ("SHIFT", 11), (24, G["isvoid"]): ("SHIFT", 24), - (24, G["id"]): ("SHIFT", 28), - (24, G["string"]): ("SHIFT", 33), (25, G["of"]): ("REDUCE", G["atom -> true"]), (25, G["<"]): ("REDUCE", G["atom -> true"]), - (25, G["error"]): ("REDUCE", G["atom -> true"]), (25, G[")"]): ("REDUCE", G["atom -> true"]), (25, G["then"]): ("REDUCE", G["atom -> true"]), (25, G["<="]): ("REDUCE", G["atom -> true"]), @@ -181,19 +180,19 @@ def __action_table(): (25, G["="]): ("REDUCE", G["atom -> true"]), (25, G[","]): ("REDUCE", G["atom -> true"]), (25, G["fi"]): ("REDUCE", G["atom -> true"]), + (25, G["error"]): ("REDUCE", G["atom -> true"]), (25, G[";"]): ("REDUCE", G["atom -> true"]), (25, G["loop"]): ("REDUCE", G["atom -> true"]), (25, G["@"]): ("REDUCE", G["atom -> true"]), (25, G["pool"]): ("REDUCE", G["atom -> true"]), - (25, G["/"]): ("REDUCE", G["atom -> true"]), (25, G["+"]): ("REDUCE", G["atom -> true"]), (25, G["-"]): ("REDUCE", G["atom -> true"]), (25, G["in"]): ("REDUCE", G["atom -> true"]), (25, G["*"]): ("REDUCE", G["atom -> true"]), (25, G["}"]): ("REDUCE", G["atom -> true"]), + (25, G["/"]): ("REDUCE", G["atom -> true"]), (26, G["of"]): ("REDUCE", G["atom -> false"]), (26, G["<"]): ("REDUCE", G["atom -> false"]), - (26, G["error"]): ("REDUCE", G["atom -> false"]), (26, G[")"]): ("REDUCE", G["atom -> false"]), (26, G["then"]): ("REDUCE", G["atom -> false"]), (26, G["<="]): ("REDUCE", G["atom -> false"]), @@ -202,28 +201,29 @@ def __action_table(): (26, G["="]): ("REDUCE", G["atom -> false"]), (26, G[","]): ("REDUCE", G["atom -> false"]), (26, G["fi"]): ("REDUCE", G["atom -> false"]), + (26, G["error"]): ("REDUCE", G["atom -> false"]), (26, G[";"]): ("REDUCE", G["atom -> false"]), (26, G["loop"]): ("REDUCE", G["atom -> false"]), (26, G["@"]): ("REDUCE", G["atom -> false"]), (26, G["pool"]): ("REDUCE", G["atom -> false"]), - (26, G["/"]): ("REDUCE", G["atom -> false"]), (26, G["+"]): ("REDUCE", G["atom -> false"]), (26, G["-"]): ("REDUCE", G["atom -> false"]), (26, G["in"]): ("REDUCE", G["atom -> false"]), (26, G["*"]): ("REDUCE", G["atom -> false"]), (26, G["}"]): ("REDUCE", G["atom -> false"]), + (26, G["/"]): ("REDUCE", G["atom -> false"]), + (27, G["("]): ("SHIFT", 11), + (27, G["string"]): ("SHIFT", 33), (27, G["new"]): ("SHIFT", 22), - (27, G["int"]): ("SHIFT", 34), - (27, G["false"]): ("SHIFT", 26), (27, G["true"]): ("SHIFT", 25), + (27, G["false"]): ("SHIFT", 26), + (27, G["int"]): ("SHIFT", 34), + (27, G["id"]): ("SHIFT", 28), (27, G["~"]): ("SHIFT", 27), - (27, G["("]): ("SHIFT", 11), (27, G["isvoid"]): ("SHIFT", 24), - (27, G["id"]): ("SHIFT", 28), - (27, G["string"]): ("SHIFT", 33), + (28, G["("]): ("SHIFT", 29), (28, G["of"]): ("REDUCE", G["atom -> id"]), (28, G["<"]): ("REDUCE", G["atom -> id"]), - (28, G["error"]): ("REDUCE", G["atom -> id"]), (28, G[")"]): ("REDUCE", G["atom -> id"]), (28, G["then"]): ("REDUCE", G["atom -> id"]), (28, G["<="]): ("REDUCE", G["atom -> id"]), @@ -232,52 +232,52 @@ def __action_table(): (28, G["="]): ("REDUCE", G["atom -> id"]), (28, G[","]): ("REDUCE", G["atom -> id"]), (28, G["fi"]): ("REDUCE", G["atom -> id"]), + (28, G["error"]): ("REDUCE", G["atom -> id"]), (28, G[";"]): ("REDUCE", G["atom -> id"]), (28, G["loop"]): ("REDUCE", G["atom -> id"]), (28, G["@"]): ("REDUCE", G["atom -> id"]), (28, G["pool"]): ("REDUCE", G["atom -> id"]), - (28, G["/"]): ("REDUCE", G["atom -> id"]), (28, G["+"]): ("REDUCE", G["atom -> id"]), (28, G["-"]): ("REDUCE", G["atom -> id"]), (28, G["in"]): ("REDUCE", G["atom -> id"]), (28, G["*"]): ("REDUCE", G["atom -> id"]), (28, G["}"]): ("REDUCE", G["atom -> id"]), - (28, G["("]): ("SHIFT", 29), - (29, G["new"]): ("SHIFT", 22), - (29, G["if"]): ("SHIFT", 12), - (29, G["~"]): ("SHIFT", 27), - (29, G["id"]): ("SHIFT", 31), - (29, G["false"]): ("SHIFT", 26), + (28, G["/"]): ("REDUCE", G["atom -> id"]), (29, G["let"]): ("SHIFT", 14), - (29, G["("]): ("SHIFT", 11), + (29, G["id"]): ("SHIFT", 31), + (29, G["if"]): ("SHIFT", 12), (29, G["string"]): ("SHIFT", 33), - (29, G[")"]): ("REDUCE", G["expr-list -> e"]), + (29, G["~"]): ("SHIFT", 27), + (29, G["case"]): ("SHIFT", 21), (29, G["while"]): ("SHIFT", 13), + (29, G["new"]): ("SHIFT", 22), + (29, G[")"]): ("REDUCE", G["expr-list -> e"]), (29, G["{"]): ("SHIFT", 10), - (29, G["isvoid"]): ("SHIFT", 24), - (29, G["true"]): ("SHIFT", 25), + (29, G["false"]): ("SHIFT", 26), (29, G["not"]): ("SHIFT", 30), - (29, G["case"]): ("SHIFT", 21), (29, G["int"]): ("SHIFT", 34), + (29, G["isvoid"]): ("SHIFT", 24), + (29, G["("]): ("SHIFT", 11), + (29, G["true"]): ("SHIFT", 25), + (30, G["("]): ("SHIFT", 11), (30, G["true"]): ("SHIFT", 25), - (30, G["if"]): ("SHIFT", 12), (30, G["let"]): ("SHIFT", 14), - (30, G["int"]): ("SHIFT", 34), - (30, G["~"]): ("SHIFT", 27), (30, G["id"]): ("SHIFT", 31), + (30, G["if"]): ("SHIFT", 12), + (30, G["string"]): ("SHIFT", 33), (30, G["while"]): ("SHIFT", 13), + (30, G["case"]): ("SHIFT", 21), + (30, G["isvoid"]): ("SHIFT", 24), (30, G["new"]): ("SHIFT", 22), (30, G["{"]): ("SHIFT", 10), (30, G["false"]): ("SHIFT", 26), - (30, G["("]): ("SHIFT", 11), - (30, G["string"]): ("SHIFT", 33), - (30, G["case"]): ("SHIFT", 21), + (30, G["int"]): ("SHIFT", 34), (30, G["not"]): ("SHIFT", 30), - (30, G["isvoid"]): ("SHIFT", 24), + (30, G["~"]): ("SHIFT", 27), + (31, G["("]): ("SHIFT", 29), (31, G["<-"]): ("SHIFT", 32), (31, G["of"]): ("REDUCE", G["atom -> id"]), (31, G["<"]): ("REDUCE", G["atom -> id"]), - (31, G["error"]): ("REDUCE", G["atom -> id"]), (31, G[")"]): ("REDUCE", G["atom -> id"]), (31, G["then"]): ("REDUCE", G["atom -> id"]), (31, G["<="]): ("REDUCE", G["atom -> id"]), @@ -286,35 +286,34 @@ def __action_table(): (31, G["="]): ("REDUCE", G["atom -> id"]), (31, G[","]): ("REDUCE", G["atom -> id"]), (31, G["fi"]): ("REDUCE", G["atom -> id"]), + (31, G["error"]): ("REDUCE", G["atom -> id"]), (31, G[";"]): ("REDUCE", G["atom -> id"]), (31, G["loop"]): ("REDUCE", G["atom -> id"]), (31, G["@"]): ("REDUCE", G["atom -> id"]), (31, G["pool"]): ("REDUCE", G["atom -> id"]), - (31, G["/"]): ("REDUCE", G["atom -> id"]), (31, G["+"]): ("REDUCE", G["atom -> id"]), (31, G["-"]): ("REDUCE", G["atom -> id"]), (31, G["in"]): ("REDUCE", G["atom -> id"]), (31, G["*"]): ("REDUCE", G["atom -> id"]), (31, G["}"]): ("REDUCE", G["atom -> id"]), - (31, G["("]): ("SHIFT", 29), + (31, G["/"]): ("REDUCE", G["atom -> id"]), + (32, G["("]): ("SHIFT", 11), (32, G["true"]): ("SHIFT", 25), - (32, G["if"]): ("SHIFT", 12), (32, G["let"]): ("SHIFT", 14), - (32, G["int"]): ("SHIFT", 34), - (32, G["~"]): ("SHIFT", 27), (32, G["id"]): ("SHIFT", 31), + (32, G["if"]): ("SHIFT", 12), + (32, G["string"]): ("SHIFT", 33), (32, G["while"]): ("SHIFT", 13), + (32, G["case"]): ("SHIFT", 21), + (32, G["isvoid"]): ("SHIFT", 24), (32, G["new"]): ("SHIFT", 22), (32, G["{"]): ("SHIFT", 10), (32, G["false"]): ("SHIFT", 26), - (32, G["("]): ("SHIFT", 11), - (32, G["string"]): ("SHIFT", 33), - (32, G["case"]): ("SHIFT", 21), + (32, G["int"]): ("SHIFT", 34), (32, G["not"]): ("SHIFT", 30), - (32, G["isvoid"]): ("SHIFT", 24), + (32, G["~"]): ("SHIFT", 27), (33, G["of"]): ("REDUCE", G["atom -> string"]), (33, G["<"]): ("REDUCE", G["atom -> string"]), - (33, G["error"]): ("REDUCE", G["atom -> string"]), (33, G[")"]): ("REDUCE", G["atom -> string"]), (33, G["then"]): ("REDUCE", G["atom -> string"]), (33, G["<="]): ("REDUCE", G["atom -> string"]), @@ -323,19 +322,19 @@ def __action_table(): (33, G["="]): ("REDUCE", G["atom -> string"]), (33, G[","]): ("REDUCE", G["atom -> string"]), (33, G["fi"]): ("REDUCE", G["atom -> string"]), + (33, G["error"]): ("REDUCE", G["atom -> string"]), (33, G[";"]): ("REDUCE", G["atom -> string"]), (33, G["loop"]): ("REDUCE", G["atom -> string"]), (33, G["@"]): ("REDUCE", G["atom -> string"]), (33, G["pool"]): ("REDUCE", G["atom -> string"]), - (33, G["/"]): ("REDUCE", G["atom -> string"]), (33, G["+"]): ("REDUCE", G["atom -> string"]), (33, G["-"]): ("REDUCE", G["atom -> string"]), (33, G["in"]): ("REDUCE", G["atom -> string"]), (33, G["*"]): ("REDUCE", G["atom -> string"]), (33, G["}"]): ("REDUCE", G["atom -> string"]), + (33, G["/"]): ("REDUCE", G["atom -> string"]), (34, G["of"]): ("REDUCE", G["atom -> int"]), (34, G["<"]): ("REDUCE", G["atom -> int"]), - (34, G["error"]): ("REDUCE", G["atom -> int"]), (34, G[")"]): ("REDUCE", G["atom -> int"]), (34, G["then"]): ("REDUCE", G["atom -> int"]), (34, G["<="]): ("REDUCE", G["atom -> int"]), @@ -344,19 +343,19 @@ def __action_table(): (34, G["="]): ("REDUCE", G["atom -> int"]), (34, G[","]): ("REDUCE", G["atom -> int"]), (34, G["fi"]): ("REDUCE", G["atom -> int"]), + (34, G["error"]): ("REDUCE", G["atom -> int"]), (34, G[";"]): ("REDUCE", G["atom -> int"]), (34, G["loop"]): ("REDUCE", G["atom -> int"]), (34, G["@"]): ("REDUCE", G["atom -> int"]), (34, G["pool"]): ("REDUCE", G["atom -> int"]), - (34, G["/"]): ("REDUCE", G["atom -> int"]), (34, G["+"]): ("REDUCE", G["atom -> int"]), (34, G["-"]): ("REDUCE", G["atom -> int"]), (34, G["in"]): ("REDUCE", G["atom -> int"]), (34, G["*"]): ("REDUCE", G["atom -> int"]), (34, G["}"]): ("REDUCE", G["atom -> int"]), + (34, G["/"]): ("REDUCE", G["atom -> int"]), (35, G["of"]): ("REDUCE", G["atom -> function-call"]), (35, G["<"]): ("REDUCE", G["atom -> function-call"]), - (35, G["error"]): ("REDUCE", G["atom -> function-call"]), (35, G[")"]): ("REDUCE", G["atom -> function-call"]), (35, G["then"]): ("REDUCE", G["atom -> function-call"]), (35, G["<="]): ("REDUCE", G["atom -> function-call"]), @@ -365,70 +364,67 @@ def __action_table(): (35, G["="]): ("REDUCE", G["atom -> function-call"]), (35, G[","]): ("REDUCE", G["atom -> function-call"]), (35, G["fi"]): ("REDUCE", G["atom -> function-call"]), + (35, G["error"]): ("REDUCE", G["atom -> function-call"]), (35, G[";"]): ("REDUCE", G["atom -> function-call"]), (35, G["loop"]): ("REDUCE", G["atom -> function-call"]), (35, G["@"]): ("REDUCE", G["atom -> function-call"]), (35, G["pool"]): ("REDUCE", G["atom -> function-call"]), - (35, G["/"]): ("REDUCE", G["atom -> function-call"]), (35, G["+"]): ("REDUCE", G["atom -> function-call"]), (35, G["-"]): ("REDUCE", G["atom -> function-call"]), (35, G["in"]): ("REDUCE", G["atom -> function-call"]), (35, G["*"]): ("REDUCE", G["atom -> function-call"]), (35, G["}"]): ("REDUCE", G["atom -> function-call"]), - (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), + (35, G["/"]): ("REDUCE", G["atom -> function-call"]), (36, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["else"]): ("REDUCE", G["expr -> id <- expr"]), (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), (36, G["in"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["}"]): ("REDUCE", G["expr -> id <- expr"]), - (37, G[";"]): ("REDUCE", G["expr -> comp"]), - (37, G["of"]): ("REDUCE", G["expr -> comp"]), - (37, G["loop"]): ("REDUCE", G["expr -> comp"]), - (37, G["error"]): ("REDUCE", G["expr -> comp"]), - (37, G[")"]): ("REDUCE", G["expr -> comp"]), + (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), (37, G["pool"]): ("REDUCE", G["expr -> comp"]), + (37, G[")"]): ("REDUCE", G["expr -> comp"]), (37, G["then"]): ("REDUCE", G["expr -> comp"]), (37, G["else"]): ("REDUCE", G["expr -> comp"]), (37, G[","]): ("REDUCE", G["expr -> comp"]), (37, G["in"]): ("REDUCE", G["expr -> comp"]), (37, G["fi"]): ("REDUCE", G["expr -> comp"]), + (37, G["error"]): ("REDUCE", G["expr -> comp"]), (37, G["}"]): ("REDUCE", G["expr -> comp"]), - (38, G["<="]): ("SHIFT", 68), - (38, G["<"]): ("SHIFT", 66), - (38, G["-"]): ("SHIFT", 64), - (38, G[";"]): ("REDUCE", G["comp -> arith"]), - (38, G["of"]): ("REDUCE", G["comp -> arith"]), - (38, G["loop"]): ("REDUCE", G["comp -> arith"]), - (38, G["error"]): ("REDUCE", G["comp -> arith"]), - (38, G[")"]): ("REDUCE", G["comp -> arith"]), + (37, G["of"]): ("REDUCE", G["expr -> comp"]), + (37, G[";"]): ("REDUCE", G["expr -> comp"]), + (37, G["loop"]): ("REDUCE", G["expr -> comp"]), + (38, G["+"]): ("SHIFT", 39), + (38, G["="]): ("SHIFT", 70), + (38, G["<="]): ("SHIFT", 68), (38, G["pool"]): ("REDUCE", G["comp -> arith"]), + (38, G[")"]): ("REDUCE", G["comp -> arith"]), (38, G["then"]): ("REDUCE", G["comp -> arith"]), (38, G["else"]): ("REDUCE", G["comp -> arith"]), (38, G[","]): ("REDUCE", G["comp -> arith"]), (38, G["in"]): ("REDUCE", G["comp -> arith"]), (38, G["fi"]): ("REDUCE", G["comp -> arith"]), + (38, G["error"]): ("REDUCE", G["comp -> arith"]), (38, G["}"]): ("REDUCE", G["comp -> arith"]), - (38, G["+"]): ("SHIFT", 39), - (38, G["="]): ("SHIFT", 70), + (38, G["of"]): ("REDUCE", G["comp -> arith"]), + (38, G[";"]): ("REDUCE", G["comp -> arith"]), + (38, G["loop"]): ("REDUCE", G["comp -> arith"]), + (38, G["-"]): ("SHIFT", 64), + (38, G["<"]): ("SHIFT", 66), + (39, G["("]): ("SHIFT", 11), (39, G["new"]): ("SHIFT", 22), - (39, G["false"]): ("SHIFT", 26), (39, G["true"]): ("SHIFT", 25), - (39, G["("]): ("SHIFT", 11), (39, G["id"]): ("SHIFT", 28), (39, G["string"]): ("SHIFT", 33), + (39, G["false"]): ("SHIFT", 26), (39, G["int"]): ("SHIFT", 34), (39, G["~"]): ("SHIFT", 27), (39, G["isvoid"]): ("SHIFT", 24), - (40, G["/"]): ("SHIFT", 54), - (40, G["*"]): ("SHIFT", 41), - (40, G["of"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), (40, G["<"]): ("REDUCE", G["arith -> arith + term"]), (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), (40, G["then"]): ("REDUCE", G["arith -> arith + term"]), @@ -437,6 +433,7 @@ def __action_table(): (40, G["="]): ("REDUCE", G["arith -> arith + term"]), (40, G[","]): ("REDUCE", G["arith -> arith + term"]), (40, G["fi"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), (40, G[";"]): ("REDUCE", G["arith -> arith + term"]), (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), @@ -444,18 +441,20 @@ def __action_table(): (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["of"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["/"]): ("SHIFT", 54), + (40, G["*"]): ("SHIFT", 41), + (41, G["("]): ("SHIFT", 11), + (41, G["string"]): ("SHIFT", 33), (41, G["new"]): ("SHIFT", 22), - (41, G["int"]): ("SHIFT", 34), - (41, G["false"]): ("SHIFT", 26), (41, G["true"]): ("SHIFT", 25), + (41, G["false"]): ("SHIFT", 26), + (41, G["int"]): ("SHIFT", 34), + (41, G["id"]): ("SHIFT", 28), (41, G["~"]): ("SHIFT", 27), - (41, G["("]): ("SHIFT", 11), (41, G["isvoid"]): ("SHIFT", 24), - (41, G["id"]): ("SHIFT", 28), - (41, G["string"]): ("SHIFT", 33), (42, G["of"]): ("REDUCE", G["term -> term * factor"]), (42, G["<"]): ("REDUCE", G["term -> term * factor"]), - (42, G["error"]): ("REDUCE", G["term -> term * factor"]), (42, G[")"]): ("REDUCE", G["term -> term * factor"]), (42, G["then"]): ("REDUCE", G["term -> term * factor"]), (42, G["<="]): ("REDUCE", G["term -> term * factor"]), @@ -463,19 +462,18 @@ def __action_table(): (42, G["="]): ("REDUCE", G["term -> term * factor"]), (42, G[","]): ("REDUCE", G["term -> term * factor"]), (42, G["fi"]): ("REDUCE", G["term -> term * factor"]), + (42, G["error"]): ("REDUCE", G["term -> term * factor"]), (42, G[";"]): ("REDUCE", G["term -> term * factor"]), (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), (42, G["pool"]): ("REDUCE", G["term -> term * factor"]), - (42, G["/"]): ("REDUCE", G["term -> term * factor"]), (42, G["+"]): ("REDUCE", G["term -> term * factor"]), (42, G["-"]): ("REDUCE", G["term -> term * factor"]), (42, G["in"]): ("REDUCE", G["term -> term * factor"]), (42, G["*"]): ("REDUCE", G["term -> term * factor"]), (42, G["}"]): ("REDUCE", G["term -> term * factor"]), - (43, G["@"]): ("SHIFT", 57), + (42, G["/"]): ("REDUCE", G["term -> term * factor"]), (43, G["of"]): ("REDUCE", G["factor -> atom"]), (43, G["<"]): ("REDUCE", G["factor -> atom"]), - (43, G["error"]): ("REDUCE", G["factor -> atom"]), (43, G[")"]): ("REDUCE", G["factor -> atom"]), (43, G["then"]): ("REDUCE", G["factor -> atom"]), (43, G["<="]): ("REDUCE", G["factor -> atom"]), @@ -483,38 +481,39 @@ def __action_table(): (43, G["="]): ("REDUCE", G["factor -> atom"]), (43, G[","]): ("REDUCE", G["factor -> atom"]), (43, G["fi"]): ("REDUCE", G["factor -> atom"]), + (43, G["error"]): ("REDUCE", G["factor -> atom"]), (43, G[";"]): ("REDUCE", G["factor -> atom"]), (43, G["loop"]): ("REDUCE", G["factor -> atom"]), (43, G["pool"]): ("REDUCE", G["factor -> atom"]), - (43, G["/"]): ("REDUCE", G["factor -> atom"]), (43, G["+"]): ("REDUCE", G["factor -> atom"]), (43, G["-"]): ("REDUCE", G["factor -> atom"]), (43, G["in"]): ("REDUCE", G["factor -> atom"]), (43, G["*"]): ("REDUCE", G["factor -> atom"]), (43, G["}"]): ("REDUCE", G["factor -> atom"]), + (43, G["/"]): ("REDUCE", G["factor -> atom"]), + (43, G["@"]): ("SHIFT", 57), (43, G["."]): ("SHIFT", 44), (44, G["id"]): ("SHIFT", 45), (45, G["("]): ("SHIFT", 46), - (46, G["new"]): ("SHIFT", 22), - (46, G["if"]): ("SHIFT", 12), - (46, G["~"]): ("SHIFT", 27), - (46, G["id"]): ("SHIFT", 31), - (46, G["false"]): ("SHIFT", 26), (46, G["let"]): ("SHIFT", 14), - (46, G["("]): ("SHIFT", 11), + (46, G["id"]): ("SHIFT", 31), + (46, G["if"]): ("SHIFT", 12), (46, G["string"]): ("SHIFT", 33), - (46, G[")"]): ("REDUCE", G["expr-list -> e"]), + (46, G["~"]): ("SHIFT", 27), + (46, G["case"]): ("SHIFT", 21), (46, G["while"]): ("SHIFT", 13), + (46, G["new"]): ("SHIFT", 22), + (46, G[")"]): ("REDUCE", G["expr-list -> e"]), (46, G["{"]): ("SHIFT", 10), - (46, G["isvoid"]): ("SHIFT", 24), - (46, G["true"]): ("SHIFT", 25), + (46, G["false"]): ("SHIFT", 26), (46, G["not"]): ("SHIFT", 30), - (46, G["case"]): ("SHIFT", 21), (46, G["int"]): ("SHIFT", 34), + (46, G["isvoid"]): ("SHIFT", 24), + (46, G["("]): ("SHIFT", 11), + (46, G["true"]): ("SHIFT", 25), (47, G[")"]): ("SHIFT", 48), (48, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), @@ -523,37 +522,36 @@ def __action_table(): (48, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (49, G[")"]): ("REDUCE", G["expr-list -> not-empty-expr-list"]), (50, G[","]): ("SHIFT", 51), (50, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), - (51, G["new"]): ("SHIFT", 22), - (51, G["if"]): ("SHIFT", 12), - (51, G["~"]): ("SHIFT", 27), - (51, G["id"]): ("SHIFT", 31), - (51, G["false"]): ("SHIFT", 26), (51, G["let"]): ("SHIFT", 14), - (51, G["("]): ("SHIFT", 11), + (51, G["id"]): ("SHIFT", 31), + (51, G["if"]): ("SHIFT", 12), (51, G["string"]): ("SHIFT", 33), + (51, G["~"]): ("SHIFT", 27), + (51, G["case"]): ("SHIFT", 21), (51, G["while"]): ("SHIFT", 13), + (51, G["new"]): ("SHIFT", 22), (51, G["{"]): ("SHIFT", 10), - (51, G["isvoid"]): ("SHIFT", 24), - (51, G["true"]): ("SHIFT", 25), + (51, G["false"]): ("SHIFT", 26), (51, G["not"]): ("SHIFT", 30), - (51, G["case"]): ("SHIFT", 21), (51, G["int"]): ("SHIFT", 34), + (51, G["isvoid"]): ("SHIFT", 24), + (51, G["("]): ("SHIFT", 11), + (51, G["true"]): ("SHIFT", 25), (52, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr , not-empty-expr-list"]), - (53, G["of"]): ("REDUCE", G["arith -> term"]), - (53, G["error"]): ("REDUCE", G["arith -> term"]), (53, G["<"]): ("REDUCE", G["arith -> term"]), (53, G[")"]): ("REDUCE", G["arith -> term"]), (53, G["then"]): ("REDUCE", G["arith -> term"]), @@ -562,6 +560,7 @@ def __action_table(): (53, G["="]): ("REDUCE", G["arith -> term"]), (53, G[","]): ("REDUCE", G["arith -> term"]), (53, G["fi"]): ("REDUCE", G["arith -> term"]), + (53, G["error"]): ("REDUCE", G["arith -> term"]), (53, G[";"]): ("REDUCE", G["arith -> term"]), (53, G["loop"]): ("REDUCE", G["arith -> term"]), (53, G["pool"]): ("REDUCE", G["arith -> term"]), @@ -569,20 +568,20 @@ def __action_table(): (53, G["-"]): ("REDUCE", G["arith -> term"]), (53, G["in"]): ("REDUCE", G["arith -> term"]), (53, G["}"]): ("REDUCE", G["arith -> term"]), - (53, G["*"]): ("SHIFT", 41), + (53, G["of"]): ("REDUCE", G["arith -> term"]), (53, G["/"]): ("SHIFT", 54), + (53, G["*"]): ("SHIFT", 41), + (54, G["("]): ("SHIFT", 11), + (54, G["string"]): ("SHIFT", 33), (54, G["new"]): ("SHIFT", 22), - (54, G["int"]): ("SHIFT", 34), - (54, G["false"]): ("SHIFT", 26), (54, G["true"]): ("SHIFT", 25), + (54, G["false"]): ("SHIFT", 26), + (54, G["int"]): ("SHIFT", 34), + (54, G["id"]): ("SHIFT", 28), (54, G["~"]): ("SHIFT", 27), - (54, G["("]): ("SHIFT", 11), (54, G["isvoid"]): ("SHIFT", 24), - (54, G["id"]): ("SHIFT", 28), - (54, G["string"]): ("SHIFT", 33), (55, G["of"]): ("REDUCE", G["term -> term / factor"]), (55, G["<"]): ("REDUCE", G["term -> term / factor"]), - (55, G["error"]): ("REDUCE", G["term -> term / factor"]), (55, G[")"]): ("REDUCE", G["term -> term / factor"]), (55, G["then"]): ("REDUCE", G["term -> term / factor"]), (55, G["<="]): ("REDUCE", G["term -> term / factor"]), @@ -590,18 +589,18 @@ def __action_table(): (55, G["="]): ("REDUCE", G["term -> term / factor"]), (55, G[","]): ("REDUCE", G["term -> term / factor"]), (55, G["fi"]): ("REDUCE", G["term -> term / factor"]), + (55, G["error"]): ("REDUCE", G["term -> term / factor"]), (55, G[";"]): ("REDUCE", G["term -> term / factor"]), (55, G["loop"]): ("REDUCE", G["term -> term / factor"]), (55, G["pool"]): ("REDUCE", G["term -> term / factor"]), - (55, G["/"]): ("REDUCE", G["term -> term / factor"]), (55, G["+"]): ("REDUCE", G["term -> term / factor"]), (55, G["-"]): ("REDUCE", G["term -> term / factor"]), (55, G["in"]): ("REDUCE", G["term -> term / factor"]), (55, G["*"]): ("REDUCE", G["term -> term / factor"]), (55, G["}"]): ("REDUCE", G["term -> term / factor"]), + (55, G["/"]): ("REDUCE", G["term -> term / factor"]), (56, G["of"]): ("REDUCE", G["term -> factor"]), (56, G["<"]): ("REDUCE", G["term -> factor"]), - (56, G["error"]): ("REDUCE", G["term -> factor"]), (56, G[")"]): ("REDUCE", G["term -> factor"]), (56, G["then"]): ("REDUCE", G["term -> factor"]), (56, G["<="]): ("REDUCE", G["term -> factor"]), @@ -609,39 +608,39 @@ def __action_table(): (56, G["="]): ("REDUCE", G["term -> factor"]), (56, G[","]): ("REDUCE", G["term -> factor"]), (56, G["fi"]): ("REDUCE", G["term -> factor"]), + (56, G["error"]): ("REDUCE", G["term -> factor"]), (56, G[";"]): ("REDUCE", G["term -> factor"]), (56, G["loop"]): ("REDUCE", G["term -> factor"]), (56, G["pool"]): ("REDUCE", G["term -> factor"]), - (56, G["/"]): ("REDUCE", G["term -> factor"]), (56, G["+"]): ("REDUCE", G["term -> factor"]), (56, G["-"]): ("REDUCE", G["term -> factor"]), (56, G["in"]): ("REDUCE", G["term -> factor"]), (56, G["*"]): ("REDUCE", G["term -> factor"]), (56, G["}"]): ("REDUCE", G["term -> factor"]), + (56, G["/"]): ("REDUCE", G["term -> factor"]), (57, G["type"]): ("SHIFT", 58), (58, G["."]): ("SHIFT", 59), (59, G["id"]): ("SHIFT", 60), (60, G["("]): ("SHIFT", 61), - (61, G["new"]): ("SHIFT", 22), - (61, G["if"]): ("SHIFT", 12), - (61, G["~"]): ("SHIFT", 27), - (61, G["id"]): ("SHIFT", 31), - (61, G["false"]): ("SHIFT", 26), (61, G["let"]): ("SHIFT", 14), - (61, G["("]): ("SHIFT", 11), + (61, G["id"]): ("SHIFT", 31), + (61, G["if"]): ("SHIFT", 12), (61, G["string"]): ("SHIFT", 33), - (61, G[")"]): ("REDUCE", G["expr-list -> e"]), + (61, G["~"]): ("SHIFT", 27), + (61, G["case"]): ("SHIFT", 21), (61, G["while"]): ("SHIFT", 13), + (61, G["new"]): ("SHIFT", 22), + (61, G[")"]): ("REDUCE", G["expr-list -> e"]), (61, G["{"]): ("SHIFT", 10), - (61, G["isvoid"]): ("SHIFT", 24), - (61, G["true"]): ("SHIFT", 25), + (61, G["false"]): ("SHIFT", 26), (61, G["not"]): ("SHIFT", 30), - (61, G["case"]): ("SHIFT", 21), (61, G["int"]): ("SHIFT", 34), + (61, G["isvoid"]): ("SHIFT", 24), + (61, G["("]): ("SHIFT", 11), + (61, G["true"]): ("SHIFT", 25), (62, G[")"]): ("SHIFT", 63), (63, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), @@ -650,29 +649,27 @@ def __action_table(): (63, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (64, G["("]): ("SHIFT", 11), (64, G["new"]): ("SHIFT", 22), - (64, G["false"]): ("SHIFT", 26), (64, G["true"]): ("SHIFT", 25), - (64, G["("]): ("SHIFT", 11), (64, G["id"]): ("SHIFT", 28), (64, G["string"]): ("SHIFT", 33), + (64, G["false"]): ("SHIFT", 26), (64, G["int"]): ("SHIFT", 34), (64, G["~"]): ("SHIFT", 27), (64, G["isvoid"]): ("SHIFT", 24), (65, G["/"]): ("SHIFT", 54), - (65, G["*"]): ("SHIFT", 41), - (65, G["of"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["error"]): ("REDUCE", G["arith -> arith - term"]), (65, G["<"]): ("REDUCE", G["arith -> arith - term"]), (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), (65, G["then"]): ("REDUCE", G["arith -> arith - term"]), @@ -681,6 +678,7 @@ def __action_table(): (65, G["="]): ("REDUCE", G["arith -> arith - term"]), (65, G[","]): ("REDUCE", G["arith -> arith - term"]), (65, G["fi"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["error"]): ("REDUCE", G["arith -> arith - term"]), (65, G[";"]): ("REDUCE", G["arith -> arith - term"]), (65, G["loop"]): ("REDUCE", G["arith -> arith - term"]), (65, G["pool"]): ("REDUCE", G["arith -> arith - term"]), @@ -688,91 +686,92 @@ def __action_table(): (65, G["-"]): ("REDUCE", G["arith -> arith - term"]), (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), (65, G["}"]): ("REDUCE", G["arith -> arith - term"]), - (66, G["~"]): ("SHIFT", 27), - (66, G["isvoid"]): ("SHIFT", 24), + (65, G["of"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["*"]): ("SHIFT", 41), (66, G["false"]): ("SHIFT", 26), - (66, G["true"]): ("SHIFT", 25), - (66, G["("]): ("SHIFT", 11), - (66, G["id"]): ("SHIFT", 28), - (66, G["string"]): ("SHIFT", 33), (66, G["int"]): ("SHIFT", 34), + (66, G["id"]): ("SHIFT", 28), + (66, G["("]): ("SHIFT", 11), (66, G["new"]): ("SHIFT", 22), - (67, G["-"]): ("SHIFT", 64), + (66, G["true"]): ("SHIFT", 25), + (66, G["~"]): ("SHIFT", 27), + (66, G["isvoid"]): ("SHIFT", 24), + (66, G["string"]): ("SHIFT", 33), (67, G["+"]): ("SHIFT", 39), - (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["-"]): ("SHIFT", 64), (67, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["else"]): ("REDUCE", G["comp -> arith < arith"]), (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), (67, G["in"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["}"]): ("REDUCE", G["comp -> arith < arith"]), - (68, G["~"]): ("SHIFT", 27), - (68, G["isvoid"]): ("SHIFT", 24), + (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), (68, G["false"]): ("SHIFT", 26), - (68, G["true"]): ("SHIFT", 25), - (68, G["("]): ("SHIFT", 11), - (68, G["id"]): ("SHIFT", 28), - (68, G["string"]): ("SHIFT", 33), (68, G["int"]): ("SHIFT", 34), + (68, G["id"]): ("SHIFT", 28), + (68, G["("]): ("SHIFT", 11), (68, G["new"]): ("SHIFT", 22), - (69, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), + (68, G["true"]): ("SHIFT", 25), + (68, G["~"]): ("SHIFT", 27), + (68, G["isvoid"]): ("SHIFT", 24), + (68, G["string"]): ("SHIFT", 33), + (69, G["+"]): ("SHIFT", 39), + (69, G["-"]): ("SHIFT", 64), (69, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["-"]): ("SHIFT", 64), - (69, G["+"]): ("SHIFT", 39), - (70, G["~"]): ("SHIFT", 27), - (70, G["isvoid"]): ("SHIFT", 24), + (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), (70, G["false"]): ("SHIFT", 26), - (70, G["true"]): ("SHIFT", 25), - (70, G["("]): ("SHIFT", 11), - (70, G["id"]): ("SHIFT", 28), - (70, G["string"]): ("SHIFT", 33), (70, G["int"]): ("SHIFT", 34), + (70, G["id"]): ("SHIFT", 28), + (70, G["("]): ("SHIFT", 11), (70, G["new"]): ("SHIFT", 22), - (71, G[";"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["error"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), + (70, G["true"]): ("SHIFT", 25), + (70, G["~"]): ("SHIFT", 27), + (70, G["isvoid"]): ("SHIFT", 24), + (70, G["string"]): ("SHIFT", 33), + (71, G["+"]): ("SHIFT", 39), + (71, G["-"]): ("SHIFT", 64), (71, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["else"]): ("REDUCE", G["comp -> arith = arith"]), (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), (71, G["in"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["error"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["}"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["+"]): ("SHIFT", 39), - (71, G["-"]): ("SHIFT", 64), - (72, G[";"]): ("REDUCE", G["expr -> not expr"]), - (72, G["of"]): ("REDUCE", G["expr -> not expr"]), - (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), - (72, G["error"]): ("REDUCE", G["expr -> not expr"]), - (72, G[")"]): ("REDUCE", G["expr -> not expr"]), + (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[";"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), (72, G["pool"]): ("REDUCE", G["expr -> not expr"]), + (72, G[")"]): ("REDUCE", G["expr -> not expr"]), (72, G["then"]): ("REDUCE", G["expr -> not expr"]), (72, G["else"]): ("REDUCE", G["expr -> not expr"]), (72, G[","]): ("REDUCE", G["expr -> not expr"]), (72, G["in"]): ("REDUCE", G["expr -> not expr"]), (72, G["fi"]): ("REDUCE", G["expr -> not expr"]), + (72, G["error"]): ("REDUCE", G["expr -> not expr"]), (72, G["}"]): ("REDUCE", G["expr -> not expr"]), + (72, G["of"]): ("REDUCE", G["expr -> not expr"]), + (72, G[";"]): ("REDUCE", G["expr -> not expr"]), + (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), (73, G[")"]): ("SHIFT", 74), (74, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), @@ -781,19 +780,19 @@ def __action_table(): (74, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (75, G["of"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["<"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), (75, G[")"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["then"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["<="]): ("REDUCE", G["factor -> ~ factor"]), @@ -801,18 +800,18 @@ def __action_table(): (75, G["="]): ("REDUCE", G["factor -> ~ factor"]), (75, G[","]): ("REDUCE", G["factor -> ~ factor"]), (75, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), (75, G[";"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["/"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["+"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["-"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["*"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["}"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["/"]): ("REDUCE", G["factor -> ~ factor"]), (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), @@ -820,35 +819,36 @@ def __action_table(): (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), (77, G["of"]): ("SHIFT", 78), (78, G["id"]): ("SHIFT", 79), (79, G[":"]): ("SHIFT", 80), (80, G["type"]): ("SHIFT", 81), (81, G["=>"]): ("SHIFT", 82), - (82, G["~"]): ("SHIFT", 27), - (82, G["new"]): ("SHIFT", 22), - (82, G["id"]): ("SHIFT", 31), - (82, G["false"]): ("SHIFT", 26), - (82, G["case"]): ("SHIFT", 21), + (82, G["true"]): ("SHIFT", 25), (82, G["("]): ("SHIFT", 11), - (82, G["string"]): ("SHIFT", 33), + (82, G["{"]): ("SHIFT", 10), + (82, G["id"]): ("SHIFT", 31), (82, G["not"]): ("SHIFT", 30), - (82, G["if"]): ("SHIFT", 12), - (82, G["isvoid"]): ("SHIFT", 24), + (82, G["string"]): ("SHIFT", 33), (82, G["let"]): ("SHIFT", 14), - (82, G["true"]): ("SHIFT", 25), + (82, G["isvoid"]): ("SHIFT", 24), + (82, G["new"]): ("SHIFT", 22), + (82, G["if"]): ("SHIFT", 12), + (82, G["case"]): ("SHIFT", 21), (82, G["while"]): ("SHIFT", 13), + (82, G["~"]): ("SHIFT", 27), + (82, G["false"]): ("SHIFT", 26), (82, G["int"]): ("SHIFT", 34), - (82, G["{"]): ("SHIFT", 10), (83, G["error"]): ("SHIFT", 86), (83, G[";"]): ("SHIFT", 84), (84, G["id"]): ("SHIFT", 79), @@ -856,128 +856,127 @@ def __action_table(): (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), (86, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), (87, G["esac"]): ("SHIFT", 88), - (88, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G[","]): ("SHIFT", 90), + (88, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), + (89, G[","]): ("SHIFT", 90), (90, G["id"]): ("SHIFT", 15), (91, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), (92, G["in"]): ("SHIFT", 93), + (93, G["("]): ("SHIFT", 11), (93, G["true"]): ("SHIFT", 25), - (93, G["if"]): ("SHIFT", 12), (93, G["let"]): ("SHIFT", 14), - (93, G["int"]): ("SHIFT", 34), - (93, G["~"]): ("SHIFT", 27), (93, G["id"]): ("SHIFT", 31), + (93, G["if"]): ("SHIFT", 12), + (93, G["string"]): ("SHIFT", 33), (93, G["while"]): ("SHIFT", 13), + (93, G["case"]): ("SHIFT", 21), + (93, G["isvoid"]): ("SHIFT", 24), (93, G["new"]): ("SHIFT", 22), (93, G["{"]): ("SHIFT", 10), (93, G["false"]): ("SHIFT", 26), - (93, G["("]): ("SHIFT", 11), - (93, G["string"]): ("SHIFT", 33), - (93, G["case"]): ("SHIFT", 21), + (93, G["int"]): ("SHIFT", 34), (93, G["not"]): ("SHIFT", 30), - (93, G["isvoid"]): ("SHIFT", 24), - (94, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["~"]): ("SHIFT", 27), (94, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["loop"]): ("SHIFT", 96), - (96, G["if"]): ("SHIFT", 12), - (96, G["true"]): ("SHIFT", 25), - (96, G["let"]): ("SHIFT", 14), + (96, G["not"]): ("SHIFT", 30), (96, G["isvoid"]): ("SHIFT", 24), + (96, G["false"]): ("SHIFT", 26), (96, G["int"]): ("SHIFT", 34), (96, G["id"]): ("SHIFT", 31), - (96, G["while"]): ("SHIFT", 13), - (96, G["{"]): ("SHIFT", 10), - (96, G["new"]): ("SHIFT", 22), - (96, G["false"]): ("SHIFT", 26), + (96, G["let"]): ("SHIFT", 14), (96, G["("]): ("SHIFT", 11), - (96, G["~"]): ("SHIFT", 27), + (96, G["if"]): ("SHIFT", 12), + (96, G["true"]): ("SHIFT", 25), + (96, G["while"]): ("SHIFT", 13), (96, G["string"]): ("SHIFT", 33), + (96, G["~"]): ("SHIFT", 27), (96, G["case"]): ("SHIFT", 21), - (96, G["not"]): ("SHIFT", 30), + (96, G["new"]): ("SHIFT", 22), + (96, G["{"]): ("SHIFT", 10), (97, G["pool"]): ("SHIFT", 98), - (98, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["then"]): ("SHIFT", 100), (100, G["if"]): ("SHIFT", 12), (100, G["~"]): ("SHIFT", 27), - (100, G["new"]): ("SHIFT", 22), - (100, G["let"]): ("SHIFT", 14), (100, G["id"]): ("SHIFT", 31), (100, G["false"]): ("SHIFT", 26), - (100, G["("]): ("SHIFT", 11), - (100, G["string"]): ("SHIFT", 33), (100, G["while"]): ("SHIFT", 13), + (100, G["case"]): ("SHIFT", 21), + (100, G["int"]): ("SHIFT", 34), + (100, G["("]): ("SHIFT", 11), + (100, G["true"]): ("SHIFT", 25), (100, G["{"]): ("SHIFT", 10), (100, G["isvoid"]): ("SHIFT", 24), - (100, G["true"]): ("SHIFT", 25), + (100, G["string"]): ("SHIFT", 33), (100, G["not"]): ("SHIFT", 30), - (100, G["case"]): ("SHIFT", 21), - (100, G["int"]): ("SHIFT", 34), + (100, G["new"]): ("SHIFT", 22), + (100, G["let"]): ("SHIFT", 14), (101, G["else"]): ("SHIFT", 102), - (102, G["let"]): ("SHIFT", 14), - (102, G["~"]): ("SHIFT", 27), - (102, G["true"]): ("SHIFT", 25), + (102, G["isvoid"]): ("SHIFT", 24), + (102, G["false"]): ("SHIFT", 26), + (102, G["int"]): ("SHIFT", 34), (102, G["id"]): ("SHIFT", 31), - (102, G["while"]): ("SHIFT", 13), (102, G["{"]): ("SHIFT", 10), - (102, G["int"]): ("SHIFT", 34), - (102, G["new"]): ("SHIFT", 22), - (102, G["case"]): ("SHIFT", 21), - (102, G["not"]): ("SHIFT", 30), - (102, G["false"]): ("SHIFT", 26), - (102, G["isvoid"]): ("SHIFT", 24), (102, G["("]): ("SHIFT", 11), + (102, G["true"]): ("SHIFT", 25), + (102, G["not"]): ("SHIFT", 30), + (102, G["~"]): ("SHIFT", 27), (102, G["string"]): ("SHIFT", 33), + (102, G["let"]): ("SHIFT", 14), (102, G["if"]): ("SHIFT", 12), + (102, G["new"]): ("SHIFT", 22), + (102, G["while"]): ("SHIFT", 13), + (102, G["case"]): ("SHIFT", 21), (103, G["fi"]): ("SHIFT", 104), - (104, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G[")"]): ("SHIFT", 106), (106, G["of"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["<"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["error"]): ("REDUCE", G["atom -> ( expr )"]), (106, G[")"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["then"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["<="]): ("REDUCE", G["atom -> ( expr )"]), @@ -986,354 +985,357 @@ def __action_table(): (106, G["="]): ("REDUCE", G["atom -> ( expr )"]), (106, G[","]): ("REDUCE", G["atom -> ( expr )"]), (106, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["error"]): ("REDUCE", G["atom -> ( expr )"]), (106, G[";"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["@"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["/"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["+"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["-"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["in"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["*"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["}"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["/"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["}"]): ("SHIFT", 108), - (108, G[";"]): ("REDUCE", G["expr -> { block }"]), - (108, G["of"]): ("REDUCE", G["expr -> { block }"]), - (108, G["loop"]): ("REDUCE", G["expr -> { block }"]), - (108, G["error"]): ("REDUCE", G["expr -> { block }"]), - (108, G[")"]): ("REDUCE", G["expr -> { block }"]), (108, G["pool"]): ("REDUCE", G["expr -> { block }"]), + (108, G[")"]): ("REDUCE", G["expr -> { block }"]), (108, G["then"]): ("REDUCE", G["expr -> { block }"]), (108, G["else"]): ("REDUCE", G["expr -> { block }"]), (108, G[","]): ("REDUCE", G["expr -> { block }"]), (108, G["in"]): ("REDUCE", G["expr -> { block }"]), (108, G["fi"]): ("REDUCE", G["expr -> { block }"]), + (108, G["error"]): ("REDUCE", G["expr -> { block }"]), (108, G["}"]): ("REDUCE", G["expr -> { block }"]), + (108, G["of"]): ("REDUCE", G["expr -> { block }"]), + (108, G[";"]): ("REDUCE", G["expr -> { block }"]), + (108, G["loop"]): ("REDUCE", G["expr -> { block }"]), (109, G[";"]): ("SHIFT", 110), - (110, G["while"]): ("SHIFT", 13), + (109, G["error"]): ("SHIFT", 112), + (110, G["true"]): ("SHIFT", 25), + (110, G["("]): ("SHIFT", 11), (110, G["{"]): ("SHIFT", 10), - (110, G["~"]): ("SHIFT", 27), - (110, G["int"]): ("SHIFT", 34), - (110, G["case"]): ("SHIFT", 21), - (110, G["not"]): ("SHIFT", 30), - (110, G["new"]): ("SHIFT", 22), (110, G["id"]): ("SHIFT", 31), - (110, G["false"]): ("SHIFT", 26), - (110, G["}"]): ("REDUCE", G["block -> expr ;"]), - (110, G["("]): ("SHIFT", 11), + (110, G["not"]): ("SHIFT", 30), (110, G["string"]): ("SHIFT", 33), - (110, G["if"]): ("SHIFT", 12), - (110, G["isvoid"]): ("SHIFT", 24), (110, G["let"]): ("SHIFT", 14), - (110, G["true"]): ("SHIFT", 25), + (110, G["isvoid"]): ("SHIFT", 24), + (110, G["new"]): ("SHIFT", 22), + (110, G["if"]): ("SHIFT", 12), + (110, G["}"]): ("REDUCE", G["block -> expr ;"]), + (110, G["case"]): ("SHIFT", 21), + (110, G["while"]): ("SHIFT", 13), + (110, G["~"]): ("SHIFT", 27), + (110, G["false"]): ("SHIFT", 26), + (110, G["int"]): ("SHIFT", 34), (111, G["}"]): ("REDUCE", G["block -> expr ; block"]), - (112, G["}"]): ("SHIFT", 113), - (113, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), - (113, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), - (114, G[":"]): ("SHIFT", 115), - (115, G["type"]): ("SHIFT", 116), - (116, G[","]): ("SHIFT", 117), - (116, G[")"]): ("REDUCE", G["param-list -> id : type"]), - (117, G["id"]): ("SHIFT", 114), - (118, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), - (119, G[")"]): ("SHIFT", 120), - (120, G[":"]): ("SHIFT", 121), - (121, G["type"]): ("SHIFT", 122), - (122, G["{"]): ("SHIFT", 123), - (123, G["true"]): ("SHIFT", 25), - (123, G["id"]): ("SHIFT", 31), - (123, G["while"]): ("SHIFT", 13), - (123, G["{"]): ("SHIFT", 10), - (123, G["~"]): ("SHIFT", 27), - (123, G["int"]): ("SHIFT", 34), - (123, G["new"]): ("SHIFT", 22), - (123, G["case"]): ("SHIFT", 21), - (123, G["not"]): ("SHIFT", 30), - (123, G["false"]): ("SHIFT", 26), - (123, G["("]): ("SHIFT", 11), - (123, G["string"]): ("SHIFT", 33), - (123, G["isvoid"]): ("SHIFT", 24), - (123, G["if"]): ("SHIFT", 12), - (123, G["let"]): ("SHIFT", 14), - (124, G["}"]): ("SHIFT", 125), - (125, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), - (125, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), - (126, G["type"]): ("SHIFT", 127), - (127, G["<-"]): ("SHIFT", 128), - (127, G[";"]): ("REDUCE", G["attribute -> id : type"]), - (127, G["error"]): ("REDUCE", G["attribute -> id : type"]), - (128, G["~"]): ("SHIFT", 27), - (128, G["new"]): ("SHIFT", 22), - (128, G["id"]): ("SHIFT", 31), - (128, G["false"]): ("SHIFT", 26), - (128, G["("]): ("SHIFT", 11), - (128, G["case"]): ("SHIFT", 21), - (128, G["string"]): ("SHIFT", 33), - (128, G["not"]): ("SHIFT", 30), - (128, G["if"]): ("SHIFT", 12), - (128, G["isvoid"]): ("SHIFT", 24), - (128, G["let"]): ("SHIFT", 14), - (128, G["true"]): ("SHIFT", 25), - (128, G["while"]): ("SHIFT", 13), - (128, G["int"]): ("SHIFT", 34), - (128, G["{"]): ("SHIFT", 10), - (129, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), - (129, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), - (130, G["}"]): ("SHIFT", 131), - (131, G["class"]): ("REDUCE", G["class-def -> class type { feature-list }"]), - (131, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), - (132, G[";"]): ("SHIFT", 133), - (132, G["error"]): ("SHIFT", 140), - (133, G["id"]): ("SHIFT", 4), - (133, G["}"]): ("REDUCE", G["feature-list -> e"]), - (134, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), - (135, G[";"]): ("SHIFT", 136), - (135, G["error"]): ("SHIFT", 138), - (136, G["id"]): ("SHIFT", 4), - (136, G["}"]): ("REDUCE", G["feature-list -> e"]), - (137, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), - (138, G["id"]): ("SHIFT", 4), - (138, G["}"]): ("REDUCE", G["feature-list -> e"]), - (139, G["}"]): ("REDUCE", G["feature-list -> method error feature-list"]), - (140, G["id"]): ("SHIFT", 4), - (140, G["}"]): ("REDUCE", G["feature-list -> e"]), - (141, G["}"]): ("REDUCE", G["feature-list -> attribute error feature-list"]), - (142, G["type"]): ("SHIFT", 143), - (143, G["{"]): ("SHIFT", 144), - (144, G["id"]): ("SHIFT", 4), - (144, G["}"]): ("REDUCE", G["feature-list -> e"]), - (145, G["}"]): ("SHIFT", 146), - (146, G["class"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), - (146, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), - (147, G["$"]): ("OK", None), - (148, G["$"]): ("REDUCE", G["program -> class-list"]), - (149, G["class"]): ("SHIFT", 1), - (149, G["$"]): ("REDUCE", G["class-list -> class-def"]), - (150, G["$"]): ("REDUCE", G["class-list -> class-def class-list"]), + (112, G["}"]): ("REDUCE", G["block -> expr error"]), + (113, G["}"]): ("SHIFT", 114), + (114, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (114, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (115, G[":"]): ("SHIFT", 116), + (116, G["type"]): ("SHIFT", 117), + (117, G[","]): ("SHIFT", 118), + (117, G[")"]): ("REDUCE", G["param-list -> id : type"]), + (118, G["id"]): ("SHIFT", 115), + (119, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), + (120, G[")"]): ("SHIFT", 121), + (121, G[":"]): ("SHIFT", 122), + (122, G["type"]): ("SHIFT", 123), + (123, G["{"]): ("SHIFT", 124), + (124, G["true"]): ("SHIFT", 25), + (124, G["if"]): ("SHIFT", 12), + (124, G["id"]): ("SHIFT", 31), + (124, G["string"]): ("SHIFT", 33), + (124, G["while"]): ("SHIFT", 13), + (124, G["case"]): ("SHIFT", 21), + (124, G["~"]): ("SHIFT", 27), + (124, G["new"]): ("SHIFT", 22), + (124, G["let"]): ("SHIFT", 14), + (124, G["{"]): ("SHIFT", 10), + (124, G["not"]): ("SHIFT", 30), + (124, G["false"]): ("SHIFT", 26), + (124, G["int"]): ("SHIFT", 34), + (124, G["isvoid"]): ("SHIFT", 24), + (124, G["("]): ("SHIFT", 11), + (125, G["}"]): ("SHIFT", 126), + (126, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (126, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (127, G["type"]): ("SHIFT", 128), + (128, G["<-"]): ("SHIFT", 129), + (128, G[";"]): ("REDUCE", G["attribute -> id : type"]), + (128, G["error"]): ("REDUCE", G["attribute -> id : type"]), + (129, G["true"]): ("SHIFT", 25), + (129, G["("]): ("SHIFT", 11), + (129, G["{"]): ("SHIFT", 10), + (129, G["id"]): ("SHIFT", 31), + (129, G["not"]): ("SHIFT", 30), + (129, G["string"]): ("SHIFT", 33), + (129, G["let"]): ("SHIFT", 14), + (129, G["isvoid"]): ("SHIFT", 24), + (129, G["new"]): ("SHIFT", 22), + (129, G["if"]): ("SHIFT", 12), + (129, G["case"]): ("SHIFT", 21), + (129, G["while"]): ("SHIFT", 13), + (129, G["~"]): ("SHIFT", 27), + (129, G["false"]): ("SHIFT", 26), + (129, G["int"]): ("SHIFT", 34), + (130, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (130, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (131, G["}"]): ("SHIFT", 132), + (132, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), + (132, G["class"]): ("REDUCE", G["class-def -> class type { feature-list }"]), + (133, G["error"]): ("SHIFT", 141), + (133, G[";"]): ("SHIFT", 134), + (134, G["id"]): ("SHIFT", 4), + (134, G["}"]): ("REDUCE", G["feature-list -> e"]), + (135, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), + (136, G["error"]): ("SHIFT", 139), + (136, G[";"]): ("SHIFT", 137), + (137, G["id"]): ("SHIFT", 4), + (137, G["}"]): ("REDUCE", G["feature-list -> e"]), + (138, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), + (139, G["id"]): ("SHIFT", 4), + (139, G["}"]): ("REDUCE", G["feature-list -> e"]), + (140, G["}"]): ("REDUCE", G["feature-list -> method error feature-list"]), + (141, G["id"]): ("SHIFT", 4), + (141, G["}"]): ("REDUCE", G["feature-list -> e"]), + (142, G["}"]): ("REDUCE", G["feature-list -> attribute error feature-list"]), + (143, G["type"]): ("SHIFT", 144), + (144, G["{"]): ("SHIFT", 145), + (145, G["id"]): ("SHIFT", 4), + (145, G["}"]): ("REDUCE", G["feature-list -> e"]), + (146, G["}"]): ("SHIFT", 147), + (147, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), + (147, G["class"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), + (148, G["$"]): ("OK", None), + (149, G["$"]): ("REDUCE", G["program -> class-list"]), + (150, G["class"]): ("SHIFT", 1), + (150, G["$"]): ("REDUCE", G["class-list -> class-def"]), + (151, G["$"]): ("REDUCE", G["class-list -> class-def class-list"]), } @staticmethod def __goto_table(): return { - (0, G["class-list"]): 148, - (0, G["program"]): 147, - (0, G["class-def"]): 149, - (3, G["attribute"]): 132, - (3, G["method"]): 135, - (3, G["feature-list"]): 130, - (5, G["param-list"]): 119, + (0, G["class-def"]): 150, + (0, G["class-list"]): 149, + (0, G["program"]): 148, + (3, G["attribute"]): 133, + (3, G["method"]): 136, + (3, G["feature-list"]): 131, + (5, G["param-list"]): 120, (9, G["arith"]): 38, + (9, G["expr"]): 113, (9, G["term"]): 53, - (9, G["comp"]): 37, (9, G["atom"]): 43, - (9, G["function-call"]): 35, - (9, G["expr"]): 112, (9, G["factor"]): 56, + (9, G["comp"]): 37, + (9, G["function-call"]): 35, + (10, G["expr"]): 109, + (10, G["factor"]): 56, + (10, G["comp"]): 37, (10, G["arith"]): 38, (10, G["term"]): 53, (10, G["block"]): 107, (10, G["atom"]): 43, - (10, G["expr"]): 109, (10, G["function-call"]): 35, - (10, G["factor"]): 56, - (10, G["comp"]): 37, (11, G["arith"]): 38, - (11, G["factor"]): 56, - (11, G["expr"]): 105, (11, G["term"]): 53, - (11, G["atom"]): 43, (11, G["function-call"]): 35, + (11, G["atom"]): 43, + (11, G["expr"]): 105, + (11, G["factor"]): 56, (11, G["comp"]): 37, (12, G["term"]): 53, - (12, G["factor"]): 56, (12, G["arith"]): 38, - (12, G["comp"]): 37, (12, G["atom"]): 43, + (12, G["factor"]): 56, (12, G["function-call"]): 35, (12, G["expr"]): 99, - (13, G["expr"]): 95, - (13, G["term"]): 53, - (13, G["factor"]): 56, + (12, G["comp"]): 37, (13, G["arith"]): 38, (13, G["comp"]): 37, + (13, G["term"]): 53, (13, G["atom"]): 43, (13, G["function-call"]): 35, + (13, G["expr"]): 95, + (13, G["factor"]): 56, (14, G["declaration-list"]): 92, (18, G["declaration-list"]): 19, (20, G["arith"]): 38, - (20, G["expr"]): 89, - (20, G["term"]): 53, - (20, G["comp"]): 37, (20, G["atom"]): 43, + (20, G["comp"]): 37, (20, G["function-call"]): 35, + (20, G["term"]): 53, + (20, G["expr"]): 89, (20, G["factor"]): 56, + (21, G["atom"]): 43, + (21, G["factor"]): 56, (21, G["arith"]): 38, (21, G["term"]): 53, - (21, G["factor"]): 56, - (21, G["expr"]): 77, (21, G["comp"]): 37, - (21, G["atom"]): 43, (21, G["function-call"]): 35, + (21, G["expr"]): 77, (24, G["atom"]): 43, - (24, G["factor"]): 76, (24, G["function-call"]): 35, + (24, G["factor"]): 76, (27, G["atom"]): 43, - (27, G["factor"]): 75, (27, G["function-call"]): 35, - (29, G["arith"]): 38, + (27, G["factor"]): 75, (29, G["term"]): 53, - (29, G["atom"]): 43, - (29, G["function-call"]): 35, - (29, G["comp"]): 37, (29, G["not-empty-expr-list"]): 49, (29, G["expr"]): 50, - (29, G["factor"]): 56, + (29, G["atom"]): 43, + (29, G["arith"]): 38, (29, G["expr-list"]): 73, - (30, G["term"]): 53, - (30, G["factor"]): 56, + (29, G["factor"]): 56, + (29, G["function-call"]): 35, + (29, G["comp"]): 37, (30, G["arith"]): 38, - (30, G["expr"]): 72, - (30, G["comp"]): 37, + (30, G["factor"]): 56, + (30, G["term"]): 53, (30, G["atom"]): 43, + (30, G["expr"]): 72, (30, G["function-call"]): 35, - (32, G["term"]): 53, - (32, G["factor"]): 56, + (30, G["comp"]): 37, (32, G["arith"]): 38, - (32, G["comp"]): 37, - (32, G["atom"]): 43, + (32, G["factor"]): 56, + (32, G["term"]): 53, (32, G["expr"]): 36, + (32, G["atom"]): 43, (32, G["function-call"]): 35, - (39, G["term"]): 40, + (32, G["comp"]): 37, (39, G["factor"]): 56, - (39, G["atom"]): 43, (39, G["function-call"]): 35, - (41, G["atom"]): 43, + (39, G["term"]): 40, + (39, G["atom"]): 43, (41, G["factor"]): 42, + (41, G["atom"]): 43, (41, G["function-call"]): 35, - (46, G["arith"]): 38, (46, G["term"]): 53, - (46, G["atom"]): 43, - (46, G["function-call"]): 35, - (46, G["comp"]): 37, (46, G["not-empty-expr-list"]): 49, (46, G["expr"]): 50, + (46, G["atom"]): 43, + (46, G["arith"]): 38, (46, G["factor"]): 56, + (46, G["function-call"]): 35, (46, G["expr-list"]): 47, - (51, G["arith"]): 38, + (46, G["comp"]): 37, (51, G["term"]): 53, + (51, G["expr"]): 50, (51, G["atom"]): 43, + (51, G["arith"]): 38, + (51, G["factor"]): 56, (51, G["function-call"]): 35, (51, G["comp"]): 37, - (51, G["expr"]): 50, - (51, G["factor"]): 56, (51, G["not-empty-expr-list"]): 52, - (54, G["factor"]): 55, (54, G["atom"]): 43, (54, G["function-call"]): 35, - (61, G["arith"]): 38, + (54, G["factor"]): 55, (61, G["term"]): 53, - (61, G["atom"]): 43, - (61, G["function-call"]): 35, - (61, G["comp"]): 37, (61, G["not-empty-expr-list"]): 49, + (61, G["expr-list"]): 62, (61, G["expr"]): 50, + (61, G["atom"]): 43, + (61, G["arith"]): 38, (61, G["factor"]): 56, - (61, G["expr-list"]): 62, - (64, G["term"]): 65, + (61, G["function-call"]): 35, + (61, G["comp"]): 37, (64, G["factor"]): 56, - (64, G["atom"]): 43, (64, G["function-call"]): 35, - (66, G["atom"]): 43, + (64, G["term"]): 65, + (64, G["atom"]): 43, (66, G["arith"]): 67, (66, G["term"]): 53, (66, G["factor"]): 56, + (66, G["atom"]): 43, (66, G["function-call"]): 35, - (68, G["atom"]): 43, - (68, G["arith"]): 69, (68, G["term"]): 53, (68, G["factor"]): 56, + (68, G["atom"]): 43, + (68, G["arith"]): 69, (68, G["function-call"]): 35, - (70, G["atom"]): 43, - (70, G["arith"]): 71, (70, G["term"]): 53, (70, G["factor"]): 56, + (70, G["atom"]): 43, + (70, G["arith"]): 71, (70, G["function-call"]): 35, (78, G["case-list"]): 87, - (82, G["term"]): 53, + (82, G["factor"]): 56, + (82, G["comp"]): 37, (82, G["expr"]): 83, - (82, G["atom"]): 43, (82, G["arith"]): 38, + (82, G["term"]): 53, + (82, G["atom"]): 43, (82, G["function-call"]): 35, - (82, G["factor"]): 56, - (82, G["comp"]): 37, (84, G["case-list"]): 85, (90, G["declaration-list"]): 91, - (93, G["term"]): 53, - (93, G["factor"]): 56, (93, G["arith"]): 38, - (93, G["expr"]): 94, - (93, G["comp"]): 37, + (93, G["factor"]): 56, + (93, G["term"]): 53, (93, G["atom"]): 43, (93, G["function-call"]): 35, - (96, G["expr"]): 97, + (93, G["expr"]): 94, + (93, G["comp"]): 37, + (96, G["atom"]): 43, (96, G["arith"]): 38, - (96, G["comp"]): 37, (96, G["term"]): 53, (96, G["factor"]): 56, - (96, G["atom"]): 43, + (96, G["comp"]): 37, + (96, G["expr"]): 97, (96, G["function-call"]): 35, - (100, G["term"]): 53, - (100, G["arith"]): 38, + (100, G["factor"]): 56, (100, G["atom"]): 43, - (100, G["function-call"]): 35, + (100, G["arith"]): 38, (100, G["comp"]): 37, - (100, G["factor"]): 56, + (100, G["term"]): 53, (100, G["expr"]): 101, + (100, G["function-call"]): 35, (102, G["arith"]): 38, - (102, G["term"]): 53, - (102, G["comp"]): 37, (102, G["atom"]): 43, - (102, G["function-call"]): 35, + (102, G["comp"]): 37, + (102, G["term"]): 53, (102, G["factor"]): 56, + (102, G["function-call"]): 35, (102, G["expr"]): 103, + (110, G["expr"]): 109, + (110, G["factor"]): 56, + (110, G["comp"]): 37, (110, G["arith"]): 38, (110, G["term"]): 53, (110, G["atom"]): 43, - (110, G["expr"]): 109, (110, G["function-call"]): 35, (110, G["block"]): 111, - (110, G["factor"]): 56, - (110, G["comp"]): 37, - (117, G["param-list"]): 118, - (123, G["arith"]): 38, - (123, G["term"]): 53, - (123, G["comp"]): 37, - (123, G["expr"]): 124, - (123, G["atom"]): 43, - (123, G["function-call"]): 35, - (123, G["factor"]): 56, - (128, G["term"]): 53, - (128, G["atom"]): 43, - (128, G["arith"]): 38, - (128, G["function-call"]): 35, - (128, G["expr"]): 129, - (128, G["factor"]): 56, - (128, G["comp"]): 37, - (133, G["attribute"]): 132, - (133, G["method"]): 135, - (133, G["feature-list"]): 134, - (136, G["feature-list"]): 137, - (136, G["attribute"]): 132, - (136, G["method"]): 135, - (138, G["attribute"]): 132, - (138, G["feature-list"]): 139, - (138, G["method"]): 135, - (140, G["attribute"]): 132, - (140, G["feature-list"]): 141, - (140, G["method"]): 135, - (144, G["feature-list"]): 145, - (144, G["attribute"]): 132, - (144, G["method"]): 135, - (149, G["class-list"]): 150, - (149, G["class-def"]): 149, + (118, G["param-list"]): 119, + (124, G["arith"]): 38, + (124, G["term"]): 53, + (124, G["atom"]): 43, + (124, G["expr"]): 125, + (124, G["factor"]): 56, + (124, G["comp"]): 37, + (124, G["function-call"]): 35, + (129, G["factor"]): 56, + (129, G["comp"]): 37, + (129, G["arith"]): 38, + (129, G["term"]): 53, + (129, G["atom"]): 43, + (129, G["expr"]): 130, + (129, G["function-call"]): 35, + (134, G["feature-list"]): 135, + (134, G["attribute"]): 133, + (134, G["method"]): 136, + (137, G["feature-list"]): 138, + (137, G["attribute"]): 133, + (137, G["method"]): 136, + (139, G["feature-list"]): 140, + (139, G["attribute"]): 133, + (139, G["method"]): 136, + (141, G["attribute"]): 133, + (141, G["method"]): 136, + (141, G["feature-list"]): 142, + (145, G["feature-list"]): 146, + (145, G["attribute"]): 133, + (145, G["method"]): 136, + (150, G["class-def"]): 150, + (150, G["class-list"]): 151, } diff --git a/pyjapt/grammar.py b/pyjapt/grammar.py index 85cc7c08b..295ecc6ef 100755 --- a/pyjapt/grammar.py +++ b/pyjapt/grammar.py @@ -1,5 +1,6 @@ import json import re +import sys from typing import List, FrozenSet, Optional, Tuple, Iterable, Callable, Dict from .lexing import Lexer, Token @@ -604,5 +605,5 @@ def success(self): def warning(self): pass - def error(self): - pass + def error(self, message): + sys.stderr.write(message + '\n') diff --git a/pyjapt/parsing.py b/pyjapt/parsing.py index 1af80a8db..9e52af4d1 100755 --- a/pyjapt/parsing.py +++ b/pyjapt/parsing.py @@ -309,6 +309,7 @@ class ShiftReduceParser: SHIFT = 'SHIFT' REDUCE = 'REDUCE' OK = 'OK' + conatins_errors = False def __init__(self, G): self.G = G @@ -317,7 +318,6 @@ def __init__(self, G): self.follows = compute_follows(self.augmented_G, self.firsts) self.automaton = self._build_automaton() self.conflicts = [] - self.errors = [] self.action = {} self.goto = {} @@ -382,18 +382,22 @@ def __call__(self, tokens): cursor = 0 while True: - state = stack[-1] + if cursor >= len(tokens): + return + + state = stack[-1] lookahead = tokens[cursor] ########################## # Error Handling Section # ########################## if (state, lookahead.token_type) not in self.action: + self.conatins_errors = True try: # Try to insert an error token into the stack action, tag = self.action[state, self.G.ERROR] lookahead.token_type = self.G.ERROR - stack += [lookahead.token_type, lookahead.lex, tag] + stack += [lookahead.token_type, lookahead, tag] cursor += 1 except KeyError: # If an error insertion fails then the parsing process enter into a panic mode recovery @@ -402,7 +406,7 @@ def __call__(self, tokens): while (state, lookahead.token_type) not in self.action: cursor += 1 if cursor >= len(tokens): - return None + return lookahead = tokens[cursor] continue ####### diff --git a/semantics/progam_executor.py b/semantics/progam_executor.py index 2ece448bb..84f93376a 100644 --- a/semantics/progam_executor.py +++ b/semantics/progam_executor.py @@ -259,10 +259,10 @@ def visit(self, node: ast.InstantiateNode, scope: Scope): self.call_stack.append(self.current_instance) self.current_instance = instance fake_scope = Scope() - for attribute, _ in instance.type.all_attributes(): - attr_instance = self.visit(attribute.expr, fake_scope) - fake_scope.define_variable(attribute.name, attribute.type).instance = attr_instance - attr_instance.set_attribute_instance(attribute.name, attr_instance) + for attr, _ in instance.type.all_attributes(): + attr_instance = self.visit(attr.expr, fake_scope) if attr.expr is not None else VoidInstance() + fake_scope.define_variable(attr.name, attr.type).instance = attr_instance + self.current_instance.set_attribute_instance(attr.name, attr_instance) self.current_instance = self.call_stack.pop() return instance diff --git a/semantics/type_builder.py b/semantics/type_builder.py index 7d5fa9a7c..40f981d38 100644 --- a/semantics/type_builder.py +++ b/semantics/type_builder.py @@ -35,7 +35,7 @@ def visit(self, node: ast.ClassDeclarationNode): if node.parent is not None: if node.parent in ("Int", "String", "Bool", "SELF_TYPE"): - self.errors.append(err.INVALID_PARENT_TYPE) + self.errors.append(err.INVALID_PARENT_TYPE % (node.id, node.parent)) try: self.current_type.set_parent(self.context.get_type(node.parent)) diff --git a/semantics/type_checker.py b/semantics/type_checker.py index a33d661fe..5c40aebdb 100644 --- a/semantics/type_checker.py +++ b/semantics/type_checker.py @@ -31,9 +31,6 @@ def visit(self, node: ast.ProgramNode, scope: Scope = None): def visit(self, node: ast.ClassDeclarationNode, scope: Scope): self.current_type = self.context.get_type(node.id) - if node.parent is not None and node.parent == 'SELF_TYPE': - self.errors.append(err.INVALID_PARENT_TYPE % (node.id, node.parent)) - attrs = [feature for feature in node.features if isinstance(feature, ast.AttrDeclarationNode)] methods = [feature for feature in node.features if isinstance(feature, ast.MethodDeclarationNode)] diff --git a/semantics/type_inference.py b/semantics/type_inference.py index fdd5d23cd..8f965b1cc 100644 --- a/semantics/type_inference.py +++ b/semantics/type_inference.py @@ -216,7 +216,7 @@ def visit(self, node: ast.ClassDeclarationNode, scope: Scope): for attr in attrs: self.visit(attr, scope) - for i, method in enumerate(methods): + for method in methods: self.visit(method, scope.create_child()) @visitor.when(ast.AttrDeclarationNode) From 05eb4693acef3be861e29bbee4ac3499f71b8ae2 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Tue, 26 May 2020 03:53:51 -0400 Subject: [PATCH 061/143] ZeroDivisionError added to Runtime Process --- main.py | 22 +++++++++++++--------- semantics/progam_executor.py | 17 +++++++++++++---- semantics/utils/errors.py | 3 +++ 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/main.py b/main.py index 425408c5d..ad1698284 100755 --- a/main.py +++ b/main.py @@ -1,25 +1,27 @@ +import sys + from lexer import CoolLexer from parser import CoolParser from semantics import (TypeCollector, TypeBuilder, OverriddenMethodChecker, TypeChecker, topological_ordering, Formatter) from semantics.formatter import CodeBuilder -from semantics.progam_executor import Executor +from semantics.progam_executor import Executor, ExecutionError from semantics.utils.scope import Context, Scope from semantics.type_inference import InferenceChecker detecting_errors = r""" -class A { +(* class A { a (n: Int) : Int { 0 }; } class B inherits A { a (x: String) : String { 1 }; -} +} *) class Main { x: Int; main (): Object { - 0 + 1 / 0 }; } """ @@ -143,12 +145,14 @@ class Main inherits IO { TypeChecker(context, errors).visit(ast, scope) if verbose: - print(CodeBuilder().visit(ast, 0)) + print(CodeBuilder().visit(ast, 0), '\n') if not errors: - print() - Executor(context, errors).visit(ast, Scope()) - print('Program finished...') + try: + Executor(context).visit(ast, Scope()) + print('Program finished...') + except ExecutionError as e: + sys.stderr.write(e.text + '\n') for error in errors: - print(error) + sys.stderr.write(error + '\n') diff --git a/semantics/progam_executor.py b/semantics/progam_executor.py index 84f93376a..6501a9539 100644 --- a/semantics/progam_executor.py +++ b/semantics/progam_executor.py @@ -1,10 +1,17 @@ from typing import List, Dict, Any import semantics.utils.astnodes as ast +import semantics.utils.errors as err import semantics.visitor as visitor from semantics.utils.scope import Context, Type, Method, Scope +class ExecutionError(Exception): + @property + def text(self): + return self.args[0] + + def abort(obj, context): print('Aborting Program') exit() @@ -95,9 +102,8 @@ def __eq__(self, other): class Executor: - def __init__(self, context: Context, errors: List[str] = []): + def __init__(self, context: Context): self.context: Context = context - self.errors: List[str] = errors self.current_type: Type = None self.current_instance: Instance = None self.call_stack: list = [] @@ -298,8 +304,11 @@ def visit(self, node: ast.StarNode, scope: Scope): @visitor.when(ast.DivNode) def visit(self, node: ast.DivNode, scope: Scope): - value = self.visit(node.left, scope).value / self.visit(node.right, scope).value - return Instance(self.context.get_type('Int'), value) + try: + value = self.visit(node.left, scope).value / self.visit(node.right, scope).value + return Instance(self.context.get_type('Int'), value) + except ZeroDivisionError: + raise ExecutionError(err.DIVIDE_BY_ZERO) @visitor.when(ast.LessEqualNode) def visit(self, node: ast.LessEqualNode, scope: Scope): diff --git a/semantics/utils/errors.py b/semantics/utils/errors.py index 8f00a0e65..739e60206 100644 --- a/semantics/utils/errors.py +++ b/semantics/utils/errors.py @@ -20,3 +20,6 @@ INFERENCE_ERROR_PARAMETER = 'InferenceError: Cannot infer type for parameter "%s".' INFERENCE_ERROR_VARIABLE = 'InferenceError: Cannot infer type for variable "%s".' INFERENCE_ERROR_METHOD = 'InferenceError: Cannot infer return type for method "%s".' + + +DIVIDE_BY_ZERO = 'ZeroDivisionError: Division by zero.' \ No newline at end of file From cc4bc005402b5db0ff8b286749352faaaa9afb28 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Wed, 27 May 2020 01:27:18 -0400 Subject: [PATCH 062/143] Detecting VoidReferenceError as an ExecutionError --- main.py | 6 +++++- semantics/progam_executor.py | 6 ++++-- semantics/utils/errors.py | 3 ++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index ad1698284..29c4f732e 100755 --- a/main.py +++ b/main.py @@ -21,7 +21,11 @@ class Main { x: Int; main (): Object { - 1 / 0 + let a: Main in a.f() + }; + + f() : Int { + 0 }; } """ diff --git a/semantics/progam_executor.py b/semantics/progam_executor.py index 6501a9539..56104ba9e 100644 --- a/semantics/progam_executor.py +++ b/semantics/progam_executor.py @@ -182,8 +182,7 @@ def visit(self, node: ast.SwitchCaseNode, scope: Scope): instance = self.visit(node.expr, scope) if isinstance(instance, VoidInstance): - # RuntimeError - pass + raise ExecutionError() types = [(i, self.context.get_type(t)) for i, (_, t, _) in enumerate(node.cases) if instance.type.conforms_to(self.context.get_type(t))] @@ -206,6 +205,9 @@ def visit(self, node: ast.SwitchCaseNode, scope: Scope): def visit(self, node: ast.MethodCallNode, scope: Scope): obj_instance = self.visit(node.obj, scope) + if isinstance(obj_instance, VoidInstance): + raise ExecutionError(err.VOID_EXPRESSION) + if obj_instance.type.conforms_to(self.context.get_type('Object')) and ('Object', node.id) in defaults: args = (obj_instance,) + tuple(self.visit(arg, scope) for arg in node.args) + (self.context,) return defaults['Object', node.id](*args) diff --git a/semantics/utils/errors.py b/semantics/utils/errors.py index 739e60206..22e44b504 100644 --- a/semantics/utils/errors.py +++ b/semantics/utils/errors.py @@ -22,4 +22,5 @@ INFERENCE_ERROR_METHOD = 'InferenceError: Cannot infer return type for method "%s".' -DIVIDE_BY_ZERO = 'ZeroDivisionError: Division by zero.' \ No newline at end of file +DIVIDE_BY_ZERO = 'ZeroDivisionError: Division by zero.' +VOID_EXPRESSION = 'VoidReferenceError: Object reference not set to an instance of an object.' From 0f3a1fc42c453417d162033d955756d8172187ad Mon Sep 17 00:00:00 2001 From: Alejandro Klever Clemente Date: Wed, 10 Jun 2020 11:18:09 +0200 Subject: [PATCH 063/143] Changed Parser and Lexer default serialization file names --- cool.sh | 9 - grammar.py | 1 + lexer.py => lexertab.py | 0 main.py | 9 +- parser.py => parsertab.py | 1474 ++++++++++++++++++------------------- pyjapt/serialization.py | 8 +- 6 files changed, 747 insertions(+), 754 deletions(-) delete mode 100755 cool.sh rename lexer.py => lexertab.py (100%) mode change 100755 => 100644 rename parser.py => parsertab.py (100%) mode change 100755 => 100644 diff --git a/cool.sh b/cool.sh deleted file mode 100755 index 7cf4723e8..000000000 --- a/cool.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -echo "Hello World" - -for i in {1..5} ; do - if [ $i ]; then - echo $i - fi -done \ No newline at end of file diff --git a/grammar.py b/grammar.py index a7377706e..d03a3f7f7 100755 --- a/grammar.py +++ b/grammar.py @@ -226,6 +226,7 @@ def case_list_error(s): s.error(f"{s[5].line, s[5].column} - SyntacticError: Expected ';' instead of '{s[5].lex}'") return [(s[1], s[3], s[5])] + @G.production("block -> expr error") def block_single_error(s): s.error(f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") diff --git a/lexer.py b/lexertab.py old mode 100755 new mode 100644 similarity index 100% rename from lexer.py rename to lexertab.py diff --git a/main.py b/main.py index 29c4f732e..07198a285 100755 --- a/main.py +++ b/main.py @@ -1,12 +1,12 @@ import sys -from lexer import CoolLexer -from parser import CoolParser -from semantics import (TypeCollector, TypeBuilder, OverriddenMethodChecker, TypeChecker, topological_ordering, Formatter) +from lexertab import CoolLexer +from parsertab import CoolParser +from semantics import (TypeCollector, TypeBuilder, OverriddenMethodChecker, TypeChecker, topological_ordering) from semantics.formatter import CodeBuilder from semantics.progam_executor import Executor, ExecutionError -from semantics.utils.scope import Context, Scope from semantics.type_inference import InferenceChecker +from semantics.utils.scope import Context, Scope detecting_errors = r""" (* class A { @@ -133,6 +133,7 @@ class Main inherits IO { parser = CoolParser() if __name__ == '__main__': + tokens = lexer(detecting_errors) ast = parser(tokens) diff --git a/parser.py b/parsertab.py old mode 100755 new mode 100644 similarity index 100% rename from parser.py rename to parsertab.py index d2c15dbd5..25e1491cc --- a/parser.py +++ b/parsertab.py @@ -27,1006 +27,1006 @@ def __action_table(): (7, G["type"]): ("SHIFT", 8), (8, G["{"]): ("SHIFT", 9), (9, G["true"]): ("SHIFT", 25), - (9, G["if"]): ("SHIFT", 12), - (9, G["id"]): ("SHIFT", 31), - (9, G["string"]): ("SHIFT", 33), - (9, G["while"]): ("SHIFT", 13), (9, G["case"]): ("SHIFT", 21), - (9, G["~"]): ("SHIFT", 27), - (9, G["new"]): ("SHIFT", 22), + (9, G["id"]): ("SHIFT", 31), (9, G["let"]): ("SHIFT", 14), - (9, G["{"]): ("SHIFT", 10), + (9, G["string"]): ("SHIFT", 33), + (9, G["("]): ("SHIFT", 11), (9, G["not"]): ("SHIFT", 30), - (9, G["false"]): ("SHIFT", 26), + (9, G["~"]): ("SHIFT", 27), + (9, G["while"]): ("SHIFT", 13), (9, G["int"]): ("SHIFT", 34), + (9, G["new"]): ("SHIFT", 22), (9, G["isvoid"]): ("SHIFT", 24), - (9, G["("]): ("SHIFT", 11), - (10, G["true"]): ("SHIFT", 25), + (9, G["if"]): ("SHIFT", 12), + (9, G["false"]): ("SHIFT", 26), + (9, G["{"]): ("SHIFT", 10), (10, G["("]): ("SHIFT", 11), - (10, G["{"]): ("SHIFT", 10), - (10, G["id"]): ("SHIFT", 31), - (10, G["not"]): ("SHIFT", 30), - (10, G["string"]): ("SHIFT", 33), - (10, G["let"]): ("SHIFT", 14), - (10, G["isvoid"]): ("SHIFT", 24), - (10, G["new"]): ("SHIFT", 22), (10, G["if"]): ("SHIFT", 12), - (10, G["case"]): ("SHIFT", 21), - (10, G["while"]): ("SHIFT", 13), - (10, G["~"]): ("SHIFT", 27), + (10, G["isvoid"]): ("SHIFT", 24), + (10, G["true"]): ("SHIFT", 25), (10, G["false"]): ("SHIFT", 26), + (10, G["string"]): ("SHIFT", 33), (10, G["int"]): ("SHIFT", 34), + (10, G["not"]): ("SHIFT", 30), + (10, G["id"]): ("SHIFT", 31), + (10, G["~"]): ("SHIFT", 27), + (10, G["while"]): ("SHIFT", 13), + (10, G["{"]): ("SHIFT", 10), + (10, G["case"]): ("SHIFT", 21), + (10, G["new"]): ("SHIFT", 22), + (10, G["let"]): ("SHIFT", 14), + (11, G["{"]): ("SHIFT", 10), + (11, G["if"]): ("SHIFT", 12), + (11, G["id"]): ("SHIFT", 31), (11, G["new"]): ("SHIFT", 22), - (11, G["not"]): ("SHIFT", 30), - (11, G["let"]): ("SHIFT", 14), (11, G["false"]): ("SHIFT", 26), - (11, G["int"]): ("SHIFT", 34), - (11, G["id"]): ("SHIFT", 31), - (11, G["if"]): ("SHIFT", 12), - (11, G["~"]): ("SHIFT", 27), - (11, G["("]): ("SHIFT", 11), (11, G["true"]): ("SHIFT", 25), + (11, G["isvoid"]): ("SHIFT", 24), + (11, G["~"]): ("SHIFT", 27), (11, G["while"]): ("SHIFT", 13), - (11, G["case"]): ("SHIFT", 21), + (11, G["int"]): ("SHIFT", 34), (11, G["string"]): ("SHIFT", 33), - (11, G["{"]): ("SHIFT", 10), - (11, G["isvoid"]): ("SHIFT", 24), - (12, G["id"]): ("SHIFT", 31), - (12, G["{"]): ("SHIFT", 10), - (12, G["("]): ("SHIFT", 11), - (12, G["not"]): ("SHIFT", 30), - (12, G["true"]): ("SHIFT", 25), - (12, G["false"]): ("SHIFT", 26), + (11, G["let"]): ("SHIFT", 14), + (11, G["not"]): ("SHIFT", 30), + (11, G["case"]): ("SHIFT", 21), + (11, G["("]): ("SHIFT", 11), + (12, G["isvoid"]): ("SHIFT", 24), + (12, G["string"]): ("SHIFT", 33), (12, G["~"]): ("SHIFT", 27), + (12, G["while"]): ("SHIFT", 13), + (12, G["id"]): ("SHIFT", 31), + (12, G["case"]): ("SHIFT", 21), (12, G["let"]): ("SHIFT", 14), - (12, G["string"]): ("SHIFT", 33), + (12, G["not"]): ("SHIFT", 30), (12, G["if"]): ("SHIFT", 12), (12, G["new"]): ("SHIFT", 22), - (12, G["while"]): ("SHIFT", 13), - (12, G["case"]): ("SHIFT", 21), - (12, G["isvoid"]): ("SHIFT", 24), + (12, G["("]): ("SHIFT", 11), + (12, G["{"]): ("SHIFT", 10), + (12, G["false"]): ("SHIFT", 26), + (12, G["true"]): ("SHIFT", 25), (12, G["int"]): ("SHIFT", 34), - (13, G["("]): ("SHIFT", 11), - (13, G["{"]): ("SHIFT", 10), (13, G["true"]): ("SHIFT", 25), - (13, G["not"]): ("SHIFT", 30), - (13, G["id"]): ("SHIFT", 31), - (13, G["string"]): ("SHIFT", 33), - (13, G["isvoid"]): ("SHIFT", 24), + (13, G["int"]): ("SHIFT", 34), (13, G["let"]): ("SHIFT", 14), - (13, G["if"]): ("SHIFT", 12), (13, G["new"]): ("SHIFT", 22), + (13, G["if"]): ("SHIFT", 12), + (13, G["isvoid"]): ("SHIFT", 24), + (13, G["id"]): ("SHIFT", 31), + (13, G["not"]): ("SHIFT", 30), + (13, G["string"]): ("SHIFT", 33), + (13, G["("]): ("SHIFT", 11), (13, G["while"]): ("SHIFT", 13), - (13, G["case"]): ("SHIFT", 21), + (13, G["{"]): ("SHIFT", 10), (13, G["~"]): ("SHIFT", 27), + (13, G["case"]): ("SHIFT", 21), (13, G["false"]): ("SHIFT", 26), - (13, G["int"]): ("SHIFT", 34), (14, G["id"]): ("SHIFT", 15), (15, G[":"]): ("SHIFT", 16), (16, G["type"]): ("SHIFT", 17), - (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), - (17, G["<-"]): ("SHIFT", 20), (17, G[","]): ("SHIFT", 18), + (17, G["<-"]): ("SHIFT", 20), + (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), (18, G["id"]): ("SHIFT", 15), (19, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), + (20, G["{"]): ("SHIFT", 10), + (20, G["if"]): ("SHIFT", 12), + (20, G["id"]): ("SHIFT", 31), (20, G["new"]): ("SHIFT", 22), + (20, G["~"]): ("SHIFT", 27), + (20, G["while"]): ("SHIFT", 13), + (20, G["int"]): ("SHIFT", 34), + (20, G["string"]): ("SHIFT", 33), + (20, G["let"]): ("SHIFT", 14), (20, G["isvoid"]): ("SHIFT", 24), - (20, G["{"]): ("SHIFT", 10), (20, G["not"]): ("SHIFT", 30), - (20, G["int"]): ("SHIFT", 34), (20, G["false"]): ("SHIFT", 26), - (20, G["let"]): ("SHIFT", 14), - (20, G["id"]): ("SHIFT", 31), - (20, G["~"]): ("SHIFT", 27), - (20, G["("]): ("SHIFT", 11), - (20, G["if"]): ("SHIFT", 12), (20, G["true"]): ("SHIFT", 25), - (20, G["while"]): ("SHIFT", 13), (20, G["case"]): ("SHIFT", 21), - (20, G["string"]): ("SHIFT", 33), + (20, G["("]): ("SHIFT", 11), (21, G["false"]): ("SHIFT", 26), + (21, G["let"]): ("SHIFT", 14), + (21, G["~"]): ("SHIFT", 27), + (21, G["isvoid"]): ("SHIFT", 24), + (21, G["true"]): ("SHIFT", 25), + (21, G["if"]): ("SHIFT", 12), (21, G["int"]): ("SHIFT", 34), + (21, G["new"]): ("SHIFT", 22), + (21, G["not"]): ("SHIFT", 30), (21, G["id"]): ("SHIFT", 31), - (21, G["if"]): ("SHIFT", 12), - (21, G["("]): ("SHIFT", 11), - (21, G["true"]): ("SHIFT", 25), - (21, G["case"]): ("SHIFT", 21), - (21, G["while"]): ("SHIFT", 13), (21, G["string"]): ("SHIFT", 33), - (21, G["isvoid"]): ("SHIFT", 24), + (21, G["while"]): ("SHIFT", 13), (21, G["{"]): ("SHIFT", 10), - (21, G["new"]): ("SHIFT", 22), - (21, G["not"]): ("SHIFT", 30), - (21, G["~"]): ("SHIFT", 27), - (21, G["let"]): ("SHIFT", 14), + (21, G["("]): ("SHIFT", 11), + (21, G["case"]): ("SHIFT", 21), (22, G["type"]): ("SHIFT", 23), - (23, G["of"]): ("REDUCE", G["atom -> new type"]), - (23, G["<"]): ("REDUCE", G["atom -> new type"]), - (23, G[")"]): ("REDUCE", G["atom -> new type"]), - (23, G["then"]): ("REDUCE", G["atom -> new type"]), - (23, G["<="]): ("REDUCE", G["atom -> new type"]), - (23, G["."]): ("REDUCE", G["atom -> new type"]), - (23, G["else"]): ("REDUCE", G["atom -> new type"]), - (23, G["="]): ("REDUCE", G["atom -> new type"]), + (23, G["in"]): ("REDUCE", G["atom -> new type"]), (23, G[","]): ("REDUCE", G["atom -> new type"]), - (23, G["fi"]): ("REDUCE", G["atom -> new type"]), - (23, G["error"]): ("REDUCE", G["atom -> new type"]), + (23, G["then"]): ("REDUCE", G["atom -> new type"]), (23, G[";"]): ("REDUCE", G["atom -> new type"]), - (23, G["loop"]): ("REDUCE", G["atom -> new type"]), (23, G["@"]): ("REDUCE", G["atom -> new type"]), - (23, G["pool"]): ("REDUCE", G["atom -> new type"]), (23, G["+"]): ("REDUCE", G["atom -> new type"]), + (23, G["else"]): ("REDUCE", G["atom -> new type"]), + (23, G["of"]): ("REDUCE", G["atom -> new type"]), + (23, G["="]): ("REDUCE", G["atom -> new type"]), (23, G["-"]): ("REDUCE", G["atom -> new type"]), - (23, G["in"]): ("REDUCE", G["atom -> new type"]), + (23, G["fi"]): ("REDUCE", G["atom -> new type"]), (23, G["*"]): ("REDUCE", G["atom -> new type"]), (23, G["}"]): ("REDUCE", G["atom -> new type"]), (23, G["/"]): ("REDUCE", G["atom -> new type"]), + (23, G["<"]): ("REDUCE", G["atom -> new type"]), + (23, G["loop"]): ("REDUCE", G["atom -> new type"]), + (23, G["<="]): ("REDUCE", G["atom -> new type"]), + (23, G["pool"]): ("REDUCE", G["atom -> new type"]), + (23, G[")"]): ("REDUCE", G["atom -> new type"]), + (23, G["error"]): ("REDUCE", G["atom -> new type"]), + (23, G["."]): ("REDUCE", G["atom -> new type"]), + (24, G["false"]): ("SHIFT", 26), (24, G["("]): ("SHIFT", 11), + (24, G["id"]): ("SHIFT", 28), (24, G["string"]): ("SHIFT", 33), (24, G["new"]): ("SHIFT", 22), - (24, G["true"]): ("SHIFT", 25), - (24, G["false"]): ("SHIFT", 26), (24, G["int"]): ("SHIFT", 34), - (24, G["id"]): ("SHIFT", 28), - (24, G["~"]): ("SHIFT", 27), (24, G["isvoid"]): ("SHIFT", 24), - (25, G["of"]): ("REDUCE", G["atom -> true"]), - (25, G["<"]): ("REDUCE", G["atom -> true"]), - (25, G[")"]): ("REDUCE", G["atom -> true"]), + (24, G["true"]): ("SHIFT", 25), + (24, G["~"]): ("SHIFT", 27), + (25, G["in"]): ("REDUCE", G["atom -> true"]), + (25, G[","]): ("REDUCE", G["atom -> true"]), (25, G["then"]): ("REDUCE", G["atom -> true"]), - (25, G["<="]): ("REDUCE", G["atom -> true"]), - (25, G["."]): ("REDUCE", G["atom -> true"]), + (25, G[";"]): ("REDUCE", G["atom -> true"]), + (25, G["+"]): ("REDUCE", G["atom -> true"]), + (25, G["@"]): ("REDUCE", G["atom -> true"]), (25, G["else"]): ("REDUCE", G["atom -> true"]), + (25, G["of"]): ("REDUCE", G["atom -> true"]), (25, G["="]): ("REDUCE", G["atom -> true"]), - (25, G[","]): ("REDUCE", G["atom -> true"]), (25, G["fi"]): ("REDUCE", G["atom -> true"]), - (25, G["error"]): ("REDUCE", G["atom -> true"]), - (25, G[";"]): ("REDUCE", G["atom -> true"]), - (25, G["loop"]): ("REDUCE", G["atom -> true"]), - (25, G["@"]): ("REDUCE", G["atom -> true"]), - (25, G["pool"]): ("REDUCE", G["atom -> true"]), - (25, G["+"]): ("REDUCE", G["atom -> true"]), (25, G["-"]): ("REDUCE", G["atom -> true"]), - (25, G["in"]): ("REDUCE", G["atom -> true"]), (25, G["*"]): ("REDUCE", G["atom -> true"]), (25, G["}"]): ("REDUCE", G["atom -> true"]), (25, G["/"]): ("REDUCE", G["atom -> true"]), - (26, G["of"]): ("REDUCE", G["atom -> false"]), - (26, G["<"]): ("REDUCE", G["atom -> false"]), - (26, G[")"]): ("REDUCE", G["atom -> false"]), - (26, G["then"]): ("REDUCE", G["atom -> false"]), - (26, G["<="]): ("REDUCE", G["atom -> false"]), - (26, G["."]): ("REDUCE", G["atom -> false"]), - (26, G["else"]): ("REDUCE", G["atom -> false"]), - (26, G["="]): ("REDUCE", G["atom -> false"]), + (25, G["<"]): ("REDUCE", G["atom -> true"]), + (25, G["loop"]): ("REDUCE", G["atom -> true"]), + (25, G["<="]): ("REDUCE", G["atom -> true"]), + (25, G["pool"]): ("REDUCE", G["atom -> true"]), + (25, G[")"]): ("REDUCE", G["atom -> true"]), + (25, G["error"]): ("REDUCE", G["atom -> true"]), + (25, G["."]): ("REDUCE", G["atom -> true"]), + (26, G["in"]): ("REDUCE", G["atom -> false"]), (26, G[","]): ("REDUCE", G["atom -> false"]), - (26, G["fi"]): ("REDUCE", G["atom -> false"]), - (26, G["error"]): ("REDUCE", G["atom -> false"]), + (26, G["then"]): ("REDUCE", G["atom -> false"]), (26, G[";"]): ("REDUCE", G["atom -> false"]), - (26, G["loop"]): ("REDUCE", G["atom -> false"]), (26, G["@"]): ("REDUCE", G["atom -> false"]), - (26, G["pool"]): ("REDUCE", G["atom -> false"]), (26, G["+"]): ("REDUCE", G["atom -> false"]), + (26, G["else"]): ("REDUCE", G["atom -> false"]), + (26, G["of"]): ("REDUCE", G["atom -> false"]), + (26, G["="]): ("REDUCE", G["atom -> false"]), + (26, G["fi"]): ("REDUCE", G["atom -> false"]), (26, G["-"]): ("REDUCE", G["atom -> false"]), - (26, G["in"]): ("REDUCE", G["atom -> false"]), (26, G["*"]): ("REDUCE", G["atom -> false"]), (26, G["}"]): ("REDUCE", G["atom -> false"]), (26, G["/"]): ("REDUCE", G["atom -> false"]), + (26, G["<"]): ("REDUCE", G["atom -> false"]), + (26, G["loop"]): ("REDUCE", G["atom -> false"]), + (26, G["<="]): ("REDUCE", G["atom -> false"]), + (26, G["pool"]): ("REDUCE", G["atom -> false"]), + (26, G[")"]): ("REDUCE", G["atom -> false"]), + (26, G["error"]): ("REDUCE", G["atom -> false"]), + (26, G["."]): ("REDUCE", G["atom -> false"]), + (27, G["false"]): ("SHIFT", 26), (27, G["("]): ("SHIFT", 11), + (27, G["id"]): ("SHIFT", 28), (27, G["string"]): ("SHIFT", 33), (27, G["new"]): ("SHIFT", 22), - (27, G["true"]): ("SHIFT", 25), - (27, G["false"]): ("SHIFT", 26), (27, G["int"]): ("SHIFT", 34), - (27, G["id"]): ("SHIFT", 28), - (27, G["~"]): ("SHIFT", 27), (27, G["isvoid"]): ("SHIFT", 24), + (27, G["true"]): ("SHIFT", 25), + (27, G["~"]): ("SHIFT", 27), (28, G["("]): ("SHIFT", 29), - (28, G["of"]): ("REDUCE", G["atom -> id"]), - (28, G["<"]): ("REDUCE", G["atom -> id"]), - (28, G[")"]): ("REDUCE", G["atom -> id"]), - (28, G["then"]): ("REDUCE", G["atom -> id"]), - (28, G["<="]): ("REDUCE", G["atom -> id"]), - (28, G["."]): ("REDUCE", G["atom -> id"]), - (28, G["else"]): ("REDUCE", G["atom -> id"]), - (28, G["="]): ("REDUCE", G["atom -> id"]), + (28, G["in"]): ("REDUCE", G["atom -> id"]), (28, G[","]): ("REDUCE", G["atom -> id"]), - (28, G["fi"]): ("REDUCE", G["atom -> id"]), - (28, G["error"]): ("REDUCE", G["atom -> id"]), + (28, G["then"]): ("REDUCE", G["atom -> id"]), (28, G[";"]): ("REDUCE", G["atom -> id"]), - (28, G["loop"]): ("REDUCE", G["atom -> id"]), (28, G["@"]): ("REDUCE", G["atom -> id"]), - (28, G["pool"]): ("REDUCE", G["atom -> id"]), (28, G["+"]): ("REDUCE", G["atom -> id"]), + (28, G["else"]): ("REDUCE", G["atom -> id"]), + (28, G["of"]): ("REDUCE", G["atom -> id"]), + (28, G["="]): ("REDUCE", G["atom -> id"]), (28, G["-"]): ("REDUCE", G["atom -> id"]), - (28, G["in"]): ("REDUCE", G["atom -> id"]), + (28, G["fi"]): ("REDUCE", G["atom -> id"]), (28, G["*"]): ("REDUCE", G["atom -> id"]), (28, G["}"]): ("REDUCE", G["atom -> id"]), (28, G["/"]): ("REDUCE", G["atom -> id"]), - (29, G["let"]): ("SHIFT", 14), - (29, G["id"]): ("SHIFT", 31), - (29, G["if"]): ("SHIFT", 12), - (29, G["string"]): ("SHIFT", 33), - (29, G["~"]): ("SHIFT", 27), + (28, G["<"]): ("REDUCE", G["atom -> id"]), + (28, G["loop"]): ("REDUCE", G["atom -> id"]), + (28, G["<="]): ("REDUCE", G["atom -> id"]), + (28, G["pool"]): ("REDUCE", G["atom -> id"]), + (28, G[")"]): ("REDUCE", G["atom -> id"]), + (28, G["error"]): ("REDUCE", G["atom -> id"]), + (28, G["."]): ("REDUCE", G["atom -> id"]), (29, G["case"]): ("SHIFT", 21), + (29, G["id"]): ("SHIFT", 31), + (29, G["~"]): ("SHIFT", 27), + (29, G["{"]): ("SHIFT", 10), + (29, G[")"]): ("REDUCE", G["expr-list -> e"]), + (29, G["isvoid"]): ("SHIFT", 24), (29, G["while"]): ("SHIFT", 13), + (29, G["int"]): ("SHIFT", 34), (29, G["new"]): ("SHIFT", 22), - (29, G[")"]): ("REDUCE", G["expr-list -> e"]), - (29, G["{"]): ("SHIFT", 10), - (29, G["false"]): ("SHIFT", 26), (29, G["not"]): ("SHIFT", 30), - (29, G["int"]): ("SHIFT", 34), - (29, G["isvoid"]): ("SHIFT", 24), (29, G["("]): ("SHIFT", 11), + (29, G["string"]): ("SHIFT", 33), + (29, G["if"]): ("SHIFT", 12), + (29, G["false"]): ("SHIFT", 26), (29, G["true"]): ("SHIFT", 25), - (30, G["("]): ("SHIFT", 11), - (30, G["true"]): ("SHIFT", 25), + (29, G["let"]): ("SHIFT", 14), (30, G["let"]): ("SHIFT", 14), - (30, G["id"]): ("SHIFT", 31), - (30, G["if"]): ("SHIFT", 12), - (30, G["string"]): ("SHIFT", 33), - (30, G["while"]): ("SHIFT", 13), - (30, G["case"]): ("SHIFT", 21), - (30, G["isvoid"]): ("SHIFT", 24), (30, G["new"]): ("SHIFT", 22), + (30, G["int"]): ("SHIFT", 34), + (30, G["~"]): ("SHIFT", 27), (30, G["{"]): ("SHIFT", 10), + (30, G["while"]): ("SHIFT", 13), + (30, G["true"]): ("SHIFT", 25), (30, G["false"]): ("SHIFT", 26), - (30, G["int"]): ("SHIFT", 34), (30, G["not"]): ("SHIFT", 30), - (30, G["~"]): ("SHIFT", 27), + (30, G["string"]): ("SHIFT", 33), + (30, G["id"]): ("SHIFT", 31), + (30, G["if"]): ("SHIFT", 12), + (30, G["isvoid"]): ("SHIFT", 24), + (30, G["("]): ("SHIFT", 11), + (30, G["case"]): ("SHIFT", 21), (31, G["("]): ("SHIFT", 29), - (31, G["<-"]): ("SHIFT", 32), - (31, G["of"]): ("REDUCE", G["atom -> id"]), - (31, G["<"]): ("REDUCE", G["atom -> id"]), - (31, G[")"]): ("REDUCE", G["atom -> id"]), - (31, G["then"]): ("REDUCE", G["atom -> id"]), - (31, G["<="]): ("REDUCE", G["atom -> id"]), - (31, G["."]): ("REDUCE", G["atom -> id"]), - (31, G["else"]): ("REDUCE", G["atom -> id"]), - (31, G["="]): ("REDUCE", G["atom -> id"]), + (31, G["in"]): ("REDUCE", G["atom -> id"]), (31, G[","]): ("REDUCE", G["atom -> id"]), - (31, G["fi"]): ("REDUCE", G["atom -> id"]), - (31, G["error"]): ("REDUCE", G["atom -> id"]), + (31, G["then"]): ("REDUCE", G["atom -> id"]), (31, G[";"]): ("REDUCE", G["atom -> id"]), - (31, G["loop"]): ("REDUCE", G["atom -> id"]), (31, G["@"]): ("REDUCE", G["atom -> id"]), - (31, G["pool"]): ("REDUCE", G["atom -> id"]), (31, G["+"]): ("REDUCE", G["atom -> id"]), + (31, G["else"]): ("REDUCE", G["atom -> id"]), + (31, G["of"]): ("REDUCE", G["atom -> id"]), + (31, G["="]): ("REDUCE", G["atom -> id"]), + (31, G["fi"]): ("REDUCE", G["atom -> id"]), (31, G["-"]): ("REDUCE", G["atom -> id"]), - (31, G["in"]): ("REDUCE", G["atom -> id"]), (31, G["*"]): ("REDUCE", G["atom -> id"]), (31, G["}"]): ("REDUCE", G["atom -> id"]), (31, G["/"]): ("REDUCE", G["atom -> id"]), - (32, G["("]): ("SHIFT", 11), - (32, G["true"]): ("SHIFT", 25), + (31, G["<"]): ("REDUCE", G["atom -> id"]), + (31, G["loop"]): ("REDUCE", G["atom -> id"]), + (31, G["<="]): ("REDUCE", G["atom -> id"]), + (31, G["pool"]): ("REDUCE", G["atom -> id"]), + (31, G[")"]): ("REDUCE", G["atom -> id"]), + (31, G["error"]): ("REDUCE", G["atom -> id"]), + (31, G["."]): ("REDUCE", G["atom -> id"]), + (31, G["<-"]): ("SHIFT", 32), (32, G["let"]): ("SHIFT", 14), - (32, G["id"]): ("SHIFT", 31), - (32, G["if"]): ("SHIFT", 12), - (32, G["string"]): ("SHIFT", 33), - (32, G["while"]): ("SHIFT", 13), - (32, G["case"]): ("SHIFT", 21), - (32, G["isvoid"]): ("SHIFT", 24), (32, G["new"]): ("SHIFT", 22), + (32, G["int"]): ("SHIFT", 34), + (32, G["~"]): ("SHIFT", 27), (32, G["{"]): ("SHIFT", 10), + (32, G["while"]): ("SHIFT", 13), + (32, G["true"]): ("SHIFT", 25), (32, G["false"]): ("SHIFT", 26), - (32, G["int"]): ("SHIFT", 34), (32, G["not"]): ("SHIFT", 30), - (32, G["~"]): ("SHIFT", 27), - (33, G["of"]): ("REDUCE", G["atom -> string"]), - (33, G["<"]): ("REDUCE", G["atom -> string"]), - (33, G[")"]): ("REDUCE", G["atom -> string"]), + (32, G["string"]): ("SHIFT", 33), + (32, G["id"]): ("SHIFT", 31), + (32, G["if"]): ("SHIFT", 12), + (32, G["isvoid"]): ("SHIFT", 24), + (32, G["("]): ("SHIFT", 11), + (32, G["case"]): ("SHIFT", 21), + (33, G["in"]): ("REDUCE", G["atom -> string"]), + (33, G[","]): ("REDUCE", G["atom -> string"]), (33, G["then"]): ("REDUCE", G["atom -> string"]), - (33, G["<="]): ("REDUCE", G["atom -> string"]), - (33, G["."]): ("REDUCE", G["atom -> string"]), + (33, G[";"]): ("REDUCE", G["atom -> string"]), + (33, G["+"]): ("REDUCE", G["atom -> string"]), + (33, G["@"]): ("REDUCE", G["atom -> string"]), (33, G["else"]): ("REDUCE", G["atom -> string"]), + (33, G["of"]): ("REDUCE", G["atom -> string"]), (33, G["="]): ("REDUCE", G["atom -> string"]), - (33, G[","]): ("REDUCE", G["atom -> string"]), (33, G["fi"]): ("REDUCE", G["atom -> string"]), - (33, G["error"]): ("REDUCE", G["atom -> string"]), - (33, G[";"]): ("REDUCE", G["atom -> string"]), - (33, G["loop"]): ("REDUCE", G["atom -> string"]), - (33, G["@"]): ("REDUCE", G["atom -> string"]), - (33, G["pool"]): ("REDUCE", G["atom -> string"]), - (33, G["+"]): ("REDUCE", G["atom -> string"]), (33, G["-"]): ("REDUCE", G["atom -> string"]), - (33, G["in"]): ("REDUCE", G["atom -> string"]), (33, G["*"]): ("REDUCE", G["atom -> string"]), (33, G["}"]): ("REDUCE", G["atom -> string"]), (33, G["/"]): ("REDUCE", G["atom -> string"]), - (34, G["of"]): ("REDUCE", G["atom -> int"]), - (34, G["<"]): ("REDUCE", G["atom -> int"]), - (34, G[")"]): ("REDUCE", G["atom -> int"]), + (33, G["<"]): ("REDUCE", G["atom -> string"]), + (33, G["loop"]): ("REDUCE", G["atom -> string"]), + (33, G["<="]): ("REDUCE", G["atom -> string"]), + (33, G["pool"]): ("REDUCE", G["atom -> string"]), + (33, G[")"]): ("REDUCE", G["atom -> string"]), + (33, G["error"]): ("REDUCE", G["atom -> string"]), + (33, G["."]): ("REDUCE", G["atom -> string"]), + (34, G["in"]): ("REDUCE", G["atom -> int"]), + (34, G[","]): ("REDUCE", G["atom -> int"]), (34, G["then"]): ("REDUCE", G["atom -> int"]), - (34, G["<="]): ("REDUCE", G["atom -> int"]), - (34, G["."]): ("REDUCE", G["atom -> int"]), + (34, G[";"]): ("REDUCE", G["atom -> int"]), + (34, G["+"]): ("REDUCE", G["atom -> int"]), + (34, G["@"]): ("REDUCE", G["atom -> int"]), (34, G["else"]): ("REDUCE", G["atom -> int"]), + (34, G["of"]): ("REDUCE", G["atom -> int"]), (34, G["="]): ("REDUCE", G["atom -> int"]), - (34, G[","]): ("REDUCE", G["atom -> int"]), (34, G["fi"]): ("REDUCE", G["atom -> int"]), - (34, G["error"]): ("REDUCE", G["atom -> int"]), - (34, G[";"]): ("REDUCE", G["atom -> int"]), - (34, G["loop"]): ("REDUCE", G["atom -> int"]), - (34, G["@"]): ("REDUCE", G["atom -> int"]), - (34, G["pool"]): ("REDUCE", G["atom -> int"]), - (34, G["+"]): ("REDUCE", G["atom -> int"]), (34, G["-"]): ("REDUCE", G["atom -> int"]), - (34, G["in"]): ("REDUCE", G["atom -> int"]), (34, G["*"]): ("REDUCE", G["atom -> int"]), (34, G["}"]): ("REDUCE", G["atom -> int"]), (34, G["/"]): ("REDUCE", G["atom -> int"]), - (35, G["of"]): ("REDUCE", G["atom -> function-call"]), - (35, G["<"]): ("REDUCE", G["atom -> function-call"]), - (35, G[")"]): ("REDUCE", G["atom -> function-call"]), - (35, G["then"]): ("REDUCE", G["atom -> function-call"]), - (35, G["<="]): ("REDUCE", G["atom -> function-call"]), - (35, G["."]): ("REDUCE", G["atom -> function-call"]), - (35, G["else"]): ("REDUCE", G["atom -> function-call"]), - (35, G["="]): ("REDUCE", G["atom -> function-call"]), + (34, G["<"]): ("REDUCE", G["atom -> int"]), + (34, G["loop"]): ("REDUCE", G["atom -> int"]), + (34, G["<="]): ("REDUCE", G["atom -> int"]), + (34, G["pool"]): ("REDUCE", G["atom -> int"]), + (34, G[")"]): ("REDUCE", G["atom -> int"]), + (34, G["error"]): ("REDUCE", G["atom -> int"]), + (34, G["."]): ("REDUCE", G["atom -> int"]), + (35, G["in"]): ("REDUCE", G["atom -> function-call"]), (35, G[","]): ("REDUCE", G["atom -> function-call"]), - (35, G["fi"]): ("REDUCE", G["atom -> function-call"]), - (35, G["error"]): ("REDUCE", G["atom -> function-call"]), + (35, G["then"]): ("REDUCE", G["atom -> function-call"]), (35, G[";"]): ("REDUCE", G["atom -> function-call"]), - (35, G["loop"]): ("REDUCE", G["atom -> function-call"]), (35, G["@"]): ("REDUCE", G["atom -> function-call"]), - (35, G["pool"]): ("REDUCE", G["atom -> function-call"]), (35, G["+"]): ("REDUCE", G["atom -> function-call"]), + (35, G["else"]): ("REDUCE", G["atom -> function-call"]), + (35, G["of"]): ("REDUCE", G["atom -> function-call"]), + (35, G["="]): ("REDUCE", G["atom -> function-call"]), + (35, G["fi"]): ("REDUCE", G["atom -> function-call"]), (35, G["-"]): ("REDUCE", G["atom -> function-call"]), - (35, G["in"]): ("REDUCE", G["atom -> function-call"]), (35, G["*"]): ("REDUCE", G["atom -> function-call"]), (35, G["}"]): ("REDUCE", G["atom -> function-call"]), (35, G["/"]): ("REDUCE", G["atom -> function-call"]), - (36, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["else"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), + (35, G["<"]): ("REDUCE", G["atom -> function-call"]), + (35, G["loop"]): ("REDUCE", G["atom -> function-call"]), + (35, G["<="]): ("REDUCE", G["atom -> function-call"]), + (35, G["pool"]): ("REDUCE", G["atom -> function-call"]), + (35, G[")"]): ("REDUCE", G["atom -> function-call"]), + (35, G["error"]): ("REDUCE", G["atom -> function-call"]), + (35, G["."]): ("REDUCE", G["atom -> function-call"]), (36, G["in"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["}"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), - (37, G["pool"]): ("REDUCE", G["expr -> comp"]), - (37, G[")"]): ("REDUCE", G["expr -> comp"]), - (37, G["then"]): ("REDUCE", G["expr -> comp"]), - (37, G["else"]): ("REDUCE", G["expr -> comp"]), - (37, G[","]): ("REDUCE", G["expr -> comp"]), + (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["else"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), (37, G["in"]): ("REDUCE", G["expr -> comp"]), - (37, G["fi"]): ("REDUCE", G["expr -> comp"]), - (37, G["error"]): ("REDUCE", G["expr -> comp"]), (37, G["}"]): ("REDUCE", G["expr -> comp"]), - (37, G["of"]): ("REDUCE", G["expr -> comp"]), - (37, G[";"]): ("REDUCE", G["expr -> comp"]), + (37, G[","]): ("REDUCE", G["expr -> comp"]), + (37, G["then"]): ("REDUCE", G["expr -> comp"]), (37, G["loop"]): ("REDUCE", G["expr -> comp"]), - (38, G["+"]): ("SHIFT", 39), - (38, G["="]): ("SHIFT", 70), + (37, G[";"]): ("REDUCE", G["expr -> comp"]), + (37, G[")"]): ("REDUCE", G["expr -> comp"]), + (37, G["of"]): ("REDUCE", G["expr -> comp"]), + (37, G["pool"]): ("REDUCE", G["expr -> comp"]), + (37, G["else"]): ("REDUCE", G["expr -> comp"]), + (37, G["error"]): ("REDUCE", G["expr -> comp"]), + (37, G["fi"]): ("REDUCE", G["expr -> comp"]), (38, G["<="]): ("SHIFT", 68), - (38, G["pool"]): ("REDUCE", G["comp -> arith"]), - (38, G[")"]): ("REDUCE", G["comp -> arith"]), - (38, G["then"]): ("REDUCE", G["comp -> arith"]), - (38, G["else"]): ("REDUCE", G["comp -> arith"]), - (38, G[","]): ("REDUCE", G["comp -> arith"]), + (38, G["-"]): ("SHIFT", 64), + (38, G["="]): ("SHIFT", 70), + (38, G["<"]): ("SHIFT", 66), (38, G["in"]): ("REDUCE", G["comp -> arith"]), - (38, G["fi"]): ("REDUCE", G["comp -> arith"]), - (38, G["error"]): ("REDUCE", G["comp -> arith"]), (38, G["}"]): ("REDUCE", G["comp -> arith"]), - (38, G["of"]): ("REDUCE", G["comp -> arith"]), - (38, G[";"]): ("REDUCE", G["comp -> arith"]), + (38, G[","]): ("REDUCE", G["comp -> arith"]), + (38, G["then"]): ("REDUCE", G["comp -> arith"]), (38, G["loop"]): ("REDUCE", G["comp -> arith"]), - (38, G["-"]): ("SHIFT", 64), - (38, G["<"]): ("SHIFT", 66), - (39, G["("]): ("SHIFT", 11), + (38, G[";"]): ("REDUCE", G["comp -> arith"]), + (38, G[")"]): ("REDUCE", G["comp -> arith"]), + (38, G["of"]): ("REDUCE", G["comp -> arith"]), + (38, G["pool"]): ("REDUCE", G["comp -> arith"]), + (38, G["else"]): ("REDUCE", G["comp -> arith"]), + (38, G["error"]): ("REDUCE", G["comp -> arith"]), + (38, G["fi"]): ("REDUCE", G["comp -> arith"]), + (38, G["+"]): ("SHIFT", 39), + (39, G["false"]): ("SHIFT", 26), (39, G["new"]): ("SHIFT", 22), - (39, G["true"]): ("SHIFT", 25), - (39, G["id"]): ("SHIFT", 28), (39, G["string"]): ("SHIFT", 33), - (39, G["false"]): ("SHIFT", 26), (39, G["int"]): ("SHIFT", 34), - (39, G["~"]): ("SHIFT", 27), + (39, G["id"]): ("SHIFT", 28), (39, G["isvoid"]): ("SHIFT", 24), - (40, G["<"]): ("REDUCE", G["arith -> arith + term"]), - (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), + (39, G["~"]): ("SHIFT", 27), + (39, G["("]): ("SHIFT", 11), + (39, G["true"]): ("SHIFT", 25), + (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), + (40, G[","]): ("REDUCE", G["arith -> arith + term"]), (40, G["then"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["<="]): ("REDUCE", G["arith -> arith + term"]), + (40, G[";"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["+"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["of"]): ("REDUCE", G["arith -> arith + term"]), (40, G["else"]): ("REDUCE", G["arith -> arith + term"]), (40, G["="]): ("REDUCE", G["arith -> arith + term"]), - (40, G[","]): ("REDUCE", G["arith -> arith + term"]), (40, G["fi"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), - (40, G[";"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["+"]): ("REDUCE", G["arith -> arith + term"]), (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["of"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["/"]): ("SHIFT", 54), + (40, G["<"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["<="]): ("REDUCE", G["arith -> arith + term"]), + (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), (40, G["*"]): ("SHIFT", 41), + (40, G["/"]): ("SHIFT", 54), + (41, G["false"]): ("SHIFT", 26), (41, G["("]): ("SHIFT", 11), + (41, G["id"]): ("SHIFT", 28), (41, G["string"]): ("SHIFT", 33), (41, G["new"]): ("SHIFT", 22), - (41, G["true"]): ("SHIFT", 25), - (41, G["false"]): ("SHIFT", 26), (41, G["int"]): ("SHIFT", 34), - (41, G["id"]): ("SHIFT", 28), - (41, G["~"]): ("SHIFT", 27), (41, G["isvoid"]): ("SHIFT", 24), - (42, G["of"]): ("REDUCE", G["term -> term * factor"]), - (42, G["<"]): ("REDUCE", G["term -> term * factor"]), - (42, G[")"]): ("REDUCE", G["term -> term * factor"]), + (41, G["true"]): ("SHIFT", 25), + (41, G["~"]): ("SHIFT", 27), + (42, G["in"]): ("REDUCE", G["term -> term * factor"]), + (42, G[","]): ("REDUCE", G["term -> term * factor"]), (42, G["then"]): ("REDUCE", G["term -> term * factor"]), - (42, G["<="]): ("REDUCE", G["term -> term * factor"]), + (42, G[";"]): ("REDUCE", G["term -> term * factor"]), + (42, G["+"]): ("REDUCE", G["term -> term * factor"]), (42, G["else"]): ("REDUCE", G["term -> term * factor"]), + (42, G["of"]): ("REDUCE", G["term -> term * factor"]), (42, G["="]): ("REDUCE", G["term -> term * factor"]), - (42, G[","]): ("REDUCE", G["term -> term * factor"]), (42, G["fi"]): ("REDUCE", G["term -> term * factor"]), - (42, G["error"]): ("REDUCE", G["term -> term * factor"]), - (42, G[";"]): ("REDUCE", G["term -> term * factor"]), - (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), - (42, G["pool"]): ("REDUCE", G["term -> term * factor"]), - (42, G["+"]): ("REDUCE", G["term -> term * factor"]), (42, G["-"]): ("REDUCE", G["term -> term * factor"]), - (42, G["in"]): ("REDUCE", G["term -> term * factor"]), (42, G["*"]): ("REDUCE", G["term -> term * factor"]), (42, G["}"]): ("REDUCE", G["term -> term * factor"]), (42, G["/"]): ("REDUCE", G["term -> term * factor"]), - (43, G["of"]): ("REDUCE", G["factor -> atom"]), - (43, G["<"]): ("REDUCE", G["factor -> atom"]), - (43, G[")"]): ("REDUCE", G["factor -> atom"]), + (42, G["<"]): ("REDUCE", G["term -> term * factor"]), + (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), + (42, G["<="]): ("REDUCE", G["term -> term * factor"]), + (42, G["pool"]): ("REDUCE", G["term -> term * factor"]), + (42, G[")"]): ("REDUCE", G["term -> term * factor"]), + (42, G["error"]): ("REDUCE", G["term -> term * factor"]), + (43, G["in"]): ("REDUCE", G["factor -> atom"]), + (43, G[","]): ("REDUCE", G["factor -> atom"]), (43, G["then"]): ("REDUCE", G["factor -> atom"]), - (43, G["<="]): ("REDUCE", G["factor -> atom"]), + (43, G[";"]): ("REDUCE", G["factor -> atom"]), + (43, G["+"]): ("REDUCE", G["factor -> atom"]), (43, G["else"]): ("REDUCE", G["factor -> atom"]), + (43, G["of"]): ("REDUCE", G["factor -> atom"]), (43, G["="]): ("REDUCE", G["factor -> atom"]), - (43, G[","]): ("REDUCE", G["factor -> atom"]), (43, G["fi"]): ("REDUCE", G["factor -> atom"]), - (43, G["error"]): ("REDUCE", G["factor -> atom"]), - (43, G[";"]): ("REDUCE", G["factor -> atom"]), - (43, G["loop"]): ("REDUCE", G["factor -> atom"]), - (43, G["pool"]): ("REDUCE", G["factor -> atom"]), - (43, G["+"]): ("REDUCE", G["factor -> atom"]), (43, G["-"]): ("REDUCE", G["factor -> atom"]), - (43, G["in"]): ("REDUCE", G["factor -> atom"]), (43, G["*"]): ("REDUCE", G["factor -> atom"]), (43, G["}"]): ("REDUCE", G["factor -> atom"]), (43, G["/"]): ("REDUCE", G["factor -> atom"]), + (43, G["<"]): ("REDUCE", G["factor -> atom"]), + (43, G["loop"]): ("REDUCE", G["factor -> atom"]), + (43, G["<="]): ("REDUCE", G["factor -> atom"]), + (43, G["pool"]): ("REDUCE", G["factor -> atom"]), + (43, G[")"]): ("REDUCE", G["factor -> atom"]), + (43, G["error"]): ("REDUCE", G["factor -> atom"]), (43, G["@"]): ("SHIFT", 57), (43, G["."]): ("SHIFT", 44), (44, G["id"]): ("SHIFT", 45), (45, G["("]): ("SHIFT", 46), - (46, G["let"]): ("SHIFT", 14), + (46, G["case"]): ("SHIFT", 21), (46, G["id"]): ("SHIFT", 31), - (46, G["if"]): ("SHIFT", 12), - (46, G["string"]): ("SHIFT", 33), (46, G["~"]): ("SHIFT", 27), - (46, G["case"]): ("SHIFT", 21), + (46, G["{"]): ("SHIFT", 10), + (46, G[")"]): ("REDUCE", G["expr-list -> e"]), + (46, G["isvoid"]): ("SHIFT", 24), (46, G["while"]): ("SHIFT", 13), + (46, G["int"]): ("SHIFT", 34), (46, G["new"]): ("SHIFT", 22), - (46, G[")"]): ("REDUCE", G["expr-list -> e"]), - (46, G["{"]): ("SHIFT", 10), - (46, G["false"]): ("SHIFT", 26), (46, G["not"]): ("SHIFT", 30), - (46, G["int"]): ("SHIFT", 34), - (46, G["isvoid"]): ("SHIFT", 24), (46, G["("]): ("SHIFT", 11), + (46, G["string"]): ("SHIFT", 33), + (46, G["if"]): ("SHIFT", 12), + (46, G["false"]): ("SHIFT", 26), (46, G["true"]): ("SHIFT", 25), + (46, G["let"]): ("SHIFT", 14), (47, G[")"]): ("SHIFT", 48), - (48, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (49, G[")"]): ("REDUCE", G["expr-list -> not-empty-expr-list"]), - (50, G[","]): ("SHIFT", 51), (50, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), - (51, G["let"]): ("SHIFT", 14), + (50, G[","]): ("SHIFT", 51), + (51, G["case"]): ("SHIFT", 21), (51, G["id"]): ("SHIFT", 31), - (51, G["if"]): ("SHIFT", 12), - (51, G["string"]): ("SHIFT", 33), (51, G["~"]): ("SHIFT", 27), - (51, G["case"]): ("SHIFT", 21), + (51, G["{"]): ("SHIFT", 10), + (51, G["isvoid"]): ("SHIFT", 24), (51, G["while"]): ("SHIFT", 13), + (51, G["int"]): ("SHIFT", 34), (51, G["new"]): ("SHIFT", 22), - (51, G["{"]): ("SHIFT", 10), - (51, G["false"]): ("SHIFT", 26), (51, G["not"]): ("SHIFT", 30), - (51, G["int"]): ("SHIFT", 34), - (51, G["isvoid"]): ("SHIFT", 24), (51, G["("]): ("SHIFT", 11), + (51, G["string"]): ("SHIFT", 33), + (51, G["if"]): ("SHIFT", 12), + (51, G["false"]): ("SHIFT", 26), (51, G["true"]): ("SHIFT", 25), + (51, G["let"]): ("SHIFT", 14), (52, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr , not-empty-expr-list"]), - (53, G["<"]): ("REDUCE", G["arith -> term"]), - (53, G[")"]): ("REDUCE", G["arith -> term"]), + (53, G["*"]): ("SHIFT", 41), + (53, G["/"]): ("SHIFT", 54), + (53, G["in"]): ("REDUCE", G["arith -> term"]), + (53, G[","]): ("REDUCE", G["arith -> term"]), (53, G["then"]): ("REDUCE", G["arith -> term"]), - (53, G["<="]): ("REDUCE", G["arith -> term"]), + (53, G[";"]): ("REDUCE", G["arith -> term"]), + (53, G["+"]): ("REDUCE", G["arith -> term"]), + (53, G["of"]): ("REDUCE", G["arith -> term"]), (53, G["else"]): ("REDUCE", G["arith -> term"]), (53, G["="]): ("REDUCE", G["arith -> term"]), - (53, G[","]): ("REDUCE", G["arith -> term"]), (53, G["fi"]): ("REDUCE", G["arith -> term"]), - (53, G["error"]): ("REDUCE", G["arith -> term"]), - (53, G[";"]): ("REDUCE", G["arith -> term"]), - (53, G["loop"]): ("REDUCE", G["arith -> term"]), - (53, G["pool"]): ("REDUCE", G["arith -> term"]), - (53, G["+"]): ("REDUCE", G["arith -> term"]), (53, G["-"]): ("REDUCE", G["arith -> term"]), - (53, G["in"]): ("REDUCE", G["arith -> term"]), (53, G["}"]): ("REDUCE", G["arith -> term"]), - (53, G["of"]): ("REDUCE", G["arith -> term"]), - (53, G["/"]): ("SHIFT", 54), - (53, G["*"]): ("SHIFT", 41), + (53, G["<"]): ("REDUCE", G["arith -> term"]), + (53, G["loop"]): ("REDUCE", G["arith -> term"]), + (53, G["<="]): ("REDUCE", G["arith -> term"]), + (53, G[")"]): ("REDUCE", G["arith -> term"]), + (53, G["pool"]): ("REDUCE", G["arith -> term"]), + (53, G["error"]): ("REDUCE", G["arith -> term"]), + (54, G["false"]): ("SHIFT", 26), (54, G["("]): ("SHIFT", 11), + (54, G["id"]): ("SHIFT", 28), (54, G["string"]): ("SHIFT", 33), (54, G["new"]): ("SHIFT", 22), - (54, G["true"]): ("SHIFT", 25), - (54, G["false"]): ("SHIFT", 26), (54, G["int"]): ("SHIFT", 34), - (54, G["id"]): ("SHIFT", 28), - (54, G["~"]): ("SHIFT", 27), (54, G["isvoid"]): ("SHIFT", 24), - (55, G["of"]): ("REDUCE", G["term -> term / factor"]), - (55, G["<"]): ("REDUCE", G["term -> term / factor"]), - (55, G[")"]): ("REDUCE", G["term -> term / factor"]), + (54, G["true"]): ("SHIFT", 25), + (54, G["~"]): ("SHIFT", 27), + (55, G["in"]): ("REDUCE", G["term -> term / factor"]), + (55, G[","]): ("REDUCE", G["term -> term / factor"]), (55, G["then"]): ("REDUCE", G["term -> term / factor"]), - (55, G["<="]): ("REDUCE", G["term -> term / factor"]), + (55, G[";"]): ("REDUCE", G["term -> term / factor"]), + (55, G["+"]): ("REDUCE", G["term -> term / factor"]), (55, G["else"]): ("REDUCE", G["term -> term / factor"]), + (55, G["of"]): ("REDUCE", G["term -> term / factor"]), (55, G["="]): ("REDUCE", G["term -> term / factor"]), - (55, G[","]): ("REDUCE", G["term -> term / factor"]), (55, G["fi"]): ("REDUCE", G["term -> term / factor"]), - (55, G["error"]): ("REDUCE", G["term -> term / factor"]), - (55, G[";"]): ("REDUCE", G["term -> term / factor"]), - (55, G["loop"]): ("REDUCE", G["term -> term / factor"]), - (55, G["pool"]): ("REDUCE", G["term -> term / factor"]), - (55, G["+"]): ("REDUCE", G["term -> term / factor"]), (55, G["-"]): ("REDUCE", G["term -> term / factor"]), - (55, G["in"]): ("REDUCE", G["term -> term / factor"]), (55, G["*"]): ("REDUCE", G["term -> term / factor"]), (55, G["}"]): ("REDUCE", G["term -> term / factor"]), (55, G["/"]): ("REDUCE", G["term -> term / factor"]), - (56, G["of"]): ("REDUCE", G["term -> factor"]), - (56, G["<"]): ("REDUCE", G["term -> factor"]), - (56, G[")"]): ("REDUCE", G["term -> factor"]), - (56, G["then"]): ("REDUCE", G["term -> factor"]), - (56, G["<="]): ("REDUCE", G["term -> factor"]), - (56, G["else"]): ("REDUCE", G["term -> factor"]), - (56, G["="]): ("REDUCE", G["term -> factor"]), + (55, G["<"]): ("REDUCE", G["term -> term / factor"]), + (55, G["loop"]): ("REDUCE", G["term -> term / factor"]), + (55, G["<="]): ("REDUCE", G["term -> term / factor"]), + (55, G["pool"]): ("REDUCE", G["term -> term / factor"]), + (55, G[")"]): ("REDUCE", G["term -> term / factor"]), + (55, G["error"]): ("REDUCE", G["term -> term / factor"]), + (56, G["in"]): ("REDUCE", G["term -> factor"]), (56, G[","]): ("REDUCE", G["term -> factor"]), - (56, G["fi"]): ("REDUCE", G["term -> factor"]), - (56, G["error"]): ("REDUCE", G["term -> factor"]), + (56, G["then"]): ("REDUCE", G["term -> factor"]), (56, G[";"]): ("REDUCE", G["term -> factor"]), - (56, G["loop"]): ("REDUCE", G["term -> factor"]), - (56, G["pool"]): ("REDUCE", G["term -> factor"]), (56, G["+"]): ("REDUCE", G["term -> factor"]), + (56, G["else"]): ("REDUCE", G["term -> factor"]), + (56, G["of"]): ("REDUCE", G["term -> factor"]), + (56, G["="]): ("REDUCE", G["term -> factor"]), + (56, G["fi"]): ("REDUCE", G["term -> factor"]), (56, G["-"]): ("REDUCE", G["term -> factor"]), - (56, G["in"]): ("REDUCE", G["term -> factor"]), (56, G["*"]): ("REDUCE", G["term -> factor"]), (56, G["}"]): ("REDUCE", G["term -> factor"]), (56, G["/"]): ("REDUCE", G["term -> factor"]), + (56, G["<"]): ("REDUCE", G["term -> factor"]), + (56, G["loop"]): ("REDUCE", G["term -> factor"]), + (56, G["<="]): ("REDUCE", G["term -> factor"]), + (56, G["pool"]): ("REDUCE", G["term -> factor"]), + (56, G[")"]): ("REDUCE", G["term -> factor"]), + (56, G["error"]): ("REDUCE", G["term -> factor"]), (57, G["type"]): ("SHIFT", 58), (58, G["."]): ("SHIFT", 59), (59, G["id"]): ("SHIFT", 60), (60, G["("]): ("SHIFT", 61), - (61, G["let"]): ("SHIFT", 14), + (61, G["case"]): ("SHIFT", 21), (61, G["id"]): ("SHIFT", 31), - (61, G["if"]): ("SHIFT", 12), - (61, G["string"]): ("SHIFT", 33), (61, G["~"]): ("SHIFT", 27), - (61, G["case"]): ("SHIFT", 21), + (61, G["{"]): ("SHIFT", 10), + (61, G[")"]): ("REDUCE", G["expr-list -> e"]), + (61, G["isvoid"]): ("SHIFT", 24), (61, G["while"]): ("SHIFT", 13), + (61, G["int"]): ("SHIFT", 34), (61, G["new"]): ("SHIFT", 22), - (61, G[")"]): ("REDUCE", G["expr-list -> e"]), - (61, G["{"]): ("SHIFT", 10), - (61, G["false"]): ("SHIFT", 26), (61, G["not"]): ("SHIFT", 30), - (61, G["int"]): ("SHIFT", 34), - (61, G["isvoid"]): ("SHIFT", 24), (61, G["("]): ("SHIFT", 11), + (61, G["string"]): ("SHIFT", 33), + (61, G["if"]): ("SHIFT", 12), + (61, G["false"]): ("SHIFT", 26), (61, G["true"]): ("SHIFT", 25), + (61, G["let"]): ("SHIFT", 14), (62, G[")"]): ("SHIFT", 63), - (63, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (64, G["("]): ("SHIFT", 11), + (63, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (64, G["false"]): ("SHIFT", 26), (64, G["new"]): ("SHIFT", 22), - (64, G["true"]): ("SHIFT", 25), - (64, G["id"]): ("SHIFT", 28), (64, G["string"]): ("SHIFT", 33), - (64, G["false"]): ("SHIFT", 26), (64, G["int"]): ("SHIFT", 34), - (64, G["~"]): ("SHIFT", 27), + (64, G["id"]): ("SHIFT", 28), (64, G["isvoid"]): ("SHIFT", 24), - (65, G["/"]): ("SHIFT", 54), - (65, G["<"]): ("REDUCE", G["arith -> arith - term"]), - (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), + (64, G["~"]): ("SHIFT", 27), + (64, G["("]): ("SHIFT", 11), + (64, G["true"]): ("SHIFT", 25), + (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), + (65, G[","]): ("REDUCE", G["arith -> arith - term"]), (65, G["then"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["<="]): ("REDUCE", G["arith -> arith - term"]), + (65, G[";"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["+"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["of"]): ("REDUCE", G["arith -> arith - term"]), (65, G["else"]): ("REDUCE", G["arith -> arith - term"]), (65, G["="]): ("REDUCE", G["arith -> arith - term"]), - (65, G[","]): ("REDUCE", G["arith -> arith - term"]), (65, G["fi"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["error"]): ("REDUCE", G["arith -> arith - term"]), - (65, G[";"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["loop"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["pool"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["+"]): ("REDUCE", G["arith -> arith - term"]), (65, G["-"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), (65, G["}"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["of"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["<"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["loop"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["<="]): ("REDUCE", G["arith -> arith - term"]), + (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["pool"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["error"]): ("REDUCE", G["arith -> arith - term"]), (65, G["*"]): ("SHIFT", 41), + (65, G["/"]): ("SHIFT", 54), + (66, G["isvoid"]): ("SHIFT", 24), + (66, G["~"]): ("SHIFT", 27), (66, G["false"]): ("SHIFT", 26), - (66, G["int"]): ("SHIFT", 34), - (66, G["id"]): ("SHIFT", 28), - (66, G["("]): ("SHIFT", 11), - (66, G["new"]): ("SHIFT", 22), (66, G["true"]): ("SHIFT", 25), - (66, G["~"]): ("SHIFT", 27), - (66, G["isvoid"]): ("SHIFT", 24), + (66, G["id"]): ("SHIFT", 28), + (66, G["int"]): ("SHIFT", 34), (66, G["string"]): ("SHIFT", 33), - (67, G["+"]): ("SHIFT", 39), + (66, G["new"]): ("SHIFT", 22), + (66, G["("]): ("SHIFT", 11), (67, G["-"]): ("SHIFT", 64), - (67, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["else"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), (67, G["in"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["}"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["else"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["+"]): ("SHIFT", 39), + (68, G["isvoid"]): ("SHIFT", 24), + (68, G["~"]): ("SHIFT", 27), (68, G["false"]): ("SHIFT", 26), - (68, G["int"]): ("SHIFT", 34), - (68, G["id"]): ("SHIFT", 28), - (68, G["("]): ("SHIFT", 11), - (68, G["new"]): ("SHIFT", 22), (68, G["true"]): ("SHIFT", 25), - (68, G["~"]): ("SHIFT", 27), - (68, G["isvoid"]): ("SHIFT", 24), + (68, G["id"]): ("SHIFT", 28), + (68, G["int"]): ("SHIFT", 34), (68, G["string"]): ("SHIFT", 33), - (69, G["+"]): ("SHIFT", 39), + (68, G["new"]): ("SHIFT", 22), + (68, G["("]): ("SHIFT", 11), (69, G["-"]): ("SHIFT", 64), - (69, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["+"]): ("SHIFT", 39), + (70, G["isvoid"]): ("SHIFT", 24), + (70, G["~"]): ("SHIFT", 27), (70, G["false"]): ("SHIFT", 26), - (70, G["int"]): ("SHIFT", 34), - (70, G["id"]): ("SHIFT", 28), - (70, G["("]): ("SHIFT", 11), - (70, G["new"]): ("SHIFT", 22), (70, G["true"]): ("SHIFT", 25), - (70, G["~"]): ("SHIFT", 27), - (70, G["isvoid"]): ("SHIFT", 24), + (70, G["id"]): ("SHIFT", 28), + (70, G["int"]): ("SHIFT", 34), (70, G["string"]): ("SHIFT", 33), - (71, G["+"]): ("SHIFT", 39), + (70, G["new"]): ("SHIFT", 22), + (70, G["("]): ("SHIFT", 11), (71, G["-"]): ("SHIFT", 64), - (71, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["else"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["+"]): ("SHIFT", 39), (71, G["in"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["error"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["}"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[";"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), - (72, G["pool"]): ("REDUCE", G["expr -> not expr"]), - (72, G[")"]): ("REDUCE", G["expr -> not expr"]), + (71, G[";"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["else"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["error"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), + (72, G["}"]): ("REDUCE", G["expr -> not expr"]), + (72, G["in"]): ("REDUCE", G["expr -> not expr"]), + (72, G[","]): ("REDUCE", G["expr -> not expr"]), + (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), (72, G["then"]): ("REDUCE", G["expr -> not expr"]), + (72, G[";"]): ("REDUCE", G["expr -> not expr"]), + (72, G[")"]): ("REDUCE", G["expr -> not expr"]), + (72, G["of"]): ("REDUCE", G["expr -> not expr"]), + (72, G["pool"]): ("REDUCE", G["expr -> not expr"]), (72, G["else"]): ("REDUCE", G["expr -> not expr"]), - (72, G[","]): ("REDUCE", G["expr -> not expr"]), - (72, G["in"]): ("REDUCE", G["expr -> not expr"]), - (72, G["fi"]): ("REDUCE", G["expr -> not expr"]), (72, G["error"]): ("REDUCE", G["expr -> not expr"]), - (72, G["}"]): ("REDUCE", G["expr -> not expr"]), - (72, G["of"]): ("REDUCE", G["expr -> not expr"]), - (72, G[";"]): ("REDUCE", G["expr -> not expr"]), - (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), + (72, G["fi"]): ("REDUCE", G["expr -> not expr"]), (73, G[")"]): ("SHIFT", 74), - (74, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G["of"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["<"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G[")"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["then"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["<="]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["else"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["="]): ("REDUCE", G["factor -> ~ factor"]), + (74, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), (75, G[","]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["then"]): ("REDUCE", G["factor -> ~ factor"]), (75, G[";"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["+"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["-"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["*"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["}"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["/"]): ("REDUCE", G["factor -> ~ factor"]), - (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), + (75, G["else"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["of"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["="]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["-"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["*"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["}"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["/"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["<"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["<="]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G[")"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), + (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), (77, G["of"]): ("SHIFT", 78), (78, G["id"]): ("SHIFT", 79), (79, G[":"]): ("SHIFT", 80), (80, G["type"]): ("SHIFT", 81), (81, G["=>"]): ("SHIFT", 82), - (82, G["true"]): ("SHIFT", 25), (82, G["("]): ("SHIFT", 11), - (82, G["{"]): ("SHIFT", 10), - (82, G["id"]): ("SHIFT", 31), - (82, G["not"]): ("SHIFT", 30), - (82, G["string"]): ("SHIFT", 33), - (82, G["let"]): ("SHIFT", 14), - (82, G["isvoid"]): ("SHIFT", 24), - (82, G["new"]): ("SHIFT", 22), (82, G["if"]): ("SHIFT", 12), - (82, G["case"]): ("SHIFT", 21), - (82, G["while"]): ("SHIFT", 13), - (82, G["~"]): ("SHIFT", 27), + (82, G["isvoid"]): ("SHIFT", 24), + (82, G["true"]): ("SHIFT", 25), (82, G["false"]): ("SHIFT", 26), + (82, G["string"]): ("SHIFT", 33), (82, G["int"]): ("SHIFT", 34), - (83, G["error"]): ("SHIFT", 86), + (82, G["not"]): ("SHIFT", 30), + (82, G["id"]): ("SHIFT", 31), + (82, G["~"]): ("SHIFT", 27), + (82, G["while"]): ("SHIFT", 13), + (82, G["{"]): ("SHIFT", 10), + (82, G["case"]): ("SHIFT", 21), + (82, G["new"]): ("SHIFT", 22), + (82, G["let"]): ("SHIFT", 14), (83, G[";"]): ("SHIFT", 84), + (83, G["error"]): ("SHIFT", 86), (84, G["id"]): ("SHIFT", 79), (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), (86, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), (87, G["esac"]): ("SHIFT", 88), - (88, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), (89, G[","]): ("SHIFT", 90), (90, G["id"]): ("SHIFT", 15), (91, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), (92, G["in"]): ("SHIFT", 93), - (93, G["("]): ("SHIFT", 11), - (93, G["true"]): ("SHIFT", 25), (93, G["let"]): ("SHIFT", 14), - (93, G["id"]): ("SHIFT", 31), - (93, G["if"]): ("SHIFT", 12), - (93, G["string"]): ("SHIFT", 33), - (93, G["while"]): ("SHIFT", 13), - (93, G["case"]): ("SHIFT", 21), - (93, G["isvoid"]): ("SHIFT", 24), (93, G["new"]): ("SHIFT", 22), + (93, G["int"]): ("SHIFT", 34), + (93, G["~"]): ("SHIFT", 27), (93, G["{"]): ("SHIFT", 10), + (93, G["while"]): ("SHIFT", 13), + (93, G["true"]): ("SHIFT", 25), (93, G["false"]): ("SHIFT", 26), - (93, G["int"]): ("SHIFT", 34), (93, G["not"]): ("SHIFT", 30), - (93, G["~"]): ("SHIFT", 27), - (94, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (93, G["string"]): ("SHIFT", 33), + (93, G["id"]): ("SHIFT", 31), + (93, G["if"]): ("SHIFT", 12), + (93, G["isvoid"]): ("SHIFT", 24), + (93, G["("]): ("SHIFT", 11), + (93, G["case"]): ("SHIFT", 21), (94, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["loop"]): ("SHIFT", 96), - (96, G["not"]): ("SHIFT", 30), - (96, G["isvoid"]): ("SHIFT", 24), - (96, G["false"]): ("SHIFT", 26), - (96, G["int"]): ("SHIFT", 34), (96, G["id"]): ("SHIFT", 31), + (96, G["~"]): ("SHIFT", 27), + (96, G["if"]): ("SHIFT", 12), + (96, G["new"]): ("SHIFT", 22), (96, G["let"]): ("SHIFT", 14), (96, G["("]): ("SHIFT", 11), - (96, G["if"]): ("SHIFT", 12), - (96, G["true"]): ("SHIFT", 25), - (96, G["while"]): ("SHIFT", 13), - (96, G["string"]): ("SHIFT", 33), - (96, G["~"]): ("SHIFT", 27), (96, G["case"]): ("SHIFT", 21), - (96, G["new"]): ("SHIFT", 22), (96, G["{"]): ("SHIFT", 10), + (96, G["while"]): ("SHIFT", 13), + (96, G["true"]): ("SHIFT", 25), + (96, G["isvoid"]): ("SHIFT", 24), + (96, G["false"]): ("SHIFT", 26), + (96, G["string"]): ("SHIFT", 33), + (96, G["int"]): ("SHIFT", 34), + (96, G["not"]): ("SHIFT", 30), (97, G["pool"]): ("SHIFT", 98), - (98, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["then"]): ("SHIFT", 100), - (100, G["if"]): ("SHIFT", 12), - (100, G["~"]): ("SHIFT", 27), - (100, G["id"]): ("SHIFT", 31), - (100, G["false"]): ("SHIFT", 26), + (100, G["new"]): ("SHIFT", 22), (100, G["while"]): ("SHIFT", 13), - (100, G["case"]): ("SHIFT", 21), (100, G["int"]): ("SHIFT", 34), - (100, G["("]): ("SHIFT", 11), - (100, G["true"]): ("SHIFT", 25), + (100, G["~"]): ("SHIFT", 27), (100, G["{"]): ("SHIFT", 10), - (100, G["isvoid"]): ("SHIFT", 24), + (100, G["true"]): ("SHIFT", 25), + (100, G["let"]): ("SHIFT", 14), + (100, G["false"]): ("SHIFT", 26), + (100, G["case"]): ("SHIFT", 21), (100, G["string"]): ("SHIFT", 33), + (100, G["id"]): ("SHIFT", 31), + (100, G["isvoid"]): ("SHIFT", 24), + (100, G["("]): ("SHIFT", 11), + (100, G["if"]): ("SHIFT", 12), (100, G["not"]): ("SHIFT", 30), - (100, G["new"]): ("SHIFT", 22), - (100, G["let"]): ("SHIFT", 14), (101, G["else"]): ("SHIFT", 102), + (102, G["id"]): ("SHIFT", 31), (102, G["isvoid"]): ("SHIFT", 24), - (102, G["false"]): ("SHIFT", 26), + (102, G["while"]): ("SHIFT", 13), + (102, G["string"]): ("SHIFT", 33), (102, G["int"]): ("SHIFT", 34), - (102, G["id"]): ("SHIFT", 31), - (102, G["{"]): ("SHIFT", 10), - (102, G["("]): ("SHIFT", 11), - (102, G["true"]): ("SHIFT", 25), + (102, G["let"]): ("SHIFT", 14), (102, G["not"]): ("SHIFT", 30), + (102, G["true"]): ("SHIFT", 25), + (102, G["false"]): ("SHIFT", 26), + (102, G["case"]): ("SHIFT", 21), (102, G["~"]): ("SHIFT", 27), - (102, G["string"]): ("SHIFT", 33), - (102, G["let"]): ("SHIFT", 14), + (102, G["{"]): ("SHIFT", 10), (102, G["if"]): ("SHIFT", 12), + (102, G["("]): ("SHIFT", 11), (102, G["new"]): ("SHIFT", 22), - (102, G["while"]): ("SHIFT", 13), - (102, G["case"]): ("SHIFT", 21), (103, G["fi"]): ("SHIFT", 104), - (104, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G[")"]): ("SHIFT", 106), - (106, G["of"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["<"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G[")"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["then"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["<="]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["."]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["else"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["="]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["in"]): ("REDUCE", G["atom -> ( expr )"]), (106, G[","]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["error"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["then"]): ("REDUCE", G["atom -> ( expr )"]), (106, G[";"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["@"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["+"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["else"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["of"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["="]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["-"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["in"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["*"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["}"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["/"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["<"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["<="]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G[")"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["error"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["."]): ("REDUCE", G["atom -> ( expr )"]), (107, G["}"]): ("SHIFT", 108), - (108, G["pool"]): ("REDUCE", G["expr -> { block }"]), - (108, G[")"]): ("REDUCE", G["expr -> { block }"]), - (108, G["then"]): ("REDUCE", G["expr -> { block }"]), - (108, G["else"]): ("REDUCE", G["expr -> { block }"]), - (108, G[","]): ("REDUCE", G["expr -> { block }"]), (108, G["in"]): ("REDUCE", G["expr -> { block }"]), - (108, G["fi"]): ("REDUCE", G["expr -> { block }"]), - (108, G["error"]): ("REDUCE", G["expr -> { block }"]), (108, G["}"]): ("REDUCE", G["expr -> { block }"]), - (108, G["of"]): ("REDUCE", G["expr -> { block }"]), - (108, G[";"]): ("REDUCE", G["expr -> { block }"]), + (108, G[","]): ("REDUCE", G["expr -> { block }"]), + (108, G["then"]): ("REDUCE", G["expr -> { block }"]), (108, G["loop"]): ("REDUCE", G["expr -> { block }"]), + (108, G[";"]): ("REDUCE", G["expr -> { block }"]), + (108, G[")"]): ("REDUCE", G["expr -> { block }"]), + (108, G["of"]): ("REDUCE", G["expr -> { block }"]), + (108, G["pool"]): ("REDUCE", G["expr -> { block }"]), + (108, G["else"]): ("REDUCE", G["expr -> { block }"]), + (108, G["error"]): ("REDUCE", G["expr -> { block }"]), + (108, G["fi"]): ("REDUCE", G["expr -> { block }"]), (109, G[";"]): ("SHIFT", 110), - (109, G["error"]): ("SHIFT", 112), - (110, G["true"]): ("SHIFT", 25), - (110, G["("]): ("SHIFT", 11), - (110, G["{"]): ("SHIFT", 10), - (110, G["id"]): ("SHIFT", 31), - (110, G["not"]): ("SHIFT", 30), - (110, G["string"]): ("SHIFT", 33), - (110, G["let"]): ("SHIFT", 14), - (110, G["isvoid"]): ("SHIFT", 24), - (110, G["new"]): ("SHIFT", 22), + (109, G["error"]): ("SHIFT", 112), + (110, G["("]): ("SHIFT", 11), (110, G["if"]): ("SHIFT", 12), (110, G["}"]): ("REDUCE", G["block -> expr ;"]), - (110, G["case"]): ("SHIFT", 21), - (110, G["while"]): ("SHIFT", 13), - (110, G["~"]): ("SHIFT", 27), + (110, G["isvoid"]): ("SHIFT", 24), + (110, G["true"]): ("SHIFT", 25), (110, G["false"]): ("SHIFT", 26), + (110, G["string"]): ("SHIFT", 33), (110, G["int"]): ("SHIFT", 34), + (110, G["not"]): ("SHIFT", 30), + (110, G["id"]): ("SHIFT", 31), + (110, G["~"]): ("SHIFT", 27), + (110, G["while"]): ("SHIFT", 13), + (110, G["{"]): ("SHIFT", 10), + (110, G["case"]): ("SHIFT", 21), + (110, G["new"]): ("SHIFT", 22), + (110, G["let"]): ("SHIFT", 14), (111, G["}"]): ("REDUCE", G["block -> expr ; block"]), (112, G["}"]): ("REDUCE", G["block -> expr error"]), (113, G["}"]): ("SHIFT", 114), @@ -1034,8 +1034,8 @@ def __action_table(): (114, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), (115, G[":"]): ("SHIFT", 116), (116, G["type"]): ("SHIFT", 117), - (117, G[","]): ("SHIFT", 118), (117, G[")"]): ("REDUCE", G["param-list -> id : type"]), + (117, G[","]): ("SHIFT", 118), (118, G["id"]): ("SHIFT", 115), (119, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), (120, G[")"]): ("SHIFT", 121), @@ -1043,49 +1043,49 @@ def __action_table(): (122, G["type"]): ("SHIFT", 123), (123, G["{"]): ("SHIFT", 124), (124, G["true"]): ("SHIFT", 25), - (124, G["if"]): ("SHIFT", 12), - (124, G["id"]): ("SHIFT", 31), - (124, G["string"]): ("SHIFT", 33), - (124, G["while"]): ("SHIFT", 13), (124, G["case"]): ("SHIFT", 21), - (124, G["~"]): ("SHIFT", 27), - (124, G["new"]): ("SHIFT", 22), + (124, G["id"]): ("SHIFT", 31), (124, G["let"]): ("SHIFT", 14), - (124, G["{"]): ("SHIFT", 10), + (124, G["string"]): ("SHIFT", 33), + (124, G["("]): ("SHIFT", 11), (124, G["not"]): ("SHIFT", 30), - (124, G["false"]): ("SHIFT", 26), + (124, G["~"]): ("SHIFT", 27), + (124, G["while"]): ("SHIFT", 13), (124, G["int"]): ("SHIFT", 34), + (124, G["new"]): ("SHIFT", 22), (124, G["isvoid"]): ("SHIFT", 24), - (124, G["("]): ("SHIFT", 11), + (124, G["if"]): ("SHIFT", 12), + (124, G["false"]): ("SHIFT", 26), + (124, G["{"]): ("SHIFT", 10), (125, G["}"]): ("SHIFT", 126), - (126, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (126, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (126, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (127, G["type"]): ("SHIFT", 128), (128, G["<-"]): ("SHIFT", 129), (128, G[";"]): ("REDUCE", G["attribute -> id : type"]), (128, G["error"]): ("REDUCE", G["attribute -> id : type"]), - (129, G["true"]): ("SHIFT", 25), (129, G["("]): ("SHIFT", 11), - (129, G["{"]): ("SHIFT", 10), - (129, G["id"]): ("SHIFT", 31), - (129, G["not"]): ("SHIFT", 30), - (129, G["string"]): ("SHIFT", 33), - (129, G["let"]): ("SHIFT", 14), - (129, G["isvoid"]): ("SHIFT", 24), - (129, G["new"]): ("SHIFT", 22), (129, G["if"]): ("SHIFT", 12), - (129, G["case"]): ("SHIFT", 21), - (129, G["while"]): ("SHIFT", 13), - (129, G["~"]): ("SHIFT", 27), + (129, G["isvoid"]): ("SHIFT", 24), + (129, G["true"]): ("SHIFT", 25), (129, G["false"]): ("SHIFT", 26), + (129, G["string"]): ("SHIFT", 33), (129, G["int"]): ("SHIFT", 34), + (129, G["not"]): ("SHIFT", 30), + (129, G["id"]): ("SHIFT", 31), + (129, G["~"]): ("SHIFT", 27), + (129, G["while"]): ("SHIFT", 13), + (129, G["{"]): ("SHIFT", 10), + (129, G["case"]): ("SHIFT", 21), + (129, G["new"]): ("SHIFT", 22), + (129, G["let"]): ("SHIFT", 14), (130, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), (130, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), (131, G["}"]): ("SHIFT", 132), - (132, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), (132, G["class"]): ("REDUCE", G["class-def -> class type { feature-list }"]), - (133, G["error"]): ("SHIFT", 141), + (132, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), (133, G[";"]): ("SHIFT", 134), + (133, G["error"]): ("SHIFT", 141), (134, G["id"]): ("SHIFT", 4), (134, G["}"]): ("REDUCE", G["feature-list -> e"]), (135, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), @@ -1105,12 +1105,12 @@ def __action_table(): (145, G["id"]): ("SHIFT", 4), (145, G["}"]): ("REDUCE", G["feature-list -> e"]), (146, G["}"]): ("SHIFT", 147), - (147, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), (147, G["class"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), + (147, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), (148, G["$"]): ("OK", None), (149, G["$"]): ("REDUCE", G["program -> class-list"]), - (150, G["class"]): ("SHIFT", 1), (150, G["$"]): ("REDUCE", G["class-list -> class-def"]), + (150, G["class"]): ("SHIFT", 1), (151, G["$"]): ("REDUCE", G["class-list -> class-def class-list"]), } @@ -1120,222 +1120,222 @@ def __goto_table(): (0, G["class-def"]): 150, (0, G["class-list"]): 149, (0, G["program"]): 148, - (3, G["attribute"]): 133, - (3, G["method"]): 136, (3, G["feature-list"]): 131, + (3, G["method"]): 136, + (3, G["attribute"]): 133, (5, G["param-list"]): 120, + (9, G["factor"]): 56, + (9, G["atom"]): 43, (9, G["arith"]): 38, - (9, G["expr"]): 113, (9, G["term"]): 53, - (9, G["atom"]): 43, - (9, G["factor"]): 56, + (9, G["expr"]): 113, (9, G["comp"]): 37, (9, G["function-call"]): 35, + (10, G["block"]): 107, + (10, G["arith"]): 38, (10, G["expr"]): 109, - (10, G["factor"]): 56, (10, G["comp"]): 37, - (10, G["arith"]): 38, - (10, G["term"]): 53, - (10, G["block"]): 107, (10, G["atom"]): 43, + (10, G["term"]): 53, (10, G["function-call"]): 35, - (11, G["arith"]): 38, - (11, G["term"]): 53, - (11, G["function-call"]): 35, + (10, G["factor"]): 56, (11, G["atom"]): 43, - (11, G["expr"]): 105, (11, G["factor"]): 56, + (11, G["arith"]): 38, + (11, G["term"]): 53, (11, G["comp"]): 37, - (12, G["term"]): 53, + (11, G["expr"]): 105, + (11, G["function-call"]): 35, (12, G["arith"]): 38, + (12, G["term"]): 53, (12, G["atom"]): 43, - (12, G["factor"]): 56, (12, G["function-call"]): 35, (12, G["expr"]): 99, (12, G["comp"]): 37, + (12, G["factor"]): 56, + (13, G["expr"]): 95, + (13, G["atom"]): 43, (13, G["arith"]): 38, (13, G["comp"]): 37, + (13, G["factor"]): 56, (13, G["term"]): 53, - (13, G["atom"]): 43, (13, G["function-call"]): 35, - (13, G["expr"]): 95, - (13, G["factor"]): 56, (14, G["declaration-list"]): 92, (18, G["declaration-list"]): 19, - (20, G["arith"]): 38, (20, G["atom"]): 43, - (20, G["comp"]): 37, - (20, G["function-call"]): 35, (20, G["term"]): 53, + (20, G["arith"]): 38, (20, G["expr"]): 89, + (20, G["comp"]): 37, + (20, G["function-call"]): 35, (20, G["factor"]): 56, - (21, G["atom"]): 43, - (21, G["factor"]): 56, - (21, G["arith"]): 38, (21, G["term"]): 53, + (21, G["arith"]): 38, + (21, G["factor"]): 56, (21, G["comp"]): 37, - (21, G["function-call"]): 35, + (21, G["atom"]): 43, (21, G["expr"]): 77, + (21, G["function-call"]): 35, (24, G["atom"]): 43, - (24, G["function-call"]): 35, (24, G["factor"]): 76, + (24, G["function-call"]): 35, (27, G["atom"]): 43, - (27, G["function-call"]): 35, (27, G["factor"]): 75, - (29, G["term"]): 53, + (27, G["function-call"]): 35, (29, G["not-empty-expr-list"]): 49, - (29, G["expr"]): 50, - (29, G["atom"]): 43, + (29, G["term"]): 53, (29, G["arith"]): 38, - (29, G["expr-list"]): 73, (29, G["factor"]): 56, - (29, G["function-call"]): 35, (29, G["comp"]): 37, + (29, G["atom"]): 43, + (29, G["expr"]): 50, + (29, G["expr-list"]): 73, + (29, G["function-call"]): 35, (30, G["arith"]): 38, - (30, G["factor"]): 56, (30, G["term"]): 53, - (30, G["atom"]): 43, (30, G["expr"]): 72, (30, G["function-call"]): 35, (30, G["comp"]): 37, + (30, G["atom"]): 43, + (30, G["factor"]): 56, (32, G["arith"]): 38, - (32, G["factor"]): 56, (32, G["term"]): 53, - (32, G["expr"]): 36, - (32, G["atom"]): 43, (32, G["function-call"]): 35, (32, G["comp"]): 37, - (39, G["factor"]): 56, - (39, G["function-call"]): 35, - (39, G["term"]): 40, + (32, G["atom"]): 43, + (32, G["expr"]): 36, + (32, G["factor"]): 56, (39, G["atom"]): 43, - (41, G["factor"]): 42, + (39, G["term"]): 40, + (39, G["function-call"]): 35, + (39, G["factor"]): 56, (41, G["atom"]): 43, + (41, G["factor"]): 42, (41, G["function-call"]): 35, - (46, G["term"]): 53, (46, G["not-empty-expr-list"]): 49, - (46, G["expr"]): 50, - (46, G["atom"]): 43, + (46, G["term"]): 53, (46, G["arith"]): 38, (46, G["factor"]): 56, - (46, G["function-call"]): 35, (46, G["expr-list"]): 47, (46, G["comp"]): 37, + (46, G["atom"]): 43, + (46, G["expr"]): 50, + (46, G["function-call"]): 35, + (51, G["not-empty-expr-list"]): 52, (51, G["term"]): 53, - (51, G["expr"]): 50, - (51, G["atom"]): 43, (51, G["arith"]): 38, (51, G["factor"]): 56, - (51, G["function-call"]): 35, (51, G["comp"]): 37, - (51, G["not-empty-expr-list"]): 52, + (51, G["atom"]): 43, + (51, G["expr"]): 50, + (51, G["function-call"]): 35, (54, G["atom"]): 43, - (54, G["function-call"]): 35, (54, G["factor"]): 55, - (61, G["term"]): 53, + (54, G["function-call"]): 35, (61, G["not-empty-expr-list"]): 49, - (61, G["expr-list"]): 62, - (61, G["expr"]): 50, - (61, G["atom"]): 43, + (61, G["term"]): 53, (61, G["arith"]): 38, (61, G["factor"]): 56, - (61, G["function-call"]): 35, + (61, G["expr-list"]): 62, (61, G["comp"]): 37, - (64, G["factor"]): 56, - (64, G["function-call"]): 35, - (64, G["term"]): 65, + (61, G["atom"]): 43, + (61, G["expr"]): 50, + (61, G["function-call"]): 35, (64, G["atom"]): 43, + (64, G["term"]): 65, + (64, G["function-call"]): 35, + (64, G["factor"]): 56, (66, G["arith"]): 67, + (66, G["function-call"]): 35, + (66, G["atom"]): 43, (66, G["term"]): 53, (66, G["factor"]): 56, - (66, G["atom"]): 43, - (66, G["function-call"]): 35, + (68, G["function-call"]): 35, + (68, G["atom"]): 43, (68, G["term"]): 53, (68, G["factor"]): 56, - (68, G["atom"]): 43, (68, G["arith"]): 69, - (68, G["function-call"]): 35, - (70, G["term"]): 53, - (70, G["factor"]): 56, + (70, G["function-call"]): 35, (70, G["atom"]): 43, + (70, G["term"]): 53, (70, G["arith"]): 71, - (70, G["function-call"]): 35, + (70, G["factor"]): 56, (78, G["case-list"]): 87, - (82, G["factor"]): 56, - (82, G["comp"]): 37, (82, G["expr"]): 83, (82, G["arith"]): 38, - (82, G["term"]): 53, + (82, G["comp"]): 37, (82, G["atom"]): 43, + (82, G["term"]): 53, (82, G["function-call"]): 35, + (82, G["factor"]): 56, (84, G["case-list"]): 85, (90, G["declaration-list"]): 91, (93, G["arith"]): 38, - (93, G["factor"]): 56, (93, G["term"]): 53, - (93, G["atom"]): 43, - (93, G["function-call"]): 35, (93, G["expr"]): 94, + (93, G["function-call"]): 35, (93, G["comp"]): 37, + (93, G["atom"]): 43, + (93, G["factor"]): 56, (96, G["atom"]): 43, - (96, G["arith"]): 38, (96, G["term"]): 53, + (96, G["function-call"]): 35, + (96, G["arith"]): 38, (96, G["factor"]): 56, - (96, G["comp"]): 37, (96, G["expr"]): 97, - (96, G["function-call"]): 35, - (100, G["factor"]): 56, - (100, G["atom"]): 43, - (100, G["arith"]): 38, + (96, G["comp"]): 37, (100, G["comp"]): 37, (100, G["term"]): 53, - (100, G["expr"]): 101, + (100, G["arith"]): 38, (100, G["function-call"]): 35, - (102, G["arith"]): 38, + (100, G["factor"]): 56, + (100, G["atom"]): 43, + (100, G["expr"]): 101, (102, G["atom"]): 43, - (102, G["comp"]): 37, (102, G["term"]): 53, - (102, G["factor"]): 56, + (102, G["arith"]): 38, (102, G["function-call"]): 35, + (102, G["comp"]): 37, (102, G["expr"]): 103, + (102, G["factor"]): 56, + (110, G["arith"]): 38, (110, G["expr"]): 109, - (110, G["factor"]): 56, (110, G["comp"]): 37, - (110, G["arith"]): 38, - (110, G["term"]): 53, (110, G["atom"]): 43, + (110, G["term"]): 53, (110, G["function-call"]): 35, (110, G["block"]): 111, + (110, G["factor"]): 56, (118, G["param-list"]): 119, + (124, G["factor"]): 56, + (124, G["atom"]): 43, (124, G["arith"]): 38, (124, G["term"]): 53, - (124, G["atom"]): 43, (124, G["expr"]): 125, - (124, G["factor"]): 56, (124, G["comp"]): 37, (124, G["function-call"]): 35, - (129, G["factor"]): 56, - (129, G["comp"]): 37, (129, G["arith"]): 38, - (129, G["term"]): 53, - (129, G["atom"]): 43, (129, G["expr"]): 130, + (129, G["comp"]): 37, + (129, G["atom"]): 43, + (129, G["term"]): 53, (129, G["function-call"]): 35, + (129, G["factor"]): 56, + (134, G["method"]): 136, (134, G["feature-list"]): 135, (134, G["attribute"]): 133, - (134, G["method"]): 136, (137, G["feature-list"]): 138, - (137, G["attribute"]): 133, (137, G["method"]): 136, - (139, G["feature-list"]): 140, + (137, G["attribute"]): 133, (139, G["attribute"]): 133, (139, G["method"]): 136, + (139, G["feature-list"]): 140, (141, G["attribute"]): 133, (141, G["method"]): 136, (141, G["feature-list"]): 142, - (145, G["feature-list"]): 146, (145, G["attribute"]): 133, (145, G["method"]): 136, + (145, G["feature-list"]): 146, (150, G["class-def"]): 150, (150, G["class-list"]): 151, } diff --git a/pyjapt/serialization.py b/pyjapt/serialization.py index b4f5542d8..e483f09b5 100755 --- a/pyjapt/serialization.py +++ b/pyjapt/serialization.py @@ -50,10 +50,10 @@ def build(parser, parser_class_name, grammar_module_name, grammar_variable_name) action, goto = LRParserSerializer._build_parsing_tables(parser, grammar_variable_name) content = PARSER_TEMPLATE % (grammar_module_name, grammar_variable_name, parser_class_name, action, goto) try: - with open('parser.py', 'x') as f: + with open('parsertab.py', 'x') as f: f.write(content) except FileExistsError: - with open('parser.py', 'w') as f: + with open('parsertab.py', 'w') as f: f.write(content) @staticmethod @@ -111,8 +111,8 @@ def build(grammar, lexer_class_name, grammar_module_name, grammar_variable_name) ) try: - with open('lexer.py', 'x') as f: + with open('lexertab.py', 'x') as f: f.write(content) except FileExistsError: - with open('lexer.py', 'w') as f: + with open('lexertab.py', 'w') as f: f.write(content) From 2dcb22f09b0240b574afbe8311b24d8c720c08ba Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Fri, 19 Jun 2020 04:29:29 +0200 Subject: [PATCH 064/143] Added a new Run-Time error --- semantics/progam_executor.py | 5 ++--- semantics/utils/errors.py | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/semantics/progam_executor.py b/semantics/progam_executor.py index 56104ba9e..ce7e03256 100644 --- a/semantics/progam_executor.py +++ b/semantics/progam_executor.py @@ -182,14 +182,13 @@ def visit(self, node: ast.SwitchCaseNode, scope: Scope): instance = self.visit(node.expr, scope) if isinstance(instance, VoidInstance): - raise ExecutionError() + raise ExecutionError(err.VOID_EXPRESSION) types = [(i, self.context.get_type(t)) for i, (_, t, _) in enumerate(node.cases) if instance.type.conforms_to(self.context.get_type(t))] if not types: - # Runtime Error - pass + raise ExecutionError(err.CASE_OF_ERROR) (index, most_conformable_type), *types = types for i, t in types: diff --git a/semantics/utils/errors.py b/semantics/utils/errors.py index 22e44b504..34b873a80 100644 --- a/semantics/utils/errors.py +++ b/semantics/utils/errors.py @@ -24,3 +24,4 @@ DIVIDE_BY_ZERO = 'ZeroDivisionError: Division by zero.' VOID_EXPRESSION = 'VoidReferenceError: Object reference not set to an instance of an object.' +CASE_OF_ERROR = 'CaseOfError: No branch matches wit de dynamic type of the case expression.' From 1161b73dccb488d1e617c92f2aab7f7fcca6f364 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Sun, 21 Jun 2020 18:08:19 +0200 Subject: [PATCH 065/143] Improved Error Handling in parsing time. --- grammar.py | 4 +- main.py | 20 +- parsertab.py | 1268 ++++++++++++++++++++++----------------------- pyjapt/parsing.py | 55 +- tester.py | 4 +- 5 files changed, 693 insertions(+), 658 deletions(-) diff --git a/grammar.py b/grammar.py index d03a3f7f7..116a06bca 100755 --- a/grammar.py +++ b/grammar.py @@ -212,13 +212,13 @@ def lexical_error(lexer): @G.production("feature-list -> attribute error feature-list") def feature_attribute_error(s): s.error(f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") - return ast.AttrDeclarationNode(s[1], s[3]) + return [s[1]] + s[3] @G.production("feature-list -> method error feature-list") def feature_method_error(s): s.error(f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") - return s[1] + return [s[1]] + s[3] @G.production("case-list -> id : type => expr error") diff --git a/main.py b/main.py index 07198a285..ca1727279 100755 --- a/main.py +++ b/main.py @@ -8,7 +8,7 @@ from semantics.type_inference import InferenceChecker from semantics.utils.scope import Context, Scope -detecting_errors = r""" +execution_errors = r""" (* class A { a (n: Int) : Int { 0 }; } @@ -128,13 +128,23 @@ class Main inherits IO { } """ -verbose = False +syntactic_errors = """ +class Main { + a: Int + + b: String + + main () : Object { 0 } +} +""" + +verbose = sys.argv[1] if len(sys.argv) > 1 else False lexer = CoolLexer() -parser = CoolParser() +parser = CoolParser(verbose) if __name__ == '__main__': - tokens = lexer(detecting_errors) + tokens = lexer(syntactic_errors) ast = parser(tokens) if ast is not None: @@ -152,7 +162,7 @@ class Main inherits IO { if verbose: print(CodeBuilder().visit(ast, 0), '\n') - if not errors: + if not errors and not parser.contains_errors: try: Executor(context).visit(ast, Scope()) print('Program finished...') diff --git a/parsertab.py b/parsertab.py index 25e1491cc..cc4efde81 100644 --- a/parsertab.py +++ b/parsertab.py @@ -21,125 +21,136 @@ def __action_table(): (3, G["}"]): ("REDUCE", G["feature-list -> e"]), (4, G[":"]): ("SHIFT", 127), (4, G["("]): ("SHIFT", 5), - (5, G["id"]): ("SHIFT", 115), (5, G[")"]): ("SHIFT", 6), + (5, G["id"]): ("SHIFT", 115), (6, G[":"]): ("SHIFT", 7), (7, G["type"]): ("SHIFT", 8), (8, G["{"]): ("SHIFT", 9), - (9, G["true"]): ("SHIFT", 25), (9, G["case"]): ("SHIFT", 21), - (9, G["id"]): ("SHIFT", 31), - (9, G["let"]): ("SHIFT", 14), - (9, G["string"]): ("SHIFT", 33), (9, G["("]): ("SHIFT", 11), - (9, G["not"]): ("SHIFT", 30), + (9, G["string"]): ("SHIFT", 33), (9, G["~"]): ("SHIFT", 27), + (9, G["id"]): ("SHIFT", 31), + (9, G["not"]): ("SHIFT", 30), (9, G["while"]): ("SHIFT", 13), - (9, G["int"]): ("SHIFT", 34), - (9, G["new"]): ("SHIFT", 22), + (9, G["true"]): ("SHIFT", 25), (9, G["isvoid"]): ("SHIFT", 24), (9, G["if"]): ("SHIFT", 12), (9, G["false"]): ("SHIFT", 26), + (9, G["let"]): ("SHIFT", 14), (9, G["{"]): ("SHIFT", 10), - (10, G["("]): ("SHIFT", 11), - (10, G["if"]): ("SHIFT", 12), - (10, G["isvoid"]): ("SHIFT", 24), + (9, G["int"]): ("SHIFT", 34), + (9, G["new"]): ("SHIFT", 22), (10, G["true"]): ("SHIFT", 25), + (10, G["case"]): ("SHIFT", 21), (10, G["false"]): ("SHIFT", 26), - (10, G["string"]): ("SHIFT", 33), - (10, G["int"]): ("SHIFT", 34), - (10, G["not"]): ("SHIFT", 30), (10, G["id"]): ("SHIFT", 31), - (10, G["~"]): ("SHIFT", 27), - (10, G["while"]): ("SHIFT", 13), + (10, G["int"]): ("SHIFT", 34), (10, G["{"]): ("SHIFT", 10), - (10, G["case"]): ("SHIFT", 21), (10, G["new"]): ("SHIFT", 22), (10, G["let"]): ("SHIFT", 14), - (11, G["{"]): ("SHIFT", 10), - (11, G["if"]): ("SHIFT", 12), - (11, G["id"]): ("SHIFT", 31), - (11, G["new"]): ("SHIFT", 22), - (11, G["false"]): ("SHIFT", 26), - (11, G["true"]): ("SHIFT", 25), - (11, G["isvoid"]): ("SHIFT", 24), - (11, G["~"]): ("SHIFT", 27), - (11, G["while"]): ("SHIFT", 13), + (10, G["if"]): ("SHIFT", 12), + (10, G["("]): ("SHIFT", 11), + (10, G["isvoid"]): ("SHIFT", 24), + (10, G["string"]): ("SHIFT", 33), + (10, G["~"]): ("SHIFT", 27), + (10, G["while"]): ("SHIFT", 13), + (10, G["not"]): ("SHIFT", 30), (11, G["int"]): ("SHIFT", 34), (11, G["string"]): ("SHIFT", 33), (11, G["let"]): ("SHIFT", 14), + (11, G["~"]): ("SHIFT", 27), + (11, G["false"]): ("SHIFT", 26), + (11, G["("]): ("SHIFT", 11), + (11, G["true"]): ("SHIFT", 25), + (11, G["id"]): ("SHIFT", 31), + (11, G["isvoid"]): ("SHIFT", 24), + (11, G["{"]): ("SHIFT", 10), (11, G["not"]): ("SHIFT", 30), + (11, G["if"]): ("SHIFT", 12), (11, G["case"]): ("SHIFT", 21), - (11, G["("]): ("SHIFT", 11), - (12, G["isvoid"]): ("SHIFT", 24), - (12, G["string"]): ("SHIFT", 33), - (12, G["~"]): ("SHIFT", 27), - (12, G["while"]): ("SHIFT", 13), - (12, G["id"]): ("SHIFT", 31), + (11, G["new"]): ("SHIFT", 22), + (11, G["while"]): ("SHIFT", 13), + (12, G["{"]): ("SHIFT", 10), + (12, G["new"]): ("SHIFT", 22), + (12, G["int"]): ("SHIFT", 34), + (12, G["true"]): ("SHIFT", 25), (12, G["case"]): ("SHIFT", 21), + (12, G["false"]): ("SHIFT", 26), (12, G["let"]): ("SHIFT", 14), + (12, G["while"]): ("SHIFT", 13), (12, G["not"]): ("SHIFT", 30), - (12, G["if"]): ("SHIFT", 12), - (12, G["new"]): ("SHIFT", 22), + (12, G["id"]): ("SHIFT", 31), + (12, G["string"]): ("SHIFT", 33), + (12, G["~"]): ("SHIFT", 27), + (12, G["isvoid"]): ("SHIFT", 24), (12, G["("]): ("SHIFT", 11), - (12, G["{"]): ("SHIFT", 10), - (12, G["false"]): ("SHIFT", 26), - (12, G["true"]): ("SHIFT", 25), - (12, G["int"]): ("SHIFT", 34), - (13, G["true"]): ("SHIFT", 25), - (13, G["int"]): ("SHIFT", 34), - (13, G["let"]): ("SHIFT", 14), + (12, G["if"]): ("SHIFT", 12), (13, G["new"]): ("SHIFT", 22), - (13, G["if"]): ("SHIFT", 12), - (13, G["isvoid"]): ("SHIFT", 24), + (13, G["~"]): ("SHIFT", 27), (13, G["id"]): ("SHIFT", 31), - (13, G["not"]): ("SHIFT", 30), - (13, G["string"]): ("SHIFT", 33), - (13, G["("]): ("SHIFT", 11), - (13, G["while"]): ("SHIFT", 13), (13, G["{"]): ("SHIFT", 10), - (13, G["~"]): ("SHIFT", 27), + (13, G["if"]): ("SHIFT", 12), (13, G["case"]): ("SHIFT", 21), + (13, G["while"]): ("SHIFT", 13), + (13, G["true"]): ("SHIFT", 25), + (13, G["not"]): ("SHIFT", 30), + (13, G["("]): ("SHIFT", 11), (13, G["false"]): ("SHIFT", 26), + (13, G["let"]): ("SHIFT", 14), + (13, G["isvoid"]): ("SHIFT", 24), + (13, G["string"]): ("SHIFT", 33), + (13, G["int"]): ("SHIFT", 34), (14, G["id"]): ("SHIFT", 15), (15, G[":"]): ("SHIFT", 16), (16, G["type"]): ("SHIFT", 17), - (17, G[","]): ("SHIFT", 18), (17, G["<-"]): ("SHIFT", 20), + (17, G[","]): ("SHIFT", 18), (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), (18, G["id"]): ("SHIFT", 15), (19, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), - (20, G["{"]): ("SHIFT", 10), - (20, G["if"]): ("SHIFT", 12), - (20, G["id"]): ("SHIFT", 31), - (20, G["new"]): ("SHIFT", 22), (20, G["~"]): ("SHIFT", 27), (20, G["while"]): ("SHIFT", 13), + (20, G["not"]): ("SHIFT", 30), (20, G["int"]): ("SHIFT", 34), (20, G["string"]): ("SHIFT", 33), - (20, G["let"]): ("SHIFT", 14), + (20, G["id"]): ("SHIFT", 31), + (20, G["case"]): ("SHIFT", 21), + (20, G["new"]): ("SHIFT", 22), (20, G["isvoid"]): ("SHIFT", 24), - (20, G["not"]): ("SHIFT", 30), + (20, G["{"]): ("SHIFT", 10), (20, G["false"]): ("SHIFT", 26), - (20, G["true"]): ("SHIFT", 25), - (20, G["case"]): ("SHIFT", 21), + (20, G["let"]): ("SHIFT", 14), (20, G["("]): ("SHIFT", 11), - (21, G["false"]): ("SHIFT", 26), - (21, G["let"]): ("SHIFT", 14), + (20, G["true"]): ("SHIFT", 25), + (20, G["if"]): ("SHIFT", 12), (21, G["~"]): ("SHIFT", 27), - (21, G["isvoid"]): ("SHIFT", 24), - (21, G["true"]): ("SHIFT", 25), - (21, G["if"]): ("SHIFT", 12), + (21, G["{"]): ("SHIFT", 10), (21, G["int"]): ("SHIFT", 34), (21, G["new"]): ("SHIFT", 22), - (21, G["not"]): ("SHIFT", 30), (21, G["id"]): ("SHIFT", 31), - (21, G["string"]): ("SHIFT", 33), + (21, G["let"]): ("SHIFT", 14), (21, G["while"]): ("SHIFT", 13), - (21, G["{"]): ("SHIFT", 10), - (21, G["("]): ("SHIFT", 11), + (21, G["not"]): ("SHIFT", 30), (21, G["case"]): ("SHIFT", 21), + (21, G["true"]): ("SHIFT", 25), + (21, G["isvoid"]): ("SHIFT", 24), + (21, G["if"]): ("SHIFT", 12), + (21, G["("]): ("SHIFT", 11), + (21, G["false"]): ("SHIFT", 26), + (21, G["string"]): ("SHIFT", 33), (22, G["type"]): ("SHIFT", 23), + (23, G["*"]): ("REDUCE", G["atom -> new type"]), + (23, G["}"]): ("REDUCE", G["atom -> new type"]), + (23, G["/"]): ("REDUCE", G["atom -> new type"]), + (23, G["loop"]): ("REDUCE", G["atom -> new type"]), + (23, G["<"]): ("REDUCE", G["atom -> new type"]), + (23, G["<="]): ("REDUCE", G["atom -> new type"]), + (23, G["pool"]): ("REDUCE", G["atom -> new type"]), + (23, G[")"]): ("REDUCE", G["atom -> new type"]), + (23, G["="]): ("REDUCE", G["atom -> new type"]), + (23, G["."]): ("REDUCE", G["atom -> new type"]), + (23, G["fi"]): ("REDUCE", G["atom -> new type"]), (23, G["in"]): ("REDUCE", G["atom -> new type"]), (23, G[","]): ("REDUCE", G["atom -> new type"]), (23, G["then"]): ("REDUCE", G["atom -> new type"]), @@ -148,91 +159,69 @@ def __action_table(): (23, G["+"]): ("REDUCE", G["atom -> new type"]), (23, G["else"]): ("REDUCE", G["atom -> new type"]), (23, G["of"]): ("REDUCE", G["atom -> new type"]), - (23, G["="]): ("REDUCE", G["atom -> new type"]), - (23, G["-"]): ("REDUCE", G["atom -> new type"]), - (23, G["fi"]): ("REDUCE", G["atom -> new type"]), - (23, G["*"]): ("REDUCE", G["atom -> new type"]), - (23, G["}"]): ("REDUCE", G["atom -> new type"]), - (23, G["/"]): ("REDUCE", G["atom -> new type"]), - (23, G["<"]): ("REDUCE", G["atom -> new type"]), - (23, G["loop"]): ("REDUCE", G["atom -> new type"]), - (23, G["<="]): ("REDUCE", G["atom -> new type"]), - (23, G["pool"]): ("REDUCE", G["atom -> new type"]), - (23, G[")"]): ("REDUCE", G["atom -> new type"]), (23, G["error"]): ("REDUCE", G["atom -> new type"]), - (23, G["."]): ("REDUCE", G["atom -> new type"]), - (24, G["false"]): ("SHIFT", 26), - (24, G["("]): ("SHIFT", 11), + (23, G["-"]): ("REDUCE", G["atom -> new type"]), + (24, G["true"]): ("SHIFT", 25), + (24, G["int"]): ("SHIFT", 34), (24, G["id"]): ("SHIFT", 28), + (24, G["~"]): ("SHIFT", 27), (24, G["string"]): ("SHIFT", 33), + (24, G["false"]): ("SHIFT", 26), + (24, G["("]): ("SHIFT", 11), (24, G["new"]): ("SHIFT", 22), - (24, G["int"]): ("SHIFT", 34), (24, G["isvoid"]): ("SHIFT", 24), - (24, G["true"]): ("SHIFT", 25), - (24, G["~"]): ("SHIFT", 27), + (25, G["*"]): ("REDUCE", G["atom -> true"]), + (25, G["}"]): ("REDUCE", G["atom -> true"]), + (25, G["/"]): ("REDUCE", G["atom -> true"]), + (25, G["loop"]): ("REDUCE", G["atom -> true"]), + (25, G["<"]): ("REDUCE", G["atom -> true"]), + (25, G["<="]): ("REDUCE", G["atom -> true"]), + (25, G["pool"]): ("REDUCE", G["atom -> true"]), + (25, G[")"]): ("REDUCE", G["atom -> true"]), + (25, G["="]): ("REDUCE", G["atom -> true"]), + (25, G["."]): ("REDUCE", G["atom -> true"]), (25, G["in"]): ("REDUCE", G["atom -> true"]), (25, G[","]): ("REDUCE", G["atom -> true"]), (25, G["then"]): ("REDUCE", G["atom -> true"]), + (25, G["-"]): ("REDUCE", G["atom -> true"]), (25, G[";"]): ("REDUCE", G["atom -> true"]), (25, G["+"]): ("REDUCE", G["atom -> true"]), (25, G["@"]): ("REDUCE", G["atom -> true"]), (25, G["else"]): ("REDUCE", G["atom -> true"]), (25, G["of"]): ("REDUCE", G["atom -> true"]), - (25, G["="]): ("REDUCE", G["atom -> true"]), - (25, G["fi"]): ("REDUCE", G["atom -> true"]), - (25, G["-"]): ("REDUCE", G["atom -> true"]), - (25, G["*"]): ("REDUCE", G["atom -> true"]), - (25, G["}"]): ("REDUCE", G["atom -> true"]), - (25, G["/"]): ("REDUCE", G["atom -> true"]), - (25, G["<"]): ("REDUCE", G["atom -> true"]), - (25, G["loop"]): ("REDUCE", G["atom -> true"]), - (25, G["<="]): ("REDUCE", G["atom -> true"]), - (25, G["pool"]): ("REDUCE", G["atom -> true"]), - (25, G[")"]): ("REDUCE", G["atom -> true"]), (25, G["error"]): ("REDUCE", G["atom -> true"]), - (25, G["."]): ("REDUCE", G["atom -> true"]), - (26, G["in"]): ("REDUCE", G["atom -> false"]), - (26, G[","]): ("REDUCE", G["atom -> false"]), - (26, G["then"]): ("REDUCE", G["atom -> false"]), - (26, G[";"]): ("REDUCE", G["atom -> false"]), - (26, G["@"]): ("REDUCE", G["atom -> false"]), - (26, G["+"]): ("REDUCE", G["atom -> false"]), - (26, G["else"]): ("REDUCE", G["atom -> false"]), - (26, G["of"]): ("REDUCE", G["atom -> false"]), - (26, G["="]): ("REDUCE", G["atom -> false"]), - (26, G["fi"]): ("REDUCE", G["atom -> false"]), - (26, G["-"]): ("REDUCE", G["atom -> false"]), + (25, G["fi"]): ("REDUCE", G["atom -> true"]), (26, G["*"]): ("REDUCE", G["atom -> false"]), (26, G["}"]): ("REDUCE", G["atom -> false"]), (26, G["/"]): ("REDUCE", G["atom -> false"]), - (26, G["<"]): ("REDUCE", G["atom -> false"]), (26, G["loop"]): ("REDUCE", G["atom -> false"]), + (26, G["<"]): ("REDUCE", G["atom -> false"]), (26, G["<="]): ("REDUCE", G["atom -> false"]), (26, G["pool"]): ("REDUCE", G["atom -> false"]), (26, G[")"]): ("REDUCE", G["atom -> false"]), - (26, G["error"]): ("REDUCE", G["atom -> false"]), + (26, G["="]): ("REDUCE", G["atom -> false"]), (26, G["."]): ("REDUCE", G["atom -> false"]), - (27, G["false"]): ("SHIFT", 26), - (27, G["("]): ("SHIFT", 11), + (26, G["in"]): ("REDUCE", G["atom -> false"]), + (26, G[","]): ("REDUCE", G["atom -> false"]), + (26, G["then"]): ("REDUCE", G["atom -> false"]), + (26, G["-"]): ("REDUCE", G["atom -> false"]), + (26, G[";"]): ("REDUCE", G["atom -> false"]), + (26, G["+"]): ("REDUCE", G["atom -> false"]), + (26, G["@"]): ("REDUCE", G["atom -> false"]), + (26, G["else"]): ("REDUCE", G["atom -> false"]), + (26, G["of"]): ("REDUCE", G["atom -> false"]), + (26, G["error"]): ("REDUCE", G["atom -> false"]), + (26, G["fi"]): ("REDUCE", G["atom -> false"]), + (27, G["true"]): ("SHIFT", 25), + (27, G["int"]): ("SHIFT", 34), (27, G["id"]): ("SHIFT", 28), + (27, G["~"]): ("SHIFT", 27), (27, G["string"]): ("SHIFT", 33), + (27, G["false"]): ("SHIFT", 26), + (27, G["("]): ("SHIFT", 11), (27, G["new"]): ("SHIFT", 22), - (27, G["int"]): ("SHIFT", 34), (27, G["isvoid"]): ("SHIFT", 24), - (27, G["true"]): ("SHIFT", 25), - (27, G["~"]): ("SHIFT", 27), (28, G["("]): ("SHIFT", 29), - (28, G["in"]): ("REDUCE", G["atom -> id"]), - (28, G[","]): ("REDUCE", G["atom -> id"]), - (28, G["then"]): ("REDUCE", G["atom -> id"]), - (28, G[";"]): ("REDUCE", G["atom -> id"]), - (28, G["@"]): ("REDUCE", G["atom -> id"]), - (28, G["+"]): ("REDUCE", G["atom -> id"]), - (28, G["else"]): ("REDUCE", G["atom -> id"]), - (28, G["of"]): ("REDUCE", G["atom -> id"]), - (28, G["="]): ("REDUCE", G["atom -> id"]), - (28, G["-"]): ("REDUCE", G["atom -> id"]), - (28, G["fi"]): ("REDUCE", G["atom -> id"]), (28, G["*"]): ("REDUCE", G["atom -> id"]), (28, G["}"]): ("REDUCE", G["atom -> id"]), (28, G["/"]): ("REDUCE", G["atom -> id"]), @@ -241,190 +230,210 @@ def __action_table(): (28, G["<="]): ("REDUCE", G["atom -> id"]), (28, G["pool"]): ("REDUCE", G["atom -> id"]), (28, G[")"]): ("REDUCE", G["atom -> id"]), - (28, G["error"]): ("REDUCE", G["atom -> id"]), + (28, G["="]): ("REDUCE", G["atom -> id"]), (28, G["."]): ("REDUCE", G["atom -> id"]), + (28, G["fi"]): ("REDUCE", G["atom -> id"]), + (28, G["in"]): ("REDUCE", G["atom -> id"]), + (28, G[","]): ("REDUCE", G["atom -> id"]), + (28, G["then"]): ("REDUCE", G["atom -> id"]), + (28, G[";"]): ("REDUCE", G["atom -> id"]), + (28, G["@"]): ("REDUCE", G["atom -> id"]), + (28, G["+"]): ("REDUCE", G["atom -> id"]), + (28, G["else"]): ("REDUCE", G["atom -> id"]), + (28, G["of"]): ("REDUCE", G["atom -> id"]), + (28, G["error"]): ("REDUCE", G["atom -> id"]), + (28, G["-"]): ("REDUCE", G["atom -> id"]), + (29, G["if"]): ("SHIFT", 12), + (29, G["true"]): ("SHIFT", 25), (29, G["case"]): ("SHIFT", 21), - (29, G["id"]): ("SHIFT", 31), - (29, G["~"]): ("SHIFT", 27), - (29, G["{"]): ("SHIFT", 10), - (29, G[")"]): ("REDUCE", G["expr-list -> e"]), - (29, G["isvoid"]): ("SHIFT", 24), - (29, G["while"]): ("SHIFT", 13), - (29, G["int"]): ("SHIFT", 34), - (29, G["new"]): ("SHIFT", 22), - (29, G["not"]): ("SHIFT", 30), (29, G["("]): ("SHIFT", 11), - (29, G["string"]): ("SHIFT", 33), - (29, G["if"]): ("SHIFT", 12), (29, G["false"]): ("SHIFT", 26), - (29, G["true"]): ("SHIFT", 25), + (29, G["string"]): ("SHIFT", 33), + (29, G["int"]): ("SHIFT", 34), + (29, G["~"]): ("SHIFT", 27), + (29, G["new"]): ("SHIFT", 22), (29, G["let"]): ("SHIFT", 14), + (29, G["while"]): ("SHIFT", 13), + (29, G["not"]): ("SHIFT", 30), + (29, G["id"]): ("SHIFT", 31), + (29, G["isvoid"]): ("SHIFT", 24), + (29, G[")"]): ("REDUCE", G["expr-list -> e"]), + (29, G["{"]): ("SHIFT", 10), (30, G["let"]): ("SHIFT", 14), - (30, G["new"]): ("SHIFT", 22), - (30, G["int"]): ("SHIFT", 34), - (30, G["~"]): ("SHIFT", 27), - (30, G["{"]): ("SHIFT", 10), (30, G["while"]): ("SHIFT", 13), - (30, G["true"]): ("SHIFT", 25), - (30, G["false"]): ("SHIFT", 26), (30, G["not"]): ("SHIFT", 30), - (30, G["string"]): ("SHIFT", 33), + (30, G["~"]): ("SHIFT", 27), (30, G["id"]): ("SHIFT", 31), + (30, G["string"]): ("SHIFT", 33), (30, G["if"]): ("SHIFT", 12), + (30, G["false"]): ("SHIFT", 26), + (30, G["true"]): ("SHIFT", 25), + (30, G["{"]): ("SHIFT", 10), + (30, G["new"]): ("SHIFT", 22), (30, G["isvoid"]): ("SHIFT", 24), - (30, G["("]): ("SHIFT", 11), + (30, G["int"]): ("SHIFT", 34), (30, G["case"]): ("SHIFT", 21), + (30, G["("]): ("SHIFT", 11), + (31, G["<-"]): ("SHIFT", 32), (31, G["("]): ("SHIFT", 29), + (31, G["*"]): ("REDUCE", G["atom -> id"]), + (31, G["}"]): ("REDUCE", G["atom -> id"]), + (31, G["/"]): ("REDUCE", G["atom -> id"]), + (31, G["loop"]): ("REDUCE", G["atom -> id"]), + (31, G["<"]): ("REDUCE", G["atom -> id"]), + (31, G["<="]): ("REDUCE", G["atom -> id"]), + (31, G["pool"]): ("REDUCE", G["atom -> id"]), + (31, G[")"]): ("REDUCE", G["atom -> id"]), + (31, G["="]): ("REDUCE", G["atom -> id"]), + (31, G["."]): ("REDUCE", G["atom -> id"]), (31, G["in"]): ("REDUCE", G["atom -> id"]), (31, G[","]): ("REDUCE", G["atom -> id"]), (31, G["then"]): ("REDUCE", G["atom -> id"]), + (31, G["-"]): ("REDUCE", G["atom -> id"]), (31, G[";"]): ("REDUCE", G["atom -> id"]), (31, G["@"]): ("REDUCE", G["atom -> id"]), (31, G["+"]): ("REDUCE", G["atom -> id"]), (31, G["else"]): ("REDUCE", G["atom -> id"]), (31, G["of"]): ("REDUCE", G["atom -> id"]), - (31, G["="]): ("REDUCE", G["atom -> id"]), - (31, G["fi"]): ("REDUCE", G["atom -> id"]), - (31, G["-"]): ("REDUCE", G["atom -> id"]), - (31, G["*"]): ("REDUCE", G["atom -> id"]), - (31, G["}"]): ("REDUCE", G["atom -> id"]), - (31, G["/"]): ("REDUCE", G["atom -> id"]), - (31, G["<"]): ("REDUCE", G["atom -> id"]), - (31, G["loop"]): ("REDUCE", G["atom -> id"]), - (31, G["<="]): ("REDUCE", G["atom -> id"]), - (31, G["pool"]): ("REDUCE", G["atom -> id"]), - (31, G[")"]): ("REDUCE", G["atom -> id"]), (31, G["error"]): ("REDUCE", G["atom -> id"]), - (31, G["."]): ("REDUCE", G["atom -> id"]), - (31, G["<-"]): ("SHIFT", 32), + (31, G["fi"]): ("REDUCE", G["atom -> id"]), (32, G["let"]): ("SHIFT", 14), - (32, G["new"]): ("SHIFT", 22), - (32, G["int"]): ("SHIFT", 34), - (32, G["~"]): ("SHIFT", 27), - (32, G["{"]): ("SHIFT", 10), (32, G["while"]): ("SHIFT", 13), - (32, G["true"]): ("SHIFT", 25), - (32, G["false"]): ("SHIFT", 26), (32, G["not"]): ("SHIFT", 30), - (32, G["string"]): ("SHIFT", 33), + (32, G["~"]): ("SHIFT", 27), (32, G["id"]): ("SHIFT", 31), + (32, G["string"]): ("SHIFT", 33), (32, G["if"]): ("SHIFT", 12), + (32, G["false"]): ("SHIFT", 26), + (32, G["true"]): ("SHIFT", 25), + (32, G["{"]): ("SHIFT", 10), + (32, G["new"]): ("SHIFT", 22), (32, G["isvoid"]): ("SHIFT", 24), - (32, G["("]): ("SHIFT", 11), + (32, G["int"]): ("SHIFT", 34), (32, G["case"]): ("SHIFT", 21), + (32, G["("]): ("SHIFT", 11), + (33, G["*"]): ("REDUCE", G["atom -> string"]), + (33, G["}"]): ("REDUCE", G["atom -> string"]), + (33, G["/"]): ("REDUCE", G["atom -> string"]), + (33, G["loop"]): ("REDUCE", G["atom -> string"]), + (33, G["<"]): ("REDUCE", G["atom -> string"]), + (33, G["<="]): ("REDUCE", G["atom -> string"]), + (33, G["pool"]): ("REDUCE", G["atom -> string"]), + (33, G[")"]): ("REDUCE", G["atom -> string"]), + (33, G["="]): ("REDUCE", G["atom -> string"]), + (33, G["."]): ("REDUCE", G["atom -> string"]), (33, G["in"]): ("REDUCE", G["atom -> string"]), (33, G[","]): ("REDUCE", G["atom -> string"]), (33, G["then"]): ("REDUCE", G["atom -> string"]), + (33, G["-"]): ("REDUCE", G["atom -> string"]), (33, G[";"]): ("REDUCE", G["atom -> string"]), (33, G["+"]): ("REDUCE", G["atom -> string"]), (33, G["@"]): ("REDUCE", G["atom -> string"]), (33, G["else"]): ("REDUCE", G["atom -> string"]), (33, G["of"]): ("REDUCE", G["atom -> string"]), - (33, G["="]): ("REDUCE", G["atom -> string"]), - (33, G["fi"]): ("REDUCE", G["atom -> string"]), - (33, G["-"]): ("REDUCE", G["atom -> string"]), - (33, G["*"]): ("REDUCE", G["atom -> string"]), - (33, G["}"]): ("REDUCE", G["atom -> string"]), - (33, G["/"]): ("REDUCE", G["atom -> string"]), - (33, G["<"]): ("REDUCE", G["atom -> string"]), - (33, G["loop"]): ("REDUCE", G["atom -> string"]), - (33, G["<="]): ("REDUCE", G["atom -> string"]), - (33, G["pool"]): ("REDUCE", G["atom -> string"]), - (33, G[")"]): ("REDUCE", G["atom -> string"]), (33, G["error"]): ("REDUCE", G["atom -> string"]), - (33, G["."]): ("REDUCE", G["atom -> string"]), + (33, G["fi"]): ("REDUCE", G["atom -> string"]), + (34, G["*"]): ("REDUCE", G["atom -> int"]), + (34, G["}"]): ("REDUCE", G["atom -> int"]), + (34, G["/"]): ("REDUCE", G["atom -> int"]), + (34, G["loop"]): ("REDUCE", G["atom -> int"]), + (34, G["<"]): ("REDUCE", G["atom -> int"]), + (34, G["<="]): ("REDUCE", G["atom -> int"]), + (34, G["pool"]): ("REDUCE", G["atom -> int"]), + (34, G[")"]): ("REDUCE", G["atom -> int"]), + (34, G["="]): ("REDUCE", G["atom -> int"]), + (34, G["."]): ("REDUCE", G["atom -> int"]), (34, G["in"]): ("REDUCE", G["atom -> int"]), (34, G[","]): ("REDUCE", G["atom -> int"]), (34, G["then"]): ("REDUCE", G["atom -> int"]), + (34, G["-"]): ("REDUCE", G["atom -> int"]), (34, G[";"]): ("REDUCE", G["atom -> int"]), (34, G["+"]): ("REDUCE", G["atom -> int"]), (34, G["@"]): ("REDUCE", G["atom -> int"]), (34, G["else"]): ("REDUCE", G["atom -> int"]), (34, G["of"]): ("REDUCE", G["atom -> int"]), - (34, G["="]): ("REDUCE", G["atom -> int"]), - (34, G["fi"]): ("REDUCE", G["atom -> int"]), - (34, G["-"]): ("REDUCE", G["atom -> int"]), - (34, G["*"]): ("REDUCE", G["atom -> int"]), - (34, G["}"]): ("REDUCE", G["atom -> int"]), - (34, G["/"]): ("REDUCE", G["atom -> int"]), - (34, G["<"]): ("REDUCE", G["atom -> int"]), - (34, G["loop"]): ("REDUCE", G["atom -> int"]), - (34, G["<="]): ("REDUCE", G["atom -> int"]), - (34, G["pool"]): ("REDUCE", G["atom -> int"]), - (34, G[")"]): ("REDUCE", G["atom -> int"]), (34, G["error"]): ("REDUCE", G["atom -> int"]), - (34, G["."]): ("REDUCE", G["atom -> int"]), - (35, G["in"]): ("REDUCE", G["atom -> function-call"]), - (35, G[","]): ("REDUCE", G["atom -> function-call"]), - (35, G["then"]): ("REDUCE", G["atom -> function-call"]), - (35, G[";"]): ("REDUCE", G["atom -> function-call"]), - (35, G["@"]): ("REDUCE", G["atom -> function-call"]), - (35, G["+"]): ("REDUCE", G["atom -> function-call"]), - (35, G["else"]): ("REDUCE", G["atom -> function-call"]), - (35, G["of"]): ("REDUCE", G["atom -> function-call"]), - (35, G["="]): ("REDUCE", G["atom -> function-call"]), - (35, G["fi"]): ("REDUCE", G["atom -> function-call"]), - (35, G["-"]): ("REDUCE", G["atom -> function-call"]), + (34, G["fi"]): ("REDUCE", G["atom -> int"]), (35, G["*"]): ("REDUCE", G["atom -> function-call"]), (35, G["}"]): ("REDUCE", G["atom -> function-call"]), (35, G["/"]): ("REDUCE", G["atom -> function-call"]), - (35, G["<"]): ("REDUCE", G["atom -> function-call"]), (35, G["loop"]): ("REDUCE", G["atom -> function-call"]), + (35, G["<"]): ("REDUCE", G["atom -> function-call"]), (35, G["<="]): ("REDUCE", G["atom -> function-call"]), (35, G["pool"]): ("REDUCE", G["atom -> function-call"]), (35, G[")"]): ("REDUCE", G["atom -> function-call"]), - (35, G["error"]): ("REDUCE", G["atom -> function-call"]), + (35, G["="]): ("REDUCE", G["atom -> function-call"]), (35, G["."]): ("REDUCE", G["atom -> function-call"]), + (35, G["in"]): ("REDUCE", G["atom -> function-call"]), + (35, G[","]): ("REDUCE", G["atom -> function-call"]), + (35, G["then"]): ("REDUCE", G["atom -> function-call"]), + (35, G["-"]): ("REDUCE", G["atom -> function-call"]), + (35, G[";"]): ("REDUCE", G["atom -> function-call"]), + (35, G["+"]): ("REDUCE", G["atom -> function-call"]), + (35, G["@"]): ("REDUCE", G["atom -> function-call"]), + (35, G["else"]): ("REDUCE", G["atom -> function-call"]), + (35, G["of"]): ("REDUCE", G["atom -> function-call"]), + (35, G["error"]): ("REDUCE", G["atom -> function-call"]), + (35, G["fi"]): ("REDUCE", G["atom -> function-call"]), + (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["in"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["}"]): ("REDUCE", G["expr -> id <- expr"]), (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["else"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), + (37, G["error"]): ("REDUCE", G["expr -> comp"]), (37, G["in"]): ("REDUCE", G["expr -> comp"]), (37, G["}"]): ("REDUCE", G["expr -> comp"]), (37, G[","]): ("REDUCE", G["expr -> comp"]), - (37, G["then"]): ("REDUCE", G["expr -> comp"]), (37, G["loop"]): ("REDUCE", G["expr -> comp"]), + (37, G["then"]): ("REDUCE", G["expr -> comp"]), (37, G[";"]): ("REDUCE", G["expr -> comp"]), - (37, G[")"]): ("REDUCE", G["expr -> comp"]), (37, G["of"]): ("REDUCE", G["expr -> comp"]), (37, G["pool"]): ("REDUCE", G["expr -> comp"]), (37, G["else"]): ("REDUCE", G["expr -> comp"]), - (37, G["error"]): ("REDUCE", G["expr -> comp"]), + (37, G[")"]): ("REDUCE", G["expr -> comp"]), (37, G["fi"]): ("REDUCE", G["expr -> comp"]), - (38, G["<="]): ("SHIFT", 68), - (38, G["-"]): ("SHIFT", 64), - (38, G["="]): ("SHIFT", 70), (38, G["<"]): ("SHIFT", 66), + (38, G["error"]): ("REDUCE", G["comp -> arith"]), (38, G["in"]): ("REDUCE", G["comp -> arith"]), (38, G["}"]): ("REDUCE", G["comp -> arith"]), (38, G[","]): ("REDUCE", G["comp -> arith"]), - (38, G["then"]): ("REDUCE", G["comp -> arith"]), (38, G["loop"]): ("REDUCE", G["comp -> arith"]), + (38, G["then"]): ("REDUCE", G["comp -> arith"]), (38, G[";"]): ("REDUCE", G["comp -> arith"]), - (38, G[")"]): ("REDUCE", G["comp -> arith"]), (38, G["of"]): ("REDUCE", G["comp -> arith"]), (38, G["pool"]): ("REDUCE", G["comp -> arith"]), (38, G["else"]): ("REDUCE", G["comp -> arith"]), - (38, G["error"]): ("REDUCE", G["comp -> arith"]), + (38, G[")"]): ("REDUCE", G["comp -> arith"]), (38, G["fi"]): ("REDUCE", G["comp -> arith"]), + (38, G["="]): ("SHIFT", 70), (38, G["+"]): ("SHIFT", 39), - (39, G["false"]): ("SHIFT", 26), - (39, G["new"]): ("SHIFT", 22), - (39, G["string"]): ("SHIFT", 33), - (39, G["int"]): ("SHIFT", 34), + (38, G["<="]): ("SHIFT", 68), + (38, G["-"]): ("SHIFT", 64), + (39, G["true"]): ("SHIFT", 25), + (39, G["~"]): ("SHIFT", 27), (39, G["id"]): ("SHIFT", 28), + (39, G["new"]): ("SHIFT", 22), (39, G["isvoid"]): ("SHIFT", 24), - (39, G["~"]): ("SHIFT", 27), + (39, G["int"]): ("SHIFT", 34), + (39, G["string"]): ("SHIFT", 33), (39, G["("]): ("SHIFT", 11), - (39, G["true"]): ("SHIFT", 25), + (39, G["false"]): ("SHIFT", 26), + (40, G["*"]): ("SHIFT", 41), + (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["<"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["<="]): ("REDUCE", G["arith -> arith + term"]), + (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["="]): ("REDUCE", G["arith -> arith + term"]), + (40, G["fi"]): ("REDUCE", G["arith -> arith + term"]), (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), (40, G[","]): ("REDUCE", G["arith -> arith + term"]), (40, G["then"]): ("REDUCE", G["arith -> arith + term"]), @@ -432,86 +441,88 @@ def __action_table(): (40, G["+"]): ("REDUCE", G["arith -> arith + term"]), (40, G["of"]): ("REDUCE", G["arith -> arith + term"]), (40, G["else"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["="]): ("REDUCE", G["arith -> arith + term"]), - (40, G["fi"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["<"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["<="]): ("REDUCE", G["arith -> arith + term"]), - (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["*"]): ("SHIFT", 41), + (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), (40, G["/"]): ("SHIFT", 54), - (41, G["false"]): ("SHIFT", 26), - (41, G["("]): ("SHIFT", 11), + (41, G["true"]): ("SHIFT", 25), + (41, G["int"]): ("SHIFT", 34), (41, G["id"]): ("SHIFT", 28), + (41, G["~"]): ("SHIFT", 27), (41, G["string"]): ("SHIFT", 33), + (41, G["false"]): ("SHIFT", 26), + (41, G["("]): ("SHIFT", 11), (41, G["new"]): ("SHIFT", 22), - (41, G["int"]): ("SHIFT", 34), (41, G["isvoid"]): ("SHIFT", 24), - (41, G["true"]): ("SHIFT", 25), - (41, G["~"]): ("SHIFT", 27), - (42, G["in"]): ("REDUCE", G["term -> term * factor"]), - (42, G[","]): ("REDUCE", G["term -> term * factor"]), - (42, G["then"]): ("REDUCE", G["term -> term * factor"]), - (42, G[";"]): ("REDUCE", G["term -> term * factor"]), - (42, G["+"]): ("REDUCE", G["term -> term * factor"]), - (42, G["else"]): ("REDUCE", G["term -> term * factor"]), - (42, G["of"]): ("REDUCE", G["term -> term * factor"]), - (42, G["="]): ("REDUCE", G["term -> term * factor"]), - (42, G["fi"]): ("REDUCE", G["term -> term * factor"]), - (42, G["-"]): ("REDUCE", G["term -> term * factor"]), (42, G["*"]): ("REDUCE", G["term -> term * factor"]), (42, G["}"]): ("REDUCE", G["term -> term * factor"]), (42, G["/"]): ("REDUCE", G["term -> term * factor"]), - (42, G["<"]): ("REDUCE", G["term -> term * factor"]), (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), - (42, G["<="]): ("REDUCE", G["term -> term * factor"]), + (42, G["<"]): ("REDUCE", G["term -> term * factor"]), (42, G["pool"]): ("REDUCE", G["term -> term * factor"]), + (42, G["<="]): ("REDUCE", G["term -> term * factor"]), (42, G[")"]): ("REDUCE", G["term -> term * factor"]), - (42, G["error"]): ("REDUCE", G["term -> term * factor"]), - (43, G["in"]): ("REDUCE", G["factor -> atom"]), - (43, G[","]): ("REDUCE", G["factor -> atom"]), - (43, G["then"]): ("REDUCE", G["factor -> atom"]), - (43, G[";"]): ("REDUCE", G["factor -> atom"]), - (43, G["+"]): ("REDUCE", G["factor -> atom"]), - (43, G["else"]): ("REDUCE", G["factor -> atom"]), - (43, G["of"]): ("REDUCE", G["factor -> atom"]), - (43, G["="]): ("REDUCE", G["factor -> atom"]), - (43, G["fi"]): ("REDUCE", G["factor -> atom"]), - (43, G["-"]): ("REDUCE", G["factor -> atom"]), + (42, G["="]): ("REDUCE", G["term -> term * factor"]), + (42, G["fi"]): ("REDUCE", G["term -> term * factor"]), + (42, G["in"]): ("REDUCE", G["term -> term * factor"]), + (42, G[","]): ("REDUCE", G["term -> term * factor"]), + (42, G["then"]): ("REDUCE", G["term -> term * factor"]), + (42, G[";"]): ("REDUCE", G["term -> term * factor"]), + (42, G["+"]): ("REDUCE", G["term -> term * factor"]), + (42, G["else"]): ("REDUCE", G["term -> term * factor"]), + (42, G["of"]): ("REDUCE", G["term -> term * factor"]), + (42, G["error"]): ("REDUCE", G["term -> term * factor"]), + (42, G["-"]): ("REDUCE", G["term -> term * factor"]), + (43, G["."]): ("SHIFT", 44), (43, G["*"]): ("REDUCE", G["factor -> atom"]), (43, G["}"]): ("REDUCE", G["factor -> atom"]), (43, G["/"]): ("REDUCE", G["factor -> atom"]), - (43, G["<"]): ("REDUCE", G["factor -> atom"]), (43, G["loop"]): ("REDUCE", G["factor -> atom"]), + (43, G["<"]): ("REDUCE", G["factor -> atom"]), (43, G["<="]): ("REDUCE", G["factor -> atom"]), (43, G["pool"]): ("REDUCE", G["factor -> atom"]), (43, G[")"]): ("REDUCE", G["factor -> atom"]), + (43, G["="]): ("REDUCE", G["factor -> atom"]), + (43, G["fi"]): ("REDUCE", G["factor -> atom"]), + (43, G["in"]): ("REDUCE", G["factor -> atom"]), + (43, G[","]): ("REDUCE", G["factor -> atom"]), + (43, G["then"]): ("REDUCE", G["factor -> atom"]), + (43, G[";"]): ("REDUCE", G["factor -> atom"]), + (43, G["+"]): ("REDUCE", G["factor -> atom"]), + (43, G["else"]): ("REDUCE", G["factor -> atom"]), + (43, G["of"]): ("REDUCE", G["factor -> atom"]), (43, G["error"]): ("REDUCE", G["factor -> atom"]), + (43, G["-"]): ("REDUCE", G["factor -> atom"]), (43, G["@"]): ("SHIFT", 57), - (43, G["."]): ("SHIFT", 44), (44, G["id"]): ("SHIFT", 45), (45, G["("]): ("SHIFT", 46), + (46, G["if"]): ("SHIFT", 12), + (46, G["true"]): ("SHIFT", 25), (46, G["case"]): ("SHIFT", 21), - (46, G["id"]): ("SHIFT", 31), - (46, G["~"]): ("SHIFT", 27), - (46, G["{"]): ("SHIFT", 10), - (46, G[")"]): ("REDUCE", G["expr-list -> e"]), - (46, G["isvoid"]): ("SHIFT", 24), - (46, G["while"]): ("SHIFT", 13), - (46, G["int"]): ("SHIFT", 34), - (46, G["new"]): ("SHIFT", 22), - (46, G["not"]): ("SHIFT", 30), (46, G["("]): ("SHIFT", 11), - (46, G["string"]): ("SHIFT", 33), - (46, G["if"]): ("SHIFT", 12), (46, G["false"]): ("SHIFT", 26), - (46, G["true"]): ("SHIFT", 25), + (46, G["string"]): ("SHIFT", 33), + (46, G["int"]): ("SHIFT", 34), + (46, G["~"]): ("SHIFT", 27), + (46, G["new"]): ("SHIFT", 22), (46, G["let"]): ("SHIFT", 14), + (46, G["while"]): ("SHIFT", 13), + (46, G["not"]): ("SHIFT", 30), + (46, G["id"]): ("SHIFT", 31), + (46, G["isvoid"]): ("SHIFT", 24), + (46, G[")"]): ("REDUCE", G["expr-list -> e"]), + (46, G["{"]): ("SHIFT", 10), (47, G[")"]): ("SHIFT", 48), + (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), @@ -520,40 +531,37 @@ def __action_table(): (48, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (49, G[")"]): ("REDUCE", G["expr-list -> not-empty-expr-list"]), (50, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), (50, G[","]): ("SHIFT", 51), + (51, G["if"]): ("SHIFT", 12), + (51, G["true"]): ("SHIFT", 25), (51, G["case"]): ("SHIFT", 21), - (51, G["id"]): ("SHIFT", 31), - (51, G["~"]): ("SHIFT", 27), - (51, G["{"]): ("SHIFT", 10), - (51, G["isvoid"]): ("SHIFT", 24), - (51, G["while"]): ("SHIFT", 13), - (51, G["int"]): ("SHIFT", 34), - (51, G["new"]): ("SHIFT", 22), - (51, G["not"]): ("SHIFT", 30), (51, G["("]): ("SHIFT", 11), - (51, G["string"]): ("SHIFT", 33), - (51, G["if"]): ("SHIFT", 12), (51, G["false"]): ("SHIFT", 26), - (51, G["true"]): ("SHIFT", 25), + (51, G["string"]): ("SHIFT", 33), + (51, G["int"]): ("SHIFT", 34), + (51, G["~"]): ("SHIFT", 27), + (51, G["new"]): ("SHIFT", 22), (51, G["let"]): ("SHIFT", 14), + (51, G["while"]): ("SHIFT", 13), + (51, G["not"]): ("SHIFT", 30), + (51, G["id"]): ("SHIFT", 31), + (51, G["isvoid"]): ("SHIFT", 24), + (51, G["{"]): ("SHIFT", 10), (52, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr , not-empty-expr-list"]), (53, G["*"]): ("SHIFT", 41), (53, G["/"]): ("SHIFT", 54), + (53, G["}"]): ("REDUCE", G["arith -> term"]), + (53, G["loop"]): ("REDUCE", G["arith -> term"]), + (53, G["<"]): ("REDUCE", G["arith -> term"]), + (53, G["pool"]): ("REDUCE", G["arith -> term"]), + (53, G["<="]): ("REDUCE", G["arith -> term"]), + (53, G[")"]): ("REDUCE", G["arith -> term"]), + (53, G["="]): ("REDUCE", G["arith -> term"]), + (53, G["fi"]): ("REDUCE", G["arith -> term"]), (53, G["in"]): ("REDUCE", G["arith -> term"]), (53, G[","]): ("REDUCE", G["arith -> term"]), (53, G["then"]): ("REDUCE", G["arith -> term"]), @@ -561,25 +569,27 @@ def __action_table(): (53, G["+"]): ("REDUCE", G["arith -> term"]), (53, G["of"]): ("REDUCE", G["arith -> term"]), (53, G["else"]): ("REDUCE", G["arith -> term"]), - (53, G["="]): ("REDUCE", G["arith -> term"]), - (53, G["fi"]): ("REDUCE", G["arith -> term"]), - (53, G["-"]): ("REDUCE", G["arith -> term"]), - (53, G["}"]): ("REDUCE", G["arith -> term"]), - (53, G["<"]): ("REDUCE", G["arith -> term"]), - (53, G["loop"]): ("REDUCE", G["arith -> term"]), - (53, G["<="]): ("REDUCE", G["arith -> term"]), - (53, G[")"]): ("REDUCE", G["arith -> term"]), - (53, G["pool"]): ("REDUCE", G["arith -> term"]), (53, G["error"]): ("REDUCE", G["arith -> term"]), - (54, G["false"]): ("SHIFT", 26), - (54, G["("]): ("SHIFT", 11), + (53, G["-"]): ("REDUCE", G["arith -> term"]), + (54, G["true"]): ("SHIFT", 25), + (54, G["int"]): ("SHIFT", 34), (54, G["id"]): ("SHIFT", 28), + (54, G["~"]): ("SHIFT", 27), (54, G["string"]): ("SHIFT", 33), + (54, G["false"]): ("SHIFT", 26), + (54, G["("]): ("SHIFT", 11), (54, G["new"]): ("SHIFT", 22), - (54, G["int"]): ("SHIFT", 34), (54, G["isvoid"]): ("SHIFT", 24), - (54, G["true"]): ("SHIFT", 25), - (54, G["~"]): ("SHIFT", 27), + (55, G["*"]): ("REDUCE", G["term -> term / factor"]), + (55, G["}"]): ("REDUCE", G["term -> term / factor"]), + (55, G["/"]): ("REDUCE", G["term -> term / factor"]), + (55, G["loop"]): ("REDUCE", G["term -> term / factor"]), + (55, G["<"]): ("REDUCE", G["term -> term / factor"]), + (55, G["pool"]): ("REDUCE", G["term -> term / factor"]), + (55, G["<="]): ("REDUCE", G["term -> term / factor"]), + (55, G[")"]): ("REDUCE", G["term -> term / factor"]), + (55, G["="]): ("REDUCE", G["term -> term / factor"]), + (55, G["fi"]): ("REDUCE", G["term -> term / factor"]), (55, G["in"]): ("REDUCE", G["term -> term / factor"]), (55, G[","]): ("REDUCE", G["term -> term / factor"]), (55, G["then"]): ("REDUCE", G["term -> term / factor"]), @@ -587,88 +597,87 @@ def __action_table(): (55, G["+"]): ("REDUCE", G["term -> term / factor"]), (55, G["else"]): ("REDUCE", G["term -> term / factor"]), (55, G["of"]): ("REDUCE", G["term -> term / factor"]), - (55, G["="]): ("REDUCE", G["term -> term / factor"]), - (55, G["fi"]): ("REDUCE", G["term -> term / factor"]), - (55, G["-"]): ("REDUCE", G["term -> term / factor"]), - (55, G["*"]): ("REDUCE", G["term -> term / factor"]), - (55, G["}"]): ("REDUCE", G["term -> term / factor"]), - (55, G["/"]): ("REDUCE", G["term -> term / factor"]), - (55, G["<"]): ("REDUCE", G["term -> term / factor"]), - (55, G["loop"]): ("REDUCE", G["term -> term / factor"]), - (55, G["<="]): ("REDUCE", G["term -> term / factor"]), - (55, G["pool"]): ("REDUCE", G["term -> term / factor"]), - (55, G[")"]): ("REDUCE", G["term -> term / factor"]), (55, G["error"]): ("REDUCE", G["term -> term / factor"]), - (56, G["in"]): ("REDUCE", G["term -> factor"]), - (56, G[","]): ("REDUCE", G["term -> factor"]), - (56, G["then"]): ("REDUCE", G["term -> factor"]), - (56, G[";"]): ("REDUCE", G["term -> factor"]), - (56, G["+"]): ("REDUCE", G["term -> factor"]), - (56, G["else"]): ("REDUCE", G["term -> factor"]), - (56, G["of"]): ("REDUCE", G["term -> factor"]), - (56, G["="]): ("REDUCE", G["term -> factor"]), - (56, G["fi"]): ("REDUCE", G["term -> factor"]), - (56, G["-"]): ("REDUCE", G["term -> factor"]), + (55, G["-"]): ("REDUCE", G["term -> term / factor"]), (56, G["*"]): ("REDUCE", G["term -> factor"]), (56, G["}"]): ("REDUCE", G["term -> factor"]), (56, G["/"]): ("REDUCE", G["term -> factor"]), - (56, G["<"]): ("REDUCE", G["term -> factor"]), (56, G["loop"]): ("REDUCE", G["term -> factor"]), + (56, G["<"]): ("REDUCE", G["term -> factor"]), (56, G["<="]): ("REDUCE", G["term -> factor"]), (56, G["pool"]): ("REDUCE", G["term -> factor"]), (56, G[")"]): ("REDUCE", G["term -> factor"]), + (56, G["="]): ("REDUCE", G["term -> factor"]), + (56, G["fi"]): ("REDUCE", G["term -> factor"]), + (56, G["in"]): ("REDUCE", G["term -> factor"]), + (56, G[","]): ("REDUCE", G["term -> factor"]), + (56, G["then"]): ("REDUCE", G["term -> factor"]), + (56, G[";"]): ("REDUCE", G["term -> factor"]), + (56, G["+"]): ("REDUCE", G["term -> factor"]), + (56, G["else"]): ("REDUCE", G["term -> factor"]), + (56, G["of"]): ("REDUCE", G["term -> factor"]), (56, G["error"]): ("REDUCE", G["term -> factor"]), + (56, G["-"]): ("REDUCE", G["term -> factor"]), (57, G["type"]): ("SHIFT", 58), (58, G["."]): ("SHIFT", 59), (59, G["id"]): ("SHIFT", 60), (60, G["("]): ("SHIFT", 61), + (61, G["if"]): ("SHIFT", 12), + (61, G["true"]): ("SHIFT", 25), (61, G["case"]): ("SHIFT", 21), - (61, G["id"]): ("SHIFT", 31), - (61, G["~"]): ("SHIFT", 27), - (61, G["{"]): ("SHIFT", 10), - (61, G[")"]): ("REDUCE", G["expr-list -> e"]), - (61, G["isvoid"]): ("SHIFT", 24), - (61, G["while"]): ("SHIFT", 13), - (61, G["int"]): ("SHIFT", 34), - (61, G["new"]): ("SHIFT", 22), - (61, G["not"]): ("SHIFT", 30), (61, G["("]): ("SHIFT", 11), - (61, G["string"]): ("SHIFT", 33), - (61, G["if"]): ("SHIFT", 12), (61, G["false"]): ("SHIFT", 26), - (61, G["true"]): ("SHIFT", 25), + (61, G["string"]): ("SHIFT", 33), + (61, G["int"]): ("SHIFT", 34), + (61, G["~"]): ("SHIFT", 27), + (61, G["new"]): ("SHIFT", 22), (61, G["let"]): ("SHIFT", 14), + (61, G["while"]): ("SHIFT", 13), + (61, G["not"]): ("SHIFT", 30), + (61, G["id"]): ("SHIFT", 31), + (61, G["isvoid"]): ("SHIFT", 24), + (61, G[")"]): ("REDUCE", G["expr-list -> e"]), + (61, G["{"]): ("SHIFT", 10), (62, G[")"]): ("SHIFT", 63), - (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (64, G["false"]): ("SHIFT", 26), - (64, G["new"]): ("SHIFT", 22), - (64, G["string"]): ("SHIFT", 33), - (64, G["int"]): ("SHIFT", 34), + (63, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (64, G["true"]): ("SHIFT", 25), + (64, G["~"]): ("SHIFT", 27), (64, G["id"]): ("SHIFT", 28), + (64, G["new"]): ("SHIFT", 22), (64, G["isvoid"]): ("SHIFT", 24), - (64, G["~"]): ("SHIFT", 27), + (64, G["int"]): ("SHIFT", 34), + (64, G["string"]): ("SHIFT", 33), (64, G["("]): ("SHIFT", 11), - (64, G["true"]): ("SHIFT", 25), + (64, G["false"]): ("SHIFT", 26), + (65, G["*"]): ("SHIFT", 41), + (65, G["}"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["loop"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["<"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["pool"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["<="]): ("REDUCE", G["arith -> arith - term"]), + (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["="]): ("REDUCE", G["arith -> arith - term"]), + (65, G["fi"]): ("REDUCE", G["arith -> arith - term"]), (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), (65, G[","]): ("REDUCE", G["arith -> arith - term"]), (65, G["then"]): ("REDUCE", G["arith -> arith - term"]), @@ -676,111 +685,91 @@ def __action_table(): (65, G["+"]): ("REDUCE", G["arith -> arith - term"]), (65, G["of"]): ("REDUCE", G["arith -> arith - term"]), (65, G["else"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["="]): ("REDUCE", G["arith -> arith - term"]), - (65, G["fi"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["-"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["}"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["<"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["loop"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["<="]): ("REDUCE", G["arith -> arith - term"]), - (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["pool"]): ("REDUCE", G["arith -> arith - term"]), (65, G["error"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["*"]): ("SHIFT", 41), + (65, G["-"]): ("REDUCE", G["arith -> arith - term"]), (65, G["/"]): ("SHIFT", 54), - (66, G["isvoid"]): ("SHIFT", 24), - (66, G["~"]): ("SHIFT", 27), + (66, G["("]): ("SHIFT", 11), (66, G["false"]): ("SHIFT", 26), (66, G["true"]): ("SHIFT", 25), (66, G["id"]): ("SHIFT", 28), (66, G["int"]): ("SHIFT", 34), + (66, G["~"]): ("SHIFT", 27), (66, G["string"]): ("SHIFT", 33), (66, G["new"]): ("SHIFT", 22), - (66, G["("]): ("SHIFT", 11), + (66, G["isvoid"]): ("SHIFT", 24), (67, G["-"]): ("SHIFT", 64), + (67, G["+"]): ("SHIFT", 39), + (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["in"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["}"]): ("REDUCE", G["comp -> arith < arith"]), (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["else"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["+"]): ("SHIFT", 39), - (68, G["isvoid"]): ("SHIFT", 24), - (68, G["~"]): ("SHIFT", 27), + (68, G["("]): ("SHIFT", 11), (68, G["false"]): ("SHIFT", 26), (68, G["true"]): ("SHIFT", 25), (68, G["id"]): ("SHIFT", 28), (68, G["int"]): ("SHIFT", 34), + (68, G["~"]): ("SHIFT", 27), (68, G["string"]): ("SHIFT", 33), (68, G["new"]): ("SHIFT", 22), - (68, G["("]): ("SHIFT", 11), + (68, G["isvoid"]): ("SHIFT", 24), (69, G["-"]): ("SHIFT", 64), + (69, G["+"]): ("SHIFT", 39), + (69, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["+"]): ("SHIFT", 39), - (70, G["isvoid"]): ("SHIFT", 24), - (70, G["~"]): ("SHIFT", 27), + (70, G["("]): ("SHIFT", 11), (70, G["false"]): ("SHIFT", 26), (70, G["true"]): ("SHIFT", 25), (70, G["id"]): ("SHIFT", 28), (70, G["int"]): ("SHIFT", 34), + (70, G["~"]): ("SHIFT", 27), (70, G["string"]): ("SHIFT", 33), (70, G["new"]): ("SHIFT", 22), - (70, G["("]): ("SHIFT", 11), - (71, G["-"]): ("SHIFT", 64), - (71, G["+"]): ("SHIFT", 39), + (70, G["isvoid"]): ("SHIFT", 24), + (71, G["error"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["in"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["}"]): ("REDUCE", G["comp -> arith = arith"]), (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), (71, G[";"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["else"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["error"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), - (72, G["}"]): ("REDUCE", G["expr -> not expr"]), + (71, G["-"]): ("SHIFT", 64), + (71, G["+"]): ("SHIFT", 39), (72, G["in"]): ("REDUCE", G["expr -> not expr"]), + (72, G["}"]): ("REDUCE", G["expr -> not expr"]), (72, G[","]): ("REDUCE", G["expr -> not expr"]), + (72, G[")"]): ("REDUCE", G["expr -> not expr"]), (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), (72, G["then"]): ("REDUCE", G["expr -> not expr"]), (72, G[";"]): ("REDUCE", G["expr -> not expr"]), - (72, G[")"]): ("REDUCE", G["expr -> not expr"]), (72, G["of"]): ("REDUCE", G["expr -> not expr"]), (72, G["pool"]): ("REDUCE", G["expr -> not expr"]), (72, G["else"]): ("REDUCE", G["expr -> not expr"]), (72, G["error"]): ("REDUCE", G["expr -> not expr"]), (72, G["fi"]): ("REDUCE", G["expr -> not expr"]), (73, G[")"]): ("SHIFT", 74), - (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), @@ -789,244 +778,255 @@ def __action_table(): (74, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G[","]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["then"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G[";"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["+"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["else"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["of"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["="]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["-"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), + (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (75, G["*"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["}"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["/"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["<"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["<"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["<="]): ("REDUCE", G["factor -> ~ factor"]), (75, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), (75, G[")"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["="]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G[","]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["then"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["-"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G[";"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["+"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["else"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["of"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), - (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), + (75, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), (77, G["of"]): ("SHIFT", 78), (78, G["id"]): ("SHIFT", 79), (79, G[":"]): ("SHIFT", 80), (80, G["type"]): ("SHIFT", 81), (81, G["=>"]): ("SHIFT", 82), - (82, G["("]): ("SHIFT", 11), - (82, G["if"]): ("SHIFT", 12), - (82, G["isvoid"]): ("SHIFT", 24), (82, G["true"]): ("SHIFT", 25), + (82, G["case"]): ("SHIFT", 21), (82, G["false"]): ("SHIFT", 26), - (82, G["string"]): ("SHIFT", 33), - (82, G["int"]): ("SHIFT", 34), - (82, G["not"]): ("SHIFT", 30), (82, G["id"]): ("SHIFT", 31), - (82, G["~"]): ("SHIFT", 27), - (82, G["while"]): ("SHIFT", 13), + (82, G["int"]): ("SHIFT", 34), (82, G["{"]): ("SHIFT", 10), - (82, G["case"]): ("SHIFT", 21), (82, G["new"]): ("SHIFT", 22), (82, G["let"]): ("SHIFT", 14), + (82, G["if"]): ("SHIFT", 12), + (82, G["("]): ("SHIFT", 11), + (82, G["isvoid"]): ("SHIFT", 24), + (82, G["string"]): ("SHIFT", 33), + (82, G["~"]): ("SHIFT", 27), + (82, G["while"]): ("SHIFT", 13), + (82, G["not"]): ("SHIFT", 30), (83, G[";"]): ("SHIFT", 84), (83, G["error"]): ("SHIFT", 86), - (84, G["id"]): ("SHIFT", 79), (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), + (84, G["id"]): ("SHIFT", 79), (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), (86, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), (87, G["esac"]): ("SHIFT", 88), + (88, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (88, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (88, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), (89, G[","]): ("SHIFT", 90), + (89, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), (90, G["id"]): ("SHIFT", 15), (91, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), (92, G["in"]): ("SHIFT", 93), (93, G["let"]): ("SHIFT", 14), - (93, G["new"]): ("SHIFT", 22), - (93, G["int"]): ("SHIFT", 34), - (93, G["~"]): ("SHIFT", 27), - (93, G["{"]): ("SHIFT", 10), (93, G["while"]): ("SHIFT", 13), - (93, G["true"]): ("SHIFT", 25), - (93, G["false"]): ("SHIFT", 26), (93, G["not"]): ("SHIFT", 30), - (93, G["string"]): ("SHIFT", 33), + (93, G["~"]): ("SHIFT", 27), (93, G["id"]): ("SHIFT", 31), + (93, G["string"]): ("SHIFT", 33), (93, G["if"]): ("SHIFT", 12), + (93, G["false"]): ("SHIFT", 26), + (93, G["true"]): ("SHIFT", 25), + (93, G["{"]): ("SHIFT", 10), + (93, G["new"]): ("SHIFT", 22), (93, G["isvoid"]): ("SHIFT", 24), - (93, G["("]): ("SHIFT", 11), + (93, G["int"]): ("SHIFT", 34), (93, G["case"]): ("SHIFT", 21), + (93, G["("]): ("SHIFT", 11), (94, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (94, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["loop"]): ("SHIFT", 96), - (96, G["id"]): ("SHIFT", 31), - (96, G["~"]): ("SHIFT", 27), (96, G["if"]): ("SHIFT", 12), - (96, G["new"]): ("SHIFT", 22), - (96, G["let"]): ("SHIFT", 14), - (96, G["("]): ("SHIFT", 11), - (96, G["case"]): ("SHIFT", 21), - (96, G["{"]): ("SHIFT", 10), - (96, G["while"]): ("SHIFT", 13), (96, G["true"]): ("SHIFT", 25), - (96, G["isvoid"]): ("SHIFT", 24), + (96, G["("]): ("SHIFT", 11), (96, G["false"]): ("SHIFT", 26), + (96, G["case"]): ("SHIFT", 21), + (96, G["new"]): ("SHIFT", 22), + (96, G["id"]): ("SHIFT", 31), + (96, G["let"]): ("SHIFT", 14), (96, G["string"]): ("SHIFT", 33), - (96, G["int"]): ("SHIFT", 34), (96, G["not"]): ("SHIFT", 30), + (96, G["while"]): ("SHIFT", 13), + (96, G["int"]): ("SHIFT", 34), + (96, G["~"]): ("SHIFT", 27), + (96, G["isvoid"]): ("SHIFT", 24), + (96, G["{"]): ("SHIFT", 10), (97, G["pool"]): ("SHIFT", 98), + (98, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (98, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (98, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["then"]): ("SHIFT", 100), + (100, G["id"]): ("SHIFT", 31), + (100, G["isvoid"]): ("SHIFT", 24), + (100, G["case"]): ("SHIFT", 21), + (100, G["if"]): ("SHIFT", 12), + (100, G["{"]): ("SHIFT", 10), + (100, G["let"]): ("SHIFT", 14), (100, G["new"]): ("SHIFT", 22), - (100, G["while"]): ("SHIFT", 13), - (100, G["int"]): ("SHIFT", 34), + (100, G["string"]): ("SHIFT", 33), (100, G["~"]): ("SHIFT", 27), - (100, G["{"]): ("SHIFT", 10), + (100, G["int"]): ("SHIFT", 34), (100, G["true"]): ("SHIFT", 25), - (100, G["let"]): ("SHIFT", 14), (100, G["false"]): ("SHIFT", 26), - (100, G["case"]): ("SHIFT", 21), - (100, G["string"]): ("SHIFT", 33), - (100, G["id"]): ("SHIFT", 31), - (100, G["isvoid"]): ("SHIFT", 24), (100, G["("]): ("SHIFT", 11), - (100, G["if"]): ("SHIFT", 12), + (100, G["while"]): ("SHIFT", 13), (100, G["not"]): ("SHIFT", 30), (101, G["else"]): ("SHIFT", 102), (102, G["id"]): ("SHIFT", 31), - (102, G["isvoid"]): ("SHIFT", 24), + (102, G["not"]): ("SHIFT", 30), (102, G["while"]): ("SHIFT", 13), (102, G["string"]): ("SHIFT", 33), + (102, G["~"]): ("SHIFT", 27), + (102, G["case"]): ("SHIFT", 21), (102, G["int"]): ("SHIFT", 34), + (102, G["if"]): ("SHIFT", 12), + (102, G["new"]): ("SHIFT", 22), + (102, G["{"]): ("SHIFT", 10), (102, G["let"]): ("SHIFT", 14), - (102, G["not"]): ("SHIFT", 30), (102, G["true"]): ("SHIFT", 25), + (102, G["isvoid"]): ("SHIFT", 24), (102, G["false"]): ("SHIFT", 26), - (102, G["case"]): ("SHIFT", 21), - (102, G["~"]): ("SHIFT", 27), - (102, G["{"]): ("SHIFT", 10), - (102, G["if"]): ("SHIFT", 12), (102, G["("]): ("SHIFT", 11), - (102, G["new"]): ("SHIFT", 22), (103, G["fi"]): ("SHIFT", 104), + (104, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (104, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (104, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G[")"]): ("SHIFT", 106), + (106, G["*"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["}"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["/"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["<"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["<="]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G[")"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["="]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["."]): ("REDUCE", G["atom -> ( expr )"]), (106, G["in"]): ("REDUCE", G["atom -> ( expr )"]), (106, G[","]): ("REDUCE", G["atom -> ( expr )"]), (106, G["then"]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["-"]): ("REDUCE", G["atom -> ( expr )"]), (106, G[";"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["@"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["+"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["else"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["of"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["="]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["-"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["*"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["}"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["/"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["<"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["<="]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G[")"]): ("REDUCE", G["atom -> ( expr )"]), (106, G["error"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["."]): ("REDUCE", G["atom -> ( expr )"]), + (106, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["}"]): ("SHIFT", 108), + (108, G["error"]): ("REDUCE", G["expr -> { block }"]), (108, G["in"]): ("REDUCE", G["expr -> { block }"]), (108, G["}"]): ("REDUCE", G["expr -> { block }"]), (108, G[","]): ("REDUCE", G["expr -> { block }"]), - (108, G["then"]): ("REDUCE", G["expr -> { block }"]), (108, G["loop"]): ("REDUCE", G["expr -> { block }"]), + (108, G["then"]): ("REDUCE", G["expr -> { block }"]), (108, G[";"]): ("REDUCE", G["expr -> { block }"]), - (108, G[")"]): ("REDUCE", G["expr -> { block }"]), (108, G["of"]): ("REDUCE", G["expr -> { block }"]), (108, G["pool"]): ("REDUCE", G["expr -> { block }"]), (108, G["else"]): ("REDUCE", G["expr -> { block }"]), - (108, G["error"]): ("REDUCE", G["expr -> { block }"]), + (108, G[")"]): ("REDUCE", G["expr -> { block }"]), (108, G["fi"]): ("REDUCE", G["expr -> { block }"]), (109, G[";"]): ("SHIFT", 110), (109, G["error"]): ("SHIFT", 112), - (110, G["("]): ("SHIFT", 11), - (110, G["if"]): ("SHIFT", 12), - (110, G["}"]): ("REDUCE", G["block -> expr ;"]), - (110, G["isvoid"]): ("SHIFT", 24), (110, G["true"]): ("SHIFT", 25), + (110, G["case"]): ("SHIFT", 21), (110, G["false"]): ("SHIFT", 26), - (110, G["string"]): ("SHIFT", 33), - (110, G["int"]): ("SHIFT", 34), - (110, G["not"]): ("SHIFT", 30), (110, G["id"]): ("SHIFT", 31), - (110, G["~"]): ("SHIFT", 27), - (110, G["while"]): ("SHIFT", 13), + (110, G["int"]): ("SHIFT", 34), (110, G["{"]): ("SHIFT", 10), - (110, G["case"]): ("SHIFT", 21), (110, G["new"]): ("SHIFT", 22), (110, G["let"]): ("SHIFT", 14), + (110, G["if"]): ("SHIFT", 12), + (110, G["("]): ("SHIFT", 11), + (110, G["isvoid"]): ("SHIFT", 24), + (110, G["string"]): ("SHIFT", 33), + (110, G["~"]): ("SHIFT", 27), + (110, G["}"]): ("REDUCE", G["block -> expr ;"]), + (110, G["while"]): ("SHIFT", 13), + (110, G["not"]): ("SHIFT", 30), (111, G["}"]): ("REDUCE", G["block -> expr ; block"]), (112, G["}"]): ("REDUCE", G["block -> expr error"]), (113, G["}"]): ("SHIFT", 114), @@ -1034,58 +1034,58 @@ def __action_table(): (114, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), (115, G[":"]): ("SHIFT", 116), (116, G["type"]): ("SHIFT", 117), - (117, G[")"]): ("REDUCE", G["param-list -> id : type"]), (117, G[","]): ("SHIFT", 118), + (117, G[")"]): ("REDUCE", G["param-list -> id : type"]), (118, G["id"]): ("SHIFT", 115), (119, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), (120, G[")"]): ("SHIFT", 121), (121, G[":"]): ("SHIFT", 122), (122, G["type"]): ("SHIFT", 123), (123, G["{"]): ("SHIFT", 124), - (124, G["true"]): ("SHIFT", 25), (124, G["case"]): ("SHIFT", 21), - (124, G["id"]): ("SHIFT", 31), - (124, G["let"]): ("SHIFT", 14), - (124, G["string"]): ("SHIFT", 33), (124, G["("]): ("SHIFT", 11), - (124, G["not"]): ("SHIFT", 30), + (124, G["string"]): ("SHIFT", 33), (124, G["~"]): ("SHIFT", 27), + (124, G["id"]): ("SHIFT", 31), + (124, G["not"]): ("SHIFT", 30), (124, G["while"]): ("SHIFT", 13), - (124, G["int"]): ("SHIFT", 34), - (124, G["new"]): ("SHIFT", 22), + (124, G["true"]): ("SHIFT", 25), (124, G["isvoid"]): ("SHIFT", 24), (124, G["if"]): ("SHIFT", 12), (124, G["false"]): ("SHIFT", 26), + (124, G["let"]): ("SHIFT", 14), (124, G["{"]): ("SHIFT", 10), + (124, G["int"]): ("SHIFT", 34), + (124, G["new"]): ("SHIFT", 22), (125, G["}"]): ("SHIFT", 126), (126, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (126, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (127, G["type"]): ("SHIFT", 128), (128, G["<-"]): ("SHIFT", 129), - (128, G[";"]): ("REDUCE", G["attribute -> id : type"]), (128, G["error"]): ("REDUCE", G["attribute -> id : type"]), - (129, G["("]): ("SHIFT", 11), - (129, G["if"]): ("SHIFT", 12), - (129, G["isvoid"]): ("SHIFT", 24), + (128, G[";"]): ("REDUCE", G["attribute -> id : type"]), (129, G["true"]): ("SHIFT", 25), + (129, G["case"]): ("SHIFT", 21), (129, G["false"]): ("SHIFT", 26), - (129, G["string"]): ("SHIFT", 33), - (129, G["int"]): ("SHIFT", 34), - (129, G["not"]): ("SHIFT", 30), (129, G["id"]): ("SHIFT", 31), - (129, G["~"]): ("SHIFT", 27), - (129, G["while"]): ("SHIFT", 13), + (129, G["int"]): ("SHIFT", 34), (129, G["{"]): ("SHIFT", 10), - (129, G["case"]): ("SHIFT", 21), (129, G["new"]): ("SHIFT", 22), (129, G["let"]): ("SHIFT", 14), - (130, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (129, G["if"]): ("SHIFT", 12), + (129, G["("]): ("SHIFT", 11), + (129, G["isvoid"]): ("SHIFT", 24), + (129, G["string"]): ("SHIFT", 33), + (129, G["~"]): ("SHIFT", 27), + (129, G["while"]): ("SHIFT", 13), + (129, G["not"]): ("SHIFT", 30), (130, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (130, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), (131, G["}"]): ("SHIFT", 132), (132, G["class"]): ("REDUCE", G["class-def -> class type { feature-list }"]), (132, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), - (133, G[";"]): ("SHIFT", 134), (133, G["error"]): ("SHIFT", 141), + (133, G[";"]): ("SHIFT", 134), (134, G["id"]): ("SHIFT", 4), (134, G["}"]): ("REDUCE", G["feature-list -> e"]), (135, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), @@ -1109,233 +1109,233 @@ def __action_table(): (147, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), (148, G["$"]): ("OK", None), (149, G["$"]): ("REDUCE", G["program -> class-list"]), - (150, G["$"]): ("REDUCE", G["class-list -> class-def"]), (150, G["class"]): ("SHIFT", 1), + (150, G["$"]): ("REDUCE", G["class-list -> class-def"]), (151, G["$"]): ("REDUCE", G["class-list -> class-def class-list"]), } @staticmethod def __goto_table(): return { - (0, G["class-def"]): 150, (0, G["class-list"]): 149, + (0, G["class-def"]): 150, (0, G["program"]): 148, - (3, G["feature-list"]): 131, - (3, G["method"]): 136, (3, G["attribute"]): 133, + (3, G["method"]): 136, + (3, G["feature-list"]): 131, (5, G["param-list"]): 120, - (9, G["factor"]): 56, - (9, G["atom"]): 43, (9, G["arith"]): 38, - (9, G["term"]): 53, (9, G["expr"]): 113, + (9, G["term"]): 53, (9, G["comp"]): 37, (9, G["function-call"]): 35, - (10, G["block"]): 107, + (9, G["atom"]): 43, + (9, G["factor"]): 56, + (10, G["atom"]): 43, (10, G["arith"]): 38, (10, G["expr"]): 109, - (10, G["comp"]): 37, - (10, G["atom"]): 43, (10, G["term"]): 53, - (10, G["function-call"]): 35, (10, G["factor"]): 56, + (10, G["block"]): 107, + (10, G["comp"]): 37, + (10, G["function-call"]): 35, (11, G["atom"]): 43, - (11, G["factor"]): 56, (11, G["arith"]): 38, + (11, G["function-call"]): 35, (11, G["term"]): 53, - (11, G["comp"]): 37, + (11, G["factor"]): 56, (11, G["expr"]): 105, - (11, G["function-call"]): 35, - (12, G["arith"]): 38, + (11, G["comp"]): 37, (12, G["term"]): 53, - (12, G["atom"]): 43, - (12, G["function-call"]): 35, + (12, G["arith"]): 38, (12, G["expr"]): 99, - (12, G["comp"]): 37, + (12, G["atom"]): 43, (12, G["factor"]): 56, - (13, G["expr"]): 95, - (13, G["atom"]): 43, + (12, G["comp"]): 37, + (12, G["function-call"]): 35, (13, G["arith"]): 38, - (13, G["comp"]): 37, (13, G["factor"]): 56, (13, G["term"]): 53, + (13, G["atom"]): 43, (13, G["function-call"]): 35, + (13, G["comp"]): 37, + (13, G["expr"]): 95, (14, G["declaration-list"]): 92, (18, G["declaration-list"]): 19, - (20, G["atom"]): 43, - (20, G["term"]): 53, (20, G["arith"]): 38, - (20, G["expr"]): 89, (20, G["comp"]): 37, + (20, G["expr"]): 89, + (20, G["term"]): 53, (20, G["function-call"]): 35, + (20, G["atom"]): 43, (20, G["factor"]): 56, (21, G["term"]): 53, (21, G["arith"]): 38, - (21, G["factor"]): 56, - (21, G["comp"]): 37, (21, G["atom"]): 43, (21, G["expr"]): 77, + (21, G["comp"]): 37, (21, G["function-call"]): 35, + (21, G["factor"]): 56, (24, G["atom"]): 43, (24, G["factor"]): 76, (24, G["function-call"]): 35, (27, G["atom"]): 43, - (27, G["factor"]): 75, (27, G["function-call"]): 35, - (29, G["not-empty-expr-list"]): 49, - (29, G["term"]): 53, + (27, G["factor"]): 75, + (29, G["function-call"]): 35, + (29, G["expr"]): 50, + (29, G["atom"]): 43, (29, G["arith"]): 38, - (29, G["factor"]): 56, + (29, G["term"]): 53, (29, G["comp"]): 37, - (29, G["atom"]): 43, - (29, G["expr"]): 50, + (29, G["factor"]): 56, + (29, G["not-empty-expr-list"]): 49, (29, G["expr-list"]): 73, - (29, G["function-call"]): 35, + (30, G["factor"]): 56, + (30, G["atom"]): 43, (30, G["arith"]): 38, - (30, G["term"]): 53, - (30, G["expr"]): 72, (30, G["function-call"]): 35, + (30, G["term"]): 53, (30, G["comp"]): 37, - (30, G["atom"]): 43, - (30, G["factor"]): 56, + (30, G["expr"]): 72, + (32, G["factor"]): 56, + (32, G["atom"]): 43, + (32, G["expr"]): 36, (32, G["arith"]): 38, - (32, G["term"]): 53, (32, G["function-call"]): 35, + (32, G["term"]): 53, (32, G["comp"]): 37, - (32, G["atom"]): 43, - (32, G["expr"]): 36, - (32, G["factor"]): 56, (39, G["atom"]): 43, (39, G["term"]): 40, - (39, G["function-call"]): 35, (39, G["factor"]): 56, + (39, G["function-call"]): 35, (41, G["atom"]): 43, - (41, G["factor"]): 42, (41, G["function-call"]): 35, - (46, G["not-empty-expr-list"]): 49, - (46, G["term"]): 53, - (46, G["arith"]): 38, - (46, G["factor"]): 56, + (41, G["factor"]): 42, (46, G["expr-list"]): 47, - (46, G["comp"]): 37, - (46, G["atom"]): 43, - (46, G["expr"]): 50, (46, G["function-call"]): 35, - (51, G["not-empty-expr-list"]): 52, - (51, G["term"]): 53, + (46, G["expr"]): 50, + (46, G["atom"]): 43, + (46, G["arith"]): 38, + (46, G["term"]): 53, + (46, G["comp"]): 37, + (46, G["factor"]): 56, + (46, G["not-empty-expr-list"]): 49, + (51, G["function-call"]): 35, + (51, G["expr"]): 50, + (51, G["atom"]): 43, (51, G["arith"]): 38, - (51, G["factor"]): 56, + (51, G["term"]): 53, (51, G["comp"]): 37, - (51, G["atom"]): 43, - (51, G["expr"]): 50, - (51, G["function-call"]): 35, + (51, G["factor"]): 56, + (51, G["not-empty-expr-list"]): 52, (54, G["atom"]): 43, - (54, G["factor"]): 55, (54, G["function-call"]): 35, - (61, G["not-empty-expr-list"]): 49, - (61, G["term"]): 53, - (61, G["arith"]): 38, - (61, G["factor"]): 56, + (54, G["factor"]): 55, + (61, G["function-call"]): 35, + (61, G["expr"]): 50, (61, G["expr-list"]): 62, - (61, G["comp"]): 37, (61, G["atom"]): 43, - (61, G["expr"]): 50, - (61, G["function-call"]): 35, + (61, G["arith"]): 38, + (61, G["term"]): 53, + (61, G["comp"]): 37, + (61, G["factor"]): 56, + (61, G["not-empty-expr-list"]): 49, (64, G["atom"]): 43, (64, G["term"]): 65, - (64, G["function-call"]): 35, (64, G["factor"]): 56, + (64, G["function-call"]): 35, (66, G["arith"]): 67, + (66, G["term"]): 53, (66, G["function-call"]): 35, (66, G["atom"]): 43, - (66, G["term"]): 53, (66, G["factor"]): 56, + (68, G["arith"]): 69, + (68, G["term"]): 53, (68, G["function-call"]): 35, (68, G["atom"]): 43, - (68, G["term"]): 53, (68, G["factor"]): 56, - (68, G["arith"]): 69, + (70, G["arith"]): 71, + (70, G["term"]): 53, (70, G["function-call"]): 35, (70, G["atom"]): 43, - (70, G["term"]): 53, - (70, G["arith"]): 71, (70, G["factor"]): 56, (78, G["case-list"]): 87, - (82, G["expr"]): 83, - (82, G["arith"]): 38, - (82, G["comp"]): 37, (82, G["atom"]): 43, + (82, G["arith"]): 38, + (82, G["expr"]): 83, (82, G["term"]): 53, - (82, G["function-call"]): 35, (82, G["factor"]): 56, + (82, G["comp"]): 37, + (82, G["function-call"]): 35, (84, G["case-list"]): 85, (90, G["declaration-list"]): 91, - (93, G["arith"]): 38, - (93, G["term"]): 53, + (93, G["factor"]): 56, + (93, G["atom"]): 43, (93, G["expr"]): 94, + (93, G["arith"]): 38, (93, G["function-call"]): 35, + (93, G["term"]): 53, (93, G["comp"]): 37, - (93, G["atom"]): 43, - (93, G["factor"]): 56, (96, G["atom"]): 43, - (96, G["term"]): 53, (96, G["function-call"]): 35, (96, G["arith"]): 38, - (96, G["factor"]): 56, - (96, G["expr"]): 97, (96, G["comp"]): 37, - (100, G["comp"]): 37, - (100, G["term"]): 53, + (96, G["expr"]): 97, + (96, G["term"]): 53, + (96, G["factor"]): 56, (100, G["arith"]): 38, - (100, G["function-call"]): 35, - (100, G["factor"]): 56, + (100, G["term"]): 53, (100, G["atom"]): 43, + (100, G["factor"]): 56, + (100, G["comp"]): 37, (100, G["expr"]): 101, - (102, G["atom"]): 43, + (100, G["function-call"]): 35, (102, G["term"]): 53, (102, G["arith"]): 38, + (102, G["atom"]): 43, + (102, G["factor"]): 56, (102, G["function-call"]): 35, - (102, G["comp"]): 37, (102, G["expr"]): 103, - (102, G["factor"]): 56, + (102, G["comp"]): 37, + (110, G["atom"]): 43, (110, G["arith"]): 38, (110, G["expr"]): 109, - (110, G["comp"]): 37, - (110, G["atom"]): 43, (110, G["term"]): 53, - (110, G["function-call"]): 35, - (110, G["block"]): 111, (110, G["factor"]): 56, + (110, G["block"]): 111, + (110, G["comp"]): 37, + (110, G["function-call"]): 35, (118, G["param-list"]): 119, - (124, G["factor"]): 56, - (124, G["atom"]): 43, (124, G["arith"]): 38, (124, G["term"]): 53, (124, G["expr"]): 125, (124, G["comp"]): 37, (124, G["function-call"]): 35, + (124, G["atom"]): 43, + (124, G["factor"]): 56, + (129, G["atom"]): 43, (129, G["arith"]): 38, + (129, G["term"]): 53, + (129, G["factor"]): 56, (129, G["expr"]): 130, (129, G["comp"]): 37, - (129, G["atom"]): 43, - (129, G["term"]): 53, (129, G["function-call"]): 35, - (129, G["factor"]): 56, + (134, G["attribute"]): 133, (134, G["method"]): 136, (134, G["feature-list"]): 135, - (134, G["attribute"]): 133, - (137, G["feature-list"]): 138, - (137, G["method"]): 136, (137, G["attribute"]): 133, + (137, G["method"]): 136, + (137, G["feature-list"]): 138, (139, G["attribute"]): 133, - (139, G["method"]): 136, (139, G["feature-list"]): 140, + (139, G["method"]): 136, (141, G["attribute"]): 133, (141, G["method"]): 136, (141, G["feature-list"]): 142, + (145, G["feature-list"]): 146, (145, G["attribute"]): 133, (145, G["method"]): 136, - (145, G["feature-list"]): 146, (150, G["class-def"]): 150, (150, G["class-list"]): 151, } diff --git a/pyjapt/parsing.py b/pyjapt/parsing.py index 9e52af4d1..77e703779 100755 --- a/pyjapt/parsing.py +++ b/pyjapt/parsing.py @@ -1,7 +1,8 @@ import sys from pyjapt.automata import State -from pyjapt.grammar import Item, RuleList +from pyjapt.grammar import Item, RuleList, Symbol +from pyjapt.lexing import Token from pyjapt.utils import ContainerSet @@ -309,15 +310,16 @@ class ShiftReduceParser: SHIFT = 'SHIFT' REDUCE = 'REDUCE' OK = 'OK' - conatins_errors = False + contains_errors = False - def __init__(self, G): + def __init__(self, G, verbose=False): self.G = G self.augmented_G = G.augmented_grammar(True) self.firsts = compute_firsts(self.augmented_G) self.follows = compute_follows(self.augmented_G, self.firsts) self.automaton = self._build_automaton() self.conflicts = [] + self.verbose = verbose self.action = {} self.goto = {} @@ -378,6 +380,7 @@ def __call__(self, tokens): :param tokens: List[Token] :return: Any """ + inserted_error = False stack: list = [0] # The order in stack is [init state] + [symbol, rule, state, ...] cursor = 0 @@ -385,30 +388,39 @@ def __call__(self, tokens): if cursor >= len(tokens): return - state = stack[-1] + state = stack[-1] lookahead = tokens[cursor] + if self.verbose: + prev = ' '.join([s.name for s in stack if isinstance(s, Symbol)]) + post = ' '.join([tokens[i].lex for i in range(cursor, len(tokens))]) + print(f'{prev} <-> {post}') + print() + ########################## # Error Handling Section # ########################## if (state, lookahead.token_type) not in self.action: - self.conatins_errors = True - try: - # Try to insert an error token into the stack - action, tag = self.action[state, self.G.ERROR] - lookahead.token_type = self.G.ERROR - stack += [lookahead.token_type, lookahead, tag] - cursor += 1 - except KeyError: + self.contains_errors = True + + if (state, self.G.ERROR) in self.action: + if self.verbose: + print(f'Inserted error token {lookahead,}') + + inserted_error = True + lookahead = Token(lookahead.lex, self.G.ERROR, lookahead.line, lookahead.column) + else: # If an error insertion fails then the parsing process enter into a panic mode recovery sys.stderr.write( f'{lookahead.line, lookahead.column} - SyntacticError: ERROR at or near "{lookahead.lex}"\n') + while (state, lookahead.token_type) not in self.action: cursor += 1 if cursor >= len(tokens): return lookahead = tokens[cursor] - continue + + continue ####### # End # ####### @@ -416,9 +428,21 @@ def __call__(self, tokens): action, tag = self.action[state, lookahead.token_type] if action == self.SHIFT: - stack += [lookahead.token_type, lookahead.lex, tag] - cursor += 1 + # in this case tag is an integer + if self.verbose: + print(f'Shift: {lookahead.lex, tag}') + + if not inserted_error: + stack += [lookahead.token_type, lookahead.lex, tag] + cursor += 1 + else: + # the rule of an error token is the self token + stack += [lookahead.token_type, lookahead, tag] elif action == self.REDUCE: + # in this case tag is a Production + if self.verbose: + print(f'Reduce: {repr(tag)}') + head, body = tag rules = RuleList(self, [None] * (len(body) + 1)) @@ -437,6 +461,7 @@ def __call__(self, tokens): else: raise Exception(f'ParsingError: invalid action {action}') + inserted_error = False class SLRParser(ShiftReduceParser): def _build_automaton(self): diff --git a/tester.py b/tester.py index bc0952bc5..cbe008bdb 100755 --- a/tester.py +++ b/tester.py @@ -4,8 +4,8 @@ import fire from pyjapt.lexing import Token -from lexer import CoolLexer -from parser import CoolParser +from lexertab import CoolLexer +from parsertab import CoolParser from semantics.formatter import Formatter lexer = CoolLexer() From 9bd3e2ee765265af9c1f75014e1ce6d3205012f5 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Sun, 21 Jun 2020 18:25:17 +0200 Subject: [PATCH 066/143] - --- grammar.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/grammar.py b/grammar.py index 116a06bca..37b5a0ce3 100755 --- a/grammar.py +++ b/grammar.py @@ -223,16 +223,28 @@ def feature_method_error(s): @G.production("case-list -> id : type => expr error") def case_list_error(s): - s.error(f"{s[5].line, s[5].column} - SyntacticError: Expected ';' instead of '{s[5].lex}'") + s.error(f"{s[6].line, s[6].column} - SyntacticError: Expected ';' instead of '{s[6].lex}'") return [(s[1], s[3], s[5])] +@G.production("case-list -> id : type => expr error case-list") +def case_list_error(s): + s.error(f"{s[6].line, s[6].column} - SyntacticError: Expected ';' instead of '{s[6].lex}'") + return [(s[1], s[3], s[5])] + s[7] + + @G.production("block -> expr error") def block_single_error(s): s.error(f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") return [s[1]] +@G.production("block -> expr error block") +def block_single_error(s): + s.error(f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") + return [s[1]] + s[3] + + if __name__ == '__main__': t = time.time() G.serialize_lexer('CoolLexer', inspect.getmodulename(__file__)) From c368d4e0b79e013f18459d1ce14317e61d3b86f7 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Sun, 21 Jun 2020 18:25:31 +0200 Subject: [PATCH 067/143] - --- main.py | 9 +- parsertab.py | 1695 +++++++++++++++++++++++++------------------------- 2 files changed, 867 insertions(+), 837 deletions(-) diff --git a/main.py b/main.py index ca1727279..7d064398b 100755 --- a/main.py +++ b/main.py @@ -131,10 +131,13 @@ class Main inherits IO { syntactic_errors = """ class Main { a: Int - b: String - - main () : Object { 0 } + main () : Object { let a: Int <- "" in 0 } + errors() : Object { + case a of + x: Int => (new IO).out_int(x) + esac + } } """ diff --git a/parsertab.py b/parsertab.py index cc4efde81..07b807c0d 100644 --- a/parsertab.py +++ b/parsertab.py @@ -15,213 +15,222 @@ def __action_table(): return { (0, G["class"]): ("SHIFT", 1), (1, G["type"]): ("SHIFT", 2), - (2, G["inherits"]): ("SHIFT", 143), (2, G["{"]): ("SHIFT", 3), + (2, G["inherits"]): ("SHIFT", 145), (3, G["id"]): ("SHIFT", 4), (3, G["}"]): ("REDUCE", G["feature-list -> e"]), - (4, G[":"]): ("SHIFT", 127), (4, G["("]): ("SHIFT", 5), + (4, G[":"]): ("SHIFT", 129), (5, G[")"]): ("SHIFT", 6), - (5, G["id"]): ("SHIFT", 115), + (5, G["id"]): ("SHIFT", 117), (6, G[":"]): ("SHIFT", 7), (7, G["type"]): ("SHIFT", 8), (8, G["{"]): ("SHIFT", 9), - (9, G["case"]): ("SHIFT", 21), - (9, G["("]): ("SHIFT", 11), - (9, G["string"]): ("SHIFT", 33), - (9, G["~"]): ("SHIFT", 27), - (9, G["id"]): ("SHIFT", 31), - (9, G["not"]): ("SHIFT", 30), - (9, G["while"]): ("SHIFT", 13), - (9, G["true"]): ("SHIFT", 25), - (9, G["isvoid"]): ("SHIFT", 24), (9, G["if"]): ("SHIFT", 12), + (9, G["new"]): ("SHIFT", 22), (9, G["false"]): ("SHIFT", 26), - (9, G["let"]): ("SHIFT", 14), + (9, G["isvoid"]): ("SHIFT", 24), + (9, G["("]): ("SHIFT", 11), + (9, G["not"]): ("SHIFT", 30), + (9, G["id"]): ("SHIFT", 31), (9, G["{"]): ("SHIFT", 10), (9, G["int"]): ("SHIFT", 34), - (9, G["new"]): ("SHIFT", 22), - (10, G["true"]): ("SHIFT", 25), - (10, G["case"]): ("SHIFT", 21), - (10, G["false"]): ("SHIFT", 26), + (9, G["~"]): ("SHIFT", 27), + (9, G["string"]): ("SHIFT", 33), + (9, G["case"]): ("SHIFT", 21), + (9, G["true"]): ("SHIFT", 25), + (9, G["let"]): ("SHIFT", 14), + (9, G["while"]): ("SHIFT", 13), + (10, G["while"]): ("SHIFT", 13), + (10, G["isvoid"]): ("SHIFT", 24), + (10, G["("]): ("SHIFT", 11), (10, G["id"]): ("SHIFT", 31), - (10, G["int"]): ("SHIFT", 34), + (10, G["not"]): ("SHIFT", 30), + (10, G["true"]): ("SHIFT", 25), + (10, G["string"]): ("SHIFT", 33), + (10, G["~"]): ("SHIFT", 27), (10, G["{"]): ("SHIFT", 10), (10, G["new"]): ("SHIFT", 22), + (10, G["int"]): ("SHIFT", 34), + (10, G["case"]): ("SHIFT", 21), (10, G["let"]): ("SHIFT", 14), (10, G["if"]): ("SHIFT", 12), - (10, G["("]): ("SHIFT", 11), - (10, G["isvoid"]): ("SHIFT", 24), - (10, G["string"]): ("SHIFT", 33), - (10, G["~"]): ("SHIFT", 27), - (10, G["while"]): ("SHIFT", 13), - (10, G["not"]): ("SHIFT", 30), + (10, G["false"]): ("SHIFT", 26), (11, G["int"]): ("SHIFT", 34), - (11, G["string"]): ("SHIFT", 33), - (11, G["let"]): ("SHIFT", 14), - (11, G["~"]): ("SHIFT", 27), - (11, G["false"]): ("SHIFT", 26), - (11, G["("]): ("SHIFT", 11), - (11, G["true"]): ("SHIFT", 25), - (11, G["id"]): ("SHIFT", 31), (11, G["isvoid"]): ("SHIFT", 24), + (11, G["id"]): ("SHIFT", 31), (11, G["{"]): ("SHIFT", 10), (11, G["not"]): ("SHIFT", 30), - (11, G["if"]): ("SHIFT", 12), - (11, G["case"]): ("SHIFT", 21), + (11, G["false"]): ("SHIFT", 26), (11, G["new"]): ("SHIFT", 22), + (11, G["("]): ("SHIFT", 11), + (11, G["let"]): ("SHIFT", 14), + (11, G["if"]): ("SHIFT", 12), (11, G["while"]): ("SHIFT", 13), - (12, G["{"]): ("SHIFT", 10), + (11, G["true"]): ("SHIFT", 25), + (11, G["~"]): ("SHIFT", 27), + (11, G["case"]): ("SHIFT", 21), + (11, G["string"]): ("SHIFT", 33), + (12, G["while"]): ("SHIFT", 13), (12, G["new"]): ("SHIFT", 22), - (12, G["int"]): ("SHIFT", 34), - (12, G["true"]): ("SHIFT", 25), + (12, G["string"]): ("SHIFT", 33), + (12, G["if"]): ("SHIFT", 12), (12, G["case"]): ("SHIFT", 21), + (12, G["int"]): ("SHIFT", 34), + (12, G["~"]): ("SHIFT", 27), (12, G["false"]): ("SHIFT", 26), - (12, G["let"]): ("SHIFT", 14), - (12, G["while"]): ("SHIFT", 13), - (12, G["not"]): ("SHIFT", 30), + (12, G["{"]): ("SHIFT", 10), (12, G["id"]): ("SHIFT", 31), - (12, G["string"]): ("SHIFT", 33), - (12, G["~"]): ("SHIFT", 27), - (12, G["isvoid"]): ("SHIFT", 24), (12, G["("]): ("SHIFT", 11), - (12, G["if"]): ("SHIFT", 12), - (13, G["new"]): ("SHIFT", 22), + (12, G["isvoid"]): ("SHIFT", 24), + (12, G["not"]): ("SHIFT", 30), + (12, G["let"]): ("SHIFT", 14), + (12, G["true"]): ("SHIFT", 25), + (13, G["string"]): ("SHIFT", 33), (13, G["~"]): ("SHIFT", 27), - (13, G["id"]): ("SHIFT", 31), - (13, G["{"]): ("SHIFT", 10), - (13, G["if"]): ("SHIFT", 12), + (13, G["new"]): ("SHIFT", 22), (13, G["case"]): ("SHIFT", 21), - (13, G["while"]): ("SHIFT", 13), - (13, G["true"]): ("SHIFT", 25), - (13, G["not"]): ("SHIFT", 30), (13, G["("]): ("SHIFT", 11), - (13, G["false"]): ("SHIFT", 26), + (13, G["id"]): ("SHIFT", 31), (13, G["let"]): ("SHIFT", 14), (13, G["isvoid"]): ("SHIFT", 24), - (13, G["string"]): ("SHIFT", 33), + (13, G["not"]): ("SHIFT", 30), + (13, G["false"]): ("SHIFT", 26), (13, G["int"]): ("SHIFT", 34), + (13, G["if"]): ("SHIFT", 12), + (13, G["{"]): ("SHIFT", 10), + (13, G["while"]): ("SHIFT", 13), + (13, G["true"]): ("SHIFT", 25), (14, G["id"]): ("SHIFT", 15), (15, G[":"]): ("SHIFT", 16), (16, G["type"]): ("SHIFT", 17), - (17, G["<-"]): ("SHIFT", 20), (17, G[","]): ("SHIFT", 18), + (17, G["<-"]): ("SHIFT", 20), (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), (18, G["id"]): ("SHIFT", 15), (19, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), + (20, G["string"]): ("SHIFT", 33), + (20, G["id"]): ("SHIFT", 31), + (20, G["("]): ("SHIFT", 11), (20, G["~"]): ("SHIFT", 27), - (20, G["while"]): ("SHIFT", 13), (20, G["not"]): ("SHIFT", 30), + (20, G["let"]): ("SHIFT", 14), + (20, G["while"]): ("SHIFT", 13), + (20, G["false"]): ("SHIFT", 26), + (20, G["if"]): ("SHIFT", 12), (20, G["int"]): ("SHIFT", 34), - (20, G["string"]): ("SHIFT", 33), - (20, G["id"]): ("SHIFT", 31), (20, G["case"]): ("SHIFT", 21), - (20, G["new"]): ("SHIFT", 22), (20, G["isvoid"]): ("SHIFT", 24), - (20, G["{"]): ("SHIFT", 10), - (20, G["false"]): ("SHIFT", 26), - (20, G["let"]): ("SHIFT", 14), - (20, G["("]): ("SHIFT", 11), (20, G["true"]): ("SHIFT", 25), - (20, G["if"]): ("SHIFT", 12), + (20, G["new"]): ("SHIFT", 22), + (20, G["{"]): ("SHIFT", 10), (21, G["~"]): ("SHIFT", 27), + (21, G["true"]): ("SHIFT", 25), + (21, G["while"]): ("SHIFT", 13), (21, G["{"]): ("SHIFT", 10), - (21, G["int"]): ("SHIFT", 34), - (21, G["new"]): ("SHIFT", 22), + (21, G["if"]): ("SHIFT", 12), + (21, G["string"]): ("SHIFT", 33), (21, G["id"]): ("SHIFT", 31), - (21, G["let"]): ("SHIFT", 14), - (21, G["while"]): ("SHIFT", 13), - (21, G["not"]): ("SHIFT", 30), - (21, G["case"]): ("SHIFT", 21), - (21, G["true"]): ("SHIFT", 25), + (21, G["int"]): ("SHIFT", 34), (21, G["isvoid"]): ("SHIFT", 24), - (21, G["if"]): ("SHIFT", 12), - (21, G["("]): ("SHIFT", 11), + (21, G["not"]): ("SHIFT", 30), + (21, G["let"]): ("SHIFT", 14), (21, G["false"]): ("SHIFT", 26), - (21, G["string"]): ("SHIFT", 33), + (21, G["new"]): ("SHIFT", 22), + (21, G["("]): ("SHIFT", 11), + (21, G["case"]): ("SHIFT", 21), (22, G["type"]): ("SHIFT", 23), + (23, G[","]): ("REDUCE", G["atom -> new type"]), + (23, G["then"]): ("REDUCE", G["atom -> new type"]), + (23, G[";"]): ("REDUCE", G["atom -> new type"]), + (23, G["."]): ("REDUCE", G["atom -> new type"]), + (23, G["@"]): ("REDUCE", G["atom -> new type"]), + (23, G["+"]): ("REDUCE", G["atom -> new type"]), + (23, G["else"]): ("REDUCE", G["atom -> new type"]), + (23, G["of"]): ("REDUCE", G["atom -> new type"]), + (23, G["-"]): ("REDUCE", G["atom -> new type"]), + (23, G["fi"]): ("REDUCE", G["atom -> new type"]), (23, G["*"]): ("REDUCE", G["atom -> new type"]), (23, G["}"]): ("REDUCE", G["atom -> new type"]), (23, G["/"]): ("REDUCE", G["atom -> new type"]), - (23, G["loop"]): ("REDUCE", G["atom -> new type"]), (23, G["<"]): ("REDUCE", G["atom -> new type"]), + (23, G["loop"]): ("REDUCE", G["atom -> new type"]), (23, G["<="]): ("REDUCE", G["atom -> new type"]), (23, G["pool"]): ("REDUCE", G["atom -> new type"]), (23, G[")"]): ("REDUCE", G["atom -> new type"]), (23, G["="]): ("REDUCE", G["atom -> new type"]), - (23, G["."]): ("REDUCE", G["atom -> new type"]), - (23, G["fi"]): ("REDUCE", G["atom -> new type"]), - (23, G["in"]): ("REDUCE", G["atom -> new type"]), - (23, G[","]): ("REDUCE", G["atom -> new type"]), - (23, G["then"]): ("REDUCE", G["atom -> new type"]), - (23, G[";"]): ("REDUCE", G["atom -> new type"]), - (23, G["@"]): ("REDUCE", G["atom -> new type"]), - (23, G["+"]): ("REDUCE", G["atom -> new type"]), - (23, G["else"]): ("REDUCE", G["atom -> new type"]), - (23, G["of"]): ("REDUCE", G["atom -> new type"]), (23, G["error"]): ("REDUCE", G["atom -> new type"]), - (23, G["-"]): ("REDUCE", G["atom -> new type"]), + (23, G["in"]): ("REDUCE", G["atom -> new type"]), + (24, G["false"]): ("SHIFT", 26), + (24, G["~"]): ("SHIFT", 27), (24, G["true"]): ("SHIFT", 25), + (24, G["string"]): ("SHIFT", 33), (24, G["int"]): ("SHIFT", 34), (24, G["id"]): ("SHIFT", 28), - (24, G["~"]): ("SHIFT", 27), - (24, G["string"]): ("SHIFT", 33), - (24, G["false"]): ("SHIFT", 26), (24, G["("]): ("SHIFT", 11), - (24, G["new"]): ("SHIFT", 22), (24, G["isvoid"]): ("SHIFT", 24), + (24, G["new"]): ("SHIFT", 22), + (25, G[","]): ("REDUCE", G["atom -> true"]), + (25, G["then"]): ("REDUCE", G["atom -> true"]), + (25, G[";"]): ("REDUCE", G["atom -> true"]), + (25, G["."]): ("REDUCE", G["atom -> true"]), + (25, G["+"]): ("REDUCE", G["atom -> true"]), + (25, G["@"]): ("REDUCE", G["atom -> true"]), + (25, G["else"]): ("REDUCE", G["atom -> true"]), + (25, G["of"]): ("REDUCE", G["atom -> true"]), + (25, G["-"]): ("REDUCE", G["atom -> true"]), + (25, G["fi"]): ("REDUCE", G["atom -> true"]), (25, G["*"]): ("REDUCE", G["atom -> true"]), (25, G["}"]): ("REDUCE", G["atom -> true"]), (25, G["/"]): ("REDUCE", G["atom -> true"]), - (25, G["loop"]): ("REDUCE", G["atom -> true"]), (25, G["<"]): ("REDUCE", G["atom -> true"]), + (25, G["loop"]): ("REDUCE", G["atom -> true"]), (25, G["<="]): ("REDUCE", G["atom -> true"]), (25, G["pool"]): ("REDUCE", G["atom -> true"]), (25, G[")"]): ("REDUCE", G["atom -> true"]), (25, G["="]): ("REDUCE", G["atom -> true"]), - (25, G["."]): ("REDUCE", G["atom -> true"]), - (25, G["in"]): ("REDUCE", G["atom -> true"]), - (25, G[","]): ("REDUCE", G["atom -> true"]), - (25, G["then"]): ("REDUCE", G["atom -> true"]), - (25, G["-"]): ("REDUCE", G["atom -> true"]), - (25, G[";"]): ("REDUCE", G["atom -> true"]), - (25, G["+"]): ("REDUCE", G["atom -> true"]), - (25, G["@"]): ("REDUCE", G["atom -> true"]), - (25, G["else"]): ("REDUCE", G["atom -> true"]), - (25, G["of"]): ("REDUCE", G["atom -> true"]), (25, G["error"]): ("REDUCE", G["atom -> true"]), - (25, G["fi"]): ("REDUCE", G["atom -> true"]), + (25, G["in"]): ("REDUCE", G["atom -> true"]), + (26, G[","]): ("REDUCE", G["atom -> false"]), + (26, G["then"]): ("REDUCE", G["atom -> false"]), + (26, G[";"]): ("REDUCE", G["atom -> false"]), + (26, G["."]): ("REDUCE", G["atom -> false"]), + (26, G["@"]): ("REDUCE", G["atom -> false"]), + (26, G["+"]): ("REDUCE", G["atom -> false"]), + (26, G["else"]): ("REDUCE", G["atom -> false"]), + (26, G["of"]): ("REDUCE", G["atom -> false"]), + (26, G["-"]): ("REDUCE", G["atom -> false"]), + (26, G["fi"]): ("REDUCE", G["atom -> false"]), (26, G["*"]): ("REDUCE", G["atom -> false"]), (26, G["}"]): ("REDUCE", G["atom -> false"]), (26, G["/"]): ("REDUCE", G["atom -> false"]), - (26, G["loop"]): ("REDUCE", G["atom -> false"]), (26, G["<"]): ("REDUCE", G["atom -> false"]), + (26, G["loop"]): ("REDUCE", G["atom -> false"]), (26, G["<="]): ("REDUCE", G["atom -> false"]), (26, G["pool"]): ("REDUCE", G["atom -> false"]), (26, G[")"]): ("REDUCE", G["atom -> false"]), (26, G["="]): ("REDUCE", G["atom -> false"]), - (26, G["."]): ("REDUCE", G["atom -> false"]), - (26, G["in"]): ("REDUCE", G["atom -> false"]), - (26, G[","]): ("REDUCE", G["atom -> false"]), - (26, G["then"]): ("REDUCE", G["atom -> false"]), - (26, G["-"]): ("REDUCE", G["atom -> false"]), - (26, G[";"]): ("REDUCE", G["atom -> false"]), - (26, G["+"]): ("REDUCE", G["atom -> false"]), - (26, G["@"]): ("REDUCE", G["atom -> false"]), - (26, G["else"]): ("REDUCE", G["atom -> false"]), - (26, G["of"]): ("REDUCE", G["atom -> false"]), (26, G["error"]): ("REDUCE", G["atom -> false"]), - (26, G["fi"]): ("REDUCE", G["atom -> false"]), + (26, G["in"]): ("REDUCE", G["atom -> false"]), + (27, G["false"]): ("SHIFT", 26), + (27, G["~"]): ("SHIFT", 27), (27, G["true"]): ("SHIFT", 25), + (27, G["string"]): ("SHIFT", 33), (27, G["int"]): ("SHIFT", 34), (27, G["id"]): ("SHIFT", 28), - (27, G["~"]): ("SHIFT", 27), - (27, G["string"]): ("SHIFT", 33), - (27, G["false"]): ("SHIFT", 26), (27, G["("]): ("SHIFT", 11), - (27, G["new"]): ("SHIFT", 22), (27, G["isvoid"]): ("SHIFT", 24), - (28, G["("]): ("SHIFT", 29), + (27, G["new"]): ("SHIFT", 22), + (28, G[","]): ("REDUCE", G["atom -> id"]), + (28, G["then"]): ("REDUCE", G["atom -> id"]), + (28, G[";"]): ("REDUCE", G["atom -> id"]), + (28, G["."]): ("REDUCE", G["atom -> id"]), + (28, G["@"]): ("REDUCE", G["atom -> id"]), + (28, G["+"]): ("REDUCE", G["atom -> id"]), + (28, G["else"]): ("REDUCE", G["atom -> id"]), + (28, G["of"]): ("REDUCE", G["atom -> id"]), + (28, G["-"]): ("REDUCE", G["atom -> id"]), + (28, G["fi"]): ("REDUCE", G["atom -> id"]), (28, G["*"]): ("REDUCE", G["atom -> id"]), (28, G["}"]): ("REDUCE", G["atom -> id"]), (28, G["/"]): ("REDUCE", G["atom -> id"]), @@ -231,545 +240,546 @@ def __action_table(): (28, G["pool"]): ("REDUCE", G["atom -> id"]), (28, G[")"]): ("REDUCE", G["atom -> id"]), (28, G["="]): ("REDUCE", G["atom -> id"]), - (28, G["."]): ("REDUCE", G["atom -> id"]), - (28, G["fi"]): ("REDUCE", G["atom -> id"]), - (28, G["in"]): ("REDUCE", G["atom -> id"]), - (28, G[","]): ("REDUCE", G["atom -> id"]), - (28, G["then"]): ("REDUCE", G["atom -> id"]), - (28, G[";"]): ("REDUCE", G["atom -> id"]), - (28, G["@"]): ("REDUCE", G["atom -> id"]), - (28, G["+"]): ("REDUCE", G["atom -> id"]), - (28, G["else"]): ("REDUCE", G["atom -> id"]), - (28, G["of"]): ("REDUCE", G["atom -> id"]), (28, G["error"]): ("REDUCE", G["atom -> id"]), - (28, G["-"]): ("REDUCE", G["atom -> id"]), - (29, G["if"]): ("SHIFT", 12), + (28, G["in"]): ("REDUCE", G["atom -> id"]), + (28, G["("]): ("SHIFT", 29), + (29, G["string"]): ("SHIFT", 33), + (29, G["id"]): ("SHIFT", 31), (29, G["true"]): ("SHIFT", 25), + (29, G["isvoid"]): ("SHIFT", 24), + (29, G["int"]): ("SHIFT", 34), (29, G["case"]): ("SHIFT", 21), - (29, G["("]): ("SHIFT", 11), (29, G["false"]): ("SHIFT", 26), - (29, G["string"]): ("SHIFT", 33), - (29, G["int"]): ("SHIFT", 34), - (29, G["~"]): ("SHIFT", 27), - (29, G["new"]): ("SHIFT", 22), - (29, G["let"]): ("SHIFT", 14), (29, G["while"]): ("SHIFT", 13), + (29, G["if"]): ("SHIFT", 12), + (29, G["let"]): ("SHIFT", 14), + (29, G["~"]): ("SHIFT", 27), (29, G["not"]): ("SHIFT", 30), - (29, G["id"]): ("SHIFT", 31), - (29, G["isvoid"]): ("SHIFT", 24), - (29, G[")"]): ("REDUCE", G["expr-list -> e"]), + (29, G["("]): ("SHIFT", 11), (29, G["{"]): ("SHIFT", 10), - (30, G["let"]): ("SHIFT", 14), + (29, G[")"]): ("REDUCE", G["expr-list -> e"]), + (29, G["new"]): ("SHIFT", 22), + (30, G["if"]): ("SHIFT", 12), (30, G["while"]): ("SHIFT", 13), + (30, G["new"]): ("SHIFT", 22), + (30, G["false"]): ("SHIFT", 26), (30, G["not"]): ("SHIFT", 30), - (30, G["~"]): ("SHIFT", 27), + (30, G["int"]): ("SHIFT", 34), + (30, G["isvoid"]): ("SHIFT", 24), (30, G["id"]): ("SHIFT", 31), - (30, G["string"]): ("SHIFT", 33), - (30, G["if"]): ("SHIFT", 12), - (30, G["false"]): ("SHIFT", 26), (30, G["true"]): ("SHIFT", 25), (30, G["{"]): ("SHIFT", 10), - (30, G["new"]): ("SHIFT", 22), - (30, G["isvoid"]): ("SHIFT", 24), - (30, G["int"]): ("SHIFT", 34), + (30, G["string"]): ("SHIFT", 33), (30, G["case"]): ("SHIFT", 21), + (30, G["~"]): ("SHIFT", 27), (30, G["("]): ("SHIFT", 11), - (31, G["<-"]): ("SHIFT", 32), - (31, G["("]): ("SHIFT", 29), + (30, G["let"]): ("SHIFT", 14), + (31, G[","]): ("REDUCE", G["atom -> id"]), + (31, G["then"]): ("REDUCE", G["atom -> id"]), + (31, G[";"]): ("REDUCE", G["atom -> id"]), + (31, G["."]): ("REDUCE", G["atom -> id"]), + (31, G["+"]): ("REDUCE", G["atom -> id"]), + (31, G["@"]): ("REDUCE", G["atom -> id"]), + (31, G["else"]): ("REDUCE", G["atom -> id"]), + (31, G["of"]): ("REDUCE", G["atom -> id"]), + (31, G["-"]): ("REDUCE", G["atom -> id"]), + (31, G["fi"]): ("REDUCE", G["atom -> id"]), (31, G["*"]): ("REDUCE", G["atom -> id"]), (31, G["}"]): ("REDUCE", G["atom -> id"]), (31, G["/"]): ("REDUCE", G["atom -> id"]), - (31, G["loop"]): ("REDUCE", G["atom -> id"]), (31, G["<"]): ("REDUCE", G["atom -> id"]), + (31, G["loop"]): ("REDUCE", G["atom -> id"]), (31, G["<="]): ("REDUCE", G["atom -> id"]), (31, G["pool"]): ("REDUCE", G["atom -> id"]), (31, G[")"]): ("REDUCE", G["atom -> id"]), (31, G["="]): ("REDUCE", G["atom -> id"]), - (31, G["."]): ("REDUCE", G["atom -> id"]), - (31, G["in"]): ("REDUCE", G["atom -> id"]), - (31, G[","]): ("REDUCE", G["atom -> id"]), - (31, G["then"]): ("REDUCE", G["atom -> id"]), - (31, G["-"]): ("REDUCE", G["atom -> id"]), - (31, G[";"]): ("REDUCE", G["atom -> id"]), - (31, G["@"]): ("REDUCE", G["atom -> id"]), - (31, G["+"]): ("REDUCE", G["atom -> id"]), - (31, G["else"]): ("REDUCE", G["atom -> id"]), - (31, G["of"]): ("REDUCE", G["atom -> id"]), (31, G["error"]): ("REDUCE", G["atom -> id"]), - (31, G["fi"]): ("REDUCE", G["atom -> id"]), - (32, G["let"]): ("SHIFT", 14), + (31, G["in"]): ("REDUCE", G["atom -> id"]), + (31, G["<-"]): ("SHIFT", 32), + (31, G["("]): ("SHIFT", 29), + (32, G["if"]): ("SHIFT", 12), (32, G["while"]): ("SHIFT", 13), + (32, G["new"]): ("SHIFT", 22), + (32, G["false"]): ("SHIFT", 26), (32, G["not"]): ("SHIFT", 30), - (32, G["~"]): ("SHIFT", 27), + (32, G["int"]): ("SHIFT", 34), + (32, G["isvoid"]): ("SHIFT", 24), (32, G["id"]): ("SHIFT", 31), - (32, G["string"]): ("SHIFT", 33), - (32, G["if"]): ("SHIFT", 12), - (32, G["false"]): ("SHIFT", 26), (32, G["true"]): ("SHIFT", 25), (32, G["{"]): ("SHIFT", 10), - (32, G["new"]): ("SHIFT", 22), - (32, G["isvoid"]): ("SHIFT", 24), - (32, G["int"]): ("SHIFT", 34), + (32, G["string"]): ("SHIFT", 33), (32, G["case"]): ("SHIFT", 21), + (32, G["~"]): ("SHIFT", 27), (32, G["("]): ("SHIFT", 11), + (32, G["let"]): ("SHIFT", 14), + (33, G[","]): ("REDUCE", G["atom -> string"]), + (33, G["then"]): ("REDUCE", G["atom -> string"]), + (33, G[";"]): ("REDUCE", G["atom -> string"]), + (33, G["."]): ("REDUCE", G["atom -> string"]), + (33, G["@"]): ("REDUCE", G["atom -> string"]), + (33, G["+"]): ("REDUCE", G["atom -> string"]), + (33, G["else"]): ("REDUCE", G["atom -> string"]), + (33, G["of"]): ("REDUCE", G["atom -> string"]), + (33, G["-"]): ("REDUCE", G["atom -> string"]), + (33, G["fi"]): ("REDUCE", G["atom -> string"]), (33, G["*"]): ("REDUCE", G["atom -> string"]), (33, G["}"]): ("REDUCE", G["atom -> string"]), (33, G["/"]): ("REDUCE", G["atom -> string"]), - (33, G["loop"]): ("REDUCE", G["atom -> string"]), (33, G["<"]): ("REDUCE", G["atom -> string"]), + (33, G["loop"]): ("REDUCE", G["atom -> string"]), (33, G["<="]): ("REDUCE", G["atom -> string"]), (33, G["pool"]): ("REDUCE", G["atom -> string"]), (33, G[")"]): ("REDUCE", G["atom -> string"]), (33, G["="]): ("REDUCE", G["atom -> string"]), - (33, G["."]): ("REDUCE", G["atom -> string"]), - (33, G["in"]): ("REDUCE", G["atom -> string"]), - (33, G[","]): ("REDUCE", G["atom -> string"]), - (33, G["then"]): ("REDUCE", G["atom -> string"]), - (33, G["-"]): ("REDUCE", G["atom -> string"]), - (33, G[";"]): ("REDUCE", G["atom -> string"]), - (33, G["+"]): ("REDUCE", G["atom -> string"]), - (33, G["@"]): ("REDUCE", G["atom -> string"]), - (33, G["else"]): ("REDUCE", G["atom -> string"]), - (33, G["of"]): ("REDUCE", G["atom -> string"]), (33, G["error"]): ("REDUCE", G["atom -> string"]), - (33, G["fi"]): ("REDUCE", G["atom -> string"]), + (33, G["in"]): ("REDUCE", G["atom -> string"]), + (34, G[","]): ("REDUCE", G["atom -> int"]), + (34, G["then"]): ("REDUCE", G["atom -> int"]), + (34, G[";"]): ("REDUCE", G["atom -> int"]), + (34, G["."]): ("REDUCE", G["atom -> int"]), + (34, G["+"]): ("REDUCE", G["atom -> int"]), + (34, G["@"]): ("REDUCE", G["atom -> int"]), + (34, G["else"]): ("REDUCE", G["atom -> int"]), + (34, G["of"]): ("REDUCE", G["atom -> int"]), + (34, G["-"]): ("REDUCE", G["atom -> int"]), + (34, G["fi"]): ("REDUCE", G["atom -> int"]), (34, G["*"]): ("REDUCE", G["atom -> int"]), (34, G["}"]): ("REDUCE", G["atom -> int"]), (34, G["/"]): ("REDUCE", G["atom -> int"]), - (34, G["loop"]): ("REDUCE", G["atom -> int"]), (34, G["<"]): ("REDUCE", G["atom -> int"]), + (34, G["loop"]): ("REDUCE", G["atom -> int"]), (34, G["<="]): ("REDUCE", G["atom -> int"]), (34, G["pool"]): ("REDUCE", G["atom -> int"]), (34, G[")"]): ("REDUCE", G["atom -> int"]), (34, G["="]): ("REDUCE", G["atom -> int"]), - (34, G["."]): ("REDUCE", G["atom -> int"]), - (34, G["in"]): ("REDUCE", G["atom -> int"]), - (34, G[","]): ("REDUCE", G["atom -> int"]), - (34, G["then"]): ("REDUCE", G["atom -> int"]), - (34, G["-"]): ("REDUCE", G["atom -> int"]), - (34, G[";"]): ("REDUCE", G["atom -> int"]), - (34, G["+"]): ("REDUCE", G["atom -> int"]), - (34, G["@"]): ("REDUCE", G["atom -> int"]), - (34, G["else"]): ("REDUCE", G["atom -> int"]), - (34, G["of"]): ("REDUCE", G["atom -> int"]), (34, G["error"]): ("REDUCE", G["atom -> int"]), - (34, G["fi"]): ("REDUCE", G["atom -> int"]), + (34, G["in"]): ("REDUCE", G["atom -> int"]), + (35, G[","]): ("REDUCE", G["atom -> function-call"]), + (35, G["then"]): ("REDUCE", G["atom -> function-call"]), + (35, G[";"]): ("REDUCE", G["atom -> function-call"]), + (35, G["."]): ("REDUCE", G["atom -> function-call"]), + (35, G["@"]): ("REDUCE", G["atom -> function-call"]), + (35, G["+"]): ("REDUCE", G["atom -> function-call"]), + (35, G["else"]): ("REDUCE", G["atom -> function-call"]), + (35, G["of"]): ("REDUCE", G["atom -> function-call"]), + (35, G["-"]): ("REDUCE", G["atom -> function-call"]), + (35, G["fi"]): ("REDUCE", G["atom -> function-call"]), (35, G["*"]): ("REDUCE", G["atom -> function-call"]), (35, G["}"]): ("REDUCE", G["atom -> function-call"]), (35, G["/"]): ("REDUCE", G["atom -> function-call"]), - (35, G["loop"]): ("REDUCE", G["atom -> function-call"]), (35, G["<"]): ("REDUCE", G["atom -> function-call"]), + (35, G["loop"]): ("REDUCE", G["atom -> function-call"]), (35, G["<="]): ("REDUCE", G["atom -> function-call"]), (35, G["pool"]): ("REDUCE", G["atom -> function-call"]), (35, G[")"]): ("REDUCE", G["atom -> function-call"]), (35, G["="]): ("REDUCE", G["atom -> function-call"]), - (35, G["."]): ("REDUCE", G["atom -> function-call"]), - (35, G["in"]): ("REDUCE", G["atom -> function-call"]), - (35, G[","]): ("REDUCE", G["atom -> function-call"]), - (35, G["then"]): ("REDUCE", G["atom -> function-call"]), - (35, G["-"]): ("REDUCE", G["atom -> function-call"]), - (35, G[";"]): ("REDUCE", G["atom -> function-call"]), - (35, G["+"]): ("REDUCE", G["atom -> function-call"]), - (35, G["@"]): ("REDUCE", G["atom -> function-call"]), - (35, G["else"]): ("REDUCE", G["atom -> function-call"]), - (35, G["of"]): ("REDUCE", G["atom -> function-call"]), (35, G["error"]): ("REDUCE", G["atom -> function-call"]), - (35, G["fi"]): ("REDUCE", G["atom -> function-call"]), - (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["in"]): ("REDUCE", G["expr -> id <- expr"]), + (35, G["in"]): ("REDUCE", G["atom -> function-call"]), (36, G["}"]): ("REDUCE", G["expr -> id <- expr"]), (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["else"]): ("REDUCE", G["expr -> id <- expr"]), (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), - (37, G["error"]): ("REDUCE", G["expr -> comp"]), - (37, G["in"]): ("REDUCE", G["expr -> comp"]), + (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["in"]): ("REDUCE", G["expr -> id <- expr"]), (37, G["}"]): ("REDUCE", G["expr -> comp"]), (37, G[","]): ("REDUCE", G["expr -> comp"]), - (37, G["loop"]): ("REDUCE", G["expr -> comp"]), (37, G["then"]): ("REDUCE", G["expr -> comp"]), + (37, G["loop"]): ("REDUCE", G["expr -> comp"]), (37, G[";"]): ("REDUCE", G["expr -> comp"]), - (37, G["of"]): ("REDUCE", G["expr -> comp"]), (37, G["pool"]): ("REDUCE", G["expr -> comp"]), (37, G["else"]): ("REDUCE", G["expr -> comp"]), (37, G[")"]): ("REDUCE", G["expr -> comp"]), + (37, G["of"]): ("REDUCE", G["expr -> comp"]), (37, G["fi"]): ("REDUCE", G["expr -> comp"]), - (38, G["<"]): ("SHIFT", 66), - (38, G["error"]): ("REDUCE", G["comp -> arith"]), - (38, G["in"]): ("REDUCE", G["comp -> arith"]), + (37, G["error"]): ("REDUCE", G["expr -> comp"]), + (37, G["in"]): ("REDUCE", G["expr -> comp"]), + (38, G["-"]): ("SHIFT", 64), + (38, G["<="]): ("SHIFT", 68), + (38, G["="]): ("SHIFT", 70), + (38, G["+"]): ("SHIFT", 39), (38, G["}"]): ("REDUCE", G["comp -> arith"]), (38, G[","]): ("REDUCE", G["comp -> arith"]), - (38, G["loop"]): ("REDUCE", G["comp -> arith"]), (38, G["then"]): ("REDUCE", G["comp -> arith"]), + (38, G["loop"]): ("REDUCE", G["comp -> arith"]), (38, G[";"]): ("REDUCE", G["comp -> arith"]), - (38, G["of"]): ("REDUCE", G["comp -> arith"]), (38, G["pool"]): ("REDUCE", G["comp -> arith"]), (38, G["else"]): ("REDUCE", G["comp -> arith"]), (38, G[")"]): ("REDUCE", G["comp -> arith"]), + (38, G["of"]): ("REDUCE", G["comp -> arith"]), (38, G["fi"]): ("REDUCE", G["comp -> arith"]), - (38, G["="]): ("SHIFT", 70), - (38, G["+"]): ("SHIFT", 39), - (38, G["<="]): ("SHIFT", 68), - (38, G["-"]): ("SHIFT", 64), + (38, G["error"]): ("REDUCE", G["comp -> arith"]), + (38, G["in"]): ("REDUCE", G["comp -> arith"]), + (38, G["<"]): ("SHIFT", 66), (39, G["true"]): ("SHIFT", 25), + (39, G["string"]): ("SHIFT", 33), + (39, G["new"]): ("SHIFT", 22), + (39, G["false"]): ("SHIFT", 26), (39, G["~"]): ("SHIFT", 27), (39, G["id"]): ("SHIFT", 28), - (39, G["new"]): ("SHIFT", 22), - (39, G["isvoid"]): ("SHIFT", 24), - (39, G["int"]): ("SHIFT", 34), - (39, G["string"]): ("SHIFT", 33), (39, G["("]): ("SHIFT", 11), - (39, G["false"]): ("SHIFT", 26), + (39, G["int"]): ("SHIFT", 34), + (39, G["isvoid"]): ("SHIFT", 24), (40, G["*"]): ("SHIFT", 41), - (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["<"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["<="]): ("REDUCE", G["arith -> arith + term"]), - (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["="]): ("REDUCE", G["arith -> arith + term"]), - (40, G["fi"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), (40, G[","]): ("REDUCE", G["arith -> arith + term"]), (40, G["then"]): ("REDUCE", G["arith -> arith + term"]), (40, G[";"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["else"]): ("REDUCE", G["arith -> arith + term"]), (40, G["+"]): ("REDUCE", G["arith -> arith + term"]), (40, G["of"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["else"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["fi"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["<"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["<="]): ("REDUCE", G["arith -> arith + term"]), + (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["="]): ("REDUCE", G["arith -> arith + term"]), + (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), (40, G["/"]): ("SHIFT", 54), + (41, G["false"]): ("SHIFT", 26), + (41, G["~"]): ("SHIFT", 27), (41, G["true"]): ("SHIFT", 25), (41, G["int"]): ("SHIFT", 34), (41, G["id"]): ("SHIFT", 28), - (41, G["~"]): ("SHIFT", 27), - (41, G["string"]): ("SHIFT", 33), - (41, G["false"]): ("SHIFT", 26), (41, G["("]): ("SHIFT", 11), - (41, G["new"]): ("SHIFT", 22), + (41, G["string"]): ("SHIFT", 33), (41, G["isvoid"]): ("SHIFT", 24), + (41, G["new"]): ("SHIFT", 22), + (42, G[","]): ("REDUCE", G["term -> term * factor"]), + (42, G["then"]): ("REDUCE", G["term -> term * factor"]), + (42, G[";"]): ("REDUCE", G["term -> term * factor"]), + (42, G["else"]): ("REDUCE", G["term -> term * factor"]), + (42, G["+"]): ("REDUCE", G["term -> term * factor"]), + (42, G["of"]): ("REDUCE", G["term -> term * factor"]), + (42, G["-"]): ("REDUCE", G["term -> term * factor"]), + (42, G["fi"]): ("REDUCE", G["term -> term * factor"]), (42, G["*"]): ("REDUCE", G["term -> term * factor"]), (42, G["}"]): ("REDUCE", G["term -> term * factor"]), (42, G["/"]): ("REDUCE", G["term -> term * factor"]), - (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), (42, G["<"]): ("REDUCE", G["term -> term * factor"]), - (42, G["pool"]): ("REDUCE", G["term -> term * factor"]), + (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), (42, G["<="]): ("REDUCE", G["term -> term * factor"]), + (42, G["pool"]): ("REDUCE", G["term -> term * factor"]), (42, G[")"]): ("REDUCE", G["term -> term * factor"]), (42, G["="]): ("REDUCE", G["term -> term * factor"]), - (42, G["fi"]): ("REDUCE", G["term -> term * factor"]), - (42, G["in"]): ("REDUCE", G["term -> term * factor"]), - (42, G[","]): ("REDUCE", G["term -> term * factor"]), - (42, G["then"]): ("REDUCE", G["term -> term * factor"]), - (42, G[";"]): ("REDUCE", G["term -> term * factor"]), - (42, G["+"]): ("REDUCE", G["term -> term * factor"]), - (42, G["else"]): ("REDUCE", G["term -> term * factor"]), - (42, G["of"]): ("REDUCE", G["term -> term * factor"]), (42, G["error"]): ("REDUCE", G["term -> term * factor"]), - (42, G["-"]): ("REDUCE", G["term -> term * factor"]), + (42, G["in"]): ("REDUCE", G["term -> term * factor"]), (43, G["."]): ("SHIFT", 44), + (43, G[","]): ("REDUCE", G["factor -> atom"]), + (43, G["then"]): ("REDUCE", G["factor -> atom"]), + (43, G[";"]): ("REDUCE", G["factor -> atom"]), + (43, G["else"]): ("REDUCE", G["factor -> atom"]), + (43, G["+"]): ("REDUCE", G["factor -> atom"]), + (43, G["of"]): ("REDUCE", G["factor -> atom"]), + (43, G["-"]): ("REDUCE", G["factor -> atom"]), + (43, G["fi"]): ("REDUCE", G["factor -> atom"]), (43, G["*"]): ("REDUCE", G["factor -> atom"]), (43, G["}"]): ("REDUCE", G["factor -> atom"]), (43, G["/"]): ("REDUCE", G["factor -> atom"]), - (43, G["loop"]): ("REDUCE", G["factor -> atom"]), (43, G["<"]): ("REDUCE", G["factor -> atom"]), + (43, G["loop"]): ("REDUCE", G["factor -> atom"]), (43, G["<="]): ("REDUCE", G["factor -> atom"]), (43, G["pool"]): ("REDUCE", G["factor -> atom"]), (43, G[")"]): ("REDUCE", G["factor -> atom"]), (43, G["="]): ("REDUCE", G["factor -> atom"]), - (43, G["fi"]): ("REDUCE", G["factor -> atom"]), - (43, G["in"]): ("REDUCE", G["factor -> atom"]), - (43, G[","]): ("REDUCE", G["factor -> atom"]), - (43, G["then"]): ("REDUCE", G["factor -> atom"]), - (43, G[";"]): ("REDUCE", G["factor -> atom"]), - (43, G["+"]): ("REDUCE", G["factor -> atom"]), - (43, G["else"]): ("REDUCE", G["factor -> atom"]), - (43, G["of"]): ("REDUCE", G["factor -> atom"]), (43, G["error"]): ("REDUCE", G["factor -> atom"]), - (43, G["-"]): ("REDUCE", G["factor -> atom"]), + (43, G["in"]): ("REDUCE", G["factor -> atom"]), (43, G["@"]): ("SHIFT", 57), (44, G["id"]): ("SHIFT", 45), (45, G["("]): ("SHIFT", 46), - (46, G["if"]): ("SHIFT", 12), + (46, G["string"]): ("SHIFT", 33), + (46, G["id"]): ("SHIFT", 31), (46, G["true"]): ("SHIFT", 25), + (46, G["isvoid"]): ("SHIFT", 24), + (46, G["int"]): ("SHIFT", 34), (46, G["case"]): ("SHIFT", 21), - (46, G["("]): ("SHIFT", 11), (46, G["false"]): ("SHIFT", 26), - (46, G["string"]): ("SHIFT", 33), - (46, G["int"]): ("SHIFT", 34), - (46, G["~"]): ("SHIFT", 27), - (46, G["new"]): ("SHIFT", 22), - (46, G["let"]): ("SHIFT", 14), (46, G["while"]): ("SHIFT", 13), + (46, G["if"]): ("SHIFT", 12), + (46, G["let"]): ("SHIFT", 14), + (46, G["~"]): ("SHIFT", 27), (46, G["not"]): ("SHIFT", 30), - (46, G["id"]): ("SHIFT", 31), - (46, G["isvoid"]): ("SHIFT", 24), - (46, G[")"]): ("REDUCE", G["expr-list -> e"]), + (46, G["("]): ("SHIFT", 11), (46, G["{"]): ("SHIFT", 10), + (46, G[")"]): ("REDUCE", G["expr-list -> e"]), + (46, G["new"]): ("SHIFT", 22), (47, G[")"]): ("SHIFT", 48), + (48, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (49, G[")"]): ("REDUCE", G["expr-list -> not-empty-expr-list"]), - (50, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), (50, G[","]): ("SHIFT", 51), - (51, G["if"]): ("SHIFT", 12), + (50, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), + (51, G["string"]): ("SHIFT", 33), + (51, G["id"]): ("SHIFT", 31), (51, G["true"]): ("SHIFT", 25), + (51, G["isvoid"]): ("SHIFT", 24), + (51, G["int"]): ("SHIFT", 34), (51, G["case"]): ("SHIFT", 21), - (51, G["("]): ("SHIFT", 11), (51, G["false"]): ("SHIFT", 26), - (51, G["string"]): ("SHIFT", 33), - (51, G["int"]): ("SHIFT", 34), - (51, G["~"]): ("SHIFT", 27), - (51, G["new"]): ("SHIFT", 22), - (51, G["let"]): ("SHIFT", 14), (51, G["while"]): ("SHIFT", 13), + (51, G["if"]): ("SHIFT", 12), + (51, G["let"]): ("SHIFT", 14), + (51, G["~"]): ("SHIFT", 27), (51, G["not"]): ("SHIFT", 30), - (51, G["id"]): ("SHIFT", 31), - (51, G["isvoid"]): ("SHIFT", 24), + (51, G["("]): ("SHIFT", 11), (51, G["{"]): ("SHIFT", 10), + (51, G["new"]): ("SHIFT", 22), (52, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr , not-empty-expr-list"]), (53, G["*"]): ("SHIFT", 41), - (53, G["/"]): ("SHIFT", 54), - (53, G["}"]): ("REDUCE", G["arith -> term"]), - (53, G["loop"]): ("REDUCE", G["arith -> term"]), - (53, G["<"]): ("REDUCE", G["arith -> term"]), - (53, G["pool"]): ("REDUCE", G["arith -> term"]), - (53, G["<="]): ("REDUCE", G["arith -> term"]), - (53, G[")"]): ("REDUCE", G["arith -> term"]), - (53, G["="]): ("REDUCE", G["arith -> term"]), - (53, G["fi"]): ("REDUCE", G["arith -> term"]), - (53, G["in"]): ("REDUCE", G["arith -> term"]), (53, G[","]): ("REDUCE", G["arith -> term"]), (53, G["then"]): ("REDUCE", G["arith -> term"]), (53, G[";"]): ("REDUCE", G["arith -> term"]), + (53, G["else"]): ("REDUCE", G["arith -> term"]), (53, G["+"]): ("REDUCE", G["arith -> term"]), (53, G["of"]): ("REDUCE", G["arith -> term"]), - (53, G["else"]): ("REDUCE", G["arith -> term"]), - (53, G["error"]): ("REDUCE", G["arith -> term"]), (53, G["-"]): ("REDUCE", G["arith -> term"]), + (53, G["fi"]): ("REDUCE", G["arith -> term"]), + (53, G["}"]): ("REDUCE", G["arith -> term"]), + (53, G["<"]): ("REDUCE", G["arith -> term"]), + (53, G["loop"]): ("REDUCE", G["arith -> term"]), + (53, G["<="]): ("REDUCE", G["arith -> term"]), + (53, G["pool"]): ("REDUCE", G["arith -> term"]), + (53, G["="]): ("REDUCE", G["arith -> term"]), + (53, G[")"]): ("REDUCE", G["arith -> term"]), + (53, G["error"]): ("REDUCE", G["arith -> term"]), + (53, G["in"]): ("REDUCE", G["arith -> term"]), + (53, G["/"]): ("SHIFT", 54), + (54, G["false"]): ("SHIFT", 26), + (54, G["~"]): ("SHIFT", 27), (54, G["true"]): ("SHIFT", 25), + (54, G["string"]): ("SHIFT", 33), (54, G["int"]): ("SHIFT", 34), (54, G["id"]): ("SHIFT", 28), - (54, G["~"]): ("SHIFT", 27), - (54, G["string"]): ("SHIFT", 33), - (54, G["false"]): ("SHIFT", 26), (54, G["("]): ("SHIFT", 11), - (54, G["new"]): ("SHIFT", 22), (54, G["isvoid"]): ("SHIFT", 24), + (54, G["new"]): ("SHIFT", 22), + (55, G[","]): ("REDUCE", G["term -> term / factor"]), + (55, G["then"]): ("REDUCE", G["term -> term / factor"]), + (55, G[";"]): ("REDUCE", G["term -> term / factor"]), + (55, G["else"]): ("REDUCE", G["term -> term / factor"]), + (55, G["+"]): ("REDUCE", G["term -> term / factor"]), + (55, G["of"]): ("REDUCE", G["term -> term / factor"]), + (55, G["-"]): ("REDUCE", G["term -> term / factor"]), + (55, G["fi"]): ("REDUCE", G["term -> term / factor"]), (55, G["*"]): ("REDUCE", G["term -> term / factor"]), (55, G["}"]): ("REDUCE", G["term -> term / factor"]), (55, G["/"]): ("REDUCE", G["term -> term / factor"]), - (55, G["loop"]): ("REDUCE", G["term -> term / factor"]), (55, G["<"]): ("REDUCE", G["term -> term / factor"]), - (55, G["pool"]): ("REDUCE", G["term -> term / factor"]), + (55, G["loop"]): ("REDUCE", G["term -> term / factor"]), (55, G["<="]): ("REDUCE", G["term -> term / factor"]), + (55, G["pool"]): ("REDUCE", G["term -> term / factor"]), (55, G[")"]): ("REDUCE", G["term -> term / factor"]), (55, G["="]): ("REDUCE", G["term -> term / factor"]), - (55, G["fi"]): ("REDUCE", G["term -> term / factor"]), - (55, G["in"]): ("REDUCE", G["term -> term / factor"]), - (55, G[","]): ("REDUCE", G["term -> term / factor"]), - (55, G["then"]): ("REDUCE", G["term -> term / factor"]), - (55, G[";"]): ("REDUCE", G["term -> term / factor"]), - (55, G["+"]): ("REDUCE", G["term -> term / factor"]), - (55, G["else"]): ("REDUCE", G["term -> term / factor"]), - (55, G["of"]): ("REDUCE", G["term -> term / factor"]), (55, G["error"]): ("REDUCE", G["term -> term / factor"]), - (55, G["-"]): ("REDUCE", G["term -> term / factor"]), + (55, G["in"]): ("REDUCE", G["term -> term / factor"]), + (56, G[","]): ("REDUCE", G["term -> factor"]), + (56, G["then"]): ("REDUCE", G["term -> factor"]), + (56, G[";"]): ("REDUCE", G["term -> factor"]), + (56, G["else"]): ("REDUCE", G["term -> factor"]), + (56, G["+"]): ("REDUCE", G["term -> factor"]), + (56, G["of"]): ("REDUCE", G["term -> factor"]), + (56, G["-"]): ("REDUCE", G["term -> factor"]), + (56, G["fi"]): ("REDUCE", G["term -> factor"]), (56, G["*"]): ("REDUCE", G["term -> factor"]), (56, G["}"]): ("REDUCE", G["term -> factor"]), (56, G["/"]): ("REDUCE", G["term -> factor"]), - (56, G["loop"]): ("REDUCE", G["term -> factor"]), (56, G["<"]): ("REDUCE", G["term -> factor"]), + (56, G["loop"]): ("REDUCE", G["term -> factor"]), (56, G["<="]): ("REDUCE", G["term -> factor"]), (56, G["pool"]): ("REDUCE", G["term -> factor"]), (56, G[")"]): ("REDUCE", G["term -> factor"]), (56, G["="]): ("REDUCE", G["term -> factor"]), - (56, G["fi"]): ("REDUCE", G["term -> factor"]), - (56, G["in"]): ("REDUCE", G["term -> factor"]), - (56, G[","]): ("REDUCE", G["term -> factor"]), - (56, G["then"]): ("REDUCE", G["term -> factor"]), - (56, G[";"]): ("REDUCE", G["term -> factor"]), - (56, G["+"]): ("REDUCE", G["term -> factor"]), - (56, G["else"]): ("REDUCE", G["term -> factor"]), - (56, G["of"]): ("REDUCE", G["term -> factor"]), (56, G["error"]): ("REDUCE", G["term -> factor"]), - (56, G["-"]): ("REDUCE", G["term -> factor"]), + (56, G["in"]): ("REDUCE", G["term -> factor"]), (57, G["type"]): ("SHIFT", 58), (58, G["."]): ("SHIFT", 59), (59, G["id"]): ("SHIFT", 60), (60, G["("]): ("SHIFT", 61), - (61, G["if"]): ("SHIFT", 12), + (61, G["string"]): ("SHIFT", 33), + (61, G["id"]): ("SHIFT", 31), (61, G["true"]): ("SHIFT", 25), + (61, G["isvoid"]): ("SHIFT", 24), + (61, G["int"]): ("SHIFT", 34), (61, G["case"]): ("SHIFT", 21), - (61, G["("]): ("SHIFT", 11), (61, G["false"]): ("SHIFT", 26), - (61, G["string"]): ("SHIFT", 33), - (61, G["int"]): ("SHIFT", 34), - (61, G["~"]): ("SHIFT", 27), - (61, G["new"]): ("SHIFT", 22), - (61, G["let"]): ("SHIFT", 14), (61, G["while"]): ("SHIFT", 13), + (61, G["if"]): ("SHIFT", 12), + (61, G["let"]): ("SHIFT", 14), + (61, G["~"]): ("SHIFT", 27), (61, G["not"]): ("SHIFT", 30), - (61, G["id"]): ("SHIFT", 31), - (61, G["isvoid"]): ("SHIFT", 24), - (61, G[")"]): ("REDUCE", G["expr-list -> e"]), + (61, G["("]): ("SHIFT", 11), (61, G["{"]): ("SHIFT", 10), + (61, G[")"]): ("REDUCE", G["expr-list -> e"]), + (61, G["new"]): ("SHIFT", 22), (62, G[")"]): ("SHIFT", 63), + (63, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (64, G["true"]): ("SHIFT", 25), + (64, G["string"]): ("SHIFT", 33), + (64, G["new"]): ("SHIFT", 22), + (64, G["false"]): ("SHIFT", 26), (64, G["~"]): ("SHIFT", 27), (64, G["id"]): ("SHIFT", 28), - (64, G["new"]): ("SHIFT", 22), - (64, G["isvoid"]): ("SHIFT", 24), - (64, G["int"]): ("SHIFT", 34), - (64, G["string"]): ("SHIFT", 33), (64, G["("]): ("SHIFT", 11), - (64, G["false"]): ("SHIFT", 26), + (64, G["int"]): ("SHIFT", 34), + (64, G["isvoid"]): ("SHIFT", 24), (65, G["*"]): ("SHIFT", 41), - (65, G["}"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["loop"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["<"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["pool"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["<="]): ("REDUCE", G["arith -> arith - term"]), - (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["="]): ("REDUCE", G["arith -> arith - term"]), - (65, G["fi"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), (65, G[","]): ("REDUCE", G["arith -> arith - term"]), (65, G["then"]): ("REDUCE", G["arith -> arith - term"]), (65, G[";"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["else"]): ("REDUCE", G["arith -> arith - term"]), (65, G["+"]): ("REDUCE", G["arith -> arith - term"]), (65, G["of"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["else"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["error"]): ("REDUCE", G["arith -> arith - term"]), (65, G["-"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["fi"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["}"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["<"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["loop"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["<="]): ("REDUCE", G["arith -> arith - term"]), + (65, G["pool"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["="]): ("REDUCE", G["arith -> arith - term"]), + (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["error"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), (65, G["/"]): ("SHIFT", 54), (66, G["("]): ("SHIFT", 11), - (66, G["false"]): ("SHIFT", 26), - (66, G["true"]): ("SHIFT", 25), (66, G["id"]): ("SHIFT", 28), (66, G["int"]): ("SHIFT", 34), - (66, G["~"]): ("SHIFT", 27), - (66, G["string"]): ("SHIFT", 33), - (66, G["new"]): ("SHIFT", 22), + (66, G["false"]): ("SHIFT", 26), (66, G["isvoid"]): ("SHIFT", 24), - (67, G["-"]): ("SHIFT", 64), + (66, G["new"]): ("SHIFT", 22), + (66, G["string"]): ("SHIFT", 33), + (66, G["~"]): ("SHIFT", 27), + (66, G["true"]): ("SHIFT", 25), (67, G["+"]): ("SHIFT", 39), - (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["in"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["}"]): ("REDUCE", G["comp -> arith < arith"]), (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["else"]): ("REDUCE", G["comp -> arith < arith"]), (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["in"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["-"]): ("SHIFT", 64), (68, G["("]): ("SHIFT", 11), - (68, G["false"]): ("SHIFT", 26), - (68, G["true"]): ("SHIFT", 25), (68, G["id"]): ("SHIFT", 28), (68, G["int"]): ("SHIFT", 34), - (68, G["~"]): ("SHIFT", 27), - (68, G["string"]): ("SHIFT", 33), - (68, G["new"]): ("SHIFT", 22), + (68, G["false"]): ("SHIFT", 26), (68, G["isvoid"]): ("SHIFT", 24), - (69, G["-"]): ("SHIFT", 64), + (68, G["new"]): ("SHIFT", 22), + (68, G["string"]): ("SHIFT", 33), + (68, G["~"]): ("SHIFT", 27), + (68, G["true"]): ("SHIFT", 25), (69, G["+"]): ("SHIFT", 39), - (69, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["-"]): ("SHIFT", 64), (70, G["("]): ("SHIFT", 11), - (70, G["false"]): ("SHIFT", 26), - (70, G["true"]): ("SHIFT", 25), (70, G["id"]): ("SHIFT", 28), (70, G["int"]): ("SHIFT", 34), - (70, G["~"]): ("SHIFT", 27), - (70, G["string"]): ("SHIFT", 33), - (70, G["new"]): ("SHIFT", 22), + (70, G["false"]): ("SHIFT", 26), (70, G["isvoid"]): ("SHIFT", 24), - (71, G["error"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["in"]): ("REDUCE", G["comp -> arith = arith"]), + (70, G["new"]): ("SHIFT", 22), + (70, G["string"]): ("SHIFT", 33), + (70, G["~"]): ("SHIFT", 27), + (70, G["true"]): ("SHIFT", 25), + (71, G["+"]): ("SHIFT", 39), + (71, G["-"]): ("SHIFT", 64), (71, G["}"]): ("REDUCE", G["comp -> arith = arith"]), (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), (71, G[";"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["else"]): ("REDUCE", G["comp -> arith = arith"]), (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["-"]): ("SHIFT", 64), - (71, G["+"]): ("SHIFT", 39), - (72, G["in"]): ("REDUCE", G["expr -> not expr"]), + (71, G["error"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["in"]): ("REDUCE", G["comp -> arith = arith"]), (72, G["}"]): ("REDUCE", G["expr -> not expr"]), (72, G[","]): ("REDUCE", G["expr -> not expr"]), - (72, G[")"]): ("REDUCE", G["expr -> not expr"]), - (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), (72, G["then"]): ("REDUCE", G["expr -> not expr"]), + (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), (72, G[";"]): ("REDUCE", G["expr -> not expr"]), - (72, G["of"]): ("REDUCE", G["expr -> not expr"]), (72, G["pool"]): ("REDUCE", G["expr -> not expr"]), (72, G["else"]): ("REDUCE", G["expr -> not expr"]), - (72, G["error"]): ("REDUCE", G["expr -> not expr"]), + (72, G[")"]): ("REDUCE", G["expr -> not expr"]), + (72, G["of"]): ("REDUCE", G["expr -> not expr"]), (72, G["fi"]): ("REDUCE", G["expr -> not expr"]), + (72, G["error"]): ("REDUCE", G["expr -> not expr"]), + (72, G["in"]): ("REDUCE", G["expr -> not expr"]), (73, G[")"]): ("SHIFT", 74), + (74, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), @@ -779,563 +789,580 @@ def __action_table(): (74, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G[","]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["then"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G[";"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["else"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["+"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["of"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["-"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["*"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["}"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["/"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["<"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["<="]): ("REDUCE", G["factor -> ~ factor"]), (75, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), (75, G[")"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["="]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G[","]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["then"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["-"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G[";"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["+"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["else"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["of"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), + (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), (77, G["of"]): ("SHIFT", 78), (78, G["id"]): ("SHIFT", 79), (79, G[":"]): ("SHIFT", 80), (80, G["type"]): ("SHIFT", 81), (81, G["=>"]): ("SHIFT", 82), - (82, G["true"]): ("SHIFT", 25), - (82, G["case"]): ("SHIFT", 21), - (82, G["false"]): ("SHIFT", 26), + (82, G["while"]): ("SHIFT", 13), + (82, G["isvoid"]): ("SHIFT", 24), + (82, G["("]): ("SHIFT", 11), (82, G["id"]): ("SHIFT", 31), - (82, G["int"]): ("SHIFT", 34), + (82, G["not"]): ("SHIFT", 30), + (82, G["true"]): ("SHIFT", 25), + (82, G["string"]): ("SHIFT", 33), + (82, G["~"]): ("SHIFT", 27), (82, G["{"]): ("SHIFT", 10), (82, G["new"]): ("SHIFT", 22), + (82, G["int"]): ("SHIFT", 34), + (82, G["case"]): ("SHIFT", 21), (82, G["let"]): ("SHIFT", 14), (82, G["if"]): ("SHIFT", 12), - (82, G["("]): ("SHIFT", 11), - (82, G["isvoid"]): ("SHIFT", 24), - (82, G["string"]): ("SHIFT", 33), - (82, G["~"]): ("SHIFT", 27), - (82, G["while"]): ("SHIFT", 13), - (82, G["not"]): ("SHIFT", 30), - (83, G[";"]): ("SHIFT", 84), + (82, G["false"]): ("SHIFT", 26), (83, G["error"]): ("SHIFT", 86), - (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), + (83, G[";"]): ("SHIFT", 84), (84, G["id"]): ("SHIFT", 79), + (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), + (86, G["id"]): ("SHIFT", 79), (86, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), - (87, G["esac"]): ("SHIFT", 88), - (88, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (88, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G[","]): ("SHIFT", 90), - (89, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), - (90, G["id"]): ("SHIFT", 15), - (91, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), - (92, G["in"]): ("SHIFT", 93), - (93, G["let"]): ("SHIFT", 14), - (93, G["while"]): ("SHIFT", 13), - (93, G["not"]): ("SHIFT", 30), - (93, G["~"]): ("SHIFT", 27), - (93, G["id"]): ("SHIFT", 31), - (93, G["string"]): ("SHIFT", 33), - (93, G["if"]): ("SHIFT", 12), - (93, G["false"]): ("SHIFT", 26), - (93, G["true"]): ("SHIFT", 25), - (93, G["{"]): ("SHIFT", 10), - (93, G["new"]): ("SHIFT", 22), - (93, G["isvoid"]): ("SHIFT", 24), - (93, G["int"]): ("SHIFT", 34), - (93, G["case"]): ("SHIFT", 21), - (93, G["("]): ("SHIFT", 11), - (94, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (94, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["loop"]): ("SHIFT", 96), - (96, G["if"]): ("SHIFT", 12), - (96, G["true"]): ("SHIFT", 25), - (96, G["("]): ("SHIFT", 11), - (96, G["false"]): ("SHIFT", 26), - (96, G["case"]): ("SHIFT", 21), - (96, G["new"]): ("SHIFT", 22), - (96, G["id"]): ("SHIFT", 31), - (96, G["let"]): ("SHIFT", 14), - (96, G["string"]): ("SHIFT", 33), - (96, G["not"]): ("SHIFT", 30), - (96, G["while"]): ("SHIFT", 13), - (96, G["int"]): ("SHIFT", 34), - (96, G["~"]): ("SHIFT", 27), - (96, G["isvoid"]): ("SHIFT", 24), - (96, G["{"]): ("SHIFT", 10), - (97, G["pool"]): ("SHIFT", 98), - (98, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (98, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["then"]): ("SHIFT", 100), - (100, G["id"]): ("SHIFT", 31), - (100, G["isvoid"]): ("SHIFT", 24), - (100, G["case"]): ("SHIFT", 21), - (100, G["if"]): ("SHIFT", 12), - (100, G["{"]): ("SHIFT", 10), - (100, G["let"]): ("SHIFT", 14), - (100, G["new"]): ("SHIFT", 22), - (100, G["string"]): ("SHIFT", 33), - (100, G["~"]): ("SHIFT", 27), - (100, G["int"]): ("SHIFT", 34), - (100, G["true"]): ("SHIFT", 25), - (100, G["false"]): ("SHIFT", 26), - (100, G["("]): ("SHIFT", 11), - (100, G["while"]): ("SHIFT", 13), - (100, G["not"]): ("SHIFT", 30), - (101, G["else"]): ("SHIFT", 102), - (102, G["id"]): ("SHIFT", 31), - (102, G["not"]): ("SHIFT", 30), - (102, G["while"]): ("SHIFT", 13), - (102, G["string"]): ("SHIFT", 33), - (102, G["~"]): ("SHIFT", 27), - (102, G["case"]): ("SHIFT", 21), - (102, G["int"]): ("SHIFT", 34), - (102, G["if"]): ("SHIFT", 12), - (102, G["new"]): ("SHIFT", 22), - (102, G["{"]): ("SHIFT", 10), - (102, G["let"]): ("SHIFT", 14), - (102, G["true"]): ("SHIFT", 25), - (102, G["isvoid"]): ("SHIFT", 24), - (102, G["false"]): ("SHIFT", 26), - (102, G["("]): ("SHIFT", 11), - (103, G["fi"]): ("SHIFT", 104), - (104, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (104, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G[")"]): ("SHIFT", 106), - (106, G["*"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["}"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["/"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["<"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["<="]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G[")"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["="]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["."]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["in"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G[","]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["then"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["-"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G[";"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["@"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["+"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["else"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["of"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["error"]): ("REDUCE", G["atom -> ( expr )"]), - (106, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["}"]): ("SHIFT", 108), - (108, G["error"]): ("REDUCE", G["expr -> { block }"]), - (108, G["in"]): ("REDUCE", G["expr -> { block }"]), - (108, G["}"]): ("REDUCE", G["expr -> { block }"]), - (108, G[","]): ("REDUCE", G["expr -> { block }"]), - (108, G["loop"]): ("REDUCE", G["expr -> { block }"]), - (108, G["then"]): ("REDUCE", G["expr -> { block }"]), - (108, G[";"]): ("REDUCE", G["expr -> { block }"]), - (108, G["of"]): ("REDUCE", G["expr -> { block }"]), - (108, G["pool"]): ("REDUCE", G["expr -> { block }"]), - (108, G["else"]): ("REDUCE", G["expr -> { block }"]), - (108, G[")"]): ("REDUCE", G["expr -> { block }"]), - (108, G["fi"]): ("REDUCE", G["expr -> { block }"]), - (109, G[";"]): ("SHIFT", 110), - (109, G["error"]): ("SHIFT", 112), - (110, G["true"]): ("SHIFT", 25), - (110, G["case"]): ("SHIFT", 21), - (110, G["false"]): ("SHIFT", 26), - (110, G["id"]): ("SHIFT", 31), - (110, G["int"]): ("SHIFT", 34), - (110, G["{"]): ("SHIFT", 10), - (110, G["new"]): ("SHIFT", 22), - (110, G["let"]): ("SHIFT", 14), - (110, G["if"]): ("SHIFT", 12), - (110, G["("]): ("SHIFT", 11), - (110, G["isvoid"]): ("SHIFT", 24), - (110, G["string"]): ("SHIFT", 33), - (110, G["~"]): ("SHIFT", 27), - (110, G["}"]): ("REDUCE", G["block -> expr ;"]), - (110, G["while"]): ("SHIFT", 13), - (110, G["not"]): ("SHIFT", 30), - (111, G["}"]): ("REDUCE", G["block -> expr ; block"]), - (112, G["}"]): ("REDUCE", G["block -> expr error"]), - (113, G["}"]): ("SHIFT", 114), - (114, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), - (114, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), - (115, G[":"]): ("SHIFT", 116), - (116, G["type"]): ("SHIFT", 117), - (117, G[","]): ("SHIFT", 118), - (117, G[")"]): ("REDUCE", G["param-list -> id : type"]), - (118, G["id"]): ("SHIFT", 115), - (119, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), - (120, G[")"]): ("SHIFT", 121), - (121, G[":"]): ("SHIFT", 122), - (122, G["type"]): ("SHIFT", 123), - (123, G["{"]): ("SHIFT", 124), - (124, G["case"]): ("SHIFT", 21), - (124, G["("]): ("SHIFT", 11), - (124, G["string"]): ("SHIFT", 33), - (124, G["~"]): ("SHIFT", 27), - (124, G["id"]): ("SHIFT", 31), - (124, G["not"]): ("SHIFT", 30), - (124, G["while"]): ("SHIFT", 13), - (124, G["true"]): ("SHIFT", 25), - (124, G["isvoid"]): ("SHIFT", 24), - (124, G["if"]): ("SHIFT", 12), - (124, G["false"]): ("SHIFT", 26), - (124, G["let"]): ("SHIFT", 14), - (124, G["{"]): ("SHIFT", 10), - (124, G["int"]): ("SHIFT", 34), - (124, G["new"]): ("SHIFT", 22), - (125, G["}"]): ("SHIFT", 126), - (126, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), - (126, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), - (127, G["type"]): ("SHIFT", 128), - (128, G["<-"]): ("SHIFT", 129), - (128, G["error"]): ("REDUCE", G["attribute -> id : type"]), - (128, G[";"]): ("REDUCE", G["attribute -> id : type"]), - (129, G["true"]): ("SHIFT", 25), - (129, G["case"]): ("SHIFT", 21), - (129, G["false"]): ("SHIFT", 26), - (129, G["id"]): ("SHIFT", 31), - (129, G["int"]): ("SHIFT", 34), - (129, G["{"]): ("SHIFT", 10), - (129, G["new"]): ("SHIFT", 22), - (129, G["let"]): ("SHIFT", 14), - (129, G["if"]): ("SHIFT", 12), - (129, G["("]): ("SHIFT", 11), - (129, G["isvoid"]): ("SHIFT", 24), - (129, G["string"]): ("SHIFT", 33), - (129, G["~"]): ("SHIFT", 27), - (129, G["while"]): ("SHIFT", 13), - (129, G["not"]): ("SHIFT", 30), - (130, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), - (130, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), - (131, G["}"]): ("SHIFT", 132), - (132, G["class"]): ("REDUCE", G["class-def -> class type { feature-list }"]), - (132, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), - (133, G["error"]): ("SHIFT", 141), - (133, G[";"]): ("SHIFT", 134), - (134, G["id"]): ("SHIFT", 4), - (134, G["}"]): ("REDUCE", G["feature-list -> e"]), - (135, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), - (136, G["error"]): ("SHIFT", 139), - (136, G[";"]): ("SHIFT", 137), - (137, G["id"]): ("SHIFT", 4), - (137, G["}"]): ("REDUCE", G["feature-list -> e"]), - (138, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), + (87, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error case-list"]), + (88, G["esac"]): ("SHIFT", 89), + (89, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (90, G[","]): ("SHIFT", 91), + (90, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), + (91, G["id"]): ("SHIFT", 15), + (92, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), + (93, G["in"]): ("SHIFT", 94), + (94, G["if"]): ("SHIFT", 12), + (94, G["while"]): ("SHIFT", 13), + (94, G["new"]): ("SHIFT", 22), + (94, G["false"]): ("SHIFT", 26), + (94, G["not"]): ("SHIFT", 30), + (94, G["int"]): ("SHIFT", 34), + (94, G["isvoid"]): ("SHIFT", 24), + (94, G["id"]): ("SHIFT", 31), + (94, G["true"]): ("SHIFT", 25), + (94, G["{"]): ("SHIFT", 10), + (94, G["string"]): ("SHIFT", 33), + (94, G["case"]): ("SHIFT", 21), + (94, G["~"]): ("SHIFT", 27), + (94, G["("]): ("SHIFT", 11), + (94, G["let"]): ("SHIFT", 14), + (95, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (96, G["loop"]): ("SHIFT", 97), + (97, G["not"]): ("SHIFT", 30), + (97, G["string"]): ("SHIFT", 33), + (97, G["new"]): ("SHIFT", 22), + (97, G["int"]): ("SHIFT", 34), + (97, G["let"]): ("SHIFT", 14), + (97, G["~"]): ("SHIFT", 27), + (97, G["case"]): ("SHIFT", 21), + (97, G["false"]): ("SHIFT", 26), + (97, G["("]): ("SHIFT", 11), + (97, G["id"]): ("SHIFT", 31), + (97, G["if"]): ("SHIFT", 12), + (97, G["isvoid"]): ("SHIFT", 24), + (97, G["while"]): ("SHIFT", 13), + (97, G["{"]): ("SHIFT", 10), + (97, G["true"]): ("SHIFT", 25), + (98, G["pool"]): ("SHIFT", 99), + (99, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (100, G["then"]): ("SHIFT", 101), + (101, G["int"]): ("SHIFT", 34), + (101, G["let"]): ("SHIFT", 14), + (101, G["~"]): ("SHIFT", 27), + (101, G["if"]): ("SHIFT", 12), + (101, G["while"]): ("SHIFT", 13), + (101, G["true"]): ("SHIFT", 25), + (101, G["string"]): ("SHIFT", 33), + (101, G["not"]): ("SHIFT", 30), + (101, G["("]): ("SHIFT", 11), + (101, G["id"]): ("SHIFT", 31), + (101, G["{"]): ("SHIFT", 10), + (101, G["isvoid"]): ("SHIFT", 24), + (101, G["case"]): ("SHIFT", 21), + (101, G["new"]): ("SHIFT", 22), + (101, G["false"]): ("SHIFT", 26), + (102, G["else"]): ("SHIFT", 103), + (103, G["isvoid"]): ("SHIFT", 24), + (103, G["("]): ("SHIFT", 11), + (103, G["id"]): ("SHIFT", 31), + (103, G["if"]): ("SHIFT", 12), + (103, G["new"]): ("SHIFT", 22), + (103, G["{"]): ("SHIFT", 10), + (103, G["false"]): ("SHIFT", 26), + (103, G["while"]): ("SHIFT", 13), + (103, G["not"]): ("SHIFT", 30), + (103, G["int"]): ("SHIFT", 34), + (103, G["case"]): ("SHIFT", 21), + (103, G["~"]): ("SHIFT", 27), + (103, G["string"]): ("SHIFT", 33), + (103, G["true"]): ("SHIFT", 25), + (103, G["let"]): ("SHIFT", 14), + (104, G["fi"]): ("SHIFT", 105), + (105, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (106, G[")"]): ("SHIFT", 107), + (107, G[","]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["then"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G[";"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["."]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["@"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["+"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["else"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["of"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["-"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["*"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["}"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["/"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["<"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["<="]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G[")"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["="]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["error"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["in"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["}"]): ("SHIFT", 109), + (109, G["}"]): ("REDUCE", G["expr -> { block }"]), + (109, G[","]): ("REDUCE", G["expr -> { block }"]), + (109, G["then"]): ("REDUCE", G["expr -> { block }"]), + (109, G["loop"]): ("REDUCE", G["expr -> { block }"]), + (109, G[";"]): ("REDUCE", G["expr -> { block }"]), + (109, G["pool"]): ("REDUCE", G["expr -> { block }"]), + (109, G["else"]): ("REDUCE", G["expr -> { block }"]), + (109, G[")"]): ("REDUCE", G["expr -> { block }"]), + (109, G["of"]): ("REDUCE", G["expr -> { block }"]), + (109, G["fi"]): ("REDUCE", G["expr -> { block }"]), + (109, G["error"]): ("REDUCE", G["expr -> { block }"]), + (109, G["in"]): ("REDUCE", G["expr -> { block }"]), + (110, G["error"]): ("SHIFT", 113), + (110, G[";"]): ("SHIFT", 111), + (111, G["while"]): ("SHIFT", 13), + (111, G["isvoid"]): ("SHIFT", 24), + (111, G["("]): ("SHIFT", 11), + (111, G["id"]): ("SHIFT", 31), + (111, G["not"]): ("SHIFT", 30), + (111, G["true"]): ("SHIFT", 25), + (111, G["string"]): ("SHIFT", 33), + (111, G["~"]): ("SHIFT", 27), + (111, G["{"]): ("SHIFT", 10), + (111, G["new"]): ("SHIFT", 22), + (111, G["}"]): ("REDUCE", G["block -> expr ;"]), + (111, G["int"]): ("SHIFT", 34), + (111, G["case"]): ("SHIFT", 21), + (111, G["let"]): ("SHIFT", 14), + (111, G["if"]): ("SHIFT", 12), + (111, G["false"]): ("SHIFT", 26), + (112, G["}"]): ("REDUCE", G["block -> expr ; block"]), + (113, G["while"]): ("SHIFT", 13), + (113, G["isvoid"]): ("SHIFT", 24), + (113, G["("]): ("SHIFT", 11), + (113, G["id"]): ("SHIFT", 31), + (113, G["not"]): ("SHIFT", 30), + (113, G["true"]): ("SHIFT", 25), + (113, G["string"]): ("SHIFT", 33), + (113, G["~"]): ("SHIFT", 27), + (113, G["{"]): ("SHIFT", 10), + (113, G["new"]): ("SHIFT", 22), + (113, G["}"]): ("REDUCE", G["block -> expr error"]), + (113, G["int"]): ("SHIFT", 34), + (113, G["case"]): ("SHIFT", 21), + (113, G["let"]): ("SHIFT", 14), + (113, G["if"]): ("SHIFT", 12), + (113, G["false"]): ("SHIFT", 26), + (114, G["}"]): ("REDUCE", G["block -> expr error block"]), + (115, G["}"]): ("SHIFT", 116), + (116, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (116, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (117, G[":"]): ("SHIFT", 118), + (118, G["type"]): ("SHIFT", 119), + (119, G[")"]): ("REDUCE", G["param-list -> id : type"]), + (119, G[","]): ("SHIFT", 120), + (120, G["id"]): ("SHIFT", 117), + (121, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), + (122, G[")"]): ("SHIFT", 123), + (123, G[":"]): ("SHIFT", 124), + (124, G["type"]): ("SHIFT", 125), + (125, G["{"]): ("SHIFT", 126), + (126, G["if"]): ("SHIFT", 12), + (126, G["new"]): ("SHIFT", 22), + (126, G["false"]): ("SHIFT", 26), + (126, G["isvoid"]): ("SHIFT", 24), + (126, G["("]): ("SHIFT", 11), + (126, G["not"]): ("SHIFT", 30), + (126, G["id"]): ("SHIFT", 31), + (126, G["{"]): ("SHIFT", 10), + (126, G["int"]): ("SHIFT", 34), + (126, G["~"]): ("SHIFT", 27), + (126, G["string"]): ("SHIFT", 33), + (126, G["case"]): ("SHIFT", 21), + (126, G["true"]): ("SHIFT", 25), + (126, G["let"]): ("SHIFT", 14), + (126, G["while"]): ("SHIFT", 13), + (127, G["}"]): ("SHIFT", 128), + (128, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (128, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (129, G["type"]): ("SHIFT", 130), + (130, G[";"]): ("REDUCE", G["attribute -> id : type"]), + (130, G["error"]): ("REDUCE", G["attribute -> id : type"]), + (130, G["<-"]): ("SHIFT", 131), + (131, G["while"]): ("SHIFT", 13), + (131, G["isvoid"]): ("SHIFT", 24), + (131, G["("]): ("SHIFT", 11), + (131, G["id"]): ("SHIFT", 31), + (131, G["not"]): ("SHIFT", 30), + (131, G["true"]): ("SHIFT", 25), + (131, G["string"]): ("SHIFT", 33), + (131, G["~"]): ("SHIFT", 27), + (131, G["{"]): ("SHIFT", 10), + (131, G["new"]): ("SHIFT", 22), + (131, G["int"]): ("SHIFT", 34), + (131, G["case"]): ("SHIFT", 21), + (131, G["let"]): ("SHIFT", 14), + (131, G["if"]): ("SHIFT", 12), + (131, G["false"]): ("SHIFT", 26), + (132, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (132, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (133, G["}"]): ("SHIFT", 134), + (134, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), + (134, G["class"]): ("REDUCE", G["class-def -> class type { feature-list }"]), + (135, G[";"]): ("SHIFT", 136), + (135, G["error"]): ("SHIFT", 143), + (136, G["id"]): ("SHIFT", 4), + (136, G["}"]): ("REDUCE", G["feature-list -> e"]), + (137, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), + (138, G[";"]): ("SHIFT", 139), + (138, G["error"]): ("SHIFT", 141), (139, G["id"]): ("SHIFT", 4), (139, G["}"]): ("REDUCE", G["feature-list -> e"]), - (140, G["}"]): ("REDUCE", G["feature-list -> method error feature-list"]), + (140, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), (141, G["id"]): ("SHIFT", 4), (141, G["}"]): ("REDUCE", G["feature-list -> e"]), - (142, G["}"]): ("REDUCE", G["feature-list -> attribute error feature-list"]), - (143, G["type"]): ("SHIFT", 144), - (144, G["{"]): ("SHIFT", 145), - (145, G["id"]): ("SHIFT", 4), - (145, G["}"]): ("REDUCE", G["feature-list -> e"]), - (146, G["}"]): ("SHIFT", 147), - (147, G["class"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), - (147, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), - (148, G["$"]): ("OK", None), - (149, G["$"]): ("REDUCE", G["program -> class-list"]), - (150, G["class"]): ("SHIFT", 1), - (150, G["$"]): ("REDUCE", G["class-list -> class-def"]), - (151, G["$"]): ("REDUCE", G["class-list -> class-def class-list"]), + (142, G["}"]): ("REDUCE", G["feature-list -> method error feature-list"]), + (143, G["id"]): ("SHIFT", 4), + (143, G["}"]): ("REDUCE", G["feature-list -> e"]), + (144, G["}"]): ("REDUCE", G["feature-list -> attribute error feature-list"]), + (145, G["type"]): ("SHIFT", 146), + (146, G["{"]): ("SHIFT", 147), + (147, G["id"]): ("SHIFT", 4), + (147, G["}"]): ("REDUCE", G["feature-list -> e"]), + (148, G["}"]): ("SHIFT", 149), + (149, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), + (149, G["class"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), + (150, G["$"]): ("OK", None), + (151, G["$"]): ("REDUCE", G["program -> class-list"]), + (152, G["class"]): ("SHIFT", 1), + (152, G["$"]): ("REDUCE", G["class-list -> class-def"]), + (153, G["$"]): ("REDUCE", G["class-list -> class-def class-list"]), } @staticmethod def __goto_table(): return { - (0, G["class-list"]): 149, - (0, G["class-def"]): 150, - (0, G["program"]): 148, - (3, G["attribute"]): 133, - (3, G["method"]): 136, - (3, G["feature-list"]): 131, - (5, G["param-list"]): 120, + (0, G["class-list"]): 151, + (0, G["class-def"]): 152, + (0, G["program"]): 150, + (3, G["attribute"]): 135, + (3, G["method"]): 138, + (3, G["feature-list"]): 133, + (5, G["param-list"]): 122, + (9, G["atom"]): 43, + (9, G["comp"]): 37, (9, G["arith"]): 38, - (9, G["expr"]): 113, (9, G["term"]): 53, - (9, G["comp"]): 37, - (9, G["function-call"]): 35, - (9, G["atom"]): 43, (9, G["factor"]): 56, + (9, G["expr"]): 115, + (9, G["function-call"]): 35, (10, G["atom"]): 43, (10, G["arith"]): 38, - (10, G["expr"]): 109, + (10, G["comp"]): 37, + (10, G["block"]): 108, (10, G["term"]): 53, + (10, G["expr"]): 110, (10, G["factor"]): 56, - (10, G["block"]): 107, - (10, G["comp"]): 37, (10, G["function-call"]): 35, - (11, G["atom"]): 43, - (11, G["arith"]): 38, - (11, G["function-call"]): 35, (11, G["term"]): 53, + (11, G["atom"]): 43, (11, G["factor"]): 56, - (11, G["expr"]): 105, + (11, G["arith"]): 38, (11, G["comp"]): 37, - (12, G["term"]): 53, + (11, G["function-call"]): 35, + (11, G["expr"]): 106, (12, G["arith"]): 38, - (12, G["expr"]): 99, + (12, G["term"]): 53, (12, G["atom"]): 43, + (12, G["function-call"]): 35, (12, G["factor"]): 56, + (12, G["expr"]): 100, (12, G["comp"]): 37, - (12, G["function-call"]): 35, - (13, G["arith"]): 38, (13, G["factor"]): 56, + (13, G["comp"]): 37, (13, G["term"]): 53, + (13, G["arith"]): 38, (13, G["atom"]): 43, (13, G["function-call"]): 35, - (13, G["comp"]): 37, - (13, G["expr"]): 95, - (14, G["declaration-list"]): 92, + (13, G["expr"]): 96, + (14, G["declaration-list"]): 93, (18, G["declaration-list"]): 19, + (20, G["term"]): 53, (20, G["arith"]): 38, (20, G["comp"]): 37, - (20, G["expr"]): 89, - (20, G["term"]): 53, + (20, G["expr"]): 90, (20, G["function-call"]): 35, (20, G["atom"]): 43, (20, G["factor"]): 56, (21, G["term"]): 53, - (21, G["arith"]): 38, - (21, G["atom"]): 43, - (21, G["expr"]): 77, (21, G["comp"]): 37, + (21, G["atom"]): 43, (21, G["function-call"]): 35, + (21, G["expr"]): 77, + (21, G["arith"]): 38, (21, G["factor"]): 56, - (24, G["atom"]): 43, (24, G["factor"]): 76, + (24, G["atom"]): 43, (24, G["function-call"]): 35, (27, G["atom"]): 43, - (27, G["function-call"]): 35, (27, G["factor"]): 75, - (29, G["function-call"]): 35, - (29, G["expr"]): 50, + (27, G["function-call"]): 35, (29, G["atom"]): 43, - (29, G["arith"]): 38, (29, G["term"]): 53, - (29, G["comp"]): 37, + (29, G["expr-list"]): 73, (29, G["factor"]): 56, + (29, G["function-call"]): 35, + (29, G["arith"]): 38, + (29, G["expr"]): 50, + (29, G["comp"]): 37, (29, G["not-empty-expr-list"]): 49, - (29, G["expr-list"]): 73, - (30, G["factor"]): 56, - (30, G["atom"]): 43, + (30, G["expr"]): 72, (30, G["arith"]): 38, - (30, G["function-call"]): 35, (30, G["term"]): 53, + (30, G["factor"]): 56, (30, G["comp"]): 37, - (30, G["expr"]): 72, - (32, G["factor"]): 56, - (32, G["atom"]): 43, - (32, G["expr"]): 36, + (30, G["atom"]): 43, + (30, G["function-call"]): 35, (32, G["arith"]): 38, - (32, G["function-call"]): 35, (32, G["term"]): 53, + (32, G["expr"]): 36, + (32, G["factor"]): 56, (32, G["comp"]): 37, + (32, G["atom"]): 43, + (32, G["function-call"]): 35, (39, G["atom"]): 43, (39, G["term"]): 40, (39, G["factor"]): 56, (39, G["function-call"]): 35, (41, G["atom"]): 43, - (41, G["function-call"]): 35, (41, G["factor"]): 42, - (46, G["expr-list"]): 47, - (46, G["function-call"]): 35, - (46, G["expr"]): 50, + (41, G["function-call"]): 35, (46, G["atom"]): 43, - (46, G["arith"]): 38, (46, G["term"]): 53, - (46, G["comp"]): 37, (46, G["factor"]): 56, + (46, G["function-call"]): 35, + (46, G["arith"]): 38, + (46, G["expr"]): 50, + (46, G["comp"]): 37, (46, G["not-empty-expr-list"]): 49, - (51, G["function-call"]): 35, - (51, G["expr"]): 50, + (46, G["expr-list"]): 47, (51, G["atom"]): 43, - (51, G["arith"]): 38, (51, G["term"]): 53, - (51, G["comp"]): 37, (51, G["factor"]): 56, + (51, G["function-call"]): 35, + (51, G["arith"]): 38, + (51, G["expr"]): 50, (51, G["not-empty-expr-list"]): 52, + (51, G["comp"]): 37, (54, G["atom"]): 43, - (54, G["function-call"]): 35, (54, G["factor"]): 55, + (54, G["function-call"]): 35, + (61, G["atom"]): 43, + (61, G["term"]): 53, + (61, G["factor"]): 56, (61, G["function-call"]): 35, + (61, G["arith"]): 38, (61, G["expr"]): 50, (61, G["expr-list"]): 62, - (61, G["atom"]): 43, - (61, G["arith"]): 38, - (61, G["term"]): 53, (61, G["comp"]): 37, - (61, G["factor"]): 56, (61, G["not-empty-expr-list"]): 49, (64, G["atom"]): 43, (64, G["term"]): 65, (64, G["factor"]): 56, (64, G["function-call"]): 35, (66, G["arith"]): 67, - (66, G["term"]): 53, (66, G["function-call"]): 35, (66, G["atom"]): 43, (66, G["factor"]): 56, + (66, G["term"]): 53, (68, G["arith"]): 69, - (68, G["term"]): 53, (68, G["function-call"]): 35, (68, G["atom"]): 43, (68, G["factor"]): 56, + (68, G["term"]): 53, (70, G["arith"]): 71, - (70, G["term"]): 53, (70, G["function-call"]): 35, (70, G["atom"]): 43, (70, G["factor"]): 56, - (78, G["case-list"]): 87, + (70, G["term"]): 53, + (78, G["case-list"]): 88, + (82, G["expr"]): 83, (82, G["atom"]): 43, (82, G["arith"]): 38, - (82, G["expr"]): 83, + (82, G["comp"]): 37, (82, G["term"]): 53, (82, G["factor"]): 56, - (82, G["comp"]): 37, (82, G["function-call"]): 35, (84, G["case-list"]): 85, - (90, G["declaration-list"]): 91, - (93, G["factor"]): 56, - (93, G["atom"]): 43, - (93, G["expr"]): 94, - (93, G["arith"]): 38, - (93, G["function-call"]): 35, - (93, G["term"]): 53, - (93, G["comp"]): 37, - (96, G["atom"]): 43, - (96, G["function-call"]): 35, - (96, G["arith"]): 38, - (96, G["comp"]): 37, - (96, G["expr"]): 97, - (96, G["term"]): 53, - (96, G["factor"]): 56, - (100, G["arith"]): 38, - (100, G["term"]): 53, - (100, G["atom"]): 43, - (100, G["factor"]): 56, - (100, G["comp"]): 37, - (100, G["expr"]): 101, - (100, G["function-call"]): 35, - (102, G["term"]): 53, - (102, G["arith"]): 38, - (102, G["atom"]): 43, - (102, G["factor"]): 56, - (102, G["function-call"]): 35, - (102, G["expr"]): 103, - (102, G["comp"]): 37, - (110, G["atom"]): 43, - (110, G["arith"]): 38, - (110, G["expr"]): 109, - (110, G["term"]): 53, - (110, G["factor"]): 56, - (110, G["block"]): 111, - (110, G["comp"]): 37, - (110, G["function-call"]): 35, - (118, G["param-list"]): 119, - (124, G["arith"]): 38, - (124, G["term"]): 53, - (124, G["expr"]): 125, - (124, G["comp"]): 37, - (124, G["function-call"]): 35, - (124, G["atom"]): 43, - (124, G["factor"]): 56, - (129, G["atom"]): 43, - (129, G["arith"]): 38, - (129, G["term"]): 53, - (129, G["factor"]): 56, - (129, G["expr"]): 130, - (129, G["comp"]): 37, - (129, G["function-call"]): 35, - (134, G["attribute"]): 133, - (134, G["method"]): 136, - (134, G["feature-list"]): 135, - (137, G["attribute"]): 133, - (137, G["method"]): 136, - (137, G["feature-list"]): 138, - (139, G["attribute"]): 133, + (86, G["case-list"]): 87, + (91, G["declaration-list"]): 92, + (94, G["arith"]): 38, + (94, G["term"]): 53, + (94, G["expr"]): 95, + (94, G["factor"]): 56, + (94, G["comp"]): 37, + (94, G["atom"]): 43, + (94, G["function-call"]): 35, + (97, G["atom"]): 43, + (97, G["arith"]): 38, + (97, G["factor"]): 56, + (97, G["function-call"]): 35, + (97, G["term"]): 53, + (97, G["expr"]): 98, + (97, G["comp"]): 37, + (101, G["arith"]): 38, + (101, G["term"]): 53, + (101, G["atom"]): 43, + (101, G["expr"]): 102, + (101, G["comp"]): 37, + (101, G["function-call"]): 35, + (101, G["factor"]): 56, + (103, G["arith"]): 38, + (103, G["factor"]): 56, + (103, G["atom"]): 43, + (103, G["term"]): 53, + (103, G["comp"]): 37, + (103, G["expr"]): 104, + (103, G["function-call"]): 35, + (111, G["atom"]): 43, + (111, G["arith"]): 38, + (111, G["comp"]): 37, + (111, G["term"]): 53, + (111, G["block"]): 112, + (111, G["expr"]): 110, + (111, G["factor"]): 56, + (111, G["function-call"]): 35, + (113, G["atom"]): 43, + (113, G["arith"]): 38, + (113, G["comp"]): 37, + (113, G["term"]): 53, + (113, G["expr"]): 110, + (113, G["factor"]): 56, + (113, G["function-call"]): 35, + (113, G["block"]): 114, + (120, G["param-list"]): 121, + (126, G["expr"]): 127, + (126, G["atom"]): 43, + (126, G["comp"]): 37, + (126, G["arith"]): 38, + (126, G["term"]): 53, + (126, G["factor"]): 56, + (126, G["function-call"]): 35, + (131, G["atom"]): 43, + (131, G["arith"]): 38, + (131, G["comp"]): 37, + (131, G["term"]): 53, + (131, G["factor"]): 56, + (131, G["function-call"]): 35, + (131, G["expr"]): 132, + (136, G["attribute"]): 135, + (136, G["method"]): 138, + (136, G["feature-list"]): 137, + (139, G["attribute"]): 135, (139, G["feature-list"]): 140, - (139, G["method"]): 136, - (141, G["attribute"]): 133, - (141, G["method"]): 136, + (139, G["method"]): 138, + (141, G["attribute"]): 135, + (141, G["method"]): 138, (141, G["feature-list"]): 142, - (145, G["feature-list"]): 146, - (145, G["attribute"]): 133, - (145, G["method"]): 136, - (150, G["class-def"]): 150, - (150, G["class-list"]): 151, + (143, G["feature-list"]): 144, + (143, G["attribute"]): 135, + (143, G["method"]): 138, + (147, G["feature-list"]): 148, + (147, G["attribute"]): 135, + (147, G["method"]): 138, + (152, G["class-def"]): 152, + (152, G["class-list"]): 153, } From 012f26b38e74c067aacf052082263d9bae983cd9 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Sun, 21 Jun 2020 19:03:21 +0200 Subject: [PATCH 068/143] - --- main.py | 8 ++++++-- .../{progam_executor.py => execution.py} | 6 +++--- semantics/type_inference.py | 20 +++++++++++++------ 3 files changed, 23 insertions(+), 11 deletions(-) rename semantics/{progam_executor.py => execution.py} (99%) diff --git a/main.py b/main.py index 7d064398b..54460200d 100755 --- a/main.py +++ b/main.py @@ -4,7 +4,7 @@ from parsertab import CoolParser from semantics import (TypeCollector, TypeBuilder, OverriddenMethodChecker, TypeChecker, topological_ordering) from semantics.formatter import CodeBuilder -from semantics.progam_executor import Executor, ExecutionError +from semantics.execution import Executor, ExecutionError from semantics.type_inference import InferenceChecker from semantics.utils.scope import Context, Scope @@ -131,17 +131,21 @@ class Main inherits IO { syntactic_errors = """ class Main { a: Int + b: String + main () : Object { let a: Int <- "" in 0 } + errors() : Object { case a of x: Int => (new IO).out_int(x) + y: String => (new IO).out_string(x) esac } } """ -verbose = sys.argv[1] if len(sys.argv) > 1 else False +verbose = bool(sys.argv[1]) if len(sys.argv) > 1 else False lexer = CoolLexer() parser = CoolParser(verbose) diff --git a/semantics/progam_executor.py b/semantics/execution.py similarity index 99% rename from semantics/progam_executor.py rename to semantics/execution.py index ce7e03256..88596ddbf 100644 --- a/semantics/progam_executor.py +++ b/semantics/execution.py @@ -1,4 +1,4 @@ -from typing import List, Dict, Any +from typing import Dict, Any import semantics.utils.astnodes as ast import semantics.utils.errors as err @@ -17,7 +17,7 @@ def abort(obj, context): exit() -def ccopy(obj, context) -> None: +def copy(obj, context): x_copy = Instance(obj.type, obj.value if obj.type.name in ('Int', 'String', 'Bool') else None) x_copy.attribute_values = obj.attribute_values return x_copy @@ -59,7 +59,7 @@ def substr(obj, i, l, context): defaults = { ('Object', 'abort'): abort, - ('Object', 'copy'): ccopy, + ('Object', 'copy'): copy, ('Object', 'type_name'): type_name, ('IO', 'out_string'): out_string, ('IO', 'out_int'): out_int, diff --git a/semantics/type_inference.py b/semantics/type_inference.py index 8f965b1cc..e6b602a8a 100644 --- a/semantics/type_inference.py +++ b/semantics/type_inference.py @@ -1,14 +1,14 @@ """The type inference algorithm consist in a dependency di-graph with special nodes to handle the behavior of the updates of components in the code and solve it in the `context`. For that we crate an structure called DependencyGraph where we can create nodes as an structure called DependencyNode and arcs between them, and arc e = - where x and y are dependency nodes means that the type of node y in inferred by the type of node x, + where x and y are dependency nodes means that the type of node y is inferred by the type of node x, so for solve the type of y we need first to infer the type of x. For this operation we need some basic nodes that only contains the type of the node called AtomNode and in the digraph formation an AtomNode is never inferred from -another node. The DependencyGraph consist in a dictionary[node, adjacency list] this adjacency has an declaration -order an this is fundamental for the inference solution algorithm. If we have a case {x : [y, z]} where x, y, +another node. The DependencyGraph consist in a dictionary[node, adjacency list] this adjacency has a declaration +order and this is fundamental for the inference solution algorithm. If we have a case {x : [y, z]} where x, y, z are nodes then the algorithm will determinate the type of y and all it dependencies before to start with z (a -simple BFS). The order in the adjacency list is the same appearance order in the program. At the end of the algorithm -all node that cannot solve it type will be tagged as `Object`. +simple DFS). The order in the adjacency list is the same appearance order in the program. At the end of the algorithm +all nodes that cannot solve it type will be tagged as `Object`. DependencyNode hierarchy AtomNode @@ -136,6 +136,9 @@ def update_dependencies(self, default_type: Type = None): continue self.update_dependencies_of(current_node, current_node.type, visited) + for k, v in self.dependencies.items(): + print(k, ':', v) + if default_type is not None: for node in self.dependencies: if node not in visited: @@ -363,6 +366,11 @@ def visit(self, node: ast.MethodCallNode, scope: Scope): param_nodes, return_node = self.methods[owner.name, method.name] for i, arg in enumerate(node.args): arg_node = self.visit(arg, scope) + + if arg_node is None: + # Possible error + continue + if isinstance(arg_node, AtomNode): if param_nodes[i].type.name == 'AUTO_TYPE': self.graph.add_edge(arg_node, param_nodes[i]) @@ -402,7 +410,7 @@ def visit(self, node: ast.VariableNode, scope: Scope): else: return AtomNode(var_info.type) else: - pass + return None @visitor.when(ast.InstantiateNode) def visit(self, node: ast.InstantiateNode, scope: Scope): From 8728741f3bd4e8e74c1db943da829a60d4a9be1a Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Sun, 21 Jun 2020 19:19:09 +0200 Subject: [PATCH 069/143] - --- main.py => cool.py | 0 grammar.py | 0 parsertab.py | 1270 ++++++++++++++++++++++---------------------- tester.py | 72 --- 4 files changed, 635 insertions(+), 707 deletions(-) rename main.py => cool.py (100%) mode change 100755 => 100644 mode change 100755 => 100644 grammar.py delete mode 100755 tester.py diff --git a/main.py b/cool.py old mode 100755 new mode 100644 similarity index 100% rename from main.py rename to cool.py diff --git a/grammar.py b/grammar.py old mode 100755 new mode 100644 diff --git a/parsertab.py b/parsertab.py index 07b807c0d..eaa765608 100644 --- a/parsertab.py +++ b/parsertab.py @@ -15,135 +15,142 @@ def __action_table(): return { (0, G["class"]): ("SHIFT", 1), (1, G["type"]): ("SHIFT", 2), - (2, G["{"]): ("SHIFT", 3), (2, G["inherits"]): ("SHIFT", 145), + (2, G["{"]): ("SHIFT", 3), (3, G["id"]): ("SHIFT", 4), (3, G["}"]): ("REDUCE", G["feature-list -> e"]), - (4, G["("]): ("SHIFT", 5), (4, G[":"]): ("SHIFT", 129), - (5, G[")"]): ("SHIFT", 6), + (4, G["("]): ("SHIFT", 5), (5, G["id"]): ("SHIFT", 117), + (5, G[")"]): ("SHIFT", 6), (6, G[":"]): ("SHIFT", 7), (7, G["type"]): ("SHIFT", 8), (8, G["{"]): ("SHIFT", 9), - (9, G["if"]): ("SHIFT", 12), - (9, G["new"]): ("SHIFT", 22), - (9, G["false"]): ("SHIFT", 26), + (9, G["while"]): ("SHIFT", 13), (9, G["isvoid"]): ("SHIFT", 24), - (9, G["("]): ("SHIFT", 11), - (9, G["not"]): ("SHIFT", 30), + (9, G["true"]): ("SHIFT", 25), (9, G["id"]): ("SHIFT", 31), - (9, G["{"]): ("SHIFT", 10), - (9, G["int"]): ("SHIFT", 34), (9, G["~"]): ("SHIFT", 27), - (9, G["string"]): ("SHIFT", 33), + (9, G["new"]): ("SHIFT", 22), + (9, G["("]): ("SHIFT", 11), + (9, G["false"]): ("SHIFT", 26), + (9, G["int"]): ("SHIFT", 34), (9, G["case"]): ("SHIFT", 21), - (9, G["true"]): ("SHIFT", 25), + (9, G["not"]): ("SHIFT", 30), + (9, G["{"]): ("SHIFT", 10), + (9, G["if"]): ("SHIFT", 12), (9, G["let"]): ("SHIFT", 14), - (9, G["while"]): ("SHIFT", 13), - (10, G["while"]): ("SHIFT", 13), - (10, G["isvoid"]): ("SHIFT", 24), + (9, G["string"]): ("SHIFT", 33), + (10, G["new"]): ("SHIFT", 22), + (10, G["false"]): ("SHIFT", 26), (10, G["("]): ("SHIFT", 11), + (10, G["isvoid"]): ("SHIFT", 24), (10, G["id"]): ("SHIFT", 31), - (10, G["not"]): ("SHIFT", 30), - (10, G["true"]): ("SHIFT", 25), - (10, G["string"]): ("SHIFT", 33), (10, G["~"]): ("SHIFT", 27), - (10, G["{"]): ("SHIFT", 10), - (10, G["new"]): ("SHIFT", 22), - (10, G["int"]): ("SHIFT", 34), - (10, G["case"]): ("SHIFT", 21), + (10, G["while"]): ("SHIFT", 13), (10, G["let"]): ("SHIFT", 14), + (10, G["{"]): ("SHIFT", 10), (10, G["if"]): ("SHIFT", 12), - (10, G["false"]): ("SHIFT", 26), - (11, G["int"]): ("SHIFT", 34), - (11, G["isvoid"]): ("SHIFT", 24), + (10, G["not"]): ("SHIFT", 30), + (10, G["case"]): ("SHIFT", 21), + (10, G["int"]): ("SHIFT", 34), + (10, G["string"]): ("SHIFT", 33), + (10, G["true"]): ("SHIFT", 25), (11, G["id"]): ("SHIFT", 31), - (11, G["{"]): ("SHIFT", 10), + (11, G["string"]): ("SHIFT", 33), + (11, G["isvoid"]): ("SHIFT", 24), + (11, G["case"]): ("SHIFT", 21), (11, G["not"]): ("SHIFT", 30), - (11, G["false"]): ("SHIFT", 26), - (11, G["new"]): ("SHIFT", 22), - (11, G["("]): ("SHIFT", 11), - (11, G["let"]): ("SHIFT", 14), (11, G["if"]): ("SHIFT", 12), + (11, G["{"]): ("SHIFT", 10), + (11, G["int"]): ("SHIFT", 34), + (11, G["let"]): ("SHIFT", 14), (11, G["while"]): ("SHIFT", 13), - (11, G["true"]): ("SHIFT", 25), (11, G["~"]): ("SHIFT", 27), - (11, G["case"]): ("SHIFT", 21), - (11, G["string"]): ("SHIFT", 33), - (12, G["while"]): ("SHIFT", 13), - (12, G["new"]): ("SHIFT", 22), - (12, G["string"]): ("SHIFT", 33), + (11, G["false"]): ("SHIFT", 26), + (11, G["("]): ("SHIFT", 11), + (11, G["new"]): ("SHIFT", 22), + (11, G["true"]): ("SHIFT", 25), + (12, G["id"]): ("SHIFT", 31), + (12, G["true"]): ("SHIFT", 25), + (12, G["{"]): ("SHIFT", 10), (12, G["if"]): ("SHIFT", 12), + (12, G["not"]): ("SHIFT", 30), + (12, G["new"]): ("SHIFT", 22), (12, G["case"]): ("SHIFT", 21), - (12, G["int"]): ("SHIFT", 34), - (12, G["~"]): ("SHIFT", 27), (12, G["false"]): ("SHIFT", 26), - (12, G["{"]): ("SHIFT", 10), - (12, G["id"]): ("SHIFT", 31), - (12, G["("]): ("SHIFT", 11), (12, G["isvoid"]): ("SHIFT", 24), - (12, G["not"]): ("SHIFT", 30), + (12, G["("]): ("SHIFT", 11), + (12, G["~"]): ("SHIFT", 27), + (12, G["int"]): ("SHIFT", 34), + (12, G["while"]): ("SHIFT", 13), + (12, G["string"]): ("SHIFT", 33), (12, G["let"]): ("SHIFT", 14), - (12, G["true"]): ("SHIFT", 25), - (13, G["string"]): ("SHIFT", 33), + (13, G["while"]): ("SHIFT", 13), + (13, G["id"]): ("SHIFT", 31), + (13, G["true"]): ("SHIFT", 25), (13, G["~"]): ("SHIFT", 27), - (13, G["new"]): ("SHIFT", 22), + (13, G["int"]): ("SHIFT", 34), + (13, G["string"]): ("SHIFT", 33), (13, G["case"]): ("SHIFT", 21), - (13, G["("]): ("SHIFT", 11), - (13, G["id"]): ("SHIFT", 31), - (13, G["let"]): ("SHIFT", 14), (13, G["isvoid"]): ("SHIFT", 24), - (13, G["not"]): ("SHIFT", 30), (13, G["false"]): ("SHIFT", 26), - (13, G["int"]): ("SHIFT", 34), + (13, G["("]): ("SHIFT", 11), + (13, G["new"]): ("SHIFT", 22), + (13, G["let"]): ("SHIFT", 14), (13, G["if"]): ("SHIFT", 12), (13, G["{"]): ("SHIFT", 10), - (13, G["while"]): ("SHIFT", 13), - (13, G["true"]): ("SHIFT", 25), + (13, G["not"]): ("SHIFT", 30), (14, G["id"]): ("SHIFT", 15), (15, G[":"]): ("SHIFT", 16), (16, G["type"]): ("SHIFT", 17), (17, G[","]): ("SHIFT", 18), - (17, G["<-"]): ("SHIFT", 20), (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), + (17, G["<-"]): ("SHIFT", 20), (18, G["id"]): ("SHIFT", 15), (19, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), - (20, G["string"]): ("SHIFT", 33), + (20, G["isvoid"]): ("SHIFT", 24), + (20, G["case"]): ("SHIFT", 21), (20, G["id"]): ("SHIFT", 31), - (20, G["("]): ("SHIFT", 11), - (20, G["~"]): ("SHIFT", 27), (20, G["not"]): ("SHIFT", 30), + (20, G["new"]): ("SHIFT", 22), (20, G["let"]): ("SHIFT", 14), - (20, G["while"]): ("SHIFT", 13), + (20, G["("]): ("SHIFT", 11), (20, G["false"]): ("SHIFT", 26), + (20, G["{"]): ("SHIFT", 10), (20, G["if"]): ("SHIFT", 12), + (20, G["string"]): ("SHIFT", 33), + (20, G["~"]): ("SHIFT", 27), (20, G["int"]): ("SHIFT", 34), - (20, G["case"]): ("SHIFT", 21), - (20, G["isvoid"]): ("SHIFT", 24), + (20, G["while"]): ("SHIFT", 13), (20, G["true"]): ("SHIFT", 25), - (20, G["new"]): ("SHIFT", 22), - (20, G["{"]): ("SHIFT", 10), - (21, G["~"]): ("SHIFT", 27), - (21, G["true"]): ("SHIFT", 25), - (21, G["while"]): ("SHIFT", 13), (21, G["{"]): ("SHIFT", 10), + (21, G["isvoid"]): ("SHIFT", 24), (21, G["if"]): ("SHIFT", 12), - (21, G["string"]): ("SHIFT", 33), (21, G["id"]): ("SHIFT", 31), - (21, G["int"]): ("SHIFT", 34), - (21, G["isvoid"]): ("SHIFT", 24), - (21, G["not"]): ("SHIFT", 30), - (21, G["let"]): ("SHIFT", 14), - (21, G["false"]): ("SHIFT", 26), (21, G["new"]): ("SHIFT", 22), (21, G["("]): ("SHIFT", 11), + (21, G["false"]): ("SHIFT", 26), + (21, G["while"]): ("SHIFT", 13), + (21, G["string"]): ("SHIFT", 33), + (21, G["true"]): ("SHIFT", 25), (21, G["case"]): ("SHIFT", 21), + (21, G["not"]): ("SHIFT", 30), + (21, G["let"]): ("SHIFT", 14), + (21, G["int"]): ("SHIFT", 34), + (21, G["~"]): ("SHIFT", 27), (22, G["type"]): ("SHIFT", 23), + (23, G["<="]): ("REDUCE", G["atom -> new type"]), + (23, G["error"]): ("REDUCE", G["atom -> new type"]), + (23, G["="]): ("REDUCE", G["atom -> new type"]), + (23, G["pool"]): ("REDUCE", G["atom -> new type"]), + (23, G[")"]): ("REDUCE", G["atom -> new type"]), + (23, G["."]): ("REDUCE", G["atom -> new type"]), + (23, G["in"]): ("REDUCE", G["atom -> new type"]), (23, G[","]): ("REDUCE", G["atom -> new type"]), (23, G["then"]): ("REDUCE", G["atom -> new type"]), (23, G[";"]): ("REDUCE", G["atom -> new type"]), - (23, G["."]): ("REDUCE", G["atom -> new type"]), + (23, G["<"]): ("REDUCE", G["atom -> new type"]), (23, G["@"]): ("REDUCE", G["atom -> new type"]), (23, G["+"]): ("REDUCE", G["atom -> new type"]), (23, G["else"]): ("REDUCE", G["atom -> new type"]), @@ -153,27 +160,27 @@ def __action_table(): (23, G["*"]): ("REDUCE", G["atom -> new type"]), (23, G["}"]): ("REDUCE", G["atom -> new type"]), (23, G["/"]): ("REDUCE", G["atom -> new type"]), - (23, G["<"]): ("REDUCE", G["atom -> new type"]), (23, G["loop"]): ("REDUCE", G["atom -> new type"]), - (23, G["<="]): ("REDUCE", G["atom -> new type"]), - (23, G["pool"]): ("REDUCE", G["atom -> new type"]), - (23, G[")"]): ("REDUCE", G["atom -> new type"]), - (23, G["="]): ("REDUCE", G["atom -> new type"]), - (23, G["error"]): ("REDUCE", G["atom -> new type"]), - (23, G["in"]): ("REDUCE", G["atom -> new type"]), - (24, G["false"]): ("SHIFT", 26), - (24, G["~"]): ("SHIFT", 27), - (24, G["true"]): ("SHIFT", 25), - (24, G["string"]): ("SHIFT", 33), - (24, G["int"]): ("SHIFT", 34), - (24, G["id"]): ("SHIFT", 28), (24, G["("]): ("SHIFT", 11), (24, G["isvoid"]): ("SHIFT", 24), + (24, G["true"]): ("SHIFT", 25), + (24, G["id"]): ("SHIFT", 28), + (24, G["int"]): ("SHIFT", 34), + (24, G["~"]): ("SHIFT", 27), + (24, G["string"]): ("SHIFT", 33), (24, G["new"]): ("SHIFT", 22), + (24, G["false"]): ("SHIFT", 26), + (25, G["<="]): ("REDUCE", G["atom -> true"]), + (25, G["error"]): ("REDUCE", G["atom -> true"]), + (25, G["="]): ("REDUCE", G["atom -> true"]), + (25, G["pool"]): ("REDUCE", G["atom -> true"]), + (25, G[")"]): ("REDUCE", G["atom -> true"]), + (25, G["."]): ("REDUCE", G["atom -> true"]), + (25, G["loop"]): ("REDUCE", G["atom -> true"]), + (25, G["in"]): ("REDUCE", G["atom -> true"]), (25, G[","]): ("REDUCE", G["atom -> true"]), (25, G["then"]): ("REDUCE", G["atom -> true"]), (25, G[";"]): ("REDUCE", G["atom -> true"]), - (25, G["."]): ("REDUCE", G["atom -> true"]), (25, G["+"]): ("REDUCE", G["atom -> true"]), (25, G["@"]): ("REDUCE", G["atom -> true"]), (25, G["else"]): ("REDUCE", G["atom -> true"]), @@ -184,17 +191,17 @@ def __action_table(): (25, G["}"]): ("REDUCE", G["atom -> true"]), (25, G["/"]): ("REDUCE", G["atom -> true"]), (25, G["<"]): ("REDUCE", G["atom -> true"]), - (25, G["loop"]): ("REDUCE", G["atom -> true"]), - (25, G["<="]): ("REDUCE", G["atom -> true"]), - (25, G["pool"]): ("REDUCE", G["atom -> true"]), - (25, G[")"]): ("REDUCE", G["atom -> true"]), - (25, G["="]): ("REDUCE", G["atom -> true"]), - (25, G["error"]): ("REDUCE", G["atom -> true"]), - (25, G["in"]): ("REDUCE", G["atom -> true"]), + (26, G["<="]): ("REDUCE", G["atom -> false"]), + (26, G["error"]): ("REDUCE", G["atom -> false"]), + (26, G["="]): ("REDUCE", G["atom -> false"]), + (26, G["pool"]): ("REDUCE", G["atom -> false"]), + (26, G[")"]): ("REDUCE", G["atom -> false"]), + (26, G["."]): ("REDUCE", G["atom -> false"]), + (26, G["loop"]): ("REDUCE", G["atom -> false"]), + (26, G["in"]): ("REDUCE", G["atom -> false"]), (26, G[","]): ("REDUCE", G["atom -> false"]), (26, G["then"]): ("REDUCE", G["atom -> false"]), (26, G[";"]): ("REDUCE", G["atom -> false"]), - (26, G["."]): ("REDUCE", G["atom -> false"]), (26, G["@"]): ("REDUCE", G["atom -> false"]), (26, G["+"]): ("REDUCE", G["atom -> false"]), (26, G["else"]): ("REDUCE", G["atom -> false"]), @@ -205,26 +212,26 @@ def __action_table(): (26, G["}"]): ("REDUCE", G["atom -> false"]), (26, G["/"]): ("REDUCE", G["atom -> false"]), (26, G["<"]): ("REDUCE", G["atom -> false"]), - (26, G["loop"]): ("REDUCE", G["atom -> false"]), - (26, G["<="]): ("REDUCE", G["atom -> false"]), - (26, G["pool"]): ("REDUCE", G["atom -> false"]), - (26, G[")"]): ("REDUCE", G["atom -> false"]), - (26, G["="]): ("REDUCE", G["atom -> false"]), - (26, G["error"]): ("REDUCE", G["atom -> false"]), - (26, G["in"]): ("REDUCE", G["atom -> false"]), - (27, G["false"]): ("SHIFT", 26), - (27, G["~"]): ("SHIFT", 27), - (27, G["true"]): ("SHIFT", 25), - (27, G["string"]): ("SHIFT", 33), - (27, G["int"]): ("SHIFT", 34), - (27, G["id"]): ("SHIFT", 28), (27, G["("]): ("SHIFT", 11), (27, G["isvoid"]): ("SHIFT", 24), + (27, G["true"]): ("SHIFT", 25), + (27, G["id"]): ("SHIFT", 28), + (27, G["int"]): ("SHIFT", 34), + (27, G["~"]): ("SHIFT", 27), + (27, G["string"]): ("SHIFT", 33), (27, G["new"]): ("SHIFT", 22), + (27, G["false"]): ("SHIFT", 26), + (28, G["<="]): ("REDUCE", G["atom -> id"]), + (28, G["error"]): ("REDUCE", G["atom -> id"]), + (28, G["="]): ("REDUCE", G["atom -> id"]), + (28, G["pool"]): ("REDUCE", G["atom -> id"]), + (28, G[")"]): ("REDUCE", G["atom -> id"]), + (28, G["."]): ("REDUCE", G["atom -> id"]), + (28, G["in"]): ("REDUCE", G["atom -> id"]), (28, G[","]): ("REDUCE", G["atom -> id"]), (28, G["then"]): ("REDUCE", G["atom -> id"]), (28, G[";"]): ("REDUCE", G["atom -> id"]), - (28, G["."]): ("REDUCE", G["atom -> id"]), + (28, G["<"]): ("REDUCE", G["atom -> id"]), (28, G["@"]): ("REDUCE", G["atom -> id"]), (28, G["+"]): ("REDUCE", G["atom -> id"]), (28, G["else"]): ("REDUCE", G["atom -> id"]), @@ -234,50 +241,51 @@ def __action_table(): (28, G["*"]): ("REDUCE", G["atom -> id"]), (28, G["}"]): ("REDUCE", G["atom -> id"]), (28, G["/"]): ("REDUCE", G["atom -> id"]), - (28, G["<"]): ("REDUCE", G["atom -> id"]), (28, G["loop"]): ("REDUCE", G["atom -> id"]), - (28, G["<="]): ("REDUCE", G["atom -> id"]), - (28, G["pool"]): ("REDUCE", G["atom -> id"]), - (28, G[")"]): ("REDUCE", G["atom -> id"]), - (28, G["="]): ("REDUCE", G["atom -> id"]), - (28, G["error"]): ("REDUCE", G["atom -> id"]), - (28, G["in"]): ("REDUCE", G["atom -> id"]), (28, G["("]): ("SHIFT", 29), - (29, G["string"]): ("SHIFT", 33), - (29, G["id"]): ("SHIFT", 31), - (29, G["true"]): ("SHIFT", 25), - (29, G["isvoid"]): ("SHIFT", 24), - (29, G["int"]): ("SHIFT", 34), - (29, G["case"]): ("SHIFT", 21), - (29, G["false"]): ("SHIFT", 26), (29, G["while"]): ("SHIFT", 13), - (29, G["if"]): ("SHIFT", 12), - (29, G["let"]): ("SHIFT", 14), (29, G["~"]): ("SHIFT", 27), - (29, G["not"]): ("SHIFT", 30), + (29, G["let"]): ("SHIFT", 14), + (29, G["id"]): ("SHIFT", 31), + (29, G["false"]): ("SHIFT", 26), (29, G["("]): ("SHIFT", 11), - (29, G["{"]): ("SHIFT", 10), (29, G[")"]): ("REDUCE", G["expr-list -> e"]), + (29, G["isvoid"]): ("SHIFT", 24), (29, G["new"]): ("SHIFT", 22), - (30, G["if"]): ("SHIFT", 12), - (30, G["while"]): ("SHIFT", 13), - (30, G["new"]): ("SHIFT", 22), - (30, G["false"]): ("SHIFT", 26), - (30, G["not"]): ("SHIFT", 30), + (29, G["true"]): ("SHIFT", 25), + (29, G["case"]): ("SHIFT", 21), + (29, G["not"]): ("SHIFT", 30), + (29, G["string"]): ("SHIFT", 33), + (29, G["{"]): ("SHIFT", 10), + (29, G["int"]): ("SHIFT", 34), + (29, G["if"]): ("SHIFT", 12), (30, G["int"]): ("SHIFT", 34), - (30, G["isvoid"]): ("SHIFT", 24), - (30, G["id"]): ("SHIFT", 31), - (30, G["true"]): ("SHIFT", 25), - (30, G["{"]): ("SHIFT", 10), (30, G["string"]): ("SHIFT", 33), - (30, G["case"]): ("SHIFT", 21), + (30, G["true"]): ("SHIFT", 25), + (30, G["id"]): ("SHIFT", 31), (30, G["~"]): ("SHIFT", 27), + (30, G["new"]): ("SHIFT", 22), + (30, G["not"]): ("SHIFT", 30), (30, G["("]): ("SHIFT", 11), + (30, G["false"]): ("SHIFT", 26), + (30, G["while"]): ("SHIFT", 13), (30, G["let"]): ("SHIFT", 14), + (30, G["{"]): ("SHIFT", 10), + (30, G["isvoid"]): ("SHIFT", 24), + (30, G["if"]): ("SHIFT", 12), + (30, G["case"]): ("SHIFT", 21), + (31, G["<-"]): ("SHIFT", 32), + (31, G["<="]): ("REDUCE", G["atom -> id"]), + (31, G["error"]): ("REDUCE", G["atom -> id"]), + (31, G["="]): ("REDUCE", G["atom -> id"]), + (31, G["pool"]): ("REDUCE", G["atom -> id"]), + (31, G[")"]): ("REDUCE", G["atom -> id"]), + (31, G["."]): ("REDUCE", G["atom -> id"]), + (31, G["loop"]): ("REDUCE", G["atom -> id"]), + (31, G["in"]): ("REDUCE", G["atom -> id"]), (31, G[","]): ("REDUCE", G["atom -> id"]), (31, G["then"]): ("REDUCE", G["atom -> id"]), (31, G[";"]): ("REDUCE", G["atom -> id"]), - (31, G["."]): ("REDUCE", G["atom -> id"]), (31, G["+"]): ("REDUCE", G["atom -> id"]), (31, G["@"]): ("REDUCE", G["atom -> id"]), (31, G["else"]): ("REDUCE", G["atom -> id"]), @@ -288,34 +296,33 @@ def __action_table(): (31, G["}"]): ("REDUCE", G["atom -> id"]), (31, G["/"]): ("REDUCE", G["atom -> id"]), (31, G["<"]): ("REDUCE", G["atom -> id"]), - (31, G["loop"]): ("REDUCE", G["atom -> id"]), - (31, G["<="]): ("REDUCE", G["atom -> id"]), - (31, G["pool"]): ("REDUCE", G["atom -> id"]), - (31, G[")"]): ("REDUCE", G["atom -> id"]), - (31, G["="]): ("REDUCE", G["atom -> id"]), - (31, G["error"]): ("REDUCE", G["atom -> id"]), - (31, G["in"]): ("REDUCE", G["atom -> id"]), - (31, G["<-"]): ("SHIFT", 32), (31, G["("]): ("SHIFT", 29), - (32, G["if"]): ("SHIFT", 12), - (32, G["while"]): ("SHIFT", 13), - (32, G["new"]): ("SHIFT", 22), - (32, G["false"]): ("SHIFT", 26), - (32, G["not"]): ("SHIFT", 30), (32, G["int"]): ("SHIFT", 34), - (32, G["isvoid"]): ("SHIFT", 24), - (32, G["id"]): ("SHIFT", 31), - (32, G["true"]): ("SHIFT", 25), - (32, G["{"]): ("SHIFT", 10), (32, G["string"]): ("SHIFT", 33), - (32, G["case"]): ("SHIFT", 21), + (32, G["true"]): ("SHIFT", 25), + (32, G["id"]): ("SHIFT", 31), (32, G["~"]): ("SHIFT", 27), + (32, G["new"]): ("SHIFT", 22), + (32, G["not"]): ("SHIFT", 30), (32, G["("]): ("SHIFT", 11), + (32, G["false"]): ("SHIFT", 26), + (32, G["while"]): ("SHIFT", 13), (32, G["let"]): ("SHIFT", 14), + (32, G["{"]): ("SHIFT", 10), + (32, G["isvoid"]): ("SHIFT", 24), + (32, G["if"]): ("SHIFT", 12), + (32, G["case"]): ("SHIFT", 21), + (33, G["<="]): ("REDUCE", G["atom -> string"]), + (33, G["error"]): ("REDUCE", G["atom -> string"]), + (33, G["="]): ("REDUCE", G["atom -> string"]), + (33, G["pool"]): ("REDUCE", G["atom -> string"]), + (33, G[")"]): ("REDUCE", G["atom -> string"]), + (33, G["."]): ("REDUCE", G["atom -> string"]), + (33, G["loop"]): ("REDUCE", G["atom -> string"]), + (33, G["in"]): ("REDUCE", G["atom -> string"]), (33, G[","]): ("REDUCE", G["atom -> string"]), (33, G["then"]): ("REDUCE", G["atom -> string"]), (33, G[";"]): ("REDUCE", G["atom -> string"]), - (33, G["."]): ("REDUCE", G["atom -> string"]), (33, G["@"]): ("REDUCE", G["atom -> string"]), (33, G["+"]): ("REDUCE", G["atom -> string"]), (33, G["else"]): ("REDUCE", G["atom -> string"]), @@ -326,19 +333,19 @@ def __action_table(): (33, G["}"]): ("REDUCE", G["atom -> string"]), (33, G["/"]): ("REDUCE", G["atom -> string"]), (33, G["<"]): ("REDUCE", G["atom -> string"]), - (33, G["loop"]): ("REDUCE", G["atom -> string"]), - (33, G["<="]): ("REDUCE", G["atom -> string"]), - (33, G["pool"]): ("REDUCE", G["atom -> string"]), - (33, G[")"]): ("REDUCE", G["atom -> string"]), - (33, G["="]): ("REDUCE", G["atom -> string"]), - (33, G["error"]): ("REDUCE", G["atom -> string"]), - (33, G["in"]): ("REDUCE", G["atom -> string"]), + (34, G["<="]): ("REDUCE", G["atom -> int"]), + (34, G["error"]): ("REDUCE", G["atom -> int"]), + (34, G["="]): ("REDUCE", G["atom -> int"]), + (34, G["pool"]): ("REDUCE", G["atom -> int"]), + (34, G[")"]): ("REDUCE", G["atom -> int"]), + (34, G["."]): ("REDUCE", G["atom -> int"]), + (34, G["loop"]): ("REDUCE", G["atom -> int"]), + (34, G["in"]): ("REDUCE", G["atom -> int"]), (34, G[","]): ("REDUCE", G["atom -> int"]), (34, G["then"]): ("REDUCE", G["atom -> int"]), (34, G[";"]): ("REDUCE", G["atom -> int"]), - (34, G["."]): ("REDUCE", G["atom -> int"]), - (34, G["+"]): ("REDUCE", G["atom -> int"]), (34, G["@"]): ("REDUCE", G["atom -> int"]), + (34, G["+"]): ("REDUCE", G["atom -> int"]), (34, G["else"]): ("REDUCE", G["atom -> int"]), (34, G["of"]): ("REDUCE", G["atom -> int"]), (34, G["-"]): ("REDUCE", G["atom -> int"]), @@ -347,19 +354,19 @@ def __action_table(): (34, G["}"]): ("REDUCE", G["atom -> int"]), (34, G["/"]): ("REDUCE", G["atom -> int"]), (34, G["<"]): ("REDUCE", G["atom -> int"]), - (34, G["loop"]): ("REDUCE", G["atom -> int"]), - (34, G["<="]): ("REDUCE", G["atom -> int"]), - (34, G["pool"]): ("REDUCE", G["atom -> int"]), - (34, G[")"]): ("REDUCE", G["atom -> int"]), - (34, G["="]): ("REDUCE", G["atom -> int"]), - (34, G["error"]): ("REDUCE", G["atom -> int"]), - (34, G["in"]): ("REDUCE", G["atom -> int"]), + (35, G["<="]): ("REDUCE", G["atom -> function-call"]), + (35, G["error"]): ("REDUCE", G["atom -> function-call"]), + (35, G["="]): ("REDUCE", G["atom -> function-call"]), + (35, G["pool"]): ("REDUCE", G["atom -> function-call"]), + (35, G[")"]): ("REDUCE", G["atom -> function-call"]), + (35, G["."]): ("REDUCE", G["atom -> function-call"]), + (35, G["loop"]): ("REDUCE", G["atom -> function-call"]), + (35, G["in"]): ("REDUCE", G["atom -> function-call"]), (35, G[","]): ("REDUCE", G["atom -> function-call"]), (35, G["then"]): ("REDUCE", G["atom -> function-call"]), (35, G[";"]): ("REDUCE", G["atom -> function-call"]), - (35, G["."]): ("REDUCE", G["atom -> function-call"]), - (35, G["@"]): ("REDUCE", G["atom -> function-call"]), (35, G["+"]): ("REDUCE", G["atom -> function-call"]), + (35, G["@"]): ("REDUCE", G["atom -> function-call"]), (35, G["else"]): ("REDUCE", G["atom -> function-call"]), (35, G["of"]): ("REDUCE", G["atom -> function-call"]), (35, G["-"]): ("REDUCE", G["atom -> function-call"]), @@ -368,96 +375,96 @@ def __action_table(): (35, G["}"]): ("REDUCE", G["atom -> function-call"]), (35, G["/"]): ("REDUCE", G["atom -> function-call"]), (35, G["<"]): ("REDUCE", G["atom -> function-call"]), - (35, G["loop"]): ("REDUCE", G["atom -> function-call"]), - (35, G["<="]): ("REDUCE", G["atom -> function-call"]), - (35, G["pool"]): ("REDUCE", G["atom -> function-call"]), - (35, G[")"]): ("REDUCE", G["atom -> function-call"]), - (35, G["="]): ("REDUCE", G["atom -> function-call"]), - (35, G["error"]): ("REDUCE", G["atom -> function-call"]), - (35, G["in"]): ("REDUCE", G["atom -> function-call"]), - (36, G["}"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["else"]): ("REDUCE", G["expr -> id <- expr"]), (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["}"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), (36, G["in"]): ("REDUCE", G["expr -> id <- expr"]), - (37, G["}"]): ("REDUCE", G["expr -> comp"]), - (37, G[","]): ("REDUCE", G["expr -> comp"]), - (37, G["then"]): ("REDUCE", G["expr -> comp"]), - (37, G["loop"]): ("REDUCE", G["expr -> comp"]), - (37, G[";"]): ("REDUCE", G["expr -> comp"]), - (37, G["pool"]): ("REDUCE", G["expr -> comp"]), + (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), (37, G["else"]): ("REDUCE", G["expr -> comp"]), (37, G[")"]): ("REDUCE", G["expr -> comp"]), + (37, G["pool"]): ("REDUCE", G["expr -> comp"]), (37, G["of"]): ("REDUCE", G["expr -> comp"]), (37, G["fi"]): ("REDUCE", G["expr -> comp"]), - (37, G["error"]): ("REDUCE", G["expr -> comp"]), + (37, G["then"]): ("REDUCE", G["expr -> comp"]), + (37, G["loop"]): ("REDUCE", G["expr -> comp"]), + (37, G["}"]): ("REDUCE", G["expr -> comp"]), + (37, G[","]): ("REDUCE", G["expr -> comp"]), (37, G["in"]): ("REDUCE", G["expr -> comp"]), - (38, G["-"]): ("SHIFT", 64), - (38, G["<="]): ("SHIFT", 68), - (38, G["="]): ("SHIFT", 70), - (38, G["+"]): ("SHIFT", 39), - (38, G["}"]): ("REDUCE", G["comp -> arith"]), - (38, G[","]): ("REDUCE", G["comp -> arith"]), - (38, G["then"]): ("REDUCE", G["comp -> arith"]), - (38, G["loop"]): ("REDUCE", G["comp -> arith"]), - (38, G[";"]): ("REDUCE", G["comp -> arith"]), - (38, G["pool"]): ("REDUCE", G["comp -> arith"]), + (37, G["error"]): ("REDUCE", G["expr -> comp"]), + (37, G[";"]): ("REDUCE", G["expr -> comp"]), (38, G["else"]): ("REDUCE", G["comp -> arith"]), (38, G[")"]): ("REDUCE", G["comp -> arith"]), + (38, G["pool"]): ("REDUCE", G["comp -> arith"]), (38, G["of"]): ("REDUCE", G["comp -> arith"]), (38, G["fi"]): ("REDUCE", G["comp -> arith"]), - (38, G["error"]): ("REDUCE", G["comp -> arith"]), + (38, G["then"]): ("REDUCE", G["comp -> arith"]), + (38, G["loop"]): ("REDUCE", G["comp -> arith"]), + (38, G["}"]): ("REDUCE", G["comp -> arith"]), + (38, G[","]): ("REDUCE", G["comp -> arith"]), (38, G["in"]): ("REDUCE", G["comp -> arith"]), + (38, G["error"]): ("REDUCE", G["comp -> arith"]), + (38, G[";"]): ("REDUCE", G["comp -> arith"]), + (38, G["+"]): ("SHIFT", 39), (38, G["<"]): ("SHIFT", 66), - (39, G["true"]): ("SHIFT", 25), - (39, G["string"]): ("SHIFT", 33), - (39, G["new"]): ("SHIFT", 22), - (39, G["false"]): ("SHIFT", 26), - (39, G["~"]): ("SHIFT", 27), + (38, G["="]): ("SHIFT", 70), + (38, G["-"]): ("SHIFT", 64), + (38, G["<="]): ("SHIFT", 68), + (39, G["int"]): ("SHIFT", 34), (39, G["id"]): ("SHIFT", 28), + (39, G["string"]): ("SHIFT", 33), (39, G["("]): ("SHIFT", 11), - (39, G["int"]): ("SHIFT", 34), (39, G["isvoid"]): ("SHIFT", 24), + (39, G["true"]): ("SHIFT", 25), + (39, G["~"]): ("SHIFT", 27), + (39, G["new"]): ("SHIFT", 22), + (39, G["false"]): ("SHIFT", 26), (40, G["*"]): ("SHIFT", 41), + (40, G["/"]): ("SHIFT", 54), + (40, G["<="]): ("REDUCE", G["arith -> arith + term"]), + (40, G["="]): ("REDUCE", G["arith -> arith + term"]), + (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), + (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), (40, G[","]): ("REDUCE", G["arith -> arith + term"]), + (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), (40, G["then"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["<"]): ("REDUCE", G["arith -> arith + term"]), (40, G[";"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["else"]): ("REDUCE", G["arith -> arith + term"]), (40, G["+"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["else"]): ("REDUCE", G["arith -> arith + term"]), (40, G["of"]): ("REDUCE", G["arith -> arith + term"]), (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), (40, G["fi"]): ("REDUCE", G["arith -> arith + term"]), (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["<"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["<="]): ("REDUCE", G["arith -> arith + term"]), - (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["="]): ("REDUCE", G["arith -> arith + term"]), - (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["/"]): ("SHIFT", 54), - (41, G["false"]): ("SHIFT", 26), - (41, G["~"]): ("SHIFT", 27), + (41, G["("]): ("SHIFT", 11), + (41, G["isvoid"]): ("SHIFT", 24), (41, G["true"]): ("SHIFT", 25), - (41, G["int"]): ("SHIFT", 34), (41, G["id"]): ("SHIFT", 28), - (41, G["("]): ("SHIFT", 11), + (41, G["int"]): ("SHIFT", 34), + (41, G["~"]): ("SHIFT", 27), (41, G["string"]): ("SHIFT", 33), - (41, G["isvoid"]): ("SHIFT", 24), (41, G["new"]): ("SHIFT", 22), + (41, G["false"]): ("SHIFT", 26), + (42, G["<="]): ("REDUCE", G["term -> term * factor"]), + (42, G["error"]): ("REDUCE", G["term -> term * factor"]), + (42, G["="]): ("REDUCE", G["term -> term * factor"]), + (42, G["pool"]): ("REDUCE", G["term -> term * factor"]), + (42, G[")"]): ("REDUCE", G["term -> term * factor"]), + (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), + (42, G["in"]): ("REDUCE", G["term -> term * factor"]), (42, G[","]): ("REDUCE", G["term -> term * factor"]), (42, G["then"]): ("REDUCE", G["term -> term * factor"]), (42, G[";"]): ("REDUCE", G["term -> term * factor"]), - (42, G["else"]): ("REDUCE", G["term -> term * factor"]), (42, G["+"]): ("REDUCE", G["term -> term * factor"]), + (42, G["else"]): ("REDUCE", G["term -> term * factor"]), (42, G["of"]): ("REDUCE", G["term -> term * factor"]), (42, G["-"]): ("REDUCE", G["term -> term * factor"]), (42, G["fi"]): ("REDUCE", G["term -> term * factor"]), @@ -465,19 +472,18 @@ def __action_table(): (42, G["}"]): ("REDUCE", G["term -> term * factor"]), (42, G["/"]): ("REDUCE", G["term -> term * factor"]), (42, G["<"]): ("REDUCE", G["term -> term * factor"]), - (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), - (42, G["<="]): ("REDUCE", G["term -> term * factor"]), - (42, G["pool"]): ("REDUCE", G["term -> term * factor"]), - (42, G[")"]): ("REDUCE", G["term -> term * factor"]), - (42, G["="]): ("REDUCE", G["term -> term * factor"]), - (42, G["error"]): ("REDUCE", G["term -> term * factor"]), - (42, G["in"]): ("REDUCE", G["term -> term * factor"]), - (43, G["."]): ("SHIFT", 44), + (43, G["<="]): ("REDUCE", G["factor -> atom"]), + (43, G["error"]): ("REDUCE", G["factor -> atom"]), + (43, G["="]): ("REDUCE", G["factor -> atom"]), + (43, G["pool"]): ("REDUCE", G["factor -> atom"]), + (43, G[")"]): ("REDUCE", G["factor -> atom"]), + (43, G["loop"]): ("REDUCE", G["factor -> atom"]), + (43, G["in"]): ("REDUCE", G["factor -> atom"]), (43, G[","]): ("REDUCE", G["factor -> atom"]), (43, G["then"]): ("REDUCE", G["factor -> atom"]), (43, G[";"]): ("REDUCE", G["factor -> atom"]), - (43, G["else"]): ("REDUCE", G["factor -> atom"]), (43, G["+"]): ("REDUCE", G["factor -> atom"]), + (43, G["else"]): ("REDUCE", G["factor -> atom"]), (43, G["of"]): ("REDUCE", G["factor -> atom"]), (43, G["-"]): ("REDUCE", G["factor -> atom"]), (43, G["fi"]): ("REDUCE", G["factor -> atom"]), @@ -485,37 +491,38 @@ def __action_table(): (43, G["}"]): ("REDUCE", G["factor -> atom"]), (43, G["/"]): ("REDUCE", G["factor -> atom"]), (43, G["<"]): ("REDUCE", G["factor -> atom"]), - (43, G["loop"]): ("REDUCE", G["factor -> atom"]), - (43, G["<="]): ("REDUCE", G["factor -> atom"]), - (43, G["pool"]): ("REDUCE", G["factor -> atom"]), - (43, G[")"]): ("REDUCE", G["factor -> atom"]), - (43, G["="]): ("REDUCE", G["factor -> atom"]), - (43, G["error"]): ("REDUCE", G["factor -> atom"]), - (43, G["in"]): ("REDUCE", G["factor -> atom"]), (43, G["@"]): ("SHIFT", 57), + (43, G["."]): ("SHIFT", 44), (44, G["id"]): ("SHIFT", 45), (45, G["("]): ("SHIFT", 46), - (46, G["string"]): ("SHIFT", 33), + (46, G["while"]): ("SHIFT", 13), + (46, G["~"]): ("SHIFT", 27), + (46, G["let"]): ("SHIFT", 14), (46, G["id"]): ("SHIFT", 31), - (46, G["true"]): ("SHIFT", 25), + (46, G["false"]): ("SHIFT", 26), + (46, G["("]): ("SHIFT", 11), + (46, G[")"]): ("REDUCE", G["expr-list -> e"]), (46, G["isvoid"]): ("SHIFT", 24), - (46, G["int"]): ("SHIFT", 34), + (46, G["new"]): ("SHIFT", 22), + (46, G["true"]): ("SHIFT", 25), (46, G["case"]): ("SHIFT", 21), - (46, G["false"]): ("SHIFT", 26), - (46, G["while"]): ("SHIFT", 13), - (46, G["if"]): ("SHIFT", 12), - (46, G["let"]): ("SHIFT", 14), - (46, G["~"]): ("SHIFT", 27), (46, G["not"]): ("SHIFT", 30), - (46, G["("]): ("SHIFT", 11), + (46, G["string"]): ("SHIFT", 33), (46, G["{"]): ("SHIFT", 10), - (46, G[")"]): ("REDUCE", G["expr-list -> e"]), - (46, G["new"]): ("SHIFT", 22), + (46, G["int"]): ("SHIFT", 34), + (46, G["if"]): ("SHIFT", 12), (47, G[")"]): ("SHIFT", 48), + (48, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), @@ -525,66 +532,66 @@ def __action_table(): (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (49, G[")"]): ("REDUCE", G["expr-list -> not-empty-expr-list"]), (50, G[","]): ("SHIFT", 51), (50, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), - (51, G["string"]): ("SHIFT", 33), + (51, G["while"]): ("SHIFT", 13), + (51, G["~"]): ("SHIFT", 27), + (51, G["let"]): ("SHIFT", 14), (51, G["id"]): ("SHIFT", 31), - (51, G["true"]): ("SHIFT", 25), + (51, G["false"]): ("SHIFT", 26), + (51, G["("]): ("SHIFT", 11), (51, G["isvoid"]): ("SHIFT", 24), - (51, G["int"]): ("SHIFT", 34), + (51, G["new"]): ("SHIFT", 22), + (51, G["true"]): ("SHIFT", 25), (51, G["case"]): ("SHIFT", 21), - (51, G["false"]): ("SHIFT", 26), - (51, G["while"]): ("SHIFT", 13), - (51, G["if"]): ("SHIFT", 12), - (51, G["let"]): ("SHIFT", 14), - (51, G["~"]): ("SHIFT", 27), (51, G["not"]): ("SHIFT", 30), - (51, G["("]): ("SHIFT", 11), + (51, G["string"]): ("SHIFT", 33), (51, G["{"]): ("SHIFT", 10), - (51, G["new"]): ("SHIFT", 22), + (51, G["int"]): ("SHIFT", 34), + (51, G["if"]): ("SHIFT", 12), (52, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr , not-empty-expr-list"]), (53, G["*"]): ("SHIFT", 41), + (53, G["/"]): ("SHIFT", 54), + (53, G["<="]): ("REDUCE", G["arith -> term"]), + (53, G["="]): ("REDUCE", G["arith -> term"]), + (53, G["pool"]): ("REDUCE", G["arith -> term"]), + (53, G[")"]): ("REDUCE", G["arith -> term"]), + (53, G["loop"]): ("REDUCE", G["arith -> term"]), (53, G[","]): ("REDUCE", G["arith -> term"]), + (53, G["in"]): ("REDUCE", G["arith -> term"]), (53, G["then"]): ("REDUCE", G["arith -> term"]), + (53, G["<"]): ("REDUCE", G["arith -> term"]), (53, G[";"]): ("REDUCE", G["arith -> term"]), - (53, G["else"]): ("REDUCE", G["arith -> term"]), (53, G["+"]): ("REDUCE", G["arith -> term"]), + (53, G["else"]): ("REDUCE", G["arith -> term"]), (53, G["of"]): ("REDUCE", G["arith -> term"]), (53, G["-"]): ("REDUCE", G["arith -> term"]), (53, G["fi"]): ("REDUCE", G["arith -> term"]), (53, G["}"]): ("REDUCE", G["arith -> term"]), - (53, G["<"]): ("REDUCE", G["arith -> term"]), - (53, G["loop"]): ("REDUCE", G["arith -> term"]), - (53, G["<="]): ("REDUCE", G["arith -> term"]), - (53, G["pool"]): ("REDUCE", G["arith -> term"]), - (53, G["="]): ("REDUCE", G["arith -> term"]), - (53, G[")"]): ("REDUCE", G["arith -> term"]), (53, G["error"]): ("REDUCE", G["arith -> term"]), - (53, G["in"]): ("REDUCE", G["arith -> term"]), - (53, G["/"]): ("SHIFT", 54), - (54, G["false"]): ("SHIFT", 26), - (54, G["~"]): ("SHIFT", 27), - (54, G["true"]): ("SHIFT", 25), - (54, G["string"]): ("SHIFT", 33), - (54, G["int"]): ("SHIFT", 34), - (54, G["id"]): ("SHIFT", 28), (54, G["("]): ("SHIFT", 11), (54, G["isvoid"]): ("SHIFT", 24), + (54, G["true"]): ("SHIFT", 25), + (54, G["id"]): ("SHIFT", 28), + (54, G["int"]): ("SHIFT", 34), + (54, G["~"]): ("SHIFT", 27), + (54, G["string"]): ("SHIFT", 33), (54, G["new"]): ("SHIFT", 22), + (54, G["false"]): ("SHIFT", 26), + (55, G["<="]): ("REDUCE", G["term -> term / factor"]), + (55, G["error"]): ("REDUCE", G["term -> term / factor"]), + (55, G["="]): ("REDUCE", G["term -> term / factor"]), + (55, G["pool"]): ("REDUCE", G["term -> term / factor"]), + (55, G[")"]): ("REDUCE", G["term -> term / factor"]), + (55, G["loop"]): ("REDUCE", G["term -> term / factor"]), + (55, G["in"]): ("REDUCE", G["term -> term / factor"]), (55, G[","]): ("REDUCE", G["term -> term / factor"]), (55, G["then"]): ("REDUCE", G["term -> term / factor"]), (55, G[";"]): ("REDUCE", G["term -> term / factor"]), - (55, G["else"]): ("REDUCE", G["term -> term / factor"]), (55, G["+"]): ("REDUCE", G["term -> term / factor"]), + (55, G["else"]): ("REDUCE", G["term -> term / factor"]), (55, G["of"]): ("REDUCE", G["term -> term / factor"]), (55, G["-"]): ("REDUCE", G["term -> term / factor"]), (55, G["fi"]): ("REDUCE", G["term -> term / factor"]), @@ -592,18 +599,18 @@ def __action_table(): (55, G["}"]): ("REDUCE", G["term -> term / factor"]), (55, G["/"]): ("REDUCE", G["term -> term / factor"]), (55, G["<"]): ("REDUCE", G["term -> term / factor"]), - (55, G["loop"]): ("REDUCE", G["term -> term / factor"]), - (55, G["<="]): ("REDUCE", G["term -> term / factor"]), - (55, G["pool"]): ("REDUCE", G["term -> term / factor"]), - (55, G[")"]): ("REDUCE", G["term -> term / factor"]), - (55, G["="]): ("REDUCE", G["term -> term / factor"]), - (55, G["error"]): ("REDUCE", G["term -> term / factor"]), - (55, G["in"]): ("REDUCE", G["term -> term / factor"]), + (56, G["<="]): ("REDUCE", G["term -> factor"]), + (56, G["error"]): ("REDUCE", G["term -> factor"]), + (56, G["="]): ("REDUCE", G["term -> factor"]), + (56, G["pool"]): ("REDUCE", G["term -> factor"]), + (56, G[")"]): ("REDUCE", G["term -> factor"]), + (56, G["loop"]): ("REDUCE", G["term -> factor"]), + (56, G["in"]): ("REDUCE", G["term -> factor"]), (56, G[","]): ("REDUCE", G["term -> factor"]), (56, G["then"]): ("REDUCE", G["term -> factor"]), (56, G[";"]): ("REDUCE", G["term -> factor"]), - (56, G["else"]): ("REDUCE", G["term -> factor"]), (56, G["+"]): ("REDUCE", G["term -> factor"]), + (56, G["else"]): ("REDUCE", G["term -> factor"]), (56, G["of"]): ("REDUCE", G["term -> factor"]), (56, G["-"]): ("REDUCE", G["term -> factor"]), (56, G["fi"]): ("REDUCE", G["term -> factor"]), @@ -611,40 +618,40 @@ def __action_table(): (56, G["}"]): ("REDUCE", G["term -> factor"]), (56, G["/"]): ("REDUCE", G["term -> factor"]), (56, G["<"]): ("REDUCE", G["term -> factor"]), - (56, G["loop"]): ("REDUCE", G["term -> factor"]), - (56, G["<="]): ("REDUCE", G["term -> factor"]), - (56, G["pool"]): ("REDUCE", G["term -> factor"]), - (56, G[")"]): ("REDUCE", G["term -> factor"]), - (56, G["="]): ("REDUCE", G["term -> factor"]), - (56, G["error"]): ("REDUCE", G["term -> factor"]), - (56, G["in"]): ("REDUCE", G["term -> factor"]), (57, G["type"]): ("SHIFT", 58), (58, G["."]): ("SHIFT", 59), (59, G["id"]): ("SHIFT", 60), (60, G["("]): ("SHIFT", 61), - (61, G["string"]): ("SHIFT", 33), - (61, G["id"]): ("SHIFT", 31), - (61, G["true"]): ("SHIFT", 25), - (61, G["isvoid"]): ("SHIFT", 24), - (61, G["int"]): ("SHIFT", 34), - (61, G["case"]): ("SHIFT", 21), - (61, G["false"]): ("SHIFT", 26), (61, G["while"]): ("SHIFT", 13), - (61, G["if"]): ("SHIFT", 12), - (61, G["let"]): ("SHIFT", 14), (61, G["~"]): ("SHIFT", 27), - (61, G["not"]): ("SHIFT", 30), + (61, G["let"]): ("SHIFT", 14), + (61, G["id"]): ("SHIFT", 31), + (61, G["false"]): ("SHIFT", 26), (61, G["("]): ("SHIFT", 11), - (61, G["{"]): ("SHIFT", 10), (61, G[")"]): ("REDUCE", G["expr-list -> e"]), + (61, G["isvoid"]): ("SHIFT", 24), (61, G["new"]): ("SHIFT", 22), + (61, G["true"]): ("SHIFT", 25), + (61, G["case"]): ("SHIFT", 21), + (61, G["not"]): ("SHIFT", 30), + (61, G["string"]): ("SHIFT", 33), + (61, G["{"]): ("SHIFT", 10), + (61, G["int"]): ("SHIFT", 34), + (61, G["if"]): ("SHIFT", 12), (62, G[")"]): ("SHIFT", 63), + (63, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), @@ -652,128 +659,128 @@ def __action_table(): (63, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (64, G["true"]): ("SHIFT", 25), - (64, G["string"]): ("SHIFT", 33), - (64, G["new"]): ("SHIFT", 22), - (64, G["false"]): ("SHIFT", 26), - (64, G["~"]): ("SHIFT", 27), + (64, G["int"]): ("SHIFT", 34), (64, G["id"]): ("SHIFT", 28), + (64, G["string"]): ("SHIFT", 33), (64, G["("]): ("SHIFT", 11), - (64, G["int"]): ("SHIFT", 34), (64, G["isvoid"]): ("SHIFT", 24), + (64, G["true"]): ("SHIFT", 25), + (64, G["~"]): ("SHIFT", 27), + (64, G["new"]): ("SHIFT", 22), + (64, G["false"]): ("SHIFT", 26), (65, G["*"]): ("SHIFT", 41), + (65, G["/"]): ("SHIFT", 54), + (65, G["<="]): ("REDUCE", G["arith -> arith - term"]), + (65, G["="]): ("REDUCE", G["arith -> arith - term"]), + (65, G["pool"]): ("REDUCE", G["arith -> arith - term"]), + (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["loop"]): ("REDUCE", G["arith -> arith - term"]), (65, G[","]): ("REDUCE", G["arith -> arith - term"]), + (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), (65, G["then"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["<"]): ("REDUCE", G["arith -> arith - term"]), (65, G[";"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["else"]): ("REDUCE", G["arith -> arith - term"]), (65, G["+"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["else"]): ("REDUCE", G["arith -> arith - term"]), (65, G["of"]): ("REDUCE", G["arith -> arith - term"]), (65, G["-"]): ("REDUCE", G["arith -> arith - term"]), (65, G["fi"]): ("REDUCE", G["arith -> arith - term"]), (65, G["}"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["<"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["loop"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["<="]): ("REDUCE", G["arith -> arith - term"]), - (65, G["pool"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["="]): ("REDUCE", G["arith -> arith - term"]), - (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), (65, G["error"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["/"]): ("SHIFT", 54), + (66, G["string"]): ("SHIFT", 33), + (66, G["isvoid"]): ("SHIFT", 24), + (66, G["~"]): ("SHIFT", 27), (66, G["("]): ("SHIFT", 11), - (66, G["id"]): ("SHIFT", 28), - (66, G["int"]): ("SHIFT", 34), (66, G["false"]): ("SHIFT", 26), - (66, G["isvoid"]): ("SHIFT", 24), (66, G["new"]): ("SHIFT", 22), - (66, G["string"]): ("SHIFT", 33), - (66, G["~"]): ("SHIFT", 27), (66, G["true"]): ("SHIFT", 25), + (66, G["id"]): ("SHIFT", 28), + (66, G["int"]): ("SHIFT", 34), + (67, G["-"]): ("SHIFT", 64), (67, G["+"]): ("SHIFT", 39), - (67, G["}"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["else"]): ("REDUCE", G["comp -> arith < arith"]), (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["}"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), (67, G["in"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["-"]): ("SHIFT", 64), + (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), + (68, G["string"]): ("SHIFT", 33), + (68, G["isvoid"]): ("SHIFT", 24), + (68, G["~"]): ("SHIFT", 27), (68, G["("]): ("SHIFT", 11), - (68, G["id"]): ("SHIFT", 28), - (68, G["int"]): ("SHIFT", 34), (68, G["false"]): ("SHIFT", 26), - (68, G["isvoid"]): ("SHIFT", 24), (68, G["new"]): ("SHIFT", 22), - (68, G["string"]): ("SHIFT", 33), - (68, G["~"]): ("SHIFT", 27), (68, G["true"]): ("SHIFT", 25), + (68, G["id"]): ("SHIFT", 28), + (68, G["int"]): ("SHIFT", 34), (69, G["+"]): ("SHIFT", 39), - (69, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["-"]): ("SHIFT", 64), (69, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["-"]): ("SHIFT", 64), + (69, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), + (70, G["string"]): ("SHIFT", 33), + (70, G["isvoid"]): ("SHIFT", 24), + (70, G["~"]): ("SHIFT", 27), (70, G["("]): ("SHIFT", 11), - (70, G["id"]): ("SHIFT", 28), - (70, G["int"]): ("SHIFT", 34), (70, G["false"]): ("SHIFT", 26), - (70, G["isvoid"]): ("SHIFT", 24), (70, G["new"]): ("SHIFT", 22), - (70, G["string"]): ("SHIFT", 33), - (70, G["~"]): ("SHIFT", 27), (70, G["true"]): ("SHIFT", 25), - (71, G["+"]): ("SHIFT", 39), + (70, G["id"]): ("SHIFT", 28), + (70, G["int"]): ("SHIFT", 34), (71, G["-"]): ("SHIFT", 64), - (71, G["}"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[";"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["else"]): ("REDUCE", G["comp -> arith = arith"]), (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["error"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["}"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), (71, G["in"]): ("REDUCE", G["comp -> arith = arith"]), - (72, G["}"]): ("REDUCE", G["expr -> not expr"]), - (72, G[","]): ("REDUCE", G["expr -> not expr"]), - (72, G["then"]): ("REDUCE", G["expr -> not expr"]), - (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), - (72, G[";"]): ("REDUCE", G["expr -> not expr"]), - (72, G["pool"]): ("REDUCE", G["expr -> not expr"]), + (71, G["error"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[";"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["+"]): ("SHIFT", 39), (72, G["else"]): ("REDUCE", G["expr -> not expr"]), + (72, G["error"]): ("REDUCE", G["expr -> not expr"]), (72, G[")"]): ("REDUCE", G["expr -> not expr"]), + (72, G["pool"]): ("REDUCE", G["expr -> not expr"]), (72, G["of"]): ("REDUCE", G["expr -> not expr"]), (72, G["fi"]): ("REDUCE", G["expr -> not expr"]), - (72, G["error"]): ("REDUCE", G["expr -> not expr"]), + (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), + (72, G["}"]): ("REDUCE", G["expr -> not expr"]), + (72, G[","]): ("REDUCE", G["expr -> not expr"]), (72, G["in"]): ("REDUCE", G["expr -> not expr"]), + (72, G["then"]): ("REDUCE", G["expr -> not expr"]), + (72, G[";"]): ("REDUCE", G["expr -> not expr"]), (73, G[")"]): ("SHIFT", 74), + (74, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), @@ -784,18 +791,18 @@ def __action_table(): (74, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G["<="]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["="]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G[")"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), (75, G[","]): ("REDUCE", G["factor -> ~ factor"]), (75, G["then"]): ("REDUCE", G["factor -> ~ factor"]), (75, G[";"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["else"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["+"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["else"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["of"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["-"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), @@ -803,18 +810,18 @@ def __action_table(): (75, G["}"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["/"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["<"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["<="]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G[")"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["="]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), + (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), @@ -822,35 +829,28 @@ def __action_table(): (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), (77, G["of"]): ("SHIFT", 78), (78, G["id"]): ("SHIFT", 79), (79, G[":"]): ("SHIFT", 80), (80, G["type"]): ("SHIFT", 81), (81, G["=>"]): ("SHIFT", 82), - (82, G["while"]): ("SHIFT", 13), - (82, G["isvoid"]): ("SHIFT", 24), + (82, G["new"]): ("SHIFT", 22), + (82, G["false"]): ("SHIFT", 26), (82, G["("]): ("SHIFT", 11), + (82, G["isvoid"]): ("SHIFT", 24), (82, G["id"]): ("SHIFT", 31), - (82, G["not"]): ("SHIFT", 30), - (82, G["true"]): ("SHIFT", 25), - (82, G["string"]): ("SHIFT", 33), (82, G["~"]): ("SHIFT", 27), - (82, G["{"]): ("SHIFT", 10), - (82, G["new"]): ("SHIFT", 22), - (82, G["int"]): ("SHIFT", 34), - (82, G["case"]): ("SHIFT", 21), + (82, G["while"]): ("SHIFT", 13), (82, G["let"]): ("SHIFT", 14), + (82, G["{"]): ("SHIFT", 10), (82, G["if"]): ("SHIFT", 12), - (82, G["false"]): ("SHIFT", 26), - (83, G["error"]): ("SHIFT", 86), + (82, G["not"]): ("SHIFT", 30), + (82, G["case"]): ("SHIFT", 21), + (82, G["int"]): ("SHIFT", 34), + (82, G["string"]): ("SHIFT", 33), + (82, G["true"]): ("SHIFT", 25), (83, G[";"]): ("SHIFT", 84), + (83, G["error"]): ("SHIFT", 86), (84, G["id"]): ("SHIFT", 79), (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), @@ -858,129 +858,136 @@ def __action_table(): (86, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), (87, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error case-list"]), (88, G["esac"]): ("SHIFT", 89), - (89, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G[","]): ("SHIFT", 91), + (89, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (90, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), + (90, G[","]): ("SHIFT", 91), (91, G["id"]): ("SHIFT", 15), (92, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), (93, G["in"]): ("SHIFT", 94), - (94, G["if"]): ("SHIFT", 12), - (94, G["while"]): ("SHIFT", 13), - (94, G["new"]): ("SHIFT", 22), - (94, G["false"]): ("SHIFT", 26), - (94, G["not"]): ("SHIFT", 30), (94, G["int"]): ("SHIFT", 34), - (94, G["isvoid"]): ("SHIFT", 24), - (94, G["id"]): ("SHIFT", 31), - (94, G["true"]): ("SHIFT", 25), - (94, G["{"]): ("SHIFT", 10), (94, G["string"]): ("SHIFT", 33), - (94, G["case"]): ("SHIFT", 21), + (94, G["true"]): ("SHIFT", 25), + (94, G["id"]): ("SHIFT", 31), (94, G["~"]): ("SHIFT", 27), + (94, G["new"]): ("SHIFT", 22), + (94, G["not"]): ("SHIFT", 30), (94, G["("]): ("SHIFT", 11), + (94, G["false"]): ("SHIFT", 26), + (94, G["while"]): ("SHIFT", 13), (94, G["let"]): ("SHIFT", 14), - (95, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G["{"]): ("SHIFT", 10), + (94, G["isvoid"]): ("SHIFT", 24), + (94, G["if"]): ("SHIFT", 12), + (94, G["case"]): ("SHIFT", 21), (95, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (96, G["loop"]): ("SHIFT", 97), - (97, G["not"]): ("SHIFT", 30), - (97, G["string"]): ("SHIFT", 33), - (97, G["new"]): ("SHIFT", 22), - (97, G["int"]): ("SHIFT", 34), - (97, G["let"]): ("SHIFT", 14), - (97, G["~"]): ("SHIFT", 27), - (97, G["case"]): ("SHIFT", 21), (97, G["false"]): ("SHIFT", 26), (97, G["("]): ("SHIFT", 11), - (97, G["id"]): ("SHIFT", 31), + (97, G["new"]): ("SHIFT", 22), + (97, G["let"]): ("SHIFT", 14), (97, G["if"]): ("SHIFT", 12), - (97, G["isvoid"]): ("SHIFT", 24), - (97, G["while"]): ("SHIFT", 13), (97, G["{"]): ("SHIFT", 10), + (97, G["id"]): ("SHIFT", 31), + (97, G["not"]): ("SHIFT", 30), + (97, G["while"]): ("SHIFT", 13), (97, G["true"]): ("SHIFT", 25), + (97, G["~"]): ("SHIFT", 27), + (97, G["int"]): ("SHIFT", 34), + (97, G["string"]): ("SHIFT", 33), + (97, G["case"]): ("SHIFT", 21), + (97, G["isvoid"]): ("SHIFT", 24), (98, G["pool"]): ("SHIFT", 99), - (99, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (100, G["then"]): ("SHIFT", 101), + (101, G["case"]): ("SHIFT", 21), (101, G["int"]): ("SHIFT", 34), - (101, G["let"]): ("SHIFT", 14), + (101, G["{"]): ("SHIFT", 10), (101, G["~"]): ("SHIFT", 27), (101, G["if"]): ("SHIFT", 12), - (101, G["while"]): ("SHIFT", 13), + (101, G["let"]): ("SHIFT", 14), + (101, G["isvoid"]): ("SHIFT", 24), (101, G["true"]): ("SHIFT", 25), - (101, G["string"]): ("SHIFT", 33), + (101, G["id"]): ("SHIFT", 31), + (101, G["while"]): ("SHIFT", 13), (101, G["not"]): ("SHIFT", 30), + (101, G["string"]): ("SHIFT", 33), + (101, G["false"]): ("SHIFT", 26), (101, G["("]): ("SHIFT", 11), - (101, G["id"]): ("SHIFT", 31), - (101, G["{"]): ("SHIFT", 10), - (101, G["isvoid"]): ("SHIFT", 24), - (101, G["case"]): ("SHIFT", 21), (101, G["new"]): ("SHIFT", 22), - (101, G["false"]): ("SHIFT", 26), (102, G["else"]): ("SHIFT", 103), - (103, G["isvoid"]): ("SHIFT", 24), - (103, G["("]): ("SHIFT", 11), + (103, G["while"]): ("SHIFT", 13), + (103, G["string"]): ("SHIFT", 33), + (103, G["let"]): ("SHIFT", 14), (103, G["id"]): ("SHIFT", 31), - (103, G["if"]): ("SHIFT", 12), - (103, G["new"]): ("SHIFT", 22), + (103, G["true"]): ("SHIFT", 25), (103, G["{"]): ("SHIFT", 10), - (103, G["false"]): ("SHIFT", 26), - (103, G["while"]): ("SHIFT", 13), + (103, G["if"]): ("SHIFT", 12), (103, G["not"]): ("SHIFT", 30), - (103, G["int"]): ("SHIFT", 34), + (103, G["new"]): ("SHIFT", 22), (103, G["case"]): ("SHIFT", 21), + (103, G["("]): ("SHIFT", 11), + (103, G["false"]): ("SHIFT", 26), + (103, G["isvoid"]): ("SHIFT", 24), (103, G["~"]): ("SHIFT", 27), - (103, G["string"]): ("SHIFT", 33), - (103, G["true"]): ("SHIFT", 25), - (103, G["let"]): ("SHIFT", 14), + (103, G["int"]): ("SHIFT", 34), (104, G["fi"]): ("SHIFT", 105), - (105, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (106, G[")"]): ("SHIFT", 107), + (107, G["<="]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["error"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["="]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G[")"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["."]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["in"]): ("REDUCE", G["atom -> ( expr )"]), (107, G[","]): ("REDUCE", G["atom -> ( expr )"]), (107, G["then"]): ("REDUCE", G["atom -> ( expr )"]), (107, G[";"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["."]): ("REDUCE", G["atom -> ( expr )"]), (107, G["@"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["+"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["else"]): ("REDUCE", G["atom -> ( expr )"]), @@ -991,124 +998,117 @@ def __action_table(): (107, G["}"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["/"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["<"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["<="]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G[")"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["="]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["error"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["in"]): ("REDUCE", G["atom -> ( expr )"]), (108, G["}"]): ("SHIFT", 109), - (109, G["}"]): ("REDUCE", G["expr -> { block }"]), - (109, G[","]): ("REDUCE", G["expr -> { block }"]), - (109, G["then"]): ("REDUCE", G["expr -> { block }"]), - (109, G["loop"]): ("REDUCE", G["expr -> { block }"]), - (109, G[";"]): ("REDUCE", G["expr -> { block }"]), - (109, G["pool"]): ("REDUCE", G["expr -> { block }"]), (109, G["else"]): ("REDUCE", G["expr -> { block }"]), (109, G[")"]): ("REDUCE", G["expr -> { block }"]), + (109, G["pool"]): ("REDUCE", G["expr -> { block }"]), (109, G["of"]): ("REDUCE", G["expr -> { block }"]), (109, G["fi"]): ("REDUCE", G["expr -> { block }"]), - (109, G["error"]): ("REDUCE", G["expr -> { block }"]), + (109, G["then"]): ("REDUCE", G["expr -> { block }"]), + (109, G["loop"]): ("REDUCE", G["expr -> { block }"]), + (109, G["}"]): ("REDUCE", G["expr -> { block }"]), + (109, G[","]): ("REDUCE", G["expr -> { block }"]), (109, G["in"]): ("REDUCE", G["expr -> { block }"]), + (109, G["error"]): ("REDUCE", G["expr -> { block }"]), + (109, G[";"]): ("REDUCE", G["expr -> { block }"]), (110, G["error"]): ("SHIFT", 113), (110, G[";"]): ("SHIFT", 111), - (111, G["while"]): ("SHIFT", 13), - (111, G["isvoid"]): ("SHIFT", 24), + (111, G["new"]): ("SHIFT", 22), (111, G["("]): ("SHIFT", 11), + (111, G["false"]): ("SHIFT", 26), + (111, G["isvoid"]): ("SHIFT", 24), (111, G["id"]): ("SHIFT", 31), - (111, G["not"]): ("SHIFT", 30), - (111, G["true"]): ("SHIFT", 25), - (111, G["string"]): ("SHIFT", 33), (111, G["~"]): ("SHIFT", 27), - (111, G["{"]): ("SHIFT", 10), - (111, G["new"]): ("SHIFT", 22), - (111, G["}"]): ("REDUCE", G["block -> expr ;"]), - (111, G["int"]): ("SHIFT", 34), - (111, G["case"]): ("SHIFT", 21), + (111, G["while"]): ("SHIFT", 13), (111, G["let"]): ("SHIFT", 14), + (111, G["}"]): ("REDUCE", G["block -> expr ;"]), + (111, G["{"]): ("SHIFT", 10), (111, G["if"]): ("SHIFT", 12), - (111, G["false"]): ("SHIFT", 26), + (111, G["not"]): ("SHIFT", 30), + (111, G["case"]): ("SHIFT", 21), + (111, G["int"]): ("SHIFT", 34), + (111, G["string"]): ("SHIFT", 33), + (111, G["true"]): ("SHIFT", 25), (112, G["}"]): ("REDUCE", G["block -> expr ; block"]), - (113, G["while"]): ("SHIFT", 13), - (113, G["isvoid"]): ("SHIFT", 24), + (113, G["new"]): ("SHIFT", 22), + (113, G["false"]): ("SHIFT", 26), (113, G["("]): ("SHIFT", 11), + (113, G["isvoid"]): ("SHIFT", 24), (113, G["id"]): ("SHIFT", 31), - (113, G["not"]): ("SHIFT", 30), - (113, G["true"]): ("SHIFT", 25), - (113, G["string"]): ("SHIFT", 33), (113, G["~"]): ("SHIFT", 27), - (113, G["{"]): ("SHIFT", 10), - (113, G["new"]): ("SHIFT", 22), - (113, G["}"]): ("REDUCE", G["block -> expr error"]), - (113, G["int"]): ("SHIFT", 34), - (113, G["case"]): ("SHIFT", 21), + (113, G["while"]): ("SHIFT", 13), (113, G["let"]): ("SHIFT", 14), + (113, G["}"]): ("REDUCE", G["block -> expr error"]), + (113, G["{"]): ("SHIFT", 10), (113, G["if"]): ("SHIFT", 12), - (113, G["false"]): ("SHIFT", 26), + (113, G["not"]): ("SHIFT", 30), + (113, G["case"]): ("SHIFT", 21), + (113, G["int"]): ("SHIFT", 34), + (113, G["string"]): ("SHIFT", 33), + (113, G["true"]): ("SHIFT", 25), (114, G["}"]): ("REDUCE", G["block -> expr error block"]), (115, G["}"]): ("SHIFT", 116), - (116, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), (116, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (116, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), (117, G[":"]): ("SHIFT", 118), (118, G["type"]): ("SHIFT", 119), - (119, G[")"]): ("REDUCE", G["param-list -> id : type"]), (119, G[","]): ("SHIFT", 120), + (119, G[")"]): ("REDUCE", G["param-list -> id : type"]), (120, G["id"]): ("SHIFT", 117), (121, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), (122, G[")"]): ("SHIFT", 123), (123, G[":"]): ("SHIFT", 124), (124, G["type"]): ("SHIFT", 125), (125, G["{"]): ("SHIFT", 126), - (126, G["if"]): ("SHIFT", 12), - (126, G["new"]): ("SHIFT", 22), - (126, G["false"]): ("SHIFT", 26), + (126, G["while"]): ("SHIFT", 13), (126, G["isvoid"]): ("SHIFT", 24), - (126, G["("]): ("SHIFT", 11), - (126, G["not"]): ("SHIFT", 30), + (126, G["true"]): ("SHIFT", 25), (126, G["id"]): ("SHIFT", 31), - (126, G["{"]): ("SHIFT", 10), - (126, G["int"]): ("SHIFT", 34), (126, G["~"]): ("SHIFT", 27), - (126, G["string"]): ("SHIFT", 33), + (126, G["new"]): ("SHIFT", 22), + (126, G["("]): ("SHIFT", 11), + (126, G["false"]): ("SHIFT", 26), + (126, G["int"]): ("SHIFT", 34), (126, G["case"]): ("SHIFT", 21), - (126, G["true"]): ("SHIFT", 25), + (126, G["not"]): ("SHIFT", 30), + (126, G["{"]): ("SHIFT", 10), + (126, G["if"]): ("SHIFT", 12), (126, G["let"]): ("SHIFT", 14), - (126, G["while"]): ("SHIFT", 13), + (126, G["string"]): ("SHIFT", 33), (127, G["}"]): ("SHIFT", 128), - (128, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (128, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (128, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (129, G["type"]): ("SHIFT", 130), - (130, G[";"]): ("REDUCE", G["attribute -> id : type"]), (130, G["error"]): ("REDUCE", G["attribute -> id : type"]), + (130, G[";"]): ("REDUCE", G["attribute -> id : type"]), (130, G["<-"]): ("SHIFT", 131), - (131, G["while"]): ("SHIFT", 13), - (131, G["isvoid"]): ("SHIFT", 24), + (131, G["new"]): ("SHIFT", 22), + (131, G["false"]): ("SHIFT", 26), (131, G["("]): ("SHIFT", 11), + (131, G["isvoid"]): ("SHIFT", 24), (131, G["id"]): ("SHIFT", 31), - (131, G["not"]): ("SHIFT", 30), - (131, G["true"]): ("SHIFT", 25), - (131, G["string"]): ("SHIFT", 33), (131, G["~"]): ("SHIFT", 27), - (131, G["{"]): ("SHIFT", 10), - (131, G["new"]): ("SHIFT", 22), - (131, G["int"]): ("SHIFT", 34), - (131, G["case"]): ("SHIFT", 21), + (131, G["while"]): ("SHIFT", 13), (131, G["let"]): ("SHIFT", 14), + (131, G["{"]): ("SHIFT", 10), (131, G["if"]): ("SHIFT", 12), - (131, G["false"]): ("SHIFT", 26), + (131, G["not"]): ("SHIFT", 30), + (131, G["case"]): ("SHIFT", 21), + (131, G["int"]): ("SHIFT", 34), + (131, G["string"]): ("SHIFT", 33), + (131, G["true"]): ("SHIFT", 25), (132, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), (132, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), (133, G["}"]): ("SHIFT", 134), - (134, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), (134, G["class"]): ("REDUCE", G["class-def -> class type { feature-list }"]), - (135, G[";"]): ("SHIFT", 136), + (134, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), (135, G["error"]): ("SHIFT", 143), + (135, G[";"]): ("SHIFT", 136), (136, G["id"]): ("SHIFT", 4), (136, G["}"]): ("REDUCE", G["feature-list -> e"]), (137, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), - (138, G[";"]): ("SHIFT", 139), (138, G["error"]): ("SHIFT", 141), + (138, G[";"]): ("SHIFT", 139), (139, G["id"]): ("SHIFT", 4), (139, G["}"]): ("REDUCE", G["feature-list -> e"]), (140, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), @@ -1123,8 +1123,8 @@ def __action_table(): (147, G["id"]): ("SHIFT", 4), (147, G["}"]): ("REDUCE", G["feature-list -> e"]), (148, G["}"]): ("SHIFT", 149), - (149, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), (149, G["class"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), + (149, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), (150, G["$"]): ("OK", None), (151, G["$"]): ("REDUCE", G["program -> class-list"]), (152, G["class"]): ("SHIFT", 1), @@ -1135,94 +1135,94 @@ def __action_table(): @staticmethod def __goto_table(): return { + (0, G["program"]): 150, (0, G["class-list"]): 151, (0, G["class-def"]): 152, - (0, G["program"]): 150, (3, G["attribute"]): 135, (3, G["method"]): 138, (3, G["feature-list"]): 133, (5, G["param-list"]): 122, (9, G["atom"]): 43, - (9, G["comp"]): 37, + (9, G["function-call"]): 35, (9, G["arith"]): 38, (9, G["term"]): 53, (9, G["factor"]): 56, + (9, G["comp"]): 37, (9, G["expr"]): 115, - (9, G["function-call"]): 35, - (10, G["atom"]): 43, + (10, G["function-call"]): 35, (10, G["arith"]): 38, - (10, G["comp"]): 37, (10, G["block"]): 108, - (10, G["term"]): 53, (10, G["expr"]): 110, + (10, G["term"]): 53, + (10, G["atom"]): 43, + (10, G["comp"]): 37, (10, G["factor"]): 56, - (10, G["function-call"]): 35, - (11, G["term"]): 53, (11, G["atom"]): 43, - (11, G["factor"]): 56, (11, G["arith"]): 38, + (11, G["term"]): 53, + (11, G["expr"]): 106, (11, G["comp"]): 37, + (11, G["factor"]): 56, (11, G["function-call"]): 35, - (11, G["expr"]): 106, (12, G["arith"]): 38, + (12, G["comp"]): 37, + (12, G["expr"]): 100, (12, G["term"]): 53, - (12, G["atom"]): 43, (12, G["function-call"]): 35, + (12, G["atom"]): 43, (12, G["factor"]): 56, - (12, G["expr"]): 100, - (12, G["comp"]): 37, (13, G["factor"]): 56, - (13, G["comp"]): 37, (13, G["term"]): 53, (13, G["arith"]): 38, + (13, G["comp"]): 37, (13, G["atom"]): 43, (13, G["function-call"]): 35, (13, G["expr"]): 96, (14, G["declaration-list"]): 93, (18, G["declaration-list"]): 19, - (20, G["term"]): 53, (20, G["arith"]): 38, - (20, G["comp"]): 37, - (20, G["expr"]): 90, - (20, G["function-call"]): 35, (20, G["atom"]): 43, + (20, G["expr"]): 90, + (20, G["term"]): 53, (20, G["factor"]): 56, - (21, G["term"]): 53, - (21, G["comp"]): 37, + (20, G["function-call"]): 35, + (20, G["comp"]): 37, (21, G["atom"]): 43, - (21, G["function-call"]): 35, - (21, G["expr"]): 77, (21, G["arith"]): 38, + (21, G["comp"]): 37, + (21, G["expr"]): 77, + (21, G["term"]): 53, + (21, G["function-call"]): 35, (21, G["factor"]): 56, - (24, G["factor"]): 76, (24, G["atom"]): 43, + (24, G["factor"]): 76, (24, G["function-call"]): 35, (27, G["atom"]): 43, - (27, G["factor"]): 75, (27, G["function-call"]): 35, - (29, G["atom"]): 43, + (27, G["factor"]): 75, + (29, G["arith"]): 38, (29, G["term"]): 53, - (29, G["expr-list"]): 73, (29, G["factor"]): 56, - (29, G["function-call"]): 35, - (29, G["arith"]): 38, + (29, G["expr-list"]): 73, (29, G["expr"]): 50, + (29, G["atom"]): 43, + (29, G["function-call"]): 35, (29, G["comp"]): 37, (29, G["not-empty-expr-list"]): 49, - (30, G["expr"]): 72, + (30, G["factor"]): 56, (30, G["arith"]): 38, (30, G["term"]): 53, - (30, G["factor"]): 56, (30, G["comp"]): 37, - (30, G["atom"]): 43, (30, G["function-call"]): 35, + (30, G["atom"]): 43, + (30, G["expr"]): 72, + (32, G["factor"]): 56, (32, G["arith"]): 38, (32, G["term"]): 53, - (32, G["expr"]): 36, - (32, G["factor"]): 56, (32, G["comp"]): 37, - (32, G["atom"]): 43, (32, G["function-call"]): 35, + (32, G["atom"]): 43, + (32, G["expr"]): 36, (39, G["atom"]): 43, (39, G["term"]): 40, (39, G["factor"]): 56, @@ -1230,32 +1230,32 @@ def __goto_table(): (41, G["atom"]): 43, (41, G["factor"]): 42, (41, G["function-call"]): 35, - (46, G["atom"]): 43, + (46, G["arith"]): 38, (46, G["term"]): 53, (46, G["factor"]): 56, - (46, G["function-call"]): 35, - (46, G["arith"]): 38, (46, G["expr"]): 50, + (46, G["atom"]): 43, + (46, G["expr-list"]): 47, + (46, G["function-call"]): 35, (46, G["comp"]): 37, (46, G["not-empty-expr-list"]): 49, - (46, G["expr-list"]): 47, - (51, G["atom"]): 43, + (51, G["arith"]): 38, (51, G["term"]): 53, (51, G["factor"]): 56, - (51, G["function-call"]): 35, - (51, G["arith"]): 38, (51, G["expr"]): 50, + (51, G["atom"]): 43, (51, G["not-empty-expr-list"]): 52, + (51, G["function-call"]): 35, (51, G["comp"]): 37, (54, G["atom"]): 43, - (54, G["factor"]): 55, (54, G["function-call"]): 35, - (61, G["atom"]): 43, + (54, G["factor"]): 55, + (61, G["arith"]): 38, (61, G["term"]): 53, (61, G["factor"]): 56, - (61, G["function-call"]): 35, - (61, G["arith"]): 38, (61, G["expr"]): 50, + (61, G["atom"]): 43, + (61, G["function-call"]): 35, (61, G["expr-list"]): 62, (61, G["comp"]): 37, (61, G["not-empty-expr-list"]): 49, @@ -1263,103 +1263,103 @@ def __goto_table(): (64, G["term"]): 65, (64, G["factor"]): 56, (64, G["function-call"]): 35, + (66, G["term"]): 53, + (66, G["atom"]): 43, (66, G["arith"]): 67, (66, G["function-call"]): 35, - (66, G["atom"]): 43, (66, G["factor"]): 56, - (66, G["term"]): 53, - (68, G["arith"]): 69, - (68, G["function-call"]): 35, + (68, G["term"]): 53, (68, G["atom"]): 43, + (68, G["function-call"]): 35, + (68, G["arith"]): 69, (68, G["factor"]): 56, - (68, G["term"]): 53, - (70, G["arith"]): 71, - (70, G["function-call"]): 35, + (70, G["term"]): 53, (70, G["atom"]): 43, + (70, G["function-call"]): 35, + (70, G["arith"]): 71, (70, G["factor"]): 56, - (70, G["term"]): 53, (78, G["case-list"]): 88, - (82, G["expr"]): 83, - (82, G["atom"]): 43, + (82, G["function-call"]): 35, (82, G["arith"]): 38, - (82, G["comp"]): 37, (82, G["term"]): 53, + (82, G["atom"]): 43, + (82, G["comp"]): 37, (82, G["factor"]): 56, - (82, G["function-call"]): 35, + (82, G["expr"]): 83, (84, G["case-list"]): 85, (86, G["case-list"]): 87, (91, G["declaration-list"]): 92, + (94, G["factor"]): 56, (94, G["arith"]): 38, (94, G["term"]): 53, - (94, G["expr"]): 95, - (94, G["factor"]): 56, (94, G["comp"]): 37, - (94, G["atom"]): 43, + (94, G["expr"]): 95, (94, G["function-call"]): 35, - (97, G["atom"]): 43, + (94, G["atom"]): 43, + (97, G["function-call"]): 35, (97, G["arith"]): 38, + (97, G["expr"]): 98, + (97, G["atom"]): 43, (97, G["factor"]): 56, - (97, G["function-call"]): 35, (97, G["term"]): 53, - (97, G["expr"]): 98, (97, G["comp"]): 37, - (101, G["arith"]): 38, (101, G["term"]): 53, + (101, G["arith"]): 38, (101, G["atom"]): 43, (101, G["expr"]): 102, (101, G["comp"]): 37, (101, G["function-call"]): 35, (101, G["factor"]): 56, + (103, G["term"]): 53, (103, G["arith"]): 38, (103, G["factor"]): 56, (103, G["atom"]): 43, - (103, G["term"]): 53, (103, G["comp"]): 37, - (103, G["expr"]): 104, (103, G["function-call"]): 35, - (111, G["atom"]): 43, + (103, G["expr"]): 104, + (111, G["function-call"]): 35, (111, G["arith"]): 38, - (111, G["comp"]): 37, - (111, G["term"]): 53, - (111, G["block"]): 112, (111, G["expr"]): 110, + (111, G["block"]): 112, + (111, G["term"]): 53, + (111, G["atom"]): 43, + (111, G["comp"]): 37, (111, G["factor"]): 56, - (111, G["function-call"]): 35, - (113, G["atom"]): 43, + (113, G["function-call"]): 35, (113, G["arith"]): 38, - (113, G["comp"]): 37, - (113, G["term"]): 53, (113, G["expr"]): 110, - (113, G["factor"]): 56, - (113, G["function-call"]): 35, + (113, G["term"]): 53, + (113, G["atom"]): 43, (113, G["block"]): 114, + (113, G["comp"]): 37, + (113, G["factor"]): 56, (120, G["param-list"]): 121, - (126, G["expr"]): 127, (126, G["atom"]): 43, - (126, G["comp"]): 37, + (126, G["function-call"]): 35, (126, G["arith"]): 38, (126, G["term"]): 53, (126, G["factor"]): 56, - (126, G["function-call"]): 35, - (131, G["atom"]): 43, + (126, G["comp"]): 37, + (126, G["expr"]): 127, + (131, G["function-call"]): 35, (131, G["arith"]): 38, - (131, G["comp"]): 37, (131, G["term"]): 53, + (131, G["atom"]): 43, + (131, G["comp"]): 37, (131, G["factor"]): 56, - (131, G["function-call"]): 35, (131, G["expr"]): 132, (136, G["attribute"]): 135, (136, G["method"]): 138, (136, G["feature-list"]): 137, (139, G["attribute"]): 135, - (139, G["feature-list"]): 140, (139, G["method"]): 138, + (139, G["feature-list"]): 140, + (141, G["feature-list"]): 142, (141, G["attribute"]): 135, (141, G["method"]): 138, - (141, G["feature-list"]): 142, - (143, G["feature-list"]): 144, (143, G["attribute"]): 135, (143, G["method"]): 138, + (143, G["feature-list"]): 144, (147, G["feature-list"]): 148, (147, G["attribute"]): 135, (147, G["method"]): 138, diff --git a/tester.py b/tester.py deleted file mode 100755 index cbe008bdb..000000000 --- a/tester.py +++ /dev/null @@ -1,72 +0,0 @@ -import time -from typing import List - -import fire - -from pyjapt.lexing import Token -from lexertab import CoolLexer -from parsertab import CoolParser -from semantics.formatter import Formatter - -lexer = CoolLexer() -parser = CoolParser() - -formatter = Formatter() - - -def pprint_tokens(text: str, tokens: List[Token]) -> str: - formatting = '' - - cursor = 0 - while cursor < len(tokens) - 1: - token = tokens[cursor] - - if text.startswith(token.lex): - formatting += token.token_type.name - text = text[len(token.lex):] - cursor += 1 - else: - formatting += text[0] - text = text[1:] - - return formatting - - -class Tester: - @staticmethod - def tokenize(script: str) -> str: - """ - Method for tokenize a cool program - :param script: string with the name of the program - """ - file = f'scripts/{script}' - program = open(file, 'r').read() - - return pprint_tokens(program, lexer(program)) - - @staticmethod - def parse(script: str) -> str: - """ - Method for parse a cool program and return an ast - :param script: string with the name of the program - """ - file = f'scripts/{script}' - program = open(file, 'r').read() - - tokens = [t for t in lexer(program)] - - ast = parser(tokens) - return str(ast) - - def timeit(self, command: str, *args): - if hasattr(self, command): - attr = getattr(self, command) - t = time.time() - out = attr(*args) - t = time.time() - t - print(out) - return f'Time : {t}' - - -if __name__ == '__main__': - fire.Fire(Tester()) From 16b942639989be662997d8ddd6d2615cb0b49a1b Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Sat, 4 Jul 2020 08:21:20 +0200 Subject: [PATCH 070/143] improved error API --- cool.py | 4 + grammar.py | 13 +- parsertab.py | 1339 ++++++++++++++++++++------------------- pyjapt/grammar.py | 9 +- pyjapt/parsing.py | 15 + pyjapt/serialization.py | 1 + 6 files changed, 702 insertions(+), 679 deletions(-) diff --git a/cool.py b/cool.py index 54460200d..edecac21d 100644 --- a/cool.py +++ b/cool.py @@ -154,6 +154,10 @@ class Main { tokens = lexer(syntactic_errors) ast = parser(tokens) + if parser.contains_errors: + for e in parser.errors: + sys.stderr.write(e + '\n') + if ast is not None: context = Context() errors = [] diff --git a/grammar.py b/grammar.py index 37b5a0ce3..f854e9cdc 100644 --- a/grammar.py +++ b/grammar.py @@ -211,42 +211,43 @@ def lexical_error(lexer): @G.production("feature-list -> attribute error feature-list") def feature_attribute_error(s): - s.error(f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") + s.error(2, f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") return [s[1]] + s[3] @G.production("feature-list -> method error feature-list") def feature_method_error(s): - s.error(f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") + s.error(2, f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") return [s[1]] + s[3] @G.production("case-list -> id : type => expr error") def case_list_error(s): - s.error(f"{s[6].line, s[6].column} - SyntacticError: Expected ';' instead of '{s[6].lex}'") + s.error(6, f"{s[6].line, s[6].column} - SyntacticError: Expected ';' instead of '{s[6].lex}'") return [(s[1], s[3], s[5])] @G.production("case-list -> id : type => expr error case-list") def case_list_error(s): - s.error(f"{s[6].line, s[6].column} - SyntacticError: Expected ';' instead of '{s[6].lex}'") + s.error(6, f"{s[6].line, s[6].column} - SyntacticError: Expected ';' instead of '{s[6].lex}'") return [(s[1], s[3], s[5])] + s[7] @G.production("block -> expr error") def block_single_error(s): - s.error(f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") + s.error(2, f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") return [s[1]] @G.production("block -> expr error block") def block_single_error(s): - s.error(f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") + s.error(2, f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") return [s[1]] + s[3] if __name__ == '__main__': t = time.time() + print() G.serialize_lexer('CoolLexer', inspect.getmodulename(__file__)) G.serialize_parser(LALR1Parser(G), 'CoolParser', inspect.getmodulename(__file__)) print('Serialization Time :', time.time() - t, 'seconds') diff --git a/parsertab.py b/parsertab.py index eaa765608..6595ab584 100644 --- a/parsertab.py +++ b/parsertab.py @@ -9,6 +9,7 @@ def __init__(self, verbose=False): self.verbose = verbose self.action = self.__action_table() self.goto = self.__goto_table() + self._errors = [] @staticmethod def __action_table(): @@ -26,159 +27,152 @@ def __action_table(): (6, G[":"]): ("SHIFT", 7), (7, G["type"]): ("SHIFT", 8), (8, G["{"]): ("SHIFT", 9), - (9, G["while"]): ("SHIFT", 13), - (9, G["isvoid"]): ("SHIFT", 24), + (9, G["case"]): ("SHIFT", 21), (9, G["true"]): ("SHIFT", 25), - (9, G["id"]): ("SHIFT", 31), - (9, G["~"]): ("SHIFT", 27), (9, G["new"]): ("SHIFT", 22), - (9, G["("]): ("SHIFT", 11), - (9, G["false"]): ("SHIFT", 26), - (9, G["int"]): ("SHIFT", 34), - (9, G["case"]): ("SHIFT", 21), + (9, G["string"]): ("SHIFT", 33), + (9, G["id"]): ("SHIFT", 31), (9, G["not"]): ("SHIFT", 30), + (9, G["let"]): ("SHIFT", 14), (9, G["{"]): ("SHIFT", 10), + (9, G["("]): ("SHIFT", 11), + (9, G["false"]): ("SHIFT", 26), (9, G["if"]): ("SHIFT", 12), - (9, G["let"]): ("SHIFT", 14), - (9, G["string"]): ("SHIFT", 33), - (10, G["new"]): ("SHIFT", 22), - (10, G["false"]): ("SHIFT", 26), - (10, G["("]): ("SHIFT", 11), - (10, G["isvoid"]): ("SHIFT", 24), + (9, G["while"]): ("SHIFT", 13), + (9, G["int"]): ("SHIFT", 34), + (9, G["isvoid"]): ("SHIFT", 24), + (9, G["~"]): ("SHIFT", 27), (10, G["id"]): ("SHIFT", 31), - (10, G["~"]): ("SHIFT", 27), (10, G["while"]): ("SHIFT", 13), + (10, G["string"]): ("SHIFT", 33), + (10, G["not"]): ("SHIFT", 30), + (10, G["new"]): ("SHIFT", 22), (10, G["let"]): ("SHIFT", 14), - (10, G["{"]): ("SHIFT", 10), + (10, G["true"]): ("SHIFT", 25), + (10, G["isvoid"]): ("SHIFT", 24), (10, G["if"]): ("SHIFT", 12), - (10, G["not"]): ("SHIFT", 30), - (10, G["case"]): ("SHIFT", 21), (10, G["int"]): ("SHIFT", 34), - (10, G["string"]): ("SHIFT", 33), - (10, G["true"]): ("SHIFT", 25), + (10, G["false"]): ("SHIFT", 26), + (10, G["("]): ("SHIFT", 11), + (10, G["{"]): ("SHIFT", 10), + (10, G["case"]): ("SHIFT", 21), + (10, G["~"]): ("SHIFT", 27), + (11, G["int"]): ("SHIFT", 34), + (11, G["case"]): ("SHIFT", 21), + (11, G["("]): ("SHIFT", 11), + (11, G["{"]): ("SHIFT", 10), + (11, G["false"]): ("SHIFT", 26), + (11, G["~"]): ("SHIFT", 27), (11, G["id"]): ("SHIFT", 31), - (11, G["string"]): ("SHIFT", 33), + (11, G["if"]): ("SHIFT", 12), (11, G["isvoid"]): ("SHIFT", 24), - (11, G["case"]): ("SHIFT", 21), + (11, G["true"]): ("SHIFT", 25), + (11, G["string"]): ("SHIFT", 33), (11, G["not"]): ("SHIFT", 30), - (11, G["if"]): ("SHIFT", 12), - (11, G["{"]): ("SHIFT", 10), - (11, G["int"]): ("SHIFT", 34), (11, G["let"]): ("SHIFT", 14), - (11, G["while"]): ("SHIFT", 13), - (11, G["~"]): ("SHIFT", 27), - (11, G["false"]): ("SHIFT", 26), - (11, G["("]): ("SHIFT", 11), (11, G["new"]): ("SHIFT", 22), - (11, G["true"]): ("SHIFT", 25), + (11, G["while"]): ("SHIFT", 13), (12, G["id"]): ("SHIFT", 31), - (12, G["true"]): ("SHIFT", 25), - (12, G["{"]): ("SHIFT", 10), + (12, G["string"]): ("SHIFT", 33), (12, G["if"]): ("SHIFT", 12), (12, G["not"]): ("SHIFT", 30), + (12, G["let"]): ("SHIFT", 14), (12, G["new"]): ("SHIFT", 22), + (12, G["true"]): ("SHIFT", 25), (12, G["case"]): ("SHIFT", 21), - (12, G["false"]): ("SHIFT", 26), - (12, G["isvoid"]): ("SHIFT", 24), - (12, G["("]): ("SHIFT", 11), (12, G["~"]): ("SHIFT", 27), - (12, G["int"]): ("SHIFT", 34), (12, G["while"]): ("SHIFT", 13), - (12, G["string"]): ("SHIFT", 33), - (12, G["let"]): ("SHIFT", 14), - (13, G["while"]): ("SHIFT", 13), - (13, G["id"]): ("SHIFT", 31), - (13, G["true"]): ("SHIFT", 25), + (12, G["isvoid"]): ("SHIFT", 24), + (12, G["int"]): ("SHIFT", 34), + (12, G["false"]): ("SHIFT", 26), + (12, G["("]): ("SHIFT", 11), + (12, G["{"]): ("SHIFT", 10), (13, G["~"]): ("SHIFT", 27), + (13, G["new"]): ("SHIFT", 22), + (13, G["false"]): ("SHIFT", 26), + (13, G["id"]): ("SHIFT", 31), + (13, G["isvoid"]): ("SHIFT", 24), (13, G["int"]): ("SHIFT", 34), - (13, G["string"]): ("SHIFT", 33), (13, G["case"]): ("SHIFT", 21), - (13, G["isvoid"]): ("SHIFT", 24), - (13, G["false"]): ("SHIFT", 26), - (13, G["("]): ("SHIFT", 11), - (13, G["new"]): ("SHIFT", 22), (13, G["let"]): ("SHIFT", 14), - (13, G["if"]): ("SHIFT", 12), - (13, G["{"]): ("SHIFT", 10), + (13, G["true"]): ("SHIFT", 25), (13, G["not"]): ("SHIFT", 30), + (13, G["{"]): ("SHIFT", 10), + (13, G["string"]): ("SHIFT", 33), + (13, G["if"]): ("SHIFT", 12), + (13, G["while"]): ("SHIFT", 13), + (13, G["("]): ("SHIFT", 11), (14, G["id"]): ("SHIFT", 15), (15, G[":"]): ("SHIFT", 16), (16, G["type"]): ("SHIFT", 17), + (17, G["<-"]): ("SHIFT", 20), (17, G[","]): ("SHIFT", 18), (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), - (17, G["<-"]): ("SHIFT", 20), (18, G["id"]): ("SHIFT", 15), (19, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), - (20, G["isvoid"]): ("SHIFT", 24), - (20, G["case"]): ("SHIFT", 21), (20, G["id"]): ("SHIFT", 31), + (20, G["while"]): ("SHIFT", 13), + (20, G["if"]): ("SHIFT", 12), (20, G["not"]): ("SHIFT", 30), (20, G["new"]): ("SHIFT", 22), (20, G["let"]): ("SHIFT", 14), - (20, G["("]): ("SHIFT", 11), (20, G["false"]): ("SHIFT", 26), + (20, G["("]): ("SHIFT", 11), (20, G["{"]): ("SHIFT", 10), - (20, G["if"]): ("SHIFT", 12), + (20, G["case"]): ("SHIFT", 21), + (20, G["isvoid"]): ("SHIFT", 24), + (20, G["int"]): ("SHIFT", 34), (20, G["string"]): ("SHIFT", 33), (20, G["~"]): ("SHIFT", 27), - (20, G["int"]): ("SHIFT", 34), - (20, G["while"]): ("SHIFT", 13), (20, G["true"]): ("SHIFT", 25), - (21, G["{"]): ("SHIFT", 10), - (21, G["isvoid"]): ("SHIFT", 24), + (21, G["let"]): ("SHIFT", 14), + (21, G["not"]): ("SHIFT", 30), + (21, G["~"]): ("SHIFT", 27), (21, G["if"]): ("SHIFT", 12), - (21, G["id"]): ("SHIFT", 31), + (21, G["while"]): ("SHIFT", 13), + (21, G["true"]): ("SHIFT", 25), (21, G["new"]): ("SHIFT", 22), + (21, G["string"]): ("SHIFT", 33), + (21, G["id"]): ("SHIFT", 31), + (21, G["isvoid"]): ("SHIFT", 24), (21, G["("]): ("SHIFT", 11), (21, G["false"]): ("SHIFT", 26), - (21, G["while"]): ("SHIFT", 13), - (21, G["string"]): ("SHIFT", 33), - (21, G["true"]): ("SHIFT", 25), (21, G["case"]): ("SHIFT", 21), - (21, G["not"]): ("SHIFT", 30), - (21, G["let"]): ("SHIFT", 14), (21, G["int"]): ("SHIFT", 34), - (21, G["~"]): ("SHIFT", 27), + (21, G["{"]): ("SHIFT", 10), (22, G["type"]): ("SHIFT", 23), - (23, G["<="]): ("REDUCE", G["atom -> new type"]), - (23, G["error"]): ("REDUCE", G["atom -> new type"]), - (23, G["="]): ("REDUCE", G["atom -> new type"]), - (23, G["pool"]): ("REDUCE", G["atom -> new type"]), - (23, G[")"]): ("REDUCE", G["atom -> new type"]), - (23, G["."]): ("REDUCE", G["atom -> new type"]), - (23, G["in"]): ("REDUCE", G["atom -> new type"]), (23, G[","]): ("REDUCE", G["atom -> new type"]), + (23, G["in"]): ("REDUCE", G["atom -> new type"]), (23, G["then"]): ("REDUCE", G["atom -> new type"]), (23, G[";"]): ("REDUCE", G["atom -> new type"]), - (23, G["<"]): ("REDUCE", G["atom -> new type"]), - (23, G["@"]): ("REDUCE", G["atom -> new type"]), (23, G["+"]): ("REDUCE", G["atom -> new type"]), + (23, G["@"]): ("REDUCE", G["atom -> new type"]), (23, G["else"]): ("REDUCE", G["atom -> new type"]), (23, G["of"]): ("REDUCE", G["atom -> new type"]), (23, G["-"]): ("REDUCE", G["atom -> new type"]), (23, G["fi"]): ("REDUCE", G["atom -> new type"]), (23, G["*"]): ("REDUCE", G["atom -> new type"]), - (23, G["}"]): ("REDUCE", G["atom -> new type"]), (23, G["/"]): ("REDUCE", G["atom -> new type"]), + (23, G["}"]): ("REDUCE", G["atom -> new type"]), + (23, G["<"]): ("REDUCE", G["atom -> new type"]), (23, G["loop"]): ("REDUCE", G["atom -> new type"]), - (24, G["("]): ("SHIFT", 11), + (23, G["<="]): ("REDUCE", G["atom -> new type"]), + (23, G["="]): ("REDUCE", G["atom -> new type"]), + (23, G["pool"]): ("REDUCE", G["atom -> new type"]), + (23, G[")"]): ("REDUCE", G["atom -> new type"]), + (23, G["error"]): ("REDUCE", G["atom -> new type"]), + (23, G["."]): ("REDUCE", G["atom -> new type"]), (24, G["isvoid"]): ("SHIFT", 24), - (24, G["true"]): ("SHIFT", 25), - (24, G["id"]): ("SHIFT", 28), + (24, G["("]): ("SHIFT", 11), (24, G["int"]): ("SHIFT", 34), - (24, G["~"]): ("SHIFT", 27), + (24, G["id"]): ("SHIFT", 28), (24, G["string"]): ("SHIFT", 33), - (24, G["new"]): ("SHIFT", 22), + (24, G["~"]): ("SHIFT", 27), (24, G["false"]): ("SHIFT", 26), - (25, G["<="]): ("REDUCE", G["atom -> true"]), - (25, G["error"]): ("REDUCE", G["atom -> true"]), - (25, G["="]): ("REDUCE", G["atom -> true"]), - (25, G["pool"]): ("REDUCE", G["atom -> true"]), - (25, G[")"]): ("REDUCE", G["atom -> true"]), - (25, G["."]): ("REDUCE", G["atom -> true"]), - (25, G["loop"]): ("REDUCE", G["atom -> true"]), - (25, G["in"]): ("REDUCE", G["atom -> true"]), + (24, G["new"]): ("SHIFT", 22), + (24, G["true"]): ("SHIFT", 25), (25, G[","]): ("REDUCE", G["atom -> true"]), + (25, G["in"]): ("REDUCE", G["atom -> true"]), (25, G["then"]): ("REDUCE", G["atom -> true"]), (25, G[";"]): ("REDUCE", G["atom -> true"]), (25, G["+"]): ("REDUCE", G["atom -> true"]), @@ -188,139 +182,139 @@ def __action_table(): (25, G["-"]): ("REDUCE", G["atom -> true"]), (25, G["fi"]): ("REDUCE", G["atom -> true"]), (25, G["*"]): ("REDUCE", G["atom -> true"]), - (25, G["}"]): ("REDUCE", G["atom -> true"]), (25, G["/"]): ("REDUCE", G["atom -> true"]), + (25, G["}"]): ("REDUCE", G["atom -> true"]), (25, G["<"]): ("REDUCE", G["atom -> true"]), - (26, G["<="]): ("REDUCE", G["atom -> false"]), - (26, G["error"]): ("REDUCE", G["atom -> false"]), - (26, G["="]): ("REDUCE", G["atom -> false"]), - (26, G["pool"]): ("REDUCE", G["atom -> false"]), - (26, G[")"]): ("REDUCE", G["atom -> false"]), - (26, G["."]): ("REDUCE", G["atom -> false"]), - (26, G["loop"]): ("REDUCE", G["atom -> false"]), - (26, G["in"]): ("REDUCE", G["atom -> false"]), + (25, G["loop"]): ("REDUCE", G["atom -> true"]), + (25, G["<="]): ("REDUCE", G["atom -> true"]), + (25, G["="]): ("REDUCE", G["atom -> true"]), + (25, G["pool"]): ("REDUCE", G["atom -> true"]), + (25, G[")"]): ("REDUCE", G["atom -> true"]), + (25, G["error"]): ("REDUCE", G["atom -> true"]), + (25, G["."]): ("REDUCE", G["atom -> true"]), (26, G[","]): ("REDUCE", G["atom -> false"]), + (26, G["in"]): ("REDUCE", G["atom -> false"]), (26, G["then"]): ("REDUCE", G["atom -> false"]), (26, G[";"]): ("REDUCE", G["atom -> false"]), - (26, G["@"]): ("REDUCE", G["atom -> false"]), (26, G["+"]): ("REDUCE", G["atom -> false"]), + (26, G["@"]): ("REDUCE", G["atom -> false"]), (26, G["else"]): ("REDUCE", G["atom -> false"]), (26, G["of"]): ("REDUCE", G["atom -> false"]), (26, G["-"]): ("REDUCE", G["atom -> false"]), (26, G["fi"]): ("REDUCE", G["atom -> false"]), (26, G["*"]): ("REDUCE", G["atom -> false"]), - (26, G["}"]): ("REDUCE", G["atom -> false"]), (26, G["/"]): ("REDUCE", G["atom -> false"]), + (26, G["}"]): ("REDUCE", G["atom -> false"]), (26, G["<"]): ("REDUCE", G["atom -> false"]), - (27, G["("]): ("SHIFT", 11), + (26, G["loop"]): ("REDUCE", G["atom -> false"]), + (26, G["<="]): ("REDUCE", G["atom -> false"]), + (26, G["="]): ("REDUCE", G["atom -> false"]), + (26, G["pool"]): ("REDUCE", G["atom -> false"]), + (26, G[")"]): ("REDUCE", G["atom -> false"]), + (26, G["error"]): ("REDUCE", G["atom -> false"]), + (26, G["."]): ("REDUCE", G["atom -> false"]), (27, G["isvoid"]): ("SHIFT", 24), - (27, G["true"]): ("SHIFT", 25), - (27, G["id"]): ("SHIFT", 28), + (27, G["("]): ("SHIFT", 11), (27, G["int"]): ("SHIFT", 34), - (27, G["~"]): ("SHIFT", 27), + (27, G["id"]): ("SHIFT", 28), (27, G["string"]): ("SHIFT", 33), - (27, G["new"]): ("SHIFT", 22), + (27, G["~"]): ("SHIFT", 27), (27, G["false"]): ("SHIFT", 26), - (28, G["<="]): ("REDUCE", G["atom -> id"]), - (28, G["error"]): ("REDUCE", G["atom -> id"]), - (28, G["="]): ("REDUCE", G["atom -> id"]), - (28, G["pool"]): ("REDUCE", G["atom -> id"]), - (28, G[")"]): ("REDUCE", G["atom -> id"]), - (28, G["."]): ("REDUCE", G["atom -> id"]), - (28, G["in"]): ("REDUCE", G["atom -> id"]), + (27, G["new"]): ("SHIFT", 22), + (27, G["true"]): ("SHIFT", 25), (28, G[","]): ("REDUCE", G["atom -> id"]), + (28, G["in"]): ("REDUCE", G["atom -> id"]), (28, G["then"]): ("REDUCE", G["atom -> id"]), (28, G[";"]): ("REDUCE", G["atom -> id"]), - (28, G["<"]): ("REDUCE", G["atom -> id"]), - (28, G["@"]): ("REDUCE", G["atom -> id"]), (28, G["+"]): ("REDUCE", G["atom -> id"]), + (28, G["@"]): ("REDUCE", G["atom -> id"]), (28, G["else"]): ("REDUCE", G["atom -> id"]), (28, G["of"]): ("REDUCE", G["atom -> id"]), (28, G["-"]): ("REDUCE", G["atom -> id"]), (28, G["fi"]): ("REDUCE", G["atom -> id"]), (28, G["*"]): ("REDUCE", G["atom -> id"]), - (28, G["}"]): ("REDUCE", G["atom -> id"]), (28, G["/"]): ("REDUCE", G["atom -> id"]), + (28, G["}"]): ("REDUCE", G["atom -> id"]), + (28, G["<"]): ("REDUCE", G["atom -> id"]), (28, G["loop"]): ("REDUCE", G["atom -> id"]), + (28, G["<="]): ("REDUCE", G["atom -> id"]), + (28, G["="]): ("REDUCE", G["atom -> id"]), + (28, G["pool"]): ("REDUCE", G["atom -> id"]), + (28, G[")"]): ("REDUCE", G["atom -> id"]), + (28, G["error"]): ("REDUCE", G["atom -> id"]), + (28, G["."]): ("REDUCE", G["atom -> id"]), (28, G["("]): ("SHIFT", 29), - (29, G["while"]): ("SHIFT", 13), - (29, G["~"]): ("SHIFT", 27), - (29, G["let"]): ("SHIFT", 14), - (29, G["id"]): ("SHIFT", 31), (29, G["false"]): ("SHIFT", 26), - (29, G["("]): ("SHIFT", 11), - (29, G[")"]): ("REDUCE", G["expr-list -> e"]), - (29, G["isvoid"]): ("SHIFT", 24), + (29, G["~"]): ("SHIFT", 27), (29, G["new"]): ("SHIFT", 22), - (29, G["true"]): ("SHIFT", 25), + (29, G["isvoid"]): ("SHIFT", 24), + (29, G["id"]): ("SHIFT", 31), (29, G["case"]): ("SHIFT", 21), - (29, G["not"]): ("SHIFT", 30), - (29, G["string"]): ("SHIFT", 33), + (29, G["true"]): ("SHIFT", 25), (29, G["{"]): ("SHIFT", 10), - (29, G["int"]): ("SHIFT", 34), + (29, G["string"]): ("SHIFT", 33), + (29, G["not"]): ("SHIFT", 30), + (29, G["let"]): ("SHIFT", 14), (29, G["if"]): ("SHIFT", 12), - (30, G["int"]): ("SHIFT", 34), + (29, G["int"]): ("SHIFT", 34), + (29, G["while"]): ("SHIFT", 13), + (29, G[")"]): ("REDUCE", G["expr-list -> e"]), + (29, G["("]): ("SHIFT", 11), (30, G["string"]): ("SHIFT", 33), - (30, G["true"]): ("SHIFT", 25), - (30, G["id"]): ("SHIFT", 31), - (30, G["~"]): ("SHIFT", 27), - (30, G["new"]): ("SHIFT", 22), - (30, G["not"]): ("SHIFT", 30), - (30, G["("]): ("SHIFT", 11), - (30, G["false"]): ("SHIFT", 26), - (30, G["while"]): ("SHIFT", 13), - (30, G["let"]): ("SHIFT", 14), - (30, G["{"]): ("SHIFT", 10), (30, G["isvoid"]): ("SHIFT", 24), - (30, G["if"]): ("SHIFT", 12), (30, G["case"]): ("SHIFT", 21), - (31, G["<-"]): ("SHIFT", 32), - (31, G["<="]): ("REDUCE", G["atom -> id"]), - (31, G["error"]): ("REDUCE", G["atom -> id"]), - (31, G["="]): ("REDUCE", G["atom -> id"]), - (31, G["pool"]): ("REDUCE", G["atom -> id"]), - (31, G[")"]): ("REDUCE", G["atom -> id"]), - (31, G["."]): ("REDUCE", G["atom -> id"]), - (31, G["loop"]): ("REDUCE", G["atom -> id"]), - (31, G["in"]): ("REDUCE", G["atom -> id"]), + (30, G["int"]): ("SHIFT", 34), + (30, G["{"]): ("SHIFT", 10), + (30, G["let"]): ("SHIFT", 14), + (30, G["("]): ("SHIFT", 11), + (30, G["not"]): ("SHIFT", 30), + (30, G["if"]): ("SHIFT", 12), + (30, G["~"]): ("SHIFT", 27), + (30, G["while"]): ("SHIFT", 13), + (30, G["false"]): ("SHIFT", 26), + (30, G["new"]): ("SHIFT", 22), + (30, G["id"]): ("SHIFT", 31), + (30, G["true"]): ("SHIFT", 25), (31, G[","]): ("REDUCE", G["atom -> id"]), + (31, G["in"]): ("REDUCE", G["atom -> id"]), (31, G["then"]): ("REDUCE", G["atom -> id"]), (31, G[";"]): ("REDUCE", G["atom -> id"]), - (31, G["+"]): ("REDUCE", G["atom -> id"]), (31, G["@"]): ("REDUCE", G["atom -> id"]), + (31, G["+"]): ("REDUCE", G["atom -> id"]), (31, G["else"]): ("REDUCE", G["atom -> id"]), (31, G["of"]): ("REDUCE", G["atom -> id"]), (31, G["-"]): ("REDUCE", G["atom -> id"]), (31, G["fi"]): ("REDUCE", G["atom -> id"]), (31, G["*"]): ("REDUCE", G["atom -> id"]), - (31, G["}"]): ("REDUCE", G["atom -> id"]), (31, G["/"]): ("REDUCE", G["atom -> id"]), + (31, G["}"]): ("REDUCE", G["atom -> id"]), (31, G["<"]): ("REDUCE", G["atom -> id"]), + (31, G["loop"]): ("REDUCE", G["atom -> id"]), + (31, G["<="]): ("REDUCE", G["atom -> id"]), + (31, G["="]): ("REDUCE", G["atom -> id"]), + (31, G["pool"]): ("REDUCE", G["atom -> id"]), + (31, G[")"]): ("REDUCE", G["atom -> id"]), + (31, G["error"]): ("REDUCE", G["atom -> id"]), + (31, G["."]): ("REDUCE", G["atom -> id"]), + (31, G["<-"]): ("SHIFT", 32), (31, G["("]): ("SHIFT", 29), - (32, G["int"]): ("SHIFT", 34), (32, G["string"]): ("SHIFT", 33), - (32, G["true"]): ("SHIFT", 25), - (32, G["id"]): ("SHIFT", 31), - (32, G["~"]): ("SHIFT", 27), - (32, G["new"]): ("SHIFT", 22), - (32, G["not"]): ("SHIFT", 30), - (32, G["("]): ("SHIFT", 11), - (32, G["false"]): ("SHIFT", 26), - (32, G["while"]): ("SHIFT", 13), - (32, G["let"]): ("SHIFT", 14), - (32, G["{"]): ("SHIFT", 10), (32, G["isvoid"]): ("SHIFT", 24), - (32, G["if"]): ("SHIFT", 12), (32, G["case"]): ("SHIFT", 21), - (33, G["<="]): ("REDUCE", G["atom -> string"]), - (33, G["error"]): ("REDUCE", G["atom -> string"]), - (33, G["="]): ("REDUCE", G["atom -> string"]), - (33, G["pool"]): ("REDUCE", G["atom -> string"]), - (33, G[")"]): ("REDUCE", G["atom -> string"]), - (33, G["."]): ("REDUCE", G["atom -> string"]), - (33, G["loop"]): ("REDUCE", G["atom -> string"]), - (33, G["in"]): ("REDUCE", G["atom -> string"]), + (32, G["int"]): ("SHIFT", 34), + (32, G["{"]): ("SHIFT", 10), + (32, G["let"]): ("SHIFT", 14), + (32, G["("]): ("SHIFT", 11), + (32, G["not"]): ("SHIFT", 30), + (32, G["if"]): ("SHIFT", 12), + (32, G["~"]): ("SHIFT", 27), + (32, G["while"]): ("SHIFT", 13), + (32, G["false"]): ("SHIFT", 26), + (32, G["new"]): ("SHIFT", 22), + (32, G["id"]): ("SHIFT", 31), + (32, G["true"]): ("SHIFT", 25), (33, G[","]): ("REDUCE", G["atom -> string"]), + (33, G["in"]): ("REDUCE", G["atom -> string"]), (33, G["then"]): ("REDUCE", G["atom -> string"]), (33, G[";"]): ("REDUCE", G["atom -> string"]), (33, G["@"]): ("REDUCE", G["atom -> string"]), @@ -330,39 +324,39 @@ def __action_table(): (33, G["-"]): ("REDUCE", G["atom -> string"]), (33, G["fi"]): ("REDUCE", G["atom -> string"]), (33, G["*"]): ("REDUCE", G["atom -> string"]), - (33, G["}"]): ("REDUCE", G["atom -> string"]), (33, G["/"]): ("REDUCE", G["atom -> string"]), + (33, G["}"]): ("REDUCE", G["atom -> string"]), (33, G["<"]): ("REDUCE", G["atom -> string"]), - (34, G["<="]): ("REDUCE", G["atom -> int"]), - (34, G["error"]): ("REDUCE", G["atom -> int"]), - (34, G["="]): ("REDUCE", G["atom -> int"]), - (34, G["pool"]): ("REDUCE", G["atom -> int"]), - (34, G[")"]): ("REDUCE", G["atom -> int"]), - (34, G["."]): ("REDUCE", G["atom -> int"]), - (34, G["loop"]): ("REDUCE", G["atom -> int"]), - (34, G["in"]): ("REDUCE", G["atom -> int"]), + (33, G["loop"]): ("REDUCE", G["atom -> string"]), + (33, G["<="]): ("REDUCE", G["atom -> string"]), + (33, G["="]): ("REDUCE", G["atom -> string"]), + (33, G["pool"]): ("REDUCE", G["atom -> string"]), + (33, G[")"]): ("REDUCE", G["atom -> string"]), + (33, G["error"]): ("REDUCE", G["atom -> string"]), + (33, G["."]): ("REDUCE", G["atom -> string"]), (34, G[","]): ("REDUCE", G["atom -> int"]), + (34, G["in"]): ("REDUCE", G["atom -> int"]), (34, G["then"]): ("REDUCE", G["atom -> int"]), (34, G[";"]): ("REDUCE", G["atom -> int"]), - (34, G["@"]): ("REDUCE", G["atom -> int"]), (34, G["+"]): ("REDUCE", G["atom -> int"]), + (34, G["@"]): ("REDUCE", G["atom -> int"]), (34, G["else"]): ("REDUCE", G["atom -> int"]), (34, G["of"]): ("REDUCE", G["atom -> int"]), (34, G["-"]): ("REDUCE", G["atom -> int"]), (34, G["fi"]): ("REDUCE", G["atom -> int"]), (34, G["*"]): ("REDUCE", G["atom -> int"]), - (34, G["}"]): ("REDUCE", G["atom -> int"]), (34, G["/"]): ("REDUCE", G["atom -> int"]), + (34, G["}"]): ("REDUCE", G["atom -> int"]), (34, G["<"]): ("REDUCE", G["atom -> int"]), - (35, G["<="]): ("REDUCE", G["atom -> function-call"]), - (35, G["error"]): ("REDUCE", G["atom -> function-call"]), - (35, G["="]): ("REDUCE", G["atom -> function-call"]), - (35, G["pool"]): ("REDUCE", G["atom -> function-call"]), - (35, G[")"]): ("REDUCE", G["atom -> function-call"]), - (35, G["."]): ("REDUCE", G["atom -> function-call"]), - (35, G["loop"]): ("REDUCE", G["atom -> function-call"]), - (35, G["in"]): ("REDUCE", G["atom -> function-call"]), + (34, G["loop"]): ("REDUCE", G["atom -> int"]), + (34, G["<="]): ("REDUCE", G["atom -> int"]), + (34, G["="]): ("REDUCE", G["atom -> int"]), + (34, G["pool"]): ("REDUCE", G["atom -> int"]), + (34, G[")"]): ("REDUCE", G["atom -> int"]), + (34, G["error"]): ("REDUCE", G["atom -> int"]), + (34, G["."]): ("REDUCE", G["atom -> int"]), (35, G[","]): ("REDUCE", G["atom -> function-call"]), + (35, G["in"]): ("REDUCE", G["atom -> function-call"]), (35, G["then"]): ("REDUCE", G["atom -> function-call"]), (35, G[";"]): ("REDUCE", G["atom -> function-call"]), (35, G["+"]): ("REDUCE", G["atom -> function-call"]), @@ -372,95 +366,96 @@ def __action_table(): (35, G["-"]): ("REDUCE", G["atom -> function-call"]), (35, G["fi"]): ("REDUCE", G["atom -> function-call"]), (35, G["*"]): ("REDUCE", G["atom -> function-call"]), - (35, G["}"]): ("REDUCE", G["atom -> function-call"]), (35, G["/"]): ("REDUCE", G["atom -> function-call"]), + (35, G["}"]): ("REDUCE", G["atom -> function-call"]), (35, G["<"]): ("REDUCE", G["atom -> function-call"]), - (36, G["else"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), + (35, G["loop"]): ("REDUCE", G["atom -> function-call"]), + (35, G["<="]): ("REDUCE", G["atom -> function-call"]), + (35, G["="]): ("REDUCE", G["atom -> function-call"]), + (35, G["pool"]): ("REDUCE", G["atom -> function-call"]), + (35, G[")"]): ("REDUCE", G["atom -> function-call"]), + (35, G["error"]): ("REDUCE", G["atom -> function-call"]), + (35, G["."]): ("REDUCE", G["atom -> function-call"]), (36, G["}"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), (36, G["in"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), - (37, G["else"]): ("REDUCE", G["expr -> comp"]), - (37, G[")"]): ("REDUCE", G["expr -> comp"]), - (37, G["pool"]): ("REDUCE", G["expr -> comp"]), - (37, G["of"]): ("REDUCE", G["expr -> comp"]), - (37, G["fi"]): ("REDUCE", G["expr -> comp"]), - (37, G["then"]): ("REDUCE", G["expr -> comp"]), - (37, G["loop"]): ("REDUCE", G["expr -> comp"]), + (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["else"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), (37, G["}"]): ("REDUCE", G["expr -> comp"]), - (37, G[","]): ("REDUCE", G["expr -> comp"]), (37, G["in"]): ("REDUCE", G["expr -> comp"]), + (37, G[","]): ("REDUCE", G["expr -> comp"]), (37, G["error"]): ("REDUCE", G["expr -> comp"]), + (37, G["then"]): ("REDUCE", G["expr -> comp"]), + (37, G["loop"]): ("REDUCE", G["expr -> comp"]), (37, G[";"]): ("REDUCE", G["expr -> comp"]), - (38, G["else"]): ("REDUCE", G["comp -> arith"]), - (38, G[")"]): ("REDUCE", G["comp -> arith"]), - (38, G["pool"]): ("REDUCE", G["comp -> arith"]), - (38, G["of"]): ("REDUCE", G["comp -> arith"]), - (38, G["fi"]): ("REDUCE", G["comp -> arith"]), - (38, G["then"]): ("REDUCE", G["comp -> arith"]), - (38, G["loop"]): ("REDUCE", G["comp -> arith"]), + (37, G[")"]): ("REDUCE", G["expr -> comp"]), + (37, G["of"]): ("REDUCE", G["expr -> comp"]), + (37, G["pool"]): ("REDUCE", G["expr -> comp"]), + (37, G["else"]): ("REDUCE", G["expr -> comp"]), + (37, G["fi"]): ("REDUCE", G["expr -> comp"]), + (38, G["<"]): ("SHIFT", 66), + (38, G["="]): ("SHIFT", 70), + (38, G["+"]): ("SHIFT", 39), + (38, G["<="]): ("SHIFT", 68), (38, G["}"]): ("REDUCE", G["comp -> arith"]), - (38, G[","]): ("REDUCE", G["comp -> arith"]), (38, G["in"]): ("REDUCE", G["comp -> arith"]), + (38, G[","]): ("REDUCE", G["comp -> arith"]), (38, G["error"]): ("REDUCE", G["comp -> arith"]), + (38, G["then"]): ("REDUCE", G["comp -> arith"]), + (38, G["loop"]): ("REDUCE", G["comp -> arith"]), (38, G[";"]): ("REDUCE", G["comp -> arith"]), - (38, G["+"]): ("SHIFT", 39), - (38, G["<"]): ("SHIFT", 66), - (38, G["="]): ("SHIFT", 70), + (38, G[")"]): ("REDUCE", G["comp -> arith"]), + (38, G["of"]): ("REDUCE", G["comp -> arith"]), + (38, G["pool"]): ("REDUCE", G["comp -> arith"]), + (38, G["else"]): ("REDUCE", G["comp -> arith"]), + (38, G["fi"]): ("REDUCE", G["comp -> arith"]), (38, G["-"]): ("SHIFT", 64), - (38, G["<="]): ("SHIFT", 68), - (39, G["int"]): ("SHIFT", 34), - (39, G["id"]): ("SHIFT", 28), - (39, G["string"]): ("SHIFT", 33), (39, G["("]): ("SHIFT", 11), - (39, G["isvoid"]): ("SHIFT", 24), - (39, G["true"]): ("SHIFT", 25), + (39, G["string"]): ("SHIFT", 33), (39, G["~"]): ("SHIFT", 27), - (39, G["new"]): ("SHIFT", 22), (39, G["false"]): ("SHIFT", 26), - (40, G["*"]): ("SHIFT", 41), + (39, G["new"]): ("SHIFT", 22), + (39, G["isvoid"]): ("SHIFT", 24), + (39, G["id"]): ("SHIFT", 28), + (39, G["int"]): ("SHIFT", 34), + (39, G["true"]): ("SHIFT", 25), (40, G["/"]): ("SHIFT", 54), - (40, G["<="]): ("REDUCE", G["arith -> arith + term"]), - (40, G["="]): ("REDUCE", G["arith -> arith + term"]), - (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), - (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), (40, G[","]): ("REDUCE", G["arith -> arith + term"]), (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), (40, G["then"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["<"]): ("REDUCE", G["arith -> arith + term"]), (40, G[";"]): ("REDUCE", G["arith -> arith + term"]), (40, G["+"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["else"]): ("REDUCE", G["arith -> arith + term"]), (40, G["of"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["else"]): ("REDUCE", G["arith -> arith + term"]), (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), (40, G["fi"]): ("REDUCE", G["arith -> arith + term"]), (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["<"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["<="]): ("REDUCE", G["arith -> arith + term"]), + (40, G["="]): ("REDUCE", G["arith -> arith + term"]), + (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), - (41, G["("]): ("SHIFT", 11), + (40, G["*"]): ("SHIFT", 41), (41, G["isvoid"]): ("SHIFT", 24), - (41, G["true"]): ("SHIFT", 25), - (41, G["id"]): ("SHIFT", 28), + (41, G["("]): ("SHIFT", 11), (41, G["int"]): ("SHIFT", 34), - (41, G["~"]): ("SHIFT", 27), (41, G["string"]): ("SHIFT", 33), - (41, G["new"]): ("SHIFT", 22), + (41, G["id"]): ("SHIFT", 28), + (41, G["~"]): ("SHIFT", 27), (41, G["false"]): ("SHIFT", 26), - (42, G["<="]): ("REDUCE", G["term -> term * factor"]), - (42, G["error"]): ("REDUCE", G["term -> term * factor"]), - (42, G["="]): ("REDUCE", G["term -> term * factor"]), - (42, G["pool"]): ("REDUCE", G["term -> term * factor"]), - (42, G[")"]): ("REDUCE", G["term -> term * factor"]), - (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), - (42, G["in"]): ("REDUCE", G["term -> term * factor"]), + (41, G["new"]): ("SHIFT", 22), + (41, G["true"]): ("SHIFT", 25), (42, G[","]): ("REDUCE", G["term -> term * factor"]), + (42, G["in"]): ("REDUCE", G["term -> term * factor"]), (42, G["then"]): ("REDUCE", G["term -> term * factor"]), (42, G[";"]): ("REDUCE", G["term -> term * factor"]), (42, G["+"]): ("REDUCE", G["term -> term * factor"]), @@ -469,17 +464,18 @@ def __action_table(): (42, G["-"]): ("REDUCE", G["term -> term * factor"]), (42, G["fi"]): ("REDUCE", G["term -> term * factor"]), (42, G["*"]): ("REDUCE", G["term -> term * factor"]), - (42, G["}"]): ("REDUCE", G["term -> term * factor"]), (42, G["/"]): ("REDUCE", G["term -> term * factor"]), + (42, G["}"]): ("REDUCE", G["term -> term * factor"]), (42, G["<"]): ("REDUCE", G["term -> term * factor"]), - (43, G["<="]): ("REDUCE", G["factor -> atom"]), - (43, G["error"]): ("REDUCE", G["factor -> atom"]), - (43, G["="]): ("REDUCE", G["factor -> atom"]), - (43, G["pool"]): ("REDUCE", G["factor -> atom"]), - (43, G[")"]): ("REDUCE", G["factor -> atom"]), - (43, G["loop"]): ("REDUCE", G["factor -> atom"]), - (43, G["in"]): ("REDUCE", G["factor -> atom"]), + (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), + (42, G["<="]): ("REDUCE", G["term -> term * factor"]), + (42, G["="]): ("REDUCE", G["term -> term * factor"]), + (42, G["pool"]): ("REDUCE", G["term -> term * factor"]), + (42, G[")"]): ("REDUCE", G["term -> term * factor"]), + (42, G["error"]): ("REDUCE", G["term -> term * factor"]), + (43, G["@"]): ("SHIFT", 57), (43, G[","]): ("REDUCE", G["factor -> atom"]), + (43, G["in"]): ("REDUCE", G["factor -> atom"]), (43, G["then"]): ("REDUCE", G["factor -> atom"]), (43, G[";"]): ("REDUCE", G["factor -> atom"]), (43, G["+"]): ("REDUCE", G["factor -> atom"]), @@ -488,41 +484,39 @@ def __action_table(): (43, G["-"]): ("REDUCE", G["factor -> atom"]), (43, G["fi"]): ("REDUCE", G["factor -> atom"]), (43, G["*"]): ("REDUCE", G["factor -> atom"]), - (43, G["}"]): ("REDUCE", G["factor -> atom"]), (43, G["/"]): ("REDUCE", G["factor -> atom"]), + (43, G["}"]): ("REDUCE", G["factor -> atom"]), (43, G["<"]): ("REDUCE", G["factor -> atom"]), - (43, G["@"]): ("SHIFT", 57), + (43, G["loop"]): ("REDUCE", G["factor -> atom"]), + (43, G["<="]): ("REDUCE", G["factor -> atom"]), + (43, G["="]): ("REDUCE", G["factor -> atom"]), + (43, G["pool"]): ("REDUCE", G["factor -> atom"]), + (43, G[")"]): ("REDUCE", G["factor -> atom"]), + (43, G["error"]): ("REDUCE", G["factor -> atom"]), (43, G["."]): ("SHIFT", 44), (44, G["id"]): ("SHIFT", 45), (45, G["("]): ("SHIFT", 46), - (46, G["while"]): ("SHIFT", 13), - (46, G["~"]): ("SHIFT", 27), - (46, G["let"]): ("SHIFT", 14), - (46, G["id"]): ("SHIFT", 31), (46, G["false"]): ("SHIFT", 26), - (46, G["("]): ("SHIFT", 11), - (46, G[")"]): ("REDUCE", G["expr-list -> e"]), - (46, G["isvoid"]): ("SHIFT", 24), + (46, G["~"]): ("SHIFT", 27), (46, G["new"]): ("SHIFT", 22), - (46, G["true"]): ("SHIFT", 25), + (46, G["isvoid"]): ("SHIFT", 24), + (46, G["id"]): ("SHIFT", 31), (46, G["case"]): ("SHIFT", 21), - (46, G["not"]): ("SHIFT", 30), - (46, G["string"]): ("SHIFT", 33), + (46, G["true"]): ("SHIFT", 25), (46, G["{"]): ("SHIFT", 10), - (46, G["int"]): ("SHIFT", 34), + (46, G["string"]): ("SHIFT", 33), + (46, G["not"]): ("SHIFT", 30), + (46, G["let"]): ("SHIFT", 14), (46, G["if"]): ("SHIFT", 12), + (46, G["int"]): ("SHIFT", 34), + (46, G["while"]): ("SHIFT", 13), + (46, G[")"]): ("REDUCE", G["expr-list -> e"]), + (46, G["("]): ("SHIFT", 11), (47, G[")"]): ("SHIFT", 48), - (48, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), @@ -530,64 +524,65 @@ def __action_table(): (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (49, G[")"]): ("REDUCE", G["expr-list -> not-empty-expr-list"]), - (50, G[","]): ("SHIFT", 51), (50, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), - (51, G["while"]): ("SHIFT", 13), - (51, G["~"]): ("SHIFT", 27), - (51, G["let"]): ("SHIFT", 14), - (51, G["id"]): ("SHIFT", 31), + (50, G[","]): ("SHIFT", 51), (51, G["false"]): ("SHIFT", 26), - (51, G["("]): ("SHIFT", 11), - (51, G["isvoid"]): ("SHIFT", 24), + (51, G["~"]): ("SHIFT", 27), (51, G["new"]): ("SHIFT", 22), - (51, G["true"]): ("SHIFT", 25), + (51, G["isvoid"]): ("SHIFT", 24), + (51, G["id"]): ("SHIFT", 31), (51, G["case"]): ("SHIFT", 21), - (51, G["not"]): ("SHIFT", 30), - (51, G["string"]): ("SHIFT", 33), + (51, G["true"]): ("SHIFT", 25), (51, G["{"]): ("SHIFT", 10), - (51, G["int"]): ("SHIFT", 34), + (51, G["string"]): ("SHIFT", 33), + (51, G["not"]): ("SHIFT", 30), + (51, G["let"]): ("SHIFT", 14), (51, G["if"]): ("SHIFT", 12), - (52, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr , not-empty-expr-list"]), - (53, G["*"]): ("SHIFT", 41), - (53, G["/"]): ("SHIFT", 54), - (53, G["<="]): ("REDUCE", G["arith -> term"]), - (53, G["="]): ("REDUCE", G["arith -> term"]), - (53, G["pool"]): ("REDUCE", G["arith -> term"]), - (53, G[")"]): ("REDUCE", G["arith -> term"]), - (53, G["loop"]): ("REDUCE", G["arith -> term"]), + (51, G["int"]): ("SHIFT", 34), + (51, G["while"]): ("SHIFT", 13), + (51, G["("]): ("SHIFT", 11), + (52, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr , not-empty-expr-list"]), + (53, G["/"]): ("SHIFT", 54), (53, G[","]): ("REDUCE", G["arith -> term"]), (53, G["in"]): ("REDUCE", G["arith -> term"]), (53, G["then"]): ("REDUCE", G["arith -> term"]), - (53, G["<"]): ("REDUCE", G["arith -> term"]), (53, G[";"]): ("REDUCE", G["arith -> term"]), (53, G["+"]): ("REDUCE", G["arith -> term"]), - (53, G["else"]): ("REDUCE", G["arith -> term"]), (53, G["of"]): ("REDUCE", G["arith -> term"]), + (53, G["else"]): ("REDUCE", G["arith -> term"]), (53, G["-"]): ("REDUCE", G["arith -> term"]), (53, G["fi"]): ("REDUCE", G["arith -> term"]), (53, G["}"]): ("REDUCE", G["arith -> term"]), + (53, G["<"]): ("REDUCE", G["arith -> term"]), + (53, G["loop"]): ("REDUCE", G["arith -> term"]), + (53, G["<="]): ("REDUCE", G["arith -> term"]), + (53, G["="]): ("REDUCE", G["arith -> term"]), + (53, G[")"]): ("REDUCE", G["arith -> term"]), + (53, G["pool"]): ("REDUCE", G["arith -> term"]), (53, G["error"]): ("REDUCE", G["arith -> term"]), - (54, G["("]): ("SHIFT", 11), + (53, G["*"]): ("SHIFT", 41), (54, G["isvoid"]): ("SHIFT", 24), - (54, G["true"]): ("SHIFT", 25), - (54, G["id"]): ("SHIFT", 28), + (54, G["("]): ("SHIFT", 11), (54, G["int"]): ("SHIFT", 34), - (54, G["~"]): ("SHIFT", 27), + (54, G["id"]): ("SHIFT", 28), (54, G["string"]): ("SHIFT", 33), - (54, G["new"]): ("SHIFT", 22), + (54, G["~"]): ("SHIFT", 27), (54, G["false"]): ("SHIFT", 26), - (55, G["<="]): ("REDUCE", G["term -> term / factor"]), - (55, G["error"]): ("REDUCE", G["term -> term / factor"]), - (55, G["="]): ("REDUCE", G["term -> term / factor"]), - (55, G["pool"]): ("REDUCE", G["term -> term / factor"]), - (55, G[")"]): ("REDUCE", G["term -> term / factor"]), - (55, G["loop"]): ("REDUCE", G["term -> term / factor"]), - (55, G["in"]): ("REDUCE", G["term -> term / factor"]), + (54, G["new"]): ("SHIFT", 22), + (54, G["true"]): ("SHIFT", 25), (55, G[","]): ("REDUCE", G["term -> term / factor"]), + (55, G["in"]): ("REDUCE", G["term -> term / factor"]), (55, G["then"]): ("REDUCE", G["term -> term / factor"]), (55, G[";"]): ("REDUCE", G["term -> term / factor"]), (55, G["+"]): ("REDUCE", G["term -> term / factor"]), @@ -596,17 +591,17 @@ def __action_table(): (55, G["-"]): ("REDUCE", G["term -> term / factor"]), (55, G["fi"]): ("REDUCE", G["term -> term / factor"]), (55, G["*"]): ("REDUCE", G["term -> term / factor"]), - (55, G["}"]): ("REDUCE", G["term -> term / factor"]), (55, G["/"]): ("REDUCE", G["term -> term / factor"]), + (55, G["}"]): ("REDUCE", G["term -> term / factor"]), (55, G["<"]): ("REDUCE", G["term -> term / factor"]), - (56, G["<="]): ("REDUCE", G["term -> factor"]), - (56, G["error"]): ("REDUCE", G["term -> factor"]), - (56, G["="]): ("REDUCE", G["term -> factor"]), - (56, G["pool"]): ("REDUCE", G["term -> factor"]), - (56, G[")"]): ("REDUCE", G["term -> factor"]), - (56, G["loop"]): ("REDUCE", G["term -> factor"]), - (56, G["in"]): ("REDUCE", G["term -> factor"]), + (55, G["loop"]): ("REDUCE", G["term -> term / factor"]), + (55, G["<="]): ("REDUCE", G["term -> term / factor"]), + (55, G["="]): ("REDUCE", G["term -> term / factor"]), + (55, G["pool"]): ("REDUCE", G["term -> term / factor"]), + (55, G[")"]): ("REDUCE", G["term -> term / factor"]), + (55, G["error"]): ("REDUCE", G["term -> term / factor"]), (56, G[","]): ("REDUCE", G["term -> factor"]), + (56, G["in"]): ("REDUCE", G["term -> factor"]), (56, G["then"]): ("REDUCE", G["term -> factor"]), (56, G[";"]): ("REDUCE", G["term -> factor"]), (56, G["+"]): ("REDUCE", G["term -> factor"]), @@ -615,41 +610,40 @@ def __action_table(): (56, G["-"]): ("REDUCE", G["term -> factor"]), (56, G["fi"]): ("REDUCE", G["term -> factor"]), (56, G["*"]): ("REDUCE", G["term -> factor"]), - (56, G["}"]): ("REDUCE", G["term -> factor"]), (56, G["/"]): ("REDUCE", G["term -> factor"]), + (56, G["}"]): ("REDUCE", G["term -> factor"]), (56, G["<"]): ("REDUCE", G["term -> factor"]), + (56, G["loop"]): ("REDUCE", G["term -> factor"]), + (56, G["<="]): ("REDUCE", G["term -> factor"]), + (56, G["="]): ("REDUCE", G["term -> factor"]), + (56, G["pool"]): ("REDUCE", G["term -> factor"]), + (56, G[")"]): ("REDUCE", G["term -> factor"]), + (56, G["error"]): ("REDUCE", G["term -> factor"]), (57, G["type"]): ("SHIFT", 58), (58, G["."]): ("SHIFT", 59), (59, G["id"]): ("SHIFT", 60), (60, G["("]): ("SHIFT", 61), - (61, G["while"]): ("SHIFT", 13), - (61, G["~"]): ("SHIFT", 27), - (61, G["let"]): ("SHIFT", 14), - (61, G["id"]): ("SHIFT", 31), (61, G["false"]): ("SHIFT", 26), - (61, G["("]): ("SHIFT", 11), - (61, G[")"]): ("REDUCE", G["expr-list -> e"]), - (61, G["isvoid"]): ("SHIFT", 24), + (61, G["~"]): ("SHIFT", 27), (61, G["new"]): ("SHIFT", 22), - (61, G["true"]): ("SHIFT", 25), + (61, G["isvoid"]): ("SHIFT", 24), + (61, G["id"]): ("SHIFT", 31), (61, G["case"]): ("SHIFT", 21), - (61, G["not"]): ("SHIFT", 30), - (61, G["string"]): ("SHIFT", 33), + (61, G["true"]): ("SHIFT", 25), (61, G["{"]): ("SHIFT", 10), - (61, G["int"]): ("SHIFT", 34), + (61, G["string"]): ("SHIFT", 33), + (61, G["not"]): ("SHIFT", 30), + (61, G["let"]): ("SHIFT", 14), (61, G["if"]): ("SHIFT", 12), + (61, G["int"]): ("SHIFT", 34), + (61, G["while"]): ("SHIFT", 13), + (61, G[")"]): ("REDUCE", G["expr-list -> e"]), + (61, G["("]): ("SHIFT", 11), (62, G[")"]): ("SHIFT", 63), - (63, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), @@ -657,148 +651,149 @@ def __action_table(): (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (64, G["int"]): ("SHIFT", 34), - (64, G["id"]): ("SHIFT", 28), - (64, G["string"]): ("SHIFT", 33), + (63, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (64, G["("]): ("SHIFT", 11), - (64, G["isvoid"]): ("SHIFT", 24), - (64, G["true"]): ("SHIFT", 25), + (64, G["string"]): ("SHIFT", 33), (64, G["~"]): ("SHIFT", 27), - (64, G["new"]): ("SHIFT", 22), (64, G["false"]): ("SHIFT", 26), - (65, G["*"]): ("SHIFT", 41), + (64, G["new"]): ("SHIFT", 22), + (64, G["isvoid"]): ("SHIFT", 24), + (64, G["id"]): ("SHIFT", 28), + (64, G["int"]): ("SHIFT", 34), + (64, G["true"]): ("SHIFT", 25), (65, G["/"]): ("SHIFT", 54), - (65, G["<="]): ("REDUCE", G["arith -> arith - term"]), - (65, G["="]): ("REDUCE", G["arith -> arith - term"]), - (65, G["pool"]): ("REDUCE", G["arith -> arith - term"]), - (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["loop"]): ("REDUCE", G["arith -> arith - term"]), (65, G[","]): ("REDUCE", G["arith -> arith - term"]), (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), (65, G["then"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["<"]): ("REDUCE", G["arith -> arith - term"]), (65, G[";"]): ("REDUCE", G["arith -> arith - term"]), (65, G["+"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["else"]): ("REDUCE", G["arith -> arith - term"]), (65, G["of"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["else"]): ("REDUCE", G["arith -> arith - term"]), (65, G["-"]): ("REDUCE", G["arith -> arith - term"]), (65, G["fi"]): ("REDUCE", G["arith -> arith - term"]), (65, G["}"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["<"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["loop"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["<="]): ("REDUCE", G["arith -> arith - term"]), + (65, G["="]): ("REDUCE", G["arith -> arith - term"]), + (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["pool"]): ("REDUCE", G["arith -> arith - term"]), (65, G["error"]): ("REDUCE", G["arith -> arith - term"]), - (66, G["string"]): ("SHIFT", 33), - (66, G["isvoid"]): ("SHIFT", 24), - (66, G["~"]): ("SHIFT", 27), - (66, G["("]): ("SHIFT", 11), + (65, G["*"]): ("SHIFT", 41), + (66, G["id"]): ("SHIFT", 28), + (66, G["int"]): ("SHIFT", 34), (66, G["false"]): ("SHIFT", 26), (66, G["new"]): ("SHIFT", 22), + (66, G["string"]): ("SHIFT", 33), + (66, G["("]): ("SHIFT", 11), + (66, G["~"]): ("SHIFT", 27), (66, G["true"]): ("SHIFT", 25), - (66, G["id"]): ("SHIFT", 28), - (66, G["int"]): ("SHIFT", 34), + (66, G["isvoid"]): ("SHIFT", 24), (67, G["-"]): ("SHIFT", 64), - (67, G["+"]): ("SHIFT", 39), - (67, G["else"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["}"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), (67, G["in"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), - (68, G["string"]): ("SHIFT", 33), - (68, G["isvoid"]): ("SHIFT", 24), - (68, G["~"]): ("SHIFT", 27), - (68, G["("]): ("SHIFT", 11), + (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["else"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["+"]): ("SHIFT", 39), + (68, G["id"]): ("SHIFT", 28), + (68, G["int"]): ("SHIFT", 34), (68, G["false"]): ("SHIFT", 26), (68, G["new"]): ("SHIFT", 22), + (68, G["string"]): ("SHIFT", 33), + (68, G["("]): ("SHIFT", 11), + (68, G["~"]): ("SHIFT", 27), (68, G["true"]): ("SHIFT", 25), - (68, G["id"]): ("SHIFT", 28), - (68, G["int"]): ("SHIFT", 34), - (69, G["+"]): ("SHIFT", 39), + (68, G["isvoid"]): ("SHIFT", 24), (69, G["-"]): ("SHIFT", 64), - (69, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), - (70, G["string"]): ("SHIFT", 33), - (70, G["isvoid"]): ("SHIFT", 24), - (70, G["~"]): ("SHIFT", 27), - (70, G["("]): ("SHIFT", 11), + (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["+"]): ("SHIFT", 39), + (70, G["id"]): ("SHIFT", 28), + (70, G["int"]): ("SHIFT", 34), (70, G["false"]): ("SHIFT", 26), (70, G["new"]): ("SHIFT", 22), + (70, G["string"]): ("SHIFT", 33), + (70, G["("]): ("SHIFT", 11), + (70, G["~"]): ("SHIFT", 27), (70, G["true"]): ("SHIFT", 25), - (70, G["id"]): ("SHIFT", 28), - (70, G["int"]): ("SHIFT", 34), + (70, G["isvoid"]): ("SHIFT", 24), (71, G["-"]): ("SHIFT", 64), - (71, G["else"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["}"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), (71, G["in"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), (71, G["error"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), (71, G[";"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["else"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["+"]): ("SHIFT", 39), - (72, G["else"]): ("REDUCE", G["expr -> not expr"]), - (72, G["error"]): ("REDUCE", G["expr -> not expr"]), - (72, G[")"]): ("REDUCE", G["expr -> not expr"]), - (72, G["pool"]): ("REDUCE", G["expr -> not expr"]), - (72, G["of"]): ("REDUCE", G["expr -> not expr"]), - (72, G["fi"]): ("REDUCE", G["expr -> not expr"]), - (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), (72, G["}"]): ("REDUCE", G["expr -> not expr"]), - (72, G[","]): ("REDUCE", G["expr -> not expr"]), (72, G["in"]): ("REDUCE", G["expr -> not expr"]), + (72, G[","]): ("REDUCE", G["expr -> not expr"]), + (72, G["fi"]): ("REDUCE", G["expr -> not expr"]), (72, G["then"]): ("REDUCE", G["expr -> not expr"]), + (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), (72, G[";"]): ("REDUCE", G["expr -> not expr"]), + (72, G[")"]): ("REDUCE", G["expr -> not expr"]), + (72, G["of"]): ("REDUCE", G["expr -> not expr"]), + (72, G["pool"]): ("REDUCE", G["expr -> not expr"]), + (72, G["else"]): ("REDUCE", G["expr -> not expr"]), + (72, G["error"]): ("REDUCE", G["expr -> not expr"]), (73, G[")"]): ("SHIFT", 74), - (74, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G["<="]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["="]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G[")"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), + (74, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), (75, G[","]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["then"]): ("REDUCE", G["factor -> ~ factor"]), (75, G[";"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["+"]): ("REDUCE", G["factor -> ~ factor"]), @@ -807,17 +802,17 @@ def __action_table(): (75, G["-"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["*"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["}"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["/"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["}"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["<"]): ("REDUCE", G["factor -> ~ factor"]), - (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), + (75, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["<="]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["="]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G[")"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), @@ -826,31 +821,37 @@ def __action_table(): (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), (77, G["of"]): ("SHIFT", 78), (78, G["id"]): ("SHIFT", 79), (79, G[":"]): ("SHIFT", 80), (80, G["type"]): ("SHIFT", 81), (81, G["=>"]): ("SHIFT", 82), - (82, G["new"]): ("SHIFT", 22), - (82, G["false"]): ("SHIFT", 26), - (82, G["("]): ("SHIFT", 11), - (82, G["isvoid"]): ("SHIFT", 24), (82, G["id"]): ("SHIFT", 31), - (82, G["~"]): ("SHIFT", 27), (82, G["while"]): ("SHIFT", 13), + (82, G["string"]): ("SHIFT", 33), + (82, G["not"]): ("SHIFT", 30), + (82, G["new"]): ("SHIFT", 22), (82, G["let"]): ("SHIFT", 14), - (82, G["{"]): ("SHIFT", 10), + (82, G["true"]): ("SHIFT", 25), + (82, G["isvoid"]): ("SHIFT", 24), (82, G["if"]): ("SHIFT", 12), - (82, G["not"]): ("SHIFT", 30), - (82, G["case"]): ("SHIFT", 21), (82, G["int"]): ("SHIFT", 34), - (82, G["string"]): ("SHIFT", 33), - (82, G["true"]): ("SHIFT", 25), - (83, G[";"]): ("SHIFT", 84), + (82, G["false"]): ("SHIFT", 26), + (82, G["("]): ("SHIFT", 11), + (82, G["{"]): ("SHIFT", 10), + (82, G["case"]): ("SHIFT", 21), + (82, G["~"]): ("SHIFT", 27), (83, G["error"]): ("SHIFT", 86), + (83, G[";"]): ("SHIFT", 84), (84, G["id"]): ("SHIFT", 79), (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), @@ -858,198 +859,198 @@ def __action_table(): (86, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), (87, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error case-list"]), (88, G["esac"]): ("SHIFT", 89), - (89, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (90, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), (90, G[","]): ("SHIFT", 91), (91, G["id"]): ("SHIFT", 15), (92, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), (93, G["in"]): ("SHIFT", 94), - (94, G["int"]): ("SHIFT", 34), (94, G["string"]): ("SHIFT", 33), - (94, G["true"]): ("SHIFT", 25), - (94, G["id"]): ("SHIFT", 31), - (94, G["~"]): ("SHIFT", 27), - (94, G["new"]): ("SHIFT", 22), - (94, G["not"]): ("SHIFT", 30), - (94, G["("]): ("SHIFT", 11), - (94, G["false"]): ("SHIFT", 26), - (94, G["while"]): ("SHIFT", 13), - (94, G["let"]): ("SHIFT", 14), - (94, G["{"]): ("SHIFT", 10), (94, G["isvoid"]): ("SHIFT", 24), - (94, G["if"]): ("SHIFT", 12), (94, G["case"]): ("SHIFT", 21), - (95, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G["int"]): ("SHIFT", 34), + (94, G["{"]): ("SHIFT", 10), + (94, G["let"]): ("SHIFT", 14), + (94, G["("]): ("SHIFT", 11), + (94, G["not"]): ("SHIFT", 30), + (94, G["if"]): ("SHIFT", 12), + (94, G["~"]): ("SHIFT", 27), + (94, G["while"]): ("SHIFT", 13), + (94, G["false"]): ("SHIFT", 26), + (94, G["new"]): ("SHIFT", 22), + (94, G["id"]): ("SHIFT", 31), + (94, G["true"]): ("SHIFT", 25), (95, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (96, G["loop"]): ("SHIFT", 97), - (97, G["false"]): ("SHIFT", 26), - (97, G["("]): ("SHIFT", 11), - (97, G["new"]): ("SHIFT", 22), - (97, G["let"]): ("SHIFT", 14), - (97, G["if"]): ("SHIFT", 12), (97, G["{"]): ("SHIFT", 10), - (97, G["id"]): ("SHIFT", 31), - (97, G["not"]): ("SHIFT", 30), - (97, G["while"]): ("SHIFT", 13), (97, G["true"]): ("SHIFT", 25), + (97, G["not"]): ("SHIFT", 30), (97, G["~"]): ("SHIFT", 27), - (97, G["int"]): ("SHIFT", 34), - (97, G["string"]): ("SHIFT", 33), + (97, G["let"]): ("SHIFT", 14), (97, G["case"]): ("SHIFT", 21), + (97, G["int"]): ("SHIFT", 34), + (97, G["id"]): ("SHIFT", 31), + (97, G["false"]): ("SHIFT", 26), + (97, G["new"]): ("SHIFT", 22), + (97, G["("]): ("SHIFT", 11), (97, G["isvoid"]): ("SHIFT", 24), + (97, G["while"]): ("SHIFT", 13), + (97, G["if"]): ("SHIFT", 12), + (97, G["string"]): ("SHIFT", 33), (98, G["pool"]): ("SHIFT", 99), - (99, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (100, G["then"]): ("SHIFT", 101), - (101, G["case"]): ("SHIFT", 21), - (101, G["int"]): ("SHIFT", 34), + (101, G["("]): ("SHIFT", 11), (101, G["{"]): ("SHIFT", 10), - (101, G["~"]): ("SHIFT", 27), - (101, G["if"]): ("SHIFT", 12), - (101, G["let"]): ("SHIFT", 14), + (101, G["id"]): ("SHIFT", 31), + (101, G["case"]): ("SHIFT", 21), (101, G["isvoid"]): ("SHIFT", 24), + (101, G["string"]): ("SHIFT", 33), (101, G["true"]): ("SHIFT", 25), - (101, G["id"]): ("SHIFT", 31), + (101, G["~"]): ("SHIFT", 27), (101, G["while"]): ("SHIFT", 13), + (101, G["int"]): ("SHIFT", 34), + (101, G["if"]): ("SHIFT", 12), (101, G["not"]): ("SHIFT", 30), - (101, G["string"]): ("SHIFT", 33), (101, G["false"]): ("SHIFT", 26), - (101, G["("]): ("SHIFT", 11), + (101, G["let"]): ("SHIFT", 14), (101, G["new"]): ("SHIFT", 22), (102, G["else"]): ("SHIFT", 103), - (103, G["while"]): ("SHIFT", 13), - (103, G["string"]): ("SHIFT", 33), - (103, G["let"]): ("SHIFT", 14), - (103, G["id"]): ("SHIFT", 31), - (103, G["true"]): ("SHIFT", 25), - (103, G["{"]): ("SHIFT", 10), - (103, G["if"]): ("SHIFT", 12), - (103, G["not"]): ("SHIFT", 30), - (103, G["new"]): ("SHIFT", 22), - (103, G["case"]): ("SHIFT", 21), (103, G["("]): ("SHIFT", 11), (103, G["false"]): ("SHIFT", 26), + (103, G["if"]): ("SHIFT", 12), + (103, G["while"]): ("SHIFT", 13), + (103, G["int"]): ("SHIFT", 34), (103, G["isvoid"]): ("SHIFT", 24), + (103, G["id"]): ("SHIFT", 31), (103, G["~"]): ("SHIFT", 27), - (103, G["int"]): ("SHIFT", 34), + (103, G["{"]): ("SHIFT", 10), + (103, G["case"]): ("SHIFT", 21), + (103, G["true"]): ("SHIFT", 25), + (103, G["new"]): ("SHIFT", 22), + (103, G["string"]): ("SHIFT", 33), + (103, G["not"]): ("SHIFT", 30), + (103, G["let"]): ("SHIFT", 14), (104, G["fi"]): ("SHIFT", 105), - (105, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (106, G[")"]): ("SHIFT", 107), - (107, G["<="]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["error"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["="]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G[")"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["."]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["in"]): ("REDUCE", G["atom -> ( expr )"]), (107, G[","]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["in"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["then"]): ("REDUCE", G["atom -> ( expr )"]), (107, G[";"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["@"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["+"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["@"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["else"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["of"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["-"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["*"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["}"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["/"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["}"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["<"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["<="]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["="]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G[")"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["error"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["."]): ("REDUCE", G["atom -> ( expr )"]), (108, G["}"]): ("SHIFT", 109), - (109, G["else"]): ("REDUCE", G["expr -> { block }"]), - (109, G[")"]): ("REDUCE", G["expr -> { block }"]), - (109, G["pool"]): ("REDUCE", G["expr -> { block }"]), - (109, G["of"]): ("REDUCE", G["expr -> { block }"]), - (109, G["fi"]): ("REDUCE", G["expr -> { block }"]), - (109, G["then"]): ("REDUCE", G["expr -> { block }"]), - (109, G["loop"]): ("REDUCE", G["expr -> { block }"]), (109, G["}"]): ("REDUCE", G["expr -> { block }"]), - (109, G[","]): ("REDUCE", G["expr -> { block }"]), (109, G["in"]): ("REDUCE", G["expr -> { block }"]), + (109, G[","]): ("REDUCE", G["expr -> { block }"]), (109, G["error"]): ("REDUCE", G["expr -> { block }"]), + (109, G["then"]): ("REDUCE", G["expr -> { block }"]), + (109, G["loop"]): ("REDUCE", G["expr -> { block }"]), (109, G[";"]): ("REDUCE", G["expr -> { block }"]), + (109, G[")"]): ("REDUCE", G["expr -> { block }"]), + (109, G["of"]): ("REDUCE", G["expr -> { block }"]), + (109, G["pool"]): ("REDUCE", G["expr -> { block }"]), + (109, G["else"]): ("REDUCE", G["expr -> { block }"]), + (109, G["fi"]): ("REDUCE", G["expr -> { block }"]), (110, G["error"]): ("SHIFT", 113), (110, G[";"]): ("SHIFT", 111), - (111, G["new"]): ("SHIFT", 22), - (111, G["("]): ("SHIFT", 11), - (111, G["false"]): ("SHIFT", 26), - (111, G["isvoid"]): ("SHIFT", 24), (111, G["id"]): ("SHIFT", 31), - (111, G["~"]): ("SHIFT", 27), (111, G["while"]): ("SHIFT", 13), + (111, G["string"]): ("SHIFT", 33), + (111, G["not"]): ("SHIFT", 30), + (111, G["new"]): ("SHIFT", 22), (111, G["let"]): ("SHIFT", 14), - (111, G["}"]): ("REDUCE", G["block -> expr ;"]), - (111, G["{"]): ("SHIFT", 10), + (111, G["true"]): ("SHIFT", 25), + (111, G["isvoid"]): ("SHIFT", 24), (111, G["if"]): ("SHIFT", 12), - (111, G["not"]): ("SHIFT", 30), - (111, G["case"]): ("SHIFT", 21), (111, G["int"]): ("SHIFT", 34), - (111, G["string"]): ("SHIFT", 33), - (111, G["true"]): ("SHIFT", 25), + (111, G["false"]): ("SHIFT", 26), + (111, G["("]): ("SHIFT", 11), + (111, G["{"]): ("SHIFT", 10), + (111, G["}"]): ("REDUCE", G["block -> expr ;"]), + (111, G["case"]): ("SHIFT", 21), + (111, G["~"]): ("SHIFT", 27), (112, G["}"]): ("REDUCE", G["block -> expr ; block"]), - (113, G["new"]): ("SHIFT", 22), - (113, G["false"]): ("SHIFT", 26), - (113, G["("]): ("SHIFT", 11), - (113, G["isvoid"]): ("SHIFT", 24), (113, G["id"]): ("SHIFT", 31), - (113, G["~"]): ("SHIFT", 27), (113, G["while"]): ("SHIFT", 13), + (113, G["string"]): ("SHIFT", 33), + (113, G["not"]): ("SHIFT", 30), + (113, G["new"]): ("SHIFT", 22), (113, G["let"]): ("SHIFT", 14), + (113, G["true"]): ("SHIFT", 25), + (113, G["isvoid"]): ("SHIFT", 24), (113, G["}"]): ("REDUCE", G["block -> expr error"]), - (113, G["{"]): ("SHIFT", 10), (113, G["if"]): ("SHIFT", 12), - (113, G["not"]): ("SHIFT", 30), - (113, G["case"]): ("SHIFT", 21), (113, G["int"]): ("SHIFT", 34), - (113, G["string"]): ("SHIFT", 33), - (113, G["true"]): ("SHIFT", 25), + (113, G["false"]): ("SHIFT", 26), + (113, G["("]): ("SHIFT", 11), + (113, G["{"]): ("SHIFT", 10), + (113, G["case"]): ("SHIFT", 21), + (113, G["~"]): ("SHIFT", 27), (114, G["}"]): ("REDUCE", G["block -> expr error block"]), (115, G["}"]): ("SHIFT", 116), - (116, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), (116, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (116, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), (117, G[":"]): ("SHIFT", 118), (118, G["type"]): ("SHIFT", 119), (119, G[","]): ("SHIFT", 120), @@ -1060,45 +1061,45 @@ def __action_table(): (123, G[":"]): ("SHIFT", 124), (124, G["type"]): ("SHIFT", 125), (125, G["{"]): ("SHIFT", 126), - (126, G["while"]): ("SHIFT", 13), - (126, G["isvoid"]): ("SHIFT", 24), + (126, G["case"]): ("SHIFT", 21), (126, G["true"]): ("SHIFT", 25), - (126, G["id"]): ("SHIFT", 31), - (126, G["~"]): ("SHIFT", 27), (126, G["new"]): ("SHIFT", 22), - (126, G["("]): ("SHIFT", 11), - (126, G["false"]): ("SHIFT", 26), - (126, G["int"]): ("SHIFT", 34), - (126, G["case"]): ("SHIFT", 21), + (126, G["string"]): ("SHIFT", 33), + (126, G["id"]): ("SHIFT", 31), (126, G["not"]): ("SHIFT", 30), + (126, G["let"]): ("SHIFT", 14), (126, G["{"]): ("SHIFT", 10), + (126, G["("]): ("SHIFT", 11), + (126, G["false"]): ("SHIFT", 26), (126, G["if"]): ("SHIFT", 12), - (126, G["let"]): ("SHIFT", 14), - (126, G["string"]): ("SHIFT", 33), + (126, G["while"]): ("SHIFT", 13), + (126, G["int"]): ("SHIFT", 34), + (126, G["isvoid"]): ("SHIFT", 24), + (126, G["~"]): ("SHIFT", 27), (127, G["}"]): ("SHIFT", 128), - (128, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (128, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (128, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (129, G["type"]): ("SHIFT", 130), - (130, G["error"]): ("REDUCE", G["attribute -> id : type"]), - (130, G[";"]): ("REDUCE", G["attribute -> id : type"]), (130, G["<-"]): ("SHIFT", 131), - (131, G["new"]): ("SHIFT", 22), - (131, G["false"]): ("SHIFT", 26), - (131, G["("]): ("SHIFT", 11), - (131, G["isvoid"]): ("SHIFT", 24), + (130, G[";"]): ("REDUCE", G["attribute -> id : type"]), + (130, G["error"]): ("REDUCE", G["attribute -> id : type"]), (131, G["id"]): ("SHIFT", 31), - (131, G["~"]): ("SHIFT", 27), (131, G["while"]): ("SHIFT", 13), + (131, G["string"]): ("SHIFT", 33), + (131, G["not"]): ("SHIFT", 30), + (131, G["new"]): ("SHIFT", 22), (131, G["let"]): ("SHIFT", 14), - (131, G["{"]): ("SHIFT", 10), + (131, G["true"]): ("SHIFT", 25), + (131, G["isvoid"]): ("SHIFT", 24), (131, G["if"]): ("SHIFT", 12), - (131, G["not"]): ("SHIFT", 30), - (131, G["case"]): ("SHIFT", 21), (131, G["int"]): ("SHIFT", 34), - (131, G["string"]): ("SHIFT", 33), - (131, G["true"]): ("SHIFT", 25), - (132, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (131, G["false"]): ("SHIFT", 26), + (131, G["("]): ("SHIFT", 11), + (131, G["{"]): ("SHIFT", 10), + (131, G["case"]): ("SHIFT", 21), + (131, G["~"]): ("SHIFT", 27), (132, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (132, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), (133, G["}"]): ("SHIFT", 134), (134, G["class"]): ("REDUCE", G["class-def -> class type { feature-list }"]), (134, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), @@ -1127,145 +1128,145 @@ def __action_table(): (149, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), (150, G["$"]): ("OK", None), (151, G["$"]): ("REDUCE", G["program -> class-list"]), - (152, G["class"]): ("SHIFT", 1), (152, G["$"]): ("REDUCE", G["class-list -> class-def"]), + (152, G["class"]): ("SHIFT", 1), (153, G["$"]): ("REDUCE", G["class-list -> class-def class-list"]), } @staticmethod def __goto_table(): return { - (0, G["program"]): 150, (0, G["class-list"]): 151, (0, G["class-def"]): 152, - (3, G["attribute"]): 135, + (0, G["program"]): 150, (3, G["method"]): 138, + (3, G["attribute"]): 135, (3, G["feature-list"]): 133, (5, G["param-list"]): 122, - (9, G["atom"]): 43, (9, G["function-call"]): 35, - (9, G["arith"]): 38, (9, G["term"]): 53, + (9, G["arith"]): 38, (9, G["factor"]): 56, - (9, G["comp"]): 37, + (9, G["atom"]): 43, (9, G["expr"]): 115, - (10, G["function-call"]): 35, - (10, G["arith"]): 38, - (10, G["block"]): 108, - (10, G["expr"]): 110, + (9, G["comp"]): 37, (10, G["term"]): 53, + (10, G["block"]): 108, + (10, G["arith"]): 38, + (10, G["function-call"]): 35, + (10, G["factor"]): 56, (10, G["atom"]): 43, (10, G["comp"]): 37, - (10, G["factor"]): 56, + (10, G["expr"]): 110, (11, G["atom"]): 43, + (11, G["expr"]): 106, (11, G["arith"]): 38, (11, G["term"]): 53, - (11, G["expr"]): 106, - (11, G["comp"]): 37, (11, G["factor"]): 56, + (11, G["comp"]): 37, (11, G["function-call"]): 35, + (12, G["factor"]): 56, (12, G["arith"]): 38, (12, G["comp"]): 37, - (12, G["expr"]): 100, (12, G["term"]): 53, (12, G["function-call"]): 35, + (12, G["expr"]): 100, (12, G["atom"]): 43, - (12, G["factor"]): 56, + (13, G["atom"]): 43, + (13, G["arith"]): 38, + (13, G["expr"]): 96, (13, G["factor"]): 56, (13, G["term"]): 53, - (13, G["arith"]): 38, (13, G["comp"]): 37, - (13, G["atom"]): 43, (13, G["function-call"]): 35, - (13, G["expr"]): 96, (14, G["declaration-list"]): 93, (18, G["declaration-list"]): 19, (20, G["arith"]): 38, - (20, G["atom"]): 43, - (20, G["expr"]): 90, (20, G["term"]): 53, + (20, G["atom"]): 43, + (20, G["comp"]): 37, (20, G["factor"]): 56, (20, G["function-call"]): 35, - (20, G["comp"]): 37, + (20, G["expr"]): 90, (21, G["atom"]): 43, - (21, G["arith"]): 38, - (21, G["comp"]): 37, - (21, G["expr"]): 77, (21, G["term"]): 53, + (21, G["expr"]): 77, + (21, G["comp"]): 37, (21, G["function-call"]): 35, (21, G["factor"]): 56, + (21, G["arith"]): 38, + (24, G["function-call"]): 35, (24, G["atom"]): 43, (24, G["factor"]): 76, - (24, G["function-call"]): 35, - (27, G["atom"]): 43, (27, G["function-call"]): 35, + (27, G["atom"]): 43, (27, G["factor"]): 75, - (29, G["arith"]): 38, - (29, G["term"]): 53, - (29, G["factor"]): 56, - (29, G["expr-list"]): 73, (29, G["expr"]): 50, + (29, G["arith"]): 38, (29, G["atom"]): 43, - (29, G["function-call"]): 35, - (29, G["comp"]): 37, + (29, G["expr-list"]): 73, (29, G["not-empty-expr-list"]): 49, + (29, G["factor"]): 56, + (29, G["comp"]): 37, + (29, G["term"]): 53, + (29, G["function-call"]): 35, (30, G["factor"]): 56, (30, G["arith"]): 38, + (30, G["expr"]): 72, + (30, G["atom"]): 43, (30, G["term"]): 53, - (30, G["comp"]): 37, (30, G["function-call"]): 35, - (30, G["atom"]): 43, - (30, G["expr"]): 72, + (30, G["comp"]): 37, (32, G["factor"]): 56, (32, G["arith"]): 38, + (32, G["atom"]): 43, (32, G["term"]): 53, - (32, G["comp"]): 37, (32, G["function-call"]): 35, - (32, G["atom"]): 43, + (32, G["comp"]): 37, (32, G["expr"]): 36, - (39, G["atom"]): 43, (39, G["term"]): 40, (39, G["factor"]): 56, (39, G["function-call"]): 35, + (39, G["atom"]): 43, + (41, G["function-call"]): 35, (41, G["atom"]): 43, (41, G["factor"]): 42, - (41, G["function-call"]): 35, - (46, G["arith"]): 38, - (46, G["term"]): 53, - (46, G["factor"]): 56, (46, G["expr"]): 50, - (46, G["atom"]): 43, + (46, G["arith"]): 38, (46, G["expr-list"]): 47, - (46, G["function-call"]): 35, - (46, G["comp"]): 37, + (46, G["atom"]): 43, (46, G["not-empty-expr-list"]): 49, - (51, G["arith"]): 38, - (51, G["term"]): 53, - (51, G["factor"]): 56, + (46, G["factor"]): 56, + (46, G["comp"]): 37, + (46, G["term"]): 53, + (46, G["function-call"]): 35, (51, G["expr"]): 50, + (51, G["arith"]): 38, (51, G["atom"]): 43, + (51, G["factor"]): 56, (51, G["not-empty-expr-list"]): 52, - (51, G["function-call"]): 35, (51, G["comp"]): 37, - (54, G["atom"]): 43, + (51, G["term"]): 53, + (51, G["function-call"]): 35, (54, G["function-call"]): 35, + (54, G["atom"]): 43, (54, G["factor"]): 55, - (61, G["arith"]): 38, - (61, G["term"]): 53, - (61, G["factor"]): 56, (61, G["expr"]): 50, + (61, G["arith"]): 38, (61, G["atom"]): 43, - (61, G["function-call"]): 35, (61, G["expr-list"]): 62, - (61, G["comp"]): 37, (61, G["not-empty-expr-list"]): 49, - (64, G["atom"]): 43, + (61, G["factor"]): 56, + (61, G["comp"]): 37, + (61, G["term"]): 53, + (61, G["function-call"]): 35, (64, G["term"]): 65, (64, G["factor"]): 56, (64, G["function-call"]): 35, + (64, G["atom"]): 43, + (66, G["arith"]): 67, (66, G["term"]): 53, (66, G["atom"]): 43, - (66, G["arith"]): 67, (66, G["function-call"]): 35, (66, G["factor"]): 56, (68, G["term"]): 53, @@ -1273,96 +1274,96 @@ def __goto_table(): (68, G["function-call"]): 35, (68, G["arith"]): 69, (68, G["factor"]): 56, + (70, G["arith"]): 71, (70, G["term"]): 53, (70, G["atom"]): 43, (70, G["function-call"]): 35, - (70, G["arith"]): 71, (70, G["factor"]): 56, (78, G["case-list"]): 88, - (82, G["function-call"]): 35, - (82, G["arith"]): 38, (82, G["term"]): 53, + (82, G["expr"]): 83, + (82, G["arith"]): 38, + (82, G["function-call"]): 35, + (82, G["factor"]): 56, (82, G["atom"]): 43, (82, G["comp"]): 37, - (82, G["factor"]): 56, - (82, G["expr"]): 83, (84, G["case-list"]): 85, (86, G["case-list"]): 87, (91, G["declaration-list"]): 92, (94, G["factor"]): 56, (94, G["arith"]): 38, + (94, G["atom"]): 43, (94, G["term"]): 53, + (94, G["function-call"]): 35, (94, G["comp"]): 37, (94, G["expr"]): 95, - (94, G["function-call"]): 35, - (94, G["atom"]): 43, - (97, G["function-call"]): 35, + (97, G["term"]): 53, (97, G["arith"]): 38, - (97, G["expr"]): 98, (97, G["atom"]): 43, (97, G["factor"]): 56, - (97, G["term"]): 53, + (97, G["function-call"]): 35, (97, G["comp"]): 37, - (101, G["term"]): 53, + (97, G["expr"]): 98, (101, G["arith"]): 38, + (101, G["function-call"]): 35, + (101, G["term"]): 53, (101, G["atom"]): 43, + (101, G["factor"]): 56, (101, G["expr"]): 102, (101, G["comp"]): 37, - (101, G["function-call"]): 35, - (101, G["factor"]): 56, - (103, G["term"]): 53, - (103, G["arith"]): 38, - (103, G["factor"]): 56, (103, G["atom"]): 43, + (103, G["arith"]): 38, + (103, G["term"]): 53, + (103, G["expr"]): 104, (103, G["comp"]): 37, (103, G["function-call"]): 35, - (103, G["expr"]): 104, - (111, G["function-call"]): 35, - (111, G["arith"]): 38, - (111, G["expr"]): 110, - (111, G["block"]): 112, + (103, G["factor"]): 56, (111, G["term"]): 53, + (111, G["arith"]): 38, + (111, G["function-call"]): 35, + (111, G["factor"]): 56, (111, G["atom"]): 43, (111, G["comp"]): 37, - (111, G["factor"]): 56, - (113, G["function-call"]): 35, - (113, G["arith"]): 38, - (113, G["expr"]): 110, + (111, G["expr"]): 110, + (111, G["block"]): 112, (113, G["term"]): 53, + (113, G["arith"]): 38, + (113, G["function-call"]): 35, + (113, G["factor"]): 56, (113, G["atom"]): 43, - (113, G["block"]): 114, (113, G["comp"]): 37, - (113, G["factor"]): 56, + (113, G["expr"]): 110, + (113, G["block"]): 114, (120, G["param-list"]): 121, - (126, G["atom"]): 43, (126, G["function-call"]): 35, - (126, G["arith"]): 38, (126, G["term"]): 53, + (126, G["arith"]): 38, (126, G["factor"]): 56, + (126, G["atom"]): 43, (126, G["comp"]): 37, (126, G["expr"]): 127, - (131, G["function-call"]): 35, - (131, G["arith"]): 38, (131, G["term"]): 53, - (131, G["atom"]): 43, - (131, G["comp"]): 37, + (131, G["arith"]): 38, + (131, G["function-call"]): 35, (131, G["factor"]): 56, + (131, G["atom"]): 43, (131, G["expr"]): 132, - (136, G["attribute"]): 135, - (136, G["method"]): 138, + (131, G["comp"]): 37, (136, G["feature-list"]): 137, - (139, G["attribute"]): 135, + (136, G["method"]): 138, + (136, G["attribute"]): 135, (139, G["method"]): 138, + (139, G["attribute"]): 135, (139, G["feature-list"]): 140, (141, G["feature-list"]): 142, - (141, G["attribute"]): 135, (141, G["method"]): 138, - (143, G["attribute"]): 135, + (141, G["attribute"]): 135, (143, G["method"]): 138, + (143, G["attribute"]): 135, (143, G["feature-list"]): 144, (147, G["feature-list"]): 148, - (147, G["attribute"]): 135, (147, G["method"]): 138, + (147, G["attribute"]): 135, (152, G["class-def"]): 152, (152, G["class-list"]): 153, } diff --git a/pyjapt/grammar.py b/pyjapt/grammar.py index 295ecc6ef..5ee2a7eab 100755 --- a/pyjapt/grammar.py +++ b/pyjapt/grammar.py @@ -395,6 +395,7 @@ def terminal(self, name: str, regex: str): :return: a function to decorate the production """ + def decorator(rule: Optional[Callable[[Lexer], Optional[Token]]]): self.add_terminal(name, regex, rule) return rule @@ -432,11 +433,11 @@ def copy(self): return G - def serialize_lexer(self, class_name, grammar_module_name, grammar_variable_name='G'): + def serialize_lexer(self, class_name: str, grammar_module_name: str, grammar_variable_name: str = 'G'): LexerSerializer.build(self, class_name, grammar_module_name, grammar_variable_name) @staticmethod - def serialize_parser(parser, class_name, grammar_module_name, grammar_variable_name='G'): + def serialize_parser(parser, class_name: str, grammar_module_name: str, grammar_variable_name: str = 'G'): LRParserSerializer.build(parser, class_name, grammar_module_name, grammar_variable_name) def to_json(self): @@ -605,5 +606,5 @@ def success(self): def warning(self): pass - def error(self, message): - sys.stderr.write(message + '\n') + def error(self, index, message): + self.__parser.set_error(self[index].line, self[index].column, message) diff --git a/pyjapt/parsing.py b/pyjapt/parsing.py index 77e703779..dae04b278 100755 --- a/pyjapt/parsing.py +++ b/pyjapt/parsing.py @@ -325,12 +325,26 @@ def __init__(self, G, verbose=False): self.goto = {} self.sr = 0 self.rr = 0 + self._errors = [] self._build_parsing_table() if self.conflicts: sys.stderr.write(f"Warning: {self.sr} Shift-Reduce Conflicts\n") sys.stderr.write(f"Warning: {self.rr} Reduce-Reduce Conflicts\n") + ############## + # Errors API # + ############## + @property + def errors(self): + return [m for _, _, m in sorted(self._errors)] + + def set_error(self, line, column, message): + self._errors.append((line, column, message)) + ############# + # End # + ############# + def _build_parsing_table(self): G = self.augmented_G automaton = self.automaton @@ -463,6 +477,7 @@ def __call__(self, tokens): inserted_error = False + class SLRParser(ShiftReduceParser): def _build_automaton(self): return build_lr0_automaton(self.augmented_G) diff --git a/pyjapt/serialization.py b/pyjapt/serialization.py index e483f09b5..54c6fa759 100755 --- a/pyjapt/serialization.py +++ b/pyjapt/serialization.py @@ -11,6 +11,7 @@ def __init__(self, verbose=False): self.verbose = verbose self.action = self.__action_table() self.goto = self.__goto_table() + self._errors = [] @staticmethod def __action_table(): From 34afdd5207ac423ad8bd197fea2a7deb30ec8cd7 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Tue, 22 Sep 2020 03:11:08 +0200 Subject: [PATCH 071/143] removed pyjapt library (converted in a python package) --- cool.py | 2 +- grammar.py | 25 +- lexertab.py | 2 +- parsertab.py | 1502 +++++++++++++++++++-------------------- pyjapt/__init__.py | 0 pyjapt/automata.py | 143 ---- pyjapt/grammar.py | 610 ---------------- pyjapt/lexing.py | 102 --- pyjapt/parsing.py | 499 ------------- pyjapt/serialization.py | 119 ---- pyjapt/utils.py | 152 ---- requirements.txt | 1 + 12 files changed, 766 insertions(+), 2391 deletions(-) delete mode 100755 pyjapt/__init__.py delete mode 100755 pyjapt/automata.py delete mode 100755 pyjapt/grammar.py delete mode 100755 pyjapt/lexing.py delete mode 100755 pyjapt/parsing.py delete mode 100755 pyjapt/serialization.py delete mode 100755 pyjapt/utils.py create mode 100644 requirements.txt diff --git a/cool.py b/cool.py index edecac21d..593257206 100644 --- a/cool.py +++ b/cool.py @@ -2,7 +2,7 @@ from lexertab import CoolLexer from parsertab import CoolParser -from semantics import (TypeCollector, TypeBuilder, OverriddenMethodChecker, TypeChecker, topological_ordering) +from semantics import TypeCollector, TypeBuilder, OverriddenMethodChecker, TypeChecker, topological_ordering from semantics.formatter import CodeBuilder from semantics.execution import Executor, ExecutionError from semantics.type_inference import InferenceChecker diff --git a/grammar.py b/grammar.py index f854e9cdc..24c4caad3 100644 --- a/grammar.py +++ b/grammar.py @@ -1,9 +1,9 @@ import inspect import time +from pyjapt import Grammar + from semantics.utils import astnodes as ast -from pyjapt.parsing import LALR1Parser -from pyjapt.grammar import Grammar G = Grammar() @@ -119,9 +119,9 @@ def tab(lexer): @G.lexical_error def lexical_error(lexer): - lexer.print_error(f'{lexer.lineno, lexer.column} -LexicographicError: ERROR "{lexer.token.lex}"') - lexer.column += 1 - lexer.position += 1 + lexer.add_error(f'{lexer.lineno, lexer.column} -LexicographicError: ERROR "{lexer.token.lex}"') + lexer.column += len(lexer.token.lex) + lexer.position += len(lexer.token.lex) ############### @@ -211,43 +211,42 @@ def lexical_error(lexer): @G.production("feature-list -> attribute error feature-list") def feature_attribute_error(s): - s.error(2, f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") + s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") return [s[1]] + s[3] @G.production("feature-list -> method error feature-list") def feature_method_error(s): - s.error(2, f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") + s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") return [s[1]] + s[3] @G.production("case-list -> id : type => expr error") def case_list_error(s): - s.error(6, f"{s[6].line, s[6].column} - SyntacticError: Expected ';' instead of '{s[6].lex}'") + s.add_error(6, f"{s[6].line, s[6].column} - SyntacticError: Expected ';' instead of '{s[6].lex}'") return [(s[1], s[3], s[5])] @G.production("case-list -> id : type => expr error case-list") def case_list_error(s): - s.error(6, f"{s[6].line, s[6].column} - SyntacticError: Expected ';' instead of '{s[6].lex}'") + s.add_error(6, f"{s[6].line, s[6].column} - SyntacticError: Expected ';' instead of '{s[6].lex}'") return [(s[1], s[3], s[5])] + s[7] @G.production("block -> expr error") def block_single_error(s): - s.error(2, f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") + s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") return [s[1]] @G.production("block -> expr error block") def block_single_error(s): - s.error(2, f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") + s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") return [s[1]] + s[3] if __name__ == '__main__': t = time.time() - print() G.serialize_lexer('CoolLexer', inspect.getmodulename(__file__)) - G.serialize_parser(LALR1Parser(G), 'CoolParser', inspect.getmodulename(__file__)) + G.serialize_parser('lalr1', 'CoolParser', inspect.getmodulename(__file__)) print('Serialization Time :', time.time() - t, 'seconds') diff --git a/lexertab.py b/lexertab.py index d1c480735..2d007f6f6 100644 --- a/lexertab.py +++ b/lexertab.py @@ -1,6 +1,6 @@ import re -from pyjapt.lexing import Token, Lexer +from pyjapt import Token, Lexer from grammar import G diff --git a/parsertab.py b/parsertab.py index 6595ab584..3ac34473c 100644 --- a/parsertab.py +++ b/parsertab.py @@ -1,11 +1,11 @@ from abc import ABC -from pyjapt.parsing import ShiftReduceParser +from pyjapt import ShiftReduceParser from grammar import G class CoolParser(ShiftReduceParser, ABC): def __init__(self, verbose=False): - self.G = G + self.grammar = G self.verbose = verbose self.action = self.__action_table() self.goto = self.__goto_table() @@ -27,809 +27,809 @@ def __action_table(): (6, G[":"]): ("SHIFT", 7), (7, G["type"]): ("SHIFT", 8), (8, G["{"]): ("SHIFT", 9), - (9, G["case"]): ("SHIFT", 21), - (9, G["true"]): ("SHIFT", 25), - (9, G["new"]): ("SHIFT", 22), - (9, G["string"]): ("SHIFT", 33), - (9, G["id"]): ("SHIFT", 31), - (9, G["not"]): ("SHIFT", 30), - (9, G["let"]): ("SHIFT", 14), (9, G["{"]): ("SHIFT", 10), - (9, G["("]): ("SHIFT", 11), + (9, G["id"]): ("SHIFT", 31), + (9, G["isvoid"]): ("SHIFT", 24), + (9, G["string"]): ("SHIFT", 33), (9, G["false"]): ("SHIFT", 26), - (9, G["if"]): ("SHIFT", 12), + (9, G["true"]): ("SHIFT", 25), (9, G["while"]): ("SHIFT", 13), - (9, G["int"]): ("SHIFT", 34), - (9, G["isvoid"]): ("SHIFT", 24), + (9, G["if"]): ("SHIFT", 12), + (9, G["not"]): ("SHIFT", 30), (9, G["~"]): ("SHIFT", 27), + (9, G["int"]): ("SHIFT", 34), + (9, G["let"]): ("SHIFT", 14), + (9, G["case"]): ("SHIFT", 21), + (9, G["("]): ("SHIFT", 11), + (9, G["new"]): ("SHIFT", 22), (10, G["id"]): ("SHIFT", 31), (10, G["while"]): ("SHIFT", 13), - (10, G["string"]): ("SHIFT", 33), - (10, G["not"]): ("SHIFT", 30), - (10, G["new"]): ("SHIFT", 22), - (10, G["let"]): ("SHIFT", 14), - (10, G["true"]): ("SHIFT", 25), - (10, G["isvoid"]): ("SHIFT", 24), (10, G["if"]): ("SHIFT", 12), (10, G["int"]): ("SHIFT", 34), - (10, G["false"]): ("SHIFT", 26), + (10, G["not"]): ("SHIFT", 30), (10, G["("]): ("SHIFT", 11), - (10, G["{"]): ("SHIFT", 10), - (10, G["case"]): ("SHIFT", 21), + (10, G["let"]): ("SHIFT", 14), (10, G["~"]): ("SHIFT", 27), - (11, G["int"]): ("SHIFT", 34), - (11, G["case"]): ("SHIFT", 21), - (11, G["("]): ("SHIFT", 11), + (10, G["case"]): ("SHIFT", 21), + (10, G["new"]): ("SHIFT", 22), + (10, G["{"]): ("SHIFT", 10), + (10, G["string"]): ("SHIFT", 33), + (10, G["false"]): ("SHIFT", 26), + (10, G["true"]): ("SHIFT", 25), + (10, G["isvoid"]): ("SHIFT", 24), (11, G["{"]): ("SHIFT", 10), - (11, G["false"]): ("SHIFT", 26), - (11, G["~"]): ("SHIFT", 27), (11, G["id"]): ("SHIFT", 31), - (11, G["if"]): ("SHIFT", 12), + (11, G["string"]): ("SHIFT", 33), + (11, G["false"]): ("SHIFT", 26), (11, G["isvoid"]): ("SHIFT", 24), (11, G["true"]): ("SHIFT", 25), - (11, G["string"]): ("SHIFT", 33), + (11, G["int"]): ("SHIFT", 34), + (11, G["~"]): ("SHIFT", 27), + (11, G["("]): ("SHIFT", 11), + (11, G["while"]): ("SHIFT", 13), + (11, G["if"]): ("SHIFT", 12), (11, G["not"]): ("SHIFT", 30), - (11, G["let"]): ("SHIFT", 14), (11, G["new"]): ("SHIFT", 22), - (11, G["while"]): ("SHIFT", 13), + (11, G["let"]): ("SHIFT", 14), + (11, G["case"]): ("SHIFT", 21), + (12, G["int"]): ("SHIFT", 34), + (12, G["("]): ("SHIFT", 11), + (12, G["{"]): ("SHIFT", 10), (12, G["id"]): ("SHIFT", 31), - (12, G["string"]): ("SHIFT", 33), + (12, G["new"]): ("SHIFT", 22), + (12, G["isvoid"]): ("SHIFT", 24), + (12, G["while"]): ("SHIFT", 13), (12, G["if"]): ("SHIFT", 12), + (12, G["string"]): ("SHIFT", 33), + (12, G["false"]): ("SHIFT", 26), (12, G["not"]): ("SHIFT", 30), (12, G["let"]): ("SHIFT", 14), - (12, G["new"]): ("SHIFT", 22), - (12, G["true"]): ("SHIFT", 25), - (12, G["case"]): ("SHIFT", 21), (12, G["~"]): ("SHIFT", 27), - (12, G["while"]): ("SHIFT", 13), - (12, G["isvoid"]): ("SHIFT", 24), - (12, G["int"]): ("SHIFT", 34), - (12, G["false"]): ("SHIFT", 26), - (12, G["("]): ("SHIFT", 11), - (12, G["{"]): ("SHIFT", 10), - (13, G["~"]): ("SHIFT", 27), - (13, G["new"]): ("SHIFT", 22), - (13, G["false"]): ("SHIFT", 26), - (13, G["id"]): ("SHIFT", 31), + (12, G["case"]): ("SHIFT", 21), + (12, G["true"]): ("SHIFT", 25), + (13, G["while"]): ("SHIFT", 13), + (13, G["if"]): ("SHIFT", 12), (13, G["isvoid"]): ("SHIFT", 24), - (13, G["int"]): ("SHIFT", 34), - (13, G["case"]): ("SHIFT", 21), + (13, G["not"]): ("SHIFT", 30), (13, G["let"]): ("SHIFT", 14), + (13, G["string"]): ("SHIFT", 33), + (13, G["false"]): ("SHIFT", 26), + (13, G["case"]): ("SHIFT", 21), + (13, G["~"]): ("SHIFT", 27), + (13, G["id"]): ("SHIFT", 31), (13, G["true"]): ("SHIFT", 25), - (13, G["not"]): ("SHIFT", 30), + (13, G["int"]): ("SHIFT", 34), (13, G["{"]): ("SHIFT", 10), - (13, G["string"]): ("SHIFT", 33), - (13, G["if"]): ("SHIFT", 12), - (13, G["while"]): ("SHIFT", 13), (13, G["("]): ("SHIFT", 11), + (13, G["new"]): ("SHIFT", 22), (14, G["id"]): ("SHIFT", 15), (15, G[":"]): ("SHIFT", 16), (16, G["type"]): ("SHIFT", 17), + (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), (17, G["<-"]): ("SHIFT", 20), (17, G[","]): ("SHIFT", 18), - (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), (18, G["id"]): ("SHIFT", 15), (19, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), - (20, G["id"]): ("SHIFT", 31), (20, G["while"]): ("SHIFT", 13), (20, G["if"]): ("SHIFT", 12), + (20, G["string"]): ("SHIFT", 33), + (20, G["false"]): ("SHIFT", 26), (20, G["not"]): ("SHIFT", 30), - (20, G["new"]): ("SHIFT", 22), (20, G["let"]): ("SHIFT", 14), - (20, G["false"]): ("SHIFT", 26), - (20, G["("]): ("SHIFT", 11), - (20, G["{"]): ("SHIFT", 10), - (20, G["case"]): ("SHIFT", 21), (20, G["isvoid"]): ("SHIFT", 24), + (20, G["id"]): ("SHIFT", 31), + (20, G["true"]): ("SHIFT", 25), + (20, G["case"]): ("SHIFT", 21), (20, G["int"]): ("SHIFT", 34), - (20, G["string"]): ("SHIFT", 33), (20, G["~"]): ("SHIFT", 27), - (20, G["true"]): ("SHIFT", 25), + (20, G["("]): ("SHIFT", 11), + (20, G["{"]): ("SHIFT", 10), + (20, G["new"]): ("SHIFT", 22), (21, G["let"]): ("SHIFT", 14), - (21, G["not"]): ("SHIFT", 30), - (21, G["~"]): ("SHIFT", 27), - (21, G["if"]): ("SHIFT", 12), - (21, G["while"]): ("SHIFT", 13), - (21, G["true"]): ("SHIFT", 25), - (21, G["new"]): ("SHIFT", 22), - (21, G["string"]): ("SHIFT", 33), (21, G["id"]): ("SHIFT", 31), - (21, G["isvoid"]): ("SHIFT", 24), - (21, G["("]): ("SHIFT", 11), - (21, G["false"]): ("SHIFT", 26), + (21, G["true"]): ("SHIFT", 25), (21, G["case"]): ("SHIFT", 21), (21, G["int"]): ("SHIFT", 34), + (21, G["isvoid"]): ("SHIFT", 24), + (21, G["("]): ("SHIFT", 11), (21, G["{"]): ("SHIFT", 10), + (21, G["new"]): ("SHIFT", 22), + (21, G["~"]): ("SHIFT", 27), + (21, G["while"]): ("SHIFT", 13), + (21, G["if"]): ("SHIFT", 12), + (21, G["string"]): ("SHIFT", 33), + (21, G["false"]): ("SHIFT", 26), + (21, G["not"]): ("SHIFT", 30), (22, G["type"]): ("SHIFT", 23), - (23, G[","]): ("REDUCE", G["atom -> new type"]), - (23, G["in"]): ("REDUCE", G["atom -> new type"]), - (23, G["then"]): ("REDUCE", G["atom -> new type"]), - (23, G[";"]): ("REDUCE", G["atom -> new type"]), - (23, G["+"]): ("REDUCE", G["atom -> new type"]), - (23, G["@"]): ("REDUCE", G["atom -> new type"]), - (23, G["else"]): ("REDUCE", G["atom -> new type"]), (23, G["of"]): ("REDUCE", G["atom -> new type"]), - (23, G["-"]): ("REDUCE", G["atom -> new type"]), - (23, G["fi"]): ("REDUCE", G["atom -> new type"]), - (23, G["*"]): ("REDUCE", G["atom -> new type"]), - (23, G["/"]): ("REDUCE", G["atom -> new type"]), - (23, G["}"]): ("REDUCE", G["atom -> new type"]), (23, G["<"]): ("REDUCE", G["atom -> new type"]), - (23, G["loop"]): ("REDUCE", G["atom -> new type"]), + (23, G[")"]): ("REDUCE", G["atom -> new type"]), + (23, G["/"]): ("REDUCE", G["atom -> new type"]), + (23, G["then"]): ("REDUCE", G["atom -> new type"]), (23, G["<="]): ("REDUCE", G["atom -> new type"]), + (23, G["."]): ("REDUCE", G["atom -> new type"]), + (23, G["else"]): ("REDUCE", G["atom -> new type"]), (23, G["="]): ("REDUCE", G["atom -> new type"]), + (23, G[","]): ("REDUCE", G["atom -> new type"]), + (23, G["fi"]): ("REDUCE", G["atom -> new type"]), + (23, G[";"]): ("REDUCE", G["atom -> new type"]), + (23, G["loop"]): ("REDUCE", G["atom -> new type"]), + (23, G["@"]): ("REDUCE", G["atom -> new type"]), (23, G["pool"]): ("REDUCE", G["atom -> new type"]), - (23, G[")"]): ("REDUCE", G["atom -> new type"]), + (23, G["+"]): ("REDUCE", G["atom -> new type"]), + (23, G["-"]): ("REDUCE", G["atom -> new type"]), + (23, G["in"]): ("REDUCE", G["atom -> new type"]), + (23, G["*"]): ("REDUCE", G["atom -> new type"]), (23, G["error"]): ("REDUCE", G["atom -> new type"]), - (23, G["."]): ("REDUCE", G["atom -> new type"]), - (24, G["isvoid"]): ("SHIFT", 24), - (24, G["("]): ("SHIFT", 11), + (23, G["}"]): ("REDUCE", G["atom -> new type"]), (24, G["int"]): ("SHIFT", 34), - (24, G["id"]): ("SHIFT", 28), - (24, G["string"]): ("SHIFT", 33), (24, G["~"]): ("SHIFT", 27), - (24, G["false"]): ("SHIFT", 26), (24, G["new"]): ("SHIFT", 22), + (24, G["id"]): ("SHIFT", 28), + (24, G["isvoid"]): ("SHIFT", 24), (24, G["true"]): ("SHIFT", 25), - (25, G[","]): ("REDUCE", G["atom -> true"]), - (25, G["in"]): ("REDUCE", G["atom -> true"]), - (25, G["then"]): ("REDUCE", G["atom -> true"]), - (25, G[";"]): ("REDUCE", G["atom -> true"]), - (25, G["+"]): ("REDUCE", G["atom -> true"]), - (25, G["@"]): ("REDUCE", G["atom -> true"]), - (25, G["else"]): ("REDUCE", G["atom -> true"]), + (24, G["("]): ("SHIFT", 11), + (24, G["string"]): ("SHIFT", 33), + (24, G["false"]): ("SHIFT", 26), (25, G["of"]): ("REDUCE", G["atom -> true"]), - (25, G["-"]): ("REDUCE", G["atom -> true"]), - (25, G["fi"]): ("REDUCE", G["atom -> true"]), - (25, G["*"]): ("REDUCE", G["atom -> true"]), - (25, G["/"]): ("REDUCE", G["atom -> true"]), - (25, G["}"]): ("REDUCE", G["atom -> true"]), (25, G["<"]): ("REDUCE", G["atom -> true"]), - (25, G["loop"]): ("REDUCE", G["atom -> true"]), + (25, G[")"]): ("REDUCE", G["atom -> true"]), + (25, G["/"]): ("REDUCE", G["atom -> true"]), + (25, G["then"]): ("REDUCE", G["atom -> true"]), (25, G["<="]): ("REDUCE", G["atom -> true"]), + (25, G["."]): ("REDUCE", G["atom -> true"]), + (25, G["else"]): ("REDUCE", G["atom -> true"]), (25, G["="]): ("REDUCE", G["atom -> true"]), + (25, G[","]): ("REDUCE", G["atom -> true"]), + (25, G["fi"]): ("REDUCE", G["atom -> true"]), + (25, G[";"]): ("REDUCE", G["atom -> true"]), + (25, G["loop"]): ("REDUCE", G["atom -> true"]), + (25, G["@"]): ("REDUCE", G["atom -> true"]), (25, G["pool"]): ("REDUCE", G["atom -> true"]), - (25, G[")"]): ("REDUCE", G["atom -> true"]), + (25, G["+"]): ("REDUCE", G["atom -> true"]), + (25, G["-"]): ("REDUCE", G["atom -> true"]), + (25, G["in"]): ("REDUCE", G["atom -> true"]), + (25, G["*"]): ("REDUCE", G["atom -> true"]), (25, G["error"]): ("REDUCE", G["atom -> true"]), - (25, G["."]): ("REDUCE", G["atom -> true"]), - (26, G[","]): ("REDUCE", G["atom -> false"]), - (26, G["in"]): ("REDUCE", G["atom -> false"]), - (26, G["then"]): ("REDUCE", G["atom -> false"]), - (26, G[";"]): ("REDUCE", G["atom -> false"]), - (26, G["+"]): ("REDUCE", G["atom -> false"]), - (26, G["@"]): ("REDUCE", G["atom -> false"]), - (26, G["else"]): ("REDUCE", G["atom -> false"]), + (25, G["}"]): ("REDUCE", G["atom -> true"]), (26, G["of"]): ("REDUCE", G["atom -> false"]), - (26, G["-"]): ("REDUCE", G["atom -> false"]), - (26, G["fi"]): ("REDUCE", G["atom -> false"]), - (26, G["*"]): ("REDUCE", G["atom -> false"]), - (26, G["/"]): ("REDUCE", G["atom -> false"]), - (26, G["}"]): ("REDUCE", G["atom -> false"]), (26, G["<"]): ("REDUCE", G["atom -> false"]), - (26, G["loop"]): ("REDUCE", G["atom -> false"]), + (26, G[")"]): ("REDUCE", G["atom -> false"]), + (26, G["/"]): ("REDUCE", G["atom -> false"]), + (26, G["then"]): ("REDUCE", G["atom -> false"]), (26, G["<="]): ("REDUCE", G["atom -> false"]), + (26, G["."]): ("REDUCE", G["atom -> false"]), + (26, G["else"]): ("REDUCE", G["atom -> false"]), (26, G["="]): ("REDUCE", G["atom -> false"]), + (26, G[","]): ("REDUCE", G["atom -> false"]), + (26, G["fi"]): ("REDUCE", G["atom -> false"]), + (26, G[";"]): ("REDUCE", G["atom -> false"]), + (26, G["loop"]): ("REDUCE", G["atom -> false"]), + (26, G["@"]): ("REDUCE", G["atom -> false"]), (26, G["pool"]): ("REDUCE", G["atom -> false"]), - (26, G[")"]): ("REDUCE", G["atom -> false"]), + (26, G["+"]): ("REDUCE", G["atom -> false"]), + (26, G["-"]): ("REDUCE", G["atom -> false"]), + (26, G["in"]): ("REDUCE", G["atom -> false"]), + (26, G["*"]): ("REDUCE", G["atom -> false"]), (26, G["error"]): ("REDUCE", G["atom -> false"]), - (26, G["."]): ("REDUCE", G["atom -> false"]), - (27, G["isvoid"]): ("SHIFT", 24), - (27, G["("]): ("SHIFT", 11), + (26, G["}"]): ("REDUCE", G["atom -> false"]), (27, G["int"]): ("SHIFT", 34), - (27, G["id"]): ("SHIFT", 28), - (27, G["string"]): ("SHIFT", 33), (27, G["~"]): ("SHIFT", 27), - (27, G["false"]): ("SHIFT", 26), (27, G["new"]): ("SHIFT", 22), + (27, G["string"]): ("SHIFT", 33), + (27, G["id"]): ("SHIFT", 28), + (27, G["isvoid"]): ("SHIFT", 24), (27, G["true"]): ("SHIFT", 25), - (28, G[","]): ("REDUCE", G["atom -> id"]), - (28, G["in"]): ("REDUCE", G["atom -> id"]), - (28, G["then"]): ("REDUCE", G["atom -> id"]), - (28, G[";"]): ("REDUCE", G["atom -> id"]), - (28, G["+"]): ("REDUCE", G["atom -> id"]), - (28, G["@"]): ("REDUCE", G["atom -> id"]), - (28, G["else"]): ("REDUCE", G["atom -> id"]), + (27, G["("]): ("SHIFT", 11), + (27, G["false"]): ("SHIFT", 26), (28, G["of"]): ("REDUCE", G["atom -> id"]), - (28, G["-"]): ("REDUCE", G["atom -> id"]), - (28, G["fi"]): ("REDUCE", G["atom -> id"]), - (28, G["*"]): ("REDUCE", G["atom -> id"]), - (28, G["/"]): ("REDUCE", G["atom -> id"]), - (28, G["}"]): ("REDUCE", G["atom -> id"]), (28, G["<"]): ("REDUCE", G["atom -> id"]), - (28, G["loop"]): ("REDUCE", G["atom -> id"]), + (28, G[")"]): ("REDUCE", G["atom -> id"]), + (28, G["/"]): ("REDUCE", G["atom -> id"]), + (28, G["then"]): ("REDUCE", G["atom -> id"]), (28, G["<="]): ("REDUCE", G["atom -> id"]), + (28, G["."]): ("REDUCE", G["atom -> id"]), + (28, G["else"]): ("REDUCE", G["atom -> id"]), (28, G["="]): ("REDUCE", G["atom -> id"]), + (28, G[","]): ("REDUCE", G["atom -> id"]), + (28, G["fi"]): ("REDUCE", G["atom -> id"]), + (28, G[";"]): ("REDUCE", G["atom -> id"]), + (28, G["loop"]): ("REDUCE", G["atom -> id"]), + (28, G["@"]): ("REDUCE", G["atom -> id"]), (28, G["pool"]): ("REDUCE", G["atom -> id"]), - (28, G[")"]): ("REDUCE", G["atom -> id"]), + (28, G["+"]): ("REDUCE", G["atom -> id"]), + (28, G["-"]): ("REDUCE", G["atom -> id"]), + (28, G["in"]): ("REDUCE", G["atom -> id"]), + (28, G["*"]): ("REDUCE", G["atom -> id"]), (28, G["error"]): ("REDUCE", G["atom -> id"]), - (28, G["."]): ("REDUCE", G["atom -> id"]), + (28, G["}"]): ("REDUCE", G["atom -> id"]), (28, G["("]): ("SHIFT", 29), - (29, G["false"]): ("SHIFT", 26), - (29, G["~"]): ("SHIFT", 27), + (29, G["int"]): ("SHIFT", 34), + (29, G["while"]): ("SHIFT", 13), + (29, G["if"]): ("SHIFT", 12), + (29, G["not"]): ("SHIFT", 30), + (29, G["("]): ("SHIFT", 11), + (29, G["let"]): ("SHIFT", 14), + (29, G[")"]): ("REDUCE", G["expr-list -> e"]), (29, G["new"]): ("SHIFT", 22), - (29, G["isvoid"]): ("SHIFT", 24), - (29, G["id"]): ("SHIFT", 31), (29, G["case"]): ("SHIFT", 21), - (29, G["true"]): ("SHIFT", 25), (29, G["{"]): ("SHIFT", 10), + (29, G["isvoid"]): ("SHIFT", 24), + (29, G["id"]): ("SHIFT", 31), (29, G["string"]): ("SHIFT", 33), - (29, G["not"]): ("SHIFT", 30), - (29, G["let"]): ("SHIFT", 14), - (29, G["if"]): ("SHIFT", 12), - (29, G["int"]): ("SHIFT", 34), - (29, G["while"]): ("SHIFT", 13), - (29, G[")"]): ("REDUCE", G["expr-list -> e"]), - (29, G["("]): ("SHIFT", 11), - (30, G["string"]): ("SHIFT", 33), - (30, G["isvoid"]): ("SHIFT", 24), - (30, G["case"]): ("SHIFT", 21), + (29, G["false"]): ("SHIFT", 26), + (29, G["true"]): ("SHIFT", 25), + (29, G["~"]): ("SHIFT", 27), (30, G["int"]): ("SHIFT", 34), - (30, G["{"]): ("SHIFT", 10), - (30, G["let"]): ("SHIFT", 14), (30, G["("]): ("SHIFT", 11), - (30, G["not"]): ("SHIFT", 30), - (30, G["if"]): ("SHIFT", 12), - (30, G["~"]): ("SHIFT", 27), - (30, G["while"]): ("SHIFT", 13), - (30, G["false"]): ("SHIFT", 26), (30, G["new"]): ("SHIFT", 22), + (30, G["while"]): ("SHIFT", 13), + (30, G["if"]): ("SHIFT", 12), + (30, G["isvoid"]): ("SHIFT", 24), + (30, G["not"]): ("SHIFT", 30), + (30, G["let"]): ("SHIFT", 14), (30, G["id"]): ("SHIFT", 31), + (30, G["case"]): ("SHIFT", 21), + (30, G["string"]): ("SHIFT", 33), + (30, G["false"]): ("SHIFT", 26), + (30, G["~"]): ("SHIFT", 27), (30, G["true"]): ("SHIFT", 25), - (31, G[","]): ("REDUCE", G["atom -> id"]), - (31, G["in"]): ("REDUCE", G["atom -> id"]), + (30, G["{"]): ("SHIFT", 10), + (31, G["of"]): ("REDUCE", G["atom -> id"]), + (31, G["<"]): ("REDUCE", G["atom -> id"]), + (31, G[")"]): ("REDUCE", G["atom -> id"]), + (31, G["/"]): ("REDUCE", G["atom -> id"]), (31, G["then"]): ("REDUCE", G["atom -> id"]), + (31, G["<="]): ("REDUCE", G["atom -> id"]), + (31, G["."]): ("REDUCE", G["atom -> id"]), + (31, G["else"]): ("REDUCE", G["atom -> id"]), + (31, G["="]): ("REDUCE", G["atom -> id"]), + (31, G[","]): ("REDUCE", G["atom -> id"]), + (31, G["fi"]): ("REDUCE", G["atom -> id"]), (31, G[";"]): ("REDUCE", G["atom -> id"]), + (31, G["loop"]): ("REDUCE", G["atom -> id"]), (31, G["@"]): ("REDUCE", G["atom -> id"]), + (31, G["pool"]): ("REDUCE", G["atom -> id"]), (31, G["+"]): ("REDUCE", G["atom -> id"]), - (31, G["else"]): ("REDUCE", G["atom -> id"]), - (31, G["of"]): ("REDUCE", G["atom -> id"]), (31, G["-"]): ("REDUCE", G["atom -> id"]), - (31, G["fi"]): ("REDUCE", G["atom -> id"]), + (31, G["in"]): ("REDUCE", G["atom -> id"]), (31, G["*"]): ("REDUCE", G["atom -> id"]), - (31, G["/"]): ("REDUCE", G["atom -> id"]), - (31, G["}"]): ("REDUCE", G["atom -> id"]), - (31, G["<"]): ("REDUCE", G["atom -> id"]), - (31, G["loop"]): ("REDUCE", G["atom -> id"]), - (31, G["<="]): ("REDUCE", G["atom -> id"]), - (31, G["="]): ("REDUCE", G["atom -> id"]), - (31, G["pool"]): ("REDUCE", G["atom -> id"]), - (31, G[")"]): ("REDUCE", G["atom -> id"]), (31, G["error"]): ("REDUCE", G["atom -> id"]), - (31, G["."]): ("REDUCE", G["atom -> id"]), + (31, G["}"]): ("REDUCE", G["atom -> id"]), (31, G["<-"]): ("SHIFT", 32), (31, G["("]): ("SHIFT", 29), - (32, G["string"]): ("SHIFT", 33), - (32, G["isvoid"]): ("SHIFT", 24), - (32, G["case"]): ("SHIFT", 21), (32, G["int"]): ("SHIFT", 34), - (32, G["{"]): ("SHIFT", 10), - (32, G["let"]): ("SHIFT", 14), (32, G["("]): ("SHIFT", 11), - (32, G["not"]): ("SHIFT", 30), - (32, G["if"]): ("SHIFT", 12), - (32, G["~"]): ("SHIFT", 27), - (32, G["while"]): ("SHIFT", 13), - (32, G["false"]): ("SHIFT", 26), (32, G["new"]): ("SHIFT", 22), + (32, G["while"]): ("SHIFT", 13), + (32, G["if"]): ("SHIFT", 12), + (32, G["isvoid"]): ("SHIFT", 24), + (32, G["not"]): ("SHIFT", 30), + (32, G["let"]): ("SHIFT", 14), (32, G["id"]): ("SHIFT", 31), + (32, G["case"]): ("SHIFT", 21), + (32, G["string"]): ("SHIFT", 33), + (32, G["false"]): ("SHIFT", 26), + (32, G["~"]): ("SHIFT", 27), (32, G["true"]): ("SHIFT", 25), - (33, G[","]): ("REDUCE", G["atom -> string"]), - (33, G["in"]): ("REDUCE", G["atom -> string"]), + (32, G["{"]): ("SHIFT", 10), + (33, G["of"]): ("REDUCE", G["atom -> string"]), + (33, G["<"]): ("REDUCE", G["atom -> string"]), + (33, G[")"]): ("REDUCE", G["atom -> string"]), + (33, G["/"]): ("REDUCE", G["atom -> string"]), (33, G["then"]): ("REDUCE", G["atom -> string"]), + (33, G["<="]): ("REDUCE", G["atom -> string"]), + (33, G["."]): ("REDUCE", G["atom -> string"]), + (33, G["else"]): ("REDUCE", G["atom -> string"]), + (33, G["="]): ("REDUCE", G["atom -> string"]), + (33, G[","]): ("REDUCE", G["atom -> string"]), + (33, G["fi"]): ("REDUCE", G["atom -> string"]), (33, G[";"]): ("REDUCE", G["atom -> string"]), + (33, G["loop"]): ("REDUCE", G["atom -> string"]), (33, G["@"]): ("REDUCE", G["atom -> string"]), + (33, G["pool"]): ("REDUCE", G["atom -> string"]), (33, G["+"]): ("REDUCE", G["atom -> string"]), - (33, G["else"]): ("REDUCE", G["atom -> string"]), - (33, G["of"]): ("REDUCE", G["atom -> string"]), (33, G["-"]): ("REDUCE", G["atom -> string"]), - (33, G["fi"]): ("REDUCE", G["atom -> string"]), + (33, G["in"]): ("REDUCE", G["atom -> string"]), (33, G["*"]): ("REDUCE", G["atom -> string"]), - (33, G["/"]): ("REDUCE", G["atom -> string"]), - (33, G["}"]): ("REDUCE", G["atom -> string"]), - (33, G["<"]): ("REDUCE", G["atom -> string"]), - (33, G["loop"]): ("REDUCE", G["atom -> string"]), - (33, G["<="]): ("REDUCE", G["atom -> string"]), - (33, G["="]): ("REDUCE", G["atom -> string"]), - (33, G["pool"]): ("REDUCE", G["atom -> string"]), - (33, G[")"]): ("REDUCE", G["atom -> string"]), (33, G["error"]): ("REDUCE", G["atom -> string"]), - (33, G["."]): ("REDUCE", G["atom -> string"]), - (34, G[","]): ("REDUCE", G["atom -> int"]), - (34, G["in"]): ("REDUCE", G["atom -> int"]), - (34, G["then"]): ("REDUCE", G["atom -> int"]), - (34, G[";"]): ("REDUCE", G["atom -> int"]), - (34, G["+"]): ("REDUCE", G["atom -> int"]), - (34, G["@"]): ("REDUCE", G["atom -> int"]), - (34, G["else"]): ("REDUCE", G["atom -> int"]), + (33, G["}"]): ("REDUCE", G["atom -> string"]), (34, G["of"]): ("REDUCE", G["atom -> int"]), - (34, G["-"]): ("REDUCE", G["atom -> int"]), - (34, G["fi"]): ("REDUCE", G["atom -> int"]), - (34, G["*"]): ("REDUCE", G["atom -> int"]), - (34, G["/"]): ("REDUCE", G["atom -> int"]), - (34, G["}"]): ("REDUCE", G["atom -> int"]), (34, G["<"]): ("REDUCE", G["atom -> int"]), - (34, G["loop"]): ("REDUCE", G["atom -> int"]), + (34, G[")"]): ("REDUCE", G["atom -> int"]), + (34, G["/"]): ("REDUCE", G["atom -> int"]), + (34, G["then"]): ("REDUCE", G["atom -> int"]), (34, G["<="]): ("REDUCE", G["atom -> int"]), + (34, G["."]): ("REDUCE", G["atom -> int"]), + (34, G["else"]): ("REDUCE", G["atom -> int"]), (34, G["="]): ("REDUCE", G["atom -> int"]), + (34, G[","]): ("REDUCE", G["atom -> int"]), + (34, G["fi"]): ("REDUCE", G["atom -> int"]), + (34, G[";"]): ("REDUCE", G["atom -> int"]), + (34, G["loop"]): ("REDUCE", G["atom -> int"]), + (34, G["@"]): ("REDUCE", G["atom -> int"]), (34, G["pool"]): ("REDUCE", G["atom -> int"]), - (34, G[")"]): ("REDUCE", G["atom -> int"]), + (34, G["+"]): ("REDUCE", G["atom -> int"]), + (34, G["-"]): ("REDUCE", G["atom -> int"]), + (34, G["in"]): ("REDUCE", G["atom -> int"]), + (34, G["*"]): ("REDUCE", G["atom -> int"]), (34, G["error"]): ("REDUCE", G["atom -> int"]), - (34, G["."]): ("REDUCE", G["atom -> int"]), - (35, G[","]): ("REDUCE", G["atom -> function-call"]), - (35, G["in"]): ("REDUCE", G["atom -> function-call"]), - (35, G["then"]): ("REDUCE", G["atom -> function-call"]), - (35, G[";"]): ("REDUCE", G["atom -> function-call"]), - (35, G["+"]): ("REDUCE", G["atom -> function-call"]), - (35, G["@"]): ("REDUCE", G["atom -> function-call"]), - (35, G["else"]): ("REDUCE", G["atom -> function-call"]), + (34, G["}"]): ("REDUCE", G["atom -> int"]), (35, G["of"]): ("REDUCE", G["atom -> function-call"]), - (35, G["-"]): ("REDUCE", G["atom -> function-call"]), - (35, G["fi"]): ("REDUCE", G["atom -> function-call"]), - (35, G["*"]): ("REDUCE", G["atom -> function-call"]), - (35, G["/"]): ("REDUCE", G["atom -> function-call"]), - (35, G["}"]): ("REDUCE", G["atom -> function-call"]), (35, G["<"]): ("REDUCE", G["atom -> function-call"]), - (35, G["loop"]): ("REDUCE", G["atom -> function-call"]), + (35, G[")"]): ("REDUCE", G["atom -> function-call"]), + (35, G["/"]): ("REDUCE", G["atom -> function-call"]), + (35, G["then"]): ("REDUCE", G["atom -> function-call"]), (35, G["<="]): ("REDUCE", G["atom -> function-call"]), + (35, G["."]): ("REDUCE", G["atom -> function-call"]), + (35, G["else"]): ("REDUCE", G["atom -> function-call"]), (35, G["="]): ("REDUCE", G["atom -> function-call"]), + (35, G[","]): ("REDUCE", G["atom -> function-call"]), + (35, G["fi"]): ("REDUCE", G["atom -> function-call"]), + (35, G[";"]): ("REDUCE", G["atom -> function-call"]), + (35, G["loop"]): ("REDUCE", G["atom -> function-call"]), + (35, G["@"]): ("REDUCE", G["atom -> function-call"]), (35, G["pool"]): ("REDUCE", G["atom -> function-call"]), - (35, G[")"]): ("REDUCE", G["atom -> function-call"]), + (35, G["+"]): ("REDUCE", G["atom -> function-call"]), + (35, G["-"]): ("REDUCE", G["atom -> function-call"]), + (35, G["in"]): ("REDUCE", G["atom -> function-call"]), + (35, G["*"]): ("REDUCE", G["atom -> function-call"]), (35, G["error"]): ("REDUCE", G["atom -> function-call"]), - (35, G["."]): ("REDUCE", G["atom -> function-call"]), - (36, G["}"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["in"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), + (35, G["}"]): ("REDUCE", G["atom -> function-call"]), (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["else"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), - (37, G["}"]): ("REDUCE", G["expr -> comp"]), - (37, G["in"]): ("REDUCE", G["expr -> comp"]), - (37, G[","]): ("REDUCE", G["expr -> comp"]), - (37, G["error"]): ("REDUCE", G["expr -> comp"]), - (37, G["then"]): ("REDUCE", G["expr -> comp"]), - (37, G["loop"]): ("REDUCE", G["expr -> comp"]), + (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["in"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["}"]): ("REDUCE", G["expr -> id <- expr"]), (37, G[";"]): ("REDUCE", G["expr -> comp"]), - (37, G[")"]): ("REDUCE", G["expr -> comp"]), (37, G["of"]): ("REDUCE", G["expr -> comp"]), + (37, G["loop"]): ("REDUCE", G["expr -> comp"]), + (37, G[")"]): ("REDUCE", G["expr -> comp"]), (37, G["pool"]): ("REDUCE", G["expr -> comp"]), + (37, G["then"]): ("REDUCE", G["expr -> comp"]), (37, G["else"]): ("REDUCE", G["expr -> comp"]), + (37, G[","]): ("REDUCE", G["expr -> comp"]), + (37, G["in"]): ("REDUCE", G["expr -> comp"]), (37, G["fi"]): ("REDUCE", G["expr -> comp"]), + (37, G["error"]): ("REDUCE", G["expr -> comp"]), + (37, G["}"]): ("REDUCE", G["expr -> comp"]), (38, G["<"]): ("SHIFT", 66), - (38, G["="]): ("SHIFT", 70), + (38, G["-"]): ("SHIFT", 64), (38, G["+"]): ("SHIFT", 39), + (38, G["="]): ("SHIFT", 70), (38, G["<="]): ("SHIFT", 68), - (38, G["}"]): ("REDUCE", G["comp -> arith"]), - (38, G["in"]): ("REDUCE", G["comp -> arith"]), - (38, G[","]): ("REDUCE", G["comp -> arith"]), - (38, G["error"]): ("REDUCE", G["comp -> arith"]), - (38, G["then"]): ("REDUCE", G["comp -> arith"]), - (38, G["loop"]): ("REDUCE", G["comp -> arith"]), (38, G[";"]): ("REDUCE", G["comp -> arith"]), - (38, G[")"]): ("REDUCE", G["comp -> arith"]), (38, G["of"]): ("REDUCE", G["comp -> arith"]), + (38, G["loop"]): ("REDUCE", G["comp -> arith"]), + (38, G[")"]): ("REDUCE", G["comp -> arith"]), (38, G["pool"]): ("REDUCE", G["comp -> arith"]), + (38, G["then"]): ("REDUCE", G["comp -> arith"]), (38, G["else"]): ("REDUCE", G["comp -> arith"]), + (38, G[","]): ("REDUCE", G["comp -> arith"]), + (38, G["in"]): ("REDUCE", G["comp -> arith"]), (38, G["fi"]): ("REDUCE", G["comp -> arith"]), - (38, G["-"]): ("SHIFT", 64), + (38, G["error"]): ("REDUCE", G["comp -> arith"]), + (38, G["}"]): ("REDUCE", G["comp -> arith"]), + (39, G["int"]): ("SHIFT", 34), (39, G["("]): ("SHIFT", 11), (39, G["string"]): ("SHIFT", 33), - (39, G["~"]): ("SHIFT", 27), (39, G["false"]): ("SHIFT", 26), + (39, G["~"]): ("SHIFT", 27), (39, G["new"]): ("SHIFT", 22), - (39, G["isvoid"]): ("SHIFT", 24), (39, G["id"]): ("SHIFT", 28), - (39, G["int"]): ("SHIFT", 34), (39, G["true"]): ("SHIFT", 25), - (40, G["/"]): ("SHIFT", 54), - (40, G[","]): ("REDUCE", G["arith -> arith + term"]), - (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["then"]): ("REDUCE", G["arith -> arith + term"]), - (40, G[";"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["+"]): ("REDUCE", G["arith -> arith + term"]), + (39, G["isvoid"]): ("SHIFT", 24), (40, G["of"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["else"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["fi"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), (40, G["<"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), + (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["then"]): ("REDUCE", G["arith -> arith + term"]), (40, G["<="]): ("REDUCE", G["arith -> arith + term"]), + (40, G["else"]): ("REDUCE", G["arith -> arith + term"]), (40, G["="]): ("REDUCE", G["arith -> arith + term"]), - (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), + (40, G[","]): ("REDUCE", G["arith -> arith + term"]), + (40, G["fi"]): ("REDUCE", G["arith -> arith + term"]), + (40, G[";"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["+"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), (40, G["*"]): ("SHIFT", 41), - (41, G["isvoid"]): ("SHIFT", 24), - (41, G["("]): ("SHIFT", 11), + (40, G["/"]): ("SHIFT", 54), (41, G["int"]): ("SHIFT", 34), - (41, G["string"]): ("SHIFT", 33), - (41, G["id"]): ("SHIFT", 28), (41, G["~"]): ("SHIFT", 27), - (41, G["false"]): ("SHIFT", 26), (41, G["new"]): ("SHIFT", 22), + (41, G["id"]): ("SHIFT", 28), + (41, G["isvoid"]): ("SHIFT", 24), (41, G["true"]): ("SHIFT", 25), - (42, G[","]): ("REDUCE", G["term -> term * factor"]), - (42, G["in"]): ("REDUCE", G["term -> term * factor"]), - (42, G["then"]): ("REDUCE", G["term -> term * factor"]), - (42, G[";"]): ("REDUCE", G["term -> term * factor"]), - (42, G["+"]): ("REDUCE", G["term -> term * factor"]), - (42, G["else"]): ("REDUCE", G["term -> term * factor"]), + (41, G["("]): ("SHIFT", 11), + (41, G["string"]): ("SHIFT", 33), + (41, G["false"]): ("SHIFT", 26), (42, G["of"]): ("REDUCE", G["term -> term * factor"]), - (42, G["-"]): ("REDUCE", G["term -> term * factor"]), - (42, G["fi"]): ("REDUCE", G["term -> term * factor"]), - (42, G["*"]): ("REDUCE", G["term -> term * factor"]), - (42, G["/"]): ("REDUCE", G["term -> term * factor"]), - (42, G["}"]): ("REDUCE", G["term -> term * factor"]), (42, G["<"]): ("REDUCE", G["term -> term * factor"]), - (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), + (42, G[")"]): ("REDUCE", G["term -> term * factor"]), + (42, G["/"]): ("REDUCE", G["term -> term * factor"]), + (42, G["then"]): ("REDUCE", G["term -> term * factor"]), (42, G["<="]): ("REDUCE", G["term -> term * factor"]), + (42, G["else"]): ("REDUCE", G["term -> term * factor"]), (42, G["="]): ("REDUCE", G["term -> term * factor"]), + (42, G[","]): ("REDUCE", G["term -> term * factor"]), + (42, G["fi"]): ("REDUCE", G["term -> term * factor"]), + (42, G[";"]): ("REDUCE", G["term -> term * factor"]), + (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), (42, G["pool"]): ("REDUCE", G["term -> term * factor"]), - (42, G[")"]): ("REDUCE", G["term -> term * factor"]), + (42, G["+"]): ("REDUCE", G["term -> term * factor"]), + (42, G["-"]): ("REDUCE", G["term -> term * factor"]), + (42, G["in"]): ("REDUCE", G["term -> term * factor"]), + (42, G["*"]): ("REDUCE", G["term -> term * factor"]), (42, G["error"]): ("REDUCE", G["term -> term * factor"]), - (43, G["@"]): ("SHIFT", 57), - (43, G[","]): ("REDUCE", G["factor -> atom"]), - (43, G["in"]): ("REDUCE", G["factor -> atom"]), - (43, G["then"]): ("REDUCE", G["factor -> atom"]), - (43, G[";"]): ("REDUCE", G["factor -> atom"]), - (43, G["+"]): ("REDUCE", G["factor -> atom"]), - (43, G["else"]): ("REDUCE", G["factor -> atom"]), + (42, G["}"]): ("REDUCE", G["term -> term * factor"]), (43, G["of"]): ("REDUCE", G["factor -> atom"]), - (43, G["-"]): ("REDUCE", G["factor -> atom"]), - (43, G["fi"]): ("REDUCE", G["factor -> atom"]), - (43, G["*"]): ("REDUCE", G["factor -> atom"]), - (43, G["/"]): ("REDUCE", G["factor -> atom"]), - (43, G["}"]): ("REDUCE", G["factor -> atom"]), (43, G["<"]): ("REDUCE", G["factor -> atom"]), - (43, G["loop"]): ("REDUCE", G["factor -> atom"]), + (43, G[")"]): ("REDUCE", G["factor -> atom"]), + (43, G["/"]): ("REDUCE", G["factor -> atom"]), + (43, G["then"]): ("REDUCE", G["factor -> atom"]), (43, G["<="]): ("REDUCE", G["factor -> atom"]), + (43, G["else"]): ("REDUCE", G["factor -> atom"]), (43, G["="]): ("REDUCE", G["factor -> atom"]), + (43, G[","]): ("REDUCE", G["factor -> atom"]), + (43, G["fi"]): ("REDUCE", G["factor -> atom"]), + (43, G[";"]): ("REDUCE", G["factor -> atom"]), + (43, G["loop"]): ("REDUCE", G["factor -> atom"]), (43, G["pool"]): ("REDUCE", G["factor -> atom"]), - (43, G[")"]): ("REDUCE", G["factor -> atom"]), + (43, G["+"]): ("REDUCE", G["factor -> atom"]), + (43, G["-"]): ("REDUCE", G["factor -> atom"]), + (43, G["in"]): ("REDUCE", G["factor -> atom"]), + (43, G["*"]): ("REDUCE", G["factor -> atom"]), (43, G["error"]): ("REDUCE", G["factor -> atom"]), + (43, G["}"]): ("REDUCE", G["factor -> atom"]), (43, G["."]): ("SHIFT", 44), + (43, G["@"]): ("SHIFT", 57), (44, G["id"]): ("SHIFT", 45), (45, G["("]): ("SHIFT", 46), - (46, G["false"]): ("SHIFT", 26), - (46, G["~"]): ("SHIFT", 27), + (46, G["int"]): ("SHIFT", 34), + (46, G["while"]): ("SHIFT", 13), + (46, G["if"]): ("SHIFT", 12), + (46, G["not"]): ("SHIFT", 30), + (46, G["("]): ("SHIFT", 11), + (46, G["let"]): ("SHIFT", 14), + (46, G[")"]): ("REDUCE", G["expr-list -> e"]), (46, G["new"]): ("SHIFT", 22), - (46, G["isvoid"]): ("SHIFT", 24), - (46, G["id"]): ("SHIFT", 31), (46, G["case"]): ("SHIFT", 21), - (46, G["true"]): ("SHIFT", 25), (46, G["{"]): ("SHIFT", 10), + (46, G["isvoid"]): ("SHIFT", 24), + (46, G["id"]): ("SHIFT", 31), (46, G["string"]): ("SHIFT", 33), - (46, G["not"]): ("SHIFT", 30), - (46, G["let"]): ("SHIFT", 14), - (46, G["if"]): ("SHIFT", 12), - (46, G["int"]): ("SHIFT", 34), - (46, G["while"]): ("SHIFT", 13), - (46, G[")"]): ("REDUCE", G["expr-list -> e"]), - (46, G["("]): ("SHIFT", 11), + (46, G["false"]): ("SHIFT", 26), + (46, G["true"]): ("SHIFT", 25), + (46, G["~"]): ("SHIFT", 27), (47, G[")"]): ("SHIFT", 48), - (48, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (49, G[")"]): ("REDUCE", G["expr-list -> not-empty-expr-list"]), (50, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), (50, G[","]): ("SHIFT", 51), - (51, G["false"]): ("SHIFT", 26), - (51, G["~"]): ("SHIFT", 27), + (51, G["int"]): ("SHIFT", 34), + (51, G["while"]): ("SHIFT", 13), + (51, G["if"]): ("SHIFT", 12), + (51, G["not"]): ("SHIFT", 30), + (51, G["("]): ("SHIFT", 11), + (51, G["let"]): ("SHIFT", 14), (51, G["new"]): ("SHIFT", 22), - (51, G["isvoid"]): ("SHIFT", 24), - (51, G["id"]): ("SHIFT", 31), (51, G["case"]): ("SHIFT", 21), - (51, G["true"]): ("SHIFT", 25), (51, G["{"]): ("SHIFT", 10), + (51, G["isvoid"]): ("SHIFT", 24), + (51, G["id"]): ("SHIFT", 31), (51, G["string"]): ("SHIFT", 33), - (51, G["not"]): ("SHIFT", 30), - (51, G["let"]): ("SHIFT", 14), - (51, G["if"]): ("SHIFT", 12), - (51, G["int"]): ("SHIFT", 34), - (51, G["while"]): ("SHIFT", 13), - (51, G["("]): ("SHIFT", 11), + (51, G["false"]): ("SHIFT", 26), + (51, G["true"]): ("SHIFT", 25), + (51, G["~"]): ("SHIFT", 27), (52, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr , not-empty-expr-list"]), - (53, G["/"]): ("SHIFT", 54), - (53, G[","]): ("REDUCE", G["arith -> term"]), - (53, G["in"]): ("REDUCE", G["arith -> term"]), - (53, G["then"]): ("REDUCE", G["arith -> term"]), - (53, G[";"]): ("REDUCE", G["arith -> term"]), - (53, G["+"]): ("REDUCE", G["arith -> term"]), (53, G["of"]): ("REDUCE", G["arith -> term"]), - (53, G["else"]): ("REDUCE", G["arith -> term"]), - (53, G["-"]): ("REDUCE", G["arith -> term"]), - (53, G["fi"]): ("REDUCE", G["arith -> term"]), - (53, G["}"]): ("REDUCE", G["arith -> term"]), (53, G["<"]): ("REDUCE", G["arith -> term"]), - (53, G["loop"]): ("REDUCE", G["arith -> term"]), + (53, G[")"]): ("REDUCE", G["arith -> term"]), + (53, G["then"]): ("REDUCE", G["arith -> term"]), (53, G["<="]): ("REDUCE", G["arith -> term"]), + (53, G["else"]): ("REDUCE", G["arith -> term"]), (53, G["="]): ("REDUCE", G["arith -> term"]), - (53, G[")"]): ("REDUCE", G["arith -> term"]), + (53, G[","]): ("REDUCE", G["arith -> term"]), + (53, G["fi"]): ("REDUCE", G["arith -> term"]), + (53, G[";"]): ("REDUCE", G["arith -> term"]), + (53, G["loop"]): ("REDUCE", G["arith -> term"]), (53, G["pool"]): ("REDUCE", G["arith -> term"]), + (53, G["+"]): ("REDUCE", G["arith -> term"]), + (53, G["-"]): ("REDUCE", G["arith -> term"]), + (53, G["in"]): ("REDUCE", G["arith -> term"]), (53, G["error"]): ("REDUCE", G["arith -> term"]), + (53, G["}"]): ("REDUCE", G["arith -> term"]), (53, G["*"]): ("SHIFT", 41), - (54, G["isvoid"]): ("SHIFT", 24), - (54, G["("]): ("SHIFT", 11), + (53, G["/"]): ("SHIFT", 54), (54, G["int"]): ("SHIFT", 34), - (54, G["id"]): ("SHIFT", 28), - (54, G["string"]): ("SHIFT", 33), (54, G["~"]): ("SHIFT", 27), - (54, G["false"]): ("SHIFT", 26), (54, G["new"]): ("SHIFT", 22), + (54, G["id"]): ("SHIFT", 28), + (54, G["isvoid"]): ("SHIFT", 24), (54, G["true"]): ("SHIFT", 25), - (55, G[","]): ("REDUCE", G["term -> term / factor"]), - (55, G["in"]): ("REDUCE", G["term -> term / factor"]), - (55, G["then"]): ("REDUCE", G["term -> term / factor"]), - (55, G[";"]): ("REDUCE", G["term -> term / factor"]), - (55, G["+"]): ("REDUCE", G["term -> term / factor"]), - (55, G["else"]): ("REDUCE", G["term -> term / factor"]), + (54, G["("]): ("SHIFT", 11), + (54, G["string"]): ("SHIFT", 33), + (54, G["false"]): ("SHIFT", 26), (55, G["of"]): ("REDUCE", G["term -> term / factor"]), - (55, G["-"]): ("REDUCE", G["term -> term / factor"]), - (55, G["fi"]): ("REDUCE", G["term -> term / factor"]), - (55, G["*"]): ("REDUCE", G["term -> term / factor"]), - (55, G["/"]): ("REDUCE", G["term -> term / factor"]), - (55, G["}"]): ("REDUCE", G["term -> term / factor"]), (55, G["<"]): ("REDUCE", G["term -> term / factor"]), - (55, G["loop"]): ("REDUCE", G["term -> term / factor"]), + (55, G[")"]): ("REDUCE", G["term -> term / factor"]), + (55, G["/"]): ("REDUCE", G["term -> term / factor"]), + (55, G["then"]): ("REDUCE", G["term -> term / factor"]), (55, G["<="]): ("REDUCE", G["term -> term / factor"]), + (55, G["else"]): ("REDUCE", G["term -> term / factor"]), (55, G["="]): ("REDUCE", G["term -> term / factor"]), + (55, G[","]): ("REDUCE", G["term -> term / factor"]), + (55, G["fi"]): ("REDUCE", G["term -> term / factor"]), + (55, G[";"]): ("REDUCE", G["term -> term / factor"]), + (55, G["loop"]): ("REDUCE", G["term -> term / factor"]), (55, G["pool"]): ("REDUCE", G["term -> term / factor"]), - (55, G[")"]): ("REDUCE", G["term -> term / factor"]), + (55, G["+"]): ("REDUCE", G["term -> term / factor"]), + (55, G["-"]): ("REDUCE", G["term -> term / factor"]), + (55, G["in"]): ("REDUCE", G["term -> term / factor"]), + (55, G["*"]): ("REDUCE", G["term -> term / factor"]), (55, G["error"]): ("REDUCE", G["term -> term / factor"]), - (56, G[","]): ("REDUCE", G["term -> factor"]), - (56, G["in"]): ("REDUCE", G["term -> factor"]), - (56, G["then"]): ("REDUCE", G["term -> factor"]), - (56, G[";"]): ("REDUCE", G["term -> factor"]), - (56, G["+"]): ("REDUCE", G["term -> factor"]), - (56, G["else"]): ("REDUCE", G["term -> factor"]), + (55, G["}"]): ("REDUCE", G["term -> term / factor"]), (56, G["of"]): ("REDUCE", G["term -> factor"]), - (56, G["-"]): ("REDUCE", G["term -> factor"]), - (56, G["fi"]): ("REDUCE", G["term -> factor"]), - (56, G["*"]): ("REDUCE", G["term -> factor"]), - (56, G["/"]): ("REDUCE", G["term -> factor"]), - (56, G["}"]): ("REDUCE", G["term -> factor"]), (56, G["<"]): ("REDUCE", G["term -> factor"]), - (56, G["loop"]): ("REDUCE", G["term -> factor"]), + (56, G[")"]): ("REDUCE", G["term -> factor"]), + (56, G["/"]): ("REDUCE", G["term -> factor"]), + (56, G["then"]): ("REDUCE", G["term -> factor"]), (56, G["<="]): ("REDUCE", G["term -> factor"]), + (56, G["else"]): ("REDUCE", G["term -> factor"]), (56, G["="]): ("REDUCE", G["term -> factor"]), + (56, G[","]): ("REDUCE", G["term -> factor"]), + (56, G["fi"]): ("REDUCE", G["term -> factor"]), + (56, G[";"]): ("REDUCE", G["term -> factor"]), + (56, G["loop"]): ("REDUCE", G["term -> factor"]), (56, G["pool"]): ("REDUCE", G["term -> factor"]), - (56, G[")"]): ("REDUCE", G["term -> factor"]), + (56, G["+"]): ("REDUCE", G["term -> factor"]), + (56, G["-"]): ("REDUCE", G["term -> factor"]), + (56, G["in"]): ("REDUCE", G["term -> factor"]), + (56, G["*"]): ("REDUCE", G["term -> factor"]), (56, G["error"]): ("REDUCE", G["term -> factor"]), + (56, G["}"]): ("REDUCE", G["term -> factor"]), (57, G["type"]): ("SHIFT", 58), (58, G["."]): ("SHIFT", 59), (59, G["id"]): ("SHIFT", 60), (60, G["("]): ("SHIFT", 61), - (61, G["false"]): ("SHIFT", 26), - (61, G["~"]): ("SHIFT", 27), + (61, G["int"]): ("SHIFT", 34), + (61, G["while"]): ("SHIFT", 13), + (61, G["if"]): ("SHIFT", 12), + (61, G["not"]): ("SHIFT", 30), + (61, G["("]): ("SHIFT", 11), + (61, G["let"]): ("SHIFT", 14), + (61, G[")"]): ("REDUCE", G["expr-list -> e"]), (61, G["new"]): ("SHIFT", 22), - (61, G["isvoid"]): ("SHIFT", 24), - (61, G["id"]): ("SHIFT", 31), (61, G["case"]): ("SHIFT", 21), - (61, G["true"]): ("SHIFT", 25), (61, G["{"]): ("SHIFT", 10), + (61, G["isvoid"]): ("SHIFT", 24), + (61, G["id"]): ("SHIFT", 31), (61, G["string"]): ("SHIFT", 33), - (61, G["not"]): ("SHIFT", 30), - (61, G["let"]): ("SHIFT", 14), - (61, G["if"]): ("SHIFT", 12), - (61, G["int"]): ("SHIFT", 34), - (61, G["while"]): ("SHIFT", 13), - (61, G[")"]): ("REDUCE", G["expr-list -> e"]), - (61, G["("]): ("SHIFT", 11), + (61, G["false"]): ("SHIFT", 26), + (61, G["true"]): ("SHIFT", 25), + (61, G["~"]): ("SHIFT", 27), (62, G[")"]): ("SHIFT", 63), - (63, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (64, G["int"]): ("SHIFT", 34), (64, G["("]): ("SHIFT", 11), (64, G["string"]): ("SHIFT", 33), - (64, G["~"]): ("SHIFT", 27), (64, G["false"]): ("SHIFT", 26), + (64, G["~"]): ("SHIFT", 27), (64, G["new"]): ("SHIFT", 22), - (64, G["isvoid"]): ("SHIFT", 24), (64, G["id"]): ("SHIFT", 28), - (64, G["int"]): ("SHIFT", 34), (64, G["true"]): ("SHIFT", 25), - (65, G["/"]): ("SHIFT", 54), - (65, G[","]): ("REDUCE", G["arith -> arith - term"]), - (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["then"]): ("REDUCE", G["arith -> arith - term"]), - (65, G[";"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["+"]): ("REDUCE", G["arith -> arith - term"]), + (64, G["isvoid"]): ("SHIFT", 24), (65, G["of"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["else"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["-"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["fi"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["}"]): ("REDUCE", G["arith -> arith - term"]), (65, G["<"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["loop"]): ("REDUCE", G["arith -> arith - term"]), + (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["then"]): ("REDUCE", G["arith -> arith - term"]), (65, G["<="]): ("REDUCE", G["arith -> arith - term"]), + (65, G["else"]): ("REDUCE", G["arith -> arith - term"]), (65, G["="]): ("REDUCE", G["arith -> arith - term"]), - (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), + (65, G[","]): ("REDUCE", G["arith -> arith - term"]), + (65, G["fi"]): ("REDUCE", G["arith -> arith - term"]), + (65, G[";"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["loop"]): ("REDUCE", G["arith -> arith - term"]), (65, G["pool"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["+"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["-"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), (65, G["error"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["}"]): ("REDUCE", G["arith -> arith - term"]), (65, G["*"]): ("SHIFT", 41), - (66, G["id"]): ("SHIFT", 28), - (66, G["int"]): ("SHIFT", 34), - (66, G["false"]): ("SHIFT", 26), + (65, G["/"]): ("SHIFT", 54), + (66, G["~"]): ("SHIFT", 27), (66, G["new"]): ("SHIFT", 22), (66, G["string"]): ("SHIFT", 33), - (66, G["("]): ("SHIFT", 11), - (66, G["~"]): ("SHIFT", 27), (66, G["true"]): ("SHIFT", 25), + (66, G["id"]): ("SHIFT", 28), (66, G["isvoid"]): ("SHIFT", 24), - (67, G["-"]): ("SHIFT", 64), - (67, G["}"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["in"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), + (66, G["int"]): ("SHIFT", 34), + (66, G["false"]): ("SHIFT", 26), + (66, G["("]): ("SHIFT", 11), (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["else"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["in"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["}"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["-"]): ("SHIFT", 64), (67, G["+"]): ("SHIFT", 39), - (68, G["id"]): ("SHIFT", 28), - (68, G["int"]): ("SHIFT", 34), - (68, G["false"]): ("SHIFT", 26), + (68, G["~"]): ("SHIFT", 27), (68, G["new"]): ("SHIFT", 22), (68, G["string"]): ("SHIFT", 33), - (68, G["("]): ("SHIFT", 11), - (68, G["~"]): ("SHIFT", 27), (68, G["true"]): ("SHIFT", 25), + (68, G["id"]): ("SHIFT", 28), (68, G["isvoid"]): ("SHIFT", 24), - (69, G["-"]): ("SHIFT", 64), - (69, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), + (68, G["int"]): ("SHIFT", 34), + (68, G["false"]): ("SHIFT", 26), + (68, G["("]): ("SHIFT", 11), (69, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["-"]): ("SHIFT", 64), (69, G["+"]): ("SHIFT", 39), - (70, G["id"]): ("SHIFT", 28), - (70, G["int"]): ("SHIFT", 34), - (70, G["false"]): ("SHIFT", 26), + (70, G["~"]): ("SHIFT", 27), (70, G["new"]): ("SHIFT", 22), (70, G["string"]): ("SHIFT", 33), - (70, G["("]): ("SHIFT", 11), - (70, G["~"]): ("SHIFT", 27), (70, G["true"]): ("SHIFT", 25), + (70, G["id"]): ("SHIFT", 28), (70, G["isvoid"]): ("SHIFT", 24), - (71, G["-"]): ("SHIFT", 64), - (71, G["}"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["in"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["error"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), + (70, G["int"]): ("SHIFT", 34), + (70, G["false"]): ("SHIFT", 26), + (70, G["("]): ("SHIFT", 11), (71, G[";"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["else"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["in"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["error"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["}"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["-"]): ("SHIFT", 64), (71, G["+"]): ("SHIFT", 39), - (72, G["}"]): ("REDUCE", G["expr -> not expr"]), - (72, G["in"]): ("REDUCE", G["expr -> not expr"]), - (72, G[","]): ("REDUCE", G["expr -> not expr"]), - (72, G["fi"]): ("REDUCE", G["expr -> not expr"]), - (72, G["then"]): ("REDUCE", G["expr -> not expr"]), - (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), (72, G[";"]): ("REDUCE", G["expr -> not expr"]), - (72, G[")"]): ("REDUCE", G["expr -> not expr"]), (72, G["of"]): ("REDUCE", G["expr -> not expr"]), + (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), + (72, G[")"]): ("REDUCE", G["expr -> not expr"]), (72, G["pool"]): ("REDUCE", G["expr -> not expr"]), + (72, G["then"]): ("REDUCE", G["expr -> not expr"]), (72, G["else"]): ("REDUCE", G["expr -> not expr"]), + (72, G[","]): ("REDUCE", G["expr -> not expr"]), + (72, G["in"]): ("REDUCE", G["expr -> not expr"]), + (72, G["fi"]): ("REDUCE", G["expr -> not expr"]), (72, G["error"]): ("REDUCE", G["expr -> not expr"]), + (72, G["}"]): ("REDUCE", G["expr -> not expr"]), (73, G[")"]): ("SHIFT", 74), - (74, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G[","]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["then"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G[";"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["+"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["else"]): ("REDUCE", G["factor -> ~ factor"]), + (74, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (75, G["of"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["-"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["*"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["/"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["}"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["<"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G[")"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["/"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["then"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["<="]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["else"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["="]): ("REDUCE", G["factor -> ~ factor"]), + (75, G[","]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G[";"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G[")"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["+"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["-"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["*"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), - (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), + (75, G["}"]): ("REDUCE", G["factor -> ~ factor"]), (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), (77, G["of"]): ("SHIFT", 78), (78, G["id"]): ("SHIFT", 79), (79, G[":"]): ("SHIFT", 80), @@ -837,21 +837,21 @@ def __action_table(): (81, G["=>"]): ("SHIFT", 82), (82, G["id"]): ("SHIFT", 31), (82, G["while"]): ("SHIFT", 13), - (82, G["string"]): ("SHIFT", 33), - (82, G["not"]): ("SHIFT", 30), - (82, G["new"]): ("SHIFT", 22), - (82, G["let"]): ("SHIFT", 14), - (82, G["true"]): ("SHIFT", 25), - (82, G["isvoid"]): ("SHIFT", 24), (82, G["if"]): ("SHIFT", 12), (82, G["int"]): ("SHIFT", 34), - (82, G["false"]): ("SHIFT", 26), + (82, G["not"]): ("SHIFT", 30), (82, G["("]): ("SHIFT", 11), - (82, G["{"]): ("SHIFT", 10), - (82, G["case"]): ("SHIFT", 21), + (82, G["let"]): ("SHIFT", 14), (82, G["~"]): ("SHIFT", 27), - (83, G["error"]): ("SHIFT", 86), + (82, G["case"]): ("SHIFT", 21), + (82, G["new"]): ("SHIFT", 22), + (82, G["{"]): ("SHIFT", 10), + (82, G["string"]): ("SHIFT", 33), + (82, G["false"]): ("SHIFT", 26), + (82, G["true"]): ("SHIFT", 25), + (82, G["isvoid"]): ("SHIFT", 24), (83, G[";"]): ("SHIFT", 84), + (83, G["error"]): ("SHIFT", 86), (84, G["id"]): ("SHIFT", 79), (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), @@ -859,194 +859,194 @@ def __action_table(): (86, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), (87, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error case-list"]), (88, G["esac"]): ("SHIFT", 89), - (89, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), + (89, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (90, G[","]): ("SHIFT", 91), + (90, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), (91, G["id"]): ("SHIFT", 15), (92, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), (93, G["in"]): ("SHIFT", 94), - (94, G["string"]): ("SHIFT", 33), - (94, G["isvoid"]): ("SHIFT", 24), - (94, G["case"]): ("SHIFT", 21), (94, G["int"]): ("SHIFT", 34), - (94, G["{"]): ("SHIFT", 10), - (94, G["let"]): ("SHIFT", 14), (94, G["("]): ("SHIFT", 11), - (94, G["not"]): ("SHIFT", 30), - (94, G["if"]): ("SHIFT", 12), - (94, G["~"]): ("SHIFT", 27), - (94, G["while"]): ("SHIFT", 13), - (94, G["false"]): ("SHIFT", 26), (94, G["new"]): ("SHIFT", 22), + (94, G["while"]): ("SHIFT", 13), + (94, G["if"]): ("SHIFT", 12), + (94, G["isvoid"]): ("SHIFT", 24), + (94, G["not"]): ("SHIFT", 30), + (94, G["let"]): ("SHIFT", 14), (94, G["id"]): ("SHIFT", 31), + (94, G["case"]): ("SHIFT", 21), + (94, G["string"]): ("SHIFT", 33), + (94, G["false"]): ("SHIFT", 26), + (94, G["~"]): ("SHIFT", 27), (94, G["true"]): ("SHIFT", 25), - (95, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G["{"]): ("SHIFT", 10), (95, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (96, G["loop"]): ("SHIFT", 97), - (97, G["{"]): ("SHIFT", 10), - (97, G["true"]): ("SHIFT", 25), - (97, G["not"]): ("SHIFT", 30), - (97, G["~"]): ("SHIFT", 27), - (97, G["let"]): ("SHIFT", 14), (97, G["case"]): ("SHIFT", 21), (97, G["int"]): ("SHIFT", 34), + (97, G["("]): ("SHIFT", 11), + (97, G["{"]): ("SHIFT", 10), (97, G["id"]): ("SHIFT", 31), - (97, G["false"]): ("SHIFT", 26), (97, G["new"]): ("SHIFT", 22), - (97, G["("]): ("SHIFT", 11), (97, G["isvoid"]): ("SHIFT", 24), + (97, G["not"]): ("SHIFT", 30), + (97, G["string"]): ("SHIFT", 33), + (97, G["false"]): ("SHIFT", 26), + (97, G["~"]): ("SHIFT", 27), (97, G["while"]): ("SHIFT", 13), (97, G["if"]): ("SHIFT", 12), - (97, G["string"]): ("SHIFT", 33), + (97, G["let"]): ("SHIFT", 14), + (97, G["true"]): ("SHIFT", 25), (98, G["pool"]): ("SHIFT", 99), - (99, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (100, G["then"]): ("SHIFT", 101), - (101, G["("]): ("SHIFT", 11), - (101, G["{"]): ("SHIFT", 10), - (101, G["id"]): ("SHIFT", 31), - (101, G["case"]): ("SHIFT", 21), - (101, G["isvoid"]): ("SHIFT", 24), - (101, G["string"]): ("SHIFT", 33), - (101, G["true"]): ("SHIFT", 25), - (101, G["~"]): ("SHIFT", 27), (101, G["while"]): ("SHIFT", 13), (101, G["int"]): ("SHIFT", 34), (101, G["if"]): ("SHIFT", 12), (101, G["not"]): ("SHIFT", 30), - (101, G["false"]): ("SHIFT", 26), + (101, G["("]): ("SHIFT", 11), (101, G["let"]): ("SHIFT", 14), + (101, G["case"]): ("SHIFT", 21), (101, G["new"]): ("SHIFT", 22), + (101, G["isvoid"]): ("SHIFT", 24), + (101, G["{"]): ("SHIFT", 10), + (101, G["id"]): ("SHIFT", 31), + (101, G["string"]): ("SHIFT", 33), + (101, G["false"]): ("SHIFT", 26), + (101, G["~"]): ("SHIFT", 27), + (101, G["true"]): ("SHIFT", 25), (102, G["else"]): ("SHIFT", 103), - (103, G["("]): ("SHIFT", 11), - (103, G["false"]): ("SHIFT", 26), - (103, G["if"]): ("SHIFT", 12), (103, G["while"]): ("SHIFT", 13), - (103, G["int"]): ("SHIFT", 34), - (103, G["isvoid"]): ("SHIFT", 24), - (103, G["id"]): ("SHIFT", 31), + (103, G["if"]): ("SHIFT", 12), + (103, G["not"]): ("SHIFT", 30), + (103, G["string"]): ("SHIFT", 33), + (103, G["false"]): ("SHIFT", 26), (103, G["~"]): ("SHIFT", 27), - (103, G["{"]): ("SHIFT", 10), + (103, G["let"]): ("SHIFT", 14), (103, G["case"]): ("SHIFT", 21), + (103, G["id"]): ("SHIFT", 31), (103, G["true"]): ("SHIFT", 25), + (103, G["int"]): ("SHIFT", 34), + (103, G["("]): ("SHIFT", 11), + (103, G["{"]): ("SHIFT", 10), (103, G["new"]): ("SHIFT", 22), - (103, G["string"]): ("SHIFT", 33), - (103, G["not"]): ("SHIFT", 30), - (103, G["let"]): ("SHIFT", 14), + (103, G["isvoid"]): ("SHIFT", 24), (104, G["fi"]): ("SHIFT", 105), - (105, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (106, G[")"]): ("SHIFT", 107), - (107, G[","]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["in"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["then"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G[";"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["+"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["@"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["else"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["of"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["-"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["*"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["/"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["}"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["<"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G[")"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["/"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["then"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["<="]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["."]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["else"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["="]): ("REDUCE", G["atom -> ( expr )"]), + (107, G[","]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G[";"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["@"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G[")"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["+"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["-"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["in"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["*"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["error"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["."]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["}"]): ("REDUCE", G["atom -> ( expr )"]), (108, G["}"]): ("SHIFT", 109), - (109, G["}"]): ("REDUCE", G["expr -> { block }"]), - (109, G["in"]): ("REDUCE", G["expr -> { block }"]), - (109, G[","]): ("REDUCE", G["expr -> { block }"]), - (109, G["error"]): ("REDUCE", G["expr -> { block }"]), - (109, G["then"]): ("REDUCE", G["expr -> { block }"]), - (109, G["loop"]): ("REDUCE", G["expr -> { block }"]), (109, G[";"]): ("REDUCE", G["expr -> { block }"]), - (109, G[")"]): ("REDUCE", G["expr -> { block }"]), (109, G["of"]): ("REDUCE", G["expr -> { block }"]), + (109, G["loop"]): ("REDUCE", G["expr -> { block }"]), + (109, G[")"]): ("REDUCE", G["expr -> { block }"]), (109, G["pool"]): ("REDUCE", G["expr -> { block }"]), + (109, G["then"]): ("REDUCE", G["expr -> { block }"]), (109, G["else"]): ("REDUCE", G["expr -> { block }"]), + (109, G[","]): ("REDUCE", G["expr -> { block }"]), + (109, G["in"]): ("REDUCE", G["expr -> { block }"]), (109, G["fi"]): ("REDUCE", G["expr -> { block }"]), + (109, G["error"]): ("REDUCE", G["expr -> { block }"]), + (109, G["}"]): ("REDUCE", G["expr -> { block }"]), (110, G["error"]): ("SHIFT", 113), (110, G[";"]): ("SHIFT", 111), (111, G["id"]): ("SHIFT", 31), (111, G["while"]): ("SHIFT", 13), - (111, G["string"]): ("SHIFT", 33), - (111, G["not"]): ("SHIFT", 30), - (111, G["new"]): ("SHIFT", 22), - (111, G["let"]): ("SHIFT", 14), - (111, G["true"]): ("SHIFT", 25), - (111, G["isvoid"]): ("SHIFT", 24), (111, G["if"]): ("SHIFT", 12), (111, G["int"]): ("SHIFT", 34), - (111, G["false"]): ("SHIFT", 26), - (111, G["("]): ("SHIFT", 11), - (111, G["{"]): ("SHIFT", 10), (111, G["}"]): ("REDUCE", G["block -> expr ;"]), - (111, G["case"]): ("SHIFT", 21), + (111, G["not"]): ("SHIFT", 30), + (111, G["("]): ("SHIFT", 11), + (111, G["let"]): ("SHIFT", 14), (111, G["~"]): ("SHIFT", 27), + (111, G["case"]): ("SHIFT", 21), + (111, G["new"]): ("SHIFT", 22), + (111, G["{"]): ("SHIFT", 10), + (111, G["string"]): ("SHIFT", 33), + (111, G["false"]): ("SHIFT", 26), + (111, G["true"]): ("SHIFT", 25), + (111, G["isvoid"]): ("SHIFT", 24), (112, G["}"]): ("REDUCE", G["block -> expr ; block"]), (113, G["id"]): ("SHIFT", 31), - (113, G["while"]): ("SHIFT", 13), - (113, G["string"]): ("SHIFT", 33), - (113, G["not"]): ("SHIFT", 30), - (113, G["new"]): ("SHIFT", 22), - (113, G["let"]): ("SHIFT", 14), - (113, G["true"]): ("SHIFT", 25), - (113, G["isvoid"]): ("SHIFT", 24), - (113, G["}"]): ("REDUCE", G["block -> expr error"]), + (113, G["while"]): ("SHIFT", 13), (113, G["if"]): ("SHIFT", 12), (113, G["int"]): ("SHIFT", 34), - (113, G["false"]): ("SHIFT", 26), + (113, G["}"]): ("REDUCE", G["block -> expr error"]), + (113, G["not"]): ("SHIFT", 30), (113, G["("]): ("SHIFT", 11), - (113, G["{"]): ("SHIFT", 10), - (113, G["case"]): ("SHIFT", 21), + (113, G["let"]): ("SHIFT", 14), (113, G["~"]): ("SHIFT", 27), + (113, G["case"]): ("SHIFT", 21), + (113, G["new"]): ("SHIFT", 22), + (113, G["{"]): ("SHIFT", 10), + (113, G["string"]): ("SHIFT", 33), + (113, G["false"]): ("SHIFT", 26), + (113, G["true"]): ("SHIFT", 25), + (113, G["isvoid"]): ("SHIFT", 24), (114, G["}"]): ("REDUCE", G["block -> expr error block"]), (115, G["}"]): ("SHIFT", 116), (116, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), @@ -1061,21 +1061,21 @@ def __action_table(): (123, G[":"]): ("SHIFT", 124), (124, G["type"]): ("SHIFT", 125), (125, G["{"]): ("SHIFT", 126), - (126, G["case"]): ("SHIFT", 21), - (126, G["true"]): ("SHIFT", 25), - (126, G["new"]): ("SHIFT", 22), - (126, G["string"]): ("SHIFT", 33), - (126, G["id"]): ("SHIFT", 31), - (126, G["not"]): ("SHIFT", 30), - (126, G["let"]): ("SHIFT", 14), (126, G["{"]): ("SHIFT", 10), - (126, G["("]): ("SHIFT", 11), + (126, G["id"]): ("SHIFT", 31), + (126, G["isvoid"]): ("SHIFT", 24), + (126, G["string"]): ("SHIFT", 33), (126, G["false"]): ("SHIFT", 26), - (126, G["if"]): ("SHIFT", 12), + (126, G["true"]): ("SHIFT", 25), (126, G["while"]): ("SHIFT", 13), - (126, G["int"]): ("SHIFT", 34), - (126, G["isvoid"]): ("SHIFT", 24), + (126, G["if"]): ("SHIFT", 12), + (126, G["not"]): ("SHIFT", 30), (126, G["~"]): ("SHIFT", 27), + (126, G["int"]): ("SHIFT", 34), + (126, G["let"]): ("SHIFT", 14), + (126, G["case"]): ("SHIFT", 21), + (126, G["("]): ("SHIFT", 11), + (126, G["new"]): ("SHIFT", 22), (127, G["}"]): ("SHIFT", 128), (128, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (128, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), @@ -1085,19 +1085,19 @@ def __action_table(): (130, G["error"]): ("REDUCE", G["attribute -> id : type"]), (131, G["id"]): ("SHIFT", 31), (131, G["while"]): ("SHIFT", 13), - (131, G["string"]): ("SHIFT", 33), - (131, G["not"]): ("SHIFT", 30), - (131, G["new"]): ("SHIFT", 22), - (131, G["let"]): ("SHIFT", 14), - (131, G["true"]): ("SHIFT", 25), - (131, G["isvoid"]): ("SHIFT", 24), (131, G["if"]): ("SHIFT", 12), (131, G["int"]): ("SHIFT", 34), - (131, G["false"]): ("SHIFT", 26), + (131, G["not"]): ("SHIFT", 30), (131, G["("]): ("SHIFT", 11), - (131, G["{"]): ("SHIFT", 10), - (131, G["case"]): ("SHIFT", 21), + (131, G["let"]): ("SHIFT", 14), (131, G["~"]): ("SHIFT", 27), + (131, G["case"]): ("SHIFT", 21), + (131, G["new"]): ("SHIFT", 22), + (131, G["{"]): ("SHIFT", 10), + (131, G["string"]): ("SHIFT", 33), + (131, G["false"]): ("SHIFT", 26), + (131, G["true"]): ("SHIFT", 25), + (131, G["isvoid"]): ("SHIFT", 24), (132, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), (132, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), (133, G["}"]): ("SHIFT", 134), @@ -1108,16 +1108,16 @@ def __action_table(): (136, G["id"]): ("SHIFT", 4), (136, G["}"]): ("REDUCE", G["feature-list -> e"]), (137, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), - (138, G["error"]): ("SHIFT", 141), (138, G[";"]): ("SHIFT", 139), + (138, G["error"]): ("SHIFT", 141), (139, G["id"]): ("SHIFT", 4), (139, G["}"]): ("REDUCE", G["feature-list -> e"]), (140, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), (141, G["id"]): ("SHIFT", 4), (141, G["}"]): ("REDUCE", G["feature-list -> e"]), (142, G["}"]): ("REDUCE", G["feature-list -> method error feature-list"]), - (143, G["id"]): ("SHIFT", 4), (143, G["}"]): ("REDUCE", G["feature-list -> e"]), + (143, G["id"]): ("SHIFT", 4), (144, G["}"]): ("REDUCE", G["feature-list -> attribute error feature-list"]), (145, G["type"]): ("SHIFT", 146), (146, G["{"]): ("SHIFT", 147), @@ -1128,242 +1128,242 @@ def __action_table(): (149, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), (150, G["$"]): ("OK", None), (151, G["$"]): ("REDUCE", G["program -> class-list"]), - (152, G["$"]): ("REDUCE", G["class-list -> class-def"]), (152, G["class"]): ("SHIFT", 1), + (152, G["$"]): ("REDUCE", G["class-list -> class-def"]), (153, G["$"]): ("REDUCE", G["class-list -> class-def class-list"]), } @staticmethod def __goto_table(): return { + (0, G["program"]): 150, (0, G["class-list"]): 151, (0, G["class-def"]): 152, - (0, G["program"]): 150, (3, G["method"]): 138, (3, G["attribute"]): 135, (3, G["feature-list"]): 133, (5, G["param-list"]): 122, - (9, G["function-call"]): 35, - (9, G["term"]): 53, (9, G["arith"]): 38, - (9, G["factor"]): 56, - (9, G["atom"]): 43, (9, G["expr"]): 115, (9, G["comp"]): 37, + (9, G["term"]): 53, + (9, G["atom"]): 43, + (9, G["function-call"]): 35, + (9, G["factor"]): 56, (10, G["term"]): 53, - (10, G["block"]): 108, - (10, G["arith"]): 38, + (10, G["expr"]): 110, (10, G["function-call"]): 35, - (10, G["factor"]): 56, + (10, G["arith"]): 38, (10, G["atom"]): 43, + (10, G["factor"]): 56, + (10, G["block"]): 108, (10, G["comp"]): 37, - (10, G["expr"]): 110, + (11, G["term"]): 53, + (11, G["arith"]): 38, (11, G["atom"]): 43, + (11, G["function-call"]): 35, + (11, G["comp"]): 37, (11, G["expr"]): 106, - (11, G["arith"]): 38, - (11, G["term"]): 53, (11, G["factor"]): 56, - (11, G["comp"]): 37, - (11, G["function-call"]): 35, - (12, G["factor"]): 56, + (12, G["expr"]): 100, (12, G["arith"]): 38, + (12, G["atom"]): 43, (12, G["comp"]): 37, (12, G["term"]): 53, + (12, G["factor"]): 56, (12, G["function-call"]): 35, - (12, G["expr"]): 100, - (12, G["atom"]): 43, - (13, G["atom"]): 43, (13, G["arith"]): 38, - (13, G["expr"]): 96, - (13, G["factor"]): 56, (13, G["term"]): 53, - (13, G["comp"]): 37, + (13, G["atom"]): 43, (13, G["function-call"]): 35, + (13, G["factor"]): 56, + (13, G["expr"]): 96, + (13, G["comp"]): 37, (14, G["declaration-list"]): 93, (18, G["declaration-list"]): 19, (20, G["arith"]): 38, + (20, G["comp"]): 37, (20, G["term"]): 53, (20, G["atom"]): 43, - (20, G["comp"]): 37, - (20, G["factor"]): 56, - (20, G["function-call"]): 35, (20, G["expr"]): 90, - (21, G["atom"]): 43, - (21, G["term"]): 53, + (20, G["function-call"]): 35, + (20, G["factor"]): 56, (21, G["expr"]): 77, - (21, G["comp"]): 37, + (21, G["arith"]): 38, + (21, G["atom"]): 43, (21, G["function-call"]): 35, + (21, G["term"]): 53, (21, G["factor"]): 56, - (21, G["arith"]): 38, - (24, G["function-call"]): 35, + (21, G["comp"]): 37, (24, G["atom"]): 43, (24, G["factor"]): 76, - (27, G["function-call"]): 35, + (24, G["function-call"]): 35, (27, G["atom"]): 43, (27, G["factor"]): 75, - (29, G["expr"]): 50, + (27, G["function-call"]): 35, + (29, G["factor"]): 56, (29, G["arith"]): 38, (29, G["atom"]): 43, - (29, G["expr-list"]): 73, + (29, G["expr"]): 50, (29, G["not-empty-expr-list"]): 49, - (29, G["factor"]): 56, - (29, G["comp"]): 37, (29, G["term"]): 53, + (29, G["expr-list"]): 73, + (29, G["comp"]): 37, (29, G["function-call"]): 35, - (30, G["factor"]): 56, (30, G["arith"]): 38, - (30, G["expr"]): 72, (30, G["atom"]): 43, + (30, G["comp"]): 37, (30, G["term"]): 53, + (30, G["factor"]): 56, (30, G["function-call"]): 35, - (30, G["comp"]): 37, - (32, G["factor"]): 56, + (30, G["expr"]): 72, (32, G["arith"]): 38, + (32, G["expr"]): 36, (32, G["atom"]): 43, + (32, G["comp"]): 37, (32, G["term"]): 53, + (32, G["factor"]): 56, (32, G["function-call"]): 35, - (32, G["comp"]): 37, - (32, G["expr"]): 36, (39, G["term"]): 40, + (39, G["atom"]): 43, (39, G["factor"]): 56, (39, G["function-call"]): 35, - (39, G["atom"]): 43, - (41, G["function-call"]): 35, (41, G["atom"]): 43, + (41, G["function-call"]): 35, (41, G["factor"]): 42, - (46, G["expr"]): 50, + (46, G["factor"]): 56, (46, G["arith"]): 38, - (46, G["expr-list"]): 47, (46, G["atom"]): 43, + (46, G["expr"]): 50, (46, G["not-empty-expr-list"]): 49, - (46, G["factor"]): 56, - (46, G["comp"]): 37, + (46, G["expr-list"]): 47, (46, G["term"]): 53, + (46, G["comp"]): 37, (46, G["function-call"]): 35, - (51, G["expr"]): 50, + (51, G["factor"]): 56, (51, G["arith"]): 38, (51, G["atom"]): 43, - (51, G["factor"]): 56, (51, G["not-empty-expr-list"]): 52, - (51, G["comp"]): 37, + (51, G["expr"]): 50, (51, G["term"]): 53, + (51, G["comp"]): 37, (51, G["function-call"]): 35, - (54, G["function-call"]): 35, (54, G["atom"]): 43, (54, G["factor"]): 55, - (61, G["expr"]): 50, + (54, G["function-call"]): 35, + (61, G["factor"]): 56, (61, G["arith"]): 38, - (61, G["atom"]): 43, (61, G["expr-list"]): 62, + (61, G["atom"]): 43, + (61, G["expr"]): 50, (61, G["not-empty-expr-list"]): 49, - (61, G["factor"]): 56, - (61, G["comp"]): 37, (61, G["term"]): 53, + (61, G["comp"]): 37, (61, G["function-call"]): 35, (64, G["term"]): 65, + (64, G["atom"]): 43, (64, G["factor"]): 56, (64, G["function-call"]): 35, - (64, G["atom"]): 43, - (66, G["arith"]): 67, - (66, G["term"]): 53, (66, G["atom"]): 43, - (66, G["function-call"]): 35, + (66, G["arith"]): 67, (66, G["factor"]): 56, - (68, G["term"]): 53, + (66, G["function-call"]): 35, + (66, G["term"]): 53, (68, G["atom"]): 43, + (68, G["factor"]): 56, (68, G["function-call"]): 35, (68, G["arith"]): 69, - (68, G["factor"]): 56, - (70, G["arith"]): 71, - (70, G["term"]): 53, + (68, G["term"]): 53, (70, G["atom"]): 43, - (70, G["function-call"]): 35, (70, G["factor"]): 56, + (70, G["function-call"]): 35, + (70, G["arith"]): 71, + (70, G["term"]): 53, (78, G["case-list"]): 88, (82, G["term"]): 53, (82, G["expr"]): 83, - (82, G["arith"]): 38, (82, G["function-call"]): 35, - (82, G["factor"]): 56, + (82, G["arith"]): 38, (82, G["atom"]): 43, + (82, G["factor"]): 56, (82, G["comp"]): 37, (84, G["case-list"]): 85, (86, G["case-list"]): 87, (91, G["declaration-list"]): 92, - (94, G["factor"]): 56, (94, G["arith"]): 38, + (94, G["expr"]): 95, (94, G["atom"]): 43, + (94, G["comp"]): 37, (94, G["term"]): 53, + (94, G["factor"]): 56, (94, G["function-call"]): 35, - (94, G["comp"]): 37, - (94, G["expr"]): 95, - (97, G["term"]): 53, + (97, G["function-call"]): 35, (97, G["arith"]): 38, + (97, G["term"]): 53, (97, G["atom"]): 43, (97, G["factor"]): 56, - (97, G["function-call"]): 35, (97, G["comp"]): 37, (97, G["expr"]): 98, (101, G["arith"]): 38, - (101, G["function-call"]): 35, - (101, G["term"]): 53, - (101, G["atom"]): 43, - (101, G["factor"]): 56, (101, G["expr"]): 102, + (101, G["atom"]): 43, + (101, G["term"]): 53, (101, G["comp"]): 37, - (103, G["atom"]): 43, - (103, G["arith"]): 38, + (101, G["factor"]): 56, + (101, G["function-call"]): 35, (103, G["term"]): 53, + (103, G["arith"]): 38, (103, G["expr"]): 104, - (103, G["comp"]): 37, - (103, G["function-call"]): 35, + (103, G["atom"]): 43, (103, G["factor"]): 56, + (103, G["function-call"]): 35, + (103, G["comp"]): 37, (111, G["term"]): 53, - (111, G["arith"]): 38, + (111, G["block"]): 112, + (111, G["expr"]): 110, (111, G["function-call"]): 35, - (111, G["factor"]): 56, + (111, G["arith"]): 38, (111, G["atom"]): 43, + (111, G["factor"]): 56, (111, G["comp"]): 37, - (111, G["expr"]): 110, - (111, G["block"]): 112, (113, G["term"]): 53, - (113, G["arith"]): 38, + (113, G["expr"]): 110, (113, G["function-call"]): 35, - (113, G["factor"]): 56, + (113, G["arith"]): 38, (113, G["atom"]): 43, - (113, G["comp"]): 37, - (113, G["expr"]): 110, + (113, G["factor"]): 56, (113, G["block"]): 114, + (113, G["comp"]): 37, (120, G["param-list"]): 121, - (126, G["function-call"]): 35, - (126, G["term"]): 53, (126, G["arith"]): 38, - (126, G["factor"]): 56, - (126, G["atom"]): 43, (126, G["comp"]): 37, (126, G["expr"]): 127, + (126, G["term"]): 53, + (126, G["atom"]): 43, + (126, G["function-call"]): 35, + (126, G["factor"]): 56, (131, G["term"]): 53, - (131, G["arith"]): 38, (131, G["function-call"]): 35, - (131, G["factor"]): 56, - (131, G["atom"]): 43, + (131, G["arith"]): 38, (131, G["expr"]): 132, + (131, G["atom"]): 43, + (131, G["factor"]): 56, (131, G["comp"]): 37, - (136, G["feature-list"]): 137, (136, G["method"]): 138, (136, G["attribute"]): 135, + (136, G["feature-list"]): 137, (139, G["method"]): 138, - (139, G["attribute"]): 135, (139, G["feature-list"]): 140, - (141, G["feature-list"]): 142, + (139, G["attribute"]): 135, (141, G["method"]): 138, + (141, G["feature-list"]): 142, (141, G["attribute"]): 135, (143, G["method"]): 138, - (143, G["attribute"]): 135, (143, G["feature-list"]): 144, - (147, G["feature-list"]): 148, + (143, G["attribute"]): 135, (147, G["method"]): 138, + (147, G["feature-list"]): 148, (147, G["attribute"]): 135, - (152, G["class-def"]): 152, (152, G["class-list"]): 153, + (152, G["class-def"]): 152, } diff --git a/pyjapt/__init__.py b/pyjapt/__init__.py deleted file mode 100755 index e69de29bb..000000000 diff --git a/pyjapt/automata.py b/pyjapt/automata.py deleted file mode 100755 index ddc114818..000000000 --- a/pyjapt/automata.py +++ /dev/null @@ -1,143 +0,0 @@ -from typing import Any, Dict, Set, List, Tuple, Union - - -class State: - def __init__(self, state: Any, final: bool = False): - self.state: Any = state - self.final: bool = final - self.transitions: Dict[str, List['State']] = {} - self.epsilon_transitions: Set['State'] = set() - self.tag = None - - def has_transition(self, symbol): - return symbol in self.transitions - - def add_transition(self, symbol: str, state: 'State'): - try: - self.transitions[symbol].append(state) - except KeyError: - self.transitions[symbol] = [state] - return self - - def add_epsilon_transition(self, state: 'State'): - self.epsilon_transitions.add(state) - return self - - def recognize(self, string: str): - states = self.epsilon_closure - for symbol in string: - states = self.move_by_state(symbol, *states) - states = self.epsilon_closure_by_state(*states) - - return any(s.final for s in states) - - def to_deterministic(self) -> 'State': - closure = self.epsilon_closure - start = State(tuple(closure), any(s.final for s in closure)) - - closures = [closure] - states = [start] - pending = [start] - - while pending: - state = pending.pop() - symbols = {symbol for s in state.state for symbol in s.transitions} - - for symbol in symbols: - move = self.move_by_state(symbol, *state.state) - closure = self.epsilon_closure_by_state(*move) - - if closure not in closures: - new_state = State(tuple(closure), any(s.final for s in closure)) - closures.append(closure) - states.append(new_state) - pending.append(new_state) - else: - index = closures.index(closure) - new_state = states[index] - - state.add_transition(symbol, new_state) - - return start - - @staticmethod - def from_nfa(nfa, get_states: bool = False) -> Union['State', Tuple['State', List['State']]]: - states = [] - for n in range(nfa.states): - state = State(n, n in nfa.finals) - states.append(state) - - for (origin, symbol), destinations in nfa.map.items(): - origin = states[origin] - origin[symbol] = [states[d] for d in destinations] - - if get_states: - return states[nfa.start], states - return states[nfa.start] - - @staticmethod - def move_by_state(symbol, *states): - return {s for state in states if state.has_transition(symbol) for s in state[symbol]} - - @staticmethod - def epsilon_closure_by_state(*states): - closure = set(states) - - n = 0 - while n != len(closure): - n = len(closure) - tmp = [s for s in closure] - for s in tmp: - for epsilon_state in s.epsilon_transitions: - closure.add(epsilon_state) - return closure - - @property - def epsilon_closure(self): - return self.epsilon_closure_by_state(self) - - def get(self, symbol): - target = self.transitions[symbol] - assert len(target) == 1 - return target[0] - - def __getitem__(self, symbol): - if symbol == '': - return self.epsilon_transitions - try: - return self.transitions[symbol] - except KeyError: - return None - - def __setitem__(self, symbol, value): - if symbol == '': - self.epsilon_transitions = value - else: - self.transitions[symbol] = value - - def __repr__(self): - return str(self) - - def __str__(self): - return str(self.state) - - def __hash__(self): - return hash(self.state) - - def __iter__(self): - yield from self.__visit() - - def __visit(self, visited=None): - if visited is None: - visited = set() - elif self in visited: - return - - visited.add(self) - yield self - - for destinations in self.transitions.values(): - for node in destinations: - yield from node.__visit(visited) - for node in self.epsilon_transitions: - yield from node.__visit(visited) diff --git a/pyjapt/grammar.py b/pyjapt/grammar.py deleted file mode 100755 index 5ee2a7eab..000000000 --- a/pyjapt/grammar.py +++ /dev/null @@ -1,610 +0,0 @@ -import json -import re -import sys -from typing import List, FrozenSet, Optional, Tuple, Iterable, Callable, Dict - -from .lexing import Lexer, Token -from .serialization import LRParserSerializer, LexerSerializer - - -class GrammarError(Exception): - def __init__(self, *args): - super().__init__(args) - self.text = args[0] - - -class Symbol: - def __init__(self, name: str, grammar: 'Grammar'): - self.name: str = name - self.grammar: 'Grammar' = grammar - - @property - def IsEpsilon(self): - return False - - def __str__(self): - return self.name - - def __repr__(self): - return repr(self.name) - - def __add__(self, other): - if isinstance(other, Symbol): - return Sentence(self, other) - - raise TypeError(other) - - def __or__(self, other): - if isinstance(other, Sentence): - return SentenceList(Sentence(self), other) - raise TypeError(other) - - def __len__(self): - return 1 - - -class NonTerminal(Symbol): - def __init__(self, name: str, grammar: 'Grammar'): - super().__init__(name, grammar) - self.productions: List['Production'] = [] - self.error_productions: List['Production'] = [] - - def __mod__(self, other): - if isinstance(other, str): - if other: - p = Production(self, Sentence(*(self.grammar[s] for s in other.split()))) - else: - p = Production(self, self.grammar.EPSILON) - self.grammar.add_production(p) - return self - - if isinstance(other, Symbol): - p = Production(self, Sentence(other)) - self.grammar.add_production(p) - return self - - if isinstance(other, Sentence): - p = Production(self, other) - self.grammar.add_production(p) - return self - - if isinstance(other, tuple): - assert len(other) > 1 - - if isinstance(other[0], str): - if other[0]: - other = Sentence(*(self.grammar[s] for s in other[0].split())), other[1] - else: - other = self.grammar.EPSILON, other[1] - - if isinstance(other[0], Symbol) and not isinstance(other[0], Sentence): - other[0] = Sentence(other[0]) - - if isinstance(other[0], Sentence): - p = Production(self, other[0], other[1]) - else: - raise TypeError("Valid types for a production are 'Symbol', 'Sentence' or 'str'") - - self.grammar.add_production(p) - return self - - if isinstance(other, SentenceList): - for s in other: - p = Production(self, s) - self.grammar.add_production(p) - return self - - raise TypeError(other) - - @property - def IsTerminal(self): - return False - - @property - def IsNonTerminal(self): - return True - - @property - def IsEpsilon(self): - return False - - -class Terminal(Symbol): - def __init__(self, name: str, grammar: 'Grammar'): - super().__init__(name, grammar) - - @property - def IsTerminal(self): - return True - - @property - def IsNonTerminal(self): - return False - - @property - def IsEpsilon(self): - return False - - -class ErrorTerminal(Terminal): - def __init__(self, G): - super().__init__('error', G) - - -class EOF(Terminal): - def __init__(self, G): - super().__init__('$', G) - - -class Sentence: - def __init__(self, *args): - self.symbols = tuple(x for x in args if not x.IsEpsilon) - self.hash = hash(self.symbols) - - def __len__(self): - return len(self.symbols) - - def __add__(self, other) -> 'Sentence': - if isinstance(other, Symbol): - return Sentence(*(self.symbols + (other,))) - - if isinstance(other, Sentence): - return Sentence(*(self.symbols + other.symbols)) - - raise TypeError(other) - - def __or__(self, other) -> 'SentenceList': - if isinstance(other, Sentence): - return SentenceList(self, other) - - if isinstance(other, Symbol): - return SentenceList(self, Sentence(other)) - - raise TypeError(other) - - def __repr__(self): - return str(self) - - def __str__(self): - return ("%s " * len(self.symbols) % tuple(self.symbols)).strip() - - def __iter__(self): - return iter(self.symbols) - - def __contains__(self, item): - return item in self.symbols - - def __getitem__(self, index): - return self.symbols[index] - - def __eq__(self, other) -> bool: - return self.symbols == other.symbols - - def __hash__(self): - return self.hash - - @property - def IsEpsilon(self): - return False - - -class SentenceList: - def __init__(self, *args): - self._sentences = list(args) - - def Add(self, symbol): - if not symbol and (symbol is None or not symbol.IsEpsilon): - raise ValueError(symbol) - - self._sentences.append(symbol) - - def __iter__(self): - return iter(self._sentences) - - def __or__(self, other): - if isinstance(other, Sentence): - self.Add(other) - return self - - if isinstance(other, Symbol): - return self | Sentence(other) - - -class Epsilon(Terminal, Sentence): - def __init__(self, grammar: 'Grammar'): - super().__init__('epsilon', grammar) - - def __str__(self): - return "e" - - def __repr__(self): - return 'epsilon' - - def __iter__(self): - yield from () - - def __len__(self): - return 0 - - def __add__(self, other): - return other - - def __eq__(self, other): - return isinstance(other, (Epsilon,)) - - def __hash__(self): - return hash("") - - @property - def IsEpsilon(self): - return True - - -class Production: - def __init__(self, non_terminal: NonTerminal, sentence: Sentence, - rule: Optional[Callable[['RuleList'], object]] = None): - self.left: NonTerminal = non_terminal - self.right: Sentence = sentence - self.rule: Optional[Callable[['RuleList'], object]] = rule - - @property - def IsEpsilon(self): - return self.right.IsEpsilon - - def __str__(self): - return '%s := %s' % (self.left, self.right) - - def __repr__(self): - return '%s -> %s' % (self.left, self.right) - - def __iter__(self): - yield self.left - yield self.right - - def __eq__(self, other): - return isinstance(other, Production) and self.left == other.left and self.right == other.right - - def __hash__(self): - return hash((self.left, self.right)) - - -class Grammar: - def __init__(self): - self.productions: List[Production] = [] - self.non_terminals: List[NonTerminal] = [] - self.terminals: List[Terminal] = [] - self.start_symbol: Optional[NonTerminal] = None - - self.ERROR: ErrorTerminal = ErrorTerminal(self) - self.EPSILON: Epsilon = Epsilon(self) - self.EOF: EOF = EOF(self) - - self.lexical_error_handler = None # type: Optional[Callable[[Lexer], None]] - self.terminal_rules = {} # type: Dict[str, Tuple[str, bool, Optional[Callable[[Lexer], Optional[Token]]]]] - self.production_dict = {} # type: Dict[str, Production] - self.symbol_dict = {'$': self.EOF, 'error': self.ERROR} # type: Dict[str, Symbol] - - def add_terminal(self, name: str, regex: str = None, - rule: Optional[Callable[[Lexer], Optional[Token]]] = None) -> Terminal: - """ - Create a terminal for the grammar with its respective regular expression - - If not regex is given then the regular expression will be the literal name of the Terminal - - If the regex is given then de param name most be a valid python identifier - - All terminals with a not given regex will be marked as `literals` and then it will have a higher priority in - the lexer recognition above the others, and the reserved set will be sorted by the length of the regular - expression by descending - - The given rule must be a function - - :param name: str - - :param regex: str - - :param rule: function to handle the arrival of a token during the lexical process - - :return: Terminal - """ - name = name.strip() - if not name: - raise Exception("Empty name") - - assert name not in self.symbol_dict, f'Terminal {name} already defined in grammar' - - literal = False - if regex is None: - regex = re.escape(name) - literal = True - - term = Terminal(name, self) - self.terminals.append(term) - self.symbol_dict[name] = term - self.terminal_rules[name] = regex, literal, rule - return term - - def add_terminal_error(self): - self.terminals.append(self.ERROR) - - def add_terminals(self, names: str) -> Tuple[Terminal, ...]: - return tuple(self.add_terminal(x) for x in names.strip().split()) - - def add_non_terminal(self, name: str, start_symbol: bool = False) -> NonTerminal: - """ - Add and return a new non-terminal, use the start_symbol parameter for define the started symbol in th grammar, - if two non-terminal are marked as started symbol an AssertionError will be raised - - :param name: str - - :param start_symbol: bool - - :return: NonTerminal created - """ - name = name.strip() - if not name: - raise Exception("Empty name") - - assert name not in self.symbol_dict, f'Non-Terminal {name} already defined in grammar' - - term = NonTerminal(name, self) - - if start_symbol: - if self.start_symbol is None: - self.start_symbol = term - else: - raise Exception("Cannot define more than one start symbol.") - - self.non_terminals.append(term) - self.symbol_dict[name] = term - return term - - def add_non_terminals(self, names: str) -> Tuple[NonTerminal, ...]: - return tuple(self.add_non_terminal(x) for x in names.strip().split()) - - def add_production(self, production: Production): - production.left.productions.append(production) - self.productions.append(production) - self.production_dict[repr(production)] = production - - def production(self, production: str): - """ - Return a function to decorate a method that will be used for as production rule - - :param production: is a string representing the production to attach the decorated function, - the string has the form ' -> ' - - :return: a function to decorate the production - """ - - def decorator(rule: Optional[Callable[['RuleList'], object]]): - head, body = production.split('->') - head = self[head.strip()] - head %= body.strip(), rule - return rule - - return decorator - - def terminal(self, name: str, regex: str): - """ - Return a function to decorate a method that will be used for as terminal rule in tokenizer process - - :param name: the name of a terminal - - :param regex: the regex of the terminal - - :return: a function to decorate the production - """ - - def decorator(rule: Optional[Callable[[Lexer], Optional[Token]]]): - self.add_terminal(name, regex, rule) - return rule - - return decorator - - def lexical_error(self, handler: Callable[[Lexer], None]): - self.lexical_error_handler = handler - return handler - - def augmented_grammar(self, force: bool = False): - if not self.is_augmented_grammar or force: - - G = self.copy() - # S, self.startSymbol, SS = self.startSymbol, None, self.NonTerminal('S\'', True) - S = G.start_symbol - G.start_symbol = None - SS = G.add_non_terminal('S\'', True) - SS %= S + G.EPSILON, lambda x: x - - return G - else: - return self.copy() - - def copy(self): - G = Grammar() - G.productions = self.productions.copy() - G.non_terminals = self.non_terminals.copy() - G.terminals = self.terminals.copy() - G.start_symbol = self.start_symbol - G.EPSILON = self.EPSILON - G.ERROR = self.ERROR - G.EOF = self.EOF - G.symbol_dict = self.symbol_dict.copy() - - return G - - def serialize_lexer(self, class_name: str, grammar_module_name: str, grammar_variable_name: str = 'G'): - LexerSerializer.build(self, class_name, grammar_module_name, grammar_variable_name) - - @staticmethod - def serialize_parser(parser, class_name: str, grammar_module_name: str, grammar_variable_name: str = 'G'): - LRParserSerializer.build(parser, class_name, grammar_module_name, grammar_variable_name) - - def to_json(self): - - productions = [] - - for p in self.productions: - head = p.left.name - - body = [] - - for s in p.right: - body.append(s.Name) - - productions.append({'Head': head, 'Body': body}) - - d = {'NonTerminals': [symb.name for symb in self.non_terminals], - 'Terminals': [symb.name for symb in self.terminals], - 'Productions': productions} - - # [{'Head':p.Left.Name, "Body": [s.Name for s in p.Right]} for p in self.Productions] - return json.dumps(d) - - @property - def is_augmented_grammar(self): - augmented = 0 - for left, _ in self.productions: - if self.start_symbol == left: - augmented += 1 - if augmented <= 1: - return True - else: - return False - - @staticmethod - def from_json(data): - data = json.loads(data) - - G = Grammar() - dic = {'epsilon': G.EPSILON} - - for term in data['Terminals']: - dic[term] = G.add_terminal(term) - - for noTerm in data['NonTerminals']: - dic[noTerm] = G.add_non_terminal(noTerm) - - for p in data['Productions']: - head = p['Head'] - dic[head] %= Sentence(*[dic[term] for term in p['Body']]) - - return G - - def __getitem__(self, item): - try: - try: - return self.symbol_dict[item] - except KeyError: - return self.production_dict[item] - except KeyError: - return None - - def __str__(self): - - mul = '%s, ' - - ans = 'Non-Terminals:\n\t' - - nonterminals = mul * (len(self.non_terminals) - 1) + '%s\n' - - ans += nonterminals % tuple(self.non_terminals) - - ans += 'Terminals:\n\t' - - terminals = mul * (len(self.terminals) - 1) + '%s\n' - - ans += terminals % tuple(self.terminals) - - ans += 'Productions:\n\t' - - ans += str(self.productions) - - return ans - - -class Item: - def __init__(self, production: Production, pos: int, lookaheads: Iterable[Symbol] = None): - if lookaheads is None: - lookaheads = [] - self.production: Production = production - self.pos: int = pos - self.lookaheads: FrozenSet[Symbol] = frozenset(lookaheads) - - def __str__(self): - s = str(self.production.left) + " -> " - if len(self.production.right) > 0: - for i, _ in enumerate(self.production.right): - if i == self.pos: - s += "." - s += str(self.production.right[i]) + " " - if self.pos == len(self.production.right): - s += "." - else: - s += "." - s += ", " + str(self.lookaheads)[10:-1] - return s - - def __repr__(self): - return str(self) - - def __eq__(self, other): - return ( - (self.pos == other.pos) and - (self.production == other.production) and - (set(self.lookaheads) == set(other.lookaheads)) - ) - - def __hash__(self): - return hash((self.production, self.pos, self.lookaheads)) - - @property - def IsReduceItem(self) -> bool: - return len(self.production.right) == self.pos - - @property - def NextSymbol(self) -> Optional[Symbol]: - if self.pos < len(self.production.right): - return self.production.right[self.pos] - else: - return None - - def NextItem(self) -> Optional['Item']: - if self.pos < len(self.production.right): - return Item(self.production, self.pos + 1, self.lookaheads) - else: - return None - - def Preview(self, skip=1) -> List[Symbol]: - unseen = self.production.right[self.pos + skip:] - return [unseen + (lookahead,) for lookahead in self.lookaheads] - - def Center(self) -> 'Item': - return Item(self.production, self.pos) - - -class RuleList: - def __init__(self, parser, rules): - self.__parser = parser - self.__list = rules - - def __iter__(self): - return iter(self.__list) - - def __getitem__(self, item): - return self.__list[item] - - def __setitem__(self, key, value): - self.__list[key] = value - - def lineno(self, index): - pass - - def success(self): - pass - - def warning(self): - pass - - def error(self, index, message): - self.__parser.set_error(self[index].line, self[index].column, message) diff --git a/pyjapt/lexing.py b/pyjapt/lexing.py deleted file mode 100755 index 29425020f..000000000 --- a/pyjapt/lexing.py +++ /dev/null @@ -1,102 +0,0 @@ -import re -import sys -from typing import List, Any, Generator, Tuple, Pattern, Optional, Callable, Dict - - -class Token: - """ - A Token class. - - Parameters - ---------- - lex: str - Token's lexeme. - token_type: Enum - Token's type. - """ - - def __init__(self, lex, token_type, line=0, column=0): - """ - :param lex: str - :param token_type: Enum - :param line: int - :param column: int - """ - self.lex: str = lex - self.token_type: Any = token_type - self.line: int = line - self.column: int = column - - def __str__(self): - return f'{self.token_type}: {self.lex}' - - def __repr__(self): - return str(self) - - @property - def is_valid(self): - return True - - -class Lexer: - def __init__(self, table: List[Tuple[str, str]], eof: str, - token_rules: Optional[Dict[str, Callable[['Lexer'], Optional[Token]]]] = None, - error_handler: Optional[Callable[['Lexer'], None]] = None): - if token_rules is None: - token_rules = {} - - if error_handler is None: - error_handler = self.error - - self.lineno: int = 1 # Current line number - self.column: int = 1 # Current column in the line - self.position: int = 0 # Current position in recognition - self.token: Token = Token('', '', 0, 0) # Current token in recognition - self.pattern: Pattern = self._build_regex(table) - self.token_rules = token_rules # type: Dict[str, Callable[['Lexer'], Optional[Token]]] - self.contain_errors: bool = False - self.error_handler = error_handler # type: Callable[['Lexer'], None] - self.eof: str = eof - - def tokenize(self, text: str) -> Generator[Token, None, None]: - while self.position < len(text): - match = self.pattern.match(text, pos=self.position) - - if match is None: - self.contain_errors = True - self.token = Token(text[self.position], None, self.lineno, self.column) - self.error_handler(self) - continue - - lexeme = match.group() - token_type = match.lastgroup if match.lastgroup is not None else match.group() - self.token = Token(lexeme, token_type, self.lineno, self.column) - - if token_type in self.token_rules: - token = self.token_rules[token_type](self) - if token is not None and isinstance(token, Token): - yield token - continue - - yield self.token - - self.position = match.end() - self.column += len(match.group()) - yield Token('$', self.eof, self.lineno, self.column) - - @staticmethod - def print_error(error_msg): - sys.stderr.write(error_msg + '\n') - - @staticmethod - def error(lexer: 'Lexer') -> None: - lexer.print_error(f'LexerError: Unexpected symbol "{lexer.token.lex}"') - lexer.position += 1 - lexer.column += 1 - - @staticmethod - def _build_regex(table: List[Tuple[str, str]]) -> Pattern: - return re.compile('|'.join(['(?P<%s>%s)' % (name, regex) for name, regex in table])) - - def __call__(self, text: str) -> List[Token]: - return list(self.tokenize(text)) diff --git a/pyjapt/parsing.py b/pyjapt/parsing.py deleted file mode 100755 index dae04b278..000000000 --- a/pyjapt/parsing.py +++ /dev/null @@ -1,499 +0,0 @@ -import sys - -from pyjapt.automata import State -from pyjapt.grammar import Item, RuleList, Symbol -from pyjapt.lexing import Token -from pyjapt.utils import ContainerSet - - -############################## -# Compute Firsts and Follows # -############################## -def compute_local_first(firsts, alpha): - first_alpha = ContainerSet() - - try: - alpha_is_epsilon = alpha.IsEpsilon - except AttributeError: - alpha_is_epsilon = False - - if alpha_is_epsilon: - first_alpha.set_epsilon() - else: - for symbol in alpha: - first_symbol = firsts[symbol] - first_alpha.update(first_symbol) - if not first_symbol.contains_epsilon: - break - else: - first_alpha.set_epsilon() - - return first_alpha - - -def compute_firsts(G): - firsts = {} - change = True - - for terminal in G.terminals: - firsts[terminal] = ContainerSet(terminal) - - for nonterminal in G.non_terminals: - firsts[nonterminal] = ContainerSet() - - while change: - change = False - - # P: X -> alpha - for production in G.productions: - X, alpha = production - - first_X = firsts[X] - - try: - first_alpha = firsts[alpha] - except KeyError: - first_alpha = firsts[alpha] = ContainerSet() - - local_first = compute_local_first(firsts, alpha) - - change |= first_alpha.hard_update(local_first) - change |= first_X.hard_update(local_first) - - return firsts - - -def compute_follows(G, firsts): - follows = {} - change = True - - local_firsts = {} - - # init Follow(Vn) - for nonterminal in G.non_terminals: - follows[nonterminal] = ContainerSet() - follows[G.start_symbol] = ContainerSet(G.EOF) - - while change: - change = False - - # P: X -> alpha - for production in G.productions: - X = production.left - alpha = production.right - - follow_X = follows[X] - - for i, symbol_Y in enumerate(alpha): - # X -> zeta Y beta - if symbol_Y.IsNonTerminal: - follow_Y = follows[symbol_Y] - try: - first_beta = local_firsts[alpha, i] - except KeyError: - first_beta = local_firsts[alpha, i] = compute_local_first(firsts, alpha[i + 1:]) - # First(beta) - { epsilon } subset of Follow(Y) - change |= follow_Y.update(first_beta) - # beta ->* epsilon or X -> zeta Y ? Follow(X) subset of Follow(Y) - if first_beta.contains_epsilon: - change |= follow_Y.update(follow_X) - # Follow(Vn) - return follows - - -######################### -# LR0 AUTOMATA BUILDING # -######################### -def closure_lr0(items): - closure = set(items) - - pending = set(items) - while pending: - current = pending.pop() - symbol = current.NextSymbol - - if current.IsReduceItem or symbol.IsTerminal: - continue - - new_items = set(Item(p, 0) for p in symbol.productions) # if Item(p, 0) not in closure] - pending |= new_items - closure - closure |= new_items - return frozenset(closure) - - -def goto_lr0(items, symbol): - return frozenset(item.NextItem() for item in items if item.NextSymbol == symbol) - - -def build_lr0_automaton(G, just_kernel=False): - assert len(G.start_symbol.productions) == 1, 'Grammar must be augmented' - - start_production = G.start_symbol.productions[0] - start_item = Item(start_production, 0) - start = frozenset([start_item]) - - if not just_kernel: - automaton = State(closure_lr0(start), True) - else: - automaton = State(start, True) - - pending = [start] - visited = {start: automaton} - - symbols = G.terminals + G.non_terminals - while pending: - current = pending.pop() - current_state = visited[current] - current_closure = current_state.state if not just_kernel else closure_lr0(current) - for symbol in symbols: - kernel = goto_lr0(current_closure, symbol) - - if kernel == frozenset(): - continue - - try: - next_state = visited[kernel] - except KeyError: - next_state = visited[kernel] = State(closure_lr0(kernel), True) if not just_kernel else State(kernel, - True) - pending.append(kernel) - - current_state.add_transition(symbol.name, next_state) - return automaton - - -######################### -# LR1 AUTOMATA BUILDING # -######################### -def compress(items): - centers = {} - - for item in items: - center = item.Center() - try: - lookaheads = centers[center] - except KeyError: - centers[center] = lookaheads = set() - lookaheads.update(item.lookaheads) - - return set(Item(x.production, x.pos, set(lookaheads)) for x, lookaheads in centers.items()) - - -def expand(item, firsts): - next_symbol = item.NextSymbol - if next_symbol is None or not next_symbol.IsNonTerminal: - return [] - - lookaheads = ContainerSet() - - for preview in item.Preview(): - local_first = compute_local_first(firsts, preview) - lookaheads.update(local_first) - - assert not lookaheads.contains_epsilon - - return [Item(p, 0, lookaheads) for p in next_symbol.productions] - - -def closure_lr1(items, firsts): - closure = set(items) - pending = set(items) - while pending: - new_items = set(expand(pending.pop(), firsts)) - pending |= new_items - closure - closure |= new_items - return compress(closure) - - -def goto_lr1(items, symbol, firsts=None, just_kernel=False): - assert just_kernel or firsts is not None, '`firsts` must be provided if `just_kernel=False`' - items = frozenset(item.NextItem() for item in items if item.NextSymbol == symbol) - return items if just_kernel else closure_lr1(items, firsts) - - -def build_lr1_automaton(G, firsts=None): - assert len(G.start_symbol.productions) == 1, 'Grammar must be augmented' - - if not firsts: - firsts = compute_firsts(G) - firsts[G.EOF] = ContainerSet(G.EOF) - - start_production = G.start_symbol.productions[0] - start_item = Item(start_production, 0, lookaheads=(G.EOF,)) - start = frozenset([start_item]) - - closure = closure_lr1(start, firsts) - automaton = State(frozenset(closure), True) - - pending = [start] - visited = {start: automaton} - - symbols = G.terminals + G.non_terminals - while pending: - current = pending.pop() - current_state = visited[current] - - current_closure = current_state.state - for symbol in symbols: - kernel = goto_lr1(current_closure, symbol, just_kernel=True) - - if kernel == frozenset(): - continue - - try: - next_state = visited[kernel] - except KeyError: - goto = closure_lr1(kernel, firsts) - visited[kernel] = next_state = State(frozenset(goto), True) - pending.append(kernel) - current_state.add_transition(symbol.name, next_state) - - return automaton - - -########################### -# LALR1 AUTOMATA BUILDING # -########################### -def determining_lookaheads(state, propagate, table, firsts): - for item_kernel in state.state: - closure = closure_lr1([Item(item_kernel.production, item_kernel.pos, ('#',))], firsts) - for item in closure: - if item.IsReduceItem: - continue - - next_state = state.get(item.NextSymbol.name) - next_item = item.NextItem().Center() - if '#' in item.lookaheads: - propagate[state, item_kernel].append((next_state, next_item)) - table[next_state, next_item].extend(item.lookaheads - {'#'}) - - -def build_lalr1_automaton(G, firsts=None): - automaton = build_lr0_automaton(G, just_kernel=True) - - if not firsts: - firsts = compute_firsts(G) - firsts['#'] = ContainerSet('#') - firsts[G.EOF] = ContainerSet(G.EOF) - - table = {(state, item): ContainerSet() for state in automaton for item in state.state} - propagate = {(state, item): [] for state in automaton for item in state.state} - - for state in automaton: - determining_lookaheads(state, propagate, table, firsts) - del firsts['#'] - - start_item = list(automaton.state).pop() - table[automaton, start_item] = ContainerSet(G.EOF) - - change = True - while change: - change = False - for from_state, from_item in propagate: - for to_state, to_item in propagate[from_state, from_item]: - change |= table[to_state, to_item].extend(table[from_state, from_item]) - - for state in automaton: - for item in state.state: - item.lookaheads = frozenset(table[state, item]) - - for state in automaton: - state.state = frozenset(closure_lr1(state.state, firsts)) - - return automaton - - -############################# -# SLR & LR1 & LALR1 Parsers # -############################# -class ShiftReduceParser: - SHIFT = 'SHIFT' - REDUCE = 'REDUCE' - OK = 'OK' - contains_errors = False - - def __init__(self, G, verbose=False): - self.G = G - self.augmented_G = G.augmented_grammar(True) - self.firsts = compute_firsts(self.augmented_G) - self.follows = compute_follows(self.augmented_G, self.firsts) - self.automaton = self._build_automaton() - self.conflicts = [] - self.verbose = verbose - - self.action = {} - self.goto = {} - self.sr = 0 - self.rr = 0 - self._errors = [] - self._build_parsing_table() - - if self.conflicts: - sys.stderr.write(f"Warning: {self.sr} Shift-Reduce Conflicts\n") - sys.stderr.write(f"Warning: {self.rr} Reduce-Reduce Conflicts\n") - - ############## - # Errors API # - ############## - @property - def errors(self): - return [m for _, _, m in sorted(self._errors)] - - def set_error(self, line, column, message): - self._errors.append((line, column, message)) - ############# - # End # - ############# - - def _build_parsing_table(self): - G = self.augmented_G - automaton = self.automaton - - for i, node in enumerate(automaton): - node.id = i - - for node in automaton: - for item in node.state: - if item.IsReduceItem: - if item.production.left == G.start_symbol: - self._register(self.action, (node.id, G.EOF), (self.OK, None)) - else: - for lookahead in self._lookaheads(item): - self._register(self.action, (node.id, lookahead), (self.REDUCE, item.production)) - else: - symbol = item.NextSymbol - if symbol.IsTerminal: - self._register(self.action, (node.id, symbol), (self.SHIFT, node.get(symbol.name).id)) - else: - self._register(self.goto, (node.id, symbol), node.get(symbol.name).id) - - def _register(self, table, key, value): - if key in table and table[key] != value: - action, tag = table[key] - if action != value[0]: - if action == self.SHIFT: - table[key] = value # By default shifting if exists a Shift-Reduce Conflict - self.sr += 1 - self.conflicts.append(('SR', value[1], tag)) - else: - self.rr += 1 - self.conflicts.append(('RR', value[1], tag)) - else: - table[key] = value - - def _build_automaton(self): - raise NotImplementedError() - - def _lookaheads(self, item): - raise NotImplementedError() - - def __call__(self, tokens): - """ - Parse the given TokenList - - :param tokens: List[Token] - :return: Any - """ - inserted_error = False - stack: list = [0] # The order in stack is [init state] + [symbol, rule, state, ...] - cursor = 0 - - while True: - if cursor >= len(tokens): - return - - state = stack[-1] - lookahead = tokens[cursor] - - if self.verbose: - prev = ' '.join([s.name for s in stack if isinstance(s, Symbol)]) - post = ' '.join([tokens[i].lex for i in range(cursor, len(tokens))]) - print(f'{prev} <-> {post}') - print() - - ########################## - # Error Handling Section # - ########################## - if (state, lookahead.token_type) not in self.action: - self.contains_errors = True - - if (state, self.G.ERROR) in self.action: - if self.verbose: - print(f'Inserted error token {lookahead,}') - - inserted_error = True - lookahead = Token(lookahead.lex, self.G.ERROR, lookahead.line, lookahead.column) - else: - # If an error insertion fails then the parsing process enter into a panic mode recovery - sys.stderr.write( - f'{lookahead.line, lookahead.column} - SyntacticError: ERROR at or near "{lookahead.lex}"\n') - - while (state, lookahead.token_type) not in self.action: - cursor += 1 - if cursor >= len(tokens): - return - lookahead = tokens[cursor] - - continue - ####### - # End # - ####### - - action, tag = self.action[state, lookahead.token_type] - - if action == self.SHIFT: - # in this case tag is an integer - if self.verbose: - print(f'Shift: {lookahead.lex, tag}') - - if not inserted_error: - stack += [lookahead.token_type, lookahead.lex, tag] - cursor += 1 - else: - # the rule of an error token is the self token - stack += [lookahead.token_type, lookahead, tag] - elif action == self.REDUCE: - # in this case tag is a Production - if self.verbose: - print(f'Reduce: {repr(tag)}') - - head, body = tag - - rules = RuleList(self, [None] * (len(body) + 1)) - for i, s in enumerate(reversed(body), 1): - state, rules[-i], symbol = stack.pop(), stack.pop(), stack.pop() - assert s == symbol, f'ReduceError: in production "{repr(tag)}". Expected {s} instead of {s}' - - if tag.rule is not None: - rules[0] = tag.rule(rules) - - state = stack[-1] - goto = self.goto[state, head] - stack += [head, rules[0], goto] - elif action == self.OK: - return stack[2] - else: - raise Exception(f'ParsingError: invalid action {action}') - - inserted_error = False - - -class SLRParser(ShiftReduceParser): - def _build_automaton(self): - return build_lr0_automaton(self.augmented_G) - - def _lookaheads(self, item): - return self.follows[item.production.left] - - -class LR1Parser(ShiftReduceParser): - def _build_automaton(self): - return build_lr1_automaton(self.augmented_G, firsts=self.firsts) - - def _lookaheads(self, item): - return item.lookaheads - - -class LALR1Parser(LR1Parser): - def _build_automaton(self): - return build_lalr1_automaton(self.augmented_G, firsts=self.firsts) diff --git a/pyjapt/serialization.py b/pyjapt/serialization.py deleted file mode 100755 index 54c6fa759..000000000 --- a/pyjapt/serialization.py +++ /dev/null @@ -1,119 +0,0 @@ -import re - -PARSER_TEMPLATE = """from abc import ABC -from pyjapt.parsing import ShiftReduceParser -from %s import %s - - -class %s(ShiftReduceParser, ABC): - def __init__(self, verbose=False): - self.G = G - self.verbose = verbose - self.action = self.__action_table() - self.goto = self.__goto_table() - self._errors = [] - - @staticmethod - def __action_table(): - return %s - - @staticmethod - def __goto_table(): - return %s -""" - -LEXER_TEMPLATE = """import re - -from pyjapt.lexing import Token, Lexer -from %s import %s - - -class %s(Lexer): - def __init__(self): - self.lineno = 1 - self.column = 1 - self.position = 0 - self.token = Token('', '', 0, 0) - self.pattern = re.compile(r'%s') - self.token_rules = %s - self.error_handler = %s - self.contain_errors = False - self.eof = '%s' - - def __call__(self, text): - return %s -""" - - -class LRParserSerializer: - @staticmethod - def build(parser, parser_class_name, grammar_module_name, grammar_variable_name): - action, goto = LRParserSerializer._build_parsing_tables(parser, grammar_variable_name) - content = PARSER_TEMPLATE % (grammar_module_name, grammar_variable_name, parser_class_name, action, goto) - try: - with open('parsertab.py', 'x') as f: - f.write(content) - except FileExistsError: - with open('parsertab.py', 'w') as f: - f.write(content) - - @staticmethod - def _build_parsing_tables(parser, variable_name): - s1 = '{\n' - for (state, symbol), (act, tag) in parser.action.items(): - s1 += f' ({state}, {variable_name}["{symbol}"]): ' - - if act == 'SHIFT': - s1 += f'("{act}", {tag}),\n' - elif act == 'REDUCE': - s1 += f'("{act}", {variable_name}["{repr(tag)}"]),\n' - else: - s1 += f'("{act}", None),\n' - - s1 += ' }' - - s2 = '{\n' - for (state, symbol), dest in parser.goto.items(): - s2 += f' ({state}, {variable_name}["{symbol}"]): {dest},\n' - s2 += ' }' - - return s1, s2 - - -class LexerSerializer: - @staticmethod - def build(grammar, lexer_class_name, grammar_module_name, grammar_variable_name): - f1 = filter(lambda x: x[1][2] is not None, grammar.terminal_rules.items()) - f2 = filter(lambda x: x[1][2] is None and not x[1][1], grammar.terminal_rules.items()) - f3 = filter(lambda x: x[1][2] is None and x[1][1], grammar.terminal_rules.items()) - - ruled_tokens = list(f1) - not_literal_tokens = sorted(f2, key=lambda x: len(x[1][0]), reverse=True) - literal_tokens = sorted(f3, key=lambda x: len(x[1][0]), reverse=True) - - pattern = re.compile('|'.join( - ['(?P<%s>%s)' % (name, regex) for name, (regex, _, _) in ruled_tokens] + - ['(?P<%s>%s)' % (name, regex) for name, (regex, _, _) in not_literal_tokens] + - ['(%s)' % regex for _, (regex, _, _) in literal_tokens] - )).pattern - - token_rules = f"{{key: rule for key, (_, _, rule) in {grammar_variable_name}.terminal_rules.items() if rule " \ - f"is not None}}" - - error_handler = f"{grammar_variable_name}.lexical_error_handler if " \ - f"{grammar_variable_name}.lexical_error_handler is not None else self.error " - - call_return = f"[Token(t.lex, {grammar_variable_name}[t.token_type], t.line, t.column) for t in " \ - f"self.tokenize(text)] " - - content = LEXER_TEMPLATE % ( - grammar_module_name, grammar_variable_name, lexer_class_name, pattern, token_rules, error_handler, - grammar.EOF.name, call_return, - ) - - try: - with open('lexertab.py', 'x') as f: - f.write(content) - except FileExistsError: - with open('lexertab.py', 'w') as f: - f.write(content) diff --git a/pyjapt/utils.py b/pyjapt/utils.py deleted file mode 100755 index fec953cac..000000000 --- a/pyjapt/utils.py +++ /dev/null @@ -1,152 +0,0 @@ -class ContainerSet: - """ - Special class used for handling the existence of epsilon in a set of Symbols. It has all properties of a set - """ - - def __init__(self, *values, contains_epsilon: bool = False): - self.set: set = set(values) - self.contains_epsilon: bool = contains_epsilon - - def add(self, value) -> bool: - """ - Add a new value to the ContainerSet and return true if size was changed - :param value: value to be added - :return: True if the item was added - """ - n = len(self.set) - self.set.add(value) - return n != len(self.set) - - def extend(self, values) -> bool: - n = len(self.set) - self.set.update(values) - return n != len(self.set) - - def set_epsilon(self, value=True) -> bool: - last = self.contains_epsilon - self.contains_epsilon = value - return last != self.contains_epsilon - - def update(self, other) -> bool: - n = len(self.set) - self.set.update(other.set) - return n != len(self.set) - - def epsilon_update(self, other) -> bool: - return self.set_epsilon(self.contains_epsilon | other.contains_epsilon) - - def hard_update(self, other): - return self.update(other) | self.epsilon_update(other) - - def __contains__(self, item): - return item in self.set - - def __len__(self): - return len(self.set) + int(self.contains_epsilon) - - def __str__(self): - return '%s-%s' % (str(self.set), self.contains_epsilon) - - def __repr__(self): - return str(self) - - def __iter__(self): - return iter(self.set) - - def __nonzero__(self): - return len(self) > 0 - - def __eq__(self, other): - if isinstance(other, set): - return self.set == other - return isinstance(other, - ContainerSet) and self.set == other.set and self.contains_epsilon == other.contains_epsilon - - -class TrieNode: - def __init__(self, symbol, parent=None, final=False): - self.symbol = symbol - self.parent = parent - self.children = {} - self.count = 1 - self.final = final - - def add(self, symbol): - try: - self.children[symbol] - except KeyError: - self.children[symbol] = TrieNode(symbol, parent=self) - - def __getitem__(self, item): - return self.children[item] - - def __setitem__(self, key, value): - self.children[key] = value - - def __contains__(self, item): - return item in self.children - - def __iter__(self): - yield from self.children - - def __eq__(self, other): - return self.symbol == other.symbol - - -class Trie: - def __init__(self): - self.root: TrieNode = TrieNode('^') - self.root.count = 0 - - def insert(self, sentence): - index, node = self.__maximum_common_prefix(sentence) - for symbol in sentence[index:]: - node.add(symbol) - node = node[symbol] - node.final = True - self.root.count += 1 - - def extend(self, *sentences): - for s in sentences: - self.insert(s) - - def __maximum_common_prefix(self, sentence): - current: TrieNode = self.root - for i, symbol in enumerate(sentence): - try: - current = current[symbol] - current.count += 1 - except KeyError: - return i, current - return len(sentence), current - - def __from_prefix(self, prefix): - node: TrieNode = self.root - for symbol in prefix: - try: - node = node[symbol] - except KeyError: - return [] - - yield from Trie.__search_from_node(node, prefix) - - @staticmethod - def __search_from_node(node, sentence): - if node.final: - yield sentence - - for child in node: - yield from Trie.__search_from_node(node[child], sentence + child) - - def __len__(self): - return self.root.count - - def __iter__(self): - yield from self.__search_from_node(self.root, "") - - def __call__(self, prefix): - yield from self.__from_prefix(prefix) - - def __contains__(self, item): - i, node = self.__maximum_common_prefix(item) - return i == len(item) and node.final diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000..65dd2e244 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +pyjapt~=0.1.6 \ No newline at end of file From e8fcbc1e0f16076ced10b03944618477e73de0d1 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Sun, 18 Oct 2020 18:04:52 +0200 Subject: [PATCH 072/143] - --- .gitignore | 3 - cool.py | 71 +--------------- requirements.txt | 2 +- semantics/formatter.py | 82 +++++++++--------- semantics/type_collector.py | 2 +- semantics/type_inference.py | 9 +- tests/__init__.py | 0 tests/inference/01_program.cl | 16 ++++ tests/inference/01_result.cl | 19 +++++ tests/inference/02_program.cl | 15 ++++ tests/inference/02_result.cl | 21 +++++ tests/inference/03_program.cl | 17 ++++ tests/inference/03_result.cl | 23 +++++ tests/inference/04_program.cl | 16 ++++ tests/inference/04_result.cl | 19 +++++ tests/lexer/comment1.cl | 55 ------------ tests/lexer/comment1_error.txt | 1 - tests/lexer/iis1.cl | 111 ------------------------ tests/lexer/iis1_error.txt | 1 - tests/lexer/iis2.cl | 120 -------------------------- tests/lexer/iis2_error.txt | 1 - tests/lexer/iis3.cl | 121 --------------------------- tests/lexer/iis3_error.txt | 1 - tests/lexer/iis4.cl | 120 -------------------------- tests/lexer/iis4_error.txt | 1 - tests/lexer/iis5.cl | 121 --------------------------- tests/lexer/iis5_error.txt | 2 - tests/lexer/iis6.cl | 125 ---------------------------- tests/lexer/iis6_error.txt | 1 - tests/lexer/mixed1.cl | 14 ---- tests/lexer/mixed1_error.txt | 1 - tests/lexer/mixed2.cl | 20 ----- tests/lexer/mixed2_error.txt | 3 - tests/lexer/string1.cl | 6 -- tests/lexer/string1_error.txt | 2 - tests/lexer/string2.cl | 19 ----- tests/lexer/string2_error.txt | 1 - tests/lexer/string3.cl | Bin 234 -> 0 bytes tests/lexer/string3_error.txt | 1 - tests/lexer/string4.cl | 38 --------- tests/lexer/string4_error.txt | 3 - tests/parser/assignment1.cl | 37 -------- tests/parser/assignment1_error.txt | 1 - tests/parser/assignment2.cl | 37 -------- tests/parser/assignment2_error.txt | 1 - tests/parser/assignment3.cl | 37 -------- tests/parser/assignment3_error.txt | 1 - tests/parser/attribute1.cl | 34 -------- tests/parser/attribute1_error.txt | 1 - tests/parser/attribute2.cl | 34 -------- tests/parser/attribute2_error.txt | 1 - tests/parser/attribute3.cl | 34 -------- tests/parser/attribute3_error.txt | 1 - tests/parser/block1.cl | 87 ------------------- tests/parser/block1_error.txt | 1 - tests/parser/block2.cl | 87 ------------------- tests/parser/block2_error.txt | 1 - tests/parser/block3.cl | 87 ------------------- tests/parser/block3_error.txt | 1 - tests/parser/block4.cl | 88 -------------------- tests/parser/block4_error.txt | 1 - tests/parser/case1.cl | 91 -------------------- tests/parser/case1_error.txt | 1 - tests/parser/case2.cl | 93 --------------------- tests/parser/case2_error.txt | 1 - tests/parser/case3.cl | 93 --------------------- tests/parser/case3_error.txt | 1 - tests/parser/case4.cl | 93 --------------------- tests/parser/case4_error.txt | 1 - tests/parser/case5.cl | 93 --------------------- tests/parser/case5_error.txt | 1 - tests/parser/case6.cl | 93 --------------------- tests/parser/case6_error.txt | 1 - tests/parser/class1.cl | 20 ----- tests/parser/class1_error.txt | 1 - tests/parser/class2.cl | 20 ----- tests/parser/class2_error.txt | 1 - tests/parser/class3.cl | 34 -------- tests/parser/class3_error.txt | 1 - tests/parser/class4.cl | 36 -------- tests/parser/class4_error.txt | 1 - tests/parser/class5.cl | 34 -------- tests/parser/class5_error.txt | 1 - tests/parser/class6.cl | 34 -------- tests/parser/class6_error.txt | 1 - tests/parser/conditional1.cl | 69 --------------- tests/parser/conditional1_error.txt | 1 - tests/parser/conditional2.cl | 69 --------------- tests/parser/conditional2_error.txt | 1 - tests/parser/conditional3.cl | 69 --------------- tests/parser/conditional3_error.txt | 1 - tests/parser/conditional4.cl | 73 ---------------- tests/parser/conditional4_error.txt | 1 - tests/parser/conditional5.cl | 73 ---------------- tests/parser/conditional5_error.txt | 1 - tests/parser/conditional6.cl | 73 ---------------- tests/parser/conditional6_error.txt | 1 - tests/parser/dispatch1.cl | 45 ---------- tests/parser/dispatch1_error.txt | 1 - tests/parser/dispatch2.cl | 45 ---------- tests/parser/dispatch2_error.txt | 1 - tests/parser/dispatch3.cl | 45 ---------- tests/parser/dispatch3_error.txt | 1 - tests/parser/dispatch4.cl | 53 ------------ tests/parser/dispatch4_error.txt | 1 - tests/parser/dispatch5.cl | 53 ------------ tests/parser/dispatch5_error.txt | 1 - tests/parser/dispatch6.cl | 57 ------------- tests/parser/dispatch6_error.txt | 1 - tests/parser/dispatch7.cl | 57 ------------- tests/parser/dispatch7_error.txt | 1 - tests/parser/dispatch8.cl | 57 ------------- tests/parser/dispatch8_error.txt | 1 - tests/parser/dispatch9.cl | 61 -------------- tests/parser/dispatch9_error.txt | 1 - tests/parser/let1.cl | 85 ------------------- tests/parser/let1_error.txt | 1 - tests/parser/let2.cl | 85 ------------------- tests/parser/let2_error.txt | 1 - tests/parser/let3.cl | 85 ------------------- tests/parser/let3_error.txt | 1 - tests/parser/let4.cl | 85 ------------------- tests/parser/let4_error.txt | 1 - tests/parser/let5.cl | 85 ------------------- tests/parser/let5_error.txt | 1 - tests/parser/let6.cl | 74 ---------------- tests/parser/let6_error.txt | 1 - tests/parser/let7.cl | 85 ------------------- tests/parser/let7_error.txt | 1 - tests/parser/loop1.cl | 78 ----------------- tests/parser/loop1_error.txt | 1 - tests/parser/loop2.cl | 78 ----------------- tests/parser/loop2_error.txt | 1 - tests/parser/loop3.cl | 78 ----------------- tests/parser/loop3_error.txt | 1 - tests/parser/loop4.cl | 78 ----------------- tests/parser/loop4_error.txt | 1 - tests/parser/method1.cl | 34 -------- tests/parser/method1_error.txt | 1 - tests/parser/method2.cl | 34 -------- tests/parser/method2_error.txt | 1 - tests/parser/method3.cl | 34 -------- tests/parser/method3_error.txt | 1 - tests/parser/method4.cl | 34 -------- tests/parser/method4_error.txt | 1 - tests/parser/method5.cl | 34 -------- tests/parser/method5_error.txt | 1 - tests/parser/method6.cl | 33 -------- tests/parser/method6_error.txt | 1 - tests/parser/mixed1.cl | 100 ---------------------- tests/parser/mixed1_error.txt | 1 - tests/parser/mixed2.cl | 14 ---- tests/parser/mixed2_error.txt | 1 - tests/parser/mixed3.cl | 40 --------- tests/parser/mixed3_error.txt | 1 - tests/parser/mixed4.cl | 21 ----- tests/parser/mixed4_error.txt | 1 - tests/parser/mixed5.cl | 20 ----- tests/parser/mixed5_error.txt | 1 - tests/parser/mixed6.cl | 5 -- tests/parser/mixed6_error.txt | 1 - tests/parser/operation1.cl | 101 ---------------------- tests/parser/operation1_error.txt | 1 - tests/parser/operation2.cl | 101 ---------------------- tests/parser/operation2_error.txt | 1 - tests/parser/operation3.cl | 101 ---------------------- tests/parser/operation3_error.txt | 1 - tests/parser/operation4.cl | 101 ---------------------- tests/parser/operation4_error.txt | 1 - tests/parser/program1.cl | 1 - tests/parser/program1_error.txt | 1 - tests/parser/program2.cl | 20 ----- tests/parser/program2_error.txt | 1 - tests/parser/program3.cl | 24 ------ tests/parser/program3_error.txt | 1 - tests/semantic/hello_world.cl | 5 -- tests/test_inference.py | 65 +++++++++++++++ 177 files changed, 258 insertions(+), 5026 deletions(-) create mode 100644 tests/__init__.py create mode 100644 tests/inference/01_program.cl create mode 100644 tests/inference/01_result.cl create mode 100644 tests/inference/02_program.cl create mode 100644 tests/inference/02_result.cl create mode 100644 tests/inference/03_program.cl create mode 100644 tests/inference/03_result.cl create mode 100644 tests/inference/04_program.cl create mode 100644 tests/inference/04_result.cl delete mode 100755 tests/lexer/comment1.cl delete mode 100755 tests/lexer/comment1_error.txt delete mode 100755 tests/lexer/iis1.cl delete mode 100755 tests/lexer/iis1_error.txt delete mode 100755 tests/lexer/iis2.cl delete mode 100755 tests/lexer/iis2_error.txt delete mode 100755 tests/lexer/iis3.cl delete mode 100755 tests/lexer/iis3_error.txt delete mode 100755 tests/lexer/iis4.cl delete mode 100755 tests/lexer/iis4_error.txt delete mode 100755 tests/lexer/iis5.cl delete mode 100755 tests/lexer/iis5_error.txt delete mode 100755 tests/lexer/iis6.cl delete mode 100755 tests/lexer/iis6_error.txt delete mode 100755 tests/lexer/mixed1.cl delete mode 100755 tests/lexer/mixed1_error.txt delete mode 100755 tests/lexer/mixed2.cl delete mode 100755 tests/lexer/mixed2_error.txt delete mode 100755 tests/lexer/string1.cl delete mode 100755 tests/lexer/string1_error.txt delete mode 100755 tests/lexer/string2.cl delete mode 100755 tests/lexer/string2_error.txt delete mode 100755 tests/lexer/string3.cl delete mode 100755 tests/lexer/string3_error.txt delete mode 100755 tests/lexer/string4.cl delete mode 100755 tests/lexer/string4_error.txt delete mode 100755 tests/parser/assignment1.cl delete mode 100755 tests/parser/assignment1_error.txt delete mode 100755 tests/parser/assignment2.cl delete mode 100755 tests/parser/assignment2_error.txt delete mode 100755 tests/parser/assignment3.cl delete mode 100755 tests/parser/assignment3_error.txt delete mode 100755 tests/parser/attribute1.cl delete mode 100755 tests/parser/attribute1_error.txt delete mode 100755 tests/parser/attribute2.cl delete mode 100755 tests/parser/attribute2_error.txt delete mode 100755 tests/parser/attribute3.cl delete mode 100755 tests/parser/attribute3_error.txt delete mode 100755 tests/parser/block1.cl delete mode 100755 tests/parser/block1_error.txt delete mode 100755 tests/parser/block2.cl delete mode 100755 tests/parser/block2_error.txt delete mode 100755 tests/parser/block3.cl delete mode 100755 tests/parser/block3_error.txt delete mode 100755 tests/parser/block4.cl delete mode 100755 tests/parser/block4_error.txt delete mode 100755 tests/parser/case1.cl delete mode 100755 tests/parser/case1_error.txt delete mode 100755 tests/parser/case2.cl delete mode 100755 tests/parser/case2_error.txt delete mode 100755 tests/parser/case3.cl delete mode 100755 tests/parser/case3_error.txt delete mode 100755 tests/parser/case4.cl delete mode 100755 tests/parser/case4_error.txt delete mode 100755 tests/parser/case5.cl delete mode 100755 tests/parser/case5_error.txt delete mode 100755 tests/parser/case6.cl delete mode 100755 tests/parser/case6_error.txt delete mode 100755 tests/parser/class1.cl delete mode 100755 tests/parser/class1_error.txt delete mode 100755 tests/parser/class2.cl delete mode 100755 tests/parser/class2_error.txt delete mode 100755 tests/parser/class3.cl delete mode 100755 tests/parser/class3_error.txt delete mode 100755 tests/parser/class4.cl delete mode 100755 tests/parser/class4_error.txt delete mode 100755 tests/parser/class5.cl delete mode 100755 tests/parser/class5_error.txt delete mode 100755 tests/parser/class6.cl delete mode 100755 tests/parser/class6_error.txt delete mode 100755 tests/parser/conditional1.cl delete mode 100755 tests/parser/conditional1_error.txt delete mode 100755 tests/parser/conditional2.cl delete mode 100755 tests/parser/conditional2_error.txt delete mode 100755 tests/parser/conditional3.cl delete mode 100755 tests/parser/conditional3_error.txt delete mode 100755 tests/parser/conditional4.cl delete mode 100755 tests/parser/conditional4_error.txt delete mode 100755 tests/parser/conditional5.cl delete mode 100755 tests/parser/conditional5_error.txt delete mode 100755 tests/parser/conditional6.cl delete mode 100755 tests/parser/conditional6_error.txt delete mode 100755 tests/parser/dispatch1.cl delete mode 100755 tests/parser/dispatch1_error.txt delete mode 100755 tests/parser/dispatch2.cl delete mode 100755 tests/parser/dispatch2_error.txt delete mode 100755 tests/parser/dispatch3.cl delete mode 100755 tests/parser/dispatch3_error.txt delete mode 100755 tests/parser/dispatch4.cl delete mode 100755 tests/parser/dispatch4_error.txt delete mode 100755 tests/parser/dispatch5.cl delete mode 100755 tests/parser/dispatch5_error.txt delete mode 100755 tests/parser/dispatch6.cl delete mode 100755 tests/parser/dispatch6_error.txt delete mode 100755 tests/parser/dispatch7.cl delete mode 100755 tests/parser/dispatch7_error.txt delete mode 100755 tests/parser/dispatch8.cl delete mode 100755 tests/parser/dispatch8_error.txt delete mode 100755 tests/parser/dispatch9.cl delete mode 100755 tests/parser/dispatch9_error.txt delete mode 100755 tests/parser/let1.cl delete mode 100755 tests/parser/let1_error.txt delete mode 100755 tests/parser/let2.cl delete mode 100755 tests/parser/let2_error.txt delete mode 100755 tests/parser/let3.cl delete mode 100755 tests/parser/let3_error.txt delete mode 100755 tests/parser/let4.cl delete mode 100755 tests/parser/let4_error.txt delete mode 100755 tests/parser/let5.cl delete mode 100755 tests/parser/let5_error.txt delete mode 100755 tests/parser/let6.cl delete mode 100755 tests/parser/let6_error.txt delete mode 100755 tests/parser/let7.cl delete mode 100755 tests/parser/let7_error.txt delete mode 100755 tests/parser/loop1.cl delete mode 100755 tests/parser/loop1_error.txt delete mode 100755 tests/parser/loop2.cl delete mode 100755 tests/parser/loop2_error.txt delete mode 100755 tests/parser/loop3.cl delete mode 100755 tests/parser/loop3_error.txt delete mode 100755 tests/parser/loop4.cl delete mode 100755 tests/parser/loop4_error.txt delete mode 100755 tests/parser/method1.cl delete mode 100755 tests/parser/method1_error.txt delete mode 100755 tests/parser/method2.cl delete mode 100755 tests/parser/method2_error.txt delete mode 100755 tests/parser/method3.cl delete mode 100755 tests/parser/method3_error.txt delete mode 100755 tests/parser/method4.cl delete mode 100755 tests/parser/method4_error.txt delete mode 100755 tests/parser/method5.cl delete mode 100755 tests/parser/method5_error.txt delete mode 100755 tests/parser/method6.cl delete mode 100755 tests/parser/method6_error.txt delete mode 100755 tests/parser/mixed1.cl delete mode 100755 tests/parser/mixed1_error.txt delete mode 100755 tests/parser/mixed2.cl delete mode 100755 tests/parser/mixed2_error.txt delete mode 100755 tests/parser/mixed3.cl delete mode 100755 tests/parser/mixed3_error.txt delete mode 100755 tests/parser/mixed4.cl delete mode 100755 tests/parser/mixed4_error.txt delete mode 100755 tests/parser/mixed5.cl delete mode 100755 tests/parser/mixed5_error.txt delete mode 100755 tests/parser/mixed6.cl delete mode 100755 tests/parser/mixed6_error.txt delete mode 100755 tests/parser/operation1.cl delete mode 100755 tests/parser/operation1_error.txt delete mode 100755 tests/parser/operation2.cl delete mode 100755 tests/parser/operation2_error.txt delete mode 100755 tests/parser/operation3.cl delete mode 100755 tests/parser/operation3_error.txt delete mode 100755 tests/parser/operation4.cl delete mode 100755 tests/parser/operation4_error.txt delete mode 100755 tests/parser/program1.cl delete mode 100755 tests/parser/program1_error.txt delete mode 100755 tests/parser/program2.cl delete mode 100755 tests/parser/program2_error.txt delete mode 100755 tests/parser/program3.cl delete mode 100755 tests/parser/program3_error.txt delete mode 100755 tests/semantic/hello_world.cl create mode 100644 tests/test_inference.py diff --git a/.gitignore b/.gitignore index aa556c4f6..ec0d0b674 100755 --- a/.gitignore +++ b/.gitignore @@ -125,9 +125,6 @@ dmypy.json .idea .vscode -tests/*.py -tests/*/*.py -tests/codegen scripts Sera borrado Untitled.ipynb Sera borrado output.txt diff --git a/cool.py b/cool.py index 593257206..03cc3a883 100644 --- a/cool.py +++ b/cool.py @@ -8,75 +8,6 @@ from semantics.type_inference import InferenceChecker from semantics.utils.scope import Context, Scope -execution_errors = r""" -(* class A { - a (n: Int) : Int { 0 }; -} - -class B inherits A { - a (x: String) : String { 1 }; -} *) - -class Main { - x: Int; - - main (): Object { - let a: Main in a.f() - }; - - f() : Int { - 0 - }; -} -""" - -inference_program_01 = r""" -class Main { main (): Object { 0 }; } - -class Point { - x: AUTO_TYPE; - y: AUTO_TYPE; - - init(x0: Int, y0: Int): AUTO_TYPE {{ - x <- x0; - y <- y0; - self; - }}; -} -""" - -inference_program_02 = r""" -class Main { main (): Object { 0 }; } - -class Ackermann { - ackermann(m: AUTO_TYPE, n: AUTO_TYPE): AUTO_TYPE { - if m = 0 then n + 1 else - if n = 0 then ackermann(m - 1, 1) else - ackermann(m - 1, ackermann(m, n - 1)) - fi - fi - }; -} -""" - -inference_program_03 = r""" -class Main { - main (): Object { 0 }; - - f(a: AUTO_TYPE, b: AUTO_TYPE): AUTO_TYPE { - if a = 1 then b else - g(a + 1, b / 1) - fi - }; - - g(a: AUTO_TYPE, b: AUTO_TYPE): AUTO_TYPE { - if b = 1 then a else - f(a / 2, b + 1) - fi - }; -} -""" - execution_program_01 = r""" class A { } @@ -151,7 +82,7 @@ class Main { if __name__ == '__main__': - tokens = lexer(syntactic_errors) + tokens = lexer(execution_program_01) ast = parser(tokens) if parser.contains_errors: diff --git a/requirements.txt b/requirements.txt index 65dd2e244..01f73f3d5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -pyjapt~=0.1.6 \ No newline at end of file +pyjapt~=0.1.7 \ No newline at end of file diff --git a/semantics/formatter.py b/semantics/formatter.py index f7c7112a0..c0a5ebb2e 100644 --- a/semantics/formatter.py +++ b/semantics/formatter.py @@ -21,14 +21,14 @@ def visit(self, node: ast.ClassDeclarationNode, tabs: int = 0): @visitor.when(ast.AttrDeclarationNode) def visit(self, node: ast.AttrDeclarationNode, tabs: int = 0): expr = f' <- {self.visit(node.expr, 0)}' if node.expr is not None else '' - return '\t' * tabs + f'{node.id}: {node.type}{expr};' + return ' ' * tabs + f'{node.id}: {node.type}{expr};' @visitor.when(ast.MethodDeclarationNode) def visit(self, node: ast.MethodDeclarationNode, tabs: int = 0): params = ', '.join(': '.join(param) for param in node.params) - ans = '\t' * tabs + f'{node.id} ({params}): {node.return_type}' + ans = ' ' * tabs + f'{node.id} ({params}): {node.return_type}' body = self.visit(node.body, tabs + 1) - return f'{ans} {{\n{body}\n\t}};' + return f'{ans} {{\n{body}\n }};' @visitor.when(ast.LetNode) def visit(self, node: ast.LetNode, tabs: int = 0): @@ -38,17 +38,17 @@ def visit(self, node: ast.LetNode, tabs: int = 0): declarations.append(f'{_id}: {_type} <- {self.visit(_expr)}') else: declarations.append(f'{_id} : {_type}') - declarations = ('\n' + '\t' * (tabs + 1)).join(declarations) - return '\t' * tabs + f'let {declarations} in \n{self.visit(node.expr, tabs + 1)}' + declarations = ('\n' + ' ' * (tabs + 1)).join(declarations) + return ' ' * tabs + f'let {declarations} in \n{self.visit(node.expr, tabs + 1)}' @visitor.when(ast.AssignNode) def visit(self, node: ast.AssignNode, tabs: int = 0): - return '\t' * tabs + f'{node.id} <- {self.visit(node.expr)}' + return ' ' * tabs + f'{node.id} <- {self.visit(node.expr)}' @visitor.when(ast.BlockNode) def visit(self, node: ast.BlockNode, tabs: int = 0): body = ';\n'.join(self.visit(child, tabs + 1) for child in node.expressions) - return '\t' * tabs + f'{{\n{body};\n' + '\t' * tabs + '}' + return ' ' * tabs + f'{{\n{body};\n' + ' ' * tabs + '}' @visitor.when(ast.ConditionalNode) def visit(self, node: ast.ConditionalNode, tabs: int = 0): @@ -56,33 +56,33 @@ def visit(self, node: ast.ConditionalNode, tabs: int = 0): then = self.visit(node.then_expr, tabs + 1) elsex = self.visit(node.else_expr, tabs + 1) - return ('\t' * tabs + f'if {ifx}\n' + - '\t' * tabs + f'then\n{then}\n' + - '\t' * tabs + f'else\n{elsex}\n' + - '\t' * tabs + 'fi') + return (' ' * tabs + f'if {ifx}\n' + + ' ' * tabs + f'then\n{then}\n' + + ' ' * tabs + f'else\n{elsex}\n' + + ' ' * tabs + 'fi') @visitor.when(ast.WhileNode) def visit(self, node: ast.WhileNode, tabs: int = 0): condition = self.visit(node.condition, 0) body = self.visit(node.body, tabs + 1) - return '\t' * tabs + f'while {condition} loop\n {body}\n' + '\t' * tabs + 'pool' + return ' ' * tabs + f'while {condition} loop\n {body}\n' + ' ' * tabs + 'pool' @visitor.when(ast.SwitchCaseNode) def visit(self, node: ast.SwitchCaseNode, tabs: int = 0): cases = [] for _id, _type, _expr in node.cases: expr = self.visit(_expr, tabs + 2) - cases.append('\t' * (tabs + 1) + f'{_id} : {_type} =>\n{expr};') + cases.append(' ' * (tabs + 1) + f'{_id} : {_type} =>\n{expr};') expr = self.visit(node.expr) cases = '\n'.join(cases) - return '\t' * tabs + f'case {expr} of \n{cases}\n' + '\t' * tabs + 'esac' + return ' ' * tabs + f'case {expr} of \n{cases}\n' + ' ' * tabs + 'esac' @visitor.when(ast.MethodCallNode) def visit(self, node: ast.MethodCallNode, tabs: int = 0): obj = f'{self.visit(node.obj, 0)}.' if node.obj is not None else '' - return '\t' * tabs + f'{obj}{node.id}({", ".join(self.visit(arg, 0) for arg in node.args)})' + return ' ' * tabs + f'{obj}{node.id}({", ".join(self.visit(arg, 0) for arg in node.args)})' @visitor.when(ast.BinaryNode) def visit(self, node: ast.BinaryNode, tabs: int = 0): @@ -92,11 +92,11 @@ def visit(self, node: ast.BinaryNode, tabs: int = 0): @visitor.when(ast.AtomicNode) def visit(self, node: ast.AtomicNode, tabs: int = 0): - return '\t' * tabs + f'{node.lex}' + return ' ' * tabs + f'{node.lex}' @visitor.when(ast.InstantiateNode) def visit(self, node: ast.InstantiateNode, tabs: int = 0): - return '\t' * tabs + f'new {node.lex}' + return ' ' * tabs + f'new {node.lex}' class Formatter: @@ -106,26 +106,26 @@ def visit(self, node, tabs): @visitor.when(ast.ProgramNode) def visit(self, node: ast.ProgramNode, tabs: int = 0): - ans = '\t' * tabs + f'\\__ProgramNode [ ... ]' + ans = ' ' * tabs + f'\\__ProgramNode [ ... ]' statements = '\n'.join(self.visit(child, tabs + 1) for child in node.declarations) return f'{ans}\n{statements}' @visitor.when(ast.ClassDeclarationNode) def visit(self, node: ast.ClassDeclarationNode, tabs: int = 0): parent = '' if node.parent is None else f": {node.parent}" - ans = '\t' * tabs + f'\\__ClassDeclarationNode: class {node.id} {parent} {{ ... }}' + ans = ' ' * 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(ast.AttrDeclarationNode) def visit(self, node: ast.AttrDeclarationNode, tabs: int = 0): - ans = '\t' * tabs + f'\\__AttrDeclarationNode: {node.id} : {node.type}' + ans = ' ' * tabs + f'\\__AttrDeclarationNode: {node.id} : {node.type}' return f'{ans}' @visitor.when(ast.MethodDeclarationNode) def visit(self, node: ast.MethodDeclarationNode, tabs: int = 0): params = ', '.join(':'.join(param) for param in node.params) - ans = '\t' * tabs + f'\\__FuncDeclarationNode: {node.id}({params}) : {node.return_type} -> ' + ans = ' ' * tabs + f'\\__FuncDeclarationNode: {node.id}({params}) : {node.return_type} -> ' body = self.visit(node.body, tabs + 1) return f'{ans}\n{body}' @@ -134,24 +134,24 @@ def visit(self, node: ast.LetNode, tabs: int = 0): declarations = [] for _id, _type, _expr in node.declarations: if _expr is not None: - declarations.append('\t' * tabs + f'\\__VarDeclarationNode: {_id}: {_type} <-\n{self.visit(_expr, tabs + 1)}') + declarations.append(' ' * tabs + f'\\__VarDeclarationNode: {_id}: {_type} <-\n{self.visit(_expr, tabs + 1)}') else: - declarations.append('\t' * tabs + f'\\__VarDeclarationNode: {_id} : {_type}') + declarations.append(' ' * tabs + f'\\__VarDeclarationNode: {_id} : {_type}') declarations = '\n'.join(declarations) - ans = '\t' * tabs + f'\\__LetNode: let' + ans = ' ' * tabs + f'\\__LetNode: let' expr = self.visit(node.expr, tabs + 2) - return f'{ans}\n {declarations}\n' + '\t' * (tabs + 1) + 'in\n' + f'{expr}' + return f'{ans}\n {declarations}\n' + ' ' * (tabs + 1) + 'in\n' + f'{expr}' @visitor.when(ast.AssignNode) def visit(self, node: ast.AssignNode, tabs: int = 0): - ans = '\t' * tabs + f'\\__AssignNode: {node.id} <- ' + ans = ' ' * tabs + f'\\__AssignNode: {node.id} <- ' expr = self.visit(node.expr, tabs + 1) return f'{ans}\n{expr}' @visitor.when(ast.BlockNode) def visit(self, node: ast.BlockNode, tabs: int = 0): - ans = '\t' * tabs + f'\\__BlockNode:' + ans = ' ' * tabs + f'\\__BlockNode:' body = '\n'.join(self.visit(child, tabs + 1) for child in node.expressions) return f'{ans}\n{body}' @@ -162,10 +162,10 @@ def visit(self, node: ast.ConditionalNode, tabs: int = 0): elsex = self.visit(node.else_expr, tabs + 2) return '\n'.join([ - '\t' * tabs + f'\\__IfThenElseNode: if then else fi', - '\t' * (tabs + 1) + f'\\__if \n{ifx}', - '\t' * (tabs + 1) + f'\\__then \n{then}', - '\t' * (tabs + 1) + f'\\__else \n{elsex}', + ' ' * tabs + f'\\__IfThenElseNode: if then else fi', + ' ' * (tabs + 1) + f'\\__if \n{ifx}', + ' ' * (tabs + 1) + f'\\__then \n{then}', + ' ' * (tabs + 1) + f'\\__else \n{elsex}', ]) @visitor.when(ast.WhileNode) @@ -174,9 +174,9 @@ def visit(self, node: ast.WhileNode, tabs: int = 0): body = self.visit(node.body, tabs + 2) return '\n'.join([ - '\t' * tabs + f'\\__WhileNode: while loop pool', - '\t' * (tabs + 1) + f'\\__while \n{condition}', - '\t' * (tabs + 1) + f'\\__loop \n{body}', + ' ' * tabs + f'\\__WhileNode: while loop pool', + ' ' * (tabs + 1) + f'\\__while \n{condition}', + ' ' * (tabs + 1) + f'\\__loop \n{body}', ]) @visitor.when(ast.SwitchCaseNode) @@ -184,33 +184,33 @@ def visit(self, node: ast.SwitchCaseNode, tabs: int = 0): cases = [] for _id, _type, _expr in node.cases: expr = self.visit(_expr, tabs + 3) - cases.append('\t' * tabs + f'\\__CaseNode: {_id} : {_type} =>\n{expr}') + cases.append(' ' * tabs + f'\\__CaseNode: {_id} : {_type} =>\n{expr}') expr = self.visit(node.expr, tabs + 2) cases = '\n'.join(cases) return '\n'.join([ - '\t' * tabs + f'\\__SwitchCaseNode: case of [ ... ] esac', - '\t' * (tabs + 1) + f'\\__case \n{expr} of', + ' ' * tabs + f'\\__SwitchCaseNode: case of [ ... ] esac', + ' ' * (tabs + 1) + f'\\__case \n{expr} of', ]) + '\n' + cases @visitor.when(ast.MethodCallNode) def visit(self, node: ast.MethodCallNode, tabs: int = 0): obj = self.visit(node.obj, tabs + 1) - ans = '\t' * tabs + f'\\__CallNode: .{node.id}(, ..., )' + ans = ' ' * 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(ast.BinaryNode) def visit(self, node: ast.BinaryNode, tabs: int = 0): - ans = '\t' * tabs + f'\\__ {node.__class__.__name__} ' + ans = ' ' * 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(ast.AtomicNode) def visit(self, node: ast.AtomicNode, tabs: int = 0): - return '\t' * tabs + f'\\__ {node.__class__.__name__}: {node.lex}' + return ' ' * tabs + f'\\__ {node.__class__.__name__}: {node.lex}' @visitor.when(ast.InstantiateNode) def visit(self, node: ast.InstantiateNode, tabs: int = 0): - return '\t' * tabs + f'\\__ InstantiateNode: new {node.lex}()' + return ' ' * tabs + f'\\__ InstantiateNode: new {node.lex}()' diff --git a/semantics/type_collector.py b/semantics/type_collector.py index dbc000eba..23b797eff 100644 --- a/semantics/type_collector.py +++ b/semantics/type_collector.py @@ -22,7 +22,7 @@ def visit(self, node): pass @visitor.when(ast.ProgramNode) - def visit(self, node): + def visit(self, node: ast.ProgramNode): self.context.create_type('AUTO_TYPE') self_type = self.context.create_type('SELF_TYPE') object_type = self.context.create_type('Object') diff --git a/semantics/type_inference.py b/semantics/type_inference.py index e6b602a8a..c8791f4d4 100644 --- a/semantics/type_inference.py +++ b/semantics/type_inference.py @@ -35,7 +35,7 @@ """ from collections import deque, OrderedDict -from typing import Dict, List, Tuple, Set +from typing import Dict, List, Tuple, Set, Optional import semantics.utils.astnodes as ast import semantics.utils.errors as err @@ -136,9 +136,6 @@ def update_dependencies(self, default_type: Type = None): continue self.update_dependencies_of(current_node, current_node.type, visited) - for k, v in self.dependencies.items(): - print(k, ':', v) - if default_type is not None: for node in self.dependencies: if node not in visited: @@ -164,8 +161,8 @@ class InferenceChecker: def __init__(self, context, errors): self.context: Context = context self.errors: List[str] = errors - self.current_type: Type = None - self.current_method: Method = None + self.current_type: Optional[Type] = None + self.current_method: Optional[Method] = None self.variables = {} self.attributes = self.build_attributes_reference(context) diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/inference/01_program.cl b/tests/inference/01_program.cl new file mode 100644 index 000000000..f83a4aa36 --- /dev/null +++ b/tests/inference/01_program.cl @@ -0,0 +1,16 @@ +class Main { + main (): Object { + 0 + }; +} + +class Point { + x: AUTO_TYPE; + y: AUTO_TYPE; + + init(x0: Int, y0: Int): AUTO_TYPE {{ + x <- x0; + y <- y0; + self; + }}; +} \ No newline at end of file diff --git a/tests/inference/01_result.cl b/tests/inference/01_result.cl new file mode 100644 index 000000000..558906f46 --- /dev/null +++ b/tests/inference/01_result.cl @@ -0,0 +1,19 @@ +class Main { + main (): Object { + 0 + }; +} + +class Point { + x: Int; + + y: Int; + + init (x0: Int, y0: Int): Point { + { + x <- x0; + y <- y0; + self; + } + }; +} \ No newline at end of file diff --git a/tests/inference/02_program.cl b/tests/inference/02_program.cl new file mode 100644 index 000000000..958af7f4e --- /dev/null +++ b/tests/inference/02_program.cl @@ -0,0 +1,15 @@ +class Main { + main (): Object { + 0 + }; +} + +class Ackermann { + ackermann(m: AUTO_TYPE, n: AUTO_TYPE): AUTO_TYPE { + if m = 0 then n + 1 else + if n = 0 then ackermann(m - 1, 1) else + ackermann(m - 1, ackermann(m, n - 1)) + fi + fi + }; +} \ No newline at end of file diff --git a/tests/inference/02_result.cl b/tests/inference/02_result.cl new file mode 100644 index 000000000..41b4a7b77 --- /dev/null +++ b/tests/inference/02_result.cl @@ -0,0 +1,21 @@ +class Main { + main (): Object { + 0 + }; +} + +class Ackermann { + ackermann (m: Int, n: Int): Int { + if m = 0 + then + n + 1 + else + if n = 0 + then + self.ackermann(m - 1, 1) + else + self.ackermann(m - 1, self.ackermann(m, n - 1)) + fi + fi + }; +} \ No newline at end of file diff --git a/tests/inference/03_program.cl b/tests/inference/03_program.cl new file mode 100644 index 000000000..04c639a99 --- /dev/null +++ b/tests/inference/03_program.cl @@ -0,0 +1,17 @@ +class Main { + main (): Object { + 0 + }; + + f(a: AUTO_TYPE, b: AUTO_TYPE): AUTO_TYPE { + if a = 1 then b else + g(a + 1, b / 1) + fi + }; + + g(a: AUTO_TYPE, b: AUTO_TYPE): AUTO_TYPE { + if b = 1 then a else + f(a / 2, b + 1) + fi + }; +} \ No newline at end of file diff --git a/tests/inference/03_result.cl b/tests/inference/03_result.cl new file mode 100644 index 000000000..08ba93dff --- /dev/null +++ b/tests/inference/03_result.cl @@ -0,0 +1,23 @@ +class Main { + main (): Object { + 0 + }; + + f (a: Int, b: Int): Object { + if a = 1 + then + b + else + self.g(a + 1, b / 1) + fi + }; + + g (a: Int, b: Int): Object { + if b = 1 + then + a + else + self.f(a / 2, b + 1) + fi + }; +} \ No newline at end of file diff --git a/tests/inference/04_program.cl b/tests/inference/04_program.cl new file mode 100644 index 000000000..8df56c80c --- /dev/null +++ b/tests/inference/04_program.cl @@ -0,0 +1,16 @@ +class Main { + main (): Object { + 0 + }; +} + +class Point { + x: Int; + y: Int; + + init(x0: AUTO_TYPE, y0: AUTO_TYPE): AUTO_TYPE {{ + x <- x0; + y <- y0; + self; + }}; +} \ No newline at end of file diff --git a/tests/inference/04_result.cl b/tests/inference/04_result.cl new file mode 100644 index 000000000..558906f46 --- /dev/null +++ b/tests/inference/04_result.cl @@ -0,0 +1,19 @@ +class Main { + main (): Object { + 0 + }; +} + +class Point { + x: Int; + + y: Int; + + init (x0: Int, y0: Int): Point { + { + x <- x0; + y <- y0; + self; + } + }; +} \ No newline at end of file diff --git a/tests/lexer/comment1.cl b/tests/lexer/comment1.cl deleted file mode 100755 index 69533f23c..000000000 --- a/tests/lexer/comment1.cl +++ /dev/null @@ -1,55 +0,0 @@ ---Any characters between two dashes “--” and the next newline ---(or EOF, if there is no next newline) are treated as comments - -(*(*(* -Comments may also be written by enclosing -text in (∗ . . . ∗). The latter form of comment may be nested. -Comments cannot cross file boundaries. -*)*)*) - -class Error() { - - (* There was once a comment, - that was quite long. - But, the reader soon discovered that - the comment was indeed longer than - previously assumed. Now, the reader - was in a real dilemma; is the comment - ever gonna end? If I stop reading, will - it end? - He started imagining all sorts of things. - He thought about heisenberg's cat and how - how that relates to the end of the sentence. - He thought to himself "I'm gonna stop reading". - "If I keep reading this comment, I'm gonna know - the fate of this sentence; That will be disastorous." - He knew that such a comment was gonna extend to - another file. It was too awesome to be contained in - a single file. And he would have kept reading too... - if only... - cool wasn't a super-duper-fab-awesomest language; - but cool is that language; - "This comment shall go not cross this file" said cool. - Alas! The reader could read no more. - There was once a comment, - that was quite long. - But, the reader soon discovered that - the comment was indeed longer than - previously assumed. Now, the reader - was in a real dilemma; is the comment - ever gonna end? If I stop reading, will - it end? - He started imagining all sorts of things. - He thought about heisenberg's cat and how - how that relates to the end of the sentence. - He thought to himself "I'm gonna stop reading". - "If I keep reading this comment, I'm gonna know - the fate of this sentence; That will be disastorous." - He knew that such a comment was gonna extend to - another file. It was too awesome to be contained in - a single file. And he would have kept reading too... - if only... - cool wasn't a super-duper-fab-awesomest language; - but cool is that language; - "This comment shall go not cross this file" said cool. - Alas! The reader could read no more. \ No newline at end of file diff --git a/tests/lexer/comment1_error.txt b/tests/lexer/comment1_error.txt deleted file mode 100755 index 9fd7b8d67..000000000 --- a/tests/lexer/comment1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(55, 46) - LexicographicError: EOF in comment diff --git a/tests/lexer/iis1.cl b/tests/lexer/iis1.cl deleted file mode 100755 index 12cb52beb..000000000 --- a/tests/lexer/iis1.cl +++ /dev/null @@ -1,111 +0,0 @@ -(* Integers, Identifiers, and Special Notation *) - -0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ -5! = 120, 2 + 2 = 5 or E = mc2; p + 1 @ p = 1: for x in range(len(b)) -new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) -class Class if then else fi testing Testing ~007agent_bond james_007B0N3SS___ -loop pool while tRuE or noT faLsE let in case of ESAC - -(* -#3 INT_CONST 0007 -#3 INT_CONST 123 -#3 '+' -#3 INT_CONST 1 -#3 '-' -#3 INT_CONST 1 -#3 '+' -#3 INT_CONST 90 -#3 '-' -#3 INT_CONST 09 -#3 '+' -#3 INT_CONST 11113 -#3 '-' -#3 INT_CONST 4 -#3 OBJECTID r -#3 '*' -#3 OBJECTID a -#3 '*' -#3 OBJECTID self -#3 '*' -#3 OBJECTID c -#3 '+' -#3 '+' -#4 INT_CONST 5 -#4 ERROR "!" -#4 '=' -#4 INT_CONST 120 -#4 ',' -#4 INT_CONST 2 -#4 '+' -#4 INT_CONST 2 -#4 '=' -#4 INT_CONST 5 -#4 OBJECTID or -#4 TYPEID E -#4 '=' -#4 OBJECTID mc2 -#4 ';' -#4 OBJECTID p -#4 '+' -#4 INT_CONST 1 -#4 '@' -#4 OBJECTID p -#4 '=' -#4 INT_CONST 1 -#4 ':' -#4 OBJECTID for -#4 OBJECTID x -#4 IN -#4 OBJECTID range -#4 '(' -#4 OBJECTID len -#4 '(' -#4 OBJECTID b -#4 ')' -#4 ')' -#5 NEW -#5 '/' -#5 ASSIGN -#5 '<' -#5 LE -#5 DARROW -#5 '{' -#5 '(' -#5 TYPEID Int -#5 ':' -#5 TYPEID Objet -#5 ',' -#5 TYPEID Bool -#5 ';' -#5 TYPEID String -#5 '.' -#5 OBJECTID string -#5 TYPEID SELF_TYPE -#5 ISVOID -#5 '}' -#5 ')' -#6 CLASS -#6 CLASS -#6 IF -#6 THEN -#6 ELSE -#6 FI -#6 OBJECTID testing -#6 TYPEID Testing -#6 '~' -#6 INT_CONST 007 -#6 OBJECTID agent_bond -#6 OBJECTID james_007B0N3SS___ -#7 LOOP -#7 POOL -#7 WHILE -#7 BOOL_CONST true -#7 OBJECTID or -#7 NOT -#7 BOOL_CONST false -#7 LET -#7 IN -#7 CASE -#7 OF -#7 ESAC -*) \ No newline at end of file diff --git a/tests/lexer/iis1_error.txt b/tests/lexer/iis1_error.txt deleted file mode 100755 index 9e6d66cac..000000000 --- a/tests/lexer/iis1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(4, 2) - LexicographicError: ERROR "!" diff --git a/tests/lexer/iis2.cl b/tests/lexer/iis2.cl deleted file mode 100755 index 9b25715d4..000000000 --- a/tests/lexer/iis2.cl +++ /dev/null @@ -1,120 +0,0 @@ -(* Integers, Identifiers, and Special Notation *) - -0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ -class Class if then else fi testing Testing ~007agent_bond james_007bones___ - - -new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) -loop pool while tRuE or noT faLsE let in case of ESAC - -factorial(5) = 120, 2 + 2 = 5? or E = mc2; p + 1 resto p = 1: (@ for x in range(len(b))) - -(* -#3 INT_CONST 0007 -#3 INT_CONST 123 -#3 '+' -#3 INT_CONST 1 -#3 '-' -#3 INT_CONST 1 -#3 '+' -#3 INT_CONST 90 -#3 '-' -#3 INT_CONST 09 -#3 '+' -#3 INT_CONST 11113 -#3 '-' -#3 INT_CONST 4 -#3 OBJECTID r -#3 '*' -#3 OBJECTID a -#3 '*' -#3 OBJECTID self -#3 '*' -#3 OBJECTID c -#3 '+' -#3 '+' -#4 CLASS -#4 CLASS -#4 IF -#4 THEN -#4 ELSE -#4 FI -#4 OBJECTID testing -#4 TYPEID Testing -#4 '~' -#4 INT_CONST 007 -#4 OBJECTID agent_bond -#4 OBJECTID james_007bones___ -#7 NEW -#7 '/' -#7 ASSIGN -#7 '<' -#7 LE -#7 DARROW -#7 '{' -#7 '(' -#7 TYPEID Int -#7 ':' -#7 TYPEID Objet -#7 ',' -#7 TYPEID Bool -#7 ';' -#7 TYPEID String -#7 '.' -#7 OBJECTID string -#7 TYPEID SELF_TYPE -#7 ISVOID -#7 '}' -#7 ')' -#8 LOOP -#8 POOL -#8 WHILE -#8 BOOL_CONST true -#8 OBJECTID or -#8 NOT -#8 BOOL_CONST false -#8 LET -#8 IN -#8 CASE -#8 OF -#8 ESAC -#10 OBJECTID factorial -#10 '(' -#10 INT_CONST 5 -#10 ')' -#10 '=' -#10 INT_CONST 120 -#10 ',' -#10 INT_CONST 2 -#10 '+' -#10 INT_CONST 2 -#10 '=' -#10 INT_CONST 5 -#10 ERROR "?" -#10 OBJECTID or -#10 TYPEID E -#10 '=' -#10 OBJECTID mc2 -#10 ';' -#10 OBJECTID p -#10 '+' -#10 INT_CONST 1 -#10 OBJECTID resto -#10 OBJECTID p -#10 '=' -#10 INT_CONST 1 -#10 ':' -#10 '(' -#10 '@' -#10 OBJECTID for -#10 OBJECTID x -#10 IN -#10 OBJECTID range -#10 '(' -#10 OBJECTID len -#10 '(' -#10 OBJECTID b -#10 ')' -#10 ')' -#10 ')' -*) \ No newline at end of file diff --git a/tests/lexer/iis2_error.txt b/tests/lexer/iis2_error.txt deleted file mode 100755 index 922391a9d..000000000 --- a/tests/lexer/iis2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(10, 30) - LexicographicError: ERROR "?" diff --git a/tests/lexer/iis3.cl b/tests/lexer/iis3.cl deleted file mode 100755 index 0b965ddea..000000000 --- a/tests/lexer/iis3.cl +++ /dev/null @@ -1,121 +0,0 @@ -(* Integers, Identifiers, and Special Notation *) - -factorial(5) = 120, 2 + 2 = 5 or E = mc^2; p + 1 @ p = 1: z for x in range(len(b))) - -loop pool while tRuE or noT faLsE let in case of ESAC - -new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) - - -0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ -class Class if then else fi testing Testing ~007agent_bond james_007bones___ - -(* -#3 OBJECTID factorial -#3 '(' -#3 INT_CONST 5 -#3 ')' -#3 '=' -#3 INT_CONST 120 -#3 ',' -#3 INT_CONST 2 -#3 '+' -#3 INT_CONST 2 -#3 '=' -#3 INT_CONST 5 -#3 OBJECTID or -#3 TYPEID E -#3 '=' -#3 OBJECTID mc -#3 ERROR "^" -#3 INT_CONST 2 -#3 ';' -#3 OBJECTID p -#3 '+' -#3 INT_CONST 1 -#3 '@' -#3 OBJECTID p -#3 '=' -#3 INT_CONST 1 -#3 ':' -#3 OBJECTID z -#3 OBJECTID for -#3 OBJECTID x -#3 IN -#3 OBJECTID range -#3 '(' -#3 OBJECTID len -#3 '(' -#3 OBJECTID b -#3 ')' -#3 ')' -#3 ')' -#5 LOOP -#5 POOL -#5 WHILE -#5 BOOL_CONST true -#5 OBJECTID or -#5 NOT -#5 BOOL_CONST false -#5 LET -#5 IN -#5 CASE -#5 OF -#5 ESAC -#7 NEW -#7 '/' -#7 ASSIGN -#7 '<' -#7 LE -#7 DARROW -#7 '{' -#7 '(' -#7 TYPEID Int -#7 ':' -#7 TYPEID Objet -#7 ',' -#7 TYPEID Bool -#7 ';' -#7 TYPEID String -#7 '.' -#7 OBJECTID string -#7 TYPEID SELF_TYPE -#7 ISVOID -#7 '}' -#7 ')' -#10 INT_CONST 0007 -#10 INT_CONST 123 -#10 '+' -#10 INT_CONST 1 -#10 '-' -#10 INT_CONST 1 -#10 '+' -#10 INT_CONST 90 -#10 '-' -#10 INT_CONST 09 -#10 '+' -#10 INT_CONST 11113 -#10 '-' -#10 INT_CONST 4 -#10 OBJECTID r -#10 '*' -#10 OBJECTID a -#10 '*' -#10 OBJECTID self -#10 '*' -#10 OBJECTID c -#10 '+' -#10 '+' -#11 CLASS -#11 CLASS -#11 IF -#11 THEN -#11 ELSE -#11 FI -#11 OBJECTID testing -#11 TYPEID Testing -#11 '~' -#11 INT_CONST 007 -#11 OBJECTID agent_bond -#11 OBJECTID james_007bones___ -*) \ No newline at end of file diff --git a/tests/lexer/iis3_error.txt b/tests/lexer/iis3_error.txt deleted file mode 100755 index b001b6a71..000000000 --- a/tests/lexer/iis3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(3, 40) - LexicographicError: ERROR "^" diff --git a/tests/lexer/iis4.cl b/tests/lexer/iis4.cl deleted file mode 100755 index 9e7a9cb62..000000000 --- a/tests/lexer/iis4.cl +++ /dev/null @@ -1,120 +0,0 @@ -(* Integers, Identifiers, and Special Notation *) - -new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) -0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ - -factorial(5) = 120, 2 + 2 = 5 or E = mc2; p + 1 % p = 1: @.@ for x in range(len(b))~ - - -loop pool while tRuE or noT faLsE let in case of ESAC -class Class if then else fi testing Testing ~007agent_bond james_007bones___ - -(* -#3 NEW -#3 '/' -#3 ASSIGN -#3 '<' -#3 LE -#3 DARROW -#3 '{' -#3 '(' -#3 TYPEID Int -#3 ':' -#3 TYPEID Objet -#3 ',' -#3 TYPEID Bool -#3 ';' -#3 TYPEID String -#3 '.' -#3 OBJECTID string -#3 TYPEID SELF_TYPE -#3 ISVOID -#3 '}' -#3 ')' -#4 INT_CONST 0007 -#4 INT_CONST 123 -#4 '+' -#4 INT_CONST 1 -#4 '-' -#4 INT_CONST 1 -#4 '+' -#4 INT_CONST 90 -#4 '-' -#4 INT_CONST 09 -#4 '+' -#4 INT_CONST 11113 -#4 '-' -#4 INT_CONST 4 -#4 OBJECTID r -#4 '*' -#4 OBJECTID a -#4 '*' -#4 OBJECTID self -#4 '*' -#4 OBJECTID c -#4 '+' -#4 '+' -#6 OBJECTID factorial -#6 '(' -#6 INT_CONST 5 -#6 ')' -#6 '=' -#6 INT_CONST 120 -#6 ',' -#6 INT_CONST 2 -#6 '+' -#6 INT_CONST 2 -#6 '=' -#6 INT_CONST 5 -#6 OBJECTID or -#6 TYPEID E -#6 '=' -#6 OBJECTID mc2 -#6 ';' -#6 OBJECTID p -#6 '+' -#6 INT_CONST 1 -#6 ERROR "%" -#6 OBJECTID p -#6 '=' -#6 INT_CONST 1 -#6 ':' -#6 '@' -#6 '.' -#6 '@' -#6 OBJECTID for -#6 OBJECTID x -#6 IN -#6 OBJECTID range -#6 '(' -#6 OBJECTID len -#6 '(' -#6 OBJECTID b -#6 ')' -#6 ')' -#6 '~' -#9 LOOP -#9 POOL -#9 WHILE -#9 BOOL_CONST true -#9 OBJECTID or -#9 NOT -#9 BOOL_CONST false -#9 LET -#9 IN -#9 CASE -#9 OF -#9 ESAC -#10 CLASS -#10 CLASS -#10 IF -#10 THEN -#10 ELSE -#10 FI -#10 OBJECTID testing -#10 TYPEID Testing -#10 '~' -#10 INT_CONST 007 -#10 OBJECTID agent_bond -#10 OBJECTID james_007bones___ -*) \ No newline at end of file diff --git a/tests/lexer/iis4_error.txt b/tests/lexer/iis4_error.txt deleted file mode 100755 index f24076a8c..000000000 --- a/tests/lexer/iis4_error.txt +++ /dev/null @@ -1 +0,0 @@ -(6, 49) - LexicographicError: ERROR "!" diff --git a/tests/lexer/iis5.cl b/tests/lexer/iis5.cl deleted file mode 100755 index d146c0547..000000000 --- a/tests/lexer/iis5.cl +++ /dev/null @@ -1,121 +0,0 @@ -(* Integers, Identifiers, and Special Notation *) - - -loop pool while tRuE or noT faLsE let in case of ESAC -new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) -class Class if then else fi testing Testing ~007agent_bond james_007bones___ - -factorial(5) = 120, 2 + 2 = 5 or E = mc2; p + 1 resto p = 1: [@.@ for x in range(len(b))] - -0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ - -(* -#4 LOOP -#4 POOL -#4 WHILE -#4 BOOL_CONST true -#4 OBJECTID or -#4 NOT -#4 BOOL_CONST false -#4 LET -#4 IN -#4 CASE -#4 OF -#4 ESAC -#5 NEW -#5 '/' -#5 ASSIGN -#5 '<' -#5 LE -#5 DARROW -#5 '{' -#5 '(' -#5 TYPEID Int -#5 ':' -#5 TYPEID Objet -#5 ',' -#5 TYPEID Bool -#5 ';' -#5 TYPEID String -#5 '.' -#5 OBJECTID string -#5 TYPEID SELF_TYPE -#5 ISVOID -#5 '}' -#5 ')' -#6 CLASS -#6 CLASS -#6 IF -#6 THEN -#6 ELSE -#6 FI -#6 OBJECTID testing -#6 TYPEID Testing -#6 '~' -#6 INT_CONST 007 -#6 OBJECTID agent_bond -#6 OBJECTID james_007bones___ -#8 OBJECTID factorial -#8 '(' -#8 INT_CONST 5 -#8 ')' -#8 '=' -#8 INT_CONST 120 -#8 ',' -#8 INT_CONST 2 -#8 '+' -#8 INT_CONST 2 -#8 '=' -#8 INT_CONST 5 -#8 OBJECTID or -#8 TYPEID E -#8 '=' -#8 OBJECTID mc2 -#8 ';' -#8 OBJECTID p -#8 '+' -#8 INT_CONST 1 -#8 OBJECTID resto -#8 OBJECTID p -#8 '=' -#8 INT_CONST 1 -#8 ':' -#8 ERROR "[" -#8 '@' -#8 '.' -#8 '@' -#8 OBJECTID for -#8 OBJECTID x -#8 IN -#8 OBJECTID range -#8 '(' -#8 OBJECTID len -#8 '(' -#8 OBJECTID b -#8 ')' -#8 ')' -#8 ERROR "]" -#10 INT_CONST 0007 -#10 INT_CONST 123 -#10 '+' -#10 INT_CONST 1 -#10 '-' -#10 INT_CONST 1 -#10 '+' -#10 INT_CONST 90 -#10 '-' -#10 INT_CONST 09 -#10 '+' -#10 INT_CONST 11113 -#10 '-' -#10 INT_CONST 4 -#10 OBJECTID r -#10 '*' -#10 OBJECTID a -#10 '*' -#10 OBJECTID self -#10 '*' -#10 OBJECTID c -#10 '+' -#10 '+' -*) diff --git a/tests/lexer/iis5_error.txt b/tests/lexer/iis5_error.txt deleted file mode 100755 index b3dbadcb6..000000000 --- a/tests/lexer/iis5_error.txt +++ /dev/null @@ -1,2 +0,0 @@ -(8, 62) - LexicographicError: ERROR "[" -(8, 89) - LexicographicError: ERROR "]" diff --git a/tests/lexer/iis6.cl b/tests/lexer/iis6.cl deleted file mode 100755 index 1042f132b..000000000 --- a/tests/lexer/iis6.cl +++ /dev/null @@ -1,125 +0,0 @@ -(* Integers, Identifiers, and Special Notation *) - -factorial(5) = 120, 2 + 2 = 5 or E = mc2; p + 1 resto p = 1: {@.@ for x in range(len(b))} - -new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) - - -class Class if then else fi testing Testing ~007agent_bond _james_007bones___ - - - -0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ -loop pool while tRuE or noT faLsE let in case of ESAC - -(* -#3 OBJECTID factorial -#3 '(' -#3 INT_CONST 5 -#3 ')' -#3 '=' -#3 INT_CONST 120 -#3 ',' -#3 INT_CONST 2 -#3 '+' -#3 INT_CONST 2 -#3 '=' -#3 INT_CONST 5 -#3 OBJECTID or -#3 TYPEID E -#3 '=' -#3 OBJECTID mc2 -#3 ';' -#3 OBJECTID p -#3 '+' -#3 INT_CONST 1 -#3 OBJECTID resto -#3 OBJECTID p -#3 '=' -#3 INT_CONST 1 -#3 ':' -#3 '{' -#3 '@' -#3 '.' -#3 '@' -#3 OBJECTID for -#3 OBJECTID x -#3 IN -#3 OBJECTID range -#3 '(' -#3 OBJECTID len -#3 '(' -#3 OBJECTID b -#3 ')' -#3 ')' -#3 '}' -#5 NEW -#5 '/' -#5 ASSIGN -#5 '<' -#5 LE -#5 DARROW -#5 '{' -#5 '(' -#5 TYPEID Int -#5 ':' -#5 TYPEID Objet -#5 ',' -#5 TYPEID Bool -#5 ';' -#5 TYPEID String -#5 '.' -#5 OBJECTID string -#5 TYPEID SELF_TYPE -#5 ISVOID -#5 '}' -#5 ')' -#8 CLASS -#8 CLASS -#8 IF -#8 THEN -#8 ELSE -#8 FI -#8 OBJECTID testing -#8 TYPEID Testing -#8 '~' -#8 INT_CONST 007 -#8 OBJECTID agent_bond -#8 ERROR "_" -#8 OBJECTID james_007bones___ -#12 INT_CONST 0007 -#12 INT_CONST 123 -#12 '+' -#12 INT_CONST 1 -#12 '-' -#12 INT_CONST 1 -#12 '+' -#12 INT_CONST 90 -#12 '-' -#12 INT_CONST 09 -#12 '+' -#12 INT_CONST 11113 -#12 '-' -#12 INT_CONST 4 -#12 OBJECTID r -#12 '*' -#12 OBJECTID a -#12 '*' -#12 OBJECTID self -#12 '*' -#12 OBJECTID c -#12 '+' -#12 '+' -#13 LOOP -#13 POOL -#13 WHILE -#13 BOOL_CONST true -#13 OBJECTID or -#13 NOT -#13 BOOL_CONST false -#13 LET -#13 IN -#13 CASE -#13 OF -#13 ESAC -*) \ No newline at end of file diff --git a/tests/lexer/iis6_error.txt b/tests/lexer/iis6_error.txt deleted file mode 100755 index d7fad9c79..000000000 --- a/tests/lexer/iis6_error.txt +++ /dev/null @@ -1 +0,0 @@ -(8, 60) - LexicographicError: ERROR "_" diff --git a/tests/lexer/mixed1.cl b/tests/lexer/mixed1.cl deleted file mode 100755 index 803d58ef5..000000000 --- a/tests/lexer/mixed1.cl +++ /dev/null @@ -1,14 +0,0 @@ -"lkjdsafkljdsalfj\u0000dsafdsaf\u0000djafslkjdsalf\nsdajf\" lkjfdsasdkjfl"123 -adsfasklj# -LKldsajf iNhERITS -"lkdsajf" - -(* -#1 STR_CONST "lkjdsafkljdsalfju0000dsafdsafu0000djafslkjdsalf\nsdajf\" lkjfdsasdkjfl" -#1 INT_CONST 123 -#2 OBJECTID adsfasklj -#2 ERROR "#" -#3 TYPEID LKldsajf -#3 INHERITS -#4 STR_CONST "lkdsajf" -*) \ No newline at end of file diff --git a/tests/lexer/mixed1_error.txt b/tests/lexer/mixed1_error.txt deleted file mode 100755 index 99af5fbdc..000000000 --- a/tests/lexer/mixed1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(2, 10) - LexicographicError: ERROR "#" diff --git a/tests/lexer/mixed2.cl b/tests/lexer/mixed2.cl deleted file mode 100755 index 12039e123..000000000 --- a/tests/lexer/mixed2.cl +++ /dev/null @@ -1,20 +0,0 @@ -"kjas\"lnnsdj\nfljrdsaf" -@.$.@ -@*%*@ -"alkjfldajf""dasfadsf - -(* -#1 STR_CONST "kjas\"lnnsdj\nfljrdsaf" -#2 '@' -#2 '.' -#2 ERROR "$" -#2 '.' -#2 '@' -#3 '@' -#3 '*' -#3 ERROR "%" -#3 '*' -#3 '@' -#4 STR_CONST "alkjfldajf" -#4 ERROR "Unterminated string constant" -*) \ No newline at end of file diff --git a/tests/lexer/mixed2_error.txt b/tests/lexer/mixed2_error.txt deleted file mode 100755 index 097dc2a07..000000000 --- a/tests/lexer/mixed2_error.txt +++ /dev/null @@ -1,3 +0,0 @@ -(2, 3) - LexicographicError: ERROR "$" -(3, 3) - LexicographicError: ERROR "%" -(4, 22) - LexicographicError: Unterminated string constant diff --git a/tests/lexer/string1.cl b/tests/lexer/string1.cl deleted file mode 100755 index 6c3c00833..000000000 --- a/tests/lexer/string1.cl +++ /dev/null @@ -1,6 +0,0 @@ -(* A non-escaped newline character may not appear in a string *) - -"This \ -is OK" -"This is not -OK" \ No newline at end of file diff --git a/tests/lexer/string1_error.txt b/tests/lexer/string1_error.txt deleted file mode 100755 index 078c12bbb..000000000 --- a/tests/lexer/string1_error.txt +++ /dev/null @@ -1,2 +0,0 @@ -(5, 13) - LexicographicError: Unterminated string constant -(6, 4) - LexicographicError: EOF in string constant \ No newline at end of file diff --git a/tests/lexer/string2.cl b/tests/lexer/string2.cl deleted file mode 100755 index 3704b6ae7..000000000 --- a/tests/lexer/string2.cl +++ /dev/null @@ -1,19 +0,0 @@ -(* A string may not contain EOF *) - -" May the Triforce \ - 0 \ - 0v0 \ - 0vvv0 \ - 0vvvvv0 \ - 0vvvvvvv0 \ - 0vvvvvvvvv0 \ - 0vvvvvvvvvvv0 \ - 000000000000000 \ - 0v0 0v0 \ - 0vvv0 0vvv0 \ - 0vvvvv0 0vvvvv0 \ - 0vvvvvvv0 0vvvvvvv0 \ - 0vvvvvvvvv0 0vvvvvvvvv0 \ - 0vvvvvvvvvvv0 0vvvvvvvvvvv0 \ - 00000000000000000000000000000 \ - be with you! \ No newline at end of file diff --git a/tests/lexer/string2_error.txt b/tests/lexer/string2_error.txt deleted file mode 100755 index 7fbbcb526..000000000 --- a/tests/lexer/string2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(19, 29) - LexicographicError: EOF in string constant \ No newline at end of file diff --git a/tests/lexer/string3.cl b/tests/lexer/string3.cl deleted file mode 100755 index 78abc4972e218bca373ba1750c99a3450cef4ea3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 234 zcmX|4yAH!34D8HToS2dhRoZ?*=Jpd<90*B>0}_xSe_!a!lI8Q=*(aJadZZi|KVhQ- zK4j?NGc6u@9^rRpGmYcJ^ifl$K@ Mi{IIrdU_-I0>Lp*mH+?% diff --git a/tests/lexer/string3_error.txt b/tests/lexer/string3_error.txt deleted file mode 100755 index 35695d07e..000000000 --- a/tests/lexer/string3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(8, 4) - LexicographicError: String contains null character \ No newline at end of file diff --git a/tests/lexer/string4.cl b/tests/lexer/string4.cl deleted file mode 100755 index f4d39c027..000000000 --- a/tests/lexer/string4.cl +++ /dev/null @@ -1,38 +0,0 @@ -class Main { - str <- "The big brown fox - jumped over the fence"; - main() : Object { - { - out_string("Yay! This is the newest shites ); - } - }; -}; - -(* -#1 CLASS -#1 TYPEID Main -#1 '{' -#2 OBJECTID str -#2 ASSIGN -#3 ERROR "Unterminated string constant" -#3 OBJECTID jumped -#3 OBJECTID over -#3 OBJECTID the -#3 OBJECTID fence -#4 ERROR "Unterminated string constant" -#4 OBJECTID main -#4 '(' -#4 ')' -#4 ':' -#4 TYPEID Object -#4 '{' -#5 '{' -#6 OBJECTID out_string -#6 '(' -#7 ERROR "Unterminated string constant" -#7 '}' -#8 '}' -#8 ';' -#9 '}' -#9 ';' -*) \ No newline at end of file diff --git a/tests/lexer/string4_error.txt b/tests/lexer/string4_error.txt deleted file mode 100755 index 5ab0ea847..000000000 --- a/tests/lexer/string4_error.txt +++ /dev/null @@ -1,3 +0,0 @@ -(2, 30) - LexicographicError: Unterminated string constant -(3, 36) - LexicographicError: Unterminated string constant -(6, 58) - LexicographicError: Unterminated string constant \ No newline at end of file diff --git a/tests/parser/assignment1.cl b/tests/parser/assignment1.cl deleted file mode 100755 index f01b0b531..000000000 --- a/tests/parser/assignment1.cl +++ /dev/null @@ -1,37 +0,0 @@ -(* An assignment has the form <- *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(): String { - Test1 <- "Hello World" -- Identifiers begin with a lower case letter - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/assignment1_error.txt b/tests/parser/assignment1_error.txt deleted file mode 100755 index cef0d3946..000000000 --- a/tests/parser/assignment1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(29, 9) - SyntacticError: ERROR at or near "Test1" \ No newline at end of file diff --git a/tests/parser/assignment2.cl b/tests/parser/assignment2.cl deleted file mode 100755 index 4efb96487..000000000 --- a/tests/parser/assignment2.cl +++ /dev/null @@ -1,37 +0,0 @@ -(* An assignment has the form <- *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 - 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(): Int { - test1 <-- ~(1 + 2 + 3 + 4 + 5) -- The left side must be an expression - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/assignment2_error.txt b/tests/parser/assignment2_error.txt deleted file mode 100755 index dc611c159..000000000 --- a/tests/parser/assignment2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(29, 17) - SyntacticError: ERROR at or near "-" \ No newline at end of file diff --git a/tests/parser/assignment3.cl b/tests/parser/assignment3.cl deleted file mode 100755 index ff633f331..000000000 --- a/tests/parser/assignment3.cl +++ /dev/null @@ -1,37 +0,0 @@ -(* An assignment has the form <- *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(): Bool { - test1 <- true++ -- The left side must be an expression - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/assignment3_error.txt b/tests/parser/assignment3_error.txt deleted file mode 100755 index a69ac3a81..000000000 --- a/tests/parser/assignment3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(29, 23) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/attribute1.cl b/tests/parser/attribute1.cl deleted file mode 100755 index 063a02c02..000000000 --- a/tests/parser/attribute1.cl +++ /dev/null @@ -1,34 +0,0 @@ -(* An attribute of class A specifies a variable that is part of the state of objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - -- Attributes names must begin with lowercase letters - Test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/attribute1_error.txt b/tests/parser/attribute1_error.txt deleted file mode 100755 index a4e9eb060..000000000 --- a/tests/parser/attribute1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(17, 5) - SyntacticError: ERROR at or near "Test2" \ No newline at end of file diff --git a/tests/parser/attribute2.cl b/tests/parser/attribute2.cl deleted file mode 100755 index c05211483..000000000 --- a/tests/parser/attribute2.cl +++ /dev/null @@ -1,34 +0,0 @@ -(* An attribute of class A specifies a variable that is part of the state of objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - -- Type names must begin with uppercase letters - test3: string <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/attribute2_error.txt b/tests/parser/attribute2_error.txt deleted file mode 100755 index b02a52ee1..000000000 --- a/tests/parser/attribute2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(19, 12) - SyntacticError: ERROR at or near "string" \ No newline at end of file diff --git a/tests/parser/attribute3.cl b/tests/parser/attribute3.cl deleted file mode 100755 index d858ae47c..000000000 --- a/tests/parser/attribute3.cl +++ /dev/null @@ -1,34 +0,0 @@ -(* An attribute of class A specifies a variable that is part of the state of objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - -- Expected '<-' not '<=' - test3: String <= "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/attribute3_error.txt b/tests/parser/attribute3_error.txt deleted file mode 100755 index 71f5bc0b7..000000000 --- a/tests/parser/attribute3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(19, 19) - SyntacticError: ERROR at or near "<=" \ No newline at end of file diff --git a/tests/parser/block1.cl b/tests/parser/block1.cl deleted file mode 100755 index 3613d9268..000000000 --- a/tests/parser/block1.cl +++ /dev/null @@ -1,87 +0,0 @@ -(* A block has the form { ; ... ; } *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - pow: Int <- 1; - count: Int <- 0; - - testing6(a: Int): IO { - { - count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2 -- Missing ";" - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/block1_error.txt b/tests/parser/block1_error.txt deleted file mode 100755 index c78fb0b96..000000000 --- a/tests/parser/block1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(56, 17) - SyntacticError: ERROR at or near "}" \ No newline at end of file diff --git a/tests/parser/block2.cl b/tests/parser/block2.cl deleted file mode 100755 index f485dd0b1..000000000 --- a/tests/parser/block2.cl +++ /dev/null @@ -1,87 +0,0 @@ -(* A block has the form { ; ... ; } *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - pow: Int <- 1; - count: Int <- 0; - - testing6(a: Int): IO { - -- Missing "{" - count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/block2_error.txt b/tests/parser/block2_error.txt deleted file mode 100755 index f85f4303c..000000000 --- a/tests/parser/block2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(49, 23) - SyntacticError: ERROR at or near ";" \ No newline at end of file diff --git a/tests/parser/block3.cl b/tests/parser/block3.cl deleted file mode 100755 index ae1598c3b..000000000 --- a/tests/parser/block3.cl +++ /dev/null @@ -1,87 +0,0 @@ -(* A block has the form { ; ... ; } *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - pow: Int <- 1; - count: Int <- 0; - - testing6(a: Int): IO { - { - count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - -- Missing "}" - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/block3_error.txt b/tests/parser/block3_error.txt deleted file mode 100755 index cda9949a2..000000000 --- a/tests/parser/block3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(57, 13) - SyntacticError: ERROR at or near "pool" \ No newline at end of file diff --git a/tests/parser/block4.cl b/tests/parser/block4.cl deleted file mode 100755 index 8fd883d02..000000000 --- a/tests/parser/block4.cl +++ /dev/null @@ -1,88 +0,0 @@ -(* A block has the form { ; ... ; } *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - pow: Int <- 1; - count: Int <- 0; - - testing6(a: Int): IO { - { - count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - true++; -- Only expressions - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/block4_error.txt b/tests/parser/block4_error.txt deleted file mode 100755 index ddbeb32ef..000000000 --- a/tests/parser/block4_error.txt +++ /dev/null @@ -1 +0,0 @@ -(56, 26) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/case1.cl b/tests/parser/case1.cl deleted file mode 100755 index c2f508809..000000000 --- a/tests/parser/case1.cl +++ /dev/null @@ -1,91 +0,0 @@ -(* Case expressions provide runtime type tests on objects *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + 2 of - -- Every case expression must have at least one branch - esac - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/case1_error.txt b/tests/parser/case1_error.txt deleted file mode 100755 index 61fca14f7..000000000 --- a/tests/parser/case1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(63, 9) - SyntacticError: ERROR at or near ESAC \ No newline at end of file diff --git a/tests/parser/case2.cl b/tests/parser/case2.cl deleted file mode 100755 index f9162e49f..000000000 --- a/tests/parser/case2.cl +++ /dev/null @@ -1,93 +0,0 @@ -(* Case expressions provide runtime type tests on objects *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case "2 + 2" of - x: Int => new IO.out_string("Es un entero!") -- Missing ";" - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/case2_error.txt b/tests/parser/case2_error.txt deleted file mode 100755 index 40b030dd9..000000000 --- a/tests/parser/case2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(63, 13) - SyntacticError: ERROR at or near "y" \ No newline at end of file diff --git a/tests/parser/case3.cl b/tests/parser/case3.cl deleted file mode 100755 index a7eedc18b..000000000 --- a/tests/parser/case3.cl +++ /dev/null @@ -1,93 +0,0 @@ -(* Case expressions provide runtime type tests on objects *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + false of - x: Int => new IO.out_string("Es un entero!"); - y: string => new IO.out_string("Es una cadena!"); -- Type identifiers starts with a uppercase letter - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/case3_error.txt b/tests/parser/case3_error.txt deleted file mode 100755 index f25c5c563..000000000 --- a/tests/parser/case3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(63, 16) - SyntacticError: ERROR at or near "string" \ No newline at end of file diff --git a/tests/parser/case4.cl b/tests/parser/case4.cl deleted file mode 100755 index 25ca3858f..000000000 --- a/tests/parser/case4.cl +++ /dev/null @@ -1,93 +0,0 @@ -(* Case expressions provide runtime type tests on objects *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case true of - x: Int => new IO.out_string("Es un entero!"); - y: String => new IO.out_string("Es una cadena!"); - Mazinger_Z: Bool => new IO.out_string("Es un booleano!"); -- Identifiers starts with a lowercase letter - esac - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/case4_error.txt b/tests/parser/case4_error.txt deleted file mode 100755 index c5a16ddec..000000000 --- a/tests/parser/case4_error.txt +++ /dev/null @@ -1 +0,0 @@ -(64, 13) - SyntacticError: ERROR at or near "Mazinger_Z" \ No newline at end of file diff --git a/tests/parser/case5.cl b/tests/parser/case5.cl deleted file mode 100755 index b36c663e1..000000000 --- a/tests/parser/case5.cl +++ /dev/null @@ -1,93 +0,0 @@ -(* Case expressions provide runtime type tests on objects *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case test2 of - x: Int <- new IO.out_string("Es un entero!"); -- Must be '=>' not '<-'; - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/case5_error.txt b/tests/parser/case5_error.txt deleted file mode 100755 index fc6ec0eda..000000000 --- a/tests/parser/case5_error.txt +++ /dev/null @@ -1 +0,0 @@ -(62, 20) - SyntacticError: ERROR at or near ASSIGN \ No newline at end of file diff --git a/tests/parser/case6.cl b/tests/parser/case6.cl deleted file mode 100755 index 66e7df2ab..000000000 --- a/tests/parser/case6.cl +++ /dev/null @@ -1,93 +0,0 @@ -(* Case expressions provide runtime type tests on objects *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + 2 -- Missing "of" - x: Int => new IO.out_string("Es un entero!"); - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/case6_error.txt b/tests/parser/case6_error.txt deleted file mode 100755 index 2ae2f723b..000000000 --- a/tests/parser/case6_error.txt +++ /dev/null @@ -1 +0,0 @@ -(62, 13) - SyntacticError: ERROR at or near "x" \ No newline at end of file diff --git a/tests/parser/class1.cl b/tests/parser/class1.cl deleted file mode 100755 index f4815e3f4..000000000 --- a/tests/parser/class1.cl +++ /dev/null @@ -1,20 +0,0 @@ -(* A class is a list of features *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - testing(): Int { - 2 + 2 - }; -}; - --- Class names must begin with uppercase letters -class alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; diff --git a/tests/parser/class1_error.txt b/tests/parser/class1_error.txt deleted file mode 100755 index acaa52a6e..000000000 --- a/tests/parser/class1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(16, 7) - SyntacticError: ERROR at or near "alpha" \ No newline at end of file diff --git a/tests/parser/class2.cl b/tests/parser/class2.cl deleted file mode 100755 index f363b032a..000000000 --- a/tests/parser/class2.cl +++ /dev/null @@ -1,20 +0,0 @@ -(* A class is a list of features *) - -CLaSS Main { - main(): Object { - (new Alpha).print() - }; -}; - -CLaSS Test { - testing(): Int { - 2 + 2 - }; -}; - --- Type names must begin with uppercase letters -CLaSS Alpha iNHeRiTS iO { - print() : Object { - out_string("reached!!\n") - }; -}; diff --git a/tests/parser/class2_error.txt b/tests/parser/class2_error.txt deleted file mode 100755 index 59d065913..000000000 --- a/tests/parser/class2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(16, 22) - SyntacticError: ERROR at or near "iO" \ No newline at end of file diff --git a/tests/parser/class3.cl b/tests/parser/class3.cl deleted file mode 100755 index 0c801372a..000000000 --- a/tests/parser/class3.cl +++ /dev/null @@ -1,34 +0,0 @@ -(* A class is a list of features *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - -- Missing semicolon - testing2(a: Alpha, b: Int): Int { - 2 + 2 - } - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; diff --git a/tests/parser/class3_error.txt b/tests/parser/class3_error.txt deleted file mode 100755 index bc2f946b2..000000000 --- a/tests/parser/class3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(25, 5) - SyntacticError: ERROR at or near "testing3" \ No newline at end of file diff --git a/tests/parser/class4.cl b/tests/parser/class4.cl deleted file mode 100755 index 5c286b5e6..000000000 --- a/tests/parser/class4.cl +++ /dev/null @@ -1,36 +0,0 @@ -(* A class is a list of features *) - -CLaSS Main { - main(): Object { - (new Alpha).print() - }; -}; - -CLaSS Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - -- Only features - 2 + 2; - - testing3(): String { - "2 + 2" - }; -}; - -CLaSS Alpha iNHeRiTS IO { - print() : Object { - out_string("reached!!\n") - }; -}; diff --git a/tests/parser/class4_error.txt b/tests/parser/class4_error.txt deleted file mode 100755 index 1007f033d..000000000 --- a/tests/parser/class4_error.txt +++ /dev/null @@ -1 +0,0 @@ -(25, 5) - SyntacticError: ERROR at or near "2" \ No newline at end of file diff --git a/tests/parser/class5.cl b/tests/parser/class5.cl deleted file mode 100755 index 3f40c36eb..000000000 --- a/tests/parser/class5.cl +++ /dev/null @@ -1,34 +0,0 @@ -(* A class is a list of features *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - --- Missing '{' -class Test - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; diff --git a/tests/parser/class5_error.txt b/tests/parser/class5_error.txt deleted file mode 100755 index 400e4d614..000000000 --- a/tests/parser/class5_error.txt +++ /dev/null @@ -1 +0,0 @@ -(11, 5) - SyntacticError: ERROR at or near "test1" \ No newline at end of file diff --git a/tests/parser/class6.cl b/tests/parser/class6.cl deleted file mode 100755 index 8501d2593..000000000 --- a/tests/parser/class6.cl +++ /dev/null @@ -1,34 +0,0 @@ -(* A class is a list of features *) - -CLaSS Main { - main(): Object { - (new Alpha).print() - }; -}; - --- Missing '}' -CLaSS Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -; - -CLaSS Alpha iNHeRiTS IO { - print() : Object { - out_string("reached!!\n") - }; -}; diff --git a/tests/parser/class6_error.txt b/tests/parser/class6_error.txt deleted file mode 100755 index 73574c94c..000000000 --- a/tests/parser/class6_error.txt +++ /dev/null @@ -1 +0,0 @@ -(28, 1) - SyntacticError: ERROR at or near ";" \ No newline at end of file diff --git a/tests/parser/conditional1.cl b/tests/parser/conditional1.cl deleted file mode 100755 index 4d546fc44..000000000 --- a/tests/parser/conditional1.cl +++ /dev/null @@ -1,69 +0,0 @@ -(* A conditional has the form if then else fi *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - if a.length() < b.length() -- Mising "then" - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - else - if a.length() = b.length() then - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - else - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fi - fi - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/conditional1_error.txt b/tests/parser/conditional1_error.txt deleted file mode 100755 index ee533fd84..000000000 --- a/tests/parser/conditional1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(34, 13) - SyntacticError: ERROR at or near NEW \ No newline at end of file diff --git a/tests/parser/conditional2.cl b/tests/parser/conditional2.cl deleted file mode 100755 index 4f10c2957..000000000 --- a/tests/parser/conditional2.cl +++ /dev/null @@ -1,69 +0,0 @@ -(* A conditional has the form if then else fi *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - if a.length() < b.length() then - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - else - if a.length() = b.length() then - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - else - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - -- Missing "fi" - fi - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/conditional2_error.txt b/tests/parser/conditional2_error.txt deleted file mode 100755 index c72f78d7e..000000000 --- a/tests/parser/conditional2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(42, 5) - SyntacticError: ERROR at or near "}" \ No newline at end of file diff --git a/tests/parser/conditional3.cl b/tests/parser/conditional3.cl deleted file mode 100755 index 67e991ade..000000000 --- a/tests/parser/conditional3.cl +++ /dev/null @@ -1,69 +0,0 @@ -(* A conditional has the form if then else fi *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - iF a.length() < b.length() tHen - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - elsE - if a.length() = b.length() then - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - eLseif -- elseif isn't a keyword - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/conditional3_error.txt b/tests/parser/conditional3_error.txt deleted file mode 100755 index ad95552b5..000000000 --- a/tests/parser/conditional3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(38, 13) - SyntacticError: ERROR at or near "eLseif" \ No newline at end of file diff --git a/tests/parser/conditional4.cl b/tests/parser/conditional4.cl deleted file mode 100755 index 0792fdc85..000000000 --- a/tests/parser/conditional4.cl +++ /dev/null @@ -1,73 +0,0 @@ -(* A conditional has the form if then else fi *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(): Int { - if true++ then 1 else 0 -- Condition must be an expression - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/conditional4_error.txt b/tests/parser/conditional4_error.txt deleted file mode 100755 index f5511445b..000000000 --- a/tests/parser/conditional4_error.txt +++ /dev/null @@ -1 +0,0 @@ -(45, 17) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/conditional5.cl b/tests/parser/conditional5.cl deleted file mode 100755 index 0c1e1aad0..000000000 --- a/tests/parser/conditional5.cl +++ /dev/null @@ -1,73 +0,0 @@ -(* A conditional has the form if then else fi *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(): Int { - if true then true++ else 0 -- If branch must be an expression - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/conditional5_error.txt b/tests/parser/conditional5_error.txt deleted file mode 100755 index b3214010d..000000000 --- a/tests/parser/conditional5_error.txt +++ /dev/null @@ -1 +0,0 @@ -(45, 27) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/conditional6.cl b/tests/parser/conditional6.cl deleted file mode 100755 index 02310404a..000000000 --- a/tests/parser/conditional6.cl +++ /dev/null @@ -1,73 +0,0 @@ -(* A conditional has the form if then else fi *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(): Int { - if true then 1 else false++ -- Else branch must be an expression - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/conditional6_error.txt b/tests/parser/conditional6_error.txt deleted file mode 100755 index 968b78ad9..000000000 --- a/tests/parser/conditional6_error.txt +++ /dev/null @@ -1 +0,0 @@ -(45, 35) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/dispatch1.cl b/tests/parser/dispatch1.cl deleted file mode 100755 index 2ca394716..000000000 --- a/tests/parser/dispatch1.cl +++ /dev/null @@ -1,45 +0,0 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - Test1.testing4(1, 2).testing4(3, 4).testing4(5, 6) -- Objet identifiers begin with a lower case letter - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/dispatch1_error.txt b/tests/parser/dispatch1_error.txt deleted file mode 100755 index ba8e9e84c..000000000 --- a/tests/parser/dispatch1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(37, 9) - SyntacticError: ERROR at or near "Test1" \ No newline at end of file diff --git a/tests/parser/dispatch2.cl b/tests/parser/dispatch2.cl deleted file mode 100755 index 0b57467a1..000000000 --- a/tests/parser/dispatch2.cl +++ /dev/null @@ -1,45 +0,0 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13,) -- Extra comma - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/dispatch2_error.txt b/tests/parser/dispatch2_error.txt deleted file mode 100755 index 134e266b2..000000000 --- a/tests/parser/dispatch2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(37, 84) - SyntacticError: ERROR at or near ")" \ No newline at end of file diff --git a/tests/parser/dispatch3.cl b/tests/parser/dispatch3.cl deleted file mode 100755 index 9f1a5afff..000000000 --- a/tests/parser/dispatch3.cl +++ /dev/null @@ -1,45 +0,0 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).Testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) -- Identifiers begin with a lower case letter - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/dispatch3_error.txt b/tests/parser/dispatch3_error.txt deleted file mode 100755 index 86d2d5142..000000000 --- a/tests/parser/dispatch3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(37, 38) - SyntacticError: ERROR at or near "Testing4" \ No newline at end of file diff --git a/tests/parser/dispatch4.cl b/tests/parser/dispatch4.cl deleted file mode 100755 index d1efc469d..000000000 --- a/tests/parser/dispatch4.cl +++ /dev/null @@ -1,53 +0,0 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - self.testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true++) -- Arguments must be expressions - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/dispatch4_error.txt b/tests/parser/dispatch4_error.txt deleted file mode 100755 index d03bb4c53..000000000 --- a/tests/parser/dispatch4_error.txt +++ /dev/null @@ -1 +0,0 @@ -(45, 81) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/dispatch5.cl b/tests/parser/dispatch5.cl deleted file mode 100755 index 63a5afa79..000000000 --- a/tests/parser/dispatch5.cl +++ /dev/null @@ -1,53 +0,0 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, ,true + fALSE) -- Extra comma - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/dispatch5_error.txt b/tests/parser/dispatch5_error.txt deleted file mode 100755 index 3fc39c625..000000000 --- a/tests/parser/dispatch5_error.txt +++ /dev/null @@ -1 +0,0 @@ -(45, 71) - SyntacticError: ERROR at or near "," \ No newline at end of file diff --git a/tests/parser/dispatch6.cl b/tests/parser/dispatch6.cl deleted file mode 100755 index 0a953e2e6..000000000 --- a/tests/parser/dispatch6.cl +++ /dev/null @@ -1,57 +0,0 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@object.copy() -- Type identifiers begin with a upper case letter - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/dispatch6_error.txt b/tests/parser/dispatch6_error.txt deleted file mode 100755 index 543f3a38c..000000000 --- a/tests/parser/dispatch6_error.txt +++ /dev/null @@ -1 +0,0 @@ -(49, 15) - SyntacticError: ERROR at or near "object" \ No newline at end of file diff --git a/tests/parser/dispatch7.cl b/tests/parser/dispatch7.cl deleted file mode 100755 index 3ecac4d0f..000000000 --- a/tests/parser/dispatch7.cl +++ /dev/null @@ -1,57 +0,0 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.Copy() -- Identifiers begin with a lower case letter - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/dispatch7_error.txt b/tests/parser/dispatch7_error.txt deleted file mode 100755 index 27235d118..000000000 --- a/tests/parser/dispatch7_error.txt +++ /dev/null @@ -1 +0,0 @@ -(49, 22) - SyntacticError: ERROR at or near "Copy" \ No newline at end of file diff --git a/tests/parser/dispatch8.cl b/tests/parser/dispatch8.cl deleted file mode 100755 index eef0455ef..000000000 --- a/tests/parser/dispatch8.cl +++ /dev/null @@ -1,57 +0,0 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy(,) -- Extra comma - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/dispatch8_error.txt b/tests/parser/dispatch8_error.txt deleted file mode 100755 index 04704520a..000000000 --- a/tests/parser/dispatch8_error.txt +++ /dev/null @@ -1 +0,0 @@ -(49, 27) - SyntacticError: ERROR at or near "," \ No newline at end of file diff --git a/tests/parser/dispatch9.cl b/tests/parser/dispatch9.cl deleted file mode 100755 index 5fdef22d6..000000000 --- a/tests/parser/dispatch9.cl +++ /dev/null @@ -1,61 +0,0 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; - - testing5(): Object { - test1:Object.copy() -- Must be '@' not ':' - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/dispatch9_error.txt b/tests/parser/dispatch9_error.txt deleted file mode 100755 index eb0b3397d..000000000 --- a/tests/parser/dispatch9_error.txt +++ /dev/null @@ -1 +0,0 @@ -(53, 14) - SyntacticError: ERROR at or near ":" \ No newline at end of file diff --git a/tests/parser/let1.cl b/tests/parser/let1.cl deleted file mode 100755 index 576ae383c..000000000 --- a/tests/parser/let1.cl +++ /dev/null @@ -1,85 +0,0 @@ -(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let Count: Int <- 0, pow: Int <- 1 -- Object identifiers starts with a lowercase letter - in { - -- count <- 0; - -- pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/let1_error.txt b/tests/parser/let1_error.txt deleted file mode 100755 index 8b7fe63d1..000000000 --- a/tests/parser/let1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(45, 13) - SyntacticError: ERROR at or near "Count" \ No newline at end of file diff --git a/tests/parser/let2.cl b/tests/parser/let2.cl deleted file mode 100755 index 4cfaef0f8..000000000 --- a/tests/parser/let2.cl +++ /dev/null @@ -1,85 +0,0 @@ -(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int, pow: int <- 1 -- Type identifiers starts with a uppercase letter - in { - count <- 0; - -- pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/let2_error.txt b/tests/parser/let2_error.txt deleted file mode 100755 index 6fb3f8e9c..000000000 --- a/tests/parser/let2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(45, 30) - SyntacticError: ERROR at or near "int" \ No newline at end of file diff --git a/tests/parser/let3.cl b/tests/parser/let3.cl deleted file mode 100755 index 91e567fd8..000000000 --- a/tests/parser/let3.cl +++ /dev/null @@ -1,85 +0,0 @@ -(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int, pow: Int, -- Extra comma - in { - count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/let3_error.txt b/tests/parser/let3_error.txt deleted file mode 100755 index 71fa08812..000000000 --- a/tests/parser/let3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(46, 9) - SyntacticError: ERROR at or near IN \ No newline at end of file diff --git a/tests/parser/let4.cl b/tests/parser/let4.cl deleted file mode 100755 index a716c332d..000000000 --- a/tests/parser/let4.cl +++ /dev/null @@ -1,85 +0,0 @@ -(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- true++, pow: Int <- 1 -- Initialization must be an expression - in { - count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/let4_error.txt b/tests/parser/let4_error.txt deleted file mode 100755 index e12c7478c..000000000 --- a/tests/parser/let4_error.txt +++ /dev/null @@ -1 +0,0 @@ -(45, 32) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/let5.cl b/tests/parser/let5.cl deleted file mode 100755 index d974cc138..000000000 --- a/tests/parser/let5.cl +++ /dev/null @@ -1,85 +0,0 @@ -(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int = 0, pow: Int -- Must be '<-' not '=' - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/let5_error.txt b/tests/parser/let5_error.txt deleted file mode 100755 index e561f846c..000000000 --- a/tests/parser/let5_error.txt +++ /dev/null @@ -1 +0,0 @@ -(45, 24) - SyntacticError: ERROR at or near "=" \ No newline at end of file diff --git a/tests/parser/let6.cl b/tests/parser/let6.cl deleted file mode 100755 index b6e51d7e1..000000000 --- a/tests/parser/let6.cl +++ /dev/null @@ -1,74 +0,0 @@ -(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int <- 1 - in false++ -- Let body must be an expression - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/let6_error.txt b/tests/parser/let6_error.txt deleted file mode 100755 index 7a77928b9..000000000 --- a/tests/parser/let6_error.txt +++ /dev/null @@ -1 +0,0 @@ -(46, 18) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/let7.cl b/tests/parser/let7.cl deleted file mode 100755 index 6fd63e6a7..000000000 --- a/tests/parser/let7.cl +++ /dev/null @@ -1,85 +0,0 @@ -(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - (* Missing "in" *) { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/let7_error.txt b/tests/parser/let7_error.txt deleted file mode 100755 index 654b1ce60..000000000 --- a/tests/parser/let7_error.txt +++ /dev/null @@ -1 +0,0 @@ -(46, 28) - SyntacticError: ERROR at or near "{" \ No newline at end of file diff --git a/tests/parser/loop1.cl b/tests/parser/loop1.cl deleted file mode 100755 index 7d0d7688f..000000000 --- a/tests/parser/loop1.cl +++ /dev/null @@ -1,78 +0,0 @@ -(* A loop has the form while loop pool *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - count: Int <- 1; - - testing6(): Object { - while count < 1024*1024 - -- Missing "loop" - count <- count * 2 - pool - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/loop1_error.txt b/tests/parser/loop1_error.txt deleted file mode 100755 index 94248ff00..000000000 --- a/tests/parser/loop1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(49, 13) - SyntacticError: ERROR at or near "count" \ No newline at end of file diff --git a/tests/parser/loop2.cl b/tests/parser/loop2.cl deleted file mode 100755 index a9613c487..000000000 --- a/tests/parser/loop2.cl +++ /dev/null @@ -1,78 +0,0 @@ -(* A loop has the form while loop pool *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - count: Int <- 1; - - testing6(): Object { - while count < 1024*1024 - loop - count <- count * 2 - -- Missing "pool" - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/loop2_error.txt b/tests/parser/loop2_error.txt deleted file mode 100755 index 6447101f8..000000000 --- a/tests/parser/loop2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(51, 5) - SyntacticError: ERROR at or near "}" \ No newline at end of file diff --git a/tests/parser/loop3.cl b/tests/parser/loop3.cl deleted file mode 100755 index 860adb4d1..000000000 --- a/tests/parser/loop3.cl +++ /dev/null @@ -1,78 +0,0 @@ -(* A loop has the form while loop pool *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - count: Int <- 1; - - testing6(): Object { - while count => 1024*1024 -- Condition must be an expression - loop - count <- count * 2 - pool - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/loop3_error.txt b/tests/parser/loop3_error.txt deleted file mode 100755 index 3da8bcde0..000000000 --- a/tests/parser/loop3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(47, 21) - SyntacticError: ERROR at or near DARROW \ No newline at end of file diff --git a/tests/parser/loop4.cl b/tests/parser/loop4.cl deleted file mode 100755 index 0a1194e82..000000000 --- a/tests/parser/loop4.cl +++ /dev/null @@ -1,78 +0,0 @@ -(* A loop has the form while loop pool *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - count: Int <- 1; - - testing6(): Object { - while count < 1024*1024 - loop - count <- true++ -- While body must be an expression - pool - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/loop4_error.txt b/tests/parser/loop4_error.txt deleted file mode 100755 index c39f35fe1..000000000 --- a/tests/parser/loop4_error.txt +++ /dev/null @@ -1 +0,0 @@ -(49, 27) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/method1.cl b/tests/parser/method1.cl deleted file mode 100755 index fcfbbcd30..000000000 --- a/tests/parser/method1.cl +++ /dev/null @@ -1,34 +0,0 @@ -(* A method of class A is a procedure that may manipulate the variables and objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - -- Method names must begin with lowercase letters - Testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/method1_error.txt b/tests/parser/method1_error.txt deleted file mode 100755 index 0eff41999..000000000 --- a/tests/parser/method1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(21, 5) - SyntacticError: ERROR at or near "Testing2" \ No newline at end of file diff --git a/tests/parser/method2.cl b/tests/parser/method2.cl deleted file mode 100755 index d5bdfd85c..000000000 --- a/tests/parser/method2.cl +++ /dev/null @@ -1,34 +0,0 @@ -(* A method of class A is a procedure that may manipulate the variables and objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - -- Parameter names must begin with lowercase letters - testing2(a: Alpha, B: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/method2_error.txt b/tests/parser/method2_error.txt deleted file mode 100755 index 1843fb7b4..000000000 --- a/tests/parser/method2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(21, 24) - SyntacticError: ERROR at or near "B" \ No newline at end of file diff --git a/tests/parser/method3.cl b/tests/parser/method3.cl deleted file mode 100755 index 1e5c9eb53..000000000 --- a/tests/parser/method3.cl +++ /dev/null @@ -1,34 +0,0 @@ -(* A method of class A is a procedure that may manipulate the variables and objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - -- Type names must begin with uppercase letters - testing2(a: Alpha, b: int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/method3_error.txt b/tests/parser/method3_error.txt deleted file mode 100755 index dbecf552e..000000000 --- a/tests/parser/method3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(21, 27) - SyntacticError: ERROR at or near "int" \ No newline at end of file diff --git a/tests/parser/method4.cl b/tests/parser/method4.cl deleted file mode 100755 index 019ada276..000000000 --- a/tests/parser/method4.cl +++ /dev/null @@ -1,34 +0,0 @@ -(* A method of class A is a procedure that may manipulate the variables and objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - -- Missing paremeter - testing3(x: Int,): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/method4_error.txt b/tests/parser/method4_error.txt deleted file mode 100755 index 6421cee2b..000000000 --- a/tests/parser/method4_error.txt +++ /dev/null @@ -1 +0,0 @@ -(25, 21) - SyntacticError: ERROR at or near ")" \ No newline at end of file diff --git a/tests/parser/method5.cl b/tests/parser/method5.cl deleted file mode 100755 index 13127f664..000000000 --- a/tests/parser/method5.cl +++ /dev/null @@ -1,34 +0,0 @@ -(* A method of class A is a procedure that may manipulate the variables and objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - -- Type names must begin with uppercase letters - testing3(): string { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/method5_error.txt b/tests/parser/method5_error.txt deleted file mode 100755 index 9bda07041..000000000 --- a/tests/parser/method5_error.txt +++ /dev/null @@ -1 +0,0 @@ -(25, 17) - SyntacticError: ERROR at or near "string" \ No newline at end of file diff --git a/tests/parser/method6.cl b/tests/parser/method6.cl deleted file mode 100755 index d48cd1293..000000000 --- a/tests/parser/method6.cl +++ /dev/null @@ -1,33 +0,0 @@ -(* A method of class A is a procedure that may manipulate the variables and objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - -- Body can't be empty - testing2(a: Alpha, b: Int): Int { - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/method6_error.txt b/tests/parser/method6_error.txt deleted file mode 100755 index e7d5de400..000000000 --- a/tests/parser/method6_error.txt +++ /dev/null @@ -1 +0,0 @@ -(22, 5) - SyntacticError: ERROR at or near "}" \ No newline at end of file diff --git a/tests/parser/mixed1.cl b/tests/parser/mixed1.cl deleted file mode 100755 index a27879513..000000000 --- a/tests/parser/mixed1.cl +++ /dev/null @@ -1,100 +0,0 @@ -(* Cool has four binary arithmetic operations: +, -, *, /. *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + 2 of - x: Int => new IO.out_string("Es un entero!"); - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; - - a: Int <- 1; - - testing8(x: Int, y: Int): Bool { - let z: Int <- 3, w: Int <- 4 - in isvoid (3 + a * (x / w + new Int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) - }; -}-- Mising ";" - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/mixed1_error.txt b/tests/parser/mixed1_error.txt deleted file mode 100755 index d5b0ff8bb..000000000 --- a/tests/parser/mixed1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(76, 1) - SyntacticError: ERROR at or near CLASS \ No newline at end of file diff --git a/tests/parser/mixed2.cl b/tests/parser/mixed2.cl deleted file mode 100755 index f5477e0bb..000000000 --- a/tests/parser/mixed2.cl +++ /dev/null @@ -1,14 +0,0 @@ -class Main { - main(): Object { - (new Alpha).print() - }; - -}; - -(* Class names must begin with uppercase letters *) -class alpha inherits IO { - print() : Object { - out_string("reached!!\n"); - }; -}; - diff --git a/tests/parser/mixed2_error.txt b/tests/parser/mixed2_error.txt deleted file mode 100755 index b5613c52a..000000000 --- a/tests/parser/mixed2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(9, 7) - SyntacticError: ERROR at or near "alpha" \ No newline at end of file diff --git a/tests/parser/mixed3.cl b/tests/parser/mixed3.cl deleted file mode 100755 index 1bdcad743..000000000 --- a/tests/parser/mixed3.cl +++ /dev/null @@ -1,40 +0,0 @@ -class Main inherits IO { - main() : Object { - { - out_string("Enter a number to check if number is prime\n"); - let i : Int <- in_int() in { - if(i <= 1) then { - out_string("Invalid Input\n"); - abort(); - } else { - if (isPrime(i) = 1) then - out_string("Number is prime\n") - else - out_string("Number is composite\n") - fi; - } - fi; - }; - } - }; - - mod(i : Int, ) : Int { -- Formal list must be comma separated. A comma does not terminate a list of formals. - i - (i/k)*k - }; - - isPrime(i : Int) : Int { - { - let x : Int <- 2, - c : Int <- 1 in - { - while (not (x = i)) loop - if (mod(i, x) = 0) then { - c <- 0; - x <- i; - } else x <- x + 1 fi - pool; - c; - }; - } - }; -}; diff --git a/tests/parser/mixed3_error.txt b/tests/parser/mixed3_error.txt deleted file mode 100755 index 159bdca63..000000000 --- a/tests/parser/mixed3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(21, 18) - SyntacticError: ERROR at or near ")" \ No newline at end of file diff --git a/tests/parser/mixed4.cl b/tests/parser/mixed4.cl deleted file mode 100755 index e752253be..000000000 --- a/tests/parser/mixed4.cl +++ /dev/null @@ -1,21 +0,0 @@ -class Main inherits IO { - main() : Object { - { - out_string("Enter number of numbers to multiply\n"); - out_int(prod(in_int())); - out_string("\n"); - } - }; - - prod(i : Int) : Int { - let y : Int <- 1 in { - while (not (i = 0) ) loop { - out_string("Enter Number: "); - y <- y * in_int(Main : Int); -- the parser correctly catches the error here - i <- i - 1; - } - pool; - y; - } - }; -}; diff --git a/tests/parser/mixed4_error.txt b/tests/parser/mixed4_error.txt deleted file mode 100755 index 2349f28a5..000000000 --- a/tests/parser/mixed4_error.txt +++ /dev/null @@ -1 +0,0 @@ -(14, 41) - SyntacticError: ERROR at or near "Main" \ No newline at end of file diff --git a/tests/parser/mixed5.cl b/tests/parser/mixed5.cl deleted file mode 100755 index c9176a890..000000000 --- a/tests/parser/mixed5.cl +++ /dev/null @@ -1,20 +0,0 @@ -class Main inherits IO { - str <- "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; - main() : Object { - { - out_string("Enter number of numbers to multiply\n"); - out_int(prod(in_int())); - out_string("\n"); - } - }; - prod(i : Int) : Int { - let y : Int <- 1 in { - while (not (i = 0) ) loop { - out_string("Enter Number: "); - y <- y * in_int(); - i <- i - 1; - } - y; - } - }; -} diff --git a/tests/parser/mixed5_error.txt b/tests/parser/mixed5_error.txt deleted file mode 100755 index 443037eca..000000000 --- a/tests/parser/mixed5_error.txt +++ /dev/null @@ -1 +0,0 @@ -(2, 9) - SyntacticError: ERROR at or near ASSIGN \ No newline at end of file diff --git a/tests/parser/mixed6.cl b/tests/parser/mixed6.cl deleted file mode 100755 index 5da80da31..000000000 --- a/tests/parser/mixed6.cl +++ /dev/null @@ -1,5 +0,0 @@ -classs Doom { - i : Int <- 0; - main() : Object { - if i = 0 then out_string("This is da real *h*t") - diff --git a/tests/parser/mixed6_error.txt b/tests/parser/mixed6_error.txt deleted file mode 100755 index af75ca925..000000000 --- a/tests/parser/mixed6_error.txt +++ /dev/null @@ -1 +0,0 @@ -(1, 1) - SyntacticError: ERROR at or near "classs" \ No newline at end of file diff --git a/tests/parser/operation1.cl b/tests/parser/operation1.cl deleted file mode 100755 index d38eb72d0..000000000 --- a/tests/parser/operation1.cl +++ /dev/null @@ -1,101 +0,0 @@ -(* Cool has four binary arithmetic operations: +, -, *, /. *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + 2 of - x: Int => new IO.out_string("Es un entero!"); - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; - - a: Int <- 1; - - testing8(x: Int, y: Int): Bool { - let z: Int <- 3, w: Int <- 4 - -- Missing ')' - in isvoid (3 + a * (x / w + new Int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a)/(0)*(((4 * 4))))) - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/operation1_error.txt b/tests/parser/operation1_error.txt deleted file mode 100755 index b30202399..000000000 --- a/tests/parser/operation1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(74, 5) - SyntacticError: ERROR at or near "}" \ No newline at end of file diff --git a/tests/parser/operation2.cl b/tests/parser/operation2.cl deleted file mode 100755 index 2dc628359..000000000 --- a/tests/parser/operation2.cl +++ /dev/null @@ -1,101 +0,0 @@ -(* Cool has four binary arithmetic operations: +, -, *, /. *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + 2 of - x: Int => new IO.out_string("Es un entero!"); - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; - - a: Int <- 1; - - testing8(x: Int, y: Int): Bool { - let z: Int <- 3, w: Int <- 4 - -- Type identifiers starts with a uppercase letter - in isvoid (3 + a * (x / w + new int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/operation2_error.txt b/tests/parser/operation2_error.txt deleted file mode 100755 index 37b458f3a..000000000 --- a/tests/parser/operation2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(73, 41) - SyntacticError: ERROR at or near "int" \ No newline at end of file diff --git a/tests/parser/operation3.cl b/tests/parser/operation3.cl deleted file mode 100755 index 61d6cbfa8..000000000 --- a/tests/parser/operation3.cl +++ /dev/null @@ -1,101 +0,0 @@ -(* Cool has four binary arithmetic operations: +, -, *, /. *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + 2 of - x: Int => new IO.out_string("Es un entero!"); - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; - - a: Int <- 1; - - testing8(x: Int, y: Int): Bool { - let z: Int <- 3, w: Int <- 4 - -- Object identifiers starts with a lowercase letter - in isvoid (3 + a * (x / w + new Int) - y - (((if tRue = not faLSe then ~Mazinger_Z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/operation3_error.txt b/tests/parser/operation3_error.txt deleted file mode 100755 index 6b266f3f3..000000000 --- a/tests/parser/operation3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(73, 81) - SyntacticError: ERROR at or near "Mazinger_Z" \ No newline at end of file diff --git a/tests/parser/operation4.cl b/tests/parser/operation4.cl deleted file mode 100755 index bae7de5b5..000000000 --- a/tests/parser/operation4.cl +++ /dev/null @@ -1,101 +0,0 @@ -(* Cool has four binary arithmetic operations: +, -, *, /. *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + 2 of - x: Int => new IO.out_string("Es un entero!"); - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; - - a: Int <- 1; - - testing8(x: Int, y: Int): Bool { - let z: Int <- 3, w: Int <- 4 - -- Double "+" - in isvoid (3 + a * (x / w++ new Int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file diff --git a/tests/parser/operation4_error.txt b/tests/parser/operation4_error.txt deleted file mode 100755 index e0ebb0985..000000000 --- a/tests/parser/operation4_error.txt +++ /dev/null @@ -1 +0,0 @@ -(73, 35) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/program1.cl b/tests/parser/program1.cl deleted file mode 100755 index 8e5cf617f..000000000 --- a/tests/parser/program1.cl +++ /dev/null @@ -1 +0,0 @@ -(* A Cool program can't be empty *) \ No newline at end of file diff --git a/tests/parser/program1_error.txt b/tests/parser/program1_error.txt deleted file mode 100755 index de00ac46b..000000000 --- a/tests/parser/program1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(0, 0) - SyntacticError: ERROR at or near EOF \ No newline at end of file diff --git a/tests/parser/program2.cl b/tests/parser/program2.cl deleted file mode 100755 index f8b16779c..000000000 --- a/tests/parser/program2.cl +++ /dev/null @@ -1,20 +0,0 @@ -(* Cool programs are sets of classes *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - --- Missing semicolon -class Test { - testing(): Int { - 2 + 2 - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; diff --git a/tests/parser/program2_error.txt b/tests/parser/program2_error.txt deleted file mode 100755 index 94ba8df65..000000000 --- a/tests/parser/program2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(16, 1) - SyntacticError: ERROR at or near CLASS \ No newline at end of file diff --git a/tests/parser/program3.cl b/tests/parser/program3.cl deleted file mode 100755 index e27889c57..000000000 --- a/tests/parser/program3.cl +++ /dev/null @@ -1,24 +0,0 @@ -(* Cool programs are sets of classes *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - testing(): Int { - 2 + 2 - }; -}; - --- Only classes -suma(a: Int, b: Int) int { - a + b -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; diff --git a/tests/parser/program3_error.txt b/tests/parser/program3_error.txt deleted file mode 100755 index dd3b3947a..000000000 --- a/tests/parser/program3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(16, 1) - SyntacticError: ERROR at or near "suma" \ No newline at end of file diff --git a/tests/semantic/hello_world.cl b/tests/semantic/hello_world.cl deleted file mode 100755 index 0c818f908..000000000 --- a/tests/semantic/hello_world.cl +++ /dev/null @@ -1,5 +0,0 @@ -class Main inherits IO { - main(): IO { - out_string("Hello, World.\n") - }; -}; diff --git a/tests/test_inference.py b/tests/test_inference.py new file mode 100644 index 000000000..2c67a2afa --- /dev/null +++ b/tests/test_inference.py @@ -0,0 +1,65 @@ +import pathlib +import pytest +from typing import List + +from lexertab import CoolLexer +from parsertab import CoolParser +from semantics import TypeCollector, TypeBuilder, OverriddenMethodChecker, TypeChecker, topological_ordering +from semantics.formatter import CodeBuilder +from semantics.type_inference import InferenceChecker +from semantics.utils.scope import Context, Scope + + +def tokenize(code): + lexer = CoolLexer() + tokens = lexer(code) + return tokens, lexer + + +def parse(tokens): + parser = CoolParser() + ast = parser(tokens) + return ast, parser + + +def check_semantics(ast, scope: Scope, context: Context, errors: List[str]): + TypeCollector(context, errors).visit(ast) + TypeBuilder(context, errors).visit(ast) + declarations = ast.declarations + topological_ordering(ast, context, errors) + ast.declarations = declarations + OverriddenMethodChecker(context, errors).visit(ast) + InferenceChecker(context, errors).visit(ast, scope) + TypeChecker(context, errors).visit(ast, scope) + return ast, scope, context, errors + + +def test_inference_programs(): + inference_testing_programs = [] + inference_testing_results = [] + for path in sorted(pathlib.Path('inference').iterdir()): + s = path.open('r').read() + if 'program' in path.name: + inference_testing_programs.append(s) + else: + inference_testing_results.append(s) + + for code, result in zip(inference_testing_programs, inference_testing_results): + tokens, _ = tokenize(code) + ast, _ = parse(tokens) + ast, scope, context, errors = check_semantics(ast, Scope(), Context(), []) + assert not errors and CodeBuilder().visit(ast, 0) == result + + +if __name__ == '__main__': + pass + + # if not errors and not parser.contains_errors: + # try: + # Executor(context).visit(ast, Scope()) + # print('Program finished...') + # except ExecutionError as e: + # sys.stderr.write(e.text + '\n') + # + # for error in errors: + # sys.stderr.write(error + '\n') From 708747319bbfdc5d1b55cd53a28515f2e9224847 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Mon, 19 Oct 2020 14:11:04 +0200 Subject: [PATCH 073/143] create a cli api --- cool.py | 216 ++++++++++++++++++++-------------- docs/Informe.md | 202 +++---------------------------- docs/Instructions.md | 29 ----- grammar.py | 2 +- requirements.txt | 3 +- semantics/type_collector.py | 2 +- semantics/type_inference.py | 35 ++++-- semantics/utils/scope.py | 3 + tests/inference/05_program.cl | 16 +++ tests/inference/05_result.cl | 16 +++ tests/test_inference.py | 9 +- 11 files changed, 212 insertions(+), 321 deletions(-) delete mode 100755 docs/Instructions.md create mode 100644 tests/inference/05_program.cl create mode 100644 tests/inference/05_result.cl diff --git a/cool.py b/cool.py index 03cc3a883..c8329921e 100644 --- a/cool.py +++ b/cool.py @@ -1,4 +1,8 @@ import sys +from typing import List + +import typer +from pathlib import Path from lexertab import CoolLexer from parsertab import CoolParser @@ -8,101 +12,137 @@ from semantics.type_inference import InferenceChecker from semantics.utils.scope import Context, Scope -execution_program_01 = r""" -class A { } - -class B inherits A { } - -class C inherits A { } - -class Main inherits IO { - number: Int <- 5; - - main () : Object { - 0 - }; - - testing_case() : IO { - let a: A <- new C in - case a of - x: B => out_string("Is type B.\n"); - x: C => out_string("Is type C.\n"); - esac - }; - - testing_fibonacci(n: Int) : IO {{ - out_string("Iterative Fibonacci : "); - out_int(iterative_fibonacci(5)); - out_string("\n"); - - out_string("Recursive Fibonacci : "); - out_int(recursive_fibonacci(5)); - out_string("\n"); - }}; - - recursive_fibonacci (n: AUTO_TYPE) : AUTO_TYPE { - if n <= 2 then 1 else recursive_fibonacci(n - 1) + recursive_fibonacci(n - 2) fi - }; - - iterative_fibonacci(n: AUTO_TYPE) : AUTO_TYPE { - let i: Int <- 2, n1: Int <- 1, n2: Int <- 1, temp: Int in { - while i < n loop - let temp: Int <- n2 in { - n2 <- n2 + n1; - n1 <- temp; - i <- i + 1; - } - pool; - n2; - } - }; -} -""" - -syntactic_errors = """ -class Main { - a: Int - - b: String - - main () : Object { let a: Int <- "" in 0 } - - errors() : Object { - case a of - x: Int => (new IO).out_int(x) - y: String => (new IO).out_string(x) - esac - } -} -""" - -verbose = bool(sys.argv[1]) if len(sys.argv) > 1 else False -lexer = CoolLexer() -parser = CoolParser(verbose) - -if __name__ == '__main__': - tokens = lexer(execution_program_01) +# execution_program_01 = r""" +# class A { } +# +# class B inherits A { } +# +# class C inherits A { } +# +# class Main inherits IO { +# number: Int <- 5; +# +# main () : Object { +# 0 +# }; +# +# testing_case() : IO { +# let a: A <- new C in +# case a of +# x: B => out_string("Is type B.\n"); +# x: C => out_string("Is type C.\n"); +# esac +# }; +# +# testing_fibonacci(n: Int) : IO {{ +# out_string("Iterative Fibonacci : "); +# out_int(iterative_fibonacci(5)); +# out_string("\n"); +# +# out_string("Recursive Fibonacci : "); +# out_int(recursive_fibonacci(5)); +# out_string("\n"); +# }}; +# +# recursive_fibonacci (n: AUTO_TYPE) : AUTO_TYPE { +# if n <= 2 then 1 else recursive_fibonacci(n - 1) + recursive_fibonacci(n - 2) fi +# }; +# +# iterative_fibonacci(n: AUTO_TYPE) : AUTO_TYPE { +# let i: Int <- 2, n1: Int <- 1, n2: Int <- 1, temp: Int in { +# while i < n loop +# let temp: Int <- n2 in { +# n2 <- n2 + n1; +# n1 <- temp; +# i <- i + 1; +# } +# pool; +# n2; +# } +# }; +# } +# """ +# +# syntactic_errors = """ +# class Main { +# a: Int +# +# b: String +# +# main () : Object { let a: Int <- "" in 0 } +# +# errors() : Object { +# case a of +# x: Int => (new IO).out_int(x) +# y: String => (new IO).out_string(x) +# esac +# } +# } +# """ + +# lexer = CoolLexer() +# parser = CoolParser() + +app = typer.Typer() + + +def check_semantics(ast, scope: Scope, context: Context, errors: List[str]): + TypeCollector(context, errors).visit(ast) + TypeBuilder(context, errors).visit(ast) + topological_ordering(ast, context, errors) + OverriddenMethodChecker(context, errors).visit(ast) + InferenceChecker(context, errors).visit(ast, scope) + TypeChecker(context, errors).visit(ast, scope) + return ast, scope, context, errors + + +@app.command() +def tokenize(file: str, verbose: bool = False): + path = Path.cwd() / file + s = path.open('r').read() + lexer = CoolLexer() + tokens = lexer(s) + + if lexer.contain_errors: + for e in lexer.errors: + typer.echo(e, err=True) + + if verbose: + for t in tokens: + typer.echo(t) + + return tokens + + +@app.command() +def parse(file: str, verbose: bool = False): + tokens = tokenize(file, verbose) + parser = CoolParser(verbose) ast = parser(tokens) if parser.contains_errors: for e in parser.errors: - sys.stderr.write(e + '\n') + typer.echo(e, err=True) + + return ast, parser + + +@app.command() +def infer(file: str, verbose: bool = False): + ast, _ = parse(file, verbose) if ast is not None: - context = Context() - errors = [] - scope = Scope() + ast, scope, context, error = check_semantics(ast, Scope(), Context(), []) + typer.echo(CodeBuilder().visit(ast, 0)) - TypeCollector(context, errors).visit(ast) - TypeBuilder(context, errors).visit(ast) - topological_ordering(ast, context, errors) - OverriddenMethodChecker(context, errors).visit(ast) - InferenceChecker(context, errors).visit(ast, scope) - TypeChecker(context, errors).visit(ast, scope) - if verbose: - print(CodeBuilder().visit(ast, 0), '\n') +@app.command() +def run(file: str, verbose: bool = False): + ast, parser = parse(file, verbose) + + if ast is not None: + ast, scope, context, errors = check_semantics(ast, Scope(), Context(), []) if not errors and not parser.contains_errors: try: @@ -113,3 +153,7 @@ class Main { for error in errors: sys.stderr.write(error + '\n') + + +if __name__ == '__main__': + app() diff --git a/docs/Informe.md b/docs/Informe.md index 34114b61d..333420973 100644 --- a/docs/Informe.md +++ b/docs/Informe.md @@ -8,189 +8,17 @@ ## Indice -- 0 Estructura del proyecto. -- 1 Analisis Lexicografico y Sintactico. - - 1.1 Generador de lexers y parsers LR "PyJapt". - - 1.2 Manejo de errores lexicograficos y sintacticos. -- 2 Inferencia de tipos. - - 2.1 Algoritmo y Grafo de Dependecias. - - 2.2 Nodos de Dependencia. - - 2.3 Casos factibles. - - 2.3.1 Ejemplos de casos Factibles para la Inferencia. - - 2.4 Casos No factibles. - - 2.4.1 Casos Generales. - - 2.4.2 Casos Particulares. - - 2.5 Expresiones atomicas. - -## 1 Analisis Lexicografico y Sintactico - -### 1.1 Generador de lexers y parsers LR "PyJapt" - -PyJapt es un generador de lexer y parser desarrolado por los autores del proyecto que pretende dar una solucion no solo a la creacion de estas piezas del proceso de compilacion, sino tambien permitir una interfaz de manejo de errores sintacticos y lexicograficos personalizados. Para su construccion nos hemos basado en las construcciones realizadas en las clases practicas y nos hemos inspirado en otros generadores de parser para las nuevas funcionalidades como yacc, bison, ply y antlr por ejemplo. - -PyJapt gira alrededor del concepto de gramatica. - -Para definir los no terminales de la gramatiga utilizamos el metodo `add_non_terminal()` de la clase `Grammar`. - -```python -from pyjapt.grammar import Grammar - -G = Grammar() - -expr = G.add_non_terminal('expr', start_symbol=True) -term = G.add_non_terminal('term') -fact = G.add_non_terminal('fact') -``` - -Para definir los terminales de nuestra gramatica usaremos el metodo `add_terminal()` de la clase `Grammar`. Este metodo recibe como primer parametro el nombre del no terminal y como parametro opcional una expresion regular para el analizador lexicografico. En caso de el segundo parametro no se provea la expresion regular sera el nombre literal del terminal. - -```python -plus = G.add_terminals('+') -minus = G.add_terminals('-') -star = G.add_terminals('*') -div = G.add_terminals('/') - -num = G.add_terminal('int', regex=r'\d+') -``` - -Si tenemos un conjunto de terminales cuya expresion regular coincide con su propio nombre podemos encapsularlos con la funcion `add_terminals()` de la clase `Grammar` - -```python -plus, minus, star, div = G.add_terminals('+ - * /') -num = G.add_terminal('int', regex=r'\d+') -``` - -Puede darse el caso tambien de que querramos aplicar una regla cuando un terminal especifico sea encontrado, para esto PyJapt nos brinda el decorador de funciones `terminal()` de la clase `Grammar` que recibe el nombre y la expresion regular del terminal. La funcion decorada debe recibir como parametro uan referencia al lexer para poder modificar parametros tales como la fila y la columna de los terminales o la posicion de lectura del parser y retornar un `Token`, en caso de no retornar este token sera ignorado. - -```python -@G.terminal('int', r'\d+') -def id_terminal(lexer): - lexer.column += len(lexer.token.lex) - lexer.position += len(lexer.token.lex) - lexer.token.lex = int(lexer.token.lex) - return lexer.token -``` - -Tambien podemos usar esta forma de definicion de terminales para saltarnos ciertos caracteres o tokens. - -```python -################## -# Ignored Tokens # -################## -@G.terminal('newline', r'\n+') -def newline(lexer): - lexer.lineno += len(lexer.token.lex) - lexer.position += len(lexer.token.lex) - lexer.column = 1 - - -@G.terminal('whitespace', r' +') -def whitespace(lexer): - lexer.column += len(lexer.token.lex) - lexer.position += len(lexer.token.lex) - - -@G.terminal('tabulation', r'\t+') -def tab(lexer): - lexer.column += 4 * len(lexer.token.lex) - lexer.position += len(lexer.token.lex) -``` - -Para definir las producciones de nuestra gramatica podemos usar una forma attributada o no atributada: - -```python -# Esta es una gramatica no atributada usando las variable previamente declaradas -expr %= expr + plus + term -expr %= expr + minus + term -expr %= term - -term %= term + star + fact -term %= term + div + fact -term %= fact - -fact %= num - -# Un poco mas sencillo... -# Cada simbolo del string de la produccion debe estar separado por un espacio en blanco -expr %= 'expr + term' -expr %= 'expr - term' -expr %= 'term' - -term %= 'term * factor' -term %= 'term / factor' -term %= 'fact' - -fact %= 'int' - -# Esta es una gramatica atributada -expr %= 'expr + term', lambda s: s[1] + s[3] -expr %= 'expr - term', lambda s: s[1] + s[3] -expr %= 'term', lambda s: s[1] - -term %= 'term * factor', lambda s: s[1] + s[3] -term %= 'term / factor', lambda s: s[1] + s[3] -term %= 'fact', lambda s: s[1] - -fact %= 'int', lambda s: int(s[1]) - -# Tambien podemos atributar una funcion para definir una regla semantica -# Esta funcion debe recibir como parametro `s` que es una referencia a una -# lista con las reglas semanticas de cada simbolo de la produccion. -# Para separar el simbolo de la cabecera del cuerpo de la expresion -# usamos como segundo simbolo `->` -@G.production('expr -> expr + term') -def expr_prod(s): - print('Estas sumando una expresion y un termino ;)') - return s[1] + s[3] -``` - -### 1.2 Manejo de errores lexicograficos y sintacticos - -Una parte importante del proceso de parsing es manejar los errores. Para esto podemos hacer el parser a mano e insertar el reporte de errores, ya que los las tecnicas como `Panic Recovery Mode` la cual implementa `PyJapt` solo permiten que no se detenga la ejecucion de nuestro parser, para dar reportes de errores especificos `PyJapt` ofrece la creacion de producciones erroneas y para reportar errores comunes en un lenguaje de programacion como la falta de un `;` un operador desconocido etc. para esto nuestra gramatica debe activar el flag de terminal de error. - -```python -G.add_terminal_error() # Agrega el terminal de error a la gramatica. - -# Ejemplo de una posible produccion de error -@G.production("instruction -> let id = expr error") -def attribute_error(s): - # Con esta linea reportamos el mensaje del error - # Como la regla semantica de s[5] es el propio token (por ser un terminal) entonces tenemos acceso - # a su lexema, tipo de token, line y columna. - s.error(f"{s[5].line, s[5].column} - SyntacticError: Expected ';' instead of '{s[5].lex}'") - - # Con esta linea permitimos que se siga creando una nodo del ast para - # poder detectar errores semanticos a pesar de haber errores sintacticos - return LetInstruction(s[2], s[4]) -``` - -Para reportar errores lexicograficos el procedimiento es bastante similar solo definimos un token que contenga un error, en este ejemplo un comentario multiliena que contiene un final de cadena. - -```python -@G.terminal('comment_error', r'\(\*(.|\n)*$') -def comment_eof_error(lexer): - lexer.contain_errors = True - lex = lexer.token.lex - for s in lex: - if s == '\n': - lexer.lineno += 1 - lexer.column = 0 - lexer.column = 1 - lexer.position += len(lex) - lexer.print_error(f'{lexer.lineno, lexer.column} -LexicographicError: EOF in comment') -``` - -Y para reportar errores generales durante el proceso de tokenizacion podemos usar el decorador `lexical_error` - -```python -@G.lexical_error -def lexical_error(lexer): - lexer.print_error(f'{lexer.lineno, lexer.column} -LexicographicError: ERROR "{lexer.token.lex}"') - lexer.column += 1 - lexer.position += 1 -``` - -## 2 Inferencia de Tipos +- 1 Inferencia de tipos. + - 1.1 Algoritmo y Grafo de Dependecias. + - 1.2 Nodos de Dependencia. + - 1.3 Casos factibles. + - 1.3.1 Ejemplos de casos Factibles para la Inferencia. + - 1.4 Casos No factibles. + - 1.4.1 Casos Generales. + - 1.4.2 Casos Particulares. + - 1.5 Expresiones atomicas. + +## 1 Inferencia de Tipos COOL es un lenguaje de programacion estaticamente tipado, y aunque el lenguaje no presenta inferencia de tipos esta es una caracteristica muy util que incorporaremos en un nuestro interprete. @@ -198,7 +26,7 @@ Nuestro algoritmo de inferencia de tipos se apoya en el uso basico de la teoria La inferencia de tipos de nuestro proyecto detecta para cada atributo, variable, parametro de funcion o retorno de funcion el primer tipo que le puede ser asignado, modificando en el arbol de sintaxis abstracta el string `AUTO_TYPE` por el nombre del tipo correspondiente y asignando los tipos correspondientes en el contexto y el ambito en que seon declarados. -### 2.1 Algoritmo y Grafo de Dependecias +### 1.1 Algoritmo y Grafo de Dependecias ***Entrada :*** Un arbol de sintaxis abstracta, un contexto con todos los tipos declarados en el programa de COOL. @@ -206,7 +34,7 @@ La inferencia de tipos de nuestro proyecto detecta para cada atributo, variable, ***Algoritmo :*** Durante el recorrido del AST sera construido un grafo dirigido cuyos nodos encerraran el concepto de las expresiones marcadas como `AUTO_TYPE` y las aristas representan las dependencias entre las expresiones de estos nodos para inferir su tipo. Sea `E1` una expresion cuyo tipo estatico es marcado como `AUTO_TYPE`, y sea `E2` una expresion a partir de a cual se puede inferir el tipo de estatico de E1 entonces en el grafo existira la arista ``. Una vez construido el arbol se comenzara una cadena de expansion de tipos estaticos de la forma `E1, E2, ..., En` donde `Ej` se infiere de `Ei` con `1 < j = i + 1 <= n` y `E1` es una expresion con tipo estatico definido, al cual llamaremos atomo. Cuando todos los atomos se hayan propagado a traves del grafo los nodos que no hayan podido ser resueltos seran marcados como tipos `Object` al ser esta la clase mas general del lenguaje. -### 2.2 Nodos de Dependencia +### 1.2 Nodos de Dependencia Cada nodo del grafo sera una abstraccion de un concepto en el que se use un tagueo explicito de `AUTO_TYPE` y tendra las referencias a las partes del proceso de semantica del programa, ademas de que cada nodo contara con un metodo `update(type)` el cual actualiza el tipo estatico de estos conceptos. @@ -236,7 +64,7 @@ class VariableInfoNode(DependencyNode): pass ``` -### 2.3 Casos factibles +### 1.3 Casos factibles Funcionando de manera analoga para atributos, variables, parametros y retorno de funciones. Explicado de forma recursiva puede ser visto como: @@ -254,7 +82,7 @@ Funcionando de manera analoga para atributos, variables, parametros y retorno de - En las expresiones if-then-else o case-of asignan automaticamente el tipo `Object` por el momento debido a la complejidad que supone la operacion `join` en el los case y en las clausulas then-else. -### 2.3.1 Ejemplos de casos Factibles para la Inferencia +### 1.3.1 Ejemplos de casos Factibles para la Inferencia En este caso la expresion `d + 1` desambigua a `d` en un `Int` y luego `c` se infiere de `d`, `b` se infiere de `c`, `a` se infiere de `b` y el retorno de la funcion de infiere de `a`. Quedando todos los parametros y el retorno de la funcion marcados como `Int`. diff --git a/docs/Instructions.md b/docs/Instructions.md deleted file mode 100755 index ea994b6f9..000000000 --- a/docs/Instructions.md +++ /dev/null @@ -1,29 +0,0 @@ -# Interprete de Cool - -# Manual de Desarrollo - -## Flujo de Trabajo: - -- El archivo `astnodes.py` contiene los nodos del ast de cool, fue renombrado asi para no entrar en conflicto con la libreria `ast` de python - -- Todo cambio realizado en la gramatica o al lexer se hara en el archivo `grammar.py`. Para probar si al hacer cambios en la gramatica esta sigue sin dar conflicto tansolo debemos correr el script de la siguiente forma `python3 grammar.py` - -- Si ha ocurrido algun cambio significativo en la gramatica o el lexer, ya sea agragar una nueva produccion, terminal, o una nueva expresion regular, se debe ejecutar este modulo. Para esta ultima accion tenemos el archivo `grammar.py`, para correrlo basta con hacer `python3 grammar.py` y este creara dos archivos nuevo `parser.py` y `lexer.py` que contendran el parser y el lexer de cool serializado con las modificaciones realizadas para no tener que construir el parser cada vez que probemos el programa. - -- Al paquete `cmp` se le han hecho varias modificaciones: - - - Se han eliminado todos los archivos y clases innecesarios para el proceso de parsing y lexing. - - - El archivo `lexing.py` contiene las clases `Token` y `Lexer`. - - - El archivo `parsing.py` contiene los metodos y funciones necesarios para el proceso de creacion de los parser SLR, LR(1), LALR(1). Se han hecho varias mejoras al proceso de de creacion de los parsers. - - - El archivo `pycompiler.py` se mantine con las definiciones de la gramatica, y se ha modificado para que casi todo sea manejado desde la clase `Grammar` (Tanto la creacion del lexer como el parser) - - - El archivo `serialization.py` contiene los serializers de las tablas de lexer y parsing. - - - El archivo `utils.py` contiene la clase `ContainerSet` (Posible eliminacion) - -- Para probar programas tan solo escribalo en un archivo `.cl` en la carpeta `scripts/` y ejecutar el comando en la terminal `python3 test.py `, por ejemplo `python3 test.py tokenize program.cl` o `python3 test.py parse program.cl` - -- En el archivo `main.py` hay un pipeline de como es el proceso completo. diff --git a/grammar.py b/grammar.py index 24c4caad3..3725f1922 100644 --- a/grammar.py +++ b/grammar.py @@ -3,7 +3,7 @@ from pyjapt import Grammar -from semantics.utils import astnodes as ast +import semantics.utils.astnodes as ast G = Grammar() diff --git a/requirements.txt b/requirements.txt index 01f73f3d5..a59742791 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ -pyjapt~=0.1.7 \ No newline at end of file +pyjapt~=0.1.7 +typer~=0.3.2 \ No newline at end of file diff --git a/semantics/type_collector.py b/semantics/type_collector.py index 23b797eff..dbc000eba 100644 --- a/semantics/type_collector.py +++ b/semantics/type_collector.py @@ -22,7 +22,7 @@ def visit(self, node): pass @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode): + def visit(self, node): self.context.create_type('AUTO_TYPE') self_type = self.context.create_type('SELF_TYPE') object_type = self.context.create_type('Object') diff --git a/semantics/type_inference.py b/semantics/type_inference.py index c8791f4d4..2334d998a 100644 --- a/semantics/type_inference.py +++ b/semantics/type_inference.py @@ -44,6 +44,8 @@ class DependencyNode: + type: Type + def update(self, typex): raise NotImplementedError() @@ -52,10 +54,10 @@ def __repr__(self): class AtomNode(DependencyNode): - def __init__(self, typex): - self.type = typex + def __init__(self, typex: Type): + self.type: Type = typex - def update(self, typex): + def update(self, typex: Type): pass def __str__(self): @@ -63,7 +65,7 @@ def __str__(self): class VariableInfoNode(DependencyNode): - def __init__(self, var_type, variable_info): + def __init__(self, var_type: Type, variable_info: VariableInfo): self.type: Type = var_type self.variable_info: VariableInfo = variable_info @@ -75,7 +77,7 @@ def __str__(self): class AttributeNode(DependencyNode): - def __init__(self, var_type, attribute): + def __init__(self, var_type: Type, attribute: Attribute): self.type: Type = var_type self.attribute: Attribute = attribute @@ -87,7 +89,7 @@ def __str__(self): class ParameterNode(DependencyNode): - def __init__(self, param_type, method, index): + def __init__(self, param_type: Type, method: Method, index: int): self.type: Type = param_type self.method: Method = method self.index: int = index @@ -100,7 +102,7 @@ def __str__(self): class ReturnTypeNode(DependencyNode): - def __init__(self, typex, method): + def __init__(self, typex: Type, method: Method): self.type: Type = typex self.method: Method = method @@ -164,7 +166,7 @@ def __init__(self, context, errors): self.current_type: Optional[Type] = None self.current_method: Optional[Method] = None - self.variables = {} + self.variables: Dict[VariableInfo, VariableInfoNode] = {} self.attributes = self.build_attributes_reference(context) self.methods = self.build_methods_reference(context) self.graph = DependencyGraph() @@ -221,14 +223,14 @@ def visit(self, node: ast.ClassDeclarationNode, scope: Scope): @visitor.when(ast.AttrDeclarationNode) def visit(self, node: ast.AttrDeclarationNode, scope: Scope): - # Define attribute in the scope - var_info = scope.define_variable(node.id, self.context.get_type(node.type)) - # Solve the expression of the attribute expr_node = self.visit(node.expr, scope.create_child()) if node.expr is not None else None + # Define attribute in the scope + var_info = scope.define_variable(node.id, self.context.get_type(node.type)) + # Set and get the reference to the variable info node - var_info_node = self.variables[var_info] = VariableInfoNode(self.context.get_type('AUTO_TYPE'), var_info) + var_info_node = self.variables[var_info] = VariableInfoNode(self.context.get_type(node.type), var_info) if node.type == 'AUTO_TYPE': # Get the reference to the attribute node @@ -307,7 +309,14 @@ def visit(self, node: ast.AssignNode, scope: Scope): expr_node = self.visit(node.expr, scope.create_child()) if var_info is not None: - self.graph.add_edge(expr_node, self.variables[var_info]) + if expr_node.type.name != 'AUTO_TYPE' and var_info.type.name == 'AUTO_TYPE': + self.graph.add_edge(expr_node, self.variables[var_info]) + elif var_info.type.name != 'AUTO_TYPE' and expr_node.type.name == 'AUTO_TYPE': + self.graph.add_edge(AtomNode(self.context.get_type(var_info.type.name)), expr_node) + elif var_info.type.name == 'AUTO_TYPE' and expr_node.type.name == 'AUTO_TYPE': + # Create a cycle + self.graph.add_edge(expr_node, self.variables[var_info]) + self.graph.add_edge(self.variables[var_info], expr_node) else: pass diff --git a/semantics/utils/scope.py b/semantics/utils/scope.py index 5eb851086..e377f198e 100755 --- a/semantics/utils/scope.py +++ b/semantics/utils/scope.py @@ -234,6 +234,9 @@ def __init__(self, name, vtype): self.name: str = name self.type: Type = vtype + def __str__(self): + return self.name + ': ' + self.type.name + class Scope: def __init__(self, parent: Optional['Scope'] = None): diff --git a/tests/inference/05_program.cl b/tests/inference/05_program.cl new file mode 100644 index 000000000..da775aabe --- /dev/null +++ b/tests/inference/05_program.cl @@ -0,0 +1,16 @@ +class Main { + main (): Object { + 0 + }; + + f (a: AUTO_TYPE, b: AUTO_TYPE, c: AUTO_TYPE, d: AUTO_TYPE): AUTO_TYPE { + { + a <- b; + b <- c; + c <- d; + d <- a; + d + 1; + a; + } + }; +} \ No newline at end of file diff --git a/tests/inference/05_result.cl b/tests/inference/05_result.cl new file mode 100644 index 000000000..5d9e597f1 --- /dev/null +++ b/tests/inference/05_result.cl @@ -0,0 +1,16 @@ +class Main { + main (): Object { + 0 + }; + + f (a: Int, b: Int, c: Int, d: Int): Int { + { + a <- b; + b <- c; + c <- d; + d <- a; + d + 1; + a; + } + }; +} \ No newline at end of file diff --git a/tests/test_inference.py b/tests/test_inference.py index 2c67a2afa..7eaa8b086 100644 --- a/tests/test_inference.py +++ b/tests/test_inference.py @@ -1,5 +1,5 @@ -import pathlib -import pytest +import os +from pathlib import Path from typing import List from lexertab import CoolLexer @@ -37,7 +37,10 @@ def check_semantics(ast, scope: Scope, context: Context, errors: List[str]): def test_inference_programs(): inference_testing_programs = [] inference_testing_results = [] - for path in sorted(pathlib.Path('inference').iterdir()): + + cwd = Path.cwd() + path = cwd / 'inference' if cwd.name.endswith('tests') else cwd / 'tests' / 'inference' + for path in sorted(path.iterdir()): s = path.open('r').read() if 'program' in path.name: inference_testing_programs.append(s) From 5e782275f704a33af0f1edf5bc324036397b876a Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Mon, 19 Oct 2020 23:04:01 +0200 Subject: [PATCH 074/143] - --- cool.py | 5 +++- semantics/execution.py | 5 ++++ semantics/formatter.py | 2 +- semantics/type_inference.py | 7 ++++-- tests/inference/06_program.cl | 44 ++++++++++++++++++++++++++++++++++ tests/inference/06_result.cl | 45 +++++++++++++++++++++++++++++++++++ 6 files changed, 104 insertions(+), 4 deletions(-) create mode 100644 tests/inference/06_program.cl create mode 100644 tests/inference/06_result.cl diff --git a/cool.py b/cool.py index c8329921e..8a413cec5 100644 --- a/cool.py +++ b/cool.py @@ -133,7 +133,10 @@ def infer(file: str, verbose: bool = False): ast, _ = parse(file, verbose) if ast is not None: - ast, scope, context, error = check_semantics(ast, Scope(), Context(), []) + ast, scope, context, errors = check_semantics(ast, Scope(), Context(), []) + if errors: + for e in errors: + typer.echo(e, err=True) typer.echo(CodeBuilder().visit(ast, 0)) diff --git a/semantics/execution.py b/semantics/execution.py index 88596ddbf..b1f78fef7 100644 --- a/semantics/execution.py +++ b/semantics/execution.py @@ -152,6 +152,11 @@ def visit(self, node: ast.LetNode, scope: Scope): @visitor.when(ast.AssignNode) def visit(self, node: ast.AssignNode, scope: Scope): variable_info = scope.find_variable(node.id) + + if variable_info is None: + self.current_instance.set_attribute_instance(node.id, self.visit(node.expr, scope)) + return self.current_instance.get_attribute_instance(node.id) + variable_info.instance = self.visit(node.expr, scope) return variable_info.instance diff --git a/semantics/formatter.py b/semantics/formatter.py index c0a5ebb2e..0f2d5e9f6 100644 --- a/semantics/formatter.py +++ b/semantics/formatter.py @@ -96,7 +96,7 @@ def visit(self, node: ast.AtomicNode, tabs: int = 0): @visitor.when(ast.InstantiateNode) def visit(self, node: ast.InstantiateNode, tabs: int = 0): - return ' ' * tabs + f'new {node.lex}' + return ' ' * tabs + f'(new {node.lex})' class Formatter: diff --git a/semantics/type_inference.py b/semantics/type_inference.py index 2334d998a..7e748dac8 100644 --- a/semantics/type_inference.py +++ b/semantics/type_inference.py @@ -367,7 +367,7 @@ def visit(self, node: ast.MethodCallNode, scope: Scope): node.obj = ast.VariableNode('self') obj_node = self.visit(node.obj, scope) - if isinstance(obj_node, AtomNode): + if isinstance(obj_node, AtomNode) and obj_node.type.contains_method(node.id): method, owner = obj_node.type.get_method(node.id, get_owner=True) param_nodes, return_node = self.methods[owner.name, method.name] for i, arg in enumerate(node.args): @@ -388,7 +388,10 @@ def visit(self, node: ast.MethodCallNode, scope: Scope): else: self.graph.add_edge(param_nodes[i], arg_node) self.graph.add_edge(arg_node, param_nodes[i]) - return return_node if return_node.type.name == 'AUTO_TYPE' else AtomNode(return_node.type) + + if return_node.type.name == 'AUTO_TYPE': + return return_node + return AtomNode(return_node.type if return_node.type.name != 'SELF_TYPE' else obj_node.type) for arg in node.args: self.visit(arg, scope) diff --git a/tests/inference/06_program.cl b/tests/inference/06_program.cl new file mode 100644 index 000000000..4ce631970 --- /dev/null +++ b/tests/inference/06_program.cl @@ -0,0 +1,44 @@ +class Main inherits IO { + main(): IO { + let vector: AUTO_TYPE <- (new Vector2).init(0, 0) in + vector.print_vector() + }; +} + +class Vector2 { + x: AUTO_TYPE; + y: AUTO_TYPE; + + init(x_: AUTO_TYPE, y_: AUTO_TYPE): AUTO_TYPE {{ + x <- x_; + y <- y_; + self; + }}; + + + get_x(): AUTO_TYPE { + x + }; + + get_y(): AUTO_TYPE { + y + }; + + add(v: Vector2): AUTO_TYPE { + (new Vector2).init(x + v.get_x(), y + v.get_y()) + }; + + print_vector(): AUTO_TYPE { + let io: IO <- new IO in { + io.out_string("("); + io.out_int(get_x()); + io.out_string("; "); + io.out_int(get_y()); + io.out_string(")\n"); + } + }; + + clone_vector(): AUTO_TYPE { + (new Vector2).init(x, y) + }; +} \ No newline at end of file diff --git a/tests/inference/06_result.cl b/tests/inference/06_result.cl new file mode 100644 index 000000000..46ae32c16 --- /dev/null +++ b/tests/inference/06_result.cl @@ -0,0 +1,45 @@ +class Main inherits IO { + main(): IO { + let vector: AUTO_TYPE <- (new Vector2).init(0, 0) in + vector.print_vector() + }; +} + +class Vector2 { + x: Int; + + y: Int; + + init(x_: Int, y_: Int): Vector2 {{ + x <- x_; + y <- y_; + self; + }}; + + + get_x(): Int { + x + }; + + get_y(): Int { + y + }; + + add(v: Vector2): Vector2 { + (new Vector2).init(x + v.get_x(), y + v.get_y()) + }; + + print_vector(): IO { + let io: IO <- new IO in { + io.out_string("("); + io.out_int(get_x()); + io.out_string("; "); + io.out_int(get_y()); + io.out_string(")\n"); + } + }; + + clone_vector(): Vector2 { + (new Vector2).init(x, y) + }; +} \ No newline at end of file From 89008c3a329e04eb472e2e4d1b1e94b8eeef7438 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Tue, 20 Oct 2020 05:07:43 +0200 Subject: [PATCH 075/143] - --- cool.py | 82 +------------ docs/Informe.md | 112 ++++++++++++------ grammar.py | 12 +- semantics/formatter.py | 4 +- semantics/overridden.py | 2 +- semantics/type_builder.py | 2 +- semantics/type_collector.py | 2 +- semantics/type_inference.py | 20 +++- tests/inference/06_result.cl | 42 +++---- tests/inference/07_program.cl | 19 +++ tests/inference/07_result.cl | 23 ++++ tests/inference/08_program.cl | 33 ++++++ tests/inference/08_result.cl | 38 ++++++ tests/programs_for_execution/01_program.cl | 34 ++++++ tests/programs_for_execution/02_program.cl | 24 ++++ tests/programs_for_execution/03_program.cl | 19 +++ tests/programs_for_execution/04_program.cl | 47 ++++++++ tests/programs_for_execution/05_program.cl | 23 ++++ tests/programs_for_execution/06_program.cl | 38 ++++++ .../01_program.cl | 16 +++ .../01_result.cl | 9 ++ tests/{test_inference.py => test_cool.py} | 27 ++++- 22 files changed, 478 insertions(+), 150 deletions(-) create mode 100644 tests/inference/07_program.cl create mode 100644 tests/inference/07_result.cl create mode 100644 tests/inference/08_program.cl create mode 100644 tests/inference/08_result.cl create mode 100644 tests/programs_for_execution/01_program.cl create mode 100644 tests/programs_for_execution/02_program.cl create mode 100644 tests/programs_for_execution/03_program.cl create mode 100644 tests/programs_for_execution/04_program.cl create mode 100644 tests/programs_for_execution/05_program.cl create mode 100644 tests/programs_for_execution/06_program.cl create mode 100644 tests/syntactic_and_semantic_errors/01_program.cl create mode 100644 tests/syntactic_and_semantic_errors/01_result.cl rename tests/{test_inference.py => test_cool.py} (68%) diff --git a/cool.py b/cool.py index 8a413cec5..f1342dd39 100644 --- a/cool.py +++ b/cool.py @@ -12,92 +12,21 @@ from semantics.type_inference import InferenceChecker from semantics.utils.scope import Context, Scope - -# execution_program_01 = r""" -# class A { } -# -# class B inherits A { } -# -# class C inherits A { } -# -# class Main inherits IO { -# number: Int <- 5; -# -# main () : Object { -# 0 -# }; -# -# testing_case() : IO { -# let a: A <- new C in -# case a of -# x: B => out_string("Is type B.\n"); -# x: C => out_string("Is type C.\n"); -# esac -# }; -# -# testing_fibonacci(n: Int) : IO {{ -# out_string("Iterative Fibonacci : "); -# out_int(iterative_fibonacci(5)); -# out_string("\n"); -# -# out_string("Recursive Fibonacci : "); -# out_int(recursive_fibonacci(5)); -# out_string("\n"); -# }}; -# -# recursive_fibonacci (n: AUTO_TYPE) : AUTO_TYPE { -# if n <= 2 then 1 else recursive_fibonacci(n - 1) + recursive_fibonacci(n - 2) fi -# }; -# -# iterative_fibonacci(n: AUTO_TYPE) : AUTO_TYPE { -# let i: Int <- 2, n1: Int <- 1, n2: Int <- 1, temp: Int in { -# while i < n loop -# let temp: Int <- n2 in { -# n2 <- n2 + n1; -# n1 <- temp; -# i <- i + 1; -# } -# pool; -# n2; -# } -# }; -# } -# """ -# -# syntactic_errors = """ -# class Main { -# a: Int -# -# b: String -# -# main () : Object { let a: Int <- "" in 0 } -# -# errors() : Object { -# case a of -# x: Int => (new IO).out_int(x) -# y: String => (new IO).out_string(x) -# esac -# } -# } -# """ - -# lexer = CoolLexer() -# parser = CoolParser() - app = typer.Typer() def check_semantics(ast, scope: Scope, context: Context, errors: List[str]): TypeCollector(context, errors).visit(ast) TypeBuilder(context, errors).visit(ast) + declarations = ast.declarations topological_ordering(ast, context, errors) + ast.declarations = declarations OverriddenMethodChecker(context, errors).visit(ast) InferenceChecker(context, errors).visit(ast, scope) TypeChecker(context, errors).visit(ast, scope) return ast, scope, context, errors -@app.command() def tokenize(file: str, verbose: bool = False): path = Path.cwd() / file s = path.open('r').read() @@ -115,7 +44,6 @@ def tokenize(file: str, verbose: bool = False): return tokens -@app.command() def parse(file: str, verbose: bool = False): tokens = tokenize(file, verbose) parser = CoolParser(verbose) @@ -150,12 +78,12 @@ def run(file: str, verbose: bool = False): if not errors and not parser.contains_errors: try: Executor(context).visit(ast, Scope()) - print('Program finished...') + typer.echo('Program finished...') except ExecutionError as e: - sys.stderr.write(e.text + '\n') + typer.echo(e.text, err=True) for error in errors: - sys.stderr.write(error + '\n') + typer.echo(error, err=True) if __name__ == '__main__': diff --git a/docs/Informe.md b/docs/Informe.md index 333420973..dc09812f7 100644 --- a/docs/Informe.md +++ b/docs/Informe.md @@ -2,21 +2,38 @@ # Segundo Proyecto de Programacion -## Inferencia de tipos en el lenguaje de programacion *COOL*, una aproximacion a traves de grafos +## Inferencia de tipos en el lenguaje de programacion *COOL*, una aproximacion a través de grafos + +## Estudiantes + + - Alejandro Klever Clemente C-311 + - Miguel Angel Gonzalez Calles C-311 ## Indice - 1 Inferencia de tipos. + - 1.1 Algoritmo y Grafo de Dependecias. + - 1.2 Nodos de Dependencia. + - 1.3 Casos factibles. + - 1.3.1 Ejemplos de casos Factibles para la Inferencia. + - 1.4 Casos No factibles. + - 1.4.1 Casos Generales. + - 1.4.2 Casos Particulares. - - 1.5 Expresiones atomicas. + + - 1.5 expresiónes atomicas. + +- 2 CLI-API + +- 3 Lexing y Parsing ## 1 Inferencia de Tipos @@ -24,27 +41,27 @@ COOL es un lenguaje de programacion estaticamente tipado, y aunque el lenguaje n Nuestro algoritmo de inferencia de tipos se apoya en el uso basico de la teoria de grafos y en el uso del patron de diseno visitor. -La inferencia de tipos de nuestro proyecto detecta para cada atributo, variable, parametro de funcion o retorno de funcion el primer tipo que le puede ser asignado, modificando en el arbol de sintaxis abstracta el string `AUTO_TYPE` por el nombre del tipo correspondiente y asignando los tipos correspondientes en el contexto y el ambito en que seon declarados. +La inferencia de tipos de nuestro proyecto detecta para cada atributo, variable, parámetro de función o retorno de función el primer tipo que le puede ser asignado, modificando en el árbol de sintaxis abstracta el string `AUTO_TYPE` por el nombre del tipo correspondiente y asignando los tipos correspondientes en el contexto y el ambito en que seon declarados. ### 1.1 Algoritmo y Grafo de Dependecias -***Entrada :*** Un arbol de sintaxis abstracta, un contexto con todos los tipos declarados en el programa de COOL. +***Entrada :*** Un árbol de sintaxis abstracta, un contexto con todos los tipos declarados en el programa de COOL. -***Salida :*** Un Arbol de Sintaxis Abstracta, Un Contexto y un Scope con tipos bien tagueados. +***Salida :*** Un árbol de Sintaxis Abstracta, Un Contexto y un Scope con tipos bien tagueados. -***Algoritmo :*** Durante el recorrido del AST sera construido un grafo dirigido cuyos nodos encerraran el concepto de las expresiones marcadas como `AUTO_TYPE` y las aristas representan las dependencias entre las expresiones de estos nodos para inferir su tipo. Sea `E1` una expresion cuyo tipo estatico es marcado como `AUTO_TYPE`, y sea `E2` una expresion a partir de a cual se puede inferir el tipo de estatico de E1 entonces en el grafo existira la arista ``. Una vez construido el arbol se comenzara una cadena de expansion de tipos estaticos de la forma `E1, E2, ..., En` donde `Ej` se infiere de `Ei` con `1 < j = i + 1 <= n` y `E1` es una expresion con tipo estatico definido, al cual llamaremos atomo. Cuando todos los atomos se hayan propagado a traves del grafo los nodos que no hayan podido ser resueltos seran marcados como tipos `Object` al ser esta la clase mas general del lenguaje. +***Algoritmo :*** Durante el recorrido del AST será construido un grafo dirigido cuyos nodos encerrarán el concepto de las expresiónes marcadas como `AUTO_TYPE` y las aristas representan las dependencias entre las expresiónes de estos nodos para inferir su tipo. Sea `E1` una expresión cuyo tipo estático es marcado como `AUTO_TYPE`, y sea `E2` una expresión a partir de a cual se puede inferir el tipo de estático de E1 entonces en el grafo existira la arista ``. Una vez construido el árbol se comenzara una cadena de expansion de tipos estáticos de la forma `E1, E2, ..., En` donde `Ej` se infiere de `Ei` con `1 < j = i + 1 <= n` y `E1` es una expresión con tipo estático definido, al cual llamaremos atomo. Cuando todos los átomos se hayan propagado a traves del grafo los nodos que no hayan podido ser resueltos serán marcados como tipos `Object` al ser esta la clase mas general del lenguaje. ### 1.2 Nodos de Dependencia -Cada nodo del grafo sera una abstraccion de un concepto en el que se use un tagueo explicito de `AUTO_TYPE` y tendra las referencias a las partes del proceso de semantica del programa, ademas de que cada nodo contara con un metodo `update(type)` el cual actualiza el tipo estatico de estos conceptos. +Cada nodo del grafo será una abstracción de un concepto en el que se use un tagueo explicito de `AUTO_TYPE` y tendra las referencias a las partes del proceso de semantica del programa, ademas de que cada nodo contara con un metodo `update(type)` el cual actualiza el tipo estático de estos conceptos. ```python class DependencyNode: pass class AtomNode(DependencyNode): - """Nodo base el cual es creado a partir de expresiones que - contienen tipo estatico u operaciones aritmeticas""" + """Nodo base el cual es creado a partir de expresiónes que + contienen tipo estático u operaciones aritméticas""" pass class AttributeNode(DependencyNode): @@ -52,11 +69,11 @@ class AttributeNode(DependencyNode): pass class ParameterNode(DependencyNode): - """Parametro de una funcion""" + """parámetro de una función""" pass class ReturnTypeNode(DependencyNode): - """Tipo de retorno de una funcion""" + """Tipo de retorno de una función""" pass class VariableInfoNode(DependencyNode): @@ -66,25 +83,25 @@ class VariableInfoNode(DependencyNode): ### 1.3 Casos factibles -Funcionando de manera analoga para atributos, variables, parametros y retorno de funciones. Explicado de forma recursiva puede ser visto como: +Funcionando de manera análoga para atributos, variables, parámetros y retorno de funciones. Explicado de forma recursiva puede ser visto como: -- Un `AUTO_TYPE` sera sustituido por su tipo correspodiente si este forma parte de una operacion que permita saber su tipo, o es asignado a una expresion de la cual es posible determinar su tipo. +- Un `AUTO_TYPE` será sustituido por su tipo correspodiente si este forma parte de una operacion que permita saber su tipo, o es asignado a una expresión de la cual es posible determinar su tipo. - Es importante senalar en que contexto estas dependencias son tomadas en cuenta: - - Para los atributos marcados como autotype su tipo podra ser determinado dentro del cuerpo de cualquiera de las funciones de la clase o si es detectable el tipo de la expresion de inicializacion. + - Para los atributos marcados como autotype su tipo podra ser determinado dentro del cuerpo de cualquiera de las funciones de la clase o si es detectable el tipo de la expresión de inicializacion. - - Para las variables su tipo sera determinado dentro del scope donde estas son validas. + - Para las variables su tipo será determinado dentro del scope donde estas son validas. -- Para los parametros su tipo sera determinado dentro del cuerpo de la funcion o cuando esta sea funcion sea llamada a traves de una operacion de dispatch. +- Para los parámetros su tipo será determinado dentro del cuerpo de la función o cuando esta sea función sea llamada a traves de una operacion de dispatch. -- Para los retornos de funciones, su tipo sera determinado con su expresion y los llamados a dicha funcion a traves de una operacion de dispatch. +- Para los retornos de funciones, su tipo será determinado con su expresión y los llamados a dicha función a traves de una operacion de dispatch. -- En las expresiones if-then-else o case-of asignan automaticamente el tipo `Object` por el momento debido a la complejidad que supone la operacion `join` en el los case y en las clausulas then-else. +- En las expresiónes if-then-else o case-of asignan automaticamente el tipo `Object` por el momento debido a la complejidad que supone la operacion `join` en el los case y en las clausulas then-else. -### 1.3.1 Ejemplos de casos Factibles para la Inferencia +### 1.3.1 Ejemplos de casos factibles para la inferencia -En este caso la expresion `d + 1` desambigua a `d` en un `Int` y luego `c` se infiere de `d`, `b` se infiere de `c`, `a` se infiere de `b` y el retorno de la funcion de infiere de `a`. Quedando todos los parametros y el retorno de la funcion marcados como `Int`. +En este caso la expresión `d + 1` desambigua a `d` en un `Int` y luego `c` se infiere de `d`, `b` se infiere de `c`, `a` se infiere de `b` y el retorno de la función de infiere de `a`. Quedando todos los parámetros y el retorno de la función marcados como `Int`. ```typescript class Main { @@ -101,7 +118,7 @@ class Main { } ``` -Similar al caso anterior pero enesta ocacion incluyendo atributos, la expresion los `x + y` infiere a los parametros `x` y `y` como `Int` y tambien al atributo `b`, `a` se infiere de `b`. El tipo de retorno de `create_point()` se infiere de su porpia cuerpo con la expression `new Point` y esta a su vez infiere el tipo de retorno de `init()`. +Similar al caso anterior pero en esta ocasión incluyendo atributos, la expresión los `x + y` infiere a los parámetros `x` y `y` como `Int` y tambien al atributo `b`, `a` se infiere de `b`. El tipo de retorno de `create_point()` se infiere de su porpia cuerpo con la expression `new Point` y esta a su vez infiere el tipo de retorno de `init()`. ```typescript class Point { @@ -118,7 +135,7 @@ class Point { } ``` -Probando con funciones recursivas tenemos el caso de fibonacci tipo de `n` se infiere al ser usado en las expresiones `n <= 2`, `n - 1`, `n - 2`, las cuales lo marcan como `Int`, `fibonacci(n - 1) + fibonacci(n - 2)` marca al retorno de la funcion como `Int` y y la expresion if-then-else lo marca como `Object`. en este ultimo caso la expresion `fibonacci(n - 1) + fibonacci(n - 2)` termina de analizarse primero que la expresion if-then-else por lo cual el tipo de retorno sera `Int` el cual fue el primero que se definio, lo cual demuestra que el orden en el que se analizan las inferencias importan de las inferencias importan. +Probando con funciones recursivas tenemos el caso de fibonacci tipo de `n` se infiere al ser usado en las expresiónes `n <= 2`, `n - 1`, `n - 2`, las cuales lo marcan como `Int`, `fibonacci(n - 1) + fibonacci(n - 2)` marca al retorno de la función como `Int` y y la expresión if-then-else lo marca como `Object`. en este ultimo caso la expresión `fibonacci(n - 1) + fibonacci(n - 2)` termina de analizarse primero que la expresión if-then-else por lo cual el tipo de retorno será `Int` el cual fue el primero que se definio, lo cual demuestra que el orden en el que se analizan las inferencias importan de las inferencias importan. ```typescript class Main { @@ -128,7 +145,7 @@ class Main { } ``` -El caso de Ackerman es bastante interesante, en nuestro algoritmo importa el orden en el que fueron definidas las dependencias. `m` y `n` son inferibles como `Int` a partir de las expresiones `n + 1` y `m - 1` respectivamente, y el tipo de retorno de `ackermann` en inferible por `n` al ser usado como segundo parametro en un llamado de si mismo, por lo cual sera `Int`. La influencia de la expresion if-then-else se ve anulada por el orden de inferencia. +El caso de Ackerman es bastante interesante, en nuestro algoritmo importa el orden en el que fueron definidas las dependencias. `m` y `n` son inferibles como `Int` a partir de las expresiónes `n + 1` y `m - 1` respectivamente, y el tipo de retorno de `ackermann` en inferible por `n` al ser usado como segundo parámetro en un llamado de si mismo, por lo cual será `Int`. La influencia de la expresión if-then-else se ve anulada por el orden de inferencia. ```typescript class Main { @@ -144,11 +161,11 @@ class Main { ### 2.4 Casos No factibles -No es posible determinar el tipo de una variable, atributo, parametro, o retorno de funcion si para este se cumple el caso general y su caso especifico correspondiente. +No es posible determinar el tipo de una variable, atributo, parámetro, o retorno de función si para este se cumple el caso general y su caso especifico correspondiente. ### 2.4.1 Casos generales -El tipo es utilizado en expresiones que no permiten determinar su tipo, o solo se logra determinar que poseen el mismo tipo que otras variables, atributos, parametros o retorno de funciones de las cuales tampoco se puede determinar el mismo. +El tipo es utilizado en expresiónes que no permiten determinar su tipo, o solo se logra determinar que poseen el mismo tipo que otras variables, atributos, parámetros o retorno de funciones de las cuales tampoco se puede determinar el mismo. ```typescript class Main { @@ -169,7 +186,7 @@ class Main { } ``` -En este ejemplo solo es posible inferir el typo del parametro `n` de la funcion `factorial`, su tipo de retorno, el parametro `a` de la funcion `function`, su tipo de retorno y el atributo `b` de la clase `Main`, el resto sera marcado como `Object`. +En este ejemplo solo es posible inferir el typo del parámetro `n` de la función `factorial`, su tipo de retorno, el parámetro `a` de la función `function`, su tipo de retorno y el atributo `b` de la clase `Main`, el resto será marcado como `Object`. ### 2.4.2 Casos Particulares @@ -185,7 +202,7 @@ class Main inherits IO { } ``` -***Para parametros:*** si dentro del cuerpo de la funcion estas no son utilizadas y no existe otra funcion que llame a esta con argumentos con tipado estatico definidos seran marcadas como `Object`: +***Para parámetros:*** si dentro del cuerpo de la función estas no son utilizadas y no existe otra función que llame a esta con argumentos con tipado estático definidos serán marcadas como `Object`: ```typescript class Main inherits IO { @@ -195,7 +212,7 @@ class Main inherits IO { } ``` -***Para atributos:*** si no es posible determinar el tipo de la expresion de inicializacion o si dentro del cuerpo de todas las funciones de su clase correspondiente este no son utilizadas, seran marcadas como `Objects`. +***Para atributos:*** si no es posible determinar el tipo de la expresión de inicializacion o si dentro del cuerpo de todas las funciones de su clase correspondiente este no son utilizadas, serán marcadas como `Objects`. ```typescript class Main inherits IO { @@ -209,7 +226,7 @@ class Main inherits IO { } ``` -***Para el retorno de funciones:*** si no es posible determinar el tipo de su expresion. +***Para el retorno de funciones:*** si no es posible determinar el tipo de su expresión. ```typescript class Main inherits IO { @@ -219,11 +236,11 @@ class Main inherits IO { } ``` -### 2.5 Expresiones atomicas +### 2.5 expresiónes atomicas -- Valores Constantes. +- Valores constantes. -- Operaciones aritmeticas. +- Operaciones aritméticas. - Operaciones logicas. @@ -233,4 +250,33 @@ class Main inherits IO { - Variables de las cuales se conoce su tipo. -- Bloques donde se puede determinar el tipo de la ultima expresion. +- Bloques donde se puede determinar el tipo de la ultima expresión. + +## 2 CLI-API + +Para la comoda utilizacion del interprete hemos usado el paquete de python `typer` para crear una api-cli bastante sencilla, basta co ejecutar el comando `python cool.py --help` y otendra como salida lo siguiente: + + Usage: cool.py [OPTIONS] COMMAND [ARGS]... + + Options: + --install-completion Install completion for the current shell. + --show-completion Show completion for the current shell, to copy it or + customize the installation. + + --help Show this message and exit. + + Commands: + infer + run + +Se se puede apreciar existen 2 comandos principales: + +- `infer` el cual recibe un archivo .cl con un programa en COOL con tipos `AUTO_TYPE` y devuelve un programa en COOL con todos los `AUTO_TYPE` reemplazados por sus tipos correspondientes. + +- `run` el cual recibe como entrada un archivo .cl con un programa en COOL y ejecuta dicho programa. + +- En ambos casos se tiene como parámetro adicional el `--verbose` para observar los distintos procesos por los que pasa la el proceso de compilación + +## 3 Lexing y Parsing + +Para el proceso de lexing y parsing usamos el paquete de python `pyjapt` cuyos autores coinciden con los de este proyecto. diff --git a/grammar.py b/grammar.py index 3725f1922..932a7f1c6 100644 --- a/grammar.py +++ b/grammar.py @@ -211,37 +211,37 @@ def lexical_error(lexer): @G.production("feature-list -> attribute error feature-list") def feature_attribute_error(s): - s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") + s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'.") return [s[1]] + s[3] @G.production("feature-list -> method error feature-list") def feature_method_error(s): - s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") + s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'.") return [s[1]] + s[3] @G.production("case-list -> id : type => expr error") def case_list_error(s): - s.add_error(6, f"{s[6].line, s[6].column} - SyntacticError: Expected ';' instead of '{s[6].lex}'") + s.add_error(6, f"{s[6].line, s[6].column} - SyntacticError: Expected ';' instead of '{s[6].lex}'.") return [(s[1], s[3], s[5])] @G.production("case-list -> id : type => expr error case-list") def case_list_error(s): - s.add_error(6, f"{s[6].line, s[6].column} - SyntacticError: Expected ';' instead of '{s[6].lex}'") + s.add_error(6, f"{s[6].line, s[6].column} - SyntacticError: Expected ';' instead of '{s[6].lex}'.") return [(s[1], s[3], s[5])] + s[7] @G.production("block -> expr error") def block_single_error(s): - s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") + s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'.") return [s[1]] @G.production("block -> expr error block") def block_single_error(s): - s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'") + s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'.") return [s[1]] + s[3] diff --git a/semantics/formatter.py b/semantics/formatter.py index 0f2d5e9f6..14598bb0c 100644 --- a/semantics/formatter.py +++ b/semantics/formatter.py @@ -38,8 +38,8 @@ def visit(self, node: ast.LetNode, tabs: int = 0): declarations.append(f'{_id}: {_type} <- {self.visit(_expr)}') else: declarations.append(f'{_id} : {_type}') - declarations = ('\n' + ' ' * (tabs + 1)).join(declarations) - return ' ' * tabs + f'let {declarations} in \n{self.visit(node.expr, tabs + 1)}' + declarations = (',\n' + ' ' * (tabs + 1)).join(declarations) + return ' ' * tabs + f'let {declarations} in\n{self.visit(node.expr, tabs + 1)}' @visitor.when(ast.AssignNode) def visit(self, node: ast.AssignNode, tabs: int = 0): diff --git a/semantics/overridden.py b/semantics/overridden.py index e48d46331..62d8ba4e1 100644 --- a/semantics/overridden.py +++ b/semantics/overridden.py @@ -55,7 +55,7 @@ class OverriddenMethodChecker: Params ------ - - errors: List[str] is a list of errors detected in the ast travel + - syntactic_and_semantic_errors: List[str] is a list of syntactic_and_semantic_errors detected in the ast travel - context: Context the context for keeping the classes - current_type: Optional[Type] is the current type in the building process""" diff --git a/semantics/type_builder.py b/semantics/type_builder.py index 40f981d38..8aaaacb7d 100644 --- a/semantics/type_builder.py +++ b/semantics/type_builder.py @@ -11,7 +11,7 @@ class TypeBuilder: Params ------ - - errors: List[str] is a list of errors detected in the ast travel + - syntactic_and_semantic_errors: List[str] is a list of syntactic_and_semantic_errors detected in the ast travel - context: Context the context for keeping the classes - current_type: Optional[Type] is the current type in the building process""" diff --git a/semantics/type_collector.py b/semantics/type_collector.py index dbc000eba..0c027891d 100644 --- a/semantics/type_collector.py +++ b/semantics/type_collector.py @@ -10,7 +10,7 @@ class TypeCollector: Params ---------- - - errors: List[str] is a list of errors detected in the ast travel + - syntactic_and_semantic_errors: List[str] is a list of syntactic_and_semantic_errors detected in the ast travel - context: Context the context for keeping the classes""" def __init__(self, context: Context = Context(), errors: List[str] = []): diff --git a/semantics/type_inference.py b/semantics/type_inference.py index 7e748dac8..029884d7f 100644 --- a/semantics/type_inference.py +++ b/semantics/type_inference.py @@ -297,8 +297,12 @@ def visit(self, node: ast.LetNode, scope: Scope): # Create an edge or add an new node only if it is AutoType if expr_node is not None: self.graph.add_edge(expr_node, var_info_node) + if expr_node.type.name == 'AUTO_TYPE': + self.graph.add_edge(var_info_node, expr_node) else: self.graph.add_node(var_info_node) + elif expr_node is not None and expr_node.type.name == 'AUTO_TYPE': + self.graph.add_edge(var_info_node, expr_node) return self.visit(node.expr, scope.create_child()) @@ -354,12 +358,16 @@ def visit(self, node: ast.WhileNode, scope: Scope): @visitor.when(ast.SwitchCaseNode) def visit(self, node: ast.SwitchCaseNode, scope: Scope): self.visit(node.expr, scope) + case_expressions = [] for _id, _type, _expr in node.cases: new_scope = scope.create_child() var_info = new_scope.define_variable(_id, self.context.get_type(_type)) self.variables[var_info] = VariableInfoNode(var_info.type, var_info) - self.visit(_expr, new_scope) - return AtomNode(self.context.get_type('Object')) # For now + case_expressions.append(self.visit(_expr, new_scope)) + + if any(e.type.name == 'AUTO_TYPE' for e in case_expressions): + return AtomNode(self.context.get_type('Object')) + return AtomNode(Type.multi_join([e.type for e in case_expressions])) @visitor.when(ast.MethodCallNode) def visit(self, node: ast.MethodCallNode, scope: Scope): @@ -423,7 +431,9 @@ def visit(self, node: ast.VariableNode, scope: Scope): @visitor.when(ast.InstantiateNode) def visit(self, node: ast.InstantiateNode, scope: Scope): - return AtomNode(self.context.get_type(node.lex)) + if node.lex in self.context.types: + return AtomNode(self.context.get_type(node.lex)) + return AtomNode(self.context.get_type('Object')) @visitor.when(ast.NegationNode) def visit(self, node: ast.NegationNode, scope: Scope): @@ -487,8 +497,8 @@ class InferenceTypeSubstitute: def __init__(self, context: Context, errors: List[str] = []): self.context: Context = context self.errors: List[str] = errors - self.current_type: Type = None - self.current_method: Method = None + self.current_type: Optional[Type] = None + self.current_method: Optional[Method] = None @visitor.on('node') def visit(self, node, tabs): diff --git a/tests/inference/06_result.cl b/tests/inference/06_result.cl index 46ae32c16..1615934ff 100644 --- a/tests/inference/06_result.cl +++ b/tests/inference/06_result.cl @@ -1,6 +1,6 @@ class Main inherits IO { - main(): IO { - let vector: AUTO_TYPE <- (new Vector2).init(0, 0) in + main (): IO { + let vector: Vector2 <- (new Vector2).init(0, 0) in vector.print_vector() }; } @@ -10,36 +10,38 @@ class Vector2 { y: Int; - init(x_: Int, y_: Int): Vector2 {{ - x <- x_; - y <- y_; - self; - }}; - + init (x_: Int, y_: Int): Vector2 { + { + x <- x_; + y <- y_; + self; + } + }; - get_x(): Int { + get_x (): Int { x }; - get_y(): Int { + get_y (): Int { y }; - add(v: Vector2): Vector2 { + add (v: Vector2): Vector2 { (new Vector2).init(x + v.get_x(), y + v.get_y()) }; - print_vector(): IO { - let io: IO <- new IO in { - io.out_string("("); - io.out_int(get_x()); - io.out_string("; "); - io.out_int(get_y()); - io.out_string(")\n"); - } + print_vector (): IO { + let io: IO <- (new IO) in + { + io.out_string("("); + io.out_int(self.get_x()); + io.out_string("; "); + io.out_int(self.get_y()); + io.out_string(")\n"); + } }; - clone_vector(): Vector2 { + clone_vector (): Vector2 { (new Vector2).init(x, y) }; } \ No newline at end of file diff --git a/tests/inference/07_program.cl b/tests/inference/07_program.cl new file mode 100644 index 000000000..a34dcfa89 --- /dev/null +++ b/tests/inference/07_program.cl @@ -0,0 +1,19 @@ +(* This program prints the first 10 numbers of fibonacci *) +class Main { + + main(): Object { + let total: AUTO_TYPE <- 10, + i: AUTO_TYPE <- 1 , + io: AUTO_TYPE <- new IO in + while i <= total loop { + io.out_int(fibonacci(i)); + io.out_string("\n"); + i <- i + 1; + } + pool + }; + + fibonacci (n: AUTO_TYPE): AUTO_TYPE { + if n <= 2 then 1 else fibonacci(n - 1) + fibonacci(n - 2) fi + }; +} \ No newline at end of file diff --git a/tests/inference/07_result.cl b/tests/inference/07_result.cl new file mode 100644 index 000000000..2bd4b5309 --- /dev/null +++ b/tests/inference/07_result.cl @@ -0,0 +1,23 @@ +class Main { + main (): Object { + let total: Int <- 10, + i: Int <- 1, + io: IO <- (new IO) in + while i <= total loop + { + io.out_int(self.fibonacci(i)); + io.out_string("\n"); + i <- i + 1; + } + pool + }; + + fibonacci (n: Int): Int { + if n <= 2 + then + 1 + else + self.fibonacci(n - 1) + self.fibonacci(n - 2) + fi + }; +} \ No newline at end of file diff --git a/tests/inference/08_program.cl b/tests/inference/08_program.cl new file mode 100644 index 000000000..7e296addf --- /dev/null +++ b/tests/inference/08_program.cl @@ -0,0 +1,33 @@ +(* Testing IO *) +class Main inherits IO { + + main(): Object { + let id: AUTO_TYPE, name: AUTO_TYPE, email: AUTO_TYPE in { + out_string("Introduzca su id: "); + id <- self.in_int(); + out_string("Introduzca su nombre: "); + name <- self.in_string(); + out_string("Introduzca su email: "); + email <- self.in_string(); + let user: AUTO_TYPE <- (new User).init(id, name, email) in + out_string("Created user: ".concat(user.get_name()).concat("\n")); + } + }; +} + +class User { + id: AUTO_TYPE; + name: AUTO_TYPE; + email: AUTO_TYPE; + + init(id_: AUTO_TYPE, name_: AUTO_TYPE, email_: AUTO_TYPE): AUTO_TYPE {{ + id <- id_; + name <- name_; + email <- email_; + self; + }}; + + get_name(): AUTO_TYPE { + name + }; +} \ No newline at end of file diff --git a/tests/inference/08_result.cl b/tests/inference/08_result.cl new file mode 100644 index 000000000..f83685a59 --- /dev/null +++ b/tests/inference/08_result.cl @@ -0,0 +1,38 @@ +class Main inherits IO { + main (): Object { + let id : Int, + name : String, + email : String in + { + self.out_string("Introduzca su id: "); + id <- self.in_int(); + self.out_string("Introduzca su nombre: "); + name <- self.in_string(); + self.out_string("Introduzca su email: "); + email <- self.in_string(); + let user: User <- (new User).init(id, name, email) in + self.out_string("Created user: ".concat(user.get_name()).concat("\n")); + } + }; +} + +class User { + id: Int; + + name: String; + + email: String; + + init (id_: Int, name_: String, email_: String): User { + { + id <- id_; + name <- name_; + email <- email_; + self; + } + }; + + get_name (): String { + name + }; +} \ No newline at end of file diff --git a/tests/programs_for_execution/01_program.cl b/tests/programs_for_execution/01_program.cl new file mode 100644 index 000000000..cf8b86a51 --- /dev/null +++ b/tests/programs_for_execution/01_program.cl @@ -0,0 +1,34 @@ +class Main inherits IO { + number: Int <- 5; + + main () : Object { + testing_fibonacci(number) + }; + + testing_fibonacci(n: Int) : IO {{ + out_string("Iterative Fibonacci : "); + out_int(iterative_fibonacci(5)); + out_string("\n"); + + out_string("Recursive Fibonacci : "); + out_int(recursive_fibonacci(5)); + out_string("\n"); + }}; + + recursive_fibonacci (n: AUTO_TYPE) : AUTO_TYPE { + if n <= 2 then 1 else recursive_fibonacci(n - 1) + recursive_fibonacci(n - 2) fi + }; + + iterative_fibonacci(n: AUTO_TYPE) : AUTO_TYPE { + let i: Int <- 2, n1: Int <- 1, n2: Int <- 1, temp: Int in { + while i < n loop + let temp: Int <- n2 in { + n2 <- n2 + n1; + n1 <- temp; + i <- i + 1; + } + pool; + n2; + } + }; +} \ No newline at end of file diff --git a/tests/programs_for_execution/02_program.cl b/tests/programs_for_execution/02_program.cl new file mode 100644 index 000000000..5c80aa2c7 --- /dev/null +++ b/tests/programs_for_execution/02_program.cl @@ -0,0 +1,24 @@ +class Main inherits IO { + main (): Object { + { + out_int((new Ackermann).ackermann(3, 2)); + out_string("\n"); + } + }; +} + +class Ackermann { + ackermann (m: Int, n: Int): Int { + if m = 0 + then + n + 1 + else + if n = 0 + then + self.ackermann(m - 1, 1) + else + self.ackermann(m - 1, self.ackermann(m, n - 1)) + fi + fi + }; +} \ No newline at end of file diff --git a/tests/programs_for_execution/03_program.cl b/tests/programs_for_execution/03_program.cl new file mode 100644 index 000000000..1d2757cab --- /dev/null +++ b/tests/programs_for_execution/03_program.cl @@ -0,0 +1,19 @@ +class A { } + +class B inherits A { } + +class C inherits A { } + +class Main inherits IO { + main () : Object { + testing_case() + }; + + testing_case() : IO { + let a: A <- new C in + case a of + x: B => out_string("Is type B.\n"); + x: C => out_string("Is type C.\n"); + esac + }; +} \ No newline at end of file diff --git a/tests/programs_for_execution/04_program.cl b/tests/programs_for_execution/04_program.cl new file mode 100644 index 000000000..1615934ff --- /dev/null +++ b/tests/programs_for_execution/04_program.cl @@ -0,0 +1,47 @@ +class Main inherits IO { + main (): IO { + let vector: Vector2 <- (new Vector2).init(0, 0) in + vector.print_vector() + }; +} + +class Vector2 { + x: Int; + + y: Int; + + init (x_: Int, y_: Int): Vector2 { + { + x <- x_; + y <- y_; + self; + } + }; + + get_x (): Int { + x + }; + + get_y (): Int { + y + }; + + add (v: Vector2): Vector2 { + (new Vector2).init(x + v.get_x(), y + v.get_y()) + }; + + print_vector (): IO { + let io: IO <- (new IO) in + { + io.out_string("("); + io.out_int(self.get_x()); + io.out_string("; "); + io.out_int(self.get_y()); + io.out_string(")\n"); + } + }; + + clone_vector (): Vector2 { + (new Vector2).init(x, y) + }; +} \ No newline at end of file diff --git a/tests/programs_for_execution/05_program.cl b/tests/programs_for_execution/05_program.cl new file mode 100644 index 000000000..2bd4b5309 --- /dev/null +++ b/tests/programs_for_execution/05_program.cl @@ -0,0 +1,23 @@ +class Main { + main (): Object { + let total: Int <- 10, + i: Int <- 1, + io: IO <- (new IO) in + while i <= total loop + { + io.out_int(self.fibonacci(i)); + io.out_string("\n"); + i <- i + 1; + } + pool + }; + + fibonacci (n: Int): Int { + if n <= 2 + then + 1 + else + self.fibonacci(n - 1) + self.fibonacci(n - 2) + fi + }; +} \ No newline at end of file diff --git a/tests/programs_for_execution/06_program.cl b/tests/programs_for_execution/06_program.cl new file mode 100644 index 000000000..f83685a59 --- /dev/null +++ b/tests/programs_for_execution/06_program.cl @@ -0,0 +1,38 @@ +class Main inherits IO { + main (): Object { + let id : Int, + name : String, + email : String in + { + self.out_string("Introduzca su id: "); + id <- self.in_int(); + self.out_string("Introduzca su nombre: "); + name <- self.in_string(); + self.out_string("Introduzca su email: "); + email <- self.in_string(); + let user: User <- (new User).init(id, name, email) in + self.out_string("Created user: ".concat(user.get_name()).concat("\n")); + } + }; +} + +class User { + id: Int; + + name: String; + + email: String; + + init (id_: Int, name_: String, email_: String): User { + { + id <- id_; + name <- name_; + email <- email_; + self; + } + }; + + get_name (): String { + name + }; +} \ No newline at end of file diff --git a/tests/syntactic_and_semantic_errors/01_program.cl b/tests/syntactic_and_semantic_errors/01_program.cl new file mode 100644 index 000000000..abb344e34 --- /dev/null +++ b/tests/syntactic_and_semantic_errors/01_program.cl @@ -0,0 +1,16 @@ +class Main { + a: Int + + b: String + + main () : String { + let a: Int <- "" in 0 + } + + function_with_errors() : Object { + case a of + x: Int => (new IO).out_int(x) + y: String => (new IO).out_string(x) + esac + } +} \ No newline at end of file diff --git a/tests/syntactic_and_semantic_errors/01_result.cl b/tests/syntactic_and_semantic_errors/01_result.cl new file mode 100644 index 000000000..da7df9c03 --- /dev/null +++ b/tests/syntactic_and_semantic_errors/01_result.cl @@ -0,0 +1,9 @@ +(4, 5) - SyntacticError: Expected ';' instead of 'b'. +(6, 5) - SyntacticError: Expected ';' instead of 'main'. +(10, 5) - SyntacticError: Expected ';' instead of 'function_with_errors'. +(13, 13) - SyntacticError: Expected ';' instead of 'y'. +(14, 9) - SyntacticError: Expected ';' instead of 'esac'. +(16, 1) - SyntacticError: Expected ';' instead of '}'. +TypeError: Cannot convert "String" into "Int". +TypeError: Cannot convert "Int" into "String". +IdentifierError: Variable "x" is not defined in "function_with_errors". \ No newline at end of file diff --git a/tests/test_inference.py b/tests/test_cool.py similarity index 68% rename from tests/test_inference.py rename to tests/test_cool.py index 7eaa8b086..89d203194 100644 --- a/tests/test_inference.py +++ b/tests/test_cool.py @@ -1,4 +1,3 @@ -import os from pathlib import Path from typing import List @@ -39,7 +38,7 @@ def test_inference_programs(): inference_testing_results = [] cwd = Path.cwd() - path = cwd / 'inference' if cwd.name.endswith('tests') else cwd / 'tests' / 'inference' + path = cwd / 'inference' if str(cwd).endswith('tests') else cwd / 'tests' / 'inference' for path in sorted(path.iterdir()): s = path.open('r').read() if 'program' in path.name: @@ -54,15 +53,35 @@ def test_inference_programs(): assert not errors and CodeBuilder().visit(ast, 0) == result +def test_errors_in_programs(): + errors_testing_programs = [] + errors_testing_results = [] + + cwd = Path.cwd() + path = cwd / 'syntactic_and_semantic_errors' if str(cwd).endswith('tests') else cwd / 'tests' / 'syntactic_and_semantic_errors' + for path in sorted(path.iterdir()): + s = path.open('r').read() + if 'program' in path.name: + errors_testing_programs.append(s) + else: + errors_testing_results.append(s) + + for code, result in zip(errors_testing_programs, errors_testing_results): + tokens, _ = tokenize(code) + ast, parser = parse(tokens) + ast, _, _, errors = check_semantics(ast, Scope(), Context(), []) + assert '\n'.join(parser.errors + errors) == result + + if __name__ == '__main__': pass - # if not errors and not parser.contains_errors: + # if not syntactic_and_semantic_errors and not parser.contains_errors: # try: # Executor(context).visit(ast, Scope()) # print('Program finished...') # except ExecutionError as e: # sys.stderr.write(e.text + '\n') # - # for error in errors: + # for error in syntactic_and_semantic_errors: # sys.stderr.write(error + '\n') From 633e8ceb17098e72ee07d96de0131e235fa63644 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Tue, 20 Oct 2020 18:10:01 +0200 Subject: [PATCH 076/143] creating new multiline comment detector --- cool.py | 8 +- grammar.py | 58 +- lexertab.py | 3 +- parsertab.py | 1170 ++++++++--------- requirements.txt | 2 +- .../01_program.cl | 0 .../02_program.cl | 0 .../03_program.cl | 0 .../04_program.cl | 0 .../05_program.cl | 0 .../06_program.cl | 0 .../inference/{01_result.cl => 01_result.txt} | 0 .../inference/{02_result.cl => 02_result.txt} | 0 .../inference/{03_result.cl => 03_result.txt} | 0 .../inference/{04_result.cl => 04_result.txt} | 0 .../inference/{05_result.cl => 05_result.txt} | 0 .../inference/{06_result.cl => 06_result.txt} | 0 .../inference/{07_result.cl => 07_result.txt} | 0 .../inference/{08_result.cl => 08_result.txt} | 0 tests/lexicographic_errors/comment1.cl | 55 + tests/lexicographic_errors/comment1_error.txt | 1 + tests/lexicographic_errors/iis1.cl | 111 ++ tests/lexicographic_errors/iis1_error.txt | 1 + tests/lexicographic_errors/iis2.cl | 120 ++ tests/lexicographic_errors/iis2_error.txt | 1 + tests/lexicographic_errors/iis3.cl | 121 ++ tests/lexicographic_errors/iis3_error.txt | 1 + tests/lexicographic_errors/iis4.cl | 120 ++ tests/lexicographic_errors/iis4_error.txt | 1 + tests/lexicographic_errors/iis5.cl | 121 ++ tests/lexicographic_errors/iis5_error.txt | 2 + tests/lexicographic_errors/iis6.cl | 125 ++ tests/lexicographic_errors/iis6_error.txt | 1 + tests/lexicographic_errors/mixed1.cl | 14 + tests/lexicographic_errors/mixed1_error.txt | 1 + tests/lexicographic_errors/mixed2.cl | 20 + tests/lexicographic_errors/mixed2_error.txt | 3 + tests/lexicographic_errors/string1.cl | 6 + tests/lexicographic_errors/string1_error.txt | 2 + tests/lexicographic_errors/string2.cl | 19 + tests/lexicographic_errors/string2_error.txt | 1 + tests/lexicographic_errors/string3.cl | Bin 0 -> 234 bytes tests/lexicographic_errors/string3_error.txt | 1 + tests/lexicographic_errors/string4.cl | 38 + tests/lexicographic_errors/string4_error.txt | 3 + .../{01_result.cl => 01_result.txt} | 0 tests/test_cool.py | 67 +- 47 files changed, 1565 insertions(+), 632 deletions(-) rename tests/{programs_for_execution => correct_programs}/01_program.cl (100%) rename tests/{programs_for_execution => correct_programs}/02_program.cl (100%) rename tests/{programs_for_execution => correct_programs}/03_program.cl (100%) rename tests/{programs_for_execution => correct_programs}/04_program.cl (100%) rename tests/{programs_for_execution => correct_programs}/05_program.cl (100%) rename tests/{programs_for_execution => correct_programs}/06_program.cl (100%) rename tests/inference/{01_result.cl => 01_result.txt} (100%) rename tests/inference/{02_result.cl => 02_result.txt} (100%) rename tests/inference/{03_result.cl => 03_result.txt} (100%) rename tests/inference/{04_result.cl => 04_result.txt} (100%) rename tests/inference/{05_result.cl => 05_result.txt} (100%) rename tests/inference/{06_result.cl => 06_result.txt} (100%) rename tests/inference/{07_result.cl => 07_result.txt} (100%) rename tests/inference/{08_result.cl => 08_result.txt} (100%) create mode 100644 tests/lexicographic_errors/comment1.cl create mode 100644 tests/lexicographic_errors/comment1_error.txt create mode 100644 tests/lexicographic_errors/iis1.cl create mode 100644 tests/lexicographic_errors/iis1_error.txt create mode 100644 tests/lexicographic_errors/iis2.cl create mode 100644 tests/lexicographic_errors/iis2_error.txt create mode 100644 tests/lexicographic_errors/iis3.cl create mode 100644 tests/lexicographic_errors/iis3_error.txt create mode 100644 tests/lexicographic_errors/iis4.cl create mode 100644 tests/lexicographic_errors/iis4_error.txt create mode 100644 tests/lexicographic_errors/iis5.cl create mode 100644 tests/lexicographic_errors/iis5_error.txt create mode 100644 tests/lexicographic_errors/iis6.cl create mode 100644 tests/lexicographic_errors/iis6_error.txt create mode 100644 tests/lexicographic_errors/mixed1.cl create mode 100644 tests/lexicographic_errors/mixed1_error.txt create mode 100644 tests/lexicographic_errors/mixed2.cl create mode 100644 tests/lexicographic_errors/mixed2_error.txt create mode 100644 tests/lexicographic_errors/string1.cl create mode 100644 tests/lexicographic_errors/string1_error.txt create mode 100644 tests/lexicographic_errors/string2.cl create mode 100644 tests/lexicographic_errors/string2_error.txt create mode 100644 tests/lexicographic_errors/string3.cl create mode 100644 tests/lexicographic_errors/string3_error.txt create mode 100644 tests/lexicographic_errors/string4.cl create mode 100644 tests/lexicographic_errors/string4_error.txt rename tests/syntactic_and_semantic_errors/{01_result.cl => 01_result.txt} (100%) diff --git a/cool.py b/cool.py index f1342dd39..fe97b30fb 100644 --- a/cool.py +++ b/cool.py @@ -41,11 +41,15 @@ def tokenize(file: str, verbose: bool = False): for t in tokens: typer.echo(t) - return tokens + return tokens, lexer def parse(file: str, verbose: bool = False): - tokens = tokenize(file, verbose) + tokens, lexer = tokenize(file, verbose) + + if lexer.contain_errors: + return None, None + parser = CoolParser(verbose) ast = parser(tokens) diff --git a/grammar.py b/grammar.py index 932a7f1c6..27558edb1 100644 --- a/grammar.py +++ b/grammar.py @@ -1,7 +1,7 @@ import inspect import time -from pyjapt import Grammar +from pyjapt import Grammar, Lexer import semantics.utils.astnodes as ast @@ -71,8 +71,8 @@ def id_terminal(lexer): ############ # Comments # ############ -@G.terminal('comment', r'(\(\*[^$]*\*\))|--.*') -def comment(lexer): +@G.terminal('single_line_comment', r'--.*') +def single_line_comment(lexer): lex = lexer.token.lex for s in lex: if s == '\n': @@ -82,24 +82,49 @@ def comment(lexer): lexer.position += len(lex) -@G.terminal('comment_error', r'\(\*(.|\n)*$') -def comment_eof_error(lexer): - lexer.contain_errors = True - lex = lexer.token.lex - for s in lex: - if s == '\n': - lexer.lineno += 1 - lexer.column = 0 - lexer.column += 1 - lexer.position += len(lex) - lexer.print_error(f'{lexer.lineno, lexer.column} -LexicographicError: EOF in comment') +@G.terminal('multi_line_comment', r'\(\*') +def multi_line_comment(lexer: Lexer): + stack = ['(*'] + text = lexer.text + pos = lexer.position + 2 + lex = '(*' + + while stack: + if pos >= len(text): + lexer.contain_errors = True + lexer.position = pos + lexer.add_error(lexer.lineno, lexer.column, + f'{lexer.lineno, lexer.column} - LexicographicError: EOF in comment') + return None + + if text.startswith('(*', pos): + stack.append('(*') + pos += 2 + lex += '(*' + lexer.column += 2 + elif text.startswith('*)', pos): + stack.pop() + pos += 2 + lex += '*)' + lexer.column += 2 + else: + if text[pos] == '\n': + lexer.lineno += 1 + lexer.column = 0 + elif text[pos] == '\t': + lexer.column += 3 + lex += text[pos] + pos += 1 + lexer.column += 1 + lexer.position = pos + lexer.token.lex = lex ################## # Ignored Tokens # ################## @G.terminal('newline', r'\n+') -def newline(lexer): +def newline(lexer: Lexer): lexer.lineno += len(lexer.token.lex) lexer.position += len(lexer.token.lex) lexer.column = 1 @@ -119,7 +144,8 @@ def tab(lexer): @G.lexical_error def lexical_error(lexer): - lexer.add_error(f'{lexer.lineno, lexer.column} -LexicographicError: ERROR "{lexer.token.lex}"') + lexer.add_error(lexer.lineno, lexer.column, + f'{lexer.lineno, lexer.column} - LexicographicError: ERROR "{lexer.token.lex}"') lexer.column += len(lexer.token.lex) lexer.position += len(lexer.token.lex) diff --git a/lexertab.py b/lexertab.py index 2d007f6f6..cb1737f3e 100644 --- a/lexertab.py +++ b/lexertab.py @@ -10,9 +10,10 @@ def __init__(self): self.column = 1 self.position = 0 self.token = Token('', '', 0, 0) - self.pattern = re.compile(r'(?P[a-z][a-zA-Z0-9_]*)|(?P(\(\*[^$]*\*\))|--.*)|(?P\(\*(.|\n)*$)|(?P\n+)|(?P +)|(?P\t+)|(?P[A-Z][a-zA-Z0-9_]*)|(?P\"[^\"]*\")|(?P\d+)|(inherits)|(isvoid)|(class)|(while)|(false)|(then)|(else)|(loop)|(pool)|(case)|(esac)|(true)|(<\-)|(let)|(new)|(not)|(\{)|(\})|(\()|(\))|(\.)|(=>)|(if)|(fi)|(in)|(of)|(\+)|(\-)|(\*)|(<=)|(\~)|(,)|(:)|(;)|(@)|(/)|(<)|(=)') + self.pattern = re.compile(r'(?P[a-z][a-zA-Z0-9_]*)|(?P--.*)|(?P\(\*)|(?P\n+)|(?P +)|(?P\t+)|(?P[A-Z][a-zA-Z0-9_]*)|(?P\"[^\"]*\")|(?P\d+)|(inherits)|(isvoid)|(class)|(while)|(false)|(then)|(else)|(loop)|(pool)|(case)|(esac)|(true)|(<\-)|(let)|(new)|(not)|(\{)|(\})|(\()|(\))|(\.)|(=>)|(if)|(fi)|(in)|(of)|(\+)|(\-)|(\*)|(<=)|(\~)|(,)|(:)|(;)|(@)|(/)|(<)|(=)') self.token_rules = {key: rule for key, (_, _, rule) in G.terminal_rules.items() if rule is not None} self.error_handler = G.lexical_error_handler if G.lexical_error_handler is not None else self.error + self._errors = [] self.contain_errors = False self.eof = '$' diff --git a/parsertab.py b/parsertab.py index 3ac34473c..f5e082dd8 100644 --- a/parsertab.py +++ b/parsertab.py @@ -18,133 +18,138 @@ def __action_table(): (1, G["type"]): ("SHIFT", 2), (2, G["inherits"]): ("SHIFT", 145), (2, G["{"]): ("SHIFT", 3), - (3, G["id"]): ("SHIFT", 4), (3, G["}"]): ("REDUCE", G["feature-list -> e"]), - (4, G[":"]): ("SHIFT", 129), + (3, G["id"]): ("SHIFT", 4), (4, G["("]): ("SHIFT", 5), + (4, G[":"]): ("SHIFT", 129), (5, G["id"]): ("SHIFT", 117), (5, G[")"]): ("SHIFT", 6), (6, G[":"]): ("SHIFT", 7), (7, G["type"]): ("SHIFT", 8), (8, G["{"]): ("SHIFT", 9), - (9, G["{"]): ("SHIFT", 10), - (9, G["id"]): ("SHIFT", 31), - (9, G["isvoid"]): ("SHIFT", 24), - (9, G["string"]): ("SHIFT", 33), + (9, G["~"]): ("SHIFT", 27), (9, G["false"]): ("SHIFT", 26), + (9, G["id"]): ("SHIFT", 31), + (9, G["new"]): ("SHIFT", 22), (9, G["true"]): ("SHIFT", 25), + (9, G["let"]): ("SHIFT", 14), + (9, G["{"]): ("SHIFT", 10), + (9, G["string"]): ("SHIFT", 33), (9, G["while"]): ("SHIFT", 13), + (9, G["isvoid"]): ("SHIFT", 24), + (9, G["("]): ("SHIFT", 11), (9, G["if"]): ("SHIFT", 12), (9, G["not"]): ("SHIFT", 30), - (9, G["~"]): ("SHIFT", 27), (9, G["int"]): ("SHIFT", 34), - (9, G["let"]): ("SHIFT", 14), (9, G["case"]): ("SHIFT", 21), - (9, G["("]): ("SHIFT", 11), - (9, G["new"]): ("SHIFT", 22), + (10, G["case"]): ("SHIFT", 21), + (10, G["isvoid"]): ("SHIFT", 24), + (10, G["false"]): ("SHIFT", 26), (10, G["id"]): ("SHIFT", 31), + (10, G["new"]): ("SHIFT", 22), + (10, G["true"]): ("SHIFT", 25), + (10, G["~"]): ("SHIFT", 27), + (10, G["string"]): ("SHIFT", 33), + (10, G["{"]): ("SHIFT", 10), + (10, G["let"]): ("SHIFT", 14), (10, G["while"]): ("SHIFT", 13), + (10, G["("]): ("SHIFT", 11), (10, G["if"]): ("SHIFT", 12), - (10, G["int"]): ("SHIFT", 34), (10, G["not"]): ("SHIFT", 30), - (10, G["("]): ("SHIFT", 11), - (10, G["let"]): ("SHIFT", 14), - (10, G["~"]): ("SHIFT", 27), - (10, G["case"]): ("SHIFT", 21), - (10, G["new"]): ("SHIFT", 22), - (10, G["{"]): ("SHIFT", 10), - (10, G["string"]): ("SHIFT", 33), - (10, G["false"]): ("SHIFT", 26), - (10, G["true"]): ("SHIFT", 25), - (10, G["isvoid"]): ("SHIFT", 24), - (11, G["{"]): ("SHIFT", 10), - (11, G["id"]): ("SHIFT", 31), - (11, G["string"]): ("SHIFT", 33), - (11, G["false"]): ("SHIFT", 26), - (11, G["isvoid"]): ("SHIFT", 24), - (11, G["true"]): ("SHIFT", 25), - (11, G["int"]): ("SHIFT", 34), - (11, G["~"]): ("SHIFT", 27), - (11, G["("]): ("SHIFT", 11), + (10, G["int"]): ("SHIFT", 34), (11, G["while"]): ("SHIFT", 13), + (11, G["isvoid"]): ("SHIFT", 24), (11, G["if"]): ("SHIFT", 12), (11, G["not"]): ("SHIFT", 30), + (11, G["int"]): ("SHIFT", 34), + (11, G["false"]): ("SHIFT", 26), + (11, G["case"]): ("SHIFT", 21), (11, G["new"]): ("SHIFT", 22), + (11, G["~"]): ("SHIFT", 27), + (11, G["true"]): ("SHIFT", 25), + (11, G["id"]): ("SHIFT", 31), + (11, G["string"]): ("SHIFT", 33), (11, G["let"]): ("SHIFT", 14), - (11, G["case"]): ("SHIFT", 21), - (12, G["int"]): ("SHIFT", 34), - (12, G["("]): ("SHIFT", 11), - (12, G["{"]): ("SHIFT", 10), - (12, G["id"]): ("SHIFT", 31), + (11, G["{"]): ("SHIFT", 10), + (11, G["("]): ("SHIFT", 11), + (12, G["false"]): ("SHIFT", 26), + (12, G["case"]): ("SHIFT", 21), (12, G["new"]): ("SHIFT", 22), + (12, G["true"]): ("SHIFT", 25), (12, G["isvoid"]): ("SHIFT", 24), + (12, G["id"]): ("SHIFT", 31), + (12, G["string"]): ("SHIFT", 33), + (12, G["~"]): ("SHIFT", 27), + (12, G["{"]): ("SHIFT", 10), + (12, G["let"]): ("SHIFT", 14), + (12, G["("]): ("SHIFT", 11), (12, G["while"]): ("SHIFT", 13), + (12, G["int"]): ("SHIFT", 34), (12, G["if"]): ("SHIFT", 12), - (12, G["string"]): ("SHIFT", 33), - (12, G["false"]): ("SHIFT", 26), (12, G["not"]): ("SHIFT", 30), - (12, G["let"]): ("SHIFT", 14), - (12, G["~"]): ("SHIFT", 27), - (12, G["case"]): ("SHIFT", 21), - (12, G["true"]): ("SHIFT", 25), - (13, G["while"]): ("SHIFT", 13), - (13, G["if"]): ("SHIFT", 12), - (13, G["isvoid"]): ("SHIFT", 24), - (13, G["not"]): ("SHIFT", 30), - (13, G["let"]): ("SHIFT", 14), - (13, G["string"]): ("SHIFT", 33), - (13, G["false"]): ("SHIFT", 26), + (13, G["new"]): ("SHIFT", 22), (13, G["case"]): ("SHIFT", 21), - (13, G["~"]): ("SHIFT", 27), - (13, G["id"]): ("SHIFT", 31), (13, G["true"]): ("SHIFT", 25), - (13, G["int"]): ("SHIFT", 34), + (13, G["id"]): ("SHIFT", 31), + (13, G["isvoid"]): ("SHIFT", 24), + (13, G["string"]): ("SHIFT", 33), + (13, G["let"]): ("SHIFT", 14), (13, G["{"]): ("SHIFT", 10), (13, G["("]): ("SHIFT", 11), - (13, G["new"]): ("SHIFT", 22), + (13, G["~"]): ("SHIFT", 27), + (13, G["while"]): ("SHIFT", 13), + (13, G["if"]): ("SHIFT", 12), + (13, G["int"]): ("SHIFT", 34), + (13, G["not"]): ("SHIFT", 30), + (13, G["false"]): ("SHIFT", 26), (14, G["id"]): ("SHIFT", 15), (15, G[":"]): ("SHIFT", 16), (16, G["type"]): ("SHIFT", 17), - (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), (17, G["<-"]): ("SHIFT", 20), (17, G[","]): ("SHIFT", 18), + (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), (18, G["id"]): ("SHIFT", 15), (19, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), - (20, G["while"]): ("SHIFT", 13), - (20, G["if"]): ("SHIFT", 12), - (20, G["string"]): ("SHIFT", 33), - (20, G["false"]): ("SHIFT", 26), - (20, G["not"]): ("SHIFT", 30), - (20, G["let"]): ("SHIFT", 14), - (20, G["isvoid"]): ("SHIFT", 24), - (20, G["id"]): ("SHIFT", 31), - (20, G["true"]): ("SHIFT", 25), (20, G["case"]): ("SHIFT", 21), - (20, G["int"]): ("SHIFT", 34), + (20, G["string"]): ("SHIFT", 33), (20, G["~"]): ("SHIFT", 27), + (20, G["id"]): ("SHIFT", 31), (20, G["("]): ("SHIFT", 11), + (20, G["int"]): ("SHIFT", 34), + (20, G["let"]): ("SHIFT", 14), (20, G["{"]): ("SHIFT", 10), + (20, G["false"]): ("SHIFT", 26), + (20, G["while"]): ("SHIFT", 13), + (20, G["if"]): ("SHIFT", 12), + (20, G["not"]): ("SHIFT", 30), (20, G["new"]): ("SHIFT", 22), - (21, G["let"]): ("SHIFT", 14), + (20, G["isvoid"]): ("SHIFT", 24), + (20, G["true"]): ("SHIFT", 25), + (21, G["string"]): ("SHIFT", 33), + (21, G["if"]): ("SHIFT", 12), + (21, G["not"]): ("SHIFT", 30), (21, G["id"]): ("SHIFT", 31), - (21, G["true"]): ("SHIFT", 25), + (21, G["("]): ("SHIFT", 11), (21, G["case"]): ("SHIFT", 21), (21, G["int"]): ("SHIFT", 34), (21, G["isvoid"]): ("SHIFT", 24), - (21, G["("]): ("SHIFT", 11), - (21, G["{"]): ("SHIFT", 10), + (21, G["false"]): ("SHIFT", 26), (21, G["new"]): ("SHIFT", 22), + (21, G["{"]): ("SHIFT", 10), + (21, G["true"]): ("SHIFT", 25), + (21, G["let"]): ("SHIFT", 14), (21, G["~"]): ("SHIFT", 27), (21, G["while"]): ("SHIFT", 13), - (21, G["if"]): ("SHIFT", 12), - (21, G["string"]): ("SHIFT", 33), - (21, G["false"]): ("SHIFT", 26), - (21, G["not"]): ("SHIFT", 30), (22, G["type"]): ("SHIFT", 23), + (23, G["-"]): ("REDUCE", G["atom -> new type"]), + (23, G["in"]): ("REDUCE", G["atom -> new type"]), + (23, G["*"]): ("REDUCE", G["atom -> new type"]), + (23, G["}"]): ("REDUCE", G["atom -> new type"]), + (23, G["/"]): ("REDUCE", G["atom -> new type"]), + (23, G["error"]): ("REDUCE", G["atom -> new type"]), (23, G["of"]): ("REDUCE", G["atom -> new type"]), (23, G["<"]): ("REDUCE", G["atom -> new type"]), (23, G[")"]): ("REDUCE", G["atom -> new type"]), - (23, G["/"]): ("REDUCE", G["atom -> new type"]), (23, G["then"]): ("REDUCE", G["atom -> new type"]), (23, G["<="]): ("REDUCE", G["atom -> new type"]), (23, G["."]): ("REDUCE", G["atom -> new type"]), @@ -157,24 +162,24 @@ def __action_table(): (23, G["@"]): ("REDUCE", G["atom -> new type"]), (23, G["pool"]): ("REDUCE", G["atom -> new type"]), (23, G["+"]): ("REDUCE", G["atom -> new type"]), - (23, G["-"]): ("REDUCE", G["atom -> new type"]), - (23, G["in"]): ("REDUCE", G["atom -> new type"]), - (23, G["*"]): ("REDUCE", G["atom -> new type"]), - (23, G["error"]): ("REDUCE", G["atom -> new type"]), - (23, G["}"]): ("REDUCE", G["atom -> new type"]), - (24, G["int"]): ("SHIFT", 34), - (24, G["~"]): ("SHIFT", 27), - (24, G["new"]): ("SHIFT", 22), (24, G["id"]): ("SHIFT", 28), (24, G["isvoid"]): ("SHIFT", 24), - (24, G["true"]): ("SHIFT", 25), (24, G["("]): ("SHIFT", 11), + (24, G["int"]): ("SHIFT", 34), (24, G["string"]): ("SHIFT", 33), + (24, G["new"]): ("SHIFT", 22), + (24, G["~"]): ("SHIFT", 27), + (24, G["true"]): ("SHIFT", 25), (24, G["false"]): ("SHIFT", 26), + (25, G["-"]): ("REDUCE", G["atom -> true"]), + (25, G["in"]): ("REDUCE", G["atom -> true"]), + (25, G["*"]): ("REDUCE", G["atom -> true"]), + (25, G["}"]): ("REDUCE", G["atom -> true"]), + (25, G["/"]): ("REDUCE", G["atom -> true"]), + (25, G["error"]): ("REDUCE", G["atom -> true"]), (25, G["of"]): ("REDUCE", G["atom -> true"]), (25, G["<"]): ("REDUCE", G["atom -> true"]), (25, G[")"]): ("REDUCE", G["atom -> true"]), - (25, G["/"]): ("REDUCE", G["atom -> true"]), (25, G["then"]): ("REDUCE", G["atom -> true"]), (25, G["<="]): ("REDUCE", G["atom -> true"]), (25, G["."]): ("REDUCE", G["atom -> true"]), @@ -187,15 +192,15 @@ def __action_table(): (25, G["@"]): ("REDUCE", G["atom -> true"]), (25, G["pool"]): ("REDUCE", G["atom -> true"]), (25, G["+"]): ("REDUCE", G["atom -> true"]), - (25, G["-"]): ("REDUCE", G["atom -> true"]), - (25, G["in"]): ("REDUCE", G["atom -> true"]), - (25, G["*"]): ("REDUCE", G["atom -> true"]), - (25, G["error"]): ("REDUCE", G["atom -> true"]), - (25, G["}"]): ("REDUCE", G["atom -> true"]), + (26, G["-"]): ("REDUCE", G["atom -> false"]), + (26, G["in"]): ("REDUCE", G["atom -> false"]), + (26, G["*"]): ("REDUCE", G["atom -> false"]), + (26, G["}"]): ("REDUCE", G["atom -> false"]), + (26, G["/"]): ("REDUCE", G["atom -> false"]), + (26, G["error"]): ("REDUCE", G["atom -> false"]), (26, G["of"]): ("REDUCE", G["atom -> false"]), (26, G["<"]): ("REDUCE", G["atom -> false"]), (26, G[")"]): ("REDUCE", G["atom -> false"]), - (26, G["/"]): ("REDUCE", G["atom -> false"]), (26, G["then"]): ("REDUCE", G["atom -> false"]), (26, G["<="]): ("REDUCE", G["atom -> false"]), (26, G["."]): ("REDUCE", G["atom -> false"]), @@ -208,24 +213,25 @@ def __action_table(): (26, G["@"]): ("REDUCE", G["atom -> false"]), (26, G["pool"]): ("REDUCE", G["atom -> false"]), (26, G["+"]): ("REDUCE", G["atom -> false"]), - (26, G["-"]): ("REDUCE", G["atom -> false"]), - (26, G["in"]): ("REDUCE", G["atom -> false"]), - (26, G["*"]): ("REDUCE", G["atom -> false"]), - (26, G["error"]): ("REDUCE", G["atom -> false"]), - (26, G["}"]): ("REDUCE", G["atom -> false"]), - (27, G["int"]): ("SHIFT", 34), - (27, G["~"]): ("SHIFT", 27), - (27, G["new"]): ("SHIFT", 22), - (27, G["string"]): ("SHIFT", 33), (27, G["id"]): ("SHIFT", 28), (27, G["isvoid"]): ("SHIFT", 24), - (27, G["true"]): ("SHIFT", 25), (27, G["("]): ("SHIFT", 11), + (27, G["int"]): ("SHIFT", 34), + (27, G["string"]): ("SHIFT", 33), + (27, G["new"]): ("SHIFT", 22), + (27, G["~"]): ("SHIFT", 27), + (27, G["true"]): ("SHIFT", 25), (27, G["false"]): ("SHIFT", 26), + (28, G["("]): ("SHIFT", 29), + (28, G["-"]): ("REDUCE", G["atom -> id"]), + (28, G["in"]): ("REDUCE", G["atom -> id"]), + (28, G["*"]): ("REDUCE", G["atom -> id"]), + (28, G["}"]): ("REDUCE", G["atom -> id"]), + (28, G["/"]): ("REDUCE", G["atom -> id"]), + (28, G["error"]): ("REDUCE", G["atom -> id"]), (28, G["of"]): ("REDUCE", G["atom -> id"]), (28, G["<"]): ("REDUCE", G["atom -> id"]), (28, G[")"]): ("REDUCE", G["atom -> id"]), - (28, G["/"]): ("REDUCE", G["atom -> id"]), (28, G["then"]): ("REDUCE", G["atom -> id"]), (28, G["<="]): ("REDUCE", G["atom -> id"]), (28, G["."]): ("REDUCE", G["atom -> id"]), @@ -238,47 +244,47 @@ def __action_table(): (28, G["@"]): ("REDUCE", G["atom -> id"]), (28, G["pool"]): ("REDUCE", G["atom -> id"]), (28, G["+"]): ("REDUCE", G["atom -> id"]), - (28, G["-"]): ("REDUCE", G["atom -> id"]), - (28, G["in"]): ("REDUCE", G["atom -> id"]), - (28, G["*"]): ("REDUCE", G["atom -> id"]), - (28, G["error"]): ("REDUCE", G["atom -> id"]), - (28, G["}"]): ("REDUCE", G["atom -> id"]), - (28, G["("]): ("SHIFT", 29), - (29, G["int"]): ("SHIFT", 34), (29, G["while"]): ("SHIFT", 13), + (29, G["id"]): ("SHIFT", 31), (29, G["if"]): ("SHIFT", 12), + (29, G["~"]): ("SHIFT", 27), (29, G["not"]): ("SHIFT", 30), (29, G["("]): ("SHIFT", 11), - (29, G["let"]): ("SHIFT", 14), - (29, G[")"]): ("REDUCE", G["expr-list -> e"]), - (29, G["new"]): ("SHIFT", 22), (29, G["case"]): ("SHIFT", 21), - (29, G["{"]): ("SHIFT", 10), - (29, G["isvoid"]): ("SHIFT", 24), - (29, G["id"]): ("SHIFT", 31), - (29, G["string"]): ("SHIFT", 33), + (29, G["int"]): ("SHIFT", 34), (29, G["false"]): ("SHIFT", 26), + (29, G["new"]): ("SHIFT", 22), (29, G["true"]): ("SHIFT", 25), - (29, G["~"]): ("SHIFT", 27), - (30, G["int"]): ("SHIFT", 34), - (30, G["("]): ("SHIFT", 11), - (30, G["new"]): ("SHIFT", 22), + (29, G["isvoid"]): ("SHIFT", 24), + (29, G["{"]): ("SHIFT", 10), + (29, G["let"]): ("SHIFT", 14), + (29, G["string"]): ("SHIFT", 33), + (29, G[")"]): ("REDUCE", G["expr-list -> e"]), + (30, G["isvoid"]): ("SHIFT", 24), + (30, G["string"]): ("SHIFT", 33), (30, G["while"]): ("SHIFT", 13), (30, G["if"]): ("SHIFT", 12), - (30, G["isvoid"]): ("SHIFT", 24), (30, G["not"]): ("SHIFT", 30), - (30, G["let"]): ("SHIFT", 14), (30, G["id"]): ("SHIFT", 31), + (30, G["("]): ("SHIFT", 11), + (30, G["~"]): ("SHIFT", 27), (30, G["case"]): ("SHIFT", 21), - (30, G["string"]): ("SHIFT", 33), + (30, G["int"]): ("SHIFT", 34), (30, G["false"]): ("SHIFT", 26), - (30, G["~"]): ("SHIFT", 27), + (30, G["new"]): ("SHIFT", 22), (30, G["true"]): ("SHIFT", 25), + (30, G["let"]): ("SHIFT", 14), (30, G["{"]): ("SHIFT", 10), + (31, G["("]): ("SHIFT", 29), + (31, G["-"]): ("REDUCE", G["atom -> id"]), + (31, G["in"]): ("REDUCE", G["atom -> id"]), + (31, G["*"]): ("REDUCE", G["atom -> id"]), + (31, G["}"]): ("REDUCE", G["atom -> id"]), + (31, G["/"]): ("REDUCE", G["atom -> id"]), + (31, G["error"]): ("REDUCE", G["atom -> id"]), (31, G["of"]): ("REDUCE", G["atom -> id"]), (31, G["<"]): ("REDUCE", G["atom -> id"]), (31, G[")"]): ("REDUCE", G["atom -> id"]), - (31, G["/"]): ("REDUCE", G["atom -> id"]), (31, G["then"]): ("REDUCE", G["atom -> id"]), (31, G["<="]): ("REDUCE", G["atom -> id"]), (31, G["."]): ("REDUCE", G["atom -> id"]), @@ -291,32 +297,31 @@ def __action_table(): (31, G["@"]): ("REDUCE", G["atom -> id"]), (31, G["pool"]): ("REDUCE", G["atom -> id"]), (31, G["+"]): ("REDUCE", G["atom -> id"]), - (31, G["-"]): ("REDUCE", G["atom -> id"]), - (31, G["in"]): ("REDUCE", G["atom -> id"]), - (31, G["*"]): ("REDUCE", G["atom -> id"]), - (31, G["error"]): ("REDUCE", G["atom -> id"]), - (31, G["}"]): ("REDUCE", G["atom -> id"]), (31, G["<-"]): ("SHIFT", 32), - (31, G["("]): ("SHIFT", 29), - (32, G["int"]): ("SHIFT", 34), - (32, G["("]): ("SHIFT", 11), - (32, G["new"]): ("SHIFT", 22), + (32, G["isvoid"]): ("SHIFT", 24), + (32, G["string"]): ("SHIFT", 33), (32, G["while"]): ("SHIFT", 13), (32, G["if"]): ("SHIFT", 12), - (32, G["isvoid"]): ("SHIFT", 24), (32, G["not"]): ("SHIFT", 30), - (32, G["let"]): ("SHIFT", 14), (32, G["id"]): ("SHIFT", 31), + (32, G["("]): ("SHIFT", 11), + (32, G["~"]): ("SHIFT", 27), (32, G["case"]): ("SHIFT", 21), - (32, G["string"]): ("SHIFT", 33), + (32, G["int"]): ("SHIFT", 34), (32, G["false"]): ("SHIFT", 26), - (32, G["~"]): ("SHIFT", 27), + (32, G["new"]): ("SHIFT", 22), (32, G["true"]): ("SHIFT", 25), + (32, G["let"]): ("SHIFT", 14), (32, G["{"]): ("SHIFT", 10), + (33, G["-"]): ("REDUCE", G["atom -> string"]), + (33, G["in"]): ("REDUCE", G["atom -> string"]), + (33, G["*"]): ("REDUCE", G["atom -> string"]), + (33, G["}"]): ("REDUCE", G["atom -> string"]), + (33, G["/"]): ("REDUCE", G["atom -> string"]), + (33, G["error"]): ("REDUCE", G["atom -> string"]), (33, G["of"]): ("REDUCE", G["atom -> string"]), (33, G["<"]): ("REDUCE", G["atom -> string"]), (33, G[")"]): ("REDUCE", G["atom -> string"]), - (33, G["/"]): ("REDUCE", G["atom -> string"]), (33, G["then"]): ("REDUCE", G["atom -> string"]), (33, G["<="]): ("REDUCE", G["atom -> string"]), (33, G["."]): ("REDUCE", G["atom -> string"]), @@ -329,15 +334,15 @@ def __action_table(): (33, G["@"]): ("REDUCE", G["atom -> string"]), (33, G["pool"]): ("REDUCE", G["atom -> string"]), (33, G["+"]): ("REDUCE", G["atom -> string"]), - (33, G["-"]): ("REDUCE", G["atom -> string"]), - (33, G["in"]): ("REDUCE", G["atom -> string"]), - (33, G["*"]): ("REDUCE", G["atom -> string"]), - (33, G["error"]): ("REDUCE", G["atom -> string"]), - (33, G["}"]): ("REDUCE", G["atom -> string"]), + (34, G["-"]): ("REDUCE", G["atom -> int"]), + (34, G["in"]): ("REDUCE", G["atom -> int"]), + (34, G["*"]): ("REDUCE", G["atom -> int"]), + (34, G["}"]): ("REDUCE", G["atom -> int"]), + (34, G["/"]): ("REDUCE", G["atom -> int"]), + (34, G["error"]): ("REDUCE", G["atom -> int"]), (34, G["of"]): ("REDUCE", G["atom -> int"]), (34, G["<"]): ("REDUCE", G["atom -> int"]), (34, G[")"]): ("REDUCE", G["atom -> int"]), - (34, G["/"]): ("REDUCE", G["atom -> int"]), (34, G["then"]): ("REDUCE", G["atom -> int"]), (34, G["<="]): ("REDUCE", G["atom -> int"]), (34, G["."]): ("REDUCE", G["atom -> int"]), @@ -350,15 +355,15 @@ def __action_table(): (34, G["@"]): ("REDUCE", G["atom -> int"]), (34, G["pool"]): ("REDUCE", G["atom -> int"]), (34, G["+"]): ("REDUCE", G["atom -> int"]), - (34, G["-"]): ("REDUCE", G["atom -> int"]), - (34, G["in"]): ("REDUCE", G["atom -> int"]), - (34, G["*"]): ("REDUCE", G["atom -> int"]), - (34, G["error"]): ("REDUCE", G["atom -> int"]), - (34, G["}"]): ("REDUCE", G["atom -> int"]), + (35, G["-"]): ("REDUCE", G["atom -> function-call"]), + (35, G["in"]): ("REDUCE", G["atom -> function-call"]), + (35, G["*"]): ("REDUCE", G["atom -> function-call"]), + (35, G["}"]): ("REDUCE", G["atom -> function-call"]), + (35, G["/"]): ("REDUCE", G["atom -> function-call"]), + (35, G["error"]): ("REDUCE", G["atom -> function-call"]), (35, G["of"]): ("REDUCE", G["atom -> function-call"]), (35, G["<"]): ("REDUCE", G["atom -> function-call"]), (35, G[")"]): ("REDUCE", G["atom -> function-call"]), - (35, G["/"]): ("REDUCE", G["atom -> function-call"]), (35, G["then"]): ("REDUCE", G["atom -> function-call"]), (35, G["<="]): ("REDUCE", G["atom -> function-call"]), (35, G["."]): ("REDUCE", G["atom -> function-call"]), @@ -371,61 +376,62 @@ def __action_table(): (35, G["@"]): ("REDUCE", G["atom -> function-call"]), (35, G["pool"]): ("REDUCE", G["atom -> function-call"]), (35, G["+"]): ("REDUCE", G["atom -> function-call"]), - (35, G["-"]): ("REDUCE", G["atom -> function-call"]), - (35, G["in"]): ("REDUCE", G["atom -> function-call"]), - (35, G["*"]): ("REDUCE", G["atom -> function-call"]), - (35, G["error"]): ("REDUCE", G["atom -> function-call"]), - (35, G["}"]): ("REDUCE", G["atom -> function-call"]), - (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["else"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), (36, G["in"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), (36, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["}"]): ("REDUCE", G["expr -> id <- expr"]), - (37, G[";"]): ("REDUCE", G["expr -> comp"]), - (37, G["of"]): ("REDUCE", G["expr -> comp"]), - (37, G["loop"]): ("REDUCE", G["expr -> comp"]), - (37, G[")"]): ("REDUCE", G["expr -> comp"]), - (37, G["pool"]): ("REDUCE", G["expr -> comp"]), - (37, G["then"]): ("REDUCE", G["expr -> comp"]), + (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), (37, G["else"]): ("REDUCE", G["expr -> comp"]), - (37, G[","]): ("REDUCE", G["expr -> comp"]), (37, G["in"]): ("REDUCE", G["expr -> comp"]), + (37, G[","]): ("REDUCE", G["expr -> comp"]), (37, G["fi"]): ("REDUCE", G["expr -> comp"]), - (37, G["error"]): ("REDUCE", G["expr -> comp"]), (37, G["}"]): ("REDUCE", G["expr -> comp"]), - (38, G["<"]): ("SHIFT", 66), - (38, G["-"]): ("SHIFT", 64), - (38, G["+"]): ("SHIFT", 39), - (38, G["="]): ("SHIFT", 70), - (38, G["<="]): ("SHIFT", 68), - (38, G[";"]): ("REDUCE", G["comp -> arith"]), - (38, G["of"]): ("REDUCE", G["comp -> arith"]), - (38, G["loop"]): ("REDUCE", G["comp -> arith"]), - (38, G[")"]): ("REDUCE", G["comp -> arith"]), - (38, G["pool"]): ("REDUCE", G["comp -> arith"]), - (38, G["then"]): ("REDUCE", G["comp -> arith"]), + (37, G["error"]): ("REDUCE", G["expr -> comp"]), + (37, G[";"]): ("REDUCE", G["expr -> comp"]), + (37, G["loop"]): ("REDUCE", G["expr -> comp"]), + (37, G["of"]): ("REDUCE", G["expr -> comp"]), + (37, G[")"]): ("REDUCE", G["expr -> comp"]), + (37, G["then"]): ("REDUCE", G["expr -> comp"]), + (37, G["pool"]): ("REDUCE", G["expr -> comp"]), (38, G["else"]): ("REDUCE", G["comp -> arith"]), - (38, G[","]): ("REDUCE", G["comp -> arith"]), (38, G["in"]): ("REDUCE", G["comp -> arith"]), + (38, G[","]): ("REDUCE", G["comp -> arith"]), (38, G["fi"]): ("REDUCE", G["comp -> arith"]), - (38, G["error"]): ("REDUCE", G["comp -> arith"]), (38, G["}"]): ("REDUCE", G["comp -> arith"]), + (38, G[";"]): ("REDUCE", G["comp -> arith"]), + (38, G["error"]): ("REDUCE", G["comp -> arith"]), + (38, G["loop"]): ("REDUCE", G["comp -> arith"]), + (38, G["of"]): ("REDUCE", G["comp -> arith"]), + (38, G[")"]): ("REDUCE", G["comp -> arith"]), + (38, G["then"]): ("REDUCE", G["comp -> arith"]), + (38, G["pool"]): ("REDUCE", G["comp -> arith"]), + (38, G["+"]): ("SHIFT", 39), + (38, G["="]): ("SHIFT", 70), + (38, G["-"]): ("SHIFT", 64), + (38, G["<"]): ("SHIFT", 66), + (38, G["<="]): ("SHIFT", 68), + (39, G["isvoid"]): ("SHIFT", 24), (39, G["int"]): ("SHIFT", 34), - (39, G["("]): ("SHIFT", 11), (39, G["string"]): ("SHIFT", 33), (39, G["false"]): ("SHIFT", 26), - (39, G["~"]): ("SHIFT", 27), - (39, G["new"]): ("SHIFT", 22), (39, G["id"]): ("SHIFT", 28), + (39, G["("]): ("SHIFT", 11), + (39, G["new"]): ("SHIFT", 22), + (39, G["~"]): ("SHIFT", 27), (39, G["true"]): ("SHIFT", 25), - (39, G["isvoid"]): ("SHIFT", 24), + (40, G["/"]): ("SHIFT", 54), + (40, G["*"]): ("SHIFT", 41), + (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), (40, G["of"]): ("REDUCE", G["arith -> arith + term"]), (40, G["<"]): ("REDUCE", G["arith -> arith + term"]), (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), @@ -439,25 +445,24 @@ def __action_table(): (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), (40, G["+"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["*"]): ("SHIFT", 41), - (40, G["/"]): ("SHIFT", 54), - (41, G["int"]): ("SHIFT", 34), - (41, G["~"]): ("SHIFT", 27), - (41, G["new"]): ("SHIFT", 22), (41, G["id"]): ("SHIFT", 28), (41, G["isvoid"]): ("SHIFT", 24), - (41, G["true"]): ("SHIFT", 25), (41, G["("]): ("SHIFT", 11), + (41, G["int"]): ("SHIFT", 34), (41, G["string"]): ("SHIFT", 33), + (41, G["new"]): ("SHIFT", 22), + (41, G["~"]): ("SHIFT", 27), + (41, G["true"]): ("SHIFT", 25), (41, G["false"]): ("SHIFT", 26), + (42, G["-"]): ("REDUCE", G["term -> term * factor"]), + (42, G["in"]): ("REDUCE", G["term -> term * factor"]), + (42, G["*"]): ("REDUCE", G["term -> term * factor"]), + (42, G["}"]): ("REDUCE", G["term -> term * factor"]), + (42, G["/"]): ("REDUCE", G["term -> term * factor"]), + (42, G["error"]): ("REDUCE", G["term -> term * factor"]), (42, G["of"]): ("REDUCE", G["term -> term * factor"]), (42, G["<"]): ("REDUCE", G["term -> term * factor"]), (42, G[")"]): ("REDUCE", G["term -> term * factor"]), - (42, G["/"]): ("REDUCE", G["term -> term * factor"]), (42, G["then"]): ("REDUCE", G["term -> term * factor"]), (42, G["<="]): ("REDUCE", G["term -> term * factor"]), (42, G["else"]): ("REDUCE", G["term -> term * factor"]), @@ -468,15 +473,17 @@ def __action_table(): (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), (42, G["pool"]): ("REDUCE", G["term -> term * factor"]), (42, G["+"]): ("REDUCE", G["term -> term * factor"]), - (42, G["-"]): ("REDUCE", G["term -> term * factor"]), - (42, G["in"]): ("REDUCE", G["term -> term * factor"]), - (42, G["*"]): ("REDUCE", G["term -> term * factor"]), - (42, G["error"]): ("REDUCE", G["term -> term * factor"]), - (42, G["}"]): ("REDUCE", G["term -> term * factor"]), + (43, G["@"]): ("SHIFT", 57), + (43, G["."]): ("SHIFT", 44), + (43, G["-"]): ("REDUCE", G["factor -> atom"]), + (43, G["in"]): ("REDUCE", G["factor -> atom"]), + (43, G["*"]): ("REDUCE", G["factor -> atom"]), + (43, G["}"]): ("REDUCE", G["factor -> atom"]), + (43, G["/"]): ("REDUCE", G["factor -> atom"]), + (43, G["error"]): ("REDUCE", G["factor -> atom"]), (43, G["of"]): ("REDUCE", G["factor -> atom"]), (43, G["<"]): ("REDUCE", G["factor -> atom"]), (43, G[")"]): ("REDUCE", G["factor -> atom"]), - (43, G["/"]): ("REDUCE", G["factor -> atom"]), (43, G["then"]): ("REDUCE", G["factor -> atom"]), (43, G["<="]): ("REDUCE", G["factor -> atom"]), (43, G["else"]): ("REDUCE", G["factor -> atom"]), @@ -487,36 +494,34 @@ def __action_table(): (43, G["loop"]): ("REDUCE", G["factor -> atom"]), (43, G["pool"]): ("REDUCE", G["factor -> atom"]), (43, G["+"]): ("REDUCE", G["factor -> atom"]), - (43, G["-"]): ("REDUCE", G["factor -> atom"]), - (43, G["in"]): ("REDUCE", G["factor -> atom"]), - (43, G["*"]): ("REDUCE", G["factor -> atom"]), - (43, G["error"]): ("REDUCE", G["factor -> atom"]), - (43, G["}"]): ("REDUCE", G["factor -> atom"]), - (43, G["."]): ("SHIFT", 44), - (43, G["@"]): ("SHIFT", 57), (44, G["id"]): ("SHIFT", 45), (45, G["("]): ("SHIFT", 46), - (46, G["int"]): ("SHIFT", 34), (46, G["while"]): ("SHIFT", 13), + (46, G["id"]): ("SHIFT", 31), (46, G["if"]): ("SHIFT", 12), + (46, G["~"]): ("SHIFT", 27), (46, G["not"]): ("SHIFT", 30), (46, G["("]): ("SHIFT", 11), - (46, G["let"]): ("SHIFT", 14), - (46, G[")"]): ("REDUCE", G["expr-list -> e"]), - (46, G["new"]): ("SHIFT", 22), (46, G["case"]): ("SHIFT", 21), - (46, G["{"]): ("SHIFT", 10), - (46, G["isvoid"]): ("SHIFT", 24), - (46, G["id"]): ("SHIFT", 31), - (46, G["string"]): ("SHIFT", 33), + (46, G["int"]): ("SHIFT", 34), (46, G["false"]): ("SHIFT", 26), + (46, G["new"]): ("SHIFT", 22), (46, G["true"]): ("SHIFT", 25), - (46, G["~"]): ("SHIFT", 27), + (46, G["isvoid"]): ("SHIFT", 24), + (46, G["{"]): ("SHIFT", 10), + (46, G["let"]): ("SHIFT", 14), + (46, G["string"]): ("SHIFT", 33), + (46, G[")"]): ("REDUCE", G["expr-list -> e"]), (47, G[")"]): ("SHIFT", 48), + (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), @@ -529,30 +534,29 @@ def __action_table(): (48, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (49, G[")"]): ("REDUCE", G["expr-list -> not-empty-expr-list"]), (50, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), (50, G[","]): ("SHIFT", 51), - (51, G["int"]): ("SHIFT", 34), (51, G["while"]): ("SHIFT", 13), + (51, G["id"]): ("SHIFT", 31), (51, G["if"]): ("SHIFT", 12), + (51, G["~"]): ("SHIFT", 27), (51, G["not"]): ("SHIFT", 30), (51, G["("]): ("SHIFT", 11), - (51, G["let"]): ("SHIFT", 14), - (51, G["new"]): ("SHIFT", 22), (51, G["case"]): ("SHIFT", 21), - (51, G["{"]): ("SHIFT", 10), - (51, G["isvoid"]): ("SHIFT", 24), - (51, G["id"]): ("SHIFT", 31), - (51, G["string"]): ("SHIFT", 33), + (51, G["int"]): ("SHIFT", 34), (51, G["false"]): ("SHIFT", 26), + (51, G["new"]): ("SHIFT", 22), (51, G["true"]): ("SHIFT", 25), - (51, G["~"]): ("SHIFT", 27), + (51, G["isvoid"]): ("SHIFT", 24), + (51, G["{"]): ("SHIFT", 10), + (51, G["let"]): ("SHIFT", 14), + (51, G["string"]): ("SHIFT", 33), (52, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr , not-empty-expr-list"]), + (53, G["in"]): ("REDUCE", G["arith -> term"]), + (53, G["-"]): ("REDUCE", G["arith -> term"]), + (53, G["}"]): ("REDUCE", G["arith -> term"]), + (53, G["error"]): ("REDUCE", G["arith -> term"]), (53, G["of"]): ("REDUCE", G["arith -> term"]), (53, G["<"]): ("REDUCE", G["arith -> term"]), (53, G[")"]): ("REDUCE", G["arith -> term"]), @@ -566,25 +570,26 @@ def __action_table(): (53, G["loop"]): ("REDUCE", G["arith -> term"]), (53, G["pool"]): ("REDUCE", G["arith -> term"]), (53, G["+"]): ("REDUCE", G["arith -> term"]), - (53, G["-"]): ("REDUCE", G["arith -> term"]), - (53, G["in"]): ("REDUCE", G["arith -> term"]), - (53, G["error"]): ("REDUCE", G["arith -> term"]), - (53, G["}"]): ("REDUCE", G["arith -> term"]), - (53, G["*"]): ("SHIFT", 41), (53, G["/"]): ("SHIFT", 54), - (54, G["int"]): ("SHIFT", 34), - (54, G["~"]): ("SHIFT", 27), - (54, G["new"]): ("SHIFT", 22), + (53, G["*"]): ("SHIFT", 41), (54, G["id"]): ("SHIFT", 28), (54, G["isvoid"]): ("SHIFT", 24), - (54, G["true"]): ("SHIFT", 25), (54, G["("]): ("SHIFT", 11), + (54, G["int"]): ("SHIFT", 34), (54, G["string"]): ("SHIFT", 33), + (54, G["new"]): ("SHIFT", 22), + (54, G["~"]): ("SHIFT", 27), + (54, G["true"]): ("SHIFT", 25), (54, G["false"]): ("SHIFT", 26), + (55, G["-"]): ("REDUCE", G["term -> term / factor"]), + (55, G["in"]): ("REDUCE", G["term -> term / factor"]), + (55, G["*"]): ("REDUCE", G["term -> term / factor"]), + (55, G["}"]): ("REDUCE", G["term -> term / factor"]), + (55, G["/"]): ("REDUCE", G["term -> term / factor"]), + (55, G["error"]): ("REDUCE", G["term -> term / factor"]), (55, G["of"]): ("REDUCE", G["term -> term / factor"]), (55, G["<"]): ("REDUCE", G["term -> term / factor"]), (55, G[")"]): ("REDUCE", G["term -> term / factor"]), - (55, G["/"]): ("REDUCE", G["term -> term / factor"]), (55, G["then"]): ("REDUCE", G["term -> term / factor"]), (55, G["<="]): ("REDUCE", G["term -> term / factor"]), (55, G["else"]): ("REDUCE", G["term -> term / factor"]), @@ -595,15 +600,15 @@ def __action_table(): (55, G["loop"]): ("REDUCE", G["term -> term / factor"]), (55, G["pool"]): ("REDUCE", G["term -> term / factor"]), (55, G["+"]): ("REDUCE", G["term -> term / factor"]), - (55, G["-"]): ("REDUCE", G["term -> term / factor"]), - (55, G["in"]): ("REDUCE", G["term -> term / factor"]), - (55, G["*"]): ("REDUCE", G["term -> term / factor"]), - (55, G["error"]): ("REDUCE", G["term -> term / factor"]), - (55, G["}"]): ("REDUCE", G["term -> term / factor"]), + (56, G["-"]): ("REDUCE", G["term -> factor"]), + (56, G["in"]): ("REDUCE", G["term -> factor"]), + (56, G["*"]): ("REDUCE", G["term -> factor"]), + (56, G["}"]): ("REDUCE", G["term -> factor"]), + (56, G["/"]): ("REDUCE", G["term -> factor"]), + (56, G["error"]): ("REDUCE", G["term -> factor"]), (56, G["of"]): ("REDUCE", G["term -> factor"]), (56, G["<"]): ("REDUCE", G["term -> factor"]), (56, G[")"]): ("REDUCE", G["term -> factor"]), - (56, G["/"]): ("REDUCE", G["term -> factor"]), (56, G["then"]): ("REDUCE", G["term -> factor"]), (56, G["<="]): ("REDUCE", G["term -> factor"]), (56, G["else"]): ("REDUCE", G["term -> factor"]), @@ -614,36 +619,36 @@ def __action_table(): (56, G["loop"]): ("REDUCE", G["term -> factor"]), (56, G["pool"]): ("REDUCE", G["term -> factor"]), (56, G["+"]): ("REDUCE", G["term -> factor"]), - (56, G["-"]): ("REDUCE", G["term -> factor"]), - (56, G["in"]): ("REDUCE", G["term -> factor"]), - (56, G["*"]): ("REDUCE", G["term -> factor"]), - (56, G["error"]): ("REDUCE", G["term -> factor"]), - (56, G["}"]): ("REDUCE", G["term -> factor"]), (57, G["type"]): ("SHIFT", 58), (58, G["."]): ("SHIFT", 59), (59, G["id"]): ("SHIFT", 60), (60, G["("]): ("SHIFT", 61), - (61, G["int"]): ("SHIFT", 34), (61, G["while"]): ("SHIFT", 13), + (61, G["id"]): ("SHIFT", 31), (61, G["if"]): ("SHIFT", 12), + (61, G["~"]): ("SHIFT", 27), (61, G["not"]): ("SHIFT", 30), (61, G["("]): ("SHIFT", 11), - (61, G["let"]): ("SHIFT", 14), - (61, G[")"]): ("REDUCE", G["expr-list -> e"]), - (61, G["new"]): ("SHIFT", 22), (61, G["case"]): ("SHIFT", 21), - (61, G["{"]): ("SHIFT", 10), - (61, G["isvoid"]): ("SHIFT", 24), - (61, G["id"]): ("SHIFT", 31), - (61, G["string"]): ("SHIFT", 33), + (61, G["int"]): ("SHIFT", 34), (61, G["false"]): ("SHIFT", 26), + (61, G["new"]): ("SHIFT", 22), (61, G["true"]): ("SHIFT", 25), - (61, G["~"]): ("SHIFT", 27), + (61, G["isvoid"]): ("SHIFT", 24), + (61, G["{"]): ("SHIFT", 10), + (61, G["let"]): ("SHIFT", 14), + (61, G["string"]): ("SHIFT", 33), + (61, G[")"]): ("REDUCE", G["expr-list -> e"]), (62, G[")"]): ("SHIFT", 63), + (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), @@ -656,20 +661,19 @@ def __action_table(): (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (64, G["isvoid"]): ("SHIFT", 24), (64, G["int"]): ("SHIFT", 34), - (64, G["("]): ("SHIFT", 11), (64, G["string"]): ("SHIFT", 33), (64, G["false"]): ("SHIFT", 26), - (64, G["~"]): ("SHIFT", 27), - (64, G["new"]): ("SHIFT", 22), (64, G["id"]): ("SHIFT", 28), + (64, G["("]): ("SHIFT", 11), + (64, G["new"]): ("SHIFT", 22), + (64, G["~"]): ("SHIFT", 27), (64, G["true"]): ("SHIFT", 25), - (64, G["isvoid"]): ("SHIFT", 24), + (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["-"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["}"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["error"]): ("REDUCE", G["arith -> arith - term"]), (65, G["of"]): ("REDUCE", G["arith -> arith - term"]), (65, G["<"]): ("REDUCE", G["arith -> arith - term"]), (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), @@ -683,98 +687,99 @@ def __action_table(): (65, G["loop"]): ("REDUCE", G["arith -> arith - term"]), (65, G["pool"]): ("REDUCE", G["arith -> arith - term"]), (65, G["+"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["-"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["error"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["}"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["*"]): ("SHIFT", 41), (65, G["/"]): ("SHIFT", 54), - (66, G["~"]): ("SHIFT", 27), - (66, G["new"]): ("SHIFT", 22), + (65, G["*"]): ("SHIFT", 41), (66, G["string"]): ("SHIFT", 33), - (66, G["true"]): ("SHIFT", 25), - (66, G["id"]): ("SHIFT", 28), (66, G["isvoid"]): ("SHIFT", 24), - (66, G["int"]): ("SHIFT", 34), (66, G["false"]): ("SHIFT", 26), + (66, G["id"]): ("SHIFT", 28), (66, G["("]): ("SHIFT", 11), - (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), + (66, G["new"]): ("SHIFT", 22), + (66, G["true"]): ("SHIFT", 25), + (66, G["~"]): ("SHIFT", 27), + (66, G["int"]): ("SHIFT", 34), + (67, G["+"]): ("SHIFT", 39), + (67, G["-"]): ("SHIFT", 64), (67, G["else"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), (67, G["in"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), (67, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["}"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["-"]): ("SHIFT", 64), - (67, G["+"]): ("SHIFT", 39), - (68, G["~"]): ("SHIFT", 27), - (68, G["new"]): ("SHIFT", 22), + (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), (68, G["string"]): ("SHIFT", 33), - (68, G["true"]): ("SHIFT", 25), - (68, G["id"]): ("SHIFT", 28), (68, G["isvoid"]): ("SHIFT", 24), - (68, G["int"]): ("SHIFT", 34), (68, G["false"]): ("SHIFT", 26), + (68, G["id"]): ("SHIFT", 28), (68, G["("]): ("SHIFT", 11), - (69, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), + (68, G["new"]): ("SHIFT", 22), + (68, G["true"]): ("SHIFT", 25), + (68, G["~"]): ("SHIFT", 27), + (68, G["int"]): ("SHIFT", 34), + (69, G["-"]): ("SHIFT", 64), + (69, G["+"]): ("SHIFT", 39), (69, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["-"]): ("SHIFT", 64), - (69, G["+"]): ("SHIFT", 39), - (70, G["~"]): ("SHIFT", 27), - (70, G["new"]): ("SHIFT", 22), + (69, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), (70, G["string"]): ("SHIFT", 33), - (70, G["true"]): ("SHIFT", 25), - (70, G["id"]): ("SHIFT", 28), (70, G["isvoid"]): ("SHIFT", 24), - (70, G["int"]): ("SHIFT", 34), (70, G["false"]): ("SHIFT", 26), + (70, G["id"]): ("SHIFT", 28), (70, G["("]): ("SHIFT", 11), - (71, G[";"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), + (70, G["new"]): ("SHIFT", 22), + (70, G["true"]): ("SHIFT", 25), + (70, G["~"]): ("SHIFT", 27), + (70, G["int"]): ("SHIFT", 34), (71, G["else"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), (71, G["in"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), (71, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["error"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["}"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["error"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[";"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["-"]): ("SHIFT", 64), (71, G["+"]): ("SHIFT", 39), - (72, G[";"]): ("REDUCE", G["expr -> not expr"]), - (72, G["of"]): ("REDUCE", G["expr -> not expr"]), - (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), - (72, G[")"]): ("REDUCE", G["expr -> not expr"]), - (72, G["pool"]): ("REDUCE", G["expr -> not expr"]), - (72, G["then"]): ("REDUCE", G["expr -> not expr"]), (72, G["else"]): ("REDUCE", G["expr -> not expr"]), (72, G[","]): ("REDUCE", G["expr -> not expr"]), (72, G["in"]): ("REDUCE", G["expr -> not expr"]), (72, G["fi"]): ("REDUCE", G["expr -> not expr"]), - (72, G["error"]): ("REDUCE", G["expr -> not expr"]), (72, G["}"]): ("REDUCE", G["expr -> not expr"]), + (72, G["error"]): ("REDUCE", G["expr -> not expr"]), + (72, G[";"]): ("REDUCE", G["expr -> not expr"]), + (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), + (72, G["of"]): ("REDUCE", G["expr -> not expr"]), + (72, G[")"]): ("REDUCE", G["expr -> not expr"]), + (72, G["then"]): ("REDUCE", G["expr -> not expr"]), + (72, G["pool"]): ("REDUCE", G["expr -> not expr"]), (73, G[")"]): ("SHIFT", 74), + (74, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), @@ -787,15 +792,15 @@ def __action_table(): (74, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G["-"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["*"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["}"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["/"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["of"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["<"]): ("REDUCE", G["factor -> ~ factor"]), (75, G[")"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["/"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["then"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["<="]): ("REDUCE", G["factor -> ~ factor"]), (75, G["else"]): ("REDUCE", G["factor -> ~ factor"]), @@ -806,15 +811,15 @@ def __action_table(): (75, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["+"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["-"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["*"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["}"]): ("REDUCE", G["factor -> ~ factor"]), + (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), @@ -825,31 +830,26 @@ def __action_table(): (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), (77, G["of"]): ("SHIFT", 78), (78, G["id"]): ("SHIFT", 79), (79, G[":"]): ("SHIFT", 80), (80, G["type"]): ("SHIFT", 81), (81, G["=>"]): ("SHIFT", 82), + (82, G["case"]): ("SHIFT", 21), + (82, G["isvoid"]): ("SHIFT", 24), + (82, G["false"]): ("SHIFT", 26), (82, G["id"]): ("SHIFT", 31), + (82, G["new"]): ("SHIFT", 22), + (82, G["true"]): ("SHIFT", 25), + (82, G["~"]): ("SHIFT", 27), + (82, G["string"]): ("SHIFT", 33), + (82, G["{"]): ("SHIFT", 10), + (82, G["let"]): ("SHIFT", 14), (82, G["while"]): ("SHIFT", 13), + (82, G["("]): ("SHIFT", 11), (82, G["if"]): ("SHIFT", 12), - (82, G["int"]): ("SHIFT", 34), (82, G["not"]): ("SHIFT", 30), - (82, G["("]): ("SHIFT", 11), - (82, G["let"]): ("SHIFT", 14), - (82, G["~"]): ("SHIFT", 27), - (82, G["case"]): ("SHIFT", 21), - (82, G["new"]): ("SHIFT", 22), - (82, G["{"]): ("SHIFT", 10), - (82, G["string"]): ("SHIFT", 33), - (82, G["false"]): ("SHIFT", 26), - (82, G["true"]): ("SHIFT", 25), - (82, G["isvoid"]): ("SHIFT", 24), + (82, G["int"]): ("SHIFT", 34), (83, G[";"]): ("SHIFT", 84), (83, G["error"]): ("SHIFT", 86), (84, G["id"]): ("SHIFT", 79), @@ -859,129 +859,134 @@ def __action_table(): (86, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), (87, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error case-list"]), (88, G["esac"]): ("SHIFT", 89), - (89, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G[","]): ("SHIFT", 91), + (89, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (90, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), + (90, G[","]): ("SHIFT", 91), (91, G["id"]): ("SHIFT", 15), (92, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), (93, G["in"]): ("SHIFT", 94), - (94, G["int"]): ("SHIFT", 34), - (94, G["("]): ("SHIFT", 11), - (94, G["new"]): ("SHIFT", 22), + (94, G["isvoid"]): ("SHIFT", 24), + (94, G["string"]): ("SHIFT", 33), (94, G["while"]): ("SHIFT", 13), (94, G["if"]): ("SHIFT", 12), - (94, G["isvoid"]): ("SHIFT", 24), (94, G["not"]): ("SHIFT", 30), - (94, G["let"]): ("SHIFT", 14), (94, G["id"]): ("SHIFT", 31), + (94, G["("]): ("SHIFT", 11), + (94, G["~"]): ("SHIFT", 27), (94, G["case"]): ("SHIFT", 21), - (94, G["string"]): ("SHIFT", 33), + (94, G["int"]): ("SHIFT", 34), (94, G["false"]): ("SHIFT", 26), - (94, G["~"]): ("SHIFT", 27), + (94, G["new"]): ("SHIFT", 22), (94, G["true"]): ("SHIFT", 25), + (94, G["let"]): ("SHIFT", 14), (94, G["{"]): ("SHIFT", 10), - (95, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (96, G["loop"]): ("SHIFT", 97), - (97, G["case"]): ("SHIFT", 21), - (97, G["int"]): ("SHIFT", 34), - (97, G["("]): ("SHIFT", 11), - (97, G["{"]): ("SHIFT", 10), - (97, G["id"]): ("SHIFT", 31), (97, G["new"]): ("SHIFT", 22), + (97, G["{"]): ("SHIFT", 10), + (97, G["true"]): ("SHIFT", 25), + (97, G["let"]): ("SHIFT", 14), + (97, G["while"]): ("SHIFT", 13), + (97, G["string"]): ("SHIFT", 33), (97, G["isvoid"]): ("SHIFT", 24), + (97, G["if"]): ("SHIFT", 12), (97, G["not"]): ("SHIFT", 30), - (97, G["string"]): ("SHIFT", 33), - (97, G["false"]): ("SHIFT", 26), + (97, G["id"]): ("SHIFT", 31), + (97, G["("]): ("SHIFT", 11), (97, G["~"]): ("SHIFT", 27), - (97, G["while"]): ("SHIFT", 13), - (97, G["if"]): ("SHIFT", 12), - (97, G["let"]): ("SHIFT", 14), - (97, G["true"]): ("SHIFT", 25), + (97, G["case"]): ("SHIFT", 21), + (97, G["int"]): ("SHIFT", 34), + (97, G["false"]): ("SHIFT", 26), (98, G["pool"]): ("SHIFT", 99), - (99, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (100, G["then"]): ("SHIFT", 101), + (101, G["string"]): ("SHIFT", 33), + (101, G["isvoid"]): ("SHIFT", 24), (101, G["while"]): ("SHIFT", 13), - (101, G["int"]): ("SHIFT", 34), (101, G["if"]): ("SHIFT", 12), + (101, G["id"]): ("SHIFT", 31), (101, G["not"]): ("SHIFT", 30), (101, G["("]): ("SHIFT", 11), - (101, G["let"]): ("SHIFT", 14), + (101, G["~"]): ("SHIFT", 27), (101, G["case"]): ("SHIFT", 21), - (101, G["new"]): ("SHIFT", 22), - (101, G["isvoid"]): ("SHIFT", 24), - (101, G["{"]): ("SHIFT", 10), - (101, G["id"]): ("SHIFT", 31), - (101, G["string"]): ("SHIFT", 33), + (101, G["int"]): ("SHIFT", 34), (101, G["false"]): ("SHIFT", 26), - (101, G["~"]): ("SHIFT", 27), + (101, G["new"]): ("SHIFT", 22), (101, G["true"]): ("SHIFT", 25), + (101, G["{"]): ("SHIFT", 10), + (101, G["let"]): ("SHIFT", 14), (102, G["else"]): ("SHIFT", 103), + (103, G["new"]): ("SHIFT", 22), + (103, G["true"]): ("SHIFT", 25), + (103, G["let"]): ("SHIFT", 14), + (103, G["{"]): ("SHIFT", 10), + (103, G["string"]): ("SHIFT", 33), + (103, G["isvoid"]): ("SHIFT", 24), (103, G["while"]): ("SHIFT", 13), + (103, G["id"]): ("SHIFT", 31), (103, G["if"]): ("SHIFT", 12), (103, G["not"]): ("SHIFT", 30), - (103, G["string"]): ("SHIFT", 33), - (103, G["false"]): ("SHIFT", 26), + (103, G["("]): ("SHIFT", 11), (103, G["~"]): ("SHIFT", 27), - (103, G["let"]): ("SHIFT", 14), - (103, G["case"]): ("SHIFT", 21), - (103, G["id"]): ("SHIFT", 31), - (103, G["true"]): ("SHIFT", 25), (103, G["int"]): ("SHIFT", 34), - (103, G["("]): ("SHIFT", 11), - (103, G["{"]): ("SHIFT", 10), - (103, G["new"]): ("SHIFT", 22), - (103, G["isvoid"]): ("SHIFT", 24), + (103, G["case"]): ("SHIFT", 21), + (103, G["false"]): ("SHIFT", 26), (104, G["fi"]): ("SHIFT", 105), - (105, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (106, G[")"]): ("SHIFT", 107), + (107, G["-"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["in"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["*"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["}"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["/"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["error"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["of"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["<"]): ("REDUCE", G["atom -> ( expr )"]), (107, G[")"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["/"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["then"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["<="]): ("REDUCE", G["atom -> ( expr )"]), (107, G["."]): ("REDUCE", G["atom -> ( expr )"]), @@ -994,59 +999,54 @@ def __action_table(): (107, G["@"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["+"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["-"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["in"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["*"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["error"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["}"]): ("REDUCE", G["atom -> ( expr )"]), (108, G["}"]): ("SHIFT", 109), - (109, G[";"]): ("REDUCE", G["expr -> { block }"]), - (109, G["of"]): ("REDUCE", G["expr -> { block }"]), - (109, G["loop"]): ("REDUCE", G["expr -> { block }"]), - (109, G[")"]): ("REDUCE", G["expr -> { block }"]), - (109, G["pool"]): ("REDUCE", G["expr -> { block }"]), - (109, G["then"]): ("REDUCE", G["expr -> { block }"]), (109, G["else"]): ("REDUCE", G["expr -> { block }"]), - (109, G[","]): ("REDUCE", G["expr -> { block }"]), (109, G["in"]): ("REDUCE", G["expr -> { block }"]), + (109, G[","]): ("REDUCE", G["expr -> { block }"]), (109, G["fi"]): ("REDUCE", G["expr -> { block }"]), - (109, G["error"]): ("REDUCE", G["expr -> { block }"]), (109, G["}"]): ("REDUCE", G["expr -> { block }"]), - (110, G["error"]): ("SHIFT", 113), + (109, G["error"]): ("REDUCE", G["expr -> { block }"]), + (109, G[";"]): ("REDUCE", G["expr -> { block }"]), + (109, G["loop"]): ("REDUCE", G["expr -> { block }"]), + (109, G["of"]): ("REDUCE", G["expr -> { block }"]), + (109, G[")"]): ("REDUCE", G["expr -> { block }"]), + (109, G["then"]): ("REDUCE", G["expr -> { block }"]), + (109, G["pool"]): ("REDUCE", G["expr -> { block }"]), (110, G[";"]): ("SHIFT", 111), + (110, G["error"]): ("SHIFT", 113), + (111, G["case"]): ("SHIFT", 21), + (111, G["isvoid"]): ("SHIFT", 24), + (111, G["false"]): ("SHIFT", 26), (111, G["id"]): ("SHIFT", 31), + (111, G["new"]): ("SHIFT", 22), + (111, G["true"]): ("SHIFT", 25), + (111, G["~"]): ("SHIFT", 27), + (111, G["string"]): ("SHIFT", 33), + (111, G["{"]): ("SHIFT", 10), + (111, G["let"]): ("SHIFT", 14), (111, G["while"]): ("SHIFT", 13), - (111, G["if"]): ("SHIFT", 12), - (111, G["int"]): ("SHIFT", 34), (111, G["}"]): ("REDUCE", G["block -> expr ;"]), - (111, G["not"]): ("SHIFT", 30), (111, G["("]): ("SHIFT", 11), - (111, G["let"]): ("SHIFT", 14), - (111, G["~"]): ("SHIFT", 27), - (111, G["case"]): ("SHIFT", 21), - (111, G["new"]): ("SHIFT", 22), - (111, G["{"]): ("SHIFT", 10), - (111, G["string"]): ("SHIFT", 33), - (111, G["false"]): ("SHIFT", 26), - (111, G["true"]): ("SHIFT", 25), - (111, G["isvoid"]): ("SHIFT", 24), + (111, G["if"]): ("SHIFT", 12), + (111, G["not"]): ("SHIFT", 30), + (111, G["int"]): ("SHIFT", 34), (112, G["}"]): ("REDUCE", G["block -> expr ; block"]), - (113, G["id"]): ("SHIFT", 31), - (113, G["while"]): ("SHIFT", 13), - (113, G["if"]): ("SHIFT", 12), - (113, G["int"]): ("SHIFT", 34), (113, G["}"]): ("REDUCE", G["block -> expr error"]), - (113, G["not"]): ("SHIFT", 30), - (113, G["("]): ("SHIFT", 11), - (113, G["let"]): ("SHIFT", 14), - (113, G["~"]): ("SHIFT", 27), (113, G["case"]): ("SHIFT", 21), - (113, G["new"]): ("SHIFT", 22), - (113, G["{"]): ("SHIFT", 10), - (113, G["string"]): ("SHIFT", 33), + (113, G["isvoid"]): ("SHIFT", 24), (113, G["false"]): ("SHIFT", 26), + (113, G["id"]): ("SHIFT", 31), + (113, G["new"]): ("SHIFT", 22), (113, G["true"]): ("SHIFT", 25), - (113, G["isvoid"]): ("SHIFT", 24), + (113, G["~"]): ("SHIFT", 27), + (113, G["string"]): ("SHIFT", 33), + (113, G["{"]): ("SHIFT", 10), + (113, G["let"]): ("SHIFT", 14), + (113, G["while"]): ("SHIFT", 13), + (113, G["("]): ("SHIFT", 11), + (113, G["if"]): ("SHIFT", 12), + (113, G["not"]): ("SHIFT", 30), + (113, G["int"]): ("SHIFT", 34), (114, G["}"]): ("REDUCE", G["block -> expr error block"]), (115, G["}"]): ("SHIFT", 116), (116, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), @@ -1061,57 +1061,57 @@ def __action_table(): (123, G[":"]): ("SHIFT", 124), (124, G["type"]): ("SHIFT", 125), (125, G["{"]): ("SHIFT", 126), - (126, G["{"]): ("SHIFT", 10), - (126, G["id"]): ("SHIFT", 31), - (126, G["isvoid"]): ("SHIFT", 24), - (126, G["string"]): ("SHIFT", 33), + (126, G["~"]): ("SHIFT", 27), (126, G["false"]): ("SHIFT", 26), + (126, G["id"]): ("SHIFT", 31), + (126, G["new"]): ("SHIFT", 22), (126, G["true"]): ("SHIFT", 25), + (126, G["let"]): ("SHIFT", 14), + (126, G["{"]): ("SHIFT", 10), + (126, G["string"]): ("SHIFT", 33), (126, G["while"]): ("SHIFT", 13), + (126, G["isvoid"]): ("SHIFT", 24), + (126, G["("]): ("SHIFT", 11), (126, G["if"]): ("SHIFT", 12), (126, G["not"]): ("SHIFT", 30), - (126, G["~"]): ("SHIFT", 27), (126, G["int"]): ("SHIFT", 34), - (126, G["let"]): ("SHIFT", 14), (126, G["case"]): ("SHIFT", 21), - (126, G["("]): ("SHIFT", 11), - (126, G["new"]): ("SHIFT", 22), (127, G["}"]): ("SHIFT", 128), (128, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (128, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (129, G["type"]): ("SHIFT", 130), - (130, G["<-"]): ("SHIFT", 131), (130, G[";"]): ("REDUCE", G["attribute -> id : type"]), (130, G["error"]): ("REDUCE", G["attribute -> id : type"]), + (130, G["<-"]): ("SHIFT", 131), + (131, G["case"]): ("SHIFT", 21), + (131, G["false"]): ("SHIFT", 26), + (131, G["isvoid"]): ("SHIFT", 24), (131, G["id"]): ("SHIFT", 31), + (131, G["new"]): ("SHIFT", 22), + (131, G["true"]): ("SHIFT", 25), + (131, G["~"]): ("SHIFT", 27), + (131, G["string"]): ("SHIFT", 33), + (131, G["{"]): ("SHIFT", 10), + (131, G["let"]): ("SHIFT", 14), (131, G["while"]): ("SHIFT", 13), + (131, G["("]): ("SHIFT", 11), (131, G["if"]): ("SHIFT", 12), - (131, G["int"]): ("SHIFT", 34), (131, G["not"]): ("SHIFT", 30), - (131, G["("]): ("SHIFT", 11), - (131, G["let"]): ("SHIFT", 14), - (131, G["~"]): ("SHIFT", 27), - (131, G["case"]): ("SHIFT", 21), - (131, G["new"]): ("SHIFT", 22), - (131, G["{"]): ("SHIFT", 10), - (131, G["string"]): ("SHIFT", 33), - (131, G["false"]): ("SHIFT", 26), - (131, G["true"]): ("SHIFT", 25), - (131, G["isvoid"]): ("SHIFT", 24), + (131, G["int"]): ("SHIFT", 34), (132, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), (132, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), (133, G["}"]): ("SHIFT", 134), (134, G["class"]): ("REDUCE", G["class-def -> class type { feature-list }"]), (134, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), - (135, G["error"]): ("SHIFT", 143), (135, G[";"]): ("SHIFT", 136), - (136, G["id"]): ("SHIFT", 4), + (135, G["error"]): ("SHIFT", 143), (136, G["}"]): ("REDUCE", G["feature-list -> e"]), + (136, G["id"]): ("SHIFT", 4), (137, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), (138, G[";"]): ("SHIFT", 139), (138, G["error"]): ("SHIFT", 141), - (139, G["id"]): ("SHIFT", 4), (139, G["}"]): ("REDUCE", G["feature-list -> e"]), + (139, G["id"]): ("SHIFT", 4), (140, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), (141, G["id"]): ("SHIFT", 4), (141, G["}"]): ("REDUCE", G["feature-list -> e"]), @@ -1121,8 +1121,8 @@ def __action_table(): (144, G["}"]): ("REDUCE", G["feature-list -> attribute error feature-list"]), (145, G["type"]): ("SHIFT", 146), (146, G["{"]): ("SHIFT", 147), - (147, G["id"]): ("SHIFT", 4), (147, G["}"]): ("REDUCE", G["feature-list -> e"]), + (147, G["id"]): ("SHIFT", 4), (148, G["}"]): ("SHIFT", 149), (149, G["class"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), (149, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), @@ -1136,234 +1136,234 @@ def __action_table(): @staticmethod def __goto_table(): return { - (0, G["program"]): 150, - (0, G["class-list"]): 151, (0, G["class-def"]): 152, + (0, G["class-list"]): 151, + (0, G["program"]): 150, (3, G["method"]): 138, - (3, G["attribute"]): 135, (3, G["feature-list"]): 133, + (3, G["attribute"]): 135, (5, G["param-list"]): 122, (9, G["arith"]): 38, + (9, G["function-call"]): 35, (9, G["expr"]): 115, - (9, G["comp"]): 37, - (9, G["term"]): 53, (9, G["atom"]): 43, - (9, G["function-call"]): 35, + (9, G["term"]): 53, (9, G["factor"]): 56, - (10, G["term"]): 53, + (9, G["comp"]): 37, (10, G["expr"]): 110, - (10, G["function-call"]): 35, + (10, G["factor"]): 56, (10, G["arith"]): 38, + (10, G["function-call"]): 35, (10, G["atom"]): 43, - (10, G["factor"]): 56, + (10, G["term"]): 53, (10, G["block"]): 108, (10, G["comp"]): 37, - (11, G["term"]): 53, (11, G["arith"]): 38, - (11, G["atom"]): 43, - (11, G["function-call"]): 35, - (11, G["comp"]): 37, (11, G["expr"]): 106, (11, G["factor"]): 56, - (12, G["expr"]): 100, + (11, G["comp"]): 37, + (11, G["atom"]): 43, + (11, G["function-call"]): 35, + (11, G["term"]): 53, + (12, G["function-call"]): 35, (12, G["arith"]): 38, + (12, G["factor"]): 56, (12, G["atom"]): 43, - (12, G["comp"]): 37, (12, G["term"]): 53, - (12, G["factor"]): 56, - (12, G["function-call"]): 35, - (13, G["arith"]): 38, - (13, G["term"]): 53, - (13, G["atom"]): 43, + (12, G["expr"]): 100, + (12, G["comp"]): 37, (13, G["function-call"]): 35, + (13, G["atom"]): 43, + (13, G["arith"]): 38, (13, G["factor"]): 56, + (13, G["term"]): 53, (13, G["expr"]): 96, (13, G["comp"]): 37, (14, G["declaration-list"]): 93, (18, G["declaration-list"]): 19, - (20, G["arith"]): 38, - (20, G["comp"]): 37, - (20, G["term"]): 53, (20, G["atom"]): 43, + (20, G["arith"]): 38, (20, G["expr"]): 90, + (20, G["term"]): 53, (20, G["function-call"]): 35, + (20, G["comp"]): 37, (20, G["factor"]): 56, - (21, G["expr"]): 77, (21, G["arith"]): 38, - (21, G["atom"]): 43, - (21, G["function-call"]): 35, (21, G["term"]): 53, - (21, G["factor"]): 56, (21, G["comp"]): 37, + (21, G["atom"]): 43, + (21, G["factor"]): 56, + (21, G["function-call"]): 35, + (21, G["expr"]): 77, (24, G["atom"]): 43, - (24, G["factor"]): 76, (24, G["function-call"]): 35, + (24, G["factor"]): 76, (27, G["atom"]): 43, - (27, G["factor"]): 75, (27, G["function-call"]): 35, - (29, G["factor"]): 56, + (27, G["factor"]): 75, (29, G["arith"]): 38, (29, G["atom"]): 43, - (29, G["expr"]): 50, - (29, G["not-empty-expr-list"]): 49, + (29, G["comp"]): 37, (29, G["term"]): 53, (29, G["expr-list"]): 73, - (29, G["comp"]): 37, + (29, G["expr"]): 50, + (29, G["not-empty-expr-list"]): 49, (29, G["function-call"]): 35, + (29, G["factor"]): 56, (30, G["arith"]): 38, - (30, G["atom"]): 43, - (30, G["comp"]): 37, - (30, G["term"]): 53, (30, G["factor"]): 56, - (30, G["function-call"]): 35, + (30, G["term"]): 53, + (30, G["comp"]): 37, + (30, G["atom"]): 43, (30, G["expr"]): 72, + (30, G["function-call"]): 35, (32, G["arith"]): 38, - (32, G["expr"]): 36, - (32, G["atom"]): 43, - (32, G["comp"]): 37, - (32, G["term"]): 53, (32, G["factor"]): 56, + (32, G["term"]): 53, + (32, G["comp"]): 37, + (32, G["atom"]): 43, (32, G["function-call"]): 35, + (32, G["expr"]): 36, + (39, G["factor"]): 56, (39, G["term"]): 40, (39, G["atom"]): 43, - (39, G["factor"]): 56, (39, G["function-call"]): 35, (41, G["atom"]): 43, (41, G["function-call"]): 35, (41, G["factor"]): 42, - (46, G["factor"]): 56, (46, G["arith"]): 38, (46, G["atom"]): 43, - (46, G["expr"]): 50, - (46, G["not-empty-expr-list"]): 49, (46, G["expr-list"]): 47, - (46, G["term"]): 53, (46, G["comp"]): 37, + (46, G["term"]): 53, + (46, G["expr"]): 50, + (46, G["not-empty-expr-list"]): 49, (46, G["function-call"]): 35, - (51, G["factor"]): 56, + (46, G["factor"]): 56, (51, G["arith"]): 38, (51, G["atom"]): 43, (51, G["not-empty-expr-list"]): 52, - (51, G["expr"]): 50, - (51, G["term"]): 53, (51, G["comp"]): 37, + (51, G["term"]): 53, + (51, G["expr"]): 50, (51, G["function-call"]): 35, + (51, G["factor"]): 56, (54, G["atom"]): 43, - (54, G["factor"]): 55, (54, G["function-call"]): 35, - (61, G["factor"]): 56, + (54, G["factor"]): 55, (61, G["arith"]): 38, - (61, G["expr-list"]): 62, (61, G["atom"]): 43, + (61, G["comp"]): 37, + (61, G["term"]): 53, (61, G["expr"]): 50, (61, G["not-empty-expr-list"]): 49, - (61, G["term"]): 53, - (61, G["comp"]): 37, (61, G["function-call"]): 35, + (61, G["expr-list"]): 62, + (61, G["factor"]): 56, + (64, G["factor"]): 56, (64, G["term"]): 65, (64, G["atom"]): 43, - (64, G["factor"]): 56, (64, G["function-call"]): 35, - (66, G["atom"]): 43, (66, G["arith"]): 67, (66, G["factor"]): 56, - (66, G["function-call"]): 35, (66, G["term"]): 53, - (68, G["atom"]): 43, - (68, G["factor"]): 56, - (68, G["function-call"]): 35, + (66, G["function-call"]): 35, + (66, G["atom"]): 43, (68, G["arith"]): 69, + (68, G["factor"]): 56, (68, G["term"]): 53, - (70, G["atom"]): 43, - (70, G["factor"]): 56, - (70, G["function-call"]): 35, + (68, G["function-call"]): 35, + (68, G["atom"]): 43, (70, G["arith"]): 71, + (70, G["factor"]): 56, (70, G["term"]): 53, + (70, G["function-call"]): 35, + (70, G["atom"]): 43, (78, G["case-list"]): 88, - (82, G["term"]): 53, (82, G["expr"]): 83, - (82, G["function-call"]): 35, + (82, G["factor"]): 56, (82, G["arith"]): 38, + (82, G["function-call"]): 35, (82, G["atom"]): 43, - (82, G["factor"]): 56, + (82, G["term"]): 53, (82, G["comp"]): 37, (84, G["case-list"]): 85, (86, G["case-list"]): 87, (91, G["declaration-list"]): 92, (94, G["arith"]): 38, - (94, G["expr"]): 95, - (94, G["atom"]): 43, - (94, G["comp"]): 37, - (94, G["term"]): 53, (94, G["factor"]): 56, + (94, G["term"]): 53, + (94, G["comp"]): 37, + (94, G["atom"]): 43, + (94, G["expr"]): 95, (94, G["function-call"]): 35, - (97, G["function-call"]): 35, - (97, G["arith"]): 38, (97, G["term"]): 53, + (97, G["function-call"]): 35, (97, G["atom"]): 43, + (97, G["arith"]): 38, (97, G["factor"]): 56, (97, G["comp"]): 37, (97, G["expr"]): 98, (101, G["arith"]): 38, - (101, G["expr"]): 102, + (101, G["factor"]): 56, + (101, G["comp"]): 37, (101, G["atom"]): 43, (101, G["term"]): 53, - (101, G["comp"]): 37, - (101, G["factor"]): 56, (101, G["function-call"]): 35, + (101, G["expr"]): 102, (103, G["term"]): 53, + (103, G["function-call"]): 35, (103, G["arith"]): 38, - (103, G["expr"]): 104, (103, G["atom"]): 43, (103, G["factor"]): 56, - (103, G["function-call"]): 35, (103, G["comp"]): 37, - (111, G["term"]): 53, - (111, G["block"]): 112, + (103, G["expr"]): 104, (111, G["expr"]): 110, - (111, G["function-call"]): 35, + (111, G["factor"]): 56, (111, G["arith"]): 38, + (111, G["function-call"]): 35, (111, G["atom"]): 43, - (111, G["factor"]): 56, + (111, G["term"]): 53, (111, G["comp"]): 37, - (113, G["term"]): 53, + (111, G["block"]): 112, (113, G["expr"]): 110, - (113, G["function-call"]): 35, + (113, G["factor"]): 56, (113, G["arith"]): 38, + (113, G["function-call"]): 35, (113, G["atom"]): 43, - (113, G["factor"]): 56, (113, G["block"]): 114, + (113, G["term"]): 53, (113, G["comp"]): 37, (120, G["param-list"]): 121, (126, G["arith"]): 38, - (126, G["comp"]): 37, - (126, G["expr"]): 127, - (126, G["term"]): 53, - (126, G["atom"]): 43, (126, G["function-call"]): 35, + (126, G["atom"]): 43, + (126, G["term"]): 53, (126, G["factor"]): 56, - (131, G["term"]): 53, - (131, G["function-call"]): 35, + (126, G["comp"]): 37, + (126, G["expr"]): 127, + (131, G["factor"]): 56, (131, G["arith"]): 38, (131, G["expr"]): 132, + (131, G["function-call"]): 35, (131, G["atom"]): 43, - (131, G["factor"]): 56, + (131, G["term"]): 53, (131, G["comp"]): 37, + (136, G["feature-list"]): 137, (136, G["method"]): 138, (136, G["attribute"]): 135, - (136, G["feature-list"]): 137, (139, G["method"]): 138, - (139, G["feature-list"]): 140, (139, G["attribute"]): 135, + (139, G["feature-list"]): 140, (141, G["method"]): 138, - (141, G["feature-list"]): 142, (141, G["attribute"]): 135, + (141, G["feature-list"]): 142, (143, G["method"]): 138, (143, G["feature-list"]): 144, (143, G["attribute"]): 135, - (147, G["method"]): 138, (147, G["feature-list"]): 148, + (147, G["method"]): 138, (147, G["attribute"]): 135, - (152, G["class-list"]): 153, (152, G["class-def"]): 152, + (152, G["class-list"]): 153, } diff --git a/requirements.txt b/requirements.txt index a59742791..f5a582276 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -pyjapt~=0.1.7 +pyjapt~=0.2.6 typer~=0.3.2 \ No newline at end of file diff --git a/tests/programs_for_execution/01_program.cl b/tests/correct_programs/01_program.cl similarity index 100% rename from tests/programs_for_execution/01_program.cl rename to tests/correct_programs/01_program.cl diff --git a/tests/programs_for_execution/02_program.cl b/tests/correct_programs/02_program.cl similarity index 100% rename from tests/programs_for_execution/02_program.cl rename to tests/correct_programs/02_program.cl diff --git a/tests/programs_for_execution/03_program.cl b/tests/correct_programs/03_program.cl similarity index 100% rename from tests/programs_for_execution/03_program.cl rename to tests/correct_programs/03_program.cl diff --git a/tests/programs_for_execution/04_program.cl b/tests/correct_programs/04_program.cl similarity index 100% rename from tests/programs_for_execution/04_program.cl rename to tests/correct_programs/04_program.cl diff --git a/tests/programs_for_execution/05_program.cl b/tests/correct_programs/05_program.cl similarity index 100% rename from tests/programs_for_execution/05_program.cl rename to tests/correct_programs/05_program.cl diff --git a/tests/programs_for_execution/06_program.cl b/tests/correct_programs/06_program.cl similarity index 100% rename from tests/programs_for_execution/06_program.cl rename to tests/correct_programs/06_program.cl diff --git a/tests/inference/01_result.cl b/tests/inference/01_result.txt similarity index 100% rename from tests/inference/01_result.cl rename to tests/inference/01_result.txt diff --git a/tests/inference/02_result.cl b/tests/inference/02_result.txt similarity index 100% rename from tests/inference/02_result.cl rename to tests/inference/02_result.txt diff --git a/tests/inference/03_result.cl b/tests/inference/03_result.txt similarity index 100% rename from tests/inference/03_result.cl rename to tests/inference/03_result.txt diff --git a/tests/inference/04_result.cl b/tests/inference/04_result.txt similarity index 100% rename from tests/inference/04_result.cl rename to tests/inference/04_result.txt diff --git a/tests/inference/05_result.cl b/tests/inference/05_result.txt similarity index 100% rename from tests/inference/05_result.cl rename to tests/inference/05_result.txt diff --git a/tests/inference/06_result.cl b/tests/inference/06_result.txt similarity index 100% rename from tests/inference/06_result.cl rename to tests/inference/06_result.txt diff --git a/tests/inference/07_result.cl b/tests/inference/07_result.txt similarity index 100% rename from tests/inference/07_result.cl rename to tests/inference/07_result.txt diff --git a/tests/inference/08_result.cl b/tests/inference/08_result.txt similarity index 100% rename from tests/inference/08_result.cl rename to tests/inference/08_result.txt diff --git a/tests/lexicographic_errors/comment1.cl b/tests/lexicographic_errors/comment1.cl new file mode 100644 index 000000000..c2bb9938c --- /dev/null +++ b/tests/lexicographic_errors/comment1.cl @@ -0,0 +1,55 @@ +--Any characters between two dashes "--" and the next newline +--(or EOF, if there is no next newline) are treated as comments + +(*(*(* +Comments may also be written by enclosing +text in (∗ . . . ∗). The latter form of comment may be nested. +Comments cannot cross file boundaries. +*)*)*) + +class Error() { + + (* There was once a comment, + that was quite long. + But, the reader soon discovered that + the comment was indeed longer than + previously assumed. Now, the reader + was in a real dilemma; is the comment + ever gonna end? If I stop reading, will + it end? + He started imagining all sorts of things. + He thought about heisenberg's cat and how + how that relates to the end of the sentence. + He thought to himself "I'm gonna stop reading". + "If I keep reading this comment, I'm gonna know + the fate of this sentence; That will be disastorous." + He knew that such a comment was gonna extend to + another file. It was too awesome to be contained in + a single file. And he would have kept reading too... + if only... + cool wasn't a super-duper-fab-awesomest language; + but cool is that language; + "This comment shall go not cross this file" said cool. + Alas! The reader could read no more. + There was once a comment, + that was quite long. + But, the reader soon discovered that + the comment was indeed longer than + previously assumed. Now, the reader + was in a real dilemma; is the comment + ever gonna end? If I stop reading, will + it end? + He started imagining all sorts of things. + He thought about heisenberg's cat and how + how that relates to the end of the sentence. + He thought to himself "I'm gonna stop reading". + "If I keep reading this comment, I'm gonna know + the fate of this sentence; That will be disastorous." + He knew that such a comment was gonna extend to + another file. It was too awesome to be contained in + a single file. And he would have kept reading too... + if only... + cool wasn't a super-duper-fab-awesomest language; + but cool is that language; + "This comment shall go not cross this file" said cool. + Alas! The reader could read no more. \ No newline at end of file diff --git a/tests/lexicographic_errors/comment1_error.txt b/tests/lexicographic_errors/comment1_error.txt new file mode 100644 index 000000000..0207a66d5 --- /dev/null +++ b/tests/lexicographic_errors/comment1_error.txt @@ -0,0 +1 @@ +(55, 46) - LexicographicError: EOF in comment \ No newline at end of file diff --git a/tests/lexicographic_errors/iis1.cl b/tests/lexicographic_errors/iis1.cl new file mode 100644 index 000000000..12cb52beb --- /dev/null +++ b/tests/lexicographic_errors/iis1.cl @@ -0,0 +1,111 @@ +(* Integers, Identifiers, and Special Notation *) + +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ +5! = 120, 2 + 2 = 5 or E = mc2; p + 1 @ p = 1: for x in range(len(b)) +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) +class Class if then else fi testing Testing ~007agent_bond james_007B0N3SS___ +loop pool while tRuE or noT faLsE let in case of ESAC + +(* +#3 INT_CONST 0007 +#3 INT_CONST 123 +#3 '+' +#3 INT_CONST 1 +#3 '-' +#3 INT_CONST 1 +#3 '+' +#3 INT_CONST 90 +#3 '-' +#3 INT_CONST 09 +#3 '+' +#3 INT_CONST 11113 +#3 '-' +#3 INT_CONST 4 +#3 OBJECTID r +#3 '*' +#3 OBJECTID a +#3 '*' +#3 OBJECTID self +#3 '*' +#3 OBJECTID c +#3 '+' +#3 '+' +#4 INT_CONST 5 +#4 ERROR "!" +#4 '=' +#4 INT_CONST 120 +#4 ',' +#4 INT_CONST 2 +#4 '+' +#4 INT_CONST 2 +#4 '=' +#4 INT_CONST 5 +#4 OBJECTID or +#4 TYPEID E +#4 '=' +#4 OBJECTID mc2 +#4 ';' +#4 OBJECTID p +#4 '+' +#4 INT_CONST 1 +#4 '@' +#4 OBJECTID p +#4 '=' +#4 INT_CONST 1 +#4 ':' +#4 OBJECTID for +#4 OBJECTID x +#4 IN +#4 OBJECTID range +#4 '(' +#4 OBJECTID len +#4 '(' +#4 OBJECTID b +#4 ')' +#4 ')' +#5 NEW +#5 '/' +#5 ASSIGN +#5 '<' +#5 LE +#5 DARROW +#5 '{' +#5 '(' +#5 TYPEID Int +#5 ':' +#5 TYPEID Objet +#5 ',' +#5 TYPEID Bool +#5 ';' +#5 TYPEID String +#5 '.' +#5 OBJECTID string +#5 TYPEID SELF_TYPE +#5 ISVOID +#5 '}' +#5 ')' +#6 CLASS +#6 CLASS +#6 IF +#6 THEN +#6 ELSE +#6 FI +#6 OBJECTID testing +#6 TYPEID Testing +#6 '~' +#6 INT_CONST 007 +#6 OBJECTID agent_bond +#6 OBJECTID james_007B0N3SS___ +#7 LOOP +#7 POOL +#7 WHILE +#7 BOOL_CONST true +#7 OBJECTID or +#7 NOT +#7 BOOL_CONST false +#7 LET +#7 IN +#7 CASE +#7 OF +#7 ESAC +*) \ No newline at end of file diff --git a/tests/lexicographic_errors/iis1_error.txt b/tests/lexicographic_errors/iis1_error.txt new file mode 100644 index 000000000..a1d71cc56 --- /dev/null +++ b/tests/lexicographic_errors/iis1_error.txt @@ -0,0 +1 @@ +(4, 2) - LexicographicError: ERROR "!" \ No newline at end of file diff --git a/tests/lexicographic_errors/iis2.cl b/tests/lexicographic_errors/iis2.cl new file mode 100644 index 000000000..9b25715d4 --- /dev/null +++ b/tests/lexicographic_errors/iis2.cl @@ -0,0 +1,120 @@ +(* Integers, Identifiers, and Special Notation *) + +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ +class Class if then else fi testing Testing ~007agent_bond james_007bones___ + + +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) +loop pool while tRuE or noT faLsE let in case of ESAC + +factorial(5) = 120, 2 + 2 = 5? or E = mc2; p + 1 resto p = 1: (@ for x in range(len(b))) + +(* +#3 INT_CONST 0007 +#3 INT_CONST 123 +#3 '+' +#3 INT_CONST 1 +#3 '-' +#3 INT_CONST 1 +#3 '+' +#3 INT_CONST 90 +#3 '-' +#3 INT_CONST 09 +#3 '+' +#3 INT_CONST 11113 +#3 '-' +#3 INT_CONST 4 +#3 OBJECTID r +#3 '*' +#3 OBJECTID a +#3 '*' +#3 OBJECTID self +#3 '*' +#3 OBJECTID c +#3 '+' +#3 '+' +#4 CLASS +#4 CLASS +#4 IF +#4 THEN +#4 ELSE +#4 FI +#4 OBJECTID testing +#4 TYPEID Testing +#4 '~' +#4 INT_CONST 007 +#4 OBJECTID agent_bond +#4 OBJECTID james_007bones___ +#7 NEW +#7 '/' +#7 ASSIGN +#7 '<' +#7 LE +#7 DARROW +#7 '{' +#7 '(' +#7 TYPEID Int +#7 ':' +#7 TYPEID Objet +#7 ',' +#7 TYPEID Bool +#7 ';' +#7 TYPEID String +#7 '.' +#7 OBJECTID string +#7 TYPEID SELF_TYPE +#7 ISVOID +#7 '}' +#7 ')' +#8 LOOP +#8 POOL +#8 WHILE +#8 BOOL_CONST true +#8 OBJECTID or +#8 NOT +#8 BOOL_CONST false +#8 LET +#8 IN +#8 CASE +#8 OF +#8 ESAC +#10 OBJECTID factorial +#10 '(' +#10 INT_CONST 5 +#10 ')' +#10 '=' +#10 INT_CONST 120 +#10 ',' +#10 INT_CONST 2 +#10 '+' +#10 INT_CONST 2 +#10 '=' +#10 INT_CONST 5 +#10 ERROR "?" +#10 OBJECTID or +#10 TYPEID E +#10 '=' +#10 OBJECTID mc2 +#10 ';' +#10 OBJECTID p +#10 '+' +#10 INT_CONST 1 +#10 OBJECTID resto +#10 OBJECTID p +#10 '=' +#10 INT_CONST 1 +#10 ':' +#10 '(' +#10 '@' +#10 OBJECTID for +#10 OBJECTID x +#10 IN +#10 OBJECTID range +#10 '(' +#10 OBJECTID len +#10 '(' +#10 OBJECTID b +#10 ')' +#10 ')' +#10 ')' +*) \ No newline at end of file diff --git a/tests/lexicographic_errors/iis2_error.txt b/tests/lexicographic_errors/iis2_error.txt new file mode 100644 index 000000000..f805d48c4 --- /dev/null +++ b/tests/lexicographic_errors/iis2_error.txt @@ -0,0 +1 @@ +(10, 30) - LexicographicError: ERROR "?" \ No newline at end of file diff --git a/tests/lexicographic_errors/iis3.cl b/tests/lexicographic_errors/iis3.cl new file mode 100644 index 000000000..0b965ddea --- /dev/null +++ b/tests/lexicographic_errors/iis3.cl @@ -0,0 +1,121 @@ +(* Integers, Identifiers, and Special Notation *) + +factorial(5) = 120, 2 + 2 = 5 or E = mc^2; p + 1 @ p = 1: z for x in range(len(b))) + +loop pool while tRuE or noT faLsE let in case of ESAC + +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) + + +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ +class Class if then else fi testing Testing ~007agent_bond james_007bones___ + +(* +#3 OBJECTID factorial +#3 '(' +#3 INT_CONST 5 +#3 ')' +#3 '=' +#3 INT_CONST 120 +#3 ',' +#3 INT_CONST 2 +#3 '+' +#3 INT_CONST 2 +#3 '=' +#3 INT_CONST 5 +#3 OBJECTID or +#3 TYPEID E +#3 '=' +#3 OBJECTID mc +#3 ERROR "^" +#3 INT_CONST 2 +#3 ';' +#3 OBJECTID p +#3 '+' +#3 INT_CONST 1 +#3 '@' +#3 OBJECTID p +#3 '=' +#3 INT_CONST 1 +#3 ':' +#3 OBJECTID z +#3 OBJECTID for +#3 OBJECTID x +#3 IN +#3 OBJECTID range +#3 '(' +#3 OBJECTID len +#3 '(' +#3 OBJECTID b +#3 ')' +#3 ')' +#3 ')' +#5 LOOP +#5 POOL +#5 WHILE +#5 BOOL_CONST true +#5 OBJECTID or +#5 NOT +#5 BOOL_CONST false +#5 LET +#5 IN +#5 CASE +#5 OF +#5 ESAC +#7 NEW +#7 '/' +#7 ASSIGN +#7 '<' +#7 LE +#7 DARROW +#7 '{' +#7 '(' +#7 TYPEID Int +#7 ':' +#7 TYPEID Objet +#7 ',' +#7 TYPEID Bool +#7 ';' +#7 TYPEID String +#7 '.' +#7 OBJECTID string +#7 TYPEID SELF_TYPE +#7 ISVOID +#7 '}' +#7 ')' +#10 INT_CONST 0007 +#10 INT_CONST 123 +#10 '+' +#10 INT_CONST 1 +#10 '-' +#10 INT_CONST 1 +#10 '+' +#10 INT_CONST 90 +#10 '-' +#10 INT_CONST 09 +#10 '+' +#10 INT_CONST 11113 +#10 '-' +#10 INT_CONST 4 +#10 OBJECTID r +#10 '*' +#10 OBJECTID a +#10 '*' +#10 OBJECTID self +#10 '*' +#10 OBJECTID c +#10 '+' +#10 '+' +#11 CLASS +#11 CLASS +#11 IF +#11 THEN +#11 ELSE +#11 FI +#11 OBJECTID testing +#11 TYPEID Testing +#11 '~' +#11 INT_CONST 007 +#11 OBJECTID agent_bond +#11 OBJECTID james_007bones___ +*) \ No newline at end of file diff --git a/tests/lexicographic_errors/iis3_error.txt b/tests/lexicographic_errors/iis3_error.txt new file mode 100644 index 000000000..5afcabe9a --- /dev/null +++ b/tests/lexicographic_errors/iis3_error.txt @@ -0,0 +1 @@ +(3, 40) - LexicographicError: ERROR "^" \ No newline at end of file diff --git a/tests/lexicographic_errors/iis4.cl b/tests/lexicographic_errors/iis4.cl new file mode 100644 index 000000000..9e7a9cb62 --- /dev/null +++ b/tests/lexicographic_errors/iis4.cl @@ -0,0 +1,120 @@ +(* Integers, Identifiers, and Special Notation *) + +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ + +factorial(5) = 120, 2 + 2 = 5 or E = mc2; p + 1 % p = 1: @.@ for x in range(len(b))~ + + +loop pool while tRuE or noT faLsE let in case of ESAC +class Class if then else fi testing Testing ~007agent_bond james_007bones___ + +(* +#3 NEW +#3 '/' +#3 ASSIGN +#3 '<' +#3 LE +#3 DARROW +#3 '{' +#3 '(' +#3 TYPEID Int +#3 ':' +#3 TYPEID Objet +#3 ',' +#3 TYPEID Bool +#3 ';' +#3 TYPEID String +#3 '.' +#3 OBJECTID string +#3 TYPEID SELF_TYPE +#3 ISVOID +#3 '}' +#3 ')' +#4 INT_CONST 0007 +#4 INT_CONST 123 +#4 '+' +#4 INT_CONST 1 +#4 '-' +#4 INT_CONST 1 +#4 '+' +#4 INT_CONST 90 +#4 '-' +#4 INT_CONST 09 +#4 '+' +#4 INT_CONST 11113 +#4 '-' +#4 INT_CONST 4 +#4 OBJECTID r +#4 '*' +#4 OBJECTID a +#4 '*' +#4 OBJECTID self +#4 '*' +#4 OBJECTID c +#4 '+' +#4 '+' +#6 OBJECTID factorial +#6 '(' +#6 INT_CONST 5 +#6 ')' +#6 '=' +#6 INT_CONST 120 +#6 ',' +#6 INT_CONST 2 +#6 '+' +#6 INT_CONST 2 +#6 '=' +#6 INT_CONST 5 +#6 OBJECTID or +#6 TYPEID E +#6 '=' +#6 OBJECTID mc2 +#6 ';' +#6 OBJECTID p +#6 '+' +#6 INT_CONST 1 +#6 ERROR "%" +#6 OBJECTID p +#6 '=' +#6 INT_CONST 1 +#6 ':' +#6 '@' +#6 '.' +#6 '@' +#6 OBJECTID for +#6 OBJECTID x +#6 IN +#6 OBJECTID range +#6 '(' +#6 OBJECTID len +#6 '(' +#6 OBJECTID b +#6 ')' +#6 ')' +#6 '~' +#9 LOOP +#9 POOL +#9 WHILE +#9 BOOL_CONST true +#9 OBJECTID or +#9 NOT +#9 BOOL_CONST false +#9 LET +#9 IN +#9 CASE +#9 OF +#9 ESAC +#10 CLASS +#10 CLASS +#10 IF +#10 THEN +#10 ELSE +#10 FI +#10 OBJECTID testing +#10 TYPEID Testing +#10 '~' +#10 INT_CONST 007 +#10 OBJECTID agent_bond +#10 OBJECTID james_007bones___ +*) \ No newline at end of file diff --git a/tests/lexicographic_errors/iis4_error.txt b/tests/lexicographic_errors/iis4_error.txt new file mode 100644 index 000000000..9c401173d --- /dev/null +++ b/tests/lexicographic_errors/iis4_error.txt @@ -0,0 +1 @@ +(6, 49) - LexicographicError: ERROR "!" \ No newline at end of file diff --git a/tests/lexicographic_errors/iis5.cl b/tests/lexicographic_errors/iis5.cl new file mode 100644 index 000000000..d146c0547 --- /dev/null +++ b/tests/lexicographic_errors/iis5.cl @@ -0,0 +1,121 @@ +(* Integers, Identifiers, and Special Notation *) + + +loop pool while tRuE or noT faLsE let in case of ESAC +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) +class Class if then else fi testing Testing ~007agent_bond james_007bones___ + +factorial(5) = 120, 2 + 2 = 5 or E = mc2; p + 1 resto p = 1: [@.@ for x in range(len(b))] + +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ + +(* +#4 LOOP +#4 POOL +#4 WHILE +#4 BOOL_CONST true +#4 OBJECTID or +#4 NOT +#4 BOOL_CONST false +#4 LET +#4 IN +#4 CASE +#4 OF +#4 ESAC +#5 NEW +#5 '/' +#5 ASSIGN +#5 '<' +#5 LE +#5 DARROW +#5 '{' +#5 '(' +#5 TYPEID Int +#5 ':' +#5 TYPEID Objet +#5 ',' +#5 TYPEID Bool +#5 ';' +#5 TYPEID String +#5 '.' +#5 OBJECTID string +#5 TYPEID SELF_TYPE +#5 ISVOID +#5 '}' +#5 ')' +#6 CLASS +#6 CLASS +#6 IF +#6 THEN +#6 ELSE +#6 FI +#6 OBJECTID testing +#6 TYPEID Testing +#6 '~' +#6 INT_CONST 007 +#6 OBJECTID agent_bond +#6 OBJECTID james_007bones___ +#8 OBJECTID factorial +#8 '(' +#8 INT_CONST 5 +#8 ')' +#8 '=' +#8 INT_CONST 120 +#8 ',' +#8 INT_CONST 2 +#8 '+' +#8 INT_CONST 2 +#8 '=' +#8 INT_CONST 5 +#8 OBJECTID or +#8 TYPEID E +#8 '=' +#8 OBJECTID mc2 +#8 ';' +#8 OBJECTID p +#8 '+' +#8 INT_CONST 1 +#8 OBJECTID resto +#8 OBJECTID p +#8 '=' +#8 INT_CONST 1 +#8 ':' +#8 ERROR "[" +#8 '@' +#8 '.' +#8 '@' +#8 OBJECTID for +#8 OBJECTID x +#8 IN +#8 OBJECTID range +#8 '(' +#8 OBJECTID len +#8 '(' +#8 OBJECTID b +#8 ')' +#8 ')' +#8 ERROR "]" +#10 INT_CONST 0007 +#10 INT_CONST 123 +#10 '+' +#10 INT_CONST 1 +#10 '-' +#10 INT_CONST 1 +#10 '+' +#10 INT_CONST 90 +#10 '-' +#10 INT_CONST 09 +#10 '+' +#10 INT_CONST 11113 +#10 '-' +#10 INT_CONST 4 +#10 OBJECTID r +#10 '*' +#10 OBJECTID a +#10 '*' +#10 OBJECTID self +#10 '*' +#10 OBJECTID c +#10 '+' +#10 '+' +*) diff --git a/tests/lexicographic_errors/iis5_error.txt b/tests/lexicographic_errors/iis5_error.txt new file mode 100644 index 000000000..b3dbadcb6 --- /dev/null +++ b/tests/lexicographic_errors/iis5_error.txt @@ -0,0 +1,2 @@ +(8, 62) - LexicographicError: ERROR "[" +(8, 89) - LexicographicError: ERROR "]" diff --git a/tests/lexicographic_errors/iis6.cl b/tests/lexicographic_errors/iis6.cl new file mode 100644 index 000000000..1042f132b --- /dev/null +++ b/tests/lexicographic_errors/iis6.cl @@ -0,0 +1,125 @@ +(* Integers, Identifiers, and Special Notation *) + +factorial(5) = 120, 2 + 2 = 5 or E = mc2; p + 1 resto p = 1: {@.@ for x in range(len(b))} + +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) + + +class Class if then else fi testing Testing ~007agent_bond _james_007bones___ + + + +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ +loop pool while tRuE or noT faLsE let in case of ESAC + +(* +#3 OBJECTID factorial +#3 '(' +#3 INT_CONST 5 +#3 ')' +#3 '=' +#3 INT_CONST 120 +#3 ',' +#3 INT_CONST 2 +#3 '+' +#3 INT_CONST 2 +#3 '=' +#3 INT_CONST 5 +#3 OBJECTID or +#3 TYPEID E +#3 '=' +#3 OBJECTID mc2 +#3 ';' +#3 OBJECTID p +#3 '+' +#3 INT_CONST 1 +#3 OBJECTID resto +#3 OBJECTID p +#3 '=' +#3 INT_CONST 1 +#3 ':' +#3 '{' +#3 '@' +#3 '.' +#3 '@' +#3 OBJECTID for +#3 OBJECTID x +#3 IN +#3 OBJECTID range +#3 '(' +#3 OBJECTID len +#3 '(' +#3 OBJECTID b +#3 ')' +#3 ')' +#3 '}' +#5 NEW +#5 '/' +#5 ASSIGN +#5 '<' +#5 LE +#5 DARROW +#5 '{' +#5 '(' +#5 TYPEID Int +#5 ':' +#5 TYPEID Objet +#5 ',' +#5 TYPEID Bool +#5 ';' +#5 TYPEID String +#5 '.' +#5 OBJECTID string +#5 TYPEID SELF_TYPE +#5 ISVOID +#5 '}' +#5 ')' +#8 CLASS +#8 CLASS +#8 IF +#8 THEN +#8 ELSE +#8 FI +#8 OBJECTID testing +#8 TYPEID Testing +#8 '~' +#8 INT_CONST 007 +#8 OBJECTID agent_bond +#8 ERROR "_" +#8 OBJECTID james_007bones___ +#12 INT_CONST 0007 +#12 INT_CONST 123 +#12 '+' +#12 INT_CONST 1 +#12 '-' +#12 INT_CONST 1 +#12 '+' +#12 INT_CONST 90 +#12 '-' +#12 INT_CONST 09 +#12 '+' +#12 INT_CONST 11113 +#12 '-' +#12 INT_CONST 4 +#12 OBJECTID r +#12 '*' +#12 OBJECTID a +#12 '*' +#12 OBJECTID self +#12 '*' +#12 OBJECTID c +#12 '+' +#12 '+' +#13 LOOP +#13 POOL +#13 WHILE +#13 BOOL_CONST true +#13 OBJECTID or +#13 NOT +#13 BOOL_CONST false +#13 LET +#13 IN +#13 CASE +#13 OF +#13 ESAC +*) \ No newline at end of file diff --git a/tests/lexicographic_errors/iis6_error.txt b/tests/lexicographic_errors/iis6_error.txt new file mode 100644 index 000000000..d7fad9c79 --- /dev/null +++ b/tests/lexicographic_errors/iis6_error.txt @@ -0,0 +1 @@ +(8, 60) - LexicographicError: ERROR "_" diff --git a/tests/lexicographic_errors/mixed1.cl b/tests/lexicographic_errors/mixed1.cl new file mode 100644 index 000000000..803d58ef5 --- /dev/null +++ b/tests/lexicographic_errors/mixed1.cl @@ -0,0 +1,14 @@ +"lkjdsafkljdsalfj\u0000dsafdsaf\u0000djafslkjdsalf\nsdajf\" lkjfdsasdkjfl"123 +adsfasklj# +LKldsajf iNhERITS +"lkdsajf" + +(* +#1 STR_CONST "lkjdsafkljdsalfju0000dsafdsafu0000djafslkjdsalf\nsdajf\" lkjfdsasdkjfl" +#1 INT_CONST 123 +#2 OBJECTID adsfasklj +#2 ERROR "#" +#3 TYPEID LKldsajf +#3 INHERITS +#4 STR_CONST "lkdsajf" +*) \ No newline at end of file diff --git a/tests/lexicographic_errors/mixed1_error.txt b/tests/lexicographic_errors/mixed1_error.txt new file mode 100644 index 000000000..99af5fbdc --- /dev/null +++ b/tests/lexicographic_errors/mixed1_error.txt @@ -0,0 +1 @@ +(2, 10) - LexicographicError: ERROR "#" diff --git a/tests/lexicographic_errors/mixed2.cl b/tests/lexicographic_errors/mixed2.cl new file mode 100644 index 000000000..12039e123 --- /dev/null +++ b/tests/lexicographic_errors/mixed2.cl @@ -0,0 +1,20 @@ +"kjas\"lnnsdj\nfljrdsaf" +@.$.@ +@*%*@ +"alkjfldajf""dasfadsf + +(* +#1 STR_CONST "kjas\"lnnsdj\nfljrdsaf" +#2 '@' +#2 '.' +#2 ERROR "$" +#2 '.' +#2 '@' +#3 '@' +#3 '*' +#3 ERROR "%" +#3 '*' +#3 '@' +#4 STR_CONST "alkjfldajf" +#4 ERROR "Unterminated string constant" +*) \ No newline at end of file diff --git a/tests/lexicographic_errors/mixed2_error.txt b/tests/lexicographic_errors/mixed2_error.txt new file mode 100644 index 000000000..097dc2a07 --- /dev/null +++ b/tests/lexicographic_errors/mixed2_error.txt @@ -0,0 +1,3 @@ +(2, 3) - LexicographicError: ERROR "$" +(3, 3) - LexicographicError: ERROR "%" +(4, 22) - LexicographicError: Unterminated string constant diff --git a/tests/lexicographic_errors/string1.cl b/tests/lexicographic_errors/string1.cl new file mode 100644 index 000000000..6c3c00833 --- /dev/null +++ b/tests/lexicographic_errors/string1.cl @@ -0,0 +1,6 @@ +(* A non-escaped newline character may not appear in a string *) + +"This \ +is OK" +"This is not +OK" \ No newline at end of file diff --git a/tests/lexicographic_errors/string1_error.txt b/tests/lexicographic_errors/string1_error.txt new file mode 100644 index 000000000..078c12bbb --- /dev/null +++ b/tests/lexicographic_errors/string1_error.txt @@ -0,0 +1,2 @@ +(5, 13) - LexicographicError: Unterminated string constant +(6, 4) - LexicographicError: EOF in string constant \ No newline at end of file diff --git a/tests/lexicographic_errors/string2.cl b/tests/lexicographic_errors/string2.cl new file mode 100644 index 000000000..3704b6ae7 --- /dev/null +++ b/tests/lexicographic_errors/string2.cl @@ -0,0 +1,19 @@ +(* A string may not contain EOF *) + +" May the Triforce \ + 0 \ + 0v0 \ + 0vvv0 \ + 0vvvvv0 \ + 0vvvvvvv0 \ + 0vvvvvvvvv0 \ + 0vvvvvvvvvvv0 \ + 000000000000000 \ + 0v0 0v0 \ + 0vvv0 0vvv0 \ + 0vvvvv0 0vvvvv0 \ + 0vvvvvvv0 0vvvvvvv0 \ + 0vvvvvvvvv0 0vvvvvvvvv0 \ + 0vvvvvvvvvvv0 0vvvvvvvvvvv0 \ + 00000000000000000000000000000 \ + be with you! \ No newline at end of file diff --git a/tests/lexicographic_errors/string2_error.txt b/tests/lexicographic_errors/string2_error.txt new file mode 100644 index 000000000..7fbbcb526 --- /dev/null +++ b/tests/lexicographic_errors/string2_error.txt @@ -0,0 +1 @@ +(19, 29) - LexicographicError: EOF in string constant \ No newline at end of file diff --git a/tests/lexicographic_errors/string3.cl b/tests/lexicographic_errors/string3.cl new file mode 100644 index 0000000000000000000000000000000000000000..78abc4972e218bca373ba1750c99a3450cef4ea3 GIT binary patch literal 234 zcmX|4yAH!34D8HToS2dhRoZ?*=Jpd<90*B>0}_xSe_!a!lI8Q=*(aJadZZi|KVhQ- zK4j?NGc6u@9^rRpGmYcJ^ifl$K@ Mi{IIrdU_-I0>Lp*mH+?% literal 0 HcmV?d00001 diff --git a/tests/lexicographic_errors/string3_error.txt b/tests/lexicographic_errors/string3_error.txt new file mode 100644 index 000000000..35695d07e --- /dev/null +++ b/tests/lexicographic_errors/string3_error.txt @@ -0,0 +1 @@ +(8, 4) - LexicographicError: String contains null character \ No newline at end of file diff --git a/tests/lexicographic_errors/string4.cl b/tests/lexicographic_errors/string4.cl new file mode 100644 index 000000000..f4d39c027 --- /dev/null +++ b/tests/lexicographic_errors/string4.cl @@ -0,0 +1,38 @@ +class Main { + str <- "The big brown fox + jumped over the fence"; + main() : Object { + { + out_string("Yay! This is the newest shites ); + } + }; +}; + +(* +#1 CLASS +#1 TYPEID Main +#1 '{' +#2 OBJECTID str +#2 ASSIGN +#3 ERROR "Unterminated string constant" +#3 OBJECTID jumped +#3 OBJECTID over +#3 OBJECTID the +#3 OBJECTID fence +#4 ERROR "Unterminated string constant" +#4 OBJECTID main +#4 '(' +#4 ')' +#4 ':' +#4 TYPEID Object +#4 '{' +#5 '{' +#6 OBJECTID out_string +#6 '(' +#7 ERROR "Unterminated string constant" +#7 '}' +#8 '}' +#8 ';' +#9 '}' +#9 ';' +*) \ No newline at end of file diff --git a/tests/lexicographic_errors/string4_error.txt b/tests/lexicographic_errors/string4_error.txt new file mode 100644 index 000000000..5ab0ea847 --- /dev/null +++ b/tests/lexicographic_errors/string4_error.txt @@ -0,0 +1,3 @@ +(2, 30) - LexicographicError: Unterminated string constant +(3, 36) - LexicographicError: Unterminated string constant +(6, 58) - LexicographicError: Unterminated string constant \ No newline at end of file diff --git a/tests/syntactic_and_semantic_errors/01_result.cl b/tests/syntactic_and_semantic_errors/01_result.txt similarity index 100% rename from tests/syntactic_and_semantic_errors/01_result.cl rename to tests/syntactic_and_semantic_errors/01_result.txt diff --git a/tests/test_cool.py b/tests/test_cool.py index 89d203194..7beea95fb 100644 --- a/tests/test_cool.py +++ b/tests/test_cool.py @@ -33,55 +33,68 @@ def check_semantics(ast, scope: Scope, context: Context, errors: List[str]): return ast, scope, context, errors -def test_inference_programs(): - inference_testing_programs = [] - inference_testing_results = [] +def test_inference(): + paths = [] + programs = [] + results = [] cwd = Path.cwd() - path = cwd / 'inference' if str(cwd).endswith('tests') else cwd / 'tests' / 'inference' + folder_name = 'inference' + path = cwd / folder_name if str(cwd).endswith('tests') else cwd / 'tests' / folder_name for path in sorted(path.iterdir()): s = path.open('r').read() if 'program' in path.name: - inference_testing_programs.append(s) + programs.append(s) + paths.append(path.name) else: - inference_testing_results.append(s) + results.append(s) - for code, result in zip(inference_testing_programs, inference_testing_results): + for path, code, result in zip(paths, programs, results): tokens, _ = tokenize(code) ast, _ = parse(tokens) ast, scope, context, errors = check_semantics(ast, Scope(), Context(), []) assert not errors and CodeBuilder().visit(ast, 0) == result -def test_errors_in_programs(): - errors_testing_programs = [] - errors_testing_results = [] +def test_syntactic_and_semantic_errors(): + paths = [] + programs = [] + results = [] cwd = Path.cwd() - path = cwd / 'syntactic_and_semantic_errors' if str(cwd).endswith('tests') else cwd / 'tests' / 'syntactic_and_semantic_errors' + folder_name = 'syntactic_and_semantic_errors' + path = cwd / folder_name if str(cwd).endswith('tests') else cwd / 'tests' / folder_name for path in sorted(path.iterdir()): s = path.open('r').read() - if 'program' in path.name: - errors_testing_programs.append(s) + if path.name.endswith('.cl'): + programs.append(s) + paths.append(path.name) else: - errors_testing_results.append(s) + results.append(s) - for code, result in zip(errors_testing_programs, errors_testing_results): + for path, code, result in zip(paths, programs, results): tokens, _ = tokenize(code) ast, parser = parse(tokens) ast, _, _, errors = check_semantics(ast, Scope(), Context(), []) - assert '\n'.join(parser.errors + errors) == result + assert '\n'.join(parser.errors + errors) == result, path + +def test_lexicographic_errors(): + paths = [] + programs = [] + results = [] -if __name__ == '__main__': - pass + cwd = Path.cwd() + folder_name = 'lexicographic_errors' + path = cwd / folder_name if str(cwd).endswith('tests') else cwd / 'tests' / folder_name + for path in sorted(path.iterdir())[:2 * 2]: + s = path.open('r').read() + if path.name.endswith('.cl'): + programs.append(s) + paths.append(path.name) + else: + results.append(s) - # if not syntactic_and_semantic_errors and not parser.contains_errors: - # try: - # Executor(context).visit(ast, Scope()) - # print('Program finished...') - # except ExecutionError as e: - # sys.stderr.write(e.text + '\n') - # - # for error in syntactic_and_semantic_errors: - # sys.stderr.write(error + '\n') + for path, code, result in zip(paths, programs, results): + tokens, lexer = tokenize(code) + assert lexer.contain_errors and '\n'.join(lexer.errors) == result.strip(), path From 847449c4dd425cded66d88228f551512e64ad388 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Wed, 21 Oct 2020 05:16:24 +0200 Subject: [PATCH 077/143] - --- cool.py | 5 +- grammar.py | 69 +- lexertab.py | 2 +- parsertab.py | 914 +++++++++--------- requirements.txt | 2 +- semantics/formatter.py | 3 +- .../01_program.cl | 0 .../02_program.cl | 0 .../03_program.cl | 0 .../04_program.cl | 0 .../05_program.cl | 0 .../06_program.cl | 0 .../comment1.cl | 0 tests/lexer/comment1_error.txt | 1 + tests/{lexicographic_errors => lexer}/iis1.cl | 0 tests/lexer/iis1_error.txt | 1 + tests/{lexicographic_errors => lexer}/iis2.cl | 0 tests/lexer/iis2_error.txt | 1 + tests/{lexicographic_errors => lexer}/iis3.cl | 0 tests/lexer/iis3_error.txt | 1 + tests/{lexicographic_errors => lexer}/iis4.cl | 0 tests/lexer/iis4_error.txt | 1 + tests/{lexicographic_errors => lexer}/iis5.cl | 0 .../iis5_error.txt | 0 tests/{lexicographic_errors => lexer}/iis6.cl | 0 .../iis6_error.txt | 0 .../{lexicographic_errors => lexer}/mixed1.cl | 0 .../mixed1_error.txt | 0 .../{lexicographic_errors => lexer}/mixed2.cl | 0 .../mixed2_error.txt | 0 .../string1.cl | 0 .../string1_error.txt | 0 .../string2.cl | 0 .../string2_error.txt | 0 .../string3.cl | Bin .../string3_error.txt | 0 .../string4.cl | 0 .../string4_error.txt | 0 tests/lexicographic_errors/comment1_error.txt | 1 - tests/lexicographic_errors/iis1_error.txt | 1 - tests/lexicographic_errors/iis2_error.txt | 1 - tests/lexicographic_errors/iis3_error.txt | 1 - tests/lexicographic_errors/iis4_error.txt | 1 - tests/parser/assignment1.cl | 37 + tests/parser/assignment1_error.txt | 1 + tests/parser/assignment2.cl | 37 + tests/parser/assignment2_error.txt | 1 + tests/parser/assignment3.cl | 37 + tests/parser/assignment3_error.txt | 2 + tests/parser/attribute1.cl | 34 + tests/parser/attribute1_error.txt | 1 + tests/parser/attribute2.cl | 34 + tests/parser/attribute2_error.txt | 6 + tests/parser/attribute3.cl | 34 + tests/parser/attribute3_error.txt | 2 + tests/parser/block1.cl | 87 ++ tests/parser/block1_error.txt | 4 + tests/parser/block2.cl | 87 ++ tests/parser/block2_error.txt | 8 + tests/parser/block3.cl | 87 ++ tests/parser/block3_error.txt | 4 + tests/parser/block4.cl | 88 ++ tests/parser/block4_error.txt | 5 + tests/parser/case1.cl | 91 ++ tests/parser/case1_error.txt | 4 + tests/parser/case2.cl | 93 ++ tests/parser/case2_error.txt | 3 + tests/parser/case3.cl | 93 ++ tests/parser/case3_error.txt | 4 + tests/parser/case4.cl | 93 ++ tests/parser/case4_error.txt | 5 + tests/parser/case5.cl | 93 ++ tests/parser/case5_error.txt | 3 + tests/parser/case6.cl | 93 ++ tests/parser/case6_error.txt | 3 + tests/parser/class1.cl | 20 + tests/parser/class1_error.txt | 1 + tests/parser/class2.cl | 20 + tests/parser/class2_error.txt | 1 + tests/parser/class3.cl | 34 + tests/parser/class3_error.txt | 1 + tests/parser/class4.cl | 36 + tests/parser/class4_error.txt | 1 + tests/parser/class5.cl | 34 + tests/parser/class5_error.txt | 3 + tests/parser/class6.cl | 34 + tests/parser/class6_error.txt | 1 + tests/parser/conditional1.cl | 69 ++ tests/parser/conditional1_error.txt | 2 + tests/parser/conditional2.cl | 69 ++ tests/parser/conditional2_error.txt | 1 + tests/parser/conditional3.cl | 69 ++ tests/parser/conditional3_error.txt | 1 + tests/parser/conditional4.cl | 73 ++ tests/parser/conditional4_error.txt | 4 + tests/parser/conditional5.cl | 73 ++ tests/parser/conditional5_error.txt | 4 + tests/parser/conditional6.cl | 73 ++ tests/parser/conditional6_error.txt | 4 + tests/parser/dispatch1.cl | 45 + tests/parser/dispatch1_error.txt | 1 + tests/parser/dispatch2.cl | 45 + tests/parser/dispatch2_error.txt | 6 + tests/parser/dispatch4.cl | 53 + tests/parser/dispatch4_error.txt | 2 + tests/parser/dispatch5.cl | 53 + tests/parser/dispatch5_error.txt | 1 + tests/parser/dispatch6.cl | 57 ++ tests/parser/dispatch6_error.txt | 2 + tests/parser/dispatch7.cl | 57 ++ tests/parser/dispatch7_error.txt | 2 + tests/parser/dispatch8.cl | 57 ++ tests/parser/dispatch8_error.txt | 1 + tests/parser/dispatch9.cl | 61 ++ tests/parser/dispatch9_error.txt | 1 + tests/parser/let1.cl | 85 ++ tests/parser/let1_error.txt | 3 + tests/parser/let2.cl | 85 ++ tests/parser/let2_error.txt | 11 + tests/parser/let3.cl | 85 ++ tests/parser/let3_error.txt | 11 + tests/parser/let4.cl | 85 ++ tests/parser/let4_error.txt | 4 + tests/parser/let5.cl | 85 ++ tests/parser/let5_error.txt | 3 + tests/parser/let6.cl | 74 ++ tests/parser/let6_error.txt | 4 + tests/parser/let7.cl | 85 ++ tests/parser/let7_error.txt | 10 + tests/parser/loop1.cl | 78 ++ tests/parser/loop1_error.txt | 3 + tests/parser/loop2.cl | 78 ++ tests/parser/loop2_error.txt | 3 + tests/parser/loop3.cl | 78 ++ tests/parser/loop3_error.txt | 3 + tests/parser/loop4.cl | 78 ++ tests/parser/loop4_error.txt | 4 + tests/parser/method1.cl | 34 + tests/parser/method1_error.txt | 6 + tests/parser/method2.cl | 34 + tests/parser/method2_error.txt | 3 + tests/parser/method3.cl | 34 + tests/parser/method3_error.txt | 2 + tests/parser/method4.cl | 34 + tests/parser/method4_error.txt | 4 + tests/parser/method5.cl | 34 + tests/parser/method5_error.txt | 3 + tests/parser/method6.cl | 33 + tests/parser/method6_error.txt | 2 + tests/parser/mixed2.cl | 14 + tests/parser/mixed2_error.txt | 2 + tests/parser/mixed3.cl | 40 + tests/parser/mixed3_error.txt | 2 + tests/parser/mixed4.cl | 21 + tests/parser/mixed4_error.txt | 1 + tests/parser/mixed5.cl | 20 + tests/parser/mixed5_error.txt | 2 + tests/parser/mixed6.cl | 5 + tests/parser/mixed6_error.txt | 1 + tests/parser/operation1.cl | 101 ++ tests/parser/operation1_error.txt | 6 + tests/parser/operation2.cl | 101 ++ tests/parser/operation2_error.txt | 5 + tests/parser/operation3.cl | 101 ++ tests/parser/operation3_error.txt | 5 + tests/parser/operation4.cl | 101 ++ tests/parser/operation4_error.txt | 5 + tests/parser/program1.cl | 1 + tests/parser/program1_error.txt | 1 + tests/parser/program3.cl | 24 + tests/parser/program3_error.txt | 1 + .../01_program.cl | 0 .../01_result.txt | 0 tests/test_cool.py | 77 +- 174 files changed, 4552 insertions(+), 514 deletions(-) rename tests/{correct_programs => execution}/01_program.cl (100%) rename tests/{correct_programs => execution}/02_program.cl (100%) rename tests/{correct_programs => execution}/03_program.cl (100%) rename tests/{correct_programs => execution}/04_program.cl (100%) rename tests/{correct_programs => execution}/05_program.cl (100%) rename tests/{correct_programs => execution}/06_program.cl (100%) rename tests/{lexicographic_errors => lexer}/comment1.cl (100%) create mode 100644 tests/lexer/comment1_error.txt rename tests/{lexicographic_errors => lexer}/iis1.cl (100%) create mode 100644 tests/lexer/iis1_error.txt rename tests/{lexicographic_errors => lexer}/iis2.cl (100%) create mode 100644 tests/lexer/iis2_error.txt rename tests/{lexicographic_errors => lexer}/iis3.cl (100%) create mode 100644 tests/lexer/iis3_error.txt rename tests/{lexicographic_errors => lexer}/iis4.cl (100%) create mode 100644 tests/lexer/iis4_error.txt rename tests/{lexicographic_errors => lexer}/iis5.cl (100%) rename tests/{lexicographic_errors => lexer}/iis5_error.txt (100%) rename tests/{lexicographic_errors => lexer}/iis6.cl (100%) rename tests/{lexicographic_errors => lexer}/iis6_error.txt (100%) rename tests/{lexicographic_errors => lexer}/mixed1.cl (100%) rename tests/{lexicographic_errors => lexer}/mixed1_error.txt (100%) rename tests/{lexicographic_errors => lexer}/mixed2.cl (100%) rename tests/{lexicographic_errors => lexer}/mixed2_error.txt (100%) rename tests/{lexicographic_errors => lexer}/string1.cl (100%) rename tests/{lexicographic_errors => lexer}/string1_error.txt (100%) rename tests/{lexicographic_errors => lexer}/string2.cl (100%) rename tests/{lexicographic_errors => lexer}/string2_error.txt (100%) rename tests/{lexicographic_errors => lexer}/string3.cl (100%) rename tests/{lexicographic_errors => lexer}/string3_error.txt (100%) rename tests/{lexicographic_errors => lexer}/string4.cl (100%) rename tests/{lexicographic_errors => lexer}/string4_error.txt (100%) delete mode 100644 tests/lexicographic_errors/comment1_error.txt delete mode 100644 tests/lexicographic_errors/iis1_error.txt delete mode 100644 tests/lexicographic_errors/iis2_error.txt delete mode 100644 tests/lexicographic_errors/iis3_error.txt delete mode 100644 tests/lexicographic_errors/iis4_error.txt create mode 100644 tests/parser/assignment1.cl create mode 100644 tests/parser/assignment1_error.txt create mode 100644 tests/parser/assignment2.cl create mode 100644 tests/parser/assignment2_error.txt create mode 100644 tests/parser/assignment3.cl create mode 100644 tests/parser/assignment3_error.txt create mode 100644 tests/parser/attribute1.cl create mode 100644 tests/parser/attribute1_error.txt create mode 100644 tests/parser/attribute2.cl create mode 100644 tests/parser/attribute2_error.txt create mode 100644 tests/parser/attribute3.cl create mode 100644 tests/parser/attribute3_error.txt create mode 100644 tests/parser/block1.cl create mode 100644 tests/parser/block1_error.txt create mode 100644 tests/parser/block2.cl create mode 100644 tests/parser/block2_error.txt create mode 100644 tests/parser/block3.cl create mode 100644 tests/parser/block3_error.txt create mode 100644 tests/parser/block4.cl create mode 100644 tests/parser/block4_error.txt create mode 100644 tests/parser/case1.cl create mode 100644 tests/parser/case1_error.txt create mode 100644 tests/parser/case2.cl create mode 100644 tests/parser/case2_error.txt create mode 100644 tests/parser/case3.cl create mode 100644 tests/parser/case3_error.txt create mode 100644 tests/parser/case4.cl create mode 100644 tests/parser/case4_error.txt create mode 100644 tests/parser/case5.cl create mode 100644 tests/parser/case5_error.txt create mode 100644 tests/parser/case6.cl create mode 100644 tests/parser/case6_error.txt create mode 100644 tests/parser/class1.cl create mode 100644 tests/parser/class1_error.txt create mode 100644 tests/parser/class2.cl create mode 100644 tests/parser/class2_error.txt create mode 100644 tests/parser/class3.cl create mode 100644 tests/parser/class3_error.txt create mode 100644 tests/parser/class4.cl create mode 100644 tests/parser/class4_error.txt create mode 100644 tests/parser/class5.cl create mode 100644 tests/parser/class5_error.txt create mode 100644 tests/parser/class6.cl create mode 100644 tests/parser/class6_error.txt create mode 100644 tests/parser/conditional1.cl create mode 100644 tests/parser/conditional1_error.txt create mode 100644 tests/parser/conditional2.cl create mode 100644 tests/parser/conditional2_error.txt create mode 100644 tests/parser/conditional3.cl create mode 100644 tests/parser/conditional3_error.txt create mode 100644 tests/parser/conditional4.cl create mode 100644 tests/parser/conditional4_error.txt create mode 100644 tests/parser/conditional5.cl create mode 100644 tests/parser/conditional5_error.txt create mode 100644 tests/parser/conditional6.cl create mode 100644 tests/parser/conditional6_error.txt create mode 100644 tests/parser/dispatch1.cl create mode 100644 tests/parser/dispatch1_error.txt create mode 100644 tests/parser/dispatch2.cl create mode 100644 tests/parser/dispatch2_error.txt create mode 100644 tests/parser/dispatch4.cl create mode 100644 tests/parser/dispatch4_error.txt create mode 100644 tests/parser/dispatch5.cl create mode 100644 tests/parser/dispatch5_error.txt create mode 100644 tests/parser/dispatch6.cl create mode 100644 tests/parser/dispatch6_error.txt create mode 100644 tests/parser/dispatch7.cl create mode 100644 tests/parser/dispatch7_error.txt create mode 100644 tests/parser/dispatch8.cl create mode 100644 tests/parser/dispatch8_error.txt create mode 100644 tests/parser/dispatch9.cl create mode 100644 tests/parser/dispatch9_error.txt create mode 100644 tests/parser/let1.cl create mode 100644 tests/parser/let1_error.txt create mode 100644 tests/parser/let2.cl create mode 100644 tests/parser/let2_error.txt create mode 100644 tests/parser/let3.cl create mode 100644 tests/parser/let3_error.txt create mode 100644 tests/parser/let4.cl create mode 100644 tests/parser/let4_error.txt create mode 100644 tests/parser/let5.cl create mode 100644 tests/parser/let5_error.txt create mode 100644 tests/parser/let6.cl create mode 100644 tests/parser/let6_error.txt create mode 100644 tests/parser/let7.cl create mode 100644 tests/parser/let7_error.txt create mode 100644 tests/parser/loop1.cl create mode 100644 tests/parser/loop1_error.txt create mode 100644 tests/parser/loop2.cl create mode 100644 tests/parser/loop2_error.txt create mode 100644 tests/parser/loop3.cl create mode 100644 tests/parser/loop3_error.txt create mode 100644 tests/parser/loop4.cl create mode 100644 tests/parser/loop4_error.txt create mode 100644 tests/parser/method1.cl create mode 100644 tests/parser/method1_error.txt create mode 100644 tests/parser/method2.cl create mode 100644 tests/parser/method2_error.txt create mode 100644 tests/parser/method3.cl create mode 100644 tests/parser/method3_error.txt create mode 100644 tests/parser/method4.cl create mode 100644 tests/parser/method4_error.txt create mode 100644 tests/parser/method5.cl create mode 100644 tests/parser/method5_error.txt create mode 100644 tests/parser/method6.cl create mode 100644 tests/parser/method6_error.txt create mode 100644 tests/parser/mixed2.cl create mode 100644 tests/parser/mixed2_error.txt create mode 100644 tests/parser/mixed3.cl create mode 100644 tests/parser/mixed3_error.txt create mode 100644 tests/parser/mixed4.cl create mode 100644 tests/parser/mixed4_error.txt create mode 100644 tests/parser/mixed5.cl create mode 100644 tests/parser/mixed5_error.txt create mode 100644 tests/parser/mixed6.cl create mode 100644 tests/parser/mixed6_error.txt create mode 100644 tests/parser/operation1.cl create mode 100644 tests/parser/operation1_error.txt create mode 100644 tests/parser/operation2.cl create mode 100644 tests/parser/operation2_error.txt create mode 100644 tests/parser/operation3.cl create mode 100644 tests/parser/operation3_error.txt create mode 100644 tests/parser/operation4.cl create mode 100644 tests/parser/operation4_error.txt create mode 100644 tests/parser/program1.cl create mode 100644 tests/parser/program1_error.txt create mode 100644 tests/parser/program3.cl create mode 100644 tests/parser/program3_error.txt rename tests/{syntactic_and_semantic_errors => semantic}/01_program.cl (100%) rename tests/{syntactic_and_semantic_errors => semantic}/01_result.txt (100%) diff --git a/cool.py b/cool.py index fe97b30fb..2d3a97498 100644 --- a/cool.py +++ b/cool.py @@ -1,14 +1,13 @@ -import sys +from pathlib import Path from typing import List import typer -from pathlib import Path from lexertab import CoolLexer from parsertab import CoolParser from semantics import TypeCollector, TypeBuilder, OverriddenMethodChecker, TypeChecker, topological_ordering -from semantics.formatter import CodeBuilder from semantics.execution import Executor, ExecutionError +from semantics.formatter import CodeBuilder from semantics.type_inference import InferenceChecker from semantics.utils.scope import Context, Scope diff --git a/grammar.py b/grammar.py index 27558edb1..11e06dafd 100644 --- a/grammar.py +++ b/grammar.py @@ -64,10 +64,77 @@ def id_terminal(lexer): ############### # Basic Types # ############### -G.add_terminal('string', regex=r'\"[^\"]*\"') G.add_terminal('int', regex=r'\d+') +@G.terminal('string', regex=r'\"') +def string(lexer: Lexer): + text = lexer.text + pos = lexer.position + 1 + lexer.column += 1 + lex = '\"' + + contains_null_character = False + while True: + if pos >= len(text): + lexer.contain_errors = True + lexer.position = pos + lexer.add_error(lexer.lineno, lexer.column, + f'{lexer.lineno, lexer.column} - LexicographicError: EOF in string constant') + return + + s = text[pos] + + if s == '\\': + if text[pos + 1] == '\n': + lex += '\n' + pos += 2 + lexer.lineno += 1 + lexer.column = 1 + elif text[pos + 1] in ('b', 'f', 't', 'n'): + if text[pos + 1] == 'b': + lex += '\\b' + elif text[pos + 1] == 'f': + lex += '\\f' + elif text[pos + 1] == 't': + lex += '\\t' + else: + lex += '\\n' + + pos += 2 + lexer.column += 2 + else: + lex += text[pos + 1] + pos += 2 + lexer.column += 2 + elif s == '\n': + # Unterminated String + lexer.contain_errors = True + lexer.position = pos + lexer.add_error(lexer.lineno, lexer.column, + f'{lexer.lineno, lexer.column} - LexicographicError: Unterminated string constant') + return + elif s == '\0': + contains_null_character = True + lexer.contain_errors = True + lexer.add_error(lexer.lineno, lexer.column, + f'{lexer.lineno, lexer.column} - LexicographicError: String contains null character') + pos += 1 + lexer.column += 1 + else: + lex += s + pos += 1 + lexer.column += 1 + + if s == '\"': + break + + lexer.position = pos + lexer.token.lex = lex + if not contains_null_character: + return lexer.token + + ############ # Comments # ############ diff --git a/lexertab.py b/lexertab.py index cb1737f3e..38fc241ed 100644 --- a/lexertab.py +++ b/lexertab.py @@ -10,7 +10,7 @@ def __init__(self): self.column = 1 self.position = 0 self.token = Token('', '', 0, 0) - self.pattern = re.compile(r'(?P[a-z][a-zA-Z0-9_]*)|(?P--.*)|(?P\(\*)|(?P\n+)|(?P +)|(?P\t+)|(?P[A-Z][a-zA-Z0-9_]*)|(?P\"[^\"]*\")|(?P\d+)|(inherits)|(isvoid)|(class)|(while)|(false)|(then)|(else)|(loop)|(pool)|(case)|(esac)|(true)|(<\-)|(let)|(new)|(not)|(\{)|(\})|(\()|(\))|(\.)|(=>)|(if)|(fi)|(in)|(of)|(\+)|(\-)|(\*)|(<=)|(\~)|(,)|(:)|(;)|(@)|(/)|(<)|(=)') + self.pattern = re.compile(r'(?P[a-z][a-zA-Z0-9_]*)|(?P\")|(?P--.*)|(?P\(\*)|(?P\n+)|(?P +)|(?P\t+)|(?P[A-Z][a-zA-Z0-9_]*)|(?P\d+)|(inherits)|(isvoid)|(class)|(while)|(false)|(then)|(else)|(loop)|(pool)|(case)|(esac)|(true)|(<\-)|(let)|(new)|(not)|(\{)|(\})|(\()|(\))|(\.)|(=>)|(if)|(fi)|(in)|(of)|(\+)|(\-)|(\*)|(<=)|(\~)|(,)|(:)|(;)|(@)|(/)|(<)|(=)') self.token_rules = {key: rule for key, (_, _, rule) in G.terminal_rules.items() if rule is not None} self.error_handler = G.lexical_error_handler if G.lexical_error_handler is not None else self.error self._errors = [] diff --git a/parsertab.py b/parsertab.py index f5e082dd8..cd83a15dc 100644 --- a/parsertab.py +++ b/parsertab.py @@ -18,128 +18,128 @@ def __action_table(): (1, G["type"]): ("SHIFT", 2), (2, G["inherits"]): ("SHIFT", 145), (2, G["{"]): ("SHIFT", 3), - (3, G["}"]): ("REDUCE", G["feature-list -> e"]), (3, G["id"]): ("SHIFT", 4), - (4, G["("]): ("SHIFT", 5), + (3, G["}"]): ("REDUCE", G["feature-list -> e"]), (4, G[":"]): ("SHIFT", 129), + (4, G["("]): ("SHIFT", 5), (5, G["id"]): ("SHIFT", 117), (5, G[")"]): ("SHIFT", 6), (6, G[":"]): ("SHIFT", 7), (7, G["type"]): ("SHIFT", 8), (8, G["{"]): ("SHIFT", 9), - (9, G["~"]): ("SHIFT", 27), - (9, G["false"]): ("SHIFT", 26), + (9, G["not"]): ("SHIFT", 30), (9, G["id"]): ("SHIFT", 31), (9, G["new"]): ("SHIFT", 22), + (9, G["{"]): ("SHIFT", 10), + (9, G["~"]): ("SHIFT", 27), (9, G["true"]): ("SHIFT", 25), + (9, G["case"]): ("SHIFT", 21), + (9, G["int"]): ("SHIFT", 33), + (9, G["string"]): ("SHIFT", 34), + (9, G["if"]): ("SHIFT", 12), + (9, G["isvoid"]): ("SHIFT", 24), (9, G["let"]): ("SHIFT", 14), - (9, G["{"]): ("SHIFT", 10), - (9, G["string"]): ("SHIFT", 33), (9, G["while"]): ("SHIFT", 13), - (9, G["isvoid"]): ("SHIFT", 24), (9, G["("]): ("SHIFT", 11), - (9, G["if"]): ("SHIFT", 12), - (9, G["not"]): ("SHIFT", 30), - (9, G["int"]): ("SHIFT", 34), - (9, G["case"]): ("SHIFT", 21), - (10, G["case"]): ("SHIFT", 21), - (10, G["isvoid"]): ("SHIFT", 24), - (10, G["false"]): ("SHIFT", 26), - (10, G["id"]): ("SHIFT", 31), - (10, G["new"]): ("SHIFT", 22), + (9, G["false"]): ("SHIFT", 26), (10, G["true"]): ("SHIFT", 25), - (10, G["~"]): ("SHIFT", 27), - (10, G["string"]): ("SHIFT", 33), - (10, G["{"]): ("SHIFT", 10), + (10, G["if"]): ("SHIFT", 12), + (10, G["int"]): ("SHIFT", 33), + (10, G["string"]): ("SHIFT", 34), + (10, G["id"]): ("SHIFT", 31), (10, G["let"]): ("SHIFT", 14), (10, G["while"]): ("SHIFT", 13), + (10, G["~"]): ("SHIFT", 27), (10, G["("]): ("SHIFT", 11), - (10, G["if"]): ("SHIFT", 12), (10, G["not"]): ("SHIFT", 30), - (10, G["int"]): ("SHIFT", 34), - (11, G["while"]): ("SHIFT", 13), + (10, G["false"]): ("SHIFT", 26), + (10, G["{"]): ("SHIFT", 10), + (10, G["isvoid"]): ("SHIFT", 24), + (10, G["new"]): ("SHIFT", 22), + (10, G["case"]): ("SHIFT", 21), + (11, G["case"]): ("SHIFT", 21), (11, G["isvoid"]): ("SHIFT", 24), + (11, G["id"]): ("SHIFT", 31), (11, G["if"]): ("SHIFT", 12), - (11, G["not"]): ("SHIFT", 30), - (11, G["int"]): ("SHIFT", 34), + (11, G["("]): ("SHIFT", 11), + (11, G["let"]): ("SHIFT", 14), + (11, G["while"]): ("SHIFT", 13), (11, G["false"]): ("SHIFT", 26), - (11, G["case"]): ("SHIFT", 21), (11, G["new"]): ("SHIFT", 22), (11, G["~"]): ("SHIFT", 27), (11, G["true"]): ("SHIFT", 25), - (11, G["id"]): ("SHIFT", 31), - (11, G["string"]): ("SHIFT", 33), - (11, G["let"]): ("SHIFT", 14), + (11, G["not"]): ("SHIFT", 30), + (11, G["int"]): ("SHIFT", 33), + (11, G["string"]): ("SHIFT", 34), (11, G["{"]): ("SHIFT", 10), - (11, G["("]): ("SHIFT", 11), + (12, G["id"]): ("SHIFT", 31), + (12, G["~"]): ("SHIFT", 27), + (12, G["not"]): ("SHIFT", 30), + (12, G["("]): ("SHIFT", 11), + (12, G["{"]): ("SHIFT", 10), (12, G["false"]): ("SHIFT", 26), (12, G["case"]): ("SHIFT", 21), + (12, G["isvoid"]): ("SHIFT", 24), + (12, G["if"]): ("SHIFT", 12), (12, G["new"]): ("SHIFT", 22), (12, G["true"]): ("SHIFT", 25), - (12, G["isvoid"]): ("SHIFT", 24), - (12, G["id"]): ("SHIFT", 31), - (12, G["string"]): ("SHIFT", 33), - (12, G["~"]): ("SHIFT", 27), - (12, G["{"]): ("SHIFT", 10), (12, G["let"]): ("SHIFT", 14), - (12, G["("]): ("SHIFT", 11), (12, G["while"]): ("SHIFT", 13), - (12, G["int"]): ("SHIFT", 34), - (12, G["if"]): ("SHIFT", 12), - (12, G["not"]): ("SHIFT", 30), - (13, G["new"]): ("SHIFT", 22), - (13, G["case"]): ("SHIFT", 21), - (13, G["true"]): ("SHIFT", 25), + (12, G["int"]): ("SHIFT", 33), + (12, G["string"]): ("SHIFT", 34), + (13, G["int"]): ("SHIFT", 33), + (13, G["string"]): ("SHIFT", 34), (13, G["id"]): ("SHIFT", 31), + (13, G["not"]): ("SHIFT", 30), (13, G["isvoid"]): ("SHIFT", 24), - (13, G["string"]): ("SHIFT", 33), - (13, G["let"]): ("SHIFT", 14), (13, G["{"]): ("SHIFT", 10), (13, G["("]): ("SHIFT", 11), + (13, G["case"]): ("SHIFT", 21), + (13, G["false"]): ("SHIFT", 26), (13, G["~"]): ("SHIFT", 27), - (13, G["while"]): ("SHIFT", 13), (13, G["if"]): ("SHIFT", 12), - (13, G["int"]): ("SHIFT", 34), - (13, G["not"]): ("SHIFT", 30), - (13, G["false"]): ("SHIFT", 26), + (13, G["new"]): ("SHIFT", 22), + (13, G["let"]): ("SHIFT", 14), + (13, G["while"]): ("SHIFT", 13), + (13, G["true"]): ("SHIFT", 25), (14, G["id"]): ("SHIFT", 15), (15, G[":"]): ("SHIFT", 16), (16, G["type"]): ("SHIFT", 17), + (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), (17, G["<-"]): ("SHIFT", 20), (17, G[","]): ("SHIFT", 18), - (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), (18, G["id"]): ("SHIFT", 15), (19, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), - (20, G["case"]): ("SHIFT", 21), - (20, G["string"]): ("SHIFT", 33), - (20, G["~"]): ("SHIFT", 27), + (20, G["new"]): ("SHIFT", 22), + (20, G["while"]): ("SHIFT", 13), + (20, G["true"]): ("SHIFT", 25), + (20, G["int"]): ("SHIFT", 33), + (20, G["string"]): ("SHIFT", 34), (20, G["id"]): ("SHIFT", 31), - (20, G["("]): ("SHIFT", 11), - (20, G["int"]): ("SHIFT", 34), - (20, G["let"]): ("SHIFT", 14), + (20, G["~"]): ("SHIFT", 27), + (20, G["not"]): ("SHIFT", 30), (20, G["{"]): ("SHIFT", 10), + (20, G["isvoid"]): ("SHIFT", 24), + (20, G["("]): ("SHIFT", 11), + (20, G["case"]): ("SHIFT", 21), (20, G["false"]): ("SHIFT", 26), - (20, G["while"]): ("SHIFT", 13), (20, G["if"]): ("SHIFT", 12), - (20, G["not"]): ("SHIFT", 30), - (20, G["new"]): ("SHIFT", 22), - (20, G["isvoid"]): ("SHIFT", 24), - (20, G["true"]): ("SHIFT", 25), - (21, G["string"]): ("SHIFT", 33), - (21, G["if"]): ("SHIFT", 12), + (20, G["let"]): ("SHIFT", 14), + (21, G["new"]): ("SHIFT", 22), (21, G["not"]): ("SHIFT", 30), - (21, G["id"]): ("SHIFT", 31), - (21, G["("]): ("SHIFT", 11), - (21, G["case"]): ("SHIFT", 21), - (21, G["int"]): ("SHIFT", 34), (21, G["isvoid"]): ("SHIFT", 24), - (21, G["false"]): ("SHIFT", 26), - (21, G["new"]): ("SHIFT", 22), - (21, G["{"]): ("SHIFT", 10), (21, G["true"]): ("SHIFT", 25), + (21, G["id"]): ("SHIFT", 31), + (21, G["int"]): ("SHIFT", 33), + (21, G["string"]): ("SHIFT", 34), + (21, G["{"]): ("SHIFT", 10), + (21, G["false"]): ("SHIFT", 26), + (21, G["case"]): ("SHIFT", 21), + (21, G["if"]): ("SHIFT", 12), (21, G["let"]): ("SHIFT", 14), - (21, G["~"]): ("SHIFT", 27), (21, G["while"]): ("SHIFT", 13), + (21, G["("]): ("SHIFT", 11), + (21, G["~"]): ("SHIFT", 27), (22, G["type"]): ("SHIFT", 23), (23, G["-"]): ("REDUCE", G["atom -> new type"]), (23, G["in"]): ("REDUCE", G["atom -> new type"]), @@ -162,15 +162,15 @@ def __action_table(): (23, G["@"]): ("REDUCE", G["atom -> new type"]), (23, G["pool"]): ("REDUCE", G["atom -> new type"]), (23, G["+"]): ("REDUCE", G["atom -> new type"]), - (24, G["id"]): ("SHIFT", 28), (24, G["isvoid"]): ("SHIFT", 24), - (24, G["("]): ("SHIFT", 11), - (24, G["int"]): ("SHIFT", 34), - (24, G["string"]): ("SHIFT", 33), + (24, G["int"]): ("SHIFT", 33), + (24, G["string"]): ("SHIFT", 34), (24, G["new"]): ("SHIFT", 22), + (24, G["id"]): ("SHIFT", 28), + (24, G["("]): ("SHIFT", 11), + (24, G["false"]): ("SHIFT", 26), (24, G["~"]): ("SHIFT", 27), (24, G["true"]): ("SHIFT", 25), - (24, G["false"]): ("SHIFT", 26), (25, G["-"]): ("REDUCE", G["atom -> true"]), (25, G["in"]): ("REDUCE", G["atom -> true"]), (25, G["*"]): ("REDUCE", G["atom -> true"]), @@ -213,15 +213,15 @@ def __action_table(): (26, G["@"]): ("REDUCE", G["atom -> false"]), (26, G["pool"]): ("REDUCE", G["atom -> false"]), (26, G["+"]): ("REDUCE", G["atom -> false"]), - (27, G["id"]): ("SHIFT", 28), (27, G["isvoid"]): ("SHIFT", 24), - (27, G["("]): ("SHIFT", 11), - (27, G["int"]): ("SHIFT", 34), - (27, G["string"]): ("SHIFT", 33), + (27, G["int"]): ("SHIFT", 33), + (27, G["string"]): ("SHIFT", 34), (27, G["new"]): ("SHIFT", 22), + (27, G["id"]): ("SHIFT", 28), + (27, G["("]): ("SHIFT", 11), + (27, G["false"]): ("SHIFT", 26), (27, G["~"]): ("SHIFT", 27), (27, G["true"]): ("SHIFT", 25), - (27, G["false"]): ("SHIFT", 26), (28, G["("]): ("SHIFT", 29), (28, G["-"]): ("REDUCE", G["atom -> id"]), (28, G["in"]): ("REDUCE", G["atom -> id"]), @@ -244,38 +244,39 @@ def __action_table(): (28, G["@"]): ("REDUCE", G["atom -> id"]), (28, G["pool"]): ("REDUCE", G["atom -> id"]), (28, G["+"]): ("REDUCE", G["atom -> id"]), - (29, G["while"]): ("SHIFT", 13), (29, G["id"]): ("SHIFT", 31), - (29, G["if"]): ("SHIFT", 12), + (29, G["{"]): ("SHIFT", 10), (29, G["~"]): ("SHIFT", 27), - (29, G["not"]): ("SHIFT", 30), (29, G["("]): ("SHIFT", 11), - (29, G["case"]): ("SHIFT", 21), - (29, G["int"]): ("SHIFT", 34), (29, G["false"]): ("SHIFT", 26), + (29, G[")"]): ("REDUCE", G["expr-list -> e"]), + (29, G["case"]): ("SHIFT", 21), + (29, G["if"]): ("SHIFT", 12), (29, G["new"]): ("SHIFT", 22), - (29, G["true"]): ("SHIFT", 25), (29, G["isvoid"]): ("SHIFT", 24), - (29, G["{"]): ("SHIFT", 10), + (29, G["true"]): ("SHIFT", 25), (29, G["let"]): ("SHIFT", 14), - (29, G["string"]): ("SHIFT", 33), - (29, G[")"]): ("REDUCE", G["expr-list -> e"]), - (30, G["isvoid"]): ("SHIFT", 24), - (30, G["string"]): ("SHIFT", 33), - (30, G["while"]): ("SHIFT", 13), - (30, G["if"]): ("SHIFT", 12), + (29, G["while"]): ("SHIFT", 13), + (29, G["int"]): ("SHIFT", 33), + (29, G["string"]): ("SHIFT", 34), + (29, G["not"]): ("SHIFT", 30), + (30, G["new"]): ("SHIFT", 22), (30, G["not"]): ("SHIFT", 30), + (30, G["true"]): ("SHIFT", 25), (30, G["id"]): ("SHIFT", 31), - (30, G["("]): ("SHIFT", 11), + (30, G["int"]): ("SHIFT", 33), + (30, G["string"]): ("SHIFT", 34), + (30, G["{"]): ("SHIFT", 10), (30, G["~"]): ("SHIFT", 27), (30, G["case"]): ("SHIFT", 21), - (30, G["int"]): ("SHIFT", 34), - (30, G["false"]): ("SHIFT", 26), - (30, G["new"]): ("SHIFT", 22), - (30, G["true"]): ("SHIFT", 25), + (30, G["if"]): ("SHIFT", 12), + (30, G["isvoid"]): ("SHIFT", 24), + (30, G["("]): ("SHIFT", 11), (30, G["let"]): ("SHIFT", 14), - (30, G["{"]): ("SHIFT", 10), + (30, G["false"]): ("SHIFT", 26), + (30, G["while"]): ("SHIFT", 13), (31, G["("]): ("SHIFT", 29), + (31, G["<-"]): ("SHIFT", 32), (31, G["-"]): ("REDUCE", G["atom -> id"]), (31, G["in"]): ("REDUCE", G["atom -> id"]), (31, G["*"]): ("REDUCE", G["atom -> id"]), @@ -297,64 +298,63 @@ def __action_table(): (31, G["@"]): ("REDUCE", G["atom -> id"]), (31, G["pool"]): ("REDUCE", G["atom -> id"]), (31, G["+"]): ("REDUCE", G["atom -> id"]), - (31, G["<-"]): ("SHIFT", 32), - (32, G["isvoid"]): ("SHIFT", 24), - (32, G["string"]): ("SHIFT", 33), - (32, G["while"]): ("SHIFT", 13), - (32, G["if"]): ("SHIFT", 12), + (32, G["new"]): ("SHIFT", 22), (32, G["not"]): ("SHIFT", 30), + (32, G["true"]): ("SHIFT", 25), (32, G["id"]): ("SHIFT", 31), - (32, G["("]): ("SHIFT", 11), + (32, G["int"]): ("SHIFT", 33), + (32, G["string"]): ("SHIFT", 34), + (32, G["{"]): ("SHIFT", 10), (32, G["~"]): ("SHIFT", 27), (32, G["case"]): ("SHIFT", 21), - (32, G["int"]): ("SHIFT", 34), - (32, G["false"]): ("SHIFT", 26), - (32, G["new"]): ("SHIFT", 22), - (32, G["true"]): ("SHIFT", 25), + (32, G["if"]): ("SHIFT", 12), + (32, G["isvoid"]): ("SHIFT", 24), + (32, G["("]): ("SHIFT", 11), (32, G["let"]): ("SHIFT", 14), - (32, G["{"]): ("SHIFT", 10), - (33, G["-"]): ("REDUCE", G["atom -> string"]), - (33, G["in"]): ("REDUCE", G["atom -> string"]), - (33, G["*"]): ("REDUCE", G["atom -> string"]), - (33, G["}"]): ("REDUCE", G["atom -> string"]), - (33, G["/"]): ("REDUCE", G["atom -> string"]), - (33, G["error"]): ("REDUCE", G["atom -> string"]), - (33, G["of"]): ("REDUCE", G["atom -> string"]), - (33, G["<"]): ("REDUCE", G["atom -> string"]), - (33, G[")"]): ("REDUCE", G["atom -> string"]), - (33, G["then"]): ("REDUCE", G["atom -> string"]), - (33, G["<="]): ("REDUCE", G["atom -> string"]), - (33, G["."]): ("REDUCE", G["atom -> string"]), - (33, G["else"]): ("REDUCE", G["atom -> string"]), - (33, G["="]): ("REDUCE", G["atom -> string"]), - (33, G[","]): ("REDUCE", G["atom -> string"]), - (33, G["fi"]): ("REDUCE", G["atom -> string"]), - (33, G[";"]): ("REDUCE", G["atom -> string"]), - (33, G["loop"]): ("REDUCE", G["atom -> string"]), - (33, G["@"]): ("REDUCE", G["atom -> string"]), - (33, G["pool"]): ("REDUCE", G["atom -> string"]), - (33, G["+"]): ("REDUCE", G["atom -> string"]), - (34, G["-"]): ("REDUCE", G["atom -> int"]), - (34, G["in"]): ("REDUCE", G["atom -> int"]), - (34, G["*"]): ("REDUCE", G["atom -> int"]), - (34, G["}"]): ("REDUCE", G["atom -> int"]), - (34, G["/"]): ("REDUCE", G["atom -> int"]), - (34, G["error"]): ("REDUCE", G["atom -> int"]), - (34, G["of"]): ("REDUCE", G["atom -> int"]), - (34, G["<"]): ("REDUCE", G["atom -> int"]), - (34, G[")"]): ("REDUCE", G["atom -> int"]), - (34, G["then"]): ("REDUCE", G["atom -> int"]), - (34, G["<="]): ("REDUCE", G["atom -> int"]), - (34, G["."]): ("REDUCE", G["atom -> int"]), - (34, G["else"]): ("REDUCE", G["atom -> int"]), - (34, G["="]): ("REDUCE", G["atom -> int"]), - (34, G[","]): ("REDUCE", G["atom -> int"]), - (34, G["fi"]): ("REDUCE", G["atom -> int"]), - (34, G[";"]): ("REDUCE", G["atom -> int"]), - (34, G["loop"]): ("REDUCE", G["atom -> int"]), - (34, G["@"]): ("REDUCE", G["atom -> int"]), - (34, G["pool"]): ("REDUCE", G["atom -> int"]), - (34, G["+"]): ("REDUCE", G["atom -> int"]), + (32, G["false"]): ("SHIFT", 26), + (32, G["while"]): ("SHIFT", 13), + (33, G["-"]): ("REDUCE", G["atom -> int"]), + (33, G["in"]): ("REDUCE", G["atom -> int"]), + (33, G["*"]): ("REDUCE", G["atom -> int"]), + (33, G["}"]): ("REDUCE", G["atom -> int"]), + (33, G["/"]): ("REDUCE", G["atom -> int"]), + (33, G["error"]): ("REDUCE", G["atom -> int"]), + (33, G["of"]): ("REDUCE", G["atom -> int"]), + (33, G["<"]): ("REDUCE", G["atom -> int"]), + (33, G[")"]): ("REDUCE", G["atom -> int"]), + (33, G["then"]): ("REDUCE", G["atom -> int"]), + (33, G["<="]): ("REDUCE", G["atom -> int"]), + (33, G["."]): ("REDUCE", G["atom -> int"]), + (33, G["else"]): ("REDUCE", G["atom -> int"]), + (33, G["="]): ("REDUCE", G["atom -> int"]), + (33, G[","]): ("REDUCE", G["atom -> int"]), + (33, G["fi"]): ("REDUCE", G["atom -> int"]), + (33, G[";"]): ("REDUCE", G["atom -> int"]), + (33, G["loop"]): ("REDUCE", G["atom -> int"]), + (33, G["@"]): ("REDUCE", G["atom -> int"]), + (33, G["pool"]): ("REDUCE", G["atom -> int"]), + (33, G["+"]): ("REDUCE", G["atom -> int"]), + (34, G["-"]): ("REDUCE", G["atom -> string"]), + (34, G["in"]): ("REDUCE", G["atom -> string"]), + (34, G["*"]): ("REDUCE", G["atom -> string"]), + (34, G["}"]): ("REDUCE", G["atom -> string"]), + (34, G["/"]): ("REDUCE", G["atom -> string"]), + (34, G["error"]): ("REDUCE", G["atom -> string"]), + (34, G["of"]): ("REDUCE", G["atom -> string"]), + (34, G["<"]): ("REDUCE", G["atom -> string"]), + (34, G[")"]): ("REDUCE", G["atom -> string"]), + (34, G["then"]): ("REDUCE", G["atom -> string"]), + (34, G["<="]): ("REDUCE", G["atom -> string"]), + (34, G["."]): ("REDUCE", G["atom -> string"]), + (34, G["else"]): ("REDUCE", G["atom -> string"]), + (34, G["="]): ("REDUCE", G["atom -> string"]), + (34, G[","]): ("REDUCE", G["atom -> string"]), + (34, G["fi"]): ("REDUCE", G["atom -> string"]), + (34, G[";"]): ("REDUCE", G["atom -> string"]), + (34, G["loop"]): ("REDUCE", G["atom -> string"]), + (34, G["@"]): ("REDUCE", G["atom -> string"]), + (34, G["pool"]): ("REDUCE", G["atom -> string"]), + (34, G["+"]): ("REDUCE", G["atom -> string"]), (35, G["-"]): ("REDUCE", G["atom -> function-call"]), (35, G["in"]): ("REDUCE", G["atom -> function-call"]), (35, G["*"]): ("REDUCE", G["atom -> function-call"]), @@ -381,25 +381,27 @@ def __action_table(): (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), (36, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["}"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), (37, G["else"]): ("REDUCE", G["expr -> comp"]), (37, G["in"]): ("REDUCE", G["expr -> comp"]), (37, G[","]): ("REDUCE", G["expr -> comp"]), (37, G["fi"]): ("REDUCE", G["expr -> comp"]), (37, G["}"]): ("REDUCE", G["expr -> comp"]), - (37, G["error"]): ("REDUCE", G["expr -> comp"]), (37, G[";"]): ("REDUCE", G["expr -> comp"]), + (37, G["error"]): ("REDUCE", G["expr -> comp"]), (37, G["loop"]): ("REDUCE", G["expr -> comp"]), (37, G["of"]): ("REDUCE", G["expr -> comp"]), (37, G[")"]): ("REDUCE", G["expr -> comp"]), - (37, G["then"]): ("REDUCE", G["expr -> comp"]), (37, G["pool"]): ("REDUCE", G["expr -> comp"]), + (37, G["then"]): ("REDUCE", G["expr -> comp"]), + (38, G["<="]): ("SHIFT", 68), + (38, G["-"]): ("SHIFT", 64), (38, G["else"]): ("REDUCE", G["comp -> arith"]), (38, G["in"]): ("REDUCE", G["comp -> arith"]), (38, G[","]): ("REDUCE", G["comp -> arith"]), @@ -410,24 +412,22 @@ def __action_table(): (38, G["loop"]): ("REDUCE", G["comp -> arith"]), (38, G["of"]): ("REDUCE", G["comp -> arith"]), (38, G[")"]): ("REDUCE", G["comp -> arith"]), - (38, G["then"]): ("REDUCE", G["comp -> arith"]), (38, G["pool"]): ("REDUCE", G["comp -> arith"]), - (38, G["+"]): ("SHIFT", 39), - (38, G["="]): ("SHIFT", 70), - (38, G["-"]): ("SHIFT", 64), + (38, G["then"]): ("REDUCE", G["comp -> arith"]), (38, G["<"]): ("SHIFT", 66), - (38, G["<="]): ("SHIFT", 68), - (39, G["isvoid"]): ("SHIFT", 24), - (39, G["int"]): ("SHIFT", 34), - (39, G["string"]): ("SHIFT", 33), - (39, G["false"]): ("SHIFT", 26), + (38, G["="]): ("SHIFT", 70), + (38, G["+"]): ("SHIFT", 39), + (39, G["new"]): ("SHIFT", 22), (39, G["id"]): ("SHIFT", 28), + (39, G["true"]): ("SHIFT", 25), + (39, G["isvoid"]): ("SHIFT", 24), + (39, G["int"]): ("SHIFT", 33), (39, G["("]): ("SHIFT", 11), - (39, G["new"]): ("SHIFT", 22), + (39, G["string"]): ("SHIFT", 34), + (39, G["false"]): ("SHIFT", 26), (39, G["~"]): ("SHIFT", 27), - (39, G["true"]): ("SHIFT", 25), - (40, G["/"]): ("SHIFT", 54), (40, G["*"]): ("SHIFT", 41), + (40, G["/"]): ("SHIFT", 54), (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), @@ -445,15 +445,15 @@ def __action_table(): (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), (40, G["+"]): ("REDUCE", G["arith -> arith + term"]), - (41, G["id"]): ("SHIFT", 28), (41, G["isvoid"]): ("SHIFT", 24), - (41, G["("]): ("SHIFT", 11), - (41, G["int"]): ("SHIFT", 34), - (41, G["string"]): ("SHIFT", 33), + (41, G["int"]): ("SHIFT", 33), + (41, G["string"]): ("SHIFT", 34), (41, G["new"]): ("SHIFT", 22), + (41, G["id"]): ("SHIFT", 28), + (41, G["("]): ("SHIFT", 11), + (41, G["false"]): ("SHIFT", 26), (41, G["~"]): ("SHIFT", 27), (41, G["true"]): ("SHIFT", 25), - (41, G["false"]): ("SHIFT", 26), (42, G["-"]): ("REDUCE", G["term -> term * factor"]), (42, G["in"]): ("REDUCE", G["term -> term * factor"]), (42, G["*"]): ("REDUCE", G["term -> term * factor"]), @@ -473,8 +473,6 @@ def __action_table(): (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), (42, G["pool"]): ("REDUCE", G["term -> term * factor"]), (42, G["+"]): ("REDUCE", G["term -> term * factor"]), - (43, G["@"]): ("SHIFT", 57), - (43, G["."]): ("SHIFT", 44), (43, G["-"]): ("REDUCE", G["factor -> atom"]), (43, G["in"]): ("REDUCE", G["factor -> atom"]), (43, G["*"]): ("REDUCE", G["factor -> atom"]), @@ -494,24 +492,26 @@ def __action_table(): (43, G["loop"]): ("REDUCE", G["factor -> atom"]), (43, G["pool"]): ("REDUCE", G["factor -> atom"]), (43, G["+"]): ("REDUCE", G["factor -> atom"]), + (43, G["."]): ("SHIFT", 44), + (43, G["@"]): ("SHIFT", 57), (44, G["id"]): ("SHIFT", 45), (45, G["("]): ("SHIFT", 46), - (46, G["while"]): ("SHIFT", 13), (46, G["id"]): ("SHIFT", 31), - (46, G["if"]): ("SHIFT", 12), + (46, G["{"]): ("SHIFT", 10), (46, G["~"]): ("SHIFT", 27), - (46, G["not"]): ("SHIFT", 30), (46, G["("]): ("SHIFT", 11), - (46, G["case"]): ("SHIFT", 21), - (46, G["int"]): ("SHIFT", 34), (46, G["false"]): ("SHIFT", 26), + (46, G[")"]): ("REDUCE", G["expr-list -> e"]), + (46, G["case"]): ("SHIFT", 21), + (46, G["if"]): ("SHIFT", 12), (46, G["new"]): ("SHIFT", 22), - (46, G["true"]): ("SHIFT", 25), (46, G["isvoid"]): ("SHIFT", 24), - (46, G["{"]): ("SHIFT", 10), + (46, G["true"]): ("SHIFT", 25), (46, G["let"]): ("SHIFT", 14), - (46, G["string"]): ("SHIFT", 33), - (46, G[")"]): ("REDUCE", G["expr-list -> e"]), + (46, G["while"]): ("SHIFT", 13), + (46, G["int"]): ("SHIFT", 33), + (46, G["string"]): ("SHIFT", 34), + (46, G["not"]): ("SHIFT", 30), (47, G[")"]): ("SHIFT", 48), (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), @@ -537,22 +537,24 @@ def __action_table(): (49, G[")"]): ("REDUCE", G["expr-list -> not-empty-expr-list"]), (50, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), (50, G[","]): ("SHIFT", 51), - (51, G["while"]): ("SHIFT", 13), (51, G["id"]): ("SHIFT", 31), - (51, G["if"]): ("SHIFT", 12), + (51, G["{"]): ("SHIFT", 10), (51, G["~"]): ("SHIFT", 27), - (51, G["not"]): ("SHIFT", 30), (51, G["("]): ("SHIFT", 11), - (51, G["case"]): ("SHIFT", 21), - (51, G["int"]): ("SHIFT", 34), (51, G["false"]): ("SHIFT", 26), + (51, G["case"]): ("SHIFT", 21), + (51, G["if"]): ("SHIFT", 12), (51, G["new"]): ("SHIFT", 22), - (51, G["true"]): ("SHIFT", 25), (51, G["isvoid"]): ("SHIFT", 24), - (51, G["{"]): ("SHIFT", 10), + (51, G["true"]): ("SHIFT", 25), (51, G["let"]): ("SHIFT", 14), - (51, G["string"]): ("SHIFT", 33), + (51, G["while"]): ("SHIFT", 13), + (51, G["int"]): ("SHIFT", 33), + (51, G["string"]): ("SHIFT", 34), + (51, G["not"]): ("SHIFT", 30), (52, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr , not-empty-expr-list"]), + (53, G["*"]): ("SHIFT", 41), + (53, G["/"]): ("SHIFT", 54), (53, G["in"]): ("REDUCE", G["arith -> term"]), (53, G["-"]): ("REDUCE", G["arith -> term"]), (53, G["}"]): ("REDUCE", G["arith -> term"]), @@ -570,17 +572,15 @@ def __action_table(): (53, G["loop"]): ("REDUCE", G["arith -> term"]), (53, G["pool"]): ("REDUCE", G["arith -> term"]), (53, G["+"]): ("REDUCE", G["arith -> term"]), - (53, G["/"]): ("SHIFT", 54), - (53, G["*"]): ("SHIFT", 41), - (54, G["id"]): ("SHIFT", 28), (54, G["isvoid"]): ("SHIFT", 24), - (54, G["("]): ("SHIFT", 11), - (54, G["int"]): ("SHIFT", 34), - (54, G["string"]): ("SHIFT", 33), + (54, G["int"]): ("SHIFT", 33), + (54, G["string"]): ("SHIFT", 34), (54, G["new"]): ("SHIFT", 22), + (54, G["id"]): ("SHIFT", 28), + (54, G["("]): ("SHIFT", 11), + (54, G["false"]): ("SHIFT", 26), (54, G["~"]): ("SHIFT", 27), (54, G["true"]): ("SHIFT", 25), - (54, G["false"]): ("SHIFT", 26), (55, G["-"]): ("REDUCE", G["term -> term / factor"]), (55, G["in"]): ("REDUCE", G["term -> term / factor"]), (55, G["*"]): ("REDUCE", G["term -> term / factor"]), @@ -623,22 +623,22 @@ def __action_table(): (58, G["."]): ("SHIFT", 59), (59, G["id"]): ("SHIFT", 60), (60, G["("]): ("SHIFT", 61), - (61, G["while"]): ("SHIFT", 13), (61, G["id"]): ("SHIFT", 31), - (61, G["if"]): ("SHIFT", 12), + (61, G["{"]): ("SHIFT", 10), (61, G["~"]): ("SHIFT", 27), - (61, G["not"]): ("SHIFT", 30), (61, G["("]): ("SHIFT", 11), - (61, G["case"]): ("SHIFT", 21), - (61, G["int"]): ("SHIFT", 34), (61, G["false"]): ("SHIFT", 26), + (61, G[")"]): ("REDUCE", G["expr-list -> e"]), + (61, G["case"]): ("SHIFT", 21), + (61, G["if"]): ("SHIFT", 12), (61, G["new"]): ("SHIFT", 22), - (61, G["true"]): ("SHIFT", 25), (61, G["isvoid"]): ("SHIFT", 24), - (61, G["{"]): ("SHIFT", 10), + (61, G["true"]): ("SHIFT", 25), (61, G["let"]): ("SHIFT", 14), - (61, G["string"]): ("SHIFT", 33), - (61, G[")"]): ("REDUCE", G["expr-list -> e"]), + (61, G["while"]): ("SHIFT", 13), + (61, G["int"]): ("SHIFT", 33), + (61, G["string"]): ("SHIFT", 34), + (61, G["not"]): ("SHIFT", 30), (62, G[")"]): ("SHIFT", 63), (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), @@ -661,15 +661,17 @@ def __action_table(): (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (64, G["isvoid"]): ("SHIFT", 24), - (64, G["int"]): ("SHIFT", 34), - (64, G["string"]): ("SHIFT", 33), - (64, G["false"]): ("SHIFT", 26), + (64, G["new"]): ("SHIFT", 22), (64, G["id"]): ("SHIFT", 28), + (64, G["true"]): ("SHIFT", 25), + (64, G["isvoid"]): ("SHIFT", 24), + (64, G["int"]): ("SHIFT", 33), (64, G["("]): ("SHIFT", 11), - (64, G["new"]): ("SHIFT", 22), + (64, G["string"]): ("SHIFT", 34), + (64, G["false"]): ("SHIFT", 26), (64, G["~"]): ("SHIFT", 27), - (64, G["true"]): ("SHIFT", 25), + (65, G["*"]): ("SHIFT", 41), + (65, G["/"]): ("SHIFT", 54), (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), (65, G["-"]): ("REDUCE", G["arith -> arith - term"]), (65, G["}"]): ("REDUCE", G["arith -> arith - term"]), @@ -687,17 +689,15 @@ def __action_table(): (65, G["loop"]): ("REDUCE", G["arith -> arith - term"]), (65, G["pool"]): ("REDUCE", G["arith -> arith - term"]), (65, G["+"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["/"]): ("SHIFT", 54), - (65, G["*"]): ("SHIFT", 41), - (66, G["string"]): ("SHIFT", 33), - (66, G["isvoid"]): ("SHIFT", 24), + (66, G["true"]): ("SHIFT", 25), + (66, G["("]): ("SHIFT", 11), + (66, G["int"]): ("SHIFT", 33), (66, G["false"]): ("SHIFT", 26), + (66, G["string"]): ("SHIFT", 34), (66, G["id"]): ("SHIFT", 28), - (66, G["("]): ("SHIFT", 11), - (66, G["new"]): ("SHIFT", 22), - (66, G["true"]): ("SHIFT", 25), + (66, G["isvoid"]): ("SHIFT", 24), (66, G["~"]): ("SHIFT", 27), - (66, G["int"]): ("SHIFT", 34), + (66, G["new"]): ("SHIFT", 22), (67, G["+"]): ("SHIFT", 39), (67, G["-"]): ("SHIFT", 64), (67, G["else"]): ("REDUCE", G["comp -> arith < arith"]), @@ -705,24 +705,24 @@ def __action_table(): (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), (67, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["}"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), - (68, G["string"]): ("SHIFT", 33), - (68, G["isvoid"]): ("SHIFT", 24), + (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), + (68, G["true"]): ("SHIFT", 25), + (68, G["("]): ("SHIFT", 11), + (68, G["int"]): ("SHIFT", 33), (68, G["false"]): ("SHIFT", 26), + (68, G["string"]): ("SHIFT", 34), (68, G["id"]): ("SHIFT", 28), - (68, G["("]): ("SHIFT", 11), - (68, G["new"]): ("SHIFT", 22), - (68, G["true"]): ("SHIFT", 25), + (68, G["isvoid"]): ("SHIFT", 24), (68, G["~"]): ("SHIFT", 27), - (68, G["int"]): ("SHIFT", 34), - (69, G["-"]): ("SHIFT", 64), + (68, G["new"]): ("SHIFT", 22), (69, G["+"]): ("SHIFT", 39), + (69, G["-"]): ("SHIFT", 64), (69, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), @@ -733,17 +733,19 @@ def __action_table(): (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), - (70, G["string"]): ("SHIFT", 33), - (70, G["isvoid"]): ("SHIFT", 24), + (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), + (70, G["true"]): ("SHIFT", 25), + (70, G["("]): ("SHIFT", 11), + (70, G["int"]): ("SHIFT", 33), (70, G["false"]): ("SHIFT", 26), + (70, G["string"]): ("SHIFT", 34), (70, G["id"]): ("SHIFT", 28), - (70, G["("]): ("SHIFT", 11), - (70, G["new"]): ("SHIFT", 22), - (70, G["true"]): ("SHIFT", 25), + (70, G["isvoid"]): ("SHIFT", 24), (70, G["~"]): ("SHIFT", 27), - (70, G["int"]): ("SHIFT", 34), + (70, G["new"]): ("SHIFT", 22), + (71, G["+"]): ("SHIFT", 39), + (71, G["-"]): ("SHIFT", 64), (71, G["else"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["in"]): ("REDUCE", G["comp -> arith = arith"]), (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), @@ -754,22 +756,20 @@ def __action_table(): (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["-"]): ("SHIFT", 64), - (71, G["+"]): ("SHIFT", 39), + (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), (72, G["else"]): ("REDUCE", G["expr -> not expr"]), - (72, G[","]): ("REDUCE", G["expr -> not expr"]), (72, G["in"]): ("REDUCE", G["expr -> not expr"]), + (72, G[","]): ("REDUCE", G["expr -> not expr"]), (72, G["fi"]): ("REDUCE", G["expr -> not expr"]), (72, G["}"]): ("REDUCE", G["expr -> not expr"]), - (72, G["error"]): ("REDUCE", G["expr -> not expr"]), (72, G[";"]): ("REDUCE", G["expr -> not expr"]), + (72, G["error"]): ("REDUCE", G["expr -> not expr"]), (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), (72, G["of"]): ("REDUCE", G["expr -> not expr"]), + (72, G["pool"]): ("REDUCE", G["expr -> not expr"]), (72, G[")"]): ("REDUCE", G["expr -> not expr"]), (72, G["then"]): ("REDUCE", G["expr -> not expr"]), - (72, G["pool"]): ("REDUCE", G["expr -> not expr"]), (73, G[")"]): ("SHIFT", 74), (74, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), @@ -835,28 +835,28 @@ def __action_table(): (79, G[":"]): ("SHIFT", 80), (80, G["type"]): ("SHIFT", 81), (81, G["=>"]): ("SHIFT", 82), - (82, G["case"]): ("SHIFT", 21), - (82, G["isvoid"]): ("SHIFT", 24), - (82, G["false"]): ("SHIFT", 26), - (82, G["id"]): ("SHIFT", 31), - (82, G["new"]): ("SHIFT", 22), (82, G["true"]): ("SHIFT", 25), - (82, G["~"]): ("SHIFT", 27), - (82, G["string"]): ("SHIFT", 33), - (82, G["{"]): ("SHIFT", 10), + (82, G["if"]): ("SHIFT", 12), + (82, G["int"]): ("SHIFT", 33), + (82, G["string"]): ("SHIFT", 34), + (82, G["id"]): ("SHIFT", 31), (82, G["let"]): ("SHIFT", 14), (82, G["while"]): ("SHIFT", 13), + (82, G["~"]): ("SHIFT", 27), (82, G["("]): ("SHIFT", 11), - (82, G["if"]): ("SHIFT", 12), (82, G["not"]): ("SHIFT", 30), - (82, G["int"]): ("SHIFT", 34), - (83, G[";"]): ("SHIFT", 84), + (82, G["false"]): ("SHIFT", 26), + (82, G["{"]): ("SHIFT", 10), + (82, G["isvoid"]): ("SHIFT", 24), + (82, G["new"]): ("SHIFT", 22), + (82, G["case"]): ("SHIFT", 21), (83, G["error"]): ("SHIFT", 86), + (83, G[";"]): ("SHIFT", 84), (84, G["id"]): ("SHIFT", 79), (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), - (86, G["id"]): ("SHIFT", 79), (86, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), + (86, G["id"]): ("SHIFT", 79), (87, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error case-list"]), (88, G["esac"]): ("SHIFT", 89), (89, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), @@ -869,56 +869,56 @@ def __action_table(): (89, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (90, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), (90, G[","]): ("SHIFT", 91), (91, G["id"]): ("SHIFT", 15), (92, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), (93, G["in"]): ("SHIFT", 94), - (94, G["isvoid"]): ("SHIFT", 24), - (94, G["string"]): ("SHIFT", 33), - (94, G["while"]): ("SHIFT", 13), - (94, G["if"]): ("SHIFT", 12), + (94, G["new"]): ("SHIFT", 22), (94, G["not"]): ("SHIFT", 30), + (94, G["true"]): ("SHIFT", 25), (94, G["id"]): ("SHIFT", 31), - (94, G["("]): ("SHIFT", 11), + (94, G["int"]): ("SHIFT", 33), + (94, G["string"]): ("SHIFT", 34), + (94, G["{"]): ("SHIFT", 10), (94, G["~"]): ("SHIFT", 27), (94, G["case"]): ("SHIFT", 21), - (94, G["int"]): ("SHIFT", 34), - (94, G["false"]): ("SHIFT", 26), - (94, G["new"]): ("SHIFT", 22), - (94, G["true"]): ("SHIFT", 25), + (94, G["if"]): ("SHIFT", 12), + (94, G["isvoid"]): ("SHIFT", 24), + (94, G["("]): ("SHIFT", 11), (94, G["let"]): ("SHIFT", 14), - (94, G["{"]): ("SHIFT", 10), + (94, G["false"]): ("SHIFT", 26), + (94, G["while"]): ("SHIFT", 13), (95, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (96, G["loop"]): ("SHIFT", 97), + (97, G["("]): ("SHIFT", 11), + (97, G["not"]): ("SHIFT", 30), + (97, G["false"]): ("SHIFT", 26), + (97, G["id"]): ("SHIFT", 31), + (97, G["~"]): ("SHIFT", 27), (97, G["new"]): ("SHIFT", 22), (97, G["{"]): ("SHIFT", 10), + (97, G["case"]): ("SHIFT", 21), (97, G["true"]): ("SHIFT", 25), + (97, G["if"]): ("SHIFT", 12), + (97, G["int"]): ("SHIFT", 33), + (97, G["string"]): ("SHIFT", 34), + (97, G["isvoid"]): ("SHIFT", 24), (97, G["let"]): ("SHIFT", 14), (97, G["while"]): ("SHIFT", 13), - (97, G["string"]): ("SHIFT", 33), - (97, G["isvoid"]): ("SHIFT", 24), - (97, G["if"]): ("SHIFT", 12), - (97, G["not"]): ("SHIFT", 30), - (97, G["id"]): ("SHIFT", 31), - (97, G["("]): ("SHIFT", 11), - (97, G["~"]): ("SHIFT", 27), - (97, G["case"]): ("SHIFT", 21), - (97, G["int"]): ("SHIFT", 34), - (97, G["false"]): ("SHIFT", 26), (98, G["pool"]): ("SHIFT", 99), (99, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), @@ -930,53 +930,53 @@ def __action_table(): (99, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (100, G["then"]): ("SHIFT", 101), - (101, G["string"]): ("SHIFT", 33), - (101, G["isvoid"]): ("SHIFT", 24), - (101, G["while"]): ("SHIFT", 13), - (101, G["if"]): ("SHIFT", 12), (101, G["id"]): ("SHIFT", 31), - (101, G["not"]): ("SHIFT", 30), - (101, G["("]): ("SHIFT", 11), - (101, G["~"]): ("SHIFT", 27), + (101, G["int"]): ("SHIFT", 33), + (101, G["string"]): ("SHIFT", 34), + (101, G["{"]): ("SHIFT", 10), (101, G["case"]): ("SHIFT", 21), - (101, G["int"]): ("SHIFT", 34), + (101, G["~"]): ("SHIFT", 27), + (101, G["if"]): ("SHIFT", 12), + (101, G["("]): ("SHIFT", 11), (101, G["false"]): ("SHIFT", 26), + (101, G["while"]): ("SHIFT", 13), + (101, G["let"]): ("SHIFT", 14), + (101, G["isvoid"]): ("SHIFT", 24), (101, G["new"]): ("SHIFT", 22), (101, G["true"]): ("SHIFT", 25), - (101, G["{"]): ("SHIFT", 10), - (101, G["let"]): ("SHIFT", 14), + (101, G["not"]): ("SHIFT", 30), (102, G["else"]): ("SHIFT", 103), - (103, G["new"]): ("SHIFT", 22), (103, G["true"]): ("SHIFT", 25), - (103, G["let"]): ("SHIFT", 14), - (103, G["{"]): ("SHIFT", 10), - (103, G["string"]): ("SHIFT", 33), - (103, G["isvoid"]): ("SHIFT", 24), - (103, G["while"]): ("SHIFT", 13), + (103, G["~"]): ("SHIFT", 27), + (103, G["case"]): ("SHIFT", 21), + (103, G["int"]): ("SHIFT", 33), (103, G["id"]): ("SHIFT", 31), + (103, G["string"]): ("SHIFT", 34), (103, G["if"]): ("SHIFT", 12), - (103, G["not"]): ("SHIFT", 30), + (103, G["isvoid"]): ("SHIFT", 24), + (103, G["let"]): ("SHIFT", 14), + (103, G["while"]): ("SHIFT", 13), (103, G["("]): ("SHIFT", 11), - (103, G["~"]): ("SHIFT", 27), - (103, G["int"]): ("SHIFT", 34), - (103, G["case"]): ("SHIFT", 21), (103, G["false"]): ("SHIFT", 26), + (103, G["not"]): ("SHIFT", 30), + (103, G["new"]): ("SHIFT", 22), + (103, G["{"]): ("SHIFT", 10), (104, G["fi"]): ("SHIFT", 105), (105, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (106, G[")"]): ("SHIFT", 107), (107, G["-"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["in"]): ("REDUCE", G["atom -> ( expr )"]), @@ -1010,119 +1010,119 @@ def __action_table(): (109, G["loop"]): ("REDUCE", G["expr -> { block }"]), (109, G["of"]): ("REDUCE", G["expr -> { block }"]), (109, G[")"]): ("REDUCE", G["expr -> { block }"]), - (109, G["then"]): ("REDUCE", G["expr -> { block }"]), (109, G["pool"]): ("REDUCE", G["expr -> { block }"]), - (110, G[";"]): ("SHIFT", 111), + (109, G["then"]): ("REDUCE", G["expr -> { block }"]), (110, G["error"]): ("SHIFT", 113), - (111, G["case"]): ("SHIFT", 21), - (111, G["isvoid"]): ("SHIFT", 24), - (111, G["false"]): ("SHIFT", 26), - (111, G["id"]): ("SHIFT", 31), - (111, G["new"]): ("SHIFT", 22), + (110, G[";"]): ("SHIFT", 111), (111, G["true"]): ("SHIFT", 25), - (111, G["~"]): ("SHIFT", 27), - (111, G["string"]): ("SHIFT", 33), - (111, G["{"]): ("SHIFT", 10), + (111, G["if"]): ("SHIFT", 12), + (111, G["int"]): ("SHIFT", 33), + (111, G["string"]): ("SHIFT", 34), + (111, G["id"]): ("SHIFT", 31), (111, G["let"]): ("SHIFT", 14), (111, G["while"]): ("SHIFT", 13), (111, G["}"]): ("REDUCE", G["block -> expr ;"]), + (111, G["~"]): ("SHIFT", 27), (111, G["("]): ("SHIFT", 11), - (111, G["if"]): ("SHIFT", 12), (111, G["not"]): ("SHIFT", 30), - (111, G["int"]): ("SHIFT", 34), + (111, G["false"]): ("SHIFT", 26), + (111, G["{"]): ("SHIFT", 10), + (111, G["isvoid"]): ("SHIFT", 24), + (111, G["new"]): ("SHIFT", 22), + (111, G["case"]): ("SHIFT", 21), (112, G["}"]): ("REDUCE", G["block -> expr ; block"]), (113, G["}"]): ("REDUCE", G["block -> expr error"]), - (113, G["case"]): ("SHIFT", 21), - (113, G["isvoid"]): ("SHIFT", 24), - (113, G["false"]): ("SHIFT", 26), - (113, G["id"]): ("SHIFT", 31), - (113, G["new"]): ("SHIFT", 22), (113, G["true"]): ("SHIFT", 25), - (113, G["~"]): ("SHIFT", 27), - (113, G["string"]): ("SHIFT", 33), - (113, G["{"]): ("SHIFT", 10), + (113, G["if"]): ("SHIFT", 12), + (113, G["int"]): ("SHIFT", 33), + (113, G["string"]): ("SHIFT", 34), + (113, G["id"]): ("SHIFT", 31), (113, G["let"]): ("SHIFT", 14), (113, G["while"]): ("SHIFT", 13), + (113, G["~"]): ("SHIFT", 27), (113, G["("]): ("SHIFT", 11), - (113, G["if"]): ("SHIFT", 12), (113, G["not"]): ("SHIFT", 30), - (113, G["int"]): ("SHIFT", 34), + (113, G["false"]): ("SHIFT", 26), + (113, G["{"]): ("SHIFT", 10), + (113, G["isvoid"]): ("SHIFT", 24), + (113, G["new"]): ("SHIFT", 22), + (113, G["case"]): ("SHIFT", 21), (114, G["}"]): ("REDUCE", G["block -> expr error block"]), (115, G["}"]): ("SHIFT", 116), - (116, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), (116, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (116, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), (117, G[":"]): ("SHIFT", 118), (118, G["type"]): ("SHIFT", 119), - (119, G[","]): ("SHIFT", 120), (119, G[")"]): ("REDUCE", G["param-list -> id : type"]), + (119, G[","]): ("SHIFT", 120), (120, G["id"]): ("SHIFT", 117), (121, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), (122, G[")"]): ("SHIFT", 123), (123, G[":"]): ("SHIFT", 124), (124, G["type"]): ("SHIFT", 125), (125, G["{"]): ("SHIFT", 126), - (126, G["~"]): ("SHIFT", 27), - (126, G["false"]): ("SHIFT", 26), + (126, G["not"]): ("SHIFT", 30), (126, G["id"]): ("SHIFT", 31), (126, G["new"]): ("SHIFT", 22), + (126, G["{"]): ("SHIFT", 10), + (126, G["~"]): ("SHIFT", 27), (126, G["true"]): ("SHIFT", 25), + (126, G["case"]): ("SHIFT", 21), + (126, G["int"]): ("SHIFT", 33), + (126, G["string"]): ("SHIFT", 34), + (126, G["if"]): ("SHIFT", 12), + (126, G["isvoid"]): ("SHIFT", 24), (126, G["let"]): ("SHIFT", 14), - (126, G["{"]): ("SHIFT", 10), - (126, G["string"]): ("SHIFT", 33), (126, G["while"]): ("SHIFT", 13), - (126, G["isvoid"]): ("SHIFT", 24), (126, G["("]): ("SHIFT", 11), - (126, G["if"]): ("SHIFT", 12), - (126, G["not"]): ("SHIFT", 30), - (126, G["int"]): ("SHIFT", 34), - (126, G["case"]): ("SHIFT", 21), + (126, G["false"]): ("SHIFT", 26), (127, G["}"]): ("SHIFT", 128), - (128, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (128, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (128, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (129, G["type"]): ("SHIFT", 130), (130, G[";"]): ("REDUCE", G["attribute -> id : type"]), (130, G["error"]): ("REDUCE", G["attribute -> id : type"]), (130, G["<-"]): ("SHIFT", 131), - (131, G["case"]): ("SHIFT", 21), - (131, G["false"]): ("SHIFT", 26), - (131, G["isvoid"]): ("SHIFT", 24), - (131, G["id"]): ("SHIFT", 31), - (131, G["new"]): ("SHIFT", 22), (131, G["true"]): ("SHIFT", 25), - (131, G["~"]): ("SHIFT", 27), - (131, G["string"]): ("SHIFT", 33), - (131, G["{"]): ("SHIFT", 10), + (131, G["if"]): ("SHIFT", 12), + (131, G["int"]): ("SHIFT", 33), + (131, G["string"]): ("SHIFT", 34), + (131, G["id"]): ("SHIFT", 31), (131, G["let"]): ("SHIFT", 14), (131, G["while"]): ("SHIFT", 13), + (131, G["~"]): ("SHIFT", 27), (131, G["("]): ("SHIFT", 11), - (131, G["if"]): ("SHIFT", 12), (131, G["not"]): ("SHIFT", 30), - (131, G["int"]): ("SHIFT", 34), + (131, G["false"]): ("SHIFT", 26), + (131, G["{"]): ("SHIFT", 10), + (131, G["isvoid"]): ("SHIFT", 24), + (131, G["new"]): ("SHIFT", 22), + (131, G["case"]): ("SHIFT", 21), (132, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), (132, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), (133, G["}"]): ("SHIFT", 134), (134, G["class"]): ("REDUCE", G["class-def -> class type { feature-list }"]), (134, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), - (135, G[";"]): ("SHIFT", 136), (135, G["error"]): ("SHIFT", 143), - (136, G["}"]): ("REDUCE", G["feature-list -> e"]), + (135, G[";"]): ("SHIFT", 136), (136, G["id"]): ("SHIFT", 4), + (136, G["}"]): ("REDUCE", G["feature-list -> e"]), (137, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), - (138, G[";"]): ("SHIFT", 139), (138, G["error"]): ("SHIFT", 141), - (139, G["}"]): ("REDUCE", G["feature-list -> e"]), + (138, G[";"]): ("SHIFT", 139), (139, G["id"]): ("SHIFT", 4), + (139, G["}"]): ("REDUCE", G["feature-list -> e"]), (140, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), (141, G["id"]): ("SHIFT", 4), (141, G["}"]): ("REDUCE", G["feature-list -> e"]), (142, G["}"]): ("REDUCE", G["feature-list -> method error feature-list"]), - (143, G["}"]): ("REDUCE", G["feature-list -> e"]), (143, G["id"]): ("SHIFT", 4), + (143, G["}"]): ("REDUCE", G["feature-list -> e"]), (144, G["}"]): ("REDUCE", G["feature-list -> attribute error feature-list"]), (145, G["type"]): ("SHIFT", 146), (146, G["{"]): ("SHIFT", 147), - (147, G["}"]): ("REDUCE", G["feature-list -> e"]), (147, G["id"]): ("SHIFT", 4), + (147, G["}"]): ("REDUCE", G["feature-list -> e"]), (148, G["}"]): ("SHIFT", 149), (149, G["class"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), (149, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), @@ -1136,234 +1136,234 @@ def __action_table(): @staticmethod def __goto_table(): return { - (0, G["class-def"]): 152, (0, G["class-list"]): 151, (0, G["program"]): 150, - (3, G["method"]): 138, - (3, G["feature-list"]): 133, + (0, G["class-def"]): 152, (3, G["attribute"]): 135, + (3, G["feature-list"]): 133, + (3, G["method"]): 138, (5, G["param-list"]): 122, + (9, G["atom"]): 43, (9, G["arith"]): 38, + (9, G["term"]): 53, (9, G["function-call"]): 35, + (9, G["comp"]): 37, (9, G["expr"]): 115, - (9, G["atom"]): 43, - (9, G["term"]): 53, (9, G["factor"]): 56, - (9, G["comp"]): 37, - (10, G["expr"]): 110, - (10, G["factor"]): 56, - (10, G["arith"]): 38, - (10, G["function-call"]): 35, - (10, G["atom"]): 43, (10, G["term"]): 53, + (10, G["arith"]): 38, (10, G["block"]): 108, + (10, G["factor"]): 56, + (10, G["expr"]): 110, (10, G["comp"]): 37, + (10, G["function-call"]): 35, + (10, G["atom"]): 43, (11, G["arith"]): 38, - (11, G["expr"]): 106, (11, G["factor"]): 56, + (11, G["term"]): 53, (11, G["comp"]): 37, (11, G["atom"]): 43, + (11, G["expr"]): 106, (11, G["function-call"]): 35, - (11, G["term"]): 53, (12, G["function-call"]): 35, (12, G["arith"]): 38, - (12, G["factor"]): 56, + (12, G["expr"]): 100, (12, G["atom"]): 43, (12, G["term"]): 53, - (12, G["expr"]): 100, + (12, G["factor"]): 56, (12, G["comp"]): 37, - (13, G["function-call"]): 35, - (13, G["atom"]): 43, (13, G["arith"]): 38, (13, G["factor"]): 56, + (13, G["function-call"]): 35, (13, G["term"]): 53, (13, G["expr"]): 96, + (13, G["atom"]): 43, (13, G["comp"]): 37, (14, G["declaration-list"]): 93, (18, G["declaration-list"]): 19, - (20, G["atom"]): 43, - (20, G["arith"]): 38, (20, G["expr"]): 90, - (20, G["term"]): 53, + (20, G["arith"]): 38, + (20, G["atom"]): 43, (20, G["function-call"]): 35, - (20, G["comp"]): 37, + (20, G["term"]): 53, (20, G["factor"]): 56, + (20, G["comp"]): 37, + (21, G["expr"]): 77, + (21, G["atom"]): 43, (21, G["arith"]): 38, (21, G["term"]): 53, - (21, G["comp"]): 37, - (21, G["atom"]): 43, (21, G["factor"]): 56, (21, G["function-call"]): 35, - (21, G["expr"]): 77, + (21, G["comp"]): 37, (24, G["atom"]): 43, - (24, G["function-call"]): 35, (24, G["factor"]): 76, + (24, G["function-call"]): 35, + (27, G["factor"]): 75, (27, G["atom"]): 43, (27, G["function-call"]): 35, - (27, G["factor"]): 75, - (29, G["arith"]): 38, (29, G["atom"]): 43, - (29, G["comp"]): 37, - (29, G["term"]): 53, - (29, G["expr-list"]): 73, (29, G["expr"]): 50, + (29, G["term"]): 53, + (29, G["arith"]): 38, + (29, G["comp"]): 37, (29, G["not-empty-expr-list"]): 49, - (29, G["function-call"]): 35, (29, G["factor"]): 56, - (30, G["arith"]): 38, - (30, G["factor"]): 56, + (29, G["expr-list"]): 73, + (29, G["function-call"]): 35, (30, G["term"]): 53, - (30, G["comp"]): 37, + (30, G["arith"]): 38, + (30, G["function-call"]): 35, (30, G["atom"]): 43, + (30, G["comp"]): 37, (30, G["expr"]): 72, - (30, G["function-call"]): 35, - (32, G["arith"]): 38, - (32, G["factor"]): 56, + (30, G["factor"]): 56, (32, G["term"]): 53, - (32, G["comp"]): 37, - (32, G["atom"]): 43, - (32, G["function-call"]): 35, + (32, G["arith"]): 38, (32, G["expr"]): 36, - (39, G["factor"]): 56, + (32, G["function-call"]): 35, + (32, G["atom"]): 43, + (32, G["comp"]): 37, + (32, G["factor"]): 56, (39, G["term"]): 40, - (39, G["atom"]): 43, (39, G["function-call"]): 35, + (39, G["atom"]): 43, + (39, G["factor"]): 56, (41, G["atom"]): 43, - (41, G["function-call"]): 35, (41, G["factor"]): 42, - (46, G["arith"]): 38, + (41, G["function-call"]): 35, (46, G["atom"]): 43, (46, G["expr-list"]): 47, - (46, G["comp"]): 37, - (46, G["term"]): 53, (46, G["expr"]): 50, + (46, G["term"]): 53, + (46, G["arith"]): 38, + (46, G["comp"]): 37, (46, G["not-empty-expr-list"]): 49, - (46, G["function-call"]): 35, (46, G["factor"]): 56, - (51, G["arith"]): 38, + (46, G["function-call"]): 35, (51, G["atom"]): 43, + (51, G["expr"]): 50, + (51, G["term"]): 53, + (51, G["arith"]): 38, (51, G["not-empty-expr-list"]): 52, (51, G["comp"]): 37, - (51, G["term"]): 53, - (51, G["expr"]): 50, - (51, G["function-call"]): 35, (51, G["factor"]): 56, + (51, G["function-call"]): 35, (54, G["atom"]): 43, (54, G["function-call"]): 35, (54, G["factor"]): 55, - (61, G["arith"]): 38, + (61, G["expr-list"]): 62, (61, G["atom"]): 43, - (61, G["comp"]): 37, - (61, G["term"]): 53, (61, G["expr"]): 50, + (61, G["term"]): 53, + (61, G["arith"]): 38, + (61, G["comp"]): 37, (61, G["not-empty-expr-list"]): 49, - (61, G["function-call"]): 35, - (61, G["expr-list"]): 62, (61, G["factor"]): 56, - (64, G["factor"]): 56, + (61, G["function-call"]): 35, (64, G["term"]): 65, - (64, G["atom"]): 43, (64, G["function-call"]): 35, - (66, G["arith"]): 67, - (66, G["factor"]): 56, + (64, G["atom"]): 43, + (64, G["factor"]): 56, (66, G["term"]): 53, - (66, G["function-call"]): 35, + (66, G["arith"]): 67, (66, G["atom"]): 43, - (68, G["arith"]): 69, - (68, G["factor"]): 56, + (66, G["function-call"]): 35, + (66, G["factor"]): 56, (68, G["term"]): 53, - (68, G["function-call"]): 35, + (68, G["arith"]): 69, (68, G["atom"]): 43, - (70, G["arith"]): 71, - (70, G["factor"]): 56, + (68, G["function-call"]): 35, + (68, G["factor"]): 56, (70, G["term"]): 53, - (70, G["function-call"]): 35, + (70, G["arith"]): 71, (70, G["atom"]): 43, + (70, G["function-call"]): 35, + (70, G["factor"]): 56, (78, G["case-list"]): 88, + (82, G["term"]): 53, + (82, G["arith"]): 38, (82, G["expr"]): 83, (82, G["factor"]): 56, - (82, G["arith"]): 38, + (82, G["comp"]): 37, (82, G["function-call"]): 35, (82, G["atom"]): 43, - (82, G["term"]): 53, - (82, G["comp"]): 37, (84, G["case-list"]): 85, (86, G["case-list"]): 87, (91, G["declaration-list"]): 92, - (94, G["arith"]): 38, - (94, G["factor"]): 56, (94, G["term"]): 53, - (94, G["comp"]): 37, + (94, G["arith"]): 38, + (94, G["function-call"]): 35, (94, G["atom"]): 43, (94, G["expr"]): 95, - (94, G["function-call"]): 35, + (94, G["comp"]): 37, + (94, G["factor"]): 56, + (97, G["arith"]): 38, + (97, G["atom"]): 43, (97, G["term"]): 53, + (97, G["expr"]): 98, (97, G["function-call"]): 35, - (97, G["atom"]): 43, - (97, G["arith"]): 38, - (97, G["factor"]): 56, (97, G["comp"]): 37, - (97, G["expr"]): 98, - (101, G["arith"]): 38, - (101, G["factor"]): 56, - (101, G["comp"]): 37, - (101, G["atom"]): 43, - (101, G["term"]): 53, + (97, G["factor"]): 56, (101, G["function-call"]): 35, (101, G["expr"]): 102, + (101, G["atom"]): 43, + (101, G["arith"]): 38, + (101, G["term"]): 53, + (101, G["comp"]): 37, + (101, G["factor"]): 56, (103, G["term"]): 53, - (103, G["function-call"]): 35, (103, G["arith"]): 38, (103, G["atom"]): 43, - (103, G["factor"]): 56, + (103, G["function-call"]): 35, (103, G["comp"]): 37, (103, G["expr"]): 104, - (111, G["expr"]): 110, - (111, G["factor"]): 56, + (103, G["factor"]): 56, + (111, G["term"]): 53, (111, G["arith"]): 38, + (111, G["factor"]): 56, + (111, G["expr"]): 110, + (111, G["comp"]): 37, (111, G["function-call"]): 35, (111, G["atom"]): 43, - (111, G["term"]): 53, - (111, G["comp"]): 37, (111, G["block"]): 112, - (113, G["expr"]): 110, - (113, G["factor"]): 56, - (113, G["arith"]): 38, - (113, G["function-call"]): 35, - (113, G["atom"]): 43, (113, G["block"]): 114, (113, G["term"]): 53, + (113, G["arith"]): 38, + (113, G["factor"]): 56, + (113, G["expr"]): 110, (113, G["comp"]): 37, + (113, G["function-call"]): 35, + (113, G["atom"]): 43, (120, G["param-list"]): 121, - (126, G["arith"]): 38, - (126, G["function-call"]): 35, (126, G["atom"]): 43, + (126, G["arith"]): 38, + (126, G["expr"]): 127, (126, G["term"]): 53, - (126, G["factor"]): 56, + (126, G["function-call"]): 35, (126, G["comp"]): 37, - (126, G["expr"]): 127, - (131, G["factor"]): 56, + (126, G["factor"]): 56, + (131, G["term"]): 53, (131, G["arith"]): 38, + (131, G["factor"]): 56, + (131, G["comp"]): 37, (131, G["expr"]): 132, (131, G["function-call"]): 35, (131, G["atom"]): 43, - (131, G["term"]): 53, - (131, G["comp"]): 37, + (136, G["attribute"]): 135, (136, G["feature-list"]): 137, (136, G["method"]): 138, - (136, G["attribute"]): 135, - (139, G["method"]): 138, (139, G["attribute"]): 135, + (139, G["method"]): 138, (139, G["feature-list"]): 140, - (141, G["method"]): 138, (141, G["attribute"]): 135, + (141, G["method"]): 138, (141, G["feature-list"]): 142, - (143, G["method"]): 138, (143, G["feature-list"]): 144, (143, G["attribute"]): 135, + (143, G["method"]): 138, (147, G["feature-list"]): 148, - (147, G["method"]): 138, (147, G["attribute"]): 135, + (147, G["method"]): 138, (152, G["class-def"]): 152, (152, G["class-list"]): 153, } diff --git a/requirements.txt b/requirements.txt index f5a582276..315945f55 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -pyjapt~=0.2.6 +pyjapt~=0.2.8 typer~=0.3.2 \ No newline at end of file diff --git a/semantics/formatter.py b/semantics/formatter.py index 14598bb0c..0cb447b98 100644 --- a/semantics/formatter.py +++ b/semantics/formatter.py @@ -92,7 +92,8 @@ def visit(self, node: ast.BinaryNode, tabs: int = 0): @visitor.when(ast.AtomicNode) def visit(self, node: ast.AtomicNode, tabs: int = 0): - return ' ' * tabs + f'{node.lex}' + lex = node.lex + return ' ' * tabs + f'{lex}' @visitor.when(ast.InstantiateNode) def visit(self, node: ast.InstantiateNode, tabs: int = 0): diff --git a/tests/correct_programs/01_program.cl b/tests/execution/01_program.cl similarity index 100% rename from tests/correct_programs/01_program.cl rename to tests/execution/01_program.cl diff --git a/tests/correct_programs/02_program.cl b/tests/execution/02_program.cl similarity index 100% rename from tests/correct_programs/02_program.cl rename to tests/execution/02_program.cl diff --git a/tests/correct_programs/03_program.cl b/tests/execution/03_program.cl similarity index 100% rename from tests/correct_programs/03_program.cl rename to tests/execution/03_program.cl diff --git a/tests/correct_programs/04_program.cl b/tests/execution/04_program.cl similarity index 100% rename from tests/correct_programs/04_program.cl rename to tests/execution/04_program.cl diff --git a/tests/correct_programs/05_program.cl b/tests/execution/05_program.cl similarity index 100% rename from tests/correct_programs/05_program.cl rename to tests/execution/05_program.cl diff --git a/tests/correct_programs/06_program.cl b/tests/execution/06_program.cl similarity index 100% rename from tests/correct_programs/06_program.cl rename to tests/execution/06_program.cl diff --git a/tests/lexicographic_errors/comment1.cl b/tests/lexer/comment1.cl similarity index 100% rename from tests/lexicographic_errors/comment1.cl rename to tests/lexer/comment1.cl diff --git a/tests/lexer/comment1_error.txt b/tests/lexer/comment1_error.txt new file mode 100644 index 000000000..9fd7b8d67 --- /dev/null +++ b/tests/lexer/comment1_error.txt @@ -0,0 +1 @@ +(55, 46) - LexicographicError: EOF in comment diff --git a/tests/lexicographic_errors/iis1.cl b/tests/lexer/iis1.cl similarity index 100% rename from tests/lexicographic_errors/iis1.cl rename to tests/lexer/iis1.cl diff --git a/tests/lexer/iis1_error.txt b/tests/lexer/iis1_error.txt new file mode 100644 index 000000000..9e6d66cac --- /dev/null +++ b/tests/lexer/iis1_error.txt @@ -0,0 +1 @@ +(4, 2) - LexicographicError: ERROR "!" diff --git a/tests/lexicographic_errors/iis2.cl b/tests/lexer/iis2.cl similarity index 100% rename from tests/lexicographic_errors/iis2.cl rename to tests/lexer/iis2.cl diff --git a/tests/lexer/iis2_error.txt b/tests/lexer/iis2_error.txt new file mode 100644 index 000000000..922391a9d --- /dev/null +++ b/tests/lexer/iis2_error.txt @@ -0,0 +1 @@ +(10, 30) - LexicographicError: ERROR "?" diff --git a/tests/lexicographic_errors/iis3.cl b/tests/lexer/iis3.cl similarity index 100% rename from tests/lexicographic_errors/iis3.cl rename to tests/lexer/iis3.cl diff --git a/tests/lexer/iis3_error.txt b/tests/lexer/iis3_error.txt new file mode 100644 index 000000000..b001b6a71 --- /dev/null +++ b/tests/lexer/iis3_error.txt @@ -0,0 +1 @@ +(3, 40) - LexicographicError: ERROR "^" diff --git a/tests/lexicographic_errors/iis4.cl b/tests/lexer/iis4.cl similarity index 100% rename from tests/lexicographic_errors/iis4.cl rename to tests/lexer/iis4.cl diff --git a/tests/lexer/iis4_error.txt b/tests/lexer/iis4_error.txt new file mode 100644 index 000000000..df76d7c3f --- /dev/null +++ b/tests/lexer/iis4_error.txt @@ -0,0 +1 @@ +(6, 49) - LexicographicError: ERROR "%" diff --git a/tests/lexicographic_errors/iis5.cl b/tests/lexer/iis5.cl similarity index 100% rename from tests/lexicographic_errors/iis5.cl rename to tests/lexer/iis5.cl diff --git a/tests/lexicographic_errors/iis5_error.txt b/tests/lexer/iis5_error.txt similarity index 100% rename from tests/lexicographic_errors/iis5_error.txt rename to tests/lexer/iis5_error.txt diff --git a/tests/lexicographic_errors/iis6.cl b/tests/lexer/iis6.cl similarity index 100% rename from tests/lexicographic_errors/iis6.cl rename to tests/lexer/iis6.cl diff --git a/tests/lexicographic_errors/iis6_error.txt b/tests/lexer/iis6_error.txt similarity index 100% rename from tests/lexicographic_errors/iis6_error.txt rename to tests/lexer/iis6_error.txt diff --git a/tests/lexicographic_errors/mixed1.cl b/tests/lexer/mixed1.cl similarity index 100% rename from tests/lexicographic_errors/mixed1.cl rename to tests/lexer/mixed1.cl diff --git a/tests/lexicographic_errors/mixed1_error.txt b/tests/lexer/mixed1_error.txt similarity index 100% rename from tests/lexicographic_errors/mixed1_error.txt rename to tests/lexer/mixed1_error.txt diff --git a/tests/lexicographic_errors/mixed2.cl b/tests/lexer/mixed2.cl similarity index 100% rename from tests/lexicographic_errors/mixed2.cl rename to tests/lexer/mixed2.cl diff --git a/tests/lexicographic_errors/mixed2_error.txt b/tests/lexer/mixed2_error.txt similarity index 100% rename from tests/lexicographic_errors/mixed2_error.txt rename to tests/lexer/mixed2_error.txt diff --git a/tests/lexicographic_errors/string1.cl b/tests/lexer/string1.cl similarity index 100% rename from tests/lexicographic_errors/string1.cl rename to tests/lexer/string1.cl diff --git a/tests/lexicographic_errors/string1_error.txt b/tests/lexer/string1_error.txt similarity index 100% rename from tests/lexicographic_errors/string1_error.txt rename to tests/lexer/string1_error.txt diff --git a/tests/lexicographic_errors/string2.cl b/tests/lexer/string2.cl similarity index 100% rename from tests/lexicographic_errors/string2.cl rename to tests/lexer/string2.cl diff --git a/tests/lexicographic_errors/string2_error.txt b/tests/lexer/string2_error.txt similarity index 100% rename from tests/lexicographic_errors/string2_error.txt rename to tests/lexer/string2_error.txt diff --git a/tests/lexicographic_errors/string3.cl b/tests/lexer/string3.cl similarity index 100% rename from tests/lexicographic_errors/string3.cl rename to tests/lexer/string3.cl diff --git a/tests/lexicographic_errors/string3_error.txt b/tests/lexer/string3_error.txt similarity index 100% rename from tests/lexicographic_errors/string3_error.txt rename to tests/lexer/string3_error.txt diff --git a/tests/lexicographic_errors/string4.cl b/tests/lexer/string4.cl similarity index 100% rename from tests/lexicographic_errors/string4.cl rename to tests/lexer/string4.cl diff --git a/tests/lexicographic_errors/string4_error.txt b/tests/lexer/string4_error.txt similarity index 100% rename from tests/lexicographic_errors/string4_error.txt rename to tests/lexer/string4_error.txt diff --git a/tests/lexicographic_errors/comment1_error.txt b/tests/lexicographic_errors/comment1_error.txt deleted file mode 100644 index 0207a66d5..000000000 --- a/tests/lexicographic_errors/comment1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(55, 46) - LexicographicError: EOF in comment \ No newline at end of file diff --git a/tests/lexicographic_errors/iis1_error.txt b/tests/lexicographic_errors/iis1_error.txt deleted file mode 100644 index a1d71cc56..000000000 --- a/tests/lexicographic_errors/iis1_error.txt +++ /dev/null @@ -1 +0,0 @@ -(4, 2) - LexicographicError: ERROR "!" \ No newline at end of file diff --git a/tests/lexicographic_errors/iis2_error.txt b/tests/lexicographic_errors/iis2_error.txt deleted file mode 100644 index f805d48c4..000000000 --- a/tests/lexicographic_errors/iis2_error.txt +++ /dev/null @@ -1 +0,0 @@ -(10, 30) - LexicographicError: ERROR "?" \ No newline at end of file diff --git a/tests/lexicographic_errors/iis3_error.txt b/tests/lexicographic_errors/iis3_error.txt deleted file mode 100644 index 5afcabe9a..000000000 --- a/tests/lexicographic_errors/iis3_error.txt +++ /dev/null @@ -1 +0,0 @@ -(3, 40) - LexicographicError: ERROR "^" \ No newline at end of file diff --git a/tests/lexicographic_errors/iis4_error.txt b/tests/lexicographic_errors/iis4_error.txt deleted file mode 100644 index 9c401173d..000000000 --- a/tests/lexicographic_errors/iis4_error.txt +++ /dev/null @@ -1 +0,0 @@ -(6, 49) - LexicographicError: ERROR "!" \ No newline at end of file diff --git a/tests/parser/assignment1.cl b/tests/parser/assignment1.cl new file mode 100644 index 000000000..a5328005d --- /dev/null +++ b/tests/parser/assignment1.cl @@ -0,0 +1,37 @@ +(* An assignment has the form <- *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(): String { + Test1 <- "Hello World" -- Identifiers begin with a lower case letter + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/assignment1_error.txt b/tests/parser/assignment1_error.txt new file mode 100644 index 000000000..cef0d3946 --- /dev/null +++ b/tests/parser/assignment1_error.txt @@ -0,0 +1 @@ +(29, 9) - SyntacticError: ERROR at or near "Test1" \ No newline at end of file diff --git a/tests/parser/assignment2.cl b/tests/parser/assignment2.cl new file mode 100644 index 000000000..ec6b47405 --- /dev/null +++ b/tests/parser/assignment2.cl @@ -0,0 +1,37 @@ +(* An assignment has the form <- *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 - 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(): Int { + test1 <-- ~(1 + 2 + 3 + 4 + 5) -- The left side must be an expression + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/assignment2_error.txt b/tests/parser/assignment2_error.txt new file mode 100644 index 000000000..dc611c159 --- /dev/null +++ b/tests/parser/assignment2_error.txt @@ -0,0 +1 @@ +(29, 17) - SyntacticError: ERROR at or near "-" \ No newline at end of file diff --git a/tests/parser/assignment3.cl b/tests/parser/assignment3.cl new file mode 100644 index 000000000..81d514e80 --- /dev/null +++ b/tests/parser/assignment3.cl @@ -0,0 +1,37 @@ +(* An assignment has the form <- *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(): Bool { + test1 <- true++ -- The left side must be an expression + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/assignment3_error.txt b/tests/parser/assignment3_error.txt new file mode 100644 index 000000000..d181a27d6 --- /dev/null +++ b/tests/parser/assignment3_error.txt @@ -0,0 +1,2 @@ +(29, 23) - SyntacticError: ERROR at or near "+" +(34, 13) - SyntacticError: ERROR at or near ":" \ No newline at end of file diff --git a/tests/parser/attribute1.cl b/tests/parser/attribute1.cl new file mode 100644 index 000000000..d2077acf3 --- /dev/null +++ b/tests/parser/attribute1.cl @@ -0,0 +1,34 @@ +(* An attribute of class A specifies a variable that is part of the state of objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + -- Attributes names must begin with lowercase letters + Test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/attribute1_error.txt b/tests/parser/attribute1_error.txt new file mode 100644 index 000000000..a4e9eb060 --- /dev/null +++ b/tests/parser/attribute1_error.txt @@ -0,0 +1 @@ +(17, 5) - SyntacticError: ERROR at or near "Test2" \ No newline at end of file diff --git a/tests/parser/attribute2.cl b/tests/parser/attribute2.cl new file mode 100644 index 000000000..aae02e2fd --- /dev/null +++ b/tests/parser/attribute2.cl @@ -0,0 +1,34 @@ +(* An attribute of class A specifies a variable that is part of the state of objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + -- Type names must begin with uppercase letters + test3: string <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/attribute2_error.txt b/tests/parser/attribute2_error.txt new file mode 100644 index 000000000..2db177c52 --- /dev/null +++ b/tests/parser/attribute2_error.txt @@ -0,0 +1,6 @@ +(19, 12) - SyntacticError: ERROR at or near "string" +(21, 22) - SyntacticError: ERROR at or near "," +(21, 22) - SyntacticError: Expected ';' instead of ','. +(21, 30) - SyntacticError: ERROR at or near ")" +(21, 30) - SyntacticError: Expected ';' instead of ')'. +(23, 6) - SyntacticError: ERROR at or near ";" \ No newline at end of file diff --git a/tests/parser/attribute3.cl b/tests/parser/attribute3.cl new file mode 100644 index 000000000..0ad3f7178 --- /dev/null +++ b/tests/parser/attribute3.cl @@ -0,0 +1,34 @@ +(* An attribute of class A specifies a variable that is part of the state of objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + -- Expected '<-' not '<=' + test3: String <= "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/attribute3_error.txt b/tests/parser/attribute3_error.txt new file mode 100644 index 000000000..e01a55336 --- /dev/null +++ b/tests/parser/attribute3_error.txt @@ -0,0 +1,2 @@ +(19, 19) - SyntacticError: ERROR at or near "<=" +(19, 19) - SyntacticError: Expected ';' instead of '<='. \ No newline at end of file diff --git a/tests/parser/block1.cl b/tests/parser/block1.cl new file mode 100644 index 000000000..74d6da19d --- /dev/null +++ b/tests/parser/block1.cl @@ -0,0 +1,87 @@ +(* A block has the form { ; ... ; } *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + } + + pow: Int <- 1; + count: Int <- 0; + + testing6(a: Int): IO { + { + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2 -- Missing ";" + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/block1_error.txt b/tests/parser/block1_error.txt new file mode 100644 index 000000000..262700783 --- /dev/null +++ b/tests/parser/block1_error.txt @@ -0,0 +1,4 @@ +(33, 9) - SyntacticError: ERROR at or near "If" +(33, 36) - SyntacticError: ERROR at or near "THeN" +(44, 5) - SyntacticError: Expected ';' instead of 'pow'. +(56, 17) - SyntacticError: Expected ';' instead of '}'. \ No newline at end of file diff --git a/tests/parser/block2.cl b/tests/parser/block2.cl new file mode 100644 index 000000000..aef2c5f45 --- /dev/null +++ b/tests/parser/block2.cl @@ -0,0 +1,87 @@ +(* A block has the form { ; ... ; } *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + pow: Int <- 1; + count: Int <- 0; + + testing6(a: Int): IO { + -- Missing "{" + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/block2_error.txt b/tests/parser/block2_error.txt new file mode 100644 index 000000000..3746ca995 --- /dev/null +++ b/tests/parser/block2_error.txt @@ -0,0 +1,8 @@ +(33, 9) - SyntacticError: ERROR at or near "If" +(33, 36) - SyntacticError: ERROR at or near "THeN" +(49, 23) - SyntacticError: ERROR at or near ";" +(57, 13) - SyntacticError: ERROR at or near "pool" +(57, 13) - SyntacticError: Expected ';' instead of 'pool'. +(58, 31) - SyntacticError: ERROR at or near ""El logaritmo en base 2 de "" +(58, 60) - SyntacticError: ERROR at or near "." +(64, 17) - SyntacticError: ERROR at or near "<-" \ No newline at end of file diff --git a/tests/parser/block3.cl b/tests/parser/block3.cl new file mode 100644 index 000000000..bfa3d0ad0 --- /dev/null +++ b/tests/parser/block3.cl @@ -0,0 +1,87 @@ +(* A block has the form { ; ... ; } *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + pow: Int <- 1; + count: Int <- 0; + + testing6(a: Int): IO { + { + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + -- Missing "}" + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/block3_error.txt b/tests/parser/block3_error.txt new file mode 100644 index 000000000..6df6aaea8 --- /dev/null +++ b/tests/parser/block3_error.txt @@ -0,0 +1,4 @@ +(33, 9) - SyntacticError: ERROR at or near "If" +(33, 36) - SyntacticError: ERROR at or near "THeN" +(57, 13) - SyntacticError: ERROR at or near "pool" +(60, 5) - SyntacticError: ERROR at or near "}" \ No newline at end of file diff --git a/tests/parser/block4.cl b/tests/parser/block4.cl new file mode 100644 index 000000000..a8a80dcd2 --- /dev/null +++ b/tests/parser/block4.cl @@ -0,0 +1,88 @@ +(* A block has the form { ; ... ; } *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + } + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + } + + testing3(): String { + "2 + 2" + } + + testing4(x: Int, y: Int): Test { + self + } + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + } + + pow: Int <- 1; + count: Int <- 0; + + testing6(a: Int): IO { + { + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + true++; -- Only expressions + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/block4_error.txt b/tests/parser/block4_error.txt new file mode 100644 index 000000000..85c39cec6 --- /dev/null +++ b/tests/parser/block4_error.txt @@ -0,0 +1,5 @@ +(7, 2) - SyntacticError: ERROR at or near ";" +(33, 9) - SyntacticError: ERROR at or near "If" +(33, 36) - SyntacticError: ERROR at or near "THeN" +(56, 26) - SyntacticError: ERROR at or near "+" +(61, 5) - SyntacticError: ERROR at or near "}" \ No newline at end of file diff --git a/tests/parser/case1.cl b/tests/parser/case1.cl new file mode 100644 index 000000000..e6ac19636 --- /dev/null +++ b/tests/parser/case1.cl @@ -0,0 +1,91 @@ +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + -- Every case expression must have at least one branch + esac + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/case1_error.txt b/tests/parser/case1_error.txt new file mode 100644 index 000000000..bdbf75e41 --- /dev/null +++ b/tests/parser/case1_error.txt @@ -0,0 +1,4 @@ +(33, 9) - SyntacticError: ERROR at or near "If" +(33, 36) - SyntacticError: ERROR at or near "THeN" +(63, 9) - SyntacticError: ERROR at or near "esac" +(68, 17) - SyntacticError: ERROR at or near "<-" \ No newline at end of file diff --git a/tests/parser/case2.cl b/tests/parser/case2.cl new file mode 100644 index 000000000..77cf79239 --- /dev/null +++ b/tests/parser/case2.cl @@ -0,0 +1,93 @@ +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case "2 + 2" of + x: Int => new IO.out_string("Es un entero!") -- Missing ";" + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/case2_error.txt b/tests/parser/case2_error.txt new file mode 100644 index 000000000..07a2da44b --- /dev/null +++ b/tests/parser/case2_error.txt @@ -0,0 +1,3 @@ +(33, 9) - SyntacticError: ERROR at or near "If" +(33, 36) - SyntacticError: ERROR at or near "THeN" +(63, 13) - SyntacticError: Expected ';' instead of 'y'. \ No newline at end of file diff --git a/tests/parser/case3.cl b/tests/parser/case3.cl new file mode 100644 index 000000000..09ca707a4 --- /dev/null +++ b/tests/parser/case3.cl @@ -0,0 +1,93 @@ +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + false of + x: Int => new IO.out_string("Es un entero!"); + y: string => new IO.out_string("Es una cadena!"); -- Type identifiers starts with a uppercase letter + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/case3_error.txt b/tests/parser/case3_error.txt new file mode 100644 index 000000000..582cb6b12 --- /dev/null +++ b/tests/parser/case3_error.txt @@ -0,0 +1,4 @@ +(33, 9) - SyntacticError: ERROR at or near "If" +(33, 36) - SyntacticError: ERROR at or near "THeN" +(63, 16) - SyntacticError: ERROR at or near "string" +(63, 32) - SyntacticError: ERROR at or near "." \ No newline at end of file diff --git a/tests/parser/case4.cl b/tests/parser/case4.cl new file mode 100644 index 000000000..7f85152ec --- /dev/null +++ b/tests/parser/case4.cl @@ -0,0 +1,93 @@ +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case true of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + Mazinger_Z: Bool => new IO.out_string("Es un booleano!"); -- Identifiers starts with a lowercase letter + esac + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/case4_error.txt b/tests/parser/case4_error.txt new file mode 100644 index 000000000..172d84953 --- /dev/null +++ b/tests/parser/case4_error.txt @@ -0,0 +1,5 @@ +(33, 9) - SyntacticError: ERROR at or near "If" +(33, 36) - SyntacticError: ERROR at or near "THeN" +(64, 13) - SyntacticError: ERROR at or near "Mazinger_Z" +(64, 50) - SyntacticError: ERROR at or near "(" +(70, 17) - SyntacticError: ERROR at or near "<-" \ No newline at end of file diff --git a/tests/parser/case5.cl b/tests/parser/case5.cl new file mode 100644 index 000000000..e6a40e2e9 --- /dev/null +++ b/tests/parser/case5.cl @@ -0,0 +1,93 @@ +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case test2 of + x: Int <- new IO.out_string("Es un entero!"); -- Must be '=>' not '<-'; + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/case5_error.txt b/tests/parser/case5_error.txt new file mode 100644 index 000000000..0ba3f05ba --- /dev/null +++ b/tests/parser/case5_error.txt @@ -0,0 +1,3 @@ +(33, 9) - SyntacticError: ERROR at or near "If" +(33, 36) - SyntacticError: ERROR at or near "THeN" +(62, 20) - SyntacticError: ERROR at or near "<-" \ No newline at end of file diff --git a/tests/parser/case6.cl b/tests/parser/case6.cl new file mode 100644 index 000000000..a40c58279 --- /dev/null +++ b/tests/parser/case6.cl @@ -0,0 +1,93 @@ +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 -- Missing "of" + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/case6_error.txt b/tests/parser/case6_error.txt new file mode 100644 index 000000000..116090c5f --- /dev/null +++ b/tests/parser/case6_error.txt @@ -0,0 +1,3 @@ +(33, 9) - SyntacticError: ERROR at or near "If" +(33, 36) - SyntacticError: ERROR at or near "THeN" +(62, 13) - SyntacticError: ERROR at or near "x" \ No newline at end of file diff --git a/tests/parser/class1.cl b/tests/parser/class1.cl new file mode 100644 index 000000000..b18724769 --- /dev/null +++ b/tests/parser/class1.cl @@ -0,0 +1,20 @@ +(* A class is a list of features *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + testing(): Int { + 2 + 2 + }; +} + +-- Class names must begin with uppercase letters +class alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} diff --git a/tests/parser/class1_error.txt b/tests/parser/class1_error.txt new file mode 100644 index 000000000..acaa52a6e --- /dev/null +++ b/tests/parser/class1_error.txt @@ -0,0 +1 @@ +(16, 7) - SyntacticError: ERROR at or near "alpha" \ No newline at end of file diff --git a/tests/parser/class2.cl b/tests/parser/class2.cl new file mode 100644 index 000000000..61a221752 --- /dev/null +++ b/tests/parser/class2.cl @@ -0,0 +1,20 @@ +(* A class is a list of features *) + +CLaSS Main { + main(): Object { + (new Alpha).print() + }; +} + +CLaSS Test { + testing(): Int { + 2 + 2 + }; +} + +-- Type names must begin with uppercase letters +CLaSS Alpha iNHeRiTS iO { + print() : Object { + out_string("reached!!\n") + }; +} diff --git a/tests/parser/class2_error.txt b/tests/parser/class2_error.txt new file mode 100644 index 000000000..fdbaeac40 --- /dev/null +++ b/tests/parser/class2_error.txt @@ -0,0 +1 @@ +(3, 1) - SyntacticError: ERROR at or near "CLaSS" \ No newline at end of file diff --git a/tests/parser/class3.cl b/tests/parser/class3.cl new file mode 100644 index 000000000..e7e337bef --- /dev/null +++ b/tests/parser/class3.cl @@ -0,0 +1,34 @@ +(* A class is a list of features *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + -- Missing semicolon + testing2(a: Alpha, b: Int): Int { + 2 + 2 + } + + testing3(): String { + "2 + 2" + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} diff --git a/tests/parser/class3_error.txt b/tests/parser/class3_error.txt new file mode 100644 index 000000000..4f048a930 --- /dev/null +++ b/tests/parser/class3_error.txt @@ -0,0 +1 @@ +(25, 5) - SyntacticError: Expected ';' instead of 'testing3'. \ No newline at end of file diff --git a/tests/parser/class4.cl b/tests/parser/class4.cl new file mode 100644 index 000000000..0db19aeea --- /dev/null +++ b/tests/parser/class4.cl @@ -0,0 +1,36 @@ +(* A class is a list of features *) + +CLaSS Main { + main(): Object { + (new Alpha).print() + }; +} + +CLaSS Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + -- Only features + 2 + 2; + + testing3(): String { + "2 + 2" + }; +} + +CLaSS Alpha iNHeRiTS IO { + print() : Object { + out_string("reached!!\n") + }; +} diff --git a/tests/parser/class4_error.txt b/tests/parser/class4_error.txt new file mode 100644 index 000000000..fdbaeac40 --- /dev/null +++ b/tests/parser/class4_error.txt @@ -0,0 +1 @@ +(3, 1) - SyntacticError: ERROR at or near "CLaSS" \ No newline at end of file diff --git a/tests/parser/class5.cl b/tests/parser/class5.cl new file mode 100644 index 000000000..2b7613efb --- /dev/null +++ b/tests/parser/class5.cl @@ -0,0 +1,34 @@ +(* A class is a list of features *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +-- Missing '{' +class Test + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} diff --git a/tests/parser/class5_error.txt b/tests/parser/class5_error.txt new file mode 100644 index 000000000..aace162bb --- /dev/null +++ b/tests/parser/class5_error.txt @@ -0,0 +1,3 @@ +(11, 5) - SyntacticError: ERROR at or near "test1" +(14, 9) - SyntacticError: ERROR at or near "2" +(15, 6) - SyntacticError: ERROR at or near ";" \ No newline at end of file diff --git a/tests/parser/class6.cl b/tests/parser/class6.cl new file mode 100644 index 000000000..dc34d4713 --- /dev/null +++ b/tests/parser/class6.cl @@ -0,0 +1,34 @@ +(* A class is a list of features *) + +CLaSS Main { + main(): Object { + (new Alpha).print() + }; +} + +-- Missing '}' +CLaSS Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +; + +CLaSS Alpha iNHeRiTS IO { + print() : Object { + out_string("reached!!\n") + }; +} diff --git a/tests/parser/class6_error.txt b/tests/parser/class6_error.txt new file mode 100644 index 000000000..fdbaeac40 --- /dev/null +++ b/tests/parser/class6_error.txt @@ -0,0 +1 @@ +(3, 1) - SyntacticError: ERROR at or near "CLaSS" \ No newline at end of file diff --git a/tests/parser/conditional1.cl b/tests/parser/conditional1.cl new file mode 100644 index 000000000..6b8ed7d98 --- /dev/null +++ b/tests/parser/conditional1.cl @@ -0,0 +1,69 @@ +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + if a.length() < b.length() -- Mising "then" + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + else + if a.length() = b.length() then + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + else + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fi + fi + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/conditional1_error.txt b/tests/parser/conditional1_error.txt new file mode 100644 index 000000000..27ef6b7aa --- /dev/null +++ b/tests/parser/conditional1_error.txt @@ -0,0 +1,2 @@ +(34, 13) - SyntacticError: ERROR at or near "new" +(41, 9) - SyntacticError: ERROR at or near "fi" \ No newline at end of file diff --git a/tests/parser/conditional2.cl b/tests/parser/conditional2.cl new file mode 100644 index 000000000..46350f878 --- /dev/null +++ b/tests/parser/conditional2.cl @@ -0,0 +1,69 @@ +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + if a.length() < b.length() then + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + else + if a.length() = b.length() then + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + else + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + -- Missing "fi" + fi + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/conditional2_error.txt b/tests/parser/conditional2_error.txt new file mode 100644 index 000000000..c72f78d7e --- /dev/null +++ b/tests/parser/conditional2_error.txt @@ -0,0 +1 @@ +(42, 5) - SyntacticError: ERROR at or near "}" \ No newline at end of file diff --git a/tests/parser/conditional3.cl b/tests/parser/conditional3.cl new file mode 100644 index 000000000..968ed91c0 --- /dev/null +++ b/tests/parser/conditional3.cl @@ -0,0 +1,69 @@ +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + iF a.length() < b.length() tHen + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + elsE + if a.length() = b.length() then + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + eLseif -- elseif isn't a keyword + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/conditional3_error.txt b/tests/parser/conditional3_error.txt new file mode 100644 index 000000000..c4fd3fe65 --- /dev/null +++ b/tests/parser/conditional3_error.txt @@ -0,0 +1 @@ +(33, 12) - SyntacticError: ERROR at or near "a" \ No newline at end of file diff --git a/tests/parser/conditional4.cl b/tests/parser/conditional4.cl new file mode 100644 index 000000000..c3f0ec957 --- /dev/null +++ b/tests/parser/conditional4.cl @@ -0,0 +1,73 @@ +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(): Int { + if true++ then 1 else 0 -- Condition must be an expression + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/conditional4_error.txt b/tests/parser/conditional4_error.txt new file mode 100644 index 000000000..5b26cba87 --- /dev/null +++ b/tests/parser/conditional4_error.txt @@ -0,0 +1,4 @@ +(33, 9) - SyntacticError: ERROR at or near "If" +(33, 36) - SyntacticError: ERROR at or near "THeN" +(45, 17) - SyntacticError: ERROR at or near "+" +(45, 26) - SyntacticError: ERROR at or near "else" \ No newline at end of file diff --git a/tests/parser/conditional5.cl b/tests/parser/conditional5.cl new file mode 100644 index 000000000..5009177a6 --- /dev/null +++ b/tests/parser/conditional5.cl @@ -0,0 +1,73 @@ +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(): Int { + if true then true++ else 0 -- If branch must be an expression + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/conditional5_error.txt b/tests/parser/conditional5_error.txt new file mode 100644 index 000000000..0fe41fbba --- /dev/null +++ b/tests/parser/conditional5_error.txt @@ -0,0 +1,4 @@ +(33, 9) - SyntacticError: ERROR at or near "If" +(33, 36) - SyntacticError: ERROR at or near "THeN" +(45, 27) - SyntacticError: ERROR at or near "+" +(46, 5) - SyntacticError: ERROR at or near "}" \ No newline at end of file diff --git a/tests/parser/conditional6.cl b/tests/parser/conditional6.cl new file mode 100644 index 000000000..a52fa555a --- /dev/null +++ b/tests/parser/conditional6.cl @@ -0,0 +1,73 @@ +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(): Int { + if true then 1 else false++ -- Else branch must be an expression + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/conditional6_error.txt b/tests/parser/conditional6_error.txt new file mode 100644 index 000000000..35f914c9e --- /dev/null +++ b/tests/parser/conditional6_error.txt @@ -0,0 +1,4 @@ +(33, 9) - SyntacticError: ERROR at or near "If" +(33, 36) - SyntacticError: ERROR at or near "THeN" +(45, 35) - SyntacticError: ERROR at or near "+" +(50, 10) - SyntacticError: ERROR at or near ":" \ No newline at end of file diff --git a/tests/parser/dispatch1.cl b/tests/parser/dispatch1.cl new file mode 100644 index 000000000..9c7fd628c --- /dev/null +++ b/tests/parser/dispatch1.cl @@ -0,0 +1,45 @@ +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + Test1.testing4(1, 2).testing4(3, 4).testing4(5, 6) -- Objet identifiers begin with a lower case letter + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/dispatch1_error.txt b/tests/parser/dispatch1_error.txt new file mode 100644 index 000000000..ba8e9e84c --- /dev/null +++ b/tests/parser/dispatch1_error.txt @@ -0,0 +1 @@ +(37, 9) - SyntacticError: ERROR at or near "Test1" \ No newline at end of file diff --git a/tests/parser/dispatch2.cl b/tests/parser/dispatch2.cl new file mode 100644 index 000000000..82fde8572 --- /dev/null +++ b/tests/parser/dispatch2.cl @@ -0,0 +1,45 @@ +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13,) -- Extra comma + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/dispatch2_error.txt b/tests/parser/dispatch2_error.txt new file mode 100644 index 000000000..c79560958 --- /dev/null +++ b/tests/parser/dispatch2_error.txt @@ -0,0 +1,6 @@ +(31, 2) - SyntacticError: ERROR at or near ";" +(37, 84) - SyntacticError: ERROR at or near ")" +(42, 13) - SyntacticError: ERROR at or near ":" +(42, 13) - SyntacticError: Expected ';' instead of ':'. +(44, 5) - SyntacticError: Expected ';' instead of '}'. +(45, 2) - SyntacticError: ERROR at or near "$" \ No newline at end of file diff --git a/tests/parser/dispatch4.cl b/tests/parser/dispatch4.cl new file mode 100644 index 000000000..3c6bf7c54 --- /dev/null +++ b/tests/parser/dispatch4.cl @@ -0,0 +1,53 @@ +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + self.testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true++) -- Arguments must be expressions + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/dispatch4_error.txt b/tests/parser/dispatch4_error.txt new file mode 100644 index 000000000..29e4c9077 --- /dev/null +++ b/tests/parser/dispatch4_error.txt @@ -0,0 +1,2 @@ +(45, 81) - SyntacticError: ERROR at or near "+" +(50, 13) - SyntacticError: ERROR at or near ":" \ No newline at end of file diff --git a/tests/parser/dispatch5.cl b/tests/parser/dispatch5.cl new file mode 100644 index 000000000..8d0916dc2 --- /dev/null +++ b/tests/parser/dispatch5.cl @@ -0,0 +1,53 @@ +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, ,true + fALSE) -- Extra comma + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/dispatch5_error.txt b/tests/parser/dispatch5_error.txt new file mode 100644 index 000000000..3fc39c625 --- /dev/null +++ b/tests/parser/dispatch5_error.txt @@ -0,0 +1 @@ +(45, 71) - SyntacticError: ERROR at or near "," \ No newline at end of file diff --git a/tests/parser/dispatch6.cl b/tests/parser/dispatch6.cl new file mode 100644 index 000000000..680af1623 --- /dev/null +++ b/tests/parser/dispatch6.cl @@ -0,0 +1,57 @@ +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@object.copy() -- Type identifiers begin with a upper case letter + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/dispatch6_error.txt b/tests/parser/dispatch6_error.txt new file mode 100644 index 000000000..9cc994bd6 --- /dev/null +++ b/tests/parser/dispatch6_error.txt @@ -0,0 +1,2 @@ +(49, 15) - SyntacticError: ERROR at or near "object" +(53, 13) - SyntacticError: ERROR at or near "inherits" \ No newline at end of file diff --git a/tests/parser/dispatch7.cl b/tests/parser/dispatch7.cl new file mode 100644 index 000000000..e66fb9973 --- /dev/null +++ b/tests/parser/dispatch7.cl @@ -0,0 +1,57 @@ +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.Copy() -- Identifiers begin with a lower case letter + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/dispatch7_error.txt b/tests/parser/dispatch7_error.txt new file mode 100644 index 000000000..daa6e0ee9 --- /dev/null +++ b/tests/parser/dispatch7_error.txt @@ -0,0 +1,2 @@ +(49, 22) - SyntacticError: ERROR at or near "Copy" +(54, 13) - SyntacticError: ERROR at or near ":" \ No newline at end of file diff --git a/tests/parser/dispatch8.cl b/tests/parser/dispatch8.cl new file mode 100644 index 000000000..6fb4a2977 --- /dev/null +++ b/tests/parser/dispatch8.cl @@ -0,0 +1,57 @@ +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy(,) -- Extra comma + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/dispatch8_error.txt b/tests/parser/dispatch8_error.txt new file mode 100644 index 000000000..04704520a --- /dev/null +++ b/tests/parser/dispatch8_error.txt @@ -0,0 +1 @@ +(49, 27) - SyntacticError: ERROR at or near "," \ No newline at end of file diff --git a/tests/parser/dispatch9.cl b/tests/parser/dispatch9.cl new file mode 100644 index 000000000..cf5f1f3fa --- /dev/null +++ b/tests/parser/dispatch9.cl @@ -0,0 +1,61 @@ +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; + + testing5(): Object { + test1:Object.copy() -- Must be '@' not ':' + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/dispatch9_error.txt b/tests/parser/dispatch9_error.txt new file mode 100644 index 000000000..eb0b3397d --- /dev/null +++ b/tests/parser/dispatch9_error.txt @@ -0,0 +1 @@ +(53, 14) - SyntacticError: ERROR at or near ":" \ No newline at end of file diff --git a/tests/parser/let1.cl b/tests/parser/let1.cl new file mode 100644 index 000000000..ec46917ba --- /dev/null +++ b/tests/parser/let1.cl @@ -0,0 +1,85 @@ +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let Count: Int <- 0, pow: Int <- 1 -- Object identifiers starts with a lowercase letter + in { + -- count <- 0; + -- pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/let1_error.txt b/tests/parser/let1_error.txt new file mode 100644 index 000000000..c9f6be187 --- /dev/null +++ b/tests/parser/let1_error.txt @@ -0,0 +1,3 @@ +(33, 9) - SyntacticError: ERROR at or near "If" +(33, 36) - SyntacticError: ERROR at or near "THeN" +(45, 13) - SyntacticError: ERROR at or near "Count" \ No newline at end of file diff --git a/tests/parser/let2.cl b/tests/parser/let2.cl new file mode 100644 index 000000000..43ffd4458 --- /dev/null +++ b/tests/parser/let2.cl @@ -0,0 +1,85 @@ +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int, pow: int <- 1 -- Type identifiers starts with a uppercase letter + in { + count <- 0; + -- pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/let2_error.txt b/tests/parser/let2_error.txt new file mode 100644 index 000000000..fe2892002 --- /dev/null +++ b/tests/parser/let2_error.txt @@ -0,0 +1,11 @@ +(33, 9) - SyntacticError: ERROR at or near "If" +(33, 36) - SyntacticError: ERROR at or near "THeN" +(45, 30) - SyntacticError: ERROR at or near "int" +(56, 19) - SyntacticError: ERROR at or near "." +(62, 28) - SyntacticError: ERROR at or near ";" +(65, 31) - SyntacticError: ERROR at or near "1" +(65, 46) - SyntacticError: ERROR at or near "(" +(68, 28) - SyntacticError: ERROR at or near ")" +(73, 25) - SyntacticError: ERROR at or near "1" +(73, 40) - SyntacticError: ERROR at or near "(" +(76, 24) - SyntacticError: ERROR at or near "{" \ No newline at end of file diff --git a/tests/parser/let3.cl b/tests/parser/let3.cl new file mode 100644 index 000000000..4d6d285a0 --- /dev/null +++ b/tests/parser/let3.cl @@ -0,0 +1,85 @@ +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int, pow: Int, -- Extra comma + in { + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/let3_error.txt b/tests/parser/let3_error.txt new file mode 100644 index 000000000..a6ffa2af2 --- /dev/null +++ b/tests/parser/let3_error.txt @@ -0,0 +1,11 @@ +(33, 9) - SyntacticError: ERROR at or near "If" +(33, 36) - SyntacticError: ERROR at or near "THeN" +(46, 9) - SyntacticError: ERROR at or near "in" +(47, 19) - SyntacticError: ERROR at or near "<-" +(62, 28) - SyntacticError: ERROR at or near ";" +(65, 31) - SyntacticError: ERROR at or near "1" +(65, 46) - SyntacticError: ERROR at or near "(" +(68, 28) - SyntacticError: ERROR at or near ")" +(73, 25) - SyntacticError: ERROR at or near "1" +(73, 40) - SyntacticError: ERROR at or near "(" +(76, 24) - SyntacticError: ERROR at or near "{" \ No newline at end of file diff --git a/tests/parser/let4.cl b/tests/parser/let4.cl new file mode 100644 index 000000000..a573dfc54 --- /dev/null +++ b/tests/parser/let4.cl @@ -0,0 +1,85 @@ +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- true++, pow: Int <- 1 -- Initialization must be an expression + in { + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/let4_error.txt b/tests/parser/let4_error.txt new file mode 100644 index 000000000..fad6aad4e --- /dev/null +++ b/tests/parser/let4_error.txt @@ -0,0 +1,4 @@ +(33, 9) - SyntacticError: ERROR at or near "If" +(33, 36) - SyntacticError: ERROR at or near "THeN" +(45, 32) - SyntacticError: ERROR at or near "+" +(45, 38) - SyntacticError: ERROR at or near ":" \ No newline at end of file diff --git a/tests/parser/let5.cl b/tests/parser/let5.cl new file mode 100644 index 000000000..065321bc2 --- /dev/null +++ b/tests/parser/let5.cl @@ -0,0 +1,85 @@ +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int = 0, pow: Int -- Must be '<-' not '=' + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/let5_error.txt b/tests/parser/let5_error.txt new file mode 100644 index 000000000..adcd1f51e --- /dev/null +++ b/tests/parser/let5_error.txt @@ -0,0 +1,3 @@ +(33, 9) - SyntacticError: ERROR at or near "If" +(33, 36) - SyntacticError: ERROR at or near "THeN" +(45, 24) - SyntacticError: ERROR at or near "=" \ No newline at end of file diff --git a/tests/parser/let6.cl b/tests/parser/let6.cl new file mode 100644 index 000000000..3cc11fe0c --- /dev/null +++ b/tests/parser/let6.cl @@ -0,0 +1,74 @@ +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int <- 1 + in false++ -- Let body must be an expression + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/let6_error.txt b/tests/parser/let6_error.txt new file mode 100644 index 000000000..78f3ae727 --- /dev/null +++ b/tests/parser/let6_error.txt @@ -0,0 +1,4 @@ +(33, 9) - SyntacticError: ERROR at or near "If" +(33, 36) - SyntacticError: ERROR at or near "THeN" +(46, 18) - SyntacticError: ERROR at or near "+" +(51, 10) - SyntacticError: ERROR at or near ":" \ No newline at end of file diff --git a/tests/parser/let7.cl b/tests/parser/let7.cl new file mode 100644 index 000000000..13fe301a9 --- /dev/null +++ b/tests/parser/let7.cl @@ -0,0 +1,85 @@ +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + (* Missing "in" *) { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/let7_error.txt b/tests/parser/let7_error.txt new file mode 100644 index 000000000..83302ad67 --- /dev/null +++ b/tests/parser/let7_error.txt @@ -0,0 +1,10 @@ +(33, 9) - SyntacticError: ERROR at or near "If" +(33, 36) - SyntacticError: ERROR at or near "THeN" +(46, 26) - SyntacticError: ERROR at or near "{" +(48, 21) - SyntacticError: ERROR at or near ";" +(65, 31) - SyntacticError: ERROR at or near "1" +(65, 46) - SyntacticError: ERROR at or near "(" +(68, 28) - SyntacticError: ERROR at or near ")" +(73, 25) - SyntacticError: ERROR at or near "1" +(73, 40) - SyntacticError: ERROR at or near "(" +(76, 24) - SyntacticError: ERROR at or near "{" \ No newline at end of file diff --git a/tests/parser/loop1.cl b/tests/parser/loop1.cl new file mode 100644 index 000000000..8d2c20ffe --- /dev/null +++ b/tests/parser/loop1.cl @@ -0,0 +1,78 @@ +(* A loop has the form while loop pool *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + count: Int <- 1; + + testing6(): Object { + while count < 1024*1024 + -- Missing "loop" + count <- count * 2 + pool + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/loop1_error.txt b/tests/parser/loop1_error.txt new file mode 100644 index 000000000..cba1dd47a --- /dev/null +++ b/tests/parser/loop1_error.txt @@ -0,0 +1,3 @@ +(33, 9) - SyntacticError: ERROR at or near "If" +(33, 36) - SyntacticError: ERROR at or near "THeN" +(49, 13) - SyntacticError: ERROR at or near "count" \ No newline at end of file diff --git a/tests/parser/loop2.cl b/tests/parser/loop2.cl new file mode 100644 index 000000000..435bf44b6 --- /dev/null +++ b/tests/parser/loop2.cl @@ -0,0 +1,78 @@ +(* A loop has the form while loop pool *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + count: Int <- 1; + + testing6(): Object { + while count < 1024*1024 + loop + count <- count * 2 + -- Missing "pool" + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/loop2_error.txt b/tests/parser/loop2_error.txt new file mode 100644 index 000000000..8a388a77b --- /dev/null +++ b/tests/parser/loop2_error.txt @@ -0,0 +1,3 @@ +(33, 9) - SyntacticError: ERROR at or near "If" +(33, 36) - SyntacticError: ERROR at or near "THeN" +(51, 5) - SyntacticError: ERROR at or near "}" \ No newline at end of file diff --git a/tests/parser/loop3.cl b/tests/parser/loop3.cl new file mode 100644 index 000000000..c8d99df13 --- /dev/null +++ b/tests/parser/loop3.cl @@ -0,0 +1,78 @@ +(* A loop has the form while loop pool *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + count: Int <- 1; + + testing6(): Object { + while count => 1024*1024 -- Condition must be an expression + loop + count <- count * 2 + pool + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/loop3_error.txt b/tests/parser/loop3_error.txt new file mode 100644 index 000000000..d248ebe3c --- /dev/null +++ b/tests/parser/loop3_error.txt @@ -0,0 +1,3 @@ +(33, 9) - SyntacticError: ERROR at or near "If" +(33, 36) - SyntacticError: ERROR at or near "THeN" +(47, 21) - SyntacticError: ERROR at or near "=>" \ No newline at end of file diff --git a/tests/parser/loop4.cl b/tests/parser/loop4.cl new file mode 100644 index 000000000..24923b3fd --- /dev/null +++ b/tests/parser/loop4.cl @@ -0,0 +1,78 @@ +(* A loop has the form while loop pool *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + count: Int <- 1; + + testing6(): Object { + while count < 1024*1024 + loop + count <- true++ -- While body must be an expression + pool + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/loop4_error.txt b/tests/parser/loop4_error.txt new file mode 100644 index 000000000..d3471ca9a --- /dev/null +++ b/tests/parser/loop4_error.txt @@ -0,0 +1,4 @@ +(33, 9) - SyntacticError: ERROR at or near "If" +(33, 36) - SyntacticError: ERROR at or near "THeN" +(49, 27) - SyntacticError: ERROR at or near "+" +(55, 10) - SyntacticError: ERROR at or near ":" \ No newline at end of file diff --git a/tests/parser/method1.cl b/tests/parser/method1.cl new file mode 100644 index 000000000..fa2dad596 --- /dev/null +++ b/tests/parser/method1.cl @@ -0,0 +1,34 @@ +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + -- Method names must begin with lowercase letters + Testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/method1_error.txt b/tests/parser/method1_error.txt new file mode 100644 index 000000000..ac3bd125c --- /dev/null +++ b/tests/parser/method1_error.txt @@ -0,0 +1,6 @@ +(21, 5) - SyntacticError: ERROR at or near "Testing2" +(21, 22) - SyntacticError: ERROR at or near "," +(21, 22) - SyntacticError: Expected ';' instead of ','. +(21, 30) - SyntacticError: ERROR at or near ")" +(21, 30) - SyntacticError: Expected ';' instead of ')'. +(23, 6) - SyntacticError: ERROR at or near ";" \ No newline at end of file diff --git a/tests/parser/method2.cl b/tests/parser/method2.cl new file mode 100644 index 000000000..aa806ed6a --- /dev/null +++ b/tests/parser/method2.cl @@ -0,0 +1,34 @@ +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + -- Parameter names must begin with lowercase letters + testing2(a: Alpha, B: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/method2_error.txt b/tests/parser/method2_error.txt new file mode 100644 index 000000000..663c8be47 --- /dev/null +++ b/tests/parser/method2_error.txt @@ -0,0 +1,3 @@ +(21, 24) - SyntacticError: ERROR at or near "B" +(25, 13) - SyntacticError: ERROR at or near "(" +(25, 24) - SyntacticError: ERROR at or near "{" \ No newline at end of file diff --git a/tests/parser/method3.cl b/tests/parser/method3.cl new file mode 100644 index 000000000..b14881635 --- /dev/null +++ b/tests/parser/method3.cl @@ -0,0 +1,34 @@ +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + -- Type names must begin with uppercase letters + testing2(a: Alpha, b: int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/method3_error.txt b/tests/parser/method3_error.txt new file mode 100644 index 000000000..e205cacb7 --- /dev/null +++ b/tests/parser/method3_error.txt @@ -0,0 +1,2 @@ +(21, 27) - SyntacticError: ERROR at or near "int" +(21, 37) - SyntacticError: ERROR at or near "{" \ No newline at end of file diff --git a/tests/parser/method4.cl b/tests/parser/method4.cl new file mode 100644 index 000000000..e2197c8b7 --- /dev/null +++ b/tests/parser/method4.cl @@ -0,0 +1,34 @@ +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + -- Missing paremeter + testing3(x: Int,): String { + "2 + 2" + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/method4_error.txt b/tests/parser/method4_error.txt new file mode 100644 index 000000000..6d3b4b7e2 --- /dev/null +++ b/tests/parser/method4_error.txt @@ -0,0 +1,4 @@ +(25, 21) - SyntacticError: ERROR at or near ")" +(31, 10) - SyntacticError: ERROR at or near "(" +(31, 22) - SyntacticError: ERROR at or near "{" +(33, 5) - SyntacticError: ERROR at or near "}" \ No newline at end of file diff --git a/tests/parser/method5.cl b/tests/parser/method5.cl new file mode 100644 index 000000000..8c97d8594 --- /dev/null +++ b/tests/parser/method5.cl @@ -0,0 +1,34 @@ +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + -- Type names must begin with uppercase letters + testing3(): string { + "2 + 2" + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/method5_error.txt b/tests/parser/method5_error.txt new file mode 100644 index 000000000..cf56396c5 --- /dev/null +++ b/tests/parser/method5_error.txt @@ -0,0 +1,3 @@ +(25, 17) - SyntacticError: ERROR at or near "string" +(30, 13) - SyntacticError: ERROR at or near "inherits" +(31, 13) - SyntacticError: ERROR at or near ":" \ No newline at end of file diff --git a/tests/parser/method6.cl b/tests/parser/method6.cl new file mode 100644 index 000000000..8c429c268 --- /dev/null +++ b/tests/parser/method6.cl @@ -0,0 +1,33 @@ +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + -- Body can't be empty + testing2(a: Alpha, b: Int): Int { + }; + + testing3(): String { + "2 + 2" + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/method6_error.txt b/tests/parser/method6_error.txt new file mode 100644 index 000000000..571673454 --- /dev/null +++ b/tests/parser/method6_error.txt @@ -0,0 +1,2 @@ +(22, 5) - SyntacticError: ERROR at or near "}" +(24, 15) - SyntacticError: ERROR at or near ":" \ No newline at end of file diff --git a/tests/parser/mixed2.cl b/tests/parser/mixed2.cl new file mode 100644 index 000000000..83e0d8d87 --- /dev/null +++ b/tests/parser/mixed2.cl @@ -0,0 +1,14 @@ +class Main { + main(): Object { + (new Alpha).print() + }; + +} + +(* Class names must begin with uppercase letters *) +class alpha inherits IO { + print() : Object { + out_string("reached!!\n"); + }; +} + diff --git a/tests/parser/mixed2_error.txt b/tests/parser/mixed2_error.txt new file mode 100644 index 000000000..88f12cfcb --- /dev/null +++ b/tests/parser/mixed2_error.txt @@ -0,0 +1,2 @@ +(9, 7) - SyntacticError: ERROR at or near "alpha" +(11, 38) - SyntacticError: ERROR at or near ";" \ No newline at end of file diff --git a/tests/parser/mixed3.cl b/tests/parser/mixed3.cl new file mode 100644 index 000000000..059b8bd35 --- /dev/null +++ b/tests/parser/mixed3.cl @@ -0,0 +1,40 @@ +class Main inherits IO { + main() : Object { + { + out_string("Enter a number to check if number is prime\n"); + let i : Int <- in_int() in { + if(i <= 1) then { + out_string("Invalid Input\n"); + abort(); + } else { + if (isPrime(i) = 1) then + out_string("Number is prime\n") + else + out_string("Number is composite\n") + fi; + } + fi; + }; + } + }; + + mod(i : Int, ) : Int { -- Formal list must be comma separated. A comma does not terminate a list of formals. + i - (i/k)*k + }; + + isPrime(i : Int) : Int { + { + let x : Int <- 2, + c : Int <- 1 in + { + while (not (x = i)) loop + if (mod(i, x) = 0) then { + c <- 0; + x <- i; + } else x <- x + 1 fi + pool; + c; + }; + } + }; +} diff --git a/tests/parser/mixed3_error.txt b/tests/parser/mixed3_error.txt new file mode 100644 index 000000000..dcc9d32d5 --- /dev/null +++ b/tests/parser/mixed3_error.txt @@ -0,0 +1,2 @@ +(21, 18) - SyntacticError: ERROR at or near ")" +(22, 9) - SyntacticError: ERROR at or near "-" \ No newline at end of file diff --git a/tests/parser/mixed4.cl b/tests/parser/mixed4.cl new file mode 100644 index 000000000..b50421791 --- /dev/null +++ b/tests/parser/mixed4.cl @@ -0,0 +1,21 @@ +class Main inherits IO { + main() : Object { + { + out_string("Enter number of numbers to multiply\n"); + out_int(prod(in_int())); + out_string("\n"); + } + }; + + prod(i : Int) : Int { + let y : Int <- 1 in { + while (not (i = 0) ) loop { + out_string("Enter Number: "); + y <- y * in_int(Main : Int); -- the parser correctly catches the error here + i <- i - 1; + } + pool; + y; + } + }; +} diff --git a/tests/parser/mixed4_error.txt b/tests/parser/mixed4_error.txt new file mode 100644 index 000000000..2349f28a5 --- /dev/null +++ b/tests/parser/mixed4_error.txt @@ -0,0 +1 @@ +(14, 41) - SyntacticError: ERROR at or near "Main" \ No newline at end of file diff --git a/tests/parser/mixed5.cl b/tests/parser/mixed5.cl new file mode 100644 index 000000000..c9176a890 --- /dev/null +++ b/tests/parser/mixed5.cl @@ -0,0 +1,20 @@ +class Main inherits IO { + str <- "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; + main() : Object { + { + out_string("Enter number of numbers to multiply\n"); + out_int(prod(in_int())); + out_string("\n"); + } + }; + prod(i : Int) : Int { + let y : Int <- 1 in { + while (not (i = 0) ) loop { + out_string("Enter Number: "); + y <- y * in_int(); + i <- i - 1; + } + y; + } + }; +} diff --git a/tests/parser/mixed5_error.txt b/tests/parser/mixed5_error.txt new file mode 100644 index 000000000..2c0ffd810 --- /dev/null +++ b/tests/parser/mixed5_error.txt @@ -0,0 +1,2 @@ +(2, 9) - SyntacticError: ERROR at or near "<-" +(17, 13) - SyntacticError: ERROR at or near "y" \ No newline at end of file diff --git a/tests/parser/mixed6.cl b/tests/parser/mixed6.cl new file mode 100644 index 000000000..5da80da31 --- /dev/null +++ b/tests/parser/mixed6.cl @@ -0,0 +1,5 @@ +classs Doom { + i : Int <- 0; + main() : Object { + if i = 0 then out_string("This is da real *h*t") + diff --git a/tests/parser/mixed6_error.txt b/tests/parser/mixed6_error.txt new file mode 100644 index 000000000..af75ca925 --- /dev/null +++ b/tests/parser/mixed6_error.txt @@ -0,0 +1 @@ +(1, 1) - SyntacticError: ERROR at or near "classs" \ No newline at end of file diff --git a/tests/parser/operation1.cl b/tests/parser/operation1.cl new file mode 100644 index 000000000..73a3ff053 --- /dev/null +++ b/tests/parser/operation1.cl @@ -0,0 +1,101 @@ +(* Cool has four binary arithmetic operations: +, -, *, /. *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; + + a: Int <- 1; + + testing8(x: Int, y: Int): Bool { + let z: Int <- 3, w: Int <- 4 + -- Missing ')' + in isvoid (3 + a * (x / w + new Int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a)/(0)*(((4 * 4))))) + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/operation1_error.txt b/tests/parser/operation1_error.txt new file mode 100644 index 000000000..7e8873924 --- /dev/null +++ b/tests/parser/operation1_error.txt @@ -0,0 +1,6 @@ +(33, 9) - SyntacticError: ERROR at or near "If" +(33, 36) - SyntacticError: ERROR at or near "THeN" +(73, 65) - SyntacticError: ERROR at or near "not" +(73, 115) - SyntacticError: ERROR at or near "+" +(74, 5) - SyntacticError: ERROR at or near "}" +(80, 15) - SyntacticError: ERROR at or near ":" \ No newline at end of file diff --git a/tests/parser/operation2.cl b/tests/parser/operation2.cl new file mode 100644 index 000000000..a3abea61d --- /dev/null +++ b/tests/parser/operation2.cl @@ -0,0 +1,101 @@ +(* Cool has four binary arithmetic operations: +, -, *, /. *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; + + a: Int <- 1; + + testing8(x: Int, y: Int): Bool { + let z: Int <- 3, w: Int <- 4 + -- Type identifiers starts with a uppercase letter + in isvoid (3 + a * (x / w + new int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/operation2_error.txt b/tests/parser/operation2_error.txt new file mode 100644 index 000000000..96ca10892 --- /dev/null +++ b/tests/parser/operation2_error.txt @@ -0,0 +1,5 @@ +(33, 9) - SyntacticError: ERROR at or near "If" +(33, 36) - SyntacticError: ERROR at or near "THeN" +(73, 41) - SyntacticError: ERROR at or near "int" +(77, 13) - SyntacticError: ERROR at or near "{" +(80, 15) - SyntacticError: ERROR at or near ":" \ No newline at end of file diff --git a/tests/parser/operation3.cl b/tests/parser/operation3.cl new file mode 100644 index 000000000..01d0b594e --- /dev/null +++ b/tests/parser/operation3.cl @@ -0,0 +1,101 @@ +(* Cool has four binary arithmetic operations: +, -, *, /. *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; + + a: Int <- 1; + + testing8(x: Int, y: Int): Bool { + let z: Int <- 3, w: Int <- 4 + -- Object identifiers starts with a lowercase letter + in isvoid (3 + a * (x / w + new Int) - y - (((if tRue = not faLSe then ~Mazinger_Z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/operation3_error.txt b/tests/parser/operation3_error.txt new file mode 100644 index 000000000..efe403bbe --- /dev/null +++ b/tests/parser/operation3_error.txt @@ -0,0 +1,5 @@ +(33, 9) - SyntacticError: ERROR at or near "If" +(33, 36) - SyntacticError: ERROR at or near "THeN" +(73, 65) - SyntacticError: ERROR at or near "not" +(73, 81) - SyntacticError: ERROR at or near "Mazinger_Z" +(73, 121) - SyntacticError: ERROR at or near "fi" \ No newline at end of file diff --git a/tests/parser/operation4.cl b/tests/parser/operation4.cl new file mode 100644 index 000000000..4e213d5af --- /dev/null +++ b/tests/parser/operation4.cl @@ -0,0 +1,101 @@ +(* Cool has four binary arithmetic operations: +, -, *, /. *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; + + a: Int <- 1; + + testing8(x: Int, y: Int): Bool { + let z: Int <- 3, w: Int <- 4 + -- Double "+" + in isvoid (3 + a * (x / w++ new Int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) + }; +} + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} \ No newline at end of file diff --git a/tests/parser/operation4_error.txt b/tests/parser/operation4_error.txt new file mode 100644 index 000000000..574e072f8 --- /dev/null +++ b/tests/parser/operation4_error.txt @@ -0,0 +1,5 @@ +(33, 9) - SyntacticError: ERROR at or near "If" +(33, 36) - SyntacticError: ERROR at or near "THeN" +(73, 35) - SyntacticError: ERROR at or near "+" +(73, 65) - SyntacticError: ERROR at or near "not" +(73, 115) - SyntacticError: ERROR at or near "+" \ No newline at end of file diff --git a/tests/parser/program1.cl b/tests/parser/program1.cl new file mode 100644 index 000000000..8e5cf617f --- /dev/null +++ b/tests/parser/program1.cl @@ -0,0 +1 @@ +(* A Cool program can't be empty *) \ No newline at end of file diff --git a/tests/parser/program1_error.txt b/tests/parser/program1_error.txt new file mode 100644 index 000000000..fc519f555 --- /dev/null +++ b/tests/parser/program1_error.txt @@ -0,0 +1 @@ +(1, 34) - SyntacticError: ERROR at or near "$" \ No newline at end of file diff --git a/tests/parser/program3.cl b/tests/parser/program3.cl new file mode 100644 index 000000000..c7d13f4db --- /dev/null +++ b/tests/parser/program3.cl @@ -0,0 +1,24 @@ +(* Cool programs are sets of classes *) + +class Main { + main(): Object { + (new Alpha).print() + }; +} + +class Test { + testing(): Int { + 2 + 2 + }; +} + +-- Only classes +suma(a: Int, b: Int) int { + a + b +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +} diff --git a/tests/parser/program3_error.txt b/tests/parser/program3_error.txt new file mode 100644 index 000000000..dd3b3947a --- /dev/null +++ b/tests/parser/program3_error.txt @@ -0,0 +1 @@ +(16, 1) - SyntacticError: ERROR at or near "suma" \ No newline at end of file diff --git a/tests/syntactic_and_semantic_errors/01_program.cl b/tests/semantic/01_program.cl similarity index 100% rename from tests/syntactic_and_semantic_errors/01_program.cl rename to tests/semantic/01_program.cl diff --git a/tests/syntactic_and_semantic_errors/01_result.txt b/tests/semantic/01_result.txt similarity index 100% rename from tests/syntactic_and_semantic_errors/01_result.txt rename to tests/semantic/01_result.txt diff --git a/tests/test_cool.py b/tests/test_cool.py index 7beea95fb..dcf85021a 100644 --- a/tests/test_cool.py +++ b/tests/test_cool.py @@ -1,5 +1,5 @@ from pathlib import Path -from typing import List +from typing import List, Tuple from lexertab import CoolLexer from parsertab import CoolParser @@ -33,68 +33,55 @@ def check_semantics(ast, scope: Scope, context: Context, errors: List[str]): return ast, scope, context, errors -def test_inference(): - paths = [] +def get_programs(folder_name: str) -> Tuple[List[str], List[str]]: programs = [] results = [] cwd = Path.cwd() - folder_name = 'inference' path = cwd / folder_name if str(cwd).endswith('tests') else cwd / 'tests' / folder_name for path in sorted(path.iterdir()): s = path.open('r').read() - if 'program' in path.name: + if path.name.endswith('.cl'): programs.append(s) - paths.append(path.name) else: results.append(s) - for path, code, result in zip(paths, programs, results): - tokens, _ = tokenize(code) - ast, _ = parse(tokens) - ast, scope, context, errors = check_semantics(ast, Scope(), Context(), []) - assert not errors and CodeBuilder().visit(ast, 0) == result + return programs, results -def test_syntactic_and_semantic_errors(): - paths = [] - programs = [] - results = [] +def test_lexer(): + programs, results = get_programs('lexer') + + for program, result in zip(programs, results): + tokens, lexer = tokenize(program) + assert lexer.contain_errors and '\n'.join(lexer.errors) == result.strip() - cwd = Path.cwd() - folder_name = 'syntactic_and_semantic_errors' - path = cwd / folder_name if str(cwd).endswith('tests') else cwd / 'tests' / folder_name - for path in sorted(path.iterdir()): - s = path.open('r').read() - if path.name.endswith('.cl'): - programs.append(s) - paths.append(path.name) - else: - results.append(s) - for path, code, result in zip(paths, programs, results): +def test_parser(): + programs, results = get_programs('parser') + + total = 20 + for code, result in zip(programs[total - 1:total], results[total - 1:total]): tokens, _ = tokenize(code) ast, parser = parse(tokens) - ast, _, _, errors = check_semantics(ast, Scope(), Context(), []) - assert '\n'.join(parser.errors + errors) == result, path + assert parser.contains_errors and '\n'.join(parser.errors) == result -def test_lexicographic_errors(): - paths = [] - programs = [] - results = [] +def test_inference(): + programs, results = get_programs('inference') + + for program, result in zip(programs, results): + tokens, _ = tokenize(program) + ast, _ = parse(tokens) + ast, _, _, errors = check_semantics(ast, Scope(), Context(), []) + assert not errors and CodeBuilder().visit(ast, 0) == result - cwd = Path.cwd() - folder_name = 'lexicographic_errors' - path = cwd / folder_name if str(cwd).endswith('tests') else cwd / 'tests' / folder_name - for path in sorted(path.iterdir())[:2 * 2]: - s = path.open('r').read() - if path.name.endswith('.cl'): - programs.append(s) - paths.append(path.name) - else: - results.append(s) - for path, code, result in zip(paths, programs, results): - tokens, lexer = tokenize(code) - assert lexer.contain_errors and '\n'.join(lexer.errors) == result.strip(), path +def test_semantic(): + programs, results = get_programs('semantic') + + for code, result in zip(programs, results): + tokens, _ = tokenize(code) + ast, parser = parse(tokens) + ast, _, _, errors = check_semantics(ast, Scope(), Context(), []) + assert (parser.contains_errors or errors) and '\n'.join(parser.errors + errors) == result From ddf1934dd6c758ff1874fd478b2092b108f9521c Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Wed, 21 Oct 2020 05:25:05 +0200 Subject: [PATCH 078/143] Info updated --- docs/Informe.md => Informe.md | 6 ++++++ 1 file changed, 6 insertions(+) rename docs/Informe.md => Informe.md (96%) diff --git a/docs/Informe.md b/Informe.md similarity index 96% rename from docs/Informe.md rename to Informe.md index dc09812f7..14f63bcf5 100644 --- a/docs/Informe.md +++ b/Informe.md @@ -35,6 +35,8 @@ - 3 Lexing y Parsing +- 4 Testing + ## 1 Inferencia de Tipos COOL es un lenguaje de programacion estaticamente tipado, y aunque el lenguaje no presenta inferencia de tipos esta es una caracteristica muy util que incorporaremos en un nuestro interprete. @@ -280,3 +282,7 @@ Se se puede apreciar existen 2 comandos principales: ## 3 Lexing y Parsing Para el proceso de lexing y parsing usamos el paquete de python `pyjapt` cuyos autores coinciden con los de este proyecto. + +## 4 Testing + +En la carpeta `tests` se encuentra las carpetas `execution`, `inference`, `lexer`, `parser`, `semantic` las cuales contienen casos de pruebas para correr todas las pruebas basta con hacer `pytest tests` y se probaran todos los casos menos los de la carpeta `execution`, la cual contiene programa en cool que deberan ser ejecutados a mano usando la cli-api de nuestro interprete. \ No newline at end of file From 66dd7e311f75e804adaffc62a10a80645cea39be Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Wed, 21 Oct 2020 05:31:01 +0200 Subject: [PATCH 079/143] update requirements.txt --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 315945f55..d8e4cf33f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ pyjapt~=0.2.8 -typer~=0.3.2 \ No newline at end of file +typer~=0.3.2 +pytest==6.1.1 \ No newline at end of file From 153ada09c86ce4ae9b933a35977057ddd0de9d01 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Tue, 24 Nov 2020 12:51:38 +0100 Subject: [PATCH 080/143] Informe corregido --- Informe.md | 166 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 107 insertions(+), 59 deletions(-) diff --git a/Informe.md b/Informe.md index 14f63bcf5..503c0a20a 100644 --- a/Informe.md +++ b/Informe.md @@ -1,17 +1,17 @@ -
+Segundo Proyecto de Compilación +=============================== -# Segundo Proyecto de Programacion +Título: +-------------------------------------------------------------------------------------------- +> Inferencia de tipos en el lenguaje de programación COOL, una aproximación a través de grafos. -## Inferencia de tipos en el lenguaje de programacion *COOL*, una aproximacion a través de grafos +Estudiantes: +----------- -## Estudiantes +> - Alejandro Klever Clemente C-311 +> - Miguel Angel Gonzalez Calles C-311 - - Alejandro Klever Clemente C-311 - - Miguel Angel Gonzalez Calles C-311 - -
- -## Indice +## Indice: - 1 Inferencia de tipos. @@ -21,7 +21,7 @@ - 1.3 Casos factibles. - - 1.3.1 Ejemplos de casos Factibles para la Inferencia. + - 1.3.1 Ejemplos de casos factibles para la inferencia. - 1.4 Casos No factibles. @@ -29,7 +29,7 @@ - 1.4.2 Casos Particulares. - - 1.5 expresiónes atomicas. + - 1.5 Expresiones atómicas. - 2 CLI-API @@ -37,32 +37,34 @@ - 4 Testing -## 1 Inferencia de Tipos +### 1 Inferencia de Tipos -COOL es un lenguaje de programacion estaticamente tipado, y aunque el lenguaje no presenta inferencia de tipos esta es una caracteristica muy util que incorporaremos en un nuestro interprete. +COOL es un lenguaje de programación estáticamente tipado, y aunque el lenguaje no presenta inferencia de tipos, esta es una característica muy util que incorporaremos en un nuestro intérprete. -Nuestro algoritmo de inferencia de tipos se apoya en el uso basico de la teoria de grafos y en el uso del patron de diseno visitor. +Nuestro algoritmo de inferencia de tipos se apoya en el uso básico de la teoría de grafos y en el uso del patrón de diseño visitor. -La inferencia de tipos de nuestro proyecto detecta para cada atributo, variable, parámetro de función o retorno de función el primer tipo que le puede ser asignado, modificando en el árbol de sintaxis abstracta el string `AUTO_TYPE` por el nombre del tipo correspondiente y asignando los tipos correspondientes en el contexto y el ambito en que seon declarados. +La inferencia de tipos de nuestro proyecto detecta para cada atributo, variable, parámetro de función o retorno de función el primer tipo que le puede ser asignado, modificando en el árbol de sintaxis abstracta el string `AUTO_TYPE` por el nombre del tipo correspondiente y asignando los tipos correspondientes en el contexto y el ámbito en que seon declarados. -### 1.1 Algoritmo y Grafo de Dependecias +#### 1.1 Algoritmo y Grafo de Dependecias -***Entrada :*** Un árbol de sintaxis abstracta, un contexto con todos los tipos declarados en el programa de COOL. +**Entrada :** Un árbol de sintaxis abstracta, un contexto con todos los tipos declarados en el programa de COOL. -***Salida :*** Un árbol de Sintaxis Abstracta, Un Contexto y un Scope con tipos bien tagueados. +**Salida :** Un árbol de Sintaxis Abstracta, Un Contexto y un Scope con tipos bien tagueados. -***Algoritmo :*** Durante el recorrido del AST será construido un grafo dirigido cuyos nodos encerrarán el concepto de las expresiónes marcadas como `AUTO_TYPE` y las aristas representan las dependencias entre las expresiónes de estos nodos para inferir su tipo. Sea `E1` una expresión cuyo tipo estático es marcado como `AUTO_TYPE`, y sea `E2` una expresión a partir de a cual se puede inferir el tipo de estático de E1 entonces en el grafo existira la arista ``. Una vez construido el árbol se comenzara una cadena de expansion de tipos estáticos de la forma `E1, E2, ..., En` donde `Ej` se infiere de `Ei` con `1 < j = i + 1 <= n` y `E1` es una expresión con tipo estático definido, al cual llamaremos atomo. Cuando todos los átomos se hayan propagado a traves del grafo los nodos que no hayan podido ser resueltos serán marcados como tipos `Object` al ser esta la clase mas general del lenguaje. +**Algoritmo :** Durante el recorrido del AST será construido un grafo dirigido cuyos nodos encerrarán el concepto de las expresiones marcadas como `AUTO_TYPE` y las aristas representan las dependencias entre las expresiones de estos nodos para inferir su tipo. Sea `E1` una expresión cuyo tipo estático es marcado como `AUTO_TYPE`, y sea `E2` una expresión a partir de a cual se puede inferir el tipo de estático de `E1` entonces en el grafo existirá la arista ``. Una vez construido el árbol se comenzará una cadena de expansión de tipos estáticos de la forma `E1, E2, ..., En` donde `Ej` se infiere de `Ei` con `1 < j = i + 1 <= n` y `E1` es una expresión con tipo estático definido, al cual llamaremos átomo. Cuando todos los átomos se hayan propagado a traves del grafo los nodos que no hayan podido ser resueltos serán marcados como tipos `Object` al ser esta la clase mas general del lenguaje. -### 1.2 Nodos de Dependencia +**Implementación :** Para eso creamos una estructura llamada `DependencyGraph` donde podemos crear nodos como una estructura llamada `DependencyNode` y arcos entre ellos. La estructura `DependencyGraph` consiste en un `OrderedDict` de nodos contra lista de adyacencia. Esta lista de adyacencia contiene los nodos a los cuales la llave propagar su tipo, estos nodos de la lista tienen un orden y esto es fundamental para el algoritmo de solución de inferencia. Si tenemos un caso `{x: [y, z]}` donde `x`, `y`, `z` son nodos, entonces el algoritmo determinará el tipo de `y` todas sus cadenas de expansión antes de comenzar con `z`, aunque si `z` forma parte de una cadena de expansión de `y` entonces `x` no propagará su tipo a `z` ya que otro nodo lo hizo antes (un DFS simple). -Cada nodo del grafo será una abstracción de un concepto en el que se use un tagueo explicito de `AUTO_TYPE` y tendra las referencias a las partes del proceso de semantica del programa, ademas de que cada nodo contara con un metodo `update(type)` el cual actualiza el tipo estático de estos conceptos. +#### 1.2 Nodos de Dependencia + +Cada nodo del grafo será una abstracción de un concepto en el que se use un tagueo explícito de `AUTO_TYPE` y tendrá las referencias a las partes del proceso de semántica del programa, además de que cada nodo contará con un método `update(type)` el cual actualiza el tipo estático de estos conceptos. ```python class DependencyNode: pass class AtomNode(DependencyNode): - """Nodo base el cual es creado a partir de expresiónes que + """Nodo base el cual es creado a partir de expresiones que contienen tipo estático u operaciones aritméticas""" pass @@ -83,25 +85,25 @@ class VariableInfoNode(DependencyNode): pass ``` -### 1.3 Casos factibles +#### 1.3 Casos factibles -Funcionando de manera análoga para atributos, variables, parámetros y retorno de funciones. Explicado de forma recursiva puede ser visto como: +El algoritmo funciona de manera análoga para atributos, variables, parámetros y retorno de funciones. Explicado de forma recursiva puede ser visto como: -- Un `AUTO_TYPE` será sustituido por su tipo correspodiente si este forma parte de una operacion que permita saber su tipo, o es asignado a una expresión de la cual es posible determinar su tipo. +- Un `AUTO_TYPE` será sustituido por su tipo correspodiente si este forma parte de una operacion que permita saber su tipo, o es usado en una expresión de la cuál es posible determinar su tipo. -- Es importante senalar en que contexto estas dependencias son tomadas en cuenta: +- Es importante señalar en que contexto estas dependencias son tomadas en cuenta: - - Para los atributos marcados como autotype su tipo podra ser determinado dentro del cuerpo de cualquiera de las funciones de la clase o si es detectable el tipo de la expresión de inicializacion. + - Para los atributos marcados como `AUTO_TYPE` su tipo podrá ser determinado dentro del cuerpo de cualquiera de las funciones de la clase, o si es detectable el tipo de la expresión de inicialización. - - Para las variables su tipo será determinado dentro del scope donde estas son validas. + - Para las variables su tipo será determinado dentro del scope donde estas son válidas. -- Para los parámetros su tipo será determinado dentro del cuerpo de la función o cuando esta sea función sea llamada a traves de una operacion de dispatch. +- Para los parámetros su tipo será determinado dentro del cuerpo de la función o cuando esta función sea llamada a traves de una operacion de dispatch. - Para los retornos de funciones, su tipo será determinado con su expresión y los llamados a dicha función a traves de una operacion de dispatch. -- En las expresiónes if-then-else o case-of asignan automaticamente el tipo `Object` por el momento debido a la complejidad que supone la operacion `join` en el los case y en las clausulas then-else. +- En las expresiones if-then-else o case-of asignan automáticamente el tipo `Object` debido a la complejidad que supone la operacion `join` en estas expresiones. -### 1.3.1 Ejemplos de casos factibles para la inferencia +##### 1.3.1 Ejemplos de casos factibles para la inferencia En este caso la expresión `d + 1` desambigua a `d` en un `Int` y luego `c` se infiere de `d`, `b` se infiere de `c`, `a` se infiere de `b` y el retorno de la función de infiere de `a`. Quedando todos los parámetros y el retorno de la función marcados como `Int`. @@ -137,7 +139,7 @@ class Point { } ``` -Probando con funciones recursivas tenemos el caso de fibonacci tipo de `n` se infiere al ser usado en las expresiónes `n <= 2`, `n - 1`, `n - 2`, las cuales lo marcan como `Int`, `fibonacci(n - 1) + fibonacci(n - 2)` marca al retorno de la función como `Int` y y la expresión if-then-else lo marca como `Object`. en este ultimo caso la expresión `fibonacci(n - 1) + fibonacci(n - 2)` termina de analizarse primero que la expresión if-then-else por lo cual el tipo de retorno será `Int` el cual fue el primero que se definio, lo cual demuestra que el orden en el que se analizan las inferencias importan de las inferencias importan. +Probando con funciones recursivas tenemos el caso de fibonacci tipo de `n` se infiere al ser usado en las expresiones `n <= 2`, `n - 1`, `n - 2`, las cuales lo marcan como `Int`, `fibonacci(n - 1) + fibonacci(n - 2)` marca al retorno de la función como `Int` y la expresión if-then-else lo marca como `Object`. En este último caso la expresión `fibonacci(n - 1) + fibonacci(n - 2)` termina de analizarse primero que la expresión if-then-else por lo cual el tipo de retorno será `Int` el cual fue el primero que se definido, lo cual demuestra que el orden en el que se analizan las inferencias importan. ```typescript class Main { @@ -147,10 +149,13 @@ class Main { } ``` -El caso de Ackerman es bastante interesante, en nuestro algoritmo importa el orden en el que fueron definidas las dependencias. `m` y `n` son inferibles como `Int` a partir de las expresiónes `n + 1` y `m - 1` respectivamente, y el tipo de retorno de `ackermann` en inferible por `n` al ser usado como segundo parámetro en un llamado de si mismo, por lo cual será `Int`. La influencia de la expresión if-then-else se ve anulada por el orden de inferencia. +El caso de Ackerman es bastante interesante, en nuestro algoritmo importa el orden en el que fueron definidas las dependencias. `m` y `n` son inferibles como `Int` a partir de las expresiones `n + 1` y `m - 1` respectivamente, y el tipo de retorno de `ackermann` en inferible por `n` al ser usado como segundo parámetro en un llamado de si mismo, por lo cual será `Int`. La influencia de la expresión `if-then-else` se ve anulada por el orden de inferencia. ```typescript class Main { + + ... + ackermann(m: AUTO_TYPE, n: AUTO_TYPE): AUTO_TYPE { if m = 0 then n + 1 else if n = 0 then ackermann(m - 1, 1) else @@ -158,23 +163,28 @@ class Main { fi fi }; + + ... + } ``` -### 2.4 Casos No factibles +#### 1.4 Casos No factibles No es posible determinar el tipo de una variable, atributo, parámetro, o retorno de función si para este se cumple el caso general y su caso especifico correspondiente. -### 2.4.1 Casos generales +##### 1.4.1 Casos generales -El tipo es utilizado en expresiónes que no permiten determinar su tipo, o solo se logra determinar que poseen el mismo tipo que otras variables, atributos, parámetros o retorno de funciones de las cuales tampoco se puede determinar el mismo. +El tipo es utilizado en expresiones que no permiten determinar su tipo, o solo se logra determinar que poseen el mismo tipo que otras variables, atributos, parámetros o retorno de funciones de las cuales tampoco se puede determinar el mismo. ```typescript class Main { b: AUTO_TYPE; c: AUTO_TYPE; - function(a: AUTO_TYPE, d: AUTO_TYPE): AUTO_TYPE { + ... + + f(a: AUTO_TYPE, d: AUTO_TYPE): AUTO_TYPE { { b <- a; d <- c; @@ -188,39 +198,74 @@ class Main { } ``` -En este ejemplo solo es posible inferir el typo del parámetro `n` de la función `factorial`, su tipo de retorno, el parámetro `a` de la función `function`, su tipo de retorno y el atributo `b` de la clase `Main`, el resto será marcado como `Object`. +En este ejemplo solo es posible inferir el typo del parámetro `n` de la función `factorial`, su tipo de retorno, el parámetro `a` de la función `f`, su tipo de retorno y el atributo `b` de la clase `Main`, el resto será marcado como `Object`. + +```typescript +class Main { + main (): Object { + 0 + }; + + f(a: AUTO_TYPE, b: AUTO_TYPE): AUTO_TYPE { + if a = 1 then b else + g(a + 1, b / 1) + fi + }; + + g(a: AUTO_TYPE, b: AUTO_TYPE): AUTO_TYPE { + if b = 1 then a else + f(a / 2, b + 1) + fi + }; +} +``` + +En este último caso es posible determinar el tipo de los parámetros `a` y `b` de ambas funciones `f` y `g` ya que estos participan en operaciones aritmétcas, sin embargo los tipos de retorno de estas funciones no son determinables ya que no se usan en otro contexto en un llamado en una de las ramas de la clausula `if-then-else`. Como nuestro algoritmo no propaga los tipos definidos entre ramas de expresiones como los `if-then-else` o `case-of` entonces el tipo de retorno no puede ser definido, luego por defecto se etiquetan como `Object`. -### 2.4.2 Casos Particulares +##### 1.4.2 Casos Particulares -***Para variables:*** si estas no son utilizadas en el ambito en que son marcadas como `Object`. +**Para variables:** si estas no son utilizadas en el ámbito en que son marcadas como `Object`. ```typescript class Main inherits IO { - function(): Int { - let a:AUTOTYPE, b:AUTO_TYPE in { + + ... + + f(): Int { + let a: AUTOTYPE, b: AUTO_TYPE in { 1; } }; + + ... + } ``` -***Para parámetros:*** si dentro del cuerpo de la función estas no son utilizadas y no existe otra función que llame a esta con argumentos con tipado estático definidos serán marcadas como `Object`: +**Para parámetros:** si dentro del cuerpo de la función estas no son utilizadas y no existe otra función que llame a esta con argumentos con tipado estático definidos, serán marcadas como `Object`: ```typescript class Main inherits IO { + + ... + f(a: AUTO_TYPE): Int{ 1 }; + + ... + } ``` -***Para atributos:*** si no es posible determinar el tipo de la expresión de inicializacion o si dentro del cuerpo de todas las funciones de su clase correspondiente este no son utilizadas, serán marcadas como `Objects`. +**Para atributos:** si no es posible determinar el tipo de la expresión de inicializacion o si dentro del cuerpo de todas las funciones de su clase correspondiente este no son utilizadas, serán marcadas como `Objects`. ```typescript class Main inherits IO { + b: AUTO_TYPE; + c: AUTO_TYPE; - b: AUTO_TYPE <- c; - c: AUTO_TYPE <- b; + ... f(a: AUTO_TYPE): AUTO_TYPE{ if a < 3 then 1 else f(a - 1) + f(a - 2) fi @@ -228,23 +273,26 @@ class Main inherits IO { } ``` -***Para el retorno de funciones:*** si no es posible determinar el tipo de su expresión. +**Para el retorno de funciones:** si no es posible determinar el tipo de su expresión. ```typescript class Main inherits IO { + + ... + f(a: Int): AUTO_TYPE{ - if a<3 then a else f(a-3) fi + if a < 3 then a else f(a - 3) fi }; } ``` -### 2.5 expresiónes atomicas +#### 1.5 Expresiones atómicas - Valores constantes. - Operaciones aritméticas. -- Operaciones logicas. +- Operaciones lógicas. - Llamdos a funciones con valor de retorno conocido. @@ -252,11 +300,11 @@ class Main inherits IO { - Variables de las cuales se conoce su tipo. -- Bloques donde se puede determinar el tipo de la ultima expresión. +- Bloques donde se puede determinar el tipo de la última expresión. -## 2 CLI-API +### 2 CLI-API -Para la comoda utilizacion del interprete hemos usado el paquete de python `typer` para crear una api-cli bastante sencilla, basta co ejecutar el comando `python cool.py --help` y otendra como salida lo siguiente: +Para la cómoda utilizacion del intérprete hemos usado el paquete de python `typer` para crear una api-cli bastante sencilla, basta con ejecutar el comando `python cool.py --help` y obtendrá como salida lo siguiente: Usage: cool.py [OPTIONS] COMMAND [ARGS]... @@ -277,12 +325,12 @@ Se se puede apreciar existen 2 comandos principales: - `run` el cual recibe como entrada un archivo .cl con un programa en COOL y ejecuta dicho programa. -- En ambos casos se tiene como parámetro adicional el `--verbose` para observar los distintos procesos por los que pasa la el proceso de compilación +- En ambos casos se tiene como parámetro adicional el `--verbose` para observar los distintos procesos por los que pasa el proceso de compilación. -## 3 Lexing y Parsing +### 3 Lexing y Parsing -Para el proceso de lexing y parsing usamos el paquete de python `pyjapt` cuyos autores coinciden con los de este proyecto. +Para el proceso de lexing y parsing usamos el paquete de Python [PyJapt](https://github.com/alejandroklever/PyJapt.git), cuyos autores coinciden con los de este proyecto. -## 4 Testing +### 4 Testing -En la carpeta `tests` se encuentra las carpetas `execution`, `inference`, `lexer`, `parser`, `semantic` las cuales contienen casos de pruebas para correr todas las pruebas basta con hacer `pytest tests` y se probaran todos los casos menos los de la carpeta `execution`, la cual contiene programa en cool que deberan ser ejecutados a mano usando la cli-api de nuestro interprete. \ No newline at end of file +En la carpeta `tests` se encuentra las carpetas `execution`, `inference`, `lexer`, `parser`, `semantic` las cuales contienen casos de pruebas. Para correr todas las pruebas basta con hacer `pytest tests` y se probaran todos los casos menos los de la carpeta `execution`, la cual contiene programa en cool que deberan ser ejecutados a mano usando la cli-api de nuestro intérprete. \ No newline at end of file From b481c2d6fc62632672120f95408f4c45fbec160b Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Tue, 24 Nov 2020 16:35:36 +0100 Subject: [PATCH 081/143] reorganizando el proyecto --- .gitignore | 3 - {semantics/utils => cool}/__init__.py | 0 cool.py => cool/__main__.py | 0 grammar.py => cool/grammar.py | 0 lexertab.py => cool/lexertab.py | 0 parsertab.py => cool/parsertab.py | 0 cool/semantics/__init__.py | 9 +++ {semantics => cool/semantics}/execution.py | 4 +- {semantics => cool/semantics}/formatter.py | 0 {semantics => cool/semantics}/overridden.py | 0 {semantics => cool/semantics}/type_builder.py | 0 {semantics => cool/semantics}/type_checker.py | 3 +- .../semantics}/type_collector.py | 0 .../semantics}/type_inference.py | 10 +-- cool/semantics/utils/__init__.py | 0 .../semantics}/utils/astnodes.py | 0 {semantics => cool/semantics}/utils/errors.py | 0 {semantics => cool/semantics}/utils/scope.py | 6 +- {semantics => cool/semantics}/visitor.py | 0 semantics/__init__.py | 9 --- tests/test_cool.py | 71 +++++++++++-------- 21 files changed, 62 insertions(+), 53 deletions(-) rename {semantics/utils => cool}/__init__.py (100%) rename cool.py => cool/__main__.py (100%) rename grammar.py => cool/grammar.py (100%) rename lexertab.py => cool/lexertab.py (100%) rename parsertab.py => cool/parsertab.py (100%) create mode 100644 cool/semantics/__init__.py rename {semantics => cool/semantics}/execution.py (99%) rename {semantics => cool/semantics}/formatter.py (100%) rename {semantics => cool/semantics}/overridden.py (100%) rename {semantics => cool/semantics}/type_builder.py (100%) rename {semantics => cool/semantics}/type_checker.py (98%) rename {semantics => cool/semantics}/type_collector.py (100%) rename {semantics => cool/semantics}/type_inference.py (98%) create mode 100644 cool/semantics/utils/__init__.py rename {semantics => cool/semantics}/utils/astnodes.py (100%) mode change 100755 => 100644 rename {semantics => cool/semantics}/utils/errors.py (100%) rename {semantics => cool/semantics}/utils/scope.py (98%) mode change 100755 => 100644 rename {semantics => cool/semantics}/visitor.py (100%) mode change 100755 => 100644 delete mode 100644 semantics/__init__.py diff --git a/.gitignore b/.gitignore index ec0d0b674..290ed31ae 100755 --- a/.gitignore +++ b/.gitignore @@ -125,6 +125,3 @@ dmypy.json .idea .vscode -scripts -Sera borrado Untitled.ipynb -Sera borrado output.txt diff --git a/semantics/utils/__init__.py b/cool/__init__.py similarity index 100% rename from semantics/utils/__init__.py rename to cool/__init__.py diff --git a/cool.py b/cool/__main__.py similarity index 100% rename from cool.py rename to cool/__main__.py diff --git a/grammar.py b/cool/grammar.py similarity index 100% rename from grammar.py rename to cool/grammar.py diff --git a/lexertab.py b/cool/lexertab.py similarity index 100% rename from lexertab.py rename to cool/lexertab.py diff --git a/parsertab.py b/cool/parsertab.py similarity index 100% rename from parsertab.py rename to cool/parsertab.py diff --git a/cool/semantics/__init__.py b/cool/semantics/__init__.py new file mode 100644 index 000000000..3f0fff322 --- /dev/null +++ b/cool/semantics/__init__.py @@ -0,0 +1,9 @@ +"""This module contains definitions of classes for make different travels through the AST of a cool program. All +classes defined here follows the visitor pattern using the module visitor, with this we can get a more decoupled +inspection. """ + +from .type_builder import TypeBuilder +from .type_collector import TypeCollector +from .formatter import Formatter +from .overridden import OverriddenMethodChecker, topological_ordering +from .type_checker import TypeChecker diff --git a/semantics/execution.py b/cool/semantics/execution.py similarity index 99% rename from semantics/execution.py rename to cool/semantics/execution.py index b1f78fef7..315b8b686 100644 --- a/semantics/execution.py +++ b/cool/semantics/execution.py @@ -1,9 +1,9 @@ -from typing import Dict, Any +from typing import Any, Dict import semantics.utils.astnodes as ast import semantics.utils.errors as err import semantics.visitor as visitor -from semantics.utils.scope import Context, Type, Method, Scope +from semantics.utils.scope import Context, Method, Scope, Type class ExecutionError(Exception): diff --git a/semantics/formatter.py b/cool/semantics/formatter.py similarity index 100% rename from semantics/formatter.py rename to cool/semantics/formatter.py diff --git a/semantics/overridden.py b/cool/semantics/overridden.py similarity index 100% rename from semantics/overridden.py rename to cool/semantics/overridden.py diff --git a/semantics/type_builder.py b/cool/semantics/type_builder.py similarity index 100% rename from semantics/type_builder.py rename to cool/semantics/type_builder.py diff --git a/semantics/type_checker.py b/cool/semantics/type_checker.py similarity index 98% rename from semantics/type_checker.py rename to cool/semantics/type_checker.py index 5c40aebdb..fdf6bfe11 100644 --- a/semantics/type_checker.py +++ b/cool/semantics/type_checker.py @@ -3,7 +3,8 @@ import semantics.utils.astnodes as ast import semantics.utils.errors as err import semantics.visitor as visitor -from semantics.utils.scope import Context, SemanticError, Type, Method, Scope, ErrorType +from semantics.utils.scope import (Context, ErrorType, Method, Scope, + SemanticError, Type) class TypeChecker: diff --git a/semantics/type_collector.py b/cool/semantics/type_collector.py similarity index 100% rename from semantics/type_collector.py rename to cool/semantics/type_collector.py diff --git a/semantics/type_inference.py b/cool/semantics/type_inference.py similarity index 98% rename from semantics/type_inference.py rename to cool/semantics/type_inference.py index 029884d7f..862f4ffba 100644 --- a/semantics/type_inference.py +++ b/cool/semantics/type_inference.py @@ -1,6 +1,6 @@ """The type inference algorithm consist in a dependency di-graph with special nodes to handle the behavior of the updates of components in the code and solve it in the `context`. For that we crate an structure called -DependencyGraph where we can create nodes as an structure called DependencyNode and arcs between them, and arc e = +DependencyGraph where we can create nodes as an structure called DependencyNode and arcs between them, an arc e = where x and y are dependency nodes means that the type of node y is inferred by the type of node x, so for solve the type of y we need first to infer the type of x. For this operation we need some basic nodes that only contains the type of the node called AtomNode and in the digraph formation an AtomNode is never inferred from @@ -32,15 +32,15 @@ - method : Reference to the method of the class All nodes has an implementation of the method update that handle how to update the type by it's dependencies - """ -from collections import deque, OrderedDict -from typing import Dict, List, Tuple, Set, Optional +from collections import OrderedDict, deque +from typing import Dict, List, Optional, Set, Tuple import semantics.utils.astnodes as ast import semantics.utils.errors as err import semantics.visitor as visitor -from semantics.utils.scope import Type, Attribute, Method, Scope, Context, SemanticError, ErrorType, VariableInfo +from semantics.utils.scope import (Attribute, Context, ErrorType, Method, + Scope, SemanticError, Type, VariableInfo) class DependencyNode: diff --git a/cool/semantics/utils/__init__.py b/cool/semantics/utils/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/semantics/utils/astnodes.py b/cool/semantics/utils/astnodes.py old mode 100755 new mode 100644 similarity index 100% rename from semantics/utils/astnodes.py rename to cool/semantics/utils/astnodes.py diff --git a/semantics/utils/errors.py b/cool/semantics/utils/errors.py similarity index 100% rename from semantics/utils/errors.py rename to cool/semantics/utils/errors.py diff --git a/semantics/utils/scope.py b/cool/semantics/utils/scope.py old mode 100755 new mode 100644 similarity index 98% rename from semantics/utils/scope.py rename to cool/semantics/utils/scope.py index e377f198e..96cc9280b --- a/semantics/utils/scope.py +++ b/cool/semantics/utils/scope.py @@ -1,5 +1,3 @@ -from enum import Enum, auto - from collections import OrderedDict from typing import List, Optional, Dict, Tuple, Union @@ -230,9 +228,9 @@ def __iter__(self): class VariableInfo: - def __init__(self, name, vtype): + def __init__(self, name, var_type): self.name: str = name - self.type: Type = vtype + self.type: Type = var_type def __str__(self): return self.name + ': ' + self.type.name diff --git a/semantics/visitor.py b/cool/semantics/visitor.py old mode 100755 new mode 100644 similarity index 100% rename from semantics/visitor.py rename to cool/semantics/visitor.py diff --git a/semantics/__init__.py b/semantics/__init__.py deleted file mode 100644 index 118bfeaf7..000000000 --- a/semantics/__init__.py +++ /dev/null @@ -1,9 +0,0 @@ -"""This module contains definitions of classes for make different travels through the AST of a cool program. All -classes defined here follows the visitor pattern using the module visitor, with this we can get a more decoupled -inspection. """ - -from semantics.type_builder import TypeBuilder -from semantics.type_collector import TypeCollector -from semantics.formatter import Formatter -from semantics.overridden import OverriddenMethodChecker, topological_ordering -from semantics.type_checker import TypeChecker diff --git a/tests/test_cool.py b/tests/test_cool.py index dcf85021a..4f3d11776 100644 --- a/tests/test_cool.py +++ b/tests/test_cool.py @@ -1,12 +1,19 @@ +import os +import subprocess +import sys +import tempfile + from pathlib import Path from typing import List, Tuple -from lexertab import CoolLexer -from parsertab import CoolParser -from semantics import TypeCollector, TypeBuilder, OverriddenMethodChecker, TypeChecker, topological_ordering -from semantics.formatter import CodeBuilder -from semantics.type_inference import InferenceChecker -from semantics.utils.scope import Context, Scope +sys.path.append(os.path.join(os.getcwd(), 'cool')) +from cool.lexertab import CoolLexer +from cool.parsertab import CoolParser +from cool.semantics import TypeCollector, TypeBuilder, OverriddenMethodChecker, TypeChecker, topological_ordering +from cool.semantics.type_inference import InferenceChecker +from cool.semantics.utils.scope import Context, Scope + + def tokenize(code): @@ -49,39 +56,45 @@ def get_programs(folder_name: str) -> Tuple[List[str], List[str]]: return programs, results -def test_lexer(): - programs, results = get_programs('lexer') - for program, result in zip(programs, results): - tokens, lexer = tokenize(program) - assert lexer.contain_errors and '\n'.join(lexer.errors) == result.strip() +# def test_lexer(): +# programs, results = get_programs('lexer') +# +# for program, result in zip(programs, results): +# tokens, lexer = tokenize(program) +# assert lexer.contain_errors and '\n'.join(lexer.errors) == result.strip() +# +# +# def test_parser(): +# programs, results = get_programs('parser') +# +# total = 20 +# for code, result in zip(programs[total - 1:total], results[total - 1:total]): +# tokens, _ = tokenize(code) +# ast, parser = parse(tokens) +# assert parser.contains_errors and '\n'.join(parser.errors) == result -def test_parser(): - programs, results = get_programs('parser') - - total = 20 - for code, result in zip(programs[total - 1:total], results[total - 1:total]): - tokens, _ = tokenize(code) - ast, parser = parse(tokens) - assert parser.contains_errors and '\n'.join(parser.errors) == result - -def test_inference(): - programs, results = get_programs('inference') - - for program, result in zip(programs, results): - tokens, _ = tokenize(program) - ast, _ = parse(tokens) - ast, _, _, errors = check_semantics(ast, Scope(), Context(), []) - assert not errors and CodeBuilder().visit(ast, 0) == result +# def test_inference(): +# programs, results = get_programs('inference') +# +# for program, result in zip(programs, results): +# tokens, _ = tokenize(program) +# ast, _ = parse(tokens) +# ast, _, _, errors = check_semantics(ast, Scope(), Context(), []) +# assert not errors and CodeBuilder().visit(ast, 0) == result def test_semantic(): programs, results = get_programs('semantic') + print(programs) for code, result in zip(programs, results): tokens, _ = tokenize(code) ast, parser = parse(tokens) ast, _, _, errors = check_semantics(ast, Scope(), Context(), []) - assert (parser.contains_errors or errors) and '\n'.join(parser.errors + errors) == result + # assert (parser.contains_errors or errors) and '\n'.join(parser.errors + errors) == result + + +test_semantic() \ No newline at end of file From 15a57971cee354a7918947c12eeca2bfaa7df35e Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Wed, 25 Nov 2020 00:39:15 +0100 Subject: [PATCH 082/143] agregando interfaz de serializacion a la cli-api --- Informe.md | 15 +- cool/__main__.py | 47 +- cool/grammar.py | 11 +- cool/lexertab.py | 2 +- cool/parsertab.py | 1250 +++++++++++++++--------------- cool/semantics/execution.py | 8 +- cool/semantics/formatter.py | 4 +- cool/semantics/overridden.py | 8 +- cool/semantics/type_builder.py | 8 +- cool/semantics/type_checker.py | 8 +- cool/semantics/type_collector.py | 6 +- cool/semantics/type_inference.py | 10 +- tests/test_cool.py | 59 +- 13 files changed, 735 insertions(+), 701 deletions(-) diff --git a/Informe.md b/Informe.md index 503c0a20a..43a2e4a75 100644 --- a/Informe.md +++ b/Informe.md @@ -39,9 +39,9 @@ Estudiantes: ### 1 Inferencia de Tipos -COOL es un lenguaje de programación estáticamente tipado, y aunque el lenguaje no presenta inferencia de tipos, esta es una característica muy util que incorporaremos en un nuestro intérprete. +COOL es un lenguaje de programación estáticamente tipado, y aunque el lenguaje no presenta inferencia de tipos, esta es una característica muy útil que incorporaremos en un nuestro intérprete. -Nuestro algoritmo de inferencia de tipos se apoya en el uso básico de la teoría de grafos y en el uso del patrón de diseño visitor. +Nuestra solución a la inferencia de tipos se apoya en el uso básico de la teoría de grafos y en el uso del patrón de diseño visitor. La inferencia de tipos de nuestro proyecto detecta para cada atributo, variable, parámetro de función o retorno de función el primer tipo que le puede ser asignado, modificando en el árbol de sintaxis abstracta el string `AUTO_TYPE` por el nombre del tipo correspondiente y asignando los tipos correspondientes en el contexto y el ámbito en que seon declarados. @@ -73,7 +73,7 @@ class AttributeNode(DependencyNode): pass class ParameterNode(DependencyNode): - """parámetro de una función""" + """Parámetro de una función""" pass class ReturnTypeNode(DependencyNode): @@ -304,9 +304,9 @@ class Main inherits IO { ### 2 CLI-API -Para la cómoda utilizacion del intérprete hemos usado el paquete de python `typer` para crear una api-cli bastante sencilla, basta con ejecutar el comando `python cool.py --help` y obtendrá como salida lo siguiente: +Para la cómoda utilizacion del intérprete hemos usado el paquete de python `typer` para crear una api-cli bastante sencilla, basta con ejecutar el comando `python cool --help` y obtendrá como salida lo siguiente: - Usage: cool.py [OPTIONS] COMMAND [ARGS]... + Usage: cool [OPTIONS] COMMAND [ARGS]... Options: --install-completion Install completion for the current shell. @@ -318,13 +318,16 @@ Para la cómoda utilizacion del intérprete hemos usado el paquete de python `ty Commands: infer run + serialize -Se se puede apreciar existen 2 comandos principales: +Se se puede apreciar existen 3 comandos principales: - `infer` el cual recibe un archivo .cl con un programa en COOL con tipos `AUTO_TYPE` y devuelve un programa en COOL con todos los `AUTO_TYPE` reemplazados por sus tipos correspondientes. - `run` el cual recibe como entrada un archivo .cl con un programa en COOL y ejecuta dicho programa. +- `serialize` el cual vuelve a generar y serializar el parser y el lexer del lenguaje tras hacer modificaciones en su gramática. (Pensado para los desarrolladores) + - En ambos casos se tiene como parámetro adicional el `--verbose` para observar los distintos procesos por los que pasa el proceso de compilación. ### 3 Lexing y Parsing diff --git a/cool/__main__.py b/cool/__main__.py index 2d3a97498..04f532819 100644 --- a/cool/__main__.py +++ b/cool/__main__.py @@ -1,15 +1,21 @@ +import os +import sys + +sys.path.append(os.getcwd()) + from pathlib import Path from typing import List import typer -from lexertab import CoolLexer -from parsertab import CoolParser -from semantics import TypeCollector, TypeBuilder, OverriddenMethodChecker, TypeChecker, topological_ordering -from semantics.execution import Executor, ExecutionError -from semantics.formatter import CodeBuilder -from semantics.type_inference import InferenceChecker -from semantics.utils.scope import Context, Scope +from cool.grammar import serialize_parser_and_lexer +from cool.lexertab import CoolLexer +from cool.parsertab import CoolParser +from cool.semantics import TypeCollector, TypeBuilder, OverriddenMethodChecker, TypeChecker, topological_ordering +from cool.semantics.execution import Executor, ExecutionError +from cool.semantics.formatter import CodeBuilder +from cool.semantics.type_inference import InferenceChecker +from cool.semantics.utils.scope import Context, Scope app = typer.Typer() @@ -89,5 +95,32 @@ def run(file: str, verbose: bool = False): typer.echo(error, err=True) +@app.command() +def serialize(): + serialize_parser_and_lexer() + + cwd = os.getcwd() + + lexertab = os.path.join(cwd, 'lexertab.py') + parsertab = os.path.join(cwd, 'parsertab.py') + + cool_lexertab = Path(os.path.join(cwd, 'cool', 'lexertab.py')) + cool_parsertab = Path(os.path.join(cwd, 'cool', 'parsertab.py')) + + mode = 'w' if cool_lexertab.exists() else 'x' + fr = open(lexertab, 'r') + with cool_lexertab.open(mode) as fw: + fw.write(fr.read().replace('from grammar', 'from cool.grammar')) + fr.close() + + mode = 'w' if cool_parsertab.exists() else 'x' + fr = open(parsertab, 'r') + with cool_parsertab.open(mode) as fw: + fw.write(fr.read().replace('from grammar', 'from cool.grammar')) + fr.close() + + os.remove(lexertab) + os.remove(parsertab) + if __name__ == '__main__': app() diff --git a/cool/grammar.py b/cool/grammar.py index 11e06dafd..a95e8d725 100644 --- a/cool/grammar.py +++ b/cool/grammar.py @@ -3,7 +3,7 @@ from pyjapt import Grammar, Lexer -import semantics.utils.astnodes as ast +import cool.semantics.utils.astnodes as ast G = Grammar() @@ -338,8 +338,15 @@ def block_single_error(s): return [s[1]] + s[3] -if __name__ == '__main__': +################# +# Serialize API # +################# +def serialize_parser_and_lexer(): t = time.time() G.serialize_lexer('CoolLexer', inspect.getmodulename(__file__)) G.serialize_parser('lalr1', 'CoolParser', inspect.getmodulename(__file__)) print('Serialization Time :', time.time() - t, 'seconds') + + +if __name__ == '__main__': + serialize_parser_and_lexer() diff --git a/cool/lexertab.py b/cool/lexertab.py index 38fc241ed..dfa2f5eaa 100644 --- a/cool/lexertab.py +++ b/cool/lexertab.py @@ -1,7 +1,7 @@ import re from pyjapt import Token, Lexer -from grammar import G +from cool.grammar import G class CoolLexer(Lexer): diff --git a/cool/parsertab.py b/cool/parsertab.py index cd83a15dc..af3924f85 100644 --- a/cool/parsertab.py +++ b/cool/parsertab.py @@ -1,6 +1,6 @@ from abc import ABC from pyjapt import ShiftReduceParser -from grammar import G +from cool.grammar import G class CoolParser(ShiftReduceParser, ABC): @@ -28,806 +28,806 @@ def __action_table(): (7, G["type"]): ("SHIFT", 8), (8, G["{"]): ("SHIFT", 9), (9, G["not"]): ("SHIFT", 30), + (9, G["if"]): ("SHIFT", 12), + (9, G["("]): ("SHIFT", 11), (9, G["id"]): ("SHIFT", 31), - (9, G["new"]): ("SHIFT", 22), - (9, G["{"]): ("SHIFT", 10), - (9, G["~"]): ("SHIFT", 27), - (9, G["true"]): ("SHIFT", 25), (9, G["case"]): ("SHIFT", 21), + (9, G["let"]): ("SHIFT", 14), (9, G["int"]): ("SHIFT", 33), - (9, G["string"]): ("SHIFT", 34), - (9, G["if"]): ("SHIFT", 12), (9, G["isvoid"]): ("SHIFT", 24), - (9, G["let"]): ("SHIFT", 14), + (9, G["{"]): ("SHIFT", 10), + (9, G["true"]): ("SHIFT", 25), + (9, G["new"]): ("SHIFT", 22), + (9, G["~"]): ("SHIFT", 27), + (9, G["string"]): ("SHIFT", 34), (9, G["while"]): ("SHIFT", 13), - (9, G["("]): ("SHIFT", 11), (9, G["false"]): ("SHIFT", 26), - (10, G["true"]): ("SHIFT", 25), - (10, G["if"]): ("SHIFT", 12), - (10, G["int"]): ("SHIFT", 33), - (10, G["string"]): ("SHIFT", 34), (10, G["id"]): ("SHIFT", 31), - (10, G["let"]): ("SHIFT", 14), - (10, G["while"]): ("SHIFT", 13), (10, G["~"]): ("SHIFT", 27), - (10, G["("]): ("SHIFT", 11), - (10, G["not"]): ("SHIFT", 30), - (10, G["false"]): ("SHIFT", 26), + (10, G["int"]): ("SHIFT", 33), + (10, G["case"]): ("SHIFT", 21), + (10, G["let"]): ("SHIFT", 14), + (10, G["true"]): ("SHIFT", 25), (10, G["{"]): ("SHIFT", 10), - (10, G["isvoid"]): ("SHIFT", 24), (10, G["new"]): ("SHIFT", 22), - (10, G["case"]): ("SHIFT", 21), - (11, G["case"]): ("SHIFT", 21), - (11, G["isvoid"]): ("SHIFT", 24), - (11, G["id"]): ("SHIFT", 31), + (10, G["string"]): ("SHIFT", 34), + (10, G["false"]): ("SHIFT", 26), + (10, G["while"]): ("SHIFT", 13), + (10, G["isvoid"]): ("SHIFT", 24), + (10, G["not"]): ("SHIFT", 30), + (10, G["if"]): ("SHIFT", 12), + (10, G["("]): ("SHIFT", 11), (11, G["if"]): ("SHIFT", 12), - (11, G["("]): ("SHIFT", 11), + (11, G["id"]): ("SHIFT", 31), + (11, G["new"]): ("SHIFT", 22), (11, G["let"]): ("SHIFT", 14), - (11, G["while"]): ("SHIFT", 13), + (11, G["true"]): ("SHIFT", 25), + (11, G["case"]): ("SHIFT", 21), + (11, G["{"]): ("SHIFT", 10), + (11, G["isvoid"]): ("SHIFT", 24), + (11, G["string"]): ("SHIFT", 34), (11, G["false"]): ("SHIFT", 26), - (11, G["new"]): ("SHIFT", 22), (11, G["~"]): ("SHIFT", 27), - (11, G["true"]): ("SHIFT", 25), - (11, G["not"]): ("SHIFT", 30), + (11, G["while"]): ("SHIFT", 13), + (11, G["("]): ("SHIFT", 11), (11, G["int"]): ("SHIFT", 33), - (11, G["string"]): ("SHIFT", 34), - (11, G["{"]): ("SHIFT", 10), - (12, G["id"]): ("SHIFT", 31), - (12, G["~"]): ("SHIFT", 27), + (11, G["not"]): ("SHIFT", 30), (12, G["not"]): ("SHIFT", 30), - (12, G["("]): ("SHIFT", 11), - (12, G["{"]): ("SHIFT", 10), (12, G["false"]): ("SHIFT", 26), + (12, G["if"]): ("SHIFT", 12), + (12, G["let"]): ("SHIFT", 14), (12, G["case"]): ("SHIFT", 21), + (12, G["id"]): ("SHIFT", 31), + (12, G["("]): ("SHIFT", 11), + (12, G["{"]): ("SHIFT", 10), + (12, G["int"]): ("SHIFT", 33), (12, G["isvoid"]): ("SHIFT", 24), - (12, G["if"]): ("SHIFT", 12), - (12, G["new"]): ("SHIFT", 22), (12, G["true"]): ("SHIFT", 25), - (12, G["let"]): ("SHIFT", 14), + (12, G["new"]): ("SHIFT", 22), + (12, G["~"]): ("SHIFT", 27), (12, G["while"]): ("SHIFT", 13), - (12, G["int"]): ("SHIFT", 33), (12, G["string"]): ("SHIFT", 34), - (13, G["int"]): ("SHIFT", 33), - (13, G["string"]): ("SHIFT", 34), + (13, G["let"]): ("SHIFT", 14), + (13, G["case"]): ("SHIFT", 21), (13, G["id"]): ("SHIFT", 31), - (13, G["not"]): ("SHIFT", 30), - (13, G["isvoid"]): ("SHIFT", 24), (13, G["{"]): ("SHIFT", 10), - (13, G["("]): ("SHIFT", 11), - (13, G["case"]): ("SHIFT", 21), + (13, G["string"]): ("SHIFT", 34), (13, G["false"]): ("SHIFT", 26), - (13, G["~"]): ("SHIFT", 27), - (13, G["if"]): ("SHIFT", 12), - (13, G["new"]): ("SHIFT", 22), - (13, G["let"]): ("SHIFT", 14), (13, G["while"]): ("SHIFT", 13), + (13, G["("]): ("SHIFT", 11), + (13, G["isvoid"]): ("SHIFT", 24), + (13, G["int"]): ("SHIFT", 33), + (13, G["new"]): ("SHIFT", 22), + (13, G["not"]): ("SHIFT", 30), + (13, G["if"]): ("SHIFT", 12), + (13, G["~"]): ("SHIFT", 27), (13, G["true"]): ("SHIFT", 25), (14, G["id"]): ("SHIFT", 15), (15, G[":"]): ("SHIFT", 16), (16, G["type"]): ("SHIFT", 17), - (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), (17, G["<-"]): ("SHIFT", 20), + (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), (17, G[","]): ("SHIFT", 18), (18, G["id"]): ("SHIFT", 15), (19, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), - (20, G["new"]): ("SHIFT", 22), - (20, G["while"]): ("SHIFT", 13), - (20, G["true"]): ("SHIFT", 25), - (20, G["int"]): ("SHIFT", 33), (20, G["string"]): ("SHIFT", 34), - (20, G["id"]): ("SHIFT", 31), - (20, G["~"]): ("SHIFT", 27), - (20, G["not"]): ("SHIFT", 30), - (20, G["{"]): ("SHIFT", 10), + (20, G["while"]): ("SHIFT", 13), (20, G["isvoid"]): ("SHIFT", 24), - (20, G["("]): ("SHIFT", 11), - (20, G["case"]): ("SHIFT", 21), + (20, G["not"]): ("SHIFT", 30), (20, G["false"]): ("SHIFT", 26), (20, G["if"]): ("SHIFT", 12), + (20, G["~"]): ("SHIFT", 27), (20, G["let"]): ("SHIFT", 14), - (21, G["new"]): ("SHIFT", 22), - (21, G["not"]): ("SHIFT", 30), - (21, G["isvoid"]): ("SHIFT", 24), - (21, G["true"]): ("SHIFT", 25), - (21, G["id"]): ("SHIFT", 31), - (21, G["int"]): ("SHIFT", 33), + (20, G["case"]): ("SHIFT", 21), + (20, G["("]): ("SHIFT", 11), + (20, G["id"]): ("SHIFT", 31), + (20, G["{"]): ("SHIFT", 10), + (20, G["int"]): ("SHIFT", 33), + (20, G["new"]): ("SHIFT", 22), + (20, G["true"]): ("SHIFT", 25), + (21, G["if"]): ("SHIFT", 12), + (21, G["~"]): ("SHIFT", 27), + (21, G["case"]): ("SHIFT", 21), + (21, G["let"]): ("SHIFT", 14), (21, G["string"]): ("SHIFT", 34), + (21, G["id"]): ("SHIFT", 31), (21, G["{"]): ("SHIFT", 10), (21, G["false"]): ("SHIFT", 26), - (21, G["case"]): ("SHIFT", 21), - (21, G["if"]): ("SHIFT", 12), - (21, G["let"]): ("SHIFT", 14), - (21, G["while"]): ("SHIFT", 13), (21, G["("]): ("SHIFT", 11), - (21, G["~"]): ("SHIFT", 27), + (21, G["int"]): ("SHIFT", 33), + (21, G["while"]): ("SHIFT", 13), + (21, G["isvoid"]): ("SHIFT", 24), + (21, G["not"]): ("SHIFT", 30), + (21, G["true"]): ("SHIFT", 25), + (21, G["new"]): ("SHIFT", 22), (22, G["type"]): ("SHIFT", 23), + (23, G[")"]): ("REDUCE", G["atom -> new type"]), (23, G["-"]): ("REDUCE", G["atom -> new type"]), (23, G["in"]): ("REDUCE", G["atom -> new type"]), (23, G["*"]): ("REDUCE", G["atom -> new type"]), (23, G["}"]): ("REDUCE", G["atom -> new type"]), (23, G["/"]): ("REDUCE", G["atom -> new type"]), - (23, G["error"]): ("REDUCE", G["atom -> new type"]), (23, G["of"]): ("REDUCE", G["atom -> new type"]), (23, G["<"]): ("REDUCE", G["atom -> new type"]), - (23, G[")"]): ("REDUCE", G["atom -> new type"]), - (23, G["then"]): ("REDUCE", G["atom -> new type"]), + (23, G["fi"]): ("REDUCE", G["atom -> new type"]), (23, G["<="]): ("REDUCE", G["atom -> new type"]), - (23, G["."]): ("REDUCE", G["atom -> new type"]), - (23, G["else"]): ("REDUCE", G["atom -> new type"]), + (23, G["@"]): ("REDUCE", G["atom -> new type"]), (23, G["="]): ("REDUCE", G["atom -> new type"]), - (23, G[","]): ("REDUCE", G["atom -> new type"]), - (23, G["fi"]): ("REDUCE", G["atom -> new type"]), (23, G[";"]): ("REDUCE", G["atom -> new type"]), + (23, G["else"]): ("REDUCE", G["atom -> new type"]), + (23, G["then"]): ("REDUCE", G["atom -> new type"]), (23, G["loop"]): ("REDUCE", G["atom -> new type"]), - (23, G["@"]): ("REDUCE", G["atom -> new type"]), + (23, G["error"]): ("REDUCE", G["atom -> new type"]), + (23, G[","]): ("REDUCE", G["atom -> new type"]), (23, G["pool"]): ("REDUCE", G["atom -> new type"]), (23, G["+"]): ("REDUCE", G["atom -> new type"]), - (24, G["isvoid"]): ("SHIFT", 24), - (24, G["int"]): ("SHIFT", 33), - (24, G["string"]): ("SHIFT", 34), + (23, G["."]): ("REDUCE", G["atom -> new type"]), + (24, G["false"]): ("SHIFT", 26), (24, G["new"]): ("SHIFT", 22), + (24, G["string"]): ("SHIFT", 34), (24, G["id"]): ("SHIFT", 28), - (24, G["("]): ("SHIFT", 11), - (24, G["false"]): ("SHIFT", 26), - (24, G["~"]): ("SHIFT", 27), (24, G["true"]): ("SHIFT", 25), + (24, G["isvoid"]): ("SHIFT", 24), + (24, G["int"]): ("SHIFT", 33), + (24, G["~"]): ("SHIFT", 27), + (24, G["("]): ("SHIFT", 11), + (25, G[")"]): ("REDUCE", G["atom -> true"]), (25, G["-"]): ("REDUCE", G["atom -> true"]), (25, G["in"]): ("REDUCE", G["atom -> true"]), (25, G["*"]): ("REDUCE", G["atom -> true"]), (25, G["}"]): ("REDUCE", G["atom -> true"]), (25, G["/"]): ("REDUCE", G["atom -> true"]), - (25, G["error"]): ("REDUCE", G["atom -> true"]), (25, G["of"]): ("REDUCE", G["atom -> true"]), (25, G["<"]): ("REDUCE", G["atom -> true"]), - (25, G[")"]): ("REDUCE", G["atom -> true"]), - (25, G["then"]): ("REDUCE", G["atom -> true"]), + (25, G["fi"]): ("REDUCE", G["atom -> true"]), (25, G["<="]): ("REDUCE", G["atom -> true"]), - (25, G["."]): ("REDUCE", G["atom -> true"]), - (25, G["else"]): ("REDUCE", G["atom -> true"]), + (25, G["@"]): ("REDUCE", G["atom -> true"]), (25, G["="]): ("REDUCE", G["atom -> true"]), - (25, G[","]): ("REDUCE", G["atom -> true"]), - (25, G["fi"]): ("REDUCE", G["atom -> true"]), (25, G[";"]): ("REDUCE", G["atom -> true"]), + (25, G["else"]): ("REDUCE", G["atom -> true"]), + (25, G["then"]): ("REDUCE", G["atom -> true"]), (25, G["loop"]): ("REDUCE", G["atom -> true"]), - (25, G["@"]): ("REDUCE", G["atom -> true"]), + (25, G["error"]): ("REDUCE", G["atom -> true"]), + (25, G[","]): ("REDUCE", G["atom -> true"]), (25, G["pool"]): ("REDUCE", G["atom -> true"]), (25, G["+"]): ("REDUCE", G["atom -> true"]), + (25, G["."]): ("REDUCE", G["atom -> true"]), + (26, G[")"]): ("REDUCE", G["atom -> false"]), (26, G["-"]): ("REDUCE", G["atom -> false"]), (26, G["in"]): ("REDUCE", G["atom -> false"]), (26, G["*"]): ("REDUCE", G["atom -> false"]), (26, G["}"]): ("REDUCE", G["atom -> false"]), (26, G["/"]): ("REDUCE", G["atom -> false"]), - (26, G["error"]): ("REDUCE", G["atom -> false"]), (26, G["of"]): ("REDUCE", G["atom -> false"]), (26, G["<"]): ("REDUCE", G["atom -> false"]), - (26, G[")"]): ("REDUCE", G["atom -> false"]), - (26, G["then"]): ("REDUCE", G["atom -> false"]), + (26, G["fi"]): ("REDUCE", G["atom -> false"]), (26, G["<="]): ("REDUCE", G["atom -> false"]), - (26, G["."]): ("REDUCE", G["atom -> false"]), - (26, G["else"]): ("REDUCE", G["atom -> false"]), + (26, G["@"]): ("REDUCE", G["atom -> false"]), (26, G["="]): ("REDUCE", G["atom -> false"]), - (26, G[","]): ("REDUCE", G["atom -> false"]), - (26, G["fi"]): ("REDUCE", G["atom -> false"]), (26, G[";"]): ("REDUCE", G["atom -> false"]), + (26, G["else"]): ("REDUCE", G["atom -> false"]), + (26, G["then"]): ("REDUCE", G["atom -> false"]), (26, G["loop"]): ("REDUCE", G["atom -> false"]), - (26, G["@"]): ("REDUCE", G["atom -> false"]), + (26, G["error"]): ("REDUCE", G["atom -> false"]), + (26, G[","]): ("REDUCE", G["atom -> false"]), (26, G["pool"]): ("REDUCE", G["atom -> false"]), (26, G["+"]): ("REDUCE", G["atom -> false"]), - (27, G["isvoid"]): ("SHIFT", 24), - (27, G["int"]): ("SHIFT", 33), - (27, G["string"]): ("SHIFT", 34), + (26, G["."]): ("REDUCE", G["atom -> false"]), + (27, G["false"]): ("SHIFT", 26), (27, G["new"]): ("SHIFT", 22), + (27, G["string"]): ("SHIFT", 34), (27, G["id"]): ("SHIFT", 28), - (27, G["("]): ("SHIFT", 11), - (27, G["false"]): ("SHIFT", 26), - (27, G["~"]): ("SHIFT", 27), (27, G["true"]): ("SHIFT", 25), - (28, G["("]): ("SHIFT", 29), + (27, G["isvoid"]): ("SHIFT", 24), + (27, G["int"]): ("SHIFT", 33), + (27, G["~"]): ("SHIFT", 27), + (27, G["("]): ("SHIFT", 11), + (28, G[")"]): ("REDUCE", G["atom -> id"]), (28, G["-"]): ("REDUCE", G["atom -> id"]), (28, G["in"]): ("REDUCE", G["atom -> id"]), (28, G["*"]): ("REDUCE", G["atom -> id"]), (28, G["}"]): ("REDUCE", G["atom -> id"]), (28, G["/"]): ("REDUCE", G["atom -> id"]), - (28, G["error"]): ("REDUCE", G["atom -> id"]), (28, G["of"]): ("REDUCE", G["atom -> id"]), (28, G["<"]): ("REDUCE", G["atom -> id"]), - (28, G[")"]): ("REDUCE", G["atom -> id"]), - (28, G["then"]): ("REDUCE", G["atom -> id"]), + (28, G["fi"]): ("REDUCE", G["atom -> id"]), (28, G["<="]): ("REDUCE", G["atom -> id"]), - (28, G["."]): ("REDUCE", G["atom -> id"]), - (28, G["else"]): ("REDUCE", G["atom -> id"]), + (28, G["@"]): ("REDUCE", G["atom -> id"]), (28, G["="]): ("REDUCE", G["atom -> id"]), - (28, G[","]): ("REDUCE", G["atom -> id"]), - (28, G["fi"]): ("REDUCE", G["atom -> id"]), (28, G[";"]): ("REDUCE", G["atom -> id"]), + (28, G["else"]): ("REDUCE", G["atom -> id"]), + (28, G["then"]): ("REDUCE", G["atom -> id"]), (28, G["loop"]): ("REDUCE", G["atom -> id"]), - (28, G["@"]): ("REDUCE", G["atom -> id"]), + (28, G["error"]): ("REDUCE", G["atom -> id"]), + (28, G[","]): ("REDUCE", G["atom -> id"]), (28, G["pool"]): ("REDUCE", G["atom -> id"]), (28, G["+"]): ("REDUCE", G["atom -> id"]), - (29, G["id"]): ("SHIFT", 31), - (29, G["{"]): ("SHIFT", 10), + (28, G["."]): ("REDUCE", G["atom -> id"]), + (28, G["("]): ("SHIFT", 29), + (29, G["new"]): ("SHIFT", 22), + (29, G["true"]): ("SHIFT", 25), + (29, G["isvoid"]): ("SHIFT", 24), + (29, G["string"]): ("SHIFT", 34), + (29, G["while"]): ("SHIFT", 13), + (29, G["false"]): ("SHIFT", 26), (29, G["~"]): ("SHIFT", 27), + (29, G["not"]): ("SHIFT", 30), + (29, G["if"]): ("SHIFT", 12), (29, G["("]): ("SHIFT", 11), - (29, G["false"]): ("SHIFT", 26), (29, G[")"]): ("REDUCE", G["expr-list -> e"]), - (29, G["case"]): ("SHIFT", 21), - (29, G["if"]): ("SHIFT", 12), - (29, G["new"]): ("SHIFT", 22), - (29, G["isvoid"]): ("SHIFT", 24), - (29, G["true"]): ("SHIFT", 25), (29, G["let"]): ("SHIFT", 14), - (29, G["while"]): ("SHIFT", 13), + (29, G["case"]): ("SHIFT", 21), + (29, G["id"]): ("SHIFT", 31), (29, G["int"]): ("SHIFT", 33), - (29, G["string"]): ("SHIFT", 34), - (29, G["not"]): ("SHIFT", 30), + (29, G["{"]): ("SHIFT", 10), (30, G["new"]): ("SHIFT", 22), - (30, G["not"]): ("SHIFT", 30), (30, G["true"]): ("SHIFT", 25), - (30, G["id"]): ("SHIFT", 31), - (30, G["int"]): ("SHIFT", 33), + (30, G["isvoid"]): ("SHIFT", 24), + (30, G["while"]): ("SHIFT", 13), (30, G["string"]): ("SHIFT", 34), - (30, G["{"]): ("SHIFT", 10), (30, G["~"]): ("SHIFT", 27), - (30, G["case"]): ("SHIFT", 21), + (30, G["not"]): ("SHIFT", 30), (30, G["if"]): ("SHIFT", 12), - (30, G["isvoid"]): ("SHIFT", 24), - (30, G["("]): ("SHIFT", 11), - (30, G["let"]): ("SHIFT", 14), (30, G["false"]): ("SHIFT", 26), - (30, G["while"]): ("SHIFT", 13), - (31, G["("]): ("SHIFT", 29), - (31, G["<-"]): ("SHIFT", 32), + (30, G["let"]): ("SHIFT", 14), + (30, G["case"]): ("SHIFT", 21), + (30, G["{"]): ("SHIFT", 10), + (30, G["id"]): ("SHIFT", 31), + (30, G["("]): ("SHIFT", 11), + (30, G["int"]): ("SHIFT", 33), + (31, G[")"]): ("REDUCE", G["atom -> id"]), (31, G["-"]): ("REDUCE", G["atom -> id"]), (31, G["in"]): ("REDUCE", G["atom -> id"]), (31, G["*"]): ("REDUCE", G["atom -> id"]), (31, G["}"]): ("REDUCE", G["atom -> id"]), (31, G["/"]): ("REDUCE", G["atom -> id"]), - (31, G["error"]): ("REDUCE", G["atom -> id"]), (31, G["of"]): ("REDUCE", G["atom -> id"]), (31, G["<"]): ("REDUCE", G["atom -> id"]), - (31, G[")"]): ("REDUCE", G["atom -> id"]), - (31, G["then"]): ("REDUCE", G["atom -> id"]), + (31, G["fi"]): ("REDUCE", G["atom -> id"]), (31, G["<="]): ("REDUCE", G["atom -> id"]), - (31, G["."]): ("REDUCE", G["atom -> id"]), - (31, G["else"]): ("REDUCE", G["atom -> id"]), + (31, G["@"]): ("REDUCE", G["atom -> id"]), (31, G["="]): ("REDUCE", G["atom -> id"]), - (31, G[","]): ("REDUCE", G["atom -> id"]), - (31, G["fi"]): ("REDUCE", G["atom -> id"]), (31, G[";"]): ("REDUCE", G["atom -> id"]), + (31, G["else"]): ("REDUCE", G["atom -> id"]), + (31, G["then"]): ("REDUCE", G["atom -> id"]), (31, G["loop"]): ("REDUCE", G["atom -> id"]), - (31, G["@"]): ("REDUCE", G["atom -> id"]), + (31, G["error"]): ("REDUCE", G["atom -> id"]), + (31, G[","]): ("REDUCE", G["atom -> id"]), (31, G["pool"]): ("REDUCE", G["atom -> id"]), (31, G["+"]): ("REDUCE", G["atom -> id"]), + (31, G["."]): ("REDUCE", G["atom -> id"]), + (31, G["<-"]): ("SHIFT", 32), + (31, G["("]): ("SHIFT", 29), (32, G["new"]): ("SHIFT", 22), - (32, G["not"]): ("SHIFT", 30), (32, G["true"]): ("SHIFT", 25), - (32, G["id"]): ("SHIFT", 31), - (32, G["int"]): ("SHIFT", 33), + (32, G["isvoid"]): ("SHIFT", 24), + (32, G["while"]): ("SHIFT", 13), (32, G["string"]): ("SHIFT", 34), - (32, G["{"]): ("SHIFT", 10), (32, G["~"]): ("SHIFT", 27), - (32, G["case"]): ("SHIFT", 21), + (32, G["not"]): ("SHIFT", 30), (32, G["if"]): ("SHIFT", 12), - (32, G["isvoid"]): ("SHIFT", 24), - (32, G["("]): ("SHIFT", 11), - (32, G["let"]): ("SHIFT", 14), (32, G["false"]): ("SHIFT", 26), - (32, G["while"]): ("SHIFT", 13), + (32, G["let"]): ("SHIFT", 14), + (32, G["case"]): ("SHIFT", 21), + (32, G["{"]): ("SHIFT", 10), + (32, G["id"]): ("SHIFT", 31), + (32, G["("]): ("SHIFT", 11), + (32, G["int"]): ("SHIFT", 33), + (33, G[")"]): ("REDUCE", G["atom -> int"]), (33, G["-"]): ("REDUCE", G["atom -> int"]), (33, G["in"]): ("REDUCE", G["atom -> int"]), (33, G["*"]): ("REDUCE", G["atom -> int"]), (33, G["}"]): ("REDUCE", G["atom -> int"]), (33, G["/"]): ("REDUCE", G["atom -> int"]), - (33, G["error"]): ("REDUCE", G["atom -> int"]), (33, G["of"]): ("REDUCE", G["atom -> int"]), (33, G["<"]): ("REDUCE", G["atom -> int"]), - (33, G[")"]): ("REDUCE", G["atom -> int"]), - (33, G["then"]): ("REDUCE", G["atom -> int"]), + (33, G["fi"]): ("REDUCE", G["atom -> int"]), (33, G["<="]): ("REDUCE", G["atom -> int"]), - (33, G["."]): ("REDUCE", G["atom -> int"]), - (33, G["else"]): ("REDUCE", G["atom -> int"]), + (33, G["@"]): ("REDUCE", G["atom -> int"]), (33, G["="]): ("REDUCE", G["atom -> int"]), - (33, G[","]): ("REDUCE", G["atom -> int"]), - (33, G["fi"]): ("REDUCE", G["atom -> int"]), (33, G[";"]): ("REDUCE", G["atom -> int"]), + (33, G["else"]): ("REDUCE", G["atom -> int"]), + (33, G["then"]): ("REDUCE", G["atom -> int"]), (33, G["loop"]): ("REDUCE", G["atom -> int"]), - (33, G["@"]): ("REDUCE", G["atom -> int"]), + (33, G["error"]): ("REDUCE", G["atom -> int"]), + (33, G[","]): ("REDUCE", G["atom -> int"]), (33, G["pool"]): ("REDUCE", G["atom -> int"]), (33, G["+"]): ("REDUCE", G["atom -> int"]), + (33, G["."]): ("REDUCE", G["atom -> int"]), + (34, G[")"]): ("REDUCE", G["atom -> string"]), (34, G["-"]): ("REDUCE", G["atom -> string"]), (34, G["in"]): ("REDUCE", G["atom -> string"]), (34, G["*"]): ("REDUCE", G["atom -> string"]), (34, G["}"]): ("REDUCE", G["atom -> string"]), (34, G["/"]): ("REDUCE", G["atom -> string"]), - (34, G["error"]): ("REDUCE", G["atom -> string"]), (34, G["of"]): ("REDUCE", G["atom -> string"]), (34, G["<"]): ("REDUCE", G["atom -> string"]), - (34, G[")"]): ("REDUCE", G["atom -> string"]), - (34, G["then"]): ("REDUCE", G["atom -> string"]), + (34, G["fi"]): ("REDUCE", G["atom -> string"]), (34, G["<="]): ("REDUCE", G["atom -> string"]), - (34, G["."]): ("REDUCE", G["atom -> string"]), - (34, G["else"]): ("REDUCE", G["atom -> string"]), + (34, G["@"]): ("REDUCE", G["atom -> string"]), (34, G["="]): ("REDUCE", G["atom -> string"]), - (34, G[","]): ("REDUCE", G["atom -> string"]), - (34, G["fi"]): ("REDUCE", G["atom -> string"]), (34, G[";"]): ("REDUCE", G["atom -> string"]), + (34, G["else"]): ("REDUCE", G["atom -> string"]), + (34, G["then"]): ("REDUCE", G["atom -> string"]), (34, G["loop"]): ("REDUCE", G["atom -> string"]), - (34, G["@"]): ("REDUCE", G["atom -> string"]), + (34, G["error"]): ("REDUCE", G["atom -> string"]), + (34, G[","]): ("REDUCE", G["atom -> string"]), (34, G["pool"]): ("REDUCE", G["atom -> string"]), (34, G["+"]): ("REDUCE", G["atom -> string"]), + (34, G["."]): ("REDUCE", G["atom -> string"]), + (35, G[")"]): ("REDUCE", G["atom -> function-call"]), (35, G["-"]): ("REDUCE", G["atom -> function-call"]), (35, G["in"]): ("REDUCE", G["atom -> function-call"]), (35, G["*"]): ("REDUCE", G["atom -> function-call"]), (35, G["}"]): ("REDUCE", G["atom -> function-call"]), (35, G["/"]): ("REDUCE", G["atom -> function-call"]), - (35, G["error"]): ("REDUCE", G["atom -> function-call"]), (35, G["of"]): ("REDUCE", G["atom -> function-call"]), (35, G["<"]): ("REDUCE", G["atom -> function-call"]), - (35, G[")"]): ("REDUCE", G["atom -> function-call"]), - (35, G["then"]): ("REDUCE", G["atom -> function-call"]), + (35, G["fi"]): ("REDUCE", G["atom -> function-call"]), (35, G["<="]): ("REDUCE", G["atom -> function-call"]), - (35, G["."]): ("REDUCE", G["atom -> function-call"]), - (35, G["else"]): ("REDUCE", G["atom -> function-call"]), + (35, G["@"]): ("REDUCE", G["atom -> function-call"]), (35, G["="]): ("REDUCE", G["atom -> function-call"]), - (35, G[","]): ("REDUCE", G["atom -> function-call"]), - (35, G["fi"]): ("REDUCE", G["atom -> function-call"]), (35, G[";"]): ("REDUCE", G["atom -> function-call"]), + (35, G["else"]): ("REDUCE", G["atom -> function-call"]), + (35, G["then"]): ("REDUCE", G["atom -> function-call"]), (35, G["loop"]): ("REDUCE", G["atom -> function-call"]), - (35, G["@"]): ("REDUCE", G["atom -> function-call"]), + (35, G["error"]): ("REDUCE", G["atom -> function-call"]), + (35, G[","]): ("REDUCE", G["atom -> function-call"]), (35, G["pool"]): ("REDUCE", G["atom -> function-call"]), (35, G["+"]): ("REDUCE", G["atom -> function-call"]), - (36, G["else"]): ("REDUCE", G["expr -> id <- expr"]), + (35, G["."]): ("REDUCE", G["atom -> function-call"]), + (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["in"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["else"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["}"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), (36, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), - (37, G["else"]): ("REDUCE", G["expr -> comp"]), + (37, G[";"]): ("REDUCE", G["expr -> comp"]), + (37, G[")"]): ("REDUCE", G["expr -> comp"]), (37, G["in"]): ("REDUCE", G["expr -> comp"]), - (37, G[","]): ("REDUCE", G["expr -> comp"]), - (37, G["fi"]): ("REDUCE", G["expr -> comp"]), + (37, G["else"]): ("REDUCE", G["expr -> comp"]), + (37, G["then"]): ("REDUCE", G["expr -> comp"]), (37, G["}"]): ("REDUCE", G["expr -> comp"]), - (37, G[";"]): ("REDUCE", G["expr -> comp"]), - (37, G["error"]): ("REDUCE", G["expr -> comp"]), - (37, G["loop"]): ("REDUCE", G["expr -> comp"]), (37, G["of"]): ("REDUCE", G["expr -> comp"]), - (37, G[")"]): ("REDUCE", G["expr -> comp"]), + (37, G["loop"]): ("REDUCE", G["expr -> comp"]), + (37, G["error"]): ("REDUCE", G["expr -> comp"]), + (37, G["fi"]): ("REDUCE", G["expr -> comp"]), + (37, G[","]): ("REDUCE", G["expr -> comp"]), (37, G["pool"]): ("REDUCE", G["expr -> comp"]), - (37, G["then"]): ("REDUCE", G["expr -> comp"]), - (38, G["<="]): ("SHIFT", 68), - (38, G["-"]): ("SHIFT", 64), - (38, G["else"]): ("REDUCE", G["comp -> arith"]), + (38, G[";"]): ("REDUCE", G["comp -> arith"]), + (38, G[")"]): ("REDUCE", G["comp -> arith"]), (38, G["in"]): ("REDUCE", G["comp -> arith"]), - (38, G[","]): ("REDUCE", G["comp -> arith"]), - (38, G["fi"]): ("REDUCE", G["comp -> arith"]), + (38, G["else"]): ("REDUCE", G["comp -> arith"]), + (38, G["then"]): ("REDUCE", G["comp -> arith"]), (38, G["}"]): ("REDUCE", G["comp -> arith"]), - (38, G[";"]): ("REDUCE", G["comp -> arith"]), - (38, G["error"]): ("REDUCE", G["comp -> arith"]), - (38, G["loop"]): ("REDUCE", G["comp -> arith"]), (38, G["of"]): ("REDUCE", G["comp -> arith"]), - (38, G[")"]): ("REDUCE", G["comp -> arith"]), + (38, G["loop"]): ("REDUCE", G["comp -> arith"]), + (38, G["error"]): ("REDUCE", G["comp -> arith"]), + (38, G["fi"]): ("REDUCE", G["comp -> arith"]), + (38, G[","]): ("REDUCE", G["comp -> arith"]), (38, G["pool"]): ("REDUCE", G["comp -> arith"]), - (38, G["then"]): ("REDUCE", G["comp -> arith"]), - (38, G["<"]): ("SHIFT", 66), (38, G["="]): ("SHIFT", 70), + (38, G["-"]): ("SHIFT", 64), + (38, G["<="]): ("SHIFT", 68), + (38, G["<"]): ("SHIFT", 66), (38, G["+"]): ("SHIFT", 39), + (39, G["false"]): ("SHIFT", 26), (39, G["new"]): ("SHIFT", 22), - (39, G["id"]): ("SHIFT", 28), (39, G["true"]): ("SHIFT", 25), (39, G["isvoid"]): ("SHIFT", 24), - (39, G["int"]): ("SHIFT", 33), (39, G["("]): ("SHIFT", 11), (39, G["string"]): ("SHIFT", 34), - (39, G["false"]): ("SHIFT", 26), + (39, G["id"]): ("SHIFT", 28), + (39, G["int"]): ("SHIFT", 33), (39, G["~"]): ("SHIFT", 27), - (40, G["*"]): ("SHIFT", 41), (40, G["/"]): ("SHIFT", 54), + (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), (40, G["of"]): ("REDUCE", G["arith -> arith + term"]), (40, G["<"]): ("REDUCE", G["arith -> arith + term"]), - (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["then"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["fi"]): ("REDUCE", G["arith -> arith + term"]), (40, G["<="]): ("REDUCE", G["arith -> arith + term"]), - (40, G["else"]): ("REDUCE", G["arith -> arith + term"]), (40, G["="]): ("REDUCE", G["arith -> arith + term"]), - (40, G[","]): ("REDUCE", G["arith -> arith + term"]), - (40, G["fi"]): ("REDUCE", G["arith -> arith + term"]), (40, G[";"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["else"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["then"]): ("REDUCE", G["arith -> arith + term"]), (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), + (40, G[","]): ("REDUCE", G["arith -> arith + term"]), (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), (40, G["+"]): ("REDUCE", G["arith -> arith + term"]), - (41, G["isvoid"]): ("SHIFT", 24), - (41, G["int"]): ("SHIFT", 33), - (41, G["string"]): ("SHIFT", 34), + (40, G["*"]): ("SHIFT", 41), + (41, G["false"]): ("SHIFT", 26), (41, G["new"]): ("SHIFT", 22), + (41, G["string"]): ("SHIFT", 34), (41, G["id"]): ("SHIFT", 28), - (41, G["("]): ("SHIFT", 11), - (41, G["false"]): ("SHIFT", 26), - (41, G["~"]): ("SHIFT", 27), (41, G["true"]): ("SHIFT", 25), + (41, G["isvoid"]): ("SHIFT", 24), + (41, G["int"]): ("SHIFT", 33), + (41, G["~"]): ("SHIFT", 27), + (41, G["("]): ("SHIFT", 11), + (42, G[")"]): ("REDUCE", G["term -> term * factor"]), (42, G["-"]): ("REDUCE", G["term -> term * factor"]), (42, G["in"]): ("REDUCE", G["term -> term * factor"]), (42, G["*"]): ("REDUCE", G["term -> term * factor"]), (42, G["}"]): ("REDUCE", G["term -> term * factor"]), (42, G["/"]): ("REDUCE", G["term -> term * factor"]), - (42, G["error"]): ("REDUCE", G["term -> term * factor"]), (42, G["of"]): ("REDUCE", G["term -> term * factor"]), (42, G["<"]): ("REDUCE", G["term -> term * factor"]), - (42, G[")"]): ("REDUCE", G["term -> term * factor"]), - (42, G["then"]): ("REDUCE", G["term -> term * factor"]), + (42, G["fi"]): ("REDUCE", G["term -> term * factor"]), (42, G["<="]): ("REDUCE", G["term -> term * factor"]), - (42, G["else"]): ("REDUCE", G["term -> term * factor"]), (42, G["="]): ("REDUCE", G["term -> term * factor"]), - (42, G[","]): ("REDUCE", G["term -> term * factor"]), - (42, G["fi"]): ("REDUCE", G["term -> term * factor"]), (42, G[";"]): ("REDUCE", G["term -> term * factor"]), + (42, G["else"]): ("REDUCE", G["term -> term * factor"]), + (42, G["then"]): ("REDUCE", G["term -> term * factor"]), (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), + (42, G["error"]): ("REDUCE", G["term -> term * factor"]), + (42, G[","]): ("REDUCE", G["term -> term * factor"]), (42, G["pool"]): ("REDUCE", G["term -> term * factor"]), (42, G["+"]): ("REDUCE", G["term -> term * factor"]), + (43, G[")"]): ("REDUCE", G["factor -> atom"]), (43, G["-"]): ("REDUCE", G["factor -> atom"]), (43, G["in"]): ("REDUCE", G["factor -> atom"]), (43, G["*"]): ("REDUCE", G["factor -> atom"]), (43, G["}"]): ("REDUCE", G["factor -> atom"]), (43, G["/"]): ("REDUCE", G["factor -> atom"]), - (43, G["error"]): ("REDUCE", G["factor -> atom"]), (43, G["of"]): ("REDUCE", G["factor -> atom"]), (43, G["<"]): ("REDUCE", G["factor -> atom"]), - (43, G[")"]): ("REDUCE", G["factor -> atom"]), - (43, G["then"]): ("REDUCE", G["factor -> atom"]), + (43, G["fi"]): ("REDUCE", G["factor -> atom"]), (43, G["<="]): ("REDUCE", G["factor -> atom"]), - (43, G["else"]): ("REDUCE", G["factor -> atom"]), (43, G["="]): ("REDUCE", G["factor -> atom"]), - (43, G[","]): ("REDUCE", G["factor -> atom"]), - (43, G["fi"]): ("REDUCE", G["factor -> atom"]), (43, G[";"]): ("REDUCE", G["factor -> atom"]), + (43, G["else"]): ("REDUCE", G["factor -> atom"]), + (43, G["then"]): ("REDUCE", G["factor -> atom"]), (43, G["loop"]): ("REDUCE", G["factor -> atom"]), + (43, G["error"]): ("REDUCE", G["factor -> atom"]), + (43, G[","]): ("REDUCE", G["factor -> atom"]), (43, G["pool"]): ("REDUCE", G["factor -> atom"]), (43, G["+"]): ("REDUCE", G["factor -> atom"]), - (43, G["."]): ("SHIFT", 44), (43, G["@"]): ("SHIFT", 57), + (43, G["."]): ("SHIFT", 44), (44, G["id"]): ("SHIFT", 45), (45, G["("]): ("SHIFT", 46), - (46, G["id"]): ("SHIFT", 31), - (46, G["{"]): ("SHIFT", 10), - (46, G["~"]): ("SHIFT", 27), - (46, G["("]): ("SHIFT", 11), - (46, G["false"]): ("SHIFT", 26), - (46, G[")"]): ("REDUCE", G["expr-list -> e"]), - (46, G["case"]): ("SHIFT", 21), - (46, G["if"]): ("SHIFT", 12), (46, G["new"]): ("SHIFT", 22), - (46, G["isvoid"]): ("SHIFT", 24), (46, G["true"]): ("SHIFT", 25), + (46, G["isvoid"]): ("SHIFT", 24), + (46, G["string"]): ("SHIFT", 34), + (46, G["while"]): ("SHIFT", 13), + (46, G["false"]): ("SHIFT", 26), + (46, G["~"]): ("SHIFT", 27), + (46, G["not"]): ("SHIFT", 30), + (46, G["if"]): ("SHIFT", 12), + (46, G["("]): ("SHIFT", 11), + (46, G[")"]): ("REDUCE", G["expr-list -> e"]), (46, G["let"]): ("SHIFT", 14), - (46, G["while"]): ("SHIFT", 13), + (46, G["case"]): ("SHIFT", 21), + (46, G["id"]): ("SHIFT", 31), (46, G["int"]): ("SHIFT", 33), - (46, G["string"]): ("SHIFT", 34), - (46, G["not"]): ("SHIFT", 30), + (46, G["{"]): ("SHIFT", 10), (47, G[")"]): ("SHIFT", 48), + (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (49, G[")"]): ("REDUCE", G["expr-list -> not-empty-expr-list"]), - (50, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), (50, G[","]): ("SHIFT", 51), - (51, G["id"]): ("SHIFT", 31), - (51, G["{"]): ("SHIFT", 10), - (51, G["~"]): ("SHIFT", 27), - (51, G["("]): ("SHIFT", 11), - (51, G["false"]): ("SHIFT", 26), - (51, G["case"]): ("SHIFT", 21), - (51, G["if"]): ("SHIFT", 12), + (50, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), (51, G["new"]): ("SHIFT", 22), - (51, G["isvoid"]): ("SHIFT", 24), (51, G["true"]): ("SHIFT", 25), - (51, G["let"]): ("SHIFT", 14), - (51, G["while"]): ("SHIFT", 13), - (51, G["int"]): ("SHIFT", 33), + (51, G["isvoid"]): ("SHIFT", 24), (51, G["string"]): ("SHIFT", 34), + (51, G["while"]): ("SHIFT", 13), + (51, G["false"]): ("SHIFT", 26), + (51, G["~"]): ("SHIFT", 27), (51, G["not"]): ("SHIFT", 30), + (51, G["if"]): ("SHIFT", 12), + (51, G["("]): ("SHIFT", 11), + (51, G["let"]): ("SHIFT", 14), + (51, G["case"]): ("SHIFT", 21), + (51, G["id"]): ("SHIFT", 31), + (51, G["int"]): ("SHIFT", 33), + (51, G["{"]): ("SHIFT", 10), (52, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr , not-empty-expr-list"]), - (53, G["*"]): ("SHIFT", 41), (53, G["/"]): ("SHIFT", 54), + (53, G[")"]): ("REDUCE", G["arith -> term"]), (53, G["in"]): ("REDUCE", G["arith -> term"]), (53, G["-"]): ("REDUCE", G["arith -> term"]), (53, G["}"]): ("REDUCE", G["arith -> term"]), - (53, G["error"]): ("REDUCE", G["arith -> term"]), (53, G["of"]): ("REDUCE", G["arith -> term"]), (53, G["<"]): ("REDUCE", G["arith -> term"]), - (53, G[")"]): ("REDUCE", G["arith -> term"]), - (53, G["then"]): ("REDUCE", G["arith -> term"]), + (53, G["fi"]): ("REDUCE", G["arith -> term"]), (53, G["<="]): ("REDUCE", G["arith -> term"]), - (53, G["else"]): ("REDUCE", G["arith -> term"]), (53, G["="]): ("REDUCE", G["arith -> term"]), - (53, G[","]): ("REDUCE", G["arith -> term"]), - (53, G["fi"]): ("REDUCE", G["arith -> term"]), (53, G[";"]): ("REDUCE", G["arith -> term"]), + (53, G["else"]): ("REDUCE", G["arith -> term"]), + (53, G["then"]): ("REDUCE", G["arith -> term"]), (53, G["loop"]): ("REDUCE", G["arith -> term"]), + (53, G["error"]): ("REDUCE", G["arith -> term"]), + (53, G[","]): ("REDUCE", G["arith -> term"]), (53, G["pool"]): ("REDUCE", G["arith -> term"]), (53, G["+"]): ("REDUCE", G["arith -> term"]), - (54, G["isvoid"]): ("SHIFT", 24), - (54, G["int"]): ("SHIFT", 33), - (54, G["string"]): ("SHIFT", 34), + (53, G["*"]): ("SHIFT", 41), + (54, G["false"]): ("SHIFT", 26), (54, G["new"]): ("SHIFT", 22), + (54, G["string"]): ("SHIFT", 34), (54, G["id"]): ("SHIFT", 28), - (54, G["("]): ("SHIFT", 11), - (54, G["false"]): ("SHIFT", 26), - (54, G["~"]): ("SHIFT", 27), (54, G["true"]): ("SHIFT", 25), + (54, G["isvoid"]): ("SHIFT", 24), + (54, G["int"]): ("SHIFT", 33), + (54, G["~"]): ("SHIFT", 27), + (54, G["("]): ("SHIFT", 11), + (55, G[")"]): ("REDUCE", G["term -> term / factor"]), (55, G["-"]): ("REDUCE", G["term -> term / factor"]), (55, G["in"]): ("REDUCE", G["term -> term / factor"]), (55, G["*"]): ("REDUCE", G["term -> term / factor"]), (55, G["}"]): ("REDUCE", G["term -> term / factor"]), (55, G["/"]): ("REDUCE", G["term -> term / factor"]), - (55, G["error"]): ("REDUCE", G["term -> term / factor"]), (55, G["of"]): ("REDUCE", G["term -> term / factor"]), (55, G["<"]): ("REDUCE", G["term -> term / factor"]), - (55, G[")"]): ("REDUCE", G["term -> term / factor"]), - (55, G["then"]): ("REDUCE", G["term -> term / factor"]), + (55, G["fi"]): ("REDUCE", G["term -> term / factor"]), (55, G["<="]): ("REDUCE", G["term -> term / factor"]), - (55, G["else"]): ("REDUCE", G["term -> term / factor"]), (55, G["="]): ("REDUCE", G["term -> term / factor"]), - (55, G[","]): ("REDUCE", G["term -> term / factor"]), - (55, G["fi"]): ("REDUCE", G["term -> term / factor"]), (55, G[";"]): ("REDUCE", G["term -> term / factor"]), + (55, G["else"]): ("REDUCE", G["term -> term / factor"]), + (55, G["then"]): ("REDUCE", G["term -> term / factor"]), (55, G["loop"]): ("REDUCE", G["term -> term / factor"]), + (55, G["error"]): ("REDUCE", G["term -> term / factor"]), + (55, G[","]): ("REDUCE", G["term -> term / factor"]), (55, G["pool"]): ("REDUCE", G["term -> term / factor"]), (55, G["+"]): ("REDUCE", G["term -> term / factor"]), + (56, G[")"]): ("REDUCE", G["term -> factor"]), (56, G["-"]): ("REDUCE", G["term -> factor"]), (56, G["in"]): ("REDUCE", G["term -> factor"]), (56, G["*"]): ("REDUCE", G["term -> factor"]), (56, G["}"]): ("REDUCE", G["term -> factor"]), (56, G["/"]): ("REDUCE", G["term -> factor"]), - (56, G["error"]): ("REDUCE", G["term -> factor"]), (56, G["of"]): ("REDUCE", G["term -> factor"]), (56, G["<"]): ("REDUCE", G["term -> factor"]), - (56, G[")"]): ("REDUCE", G["term -> factor"]), - (56, G["then"]): ("REDUCE", G["term -> factor"]), + (56, G["fi"]): ("REDUCE", G["term -> factor"]), (56, G["<="]): ("REDUCE", G["term -> factor"]), - (56, G["else"]): ("REDUCE", G["term -> factor"]), (56, G["="]): ("REDUCE", G["term -> factor"]), - (56, G[","]): ("REDUCE", G["term -> factor"]), - (56, G["fi"]): ("REDUCE", G["term -> factor"]), (56, G[";"]): ("REDUCE", G["term -> factor"]), + (56, G["else"]): ("REDUCE", G["term -> factor"]), + (56, G["then"]): ("REDUCE", G["term -> factor"]), (56, G["loop"]): ("REDUCE", G["term -> factor"]), + (56, G["error"]): ("REDUCE", G["term -> factor"]), + (56, G[","]): ("REDUCE", G["term -> factor"]), (56, G["pool"]): ("REDUCE", G["term -> factor"]), (56, G["+"]): ("REDUCE", G["term -> factor"]), (57, G["type"]): ("SHIFT", 58), (58, G["."]): ("SHIFT", 59), (59, G["id"]): ("SHIFT", 60), (60, G["("]): ("SHIFT", 61), - (61, G["id"]): ("SHIFT", 31), - (61, G["{"]): ("SHIFT", 10), + (61, G["new"]): ("SHIFT", 22), + (61, G["true"]): ("SHIFT", 25), + (61, G["isvoid"]): ("SHIFT", 24), + (61, G["string"]): ("SHIFT", 34), + (61, G["while"]): ("SHIFT", 13), + (61, G["false"]): ("SHIFT", 26), (61, G["~"]): ("SHIFT", 27), + (61, G["not"]): ("SHIFT", 30), + (61, G["if"]): ("SHIFT", 12), (61, G["("]): ("SHIFT", 11), - (61, G["false"]): ("SHIFT", 26), (61, G[")"]): ("REDUCE", G["expr-list -> e"]), - (61, G["case"]): ("SHIFT", 21), - (61, G["if"]): ("SHIFT", 12), - (61, G["new"]): ("SHIFT", 22), - (61, G["isvoid"]): ("SHIFT", 24), - (61, G["true"]): ("SHIFT", 25), (61, G["let"]): ("SHIFT", 14), - (61, G["while"]): ("SHIFT", 13), + (61, G["case"]): ("SHIFT", 21), + (61, G["id"]): ("SHIFT", 31), (61, G["int"]): ("SHIFT", 33), - (61, G["string"]): ("SHIFT", 34), - (61, G["not"]): ("SHIFT", 30), + (61, G["{"]): ("SHIFT", 10), (62, G[")"]): ("SHIFT", 63), + (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (64, G["false"]): ("SHIFT", 26), (64, G["new"]): ("SHIFT", 22), - (64, G["id"]): ("SHIFT", 28), (64, G["true"]): ("SHIFT", 25), (64, G["isvoid"]): ("SHIFT", 24), - (64, G["int"]): ("SHIFT", 33), (64, G["("]): ("SHIFT", 11), (64, G["string"]): ("SHIFT", 34), - (64, G["false"]): ("SHIFT", 26), + (64, G["id"]): ("SHIFT", 28), + (64, G["int"]): ("SHIFT", 33), (64, G["~"]): ("SHIFT", 27), - (65, G["*"]): ("SHIFT", 41), (65, G["/"]): ("SHIFT", 54), + (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), (65, G["-"]): ("REDUCE", G["arith -> arith - term"]), (65, G["}"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["error"]): ("REDUCE", G["arith -> arith - term"]), (65, G["of"]): ("REDUCE", G["arith -> arith - term"]), (65, G["<"]): ("REDUCE", G["arith -> arith - term"]), - (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["then"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["fi"]): ("REDUCE", G["arith -> arith - term"]), (65, G["<="]): ("REDUCE", G["arith -> arith - term"]), - (65, G["else"]): ("REDUCE", G["arith -> arith - term"]), (65, G["="]): ("REDUCE", G["arith -> arith - term"]), - (65, G[","]): ("REDUCE", G["arith -> arith - term"]), - (65, G["fi"]): ("REDUCE", G["arith -> arith - term"]), (65, G[";"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["else"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["then"]): ("REDUCE", G["arith -> arith - term"]), (65, G["loop"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["error"]): ("REDUCE", G["arith -> arith - term"]), + (65, G[","]): ("REDUCE", G["arith -> arith - term"]), (65, G["pool"]): ("REDUCE", G["arith -> arith - term"]), (65, G["+"]): ("REDUCE", G["arith -> arith - term"]), - (66, G["true"]): ("SHIFT", 25), + (65, G["*"]): ("SHIFT", 41), (66, G["("]): ("SHIFT", 11), - (66, G["int"]): ("SHIFT", 33), - (66, G["false"]): ("SHIFT", 26), - (66, G["string"]): ("SHIFT", 34), (66, G["id"]): ("SHIFT", 28), + (66, G["string"]): ("SHIFT", 34), + (66, G["int"]): ("SHIFT", 33), (66, G["isvoid"]): ("SHIFT", 24), - (66, G["~"]): ("SHIFT", 27), + (66, G["false"]): ("SHIFT", 26), + (66, G["true"]): ("SHIFT", 25), (66, G["new"]): ("SHIFT", 22), + (66, G["~"]): ("SHIFT", 27), (67, G["+"]): ("SHIFT", 39), (67, G["-"]): ("SHIFT", 64), - (67, G["else"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["in"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["else"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["}"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), (67, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), - (68, G["true"]): ("SHIFT", 25), (68, G["("]): ("SHIFT", 11), - (68, G["int"]): ("SHIFT", 33), - (68, G["false"]): ("SHIFT", 26), - (68, G["string"]): ("SHIFT", 34), (68, G["id"]): ("SHIFT", 28), + (68, G["string"]): ("SHIFT", 34), + (68, G["int"]): ("SHIFT", 33), (68, G["isvoid"]): ("SHIFT", 24), - (68, G["~"]): ("SHIFT", 27), + (68, G["false"]): ("SHIFT", 26), + (68, G["true"]): ("SHIFT", 25), (68, G["new"]): ("SHIFT", 22), + (68, G["~"]): ("SHIFT", 27), (69, G["+"]): ("SHIFT", 39), (69, G["-"]): ("SHIFT", 64), - (69, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), - (70, G["true"]): ("SHIFT", 25), (70, G["("]): ("SHIFT", 11), - (70, G["int"]): ("SHIFT", 33), - (70, G["false"]): ("SHIFT", 26), - (70, G["string"]): ("SHIFT", 34), (70, G["id"]): ("SHIFT", 28), + (70, G["string"]): ("SHIFT", 34), + (70, G["int"]): ("SHIFT", 33), (70, G["isvoid"]): ("SHIFT", 24), - (70, G["~"]): ("SHIFT", 27), + (70, G["false"]): ("SHIFT", 26), + (70, G["true"]): ("SHIFT", 25), (70, G["new"]): ("SHIFT", 22), + (70, G["~"]): ("SHIFT", 27), (71, G["+"]): ("SHIFT", 39), (71, G["-"]): ("SHIFT", 64), - (71, G["else"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[";"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["in"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["else"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["}"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["error"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[";"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["error"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), (71, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), - (72, G["else"]): ("REDUCE", G["expr -> not expr"]), + (72, G[";"]): ("REDUCE", G["expr -> not expr"]), + (72, G[")"]): ("REDUCE", G["expr -> not expr"]), (72, G["in"]): ("REDUCE", G["expr -> not expr"]), - (72, G[","]): ("REDUCE", G["expr -> not expr"]), - (72, G["fi"]): ("REDUCE", G["expr -> not expr"]), + (72, G["else"]): ("REDUCE", G["expr -> not expr"]), + (72, G["then"]): ("REDUCE", G["expr -> not expr"]), (72, G["}"]): ("REDUCE", G["expr -> not expr"]), - (72, G[";"]): ("REDUCE", G["expr -> not expr"]), - (72, G["error"]): ("REDUCE", G["expr -> not expr"]), - (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), (72, G["of"]): ("REDUCE", G["expr -> not expr"]), + (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), + (72, G["error"]): ("REDUCE", G["expr -> not expr"]), + (72, G["fi"]): ("REDUCE", G["expr -> not expr"]), + (72, G[","]): ("REDUCE", G["expr -> not expr"]), (72, G["pool"]): ("REDUCE", G["expr -> not expr"]), - (72, G[")"]): ("REDUCE", G["expr -> not expr"]), - (72, G["then"]): ("REDUCE", G["expr -> not expr"]), (73, G[")"]): ("SHIFT", 74), + (74, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G[")"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["-"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["*"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["}"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["/"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["of"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["<"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G[")"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["then"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["<="]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["else"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["="]): ("REDUCE", G["factor -> ~ factor"]), - (75, G[","]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), (75, G[";"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["else"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["then"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G[","]): ("REDUCE", G["factor -> ~ factor"]), (75, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["+"]): ("REDUCE", G["factor -> ~ factor"]), + (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), (77, G["of"]): ("SHIFT", 78), @@ -835,226 +835,226 @@ def __action_table(): (79, G[":"]): ("SHIFT", 80), (80, G["type"]): ("SHIFT", 81), (81, G["=>"]): ("SHIFT", 82), - (82, G["true"]): ("SHIFT", 25), - (82, G["if"]): ("SHIFT", 12), - (82, G["int"]): ("SHIFT", 33), - (82, G["string"]): ("SHIFT", 34), (82, G["id"]): ("SHIFT", 31), - (82, G["let"]): ("SHIFT", 14), - (82, G["while"]): ("SHIFT", 13), (82, G["~"]): ("SHIFT", 27), - (82, G["("]): ("SHIFT", 11), - (82, G["not"]): ("SHIFT", 30), - (82, G["false"]): ("SHIFT", 26), + (82, G["int"]): ("SHIFT", 33), + (82, G["case"]): ("SHIFT", 21), + (82, G["let"]): ("SHIFT", 14), + (82, G["true"]): ("SHIFT", 25), (82, G["{"]): ("SHIFT", 10), - (82, G["isvoid"]): ("SHIFT", 24), (82, G["new"]): ("SHIFT", 22), - (82, G["case"]): ("SHIFT", 21), - (83, G["error"]): ("SHIFT", 86), + (82, G["string"]): ("SHIFT", 34), + (82, G["false"]): ("SHIFT", 26), + (82, G["while"]): ("SHIFT", 13), + (82, G["isvoid"]): ("SHIFT", 24), + (82, G["not"]): ("SHIFT", 30), + (82, G["if"]): ("SHIFT", 12), + (82, G["("]): ("SHIFT", 11), (83, G[";"]): ("SHIFT", 84), + (83, G["error"]): ("SHIFT", 86), (84, G["id"]): ("SHIFT", 79), (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), - (86, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), (86, G["id"]): ("SHIFT", 79), + (86, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), (87, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error case-list"]), (88, G["esac"]): ("SHIFT", 89), - (89, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), (90, G[","]): ("SHIFT", 91), + (90, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), (91, G["id"]): ("SHIFT", 15), (92, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), (93, G["in"]): ("SHIFT", 94), (94, G["new"]): ("SHIFT", 22), - (94, G["not"]): ("SHIFT", 30), (94, G["true"]): ("SHIFT", 25), - (94, G["id"]): ("SHIFT", 31), - (94, G["int"]): ("SHIFT", 33), + (94, G["isvoid"]): ("SHIFT", 24), + (94, G["while"]): ("SHIFT", 13), (94, G["string"]): ("SHIFT", 34), - (94, G["{"]): ("SHIFT", 10), (94, G["~"]): ("SHIFT", 27), - (94, G["case"]): ("SHIFT", 21), + (94, G["not"]): ("SHIFT", 30), (94, G["if"]): ("SHIFT", 12), - (94, G["isvoid"]): ("SHIFT", 24), - (94, G["("]): ("SHIFT", 11), - (94, G["let"]): ("SHIFT", 14), (94, G["false"]): ("SHIFT", 26), - (94, G["while"]): ("SHIFT", 13), - (95, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (94, G["let"]): ("SHIFT", 14), + (94, G["case"]): ("SHIFT", 21), + (94, G["{"]): ("SHIFT", 10), + (94, G["id"]): ("SHIFT", 31), + (94, G["("]): ("SHIFT", 11), + (94, G["int"]): ("SHIFT", 33), + (95, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (96, G["loop"]): ("SHIFT", 97), - (97, G["("]): ("SHIFT", 11), - (97, G["not"]): ("SHIFT", 30), + (97, G["string"]): ("SHIFT", 34), (97, G["false"]): ("SHIFT", 26), + (97, G["while"]): ("SHIFT", 13), + (97, G["("]): ("SHIFT", 11), (97, G["id"]): ("SHIFT", 31), - (97, G["~"]): ("SHIFT", 27), - (97, G["new"]): ("SHIFT", 22), - (97, G["{"]): ("SHIFT", 10), - (97, G["case"]): ("SHIFT", 21), - (97, G["true"]): ("SHIFT", 25), - (97, G["if"]): ("SHIFT", 12), (97, G["int"]): ("SHIFT", 33), - (97, G["string"]): ("SHIFT", 34), + (97, G["not"]): ("SHIFT", 30), (97, G["isvoid"]): ("SHIFT", 24), + (97, G["if"]): ("SHIFT", 12), + (97, G["new"]): ("SHIFT", 22), (97, G["let"]): ("SHIFT", 14), - (97, G["while"]): ("SHIFT", 13), + (97, G["case"]): ("SHIFT", 21), + (97, G["true"]): ("SHIFT", 25), + (97, G["~"]): ("SHIFT", 27), + (97, G["{"]): ("SHIFT", 10), (98, G["pool"]): ("SHIFT", 99), - (99, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (100, G["then"]): ("SHIFT", 101), - (101, G["id"]): ("SHIFT", 31), - (101, G["int"]): ("SHIFT", 33), + (101, G["not"]): ("SHIFT", 30), + (101, G["if"]): ("SHIFT", 12), (101, G["string"]): ("SHIFT", 34), - (101, G["{"]): ("SHIFT", 10), + (101, G["isvoid"]): ("SHIFT", 24), + (101, G["let"]): ("SHIFT", 14), (101, G["case"]): ("SHIFT", 21), + (101, G["false"]): ("SHIFT", 26), + (101, G["id"]): ("SHIFT", 31), + (101, G["{"]): ("SHIFT", 10), (101, G["~"]): ("SHIFT", 27), - (101, G["if"]): ("SHIFT", 12), (101, G["("]): ("SHIFT", 11), - (101, G["false"]): ("SHIFT", 26), - (101, G["while"]): ("SHIFT", 13), - (101, G["let"]): ("SHIFT", 14), - (101, G["isvoid"]): ("SHIFT", 24), + (101, G["int"]): ("SHIFT", 33), (101, G["new"]): ("SHIFT", 22), + (101, G["while"]): ("SHIFT", 13), (101, G["true"]): ("SHIFT", 25), - (101, G["not"]): ("SHIFT", 30), (102, G["else"]): ("SHIFT", 103), - (103, G["true"]): ("SHIFT", 25), - (103, G["~"]): ("SHIFT", 27), + (103, G["not"]): ("SHIFT", 30), + (103, G["if"]): ("SHIFT", 12), + (103, G["string"]): ("SHIFT", 34), + (103, G["let"]): ("SHIFT", 14), (103, G["case"]): ("SHIFT", 21), - (103, G["int"]): ("SHIFT", 33), (103, G["id"]): ("SHIFT", 31), - (103, G["string"]): ("SHIFT", 34), - (103, G["if"]): ("SHIFT", 12), + (103, G["{"]): ("SHIFT", 10), (103, G["isvoid"]): ("SHIFT", 24), - (103, G["let"]): ("SHIFT", 14), - (103, G["while"]): ("SHIFT", 13), - (103, G["("]): ("SHIFT", 11), (103, G["false"]): ("SHIFT", 26), - (103, G["not"]): ("SHIFT", 30), + (103, G["("]): ("SHIFT", 11), + (103, G["~"]): ("SHIFT", 27), + (103, G["int"]): ("SHIFT", 33), + (103, G["while"]): ("SHIFT", 13), + (103, G["true"]): ("SHIFT", 25), (103, G["new"]): ("SHIFT", 22), - (103, G["{"]): ("SHIFT", 10), (104, G["fi"]): ("SHIFT", 105), - (105, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (106, G[")"]): ("SHIFT", 107), + (107, G[")"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["-"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["in"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["*"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["}"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["/"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["error"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["of"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["<"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G[")"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["then"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["<="]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["."]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["else"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["@"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["="]): ("REDUCE", G["atom -> ( expr )"]), - (107, G[","]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), (107, G[";"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["else"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["then"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["@"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["error"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G[","]): ("REDUCE", G["atom -> ( expr )"]), (107, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["+"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["."]): ("REDUCE", G["atom -> ( expr )"]), (108, G["}"]): ("SHIFT", 109), - (109, G["else"]): ("REDUCE", G["expr -> { block }"]), + (109, G[";"]): ("REDUCE", G["expr -> { block }"]), + (109, G[")"]): ("REDUCE", G["expr -> { block }"]), (109, G["in"]): ("REDUCE", G["expr -> { block }"]), - (109, G[","]): ("REDUCE", G["expr -> { block }"]), - (109, G["fi"]): ("REDUCE", G["expr -> { block }"]), + (109, G["else"]): ("REDUCE", G["expr -> { block }"]), + (109, G["then"]): ("REDUCE", G["expr -> { block }"]), (109, G["}"]): ("REDUCE", G["expr -> { block }"]), - (109, G["error"]): ("REDUCE", G["expr -> { block }"]), - (109, G[";"]): ("REDUCE", G["expr -> { block }"]), - (109, G["loop"]): ("REDUCE", G["expr -> { block }"]), (109, G["of"]): ("REDUCE", G["expr -> { block }"]), - (109, G[")"]): ("REDUCE", G["expr -> { block }"]), + (109, G["loop"]): ("REDUCE", G["expr -> { block }"]), + (109, G["error"]): ("REDUCE", G["expr -> { block }"]), + (109, G["fi"]): ("REDUCE", G["expr -> { block }"]), + (109, G[","]): ("REDUCE", G["expr -> { block }"]), (109, G["pool"]): ("REDUCE", G["expr -> { block }"]), - (109, G["then"]): ("REDUCE", G["expr -> { block }"]), - (110, G["error"]): ("SHIFT", 113), (110, G[";"]): ("SHIFT", 111), - (111, G["true"]): ("SHIFT", 25), - (111, G["if"]): ("SHIFT", 12), - (111, G["int"]): ("SHIFT", 33), - (111, G["string"]): ("SHIFT", 34), - (111, G["id"]): ("SHIFT", 31), - (111, G["let"]): ("SHIFT", 14), - (111, G["while"]): ("SHIFT", 13), + (110, G["error"]): ("SHIFT", 113), (111, G["}"]): ("REDUCE", G["block -> expr ;"]), + (111, G["id"]): ("SHIFT", 31), (111, G["~"]): ("SHIFT", 27), - (111, G["("]): ("SHIFT", 11), - (111, G["not"]): ("SHIFT", 30), - (111, G["false"]): ("SHIFT", 26), + (111, G["int"]): ("SHIFT", 33), + (111, G["case"]): ("SHIFT", 21), + (111, G["let"]): ("SHIFT", 14), + (111, G["true"]): ("SHIFT", 25), (111, G["{"]): ("SHIFT", 10), + (111, G["new"]): ("SHIFT", 22), + (111, G["string"]): ("SHIFT", 34), + (111, G["false"]): ("SHIFT", 26), + (111, G["while"]): ("SHIFT", 13), (111, G["isvoid"]): ("SHIFT", 24), - (111, G["new"]): ("SHIFT", 22), - (111, G["case"]): ("SHIFT", 21), + (111, G["not"]): ("SHIFT", 30), + (111, G["if"]): ("SHIFT", 12), + (111, G["("]): ("SHIFT", 11), (112, G["}"]): ("REDUCE", G["block -> expr ; block"]), - (113, G["}"]): ("REDUCE", G["block -> expr error"]), - (113, G["true"]): ("SHIFT", 25), - (113, G["if"]): ("SHIFT", 12), - (113, G["int"]): ("SHIFT", 33), - (113, G["string"]): ("SHIFT", 34), (113, G["id"]): ("SHIFT", 31), - (113, G["let"]): ("SHIFT", 14), - (113, G["while"]): ("SHIFT", 13), (113, G["~"]): ("SHIFT", 27), - (113, G["("]): ("SHIFT", 11), - (113, G["not"]): ("SHIFT", 30), - (113, G["false"]): ("SHIFT", 26), + (113, G["int"]): ("SHIFT", 33), + (113, G["case"]): ("SHIFT", 21), + (113, G["let"]): ("SHIFT", 14), + (113, G["true"]): ("SHIFT", 25), (113, G["{"]): ("SHIFT", 10), - (113, G["isvoid"]): ("SHIFT", 24), (113, G["new"]): ("SHIFT", 22), - (113, G["case"]): ("SHIFT", 21), + (113, G["string"]): ("SHIFT", 34), + (113, G["false"]): ("SHIFT", 26), + (113, G["while"]): ("SHIFT", 13), + (113, G["isvoid"]): ("SHIFT", 24), + (113, G["}"]): ("REDUCE", G["block -> expr error"]), + (113, G["not"]): ("SHIFT", 30), + (113, G["if"]): ("SHIFT", 12), + (113, G["("]): ("SHIFT", 11), (114, G["}"]): ("REDUCE", G["block -> expr error block"]), (115, G["}"]): ("SHIFT", 116), - (116, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), (116, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (116, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), (117, G[":"]): ("SHIFT", 118), (118, G["type"]): ("SHIFT", 119), - (119, G[")"]): ("REDUCE", G["param-list -> id : type"]), (119, G[","]): ("SHIFT", 120), + (119, G[")"]): ("REDUCE", G["param-list -> id : type"]), (120, G["id"]): ("SHIFT", 117), (121, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), (122, G[")"]): ("SHIFT", 123), @@ -1062,47 +1062,47 @@ def __action_table(): (124, G["type"]): ("SHIFT", 125), (125, G["{"]): ("SHIFT", 126), (126, G["not"]): ("SHIFT", 30), + (126, G["if"]): ("SHIFT", 12), + (126, G["("]): ("SHIFT", 11), (126, G["id"]): ("SHIFT", 31), - (126, G["new"]): ("SHIFT", 22), - (126, G["{"]): ("SHIFT", 10), - (126, G["~"]): ("SHIFT", 27), - (126, G["true"]): ("SHIFT", 25), (126, G["case"]): ("SHIFT", 21), + (126, G["let"]): ("SHIFT", 14), (126, G["int"]): ("SHIFT", 33), - (126, G["string"]): ("SHIFT", 34), - (126, G["if"]): ("SHIFT", 12), (126, G["isvoid"]): ("SHIFT", 24), - (126, G["let"]): ("SHIFT", 14), + (126, G["{"]): ("SHIFT", 10), + (126, G["true"]): ("SHIFT", 25), + (126, G["new"]): ("SHIFT", 22), + (126, G["~"]): ("SHIFT", 27), + (126, G["string"]): ("SHIFT", 34), (126, G["while"]): ("SHIFT", 13), - (126, G["("]): ("SHIFT", 11), (126, G["false"]): ("SHIFT", 26), (127, G["}"]): ("SHIFT", 128), - (128, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (128, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (128, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (129, G["type"]): ("SHIFT", 130), (130, G[";"]): ("REDUCE", G["attribute -> id : type"]), (130, G["error"]): ("REDUCE", G["attribute -> id : type"]), (130, G["<-"]): ("SHIFT", 131), - (131, G["true"]): ("SHIFT", 25), - (131, G["if"]): ("SHIFT", 12), - (131, G["int"]): ("SHIFT", 33), - (131, G["string"]): ("SHIFT", 34), (131, G["id"]): ("SHIFT", 31), - (131, G["let"]): ("SHIFT", 14), - (131, G["while"]): ("SHIFT", 13), + (131, G["int"]): ("SHIFT", 33), (131, G["~"]): ("SHIFT", 27), - (131, G["("]): ("SHIFT", 11), - (131, G["not"]): ("SHIFT", 30), - (131, G["false"]): ("SHIFT", 26), + (131, G["let"]): ("SHIFT", 14), + (131, G["case"]): ("SHIFT", 21), + (131, G["true"]): ("SHIFT", 25), + (131, G["new"]): ("SHIFT", 22), (131, G["{"]): ("SHIFT", 10), + (131, G["string"]): ("SHIFT", 34), + (131, G["false"]): ("SHIFT", 26), + (131, G["while"]): ("SHIFT", 13), (131, G["isvoid"]): ("SHIFT", 24), - (131, G["new"]): ("SHIFT", 22), - (131, G["case"]): ("SHIFT", 21), + (131, G["not"]): ("SHIFT", 30), + (131, G["if"]): ("SHIFT", 12), + (131, G["("]): ("SHIFT", 11), (132, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), (132, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), (133, G["}"]): ("SHIFT", 134), - (134, G["class"]): ("REDUCE", G["class-def -> class type { feature-list }"]), (134, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), + (134, G["class"]): ("REDUCE", G["class-def -> class type { feature-list }"]), (135, G["error"]): ("SHIFT", 143), (135, G[";"]): ("SHIFT", 136), (136, G["id"]): ("SHIFT", 4), @@ -1124,8 +1124,8 @@ def __action_table(): (147, G["id"]): ("SHIFT", 4), (147, G["}"]): ("REDUCE", G["feature-list -> e"]), (148, G["}"]): ("SHIFT", 149), - (149, G["class"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), (149, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), + (149, G["class"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), (150, G["$"]): ("OK", None), (151, G["$"]): ("REDUCE", G["program -> class-list"]), (152, G["class"]): ("SHIFT", 1), @@ -1136,234 +1136,234 @@ def __action_table(): @staticmethod def __goto_table(): return { - (0, G["class-list"]): 151, (0, G["program"]): 150, + (0, G["class-list"]): 151, (0, G["class-def"]): 152, + (3, G["method"]): 138, (3, G["attribute"]): 135, (3, G["feature-list"]): 133, - (3, G["method"]): 138, (5, G["param-list"]): 122, (9, G["atom"]): 43, - (9, G["arith"]): 38, (9, G["term"]): 53, (9, G["function-call"]): 35, - (9, G["comp"]): 37, + (9, G["arith"]): 38, (9, G["expr"]): 115, (9, G["factor"]): 56, - (10, G["term"]): 53, - (10, G["arith"]): 38, + (9, G["comp"]): 37, + (10, G["expr"]): 110, (10, G["block"]): 108, + (10, G["arith"]): 38, (10, G["factor"]): 56, - (10, G["expr"]): 110, + (10, G["term"]): 53, + (10, G["atom"]): 43, (10, G["comp"]): 37, (10, G["function-call"]): 35, - (10, G["atom"]): 43, (11, G["arith"]): 38, - (11, G["factor"]): 56, (11, G["term"]): 53, + (11, G["expr"]): 106, (11, G["comp"]): 37, (11, G["atom"]): 43, - (11, G["expr"]): 106, + (11, G["factor"]): 56, (11, G["function-call"]): 35, - (12, G["function-call"]): 35, + (12, G["atom"]): 43, (12, G["arith"]): 38, (12, G["expr"]): 100, - (12, G["atom"]): 43, (12, G["term"]): 53, - (12, G["factor"]): 56, + (12, G["function-call"]): 35, (12, G["comp"]): 37, + (12, G["factor"]): 56, (13, G["arith"]): 38, - (13, G["factor"]): 56, - (13, G["function-call"]): 35, (13, G["term"]): 53, - (13, G["expr"]): 96, (13, G["atom"]): 43, (13, G["comp"]): 37, + (13, G["function-call"]): 35, + (13, G["expr"]): 96, + (13, G["factor"]): 56, (14, G["declaration-list"]): 93, (18, G["declaration-list"]): 19, + (20, G["term"]): 53, (20, G["expr"]): 90, - (20, G["arith"]): 38, (20, G["atom"]): 43, - (20, G["function-call"]): 35, - (20, G["term"]): 53, + (20, G["arith"]): 38, (20, G["factor"]): 56, + (20, G["function-call"]): 35, (20, G["comp"]): 37, - (21, G["expr"]): 77, - (21, G["atom"]): 43, (21, G["arith"]): 38, - (21, G["term"]): 53, (21, G["factor"]): 56, - (21, G["function-call"]): 35, + (21, G["expr"]): 77, + (21, G["term"]): 53, + (21, G["atom"]): 43, (21, G["comp"]): 37, + (21, G["function-call"]): 35, (24, G["atom"]): 43, (24, G["factor"]): 76, (24, G["function-call"]): 35, - (27, G["factor"]): 75, (27, G["atom"]): 43, + (27, G["factor"]): 75, (27, G["function-call"]): 35, - (29, G["atom"]): 43, - (29, G["expr"]): 50, - (29, G["term"]): 53, (29, G["arith"]): 38, + (29, G["expr"]): 50, (29, G["comp"]): 37, (29, G["not-empty-expr-list"]): 49, + (29, G["atom"]): 43, (29, G["factor"]): 56, - (29, G["expr-list"]): 73, + (29, G["term"]): 53, (29, G["function-call"]): 35, - (30, G["term"]): 53, + (29, G["expr-list"]): 73, (30, G["arith"]): 38, - (30, G["function-call"]): 35, + (30, G["factor"]): 56, (30, G["atom"]): 43, - (30, G["comp"]): 37, + (30, G["term"]): 53, + (30, G["function-call"]): 35, (30, G["expr"]): 72, - (30, G["factor"]): 56, - (32, G["term"]): 53, + (30, G["comp"]): 37, (32, G["arith"]): 38, - (32, G["expr"]): 36, - (32, G["function-call"]): 35, + (32, G["factor"]): 56, (32, G["atom"]): 43, + (32, G["term"]): 53, + (32, G["function-call"]): 35, + (32, G["expr"]): 36, (32, G["comp"]): 37, - (32, G["factor"]): 56, + (39, G["atom"]): 43, (39, G["term"]): 40, (39, G["function-call"]): 35, - (39, G["atom"]): 43, (39, G["factor"]): 56, (41, G["atom"]): 43, (41, G["factor"]): 42, (41, G["function-call"]): 35, - (46, G["atom"]): 43, - (46, G["expr-list"]): 47, - (46, G["expr"]): 50, - (46, G["term"]): 53, (46, G["arith"]): 38, + (46, G["expr"]): 50, (46, G["comp"]): 37, (46, G["not-empty-expr-list"]): 49, + (46, G["atom"]): 43, (46, G["factor"]): 56, + (46, G["term"]): 53, (46, G["function-call"]): 35, - (51, G["atom"]): 43, - (51, G["expr"]): 50, - (51, G["term"]): 53, + (46, G["expr-list"]): 47, (51, G["arith"]): 38, (51, G["not-empty-expr-list"]): 52, + (51, G["expr"]): 50, (51, G["comp"]): 37, + (51, G["atom"]): 43, (51, G["factor"]): 56, + (51, G["term"]): 53, (51, G["function-call"]): 35, (54, G["atom"]): 43, - (54, G["function-call"]): 35, (54, G["factor"]): 55, - (61, G["expr-list"]): 62, - (61, G["atom"]): 43, - (61, G["expr"]): 50, - (61, G["term"]): 53, + (54, G["function-call"]): 35, (61, G["arith"]): 38, + (61, G["expr"]): 50, (61, G["comp"]): 37, (61, G["not-empty-expr-list"]): 49, + (61, G["atom"]): 43, (61, G["factor"]): 56, + (61, G["term"]): 53, (61, G["function-call"]): 35, + (61, G["expr-list"]): 62, + (64, G["atom"]): 43, (64, G["term"]): 65, (64, G["function-call"]): 35, - (64, G["atom"]): 43, (64, G["factor"]): 56, (66, G["term"]): 53, (66, G["arith"]): 67, (66, G["atom"]): 43, - (66, G["function-call"]): 35, (66, G["factor"]): 56, + (66, G["function-call"]): 35, (68, G["term"]): 53, (68, G["arith"]): 69, (68, G["atom"]): 43, - (68, G["function-call"]): 35, (68, G["factor"]): 56, + (68, G["function-call"]): 35, (70, G["term"]): 53, (70, G["arith"]): 71, (70, G["atom"]): 43, - (70, G["function-call"]): 35, (70, G["factor"]): 56, + (70, G["function-call"]): 35, (78, G["case-list"]): 88, - (82, G["term"]): 53, (82, G["arith"]): 38, - (82, G["expr"]): 83, (82, G["factor"]): 56, + (82, G["term"]): 53, + (82, G["atom"]): 43, (82, G["comp"]): 37, + (82, G["expr"]): 83, (82, G["function-call"]): 35, - (82, G["atom"]): 43, (84, G["case-list"]): 85, (86, G["case-list"]): 87, (91, G["declaration-list"]): 92, - (94, G["term"]): 53, (94, G["arith"]): 38, - (94, G["function-call"]): 35, - (94, G["atom"]): 43, (94, G["expr"]): 95, - (94, G["comp"]): 37, (94, G["factor"]): 56, - (97, G["arith"]): 38, - (97, G["atom"]): 43, + (94, G["atom"]): 43, + (94, G["term"]): 53, + (94, G["function-call"]): 35, + (94, G["comp"]): 37, (97, G["term"]): 53, - (97, G["expr"]): 98, - (97, G["function-call"]): 35, + (97, G["atom"]): 43, (97, G["comp"]): 37, + (97, G["arith"]): 38, + (97, G["function-call"]): 35, + (97, G["expr"]): 98, (97, G["factor"]): 56, - (101, G["function-call"]): 35, - (101, G["expr"]): 102, - (101, G["atom"]): 43, (101, G["arith"]): 38, + (101, G["atom"]): 43, + (101, G["factor"]): 56, + (101, G["function-call"]): 35, (101, G["term"]): 53, (101, G["comp"]): 37, - (101, G["factor"]): 56, + (101, G["expr"]): 102, (103, G["term"]): 53, (103, G["arith"]): 38, + (103, G["expr"]): 104, (103, G["atom"]): 43, (103, G["function-call"]): 35, (103, G["comp"]): 37, - (103, G["expr"]): 104, (103, G["factor"]): 56, - (111, G["term"]): 53, + (111, G["expr"]): 110, (111, G["arith"]): 38, (111, G["factor"]): 56, - (111, G["expr"]): 110, + (111, G["block"]): 112, + (111, G["term"]): 53, + (111, G["atom"]): 43, (111, G["comp"]): 37, (111, G["function-call"]): 35, - (111, G["atom"]): 43, - (111, G["block"]): 112, - (113, G["block"]): 114, - (113, G["term"]): 53, + (113, G["expr"]): 110, (113, G["arith"]): 38, (113, G["factor"]): 56, - (113, G["expr"]): 110, + (113, G["term"]): 53, + (113, G["block"]): 114, + (113, G["atom"]): 43, (113, G["comp"]): 37, (113, G["function-call"]): 35, - (113, G["atom"]): 43, (120, G["param-list"]): 121, (126, G["atom"]): 43, - (126, G["arith"]): 38, - (126, G["expr"]): 127, (126, G["term"]): 53, (126, G["function-call"]): 35, - (126, G["comp"]): 37, + (126, G["arith"]): 38, + (126, G["expr"]): 127, (126, G["factor"]): 56, - (131, G["term"]): 53, + (126, G["comp"]): 37, (131, G["arith"]): 38, (131, G["factor"]): 56, + (131, G["term"]): 53, + (131, G["atom"]): 43, (131, G["comp"]): 37, (131, G["expr"]): 132, (131, G["function-call"]): 35, - (131, G["atom"]): 43, + (136, G["method"]): 138, (136, G["attribute"]): 135, (136, G["feature-list"]): 137, - (136, G["method"]): 138, - (139, G["attribute"]): 135, (139, G["method"]): 138, + (139, G["attribute"]): 135, (139, G["feature-list"]): 140, - (141, G["attribute"]): 135, (141, G["method"]): 138, + (141, G["attribute"]): 135, (141, G["feature-list"]): 142, - (143, G["feature-list"]): 144, - (143, G["attribute"]): 135, (143, G["method"]): 138, + (143, G["attribute"]): 135, + (143, G["feature-list"]): 144, (147, G["feature-list"]): 148, - (147, G["attribute"]): 135, (147, G["method"]): 138, - (152, G["class-def"]): 152, + (147, G["attribute"]): 135, (152, G["class-list"]): 153, + (152, G["class-def"]): 152, } diff --git a/cool/semantics/execution.py b/cool/semantics/execution.py index 315b8b686..b2786b4cf 100644 --- a/cool/semantics/execution.py +++ b/cool/semantics/execution.py @@ -1,9 +1,9 @@ from typing import Any, Dict -import semantics.utils.astnodes as ast -import semantics.utils.errors as err -import semantics.visitor as visitor -from semantics.utils.scope import Context, Method, Scope, Type +import cool.semantics.utils.astnodes as ast +import cool.semantics.utils.errors as err +import cool.semantics.visitor as visitor +from cool.semantics.utils.scope import Context, Method, Scope, Type class ExecutionError(Exception): diff --git a/cool/semantics/formatter.py b/cool/semantics/formatter.py index 0cb447b98..e4d4538d6 100644 --- a/cool/semantics/formatter.py +++ b/cool/semantics/formatter.py @@ -1,5 +1,5 @@ -import semantics.utils.astnodes as ast -import semantics.visitor as visitor +import cool.semantics.utils.astnodes as ast +import cool.semantics.visitor as visitor class CodeBuilder: diff --git a/cool/semantics/overridden.py b/cool/semantics/overridden.py index 62d8ba4e1..747862108 100644 --- a/cool/semantics/overridden.py +++ b/cool/semantics/overridden.py @@ -1,9 +1,9 @@ from typing import List, Dict, Optional -import semantics.utils.astnodes as ast -import semantics.utils.errors as err -import semantics.visitor as visitor -from semantics.utils.scope import Context, Type, SemanticError +import cool.semantics.utils.astnodes as ast +import cool.semantics.utils.errors as err +import cool.semantics.visitor as visitor +from cool.semantics.utils.scope import Context, Type, SemanticError def topological_ordering(program_node: ast.ProgramNode, diff --git a/cool/semantics/type_builder.py b/cool/semantics/type_builder.py index 8aaaacb7d..6d1130e80 100644 --- a/cool/semantics/type_builder.py +++ b/cool/semantics/type_builder.py @@ -1,9 +1,9 @@ from typing import List, Optional -import semantics.utils.astnodes as ast -import semantics.utils.errors as err -import semantics.visitor as visitor -from semantics.utils.scope import Context, SemanticError, Type, ErrorType +import cool.semantics.utils.astnodes as ast +import cool.semantics.utils.errors as err +import cool.semantics.visitor as visitor +from cool.semantics.utils.scope import Context, SemanticError, Type, ErrorType class TypeBuilder: diff --git a/cool/semantics/type_checker.py b/cool/semantics/type_checker.py index fdf6bfe11..bd46897d3 100644 --- a/cool/semantics/type_checker.py +++ b/cool/semantics/type_checker.py @@ -1,9 +1,9 @@ from typing import List -import semantics.utils.astnodes as ast -import semantics.utils.errors as err -import semantics.visitor as visitor -from semantics.utils.scope import (Context, ErrorType, Method, Scope, +import cool.semantics.utils.astnodes as ast +import cool.semantics.utils.errors as err +import cool.semantics.visitor as visitor +from cool.semantics.utils.scope import (Context, ErrorType, Method, Scope, SemanticError, Type) diff --git a/cool/semantics/type_collector.py b/cool/semantics/type_collector.py index 0c027891d..765f1c4a8 100644 --- a/cool/semantics/type_collector.py +++ b/cool/semantics/type_collector.py @@ -1,8 +1,8 @@ from typing import List -import semantics.utils.astnodes as ast -import semantics.visitor as visitor -from semantics.utils.scope import Context, SemanticError +import cool.semantics.utils.astnodes as ast +import cool.semantics.visitor as visitor +from cool.semantics.utils.scope import Context, SemanticError class TypeCollector: diff --git a/cool/semantics/type_inference.py b/cool/semantics/type_inference.py index 862f4ffba..ec1423cb4 100644 --- a/cool/semantics/type_inference.py +++ b/cool/semantics/type_inference.py @@ -36,11 +36,11 @@ from collections import OrderedDict, deque from typing import Dict, List, Optional, Set, Tuple -import semantics.utils.astnodes as ast -import semantics.utils.errors as err -import semantics.visitor as visitor -from semantics.utils.scope import (Attribute, Context, ErrorType, Method, - Scope, SemanticError, Type, VariableInfo) +import cool.semantics.utils.astnodes as ast +import cool.semantics.utils.errors as err +import cool.semantics.visitor as visitor +from cool.semantics.utils.scope import (Attribute, Context, ErrorType, Method, + Scope, SemanticError, Type, VariableInfo) class DependencyNode: diff --git a/tests/test_cool.py b/tests/test_cool.py index 4f3d11776..f8671f909 100644 --- a/tests/test_cool.py +++ b/tests/test_cool.py @@ -1,21 +1,14 @@ -import os -import subprocess -import sys -import tempfile - from pathlib import Path from typing import List, Tuple -sys.path.append(os.path.join(os.getcwd(), 'cool')) from cool.lexertab import CoolLexer from cool.parsertab import CoolParser from cool.semantics import TypeCollector, TypeBuilder, OverriddenMethodChecker, TypeChecker, topological_ordering +from cool.semantics.formatter import CodeBuilder from cool.semantics.type_inference import InferenceChecker from cool.semantics.utils.scope import Context, Scope - - def tokenize(code): lexer = CoolLexer() tokens = lexer(code) @@ -56,34 +49,32 @@ def get_programs(folder_name: str) -> Tuple[List[str], List[str]]: return programs, results +def test_lexer(): + programs, results = get_programs('lexer') + for program, result in zip(programs, results): + tokens, lexer = tokenize(program) + assert lexer.contain_errors and '\n'.join(lexer.errors) == result.strip() -# def test_lexer(): -# programs, results = get_programs('lexer') -# -# for program, result in zip(programs, results): -# tokens, lexer = tokenize(program) -# assert lexer.contain_errors and '\n'.join(lexer.errors) == result.strip() -# -# -# def test_parser(): -# programs, results = get_programs('parser') -# -# total = 20 -# for code, result in zip(programs[total - 1:total], results[total - 1:total]): -# tokens, _ = tokenize(code) -# ast, parser = parse(tokens) -# assert parser.contains_errors and '\n'.join(parser.errors) == result +def test_parser(): + programs, results = get_programs('parser') -# def test_inference(): -# programs, results = get_programs('inference') -# -# for program, result in zip(programs, results): -# tokens, _ = tokenize(program) -# ast, _ = parse(tokens) -# ast, _, _, errors = check_semantics(ast, Scope(), Context(), []) -# assert not errors and CodeBuilder().visit(ast, 0) == result + total = 20 + for code, result in zip(programs[total - 1:total], results[total - 1:total]): + tokens, _ = tokenize(code) + ast, parser = parse(tokens) + assert parser.contains_errors and '\n'.join(parser.errors) == result + + +def test_inference(): + programs, results = get_programs('inference') + + for program, result in zip(programs, results): + tokens, _ = tokenize(program) + ast, _ = parse(tokens) + ast, _, _, errors = check_semantics(ast, Scope(), Context(), []) + assert not errors and CodeBuilder().visit(ast, 0) == result def test_semantic(): @@ -94,7 +85,7 @@ def test_semantic(): tokens, _ = tokenize(code) ast, parser = parse(tokens) ast, _, _, errors = check_semantics(ast, Scope(), Context(), []) - # assert (parser.contains_errors or errors) and '\n'.join(parser.errors + errors) == result + assert (parser.contains_errors or errors) and '\n'.join(parser.errors + errors) == result -test_semantic() \ No newline at end of file +test_semantic() From a9cb1f4f2015ad71d0ec95b3174eb2e9ed4c5516 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Wed, 25 Nov 2020 00:49:49 +0100 Subject: [PATCH 083/143] Agregado informe en PDF --- Informe.md | 26 -------------------------- Informe.pdf | Bin 0 -> 57185 bytes 2 files changed, 26 deletions(-) create mode 100644 Informe.pdf diff --git a/Informe.md b/Informe.md index 43a2e4a75..968da4bed 100644 --- a/Informe.md +++ b/Informe.md @@ -11,32 +11,6 @@ Estudiantes: > - Alejandro Klever Clemente C-311 > - Miguel Angel Gonzalez Calles C-311 -## Indice: - -- 1 Inferencia de tipos. - - - 1.1 Algoritmo y Grafo de Dependecias. - - - 1.2 Nodos de Dependencia. - - - 1.3 Casos factibles. - - - 1.3.1 Ejemplos de casos factibles para la inferencia. - - - 1.4 Casos No factibles. - - - 1.4.1 Casos Generales. - - - 1.4.2 Casos Particulares. - - - 1.5 Expresiones atómicas. - -- 2 CLI-API - -- 3 Lexing y Parsing - -- 4 Testing - ### 1 Inferencia de Tipos COOL es un lenguaje de programación estáticamente tipado, y aunque el lenguaje no presenta inferencia de tipos, esta es una característica muy útil que incorporaremos en un nuestro intérprete. diff --git a/Informe.pdf b/Informe.pdf new file mode 100644 index 0000000000000000000000000000000000000000..915c24995fde51bcb05517d7aab51c687bb61dbf GIT binary patch literal 57185 zcmc$_Wmp`|w)ahN3GPlHxHGuBYj6!VxVyW%yK8WFcZUE0g1b8ex0ht!_u2cLv)^Yw z-=4WI5e5;Zgryg<1L`?g+x^ixzw1mu96&5VEZ(=)AU5x% zjNY{jAao#%AWZLDmiH3!cGiZD2Ecz5QFs>;fiS z21Z6E76uj;1|~)gN?2ZASfG{RZ%+aL>anX0kceKy#X(Hb;k_g*y`lh-gPr5=0~sO) zItC_KdILQoMmmOfmj(W@7m!dSGSaiK|D(~fHz%T(wYCEO(>(KE<~8Z%^&A|4c2-36 z!ayfe1K<}iLG8bN;P_j_Kt!*mu0aF<5D~$$GXm&X7=C||y7!j&pLUu4on00Nwtr{$?>75yc3A-||IN|=s`)L-t z&7VGy*E4=^QF%Q(pp^sBZ`Z!OH@UTy!+X-6i1D}nJ>v_|-rCX50QjE6_KzF^D=X{Y z0``9-Wq^jJdVJj~Jr!Rlb{oVQRhJQ;%->dRRCCW;~ z`j1P9vJw4N2~l>UfB64fsV1jy1~m91eowxC{~ES`s`%S;O`?B}jel)NX`q#{g9#Di z-{ws%-bWu1y{N_ez!nA?SQ`R=TeEj~|La-8x@4ScYfmjVqIcd^eRuTbB&Li-WB54y zM21}*{y_lrME~bNOeJ+#gW5v)%gYFcsb(DEl9!#ZM3hE-&4fHLBI4BDP&%LIqu6ED zdN^BE_N$@?jCZHkQlh(R@+#lJ=K49k_jfNsUQC_Tid8o9EwJUmnlLs!GdG)>um~PtSKRjyLJw>Yt9C2dYlNwo%49oRzg%JDG#0){eFp z`u6**BdrLZo|3;hTens;0G4BGe=M2gN2OzXS*xDG0grmoT4`RNrdFd*kI20;S(Tq! zkAAgA-^p-S9NnMqy0?Ah?RYJG`PC(e>23A))N;SPzD(%d9I$4xHMYN+j@Zc1djD)N z-Er`A7CjXl=(XOvdyP0ih_HV%v~@kzc6(7?31$?4yc&7$sYoz1NkSHtFj?kw!2JbZ ztbQq3^k)BuO}`V#uFe9`8=}%(u8yyB*RG#X?77o@epehdTZMJ-X6?GsU8A8Yn7aGi zHI!>^wf5Y1(wt5IPMIg=x)PU>HVL2Hb5)jcrz4x30Y}R~IcL*^#^+R+4i+ldyh; zF5r8=vHB2t93nqg%B%KN9p6fME_ntMlV3#B$&Vp(J+cye&aI`I@#~a=0N3FozL)Z( zARqSGU%+y%m~fZ{FXYcM$96_mb}Y9ckFx1S;UmX3*+96=-J8;Xu)AU9a`wEgQH?Xuk2C)@~yO*MYLyz0*Og85PX}zyH~QjOkP=cCr|Z4xYMI z*`Rkazy&lR&LRo7mf86!q((05o~S003A#r*Zh3ML#r1XpIs)IPB|MTw^GOmK0Pe3` zr7Aoa>%yI?RWbGf!qmDKsd`g~vcVb>7LG(UczHI;AqHzYpBlxvy>PDcD9Y2tXJO5M zp=f(H0hdD8rkI1&orQO6sb0*5iT-8A)A|PSD`#PtMxb2h%N&NIYpn!+r`MwLgieX5 zdsP&l(yQIo0`9Y>H1kmD?VFt{8QO$?UU)<)hg%>?(z{^tJ#*s zkQ81*TU9(2>I?xHLkfv*t@yh!1rrDo>8Il9r?ISDM3%Qyrgfe(M!^LWP6ZRU z;_2EjrggFPhu!zTewsx>sER(IEAOF#r^+t^7m8%in1Xtx{Z4w7kEz5%9f44BOhy>s zky7o!xwYdHFVd}ATo+kf6mfo~7b+1Hkrndv&a zM2c~Ladpt@Ik;$RV3}TaT)=DgJE*0&%lB8(QF5rq17UwwScx5_F+Yy7xCRgw|=qBFx=~SIHdJ;0(sGRC0fwW;0g7jmBw8!mq zk(3OIqp9y~>XJR|`V2fjK`FB6eEf1dYCY0910QzHvxN$6=PZ8>ZWv?)-}6MUgR186 z2wOu23J)}c=kb3)%ts>mb`V5#g9RC}$&hT*$AIfmlmfEV)*Yj`XM}u0mn%=ht|I$W z%QsLC5*7Q1_^7RbfuNEWdA?VdnmvZV+9*ke&oZzc`-@1lFfd zsN&taUU0}@_~U1+mL{`7Y8WFXC$*o7ZTMi26;+zjcx-qD%COQx2G%htCJm?oIv?`0 z81e#7EE5XzBOb+}H(&Pq85WHE&g*k61?4Pc3$R5`ro#B;2XxJ*ZzlDw?t@?@P&FbR+nwCZNiT|sPd0g&`C zJ?U97kbn&@6<~?M@j@&z%kI7MYXmy>^;eKrCrhT{OQ4NkqK-p=1xniKWz6KMf|NZd z#i-JO(v7Xe~7zjib8H(VAt^$`Bx6l+}Hj+4*Y9@_tEc=rapZ5_p zb@M1-gmYDB-3PF{pkhhWb!P$&N%TyClEH>yrbWFxSYw!t7Q>KV7(=%{Dr#0YaBR}| z_L5^1!Mu5~>iIA#gbgwSAe<o!*E7`wlV05hPgr;ntldapXt3$NPF2D?SQ8* zpB_4FTY1U433-F{>uxX2>KYtHlplKM0#)EB*^hlsRNHFFUk0w&of7IxH$!|$(D6z_ zi`Ch;HimbQ*BWPdK$z0N^A+}5e+2A>iR6Hr0v&!mtTrlANTHg$>D-;iD?v9}K%(2L zV@aSB&Ymo0)h@=ueebq2MY$&)d;FAqLb7^xi*j~*Vv5&$64gVc5JFZjq_AFV)1L8d z!WX5=5G;a8&ze<=!GI9RprfKY&=ec`2s}aixZYVNdAbnV)hJI8($zpP-#}&Hu;lvb z9F*e6Mao46NWsx)V=Fv0PiZ!~BQZoQfNvGyo41?7doe8@?X##WqS^o*uq75JHR0&R=tz4}T6G64 zUwlC{URpGNb7xp-ZPhFcY8Re*KgB`@K8yL@lVX1p)TiMUf9ud|SrRj?XYM*Pq^ z&Hj92Pm#w~voSP+&NHd+4{G=QTN!n@s)?bcpUZ0S3|R==SMnELlqh4&e%o1p8KmS+ zzR-C{IkFHyC8~NMxvf7o>4$LAh%~;gG^Vx?*_IMR2-TpVVb&7$d_@Qt%lQnZ*S0`r zRUdGXI>r942RGb;P~N+>y5ZCqzp7tucg$>r?!a|=B8YREk{RT*>JeiD52LQv{A)kf zO)9_XsH_|2Y1j?S=?YTdQYTW%Gkr1>G_oY_!8dL;9CeVS;Az2X|JIz@e3N=1qw-yo zpO$XXOjKHuGDv_92b3|3>Km>3xgknbvPJm7kHC=~G+N)xoTTgJBwz`XJ*-+wS{GH6 z#f$iKTMUEd&e5LVA%#CzlL~|7V{nCBDbDsxx6gz!Cxs#dcj90sU__o$Q>`xQv(TK? zE$DUQ=RPs|N;4%ypIY1F7L#@hZ0bcik#R39x@!ykVMF)i(JVv~7{);_GB(p!$-EY3 zj6vFFiBj_zrTy|HDox*;jYA(?J<3uk`1zBytlC2 zwLeXu#^Q@JGJ&Vv|T zQGz6RA0ihrba47*C$|w_67^G2N7sUldHQU>^j0~xuU2Zh)uSGkJLpmEBx|$Xu_HoE z)N}Dk6kT}n-=wwrY`+Sw=(oT+mwR>VHjqxz^9tA%agea7L2BbjThS?F)!rR2V)z$P% zf7i2I>Kik0hqk+5r3gwcYZH6&(4@%E>v`aqF_$%dr8%g}kP{dZ4wxu_Q83X@3QZWO z*K~L(9Ns1rSwcT)17|%LV2r+)ro?rRTcXK;=yRWkPQrau**%JGcdS+i=~VcR%%Xq| zDu$XCU=fKmt-}!E&w?zTLVXj9TqKgtz>RbnKk;&B!I;~k;Y8a^A<@V>_3>kpATRlR z?PSAl$~{!kd<{(nTE!Es)^%hFQXf*c)=i|{oSHF}Usc_6&sBID9Y-rw{M%|mAfWS` zDiV=F#No8V0lz}^IH(gerJ9jI4-=f(6%$+$&+!=TJ`>HZK6fp|Io6yYYrAaYZs|9D zX-4G1KEE3jvfI=iw#Bv>iEOFyPaC2)H@#GKULKa}ZVnvQ+sDM}{5~BsP}CrY8u3ai z3)Frd+XqOpE1 zFwRV#y-p1zQ%<<|WW_&3`lN$1#ey?cbPXkwgEqs^H|-#5qF0&%lQGi5leNp+xL0Hx zOsBwbYFWlbnp=)2=bRS0vTK!nfgQTncR~|$+98a(VL?vvm!X%f5f!GmaIZKd{AAGv zvkno)=#us&Y?IgZl67?F+Y*amE+a{I@w?E{E3o;Zz(n5$-kCfjh=O4PDse4c>L{=7 zg_utS_oglgUWjBlY8IJ{uf6!Kh$|w*hO~NeMw!SMj=&CVSMyT3s?wH)+uN;8l#-3F zMFsXn2(=NS`X5&gpY^22#H>p&aMnLY(fP0g3f)tPs%QslKkg8WC_ zJ`oISx;LWrTNej1Dk|xk@UdiU>NCSIt4qSoF5}auoOmQFEI;27%G-~lMna>t;$$cIeQB59 z_NY8>Ei5UGn_T620%SYGp|~w0ev(kF&~Q%p)o?Q&29BASeqFA;Fv5TBSxS>Ck?z~7 z#BoDl8BZUC&||p;-9mX0zVw3c@WD}GoQqdwY-l(N?H!A5n^Hzo#iyUd@srY4zoDDl z;bn6k?&s*bC>kN3jWzAaBANAs4lBgzBLO&tim9aD;Hl5~=VWm!{G2$>>Q0~d~xp;mM}c~%;WjF zmllDuhG$o6PAp--sLZz3u*L~hX8{Q%wnW|I3FLgf2eW=YIYG}&Mu!kK;=vs@f~R(yjYOE@DiatbOgF(6ScseIfjn?>0rx>VAgUI#Ej zo(t>MvVb3#rHX_dO(1$fw&fr)Aq_(fW<)Q%S5kvCA18y%U5&+DQBI(9ck6)F*tID? zP_kAw{eg;^Jja;@()An1H`!Ippx|7kfC1P3LFCzwq8k}GwC*XRc0kL}yMyN0>C#Kt zu@J%TJMUdn0WWt82*(W6)(fvyuZvmE0E^oX@S=vfYpPx;kieq77pTvTyqyTQBv}QI zM@$^M^GeKLgF7E&ikj#4;5?#D8YD~UM&p6nz_I8N;C3&QY^8-3q*dN8%MY^h>eAyk z1baIn?FOZm*lQ&ew_hr8Lh_e{PJmZrK5k=L&vSe#^uA-34!bKDeD|$VM zag@EQO{yHy$=yCV{}vC@@y_(l8vofMDE>jD6zUSpuXyV2?G|hb&je(jo<~roz*flS zojSTYVjiYHS!+#X#Fo_F$YHg0lw-P&H1LH;Lc`=yYEHz#=(sUSCp5q?#(LHE)YZ~% zqolCAqj|DgsYNt|4^D=asMOk~gcX%5YbbI0 z(4;w+M!erYvQ=>WH?5;HIu+)2cz`H~v2>+YCYH#lnjJ9;8yW*^p+;8(A4f?GVh?QwDjxTG(JD!e)f61 z4*6C+pYP6Qqi$5{F1xJmuUTo4DxR!09>5;FGYoUsu9@Rk>_X560Q`d9Q$M! z`=99dJK_c(zuz8;goWzZf66#RF^ijdN;oLsu3x1#?~^m1u|pl+nm@b%xEiRq6`Xq| zCy>9mijU2%Wv^jc67o`zj3?N4G&Wm}$RWl7htGFbm%r#Qwo_s`Uw*7$CygUy01$1_lg+~scF z`_v1!|EXjmSn;xnreI&zfvbXQ%g5 z`_^sU0Zm$x)1I#lPoKsOo|4b5&jm^&aX)lzmb~C!qPF(&b#wCZy&&|RUtUD{I(vQo zp?5L)lvg33bImo(hHxGdrv%s0b$z|h&SfSmcgRJubb@DOydjp7siBjJ3p^hm$9dHH zDw2eE9^fF8BHO!j1F6L0Zx+>7OwI3GQduZ#n`!jpC=#?tm&YE{7yvBZLdemuF;)Qi?3tK+qLJ$=Bo z?1G@a-`jK7QEUq_(0yK10PjTpY-nUy`Vr=2#!$^#j zCYQ}XkRS0RnxoKVDvYC%3x6(-EJa*y4h6AzL%))un`8{qieh<)(GilUo~R&$SdH(% z*${j>SX>`}41NTLxVjh$rR*a>Fhx0{@C*FTghioKgXON&2iHVErU|qpv9z8^WqO;8 zUpv5=LKI}{GXNQ~2qe7?62O-75Ui|cG-06$GnQzmE215)iD5)mGBua@nKFw8c4$IA zatwZOl*;@YCMxOy12iq!aKK0jZ9h1;d;qAgUX1Y|E~(3F zN+SkpeTwdBO82#FN~6Bxm$;zAW2&Ph1HZf@)T(wgm25SM&NLH&UL_C|hyZkg(DWa@qX6@^5EMP8v(iU(zTTLh{K(P^5q5(LFs$n?zSxh^ zXwmHh1hltm9JdTA&T$PlA;O-VU8g_6sH-$wje)aHlqEj{91+8E)v~#0>D(l2W7%lw zBpqvZ$4pjKkucQ{{q&4~4~K##n^r%Xwky90d@Fcz9HcK3q(Qhfu!Dn;Lbc4r~vd~!+GS{lfFw=sX!2kn6MLTD&ArQdDJ-+8<+V9P9jK3zAd-3QJSKbgL$XFgy%kfYcIY4`wx`b8Veo10JU=A^=DPrvAt9O~-E9i!I2iW2!LFfheoC{B z*sXN%^9(+!$bAM^b8(8wD*!fyb%jv+LlQnLB6K~>%P)1m zAqS&Z`A2)Pm>3PbKtM_!BC()TZZY5*P0?q6Whxlk!zfFuKqjMmeXh zd5ShbFq~XZp(p`egPX@#3GIwh!~~`{poIj%mOkCh1b{bCuiz%hxTDsf7-6TN*r0$a zmm29D>*un~xY9$nYkMdVMrr8+X>jV-;?EIw^C2k)H;HX@oR~uc$O3_vo%-Ov?(ayP zfMh6|O{n3zS2_Ainx1iLR1$3ud%)Jqug#B~mMm0X&1Rv-uA7(jlVC*n`^$pfE9Rt+ z@<@Eaeg%ik$wtpcW_PqY!MV2MSF)v-Lm28nc4Wn>j)n-3>1n=tWnY_7*&ozK^~QSSw3Wl#54ZSU;0{5Qbt*kW}pa8V5l ziH)qG_8^TGnNnUN92D*&V;swvytd;>u_n0!7PCK+DKj(=vd`k^T>F|!l~AgQ>b5X( zKv5qaVsH5J_e7xQf3t(N38w6>NW8hOUY87Y9gPCDie!RK$iiUh1$gA&=ctKN@(g?l z70m={L_Z#Nllm(i5#J*CX*W1+6gS?7gJ6V)O_@N+?TlBS#-c%;Jr zBI6e|)*6TKq8I#5+&!(4c2^H zyt+F=)QNf&iMtn!*e#QoTi*@17(v#Cx@T4+fvw>_{pRrGZbk4hOw4Mu+pAAFuBy)1C#-O9l}tb3K&UY8OC5VWyK#ar5L*k@-2BNOxt^j+Tb+d z%6f~rCa_`1#r^v(I}~UM6V{Yt3R=Y!I6|=sD5D`m#Wd?-W{h9v#ndD4?8vptvmFb| z55ZB74kRNNI9mm8cSZxgEHB2_)xCH8Vmue~KYIPei%n^*ho$1DHW8kK)hw_ycC?=s^ zN*Uv|*bH)=Q_f4#CM~r2;lnQRCy9iQMYX(-k5c;KRkYE*v03bpRl4ERGKgFQJ;mV* z@gH3p0>W?N!55sxFHBIoi_FS;fD^wS>F#Nd{gYb0xOq?@@BpPKfXIH;lq>`g25z2> z@NFi3ltAfOJpXui{|)P7yZhxwsf(s<4u1Sf@{6W$pSu!XInC&criSE=^NX$W8ygov=p!ODX_882;_Tz z)kZDR?$0QVKC=U?3(Ad0ic}a4L6QMNKK@OegnWImamQv;Pc`&M6A` zg=g-3=7d^_W16Y=YzB4D_@+)9(GslTpFVA>PA_el!*krdd&sQOHp>KhnyEDK@s*wB z%2-!4ZnqGo70Fw>>vn_B$FcZfb2P`-$a_u=9*&Y^v;$(q_Y3>FMytvbflbYDbgTA8 zDqLgR7)etUihth`{4n-< zZNqYvWHeM2zxRGaE@I$>pp|aeMuTVyR;1HGHmR8qs#=&T*H~pNbHZaK-7od!fj`OR zlm-el*Dkl2OL&Zx=Xv(#Ce5|)UewNGOx9Yl_wZQxz{Wz+!(x4Nl-=I~3E(4$T=nsV z{5WpbDcJ3UwD_R5`PloQmdngVXzrZ}2KGemqLN))5#7xna{<@Q4^4G7|FGjxe)*5P zlN1=3AorFBO<0Vor0{AHmn&F$4TI&+$a|!7;ZUy#*c4k^XzCdNn!HLFWv+E$Ltk(D z7{fZl-2E@durX1X){9~W${uG0%=(iIo)_RhW}4EsuDy8VVIu8v(x1$c1Ro!4*sBk#BL4}`E7TOqbX%3$l)fRNW>AuNL6 z3+9EL+2f5n;lnRHd{Polv2|Xf*H|W{yt0RN(-)Y7rp(UI6jX{l3?B84k_|rRHJ3bD zG9|p?m)LX7#nX>kIl4uB%?*7P$g|Pkulj~Fi@gm>!*7{Kn>aiO?-=VhU;EWfH}*N` zBeb~TwoUWl#eDn0XslD9Y#pmGFXs)8bYXSnB;Fs4#ZK|uO34MFll-wmgSk^mz$jBv zNvru{xuggNFzV~H%u)?rq79P*V<>w(xLgl8QW592F>tpM`3;N5i?%R^YF)?I^RYgU zUKAdH6CQp%F37Ks@WM$-nax6<#3S-(voYfE1Hs<{;>|#EaDG#JQM+NNeoDm{^b`VE z#`MDhEJqB63q4Ohs=aZgP>*~uaiW*%wU$iEnCzg3as>E0Ck4xLco#e;POKF2?*YQM zni@C0MJ(pMDh}>Ho^K5Wj0)bJ)I3&MjKTt)!DQhm-K$+z5!Y3}Mj#3{_O#?yd^^E4 zNp>Gny|Yjzl$c`Wi1X@I?f4~*Qd9ht@nrxg5es?tSHN2duI$#RP0JB2vvmqm4p=aI z59xBrC_CgrWk-dUJ8D^<>&a-@d}*vQ5%}WSj0(jbe@{DSvV-fnPhSor%g0j@%Yno<%N*+8%yy2 zraFIMz;8gn%)kQpFRJr5>iNH=FMq|G{R@5h&2Qer-TtC4fZv$tJ^7#M%fE7;|0iK| z|D-Q}htd6?n9HAv{ZHodyEXnNbNMTd@INyb%_`g`WUqy)pZg#>*IpmOKrc(Qa}Xgu z5)vVb5QfFKiXcHbUVrcUTB$NKd0?V46S8IJh(!`Qp4hyz!j6Z~<@&Zy|90?t<9_#g zIOg4&y!w{iX(4=Gf%SG6#CNXi5BqXvk6Ezhd8X58+3CE_md%zu>)mBNxbErtX#V)C zOV-g_;_Y?j<@CJda(^{Bh~8t_JTS2<0NnYh>rzt;_2%Td0KM5=2GQ%gV5N`P+f;K)>l#=Slte$K8ncinzTb3ycC zt36@xw3UWuKxJ;7J$2R;aVpcTKuLEWDYyEd^63|`=ZI-}Ob)&&nMv>#nm)ZHN`j9@ z{((%4Aa!}3N`VB9UO}&*X`n=Ja;vSpNJVuA+n0hC-%DSWg1j935(*P2efYHy4aDs} zD$WTgYWNf$23XWW*;#jBnPYr{2q}<9${jUf00QC$yye3oT+0VaNTYBgn^ydrS*-vl z2jrC;;t|FMjAMX_*yG0~U#*s3fj@HVQ5p~kJyE>FZx#_}FtkI&yvi^;lO_;+xit$+ZJ zfEE9vpcQ|Z?_wTyhLzY0GiELwW-i42JlckNyLVf=biCO8jkE1MYarw0=8*O21l5|R-GHVxxqmX3B7jr}4PQ*E4zeUl1t4Yt;a zQIkZgbSd|qpY4q!=2G=^#|?>YwFL=*DJExWDfs>4aN3c&<<~GB5GjX|T30MB0$c2Z zkA3>3dxa*YLCP|zW&uu_awY=wMP>zE4F#ozP%?8drP!L0-z%?SXb%RIBF`)Zl#LSKrd@;h@@&e8eJ<5)fVa98@ zxPH;Z#@>UIH(G4J5h2R}7@$MX-%e3aUj`g}j6>b^>H`!CxV6mPjBrNyQmtyzCW>^9 zxJ*(wX0z|i)WLa?@W#sB?jQ2v@nPrBG~VeyPhYa~-&s9{kGbWG@!zrTL4A&`JKIw5 zUU}O?7ZG#Ebu+LZ7dv&UYZIG|pB7E$Ju(RITDK$3y-A))+oR-pkC@FGey|ap$YpsU zNSn`CGl9wF5F7iz1DXcux|`OB7KHa9IIsTmOvf~U^wc*&$=WQNJ|QWW1joj3U+hXk zM@m2nUFg`Eqm5itX4cXO{Fk(Z>oSo1cX)7^{ zd2?Xy{VBK^+&0r{{l0Y*xRm{sa#%SciQi4A?~0VY(qS!UF5eOylQT?mt0=G39wtVV zDDo%i#afXe7&qe4uNB@lb}5T*DWqp1ZrOI#{nQo@CKbgm+LHu()3=5W-%hox3j?({ z)T?5sjjxvRcWKXlnGOwRe*W64TQMRMT^BGjhDJO3Yd#HiVi)eDWQ~2aU%mA3?z>Sw zjiY2)oq}2MB+F5qf>^1TkY9`oM_juwkAIlZx#j`&;tnaPM3K>yPaMOB8nk3PMk{+v>3)O#?6x1N z3;ho=^9^q2Hah$Xs}gC)r|6%(n47|1WtKCVCLZj@T4kR~PeGXrKFl?Om_|;pn{(uP z*Zt5@foiXn+;OcB<3-e*HpX|kkdep0ObDiWQTi38CG8QPr{@sPQ{7IGRArxgy6d|O zcTQK;2G@#JYN)ScN9@pcMR}{r+aO=~X&)EqDZ_0>w|h)GK~@kYZArI*v5?Ulx9Iip z2U%!30vrAeU)oZ@Om``IKl=d+wT!Jjrin=)q=s)$9Fv<>yyD_5`Kauu3YnEgOo5Bi z{U)T7_ZNr)i|TGMsvH7z3>R0V$6m}6YDJa`u0v1728p@x{9e!|=5ww>SJk4KzK5@H zCLobcg|?xlpC@n_SsNlMXW?-PLL%ZO*!e1Ltu9ewIdqsv7M|;W9p5Wn>$ydWejR}< zkFe~t>K=txb3NIoiomIO{*Y>%t@wh&?eA;E>aWoE0eTXSTjPic-?dL~4;Bgvi}gH^ zWzsRV-5G*imHF__#z*X{cJgM^dANRQ<_Mk{H_VtK@ zX_^&t1;^eVV--KT*akG+Lvy7pKRzn49j?=IBAC~41SI#&5JL!4>Mjcg%v&18q+yM`Kb#kiwcQWfJA14SG7qGEoL3_OYZF63M} zfc)rG39>o3PQG2X88*MAf{7w!IQXL?9BM<3?)I&Av*&uwMk6%9A>(R~JKo9D$Z@ye zm#s>*eQxbX_u~=|jD59u)WZVQxWiJUj7-Hf9^xU!4R))Ha{$P|nbGwIn^vLG z7{9)j$;o^mfu(9>$3+7VV#>Wfv55_GRmCiA0sE%(LC0k6Y0}l2WnYAsQn(4biQ0O{ zPcbGX>K=_!?=VQ;n~u}m7AW{ViVD@wN&eGRA$15G?mf^!L6>-ffP2G zJoFy)i71oZqXD||#e8|A0Xg`}WC4olR5!kCdGmeu@<2fbLZx%WNiR2&oFArcRb>Id zfBzU*_lT0D0ktroaxI8QrG{gxW<*t~TQb5NlDY#TS}Ks}NELaJi2=`|j)%l7bIF-V z3uk0y0l$ysa;s`+#?m@5T_I~wE@-S=<_jNTdwEnmmKzeR;s2nsN9^qwH%3`T1#X`_Q90 zGPXLYGJB{f9*$v0{)D9Buv=HeK#QP*0q}lTMm7%>E=ewE`zM>|%=db>mb?%olB(n) z0iyt4$D-!?{=Os^cJ2{(FdqYL_Ie%TGuO2rtzSx_@ib;{BlGQDPX%%dhU-!U27Dnh zkLnXEM~}pN)ay}|)UD`Uf;oBMP@4H8!OD&ehZ_fd8^m;$BSSV|Z$>18r`n=uvgapC z3{^|xdJMphCCEi@$}a879dHgu^^*;D8!c8vB*zvlzDI#V;Ro6;XZgEUb1&JKS+W}E zEhsKaKV>49)=b9UJ|>{r+>t!f0LvpBFmWpDpr;3pQ;G)70((vT4@!qEf?>_mvCrwX zC$5&*CWBI(y4b5rlU4VOJ`vLplo)TevsJ%8rry?NNzSj`+d^EhX~(oq!NyPotb&Sm zrW@^qOFj~y@_;_VbXbofA44ZYaZO^+Eq~%J_x4AQuKn&(NGpuz*U~uoQ?Fipul68* z1#}NofKIujbk2?*A9}nWf^*tO`HqTSq;9aoWJMr}`YV;|=i^JR@ZyXVJQ9r|$@DR5 zYgabN40eLzMx<3-&y&$=uJZospeoHCHx2x)(mK6gV`kh+cCy5TW;H^EKd5h!ux}C( z+@%`gccs7^e@HN7zNDc0aNE;KO+e`&I+Z(O@OpiNe60#?> zD)9jP+_hpRYZs$1O}?sZj4lMD1%9VD9%mX-v;D%Ke8;>lyXCyLYw-|sv{fmDttIWN zfB*r>hKAH3f7@FOF=Ga=scb#dukC3bdgg zAOL}UuGPsdI8R>>Wty6nOZKu%ii9g9x7b@ESp$5CQ*m_xu7qkNchmS2@E_{2RdYn>_phJdCVNe*+%Cf3493{7cvl3kUnZS?p` zJ+M!sO#SWa?8`$8EA+zPROB|3msM7mrB3?7#Qwzo#ocj{_u1IC+~#a{q>0zZx3{I| z?d;skrcY>s5wQL1a*%wWJ7@a{mi!;>$cWUu$a5wh0`uwbYt;wc&jD;!)JJNK$ z$LAfRRgL|8{ThL(zX;nRs3ruyAb;z#xJ_Wn7&!1KglVz%)XmS`XKOxI9~cw{H-(~{uW$T@)E?+m~&TB6Nsx~L^G!R^|@>yy{b6E>v33uNUR-CWd|tGHph^pa7LUXRgz>^t#-)*VraR})-0sD5-C^od;zUPb#cAw z#C%U>!Y;DClJBaNzl6W!)8lB2cXVe?kSU9BRc+TfQl^)n4H^Cl%M4U#a5lKL*W2Bm zdGMLN*dpqf@_sN_&#G}>xnkVd*|mbc+=FL#zUoy0qFj1(wpO3=^{<9Q%)8vT{ljH4 zhE4xpqbzb=%-%3&7H>=3FF5>`T5oRRcbdxtmux@!_#zTnqTJLFsf6xw1h& zHSzFqi;RzlF6NwO9+sr6UXkd|chOe$@*n}NZ)to|bnE)Qwx_k=8=}SQ8x2cik(ro~ z5=?XxSeP(EG()9{u8BY}{i#Nwh_ka}d)Dqu&6Exb4qZ~ep(kg+7Ox1T3}@01dJ%DG5U$M} zj{&Kca0UQQ$&j)yGY+O2cCC`(KRAuSs1w98Gbc>XsH0LbxT0k&r%ocl1a@ce*?dsU zF8}H&FUl{5YjfJh$p#T&Sh=rnhunf5}{qWw6O4qHKqZRMo-Uh7M2KqLznl zZ;c%l-ng>0Dbsy>rF_umt1;qasXkdF^!Gpu3;1o645>Dp{uQv-1hb zLme5~VNFsNt!6zWR&PtNn-2`-h4`5^T^NHWKA94zZ+5}SarZ^x3KECNi? zPhZ(P6D<0L2FbBgzdIftY`Yx#L+swQ<|44~sU$Z2`8=Yq^^PR443;hgxci~ep9S4~ zt~~^&q|4E&_TAYL2~I!xJ;{e&05}E5YLT5Ge~z(Y{n830awf)$R^Y+A8HiG(Aku@9 z`VbxT5Tq*Eqp5D%H=P&C!HOfo>yp*H?vfhA7`|x&Ok~Is98(FMoq*S&ghcg)aw$X= z97N+ciF5H$_VMvwO;3lKlExwqqwN1eF@_(8-CeKn{${oNS{JOQSv}l(q;!5%0qy-6 z#K`7#DS`pEfw7aoIReUspq)VQo-vvA%gP7JocsV9w5Ttl{?I)x>D9_=yg;y_+Fay$ zln5jm2tW8m!T$Mm(!JTTz)FM`3+m8oBhjkPJidYPZd4XgUzC z+)(2SZnQIb(Y}qM06a8G-KFZS=6}j<8wV|zZ`~eBa3jSYxe(cpat}D2{jl1XMWA=UwAG{jNl)48EG}7iDaj~i zn^r|U_eez1&5NlyREt+w!1~h)0hVsSg*hUomKRnkYAZjCSV1jCO*i68TtKZUFX=5+ z+qtv^31xF-+f{M_<^H7`89iWmkAPIHx3ho-0u5I%$C5aez71XZ#sOZZ=p>b&Dt%Z!RPYrSsb zPdgt=29`mowG?46@GA@B7KKZ8AiDIc0xQho%Obbz%iwP*l`U0DSqB$J(NgD|7so=r zssdsATuG=6QHHS?ohziZo}pEj(xKPNZ0S5jU@D!}T(zqxD5IxY$ZAEy$b>QH3vgM=F+0atly*~Ahmf5yBQGXF~-p&m6hl0l z%$nyP{Yo)-=U2y-=4h_VKAbw2EEL&yDURar~(<0_DfG8uOM!eB1>BKC9Bisu(Pm#Q?= zB3|jqm(mF;fK0J)2R=pLK;@NC2mS#S2KVtPzaop!b7kCtaLZ6FgzaAGapV|G*!?)i z9Zy2VwDv9Bx=Vd6+K(~kqIsbQDt5Y$G9?^Qlxol6yJ}73X6f|a+6chHJ4JEhQ~ZIJR51-B-gnVcpa4$Da)?*Rzin4bfAjX<-T8;+8$&JLhKI4&TZbg zbr<3=3!CeKOZqZzGNmQIs1*!_$YNzJ`HFU zQqCvh-`_IH1x0HSu000)f5g3YTvtofH%dt=jdV$OcXxM(gmgE8q#z~T4N5oC9ZE@e zcMH-jc{iZvc;dd#dF~(gh0p%&y=PB+_nI|p&#YN9i;mRc!u+JY;k}JjypHim2&NxQ zg|a^0_!w^NNI&JbBiTceK7!4)2jY_Oxte zfu2?cY`uh=ssNjr9AytFlW{TEWjSnp_nY$i%KHwMv7bX}@hAJ(8@I2#uGY#g5<}}E zi-gh?ASSjk>Vsd?$_3R?6Zvy5|>0zH?ymX(WfbnTw{Ze4R;n_C3(U9bIr zj)fk&(D&VHMs`NFKgL48rku5ye;*6c|J(L5Ouq(G|8ac7{Bz#>&+!fO&xHy<$2ZJB zZSnud@y$cJUn7G5%j2706XSm_Q20NMZysLp9{F$Mn+Ll5dYhl)8|M45BVZ%&U&c4s zbx6(M)lOVNYkpAjdK0w1nShTF0%-%^(T^1R5Q;**BSPx-brC_!TtXzj&_p?7DyE%f zB5ul@RpWHrcU)!ds>S_>*m)^m{kfd(?PzhAS9)`i@IJrg-FIM)+}8K#=A!OcF+9ED z^n6_Ey!^8966elS!)pKP=%nUi%PV#J7VGY=_-Y-n7n(d2YeQ%*O>w*#di(C;6#JIa zudL}A6U7lW4pcv*fs#cas#0iwQ| zlP*JfJZJORn=w!(b`7CzQ3JkE*TQ4(J8N{7&)VFZmz}w<+E9qf>1ie-f$9FK15&cw z3ZG95cklb|I2vNu78a5Bhds37c5~^%^4}Uqg}Bz=n5!CA`c%DOt?4cr0KvvqD1Gvd z=&kT>kYR>11epO*o}Y>iX)&$mn4(7H`@CQuLU7Y{MfrMYUU@;dV39ExG%pZBcIu2g z79@qSv_Numu}`9M(wgV1Qo^YHWJvJ$c#yJlwmg9G4xy1k)?ApG4Zj8sxrAH-c0x07 zyfUrsews5I?U@v88$j#hD~?KG1fln0FpnqFWGu|?Ni+Jw<>$N3;*V^KqGTMgn;=8j z76SOLhoCEKz7UBnhlIQg&PBpNd=?;n+E*rXv5TJo)-e0YV)2;WvIO8`l5);N>!6=e z1ix5!)_w;W)A2UyTckT_&AKM^}P1qE|`0HAgZi;$vKZ&`W>h44KFfhFb$FMGDmA<0TX^tC>0mA zVJ~%f^iC(v5)dr{VdCacPq4PZV37pocl(*zzB!>VZ}_TV{fe?0k(l@4aJtLMiqlkRM2;-xORS|B ziqISjCn1Q8%F7||d$!{T)!wXJ_Lrl@x@Vl#VG4??3(sL5Xpt6AfXg_6kvIVMd{^C1oc7V-RYh0TFK z6ov6kiZ_-CjTap#3kIqrT%LY*hGffTOAVE)uAB+H%uTH$KaCBB?PqT+(^)X{pbhUg zh6kWv<{%|c#*nY;MuNmuAjeuoD64jy-UWY9^bFP3A0wmXPc$mTLr=6FctZwJ)Sr&> zjU9{=+`edm=F_P)$G1l12-AS#CkH$s@nKER=V$wImCDk^QRC05UlNOKaMTS`1W;*( zzPkL7FFs;svj#0Hk$`oYdzhwQ7+lHr1|qE9L|as9UMvPalYOF~nQc|Z=40}_0@Tj% z6n8g%Qbr1rExXwHnXvs^JnS2sD7e-7Rc>o0d6p8|oHU{H&d;aL^Po*AVq=M)u_aP5 zVR95i!o2-(li(a}o|+jh)6msyEtmq6^KXe9o?7oO5~a*B`3i?o54o%=NbdPJLn#Z$wXurAZlcSLLSd`(aFz{XJ3 zxL<4=S2Lhb-7$M4>lY&hy zHqqB;wLr#(G{;us^fG%v3t90DWyFul2YyV|jln3IvK;zP-{hP)m}=AESN448t<2W4 zzKTZYN>PKsDZZxHKk1_*#el9GHj<*yX6j^RQo7_Yiig}h6;)!ksZBeciOzhDktDc> z{Ic?mo6T&Qk-9&J7g}d|A3@h?Rw@097N!ir0kKVye(S6?w7{I`&-%+=u zEXl`YVsJ2a(Q7lEADC!z78O@*w`z|11;Y|n7x27R*Rl||1j%I_T{L9gb*Y4M~l4al~_SpvGm2stz(3MDE)2=-n(%R&vnCs9rnW^qYp)m zvx1nkoMC62T$56Im#Wa51j(<^T_DR?R#mP!)HqBPjaAW?{ zl&oBB*T%@&UTVDFNlT|CVaInW9%1xfV^FGa++JfgW+8T0u8m@*&d6#aS2)*jRn1X0 z4fRI9rsfM3Wbwg-DK(lS%6Ah*Vrk-zOezM8ZmWim{?WFqJaV>NZ2N-6x{)lfW>F}d zW~Y-i$GJ)0@@lti%wnf_kRvDo?H^O$wB< zW*uJX2{&eIs$vXZnBllE*yR`x*M5*>OR_hN1q4@TT14!gOyc4D0NWVH!n}nuoy{$W zFYu0J$95bs@ybe1`&7bhlQl-!5*fHxqwIX1ILiAtqxZ8bu@i;IId2{xG28H(PUyj# zfCnWOnRQ}cu1A9h8_C2+i4I&zzTxQ07o{T6IB!Y=8?qBvr+O*>R;KveqbRS)+fb8n zdYR?Bj?1uAurnNpGd z-UEsHxX7Qsg~rMV<#G-YeK>YyugsC_(BIK+S#srA@GnU%td2eH=N(!==cA0{9bc}Z zk|H1#$4vcTj0Yb9Q*eSAn$jk8gy$ei#jiO&N?9v8j#0V2G7fnHJ`_q*j4hQq+{)hm z9()s<2caVMO=5BeTKYo5Yne}3U{LeivC3~}M*<)h=VP%Dj$sBI&oavW-P-C}CYj{M z8TV^h$>D~=kcG%A6fmjVZVD>H(PpX;6@B2yJ=*82{32ci330j83P=w{UpC?Ls%^as z-f-?Cp3uw}+D@cRQ0JmW$Q{wdB$7{SG%2jhT2T3pQxYLje${7bmoh9H&cDMrkhgPE zm^}xtMU`59c1cl_(v#nq>=#qOw5~iBWoB6fA)ExsqPDy-pJ;Q~pPNlcQGXqjN@LWN zT{Nh;Ii49_5)M9aE6nT#n`)8lTCtJyqlaWOeuj_ZJB$aKdWhnzzX{J;z=D^zC|Yo? z>+7iQ%KVgAL`f!!{Tzl~8^Hm@7xfdA$IGVKDL>xVuv0kWJvYE)_4QTVJ*^$r!7?<- zeoI-{#GEi@JttNbkHnc6=bUglNx5Q&XcI3K$WF5&uq%OtVBXb1yyUiATtjR1tSNE? zJNfw`g!h6v+)OSB1?UTBABZhmB)LGj5L~KA)WZ)GS%FYhWFp*oxM)=$$ViK?4oO6~ zO?l0_pC<88VspxyCoR;d?2dbvvp=#G$?t46=Ux?$OWCAZHEC+~k6wlbBPP6+gxe6;B?=f-w7n=;e&;fhK{@cv_!jWw&|LkKHRqNGxjI zG-m8R)|eaWaHe)Ov8cgD30gEVz4UVOIg*nM%8B|V2I&1(9ksR{RbQ;?ia9Uh^uv%0 zvLs0wjS?n#mdzRao{d#F9ry8sTwA~SZv4h~!)_PZSu3%{3?g_vQi`Xe_4{TddJltP zQ`&%AJ9#Rbq)m&INr7GY06PU?ilro{RIsP(palJLmQW>AmHF3=mhK8kCN+??b-4uy z8qqlVP4>gSx|0-zO_}$7TKL1;<(e;5J!L+3E78Uxel256*`(G{`aHtr+B7Rj#ukR! z#N9Pt%a&3fht7{9Xj@)uCK5GSwVX$S6~^psITSo&`n1(7n#>~G{QE1Y^>e*lY*k_uXY*(3k$J=)#IE`@s z)LJ|YjPD1_OziX=zqA(2zjkQVV)nraH$C5|9ofS*XxC9#iNF~^ z4`^Gy*Ke2{@AD;{<2PUDy5ij492n)!EGgel;JOCDIa&rR%0Mt(TjK%yE?6}0^6v9) zwzTYCzR~5qrn$S+%}j3Dxbw2Qy$#pC7(Gxp|7_C$@^Kf$yEk0!0x9OSST5oft=eeU z-m0!MpXcQDLe+$5b|vdfYxB#?>j5(Z&F_kgFWCkicW15J{mr9m1nMxH&bdrYqJ740 z!g`3G4X}A}-!{7~8rY#b6wYvNTJkZXX^DTX8w;1to-o6eK4K|_K(5dprkx4@51DXy z@mF&+(8D4DTEy7_w>*3D99V-Wv|X8e)d>`Et49ojCxeT-n>lOJ=pXm$w~^qhgy9XT3gNR~vod`@B)*JxwvAjV!1|D$L+_?RZ9FO0txo9tNgu z%f$pl%Z%*mP#q{-^5CQhFG>UZ(lk?!N`#O$aZjvDO>jCz9-5dN8zb6SS( z7beC0MWY}J;cS+b}UO6cU4z)MEjdQ9B0p|`M!P2K7Sh39E9z0QSWv~ z!K#;B%ExxIv~YUoeq$9Mc`(40zIZcsO>t~@;c$F9DLu}6)&)~vdS-KiFo%87KJnw? zn(e(+SJvh^2=kRFPYV>XX_5zcnn&9!laEkkHGT|weVVeBOPIeUAwF$OS#*>7BR3K?i2;s&QmMFtn2KItrIP)UYcf0mY1%fG1z_u5h-1dtbfo+OVxMc zt2eCVckE+3fls+0>@sT&v#w;ym_?ZZ|AG>vsCay$oI|5}*>4SuS!eag!$5>qx9g~H z;5^iXC8$euNk*}V&*I~xC4$Qx&i>u<$Kq^i^qC*c#Gj9Hu)>~26yVAL?K|k?tngwP7ieagcqjG!BreJ9ra5+0M8~q~b=nxF zV+4;!1xV;F_Tm5mlt&???fsJgO7yBxIwmF3z#k;5ILw~ho_Q!QXV@IOUDQp7W}!=} z%xA!R&yw&5P3=+|LG?_+xZ&cRiQMI4h5;`KGq?TeW+0TOOaJ7;!g3=1$hEWTY z`tpYkgNr>oX!|4tIhtDgcE))7X=hXF^kJ|8?zqis+>f|#=!IWO)4+RA5R1%Wo>MFv zlF5b-<$R{3_diP6DS>Z@EU9XXTXe*Xb^~!90cUFtN(vJj@qN;mh%|$^Y){z~5NfI1 zRo=8$9Mh*GBox2&p@vG4E8;VW2RL!K3nR}6Tgphyp^QA?2|AZC(lB2at0>wBhU&XW z3GTc+ECcu&fxUG6*P=Bb5?#=3==|H@{%I`>d{@nqLfgj0LLUOGxq>PeJ(eXrZrz0=-ZAtr787^A$4BUub~nV}{H9yR^MlqBj) zR{y~*C&~EkNyMf1$8#VcZI~HL4-A(S2=gO5IYGNdP*yHowO1F*}5(rkjnSGm16_=iK`Ivu@Z5 zK=taTg3bpwh9aYbz!e`b)b36fQ8U3zxqjx4ol-Hfqd~&1u?(>E%CpWU3dk0A%;L4g z-E^PgRK#~a=SCVXJJ-(ya3Z|m9Qg6c=>zZ1p6iPYq5U?|d!SB8xMKKch^3Ln@cVGj zg*a`MTKL^9g0x^pfrT&+dBiZTO{IR!IO-l5ARMFL%g=Qgl0$5Kf6r zaT=B>z8DrPiYa*Z8Xh~>tSsoY9b_Axmp(U&d1oT`R+G4>q)TR=ySnMLw=bycnOz6_`0G*7mn}n_UBlC^j|XWTe>u_4w1d*!in<6Io;ymK=7T zmmTv*mbwOo8#7d!S%Zo_wsB{!vj$PmIAI2A&TU{fRM$eIcfe9AR@C^QEM8U*3!1>i zau7B}MMB0g_WFG8z&7)7gsiuer03Pg@}f@nBI=H9TM6|dk~sSm0kU^x5v-Ex4XdhS zbSTB5Gk1`j+z1wffsJg}2D>V>@qvm;CK6lpm8!%m31Wq0Bitb)yVm5}ovolJ>w^Yj zf|+3N*~oLR6&U-3?X~GtishPRx-|{V3N)2v6~{B|V;IMCrwStaS;eH3ETVdEKIEH6 z%NE&fG66Su8X6a3(VWuis!tlZsd$jo?cmcN{3KJlKaFWa z0DgkK05UyZEu{b4h-9OhfMM+{7^#0#b(LxBFo=?LrznEViGGKm2p#tD{|L+A;EE7Y*jw#;m1$wFqI2D15Ka7i%gu!#p8R z24)7d9eY>?atl@vC>L;LFN3R_Allo5LEEgQRI{};DdIgUK8;XILa9)wWoySCsl=4O z+q{^Lo690x(vt`b{>IALosza%B=eMD7h7q6eQwUmO5yz8Ji%$DTlCjkbrQS6Ycp83Y z-F!kd2P*F|3D6p^TS_0*+>1wVj@fdSp+ z6FJMGVbR+`I_V}jbcIBx&Gjc-S8%T_bsVeRcc)+153|Uk_BWq9s-{(u<9&M-o%l2d zW<1s3_$UHR$zJ!shb%1~)`#RAZVvnOc5oK&fRhX^j7|#Q8KEM14lxFq%wIiS2-csfsOcKEI@s#qssk8cP2=cqGPG zD(LmM!o5y9ptXCpVCK*nR)P+s(EA#-lbS}n;o}Y&g;&QSwdjMdq1YqoRv(uSNOT(qG>}1&6dn{);Z{mjMqm^Pd(# zEPt$qVEs*(#s(O!{N^r;<&R|$zei%_VEjv@e`?Pj41EB%Urw(aAGR@-HnX<4cQ^%j zV$x#dp#NjR1sgr?C;~baMG4sZ9|CeyM@L%+PC7ahGe=XWSF{E;R&@H7M&|m~hW0iVmPXD-_H^>D zlKQrev_OmpZ)Sik&(9rSS$^pl?{!$Zx@uAavO?l=in@#hKUI9ch1n21Xe0sqo!CRihLrVjDa&t2|Kzm4A!P*0mj$rgJN$F_ ze?epo@_^|-A~N__M32jkfH#o0H*zL;pxlGMwVzFa^_L3$FI9I>N+tl5&^(T(|UuWImPhti2C&%P*Y58O_Or458_To*4a-C0WPKEG zKzva%d!RM{{7s|ATErfY-g3+lD}i`aqeE59R+?3C{X& zCA0j|qJA>TA9D4PNgiqQ8?b+E{z?E469Cw~xPJ7FY7d-UfzW%o^ru)C0jMUlM5 zx%GJ7a)Z}=ji|e=bD>x@HZc!k*tWWu98N5w#Fo|wx7fR7aDJ4#J;}CW!KSsFr7TG$ zbJMtWtdf~h)E$)z-={GoD*cqs!|g)zB?9}*H__R7MiKLbS*}Q+Z*j$fxXsHOFS##FTd7k<1&a zMv5@{`?@V4TVCZI?`i84^aQibK@AA;R-4B9$}w27afs;a;OJ@ik>HEv3VV29Sh{2v zHg}Ba$T@OLg}tJEi)b3A?IANtC*c$K#D4TxJh zF9sA&TG9d@r)rgQ6nh$f}64*1;=mAXDo%nX|@Q1SGs>a6F*RT%))IHFYi>PYzQ2 zD=*oSvb>_h76K}tqnf47ARS^MKM{+zJNf!vz#T_)Q=QBut?`qcJ4e`)&{La*KqwP* z0#OZC8^Uq_;t!a43=8bd2vATsDy?PnM>7W+nMq<7n@vfSiFOgyqga}i{Uq5qAt~RI zl82cRMfdH3%kunUbGMacruqOI_YarU|fAa=bnpyV(&P% z4FRS0IW%>(^X^W}gy#5Mr#p5ppQRh4$?@lgWvcE4h?UP!G_kC^@b zPh0hZy{KN>#+INQB{^}PHC9N@Jfbe?TFmc21ZmPgEGWj+4)S+ob&j1q7b(z$*J59P z&c|wba#&_0^%DQB?~@MA52)zUhr?8@0;h_sR{7U=uPIWwdI#yPO&CpF3yCDh-=co` z9HQSvU#mXc+{iH}SjCelW3-cGSIaT=}GGmoDvzCOB73g(xlj{ClTy*U}4lN zhIAb4OMMQP{4d0aY`@Wz%J!J^4T{4)#m+&5v_U^?Otn<0U-9MMPhi+;{FXln!(+4K z#JdcpQlI*fPtyLQCXB2!xs4O}23DUL&ed`DY0Nw@;3?vSZ`ow39Nv)fctpCXtrI zNs)t-pq89_=L(_~Q6)yE)gnWr+s8`visQ0c2b^@>I@>*Q(eudG|omqW3E`^h{ zp3>rvs0U9jpERLxas19bDruwIC*RrqJD#7e_?%3t*OczRv6rJd z_8`n1fr0Tl4yh$mWz{Z>GCh@*2PLl*D^7(Csw3^;51 zZYWf?ZaJy=Bxm7D8ovD)VN@6+%ji2trQnkOpafx083t!(oS*Eb`%<|$qDgrhzNyb- zL~@+lp@f9%=B=GSe0o{(@xock>BQH*VP^NsFo%6AF;e>smTYc_fu>a)*VeK;xYViS zw>10NG1)uDouO+CnP#1CcV|AK4$=G+_)pRi*Ts!wiCOnUO*H5lKB5VIv8RqH%H?4j zOx`)aTL?TKzw1+PX!@t3?BN4_|Iub(=lEl(9NV7?1%jVmdG7s>1HD57dox={8+%~& z7H}`CZw2(U6x4(S1O%w$Y>ljy^sOCe1Z^x0f#;U`CJulz^v9Tj4=&YdSOK#&24;Fz zz=I79BL^cb2P-?^J_yk10J<-BW;Q@wz(5c9rGLBxv|bWGr_anlz}m#p2eLZ-&Wkn%*6C>k(C^ctW*h@IcVAGneWT~2@hC`X2eJU+}fb!}$BVPZrAVo)R` zcLJY4hzzidw-Cq>U=oN(IQSyd)2hWCn&wyHK|*U zms3?koT*!VrI~B>i*;;)RyD^C@mCG!o||(H&Br{qi$sV7??Q-Xp{2gUCNtdF9%lxz zJJ2nB$4=t>zPQXX_<~3JYs}z0ZNTWM^T)`DgV(kLE1f|UHdG5l#IIh2nbakNC+o~& zmp$vsXXhPWD|Q&e$*)?vP{L7T<6^CfVtz$LY!4d7LK9}J*41)uVb_?3sL!qM`phBe z;N1a~D+(dKl4nJ{I8R83K?2MwMBFBZ{}s4?2@OFKJp0~2{4YHXIt zoV9V4e=FTLwi16n2|1x>nD&re`s~I*J`v`3`2htX7osTxf2vRIMI_5%v4V5K+s*2Ux9cO*ESr7|e9BV-@JR82AopW%^$FIl+?&gcjJqJ5;6Md*lg8 ztfKk|24{T2@(>iRrPgw+eBM!(u{L2E6LC19$%tkf(%n-YsLMCia+TKNH9d;LZ14Bv zHCG{}g;Zg|v@b_pad907krBd9fOx{?flyPE?rw|Q7Gt0)Rsaf7tSO&P$V$?oHj0L{ z>Pq)8EZTa>=yyNUYza>E{v0$zYz+lc2cPRWOHmn!F9`xpoTxmUk{q0w!K+E>5`KH> z?uIg~@XaUMyO%`aK{g)4RZr|4*m66!2=rAyCpj`XT3&ld-uj3uARJd{g^d+e8DDzp z==UEDBw7Lf=XmIWjrdcvE6?7Ib{ri_{GgJ&8niYAo9*GDw zO-n}J>A+Syr%@3VEoGl8J5ENccdl%b(2qHej);IjhzIY$Vn|7-$#YtnR`C2|D5BwP zQlz0AiGOZs{z6-}U2yV4ahOPo*M7%cph4tJYa zINe}BV0mE49^jHE$Xy8|nL&JrA!Y{+F3MO#@m4ZVX!sNrCaRx8XL#kQLv__Nu;xiR zx3;l}Tah#3*9HWmU$iRfv5Pb`5_lo5{t*@OKns ziuGC|!w1xQjv2mxCuEL_h9@NSgk_}-P0$_Z83vONW14xk5AWAXM<-3D)>m6ImSvx= zJ+7>y#2V_4j?ec%_vG1-rDs;xok84wtb$iFl2hR$mg2f&z{Z`N-~@cVh0>S!90qJk zfU0>Y5wcC6(OE&^O+Mhrnf5|Hz}$kxWkK!KEshp6fy?H*^@igj_{t<#2b?Wt=i=31 zQG}6|HKU34MY)^Qf!1vn9lzn?C)_**V)&8qqBX2jn#oVg91deJnCGRHZ(R;sqH+z3 zH2QyZ1$#ZEqTGI#wrMU~+CPw?9hkS~+*=zoB%1$ift+SYJZLm|J+D%*dwmP#9sRBd zIpV2nGAlkMP5DObz~F?4JN~p=}W(a=S_U zrd~l0@dCZ5qEir3oz{<6=7SfG(%9tGD`FhiNcJO@??a&wFXgA0iHl?NhJ!a#uR0g9=%V6S8X=r+^ny>%^ESGI!0NAZ+$a zpP^1vj3MmtqVdzPvq#3!uokx;YeFCEO;?TK4Ta`@r^EXeIZsd_S1A-vPA-%mhY})= zbkmfgO+?^ z<#bwFNAPrW$CH+bFC{y9#UaLbSHl_j`jz2i(Vx;t)U$Dl!olCU<8$+ZR7CgS1!y0> z$U4+I2j8Jt)?wT&r;jE6|-%^$C{4Weyh5Zd`xYFU!nKC(?|!UY2|rorscPI2!TQ{B_TL$6p9MHKg_(}jJfUyUo? zpuLXL^qKCm|7^XtP`@S{)yLGQ*Z1Snw4yiFKducv=zF_+W(18Gow0f&!DXFdqZ|m) zd(#e&Zy#zDpyDq5OM>xHzcXE}JOhuqZs!G@kAZ!*cFKMa{1% z@0HMM4`}R+W&Rwn#lZNA@4na$bwCT0(JAH+@q&%77+i0C z4^B8en4L?xu*wh|XclV3s{pozAxpwHU3rFIi~;Q6ZH1n3fnq$ow@1U(jv|K}z(&j8 z))kM1$8+{((>TwGyJdj{zHCD;fk6xOynUZ$*hP5DQ z?q`|G*p$srC-hOeYFd88P0>tz!It;hOSwP}49nzNM%yTGSz1@Sh^A{M$Md5ik^;@9 z6>yBp7<;p=B>lcpHbLkavJBrzR0PQr)HmFky|H2ROFU6&IjY$?@iS^MC0Le}>WT_` zx4ELP&$I)B>8L%InJd;|FQASbn2M(hpGv&B897$DbWuS)v)GDN@toXdv6#fW8aI5A z`OXX1DN&FF+kwd7@mp$ELkhW;wB*T>Ocs1SP-OB zS5m}GZ7I3BI5>mwc3+`{k?38nsJdJKqvmi=BgcFFgG`Bx zU<$HRR1y!oGQ>b8*8S2%-qtH{zTYWW^dr zs|^=7x|5G>y12~`0uS49Jxje1S+v`;9vF>=1~tLpF$ zoL858$}-35)Ahb!l)NmOjC*-8s!Z`++pvgaFGfPDGZMW!!>++)z=%v_1LF_GyihAt z;gq~wE!eoH=x)z-@zs~@N_{a9`Izaxj=t8IHv8Pt@y&h;bZW}(u#|@Xh^p* zf0E0D`8}uais}Zc>->(K6z#`1I)X375_3$}uWchDK3UbiN`9f+*=FU{J(s-pbd!{2 z?l>!HRsw=I9jE;Y5kG9zMx4c$eC>(-dmd?cy9Nbc%&eqcVo^`5EqQl>Vy^beNZv*S zyM1J?`8HhAAohhWYLZ=T^u4AqhbwV1ChrsGYyabG*|jUkt)+l&ifh#umhp>>Ey-FD z6B3&WX;*>KT*6=Eo0X*TKO;+I1O?#uVSYlLS)#!3Ar$Q}WS}+XI|gHF$5Ll&2;MbV zTy{+HtFUXRO?MFD?hQEBXiQz~!{1y)Q}z*=qHHA4RuLwTLeoMUq*zdLFS!Ud{Aj2s z+JsnseSVkIcCB@+L5!FI>NcS!#4N;qq!VZyghl$!G)&sR5wSlyXb2T6WNdhG; zFvHYm8TdeU?LM@^$A*+K{-&U(yU@e1M;P2#8C{XneV-9|-WoFQ2Yd?(3?D<}f!RVA zIx$onpdkt#vU%nLb+90<-7dlG!ezU|Ul8UZLFLTHYZi-b!mERN0@iltdEu&0Ux^kFe3JmC81}Exl@&?W!Q7#atkt zaMs>#BPp*=(h@{$=-m_}VLrh)3SX=B9pxE`<|HS;oD8B$I@~3~wjGe#_F8&cA6*|; zvfci=nE88~iEld%K@d&DB2lU;S-(8S*HzIG+Rv@w7Tgz3V;?=YM;NGFuCW40mmJt% z_QNkihSqqFMTR}k&6ys~&v!C&FM$l_TRI{H_eQnS%xcd6dc3$DlS0)6F zNr?h35(Uqv3dDoDo91@)?llH};(E`PR_dnkFeL&UvzMy(8H?e{q$Bf;XC&*u-%iwt z8ijesZB*hBC;|a5_TCN2F0oMQZ{~ZbjXKa z(he%g&ZBG%CVuV7^y}T4L@Mu){P^PoJ*bjsvBi0zwzI1U8L>#jj1Ih*)^J|)_z-N{ z24>gdFiv;BW(?-c1X($W8@t{R+_V=O*`O_~9%9gZ1E|r0C;P8)WDxlvC zoP;EV@0CFJ^K*=V!IHj%(fus}-QN^JKr|&+2SD#4VQp*!STPX*(`P1TfXiuD0&)RE zn^#5@K$3f7Co^jk0&)pMK*3|?=n4cXIoaA;8d=>deCP=PrOboM=}#3D!Gn?tnDYY) zP__}15SG!mC7}D29+pn+-grujg@Xl{r(z{wVFwPte1#QI-aH(P>;$ZU*$^WzmB|YD zMq&okP%OY)JquvS#0>0i%L-{r!`up;M<%U1=yT5)Y56JW38p!h=9~0mZ`z7ql z-<42*&iw*51V+{-j-~{x!2BUV5rBwB`c@AVkgzrbNH1@1W1wW@NMLLRn0*;J*f`l6 z7!kYz$ZZV^SXddF0k&w5cMrb?R{FLNiT@Y%qavjA&#ECXG%^M<0xIB9Blu9QG{35X z21xT~jECu501J?U;Sr1hFkkCnt8ZXruWxN)1j|hi{P7ZSivoWS7HWTc&iI(>mGNJr z|4j98ddPzT$b+7qQHYm73pledJ>0UgJf7GdPHaE#L>>c~A5WqWC&qgWK)S~h8{@+r z8^>dm$IRFs6EOeGTKF-_V*=KnF@fTNTv#8$h(5+-c}yqrn1D&(Aqw*&7PiMIOpghe zf9Asa5QXs(C-cu|kMF?zm>JU}K<39NOg|w#2C_bu!1NfC?J+Zv$6T0x7R&w!;t?(* zfb3yb_ZN`?GD5Mj~K)uoe1E$NQ(P z!S8bJPdW1!RkxtO)3PP+Sfk6mEtPv8F#s+vdf(3D}86gW-T3QsBt7wT(2Ue+Q^A;4@PG}bH zDt@moahmm$*}-Cldobc4n$z>>X+}Dt5JWnrwBV99l<4@ccwY`> zaR&1&%1en`l2~E7Ol+^645UKM4wh{32@5jWJ!`uw%VUWn1qB=1?24>eSu{Kw*0=O< zHj!RDBcwiuv?N3pB<3Q96l@**(XT@)wG7A6#!VbsjvS_6%ZIYDA0*raQPtP(`z`t? z8YZpwd&K3T4imt>q zYAoDkh2J-+QlXQ)281q_TAoT|J`D@l418m#&OuLej=_m+ z?Vek;9+F+B@AyZN*EquR=`Cmo#`HY0vB-7JjrQMQ5M13A2-P;~4eSj@t-BOxZv=(r zaK`kS+=Ax=vD}9YyiO7X!iUwyvf;+^d9oEh^X64 zknXvd`tI&v?jADoUEif=LNq87rHr!4a3v#Nadlf@W~a!E2!<>xK{#V(XJ;`C$)S~g z(ERjqV`I$;j*ilpQ|h%o2g?rYs-m(|dQtHb`7Q-5o~wuLOJ0eSp*NNUsHmLauxQ_6 zfX6Gac!@xV{*^9coPHJxs-3crec5`&;{4?hrlr=lLIqJ2qR$Ay)Cwj&X}&|HzG5tb z56s}!c@0TGIU0sbcP71{S#D=|&4FJd9b+q?d1HTVS3yASq%Ex^<)}1#%%$E2Pj-H` z*Ei@tcHcaq)w~*YRu+e4QmxhS?K52En$tOYrE-)|Zib{r)(7$uH9lE$W@j@_AWT(9 z-7riVdlxx?DuL&Er_xlBA%X`ReHO|t=;os+0HfECWi96pp{2Wg76(&s$}UjZ&hojH zPfFc{Y13YIU_0Nkf1RL3-{zapaX@JZdtGszL21#pOuSf{jKcKILO&X{@~!25J5BG< z)r36HSIAz?Prezg?(&5A^kF-+FOy!*xn7oC($}0;;KwU}!L$MAgLmBa3mKGrTbyoo zBEYx(Vm{?E2h))VD(3m?Y(I-1?e$xwrNgepH5V@1Q@6LXD4N;y7^?_-lvETHSU4In z!w?7BTur!g@>9j^&q|x-GFsAG>~jk0>koGqfvo%j#3kvjZ(HDL^~CrnvqeLX8mv1n z!|k4rHj?F6>HU&0(>6K^JGExS=c){VfFK(>lfS+Yq7#wEFvki;R4uO5 zGVy@U<{gN_^9Un?72zH_j2U$#NBe@VW5pb3m~)8Hl)E6jaNjNQ?KReZm&_(Q9=}31 z(a#TK+6QeQ05m-aS_=yCwT$bTh$1BKxzb(P{_HI1+Yvrda3)S29BO6Z-oy~5Orufv z(@A`=JE561j+`WhjI_q%bhySBg05-7&EHmPmRB*BGnb)L9ul@P&9yv>ioQ0Fj7h)H zZDb(7o{+HZ&JQw7xJYuzHXz2=pO4>N{}ArpBs&rJ^Kek(X_+qsR)jVYm0tb3*<(Jw zYoroOH64B0*8C4N39L@LcVFf+$-ijA(W^6W+PHJkG3Gp^A3ia2_5u8Wg%b z9}w)E{cg1&uqlr6^VJez*O$eyubk7FMv8-?qJ6JY7$N96NAjFWC3fZ7cb2;5H*s0- zVv29PN=XgmUBN2RC7fu2$qOn4pVUb66a%@x?{* zjkY6q0PW3B6}EdUW_RW<2p#gDfdP)OLyfg0d88P91}hsHwL-fV6Iid52idmyme&UY zR!^2OE{@0BGqnY%I&rz(d!Qm5-(MPTbQE#4Tx@Mb0PqjMiHXb7eOy1M@Vv0T@n0Nl z8M}u&u?|qp*xvWKGfuhjyM?+8>Fm>HP9yFZc(clozLQ}twbbH8c7&PuK~saYGoB8G zicES!_^soW$qkuDZbh+X%NIvsPt4RZfl1;X7~awsI*4~wC;MzIXNDsmu1H$Y8>A00 zE?K1+U4^>h+cJLSg4FL<de7_0%F?P4Cn`_-^8^eAN+hZQ3AFeu}*z@K~-m?XLz@16BLM(0Oz zyS42!jDT-z&MypIGfuOb;E`TT7als&es=ki>`uf93qjYn48y}II@BmOpH>f0BV>0Z zj}{0X#=~)5JBwFP-uNy}diWY6to5rYd9I>3D^o)l;h3U+W$Vhs+t+AVEU?X=%XXaO zJeM!T4RcmaP;`L~zUJcCi=dl2e#6{Wa%t zHxjoApQ@p3fe@6@$J#ThQ7Jf}PC7dTUxC(I;L@|=z2-n**cz<5AVFFP$jw_7%xk_UdZFb`5 z%Emg_eLP$bv?Bd*X=x{-MqZumO*d=+KRq%9=c$X!Qd%yWN@M65QNaLW335T9><-pI zo0D?shuET0m{83*ZU{jA?#e;CU+?%e#!3kFu1nH=Fu-1HIz5K!@-!mJv%XEiLttt1 zt2*6%X0z63sq|J-e4W+xn^q<^k<|G_E&DwyB&kV>bG2-*J*-6!v5k9XH={^85$yb+ zgcYXpSs-05jlmgBs#P~!^}?K+-5`nn&N*kV{l3pP&9#De>D*k+;4f<%zsdVmb9<<@ z7p^K`oyJFkOSI*W<+=NP69o%pRwCMv70ErZ+_)d~tTd#C^XYOwtLvg+XGyZ(C>T_) z39Wb`JQki@Xf8ot-cwKmHSo-*DTo_5@@+XKEQ!u?r+{xd=}V`uo!Ze5Yfo#pWcsla zOB{`P{#|uI@zu#=2BXNn$Fk3I3CE~uR|br{t4o` zJ<#UU&`_ByIRA+AoV0%^i0@q8}Z6|juZ{Swy7w-v2vx^vL@qovJ4HpYD8xG zRi7^AUEVXbzzy-X{fv)jmsh_qzi)t8zP%lgy!$z3OwyzEKG74;z1DHjboaY|kwZ^t ze3n$AjA0d}SwdLHmo)K>Q{=1#z*pW()b6>0k=bkFoPru3ms3ue=RKf4kWS~yos-svGP*E0(~tF**&)AO2Q3n2tLRx2D%x7+TibnV9XW{c$b zVU?RJp=o18)BgL30{Y>}{BS=;eSvA8C&(^pDI?!u2g zhyX(~3*waAM}FvkA1SJT-3)Dbzrw?E$B^D^yVB|2i~&f**PlQ&Yz_plo;dzpkgD4z6raZWVUYucPg9ZrUYlH8)2kH|OTdu~7#b#S~ss!~0YNOZ)%Dg1?(ke6| z-nh#85z-W17QwGotb{G>Y5R#*=d-Q}5*k%biILdU275x70GF(Kf|IL1>t{Ml_2*ZmY*BRB zph+G5R2oVRVcu~(q^_Q>@H<`kIDMYSN=-g|`{K6kvJGSFEK;lW7BTSM4#@(s=eP2B z#CQx_p~@3)Cc7V6hx39*R4Bqib;+xU_MsPcsh!=qkperUditLX5R8e@LXnA`zV3MJslwVp=8a7y**^#!iN{4|h`791xdClA$;7dw-^m1DmWvCK|q+lNpR@mZxx zGbh?R!EwSg#NH}yy#}^BaaNOF=(cW`>1xAw9M3i?)>%m#`GfFv$55{K4+_q=ICo89u-3-1x88rLG^J&4d-Zm<1{TfQT&+) zNTpFcOW298h*&+etGod*c`g?2i zRjHT(ZNW=IKo~H%g8HRlMBvd|zB*&FUg`I_Oa25Su-HBSBt?XVhk0C(GJM?c7>4oxJ=G(icMKng$GX|^$=4xsj#i!K{j;GuXZ|k@@ zA$U$ICt%go%&=*VpNirkZid&XA@5z=^`zXGTy_1&i^>Nx3I9;|qS>&`Ge-1Pj#lwD-@lfgPCSdDBcpy z;7TsZlRDwGIMJ?Jq?2M+346yuC`YeSgft|R&(;IK`AIRsyn8sQ{L`Gt?7r})gb?-f^9pT)H5OqSHMXRN3`%2_zRK7$x^~v4EEkUpB zQqrCa4TLGFWL>_YAw)qZgdLi%4ug%yMH{0b&(uX3vJY?eK%m`yQI73JN2pY}H42Ws zo-YYq+BB3UWd@vBigz}wxx%X>=I?0X0i1^gz{nPK6@@L@wfh@ah(N8g#;y_!$onl2 zvoUfLc^{6Tn_H@6kAbPHC<)n_Nxe4@29f=Kj_oH&SwAT0I0_}?Eg0a1ppm7gN}Yd(c>V{2Ndka%m5@{20=IgPyiYb z1W5e_LV?a%nLr>E3+Vm;G%}>tAgHKp@rw$n;l#ATSBY0J!ND*w;h54`o@IAL=~T zdngA4352pf^aqmbe0U%DSNkAe*+KO|VA8|=p|8LE00qzk*+K1rd;x$++`j@?Y!5MV zkLSw&0#PWz$Jpouxh!^u?b>=6~=<&w-h$Q`uGClh88*;_} z2xmRvU%w(=k4EMvCmwr$!m6IoH`d32J;7%}Pw?5(ygVXaLXSm&kKoo5_Vgs1P{re>dF=M0yFoEJW{x4V=D>HzOg%!vO8pPjl;5!ib z24tmU0x$zWcsvNE{#RtkFNGf?LqI4U6C(h$H$Ft0JWTOpWC+{uks*H>e#gofnOHyw z{=Y&)*#4WLAtkP`@6;y}_hvRk;w-)*s7i0I5%)#W@Q}<@6kpuF?-Wg$4#y=g$NgGi zQS^~iI7&bCC1HGS3@o#+GB`vpMAA1nYMI%uh!ndF1Gr?hhNp7=eeWDV$q46p-LOqI zbBbA1$j=wmg=p=;yT){}Ue7P;a@}*^%yj$hD{Xjm;vT ztO#!Kg~z4mKyfC;F$L%SLdt%eiy6u(!8|xuF#PrUbI-Y>aLhO{3bBS*J&3W*_hKTl z?LEF$88R_9Mhm&QreZ0g#>NKUsy<{wVo+R}!B*R$7?Iyk515GeRr`XSlMOKrE%?%IISnjPynt?6z$|9P$Y3=K&OK4kD7mp;-m-G# ztHoJek%E{zCE`2O8yalD2pPr<{09QRvOs>`S@H&9ir~xqz&5>KJr&2g#5b zy!nb5%>r3_dJOY%%oQ5ZW(BoK^1-OUPUs-PC>ql=8Mn18nQOr!oud%)pNq;daTu6} zN94+T#T0atsO#$zXl7zNR?=w36yqwBw6u|8$D}iQNP_aJ1d9~C$(AQ4Y^(lpm-QwHbFYaf&AXHY*VF{?dWV!N z)vep-#aSp2Sm9qu(b8&UZZTWll-Xwnt_2HY5trM&+?ET~s7RNMe|gv@06r(a)2qtJ z`A+BZkjV)L2aAH%maP_np8g(0msprEt8j?nIK%Db?UN7lVvJ?Le#YR>fL#@$qWA8pNw=#x7GYrYeydXyUk~#x?dOuj zy)%?%E-#0)xA8sNWFH?-krGpKIg311LH8YX7naVQ83S|e1zC&Rks$N_9Q(H!BYJiY zhKmvLytHY?&iTp`Yjyp~uI|{E)iAMR)h^;UyuxlP9Yaz}`#3wt&v&BX?;v!umavcc zvm);(4#gWNY`xB)t0QdO@RyTx?lc+hvqnU25Da2rEYVpdTI!C(tHRtWAyb{<(9#XG z*l$Pno7sHV0xViJpr|=|-4&vlr_642?Pm`nqayeh5Z)3I+qy< zq#9RHaySjOFf+9@v)tdjhdy>VpZGdJ>Dq64IQD>I7yJY5!0oAwsW4lPN z66;y^h70u6)Ev3bf;l-!{IUGn$t^qk)dO)@?UYEki9| zi_Kj`4A3MuXT3%&OmAiRdZ}qgAa~&oqC|yVS3iVz5j z@D=p;2~w~M=P_KM;|e6`BMf`ojIwc)F9=MT_DMYRbTwhh_b+Zg%2scD6d%i)i= zex}z?UV5jU&k#UKTdk`Z=H*AUKyMY(BPiE=g!n^)F)>-)DQs_!ou%eF)OqY+WK~98 zTrg4WlBhol)vUM%E4$C4W_IUQZC*pgdjUz)AR);R>vPF!Cv^3X%!^bzYjN6%RMdQ3 zadBtg^=qvx&F$a3^P`|vFDakFuHzSsgXl9vGfZ}6ShUR#jc*H}&L>N=&UO#OFC!|E zb1mMcl9N<}>AOAO#!{TnN zO`un8ew3S~p{y*s3GvPts%Nh5G6`Y}(+JISC z@YfpE)spotn0m~dC;Dnf&!UuVTAV**Zxot$V#-+*u;*vH=F3BpH0BgSgkv4(DdiZ* zg+ro!MB9{=dXKbSx=`1*(GqsewIv+egXe;VW>#cgV+G6Q`npL7f03z5U*B3l-n3qh zcAWc=DSk}$@a8adVYefiLk$#r6^?_53x&#F=@r%@kikssm#l4l4nz-`swYMF;rB@A*C)kN3uy$-` zey&y#yu%tTr)wsh;6w0s}NFPlG(ilvc5I;ls&qOq#Y z=JXw(@Ot5W?c(BmAuDg_s5A^>bh188Vd0K09jQ@7dIr8X*Bmcwy4U?OR{7BK*vG8+ z3xn=3dAgTY>(L8?>W;%_=K?jX`4d*>H6^d8!oqJamD*nY@O%Ij`iqK`vp2-*colhdO#t?#<=gb zk~>T(`un~P#C#1E9P)1-M;toweH#@Un@Gqjl1o7e z$r(Q#I<&T0I4)HAT_!)8@)^47;GB}|i;FiQ!#v-%s%}Dl094JL1*j5Ohht*Tlfg`1 zTe6%dGGUTBQiBm9AiNq0&^xUzq7ZOSNOt*V$nqSn4+8c1H4XB7VUFDaci>08EfF%m z^4mwJ+wFa#ua76Pmct zh&E&fvPA48A;9nEn^Wk8b?0_#5|54?$OxpCZwivgs}%#WXRp3g=dQRH@EcV+o4>hY zaSoA$ybM%7kaToZx9GL7usoE+36$RZxmTqciB!1L*;y;x$dUT08u^)NY-5xC4;5u6 zKk)*8u{B4h$OgM8ScU-KVL7_Gw&#(>A0;Z%6xdvp1bRvsk`+D}w%V_1vD)XKr+1$b z^eU-&)K_K~7x(-eK{Yb&GaNcvNYk;t#UJ6=f3GqunLV0nJSvhim_-d?;~qhxo?WBH ziEq7c;>2F%cdm8Op$!)d;dCY7%kGWR)cVSWG+70*&6D+x{8-5Uy zeOeg);&r)N z2>s^fwJw-&x)^;&Knzy1RWf~c)8-DW*26y(S?&a*(__)zx$WWlF{A1lHa4oNG^xH! zHEv)i@Z~Et70cPs8H>B`-R}1g_;zEbu)7Xn#keSbO{qOD!>r(`TlR$&z4h*rxIDTse!7am-aStp$!ocq#QS%`;NECr7R9e&WnJDx|tEI%ygT%Nl#vO8KFt_?P^4ClqPd$R?YL2N!qMoK?YJZ3(;C7#xtLHK!EXPg@yp^|WXyDD=d4 zUKtz4>bsga>lpNeFVA6N1HjVixEeXkws&*P*udCvZ`I?sSk6x1&rT+*ViiqJXOIuT zQya}}J{63bd2uQ(QPNTaC>32?h#0-iY@h2(J!=`n>LmyG@l%hrAI_|q(028>HPH#A zoY&ECFi~@8=PH<2i^WP%%C{Eu>QK=YJ*#)(i;Mg)Z}WjwY;2MFz;Fdh!2E>@&Ph># zYC+6P#`e&G;uLqmW`$fCbaXDrb3IY1_k7K$;d*92f;v|C!_?$eK2@H?#}z7yX=aw^ z?*OkXg+FEzXwyWAR5bvE#q|>JT*783=n+Gn@tadoH6VW-$kDd=JjZPIK{9_9rJ!c+ zM6K6r-t8sqDs_^JSK@PVa%poomzkc7bBE#0pQ0BZq77))M+@f)mAm1U-wLr3a( z(nD`(x_yuT$eiYc2JZc8{iMOa;jmm_udsi%CvBMXsCy`Gvck@9i=09^i_%vuOgE$H zo96Y%I_+lrf~dB&vRq;bWjY0v$Y~yV_qHE&zCF41knegV%L?3U2 zcbmr;;bdP<>a+7kZbje=sDk`?c?1!|a2Ih9kmfv5WSG6GkHaEI$=0Fs19PQN;7uu+ z6a^Q$%5Zt77DjWIe4rN@Cnqp!AZAU6n=<7JVXFm;Ew4jN+!vQV^pwbA^h$J10C%;L zyA}e}X3u%tJS!W&>B;quh+>$xUV@WqA(_Df*U$z_l9M^H`*8%j-RnE5V}}w>73}AZ z?BE){AzKK5*|5FD3APPl1(%BIi`0qQt{XT_6-crK7fHTR)LVn@;cJ+QFQhLcS$u&q z5?RR5vbLaWSMMa#)t@fww{$=pQQRAj>vI|VIUpeAYx%3!NUIds9SMf3CL8F^Lnam2 z+S>2yWiwoB)>1Ldnv6YRGwRQBAP6e&+fp@MwDZ?i^Q1Dx69gHrfJ{<7a{Hr+hn=Rb zuWzp~-MgC}epvayDSKD;PQ6FDR%F=kpK_58F|+pGXkIthSUyXB&hb{2H^TCR5lmG5 zf zV`@j$A5e&SUIq{9wzYiCa3G}V1-{1Oix6ML^0pYnLMpN@#Q*MKZsVL^FlyosM(8h^ zGAvIiDQHLv+^yD1mdq4MfeQGvdnxAdvAlC{@4%`x`@|!H27kJIOwlj$`;v@buS%LUFLp{r!YQFrkRE(QbQ@pP`fj@Eqc2RehN8F(qj&QKBIT z$MDwSN07P=h(ZQvP-bb+%OY)=&|@QAntZNB9NzY6nh06#l}LS3#HV~aOSh*iF}y-O zZ_0er-+qp-?hFrapXXWb4rgu?ijCIWCg3DKPD1pybVG?PyeZ3#%m8pjNzD7Xd zxK!C3PO0^ks>FM~kE6?GJNef6HfB|Jm{9K>xUj!iiFzsI$P_8kE?{AZ6i_m6T6mNU zUZ?~?U}o)?h`0rZy3}I<)eS5lA`=Rts8N?9V7h-$c}d#mQu(QVHB4ObjF?c zBJV7n?c;zXOC(QZMFG#-WNPp5bR+ZmGU&R#MLysX7-nhOBA?4p<Scvkq2VUZU=J&Ryb1O@WLerhCokItwxOlz><)W|s*hvleckeZ0VZnRiCf908 z_e#i;b2{}ZQHL$&whAUq&9`s&sN%mD%4T2tvsxZbqG9@Z5B!+H#Du&g%N`qDDvvj* zu4fmHWR@28Q7o!g_|USZi~V$mCYNxEe1bSe|pWya7- zB8g;9zbFF>`l)qAz7DR7Y1jcuTl_p(vEk09>dO9PYi<`I?Z$2Ip7Y{!lfl<@nN5zy z>nqm=R_ht|8e92l;UZxZ$1Ckx>zR4^nc(*q;N!M8;XWL~8l{}3qsJ_t>k8^}EZv8Z zoi-8cxZY<6ExHIuBK|mLDS+&qKci1~`;va^J$GMrF|pAneL)fd1^Oq)0{BEzXniq#6Xb-lNU1rHI_FYXZIlqrz37WL> zI3Qyk_~QB0pj-{NvcfK6L?6qrGlR8EiH|t8aSe{;OjeJL$k|itroC=1l!&NYrb-jeNFg#KIB*L zbXab5HQ%r8p6GU%`j}3}?o<_lvu}A&HPJVM&w~&`B0|zJJkw0S&ZpGVAD7aQnZMbt zDYl=fp5f``CNKCnPkPDGr`mTN6=C0P*PMF%wiKimBb}@qcmA%K)|2f1**>`DIQZ-H zL#OR~Oc`f~FTr9nSYDMkT#I?jRhPr=>0l@Kn2Q)PdY_iB`Nh1kF5g3iMjUw{O?+6` zxCW8N&kt@TsM4E#_Kin*kTqAYXB1Q?h26FJDJzmM-@lqoIVNvT7oS*7g_4SVc27Ej zx(suU6f4cue{Py^D&IUTqqL>$uFbnf%(#dlXJ)W|jmfa^^;~eAmZJ5%OM$ZF$8{pA zc*OB7&GIvln4YnGhpO;JvoF)e6!ehN{|Fgsi`+a-F}KZt=*%LY9o4?Jeg z|Am(c9ElFstJ>>a)JYyaFZ8<;z7UjZsWv?Ow<%2w{)s)(M!F~6LWzXuusU($7Ci35 zZA}P{FvuuulPWqsjFUax+06y5DfA8TVG@;xGrUQBMp+;ITsU_k1_rO&+js|Ti9OyY zvdXYB(+XNbq2JnIwe!#Eo}wbTIUuK^akJtLn>~}8yBV@MpDV*5*x^zZ+ORqozFUwKIN4gSn$k{ zuR$^rDSog)g1~bAg0shOQyU+uA13(`P28YIFau2^M^)1No+duRCiUAqNjX?VIE$>5JuFsMaGv@^it}h0pmy^z$>NljIR55lAeB>y<~` zG(fBhl}I0K3%$ZKWtunzy`)W1t*@T-+;R(;k8elKS%4F&$?Bdc`H_QU-j_TtdoKZ;~y_Sy)M zfj=+bx#(4j(@58M|8uySS79$o&p zqC!l8l_($kNYRK0`?-yQ13zrwt%tpR+W{Ol^ge zAzdE2o&?==?J~~_`!q;!f(EZ|d^Om@gL>A%@0Q*nZn08s-KlDiZ$t>h8W?+AgMV7> zbhig{WMo52r!^L6YXW0IPSX1!e(cp{f;dcLyy5P~NZ-b`!-x_j0hTB-f=|FX+z~1= zjX^XZN!RJU%u53Wq{f2pTqjJ5FWNtaLLJh)*39!& zk;^^n-}?pF+%qLKI)?McB`9!s>Dyg11e1xqp{ zQJqK$>OA>|$Z%f}yKjUicTmr}R=^zXg1+yE(CI>zBNUIOod`yU*FfKS5%$moRl7X1 zlBz@RTO+8xQ6pGcV#Jm`~Y}C-To*4XHwO;8>fLDtG_`G` zT@2Gq2nLMnNlHl4+7oS?<}X|-xMN$XI0{7i=7Fa<8h&NjH>VC&LLMc^WJO9T2fHm$ zU>fvpk!6S5mttkiDp8+kY%8>3VDzs-|N`mCA+b z4ooO`4~o;z3!n?yz^1M5sA=BrhSKo9*CeXv3Aab-3zoqo(An@Nk>)L4dA*A>J1-^& z*6h{ER=pJQ!>*hS`(!w`1isXW82O^;CAyv~H{ zs9t~bqn?b9o&g_SVtu+j`tn4t0zCHj#5en!efBhl$KL0PT?c@(~*FXEnf0xwtux0&5>iSIx;UAXfzvn^#@wLQF4eSYE)L|YuP#{X_g9HGG zf%wAf=Mu z*8<4K^oM^S}T{|8T?D&znF literal 0 HcmV?d00001 From 8eb80e964911b30ebeb7b9e9c689e4f4a2a1cc36 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Mon, 30 Nov 2020 00:24:03 -0500 Subject: [PATCH 084/143] =?UTF-8?q?arreglando=20errores=20en=20la=20ejecuc?= =?UTF-8?q?i=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cool/semantics/execution.py | 8 +++++++- cool/semantics/utils/scope.py | 20 ++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/cool/semantics/execution.py b/cool/semantics/execution.py index b2786b4cf..4fd098cc9 100644 --- a/cool/semantics/execution.py +++ b/cool/semantics/execution.py @@ -143,8 +143,14 @@ def visit(self, node: ast.MethodDeclarationNode, scope: Scope): @visitor.when(ast.LetNode) def visit(self, node: ast.LetNode, scope: Scope): - for _id, _, _expr in node.declarations: + default = {'String': '', 'Int': 0, 'Bool': False} + for _id, _type, _expr in node.declarations: + instance = self.visit(_expr, scope.create_child()) if _expr is not None else VoidInstance() + + if _expr is None and _type in default: + instance = Instance(self.context.get_type(_type), default[_type]) + scope.define_variable(_id, instance.type).instance = instance return self.visit(node.expr, scope.create_child()) diff --git a/cool/semantics/utils/scope.py b/cool/semantics/utils/scope.py index 96cc9280b..2d39131a8 100644 --- a/cool/semantics/utils/scope.py +++ b/cool/semantics/utils/scope.py @@ -247,22 +247,22 @@ def create_child(self) -> 'Scope': self.children.append(child) return child - def define_variable(self, vname: str, vtype: Type) -> VariableInfo: - info = VariableInfo(vname, vtype) - self.locals[vname] = info + def define_variable(self, var_name: str, var_type: Type) -> VariableInfo: + info = VariableInfo(var_name, var_type) + self.locals[var_name] = info return info - def find_variable(self, vname: str) -> Optional[VariableInfo]: + def find_variable(self, var_name: str) -> Optional[VariableInfo]: try: - return self.locals[vname] + return self.locals[var_name] except KeyError: - return self.parent.find_variable(vname) if self.parent is not None else None + return self.parent.find_variable(var_name) if self.parent is not None else None - def is_defined(self, vname) -> bool: - return self.find_variable(vname) is not None + def is_defined(self, var_name) -> bool: + return self.find_variable(var_name) is not None - def is_local(self, vname: str) -> bool: - return vname in self.locals + def is_local(self, var_name: str) -> bool: + return var_name in self.locals def clear(self): self.children = [] From 5bc3f2308f3e0c8450eaeb1097d96875f20f8ca4 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Mon, 30 Nov 2020 03:58:25 -0500 Subject: [PATCH 085/143] =?UTF-8?q?Actualizaci=C3=B3n=20del=20informe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Informe.md | 10 +++++----- Informe.pdf | Bin 57185 -> 57325 bytes 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Informe.md b/Informe.md index 968da4bed..7e90e601d 100644 --- a/Informe.md +++ b/Informe.md @@ -25,9 +25,9 @@ La inferencia de tipos de nuestro proyecto detecta para cada atributo, variable, **Salida :** Un árbol de Sintaxis Abstracta, Un Contexto y un Scope con tipos bien tagueados. -**Algoritmo :** Durante el recorrido del AST será construido un grafo dirigido cuyos nodos encerrarán el concepto de las expresiones marcadas como `AUTO_TYPE` y las aristas representan las dependencias entre las expresiones de estos nodos para inferir su tipo. Sea `E1` una expresión cuyo tipo estático es marcado como `AUTO_TYPE`, y sea `E2` una expresión a partir de a cual se puede inferir el tipo de estático de `E1` entonces en el grafo existirá la arista ``. Una vez construido el árbol se comenzará una cadena de expansión de tipos estáticos de la forma `E1, E2, ..., En` donde `Ej` se infiere de `Ei` con `1 < j = i + 1 <= n` y `E1` es una expresión con tipo estático definido, al cual llamaremos átomo. Cuando todos los átomos se hayan propagado a traves del grafo los nodos que no hayan podido ser resueltos serán marcados como tipos `Object` al ser esta la clase mas general del lenguaje. +**Algoritmo :** Durante el recorrido del AST será construido un grafo dirigido cuyos nodos encerrarán el concepto de las expresiones marcadas como `AUTO_TYPE` y las aristas representan las dependencias entre las expresiones de estos nodos para inferir su tipo. Sea `E1` una expresión cuyo tipo estático es marcado como `AUTO_TYPE`, y sea `E2` una expresión a partir de a cual se puede inferir el tipo de estático de `E1` entonces en el grafo existirá la arista ``. Una vez construido el árbol se comenzará una cadena de expansión de tipos estáticos de la forma `E1, E2, ..., En` donde `Ej` se infiere de `Ei` con `1 < j = i + 1 <= n` y `E1` es una expresión con tipo estático definido, al cual llamaremos átomo. Cuando todos los átomos se hayan propagado a través del grafo los nodos que no hayan podido ser resueltos serán marcados como tipos `Object` al ser esta la clase mas general del lenguaje. -**Implementación :** Para eso creamos una estructura llamada `DependencyGraph` donde podemos crear nodos como una estructura llamada `DependencyNode` y arcos entre ellos. La estructura `DependencyGraph` consiste en un `OrderedDict` de nodos contra lista de adyacencia. Esta lista de adyacencia contiene los nodos a los cuales la llave propagar su tipo, estos nodos de la lista tienen un orden y esto es fundamental para el algoritmo de solución de inferencia. Si tenemos un caso `{x: [y, z]}` donde `x`, `y`, `z` son nodos, entonces el algoritmo determinará el tipo de `y` todas sus cadenas de expansión antes de comenzar con `z`, aunque si `z` forma parte de una cadena de expansión de `y` entonces `x` no propagará su tipo a `z` ya que otro nodo lo hizo antes (un DFS simple). +**Implementación :** Para eso creamos una estructura llamada `DependencyGraph` donde podemos crear nodos como una estructura llamada `DependencyNode` y arcos entre ellos. La estructura `DependencyGraph` consiste en un `OrderedDict` de nodos contra lista de adyacencia. Esta lista de adyacencia contiene los nodos a los cuales la llave propagar su tipo, estos nodos de la lista tienen un orden y esto es fundamental para el algoritmo de solución de inferencia. Si tenemos un caso `{x: [y, z]}` donde `x`, `y`, `z` son nodos, entonces el algoritmo determinará el tipo de `y` y `z` antes de continuar con todas sus cadenas de expansión, por lo que si `z` forma parte de una cadena de expansión de `y` entonces `y` no propagará su tipo a `z` ya que `x` lo hizo antes (un BFS simple). #### 1.2 Nodos de Dependencia @@ -71,11 +71,11 @@ El algoritmo funciona de manera análoga para atributos, variables, parámetros - Para las variables su tipo será determinado dentro del scope donde estas son válidas. -- Para los parámetros su tipo será determinado dentro del cuerpo de la función o cuando esta función sea llamada a traves de una operacion de dispatch. +- Para los parámetros su tipo será determinado dentro del cuerpo de la función o cuando esta función sea llamada a través de una operacion de dispatch. -- Para los retornos de funciones, su tipo será determinado con su expresión y los llamados a dicha función a traves de una operacion de dispatch. +- Para los retornos de funciones, su tipo será determinado con su expresión y los llamados a dicha función a través de una operacion de dispatch. -- En las expresiones if-then-else o case-of asignan automáticamente el tipo `Object` debido a la complejidad que supone la operacion `join` en estas expresiones. +- En las expresiones if-then-else o case-of asignan automáticamente el tipo `Object` si al menos una de sus ramificaciones devuelve una expresión que no tiene tipo definido (`AUTO_TYPE`), en caso contrario asignará el `join` de las ramificaciones. ##### 1.3.1 Ejemplos de casos factibles para la inferencia diff --git a/Informe.pdf b/Informe.pdf index 915c24995fde51bcb05517d7aab51c687bb61dbf..959aceadcf68c10203e21af156df0945411f57d8 100644 GIT binary patch delta 20191 zcmV)hK%>9mz60&Q1CXW&GcYhXH8M3dv91;ae@n01#ueV*U%_>N$ebC@gFsQh_u4Md zMFGPGx+uCRoTfq01WmK(-!CQ3NFu3^;{AL$BxNQ@ENM(~c;>vHZ~pY@AH~0ZFW$U- z`cLsC{`vChsXTaFw*M5zf4{%}L5D;9Tm)s}=iU6iVHoo(mx9#1kgYEACe?R9r zy{T@uJq0>1?TR~8ws+0DcEvPUcDm^6-W05Cgqe`?l z)#6)y@XmJkrZikJX$MC4@D0Lx}zi~_v zg~~(KKic?OHob8lu($5!6G;Snf1;MlHU0vM3)8HWbthhV{M@q7S|2~xrK(-S47$u~ z!r#9S;8#BM1b$zro8Z^B`C`v+-=fGF`~w1NBx1|o2CT0-cvJP*OBJCU+JymHH3u_b zefS!@gBCX$iQ3}z;51F*Zv(RT2R}ghI$q-jOyn)x0p2yf+jE3l%ao_>fBFUP;9Xp) z2CV#jf{s6Nq)B^YPJy}G2l%G=ZulBv*O4vzA?`$WdFxFf?nJ)wy1nJXH;g-&8X;C; zxQ*Nm!_6eV--v*&sKsnN?lA?Q9DNdy`m2odT963^lfV$6tPUhU|tBE~0ErmJy98GlYOu zFE>=ifqFcfUaiX>2Wcpw57=~2_tG!z_s0GRrB|x3Dt-#hudcA=f7vH>{QBjost-!l zIs|q4p$gX*pT1o@S5K$!I$lt8E>+!ItLATa9^I^)>x;X){_^zG)AM&Lv~OHv-{`7N zC!L5m8h2l(RgP$Tn89F)fY~A;FGm>Wd-xm%27OsU8GVF`MQs)<1dPFhg)SqMCCDx{+;L}5|HC9|1<5$#}A7RLZ$u7G$ZIY7FS7t`oF5I=QqLyeY*VB}- zupoHc$a5Gj%j}JD&=7V+Mvf`3vzI6erOvv_+oZ1!bleaHe`&t;c&YpEu z_52Pm>4*m=k4`%n9DcjEIz_uCT?2QJLKfv=aF8m#Pkf!BDA&V)8-z}>PV}MgVHw#q zhP6%C*xn9Cc3r|9__WejCZgRU5Q0I1Y)=E4QgrSYE#lIZPT~-A8W>J|=jGpTnpl za0fa-^kz^!d=2C7Le_?~q6f;0f3k*ADD2otxBL>Ba zbLE8H6P$S!$H!qm21TDBvT8<>LHp&3V4Up7x!GaJa*G^qD9Pp{WXMcCx$*-wpF# zLZWL%+rXGONIYdWi?6|lOfc3wHe03B<8ao+uEp@119{C zOExnaEb~4L1v5H;tWSywwBS>aE#qY92l6Uxe;bZaJ%PPc$?QO*V2+;}vd}3vqi0@}p1{fEmXihWJV2AP|F=kM%tdU$E2U%4~7CHpJjYy2E;>C}h zLipNMzO*46i{ERn?Wq9%_&GM4b+7L>Yn?BuDiq!pTCJqvYyi5S^<_ukg6N6)xNOOgZ^2uRf0_oXRq#dY54~FGpS+ss&p7?umc63 z^DZG*eAPY*9f!~K`qz%^0Ky;*YiZzSdcAcq+&-My9CDWr-}DT(!PJbGh<3H>H_>C> z$E9lqBUyCXf$KvQ-YqtRYu*&Nf4XkmEp_mE)eg>`!a{#o3-dlLMC&w1W(vNIoR3&{ zF^6qm>(1T95>Fd;8np4XhHcy4MHDIrpm-Zs3@HA+#Rpwn8FZW+xhBP-E_^e_y*LH4dFM zdzT)qH)pPj)Li4AB<*vkqSvY6$2k-|tYU)-afAJS*JrB?!+#nY0am9)r_TQdE4Za_qz<_1q|*Q<|Bmm zA&D^EO5Q0b%LwaS{qJS%O(v@)S6&TfgtEC(nGz*OR81(XO=7si3YSckP9sK7E&(s9 zZjVrXCVZ1s^j6S|OSYR4Q&Ngykc)>vjHeoE%lbQ+!s|8rVlj7Ne=0deTVRiH%jJE` zvRs)t1#Da`-xWu;f21fajJPdwO>@C~l);^QJD9ip!`ZW`#)LF5U~{z&%9IRGm2u}R zGE~YH&TON|P&F@mg?W3C;cE$3)v5zP*}U~!JYKeqmF$!v=6x6`^Jo*uWM`Mko)4o5 zG0uLbHfi}zqPZ*2^>V0>{o0F*8g740Ff7g)^yYKFm686{$?h1fZ zDk|gEV|+vR1a=$2k{t0%0^9#t@cu@Q98t8Nqn` z9N8AAkJeKB(cC!e?+YoL1~PM+L9Oot_R$PEp1?Bs#~QWDZ$qsLwu3_pI>=OMI$OyV z9LtrK_FzTif2&RjX7pj%1PDTAQc3W#W2e`gIFi+GWXlr=cVYb;+}JMPe7@s>!6x&q zl^3}3j(AQDS7uMitW-x^qT+H)p)x^+!?}cb#BvpB%)Y{5wHMB;pt4H98p6 z4=WIS|FAr!g)U9u>PDH@di}PAE?tLdFq*xr1tDvxd=Om`ebeY)nNc1XZ99j{a1Yrz zBJ1$pHqSm$=oZ|!#)oMH8dcLd(W!P5(Mi_skd2QqeUX-*sFpQpBy5K~sxXy2X4k%L zIh8!-e`s8mX&$Eut!`7*>&FdSsT&9KI_Zslt?(L!^ZM{LI1>+FgR=zjH8@KU!$1^n z)SJ$(DK(FrM!R?O2lLROFZE_vbo1`7GBM_yyrIoR7A>1ezGn%ppyFc#T|sB|4VpcZ zXc7`L#sfwn(XbYi^Ddm2xqNCUzJ~By3YYm{e-_M?(l9N78EOCjWuybu7y(Mf-jW_k3eI#4rpnSAU~iJ=U3y;M;6} zf3W_hrfbfw$`pS$W#LUI>;@8Kj4>Ua4g)9(wpqXdAqCqkDA;B}&E96gG-rMN%DEg% zxde}F!#l>bkWH_X9l0uM7*j%oiLhY1gvoto@J*H$GTCz@*AQ@{=6Ye1S-*a7S!Q(k z;L_s~TR?!lF$XIG>DG``Jl89Me7J(=e{JDwS|qMhk<&nPxG~pjWPoc*iX7Yx&ks9? z{E!>r*4`GJ5~hs0KK2nyHUWJYp2^h|l#y<--NYEfjtS3*8Uf44=(E+?5%XY$hup0> zw8u=+$eNw0bm6@&)E07oDrGzJ5~h-kSVFKMVC0$-uHeKp=5E+ZgQWrrr@6g{e=D#g z0YgX6o-}7qrtt)+xSH~U*M-LzC+*_l|6FpJvbBzL+&XMUZe+0!!jp30Qx5gu@ z%yy2f>OfG>UMTFXpU9dSErijK7I%ftpD%NC47mx8p>Jn)^zL}b=XhWYG-kLNV~%H< ziYbhVxtd|k;Yi7p&R#ZZlih|4HplS~7ydlI+GLdL2n4?BCs#K#wVlH>)irGASEx*7 zryVBMG@0Su%g20|e^0l<9iW&r8z#?U`6(Za`YhV>jLJ2U&AncJ7WMMf_?T0wZ_zfB zCB*1u3_oBJ443bs%@k$jR82xzZ$>p~&LgjC5{|>fCaETQ=U>n4X}R?KkxjjjEh!Y` z@!2}FtXb0T@^lM{9GOPkTVDjf4Y{CQdCj%v_djT_I&3mmf0vH6xTMfn^?1#A`f+wd8z>09-7!G3jxwA*jmKcJ8u~cTs6k1Fo#l zH4(k5A;@FMVXmfe}Wv5*oE{sINEuZMz%{P!O41b z9&J8ru3?AE`*HEq(r5S_(Z-)tip8Ny zFNFV%Iv-K&rQ$~rM|FVM%aowXQt;a2N3IG*ZL7lD^}AnA)pi$cwuC+KOV~`bgk_Pq zp=ycCeX2s88YU>}YhCjk>W@|Tu z`x{vv9hT47$(64u+e(IsUdo2n*W5;hXeu$nG-Wf@nT)Cj!$eu15HpsF${ZHWc%v|J z@!axk)~;;c;Wj9qtYNaeski3V-j5cByEmmWsv94R-;Tn6j1zt=K0f^) z1V)hhWRr*&9RfHwv!@s70e`p=zW1-t*??ufAHX8Odb|#hLjc1Dd5F=da+n~_vg?5=>GNJ?%mzze|Pus-@DH{)?3ZS z|GMGN+q6NrKK||;m+^OZ|9$tP`?349`xO5Eu^an+zWZzV^}kMZe}4)8|K9!W@1gP6 z_|Wjc_nqao9|qt$Tt1|ioGH^A&%F!nYa3avcje)#Q}^nz>C{rCQl-MbNsI~U$6l-62}Gh?pj-fHc~ znK9pMA*>wkTF!dyoqrI%<2|!sU@c|ZDtg73G2Zy@ewVa|)}C{20)8IycHS##tPf+K zUZj}lH5bC^E`cU#y-$Ho+QZnrvNrs*CT%wXEN-0+Ka)3Rtw;FocS(CPpNF(Po&D*J zfwNLv-Umwm_GV9;l9VpWgpK$M68~%QRo-a7CE6$bMv@(;&wr-aNM@2jce#BrEfTfh zt#WK>m3gxhZA-I>EdD{B!r) zz}`1<>_}AevgND47~F*p$~(1 z-WMGW;+o$eTY;+9-QxX4TNw`YOES zcqgQ5%yeQVuQwp-85DEeJzW3_40SDWiu*LBR*wo8f`9eYU9h#gV9+-abreyGo67o5 zLUyLyDa+2d&y4=oB?UNMP%{wVMM$wnu&Sb1DijFtd?=m_7Lo)i;F%WYD)^qVmgEc$ zpz`NXh-Uf_s4&AJ7^7IhV)NsM z)d9(1An*>37D!o#6DdaeGhCQel%-NF$eZa(?P}}FmlEVv&UB(hP!eVeq`9u{HW}od zxkFI`FitY#VPFWbx@%$P7H0lw)iASWw(W%FLVq%#qOQg*8)hbn&((z_$)7A5j+=oR ziyKPlvy$q?IM|p^poMEbK_;P;s4Ssgj8C8g5t>hsF_TkU@CgV(5lRRQ2YF_!QG(@< zVQW4?^9k1W2|VwFX**UYA!(StE~0MPCnzdD@y<(O@ri}xtML{jOa&l8K-l4tIBBRT zkAJS{VHhr&hmpxUQ9IS{#dsJ-t4_FfiYQ?wUy%xI!q=!6eP-qk%9duB_xO`<+*bdOYTEZ_6!>CVWZocGG)cldEM zr@gc(1fvV$`h9b@uIynnu2>E=?gL?q4uA=QcU)MHfQ^lPd>@f>Va>aUxYKAnVpIj5 z$smX&8^U~~pUg*~K1>{7Gt>9@lYcb0$|e@b#XXz2!`|!hkgAQdnkq%vYdO8+;~g_) zAm*Mv+Q|UXX42 z#PvF&XG-!*cT8mAbL`-mVyN+ZFy-(}e}8k|ObY}ff=5t5jkXjgpE0`h=Vub9%OlQ_9h5)a*Uk)qyOg*^>n-Wu{idRWAFP}#i zEIQz57+o_=ix**0q?Bb^ygX+_6rL%CX$j1Pu_F$CFPmCuGZ@9NQD#a}M4 z@4+$=atKnR&v&gnb60tKW|kOdWjPAtjAA%H!Cb+M7K21lEO_czIA9x_;33L{qcA^> zEkh`XpNE2^>A06>{AOzRJzfXWIA(b#)%arw{CYX;=^a0`y1%~PNq^CE?uBzaKEbp8 zJRLney}#CDmoD$CCZnt2`Rx7S36u3V`RLzv@83K#@P(G0+ONCg>F2ly!H3A*goCke zOd=~4WA=7HZa|hT6SJS;E(*R;WZkL^-?*{_!+D1=`;)<>3I_KWXGX(&K5%a-RRzm1 zELSGSU?n*{6L=s%Fn^=PD59JaxWf?O(aPF+*lwlxJY}hXN25@IGSi|;cm{728x->> zWu};`Fh((KSWjWfm9+vf)Oa)suFKBnmi?r%fz`5jD;vnC#6Tz*#WcmZF1syID{_Nl zd$y>LN#R}sMrT$Q!3rSp4wgui2zXJSd7HYP6t|~X4%f8If`4}V=x7>oog4)ADr}fi zjEnU}I)s`OIxcG#;$WgGDbfoE`f&K1LLWllmbBYl*2paDz7aU2@aAb*-l3S1WmP*x zhP)oddUsN5&xs>@mdBAjzZ6IIGLQ6z>q#7Wc!FpBc{+NGBRhX7j_h1Mdbpm%kzI@& zpZc48^u^=I{(n&8W+pX`B5JVuz)PlVbctd?uOEqkqX~*fO;LvwQB&0Xs^;ZUqH;w! zWX8-Zy9rn}R)u+oA}J_JoZ_Ej%26OFo8M9vqqtAeXbgo%Nl`{jpR#x>D#b`yA7x|Y z5IgeXp5Fyi%9>6vp^m21c&(!;WKX6{XtkX^89V#y`+uE1nM30fJnPTX(eHQTwTz}v z-d9XU7sK<}`@<6^>u>VWzwJIRws#CuWP*()m^|YBK*jT@QLS`iLdrF1Exnqw=E5od z7zeeo{3z6}lw`D0-iq7{7;ZL}xFQ3rsq|@?D^C^QGI;+P247gPrEsVaOPfkLI)!(p zUQc*&{eNt5ihWBtQBoFaN=Uz~Ux0B?RvwhyrlH_~5al98k|-HWWo`8Jx5O6TTOJ)F zJuwVk!4adICOgHzr?c0S6nM3Si}jNP*EdKowF$wdYP-Q@)%5x%_$|wWmbp@zJ`{tV zawL?p2|+lN8cV^LUY{MqE}CFUp=p|9a58UD_F{^at)v%Ux8fB=!qz{N*5Xht z4prX3#e7Z4i=kv>P;fwT)5{uax138;Df8n@y^*q>DTh`G=qi&@DmWKuMrpW~=NYA; zRez^BpZn`9qjY?NXZ?9P`aYvHT=Vmc($LB#qq97tbbP{O{Y^gl!WpGv0AmB@UfKQc zR*|b&gv}ys7U8xn!nQM6I!wCywpQVgXVKahq`h8>m4C|_^RI_@C|a|u%|}?<)$-LT znY0ueiC|x!d3(ptxYXIzT=VZS%2#Y zXIV3xU>>)C3K0h{Dlky1PUqqQ2!AY%-2wwGFfc3m3Izs)$m(N->kIXw z2KGV)?&L{P;#wSeH-{hk&9T*Ve5%sYsOkODwb(`ko4IIY8 zuwgUeW4seN`Y|G4#>64)NY6k(*?%dfxW1M44htVH!+66`wobRG0 zXxZv3*iD)Vs8B*j1b!psWYwxOxaA{pwX3{nDF#bJbXshw%8Qmdvr}+g77pvOa9A0J z!@4XS)@9*~drjJ@e9pCw^HPq;QR+icBuClWRke1)D}CpWRJ@+Dbw<$>1b`lA(7e5wN0xdxUtt{SeG$)zVH@1#=kW>N@e z{p^LJ`+lU71r!|Ia=5H)j(-n5P*Yoe8zV;fE$x=%w=p`CJ~-qdp#0|e4qIA!8t-%c zbIS*!noE5@%qGOe05L zfM8}mc(jAp6-~6WRp~Dr_`^^aooVE6)AKVq4PnFciL27U53*mNT&#ZfG-^XCkZ^$c z4dWmNpn4H+J*E$a0M3*&8pL(f9ATz=(9--6>#uun>*W#rS4 zRG7}Ju&+b-TJ=l<3NE-vh(wS|BG5C$tH*u=VfQO7(0xNIZQ#TUD{aXS&q({&6|nx7 z&sXB5FzlX}gx?e|Ih|Wy4$5W*?<^my=lqfUSN5zHW#4oru77)LDQ3!;Ey_P-d@ld& z;`}$UZ3>^yEn9`15>cd_*(rPa<=SY~(=P*)ZE$U9D=OOt+U3^q)!owSl=N(ql=Kt4 z>ZK`Zm}*k)bxAqnH|YTxZz@{=mf72ua(1BL_9$uj1g{?#r=)OA%DpZr=eXVC+HitZ zwg8-5)X%<_Re!Yf9@8mXWt+9eZaK&1_0&08|2u0bq{pkql|?^B?Y_Aqv@tPMY{N!v{Ti(99|&*Y6+>k+>DUDBS+=OJxRXMcJl>oQyp zwcfr41TU~!8dq$dE0TUA$&S-!Q*0zN$)LO3o)EDn=WUY9YXM!E5OezKQ}=22e*tbw zV3S@c90M^oFtdFrWDb8}RoAcHllS&e-edi&h>Wa~Dx5?k4h^#2(PpJ7WW8U;;#?uR zu`>MfCMVH}1L80l={?99pk4 z_dIWEU8&SZ4y|eX#?iUF_MlKw6bp^`sM{`qg+jRyvJzWwFb# za$C0UBBkYQHfTqIgO0+vZO_3xSRU=U)i#?m(d(&grv1(c)mZ09dwt3Yxcd=)mNHgG zx(f~0S%m1~bxeO#W3@tIv_W)LWVS!Xuzs_ zm6xJf<6boGAj_36l{}L5_?^X5PE3vwtz)Il<(0R*8v{-pk5gNS?u|ZnW!N27Vpzl1 ztzbQ^4sq4lF#2UR9x6E}kq@=lp;GDqCk{ z=$A8QnPaRtDWJ=Hnr|oZJMVI~d`NY1*P#q9robqN0)rb0h+Zgr;nMnuT*B89aXo)dyM;rXgrYn1-MoVElnMqSnLs z5T+rR4?+rrv!C85Iz-ELL0vZ9--GwycLIY}ieqYknV`{~Zs*^HzCgYzme|~QoYhVg zN_hyqNP7^cv5tavq^zJFN?3@!v`KaXYK@{dK?<#~)>@I~ZG@2u%c&J6$z$rqL9Mj| zCafxvB5j?(_&_VtTF{QP7PJFN2X92Jhw)*po#un}2+SVXiHTCD>Afx+-jjeW79_N_ z;BBl04Uv3tMDivmO;Fw*bbVV3ZYAC9m%7iJ{{zQ!69uzBJ0%+d_OoSHm;wZ6gS-s0 z0a-2ye@8>rbDY@<=K~-3Pz64OpzQWJzv=JCIw$c^eBb!s555O{=mn2Az8y&b3?D4< zp$IcUmIs)b0Q3wqK_)Xy?%gwGru`Q{>H~(}GZSQ~aLP=e5{0hPgqikVcv9a}=+|bZ ztljC_v6F98{lmwV2qK&oNQ@_cJ|alM7-gAOe-dNGkB4O@J~9j**zrhWtoT{rM|yR3 zwvMuMHjHQ3Ig>PDI2)(z+*qI=NMcmZexc>r3eZbHM2DEeDMs2CLv3s5{pzXbl zsJ^Grug-w(Mczh<3xI`I_!!*wY*v<;1nj(Epi1njvbdIrja#-uwm($2(vibbIU+hz zAGVHjK5QMS54(Gwi0Ih+uu*-$&<7D6=X}^YP#<>pJQ2~M_hF;@ooKV+lQfA zF~DD>!21#fX7cMt_-5!}A+aytj^IL#vWb^Pv&~Bio_YmIlqLD` z7mQC{^%mX3Sm3Pf%tfbM<9wOdLvO{ z62FMZ0OISgy%s6*wG4*4^hGXQ!@8D9x#3#f$Hs(ERn<{d#ls2mTM1FUNx@p*EWNpZ zfwj6s=nLXU7Ho4~u=2bhxO=;71dHSjz=d_H;D*En?3}yh?s==K?bMD3)l?5L(mGy` z_gnLEI1&?cfd`9H^G(JY`251uyKoVeS$AGuu(Q8#$L2+6%h#TLryE`4MA7VfPiN&> zi{gPUHkrv_no!+oXeJL?F(vl}FL>gAd8r^+a=*a6QSbk}?E$ZIvf%i#^kMg4%n1V( zNp<>m5~oU1gh&#ol)ZkSXp(@16qkJ8B#9;@=N|d9#=Rnsmkj+rGa5*;F-wS6k~>dA z&XSx+MHAWM1FMd2lr8 zdG}0{p6|c#q`s%n_esxJw1MruSLW{0nRSZRAMPOCV8wYI10rcMu2>Qb7s#KTl9H+xJ6NtEP>PGM8S%@E&N^6 zC;EGPqo(S+s_&%wPI8mPIem9Usj|=C7!DgKq8w?rrj$eH$O!kQlXHiE$xKw0{7h2r za;OpvmR-3^uDIY8i6Hs2=<1g39mae+lHCW%Et!(>+{%Kcl#=6dUG|bO2@WLN9h+yx zy!y4(5ggebh~Q_o2V(vUJMg<_x;?P}0!V$p(EIIy2zF+BAcC1dHVxsvwZZx6(O+~I+SUKo;e9Ss`->11{FFOGC`SN{zpiY_aRB{$owb$?&o zJgJ)})tU5cX1`%)lE}e&pO?i*9LBr_E)h`@rb>?=M{kK4kw_7AlgKavR@jfdnH$D=>Cs2YOH*OEHFQpGi>0@YJA3BHrC@rD;KFOK;=XzpmHn+bZ0JvU=uC1ZS*?mK&68T`KL0*dCCta zKxY)@7g#!&kU3aqS=HT5aqJ%|CDH+v6X}4;5l5jGN$H_~R5~2T^F+&!qd&HYFg1_w z*P=x#32jb71QMPNj7dBj7-ML(WCZi&1WwgPRU6g2oL<#kPL+fz3DxVssy4baZS-w< zXY_OPdG~(+?Zb$Z0a+81U~CHkHnVJOk`8~meP-n&LRy|E32Av!J3?AMF#BfEse4XC zTKyZ8^ry|yhme*hxg(_IrB6o>&uK`jf1^qIH|gkoNNYin=BXVKuOU%zG#N*atQf?{ zVRVjlg6GK#8^@R9SkPGi=8br8b^&6PW%CwNZP*H$fg0nDe+6Pzn$`r(ywe6N#JZ%ond z3OaMLhIs`Z$8YBw5K9N90uNp`yX1cj%9QdsFs`vc-tOZJO!4x080vvx-FJ;q~ z%Kv|t(z&zz4C8htbC$O{qEsD7AsoyYb_|1y746HL!!1GcZlA7GHCl>T+@s{%u{Jweod_p7Kf$ zEWa>ya)KvW)2w-YBvt^4lPiDV$RbYml7j=zJf{yNax?;m-ty|CtoHMaq`NZ08Tz9n7pj%u#DwxzH(;*8oW`*~Us_M; ze5!AR3v?!oxukTe_X#!9h}8o!qcgcoI9lwp#li^qooYQ|;oO$wA!RM7i zrK+z^FP~moX=%x&DT=PkI(({WBD=7JGEhR{dJlLiRKdEE8R>~DLGUS8xwMSbVdHj4 zf9y{er%dlIkur^(;Ps_F-c`NCp;^xPYX|}6fC4p2tv+wcG)`Wkxo2F8*O~M3d8O&% z_MTPdyeTHwLIcHEbxD5|WAy~DSo^_S8L(VB;>L(2X~~_r^szolpT=DjE%}M`VeG!b zREAryj$>GC)GkebjdlC_t|#}jGT#?+`uqdOdoFbXCU5@X^e2>F$|Wovg;mGYI&xw& zGga%1-JqxZZ49yRf%7w{f8uZ@=b&reJ2^OcR!rY{rE@7QaFKspGE--jcOHJO;)HqQ zv$>a~cxB+Gq zI96|7ZJpQZEmf&=#+Ey&2f@UP@WYZf4v_9y6L|y!US}*f=){l=4yV2~mzz z=0sxi-guVvvKv}4BrL~5$$Hvz^SsG^|L=`>U;Pgt0J{Ocvvz-S7=J)f2?T;7k`N(+ z0z!a*h=@D{jwQ8+eZI@a<>sq(% z*X`HsLtVeR-M)6Wt7P1BXGWxU`}n?uNzR?QbI!Tv{Li`n2?PisO7aL{3CYO|i|C7f z_P_DWMm#EO8rqkf`G072Im)*P@myYOHCwE6(!&Vxvf#PsT0Ajfv0^Nacj9-oE5P1k; zxz}Mckr5)>Au|#Je&RQKnJj@Xl?*dhE@x#N!*G8l%-`k`?SEp_G7S$Bo|uck2$COVnMOp&8=rt})c9dGf6*A-uj>q7bB?>}3bSj+*k27rg@QbxfyR%bv^maxq zcO6ZWA^fllGl@}UR1FQ%Yk2-3YDnfvi8moSRiq(M@2`-1s`M(O#u#miHhF2hJXP$o z@pD!m$jKe(^nXzrOBdVDTP@7_wMp~J%Kqp)!=?57B4j#1dF3CRQPh$zu5i5Ek9guh zhnn%+0^>kDSbLpOl`T0e+S zSU(@vXTSRy=Pr1s!zjuPfhspsv@rsm^3VIVMQ0UNk=HYKPJh5i=2N&B{ zILC42i}xKmP@I+f^kdn%}H8Wb$r_Dudl zBF2L?phb5aL{Oi<6Az|8El!ghxvs2Y;BgOSd|?4s>bhe>L*s7e5iadQecUY6V7q&Z z-GCZ=(0^lp^q4`9(O1-E2sCItl8x7BN4-D7{x&dmui#>|};&L0BE%kBGB zSF^gi3&w%_wjOYE_j!Z_dyFDz|{>yE{k^r2@TSiQqHY6o2F63*hU6n#%8f#$Mz~$P_XIH5q7n z4Cpat%M>L-!4NHlTNU7CijIoHILkG-0(PNJnU|Z_-oLnv@i=aZZC}6Nm|Im*b*`eE zAHSodXyCO)#Q-tUJ8SiUke~lFEKtdlSI>#he|Y+&iHjDUcB)&Uu%NeEp^S>LEe^#J zq<^`-#hK)4q9y@^1nA{@|B-YX4F<%lJ|KenfMFDXq((P(xHvw2clnAHZSQ>8Hcr6} zbn?&c%g%(%oPFJy*;$$0&vkDBH<-}VvnMADPW|gvTiN1E`oCDKp~ZITO8rvImfzi5 z%wAb4nTR%Vi2|PVS`|gD$>^!`)Tz)8<9|Lqc-lmt$f#ic>@&}#R>B?Qs?ZM=tsig`^Gh=(>75+T)$WFX!j=?21;KDEXV4NG9PDcbU1qci%IeWOW9H46p z|Ce{|t&lj^fz_$?OD&9yZfJO|AeC1wSg`S}B^Fc6w%3;>B$Oo1ZTzB4TY=x!FeD1RxCTxED!S=;fl#lQ?bnlu-nsN|S) zrzn?Iye;f;IiVrP3xAB^Bl{dH)|Om{wdGGje@=CIdQfkS6krPdkC)o%nK35q8#5Ly zn%n%7Rd;m0?0OO%@6Z(s%T+d-YrHK%0kB$3k{l?C< zx3{0){vrSJ?+!v?Uf-^FuN_ExPG;QQ$KT{X+W9QD@TX$o{C}%Z|MB2H3{U=+Y}!>i z?%tA}l3gSdh@ZG_omOnsIu2LOi1nay6Z0WEb?62DJhgD}caQ>chYsDb!y_GEebw>M zs*W$e{^cXg2Ylbq&}-+Q4y@0ck}P`J`KIwVLBLkw?XgIB7b4OMgAfa`HRkT zXpmWp9Olygjgw3`qv1=T-+9w{2~P6K1Oyhw;N7l> zKrniE2{7|O9lQC;!?$uKD96m6_2yx|63b=zwWP?s1AolSJI5r%xFce`Ma29xpE0nb z5c3n{X7#H3nE5H91E9MP86ey4egcn^uP~p)6e#+m5qo#wcF<0Vou%^woi5g>)7K~I z{r&Yx^ZfN%KZ*o=$=qZok$oad*0DNPPeaMlnq;}kqt2s8_A~P~F$uhN(BEG(Z9iP* z!(=CKCx0{baK7M|m3BT(;-=h9%VhYOpLNvm=T z&_@Z~Nh-||qQickoxACGg$3B3|KX^tDk*QQH-Ez_zI^kRL8~P_ zw=L(&pC~GxqSO>G?z-Hv%-t>I*)Z=(072jan;>h!y81csFmY09OKR{mb2atsB!=w5 zy>+T0O@d)CG8gtJy(aoxDS|Z{Irm2$US690Hkd9&M!pR1piB?+UbMF%;s9GU-mV8W zmw$Itj)P}_z$GPI;RnYnc~_a+(^rPeWk>I1a7gjl=lfo{{T0>KarZM>JjO*Q@N(LT zY1PurjBaDdbhX$luy}P5CY6rOgfAT{+MnTHIQCL$$$|YhZeE!8+Kc?(dwO8YCYZQw z3;zM)U*uvGThmX^aD)3RPk0~UC#Qq-{sd03v{9JlkWw>86KbNX<9pCA; z3~~rLu26$G9MuZs67|9UZ(vu69e=Bs zhwf;PXJ)I`x}M%Cur}0b!X3^{V8Yl-g~b~r(yO`0i_w@#LV}#h{!Lbh0xok{s^lG7_IO>F$^diZQ=*m#^84{fHfj* zTzNQD3m?AGLMgH)gcv@`?aZ8I&X81=F`q)ZA#KPdYuPHgoLeCwF=U&fv`9nThLDgY zOKI#gxCzrBvZQPYebe{dtux>JHP7$)y}#vs-}8H(nLm!jvyJ=2dyIKqjuLlfVjhLD zs#SG*(kZXzbrr+uJ))`xu5-SA0IsHoc0#IY2CdITlb^=uY1bQEGsXjk7v#0>3~^b zi{d3|$7Ul3xbI&bATN(C&-wgO_5H~5_fz7BXO@}yaIS8@c=0fwJ(X5mY8si7I$o%y z(F2!%O=N#n}dyVB38wvTVL zD*TeDGdYHt7x#3eZ_Jt2NszJCy4!reB23wFv)PRu1I+f#D}WYz+I1>{QS5E-b=%VK zuMRm%B}hgjUn=+ML)#P2>vX#y(G0_rpW?e6(yH67zK_L zjJ|t`ZTr-8ej@3ifu7+Z-@@^fN$K`%sRuELsS3*}PI9Pq?o?{;V{iVO2~uPOP11Sy z&f9Yml#yh`u-=r^yM$Qv;jGk;QB1bodjDPF_eS%j8ix;=JA`+fD%4=!a&K$XGhJgg zEZ%-|$b)#2J1beGYc>%uwz%Q8$bg)27Rr@O#_~=%51=7x8fAH&p}KMVp2m#3Z&0)v zcC1h-Z;YVW5eL|YiCNxnF9u)d4#z&ra0zfO3@)bCcQik|M}5DB1(wcwnfav0m;26g z8n54srMJ(vH6COjL?{}%Mbe#Z&oHRISlS%_3L;|DX+*pI&@1ZNO^zI zg8)oAa>}^aYCbOr(mQVGV)%GGZ#yXVW*dJ{R<6QNsY>#iY$dN%=F#owD9fCNEmNDo z=&x;`Yqbyxr@e%vmB#fx9U4b(?@2|^w5J`ZS-9-E@=IUYino3@$l+US-+CN*-XY?j zcS+_CHPMy;krYkJzMkTp_Y}cNK-dO2N1zXoun(Ri1(V{FhyoVRd%K zN|-9|^|N}VIfCExhxbHev+qZ{6)rMA?RLMPtkqppQvPniFYgmWBTk9Qt!wGs?k+Pj z(bGol^C5f%nmwNN#9l)@o$9L2KCv~q>uP7JxN3_p-6}bF#_Nt#QS{O5$|ODe>bDxm z(L+S1nciVZwq&_=(WM2E@k=}T8rqYa24paHSy=JYNHC4BU{XOXO4*^Tca>83ppvymGtT4xuj8mh{F$h-dX&Zaz7{)5P66Ju`tGo`XG zYdlGIt?E}bRIZ-C`2AAZ|S6iBRT?o`|QyC1Rxt`)M=#6yqkJ+03HL97K2hE;3WecjwKQ@1K zVX8WaW=nT()S+#%aNdxmSxUD-j?wFGEyQbHrEZ1eU2LcxA5QiCMz_Bleqs`M+Zkg6 zyVqVXx;+$NtC!xfS)@SoLSs!9R+Ks?tM>1HmzC)^uCf@uM@2_k=$eV%XUU7unt29I zCgg$TLuR&rdv1Y4fjp}^C)dZvy{Mz3UBBQF(|d5 zpl+jW&y;6d-;aD79MCHG8>q0)ZQ8tb3>ur&uyNz26|Q4+IeSCDCwVZEUt2sbX~^`3 ziaeP)4vfNk?D70=DMH}hZV%=wr`m~m+e0^cZ0z>-J5q04zW>C*{)y?SflJm@>9G!u zR&)ol(aPk90#WUz-404--C<|`^=9VC-46N->s=mqWQ#fdCsO6)F%E|#?~w%A-R3oq z4A$mB zDW#l!{eCx{(*{f+ui7BqyVBX_)=;U^_3xyeVb(gs{Nu3>;eGlZx!pDL{%|PG&h^B^ zd4tUXgOb$2@=0rTvMzkKu;0M4b8?Rst#097oL5*-RP(vz+GbP}U{kjjQ`}QZCI8aT z_q6Z24BZVATPOALz=YCVMOJ6-bCG4FgyejH#mrZ3j{+H6c>YGA|;`@GeZPH5`4S#F*1xx01yDh7XlC>NEFJ00T34> z0%VASivb9UB3utb|A)o?o>l-R12`~|2%z{4h%iV(@Oc1AA>m_001?JQ;CBmS0-^*3 zA^e1b7zMvE5hf!-8>0v!Gz<*G!u80IFqRBrLQPOah<+jkfbq1FNE8UdZ;Ya_P!kFO z3SmLu&phlevj_?z-%%rAh9r2)mM|DZ@k5iy=pTCiEhh;i3VDkJg2?w+0skNXp?KX% zWD0=aP7s5>2MY!yQ^TwpZQHhO+qSLSw%z-^_cnHaWmQI1<%!6QQYab&()KpqKyF zhU02zBbqf=Bfq}JF)efwh&Fs3MWtf2o9d?(Nsy3cUq&+peBLGQYIh?!YIDC;ykP)6 zz8lG28mZd?!~458jDR^`B7Q8r^xO8=`^oFpgVycQ?a}9-yV=1leOLMRFTnmyS;yD= z&17vw)#VO*#og5n@b+S#@u%tI!fm+r3hWSdvfEAVFMH3Q(Ak~y!_~o)LAz*MqK}VM zeK)&~>Sor>_=cqo^TL=+9A7()YdDkh0rU>K?~mE-*sF6&-)wfZkB;-lj@TDD-su4Gs3) z9RNNc4HF@rJdGYa%yvHCR@H!+2BB<6zxt>Uj?R!$#3apBx}NeX6G${|q>4YCEZGma zk^=QsO#l!zUJ8u@JwV4HB8kr)uN9yqTCO_#$kWb4ihnJ5zonjqiOxu_3Q;Q+f*v+6vy1PI zq!3byn!Zzz9wAN29hLqsXU_L;CohNI=i@WjEnc;Xwm97U!1I`uzg#7L!oVI}LYp;p z0ykdp%jVK{cXDqZKo|W9*EM_u>wJ}}O>EQsZ98dhG{3j4^zvE?_G9=e0pN$-kI4HB z<+DanqrdjzS;l9>CzOQpHkLtg5{2iToy2E(C*4v|ui}@0bz3q}xI0;L{1z;dlU#La*t8wv1+)OjnO zWV@OD7(K1j$B$=NVbCc|4XWXCqz!Eh*qklA1>+2?Zw3x zt0zGqEbIo5>-P1io9!TB;Yc+?Hy2}^ph!~gvKl-!vXOvs9n%VhP#+RC9s%cf=A1Ah2}R* zZD4~Ta z4q&u#vY=B0?2zmQ2t^&8epcD;(kK;TnlPA_fg3?@M$Km4aZP_6bD*)bf?Lvcgz%UE zwp6jXr>LiDGGRK;nbh}rLT^C#@#p5#^>!FZDdc1F>NbQj#>@#bFO)Lg4>QHmvZ&5y z=Qy;a`#JwH@vVVU0j+XHiXE119!K_!vO-_^qBub{^7usUAcIAR z+rSG1L68cONy|<{em`MDM(s1D+7B`T@VraXejRl7#i<;dqFgfME7EbQ%dhGB2P;6L z;hdA4cNQ@b*3hG@3>ff|CZKrlvy>UL9BU=>qc$3ZFcgXyN>L3-3b;dH6BDCJ_8IuX zp@0!gU9;PmFNSDhj+;V1^xC-&>A2^$le{#6>u_4C&sZQbXcYgUNZcw1aa)EExOe*+^{+Wbq+# zSR#j=Zi&%?*kWhY&tAFlUFxOoGSO$H?;3b~*cX$`gJgtl`y+Ql--gq|m4C(54{3f~6e|vla?8epSAy#%VBs zGEDB|{Sx(XKjxrdMNWPSV-zkq$MEuqYYe!=A)yu^xj|W)44qSJ9~hG;{4U4h&FY zmcab@vK#s_D@Ba_VTEv|qD3u)1V-SFn>fT_Bpc_8?CAs;>5?(}UXl-Rv^bhveG$KP zJ9O|<^bzrg{%d@`vutd35mS2`SPoW)qvpKuztre#p!^!X=X6bKs@Mf? zJlGpMLfL6q;QPgr0bZyCIPO>qI*t&_1Gg}7etg?*QK6DSv+~q?xk*%oZn1{MaMHq- z!XR3_T+eA(kB6J4}UkgM2Fw)sg%B24exDHBn;~XG!w2g(-=8#co5%! zQZ3!4-DdqNI-h9iK%nKT$i?4OaFqKqCi})}5~@K&6;Tzb?qORIuy~PbAcmjoLCjsz&te{S0vq5P zXViZ5)OU>wv>k_+4TP!iXp^ZGS%@u#O>Ic}3C!AzC!D3J_}a0%%G$Eqp3-mS)aP^r z=^557#bu?bLxdP`L78)C%IK|bj8SV-ts{q*g2#^l==A>Cc_|N@DJJDCPOzHo8NDW5!;o6FEqvFw7&q6dV@c(gp2* zFh}SCZBi9hajGX(8#FrpPn-2zQ~E~E-!wB(U(t1(l-Ajeoi>3wbC=sxZT=3GyN*uB zO5xsyR)Dz>^*rR}gRaFvt3NArLk<7pO!G5$q>T|?3dqA#ru2eoHIG@!X5~X1nP07K zfKFFQ)B>EnYK$t{qX#x_Bk81-+JRRyoSTOLM4pzdij*hUKD83eWr-IDu0P4A1TnoJ1=9IJboRiJ2Tcp zx?YANYwWQhL&)eJgf%mjqgS|;asHJEHCuvz$+cdbe+vC&lS^8YbZ6>y4J{N>M0-vF zaR%aqDF}YQ-6=4@88=-$$NfpQuEbqDiuP6*a|1Fv6gc#4H4W+}ylsv!V!B9o7W?AI zMObK;6H};q@e|8rbq5{vg}45-!@5=Z_8Byj&(P(yU4m9{jh)Xme1i$!OKm}{lSRH= z`84d1h)-m7W5?D_C&F}P4IFb-H}_Ek_@)i%+Mov(*Ts%wVUpCiv6qqHkiEa^cq@V# zS|@jkfLh5LMIiG*7->$>vmdh_;=>m z((IxiUjEMg&X5n6kM2gxHhx0X`oUJgviOd%)Cv^;^sJEp-gFZt%Ivy$+&rZL3hcE? ze6vQ}8swJgh&axr|8m8RwsEvH4{*VbKJ9aHq9V=qD+RbC#-I){AqV3%FOHKJKPSIz zZ)e^GdR*tzK3PgScfN$GMp5(FnLAO2r$m$O7Jy^L-PH$FoG+IvY|+((LTkal!#?A@gm>glS{t3T*PX(3gra)bxsWnZ7`dQ#C?^)nV_%0^tPgv-H|9Bf9Zm^ey*}LRh zfE8u`WSLP$1_Pc@DW22&Io3Plq;h4Zi1);wo(5~j$SP&t^#Ey%cZ&n}Y9_izJABoqd}2IUz9jK$kpT5vjps0$fl z`SQob^J2GI+am&4w&YqeunX6iuW^*f4Sb1wT6lR1h^p)pJIOnr)8uir3R#mGvKE82 zMJ^SJ&k1{j@{M8Speew~j+5-cp-Pw)2DNczF%&tcuK4i%sbR1I+@AM&?eAr{yZsng ziF&tbUQx^oGuPjQEMUi~?VZ_$34;4JarEY-cEsg$5?FpRB7NIDob7AC2f8Ih@f zt2%kNC%;J3~`4P_@K?8-55cj03g{5V+w#a?N@Yw3qYxl?Jdwj6;J zlN5I2A%PQ~#DrryUM=WDcBR40Dyjxnc;DW^+NpGN(~Ou$Y~p_dL6jIY+Gt+su{MUZ zjo2DQ<>Y)>lEVhd=g?tM9DX$vzn4$Wk}-|3yC*#XnLmj05|M4O1N_ISpW!D=MJ5^~ zDJ}^HGw#X&$230A);82;tsaVeLGnG3P`ox#Yos(=bllSc^}Nhy!IS0|`kM{6rUc*p z8yPa?vV#XTxSoh?Q<){-(5W=>_S4lL!iWkj50Er&)rLE(gxDfDzR74Ly~0o zFHLCKmoN7EkLSMkWphihGNT&!LgFet8_k7CC*tYwG`RqU>u=kYv+DuR%rFUBY=h`0 z0#}p(EBkEve~eboqK$+rW|@Q+lX<==d@GcjbV1D9W|b1tMI0v08Sc%vO)fnXQ7vCy z1ENyK*JOM?WCQew-1U4w-DQcSVbe;72IG2HG`&@1)cA5O?~h+MEB#naE2&9_o^pCb zuu*Sbuu*)a^Bk$nQq_o{dTtZ(}&K|+oOGEOX^_$|eOv)HsO3@w-`qv&yYJ@QI|913q8_8&lX z6`|hCvom%}@4n)2`A+3L2+beLJU2E-k20<@`E9I_(0tXPVUM8^ltp;)y{tTXue1qA z6Pxgt)3(L=iaYtqFyX!z0MJ6n*UK8hB@3C`WXa4+&F(n!#54mq~!Pu zimZjd2l1ISr|A8hg$uZ%`bR&s=M5lN(zbjI=N)U_EM37ck!bSQWHNT#Ufh3>;{qrpC8myNlho9yNk>@6Fg%G5p$vb(6F5FoK2UfP!} zi`!5eG1C0=hG9MyDjC}dUS;Jlh|e3qBfq!8T4xJ?ZJmGTb-QR!OHjZTm(#N%78#lf zD^;U=NDV8lP}yAW3eu`UvbhsUy*?JyJEiaI@J%H&KTrZgL06eJReMg~PWaT=zHi&C z4u3E*de92?prAAmJ3PAm1M+OxP@9;CMF7hFr?D673AB&*<`3!Zy&3V$z5XWj z{i;RV2J8;}^t$zalA?d(65$fQwlr=%i-75dPKG`vu$p)tw!7tL$uWk8_FngNoqc2P ztniEk#R=bkc|BaTN-YZ>V=VOCAZ{6Sb4;*YWnug3e<_L2;BUvb>p?S zIqg>qTU0Nvu^xL~SFiY9;yiR?4ovLV0IODa05JPJJFIxPE6OFs1sYK}htW6JZc-jp zS6n9)w!=3F{9k@PC zR4LtGb^%wuctaoM(^+M}2qzvz-cR-^Zt`|~U;UzI=2k53&A z*Xyg-*%Q0YzMxiJ>3N@TK=TLjl+j1(^}~%&MKm5r?|%6g!5v!1pgBc3#so9=HTDG=cHlE4N z)D-T!uD)0b{!NgxT$=pA(G#R9U!Y}7XDO|qe|b%@yhFC>(s?u}pu~XB3CsJ6f%8#L zj6f~vproNYQ8A0!Z6boThSjLoMG7K@atR*79aZ@g#kztj2R0aVi%6O*FqzB{-ChAs z2E$uHOTjS&YVOsEw~^{lgo%M{T?xDgh0NI0)~FQ52_5gJpi%T6pXW4)_HZ2BI>h8E z{M&e(j1G_ea7X|NU}4tYzZD$Mj8S=>-u zm`S4EfB1S7ArmZNP%w@l3R6-`0+m|+omDtZEvi@<;b_{r*tOXPCP990>wt_E1+wH~EwFrYS}F>~b<0 zbq*cu=(J+=G6KYVm9Zx?5<4cE`M$PnoCOs*ja3;I8rmrnG(E*w(0Doh5IDGE5U9Ul zoY@E-x%+oo3np4qn!#0C--CQw%Rd+8gpjifn)4K+fP!F*&xHF^B}9vFjPa9>xy?Rfq}R+K@{25D8~^c z81`Lvf1LMN^w_RpLi%S-u4g87w}j@WFi{`w-m5h*+FET7Gm}ME>hiT97o>=M&0HRO z22Ux6cn*37X_tE7r1_QxGM3g^fT7v{ghWxReMbO*uJb-%n!px;5*Jx{nmh!r9(H5| zQY4=~#j<{>qdsZ5C(-6aslw6bij;L?M43?zC-K=!F-ckpOlCtTu$%(hae|O`A*a4z zv)RmXnd;*Kx+G$sk9RX-s>&#PUam3sPp5_k(2ge_XPBaCokRq8W>avDSSiYm#lRCectt8BK zlRSQNYh)$wWuXE)f;{x}abT^tE@GuypJk~FwSWos3l05-vz|~05AWiYpXFpA%Proa zbjAIs43;HP2|3mp`YYadfyn=y$suoAcJ~mVu(4N>rkRKJ^6voAs&-Vag8kXj65XU0 z_!txGHl^y9=H+Qc2_>2-m7RMKSE+gCEFp2M#old1ynIubmIX5>gl$ZOuEOw~208_X zvugx2HYiMM)023X4gFjoKofh-;%O^Qv-~9Fb!;mY7+66ZlT5lAZDMDIO=I68k_7>z z5WpfqH^F>8Y6Xlsn|>?4J4wXFY2yd8rWGKO2)pK&vOb`z_?>LchT?de=I9p5g_kQ0 zH42Ny5a6e?;>Sq7|9nORzsBPRKjjjUP1GyreKvLrHQaC22NVv33 z*dXw8)87Jj16@dxkd4K2iL^bAYbG9L8JTA%q|uLYh8=tZIs+)_DZ>A0+OO6-_VKe5 z3r9u%S6v>s|C0i*h%68qP;}OoYWitv`9iN3n(r`mFJEyt`s>q^tLltEps54U+p{Y* z?{ppP#LM5`_|9v?$J^bzVwB8KTS-w}x&L4xi}otKD1UXb?eOBH z8@LDN$PsT~jfZAjOk!#Wbqr~`&XV>O<*f7?9p_TX;(M4#jy=N@w4Mu3p~loU!nug6 z_uy|OQ%2q_QU-iM_iFa2k$bU>XOq@7`UR&8Ds;{HsAkT+ewjs8s>jHNI+ zfjFE@XSG4iee{IA(wV5`g&1?G6+`Of3nTH&BH=ms1TI0Cv!~^g(?aNAe8RXtHUq2< zy?}|iBysevu)ANu8jS~h?MG#%FL6dx^dEyMq&J+R4hQNHh5J>*NQ=rbhoY;gEPYjA z0+kfo3s6}OkCXp`(?zNouIHP>Mxc}qowy%Sp(jn-QBNxAmQvx0#4DjrgpHQc?M7HK zE3ZgsMd3SA{;kS&DXuyLM>{{2j$Y;N5Pm+I2vXi$Pi$=b&-Z}!M4mtY=lL&R4!y}! zSfI;rkqa|#ZnprhVZ%Fx-PgtS;yw|62ndjbSSks=q=EnaUFKh8Eq$zi zd=4jMtwH3x91_oPe`(}uBD{NZP~=l0_^O-atvOm>iDhNK$@Jqp!z=woU`o5Pr#BTM zpNR~W2}(d6H5(y>k*7}!LZ^8EwTbK^eqf?k;GP}e!tr(UUFNp+kV}xDhVr&G((k35 zUqL7KwzWBR@8dBtZzc-XpR(= zB-zcrURUM*9~BM`I-%mgV?)da{mFvr#3v`KT~U?UM2Q+`=Y(+*?2K535^fF9L)?OD z*J)P$>ghh4g0dUuGk$yA+Z@(?oxFiS;=sx%{7aMUcKCqrddEC^@hI5(inDbJkr zj<3$-3#*MSFo0hAKg%#0^0&+kA))(Hg44pod~!KP^(b zI$Nc^&0Oh<&rW_);m?O~na?e2BGT5d*=Z%^Jy})YGmxLM+y%UCSiziWu;m2w^V#~r z#zQf}VwbtdpB(%O5+ID;_Vb5?pR()`?(;)lf79H5A9&Nu|HDIM1;_>i`=E4J&n>Nv z?Guc+3a>{0as8Y?L z2<=F6X*JK_Y~81{ZIpJIQ$s3szV1`j40{;zP-dOc7|bfvj* znm71oiX>NkbGfv!p?V=oIq||!-;7x&znoG!;pqn2C?SA*9DSFajQ>aP zAVjd32VoAQYGAt$tYP1!BG`nXw|`cT7BBW*M9-A@1Z1RK;~RY^9CR(|?iC&nS_P>X;EcQ;g7^8G~;SMbd5hVPF!07DKpd4IkvF=uk&JAD<6r}!p zE=yeDdsa{iL8k=bgopB`m4i{IrIXhQ#Pi4y4r4Yo0(33YjlN=yQ-b5D`@MNQ&bZQ% zmJc!U4w40pOQ%W>Fh?6argjUl$tG@#Pr-@K;4g{_o1%PiQ_>c5FlO+7dw1HKas~V% zI55FqfaKyX)BMtWVygQ{#~kqyVYP`Hf@8HAHySJUxrEpJ;Yp(%S2lNLlo_y-PRW|- zW`uHK1q8aKgvxUPiawL4w~7UiStAcxTlUJL)(gH>Mo!*u4n~6}gkLV}-)pTWU`^b> zfE=Hb~W^)kc3P6N$qE(0RCr*L+5b&K6vFN2xq%_mJdCS`x#q_ ziu?q-LXNq_-1b1t>QisWe3dXvE z0WeMF0h`{BJS0K(@5P>YM0S}=fiO?ZJ7i3u-jJK;hIqyC&!3;r)1Ri;iP>&55u#*3 z>md7J|IhkLMDsHDgSf5JFt_9}dG6Ue*6skb^X^ORWq-YIUgm}UTbv$+$SpEqjxHh+ zVB5!I@e5^WnmNB|#nL*yJ?EoOSfFLhyEYg)gIafk*l>vlWyt?!3es@#fAdO1dF)<+ zELLiyV!o3t@D9Rz#~oUWDkPg+JwQ>~DI3th zqCg^tX|crn|Ky|#xuH$GS6^q*Rg>;qS)X_0Oz!^c3q}7Pl;fB1LNC{R*n#2;iBTPs z!13QJNnLW%9`psYNJClO?`u9=Uqs|(Y@x6ww#H7*jwXgS|1+}tX9=75MGXta#KzhP zOJj@(Al9zb@20%D%I_L|*FwS3B3I)K7stmn?k=2`RvGi`jT&wjb~ZA31!`MZ>~H4P1>xO4K3dx7~G{pD=ZGrRWKS?W+OkHyzs ze2y-3^0*SpFB)r16B_o1$UbjMu9-NO?AK}nps8xvGP;Ly^TDCE2}XleUKo$HjQBT8 z=xs)a?ZG~cONY*O#?a-iOqUyLR3!8pfn7*Zia%A}IaWF2o=yBqH3GI+Z;MG!u3OK= zfI<-jJ8k9!derf5I91xPn-#38Y|4IQqg2$-#6Q0$q1nHXe$ts#MLA>P)-*!T4_~AK zN=7V$2h0OcE5@utVXZQ8ZW#Yg-*0ftgrvFla@JL(Y8;yqlh6^Co9%aT)aABqUx}XrGaBo{|y0WSSF!GT<#sQcT%jX&8RIP7E^BP&9|_W1A^ z6w*iPGfzC_AKZVq6@TDPL|NPc$Q4LUB(frNF-!H;7sgmxIJ>#E$%Nr3u zTuEvP@g&tDds!r2f-m8U*#)3$8&)@yOm9MyVx*|h$|j61MF(nILCIWx3KEp)P%z&c{>O@l2gpc>*70oZ^7J>?pSAZ$>sQg3Wh-aYMkOB#{+R~yjM>H z1t-Vvf@_S?Vt@gRGB3quxFQFZ~p+5^y!;}a&2*q$*xWpsr{OW3`7WDI`-UO`X=>`;)<-ubbIoUTV z)=6yJ>#mSU;%&wQ6E)5&u!SjA&F-ucEDH@#3=^o3`Vs@|p!v#@i{?zCi{^E#8RCJI z9eG|Q8KyrFaqoWlFaIfW=KtUtfD%yrrvn62KJf+n+Q=2|+wVY!Sm0l_M~<1$WBCQW zf}74*3WpKJ3RW^knejk{w=8XzU1hb_vkE~+ww1R!{NH&<@a897(HqKkMlZaEf}37= zN2DJ85I8?q%J4~5=76)wehBi zjd#ZIpa2f4(oZFpDN#pVMzv~%9=UOCBZ~@cRe9y*0>>nl< zO3CpZ{geeAJY)sgV}w+g;6S54bGR7*%m_X@CCaKNtIxxbBK}1AHe=i=U^)__P)Bm6@%o>{gwLT2xlD_7*FU?6xv|ki z)E^rf6_*Nn5!bknRgd52_C&ntNYpIAEV*uw9Hw zaV;+NBN#wJEaUH;97I^WV7m}ROw^D2D`r&`>1EpskF0v930Cs!wCx0-ZFJ8ns5TZt}fa zQbW+m>w3yo5%HdZR9NIGJNI~2&S8}t{O>C~m79YB$hd9-HtpT6Vh&Vtio3`#_}@K< zn^y58`jZB2GWtgYY*kk2Nq9BOKGw3(YH9>(YP?y$dy|ouGtsM_rWY~+c$$?mK|Q~H zjr-Y8AZTad0ylUYyl)nyCm+|0Slw zm%uD%hnU{SVW>Fj-v&?ua#CRf$Y0>L@SeVBHwkaKDdA!mWr$pnMzWX`<5f%TC><)u z#KOq@rPnW@A}C-qB^}0J86AD_|tb^at1@vc_VT+T63_IBJ{ZfR2hQMK_|G9W`JO~1ibci*(D4!Fl&J#NrQ1_T_;=v>`VPeYQ(lLi5vLVyV^nI^sBab&a0`Ne;KCUBQCWh5=2-#%b-Bm*wfi4iDvQsaex!JXeZv z{HhlZt*9ZxDV;r36mlho+Nj3kT2(zZsg8p7c?`Mm8v7Y1b2WSZazSYqtB22zBedxt zL=={PYFHiLqLVIqAZ^$7pq9`DHpyT{2s1%|7-=aAXH|KY{6fbh9QeKC#5TN^15wNy(ezNjUIX8LAtGa_?>)kZWYFFze=- zKR3;e@e`n`@ybbj$c8!gq<{K?h!ircciQAV8};y!z5>7bVOclZpP`U++sB z`j0w8#AU>p^yT+dZB(0;x+l-nwt=crWeJMih*g$_Jd5JHDQ@Bd9Jy{kP?1rC@rmo! zgdiM^uht2O0M9`m0g@tMctTtXWix3J5UkM-GP~pCPtkI(kQ878-v`>lBY{U)TkqZZ z@ir@@>765^2#^@F6WWA{ZjrNra)*lwA(80tI2Iw~jW2$pN$H-`Rp;Q%6$26dWVaIr zWrp=zT#Ma~csZmx52uWIhqDI>3JPDXuYUV}<5sH>kRkDU(w#w*?hx0qh^yT+OQ_je<>XGS(opsz1Oqv{VGxSXSGeCe!qkce;}O_j`XX7! zIs9NB1wt2aXYS$PH=bSy&DGzoTtcKrJ^I4U^)!NhRg=d`X_cn2=kV#;15)p7Ky$li z(kQb7$djec1v|urQRUi@u26kKgF38@q9 zlXNp(ch(_1i4Hh7wFcp;DM|5dwLx*^6L-(m`4jX@m_9deM>(Z!R&cmzWa$}GtU?=6 zhZBe?z;69`S8pQom&iX5Vpuy59ZU9Zp0-a2@TAOcQ~vqmMxD(wIm={g#$x7CNh-bU zk3P^JWjM;zra9l!#kD2e%$F`_a+%@K#!PExB*i}{V9&?;gp*ZvATDc1Y{a*A_Ho7* zh0q<-wp}yY#{#x^WO>KdTFyX;wZFRp)S}flJEg9D?7N3kp`>(AV4KcZmG}n{$Jq`F zh@m?$X5`}Bn{s*=B#|JsKc%mgpRg2|m4t=ID?x^|!@BFrwpQyn2;{vB&y5rF)W;PK7*40O!|>LlR;_qHf4n~{PEJYD%_unSs2VKI zplE=Tp#mdEuX*t+6~?HdO^?rMLj})uOqQ9HBw)7J33QK%`PETsnU!kv%*j&+r;4cF*Qw%+<(Xu)WbTnaTVYK>tTEN-b3sz^txt z8_`VEl?*ajOlljYnUJ!TE<@cioY);f{vhNO2z;kR z)Nn-XIPOjiOf(yQ%+}yeT>!-bjFYpvsC%63pU}vsaqwq)NkxpNXp`f|V}2J{pZcwc zI!(VCS%oZTvQ3gYIPWhXrGo~Sqzs+eDbuQ5^u_1k%LEub9WSqVRPQJ!bDLSeHO|x< zakou^x^Zt&C00|M7m0ak`5UFc@BtnN))6fg2+V%N}9-%vEM|SX)$)@V~7km(j`@u z@^Q>&UcUV7guN{POlfw4bT@+fIbs9)3Q(cJ#mI<-!GS2C;G*D1#J_8kL;boy!+DQP zP(_=pt*RT;bj0Ywn$>jqE2=syzqBe>v@5TaFFI;mHhs5k-8L&OG+H-TuU(U)cH0wC z%D4G@7!4Dg%&xPXuDO1kt^uGR!eLpw(wf4K4}&C-1-Tz~yp1ri6&oWl#n*u6+uZ{1 zNaR@z7tF+U7Dm!2WJcDU$eKa4#MCjufjfEp*)pq!TC&~@c9>B!`%f1mnP`jKJ$oYJ zib77`w(+KhWU_c+;jTf4DqD6oE#FSynF0O@3JC%+-3z2OF{&^b4;iFz-|XA89)-+4 z9M>Q(S#kqvjA5Gq+VM@eXg2`7d1@%|H1R$WCa3Kp?)^^szU@=0L{rWHt9ztaCPvAs zO*o`0;t+<@G&~9!DO%WQ=unN_=y904WN@CG%ax}wrZc8w9NKp+D19i8iAp@=jExrn z%~oV@GL(rNO`?od_LM5choK!TWD>?Mj@PZKmjnCU{_0_ccyx^5@&*_~Fp;S`p*KDL z>^OP@0s;126U8szbjFy1V#_xKN=pfhHTDThvF-wrVhD0(9&O< zAf(+r@y7a0PG)K-`O5@!jQpo;{B2>ManTvBy;=-V97Y0{^TpioMHO>cA+nj(hft9F2T0%f?Sjj*knp{oRXE#gJq1s>9BA+P zV3TMEzIyCLkVotCBax{hsAG6OBQRzqY&47zp-|?4g8cl#Jsx`ZlAAw%7Co$irEiXB z$mkcW5Z)y?MgVVb5N{tvmEmoL^+;Xnba~T43Ie%UM7|MgoWd-{IkCunb#Ql_!omWk z8D)$bzrRKCCnrERcm`@SUU_UI9`;L)BQ*{6+{&sw$}1{*LQfwD7(v;`8E%{3=;*v) za2N|oY!3%;gz0Q969>a)_!I0@G?%sU!z=uF7K*7`@pBu zk3jMAd_6uLviQ@ptk-jt@LZdMYu>Eau}}x!2y}bFY}7~)FUgbBE%2kP))rE-`r~fN z%Ldyt*anz|&EXoRWT8nD__%DeP-BV}z{A{tbPWHDmtw&hGhqi7e+@D2CSr`fq=(6X*#vmL)xI&dJT(xdYINb)g9#zHUIa%@ z%ZXOyT0V*hT|jMRy%poQl0YVbViyKm9}cvi*VN2xjM^H?-f!%b8lgwr<8?4=%F=|?R&Bou;*qxmM%;O3O)6uo~xG{LztArdH zK#cs|Pi;$RgU60=U^S}nnwu(XCnoOy4u*)9sFd4t2u%tK5fb(`x`Y2QFH9$>n+@-Lstp3ijnyZi z`Pc5e@gOAhfl_UwZD2&-SLR2T#^HAL-L;iZ+4UE`*ra9mcSD=A#O3?jLw>^nO``jW z`|PagwD{Z0l-SV5w(X9{sSMf~;vRr_xNCQDl6NiNRBc*HY8)|(8Jv-KuGF1e_DXr+ za&LI+lz`(qsp`|ehTK@i6QmJS){QQLvb<451%(o4$_a=ba*CeikNAn zW-UDj#+d`|uWlW@WR9-B-i~j9Hw+VLEIB18dMcsYrSk+Z*$&Q2*VcS2To@4OYn^M9 z-Aul0VDpwZm#h3Yhj0lG3?fbTW3bqjf_J3M*Xj9SIGkQU+eITS@{W91D(8WghSb89 zNW7Opiec^xiir@GBfr;Ox*7jjB?H>*s@_50c5SKo`uX``Q{YJd`-zxpf@tmOx*6NWFI-<3a<{_{+e^9O+Y$NNtg(x6HmTc~UDOlK=uDLK}-@xh61tN4}mGA^RV zH0OoT{_#}k(c?bW>%-DOzP<>}5COmUC}gaw@0-cVU?orQ>-kA63(+kYDQRtPpl4l{ z0F>Ql$nJFS;t%|zU8q*x#ZBP1S=MLp7vx*y(767e9MZul?jxq$%RGRU{9dm=#XU~C z-(Owwp;QJm8VZGF2~pQ~^G^z&l7_0kysQ%8sDELqHy z3%94@Zuj9@Q4Q)5gmj>Pv*mA`(^O8I&8NE-6=fN$?%ZBsEcF6h0bbh@ z&jx!aKtO|Ht--Iut#V97hEl66YA*(uWmuM(l` zxSqP&OZODO{;P~hG1T*Jn}^}|1>^nC=~ZxbrlIt%`Zsxq+Yn?2EeP%E{hj}QgEG}6 z{aSNmFJPv3bGJ6Qafw3NvIT~A7~*SH)E|-+0=LED5m)7?ZD`9L-*6(eQOs&3DkqOX zZLd(1Xi*9}{7ZmEdGJ;Ft^Bb`+pX8smqrc9-MegqbA+s{n-A;2S%V=db{_b(JBI(p zD?y!$&HFHd!f!65WuoC4!fe9HO1L?A>_$Vv4bWgk+EvOOn^3B9;%ihfuqj&%fd|lnX_6*@SD^&Y@rmXjga}&B{+8n8dB}-R(Atdm@s5FXEP;evZ6g0Rv^}=HjW<;gpee&?w%PGOo?2LLQDW5{F zMlG*Uy2PF8chjixORlVejrzOE56;ql1vt1J2p(Jdz&ePez4FNTiC}S(Udv6Qd3%b@ z0JQ%YUwO{+zURE>J?H$M{FU0%fhUGPzO+%@ zOs}>pGES{gly(^X@TCSM=_S97xAU3x_`&!$!xihyTeExEfd=E7`0E#ARP`it!{SE3 z;@6OBHpX!olkCwbSUU9Px_6rbWqL*Zh0k12*SWDg-&9SFYJ`WctfI>zq*OD|y6*ny z={-x#7#_pg-0qx!kS_hLbUayZ+)OWf(S3Zg4PiN{2nIC-ESEQ6U_ye=cwU>$V|vLB z-R`Kw`&7fj#Z7sSx3_KystVJDUUj`oicC;-pUykhpHTT+*W3D2JF%&z(I|DnpKuRD z&3#i=E}Wg;jQ~&C8Q*PulxMQl_W8M$tEeP;H^r`**s7=o`(0u}$6Fj^%vZ8_KiAPb zv)U)b7i#PxB)rR<+QMuSq{Pz&y2hDjE?n9FG~6p$H2AK0VWydLPq`WP=}~JrSIVQT z)wfq~fX@WmkJe5wqw6eeR;im$dEc$Cw;F9sbYD_vvO{jfBl`l%uCQHZ21E1xn&`|7 z<9Ji2M+aQvBI_$tPK_^#Jge69p7WP@KH9SbC!5x}CJ4_mC4$+(zn7SQrmc1xYL8hq zQE5-osg2NdiqiF(_Ol|4r%Y&KF@bLXKWICxo<_N-c@JHb7pgA<~Fgr z@;Pvy&>5t_*I|qlAOlj;t{>YI<5fwYb@@rcWZvPKL{)1jOa{fGG-7j>=8siHP5J5$ zo8b0bD!o=7_QJBWFk5>n!n@?!vfD9_l=xzomB$5cIzp;MkG<;G*Bkp%?JI7$vX!MH zSszE}Dcy4Yp>y#kC{c;W1>bkx%kLJ)uC#=Xgl$Kny+R7!&JId~pp1skLQ2XsMyCT= z=xn-fGE~02)<-N%)$m^@=u;%dR)9s zh#&Jh$XRYYxTBU*$FY-+XF$n${e-9WrFrT0gtY8pUX+_F}3G{{M= zB@K}&=e^&taNzfio$LXav=h*gw&$4%pi$)I-A9=QcQY?Pw+eefvlsQ$Hsw>iWq03M ze*BM&_YqZ552KIU6_6!$5wEO64n;`EmRa175ji2#t6laQ8qSti`GX@fcWLL(zoKi9 zRn*1y6iYbk#>}lg48&;o@HlE!Z(LRf1&5HsqhsRCN^i-wiXj@qdq2S>KV;W7#JvcmW3m{&d{(&Q+Q%&5hdNPuO;_U(&YYn zPch?96Xf>f2>kSwd6m-sl8~j5U;0;ah$_k*>pRwK*J^i9F2~r_tP9h8rxk|ekuIc| zDa_pMrNdgh4SK(~n}4hQ>7b~tPI=;}un&FJJNbEIcFc)s#S4@yN1;pdVssICf1ai@ zH0c}CBZVVLFSE8jlpeVs_WhicW0rq~)63*Og~BY0J-SC=DT!Oi9bV&TpO^}ZL3*eg zv)pXMNGEQedCgJ`zq)brg=X3)|AZrA!qDzfQdXurSQsput((Jt=(%U6lID2HdO@QH zQ>b#Yi+lYgoFpd;YCc1C{_3TQtLJN`9-g<~Rlo4M!m`}M#PQeoEHQ}}iKB$oTJr#* z8XLMKqjnKnVI@t7JlBx&LCMq0R&s?@#!zdnlJ7JSQH1UoH*arNyVLQjU6(rI@?g<& zA_qvuST4s+GfSdJ=e=29ioOJ{v282Q-LW;WB|mYy0#AR+;hW?;!1-}Bo#1Ky;;8z8 zw2mJxT$Bzl3b{%dr-Yr0-TJxXtl7mP#->^9*(5E?SUBURh}k{iGgiti<|Es6wa@B^ z<6fRTYaH8Zue~MzJ&Yin1@LzAQ8RBA-8T6EADG}6rU0ulIi3w)5 z!F{g!lCO!KR)7CaiTivT?8zc;5 z|6bvdD_t4bdT6QtoHnUG+$Z^#Y4j8Aa12?p(8S2-j`YfO&YH#HfG&mCA-r*3I*c?2 zi4>~rsb>uAHDx2M5%RcZ7nxE3C3NQVv?o!>-CuLxex7j}r)!mv)73O3A5WATYD z1!d1jJrHL#knP{lY5WgZ#CKmXvZCU$0_|^0BL$dJV%-?!^z)+aK2g`Q!D^w1Ab!pZU#*c@6oIZ11|zOC@^S zKM?PZ%CuU949SylnsT@2Ux`!Qtuni}+E|fwyj_iNxYCBV$ZiVQN>yQ5K?Mz48HR;F z@euGJi&EIQje#vbxD{ZXE{;;(h9faX`;8BRFi{5k=SRjvhX1cGcnE|@TrtkS7(oo% zfz)kyfU!Ps1c7i|04xDZ08udf$%tVJ_7dt zaA8jWe~s#&nQ?lR9!3Cq2#0FeZu1d_0LZZ3$$p_UMU zVVH<;*$;5?p~S!>R6>BWTinaVSuH$D3=E;J1b~UaR~+*7Rsj+o=AIqLeF8d00#H_y zU?O+N0E`2<-2$-y$hBJt$9@8ldxJrMfa(Oq;!$EaTr>_K5V+461YnT65s+g7Rz~^T z?FWej)SNg#2xiC*h$39tu^@?rIx0M#^Ner}6_1Bdhs(j?x&6U&9!Kus<00bLHx&Bk gRv-}lEOCw=;x5d=0gNQJE Date: Mon, 30 Nov 2020 19:20:30 -0500 Subject: [PATCH 086/143] =?UTF-8?q?reporte=20de=20error=20en=20dependencia?= =?UTF-8?q?s=20c=C3=ADclicas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cool/__init__.py | 1 + cool/__main__.py | 17 +++++++++-------- cool/semantics/__init__.py | 1 + cool/semantics/overridden.py | 14 ++++++++++---- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/cool/__init__.py b/cool/__init__.py index e69de29bb..d9540601e 100644 --- a/cool/__init__.py +++ b/cool/__init__.py @@ -0,0 +1 @@ +from .__main__ import check_semantics, CoolLexer, CoolParser diff --git a/cool/__main__.py b/cool/__main__.py index 04f532819..44c826ccf 100644 --- a/cool/__main__.py +++ b/cool/__main__.py @@ -1,13 +1,12 @@ import os import sys - -sys.path.append(os.getcwd()) - from pathlib import Path from typing import List import typer +sys.path.append(os.getcwd()) + from cool.grammar import serialize_parser_and_lexer from cool.lexertab import CoolLexer from cool.parsertab import CoolParser @@ -26,9 +25,10 @@ def check_semantics(ast, scope: Scope, context: Context, errors: List[str]): declarations = ast.declarations topological_ordering(ast, context, errors) ast.declarations = declarations - OverriddenMethodChecker(context, errors).visit(ast) - InferenceChecker(context, errors).visit(ast, scope) - TypeChecker(context, errors).visit(ast, scope) + if not errors: + OverriddenMethodChecker(context, errors).visit(ast) + InferenceChecker(context, errors).visit(ast, scope) + TypeChecker(context, errors).visit(ast, scope) return ast, scope, context, errors @@ -70,7 +70,7 @@ def infer(file: str, verbose: bool = False): ast, _ = parse(file, verbose) if ast is not None: - ast, scope, context, errors = check_semantics(ast, Scope(), Context(), []) + ast, _, _, errors = check_semantics(ast, Scope(), Context(), []) if errors: for e in errors: typer.echo(e, err=True) @@ -82,7 +82,7 @@ def run(file: str, verbose: bool = False): ast, parser = parse(file, verbose) if ast is not None: - ast, scope, context, errors = check_semantics(ast, Scope(), Context(), []) + ast, _, context, errors = check_semantics(ast, Scope(), Context(), []) if not errors and not parser.contains_errors: try: @@ -122,5 +122,6 @@ def serialize(): os.remove(lexertab) os.remove(parsertab) + if __name__ == '__main__': app() diff --git a/cool/semantics/__init__.py b/cool/semantics/__init__.py index 3f0fff322..62b862921 100644 --- a/cool/semantics/__init__.py +++ b/cool/semantics/__init__.py @@ -2,6 +2,7 @@ classes defined here follows the visitor pattern using the module visitor, with this we can get a more decoupled inspection. """ +from .formatter import CodeBuilder, Formatter from .type_builder import TypeBuilder from .type_collector import TypeCollector from .formatter import Formatter diff --git a/cool/semantics/overridden.py b/cool/semantics/overridden.py index 747862108..4b120b183 100644 --- a/cool/semantics/overridden.py +++ b/cool/semantics/overridden.py @@ -22,7 +22,7 @@ def topological_ordering(program_node: ast.ProgramNode, types = context.types - graph: Dict[str, List[str]] = {name: [] for name in types} + graph: Dict[str, List[str]] = {name: [] for name in types if name not in ('SELF_TYPE', 'AUTO_TYPE')} for name, typex in types.items(): if name in ('Object', 'SELF_TYPE', 'AUTO_TYPE'): @@ -30,19 +30,25 @@ def topological_ordering(program_node: ast.ProgramNode, graph[typex.parent.name].append(name) order = [] - visited = {name: False for name in graph} + visited = set() stack = ['Object'] while stack: current_name = stack.pop() - if visited[current_name]: + if current_name in visited: errors.append(f'DependencyError: Circular class dependency involving class {current_name}.') - visited[current_name] = True + visited.add(current_name) stack += graph[current_name] order.append(current_name) + if len(visited) != len(graph): + types_names = set(x for x in context.types if x not in ('SELF_TYPE', 'AUTO_TYPE')) + exclude_type_names = types_names - visited + errors.append(f'DependencyError: Circular class dependency ' + f'involving class {sorted(exclude_type_names, reverse=True).pop()}.') + declarations = {d.id: d for d in program_node.declarations} program_node.declarations = [declarations[name] for name in order if name not in ('Object', 'Int', 'IO', 'String', 'Bool')] From 014522e6b5906fbd73e7b7fa8f3beb347341d525 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Mon, 30 Nov 2020 19:20:45 -0500 Subject: [PATCH 087/143] =?UTF-8?q?index=20on=20master:=204cadc89=20report?= =?UTF-8?q?e=20de=20error=20en=20dependencias=20c=C3=ADclicas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Informe.md | 10 +++++++++- tests/inference/09_program.cl | 16 ++++++++++++++++ tests/inference/09_result.txt | 19 +++++++++++++++++++ tests/semantic/02_program.cl | 7 +++++++ tests/semantic/02_result.txt | 1 + tests/test_cool.py | 19 ++----------------- 6 files changed, 54 insertions(+), 18 deletions(-) create mode 100644 tests/inference/09_program.cl create mode 100644 tests/inference/09_result.txt create mode 100644 tests/semantic/02_program.cl create mode 100644 tests/semantic/02_result.txt diff --git a/Informe.md b/Informe.md index 7e90e601d..72f92ede9 100644 --- a/Informe.md +++ b/Informe.md @@ -27,7 +27,7 @@ La inferencia de tipos de nuestro proyecto detecta para cada atributo, variable, **Algoritmo :** Durante el recorrido del AST será construido un grafo dirigido cuyos nodos encerrarán el concepto de las expresiones marcadas como `AUTO_TYPE` y las aristas representan las dependencias entre las expresiones de estos nodos para inferir su tipo. Sea `E1` una expresión cuyo tipo estático es marcado como `AUTO_TYPE`, y sea `E2` una expresión a partir de a cual se puede inferir el tipo de estático de `E1` entonces en el grafo existirá la arista ``. Una vez construido el árbol se comenzará una cadena de expansión de tipos estáticos de la forma `E1, E2, ..., En` donde `Ej` se infiere de `Ei` con `1 < j = i + 1 <= n` y `E1` es una expresión con tipo estático definido, al cual llamaremos átomo. Cuando todos los átomos se hayan propagado a través del grafo los nodos que no hayan podido ser resueltos serán marcados como tipos `Object` al ser esta la clase mas general del lenguaje. -**Implementación :** Para eso creamos una estructura llamada `DependencyGraph` donde podemos crear nodos como una estructura llamada `DependencyNode` y arcos entre ellos. La estructura `DependencyGraph` consiste en un `OrderedDict` de nodos contra lista de adyacencia. Esta lista de adyacencia contiene los nodos a los cuales la llave propagar su tipo, estos nodos de la lista tienen un orden y esto es fundamental para el algoritmo de solución de inferencia. Si tenemos un caso `{x: [y, z]}` donde `x`, `y`, `z` son nodos, entonces el algoritmo determinará el tipo de `y` y `z` antes de continuar con todas sus cadenas de expansión, por lo que si `z` forma parte de una cadena de expansión de `y` entonces `y` no propagará su tipo a `z` ya que `x` lo hizo antes (un BFS simple). +**Implementación :** Para eso creamos una estructura llamada `DependencyGraph` donde podemos crear nodos como una estructura llamada `DependencyNode` y arcos entre ellos. La estructura `DependencyGraph` consiste en un `OrderedDict` de nodos contra lista de adyacencia. Esta lista de adyacencia contiene los nodos a los cuales la llave propagar su tipo, estos nodos de la lista tienen un orden y esto es fundamental para el algoritmo de solución de inferencia. Si tenemos un caso `{x: [y, z]}` donde `x`, `y`, `z` son nodos, entonces el algoritmo determinará el tipo de `y` y `z` antes de continuar con todas sus cadenas de expansión, por lo que si `z` forma parte de una cadena de expansión de `y` entonces `y` no propagará su tipo a `z` ya que `x` lo hizo antes (un BFS simple). Una vez tenemos un arbol abarcador del BFS buscamos el próximo nodo con tipo definido que no fue visitado y comenzamos un nuevo BFS desde el #### 1.2 Nodos de Dependencia @@ -276,6 +276,14 @@ class Main inherits IO { - Bloques donde se puede determinar el tipo de la última expresión. +### 2 Proceso de Semantica + +El proceso de semantica está dado de la siguiente forma: + +- Primero realizamos una recoleccion de tipos. +- Luego pasamos a la construccion los metodos y atributos de estos tipos. + + ### 2 CLI-API Para la cómoda utilizacion del intérprete hemos usado el paquete de python `typer` para crear una api-cli bastante sencilla, basta con ejecutar el comando `python cool --help` y obtendrá como salida lo siguiente: diff --git a/tests/inference/09_program.cl b/tests/inference/09_program.cl new file mode 100644 index 000000000..8df56c80c --- /dev/null +++ b/tests/inference/09_program.cl @@ -0,0 +1,16 @@ +class Main { + main (): Object { + 0 + }; +} + +class Point { + x: Int; + y: Int; + + init(x0: AUTO_TYPE, y0: AUTO_TYPE): AUTO_TYPE {{ + x <- x0; + y <- y0; + self; + }}; +} \ No newline at end of file diff --git a/tests/inference/09_result.txt b/tests/inference/09_result.txt new file mode 100644 index 000000000..558906f46 --- /dev/null +++ b/tests/inference/09_result.txt @@ -0,0 +1,19 @@ +class Main { + main (): Object { + 0 + }; +} + +class Point { + x: Int; + + y: Int; + + init (x0: Int, y0: Int): Point { + { + x <- x0; + y <- y0; + self; + } + }; +} \ No newline at end of file diff --git a/tests/semantic/02_program.cl b/tests/semantic/02_program.cl new file mode 100644 index 000000000..5a5a5597b --- /dev/null +++ b/tests/semantic/02_program.cl @@ -0,0 +1,7 @@ +class Main { + +} + +class A inherits C { } +class B inherits A { } +class C inherits B { } \ No newline at end of file diff --git a/tests/semantic/02_result.txt b/tests/semantic/02_result.txt new file mode 100644 index 000000000..a02611c57 --- /dev/null +++ b/tests/semantic/02_result.txt @@ -0,0 +1 @@ +DependencyError: Circular class dependency involving class A. \ No newline at end of file diff --git a/tests/test_cool.py b/tests/test_cool.py index f8671f909..c98a4eefa 100644 --- a/tests/test_cool.py +++ b/tests/test_cool.py @@ -1,11 +1,8 @@ from pathlib import Path from typing import List, Tuple -from cool.lexertab import CoolLexer -from cool.parsertab import CoolParser -from cool.semantics import TypeCollector, TypeBuilder, OverriddenMethodChecker, TypeChecker, topological_ordering -from cool.semantics.formatter import CodeBuilder -from cool.semantics.type_inference import InferenceChecker +from cool import check_semantics, CoolLexer, CoolParser +from cool.semantics import CodeBuilder from cool.semantics.utils.scope import Context, Scope @@ -21,18 +18,6 @@ def parse(tokens): return ast, parser -def check_semantics(ast, scope: Scope, context: Context, errors: List[str]): - TypeCollector(context, errors).visit(ast) - TypeBuilder(context, errors).visit(ast) - declarations = ast.declarations - topological_ordering(ast, context, errors) - ast.declarations = declarations - OverriddenMethodChecker(context, errors).visit(ast) - InferenceChecker(context, errors).visit(ast, scope) - TypeChecker(context, errors).visit(ast, scope) - return ast, scope, context, errors - - def get_programs(folder_name: str) -> Tuple[List[str], List[str]]: programs = [] results = [] From c0c6b8f729f0670c6500cbc11ba171ee5e736d0a Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Mon, 30 Nov 2020 23:28:38 -0500 Subject: [PATCH 088/143] Arreglos en el informe y agrego de errores en ejecucion --- Informe.md | 38 +++++++++++++++++++++------------ Informe.pdf | Bin 57325 -> 60796 bytes cool/__main__.py | 7 ++++-- cool/semantics/__init__.py | 2 +- cool/semantics/execution.py | 5 ++++- cool/semantics/overridden.py | 6 +++--- cool/semantics/utils/errors.py | 1 + 7 files changed, 38 insertions(+), 21 deletions(-) diff --git a/Informe.md b/Informe.md index 72f92ede9..66f9010aa 100644 --- a/Informe.md +++ b/Informe.md @@ -27,7 +27,7 @@ La inferencia de tipos de nuestro proyecto detecta para cada atributo, variable, **Algoritmo :** Durante el recorrido del AST será construido un grafo dirigido cuyos nodos encerrarán el concepto de las expresiones marcadas como `AUTO_TYPE` y las aristas representan las dependencias entre las expresiones de estos nodos para inferir su tipo. Sea `E1` una expresión cuyo tipo estático es marcado como `AUTO_TYPE`, y sea `E2` una expresión a partir de a cual se puede inferir el tipo de estático de `E1` entonces en el grafo existirá la arista ``. Una vez construido el árbol se comenzará una cadena de expansión de tipos estáticos de la forma `E1, E2, ..., En` donde `Ej` se infiere de `Ei` con `1 < j = i + 1 <= n` y `E1` es una expresión con tipo estático definido, al cual llamaremos átomo. Cuando todos los átomos se hayan propagado a través del grafo los nodos que no hayan podido ser resueltos serán marcados como tipos `Object` al ser esta la clase mas general del lenguaje. -**Implementación :** Para eso creamos una estructura llamada `DependencyGraph` donde podemos crear nodos como una estructura llamada `DependencyNode` y arcos entre ellos. La estructura `DependencyGraph` consiste en un `OrderedDict` de nodos contra lista de adyacencia. Esta lista de adyacencia contiene los nodos a los cuales la llave propagar su tipo, estos nodos de la lista tienen un orden y esto es fundamental para el algoritmo de solución de inferencia. Si tenemos un caso `{x: [y, z]}` donde `x`, `y`, `z` son nodos, entonces el algoritmo determinará el tipo de `y` y `z` antes de continuar con todas sus cadenas de expansión, por lo que si `z` forma parte de una cadena de expansión de `y` entonces `y` no propagará su tipo a `z` ya que `x` lo hizo antes (un BFS simple). Una vez tenemos un arbol abarcador del BFS buscamos el próximo nodo con tipo definido que no fue visitado y comenzamos un nuevo BFS desde el +**Implementación :** Para esto creamos una estructura llamada `DependencyGraph` donde podemos crear nodos como una estructura llamada `DependencyNode` y arcos entre ellos. La estructura `DependencyGraph` consiste en un `OrderedDict` de nodos contra lista de adyacencia. Esta lista de adyacencia contiene los nodos a los cuales la llave propagar su tipo, estos nodos de la lista tienen un orden y esto es fundamental para el algoritmo de solución de inferencia. Si tenemos un caso `{x: [y, z]}` donde `x`, `y`, `z` son nodos, entonces el algoritmo determinará el tipo de `y` y `z` antes de continuar con todas sus cadenas de expansión, por lo que si `z` forma parte de una cadena de expansión de `y` entonces `y` no propagará su tipo a `z` ya que `x` lo hizo antes. Como se puede ver el algoritmo es un BFS simple donde en la cola, al inicio, serán incluido los nodos del grafo que tengan su tipo definido, es decir que no sea `AUTO_TYPE`. #### 1.2 Nodos de Dependencia @@ -262,11 +262,11 @@ class Main inherits IO { #### 1.5 Expresiones atómicas -- Valores constantes. +- Valores constantes (ej: 2, "hello", true). -- Operaciones aritméticas. +- Operaciones aritméticas, las cuales influyen en sus operandos que sean `AUTO_TYPE`. -- Operaciones lógicas. +- Operaciones lógicas, las cuales influyen en sus operandos que sean `AUTO_TYPE`. - Llamdos a funciones con valor de retorno conocido. @@ -276,15 +276,29 @@ class Main inherits IO { - Bloques donde se puede determinar el tipo de la última expresión. -### 2 Proceso de Semantica +### 2 Lexing y Parsing -El proceso de semantica está dado de la siguiente forma: +Para el proceso de lexing y parsing usamos el paquete de Python [PyJapt](https://github.com/alejandroklever/PyJapt.git), cuyos autores coinciden con los de este proyecto. + +### 3 Proceso de Semántica + +El proceso de semantica es bastante similar al visto en clases prácticas de la 12 a la 15 con algunas pequeñas modificaciones: + +- Recoleccion de tipos. +- Construccion los métodos y atributos de los tipos. +- Comprobamos que no existan dependencias cíclicas con un ordenamiento topológico de los tipos en su árbol de jerarquía +- Chequeo del la sobreescritura de métodos. +- Inferencia de tipos. +- Chequeo de tipos. +- Ejecución del programa. -- Primero realizamos una recoleccion de tipos. -- Luego pasamos a la construccion los metodos y atributos de estos tipos. +Cada uno de estos procesos hace uso del patrón visitor visto en clases prácticas para recorrer el ast y realizar el analisis de cada uno de los procesos. +#### 3.1 Ejecución de código -### 2 CLI-API +Para la ejecución hemos creado la abstracción de una instancia de un objeto. Con esto conseguimos en todo momento saber sobre que objecto en memoria estamos ejecutando un método y también tenemos acceso a los valores particulares de sus atributos en todo momento del programa. Para guardar el orden de ejcución de las funciones llevaremos una cola donde cada vez que ocurra un llamado a función colocaremos en el tope de la pila la instancia actual en la que estamos y tomará el control de la ejecución la instancia de la cual realizamos el dispatch. Finalmente cuando termine la ejecución de una función retomará el control del programa la instancia en el tope de la pila. El proceso se retira hasta que la pila esta vacía. Para comenzar ejecución de cualquier programa en `COOL` basta con comenzar con la instrucción `(new Main).main()`. + +### 4 CLI-API Para la cómoda utilizacion del intérprete hemos usado el paquete de python `typer` para crear una api-cli bastante sencilla, basta con ejecutar el comando `python cool --help` y obtendrá como salida lo siguiente: @@ -312,10 +326,6 @@ Se se puede apreciar existen 3 comandos principales: - En ambos casos se tiene como parámetro adicional el `--verbose` para observar los distintos procesos por los que pasa el proceso de compilación. -### 3 Lexing y Parsing - -Para el proceso de lexing y parsing usamos el paquete de Python [PyJapt](https://github.com/alejandroklever/PyJapt.git), cuyos autores coinciden con los de este proyecto. - -### 4 Testing +### 5 Testing En la carpeta `tests` se encuentra las carpetas `execution`, `inference`, `lexer`, `parser`, `semantic` las cuales contienen casos de pruebas. Para correr todas las pruebas basta con hacer `pytest tests` y se probaran todos los casos menos los de la carpeta `execution`, la cual contiene programa en cool que deberan ser ejecutados a mano usando la cli-api de nuestro intérprete. \ No newline at end of file diff --git a/Informe.pdf b/Informe.pdf index 959aceadcf68c10203e21af156df0945411f57d8..8ac0af9f454541a0ff6d174b79a0b8b4948810ff 100644 GIT binary patch delta 33499 zcmZs?1yCH{66lS)TX1(>T!IF7cL=(;yD!0=ki|7YgA?4{-Q5Z9u7Ss2?tS;w_ifeG zp6==H(|vkoYU(#LrybBQ%g|p75IF$s04@$*4z6DnevnXHfEs3~Tu9KD!AyejU{RIM z`(@TiNyr|!X8LCO%tEnA7{!`{4K^AV>V#R|?LU5e)IeGpW@`l(uf5hB$Jd)fvc8T0 zw)IxOC*{k6=j+`Wb?=LMyElfow*b#S!D!)Uu9%63!XJzRyr0S+P7ilx2KL@ACwA&O z1ig3B2RicXu5ULMj5I;IO~Iv_B7%2mA&d(x6H^-SBB*5%?ly zqxhWoj=AQh({rN$f1jClJy&3jTCyII{p=wyY$GEp{1btG>Zg=G(A(pUSnF3z$Ni$ci_Cfw3pb`_L&WfA!E!?_1p@|um9c4H zfk3&HJALetk=a(1t@dzmJrD%n?yuy}C$#HBld0AHqix|~8ZqV&OkEyJ{Nt8J^LE#8xJ=KgN0)^zsAG~+|5 ztw!Wsp`KqU`ufuAdSVz8?OEpmWV@ISUAB7Hy|werpZzeWj^ryhSbF6oMu%QXH zfMDV4^o#p*=!Yb9p)VUBj%Xk1?AsTwR~qPD;NBtv2_qM;8ZeJb(bhGf@6_B?&`!G% z%F}}hehK@bu8Tzz#Y)&;`naXjz8ft)2b2BqTQl5|QuxiX3c1eRzTyhskj$XGa*Mp$ z)#6Y<_zQG(k16oln?QRS%MZKfK(?8&-LhpHVd!bM6z^PQmeR0}v#m6s{kfsR;33Qz zUY)9!5v8Gb4X~>4`#BcjAX-nM2xiVR=nO9j!)r~p)Cs{SLX&lvntZ^a{NYUTRz@(~ z0X|EK-P#e~_cDV+5Yvb%+R;66QCx>k$rr36nFa2L!v)bK5`5|`Ng-m~krB#PteoEs z4CYD%z}QJ^%aI&?>FPe1Be~^bVxg9LISA_~DXtaJIQ@l=elhQQvF_HIaRm*H(r&FZ z_Bl3wF?|nV;;g`E`8@Uyrd*|liRL{6S4VSqvSrTf<#9?;i7>t9F~;m+IHQ4)-;>9s zflyZa@fj#6*R%L&LysHOa(`g4W?;0sahp<d|$4 zcvKT<^WUjg0=|*CDo16dt+7u>G6SetNCuPH}e~v7_J*n6U1KVe&jEutWFOc2=o}RUPO2G-F8r|=3(M^5yte&a|u`x+aP-a5k-D~8;gM(X+;HILoA`IN?}YR zvBnv_1Yvi>LWeTCm;_DdQU{LtF%B_(fKI`6RDsN;6dd^oCWsi8l1PonwIiH~qj*$1 z#dnW7gmIc6PFu2YeG=Xtv3VUSVgcwT!sM#7B-1$4o{4D;(S~qsJ;`|KrOi{Mxuh4n zq4!^h3K3ODYAF2Rqngz^u~+JiuDXg$vZid$0Vxs~8zkoPk0}I`3`h5-iZxYBxp)(s zYtrZ*U_2y$#nh#+jipzM+&#pg4pxk0TJ%rE5!_Ny#QEXH z1Cfz%`+Y#NMg2|C*$h|%sooA2SDZPfFe={q(nfjdXb@M&xQQ82VX)eHkb6MJbNMs0 zJ=^Dg3g$EXGOSRmZg3DXCrIeTRN@ynwkGREp;jdOg9=>@y^j&@A6ysj>dsaTnXhV{i^Nvi<{Rx-TF^p=G3nPmnBZ{U z*0+Nz^aZ<8+u9IOU=0gg|4clKTl8SI{&6w>5N%3 z1qZ12ANTa$1KWgK_CdA{`O}lSHJ*o4KCXKuGGpAYveUxhj6Nhp0h!`cJB&O($vyGh z-Oa9%%Iy>}8~o`{qZ$GHhxZB2g3Xk1;iM-~ja+}IrHBMmDaS*U%ww}*U^%6rwB+$Q zLEfA|XWT3#^&!Rz6!ZiVwVJ-~NNUTO{Ms)KM8%E}h$R;LF*+R%^VbL@-KeHrq}pW% zCU2+wvzy^th^@h}nw^^!CfVe*=&B)yT31S9x>7p(M<6y^M-E+1E|j$Yf9iKR3;Ezb zS$71f!s96PAwI?4jOJrOgg2Sgu;4Nb$I?{X%jm4< zb0Zq_zkD{bF88QQ>Ni_B*KetN&sspf1tCHnK`l_^Nm0XIxA+^ALSM4N1xxfCrNE^& zA61ilKl0}40zC{J+?!Xgf<^IB!`VZCB!am+@>uxsIaDi9w^MpiBI!hyfBY$cGolts zoIh{cHKEyiNU8aDmpSX1(`KXPm`8K_{}kN#R!9#Ga$qU z6&Mjedz{>)V@p>*#oBpqZ?cx<1QV_7XH0ks0v65N>#m@**D)uGw}wv`(vps>>s4;l zPZk`rqe|7J)RCLBB%$Xr(6m;fe>%glIJsAKmVR zmCwdPduQGBw`+ODc6<9j5N1Y(S9a+Jy$@(2OvsUVj}$Ez64RxX^43}&gS`(XQ+zm? zo4xO~)9_uD)+a3}qm##|H)>$CRW5&hsrb(M3^$f7%Y_(8umhR*)k-IN$oqrRsDUsy zj*<8SOX!Fn0NFy$Iu(@MiNYO)2f?0j-}@UDuGD2rdYx{u3}S=+Afovv%9lJu`A_xI zF$c`}w4LcP)T5eDgY+}G;`mYoB1Z(dx)m22dAlKdgiCeXh15&^f}8*yBc@W+le&3mAe5`{}ob-eYEZU=I) ze*Br8LqK4zaRw|ghFaBFP>?;|?1?>|g6sT3W#-7QMEQ$Bo>nsj7 z2M3tE*74d4CAUEWc>J+k;Y6-&SkMM$YQGO0yaE>ae}}IkG~Cs1CIW!7x4-C^mk@58 zy=b-7Ck;*w2)uh!{S-E(W(9SGeR9g7;!|;$1YaG-#6&FmrRG}|cahKCf7E}))i|uC zlQsFK+btDT02OH~*BGQepW0&bjEaXzp9yhKTG43=i$cOEln&1 z=Go)2H_*T(t$IkCSY3BrsL__3)0+HRDhRBNMGA`6?_msWX~~}Xe((R3c=~~vh)h2~ z&8DJBJjPa?>o9oOAm%s6UCk-wgKZ{6nrVXj8dA0*{#d~}%|s93m~{LgPFiAlTZ-L| zh;C%3c`d*~LyJV`7@Mtxw=-(>S3@su{dOyYLKw<*r)ST?=Dsmp)Z9EQC+CYZYZo;h z#W4uc7jPa^Rl-CxHn?K%?*C^z*yElTy+Nh`mUAqdb1WIijAgc&!J4yK8*r0MSaCVF zd4QD4IWrqB`?egdoL^ez(#4`ZSAF6Iu_U3oMBjTuI*+cM`EZKDYq5-a0^LVe8G4+K z+q^p$)H?oCA3#och;)zK@!?a(l1-UZ_D|3*mNC#BLWf%M2Sx%s`ATmNWk6xAn8!_? z9do=l8I%CxZkP#vYS#APce||ovWVVUnV7BblqF5+xkAgG!+rjwvu;0JPquLrc%)7- zH664JExNq2Q@eZIQCb=*n1hz2{3Zol%ag1Z?=*V`e}v)AHENditBS6+=2#t9n&5y` zdR_~C?p_PWOR^bTUt6CIPF?0Ao$9|D9F3Gn^VJNjwpK5ow;o>&xtZ%Z?hm?=1(`|? zUJS7=m$73Ufegwvvga7Sg@H1<1(zzPFOQp~ z9}(7HGiel7&!B;AibgNacFo#HiuAYERTR=u!Ir;XUeKld@lL~}cGCy`X9>~-afoFg0?@iDH-~2nZBXtxD6{glibQ4kreG;vG8?W|aI)Vr@0- z08c!Sj&6Mq#qua)F*#*9Th`xR*7xJp@zw9PS$gDD*U&YBR&o1eCCas}=w~oe1=1iG zfHp|&Zi(yriAkk;kdCG|m%81|PIM#~<%Zx}fL6lz?CI*I zJ-|zHO4wmt8bj|2VS3TOCIGwV{;}#ZecboS{XF=5p3>a^VA7bH=i~=c&$tLJbe{GY zMen|e^c697crurr$2AajJY*O947ADpL?A5f_6d0o`Jqby6?lvYW)errNNEz7WOu^e zb!3wHk>m|-i0rWQ1R{5-b7roAa5CDa&PPa?}9E(9*;_J zrQbq0$ABZ`^Q%|MRuFPPXn-nz;nQgsKy{v_HwNRw_!x!Km+s!aX9#mnFQBbN!(sl| z93+kQm`b4oZM6fuLeaizX60cr5B!-q$2W1!pVg{-$5oI_{14e^WtaI@twGY|+i4?J zCLE-PC6}%jYZoZirnL3h9g0J?!I454)Y>U+{89yD_D!1D%)CoocM9|D>gBaBn+dzu z2NKdx)W56B?5kVr8un!E;_+fyw3`;JiOHfj;gYU%3Cs z;4|Ll6gNQUHJ?+I7hZI~;Bzv)>py4i#x0oBCL(B3{Yp#rXXWfqh9zA4WVQOUyQknE z;(PK3jHV1Hz zwep&PKVvB2b9>M}wzI56=+@{g{Z40GpRu z2*O_gHo)3QIyl));N7w_tjc#Dj1E)kKvJ)FVMSs=vK?_csxN@I?{G%8(vx*39mq%& zsVcz1ou5Nd)uWt$wabL7fIkfY$377&XwXRdY>ASg<)|NsBdmV&Xc-|)1FrExh2yLX zvW$GhQLiquDH{B`kf(F5WOK^zY(8E`Kr{eWkRC zN;jHo6_nGcpbsBS^#<}nj`WuR&Q+*kB_q{eTow3{V1U>9!=^a*41}>iF6bGCK@o@Q zc#e_<_zcH+b}_`JbZccf+y!NaFxW>{a7VY*heNbhmcYMiI@&ju!2DdoT{W+Q zB!2>UKaW@;?fUnbyRrX2&A&GF9RNtuF6smgQLUqE2*wl6$??+W8-VAhOJ!|YGq>ZN zRhUNNKb^|SN-=?U%Lm&6w=B#enK(Mr<#Ljnt~4%Lg70%oE<$1Tk;0LF)fOk_se4%- z-G+Qvn1Cxe(Tbhmofs$+g-NpPO(p8 z_iW-4vo~8;tE2b{_zKB>(Ux!25s`KB4~9|Cz_2T+Co%wODONfLZBz?dr7;y8inAXu zNPl9;zz7j9{)H2Bc)P@Yl8ab~lU~RVM|TYu+EG5zvoUXk1p1f_|Fh?o`sLKL^Lh6D zR2aBus7vYI*y>w4*z&=8CCvut{?)P156=(weHmz=4{LHhm+nlTRjKX%a9XpV&26jf zq8f}YB!XJ;<)q+X;cXt?F&wA4SS1Bka1ay(xh7a7hS_>&s}kzD zr(ZX9jC08Sdjg(w%Jp!IOwgm2+i?htaK5V*<~M%lv1O_O9B`Y`B^Q~y zEifHcDD6Ii3wrWP9c^*Zyz$EY#g>l?Kst{Nne1;qUg5diBg=jvb%rcPS>I&keG9jijcX#`)f%JE88aStCkd?^M(^lb;GSZm)z$8?w4~I<$c2KgJ91+s4ZIkbUSt7GLP6Jjt5h)-jVKe=YHU{_W2&{d{dKqCZEXAoGx2oo zcEb+9;CuOGOwNb+`CMEshvo6z+<4CH5tHr4O$-w0)1PHbKed?Llk# zX@N*IZW5ckYD!w=0>S#iSlTVa(aEM&ToOfn$tA5;#hf2u7l2z;tjOU>CLq4Dk!}-1 zy!OV0{H)=9gJV9n-3a0WVH`=9#BxJTTe{Y1&sUkgV+MUo93inPZe$SZjTX<3FoSc$C_lhqC(WPNb7A}XfLm!JZTGMd4bwzxC9JG@a zn?u6FHxRQjW$cKf&(0=q^hc-$$hXiu+Q*FNqoa8v(0A~+_arB0_dgrFtzLckxu>=f zC-1*2@p9cb=eBCV{K9#0#9m4vP~X09xqcKb6C06ljyqg*-*s*xtq&RTGxo*aCxEty!p=+BS(ETV><&3GdTt_H%3cN*3k}d=Lfi|X!M0sK zaMOj+nf6U8xG^rBY80fQTnn)mOb{2&mwE_Ik*Z7MB#ik{9&ZD6T9-9xvHI0=YTGny!VxkpdjiSNQb!66=}pbjQpK zYk42<=_R_Gs(y{n5Xc{=2dxQ&YUuKkzr4uqdcH;`F9AxM%Fu`VM{Sm0}K| z*H3gPu7rjK(ekrJm8)$F$b+7leNkj(`B%N3<@})inGXDTt2w9PTfgIX(R;JEL1Dgm zbSGC5RYsA=cw&nepX~#|I^fx;ZqxX6db8owty>U{osZof(puSVg}OaEzE|78mX>EVL4?O91U+1Xin|5bCcbN$zZlY^6$7o2PF z0ma1yrod;V;s(4&RYPJ^1G+l8yO;r8$+KvS_l0bqq7Q^MtYwx@7W> zuUCgTYaMR~>#ff>IcF5F_iIJa$K@6~Z_Qgd3)Wwp{9jsJ4f;D;!q3CW*5Z2xdIm1e z$-;lF7kPq^L7+dC*lR{TZ=mDX*Lal&c|U8ft>-S66?9Z5l7IktkV~P0qu@PjV$Ie5 z#Z_fETV?Y`_`1(PDu$X&zzOf$A3bCS--5Oj=(PB+cRPSFxZ^g}Wb6Ijiw0ah@BTj* z4QA8G6^i!*J?G)PJItg82b%Qdb%fIW1`};_%kflZp!S7NI{bolnYYUyDf|X}E$S{u zEedkAV+eL)&q>h^SK{uaIL&sQtG~Hm($7jovmQo#oZ}oT_-6P?QSIp~R#swoy)Urb zX*s=i6{fn;efh9~ z;KJZ&3j!(I=FAeMoN)PRjZ1NSi)r4y%Fs=)g1sO9HB0O238xd$=_M7?+$2i7n`TbC zTMUTW+>o(NnvmCg=PTWNl#KQdU|E8nPsu6Q>xdsn^WPO1RE4RN#SydxX%X*E?;D~% zosdNV-IEKZQ2f6B=K#__O#|kI$@|aaWgz#RL`DAH00m#O#4!RITL!~eH`j&qdCav@E{m0ep6k@g za);dq5;BU$Z)j%%dG4D^`vP4pZ?DG}?#Ab~8T{%axceU8y&hHo$BDmP9()s)3&`rDxX*4#ca+mm)bGWZl%QJj)@L9c~~b7rVDr|5p~LI%g_jbFbqE zi5C>1EwWC5^GZ;6XFz^OHWX_o-H8tppd9f6k#`f@$wQ0YDc=>fzJK<%9MRkF>eV%| zF1_2qd!VO>_9Q1B8!JSJ{%Qa(26TtGKyDVOto5|DiLJtyDpAF$K(tCoKaHYMhJwTW z=<)H_Wp1P*El*h5vMKb+HZ9LH4iPpFb`OIbI9=8zv6Pt`McTRAUJ5Ju zlGhYvaS1jl%`1BGhHJMqH?yyW$ML84iUTsR_4JdxqGXmv;%;lbX6deL5XcmoX((yl zI2w5duEd}*E+~|w5EYMmG!k{2EAq>}E|W$uPUpVs#UuKv9?LrspHNQZM9RoYYLaq# zsj!4E3r-{P%2y4yGbyoqNZ}Y$%VJ5wNn(kB06O*fHzl?2oN_U3A+ucHMwJG2O4|WA zS8`c-2mruVZj-Vd5zcvb5X3Pt|G@L=a`Uv1U0O1dfNbSEHKwf77vk~!8QLsBl zrm{N8$%p>b<`xPD0IkiHI!}NW_zoW8$oSOT5 zv=7afcOkQN`2uqX-EhZKeNX=_Wo}CKhM7s%T_fG#u4@zZ#<2S%AY4IzJMB|AgXkq% zE0UA#MQayT-v!aB4TvgVn6a}U0K;{R&eI^On%m1`bFTjY+R1+#&es}Olr+|Y-dTHS zwG-~+2KLE|Fhp6bDvxENrMt+FqhcAIX1EZck0)J5o;CukwxWyNNQ4;4YeX3HuoTvl z`DcDGN0~luZJ)WghFqsE@$Qv%`lFZeCr^LKRzZbm{)s|zxB%t&2ETbRd>l$oN&N{4 zwAGJ;d-L|VAR9g5dO(ju&qnR+ga6PDX`p6kXJZ6dr0ML_UxQ#JFyhOp)P`<6@$IaG zWJQB$)bVJp?v*C$T?!%P(+|us3yDcdXdJXhcF%RK#G?#wDCy~UT4<`nhQ)MO^&!r@ zpRQ@mVNe>fOaSq**J%Z5KEUjzNot#MsogV%y$stcd=D%Qf)WyPrX)iT3rg|^tJ`93 zaV)H}f6bazC7;Vn!Rlr5a2q0y2?#x>A~N_yqw8Dq(ddN=z#i}b zT?i5Ox$_$CJ{Yo-+(LSJ5uHtQA4%tvXeo=L9~NR`L=Zw1{jFb>>GqY0LUMl zR`NKf47VV>sX#S~?^=+JS3bZV|AMiQ8)Xr@Mz~6C09P{sk`|eD|k6#+k4< zc4Q8yoQ_MEnswrR7q%Ce-5p#*#oJLtq0Y?TYeZNS_H+ej5H1sl9Cp&JjUFr{lzvS& zsh5F9zo`=w_l(+WR=7ol|5KuLkxns9k{=+FQmHoJlt5!zMa^~D#nZs!rV`Xqs^4)l*=B{h>M&?{;mga~{PUN6&ov^1C ziN1>#G^gd6`GX-}X%CTL>BP)@UX2ZC?OTnF{d#j=_I7F-ffbKAcC!^^mG$9W z8#Z*5(R!<|PuQg#so`bN@5ShX*)rSBW1JfAQL0oLvUxd4DnxFFkpxjfEJZVm6=UNh z#(_CS6La)$K>9!%L@62#v^>Iq4^Tg)@HN#oewS|;K-_|jHBz0p773jLa!&iovUXH+ z3{RHOmxT3I3Jl~l7(vUsUW{AG7aHBWUL{+eKXTV1isb&v@MrECR<_(Cu`>4yt41x! zrG~6OxFNt5_p~rIE0g1DtOkpcN4z&YvGxd$sx}GB`-dKM9}4$EEtUP@nO<{CIx8A6 z&n3CNlSl-C;TG@c<7TwN^gUOwr9jvBXgxKhJEfTBgzF`4P;sM@Pc{LM1LY@@Ek%zt z%jW#v=cWFgqC><@(F|eAEz4sZFDs8NnIN1%jT-E^PVYXoEH4_x8@=5>3NI`cA0~2d zo)5cXw1vDhQ8?jwQ7}pP`;@HPe)rb6ro#3Uezk#2%<4RVUsgmeQ@^uw2Q=evnUz6A z8y~~i!Hu&dl-|TwQ{UifAFUt%Hdj?n> zt>(G~4XqY7m%g6wtd4g%RE-CEU!9H(*tzP*1u0O*iE2L-W9=DBdRU9Mub4psp1qd8 zvazIAW069^x-1G`eA(jF%aAw{$%E(sgp-@MjF0O_f@I;NXGrg^vUpp`LOrw8t1;O( z?&GLPu_~C&O7ZS4FGxKK$h-tCN;rGkzu=VBdI*f9K9)Gyvb#s-6lh{P+wNo7nd(> z@$eI)EsXYMyi#luv<`BSm&HyT0n?&%xc*+bLOONVPMF7(!?;v*tAk9+Szrn|4+@iPY&dC9773er~=!g&1>zoVAmM;2wc>ddNcF zyhQywSRRB;J#}FEdn`4G_oDItJ^Hc2-eDTKQq@O{(vabMP zSbGOplo+Tx9*mc;$4}hOKOHBYKkAj_#13JG4q-;qO5@Nl z=j5kMCr(HsR-O7iSd^NXG=^a>f#IC3k6f<7@`!RO>7w`hb9s%co_n4{yXZJv0e|K$V!pcs_@<)Q{rVq zI^vKvLcUeF@B?EuR97gSNbIf3B#a{2kbTrGv5Lh_YQt4^9u>(#leScAoeybYx6CtD zacN=h$^S^Eg(imPg!45DJpvYl^SbX6`%Kk*yyJJkMk)npU29hD0pFQ6_SH1-GgA~Y z^i{txjj_7oGa^>1r&ZGi$P@Rbu}!Cs{m6>}0~@A^+EKcYSd-D@kcNRUHz?HKsboYg{}Cu< zK%yVWA%&n34-l{>31mdIVGyl0Ua~&W;1?pSXY_5hF$CRP;I;CydpTDBBfO8IHrvu* z&lOSDGnl;`8R5>y7`)IovP4h0*$?+H>S4e?%;7WOr}<`v8Hl=t`d6pEw|LikObq-~ z?|0@qf`7)lSf+fzoGpI1JIcBPjnkYqZTqj+cl%}GgPp)!1=Nf^{n_Yd0DuijM9l2+ zLAvU@?>XYJgvm=OMk&dhpa%I{7h_(=5=Uu1oElJMxG(o{!LRq;QS zY!e?4%=wPnMs+DAj1vvVIH2eCS&i&Btu)=D%^VCgm7e;r3by+$3#7$?K3Zilv$;-I z9qyP}$_2z-4?u>y|4>Rqg$>B%o@HRpIVOK>o` z*LMg757KvR^G{~~oQH+o@F6o-GO{anzpqWMqZr%PmrpUy$130k$%?$`j!8KLi2K5~ z*y_Ed%%ded6|{sM&Gc8u@CWoQcV>SO%&R5El+t$qS%~}UsW8=Wo$6BC+vE`l!eXnf zz6KN4s=%pD_D69PDt5N+pL?0Ha?CJBq<{---ZGB#9SfCmd;>g)u1+cP?oqlrjvic| z1F4Tx(8Y=1&}xK0#x~F9{24|HI!h<(z)mlCf*W?c53N=)%Ms^%zPvUS>^bReruson z5w@q=rSF&aYqyzxP4=?KRg7FtkFaxvp3U9U8BNOXNk31hYd_DLee&8_i!i%$P7p_+ zI&w9sHKvZqU0l_|@@1|q`2hX7U4BO9#Bt_~*$OP>@G9m6GF3;9PrOrit?QpLc5duM zqNO4@EP{x1M>zd3V)JM|!Ca+GT;G>@WjgKOtsQK;#H@!vNvl`A6H;|*1K+gqyco0Y zqfK*?M-?D;=Q}YSwB@KLvc+1Ne{M`CRocLwGH9*75SWQzq#-VeM&~FxdSvW|yVp`( zXS$d_@QdCbq=KjxnGVgTiM3}&m@1=m9dX9xq08cSvpR0ZUf+I7w(^R(GQlY>H+A}e z=YkFr^g9V4HhK)GTD=p0HVDtzn9j*8?hMQJ{V=Ti=<4;j(37IQc5VV?cu`h2Z)2Cx zl4J7E%T`@`0lwg;s zX9|M$gKu$->OwPuKc`uL&@%YTL@Eu7ue4Qb@!2ctIY8;I3Y@wvn`!yvo^O3kq}zE+ zPA<7<61M<@*@LT3Q7||y8zQzLa!BJ+9L zWG(UGZ_redm~nrBK36vvpo#r|kRLbuzodY-*&~r;rfr!KbihbOTi#dJSjE} zYd1R}IsNM!1SbS51Um#dgd~Iw1Q5au!u@@-hPZ}sc-NV~YslZ_>-Uj0ge8O{!{1ey zxBwmAQ{Z~fixxcYNY2msZlwa@0^#^>3xsfe|NoD#`nzlovGpF!?LC4SgvtLC;h)Mp z-SF7{I#B*+iT=X2e~bTA%li-KeP6+Us^tK?I?+IKflFP9|1B5N6RhHj3x;v#CgXme zT;uOF{+iMO!t(z+C5rc7b%;By6lL}Oo*KCzIKq^iBqXf zFHj}Xd)O8(=;$kYT&ptAgUfvG7nI-ZUjIm6pS{k2(g!X#o|TEF1gOH^($6MVYDJ$s zUe>(ScFy-MpZ6@UU9X+5*;Q z1(}f@14*mcL?z%k=p$A+;^*Nr`wd3QD*-mta?Rv28&Y1`CXOGP&dWA|I~A)@^Kxc8 zlr%#9aC&qS2l6@nDT%^`*RsQAE9D+aK09`L4*D#E-aCrRW_r!%PkSzKc6QBb;q) za%yEOC;Xgfqt#tF_jixuSPmuEYEDM@2Cr(G7WLS7_jvB=%1FkBYyY{5J%1x?vAw~T zvb~DRDSMS*(0qI8rGKpLK)=$_fWtGp$2pOp&8jkf2f?zO?af2%LQj=40Z~yMy3=eU zH_DVz|F6SeO@?Da#N4Drq+Lc)^nqWW)QVyk;xI zNUMH=3X<}^d~Q)E{9-QpBq!lAVqCWhk3{M|rN}3SM4_Aar50?H2UzlVPoSr`<%7zz zhr|b{fT<1a1<4Q^5TUv-4rIjlx-rLxkvNI*H@QPYA|zwjyLvcxjWt!fLVEe?#ZgR7 zo+ADAK-!94Z<7p#ANU@|XNlWXW3L4mUn&x2U+#@E*mfWo8NZV_#oG(Mq;ipzZ<3EhUdMD_lw#~V}!VpR@$6-X*u#3ph8?m58=1~>qxZ9;qt%v21` zY?$JYU6w-XWexV}&V!_j&|^7a_psIz2z(ZelBrj^Wi}xr{l!h-^Yz5otAU2plwAG! zYjwCDP1{B_b;H844COY0)NA#|#4eWPi8H^AqwZNSE`>}vT|V@v<*%pyUx~(XeZNpm zBS77bIvl72Oln##Tl7=J8NAYkUznslo$S0UofGxr`qE7NQmaVK#L+D$Oc)YsYMgBG zci7vV1<`@dIA#c$$|fs5s%4CJ_;U0*>h#Y6T zZ|=edWveVA?66s99>+pZenm*m^N&AQ5BOaSJI8t2wPl4LEq>E}CZrvO(yO?ipcLm0 zr-Cn&G%RIKt1c_g5@&tD^0fDks*Su#oWZ0zy@Fw!eoRiqh^rEX4FyD&N1%*Q)q_U9 zeeB4IBwU;b0pfR~E*Kvei{ZrE8#Ij^zP9*v^HcRGN}FPWY- zabjM9mxeJVzDUJzi_#OMlTyKh(@_YA7epchGB6@BWn9(YI>dSvd)ngp;Q}QSX()!H zn?p2}b?#&1XKWHxQU;G&roPd-tbrn0HnbXLnq=KO;^XcT?{gL)#!uXyP^1#!ceE2- z%gurged$xXci_{hAc!<-%x^`z9~FoxLh|q~M00~m@Xw^N49E~{BcHzjHi`3k;T@b} z1FyR{X;uj>6-`8teDMLRe5DZgt2Nwnr&J_Ev8@ZkN!xdL1RJUbMcHda*q}nf6I`>& zmdHHguY2(tK6nOKxl^x{8@ux2h2Pn#)P9X4n3_Q3(F!j`$O3vu2e9BS5asOFdbSZP zpptl4Eo`vylmzQxcf?G7T+D5L>E5P1gRi*jWd!)a<2#hi^(R7^u~l^0M(y`t6w>K9 zs#bRQj;AXdP>aR>G67yHGlQ}R4LY~^2SbJ++I4<$>`p5**^Px1>f)el6}EEhCNUU= zGPvFmf3}a%1bPDYCx?0woJ2CY{T(dFC?RB*dXu#vt>_>aTJU+A=UWR2(Xe+GC3T=M zUg6@>`vz?hQFyJRGaEsM^7)yn+6~RBXSoMZY_Xb6Mf&sd{9Mg4-Js@qg*j$X?R^aY z{>KEwC1Px?)(=&2T8A(rFcO!3?~h=J2P8!B1r}FEr%LwBKB_HR)M3yWNDtFxhVDD@ zQPMJjT{JTiOUv*xX_t!$5z@5shh)Y=&K(;Qcel5R}} z(omH;mGZOb4jE2z$AL6SK*7aO;=ApgtqH4%y03B*8Jy#DHem=DGGYttAg)gzU1*d$J`N)Gt8l50{v3E#FAT__fW-gNqa!nd zh%+E&skBP&x0{^6NZA$u?_Sgj<6t{ENii_%qnrY zz~C&Kj90E+Ld-{bhbYls+4}hM^mPd>hij>!|9APo{zJer=ss+$y}|p~h}YB62C1f* zC<*OD|Cs=AYgp>`2>(>Q^_E{_;1~fz%mO<@L|A^Q7CrQugdJgBVih4QzZ;3UKfxE^ zMvg*jioC4@2MZnLuOk?J|U6aw&=8fQjZ!k(Q&>xCQP-4Z*|)}Zx5T5lgRTi~B~?e5yf^mBTIzPC(z0F|V)wqM(PMZqiE zlcAQ;6+I?dBXCXWPjr?7EyW;6$n+5`Go`x}y`dwm{h=d4-B?*m$2(Xeunye(%4mHz zJH8oWrg$#j=x*p~nVL^9Pt*GMQ}#BBsG&4-vK-L;P1qUgaC=eht*YbXQ|kKnxzEQo zMve#TRZI6gj{bOUVogLfglIm&OY1V;Lv%}(c{5)%2w;rj)m)L|gp$9;G4M-&>e_Ic z#S9w*(}X)It-HqE;f>YwR69-NFjUx4&QvpL%QgeMVx8%Ix8uZA4>U$9#`#mxtZ|tt zv6Dg4{DjB@dEGzqP&$S}?!G*C@r36-^mDX0yK!N!3=l{_{JMh;+*B%oH3HY&y;H$wI2=jGx!~ z)=}k7sGvNawtO=_tu|;xQSZ`wB7d&Uq~_dy-N$jdnNpT>o8eP)kc{fADtDK36;sW; zHGbTUj)xuayuUt2tyJt*|CB!;V6zG;?nFx~jLlagxH4x!xTp+7 z)fD&gh0xM*X!m;`X{Cw8!|Wna*QNR0l`;X$2bT9Q?1j3vqL%^aB#6M+ zu4`LrU{9XYwv*FY&1@7?kaQ>e_#DUWnI4wT~bn@2TwekL0bjuLDXvE?eB_HLDu#A!RGdq}7?;-LK+@QcaA z^K}$A{L{jua;mZB;JSl8W}G|;CYjXAd4-grZ;j_g%?&kEO5LIppr$MqR-L|ehL7;Z z^}4uxE_7U!;H|m*LW9D5kuRY(7}Gs~GU|1Xjc>p|Ypg82F3!w*ClfK_ElLuk%cwB| zCn(~tx7_9}Np;v^+Dx~r>adYNaRs%|gBc7PnF8_yb3 zyX}NbB?SERuoha)9;%VW8zkuo+OT0FysKbzEbD@|vWu4n{TR4X;)D^(Euaamf2X`u zyJ?7R1Yun8Nsh{-P-7qF$P905>ZxhsO?l}5v2C&s_-Pc?`EXs&@UBB&K`xB4;z4jI zx9+mIo~(^qCj4}jb0+_=uwcgNEW5U8HM=^)Y6x4TnW8`CrEZks&!Ux!l6I2}a?hOdl^VR18?W~>_2&q5A$o*Hf+@@_Hn53|ShL&i`g zW+0NdHGESXOm0$bZ?VVEX8n;$BgYF5-Nmvv+N9>1k2FPub#`(yL(NF$m?JC|%cM<} zwTwAJAgWd({xsU-Ejc~2f?9}}cjNh|RJq}MZc%5mPQ|Iw%b?`A1r@Q&0Yd9>;)(I4 zo0msA7eKnT%dOQ_BQdu4JAY^Vg-v^{&`%5nZ44;Q%sBlTlByKGFEAHfXVjeWIk!$) z4LiAz%j;Qv5BplAjUMws`) z(dr&O|9a^EU!3PR3h;Nv85=1l;DyBY9|9T(@cU7{>Z@l820rLF$h`|RCQ!69My5i)RMhN!RwiffI-%FBorjr zkbr<*GSZp;mp4=gmH+VT^@>gmk!gmYH#i1O>tZo-*c?wGr$GdvQXvNo-7=MP7EaLx z2i-D*6^&(pqv->y$b_L&_Ygj%rN@RMovGISM_nloj4Vny?6`=*!-((Nkqgfrs?(5l z1r_bqIy05aE+N_#vd#@I4r8TU7Y#`yvi;~UOqB>MAt}Xg0(Vx{Z|jl}7RaZXD*}DK zxMIO*xhwhZ36IX1Aiw26_*HJo%9JFBCBdBbtJ7X4yRhvc8Fd7H{r2sL&G$ZA%nvYmKenk#`n{!&uL6WYKGg|eZx8GVv*Xu<^mzMp8}(o}os2SHuPybW zY;jZT3h5y>_fQRlDVl?X{8GB?#du8uy)aZuCCxiG7?S}f8mLvX%Va#R0yTb(fq4=F z-_(60J2L^Yp0+g>NBd=)-o)@*Q9Ubi5=hjk-*XJ=Vj;CU7Q zLyA3S(}X_GmMbK-iftUjPqrRnKE`2?F!s)|@(XSCE^pQ00>?qz4|fNbQ}TP8GQ;B* zAw-n%sx;lmNRE_1iKIP*5la|&kj27u#eVj@J+86%(&n!ceQUwvlp&VQL27+oH9if8 zwrJMciHZO8ZMq(LyNVJK4n<3E9=%W`NuLmMMlQHHB8`j7o~+Dk@A?&lyfI9HgJCe z)ma=PnBa#y5>xoYraOPuad%L~={Cf7RiV0n!@d^;78+55NaJ)1hkhD02q7*1agFpP z9GU1BAA(-U_03PVWi0?4MA#)1rkt(2PiGlwS*M_Ib8Y9)s4OCc3R@vMEl(_**q}B9 zlN{$FQn60?8*z7U08&VmRw%okiFxdt`dsk!Ad|6HIAJzk`LcB{Jqwe7u10(KtVY7h z{d5Y9M_=TEnZr{=^f~XKVjuQ=Ue_jLGOO!k3fSb(YA7OpK`B!nA}U=wh}w;nQ{U3@ zcFU?W^agW1Kl;E8al&%+0JDm_m31H1PXQ{5u%TkA?P~7+6+V-h%dd^NHI%X+-YYFE z6sY5XYsXxpoP5XT$r{X*PlnFd$Ab=_$6q{5UH0X>PiAEvw{Z+J``e#t-H4YzUG+!x z(pCp5;hf}56wsQ5LJ*uw8&!Or-ozt&Ziu<~iou=j=zJk7e4Tf?^T8|mJ)IIWVWy3T zw6Uei`pOOG{doTg5_i0J6X6WwDyLv)sm{*n8xb5ddXr8jeW~|5pK{`Cbp{8{&tBzm zgD;&5Vk=zgLrEAl>P-7qu7@SPFRGv2ukaJ0604R-e+n$b3_yB%I~rfXba&)gJ!w7_ z%Pbw{cTrj2FMW{r9TRbE!DKPU-JkuHs>#p|KuGo0|(Ec^cJL19v3lK0+D zjQ8eNE`2xq^b9RMF@K$yoK-F9Q+b4Ymt|i)?3u4Me0@4PqjtkAeZwl_=*Z&+ll1XTN8T=#(1p*@Gyw# zv#NTcogKs~qLIKjm+xLfLS4mJRm7~{G~VMBQ_0&4#@*h2KRhP+=Or{95}N01!rg;y zOJujCQ@o|*MJlALd;CjNKtaHI)aMaI+#|8-+RvV-wNTk8<9hRxTlZCfuc|KGZ%~3u zT15?Q`>qON*^LE1_cEZbEiUzc}hR*|ZqU(9XSF zdpGxa&Ik~76L3Cl)~QmuWiuV3hE8w7Mp8N9ud~G>{|ZspQ#gR%Vb>Ek&Fb;)U|N^i z@^L>oKh2nb-TCsm)sfh&&25cW>w%*+8dARFvO5QZEx1zk)-?_P_SIMP+hFNU7L9Aj z6Mx=2@Sut2UW&o(*HOV1(y-aCsSj>@z)Zu<-O=wSDlDZV0W6c-TMYOgt&ixkHZFTz zW7MEKPT*d*3%q-D4$=LFQk?;AWAPu3elU7Eik7C$-VW9af2@5(N!i3kLShVQ%TLAd z)U&z7(Ay5;b~-ci|795Vky|$PZ1__PI+S~s=ZpB(zxaJVwMmtRbeQH`lMJJay9Or_SG!u=Sx)aa|FlO*AaeO#PgH7*1)U1`ar0S(;!g$VHN6E3tmsyfITx-`ioGeIr zbin-J93^QVvHM-u(6AIj#e#o-4iT_4+VZ7Bb);77kGGheH7S#pa4%xyD(BD7=&F5K ziu2X#Yk2UgkaTQY94VnCsNCmuH`ElI|M%@(B@l0zY~F3Lz-WA?7U zFik76$<}-GdN6lMGF(At=Iqn0#_-nLWPg9xR(NXh$Vir-G_(`2sfb6G0T9qnmC*15 zkD>L{*p4-LQX3KEnVS|&$z_S{hld(Zthq77LLx=Ct1WHo#pk4bGxwW%Mud$l+%Mpx z&T6wgebIQfm;bvh@YI^-S+gYv^4e5uMS^u#b@{Gb71lf-e^}`zolcuS2sAW)+HieS z<3jPw-La7UpuGsiF!QkI*#gP>(0epISK-~-*Sa#1?QK6vt!P#Y&Cmt?I3wzT#}2Pi z`)L&++N8C8v693%2>-i_r6p|7XEEFx+UXuOEa9xD@Q_K?>W|-;`Iu$|$`aG1ls0}%#*22$y>G>OCnd+ch;QW%m z?x#19I479?m(Dl<*Yp{M1i~2#_v)EfI`*i-FWd7=~<=rPN}JZJHLt@zBa6d zi-O{U^r^jUqyu*bnEG=bw;I0>*H64gSUFU2Mo;G(WbA`l^=1R)=d2@BbB4SI%k@x_ zuXM8s-jl7b_Q>gqys<3uJ$F4}>)BpEzG`y6H8PR=`-!QQnQ4^iJv6N=Oi`=;@WZzE z%yuTOa#~C6!qd_-8rhy@1S>1K=a3{2zaUA*`HWxa8G+6*4qrX3={j8Vw?&XlLHcRCJaf)ZkM1I)MD#9DW z=LVQ)SJwo{!h?PONN-pgcULRiG9eGi;ICz$D#x}E{47~td82ANvqTPeH`@3?|9&@4 zYwGaj0a9u)fk0&F&~;+F-sHDF=^Hs&A2eGp%<^(B8XjdjwFJ}HC@7Ka?=&e(+b!yn z+U7>9_jaSQpuMYMrw-}}1{a1N-M`0-&852Xw-pFNBtAcX9^TvV4L(!@JF$q%%uRvW zk$W+8L}!2@A&m~-uMx^B$*yvx1Kqi{J}2LLSl!DUGERC=e5i4qaMmsZ#vQiJ?VBw;`^9@ZXYb$8#df0 zP{GRs8JVy}dG2|I8fx(&roy0aQ(UL9?MXr3O;v31f{d6aU<{uR!F+|nc})HOXs8+h zuhXfl&vkLf&u(|g#x&B64*j@9zr)p2Mtgy!1)3fU~+J*sRLf*x@VoCX8Vn-J_A zBd24n=p>lF!UJdL+a^mNSjK-SD(DU;s|LGq?7 zij&B<=lFPhP7}k2G=YvqZS(>3+3=<#sO9XPe+x8oxH>$-Krjdyd?M!W651zK9qqR{ zJ@S+_^)oYh>$hlaQ&rqy=Ot_7YW(&D;^FxC;PljgL;(iZyX5oh_aE{Yi4~iF>v%5g zU+#>tl$M?U4*e=RK)ur-vFd0f7ebN$IYZChpl|izg$-~!A?MH5GFg!d=r9Lm zDSVUY?1*Ru9Rt7v!qMN3Il;X|RLfcn6_v=Fq+fm2-h$_b)FqHN{OlWjcV+_6pNKch zHWG?+(0-9@_6HKDFLm^iIML$;TpP;fC=<(Qfcf_PAyI0~I6bRr0sF?)5X0cX#A9=D zfe8`2I%Y+$9tjbgy?AYk(!ID({Ii&I7UE;XR#bI|Dc7JVMDaAfFLs#qQ z`&C%wn>qMjti#eM6J3XTkmgxRC*-e5_M2Jt##Zn@LV4PnX(sye2Ivh-E2k>24V|}$ z&lp{59!ehUeRU!WzKEV?tz#R7R4TfN-)5fuLQ6xlMT1Ave5Yf3lkL4U)-$#_dtBFX zs@>Cy8jT)Ipu%KG9kw~@o*Z*Z^DNp?-FBeRN!{o1c$Y%St|kJBff(ZTgvS|%6=VoT z8FeDhQ>n|QtOZaqu&SI>s!J>;v`U__0{l26E3uJ{(WTC8um-y%&ycWsQ^kURuFbz^ z^m3%1z2>J&DyoEXBXJ^%H$>X_ zFzQe^XqHHVIP6T965;}+^;j+qAh>#hs5ZLFu|T?h|m1KhUO8LeQw^k zA^T_gq-~bkNtKyd;63nD^amRFHPv0=p~1Yoeb*}LmOemhA4I=$ij!kKJF#FSL<2}k z=*Wr1pp#^6HEEbkppX)JT_nLi&o!nt!l}wNlPr%UQarg}`ViJZv!URcvlp3`L6eS# zik6Ba^Q_5~q>+K(g@F5Q1$8Jo9K9j;ts6bMn3_$=8>FEOP0A6AiuDKJB<1brk#A`N zHSJt7Su)~+RFE)J44lCZbD5m|ugKYQ;};VO!KXj8>dY`hlq@;hAeiJeUNtCdD84~o zbo^yCd@5pZwAm6I7-a4@0wy&$s6&VJi-24SjORcZ76eg2Y`p|`yIZo#h&C+%%9Ic- z&1)e5W1QU0>$Kt*eQCr;gjb5NOLmj97U%gsKGoILaLJTIxCNlPtU|KQ=kjU4Pw6ah zvy4A;2zr7dkntQi^|HQAR$HFB+2_t_Xf6c=pp;c`tlj|0u#L%H=^rQg`waL6eU950 z{f^udXaZSr_lvuVo<$Xk$0+_>^YSodKgkF;qhc`KImD&B8t!0{wT)TV;YIUkV@OPh zj+dnv>U_|;;e%VA6NxiuP2MM%K!egOW}|N^47brH6Sp7XItFbnt|95BFY2Tpu?j`@ z4E-vC{@|aGGw3gF7v@XKG6#_TKbSL!;{_3ZAAMA!5Ay=>DwLjca{}34GMNFS08St& z0Q|2v7uSmnz(&deW__VZa*?uwK`-Yy{`$8pQ6x5Y z7!FjfU-LK-^#mTx+F~tKFb>obsM}G3yAv<~z+5f84_`P0J%FPz#%iA9XhIp)M!WB* ze;8dVGDojDRn)1M2!5rJ-<4M(EQ!AVRZ5|0`$10|p`z6NYHnxc`TqGSTRtF*md%l{ zOMY_ty~$Kw1?1UTt)8$O(kX5Fx#22cUzN30Sb_S;;wRUZ?)=9O3L^Sy#fiSYhxmIM zbyl7S>vQ!tGK8)r%{F`@3gRR|H}1D9GZwkD=ax3l%itB6^N%c!0v1F5=A4JguO2K1 zG>z+=6k;40x{&h5nqwlee8Q2I1T$H0hngg0CSpL*!^6EfpP_|b5CZv&SUj^W6!|`% z_m*!B)r)-l*UFFtWZZ(fMY4f>?=xwZdC=u_vGz|s$E0D&Q{Yhb`kEscGUsx(zg3LJ zLC2=RH(Cu>H>|BM=AGhXcuE)|c8-+{6hMK)hHo8+i){K;<7$2)7STA~5kd)f(Ld%! zXKwek0Z!@d*jHT1U`T00UY7;B)t;lO+0Y3u?+P;gDsVhUYoZRhdTM_bX*>B{3Vm_nd#6ce5T zFc$tS)XR;Wmp$<N;^`wa!=LGoBBH=%4D zbyJusm$0$>8qWIN!o;W{a9*l`=Q;!t{qU{1nPI4j!Z**M>Dg+7uR_sN2u*l6vy3vK z9o{miPQ_ZH0v8+J{s^`4vyoN$Uv__fPnHE>oyQ85*?kVPZs)a2KiH7l833< z*6B!^4a6fiY*zmct)FU<|AZU9uW58&Waw)oC zF4jKARHce}1!7XdXg2pMXPiqTs$LAR?_#4=pM$8^pnyCzd+#_ZF^l2lW(kX$v` zLEX^qZ9K@zrn4M>__jNb827>j)L_!aq=V!Z+|$wOGN|fQ5UE8Mymj9*_9G)aww^ z;*X|Pb)W9LVs*1E7Y~?rJ1GioD9^|D5WhWlkugF93}LsizgK!6ig8HTmv)nI=A*LE z-O_G83Q_{t(o1*)5fFH%5Zs+qWXn`kRdiaLo3owtCpJ4Rc^bIZ3B{>dD!4c;p96IG z!)j51z>mst@yd<;1JWg0#ud|DcPVH-!1?~7&?SmwO^sxY1)e*BPPZkOE$nTwHmG4y zJWR+3`c7V8d_soYAk{J<`b4aQk&k)XJ^!}sgmo4tN@bR0AG@{oPB!naqL^5Ir^XbO zD#<{*GZaIxi@w7978L_#diu$tbGwMhQtNqe!wo`eYOdmU-`re{P|3`x82XQr_0r^? z{vq8#LEUZ3Ee(F;?AvQHtCvfZ5JVZK4iZa5{)J2qM=dE1XNO2jTL;{+9Z!j&Q>G{E#Rk7MLrNQ7P@O_(}I(u zv$tnerTJM|&Q8QHv#oOKcezf9BAbL)L|%B?nVnTRj@3A%qj)O*Jk4HE;)ZB$I7bc% z9&+@ncc`4#%8@q=8a*Dv$G+bcx;Jm8W!EfZu9%_8vt?Wy4h2-TXUBM&b-v}xHBM>g z?XTvA3N&tB+|DYt>~bJ{)l7JY2+K#Z4;5=j?~p=zl%!o(BFrb}>!rckuVd(yl}0B%!x__f zlj~5o1dqh%bT50YApRs(!P% zD2QmcC|KQAw%DzqZ$~(>eG?17e}lS7rx1i59$5eV42L}k@iFxty!WU#cl0qEk|8L# zkrL6rB2O*t1!Hyk)(Ug!_H_ex^UzS1LC>i7qK@=!XY8{NihaVk0^#)3n=kU6_g$A~ zb>jW1#QG@%BHP>3+S&I`VWCI-6wAE4K=9!pga3!g*Utey1&^ z?YG;2E9O@tr}RG(R7D7qQ6ffyw+zzu7H604^S%8eYU;AxEgW=p#lEuV^c;sZ_@VfV zHrn@W5c13?F>0)CjAphTL((rC*9j70OTk7_+n=kMRZVun@SQ?GC=Zyh;Sc@n0{31t z0GR_0zDP*)t$N3RRaX|r&-!QIT$7Ebyf3#6E%?^KuWD(jWToTx1{M7=A#Txs6L*p2 zcw@JIpTO1+N7D>#zW{pwBXpltA-!idLQ{e=U1E&Edl5r;gqUdEUPwbRm*v&1_1cri zox)ayzm6z@w&T#WWu`xRw(9Q2S3f6<{m-WKOsYk`4L!s=Y0c*PSuJR8Mk1bkNy)~{ z-X^-?@!Dly7*`BdO_PkBrCRMy zsV^vXaZv5ta`?#ml{eeu{$w*OuC~%Hcb|r1>ZvwO=5fnIGW^0)2p2{gk+16HbVD?z^>9e7#`x4Aus&o`QnCSik-w!c8JqWYHEL)kEQyOq^8-BOw ztRD{H*dg>sZL`4vXRAu)C~XZvc5!v5#_KM>;D=W`W%ua4EkBm`uDN~?gkTt4Y`}DG zZYQ7=(>Eqc1>{oXa*no}tU~HUOYCnPa(1cs6Kx-3q`Z=E>++okj_01f^BoNdtt;jj`VoJ0Wj|XQYU+k(EEg$yjPdkb zcgA&JSJ&Vtenv9Q6!ei@Oizf~*)}qI<&&H14LdMEBS*wtXWzNk8?CPvW}6@g_mn50 ztVC2#Za<{#c(I7x9vPXL+H?N{B|TfJzZMT4SF7Iv!pjw3A#+cpHR?9Tw~TL7iZs?2ido_CL3 zUE;ab>b#KSykDs3p&?(2q1$o!s3Q%HjEs>mqUa7%XCL`HJ4vGL%?DK6I* zdE4HxIJm)Fg{&t|oq+)|iCk5A7wbLpJ_JWe3_u6D5KDjXY~*v>C!ha%PuCp?z_MQi zLEYdUTi%(_A`p=HwonJJW^GpwR+N?BR&LtH7TM}X8_}Ct5YKUt5X>vg$oD2m%Y-(H zW@WBr`f)3*or~vHtC@3FU%HqF2c74lBo3{Y?(HtDGBMNliYtf6bK3X{=7BbM(L)nYp0O6N- z+F>F}BBd+SK7w3SgnCL@@e82_Ja&4Ut+wSy1j3KrN0d7F*_nu`tN)nDoH8`&Ga5ci zJJyqXBpK7RhRBb|WRInqjEUzCWz9f=TBIORrOKL2Y2mfb)r~~lLreHCzt3iqx1~No zeG1FS#-AlCH^eR`y;%u;#-A0~W-N#mhS!nv591h zmAOf`R+zi6k!{6-!k`HvE`=WF2yn9{(7E>rStRA%J;l9m}hrbU~J-HBk2xZM4*eo7VnWv zN@pnS%T86v`b?sb#Zxl&jaze#ly+n_#-v5PA3*WbmEa?#HfdR zTbznvFHflQYedZZyVH;$ES_Tldg7%9)KsuiFTo&na_-rnM0j6`d=Ox4x2y_s(Hy8L zAUv07mb)}9EC8cH=iOqUctcIq)g$2|yrrxFVB~z{8V;>4Lgi=_MT4(10`7f{B^1fu z3rV)pX}Zlzj>j{p6H3_#w@!z^(;|B)Y6nGyT+@x;xSnAq3AMhLRCXNdE&GL_lbo=M zhP1L-OT(WY+!Y^Z4YoNLEN+F|FCp$;??Qb8%}Eh;J82(Kj`P5`?TEER5b*_Fw?GlN zzU6I!Frk;O+i3-`p-DTg7mg^$+VI&(KeMvnvP~Ao^@ptw9Qr!~G&TfD#;2 z)WjS4=6wywla0n>#h7UmJMlwi^j?O$6Iesa_N(=%Nx(UAtdWVa(au1OS*mPd6rB;u zZcvCwmk}=MHFGZ(RsQ1DWBEEKKxVMUl9}4N* zV9L6pQXahA=&JS2CIUMk`k^YNQ#kufkGZ*Kv5MtvxN*%NTK8yyc$>i@Sb?&-+olqX z69VOI$(!){n1ZI3B3<2`0Q)_B!b8qd0zK@aE8(IePH!|j(rc@BnA;%ZG=sdK<9$}4 zWGwe@F4CUpVEK?C8HTa%@eyDt1OueCwrXPRQK7L8f5ERcnU~)~08!oNW%`1nZ7J_p zcBL=Fmg_})Js(R(;KnzN*YY1=Id`9xcti5Oq0@A51Jg1uRT$oH$Va(LXca#D8I5 zrA&N{OkE!)R|jda7jLwL+KXzHEFoG0iF4g6UT)=X-s`~-DB^CvJ7%Je|N2U~Ye$9eXq>=>uknFDcH=~W2a@?Tx;!$5QaxsT`=6z!x$y1e%TK}J zoWWfThKnI0RE9c7tNb6|DcIpBMJ9jE#@?G01B(BMyhojAeo4I|Ky9r)X%@rNdEc?P zr^`sv0U;pT5QVop8GSd&kJ3?oY31L>#@yQODBxJqlH5jLn^$=6I*dxIla^=G)Yd+s z&^sQ?^HkCSmX@X&njkFV)8^|KT1NG)BPTVtg~htA<^(fT6Xb9KfuUg}O)jRhjqgjl zFiNBtqD`a#0MhH&e*3dZO0U=6!%9;VHC3}(kQ|XrxQVL06Tx>m(@ne|)j2w}Iq5#m zfnhQcCC*V@8;4>)aNH_3w;4OTS~#VW(S*O{;(5t6Vk$+;*GNvL;3}vQWzh3yq;Aa^ z-L&Cwn&kQjs^PAG4cppqjH>e^N3ck-V5$huI`mb}q*;iormi`=6+w`0)oN z9Y~qV5MB}iG^KITCJOvbw%2K$^#ere783=q{be;Vl;T=4j!wN3zM! zyUSLW8-H+eP64eB53d{@A-0;wPqrA%r&z=MM~ly>eU-++9A) zjBfS!O%V+Y;|2SE5G|xmVq)7YeAr|3@S@dfWqd(VmplOScg$=Ut2h!r^BMp9vm$C7(?$iHGxbp1=o4&Vg?O zi#R$C^q?c=A)CX|ukOAUYNP04?qrC0^lTCB%mpWYWY_dEm>=`}qYF{l_;^+tpFyyY z3@T^v>pPC-u`M$Tv(J{McFOyqy&2`@ge&ey1d@$I#&r7!OXH6=&Oa1%_sq;pEkBz% z)Q7kN6X7uFDRK08<1RzUznR+YQ@Vg< zuzR2YN`|@ZJU?xvHTku!LU8PkAQ5eOnNlJjyZ5npqaV2Nz3yrECDm9{A7prrTA9@d zJtN@_(7IVeG~VC{5c}Jrb-#nK9{bzUgoNLIwMNMs`*gz(z2Wp`lK;H|T<8+~QKys!X{JNYo~FKiM# z5_|!MC*Fy;x#W75^DstgbMAw<68pKDIe}h&n!?CMvfGx;l1;uoF|Yx6W!QyLHE|&( ze}G}&E8y2-)AOM2V5`3xq&&C*-9TuWVfxubcx~#Ep5DkB4(%NMA;mB3LiHiV6K#$C z8*@gd_`ry73>?SV`D-vJp_v=9zTuxM>vh>8=Us6W+oA7h1xE7xs=`j}k(HB}Hg>=l6^CRm zt^1x46p*}B*q?=`oky)=`WSJhq(J|nOHW$KR?XaB9mfsn`LazC!}wD_w6jJbhMSrh z)U_tH!Z z9*mU4(4JXOK}L)vk_0c4`98LUPz)kMZ(nf`9`dc8pIkyFUT-L^7J@O}2mS=D0rz(! z&&ob3a|H%7rpv2!pU9;{@KfNw>_ZvVuZfZpz#^-KcO12lL3}TNsAc#*-|2M*YUHnm zfXRn-)H((?c&fg;x@QkY9Kf?mnf)MX*;$=Oq=64aCNgLI-uC9eU_)W$quwz7(tv2* z+>Hh45GnguZ#%EfmDu*S`mXslK~h|ntEY&7gS46{4=+TL@HUxP#a?T@K0B$mg^4X z82L1c8QV1Dgwf!WhA=F?_0(?}e28Dy4a3uSqjT|YwV{`t?0v{p(5D*(LK|5XRHE$N zxCD1)u?M8Jae2RG>{0OEuO;T>R~T9ffN8ei*~pbWY#^9$1Yeqo%0AfC#FrR^%0$w{ z^#%qDGSo>{rJNjiH`6u4A&2v?%ghof@p576UkN6q?YI!AF_Wxu=hjQ;!%AbC({|r~ zirJ+VU4;83wTCg#oElFf-h{hgC{X_6ozE~%2_u%IxoZk}QVI=mg|KW-L&trT+})R% zph#hyZAXX?N6cAJPDkD%N1sW68uRB%(4e~h0PUD!KnZ+7a__CJez=WBHG=AAs_W%h zY<<L$*{!IU{310tu55@GG7T^ z_<*Yqg1KoasUauo?V8{UvarsZBIRg)ry6A|>W}2Sp_9aJEPH#O_?eD&vJvdLM(oqZ z^Q~jEC6=Eg+;iPfdRoIrn8?^R3D5bed7%2u-I^Lw?ixw8%(Jr)?1J3A7Lq7#h|(+U^#rx%LhK~m-h%PT%8m^0HKIOSf%=#!DJKcC+$Xem zhfW|G5TX}!l%6wOhf-vhT2xP=o(2D=roMZoydkF5UB*eL7yGAGTK-^V=-gMT%o%SX zK~OlKHZVDf0*BiIPk+kTM*PI5HUb7Xx9xLNbw&Yd#PG7(1aa)Wl*7=2F`stGGq`Ch zSi|qBg`_NiP}PDO1xs*`pt(*0Lm`*UyJxN)*Vl!s+S)@>Q-O+)avwxK5XT`SjLd5(9;m$va% zsIRz@_T{5vC&Ar%vXm4StROC9p>$RRMxmgIkV_DG)?a#SP`CYj^=S}dI3#PU%Sfz8 z6F>XdvWsPmasQLxNJ1C5XBxap^2Tm3N-Y_2b=zlz{1zn6)JhNlx{==9EY>c99FM^I zQmJ*-I56ESR-N9srB2k>)$Jxok>MiFwjrnaFG0RJ_3edYzbe}y6ER9MT%he+FPuo7XS}+D5(o6gC$Sf^v-Tb}uF=~yl5UW!Fstdeqa)QSSF#qc$v{Pf^fvK*)umBaXQO{1U~ z+)1cMBT-B5d;gN6lG&egj+Ipc^W8e5M(daAhik2l$$PA-3;a^TRP=_0*epM&ss+ry zRrh#k5VnI5?NCSIW %4#P{Nd8l=<&4VWwBo(1sJUT%&tKl1V6(GWkkvu*^tszm$ z6IE=+&I>mn65+%5SNnn9GO6#7U%pC_=jWgdJqsNa*Cw|Q?1XEh4Uy?siBa#O16?m2 zzPQDz0P17m)?&Wsp zX!x5ZD<^>c#nC@yzY`AskZ}V4?1haL^xN4#^nk#Bw#Nzh%NFudxc}cSvay2M{#0aR z0|5SXkc|WQyZqGOI$>jDec2D-PZ@yqpSB#o%NYH~_N9MT)|UoBFIBYuBm9?)gZ*V< z|B!)MU(yu+E(3vB|KSV==L@~%4?PYL=>KC2`CVG-&jtbiFa`r&;`Dbt06Qz_&naO8 zfnWGGf7fFJv;EG^{97LY_J0o;^55{k%sT7;hUT}$i|qG41%DW`{iBnY?X=kcboxd1 zJB9QQTM*!H)AT$301y}FpY#5ba?1A4j=5fFHh*vM#XrEGQFv+ZpB;lhfIn>kAQ0Ef z`2TE>o#W4uyzCJ1&j!JO-@8owe*NbHehJ_|E>?C{HsGHQva_Rh_J7Jaf3HFRqxTYj02l=P$2@^wUVl?$Wo3V% zUj1VvY`_;%*Z(&7qQ?gMz3s*Sbn+tO0I~ivS}*Gd=;fyE9zCe>(Vb zd;Sr@53Db0{|FZc7w~t{zP~m2vTprt<@$Z{MUR6uI(3DR1I&)XB4K50P5NT?yGEO$ owe?F?zL#lu`QwG!X7BLH&f$xlkul24GQ`1&LPaGaCyMg_03@5e_y7O^ delta 30132 zcmZU&b6{T27A_p8v28TAoiw&>G`8IxHc8{Wv2ELF%m$5ZHMY~QKb&*!ckh1x*t6G~ zg}wH?GtWHpx&nFD0~uEY$I8ya!o$hN$yrzJ2M)o-(ZB$a4-N#3Wa3Q*i>Q2mSYeu$ z0Plxsr)j6jEdDeNrO!35o@%{FgWU%K8^G2uN zv(nYa_owUQG665W=HHmZKu^#6r!cWseJJyt!<}(vr5>yvL4UvJrB~rM@6P)a>YCT> zN6$q2?)R7H3Oaz^)2XRk?8bNbx6kXiu;ANW$IjxxSL?`qvd6JxcbXqpu1?RlcaKkx zdQ};#@9+DICERBfoLXG;=4DMYl39kuzq^*bX%g!~Y29>QA99q0xjJ&5oLAI;?3Ul` z3MqD6c2>;xEKb=2Pq)`82eZH74PM)xE)I7b0mm<|+xUP_FhY*7aM#lod_m-tF!ot+ zx8v_ezqO+WBz>XZ%CFmAh5&=m@7FoP>{%{TN&T5KS)RFl>$7^(pR&inHpxu%^VSj- zV%F*p_y}719je5Qj2--!XRg2ck7*a_w;R!s&$_C$ez~>Ob9LWjww$e(2cKPl2_N!y zl{vHsLh}L4XW#hMn>~MYcnorAd$b>&Y+&{yT_A0q`L}1Jb+@3DU=<)IY4#c!6v#Gm z&+q8@Uru^F6m#gaTEj{{Tq5=P?D1mxi95!)wh z`!;(}wzPz9p}rWEW^64sKbcNBZsw2Ry+T6RP@0Z!!c^Aqd8yqk$zkOYu7rZ?a>BA3 z`#<7$24i#MN387JZE+~9?DU6-i*e(43)>x9?K zk#Ak$DH|MSlcU6<=Bt#Qf@_H7!%yb3hoScmMOx*xbYI|q)Ku5*FH^g}KJS;6qsRjD zd{FMsdGL!kIo$>VT1q7se1^(yOd9KY6$g%<#OswACy^Z;@7K4pvp1gfjgIf`Nd&83ot0HC5*)ThTAhCf3!G zdaaGP;xdh&MmtZVdWcKL(AG4h(7+c>wvVkA)*!pBp+Z{^j91_QipGQ?fX`&MyT;us zGV^gbELE%`KQ7^yjut+N4k`mk&p1)+eG{iRx^5-EtUQ{<{s4jy#d^itybBY&WzMfn z3X4k{$dVogeMFCqKeedx*U3?XJ_YSzzE+;AC6%g0y5O+u2RVnFO&+d42{64Sdt$Ju zLoj07Z)dQX&><2XU}CrY07AsvaVuDUnCOxQLGnS*jvw>wjEtfYYWj{~;EkK12+Fzw z@;V{o5j*dQ0B9dmo)qRLSTJyB8=VGsgPy*nOikOc2botM-)LRR5mAWBD?F#al)?#? zPvq7@Sz0}s;1g!)mIn3O*|0n8#%TR=(6H1Nnso)7zl4Cw;fMf=ulqZ%_CLJ4 z`?Bw|!kk+By>8QJkn+mlZ9VEc;Wv?P3`O&8C0Dr39kAVN~T#>sK9<1^d{AwskB1ym}1gKOMUi(}mVd<1(< zXGajDEEw3OK6)xrU>pPFpfcgosK+BwaiF>J$at@H|pN5$IK*+`oZQRgD> z6UQ{4P4z$=O|cm+Rg7p3f)GV;MSVz2=~AWZ05wgTswpO(k~jd+-dk`pHmK zpO<;|(#;C_?P~&?ahP{eu{{wrBShT>K*0#?!1{%)M)7Imxa5X}a_Kwkwk>&FIYG^Q zckR#Mcbz(oAO$4LnsX29CzxmUGLwgLH(Z-qNa&m!CNeF*c_DbBu&LYU#h6pDK2juG z>n#hPE_c>7q0D7MmlTxETf~;$xu}$IkERpu8MBSyB3l>=9k-Rh6EVyUMy_Dn4b0Yd zz+sKi{nBS1c`~a{6wpSv5n>cS;gGU`?~cxl)%Ii!vo|`KTpvVNBJjX(ylVPtzq%oT zNe7$jMWBU9^WHTGYoL$kmPyz~HCXUfg_;>!Xpism7ycItwwE<@-|4D^8L<12abj;g zVDcLU^D>OZDR#zf2Ad%XRX6j=-Ljw&(D9KIIg8Ubg}92_vijSc{%#KCnQLkOV%hdE zFQ#CnX)wG?V`&9JhL)AN?YGu5QERP%&{3HlrKsH*EN6jRW37RrW6RHty}`6Q@<-we zM|gS0L(<=E;LHw~9g7*N^VLk~bOw{Q$?C;ynsL=X$!4%0e*5h~afd|uY5p|xN*l*g z5M`QdjTHOTdGH(Y{bsfpQa4HVcYbYUXvA~;1B#G)vIv%S*$rBn@ee2ZZx`lg3RD#z zwG5FgLh9R8)6hRksVmS_DwwwR!>7n6DN;x(F@ZCeJH&z_k?4U~r}2IN@p}CH`LoVe%lsKYrY&(WV!QBU%;?AI_Wf#{JE(QZuN?nVbjd*iD@$Gcl0Gs>?0oz%IZ*UF7M+f7f1}v z9-M;-GxX5DWv9lkT*j!Jzd9HF+3Zjc;sq15WXOhKjv1|H>7+iVha4f~z zp!}NauG=;et%X}VwV2g(hJX2c4rPE!SAs4ky%yt9J1&6pB=q|wxO4abbvnA;c{4w; z2PhBX>r$I8Jca7=GjWacv$b%Gq-FQE`D2%H6bKUz!XeaT_sj4YX1rdnSHflN(%1#n z*O@h*lM4je3>Y@o^iNe6koPl)yxHH`o`&(8#vH|};G2WR5co#at@-puu?WYLlJAWr z_9_(NEN%glWvCCL7OFCr^=2iDnLG*ej-SUdU_DLV2-lXFHvPJH1AD1%s*-S8uVcIv zk+dw7Ml02&^zwIHUB_S(&cCf)u^M%Y$Af zkKBLrub&~89M|u}i>;jk$#iD+AM)0;e5V(jGN}Yw;rjZYB$B7#5;^&BXHn=;{eIU9 z6o)b?Z2yu>Tl9Hr4rMY3vt~)}s)Q!9E%QS)K=YqHGD=e+#z?hL)IFE~tW%Z9w&M8giw5GHR6DVg%60lh8w&zU}IIz-B zwk8Hj;Hn(d=1+!^^vVceulbIn{i`nVLvNlhIe9QpjDj1Wt~hz*Q2RwN9p*A7t7$o7 zGbKAbZ(whx^O)}}wB2sbYuH#1GCT8rh+{Km$aGu6Rp;)QK^lCryhlnG1X-b@vkyT^ zlFig&gKn5IQ``J(Xu7{%>cOWx8Dmc*{$v3d1MzGy8Np1+FDO7bxRqm^B;Gm34G?|> zxfH+h*`Q)#w9)GYO~oyHS-=2Z{Ja%Uor&p6=z1an zU97P55XTE~>H>@Ofqtz)hxXgHx|Be*TKuetYb)!b?dJen*>8kvNK+{MVXtun+Y1}m zndrq)?Lzlxa$Mm4xY?ugn2GTY_3Hz;{V{M;;rQU=!$%GC%V;;opD2QscdJ^y;kvjsu4!+2A4w_>#7+F#1|ba4~wRsca5Q zrQ$27vexwLpvBN(T<^_1(zU9?572eb5?+4r1WqU@&MXtqg^-&V0h<>yC zv#ATQ8>$o>-FSos;I0`{fGBL=dDI$aDmusT*a_+p?%VS!hG@ zYJvWCkGq^U1`VPuow{+0cM(rEvuW@kTN=KaCzry9q_qB=6T@5 z^=>hKyl_TA*Z@m|>Qftob2{@Xp^G`5ITf_kd}x!{33C2A?jJ1gQ!|7$cl3$97WYBN zBaIuA@yAS1gR;@v@pvsm6crO5F_phWl&1`7POEZ8((xEWX5z3tLnm{XUEL7d;9~L| zEj@0}y+#hbj1f63TJg+cEYrWyMn$xxoBY_89!;Dyt7MMhOba?-UWJAJ|~`h zfa?B5t;NmJl-18M&uMq4RVr^@LPRysk+!`)KJ1sG)Y3|@3>WC*z>ztkurWGf%0>PUO!Iwp1yLPGNlxoYiW(dAnEnB( zGAi#wqba6S>$cmMc!jPwMq14Mt7X21N}ZqQ*KPGYWFuxTlJ3NxXM_=p&>5KMnW|FTTOev804l!#jZfV7T-StI8*a6> zuf^t~WT7w4#^ahciQ`va-81z=e;}@jKdr)( zH`J%5p77SU0n8!4qxncwPK$P=P^H`hmc|ov$5by@cBQJ}CG0EuR_{8D6z4r~?3+Ub zFXfix8$-ubNjdec5A>bV<;a?65M9_m>KegU0N}2V=BcYEVTMSN_*qo45 zeiiPsx3J|7c_GjtCQ6=K8cnL9U6uVBVL0}6VR20|6tJRW?c*?KpHGV_hwT^F$w6gL z{x(L4{llw(#rbOO+HRrRZeyEEu(7S&#$`Y6b9r3+9j`H;V63N?0`xgyD`->{SwrRJ zpr;lbf%nlCNqcu$%nKUj;=7ukF#@pwrTFgQR>yXk_(0-EL0~lw2BiimLEn7U^>!nB z(MIhDjKKMYxQ8nK>|25ipwkW7zb=c+7c`X$sjW1r?<{LMSlEcg{@TG^#8yr~61f@E z2Sj0fVGt5}Baw`I{tRNlC4^+*;b~C9t@;3j6tDjijIDStITSq#n3n}e6(|R?&F0H`!8l?PVBXM}7pGRRNV3{#E18TXH9@e>d2zs3 zk53*ZzZKR8&ewa<6O5D$h|u5;ats2kOdX8M^e(|>zRjhvGTVj_l9rm-z3`-0$jQ=) zAG}m@yffOfF{3;uBJU*lLeeq$m~63kjPvPee zJ3VHKl8A04H?A5ij4+&Zqwy489$4#a^)ilFdK9*zeDdoZQ$ z*w}ZPQ@5;LtRGcy7Hnq>+ z<%;dxB1}KkkVFI&z-3xsziy zrb0@Sv8jq((5f_Jg%~O&qaq2&=lrP$-JrA%iMiPxD*yFP_9nF2Sh^xhUQF?vS5*P+ zXQg6!tEMbLJpPxHmn^|Fv0V&-ld0L63(wuAsAA;}EqO_t{+s2OehjJ;$LpD%Ga=?? zPeirPLD3&m1$N#<25(ALs@%*($2hGSyV4sE`e@&AVVmk-Y38aEKQ{uZ8{gIta2>dk zTgf3S%WkdH=#{WG*}Q(^!5C@R7CDuo%4Nv%@`ZX98!CA@zu7r`^OxgQQN^~AmF}rD z3UF4|Bu-o}&f5w=-6xkwpuv+jx4*q>8NlAuBPOB{WJNUWMJvdl;vf88(y$1^^lA!; zyaPcka!a!`!Sxo~bo2t|^S94bkBsBN$!)6XLYTqXE|iJ&aG!V*@#T6`4ReV4nbM7A z^Q_a&oY)+dA6MH2UhUtCE?aiJ1Niin`Zk$hI+gzVWQc&CFYPOlVP-UOHTCwzzkh|3 z(4N>$&CcUX&zY)19HW*UEQ!7aVbH>kG9$9a#`i%#1z)i6Z{$qH@)=xo8^Cn&5 zmRf(wGHLO$2=P(du-4?bO<8EhsL^2T15w_=>0dXsL07Z6p;u<9J99ZD1;e?aZOV$Q zjpd_9Hu#M!Hi&AtSul+9O)lSpR>hJcwJ?FkC5xGpJN61q?uqiG{^C9TCS#>P%LP(# zJ(K?O?s^kXx4Gtw(6+Li?MA(?&dCQ$9rjFP;+6n-G+1Uj7Uc@X!yWJs07LXT1SBI1 z3;h#3G)&0IFSF1Sgu6OXTTK#MAPW}eUg@$@SV@Wm5;Cx#844yyEk1UV`mSz>S{_)~ z+$&%v!bROdyQ`y-H>5>#&p6maA{^?gHDTW|>%`!FW+gWs8X!BBo)QsRrY&ymPP#`% zAYtnF>Q~EGh-{g<}8nd^vmTK815rMW+=l zjGUO8u3gz!WHMianv(%G@=3juHXiV`zny__!F)T?S7D{hZ?Y-oMm1(c<(HTWrPT6@ zMw3S$z5ijXdS`aMyW|W8lwQN-qKKn8hRv~br1Ak?lqc~;zV?N(Y9EJW#{EsF|`SvZ=(4VZf|dff9~PdV`cC8F9mF))fGDOGouczElsB1CV{=@0xUJZ za)^aCm}IVM{OZ)vBI=J9g{oH;svj)hPDArwz7!@vV-l{pv{u^1pa?3f>3t!fkbGi1 zOWtc?H6SbxW2iL!{(>U`SUZ~C1G4m?P|_CyVhM!eXkg<{Cc$X zoSoxcK|;<+o{*qHld}QaLk;|-UBb5vo7Nww%-InbbDkd_{33}21S;;@Y)f%v%YK+d z{;p6oR`js+NIX@nOyYOSUV0@@A!Qg~Y$4>;7`%w3(Ac1H%uM*$uZ)vrz2`W4!_JFj z(ti_C@$)-My-}`y<(GR78!@^#r+_D$R;K;Z z)_ot^73l3i%0I( zJ&pAfR1FDENuiU%SQiuRVe9(Nic^qAGgzkn+*Eh6M&m8Z47!Frs!jbj-8QnEtYMxJRLx1KP267X8N!+_ylWW!cdc} zyV|XI6~68nBqhLo37#NfS5iVm=y0#p0EFM8lu42vK+1ZkGg`~=+^_{_>8-vsh?zw6 zzArDtG|lrhNIJL<^En-S%s77L{sIZzPVypk-&^-3Amha8DbA3J((40?5>r@M&slf( z@%x9GKAZyIeJvmxtZ8R8XDVu`qBc{^ zlvc!Sr+B%+tHV089%S)P`j<*@XsLXDggUj$<;v(@sO5t0Sv+bgk%X&cRu#Y^^-B7u z_M&x8(7Im?er8V`lG!U+0zMQcZ2HJe8{IHa%(c4sT6Wp=3128iV`eSY>?qksb34|u zQR}D}SEZkC1=xyaA3n>&2|tNFK+zZwDp@XYe&4wi0Kq#QgTvS=#cjL0B%t@+9y2+fAnKDf*f zQ6W8Cf__&1UK=QY=}*I?5WIyx_e1RWm$IZr{(^a{hlAFi=R{@$hAKO8gp)X7{o5}+ zeovM+7sBZeB;Bti-h}UOm*yoaTk5}!X5YNS5Zvs-HWi@QUmb{nRe#&=GocHi!=9eA zXCEV>SH|DKvr$1t&%tlN{{1~x|8e$G<)PQH11#?hEMPoV=@BjQu1YD+lu2uL_qgUpWKkp6%J*)A=hsPVGu;zaHUsV{x3g7;fv+~8mQQWC?hpJ{mY|@yx0o?X zq)Bc-;Jw>-)65yiwPJ6Xu%pFl7HX|urc_iTLPntm8nD*r@F3N z)Tt!I8O#6b9y+O*t_7lGB5rV2GekXaC0gx!tOQe)a}&f*@= zt$@LYa0-J_IOctcyl+mR`$Aq%OLjR?^;`;Q(h^!C-=mAoOm`31y18mRiKN( z$P@a+i+7})FwQDmpxQT8nt91iCv_XGJ5V(Ij`l@z*E@fIc!oqzJT-mzAuH`ek}4Na zl=#AmMwe%&NCSnQjT9yGCl52L#?SgU`%sFUXb$7zrO4gBE|>FdK!>YQR)+?I*5Sk( zza?Fsx@ehUCqcn$ODV!HI=>qYuaAkcH1h_oW{JPC-9H)BYk4YUy|kQF$6sIzH;|wb zT-5W0;u0YJ0Dd>Uv{76f2JzlwGl&33K5K9HbmF$(-Fhs2eMcV<6S^Y^{2$wWf75aq zXVeIDzin;Y{q}paPl>;riBn|r0baej2Yxm%Q<7rGyYYp=O?yhT|fcpO-GdVJ;n zWKp3lFs$QP11wh*-X`7Nsk9ykB^-i zJ$x9Q$cBDugQI_eA(X>C%?R}f@b6~}V}o!xco`Bi)6uO9(x|JnAZ|9xD5PISZN3_- z`N7r6RBh*)VYho@ntxNORgKp+G?dgPS=YR^%$=bu-@<72%M>bJz8&4X67?#{pP^}cU&0DlX@%l}8@q0V3s)zw+<*A!e(z~f4z!rRPlfz?)5B>C#g6Q)I zb~)W%Pi0N|uhOz8L!Dr&WLR$f6j%^`=>~&1&gAqHzJ&xTNgcRFb96hf^!fY82R$^C zv)`FiYq zaf1F0V9{p;o0Ful{uMAze`&(#aGGYB+104RpFZvqa(of^Qi@@)!tFNdrEN96`k}hX zW(9KmKAmLB$~m(W+!(No83x}(RwA=b4dp0m>AmPq3AfbwSo`wJCr0O>_;`0Ze$oey z9rB#KjT*5T%$~58pw&gT+!b+1j3BzxOSIgt#@mVn${)knlBMZzn*hlsn@P+3j&ER-shi@viONSXc&K&}I>(}3FdXGwM#jNGJ5z>fDwao{m+rl+WuTnu- z`0o@2!CDww3H5MBkovU@_qHS~t)pNmnEFUgWNv5}SvB}uE~}7+{NF#afiry~iedOv z6D$%v11W`c*^KxMJ}Oai}Y6`6|+kXx`D2C=Vd=VG%cwXG9KIpp;m}d!XI^ zOsyC@UEE8@^7T6Nv>Lf1zPhPDdD9IKm&+)}DAN7^8-{#{MN;jD)-Us$i$*`$uV7G|upQza7&)3<_i{Eg7zXEQsV|*@i8k5gO53T+gl6G(8 zrMjthv}jRWxqiG-2Xa(<>mN?~K%R*$9YqZYkxTdCnx|=^n+?W>nNta|ArdcLNt;$a z>TF5*xO+6m)Vp#;SuXK{I81m5N>11O!3%|qk0AN=_=hJK!9kddo~wK^M`OY{lLkgV!j}0-B!_-J_qHe4ynTOFy^c z4~C`CXEQO^;IhODg3VJaNrUlg$ z8h%4a`+uMIRVes0WrdH#5{QiPN7e^=&KB)yE}n7XafIsUK)zp-*sD)Q5E1o*V7KHX z8;F(4oyQq!$O;zM`(;1pF}b>wMj9fqHn-aPk2_eHM%N8V`!b-V&NrJS_pB?rw7X=w zW-{PhVnZ?lAs|%q5qIt0PBS?T>a^21SN62LzBM^KTCZ8GSy;X0XMDdZIiD&?bBwEy z9Z?xdhi`WH(b7w;%AZ7G(TEQHmiUxOJRStlX7V0P3jWHpJv^oWWi@JeND1Wv0b7jE zNv%i3&o)92fSav$+t7fDHfKkx9*=3vhOa5N86%Iw@Rhv28k36Lm$l;_!d@&p`|Nk4~+{%J*t5Q*u@B|9jmhO ztw^Ns;W4Zri}r|l_*WIdU!7t4i2)M<44a`ef#WVfT2j`lpwv%W`{*)5OQ7cFCnzO8 z$dK8}D}rl_b?h*u4srt~sMAWo_Dn5tUL8G)p^o*D2S!LY@UXIeMZ`3tZiyA*MSZ|E z=&m2a@@m@aTS}$mLOp>u{Pw!F`J$&pS$Qqin5k4O_1C$GJ+t8kkt>&{=6gJZl(S%C zeLFiKjpCNtVr2Xj=bR=aScC!heU6}(x-dX6!kx>pAB&Owu+&~Nc@aU+zVkfgs38Bu zS!E&=3f7P4%a_Obg_2Jzw^jOIZ3By1{>)U|T9g@Rt6|zHcWX)OFZ-5?=$xFzJc0&; z>(_QhW)%l3^oNC0s$)*c_ui{!2}pc!lPwQ`Bm9BpUNq-&C-A+BmTD7u!gUtN?gTL-Q*+ zPQ$g!jEqi*L|g)N=YIHIv4dQCdWCobNmET3QyEH?40EDsbLa0F@2AHR(EC$nQldZs z#5a<9D+S7adCK8C)%oYW)x=89eOZ#n>*z-Bi=KPF0i@u_8wgF zGtxA5KtLCB=)s-wbKn#L5$E70D6rFxDpf8wrX|};-JD%MEj`B9J3g*0yb=f@(Fm(< z<;ff*+7Dm)QVMKPHaKaug$CahUvW0o;@>2N+QDT4`_a(Ds692*ah?dgYfl3A4*a^` znvdUW2HZ%CIf_|8j|1YPZ{B7B)CxjMoXkPc8^ZCd-;D~tzo0`~>n)nv^X**t7G1b*%FPek4TYd_#p?M?E@{7`0?oqCrZii4tu>{d#mznLZU=}*RP!J zJ$Gjv*e>j`T9p%#@5E&}ZT_q=R+Qwj%#A?*Bi~Iq$wgyKgVsobR?aIX$9_}+9|Ac! zq&3{305oyTJGn9d_OqMyj)}<*YW>4~2>;dQbQW*v?697dGv66XMs7TL~up z{`O>M~!G5@FJvfyvnO@yZfT61`u&G`A2w_JG+s@Un_PUd_)wjbA zDsm6`d#HQ)*4F{()69B{TYR#YfDtREks z0cNiq?=n(tm!9ukDi^;y&%kS3>$e{3Z%rPIC*UBlWZa)U&`V@hL!{A56T80TS|tR8 zVy5_QQbtfw9uhw_40VymrXaovvExhEv&w~QCh#kXP9|hZOJFSTLe?=$`(&rQQ6766 z-c3>pPSHgae!R%G{(1BE_d2^lErm0(T(W0YQB5SFtp|=X5s?_uSrb^ zj*lsluijq7_&waCIlMUv zI%*tYw%4u}Q&@Vp-hQnTDhUjMv%BKG-#Qsz4Q8pIeSHgxe|3~!6h14ufChN||4fDT zQ=7QR1T^`C)-A<}VuvFi9*O~wYuKo~deW=B>bXlPI%2Xxn_PA47FGo5Q^V1(9cLe^+4$F4I z+J6?gm$SeR9u~f&L1`k~ptHa?ob0&=%xCOX$TrVtCJg1ag!@gv5oKU)JMgO^Zh{*T z5&^{VXZJhi7&lj~-$<0-nCPQEa<5jp14iotWf|1-X}5M3Jtme3BfUO3DTC64L!Hn} zXe#LY*JC`k@3Q+EphEg|0)v^vBltssFiq$~5PYF}3)fVSlF*F&5h@vlrhDFrQltJM zR=^1|b?#Tv6-{1%WnoMHs5J4jsMJ0s1|OYNTCYlE;qA0=0vu6v*dESbo9I&fpz*~7 zz8=*<&QgeZH4eD$bW_OakXwiDPLa#bkn8h=vBeIIE#&y%5zQ0%8$)`WG6s=-ahhBg z23R*srVwKc#wPn)z9W&MV7R9ewju8^6eB#1vwjhqD`{nF?Z$-0#q&3NMM}!7>|*Xg%EbkebEO5zxbysLoZ*fI z`sIoa`s9KIT6E_GIl2&ls6DVjxh^pHe~cupU0mHrxj6pgMBe1DM;;KB_eV4~Fj6ov zFnKT;Fh;OXV9H=JATt+g(1Zsz3fq6W{}U5b=S~IA4hr^Qg5cx@&3H0{1U=wj{?+Mw zP=RxRmb?i64sGj+1S0f?17`#Ecz*=Rc~kyfCp=JuHx?`Be_!R_to~x&RN?<*`A=5t ze?JNd{rAKEDFqg2&s!Fp>+h0E`(Ts*&&S_3|CAs8|FGc#1^AGm|4Rb?)90VkUb$j{ zMto@g_`33;MCbg!W3htjaG5B$|4HfpU=O+fsRi@D>>)QhC?0|uf}8DM`Vbz}Ez3m6 z{a5P$aEP3Lm->HHA~y(J4g-Rl^&j%kVBK+*3l&&2>OF)|@p_GuHpWHm_z@t8NP}*S z(og)=%|NAcuwLkNljNgH1no=7lI6GN;ASh+G;(i&jR&ITlbrK+RKOo&@uUM75PR+F zuK2vJ%lnG9zFF~uIk95ba$91_B?R96v3uT# zyI)a_ei=ThHq9-pgMIGb-OPxkR8Zs2?nKxeKQ?=~F8Q^{y<^L*cUGt_ORwW$ zkXbpJP=Y+6Gc75P$n5X?sB3`2vvMT4y6#4yYq<)JXQI*HP>}^R7hEy&8p`Y^^G>TOWy<%rhUX=;k-UP_250{J7w6*L zU)}B9?m!#msSC)j%4dzMnq_d&fbTs{}#QiZb zY75h2T6%M?Z&*GS$-M?UDJIlxl@zSRYRAnhVPZ&VtP}c?M5;vG-yhe`tEi%TaL!Q4 zO+YTjlqnF^D#kEWmyfwC{#-AJ1VcZj`mSwi^+QwL>ajNv69FW9m*-fW)b5q37C-bslS*0P95m)ZUXR*O0H)q&%wDFT6lA_FSW zXU(JFUTY{-okhk}vQIu{xhS!$k7d#llh_a?EQuFBvq2b_zZJR$(+sv{uZRed6VkEW z-(sIaR5zOj&KmGmb6hE3dJ+=C8B5eSA;cD1Lqe;-79IeCDaCYs-1tJ*KY zrw8KiM(@5jIek}wCR}B#LCWDQ_YMIzD#{Y@V66fEsyvBRebuqvk%;OxJVB84EpZEO zq^`C%JWqNbZ&(W3$H-@rMB~d!B#)69c6=dQL|6X!IBr}&pIE3!H35`i-0$SLvB@~F zshPar;xIDl&7ZfET>NT4YL44^eAe zL)dYyQkNpNxezpM(uZX)IRIbS_eEI4`(qx1axE_eXkyvNr z8U2jvtDt4|p=!J^f`)6ZX1r-prvoVIy6oW50685Ck`>sJ244@&`E1pW*Y6Yz6FX@;thy4SS<> z6rd!m3edJTO6II~ruVgG?_rW?Q8`ef$ed%SYi&JRMEk9JoX@Y^n!KYngiTp=+Xuyq zPQAB10q;11{?jF`R$F7#oXM_-G;pefQzC!C6wel&xph}0xS`QCkf$^GWcva9AOM0> zwo1rxj6=~dzs*wr+hW?ywRh3+&V9DVK_@NMk|^Y$wz~|b*&S4k_DioGUM--{w=)#} z(Rwti?Y2%xHfP8Hlkq9y*5tIiPyMT2ZH$?=-5iqw5bgf*TuuGZ$hL{&^85-p?91d1 zLFM?qeM_BaIQEf&C{$y3j?cxEon7N3YCX5))gH0#BJhU26xeb4c$jOu!OzR%ttr3h zUF1s3=oGKdre>MsN&KaHCj{``ZD>m=^s+0{=tHyKW*+;BY^A`l7$w|nq1~m^Ab>7~ zW2lf#t88T>lle~7q}qf`csyE1$)o9LXrHzCi&3M@btqZ*gpj{Dczi8KHR-&j;kux) zYpXpno0$K1Pbt2>ABsoLX0HOl)h7e=;7HFtU9*q6=^7+E7+!%)w$! znwUM^qVvI#d5MP`F7aCB5>6#X{XpFGX2UD_uAV@bm6Bmtbkt|X^`>+5%kPV5FQYdU zQm~Hh|KUiI{~!x))_>P)RvupN{|Y%kfm>K0#3&pHEiur?sNw$yBye+r-lNDMxOp1L zqWe&Bxc|a4e;*gJvHus1a&!Ih!UGD+M*;P3=|FIEfJEAYL~ZCus7sbV3g$)-xzK1EmfM7QN^@y}1ppr?Jk+oPr8^O~!rWTD5) zV|R$mWLBH&WZU8ERNHSjs1Iba*B?yaMn@4Mk0QU^_gn!Jk^*$L_$w)yPgd@{V=W)9 z^bKt}^(tL|_J6pl-)cM36<{@~Gi8YJ-0`xpFEE3CI@`PA5sKb*#80pI(SyhTNG-}C z<@Bmt;4Oh5LkS(?H8oJzJi2D}R`Wv%dY2~!)%$}<+oB13JR12b89O?}mmO~3G=@Ot zBt&*iCQEaGu-^%wn%F!*KQo=t6WHaWW}*BCoqaui~ zt-8{5%NfPo&jeiSSG$?0*sjAN8q=Am{~7}@XWZc%xgLP;H*E&orhbZ@(V8>=z+ol0 zhtEvmo}qKyGH+|VZU#(E{(xg0n#jVLB!L(iKYP*8YH0637z%u8CU$at@aePdqiYKf1iadu$%(O z1?Ot#L~OAyWA5%EY@GzBk6nBjGTf6L!DNHv#Iy22JYuyN$NVVTi^>?PhqYz?E#_Mv z&p2l*gh!rYT1v*^Mo(+h6_3L=d!wGsR6Pw9_v-vilAeM>tF0!9K`_=Ce%rgixSZb{ z49cS*t*MA9!0Wj%A`&~xqg*eqHn#=P&5Qb0$A~n6_t=PX!(Vb+qsEJKl`| z31*;Dh&1Rqzyvd(P?FoDl}E_m^XVIw{e|BWmtrrH+x67>_+-dLrvG}{vQFCil)EE1 zck1+P12r{*;@gR)-tvyzbB}gK-k`^^?3?OD^5(kUgrN>yS~!<;1Vr|&E|vsPHF{Kb zGgmf^yelN=wIZG~QfmBu%05-7*+=+pr)@<~V?Gu(Os`KGww#)A-ScX5NGJCh(_s9Q z;g2TxRwQ(1+iBl*DYVewF(l{6CDm#7)KYVOoSWC5`8&(i)sR{E=AtH_W_{_CYqXyh zyAasO=x~NU4 zIMK_#lux5zRgpMh+{m#rki*PD;1-11?e?{mPfkvC*xx_$o-Dkdt?Xv?Ganw_UC>TU zF`r%-r4B<~8VNTMsj6z$2!T}#>gBbh^tcw)m6dIuwWQ#3}GX}!x87ZI-noI( z5N$idP(dc>m>>I~==8(&PbejN`40$b80-{0d_KJ^nex&n@<9RL+t^suo~A#p=+R1Gon;=j$c34ls&{h^ss_Bz83qk zVz!5dq0W~|^KJDpKN@EeWGG5OF++bqq~Y~#ttZU2MfjcKc~%w2vluvEb|=Re73E;% zRYjVl#i(6-RrL{DZK8QGgZgacT=$r)IUxTjyaWdOv(S^N zx4DC&r@Q1cO-vL5zA@?=CVeGE#8J&C<2Z}$|stBv0!bpvFe(^xF;)8E>7A!B_zaOGsrdZa!(TTd>z-yD3Bc+#*q z&oW!@Nfm)OYQfXr%B>mHdbTrZ#b%b&LmT z{LP@7oe}cL0lS?BppDZv_tMc>y{aGljwqPUfsN z5YjIs>xVV%D~SS%?%qDij!~G#@NcmxE5~W9RA&V2*o^6`uOJQ2&^BBn{lp{QnojZr ziwCmXlY~=qq!qt_#Ku8Nd4x^t(Wl)1_w|gmW13dR;#Sk&*xW)pU6bbIpz z;Z*NQ&!Okd#jOxh*QyC0u20LSi&=8Oq(|bN9OEf+5^%MO(}^TJm?d)i0r%Q6EiFWC zR{Q_8^_Ed_bW6B!(BSSKT*C}A1A_$%7F-itg1b9RAh=8L00{)Q;1=B7-JKBJolD;H zoqNxle80N8R@L5BwQKcST~$wYn5F;Kn6c=!zw|0@4CO1n=Hm>@BFia`!r4)+H{0aV z=gejB(ZAqG0-gpo@OPEElRAA7Y%TRIiMtbjh=`MgX06J6U3MRLN0mS6MMNa(T3IX! z76y2@p#n~YDI2c)+G`vbnY#zl&$kR4B+=H zoKyS_lkcw>*J zM?S~NI-@AbXsvC&PsoC~{K_Vm#2XH2TK zMt{U>=YNl|IQb#o@_wTQrf-f)aJF$c*QvL?yuUx$u3>@C0+|nvU-NtTl_?yQ3{N=^ z^@?C|(lxY!VuOtPXWAwUgQCVGS&x*8qFCttJ07S>^X;AT@3cKMjcfHlLWuP> zF&t2MOB6psDJIc2@XlKwYz?tsF~#bU=;)TD5#K7EPhJNJZn8|9Fke%p*pKqooo@fnTCN42zsw45G#* zfhD-WKS6i14Bu$L#(i&B*T#?~JAH9^14ia^9#9HVNQ#eyfEdga)@#pax>j7dK0s(? zTF8`87sb|Q^)bF(gqQnQv{SPzrt=Qou#yJEE_Uj;UG^N27DZ~jTGVlzy@uD4T-J)g z^@tH(%^&VZxCA%0%n?=+_Y!uQMZ8v%Q=ZmOhq-n-yem6_6|~HpTO)i?oa4lL`R;>k zqbpofZR|nrRVfQ7*Z&^1E=BJ$cys#Kpc)TiWK+@g3H7gC#9wEq+81yVHd9doA3thu z44tLaHi!ooB_C8V(k()o9zP8|4u_kI1k!kad1;tAT+2FLn=}?pI*u8buTr(Tw1i*K zooWbM5lQ!?hD{uhDOBBlVmaQIs$HB+Co4KW_NUONl}LNFSvWz91Q>lM z{aKPBwbq*dk@I1GP)i@DD50Xeh-h|nb&p@cX6}c3lD7}^JgKf=?hem0+@i1>12B`i zqk_OeDQ`95WKO4m**3MoAQ(FyOT0{hK+f&cx;(4+16JAOvYZK@lqn~7=n+SBMTf2D zbNFszv~_5Jy^k_(ThOOC@7Ywk&fK%!dta$Ve0&OYS`%7l`3lXO3r&vb3W%fnLTu4@ z6fs3NT@56Ypv*#)X2z?9@i)Wb;->a z!!m%18dzdouaNU@<=##|=jpKTVL}N%hoF{y)j`rR-b6l5K{&TKWraaB_V(D7UGj3Z z^~Ta6S8%U1wxOtS))fZtZX&7wa#C_OL*$E}xydJ?g+p&~9Yq3i_P*l`{M3@t44Aa5 zqAUDrK0eMNjxO;Nb>hpm1<-c-61$C6;?QaTp5&=szDX#S3!TPJEVVP-gnHA^HI`cX zutqEW2tP0eHXIN=4KiPb9Hl)8gC-U}KDRv(lKfKZk=H?{}}n;pp8u;U3@*T(S6 zv%*5hcuo5 z_O5jcoz6*k$5K0%O!FI(w><+t=NezoQI5g5xc7e!^%=EY+X_7x9fpukH(hOYomV_B zUGDgdx))xduW)hwO6U{?EaCQGT7o=My?a{}AvikAGRCuU?A6?|E*PwPg3a=MO|nkF zhKBg-S;iex4z=kSPb76l_oXoMsmhP^wFP4PgFq^p_r$@qqHVkz&xyq*-CvO|QLpjC z_-<}RTK&7My)7qcBMKZ!y6*bRGWSr}$YudSUC_PQ3izY9e z?jBthFvs6LTpX8Nv0-=wj99cRM#ghn8g#e0)vLeGHhC*f`kc)^Rw2>j!s?qrO_*+e zYXZl+_H{aLT`i!&#qv+=A?zl_nxH#)*g=r+1|8Ee)h7N>qkrv>U{J~i@#|*E#*w<6dmPfUyN2EDR|;Y$LI!?#qdb0#5$!1xxgfw*kR{52bh37 zt6^{S9@JixxUQX$p5EoDm z_~h(Ip|FqIL}EWwSbP8TP<^dlFect4n#hR8HhO;Lxy;exb6YMOS-$bXJwxvqRTl=& zQ1bRp`{IT73-SkumyxoZsceM_&aj@T{-qf27niZyeU=-h8yPGZp#+^-p?Yku)VtU? z`o#J!<6+LnF49gcE*d`_+BP{7OS`TjfKeL!CeumyqR4B~ue>9pxo%f1@dikFsbwf) zG2Y#qG98x+&`hmcdm7$Ir&u*VxQD1l%x8?Z7XF3VV> zw|IS22^;qGpJbvpj_H&5gNS_FNc=F! ze_D;GTB_XdtleE&J=T1HMVd;+kR+GBAy%1NFSh&ZT?~DcBs(O=NLkY2$Zn-9_FYJT z*)d>!CR`a}-u1aAYuibk1C~BX3tvg^H_(w=lYB)$^JdiuIXx|^BGq0OVRtl^{*$#E z&pjCZCRG~WyFk9AFyC>axKgu{sG_~7*v7`ZW^!_ZukyAM7u0SVxFUIlv46L&>(V*H{)7X{J`?3>|!*!(niio3kh!H0V0KQP)aaRDLVBsxO%ql2@I2XOyTvjN(821QB87*Ie%B?r3;{x8^uw+t9_8h93p&y&$?sP@%lc`T+%aa(y(fJ68s`l)RHm+ zDx}imuh!$2)G(#A>hQ%dW%D)Is>^+Cr{QvB%m=3dcL&c9Qh_D-{e7fnzzUy5@mvRy zBg9Agt%=#8FTV(_(-yYmR@1TK3s#6*)hfUI%&{z^boX6Ow3WYm=!hpGlZ51J0M(pT zA*v+~<@X@t9Hwle?QDM(ESwWtW8Ow^+-Mp;(SPfk5Fi-(-+U<)_)n(uc{5(zX5CY! zllLjpc`D7t3w|m$gJ>W?E}Gx>Tu-%Uo~QaKgbPRm;RQTBL!OGGI{#C$h5oLv{s(OF zR0;kM*n$TNt_W{nf`bQ%RaE`3grnkuzM>HT0Ki=Txp4n;;o|-00uqUP)kFpl7KwA+ z(2JXFvLgAN-u-um^`A|Y<5sc=<3d+3ekXb1B;#V6+fn{o2#$-X!zcf5@)Sq|1aWf% z{wJCGAMi)92fCBiWb(o6wp4;uKemR#uT8q%Sau=$+47>Rd!G*J&ohyfOl6e)_JQ!!(daK>&Ic<2Mka$))=2F2lhHSm(^-42z!#7?PM2m zzhk;w){?AV^KYq_m9MTGe&zXi3wvCC#TCFDil+i|Rm2dtrgT!brnrrI{1D^$Rc^pP zA*W^_Q3&Z?hM-e78S^UVPKI2Dx$nx8q%b+acQ5fLCV{cxYLlDGOP{b?nAV-$vWSut zW$2anHEf{hEAuI{z~j>A!vuE={BxQG1i?_u+bww5{7EEf!W-r{_3?&?<2ycYq?Fpa z{cXO$6hGaWEal{wzxga}YHBoA`Qa-PG4qWDdX)oVo{?x)HAXr6r0AyI+kgzlSK{lL zN-61IMpO1;>ftj$KRQq;7h*xHXZ+H9L`18iukHpLMM~wR7Qwp2L-S$@Ymz%ULdL zmTIAVRwrM{k(1bRf^>~tx=B?tnrSdLxC13bJeJ)&UD0zhQ}I^3Q2!*1>F4s>PYJ}N z#wSc~4~m#yP7!Qv$r4(;*|Sj~G-aN6H^spb{pOTm)(}@*MT2IUxreDuFe@3zWwMa~ z42S8TWw&zB#?uwt+5tR%To&xLOm6{7@Wy zS~dmi{KA@qo((g*6$2COC0ml(0VZwb9%dLsCW0!9CWHS-<>1+A=*kc$7RrGDa`}Yr z{ks(cbwzPi&_MsnU_0BAN}8%yA0Mry!-C11A(iZ;k~PeY*9_S@i|d|#HBtNKW?UqD z41#H%T_2xcghL?ZffdZnEhd&$b7hTRdo2)j(b23Da=KPqbC4ULhvZidDfUj`_u?=g5DhX{ z$WKKxqaT=$W$KyjeJ@a|qU=1WS5x#KbO4W;BT{$RM)7FYL_D(1wI?!_5irjRq%=1S z!VDu_-uscmCaC{rkX4H|G8=!7mueh%+TzZ@aqcKOHcE5}`!y|{qx+^g7_gE*^{c$X z!2vQ?esZ(FPg#Xe&ct*uGddnXO_ThiV`--H{=LUFbdGyuL{UvcSACzA6IAYy+^I?Y z%aIRY&4oy45oez2JVPrCNQ$KQZqHT9P=_yKWuL5=E={>K8Qq{p)xh3VBPnfoh+& zKH3X~5M?j7@PPnWylIls!p@;Uk2E!6zfCR~5)wSww!i8_AeR9FfnC_Jeb~;y_Q>Ln zjtvnde<0P?g<&64$%9@VAc%#d%0MT=H-L7D)8Ie@FF=5H zacO(B>--3dfFm&|DY7VZgvy!JDGMiROp)i&aGu9TNwxG5G~ z7t}G%mUu5VJ|YFX4J7jnd6Ta?ySIe755>!^v^1DZJg=j*x1J4ltS@_F;JJn~eK=o_*N z5F^Q8M~3RzM#_;$gfWCWO7cFqze<*Bd$*e-ZUuKGU0itu<5%&W;?7cH?pc)xSax^GIm;;#07g3F z*WaL?^1aT$x=V^xD>XJGe4R0ykf8bFM75yfB^>tFKu-16s19!8xYF_6arn}HdmO*! zTwh;&LB@pY?YsxiMIr*L;8+c&4wU4`wOUJ-nU3yxT7CK5X`|Y~+FEr&*<#Iodr!#? ztRCr%JeeNd0eTVOVG|`hteyG&y*9$WfO*m&`iRgC7+t*<%I$s;qXxfG@Q89_v{4)dj>BVOrkQrQ2Pna3!`WF zKCY6L4XuvHWF}r2bw#MWM77z9TN>1Ifel|=idFOEP1;;m7stR8eliV^?Yl>6v?#UX zYx!pE>djVZ9yX|}^s1JF>b{h2{>B68Tse2KS-sT$mrTfAtL^WsYYJTBj{zTunn z)WmoWoP-1{EOyQe0sEbmA>3R#g-`?DE(3VnD=mY9l(inhWXqELtnGBX$Z(8(0oYQr z+7-Nxa&^^=s#RG+LcOm3%d~s-Y;-xKr8^ff%GeEyv+PaG5aT1v7Q}&H^z9-AfVnZ6 zYGNao2GpmtteY~SKtRX00cTcv_jXzm3JNMp8>{lUY==tDlcmR^VjYqLY6_sJJ7;M@ z(cEOis80U)t4H0`c5~*w-u{74{jhNHp}?j={)1i4mlCYmgKPFY-Y_>aqYf=hoS`%S z*Rk>O$uESZa+q0=1QKV$hc-6~CL}5r74za)o)Kvb&Z{duzv6ou!#uWIc^9_MrD5qN z#+t-4{3-r270#T*n)@;tM9Sd82KNFR8*3!U@Vu&!SMwv&9PT}<|yOLho+B{wk z$0Gh|FO8F0iODPNIAbt`J8CZl8*@L;lG!k#E2m3`Zgk{GQ7o-&N1R?ovj{>yck`nv zXU!{L)TF}AlJADwEldvSIvA#PBngH}in@P}5SWl zj+b)SL`z$0u{d`)QVxN=elcx1n=0_WHnmtP$@YSPX*^9avA%_|x5D|PXsWY!qHK zOM$@40l0#+g+gKXo2BqEPv0%^r1Ryt2O2uK>fPd*i@R1YNR=Us`dDhU1Ma0Ex8B}; zx8VA$hDXHssD}EK)++0Sk+Im1el}L_i=hi{FaL-A#W2h^Q`d-xc1g8_SWzAM13|nH z&G%*Mj!ZQ*u6+8fjl?4*!x()Xoni0Va%n0WQSo-mIA_K}G2C;@LRV=Fmj%+5lnlGK zqe8oDY{X252+BNQ6{9Bk0*+(v!EB#0Wx@5o*u7zE7g35XIhy7*kkKe#^}dw_Ad6RO z?Arb}fy|QvW>TWm2l8zRvdO>{9l9X+1+J8{#-WJJai=bhnwLu+{lzk2poJGh$3d>c z&B&h+h4WvEOLyH8@LqYG;HHQ*i@s5F9_%SOL|#ftTERkrEpJsby~+sdOiZxlx4Rwq z)qFh|wBx$-O!u>Z3`LiV4!`ub3T6MlGv@SLJhL6OqpOE1fy&T+`xjkMfHR(g z&a`UVc?O2`a7hHO+U<1F!ul;NbC>$^4y;kBb z_r)3J#o1IPEMCp*d=~ErA+5o}?pyw-g|C3x3JV7t7mJ#^J1x-9!XEy;{IljkvK}U` z08zH_w&U4NGmg$~&&HQxpD%0K`9W;_dO50=Rd3>DSyWo`d-Pdf7Cx(U6-kKxuweIr z=gs&s_{ew-Slx-c)#l#qJx+@`qAJ*1cePI1@nb<)=-&}Y4u)s;z zP{LHXL%=Q*^V>`of6WMkFO6e5wQw=F*Hf9q^)2_XZr1a@py2=36^98!$2?+hfvS^f!t+`upd2ld&4l~>mJnD zp6PJhDINhavJkW79hzj=GxW(<|EEE z+$Z9AB>%bwUXocz?)*&t=!fmJb4nb^_~WcDD|h5x3NxQIBv4pL94CTunF1Sk9)_<7 z_N{`QMnsP?ZlUA_=g8w@nzMk^#FsitDTSw(Msrp^qAUZaCW)&N=gfy2zbY4?SBV!{ z--elaEw6m&E>?CYj>E(K}MT?%=^DjLQNm3u~{i7i{M5g2rFEzlvGgoDMY zsRHDE6yjZ8b?sI0LrLeVj`JrD81-X#R$?$XJ18nesC@_zf_!Xmw0`Wb+JW;lu@q|r zsnk0)!%dWKk^0%h0?tzU<>&Y#(FK6!%_ReeI#SqMk^~kJs_vgMvQy zmtm3MZZMO#CmC;;Z4G{+teetN?Oe3~vG=-smsk_KVq^WppP1AAL%iDx) z%L#~tP#B=f)-o16iApn@q(AGM(}7zsqr|yCNh0VSMj37mx=Y{W<`-* za#%K~RvLiGNjZ`nT?uhvf>^gMNptZUGi}MTi9ta7UNR-SnnV;1l z8E&C%0rjG@rJY+|{-~K3+>1cz&%-J#a^l7eko_v%RJpHGpOJ&U?O(rfjwyq692^|k zv}B!mN3m1Sl#QzeL@)Bqz`9#O*wnSw+mWn^gG)kgN0AvMgAxhoZhd_(XwkxP=HfgL zqQ4`n2T?gE&S`uEQV? zqj{=<61ltf4sH5=qU^>7xo{>W=YX7-=Zl+rO4~6ax`N~j8P0<%%^=65B=wZs@wcA! zoZ!!Js%d{vJUt5 z$D(kZX)37MUJe;nNPiSX&2e2{_2rW)c6ZM!w+L)7RLv`QL=?r2-TLM1lFAlfagxo~ zICyY2v#04TPX)4Zfm+^ZYEsHqG4e>3ytTwoZ^6=#^%02~UA5TDv(2-!sB|Dj_Hh;@ z|6wETtD3D?sK&8GMl6*NV*&42c^3~}y$eAk%{(lY@(c}kuOowK8CfAlC*{Yo5v)X^ zb*;1d$~k7|(KPqySH$xHWt4;6C>MO0I!fkx`H>itnUZ<%5ps7xZS62m#*aS+J+^k4 z2Hb-qtj(KMasZW{jpeH|aeeanHTW$0>+-`AEF|7k$pbozt&Nv38*8fq^S#}@V`tZd zM3MTph5dcxDfQG3K05K}2;B)&o7E);#f+)h9flPI!&dXV`BUbWzwQrM6Bi4VvTg%; ztdFM%Ndx=_)@Mmck**oD#z$Am63wdWcqOC33Z-nE#i;e#ymbNH9ETVbfleTDk_?_+#%X=Ng-fUUQV@)%mI{37huhdtxiyM_yxkf5< z2&hp76;@76G?-f1=jFGW#I(9gncCHnrD|%Dr)bCXA&mXn{nh14?T3)MXi|}M!)^Q1 zy)w7^OQ914Qdtd#)N3PCrpOYR6XKx(mU=zpGnmBdcr{yKrD~JhVIo05KB&EPaZPDs zRd#(Whaut$x8W!%!-}ozxne}81)zmq4%d=%SrPr|E9{183&DWYxZSpL5I$9{{=u&D z#_?=-ejhvi&hy|=;Ocv$QU8|W4u8Y#jYmC??JRG#y-Jm2p`@A1jb4rI?1IW{sLvI` zg#BIQM}A3|c8P%b=qdO2+WgvVYp-EE*BzW%L7%LUWp^<-ob^-ge59U*3(gGB9~t+4 z^N*!hliR&2XJTv)cXXgP)%`+uJRSA2Le< zk;Z$Mi^d4g*W?fy-S2~Uy_+8MzDxbecIKzZ6d=1SiNRnzKAAagj!{cDi>c ziofi`&U9E^?f$nicAK#grejz;MmqtI>NK8|B#L(3E!i zx`eBSMIrTV!lhFa2aNIY*&%|?1OmzBvFoo#7^$M0^N-Lsvt+&%cY@2gtCiQoUKwy_ zkEF}QiiY1-Z$;nukzM;Bhew@w<4%59+P*b>BXW6kFUy+I^zqPiR0vOJ<91e6V@lFX zPn4xR_1Xt(?(->AQ-;jsMjEnw^s`5X5rS2;OWb$`!M;oLq;r*~VMX=bw_bX}n{>cs zVwkdp(bg>~V5$F7e1e0y<+4+irFi`|nLsA$^qzh7nfIqdQ4GiA4wF(c|(|P+O^C3P>KT3k(9j60bT_GI(@=?u9+EwmNz#ghrWUI8G|yf9!9eh!;^6xx&a?4Kj=9 zx3A1UjHEFpB-b;#-3gCNx?QxVe9J8}vJ#qQ+C&1|kL2)2zSCa?}e;*+i zLnvd^E&hd2J6l8k>b!N~ldhk?B=s?)RU}J#Dhkk(MsE020Fym2$}VkefxZkbCm2Go zeh+x#L_lZbx1H@2yty>gk59i8YF(Z&J&z@7iY7sXnhg<@$CVqxk9tSj@P2XCy*K{V zQk5Y+Zh$+b0cQ3O+MnN9T;)z+q_hb#nu1u~2{T-8DhX)c!|f84!#>Z@eI_byRnzRP zJ;pj|C_w}p9c8;A1Nj4!AD!m$%Sx2}J3YIt;r`MC7XLJ;eeS9`* z@!>M!lWeax5gi;AjU#|bE2Ox+MQJPufDMPYgZ@Jac`hX5;gO^ub95aNSV`<<)wj(x-#g7kH4L*L>MpLWdl2UWlC0S4o=Z6~ES5 z81WX-?|1!mt;D52d+y1hY6!uGeo^aXzEVmW{_SH{hUuZw2sEM-067 zc64k#!XQUE#Fn62trI4(DB~39l=$-IwFV5ZtCtkk>1_a`>3Z3w_^hB;o1P+M@b=DM z8yXqXy@l|w;)Juy!?OFJp*OJ|B^GaF>V1pwZKK1>5zYk&CCuP3g^9H`!g1rJ7_Q5l z`gWS(46~bVdwBvmTcLYE{192VWT_Eq8iC>VaH$z$+5x$j9e%6A?8p!{GR%%Gx>c5e zuOAn&ZV|VI0m68Dk@{||pEP{Q!RATOCBPJ&SOHZf{~^mlfQ7!;kRWvpMER{M~^ zVz?h@tpwTv=|*{HU_h!`1}wa*wr}Cc$Lu6Jx&H5zb1r&B!6dui)5f0u%{7$o+q{U_o>L34-ZSY|tA`Qz zPqHf}fklyRO$H0-oC8RiO^QY75x%Xa2r8Rp9R}|@EJ8+YFn-{4-APXE5nOhz z!MQkuEFOlvG(axHE*ecg6OW6mMtSgk(aj!G<^Ie@zLuzWlcwrUlV)uN^fj*3CBI$> zn;=1-V0x@-PX;#FwSMaSG*Wdf^Zm;JRSNy*Om0*zkJqydxkB>nwdp|w@#eACS@dDK zE()Wa=(*l;qbs_ypE6xyF*1s3WXz!qO)1;c7Fu}g^q@A1e75|%!~ul-+QV;w&*ZCe zjLRnCi~>?=71^3X1BrTdeUuSwD{YUE>%2I`boA`w+>K%BW;6q)b@avb>21mOjSE-q z<*(vfSo!m%dKVz)+1df6S$F5ol@i{?c#MVWpO5yNk>RvCJ)=vHe_g*R1;2~^#%^D( zhlck4Mp`2dg;93*ONB!?!*^0osM@DdYH8afzY7p;>=)CqThGPu&U3aBz@{@U;mz z6bR@)T?uiv8-0Y(zu{d_o;dkU4LD$2-lilxlsE2plM@jF;)2A{Z^>|gpb*g09{1~}2K?6d4;m2k)DQ6o z4FY&->G&572;liWDf3@605=!!-|K;)|H#6ghA8}3;V0qW(D{D}1A$Ld)c>SCnf>IS zfAayLPg5HHpaB8D2Os>K4*~}Lufb3I0{}n>==ZSBKNvy0e_9NL@NoZSF_fG8FJ&MQ z$lvSnJT9#Zfx1-YIYW1hwY{EG&JKE=VGG+qGcFIf=a z|Ko%GKleW^_|#VO?*+M@{s;NDFbMjmXSjHv|2fb9IZiIn-?7C70&)LK_P75*0Pt@p z;=e56;^77SY26bI{4e1ri6`1`1m(YFp+M-LvLFBm_@`$;03ZnV=Q(jb{r>VVWq5i2 zTJXvHz`ta9A%6wyQ|tr(@*wZi8UIIV*#C`wE+{wX&j{v%LIHo%c>fAQE?yw;Pm8&D zxqc&5|K*t{FZ>3M{txZR{~!Pq_~*HUejn(+7=QC||D_BF@c+Zd1^p{#Ku?T+8Uo@0 za{*v~Zo&io`1Kd7AO^m(pM`H}`+}VE=vjfWg4OqWY=C z1O77>z!2!)Z&mQ$Z%hdI=>YyP4g!99>;6BQlY@bI9N#|X(~4-E(l#cxG*9RC&)8vG m+o$;|PbNP-Ji&DxoeUhD+#HNe&>#>nHw2A=L0mxs?f(E ast.ProgramNode: +def topological_sorting(program_node: ast.ProgramNode, + context: Context, + errors: List[str]) -> ast.ProgramNode: """Set an order in the program node of de ast such that for all class A with parent B, class B is before A in the list, if in the process is detected a cycle an error is added to the `error` parameter diff --git a/cool/semantics/utils/errors.py b/cool/semantics/utils/errors.py index 34b873a80..db829879a 100644 --- a/cool/semantics/utils/errors.py +++ b/cool/semantics/utils/errors.py @@ -23,5 +23,6 @@ DIVIDE_BY_ZERO = 'ZeroDivisionError: Division by zero.' +INPUT_INT_ERROR = 'InputError: Expected a number' VOID_EXPRESSION = 'VoidReferenceError: Object reference not set to an instance of an object.' CASE_OF_ERROR = 'CaseOfError: No branch matches wit de dynamic type of the case expression.' From c8e41f86d8b53e54c34a667dc3b21b2862d7acf6 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Mon, 30 Nov 2020 23:40:04 -0500 Subject: [PATCH 089/143] Agregado error: 'Main not found error' --- cool/semantics/execution.py | 12 +++++++++++- cool/semantics/utils/errors.py | 4 +++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/cool/semantics/execution.py b/cool/semantics/execution.py index c8c2650c9..93c8550c4 100644 --- a/cool/semantics/execution.py +++ b/cool/semantics/execution.py @@ -3,7 +3,7 @@ import cool.semantics.utils.astnodes as ast import cool.semantics.utils.errors as err import cool.semantics.visitor as visitor -from cool.semantics.utils.scope import Context, Method, Scope, Type +from cool.semantics.utils.scope import Context, Method, Scope, Type, SemanticError class ExecutionError(Exception): @@ -120,6 +120,16 @@ def visit(self, node: ast.ProgramNode, scope: Scope = None): for declaration in node.declarations: self.visit(declaration, None) + try: + main_class = self.context.get_type('Main') + except SemanticError: + raise ExecutionError(err.MAIN_CLASS_NOT_FOUND) + + try: + main_class.get_method('main') + except SemanticError: + raise ExecutionError(err.MAIN_METHOD_NOT_FOUND) + execution_node = ast.MethodCallNode('main', [], ast.InstantiateNode('Main')) self.visit(execution_node, scope) diff --git a/cool/semantics/utils/errors.py b/cool/semantics/utils/errors.py index db829879a..ded744d50 100644 --- a/cool/semantics/utils/errors.py +++ b/cool/semantics/utils/errors.py @@ -23,6 +23,8 @@ DIVIDE_BY_ZERO = 'ZeroDivisionError: Division by zero.' -INPUT_INT_ERROR = 'InputError: Expected a number' +INPUT_INT_ERROR = 'InputError: Expected a number.' +MAIN_CLASS_NOT_FOUND = 'MainClassNotFound: no Main class in program.' +MAIN_METHOD_NOT_FOUND = 'MainMethodNotFound: no main method in class Main.' VOID_EXPRESSION = 'VoidReferenceError: Object reference not set to an instance of an object.' CASE_OF_ERROR = 'CaseOfError: No branch matches wit de dynamic type of the case expression.' From 48491c9df031b133dc7153223137ab0b0b56b66a Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Sun, 13 Dec 2020 20:53:55 -0500 Subject: [PATCH 090/143] primer paso en inferencia en condicionales --- cool/__main__.py | 2 +- cool/semantics/type_inference.py | 115 +++++++++++++++++++++---------- tests/inference/02_program.cl | 2 +- tests/inference/03_program.cl | 2 +- tests/inference/03_result.txt | 6 +- tests/inference/10_program.cl | 17 +++++ tests/test_cool.py | 4 +- 7 files changed, 102 insertions(+), 46 deletions(-) create mode 100644 tests/inference/10_program.cl diff --git a/cool/__main__.py b/cool/__main__.py index 86bac5f57..8a9256ed5 100644 --- a/cool/__main__.py +++ b/cool/__main__.py @@ -77,7 +77,7 @@ def infer(file: str, verbose: bool = False): if errors: for e in errors: typer.echo(e, err=True) - typer.echo(CodeBuilder().visit(ast, 0)) + # typer.echo(CodeBuilder().visit(ast, 0)) @app.command() diff --git a/cool/semantics/type_inference.py b/cool/semantics/type_inference.py index ec1423cb4..6cdd95015 100644 --- a/cool/semantics/type_inference.py +++ b/cool/semantics/type_inference.py @@ -33,8 +33,9 @@ All nodes has an implementation of the method update that handle how to update the type by it's dependencies """ +from abc import ABC from collections import OrderedDict, deque -from typing import Dict, List, Optional, Set, Tuple +from typing import Dict, List, Optional, Set, Tuple, Deque import cool.semantics.utils.astnodes as ast import cool.semantics.utils.errors as err @@ -46,18 +47,22 @@ class DependencyNode: type: Type - def update(self, typex): + def update(self, _type: Type) -> None: raise NotImplementedError() def __repr__(self): return str(self) + @property + def is_ready(self): + return True + class AtomNode(DependencyNode): - def __init__(self, typex: Type): - self.type: Type = typex + def __init__(self, atom_type: Type): + self.type: Type = atom_type - def update(self, typex: Type): + def update(self, _type: Type) -> None: pass def __str__(self): @@ -69,20 +74,20 @@ def __init__(self, var_type: Type, variable_info: VariableInfo): self.type: Type = var_type self.variable_info: VariableInfo = variable_info - def update(self, typex): - self.type = self.variable_info.type = typex + def update(self, _type): + self.type = self.variable_info.type = _type def __str__(self): return f'VarInfo({self.variable_info.name}, {self.type.name})' class AttributeNode(DependencyNode): - def __init__(self, var_type: Type, attribute: Attribute): - self.type: Type = var_type + def __init__(self, attr_type: Type, attribute: Attribute): + self.type: Type = attr_type self.attribute: Attribute = attribute - def update(self, typex): - self.type = self.attribute.type = typex + def update(self, _type: Type) -> None: + self.type = self.attribute.type = _type def __str__(self): return f'Attr({self.attribute.name}, {self.type.name})' @@ -94,25 +99,46 @@ def __init__(self, param_type: Type, method: Method, index: int): self.method: Method = method self.index: int = index - def update(self, typex): - self.type = self.method.param_types[self.index] = typex + def update(self, _type): + self.type = self.method.param_types[self.index] = _type def __str__(self): return f'Param({self.method.name}, {self.index}, {self.type.name})' class ReturnTypeNode(DependencyNode): - def __init__(self, typex: Type, method: Method): - self.type: Type = typex + def __init__(self, ret_type: Type, method: Method): + self.type: Type = ret_type self.method: Method = method - def update(self, typex): - self.type = self.method.return_type = typex + def update(self, _type): + self.type = self.method.return_type = _type def __str__(self): return f'Return({self.method.name}, {self.type.name})' +class BranchedNode(DependencyNode, ABC): + _is_ready: bool = False + branches: List[DependencyNode] = [] + + @property + def is_ready(self) -> bool: + return all(x.is_ready for x in self.branches) + + +class ConditionalNode(BranchedNode): + def __init__(self, conditional_type, then_branch, else_branch): + self.type = conditional_type + self.branches = [then_branch, else_branch] + + def update(self, _type: Type) -> None: + self.type = _type + + def __str__(self): + return f'ConditionalNode({self.type.name})' + + class DependencyGraph: def __init__(self): self.dependencies: Dict[DependencyNode, List[DependencyNode]] = OrderedDict() @@ -129,34 +155,31 @@ def add_edge(self, node: DependencyNode, other: DependencyNode): self.add_node(other) def update_dependencies(self, default_type: Type = None): - queue = deque(key for key in self.dependencies if isinstance(key, AtomNode)) - visited: Set[DependencyNode] = set() + queue: Deque[DependencyNode] = deque(node for node in self.dependencies if isinstance(node, AtomNode)) + visited: Set[DependencyNode] = set(queue) + print(queue, '\n') while queue: - current_node = queue.popleft() - if current_node in visited: + node = queue.popleft() + + if not node.is_ready: continue - self.update_dependencies_of(current_node, current_node.type, visited) + + for adj in self.dependencies[node]: + if adj not in visited: + visited.add(adj) + adj.update(node.type) + queue.append(adj) + + branched_node = [node for node in self.dependencies if isinstance(node, ConditionalNode) and not node.is_ready] if default_type is not None: for node in self.dependencies: if node not in visited: node.update(default_type) - def update_dependencies_of(self, node: DependencyNode, typex: Type, visited: Set[DependencyNode]): - queue = deque([node] + self.dependencies[node]) - while queue: - current_node = queue.popleft() - - if current_node in visited: - continue - - current_node.update(typex) - visited.add(current_node) - queue.extend(self.dependencies[current_node]) - def __str__(self): - return '{\n' + '\n'.join(f'{key}: {value}' for key, value in self.dependencies.items()) + '}' + return '{\n\t' + '\n\t'.join(f'{key}: {value}' for key, value in self.dependencies.items()) + '\n}' class InferenceChecker: @@ -205,7 +228,14 @@ def visit(self, node: ast.ProgramNode, scope: Scope = None): for item in node.declarations: self.visit(item, scope.create_child()) + print(self.graph) + print() + self.graph.update_dependencies(default_type=self.context.get_type('Object')) + + print(self.graph) + print() + InferenceTypeSubstitute(self.context, self.errors).visit(node, scope) @visitor.when(ast.ClassDeclarationNode) @@ -347,7 +377,18 @@ def visit(self, node: ast.ConditionalNode, scope: Scope): if isinstance(then_node, AtomNode) and isinstance(else_node, AtomNode): return AtomNode(then_node.type.join(else_node.type)) - return AtomNode(self.context.get_type('Object')) # For now + conditional_node = ConditionalNode(self.context.get_type('AUTO_TYPE'), then_node, else_node) + if isinstance(then_node, AtomNode) and not isinstance(else_node, AtomNode): + self.graph.add_edge(then_node, else_node) + elif not isinstance(then_node, AtomNode) and isinstance(else_node, AtomNode): + self.graph.add_edge(else_node, then_node) + else: + self.graph.add_edge(then_node, else_node) + self.graph.add_edge(else_node, then_node) + self.graph.add_edge(conditional_node, then_node) + self.graph.add_edge(conditional_node, else_node) + + return conditional_node @visitor.when(ast.WhileNode) def visit(self, node: ast.WhileNode, scope: Scope): @@ -494,7 +535,7 @@ def _visit_arithmetic_node(self, node: ast.BinaryNode, scope: Scope, member_type class InferenceTypeSubstitute: - def __init__(self, context: Context, errors: List[str] = []): + def __init__(self, context: Context, errors: List[str]): self.context: Context = context self.errors: List[str] = errors self.current_type: Optional[Type] = None diff --git a/tests/inference/02_program.cl b/tests/inference/02_program.cl index 958af7f4e..32fe7f289 100644 --- a/tests/inference/02_program.cl +++ b/tests/inference/02_program.cl @@ -1,6 +1,6 @@ class Main { main (): Object { - 0 + let x: Int <- (new Ackermann).ackermann(5, 6) in x }; } diff --git a/tests/inference/03_program.cl b/tests/inference/03_program.cl index 04c639a99..5391dae4f 100644 --- a/tests/inference/03_program.cl +++ b/tests/inference/03_program.cl @@ -1,5 +1,5 @@ class Main { - main (): Object { + main (): AUTO_TYPE { 0 }; diff --git a/tests/inference/03_result.txt b/tests/inference/03_result.txt index 08ba93dff..b69e2a36a 100644 --- a/tests/inference/03_result.txt +++ b/tests/inference/03_result.txt @@ -1,9 +1,9 @@ class Main { - main (): Object { + main (): Int { 0 }; - f (a: Int, b: Int): Object { + f (a: Int, b: Int): Int { if a = 1 then b @@ -12,7 +12,7 @@ class Main { fi }; - g (a: Int, b: Int): Object { + g (a: Int, b: Int): Int { if b = 1 then a diff --git a/tests/inference/10_program.cl b/tests/inference/10_program.cl new file mode 100644 index 000000000..10ca1998b --- /dev/null +++ b/tests/inference/10_program.cl @@ -0,0 +1,17 @@ +class Main { + main (): Object { + 0 + }; + + h(): Int { + if true then f() else g() fi + }; + + g(): AUTO_TYPE { + "" + }; + + f(): AUTO_TYPE { + false + }; +} \ No newline at end of file diff --git a/tests/test_cool.py b/tests/test_cool.py index c98a4eefa..aef07ee68 100644 --- a/tests/test_cool.py +++ b/tests/test_cool.py @@ -45,8 +45,7 @@ def test_lexer(): def test_parser(): programs, results = get_programs('parser') - total = 20 - for code, result in zip(programs[total - 1:total], results[total - 1:total]): + for code, result in zip(programs, results): tokens, _ = tokenize(code) ast, parser = parse(tokens) assert parser.contains_errors and '\n'.join(parser.errors) == result @@ -65,7 +64,6 @@ def test_inference(): def test_semantic(): programs, results = get_programs('semantic') - print(programs) for code, result in zip(programs, results): tokens, _ = tokenize(code) ast, parser = parse(tokens) From 43be8751e874d6bd1355817c5c712f51508da1a9 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Sun, 13 Dec 2020 23:50:36 -0500 Subject: [PATCH 091/143] terminada la inferencia en condicionales y expresiones case-of --- cool/__main__.py | 2 +- cool/semantics/type_inference.py | 68 ++++++++++++++++++++++++-------- tests/inference/02_result.txt | 3 +- tests/inference/10_program.cl | 30 ++++++++++---- tests/inference/10_result.txt | 51 ++++++++++++++++++++++++ tests/inference/11_program.cl | 35 ++++++++++++++++ tests/inference/11_result.txt | 52 ++++++++++++++++++++++++ tests/test_cool.py | 2 +- 8 files changed, 216 insertions(+), 27 deletions(-) create mode 100644 tests/inference/10_result.txt create mode 100644 tests/inference/11_program.cl create mode 100644 tests/inference/11_result.txt diff --git a/cool/__main__.py b/cool/__main__.py index 8a9256ed5..86bac5f57 100644 --- a/cool/__main__.py +++ b/cool/__main__.py @@ -77,7 +77,7 @@ def infer(file: str, verbose: bool = False): if errors: for e in errors: typer.echo(e, err=True) - # typer.echo(CodeBuilder().visit(ast, 0)) + typer.echo(CodeBuilder().visit(ast, 0)) @app.command() diff --git a/cool/semantics/type_inference.py b/cool/semantics/type_inference.py index 6cdd95015..2fec535cf 100644 --- a/cool/semantics/type_inference.py +++ b/cool/semantics/type_inference.py @@ -119,12 +119,11 @@ def __str__(self): class BranchedNode(DependencyNode, ABC): - _is_ready: bool = False branches: List[DependencyNode] = [] @property def is_ready(self) -> bool: - return all(x.is_ready for x in self.branches) + return all(x.type.name != 'AUTO_TYPE' for x in self.branches) class ConditionalNode(BranchedNode): @@ -139,6 +138,18 @@ def __str__(self): return f'ConditionalNode({self.type.name})' +class CaseOfNode(BranchedNode): + def __init__(self, _type, branches): + self.type = _type + self.branches = branches + + def update(self, _type: Type) -> None: + self.type = _type + + def __str__(self): + return f'CaseOfNode({self.type.name})' + + class DependencyGraph: def __init__(self): self.dependencies: Dict[DependencyNode, List[DependencyNode]] = OrderedDict() @@ -158,7 +169,6 @@ def update_dependencies(self, default_type: Type = None): queue: Deque[DependencyNode] = deque(node for node in self.dependencies if isinstance(node, AtomNode)) visited: Set[DependencyNode] = set(queue) - print(queue, '\n') while queue: node = queue.popleft() @@ -167,12 +177,26 @@ def update_dependencies(self, default_type: Type = None): for adj in self.dependencies[node]: if adj not in visited: + adj.update(node.type) visited.add(adj) + if not isinstance(adj, BranchedNode): + queue.append(adj) + + for node in self.dependencies: + if isinstance(node, BranchedNode) and node.is_ready: + node.update(Type.multi_join([x.type for x in node.branches])) + + queue = deque(node for node in self.dependencies + if isinstance(node, BranchedNode) and node.type.name != 'AUTO_TYPE') + visited.update(queue) + while queue: + node = queue.popleft() + for adj in self.dependencies[node]: + if adj not in visited: adj.update(node.type) + visited.add(adj) queue.append(adj) - branched_node = [node for node in self.dependencies if isinstance(node, ConditionalNode) and not node.is_ready] - if default_type is not None: for node in self.dependencies: if node not in visited: @@ -228,14 +252,9 @@ def visit(self, node: ast.ProgramNode, scope: Scope = None): for item in node.declarations: self.visit(item, scope.create_child()) - print(self.graph) - print() - + # print(self.graph, '\n') self.graph.update_dependencies(default_type=self.context.get_type('Object')) - - print(self.graph) - print() - + # print(self.graph, '\n') InferenceTypeSubstitute(self.context, self.errors).visit(node, scope) @visitor.when(ast.ClassDeclarationNode) @@ -399,16 +418,31 @@ def visit(self, node: ast.WhileNode, scope: Scope): @visitor.when(ast.SwitchCaseNode) def visit(self, node: ast.SwitchCaseNode, scope: Scope): self.visit(node.expr, scope) - case_expressions = [] + + defined_nodes = [] + not_defined_nodes = [] + case_nodes = [] for _id, _type, _expr in node.cases: new_scope = scope.create_child() var_info = new_scope.define_variable(_id, self.context.get_type(_type)) self.variables[var_info] = VariableInfoNode(var_info.type, var_info) - case_expressions.append(self.visit(_expr, new_scope)) - if any(e.type.name == 'AUTO_TYPE' for e in case_expressions): - return AtomNode(self.context.get_type('Object')) - return AtomNode(Type.multi_join([e.type for e in case_expressions])) + case_node = self.visit(_expr, new_scope) + if isinstance(case_node, AtomNode): + defined_nodes.append(case_node) + else: + not_defined_nodes.append(case_node) + case_nodes.append(case_node) + + if any(e.type.name == 'AUTO_TYPE' for e in case_nodes): + if defined_nodes: + t = Type.multi_join([x.type for x in defined_nodes]) + for x in not_defined_nodes: + self.graph.add_edge(AtomNode(t), x) + case_of_node = CaseOfNode(self.context.get_type('AUTO_TYPE'), case_nodes) + self.graph.add_node(case_of_node) + return case_of_node + return AtomNode(Type.multi_join([e.type for e in case_nodes])) @visitor.when(ast.MethodCallNode) def visit(self, node: ast.MethodCallNode, scope: Scope): diff --git a/tests/inference/02_result.txt b/tests/inference/02_result.txt index 41b4a7b77..927ed2f00 100644 --- a/tests/inference/02_result.txt +++ b/tests/inference/02_result.txt @@ -1,6 +1,7 @@ class Main { main (): Object { - 0 + let x: Int <- (new Ackermann).ackermann(5, 6) in + x }; } diff --git a/tests/inference/10_program.cl b/tests/inference/10_program.cl index 10ca1998b..04c2c29ad 100644 --- a/tests/inference/10_program.cl +++ b/tests/inference/10_program.cl @@ -3,15 +3,31 @@ class Main { 0 }; - h(): Int { - if true then f() else g() fi + f(): AUTO_TYPE { + if true then + if true then + create_dog() + else + create_cat() fi + else + create_reptile() fi }; - g(): AUTO_TYPE { - "" + create_dog(): AUTO_TYPE { + new Dog }; - f(): AUTO_TYPE { - false + create_cat(): AUTO_TYPE { + new Cat }; -} \ No newline at end of file + + create_reptile(): AUTO_TYPE { + new Reptile + }; +} + +class Animal {} +class Mammal inherits Animal {} +class Reptile inherits Animal {} +class Dog inherits Mammal {} +class Cat inherits Mammal {} \ No newline at end of file diff --git a/tests/inference/10_result.txt b/tests/inference/10_result.txt new file mode 100644 index 000000000..0cddc38c9 --- /dev/null +++ b/tests/inference/10_result.txt @@ -0,0 +1,51 @@ +class Main { + main (): Object { + 0 + }; + + f (): Animal { + if true + then + if true + then + self.create_dog() + else + self.create_cat() + fi + else + self.create_reptile() + fi + }; + + create_dog (): Dog { + (new Dog) + }; + + create_cat (): Cat { + (new Cat) + }; + + create_reptile (): Reptile { + (new Reptile) + }; +} + +class Animal { + +} + +class Mammal inherits Animal { + +} + +class Reptile inherits Animal { + +} + +class Dog inherits Mammal { + +} + +class Cat inherits Mammal { + +} \ No newline at end of file diff --git a/tests/inference/11_program.cl b/tests/inference/11_program.cl new file mode 100644 index 000000000..9aa7eaf9a --- /dev/null +++ b/tests/inference/11_program.cl @@ -0,0 +1,35 @@ +class Main { + main (): Object { + 0 + }; + + f(): AUTO_TYPE { + let x: AUTO_TYPE <- new Dog in + case x of + m: Mammal => + case m of + c: Cat => create_cat(); + d: Dog => create_dog(); + esac; + r: Reptile => create_reptile(); + esac + }; + + create_dog(): AUTO_TYPE { + new Dog + }; + + create_cat(): AUTO_TYPE { + new Cat + }; + + create_reptile(): AUTO_TYPE { + new Reptile + }; +} + +class Animal {} +class Mammal inherits Animal {} +class Reptile inherits Animal {} +class Dog inherits Mammal {} +class Cat inherits Mammal {} \ No newline at end of file diff --git a/tests/inference/11_result.txt b/tests/inference/11_result.txt new file mode 100644 index 000000000..3ab526fbc --- /dev/null +++ b/tests/inference/11_result.txt @@ -0,0 +1,52 @@ +class Main { + main (): Object { + 0 + }; + + f (): Animal { + let x: Dog <- (new Dog) in + case x of + m : Mammal => + case m of + c : Cat => + self.create_cat(); + d : Dog => + self.create_dog(); + esac; + r : Reptile => + self.create_reptile(); + esac + }; + + create_dog (): Dog { + (new Dog) + }; + + create_cat (): Cat { + (new Cat) + }; + + create_reptile (): Reptile { + (new Reptile) + }; +} + +class Animal { + +} + +class Mammal inherits Animal { + +} + +class Reptile inherits Animal { + +} + +class Dog inherits Mammal { + +} + +class Cat inherits Mammal { + +} \ No newline at end of file diff --git a/tests/test_cool.py b/tests/test_cool.py index aef07ee68..4f3c74678 100644 --- a/tests/test_cool.py +++ b/tests/test_cool.py @@ -71,4 +71,4 @@ def test_semantic(): assert (parser.contains_errors or errors) and '\n'.join(parser.errors + errors) == result -test_semantic() +test_inference() From 759bc704f179df4f678a3eefd380b161e6827ff7 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Mon, 14 Dec 2020 00:19:08 -0500 Subject: [PATCH 092/143] =?UTF-8?q?un=20peque=C3=B1o=20ajuste=20en=20el=20?= =?UTF-8?q?constructor=20de=20codigo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cool/semantics/__init__.py | 1 - cool/semantics/formatter.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/cool/semantics/__init__.py b/cool/semantics/__init__.py index 4e7b76976..88020cd0a 100644 --- a/cool/semantics/__init__.py +++ b/cool/semantics/__init__.py @@ -5,6 +5,5 @@ from .formatter import CodeBuilder, Formatter from .type_builder import TypeBuilder from .type_collector import TypeCollector -from .formatter import Formatter from .overridden import OverriddenMethodChecker, topological_sorting from .type_checker import TypeChecker diff --git a/cool/semantics/formatter.py b/cool/semantics/formatter.py index e4d4538d6..1319d17d5 100644 --- a/cool/semantics/formatter.py +++ b/cool/semantics/formatter.py @@ -77,7 +77,7 @@ def visit(self, node: ast.SwitchCaseNode, tabs: int = 0): expr = self.visit(node.expr) cases = '\n'.join(cases) - return ' ' * tabs + f'case {expr} of \n{cases}\n' + ' ' * tabs + 'esac' + return ' ' * tabs + f'case {expr} of\n{cases}\n' + ' ' * tabs + 'esac' @visitor.when(ast.MethodCallNode) def visit(self, node: ast.MethodCallNode, tabs: int = 0): From 24390eac9d304d54e8653c598da12cd27f9d3111 Mon Sep 17 00:00:00 2001 From: LauTB <45464137+LauTB@users.noreply.github.com> Date: Fri, 19 Feb 2021 19:49:55 -0500 Subject: [PATCH 093/143] Fixed semicolon issue --- src/cool/grammar.py | 4 +- src/cool/parsertab.py | 1384 ++++++++++++++++++++--------------------- 2 files changed, 694 insertions(+), 694 deletions(-) diff --git a/src/cool/grammar.py b/src/cool/grammar.py index a95e8d725..1e32a48f8 100644 --- a/src/cool/grammar.py +++ b/src/cool/grammar.py @@ -222,8 +222,8 @@ def lexical_error(lexer): ############### program %= 'class-list', lambda s: ast.ProgramNode(s[1]) -class_list %= 'class-def', lambda s: [s[1]] -class_list %= 'class-def class-list', lambda s: [s[1]] + s[2] +class_list %= 'class-def ;', lambda s: [s[1]] +class_list %= 'class-def ; class-list', lambda s: [s[1]] + s[2] class_def %= 'class type { feature-list }', lambda s: ast.ClassDeclarationNode(s[2], s[4]) class_def %= 'class type inherits type { feature-list }', lambda s: ast.ClassDeclarationNode(s[2], s[6], s[4]) diff --git a/src/cool/parsertab.py b/src/cool/parsertab.py index af3924f85..e4433bd35 100644 --- a/src/cool/parsertab.py +++ b/src/cool/parsertab.py @@ -22,86 +22,86 @@ def __action_table(): (3, G["}"]): ("REDUCE", G["feature-list -> e"]), (4, G[":"]): ("SHIFT", 129), (4, G["("]): ("SHIFT", 5), - (5, G["id"]): ("SHIFT", 117), (5, G[")"]): ("SHIFT", 6), + (5, G["id"]): ("SHIFT", 117), (6, G[":"]): ("SHIFT", 7), (7, G["type"]): ("SHIFT", 8), (8, G["{"]): ("SHIFT", 9), + (9, G["{"]): ("SHIFT", 10), + (9, G["~"]): ("SHIFT", 27), (9, G["not"]): ("SHIFT", 30), - (9, G["if"]): ("SHIFT", 12), - (9, G["("]): ("SHIFT", 11), (9, G["id"]): ("SHIFT", 31), - (9, G["case"]): ("SHIFT", 21), - (9, G["let"]): ("SHIFT", 14), + (9, G["if"]): ("SHIFT", 12), (9, G["int"]): ("SHIFT", 33), + (9, G["let"]): ("SHIFT", 14), + (9, G["case"]): ("SHIFT", 21), + (9, G["("]): ("SHIFT", 11), + (9, G["false"]): ("SHIFT", 26), + (9, G["new"]): ("SHIFT", 22), + (9, G["while"]): ("SHIFT", 13), (9, G["isvoid"]): ("SHIFT", 24), - (9, G["{"]): ("SHIFT", 10), (9, G["true"]): ("SHIFT", 25), - (9, G["new"]): ("SHIFT", 22), - (9, G["~"]): ("SHIFT", 27), (9, G["string"]): ("SHIFT", 34), - (9, G["while"]): ("SHIFT", 13), - (9, G["false"]): ("SHIFT", 26), + (10, G["isvoid"]): ("SHIFT", 24), (10, G["id"]): ("SHIFT", 31), - (10, G["~"]): ("SHIFT", 27), (10, G["int"]): ("SHIFT", 33), - (10, G["case"]): ("SHIFT", 21), - (10, G["let"]): ("SHIFT", 14), - (10, G["true"]): ("SHIFT", 25), + (10, G["("]): ("SHIFT", 11), (10, G["{"]): ("SHIFT", 10), - (10, G["new"]): ("SHIFT", 22), - (10, G["string"]): ("SHIFT", 34), (10, G["false"]): ("SHIFT", 26), - (10, G["while"]): ("SHIFT", 13), - (10, G["isvoid"]): ("SHIFT", 24), + (10, G["new"]): ("SHIFT", 22), + (10, G["~"]): ("SHIFT", 27), (10, G["not"]): ("SHIFT", 30), + (10, G["true"]): ("SHIFT", 25), (10, G["if"]): ("SHIFT", 12), - (10, G["("]): ("SHIFT", 11), - (11, G["if"]): ("SHIFT", 12), - (11, G["id"]): ("SHIFT", 31), - (11, G["new"]): ("SHIFT", 22), + (10, G["string"]): ("SHIFT", 34), + (10, G["let"]): ("SHIFT", 14), + (10, G["case"]): ("SHIFT", 21), + (10, G["while"]): ("SHIFT", 13), (11, G["let"]): ("SHIFT", 14), - (11, G["true"]): ("SHIFT", 25), (11, G["case"]): ("SHIFT", 21), - (11, G["{"]): ("SHIFT", 10), - (11, G["isvoid"]): ("SHIFT", 24), - (11, G["string"]): ("SHIFT", 34), - (11, G["false"]): ("SHIFT", 26), - (11, G["~"]): ("SHIFT", 27), (11, G["while"]): ("SHIFT", 13), - (11, G["("]): ("SHIFT", 11), + (11, G["~"]): ("SHIFT", 27), (11, G["int"]): ("SHIFT", 33), + (11, G["id"]): ("SHIFT", 31), + (11, G["("]): ("SHIFT", 11), + (11, G["false"]): ("SHIFT", 26), + (11, G["new"]): ("SHIFT", 22), + (11, G["{"]): ("SHIFT", 10), + (11, G["true"]): ("SHIFT", 25), (11, G["not"]): ("SHIFT", 30), - (12, G["not"]): ("SHIFT", 30), - (12, G["false"]): ("SHIFT", 26), - (12, G["if"]): ("SHIFT", 12), - (12, G["let"]): ("SHIFT", 14), - (12, G["case"]): ("SHIFT", 21), + (11, G["string"]): ("SHIFT", 34), + (11, G["isvoid"]): ("SHIFT", 24), + (11, G["if"]): ("SHIFT", 12), + (12, G["true"]): ("SHIFT", 25), (12, G["id"]): ("SHIFT", 31), - (12, G["("]): ("SHIFT", 11), (12, G["{"]): ("SHIFT", 10), - (12, G["int"]): ("SHIFT", 33), (12, G["isvoid"]): ("SHIFT", 24), - (12, G["true"]): ("SHIFT", 25), - (12, G["new"]): ("SHIFT", 22), + (12, G["not"]): ("SHIFT", 30), + (12, G["string"]): ("SHIFT", 34), + (12, G["if"]): ("SHIFT", 12), (12, G["~"]): ("SHIFT", 27), + (12, G["case"]): ("SHIFT", 21), + (12, G["let"]): ("SHIFT", 14), (12, G["while"]): ("SHIFT", 13), - (12, G["string"]): ("SHIFT", 34), + (12, G["int"]): ("SHIFT", 33), + (12, G["("]): ("SHIFT", 11), + (12, G["false"]): ("SHIFT", 26), + (12, G["new"]): ("SHIFT", 22), + (13, G["string"]): ("SHIFT", 34), + (13, G["isvoid"]): ("SHIFT", 24), (13, G["let"]): ("SHIFT", 14), (13, G["case"]): ("SHIFT", 21), + (13, G["while"]): ("SHIFT", 13), (13, G["id"]): ("SHIFT", 31), + (13, G["~"]): ("SHIFT", 27), (13, G["{"]): ("SHIFT", 10), - (13, G["string"]): ("SHIFT", 34), - (13, G["false"]): ("SHIFT", 26), - (13, G["while"]): ("SHIFT", 13), - (13, G["("]): ("SHIFT", 11), - (13, G["isvoid"]): ("SHIFT", 24), (13, G["int"]): ("SHIFT", 33), - (13, G["new"]): ("SHIFT", 22), + (13, G["("]): ("SHIFT", 11), + (13, G["false"]): ("SHIFT", 26), (13, G["not"]): ("SHIFT", 30), - (13, G["if"]): ("SHIFT", 12), - (13, G["~"]): ("SHIFT", 27), + (13, G["new"]): ("SHIFT", 22), (13, G["true"]): ("SHIFT", 25), + (13, G["if"]): ("SHIFT", 12), (14, G["id"]): ("SHIFT", 15), (15, G[":"]): ("SHIFT", 16), (16, G["type"]): ("SHIFT", 17), @@ -110,748 +110,748 @@ def __action_table(): (17, G[","]): ("SHIFT", 18), (18, G["id"]): ("SHIFT", 15), (19, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), - (20, G["string"]): ("SHIFT", 34), - (20, G["while"]): ("SHIFT", 13), - (20, G["isvoid"]): ("SHIFT", 24), - (20, G["not"]): ("SHIFT", 30), - (20, G["false"]): ("SHIFT", 26), - (20, G["if"]): ("SHIFT", 12), - (20, G["~"]): ("SHIFT", 27), - (20, G["let"]): ("SHIFT", 14), (20, G["case"]): ("SHIFT", 21), - (20, G["("]): ("SHIFT", 11), + (20, G["let"]): ("SHIFT", 14), + (20, G["isvoid"]): ("SHIFT", 24), + (20, G["while"]): ("SHIFT", 13), (20, G["id"]): ("SHIFT", 31), + (20, G["~"]): ("SHIFT", 27), (20, G["{"]): ("SHIFT", 10), (20, G["int"]): ("SHIFT", 33), + (20, G["not"]): ("SHIFT", 30), + (20, G["("]): ("SHIFT", 11), (20, G["new"]): ("SHIFT", 22), + (20, G["false"]): ("SHIFT", 26), (20, G["true"]): ("SHIFT", 25), - (21, G["if"]): ("SHIFT", 12), - (21, G["~"]): ("SHIFT", 27), - (21, G["case"]): ("SHIFT", 21), - (21, G["let"]): ("SHIFT", 14), + (20, G["if"]): ("SHIFT", 12), + (20, G["string"]): ("SHIFT", 34), (21, G["string"]): ("SHIFT", 34), - (21, G["id"]): ("SHIFT", 31), - (21, G["{"]): ("SHIFT", 10), - (21, G["false"]): ("SHIFT", 26), - (21, G["("]): ("SHIFT", 11), - (21, G["int"]): ("SHIFT", 33), + (21, G["let"]): ("SHIFT", 14), + (21, G["case"]): ("SHIFT", 21), (21, G["while"]): ("SHIFT", 13), + (21, G["id"]): ("SHIFT", 31), (21, G["isvoid"]): ("SHIFT", 24), + (21, G["{"]): ("SHIFT", 10), (21, G["not"]): ("SHIFT", 30), - (21, G["true"]): ("SHIFT", 25), + (21, G["int"]): ("SHIFT", 33), + (21, G["("]): ("SHIFT", 11), + (21, G["false"]): ("SHIFT", 26), (21, G["new"]): ("SHIFT", 22), + (21, G["if"]): ("SHIFT", 12), + (21, G["~"]): ("SHIFT", 27), + (21, G["true"]): ("SHIFT", 25), (22, G["type"]): ("SHIFT", 23), - (23, G[")"]): ("REDUCE", G["atom -> new type"]), - (23, G["-"]): ("REDUCE", G["atom -> new type"]), - (23, G["in"]): ("REDUCE", G["atom -> new type"]), - (23, G["*"]): ("REDUCE", G["atom -> new type"]), - (23, G["}"]): ("REDUCE", G["atom -> new type"]), (23, G["/"]): ("REDUCE", G["atom -> new type"]), (23, G["of"]): ("REDUCE", G["atom -> new type"]), (23, G["<"]): ("REDUCE", G["atom -> new type"]), - (23, G["fi"]): ("REDUCE", G["atom -> new type"]), + (23, G[")"]): ("REDUCE", G["atom -> new type"]), + (23, G["then"]): ("REDUCE", G["atom -> new type"]), (23, G["<="]): ("REDUCE", G["atom -> new type"]), - (23, G["@"]): ("REDUCE", G["atom -> new type"]), + (23, G["error"]): ("REDUCE", G["atom -> new type"]), + (23, G["."]): ("REDUCE", G["atom -> new type"]), + (23, G["else"]): ("REDUCE", G["atom -> new type"]), + (23, G["in"]): ("REDUCE", G["atom -> new type"]), (23, G["="]): ("REDUCE", G["atom -> new type"]), + (23, G[","]): ("REDUCE", G["atom -> new type"]), + (23, G["fi"]): ("REDUCE", G["atom -> new type"]), (23, G[";"]): ("REDUCE", G["atom -> new type"]), - (23, G["else"]): ("REDUCE", G["atom -> new type"]), - (23, G["then"]): ("REDUCE", G["atom -> new type"]), (23, G["loop"]): ("REDUCE", G["atom -> new type"]), - (23, G["error"]): ("REDUCE", G["atom -> new type"]), - (23, G[","]): ("REDUCE", G["atom -> new type"]), + (23, G["@"]): ("REDUCE", G["atom -> new type"]), (23, G["pool"]): ("REDUCE", G["atom -> new type"]), (23, G["+"]): ("REDUCE", G["atom -> new type"]), - (23, G["."]): ("REDUCE", G["atom -> new type"]), - (24, G["false"]): ("SHIFT", 26), - (24, G["new"]): ("SHIFT", 22), - (24, G["string"]): ("SHIFT", 34), + (23, G["-"]): ("REDUCE", G["atom -> new type"]), + (23, G["*"]): ("REDUCE", G["atom -> new type"]), + (23, G["}"]): ("REDUCE", G["atom -> new type"]), (24, G["id"]): ("SHIFT", 28), + (24, G["string"]): ("SHIFT", 34), + (24, G["new"]): ("SHIFT", 22), (24, G["true"]): ("SHIFT", 25), (24, G["isvoid"]): ("SHIFT", 24), (24, G["int"]): ("SHIFT", 33), (24, G["~"]): ("SHIFT", 27), (24, G["("]): ("SHIFT", 11), - (25, G[")"]): ("REDUCE", G["atom -> true"]), - (25, G["-"]): ("REDUCE", G["atom -> true"]), - (25, G["in"]): ("REDUCE", G["atom -> true"]), - (25, G["*"]): ("REDUCE", G["atom -> true"]), - (25, G["}"]): ("REDUCE", G["atom -> true"]), + (24, G["false"]): ("SHIFT", 26), (25, G["/"]): ("REDUCE", G["atom -> true"]), (25, G["of"]): ("REDUCE", G["atom -> true"]), (25, G["<"]): ("REDUCE", G["atom -> true"]), - (25, G["fi"]): ("REDUCE", G["atom -> true"]), + (25, G[")"]): ("REDUCE", G["atom -> true"]), + (25, G["then"]): ("REDUCE", G["atom -> true"]), (25, G["<="]): ("REDUCE", G["atom -> true"]), - (25, G["@"]): ("REDUCE", G["atom -> true"]), + (25, G["error"]): ("REDUCE", G["atom -> true"]), + (25, G["."]): ("REDUCE", G["atom -> true"]), + (25, G["else"]): ("REDUCE", G["atom -> true"]), + (25, G["in"]): ("REDUCE", G["atom -> true"]), (25, G["="]): ("REDUCE", G["atom -> true"]), + (25, G[","]): ("REDUCE", G["atom -> true"]), + (25, G["fi"]): ("REDUCE", G["atom -> true"]), (25, G[";"]): ("REDUCE", G["atom -> true"]), - (25, G["else"]): ("REDUCE", G["atom -> true"]), - (25, G["then"]): ("REDUCE", G["atom -> true"]), (25, G["loop"]): ("REDUCE", G["atom -> true"]), - (25, G["error"]): ("REDUCE", G["atom -> true"]), - (25, G[","]): ("REDUCE", G["atom -> true"]), + (25, G["@"]): ("REDUCE", G["atom -> true"]), (25, G["pool"]): ("REDUCE", G["atom -> true"]), (25, G["+"]): ("REDUCE", G["atom -> true"]), - (25, G["."]): ("REDUCE", G["atom -> true"]), - (26, G[")"]): ("REDUCE", G["atom -> false"]), - (26, G["-"]): ("REDUCE", G["atom -> false"]), - (26, G["in"]): ("REDUCE", G["atom -> false"]), - (26, G["*"]): ("REDUCE", G["atom -> false"]), - (26, G["}"]): ("REDUCE", G["atom -> false"]), + (25, G["-"]): ("REDUCE", G["atom -> true"]), + (25, G["*"]): ("REDUCE", G["atom -> true"]), + (25, G["}"]): ("REDUCE", G["atom -> true"]), (26, G["/"]): ("REDUCE", G["atom -> false"]), (26, G["of"]): ("REDUCE", G["atom -> false"]), (26, G["<"]): ("REDUCE", G["atom -> false"]), - (26, G["fi"]): ("REDUCE", G["atom -> false"]), + (26, G[")"]): ("REDUCE", G["atom -> false"]), + (26, G["then"]): ("REDUCE", G["atom -> false"]), (26, G["<="]): ("REDUCE", G["atom -> false"]), - (26, G["@"]): ("REDUCE", G["atom -> false"]), + (26, G["error"]): ("REDUCE", G["atom -> false"]), + (26, G["."]): ("REDUCE", G["atom -> false"]), + (26, G["else"]): ("REDUCE", G["atom -> false"]), + (26, G["in"]): ("REDUCE", G["atom -> false"]), (26, G["="]): ("REDUCE", G["atom -> false"]), + (26, G[","]): ("REDUCE", G["atom -> false"]), + (26, G["fi"]): ("REDUCE", G["atom -> false"]), (26, G[";"]): ("REDUCE", G["atom -> false"]), - (26, G["else"]): ("REDUCE", G["atom -> false"]), - (26, G["then"]): ("REDUCE", G["atom -> false"]), (26, G["loop"]): ("REDUCE", G["atom -> false"]), - (26, G["error"]): ("REDUCE", G["atom -> false"]), - (26, G[","]): ("REDUCE", G["atom -> false"]), + (26, G["@"]): ("REDUCE", G["atom -> false"]), (26, G["pool"]): ("REDUCE", G["atom -> false"]), (26, G["+"]): ("REDUCE", G["atom -> false"]), - (26, G["."]): ("REDUCE", G["atom -> false"]), - (27, G["false"]): ("SHIFT", 26), - (27, G["new"]): ("SHIFT", 22), - (27, G["string"]): ("SHIFT", 34), + (26, G["-"]): ("REDUCE", G["atom -> false"]), + (26, G["*"]): ("REDUCE", G["atom -> false"]), + (26, G["}"]): ("REDUCE", G["atom -> false"]), (27, G["id"]): ("SHIFT", 28), + (27, G["string"]): ("SHIFT", 34), + (27, G["new"]): ("SHIFT", 22), (27, G["true"]): ("SHIFT", 25), (27, G["isvoid"]): ("SHIFT", 24), (27, G["int"]): ("SHIFT", 33), (27, G["~"]): ("SHIFT", 27), (27, G["("]): ("SHIFT", 11), - (28, G[")"]): ("REDUCE", G["atom -> id"]), - (28, G["-"]): ("REDUCE", G["atom -> id"]), - (28, G["in"]): ("REDUCE", G["atom -> id"]), - (28, G["*"]): ("REDUCE", G["atom -> id"]), - (28, G["}"]): ("REDUCE", G["atom -> id"]), + (27, G["false"]): ("SHIFT", 26), (28, G["/"]): ("REDUCE", G["atom -> id"]), (28, G["of"]): ("REDUCE", G["atom -> id"]), (28, G["<"]): ("REDUCE", G["atom -> id"]), - (28, G["fi"]): ("REDUCE", G["atom -> id"]), + (28, G[")"]): ("REDUCE", G["atom -> id"]), + (28, G["then"]): ("REDUCE", G["atom -> id"]), (28, G["<="]): ("REDUCE", G["atom -> id"]), - (28, G["@"]): ("REDUCE", G["atom -> id"]), + (28, G["error"]): ("REDUCE", G["atom -> id"]), + (28, G["."]): ("REDUCE", G["atom -> id"]), + (28, G["else"]): ("REDUCE", G["atom -> id"]), + (28, G["in"]): ("REDUCE", G["atom -> id"]), (28, G["="]): ("REDUCE", G["atom -> id"]), + (28, G[","]): ("REDUCE", G["atom -> id"]), + (28, G["fi"]): ("REDUCE", G["atom -> id"]), (28, G[";"]): ("REDUCE", G["atom -> id"]), - (28, G["else"]): ("REDUCE", G["atom -> id"]), - (28, G["then"]): ("REDUCE", G["atom -> id"]), (28, G["loop"]): ("REDUCE", G["atom -> id"]), - (28, G["error"]): ("REDUCE", G["atom -> id"]), - (28, G[","]): ("REDUCE", G["atom -> id"]), + (28, G["@"]): ("REDUCE", G["atom -> id"]), (28, G["pool"]): ("REDUCE", G["atom -> id"]), (28, G["+"]): ("REDUCE", G["atom -> id"]), - (28, G["."]): ("REDUCE", G["atom -> id"]), + (28, G["-"]): ("REDUCE", G["atom -> id"]), + (28, G["*"]): ("REDUCE", G["atom -> id"]), + (28, G["}"]): ("REDUCE", G["atom -> id"]), (28, G["("]): ("SHIFT", 29), - (29, G["new"]): ("SHIFT", 22), - (29, G["true"]): ("SHIFT", 25), - (29, G["isvoid"]): ("SHIFT", 24), - (29, G["string"]): ("SHIFT", 34), (29, G["while"]): ("SHIFT", 13), - (29, G["false"]): ("SHIFT", 26), + (29, G["true"]): ("SHIFT", 25), + (29, G["id"]): ("SHIFT", 31), (29, G["~"]): ("SHIFT", 27), + (29, G["string"]): ("SHIFT", 34), + (29, G["{"]): ("SHIFT", 10), (29, G["not"]): ("SHIFT", 30), (29, G["if"]): ("SHIFT", 12), + (29, G["isvoid"]): ("SHIFT", 24), + (29, G["int"]): ("SHIFT", 33), + (29, G["let"]): ("SHIFT", 14), (29, G["("]): ("SHIFT", 11), + (29, G["false"]): ("SHIFT", 26), + (29, G["new"]): ("SHIFT", 22), (29, G[")"]): ("REDUCE", G["expr-list -> e"]), - (29, G["let"]): ("SHIFT", 14), (29, G["case"]): ("SHIFT", 21), - (29, G["id"]): ("SHIFT", 31), - (29, G["int"]): ("SHIFT", 33), - (29, G["{"]): ("SHIFT", 10), - (30, G["new"]): ("SHIFT", 22), - (30, G["true"]): ("SHIFT", 25), - (30, G["isvoid"]): ("SHIFT", 24), + (30, G["case"]): ("SHIFT", 21), + (30, G["let"]): ("SHIFT", 14), + (30, G["id"]): ("SHIFT", 31), (30, G["while"]): ("SHIFT", 13), - (30, G["string"]): ("SHIFT", 34), + (30, G["isvoid"]): ("SHIFT", 24), + (30, G["int"]): ("SHIFT", 33), + (30, G["{"]): ("SHIFT", 10), (30, G["~"]): ("SHIFT", 27), + (30, G["("]): ("SHIFT", 11), + (30, G["false"]): ("SHIFT", 26), + (30, G["new"]): ("SHIFT", 22), (30, G["not"]): ("SHIFT", 30), + (30, G["true"]): ("SHIFT", 25), (30, G["if"]): ("SHIFT", 12), - (30, G["false"]): ("SHIFT", 26), - (30, G["let"]): ("SHIFT", 14), - (30, G["case"]): ("SHIFT", 21), - (30, G["{"]): ("SHIFT", 10), - (30, G["id"]): ("SHIFT", 31), - (30, G["("]): ("SHIFT", 11), - (30, G["int"]): ("SHIFT", 33), - (31, G[")"]): ("REDUCE", G["atom -> id"]), - (31, G["-"]): ("REDUCE", G["atom -> id"]), - (31, G["in"]): ("REDUCE", G["atom -> id"]), - (31, G["*"]): ("REDUCE", G["atom -> id"]), - (31, G["}"]): ("REDUCE", G["atom -> id"]), + (30, G["string"]): ("SHIFT", 34), + (31, G["<-"]): ("SHIFT", 32), + (31, G["("]): ("SHIFT", 29), (31, G["/"]): ("REDUCE", G["atom -> id"]), (31, G["of"]): ("REDUCE", G["atom -> id"]), (31, G["<"]): ("REDUCE", G["atom -> id"]), - (31, G["fi"]): ("REDUCE", G["atom -> id"]), + (31, G[")"]): ("REDUCE", G["atom -> id"]), + (31, G["then"]): ("REDUCE", G["atom -> id"]), (31, G["<="]): ("REDUCE", G["atom -> id"]), - (31, G["@"]): ("REDUCE", G["atom -> id"]), + (31, G["error"]): ("REDUCE", G["atom -> id"]), + (31, G["."]): ("REDUCE", G["atom -> id"]), + (31, G["else"]): ("REDUCE", G["atom -> id"]), + (31, G["in"]): ("REDUCE", G["atom -> id"]), (31, G["="]): ("REDUCE", G["atom -> id"]), + (31, G[","]): ("REDUCE", G["atom -> id"]), + (31, G["fi"]): ("REDUCE", G["atom -> id"]), (31, G[";"]): ("REDUCE", G["atom -> id"]), - (31, G["else"]): ("REDUCE", G["atom -> id"]), - (31, G["then"]): ("REDUCE", G["atom -> id"]), (31, G["loop"]): ("REDUCE", G["atom -> id"]), - (31, G["error"]): ("REDUCE", G["atom -> id"]), - (31, G[","]): ("REDUCE", G["atom -> id"]), + (31, G["@"]): ("REDUCE", G["atom -> id"]), (31, G["pool"]): ("REDUCE", G["atom -> id"]), (31, G["+"]): ("REDUCE", G["atom -> id"]), - (31, G["."]): ("REDUCE", G["atom -> id"]), - (31, G["<-"]): ("SHIFT", 32), - (31, G["("]): ("SHIFT", 29), - (32, G["new"]): ("SHIFT", 22), - (32, G["true"]): ("SHIFT", 25), - (32, G["isvoid"]): ("SHIFT", 24), + (31, G["-"]): ("REDUCE", G["atom -> id"]), + (31, G["*"]): ("REDUCE", G["atom -> id"]), + (31, G["}"]): ("REDUCE", G["atom -> id"]), + (32, G["case"]): ("SHIFT", 21), + (32, G["let"]): ("SHIFT", 14), + (32, G["id"]): ("SHIFT", 31), (32, G["while"]): ("SHIFT", 13), - (32, G["string"]): ("SHIFT", 34), + (32, G["isvoid"]): ("SHIFT", 24), + (32, G["int"]): ("SHIFT", 33), + (32, G["{"]): ("SHIFT", 10), (32, G["~"]): ("SHIFT", 27), + (32, G["("]): ("SHIFT", 11), + (32, G["false"]): ("SHIFT", 26), + (32, G["new"]): ("SHIFT", 22), (32, G["not"]): ("SHIFT", 30), + (32, G["true"]): ("SHIFT", 25), (32, G["if"]): ("SHIFT", 12), - (32, G["false"]): ("SHIFT", 26), - (32, G["let"]): ("SHIFT", 14), - (32, G["case"]): ("SHIFT", 21), - (32, G["{"]): ("SHIFT", 10), - (32, G["id"]): ("SHIFT", 31), - (32, G["("]): ("SHIFT", 11), - (32, G["int"]): ("SHIFT", 33), - (33, G[")"]): ("REDUCE", G["atom -> int"]), - (33, G["-"]): ("REDUCE", G["atom -> int"]), - (33, G["in"]): ("REDUCE", G["atom -> int"]), - (33, G["*"]): ("REDUCE", G["atom -> int"]), - (33, G["}"]): ("REDUCE", G["atom -> int"]), + (32, G["string"]): ("SHIFT", 34), (33, G["/"]): ("REDUCE", G["atom -> int"]), (33, G["of"]): ("REDUCE", G["atom -> int"]), (33, G["<"]): ("REDUCE", G["atom -> int"]), - (33, G["fi"]): ("REDUCE", G["atom -> int"]), + (33, G[")"]): ("REDUCE", G["atom -> int"]), + (33, G["then"]): ("REDUCE", G["atom -> int"]), (33, G["<="]): ("REDUCE", G["atom -> int"]), - (33, G["@"]): ("REDUCE", G["atom -> int"]), + (33, G["error"]): ("REDUCE", G["atom -> int"]), + (33, G["."]): ("REDUCE", G["atom -> int"]), + (33, G["else"]): ("REDUCE", G["atom -> int"]), + (33, G["in"]): ("REDUCE", G["atom -> int"]), (33, G["="]): ("REDUCE", G["atom -> int"]), + (33, G[","]): ("REDUCE", G["atom -> int"]), + (33, G["fi"]): ("REDUCE", G["atom -> int"]), (33, G[";"]): ("REDUCE", G["atom -> int"]), - (33, G["else"]): ("REDUCE", G["atom -> int"]), - (33, G["then"]): ("REDUCE", G["atom -> int"]), (33, G["loop"]): ("REDUCE", G["atom -> int"]), - (33, G["error"]): ("REDUCE", G["atom -> int"]), - (33, G[","]): ("REDUCE", G["atom -> int"]), + (33, G["@"]): ("REDUCE", G["atom -> int"]), (33, G["pool"]): ("REDUCE", G["atom -> int"]), (33, G["+"]): ("REDUCE", G["atom -> int"]), - (33, G["."]): ("REDUCE", G["atom -> int"]), - (34, G[")"]): ("REDUCE", G["atom -> string"]), - (34, G["-"]): ("REDUCE", G["atom -> string"]), - (34, G["in"]): ("REDUCE", G["atom -> string"]), - (34, G["*"]): ("REDUCE", G["atom -> string"]), - (34, G["}"]): ("REDUCE", G["atom -> string"]), + (33, G["-"]): ("REDUCE", G["atom -> int"]), + (33, G["*"]): ("REDUCE", G["atom -> int"]), + (33, G["}"]): ("REDUCE", G["atom -> int"]), (34, G["/"]): ("REDUCE", G["atom -> string"]), (34, G["of"]): ("REDUCE", G["atom -> string"]), (34, G["<"]): ("REDUCE", G["atom -> string"]), - (34, G["fi"]): ("REDUCE", G["atom -> string"]), + (34, G[")"]): ("REDUCE", G["atom -> string"]), + (34, G["then"]): ("REDUCE", G["atom -> string"]), (34, G["<="]): ("REDUCE", G["atom -> string"]), - (34, G["@"]): ("REDUCE", G["atom -> string"]), + (34, G["error"]): ("REDUCE", G["atom -> string"]), + (34, G["."]): ("REDUCE", G["atom -> string"]), + (34, G["else"]): ("REDUCE", G["atom -> string"]), + (34, G["in"]): ("REDUCE", G["atom -> string"]), (34, G["="]): ("REDUCE", G["atom -> string"]), + (34, G[","]): ("REDUCE", G["atom -> string"]), + (34, G["fi"]): ("REDUCE", G["atom -> string"]), (34, G[";"]): ("REDUCE", G["atom -> string"]), - (34, G["else"]): ("REDUCE", G["atom -> string"]), - (34, G["then"]): ("REDUCE", G["atom -> string"]), (34, G["loop"]): ("REDUCE", G["atom -> string"]), - (34, G["error"]): ("REDUCE", G["atom -> string"]), - (34, G[","]): ("REDUCE", G["atom -> string"]), + (34, G["@"]): ("REDUCE", G["atom -> string"]), (34, G["pool"]): ("REDUCE", G["atom -> string"]), (34, G["+"]): ("REDUCE", G["atom -> string"]), - (34, G["."]): ("REDUCE", G["atom -> string"]), - (35, G[")"]): ("REDUCE", G["atom -> function-call"]), - (35, G["-"]): ("REDUCE", G["atom -> function-call"]), - (35, G["in"]): ("REDUCE", G["atom -> function-call"]), - (35, G["*"]): ("REDUCE", G["atom -> function-call"]), - (35, G["}"]): ("REDUCE", G["atom -> function-call"]), + (34, G["-"]): ("REDUCE", G["atom -> string"]), + (34, G["*"]): ("REDUCE", G["atom -> string"]), + (34, G["}"]): ("REDUCE", G["atom -> string"]), (35, G["/"]): ("REDUCE", G["atom -> function-call"]), (35, G["of"]): ("REDUCE", G["atom -> function-call"]), (35, G["<"]): ("REDUCE", G["atom -> function-call"]), - (35, G["fi"]): ("REDUCE", G["atom -> function-call"]), + (35, G[")"]): ("REDUCE", G["atom -> function-call"]), + (35, G["then"]): ("REDUCE", G["atom -> function-call"]), (35, G["<="]): ("REDUCE", G["atom -> function-call"]), - (35, G["@"]): ("REDUCE", G["atom -> function-call"]), + (35, G["error"]): ("REDUCE", G["atom -> function-call"]), + (35, G["."]): ("REDUCE", G["atom -> function-call"]), + (35, G["else"]): ("REDUCE", G["atom -> function-call"]), + (35, G["in"]): ("REDUCE", G["atom -> function-call"]), (35, G["="]): ("REDUCE", G["atom -> function-call"]), + (35, G[","]): ("REDUCE", G["atom -> function-call"]), + (35, G["fi"]): ("REDUCE", G["atom -> function-call"]), (35, G[";"]): ("REDUCE", G["atom -> function-call"]), - (35, G["else"]): ("REDUCE", G["atom -> function-call"]), - (35, G["then"]): ("REDUCE", G["atom -> function-call"]), (35, G["loop"]): ("REDUCE", G["atom -> function-call"]), - (35, G["error"]): ("REDUCE", G["atom -> function-call"]), - (35, G[","]): ("REDUCE", G["atom -> function-call"]), + (35, G["@"]): ("REDUCE", G["atom -> function-call"]), (35, G["pool"]): ("REDUCE", G["atom -> function-call"]), (35, G["+"]): ("REDUCE", G["atom -> function-call"]), - (35, G["."]): ("REDUCE", G["atom -> function-call"]), + (35, G["-"]): ("REDUCE", G["atom -> function-call"]), + (35, G["*"]): ("REDUCE", G["atom -> function-call"]), + (35, G["}"]): ("REDUCE", G["atom -> function-call"]), (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["in"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["else"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["}"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["else"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["in"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["}"]): ("REDUCE", G["expr -> id <- expr"]), (37, G[";"]): ("REDUCE", G["expr -> comp"]), + (37, G["loop"]): ("REDUCE", G["expr -> comp"]), + (37, G["of"]): ("REDUCE", G["expr -> comp"]), + (37, G["pool"]): ("REDUCE", G["expr -> comp"]), (37, G[")"]): ("REDUCE", G["expr -> comp"]), - (37, G["in"]): ("REDUCE", G["expr -> comp"]), - (37, G["else"]): ("REDUCE", G["expr -> comp"]), (37, G["then"]): ("REDUCE", G["expr -> comp"]), - (37, G["}"]): ("REDUCE", G["expr -> comp"]), - (37, G["of"]): ("REDUCE", G["expr -> comp"]), - (37, G["loop"]): ("REDUCE", G["expr -> comp"]), (37, G["error"]): ("REDUCE", G["expr -> comp"]), - (37, G["fi"]): ("REDUCE", G["expr -> comp"]), (37, G[","]): ("REDUCE", G["expr -> comp"]), - (37, G["pool"]): ("REDUCE", G["expr -> comp"]), + (37, G["else"]): ("REDUCE", G["expr -> comp"]), + (37, G["in"]): ("REDUCE", G["expr -> comp"]), + (37, G["fi"]): ("REDUCE", G["expr -> comp"]), + (37, G["}"]): ("REDUCE", G["expr -> comp"]), + (38, G["-"]): ("SHIFT", 64), + (38, G["<"]): ("SHIFT", 66), (38, G[";"]): ("REDUCE", G["comp -> arith"]), + (38, G["loop"]): ("REDUCE", G["comp -> arith"]), + (38, G["of"]): ("REDUCE", G["comp -> arith"]), + (38, G["pool"]): ("REDUCE", G["comp -> arith"]), (38, G[")"]): ("REDUCE", G["comp -> arith"]), - (38, G["in"]): ("REDUCE", G["comp -> arith"]), - (38, G["else"]): ("REDUCE", G["comp -> arith"]), (38, G["then"]): ("REDUCE", G["comp -> arith"]), - (38, G["}"]): ("REDUCE", G["comp -> arith"]), - (38, G["of"]): ("REDUCE", G["comp -> arith"]), - (38, G["loop"]): ("REDUCE", G["comp -> arith"]), (38, G["error"]): ("REDUCE", G["comp -> arith"]), - (38, G["fi"]): ("REDUCE", G["comp -> arith"]), (38, G[","]): ("REDUCE", G["comp -> arith"]), - (38, G["pool"]): ("REDUCE", G["comp -> arith"]), - (38, G["="]): ("SHIFT", 70), - (38, G["-"]): ("SHIFT", 64), + (38, G["else"]): ("REDUCE", G["comp -> arith"]), + (38, G["in"]): ("REDUCE", G["comp -> arith"]), + (38, G["fi"]): ("REDUCE", G["comp -> arith"]), + (38, G["}"]): ("REDUCE", G["comp -> arith"]), (38, G["<="]): ("SHIFT", 68), - (38, G["<"]): ("SHIFT", 66), (38, G["+"]): ("SHIFT", 39), - (39, G["false"]): ("SHIFT", 26), - (39, G["new"]): ("SHIFT", 22), + (38, G["="]): ("SHIFT", 70), + (39, G["id"]): ("SHIFT", 28), (39, G["true"]): ("SHIFT", 25), (39, G["isvoid"]): ("SHIFT", 24), - (39, G["("]): ("SHIFT", 11), + (39, G["false"]): ("SHIFT", 26), (39, G["string"]): ("SHIFT", 34), - (39, G["id"]): ("SHIFT", 28), (39, G["int"]): ("SHIFT", 33), (39, G["~"]): ("SHIFT", 27), + (39, G["("]): ("SHIFT", 11), + (39, G["new"]): ("SHIFT", 22), (40, G["/"]): ("SHIFT", 54), - (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), (40, G["of"]): ("REDUCE", G["arith -> arith + term"]), (40, G["<"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["fi"]): ("REDUCE", G["arith -> arith + term"]), + (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["then"]): ("REDUCE", G["arith -> arith + term"]), (40, G["<="]): ("REDUCE", G["arith -> arith + term"]), + (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["else"]): ("REDUCE", G["arith -> arith + term"]), (40, G["="]): ("REDUCE", G["arith -> arith + term"]), + (40, G[","]): ("REDUCE", G["arith -> arith + term"]), + (40, G["fi"]): ("REDUCE", G["arith -> arith + term"]), (40, G[";"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["else"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["then"]): ("REDUCE", G["arith -> arith + term"]), (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), - (40, G[","]): ("REDUCE", G["arith -> arith + term"]), (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), (40, G["+"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), (40, G["*"]): ("SHIFT", 41), - (41, G["false"]): ("SHIFT", 26), - (41, G["new"]): ("SHIFT", 22), - (41, G["string"]): ("SHIFT", 34), (41, G["id"]): ("SHIFT", 28), + (41, G["string"]): ("SHIFT", 34), + (41, G["new"]): ("SHIFT", 22), (41, G["true"]): ("SHIFT", 25), (41, G["isvoid"]): ("SHIFT", 24), (41, G["int"]): ("SHIFT", 33), (41, G["~"]): ("SHIFT", 27), (41, G["("]): ("SHIFT", 11), - (42, G[")"]): ("REDUCE", G["term -> term * factor"]), - (42, G["-"]): ("REDUCE", G["term -> term * factor"]), - (42, G["in"]): ("REDUCE", G["term -> term * factor"]), - (42, G["*"]): ("REDUCE", G["term -> term * factor"]), - (42, G["}"]): ("REDUCE", G["term -> term * factor"]), + (41, G["false"]): ("SHIFT", 26), (42, G["/"]): ("REDUCE", G["term -> term * factor"]), (42, G["of"]): ("REDUCE", G["term -> term * factor"]), (42, G["<"]): ("REDUCE", G["term -> term * factor"]), - (42, G["fi"]): ("REDUCE", G["term -> term * factor"]), + (42, G[")"]): ("REDUCE", G["term -> term * factor"]), + (42, G["then"]): ("REDUCE", G["term -> term * factor"]), (42, G["<="]): ("REDUCE", G["term -> term * factor"]), + (42, G["error"]): ("REDUCE", G["term -> term * factor"]), + (42, G["else"]): ("REDUCE", G["term -> term * factor"]), + (42, G["in"]): ("REDUCE", G["term -> term * factor"]), (42, G["="]): ("REDUCE", G["term -> term * factor"]), + (42, G[","]): ("REDUCE", G["term -> term * factor"]), + (42, G["fi"]): ("REDUCE", G["term -> term * factor"]), (42, G[";"]): ("REDUCE", G["term -> term * factor"]), - (42, G["else"]): ("REDUCE", G["term -> term * factor"]), - (42, G["then"]): ("REDUCE", G["term -> term * factor"]), (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), - (42, G["error"]): ("REDUCE", G["term -> term * factor"]), - (42, G[","]): ("REDUCE", G["term -> term * factor"]), (42, G["pool"]): ("REDUCE", G["term -> term * factor"]), (42, G["+"]): ("REDUCE", G["term -> term * factor"]), - (43, G[")"]): ("REDUCE", G["factor -> atom"]), - (43, G["-"]): ("REDUCE", G["factor -> atom"]), - (43, G["in"]): ("REDUCE", G["factor -> atom"]), - (43, G["*"]): ("REDUCE", G["factor -> atom"]), - (43, G["}"]): ("REDUCE", G["factor -> atom"]), + (42, G["-"]): ("REDUCE", G["term -> term * factor"]), + (42, G["*"]): ("REDUCE", G["term -> term * factor"]), + (42, G["}"]): ("REDUCE", G["term -> term * factor"]), + (43, G["."]): ("SHIFT", 44), (43, G["/"]): ("REDUCE", G["factor -> atom"]), (43, G["of"]): ("REDUCE", G["factor -> atom"]), (43, G["<"]): ("REDUCE", G["factor -> atom"]), - (43, G["fi"]): ("REDUCE", G["factor -> atom"]), + (43, G[")"]): ("REDUCE", G["factor -> atom"]), + (43, G["then"]): ("REDUCE", G["factor -> atom"]), (43, G["<="]): ("REDUCE", G["factor -> atom"]), + (43, G["error"]): ("REDUCE", G["factor -> atom"]), + (43, G["else"]): ("REDUCE", G["factor -> atom"]), + (43, G["in"]): ("REDUCE", G["factor -> atom"]), (43, G["="]): ("REDUCE", G["factor -> atom"]), + (43, G[","]): ("REDUCE", G["factor -> atom"]), + (43, G["fi"]): ("REDUCE", G["factor -> atom"]), (43, G[";"]): ("REDUCE", G["factor -> atom"]), - (43, G["else"]): ("REDUCE", G["factor -> atom"]), - (43, G["then"]): ("REDUCE", G["factor -> atom"]), (43, G["loop"]): ("REDUCE", G["factor -> atom"]), - (43, G["error"]): ("REDUCE", G["factor -> atom"]), - (43, G[","]): ("REDUCE", G["factor -> atom"]), (43, G["pool"]): ("REDUCE", G["factor -> atom"]), (43, G["+"]): ("REDUCE", G["factor -> atom"]), + (43, G["-"]): ("REDUCE", G["factor -> atom"]), + (43, G["*"]): ("REDUCE", G["factor -> atom"]), + (43, G["}"]): ("REDUCE", G["factor -> atom"]), (43, G["@"]): ("SHIFT", 57), - (43, G["."]): ("SHIFT", 44), (44, G["id"]): ("SHIFT", 45), (45, G["("]): ("SHIFT", 46), - (46, G["new"]): ("SHIFT", 22), - (46, G["true"]): ("SHIFT", 25), - (46, G["isvoid"]): ("SHIFT", 24), - (46, G["string"]): ("SHIFT", 34), (46, G["while"]): ("SHIFT", 13), - (46, G["false"]): ("SHIFT", 26), + (46, G["true"]): ("SHIFT", 25), + (46, G["id"]): ("SHIFT", 31), (46, G["~"]): ("SHIFT", 27), + (46, G["string"]): ("SHIFT", 34), + (46, G["{"]): ("SHIFT", 10), (46, G["not"]): ("SHIFT", 30), (46, G["if"]): ("SHIFT", 12), + (46, G["isvoid"]): ("SHIFT", 24), + (46, G["int"]): ("SHIFT", 33), + (46, G["let"]): ("SHIFT", 14), (46, G["("]): ("SHIFT", 11), + (46, G["false"]): ("SHIFT", 26), + (46, G["new"]): ("SHIFT", 22), (46, G[")"]): ("REDUCE", G["expr-list -> e"]), - (46, G["let"]): ("SHIFT", 14), (46, G["case"]): ("SHIFT", 21), - (46, G["id"]): ("SHIFT", 31), - (46, G["int"]): ("SHIFT", 33), - (46, G["{"]): ("SHIFT", 10), (47, G[")"]): ("SHIFT", 48), - (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (49, G[")"]): ("REDUCE", G["expr-list -> not-empty-expr-list"]), (50, G[","]): ("SHIFT", 51), (50, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), - (51, G["new"]): ("SHIFT", 22), - (51, G["true"]): ("SHIFT", 25), - (51, G["isvoid"]): ("SHIFT", 24), - (51, G["string"]): ("SHIFT", 34), (51, G["while"]): ("SHIFT", 13), - (51, G["false"]): ("SHIFT", 26), + (51, G["true"]): ("SHIFT", 25), + (51, G["id"]): ("SHIFT", 31), (51, G["~"]): ("SHIFT", 27), + (51, G["string"]): ("SHIFT", 34), + (51, G["{"]): ("SHIFT", 10), (51, G["not"]): ("SHIFT", 30), (51, G["if"]): ("SHIFT", 12), - (51, G["("]): ("SHIFT", 11), + (51, G["isvoid"]): ("SHIFT", 24), + (51, G["int"]): ("SHIFT", 33), (51, G["let"]): ("SHIFT", 14), + (51, G["("]): ("SHIFT", 11), + (51, G["false"]): ("SHIFT", 26), + (51, G["new"]): ("SHIFT", 22), (51, G["case"]): ("SHIFT", 21), - (51, G["id"]): ("SHIFT", 31), - (51, G["int"]): ("SHIFT", 33), - (51, G["{"]): ("SHIFT", 10), (52, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr , not-empty-expr-list"]), (53, G["/"]): ("SHIFT", 54), - (53, G[")"]): ("REDUCE", G["arith -> term"]), - (53, G["in"]): ("REDUCE", G["arith -> term"]), - (53, G["-"]): ("REDUCE", G["arith -> term"]), - (53, G["}"]): ("REDUCE", G["arith -> term"]), + (53, G["*"]): ("SHIFT", 41), (53, G["of"]): ("REDUCE", G["arith -> term"]), (53, G["<"]): ("REDUCE", G["arith -> term"]), - (53, G["fi"]): ("REDUCE", G["arith -> term"]), + (53, G[")"]): ("REDUCE", G["arith -> term"]), + (53, G["then"]): ("REDUCE", G["arith -> term"]), (53, G["<="]): ("REDUCE", G["arith -> term"]), + (53, G["error"]): ("REDUCE", G["arith -> term"]), + (53, G["else"]): ("REDUCE", G["arith -> term"]), (53, G["="]): ("REDUCE", G["arith -> term"]), + (53, G[","]): ("REDUCE", G["arith -> term"]), + (53, G["fi"]): ("REDUCE", G["arith -> term"]), (53, G[";"]): ("REDUCE", G["arith -> term"]), - (53, G["else"]): ("REDUCE", G["arith -> term"]), - (53, G["then"]): ("REDUCE", G["arith -> term"]), (53, G["loop"]): ("REDUCE", G["arith -> term"]), - (53, G["error"]): ("REDUCE", G["arith -> term"]), - (53, G[","]): ("REDUCE", G["arith -> term"]), (53, G["pool"]): ("REDUCE", G["arith -> term"]), (53, G["+"]): ("REDUCE", G["arith -> term"]), - (53, G["*"]): ("SHIFT", 41), - (54, G["false"]): ("SHIFT", 26), - (54, G["new"]): ("SHIFT", 22), - (54, G["string"]): ("SHIFT", 34), + (53, G["in"]): ("REDUCE", G["arith -> term"]), + (53, G["-"]): ("REDUCE", G["arith -> term"]), + (53, G["}"]): ("REDUCE", G["arith -> term"]), (54, G["id"]): ("SHIFT", 28), + (54, G["string"]): ("SHIFT", 34), + (54, G["new"]): ("SHIFT", 22), (54, G["true"]): ("SHIFT", 25), (54, G["isvoid"]): ("SHIFT", 24), (54, G["int"]): ("SHIFT", 33), - (54, G["~"]): ("SHIFT", 27), - (54, G["("]): ("SHIFT", 11), - (55, G[")"]): ("REDUCE", G["term -> term / factor"]), - (55, G["-"]): ("REDUCE", G["term -> term / factor"]), - (55, G["in"]): ("REDUCE", G["term -> term / factor"]), - (55, G["*"]): ("REDUCE", G["term -> term / factor"]), - (55, G["}"]): ("REDUCE", G["term -> term / factor"]), + (54, G["~"]): ("SHIFT", 27), + (54, G["("]): ("SHIFT", 11), + (54, G["false"]): ("SHIFT", 26), (55, G["/"]): ("REDUCE", G["term -> term / factor"]), (55, G["of"]): ("REDUCE", G["term -> term / factor"]), (55, G["<"]): ("REDUCE", G["term -> term / factor"]), - (55, G["fi"]): ("REDUCE", G["term -> term / factor"]), + (55, G[")"]): ("REDUCE", G["term -> term / factor"]), + (55, G["then"]): ("REDUCE", G["term -> term / factor"]), (55, G["<="]): ("REDUCE", G["term -> term / factor"]), + (55, G["error"]): ("REDUCE", G["term -> term / factor"]), + (55, G["else"]): ("REDUCE", G["term -> term / factor"]), + (55, G["in"]): ("REDUCE", G["term -> term / factor"]), (55, G["="]): ("REDUCE", G["term -> term / factor"]), + (55, G[","]): ("REDUCE", G["term -> term / factor"]), + (55, G["fi"]): ("REDUCE", G["term -> term / factor"]), (55, G[";"]): ("REDUCE", G["term -> term / factor"]), - (55, G["else"]): ("REDUCE", G["term -> term / factor"]), - (55, G["then"]): ("REDUCE", G["term -> term / factor"]), (55, G["loop"]): ("REDUCE", G["term -> term / factor"]), - (55, G["error"]): ("REDUCE", G["term -> term / factor"]), - (55, G[","]): ("REDUCE", G["term -> term / factor"]), (55, G["pool"]): ("REDUCE", G["term -> term / factor"]), (55, G["+"]): ("REDUCE", G["term -> term / factor"]), - (56, G[")"]): ("REDUCE", G["term -> factor"]), - (56, G["-"]): ("REDUCE", G["term -> factor"]), - (56, G["in"]): ("REDUCE", G["term -> factor"]), - (56, G["*"]): ("REDUCE", G["term -> factor"]), - (56, G["}"]): ("REDUCE", G["term -> factor"]), + (55, G["-"]): ("REDUCE", G["term -> term / factor"]), + (55, G["*"]): ("REDUCE", G["term -> term / factor"]), + (55, G["}"]): ("REDUCE", G["term -> term / factor"]), (56, G["/"]): ("REDUCE", G["term -> factor"]), (56, G["of"]): ("REDUCE", G["term -> factor"]), (56, G["<"]): ("REDUCE", G["term -> factor"]), - (56, G["fi"]): ("REDUCE", G["term -> factor"]), + (56, G[")"]): ("REDUCE", G["term -> factor"]), + (56, G["then"]): ("REDUCE", G["term -> factor"]), (56, G["<="]): ("REDUCE", G["term -> factor"]), + (56, G["error"]): ("REDUCE", G["term -> factor"]), + (56, G["else"]): ("REDUCE", G["term -> factor"]), + (56, G["in"]): ("REDUCE", G["term -> factor"]), (56, G["="]): ("REDUCE", G["term -> factor"]), + (56, G[","]): ("REDUCE", G["term -> factor"]), + (56, G["fi"]): ("REDUCE", G["term -> factor"]), (56, G[";"]): ("REDUCE", G["term -> factor"]), - (56, G["else"]): ("REDUCE", G["term -> factor"]), - (56, G["then"]): ("REDUCE", G["term -> factor"]), (56, G["loop"]): ("REDUCE", G["term -> factor"]), - (56, G["error"]): ("REDUCE", G["term -> factor"]), - (56, G[","]): ("REDUCE", G["term -> factor"]), (56, G["pool"]): ("REDUCE", G["term -> factor"]), (56, G["+"]): ("REDUCE", G["term -> factor"]), + (56, G["-"]): ("REDUCE", G["term -> factor"]), + (56, G["*"]): ("REDUCE", G["term -> factor"]), + (56, G["}"]): ("REDUCE", G["term -> factor"]), (57, G["type"]): ("SHIFT", 58), (58, G["."]): ("SHIFT", 59), (59, G["id"]): ("SHIFT", 60), (60, G["("]): ("SHIFT", 61), - (61, G["new"]): ("SHIFT", 22), - (61, G["true"]): ("SHIFT", 25), - (61, G["isvoid"]): ("SHIFT", 24), - (61, G["string"]): ("SHIFT", 34), (61, G["while"]): ("SHIFT", 13), - (61, G["false"]): ("SHIFT", 26), + (61, G["true"]): ("SHIFT", 25), + (61, G["id"]): ("SHIFT", 31), (61, G["~"]): ("SHIFT", 27), + (61, G["string"]): ("SHIFT", 34), + (61, G["{"]): ("SHIFT", 10), (61, G["not"]): ("SHIFT", 30), (61, G["if"]): ("SHIFT", 12), + (61, G["isvoid"]): ("SHIFT", 24), + (61, G["int"]): ("SHIFT", 33), + (61, G["let"]): ("SHIFT", 14), (61, G["("]): ("SHIFT", 11), + (61, G["false"]): ("SHIFT", 26), + (61, G["new"]): ("SHIFT", 22), (61, G[")"]): ("REDUCE", G["expr-list -> e"]), - (61, G["let"]): ("SHIFT", 14), (61, G["case"]): ("SHIFT", 21), - (61, G["id"]): ("SHIFT", 31), - (61, G["int"]): ("SHIFT", 33), - (61, G["{"]): ("SHIFT", 10), (62, G[")"]): ("SHIFT", 63), - (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (64, G["false"]): ("SHIFT", 26), - (64, G["new"]): ("SHIFT", 22), + (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (64, G["id"]): ("SHIFT", 28), (64, G["true"]): ("SHIFT", 25), (64, G["isvoid"]): ("SHIFT", 24), - (64, G["("]): ("SHIFT", 11), + (64, G["false"]): ("SHIFT", 26), (64, G["string"]): ("SHIFT", 34), - (64, G["id"]): ("SHIFT", 28), (64, G["int"]): ("SHIFT", 33), (64, G["~"]): ("SHIFT", 27), + (64, G["("]): ("SHIFT", 11), + (64, G["new"]): ("SHIFT", 22), (65, G["/"]): ("SHIFT", 54), - (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["-"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["}"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["*"]): ("SHIFT", 41), (65, G["of"]): ("REDUCE", G["arith -> arith - term"]), (65, G["<"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["fi"]): ("REDUCE", G["arith -> arith - term"]), + (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["then"]): ("REDUCE", G["arith -> arith - term"]), (65, G["<="]): ("REDUCE", G["arith -> arith - term"]), + (65, G["error"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["else"]): ("REDUCE", G["arith -> arith - term"]), (65, G["="]): ("REDUCE", G["arith -> arith - term"]), + (65, G[","]): ("REDUCE", G["arith -> arith - term"]), + (65, G["fi"]): ("REDUCE", G["arith -> arith - term"]), (65, G[";"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["else"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["then"]): ("REDUCE", G["arith -> arith - term"]), (65, G["loop"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["error"]): ("REDUCE", G["arith -> arith - term"]), - (65, G[","]): ("REDUCE", G["arith -> arith - term"]), (65, G["pool"]): ("REDUCE", G["arith -> arith - term"]), (65, G["+"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["*"]): ("SHIFT", 41), - (66, G["("]): ("SHIFT", 11), + (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["-"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["}"]): ("REDUCE", G["arith -> arith - term"]), + (66, G["new"]): ("SHIFT", 22), (66, G["id"]): ("SHIFT", 28), + (66, G["true"]): ("SHIFT", 25), (66, G["string"]): ("SHIFT", 34), + (66, G["~"]): ("SHIFT", 27), (66, G["int"]): ("SHIFT", 33), - (66, G["isvoid"]): ("SHIFT", 24), (66, G["false"]): ("SHIFT", 26), - (66, G["true"]): ("SHIFT", 25), - (66, G["new"]): ("SHIFT", 22), - (66, G["~"]): ("SHIFT", 27), - (67, G["+"]): ("SHIFT", 39), - (67, G["-"]): ("SHIFT", 64), + (66, G["isvoid"]): ("SHIFT", 24), + (66, G["("]): ("SHIFT", 11), (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["in"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["else"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["}"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), - (68, G["("]): ("SHIFT", 11), + (67, G["else"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["in"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["}"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["+"]): ("SHIFT", 39), + (67, G["-"]): ("SHIFT", 64), + (68, G["new"]): ("SHIFT", 22), (68, G["id"]): ("SHIFT", 28), + (68, G["true"]): ("SHIFT", 25), (68, G["string"]): ("SHIFT", 34), + (68, G["~"]): ("SHIFT", 27), (68, G["int"]): ("SHIFT", 33), - (68, G["isvoid"]): ("SHIFT", 24), (68, G["false"]): ("SHIFT", 26), - (68, G["true"]): ("SHIFT", 25), - (68, G["new"]): ("SHIFT", 22), - (68, G["~"]): ("SHIFT", 27), - (69, G["+"]): ("SHIFT", 39), + (68, G["isvoid"]): ("SHIFT", 24), + (68, G["("]): ("SHIFT", 11), (69, G["-"]): ("SHIFT", 64), (69, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), - (70, G["("]): ("SHIFT", 11), + (69, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["+"]): ("SHIFT", 39), + (70, G["new"]): ("SHIFT", 22), (70, G["id"]): ("SHIFT", 28), + (70, G["true"]): ("SHIFT", 25), (70, G["string"]): ("SHIFT", 34), + (70, G["~"]): ("SHIFT", 27), (70, G["int"]): ("SHIFT", 33), - (70, G["isvoid"]): ("SHIFT", 24), (70, G["false"]): ("SHIFT", 26), - (70, G["true"]): ("SHIFT", 25), - (70, G["new"]): ("SHIFT", 22), - (70, G["~"]): ("SHIFT", 27), - (71, G["+"]): ("SHIFT", 39), + (70, G["isvoid"]): ("SHIFT", 24), + (70, G["("]): ("SHIFT", 11), (71, G["-"]): ("SHIFT", 64), (71, G[";"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["in"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["else"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["}"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["error"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["else"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["in"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["}"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["+"]): ("SHIFT", 39), (72, G[";"]): ("REDUCE", G["expr -> not expr"]), + (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), + (72, G["of"]): ("REDUCE", G["expr -> not expr"]), + (72, G["pool"]): ("REDUCE", G["expr -> not expr"]), (72, G[")"]): ("REDUCE", G["expr -> not expr"]), - (72, G["in"]): ("REDUCE", G["expr -> not expr"]), - (72, G["else"]): ("REDUCE", G["expr -> not expr"]), (72, G["then"]): ("REDUCE", G["expr -> not expr"]), - (72, G["}"]): ("REDUCE", G["expr -> not expr"]), - (72, G["of"]): ("REDUCE", G["expr -> not expr"]), - (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), (72, G["error"]): ("REDUCE", G["expr -> not expr"]), - (72, G["fi"]): ("REDUCE", G["expr -> not expr"]), + (72, G["else"]): ("REDUCE", G["expr -> not expr"]), + (72, G["in"]): ("REDUCE", G["expr -> not expr"]), (72, G[","]): ("REDUCE", G["expr -> not expr"]), - (72, G["pool"]): ("REDUCE", G["expr -> not expr"]), + (72, G["fi"]): ("REDUCE", G["expr -> not expr"]), + (72, G["}"]): ("REDUCE", G["expr -> not expr"]), (73, G[")"]): ("SHIFT", 74), - (74, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G[")"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["-"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["*"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["}"]): ("REDUCE", G["factor -> ~ factor"]), + (74, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (75, G["/"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["of"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["<"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G[")"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["then"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["<="]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["else"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["="]): ("REDUCE", G["factor -> ~ factor"]), + (75, G[","]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), (75, G[";"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["else"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["then"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G[","]): ("REDUCE", G["factor -> ~ factor"]), (75, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["+"]): ("REDUCE", G["factor -> ~ factor"]), - (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), + (75, G["-"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["*"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["}"]): ("REDUCE", G["factor -> ~ factor"]), (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), (77, G["of"]): ("SHIFT", 78), (78, G["id"]): ("SHIFT", 79), (79, G[":"]): ("SHIFT", 80), (80, G["type"]): ("SHIFT", 81), (81, G["=>"]): ("SHIFT", 82), + (82, G["isvoid"]): ("SHIFT", 24), (82, G["id"]): ("SHIFT", 31), - (82, G["~"]): ("SHIFT", 27), (82, G["int"]): ("SHIFT", 33), - (82, G["case"]): ("SHIFT", 21), - (82, G["let"]): ("SHIFT", 14), - (82, G["true"]): ("SHIFT", 25), + (82, G["("]): ("SHIFT", 11), (82, G["{"]): ("SHIFT", 10), - (82, G["new"]): ("SHIFT", 22), - (82, G["string"]): ("SHIFT", 34), (82, G["false"]): ("SHIFT", 26), - (82, G["while"]): ("SHIFT", 13), - (82, G["isvoid"]): ("SHIFT", 24), + (82, G["new"]): ("SHIFT", 22), + (82, G["~"]): ("SHIFT", 27), (82, G["not"]): ("SHIFT", 30), + (82, G["true"]): ("SHIFT", 25), (82, G["if"]): ("SHIFT", 12), - (82, G["("]): ("SHIFT", 11), - (83, G[";"]): ("SHIFT", 84), + (82, G["string"]): ("SHIFT", 34), + (82, G["let"]): ("SHIFT", 14), + (82, G["case"]): ("SHIFT", 21), + (82, G["while"]): ("SHIFT", 13), (83, G["error"]): ("SHIFT", 86), + (83, G[";"]): ("SHIFT", 84), (84, G["id"]): ("SHIFT", 79), (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), @@ -860,197 +860,197 @@ def __action_table(): (87, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error case-list"]), (88, G["esac"]): ("SHIFT", 89), (89, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G[","]): ("SHIFT", 91), + (89, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (90, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), + (90, G[","]): ("SHIFT", 91), (91, G["id"]): ("SHIFT", 15), (92, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), (93, G["in"]): ("SHIFT", 94), - (94, G["new"]): ("SHIFT", 22), - (94, G["true"]): ("SHIFT", 25), - (94, G["isvoid"]): ("SHIFT", 24), + (94, G["case"]): ("SHIFT", 21), + (94, G["let"]): ("SHIFT", 14), + (94, G["id"]): ("SHIFT", 31), (94, G["while"]): ("SHIFT", 13), - (94, G["string"]): ("SHIFT", 34), + (94, G["isvoid"]): ("SHIFT", 24), + (94, G["int"]): ("SHIFT", 33), + (94, G["{"]): ("SHIFT", 10), (94, G["~"]): ("SHIFT", 27), + (94, G["("]): ("SHIFT", 11), + (94, G["false"]): ("SHIFT", 26), + (94, G["new"]): ("SHIFT", 22), (94, G["not"]): ("SHIFT", 30), + (94, G["true"]): ("SHIFT", 25), (94, G["if"]): ("SHIFT", 12), - (94, G["false"]): ("SHIFT", 26), - (94, G["let"]): ("SHIFT", 14), - (94, G["case"]): ("SHIFT", 21), - (94, G["{"]): ("SHIFT", 10), - (94, G["id"]): ("SHIFT", 31), - (94, G["("]): ("SHIFT", 11), - (94, G["int"]): ("SHIFT", 33), + (94, G["string"]): ("SHIFT", 34), (95, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (96, G["loop"]): ("SHIFT", 97), - (97, G["string"]): ("SHIFT", 34), - (97, G["false"]): ("SHIFT", 26), - (97, G["while"]): ("SHIFT", 13), - (97, G["("]): ("SHIFT", 11), + (97, G["let"]): ("SHIFT", 14), (97, G["id"]): ("SHIFT", 31), - (97, G["int"]): ("SHIFT", 33), - (97, G["not"]): ("SHIFT", 30), + (97, G["while"]): ("SHIFT", 13), + (97, G["case"]): ("SHIFT", 21), (97, G["isvoid"]): ("SHIFT", 24), - (97, G["if"]): ("SHIFT", 12), + (97, G["int"]): ("SHIFT", 33), + (97, G["{"]): ("SHIFT", 10), + (97, G["("]): ("SHIFT", 11), + (97, G["false"]): ("SHIFT", 26), (97, G["new"]): ("SHIFT", 22), - (97, G["let"]): ("SHIFT", 14), - (97, G["case"]): ("SHIFT", 21), + (97, G["not"]): ("SHIFT", 30), (97, G["true"]): ("SHIFT", 25), (97, G["~"]): ("SHIFT", 27), - (97, G["{"]): ("SHIFT", 10), + (97, G["if"]): ("SHIFT", 12), + (97, G["string"]): ("SHIFT", 34), (98, G["pool"]): ("SHIFT", 99), (99, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (100, G["then"]): ("SHIFT", 101), - (101, G["not"]): ("SHIFT", 30), - (101, G["if"]): ("SHIFT", 12), - (101, G["string"]): ("SHIFT", 34), - (101, G["isvoid"]): ("SHIFT", 24), - (101, G["let"]): ("SHIFT", 14), + (101, G["int"]): ("SHIFT", 33), (101, G["case"]): ("SHIFT", 21), - (101, G["false"]): ("SHIFT", 26), - (101, G["id"]): ("SHIFT", 31), - (101, G["{"]): ("SHIFT", 10), - (101, G["~"]): ("SHIFT", 27), + (101, G["let"]): ("SHIFT", 14), (101, G["("]): ("SHIFT", 11), - (101, G["int"]): ("SHIFT", 33), - (101, G["new"]): ("SHIFT", 22), (101, G["while"]): ("SHIFT", 13), + (101, G["false"]): ("SHIFT", 26), + (101, G["new"]): ("SHIFT", 22), + (101, G["~"]): ("SHIFT", 27), (101, G["true"]): ("SHIFT", 25), + (101, G["id"]): ("SHIFT", 31), + (101, G["string"]): ("SHIFT", 34), + (101, G["{"]): ("SHIFT", 10), + (101, G["not"]): ("SHIFT", 30), + (101, G["if"]): ("SHIFT", 12), + (101, G["isvoid"]): ("SHIFT", 24), (102, G["else"]): ("SHIFT", 103), (103, G["not"]): ("SHIFT", 30), + (103, G["int"]): ("SHIFT", 33), + (103, G["("]): ("SHIFT", 11), + (103, G["false"]): ("SHIFT", 26), (103, G["if"]): ("SHIFT", 12), - (103, G["string"]): ("SHIFT", 34), - (103, G["let"]): ("SHIFT", 14), - (103, G["case"]): ("SHIFT", 21), - (103, G["id"]): ("SHIFT", 31), - (103, G["{"]): ("SHIFT", 10), + (103, G["new"]): ("SHIFT", 22), (103, G["isvoid"]): ("SHIFT", 24), - (103, G["false"]): ("SHIFT", 26), - (103, G["("]): ("SHIFT", 11), - (103, G["~"]): ("SHIFT", 27), - (103, G["int"]): ("SHIFT", 33), - (103, G["while"]): ("SHIFT", 13), (103, G["true"]): ("SHIFT", 25), - (103, G["new"]): ("SHIFT", 22), + (103, G["id"]): ("SHIFT", 31), + (103, G["case"]): ("SHIFT", 21), + (103, G["let"]): ("SHIFT", 14), + (103, G["string"]): ("SHIFT", 34), + (103, G["while"]): ("SHIFT", 13), + (103, G["~"]): ("SHIFT", 27), + (103, G["{"]): ("SHIFT", 10), (104, G["fi"]): ("SHIFT", 105), (105, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (106, G[")"]): ("SHIFT", 107), - (107, G[")"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["-"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["in"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["*"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["}"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["/"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["of"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["<"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G[")"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["then"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["<="]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["@"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["error"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["."]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["else"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["in"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["="]): ("REDUCE", G["atom -> ( expr )"]), + (107, G[","]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), (107, G[";"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["else"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["then"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["error"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G[","]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["@"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["+"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["."]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["-"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["*"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["}"]): ("REDUCE", G["atom -> ( expr )"]), (108, G["}"]): ("SHIFT", 109), (109, G[";"]): ("REDUCE", G["expr -> { block }"]), + (109, G["loop"]): ("REDUCE", G["expr -> { block }"]), + (109, G["of"]): ("REDUCE", G["expr -> { block }"]), + (109, G["pool"]): ("REDUCE", G["expr -> { block }"]), (109, G[")"]): ("REDUCE", G["expr -> { block }"]), - (109, G["in"]): ("REDUCE", G["expr -> { block }"]), - (109, G["else"]): ("REDUCE", G["expr -> { block }"]), (109, G["then"]): ("REDUCE", G["expr -> { block }"]), - (109, G["}"]): ("REDUCE", G["expr -> { block }"]), - (109, G["of"]): ("REDUCE", G["expr -> { block }"]), - (109, G["loop"]): ("REDUCE", G["expr -> { block }"]), (109, G["error"]): ("REDUCE", G["expr -> { block }"]), - (109, G["fi"]): ("REDUCE", G["expr -> { block }"]), (109, G[","]): ("REDUCE", G["expr -> { block }"]), - (109, G["pool"]): ("REDUCE", G["expr -> { block }"]), + (109, G["else"]): ("REDUCE", G["expr -> { block }"]), + (109, G["in"]): ("REDUCE", G["expr -> { block }"]), + (109, G["fi"]): ("REDUCE", G["expr -> { block }"]), + (109, G["}"]): ("REDUCE", G["expr -> { block }"]), (110, G[";"]): ("SHIFT", 111), (110, G["error"]): ("SHIFT", 113), - (111, G["}"]): ("REDUCE", G["block -> expr ;"]), + (111, G["isvoid"]): ("SHIFT", 24), (111, G["id"]): ("SHIFT", 31), - (111, G["~"]): ("SHIFT", 27), (111, G["int"]): ("SHIFT", 33), - (111, G["case"]): ("SHIFT", 21), - (111, G["let"]): ("SHIFT", 14), - (111, G["true"]): ("SHIFT", 25), + (111, G["("]): ("SHIFT", 11), (111, G["{"]): ("SHIFT", 10), - (111, G["new"]): ("SHIFT", 22), - (111, G["string"]): ("SHIFT", 34), (111, G["false"]): ("SHIFT", 26), - (111, G["while"]): ("SHIFT", 13), - (111, G["isvoid"]): ("SHIFT", 24), + (111, G["new"]): ("SHIFT", 22), + (111, G["~"]): ("SHIFT", 27), (111, G["not"]): ("SHIFT", 30), + (111, G["true"]): ("SHIFT", 25), + (111, G["}"]): ("REDUCE", G["block -> expr ;"]), (111, G["if"]): ("SHIFT", 12), - (111, G["("]): ("SHIFT", 11), + (111, G["string"]): ("SHIFT", 34), + (111, G["let"]): ("SHIFT", 14), + (111, G["case"]): ("SHIFT", 21), + (111, G["while"]): ("SHIFT", 13), (112, G["}"]): ("REDUCE", G["block -> expr ; block"]), + (113, G["isvoid"]): ("SHIFT", 24), (113, G["id"]): ("SHIFT", 31), - (113, G["~"]): ("SHIFT", 27), (113, G["int"]): ("SHIFT", 33), - (113, G["case"]): ("SHIFT", 21), - (113, G["let"]): ("SHIFT", 14), - (113, G["true"]): ("SHIFT", 25), + (113, G["}"]): ("REDUCE", G["block -> expr error"]), + (113, G["("]): ("SHIFT", 11), (113, G["{"]): ("SHIFT", 10), - (113, G["new"]): ("SHIFT", 22), - (113, G["string"]): ("SHIFT", 34), (113, G["false"]): ("SHIFT", 26), - (113, G["while"]): ("SHIFT", 13), - (113, G["isvoid"]): ("SHIFT", 24), - (113, G["}"]): ("REDUCE", G["block -> expr error"]), + (113, G["new"]): ("SHIFT", 22), + (113, G["~"]): ("SHIFT", 27), (113, G["not"]): ("SHIFT", 30), + (113, G["true"]): ("SHIFT", 25), (113, G["if"]): ("SHIFT", 12), - (113, G["("]): ("SHIFT", 11), + (113, G["string"]): ("SHIFT", 34), + (113, G["let"]): ("SHIFT", 14), + (113, G["case"]): ("SHIFT", 21), + (113, G["while"]): ("SHIFT", 13), (114, G["}"]): ("REDUCE", G["block -> expr error block"]), (115, G["}"]): ("SHIFT", 116), - (116, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), (116, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (116, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), (117, G[":"]): ("SHIFT", 118), (118, G["type"]): ("SHIFT", 119), (119, G[","]): ("SHIFT", 120), @@ -1061,55 +1061,55 @@ def __action_table(): (123, G[":"]): ("SHIFT", 124), (124, G["type"]): ("SHIFT", 125), (125, G["{"]): ("SHIFT", 126), + (126, G["{"]): ("SHIFT", 10), + (126, G["~"]): ("SHIFT", 27), (126, G["not"]): ("SHIFT", 30), - (126, G["if"]): ("SHIFT", 12), - (126, G["("]): ("SHIFT", 11), (126, G["id"]): ("SHIFT", 31), - (126, G["case"]): ("SHIFT", 21), - (126, G["let"]): ("SHIFT", 14), + (126, G["if"]): ("SHIFT", 12), (126, G["int"]): ("SHIFT", 33), + (126, G["let"]): ("SHIFT", 14), + (126, G["case"]): ("SHIFT", 21), + (126, G["("]): ("SHIFT", 11), + (126, G["false"]): ("SHIFT", 26), + (126, G["new"]): ("SHIFT", 22), + (126, G["while"]): ("SHIFT", 13), (126, G["isvoid"]): ("SHIFT", 24), - (126, G["{"]): ("SHIFT", 10), (126, G["true"]): ("SHIFT", 25), - (126, G["new"]): ("SHIFT", 22), - (126, G["~"]): ("SHIFT", 27), (126, G["string"]): ("SHIFT", 34), - (126, G["while"]): ("SHIFT", 13), - (126, G["false"]): ("SHIFT", 26), (127, G["}"]): ("SHIFT", 128), - (128, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (128, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (128, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (129, G["type"]): ("SHIFT", 130), - (130, G[";"]): ("REDUCE", G["attribute -> id : type"]), - (130, G["error"]): ("REDUCE", G["attribute -> id : type"]), (130, G["<-"]): ("SHIFT", 131), + (130, G["error"]): ("REDUCE", G["attribute -> id : type"]), + (130, G[";"]): ("REDUCE", G["attribute -> id : type"]), + (131, G["isvoid"]): ("SHIFT", 24), (131, G["id"]): ("SHIFT", 31), (131, G["int"]): ("SHIFT", 33), + (131, G["("]): ("SHIFT", 11), + (131, G["false"]): ("SHIFT", 26), + (131, G["{"]): ("SHIFT", 10), + (131, G["new"]): ("SHIFT", 22), (131, G["~"]): ("SHIFT", 27), - (131, G["let"]): ("SHIFT", 14), - (131, G["case"]): ("SHIFT", 21), + (131, G["not"]): ("SHIFT", 30), (131, G["true"]): ("SHIFT", 25), - (131, G["new"]): ("SHIFT", 22), - (131, G["{"]): ("SHIFT", 10), + (131, G["if"]): ("SHIFT", 12), (131, G["string"]): ("SHIFT", 34), - (131, G["false"]): ("SHIFT", 26), + (131, G["let"]): ("SHIFT", 14), + (131, G["case"]): ("SHIFT", 21), (131, G["while"]): ("SHIFT", 13), - (131, G["isvoid"]): ("SHIFT", 24), - (131, G["not"]): ("SHIFT", 30), - (131, G["if"]): ("SHIFT", 12), - (131, G["("]): ("SHIFT", 11), - (132, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), (132, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (132, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), (133, G["}"]): ("SHIFT", 134), - (134, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), (134, G["class"]): ("REDUCE", G["class-def -> class type { feature-list }"]), + (134, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), (135, G["error"]): ("SHIFT", 143), (135, G[";"]): ("SHIFT", 136), (136, G["id"]): ("SHIFT", 4), (136, G["}"]): ("REDUCE", G["feature-list -> e"]), (137, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), - (138, G["error"]): ("SHIFT", 141), (138, G[";"]): ("SHIFT", 139), + (138, G["error"]): ("SHIFT", 141), (139, G["id"]): ("SHIFT", 4), (139, G["}"]): ("REDUCE", G["feature-list -> e"]), (140, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), @@ -1124,246 +1124,246 @@ def __action_table(): (147, G["id"]): ("SHIFT", 4), (147, G["}"]): ("REDUCE", G["feature-list -> e"]), (148, G["}"]): ("SHIFT", 149), - (149, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), (149, G["class"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), + (149, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), (150, G["$"]): ("OK", None), (151, G["$"]): ("REDUCE", G["program -> class-list"]), - (152, G["class"]): ("SHIFT", 1), (152, G["$"]): ("REDUCE", G["class-list -> class-def"]), + (152, G["class"]): ("SHIFT", 1), (153, G["$"]): ("REDUCE", G["class-list -> class-def class-list"]), } @staticmethod def __goto_table(): return { - (0, G["program"]): 150, (0, G["class-list"]): 151, (0, G["class-def"]): 152, - (3, G["method"]): 138, - (3, G["attribute"]): 135, + (0, G["program"]): 150, (3, G["feature-list"]): 133, + (3, G["attribute"]): 135, + (3, G["method"]): 138, (5, G["param-list"]): 122, - (9, G["atom"]): 43, - (9, G["term"]): 53, - (9, G["function-call"]): 35, (9, G["arith"]): 38, - (9, G["expr"]): 115, + (9, G["term"]): 53, + (9, G["atom"]): 43, (9, G["factor"]): 56, (9, G["comp"]): 37, - (10, G["expr"]): 110, - (10, G["block"]): 108, - (10, G["arith"]): 38, - (10, G["factor"]): 56, + (9, G["expr"]): 115, + (9, G["function-call"]): 35, (10, G["term"]): 53, + (10, G["arith"]): 38, + (10, G["block"]): 108, + (10, G["expr"]): 110, (10, G["atom"]): 43, - (10, G["comp"]): 37, (10, G["function-call"]): 35, + (10, G["factor"]): 56, + (10, G["comp"]): 37, + (11, G["expr"]): 106, (11, G["arith"]): 38, (11, G["term"]): 53, - (11, G["expr"]): 106, - (11, G["comp"]): 37, (11, G["atom"]): 43, (11, G["factor"]): 56, (11, G["function-call"]): 35, + (11, G["comp"]): 37, + (12, G["function-call"]): 35, (12, G["atom"]): 43, + (12, G["term"]): 53, (12, G["arith"]): 38, (12, G["expr"]): 100, - (12, G["term"]): 53, - (12, G["function-call"]): 35, (12, G["comp"]): 37, (12, G["factor"]): 56, - (13, G["arith"]): 38, - (13, G["term"]): 53, (13, G["atom"]): 43, - (13, G["comp"]): 37, - (13, G["function-call"]): 35, + (13, G["term"]): 53, + (13, G["arith"]): 38, (13, G["expr"]): 96, (13, G["factor"]): 56, + (13, G["function-call"]): 35, + (13, G["comp"]): 37, (14, G["declaration-list"]): 93, (18, G["declaration-list"]): 19, (20, G["term"]): 53, (20, G["expr"]): 90, - (20, G["atom"]): 43, (20, G["arith"]): 38, + (20, G["atom"]): 43, (20, G["factor"]): 56, (20, G["function-call"]): 35, (20, G["comp"]): 37, - (21, G["arith"]): 38, (21, G["factor"]): 56, - (21, G["expr"]): 77, - (21, G["term"]): 53, (21, G["atom"]): 43, + (21, G["arith"]): 38, + (21, G["term"]): 53, + (21, G["expr"]): 77, (21, G["comp"]): 37, (21, G["function-call"]): 35, (24, G["atom"]): 43, (24, G["factor"]): 76, (24, G["function-call"]): 35, - (27, G["atom"]): 43, (27, G["factor"]): 75, + (27, G["atom"]): 43, (27, G["function-call"]): 35, - (29, G["arith"]): 38, - (29, G["expr"]): 50, - (29, G["comp"]): 37, - (29, G["not-empty-expr-list"]): 49, - (29, G["atom"]): 43, - (29, G["factor"]): 56, (29, G["term"]): 53, + (29, G["not-empty-expr-list"]): 49, (29, G["function-call"]): 35, + (29, G["expr"]): 50, + (29, G["atom"]): 43, + (29, G["arith"]): 38, (29, G["expr-list"]): 73, + (29, G["factor"]): 56, + (29, G["comp"]): 37, + (30, G["term"]): 53, (30, G["arith"]): 38, - (30, G["factor"]): 56, + (30, G["expr"]): 72, (30, G["atom"]): 43, - (30, G["term"]): 53, (30, G["function-call"]): 35, - (30, G["expr"]): 72, + (30, G["factor"]): 56, (30, G["comp"]): 37, + (32, G["term"]): 53, (32, G["arith"]): 38, - (32, G["factor"]): 56, + (32, G["expr"]): 36, (32, G["atom"]): 43, - (32, G["term"]): 53, (32, G["function-call"]): 35, - (32, G["expr"]): 36, + (32, G["factor"]): 56, (32, G["comp"]): 37, - (39, G["atom"]): 43, (39, G["term"]): 40, + (39, G["atom"]): 43, (39, G["function-call"]): 35, (39, G["factor"]): 56, (41, G["atom"]): 43, (41, G["factor"]): 42, (41, G["function-call"]): 35, - (46, G["arith"]): 38, - (46, G["expr"]): 50, - (46, G["comp"]): 37, + (46, G["term"]): 53, (46, G["not-empty-expr-list"]): 49, + (46, G["function-call"]): 35, + (46, G["expr"]): 50, (46, G["atom"]): 43, + (46, G["arith"]): 38, (46, G["factor"]): 56, - (46, G["term"]): 53, - (46, G["function-call"]): 35, + (46, G["comp"]): 37, (46, G["expr-list"]): 47, - (51, G["arith"]): 38, - (51, G["not-empty-expr-list"]): 52, + (51, G["term"]): 53, + (51, G["function-call"]): 35, (51, G["expr"]): 50, - (51, G["comp"]): 37, (51, G["atom"]): 43, + (51, G["arith"]): 38, + (51, G["not-empty-expr-list"]): 52, (51, G["factor"]): 56, - (51, G["term"]): 53, - (51, G["function-call"]): 35, + (51, G["comp"]): 37, (54, G["atom"]): 43, (54, G["factor"]): 55, (54, G["function-call"]): 35, - (61, G["arith"]): 38, - (61, G["expr"]): 50, - (61, G["comp"]): 37, + (61, G["term"]): 53, (61, G["not-empty-expr-list"]): 49, + (61, G["function-call"]): 35, + (61, G["expr"]): 50, (61, G["atom"]): 43, + (61, G["arith"]): 38, (61, G["factor"]): 56, - (61, G["term"]): 53, - (61, G["function-call"]): 35, + (61, G["comp"]): 37, (61, G["expr-list"]): 62, - (64, G["atom"]): 43, (64, G["term"]): 65, + (64, G["atom"]): 43, (64, G["function-call"]): 35, (64, G["factor"]): 56, - (66, G["term"]): 53, - (66, G["arith"]): 67, (66, G["atom"]): 43, + (66, G["arith"]): 67, (66, G["factor"]): 56, + (66, G["term"]): 53, (66, G["function-call"]): 35, - (68, G["term"]): 53, - (68, G["arith"]): 69, (68, G["atom"]): 43, + (68, G["arith"]): 69, (68, G["factor"]): 56, + (68, G["term"]): 53, (68, G["function-call"]): 35, - (70, G["term"]): 53, - (70, G["arith"]): 71, (70, G["atom"]): 43, + (70, G["arith"]): 71, (70, G["factor"]): 56, + (70, G["term"]): 53, (70, G["function-call"]): 35, (78, G["case-list"]): 88, - (82, G["arith"]): 38, - (82, G["factor"]): 56, (82, G["term"]): 53, - (82, G["atom"]): 43, - (82, G["comp"]): 37, + (82, G["arith"]): 38, (82, G["expr"]): 83, + (82, G["atom"]): 43, (82, G["function-call"]): 35, + (82, G["factor"]): 56, + (82, G["comp"]): 37, (84, G["case-list"]): 85, (86, G["case-list"]): 87, (91, G["declaration-list"]): 92, + (94, G["term"]): 53, (94, G["arith"]): 38, - (94, G["expr"]): 95, - (94, G["factor"]): 56, (94, G["atom"]): 43, - (94, G["term"]): 53, (94, G["function-call"]): 35, + (94, G["factor"]): 56, + (94, G["expr"]): 95, (94, G["comp"]): 37, - (97, G["term"]): 53, - (97, G["atom"]): 43, - (97, G["comp"]): 37, (97, G["arith"]): 38, - (97, G["function-call"]): 35, - (97, G["expr"]): 98, + (97, G["atom"]): 43, (97, G["factor"]): 56, + (97, G["term"]): 53, + (97, G["expr"]): 98, + (97, G["function-call"]): 35, + (97, G["comp"]): 37, + (101, G["comp"]): 37, + (101, G["term"]): 53, (101, G["arith"]): 38, + (101, G["expr"]): 102, (101, G["atom"]): 43, - (101, G["factor"]): 56, (101, G["function-call"]): 35, - (101, G["term"]): 53, - (101, G["comp"]): 37, - (101, G["expr"]): 102, - (103, G["term"]): 53, + (101, G["factor"]): 56, + (103, G["factor"]): 56, (103, G["arith"]): 38, - (103, G["expr"]): 104, + (103, G["term"]): 53, + (103, G["comp"]): 37, (103, G["atom"]): 43, (103, G["function-call"]): 35, - (103, G["comp"]): 37, - (103, G["factor"]): 56, - (111, G["expr"]): 110, - (111, G["arith"]): 38, - (111, G["factor"]): 56, - (111, G["block"]): 112, + (103, G["expr"]): 104, (111, G["term"]): 53, + (111, G["arith"]): 38, + (111, G["expr"]): 110, (111, G["atom"]): 43, - (111, G["comp"]): 37, (111, G["function-call"]): 35, - (113, G["expr"]): 110, - (113, G["arith"]): 38, - (113, G["factor"]): 56, + (111, G["factor"]): 56, + (111, G["comp"]): 37, + (111, G["block"]): 112, (113, G["term"]): 53, - (113, G["block"]): 114, + (113, G["arith"]): 38, + (113, G["expr"]): 110, (113, G["atom"]): 43, - (113, G["comp"]): 37, (113, G["function-call"]): 35, + (113, G["factor"]): 56, + (113, G["comp"]): 37, + (113, G["block"]): 114, (120, G["param-list"]): 121, - (126, G["atom"]): 43, - (126, G["term"]): 53, - (126, G["function-call"]): 35, - (126, G["arith"]): 38, (126, G["expr"]): 127, + (126, G["arith"]): 38, + (126, G["term"]): 53, + (126, G["atom"]): 43, (126, G["factor"]): 56, (126, G["comp"]): 37, - (131, G["arith"]): 38, - (131, G["factor"]): 56, + (126, G["function-call"]): 35, (131, G["term"]): 53, + (131, G["arith"]): 38, (131, G["atom"]): 43, - (131, G["comp"]): 37, (131, G["expr"]): 132, (131, G["function-call"]): 35, - (136, G["method"]): 138, + (131, G["factor"]): 56, + (131, G["comp"]): 37, (136, G["attribute"]): 135, + (136, G["method"]): 138, (136, G["feature-list"]): 137, - (139, G["method"]): 138, (139, G["attribute"]): 135, + (139, G["method"]): 138, (139, G["feature-list"]): 140, - (141, G["method"]): 138, (141, G["attribute"]): 135, (141, G["feature-list"]): 142, - (143, G["method"]): 138, + (141, G["method"]): 138, (143, G["attribute"]): 135, + (143, G["method"]): 138, (143, G["feature-list"]): 144, + (147, G["attribute"]): 135, (147, G["feature-list"]): 148, (147, G["method"]): 138, - (147, G["attribute"]): 135, - (152, G["class-list"]): 153, (152, G["class-def"]): 152, + (152, G["class-list"]): 153, } From 1014a7cfaf1a0d6a6005f96e329252d0de155217 Mon Sep 17 00:00:00 2001 From: LauTB <45464137+LauTB@users.noreply.github.com> Date: Fri, 19 Feb 2021 20:25:45 -0500 Subject: [PATCH 094/143] Fixed index on class-list production --- src/cool/grammar.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/cool/grammar.py b/src/cool/grammar.py index 1e32a48f8..eda8e7d42 100644 --- a/src/cool/grammar.py +++ b/src/cool/grammar.py @@ -223,7 +223,7 @@ def lexical_error(lexer): program %= 'class-list', lambda s: ast.ProgramNode(s[1]) class_list %= 'class-def ;', lambda s: [s[1]] -class_list %= 'class-def ; class-list', lambda s: [s[1]] + s[2] +class_list %= 'class-def ; class-list', lambda s: [s[1]] + s[3] class_def %= 'class type { feature-list }', lambda s: ast.ClassDeclarationNode(s[2], s[4]) class_def %= 'class type inherits type { feature-list }', lambda s: ast.ClassDeclarationNode(s[2], s[6], s[4]) @@ -304,37 +304,37 @@ def lexical_error(lexer): @G.production("feature-list -> attribute error feature-list") def feature_attribute_error(s): - s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'.") + s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: ERROR at or near " + f'"{s[2].lex}"' + ".") return [s[1]] + s[3] @G.production("feature-list -> method error feature-list") def feature_method_error(s): - s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'.") + s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: ERROR at or near " + f'"{s[2].lex}"' + ".") return [s[1]] + s[3] @G.production("case-list -> id : type => expr error") def case_list_error(s): - s.add_error(6, f"{s[6].line, s[6].column} - SyntacticError: Expected ';' instead of '{s[6].lex}'.") + s.add_error(6, f"{s[6].line, s[6].column} - SyntacticError: ERROR at or near " + f'"{s[6].lex}"' + ".") return [(s[1], s[3], s[5])] @G.production("case-list -> id : type => expr error case-list") def case_list_error(s): - s.add_error(6, f"{s[6].line, s[6].column} - SyntacticError: Expected ';' instead of '{s[6].lex}'.") + s.add_error(6, f"{s[6].line, s[6].column} - SyntacticError:ERROR at or near " + f'"{s[6].lex}"' + ".") return [(s[1], s[3], s[5])] + s[7] @G.production("block -> expr error") def block_single_error(s): - s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'.") + s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: ERROR at or near " + f'"{s[2].lex}"' + ".") return [s[1]] @G.production("block -> expr error block") def block_single_error(s): - s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: Expected ';' instead of '{s[2].lex}'.") + s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: ERROR at or near " + f'"{s[2].lex}"' + ".") return [s[1]] + s[3] From 204fbfdb374941016d359c73df40049eac727988 Mon Sep 17 00:00:00 2001 From: LauTB <45464137+LauTB@users.noreply.github.com> Date: Fri, 19 Feb 2021 20:28:55 -0500 Subject: [PATCH 095/143] Changed error messages --- src/cool/__main__.py | 3 +- src/cool/parsertab.py | 885 +++++++++++++++++++++--------------------- 2 files changed, 443 insertions(+), 445 deletions(-) diff --git a/src/cool/__main__.py b/src/cool/__main__.py index 86bac5f57..6d8d1b392 100644 --- a/src/cool/__main__.py +++ b/src/cool/__main__.py @@ -62,8 +62,7 @@ def parse(file: str, verbose: bool = False): ast = parser(tokens) if parser.contains_errors: - for e in parser.errors: - typer.echo(e, err=True) + typer.echo(parser.errors[0], err=True) return ast, parser diff --git a/src/cool/parsertab.py b/src/cool/parsertab.py index e4433bd35..f295712d3 100644 --- a/src/cool/parsertab.py +++ b/src/cool/parsertab.py @@ -18,128 +18,128 @@ def __action_table(): (1, G["type"]): ("SHIFT", 2), (2, G["inherits"]): ("SHIFT", 145), (2, G["{"]): ("SHIFT", 3), - (3, G["id"]): ("SHIFT", 4), (3, G["}"]): ("REDUCE", G["feature-list -> e"]), - (4, G[":"]): ("SHIFT", 129), + (3, G["id"]): ("SHIFT", 4), (4, G["("]): ("SHIFT", 5), + (4, G[":"]): ("SHIFT", 129), (5, G[")"]): ("SHIFT", 6), (5, G["id"]): ("SHIFT", 117), (6, G[":"]): ("SHIFT", 7), (7, G["type"]): ("SHIFT", 8), (8, G["{"]): ("SHIFT", 9), - (9, G["{"]): ("SHIFT", 10), + (9, G["while"]): ("SHIFT", 13), (9, G["~"]): ("SHIFT", 27), - (9, G["not"]): ("SHIFT", 30), - (9, G["id"]): ("SHIFT", 31), + (9, G["isvoid"]): ("SHIFT", 24), + (9, G["{"]): ("SHIFT", 10), (9, G["if"]): ("SHIFT", 12), - (9, G["int"]): ("SHIFT", 33), - (9, G["let"]): ("SHIFT", 14), - (9, G["case"]): ("SHIFT", 21), + (9, G["not"]): ("SHIFT", 30), + (9, G["new"]): ("SHIFT", 22), (9, G["("]): ("SHIFT", 11), + (9, G["string"]): ("SHIFT", 34), + (9, G["int"]): ("SHIFT", 33), (9, G["false"]): ("SHIFT", 26), - (9, G["new"]): ("SHIFT", 22), - (9, G["while"]): ("SHIFT", 13), - (9, G["isvoid"]): ("SHIFT", 24), + (9, G["id"]): ("SHIFT", 31), + (9, G["let"]): ("SHIFT", 14), (9, G["true"]): ("SHIFT", 25), - (9, G["string"]): ("SHIFT", 34), - (10, G["isvoid"]): ("SHIFT", 24), - (10, G["id"]): ("SHIFT", 31), + (9, G["case"]): ("SHIFT", 21), (10, G["int"]): ("SHIFT", 33), - (10, G["("]): ("SHIFT", 11), - (10, G["{"]): ("SHIFT", 10), + (10, G["case"]): ("SHIFT", 21), (10, G["false"]): ("SHIFT", 26), - (10, G["new"]): ("SHIFT", 22), - (10, G["~"]): ("SHIFT", 27), - (10, G["not"]): ("SHIFT", 30), + (10, G["while"]): ("SHIFT", 13), (10, G["true"]): ("SHIFT", 25), + (10, G["id"]): ("SHIFT", 31), + (10, G["{"]): ("SHIFT", 10), (10, G["if"]): ("SHIFT", 12), + (10, G["not"]): ("SHIFT", 30), + (10, G["~"]): ("SHIFT", 27), + (10, G["new"]): ("SHIFT", 22), + (10, G["("]): ("SHIFT", 11), + (10, G["isvoid"]): ("SHIFT", 24), (10, G["string"]): ("SHIFT", 34), (10, G["let"]): ("SHIFT", 14), - (10, G["case"]): ("SHIFT", 21), - (10, G["while"]): ("SHIFT", 13), - (11, G["let"]): ("SHIFT", 14), (11, G["case"]): ("SHIFT", 21), (11, G["while"]): ("SHIFT", 13), - (11, G["~"]): ("SHIFT", 27), - (11, G["int"]): ("SHIFT", 33), - (11, G["id"]): ("SHIFT", 31), - (11, G["("]): ("SHIFT", 11), - (11, G["false"]): ("SHIFT", 26), - (11, G["new"]): ("SHIFT", 22), (11, G["{"]): ("SHIFT", 10), - (11, G["true"]): ("SHIFT", 25), + (11, G["if"]): ("SHIFT", 12), (11, G["not"]): ("SHIFT", 30), + (11, G["new"]): ("SHIFT", 22), + (11, G["("]): ("SHIFT", 11), (11, G["string"]): ("SHIFT", 34), + (11, G["int"]): ("SHIFT", 33), + (11, G["false"]): ("SHIFT", 26), + (11, G["~"]): ("SHIFT", 27), + (11, G["id"]): ("SHIFT", 31), + (11, G["true"]): ("SHIFT", 25), (11, G["isvoid"]): ("SHIFT", 24), - (11, G["if"]): ("SHIFT", 12), - (12, G["true"]): ("SHIFT", 25), - (12, G["id"]): ("SHIFT", 31), + (11, G["let"]): ("SHIFT", 14), + (12, G["while"]): ("SHIFT", 13), (12, G["{"]): ("SHIFT", 10), - (12, G["isvoid"]): ("SHIFT", 24), - (12, G["not"]): ("SHIFT", 30), - (12, G["string"]): ("SHIFT", 34), (12, G["if"]): ("SHIFT", 12), (12, G["~"]): ("SHIFT", 27), - (12, G["case"]): ("SHIFT", 21), - (12, G["let"]): ("SHIFT", 14), - (12, G["while"]): ("SHIFT", 13), - (12, G["int"]): ("SHIFT", 33), + (12, G["not"]): ("SHIFT", 30), + (12, G["new"]): ("SHIFT", 22), + (12, G["isvoid"]): ("SHIFT", 24), (12, G["("]): ("SHIFT", 11), + (12, G["string"]): ("SHIFT", 34), + (12, G["int"]): ("SHIFT", 33), (12, G["false"]): ("SHIFT", 26), - (12, G["new"]): ("SHIFT", 22), - (13, G["string"]): ("SHIFT", 34), - (13, G["isvoid"]): ("SHIFT", 24), + (12, G["id"]): ("SHIFT", 31), + (12, G["true"]): ("SHIFT", 25), + (12, G["let"]): ("SHIFT", 14), + (12, G["case"]): ("SHIFT", 21), + (13, G["id"]): ("SHIFT", 31), (13, G["let"]): ("SHIFT", 14), + (13, G["~"]): ("SHIFT", 27), + (13, G["new"]): ("SHIFT", 22), (13, G["case"]): ("SHIFT", 21), (13, G["while"]): ("SHIFT", 13), - (13, G["id"]): ("SHIFT", 31), - (13, G["~"]): ("SHIFT", 27), - (13, G["{"]): ("SHIFT", 10), - (13, G["int"]): ("SHIFT", 33), (13, G["("]): ("SHIFT", 11), + (13, G["string"]): ("SHIFT", 34), + (13, G["isvoid"]): ("SHIFT", 24), + (13, G["int"]): ("SHIFT", 33), + (13, G["{"]): ("SHIFT", 10), + (13, G["if"]): ("SHIFT", 12), (13, G["false"]): ("SHIFT", 26), (13, G["not"]): ("SHIFT", 30), - (13, G["new"]): ("SHIFT", 22), (13, G["true"]): ("SHIFT", 25), - (13, G["if"]): ("SHIFT", 12), (14, G["id"]): ("SHIFT", 15), (15, G[":"]): ("SHIFT", 16), (16, G["type"]): ("SHIFT", 17), (17, G["<-"]): ("SHIFT", 20), - (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), (17, G[","]): ("SHIFT", 18), + (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), (18, G["id"]): ("SHIFT", 15), (19, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), (20, G["case"]): ("SHIFT", 21), - (20, G["let"]): ("SHIFT", 14), - (20, G["isvoid"]): ("SHIFT", 24), + (20, G["false"]): ("SHIFT", 26), + (20, G["true"]): ("SHIFT", 25), (20, G["while"]): ("SHIFT", 13), (20, G["id"]): ("SHIFT", 31), - (20, G["~"]): ("SHIFT", 27), (20, G["{"]): ("SHIFT", 10), - (20, G["int"]): ("SHIFT", 33), + (20, G["if"]): ("SHIFT", 12), (20, G["not"]): ("SHIFT", 30), - (20, G["("]): ("SHIFT", 11), + (20, G["~"]): ("SHIFT", 27), (20, G["new"]): ("SHIFT", 22), - (20, G["false"]): ("SHIFT", 26), - (20, G["true"]): ("SHIFT", 25), - (20, G["if"]): ("SHIFT", 12), + (20, G["isvoid"]): ("SHIFT", 24), + (20, G["("]): ("SHIFT", 11), (20, G["string"]): ("SHIFT", 34), - (21, G["string"]): ("SHIFT", 34), - (21, G["let"]): ("SHIFT", 14), + (20, G["let"]): ("SHIFT", 14), + (20, G["int"]): ("SHIFT", 33), + (21, G["int"]): ("SHIFT", 33), + (21, G["~"]): ("SHIFT", 27), + (21, G["false"]): ("SHIFT", 26), (21, G["case"]): ("SHIFT", 21), + (21, G["true"]): ("SHIFT", 25), + (21, G["isvoid"]): ("SHIFT", 24), (21, G["while"]): ("SHIFT", 13), (21, G["id"]): ("SHIFT", 31), - (21, G["isvoid"]): ("SHIFT", 24), (21, G["{"]): ("SHIFT", 10), + (21, G["if"]): ("SHIFT", 12), (21, G["not"]): ("SHIFT", 30), - (21, G["int"]): ("SHIFT", 33), - (21, G["("]): ("SHIFT", 11), - (21, G["false"]): ("SHIFT", 26), (21, G["new"]): ("SHIFT", 22), - (21, G["if"]): ("SHIFT", 12), - (21, G["~"]): ("SHIFT", 27), - (21, G["true"]): ("SHIFT", 25), + (21, G["("]): ("SHIFT", 11), + (21, G["string"]): ("SHIFT", 34), + (21, G["let"]): ("SHIFT", 14), (22, G["type"]): ("SHIFT", 23), (23, G["/"]): ("REDUCE", G["atom -> new type"]), (23, G["of"]): ("REDUCE", G["atom -> new type"]), @@ -147,48 +147,48 @@ def __action_table(): (23, G[")"]): ("REDUCE", G["atom -> new type"]), (23, G["then"]): ("REDUCE", G["atom -> new type"]), (23, G["<="]): ("REDUCE", G["atom -> new type"]), - (23, G["error"]): ("REDUCE", G["atom -> new type"]), (23, G["."]): ("REDUCE", G["atom -> new type"]), (23, G["else"]): ("REDUCE", G["atom -> new type"]), - (23, G["in"]): ("REDUCE", G["atom -> new type"]), (23, G["="]): ("REDUCE", G["atom -> new type"]), (23, G[","]): ("REDUCE", G["atom -> new type"]), (23, G["fi"]): ("REDUCE", G["atom -> new type"]), (23, G[";"]): ("REDUCE", G["atom -> new type"]), + (23, G["in"]): ("REDUCE", G["atom -> new type"]), (23, G["loop"]): ("REDUCE", G["atom -> new type"]), (23, G["@"]): ("REDUCE", G["atom -> new type"]), (23, G["pool"]): ("REDUCE", G["atom -> new type"]), (23, G["+"]): ("REDUCE", G["atom -> new type"]), + (23, G["error"]): ("REDUCE", G["atom -> new type"]), (23, G["-"]): ("REDUCE", G["atom -> new type"]), (23, G["*"]): ("REDUCE", G["atom -> new type"]), (23, G["}"]): ("REDUCE", G["atom -> new type"]), - (24, G["id"]): ("SHIFT", 28), - (24, G["string"]): ("SHIFT", 34), - (24, G["new"]): ("SHIFT", 22), + (24, G["false"]): ("SHIFT", 26), + (24, G["~"]): ("SHIFT", 27), (24, G["true"]): ("SHIFT", 25), - (24, G["isvoid"]): ("SHIFT", 24), + (24, G["new"]): ("SHIFT", 22), (24, G["int"]): ("SHIFT", 33), - (24, G["~"]): ("SHIFT", 27), + (24, G["id"]): ("SHIFT", 28), + (24, G["isvoid"]): ("SHIFT", 24), (24, G["("]): ("SHIFT", 11), - (24, G["false"]): ("SHIFT", 26), + (24, G["string"]): ("SHIFT", 34), (25, G["/"]): ("REDUCE", G["atom -> true"]), (25, G["of"]): ("REDUCE", G["atom -> true"]), (25, G["<"]): ("REDUCE", G["atom -> true"]), (25, G[")"]): ("REDUCE", G["atom -> true"]), (25, G["then"]): ("REDUCE", G["atom -> true"]), (25, G["<="]): ("REDUCE", G["atom -> true"]), - (25, G["error"]): ("REDUCE", G["atom -> true"]), (25, G["."]): ("REDUCE", G["atom -> true"]), (25, G["else"]): ("REDUCE", G["atom -> true"]), - (25, G["in"]): ("REDUCE", G["atom -> true"]), (25, G["="]): ("REDUCE", G["atom -> true"]), (25, G[","]): ("REDUCE", G["atom -> true"]), (25, G["fi"]): ("REDUCE", G["atom -> true"]), (25, G[";"]): ("REDUCE", G["atom -> true"]), + (25, G["in"]): ("REDUCE", G["atom -> true"]), (25, G["loop"]): ("REDUCE", G["atom -> true"]), (25, G["@"]): ("REDUCE", G["atom -> true"]), (25, G["pool"]): ("REDUCE", G["atom -> true"]), (25, G["+"]): ("REDUCE", G["atom -> true"]), + (25, G["error"]): ("REDUCE", G["atom -> true"]), (25, G["-"]): ("REDUCE", G["atom -> true"]), (25, G["*"]): ("REDUCE", G["atom -> true"]), (25, G["}"]): ("REDUCE", G["atom -> true"]), @@ -198,139 +198,139 @@ def __action_table(): (26, G[")"]): ("REDUCE", G["atom -> false"]), (26, G["then"]): ("REDUCE", G["atom -> false"]), (26, G["<="]): ("REDUCE", G["atom -> false"]), - (26, G["error"]): ("REDUCE", G["atom -> false"]), (26, G["."]): ("REDUCE", G["atom -> false"]), (26, G["else"]): ("REDUCE", G["atom -> false"]), - (26, G["in"]): ("REDUCE", G["atom -> false"]), (26, G["="]): ("REDUCE", G["atom -> false"]), (26, G[","]): ("REDUCE", G["atom -> false"]), (26, G["fi"]): ("REDUCE", G["atom -> false"]), (26, G[";"]): ("REDUCE", G["atom -> false"]), + (26, G["in"]): ("REDUCE", G["atom -> false"]), (26, G["loop"]): ("REDUCE", G["atom -> false"]), (26, G["@"]): ("REDUCE", G["atom -> false"]), (26, G["pool"]): ("REDUCE", G["atom -> false"]), (26, G["+"]): ("REDUCE", G["atom -> false"]), + (26, G["error"]): ("REDUCE", G["atom -> false"]), (26, G["-"]): ("REDUCE", G["atom -> false"]), (26, G["*"]): ("REDUCE", G["atom -> false"]), (26, G["}"]): ("REDUCE", G["atom -> false"]), - (27, G["id"]): ("SHIFT", 28), - (27, G["string"]): ("SHIFT", 34), - (27, G["new"]): ("SHIFT", 22), + (27, G["false"]): ("SHIFT", 26), + (27, G["~"]): ("SHIFT", 27), (27, G["true"]): ("SHIFT", 25), - (27, G["isvoid"]): ("SHIFT", 24), + (27, G["new"]): ("SHIFT", 22), (27, G["int"]): ("SHIFT", 33), - (27, G["~"]): ("SHIFT", 27), + (27, G["id"]): ("SHIFT", 28), + (27, G["isvoid"]): ("SHIFT", 24), (27, G["("]): ("SHIFT", 11), - (27, G["false"]): ("SHIFT", 26), + (27, G["string"]): ("SHIFT", 34), (28, G["/"]): ("REDUCE", G["atom -> id"]), (28, G["of"]): ("REDUCE", G["atom -> id"]), (28, G["<"]): ("REDUCE", G["atom -> id"]), (28, G[")"]): ("REDUCE", G["atom -> id"]), (28, G["then"]): ("REDUCE", G["atom -> id"]), (28, G["<="]): ("REDUCE", G["atom -> id"]), - (28, G["error"]): ("REDUCE", G["atom -> id"]), (28, G["."]): ("REDUCE", G["atom -> id"]), (28, G["else"]): ("REDUCE", G["atom -> id"]), - (28, G["in"]): ("REDUCE", G["atom -> id"]), (28, G["="]): ("REDUCE", G["atom -> id"]), (28, G[","]): ("REDUCE", G["atom -> id"]), (28, G["fi"]): ("REDUCE", G["atom -> id"]), (28, G[";"]): ("REDUCE", G["atom -> id"]), + (28, G["in"]): ("REDUCE", G["atom -> id"]), (28, G["loop"]): ("REDUCE", G["atom -> id"]), (28, G["@"]): ("REDUCE", G["atom -> id"]), (28, G["pool"]): ("REDUCE", G["atom -> id"]), (28, G["+"]): ("REDUCE", G["atom -> id"]), + (28, G["error"]): ("REDUCE", G["atom -> id"]), (28, G["-"]): ("REDUCE", G["atom -> id"]), (28, G["*"]): ("REDUCE", G["atom -> id"]), (28, G["}"]): ("REDUCE", G["atom -> id"]), (28, G["("]): ("SHIFT", 29), - (29, G["while"]): ("SHIFT", 13), (29, G["true"]): ("SHIFT", 25), - (29, G["id"]): ("SHIFT", 31), - (29, G["~"]): ("SHIFT", 27), - (29, G["string"]): ("SHIFT", 34), - (29, G["{"]): ("SHIFT", 10), (29, G["not"]): ("SHIFT", 30), - (29, G["if"]): ("SHIFT", 12), + (29, G["id"]): ("SHIFT", 31), (29, G["isvoid"]): ("SHIFT", 24), - (29, G["int"]): ("SHIFT", 33), + (29, G[")"]): ("REDUCE", G["expr-list -> e"]), + (29, G["new"]): ("SHIFT", 22), (29, G["let"]): ("SHIFT", 14), + (29, G["string"]): ("SHIFT", 34), (29, G["("]): ("SHIFT", 11), - (29, G["false"]): ("SHIFT", 26), - (29, G["new"]): ("SHIFT", 22), - (29, G[")"]): ("REDUCE", G["expr-list -> e"]), (29, G["case"]): ("SHIFT", 21), - (30, G["case"]): ("SHIFT", 21), - (30, G["let"]): ("SHIFT", 14), - (30, G["id"]): ("SHIFT", 31), - (30, G["while"]): ("SHIFT", 13), - (30, G["isvoid"]): ("SHIFT", 24), - (30, G["int"]): ("SHIFT", 33), - (30, G["{"]): ("SHIFT", 10), + (29, G["while"]): ("SHIFT", 13), + (29, G["int"]): ("SHIFT", 33), + (29, G["false"]): ("SHIFT", 26), + (29, G["{"]): ("SHIFT", 10), + (29, G["if"]): ("SHIFT", 12), + (29, G["~"]): ("SHIFT", 27), (30, G["~"]): ("SHIFT", 27), + (30, G["isvoid"]): ("SHIFT", 24), + (30, G["id"]): ("SHIFT", 31), + (30, G["new"]): ("SHIFT", 22), + (30, G["let"]): ("SHIFT", 14), (30, G["("]): ("SHIFT", 11), + (30, G["string"]): ("SHIFT", 34), + (30, G["case"]): ("SHIFT", 21), + (30, G["int"]): ("SHIFT", 33), + (30, G["while"]): ("SHIFT", 13), (30, G["false"]): ("SHIFT", 26), - (30, G["new"]): ("SHIFT", 22), - (30, G["not"]): ("SHIFT", 30), - (30, G["true"]): ("SHIFT", 25), + (30, G["{"]): ("SHIFT", 10), (30, G["if"]): ("SHIFT", 12), - (30, G["string"]): ("SHIFT", 34), + (30, G["true"]): ("SHIFT", 25), + (30, G["not"]): ("SHIFT", 30), (31, G["<-"]): ("SHIFT", 32), - (31, G["("]): ("SHIFT", 29), (31, G["/"]): ("REDUCE", G["atom -> id"]), (31, G["of"]): ("REDUCE", G["atom -> id"]), (31, G["<"]): ("REDUCE", G["atom -> id"]), (31, G[")"]): ("REDUCE", G["atom -> id"]), (31, G["then"]): ("REDUCE", G["atom -> id"]), (31, G["<="]): ("REDUCE", G["atom -> id"]), - (31, G["error"]): ("REDUCE", G["atom -> id"]), (31, G["."]): ("REDUCE", G["atom -> id"]), (31, G["else"]): ("REDUCE", G["atom -> id"]), - (31, G["in"]): ("REDUCE", G["atom -> id"]), (31, G["="]): ("REDUCE", G["atom -> id"]), (31, G[","]): ("REDUCE", G["atom -> id"]), (31, G["fi"]): ("REDUCE", G["atom -> id"]), (31, G[";"]): ("REDUCE", G["atom -> id"]), + (31, G["in"]): ("REDUCE", G["atom -> id"]), (31, G["loop"]): ("REDUCE", G["atom -> id"]), (31, G["@"]): ("REDUCE", G["atom -> id"]), (31, G["pool"]): ("REDUCE", G["atom -> id"]), (31, G["+"]): ("REDUCE", G["atom -> id"]), + (31, G["error"]): ("REDUCE", G["atom -> id"]), (31, G["-"]): ("REDUCE", G["atom -> id"]), (31, G["*"]): ("REDUCE", G["atom -> id"]), (31, G["}"]): ("REDUCE", G["atom -> id"]), - (32, G["case"]): ("SHIFT", 21), - (32, G["let"]): ("SHIFT", 14), - (32, G["id"]): ("SHIFT", 31), - (32, G["while"]): ("SHIFT", 13), - (32, G["isvoid"]): ("SHIFT", 24), - (32, G["int"]): ("SHIFT", 33), - (32, G["{"]): ("SHIFT", 10), + (31, G["("]): ("SHIFT", 29), (32, G["~"]): ("SHIFT", 27), + (32, G["isvoid"]): ("SHIFT", 24), + (32, G["id"]): ("SHIFT", 31), + (32, G["new"]): ("SHIFT", 22), + (32, G["let"]): ("SHIFT", 14), (32, G["("]): ("SHIFT", 11), + (32, G["string"]): ("SHIFT", 34), + (32, G["case"]): ("SHIFT", 21), + (32, G["int"]): ("SHIFT", 33), + (32, G["while"]): ("SHIFT", 13), (32, G["false"]): ("SHIFT", 26), - (32, G["new"]): ("SHIFT", 22), - (32, G["not"]): ("SHIFT", 30), - (32, G["true"]): ("SHIFT", 25), + (32, G["{"]): ("SHIFT", 10), (32, G["if"]): ("SHIFT", 12), - (32, G["string"]): ("SHIFT", 34), + (32, G["true"]): ("SHIFT", 25), + (32, G["not"]): ("SHIFT", 30), (33, G["/"]): ("REDUCE", G["atom -> int"]), (33, G["of"]): ("REDUCE", G["atom -> int"]), (33, G["<"]): ("REDUCE", G["atom -> int"]), (33, G[")"]): ("REDUCE", G["atom -> int"]), (33, G["then"]): ("REDUCE", G["atom -> int"]), (33, G["<="]): ("REDUCE", G["atom -> int"]), - (33, G["error"]): ("REDUCE", G["atom -> int"]), (33, G["."]): ("REDUCE", G["atom -> int"]), (33, G["else"]): ("REDUCE", G["atom -> int"]), - (33, G["in"]): ("REDUCE", G["atom -> int"]), (33, G["="]): ("REDUCE", G["atom -> int"]), (33, G[","]): ("REDUCE", G["atom -> int"]), (33, G["fi"]): ("REDUCE", G["atom -> int"]), (33, G[";"]): ("REDUCE", G["atom -> int"]), + (33, G["in"]): ("REDUCE", G["atom -> int"]), (33, G["loop"]): ("REDUCE", G["atom -> int"]), (33, G["@"]): ("REDUCE", G["atom -> int"]), (33, G["pool"]): ("REDUCE", G["atom -> int"]), (33, G["+"]): ("REDUCE", G["atom -> int"]), + (33, G["error"]): ("REDUCE", G["atom -> int"]), (33, G["-"]): ("REDUCE", G["atom -> int"]), (33, G["*"]): ("REDUCE", G["atom -> int"]), (33, G["}"]): ("REDUCE", G["atom -> int"]), @@ -340,18 +340,18 @@ def __action_table(): (34, G[")"]): ("REDUCE", G["atom -> string"]), (34, G["then"]): ("REDUCE", G["atom -> string"]), (34, G["<="]): ("REDUCE", G["atom -> string"]), - (34, G["error"]): ("REDUCE", G["atom -> string"]), (34, G["."]): ("REDUCE", G["atom -> string"]), (34, G["else"]): ("REDUCE", G["atom -> string"]), - (34, G["in"]): ("REDUCE", G["atom -> string"]), (34, G["="]): ("REDUCE", G["atom -> string"]), (34, G[","]): ("REDUCE", G["atom -> string"]), (34, G["fi"]): ("REDUCE", G["atom -> string"]), (34, G[";"]): ("REDUCE", G["atom -> string"]), + (34, G["in"]): ("REDUCE", G["atom -> string"]), (34, G["loop"]): ("REDUCE", G["atom -> string"]), (34, G["@"]): ("REDUCE", G["atom -> string"]), (34, G["pool"]): ("REDUCE", G["atom -> string"]), (34, G["+"]): ("REDUCE", G["atom -> string"]), + (34, G["error"]): ("REDUCE", G["atom -> string"]), (34, G["-"]): ("REDUCE", G["atom -> string"]), (34, G["*"]): ("REDUCE", G["atom -> string"]), (34, G["}"]): ("REDUCE", G["atom -> string"]), @@ -361,78 +361,77 @@ def __action_table(): (35, G[")"]): ("REDUCE", G["atom -> function-call"]), (35, G["then"]): ("REDUCE", G["atom -> function-call"]), (35, G["<="]): ("REDUCE", G["atom -> function-call"]), - (35, G["error"]): ("REDUCE", G["atom -> function-call"]), (35, G["."]): ("REDUCE", G["atom -> function-call"]), (35, G["else"]): ("REDUCE", G["atom -> function-call"]), - (35, G["in"]): ("REDUCE", G["atom -> function-call"]), (35, G["="]): ("REDUCE", G["atom -> function-call"]), (35, G[","]): ("REDUCE", G["atom -> function-call"]), (35, G["fi"]): ("REDUCE", G["atom -> function-call"]), (35, G[";"]): ("REDUCE", G["atom -> function-call"]), + (35, G["in"]): ("REDUCE", G["atom -> function-call"]), (35, G["loop"]): ("REDUCE", G["atom -> function-call"]), (35, G["@"]): ("REDUCE", G["atom -> function-call"]), (35, G["pool"]): ("REDUCE", G["atom -> function-call"]), (35, G["+"]): ("REDUCE", G["atom -> function-call"]), + (35, G["error"]): ("REDUCE", G["atom -> function-call"]), (35, G["-"]): ("REDUCE", G["atom -> function-call"]), (35, G["*"]): ("REDUCE", G["atom -> function-call"]), (35, G["}"]): ("REDUCE", G["atom -> function-call"]), + (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), (36, G["else"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["in"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), (36, G["}"]): ("REDUCE", G["expr -> id <- expr"]), + (37, G[","]): ("REDUCE", G["expr -> comp"]), (37, G[";"]): ("REDUCE", G["expr -> comp"]), (37, G["loop"]): ("REDUCE", G["expr -> comp"]), (37, G["of"]): ("REDUCE", G["expr -> comp"]), - (37, G["pool"]): ("REDUCE", G["expr -> comp"]), (37, G[")"]): ("REDUCE", G["expr -> comp"]), + (37, G["pool"]): ("REDUCE", G["expr -> comp"]), (37, G["then"]): ("REDUCE", G["expr -> comp"]), (37, G["error"]): ("REDUCE", G["expr -> comp"]), - (37, G[","]): ("REDUCE", G["expr -> comp"]), (37, G["else"]): ("REDUCE", G["expr -> comp"]), (37, G["in"]): ("REDUCE", G["expr -> comp"]), (37, G["fi"]): ("REDUCE", G["expr -> comp"]), (37, G["}"]): ("REDUCE", G["expr -> comp"]), - (38, G["-"]): ("SHIFT", 64), (38, G["<"]): ("SHIFT", 66), + (38, G["="]): ("SHIFT", 70), + (38, G[","]): ("REDUCE", G["comp -> arith"]), (38, G[";"]): ("REDUCE", G["comp -> arith"]), (38, G["loop"]): ("REDUCE", G["comp -> arith"]), (38, G["of"]): ("REDUCE", G["comp -> arith"]), - (38, G["pool"]): ("REDUCE", G["comp -> arith"]), (38, G[")"]): ("REDUCE", G["comp -> arith"]), + (38, G["pool"]): ("REDUCE", G["comp -> arith"]), (38, G["then"]): ("REDUCE", G["comp -> arith"]), (38, G["error"]): ("REDUCE", G["comp -> arith"]), - (38, G[","]): ("REDUCE", G["comp -> arith"]), (38, G["else"]): ("REDUCE", G["comp -> arith"]), (38, G["in"]): ("REDUCE", G["comp -> arith"]), (38, G["fi"]): ("REDUCE", G["comp -> arith"]), (38, G["}"]): ("REDUCE", G["comp -> arith"]), (38, G["<="]): ("SHIFT", 68), + (38, G["-"]): ("SHIFT", 64), (38, G["+"]): ("SHIFT", 39), - (38, G["="]): ("SHIFT", 70), - (39, G["id"]): ("SHIFT", 28), - (39, G["true"]): ("SHIFT", 25), + (39, G["~"]): ("SHIFT", 27), + (39, G["int"]): ("SHIFT", 33), (39, G["isvoid"]): ("SHIFT", 24), (39, G["false"]): ("SHIFT", 26), - (39, G["string"]): ("SHIFT", 34), - (39, G["int"]): ("SHIFT", 33), - (39, G["~"]): ("SHIFT", 27), - (39, G["("]): ("SHIFT", 11), + (39, G["true"]): ("SHIFT", 25), (39, G["new"]): ("SHIFT", 22), + (39, G["id"]): ("SHIFT", 28), + (39, G["("]): ("SHIFT", 11), + (39, G["string"]): ("SHIFT", 34), (40, G["/"]): ("SHIFT", 54), (40, G["of"]): ("REDUCE", G["arith -> arith + term"]), (40, G["<"]): ("REDUCE", G["arith -> arith + term"]), (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), (40, G["then"]): ("REDUCE", G["arith -> arith + term"]), (40, G["<="]): ("REDUCE", G["arith -> arith + term"]), - (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), (40, G["else"]): ("REDUCE", G["arith -> arith + term"]), (40, G["="]): ("REDUCE", G["arith -> arith + term"]), (40, G[","]): ("REDUCE", G["arith -> arith + term"]), @@ -441,77 +440,78 @@ def __action_table(): (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), (40, G["+"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), (40, G["*"]): ("SHIFT", 41), - (41, G["id"]): ("SHIFT", 28), - (41, G["string"]): ("SHIFT", 34), - (41, G["new"]): ("SHIFT", 22), + (41, G["false"]): ("SHIFT", 26), + (41, G["~"]): ("SHIFT", 27), (41, G["true"]): ("SHIFT", 25), - (41, G["isvoid"]): ("SHIFT", 24), + (41, G["new"]): ("SHIFT", 22), (41, G["int"]): ("SHIFT", 33), - (41, G["~"]): ("SHIFT", 27), + (41, G["id"]): ("SHIFT", 28), + (41, G["isvoid"]): ("SHIFT", 24), (41, G["("]): ("SHIFT", 11), - (41, G["false"]): ("SHIFT", 26), + (41, G["string"]): ("SHIFT", 34), (42, G["/"]): ("REDUCE", G["term -> term * factor"]), (42, G["of"]): ("REDUCE", G["term -> term * factor"]), (42, G["<"]): ("REDUCE", G["term -> term * factor"]), (42, G[")"]): ("REDUCE", G["term -> term * factor"]), (42, G["then"]): ("REDUCE", G["term -> term * factor"]), (42, G["<="]): ("REDUCE", G["term -> term * factor"]), - (42, G["error"]): ("REDUCE", G["term -> term * factor"]), (42, G["else"]): ("REDUCE", G["term -> term * factor"]), - (42, G["in"]): ("REDUCE", G["term -> term * factor"]), (42, G["="]): ("REDUCE", G["term -> term * factor"]), (42, G[","]): ("REDUCE", G["term -> term * factor"]), (42, G["fi"]): ("REDUCE", G["term -> term * factor"]), (42, G[";"]): ("REDUCE", G["term -> term * factor"]), + (42, G["in"]): ("REDUCE", G["term -> term * factor"]), (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), (42, G["pool"]): ("REDUCE", G["term -> term * factor"]), (42, G["+"]): ("REDUCE", G["term -> term * factor"]), + (42, G["error"]): ("REDUCE", G["term -> term * factor"]), (42, G["-"]): ("REDUCE", G["term -> term * factor"]), (42, G["*"]): ("REDUCE", G["term -> term * factor"]), (42, G["}"]): ("REDUCE", G["term -> term * factor"]), - (43, G["."]): ("SHIFT", 44), (43, G["/"]): ("REDUCE", G["factor -> atom"]), (43, G["of"]): ("REDUCE", G["factor -> atom"]), (43, G["<"]): ("REDUCE", G["factor -> atom"]), (43, G[")"]): ("REDUCE", G["factor -> atom"]), (43, G["then"]): ("REDUCE", G["factor -> atom"]), (43, G["<="]): ("REDUCE", G["factor -> atom"]), - (43, G["error"]): ("REDUCE", G["factor -> atom"]), (43, G["else"]): ("REDUCE", G["factor -> atom"]), - (43, G["in"]): ("REDUCE", G["factor -> atom"]), (43, G["="]): ("REDUCE", G["factor -> atom"]), (43, G[","]): ("REDUCE", G["factor -> atom"]), (43, G["fi"]): ("REDUCE", G["factor -> atom"]), (43, G[";"]): ("REDUCE", G["factor -> atom"]), + (43, G["in"]): ("REDUCE", G["factor -> atom"]), (43, G["loop"]): ("REDUCE", G["factor -> atom"]), (43, G["pool"]): ("REDUCE", G["factor -> atom"]), (43, G["+"]): ("REDUCE", G["factor -> atom"]), + (43, G["error"]): ("REDUCE", G["factor -> atom"]), (43, G["-"]): ("REDUCE", G["factor -> atom"]), (43, G["*"]): ("REDUCE", G["factor -> atom"]), (43, G["}"]): ("REDUCE", G["factor -> atom"]), + (43, G["."]): ("SHIFT", 44), (43, G["@"]): ("SHIFT", 57), (44, G["id"]): ("SHIFT", 45), (45, G["("]): ("SHIFT", 46), - (46, G["while"]): ("SHIFT", 13), (46, G["true"]): ("SHIFT", 25), - (46, G["id"]): ("SHIFT", 31), - (46, G["~"]): ("SHIFT", 27), - (46, G["string"]): ("SHIFT", 34), - (46, G["{"]): ("SHIFT", 10), (46, G["not"]): ("SHIFT", 30), - (46, G["if"]): ("SHIFT", 12), + (46, G["id"]): ("SHIFT", 31), (46, G["isvoid"]): ("SHIFT", 24), - (46, G["int"]): ("SHIFT", 33), + (46, G[")"]): ("REDUCE", G["expr-list -> e"]), + (46, G["new"]): ("SHIFT", 22), (46, G["let"]): ("SHIFT", 14), + (46, G["string"]): ("SHIFT", 34), (46, G["("]): ("SHIFT", 11), - (46, G["false"]): ("SHIFT", 26), - (46, G["new"]): ("SHIFT", 22), - (46, G[")"]): ("REDUCE", G["expr-list -> e"]), (46, G["case"]): ("SHIFT", 21), + (46, G["while"]): ("SHIFT", 13), + (46, G["int"]): ("SHIFT", 33), + (46, G["false"]): ("SHIFT", 26), + (46, G["{"]): ("SHIFT", 10), + (46, G["if"]): ("SHIFT", 12), + (46, G["~"]): ("SHIFT", 27), (47, G[")"]): ("SHIFT", 48), (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), @@ -519,48 +519,47 @@ def __action_table(): (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), (49, G[")"]): ("REDUCE", G["expr-list -> not-empty-expr-list"]), (50, G[","]): ("SHIFT", 51), (50, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), - (51, G["while"]): ("SHIFT", 13), (51, G["true"]): ("SHIFT", 25), - (51, G["id"]): ("SHIFT", 31), - (51, G["~"]): ("SHIFT", 27), - (51, G["string"]): ("SHIFT", 34), - (51, G["{"]): ("SHIFT", 10), (51, G["not"]): ("SHIFT", 30), - (51, G["if"]): ("SHIFT", 12), + (51, G["id"]): ("SHIFT", 31), (51, G["isvoid"]): ("SHIFT", 24), - (51, G["int"]): ("SHIFT", 33), + (51, G["new"]): ("SHIFT", 22), (51, G["let"]): ("SHIFT", 14), + (51, G["string"]): ("SHIFT", 34), (51, G["("]): ("SHIFT", 11), - (51, G["false"]): ("SHIFT", 26), - (51, G["new"]): ("SHIFT", 22), (51, G["case"]): ("SHIFT", 21), + (51, G["while"]): ("SHIFT", 13), + (51, G["int"]): ("SHIFT", 33), + (51, G["false"]): ("SHIFT", 26), + (51, G["{"]): ("SHIFT", 10), + (51, G["if"]): ("SHIFT", 12), + (51, G["~"]): ("SHIFT", 27), (52, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr , not-empty-expr-list"]), - (53, G["/"]): ("SHIFT", 54), (53, G["*"]): ("SHIFT", 41), + (53, G["/"]): ("SHIFT", 54), (53, G["of"]): ("REDUCE", G["arith -> term"]), (53, G["<"]): ("REDUCE", G["arith -> term"]), (53, G[")"]): ("REDUCE", G["arith -> term"]), (53, G["then"]): ("REDUCE", G["arith -> term"]), (53, G["<="]): ("REDUCE", G["arith -> term"]), - (53, G["error"]): ("REDUCE", G["arith -> term"]), (53, G["else"]): ("REDUCE", G["arith -> term"]), (53, G["="]): ("REDUCE", G["arith -> term"]), (53, G[","]): ("REDUCE", G["arith -> term"]), @@ -569,34 +568,35 @@ def __action_table(): (53, G["loop"]): ("REDUCE", G["arith -> term"]), (53, G["pool"]): ("REDUCE", G["arith -> term"]), (53, G["+"]): ("REDUCE", G["arith -> term"]), + (53, G["error"]): ("REDUCE", G["arith -> term"]), (53, G["in"]): ("REDUCE", G["arith -> term"]), (53, G["-"]): ("REDUCE", G["arith -> term"]), (53, G["}"]): ("REDUCE", G["arith -> term"]), - (54, G["id"]): ("SHIFT", 28), - (54, G["string"]): ("SHIFT", 34), - (54, G["new"]): ("SHIFT", 22), + (54, G["false"]): ("SHIFT", 26), + (54, G["~"]): ("SHIFT", 27), (54, G["true"]): ("SHIFT", 25), - (54, G["isvoid"]): ("SHIFT", 24), + (54, G["new"]): ("SHIFT", 22), (54, G["int"]): ("SHIFT", 33), - (54, G["~"]): ("SHIFT", 27), + (54, G["id"]): ("SHIFT", 28), + (54, G["isvoid"]): ("SHIFT", 24), (54, G["("]): ("SHIFT", 11), - (54, G["false"]): ("SHIFT", 26), + (54, G["string"]): ("SHIFT", 34), (55, G["/"]): ("REDUCE", G["term -> term / factor"]), (55, G["of"]): ("REDUCE", G["term -> term / factor"]), (55, G["<"]): ("REDUCE", G["term -> term / factor"]), (55, G[")"]): ("REDUCE", G["term -> term / factor"]), (55, G["then"]): ("REDUCE", G["term -> term / factor"]), (55, G["<="]): ("REDUCE", G["term -> term / factor"]), - (55, G["error"]): ("REDUCE", G["term -> term / factor"]), (55, G["else"]): ("REDUCE", G["term -> term / factor"]), - (55, G["in"]): ("REDUCE", G["term -> term / factor"]), (55, G["="]): ("REDUCE", G["term -> term / factor"]), (55, G[","]): ("REDUCE", G["term -> term / factor"]), (55, G["fi"]): ("REDUCE", G["term -> term / factor"]), (55, G[";"]): ("REDUCE", G["term -> term / factor"]), + (55, G["in"]): ("REDUCE", G["term -> term / factor"]), (55, G["loop"]): ("REDUCE", G["term -> term / factor"]), (55, G["pool"]): ("REDUCE", G["term -> term / factor"]), (55, G["+"]): ("REDUCE", G["term -> term / factor"]), + (55, G["error"]): ("REDUCE", G["term -> term / factor"]), (55, G["-"]): ("REDUCE", G["term -> term / factor"]), (55, G["*"]): ("REDUCE", G["term -> term / factor"]), (55, G["}"]): ("REDUCE", G["term -> term / factor"]), @@ -606,16 +606,16 @@ def __action_table(): (56, G[")"]): ("REDUCE", G["term -> factor"]), (56, G["then"]): ("REDUCE", G["term -> factor"]), (56, G["<="]): ("REDUCE", G["term -> factor"]), - (56, G["error"]): ("REDUCE", G["term -> factor"]), (56, G["else"]): ("REDUCE", G["term -> factor"]), - (56, G["in"]): ("REDUCE", G["term -> factor"]), (56, G["="]): ("REDUCE", G["term -> factor"]), (56, G[","]): ("REDUCE", G["term -> factor"]), (56, G["fi"]): ("REDUCE", G["term -> factor"]), (56, G[";"]): ("REDUCE", G["term -> factor"]), + (56, G["in"]): ("REDUCE", G["term -> factor"]), (56, G["loop"]): ("REDUCE", G["term -> factor"]), (56, G["pool"]): ("REDUCE", G["term -> factor"]), (56, G["+"]): ("REDUCE", G["term -> factor"]), + (56, G["error"]): ("REDUCE", G["term -> factor"]), (56, G["-"]): ("REDUCE", G["term -> factor"]), (56, G["*"]): ("REDUCE", G["term -> factor"]), (56, G["}"]): ("REDUCE", G["term -> factor"]), @@ -623,22 +623,22 @@ def __action_table(): (58, G["."]): ("SHIFT", 59), (59, G["id"]): ("SHIFT", 60), (60, G["("]): ("SHIFT", 61), - (61, G["while"]): ("SHIFT", 13), (61, G["true"]): ("SHIFT", 25), - (61, G["id"]): ("SHIFT", 31), - (61, G["~"]): ("SHIFT", 27), - (61, G["string"]): ("SHIFT", 34), - (61, G["{"]): ("SHIFT", 10), (61, G["not"]): ("SHIFT", 30), - (61, G["if"]): ("SHIFT", 12), + (61, G["id"]): ("SHIFT", 31), (61, G["isvoid"]): ("SHIFT", 24), - (61, G["int"]): ("SHIFT", 33), + (61, G[")"]): ("REDUCE", G["expr-list -> e"]), + (61, G["new"]): ("SHIFT", 22), (61, G["let"]): ("SHIFT", 14), + (61, G["string"]): ("SHIFT", 34), (61, G["("]): ("SHIFT", 11), - (61, G["false"]): ("SHIFT", 26), - (61, G["new"]): ("SHIFT", 22), - (61, G[")"]): ("REDUCE", G["expr-list -> e"]), (61, G["case"]): ("SHIFT", 21), + (61, G["while"]): ("SHIFT", 13), + (61, G["int"]): ("SHIFT", 33), + (61, G["false"]): ("SHIFT", 26), + (61, G["{"]): ("SHIFT", 10), + (61, G["if"]): ("SHIFT", 12), + (61, G["~"]): ("SHIFT", 27), (62, G[")"]): ("SHIFT", 63), (63, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), @@ -646,38 +646,35 @@ def __action_table(): (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), (63, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (64, G["id"]): ("SHIFT", 28), - (64, G["true"]): ("SHIFT", 25), + (64, G["~"]): ("SHIFT", 27), + (64, G["int"]): ("SHIFT", 33), (64, G["isvoid"]): ("SHIFT", 24), (64, G["false"]): ("SHIFT", 26), - (64, G["string"]): ("SHIFT", 34), - (64, G["int"]): ("SHIFT", 33), - (64, G["~"]): ("SHIFT", 27), (64, G["("]): ("SHIFT", 11), + (64, G["true"]): ("SHIFT", 25), (64, G["new"]): ("SHIFT", 22), - (65, G["/"]): ("SHIFT", 54), - (65, G["*"]): ("SHIFT", 41), + (64, G["id"]): ("SHIFT", 28), + (64, G["string"]): ("SHIFT", 34), (65, G["of"]): ("REDUCE", G["arith -> arith - term"]), (65, G["<"]): ("REDUCE", G["arith -> arith - term"]), (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), (65, G["then"]): ("REDUCE", G["arith -> arith - term"]), (65, G["<="]): ("REDUCE", G["arith -> arith - term"]), - (65, G["error"]): ("REDUCE", G["arith -> arith - term"]), (65, G["else"]): ("REDUCE", G["arith -> arith - term"]), (65, G["="]): ("REDUCE", G["arith -> arith - term"]), (65, G[","]): ("REDUCE", G["arith -> arith - term"]), @@ -686,87 +683,90 @@ def __action_table(): (65, G["loop"]): ("REDUCE", G["arith -> arith - term"]), (65, G["pool"]): ("REDUCE", G["arith -> arith - term"]), (65, G["+"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["error"]): ("REDUCE", G["arith -> arith - term"]), (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), (65, G["-"]): ("REDUCE", G["arith -> arith - term"]), (65, G["}"]): ("REDUCE", G["arith -> arith - term"]), - (66, G["new"]): ("SHIFT", 22), - (66, G["id"]): ("SHIFT", 28), - (66, G["true"]): ("SHIFT", 25), - (66, G["string"]): ("SHIFT", 34), - (66, G["~"]): ("SHIFT", 27), + (65, G["*"]): ("SHIFT", 41), + (65, G["/"]): ("SHIFT", 54), (66, G["int"]): ("SHIFT", 33), (66, G["false"]): ("SHIFT", 26), + (66, G["~"]): ("SHIFT", 27), + (66, G["true"]): ("SHIFT", 25), + (66, G["new"]): ("SHIFT", 22), (66, G["isvoid"]): ("SHIFT", 24), + (66, G["id"]): ("SHIFT", 28), (66, G["("]): ("SHIFT", 11), + (66, G["string"]): ("SHIFT", 34), + (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), (67, G["else"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["in"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), (67, G["}"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["+"]): ("SHIFT", 39), (67, G["-"]): ("SHIFT", 64), - (68, G["new"]): ("SHIFT", 22), - (68, G["id"]): ("SHIFT", 28), - (68, G["true"]): ("SHIFT", 25), - (68, G["string"]): ("SHIFT", 34), - (68, G["~"]): ("SHIFT", 27), + (67, G["+"]): ("SHIFT", 39), (68, G["int"]): ("SHIFT", 33), (68, G["false"]): ("SHIFT", 26), + (68, G["~"]): ("SHIFT", 27), + (68, G["true"]): ("SHIFT", 25), + (68, G["new"]): ("SHIFT", 22), (68, G["isvoid"]): ("SHIFT", 24), + (68, G["id"]): ("SHIFT", 28), (68, G["("]): ("SHIFT", 11), + (68, G["string"]): ("SHIFT", 34), (69, G["-"]): ("SHIFT", 64), + (69, G["+"]): ("SHIFT", 39), + (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), (69, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), (69, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["+"]): ("SHIFT", 39), - (70, G["new"]): ("SHIFT", 22), - (70, G["id"]): ("SHIFT", 28), - (70, G["true"]): ("SHIFT", 25), - (70, G["string"]): ("SHIFT", 34), - (70, G["~"]): ("SHIFT", 27), (70, G["int"]): ("SHIFT", 33), (70, G["false"]): ("SHIFT", 26), + (70, G["~"]): ("SHIFT", 27), + (70, G["true"]): ("SHIFT", 25), + (70, G["new"]): ("SHIFT", 22), (70, G["isvoid"]): ("SHIFT", 24), + (70, G["id"]): ("SHIFT", 28), (70, G["("]): ("SHIFT", 11), - (71, G["-"]): ("SHIFT", 64), + (70, G["string"]): ("SHIFT", 34), + (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), (71, G[";"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["error"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), (71, G["else"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["in"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), (71, G["}"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["-"]): ("SHIFT", 64), (71, G["+"]): ("SHIFT", 39), (72, G[";"]): ("REDUCE", G["expr -> not expr"]), + (72, G["in"]): ("REDUCE", G["expr -> not expr"]), (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), (72, G["of"]): ("REDUCE", G["expr -> not expr"]), - (72, G["pool"]): ("REDUCE", G["expr -> not expr"]), (72, G[")"]): ("REDUCE", G["expr -> not expr"]), + (72, G["pool"]): ("REDUCE", G["expr -> not expr"]), (72, G["then"]): ("REDUCE", G["expr -> not expr"]), (72, G["error"]): ("REDUCE", G["expr -> not expr"]), (72, G["else"]): ("REDUCE", G["expr -> not expr"]), - (72, G["in"]): ("REDUCE", G["expr -> not expr"]), (72, G[","]): ("REDUCE", G["expr -> not expr"]), (72, G["fi"]): ("REDUCE", G["expr -> not expr"]), (72, G["}"]): ("REDUCE", G["expr -> not expr"]), @@ -777,18 +777,18 @@ def __action_table(): (74, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), (74, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), @@ -798,16 +798,16 @@ def __action_table(): (75, G[")"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["then"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["<="]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["else"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["="]): ("REDUCE", G["factor -> ~ factor"]), (75, G[","]): ("REDUCE", G["factor -> ~ factor"]), (75, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), (75, G[";"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["+"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["-"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["*"]): ("REDUCE", G["factor -> ~ factor"]), (75, G["}"]): ("REDUCE", G["factor -> ~ factor"]), @@ -817,16 +817,16 @@ def __action_table(): (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), @@ -835,23 +835,23 @@ def __action_table(): (79, G[":"]): ("SHIFT", 80), (80, G["type"]): ("SHIFT", 81), (81, G["=>"]): ("SHIFT", 82), - (82, G["isvoid"]): ("SHIFT", 24), - (82, G["id"]): ("SHIFT", 31), (82, G["int"]): ("SHIFT", 33), - (82, G["("]): ("SHIFT", 11), - (82, G["{"]): ("SHIFT", 10), + (82, G["case"]): ("SHIFT", 21), (82, G["false"]): ("SHIFT", 26), - (82, G["new"]): ("SHIFT", 22), - (82, G["~"]): ("SHIFT", 27), - (82, G["not"]): ("SHIFT", 30), + (82, G["while"]): ("SHIFT", 13), (82, G["true"]): ("SHIFT", 25), + (82, G["id"]): ("SHIFT", 31), + (82, G["{"]): ("SHIFT", 10), (82, G["if"]): ("SHIFT", 12), + (82, G["not"]): ("SHIFT", 30), + (82, G["~"]): ("SHIFT", 27), + (82, G["new"]): ("SHIFT", 22), + (82, G["("]): ("SHIFT", 11), + (82, G["isvoid"]): ("SHIFT", 24), (82, G["string"]): ("SHIFT", 34), (82, G["let"]): ("SHIFT", 14), - (82, G["case"]): ("SHIFT", 21), - (82, G["while"]): ("SHIFT", 13), - (83, G["error"]): ("SHIFT", 86), (83, G[";"]): ("SHIFT", 84), + (83, G["error"]): ("SHIFT", 86), (84, G["id"]): ("SHIFT", 79), (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), @@ -859,14 +859,14 @@ def __action_table(): (86, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), (87, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error case-list"]), (88, G["esac"]): ("SHIFT", 89), + (89, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (89, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), @@ -876,21 +876,22 @@ def __action_table(): (91, G["id"]): ("SHIFT", 15), (92, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), (93, G["in"]): ("SHIFT", 94), - (94, G["case"]): ("SHIFT", 21), - (94, G["let"]): ("SHIFT", 14), - (94, G["id"]): ("SHIFT", 31), - (94, G["while"]): ("SHIFT", 13), - (94, G["isvoid"]): ("SHIFT", 24), - (94, G["int"]): ("SHIFT", 33), - (94, G["{"]): ("SHIFT", 10), (94, G["~"]): ("SHIFT", 27), - (94, G["("]): ("SHIFT", 11), - (94, G["false"]): ("SHIFT", 26), + (94, G["isvoid"]): ("SHIFT", 24), + (94, G["id"]): ("SHIFT", 31), (94, G["new"]): ("SHIFT", 22), - (94, G["not"]): ("SHIFT", 30), - (94, G["true"]): ("SHIFT", 25), - (94, G["if"]): ("SHIFT", 12), + (94, G["let"]): ("SHIFT", 14), + (94, G["("]): ("SHIFT", 11), (94, G["string"]): ("SHIFT", 34), + (94, G["case"]): ("SHIFT", 21), + (94, G["int"]): ("SHIFT", 33), + (94, G["while"]): ("SHIFT", 13), + (94, G["false"]): ("SHIFT", 26), + (94, G["{"]): ("SHIFT", 10), + (94, G["if"]): ("SHIFT", 12), + (94, G["true"]): ("SHIFT", 25), + (94, G["not"]): ("SHIFT", 30), + (95, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), @@ -898,28 +899,28 @@ def __action_table(): (95, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (95, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), (96, G["loop"]): ("SHIFT", 97), - (97, G["let"]): ("SHIFT", 14), (97, G["id"]): ("SHIFT", 31), - (97, G["while"]): ("SHIFT", 13), - (97, G["case"]): ("SHIFT", 21), - (97, G["isvoid"]): ("SHIFT", 24), (97, G["int"]): ("SHIFT", 33), - (97, G["{"]): ("SHIFT", 10), - (97, G["("]): ("SHIFT", 11), + (97, G["let"]): ("SHIFT", 14), (97, G["false"]): ("SHIFT", 26), - (97, G["new"]): ("SHIFT", 22), - (97, G["not"]): ("SHIFT", 30), (97, G["true"]): ("SHIFT", 25), - (97, G["~"]): ("SHIFT", 27), + (97, G["case"]): ("SHIFT", 21), + (97, G["while"]): ("SHIFT", 13), + (97, G["{"]): ("SHIFT", 10), (97, G["if"]): ("SHIFT", 12), + (97, G["not"]): ("SHIFT", 30), + (97, G["~"]): ("SHIFT", 27), + (97, G["new"]): ("SHIFT", 22), + (97, G["isvoid"]): ("SHIFT", 24), + (97, G["("]): ("SHIFT", 11), (97, G["string"]): ("SHIFT", 34), (98, G["pool"]): ("SHIFT", 99), + (99, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), @@ -927,44 +928,44 @@ def __action_table(): (99, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (99, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), (100, G["then"]): ("SHIFT", 101), - (101, G["int"]): ("SHIFT", 33), - (101, G["case"]): ("SHIFT", 21), - (101, G["let"]): ("SHIFT", 14), + (101, G["~"]): ("SHIFT", 27), + (101, G["string"]): ("SHIFT", 34), (101, G["("]): ("SHIFT", 11), + (101, G["case"]): ("SHIFT", 21), + (101, G["isvoid"]): ("SHIFT", 24), (101, G["while"]): ("SHIFT", 13), + (101, G["int"]): ("SHIFT", 33), (101, G["false"]): ("SHIFT", 26), - (101, G["new"]): ("SHIFT", 22), - (101, G["~"]): ("SHIFT", 27), - (101, G["true"]): ("SHIFT", 25), - (101, G["id"]): ("SHIFT", 31), - (101, G["string"]): ("SHIFT", 34), (101, G["{"]): ("SHIFT", 10), - (101, G["not"]): ("SHIFT", 30), (101, G["if"]): ("SHIFT", 12), - (101, G["isvoid"]): ("SHIFT", 24), + (101, G["true"]): ("SHIFT", 25), + (101, G["not"]): ("SHIFT", 30), + (101, G["id"]): ("SHIFT", 31), + (101, G["new"]): ("SHIFT", 22), + (101, G["let"]): ("SHIFT", 14), (102, G["else"]): ("SHIFT", 103), - (103, G["not"]): ("SHIFT", 30), - (103, G["int"]): ("SHIFT", 33), - (103, G["("]): ("SHIFT", 11), (103, G["false"]): ("SHIFT", 26), - (103, G["if"]): ("SHIFT", 12), - (103, G["new"]): ("SHIFT", 22), - (103, G["isvoid"]): ("SHIFT", 24), + (103, G["let"]): ("SHIFT", 14), (103, G["true"]): ("SHIFT", 25), - (103, G["id"]): ("SHIFT", 31), (103, G["case"]): ("SHIFT", 21), - (103, G["let"]): ("SHIFT", 14), - (103, G["string"]): ("SHIFT", 34), + (103, G["id"]): ("SHIFT", 31), (103, G["while"]): ("SHIFT", 13), (103, G["~"]): ("SHIFT", 27), + (103, G["isvoid"]): ("SHIFT", 24), (103, G["{"]): ("SHIFT", 10), + (103, G["if"]): ("SHIFT", 12), + (103, G["not"]): ("SHIFT", 30), + (103, G["new"]): ("SHIFT", 22), + (103, G["("]): ("SHIFT", 11), + (103, G["string"]): ("SHIFT", 34), + (103, G["int"]): ("SHIFT", 33), (104, G["fi"]): ("SHIFT", 105), + (105, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), @@ -972,7 +973,6 @@ def __action_table(): (105, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), (105, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), @@ -984,22 +984,23 @@ def __action_table(): (107, G[")"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["then"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["<="]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["error"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["."]): ("REDUCE", G["atom -> ( expr )"]), (107, G["else"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["in"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["="]): ("REDUCE", G["atom -> ( expr )"]), (107, G[","]): ("REDUCE", G["atom -> ( expr )"]), (107, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), (107, G[";"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["in"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["@"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["+"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["error"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["-"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["*"]): ("REDUCE", G["atom -> ( expr )"]), (107, G["}"]): ("REDUCE", G["atom -> ( expr )"]), (108, G["}"]): ("SHIFT", 109), + (109, G[","]): ("REDUCE", G["expr -> { block }"]), (109, G[";"]): ("REDUCE", G["expr -> { block }"]), (109, G["loop"]): ("REDUCE", G["expr -> { block }"]), (109, G["of"]): ("REDUCE", G["expr -> { block }"]), @@ -1007,46 +1008,45 @@ def __action_table(): (109, G[")"]): ("REDUCE", G["expr -> { block }"]), (109, G["then"]): ("REDUCE", G["expr -> { block }"]), (109, G["error"]): ("REDUCE", G["expr -> { block }"]), - (109, G[","]): ("REDUCE", G["expr -> { block }"]), (109, G["else"]): ("REDUCE", G["expr -> { block }"]), (109, G["in"]): ("REDUCE", G["expr -> { block }"]), (109, G["fi"]): ("REDUCE", G["expr -> { block }"]), (109, G["}"]): ("REDUCE", G["expr -> { block }"]), - (110, G[";"]): ("SHIFT", 111), (110, G["error"]): ("SHIFT", 113), - (111, G["isvoid"]): ("SHIFT", 24), - (111, G["id"]): ("SHIFT", 31), + (110, G[";"]): ("SHIFT", 111), (111, G["int"]): ("SHIFT", 33), - (111, G["("]): ("SHIFT", 11), - (111, G["{"]): ("SHIFT", 10), + (111, G["case"]): ("SHIFT", 21), (111, G["false"]): ("SHIFT", 26), - (111, G["new"]): ("SHIFT", 22), - (111, G["~"]): ("SHIFT", 27), - (111, G["not"]): ("SHIFT", 30), - (111, G["true"]): ("SHIFT", 25), (111, G["}"]): ("REDUCE", G["block -> expr ;"]), + (111, G["while"]): ("SHIFT", 13), + (111, G["true"]): ("SHIFT", 25), + (111, G["id"]): ("SHIFT", 31), + (111, G["{"]): ("SHIFT", 10), (111, G["if"]): ("SHIFT", 12), + (111, G["not"]): ("SHIFT", 30), + (111, G["~"]): ("SHIFT", 27), + (111, G["new"]): ("SHIFT", 22), + (111, G["("]): ("SHIFT", 11), + (111, G["isvoid"]): ("SHIFT", 24), (111, G["string"]): ("SHIFT", 34), (111, G["let"]): ("SHIFT", 14), - (111, G["case"]): ("SHIFT", 21), - (111, G["while"]): ("SHIFT", 13), (112, G["}"]): ("REDUCE", G["block -> expr ; block"]), - (113, G["isvoid"]): ("SHIFT", 24), - (113, G["id"]): ("SHIFT", 31), (113, G["int"]): ("SHIFT", 33), - (113, G["}"]): ("REDUCE", G["block -> expr error"]), - (113, G["("]): ("SHIFT", 11), - (113, G["{"]): ("SHIFT", 10), + (113, G["case"]): ("SHIFT", 21), (113, G["false"]): ("SHIFT", 26), - (113, G["new"]): ("SHIFT", 22), - (113, G["~"]): ("SHIFT", 27), - (113, G["not"]): ("SHIFT", 30), + (113, G["while"]): ("SHIFT", 13), (113, G["true"]): ("SHIFT", 25), + (113, G["id"]): ("SHIFT", 31), + (113, G["{"]): ("SHIFT", 10), (113, G["if"]): ("SHIFT", 12), + (113, G["not"]): ("SHIFT", 30), + (113, G["}"]): ("REDUCE", G["block -> expr error"]), + (113, G["~"]): ("SHIFT", 27), + (113, G["new"]): ("SHIFT", 22), + (113, G["("]): ("SHIFT", 11), + (113, G["isvoid"]): ("SHIFT", 24), (113, G["string"]): ("SHIFT", 34), (113, G["let"]): ("SHIFT", 14), - (113, G["case"]): ("SHIFT", 21), - (113, G["while"]): ("SHIFT", 13), (114, G["}"]): ("REDUCE", G["block -> expr error block"]), (115, G["}"]): ("SHIFT", 116), (116, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), @@ -1061,21 +1061,21 @@ def __action_table(): (123, G[":"]): ("SHIFT", 124), (124, G["type"]): ("SHIFT", 125), (125, G["{"]): ("SHIFT", 126), - (126, G["{"]): ("SHIFT", 10), + (126, G["while"]): ("SHIFT", 13), (126, G["~"]): ("SHIFT", 27), - (126, G["not"]): ("SHIFT", 30), - (126, G["id"]): ("SHIFT", 31), + (126, G["isvoid"]): ("SHIFT", 24), + (126, G["{"]): ("SHIFT", 10), (126, G["if"]): ("SHIFT", 12), - (126, G["int"]): ("SHIFT", 33), - (126, G["let"]): ("SHIFT", 14), - (126, G["case"]): ("SHIFT", 21), + (126, G["not"]): ("SHIFT", 30), + (126, G["new"]): ("SHIFT", 22), (126, G["("]): ("SHIFT", 11), + (126, G["string"]): ("SHIFT", 34), + (126, G["int"]): ("SHIFT", 33), (126, G["false"]): ("SHIFT", 26), - (126, G["new"]): ("SHIFT", 22), - (126, G["while"]): ("SHIFT", 13), - (126, G["isvoid"]): ("SHIFT", 24), + (126, G["id"]): ("SHIFT", 31), + (126, G["let"]): ("SHIFT", 14), (126, G["true"]): ("SHIFT", 25), - (126, G["string"]): ("SHIFT", 34), + (126, G["case"]): ("SHIFT", 21), (127, G["}"]): ("SHIFT", 128), (128, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), (128, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), @@ -1083,287 +1083,286 @@ def __action_table(): (130, G["<-"]): ("SHIFT", 131), (130, G["error"]): ("REDUCE", G["attribute -> id : type"]), (130, G[";"]): ("REDUCE", G["attribute -> id : type"]), - (131, G["isvoid"]): ("SHIFT", 24), - (131, G["id"]): ("SHIFT", 31), (131, G["int"]): ("SHIFT", 33), - (131, G["("]): ("SHIFT", 11), + (131, G["case"]): ("SHIFT", 21), (131, G["false"]): ("SHIFT", 26), - (131, G["{"]): ("SHIFT", 10), - (131, G["new"]): ("SHIFT", 22), - (131, G["~"]): ("SHIFT", 27), - (131, G["not"]): ("SHIFT", 30), + (131, G["while"]): ("SHIFT", 13), (131, G["true"]): ("SHIFT", 25), + (131, G["id"]): ("SHIFT", 31), + (131, G["{"]): ("SHIFT", 10), (131, G["if"]): ("SHIFT", 12), + (131, G["not"]): ("SHIFT", 30), + (131, G["~"]): ("SHIFT", 27), + (131, G["new"]): ("SHIFT", 22), + (131, G["("]): ("SHIFT", 11), + (131, G["isvoid"]): ("SHIFT", 24), (131, G["string"]): ("SHIFT", 34), (131, G["let"]): ("SHIFT", 14), - (131, G["case"]): ("SHIFT", 21), - (131, G["while"]): ("SHIFT", 13), (132, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), (132, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), (133, G["}"]): ("SHIFT", 134), - (134, G["class"]): ("REDUCE", G["class-def -> class type { feature-list }"]), - (134, G["$"]): ("REDUCE", G["class-def -> class type { feature-list }"]), - (135, G["error"]): ("SHIFT", 143), + (134, G[";"]): ("REDUCE", G["class-def -> class type { feature-list }"]), (135, G[";"]): ("SHIFT", 136), - (136, G["id"]): ("SHIFT", 4), + (135, G["error"]): ("SHIFT", 143), (136, G["}"]): ("REDUCE", G["feature-list -> e"]), + (136, G["id"]): ("SHIFT", 4), (137, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), - (138, G[";"]): ("SHIFT", 139), (138, G["error"]): ("SHIFT", 141), - (139, G["id"]): ("SHIFT", 4), + (138, G[";"]): ("SHIFT", 139), (139, G["}"]): ("REDUCE", G["feature-list -> e"]), + (139, G["id"]): ("SHIFT", 4), (140, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), - (141, G["id"]): ("SHIFT", 4), (141, G["}"]): ("REDUCE", G["feature-list -> e"]), + (141, G["id"]): ("SHIFT", 4), (142, G["}"]): ("REDUCE", G["feature-list -> method error feature-list"]), - (143, G["id"]): ("SHIFT", 4), (143, G["}"]): ("REDUCE", G["feature-list -> e"]), + (143, G["id"]): ("SHIFT", 4), (144, G["}"]): ("REDUCE", G["feature-list -> attribute error feature-list"]), (145, G["type"]): ("SHIFT", 146), (146, G["{"]): ("SHIFT", 147), - (147, G["id"]): ("SHIFT", 4), (147, G["}"]): ("REDUCE", G["feature-list -> e"]), + (147, G["id"]): ("SHIFT", 4), (148, G["}"]): ("SHIFT", 149), - (149, G["class"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), - (149, G["$"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), + (149, G[";"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), (150, G["$"]): ("OK", None), (151, G["$"]): ("REDUCE", G["program -> class-list"]), - (152, G["$"]): ("REDUCE", G["class-list -> class-def"]), - (152, G["class"]): ("SHIFT", 1), - (153, G["$"]): ("REDUCE", G["class-list -> class-def class-list"]), + (152, G[";"]): ("SHIFT", 153), + (153, G["class"]): ("SHIFT", 1), + (153, G["$"]): ("REDUCE", G["class-list -> class-def ;"]), + (154, G["$"]): ("REDUCE", G["class-list -> class-def ; class-list"]), } @staticmethod def __goto_table(): return { - (0, G["class-list"]): 151, (0, G["class-def"]): 152, + (0, G["class-list"]): 151, (0, G["program"]): 150, (3, G["feature-list"]): 133, (3, G["attribute"]): 135, (3, G["method"]): 138, (5, G["param-list"]): 122, - (9, G["arith"]): 38, (9, G["term"]): 53, + (9, G["arith"]): 38, (9, G["atom"]): 43, (9, G["factor"]): 56, - (9, G["comp"]): 37, (9, G["expr"]): 115, + (9, G["comp"]): 37, (9, G["function-call"]): 35, (10, G["term"]): 53, (10, G["arith"]): 38, - (10, G["block"]): 108, (10, G["expr"]): 110, - (10, G["atom"]): 43, - (10, G["function-call"]): 35, (10, G["factor"]): 56, + (10, G["block"]): 108, + (10, G["function-call"]): 35, + (10, G["atom"]): 43, (10, G["comp"]): 37, - (11, G["expr"]): 106, - (11, G["arith"]): 38, + (11, G["function-call"]): 35, (11, G["term"]): 53, - (11, G["atom"]): 43, (11, G["factor"]): 56, - (11, G["function-call"]): 35, + (11, G["atom"]): 43, + (11, G["arith"]): 38, (11, G["comp"]): 37, - (12, G["function-call"]): 35, - (12, G["atom"]): 43, + (11, G["expr"]): 106, (12, G["term"]): 53, + (12, G["atom"]): 43, (12, G["arith"]): 38, (12, G["expr"]): 100, - (12, G["comp"]): 37, (12, G["factor"]): 56, - (13, G["atom"]): 43, - (13, G["term"]): 53, + (12, G["comp"]): 37, + (12, G["function-call"]): 35, + (13, G["function-call"]): 35, (13, G["arith"]): 38, + (13, G["term"]): 53, + (13, G["comp"]): 37, (13, G["expr"]): 96, + (13, G["atom"]): 43, (13, G["factor"]): 56, - (13, G["function-call"]): 35, - (13, G["comp"]): 37, (14, G["declaration-list"]): 93, (18, G["declaration-list"]): 19, + (20, G["factor"]): 56, (20, G["term"]): 53, - (20, G["expr"]): 90, + (20, G["function-call"]): 35, (20, G["arith"]): 38, (20, G["atom"]): 43, - (20, G["factor"]): 56, - (20, G["function-call"]): 35, (20, G["comp"]): 37, - (21, G["factor"]): 56, - (21, G["atom"]): 43, + (20, G["expr"]): 90, (21, G["arith"]): 38, - (21, G["term"]): 53, (21, G["expr"]): 77, - (21, G["comp"]): 37, + (21, G["term"]): 53, (21, G["function-call"]): 35, + (21, G["factor"]): 56, + (21, G["atom"]): 43, + (21, G["comp"]): 37, + (24, G["function-call"]): 35, (24, G["atom"]): 43, (24, G["factor"]): 76, - (24, G["function-call"]): 35, (27, G["factor"]): 75, - (27, G["atom"]): 43, (27, G["function-call"]): 35, - (29, G["term"]): 53, - (29, G["not-empty-expr-list"]): 49, - (29, G["function-call"]): 35, - (29, G["expr"]): 50, - (29, G["atom"]): 43, + (27, G["atom"]): 43, (29, G["arith"]): 38, (29, G["expr-list"]): 73, + (29, G["function-call"]): 35, + (29, G["term"]): 53, + (29, G["not-empty-expr-list"]): 49, (29, G["factor"]): 56, (29, G["comp"]): 37, - (30, G["term"]): 53, + (29, G["atom"]): 43, + (29, G["expr"]): 50, + (30, G["function-call"]): 35, (30, G["arith"]): 38, - (30, G["expr"]): 72, + (30, G["term"]): 53, + (30, G["comp"]): 37, (30, G["atom"]): 43, - (30, G["function-call"]): 35, + (30, G["expr"]): 72, (30, G["factor"]): 56, - (30, G["comp"]): 37, - (32, G["term"]): 53, + (32, G["function-call"]): 35, (32, G["arith"]): 38, + (32, G["term"]): 53, (32, G["expr"]): 36, + (32, G["comp"]): 37, (32, G["atom"]): 43, - (32, G["function-call"]): 35, (32, G["factor"]): 56, - (32, G["comp"]): 37, - (39, G["term"]): 40, - (39, G["atom"]): 43, (39, G["function-call"]): 35, (39, G["factor"]): 56, + (39, G["atom"]): 43, + (39, G["term"]): 40, + (41, G["function-call"]): 35, (41, G["atom"]): 43, (41, G["factor"]): 42, - (41, G["function-call"]): 35, + (46, G["arith"]): 38, + (46, G["function-call"]): 35, (46, G["term"]): 53, (46, G["not-empty-expr-list"]): 49, - (46, G["function-call"]): 35, - (46, G["expr"]): 50, - (46, G["atom"]): 43, - (46, G["arith"]): 38, (46, G["factor"]): 56, (46, G["comp"]): 37, + (46, G["atom"]): 43, + (46, G["expr"]): 50, (46, G["expr-list"]): 47, - (51, G["term"]): 53, - (51, G["function-call"]): 35, - (51, G["expr"]): 50, - (51, G["atom"]): 43, (51, G["arith"]): 38, - (51, G["not-empty-expr-list"]): 52, + (51, G["function-call"]): 35, + (51, G["term"]): 53, (51, G["factor"]): 56, (51, G["comp"]): 37, + (51, G["atom"]): 43, + (51, G["expr"]): 50, + (51, G["not-empty-expr-list"]): 52, + (54, G["function-call"]): 35, (54, G["atom"]): 43, (54, G["factor"]): 55, - (54, G["function-call"]): 35, + (61, G["arith"]): 38, + (61, G["function-call"]): 35, (61, G["term"]): 53, (61, G["not-empty-expr-list"]): 49, - (61, G["function-call"]): 35, - (61, G["expr"]): 50, - (61, G["atom"]): 43, - (61, G["arith"]): 38, (61, G["factor"]): 56, - (61, G["comp"]): 37, (61, G["expr-list"]): 62, - (64, G["term"]): 65, - (64, G["atom"]): 43, + (61, G["comp"]): 37, + (61, G["atom"]): 43, + (61, G["expr"]): 50, (64, G["function-call"]): 35, (64, G["factor"]): 56, - (66, G["atom"]): 43, + (64, G["atom"]): 43, + (64, G["term"]): 65, (66, G["arith"]): 67, (66, G["factor"]): 56, + (66, G["atom"]): 43, (66, G["term"]): 53, (66, G["function-call"]): 35, - (68, G["atom"]): 43, (68, G["arith"]): 69, (68, G["factor"]): 56, + (68, G["atom"]): 43, (68, G["term"]): 53, (68, G["function-call"]): 35, - (70, G["atom"]): 43, (70, G["arith"]): 71, (70, G["factor"]): 56, + (70, G["atom"]): 43, (70, G["term"]): 53, (70, G["function-call"]): 35, (78, G["case-list"]): 88, (82, G["term"]): 53, - (82, G["arith"]): 38, (82, G["expr"]): 83, - (82, G["atom"]): 43, - (82, G["function-call"]): 35, + (82, G["arith"]): 38, (82, G["factor"]): 56, + (82, G["function-call"]): 35, + (82, G["atom"]): 43, (82, G["comp"]): 37, (84, G["case-list"]): 85, (86, G["case-list"]): 87, (91, G["declaration-list"]): 92, - (94, G["term"]): 53, + (94, G["function-call"]): 35, (94, G["arith"]): 38, + (94, G["term"]): 53, + (94, G["comp"]): 37, (94, G["atom"]): 43, - (94, G["function-call"]): 35, - (94, G["factor"]): 56, (94, G["expr"]): 95, - (94, G["comp"]): 37, + (94, G["factor"]): 56, + (97, G["comp"]): 37, (97, G["arith"]): 38, - (97, G["atom"]): 43, (97, G["factor"]): 56, - (97, G["term"]): 53, (97, G["expr"]): 98, + (97, G["term"]): 53, (97, G["function-call"]): 35, - (97, G["comp"]): 37, - (101, G["comp"]): 37, + (97, G["atom"]): 43, (101, G["term"]): 53, + (101, G["atom"]): 43, (101, G["arith"]): 38, + (101, G["factor"]): 56, (101, G["expr"]): 102, - (101, G["atom"]): 43, (101, G["function-call"]): 35, - (101, G["factor"]): 56, - (103, G["factor"]): 56, - (103, G["arith"]): 38, - (103, G["term"]): 53, + (101, G["comp"]): 37, (103, G["comp"]): 37, + (103, G["term"]): 53, + (103, G["arith"]): 38, (103, G["atom"]): 43, (103, G["function-call"]): 35, (103, G["expr"]): 104, + (103, G["factor"]): 56, (111, G["term"]): 53, (111, G["arith"]): 38, (111, G["expr"]): 110, - (111, G["atom"]): 43, - (111, G["function-call"]): 35, (111, G["factor"]): 56, - (111, G["comp"]): 37, + (111, G["function-call"]): 35, (111, G["block"]): 112, + (111, G["atom"]): 43, + (111, G["comp"]): 37, (113, G["term"]): 53, (113, G["arith"]): 38, (113, G["expr"]): 110, - (113, G["atom"]): 43, - (113, G["function-call"]): 35, (113, G["factor"]): 56, - (113, G["comp"]): 37, + (113, G["function-call"]): 35, (113, G["block"]): 114, + (113, G["atom"]): 43, + (113, G["comp"]): 37, (120, G["param-list"]): 121, (126, G["expr"]): 127, - (126, G["arith"]): 38, (126, G["term"]): 53, + (126, G["arith"]): 38, (126, G["atom"]): 43, (126, G["factor"]): 56, (126, G["comp"]): 37, (126, G["function-call"]): 35, (131, G["term"]): 53, (131, G["arith"]): 38, - (131, G["atom"]): 43, + (131, G["factor"]): 56, (131, G["expr"]): 132, (131, G["function-call"]): 35, - (131, G["factor"]): 56, + (131, G["atom"]): 43, (131, G["comp"]): 37, (136, G["attribute"]): 135, - (136, G["method"]): 138, (136, G["feature-list"]): 137, + (136, G["method"]): 138, + (139, G["feature-list"]): 140, (139, G["attribute"]): 135, (139, G["method"]): 138, - (139, G["feature-list"]): 140, - (141, G["attribute"]): 135, (141, G["feature-list"]): 142, + (141, G["attribute"]): 135, (141, G["method"]): 138, + (143, G["feature-list"]): 144, (143, G["attribute"]): 135, (143, G["method"]): 138, - (143, G["feature-list"]): 144, - (147, G["attribute"]): 135, (147, G["feature-list"]): 148, + (147, G["attribute"]): 135, (147, G["method"]): 138, - (152, G["class-def"]): 152, - (152, G["class-list"]): 153, + (153, G["class-def"]): 152, + (153, G["class-list"]): 154, } From fcb59bef09595aa69cfe3dfc334e91923c0cb5f9 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Sun, 21 Feb 2021 00:08:58 -0500 Subject: [PATCH 096/143] - --- src/cool/code_generation/__init__.py | 0 src/cool/code_generation/cil.py | 230 +++++++++++++++++++++ src/cool/semantics/execution.py | 2 +- src/cool/semantics/formatter.py | 2 +- src/cool/semantics/overridden.py | 2 +- src/cool/semantics/type_builder.py | 2 +- src/cool/semantics/type_checker.py | 2 +- src/cool/semantics/type_collector.py | 2 +- src/cool/semantics/type_inference.py | 2 +- src/cool/visitor/__init__.py | 1 + src/cool/{semantics => visitor}/visitor.py | 0 11 files changed, 238 insertions(+), 7 deletions(-) create mode 100644 src/cool/code_generation/__init__.py create mode 100644 src/cool/code_generation/cil.py create mode 100644 src/cool/visitor/__init__.py rename src/cool/{semantics => visitor}/visitor.py (100%) diff --git a/src/cool/code_generation/__init__.py b/src/cool/code_generation/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/src/cool/code_generation/cil.py b/src/cool/code_generation/cil.py new file mode 100644 index 000000000..72add09d8 --- /dev/null +++ b/src/cool/code_generation/cil.py @@ -0,0 +1,230 @@ +import cool.visitor as visitor + + +class Node: + pass + +class ProgramNode(Node): + def __init__(self, dottypes, dotdata, dotcode): + self.dottypes = dottypes + self.dotdata = dotdata + self.dotcode = dotcode + +class TypeNode(Node): + def __init__(self, name): + self.name = name + self.attributes = [] + self.methods = [] + +class DataNode(Node): + def __init__(self, vname, value): + self.name = vname + self.value = value + +class FunctionNode(Node): + def __init__(self, fname, params, localvars, instructions): + self.name = fname + self.params = params + self.localvars = localvars + self.instructions = instructions + +class ParamNode(Node): + def __init__(self, name): + self.name = name + +class LocalNode(Node): + def __init__(self, name): + self.name = name + +class InstructionNode(Node): + pass + +class AssignNode(InstructionNode): + def __init__(self, dest, source): + self.dest = dest + self.source = source + +class ArithmeticNode(InstructionNode): + def __init__(self, dest, left, right): + self.dest = dest + self.left = left + self.right = right + +class PlusNode(ArithmeticNode): + pass + +class MinusNode(ArithmeticNode): + pass + +class StarNode(ArithmeticNode): + pass + +class DivNode(ArithmeticNode): + pass + +class GetAttribNode(InstructionNode): + pass + +class SetAttribNode(InstructionNode): + pass + +class GetIndexNode(InstructionNode): + pass + +class SetIndexNode(InstructionNode): + pass + +class AllocateNode(InstructionNode): + def __init__(self, itype, dest): + self.type = itype + self.dest = dest + +class ArrayNode(InstructionNode): + pass + +class TypeOfNode(InstructionNode): + def __init__(self, obj, dest): + self.obj = obj + self.dest = dest + +class LabelNode(InstructionNode): + pass + +class GotoNode(InstructionNode): + pass + +class GotoIfNode(InstructionNode): + pass + +class StaticCallNode(InstructionNode): + def __init__(self, function, dest): + self.function = function + self.dest = dest + +class DynamicCallNode(InstructionNode): + def __init__(self, xtype, method, dest): + self.type = xtype + self.method = method + self.dest = dest + +class ArgNode(InstructionNode): + def __init__(self, name): + self.name = name + +class ReturnNode(InstructionNode): + def __init__(self, value=None): + self.value = value + +class LoadNode(InstructionNode): + def __init__(self, dest, msg): + self.dest = dest + self.msg = msg + +class LengthNode(InstructionNode): + pass + +class ConcatNode(InstructionNode): + pass + +class PrefixNode(InstructionNode): + pass + +class SubstringNode(InstructionNode): + pass + +class ToStrNode(InstructionNode): + def __init__(self, dest, ivalue): + self.dest = dest + self.ivalue = ivalue + +class ReadNode(InstructionNode): + def __init__(self, dest): + self.dest = dest + +class PrintNode(InstructionNode): + def __init__(self, str_addr): + self.str_addr = str_addr + +def get_formatter(): + class PrintVisitor(object): + @visitor.on('node') + def visit(self, node): + pass + + @visitor.when(ProgramNode) + def visit(self, node): + 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): + attributes = '\n\t'.join(f'attribute {x}' for x 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): + 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(ParamNode) + def visit(self, node): + return f'PARAM {node.name}' + + @visitor.when(LocalNode) + def visit(self, node): + return f'LOCAL {node.name}' + + @visitor.when(AssignNode) + def visit(self, node): + return f'{node.dest} = {node.source}' + + @visitor.when(PlusNode) + def visit(self, node): + return f'{node.dest} = {node.left} + {node.right}' + + @visitor.when(MinusNode) + def visit(self, node): + return f'{node.dest} = {node.left} - {node.right}' + + @visitor.when(StarNode) + def visit(self, node): + return f'{node.dest} = {node.left} * {node.right}' + + @visitor.when(DivNode) + def visit(self, node): + return f'{node.dest} = {node.left} / {node.right}' + + @visitor.when(AllocateNode) + def visit(self, node): + return f'{node.dest} = ALLOCATE {node.type}' + + @visitor.when(TypeOfNode) + def visit(self, node): + return f'{node.dest} = TYPEOF {node.type}' + + @visitor.when(StaticCallNode) + def visit(self, node): + return f'{node.dest} = CALL {node.function}' + + @visitor.when(DynamicCallNode) + def visit(self, node): + return f'{node.dest} = VCALL {node.type} {node.method}' + + @visitor.when(ArgNode) + def visit(self, node): + return f'ARG {node.name}' + + @visitor.when(ReturnNode) + def visit(self, node): + return f'RETURN {node.value if node.value is not None else ""}' + + printer = PrintVisitor() + return (lambda ast: printer.visit(ast)) \ No newline at end of file diff --git a/src/cool/semantics/execution.py b/src/cool/semantics/execution.py index 93c8550c4..aff616dd6 100644 --- a/src/cool/semantics/execution.py +++ b/src/cool/semantics/execution.py @@ -2,7 +2,7 @@ import cool.semantics.utils.astnodes as ast import cool.semantics.utils.errors as err -import cool.semantics.visitor as visitor +import cool.visitor as visitor from cool.semantics.utils.scope import Context, Method, Scope, Type, SemanticError diff --git a/src/cool/semantics/formatter.py b/src/cool/semantics/formatter.py index 1319d17d5..09e83c766 100644 --- a/src/cool/semantics/formatter.py +++ b/src/cool/semantics/formatter.py @@ -1,5 +1,5 @@ import cool.semantics.utils.astnodes as ast -import cool.semantics.visitor as visitor +import cool.visitor as visitor class CodeBuilder: diff --git a/src/cool/semantics/overridden.py b/src/cool/semantics/overridden.py index 8ca5b64f2..009fed3e4 100644 --- a/src/cool/semantics/overridden.py +++ b/src/cool/semantics/overridden.py @@ -2,7 +2,7 @@ import cool.semantics.utils.astnodes as ast import cool.semantics.utils.errors as err -import cool.semantics.visitor as visitor +import cool.visitor as visitor from cool.semantics.utils.scope import Context, Type, SemanticError diff --git a/src/cool/semantics/type_builder.py b/src/cool/semantics/type_builder.py index 6d1130e80..140500354 100644 --- a/src/cool/semantics/type_builder.py +++ b/src/cool/semantics/type_builder.py @@ -2,7 +2,7 @@ import cool.semantics.utils.astnodes as ast import cool.semantics.utils.errors as err -import cool.semantics.visitor as visitor +import cool.visitor as visitor from cool.semantics.utils.scope import Context, SemanticError, Type, ErrorType diff --git a/src/cool/semantics/type_checker.py b/src/cool/semantics/type_checker.py index bd46897d3..481b43ec7 100644 --- a/src/cool/semantics/type_checker.py +++ b/src/cool/semantics/type_checker.py @@ -2,7 +2,7 @@ import cool.semantics.utils.astnodes as ast import cool.semantics.utils.errors as err -import cool.semantics.visitor as visitor +import cool.visitor as visitor from cool.semantics.utils.scope import (Context, ErrorType, Method, Scope, SemanticError, Type) diff --git a/src/cool/semantics/type_collector.py b/src/cool/semantics/type_collector.py index 765f1c4a8..fa921ca1f 100644 --- a/src/cool/semantics/type_collector.py +++ b/src/cool/semantics/type_collector.py @@ -1,7 +1,7 @@ from typing import List import cool.semantics.utils.astnodes as ast -import cool.semantics.visitor as visitor +import cool.visitor as visitor from cool.semantics.utils.scope import Context, SemanticError diff --git a/src/cool/semantics/type_inference.py b/src/cool/semantics/type_inference.py index 2fec535cf..4c1d318af 100644 --- a/src/cool/semantics/type_inference.py +++ b/src/cool/semantics/type_inference.py @@ -39,7 +39,7 @@ import cool.semantics.utils.astnodes as ast import cool.semantics.utils.errors as err -import cool.semantics.visitor as visitor +import cool.visitor as visitor from cool.semantics.utils.scope import (Attribute, Context, ErrorType, Method, Scope, SemanticError, Type, VariableInfo) diff --git a/src/cool/visitor/__init__.py b/src/cool/visitor/__init__.py new file mode 100644 index 000000000..6949fb886 --- /dev/null +++ b/src/cool/visitor/__init__.py @@ -0,0 +1 @@ +from cool.visitor.visitor import on, when diff --git a/src/cool/semantics/visitor.py b/src/cool/visitor/visitor.py similarity index 100% rename from src/cool/semantics/visitor.py rename to src/cool/visitor/visitor.py From 77fa6ab5034098f2bac5aa14b0380554d6bbec1d Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Sun, 21 Feb 2021 03:09:35 -0500 Subject: [PATCH 097/143] - --- src/cool/code_generation/base.py | 55 ++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/cool/code_generation/base.py diff --git a/src/cool/code_generation/base.py b/src/cool/code_generation/base.py new file mode 100644 index 000000000..530a4be33 --- /dev/null +++ b/src/cool/code_generation/base.py @@ -0,0 +1,55 @@ +import cool.code_generation.cil as cil + +class BaseCOOLToCILVisitor: + def __init__(self, context): + self.dottypes = [] + self.dotdata = [] + self.dotcode = [] + self.current_type = None + self.current_method = None + self.current_function = None + self.context = context + + @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_local(self, var_name): + name = f'local_{self.current_function.name[9:]}_{var_name}_{len(self.localvars)}' + local_node = cil.LocalNode(name) + 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) + return instruction + + def to_function_name(self, method_name, type_name): + return f'function_{method_name}_at_{type_name}' + + def register_function(self, function_name): + function_node = cil.FunctionNode(function_name, [], [], []) + self.dotcode.append(function_node) + return function_node + + def register_type(self, name): + type_node = cil.TypeNode(name) + self.dottypes.append(type_node) + return type_node + + def register_data(self, value): + vname = f'data_{len(self.dotdata)}' + data_node = cil.DataNode(vname, value) + self.dotdata.append(data_node) + return data_node \ No newline at end of file From 42a7673009c9be74ced4e1c67231bfa92ac3116f Mon Sep 17 00:00:00 2001 From: alejandroklever Date: Thu, 25 Feb 2021 18:30:44 -0500 Subject: [PATCH 098/143] - --- .github/workflows/tests.yml | 166 +- .gitignore | 808 +++---- .vscode/settings.json | 9 + Informe.md | 663 +++--- LICENSE | 42 +- README.md | 8 - Readme.md | 17 +- doc/Readme.md | 66 +- doc/team.yml | 20 +- requirements.txt | 8 +- src/Readme.md | 156 +- src/cool/__init__.py | 2 +- src/cool/__main__.py | 258 +-- src/cool/code_generation/base.py | 110 +- src/cool/code_generation/cil.py | 458 ++-- src/cool/grammar.py | 704 +++--- src/cool/lexertab.py | 42 +- src/cool/parsertab.py | 2736 ++++++++++++------------ src/cool/semantics/__init__.py | 18 +- src/cool/semantics/execution.py | 702 +++--- src/cool/semantics/formatter.py | 434 ++-- src/cool/semantics/overridden.py | 214 +- src/cool/semantics/type_builder.py | 152 +- src/cool/semantics/type_checker.py | 578 ++--- src/cool/semantics/type_collector.py | 120 +- src/cool/semantics/type_inference.py | 1396 ++++++------ src/cool/semantics/utils/astnodes.py | 350 +-- src/cool/semantics/utils/errors.py | 60 +- src/cool/semantics/utils/scope.py | 542 ++--- src/cool/visitor/__init__.py | 2 +- src/cool/visitor/visitor.py | 168 +- src/coolc.sh | 22 +- src/makefile | 24 +- tests/codegen/arith.cl | 860 ++++---- tests/codegen/arith_input.txt | 26 +- tests/codegen/arith_output.txt | 316 +-- tests/codegen/atoi_output.txt | 2 +- tests/codegen/book_list.cl | 264 +-- tests/codegen/book_list_output.txt | 14 +- tests/codegen/cells.cl | 194 +- tests/codegen/cells_output.txt | 42 +- tests/codegen/complex.cl | 104 +- tests/codegen/complex_output.txt | 2 +- tests/codegen/fib.cl | 58 +- tests/codegen/fib_input.txt | 2 +- tests/codegen/fib_output.txt | 4 +- tests/codegen/graph.cl | 762 +++---- tests/codegen/graph_input.txt | 10 +- tests/codegen/graph_output.txt | 14 +- tests/codegen/hairyscary.cl | 134 +- tests/codegen/hello_world.cl | 10 +- tests/codegen/hello_world_output.txt | 2 +- tests/codegen/io.cl | 206 +- tests/codegen/io_output.txt | 10 +- tests/codegen/life.cl | 872 ++++---- tests/codegen/life_input.txt | 130 +- tests/codegen/life_output.txt | 1554 +++++++------- tests/codegen/list_output.txt | 10 +- tests/codegen/new_complex.cl | 158 +- tests/codegen/new_complex_output.txt | 4 +- tests/codegen/palindrome.cl | 50 +- tests/codegen/palindrome_input.txt | 2 +- tests/codegen/palindrome_output.txt | 4 +- tests/codegen/primes_output.txt | 192 +- tests/codegen/print-cool_output.txt | 2 +- tests/codegen/sort-list_input.txt | 2 +- tests/codegen/sort-list_output.txt | 20 +- tests/codegen_test.py | 33 +- tests/conftest.py | 10 +- tests/execution/01_program.cl | 66 +- tests/execution/02_program.cl | 46 +- tests/execution/03_program.cl | 36 +- tests/execution/04_program.cl | 92 +- tests/execution/05_program.cl | 44 +- tests/execution/06_program.cl | 74 +- tests/inference/01_program.cl | 30 +- tests/inference/01_result.txt | 36 +- tests/inference/02_program.cl | 28 +- tests/inference/02_result.txt | 42 +- tests/inference/03_program.cl | 32 +- tests/inference/03_result.txt | 44 +- tests/inference/04_program.cl | 30 +- tests/inference/04_result.txt | 36 +- tests/inference/05_program.cl | 30 +- tests/inference/05_result.txt | 30 +- tests/inference/06_program.cl | 86 +- tests/inference/06_result.txt | 92 +- tests/inference/07_program.cl | 36 +- tests/inference/07_result.txt | 44 +- tests/inference/08_program.cl | 64 +- tests/inference/08_result.txt | 74 +- tests/inference/09_program.cl | 30 +- tests/inference/09_result.txt | 36 +- tests/inference/10_program.cl | 64 +- tests/inference/10_result.txt | 100 +- tests/inference/11_program.cl | 68 +- tests/inference/11_result.txt | 102 +- tests/lexer/comment1.cl | 108 +- tests/lexer/comment1_error.txt | 2 +- tests/lexer/iis1.cl | 220 +- tests/lexer/iis1_error.txt | 2 +- tests/lexer/iis2.cl | 238 +-- tests/lexer/iis2_error.txt | 2 +- tests/lexer/iis3.cl | 240 +-- tests/lexer/iis3_error.txt | 2 +- tests/lexer/iis4.cl | 238 +-- tests/lexer/iis4_error.txt | 2 +- tests/lexer/iis5.cl | 242 +-- tests/lexer/iis5_error.txt | 4 +- tests/lexer/iis6.cl | 248 +-- tests/lexer/iis6_error.txt | 2 +- tests/lexer/mixed1.cl | 26 +- tests/lexer/mixed1_error.txt | 2 +- tests/lexer/mixed2.cl | 38 +- tests/lexer/mixed2_error.txt | 6 +- tests/lexer/string1.cl | 10 +- tests/lexer/string1_error.txt | 2 +- tests/lexer/string2.cl | 36 +- tests/lexer/string4.cl | 74 +- tests/lexer/string4_error.txt | 4 +- tests/lexer_test.py | 24 +- tests/parser/assignment1.cl | 74 +- tests/parser/assignment2.cl | 74 +- tests/parser/assignment3.cl | 74 +- tests/parser/assignment3_error.txt | 2 +- tests/parser/attribute1.cl | 68 +- tests/parser/attribute2.cl | 68 +- tests/parser/attribute2_error.txt | 2 +- tests/parser/attribute3.cl | 68 +- tests/parser/attribute3_error.txt | 2 +- tests/parser/block1.cl | 174 +- tests/parser/block1_error.txt | 2 +- tests/parser/block2.cl | 174 +- tests/parser/block2_error.txt | 2 +- tests/parser/block3.cl | 174 +- tests/parser/block3_error.txt | 2 +- tests/parser/block4.cl | 176 +- tests/parser/block4_error.txt | 2 +- tests/parser/case1.cl | 182 +- tests/parser/case1_error.txt | 2 +- tests/parser/case2.cl | 186 +- tests/parser/case2_error.txt | 2 +- tests/parser/case3.cl | 186 +- tests/parser/case3_error.txt | 2 +- tests/parser/case4.cl | 186 +- tests/parser/case4_error.txt | 2 +- tests/parser/case5.cl | 186 +- tests/parser/case5_error.txt | 2 +- tests/parser/case6.cl | 186 +- tests/parser/class1.cl | 40 +- tests/parser/class2.cl | 40 +- tests/parser/class2_error.txt | 2 +- tests/parser/class3.cl | 68 +- tests/parser/class3_error.txt | 2 +- tests/parser/class4.cl | 72 +- tests/parser/class4_error.txt | 2 +- tests/parser/class5.cl | 68 +- tests/parser/class5_error.txt | 2 +- tests/parser/class6.cl | 68 +- tests/parser/class6_error.txt | 2 +- tests/parser/conditional1.cl | 138 +- tests/parser/conditional1_error.txt | 2 +- tests/parser/conditional2.cl | 138 +- tests/parser/conditional3.cl | 138 +- tests/parser/conditional3_error.txt | 2 +- tests/parser/conditional4.cl | 146 +- tests/parser/conditional4_error.txt | 2 +- tests/parser/conditional5.cl | 146 +- tests/parser/conditional5_error.txt | 2 +- tests/parser/conditional6.cl | 146 +- tests/parser/conditional6_error.txt | 2 +- tests/parser/dispatch1.cl | 90 +- tests/parser/dispatch2.cl | 90 +- tests/parser/dispatch2_error.txt | 2 +- tests/parser/dispatch3.cl | 88 +- tests/parser/dispatch4.cl | 106 +- tests/parser/dispatch4_error.txt | 2 +- tests/parser/dispatch5.cl | 106 +- tests/parser/dispatch6.cl | 114 +- tests/parser/dispatch6_error.txt | 2 +- tests/parser/dispatch7.cl | 114 +- tests/parser/dispatch7_error.txt | 2 +- tests/parser/dispatch8.cl | 114 +- tests/parser/dispatch9.cl | 122 +- tests/parser/let1.cl | 170 +- tests/parser/let2.cl | 170 +- tests/parser/let2_error.txt | 2 +- tests/parser/let3.cl | 170 +- tests/parser/let3_error.txt | 2 +- tests/parser/let4.cl | 170 +- tests/parser/let4_error.txt | 2 +- tests/parser/let5.cl | 170 +- tests/parser/let6.cl | 148 +- tests/parser/let6_error.txt | 2 +- tests/parser/let7.cl | 170 +- tests/parser/let7_error.txt | 2 +- tests/parser/loop1.cl | 156 +- tests/parser/loop2.cl | 156 +- tests/parser/loop3.cl | 156 +- tests/parser/loop3_error.txt | 2 +- tests/parser/loop4.cl | 156 +- tests/parser/loop4_error.txt | 2 +- tests/parser/method1.cl | 68 +- tests/parser/method1_error.txt | 2 +- tests/parser/method2.cl | 68 +- tests/parser/method2_error.txt | 2 +- tests/parser/method3.cl | 68 +- tests/parser/method3_error.txt | 2 +- tests/parser/method4.cl | 68 +- tests/parser/method4_error.txt | 2 +- tests/parser/method5.cl | 68 +- tests/parser/method5_error.txt | 2 +- tests/parser/method6.cl | 66 +- tests/parser/method6_error.txt | 2 +- tests/parser/mixed1.cl | 198 +- tests/parser/mixed2.cl | 28 +- tests/parser/mixed2_error.txt | 2 +- tests/parser/mixed3.cl | 80 +- tests/parser/mixed3_error.txt | 2 +- tests/parser/mixed4.cl | 42 +- tests/parser/mixed5.cl | 40 +- tests/parser/mixed5_error.txt | 2 +- tests/parser/mixed6.cl | 10 +- tests/parser/operation1.cl | 202 +- tests/parser/operation1_error.txt | 2 +- tests/parser/operation2.cl | 202 +- tests/parser/operation2_error.txt | 2 +- tests/parser/operation3.cl | 202 +- tests/parser/operation3_error.txt | 2 +- tests/parser/operation4.cl | 202 +- tests/parser/operation4_error.txt | 2 +- tests/parser/program1_error.txt | 2 +- tests/parser/program2.cl | 40 +- tests/parser/program3.cl | 48 +- tests/parser_test.py | 24 +- tests/semantic/01_program.cl | 30 +- tests/semantic/01_result.txt | 16 +- tests/semantic/02_program.cl | 12 +- tests/semantic/arithmetic1.cl | 20 +- tests/semantic/arithmetic10.cl | 28 +- tests/semantic/arithmetic11.cl | 26 +- tests/semantic/arithmetic12.cl | 26 +- tests/semantic/arithmetic1_error.txt | 2 +- tests/semantic/arithmetic2.cl | 20 +- tests/semantic/arithmetic2_error.txt | 2 +- tests/semantic/arithmetic3.cl | 20 +- tests/semantic/arithmetic3_error.txt | 2 +- tests/semantic/arithmetic4.cl | 20 +- tests/semantic/arithmetic5.cl | 20 +- tests/semantic/arithmetic5_error.txt | 2 +- tests/semantic/arithmetic6.cl | 22 +- tests/semantic/arithmetic6_error.txt | 2 +- tests/semantic/arithmetic7.cl | 24 +- tests/semantic/arithmetic7_error.txt | 2 +- tests/semantic/arithmetic8.cl | 26 +- tests/semantic/arithmetic8_error.txt | 2 +- tests/semantic/arithmetic9.cl | 28 +- tests/semantic/assignment1.cl | 14 +- tests/semantic/assignment1_error.txt | 2 +- tests/semantic/assignment2.cl | 26 +- tests/semantic/assignment2_error.txt | 2 +- tests/semantic/assignment3.cl | 28 +- tests/semantic/attributes1.cl | 24 +- tests/semantic/attributes1_error.txt | 2 +- tests/semantic/attributes2.cl | 24 +- tests/semantic/attributes2_error.txt | 2 +- tests/semantic/attributes3.cl | 48 +- tests/semantic/attributes3_error.txt | 2 +- tests/semantic/attributes4.cl | 76 +- tests/semantic/basics1.cl | 18 +- tests/semantic/basics1_error.txt | 2 +- tests/semantic/basics2.cl | 18 +- tests/semantic/basics2_error.txt | 2 +- tests/semantic/basics3.cl | 16 +- tests/semantic/basics3_error.txt | 2 +- tests/semantic/basics4.cl | 16 +- tests/semantic/basics4_error.txt | 2 +- tests/semantic/basics5.cl | 16 +- tests/semantic/basics5_error.txt | 2 +- tests/semantic/basics6.cl | 16 +- tests/semantic/basics6_error.txt | 2 +- tests/semantic/basics7.cl | 16 +- tests/semantic/basics7_error.txt | 2 +- tests/semantic/basics8.cl | 16 +- tests/semantic/basics8_error.txt | 2 +- tests/semantic/blocks1.cl | 60 +- tests/semantic/blocks1_error.txt | 2 +- tests/semantic/case1.cl | 46 +- tests/semantic/case1_error.txt | 2 +- tests/semantic/case2.cl | 44 +- tests/semantic/case3.cl | 44 +- tests/semantic/class1.cl | 16 +- tests/semantic/class1_error.txt | 4 +- tests/semantic/conditionals1.cl | 26 +- tests/semantic/conditionals1_error.txt | 2 +- tests/semantic/conditionals2.cl | 48 +- tests/semantic/conditionals2_error.txt | 4 +- tests/semantic/dispatch1.cl | 64 +- tests/semantic/dispatch1_error.txt | 2 +- tests/semantic/dispatch2.cl | 66 +- tests/semantic/dispatch2_error.txt | 2 +- tests/semantic/dispatch3.cl | 70 +- tests/semantic/dispatch3_error.txt | 2 +- tests/semantic/dispatch4.cl | 70 +- tests/semantic/dispatch5.cl | 60 +- tests/semantic/dispatch5_error.txt | 2 +- tests/semantic/dispatch6.cl | 64 +- tests/semantic/dispatch6_error.txt | 2 +- tests/semantic/eq1.cl | 32 +- tests/semantic/eq1_error.txt | 2 +- tests/semantic/eq2.cl | 34 +- tests/semantic/eq2_error.txt | 2 +- tests/semantic/eq3.cl | 34 +- tests/semantic/eq3_error.txt | 2 +- tests/semantic/eq4.cl | 34 +- tests/semantic/eq4_error.txt | 2 +- tests/semantic/isvoid1.cl | 50 +- tests/semantic/isvoid1_error.txt | 2 +- tests/semantic/let1.cl | 28 +- tests/semantic/let1_error.txt | 2 +- tests/semantic/let2.cl | 28 +- tests/semantic/let2_error.txt | 2 +- tests/semantic/let3.cl | 28 +- tests/semantic/loops1.cl | 14 +- tests/semantic/loops2.cl | 18 +- tests/semantic/loops2_error.txt | 2 +- tests/semantic/methods1.cl | 22 +- tests/semantic/methods1_error.txt | 2 +- tests/semantic/methods2.cl | 22 +- tests/semantic/methods2_error.txt | 2 +- tests/semantic/methods3.cl | 26 +- tests/semantic/methods3_error.txt | 2 +- tests/semantic/methods4.cl | 36 +- tests/semantic/methods4_error.txt | 2 +- tests/semantic/methods5.cl | 40 +- tests/semantic/methods5_error.txt | 2 +- tests/semantic/methods6.cl | 52 +- tests/semantic/methods6_error.txt | 2 +- tests/semantic/methods7.cl | 22 +- tests/semantic/methods8.cl | 22 +- tests/semantic/new1.cl | 60 +- tests/semantic/self1.cl | 22 +- tests/semantic/self1_error.txt | 2 +- tests/semantic/self2.cl | 20 +- tests/semantic/self2_error.txt | 2 +- tests/semantic/self3.cl | 20 +- tests/semantic/self3_error.txt | 2 +- tests/semantic/self4.cl | 18 +- tests/semantic/self4_error.txt | 2 +- tests/semantic_test.py | 26 +- tests/test_cool.py | 148 +- tests/utils/utils.py | 182 +- 352 files changed, 15463 insertions(+), 15459 deletions(-) create mode 100644 .vscode/settings.json delete mode 100755 README.md diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 62ff3680b..9fb3b7bf2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,83 +1,83 @@ -name: Tests - -on: [push, pull_request] - -jobs: - lexer: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Setup Python - uses: actions/setup-python@v2 - - - name: Install requirements - run: pip install -r requirements.txt - - - name: Run tests - run: | - cd src - make clean - make - make test TAG=lexer - - parser: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Setup Python - uses: actions/setup-python@v2 - - - name: Install requirements - run: pip install -r requirements.txt - - - name: Run tests - run: | - cd src - make clean - make - make test TAG=parser - - semantic: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Setup Python - uses: actions/setup-python@v2 - - - name: Install requirements - run: pip install -r requirements.txt - - - name: Run tests - run: | - cd src - make clean - make - make test TAG=semantic - - codegen: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Setup Python - uses: actions/setup-python@v2 - - - name: Install requirements - run: pip install -r requirements.txt - - - name: Install spim - run: sudo apt-get install spim - - - name: Run tests - run: | - cd src - make clean - make - make test TAG=codegen +name: Tests + +on: [push, pull_request] + +jobs: + lexer: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Setup Python + uses: actions/setup-python@v2 + + - name: Install requirements + run: pip install -r requirements.txt + + - name: Run tests + run: | + cd src + make clean + make + make test TAG=lexer + + parser: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Setup Python + uses: actions/setup-python@v2 + + - name: Install requirements + run: pip install -r requirements.txt + + - name: Run tests + run: | + cd src + make clean + make + make test TAG=parser + + semantic: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Setup Python + uses: actions/setup-python@v2 + + - name: Install requirements + run: pip install -r requirements.txt + + - name: Run tests + run: | + cd src + make clean + make + make test TAG=semantic + + codegen: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Setup Python + uses: actions/setup-python@v2 + + - name: Install requirements + run: pip install -r requirements.txt + + - name: Install spim + run: sudo apt-get install spim + + - name: Run tests + run: | + cd src + make clean + make + make test TAG=codegen diff --git a/.gitignore b/.gitignore index 24e92fb80..9a60321a0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,404 +1,404 @@ -# 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] -# Created by .ignore support plugin (hsz.mobi) -### Python template -# Byte-compiled / optimized / DLL files -__pycache__/ -*$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 - -# 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) - +# 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] +# Created by .ignore support plugin (hsz.mobi) +### Python template +# Byte-compiled / optimized / DLL files +__pycache__/ +*$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 + +# 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) + diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..33dc370f9 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,9 @@ +{ + "python.testing.pytestArgs": [ + "tests" + ], + "python.testing.unittestEnabled": false, + "python.testing.nosetestsEnabled": false, + "python.testing.pytestEnabled": true, + "python.testing.autoTestDiscoverOnSaveEnabled": true +} \ No newline at end of file diff --git a/Informe.md b/Informe.md index 66f9010aa..939682ce7 100644 --- a/Informe.md +++ b/Informe.md @@ -1,331 +1,332 @@ -Segundo Proyecto de Compilación -=============================== - -Título: --------------------------------------------------------------------------------------------- -> Inferencia de tipos en el lenguaje de programación COOL, una aproximación a través de grafos. - -Estudiantes: ------------ - -> - Alejandro Klever Clemente C-311 -> - Miguel Angel Gonzalez Calles C-311 - -### 1 Inferencia de Tipos - -COOL es un lenguaje de programación estáticamente tipado, y aunque el lenguaje no presenta inferencia de tipos, esta es una característica muy útil que incorporaremos en un nuestro intérprete. - -Nuestra solución a la inferencia de tipos se apoya en el uso básico de la teoría de grafos y en el uso del patrón de diseño visitor. - -La inferencia de tipos de nuestro proyecto detecta para cada atributo, variable, parámetro de función o retorno de función el primer tipo que le puede ser asignado, modificando en el árbol de sintaxis abstracta el string `AUTO_TYPE` por el nombre del tipo correspondiente y asignando los tipos correspondientes en el contexto y el ámbito en que seon declarados. - -#### 1.1 Algoritmo y Grafo de Dependecias - -**Entrada :** Un árbol de sintaxis abstracta, un contexto con todos los tipos declarados en el programa de COOL. - -**Salida :** Un árbol de Sintaxis Abstracta, Un Contexto y un Scope con tipos bien tagueados. - -**Algoritmo :** Durante el recorrido del AST será construido un grafo dirigido cuyos nodos encerrarán el concepto de las expresiones marcadas como `AUTO_TYPE` y las aristas representan las dependencias entre las expresiones de estos nodos para inferir su tipo. Sea `E1` una expresión cuyo tipo estático es marcado como `AUTO_TYPE`, y sea `E2` una expresión a partir de a cual se puede inferir el tipo de estático de `E1` entonces en el grafo existirá la arista ``. Una vez construido el árbol se comenzará una cadena de expansión de tipos estáticos de la forma `E1, E2, ..., En` donde `Ej` se infiere de `Ei` con `1 < j = i + 1 <= n` y `E1` es una expresión con tipo estático definido, al cual llamaremos átomo. Cuando todos los átomos se hayan propagado a través del grafo los nodos que no hayan podido ser resueltos serán marcados como tipos `Object` al ser esta la clase mas general del lenguaje. - -**Implementación :** Para esto creamos una estructura llamada `DependencyGraph` donde podemos crear nodos como una estructura llamada `DependencyNode` y arcos entre ellos. La estructura `DependencyGraph` consiste en un `OrderedDict` de nodos contra lista de adyacencia. Esta lista de adyacencia contiene los nodos a los cuales la llave propagar su tipo, estos nodos de la lista tienen un orden y esto es fundamental para el algoritmo de solución de inferencia. Si tenemos un caso `{x: [y, z]}` donde `x`, `y`, `z` son nodos, entonces el algoritmo determinará el tipo de `y` y `z` antes de continuar con todas sus cadenas de expansión, por lo que si `z` forma parte de una cadena de expansión de `y` entonces `y` no propagará su tipo a `z` ya que `x` lo hizo antes. Como se puede ver el algoritmo es un BFS simple donde en la cola, al inicio, serán incluido los nodos del grafo que tengan su tipo definido, es decir que no sea `AUTO_TYPE`. - -#### 1.2 Nodos de Dependencia - -Cada nodo del grafo será una abstracción de un concepto en el que se use un tagueo explícito de `AUTO_TYPE` y tendrá las referencias a las partes del proceso de semántica del programa, además de que cada nodo contará con un método `update(type)` el cual actualiza el tipo estático de estos conceptos. - -```python -class DependencyNode: - pass - -class AtomNode(DependencyNode): - """Nodo base el cual es creado a partir de expresiones que - contienen tipo estático u operaciones aritméticas""" - pass - -class AttributeNode(DependencyNode): - """Atributo de una clase""" - pass - -class ParameterNode(DependencyNode): - """Parámetro de una función""" - pass - -class ReturnTypeNode(DependencyNode): - """Tipo de retorno de una función""" - pass - -class VariableInfoNode(DependencyNode): - """Variables declaradas en el scope.""" - pass -``` - -#### 1.3 Casos factibles - -El algoritmo funciona de manera análoga para atributos, variables, parámetros y retorno de funciones. Explicado de forma recursiva puede ser visto como: - -- Un `AUTO_TYPE` será sustituido por su tipo correspodiente si este forma parte de una operacion que permita saber su tipo, o es usado en una expresión de la cuál es posible determinar su tipo. - -- Es importante señalar en que contexto estas dependencias son tomadas en cuenta: - - - Para los atributos marcados como `AUTO_TYPE` su tipo podrá ser determinado dentro del cuerpo de cualquiera de las funciones de la clase, o si es detectable el tipo de la expresión de inicialización. - - - Para las variables su tipo será determinado dentro del scope donde estas son válidas. - -- Para los parámetros su tipo será determinado dentro del cuerpo de la función o cuando esta función sea llamada a través de una operacion de dispatch. - -- Para los retornos de funciones, su tipo será determinado con su expresión y los llamados a dicha función a través de una operacion de dispatch. - -- En las expresiones if-then-else o case-of asignan automáticamente el tipo `Object` si al menos una de sus ramificaciones devuelve una expresión que no tiene tipo definido (`AUTO_TYPE`), en caso contrario asignará el `join` de las ramificaciones. - -##### 1.3.1 Ejemplos de casos factibles para la inferencia - -En este caso la expresión `d + 1` desambigua a `d` en un `Int` y luego `c` se infiere de `d`, `b` se infiere de `c`, `a` se infiere de `b` y el retorno de la función de infiere de `a`. Quedando todos los parámetros y el retorno de la función marcados como `Int`. - -```typescript -class Main { - function(a: AUTO_TYPE, b: AUTO_TYPE, c: AUTO_TYPE, d: AUTO_TYPE): AUTO_TYPE { - { - a <- b; - b <- c; - c <- d; - d <- a; - d + 1; - a; - } - }; -} -``` - -Similar al caso anterior pero en esta ocasión incluyendo atributos, la expresión los `x + y` infiere a los parámetros `x` y `y` como `Int` y tambien al atributo `b`, `a` se infiere de `b`. El tipo de retorno de `create_point()` se infiere de su porpia cuerpo con la expression `new Point` y esta a su vez infiere el tipo de retorno de `init()`. - -```typescript -class Point { - a: AUTO_TYPE; - b: AUTO_TYPE; - - init(x: AUTO_TYPE, y: AUTO_TYPE): AUTO_TYPE {{ - a <- b; - b <- x + y; - create_point(); - }}; - - create_point(): AUTO_TYPE { new Point }; -} -``` - -Probando con funciones recursivas tenemos el caso de fibonacci tipo de `n` se infiere al ser usado en las expresiones `n <= 2`, `n - 1`, `n - 2`, las cuales lo marcan como `Int`, `fibonacci(n - 1) + fibonacci(n - 2)` marca al retorno de la función como `Int` y la expresión if-then-else lo marca como `Object`. En este último caso la expresión `fibonacci(n - 1) + fibonacci(n - 2)` termina de analizarse primero que la expresión if-then-else por lo cual el tipo de retorno será `Int` el cual fue el primero que se definido, lo cual demuestra que el orden en el que se analizan las inferencias importan. - -```typescript -class Main { - fibonacci(n: AUTO_TYPE): AUTO_TYPE { - if n <= 2 then 1 else fibonacci(n - 1) + fibonacci(n - 2) fi - }; -} -``` - -El caso de Ackerman es bastante interesante, en nuestro algoritmo importa el orden en el que fueron definidas las dependencias. `m` y `n` son inferibles como `Int` a partir de las expresiones `n + 1` y `m - 1` respectivamente, y el tipo de retorno de `ackermann` en inferible por `n` al ser usado como segundo parámetro en un llamado de si mismo, por lo cual será `Int`. La influencia de la expresión `if-then-else` se ve anulada por el orden de inferencia. - -```typescript -class Main { - - ... - - ackermann(m: AUTO_TYPE, n: AUTO_TYPE): AUTO_TYPE { - if m = 0 then n + 1 else - if n = 0 then ackermann(m - 1, 1) else - ackermann(m - 1, ackermann(m, n - 1)) - fi - fi - }; - - ... - -} -``` - -#### 1.4 Casos No factibles - -No es posible determinar el tipo de una variable, atributo, parámetro, o retorno de función si para este se cumple el caso general y su caso especifico correspondiente. - -##### 1.4.1 Casos generales - -El tipo es utilizado en expresiones que no permiten determinar su tipo, o solo se logra determinar que poseen el mismo tipo que otras variables, atributos, parámetros o retorno de funciones de las cuales tampoco se puede determinar el mismo. - -```typescript -class Main { - b: AUTO_TYPE; - c: AUTO_TYPE; - - ... - - f(a: AUTO_TYPE, d: AUTO_TYPE): AUTO_TYPE { - { - b <- a; - d <- c; - f(a); - } - }; - - factorial(n: AUTO_TYPE): AUTO_TYPE { - if n = 1 then 1 else n * factorial(n - 1) fi - }; -} -``` - -En este ejemplo solo es posible inferir el typo del parámetro `n` de la función `factorial`, su tipo de retorno, el parámetro `a` de la función `f`, su tipo de retorno y el atributo `b` de la clase `Main`, el resto será marcado como `Object`. - -```typescript -class Main { - main (): Object { - 0 - }; - - f(a: AUTO_TYPE, b: AUTO_TYPE): AUTO_TYPE { - if a = 1 then b else - g(a + 1, b / 1) - fi - }; - - g(a: AUTO_TYPE, b: AUTO_TYPE): AUTO_TYPE { - if b = 1 then a else - f(a / 2, b + 1) - fi - }; -} -``` - -En este último caso es posible determinar el tipo de los parámetros `a` y `b` de ambas funciones `f` y `g` ya que estos participan en operaciones aritmétcas, sin embargo los tipos de retorno de estas funciones no son determinables ya que no se usan en otro contexto en un llamado en una de las ramas de la clausula `if-then-else`. Como nuestro algoritmo no propaga los tipos definidos entre ramas de expresiones como los `if-then-else` o `case-of` entonces el tipo de retorno no puede ser definido, luego por defecto se etiquetan como `Object`. - -##### 1.4.2 Casos Particulares - -**Para variables:** si estas no son utilizadas en el ámbito en que son marcadas como `Object`. - -```typescript -class Main inherits IO { - - ... - - f(): Int { - let a: AUTOTYPE, b: AUTO_TYPE in { - 1; - } - }; - - ... - -} -``` - -**Para parámetros:** si dentro del cuerpo de la función estas no son utilizadas y no existe otra función que llame a esta con argumentos con tipado estático definidos, serán marcadas como `Object`: - -```typescript -class Main inherits IO { - - ... - - f(a: AUTO_TYPE): Int{ - 1 - }; - - ... - -} -``` - -**Para atributos:** si no es posible determinar el tipo de la expresión de inicializacion o si dentro del cuerpo de todas las funciones de su clase correspondiente este no son utilizadas, serán marcadas como `Objects`. - -```typescript -class Main inherits IO { - b: AUTO_TYPE; - c: AUTO_TYPE; - - ... - - f(a: AUTO_TYPE): AUTO_TYPE{ - if a < 3 then 1 else f(a - 1) + f(a - 2) fi - }; -} -``` - -**Para el retorno de funciones:** si no es posible determinar el tipo de su expresión. - -```typescript -class Main inherits IO { - - ... - - f(a: Int): AUTO_TYPE{ - if a < 3 then a else f(a - 3) fi - }; -} -``` - -#### 1.5 Expresiones atómicas - -- Valores constantes (ej: 2, "hello", true). - -- Operaciones aritméticas, las cuales influyen en sus operandos que sean `AUTO_TYPE`. - -- Operaciones lógicas, las cuales influyen en sus operandos que sean `AUTO_TYPE`. - -- Llamdos a funciones con valor de retorno conocido. - -- Instancias de clases. - -- Variables de las cuales se conoce su tipo. - -- Bloques donde se puede determinar el tipo de la última expresión. - -### 2 Lexing y Parsing - -Para el proceso de lexing y parsing usamos el paquete de Python [PyJapt](https://github.com/alejandroklever/PyJapt.git), cuyos autores coinciden con los de este proyecto. - -### 3 Proceso de Semántica - -El proceso de semantica es bastante similar al visto en clases prácticas de la 12 a la 15 con algunas pequeñas modificaciones: - -- Recoleccion de tipos. -- Construccion los métodos y atributos de los tipos. -- Comprobamos que no existan dependencias cíclicas con un ordenamiento topológico de los tipos en su árbol de jerarquía -- Chequeo del la sobreescritura de métodos. -- Inferencia de tipos. -- Chequeo de tipos. -- Ejecución del programa. - -Cada uno de estos procesos hace uso del patrón visitor visto en clases prácticas para recorrer el ast y realizar el analisis de cada uno de los procesos. - -#### 3.1 Ejecución de código - -Para la ejecución hemos creado la abstracción de una instancia de un objeto. Con esto conseguimos en todo momento saber sobre que objecto en memoria estamos ejecutando un método y también tenemos acceso a los valores particulares de sus atributos en todo momento del programa. Para guardar el orden de ejcución de las funciones llevaremos una cola donde cada vez que ocurra un llamado a función colocaremos en el tope de la pila la instancia actual en la que estamos y tomará el control de la ejecución la instancia de la cual realizamos el dispatch. Finalmente cuando termine la ejecución de una función retomará el control del programa la instancia en el tope de la pila. El proceso se retira hasta que la pila esta vacía. Para comenzar ejecución de cualquier programa en `COOL` basta con comenzar con la instrucción `(new Main).main()`. - -### 4 CLI-API - -Para la cómoda utilizacion del intérprete hemos usado el paquete de python `typer` para crear una api-cli bastante sencilla, basta con ejecutar el comando `python cool --help` y obtendrá como salida lo siguiente: - - Usage: cool [OPTIONS] COMMAND [ARGS]... - - Options: - --install-completion Install completion for the current shell. - --show-completion Show completion for the current shell, to copy it or - customize the installation. - - --help Show this message and exit. - - Commands: - infer - run - serialize - -Se se puede apreciar existen 3 comandos principales: - -- `infer` el cual recibe un archivo .cl con un programa en COOL con tipos `AUTO_TYPE` y devuelve un programa en COOL con todos los `AUTO_TYPE` reemplazados por sus tipos correspondientes. - -- `run` el cual recibe como entrada un archivo .cl con un programa en COOL y ejecuta dicho programa. - -- `serialize` el cual vuelve a generar y serializar el parser y el lexer del lenguaje tras hacer modificaciones en su gramática. (Pensado para los desarrolladores) - -- En ambos casos se tiene como parámetro adicional el `--verbose` para observar los distintos procesos por los que pasa el proceso de compilación. - -### 5 Testing - -En la carpeta `tests` se encuentra las carpetas `execution`, `inference`, `lexer`, `parser`, `semantic` las cuales contienen casos de pruebas. Para correr todas las pruebas basta con hacer `pytest tests` y se probaran todos los casos menos los de la carpeta `execution`, la cual contiene programa en cool que deberan ser ejecutados a mano usando la cli-api de nuestro intérprete. \ No newline at end of file +Segundo Proyecto de Compilación +=============================== + +Título +-------------------------------------------------------------------------------------------- + +> Inferencia de tipos en el lenguaje de programación COOL, una aproximación a través de grafos. + +Estudiantes +----------- + +> - Alejandro Klever Clemente C-311 +> - Miguel Angel Gonzalez Calles C-311 + +### 1 Inferencia de Tipos + +COOL es un lenguaje de programación estáticamente tipado, y aunque el lenguaje no presenta inferencia de tipos, esta es una característica muy útil que incorporaremos en un nuestro intérprete. + +Nuestra solución a la inferencia de tipos se apoya en el uso básico de la teoría de grafos y en el uso del patrón de diseño visitor. + +La inferencia de tipos de nuestro proyecto detecta para cada atributo, variable, parámetro de función o retorno de función el primer tipo que le puede ser asignado, modificando en el árbol de sintaxis abstracta el string `AUTO_TYPE` por el nombre del tipo correspondiente y asignando los tipos correspondientes en el contexto y el ámbito en que seon declarados. + +#### 1.1 Algoritmo y Grafo de Dependecias + +**Entrada :** Un árbol de sintaxis abstracta, un contexto con todos los tipos declarados en el programa de COOL. + +**Salida :** Un árbol de Sintaxis Abstracta, Un Contexto y un Scope con tipos bien tagueados. + +**Algoritmo :** Durante el recorrido del AST será construido un grafo dirigido cuyos nodos encerrarán el concepto de las expresiones marcadas como `AUTO_TYPE` y las aristas representan las dependencias entre las expresiones de estos nodos para inferir su tipo. Sea `E1` una expresión cuyo tipo estático es marcado como `AUTO_TYPE`, y sea `E2` una expresión a partir de a cual se puede inferir el tipo de estático de `E1` entonces en el grafo existirá la arista ``. Una vez construido el árbol se comenzará una cadena de expansión de tipos estáticos de la forma `E1, E2, ..., En` donde `Ej` se infiere de `Ei` con `1 < j = i + 1 <= n` y `E1` es una expresión con tipo estático definido, al cual llamaremos átomo. Cuando todos los átomos se hayan propagado a través del grafo los nodos que no hayan podido ser resueltos serán marcados como tipos `Object` al ser esta la clase mas general del lenguaje. + +**Implementación :** Para esto creamos una estructura llamada `DependencyGraph` donde podemos crear nodos como una estructura llamada `DependencyNode` y arcos entre ellos. La estructura `DependencyGraph` consiste en un `OrderedDict` de nodos contra lista de adyacencia. Esta lista de adyacencia contiene los nodos a los cuales la llave propagar su tipo, estos nodos de la lista tienen un orden y esto es fundamental para el algoritmo de solución de inferencia. Si tenemos un caso `{x: [y, z]}` donde `x`, `y`, `z` son nodos, entonces el algoritmo determinará el tipo de `y` y `z` antes de continuar con todas sus cadenas de expansión, por lo que si `z` forma parte de una cadena de expansión de `y` entonces `y` no propagará su tipo a `z` ya que `x` lo hizo antes. Como se puede ver el algoritmo es un BFS simple donde en la cola, al inicio, serán incluido los nodos del grafo que tengan su tipo definido, es decir que no sea `AUTO_TYPE`. + +#### 1.2 Nodos de Dependencia + +Cada nodo del grafo será una abstracción de un concepto en el que se use un tagueo explícito de `AUTO_TYPE` y tendrá las referencias a las partes del proceso de semántica del programa, además de que cada nodo contará con un método `update(type)` el cual actualiza el tipo estático de estos conceptos. + +```python +class DependencyNode: + pass + +class AtomNode(DependencyNode): + """Nodo base el cual es creado a partir de expresiones que + contienen tipo estático u operaciones aritméticas""" + pass + +class AttributeNode(DependencyNode): + """Atributo de una clase""" + pass + +class ParameterNode(DependencyNode): + """Parámetro de una función""" + pass + +class ReturnTypeNode(DependencyNode): + """Tipo de retorno de una función""" + pass + +class VariableInfoNode(DependencyNode): + """Variables declaradas en el scope.""" + pass +``` + +#### 1.3 Casos factibles + +El algoritmo funciona de manera análoga para atributos, variables, parámetros y retorno de funciones. Explicado de forma recursiva puede ser visto como: + +- Un `AUTO_TYPE` será sustituido por su tipo correspodiente si este forma parte de una operacion que permita saber su tipo, o es usado en una expresión de la cuál es posible determinar su tipo. + +- Es importante señalar en que contexto estas dependencias son tomadas en cuenta: + + - Para los atributos marcados como `AUTO_TYPE` su tipo podrá ser determinado dentro del cuerpo de cualquiera de las funciones de la clase, o si es detectable el tipo de la expresión de inicialización. + + - Para las variables su tipo será determinado dentro del scope donde estas son válidas. + +- Para los parámetros su tipo será determinado dentro del cuerpo de la función o cuando esta función sea llamada a través de una operacion de dispatch. + +- Para los retornos de funciones, su tipo será determinado con su expresión y los llamados a dicha función a través de una operacion de dispatch. + +- En las expresiones if-then-else o case-of asignan automáticamente el tipo `Object` si al menos una de sus ramificaciones devuelve una expresión que no tiene tipo definido (`AUTO_TYPE`), en caso contrario asignará el `join` de las ramificaciones. + +##### 1.3.1 Ejemplos de casos factibles para la inferencia + +En este caso la expresión `d + 1` desambigua a `d` en un `Int` y luego `c` se infiere de `d`, `b` se infiere de `c`, `a` se infiere de `b` y el retorno de la función de infiere de `a`. Quedando todos los parámetros y el retorno de la función marcados como `Int`. + +```typescript +class Main { + function(a: AUTO_TYPE, b: AUTO_TYPE, c: AUTO_TYPE, d: AUTO_TYPE): AUTO_TYPE { + { + a <- b; + b <- c; + c <- d; + d <- a; + d + 1; + a; + } + }; +} +``` + +Similar al caso anterior pero en esta ocasión incluyendo atributos, la expresión los `x + y` infiere a los parámetros `x` y `y` como `Int` y tambien al atributo `b`, `a` se infiere de `b`. El tipo de retorno de `create_point()` se infiere de su porpia cuerpo con la expression `new Point` y esta a su vez infiere el tipo de retorno de `init()`. + +```typescript +class Point { + a: AUTO_TYPE; + b: AUTO_TYPE; + + init(x: AUTO_TYPE, y: AUTO_TYPE): AUTO_TYPE {{ + a <- b; + b <- x + y; + create_point(); + }}; + + create_point(): AUTO_TYPE { new Point }; +} +``` + +Probando con funciones recursivas tenemos el caso de fibonacci tipo de `n` se infiere al ser usado en las expresiones `n <= 2`, `n - 1`, `n - 2`, las cuales lo marcan como `Int`, `fibonacci(n - 1) + fibonacci(n - 2)` marca al retorno de la función como `Int` y la expresión if-then-else lo marca como `Object`. En este último caso la expresión `fibonacci(n - 1) + fibonacci(n - 2)` termina de analizarse primero que la expresión if-then-else por lo cual el tipo de retorno será `Int` el cual fue el primero que se definido, lo cual demuestra que el orden en el que se analizan las inferencias importan. + +```typescript +class Main { + fibonacci(n: AUTO_TYPE): AUTO_TYPE { + if n <= 2 then 1 else fibonacci(n - 1) + fibonacci(n - 2) fi + }; +} +``` + +El caso de Ackerman es bastante interesante, en nuestro algoritmo importa el orden en el que fueron definidas las dependencias. `m` y `n` son inferibles como `Int` a partir de las expresiones `n + 1` y `m - 1` respectivamente, y el tipo de retorno de `ackermann` en inferible por `n` al ser usado como segundo parámetro en un llamado de si mismo, por lo cual será `Int`. La influencia de la expresión `if-then-else` se ve anulada por el orden de inferencia. + +```typescript +class Main { + + ... + + ackermann(m: AUTO_TYPE, n: AUTO_TYPE): AUTO_TYPE { + if m = 0 then n + 1 else + if n = 0 then ackermann(m - 1, 1) else + ackermann(m - 1, ackermann(m, n - 1)) + fi + fi + }; + + ... + +} +``` + +#### 1.4 Casos No factibles + +No es posible determinar el tipo de una variable, atributo, parámetro, o retorno de función si para este se cumple el caso general y su caso especifico correspondiente. + +##### 1.4.1 Casos generales + +El tipo es utilizado en expresiones que no permiten determinar su tipo, o solo se logra determinar que poseen el mismo tipo que otras variables, atributos, parámetros o retorno de funciones de las cuales tampoco se puede determinar el mismo. + +```typescript +class Main { + b: AUTO_TYPE; + c: AUTO_TYPE; + + ... + + f(a: AUTO_TYPE, d: AUTO_TYPE): AUTO_TYPE { + { + b <- a; + d <- c; + f(a); + } + }; + + factorial(n: AUTO_TYPE): AUTO_TYPE { + if n = 1 then 1 else n * factorial(n - 1) fi + }; +} +``` + +En este ejemplo solo es posible inferir el typo del parámetro `n` de la función `factorial`, su tipo de retorno, el parámetro `a` de la función `f`, su tipo de retorno y el atributo `b` de la clase `Main`, el resto será marcado como `Object`. + +```typescript +class Main { + main (): Object { + 0 + }; + + f(a: AUTO_TYPE, b: AUTO_TYPE): AUTO_TYPE { + if a = 1 then b else + g(a + 1, b / 1) + fi + }; + + g(a: AUTO_TYPE, b: AUTO_TYPE): AUTO_TYPE { + if b = 1 then a else + f(a / 2, b + 1) + fi + }; +} +``` + +En este último caso es posible determinar el tipo de los parámetros `a` y `b` de ambas funciones `f` y `g` ya que estos participan en operaciones aritmétcas, sin embargo los tipos de retorno de estas funciones no son determinables ya que no se usan en otro contexto en un llamado en una de las ramas de la clausula `if-then-else`. Como nuestro algoritmo no propaga los tipos definidos entre ramas de expresiones como los `if-then-else` o `case-of` entonces el tipo de retorno no puede ser definido, luego por defecto se etiquetan como `Object`. + +##### 1.4.2 Casos Particulares + +**Para variables:** si estas no son utilizadas en el ámbito en que son marcadas como `Object`. + +```typescript +class Main inherits IO { + + ... + + f(): Int { + let a: AUTOTYPE, b: AUTO_TYPE in { + 1; + } + }; + + ... + +} +``` + +**Para parámetros:** si dentro del cuerpo de la función estas no son utilizadas y no existe otra función que llame a esta con argumentos con tipado estático definidos, serán marcadas como `Object`: + +```typescript +class Main inherits IO { + + ... + + f(a: AUTO_TYPE): Int{ + 1 + }; + + ... + +} +``` + +**Para atributos:** si no es posible determinar el tipo de la expresión de inicializacion o si dentro del cuerpo de todas las funciones de su clase correspondiente este no son utilizadas, serán marcadas como `Objects`. + +```typescript +class Main inherits IO { + b: AUTO_TYPE; + c: AUTO_TYPE; + + ... + + f(a: AUTO_TYPE): AUTO_TYPE{ + if a < 3 then 1 else f(a - 1) + f(a - 2) fi + }; +} +``` + +**Para el retorno de funciones:** si no es posible determinar el tipo de su expresión. + +```typescript +class Main inherits IO { + + ... + + f(a: Int): AUTO_TYPE{ + if a < 3 then a else f(a - 3) fi + }; +} +``` + +#### 1.5 Expresiones atómicas + +- Valores constantes (ej: 2, "hello", true). + +- Operaciones aritméticas, las cuales influyen en sus operandos que sean `AUTO_TYPE`. + +- Operaciones lógicas, las cuales influyen en sus operandos que sean `AUTO_TYPE`. + +- Llamdos a funciones con valor de retorno conocido. + +- Instancias de clases. + +- Variables de las cuales se conoce su tipo. + +- Bloques donde se puede determinar el tipo de la última expresión. + +### 2 Lexing y Parsing + +Para el proceso de lexing y parsing usamos el paquete de Python [PyJapt](https://github.com/alejandroklever/PyJapt.git), cuyos autores coinciden con los de este proyecto. + +### 3 Proceso de Semántica + +El proceso de semantica es bastante similar al visto en clases prácticas de la 12 a la 15 con algunas pequeñas modificaciones: + +- Recoleccion de tipos. +- Construccion los métodos y atributos de los tipos. +- Comprobamos que no existan dependencias cíclicas con un ordenamiento topológico de los tipos en su árbol de jerarquía +- Chequeo del la sobreescritura de métodos. +- Inferencia de tipos. +- Chequeo de tipos. +- Ejecución del programa. + +Cada uno de estos procesos hace uso del patrón visitor visto en clases prácticas para recorrer el ast y realizar el analisis de cada uno de los procesos. + +#### 3.1 Ejecución de código + +Para la ejecución hemos creado la abstracción de una instancia de un objeto. Con esto conseguimos en todo momento saber sobre que objecto en memoria estamos ejecutando un método y también tenemos acceso a los valores particulares de sus atributos en todo momento del programa. Para guardar el orden de ejcución de las funciones llevaremos una cola donde cada vez que ocurra un llamado a función colocaremos en el tope de la pila la instancia actual en la que estamos y tomará el control de la ejecución la instancia de la cual realizamos el dispatch. Finalmente cuando termine la ejecución de una función retomará el control del programa la instancia en el tope de la pila. El proceso se retira hasta que la pila esta vacía. Para comenzar ejecución de cualquier programa en `COOL` basta con comenzar con la instrucción `(new Main).main()`. + +### 4 CLI-API + +Para la cómoda utilizacion del intérprete hemos usado el paquete de python `typer` para crear una api-cli bastante sencilla, basta con ejecutar el comando `python cool --help` y obtendrá como salida lo siguiente: + + Usage: cool [OPTIONS] COMMAND [ARGS]... + + Options: + --install-completion Install completion for the current shell. + --show-completion Show completion for the current shell, to copy it or + customize the installation. + + --help Show this message and exit. + + Commands: + infer + run + serialize + +Se se puede apreciar existen 3 comandos principales: + +- `infer` el cual recibe un archivo .cl con un programa en COOL con tipos `AUTO_TYPE` y devuelve un programa en COOL con todos los `AUTO_TYPE` reemplazados por sus tipos correspondientes. + +- `run` el cual recibe como entrada un archivo .cl con un programa en COOL y ejecuta dicho programa. + +- `serialize` el cual vuelve a generar y serializar el parser y el lexer del lenguaje tras hacer modificaciones en su gramática. (Pensado para los desarrolladores) + +- En ambos casos se tiene como parámetro adicional el `--verbose` para observar los distintos procesos por los que pasa el proceso de compilación. + +### 5 Testing + +En la carpeta `tests` se encuentra las carpetas `execution`, `inference`, `lexer`, `parser`, `semantic` las cuales contienen casos de pruebas. Para correr todas las pruebas basta con hacer `pytest tests` y se probaran todos los casos menos los de la carpeta `execution`, la cual contiene programa en cool que deberan ser ejecutados a mano usando la cli-api de nuestro intérprete. diff --git a/LICENSE b/LICENSE index 718bd210a..7f19c2d8c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,21 @@ -MIT License - -Copyright (c) 2021 School of Math and Computer Science, University of Havana - -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. +MIT License + +Copyright (c) 2021 School of Math and Computer Science, University of Havana + +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. diff --git a/README.md b/README.md deleted file mode 100755 index f7d622591..000000000 --- a/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# Cool Interpreter with type inference for compiling class - -## University of Havana, Matcom Faculty, Computer Science, 3rd year - -### Students - - - Alejandro Klever Clemente C-311 - - Miguel Angel Gonzalez Calles C-311 diff --git a/Readme.md b/Readme.md index f7d622591..b22a31063 100644 --- a/Readme.md +++ b/Readme.md @@ -1,8 +1,9 @@ -# Cool Interpreter with type inference for compiling class - -## University of Havana, Matcom Faculty, Computer Science, 3rd year - -### Students - - - Alejandro Klever Clemente C-311 - - Miguel Angel Gonzalez Calles C-311 +# Cool Compiler for for compiling course + +## University of Havana, Matcom Faculty, Computer Science, 4th year + +### Students + + - Alejandro Klever Clemente C-411 + - Laura Tamayo Blanco C-411 + - Miguel Angel Gonzalez Calles C-411 diff --git a/doc/Readme.md b/doc/Readme.md index 3b2569f5c..a7ed0e32d 100644 --- a/doc/Readme.md +++ b/doc/Readme.md @@ -1,33 +1,33 @@ -# Documentación - -## Readme - -Modifique el contenido de este documento para documentar de forma clara y concisa los siguientes aspectos: - -- Cómo ejecutar (y compilar si es necesario) su compilador. -- Requisitos adicionales, dependencias, configuración, etc. -- Opciones adicionales que tenga su compilador. - -## Sobre los Equipos de Desarrollo - -Para desarrollar el compilador del lenguaje COOL se trabajará en equipos de 2 o 3 integrantes. El proyecto de Compilación será recogido y evaluado únicamente a través de Github. Es imprescindible tener una cuenta de Github para cada participante, y que su proyecto esté correctamente hosteado en esta plataforma. - -**⚠️ NOTA**: Debe completar el archivo `team.yml` con los datos correctos de cada miembro de su equipo. - -## Sobre los Materiales a Entregar - -Para la evaluación del proyecto Ud. debe entregar un informe en formato PDF (`report.pdf`) en esta carpeta, que resuma de manera organizada y comprensible la arquitectura e implementación de su compilador. -El documento no tiene límite de extensión. -En él explicará en más detalle su solución a los problemas que, durante la implementación de cada una de las fases del proceso de compilación, hayan requerido de Ud. especial atención. - -## Estructura del reporte - -Usted es libre de estructurar su reporte escrito como más conveniente le parezca. A continuación le sugerimos algunas secciones que no deberían faltar, aunque puede mezclar, renombrar y organizarlas de la manera que mejor le parezca: - -- **Uso del compilador**: detalles sobre las opciones de líneas de comando, si tiene opciones adicionales (e.j., `--ast` genera un AST en JSON, etc.). Básicamente lo mismo que pondrá en este Readme. -- **Arquitectura del compilador**: una explicación general de la arquitectura, en cuántos módulos se divide el proyecto, cuantas fases tiene, qué tipo de gramática se utiliza, y en general, como se organiza el proyecto. Una buena imagen siempre ayuda. -- **Problemas técnicos**: detalles sobre cualquier problema teórico o técnico interesante que haya necesitado resolver de forma particular. - -## Sobre la Fecha de Entrega - -Se realizarán recogidas parciales del proyecto a lo largo del curso. En el Canal de Telegram se anunciará la fecha y requisitos de cada entrega. +# Documentación + +## Readme + +Modifique el contenido de este documento para documentar de forma clara y concisa los siguientes aspectos: + +- Cómo ejecutar (y compilar si es necesario) su compilador. +- Requisitos adicionales, dependencias, configuración, etc. +- Opciones adicionales que tenga su compilador. + +## Sobre los Equipos de Desarrollo + +Para desarrollar el compilador del lenguaje COOL se trabajará en equipos de 2 o 3 integrantes. El proyecto de Compilación será recogido y evaluado únicamente a través de Github. Es imprescindible tener una cuenta de Github para cada participante, y que su proyecto esté correctamente hosteado en esta plataforma. + +**⚠️ NOTA**: Debe completar el archivo `team.yml` con los datos correctos de cada miembro de su equipo. + +## Sobre los Materiales a Entregar + +Para la evaluación del proyecto Ud. debe entregar un informe en formato PDF (`report.pdf`) en esta carpeta, que resuma de manera organizada y comprensible la arquitectura e implementación de su compilador. +El documento no tiene límite de extensión. +En él explicará en más detalle su solución a los problemas que, durante la implementación de cada una de las fases del proceso de compilación, hayan requerido de Ud. especial atención. + +## Estructura del reporte + +Usted es libre de estructurar su reporte escrito como más conveniente le parezca. A continuación le sugerimos algunas secciones que no deberían faltar, aunque puede mezclar, renombrar y organizarlas de la manera que mejor le parezca: + +- **Uso del compilador**: detalles sobre las opciones de líneas de comando, si tiene opciones adicionales (e.j., `--ast` genera un AST en JSON, etc.). Básicamente lo mismo que pondrá en este Readme. +- **Arquitectura del compilador**: una explicación general de la arquitectura, en cuántos módulos se divide el proyecto, cuantas fases tiene, qué tipo de gramática se utiliza, y en general, como se organiza el proyecto. Una buena imagen siempre ayuda. +- **Problemas técnicos**: detalles sobre cualquier problema teórico o técnico interesante que haya necesitado resolver de forma particular. + +## Sobre la Fecha de Entrega + +Se realizarán recogidas parciales del proyecto a lo largo del curso. En el Canal de Telegram se anunciará la fecha y requisitos de cada entrega. diff --git a/doc/team.yml b/doc/team.yml index c16162532..168b4bf1e 100644 --- a/doc/team.yml +++ b/doc/team.yml @@ -1,10 +1,10 @@ -members: - - name: Nombre Apellido1 Apellido2 - github: github_id - group: CXXX - - name: Nombre Apellido1 Apellido2 - github: github_id - group: CXXX - - name: Nombre Apellido1 Apellido2 - github: github_id - group: CXXX +members: + - name: Alejandro Klever Clemente + github: alejandroklever + group: C411 + - name: Miguel Angel Gonzales Calles + github: LauTB + group: C411 + - name: laura Tamayo Blanco + github: Migueacalle98 + group: C411 diff --git a/requirements.txt b/requirements.txt index a675cd29a..e5e391d0a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -pytest -pytest-ordering -pyjapt~=0.2.8 -typer~=0.3.2 +pytest +pytest-ordering +pyjapt~=0.2.8 +typer~=0.3.2 diff --git a/src/Readme.md b/src/Readme.md index 1200371b5..cdca282ec 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/cool/__init__.py b/src/cool/__init__.py index d9540601e..cdbd923c5 100644 --- a/src/cool/__init__.py +++ b/src/cool/__init__.py @@ -1 +1 @@ -from .__main__ import check_semantics, CoolLexer, CoolParser +from .__main__ import check_semantics, CoolLexer, CoolParser diff --git a/src/cool/__main__.py b/src/cool/__main__.py index 6d8d1b392..c3a7a18e1 100644 --- a/src/cool/__main__.py +++ b/src/cool/__main__.py @@ -1,129 +1,129 @@ -import os -import sys -from pathlib import Path -from typing import List - -import typer - -sys.path.append(os.getcwd()) - -from cool.grammar import serialize_parser_and_lexer -from cool.lexertab import CoolLexer -from cool.parsertab import CoolParser -from cool.semantics import TypeCollector, TypeBuilder, OverriddenMethodChecker, TypeChecker, topological_sorting -from cool.semantics.execution import Executor, ExecutionError -from cool.semantics.formatter import CodeBuilder -from cool.semantics.type_inference import InferenceChecker -from cool.semantics.utils.scope import Context, Scope - -app = typer.Typer() - - -def check_semantics(ast, scope: Scope, context: Context, errors: List[str]): - TypeCollector(context, errors).visit(ast) - TypeBuilder(context, errors).visit(ast) - declarations = ast.declarations - topological_sorting(ast, context, errors) - ast.declarations = declarations - if not errors: - OverriddenMethodChecker(context, errors).visit(ast) - InferenceChecker(context, errors).visit(ast, scope) - TypeChecker(context, errors).visit(ast, scope) - return ast, scope, context, errors - - -def tokenize(file: str, verbose: bool = False): - path = Path.cwd() / file - if not path.exists(): - typer.echo(f'File {file} does not exist.') - exit() - s = path.open('r').read() - lexer = CoolLexer() - tokens = lexer(s) - - if lexer.contain_errors: - for e in lexer.errors: - typer.echo(e, err=True) - - if verbose: - for t in tokens: - typer.echo(t) - - return tokens, lexer - - -def parse(file: str, verbose: bool = False): - tokens, lexer = tokenize(file, verbose) - - if lexer.contain_errors: - return None, None - - parser = CoolParser(verbose) - ast = parser(tokens) - - if parser.contains_errors: - typer.echo(parser.errors[0], err=True) - - return ast, parser - - -@app.command() -def infer(file: str, verbose: bool = False): - ast, _ = parse(file, verbose) - - if ast is not None: - ast, _, _, errors = check_semantics(ast, Scope(), Context(), []) - if errors: - for e in errors: - typer.echo(e, err=True) - typer.echo(CodeBuilder().visit(ast, 0)) - - -@app.command() -def run(file: str, verbose: bool = False): - ast, parser = parse(file, verbose) - - if ast is not None: - ast, _, context, errors = check_semantics(ast, Scope(), Context(), []) - - if not errors and not parser.contains_errors: - try: - Executor(context).visit(ast, Scope()) - typer.echo('Program finished...') - except ExecutionError as e: - typer.echo(e.text, err=True) - - for error in errors: - typer.echo(error, err=True) - - -@app.command() -def serialize(): - serialize_parser_and_lexer() - - cwd = os.getcwd() - - lexertab = os.path.join(cwd, 'lexertab.py') - parsertab = os.path.join(cwd, 'parsertab.py') - - cool_lexertab = Path(os.path.join(cwd, 'cool', 'lexertab.py')) - cool_parsertab = Path(os.path.join(cwd, 'cool', 'parsertab.py')) - - mode = 'w' if cool_lexertab.exists() else 'x' - fr = open(lexertab, 'r') - with cool_lexertab.open(mode) as fw: - fw.write(fr.read().replace('from grammar', 'from cool.grammar')) - fr.close() - - mode = 'w' if cool_parsertab.exists() else 'x' - fr = open(parsertab, 'r') - with cool_parsertab.open(mode) as fw: - fw.write(fr.read().replace('from grammar', 'from cool.grammar')) - fr.close() - - os.remove(lexertab) - os.remove(parsertab) - - -if __name__ == '__main__': - app() +import os +import sys +from pathlib import Path +from typing import List + +import typer + +sys.path.append(os.getcwd()) + +from cool.grammar import serialize_parser_and_lexer +from cool.lexertab import CoolLexer +from cool.parsertab import CoolParser +from cool.semantics import TypeCollector, TypeBuilder, OverriddenMethodChecker, TypeChecker, topological_sorting +from cool.semantics.execution import Executor, ExecutionError +from cool.semantics.formatter import CodeBuilder +from cool.semantics.type_inference import InferenceChecker +from cool.semantics.utils.scope import Context, Scope + +app = typer.Typer() + + +def check_semantics(ast, scope: Scope, context: Context, errors: List[str]): + TypeCollector(context, errors).visit(ast) + TypeBuilder(context, errors).visit(ast) + declarations = ast.declarations + topological_sorting(ast, context, errors) + ast.declarations = declarations + if not errors: + OverriddenMethodChecker(context, errors).visit(ast) + InferenceChecker(context, errors).visit(ast, scope) + TypeChecker(context, errors).visit(ast, scope) + return ast, scope, context, errors + + +def tokenize(file: str, verbose: bool = False): + path = Path.cwd() / file + if not path.exists(): + typer.echo(f'File {file} does not exist.') + exit() + s = path.open('r').read() + lexer = CoolLexer() + tokens = lexer(s) + + if lexer.contain_errors: + for e in lexer.errors: + typer.echo(e, err=True) + + if verbose: + for t in tokens: + typer.echo(t) + + return tokens, lexer + + +def parse(file: str, verbose: bool = False): + tokens, lexer = tokenize(file, verbose) + + if lexer.contain_errors: + return None, None + + parser = CoolParser(verbose) + ast = parser(tokens) + + if parser.contains_errors: + typer.echo(parser.errors[0], err=True) + + return ast, parser + + +@app.command() +def infer(file: str, verbose: bool = False): + ast, _ = parse(file, verbose) + + if ast is not None: + ast, _, _, errors = check_semantics(ast, Scope(), Context(), []) + if errors: + for e in errors: + typer.echo(e, err=True) + typer.echo(CodeBuilder().visit(ast, 0)) + + +@app.command() +def run(file: str, verbose: bool = False): + ast, parser = parse(file, verbose) + + if ast is not None: + ast, _, context, errors = check_semantics(ast, Scope(), Context(), []) + + if not errors and not parser.contains_errors: + try: + Executor(context).visit(ast, Scope()) + typer.echo('Program finished...') + except ExecutionError as e: + typer.echo(e.text, err=True) + + for error in errors: + typer.echo(error, err=True) + + +@app.command() +def serialize(): + serialize_parser_and_lexer() + + cwd = os.getcwd() + + lexertab = os.path.join(cwd, 'lexertab.py') + parsertab = os.path.join(cwd, 'parsertab.py') + + cool_lexertab = Path(os.path.join(cwd, 'cool', 'lexertab.py')) + cool_parsertab = Path(os.path.join(cwd, 'cool', 'parsertab.py')) + + mode = 'w' if cool_lexertab.exists() else 'x' + fr = open(lexertab, 'r') + with cool_lexertab.open(mode) as fw: + fw.write(fr.read().replace('from grammar', 'from cool.grammar')) + fr.close() + + mode = 'w' if cool_parsertab.exists() else 'x' + fr = open(parsertab, 'r') + with cool_parsertab.open(mode) as fw: + fw.write(fr.read().replace('from grammar', 'from cool.grammar')) + fr.close() + + os.remove(lexertab) + os.remove(parsertab) + + +if __name__ == '__main__': + app() diff --git a/src/cool/code_generation/base.py b/src/cool/code_generation/base.py index 530a4be33..943acb94e 100644 --- a/src/cool/code_generation/base.py +++ b/src/cool/code_generation/base.py @@ -1,55 +1,55 @@ -import cool.code_generation.cil as cil - -class BaseCOOLToCILVisitor: - def __init__(self, context): - self.dottypes = [] - self.dotdata = [] - self.dotcode = [] - self.current_type = None - self.current_method = None - self.current_function = None - self.context = context - - @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_local(self, var_name): - name = f'local_{self.current_function.name[9:]}_{var_name}_{len(self.localvars)}' - local_node = cil.LocalNode(name) - 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) - return instruction - - def to_function_name(self, method_name, type_name): - return f'function_{method_name}_at_{type_name}' - - def register_function(self, function_name): - function_node = cil.FunctionNode(function_name, [], [], []) - self.dotcode.append(function_node) - return function_node - - def register_type(self, name): - type_node = cil.TypeNode(name) - self.dottypes.append(type_node) - return type_node - - def register_data(self, value): - vname = f'data_{len(self.dotdata)}' - data_node = cil.DataNode(vname, value) - self.dotdata.append(data_node) - return data_node \ No newline at end of file +import cool.code_generation.cil as cil + +class BaseCOOLToCILVisitor: + def __init__(self, context): + self.dottypes = [] + self.dotdata = [] + self.dotcode = [] + self.current_type = None + self.current_method = None + self.current_function = None + self.context = context + + @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_local(self, var_name): + name = f'local_{self.current_function.name[9:]}_{var_name}_{len(self.localvars)}' + local_node = cil.LocalNode(name) + 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) + return instruction + + def to_function_name(self, method_name, type_name): + return f'function_{method_name}_at_{type_name}' + + def register_function(self, function_name): + function_node = cil.FunctionNode(function_name, [], [], []) + self.dotcode.append(function_node) + return function_node + + def register_type(self, name): + type_node = cil.TypeNode(name) + self.dottypes.append(type_node) + return type_node + + def register_data(self, value): + vname = f'data_{len(self.dotdata)}' + data_node = cil.DataNode(vname, value) + self.dotdata.append(data_node) + return data_node diff --git a/src/cool/code_generation/cil.py b/src/cool/code_generation/cil.py index 72add09d8..aa1c212d6 100644 --- a/src/cool/code_generation/cil.py +++ b/src/cool/code_generation/cil.py @@ -1,230 +1,230 @@ -import cool.visitor as visitor - - -class Node: - pass - -class ProgramNode(Node): - def __init__(self, dottypes, dotdata, dotcode): - self.dottypes = dottypes - self.dotdata = dotdata - self.dotcode = dotcode - -class TypeNode(Node): - def __init__(self, name): - self.name = name - self.attributes = [] - self.methods = [] - -class DataNode(Node): - def __init__(self, vname, value): - self.name = vname - self.value = value - -class FunctionNode(Node): - def __init__(self, fname, params, localvars, instructions): - self.name = fname - self.params = params - self.localvars = localvars - self.instructions = instructions - -class ParamNode(Node): - def __init__(self, name): - self.name = name - -class LocalNode(Node): - def __init__(self, name): - self.name = name - -class InstructionNode(Node): - pass - -class AssignNode(InstructionNode): - def __init__(self, dest, source): - self.dest = dest - self.source = source - -class ArithmeticNode(InstructionNode): - def __init__(self, dest, left, right): - self.dest = dest - self.left = left - self.right = right - -class PlusNode(ArithmeticNode): - pass - -class MinusNode(ArithmeticNode): - pass - -class StarNode(ArithmeticNode): - pass - -class DivNode(ArithmeticNode): - pass - -class GetAttribNode(InstructionNode): - pass - -class SetAttribNode(InstructionNode): - pass - -class GetIndexNode(InstructionNode): - pass - -class SetIndexNode(InstructionNode): - pass - -class AllocateNode(InstructionNode): - def __init__(self, itype, dest): - self.type = itype - self.dest = dest - -class ArrayNode(InstructionNode): - pass - -class TypeOfNode(InstructionNode): - def __init__(self, obj, dest): - self.obj = obj - self.dest = dest - -class LabelNode(InstructionNode): - pass - -class GotoNode(InstructionNode): - pass - -class GotoIfNode(InstructionNode): - pass - -class StaticCallNode(InstructionNode): - def __init__(self, function, dest): - self.function = function - self.dest = dest - -class DynamicCallNode(InstructionNode): - def __init__(self, xtype, method, dest): - self.type = xtype - self.method = method - self.dest = dest - -class ArgNode(InstructionNode): - def __init__(self, name): - self.name = name - -class ReturnNode(InstructionNode): - def __init__(self, value=None): - self.value = value - -class LoadNode(InstructionNode): - def __init__(self, dest, msg): - self.dest = dest - self.msg = msg - -class LengthNode(InstructionNode): - pass - -class ConcatNode(InstructionNode): - pass - -class PrefixNode(InstructionNode): - pass - -class SubstringNode(InstructionNode): - pass - -class ToStrNode(InstructionNode): - def __init__(self, dest, ivalue): - self.dest = dest - self.ivalue = ivalue - -class ReadNode(InstructionNode): - def __init__(self, dest): - self.dest = dest - -class PrintNode(InstructionNode): - def __init__(self, str_addr): - self.str_addr = str_addr - -def get_formatter(): - class PrintVisitor(object): - @visitor.on('node') - def visit(self, node): - pass - - @visitor.when(ProgramNode) - def visit(self, node): - 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): - attributes = '\n\t'.join(f'attribute {x}' for x 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): - 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(ParamNode) - def visit(self, node): - return f'PARAM {node.name}' - - @visitor.when(LocalNode) - def visit(self, node): - return f'LOCAL {node.name}' - - @visitor.when(AssignNode) - def visit(self, node): - return f'{node.dest} = {node.source}' - - @visitor.when(PlusNode) - def visit(self, node): - return f'{node.dest} = {node.left} + {node.right}' - - @visitor.when(MinusNode) - def visit(self, node): - return f'{node.dest} = {node.left} - {node.right}' - - @visitor.when(StarNode) - def visit(self, node): - return f'{node.dest} = {node.left} * {node.right}' - - @visitor.when(DivNode) - def visit(self, node): - return f'{node.dest} = {node.left} / {node.right}' - - @visitor.when(AllocateNode) - def visit(self, node): - return f'{node.dest} = ALLOCATE {node.type}' - - @visitor.when(TypeOfNode) - def visit(self, node): - return f'{node.dest} = TYPEOF {node.type}' - - @visitor.when(StaticCallNode) - def visit(self, node): - return f'{node.dest} = CALL {node.function}' - - @visitor.when(DynamicCallNode) - def visit(self, node): - return f'{node.dest} = VCALL {node.type} {node.method}' - - @visitor.when(ArgNode) - def visit(self, node): - return f'ARG {node.name}' - - @visitor.when(ReturnNode) - def visit(self, node): - return f'RETURN {node.value if node.value is not None else ""}' - - printer = PrintVisitor() +import cool.visitor as visitor + + +class Node: + pass + +class ProgramNode(Node): + def __init__(self, dottypes, dotdata, dotcode): + self.dottypes = dottypes + self.dotdata = dotdata + self.dotcode = dotcode + +class TypeNode(Node): + def __init__(self, name): + self.name = name + self.attributes = [] + self.methods = [] + +class DataNode(Node): + def __init__(self, vname, value): + self.name = vname + self.value = value + +class FunctionNode(Node): + def __init__(self, fname, params, localvars, instructions): + self.name = fname + self.params = params + self.localvars = localvars + self.instructions = instructions + +class ParamNode(Node): + def __init__(self, name): + self.name = name + +class LocalNode(Node): + def __init__(self, name): + self.name = name + +class InstructionNode(Node): + pass + +class AssignNode(InstructionNode): + def __init__(self, dest, source): + self.dest = dest + self.source = source + +class ArithmeticNode(InstructionNode): + def __init__(self, dest, left, right): + self.dest = dest + self.left = left + self.right = right + +class PlusNode(ArithmeticNode): + pass + +class MinusNode(ArithmeticNode): + pass + +class StarNode(ArithmeticNode): + pass + +class DivNode(ArithmeticNode): + pass + +class GetAttribNode(InstructionNode): + pass + +class SetAttribNode(InstructionNode): + pass + +class GetIndexNode(InstructionNode): + pass + +class SetIndexNode(InstructionNode): + pass + +class AllocateNode(InstructionNode): + def __init__(self, itype, dest): + self.type = itype + self.dest = dest + +class ArrayNode(InstructionNode): + pass + +class TypeOfNode(InstructionNode): + def __init__(self, obj, dest): + self.obj = obj + self.dest = dest + +class LabelNode(InstructionNode): + pass + +class GotoNode(InstructionNode): + pass + +class GotoIfNode(InstructionNode): + pass + +class StaticCallNode(InstructionNode): + def __init__(self, function, dest): + self.function = function + self.dest = dest + +class DynamicCallNode(InstructionNode): + def __init__(self, xtype, method, dest): + self.type = xtype + self.method = method + self.dest = dest + +class ArgNode(InstructionNode): + def __init__(self, name): + self.name = name + +class ReturnNode(InstructionNode): + def __init__(self, value=None): + self.value = value + +class LoadNode(InstructionNode): + def __init__(self, dest, msg): + self.dest = dest + self.msg = msg + +class LengthNode(InstructionNode): + pass + +class ConcatNode(InstructionNode): + pass + +class PrefixNode(InstructionNode): + pass + +class SubstringNode(InstructionNode): + pass + +class ToStrNode(InstructionNode): + def __init__(self, dest, ivalue): + self.dest = dest + self.ivalue = ivalue + +class ReadNode(InstructionNode): + def __init__(self, dest): + self.dest = dest + +class PrintNode(InstructionNode): + def __init__(self, str_addr): + self.str_addr = str_addr + +def get_formatter(): + class PrintVisitor(object): + @visitor.on('node') + def visit(self, node): + pass + + @visitor.when(ProgramNode) + def visit(self, node): + 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): + attributes = '\n\t'.join(f'attribute {x}' for x 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): + 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(ParamNode) + def visit(self, node): + return f'PARAM {node.name}' + + @visitor.when(LocalNode) + def visit(self, node): + return f'LOCAL {node.name}' + + @visitor.when(AssignNode) + def visit(self, node): + return f'{node.dest} = {node.source}' + + @visitor.when(PlusNode) + def visit(self, node): + return f'{node.dest} = {node.left} + {node.right}' + + @visitor.when(MinusNode) + def visit(self, node): + return f'{node.dest} = {node.left} - {node.right}' + + @visitor.when(StarNode) + def visit(self, node): + return f'{node.dest} = {node.left} * {node.right}' + + @visitor.when(DivNode) + def visit(self, node): + return f'{node.dest} = {node.left} / {node.right}' + + @visitor.when(AllocateNode) + def visit(self, node): + return f'{node.dest} = ALLOCATE {node.type}' + + @visitor.when(TypeOfNode) + def visit(self, node): + return f'{node.dest} = TYPEOF {node.type}' + + @visitor.when(StaticCallNode) + def visit(self, node): + return f'{node.dest} = CALL {node.function}' + + @visitor.when(DynamicCallNode) + def visit(self, node): + return f'{node.dest} = VCALL {node.type} {node.method}' + + @visitor.when(ArgNode) + def visit(self, node): + return f'ARG {node.name}' + + @visitor.when(ReturnNode) + def visit(self, node): + return f'RETURN {node.value if node.value is not None else ""}' + + printer = PrintVisitor() return (lambda ast: printer.visit(ast)) \ No newline at end of file diff --git a/src/cool/grammar.py b/src/cool/grammar.py index eda8e7d42..880e69cc9 100644 --- a/src/cool/grammar.py +++ b/src/cool/grammar.py @@ -1,352 +1,352 @@ -import inspect -import time - -from pyjapt import Grammar, Lexer - -import cool.semantics.utils.astnodes as ast - -G = Grammar() - -################# -# Non-Terminals # -################# -program = G.add_non_terminal('program', start_symbol=True) -class_list = G.add_non_terminal('class-list') -class_def = G.add_non_terminal('class-def') -feature_list = G.add_non_terminal('feature-list') -attribute = G.add_non_terminal('attribute') -method = G.add_non_terminal('method') -param_list = G.add_non_terminal('param-list') -block = G.add_non_terminal('block') -declaration_list = G.add_non_terminal('declaration-list') -case_list = G.add_non_terminal('case-list') -function_call = G.add_non_terminal('function-call') -expr_list = G.add_non_terminal('expr-list') -not_empty_expr_list = G.add_non_terminal('not-empty-expr-list') -expr = G.add_non_terminal('expr') -comp = G.add_non_terminal('comp') -arith = G.add_non_terminal('arith') -term = G.add_non_terminal('term') -factor = G.add_non_terminal('factor') -atom = G.add_non_terminal('atom') - -########### -# Symbols # -########### -G.add_terminals('{ } ( ) . , : ; @ <- =>') - -############ -# Keywords # -############ -keywords = G.add_terminals( - 'class inherits if then else fi while loop pool let in case of esac new isvoid true false not') -keywords_names = {x.name for x in keywords} - -############# -# Symbols # -############# -G.add_terminals('+ - * / < <= = ~') - - -############### -# Identifiers # -############### -@G.terminal('id', r'[a-z][a-zA-Z0-9_]*') -def id_terminal(lexer): - lexer.column += len(lexer.token.lex) - lexer.position += len(lexer.token.lex) - lexer.token.token_type = lexer.token.lex if lexer.token.lex in keywords_names else lexer.token.token_type - return lexer.token - - -G.add_terminal('type', regex=r'[A-Z][a-zA-Z0-9_]*') - -############### -# Basic Types # -############### -G.add_terminal('int', regex=r'\d+') - - -@G.terminal('string', regex=r'\"') -def string(lexer: Lexer): - text = lexer.text - pos = lexer.position + 1 - lexer.column += 1 - lex = '\"' - - contains_null_character = False - while True: - if pos >= len(text): - lexer.contain_errors = True - lexer.position = pos - lexer.add_error(lexer.lineno, lexer.column, - f'{lexer.lineno, lexer.column} - LexicographicError: EOF in string constant') - return - - s = text[pos] - - if s == '\\': - if text[pos + 1] == '\n': - lex += '\n' - pos += 2 - lexer.lineno += 1 - lexer.column = 1 - elif text[pos + 1] in ('b', 'f', 't', 'n'): - if text[pos + 1] == 'b': - lex += '\\b' - elif text[pos + 1] == 'f': - lex += '\\f' - elif text[pos + 1] == 't': - lex += '\\t' - else: - lex += '\\n' - - pos += 2 - lexer.column += 2 - else: - lex += text[pos + 1] - pos += 2 - lexer.column += 2 - elif s == '\n': - # Unterminated String - lexer.contain_errors = True - lexer.position = pos - lexer.add_error(lexer.lineno, lexer.column, - f'{lexer.lineno, lexer.column} - LexicographicError: Unterminated string constant') - return - elif s == '\0': - contains_null_character = True - lexer.contain_errors = True - lexer.add_error(lexer.lineno, lexer.column, - f'{lexer.lineno, lexer.column} - LexicographicError: String contains null character') - pos += 1 - lexer.column += 1 - else: - lex += s - pos += 1 - lexer.column += 1 - - if s == '\"': - break - - lexer.position = pos - lexer.token.lex = lex - if not contains_null_character: - return lexer.token - - -############ -# Comments # -############ -@G.terminal('single_line_comment', r'--.*') -def single_line_comment(lexer): - lex = lexer.token.lex - for s in lex: - if s == '\n': - lexer.lineno += 1 - lexer.column = 0 - lexer.column += 1 - lexer.position += len(lex) - - -@G.terminal('multi_line_comment', r'\(\*') -def multi_line_comment(lexer: Lexer): - stack = ['(*'] - text = lexer.text - pos = lexer.position + 2 - lex = '(*' - - while stack: - if pos >= len(text): - lexer.contain_errors = True - lexer.position = pos - lexer.add_error(lexer.lineno, lexer.column, - f'{lexer.lineno, lexer.column} - LexicographicError: EOF in comment') - return None - - if text.startswith('(*', pos): - stack.append('(*') - pos += 2 - lex += '(*' - lexer.column += 2 - elif text.startswith('*)', pos): - stack.pop() - pos += 2 - lex += '*)' - lexer.column += 2 - else: - if text[pos] == '\n': - lexer.lineno += 1 - lexer.column = 0 - elif text[pos] == '\t': - lexer.column += 3 - lex += text[pos] - pos += 1 - lexer.column += 1 - lexer.position = pos - lexer.token.lex = lex - - -################## -# Ignored Tokens # -################## -@G.terminal('newline', r'\n+') -def newline(lexer: Lexer): - lexer.lineno += len(lexer.token.lex) - lexer.position += len(lexer.token.lex) - lexer.column = 1 - - -@G.terminal('whitespace', r' +') -def whitespace(lexer): - lexer.column += len(lexer.token.lex) - lexer.position += len(lexer.token.lex) - - -@G.terminal('tabulation', r'\t+') -def tab(lexer): - lexer.column += 4 * len(lexer.token.lex) - lexer.position += len(lexer.token.lex) - - -@G.lexical_error -def lexical_error(lexer): - lexer.add_error(lexer.lineno, lexer.column, - f'{lexer.lineno, lexer.column} - LexicographicError: ERROR "{lexer.token.lex}"') - lexer.column += len(lexer.token.lex) - lexer.position += len(lexer.token.lex) - - -############### -# Productions # -############### -program %= 'class-list', lambda s: ast.ProgramNode(s[1]) - -class_list %= 'class-def ;', lambda s: [s[1]] -class_list %= 'class-def ; class-list', lambda s: [s[1]] + s[3] - -class_def %= 'class type { feature-list }', lambda s: ast.ClassDeclarationNode(s[2], s[4]) -class_def %= 'class type inherits type { feature-list }', lambda s: ast.ClassDeclarationNode(s[2], s[6], s[4]) - -feature_list %= '', lambda s: [] -feature_list %= 'attribute ; feature-list', lambda s: [s[1]] + s[3] -feature_list %= 'method ; feature-list', lambda s: [s[1]] + s[3] - -attribute %= 'id : type', lambda s: ast.AttrDeclarationNode(s[1], s[3]) -attribute %= 'id : type <- expr', lambda s: ast.AttrDeclarationNode(s[1], s[3], s[5]) - -method %= 'id ( ) : type { expr }', lambda s: ast.MethodDeclarationNode(s[1], [], s[5], s[7]) -method %= 'id ( param-list ) : type { expr }', lambda s: ast.MethodDeclarationNode(s[1], s[3], s[6], s[8]) - -param_list %= 'id : type', lambda s: [(s[1], s[3])] -param_list %= 'id : type , param-list', lambda s: [(s[1], s[3])] + s[5] - -expr %= 'id <- expr', lambda s: ast.AssignNode(s[1], s[3]) -expr %= '{ block }', lambda s: ast.BlockNode(s[2]) -expr %= 'if expr then expr else expr fi', lambda s: ast.ConditionalNode(s[2], s[4], s[6]) -expr %= 'while expr loop expr pool', lambda s: ast.WhileNode(s[2], s[4]) -expr %= 'let declaration-list in expr', lambda s: ast.LetNode(s[2], s[4]) -expr %= 'case expr of case-list esac', lambda s: ast.SwitchCaseNode(s[2], s[4]) -expr %= 'not expr', lambda s: ast.NegationNode(s[2]) -expr %= 'comp', lambda s: s[1] - -comp %= 'arith < arith', lambda s: ast.LessThanNode(s[1], s[2], s[3]) -comp %= 'arith <= arith', lambda s: ast.LessEqualNode(s[1], s[2], s[3]) -comp %= 'arith = arith', lambda s: ast.EqualNode(s[1], s[2], s[3]) -comp %= 'arith', lambda s: s[1] - -arith %= 'arith + term', lambda s: ast.PlusNode(s[1], s[2], s[3]) -arith %= 'arith - term', lambda s: ast.MinusNode(s[1], s[2], s[3]) -arith %= 'term', lambda s: s[1] - -term %= 'term * factor', lambda s: ast.StarNode(s[1], s[2], s[3]) -term %= 'term / factor', lambda s: ast.DivNode(s[1], s[2], s[3]) -term %= 'factor', lambda s: s[1] - -factor %= 'isvoid factor', lambda s: ast.IsVoidNode(s[2]) -factor %= '~ factor', lambda s: ast.ComplementNode(s[2]) -factor %= 'atom', lambda s: s[1] - -atom %= 'id', lambda s: ast.VariableNode(s[1]) -atom %= 'true', lambda s: ast.BooleanNode(s[1]) -atom %= 'false', lambda s: ast.BooleanNode(s[1]) -atom %= 'int', lambda s: ast.IntegerNode(s[1]) -atom %= 'string', lambda s: ast.StringNode(s[1]) -atom %= 'function-call', lambda s: s[1] -atom %= 'new type', lambda s: ast.InstantiateNode(s[2]) -atom %= '( expr )', lambda s: s[2] - -block %= 'expr ;', lambda s: [s[1]] -block %= 'expr ; block', lambda s: [s[1]] + s[3] - -declaration_list %= 'id : type', lambda s: [(s[1], s[3], None)] -declaration_list %= 'id : type <- expr', lambda s: [(s[1], s[3], s[5])] -declaration_list %= 'id : type , declaration-list', lambda s: [(s[1], s[3], None)] + s[5] -declaration_list %= 'id : type <- expr , declaration-list', lambda s: [(s[1], s[3], s[5])] + s[7] - -case_list %= 'id : type => expr ;', lambda s: [(s[1], s[3], s[5])] -case_list %= 'id : type => expr ; case-list', lambda s: [(s[1], s[3], s[5])] + s[7] - -function_call %= 'id ( expr-list )', lambda s: ast.MethodCallNode(s[1], s[3]) -function_call %= 'atom . id ( expr-list )', lambda s: ast.MethodCallNode(s[3], s[5], s[1]) -function_call %= 'atom @ type . id ( expr-list )', lambda s: ast.MethodCallNode(s[5], s[7], s[1], s[3]) - -expr_list %= '', lambda s: [] -expr_list %= 'not-empty-expr-list', lambda s: s[1] -not_empty_expr_list %= 'expr', lambda s: [s[1]] -not_empty_expr_list %= 'expr , not-empty-expr-list', lambda s: [s[1]] + s[3] - -##################### -# Error Productions # -##################### -G.add_terminal_error() - - -@G.production("feature-list -> attribute error feature-list") -def feature_attribute_error(s): - s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: ERROR at or near " + f'"{s[2].lex}"' + ".") - return [s[1]] + s[3] - - -@G.production("feature-list -> method error feature-list") -def feature_method_error(s): - s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: ERROR at or near " + f'"{s[2].lex}"' + ".") - return [s[1]] + s[3] - - -@G.production("case-list -> id : type => expr error") -def case_list_error(s): - s.add_error(6, f"{s[6].line, s[6].column} - SyntacticError: ERROR at or near " + f'"{s[6].lex}"' + ".") - return [(s[1], s[3], s[5])] - - -@G.production("case-list -> id : type => expr error case-list") -def case_list_error(s): - s.add_error(6, f"{s[6].line, s[6].column} - SyntacticError:ERROR at or near " + f'"{s[6].lex}"' + ".") - return [(s[1], s[3], s[5])] + s[7] - - -@G.production("block -> expr error") -def block_single_error(s): - s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: ERROR at or near " + f'"{s[2].lex}"' + ".") - return [s[1]] - - -@G.production("block -> expr error block") -def block_single_error(s): - s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: ERROR at or near " + f'"{s[2].lex}"' + ".") - return [s[1]] + s[3] - - -################# -# Serialize API # -################# -def serialize_parser_and_lexer(): - t = time.time() - G.serialize_lexer('CoolLexer', inspect.getmodulename(__file__)) - G.serialize_parser('lalr1', 'CoolParser', inspect.getmodulename(__file__)) - print('Serialization Time :', time.time() - t, 'seconds') - - -if __name__ == '__main__': - serialize_parser_and_lexer() +import inspect +import time + +from pyjapt import Grammar, Lexer + +import cool.semantics.utils.astnodes as ast + +G = Grammar() + +################# +# Non-Terminals # +################# +program = G.add_non_terminal('program', start_symbol=True) +class_list = G.add_non_terminal('class-list') +class_def = G.add_non_terminal('class-def') +feature_list = G.add_non_terminal('feature-list') +attribute = G.add_non_terminal('attribute') +method = G.add_non_terminal('method') +param_list = G.add_non_terminal('param-list') +block = G.add_non_terminal('block') +declaration_list = G.add_non_terminal('declaration-list') +case_list = G.add_non_terminal('case-list') +function_call = G.add_non_terminal('function-call') +expr_list = G.add_non_terminal('expr-list') +not_empty_expr_list = G.add_non_terminal('not-empty-expr-list') +expr = G.add_non_terminal('expr') +comp = G.add_non_terminal('comp') +arith = G.add_non_terminal('arith') +term = G.add_non_terminal('term') +factor = G.add_non_terminal('factor') +atom = G.add_non_terminal('atom') + +########### +# Symbols # +########### +G.add_terminals('{ } ( ) . , : ; @ <- =>') + +############ +# Keywords # +############ +keywords = G.add_terminals( + 'class inherits if then else fi while loop pool let in case of esac new isvoid true false not') +keywords_names = {x.name for x in keywords} + +############# +# Symbols # +############# +G.add_terminals('+ - * / < <= = ~') + + +############### +# Identifiers # +############### +@G.terminal('id', r'[a-z][a-zA-Z0-9_]*') +def id_terminal(lexer): + lexer.column += len(lexer.token.lex) + lexer.position += len(lexer.token.lex) + lexer.token.token_type = lexer.token.lex if lexer.token.lex in keywords_names else lexer.token.token_type + return lexer.token + + +G.add_terminal('type', regex=r'[A-Z][a-zA-Z0-9_]*') + +############### +# Basic Types # +############### +G.add_terminal('int', regex=r'\d+') + + +@G.terminal('string', regex=r'\"') +def string(lexer: Lexer): + text = lexer.text + pos = lexer.position + 1 + lexer.column += 1 + lex = '\"' + + contains_null_character = False + while True: + if pos >= len(text): + lexer.contain_errors = True + lexer.position = pos + lexer.add_error(lexer.lineno, lexer.column, + f'{lexer.lineno, lexer.column} - LexicographicError: EOF in string constant') + return + + s = text[pos] + + if s == '\\': + if text[pos + 1] == '\n': + lex += '\n' + pos += 2 + lexer.lineno += 1 + lexer.column = 1 + elif text[pos + 1] in ('b', 'f', 't', 'n'): + if text[pos + 1] == 'b': + lex += '\\b' + elif text[pos + 1] == 'f': + lex += '\\f' + elif text[pos + 1] == 't': + lex += '\\t' + else: + lex += '\\n' + + pos += 2 + lexer.column += 2 + else: + lex += text[pos + 1] + pos += 2 + lexer.column += 2 + elif s == '\n': + # Unterminated String + lexer.contain_errors = True + lexer.position = pos + lexer.add_error(lexer.lineno, lexer.column, + f'{lexer.lineno, lexer.column} - LexicographicError: Unterminated string constant') + return + elif s == '\0': + contains_null_character = True + lexer.contain_errors = True + lexer.add_error(lexer.lineno, lexer.column, + f'{lexer.lineno, lexer.column} - LexicographicError: String contains null character') + pos += 1 + lexer.column += 1 + else: + lex += s + pos += 1 + lexer.column += 1 + + if s == '\"': + break + + lexer.position = pos + lexer.token.lex = lex + if not contains_null_character: + return lexer.token + + +############ +# Comments # +############ +@G.terminal('single_line_comment', r'--.*') +def single_line_comment(lexer): + lex = lexer.token.lex + for s in lex: + if s == '\n': + lexer.lineno += 1 + lexer.column = 0 + lexer.column += 1 + lexer.position += len(lex) + + +@G.terminal('multi_line_comment', r'\(\*') +def multi_line_comment(lexer: Lexer): + counter = 1 + text = lexer.text + pos = lexer.position + 2 + lex = '(*' + + while counter > 1: + if pos >= len(text): + lexer.contain_errors = True + lexer.position = pos + lexer.add_error(lexer.lineno, lexer.column, + f'{lexer.lineno, lexer.column} - LexicographicError: EOF in comment') + return None + + if text.startswith('(*', pos): + counter += 1 + pos += 2 + lex += '(*' + lexer.column += 2 + elif text.startswith('*)', pos): + counter -= 1 + pos += 2 + lex += '*)' + lexer.column += 2 + else: + if text[pos] == '\n': + lexer.lineno += 1 + lexer.column = 0 + elif text[pos] == '\t': + lexer.column += 3 + lex += text[pos] + pos += 1 + lexer.column += 1 + lexer.position = pos + lexer.token.lex = lex + + +################## +# Ignored Tokens # +################## +@G.terminal('newline', r'\n+') +def newline(lexer: Lexer): + lexer.lineno += len(lexer.token.lex) + lexer.position += len(lexer.token.lex) + lexer.column = 1 + + +@G.terminal('whitespace', r' +') +def whitespace(lexer): + lexer.column += len(lexer.token.lex) + lexer.position += len(lexer.token.lex) + + +@G.terminal('tabulation', r'\t+') +def tab(lexer): + lexer.column += 4 * len(lexer.token.lex) + lexer.position += len(lexer.token.lex) + + +@G.lexical_error +def lexical_error(lexer): + lexer.add_error(lexer.lineno, lexer.column, + f'{lexer.lineno, lexer.column} - LexicographicError: ERROR "{lexer.token.lex}"') + lexer.column += len(lexer.token.lex) + lexer.position += len(lexer.token.lex) + + +############### +# Productions # +############### +program %= 'class-list', lambda s: ast.ProgramNode(s[1]) + +class_list %= 'class-def ;', lambda s: [s[1]] +class_list %= 'class-def ; class-list', lambda s: [s[1]] + s[3] + +class_def %= 'class type { feature-list }', lambda s: ast.ClassDeclarationNode(s[2], s[4]) +class_def %= 'class type inherits type { feature-list }', lambda s: ast.ClassDeclarationNode(s[2], s[6], s[4]) + +feature_list %= '', lambda s: [] +feature_list %= 'attribute ; feature-list', lambda s: [s[1]] + s[3] +feature_list %= 'method ; feature-list', lambda s: [s[1]] + s[3] + +attribute %= 'id : type', lambda s: ast.AttrDeclarationNode(s[1], s[3]) +attribute %= 'id : type <- expr', lambda s: ast.AttrDeclarationNode(s[1], s[3], s[5]) + +method %= 'id ( ) : type { expr }', lambda s: ast.MethodDeclarationNode(s[1], [], s[5], s[7]) +method %= 'id ( param-list ) : type { expr }', lambda s: ast.MethodDeclarationNode(s[1], s[3], s[6], s[8]) + +param_list %= 'id : type', lambda s: [(s[1], s[3])] +param_list %= 'id : type , param-list', lambda s: [(s[1], s[3])] + s[5] + +expr %= 'id <- expr', lambda s: ast.AssignNode(s[1], s[3]) +expr %= '{ block }', lambda s: ast.BlockNode(s[2]) +expr %= 'if expr then expr else expr fi', lambda s: ast.ConditionalNode(s[2], s[4], s[6]) +expr %= 'while expr loop expr pool', lambda s: ast.WhileNode(s[2], s[4]) +expr %= 'let declaration-list in expr', lambda s: ast.LetNode(s[2], s[4]) +expr %= 'case expr of case-list esac', lambda s: ast.SwitchCaseNode(s[2], s[4]) +expr %= 'not expr', lambda s: ast.NegationNode(s[2]) +expr %= 'comp', lambda s: s[1] + +comp %= 'arith < arith', lambda s: ast.LessThanNode(s[1], s[2], s[3]) +comp %= 'arith <= arith', lambda s: ast.LessEqualNode(s[1], s[2], s[3]) +comp %= 'arith = arith', lambda s: ast.EqualNode(s[1], s[2], s[3]) +comp %= 'arith', lambda s: s[1] + +arith %= 'arith + term', lambda s: ast.PlusNode(s[1], s[2], s[3]) +arith %= 'arith - term', lambda s: ast.MinusNode(s[1], s[2], s[3]) +arith %= 'term', lambda s: s[1] + +term %= 'term * factor', lambda s: ast.StarNode(s[1], s[2], s[3]) +term %= 'term / factor', lambda s: ast.DivNode(s[1], s[2], s[3]) +term %= 'factor', lambda s: s[1] + +factor %= 'isvoid factor', lambda s: ast.IsVoidNode(s[2]) +factor %= '~ factor', lambda s: ast.ComplementNode(s[2]) +factor %= 'atom', lambda s: s[1] + +atom %= 'id', lambda s: ast.VariableNode(s[1]) +atom %= 'true', lambda s: ast.BooleanNode(s[1]) +atom %= 'false', lambda s: ast.BooleanNode(s[1]) +atom %= 'int', lambda s: ast.IntegerNode(s[1]) +atom %= 'string', lambda s: ast.StringNode(s[1]) +atom %= 'function-call', lambda s: s[1] +atom %= 'new type', lambda s: ast.InstantiateNode(s[2]) +atom %= '( expr )', lambda s: s[2] + +block %= 'expr ;', lambda s: [s[1]] +block %= 'expr ; block', lambda s: [s[1]] + s[3] + +declaration_list %= 'id : type', lambda s: [(s[1], s[3], None)] +declaration_list %= 'id : type <- expr', lambda s: [(s[1], s[3], s[5])] +declaration_list %= 'id : type , declaration-list', lambda s: [(s[1], s[3], None)] + s[5] +declaration_list %= 'id : type <- expr , declaration-list', lambda s: [(s[1], s[3], s[5])] + s[7] + +case_list %= 'id : type => expr ;', lambda s: [(s[1], s[3], s[5])] +case_list %= 'id : type => expr ; case-list', lambda s: [(s[1], s[3], s[5])] + s[7] + +function_call %= 'id ( expr-list )', lambda s: ast.MethodCallNode(s[1], s[3]) +function_call %= 'atom . id ( expr-list )', lambda s: ast.MethodCallNode(s[3], s[5], s[1]) +function_call %= 'atom @ type . id ( expr-list )', lambda s: ast.MethodCallNode(s[5], s[7], s[1], s[3]) + +expr_list %= '', lambda s: [] +expr_list %= 'not-empty-expr-list', lambda s: s[1] +not_empty_expr_list %= 'expr', lambda s: [s[1]] +not_empty_expr_list %= 'expr , not-empty-expr-list', lambda s: [s[1]] + s[3] + +##################### +# Error Productions # +##################### +G.add_terminal_error() + + +@G.production("feature-list -> attribute error feature-list") +def feature_attribute_error(s): + s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: ERROR at or near " + f'"{s[2].lex}"' + ".") + return [s[1]] + s[3] + + +@G.production("feature-list -> method error feature-list") +def feature_method_error(s): + s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: ERROR at or near " + f'"{s[2].lex}"' + ".") + return [s[1]] + s[3] + + +@G.production("case-list -> id : type => expr error") +def case_list_error(s): + s.add_error(6, f"{s[6].line, s[6].column} - SyntacticError: ERROR at or near " + f'"{s[6].lex}"' + ".") + return [(s[1], s[3], s[5])] + + +@G.production("case-list -> id : type => expr error case-list") +def case_list_error(s): + s.add_error(6, f"{s[6].line, s[6].column} - SyntacticError:ERROR at or near " + f'"{s[6].lex}"' + ".") + return [(s[1], s[3], s[5])] + s[7] + + +@G.production("block -> expr error") +def block_single_error(s): + s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: ERROR at or near " + f'"{s[2].lex}"' + ".") + return [s[1]] + + +@G.production("block -> expr error block") +def block_single_error(s): + s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: ERROR at or near " + f'"{s[2].lex}"' + ".") + return [s[1]] + s[3] + + +################# +# Serialize API # +################# +def serialize_parser_and_lexer(): + t = time.time() + G.serialize_lexer('CoolLexer', inspect.getmodulename(__file__)) + G.serialize_parser('lalr1', 'CoolParser', inspect.getmodulename(__file__)) + print('Serialization Time :', time.time() - t, 'seconds') + + +if __name__ == '__main__': + serialize_parser_and_lexer() diff --git a/src/cool/lexertab.py b/src/cool/lexertab.py index dfa2f5eaa..b689f5888 100644 --- a/src/cool/lexertab.py +++ b/src/cool/lexertab.py @@ -1,21 +1,21 @@ -import re - -from pyjapt import Token, Lexer -from cool.grammar import G - - -class CoolLexer(Lexer): - def __init__(self): - self.lineno = 1 - self.column = 1 - self.position = 0 - self.token = Token('', '', 0, 0) - self.pattern = re.compile(r'(?P[a-z][a-zA-Z0-9_]*)|(?P\")|(?P--.*)|(?P\(\*)|(?P\n+)|(?P +)|(?P\t+)|(?P[A-Z][a-zA-Z0-9_]*)|(?P\d+)|(inherits)|(isvoid)|(class)|(while)|(false)|(then)|(else)|(loop)|(pool)|(case)|(esac)|(true)|(<\-)|(let)|(new)|(not)|(\{)|(\})|(\()|(\))|(\.)|(=>)|(if)|(fi)|(in)|(of)|(\+)|(\-)|(\*)|(<=)|(\~)|(,)|(:)|(;)|(@)|(/)|(<)|(=)') - self.token_rules = {key: rule for key, (_, _, rule) in G.terminal_rules.items() if rule is not None} - self.error_handler = G.lexical_error_handler if G.lexical_error_handler is not None else self.error - self._errors = [] - self.contain_errors = False - self.eof = '$' - - def __call__(self, text): - return [Token(t.lex, G[t.token_type], t.line, t.column) for t in self.tokenize(text)] +import re + +from pyjapt import Token, Lexer +from cool.grammar import G + + +class CoolLexer(Lexer): + def __init__(self): + self.lineno = 1 + self.column = 1 + self.position = 0 + self.token = Token('', '', 0, 0) + self.pattern = re.compile(r'(?P[a-z][a-zA-Z0-9_]*)|(?P\")|(?P--.*)|(?P\(\*)|(?P\n+)|(?P +)|(?P\t+)|(?P[A-Z][a-zA-Z0-9_]*)|(?P\d+)|(inherits)|(isvoid)|(class)|(while)|(false)|(then)|(else)|(loop)|(pool)|(case)|(esac)|(true)|(<\-)|(let)|(new)|(not)|(\{)|(\})|(\()|(\))|(\.)|(=>)|(if)|(fi)|(in)|(of)|(\+)|(\-)|(\*)|(<=)|(\~)|(,)|(:)|(;)|(@)|(/)|(<)|(=)') + self.token_rules = {key: rule for key, (_, _, rule) in G.terminal_rules.items() if rule is not None} + self.error_handler = G.lexical_error_handler if G.lexical_error_handler is not None else self.error + self._errors = [] + self.contain_errors = False + self.eof = '$' + + def __call__(self, text): + return [Token(t.lex, G[t.token_type], t.line, t.column) for t in self.tokenize(text)] diff --git a/src/cool/parsertab.py b/src/cool/parsertab.py index f295712d3..fd092dd6e 100644 --- a/src/cool/parsertab.py +++ b/src/cool/parsertab.py @@ -1,1368 +1,1368 @@ -from abc import ABC -from pyjapt import ShiftReduceParser -from cool.grammar import G - - -class CoolParser(ShiftReduceParser, ABC): - def __init__(self, verbose=False): - self.grammar = G - self.verbose = verbose - self.action = self.__action_table() - self.goto = self.__goto_table() - self._errors = [] - - @staticmethod - def __action_table(): - return { - (0, G["class"]): ("SHIFT", 1), - (1, G["type"]): ("SHIFT", 2), - (2, G["inherits"]): ("SHIFT", 145), - (2, G["{"]): ("SHIFT", 3), - (3, G["}"]): ("REDUCE", G["feature-list -> e"]), - (3, G["id"]): ("SHIFT", 4), - (4, G["("]): ("SHIFT", 5), - (4, G[":"]): ("SHIFT", 129), - (5, G[")"]): ("SHIFT", 6), - (5, G["id"]): ("SHIFT", 117), - (6, G[":"]): ("SHIFT", 7), - (7, G["type"]): ("SHIFT", 8), - (8, G["{"]): ("SHIFT", 9), - (9, G["while"]): ("SHIFT", 13), - (9, G["~"]): ("SHIFT", 27), - (9, G["isvoid"]): ("SHIFT", 24), - (9, G["{"]): ("SHIFT", 10), - (9, G["if"]): ("SHIFT", 12), - (9, G["not"]): ("SHIFT", 30), - (9, G["new"]): ("SHIFT", 22), - (9, G["("]): ("SHIFT", 11), - (9, G["string"]): ("SHIFT", 34), - (9, G["int"]): ("SHIFT", 33), - (9, G["false"]): ("SHIFT", 26), - (9, G["id"]): ("SHIFT", 31), - (9, G["let"]): ("SHIFT", 14), - (9, G["true"]): ("SHIFT", 25), - (9, G["case"]): ("SHIFT", 21), - (10, G["int"]): ("SHIFT", 33), - (10, G["case"]): ("SHIFT", 21), - (10, G["false"]): ("SHIFT", 26), - (10, G["while"]): ("SHIFT", 13), - (10, G["true"]): ("SHIFT", 25), - (10, G["id"]): ("SHIFT", 31), - (10, G["{"]): ("SHIFT", 10), - (10, G["if"]): ("SHIFT", 12), - (10, G["not"]): ("SHIFT", 30), - (10, G["~"]): ("SHIFT", 27), - (10, G["new"]): ("SHIFT", 22), - (10, G["("]): ("SHIFT", 11), - (10, G["isvoid"]): ("SHIFT", 24), - (10, G["string"]): ("SHIFT", 34), - (10, G["let"]): ("SHIFT", 14), - (11, G["case"]): ("SHIFT", 21), - (11, G["while"]): ("SHIFT", 13), - (11, G["{"]): ("SHIFT", 10), - (11, G["if"]): ("SHIFT", 12), - (11, G["not"]): ("SHIFT", 30), - (11, G["new"]): ("SHIFT", 22), - (11, G["("]): ("SHIFT", 11), - (11, G["string"]): ("SHIFT", 34), - (11, G["int"]): ("SHIFT", 33), - (11, G["false"]): ("SHIFT", 26), - (11, G["~"]): ("SHIFT", 27), - (11, G["id"]): ("SHIFT", 31), - (11, G["true"]): ("SHIFT", 25), - (11, G["isvoid"]): ("SHIFT", 24), - (11, G["let"]): ("SHIFT", 14), - (12, G["while"]): ("SHIFT", 13), - (12, G["{"]): ("SHIFT", 10), - (12, G["if"]): ("SHIFT", 12), - (12, G["~"]): ("SHIFT", 27), - (12, G["not"]): ("SHIFT", 30), - (12, G["new"]): ("SHIFT", 22), - (12, G["isvoid"]): ("SHIFT", 24), - (12, G["("]): ("SHIFT", 11), - (12, G["string"]): ("SHIFT", 34), - (12, G["int"]): ("SHIFT", 33), - (12, G["false"]): ("SHIFT", 26), - (12, G["id"]): ("SHIFT", 31), - (12, G["true"]): ("SHIFT", 25), - (12, G["let"]): ("SHIFT", 14), - (12, G["case"]): ("SHIFT", 21), - (13, G["id"]): ("SHIFT", 31), - (13, G["let"]): ("SHIFT", 14), - (13, G["~"]): ("SHIFT", 27), - (13, G["new"]): ("SHIFT", 22), - (13, G["case"]): ("SHIFT", 21), - (13, G["while"]): ("SHIFT", 13), - (13, G["("]): ("SHIFT", 11), - (13, G["string"]): ("SHIFT", 34), - (13, G["isvoid"]): ("SHIFT", 24), - (13, G["int"]): ("SHIFT", 33), - (13, G["{"]): ("SHIFT", 10), - (13, G["if"]): ("SHIFT", 12), - (13, G["false"]): ("SHIFT", 26), - (13, G["not"]): ("SHIFT", 30), - (13, G["true"]): ("SHIFT", 25), - (14, G["id"]): ("SHIFT", 15), - (15, G[":"]): ("SHIFT", 16), - (16, G["type"]): ("SHIFT", 17), - (17, G["<-"]): ("SHIFT", 20), - (17, G[","]): ("SHIFT", 18), - (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), - (18, G["id"]): ("SHIFT", 15), - (19, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), - (20, G["case"]): ("SHIFT", 21), - (20, G["false"]): ("SHIFT", 26), - (20, G["true"]): ("SHIFT", 25), - (20, G["while"]): ("SHIFT", 13), - (20, G["id"]): ("SHIFT", 31), - (20, G["{"]): ("SHIFT", 10), - (20, G["if"]): ("SHIFT", 12), - (20, G["not"]): ("SHIFT", 30), - (20, G["~"]): ("SHIFT", 27), - (20, G["new"]): ("SHIFT", 22), - (20, G["isvoid"]): ("SHIFT", 24), - (20, G["("]): ("SHIFT", 11), - (20, G["string"]): ("SHIFT", 34), - (20, G["let"]): ("SHIFT", 14), - (20, G["int"]): ("SHIFT", 33), - (21, G["int"]): ("SHIFT", 33), - (21, G["~"]): ("SHIFT", 27), - (21, G["false"]): ("SHIFT", 26), - (21, G["case"]): ("SHIFT", 21), - (21, G["true"]): ("SHIFT", 25), - (21, G["isvoid"]): ("SHIFT", 24), - (21, G["while"]): ("SHIFT", 13), - (21, G["id"]): ("SHIFT", 31), - (21, G["{"]): ("SHIFT", 10), - (21, G["if"]): ("SHIFT", 12), - (21, G["not"]): ("SHIFT", 30), - (21, G["new"]): ("SHIFT", 22), - (21, G["("]): ("SHIFT", 11), - (21, G["string"]): ("SHIFT", 34), - (21, G["let"]): ("SHIFT", 14), - (22, G["type"]): ("SHIFT", 23), - (23, G["/"]): ("REDUCE", G["atom -> new type"]), - (23, G["of"]): ("REDUCE", G["atom -> new type"]), - (23, G["<"]): ("REDUCE", G["atom -> new type"]), - (23, G[")"]): ("REDUCE", G["atom -> new type"]), - (23, G["then"]): ("REDUCE", G["atom -> new type"]), - (23, G["<="]): ("REDUCE", G["atom -> new type"]), - (23, G["."]): ("REDUCE", G["atom -> new type"]), - (23, G["else"]): ("REDUCE", G["atom -> new type"]), - (23, G["="]): ("REDUCE", G["atom -> new type"]), - (23, G[","]): ("REDUCE", G["atom -> new type"]), - (23, G["fi"]): ("REDUCE", G["atom -> new type"]), - (23, G[";"]): ("REDUCE", G["atom -> new type"]), - (23, G["in"]): ("REDUCE", G["atom -> new type"]), - (23, G["loop"]): ("REDUCE", G["atom -> new type"]), - (23, G["@"]): ("REDUCE", G["atom -> new type"]), - (23, G["pool"]): ("REDUCE", G["atom -> new type"]), - (23, G["+"]): ("REDUCE", G["atom -> new type"]), - (23, G["error"]): ("REDUCE", G["atom -> new type"]), - (23, G["-"]): ("REDUCE", G["atom -> new type"]), - (23, G["*"]): ("REDUCE", G["atom -> new type"]), - (23, G["}"]): ("REDUCE", G["atom -> new type"]), - (24, G["false"]): ("SHIFT", 26), - (24, G["~"]): ("SHIFT", 27), - (24, G["true"]): ("SHIFT", 25), - (24, G["new"]): ("SHIFT", 22), - (24, G["int"]): ("SHIFT", 33), - (24, G["id"]): ("SHIFT", 28), - (24, G["isvoid"]): ("SHIFT", 24), - (24, G["("]): ("SHIFT", 11), - (24, G["string"]): ("SHIFT", 34), - (25, G["/"]): ("REDUCE", G["atom -> true"]), - (25, G["of"]): ("REDUCE", G["atom -> true"]), - (25, G["<"]): ("REDUCE", G["atom -> true"]), - (25, G[")"]): ("REDUCE", G["atom -> true"]), - (25, G["then"]): ("REDUCE", G["atom -> true"]), - (25, G["<="]): ("REDUCE", G["atom -> true"]), - (25, G["."]): ("REDUCE", G["atom -> true"]), - (25, G["else"]): ("REDUCE", G["atom -> true"]), - (25, G["="]): ("REDUCE", G["atom -> true"]), - (25, G[","]): ("REDUCE", G["atom -> true"]), - (25, G["fi"]): ("REDUCE", G["atom -> true"]), - (25, G[";"]): ("REDUCE", G["atom -> true"]), - (25, G["in"]): ("REDUCE", G["atom -> true"]), - (25, G["loop"]): ("REDUCE", G["atom -> true"]), - (25, G["@"]): ("REDUCE", G["atom -> true"]), - (25, G["pool"]): ("REDUCE", G["atom -> true"]), - (25, G["+"]): ("REDUCE", G["atom -> true"]), - (25, G["error"]): ("REDUCE", G["atom -> true"]), - (25, G["-"]): ("REDUCE", G["atom -> true"]), - (25, G["*"]): ("REDUCE", G["atom -> true"]), - (25, G["}"]): ("REDUCE", G["atom -> true"]), - (26, G["/"]): ("REDUCE", G["atom -> false"]), - (26, G["of"]): ("REDUCE", G["atom -> false"]), - (26, G["<"]): ("REDUCE", G["atom -> false"]), - (26, G[")"]): ("REDUCE", G["atom -> false"]), - (26, G["then"]): ("REDUCE", G["atom -> false"]), - (26, G["<="]): ("REDUCE", G["atom -> false"]), - (26, G["."]): ("REDUCE", G["atom -> false"]), - (26, G["else"]): ("REDUCE", G["atom -> false"]), - (26, G["="]): ("REDUCE", G["atom -> false"]), - (26, G[","]): ("REDUCE", G["atom -> false"]), - (26, G["fi"]): ("REDUCE", G["atom -> false"]), - (26, G[";"]): ("REDUCE", G["atom -> false"]), - (26, G["in"]): ("REDUCE", G["atom -> false"]), - (26, G["loop"]): ("REDUCE", G["atom -> false"]), - (26, G["@"]): ("REDUCE", G["atom -> false"]), - (26, G["pool"]): ("REDUCE", G["atom -> false"]), - (26, G["+"]): ("REDUCE", G["atom -> false"]), - (26, G["error"]): ("REDUCE", G["atom -> false"]), - (26, G["-"]): ("REDUCE", G["atom -> false"]), - (26, G["*"]): ("REDUCE", G["atom -> false"]), - (26, G["}"]): ("REDUCE", G["atom -> false"]), - (27, G["false"]): ("SHIFT", 26), - (27, G["~"]): ("SHIFT", 27), - (27, G["true"]): ("SHIFT", 25), - (27, G["new"]): ("SHIFT", 22), - (27, G["int"]): ("SHIFT", 33), - (27, G["id"]): ("SHIFT", 28), - (27, G["isvoid"]): ("SHIFT", 24), - (27, G["("]): ("SHIFT", 11), - (27, G["string"]): ("SHIFT", 34), - (28, G["/"]): ("REDUCE", G["atom -> id"]), - (28, G["of"]): ("REDUCE", G["atom -> id"]), - (28, G["<"]): ("REDUCE", G["atom -> id"]), - (28, G[")"]): ("REDUCE", G["atom -> id"]), - (28, G["then"]): ("REDUCE", G["atom -> id"]), - (28, G["<="]): ("REDUCE", G["atom -> id"]), - (28, G["."]): ("REDUCE", G["atom -> id"]), - (28, G["else"]): ("REDUCE", G["atom -> id"]), - (28, G["="]): ("REDUCE", G["atom -> id"]), - (28, G[","]): ("REDUCE", G["atom -> id"]), - (28, G["fi"]): ("REDUCE", G["atom -> id"]), - (28, G[";"]): ("REDUCE", G["atom -> id"]), - (28, G["in"]): ("REDUCE", G["atom -> id"]), - (28, G["loop"]): ("REDUCE", G["atom -> id"]), - (28, G["@"]): ("REDUCE", G["atom -> id"]), - (28, G["pool"]): ("REDUCE", G["atom -> id"]), - (28, G["+"]): ("REDUCE", G["atom -> id"]), - (28, G["error"]): ("REDUCE", G["atom -> id"]), - (28, G["-"]): ("REDUCE", G["atom -> id"]), - (28, G["*"]): ("REDUCE", G["atom -> id"]), - (28, G["}"]): ("REDUCE", G["atom -> id"]), - (28, G["("]): ("SHIFT", 29), - (29, G["true"]): ("SHIFT", 25), - (29, G["not"]): ("SHIFT", 30), - (29, G["id"]): ("SHIFT", 31), - (29, G["isvoid"]): ("SHIFT", 24), - (29, G[")"]): ("REDUCE", G["expr-list -> e"]), - (29, G["new"]): ("SHIFT", 22), - (29, G["let"]): ("SHIFT", 14), - (29, G["string"]): ("SHIFT", 34), - (29, G["("]): ("SHIFT", 11), - (29, G["case"]): ("SHIFT", 21), - (29, G["while"]): ("SHIFT", 13), - (29, G["int"]): ("SHIFT", 33), - (29, G["false"]): ("SHIFT", 26), - (29, G["{"]): ("SHIFT", 10), - (29, G["if"]): ("SHIFT", 12), - (29, G["~"]): ("SHIFT", 27), - (30, G["~"]): ("SHIFT", 27), - (30, G["isvoid"]): ("SHIFT", 24), - (30, G["id"]): ("SHIFT", 31), - (30, G["new"]): ("SHIFT", 22), - (30, G["let"]): ("SHIFT", 14), - (30, G["("]): ("SHIFT", 11), - (30, G["string"]): ("SHIFT", 34), - (30, G["case"]): ("SHIFT", 21), - (30, G["int"]): ("SHIFT", 33), - (30, G["while"]): ("SHIFT", 13), - (30, G["false"]): ("SHIFT", 26), - (30, G["{"]): ("SHIFT", 10), - (30, G["if"]): ("SHIFT", 12), - (30, G["true"]): ("SHIFT", 25), - (30, G["not"]): ("SHIFT", 30), - (31, G["<-"]): ("SHIFT", 32), - (31, G["/"]): ("REDUCE", G["atom -> id"]), - (31, G["of"]): ("REDUCE", G["atom -> id"]), - (31, G["<"]): ("REDUCE", G["atom -> id"]), - (31, G[")"]): ("REDUCE", G["atom -> id"]), - (31, G["then"]): ("REDUCE", G["atom -> id"]), - (31, G["<="]): ("REDUCE", G["atom -> id"]), - (31, G["."]): ("REDUCE", G["atom -> id"]), - (31, G["else"]): ("REDUCE", G["atom -> id"]), - (31, G["="]): ("REDUCE", G["atom -> id"]), - (31, G[","]): ("REDUCE", G["atom -> id"]), - (31, G["fi"]): ("REDUCE", G["atom -> id"]), - (31, G[";"]): ("REDUCE", G["atom -> id"]), - (31, G["in"]): ("REDUCE", G["atom -> id"]), - (31, G["loop"]): ("REDUCE", G["atom -> id"]), - (31, G["@"]): ("REDUCE", G["atom -> id"]), - (31, G["pool"]): ("REDUCE", G["atom -> id"]), - (31, G["+"]): ("REDUCE", G["atom -> id"]), - (31, G["error"]): ("REDUCE", G["atom -> id"]), - (31, G["-"]): ("REDUCE", G["atom -> id"]), - (31, G["*"]): ("REDUCE", G["atom -> id"]), - (31, G["}"]): ("REDUCE", G["atom -> id"]), - (31, G["("]): ("SHIFT", 29), - (32, G["~"]): ("SHIFT", 27), - (32, G["isvoid"]): ("SHIFT", 24), - (32, G["id"]): ("SHIFT", 31), - (32, G["new"]): ("SHIFT", 22), - (32, G["let"]): ("SHIFT", 14), - (32, G["("]): ("SHIFT", 11), - (32, G["string"]): ("SHIFT", 34), - (32, G["case"]): ("SHIFT", 21), - (32, G["int"]): ("SHIFT", 33), - (32, G["while"]): ("SHIFT", 13), - (32, G["false"]): ("SHIFT", 26), - (32, G["{"]): ("SHIFT", 10), - (32, G["if"]): ("SHIFT", 12), - (32, G["true"]): ("SHIFT", 25), - (32, G["not"]): ("SHIFT", 30), - (33, G["/"]): ("REDUCE", G["atom -> int"]), - (33, G["of"]): ("REDUCE", G["atom -> int"]), - (33, G["<"]): ("REDUCE", G["atom -> int"]), - (33, G[")"]): ("REDUCE", G["atom -> int"]), - (33, G["then"]): ("REDUCE", G["atom -> int"]), - (33, G["<="]): ("REDUCE", G["atom -> int"]), - (33, G["."]): ("REDUCE", G["atom -> int"]), - (33, G["else"]): ("REDUCE", G["atom -> int"]), - (33, G["="]): ("REDUCE", G["atom -> int"]), - (33, G[","]): ("REDUCE", G["atom -> int"]), - (33, G["fi"]): ("REDUCE", G["atom -> int"]), - (33, G[";"]): ("REDUCE", G["atom -> int"]), - (33, G["in"]): ("REDUCE", G["atom -> int"]), - (33, G["loop"]): ("REDUCE", G["atom -> int"]), - (33, G["@"]): ("REDUCE", G["atom -> int"]), - (33, G["pool"]): ("REDUCE", G["atom -> int"]), - (33, G["+"]): ("REDUCE", G["atom -> int"]), - (33, G["error"]): ("REDUCE", G["atom -> int"]), - (33, G["-"]): ("REDUCE", G["atom -> int"]), - (33, G["*"]): ("REDUCE", G["atom -> int"]), - (33, G["}"]): ("REDUCE", G["atom -> int"]), - (34, G["/"]): ("REDUCE", G["atom -> string"]), - (34, G["of"]): ("REDUCE", G["atom -> string"]), - (34, G["<"]): ("REDUCE", G["atom -> string"]), - (34, G[")"]): ("REDUCE", G["atom -> string"]), - (34, G["then"]): ("REDUCE", G["atom -> string"]), - (34, G["<="]): ("REDUCE", G["atom -> string"]), - (34, G["."]): ("REDUCE", G["atom -> string"]), - (34, G["else"]): ("REDUCE", G["atom -> string"]), - (34, G["="]): ("REDUCE", G["atom -> string"]), - (34, G[","]): ("REDUCE", G["atom -> string"]), - (34, G["fi"]): ("REDUCE", G["atom -> string"]), - (34, G[";"]): ("REDUCE", G["atom -> string"]), - (34, G["in"]): ("REDUCE", G["atom -> string"]), - (34, G["loop"]): ("REDUCE", G["atom -> string"]), - (34, G["@"]): ("REDUCE", G["atom -> string"]), - (34, G["pool"]): ("REDUCE", G["atom -> string"]), - (34, G["+"]): ("REDUCE", G["atom -> string"]), - (34, G["error"]): ("REDUCE", G["atom -> string"]), - (34, G["-"]): ("REDUCE", G["atom -> string"]), - (34, G["*"]): ("REDUCE", G["atom -> string"]), - (34, G["}"]): ("REDUCE", G["atom -> string"]), - (35, G["/"]): ("REDUCE", G["atom -> function-call"]), - (35, G["of"]): ("REDUCE", G["atom -> function-call"]), - (35, G["<"]): ("REDUCE", G["atom -> function-call"]), - (35, G[")"]): ("REDUCE", G["atom -> function-call"]), - (35, G["then"]): ("REDUCE", G["atom -> function-call"]), - (35, G["<="]): ("REDUCE", G["atom -> function-call"]), - (35, G["."]): ("REDUCE", G["atom -> function-call"]), - (35, G["else"]): ("REDUCE", G["atom -> function-call"]), - (35, G["="]): ("REDUCE", G["atom -> function-call"]), - (35, G[","]): ("REDUCE", G["atom -> function-call"]), - (35, G["fi"]): ("REDUCE", G["atom -> function-call"]), - (35, G[";"]): ("REDUCE", G["atom -> function-call"]), - (35, G["in"]): ("REDUCE", G["atom -> function-call"]), - (35, G["loop"]): ("REDUCE", G["atom -> function-call"]), - (35, G["@"]): ("REDUCE", G["atom -> function-call"]), - (35, G["pool"]): ("REDUCE", G["atom -> function-call"]), - (35, G["+"]): ("REDUCE", G["atom -> function-call"]), - (35, G["error"]): ("REDUCE", G["atom -> function-call"]), - (35, G["-"]): ("REDUCE", G["atom -> function-call"]), - (35, G["*"]): ("REDUCE", G["atom -> function-call"]), - (35, G["}"]): ("REDUCE", G["atom -> function-call"]), - (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["else"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["in"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["}"]): ("REDUCE", G["expr -> id <- expr"]), - (37, G[","]): ("REDUCE", G["expr -> comp"]), - (37, G[";"]): ("REDUCE", G["expr -> comp"]), - (37, G["loop"]): ("REDUCE", G["expr -> comp"]), - (37, G["of"]): ("REDUCE", G["expr -> comp"]), - (37, G[")"]): ("REDUCE", G["expr -> comp"]), - (37, G["pool"]): ("REDUCE", G["expr -> comp"]), - (37, G["then"]): ("REDUCE", G["expr -> comp"]), - (37, G["error"]): ("REDUCE", G["expr -> comp"]), - (37, G["else"]): ("REDUCE", G["expr -> comp"]), - (37, G["in"]): ("REDUCE", G["expr -> comp"]), - (37, G["fi"]): ("REDUCE", G["expr -> comp"]), - (37, G["}"]): ("REDUCE", G["expr -> comp"]), - (38, G["<"]): ("SHIFT", 66), - (38, G["="]): ("SHIFT", 70), - (38, G[","]): ("REDUCE", G["comp -> arith"]), - (38, G[";"]): ("REDUCE", G["comp -> arith"]), - (38, G["loop"]): ("REDUCE", G["comp -> arith"]), - (38, G["of"]): ("REDUCE", G["comp -> arith"]), - (38, G[")"]): ("REDUCE", G["comp -> arith"]), - (38, G["pool"]): ("REDUCE", G["comp -> arith"]), - (38, G["then"]): ("REDUCE", G["comp -> arith"]), - (38, G["error"]): ("REDUCE", G["comp -> arith"]), - (38, G["else"]): ("REDUCE", G["comp -> arith"]), - (38, G["in"]): ("REDUCE", G["comp -> arith"]), - (38, G["fi"]): ("REDUCE", G["comp -> arith"]), - (38, G["}"]): ("REDUCE", G["comp -> arith"]), - (38, G["<="]): ("SHIFT", 68), - (38, G["-"]): ("SHIFT", 64), - (38, G["+"]): ("SHIFT", 39), - (39, G["~"]): ("SHIFT", 27), - (39, G["int"]): ("SHIFT", 33), - (39, G["isvoid"]): ("SHIFT", 24), - (39, G["false"]): ("SHIFT", 26), - (39, G["true"]): ("SHIFT", 25), - (39, G["new"]): ("SHIFT", 22), - (39, G["id"]): ("SHIFT", 28), - (39, G["("]): ("SHIFT", 11), - (39, G["string"]): ("SHIFT", 34), - (40, G["/"]): ("SHIFT", 54), - (40, G["of"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["<"]): ("REDUCE", G["arith -> arith + term"]), - (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["then"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["<="]): ("REDUCE", G["arith -> arith + term"]), - (40, G["else"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["="]): ("REDUCE", G["arith -> arith + term"]), - (40, G[","]): ("REDUCE", G["arith -> arith + term"]), - (40, G["fi"]): ("REDUCE", G["arith -> arith + term"]), - (40, G[";"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["+"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["*"]): ("SHIFT", 41), - (41, G["false"]): ("SHIFT", 26), - (41, G["~"]): ("SHIFT", 27), - (41, G["true"]): ("SHIFT", 25), - (41, G["new"]): ("SHIFT", 22), - (41, G["int"]): ("SHIFT", 33), - (41, G["id"]): ("SHIFT", 28), - (41, G["isvoid"]): ("SHIFT", 24), - (41, G["("]): ("SHIFT", 11), - (41, G["string"]): ("SHIFT", 34), - (42, G["/"]): ("REDUCE", G["term -> term * factor"]), - (42, G["of"]): ("REDUCE", G["term -> term * factor"]), - (42, G["<"]): ("REDUCE", G["term -> term * factor"]), - (42, G[")"]): ("REDUCE", G["term -> term * factor"]), - (42, G["then"]): ("REDUCE", G["term -> term * factor"]), - (42, G["<="]): ("REDUCE", G["term -> term * factor"]), - (42, G["else"]): ("REDUCE", G["term -> term * factor"]), - (42, G["="]): ("REDUCE", G["term -> term * factor"]), - (42, G[","]): ("REDUCE", G["term -> term * factor"]), - (42, G["fi"]): ("REDUCE", G["term -> term * factor"]), - (42, G[";"]): ("REDUCE", G["term -> term * factor"]), - (42, G["in"]): ("REDUCE", G["term -> term * factor"]), - (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), - (42, G["pool"]): ("REDUCE", G["term -> term * factor"]), - (42, G["+"]): ("REDUCE", G["term -> term * factor"]), - (42, G["error"]): ("REDUCE", G["term -> term * factor"]), - (42, G["-"]): ("REDUCE", G["term -> term * factor"]), - (42, G["*"]): ("REDUCE", G["term -> term * factor"]), - (42, G["}"]): ("REDUCE", G["term -> term * factor"]), - (43, G["/"]): ("REDUCE", G["factor -> atom"]), - (43, G["of"]): ("REDUCE", G["factor -> atom"]), - (43, G["<"]): ("REDUCE", G["factor -> atom"]), - (43, G[")"]): ("REDUCE", G["factor -> atom"]), - (43, G["then"]): ("REDUCE", G["factor -> atom"]), - (43, G["<="]): ("REDUCE", G["factor -> atom"]), - (43, G["else"]): ("REDUCE", G["factor -> atom"]), - (43, G["="]): ("REDUCE", G["factor -> atom"]), - (43, G[","]): ("REDUCE", G["factor -> atom"]), - (43, G["fi"]): ("REDUCE", G["factor -> atom"]), - (43, G[";"]): ("REDUCE", G["factor -> atom"]), - (43, G["in"]): ("REDUCE", G["factor -> atom"]), - (43, G["loop"]): ("REDUCE", G["factor -> atom"]), - (43, G["pool"]): ("REDUCE", G["factor -> atom"]), - (43, G["+"]): ("REDUCE", G["factor -> atom"]), - (43, G["error"]): ("REDUCE", G["factor -> atom"]), - (43, G["-"]): ("REDUCE", G["factor -> atom"]), - (43, G["*"]): ("REDUCE", G["factor -> atom"]), - (43, G["}"]): ("REDUCE", G["factor -> atom"]), - (43, G["."]): ("SHIFT", 44), - (43, G["@"]): ("SHIFT", 57), - (44, G["id"]): ("SHIFT", 45), - (45, G["("]): ("SHIFT", 46), - (46, G["true"]): ("SHIFT", 25), - (46, G["not"]): ("SHIFT", 30), - (46, G["id"]): ("SHIFT", 31), - (46, G["isvoid"]): ("SHIFT", 24), - (46, G[")"]): ("REDUCE", G["expr-list -> e"]), - (46, G["new"]): ("SHIFT", 22), - (46, G["let"]): ("SHIFT", 14), - (46, G["string"]): ("SHIFT", 34), - (46, G["("]): ("SHIFT", 11), - (46, G["case"]): ("SHIFT", 21), - (46, G["while"]): ("SHIFT", 13), - (46, G["int"]): ("SHIFT", 33), - (46, G["false"]): ("SHIFT", 26), - (46, G["{"]): ("SHIFT", 10), - (46, G["if"]): ("SHIFT", 12), - (46, G["~"]): ("SHIFT", 27), - (47, G[")"]): ("SHIFT", 48), - (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (49, G[")"]): ("REDUCE", G["expr-list -> not-empty-expr-list"]), - (50, G[","]): ("SHIFT", 51), - (50, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), - (51, G["true"]): ("SHIFT", 25), - (51, G["not"]): ("SHIFT", 30), - (51, G["id"]): ("SHIFT", 31), - (51, G["isvoid"]): ("SHIFT", 24), - (51, G["new"]): ("SHIFT", 22), - (51, G["let"]): ("SHIFT", 14), - (51, G["string"]): ("SHIFT", 34), - (51, G["("]): ("SHIFT", 11), - (51, G["case"]): ("SHIFT", 21), - (51, G["while"]): ("SHIFT", 13), - (51, G["int"]): ("SHIFT", 33), - (51, G["false"]): ("SHIFT", 26), - (51, G["{"]): ("SHIFT", 10), - (51, G["if"]): ("SHIFT", 12), - (51, G["~"]): ("SHIFT", 27), - (52, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr , not-empty-expr-list"]), - (53, G["*"]): ("SHIFT", 41), - (53, G["/"]): ("SHIFT", 54), - (53, G["of"]): ("REDUCE", G["arith -> term"]), - (53, G["<"]): ("REDUCE", G["arith -> term"]), - (53, G[")"]): ("REDUCE", G["arith -> term"]), - (53, G["then"]): ("REDUCE", G["arith -> term"]), - (53, G["<="]): ("REDUCE", G["arith -> term"]), - (53, G["else"]): ("REDUCE", G["arith -> term"]), - (53, G["="]): ("REDUCE", G["arith -> term"]), - (53, G[","]): ("REDUCE", G["arith -> term"]), - (53, G["fi"]): ("REDUCE", G["arith -> term"]), - (53, G[";"]): ("REDUCE", G["arith -> term"]), - (53, G["loop"]): ("REDUCE", G["arith -> term"]), - (53, G["pool"]): ("REDUCE", G["arith -> term"]), - (53, G["+"]): ("REDUCE", G["arith -> term"]), - (53, G["error"]): ("REDUCE", G["arith -> term"]), - (53, G["in"]): ("REDUCE", G["arith -> term"]), - (53, G["-"]): ("REDUCE", G["arith -> term"]), - (53, G["}"]): ("REDUCE", G["arith -> term"]), - (54, G["false"]): ("SHIFT", 26), - (54, G["~"]): ("SHIFT", 27), - (54, G["true"]): ("SHIFT", 25), - (54, G["new"]): ("SHIFT", 22), - (54, G["int"]): ("SHIFT", 33), - (54, G["id"]): ("SHIFT", 28), - (54, G["isvoid"]): ("SHIFT", 24), - (54, G["("]): ("SHIFT", 11), - (54, G["string"]): ("SHIFT", 34), - (55, G["/"]): ("REDUCE", G["term -> term / factor"]), - (55, G["of"]): ("REDUCE", G["term -> term / factor"]), - (55, G["<"]): ("REDUCE", G["term -> term / factor"]), - (55, G[")"]): ("REDUCE", G["term -> term / factor"]), - (55, G["then"]): ("REDUCE", G["term -> term / factor"]), - (55, G["<="]): ("REDUCE", G["term -> term / factor"]), - (55, G["else"]): ("REDUCE", G["term -> term / factor"]), - (55, G["="]): ("REDUCE", G["term -> term / factor"]), - (55, G[","]): ("REDUCE", G["term -> term / factor"]), - (55, G["fi"]): ("REDUCE", G["term -> term / factor"]), - (55, G[";"]): ("REDUCE", G["term -> term / factor"]), - (55, G["in"]): ("REDUCE", G["term -> term / factor"]), - (55, G["loop"]): ("REDUCE", G["term -> term / factor"]), - (55, G["pool"]): ("REDUCE", G["term -> term / factor"]), - (55, G["+"]): ("REDUCE", G["term -> term / factor"]), - (55, G["error"]): ("REDUCE", G["term -> term / factor"]), - (55, G["-"]): ("REDUCE", G["term -> term / factor"]), - (55, G["*"]): ("REDUCE", G["term -> term / factor"]), - (55, G["}"]): ("REDUCE", G["term -> term / factor"]), - (56, G["/"]): ("REDUCE", G["term -> factor"]), - (56, G["of"]): ("REDUCE", G["term -> factor"]), - (56, G["<"]): ("REDUCE", G["term -> factor"]), - (56, G[")"]): ("REDUCE", G["term -> factor"]), - (56, G["then"]): ("REDUCE", G["term -> factor"]), - (56, G["<="]): ("REDUCE", G["term -> factor"]), - (56, G["else"]): ("REDUCE", G["term -> factor"]), - (56, G["="]): ("REDUCE", G["term -> factor"]), - (56, G[","]): ("REDUCE", G["term -> factor"]), - (56, G["fi"]): ("REDUCE", G["term -> factor"]), - (56, G[";"]): ("REDUCE", G["term -> factor"]), - (56, G["in"]): ("REDUCE", G["term -> factor"]), - (56, G["loop"]): ("REDUCE", G["term -> factor"]), - (56, G["pool"]): ("REDUCE", G["term -> factor"]), - (56, G["+"]): ("REDUCE", G["term -> factor"]), - (56, G["error"]): ("REDUCE", G["term -> factor"]), - (56, G["-"]): ("REDUCE", G["term -> factor"]), - (56, G["*"]): ("REDUCE", G["term -> factor"]), - (56, G["}"]): ("REDUCE", G["term -> factor"]), - (57, G["type"]): ("SHIFT", 58), - (58, G["."]): ("SHIFT", 59), - (59, G["id"]): ("SHIFT", 60), - (60, G["("]): ("SHIFT", 61), - (61, G["true"]): ("SHIFT", 25), - (61, G["not"]): ("SHIFT", 30), - (61, G["id"]): ("SHIFT", 31), - (61, G["isvoid"]): ("SHIFT", 24), - (61, G[")"]): ("REDUCE", G["expr-list -> e"]), - (61, G["new"]): ("SHIFT", 22), - (61, G["let"]): ("SHIFT", 14), - (61, G["string"]): ("SHIFT", 34), - (61, G["("]): ("SHIFT", 11), - (61, G["case"]): ("SHIFT", 21), - (61, G["while"]): ("SHIFT", 13), - (61, G["int"]): ("SHIFT", 33), - (61, G["false"]): ("SHIFT", 26), - (61, G["{"]): ("SHIFT", 10), - (61, G["if"]): ("SHIFT", 12), - (61, G["~"]): ("SHIFT", 27), - (62, G[")"]): ("SHIFT", 63), - (63, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (64, G["~"]): ("SHIFT", 27), - (64, G["int"]): ("SHIFT", 33), - (64, G["isvoid"]): ("SHIFT", 24), - (64, G["false"]): ("SHIFT", 26), - (64, G["("]): ("SHIFT", 11), - (64, G["true"]): ("SHIFT", 25), - (64, G["new"]): ("SHIFT", 22), - (64, G["id"]): ("SHIFT", 28), - (64, G["string"]): ("SHIFT", 34), - (65, G["of"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["<"]): ("REDUCE", G["arith -> arith - term"]), - (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["then"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["<="]): ("REDUCE", G["arith -> arith - term"]), - (65, G["else"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["="]): ("REDUCE", G["arith -> arith - term"]), - (65, G[","]): ("REDUCE", G["arith -> arith - term"]), - (65, G["fi"]): ("REDUCE", G["arith -> arith - term"]), - (65, G[";"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["loop"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["pool"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["+"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["error"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["-"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["}"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["*"]): ("SHIFT", 41), - (65, G["/"]): ("SHIFT", 54), - (66, G["int"]): ("SHIFT", 33), - (66, G["false"]): ("SHIFT", 26), - (66, G["~"]): ("SHIFT", 27), - (66, G["true"]): ("SHIFT", 25), - (66, G["new"]): ("SHIFT", 22), - (66, G["isvoid"]): ("SHIFT", 24), - (66, G["id"]): ("SHIFT", 28), - (66, G["("]): ("SHIFT", 11), - (66, G["string"]): ("SHIFT", 34), - (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["else"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["in"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["}"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["-"]): ("SHIFT", 64), - (67, G["+"]): ("SHIFT", 39), - (68, G["int"]): ("SHIFT", 33), - (68, G["false"]): ("SHIFT", 26), - (68, G["~"]): ("SHIFT", 27), - (68, G["true"]): ("SHIFT", 25), - (68, G["new"]): ("SHIFT", 22), - (68, G["isvoid"]): ("SHIFT", 24), - (68, G["id"]): ("SHIFT", 28), - (68, G["("]): ("SHIFT", 11), - (68, G["string"]): ("SHIFT", 34), - (69, G["-"]): ("SHIFT", 64), - (69, G["+"]): ("SHIFT", 39), - (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), - (70, G["int"]): ("SHIFT", 33), - (70, G["false"]): ("SHIFT", 26), - (70, G["~"]): ("SHIFT", 27), - (70, G["true"]): ("SHIFT", 25), - (70, G["new"]): ("SHIFT", 22), - (70, G["isvoid"]): ("SHIFT", 24), - (70, G["id"]): ("SHIFT", 28), - (70, G["("]): ("SHIFT", 11), - (70, G["string"]): ("SHIFT", 34), - (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[";"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["error"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["else"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["in"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["}"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["-"]): ("SHIFT", 64), - (71, G["+"]): ("SHIFT", 39), - (72, G[";"]): ("REDUCE", G["expr -> not expr"]), - (72, G["in"]): ("REDUCE", G["expr -> not expr"]), - (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), - (72, G["of"]): ("REDUCE", G["expr -> not expr"]), - (72, G[")"]): ("REDUCE", G["expr -> not expr"]), - (72, G["pool"]): ("REDUCE", G["expr -> not expr"]), - (72, G["then"]): ("REDUCE", G["expr -> not expr"]), - (72, G["error"]): ("REDUCE", G["expr -> not expr"]), - (72, G["else"]): ("REDUCE", G["expr -> not expr"]), - (72, G[","]): ("REDUCE", G["expr -> not expr"]), - (72, G["fi"]): ("REDUCE", G["expr -> not expr"]), - (72, G["}"]): ("REDUCE", G["expr -> not expr"]), - (73, G[")"]): ("SHIFT", 74), - (74, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G["/"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["of"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["<"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G[")"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["then"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["<="]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["else"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["="]): ("REDUCE", G["factor -> ~ factor"]), - (75, G[","]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G[";"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["+"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["-"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["*"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["}"]): ("REDUCE", G["factor -> ~ factor"]), - (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), - (77, G["of"]): ("SHIFT", 78), - (78, G["id"]): ("SHIFT", 79), - (79, G[":"]): ("SHIFT", 80), - (80, G["type"]): ("SHIFT", 81), - (81, G["=>"]): ("SHIFT", 82), - (82, G["int"]): ("SHIFT", 33), - (82, G["case"]): ("SHIFT", 21), - (82, G["false"]): ("SHIFT", 26), - (82, G["while"]): ("SHIFT", 13), - (82, G["true"]): ("SHIFT", 25), - (82, G["id"]): ("SHIFT", 31), - (82, G["{"]): ("SHIFT", 10), - (82, G["if"]): ("SHIFT", 12), - (82, G["not"]): ("SHIFT", 30), - (82, G["~"]): ("SHIFT", 27), - (82, G["new"]): ("SHIFT", 22), - (82, G["("]): ("SHIFT", 11), - (82, G["isvoid"]): ("SHIFT", 24), - (82, G["string"]): ("SHIFT", 34), - (82, G["let"]): ("SHIFT", 14), - (83, G[";"]): ("SHIFT", 84), - (83, G["error"]): ("SHIFT", 86), - (84, G["id"]): ("SHIFT", 79), - (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), - (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), - (86, G["id"]): ("SHIFT", 79), - (86, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), - (87, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error case-list"]), - (88, G["esac"]): ("SHIFT", 89), - (89, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), - (90, G[","]): ("SHIFT", 91), - (91, G["id"]): ("SHIFT", 15), - (92, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), - (93, G["in"]): ("SHIFT", 94), - (94, G["~"]): ("SHIFT", 27), - (94, G["isvoid"]): ("SHIFT", 24), - (94, G["id"]): ("SHIFT", 31), - (94, G["new"]): ("SHIFT", 22), - (94, G["let"]): ("SHIFT", 14), - (94, G["("]): ("SHIFT", 11), - (94, G["string"]): ("SHIFT", 34), - (94, G["case"]): ("SHIFT", 21), - (94, G["int"]): ("SHIFT", 33), - (94, G["while"]): ("SHIFT", 13), - (94, G["false"]): ("SHIFT", 26), - (94, G["{"]): ("SHIFT", 10), - (94, G["if"]): ("SHIFT", 12), - (94, G["true"]): ("SHIFT", 25), - (94, G["not"]): ("SHIFT", 30), - (95, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (96, G["loop"]): ("SHIFT", 97), - (97, G["id"]): ("SHIFT", 31), - (97, G["int"]): ("SHIFT", 33), - (97, G["let"]): ("SHIFT", 14), - (97, G["false"]): ("SHIFT", 26), - (97, G["true"]): ("SHIFT", 25), - (97, G["case"]): ("SHIFT", 21), - (97, G["while"]): ("SHIFT", 13), - (97, G["{"]): ("SHIFT", 10), - (97, G["if"]): ("SHIFT", 12), - (97, G["not"]): ("SHIFT", 30), - (97, G["~"]): ("SHIFT", 27), - (97, G["new"]): ("SHIFT", 22), - (97, G["isvoid"]): ("SHIFT", 24), - (97, G["("]): ("SHIFT", 11), - (97, G["string"]): ("SHIFT", 34), - (98, G["pool"]): ("SHIFT", 99), - (99, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (100, G["then"]): ("SHIFT", 101), - (101, G["~"]): ("SHIFT", 27), - (101, G["string"]): ("SHIFT", 34), - (101, G["("]): ("SHIFT", 11), - (101, G["case"]): ("SHIFT", 21), - (101, G["isvoid"]): ("SHIFT", 24), - (101, G["while"]): ("SHIFT", 13), - (101, G["int"]): ("SHIFT", 33), - (101, G["false"]): ("SHIFT", 26), - (101, G["{"]): ("SHIFT", 10), - (101, G["if"]): ("SHIFT", 12), - (101, G["true"]): ("SHIFT", 25), - (101, G["not"]): ("SHIFT", 30), - (101, G["id"]): ("SHIFT", 31), - (101, G["new"]): ("SHIFT", 22), - (101, G["let"]): ("SHIFT", 14), - (102, G["else"]): ("SHIFT", 103), - (103, G["false"]): ("SHIFT", 26), - (103, G["let"]): ("SHIFT", 14), - (103, G["true"]): ("SHIFT", 25), - (103, G["case"]): ("SHIFT", 21), - (103, G["id"]): ("SHIFT", 31), - (103, G["while"]): ("SHIFT", 13), - (103, G["~"]): ("SHIFT", 27), - (103, G["isvoid"]): ("SHIFT", 24), - (103, G["{"]): ("SHIFT", 10), - (103, G["if"]): ("SHIFT", 12), - (103, G["not"]): ("SHIFT", 30), - (103, G["new"]): ("SHIFT", 22), - (103, G["("]): ("SHIFT", 11), - (103, G["string"]): ("SHIFT", 34), - (103, G["int"]): ("SHIFT", 33), - (104, G["fi"]): ("SHIFT", 105), - (105, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (106, G[")"]): ("SHIFT", 107), - (107, G["/"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["of"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["<"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G[")"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["then"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["<="]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["."]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["else"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["="]): ("REDUCE", G["atom -> ( expr )"]), - (107, G[","]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G[";"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["in"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["@"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["+"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["error"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["-"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["*"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["}"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["}"]): ("SHIFT", 109), - (109, G[","]): ("REDUCE", G["expr -> { block }"]), - (109, G[";"]): ("REDUCE", G["expr -> { block }"]), - (109, G["loop"]): ("REDUCE", G["expr -> { block }"]), - (109, G["of"]): ("REDUCE", G["expr -> { block }"]), - (109, G["pool"]): ("REDUCE", G["expr -> { block }"]), - (109, G[")"]): ("REDUCE", G["expr -> { block }"]), - (109, G["then"]): ("REDUCE", G["expr -> { block }"]), - (109, G["error"]): ("REDUCE", G["expr -> { block }"]), - (109, G["else"]): ("REDUCE", G["expr -> { block }"]), - (109, G["in"]): ("REDUCE", G["expr -> { block }"]), - (109, G["fi"]): ("REDUCE", G["expr -> { block }"]), - (109, G["}"]): ("REDUCE", G["expr -> { block }"]), - (110, G["error"]): ("SHIFT", 113), - (110, G[";"]): ("SHIFT", 111), - (111, G["int"]): ("SHIFT", 33), - (111, G["case"]): ("SHIFT", 21), - (111, G["false"]): ("SHIFT", 26), - (111, G["}"]): ("REDUCE", G["block -> expr ;"]), - (111, G["while"]): ("SHIFT", 13), - (111, G["true"]): ("SHIFT", 25), - (111, G["id"]): ("SHIFT", 31), - (111, G["{"]): ("SHIFT", 10), - (111, G["if"]): ("SHIFT", 12), - (111, G["not"]): ("SHIFT", 30), - (111, G["~"]): ("SHIFT", 27), - (111, G["new"]): ("SHIFT", 22), - (111, G["("]): ("SHIFT", 11), - (111, G["isvoid"]): ("SHIFT", 24), - (111, G["string"]): ("SHIFT", 34), - (111, G["let"]): ("SHIFT", 14), - (112, G["}"]): ("REDUCE", G["block -> expr ; block"]), - (113, G["int"]): ("SHIFT", 33), - (113, G["case"]): ("SHIFT", 21), - (113, G["false"]): ("SHIFT", 26), - (113, G["while"]): ("SHIFT", 13), - (113, G["true"]): ("SHIFT", 25), - (113, G["id"]): ("SHIFT", 31), - (113, G["{"]): ("SHIFT", 10), - (113, G["if"]): ("SHIFT", 12), - (113, G["not"]): ("SHIFT", 30), - (113, G["}"]): ("REDUCE", G["block -> expr error"]), - (113, G["~"]): ("SHIFT", 27), - (113, G["new"]): ("SHIFT", 22), - (113, G["("]): ("SHIFT", 11), - (113, G["isvoid"]): ("SHIFT", 24), - (113, G["string"]): ("SHIFT", 34), - (113, G["let"]): ("SHIFT", 14), - (114, G["}"]): ("REDUCE", G["block -> expr error block"]), - (115, G["}"]): ("SHIFT", 116), - (116, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), - (116, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), - (117, G[":"]): ("SHIFT", 118), - (118, G["type"]): ("SHIFT", 119), - (119, G[","]): ("SHIFT", 120), - (119, G[")"]): ("REDUCE", G["param-list -> id : type"]), - (120, G["id"]): ("SHIFT", 117), - (121, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), - (122, G[")"]): ("SHIFT", 123), - (123, G[":"]): ("SHIFT", 124), - (124, G["type"]): ("SHIFT", 125), - (125, G["{"]): ("SHIFT", 126), - (126, G["while"]): ("SHIFT", 13), - (126, G["~"]): ("SHIFT", 27), - (126, G["isvoid"]): ("SHIFT", 24), - (126, G["{"]): ("SHIFT", 10), - (126, G["if"]): ("SHIFT", 12), - (126, G["not"]): ("SHIFT", 30), - (126, G["new"]): ("SHIFT", 22), - (126, G["("]): ("SHIFT", 11), - (126, G["string"]): ("SHIFT", 34), - (126, G["int"]): ("SHIFT", 33), - (126, G["false"]): ("SHIFT", 26), - (126, G["id"]): ("SHIFT", 31), - (126, G["let"]): ("SHIFT", 14), - (126, G["true"]): ("SHIFT", 25), - (126, G["case"]): ("SHIFT", 21), - (127, G["}"]): ("SHIFT", 128), - (128, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), - (128, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), - (129, G["type"]): ("SHIFT", 130), - (130, G["<-"]): ("SHIFT", 131), - (130, G["error"]): ("REDUCE", G["attribute -> id : type"]), - (130, G[";"]): ("REDUCE", G["attribute -> id : type"]), - (131, G["int"]): ("SHIFT", 33), - (131, G["case"]): ("SHIFT", 21), - (131, G["false"]): ("SHIFT", 26), - (131, G["while"]): ("SHIFT", 13), - (131, G["true"]): ("SHIFT", 25), - (131, G["id"]): ("SHIFT", 31), - (131, G["{"]): ("SHIFT", 10), - (131, G["if"]): ("SHIFT", 12), - (131, G["not"]): ("SHIFT", 30), - (131, G["~"]): ("SHIFT", 27), - (131, G["new"]): ("SHIFT", 22), - (131, G["("]): ("SHIFT", 11), - (131, G["isvoid"]): ("SHIFT", 24), - (131, G["string"]): ("SHIFT", 34), - (131, G["let"]): ("SHIFT", 14), - (132, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), - (132, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), - (133, G["}"]): ("SHIFT", 134), - (134, G[";"]): ("REDUCE", G["class-def -> class type { feature-list }"]), - (135, G[";"]): ("SHIFT", 136), - (135, G["error"]): ("SHIFT", 143), - (136, G["}"]): ("REDUCE", G["feature-list -> e"]), - (136, G["id"]): ("SHIFT", 4), - (137, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), - (138, G["error"]): ("SHIFT", 141), - (138, G[";"]): ("SHIFT", 139), - (139, G["}"]): ("REDUCE", G["feature-list -> e"]), - (139, G["id"]): ("SHIFT", 4), - (140, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), - (141, G["}"]): ("REDUCE", G["feature-list -> e"]), - (141, G["id"]): ("SHIFT", 4), - (142, G["}"]): ("REDUCE", G["feature-list -> method error feature-list"]), - (143, G["}"]): ("REDUCE", G["feature-list -> e"]), - (143, G["id"]): ("SHIFT", 4), - (144, G["}"]): ("REDUCE", G["feature-list -> attribute error feature-list"]), - (145, G["type"]): ("SHIFT", 146), - (146, G["{"]): ("SHIFT", 147), - (147, G["}"]): ("REDUCE", G["feature-list -> e"]), - (147, G["id"]): ("SHIFT", 4), - (148, G["}"]): ("SHIFT", 149), - (149, G[";"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), - (150, G["$"]): ("OK", None), - (151, G["$"]): ("REDUCE", G["program -> class-list"]), - (152, G[";"]): ("SHIFT", 153), - (153, G["class"]): ("SHIFT", 1), - (153, G["$"]): ("REDUCE", G["class-list -> class-def ;"]), - (154, G["$"]): ("REDUCE", G["class-list -> class-def ; class-list"]), - } - - @staticmethod - def __goto_table(): - return { - (0, G["class-def"]): 152, - (0, G["class-list"]): 151, - (0, G["program"]): 150, - (3, G["feature-list"]): 133, - (3, G["attribute"]): 135, - (3, G["method"]): 138, - (5, G["param-list"]): 122, - (9, G["term"]): 53, - (9, G["arith"]): 38, - (9, G["atom"]): 43, - (9, G["factor"]): 56, - (9, G["expr"]): 115, - (9, G["comp"]): 37, - (9, G["function-call"]): 35, - (10, G["term"]): 53, - (10, G["arith"]): 38, - (10, G["expr"]): 110, - (10, G["factor"]): 56, - (10, G["block"]): 108, - (10, G["function-call"]): 35, - (10, G["atom"]): 43, - (10, G["comp"]): 37, - (11, G["function-call"]): 35, - (11, G["term"]): 53, - (11, G["factor"]): 56, - (11, G["atom"]): 43, - (11, G["arith"]): 38, - (11, G["comp"]): 37, - (11, G["expr"]): 106, - (12, G["term"]): 53, - (12, G["atom"]): 43, - (12, G["arith"]): 38, - (12, G["expr"]): 100, - (12, G["factor"]): 56, - (12, G["comp"]): 37, - (12, G["function-call"]): 35, - (13, G["function-call"]): 35, - (13, G["arith"]): 38, - (13, G["term"]): 53, - (13, G["comp"]): 37, - (13, G["expr"]): 96, - (13, G["atom"]): 43, - (13, G["factor"]): 56, - (14, G["declaration-list"]): 93, - (18, G["declaration-list"]): 19, - (20, G["factor"]): 56, - (20, G["term"]): 53, - (20, G["function-call"]): 35, - (20, G["arith"]): 38, - (20, G["atom"]): 43, - (20, G["comp"]): 37, - (20, G["expr"]): 90, - (21, G["arith"]): 38, - (21, G["expr"]): 77, - (21, G["term"]): 53, - (21, G["function-call"]): 35, - (21, G["factor"]): 56, - (21, G["atom"]): 43, - (21, G["comp"]): 37, - (24, G["function-call"]): 35, - (24, G["atom"]): 43, - (24, G["factor"]): 76, - (27, G["factor"]): 75, - (27, G["function-call"]): 35, - (27, G["atom"]): 43, - (29, G["arith"]): 38, - (29, G["expr-list"]): 73, - (29, G["function-call"]): 35, - (29, G["term"]): 53, - (29, G["not-empty-expr-list"]): 49, - (29, G["factor"]): 56, - (29, G["comp"]): 37, - (29, G["atom"]): 43, - (29, G["expr"]): 50, - (30, G["function-call"]): 35, - (30, G["arith"]): 38, - (30, G["term"]): 53, - (30, G["comp"]): 37, - (30, G["atom"]): 43, - (30, G["expr"]): 72, - (30, G["factor"]): 56, - (32, G["function-call"]): 35, - (32, G["arith"]): 38, - (32, G["term"]): 53, - (32, G["expr"]): 36, - (32, G["comp"]): 37, - (32, G["atom"]): 43, - (32, G["factor"]): 56, - (39, G["function-call"]): 35, - (39, G["factor"]): 56, - (39, G["atom"]): 43, - (39, G["term"]): 40, - (41, G["function-call"]): 35, - (41, G["atom"]): 43, - (41, G["factor"]): 42, - (46, G["arith"]): 38, - (46, G["function-call"]): 35, - (46, G["term"]): 53, - (46, G["not-empty-expr-list"]): 49, - (46, G["factor"]): 56, - (46, G["comp"]): 37, - (46, G["atom"]): 43, - (46, G["expr"]): 50, - (46, G["expr-list"]): 47, - (51, G["arith"]): 38, - (51, G["function-call"]): 35, - (51, G["term"]): 53, - (51, G["factor"]): 56, - (51, G["comp"]): 37, - (51, G["atom"]): 43, - (51, G["expr"]): 50, - (51, G["not-empty-expr-list"]): 52, - (54, G["function-call"]): 35, - (54, G["atom"]): 43, - (54, G["factor"]): 55, - (61, G["arith"]): 38, - (61, G["function-call"]): 35, - (61, G["term"]): 53, - (61, G["not-empty-expr-list"]): 49, - (61, G["factor"]): 56, - (61, G["expr-list"]): 62, - (61, G["comp"]): 37, - (61, G["atom"]): 43, - (61, G["expr"]): 50, - (64, G["function-call"]): 35, - (64, G["factor"]): 56, - (64, G["atom"]): 43, - (64, G["term"]): 65, - (66, G["arith"]): 67, - (66, G["factor"]): 56, - (66, G["atom"]): 43, - (66, G["term"]): 53, - (66, G["function-call"]): 35, - (68, G["arith"]): 69, - (68, G["factor"]): 56, - (68, G["atom"]): 43, - (68, G["term"]): 53, - (68, G["function-call"]): 35, - (70, G["arith"]): 71, - (70, G["factor"]): 56, - (70, G["atom"]): 43, - (70, G["term"]): 53, - (70, G["function-call"]): 35, - (78, G["case-list"]): 88, - (82, G["term"]): 53, - (82, G["expr"]): 83, - (82, G["arith"]): 38, - (82, G["factor"]): 56, - (82, G["function-call"]): 35, - (82, G["atom"]): 43, - (82, G["comp"]): 37, - (84, G["case-list"]): 85, - (86, G["case-list"]): 87, - (91, G["declaration-list"]): 92, - (94, G["function-call"]): 35, - (94, G["arith"]): 38, - (94, G["term"]): 53, - (94, G["comp"]): 37, - (94, G["atom"]): 43, - (94, G["expr"]): 95, - (94, G["factor"]): 56, - (97, G["comp"]): 37, - (97, G["arith"]): 38, - (97, G["factor"]): 56, - (97, G["expr"]): 98, - (97, G["term"]): 53, - (97, G["function-call"]): 35, - (97, G["atom"]): 43, - (101, G["term"]): 53, - (101, G["atom"]): 43, - (101, G["arith"]): 38, - (101, G["factor"]): 56, - (101, G["expr"]): 102, - (101, G["function-call"]): 35, - (101, G["comp"]): 37, - (103, G["comp"]): 37, - (103, G["term"]): 53, - (103, G["arith"]): 38, - (103, G["atom"]): 43, - (103, G["function-call"]): 35, - (103, G["expr"]): 104, - (103, G["factor"]): 56, - (111, G["term"]): 53, - (111, G["arith"]): 38, - (111, G["expr"]): 110, - (111, G["factor"]): 56, - (111, G["function-call"]): 35, - (111, G["block"]): 112, - (111, G["atom"]): 43, - (111, G["comp"]): 37, - (113, G["term"]): 53, - (113, G["arith"]): 38, - (113, G["expr"]): 110, - (113, G["factor"]): 56, - (113, G["function-call"]): 35, - (113, G["block"]): 114, - (113, G["atom"]): 43, - (113, G["comp"]): 37, - (120, G["param-list"]): 121, - (126, G["expr"]): 127, - (126, G["term"]): 53, - (126, G["arith"]): 38, - (126, G["atom"]): 43, - (126, G["factor"]): 56, - (126, G["comp"]): 37, - (126, G["function-call"]): 35, - (131, G["term"]): 53, - (131, G["arith"]): 38, - (131, G["factor"]): 56, - (131, G["expr"]): 132, - (131, G["function-call"]): 35, - (131, G["atom"]): 43, - (131, G["comp"]): 37, - (136, G["attribute"]): 135, - (136, G["feature-list"]): 137, - (136, G["method"]): 138, - (139, G["feature-list"]): 140, - (139, G["attribute"]): 135, - (139, G["method"]): 138, - (141, G["feature-list"]): 142, - (141, G["attribute"]): 135, - (141, G["method"]): 138, - (143, G["feature-list"]): 144, - (143, G["attribute"]): 135, - (143, G["method"]): 138, - (147, G["feature-list"]): 148, - (147, G["attribute"]): 135, - (147, G["method"]): 138, - (153, G["class-def"]): 152, - (153, G["class-list"]): 154, - } +from abc import ABC +from pyjapt import ShiftReduceParser +from cool.grammar import G + + +class CoolParser(ShiftReduceParser, ABC): + def __init__(self, verbose=False): + self.grammar = G + self.verbose = verbose + self.action = self.__action_table() + self.goto = self.__goto_table() + self._errors = [] + + @staticmethod + def __action_table(): + return { + (0, G["class"]): ("SHIFT", 1), + (1, G["type"]): ("SHIFT", 2), + (2, G["inherits"]): ("SHIFT", 145), + (2, G["{"]): ("SHIFT", 3), + (3, G["}"]): ("REDUCE", G["feature-list -> e"]), + (3, G["id"]): ("SHIFT", 4), + (4, G["("]): ("SHIFT", 5), + (4, G[":"]): ("SHIFT", 129), + (5, G[")"]): ("SHIFT", 6), + (5, G["id"]): ("SHIFT", 117), + (6, G[":"]): ("SHIFT", 7), + (7, G["type"]): ("SHIFT", 8), + (8, G["{"]): ("SHIFT", 9), + (9, G["while"]): ("SHIFT", 13), + (9, G["~"]): ("SHIFT", 27), + (9, G["isvoid"]): ("SHIFT", 24), + (9, G["{"]): ("SHIFT", 10), + (9, G["if"]): ("SHIFT", 12), + (9, G["not"]): ("SHIFT", 30), + (9, G["new"]): ("SHIFT", 22), + (9, G["("]): ("SHIFT", 11), + (9, G["string"]): ("SHIFT", 34), + (9, G["int"]): ("SHIFT", 33), + (9, G["false"]): ("SHIFT", 26), + (9, G["id"]): ("SHIFT", 31), + (9, G["let"]): ("SHIFT", 14), + (9, G["true"]): ("SHIFT", 25), + (9, G["case"]): ("SHIFT", 21), + (10, G["int"]): ("SHIFT", 33), + (10, G["case"]): ("SHIFT", 21), + (10, G["false"]): ("SHIFT", 26), + (10, G["while"]): ("SHIFT", 13), + (10, G["true"]): ("SHIFT", 25), + (10, G["id"]): ("SHIFT", 31), + (10, G["{"]): ("SHIFT", 10), + (10, G["if"]): ("SHIFT", 12), + (10, G["not"]): ("SHIFT", 30), + (10, G["~"]): ("SHIFT", 27), + (10, G["new"]): ("SHIFT", 22), + (10, G["("]): ("SHIFT", 11), + (10, G["isvoid"]): ("SHIFT", 24), + (10, G["string"]): ("SHIFT", 34), + (10, G["let"]): ("SHIFT", 14), + (11, G["case"]): ("SHIFT", 21), + (11, G["while"]): ("SHIFT", 13), + (11, G["{"]): ("SHIFT", 10), + (11, G["if"]): ("SHIFT", 12), + (11, G["not"]): ("SHIFT", 30), + (11, G["new"]): ("SHIFT", 22), + (11, G["("]): ("SHIFT", 11), + (11, G["string"]): ("SHIFT", 34), + (11, G["int"]): ("SHIFT", 33), + (11, G["false"]): ("SHIFT", 26), + (11, G["~"]): ("SHIFT", 27), + (11, G["id"]): ("SHIFT", 31), + (11, G["true"]): ("SHIFT", 25), + (11, G["isvoid"]): ("SHIFT", 24), + (11, G["let"]): ("SHIFT", 14), + (12, G["while"]): ("SHIFT", 13), + (12, G["{"]): ("SHIFT", 10), + (12, G["if"]): ("SHIFT", 12), + (12, G["~"]): ("SHIFT", 27), + (12, G["not"]): ("SHIFT", 30), + (12, G["new"]): ("SHIFT", 22), + (12, G["isvoid"]): ("SHIFT", 24), + (12, G["("]): ("SHIFT", 11), + (12, G["string"]): ("SHIFT", 34), + (12, G["int"]): ("SHIFT", 33), + (12, G["false"]): ("SHIFT", 26), + (12, G["id"]): ("SHIFT", 31), + (12, G["true"]): ("SHIFT", 25), + (12, G["let"]): ("SHIFT", 14), + (12, G["case"]): ("SHIFT", 21), + (13, G["id"]): ("SHIFT", 31), + (13, G["let"]): ("SHIFT", 14), + (13, G["~"]): ("SHIFT", 27), + (13, G["new"]): ("SHIFT", 22), + (13, G["case"]): ("SHIFT", 21), + (13, G["while"]): ("SHIFT", 13), + (13, G["("]): ("SHIFT", 11), + (13, G["string"]): ("SHIFT", 34), + (13, G["isvoid"]): ("SHIFT", 24), + (13, G["int"]): ("SHIFT", 33), + (13, G["{"]): ("SHIFT", 10), + (13, G["if"]): ("SHIFT", 12), + (13, G["false"]): ("SHIFT", 26), + (13, G["not"]): ("SHIFT", 30), + (13, G["true"]): ("SHIFT", 25), + (14, G["id"]): ("SHIFT", 15), + (15, G[":"]): ("SHIFT", 16), + (16, G["type"]): ("SHIFT", 17), + (17, G["<-"]): ("SHIFT", 20), + (17, G[","]): ("SHIFT", 18), + (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), + (18, G["id"]): ("SHIFT", 15), + (19, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), + (20, G["case"]): ("SHIFT", 21), + (20, G["false"]): ("SHIFT", 26), + (20, G["true"]): ("SHIFT", 25), + (20, G["while"]): ("SHIFT", 13), + (20, G["id"]): ("SHIFT", 31), + (20, G["{"]): ("SHIFT", 10), + (20, G["if"]): ("SHIFT", 12), + (20, G["not"]): ("SHIFT", 30), + (20, G["~"]): ("SHIFT", 27), + (20, G["new"]): ("SHIFT", 22), + (20, G["isvoid"]): ("SHIFT", 24), + (20, G["("]): ("SHIFT", 11), + (20, G["string"]): ("SHIFT", 34), + (20, G["let"]): ("SHIFT", 14), + (20, G["int"]): ("SHIFT", 33), + (21, G["int"]): ("SHIFT", 33), + (21, G["~"]): ("SHIFT", 27), + (21, G["false"]): ("SHIFT", 26), + (21, G["case"]): ("SHIFT", 21), + (21, G["true"]): ("SHIFT", 25), + (21, G["isvoid"]): ("SHIFT", 24), + (21, G["while"]): ("SHIFT", 13), + (21, G["id"]): ("SHIFT", 31), + (21, G["{"]): ("SHIFT", 10), + (21, G["if"]): ("SHIFT", 12), + (21, G["not"]): ("SHIFT", 30), + (21, G["new"]): ("SHIFT", 22), + (21, G["("]): ("SHIFT", 11), + (21, G["string"]): ("SHIFT", 34), + (21, G["let"]): ("SHIFT", 14), + (22, G["type"]): ("SHIFT", 23), + (23, G["/"]): ("REDUCE", G["atom -> new type"]), + (23, G["of"]): ("REDUCE", G["atom -> new type"]), + (23, G["<"]): ("REDUCE", G["atom -> new type"]), + (23, G[")"]): ("REDUCE", G["atom -> new type"]), + (23, G["then"]): ("REDUCE", G["atom -> new type"]), + (23, G["<="]): ("REDUCE", G["atom -> new type"]), + (23, G["."]): ("REDUCE", G["atom -> new type"]), + (23, G["else"]): ("REDUCE", G["atom -> new type"]), + (23, G["="]): ("REDUCE", G["atom -> new type"]), + (23, G[","]): ("REDUCE", G["atom -> new type"]), + (23, G["fi"]): ("REDUCE", G["atom -> new type"]), + (23, G[";"]): ("REDUCE", G["atom -> new type"]), + (23, G["in"]): ("REDUCE", G["atom -> new type"]), + (23, G["loop"]): ("REDUCE", G["atom -> new type"]), + (23, G["@"]): ("REDUCE", G["atom -> new type"]), + (23, G["pool"]): ("REDUCE", G["atom -> new type"]), + (23, G["+"]): ("REDUCE", G["atom -> new type"]), + (23, G["error"]): ("REDUCE", G["atom -> new type"]), + (23, G["-"]): ("REDUCE", G["atom -> new type"]), + (23, G["*"]): ("REDUCE", G["atom -> new type"]), + (23, G["}"]): ("REDUCE", G["atom -> new type"]), + (24, G["false"]): ("SHIFT", 26), + (24, G["~"]): ("SHIFT", 27), + (24, G["true"]): ("SHIFT", 25), + (24, G["new"]): ("SHIFT", 22), + (24, G["int"]): ("SHIFT", 33), + (24, G["id"]): ("SHIFT", 28), + (24, G["isvoid"]): ("SHIFT", 24), + (24, G["("]): ("SHIFT", 11), + (24, G["string"]): ("SHIFT", 34), + (25, G["/"]): ("REDUCE", G["atom -> true"]), + (25, G["of"]): ("REDUCE", G["atom -> true"]), + (25, G["<"]): ("REDUCE", G["atom -> true"]), + (25, G[")"]): ("REDUCE", G["atom -> true"]), + (25, G["then"]): ("REDUCE", G["atom -> true"]), + (25, G["<="]): ("REDUCE", G["atom -> true"]), + (25, G["."]): ("REDUCE", G["atom -> true"]), + (25, G["else"]): ("REDUCE", G["atom -> true"]), + (25, G["="]): ("REDUCE", G["atom -> true"]), + (25, G[","]): ("REDUCE", G["atom -> true"]), + (25, G["fi"]): ("REDUCE", G["atom -> true"]), + (25, G[";"]): ("REDUCE", G["atom -> true"]), + (25, G["in"]): ("REDUCE", G["atom -> true"]), + (25, G["loop"]): ("REDUCE", G["atom -> true"]), + (25, G["@"]): ("REDUCE", G["atom -> true"]), + (25, G["pool"]): ("REDUCE", G["atom -> true"]), + (25, G["+"]): ("REDUCE", G["atom -> true"]), + (25, G["error"]): ("REDUCE", G["atom -> true"]), + (25, G["-"]): ("REDUCE", G["atom -> true"]), + (25, G["*"]): ("REDUCE", G["atom -> true"]), + (25, G["}"]): ("REDUCE", G["atom -> true"]), + (26, G["/"]): ("REDUCE", G["atom -> false"]), + (26, G["of"]): ("REDUCE", G["atom -> false"]), + (26, G["<"]): ("REDUCE", G["atom -> false"]), + (26, G[")"]): ("REDUCE", G["atom -> false"]), + (26, G["then"]): ("REDUCE", G["atom -> false"]), + (26, G["<="]): ("REDUCE", G["atom -> false"]), + (26, G["."]): ("REDUCE", G["atom -> false"]), + (26, G["else"]): ("REDUCE", G["atom -> false"]), + (26, G["="]): ("REDUCE", G["atom -> false"]), + (26, G[","]): ("REDUCE", G["atom -> false"]), + (26, G["fi"]): ("REDUCE", G["atom -> false"]), + (26, G[";"]): ("REDUCE", G["atom -> false"]), + (26, G["in"]): ("REDUCE", G["atom -> false"]), + (26, G["loop"]): ("REDUCE", G["atom -> false"]), + (26, G["@"]): ("REDUCE", G["atom -> false"]), + (26, G["pool"]): ("REDUCE", G["atom -> false"]), + (26, G["+"]): ("REDUCE", G["atom -> false"]), + (26, G["error"]): ("REDUCE", G["atom -> false"]), + (26, G["-"]): ("REDUCE", G["atom -> false"]), + (26, G["*"]): ("REDUCE", G["atom -> false"]), + (26, G["}"]): ("REDUCE", G["atom -> false"]), + (27, G["false"]): ("SHIFT", 26), + (27, G["~"]): ("SHIFT", 27), + (27, G["true"]): ("SHIFT", 25), + (27, G["new"]): ("SHIFT", 22), + (27, G["int"]): ("SHIFT", 33), + (27, G["id"]): ("SHIFT", 28), + (27, G["isvoid"]): ("SHIFT", 24), + (27, G["("]): ("SHIFT", 11), + (27, G["string"]): ("SHIFT", 34), + (28, G["/"]): ("REDUCE", G["atom -> id"]), + (28, G["of"]): ("REDUCE", G["atom -> id"]), + (28, G["<"]): ("REDUCE", G["atom -> id"]), + (28, G[")"]): ("REDUCE", G["atom -> id"]), + (28, G["then"]): ("REDUCE", G["atom -> id"]), + (28, G["<="]): ("REDUCE", G["atom -> id"]), + (28, G["."]): ("REDUCE", G["atom -> id"]), + (28, G["else"]): ("REDUCE", G["atom -> id"]), + (28, G["="]): ("REDUCE", G["atom -> id"]), + (28, G[","]): ("REDUCE", G["atom -> id"]), + (28, G["fi"]): ("REDUCE", G["atom -> id"]), + (28, G[";"]): ("REDUCE", G["atom -> id"]), + (28, G["in"]): ("REDUCE", G["atom -> id"]), + (28, G["loop"]): ("REDUCE", G["atom -> id"]), + (28, G["@"]): ("REDUCE", G["atom -> id"]), + (28, G["pool"]): ("REDUCE", G["atom -> id"]), + (28, G["+"]): ("REDUCE", G["atom -> id"]), + (28, G["error"]): ("REDUCE", G["atom -> id"]), + (28, G["-"]): ("REDUCE", G["atom -> id"]), + (28, G["*"]): ("REDUCE", G["atom -> id"]), + (28, G["}"]): ("REDUCE", G["atom -> id"]), + (28, G["("]): ("SHIFT", 29), + (29, G["true"]): ("SHIFT", 25), + (29, G["not"]): ("SHIFT", 30), + (29, G["id"]): ("SHIFT", 31), + (29, G["isvoid"]): ("SHIFT", 24), + (29, G[")"]): ("REDUCE", G["expr-list -> e"]), + (29, G["new"]): ("SHIFT", 22), + (29, G["let"]): ("SHIFT", 14), + (29, G["string"]): ("SHIFT", 34), + (29, G["("]): ("SHIFT", 11), + (29, G["case"]): ("SHIFT", 21), + (29, G["while"]): ("SHIFT", 13), + (29, G["int"]): ("SHIFT", 33), + (29, G["false"]): ("SHIFT", 26), + (29, G["{"]): ("SHIFT", 10), + (29, G["if"]): ("SHIFT", 12), + (29, G["~"]): ("SHIFT", 27), + (30, G["~"]): ("SHIFT", 27), + (30, G["isvoid"]): ("SHIFT", 24), + (30, G["id"]): ("SHIFT", 31), + (30, G["new"]): ("SHIFT", 22), + (30, G["let"]): ("SHIFT", 14), + (30, G["("]): ("SHIFT", 11), + (30, G["string"]): ("SHIFT", 34), + (30, G["case"]): ("SHIFT", 21), + (30, G["int"]): ("SHIFT", 33), + (30, G["while"]): ("SHIFT", 13), + (30, G["false"]): ("SHIFT", 26), + (30, G["{"]): ("SHIFT", 10), + (30, G["if"]): ("SHIFT", 12), + (30, G["true"]): ("SHIFT", 25), + (30, G["not"]): ("SHIFT", 30), + (31, G["<-"]): ("SHIFT", 32), + (31, G["/"]): ("REDUCE", G["atom -> id"]), + (31, G["of"]): ("REDUCE", G["atom -> id"]), + (31, G["<"]): ("REDUCE", G["atom -> id"]), + (31, G[")"]): ("REDUCE", G["atom -> id"]), + (31, G["then"]): ("REDUCE", G["atom -> id"]), + (31, G["<="]): ("REDUCE", G["atom -> id"]), + (31, G["."]): ("REDUCE", G["atom -> id"]), + (31, G["else"]): ("REDUCE", G["atom -> id"]), + (31, G["="]): ("REDUCE", G["atom -> id"]), + (31, G[","]): ("REDUCE", G["atom -> id"]), + (31, G["fi"]): ("REDUCE", G["atom -> id"]), + (31, G[";"]): ("REDUCE", G["atom -> id"]), + (31, G["in"]): ("REDUCE", G["atom -> id"]), + (31, G["loop"]): ("REDUCE", G["atom -> id"]), + (31, G["@"]): ("REDUCE", G["atom -> id"]), + (31, G["pool"]): ("REDUCE", G["atom -> id"]), + (31, G["+"]): ("REDUCE", G["atom -> id"]), + (31, G["error"]): ("REDUCE", G["atom -> id"]), + (31, G["-"]): ("REDUCE", G["atom -> id"]), + (31, G["*"]): ("REDUCE", G["atom -> id"]), + (31, G["}"]): ("REDUCE", G["atom -> id"]), + (31, G["("]): ("SHIFT", 29), + (32, G["~"]): ("SHIFT", 27), + (32, G["isvoid"]): ("SHIFT", 24), + (32, G["id"]): ("SHIFT", 31), + (32, G["new"]): ("SHIFT", 22), + (32, G["let"]): ("SHIFT", 14), + (32, G["("]): ("SHIFT", 11), + (32, G["string"]): ("SHIFT", 34), + (32, G["case"]): ("SHIFT", 21), + (32, G["int"]): ("SHIFT", 33), + (32, G["while"]): ("SHIFT", 13), + (32, G["false"]): ("SHIFT", 26), + (32, G["{"]): ("SHIFT", 10), + (32, G["if"]): ("SHIFT", 12), + (32, G["true"]): ("SHIFT", 25), + (32, G["not"]): ("SHIFT", 30), + (33, G["/"]): ("REDUCE", G["atom -> int"]), + (33, G["of"]): ("REDUCE", G["atom -> int"]), + (33, G["<"]): ("REDUCE", G["atom -> int"]), + (33, G[")"]): ("REDUCE", G["atom -> int"]), + (33, G["then"]): ("REDUCE", G["atom -> int"]), + (33, G["<="]): ("REDUCE", G["atom -> int"]), + (33, G["."]): ("REDUCE", G["atom -> int"]), + (33, G["else"]): ("REDUCE", G["atom -> int"]), + (33, G["="]): ("REDUCE", G["atom -> int"]), + (33, G[","]): ("REDUCE", G["atom -> int"]), + (33, G["fi"]): ("REDUCE", G["atom -> int"]), + (33, G[";"]): ("REDUCE", G["atom -> int"]), + (33, G["in"]): ("REDUCE", G["atom -> int"]), + (33, G["loop"]): ("REDUCE", G["atom -> int"]), + (33, G["@"]): ("REDUCE", G["atom -> int"]), + (33, G["pool"]): ("REDUCE", G["atom -> int"]), + (33, G["+"]): ("REDUCE", G["atom -> int"]), + (33, G["error"]): ("REDUCE", G["atom -> int"]), + (33, G["-"]): ("REDUCE", G["atom -> int"]), + (33, G["*"]): ("REDUCE", G["atom -> int"]), + (33, G["}"]): ("REDUCE", G["atom -> int"]), + (34, G["/"]): ("REDUCE", G["atom -> string"]), + (34, G["of"]): ("REDUCE", G["atom -> string"]), + (34, G["<"]): ("REDUCE", G["atom -> string"]), + (34, G[")"]): ("REDUCE", G["atom -> string"]), + (34, G["then"]): ("REDUCE", G["atom -> string"]), + (34, G["<="]): ("REDUCE", G["atom -> string"]), + (34, G["."]): ("REDUCE", G["atom -> string"]), + (34, G["else"]): ("REDUCE", G["atom -> string"]), + (34, G["="]): ("REDUCE", G["atom -> string"]), + (34, G[","]): ("REDUCE", G["atom -> string"]), + (34, G["fi"]): ("REDUCE", G["atom -> string"]), + (34, G[";"]): ("REDUCE", G["atom -> string"]), + (34, G["in"]): ("REDUCE", G["atom -> string"]), + (34, G["loop"]): ("REDUCE", G["atom -> string"]), + (34, G["@"]): ("REDUCE", G["atom -> string"]), + (34, G["pool"]): ("REDUCE", G["atom -> string"]), + (34, G["+"]): ("REDUCE", G["atom -> string"]), + (34, G["error"]): ("REDUCE", G["atom -> string"]), + (34, G["-"]): ("REDUCE", G["atom -> string"]), + (34, G["*"]): ("REDUCE", G["atom -> string"]), + (34, G["}"]): ("REDUCE", G["atom -> string"]), + (35, G["/"]): ("REDUCE", G["atom -> function-call"]), + (35, G["of"]): ("REDUCE", G["atom -> function-call"]), + (35, G["<"]): ("REDUCE", G["atom -> function-call"]), + (35, G[")"]): ("REDUCE", G["atom -> function-call"]), + (35, G["then"]): ("REDUCE", G["atom -> function-call"]), + (35, G["<="]): ("REDUCE", G["atom -> function-call"]), + (35, G["."]): ("REDUCE", G["atom -> function-call"]), + (35, G["else"]): ("REDUCE", G["atom -> function-call"]), + (35, G["="]): ("REDUCE", G["atom -> function-call"]), + (35, G[","]): ("REDUCE", G["atom -> function-call"]), + (35, G["fi"]): ("REDUCE", G["atom -> function-call"]), + (35, G[";"]): ("REDUCE", G["atom -> function-call"]), + (35, G["in"]): ("REDUCE", G["atom -> function-call"]), + (35, G["loop"]): ("REDUCE", G["atom -> function-call"]), + (35, G["@"]): ("REDUCE", G["atom -> function-call"]), + (35, G["pool"]): ("REDUCE", G["atom -> function-call"]), + (35, G["+"]): ("REDUCE", G["atom -> function-call"]), + (35, G["error"]): ("REDUCE", G["atom -> function-call"]), + (35, G["-"]): ("REDUCE", G["atom -> function-call"]), + (35, G["*"]): ("REDUCE", G["atom -> function-call"]), + (35, G["}"]): ("REDUCE", G["atom -> function-call"]), + (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), + (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["else"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["in"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["}"]): ("REDUCE", G["expr -> id <- expr"]), + (37, G[","]): ("REDUCE", G["expr -> comp"]), + (37, G[";"]): ("REDUCE", G["expr -> comp"]), + (37, G["loop"]): ("REDUCE", G["expr -> comp"]), + (37, G["of"]): ("REDUCE", G["expr -> comp"]), + (37, G[")"]): ("REDUCE", G["expr -> comp"]), + (37, G["pool"]): ("REDUCE", G["expr -> comp"]), + (37, G["then"]): ("REDUCE", G["expr -> comp"]), + (37, G["error"]): ("REDUCE", G["expr -> comp"]), + (37, G["else"]): ("REDUCE", G["expr -> comp"]), + (37, G["in"]): ("REDUCE", G["expr -> comp"]), + (37, G["fi"]): ("REDUCE", G["expr -> comp"]), + (37, G["}"]): ("REDUCE", G["expr -> comp"]), + (38, G["<"]): ("SHIFT", 66), + (38, G["="]): ("SHIFT", 70), + (38, G[","]): ("REDUCE", G["comp -> arith"]), + (38, G[";"]): ("REDUCE", G["comp -> arith"]), + (38, G["loop"]): ("REDUCE", G["comp -> arith"]), + (38, G["of"]): ("REDUCE", G["comp -> arith"]), + (38, G[")"]): ("REDUCE", G["comp -> arith"]), + (38, G["pool"]): ("REDUCE", G["comp -> arith"]), + (38, G["then"]): ("REDUCE", G["comp -> arith"]), + (38, G["error"]): ("REDUCE", G["comp -> arith"]), + (38, G["else"]): ("REDUCE", G["comp -> arith"]), + (38, G["in"]): ("REDUCE", G["comp -> arith"]), + (38, G["fi"]): ("REDUCE", G["comp -> arith"]), + (38, G["}"]): ("REDUCE", G["comp -> arith"]), + (38, G["<="]): ("SHIFT", 68), + (38, G["-"]): ("SHIFT", 64), + (38, G["+"]): ("SHIFT", 39), + (39, G["~"]): ("SHIFT", 27), + (39, G["int"]): ("SHIFT", 33), + (39, G["isvoid"]): ("SHIFT", 24), + (39, G["false"]): ("SHIFT", 26), + (39, G["true"]): ("SHIFT", 25), + (39, G["new"]): ("SHIFT", 22), + (39, G["id"]): ("SHIFT", 28), + (39, G["("]): ("SHIFT", 11), + (39, G["string"]): ("SHIFT", 34), + (40, G["/"]): ("SHIFT", 54), + (40, G["of"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["<"]): ("REDUCE", G["arith -> arith + term"]), + (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["then"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["<="]): ("REDUCE", G["arith -> arith + term"]), + (40, G["else"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["="]): ("REDUCE", G["arith -> arith + term"]), + (40, G[","]): ("REDUCE", G["arith -> arith + term"]), + (40, G["fi"]): ("REDUCE", G["arith -> arith + term"]), + (40, G[";"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["+"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["*"]): ("SHIFT", 41), + (41, G["false"]): ("SHIFT", 26), + (41, G["~"]): ("SHIFT", 27), + (41, G["true"]): ("SHIFT", 25), + (41, G["new"]): ("SHIFT", 22), + (41, G["int"]): ("SHIFT", 33), + (41, G["id"]): ("SHIFT", 28), + (41, G["isvoid"]): ("SHIFT", 24), + (41, G["("]): ("SHIFT", 11), + (41, G["string"]): ("SHIFT", 34), + (42, G["/"]): ("REDUCE", G["term -> term * factor"]), + (42, G["of"]): ("REDUCE", G["term -> term * factor"]), + (42, G["<"]): ("REDUCE", G["term -> term * factor"]), + (42, G[")"]): ("REDUCE", G["term -> term * factor"]), + (42, G["then"]): ("REDUCE", G["term -> term * factor"]), + (42, G["<="]): ("REDUCE", G["term -> term * factor"]), + (42, G["else"]): ("REDUCE", G["term -> term * factor"]), + (42, G["="]): ("REDUCE", G["term -> term * factor"]), + (42, G[","]): ("REDUCE", G["term -> term * factor"]), + (42, G["fi"]): ("REDUCE", G["term -> term * factor"]), + (42, G[";"]): ("REDUCE", G["term -> term * factor"]), + (42, G["in"]): ("REDUCE", G["term -> term * factor"]), + (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), + (42, G["pool"]): ("REDUCE", G["term -> term * factor"]), + (42, G["+"]): ("REDUCE", G["term -> term * factor"]), + (42, G["error"]): ("REDUCE", G["term -> term * factor"]), + (42, G["-"]): ("REDUCE", G["term -> term * factor"]), + (42, G["*"]): ("REDUCE", G["term -> term * factor"]), + (42, G["}"]): ("REDUCE", G["term -> term * factor"]), + (43, G["/"]): ("REDUCE", G["factor -> atom"]), + (43, G["of"]): ("REDUCE", G["factor -> atom"]), + (43, G["<"]): ("REDUCE", G["factor -> atom"]), + (43, G[")"]): ("REDUCE", G["factor -> atom"]), + (43, G["then"]): ("REDUCE", G["factor -> atom"]), + (43, G["<="]): ("REDUCE", G["factor -> atom"]), + (43, G["else"]): ("REDUCE", G["factor -> atom"]), + (43, G["="]): ("REDUCE", G["factor -> atom"]), + (43, G[","]): ("REDUCE", G["factor -> atom"]), + (43, G["fi"]): ("REDUCE", G["factor -> atom"]), + (43, G[";"]): ("REDUCE", G["factor -> atom"]), + (43, G["in"]): ("REDUCE", G["factor -> atom"]), + (43, G["loop"]): ("REDUCE", G["factor -> atom"]), + (43, G["pool"]): ("REDUCE", G["factor -> atom"]), + (43, G["+"]): ("REDUCE", G["factor -> atom"]), + (43, G["error"]): ("REDUCE", G["factor -> atom"]), + (43, G["-"]): ("REDUCE", G["factor -> atom"]), + (43, G["*"]): ("REDUCE", G["factor -> atom"]), + (43, G["}"]): ("REDUCE", G["factor -> atom"]), + (43, G["."]): ("SHIFT", 44), + (43, G["@"]): ("SHIFT", 57), + (44, G["id"]): ("SHIFT", 45), + (45, G["("]): ("SHIFT", 46), + (46, G["true"]): ("SHIFT", 25), + (46, G["not"]): ("SHIFT", 30), + (46, G["id"]): ("SHIFT", 31), + (46, G["isvoid"]): ("SHIFT", 24), + (46, G[")"]): ("REDUCE", G["expr-list -> e"]), + (46, G["new"]): ("SHIFT", 22), + (46, G["let"]): ("SHIFT", 14), + (46, G["string"]): ("SHIFT", 34), + (46, G["("]): ("SHIFT", 11), + (46, G["case"]): ("SHIFT", 21), + (46, G["while"]): ("SHIFT", 13), + (46, G["int"]): ("SHIFT", 33), + (46, G["false"]): ("SHIFT", 26), + (46, G["{"]): ("SHIFT", 10), + (46, G["if"]): ("SHIFT", 12), + (46, G["~"]): ("SHIFT", 27), + (47, G[")"]): ("SHIFT", 48), + (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (49, G[")"]): ("REDUCE", G["expr-list -> not-empty-expr-list"]), + (50, G[","]): ("SHIFT", 51), + (50, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), + (51, G["true"]): ("SHIFT", 25), + (51, G["not"]): ("SHIFT", 30), + (51, G["id"]): ("SHIFT", 31), + (51, G["isvoid"]): ("SHIFT", 24), + (51, G["new"]): ("SHIFT", 22), + (51, G["let"]): ("SHIFT", 14), + (51, G["string"]): ("SHIFT", 34), + (51, G["("]): ("SHIFT", 11), + (51, G["case"]): ("SHIFT", 21), + (51, G["while"]): ("SHIFT", 13), + (51, G["int"]): ("SHIFT", 33), + (51, G["false"]): ("SHIFT", 26), + (51, G["{"]): ("SHIFT", 10), + (51, G["if"]): ("SHIFT", 12), + (51, G["~"]): ("SHIFT", 27), + (52, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr , not-empty-expr-list"]), + (53, G["*"]): ("SHIFT", 41), + (53, G["/"]): ("SHIFT", 54), + (53, G["of"]): ("REDUCE", G["arith -> term"]), + (53, G["<"]): ("REDUCE", G["arith -> term"]), + (53, G[")"]): ("REDUCE", G["arith -> term"]), + (53, G["then"]): ("REDUCE", G["arith -> term"]), + (53, G["<="]): ("REDUCE", G["arith -> term"]), + (53, G["else"]): ("REDUCE", G["arith -> term"]), + (53, G["="]): ("REDUCE", G["arith -> term"]), + (53, G[","]): ("REDUCE", G["arith -> term"]), + (53, G["fi"]): ("REDUCE", G["arith -> term"]), + (53, G[";"]): ("REDUCE", G["arith -> term"]), + (53, G["loop"]): ("REDUCE", G["arith -> term"]), + (53, G["pool"]): ("REDUCE", G["arith -> term"]), + (53, G["+"]): ("REDUCE", G["arith -> term"]), + (53, G["error"]): ("REDUCE", G["arith -> term"]), + (53, G["in"]): ("REDUCE", G["arith -> term"]), + (53, G["-"]): ("REDUCE", G["arith -> term"]), + (53, G["}"]): ("REDUCE", G["arith -> term"]), + (54, G["false"]): ("SHIFT", 26), + (54, G["~"]): ("SHIFT", 27), + (54, G["true"]): ("SHIFT", 25), + (54, G["new"]): ("SHIFT", 22), + (54, G["int"]): ("SHIFT", 33), + (54, G["id"]): ("SHIFT", 28), + (54, G["isvoid"]): ("SHIFT", 24), + (54, G["("]): ("SHIFT", 11), + (54, G["string"]): ("SHIFT", 34), + (55, G["/"]): ("REDUCE", G["term -> term / factor"]), + (55, G["of"]): ("REDUCE", G["term -> term / factor"]), + (55, G["<"]): ("REDUCE", G["term -> term / factor"]), + (55, G[")"]): ("REDUCE", G["term -> term / factor"]), + (55, G["then"]): ("REDUCE", G["term -> term / factor"]), + (55, G["<="]): ("REDUCE", G["term -> term / factor"]), + (55, G["else"]): ("REDUCE", G["term -> term / factor"]), + (55, G["="]): ("REDUCE", G["term -> term / factor"]), + (55, G[","]): ("REDUCE", G["term -> term / factor"]), + (55, G["fi"]): ("REDUCE", G["term -> term / factor"]), + (55, G[";"]): ("REDUCE", G["term -> term / factor"]), + (55, G["in"]): ("REDUCE", G["term -> term / factor"]), + (55, G["loop"]): ("REDUCE", G["term -> term / factor"]), + (55, G["pool"]): ("REDUCE", G["term -> term / factor"]), + (55, G["+"]): ("REDUCE", G["term -> term / factor"]), + (55, G["error"]): ("REDUCE", G["term -> term / factor"]), + (55, G["-"]): ("REDUCE", G["term -> term / factor"]), + (55, G["*"]): ("REDUCE", G["term -> term / factor"]), + (55, G["}"]): ("REDUCE", G["term -> term / factor"]), + (56, G["/"]): ("REDUCE", G["term -> factor"]), + (56, G["of"]): ("REDUCE", G["term -> factor"]), + (56, G["<"]): ("REDUCE", G["term -> factor"]), + (56, G[")"]): ("REDUCE", G["term -> factor"]), + (56, G["then"]): ("REDUCE", G["term -> factor"]), + (56, G["<="]): ("REDUCE", G["term -> factor"]), + (56, G["else"]): ("REDUCE", G["term -> factor"]), + (56, G["="]): ("REDUCE", G["term -> factor"]), + (56, G[","]): ("REDUCE", G["term -> factor"]), + (56, G["fi"]): ("REDUCE", G["term -> factor"]), + (56, G[";"]): ("REDUCE", G["term -> factor"]), + (56, G["in"]): ("REDUCE", G["term -> factor"]), + (56, G["loop"]): ("REDUCE", G["term -> factor"]), + (56, G["pool"]): ("REDUCE", G["term -> factor"]), + (56, G["+"]): ("REDUCE", G["term -> factor"]), + (56, G["error"]): ("REDUCE", G["term -> factor"]), + (56, G["-"]): ("REDUCE", G["term -> factor"]), + (56, G["*"]): ("REDUCE", G["term -> factor"]), + (56, G["}"]): ("REDUCE", G["term -> factor"]), + (57, G["type"]): ("SHIFT", 58), + (58, G["."]): ("SHIFT", 59), + (59, G["id"]): ("SHIFT", 60), + (60, G["("]): ("SHIFT", 61), + (61, G["true"]): ("SHIFT", 25), + (61, G["not"]): ("SHIFT", 30), + (61, G["id"]): ("SHIFT", 31), + (61, G["isvoid"]): ("SHIFT", 24), + (61, G[")"]): ("REDUCE", G["expr-list -> e"]), + (61, G["new"]): ("SHIFT", 22), + (61, G["let"]): ("SHIFT", 14), + (61, G["string"]): ("SHIFT", 34), + (61, G["("]): ("SHIFT", 11), + (61, G["case"]): ("SHIFT", 21), + (61, G["while"]): ("SHIFT", 13), + (61, G["int"]): ("SHIFT", 33), + (61, G["false"]): ("SHIFT", 26), + (61, G["{"]): ("SHIFT", 10), + (61, G["if"]): ("SHIFT", 12), + (61, G["~"]): ("SHIFT", 27), + (62, G[")"]): ("SHIFT", 63), + (63, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (64, G["~"]): ("SHIFT", 27), + (64, G["int"]): ("SHIFT", 33), + (64, G["isvoid"]): ("SHIFT", 24), + (64, G["false"]): ("SHIFT", 26), + (64, G["("]): ("SHIFT", 11), + (64, G["true"]): ("SHIFT", 25), + (64, G["new"]): ("SHIFT", 22), + (64, G["id"]): ("SHIFT", 28), + (64, G["string"]): ("SHIFT", 34), + (65, G["of"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["<"]): ("REDUCE", G["arith -> arith - term"]), + (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["then"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["<="]): ("REDUCE", G["arith -> arith - term"]), + (65, G["else"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["="]): ("REDUCE", G["arith -> arith - term"]), + (65, G[","]): ("REDUCE", G["arith -> arith - term"]), + (65, G["fi"]): ("REDUCE", G["arith -> arith - term"]), + (65, G[";"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["loop"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["pool"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["+"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["error"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["-"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["}"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["*"]): ("SHIFT", 41), + (65, G["/"]): ("SHIFT", 54), + (66, G["int"]): ("SHIFT", 33), + (66, G["false"]): ("SHIFT", 26), + (66, G["~"]): ("SHIFT", 27), + (66, G["true"]): ("SHIFT", 25), + (66, G["new"]): ("SHIFT", 22), + (66, G["isvoid"]): ("SHIFT", 24), + (66, G["id"]): ("SHIFT", 28), + (66, G["("]): ("SHIFT", 11), + (66, G["string"]): ("SHIFT", 34), + (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), + (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["else"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["in"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["}"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["-"]): ("SHIFT", 64), + (67, G["+"]): ("SHIFT", 39), + (68, G["int"]): ("SHIFT", 33), + (68, G["false"]): ("SHIFT", 26), + (68, G["~"]): ("SHIFT", 27), + (68, G["true"]): ("SHIFT", 25), + (68, G["new"]): ("SHIFT", 22), + (68, G["isvoid"]): ("SHIFT", 24), + (68, G["id"]): ("SHIFT", 28), + (68, G["("]): ("SHIFT", 11), + (68, G["string"]): ("SHIFT", 34), + (69, G["-"]): ("SHIFT", 64), + (69, G["+"]): ("SHIFT", 39), + (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), + (70, G["int"]): ("SHIFT", 33), + (70, G["false"]): ("SHIFT", 26), + (70, G["~"]): ("SHIFT", 27), + (70, G["true"]): ("SHIFT", 25), + (70, G["new"]): ("SHIFT", 22), + (70, G["isvoid"]): ("SHIFT", 24), + (70, G["id"]): ("SHIFT", 28), + (70, G["("]): ("SHIFT", 11), + (70, G["string"]): ("SHIFT", 34), + (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[";"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["error"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["else"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["in"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["}"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["-"]): ("SHIFT", 64), + (71, G["+"]): ("SHIFT", 39), + (72, G[";"]): ("REDUCE", G["expr -> not expr"]), + (72, G["in"]): ("REDUCE", G["expr -> not expr"]), + (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), + (72, G["of"]): ("REDUCE", G["expr -> not expr"]), + (72, G[")"]): ("REDUCE", G["expr -> not expr"]), + (72, G["pool"]): ("REDUCE", G["expr -> not expr"]), + (72, G["then"]): ("REDUCE", G["expr -> not expr"]), + (72, G["error"]): ("REDUCE", G["expr -> not expr"]), + (72, G["else"]): ("REDUCE", G["expr -> not expr"]), + (72, G[","]): ("REDUCE", G["expr -> not expr"]), + (72, G["fi"]): ("REDUCE", G["expr -> not expr"]), + (72, G["}"]): ("REDUCE", G["expr -> not expr"]), + (73, G[")"]): ("SHIFT", 74), + (74, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G["/"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["of"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["<"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G[")"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["then"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["<="]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["else"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["="]): ("REDUCE", G["factor -> ~ factor"]), + (75, G[","]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G[";"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["+"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["-"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["*"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["}"]): ("REDUCE", G["factor -> ~ factor"]), + (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), + (77, G["of"]): ("SHIFT", 78), + (78, G["id"]): ("SHIFT", 79), + (79, G[":"]): ("SHIFT", 80), + (80, G["type"]): ("SHIFT", 81), + (81, G["=>"]): ("SHIFT", 82), + (82, G["int"]): ("SHIFT", 33), + (82, G["case"]): ("SHIFT", 21), + (82, G["false"]): ("SHIFT", 26), + (82, G["while"]): ("SHIFT", 13), + (82, G["true"]): ("SHIFT", 25), + (82, G["id"]): ("SHIFT", 31), + (82, G["{"]): ("SHIFT", 10), + (82, G["if"]): ("SHIFT", 12), + (82, G["not"]): ("SHIFT", 30), + (82, G["~"]): ("SHIFT", 27), + (82, G["new"]): ("SHIFT", 22), + (82, G["("]): ("SHIFT", 11), + (82, G["isvoid"]): ("SHIFT", 24), + (82, G["string"]): ("SHIFT", 34), + (82, G["let"]): ("SHIFT", 14), + (83, G[";"]): ("SHIFT", 84), + (83, G["error"]): ("SHIFT", 86), + (84, G["id"]): ("SHIFT", 79), + (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), + (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), + (86, G["id"]): ("SHIFT", 79), + (86, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), + (87, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error case-list"]), + (88, G["esac"]): ("SHIFT", 89), + (89, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (90, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), + (90, G[","]): ("SHIFT", 91), + (91, G["id"]): ("SHIFT", 15), + (92, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), + (93, G["in"]): ("SHIFT", 94), + (94, G["~"]): ("SHIFT", 27), + (94, G["isvoid"]): ("SHIFT", 24), + (94, G["id"]): ("SHIFT", 31), + (94, G["new"]): ("SHIFT", 22), + (94, G["let"]): ("SHIFT", 14), + (94, G["("]): ("SHIFT", 11), + (94, G["string"]): ("SHIFT", 34), + (94, G["case"]): ("SHIFT", 21), + (94, G["int"]): ("SHIFT", 33), + (94, G["while"]): ("SHIFT", 13), + (94, G["false"]): ("SHIFT", 26), + (94, G["{"]): ("SHIFT", 10), + (94, G["if"]): ("SHIFT", 12), + (94, G["true"]): ("SHIFT", 25), + (94, G["not"]): ("SHIFT", 30), + (95, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (96, G["loop"]): ("SHIFT", 97), + (97, G["id"]): ("SHIFT", 31), + (97, G["int"]): ("SHIFT", 33), + (97, G["let"]): ("SHIFT", 14), + (97, G["false"]): ("SHIFT", 26), + (97, G["true"]): ("SHIFT", 25), + (97, G["case"]): ("SHIFT", 21), + (97, G["while"]): ("SHIFT", 13), + (97, G["{"]): ("SHIFT", 10), + (97, G["if"]): ("SHIFT", 12), + (97, G["not"]): ("SHIFT", 30), + (97, G["~"]): ("SHIFT", 27), + (97, G["new"]): ("SHIFT", 22), + (97, G["isvoid"]): ("SHIFT", 24), + (97, G["("]): ("SHIFT", 11), + (97, G["string"]): ("SHIFT", 34), + (98, G["pool"]): ("SHIFT", 99), + (99, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (100, G["then"]): ("SHIFT", 101), + (101, G["~"]): ("SHIFT", 27), + (101, G["string"]): ("SHIFT", 34), + (101, G["("]): ("SHIFT", 11), + (101, G["case"]): ("SHIFT", 21), + (101, G["isvoid"]): ("SHIFT", 24), + (101, G["while"]): ("SHIFT", 13), + (101, G["int"]): ("SHIFT", 33), + (101, G["false"]): ("SHIFT", 26), + (101, G["{"]): ("SHIFT", 10), + (101, G["if"]): ("SHIFT", 12), + (101, G["true"]): ("SHIFT", 25), + (101, G["not"]): ("SHIFT", 30), + (101, G["id"]): ("SHIFT", 31), + (101, G["new"]): ("SHIFT", 22), + (101, G["let"]): ("SHIFT", 14), + (102, G["else"]): ("SHIFT", 103), + (103, G["false"]): ("SHIFT", 26), + (103, G["let"]): ("SHIFT", 14), + (103, G["true"]): ("SHIFT", 25), + (103, G["case"]): ("SHIFT", 21), + (103, G["id"]): ("SHIFT", 31), + (103, G["while"]): ("SHIFT", 13), + (103, G["~"]): ("SHIFT", 27), + (103, G["isvoid"]): ("SHIFT", 24), + (103, G["{"]): ("SHIFT", 10), + (103, G["if"]): ("SHIFT", 12), + (103, G["not"]): ("SHIFT", 30), + (103, G["new"]): ("SHIFT", 22), + (103, G["("]): ("SHIFT", 11), + (103, G["string"]): ("SHIFT", 34), + (103, G["int"]): ("SHIFT", 33), + (104, G["fi"]): ("SHIFT", 105), + (105, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (106, G[")"]): ("SHIFT", 107), + (107, G["/"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["of"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["<"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G[")"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["then"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["<="]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["."]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["else"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["="]): ("REDUCE", G["atom -> ( expr )"]), + (107, G[","]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G[";"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["in"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["@"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["+"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["error"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["-"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["*"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["}"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["}"]): ("SHIFT", 109), + (109, G[","]): ("REDUCE", G["expr -> { block }"]), + (109, G[";"]): ("REDUCE", G["expr -> { block }"]), + (109, G["loop"]): ("REDUCE", G["expr -> { block }"]), + (109, G["of"]): ("REDUCE", G["expr -> { block }"]), + (109, G["pool"]): ("REDUCE", G["expr -> { block }"]), + (109, G[")"]): ("REDUCE", G["expr -> { block }"]), + (109, G["then"]): ("REDUCE", G["expr -> { block }"]), + (109, G["error"]): ("REDUCE", G["expr -> { block }"]), + (109, G["else"]): ("REDUCE", G["expr -> { block }"]), + (109, G["in"]): ("REDUCE", G["expr -> { block }"]), + (109, G["fi"]): ("REDUCE", G["expr -> { block }"]), + (109, G["}"]): ("REDUCE", G["expr -> { block }"]), + (110, G["error"]): ("SHIFT", 113), + (110, G[";"]): ("SHIFT", 111), + (111, G["int"]): ("SHIFT", 33), + (111, G["case"]): ("SHIFT", 21), + (111, G["false"]): ("SHIFT", 26), + (111, G["}"]): ("REDUCE", G["block -> expr ;"]), + (111, G["while"]): ("SHIFT", 13), + (111, G["true"]): ("SHIFT", 25), + (111, G["id"]): ("SHIFT", 31), + (111, G["{"]): ("SHIFT", 10), + (111, G["if"]): ("SHIFT", 12), + (111, G["not"]): ("SHIFT", 30), + (111, G["~"]): ("SHIFT", 27), + (111, G["new"]): ("SHIFT", 22), + (111, G["("]): ("SHIFT", 11), + (111, G["isvoid"]): ("SHIFT", 24), + (111, G["string"]): ("SHIFT", 34), + (111, G["let"]): ("SHIFT", 14), + (112, G["}"]): ("REDUCE", G["block -> expr ; block"]), + (113, G["int"]): ("SHIFT", 33), + (113, G["case"]): ("SHIFT", 21), + (113, G["false"]): ("SHIFT", 26), + (113, G["while"]): ("SHIFT", 13), + (113, G["true"]): ("SHIFT", 25), + (113, G["id"]): ("SHIFT", 31), + (113, G["{"]): ("SHIFT", 10), + (113, G["if"]): ("SHIFT", 12), + (113, G["not"]): ("SHIFT", 30), + (113, G["}"]): ("REDUCE", G["block -> expr error"]), + (113, G["~"]): ("SHIFT", 27), + (113, G["new"]): ("SHIFT", 22), + (113, G["("]): ("SHIFT", 11), + (113, G["isvoid"]): ("SHIFT", 24), + (113, G["string"]): ("SHIFT", 34), + (113, G["let"]): ("SHIFT", 14), + (114, G["}"]): ("REDUCE", G["block -> expr error block"]), + (115, G["}"]): ("SHIFT", 116), + (116, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (116, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (117, G[":"]): ("SHIFT", 118), + (118, G["type"]): ("SHIFT", 119), + (119, G[","]): ("SHIFT", 120), + (119, G[")"]): ("REDUCE", G["param-list -> id : type"]), + (120, G["id"]): ("SHIFT", 117), + (121, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), + (122, G[")"]): ("SHIFT", 123), + (123, G[":"]): ("SHIFT", 124), + (124, G["type"]): ("SHIFT", 125), + (125, G["{"]): ("SHIFT", 126), + (126, G["while"]): ("SHIFT", 13), + (126, G["~"]): ("SHIFT", 27), + (126, G["isvoid"]): ("SHIFT", 24), + (126, G["{"]): ("SHIFT", 10), + (126, G["if"]): ("SHIFT", 12), + (126, G["not"]): ("SHIFT", 30), + (126, G["new"]): ("SHIFT", 22), + (126, G["("]): ("SHIFT", 11), + (126, G["string"]): ("SHIFT", 34), + (126, G["int"]): ("SHIFT", 33), + (126, G["false"]): ("SHIFT", 26), + (126, G["id"]): ("SHIFT", 31), + (126, G["let"]): ("SHIFT", 14), + (126, G["true"]): ("SHIFT", 25), + (126, G["case"]): ("SHIFT", 21), + (127, G["}"]): ("SHIFT", 128), + (128, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (128, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (129, G["type"]): ("SHIFT", 130), + (130, G["<-"]): ("SHIFT", 131), + (130, G["error"]): ("REDUCE", G["attribute -> id : type"]), + (130, G[";"]): ("REDUCE", G["attribute -> id : type"]), + (131, G["int"]): ("SHIFT", 33), + (131, G["case"]): ("SHIFT", 21), + (131, G["false"]): ("SHIFT", 26), + (131, G["while"]): ("SHIFT", 13), + (131, G["true"]): ("SHIFT", 25), + (131, G["id"]): ("SHIFT", 31), + (131, G["{"]): ("SHIFT", 10), + (131, G["if"]): ("SHIFT", 12), + (131, G["not"]): ("SHIFT", 30), + (131, G["~"]): ("SHIFT", 27), + (131, G["new"]): ("SHIFT", 22), + (131, G["("]): ("SHIFT", 11), + (131, G["isvoid"]): ("SHIFT", 24), + (131, G["string"]): ("SHIFT", 34), + (131, G["let"]): ("SHIFT", 14), + (132, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (132, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (133, G["}"]): ("SHIFT", 134), + (134, G[";"]): ("REDUCE", G["class-def -> class type { feature-list }"]), + (135, G[";"]): ("SHIFT", 136), + (135, G["error"]): ("SHIFT", 143), + (136, G["}"]): ("REDUCE", G["feature-list -> e"]), + (136, G["id"]): ("SHIFT", 4), + (137, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), + (138, G["error"]): ("SHIFT", 141), + (138, G[";"]): ("SHIFT", 139), + (139, G["}"]): ("REDUCE", G["feature-list -> e"]), + (139, G["id"]): ("SHIFT", 4), + (140, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), + (141, G["}"]): ("REDUCE", G["feature-list -> e"]), + (141, G["id"]): ("SHIFT", 4), + (142, G["}"]): ("REDUCE", G["feature-list -> method error feature-list"]), + (143, G["}"]): ("REDUCE", G["feature-list -> e"]), + (143, G["id"]): ("SHIFT", 4), + (144, G["}"]): ("REDUCE", G["feature-list -> attribute error feature-list"]), + (145, G["type"]): ("SHIFT", 146), + (146, G["{"]): ("SHIFT", 147), + (147, G["}"]): ("REDUCE", G["feature-list -> e"]), + (147, G["id"]): ("SHIFT", 4), + (148, G["}"]): ("SHIFT", 149), + (149, G[";"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), + (150, G["$"]): ("OK", None), + (151, G["$"]): ("REDUCE", G["program -> class-list"]), + (152, G[";"]): ("SHIFT", 153), + (153, G["class"]): ("SHIFT", 1), + (153, G["$"]): ("REDUCE", G["class-list -> class-def ;"]), + (154, G["$"]): ("REDUCE", G["class-list -> class-def ; class-list"]), + } + + @staticmethod + def __goto_table(): + return { + (0, G["class-def"]): 152, + (0, G["class-list"]): 151, + (0, G["program"]): 150, + (3, G["feature-list"]): 133, + (3, G["attribute"]): 135, + (3, G["method"]): 138, + (5, G["param-list"]): 122, + (9, G["term"]): 53, + (9, G["arith"]): 38, + (9, G["atom"]): 43, + (9, G["factor"]): 56, + (9, G["expr"]): 115, + (9, G["comp"]): 37, + (9, G["function-call"]): 35, + (10, G["term"]): 53, + (10, G["arith"]): 38, + (10, G["expr"]): 110, + (10, G["factor"]): 56, + (10, G["block"]): 108, + (10, G["function-call"]): 35, + (10, G["atom"]): 43, + (10, G["comp"]): 37, + (11, G["function-call"]): 35, + (11, G["term"]): 53, + (11, G["factor"]): 56, + (11, G["atom"]): 43, + (11, G["arith"]): 38, + (11, G["comp"]): 37, + (11, G["expr"]): 106, + (12, G["term"]): 53, + (12, G["atom"]): 43, + (12, G["arith"]): 38, + (12, G["expr"]): 100, + (12, G["factor"]): 56, + (12, G["comp"]): 37, + (12, G["function-call"]): 35, + (13, G["function-call"]): 35, + (13, G["arith"]): 38, + (13, G["term"]): 53, + (13, G["comp"]): 37, + (13, G["expr"]): 96, + (13, G["atom"]): 43, + (13, G["factor"]): 56, + (14, G["declaration-list"]): 93, + (18, G["declaration-list"]): 19, + (20, G["factor"]): 56, + (20, G["term"]): 53, + (20, G["function-call"]): 35, + (20, G["arith"]): 38, + (20, G["atom"]): 43, + (20, G["comp"]): 37, + (20, G["expr"]): 90, + (21, G["arith"]): 38, + (21, G["expr"]): 77, + (21, G["term"]): 53, + (21, G["function-call"]): 35, + (21, G["factor"]): 56, + (21, G["atom"]): 43, + (21, G["comp"]): 37, + (24, G["function-call"]): 35, + (24, G["atom"]): 43, + (24, G["factor"]): 76, + (27, G["factor"]): 75, + (27, G["function-call"]): 35, + (27, G["atom"]): 43, + (29, G["arith"]): 38, + (29, G["expr-list"]): 73, + (29, G["function-call"]): 35, + (29, G["term"]): 53, + (29, G["not-empty-expr-list"]): 49, + (29, G["factor"]): 56, + (29, G["comp"]): 37, + (29, G["atom"]): 43, + (29, G["expr"]): 50, + (30, G["function-call"]): 35, + (30, G["arith"]): 38, + (30, G["term"]): 53, + (30, G["comp"]): 37, + (30, G["atom"]): 43, + (30, G["expr"]): 72, + (30, G["factor"]): 56, + (32, G["function-call"]): 35, + (32, G["arith"]): 38, + (32, G["term"]): 53, + (32, G["expr"]): 36, + (32, G["comp"]): 37, + (32, G["atom"]): 43, + (32, G["factor"]): 56, + (39, G["function-call"]): 35, + (39, G["factor"]): 56, + (39, G["atom"]): 43, + (39, G["term"]): 40, + (41, G["function-call"]): 35, + (41, G["atom"]): 43, + (41, G["factor"]): 42, + (46, G["arith"]): 38, + (46, G["function-call"]): 35, + (46, G["term"]): 53, + (46, G["not-empty-expr-list"]): 49, + (46, G["factor"]): 56, + (46, G["comp"]): 37, + (46, G["atom"]): 43, + (46, G["expr"]): 50, + (46, G["expr-list"]): 47, + (51, G["arith"]): 38, + (51, G["function-call"]): 35, + (51, G["term"]): 53, + (51, G["factor"]): 56, + (51, G["comp"]): 37, + (51, G["atom"]): 43, + (51, G["expr"]): 50, + (51, G["not-empty-expr-list"]): 52, + (54, G["function-call"]): 35, + (54, G["atom"]): 43, + (54, G["factor"]): 55, + (61, G["arith"]): 38, + (61, G["function-call"]): 35, + (61, G["term"]): 53, + (61, G["not-empty-expr-list"]): 49, + (61, G["factor"]): 56, + (61, G["expr-list"]): 62, + (61, G["comp"]): 37, + (61, G["atom"]): 43, + (61, G["expr"]): 50, + (64, G["function-call"]): 35, + (64, G["factor"]): 56, + (64, G["atom"]): 43, + (64, G["term"]): 65, + (66, G["arith"]): 67, + (66, G["factor"]): 56, + (66, G["atom"]): 43, + (66, G["term"]): 53, + (66, G["function-call"]): 35, + (68, G["arith"]): 69, + (68, G["factor"]): 56, + (68, G["atom"]): 43, + (68, G["term"]): 53, + (68, G["function-call"]): 35, + (70, G["arith"]): 71, + (70, G["factor"]): 56, + (70, G["atom"]): 43, + (70, G["term"]): 53, + (70, G["function-call"]): 35, + (78, G["case-list"]): 88, + (82, G["term"]): 53, + (82, G["expr"]): 83, + (82, G["arith"]): 38, + (82, G["factor"]): 56, + (82, G["function-call"]): 35, + (82, G["atom"]): 43, + (82, G["comp"]): 37, + (84, G["case-list"]): 85, + (86, G["case-list"]): 87, + (91, G["declaration-list"]): 92, + (94, G["function-call"]): 35, + (94, G["arith"]): 38, + (94, G["term"]): 53, + (94, G["comp"]): 37, + (94, G["atom"]): 43, + (94, G["expr"]): 95, + (94, G["factor"]): 56, + (97, G["comp"]): 37, + (97, G["arith"]): 38, + (97, G["factor"]): 56, + (97, G["expr"]): 98, + (97, G["term"]): 53, + (97, G["function-call"]): 35, + (97, G["atom"]): 43, + (101, G["term"]): 53, + (101, G["atom"]): 43, + (101, G["arith"]): 38, + (101, G["factor"]): 56, + (101, G["expr"]): 102, + (101, G["function-call"]): 35, + (101, G["comp"]): 37, + (103, G["comp"]): 37, + (103, G["term"]): 53, + (103, G["arith"]): 38, + (103, G["atom"]): 43, + (103, G["function-call"]): 35, + (103, G["expr"]): 104, + (103, G["factor"]): 56, + (111, G["term"]): 53, + (111, G["arith"]): 38, + (111, G["expr"]): 110, + (111, G["factor"]): 56, + (111, G["function-call"]): 35, + (111, G["block"]): 112, + (111, G["atom"]): 43, + (111, G["comp"]): 37, + (113, G["term"]): 53, + (113, G["arith"]): 38, + (113, G["expr"]): 110, + (113, G["factor"]): 56, + (113, G["function-call"]): 35, + (113, G["block"]): 114, + (113, G["atom"]): 43, + (113, G["comp"]): 37, + (120, G["param-list"]): 121, + (126, G["expr"]): 127, + (126, G["term"]): 53, + (126, G["arith"]): 38, + (126, G["atom"]): 43, + (126, G["factor"]): 56, + (126, G["comp"]): 37, + (126, G["function-call"]): 35, + (131, G["term"]): 53, + (131, G["arith"]): 38, + (131, G["factor"]): 56, + (131, G["expr"]): 132, + (131, G["function-call"]): 35, + (131, G["atom"]): 43, + (131, G["comp"]): 37, + (136, G["attribute"]): 135, + (136, G["feature-list"]): 137, + (136, G["method"]): 138, + (139, G["feature-list"]): 140, + (139, G["attribute"]): 135, + (139, G["method"]): 138, + (141, G["feature-list"]): 142, + (141, G["attribute"]): 135, + (141, G["method"]): 138, + (143, G["feature-list"]): 144, + (143, G["attribute"]): 135, + (143, G["method"]): 138, + (147, G["feature-list"]): 148, + (147, G["attribute"]): 135, + (147, G["method"]): 138, + (153, G["class-def"]): 152, + (153, G["class-list"]): 154, + } diff --git a/src/cool/semantics/__init__.py b/src/cool/semantics/__init__.py index 88020cd0a..9c9770569 100644 --- a/src/cool/semantics/__init__.py +++ b/src/cool/semantics/__init__.py @@ -1,9 +1,9 @@ -"""This module contains definitions of classes for make different travels through the AST of a cool program. All -classes defined here follows the visitor pattern using the module visitor, with this we can get a more decoupled -inspection. """ - -from .formatter import CodeBuilder, Formatter -from .type_builder import TypeBuilder -from .type_collector import TypeCollector -from .overridden import OverriddenMethodChecker, topological_sorting -from .type_checker import TypeChecker +"""This module contains definitions of classes for make different travels through the AST of a cool program. All +classes defined here follows the visitor pattern using the module visitor, with this we can get a more decoupled +inspection. """ + +from .formatter import CodeBuilder, Formatter +from .type_builder import TypeBuilder +from .type_collector import TypeCollector +from .overridden import OverriddenMethodChecker, topological_sorting +from .type_checker import TypeChecker diff --git a/src/cool/semantics/execution.py b/src/cool/semantics/execution.py index aff616dd6..cb545cca8 100644 --- a/src/cool/semantics/execution.py +++ b/src/cool/semantics/execution.py @@ -1,351 +1,351 @@ -from typing import Any, Dict - -import cool.semantics.utils.astnodes as ast -import cool.semantics.utils.errors as err -import cool.visitor as visitor -from cool.semantics.utils.scope import Context, Method, Scope, Type, SemanticError - - -class ExecutionError(Exception): - @property - def text(self): - return self.args[0] - - -def abort(obj, context): - print('Aborting Program') - exit() - - -def copy(obj, context): - x_copy = Instance(obj.type, obj.value if obj.type.name in ('Int', 'String', 'Bool') else None) - x_copy.attribute_values = obj.attribute_values - return x_copy - - -def type_name(obj, context): - return Instance(context.get_type('String'), obj.type.name) - - -def out_string(obj, s, context): - print(s.value, end='') - return obj - - -def out_int(obj, s, context): - print(s.value, end='') - return obj - - -def in_string(obj, context): - return Instance(context.get_type('Int'), input()) - - -def in_int(obj, context): - try: - return Instance(context.get_type('Int'), int(input())) - except ValueError: - raise ExecutionError(err.INPUT_INT_ERROR) - - -def length(obj, context): - return Instance(context.get_type('Int'), len(obj.value)) - - -def concat(obj, s, context): - return Instance(context.get_type('String'), obj.value + s.value) - - -def substr(obj, i, l, context): - return Instance(context.get_type('String'), obj.value[i: i + l]) - - -defaults = { - ('Object', 'abort'): abort, - ('Object', 'copy'): copy, - ('Object', 'type_name'): type_name, - ('IO', 'out_string'): out_string, - ('IO', 'out_int'): out_int, - ('IO', 'in_string'): in_string, - ('IO', 'in_int'): in_int, - ('String', 'length'): length, - ('String', 'concat'): concat, - ('String', 'substr'): substr, -} - - -class Instance: - def __init__(self, typex: Type, value: Any = None): - if value is None: - value = id(self) - - self.type: Type = typex - self.value: Any = value - self.attribute_values: Dict[str, Instance] = {} - - def set_attribute_instance(self, name: str, value: 'Instance') -> None: - self.attribute_values[name] = value - - def get_attribute_instance(self, name: str) -> 'Instance': - return self.attribute_values[name] - - def get_method(self, name: str) -> Method: - return self.type.get_method(name) - - def __str__(self): - return f'{self.type.name} {self.value}' - - -class VoidInstance(Instance): - def __init__(self): - super(VoidInstance, self).__init__(None, None) - - def __eq__(self, other): - return isinstance(other, VoidInstance) - - -class Executor: - def __init__(self, context: Context): - self.context: Context = context - self.current_type: Type = None - self.current_instance: Instance = None - self.call_stack: list = [] - - @visitor.on('node') - def visit(self, node, tabs): - pass - - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode, scope: Scope = None): - for declaration in node.declarations: - self.visit(declaration, None) - - try: - main_class = self.context.get_type('Main') - except SemanticError: - raise ExecutionError(err.MAIN_CLASS_NOT_FOUND) - - try: - main_class.get_method('main') - except SemanticError: - raise ExecutionError(err.MAIN_METHOD_NOT_FOUND) - - execution_node = ast.MethodCallNode('main', [], ast.InstantiateNode('Main')) - self.visit(execution_node, scope) - - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode, scope: Scope): - self.current_type = self.context.get_type(node.id) - - attrs = [f for f in node.features if isinstance(f, ast.AttrDeclarationNode)] - methods = [f for f in node.features if isinstance(f, ast.MethodDeclarationNode)] - - for attr in attrs: - self.visit(attr, None) - - for method in methods: - self.visit(method, None) - - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode, scope: Scope): - self.current_type.get_attribute(node.id).expr = node.expr - - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode, scope: Scope): - self.current_type.get_method(node.id).expr = node.body - - @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode, scope: Scope): - default = {'String': '', 'Int': 0, 'Bool': False} - for _id, _type, _expr in node.declarations: - - instance = self.visit(_expr, scope.create_child()) if _expr is not None else VoidInstance() - - if _expr is None and _type in default: - instance = Instance(self.context.get_type(_type), default[_type]) - - scope.define_variable(_id, instance.type).instance = instance - - return self.visit(node.expr, scope.create_child()) - - @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode, scope: Scope): - variable_info = scope.find_variable(node.id) - - if variable_info is None: - self.current_instance.set_attribute_instance(node.id, self.visit(node.expr, scope)) - return self.current_instance.get_attribute_instance(node.id) - - variable_info.instance = self.visit(node.expr, scope) - return variable_info.instance - - @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode, scope: Scope): - child_scope = scope.create_child() - instance = None - for expr in node.expressions: - instance = self.visit(expr, child_scope) - return instance - - @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode, scope: Scope): - if_instance = self.visit(node.if_expr, scope) - - if if_instance.value: - return self.visit(node.then_expr, scope.create_child()) - return self.visit(node.else_expr, scope.create_child()) - - @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode, scope: Scope): - while self.visit(node.condition, scope).value: - self.visit(node.body, scope.create_child()) - return VoidInstance() - - @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode, scope: Scope): - instance = self.visit(node.expr, scope) - - if isinstance(instance, VoidInstance): - raise ExecutionError(err.VOID_EXPRESSION) - - types = [(i, self.context.get_type(t)) for i, (_, t, _) in enumerate(node.cases) - if instance.type.conforms_to(self.context.get_type(t))] - - if not types: - raise ExecutionError(err.CASE_OF_ERROR) - - (index, most_conformable_type), *types = types - for i, t in types: - if t.conforms_to(most_conformable_type): - index, most_conformable_type = i, t - - child_scope = scope.create_child() - name, typex, expr = node.cases[index] - child_scope.define_variable(name, self.context.get_type(typex)).instance = instance - return self.visit(expr, child_scope) - - @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode, scope: Scope): - obj_instance = self.visit(node.obj, scope) - - if isinstance(obj_instance, VoidInstance): - raise ExecutionError(err.VOID_EXPRESSION) - - if obj_instance.type.conforms_to(self.context.get_type('Object')) and ('Object', node.id) in defaults: - args = (obj_instance,) + tuple(self.visit(arg, scope) for arg in node.args) + (self.context,) - return defaults['Object', node.id](*args) - - if obj_instance.type.conforms_to(self.context.get_type('IO')) and ('IO', node.id) in defaults: - args = (obj_instance,) + tuple(self.visit(arg, scope) for arg in node.args) + (self.context,) - return defaults['IO', node.id](*args) - - if obj_instance.type.conforms_to(self.context.get_type('String')) and ('String', node.id) in defaults: - args = (obj_instance,) + tuple(self.visit(arg, scope) for arg in node.args) + (self.context,) - return defaults['String', node.id](*args) - - new_scope = Scope() - - method = obj_instance.get_method(node.id) - new_scope.define_variable('self', obj_instance.type).instance = obj_instance - for name, typex, arg in zip(method.param_names, method.param_types, node.args): - new_scope.define_variable(name, typex).instance = self.visit(arg, scope) - - self.call_stack.append(self.current_instance) - self.current_instance = obj_instance - output = self.visit(method.expr, new_scope) - self.current_instance = self.call_stack.pop() - return output - - @visitor.when(ast.IntegerNode) - def visit(self, node: ast.IntegerNode, scope: Scope): - return Instance(self.context.get_type('Int'), int(node.lex)) - - @visitor.when(ast.StringNode) - def visit(self, node: ast.StringNode, scope: Scope): - return Instance(self.context.get_type('String'), str(node.lex[1:-1].replace('\\n', '\n'))) - - @visitor.when(ast.BooleanNode) - def visit(self, node: ast.BooleanNode, scope: Scope): - return Instance(self.context.get_type('Bool'), True if node.lex == 'true' else False) - - @visitor.when(ast.VariableNode) - def visit(self, node: ast.VariableNode, scope: Scope): - variable_info = scope.find_variable(node.lex) - if variable_info is not None: - return variable_info.instance - else: - return self.current_instance.get_attribute_instance(node.lex) - - @visitor.when(ast.InstantiateNode) - def visit(self, node: ast.InstantiateNode, scope: Scope): - default = None - if node.lex == 'String': - default = '' - elif node.lex == 'Int': - default = 0 - elif node.lex == 'Bool': - default = False - - instance = Instance(self.context.get_type(node.lex), default) - self.call_stack.append(self.current_instance) - self.current_instance = instance - fake_scope = Scope() - for attr, _ in instance.type.all_attributes(): - attr_instance = self.visit(attr.expr, fake_scope) if attr.expr is not None else VoidInstance() - fake_scope.define_variable(attr.name, attr.type).instance = attr_instance - self.current_instance.set_attribute_instance(attr.name, attr_instance) - self.current_instance = self.call_stack.pop() - return instance - - @visitor.when(ast.NegationNode) - def visit(self, node: ast.NegationNode, scope: Scope): - value = not self.visit(node.expr, scope).value - return Instance(self.context.get_type('Bool'), value) - - @visitor.when(ast.ComplementNode) - def visit(self, node: ast.ComplementNode, scope: Scope): - value = ~ self.visit(node.expr, scope).value - return Instance(self.context.get_type('Int'), value) - - @visitor.when(ast.IsVoidNode) - def visit(self, node: ast.IsVoidNode, scope: Scope): - value = isinstance(self.visit(node.expr, scope), VoidInstance) - return Instance(self.context.get_type('Bool'), value) - - @visitor.when(ast.PlusNode) - def visit(self, node: ast.PlusNode, scope: Scope): - value = self.visit(node.left, scope).value + self.visit(node.right, scope).value - return Instance(self.context.get_type('Int'), value) - - @visitor.when(ast.MinusNode) - def visit(self, node: ast.MinusNode, scope: Scope): - value = self.visit(node.left, scope).value - self.visit(node.right, scope).value - return Instance(self.context.get_type('Int'), value) - - @visitor.when(ast.StarNode) - def visit(self, node: ast.StarNode, scope: Scope): - value = self.visit(node.left, scope).value * self.visit(node.right, scope).value - return Instance(self.context.get_type('Int'), value) - - @visitor.when(ast.DivNode) - def visit(self, node: ast.DivNode, scope: Scope): - try: - value = self.visit(node.left, scope).value / self.visit(node.right, scope).value - return Instance(self.context.get_type('Int'), value) - except ZeroDivisionError: - raise ExecutionError(err.DIVIDE_BY_ZERO) - - @visitor.when(ast.LessEqualNode) - def visit(self, node: ast.LessEqualNode, scope: Scope): - value = self.visit(node.left, scope).value <= self.visit(node.right, scope).value - return Instance(self.context.get_type('Bool'), value) - - @visitor.when(ast.LessThanNode) - def visit(self, node: ast.LessThanNode, scope: Scope): - value = self.visit(node.left, scope).value < self.visit(node.right, scope).value - return Instance(self.context.get_type('Bool'), value) - - @visitor.when(ast.EqualNode) - def visit(self, node: ast.EqualNode, scope: Scope): - value = self.visit(node.left, scope).value == self.visit(node.right, scope).value - return Instance(self.context.get_type('Bool'), value) +from typing import Any, Dict + +import cool.semantics.utils.astnodes as ast +import cool.semantics.utils.errors as err +import cool.visitor as visitor +from cool.semantics.utils.scope import Context, Method, Scope, Type, SemanticError + + +class ExecutionError(Exception): + @property + def text(self): + return self.args[0] + + +def abort(obj, context): + print('Aborting Program') + exit() + + +def copy(obj, context): + x_copy = Instance(obj.type, obj.value if obj.type.name in ('Int', 'String', 'Bool') else None) + x_copy.attribute_values = obj.attribute_values + return x_copy + + +def type_name(obj, context): + return Instance(context.get_type('String'), obj.type.name) + + +def out_string(obj, s, context): + print(s.value, end='') + return obj + + +def out_int(obj, s, context): + print(s.value, end='') + return obj + + +def in_string(obj, context): + return Instance(context.get_type('Int'), input()) + + +def in_int(obj, context): + try: + return Instance(context.get_type('Int'), int(input())) + except ValueError: + raise ExecutionError(err.INPUT_INT_ERROR) + + +def length(obj, context): + return Instance(context.get_type('Int'), len(obj.value)) + + +def concat(obj, s, context): + return Instance(context.get_type('String'), obj.value + s.value) + + +def substr(obj, i, l, context): + return Instance(context.get_type('String'), obj.value[i: i + l]) + + +defaults = { + ('Object', 'abort'): abort, + ('Object', 'copy'): copy, + ('Object', 'type_name'): type_name, + ('IO', 'out_string'): out_string, + ('IO', 'out_int'): out_int, + ('IO', 'in_string'): in_string, + ('IO', 'in_int'): in_int, + ('String', 'length'): length, + ('String', 'concat'): concat, + ('String', 'substr'): substr, +} + + +class Instance: + def __init__(self, typex: Type, value: Any = None): + if value is None: + value = id(self) + + self.type: Type = typex + self.value: Any = value + self.attribute_values: Dict[str, Instance] = {} + + def set_attribute_instance(self, name: str, value: 'Instance') -> None: + self.attribute_values[name] = value + + def get_attribute_instance(self, name: str) -> 'Instance': + return self.attribute_values[name] + + def get_method(self, name: str) -> Method: + return self.type.get_method(name) + + def __str__(self): + return f'{self.type.name} {self.value}' + + +class VoidInstance(Instance): + def __init__(self): + super(VoidInstance, self).__init__(None, None) + + def __eq__(self, other): + return isinstance(other, VoidInstance) + + +class Executor: + def __init__(self, context: Context): + self.context: Context = context + self.current_type: Type = None + self.current_instance: Instance = None + self.call_stack: list = [] + + @visitor.on('node') + def visit(self, node, tabs): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode, scope: Scope = None): + for declaration in node.declarations: + self.visit(declaration, None) + + try: + main_class = self.context.get_type('Main') + except SemanticError: + raise ExecutionError(err.MAIN_CLASS_NOT_FOUND) + + try: + main_class.get_method('main') + except SemanticError: + raise ExecutionError(err.MAIN_METHOD_NOT_FOUND) + + execution_node = ast.MethodCallNode('main', [], ast.InstantiateNode('Main')) + self.visit(execution_node, scope) + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode, scope: Scope): + self.current_type = self.context.get_type(node.id) + + attrs = [f for f in node.features if isinstance(f, ast.AttrDeclarationNode)] + methods = [f for f in node.features if isinstance(f, ast.MethodDeclarationNode)] + + for attr in attrs: + self.visit(attr, None) + + for method in methods: + self.visit(method, None) + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode, scope: Scope): + self.current_type.get_attribute(node.id).expr = node.expr + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode, scope: Scope): + self.current_type.get_method(node.id).expr = node.body + + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode, scope: Scope): + default = {'String': '', 'Int': 0, 'Bool': False} + for _id, _type, _expr in node.declarations: + + instance = self.visit(_expr, scope.create_child()) if _expr is not None else VoidInstance() + + if _expr is None and _type in default: + instance = Instance(self.context.get_type(_type), default[_type]) + + scope.define_variable(_id, instance.type).instance = instance + + return self.visit(node.expr, scope.create_child()) + + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode, scope: Scope): + variable_info = scope.find_variable(node.id) + + if variable_info is None: + self.current_instance.set_attribute_instance(node.id, self.visit(node.expr, scope)) + return self.current_instance.get_attribute_instance(node.id) + + variable_info.instance = self.visit(node.expr, scope) + return variable_info.instance + + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode, scope: Scope): + child_scope = scope.create_child() + instance = None + for expr in node.expressions: + instance = self.visit(expr, child_scope) + return instance + + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode, scope: Scope): + if_instance = self.visit(node.if_expr, scope) + + if if_instance.value: + return self.visit(node.then_expr, scope.create_child()) + return self.visit(node.else_expr, scope.create_child()) + + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode, scope: Scope): + while self.visit(node.condition, scope).value: + self.visit(node.body, scope.create_child()) + return VoidInstance() + + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode, scope: Scope): + instance = self.visit(node.expr, scope) + + if isinstance(instance, VoidInstance): + raise ExecutionError(err.VOID_EXPRESSION) + + types = [(i, self.context.get_type(t)) for i, (_, t, _) in enumerate(node.cases) + if instance.type.conforms_to(self.context.get_type(t))] + + if not types: + raise ExecutionError(err.CASE_OF_ERROR) + + (index, most_conformable_type), *types = types + for i, t in types: + if t.conforms_to(most_conformable_type): + index, most_conformable_type = i, t + + child_scope = scope.create_child() + name, typex, expr = node.cases[index] + child_scope.define_variable(name, self.context.get_type(typex)).instance = instance + return self.visit(expr, child_scope) + + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode, scope: Scope): + obj_instance = self.visit(node.obj, scope) + + if isinstance(obj_instance, VoidInstance): + raise ExecutionError(err.VOID_EXPRESSION) + + if obj_instance.type.conforms_to(self.context.get_type('Object')) and ('Object', node.id) in defaults: + args = (obj_instance,) + tuple(self.visit(arg, scope) for arg in node.args) + (self.context,) + return defaults['Object', node.id](*args) + + if obj_instance.type.conforms_to(self.context.get_type('IO')) and ('IO', node.id) in defaults: + args = (obj_instance,) + tuple(self.visit(arg, scope) for arg in node.args) + (self.context,) + return defaults['IO', node.id](*args) + + if obj_instance.type.conforms_to(self.context.get_type('String')) and ('String', node.id) in defaults: + args = (obj_instance,) + tuple(self.visit(arg, scope) for arg in node.args) + (self.context,) + return defaults['String', node.id](*args) + + new_scope = Scope() + + method = obj_instance.get_method(node.id) + new_scope.define_variable('self', obj_instance.type).instance = obj_instance + for name, typex, arg in zip(method.param_names, method.param_types, node.args): + new_scope.define_variable(name, typex).instance = self.visit(arg, scope) + + self.call_stack.append(self.current_instance) + self.current_instance = obj_instance + output = self.visit(method.expr, new_scope) + self.current_instance = self.call_stack.pop() + return output + + @visitor.when(ast.IntegerNode) + def visit(self, node: ast.IntegerNode, scope: Scope): + return Instance(self.context.get_type('Int'), int(node.lex)) + + @visitor.when(ast.StringNode) + def visit(self, node: ast.StringNode, scope: Scope): + return Instance(self.context.get_type('String'), str(node.lex[1:-1].replace('\\n', '\n'))) + + @visitor.when(ast.BooleanNode) + def visit(self, node: ast.BooleanNode, scope: Scope): + return Instance(self.context.get_type('Bool'), True if node.lex == 'true' else False) + + @visitor.when(ast.VariableNode) + def visit(self, node: ast.VariableNode, scope: Scope): + variable_info = scope.find_variable(node.lex) + if variable_info is not None: + return variable_info.instance + else: + return self.current_instance.get_attribute_instance(node.lex) + + @visitor.when(ast.InstantiateNode) + def visit(self, node: ast.InstantiateNode, scope: Scope): + default = None + if node.lex == 'String': + default = '' + elif node.lex == 'Int': + default = 0 + elif node.lex == 'Bool': + default = False + + instance = Instance(self.context.get_type(node.lex), default) + self.call_stack.append(self.current_instance) + self.current_instance = instance + fake_scope = Scope() + for attr, _ in instance.type.all_attributes(): + attr_instance = self.visit(attr.expr, fake_scope) if attr.expr is not None else VoidInstance() + fake_scope.define_variable(attr.name, attr.type).instance = attr_instance + self.current_instance.set_attribute_instance(attr.name, attr_instance) + self.current_instance = self.call_stack.pop() + return instance + + @visitor.when(ast.NegationNode) + def visit(self, node: ast.NegationNode, scope: Scope): + value = not self.visit(node.expr, scope).value + return Instance(self.context.get_type('Bool'), value) + + @visitor.when(ast.ComplementNode) + def visit(self, node: ast.ComplementNode, scope: Scope): + value = ~ self.visit(node.expr, scope).value + return Instance(self.context.get_type('Int'), value) + + @visitor.when(ast.IsVoidNode) + def visit(self, node: ast.IsVoidNode, scope: Scope): + value = isinstance(self.visit(node.expr, scope), VoidInstance) + return Instance(self.context.get_type('Bool'), value) + + @visitor.when(ast.PlusNode) + def visit(self, node: ast.PlusNode, scope: Scope): + value = self.visit(node.left, scope).value + self.visit(node.right, scope).value + return Instance(self.context.get_type('Int'), value) + + @visitor.when(ast.MinusNode) + def visit(self, node: ast.MinusNode, scope: Scope): + value = self.visit(node.left, scope).value - self.visit(node.right, scope).value + return Instance(self.context.get_type('Int'), value) + + @visitor.when(ast.StarNode) + def visit(self, node: ast.StarNode, scope: Scope): + value = self.visit(node.left, scope).value * self.visit(node.right, scope).value + return Instance(self.context.get_type('Int'), value) + + @visitor.when(ast.DivNode) + def visit(self, node: ast.DivNode, scope: Scope): + try: + value = self.visit(node.left, scope).value / self.visit(node.right, scope).value + return Instance(self.context.get_type('Int'), value) + except ZeroDivisionError: + raise ExecutionError(err.DIVIDE_BY_ZERO) + + @visitor.when(ast.LessEqualNode) + def visit(self, node: ast.LessEqualNode, scope: Scope): + value = self.visit(node.left, scope).value <= self.visit(node.right, scope).value + return Instance(self.context.get_type('Bool'), value) + + @visitor.when(ast.LessThanNode) + def visit(self, node: ast.LessThanNode, scope: Scope): + value = self.visit(node.left, scope).value < self.visit(node.right, scope).value + return Instance(self.context.get_type('Bool'), value) + + @visitor.when(ast.EqualNode) + def visit(self, node: ast.EqualNode, scope: Scope): + value = self.visit(node.left, scope).value == self.visit(node.right, scope).value + return Instance(self.context.get_type('Bool'), value) diff --git a/src/cool/semantics/formatter.py b/src/cool/semantics/formatter.py index 09e83c766..52efa7449 100644 --- a/src/cool/semantics/formatter.py +++ b/src/cool/semantics/formatter.py @@ -1,217 +1,217 @@ -import cool.semantics.utils.astnodes as ast -import cool.visitor as visitor - - -class CodeBuilder: - @visitor.on('node') - def visit(self, node, tabs): - pass - - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode, tabs: int = 0): - return '\n\n'.join(self.visit(child, tabs) for child in node.declarations) - - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode, tabs: int = 0): - parent = '' if node.parent is None else f"inherits {node.parent} " - return (f'class {node.id} {parent}{{\n' + - '\n\n'.join(self.visit(child, tabs + 1) for child in node.features) + - '\n}') - - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode, tabs: int = 0): - expr = f' <- {self.visit(node.expr, 0)}' if node.expr is not None else '' - return ' ' * tabs + f'{node.id}: {node.type}{expr};' - - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode, tabs: int = 0): - params = ', '.join(': '.join(param) for param in node.params) - ans = ' ' * tabs + f'{node.id} ({params}): {node.return_type}' - body = self.visit(node.body, tabs + 1) - return f'{ans} {{\n{body}\n }};' - - @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode, tabs: int = 0): - declarations = [] - for _id, _type, _expr in node.declarations: - if _expr is not None: - declarations.append(f'{_id}: {_type} <- {self.visit(_expr)}') - else: - declarations.append(f'{_id} : {_type}') - declarations = (',\n' + ' ' * (tabs + 1)).join(declarations) - return ' ' * tabs + f'let {declarations} in\n{self.visit(node.expr, tabs + 1)}' - - @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode, tabs: int = 0): - return ' ' * tabs + f'{node.id} <- {self.visit(node.expr)}' - - @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode, tabs: int = 0): - body = ';\n'.join(self.visit(child, tabs + 1) for child in node.expressions) - return ' ' * tabs + f'{{\n{body};\n' + ' ' * tabs + '}' - - @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode, tabs: int = 0): - ifx = self.visit(node.if_expr) - then = self.visit(node.then_expr, tabs + 1) - elsex = self.visit(node.else_expr, tabs + 1) - - return (' ' * tabs + f'if {ifx}\n' + - ' ' * tabs + f'then\n{then}\n' + - ' ' * tabs + f'else\n{elsex}\n' + - ' ' * tabs + 'fi') - - @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode, tabs: int = 0): - condition = self.visit(node.condition, 0) - body = self.visit(node.body, tabs + 1) - - return ' ' * tabs + f'while {condition} loop\n {body}\n' + ' ' * tabs + 'pool' - - @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode, tabs: int = 0): - cases = [] - for _id, _type, _expr in node.cases: - expr = self.visit(_expr, tabs + 2) - cases.append(' ' * (tabs + 1) + f'{_id} : {_type} =>\n{expr};') - expr = self.visit(node.expr) - cases = '\n'.join(cases) - - return ' ' * tabs + f'case {expr} of\n{cases}\n' + ' ' * tabs + 'esac' - - @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode, tabs: int = 0): - obj = f'{self.visit(node.obj, 0)}.' if node.obj is not None else '' - return ' ' * tabs + f'{obj}{node.id}({", ".join(self.visit(arg, 0) for arg in node.args)})' - - @visitor.when(ast.BinaryNode) - def visit(self, node: ast.BinaryNode, tabs: int = 0): - left = self.visit(node.left) if isinstance(node.left, ast.BinaryNode) else self.visit(node.left, tabs) - right = self.visit(node.right) - return f'{left} {node.operation} {right}' - - @visitor.when(ast.AtomicNode) - def visit(self, node: ast.AtomicNode, tabs: int = 0): - lex = node.lex - return ' ' * tabs + f'{lex}' - - @visitor.when(ast.InstantiateNode) - def visit(self, node: ast.InstantiateNode, tabs: int = 0): - return ' ' * tabs + f'(new {node.lex})' - - -class Formatter: - @visitor.on('node') - def visit(self, node, tabs): - pass - - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode, tabs: int = 0): - ans = ' ' * tabs + f'\\__ProgramNode [ ... ]' - statements = '\n'.join(self.visit(child, tabs + 1) for child in node.declarations) - return f'{ans}\n{statements}' - - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode, tabs: int = 0): - parent = '' if node.parent is None else f": {node.parent}" - ans = ' ' * 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(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode, tabs: int = 0): - ans = ' ' * tabs + f'\\__AttrDeclarationNode: {node.id} : {node.type}' - return f'{ans}' - - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode, tabs: int = 0): - params = ', '.join(':'.join(param) for param in node.params) - ans = ' ' * tabs + f'\\__FuncDeclarationNode: {node.id}({params}) : {node.return_type} -> ' - body = self.visit(node.body, tabs + 1) - return f'{ans}\n{body}' - - @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode, tabs: int = 0): - declarations = [] - for _id, _type, _expr in node.declarations: - if _expr is not None: - declarations.append(' ' * tabs + f'\\__VarDeclarationNode: {_id}: {_type} <-\n{self.visit(_expr, tabs + 1)}') - else: - declarations.append(' ' * tabs + f'\\__VarDeclarationNode: {_id} : {_type}') - - declarations = '\n'.join(declarations) - ans = ' ' * tabs + f'\\__LetNode: let' - expr = self.visit(node.expr, tabs + 2) - return f'{ans}\n {declarations}\n' + ' ' * (tabs + 1) + 'in\n' + f'{expr}' - - @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode, tabs: int = 0): - ans = ' ' * tabs + f'\\__AssignNode: {node.id} <- ' - expr = self.visit(node.expr, tabs + 1) - return f'{ans}\n{expr}' - - @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode, tabs: int = 0): - ans = ' ' * tabs + f'\\__BlockNode:' - body = '\n'.join(self.visit(child, tabs + 1) for child in node.expressions) - return f'{ans}\n{body}' - - @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode, tabs: int = 0): - ifx = self.visit(node.if_expr, tabs + 2) - then = self.visit(node.then_expr, tabs + 2) - elsex = self.visit(node.else_expr, tabs + 2) - - return '\n'.join([ - ' ' * tabs + f'\\__IfThenElseNode: if then else fi', - ' ' * (tabs + 1) + f'\\__if \n{ifx}', - ' ' * (tabs + 1) + f'\\__then \n{then}', - ' ' * (tabs + 1) + f'\\__else \n{elsex}', - ]) - - @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode, tabs: int = 0): - condition = self.visit(node.condition, tabs + 2) - body = self.visit(node.body, tabs + 2) - - return '\n'.join([ - ' ' * tabs + f'\\__WhileNode: while loop pool', - ' ' * (tabs + 1) + f'\\__while \n{condition}', - ' ' * (tabs + 1) + f'\\__loop \n{body}', - ]) - - @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode, tabs: int = 0): - cases = [] - for _id, _type, _expr in node.cases: - expr = self.visit(_expr, tabs + 3) - cases.append(' ' * tabs + f'\\__CaseNode: {_id} : {_type} =>\n{expr}') - expr = self.visit(node.expr, tabs + 2) - cases = '\n'.join(cases) - - return '\n'.join([ - ' ' * tabs + f'\\__SwitchCaseNode: case of [ ... ] esac', - ' ' * (tabs + 1) + f'\\__case \n{expr} of', - ]) + '\n' + cases - - @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode, tabs: int = 0): - obj = self.visit(node.obj, tabs + 1) - ans = ' ' * 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(ast.BinaryNode) - def visit(self, node: ast.BinaryNode, tabs: int = 0): - ans = ' ' * 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(ast.AtomicNode) - def visit(self, node: ast.AtomicNode, tabs: int = 0): - return ' ' * tabs + f'\\__ {node.__class__.__name__}: {node.lex}' - - @visitor.when(ast.InstantiateNode) - def visit(self, node: ast.InstantiateNode, tabs: int = 0): - return ' ' * tabs + f'\\__ InstantiateNode: new {node.lex}()' +import cool.semantics.utils.astnodes as ast +import cool.visitor as visitor + + +class CodeBuilder: + @visitor.on('node') + def visit(self, node, tabs): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode, tabs: int = 0): + return '\n\n'.join(self.visit(child, tabs) for child in node.declarations) + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode, tabs: int = 0): + parent = '' if node.parent is None else f"inherits {node.parent} " + return (f'class {node.id} {parent}{{\n' + + '\n\n'.join(self.visit(child, tabs + 1) for child in node.features) + + '\n}') + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode, tabs: int = 0): + expr = f' <- {self.visit(node.expr, 0)}' if node.expr is not None else '' + return ' ' * tabs + f'{node.id}: {node.type}{expr};' + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode, tabs: int = 0): + params = ', '.join(': '.join(param) for param in node.params) + ans = ' ' * tabs + f'{node.id} ({params}): {node.return_type}' + body = self.visit(node.body, tabs + 1) + return f'{ans} {{\n{body}\n }};' + + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode, tabs: int = 0): + declarations = [] + for _id, _type, _expr in node.declarations: + if _expr is not None: + declarations.append(f'{_id}: {_type} <- {self.visit(_expr)}') + else: + declarations.append(f'{_id} : {_type}') + declarations = (',\n' + ' ' * (tabs + 1)).join(declarations) + return ' ' * tabs + f'let {declarations} in\n{self.visit(node.expr, tabs + 1)}' + + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode, tabs: int = 0): + return ' ' * tabs + f'{node.id} <- {self.visit(node.expr)}' + + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode, tabs: int = 0): + body = ';\n'.join(self.visit(child, tabs + 1) for child in node.expressions) + return ' ' * tabs + f'{{\n{body};\n' + ' ' * tabs + '}' + + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode, tabs: int = 0): + ifx = self.visit(node.if_expr) + then = self.visit(node.then_expr, tabs + 1) + elsex = self.visit(node.else_expr, tabs + 1) + + return (' ' * tabs + f'if {ifx}\n' + + ' ' * tabs + f'then\n{then}\n' + + ' ' * tabs + f'else\n{elsex}\n' + + ' ' * tabs + 'fi') + + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode, tabs: int = 0): + condition = self.visit(node.condition, 0) + body = self.visit(node.body, tabs + 1) + + return ' ' * tabs + f'while {condition} loop\n {body}\n' + ' ' * tabs + 'pool' + + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode, tabs: int = 0): + cases = [] + for _id, _type, _expr in node.cases: + expr = self.visit(_expr, tabs + 2) + cases.append(' ' * (tabs + 1) + f'{_id} : {_type} =>\n{expr};') + expr = self.visit(node.expr) + cases = '\n'.join(cases) + + return ' ' * tabs + f'case {expr} of\n{cases}\n' + ' ' * tabs + 'esac' + + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode, tabs: int = 0): + obj = f'{self.visit(node.obj, 0)}.' if node.obj is not None else '' + return ' ' * tabs + f'{obj}{node.id}({", ".join(self.visit(arg, 0) for arg in node.args)})' + + @visitor.when(ast.BinaryNode) + def visit(self, node: ast.BinaryNode, tabs: int = 0): + left = self.visit(node.left) if isinstance(node.left, ast.BinaryNode) else self.visit(node.left, tabs) + right = self.visit(node.right) + return f'{left} {node.operation} {right}' + + @visitor.when(ast.AtomicNode) + def visit(self, node: ast.AtomicNode, tabs: int = 0): + lex = node.lex + return ' ' * tabs + f'{lex}' + + @visitor.when(ast.InstantiateNode) + def visit(self, node: ast.InstantiateNode, tabs: int = 0): + return ' ' * tabs + f'(new {node.lex})' + + +class Formatter: + @visitor.on('node') + def visit(self, node, tabs): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode, tabs: int = 0): + ans = ' ' * tabs + f'\\__ProgramNode [ ... ]' + statements = '\n'.join(self.visit(child, tabs + 1) for child in node.declarations) + return f'{ans}\n{statements}' + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode, tabs: int = 0): + parent = '' if node.parent is None else f": {node.parent}" + ans = ' ' * 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(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode, tabs: int = 0): + ans = ' ' * tabs + f'\\__AttrDeclarationNode: {node.id} : {node.type}' + return f'{ans}' + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode, tabs: int = 0): + params = ', '.join(':'.join(param) for param in node.params) + ans = ' ' * tabs + f'\\__FuncDeclarationNode: {node.id}({params}) : {node.return_type} -> ' + body = self.visit(node.body, tabs + 1) + return f'{ans}\n{body}' + + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode, tabs: int = 0): + declarations = [] + for _id, _type, _expr in node.declarations: + if _expr is not None: + declarations.append(' ' * tabs + f'\\__VarDeclarationNode: {_id}: {_type} <-\n{self.visit(_expr, tabs + 1)}') + else: + declarations.append(' ' * tabs + f'\\__VarDeclarationNode: {_id} : {_type}') + + declarations = '\n'.join(declarations) + ans = ' ' * tabs + f'\\__LetNode: let' + expr = self.visit(node.expr, tabs + 2) + return f'{ans}\n {declarations}\n' + ' ' * (tabs + 1) + 'in\n' + f'{expr}' + + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode, tabs: int = 0): + ans = ' ' * tabs + f'\\__AssignNode: {node.id} <- ' + expr = self.visit(node.expr, tabs + 1) + return f'{ans}\n{expr}' + + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode, tabs: int = 0): + ans = ' ' * tabs + f'\\__BlockNode:' + body = '\n'.join(self.visit(child, tabs + 1) for child in node.expressions) + return f'{ans}\n{body}' + + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode, tabs: int = 0): + ifx = self.visit(node.if_expr, tabs + 2) + then = self.visit(node.then_expr, tabs + 2) + elsex = self.visit(node.else_expr, tabs + 2) + + return '\n'.join([ + ' ' * tabs + f'\\__IfThenElseNode: if then else fi', + ' ' * (tabs + 1) + f'\\__if \n{ifx}', + ' ' * (tabs + 1) + f'\\__then \n{then}', + ' ' * (tabs + 1) + f'\\__else \n{elsex}', + ]) + + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode, tabs: int = 0): + condition = self.visit(node.condition, tabs + 2) + body = self.visit(node.body, tabs + 2) + + return '\n'.join([ + ' ' * tabs + f'\\__WhileNode: while loop pool', + ' ' * (tabs + 1) + f'\\__while \n{condition}', + ' ' * (tabs + 1) + f'\\__loop \n{body}', + ]) + + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode, tabs: int = 0): + cases = [] + for _id, _type, _expr in node.cases: + expr = self.visit(_expr, tabs + 3) + cases.append(' ' * tabs + f'\\__CaseNode: {_id} : {_type} =>\n{expr}') + expr = self.visit(node.expr, tabs + 2) + cases = '\n'.join(cases) + + return '\n'.join([ + ' ' * tabs + f'\\__SwitchCaseNode: case of [ ... ] esac', + ' ' * (tabs + 1) + f'\\__case \n{expr} of', + ]) + '\n' + cases + + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode, tabs: int = 0): + obj = self.visit(node.obj, tabs + 1) + ans = ' ' * 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(ast.BinaryNode) + def visit(self, node: ast.BinaryNode, tabs: int = 0): + ans = ' ' * 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(ast.AtomicNode) + def visit(self, node: ast.AtomicNode, tabs: int = 0): + return ' ' * tabs + f'\\__ {node.__class__.__name__}: {node.lex}' + + @visitor.when(ast.InstantiateNode) + def visit(self, node: ast.InstantiateNode, tabs: int = 0): + return ' ' * tabs + f'\\__ InstantiateNode: new {node.lex}()' diff --git a/src/cool/semantics/overridden.py b/src/cool/semantics/overridden.py index 009fed3e4..fd0f6e07b 100644 --- a/src/cool/semantics/overridden.py +++ b/src/cool/semantics/overridden.py @@ -1,107 +1,107 @@ -from typing import List, Dict, Optional - -import cool.semantics.utils.astnodes as ast -import cool.semantics.utils.errors as err -import cool.visitor as visitor -from cool.semantics.utils.scope import Context, Type, SemanticError - - -def topological_sorting(program_node: ast.ProgramNode, - context: Context, - errors: List[str]) -> ast.ProgramNode: - """Set an order in the program node of de ast such that for all class A with parent B, class B is before A in the - list, if in the process is detected a cycle an error is added to the `error` parameter - - :param program_node: Root of the first AST of the program - - :param context: Context With all collected and building types - - :param errors: The error list - - :return: a new AST where all declared class are in topological order""" - - types = context.types - - graph: Dict[str, List[str]] = {name: [] for name in types if name not in ('SELF_TYPE', 'AUTO_TYPE')} - - for name, typex in types.items(): - if name in ('Object', 'SELF_TYPE', 'AUTO_TYPE'): - continue - graph[typex.parent.name].append(name) - - order = [] - visited = set() - stack = ['Object'] - - while stack: - current_name = stack.pop() - - if current_name in visited: - errors.append(f'DependencyError: Circular class dependency involving class {current_name}.') - - visited.add(current_name) - stack += graph[current_name] - order.append(current_name) - - if len(visited) != len(graph): - types_names = set(x for x in context.types if x not in ('SELF_TYPE', 'AUTO_TYPE')) - exclude_type_names = types_names - visited - errors.append(f'DependencyError: Circular class dependency ' - f'involving class {sorted(exclude_type_names, reverse=True).pop()}.') - - declarations = {d.id: d for d in program_node.declarations} - program_node.declarations = [declarations[name] for name in order if - name not in ('Object', 'Int', 'IO', 'String', 'Bool')] - - return program_node - - -class OverriddenMethodChecker: - """This visitor for validate the signature of the overridden methods - - Params - ------ - - syntactic_and_semantic_errors: List[str] is a list of syntactic_and_semantic_errors detected in the ast travel - - context: Context the context for keeping the classes - - current_type: Optional[Type] is the current type in the building process""" - - def __init__(self, context: Context, errors: List[str]): - self.context: Context = context - self.current_type: Optional[Type] = None - self.errors: List[str] = errors - - @visitor.on('node') - def visit(self, node): - pass - - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode): - for declaration in node.declarations: - self.visit(declaration) - - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode): - self.current_type = self.context.get_type(node.id) - - for feature in node.features: - if isinstance(feature, ast.MethodDeclarationNode): - self.visit(feature) - - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode): - try: - attribute, owner = self.current_type.parent.get_attribute(node.id) - self.errors.append(err.ATTRIBUTE_OVERRIDE_ERROR % (attribute.name, owner.name)) - except SemanticError: - pass - - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode): - # TODO: Change the comparison overriding - current_method = self.current_type.get_method(node.id) - try: - method, owner = self.current_type.parent.get_method(node.id, get_owner=True) - if method != current_method: - self.errors.append(err.METHOD_OVERRIDE_ERROR % (node.id, owner.name)) - except SemanticError: - pass +from typing import List, Dict, Optional + +import cool.semantics.utils.astnodes as ast +import cool.semantics.utils.errors as err +import cool.visitor as visitor +from cool.semantics.utils.scope import Context, Type, SemanticError + + +def topological_sorting(program_node: ast.ProgramNode, + context: Context, + errors: List[str]) -> ast.ProgramNode: + """Set an order in the program node of de ast such that for all class A with parent B, class B is before A in the + list, if in the process is detected a cycle an error is added to the `error` parameter + + :param program_node: Root of the first AST of the program + + :param context: Context With all collected and building types + + :param errors: The error list + + :return: a new AST where all declared class are in topological order""" + + types = context.types + + graph: Dict[str, List[str]] = {name: [] for name in types if name not in ('SELF_TYPE', 'AUTO_TYPE')} + + for name, typex in types.items(): + if name in ('Object', 'SELF_TYPE', 'AUTO_TYPE'): + continue + graph[typex.parent.name].append(name) + + order = [] + visited = set() + stack = ['Object'] + + while stack: + current_name = stack.pop() + + if current_name in visited: + errors.append(f'DependencyError: Circular class dependency involving class {current_name}.') + + visited.add(current_name) + stack += graph[current_name] + order.append(current_name) + + if len(visited) != len(graph): + types_names = set(x for x in context.types if x not in ('SELF_TYPE', 'AUTO_TYPE')) + exclude_type_names = types_names - visited + errors.append(f'DependencyError: Circular class dependency ' + f'involving class {sorted(exclude_type_names, reverse=True).pop()}.') + + declarations = {d.id: d for d in program_node.declarations} + program_node.declarations = [declarations[name] for name in order if + name not in ('Object', 'Int', 'IO', 'String', 'Bool')] + + return program_node + + +class OverriddenMethodChecker: + """This visitor for validate the signature of the overridden methods + + Params + ------ + - syntactic_and_semantic_errors: List[str] is a list of syntactic_and_semantic_errors detected in the ast travel + - context: Context the context for keeping the classes + - current_type: Optional[Type] is the current type in the building process""" + + def __init__(self, context: Context, errors: List[str]): + self.context: Context = context + self.current_type: Optional[Type] = None + self.errors: List[str] = errors + + @visitor.on('node') + def visit(self, node): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode): + for declaration in node.declarations: + self.visit(declaration) + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode): + self.current_type = self.context.get_type(node.id) + + for feature in node.features: + if isinstance(feature, ast.MethodDeclarationNode): + self.visit(feature) + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode): + try: + attribute, owner = self.current_type.parent.get_attribute(node.id) + self.errors.append(err.ATTRIBUTE_OVERRIDE_ERROR % (attribute.name, owner.name)) + except SemanticError: + pass + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode): + # TODO: Change the comparison overriding + current_method = self.current_type.get_method(node.id) + try: + method, owner = self.current_type.parent.get_method(node.id, get_owner=True) + if method != current_method: + self.errors.append(err.METHOD_OVERRIDE_ERROR % (node.id, owner.name)) + except SemanticError: + pass diff --git a/src/cool/semantics/type_builder.py b/src/cool/semantics/type_builder.py index 140500354..b6c653c9a 100644 --- a/src/cool/semantics/type_builder.py +++ b/src/cool/semantics/type_builder.py @@ -1,76 +1,76 @@ -from typing import List, Optional - -import cool.semantics.utils.astnodes as ast -import cool.semantics.utils.errors as err -import cool.visitor as visitor -from cool.semantics.utils.scope import Context, SemanticError, Type, ErrorType - - -class TypeBuilder: - """This visitor collect all the attributes and methods in classes and set the parent to the current class - - Params - ------ - - syntactic_and_semantic_errors: List[str] is a list of syntactic_and_semantic_errors detected in the ast travel - - context: Context the context for keeping the classes - - current_type: Optional[Type] is the current type in the building process""" - - def __init__(self, context: Context, errors: List[str]): - self.context: Context = context - self.current_type: Optional[Type] = None - self.errors: List[str] = errors - - @visitor.on('node') - def visit(self, node): - pass - - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode): - for declaration in node.declarations: - self.visit(declaration) - - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode): - self.current_type = self.context.get_type(node.id) - - if node.parent is not None: - if node.parent in ("Int", "String", "Bool", "SELF_TYPE"): - self.errors.append(err.INVALID_PARENT_TYPE % (node.id, node.parent)) - - try: - self.current_type.set_parent(self.context.get_type(node.parent)) - except SemanticError as e: - self.errors.append(e.text) - else: - self.current_type.set_parent(self.context.get_type('Object')) - - for feature in node.features: - self.visit(feature) - - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode): - try: - self.current_type.define_attribute(node.id, self.context.get_type(node.type)) - except SemanticError as e: - self.errors.append(e.text) - self.current_type.define_attribute(node.id, ErrorType()) - - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode): - param_names = [] - param_types = [] - for name, typex in node.params: - param_names.append(name) - try: - param_types.append(self.context.get_type(typex)) - except SemanticError as e: - param_types.append(ErrorType()) - self.errors.append(e.text) - - try: - return_type = self.context.get_type(node.return_type) - except SemanticError as e: - return_type = ErrorType() - self.errors.append(e.text) - - self.current_type.define_method(node.id, param_names, param_types, return_type) +from typing import List, Optional + +import cool.semantics.utils.astnodes as ast +import cool.semantics.utils.errors as err +import cool.visitor as visitor +from cool.semantics.utils.scope import Context, SemanticError, Type, ErrorType + + +class TypeBuilder: + """This visitor collect all the attributes and methods in classes and set the parent to the current class + + Params + ------ + - syntactic_and_semantic_errors: List[str] is a list of syntactic_and_semantic_errors detected in the ast travel + - context: Context the context for keeping the classes + - current_type: Optional[Type] is the current type in the building process""" + + def __init__(self, context: Context, errors: List[str]): + self.context: Context = context + self.current_type: Optional[Type] = None + self.errors: List[str] = errors + + @visitor.on('node') + def visit(self, node): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode): + for declaration in node.declarations: + self.visit(declaration) + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode): + self.current_type = self.context.get_type(node.id) + + if node.parent is not None: + if node.parent in ("Int", "String", "Bool", "SELF_TYPE"): + self.errors.append(err.INVALID_PARENT_TYPE % (node.id, node.parent)) + + try: + self.current_type.set_parent(self.context.get_type(node.parent)) + except SemanticError as e: + self.errors.append(e.text) + else: + self.current_type.set_parent(self.context.get_type('Object')) + + for feature in node.features: + self.visit(feature) + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode): + try: + self.current_type.define_attribute(node.id, self.context.get_type(node.type)) + except SemanticError as e: + self.errors.append(e.text) + self.current_type.define_attribute(node.id, ErrorType()) + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode): + param_names = [] + param_types = [] + for name, typex in node.params: + param_names.append(name) + try: + param_types.append(self.context.get_type(typex)) + except SemanticError as e: + param_types.append(ErrorType()) + self.errors.append(e.text) + + try: + return_type = self.context.get_type(node.return_type) + except SemanticError as e: + return_type = ErrorType() + self.errors.append(e.text) + + self.current_type.define_method(node.id, param_names, param_types, return_type) diff --git a/src/cool/semantics/type_checker.py b/src/cool/semantics/type_checker.py index 481b43ec7..434e2dc45 100644 --- a/src/cool/semantics/type_checker.py +++ b/src/cool/semantics/type_checker.py @@ -1,289 +1,289 @@ -from typing import List - -import cool.semantics.utils.astnodes as ast -import cool.semantics.utils.errors as err -import cool.visitor as visitor -from cool.semantics.utils.scope import (Context, ErrorType, Method, Scope, - SemanticError, Type) - - -class TypeChecker: - def __init__(self, context: Context, errors: List[str]): - self.context: Context = context - self.errors: List[str] = errors - self.current_type: Type = None - self.current_method: Method = None - - @visitor.on('node') - def visit(self, node, scope): - pass - - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode, scope: Scope = None): - if scope is None: - scope = Scope() - - for elem in node.declarations: - self.visit(elem, scope.create_child()) - - return scope - - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode, scope: Scope): - self.current_type = self.context.get_type(node.id) - - attrs = [feature for feature in node.features if isinstance(feature, ast.AttrDeclarationNode)] - methods = [feature for feature in node.features if isinstance(feature, ast.MethodDeclarationNode)] - - for attr, attr_owner in self.current_type.all_attributes(): - if attr_owner != self.current_type: - scope.define_variable(attr.name, attr.type) - - for attr in attrs: - self.visit(attr, scope) - - for method in methods: - self.visit(method, scope.create_child()) - - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode, scope: Scope): - if node.id == 'self': - self.errors.append(err.SELF_INVALID_ATTRIBUTE_ID) - - attr_type = self.context.get_type(node.type) if node.type != 'SELF_TYPE' else self.current_type - - if node.expr is not None: - expr_type = self.visit(node.expr, scope.create_child()) - if not expr_type.conforms_to(attr_type): - self.errors.append(err.INCOMPATIBLE_TYPES % (expr_type.name, attr_type.name)) - - scope.define_variable(node.id, attr_type) - - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode, scope: Scope): - self.current_method = self.current_type.get_method(node.id) - - # Parameters can hide the attribute declaration, that's why we are not checking if there is defined, - # instead we are checking for local declaration. Also it is checked that the static type of a parameter is - # different of SELF_TYPE. - - scope.define_variable('self', self.current_type) - - for param_name, param_type in zip(self.current_method.param_names, self.current_method.param_types): - if not scope.is_local(param_name): - if param_type.name == 'SELF_TYPE': - self.errors.append(err.INVALID_PARAM_TYPE % 'SELF_TYPE') - scope.define_variable(param_name, ErrorType()) - else: - scope.define_variable(param_name, self.context.get_type(param_type.name)) - else: - self.errors.append(err.LOCAL_ALREADY_DEFINED % (param_name, self.current_method.name)) - - return_type = self.context.get_type(node.return_type) if node.return_type != 'SELF_TYPE' else self.current_type - - expr_type = self.visit(node.body, scope) - - if not expr_type.conforms_to(return_type): - self.errors.append(err.INCOMPATIBLE_TYPES % (expr_type.name, return_type.name)) - - @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode, scope: Scope): - for _id, _type, _expr in node.declarations: - try: - var_static_type = self.context.get_type(_type) if _type != 'SELF_TYPE' else self.current_type - except SemanticError as e: - self.errors.append(e.text) - var_static_type = ErrorType() - - if scope.is_local(_id): - self.errors.append(err.LOCAL_ALREADY_DEFINED % (_id, self.current_method.name)) - else: - scope.define_variable(_id, var_static_type) - - expr_type = self.visit(_expr, scope.create_child()) if _expr is not None else None - if expr_type is not None and not expr_type.conforms_to(var_static_type): - self.errors.append(err.INCOMPATIBLE_TYPES % (expr_type.name, var_static_type.name)) - - return self.visit(node.expr, scope.create_child()) - - @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode, scope: Scope): - var_info = scope.find_variable(node.id) - - expr_type = self.visit(node.expr, scope.create_child()) - - if var_info is None: - self.errors.append(err.VARIABLE_NOT_DEFINED % (node.id, self.current_method.name)) - else: - if not expr_type.conforms_to(var_info.type): - self.errors.append(err.INCOMPATIBLE_TYPES % (expr_type.name, var_info.type.name)) - - return expr_type - - @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode, scope: Scope): - child_scope = scope.create_child() - return_type = ErrorType() - for expr in node.expressions: - return_type = self.visit(expr, child_scope) - return return_type - - @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode, scope: Scope): - if_type = self.visit(node.if_expr, scope) - then_type = self.visit(node.then_expr, scope) - else_type = self.visit(node.else_expr, scope) - if if_type != self.context.get_type('Bool'): - self.errors.append(err.INCOMPATIBLE_TYPES % (if_type.name, 'Bool')) - return then_type.join(else_type) - - @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode, scope: Scope): - condition = self.visit(node.condition, scope) - if condition != self.context.get_type('Bool'): - self.errors.append(err.INCOMPATIBLE_TYPES % (condition.name, 'Bool')) - - self.visit(node.body, scope.create_child()) - return self.context.get_type('Object') - - @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode, scope: Scope): - self.visit(node.expr, scope) - types = [] - for _id, _type, _expr in node.cases: - new_scope = scope.create_child() - try: - if _type != 'SELF_TYPE': - new_scope.define_variable(_id, self.context.get_type(_type)) - else: - self.errors.append(err.INVALID_CASE_TYPE % _type) - except SemanticError as e: - new_scope.define_variable(_id, ErrorType()) - self.errors.append(e.text) - - types.append(self.visit(_expr, new_scope)) - - return Type.multi_join(types) - - @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode, scope: Scope): - if node.obj is None: - node.obj = ast.VariableNode('self') - obj_type = self.visit(node.obj, scope) - - if node.type is not None: - try: - ancestor_type = self.context.get_type(node.type) - except SemanticError as e: - ancestor_type = ErrorType() - self.errors.append(e.text) - - if not obj_type.conforms_to(ancestor_type): - self.errors.append(err.INVALID_ANCESTOR % (obj_type.name, ancestor_type.name)) - else: - ancestor_type = obj_type - - try: - method = ancestor_type.get_method(node.id) - except SemanticError as e: - self.errors.append(e.text) - for arg in node.args: - self.visit(arg, scope) - return ErrorType() - - if len(node.args) != len(method.param_names): - self.errors.append(err.METHOD_OVERRIDE_ERROR % (method.name, obj_type.name)) - - for i, arg in enumerate(node.args): - arg_type = self.visit(arg, scope) - if not arg_type.conforms_to(method.param_types[i]): - self.errors.append(err.INCOMPATIBLE_TYPES % (arg_type.name, method.param_types[i].name)) - - return method.return_type if method.return_type.name != 'SELF_TYPE' else ancestor_type - - @visitor.when(ast.IntegerNode) - def visit(self, node: ast.IntegerNode, scope: Scope): - return self.context.get_type('Int') - - @visitor.when(ast.StringNode) - def visit(self, node: ast.StringNode, scope: Scope): - return self.context.get_type('String') - - @visitor.when(ast.BooleanNode) - def visit(self, node: ast.BooleanNode, scope: Scope): - return self.context.get_type('Bool') - - @visitor.when(ast.VariableNode) - def visit(self, node: ast.VariableNode, scope: Scope): - variable = scope.find_variable(node.lex) - if variable is None: - self.errors.append(err.VARIABLE_NOT_DEFINED % (node.lex, self.current_method.name)) - return ErrorType() - return variable.type - - @visitor.when(ast.InstantiateNode) - def visit(self, node: ast.InstantiateNode, scope: Scope): - try: - return self.context.get_type(node.lex) if node.lex != 'SELF_TYPE' else self.current_type - except SemanticError as e: - self.errors.append(e.text) - return ErrorType() - - @visitor.when(ast.NegationNode) - def visit(self, node: ast.NegationNode, scope: Scope): - return self._check_unary_operation(node, scope, 'not', self.context.get_type('Bool')) - - @visitor.when(ast.ComplementNode) - def visit(self, node: ast.ComplementNode, scope: Scope): - return self._check_unary_operation(node, scope, '~', self.context.get_type('Int')) - - @visitor.when(ast.IsVoidNode) - def visit(self, node: ast.IsVoidNode, scope: Scope): - self.visit(node.expr, scope) - return self.context.get_type('Bool') - - @visitor.when(ast.PlusNode) - def visit(self, node: ast.PlusNode, scope: Scope): - return self._check_int_binary_operation(node, scope, '+', self.context.get_type('Int')) - - @visitor.when(ast.MinusNode) - def visit(self, node: ast.MinusNode, scope: Scope): - return self._check_int_binary_operation(node, scope, '-', self.context.get_type('Int')) - - @visitor.when(ast.StarNode) - def visit(self, node: ast.StarNode, scope: Scope): - return self._check_int_binary_operation(node, scope, '*', self.context.get_type('Int')) - - @visitor.when(ast.DivNode) - def visit(self, node: ast.DivNode, scope: Scope): - return self._check_int_binary_operation(node, scope, '/', self.context.get_type('Int')) - - @visitor.when(ast.LessEqualNode) - def visit(self, node: ast.LessEqualNode, scope: Scope): - return self._check_int_binary_operation(node, scope, '<=', self.context.get_type('Bool')) - - @visitor.when(ast.LessThanNode) - def visit(self, node: ast.LessThanNode, scope: Scope): - return self._check_int_binary_operation(node, scope, '<', self.context.get_type('Bool')) - - @visitor.when(ast.EqualNode) - def visit(self, node: ast.EqualNode, scope: Scope): - self.visit(node.left, scope) - self.visit(node.right, scope) - return self.context.get_type('Bool') - - def _check_int_binary_operation(self, node: ast.BinaryNode, scope: Scope, operation: str, return_type: Type): - left_type = self.visit(node.left, scope) - right_type = self.visit(node.right, scope) - - if left_type == right_type == self.context.get_type('Int'): - return return_type - self.errors.append(err.INVALID_BINARY_OPERATION % (operation, left_type.name, right_type.name)) - return ErrorType() - - def _check_unary_operation(self, node: ast.UnaryNode, scope: Scope, operation: str, expected_type: Type): - typex = self.visit(node.expr, scope) - if typex == expected_type: - return typex - self.errors.append(err.INVALID_UNARY_OPERATION % (operation, typex.name)) - return ErrorType() +from typing import List + +import cool.semantics.utils.astnodes as ast +import cool.semantics.utils.errors as err +import cool.visitor as visitor +from cool.semantics.utils.scope import (Context, ErrorType, Method, Scope, + SemanticError, Type) + + +class TypeChecker: + def __init__(self, context: Context, errors: List[str]): + self.context: Context = context + self.errors: List[str] = errors + self.current_type: Type = None + self.current_method: Method = None + + @visitor.on('node') + def visit(self, node, scope): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode, scope: Scope = None): + if scope is None: + scope = Scope() + + for elem in node.declarations: + self.visit(elem, scope.create_child()) + + return scope + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode, scope: Scope): + self.current_type = self.context.get_type(node.id) + + attrs = [feature for feature in node.features if isinstance(feature, ast.AttrDeclarationNode)] + methods = [feature for feature in node.features if isinstance(feature, ast.MethodDeclarationNode)] + + for attr, attr_owner in self.current_type.all_attributes(): + if attr_owner != self.current_type: + scope.define_variable(attr.name, attr.type) + + for attr in attrs: + self.visit(attr, scope) + + for method in methods: + self.visit(method, scope.create_child()) + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode, scope: Scope): + if node.id == 'self': + self.errors.append(err.SELF_INVALID_ATTRIBUTE_ID) + + attr_type = self.context.get_type(node.type) if node.type != 'SELF_TYPE' else self.current_type + + if node.expr is not None: + expr_type = self.visit(node.expr, scope.create_child()) + if not expr_type.conforms_to(attr_type): + self.errors.append(err.INCOMPATIBLE_TYPES % (expr_type.name, attr_type.name)) + + scope.define_variable(node.id, attr_type) + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode, scope: Scope): + self.current_method = self.current_type.get_method(node.id) + + # Parameters can hide the attribute declaration, that's why we are not checking if there is defined, + # instead we are checking for local declaration. Also it is checked that the static type of a parameter is + # different of SELF_TYPE. + + scope.define_variable('self', self.current_type) + + for param_name, param_type in zip(self.current_method.param_names, self.current_method.param_types): + if not scope.is_local(param_name): + if param_type.name == 'SELF_TYPE': + self.errors.append(err.INVALID_PARAM_TYPE % 'SELF_TYPE') + scope.define_variable(param_name, ErrorType()) + else: + scope.define_variable(param_name, self.context.get_type(param_type.name)) + else: + self.errors.append(err.LOCAL_ALREADY_DEFINED % (param_name, self.current_method.name)) + + return_type = self.context.get_type(node.return_type) if node.return_type != 'SELF_TYPE' else self.current_type + + expr_type = self.visit(node.body, scope) + + if not expr_type.conforms_to(return_type): + self.errors.append(err.INCOMPATIBLE_TYPES % (expr_type.name, return_type.name)) + + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode, scope: Scope): + for _id, _type, _expr in node.declarations: + try: + var_static_type = self.context.get_type(_type) if _type != 'SELF_TYPE' else self.current_type + except SemanticError as e: + self.errors.append(e.text) + var_static_type = ErrorType() + + if scope.is_local(_id): + self.errors.append(err.LOCAL_ALREADY_DEFINED % (_id, self.current_method.name)) + else: + scope.define_variable(_id, var_static_type) + + expr_type = self.visit(_expr, scope.create_child()) if _expr is not None else None + if expr_type is not None and not expr_type.conforms_to(var_static_type): + self.errors.append(err.INCOMPATIBLE_TYPES % (expr_type.name, var_static_type.name)) + + return self.visit(node.expr, scope.create_child()) + + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode, scope: Scope): + var_info = scope.find_variable(node.id) + + expr_type = self.visit(node.expr, scope.create_child()) + + if var_info is None: + self.errors.append(err.VARIABLE_NOT_DEFINED % (node.id, self.current_method.name)) + else: + if not expr_type.conforms_to(var_info.type): + self.errors.append(err.INCOMPATIBLE_TYPES % (expr_type.name, var_info.type.name)) + + return expr_type + + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode, scope: Scope): + child_scope = scope.create_child() + return_type = ErrorType() + for expr in node.expressions: + return_type = self.visit(expr, child_scope) + return return_type + + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode, scope: Scope): + if_type = self.visit(node.if_expr, scope) + then_type = self.visit(node.then_expr, scope) + else_type = self.visit(node.else_expr, scope) + if if_type != self.context.get_type('Bool'): + self.errors.append(err.INCOMPATIBLE_TYPES % (if_type.name, 'Bool')) + return then_type.join(else_type) + + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode, scope: Scope): + condition = self.visit(node.condition, scope) + if condition != self.context.get_type('Bool'): + self.errors.append(err.INCOMPATIBLE_TYPES % (condition.name, 'Bool')) + + self.visit(node.body, scope.create_child()) + return self.context.get_type('Object') + + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode, scope: Scope): + self.visit(node.expr, scope) + types = [] + for _id, _type, _expr in node.cases: + new_scope = scope.create_child() + try: + if _type != 'SELF_TYPE': + new_scope.define_variable(_id, self.context.get_type(_type)) + else: + self.errors.append(err.INVALID_CASE_TYPE % _type) + except SemanticError as e: + new_scope.define_variable(_id, ErrorType()) + self.errors.append(e.text) + + types.append(self.visit(_expr, new_scope)) + + return Type.multi_join(types) + + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode, scope: Scope): + if node.obj is None: + node.obj = ast.VariableNode('self') + obj_type = self.visit(node.obj, scope) + + if node.type is not None: + try: + ancestor_type = self.context.get_type(node.type) + except SemanticError as e: + ancestor_type = ErrorType() + self.errors.append(e.text) + + if not obj_type.conforms_to(ancestor_type): + self.errors.append(err.INVALID_ANCESTOR % (obj_type.name, ancestor_type.name)) + else: + ancestor_type = obj_type + + try: + method = ancestor_type.get_method(node.id) + except SemanticError as e: + self.errors.append(e.text) + for arg in node.args: + self.visit(arg, scope) + return ErrorType() + + if len(node.args) != len(method.param_names): + self.errors.append(err.METHOD_OVERRIDE_ERROR % (method.name, obj_type.name)) + + for i, arg in enumerate(node.args): + arg_type = self.visit(arg, scope) + if not arg_type.conforms_to(method.param_types[i]): + self.errors.append(err.INCOMPATIBLE_TYPES % (arg_type.name, method.param_types[i].name)) + + return method.return_type if method.return_type.name != 'SELF_TYPE' else ancestor_type + + @visitor.when(ast.IntegerNode) + def visit(self, node: ast.IntegerNode, scope: Scope): + return self.context.get_type('Int') + + @visitor.when(ast.StringNode) + def visit(self, node: ast.StringNode, scope: Scope): + return self.context.get_type('String') + + @visitor.when(ast.BooleanNode) + def visit(self, node: ast.BooleanNode, scope: Scope): + return self.context.get_type('Bool') + + @visitor.when(ast.VariableNode) + def visit(self, node: ast.VariableNode, scope: Scope): + variable = scope.find_variable(node.lex) + if variable is None: + self.errors.append(err.VARIABLE_NOT_DEFINED % (node.lex, self.current_method.name)) + return ErrorType() + return variable.type + + @visitor.when(ast.InstantiateNode) + def visit(self, node: ast.InstantiateNode, scope: Scope): + try: + return self.context.get_type(node.lex) if node.lex != 'SELF_TYPE' else self.current_type + except SemanticError as e: + self.errors.append(e.text) + return ErrorType() + + @visitor.when(ast.NegationNode) + def visit(self, node: ast.NegationNode, scope: Scope): + return self._check_unary_operation(node, scope, 'not', self.context.get_type('Bool')) + + @visitor.when(ast.ComplementNode) + def visit(self, node: ast.ComplementNode, scope: Scope): + return self._check_unary_operation(node, scope, '~', self.context.get_type('Int')) + + @visitor.when(ast.IsVoidNode) + def visit(self, node: ast.IsVoidNode, scope: Scope): + self.visit(node.expr, scope) + return self.context.get_type('Bool') + + @visitor.when(ast.PlusNode) + def visit(self, node: ast.PlusNode, scope: Scope): + return self._check_int_binary_operation(node, scope, '+', self.context.get_type('Int')) + + @visitor.when(ast.MinusNode) + def visit(self, node: ast.MinusNode, scope: Scope): + return self._check_int_binary_operation(node, scope, '-', self.context.get_type('Int')) + + @visitor.when(ast.StarNode) + def visit(self, node: ast.StarNode, scope: Scope): + return self._check_int_binary_operation(node, scope, '*', self.context.get_type('Int')) + + @visitor.when(ast.DivNode) + def visit(self, node: ast.DivNode, scope: Scope): + return self._check_int_binary_operation(node, scope, '/', self.context.get_type('Int')) + + @visitor.when(ast.LessEqualNode) + def visit(self, node: ast.LessEqualNode, scope: Scope): + return self._check_int_binary_operation(node, scope, '<=', self.context.get_type('Bool')) + + @visitor.when(ast.LessThanNode) + def visit(self, node: ast.LessThanNode, scope: Scope): + return self._check_int_binary_operation(node, scope, '<', self.context.get_type('Bool')) + + @visitor.when(ast.EqualNode) + def visit(self, node: ast.EqualNode, scope: Scope): + self.visit(node.left, scope) + self.visit(node.right, scope) + return self.context.get_type('Bool') + + def _check_int_binary_operation(self, node: ast.BinaryNode, scope: Scope, operation: str, return_type: Type): + left_type = self.visit(node.left, scope) + right_type = self.visit(node.right, scope) + + if left_type == right_type == self.context.get_type('Int'): + return return_type + self.errors.append(err.INVALID_BINARY_OPERATION % (operation, left_type.name, right_type.name)) + return ErrorType() + + def _check_unary_operation(self, node: ast.UnaryNode, scope: Scope, operation: str, expected_type: Type): + typex = self.visit(node.expr, scope) + if typex == expected_type: + return typex + self.errors.append(err.INVALID_UNARY_OPERATION % (operation, typex.name)) + return ErrorType() diff --git a/src/cool/semantics/type_collector.py b/src/cool/semantics/type_collector.py index fa921ca1f..253ba943d 100644 --- a/src/cool/semantics/type_collector.py +++ b/src/cool/semantics/type_collector.py @@ -1,60 +1,60 @@ -from typing import List - -import cool.semantics.utils.astnodes as ast -import cool.visitor as visitor -from cool.semantics.utils.scope import Context, SemanticError - - -class TypeCollector: - """Visitor to collect the class in the program, and the basic classes as Object, Int, String, IO and Bool - - Params - ---------- - - syntactic_and_semantic_errors: List[str] is a list of syntactic_and_semantic_errors detected in the ast travel - - context: Context the context for keeping the classes""" - - def __init__(self, context: Context = Context(), errors: List[str] = []): - self.errors: List[str] = errors - self.context: Context = context - - @visitor.on('node') - def visit(self, node): - pass - - @visitor.when(ast.ProgramNode) - def visit(self, node): - self.context.create_type('AUTO_TYPE') - self_type = self.context.create_type('SELF_TYPE') - object_type = self.context.create_type('Object') - io_type = self.context.create_type('IO') - string_type = self.context.create_type('String') - int_type = self.context.create_type('Int') - bool_type = self.context.create_type('Bool') - - io_type.set_parent(object_type) - string_type.set_parent(object_type) - int_type.set_parent(object_type) - bool_type.set_parent(object_type) - - object_type.define_method('abort', [], [], object_type) - object_type.define_method('get_type', [], [], string_type) - object_type.define_method('copy', [], [], self_type) - - io_type.define_method('out_string', ['x'], [string_type], self_type) - io_type.define_method('out_int', ['x'], [int_type], self_type) - io_type.define_method('in_string', [], [], string_type) - io_type.define_method('in_int', [], [], int_type) - - string_type.define_method('length', [], [], int_type) - string_type.define_method('concat', ['s'], [string_type], string_type) - string_type.define_method('substr', ['i', 'l'], [int_type, int_type], string_type) - - for declaration in node.declarations: - self.visit(declaration) - - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node): - try: - self.context.create_type(node.id) - except SemanticError as e: - self.errors.append(e.text) +from typing import List + +import cool.semantics.utils.astnodes as ast +import cool.visitor as visitor +from cool.semantics.utils.scope import Context, SemanticError + + +class TypeCollector: + """Visitor to collect the class in the program, and the basic classes as Object, Int, String, IO and Bool + + Params + ---------- + - syntactic_and_semantic_errors: List[str] is a list of syntactic_and_semantic_errors detected in the ast travel + - context: Context the context for keeping the classes""" + + def __init__(self, context: Context = Context(), errors: List[str] = []): + self.errors: List[str] = errors + self.context: Context = context + + @visitor.on('node') + def visit(self, node): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node): + self.context.create_type('AUTO_TYPE') + self_type = self.context.create_type('SELF_TYPE') + object_type = self.context.create_type('Object') + io_type = self.context.create_type('IO') + string_type = self.context.create_type('String') + int_type = self.context.create_type('Int') + bool_type = self.context.create_type('Bool') + + io_type.set_parent(object_type) + string_type.set_parent(object_type) + int_type.set_parent(object_type) + bool_type.set_parent(object_type) + + object_type.define_method('abort', [], [], object_type) + object_type.define_method('get_type', [], [], string_type) + object_type.define_method('copy', [], [], self_type) + + io_type.define_method('out_string', ['x'], [string_type], self_type) + io_type.define_method('out_int', ['x'], [int_type], self_type) + io_type.define_method('in_string', [], [], string_type) + io_type.define_method('in_int', [], [], int_type) + + string_type.define_method('length', [], [], int_type) + string_type.define_method('concat', ['s'], [string_type], string_type) + string_type.define_method('substr', ['i', 'l'], [int_type, int_type], string_type) + + for declaration in node.declarations: + self.visit(declaration) + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node): + try: + self.context.create_type(node.id) + except SemanticError as e: + self.errors.append(e.text) diff --git a/src/cool/semantics/type_inference.py b/src/cool/semantics/type_inference.py index 4c1d318af..aaebb8e31 100644 --- a/src/cool/semantics/type_inference.py +++ b/src/cool/semantics/type_inference.py @@ -1,698 +1,698 @@ -"""The type inference algorithm consist in a dependency di-graph with special nodes to handle the behavior of the -updates of components in the code and solve it in the `context`. For that we crate an structure called -DependencyGraph where we can create nodes as an structure called DependencyNode and arcs between them, an arc e = - where x and y are dependency nodes means that the type of node y is inferred by the type of node x, -so for solve the type of y we need first to infer the type of x. For this operation we need some basic nodes that -only contains the type of the node called AtomNode and in the digraph formation an AtomNode is never inferred from -another node. The DependencyGraph consist in a dictionary[node, adjacency list] this adjacency has a declaration -order and this is fundamental for the inference solution algorithm. If we have a case {x : [y, z]} where x, y, -z are nodes then the algorithm will determinate the type of y and all it dependencies before to start with z (a -simple DFS). The order in the adjacency list is the same appearance order in the program. At the end of the algorithm -all nodes that cannot solve it type will be tagged as `Object`. - -DependencyNode hierarchy - AtomNode - - type : Node type - - VariableInfoNode - - type: Node type - - variable_type : Reference to the variable info of the scope - - AttributeNode - - type : Node type - - attribute : Reference to the attribute of the class - - ParameterNode - - type : Node type - - method : Reference to the method of the class - - index : Index of the parameter of the method - - ReturnTypeNode - - type : Node type - - method : Reference to the method of the class - -All nodes has an implementation of the method update that handle how to update the type by it's dependencies -""" -from abc import ABC -from collections import OrderedDict, deque -from typing import Dict, List, Optional, Set, Tuple, Deque - -import cool.semantics.utils.astnodes as ast -import cool.semantics.utils.errors as err -import cool.visitor as visitor -from cool.semantics.utils.scope import (Attribute, Context, ErrorType, Method, - Scope, SemanticError, Type, VariableInfo) - - -class DependencyNode: - type: Type - - def update(self, _type: Type) -> None: - raise NotImplementedError() - - def __repr__(self): - return str(self) - - @property - def is_ready(self): - return True - - -class AtomNode(DependencyNode): - def __init__(self, atom_type: Type): - self.type: Type = atom_type - - def update(self, _type: Type) -> None: - pass - - def __str__(self): - return f'Atom({self.type.name})' - - -class VariableInfoNode(DependencyNode): - def __init__(self, var_type: Type, variable_info: VariableInfo): - self.type: Type = var_type - self.variable_info: VariableInfo = variable_info - - def update(self, _type): - self.type = self.variable_info.type = _type - - def __str__(self): - return f'VarInfo({self.variable_info.name}, {self.type.name})' - - -class AttributeNode(DependencyNode): - def __init__(self, attr_type: Type, attribute: Attribute): - self.type: Type = attr_type - self.attribute: Attribute = attribute - - def update(self, _type: Type) -> None: - self.type = self.attribute.type = _type - - def __str__(self): - return f'Attr({self.attribute.name}, {self.type.name})' - - -class ParameterNode(DependencyNode): - def __init__(self, param_type: Type, method: Method, index: int): - self.type: Type = param_type - self.method: Method = method - self.index: int = index - - def update(self, _type): - self.type = self.method.param_types[self.index] = _type - - def __str__(self): - return f'Param({self.method.name}, {self.index}, {self.type.name})' - - -class ReturnTypeNode(DependencyNode): - def __init__(self, ret_type: Type, method: Method): - self.type: Type = ret_type - self.method: Method = method - - def update(self, _type): - self.type = self.method.return_type = _type - - def __str__(self): - return f'Return({self.method.name}, {self.type.name})' - - -class BranchedNode(DependencyNode, ABC): - branches: List[DependencyNode] = [] - - @property - def is_ready(self) -> bool: - return all(x.type.name != 'AUTO_TYPE' for x in self.branches) - - -class ConditionalNode(BranchedNode): - def __init__(self, conditional_type, then_branch, else_branch): - self.type = conditional_type - self.branches = [then_branch, else_branch] - - def update(self, _type: Type) -> None: - self.type = _type - - def __str__(self): - return f'ConditionalNode({self.type.name})' - - -class CaseOfNode(BranchedNode): - def __init__(self, _type, branches): - self.type = _type - self.branches = branches - - def update(self, _type: Type) -> None: - self.type = _type - - def __str__(self): - return f'CaseOfNode({self.type.name})' - - -class DependencyGraph: - def __init__(self): - self.dependencies: Dict[DependencyNode, List[DependencyNode]] = OrderedDict() - - def add_node(self, node: DependencyNode): - if node not in self.dependencies: - self.dependencies[node] = [] - - def add_edge(self, node: DependencyNode, other: DependencyNode): - try: - self.dependencies[node].append(other) - except KeyError: - self.dependencies[node] = [other] - self.add_node(other) - - def update_dependencies(self, default_type: Type = None): - queue: Deque[DependencyNode] = deque(node for node in self.dependencies if isinstance(node, AtomNode)) - visited: Set[DependencyNode] = set(queue) - - while queue: - node = queue.popleft() - - if not node.is_ready: - continue - - for adj in self.dependencies[node]: - if adj not in visited: - adj.update(node.type) - visited.add(adj) - if not isinstance(adj, BranchedNode): - queue.append(adj) - - for node in self.dependencies: - if isinstance(node, BranchedNode) and node.is_ready: - node.update(Type.multi_join([x.type for x in node.branches])) - - queue = deque(node for node in self.dependencies - if isinstance(node, BranchedNode) and node.type.name != 'AUTO_TYPE') - visited.update(queue) - while queue: - node = queue.popleft() - for adj in self.dependencies[node]: - if adj not in visited: - adj.update(node.type) - visited.add(adj) - queue.append(adj) - - if default_type is not None: - for node in self.dependencies: - if node not in visited: - node.update(default_type) - - def __str__(self): - return '{\n\t' + '\n\t'.join(f'{key}: {value}' for key, value in self.dependencies.items()) + '\n}' - - -class InferenceChecker: - def __init__(self, context, errors): - self.context: Context = context - self.errors: List[str] = errors - self.current_type: Optional[Type] = None - self.current_method: Optional[Method] = None - - self.variables: Dict[VariableInfo, VariableInfoNode] = {} - self.attributes = self.build_attributes_reference(context) - self.methods = self.build_methods_reference(context) - self.graph = DependencyGraph() - - @staticmethod - def build_attributes_reference(context: Context) -> Dict[Tuple[str, str], AttributeNode]: - attributes = {} - - for typex in context: - for attr in typex.attributes: - attributes[typex.name, attr.name] = AttributeNode(attr.type, attr) - - return attributes - - @staticmethod - def build_methods_reference(context: Context) -> Dict[Tuple[str, str], Tuple[List[ParameterNode], ReturnTypeNode]]: - methods = {} - - for typex in context: - for method in typex.methods: - methods[typex.name, method.name] = ( - [ParameterNode(t, method, i) for i, t in enumerate(method.param_types)], - ReturnTypeNode(method.return_type, method)) - - return methods - - @visitor.on('node') - def visit(self, node, scope): - pass - - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode, scope: Scope = None): - if scope is None: - scope = Scope() - - for item in node.declarations: - self.visit(item, scope.create_child()) - - # print(self.graph, '\n') - self.graph.update_dependencies(default_type=self.context.get_type('Object')) - # print(self.graph, '\n') - InferenceTypeSubstitute(self.context, self.errors).visit(node, scope) - - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode, scope: Scope): - self.current_type = self.context.get_type(node.id) - - attrs = [feature for feature in node.features if isinstance(feature, ast.AttrDeclarationNode)] - methods = [feature for feature in node.features if isinstance(feature, ast.MethodDeclarationNode)] - - for attr in attrs: - self.visit(attr, scope) - - for method in methods: - self.visit(method, scope.create_child()) - - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode, scope: Scope): - # Solve the expression of the attribute - expr_node = self.visit(node.expr, scope.create_child()) if node.expr is not None else None - - # Define attribute in the scope - var_info = scope.define_variable(node.id, self.context.get_type(node.type)) - - # Set and get the reference to the variable info node - var_info_node = self.variables[var_info] = VariableInfoNode(self.context.get_type(node.type), var_info) - - if node.type == 'AUTO_TYPE': - # Get the reference to the attribute node - attr_node = self.attributes[self.current_type.name, node.id] - - # If the expression node is not None then two edges are creates in the graph - if expr_node is not None: - self.graph.add_edge(expr_node, var_info_node) - self.graph.add_edge(expr_node, attr_node) - - # Finally a cycle of two nodes is created between var_info_node and attr_node - self.graph.add_edge(var_info_node, attr_node) - self.graph.add_edge(attr_node, var_info_node) - - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode, scope: Scope): - self.current_method = self.current_type.get_method(node.id) - - # Define 'self' as a variable in the scope - self_var = scope.define_variable('self', self.current_type) - - # Set the reference of 'self' variable info node - self.variables[self_var] = VariableInfoNode(self.current_type, self_var) - - param_names = self.current_method.param_names - param_types = self.current_method.param_types - - for i, (param_name, param_type) in enumerate(zip(param_names, param_types)): - # Define parameter as local variable in current scope - param_var_info = scope.define_variable(param_name, param_type) - - # Set the reference to the variable info node - param_var_info_node = self.variables[param_var_info] = VariableInfoNode(param_type, param_var_info) - - if param_type.name == 'AUTO_TYPE': - # Get the parameter node - parameter_node = self.methods[self.current_type.name, self.current_method.name][0][i] - - # Create the cycle of two nodes between param_var_info_node and parameter_node - self.graph.add_edge(param_var_info_node, parameter_node) - self.graph.add_edge(parameter_node, param_var_info_node) - - # Solve the body of the method - body_node = self.visit(node.body, scope) - - if self.current_method.return_type.name == 'AUTO_TYPE': - # Get the return type node and add an edge body_node -> return_type_node - return_type_node = self.methods[self.current_type.name, self.current_method.name][1] - self.graph.add_edge(body_node, return_type_node) - - @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode, scope: Scope): - for _id, _type, _expr in node.declarations: - try: - # Define and get the var_info - var_info = scope.define_variable(_id, self.context.get_type(_type)) - except SemanticError: - var_info = scope.define_variable(_id, ErrorType()) - var_info_node = self.variables[var_info] = VariableInfoNode(var_info.type, var_info) - - expr_node = self.visit(_expr, scope.create_child()) if _expr is not None else None - - if var_info.type.name == 'AUTO_TYPE': - # Create an edge or add an new node only if it is AutoType - if expr_node is not None: - self.graph.add_edge(expr_node, var_info_node) - if expr_node.type.name == 'AUTO_TYPE': - self.graph.add_edge(var_info_node, expr_node) - else: - self.graph.add_node(var_info_node) - elif expr_node is not None and expr_node.type.name == 'AUTO_TYPE': - self.graph.add_edge(var_info_node, expr_node) - - return self.visit(node.expr, scope.create_child()) - - @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode, scope: Scope): - var_info = scope.find_variable(node.id) - - expr_node = self.visit(node.expr, scope.create_child()) - - if var_info is not None: - if expr_node.type.name != 'AUTO_TYPE' and var_info.type.name == 'AUTO_TYPE': - self.graph.add_edge(expr_node, self.variables[var_info]) - elif var_info.type.name != 'AUTO_TYPE' and expr_node.type.name == 'AUTO_TYPE': - self.graph.add_edge(AtomNode(self.context.get_type(var_info.type.name)), expr_node) - elif var_info.type.name == 'AUTO_TYPE' and expr_node.type.name == 'AUTO_TYPE': - # Create a cycle - self.graph.add_edge(expr_node, self.variables[var_info]) - self.graph.add_edge(self.variables[var_info], expr_node) - else: - pass - - return expr_node - - @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode, scope: Scope): - child_scope = scope.create_child() - result_node = None - for expr in node.expressions: - result_node = self.visit(expr, child_scope) - return result_node - - @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode, scope: Scope): - if_node = self.visit(node.if_expr, scope) - - if not isinstance(if_node, AtomNode): - self.graph.add_edge(AtomNode(self.context.get_type('Bool')), if_node) - - then_node = self.visit(node.then_expr, scope.create_child()) - else_node = self.visit(node.else_expr, scope.create_child()) - - if isinstance(then_node, AtomNode) and isinstance(else_node, AtomNode): - return AtomNode(then_node.type.join(else_node.type)) - - conditional_node = ConditionalNode(self.context.get_type('AUTO_TYPE'), then_node, else_node) - if isinstance(then_node, AtomNode) and not isinstance(else_node, AtomNode): - self.graph.add_edge(then_node, else_node) - elif not isinstance(then_node, AtomNode) and isinstance(else_node, AtomNode): - self.graph.add_edge(else_node, then_node) - else: - self.graph.add_edge(then_node, else_node) - self.graph.add_edge(else_node, then_node) - self.graph.add_edge(conditional_node, then_node) - self.graph.add_edge(conditional_node, else_node) - - return conditional_node - - @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode, scope: Scope): - self.visit(node.condition, scope) - self.visit(node.body, scope.create_child()) - return AtomNode(self.context.get_type('Object')) - - @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode, scope: Scope): - self.visit(node.expr, scope) - - defined_nodes = [] - not_defined_nodes = [] - case_nodes = [] - for _id, _type, _expr in node.cases: - new_scope = scope.create_child() - var_info = new_scope.define_variable(_id, self.context.get_type(_type)) - self.variables[var_info] = VariableInfoNode(var_info.type, var_info) - - case_node = self.visit(_expr, new_scope) - if isinstance(case_node, AtomNode): - defined_nodes.append(case_node) - else: - not_defined_nodes.append(case_node) - case_nodes.append(case_node) - - if any(e.type.name == 'AUTO_TYPE' for e in case_nodes): - if defined_nodes: - t = Type.multi_join([x.type for x in defined_nodes]) - for x in not_defined_nodes: - self.graph.add_edge(AtomNode(t), x) - case_of_node = CaseOfNode(self.context.get_type('AUTO_TYPE'), case_nodes) - self.graph.add_node(case_of_node) - return case_of_node - return AtomNode(Type.multi_join([e.type for e in case_nodes])) - - @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode, scope: Scope): - if node.obj is None: - node.obj = ast.VariableNode('self') - obj_node = self.visit(node.obj, scope) - - if isinstance(obj_node, AtomNode) and obj_node.type.contains_method(node.id): - method, owner = obj_node.type.get_method(node.id, get_owner=True) - param_nodes, return_node = self.methods[owner.name, method.name] - for i, arg in enumerate(node.args): - arg_node = self.visit(arg, scope) - - if arg_node is None: - # Possible error - continue - - if isinstance(arg_node, AtomNode): - if param_nodes[i].type.name == 'AUTO_TYPE': - self.graph.add_edge(arg_node, param_nodes[i]) - else: - continue - else: - if param_nodes[i].type.name != 'AUTO_TYPE': - self.graph.add_edge(param_nodes[i], arg_node) - else: - self.graph.add_edge(param_nodes[i], arg_node) - self.graph.add_edge(arg_node, param_nodes[i]) - - if return_node.type.name == 'AUTO_TYPE': - return return_node - return AtomNode(return_node.type if return_node.type.name != 'SELF_TYPE' else obj_node.type) - - for arg in node.args: - self.visit(arg, scope) - return AtomNode(self.context.get_type('Object')) - - @visitor.when(ast.IntegerNode) - def visit(self, node: ast.IntegerNode, scope: Scope): - return AtomNode(self.context.get_type('Int')) - - @visitor.when(ast.StringNode) - def visit(self, node: ast.StringNode, scope: Scope): - return AtomNode(self.context.get_type('String')) - - @visitor.when(ast.BooleanNode) - def visit(self, node: ast.BooleanNode, scope: Scope): - return AtomNode(self.context.get_type('Bool')) - - @visitor.when(ast.VariableNode) - def visit(self, node: ast.VariableNode, scope: Scope): - var_info = scope.find_variable(node.lex) - - if var_info is not None: - if var_info.type.name == 'AUTO_TYPE': - return self.variables[var_info] - else: - return AtomNode(var_info.type) - else: - return None - - @visitor.when(ast.InstantiateNode) - def visit(self, node: ast.InstantiateNode, scope: Scope): - if node.lex in self.context.types: - return AtomNode(self.context.get_type(node.lex)) - return AtomNode(self.context.get_type('Object')) - - @visitor.when(ast.NegationNode) - def visit(self, node: ast.NegationNode, scope: Scope): - self.visit(node.expr, scope) - return AtomNode(self.context.get_type('Bool')) - - @visitor.when(ast.ComplementNode) - def visit(self, node: ast.ComplementNode, scope: Scope): - self.visit(node.expr, scope) - return AtomNode(self.context.get_type('Int')) - - @visitor.when(ast.IsVoidNode) - def visit(self, node: ast.IsVoidNode, scope: Scope): - self.visit(node.expr, scope) - return AtomNode(self.context.get_type('Bool')) - - @visitor.when(ast.PlusNode) - def visit(self, node: ast.PlusNode, scope: Scope): - return self._visit_arithmetic_node(node, scope, self.context.get_type('Int'), self.context.get_type('Int')) - - @visitor.when(ast.MinusNode) - def visit(self, node: ast.MinusNode, scope: Scope): - return self._visit_arithmetic_node(node, scope, self.context.get_type('Int'), self.context.get_type('Int')) - - @visitor.when(ast.StarNode) - def visit(self, node: ast.StarNode, scope: Scope): - return self._visit_arithmetic_node(node, scope, self.context.get_type('Int'), self.context.get_type('Int')) - - @visitor.when(ast.DivNode) - def visit(self, node: ast.DivNode, scope: Scope): - return self._visit_arithmetic_node(node, scope, self.context.get_type('Int'), self.context.get_type('Int')) - - @visitor.when(ast.LessEqualNode) - def visit(self, node: ast.LessEqualNode, scope: Scope): - return self._visit_arithmetic_node(node, scope, self.context.get_type('Int'), self.context.get_type('Bool')) - - @visitor.when(ast.LessThanNode) - def visit(self, node: ast.LessThanNode, scope: Scope): - return self._visit_arithmetic_node(node, scope, self.context.get_type('Int'), self.context.get_type('Bool')) - - @visitor.when(ast.EqualNode) - def visit(self, node: ast.EqualNode, scope: Scope): - self.visit(node.left, scope) - self.visit(node.right, scope) - return AtomNode(self.context.get_type('Bool')) - - def _visit_arithmetic_node(self, node: ast.BinaryNode, scope: Scope, member_types: Type, return_type: Type): - left = self.visit(node.left, scope) - right = self.visit(node.right, scope) - - if not isinstance(left, AtomNode): - self.graph.add_edge(AtomNode(member_types), left) - - if not isinstance(right, AtomNode): - self.graph.add_edge(AtomNode(member_types), right) - - return AtomNode(return_type) - - -class InferenceTypeSubstitute: - def __init__(self, context: Context, errors: List[str]): - self.context: Context = context - self.errors: List[str] = errors - self.current_type: Optional[Type] = None - self.current_method: Optional[Method] = None - - @visitor.on('node') - def visit(self, node, tabs): - pass - - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode, scope: Scope): - for i, elem in enumerate(node.declarations): - self.visit(elem, scope.children[i]) - return scope - - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode, scope: Scope): - self.current_type = self.context.get_type(node.id) - - attrs = [feature for feature in node.features if isinstance(feature, ast.AttrDeclarationNode)] - methods = [feature for feature in node.features if isinstance(feature, ast.MethodDeclarationNode)] - - i = 0 - for attr in attrs: - if attr.expr is not None: - attr.index = i - i += 1 - self.visit(attr, scope) - - for i, method in enumerate(methods, i): - self.visit(method, scope.children[i]) - - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode, scope: Scope): - attr_type = self.context.get_type(node.type) - var_info = scope.find_variable(node.id) - - if node.expr is not None: - self.visit(node.expr, scope.children[node.index]) - - if attr_type == self.context.get_type('AUTO_TYPE'): - if var_info.type == self.context.get_type('AUTO_TYPE'): - self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % node.id) - node.type = var_info.type.name - - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode, scope: Scope): - self.current_method = self.current_type.get_method(node.id) - return_type = self.context.get_type(node.return_type) - - for i, (name, expr_body_type) in enumerate(node.params): - variable_info = scope.find_variable(name) - if variable_info.type == self.context.get_type('AUTO_TYPE'): - self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % name) - node.params[i] = (name, variable_info.type.name) - - self.visit(node.body, scope) - - if return_type == self.context.get_type('AUTO_TYPE'): - if self.current_method.return_type == self.context.get_type('AUTO_TYPE'): - self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % node.id) - node.return_type = self.current_method.return_type.name - - @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode, scope: Scope): - child_index = 0 - for i, (_id, _type, _expr) in enumerate(node.declarations): - variable_info = scope.find_variable(_id) - - if _expr is not None: - self.visit(_expr, scope.children[child_index]) - child_index += 1 - - if _type == 'AUTO_TYPE': - if variable_info.type == self.context.get_type('AUTO_TYPE'): - self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % _id) - node.declarations[i] = (_id, variable_info.type.name, _expr) - - self.visit(node.expr, scope.children[child_index]) - - @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode, scope: Scope): - self.visit(node.expr, scope.children[0]) - - @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode, scope: Scope): - child_scope = scope.children[0] - for i, expr in enumerate(node.expressions): - self.visit(expr, child_scope) - - @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode, scope: Scope): - self.visit(node.if_expr, scope) - self.visit(node.then_expr, scope.children[0]) - self.visit(node.else_expr, scope.children[1]) - - @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode, scope: Scope): - self.visit(node.condition, scope) - self.visit(node.body, scope.children[0]) - - @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode, scope: Scope): - self.visit(node.expr, scope) - for i, (_id, _type, _expr) in enumerate(node.cases): - self.visit(_expr, scope.children[i]) - - @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode, scope: Scope): - self.visit(node.obj, scope) - - for arg in node.args: - self.visit(arg, scope) - - @visitor.when(ast.AtomicNode) - def visit(self, node: ast.AtomicNode, scope: Scope): - pass - - @visitor.when(ast.UnaryNode) - def visit(self, node: ast.UnaryNode, scope: Scope): - self.visit(node.expr, scope) - - @visitor.when(ast.BinaryNode) - def visit(self, node: ast.BinaryNode, scope: Scope): - self.visit(node.left, scope) - self.visit(node.right, scope) +"""The type inference algorithm consist in a dependency di-graph with special nodes to handle the behavior of the +updates of components in the code and solve it in the `context`. For that we crate an structure called +DependencyGraph where we can create nodes as an structure called DependencyNode and arcs between them, an arc e = + where x and y are dependency nodes means that the type of node y is inferred by the type of node x, +so for solve the type of y we need first to infer the type of x. For this operation we need some basic nodes that +only contains the type of the node called AtomNode and in the digraph formation an AtomNode is never inferred from +another node. The DependencyGraph consist in a dictionary[node, adjacency list] this adjacency has a declaration +order and this is fundamental for the inference solution algorithm. If we have a case {x : [y, z]} where x, y, +z are nodes then the algorithm will determinate the type of y and all it dependencies before to start with z (a +simple DFS). The order in the adjacency list is the same appearance order in the program. At the end of the algorithm +all nodes that cannot solve it type will be tagged as `Object`. + +DependencyNode hierarchy + AtomNode + - type : Node type + + VariableInfoNode + - type: Node type + - variable_type : Reference to the variable info of the scope + + AttributeNode + - type : Node type + - attribute : Reference to the attribute of the class + + ParameterNode + - type : Node type + - method : Reference to the method of the class + - index : Index of the parameter of the method + + ReturnTypeNode + - type : Node type + - method : Reference to the method of the class + +All nodes has an implementation of the method update that handle how to update the type by it's dependencies +""" +from abc import ABC +from collections import OrderedDict, deque +from typing import Dict, List, Optional, Set, Tuple, Deque + +import cool.semantics.utils.astnodes as ast +import cool.semantics.utils.errors as err +import cool.visitor as visitor +from cool.semantics.utils.scope import (Attribute, Context, ErrorType, Method, + Scope, SemanticError, Type, VariableInfo) + + +class DependencyNode: + type: Type + + def update(self, _type: Type) -> None: + raise NotImplementedError() + + def __repr__(self): + return str(self) + + @property + def is_ready(self): + return True + + +class AtomNode(DependencyNode): + def __init__(self, atom_type: Type): + self.type: Type = atom_type + + def update(self, _type: Type) -> None: + pass + + def __str__(self): + return f'Atom({self.type.name})' + + +class VariableInfoNode(DependencyNode): + def __init__(self, var_type: Type, variable_info: VariableInfo): + self.type: Type = var_type + self.variable_info: VariableInfo = variable_info + + def update(self, _type): + self.type = self.variable_info.type = _type + + def __str__(self): + return f'VarInfo({self.variable_info.name}, {self.type.name})' + + +class AttributeNode(DependencyNode): + def __init__(self, attr_type: Type, attribute: Attribute): + self.type: Type = attr_type + self.attribute: Attribute = attribute + + def update(self, _type: Type) -> None: + self.type = self.attribute.type = _type + + def __str__(self): + return f'Attr({self.attribute.name}, {self.type.name})' + + +class ParameterNode(DependencyNode): + def __init__(self, param_type: Type, method: Method, index: int): + self.type: Type = param_type + self.method: Method = method + self.index: int = index + + def update(self, _type): + self.type = self.method.param_types[self.index] = _type + + def __str__(self): + return f'Param({self.method.name}, {self.index}, {self.type.name})' + + +class ReturnTypeNode(DependencyNode): + def __init__(self, ret_type: Type, method: Method): + self.type: Type = ret_type + self.method: Method = method + + def update(self, _type): + self.type = self.method.return_type = _type + + def __str__(self): + return f'Return({self.method.name}, {self.type.name})' + + +class BranchedNode(DependencyNode, ABC): + branches: List[DependencyNode] = [] + + @property + def is_ready(self) -> bool: + return all(x.type.name != 'AUTO_TYPE' for x in self.branches) + + +class ConditionalNode(BranchedNode): + def __init__(self, conditional_type, then_branch, else_branch): + self.type = conditional_type + self.branches = [then_branch, else_branch] + + def update(self, _type: Type) -> None: + self.type = _type + + def __str__(self): + return f'ConditionalNode({self.type.name})' + + +class CaseOfNode(BranchedNode): + def __init__(self, _type, branches): + self.type = _type + self.branches = branches + + def update(self, _type: Type) -> None: + self.type = _type + + def __str__(self): + return f'CaseOfNode({self.type.name})' + + +class DependencyGraph: + def __init__(self): + self.dependencies: Dict[DependencyNode, List[DependencyNode]] = OrderedDict() + + def add_node(self, node: DependencyNode): + if node not in self.dependencies: + self.dependencies[node] = [] + + def add_edge(self, node: DependencyNode, other: DependencyNode): + try: + self.dependencies[node].append(other) + except KeyError: + self.dependencies[node] = [other] + self.add_node(other) + + def update_dependencies(self, default_type: Type = None): + queue: Deque[DependencyNode] = deque(node for node in self.dependencies if isinstance(node, AtomNode)) + visited: Set[DependencyNode] = set(queue) + + while queue: + node = queue.popleft() + + if not node.is_ready: + continue + + for adj in self.dependencies[node]: + if adj not in visited: + adj.update(node.type) + visited.add(adj) + if not isinstance(adj, BranchedNode): + queue.append(adj) + + for node in self.dependencies: + if isinstance(node, BranchedNode) and node.is_ready: + node.update(Type.multi_join([x.type for x in node.branches])) + + queue = deque(node for node in self.dependencies + if isinstance(node, BranchedNode) and node.type.name != 'AUTO_TYPE') + visited.update(queue) + while queue: + node = queue.popleft() + for adj in self.dependencies[node]: + if adj not in visited: + adj.update(node.type) + visited.add(adj) + queue.append(adj) + + if default_type is not None: + for node in self.dependencies: + if node not in visited: + node.update(default_type) + + def __str__(self): + return '{\n\t' + '\n\t'.join(f'{key}: {value}' for key, value in self.dependencies.items()) + '\n}' + + +class InferenceChecker: + def __init__(self, context, errors): + self.context: Context = context + self.errors: List[str] = errors + self.current_type: Optional[Type] = None + self.current_method: Optional[Method] = None + + self.variables: Dict[VariableInfo, VariableInfoNode] = {} + self.attributes = self.build_attributes_reference(context) + self.methods = self.build_methods_reference(context) + self.graph = DependencyGraph() + + @staticmethod + def build_attributes_reference(context: Context) -> Dict[Tuple[str, str], AttributeNode]: + attributes = {} + + for typex in context: + for attr in typex.attributes: + attributes[typex.name, attr.name] = AttributeNode(attr.type, attr) + + return attributes + + @staticmethod + def build_methods_reference(context: Context) -> Dict[Tuple[str, str], Tuple[List[ParameterNode], ReturnTypeNode]]: + methods = {} + + for typex in context: + for method in typex.methods: + methods[typex.name, method.name] = ( + [ParameterNode(t, method, i) for i, t in enumerate(method.param_types)], + ReturnTypeNode(method.return_type, method)) + + return methods + + @visitor.on('node') + def visit(self, node, scope): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode, scope: Scope = None): + if scope is None: + scope = Scope() + + for item in node.declarations: + self.visit(item, scope.create_child()) + + # print(self.graph, '\n') + self.graph.update_dependencies(default_type=self.context.get_type('Object')) + # print(self.graph, '\n') + InferenceTypeSubstitute(self.context, self.errors).visit(node, scope) + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode, scope: Scope): + self.current_type = self.context.get_type(node.id) + + attrs = [feature for feature in node.features if isinstance(feature, ast.AttrDeclarationNode)] + methods = [feature for feature in node.features if isinstance(feature, ast.MethodDeclarationNode)] + + for attr in attrs: + self.visit(attr, scope) + + for method in methods: + self.visit(method, scope.create_child()) + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode, scope: Scope): + # Solve the expression of the attribute + expr_node = self.visit(node.expr, scope.create_child()) if node.expr is not None else None + + # Define attribute in the scope + var_info = scope.define_variable(node.id, self.context.get_type(node.type)) + + # Set and get the reference to the variable info node + var_info_node = self.variables[var_info] = VariableInfoNode(self.context.get_type(node.type), var_info) + + if node.type == 'AUTO_TYPE': + # Get the reference to the attribute node + attr_node = self.attributes[self.current_type.name, node.id] + + # If the expression node is not None then two edges are creates in the graph + if expr_node is not None: + self.graph.add_edge(expr_node, var_info_node) + self.graph.add_edge(expr_node, attr_node) + + # Finally a cycle of two nodes is created between var_info_node and attr_node + self.graph.add_edge(var_info_node, attr_node) + self.graph.add_edge(attr_node, var_info_node) + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode, scope: Scope): + self.current_method = self.current_type.get_method(node.id) + + # Define 'self' as a variable in the scope + self_var = scope.define_variable('self', self.current_type) + + # Set the reference of 'self' variable info node + self.variables[self_var] = VariableInfoNode(self.current_type, self_var) + + param_names = self.current_method.param_names + param_types = self.current_method.param_types + + for i, (param_name, param_type) in enumerate(zip(param_names, param_types)): + # Define parameter as local variable in current scope + param_var_info = scope.define_variable(param_name, param_type) + + # Set the reference to the variable info node + param_var_info_node = self.variables[param_var_info] = VariableInfoNode(param_type, param_var_info) + + if param_type.name == 'AUTO_TYPE': + # Get the parameter node + parameter_node = self.methods[self.current_type.name, self.current_method.name][0][i] + + # Create the cycle of two nodes between param_var_info_node and parameter_node + self.graph.add_edge(param_var_info_node, parameter_node) + self.graph.add_edge(parameter_node, param_var_info_node) + + # Solve the body of the method + body_node = self.visit(node.body, scope) + + if self.current_method.return_type.name == 'AUTO_TYPE': + # Get the return type node and add an edge body_node -> return_type_node + return_type_node = self.methods[self.current_type.name, self.current_method.name][1] + self.graph.add_edge(body_node, return_type_node) + + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode, scope: Scope): + for _id, _type, _expr in node.declarations: + try: + # Define and get the var_info + var_info = scope.define_variable(_id, self.context.get_type(_type)) + except SemanticError: + var_info = scope.define_variable(_id, ErrorType()) + var_info_node = self.variables[var_info] = VariableInfoNode(var_info.type, var_info) + + expr_node = self.visit(_expr, scope.create_child()) if _expr is not None else None + + if var_info.type.name == 'AUTO_TYPE': + # Create an edge or add an new node only if it is AutoType + if expr_node is not None: + self.graph.add_edge(expr_node, var_info_node) + if expr_node.type.name == 'AUTO_TYPE': + self.graph.add_edge(var_info_node, expr_node) + else: + self.graph.add_node(var_info_node) + elif expr_node is not None and expr_node.type.name == 'AUTO_TYPE': + self.graph.add_edge(var_info_node, expr_node) + + return self.visit(node.expr, scope.create_child()) + + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode, scope: Scope): + var_info = scope.find_variable(node.id) + + expr_node = self.visit(node.expr, scope.create_child()) + + if var_info is not None: + if expr_node.type.name != 'AUTO_TYPE' and var_info.type.name == 'AUTO_TYPE': + self.graph.add_edge(expr_node, self.variables[var_info]) + elif var_info.type.name != 'AUTO_TYPE' and expr_node.type.name == 'AUTO_TYPE': + self.graph.add_edge(AtomNode(self.context.get_type(var_info.type.name)), expr_node) + elif var_info.type.name == 'AUTO_TYPE' and expr_node.type.name == 'AUTO_TYPE': + # Create a cycle + self.graph.add_edge(expr_node, self.variables[var_info]) + self.graph.add_edge(self.variables[var_info], expr_node) + else: + pass + + return expr_node + + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode, scope: Scope): + child_scope = scope.create_child() + result_node = None + for expr in node.expressions: + result_node = self.visit(expr, child_scope) + return result_node + + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode, scope: Scope): + if_node = self.visit(node.if_expr, scope) + + if not isinstance(if_node, AtomNode): + self.graph.add_edge(AtomNode(self.context.get_type('Bool')), if_node) + + then_node = self.visit(node.then_expr, scope.create_child()) + else_node = self.visit(node.else_expr, scope.create_child()) + + if isinstance(then_node, AtomNode) and isinstance(else_node, AtomNode): + return AtomNode(then_node.type.join(else_node.type)) + + conditional_node = ConditionalNode(self.context.get_type('AUTO_TYPE'), then_node, else_node) + if isinstance(then_node, AtomNode) and not isinstance(else_node, AtomNode): + self.graph.add_edge(then_node, else_node) + elif not isinstance(then_node, AtomNode) and isinstance(else_node, AtomNode): + self.graph.add_edge(else_node, then_node) + else: + self.graph.add_edge(then_node, else_node) + self.graph.add_edge(else_node, then_node) + self.graph.add_edge(conditional_node, then_node) + self.graph.add_edge(conditional_node, else_node) + + return conditional_node + + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode, scope: Scope): + self.visit(node.condition, scope) + self.visit(node.body, scope.create_child()) + return AtomNode(self.context.get_type('Object')) + + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode, scope: Scope): + self.visit(node.expr, scope) + + defined_nodes = [] + not_defined_nodes = [] + case_nodes = [] + for _id, _type, _expr in node.cases: + new_scope = scope.create_child() + var_info = new_scope.define_variable(_id, self.context.get_type(_type)) + self.variables[var_info] = VariableInfoNode(var_info.type, var_info) + + case_node = self.visit(_expr, new_scope) + if isinstance(case_node, AtomNode): + defined_nodes.append(case_node) + else: + not_defined_nodes.append(case_node) + case_nodes.append(case_node) + + if any(e.type.name == 'AUTO_TYPE' for e in case_nodes): + if defined_nodes: + t = Type.multi_join([x.type for x in defined_nodes]) + for x in not_defined_nodes: + self.graph.add_edge(AtomNode(t), x) + case_of_node = CaseOfNode(self.context.get_type('AUTO_TYPE'), case_nodes) + self.graph.add_node(case_of_node) + return case_of_node + return AtomNode(Type.multi_join([e.type for e in case_nodes])) + + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode, scope: Scope): + if node.obj is None: + node.obj = ast.VariableNode('self') + obj_node = self.visit(node.obj, scope) + + if isinstance(obj_node, AtomNode) and obj_node.type.contains_method(node.id): + method, owner = obj_node.type.get_method(node.id, get_owner=True) + param_nodes, return_node = self.methods[owner.name, method.name] + for i, arg in enumerate(node.args): + arg_node = self.visit(arg, scope) + + if arg_node is None: + # Possible error + continue + + if isinstance(arg_node, AtomNode): + if param_nodes[i].type.name == 'AUTO_TYPE': + self.graph.add_edge(arg_node, param_nodes[i]) + else: + continue + else: + if param_nodes[i].type.name != 'AUTO_TYPE': + self.graph.add_edge(param_nodes[i], arg_node) + else: + self.graph.add_edge(param_nodes[i], arg_node) + self.graph.add_edge(arg_node, param_nodes[i]) + + if return_node.type.name == 'AUTO_TYPE': + return return_node + return AtomNode(return_node.type if return_node.type.name != 'SELF_TYPE' else obj_node.type) + + for arg in node.args: + self.visit(arg, scope) + return AtomNode(self.context.get_type('Object')) + + @visitor.when(ast.IntegerNode) + def visit(self, node: ast.IntegerNode, scope: Scope): + return AtomNode(self.context.get_type('Int')) + + @visitor.when(ast.StringNode) + def visit(self, node: ast.StringNode, scope: Scope): + return AtomNode(self.context.get_type('String')) + + @visitor.when(ast.BooleanNode) + def visit(self, node: ast.BooleanNode, scope: Scope): + return AtomNode(self.context.get_type('Bool')) + + @visitor.when(ast.VariableNode) + def visit(self, node: ast.VariableNode, scope: Scope): + var_info = scope.find_variable(node.lex) + + if var_info is not None: + if var_info.type.name == 'AUTO_TYPE': + return self.variables[var_info] + else: + return AtomNode(var_info.type) + else: + return None + + @visitor.when(ast.InstantiateNode) + def visit(self, node: ast.InstantiateNode, scope: Scope): + if node.lex in self.context.types: + return AtomNode(self.context.get_type(node.lex)) + return AtomNode(self.context.get_type('Object')) + + @visitor.when(ast.NegationNode) + def visit(self, node: ast.NegationNode, scope: Scope): + self.visit(node.expr, scope) + return AtomNode(self.context.get_type('Bool')) + + @visitor.when(ast.ComplementNode) + def visit(self, node: ast.ComplementNode, scope: Scope): + self.visit(node.expr, scope) + return AtomNode(self.context.get_type('Int')) + + @visitor.when(ast.IsVoidNode) + def visit(self, node: ast.IsVoidNode, scope: Scope): + self.visit(node.expr, scope) + return AtomNode(self.context.get_type('Bool')) + + @visitor.when(ast.PlusNode) + def visit(self, node: ast.PlusNode, scope: Scope): + return self._visit_arithmetic_node(node, scope, self.context.get_type('Int'), self.context.get_type('Int')) + + @visitor.when(ast.MinusNode) + def visit(self, node: ast.MinusNode, scope: Scope): + return self._visit_arithmetic_node(node, scope, self.context.get_type('Int'), self.context.get_type('Int')) + + @visitor.when(ast.StarNode) + def visit(self, node: ast.StarNode, scope: Scope): + return self._visit_arithmetic_node(node, scope, self.context.get_type('Int'), self.context.get_type('Int')) + + @visitor.when(ast.DivNode) + def visit(self, node: ast.DivNode, scope: Scope): + return self._visit_arithmetic_node(node, scope, self.context.get_type('Int'), self.context.get_type('Int')) + + @visitor.when(ast.LessEqualNode) + def visit(self, node: ast.LessEqualNode, scope: Scope): + return self._visit_arithmetic_node(node, scope, self.context.get_type('Int'), self.context.get_type('Bool')) + + @visitor.when(ast.LessThanNode) + def visit(self, node: ast.LessThanNode, scope: Scope): + return self._visit_arithmetic_node(node, scope, self.context.get_type('Int'), self.context.get_type('Bool')) + + @visitor.when(ast.EqualNode) + def visit(self, node: ast.EqualNode, scope: Scope): + self.visit(node.left, scope) + self.visit(node.right, scope) + return AtomNode(self.context.get_type('Bool')) + + def _visit_arithmetic_node(self, node: ast.BinaryNode, scope: Scope, member_types: Type, return_type: Type): + left = self.visit(node.left, scope) + right = self.visit(node.right, scope) + + if not isinstance(left, AtomNode): + self.graph.add_edge(AtomNode(member_types), left) + + if not isinstance(right, AtomNode): + self.graph.add_edge(AtomNode(member_types), right) + + return AtomNode(return_type) + + +class InferenceTypeSubstitute: + def __init__(self, context: Context, errors: List[str]): + self.context: Context = context + self.errors: List[str] = errors + self.current_type: Optional[Type] = None + self.current_method: Optional[Method] = None + + @visitor.on('node') + def visit(self, node, tabs): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode, scope: Scope): + for i, elem in enumerate(node.declarations): + self.visit(elem, scope.children[i]) + return scope + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode, scope: Scope): + self.current_type = self.context.get_type(node.id) + + attrs = [feature for feature in node.features if isinstance(feature, ast.AttrDeclarationNode)] + methods = [feature for feature in node.features if isinstance(feature, ast.MethodDeclarationNode)] + + i = 0 + for attr in attrs: + if attr.expr is not None: + attr.index = i + i += 1 + self.visit(attr, scope) + + for i, method in enumerate(methods, i): + self.visit(method, scope.children[i]) + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode, scope: Scope): + attr_type = self.context.get_type(node.type) + var_info = scope.find_variable(node.id) + + if node.expr is not None: + self.visit(node.expr, scope.children[node.index]) + + if attr_type == self.context.get_type('AUTO_TYPE'): + if var_info.type == self.context.get_type('AUTO_TYPE'): + self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % node.id) + node.type = var_info.type.name + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode, scope: Scope): + self.current_method = self.current_type.get_method(node.id) + return_type = self.context.get_type(node.return_type) + + for i, (name, expr_body_type) in enumerate(node.params): + variable_info = scope.find_variable(name) + if variable_info.type == self.context.get_type('AUTO_TYPE'): + self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % name) + node.params[i] = (name, variable_info.type.name) + + self.visit(node.body, scope) + + if return_type == self.context.get_type('AUTO_TYPE'): + if self.current_method.return_type == self.context.get_type('AUTO_TYPE'): + self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % node.id) + node.return_type = self.current_method.return_type.name + + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode, scope: Scope): + child_index = 0 + for i, (_id, _type, _expr) in enumerate(node.declarations): + variable_info = scope.find_variable(_id) + + if _expr is not None: + self.visit(_expr, scope.children[child_index]) + child_index += 1 + + if _type == 'AUTO_TYPE': + if variable_info.type == self.context.get_type('AUTO_TYPE'): + self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % _id) + node.declarations[i] = (_id, variable_info.type.name, _expr) + + self.visit(node.expr, scope.children[child_index]) + + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode, scope: Scope): + self.visit(node.expr, scope.children[0]) + + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode, scope: Scope): + child_scope = scope.children[0] + for i, expr in enumerate(node.expressions): + self.visit(expr, child_scope) + + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode, scope: Scope): + self.visit(node.if_expr, scope) + self.visit(node.then_expr, scope.children[0]) + self.visit(node.else_expr, scope.children[1]) + + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode, scope: Scope): + self.visit(node.condition, scope) + self.visit(node.body, scope.children[0]) + + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode, scope: Scope): + self.visit(node.expr, scope) + for i, (_id, _type, _expr) in enumerate(node.cases): + self.visit(_expr, scope.children[i]) + + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode, scope: Scope): + self.visit(node.obj, scope) + + for arg in node.args: + self.visit(arg, scope) + + @visitor.when(ast.AtomicNode) + def visit(self, node: ast.AtomicNode, scope: Scope): + pass + + @visitor.when(ast.UnaryNode) + def visit(self, node: ast.UnaryNode, scope: Scope): + self.visit(node.expr, scope) + + @visitor.when(ast.BinaryNode) + def visit(self, node: ast.BinaryNode, scope: Scope): + self.visit(node.left, scope) + self.visit(node.right, scope) diff --git a/src/cool/semantics/utils/astnodes.py b/src/cool/semantics/utils/astnodes.py index 539666efa..2167be6fe 100644 --- a/src/cool/semantics/utils/astnodes.py +++ b/src/cool/semantics/utils/astnodes.py @@ -1,175 +1,175 @@ -from typing import List, Union, Tuple, Optional - -Feature = Union['MethodDeclarationNode', 'AttrDeclarationNode'] - - -class Node: - pass - - -class ProgramNode(Node): - def __init__(self, declarations): - self.declarations: List[ClassDeclarationNode] = declarations - - -class DeclarationNode(Node): - pass - - -class ClassDeclarationNode(DeclarationNode): - def __init__(self, idx, features, parent=None): - self.id: str = idx - self.parent: str = parent - self.features: List[Feature] = features - - -class MethodDeclarationNode(DeclarationNode): - def __init__(self, idx, params, return_type, body): - self.id: str = idx - self.params: List[Tuple[str, str]] = params - self.return_type: str = return_type - self.body: ExprNode = body - - -class AttrDeclarationNode(DeclarationNode): - def __init__(self, idx, typex, expr=None): - self.id: str = idx - self.type: str = typex - self.expr: ExprNode = expr - - -class ExprNode(Node): - pass - - -class ParenthesisExpr(ExprNode): - def __init__(self, expr): - self.expr = expr - - -class BlockNode(ExprNode): - def __init__(self, expressions): - self.expressions: List[ExprNode] = expressions - - -class LetNode(ExprNode): - def __init__(self, declarations, expr): - self.declarations: List[Tuple[str, str, Optional[ExprNode]]] = declarations - self.expr: ExprNode = expr - - -class SwitchCaseNode(ExprNode): - def __init__(self, expr, cases): - self.expr: ExprNode = expr - self.cases: List[Tuple[str, str, ExprNode]] = cases - - -# class CaseNode(ExprNode): -# def __init__(self, idx, typex, expr): -# self.id: str = idx -# self.type: str = typex -# self.expr: ExprNode = expr - - -class AssignNode(ExprNode): - def __init__(self, idx, expr): - self.id: str = idx - self.expr: ExprNode = expr - - -class ConditionalNode(ExprNode): - def __init__(self, ifx, then, elsex): - self.if_expr: ExprNode = ifx - self.then_expr: ExprNode = then - self.else_expr: ExprNode = elsex - - -class WhileNode(ExprNode): - def __init__(self, condition, body): - self.condition: ExprNode = condition - self.body: ExprNode = body - - -class MethodCallNode(ExprNode): - def __init__(self, idx, args, obj=None, typex=None): - self.obj: ExprNode = obj - self.id: str = idx - self.args: List[ExprNode] = args - self.type: str = typex - - -class AtomicNode(ExprNode): - def __init__(self, lex): - self.lex: str = lex - - -class UnaryNode(ExprNode): - def __init__(self, expr): - self.expr: ExprNode = expr - - -class BinaryNode(ExprNode): - def __init__(self, left, operation, right): - self.left: ExprNode = left - self.operation: str = operation - self.right: ExprNode = right - - -class VariableNode(AtomicNode): - pass - - -class InstantiateNode(AtomicNode): - pass - - -class IntegerNode(AtomicNode): - pass - - -class StringNode(AtomicNode): - pass - - -class BooleanNode(AtomicNode): - pass - - -class NegationNode(UnaryNode): - pass - - -class ComplementNode(UnaryNode): - pass - - -class IsVoidNode(UnaryNode): - pass - - -class PlusNode(BinaryNode): - pass - - -class MinusNode(BinaryNode): - pass - - -class StarNode(BinaryNode): - pass - - -class DivNode(BinaryNode): - pass - - -class LessThanNode(BinaryNode): - pass - - -class LessEqualNode(BinaryNode): - pass - - -class EqualNode(BinaryNode): - pass +from typing import List, Union, Tuple, Optional + +Feature = Union['MethodDeclarationNode', 'AttrDeclarationNode'] + + +class Node: + pass + + +class ProgramNode(Node): + def __init__(self, declarations): + self.declarations: List[ClassDeclarationNode] = declarations + + +class DeclarationNode(Node): + pass + + +class ClassDeclarationNode(DeclarationNode): + def __init__(self, idx, features, parent=None): + self.id: str = idx + self.parent: str = parent + self.features: List[Feature] = features + + +class MethodDeclarationNode(DeclarationNode): + def __init__(self, idx, params, return_type, body): + self.id: str = idx + self.params: List[Tuple[str, str]] = params + self.return_type: str = return_type + self.body: ExprNode = body + + +class AttrDeclarationNode(DeclarationNode): + def __init__(self, idx, typex, expr=None): + self.id: str = idx + self.type: str = typex + self.expr: ExprNode = expr + + +class ExprNode(Node): + pass + + +class ParenthesisExpr(ExprNode): + def __init__(self, expr): + self.expr = expr + + +class BlockNode(ExprNode): + def __init__(self, expressions): + self.expressions: List[ExprNode] = expressions + + +class LetNode(ExprNode): + def __init__(self, declarations, expr): + self.declarations: List[Tuple[str, str, Optional[ExprNode]]] = declarations + self.expr: ExprNode = expr + + +class SwitchCaseNode(ExprNode): + def __init__(self, expr, cases): + self.expr: ExprNode = expr + self.cases: List[Tuple[str, str, ExprNode]] = cases + + +# class CaseNode(ExprNode): +# def __init__(self, idx, typex, expr): +# self.id: str = idx +# self.type: str = typex +# self.expr: ExprNode = expr + + +class AssignNode(ExprNode): + def __init__(self, idx, expr): + self.id: str = idx + self.expr: ExprNode = expr + + +class ConditionalNode(ExprNode): + def __init__(self, ifx, then, elsex): + self.if_expr: ExprNode = ifx + self.then_expr: ExprNode = then + self.else_expr: ExprNode = elsex + + +class WhileNode(ExprNode): + def __init__(self, condition, body): + self.condition: ExprNode = condition + self.body: ExprNode = body + + +class MethodCallNode(ExprNode): + def __init__(self, idx, args, obj=None, typex=None): + self.obj: ExprNode = obj + self.id: str = idx + self.args: List[ExprNode] = args + self.type: str = typex + + +class AtomicNode(ExprNode): + def __init__(self, lex): + self.lex: str = lex + + +class UnaryNode(ExprNode): + def __init__(self, expr): + self.expr: ExprNode = expr + + +class BinaryNode(ExprNode): + def __init__(self, left, operation, right): + self.left: ExprNode = left + self.operation: str = operation + self.right: ExprNode = right + + +class VariableNode(AtomicNode): + pass + + +class InstantiateNode(AtomicNode): + pass + + +class IntegerNode(AtomicNode): + pass + + +class StringNode(AtomicNode): + pass + + +class BooleanNode(AtomicNode): + pass + + +class NegationNode(UnaryNode): + pass + + +class ComplementNode(UnaryNode): + pass + + +class IsVoidNode(UnaryNode): + pass + + +class PlusNode(BinaryNode): + pass + + +class MinusNode(BinaryNode): + pass + + +class StarNode(BinaryNode): + pass + + +class DivNode(BinaryNode): + pass + + +class LessThanNode(BinaryNode): + pass + + +class LessEqualNode(BinaryNode): + pass + + +class EqualNode(BinaryNode): + pass diff --git a/src/cool/semantics/utils/errors.py b/src/cool/semantics/utils/errors.py index ded744d50..c32cd75a0 100644 --- a/src/cool/semantics/utils/errors.py +++ b/src/cool/semantics/utils/errors.py @@ -1,30 +1,30 @@ -ATTRIBUTE_OVERRIDE_ERROR = 'OverrideError: Attribute "%s" already defined in "%s", attributes cannot be overridden' -METHOD_OVERRIDE_ERROR = 'OverrideError: Method "%s" already defined in "%s" with a different signature.' - -INCOMPATIBLE_TYPES = 'TypeError: Cannot convert "%s" into "%s".' -INVALID_PARAM_TYPE = 'TypeError: "%s" cannot be a static type of a parameter.' -INVALID_CASE_TYPE = 'TypeError: "%s" cannot be a static type of a case branch.' -INVALID_PARENT_TYPE = 'TypeError: Class "%s" cannot inherits from "%s"' -INVALID_ANCESTOR = 'TypeError: Class "%s" has no an ancestor class "%s".' - -INVALID_BINARY_OPERATION = 'OperationError: Operation "%s" is not defined between "%s" and "%s".' -INVALID_UNARY_OPERATION = 'OperationError: Operation "%s" is not defined for "%s".' - -SELF_IS_READONLY = 'IdentifierError: Variable "self" is read-only.' -SELF_INVALID_ATTRIBUTE_ID = 'IdentifierError: Cannot set "self" as attribute of a class.' -SELF_INVALID_PARAM_ID = 'IdentifierError: Cannot set "self" as parameter of a method.' -LOCAL_ALREADY_DEFINED = 'IdentifierError: Variable "%s" is already defined in method "%s".' -VARIABLE_NOT_DEFINED = 'IdentifierError: Variable "%s" is not defined in "%s".' - -INFERENCE_ERROR_ATTRIBUTE = 'InferenceError: Cannot infer type for attribute "%s".' -INFERENCE_ERROR_PARAMETER = 'InferenceError: Cannot infer type for parameter "%s".' -INFERENCE_ERROR_VARIABLE = 'InferenceError: Cannot infer type for variable "%s".' -INFERENCE_ERROR_METHOD = 'InferenceError: Cannot infer return type for method "%s".' - - -DIVIDE_BY_ZERO = 'ZeroDivisionError: Division by zero.' -INPUT_INT_ERROR = 'InputError: Expected a number.' -MAIN_CLASS_NOT_FOUND = 'MainClassNotFound: no Main class in program.' -MAIN_METHOD_NOT_FOUND = 'MainMethodNotFound: no main method in class Main.' -VOID_EXPRESSION = 'VoidReferenceError: Object reference not set to an instance of an object.' -CASE_OF_ERROR = 'CaseOfError: No branch matches wit de dynamic type of the case expression.' +ATTRIBUTE_OVERRIDE_ERROR = 'OverrideError: Attribute "%s" already defined in "%s", attributes cannot be overridden' +METHOD_OVERRIDE_ERROR = 'OverrideError: Method "%s" already defined in "%s" with a different signature.' + +INCOMPATIBLE_TYPES = 'TypeError: Cannot convert "%s" into "%s".' +INVALID_PARAM_TYPE = 'TypeError: "%s" cannot be a static type of a parameter.' +INVALID_CASE_TYPE = 'TypeError: "%s" cannot be a static type of a case branch.' +INVALID_PARENT_TYPE = 'TypeError: Class "%s" cannot inherits from "%s"' +INVALID_ANCESTOR = 'TypeError: Class "%s" has no an ancestor class "%s".' + +INVALID_BINARY_OPERATION = 'OperationError: Operation "%s" is not defined between "%s" and "%s".' +INVALID_UNARY_OPERATION = 'OperationError: Operation "%s" is not defined for "%s".' + +SELF_IS_READONLY = 'IdentifierError: Variable "self" is read-only.' +SELF_INVALID_ATTRIBUTE_ID = 'IdentifierError: Cannot set "self" as attribute of a class.' +SELF_INVALID_PARAM_ID = 'IdentifierError: Cannot set "self" as parameter of a method.' +LOCAL_ALREADY_DEFINED = 'IdentifierError: Variable "%s" is already defined in method "%s".' +VARIABLE_NOT_DEFINED = 'IdentifierError: Variable "%s" is not defined in "%s".' + +INFERENCE_ERROR_ATTRIBUTE = 'InferenceError: Cannot infer type for attribute "%s".' +INFERENCE_ERROR_PARAMETER = 'InferenceError: Cannot infer type for parameter "%s".' +INFERENCE_ERROR_VARIABLE = 'InferenceError: Cannot infer type for variable "%s".' +INFERENCE_ERROR_METHOD = 'InferenceError: Cannot infer return type for method "%s".' + + +DIVIDE_BY_ZERO = 'ZeroDivisionError: Division by zero.' +INPUT_INT_ERROR = 'InputError: Expected a number.' +MAIN_CLASS_NOT_FOUND = 'MainClassNotFound: no Main class in program.' +MAIN_METHOD_NOT_FOUND = 'MainMethodNotFound: no main method in class Main.' +VOID_EXPRESSION = 'VoidReferenceError: Object reference not set to an instance of an object.' +CASE_OF_ERROR = 'CaseOfError: No branch matches wit de dynamic type of the case expression.' diff --git a/src/cool/semantics/utils/scope.py b/src/cool/semantics/utils/scope.py index 2d39131a8..e86f7fb16 100644 --- a/src/cool/semantics/utils/scope.py +++ b/src/cool/semantics/utils/scope.py @@ -1,271 +1,271 @@ -from collections import OrderedDict -from typing import List, Optional, Dict, Tuple, Union - - -class SemanticError(Exception): - @property - def text(self): - return self.args[0] - - -class Attribute: - def __init__(self, name, typex): - self.name: str = name - self.type: 'Type' = typex - - 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: str = name - self.param_names: List[str] = param_names - self.param_types: List['Type'] = params_types - self.return_type: '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 - tuple(other.param_types) == tuple(self.param_types)) - - -class Type: - def __init__(self, name: str): - self.name: str = name - self.attributes_dict: OrderedDict[str, Attribute] = OrderedDict() - self.methods_dict: OrderedDict[str, Method] = OrderedDict() - self.parent: Optional['Type'] = None - - @property - def attributes(self): - return [x for _, x in self.attributes_dict.items()] - - @property - def methods(self): - return [x for _, x in self.methods_dict.items()] - - def set_parent(self, parent: 'Type') -> None: - if self.parent is not None: - raise SemanticError(f'Parent type is already set for {self.name}.') - self.parent = parent - - def get_attribute(self, name: str, get_owner: bool = False) -> Union[Attribute, Tuple[Attribute, 'Type']]: - """ - Search the innermost declaration of the attribute with the given name and return it, if "get_owner" has - value "True" the returned object is a tuple (attribute, type) where type is the innermost `Type` in th Type - Hierarchy where the attribute is defined. If the method does not exist in the hierarchy then a SemanticError is - raised. - - :param name: str, name of the attribute - - :param get_owner: bool, if has value "True" then a tuple (attribute, type) is returned else only the method is - returned - - :return: the desired attribute and it's optional type owner. - """ - try: - return self.attributes_dict[name] if not get_owner else (self.attributes_dict[name], self) - except KeyError: - if self.parent is None: - raise SemanticError(f'Attribute "{name}" is not defined in {self.name}.') - try: - return self.parent.get_attribute(name, get_owner) - except SemanticError: - raise SemanticError(f'Attribute "{name}" is not defined in {self.name}.') - - def define_attribute(self, name: str, typex: 'Type') -> Attribute: - try: - self.get_attribute(name) - except SemanticError: - attribute = Attribute(name, typex) - self.attributes_dict[name] = attribute - return attribute - else: - raise SemanticError(f'Attribute "{name}" is already defined in {self.name}.') - - def contains_attribute(self, name: str) -> bool: - return name in self.attributes_dict or self.parent is not None and self.parent.contains_attribute(name) - - def get_method(self, name: str, get_owner: bool = False) -> Union[Method, Tuple[Method, 'Type']]: - """ - Search the innermost declaration of the method with the given name and return it, if "get_owner" has - value "True" the returned object is a tuple (method, type) where type is the innermost `Type` in th Type - Hierarchy where the methods is defined. If the method does not exist in the hierarchy then a SemanticError is - raised - - :param name: str, name of the method - - :param get_owner: bool, if has value "True" then a tuple (method, type) is returned else only the method is - returned - - :return: the desired method and it's optional type owner. - """ - try: - return self.methods_dict[name] if not get_owner else (self.methods_dict[name], self) - except KeyError: - if self.parent is None: - raise SemanticError(f'Method "{name}" is not defined in {self.name}.') - try: - return self.parent.get_method(name, get_owner) - except SemanticError: - raise SemanticError(f'Method "{name}" is not defined in {self.name}.') - - def define_method(self, name: str, - param_names: List[str], - param_types: List['Type'], - return_type: 'Type') -> Method: - if name in self.methods_dict: - raise SemanticError(f'Method "{name}" already defined in {self.name}') - - method = Method(name, param_names, param_types, return_type) - self.methods_dict[name] = method - return method - - def contains_method(self, name) -> bool: - return name in self.methods_dict or (self.parent is not None and self.parent.contains_method(name)) - - def all_attributes(self) -> List[Tuple[Attribute, 'Type']]: - attributes = [] if self.parent is None else self.parent.all_attributes() - attributes += [(x, self) for x in self.attributes] - return attributes - - def all_methods(self) -> List[Tuple[Method, 'Type']]: - methods = [] if self.parent is None else self.parent.all_methods() - methods += [(x, self) for x in self.methods] - return methods - - def conforms_to(self, other: 'Type') -> bool: - return other.bypass() or self == other or self.parent is not None and self.parent.conforms_to(other) - - def join(self, other: 'Type') -> 'Type': - self_ancestors = set(self.get_ancestors()) - - current_type = other - while current_type is not None: - if current_type in self_ancestors: - break - current_type = current_type.parent - return current_type - - @staticmethod - def multi_join(types: List['Type']) -> 'Type': - static_type = types[0] - for t in types[1:]: - static_type = static_type.join(t) - return static_type - - def bypass(self) -> bool: - return False - - def get_ancestors(self): - if self.parent is None: - return [self] - return [self] + self.parent.get_ancestors() - - def __str__(self): - output = f'type {self.name}' - parent = '' if self.parent is None else f' : {self.parent.name}' - output += parent - output += ' {' - output += '\n\t' if self.attributes or self.methods else '' - output += '\n\t'.join(str(x) for x in self.attributes) - output += '\n\t' if self.attributes_dict else '' - output += '\n\t'.join(str(x) for x in self.methods) - output += '\n' if self.methods_dict else '' - output += '}\n' - return output - - def __repr__(self): - return str(self) - - -class ErrorType(Type): - def __init__(self): - super().__init__('Error') - - def conforms_to(self, other): - return True - - def bypass(self): - return True - - def __eq__(self, other): - return isinstance(other, Type) - - -class Context: - def __init__(self): - self.types: Dict[str, Type] = {} - - def create_type(self, name: str) -> Type: - if name in self.types: - raise SemanticError(f'Type with the same name ({name}) already in context.') - typex = self.types[name] = Type(name) - return typex - - def get_type(self, name: str) -> Type: - try: - return self.types[name] - except KeyError: - raise SemanticError(f'Type "{name}" is not defined.') - - 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) - - def __iter__(self): - return iter(self.types.values()) - - -class VariableInfo: - def __init__(self, name, var_type): - self.name: str = name - self.type: Type = var_type - - def __str__(self): - return self.name + ': ' + self.type.name - - -class Scope: - def __init__(self, parent: Optional['Scope'] = None): - self.locals: Dict[str, VariableInfo] = {} - self.parent: Optional['Scope'] = parent - self.children: List[Scope] = [] - - def create_child(self) -> 'Scope': - child = Scope(self) - self.children.append(child) - return child - - def define_variable(self, var_name: str, var_type: Type) -> VariableInfo: - info = VariableInfo(var_name, var_type) - self.locals[var_name] = info - return info - - def find_variable(self, var_name: str) -> Optional[VariableInfo]: - try: - return self.locals[var_name] - except KeyError: - return self.parent.find_variable(var_name) if self.parent is not None else None - - def is_defined(self, var_name) -> bool: - return self.find_variable(var_name) is not None - - def is_local(self, var_name: str) -> bool: - return var_name in self.locals - - def clear(self): - self.children = [] - - def __len__(self): - return len(self.locals) +from collections import OrderedDict +from typing import List, Optional, Dict, Tuple, Union + + +class SemanticError(Exception): + @property + def text(self): + return self.args[0] + + +class Attribute: + def __init__(self, name, typex): + self.name: str = name + self.type: 'Type' = typex + + 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: str = name + self.param_names: List[str] = param_names + self.param_types: List['Type'] = params_types + self.return_type: '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 + tuple(other.param_types) == tuple(self.param_types)) + + +class Type: + def __init__(self, name: str): + self.name: str = name + self.attributes_dict: OrderedDict[str, Attribute] = OrderedDict() + self.methods_dict: OrderedDict[str, Method] = OrderedDict() + self.parent: Optional['Type'] = None + + @property + def attributes(self): + return [x for _, x in self.attributes_dict.items()] + + @property + def methods(self): + return [x for _, x in self.methods_dict.items()] + + def set_parent(self, parent: 'Type') -> None: + if self.parent is not None: + raise SemanticError(f'Parent type is already set for {self.name}.') + self.parent = parent + + def get_attribute(self, name: str, get_owner: bool = False) -> Union[Attribute, Tuple[Attribute, 'Type']]: + """ + Search the innermost declaration of the attribute with the given name and return it, if "get_owner" has + value "True" the returned object is a tuple (attribute, type) where type is the innermost `Type` in th Type + Hierarchy where the attribute is defined. If the method does not exist in the hierarchy then a SemanticError is + raised. + + :param name: str, name of the attribute + + :param get_owner: bool, if has value "True" then a tuple (attribute, type) is returned else only the method is + returned + + :return: the desired attribute and it's optional type owner. + """ + try: + return self.attributes_dict[name] if not get_owner else (self.attributes_dict[name], self) + except KeyError: + if self.parent is None: + raise SemanticError(f'Attribute "{name}" is not defined in {self.name}.') + try: + return self.parent.get_attribute(name, get_owner) + except SemanticError: + raise SemanticError(f'Attribute "{name}" is not defined in {self.name}.') + + def define_attribute(self, name: str, typex: 'Type') -> Attribute: + try: + self.get_attribute(name) + except SemanticError: + attribute = Attribute(name, typex) + self.attributes_dict[name] = attribute + return attribute + else: + raise SemanticError(f'Attribute "{name}" is already defined in {self.name}.') + + def contains_attribute(self, name: str) -> bool: + return name in self.attributes_dict or self.parent is not None and self.parent.contains_attribute(name) + + def get_method(self, name: str, get_owner: bool = False) -> Union[Method, Tuple[Method, 'Type']]: + """ + Search the innermost declaration of the method with the given name and return it, if "get_owner" has + value "True" the returned object is a tuple (method, type) where type is the innermost `Type` in th Type + Hierarchy where the methods is defined. If the method does not exist in the hierarchy then a SemanticError is + raised + + :param name: str, name of the method + + :param get_owner: bool, if has value "True" then a tuple (method, type) is returned else only the method is + returned + + :return: the desired method and it's optional type owner. + """ + try: + return self.methods_dict[name] if not get_owner else (self.methods_dict[name], self) + except KeyError: + if self.parent is None: + raise SemanticError(f'Method "{name}" is not defined in {self.name}.') + try: + return self.parent.get_method(name, get_owner) + except SemanticError: + raise SemanticError(f'Method "{name}" is not defined in {self.name}.') + + def define_method(self, name: str, + param_names: List[str], + param_types: List['Type'], + return_type: 'Type') -> Method: + if name in self.methods_dict: + raise SemanticError(f'Method "{name}" already defined in {self.name}') + + method = Method(name, param_names, param_types, return_type) + self.methods_dict[name] = method + return method + + def contains_method(self, name) -> bool: + return name in self.methods_dict or (self.parent is not None and self.parent.contains_method(name)) + + def all_attributes(self) -> List[Tuple[Attribute, 'Type']]: + attributes = [] if self.parent is None else self.parent.all_attributes() + attributes += [(x, self) for x in self.attributes] + return attributes + + def all_methods(self) -> List[Tuple[Method, 'Type']]: + methods = [] if self.parent is None else self.parent.all_methods() + methods += [(x, self) for x in self.methods] + return methods + + def conforms_to(self, other: 'Type') -> bool: + return other.bypass() or self == other or self.parent is not None and self.parent.conforms_to(other) + + def join(self, other: 'Type') -> 'Type': + self_ancestors = set(self.get_ancestors()) + + current_type = other + while current_type is not None: + if current_type in self_ancestors: + break + current_type = current_type.parent + return current_type + + @staticmethod + def multi_join(types: List['Type']) -> 'Type': + static_type = types[0] + for t in types[1:]: + static_type = static_type.join(t) + return static_type + + def bypass(self) -> bool: + return False + + def get_ancestors(self): + if self.parent is None: + return [self] + return [self] + self.parent.get_ancestors() + + def __str__(self): + output = f'type {self.name}' + parent = '' if self.parent is None else f' : {self.parent.name}' + output += parent + output += ' {' + output += '\n\t' if self.attributes or self.methods else '' + output += '\n\t'.join(str(x) for x in self.attributes) + output += '\n\t' if self.attributes_dict else '' + output += '\n\t'.join(str(x) for x in self.methods) + output += '\n' if self.methods_dict else '' + output += '}\n' + return output + + def __repr__(self): + return str(self) + + +class ErrorType(Type): + def __init__(self): + super().__init__('Error') + + def conforms_to(self, other): + return True + + def bypass(self): + return True + + def __eq__(self, other): + return isinstance(other, Type) + + +class Context: + def __init__(self): + self.types: Dict[str, Type] = {} + + def create_type(self, name: str) -> Type: + if name in self.types: + raise SemanticError(f'Type with the same name ({name}) already in context.') + typex = self.types[name] = Type(name) + return typex + + def get_type(self, name: str) -> Type: + try: + return self.types[name] + except KeyError: + raise SemanticError(f'Type "{name}" is not defined.') + + 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) + + def __iter__(self): + return iter(self.types.values()) + + +class VariableInfo: + def __init__(self, name, var_type): + self.name: str = name + self.type: Type = var_type + + def __str__(self): + return self.name + ': ' + self.type.name + + +class Scope: + def __init__(self, parent: Optional['Scope'] = None): + self.locals: Dict[str, VariableInfo] = {} + self.parent: Optional['Scope'] = parent + self.children: List[Scope] = [] + + def create_child(self) -> 'Scope': + child = Scope(self) + self.children.append(child) + return child + + def define_variable(self, var_name: str, var_type: Type) -> VariableInfo: + info = VariableInfo(var_name, var_type) + self.locals[var_name] = info + return info + + def find_variable(self, var_name: str) -> Optional[VariableInfo]: + try: + return self.locals[var_name] + except KeyError: + return self.parent.find_variable(var_name) if self.parent is not None else None + + def is_defined(self, var_name) -> bool: + return self.find_variable(var_name) is not None + + def is_local(self, var_name: str) -> bool: + return var_name in self.locals + + def clear(self): + self.children = [] + + def __len__(self): + return len(self.locals) diff --git a/src/cool/visitor/__init__.py b/src/cool/visitor/__init__.py index 6949fb886..2c288e23c 100644 --- a/src/cool/visitor/__init__.py +++ b/src/cool/visitor/__init__.py @@ -1 +1 @@ -from cool.visitor.visitor import on, when +from cool.visitor.visitor import on, when diff --git a/src/cool/visitor/visitor.py b/src/cool/visitor/visitor.py index 5e3b2526a..c7f5e8175 100644 --- a/src/cool/visitor/visitor.py +++ b/src/cool/visitor/visitor.py @@ -1,84 +1,84 @@ -# The MIT License (MIT) -# -# Copyright © 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 - self.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: - t = self.targets - ks = t.keys() - ans = [t[k](*args, **kw) for k in ks if issubclass(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) +# The MIT License (MIT) +# +# Copyright © 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 + self.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: + t = self.targets + ks = t.keys() + ans = [t[k](*args, **kw) for k in ks if issubclass(typ, k)] + if len(ans) == 1: + return ans.pop() + return ans + + def add_target(self, typ, target): + self.targets[typ] = target + + @staticmethod + def __argspec(fn): + # Support for Python 3 type hints requires inspect.getfullargspec + if hasattr(inspect, 'getfullargspec'): + return inspect.getfullargspec(fn) + else: + return inspect.getargspec(fn) diff --git a/src/coolc.sh b/src/coolc.sh index 3088de4f9..c685089bd 100755 --- a/src/coolc.sh +++ b/src/coolc.sh @@ -1,11 +1,11 @@ -# Incluya aquí las instrucciones necesarias para ejecutar su compilador - -INPUT_FILE=$1 -OUTPUT_FILE=${INPUT_FILE:0: -2}mips - -# Si su compilador no lo hace ya, aquí puede imprimir la información de contacto -echo "LINEA_CON_NOMBRE_Y_VERSION_DEL_COMPILADOR" # TODO: Recuerde cambiar estas -echo "Copyright (c) 2019: Nombre1, Nombre2, Nombre3" # TODO: líneas a los valores correctos - -# Llamar al compilador -echo "Compiling $INPUT_FILE into $OUTPUT_FILE" +# Incluya aquí las instrucciones necesarias para ejecutar su compilador + +INPUT_FILE=$1 +OUTPUT_FILE=${INPUT_FILE:0: -2}mips + +# Si su compilador no lo hace ya, aquí puede imprimir la información de contacto +echo "LINEA_CON_NOMBRE_Y_VERSION_DEL_COMPILADOR" # TODO: Recuerde cambiar estas +echo "Copyright (c) 2019: Nombre1, Nombre2, Nombre3" # TODO: líneas a los valores correctos + +# Llamar al compilador +echo "Compiling $INPUT_FILE into $OUTPUT_FILE" diff --git a/src/makefile b/src/makefile index 30df993f5..cd83fb352 100644 --- a/src/makefile +++ b/src/makefile @@ -1,12 +1,12 @@ -.PHONY: clean - -main: - # Compiling the compiler :) - -clean: - rm -rf build/* - rm -rf ../tests/*/*.mips - -test: - pytest ../tests -v --tb=short -m=${TAG} - +.PHONY: clean + +main: + # Compiling the compiler :) + +clean: + rm -rf build/* + rm -rf ../tests/*/*.mips + +test: + pytest ../tests -v --tb=short -m=${TAG} + diff --git a/tests/codegen/arith.cl b/tests/codegen/arith.cl index af5951cf7..0d9f5dd33 100755 --- 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_input.txt b/tests/codegen/arith_input.txt index 83e05b1ea..c431a225b 100644 --- a/tests/codegen/arith_input.txt +++ b/tests/codegen/arith_input.txt @@ -1,13 +1,13 @@ -a -1 -b -c -0 -d -e -f -g -h -j -5 -q +a +1 +b +c +0 +d +e +f +g +h +j +5 +q diff --git a/tests/codegen/arith_output.txt b/tests/codegen/arith_output.txt index 44b4ce73e..476cb3bad 100644 --- a/tests/codegen/arith_output.txt +++ b/tests/codegen/arith_output.txt @@ -1,158 +1,158 @@ -number 0 is even! -Class type is now A - - To add a number to 0 ...enter a: - To negate 0 ...enter b: - To find the difference between 0 and another number...enter c: - To find the factorial of 0 ...enter d: - To square 0 ...enter e: - To cube 0 ...enter f: - To find out if 0 is a multiple of 3...enter g: - To divide 0 by 8...enter h: - To get a new number...enter j: - To quit...enter q: - - -Please enter a number... number 1 is odd! -Class type is now B - - To add a number to 1 ...enter a: - To negate 1 ...enter b: - To find the difference between 1 and another number...enter c: - To find the factorial of 1 ...enter d: - To square 1 ...enter e: - To cube 1 ...enter f: - To find out if 1 is a multiple of 3...enter g: - To divide 1 by 8...enter h: - To get a new number...enter j: - To quit...enter q: - -number -1 is odd! -Class type is now C - - To add a number to -1 ...enter a: - To negate -1 ...enter b: - To find the difference between -1 and another number...enter c: - To find the factorial of -1 ...enter d: - To square -1 ...enter e: - To cube -1 ...enter f: - To find out if -1 is a multiple of 3...enter g: - To divide -1 by 8...enter h: - To get a new number...enter j: - To quit...enter q: - - -Please enter a number... number 1 is odd! -Class type is now D - - To add a number to 1 ...enter a: - To negate 1 ...enter b: - To find the difference between 1 and another number...enter c: - To find the factorial of 1 ...enter d: - To square 1 ...enter e: - To cube 1 ...enter f: - To find out if 1 is a multiple of 3...enter g: - To divide 1 by 8...enter h: - To get a new number...enter j: - To quit...enter q: - -number 1 is odd! -Class type is now E - - To add a number to 1 ...enter a: - To negate 1 ...enter b: - To find the difference between 1 and another number...enter c: - To find the factorial of 1 ...enter d: - To square 1 ...enter e: - To cube 1 ...enter f: - To find out if 1 is a multiple of 3...enter g: - To divide 1 by 8...enter h: - To get a new number...enter j: - To quit...enter q: - -number 1 is odd! -Class type is now E - - To add a number to 1 ...enter a: - To negate 1 ...enter b: - To find the difference between 1 and another number...enter c: - To find the factorial of 1 ...enter d: - To square 1 ...enter e: - To cube 1 ...enter f: - To find out if 1 is a multiple of 3...enter g: - To divide 1 by 8...enter h: - To get a new number...enter j: - To quit...enter q: - -number 1 is odd! -Class type is now E - - To add a number to 1 ...enter a: - To negate 1 ...enter b: - To find the difference between 1 and another number...enter c: - To find the factorial of 1 ...enter d: - To square 1 ...enter e: - To cube 1 ...enter f: - To find out if 1 is a multiple of 3...enter g: - To divide 1 by 8...enter h: - To get a new number...enter j: - To quit...enter q: - -number 1 is not divisible by 3. -number 1 is odd! -Class type is now E - - To add a number to 1 ...enter a: - To negate 1 ...enter b: - To find the difference between 1 and another number...enter c: - To find the factorial of 1 ...enter d: - To square 1 ...enter e: - To cube 1 ...enter f: - To find out if 1 is a multiple of 3...enter g: - To divide 1 by 8...enter h: - To get a new number...enter j: - To quit...enter q: - -number 1 is equal to 0 times 8 with a remainder of 1 -number 0 is even! -Class type is now A - - To add a number to 0 ...enter a: - To negate 0 ...enter b: - To find the difference between 0 and another number...enter c: - To find the factorial of 0 ...enter d: - To square 0 ...enter e: - To cube 0 ...enter f: - To find out if 0 is a multiple of 3...enter g: - To divide 0 by 8...enter h: - To get a new number...enter j: - To quit...enter q: - -number 0 is even! -Class type is now A - - To add a number to 0 ...enter a: - To negate 0 ...enter b: - To find the difference between 0 and another number...enter c: - To find the factorial of 0 ...enter d: - To square 0 ...enter e: - To cube 0 ...enter f: - To find out if 0 is a multiple of 3...enter g: - To divide 0 by 8...enter h: - To get a new number...enter j: - To quit...enter q: - -number 0 is even! -Class type is now A - - To add a number to 0 ...enter a: - To negate 0 ...enter b: - To find the difference between 0 and another number...enter c: - To find the factorial of 0 ...enter d: - To square 0 ...enter e: - To cube 0 ...enter f: - To find out if 0 is a multiple of 3...enter g: - To divide 0 by 8...enter h: - To get a new number...enter j: - To quit...enter q: - +number 0 is even! +Class type is now A + + To add a number to 0 ...enter a: + To negate 0 ...enter b: + To find the difference between 0 and another number...enter c: + To find the factorial of 0 ...enter d: + To square 0 ...enter e: + To cube 0 ...enter f: + To find out if 0 is a multiple of 3...enter g: + To divide 0 by 8...enter h: + To get a new number...enter j: + To quit...enter q: + + +Please enter a number... number 1 is odd! +Class type is now B + + To add a number to 1 ...enter a: + To negate 1 ...enter b: + To find the difference between 1 and another number...enter c: + To find the factorial of 1 ...enter d: + To square 1 ...enter e: + To cube 1 ...enter f: + To find out if 1 is a multiple of 3...enter g: + To divide 1 by 8...enter h: + To get a new number...enter j: + To quit...enter q: + +number -1 is odd! +Class type is now C + + To add a number to -1 ...enter a: + To negate -1 ...enter b: + To find the difference between -1 and another number...enter c: + To find the factorial of -1 ...enter d: + To square -1 ...enter e: + To cube -1 ...enter f: + To find out if -1 is a multiple of 3...enter g: + To divide -1 by 8...enter h: + To get a new number...enter j: + To quit...enter q: + + +Please enter a number... number 1 is odd! +Class type is now D + + To add a number to 1 ...enter a: + To negate 1 ...enter b: + To find the difference between 1 and another number...enter c: + To find the factorial of 1 ...enter d: + To square 1 ...enter e: + To cube 1 ...enter f: + To find out if 1 is a multiple of 3...enter g: + To divide 1 by 8...enter h: + To get a new number...enter j: + To quit...enter q: + +number 1 is odd! +Class type is now E + + To add a number to 1 ...enter a: + To negate 1 ...enter b: + To find the difference between 1 and another number...enter c: + To find the factorial of 1 ...enter d: + To square 1 ...enter e: + To cube 1 ...enter f: + To find out if 1 is a multiple of 3...enter g: + To divide 1 by 8...enter h: + To get a new number...enter j: + To quit...enter q: + +number 1 is odd! +Class type is now E + + To add a number to 1 ...enter a: + To negate 1 ...enter b: + To find the difference between 1 and another number...enter c: + To find the factorial of 1 ...enter d: + To square 1 ...enter e: + To cube 1 ...enter f: + To find out if 1 is a multiple of 3...enter g: + To divide 1 by 8...enter h: + To get a new number...enter j: + To quit...enter q: + +number 1 is odd! +Class type is now E + + To add a number to 1 ...enter a: + To negate 1 ...enter b: + To find the difference between 1 and another number...enter c: + To find the factorial of 1 ...enter d: + To square 1 ...enter e: + To cube 1 ...enter f: + To find out if 1 is a multiple of 3...enter g: + To divide 1 by 8...enter h: + To get a new number...enter j: + To quit...enter q: + +number 1 is not divisible by 3. +number 1 is odd! +Class type is now E + + To add a number to 1 ...enter a: + To negate 1 ...enter b: + To find the difference between 1 and another number...enter c: + To find the factorial of 1 ...enter d: + To square 1 ...enter e: + To cube 1 ...enter f: + To find out if 1 is a multiple of 3...enter g: + To divide 1 by 8...enter h: + To get a new number...enter j: + To quit...enter q: + +number 1 is equal to 0 times 8 with a remainder of 1 +number 0 is even! +Class type is now A + + To add a number to 0 ...enter a: + To negate 0 ...enter b: + To find the difference between 0 and another number...enter c: + To find the factorial of 0 ...enter d: + To square 0 ...enter e: + To cube 0 ...enter f: + To find out if 0 is a multiple of 3...enter g: + To divide 0 by 8...enter h: + To get a new number...enter j: + To quit...enter q: + +number 0 is even! +Class type is now A + + To add a number to 0 ...enter a: + To negate 0 ...enter b: + To find the difference between 0 and another number...enter c: + To find the factorial of 0 ...enter d: + To square 0 ...enter e: + To cube 0 ...enter f: + To find out if 0 is a multiple of 3...enter g: + To divide 0 by 8...enter h: + To get a new number...enter j: + To quit...enter q: + +number 0 is even! +Class type is now A + + To add a number to 0 ...enter a: + To negate 0 ...enter b: + To find the difference between 0 and another number...enter c: + To find the factorial of 0 ...enter d: + To square 0 ...enter e: + To cube 0 ...enter f: + To find out if 0 is a multiple of 3...enter g: + To divide 0 by 8...enter h: + To get a new number...enter j: + To quit...enter q: + diff --git a/tests/codegen/atoi_output.txt b/tests/codegen/atoi_output.txt index 51b815a48..c51d7bad6 100644 --- a/tests/codegen/atoi_output.txt +++ b/tests/codegen/atoi_output.txt @@ -1 +1 @@ -678987 == 678987 +678987 == 678987 diff --git a/tests/codegen/book_list.cl b/tests/codegen/book_list.cl index 025ea1695..d39f86bbe 100755 --- 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_output.txt b/tests/codegen/book_list_output.txt index 3408320b2..ced587a4f 100644 --- a/tests/codegen/book_list_output.txt +++ b/tests/codegen/book_list_output.txt @@ -1,7 +1,7 @@ -title: The Top 100 CD_ROMs -author: Ulanoff -periodical: PC Magazine -- dynamic type was Article - -title: Compilers, Principles, Techniques, and Tools -author: Aho, Sethi, and Ullman -- dynamic type was Book - +title: The Top 100 CD_ROMs +author: Ulanoff +periodical: PC Magazine +- dynamic type was Article - +title: Compilers, Principles, Techniques, and Tools +author: Aho, Sethi, and Ullman +- dynamic type was Book - diff --git a/tests/codegen/cells.cl b/tests/codegen/cells.cl index 9fd6741bb..bcd891498 100755 --- 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_output.txt b/tests/codegen/cells_output.txt index 6304902cc..9d06c27bc 100644 --- a/tests/codegen/cells_output.txt +++ b/tests/codegen/cells_output.txt @@ -1,21 +1,21 @@ - X -........XXX........ -.......X...X....... -......XXX.XXX...... -.....X.......X..... -....XXX.....XXX.... -...X...X...X...X... -..XXX.XXX.XXX.XXX.. -.X...............X. -XXX.............XXX -...X...........X... -..XXX.........XXX.. -.X...X.......X...X. -XXX.XXX.....XXX.XXX -.......X...X....... -......XXX.XXX...... -.....X.......X..... -....XXX.....XXX.... -...X...X...X...X... -..XXX.XXX.XXX.XXX.. -.X...............X. + X +........XXX........ +.......X...X....... +......XXX.XXX...... +.....X.......X..... +....XXX.....XXX.... +...X...X...X...X... +..XXX.XXX.XXX.XXX.. +.X...............X. +XXX.............XXX +...X...........X... +..XXX.........XXX.. +.X...X.......X...X. +XXX.XXX.....XXX.XXX +.......X...X....... +......XXX.XXX...... +.....X.......X..... +....XXX.....XXX.... +...X...X...X...X... +..XXX.XXX.XXX.XXX.. +.X...............X. diff --git a/tests/codegen/complex.cl b/tests/codegen/complex.cl index 0b7aa44e9..9edb6151d 100755 --- 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_output.txt b/tests/codegen/complex_output.txt index 18b77c1fc..7d6173685 100644 --- a/tests/codegen/complex_output.txt +++ b/tests/codegen/complex_output.txt @@ -1 +1 @@ -=) +=) diff --git a/tests/codegen/fib.cl b/tests/codegen/fib.cl index 08ceaede8..ced8cee48 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_input.txt b/tests/codegen/fib_input.txt index f599e28b8..d43401489 100644 --- a/tests/codegen/fib_input.txt +++ b/tests/codegen/fib_input.txt @@ -1 +1 @@ -10 +10 diff --git a/tests/codegen/fib_output.txt b/tests/codegen/fib_output.txt index d402da6af..2552f4479 100644 --- a/tests/codegen/fib_output.txt +++ b/tests/codegen/fib_output.txt @@ -1,2 +1,2 @@ -Enter n to find nth fibonacci number! -89 +Enter n to find nth fibonacci number! +89 diff --git a/tests/codegen/graph.cl b/tests/codegen/graph.cl index 8e511358c..59e29bbf4 100755 --- 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/hello_world.cl b/tests/codegen/hello_world.cl index 0c818f908..b0a180a2e 100755 --- 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_output.txt b/tests/codegen/hello_world_output.txt index 349db2bfe..9c1c7a002 100644 --- a/tests/codegen/hello_world_output.txt +++ b/tests/codegen/hello_world_output.txt @@ -1 +1 @@ -Hello, World. +Hello, World. diff --git a/tests/codegen/io.cl b/tests/codegen/io.cl index 7f0de869e..42ee6854e 100755 --- 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_output.txt b/tests/codegen/io_output.txt index f846f596d..870cffce6 100644 --- a/tests/codegen/io_output.txt +++ b/tests/codegen/io_output.txt @@ -1,5 +1,5 @@ -A: Hello world -B: Hello world -C: Hello world -D: Hello world -Done. +A: Hello world +B: Hello world +C: Hello world +D: Hello world +Done. diff --git a/tests/codegen/life.cl b/tests/codegen/life.cl index b83d97957..7d7a41fdb 100755 --- 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_input.txt b/tests/codegen/life_input.txt index 07e016726..1dfbde620 100644 --- a/tests/codegen/life_input.txt +++ b/tests/codegen/life_input.txt @@ -1,66 +1,66 @@ -y -1 -n -y -2 -n -y -3 -n -y -4 -n -y -5 -n -y -6 -n -y -7 -n -y -8 -n -y -9 -n -y -10 -n -y -11 -n -y -12 -n -y -13 -n -y -14 -n -y -15 -n -y -16 -n -y -17 -n -y -18 -n -y -19 -n -y -20 -n -y -21 -y -y -n +y +1 +n +y +2 +n +y +3 +n +y +4 +n +y +5 +n +y +6 +n +y +7 +n +y +8 +n +y +9 +n +y +10 +n +y +11 +n +y +12 +n +y +13 +n +y +14 +n +y +15 +n +y +16 +n +y +17 +n +y +18 +n +y +19 +n +y +20 +n +y +21 +y +y +n n \ No newline at end of file diff --git a/tests/codegen/life_output.txt b/tests/codegen/life_output.txt index 5a9b9f73d..e804b2382 100644 --- a/tests/codegen/life_output.txt +++ b/tests/codegen/life_output.txt @@ -1,778 +1,778 @@ -Welcome to the Game of Life. -There are many initial states to choose from. - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - - XX -XXXX -XXXX - XX - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - - X - X - X - X -X - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - -X - X - X - X - X - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - -X X - X X - X - X X -X X - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - -X - X - X - X -X - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - - X - X - X - X - X - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - -X X - X X -X X - - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - - X X -X X - X X - - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - -X X - X X - X - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - - X - X X -X X - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - -X X X - X X -X X X - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - -XXXXX -XXXXX -XXXXX -XXXXX -XXXXX - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - -XXXXX - X - X - X - X - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - - X - X -XXXXX - X - X - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - -X X - X X X - X X - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - - X X - X X X -X X - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - -XXXX -X -X -XXXX -X -X -XXXX - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - -XXX - X - X - X - X - X -XXX - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - - XX -X X -X X - XX - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - - XX -X X -X X - XX -X X -X X - XX - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - - XXX -X -X - XX - X - X -XXX - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - --XX- -X-X- -X--- --XX- ----X --X-X --XX- - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - --XX- -X-X- -X-X- --XX- --X-X --X-X --XX- - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? +Welcome to the Game of Life. +There are many initial states to choose from. + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + + XX +XXXX +XXXX + XX + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + + X + X + X + X +X + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + +X + X + X + X + X + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + +X X + X X + X + X X +X X + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + +X + X + X + X +X + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + + X + X + X + X + X + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + +X X + X X +X X + + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + + X X +X X + X X + + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + +X X + X X + X + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + + X + X X +X X + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + +X X X + X X +X X X + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + +XXXXX +XXXXX +XXXXX +XXXXX +XXXXX + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + +XXXXX + X + X + X + X + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + + X + X +XXXXX + X + X + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + +X X + X X X + X X + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + + X X + X X X +X X + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + +XXXX +X +X +XXXX +X +X +XXXX + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + +XXX + X + X + X + X + X +XXX + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + + XX +X X +X X + XX + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + + XX +X X +X X + XX +X X +X X + XX + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + + XXX +X +X + XX + X + X +XXX + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + +-XX- +X-X- +X--- +-XX- +---X +-X-X +-XX- + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + +-XX- +X-X- +X-X- +-XX- +-X-X +-X-X +-XX- + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? Please use lowercase y or n for your answer [n]: \ No newline at end of file diff --git a/tests/codegen/list_output.txt b/tests/codegen/list_output.txt index fca724903..00d68ed23 100644 --- a/tests/codegen/list_output.txt +++ b/tests/codegen/list_output.txt @@ -1,5 +1,5 @@ -5 4 3 2 1 -4 3 2 1 -3 2 1 -2 1 -1 +5 4 3 2 1 +4 3 2 1 +3 2 1 +2 1 +1 diff --git a/tests/codegen/new_complex.cl b/tests/codegen/new_complex.cl index a4fe714ce..ad7035b56 100755 --- 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_output.txt b/tests/codegen/new_complex_output.txt index 0e8da112c..831c23af4 100644 --- a/tests/codegen/new_complex_output.txt +++ b/tests/codegen/new_complex_output.txt @@ -1,2 +1,2 @@ -=) -=) +=) +=) diff --git a/tests/codegen/palindrome.cl b/tests/codegen/palindrome.cl index 7f24789f9..6acbeb731 100755 --- 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_input.txt b/tests/codegen/palindrome_input.txt index 8e1b64142..c49a0114c 100644 --- a/tests/codegen/palindrome_input.txt +++ b/tests/codegen/palindrome_input.txt @@ -1 +1 @@ -anitalabalatina +anitalabalatina diff --git a/tests/codegen/palindrome_output.txt b/tests/codegen/palindrome_output.txt index 7a0095959..e93d36585 100644 --- a/tests/codegen/palindrome_output.txt +++ b/tests/codegen/palindrome_output.txt @@ -1,2 +1,2 @@ -enter a string -that was a palindrome +enter a string +that was a palindrome diff --git a/tests/codegen/primes_output.txt b/tests/codegen/primes_output.txt index a4d0fcb3f..cf5d78d49 100644 --- a/tests/codegen/primes_output.txt +++ b/tests/codegen/primes_output.txt @@ -1,96 +1,96 @@ -2 is trivially prime. -3 is prime. -5 is prime. -7 is prime. -11 is prime. -13 is prime. -17 is prime. -19 is prime. -23 is prime. -29 is prime. -31 is prime. -37 is prime. -41 is prime. -43 is prime. -47 is prime. -53 is prime. -59 is prime. -61 is prime. -67 is prime. -71 is prime. -73 is prime. -79 is prime. -83 is prime. -89 is prime. -97 is prime. -101 is prime. -103 is prime. -107 is prime. -109 is prime. -113 is prime. -127 is prime. -131 is prime. -137 is prime. -139 is prime. -149 is prime. -151 is prime. -157 is prime. -163 is prime. -167 is prime. -173 is prime. -179 is prime. -181 is prime. -191 is prime. -193 is prime. -197 is prime. -199 is prime. -211 is prime. -223 is prime. -227 is prime. -229 is prime. -233 is prime. -239 is prime. -241 is prime. -251 is prime. -257 is prime. -263 is prime. -269 is prime. -271 is prime. -277 is prime. -281 is prime. -283 is prime. -293 is prime. -307 is prime. -311 is prime. -313 is prime. -317 is prime. -331 is prime. -337 is prime. -347 is prime. -349 is prime. -353 is prime. -359 is prime. -367 is prime. -373 is prime. -379 is prime. -383 is prime. -389 is prime. -397 is prime. -401 is prime. -409 is prime. -419 is prime. -421 is prime. -431 is prime. -433 is prime. -439 is prime. -443 is prime. -449 is prime. -457 is prime. -461 is prime. -463 is prime. -467 is prime. -479 is prime. -487 is prime. -491 is prime. -499 is prime. -Abort called from class String +2 is trivially prime. +3 is prime. +5 is prime. +7 is prime. +11 is prime. +13 is prime. +17 is prime. +19 is prime. +23 is prime. +29 is prime. +31 is prime. +37 is prime. +41 is prime. +43 is prime. +47 is prime. +53 is prime. +59 is prime. +61 is prime. +67 is prime. +71 is prime. +73 is prime. +79 is prime. +83 is prime. +89 is prime. +97 is prime. +101 is prime. +103 is prime. +107 is prime. +109 is prime. +113 is prime. +127 is prime. +131 is prime. +137 is prime. +139 is prime. +149 is prime. +151 is prime. +157 is prime. +163 is prime. +167 is prime. +173 is prime. +179 is prime. +181 is prime. +191 is prime. +193 is prime. +197 is prime. +199 is prime. +211 is prime. +223 is prime. +227 is prime. +229 is prime. +233 is prime. +239 is prime. +241 is prime. +251 is prime. +257 is prime. +263 is prime. +269 is prime. +271 is prime. +277 is prime. +281 is prime. +283 is prime. +293 is prime. +307 is prime. +311 is prime. +313 is prime. +317 is prime. +331 is prime. +337 is prime. +347 is prime. +349 is prime. +353 is prime. +359 is prime. +367 is prime. +373 is prime. +379 is prime. +383 is prime. +389 is prime. +397 is prime. +401 is prime. +409 is prime. +419 is prime. +421 is prime. +431 is prime. +433 is prime. +439 is prime. +443 is prime. +449 is prime. +457 is prime. +461 is prime. +463 is prime. +467 is prime. +479 is prime. +487 is prime. +491 is prime. +499 is prime. +Abort called from class String diff --git a/tests/codegen/print-cool_output.txt b/tests/codegen/print-cool_output.txt index 2b58f8985..3c8cd620c 100644 --- a/tests/codegen/print-cool_output.txt +++ b/tests/codegen/print-cool_output.txt @@ -1 +1 @@ -cool +cool diff --git a/tests/codegen/sort-list_input.txt b/tests/codegen/sort-list_input.txt index f599e28b8..d43401489 100644 --- a/tests/codegen/sort-list_input.txt +++ b/tests/codegen/sort-list_input.txt @@ -1 +1 @@ -10 +10 diff --git a/tests/codegen/sort-list_output.txt b/tests/codegen/sort-list_output.txt index 9878d57ea..7b1d40452 100644 --- a/tests/codegen/sort-list_output.txt +++ b/tests/codegen/sort-list_output.txt @@ -1,10 +1,10 @@ -How many numbers to sort? 0 -1 -2 -3 -4 -5 -6 -7 -8 -9 +How many numbers to sort? 0 +1 +2 +3 +4 +5 +6 +7 +8 +9 diff --git a/tests/codegen_test.py b/tests/codegen_test.py index 48df768ff..a21322273 100644 --- a/tests/codegen_test.py +++ b/tests/codegen_test.py @@ -1,17 +1,18 @@ -import pytest -import os -from utils import compare_outputs - -tests_dir = __file__.rpartition('/')[0] + '/codegen/' -tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] - -# @pytest.mark.lexer -# @pytest.mark.parser -# @pytest.mark.semantic -@pytest.mark.codegen -@pytest.mark.ok -@pytest.mark.run(order=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',\ +import pytest +import os +from utils import compare_outputs + +tests_dir = __file__.rpartition('/')[0] + '/codegen/' +print(tests_dir) +tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] + +# @pytest.mark.lexer +# @pytest.mark.parser +# @pytest.mark.semantic +@pytest.mark.codegen +@pytest.mark.ok +@pytest.mark.run(order=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 diff --git a/tests/conftest.py b/tests/conftest.py index 1f44eeb72..561d8bafc 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/execution/01_program.cl b/tests/execution/01_program.cl index cf8b86a51..c87561ca0 100644 --- a/tests/execution/01_program.cl +++ b/tests/execution/01_program.cl @@ -1,34 +1,34 @@ -class Main inherits IO { - number: Int <- 5; - - main () : Object { - testing_fibonacci(number) - }; - - testing_fibonacci(n: Int) : IO {{ - out_string("Iterative Fibonacci : "); - out_int(iterative_fibonacci(5)); - out_string("\n"); - - out_string("Recursive Fibonacci : "); - out_int(recursive_fibonacci(5)); - out_string("\n"); - }}; - - recursive_fibonacci (n: AUTO_TYPE) : AUTO_TYPE { - if n <= 2 then 1 else recursive_fibonacci(n - 1) + recursive_fibonacci(n - 2) fi - }; - - iterative_fibonacci(n: AUTO_TYPE) : AUTO_TYPE { - let i: Int <- 2, n1: Int <- 1, n2: Int <- 1, temp: Int in { - while i < n loop - let temp: Int <- n2 in { - n2 <- n2 + n1; - n1 <- temp; - i <- i + 1; - } - pool; - n2; - } - }; +class Main inherits IO { + number: Int <- 5; + + main () : Object { + testing_fibonacci(number) + }; + + testing_fibonacci(n: Int) : IO {{ + out_string("Iterative Fibonacci : "); + out_int(iterative_fibonacci(5)); + out_string("\n"); + + out_string("Recursive Fibonacci : "); + out_int(recursive_fibonacci(5)); + out_string("\n"); + }}; + + recursive_fibonacci (n: AUTO_TYPE) : AUTO_TYPE { + if n <= 2 then 1 else recursive_fibonacci(n - 1) + recursive_fibonacci(n - 2) fi + }; + + iterative_fibonacci(n: AUTO_TYPE) : AUTO_TYPE { + let i: Int <- 2, n1: Int <- 1, n2: Int <- 1, temp: Int in { + while i < n loop + let temp: Int <- n2 in { + n2 <- n2 + n1; + n1 <- temp; + i <- i + 1; + } + pool; + n2; + } + }; } \ No newline at end of file diff --git a/tests/execution/02_program.cl b/tests/execution/02_program.cl index 5c80aa2c7..eb3a70605 100644 --- a/tests/execution/02_program.cl +++ b/tests/execution/02_program.cl @@ -1,24 +1,24 @@ -class Main inherits IO { - main (): Object { - { - out_int((new Ackermann).ackermann(3, 2)); - out_string("\n"); - } - }; -} - -class Ackermann { - ackermann (m: Int, n: Int): Int { - if m = 0 - then - n + 1 - else - if n = 0 - then - self.ackermann(m - 1, 1) - else - self.ackermann(m - 1, self.ackermann(m, n - 1)) - fi - fi - }; +class Main inherits IO { + main (): Object { + { + out_int((new Ackermann).ackermann(3, 2)); + out_string("\n"); + } + }; +} + +class Ackermann { + ackermann (m: Int, n: Int): Int { + if m = 0 + then + n + 1 + else + if n = 0 + then + self.ackermann(m - 1, 1) + else + self.ackermann(m - 1, self.ackermann(m, n - 1)) + fi + fi + }; } \ No newline at end of file diff --git a/tests/execution/03_program.cl b/tests/execution/03_program.cl index 1d2757cab..bab710ec4 100644 --- a/tests/execution/03_program.cl +++ b/tests/execution/03_program.cl @@ -1,19 +1,19 @@ -class A { } - -class B inherits A { } - -class C inherits A { } - -class Main inherits IO { - main () : Object { - testing_case() - }; - - testing_case() : IO { - let a: A <- new C in - case a of - x: B => out_string("Is type B.\n"); - x: C => out_string("Is type C.\n"); - esac - }; +class A { } + +class B inherits A { } + +class C inherits A { } + +class Main inherits IO { + main () : Object { + testing_case() + }; + + testing_case() : IO { + let a: A <- new C in + case a of + x: B => out_string("Is type B.\n"); + x: C => out_string("Is type C.\n"); + esac + }; } \ No newline at end of file diff --git a/tests/execution/04_program.cl b/tests/execution/04_program.cl index 1615934ff..ca0850a18 100644 --- a/tests/execution/04_program.cl +++ b/tests/execution/04_program.cl @@ -1,47 +1,47 @@ -class Main inherits IO { - main (): IO { - let vector: Vector2 <- (new Vector2).init(0, 0) in - vector.print_vector() - }; -} - -class Vector2 { - x: Int; - - y: Int; - - init (x_: Int, y_: Int): Vector2 { - { - x <- x_; - y <- y_; - self; - } - }; - - get_x (): Int { - x - }; - - get_y (): Int { - y - }; - - add (v: Vector2): Vector2 { - (new Vector2).init(x + v.get_x(), y + v.get_y()) - }; - - print_vector (): IO { - let io: IO <- (new IO) in - { - io.out_string("("); - io.out_int(self.get_x()); - io.out_string("; "); - io.out_int(self.get_y()); - io.out_string(")\n"); - } - }; - - clone_vector (): Vector2 { - (new Vector2).init(x, y) - }; +class Main inherits IO { + main (): IO { + let vector: Vector2 <- (new Vector2).init(0, 0) in + vector.print_vector() + }; +} + +class Vector2 { + x: Int; + + y: Int; + + init (x_: Int, y_: Int): Vector2 { + { + x <- x_; + y <- y_; + self; + } + }; + + get_x (): Int { + x + }; + + get_y (): Int { + y + }; + + add (v: Vector2): Vector2 { + (new Vector2).init(x + v.get_x(), y + v.get_y()) + }; + + print_vector (): IO { + let io: IO <- (new IO) in + { + io.out_string("("); + io.out_int(self.get_x()); + io.out_string("; "); + io.out_int(self.get_y()); + io.out_string(")\n"); + } + }; + + clone_vector (): Vector2 { + (new Vector2).init(x, y) + }; } \ No newline at end of file diff --git a/tests/execution/05_program.cl b/tests/execution/05_program.cl index 2bd4b5309..b67842198 100644 --- a/tests/execution/05_program.cl +++ b/tests/execution/05_program.cl @@ -1,23 +1,23 @@ -class Main { - main (): Object { - let total: Int <- 10, - i: Int <- 1, - io: IO <- (new IO) in - while i <= total loop - { - io.out_int(self.fibonacci(i)); - io.out_string("\n"); - i <- i + 1; - } - pool - }; - - fibonacci (n: Int): Int { - if n <= 2 - then - 1 - else - self.fibonacci(n - 1) + self.fibonacci(n - 2) - fi - }; +class Main { + main (): Object { + let total: Int <- 10, + i: Int <- 1, + io: IO <- (new IO) in + while i <= total loop + { + io.out_int(self.fibonacci(i)); + io.out_string("\n"); + i <- i + 1; + } + pool + }; + + fibonacci (n: Int): Int { + if n <= 2 + then + 1 + else + self.fibonacci(n - 1) + self.fibonacci(n - 2) + fi + }; } \ No newline at end of file diff --git a/tests/execution/06_program.cl b/tests/execution/06_program.cl index f83685a59..ec388ebd7 100644 --- a/tests/execution/06_program.cl +++ b/tests/execution/06_program.cl @@ -1,38 +1,38 @@ -class Main inherits IO { - main (): Object { - let id : Int, - name : String, - email : String in - { - self.out_string("Introduzca su id: "); - id <- self.in_int(); - self.out_string("Introduzca su nombre: "); - name <- self.in_string(); - self.out_string("Introduzca su email: "); - email <- self.in_string(); - let user: User <- (new User).init(id, name, email) in - self.out_string("Created user: ".concat(user.get_name()).concat("\n")); - } - }; -} - -class User { - id: Int; - - name: String; - - email: String; - - init (id_: Int, name_: String, email_: String): User { - { - id <- id_; - name <- name_; - email <- email_; - self; - } - }; - - get_name (): String { - name - }; +class Main inherits IO { + main (): Object { + let id : Int, + name : String, + email : String in + { + self.out_string("Introduzca su id: "); + id <- self.in_int(); + self.out_string("Introduzca su nombre: "); + name <- self.in_string(); + self.out_string("Introduzca su email: "); + email <- self.in_string(); + let user: User <- (new User).init(id, name, email) in + self.out_string("Created user: ".concat(user.get_name()).concat("\n")); + } + }; +} + +class User { + id: Int; + + name: String; + + email: String; + + init (id_: Int, name_: String, email_: String): User { + { + id <- id_; + name <- name_; + email <- email_; + self; + } + }; + + get_name (): String { + name + }; } \ No newline at end of file diff --git a/tests/inference/01_program.cl b/tests/inference/01_program.cl index f83a4aa36..794f2ea3f 100644 --- a/tests/inference/01_program.cl +++ b/tests/inference/01_program.cl @@ -1,16 +1,16 @@ -class Main { - main (): Object { - 0 - }; -} - -class Point { - x: AUTO_TYPE; - y: AUTO_TYPE; - - init(x0: Int, y0: Int): AUTO_TYPE {{ - x <- x0; - y <- y0; - self; - }}; +class Main { + main (): Object { + 0 + }; +} + +class Point { + x: AUTO_TYPE; + y: AUTO_TYPE; + + init(x0: Int, y0: Int): AUTO_TYPE {{ + x <- x0; + y <- y0; + self; + }}; } \ No newline at end of file diff --git a/tests/inference/01_result.txt b/tests/inference/01_result.txt index 558906f46..a09a7f345 100644 --- a/tests/inference/01_result.txt +++ b/tests/inference/01_result.txt @@ -1,19 +1,19 @@ -class Main { - main (): Object { - 0 - }; -} - -class Point { - x: Int; - - y: Int; - - init (x0: Int, y0: Int): Point { - { - x <- x0; - y <- y0; - self; - } - }; +class Main { + main (): Object { + 0 + }; +} + +class Point { + x: Int; + + y: Int; + + init (x0: Int, y0: Int): Point { + { + x <- x0; + y <- y0; + self; + } + }; } \ No newline at end of file diff --git a/tests/inference/02_program.cl b/tests/inference/02_program.cl index 32fe7f289..0b4afe948 100644 --- a/tests/inference/02_program.cl +++ b/tests/inference/02_program.cl @@ -1,15 +1,15 @@ -class Main { - main (): Object { - let x: Int <- (new Ackermann).ackermann(5, 6) in x - }; -} - -class Ackermann { - ackermann(m: AUTO_TYPE, n: AUTO_TYPE): AUTO_TYPE { - if m = 0 then n + 1 else - if n = 0 then ackermann(m - 1, 1) else - ackermann(m - 1, ackermann(m, n - 1)) - fi - fi - }; +class Main { + main (): Object { + let x: Int <- (new Ackermann).ackermann(5, 6) in x + }; +} + +class Ackermann { + ackermann(m: AUTO_TYPE, n: AUTO_TYPE): AUTO_TYPE { + if m = 0 then n + 1 else + if n = 0 then ackermann(m - 1, 1) else + ackermann(m - 1, ackermann(m, n - 1)) + fi + fi + }; } \ No newline at end of file diff --git a/tests/inference/02_result.txt b/tests/inference/02_result.txt index 927ed2f00..28aab1a38 100644 --- a/tests/inference/02_result.txt +++ b/tests/inference/02_result.txt @@ -1,22 +1,22 @@ -class Main { - main (): Object { - let x: Int <- (new Ackermann).ackermann(5, 6) in - x - }; -} - -class Ackermann { - ackermann (m: Int, n: Int): Int { - if m = 0 - then - n + 1 - else - if n = 0 - then - self.ackermann(m - 1, 1) - else - self.ackermann(m - 1, self.ackermann(m, n - 1)) - fi - fi - }; +class Main { + main (): Object { + let x: Int <- (new Ackermann).ackermann(5, 6) in + x + }; +} + +class Ackermann { + ackermann (m: Int, n: Int): Int { + if m = 0 + then + n + 1 + else + if n = 0 + then + self.ackermann(m - 1, 1) + else + self.ackermann(m - 1, self.ackermann(m, n - 1)) + fi + fi + }; } \ No newline at end of file diff --git a/tests/inference/03_program.cl b/tests/inference/03_program.cl index 5391dae4f..68c4b3117 100644 --- a/tests/inference/03_program.cl +++ b/tests/inference/03_program.cl @@ -1,17 +1,17 @@ -class Main { - main (): AUTO_TYPE { - 0 - }; - - f(a: AUTO_TYPE, b: AUTO_TYPE): AUTO_TYPE { - if a = 1 then b else - g(a + 1, b / 1) - fi - }; - - g(a: AUTO_TYPE, b: AUTO_TYPE): AUTO_TYPE { - if b = 1 then a else - f(a / 2, b + 1) - fi - }; +class Main { + main (): AUTO_TYPE { + 0 + }; + + f(a: AUTO_TYPE, b: AUTO_TYPE): AUTO_TYPE { + if a = 1 then b else + g(a + 1, b / 1) + fi + }; + + g(a: AUTO_TYPE, b: AUTO_TYPE): AUTO_TYPE { + if b = 1 then a else + f(a / 2, b + 1) + fi + }; } \ No newline at end of file diff --git a/tests/inference/03_result.txt b/tests/inference/03_result.txt index b69e2a36a..e65b20c1e 100644 --- a/tests/inference/03_result.txt +++ b/tests/inference/03_result.txt @@ -1,23 +1,23 @@ -class Main { - main (): Int { - 0 - }; - - f (a: Int, b: Int): Int { - if a = 1 - then - b - else - self.g(a + 1, b / 1) - fi - }; - - g (a: Int, b: Int): Int { - if b = 1 - then - a - else - self.f(a / 2, b + 1) - fi - }; +class Main { + main (): Int { + 0 + }; + + f (a: Int, b: Int): Int { + if a = 1 + then + b + else + self.g(a + 1, b / 1) + fi + }; + + g (a: Int, b: Int): Int { + if b = 1 + then + a + else + self.f(a / 2, b + 1) + fi + }; } \ No newline at end of file diff --git a/tests/inference/04_program.cl b/tests/inference/04_program.cl index 8df56c80c..4eaffa71a 100644 --- a/tests/inference/04_program.cl +++ b/tests/inference/04_program.cl @@ -1,16 +1,16 @@ -class Main { - main (): Object { - 0 - }; -} - -class Point { - x: Int; - y: Int; - - init(x0: AUTO_TYPE, y0: AUTO_TYPE): AUTO_TYPE {{ - x <- x0; - y <- y0; - self; - }}; +class Main { + main (): Object { + 0 + }; +} + +class Point { + x: Int; + y: Int; + + init(x0: AUTO_TYPE, y0: AUTO_TYPE): AUTO_TYPE {{ + x <- x0; + y <- y0; + self; + }}; } \ No newline at end of file diff --git a/tests/inference/04_result.txt b/tests/inference/04_result.txt index 558906f46..a09a7f345 100644 --- a/tests/inference/04_result.txt +++ b/tests/inference/04_result.txt @@ -1,19 +1,19 @@ -class Main { - main (): Object { - 0 - }; -} - -class Point { - x: Int; - - y: Int; - - init (x0: Int, y0: Int): Point { - { - x <- x0; - y <- y0; - self; - } - }; +class Main { + main (): Object { + 0 + }; +} + +class Point { + x: Int; + + y: Int; + + init (x0: Int, y0: Int): Point { + { + x <- x0; + y <- y0; + self; + } + }; } \ No newline at end of file diff --git a/tests/inference/05_program.cl b/tests/inference/05_program.cl index da775aabe..dbb3aaae7 100644 --- a/tests/inference/05_program.cl +++ b/tests/inference/05_program.cl @@ -1,16 +1,16 @@ -class Main { - main (): Object { - 0 - }; - - f (a: AUTO_TYPE, b: AUTO_TYPE, c: AUTO_TYPE, d: AUTO_TYPE): AUTO_TYPE { - { - a <- b; - b <- c; - c <- d; - d <- a; - d + 1; - a; - } - }; +class Main { + main (): Object { + 0 + }; + + f (a: AUTO_TYPE, b: AUTO_TYPE, c: AUTO_TYPE, d: AUTO_TYPE): AUTO_TYPE { + { + a <- b; + b <- c; + c <- d; + d <- a; + d + 1; + a; + } + }; } \ No newline at end of file diff --git a/tests/inference/05_result.txt b/tests/inference/05_result.txt index 5d9e597f1..19918ead2 100644 --- a/tests/inference/05_result.txt +++ b/tests/inference/05_result.txt @@ -1,16 +1,16 @@ -class Main { - main (): Object { - 0 - }; - - f (a: Int, b: Int, c: Int, d: Int): Int { - { - a <- b; - b <- c; - c <- d; - d <- a; - d + 1; - a; - } - }; +class Main { + main (): Object { + 0 + }; + + f (a: Int, b: Int, c: Int, d: Int): Int { + { + a <- b; + b <- c; + c <- d; + d <- a; + d + 1; + a; + } + }; } \ No newline at end of file diff --git a/tests/inference/06_program.cl b/tests/inference/06_program.cl index 4ce631970..da192644d 100644 --- a/tests/inference/06_program.cl +++ b/tests/inference/06_program.cl @@ -1,44 +1,44 @@ -class Main inherits IO { - main(): IO { - let vector: AUTO_TYPE <- (new Vector2).init(0, 0) in - vector.print_vector() - }; -} - -class Vector2 { - x: AUTO_TYPE; - y: AUTO_TYPE; - - init(x_: AUTO_TYPE, y_: AUTO_TYPE): AUTO_TYPE {{ - x <- x_; - y <- y_; - self; - }}; - - - get_x(): AUTO_TYPE { - x - }; - - get_y(): AUTO_TYPE { - y - }; - - add(v: Vector2): AUTO_TYPE { - (new Vector2).init(x + v.get_x(), y + v.get_y()) - }; - - print_vector(): AUTO_TYPE { - let io: IO <- new IO in { - io.out_string("("); - io.out_int(get_x()); - io.out_string("; "); - io.out_int(get_y()); - io.out_string(")\n"); - } - }; - - clone_vector(): AUTO_TYPE { - (new Vector2).init(x, y) - }; +class Main inherits IO { + main(): IO { + let vector: AUTO_TYPE <- (new Vector2).init(0, 0) in + vector.print_vector() + }; +} + +class Vector2 { + x: AUTO_TYPE; + y: AUTO_TYPE; + + init(x_: AUTO_TYPE, y_: AUTO_TYPE): AUTO_TYPE {{ + x <- x_; + y <- y_; + self; + }}; + + + get_x(): AUTO_TYPE { + x + }; + + get_y(): AUTO_TYPE { + y + }; + + add(v: Vector2): AUTO_TYPE { + (new Vector2).init(x + v.get_x(), y + v.get_y()) + }; + + print_vector(): AUTO_TYPE { + let io: IO <- new IO in { + io.out_string("("); + io.out_int(get_x()); + io.out_string("; "); + io.out_int(get_y()); + io.out_string(")\n"); + } + }; + + clone_vector(): AUTO_TYPE { + (new Vector2).init(x, y) + }; } \ No newline at end of file diff --git a/tests/inference/06_result.txt b/tests/inference/06_result.txt index 1615934ff..ca0850a18 100644 --- a/tests/inference/06_result.txt +++ b/tests/inference/06_result.txt @@ -1,47 +1,47 @@ -class Main inherits IO { - main (): IO { - let vector: Vector2 <- (new Vector2).init(0, 0) in - vector.print_vector() - }; -} - -class Vector2 { - x: Int; - - y: Int; - - init (x_: Int, y_: Int): Vector2 { - { - x <- x_; - y <- y_; - self; - } - }; - - get_x (): Int { - x - }; - - get_y (): Int { - y - }; - - add (v: Vector2): Vector2 { - (new Vector2).init(x + v.get_x(), y + v.get_y()) - }; - - print_vector (): IO { - let io: IO <- (new IO) in - { - io.out_string("("); - io.out_int(self.get_x()); - io.out_string("; "); - io.out_int(self.get_y()); - io.out_string(")\n"); - } - }; - - clone_vector (): Vector2 { - (new Vector2).init(x, y) - }; +class Main inherits IO { + main (): IO { + let vector: Vector2 <- (new Vector2).init(0, 0) in + vector.print_vector() + }; +} + +class Vector2 { + x: Int; + + y: Int; + + init (x_: Int, y_: Int): Vector2 { + { + x <- x_; + y <- y_; + self; + } + }; + + get_x (): Int { + x + }; + + get_y (): Int { + y + }; + + add (v: Vector2): Vector2 { + (new Vector2).init(x + v.get_x(), y + v.get_y()) + }; + + print_vector (): IO { + let io: IO <- (new IO) in + { + io.out_string("("); + io.out_int(self.get_x()); + io.out_string("; "); + io.out_int(self.get_y()); + io.out_string(")\n"); + } + }; + + clone_vector (): Vector2 { + (new Vector2).init(x, y) + }; } \ No newline at end of file diff --git a/tests/inference/07_program.cl b/tests/inference/07_program.cl index a34dcfa89..6b9e01d8f 100644 --- a/tests/inference/07_program.cl +++ b/tests/inference/07_program.cl @@ -1,19 +1,19 @@ -(* This program prints the first 10 numbers of fibonacci *) -class Main { - - main(): Object { - let total: AUTO_TYPE <- 10, - i: AUTO_TYPE <- 1 , - io: AUTO_TYPE <- new IO in - while i <= total loop { - io.out_int(fibonacci(i)); - io.out_string("\n"); - i <- i + 1; - } - pool - }; - - fibonacci (n: AUTO_TYPE): AUTO_TYPE { - if n <= 2 then 1 else fibonacci(n - 1) + fibonacci(n - 2) fi - }; +(* This program prints the first 10 numbers of fibonacci *) +class Main { + + main(): Object { + let total: AUTO_TYPE <- 10, + i: AUTO_TYPE <- 1 , + io: AUTO_TYPE <- new IO in + while i <= total loop { + io.out_int(fibonacci(i)); + io.out_string("\n"); + i <- i + 1; + } + pool + }; + + fibonacci (n: AUTO_TYPE): AUTO_TYPE { + if n <= 2 then 1 else fibonacci(n - 1) + fibonacci(n - 2) fi + }; } \ No newline at end of file diff --git a/tests/inference/07_result.txt b/tests/inference/07_result.txt index 2bd4b5309..b67842198 100644 --- a/tests/inference/07_result.txt +++ b/tests/inference/07_result.txt @@ -1,23 +1,23 @@ -class Main { - main (): Object { - let total: Int <- 10, - i: Int <- 1, - io: IO <- (new IO) in - while i <= total loop - { - io.out_int(self.fibonacci(i)); - io.out_string("\n"); - i <- i + 1; - } - pool - }; - - fibonacci (n: Int): Int { - if n <= 2 - then - 1 - else - self.fibonacci(n - 1) + self.fibonacci(n - 2) - fi - }; +class Main { + main (): Object { + let total: Int <- 10, + i: Int <- 1, + io: IO <- (new IO) in + while i <= total loop + { + io.out_int(self.fibonacci(i)); + io.out_string("\n"); + i <- i + 1; + } + pool + }; + + fibonacci (n: Int): Int { + if n <= 2 + then + 1 + else + self.fibonacci(n - 1) + self.fibonacci(n - 2) + fi + }; } \ No newline at end of file diff --git a/tests/inference/08_program.cl b/tests/inference/08_program.cl index 7e296addf..8a0ccf4c9 100644 --- a/tests/inference/08_program.cl +++ b/tests/inference/08_program.cl @@ -1,33 +1,33 @@ -(* Testing IO *) -class Main inherits IO { - - main(): Object { - let id: AUTO_TYPE, name: AUTO_TYPE, email: AUTO_TYPE in { - out_string("Introduzca su id: "); - id <- self.in_int(); - out_string("Introduzca su nombre: "); - name <- self.in_string(); - out_string("Introduzca su email: "); - email <- self.in_string(); - let user: AUTO_TYPE <- (new User).init(id, name, email) in - out_string("Created user: ".concat(user.get_name()).concat("\n")); - } - }; -} - -class User { - id: AUTO_TYPE; - name: AUTO_TYPE; - email: AUTO_TYPE; - - init(id_: AUTO_TYPE, name_: AUTO_TYPE, email_: AUTO_TYPE): AUTO_TYPE {{ - id <- id_; - name <- name_; - email <- email_; - self; - }}; - - get_name(): AUTO_TYPE { - name - }; +(* Testing IO *) +class Main inherits IO { + + main(): Object { + let id: AUTO_TYPE, name: AUTO_TYPE, email: AUTO_TYPE in { + out_string("Introduzca su id: "); + id <- self.in_int(); + out_string("Introduzca su nombre: "); + name <- self.in_string(); + out_string("Introduzca su email: "); + email <- self.in_string(); + let user: AUTO_TYPE <- (new User).init(id, name, email) in + out_string("Created user: ".concat(user.get_name()).concat("\n")); + } + }; +} + +class User { + id: AUTO_TYPE; + name: AUTO_TYPE; + email: AUTO_TYPE; + + init(id_: AUTO_TYPE, name_: AUTO_TYPE, email_: AUTO_TYPE): AUTO_TYPE {{ + id <- id_; + name <- name_; + email <- email_; + self; + }}; + + get_name(): AUTO_TYPE { + name + }; } \ No newline at end of file diff --git a/tests/inference/08_result.txt b/tests/inference/08_result.txt index f83685a59..ec388ebd7 100644 --- a/tests/inference/08_result.txt +++ b/tests/inference/08_result.txt @@ -1,38 +1,38 @@ -class Main inherits IO { - main (): Object { - let id : Int, - name : String, - email : String in - { - self.out_string("Introduzca su id: "); - id <- self.in_int(); - self.out_string("Introduzca su nombre: "); - name <- self.in_string(); - self.out_string("Introduzca su email: "); - email <- self.in_string(); - let user: User <- (new User).init(id, name, email) in - self.out_string("Created user: ".concat(user.get_name()).concat("\n")); - } - }; -} - -class User { - id: Int; - - name: String; - - email: String; - - init (id_: Int, name_: String, email_: String): User { - { - id <- id_; - name <- name_; - email <- email_; - self; - } - }; - - get_name (): String { - name - }; +class Main inherits IO { + main (): Object { + let id : Int, + name : String, + email : String in + { + self.out_string("Introduzca su id: "); + id <- self.in_int(); + self.out_string("Introduzca su nombre: "); + name <- self.in_string(); + self.out_string("Introduzca su email: "); + email <- self.in_string(); + let user: User <- (new User).init(id, name, email) in + self.out_string("Created user: ".concat(user.get_name()).concat("\n")); + } + }; +} + +class User { + id: Int; + + name: String; + + email: String; + + init (id_: Int, name_: String, email_: String): User { + { + id <- id_; + name <- name_; + email <- email_; + self; + } + }; + + get_name (): String { + name + }; } \ No newline at end of file diff --git a/tests/inference/09_program.cl b/tests/inference/09_program.cl index 8df56c80c..4eaffa71a 100644 --- a/tests/inference/09_program.cl +++ b/tests/inference/09_program.cl @@ -1,16 +1,16 @@ -class Main { - main (): Object { - 0 - }; -} - -class Point { - x: Int; - y: Int; - - init(x0: AUTO_TYPE, y0: AUTO_TYPE): AUTO_TYPE {{ - x <- x0; - y <- y0; - self; - }}; +class Main { + main (): Object { + 0 + }; +} + +class Point { + x: Int; + y: Int; + + init(x0: AUTO_TYPE, y0: AUTO_TYPE): AUTO_TYPE {{ + x <- x0; + y <- y0; + self; + }}; } \ No newline at end of file diff --git a/tests/inference/09_result.txt b/tests/inference/09_result.txt index 558906f46..a09a7f345 100644 --- a/tests/inference/09_result.txt +++ b/tests/inference/09_result.txt @@ -1,19 +1,19 @@ -class Main { - main (): Object { - 0 - }; -} - -class Point { - x: Int; - - y: Int; - - init (x0: Int, y0: Int): Point { - { - x <- x0; - y <- y0; - self; - } - }; +class Main { + main (): Object { + 0 + }; +} + +class Point { + x: Int; + + y: Int; + + init (x0: Int, y0: Int): Point { + { + x <- x0; + y <- y0; + self; + } + }; } \ No newline at end of file diff --git a/tests/inference/10_program.cl b/tests/inference/10_program.cl index 04c2c29ad..22e26a116 100644 --- a/tests/inference/10_program.cl +++ b/tests/inference/10_program.cl @@ -1,33 +1,33 @@ -class Main { - main (): Object { - 0 - }; - - f(): AUTO_TYPE { - if true then - if true then - create_dog() - else - create_cat() fi - else - create_reptile() fi - }; - - create_dog(): AUTO_TYPE { - new Dog - }; - - create_cat(): AUTO_TYPE { - new Cat - }; - - create_reptile(): AUTO_TYPE { - new Reptile - }; -} - -class Animal {} -class Mammal inherits Animal {} -class Reptile inherits Animal {} -class Dog inherits Mammal {} +class Main { + main (): Object { + 0 + }; + + f(): AUTO_TYPE { + if true then + if true then + create_dog() + else + create_cat() fi + else + create_reptile() fi + }; + + create_dog(): AUTO_TYPE { + new Dog + }; + + create_cat(): AUTO_TYPE { + new Cat + }; + + create_reptile(): AUTO_TYPE { + new Reptile + }; +} + +class Animal {} +class Mammal inherits Animal {} +class Reptile inherits Animal {} +class Dog inherits Mammal {} class Cat inherits Mammal {} \ No newline at end of file diff --git a/tests/inference/10_result.txt b/tests/inference/10_result.txt index 0cddc38c9..db2bc9341 100644 --- a/tests/inference/10_result.txt +++ b/tests/inference/10_result.txt @@ -1,51 +1,51 @@ -class Main { - main (): Object { - 0 - }; - - f (): Animal { - if true - then - if true - then - self.create_dog() - else - self.create_cat() - fi - else - self.create_reptile() - fi - }; - - create_dog (): Dog { - (new Dog) - }; - - create_cat (): Cat { - (new Cat) - }; - - create_reptile (): Reptile { - (new Reptile) - }; -} - -class Animal { - -} - -class Mammal inherits Animal { - -} - -class Reptile inherits Animal { - -} - -class Dog inherits Mammal { - -} - -class Cat inherits Mammal { - +class Main { + main (): Object { + 0 + }; + + f (): Animal { + if true + then + if true + then + self.create_dog() + else + self.create_cat() + fi + else + self.create_reptile() + fi + }; + + create_dog (): Dog { + (new Dog) + }; + + create_cat (): Cat { + (new Cat) + }; + + create_reptile (): Reptile { + (new Reptile) + }; +} + +class Animal { + +} + +class Mammal inherits Animal { + +} + +class Reptile inherits Animal { + +} + +class Dog inherits Mammal { + +} + +class Cat inherits Mammal { + } \ No newline at end of file diff --git a/tests/inference/11_program.cl b/tests/inference/11_program.cl index 9aa7eaf9a..80cf2ee8b 100644 --- a/tests/inference/11_program.cl +++ b/tests/inference/11_program.cl @@ -1,35 +1,35 @@ -class Main { - main (): Object { - 0 - }; - - f(): AUTO_TYPE { - let x: AUTO_TYPE <- new Dog in - case x of - m: Mammal => - case m of - c: Cat => create_cat(); - d: Dog => create_dog(); - esac; - r: Reptile => create_reptile(); - esac - }; - - create_dog(): AUTO_TYPE { - new Dog - }; - - create_cat(): AUTO_TYPE { - new Cat - }; - - create_reptile(): AUTO_TYPE { - new Reptile - }; -} - -class Animal {} -class Mammal inherits Animal {} -class Reptile inherits Animal {} -class Dog inherits Mammal {} +class Main { + main (): Object { + 0 + }; + + f(): AUTO_TYPE { + let x: AUTO_TYPE <- new Dog in + case x of + m: Mammal => + case m of + c: Cat => create_cat(); + d: Dog => create_dog(); + esac; + r: Reptile => create_reptile(); + esac + }; + + create_dog(): AUTO_TYPE { + new Dog + }; + + create_cat(): AUTO_TYPE { + new Cat + }; + + create_reptile(): AUTO_TYPE { + new Reptile + }; +} + +class Animal {} +class Mammal inherits Animal {} +class Reptile inherits Animal {} +class Dog inherits Mammal {} class Cat inherits Mammal {} \ No newline at end of file diff --git a/tests/inference/11_result.txt b/tests/inference/11_result.txt index 3ab526fbc..f291cb86b 100644 --- a/tests/inference/11_result.txt +++ b/tests/inference/11_result.txt @@ -1,52 +1,52 @@ -class Main { - main (): Object { - 0 - }; - - f (): Animal { - let x: Dog <- (new Dog) in - case x of - m : Mammal => - case m of - c : Cat => - self.create_cat(); - d : Dog => - self.create_dog(); - esac; - r : Reptile => - self.create_reptile(); - esac - }; - - create_dog (): Dog { - (new Dog) - }; - - create_cat (): Cat { - (new Cat) - }; - - create_reptile (): Reptile { - (new Reptile) - }; -} - -class Animal { - -} - -class Mammal inherits Animal { - -} - -class Reptile inherits Animal { - -} - -class Dog inherits Mammal { - -} - -class Cat inherits Mammal { - +class Main { + main (): Object { + 0 + }; + + f (): Animal { + let x: Dog <- (new Dog) in + case x of + m : Mammal => + case m of + c : Cat => + self.create_cat(); + d : Dog => + self.create_dog(); + esac; + r : Reptile => + self.create_reptile(); + esac + }; + + create_dog (): Dog { + (new Dog) + }; + + create_cat (): Cat { + (new Cat) + }; + + create_reptile (): Reptile { + (new Reptile) + }; +} + +class Animal { + +} + +class Mammal inherits Animal { + +} + +class Reptile inherits Animal { + +} + +class Dog inherits Mammal { + +} + +class Cat inherits Mammal { + } \ No newline at end of file diff --git a/tests/lexer/comment1.cl b/tests/lexer/comment1.cl index 69533f23c..1b63af3c7 100644 --- a/tests/lexer/comment1.cl +++ b/tests/lexer/comment1.cl @@ -1,55 +1,55 @@ ---Any characters between two dashes “--” and the next newline ---(or EOF, if there is no next newline) are treated as comments - -(*(*(* -Comments may also be written by enclosing -text in (∗ . . . ∗). The latter form of comment may be nested. -Comments cannot cross file boundaries. -*)*)*) - -class Error() { - - (* There was once a comment, - that was quite long. - But, the reader soon discovered that - the comment was indeed longer than - previously assumed. Now, the reader - was in a real dilemma; is the comment - ever gonna end? If I stop reading, will - it end? - He started imagining all sorts of things. - He thought about heisenberg's cat and how - how that relates to the end of the sentence. - He thought to himself "I'm gonna stop reading". - "If I keep reading this comment, I'm gonna know - the fate of this sentence; That will be disastorous." - He knew that such a comment was gonna extend to - another file. It was too awesome to be contained in - a single file. And he would have kept reading too... - if only... - cool wasn't a super-duper-fab-awesomest language; - but cool is that language; - "This comment shall go not cross this file" said cool. - Alas! The reader could read no more. - There was once a comment, - that was quite long. - But, the reader soon discovered that - the comment was indeed longer than - previously assumed. Now, the reader - was in a real dilemma; is the comment - ever gonna end? If I stop reading, will - it end? - He started imagining all sorts of things. - He thought about heisenberg's cat and how - how that relates to the end of the sentence. - He thought to himself "I'm gonna stop reading". - "If I keep reading this comment, I'm gonna know - the fate of this sentence; That will be disastorous." - He knew that such a comment was gonna extend to - another file. It was too awesome to be contained in - a single file. And he would have kept reading too... - if only... - cool wasn't a super-duper-fab-awesomest language; - but cool is that language; - "This comment shall go not cross this file" said cool. +--Any characters between two dashes “--” and the next newline +--(or EOF, if there is no next newline) are treated as comments + +(*(*(* +Comments may also be written by enclosing +text in (∗ . . . ∗). The latter form of comment may be nested. +Comments cannot cross file boundaries. +*)*)*) + +class Error() { + + (* There was once a comment, + that was quite long. + But, the reader soon discovered that + the comment was indeed longer than + previously assumed. Now, the reader + was in a real dilemma; is the comment + ever gonna end? If I stop reading, will + it end? + He started imagining all sorts of things. + He thought about heisenberg's cat and how + how that relates to the end of the sentence. + He thought to himself "I'm gonna stop reading". + "If I keep reading this comment, I'm gonna know + the fate of this sentence; That will be disastorous." + He knew that such a comment was gonna extend to + another file. It was too awesome to be contained in + a single file. And he would have kept reading too... + if only... + cool wasn't a super-duper-fab-awesomest language; + but cool is that language; + "This comment shall go not cross this file" said cool. + Alas! The reader could read no more. + There was once a comment, + that was quite long. + But, the reader soon discovered that + the comment was indeed longer than + previously assumed. Now, the reader + was in a real dilemma; is the comment + ever gonna end? If I stop reading, will + it end? + He started imagining all sorts of things. + He thought about heisenberg's cat and how + how that relates to the end of the sentence. + He thought to himself "I'm gonna stop reading". + "If I keep reading this comment, I'm gonna know + the fate of this sentence; That will be disastorous." + He knew that such a comment was gonna extend to + another file. It was too awesome to be contained in + a single file. And he would have kept reading too... + if only... + cool wasn't a super-duper-fab-awesomest language; + but cool is that language; + "This comment shall go not cross this file" said cool. Alas! The reader could read no more. \ No newline at end of file diff --git a/tests/lexer/comment1_error.txt b/tests/lexer/comment1_error.txt index 9fd7b8d67..710483ee9 100644 --- a/tests/lexer/comment1_error.txt +++ b/tests/lexer/comment1_error.txt @@ -1 +1 @@ -(55, 46) - LexicographicError: EOF in comment +(55, 46) - LexicographicError: EOF in comment diff --git a/tests/lexer/iis1.cl b/tests/lexer/iis1.cl index 12cb52beb..ca6b68ac3 100644 --- a/tests/lexer/iis1.cl +++ b/tests/lexer/iis1.cl @@ -1,111 +1,111 @@ -(* Integers, Identifiers, and Special Notation *) - -0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ -5! = 120, 2 + 2 = 5 or E = mc2; p + 1 @ p = 1: for x in range(len(b)) -new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) -class Class if then else fi testing Testing ~007agent_bond james_007B0N3SS___ -loop pool while tRuE or noT faLsE let in case of ESAC - -(* -#3 INT_CONST 0007 -#3 INT_CONST 123 -#3 '+' -#3 INT_CONST 1 -#3 '-' -#3 INT_CONST 1 -#3 '+' -#3 INT_CONST 90 -#3 '-' -#3 INT_CONST 09 -#3 '+' -#3 INT_CONST 11113 -#3 '-' -#3 INT_CONST 4 -#3 OBJECTID r -#3 '*' -#3 OBJECTID a -#3 '*' -#3 OBJECTID self -#3 '*' -#3 OBJECTID c -#3 '+' -#3 '+' -#4 INT_CONST 5 -#4 ERROR "!" -#4 '=' -#4 INT_CONST 120 -#4 ',' -#4 INT_CONST 2 -#4 '+' -#4 INT_CONST 2 -#4 '=' -#4 INT_CONST 5 -#4 OBJECTID or -#4 TYPEID E -#4 '=' -#4 OBJECTID mc2 -#4 ';' -#4 OBJECTID p -#4 '+' -#4 INT_CONST 1 -#4 '@' -#4 OBJECTID p -#4 '=' -#4 INT_CONST 1 -#4 ':' -#4 OBJECTID for -#4 OBJECTID x -#4 IN -#4 OBJECTID range -#4 '(' -#4 OBJECTID len -#4 '(' -#4 OBJECTID b -#4 ')' -#4 ')' -#5 NEW -#5 '/' -#5 ASSIGN -#5 '<' -#5 LE -#5 DARROW -#5 '{' -#5 '(' -#5 TYPEID Int -#5 ':' -#5 TYPEID Objet -#5 ',' -#5 TYPEID Bool -#5 ';' -#5 TYPEID String -#5 '.' -#5 OBJECTID string -#5 TYPEID SELF_TYPE -#5 ISVOID -#5 '}' -#5 ')' -#6 CLASS -#6 CLASS -#6 IF -#6 THEN -#6 ELSE -#6 FI -#6 OBJECTID testing -#6 TYPEID Testing -#6 '~' -#6 INT_CONST 007 -#6 OBJECTID agent_bond -#6 OBJECTID james_007B0N3SS___ -#7 LOOP -#7 POOL -#7 WHILE -#7 BOOL_CONST true -#7 OBJECTID or -#7 NOT -#7 BOOL_CONST false -#7 LET -#7 IN -#7 CASE -#7 OF -#7 ESAC +(* Integers, Identifiers, and Special Notation *) + +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ +5! = 120, 2 + 2 = 5 or E = mc2; p + 1 @ p = 1: for x in range(len(b)) +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) +class Class if then else fi testing Testing ~007agent_bond james_007B0N3SS___ +loop pool while tRuE or noT faLsE let in case of ESAC + +(* +#3 INT_CONST 0007 +#3 INT_CONST 123 +#3 '+' +#3 INT_CONST 1 +#3 '-' +#3 INT_CONST 1 +#3 '+' +#3 INT_CONST 90 +#3 '-' +#3 INT_CONST 09 +#3 '+' +#3 INT_CONST 11113 +#3 '-' +#3 INT_CONST 4 +#3 OBJECTID r +#3 '*' +#3 OBJECTID a +#3 '*' +#3 OBJECTID self +#3 '*' +#3 OBJECTID c +#3 '+' +#3 '+' +#4 INT_CONST 5 +#4 ERROR "!" +#4 '=' +#4 INT_CONST 120 +#4 ',' +#4 INT_CONST 2 +#4 '+' +#4 INT_CONST 2 +#4 '=' +#4 INT_CONST 5 +#4 OBJECTID or +#4 TYPEID E +#4 '=' +#4 OBJECTID mc2 +#4 ';' +#4 OBJECTID p +#4 '+' +#4 INT_CONST 1 +#4 '@' +#4 OBJECTID p +#4 '=' +#4 INT_CONST 1 +#4 ':' +#4 OBJECTID for +#4 OBJECTID x +#4 IN +#4 OBJECTID range +#4 '(' +#4 OBJECTID len +#4 '(' +#4 OBJECTID b +#4 ')' +#4 ')' +#5 NEW +#5 '/' +#5 ASSIGN +#5 '<' +#5 LE +#5 DARROW +#5 '{' +#5 '(' +#5 TYPEID Int +#5 ':' +#5 TYPEID Objet +#5 ',' +#5 TYPEID Bool +#5 ';' +#5 TYPEID String +#5 '.' +#5 OBJECTID string +#5 TYPEID SELF_TYPE +#5 ISVOID +#5 '}' +#5 ')' +#6 CLASS +#6 CLASS +#6 IF +#6 THEN +#6 ELSE +#6 FI +#6 OBJECTID testing +#6 TYPEID Testing +#6 '~' +#6 INT_CONST 007 +#6 OBJECTID agent_bond +#6 OBJECTID james_007B0N3SS___ +#7 LOOP +#7 POOL +#7 WHILE +#7 BOOL_CONST true +#7 OBJECTID or +#7 NOT +#7 BOOL_CONST false +#7 LET +#7 IN +#7 CASE +#7 OF +#7 ESAC *) \ No newline at end of file diff --git a/tests/lexer/iis1_error.txt b/tests/lexer/iis1_error.txt index 9e6d66cac..12f62f1ba 100644 --- a/tests/lexer/iis1_error.txt +++ b/tests/lexer/iis1_error.txt @@ -1 +1 @@ -(4, 2) - LexicographicError: ERROR "!" +(4, 2) - LexicographicError: ERROR "!" diff --git a/tests/lexer/iis2.cl b/tests/lexer/iis2.cl index 9b25715d4..d42552494 100644 --- a/tests/lexer/iis2.cl +++ b/tests/lexer/iis2.cl @@ -1,120 +1,120 @@ -(* Integers, Identifiers, and Special Notation *) - -0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ -class Class if then else fi testing Testing ~007agent_bond james_007bones___ - - -new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) -loop pool while tRuE or noT faLsE let in case of ESAC - -factorial(5) = 120, 2 + 2 = 5? or E = mc2; p + 1 resto p = 1: (@ for x in range(len(b))) - -(* -#3 INT_CONST 0007 -#3 INT_CONST 123 -#3 '+' -#3 INT_CONST 1 -#3 '-' -#3 INT_CONST 1 -#3 '+' -#3 INT_CONST 90 -#3 '-' -#3 INT_CONST 09 -#3 '+' -#3 INT_CONST 11113 -#3 '-' -#3 INT_CONST 4 -#3 OBJECTID r -#3 '*' -#3 OBJECTID a -#3 '*' -#3 OBJECTID self -#3 '*' -#3 OBJECTID c -#3 '+' -#3 '+' -#4 CLASS -#4 CLASS -#4 IF -#4 THEN -#4 ELSE -#4 FI -#4 OBJECTID testing -#4 TYPEID Testing -#4 '~' -#4 INT_CONST 007 -#4 OBJECTID agent_bond -#4 OBJECTID james_007bones___ -#7 NEW -#7 '/' -#7 ASSIGN -#7 '<' -#7 LE -#7 DARROW -#7 '{' -#7 '(' -#7 TYPEID Int -#7 ':' -#7 TYPEID Objet -#7 ',' -#7 TYPEID Bool -#7 ';' -#7 TYPEID String -#7 '.' -#7 OBJECTID string -#7 TYPEID SELF_TYPE -#7 ISVOID -#7 '}' -#7 ')' -#8 LOOP -#8 POOL -#8 WHILE -#8 BOOL_CONST true -#8 OBJECTID or -#8 NOT -#8 BOOL_CONST false -#8 LET -#8 IN -#8 CASE -#8 OF -#8 ESAC -#10 OBJECTID factorial -#10 '(' -#10 INT_CONST 5 -#10 ')' -#10 '=' -#10 INT_CONST 120 -#10 ',' -#10 INT_CONST 2 -#10 '+' -#10 INT_CONST 2 -#10 '=' -#10 INT_CONST 5 -#10 ERROR "?" -#10 OBJECTID or -#10 TYPEID E -#10 '=' -#10 OBJECTID mc2 -#10 ';' -#10 OBJECTID p -#10 '+' -#10 INT_CONST 1 -#10 OBJECTID resto -#10 OBJECTID p -#10 '=' -#10 INT_CONST 1 -#10 ':' -#10 '(' -#10 '@' -#10 OBJECTID for -#10 OBJECTID x -#10 IN -#10 OBJECTID range -#10 '(' -#10 OBJECTID len -#10 '(' -#10 OBJECTID b -#10 ')' -#10 ')' -#10 ')' +(* Integers, Identifiers, and Special Notation *) + +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ +class Class if then else fi testing Testing ~007agent_bond james_007bones___ + + +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) +loop pool while tRuE or noT faLsE let in case of ESAC + +factorial(5) = 120, 2 + 2 = 5? or E = mc2; p + 1 resto p = 1: (@ for x in range(len(b))) + +(* +#3 INT_CONST 0007 +#3 INT_CONST 123 +#3 '+' +#3 INT_CONST 1 +#3 '-' +#3 INT_CONST 1 +#3 '+' +#3 INT_CONST 90 +#3 '-' +#3 INT_CONST 09 +#3 '+' +#3 INT_CONST 11113 +#3 '-' +#3 INT_CONST 4 +#3 OBJECTID r +#3 '*' +#3 OBJECTID a +#3 '*' +#3 OBJECTID self +#3 '*' +#3 OBJECTID c +#3 '+' +#3 '+' +#4 CLASS +#4 CLASS +#4 IF +#4 THEN +#4 ELSE +#4 FI +#4 OBJECTID testing +#4 TYPEID Testing +#4 '~' +#4 INT_CONST 007 +#4 OBJECTID agent_bond +#4 OBJECTID james_007bones___ +#7 NEW +#7 '/' +#7 ASSIGN +#7 '<' +#7 LE +#7 DARROW +#7 '{' +#7 '(' +#7 TYPEID Int +#7 ':' +#7 TYPEID Objet +#7 ',' +#7 TYPEID Bool +#7 ';' +#7 TYPEID String +#7 '.' +#7 OBJECTID string +#7 TYPEID SELF_TYPE +#7 ISVOID +#7 '}' +#7 ')' +#8 LOOP +#8 POOL +#8 WHILE +#8 BOOL_CONST true +#8 OBJECTID or +#8 NOT +#8 BOOL_CONST false +#8 LET +#8 IN +#8 CASE +#8 OF +#8 ESAC +#10 OBJECTID factorial +#10 '(' +#10 INT_CONST 5 +#10 ')' +#10 '=' +#10 INT_CONST 120 +#10 ',' +#10 INT_CONST 2 +#10 '+' +#10 INT_CONST 2 +#10 '=' +#10 INT_CONST 5 +#10 ERROR "?" +#10 OBJECTID or +#10 TYPEID E +#10 '=' +#10 OBJECTID mc2 +#10 ';' +#10 OBJECTID p +#10 '+' +#10 INT_CONST 1 +#10 OBJECTID resto +#10 OBJECTID p +#10 '=' +#10 INT_CONST 1 +#10 ':' +#10 '(' +#10 '@' +#10 OBJECTID for +#10 OBJECTID x +#10 IN +#10 OBJECTID range +#10 '(' +#10 OBJECTID len +#10 '(' +#10 OBJECTID b +#10 ')' +#10 ')' +#10 ')' *) \ No newline at end of file diff --git a/tests/lexer/iis2_error.txt b/tests/lexer/iis2_error.txt index 922391a9d..988d0286e 100644 --- a/tests/lexer/iis2_error.txt +++ b/tests/lexer/iis2_error.txt @@ -1 +1 @@ -(10, 30) - LexicographicError: ERROR "?" +(10, 30) - LexicographicError: ERROR "?" diff --git a/tests/lexer/iis3.cl b/tests/lexer/iis3.cl index 0b965ddea..dcd85f960 100644 --- a/tests/lexer/iis3.cl +++ b/tests/lexer/iis3.cl @@ -1,121 +1,121 @@ -(* Integers, Identifiers, and Special Notation *) - -factorial(5) = 120, 2 + 2 = 5 or E = mc^2; p + 1 @ p = 1: z for x in range(len(b))) - -loop pool while tRuE or noT faLsE let in case of ESAC - -new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) - - -0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ -class Class if then else fi testing Testing ~007agent_bond james_007bones___ - -(* -#3 OBJECTID factorial -#3 '(' -#3 INT_CONST 5 -#3 ')' -#3 '=' -#3 INT_CONST 120 -#3 ',' -#3 INT_CONST 2 -#3 '+' -#3 INT_CONST 2 -#3 '=' -#3 INT_CONST 5 -#3 OBJECTID or -#3 TYPEID E -#3 '=' -#3 OBJECTID mc -#3 ERROR "^" -#3 INT_CONST 2 -#3 ';' -#3 OBJECTID p -#3 '+' -#3 INT_CONST 1 -#3 '@' -#3 OBJECTID p -#3 '=' -#3 INT_CONST 1 -#3 ':' -#3 OBJECTID z -#3 OBJECTID for -#3 OBJECTID x -#3 IN -#3 OBJECTID range -#3 '(' -#3 OBJECTID len -#3 '(' -#3 OBJECTID b -#3 ')' -#3 ')' -#3 ')' -#5 LOOP -#5 POOL -#5 WHILE -#5 BOOL_CONST true -#5 OBJECTID or -#5 NOT -#5 BOOL_CONST false -#5 LET -#5 IN -#5 CASE -#5 OF -#5 ESAC -#7 NEW -#7 '/' -#7 ASSIGN -#7 '<' -#7 LE -#7 DARROW -#7 '{' -#7 '(' -#7 TYPEID Int -#7 ':' -#7 TYPEID Objet -#7 ',' -#7 TYPEID Bool -#7 ';' -#7 TYPEID String -#7 '.' -#7 OBJECTID string -#7 TYPEID SELF_TYPE -#7 ISVOID -#7 '}' -#7 ')' -#10 INT_CONST 0007 -#10 INT_CONST 123 -#10 '+' -#10 INT_CONST 1 -#10 '-' -#10 INT_CONST 1 -#10 '+' -#10 INT_CONST 90 -#10 '-' -#10 INT_CONST 09 -#10 '+' -#10 INT_CONST 11113 -#10 '-' -#10 INT_CONST 4 -#10 OBJECTID r -#10 '*' -#10 OBJECTID a -#10 '*' -#10 OBJECTID self -#10 '*' -#10 OBJECTID c -#10 '+' -#10 '+' -#11 CLASS -#11 CLASS -#11 IF -#11 THEN -#11 ELSE -#11 FI -#11 OBJECTID testing -#11 TYPEID Testing -#11 '~' -#11 INT_CONST 007 -#11 OBJECTID agent_bond -#11 OBJECTID james_007bones___ +(* Integers, Identifiers, and Special Notation *) + +factorial(5) = 120, 2 + 2 = 5 or E = mc^2; p + 1 @ p = 1: z for x in range(len(b))) + +loop pool while tRuE or noT faLsE let in case of ESAC + +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) + + +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ +class Class if then else fi testing Testing ~007agent_bond james_007bones___ + +(* +#3 OBJECTID factorial +#3 '(' +#3 INT_CONST 5 +#3 ')' +#3 '=' +#3 INT_CONST 120 +#3 ',' +#3 INT_CONST 2 +#3 '+' +#3 INT_CONST 2 +#3 '=' +#3 INT_CONST 5 +#3 OBJECTID or +#3 TYPEID E +#3 '=' +#3 OBJECTID mc +#3 ERROR "^" +#3 INT_CONST 2 +#3 ';' +#3 OBJECTID p +#3 '+' +#3 INT_CONST 1 +#3 '@' +#3 OBJECTID p +#3 '=' +#3 INT_CONST 1 +#3 ':' +#3 OBJECTID z +#3 OBJECTID for +#3 OBJECTID x +#3 IN +#3 OBJECTID range +#3 '(' +#3 OBJECTID len +#3 '(' +#3 OBJECTID b +#3 ')' +#3 ')' +#3 ')' +#5 LOOP +#5 POOL +#5 WHILE +#5 BOOL_CONST true +#5 OBJECTID or +#5 NOT +#5 BOOL_CONST false +#5 LET +#5 IN +#5 CASE +#5 OF +#5 ESAC +#7 NEW +#7 '/' +#7 ASSIGN +#7 '<' +#7 LE +#7 DARROW +#7 '{' +#7 '(' +#7 TYPEID Int +#7 ':' +#7 TYPEID Objet +#7 ',' +#7 TYPEID Bool +#7 ';' +#7 TYPEID String +#7 '.' +#7 OBJECTID string +#7 TYPEID SELF_TYPE +#7 ISVOID +#7 '}' +#7 ')' +#10 INT_CONST 0007 +#10 INT_CONST 123 +#10 '+' +#10 INT_CONST 1 +#10 '-' +#10 INT_CONST 1 +#10 '+' +#10 INT_CONST 90 +#10 '-' +#10 INT_CONST 09 +#10 '+' +#10 INT_CONST 11113 +#10 '-' +#10 INT_CONST 4 +#10 OBJECTID r +#10 '*' +#10 OBJECTID a +#10 '*' +#10 OBJECTID self +#10 '*' +#10 OBJECTID c +#10 '+' +#10 '+' +#11 CLASS +#11 CLASS +#11 IF +#11 THEN +#11 ELSE +#11 FI +#11 OBJECTID testing +#11 TYPEID Testing +#11 '~' +#11 INT_CONST 007 +#11 OBJECTID agent_bond +#11 OBJECTID james_007bones___ *) \ No newline at end of file diff --git a/tests/lexer/iis3_error.txt b/tests/lexer/iis3_error.txt index b001b6a71..3abc2b556 100644 --- a/tests/lexer/iis3_error.txt +++ b/tests/lexer/iis3_error.txt @@ -1 +1 @@ -(3, 40) - LexicographicError: ERROR "^" +(3, 40) - LexicographicError: ERROR "^" diff --git a/tests/lexer/iis4.cl b/tests/lexer/iis4.cl index 9e7a9cb62..5357ab734 100644 --- a/tests/lexer/iis4.cl +++ b/tests/lexer/iis4.cl @@ -1,120 +1,120 @@ -(* Integers, Identifiers, and Special Notation *) - -new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) -0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ - -factorial(5) = 120, 2 + 2 = 5 or E = mc2; p + 1 % p = 1: @.@ for x in range(len(b))~ - - -loop pool while tRuE or noT faLsE let in case of ESAC -class Class if then else fi testing Testing ~007agent_bond james_007bones___ - -(* -#3 NEW -#3 '/' -#3 ASSIGN -#3 '<' -#3 LE -#3 DARROW -#3 '{' -#3 '(' -#3 TYPEID Int -#3 ':' -#3 TYPEID Objet -#3 ',' -#3 TYPEID Bool -#3 ';' -#3 TYPEID String -#3 '.' -#3 OBJECTID string -#3 TYPEID SELF_TYPE -#3 ISVOID -#3 '}' -#3 ')' -#4 INT_CONST 0007 -#4 INT_CONST 123 -#4 '+' -#4 INT_CONST 1 -#4 '-' -#4 INT_CONST 1 -#4 '+' -#4 INT_CONST 90 -#4 '-' -#4 INT_CONST 09 -#4 '+' -#4 INT_CONST 11113 -#4 '-' -#4 INT_CONST 4 -#4 OBJECTID r -#4 '*' -#4 OBJECTID a -#4 '*' -#4 OBJECTID self -#4 '*' -#4 OBJECTID c -#4 '+' -#4 '+' -#6 OBJECTID factorial -#6 '(' -#6 INT_CONST 5 -#6 ')' -#6 '=' -#6 INT_CONST 120 -#6 ',' -#6 INT_CONST 2 -#6 '+' -#6 INT_CONST 2 -#6 '=' -#6 INT_CONST 5 -#6 OBJECTID or -#6 TYPEID E -#6 '=' -#6 OBJECTID mc2 -#6 ';' -#6 OBJECTID p -#6 '+' -#6 INT_CONST 1 -#6 ERROR "%" -#6 OBJECTID p -#6 '=' -#6 INT_CONST 1 -#6 ':' -#6 '@' -#6 '.' -#6 '@' -#6 OBJECTID for -#6 OBJECTID x -#6 IN -#6 OBJECTID range -#6 '(' -#6 OBJECTID len -#6 '(' -#6 OBJECTID b -#6 ')' -#6 ')' -#6 '~' -#9 LOOP -#9 POOL -#9 WHILE -#9 BOOL_CONST true -#9 OBJECTID or -#9 NOT -#9 BOOL_CONST false -#9 LET -#9 IN -#9 CASE -#9 OF -#9 ESAC -#10 CLASS -#10 CLASS -#10 IF -#10 THEN -#10 ELSE -#10 FI -#10 OBJECTID testing -#10 TYPEID Testing -#10 '~' -#10 INT_CONST 007 -#10 OBJECTID agent_bond -#10 OBJECTID james_007bones___ +(* Integers, Identifiers, and Special Notation *) + +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ + +factorial(5) = 120, 2 + 2 = 5 or E = mc2; p + 1 % p = 1: @.@ for x in range(len(b))~ + + +loop pool while tRuE or noT faLsE let in case of ESAC +class Class if then else fi testing Testing ~007agent_bond james_007bones___ + +(* +#3 NEW +#3 '/' +#3 ASSIGN +#3 '<' +#3 LE +#3 DARROW +#3 '{' +#3 '(' +#3 TYPEID Int +#3 ':' +#3 TYPEID Objet +#3 ',' +#3 TYPEID Bool +#3 ';' +#3 TYPEID String +#3 '.' +#3 OBJECTID string +#3 TYPEID SELF_TYPE +#3 ISVOID +#3 '}' +#3 ')' +#4 INT_CONST 0007 +#4 INT_CONST 123 +#4 '+' +#4 INT_CONST 1 +#4 '-' +#4 INT_CONST 1 +#4 '+' +#4 INT_CONST 90 +#4 '-' +#4 INT_CONST 09 +#4 '+' +#4 INT_CONST 11113 +#4 '-' +#4 INT_CONST 4 +#4 OBJECTID r +#4 '*' +#4 OBJECTID a +#4 '*' +#4 OBJECTID self +#4 '*' +#4 OBJECTID c +#4 '+' +#4 '+' +#6 OBJECTID factorial +#6 '(' +#6 INT_CONST 5 +#6 ')' +#6 '=' +#6 INT_CONST 120 +#6 ',' +#6 INT_CONST 2 +#6 '+' +#6 INT_CONST 2 +#6 '=' +#6 INT_CONST 5 +#6 OBJECTID or +#6 TYPEID E +#6 '=' +#6 OBJECTID mc2 +#6 ';' +#6 OBJECTID p +#6 '+' +#6 INT_CONST 1 +#6 ERROR "%" +#6 OBJECTID p +#6 '=' +#6 INT_CONST 1 +#6 ':' +#6 '@' +#6 '.' +#6 '@' +#6 OBJECTID for +#6 OBJECTID x +#6 IN +#6 OBJECTID range +#6 '(' +#6 OBJECTID len +#6 '(' +#6 OBJECTID b +#6 ')' +#6 ')' +#6 '~' +#9 LOOP +#9 POOL +#9 WHILE +#9 BOOL_CONST true +#9 OBJECTID or +#9 NOT +#9 BOOL_CONST false +#9 LET +#9 IN +#9 CASE +#9 OF +#9 ESAC +#10 CLASS +#10 CLASS +#10 IF +#10 THEN +#10 ELSE +#10 FI +#10 OBJECTID testing +#10 TYPEID Testing +#10 '~' +#10 INT_CONST 007 +#10 OBJECTID agent_bond +#10 OBJECTID james_007bones___ *) \ No newline at end of file diff --git a/tests/lexer/iis4_error.txt b/tests/lexer/iis4_error.txt index f24076a8c..aab8f39c1 100644 --- a/tests/lexer/iis4_error.txt +++ b/tests/lexer/iis4_error.txt @@ -1 +1 @@ -(6, 49) - LexicographicError: ERROR "!" +(6, 49) - LexicographicError: ERROR "!" diff --git a/tests/lexer/iis5.cl b/tests/lexer/iis5.cl index d146c0547..f602488b9 100644 --- a/tests/lexer/iis5.cl +++ b/tests/lexer/iis5.cl @@ -1,121 +1,121 @@ -(* Integers, Identifiers, and Special Notation *) - - -loop pool while tRuE or noT faLsE let in case of ESAC -new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) -class Class if then else fi testing Testing ~007agent_bond james_007bones___ - -factorial(5) = 120, 2 + 2 = 5 or E = mc2; p + 1 resto p = 1: [@.@ for x in range(len(b))] - -0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ - -(* -#4 LOOP -#4 POOL -#4 WHILE -#4 BOOL_CONST true -#4 OBJECTID or -#4 NOT -#4 BOOL_CONST false -#4 LET -#4 IN -#4 CASE -#4 OF -#4 ESAC -#5 NEW -#5 '/' -#5 ASSIGN -#5 '<' -#5 LE -#5 DARROW -#5 '{' -#5 '(' -#5 TYPEID Int -#5 ':' -#5 TYPEID Objet -#5 ',' -#5 TYPEID Bool -#5 ';' -#5 TYPEID String -#5 '.' -#5 OBJECTID string -#5 TYPEID SELF_TYPE -#5 ISVOID -#5 '}' -#5 ')' -#6 CLASS -#6 CLASS -#6 IF -#6 THEN -#6 ELSE -#6 FI -#6 OBJECTID testing -#6 TYPEID Testing -#6 '~' -#6 INT_CONST 007 -#6 OBJECTID agent_bond -#6 OBJECTID james_007bones___ -#8 OBJECTID factorial -#8 '(' -#8 INT_CONST 5 -#8 ')' -#8 '=' -#8 INT_CONST 120 -#8 ',' -#8 INT_CONST 2 -#8 '+' -#8 INT_CONST 2 -#8 '=' -#8 INT_CONST 5 -#8 OBJECTID or -#8 TYPEID E -#8 '=' -#8 OBJECTID mc2 -#8 ';' -#8 OBJECTID p -#8 '+' -#8 INT_CONST 1 -#8 OBJECTID resto -#8 OBJECTID p -#8 '=' -#8 INT_CONST 1 -#8 ':' -#8 ERROR "[" -#8 '@' -#8 '.' -#8 '@' -#8 OBJECTID for -#8 OBJECTID x -#8 IN -#8 OBJECTID range -#8 '(' -#8 OBJECTID len -#8 '(' -#8 OBJECTID b -#8 ')' -#8 ')' -#8 ERROR "]" -#10 INT_CONST 0007 -#10 INT_CONST 123 -#10 '+' -#10 INT_CONST 1 -#10 '-' -#10 INT_CONST 1 -#10 '+' -#10 INT_CONST 90 -#10 '-' -#10 INT_CONST 09 -#10 '+' -#10 INT_CONST 11113 -#10 '-' -#10 INT_CONST 4 -#10 OBJECTID r -#10 '*' -#10 OBJECTID a -#10 '*' -#10 OBJECTID self -#10 '*' -#10 OBJECTID c -#10 '+' -#10 '+' -*) +(* Integers, Identifiers, and Special Notation *) + + +loop pool while tRuE or noT faLsE let in case of ESAC +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) +class Class if then else fi testing Testing ~007agent_bond james_007bones___ + +factorial(5) = 120, 2 + 2 = 5 or E = mc2; p + 1 resto p = 1: [@.@ for x in range(len(b))] + +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ + +(* +#4 LOOP +#4 POOL +#4 WHILE +#4 BOOL_CONST true +#4 OBJECTID or +#4 NOT +#4 BOOL_CONST false +#4 LET +#4 IN +#4 CASE +#4 OF +#4 ESAC +#5 NEW +#5 '/' +#5 ASSIGN +#5 '<' +#5 LE +#5 DARROW +#5 '{' +#5 '(' +#5 TYPEID Int +#5 ':' +#5 TYPEID Objet +#5 ',' +#5 TYPEID Bool +#5 ';' +#5 TYPEID String +#5 '.' +#5 OBJECTID string +#5 TYPEID SELF_TYPE +#5 ISVOID +#5 '}' +#5 ')' +#6 CLASS +#6 CLASS +#6 IF +#6 THEN +#6 ELSE +#6 FI +#6 OBJECTID testing +#6 TYPEID Testing +#6 '~' +#6 INT_CONST 007 +#6 OBJECTID agent_bond +#6 OBJECTID james_007bones___ +#8 OBJECTID factorial +#8 '(' +#8 INT_CONST 5 +#8 ')' +#8 '=' +#8 INT_CONST 120 +#8 ',' +#8 INT_CONST 2 +#8 '+' +#8 INT_CONST 2 +#8 '=' +#8 INT_CONST 5 +#8 OBJECTID or +#8 TYPEID E +#8 '=' +#8 OBJECTID mc2 +#8 ';' +#8 OBJECTID p +#8 '+' +#8 INT_CONST 1 +#8 OBJECTID resto +#8 OBJECTID p +#8 '=' +#8 INT_CONST 1 +#8 ':' +#8 ERROR "[" +#8 '@' +#8 '.' +#8 '@' +#8 OBJECTID for +#8 OBJECTID x +#8 IN +#8 OBJECTID range +#8 '(' +#8 OBJECTID len +#8 '(' +#8 OBJECTID b +#8 ')' +#8 ')' +#8 ERROR "]" +#10 INT_CONST 0007 +#10 INT_CONST 123 +#10 '+' +#10 INT_CONST 1 +#10 '-' +#10 INT_CONST 1 +#10 '+' +#10 INT_CONST 90 +#10 '-' +#10 INT_CONST 09 +#10 '+' +#10 INT_CONST 11113 +#10 '-' +#10 INT_CONST 4 +#10 OBJECTID r +#10 '*' +#10 OBJECTID a +#10 '*' +#10 OBJECTID self +#10 '*' +#10 OBJECTID c +#10 '+' +#10 '+' +*) diff --git a/tests/lexer/iis5_error.txt b/tests/lexer/iis5_error.txt index b3dbadcb6..9d6e1a738 100644 --- a/tests/lexer/iis5_error.txt +++ b/tests/lexer/iis5_error.txt @@ -1,2 +1,2 @@ -(8, 62) - LexicographicError: ERROR "[" -(8, 89) - LexicographicError: ERROR "]" +(8, 62) - LexicographicError: ERROR "[" +(8, 89) - LexicographicError: ERROR "]" diff --git a/tests/lexer/iis6.cl b/tests/lexer/iis6.cl index 1042f132b..ba93b19d9 100644 --- a/tests/lexer/iis6.cl +++ b/tests/lexer/iis6.cl @@ -1,125 +1,125 @@ -(* Integers, Identifiers, and Special Notation *) - -factorial(5) = 120, 2 + 2 = 5 or E = mc2; p + 1 resto p = 1: {@.@ for x in range(len(b))} - -new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) - - -class Class if then else fi testing Testing ~007agent_bond _james_007bones___ - - - -0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ -loop pool while tRuE or noT faLsE let in case of ESAC - -(* -#3 OBJECTID factorial -#3 '(' -#3 INT_CONST 5 -#3 ')' -#3 '=' -#3 INT_CONST 120 -#3 ',' -#3 INT_CONST 2 -#3 '+' -#3 INT_CONST 2 -#3 '=' -#3 INT_CONST 5 -#3 OBJECTID or -#3 TYPEID E -#3 '=' -#3 OBJECTID mc2 -#3 ';' -#3 OBJECTID p -#3 '+' -#3 INT_CONST 1 -#3 OBJECTID resto -#3 OBJECTID p -#3 '=' -#3 INT_CONST 1 -#3 ':' -#3 '{' -#3 '@' -#3 '.' -#3 '@' -#3 OBJECTID for -#3 OBJECTID x -#3 IN -#3 OBJECTID range -#3 '(' -#3 OBJECTID len -#3 '(' -#3 OBJECTID b -#3 ')' -#3 ')' -#3 '}' -#5 NEW -#5 '/' -#5 ASSIGN -#5 '<' -#5 LE -#5 DARROW -#5 '{' -#5 '(' -#5 TYPEID Int -#5 ':' -#5 TYPEID Objet -#5 ',' -#5 TYPEID Bool -#5 ';' -#5 TYPEID String -#5 '.' -#5 OBJECTID string -#5 TYPEID SELF_TYPE -#5 ISVOID -#5 '}' -#5 ')' -#8 CLASS -#8 CLASS -#8 IF -#8 THEN -#8 ELSE -#8 FI -#8 OBJECTID testing -#8 TYPEID Testing -#8 '~' -#8 INT_CONST 007 -#8 OBJECTID agent_bond -#8 ERROR "_" -#8 OBJECTID james_007bones___ -#12 INT_CONST 0007 -#12 INT_CONST 123 -#12 '+' -#12 INT_CONST 1 -#12 '-' -#12 INT_CONST 1 -#12 '+' -#12 INT_CONST 90 -#12 '-' -#12 INT_CONST 09 -#12 '+' -#12 INT_CONST 11113 -#12 '-' -#12 INT_CONST 4 -#12 OBJECTID r -#12 '*' -#12 OBJECTID a -#12 '*' -#12 OBJECTID self -#12 '*' -#12 OBJECTID c -#12 '+' -#12 '+' -#13 LOOP -#13 POOL -#13 WHILE -#13 BOOL_CONST true -#13 OBJECTID or -#13 NOT -#13 BOOL_CONST false -#13 LET -#13 IN -#13 CASE -#13 OF -#13 ESAC +(* Integers, Identifiers, and Special Notation *) + +factorial(5) = 120, 2 + 2 = 5 or E = mc2; p + 1 resto p = 1: {@.@ for x in range(len(b))} + +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) + + +class Class if then else fi testing Testing ~007agent_bond _james_007bones___ + + + +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ +loop pool while tRuE or noT faLsE let in case of ESAC + +(* +#3 OBJECTID factorial +#3 '(' +#3 INT_CONST 5 +#3 ')' +#3 '=' +#3 INT_CONST 120 +#3 ',' +#3 INT_CONST 2 +#3 '+' +#3 INT_CONST 2 +#3 '=' +#3 INT_CONST 5 +#3 OBJECTID or +#3 TYPEID E +#3 '=' +#3 OBJECTID mc2 +#3 ';' +#3 OBJECTID p +#3 '+' +#3 INT_CONST 1 +#3 OBJECTID resto +#3 OBJECTID p +#3 '=' +#3 INT_CONST 1 +#3 ':' +#3 '{' +#3 '@' +#3 '.' +#3 '@' +#3 OBJECTID for +#3 OBJECTID x +#3 IN +#3 OBJECTID range +#3 '(' +#3 OBJECTID len +#3 '(' +#3 OBJECTID b +#3 ')' +#3 ')' +#3 '}' +#5 NEW +#5 '/' +#5 ASSIGN +#5 '<' +#5 LE +#5 DARROW +#5 '{' +#5 '(' +#5 TYPEID Int +#5 ':' +#5 TYPEID Objet +#5 ',' +#5 TYPEID Bool +#5 ';' +#5 TYPEID String +#5 '.' +#5 OBJECTID string +#5 TYPEID SELF_TYPE +#5 ISVOID +#5 '}' +#5 ')' +#8 CLASS +#8 CLASS +#8 IF +#8 THEN +#8 ELSE +#8 FI +#8 OBJECTID testing +#8 TYPEID Testing +#8 '~' +#8 INT_CONST 007 +#8 OBJECTID agent_bond +#8 ERROR "_" +#8 OBJECTID james_007bones___ +#12 INT_CONST 0007 +#12 INT_CONST 123 +#12 '+' +#12 INT_CONST 1 +#12 '-' +#12 INT_CONST 1 +#12 '+' +#12 INT_CONST 90 +#12 '-' +#12 INT_CONST 09 +#12 '+' +#12 INT_CONST 11113 +#12 '-' +#12 INT_CONST 4 +#12 OBJECTID r +#12 '*' +#12 OBJECTID a +#12 '*' +#12 OBJECTID self +#12 '*' +#12 OBJECTID c +#12 '+' +#12 '+' +#13 LOOP +#13 POOL +#13 WHILE +#13 BOOL_CONST true +#13 OBJECTID or +#13 NOT +#13 BOOL_CONST false +#13 LET +#13 IN +#13 CASE +#13 OF +#13 ESAC *) \ No newline at end of file diff --git a/tests/lexer/iis6_error.txt b/tests/lexer/iis6_error.txt index d7fad9c79..79a9d5aee 100644 --- a/tests/lexer/iis6_error.txt +++ b/tests/lexer/iis6_error.txt @@ -1 +1 @@ -(8, 60) - LexicographicError: ERROR "_" +(8, 60) - LexicographicError: ERROR "_" diff --git a/tests/lexer/mixed1.cl b/tests/lexer/mixed1.cl index 803d58ef5..d3e520a10 100644 --- a/tests/lexer/mixed1.cl +++ b/tests/lexer/mixed1.cl @@ -1,14 +1,14 @@ -"lkjdsafkljdsalfj\u0000dsafdsaf\u0000djafslkjdsalf\nsdajf\" lkjfdsasdkjfl"123 -adsfasklj# -LKldsajf iNhERITS -"lkdsajf" - -(* -#1 STR_CONST "lkjdsafkljdsalfju0000dsafdsafu0000djafslkjdsalf\nsdajf\" lkjfdsasdkjfl" -#1 INT_CONST 123 -#2 OBJECTID adsfasklj -#2 ERROR "#" -#3 TYPEID LKldsajf -#3 INHERITS -#4 STR_CONST "lkdsajf" +"lkjdsafkljdsalfj\u0000dsafdsaf\u0000djafslkjdsalf\nsdajf\" lkjfdsasdkjfl"123 +adsfasklj# +LKldsajf iNhERITS +"lkdsajf" + +(* +#1 STR_CONST "lkjdsafkljdsalfju0000dsafdsafu0000djafslkjdsalf\nsdajf\" lkjfdsasdkjfl" +#1 INT_CONST 123 +#2 OBJECTID adsfasklj +#2 ERROR "#" +#3 TYPEID LKldsajf +#3 INHERITS +#4 STR_CONST "lkdsajf" *) \ No newline at end of file diff --git a/tests/lexer/mixed1_error.txt b/tests/lexer/mixed1_error.txt index 99af5fbdc..a142c2edd 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/mixed2.cl b/tests/lexer/mixed2.cl index 12039e123..759bf9523 100644 --- a/tests/lexer/mixed2.cl +++ b/tests/lexer/mixed2.cl @@ -1,20 +1,20 @@ -"kjas\"lnnsdj\nfljrdsaf" -@.$.@ -@*%*@ -"alkjfldajf""dasfadsf - -(* -#1 STR_CONST "kjas\"lnnsdj\nfljrdsaf" -#2 '@' -#2 '.' -#2 ERROR "$" -#2 '.' -#2 '@' -#3 '@' -#3 '*' -#3 ERROR "%" -#3 '*' -#3 '@' -#4 STR_CONST "alkjfldajf" -#4 ERROR "Unterminated string constant" +"kjas\"lnnsdj\nfljrdsaf" +@.$.@ +@*%*@ +"alkjfldajf""dasfadsf + +(* +#1 STR_CONST "kjas\"lnnsdj\nfljrdsaf" +#2 '@' +#2 '.' +#2 ERROR "$" +#2 '.' +#2 '@' +#3 '@' +#3 '*' +#3 ERROR "%" +#3 '*' +#3 '@' +#4 STR_CONST "alkjfldajf" +#4 ERROR "Unterminated string constant" *) \ No newline at end of file diff --git a/tests/lexer/mixed2_error.txt b/tests/lexer/mixed2_error.txt index 097dc2a07..37cb73ac2 100644 --- a/tests/lexer/mixed2_error.txt +++ b/tests/lexer/mixed2_error.txt @@ -1,3 +1,3 @@ -(2, 3) - LexicographicError: ERROR "$" -(3, 3) - LexicographicError: ERROR "%" -(4, 22) - LexicographicError: Unterminated string constant +(2, 3) - LexicographicError: ERROR "$" +(3, 3) - LexicographicError: ERROR "%" +(4, 22) - LexicographicError: Unterminated string constant diff --git a/tests/lexer/string1.cl b/tests/lexer/string1.cl index 6c3c00833..f0a5bd873 100644 --- a/tests/lexer/string1.cl +++ b/tests/lexer/string1.cl @@ -1,6 +1,6 @@ -(* A non-escaped newline character may not appear in a string *) - -"This \ -is OK" -"This is not +(* A non-escaped newline character may not appear in a string *) + +"This \ +is OK" +"This is not OK" \ No newline at end of file diff --git a/tests/lexer/string1_error.txt b/tests/lexer/string1_error.txt index 078c12bbb..1dd4d70d9 100644 --- a/tests/lexer/string1_error.txt +++ b/tests/lexer/string1_error.txt @@ -1,2 +1,2 @@ -(5, 13) - LexicographicError: Unterminated string constant +(5, 13) - LexicographicError: Unterminated string constant (6, 4) - LexicographicError: EOF in string constant \ No newline at end of file diff --git a/tests/lexer/string2.cl b/tests/lexer/string2.cl index 3704b6ae7..cb3024180 100644 --- a/tests/lexer/string2.cl +++ b/tests/lexer/string2.cl @@ -1,19 +1,19 @@ -(* A string may not contain EOF *) - -" May the Triforce \ - 0 \ - 0v0 \ - 0vvv0 \ - 0vvvvv0 \ - 0vvvvvvv0 \ - 0vvvvvvvvv0 \ - 0vvvvvvvvvvv0 \ - 000000000000000 \ - 0v0 0v0 \ - 0vvv0 0vvv0 \ - 0vvvvv0 0vvvvv0 \ - 0vvvvvvv0 0vvvvvvv0 \ - 0vvvvvvvvv0 0vvvvvvvvv0 \ - 0vvvvvvvvvvv0 0vvvvvvvvvvv0 \ - 00000000000000000000000000000 \ +(* A string may not contain EOF *) + +" May the Triforce \ + 0 \ + 0v0 \ + 0vvv0 \ + 0vvvvv0 \ + 0vvvvvvv0 \ + 0vvvvvvvvv0 \ + 0vvvvvvvvvvv0 \ + 000000000000000 \ + 0v0 0v0 \ + 0vvv0 0vvv0 \ + 0vvvvv0 0vvvvv0 \ + 0vvvvvvv0 0vvvvvvv0 \ + 0vvvvvvvvv0 0vvvvvvvvv0 \ + 0vvvvvvvvvvv0 0vvvvvvvvvvv0 \ + 00000000000000000000000000000 \ be with you! \ No newline at end of file diff --git a/tests/lexer/string4.cl b/tests/lexer/string4.cl index f4d39c027..7ca4eb42b 100644 --- a/tests/lexer/string4.cl +++ b/tests/lexer/string4.cl @@ -1,38 +1,38 @@ -class Main { - str <- "The big brown fox - jumped over the fence"; - main() : Object { - { - out_string("Yay! This is the newest shites ); - } - }; -}; - -(* -#1 CLASS -#1 TYPEID Main -#1 '{' -#2 OBJECTID str -#2 ASSIGN -#3 ERROR "Unterminated string constant" -#3 OBJECTID jumped -#3 OBJECTID over -#3 OBJECTID the -#3 OBJECTID fence -#4 ERROR "Unterminated string constant" -#4 OBJECTID main -#4 '(' -#4 ')' -#4 ':' -#4 TYPEID Object -#4 '{' -#5 '{' -#6 OBJECTID out_string -#6 '(' -#7 ERROR "Unterminated string constant" -#7 '}' -#8 '}' -#8 ';' -#9 '}' -#9 ';' +class Main { + str <- "The big brown fox + jumped over the fence"; + main() : Object { + { + out_string("Yay! This is the newest shites ); + } + }; +}; + +(* +#1 CLASS +#1 TYPEID Main +#1 '{' +#2 OBJECTID str +#2 ASSIGN +#3 ERROR "Unterminated string constant" +#3 OBJECTID jumped +#3 OBJECTID over +#3 OBJECTID the +#3 OBJECTID fence +#4 ERROR "Unterminated string constant" +#4 OBJECTID main +#4 '(' +#4 ')' +#4 ':' +#4 TYPEID Object +#4 '{' +#5 '{' +#6 OBJECTID out_string +#6 '(' +#7 ERROR "Unterminated string constant" +#7 '}' +#8 '}' +#8 ';' +#9 '}' +#9 ';' *) \ No newline at end of file diff --git a/tests/lexer/string4_error.txt b/tests/lexer/string4_error.txt index 5ab0ea847..bf420217c 100644 --- a/tests/lexer/string4_error.txt +++ b/tests/lexer/string4_error.txt @@ -1,3 +1,3 @@ -(2, 30) - LexicographicError: Unterminated string constant -(3, 36) - LexicographicError: Unterminated string constant +(2, 30) - LexicographicError: Unterminated string constant +(3, 36) - LexicographicError: Unterminated string constant (6, 58) - LexicographicError: Unterminated string constant \ No newline at end of file diff --git a/tests/lexer_test.py b/tests/lexer_test.py index 2a27223d3..a21fd880a 100644 --- a/tests/lexer_test.py +++ b/tests/lexer_test.py @@ -1,13 +1,13 @@ -import pytest -import os -from utils import compare_errors - -tests_dir = __file__.rpartition('/')[0] + '/lexer/' -tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] - -@pytest.mark.lexer -@pytest.mark.error -@pytest.mark.run(order=1) -@pytest.mark.parametrize("cool_file", tests) -def test_lexer_errors(compiler_path, cool_file): +import pytest +import os +from utils import compare_errors + +tests_dir = __file__.rpartition('/')[0] + '/lexer/' +tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] + +@pytest.mark.lexer +@pytest.mark.error +@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 diff --git a/tests/parser/assignment1.cl b/tests/parser/assignment1.cl index e179e4792..7587ffb45 100644 --- a/tests/parser/assignment1.cl +++ b/tests/parser/assignment1.cl @@ -1,37 +1,37 @@ -(* An assignment has the form <- *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(): String { - Test1 <- "Hello World" -- Identifiers begin with a lower case letter - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* An assignment has the form <- *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(): String { + Test1 <- "Hello World" -- Identifiers begin with a lower case letter + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/assignment2.cl b/tests/parser/assignment2.cl index 06f8f96d8..dd2267c1e 100644 --- a/tests/parser/assignment2.cl +++ b/tests/parser/assignment2.cl @@ -1,37 +1,37 @@ -(* An assignment has the form <- *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 - 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(): Int { - test1 <-- ~(1 + 2 + 3 + 4 + 5) -- The left side must be an expression - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* An assignment has the form <- *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 - 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(): Int { + test1 <-- ~(1 + 2 + 3 + 4 + 5) -- The left side must be an expression + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/assignment3.cl b/tests/parser/assignment3.cl index e7d0d4cd8..56f35bc01 100644 --- a/tests/parser/assignment3.cl +++ b/tests/parser/assignment3.cl @@ -1,37 +1,37 @@ -(* An assignment has the form <- *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(): Bool { - test1 <- true++ -- The left side must be an expression - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* An assignment has the form <- *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(): Bool { + test1 <- true++ -- The left side must be an expression + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/assignment3_error.txt b/tests/parser/assignment3_error.txt index be83d138b..fb0df23dc 100644 --- a/tests/parser/assignment3_error.txt +++ b/tests/parser/assignment3_error.txt @@ -1 +1 @@ -(29, 23) - SyntacticError: ERROR at or near "+" +(29, 23) - SyntacticError: ERROR at or near "+" diff --git a/tests/parser/attribute1.cl b/tests/parser/attribute1.cl index a021193c0..1259398af 100644 --- a/tests/parser/attribute1.cl +++ b/tests/parser/attribute1.cl @@ -1,34 +1,34 @@ -(* An attribute of class A specifies a variable that is part of the state of objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - -- Attributes names must begin with lowercase letters - Test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* An attribute of class A specifies a variable that is part of the state of objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + -- Attributes names must begin with lowercase letters + Test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/attribute2.cl b/tests/parser/attribute2.cl index 44e95a4dc..43d7ff86e 100644 --- a/tests/parser/attribute2.cl +++ b/tests/parser/attribute2.cl @@ -1,34 +1,34 @@ -(* An attribute of class A specifies a variable that is part of the state of objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - -- Type names must begin with uppercase letters - test3: string <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* An attribute of class A specifies a variable that is part of the state of objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + -- Type names must begin with uppercase letters + test3: string <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/attribute2_error.txt b/tests/parser/attribute2_error.txt index 5716d8e04..15f919e33 100644 --- a/tests/parser/attribute2_error.txt +++ b/tests/parser/attribute2_error.txt @@ -1 +1 @@ -(19, 12) - SyntacticError: ERROR at or near "string" +(19, 12) - SyntacticError: ERROR at or near "string" diff --git a/tests/parser/attribute3.cl b/tests/parser/attribute3.cl index 0cbbae605..86cb1871c 100644 --- a/tests/parser/attribute3.cl +++ b/tests/parser/attribute3.cl @@ -1,34 +1,34 @@ -(* An attribute of class A specifies a variable that is part of the state of objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - -- Expected '<-' not '<=' - test3: String <= "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* An attribute of class A specifies a variable that is part of the state of objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + -- Expected '<-' not '<=' + test3: String <= "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/attribute3_error.txt b/tests/parser/attribute3_error.txt index fc45c7d9c..fe70914f8 100644 --- a/tests/parser/attribute3_error.txt +++ b/tests/parser/attribute3_error.txt @@ -1 +1 @@ -(19, 19) - SyntacticError: ERROR at or near "<=" +(19, 19) - SyntacticError: ERROR at or near "<=" diff --git a/tests/parser/block1.cl b/tests/parser/block1.cl index 18999a60c..ac18b6c56 100644 --- a/tests/parser/block1.cl +++ b/tests/parser/block1.cl @@ -1,87 +1,87 @@ -(* A block has the form { ; ... ; } *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - pow: Int <- 1; - count: Int <- 0; - - testing6(a: Int): IO { - { - count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2 -- Missing ";" - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A block has the form { ; ... ; } *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + pow: Int <- 1; + count: Int <- 0; + + testing6(a: Int): IO { + { + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2 -- Missing ";" + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/block1_error.txt b/tests/parser/block1_error.txt index f939d44f0..042ee982a 100644 --- a/tests/parser/block1_error.txt +++ b/tests/parser/block1_error.txt @@ -1 +1 @@ -(56, 17) - SyntacticError: ERROR at or near "}" +(56, 17) - SyntacticError: ERROR at or near "}" diff --git a/tests/parser/block2.cl b/tests/parser/block2.cl index de16aad43..d06c9671e 100644 --- a/tests/parser/block2.cl +++ b/tests/parser/block2.cl @@ -1,87 +1,87 @@ -(* A block has the form { ; ... ; } *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - pow: Int <- 1; - count: Int <- 0; - - testing6(a: Int): IO { - -- Missing "{" - count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A block has the form { ; ... ; } *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + pow: Int <- 1; + count: Int <- 0; + + testing6(a: Int): IO { + -- Missing "{" + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/block2_error.txt b/tests/parser/block2_error.txt index 52d391e68..7674c9402 100644 --- a/tests/parser/block2_error.txt +++ b/tests/parser/block2_error.txt @@ -1 +1 @@ -(49, 23) - SyntacticError: ERROR at or near ";" +(49, 23) - SyntacticError: ERROR at or near ";" diff --git a/tests/parser/block3.cl b/tests/parser/block3.cl index 9a590812d..a2f8cd9bc 100644 --- a/tests/parser/block3.cl +++ b/tests/parser/block3.cl @@ -1,87 +1,87 @@ -(* A block has the form { ; ... ; } *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - pow: Int <- 1; - count: Int <- 0; - - testing6(a: Int): IO { - { - count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - -- Missing "}" - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A block has the form { ; ... ; } *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + pow: Int <- 1; + count: Int <- 0; + + testing6(a: Int): IO { + { + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + -- Missing "}" + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/block3_error.txt b/tests/parser/block3_error.txt index d0d806087..35dc5f31a 100644 --- a/tests/parser/block3_error.txt +++ b/tests/parser/block3_error.txt @@ -1 +1 @@ -(57, 13) - SyntacticError: ERROR at or near "pool" +(57, 13) - SyntacticError: ERROR at or near "pool" diff --git a/tests/parser/block4.cl b/tests/parser/block4.cl index 5d9474c72..13b8a4445 100644 --- a/tests/parser/block4.cl +++ b/tests/parser/block4.cl @@ -1,88 +1,88 @@ -(* A block has the form { ; ... ; } *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - pow: Int <- 1; - count: Int <- 0; - - testing6(a: Int): IO { - { - count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - true++; -- Only expressions - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A block has the form { ; ... ; } *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + pow: Int <- 1; + count: Int <- 0; + + testing6(a: Int): IO { + { + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + true++; -- Only expressions + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/block4_error.txt b/tests/parser/block4_error.txt index 10a4ec56f..cb0f89f85 100644 --- a/tests/parser/block4_error.txt +++ b/tests/parser/block4_error.txt @@ -1 +1 @@ -(56, 26) - SyntacticError: ERROR at or near "+" +(56, 26) - SyntacticError: ERROR at or near "+" diff --git a/tests/parser/case1.cl b/tests/parser/case1.cl index 8cff248e8..54b2e4fc6 100644 --- a/tests/parser/case1.cl +++ b/tests/parser/case1.cl @@ -1,91 +1,91 @@ -(* Case expressions provide runtime type tests on objects *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + 2 of - -- Every case expression must have at least one branch - esac - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + -- Every case expression must have at least one branch + esac + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/case1_error.txt b/tests/parser/case1_error.txt index c1548c9a2..568c35796 100644 --- a/tests/parser/case1_error.txt +++ b/tests/parser/case1_error.txt @@ -1 +1 @@ -(63, 9) - SyntacticError: ERROR at or near ESAC +(63, 9) - SyntacticError: ERROR at or near ESAC diff --git a/tests/parser/case2.cl b/tests/parser/case2.cl index a50d88636..7f5208a00 100644 --- a/tests/parser/case2.cl +++ b/tests/parser/case2.cl @@ -1,93 +1,93 @@ -(* Case expressions provide runtime type tests on objects *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case "2 + 2" of - x: Int => new IO.out_string("Es un entero!") -- Missing ";" - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case "2 + 2" of + x: Int => new IO.out_string("Es un entero!") -- Missing ";" + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/case2_error.txt b/tests/parser/case2_error.txt index 424754b65..98606a6f5 100644 --- a/tests/parser/case2_error.txt +++ b/tests/parser/case2_error.txt @@ -1 +1 @@ -(63, 13) - SyntacticError: ERROR at or near "y" +(63, 13) - SyntacticError: ERROR at or near "y" diff --git a/tests/parser/case3.cl b/tests/parser/case3.cl index 7fd4b1646..ac5bf4e6a 100644 --- a/tests/parser/case3.cl +++ b/tests/parser/case3.cl @@ -1,93 +1,93 @@ -(* Case expressions provide runtime type tests on objects *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + false of - x: Int => new IO.out_string("Es un entero!"); - y: string => new IO.out_string("Es una cadena!"); -- Type identifiers starts with a uppercase letter - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + false of + x: Int => new IO.out_string("Es un entero!"); + y: string => new IO.out_string("Es una cadena!"); -- Type identifiers starts with a uppercase letter + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/case3_error.txt b/tests/parser/case3_error.txt index 4b2bf6b58..9eefecd04 100644 --- a/tests/parser/case3_error.txt +++ b/tests/parser/case3_error.txt @@ -1 +1 @@ -(63, 16) - SyntacticError: ERROR at or near "string" +(63, 16) - SyntacticError: ERROR at or near "string" diff --git a/tests/parser/case4.cl b/tests/parser/case4.cl index 0ed5436a2..eb52d872a 100644 --- a/tests/parser/case4.cl +++ b/tests/parser/case4.cl @@ -1,93 +1,93 @@ -(* Case expressions provide runtime type tests on objects *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case true of - x: Int => new IO.out_string("Es un entero!"); - y: String => new IO.out_string("Es una cadena!"); - Mazinger_Z: Bool => new IO.out_string("Es un booleano!"); -- Identifiers starts with a lowercase letter - esac - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case true of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + Mazinger_Z: Bool => new IO.out_string("Es un booleano!"); -- Identifiers starts with a lowercase letter + esac + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/case4_error.txt b/tests/parser/case4_error.txt index bc0109276..91d4504bf 100644 --- a/tests/parser/case4_error.txt +++ b/tests/parser/case4_error.txt @@ -1 +1 @@ -(64, 13) - SyntacticError: ERROR at or near "Mazinger_Z" +(64, 13) - SyntacticError: ERROR at or near "Mazinger_Z" diff --git a/tests/parser/case5.cl b/tests/parser/case5.cl index 732b8a59c..1e4c9831d 100644 --- a/tests/parser/case5.cl +++ b/tests/parser/case5.cl @@ -1,93 +1,93 @@ -(* Case expressions provide runtime type tests on objects *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case test2 of - x: Int <- new IO.out_string("Es un entero!"); -- Must be '=>' not '<-'; - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case test2 of + x: Int <- new IO.out_string("Es un entero!"); -- Must be '=>' not '<-'; + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/case5_error.txt b/tests/parser/case5_error.txt index e700df372..c8da7ab5e 100644 --- a/tests/parser/case5_error.txt +++ b/tests/parser/case5_error.txt @@ -1 +1 @@ -(62, 20) - SyntacticError: ERROR at or near ASSIGN +(62, 20) - SyntacticError: ERROR at or near ASSIGN diff --git a/tests/parser/case6.cl b/tests/parser/case6.cl index cef622001..4d1c5e1ad 100644 --- a/tests/parser/case6.cl +++ b/tests/parser/case6.cl @@ -1,93 +1,93 @@ -(* Case expressions provide runtime type tests on objects *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + 2 -- Missing "of" - x: Int => new IO.out_string("Es un entero!"); - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 -- Missing "of" + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/class1.cl b/tests/parser/class1.cl index f4815e3f4..1c0641a94 100644 --- a/tests/parser/class1.cl +++ b/tests/parser/class1.cl @@ -1,20 +1,20 @@ -(* A class is a list of features *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - testing(): Int { - 2 + 2 - }; -}; - --- Class names must begin with uppercase letters -class alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A class is a list of features *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + testing(): Int { + 2 + 2 + }; +}; + +-- Class names must begin with uppercase letters +class alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/class2.cl b/tests/parser/class2.cl index f363b032a..baf290822 100644 --- a/tests/parser/class2.cl +++ b/tests/parser/class2.cl @@ -1,20 +1,20 @@ -(* A class is a list of features *) - -CLaSS Main { - main(): Object { - (new Alpha).print() - }; -}; - -CLaSS Test { - testing(): Int { - 2 + 2 - }; -}; - --- Type names must begin with uppercase letters -CLaSS Alpha iNHeRiTS iO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A class is a list of features *) + +CLaSS Main { + main(): Object { + (new Alpha).print() + }; +}; + +CLaSS Test { + testing(): Int { + 2 + 2 + }; +}; + +-- Type names must begin with uppercase letters +CLaSS Alpha iNHeRiTS iO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/class2_error.txt b/tests/parser/class2_error.txt index fffd542ad..6242b16d9 100644 --- a/tests/parser/class2_error.txt +++ b/tests/parser/class2_error.txt @@ -1 +1 @@ -(16, 22) - SyntacticError: ERROR at or near "iO" +(16, 22) - SyntacticError: ERROR at or near "iO" diff --git a/tests/parser/class3.cl b/tests/parser/class3.cl index 0c801372a..5c89c5eb8 100644 --- a/tests/parser/class3.cl +++ b/tests/parser/class3.cl @@ -1,34 +1,34 @@ -(* A class is a list of features *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - -- Missing semicolon - testing2(a: Alpha, b: Int): Int { - 2 + 2 - } - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A class is a list of features *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + -- Missing semicolon + testing2(a: Alpha, b: Int): Int { + 2 + 2 + } + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/class3_error.txt b/tests/parser/class3_error.txt index 911bf3557..44380e3f5 100644 --- a/tests/parser/class3_error.txt +++ b/tests/parser/class3_error.txt @@ -1 +1 @@ -(25, 5) - SyntacticError: ERROR at or near "testing3" +(25, 5) - SyntacticError: ERROR at or near "testing3" diff --git a/tests/parser/class4.cl b/tests/parser/class4.cl index 5c286b5e6..cdfbc313c 100644 --- a/tests/parser/class4.cl +++ b/tests/parser/class4.cl @@ -1,36 +1,36 @@ -(* A class is a list of features *) - -CLaSS Main { - main(): Object { - (new Alpha).print() - }; -}; - -CLaSS Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - -- Only features - 2 + 2; - - testing3(): String { - "2 + 2" - }; -}; - -CLaSS Alpha iNHeRiTS IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A class is a list of features *) + +CLaSS Main { + main(): Object { + (new Alpha).print() + }; +}; + +CLaSS Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + -- Only features + 2 + 2; + + testing3(): String { + "2 + 2" + }; +}; + +CLaSS Alpha iNHeRiTS IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/class4_error.txt b/tests/parser/class4_error.txt index 426f37080..7d2241976 100644 --- a/tests/parser/class4_error.txt +++ b/tests/parser/class4_error.txt @@ -1 +1 @@ -(25, 5) - SyntacticError: ERROR at or near "2" +(25, 5) - SyntacticError: ERROR at or near "2" diff --git a/tests/parser/class5.cl b/tests/parser/class5.cl index 3f40c36eb..d6b5c5fda 100644 --- a/tests/parser/class5.cl +++ b/tests/parser/class5.cl @@ -1,34 +1,34 @@ -(* A class is a list of features *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - --- Missing '{' -class Test - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A class is a list of features *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +-- Missing '{' +class Test + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/class5_error.txt b/tests/parser/class5_error.txt index 200232e65..307928c02 100644 --- a/tests/parser/class5_error.txt +++ b/tests/parser/class5_error.txt @@ -1 +1 @@ -(11, 5) - SyntacticError: ERROR at or near "test1" +(11, 5) - SyntacticError: ERROR at or near "test1" diff --git a/tests/parser/class6.cl b/tests/parser/class6.cl index 8501d2593..af9ecbf15 100644 --- a/tests/parser/class6.cl +++ b/tests/parser/class6.cl @@ -1,34 +1,34 @@ -(* A class is a list of features *) - -CLaSS Main { - main(): Object { - (new Alpha).print() - }; -}; - --- Missing '}' -CLaSS Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -; - -CLaSS Alpha iNHeRiTS IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A class is a list of features *) + +CLaSS Main { + main(): Object { + (new Alpha).print() + }; +}; + +-- Missing '}' +CLaSS Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +; + +CLaSS Alpha iNHeRiTS IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/class6_error.txt b/tests/parser/class6_error.txt index 370c153be..a2a4d3359 100644 --- a/tests/parser/class6_error.txt +++ b/tests/parser/class6_error.txt @@ -1 +1 @@ -(28, 1) - SyntacticError: ERROR at or near ";" +(28, 1) - SyntacticError: ERROR at or near ";" diff --git a/tests/parser/conditional1.cl b/tests/parser/conditional1.cl index 16dbeae5c..f7b5c8750 100644 --- a/tests/parser/conditional1.cl +++ b/tests/parser/conditional1.cl @@ -1,69 +1,69 @@ -(* A conditional has the form if then else fi *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - if a.length() < b.length() -- Mising "then" - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - else - if a.length() = b.length() then - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - else - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fi - fi - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + if a.length() < b.length() -- Mising "then" + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + else + if a.length() = b.length() then + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + else + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fi + fi + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/conditional1_error.txt b/tests/parser/conditional1_error.txt index ce446194c..8f9691f82 100644 --- a/tests/parser/conditional1_error.txt +++ b/tests/parser/conditional1_error.txt @@ -1 +1 @@ -(34, 13) - SyntacticError: ERROR at or near NEW +(34, 13) - SyntacticError: ERROR at or near NEW diff --git a/tests/parser/conditional2.cl b/tests/parser/conditional2.cl index 66869f35f..257b28084 100644 --- a/tests/parser/conditional2.cl +++ b/tests/parser/conditional2.cl @@ -1,69 +1,69 @@ -(* A conditional has the form if then else fi *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - if a.length() < b.length() then - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - else - if a.length() = b.length() then - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - else - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - -- Missing "fi" - fi - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + if a.length() < b.length() then + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + else + if a.length() = b.length() then + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + else + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + -- Missing "fi" + fi + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/conditional3.cl b/tests/parser/conditional3.cl index 2c333127b..965d7be11 100644 --- a/tests/parser/conditional3.cl +++ b/tests/parser/conditional3.cl @@ -1,69 +1,69 @@ -(* A conditional has the form if then else fi *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - iF a.length() < b.length() tHen - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - elsE - if a.length() = b.length() then - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - eLseif -- elseif isn't a keyword - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + iF a.length() < b.length() tHen + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + elsE + if a.length() = b.length() then + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + eLseif -- elseif isn't a keyword + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/conditional3_error.txt b/tests/parser/conditional3_error.txt index 36d815052..53794e443 100644 --- a/tests/parser/conditional3_error.txt +++ b/tests/parser/conditional3_error.txt @@ -1 +1 @@ -(38, 13) - SyntacticError: ERROR at or near "eLseif" +(38, 13) - SyntacticError: ERROR at or near "eLseif" diff --git a/tests/parser/conditional4.cl b/tests/parser/conditional4.cl index 7298e3a26..187ff2e87 100644 --- a/tests/parser/conditional4.cl +++ b/tests/parser/conditional4.cl @@ -1,73 +1,73 @@ -(* A conditional has the form if then else fi *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(): Int { - if true++ then 1 else 0 -- Condition must be an expression - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(): Int { + if true++ then 1 else 0 -- Condition must be an expression + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/conditional4_error.txt b/tests/parser/conditional4_error.txt index 0ceb3cab7..3c6702ed2 100644 --- a/tests/parser/conditional4_error.txt +++ b/tests/parser/conditional4_error.txt @@ -1 +1 @@ -(45, 17) - SyntacticError: ERROR at or near "+" +(45, 17) - SyntacticError: ERROR at or near "+" diff --git a/tests/parser/conditional5.cl b/tests/parser/conditional5.cl index 492dc7d78..c0d107049 100644 --- a/tests/parser/conditional5.cl +++ b/tests/parser/conditional5.cl @@ -1,73 +1,73 @@ -(* A conditional has the form if then else fi *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(): Int { - if true then true++ else 0 -- If branch must be an expression - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(): Int { + if true then true++ else 0 -- If branch must be an expression + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/conditional5_error.txt b/tests/parser/conditional5_error.txt index ad6037bd6..81c60bdf7 100644 --- a/tests/parser/conditional5_error.txt +++ b/tests/parser/conditional5_error.txt @@ -1 +1 @@ -(45, 27) - SyntacticError: ERROR at or near "+" +(45, 27) - SyntacticError: ERROR at or near "+" diff --git a/tests/parser/conditional6.cl b/tests/parser/conditional6.cl index fef8293f7..967716fd0 100644 --- a/tests/parser/conditional6.cl +++ b/tests/parser/conditional6.cl @@ -1,73 +1,73 @@ -(* A conditional has the form if then else fi *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(): Int { - if true then 1 else false++ -- Else branch must be an expression - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(): Int { + if true then 1 else false++ -- Else branch must be an expression + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/conditional6_error.txt b/tests/parser/conditional6_error.txt index 57a867ae7..62c050d02 100644 --- a/tests/parser/conditional6_error.txt +++ b/tests/parser/conditional6_error.txt @@ -1 +1 @@ -(45, 35) - SyntacticError: ERROR at or near "+" +(45, 35) - SyntacticError: ERROR at or near "+" diff --git a/tests/parser/dispatch1.cl b/tests/parser/dispatch1.cl index 3c4972870..332e89f16 100644 --- a/tests/parser/dispatch1.cl +++ b/tests/parser/dispatch1.cl @@ -1,45 +1,45 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - Test1.testing4(1, 2).testing4(3, 4).testing4(5, 6) -- Objet identifiers begin with a lower case letter - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + Test1.testing4(1, 2).testing4(3, 4).testing4(5, 6) -- Objet identifiers begin with a lower case letter + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/dispatch2.cl b/tests/parser/dispatch2.cl index 1b163d549..9e096c4e4 100644 --- a/tests/parser/dispatch2.cl +++ b/tests/parser/dispatch2.cl @@ -1,45 +1,45 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13,) -- Extra comma - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13,) -- Extra comma + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/dispatch2_error.txt b/tests/parser/dispatch2_error.txt index 152bdd1f2..9d2f85ed2 100644 --- a/tests/parser/dispatch2_error.txt +++ b/tests/parser/dispatch2_error.txt @@ -1 +1 @@ -(37, 84) - SyntacticError: ERROR at or near ")" +(37, 84) - SyntacticError: ERROR at or near ")" diff --git a/tests/parser/dispatch3.cl b/tests/parser/dispatch3.cl index 9f1a5afff..0d88f5c23 100644 --- a/tests/parser/dispatch3.cl +++ b/tests/parser/dispatch3.cl @@ -1,45 +1,45 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).Testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) -- Identifiers begin with a lower case letter - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).Testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) -- Identifiers begin with a lower case letter + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; }; \ No newline at end of file diff --git a/tests/parser/dispatch4.cl b/tests/parser/dispatch4.cl index e4851dbe7..92def488d 100644 --- a/tests/parser/dispatch4.cl +++ b/tests/parser/dispatch4.cl @@ -1,53 +1,53 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - self.testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true++) -- Arguments must be expressions - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + self.testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true++) -- Arguments must be expressions + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/dispatch4_error.txt b/tests/parser/dispatch4_error.txt index 7a114cf60..22f0cce1d 100644 --- a/tests/parser/dispatch4_error.txt +++ b/tests/parser/dispatch4_error.txt @@ -1 +1 @@ -(45, 81) - SyntacticError: ERROR at or near "+" +(45, 81) - SyntacticError: ERROR at or near "+" diff --git a/tests/parser/dispatch5.cl b/tests/parser/dispatch5.cl index 75ff16d2b..7d57f8f92 100644 --- a/tests/parser/dispatch5.cl +++ b/tests/parser/dispatch5.cl @@ -1,53 +1,53 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, ,true + fALSE) -- Extra comma - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, ,true + fALSE) -- Extra comma + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/dispatch6.cl b/tests/parser/dispatch6.cl index c3fea10a4..4a4737d8a 100644 --- a/tests/parser/dispatch6.cl +++ b/tests/parser/dispatch6.cl @@ -1,57 +1,57 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@object.copy() -- Type identifiers begin with a upper case letter - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@object.copy() -- Type identifiers begin with a upper case letter + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/dispatch6_error.txt b/tests/parser/dispatch6_error.txt index 0d6f9d6b4..7e7022c1a 100644 --- a/tests/parser/dispatch6_error.txt +++ b/tests/parser/dispatch6_error.txt @@ -1 +1 @@ -(49, 15) - SyntacticError: ERROR at or near "object" +(49, 15) - SyntacticError: ERROR at or near "object" diff --git a/tests/parser/dispatch7.cl b/tests/parser/dispatch7.cl index b9c2395f6..21de69850 100644 --- a/tests/parser/dispatch7.cl +++ b/tests/parser/dispatch7.cl @@ -1,57 +1,57 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.Copy() -- Identifiers begin with a lower case letter - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.Copy() -- Identifiers begin with a lower case letter + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/dispatch7_error.txt b/tests/parser/dispatch7_error.txt index d99ff26eb..3740868cc 100644 --- a/tests/parser/dispatch7_error.txt +++ b/tests/parser/dispatch7_error.txt @@ -1 +1 @@ -(49, 22) - SyntacticError: ERROR at or near "Copy" +(49, 22) - SyntacticError: ERROR at or near "Copy" diff --git a/tests/parser/dispatch8.cl b/tests/parser/dispatch8.cl index 36a752401..ce525176c 100644 --- a/tests/parser/dispatch8.cl +++ b/tests/parser/dispatch8.cl @@ -1,57 +1,57 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy(,) -- Extra comma - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy(,) -- Extra comma + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/dispatch9.cl b/tests/parser/dispatch9.cl index 828e70cb2..9f9e03b72 100644 --- a/tests/parser/dispatch9.cl +++ b/tests/parser/dispatch9.cl @@ -1,61 +1,61 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; - - testing5(): Object { - test1:Object.copy() -- Must be '@' not ':' - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; + + testing5(): Object { + test1:Object.copy() -- Must be '@' not ':' + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/let1.cl b/tests/parser/let1.cl index 23e60a106..a15d703da 100644 --- a/tests/parser/let1.cl +++ b/tests/parser/let1.cl @@ -1,85 +1,85 @@ -(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let Count: Int <- 0, pow: Int <- 1 -- Object identifiers starts with a lowercase letter - in { - -- count <- 0; - -- pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let Count: Int <- 0, pow: Int <- 1 -- Object identifiers starts with a lowercase letter + in { + -- count <- 0; + -- pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/let2.cl b/tests/parser/let2.cl index 983f16ed0..3c60fd726 100644 --- a/tests/parser/let2.cl +++ b/tests/parser/let2.cl @@ -1,85 +1,85 @@ -(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int, pow: int <- 1 -- Type identifiers starts with a uppercase letter - in { - count <- 0; - -- pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int, pow: int <- 1 -- Type identifiers starts with a uppercase letter + in { + count <- 0; + -- pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/let2_error.txt b/tests/parser/let2_error.txt index abb561870..d673ef17e 100644 --- a/tests/parser/let2_error.txt +++ b/tests/parser/let2_error.txt @@ -1 +1 @@ -(45, 30) - SyntacticError: ERROR at or near "int" +(45, 30) - SyntacticError: ERROR at or near "int" diff --git a/tests/parser/let3.cl b/tests/parser/let3.cl index 498dbd349..9d788f15e 100644 --- a/tests/parser/let3.cl +++ b/tests/parser/let3.cl @@ -1,85 +1,85 @@ -(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int, pow: Int, -- Extra comma - in { - count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int, pow: Int, -- Extra comma + in { + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/let3_error.txt b/tests/parser/let3_error.txt index 9b0187276..e89206ca9 100644 --- a/tests/parser/let3_error.txt +++ b/tests/parser/let3_error.txt @@ -1 +1 @@ -(46, 9) - SyntacticError: ERROR at or near IN +(46, 9) - SyntacticError: ERROR at or near IN diff --git a/tests/parser/let4.cl b/tests/parser/let4.cl index 0a39d0acf..d87fe60f5 100644 --- a/tests/parser/let4.cl +++ b/tests/parser/let4.cl @@ -1,85 +1,85 @@ -(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- true++, pow: Int <- 1 -- Initialization must be an expression - in { - count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- true++, pow: Int <- 1 -- Initialization must be an expression + in { + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/let4_error.txt b/tests/parser/let4_error.txt index 84456d766..3eed8a78c 100644 --- a/tests/parser/let4_error.txt +++ b/tests/parser/let4_error.txt @@ -1 +1 @@ -(45, 32) - SyntacticError: ERROR at or near "+" +(45, 32) - SyntacticError: ERROR at or near "+" diff --git a/tests/parser/let5.cl b/tests/parser/let5.cl index 5adbda4d4..c9b4277b3 100644 --- a/tests/parser/let5.cl +++ b/tests/parser/let5.cl @@ -1,85 +1,85 @@ -(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int = 0, pow: Int -- Must be '<-' not '=' - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int = 0, pow: Int -- Must be '<-' not '=' + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/let6.cl b/tests/parser/let6.cl index dd8e73c90..451b91acb 100644 --- a/tests/parser/let6.cl +++ b/tests/parser/let6.cl @@ -1,74 +1,74 @@ -(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int <- 1 - in false++ -- Let body must be an expression - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int <- 1 + in false++ -- Let body must be an expression + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/let6_error.txt b/tests/parser/let6_error.txt index e3fec20a4..e2c241cb7 100644 --- a/tests/parser/let6_error.txt +++ b/tests/parser/let6_error.txt @@ -1 +1 @@ -(46, 18) - SyntacticError: ERROR at or near "+" +(46, 18) - SyntacticError: ERROR at or near "+" diff --git a/tests/parser/let7.cl b/tests/parser/let7.cl index 694bce875..8a0e4a747 100644 --- a/tests/parser/let7.cl +++ b/tests/parser/let7.cl @@ -1,85 +1,85 @@ -(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - (* Missing "in" *) { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + (* Missing "in" *) { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/let7_error.txt b/tests/parser/let7_error.txt index 17ab7cd32..0c426beeb 100644 --- a/tests/parser/let7_error.txt +++ b/tests/parser/let7_error.txt @@ -1 +1 @@ -(46, 28) - SyntacticError: ERROR at or near "{" +(46, 28) - SyntacticError: ERROR at or near "{" diff --git a/tests/parser/loop1.cl b/tests/parser/loop1.cl index a356f2a62..e83a39675 100644 --- a/tests/parser/loop1.cl +++ b/tests/parser/loop1.cl @@ -1,78 +1,78 @@ -(* A loop has the form while loop pool *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - count: Int <- 1; - - testing6(): Object { - while count < 1024*1024 - -- Missing "loop" - count <- count * 2 - pool - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A loop has the form while loop pool *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + count: Int <- 1; + + testing6(): Object { + while count < 1024*1024 + -- Missing "loop" + count <- count * 2 + pool + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/loop2.cl b/tests/parser/loop2.cl index a5c4742a4..f2c2b7007 100644 --- a/tests/parser/loop2.cl +++ b/tests/parser/loop2.cl @@ -1,78 +1,78 @@ -(* A loop has the form while loop pool *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - count: Int <- 1; - - testing6(): Object { - while count < 1024*1024 - loop - count <- count * 2 - -- Missing "pool" - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A loop has the form while loop pool *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + count: Int <- 1; + + testing6(): Object { + while count < 1024*1024 + loop + count <- count * 2 + -- Missing "pool" + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/loop3.cl b/tests/parser/loop3.cl index bfd4d90d5..36181b636 100644 --- a/tests/parser/loop3.cl +++ b/tests/parser/loop3.cl @@ -1,78 +1,78 @@ -(* A loop has the form while loop pool *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - count: Int <- 1; - - testing6(): Object { - while count => 1024*1024 -- Condition must be an expression - loop - count <- count * 2 - pool - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A loop has the form while loop pool *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + count: Int <- 1; + + testing6(): Object { + while count => 1024*1024 -- Condition must be an expression + loop + count <- count * 2 + pool + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/loop3_error.txt b/tests/parser/loop3_error.txt index 750ff4822..bace8617b 100644 --- a/tests/parser/loop3_error.txt +++ b/tests/parser/loop3_error.txt @@ -1 +1 @@ -(47, 21) - SyntacticError: ERROR at or near DARROW +(47, 21) - SyntacticError: ERROR at or near DARROW diff --git a/tests/parser/loop4.cl b/tests/parser/loop4.cl index fceda5b70..5c71f923e 100644 --- a/tests/parser/loop4.cl +++ b/tests/parser/loop4.cl @@ -1,78 +1,78 @@ -(* A loop has the form while loop pool *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - count: Int <- 1; - - testing6(): Object { - while count < 1024*1024 - loop - count <- true++ -- While body must be an expression - pool - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A loop has the form while loop pool *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + count: Int <- 1; + + testing6(): Object { + while count < 1024*1024 + loop + count <- true++ -- While body must be an expression + pool + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/loop4_error.txt b/tests/parser/loop4_error.txt index eb5ca28b4..e0eadab3a 100644 --- a/tests/parser/loop4_error.txt +++ b/tests/parser/loop4_error.txt @@ -1 +1 @@ -(49, 27) - SyntacticError: ERROR at or near "+" +(49, 27) - SyntacticError: ERROR at or near "+" diff --git a/tests/parser/method1.cl b/tests/parser/method1.cl index a5a63dae6..d9f8532be 100644 --- a/tests/parser/method1.cl +++ b/tests/parser/method1.cl @@ -1,34 +1,34 @@ -(* A method of class A is a procedure that may manipulate the variables and objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - -- Method names must begin with lowercase letters - Testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + -- Method names must begin with lowercase letters + Testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/method1_error.txt b/tests/parser/method1_error.txt index 06d6e5cb5..d24075c33 100644 --- a/tests/parser/method1_error.txt +++ b/tests/parser/method1_error.txt @@ -1 +1 @@ -(21, 5) - SyntacticError: ERROR at or near "Testing2" +(21, 5) - SyntacticError: ERROR at or near "Testing2" diff --git a/tests/parser/method2.cl b/tests/parser/method2.cl index 1b8e260b2..9729ba749 100644 --- a/tests/parser/method2.cl +++ b/tests/parser/method2.cl @@ -1,34 +1,34 @@ -(* A method of class A is a procedure that may manipulate the variables and objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - -- Parameter names must begin with lowercase letters - testing2(a: Alpha, B: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + -- Parameter names must begin with lowercase letters + testing2(a: Alpha, B: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/method2_error.txt b/tests/parser/method2_error.txt index 256fb6f80..4d9d6b672 100644 --- a/tests/parser/method2_error.txt +++ b/tests/parser/method2_error.txt @@ -1 +1 @@ -(21, 24) - SyntacticError: ERROR at or near "B" +(21, 24) - SyntacticError: ERROR at or near "B" diff --git a/tests/parser/method3.cl b/tests/parser/method3.cl index 65e169c84..67d083c73 100644 --- a/tests/parser/method3.cl +++ b/tests/parser/method3.cl @@ -1,34 +1,34 @@ -(* A method of class A is a procedure that may manipulate the variables and objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - -- Type names must begin with uppercase letters - testing2(a: Alpha, b: int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + -- Type names must begin with uppercase letters + testing2(a: Alpha, b: int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/method3_error.txt b/tests/parser/method3_error.txt index 2fb93869e..6fb5d2f09 100644 --- a/tests/parser/method3_error.txt +++ b/tests/parser/method3_error.txt @@ -1 +1 @@ -(21, 27) - SyntacticError: ERROR at or near "int" +(21, 27) - SyntacticError: ERROR at or near "int" diff --git a/tests/parser/method4.cl b/tests/parser/method4.cl index 57c72f6bb..6c0a02bc5 100644 --- a/tests/parser/method4.cl +++ b/tests/parser/method4.cl @@ -1,34 +1,34 @@ -(* A method of class A is a procedure that may manipulate the variables and objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - -- Missing paremeter - testing3(x: Int,): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + -- Missing paremeter + testing3(x: Int,): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/method4_error.txt b/tests/parser/method4_error.txt index fdfda1479..13315a2b5 100644 --- a/tests/parser/method4_error.txt +++ b/tests/parser/method4_error.txt @@ -1 +1 @@ -(25, 21) - SyntacticError: ERROR at or near ")" +(25, 21) - SyntacticError: ERROR at or near ")" diff --git a/tests/parser/method5.cl b/tests/parser/method5.cl index c959bc2a5..f5e2c2a86 100644 --- a/tests/parser/method5.cl +++ b/tests/parser/method5.cl @@ -1,34 +1,34 @@ -(* A method of class A is a procedure that may manipulate the variables and objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - -- Type names must begin with uppercase letters - testing3(): string { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + -- Type names must begin with uppercase letters + testing3(): string { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/method5_error.txt b/tests/parser/method5_error.txt index ac11549ae..9bd898c48 100644 --- a/tests/parser/method5_error.txt +++ b/tests/parser/method5_error.txt @@ -1 +1 @@ -(25, 17) - SyntacticError: ERROR at or near "string" +(25, 17) - SyntacticError: ERROR at or near "string" diff --git a/tests/parser/method6.cl b/tests/parser/method6.cl index eb4817796..fc5389082 100644 --- a/tests/parser/method6.cl +++ b/tests/parser/method6.cl @@ -1,33 +1,33 @@ -(* A method of class A is a procedure that may manipulate the variables and objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - -- Body can't be empty - testing2(a: Alpha, b: Int): Int { - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + -- Body can't be empty + testing2(a: Alpha, b: Int): Int { + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/method6_error.txt b/tests/parser/method6_error.txt index 87b98a71f..ef6413b71 100644 --- a/tests/parser/method6_error.txt +++ b/tests/parser/method6_error.txt @@ -1 +1 @@ -(22, 5) - SyntacticError: ERROR at or near "}" +(22, 5) - SyntacticError: ERROR at or near "}" diff --git a/tests/parser/mixed1.cl b/tests/parser/mixed1.cl index a27879513..b13e679da 100644 --- a/tests/parser/mixed1.cl +++ b/tests/parser/mixed1.cl @@ -1,100 +1,100 @@ -(* Cool has four binary arithmetic operations: +, -, *, /. *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + 2 of - x: Int => new IO.out_string("Es un entero!"); - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; - - a: Int <- 1; - - testing8(x: Int, y: Int): Bool { - let z: Int <- 3, w: Int <- 4 - in isvoid (3 + a * (x / w + new Int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) - }; -}-- Mising ";" - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; +(* Cool has four binary arithmetic operations: +, -, *, /. *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; + + a: Int <- 1; + + testing8(x: Int, y: Int): Bool { + let z: Int <- 3, w: Int <- 4 + in isvoid (3 + a * (x / w + new Int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) + }; +}-- Mising ";" + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; }; \ No newline at end of file diff --git a/tests/parser/mixed2.cl b/tests/parser/mixed2.cl index f5477e0bb..6776fcc12 100644 --- a/tests/parser/mixed2.cl +++ b/tests/parser/mixed2.cl @@ -1,14 +1,14 @@ -class Main { - main(): Object { - (new Alpha).print() - }; - -}; - -(* Class names must begin with uppercase letters *) -class alpha inherits IO { - print() : Object { - out_string("reached!!\n"); - }; -}; - +class Main { + main(): Object { + (new Alpha).print() + }; + +}; + +(* Class names must begin with uppercase letters *) +class alpha inherits IO { + print() : Object { + out_string("reached!!\n"); + }; +}; + diff --git a/tests/parser/mixed2_error.txt b/tests/parser/mixed2_error.txt index 4e1088ee1..9ee440d98 100644 --- a/tests/parser/mixed2_error.txt +++ b/tests/parser/mixed2_error.txt @@ -1 +1 @@ -(9, 7) - SyntacticError: ERROR at or near "alpha" +(9, 7) - SyntacticError: ERROR at or near "alpha" diff --git a/tests/parser/mixed3.cl b/tests/parser/mixed3.cl index 1bdcad743..f5271eb3e 100644 --- a/tests/parser/mixed3.cl +++ b/tests/parser/mixed3.cl @@ -1,40 +1,40 @@ -class Main inherits IO { - main() : Object { - { - out_string("Enter a number to check if number is prime\n"); - let i : Int <- in_int() in { - if(i <= 1) then { - out_string("Invalid Input\n"); - abort(); - } else { - if (isPrime(i) = 1) then - out_string("Number is prime\n") - else - out_string("Number is composite\n") - fi; - } - fi; - }; - } - }; - - mod(i : Int, ) : Int { -- Formal list must be comma separated. A comma does not terminate a list of formals. - i - (i/k)*k - }; - - isPrime(i : Int) : Int { - { - let x : Int <- 2, - c : Int <- 1 in - { - while (not (x = i)) loop - if (mod(i, x) = 0) then { - c <- 0; - x <- i; - } else x <- x + 1 fi - pool; - c; - }; - } - }; -}; +class Main inherits IO { + main() : Object { + { + out_string("Enter a number to check if number is prime\n"); + let i : Int <- in_int() in { + if(i <= 1) then { + out_string("Invalid Input\n"); + abort(); + } else { + if (isPrime(i) = 1) then + out_string("Number is prime\n") + else + out_string("Number is composite\n") + fi; + } + fi; + }; + } + }; + + mod(i : Int, ) : Int { -- Formal list must be comma separated. A comma does not terminate a list of formals. + i - (i/k)*k + }; + + isPrime(i : Int) : Int { + { + let x : Int <- 2, + c : Int <- 1 in + { + while (not (x = i)) loop + if (mod(i, x) = 0) then { + c <- 0; + x <- i; + } else x <- x + 1 fi + pool; + c; + }; + } + }; +}; diff --git a/tests/parser/mixed3_error.txt b/tests/parser/mixed3_error.txt index 05d59a4b7..46af269e0 100644 --- a/tests/parser/mixed3_error.txt +++ b/tests/parser/mixed3_error.txt @@ -1 +1 @@ -(21, 18) - SyntacticError: ERROR at or near ")" +(21, 18) - SyntacticError: ERROR at or near ")" diff --git a/tests/parser/mixed4.cl b/tests/parser/mixed4.cl index e752253be..47e6ea5e9 100644 --- a/tests/parser/mixed4.cl +++ b/tests/parser/mixed4.cl @@ -1,21 +1,21 @@ -class Main inherits IO { - main() : Object { - { - out_string("Enter number of numbers to multiply\n"); - out_int(prod(in_int())); - out_string("\n"); - } - }; - - prod(i : Int) : Int { - let y : Int <- 1 in { - while (not (i = 0) ) loop { - out_string("Enter Number: "); - y <- y * in_int(Main : Int); -- the parser correctly catches the error here - i <- i - 1; - } - pool; - y; - } - }; -}; +class Main inherits IO { + main() : Object { + { + out_string("Enter number of numbers to multiply\n"); + out_int(prod(in_int())); + out_string("\n"); + } + }; + + prod(i : Int) : Int { + let y : Int <- 1 in { + while (not (i = 0) ) loop { + out_string("Enter Number: "); + y <- y * in_int(Main : Int); -- the parser correctly catches the error here + i <- i - 1; + } + pool; + y; + } + }; +}; diff --git a/tests/parser/mixed5.cl b/tests/parser/mixed5.cl index c9176a890..d4ca68f44 100644 --- a/tests/parser/mixed5.cl +++ b/tests/parser/mixed5.cl @@ -1,20 +1,20 @@ -class Main inherits IO { - str <- "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; - main() : Object { - { - out_string("Enter number of numbers to multiply\n"); - out_int(prod(in_int())); - out_string("\n"); - } - }; - prod(i : Int) : Int { - let y : Int <- 1 in { - while (not (i = 0) ) loop { - out_string("Enter Number: "); - y <- y * in_int(); - i <- i - 1; - } - y; - } - }; -} +class Main inherits IO { + str <- "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; + main() : Object { + { + out_string("Enter number of numbers to multiply\n"); + out_int(prod(in_int())); + out_string("\n"); + } + }; + prod(i : Int) : Int { + let y : Int <- 1 in { + while (not (i = 0) ) loop { + out_string("Enter Number: "); + y <- y * in_int(); + i <- i - 1; + } + y; + } + }; +} diff --git a/tests/parser/mixed5_error.txt b/tests/parser/mixed5_error.txt index 60390218f..110601e2b 100644 --- a/tests/parser/mixed5_error.txt +++ b/tests/parser/mixed5_error.txt @@ -1 +1 @@ -(2, 9) - SyntacticError: ERROR at or near ASSIGN +(2, 9) - SyntacticError: ERROR at or near ASSIGN diff --git a/tests/parser/mixed6.cl b/tests/parser/mixed6.cl index 5da80da31..0a51656c9 100644 --- a/tests/parser/mixed6.cl +++ b/tests/parser/mixed6.cl @@ -1,5 +1,5 @@ -classs Doom { - i : Int <- 0; - main() : Object { - if i = 0 then out_string("This is da real *h*t") - +classs Doom { + i : Int <- 0; + main() : Object { + if i = 0 then out_string("This is da real *h*t") + diff --git a/tests/parser/operation1.cl b/tests/parser/operation1.cl index 5bd90a737..cb9d5f706 100644 --- a/tests/parser/operation1.cl +++ b/tests/parser/operation1.cl @@ -1,101 +1,101 @@ -(* Cool has four binary arithmetic operations: +, -, *, /. *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + 2 of - x: Int => new IO.out_string("Es un entero!"); - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; - - a: Int <- 1; - - testing8(x: Int, y: Int): Bool { - let z: Int <- 3, w: Int <- 4 - -- Missing ')' - in isvoid (3 + a * (x / w + new Int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a)/(0)*(((4 * 4))))) - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* Cool has four binary arithmetic operations: +, -, *, /. *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; + + a: Int <- 1; + + testing8(x: Int, y: Int): Bool { + let z: Int <- 3, w: Int <- 4 + -- Missing ')' + in isvoid (3 + a * (x / w + new Int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a)/(0)*(((4 * 4))))) + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/operation1_error.txt b/tests/parser/operation1_error.txt index 0bf86401b..db4601844 100644 --- a/tests/parser/operation1_error.txt +++ b/tests/parser/operation1_error.txt @@ -1 +1 @@ -(74, 5) - SyntacticError: ERROR at or near "}" +(74, 5) - SyntacticError: ERROR at or near "}" diff --git a/tests/parser/operation2.cl b/tests/parser/operation2.cl index d18f7a040..0ee832b53 100644 --- a/tests/parser/operation2.cl +++ b/tests/parser/operation2.cl @@ -1,101 +1,101 @@ -(* Cool has four binary arithmetic operations: +, -, *, /. *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + 2 of - x: Int => new IO.out_string("Es un entero!"); - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; - - a: Int <- 1; - - testing8(x: Int, y: Int): Bool { - let z: Int <- 3, w: Int <- 4 - -- Type identifiers starts with a uppercase letter - in isvoid (3 + a * (x / w + new int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* Cool has four binary arithmetic operations: +, -, *, /. *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; + + a: Int <- 1; + + testing8(x: Int, y: Int): Bool { + let z: Int <- 3, w: Int <- 4 + -- Type identifiers starts with a uppercase letter + in isvoid (3 + a * (x / w + new int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/operation2_error.txt b/tests/parser/operation2_error.txt index c5e445cc7..4d016a25b 100644 --- a/tests/parser/operation2_error.txt +++ b/tests/parser/operation2_error.txt @@ -1 +1 @@ -(73, 41) - SyntacticError: ERROR at or near "int" +(73, 41) - SyntacticError: ERROR at or near "int" diff --git a/tests/parser/operation3.cl b/tests/parser/operation3.cl index e18398014..f12aa5684 100644 --- a/tests/parser/operation3.cl +++ b/tests/parser/operation3.cl @@ -1,101 +1,101 @@ -(* Cool has four binary arithmetic operations: +, -, *, /. *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + 2 of - x: Int => new IO.out_string("Es un entero!"); - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; - - a: Int <- 1; - - testing8(x: Int, y: Int): Bool { - let z: Int <- 3, w: Int <- 4 - -- Object identifiers starts with a lowercase letter - in isvoid (3 + a * (x / w + new Int) - y - (((if tRue = not faLSe then ~Mazinger_Z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* Cool has four binary arithmetic operations: +, -, *, /. *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; + + a: Int <- 1; + + testing8(x: Int, y: Int): Bool { + let z: Int <- 3, w: Int <- 4 + -- Object identifiers starts with a lowercase letter + in isvoid (3 + a * (x / w + new Int) - y - (((if tRue = not faLSe then ~Mazinger_Z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/operation3_error.txt b/tests/parser/operation3_error.txt index 40fd40d15..8ac17fd80 100644 --- a/tests/parser/operation3_error.txt +++ b/tests/parser/operation3_error.txt @@ -1 +1 @@ -(73, 81) - SyntacticError: ERROR at or near "Mazinger_Z" +(73, 81) - SyntacticError: ERROR at or near "Mazinger_Z" diff --git a/tests/parser/operation4.cl b/tests/parser/operation4.cl index 5ce08248c..2f203e879 100644 --- a/tests/parser/operation4.cl +++ b/tests/parser/operation4.cl @@ -1,101 +1,101 @@ -(* Cool has four binary arithmetic operations: +, -, *, /. *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + 2 of - x: Int => new IO.out_string("Es un entero!"); - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; - - a: Int <- 1; - - testing8(x: Int, y: Int): Bool { - let z: Int <- 3, w: Int <- 4 - -- Double "+" - in isvoid (3 + a * (x / w++ new Int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* Cool has four binary arithmetic operations: +, -, *, /. *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; + + a: Int <- 1; + + testing8(x: Int, y: Int): Bool { + let z: Int <- 3, w: Int <- 4 + -- Double "+" + in isvoid (3 + a * (x / w++ new Int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/operation4_error.txt b/tests/parser/operation4_error.txt index 5bf87721f..a2c723e51 100644 --- a/tests/parser/operation4_error.txt +++ b/tests/parser/operation4_error.txt @@ -1 +1 @@ -(73, 35) - SyntacticError: ERROR at or near "+" +(73, 35) - SyntacticError: ERROR at or near "+" diff --git a/tests/parser/program1_error.txt b/tests/parser/program1_error.txt index fceafee78..100048787 100644 --- a/tests/parser/program1_error.txt +++ b/tests/parser/program1_error.txt @@ -1 +1 @@ -(0, 0) - SyntacticError: ERROR at or near EOF +(0, 0) - SyntacticError: ERROR at or near EOF diff --git a/tests/parser/program2.cl b/tests/parser/program2.cl index f8b16779c..a281c6c14 100644 --- a/tests/parser/program2.cl +++ b/tests/parser/program2.cl @@ -1,20 +1,20 @@ -(* Cool programs are sets of classes *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - --- Missing semicolon -class Test { - testing(): Int { - 2 + 2 - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* Cool programs are sets of classes *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +-- Missing semicolon +class Test { + testing(): Int { + 2 + 2 + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/program3.cl b/tests/parser/program3.cl index e27889c57..10d2dc71e 100644 --- a/tests/parser/program3.cl +++ b/tests/parser/program3.cl @@ -1,24 +1,24 @@ -(* Cool programs are sets of classes *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - testing(): Int { - 2 + 2 - }; -}; - --- Only classes -suma(a: Int, b: Int) int { - a + b -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* Cool programs are sets of classes *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + testing(): Int { + 2 + 2 + }; +}; + +-- Only classes +suma(a: Int, b: Int) int { + a + b +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser_test.py b/tests/parser_test.py index 129c0f20a..166de45de 100644 --- a/tests/parser_test.py +++ b/tests/parser_test.py @@ -1,13 +1,13 @@ -import pytest -import os -from utils import compare_errors - -tests_dir = __file__.rpartition('/')[0] + '/parser/' -tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] - -@pytest.mark.parser -@pytest.mark.error -@pytest.mark.run(order=2) -@pytest.mark.parametrize("cool_file", tests) -def test_parser_errors(compiler_path, cool_file): +import pytest +import os +from utils import compare_errors + +tests_dir = __file__.rpartition('/')[0] + '/parser/' +tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] + +@pytest.mark.parser +@pytest.mark.error +@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 diff --git a/tests/semantic/01_program.cl b/tests/semantic/01_program.cl index abb344e34..75aaf27d0 100644 --- a/tests/semantic/01_program.cl +++ b/tests/semantic/01_program.cl @@ -1,16 +1,16 @@ -class Main { - a: Int - - b: String - - main () : String { - let a: Int <- "" in 0 - } - - function_with_errors() : Object { - case a of - x: Int => (new IO).out_int(x) - y: String => (new IO).out_string(x) - esac - } +class Main { + a: Int + + b: String + + main () : String { + let a: Int <- "" in 0 + } + + function_with_errors() : Object { + case a of + x: Int => (new IO).out_int(x) + y: String => (new IO).out_string(x) + esac + } } \ No newline at end of file diff --git a/tests/semantic/01_result.txt b/tests/semantic/01_result.txt index da7df9c03..f8d632677 100644 --- a/tests/semantic/01_result.txt +++ b/tests/semantic/01_result.txt @@ -1,9 +1,9 @@ -(4, 5) - SyntacticError: Expected ';' instead of 'b'. -(6, 5) - SyntacticError: Expected ';' instead of 'main'. -(10, 5) - SyntacticError: Expected ';' instead of 'function_with_errors'. -(13, 13) - SyntacticError: Expected ';' instead of 'y'. -(14, 9) - SyntacticError: Expected ';' instead of 'esac'. -(16, 1) - SyntacticError: Expected ';' instead of '}'. -TypeError: Cannot convert "String" into "Int". -TypeError: Cannot convert "Int" into "String". +(4, 5) - SyntacticError: Expected ';' instead of 'b'. +(6, 5) - SyntacticError: Expected ';' instead of 'main'. +(10, 5) - SyntacticError: Expected ';' instead of 'function_with_errors'. +(13, 13) - SyntacticError: Expected ';' instead of 'y'. +(14, 9) - SyntacticError: Expected ';' instead of 'esac'. +(16, 1) - SyntacticError: Expected ';' instead of '}'. +TypeError: Cannot convert "String" into "Int". +TypeError: Cannot convert "Int" into "String". IdentifierError: Variable "x" is not defined in "function_with_errors". \ No newline at end of file diff --git a/tests/semantic/02_program.cl b/tests/semantic/02_program.cl index 5a5a5597b..e3fb69887 100644 --- a/tests/semantic/02_program.cl +++ b/tests/semantic/02_program.cl @@ -1,7 +1,7 @@ -class Main { - -} - -class A inherits C { } -class B inherits A { } +class Main { + +} + +class A inherits C { } +class B inherits A { } class C inherits B { } \ No newline at end of file diff --git a/tests/semantic/arithmetic1.cl b/tests/semantic/arithmetic1.cl index bf94eb194..65719c064 100644 --- a/tests/semantic/arithmetic1.cl +++ b/tests/semantic/arithmetic1.cl @@ -1,11 +1,11 @@ ---The static types of the two sub-expressions must be Int. - -class A { }; -class B inherits A { }; -class C inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - test: Int <- let x: Int <- 1 * 2 / 3 - 4 + new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() - in x <- x + new A.type_name().concat(new B.type_name().concat(new C.type_name())); +--The static types of the two sub-expressions must be Int. + +class A { }; +class B inherits A { }; +class C inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + test: Int <- let x: Int <- 1 * 2 / 3 - 4 + new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() + in x <- x + new A.type_name().concat(new B.type_name().concat(new C.type_name())); }; \ No newline at end of file diff --git a/tests/semantic/arithmetic10.cl b/tests/semantic/arithmetic10.cl index bbfe6cdb3..b2488ad7f 100644 --- a/tests/semantic/arithmetic10.cl +++ b/tests/semantic/arithmetic10.cl @@ -1,15 +1,15 @@ -(* -The expression ~ is the integer -complement of . The expression must have static type Int and the entire expression -has static type Int. -*) - -class A { }; -class B inherits A { }; -class C inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - test: Bool <- let x: Bool <- 1 / 2 - 3 + 4 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() - in ~new A.type_name().concat(new B.type_name().concat(new C.type_name())).length(); +(* +The expression ~ is the integer +complement of . The expression must have static type Int and the entire expression +has static type Int. +*) + +class A { }; +class B inherits A { }; +class C inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + test: Bool <- let x: Bool <- 1 / 2 - 3 + 4 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() + in ~new A.type_name().concat(new B.type_name().concat(new C.type_name())).length(); }; \ No newline at end of file diff --git a/tests/semantic/arithmetic11.cl b/tests/semantic/arithmetic11.cl index fc067dc1a..05cec0465 100644 --- a/tests/semantic/arithmetic11.cl +++ b/tests/semantic/arithmetic11.cl @@ -1,14 +1,14 @@ -(* -The expression not is the boolean complement of . The expression - must have static type Bool and the entire expression has static type Bool. -*) - -class A { }; -class B inherits A { }; -class C inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - test: Bool <- let x: Bool <- 1 / 2 - 3 + 4 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() - in not 1 + new A.type_name().concat(new B.type_name().concat(new C.type_name())).length(); +(* +The expression not is the boolean complement of . The expression + must have static type Bool and the entire expression has static type Bool. +*) + +class A { }; +class B inherits A { }; +class C inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + test: Bool <- let x: Bool <- 1 / 2 - 3 + 4 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() + in not 1 + new A.type_name().concat(new B.type_name().concat(new C.type_name())).length(); }; \ No newline at end of file diff --git a/tests/semantic/arithmetic12.cl b/tests/semantic/arithmetic12.cl index 2e012fc41..05a2da918 100644 --- a/tests/semantic/arithmetic12.cl +++ b/tests/semantic/arithmetic12.cl @@ -1,14 +1,14 @@ -(* -The expression not is the boolean complement of . The expression - must have static type Bool and the entire expression has static type Bool. -*) - -class A { }; -class B inherits A { }; -class C inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - test: Int <- let x: Bool <- 1 / 2 - 3 + 4 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() - in not 1 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length(); +(* +The expression not is the boolean complement of . The expression + must have static type Bool and the entire expression has static type Bool. +*) + +class A { }; +class B inherits A { }; +class C inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + test: Int <- let x: Bool <- 1 / 2 - 3 + 4 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() + in not 1 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length(); }; \ No newline at end of file diff --git a/tests/semantic/arithmetic1_error.txt b/tests/semantic/arithmetic1_error.txt index a74ebf3da..59213724d 100644 --- a/tests/semantic/arithmetic1_error.txt +++ b/tests/semantic/arithmetic1_error.txt @@ -1 +1 @@ -(10, 27) - TypeError: non-Int arguments: Int + String +(10, 27) - TypeError: non-Int arguments: Int + String diff --git a/tests/semantic/arithmetic2.cl b/tests/semantic/arithmetic2.cl index 59532573d..f1f0935e2 100644 --- a/tests/semantic/arithmetic2.cl +++ b/tests/semantic/arithmetic2.cl @@ -1,11 +1,11 @@ ---The static types of the two sub-expressions must be Int. - -class A { }; -class B inherits A { }; -class C inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - test: Int <- let x: Int <- 1 + 2 * 3 / 4 - new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() - in x <- x - new A.type_name().concat(new B.type_name().concat(new C.type_name())); +--The static types of the two sub-expressions must be Int. + +class A { }; +class B inherits A { }; +class C inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + test: Int <- let x: Int <- 1 + 2 * 3 / 4 - new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() + in x <- x - new A.type_name().concat(new B.type_name().concat(new C.type_name())); }; \ No newline at end of file diff --git a/tests/semantic/arithmetic2_error.txt b/tests/semantic/arithmetic2_error.txt index 2c7952af8..aebc7aab9 100644 --- a/tests/semantic/arithmetic2_error.txt +++ b/tests/semantic/arithmetic2_error.txt @@ -1 +1 @@ -(10, 27) - TypeError: non-Int arguments: Int - String +(10, 27) - TypeError: non-Int arguments: Int - String diff --git a/tests/semantic/arithmetic3.cl b/tests/semantic/arithmetic3.cl index b208957f5..df64d8000 100644 --- a/tests/semantic/arithmetic3.cl +++ b/tests/semantic/arithmetic3.cl @@ -1,11 +1,11 @@ ---The static types of the two sub-expressions must be Int. - -class A { }; -class B inherits A { }; -class C inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - test: Int <- let x: Int <- 1 - 2 + 3 * 4 / new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() - in x <- x / new A.type_name().concat(new B.type_name().concat(new C.type_name())); +--The static types of the two sub-expressions must be Int. + +class A { }; +class B inherits A { }; +class C inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + test: Int <- let x: Int <- 1 - 2 + 3 * 4 / new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() + in x <- x / new A.type_name().concat(new B.type_name().concat(new C.type_name())); }; \ No newline at end of file diff --git a/tests/semantic/arithmetic3_error.txt b/tests/semantic/arithmetic3_error.txt index 81d88331a..d0af01bb5 100644 --- a/tests/semantic/arithmetic3_error.txt +++ b/tests/semantic/arithmetic3_error.txt @@ -1 +1 @@ -(10, 27) - TypeError: non-Int arguments: Int / String +(10, 27) - TypeError: non-Int arguments: Int / String diff --git a/tests/semantic/arithmetic4.cl b/tests/semantic/arithmetic4.cl index 2c7dd4fc9..68512ca44 100644 --- a/tests/semantic/arithmetic4.cl +++ b/tests/semantic/arithmetic4.cl @@ -1,11 +1,11 @@ ---The static types of the two sub-expressions must be Int. - -class A { }; -class B inherits A { }; -class C inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - test: Int <- let x: Int <- 1 / 2 - 3 + 4 * new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() - in x <- x * new A.type_name().concat(new B.type_name().concat(new C.type_name())); +--The static types of the two sub-expressions must be Int. + +class A { }; +class B inherits A { }; +class C inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + test: Int <- let x: Int <- 1 / 2 - 3 + 4 * new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() + in x <- x * new A.type_name().concat(new B.type_name().concat(new C.type_name())); }; \ No newline at end of file diff --git a/tests/semantic/arithmetic5.cl b/tests/semantic/arithmetic5.cl index bc08c6e82..fd77c7971 100644 --- a/tests/semantic/arithmetic5.cl +++ b/tests/semantic/arithmetic5.cl @@ -1,11 +1,11 @@ ---The static type of the expression is Int. - -class A { }; -class B inherits A { }; -class C inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - test: Bool <- let x: Int <- 1 / 2 - 3 + 4 * new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() - in x <- x * new A.type_name().concat(new B.type_name().concat(new C.type_name())).length(); +--The static type of the expression is Int. + +class A { }; +class B inherits A { }; +class C inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + test: Bool <- let x: Int <- 1 / 2 - 3 + 4 * new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() + in x <- x * new A.type_name().concat(new B.type_name().concat(new C.type_name())).length(); }; \ No newline at end of file diff --git a/tests/semantic/arithmetic5_error.txt b/tests/semantic/arithmetic5_error.txt index dd5346844..8c67c2f53 100644 --- a/tests/semantic/arithmetic5_error.txt +++ b/tests/semantic/arithmetic5_error.txt @@ -1 +1 @@ -(9, 19) - TypeError: Inferred type Int of initialization of attribute test does not conform to declared type Bool. +(9, 19) - TypeError: Inferred type Int of initialization of attribute test does not conform to declared type Bool. diff --git a/tests/semantic/arithmetic6.cl b/tests/semantic/arithmetic6.cl index a0c3d03ff..d4da66a73 100644 --- a/tests/semantic/arithmetic6.cl +++ b/tests/semantic/arithmetic6.cl @@ -1,11 +1,11 @@ - --The static types of the two sub-expressions must be Int. - -class A { }; -class B inherits A { }; -class C inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - test: Bool <- let x: Bool <- 1 / 2 - 3 + 4 <= new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() - in 1 <= new A.type_name().concat(new B.type_name().concat(new C.type_name())); -}; + --The static types of the two sub-expressions must be Int. + +class A { }; +class B inherits A { }; +class C inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + test: Bool <- let x: Bool <- 1 / 2 - 3 + 4 <= new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() + in 1 <= new A.type_name().concat(new B.type_name().concat(new C.type_name())); +}; diff --git a/tests/semantic/arithmetic6_error.txt b/tests/semantic/arithmetic6_error.txt index 2e43dfc17..a0d67cb48 100644 --- a/tests/semantic/arithmetic6_error.txt +++ b/tests/semantic/arithmetic6_error.txt @@ -1 +1 @@ -(10, 22) - TypeError: non-Int arguments: Int <= String +(10, 22) - TypeError: non-Int arguments: Int <= String diff --git a/tests/semantic/arithmetic7.cl b/tests/semantic/arithmetic7.cl index c00c75cde..b98a4b0e2 100644 --- a/tests/semantic/arithmetic7.cl +++ b/tests/semantic/arithmetic7.cl @@ -1,12 +1,12 @@ - --The static types of the two sub-expressions must be Int. - -class A { }; -class B inherits A { }; -class C inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - test: Bool <- let x: Bool <- 1 / 2 - 3 + 4 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() - in 1 < new A.type_name().concat(new B.type_name().concat(new C.type_name())); -}; - + --The static types of the two sub-expressions must be Int. + +class A { }; +class B inherits A { }; +class C inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + test: Bool <- let x: Bool <- 1 / 2 - 3 + 4 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() + in 1 < new A.type_name().concat(new B.type_name().concat(new C.type_name())); +}; + diff --git a/tests/semantic/arithmetic7_error.txt b/tests/semantic/arithmetic7_error.txt index 6f3537117..166bcc8ef 100644 --- a/tests/semantic/arithmetic7_error.txt +++ b/tests/semantic/arithmetic7_error.txt @@ -1 +1 @@ -(10, 22) - TypeError: non-Int arguments: Int < String +(10, 22) - TypeError: non-Int arguments: Int < String diff --git a/tests/semantic/arithmetic8.cl b/tests/semantic/arithmetic8.cl index 3210bdb8a..f3ad37ec4 100644 --- a/tests/semantic/arithmetic8.cl +++ b/tests/semantic/arithmetic8.cl @@ -1,13 +1,13 @@ - --The rules are exactly the same as for the binary arithmetic operations, except that the result is a Bool. - -class A { }; -class B inherits A { }; -class C inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - test: Int <- let x: Bool <- 1 / 2 - 3 + 4 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() - in 1 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length(); -}; - - + --The rules are exactly the same as for the binary arithmetic operations, except that the result is a Bool. + +class A { }; +class B inherits A { }; +class C inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + test: Int <- let x: Bool <- 1 / 2 - 3 + 4 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() + in 1 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length(); +}; + + diff --git a/tests/semantic/arithmetic8_error.txt b/tests/semantic/arithmetic8_error.txt index ebcaa3797..5a8814e1a 100644 --- a/tests/semantic/arithmetic8_error.txt +++ b/tests/semantic/arithmetic8_error.txt @@ -1 +1 @@ -(9, 18) - TypeError: Inferred type Bool of initialization of attribute test does not conform to declared type Int. +(9, 18) - TypeError: Inferred type Bool of initialization of attribute test does not conform to declared type Int. diff --git a/tests/semantic/arithmetic9.cl b/tests/semantic/arithmetic9.cl index 95579e134..b7b4d3645 100644 --- a/tests/semantic/arithmetic9.cl +++ b/tests/semantic/arithmetic9.cl @@ -1,15 +1,15 @@ -(* -The expression ~ is the integer -complement of . The expression must have static type Int and the entire expression -has static type Int. -*) - -class A { }; -class B inherits A { }; -class C inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - test: Int <- let x: Bool <- 1 / 2 - 3 + 4 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() - in 1 + ~new A.type_name().concat(new B.type_name().concat(new C.type_name())); +(* +The expression ~ is the integer +complement of . The expression must have static type Int and the entire expression +has static type Int. +*) + +class A { }; +class B inherits A { }; +class C inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + test: Int <- let x: Bool <- 1 / 2 - 3 + 4 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() + in 1 + ~new A.type_name().concat(new B.type_name().concat(new C.type_name())); }; \ No newline at end of file diff --git a/tests/semantic/assignment1.cl b/tests/semantic/assignment1.cl index 19ab70219..174f93e2b 100644 --- a/tests/semantic/assignment1.cl +++ b/tests/semantic/assignment1.cl @@ -1,7 +1,7 @@ ---The static type of the expression must conform to the declared type of the identifier - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test: Int <- "String"; -}; +--The static type of the expression must conform to the declared type of the identifier + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test: Int <- "String"; +}; diff --git a/tests/semantic/assignment1_error.txt b/tests/semantic/assignment1_error.txt index 6eb883012..9d05707aa 100644 --- a/tests/semantic/assignment1_error.txt +++ b/tests/semantic/assignment1_error.txt @@ -1 +1 @@ -(6, 18) - TypeError: Inferred type String of initialization of attribute test does not conform to declared type Int. +(6, 18) - TypeError: Inferred type String of initialization of attribute test does not conform to declared type Int. diff --git a/tests/semantic/assignment2.cl b/tests/semantic/assignment2.cl index cace221ae..c7f3d7873 100644 --- a/tests/semantic/assignment2.cl +++ b/tests/semantic/assignment2.cl @@ -1,13 +1,13 @@ ---The static type of an assignment is the static type of . - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test(a: A): B { a <- new C }; - test2(a: A): D { a <- new C }; -}; +--The static type of an assignment is the static type of . + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test(a: A): B { a <- new C }; + test2(a: A): D { a <- new C }; +}; diff --git a/tests/semantic/assignment2_error.txt b/tests/semantic/assignment2_error.txt index ed10b7f38..55f5aa214 100644 --- a/tests/semantic/assignment2_error.txt +++ b/tests/semantic/assignment2_error.txt @@ -1 +1 @@ -(12, 22) - TypeError: Inferred return type C of method test2 does not conform to declared return type D. +(12, 22) - TypeError: Inferred return type C of method test2 does not conform to declared return type D. diff --git a/tests/semantic/assignment3.cl b/tests/semantic/assignment3.cl index eba0d69e2..9d60a4b6c 100644 --- a/tests/semantic/assignment3.cl +++ b/tests/semantic/assignment3.cl @@ -1,14 +1,14 @@ ---The static type of an assignment is the static type of . - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - a: A; - b: B <- a <- new C; - d: D <- a <- new C; -}; +--The static type of an assignment is the static type of . + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + a: A; + b: B <- a <- new C; + d: D <- a <- new C; +}; diff --git a/tests/semantic/attributes1.cl b/tests/semantic/attributes1.cl index 3fa0440e4..d11ea7cdb 100644 --- a/tests/semantic/attributes1.cl +++ b/tests/semantic/attributes1.cl @@ -1,13 +1,13 @@ ---The static type of the expression must conform to the declared type of the attribute. - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; - -class Main inherits IO { - test1: IO <- new Main; - test2: B <- new A; - - main(): IO { out_string("Hello World!")}; +--The static type of the expression must conform to the declared type of the attribute. + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; + +class Main inherits IO { + test1: IO <- new Main; + test2: B <- new A; + + main(): IO { out_string("Hello World!")}; }; \ No newline at end of file diff --git a/tests/semantic/attributes1_error.txt b/tests/semantic/attributes1_error.txt index 9cb8460c9..22e45b837 100644 --- a/tests/semantic/attributes1_error.txt +++ b/tests/semantic/attributes1_error.txt @@ -1 +1 @@ -(10, 17) - TypeError: Inferred type A of initialization of attribute test2 does not conform to declared type B. +(10, 17) - TypeError: Inferred type A of initialization of attribute test2 does not conform to declared type B. diff --git a/tests/semantic/attributes2.cl b/tests/semantic/attributes2.cl index 7937c2cc8..85c791b5e 100644 --- a/tests/semantic/attributes2.cl +++ b/tests/semantic/attributes2.cl @@ -1,13 +1,13 @@ ---The static type of the expression must conform to the declared type of the attribute. - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; - -class Main inherits IO { - test1: IO <- new Main; - test2: C <- new D; - - main(): IO { out_string("Hello World!")}; +--The static type of the expression must conform to the declared type of the attribute. + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; + +class Main inherits IO { + test1: IO <- new Main; + test2: C <- new D; + + main(): IO { out_string("Hello World!")}; }; \ No newline at end of file diff --git a/tests/semantic/attributes2_error.txt b/tests/semantic/attributes2_error.txt index 6d601b7cd..d7694b0ad 100644 --- a/tests/semantic/attributes2_error.txt +++ b/tests/semantic/attributes2_error.txt @@ -1 +1 @@ -(10, 17) - TypeError: Inferred type D of initialization of attribute test2 does not conform to declared type C. +(10, 17) - TypeError: Inferred type D of initialization of attribute test2 does not conform to declared type C. diff --git a/tests/semantic/attributes3.cl b/tests/semantic/attributes3.cl index 8a67decd1..0c8294fa2 100644 --- a/tests/semantic/attributes3.cl +++ b/tests/semantic/attributes3.cl @@ -1,25 +1,25 @@ ---Attributes are local to the class in which they are defined or inherited. - -class A { - a: Int <- 5; - test(x1: Int, y1: Int): Int { - let x: Int <- x1, y: Int <-y1 in { - x <- x + a; - y <- y + a; - if b then x + y else x - y fi; - } - }; -}; -class B inherits A { - b: Bool <- true; -}; -class C inherits B { - c: String <- "C"; -}; -class D inherits B { - d: IO <- new Main.main(); -}; - -class Main inherits IO { - main(): IO { out_string("Hello World!") }; +--Attributes are local to the class in which they are defined or inherited. + +class A { + a: Int <- 5; + test(x1: Int, y1: Int): Int { + let x: Int <- x1, y: Int <-y1 in { + x <- x + a; + y <- y + a; + if b then x + y else x - y fi; + } + }; +}; +class B inherits A { + b: Bool <- true; +}; +class C inherits B { + c: String <- "C"; +}; +class D inherits B { + d: IO <- new Main.main(); +}; + +class Main inherits IO { + main(): IO { out_string("Hello World!") }; }; \ No newline at end of file diff --git a/tests/semantic/attributes3_error.txt b/tests/semantic/attributes3_error.txt index 6195c816c..68a2ba571 100644 --- a/tests/semantic/attributes3_error.txt +++ b/tests/semantic/attributes3_error.txt @@ -1 +1 @@ -(9, 16) - NameError: Undeclared identifier b. +(9, 16) - NameError: Undeclared identifier b. diff --git a/tests/semantic/attributes4.cl b/tests/semantic/attributes4.cl index a7f63adbd..307b185fd 100644 --- a/tests/semantic/attributes4.cl +++ b/tests/semantic/attributes4.cl @@ -1,39 +1,39 @@ ---Attributes are local to the class in which they are defined or inherited. - -class A { - a: Int <- 5; -}; -class B inherits A { - b: Bool <- true; - test(x1: Int, y1: Int): Int { - let x: Int <- x1, y: Int <-y1 in { - x <- x + a; - y <- y + a; - if b then x + y else x - y fi; - } - }; -}; -class D inherits B { - d: IO <- new Main.main(); - test3(x1: Int, y1: Int): IO { - let x: Int <- x1, y: Int <-y1, c: String <- "C" in { - x <- x + a; - y <- y + a; - if b then new IO.out_string(c) else d fi; - } - }; -}; -class C inherits B { - c: String <- "C"; - test2(x1: Int, y1: Int): IO { - let x: Int <- x1, y: Int <-y1 in { - x <- x + a; - y <- y + a; - if b then new IO.out_string(c) else d fi; - } - }; -}; - -class Main inherits IO { - main(): IO { out_string("Hello World!") }; +--Attributes are local to the class in which they are defined or inherited. + +class A { + a: Int <- 5; +}; +class B inherits A { + b: Bool <- true; + test(x1: Int, y1: Int): Int { + let x: Int <- x1, y: Int <-y1 in { + x <- x + a; + y <- y + a; + if b then x + y else x - y fi; + } + }; +}; +class D inherits B { + d: IO <- new Main.main(); + test3(x1: Int, y1: Int): IO { + let x: Int <- x1, y: Int <-y1, c: String <- "C" in { + x <- x + a; + y <- y + a; + if b then new IO.out_string(c) else d fi; + } + }; +}; +class C inherits B { + c: String <- "C"; + test2(x1: Int, y1: Int): IO { + let x: Int <- x1, y: Int <-y1 in { + x <- x + a; + y <- y + a; + if b then new IO.out_string(c) else d fi; + } + }; +}; + +class Main inherits IO { + main(): IO { out_string("Hello World!") }; }; \ No newline at end of file diff --git a/tests/semantic/basics1.cl b/tests/semantic/basics1.cl index 32ae16564..af84ca0c9 100644 --- a/tests/semantic/basics1.cl +++ b/tests/semantic/basics1.cl @@ -1,10 +1,10 @@ --- It is an error to redefine the IO class. - -class IO { - scan(): String { ":)" }; - print(s: String): IO { new IO }; -}; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; +-- It is an error to redefine the IO class. + +class IO { + scan(): String { ":)" }; + print(s: String): IO { new IO }; +}; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; }; \ No newline at end of file diff --git a/tests/semantic/basics1_error.txt b/tests/semantic/basics1_error.txt index 676f5049c..0db23a051 100644 --- a/tests/semantic/basics1_error.txt +++ b/tests/semantic/basics1_error.txt @@ -1 +1 @@ -(3, 7) - SemanticError: Redefinition of basic class IO. +(3, 7) - SemanticError: Redefinition of basic class IO. diff --git a/tests/semantic/basics2.cl b/tests/semantic/basics2.cl index cf2b1cd2f..61399a989 100644 --- a/tests/semantic/basics2.cl +++ b/tests/semantic/basics2.cl @@ -1,9 +1,9 @@ --- It is an error to inherit from or redefine Int. - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; -}; - -class A inherits Int { - is_prime(): Bool { false }; -}; +-- It is an error to inherit from or redefine Int. + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; +}; + +class A inherits Int { + is_prime(): Bool { false }; +}; diff --git a/tests/semantic/basics2_error.txt b/tests/semantic/basics2_error.txt index 69a3b6814..e2810833a 100644 --- a/tests/semantic/basics2_error.txt +++ b/tests/semantic/basics2_error.txt @@ -1 +1 @@ -(7, 18) - SemanticError: Class A cannot inherit class Int. +(7, 18) - SemanticError: Class A cannot inherit class Int. diff --git a/tests/semantic/basics3.cl b/tests/semantic/basics3.cl index fef017a8d..8c28b31e1 100644 --- a/tests/semantic/basics3.cl +++ b/tests/semantic/basics3.cl @@ -1,9 +1,9 @@ --- It is an error to inherit from or redefine Int. - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; -}; - -class Int { - is_prime(): Bool { false }; +-- It is an error to inherit from or redefine Int. + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; +}; + +class Int { + is_prime(): Bool { false }; }; \ No newline at end of file diff --git a/tests/semantic/basics3_error.txt b/tests/semantic/basics3_error.txt index d8f80cb12..ed382c8eb 100644 --- a/tests/semantic/basics3_error.txt +++ b/tests/semantic/basics3_error.txt @@ -1 +1 @@ -(7, 7) - SemanticError: Redefinition of basic class Int. +(7, 7) - SemanticError: Redefinition of basic class Int. diff --git a/tests/semantic/basics4.cl b/tests/semantic/basics4.cl index 9266ec79b..4475bc08f 100644 --- a/tests/semantic/basics4.cl +++ b/tests/semantic/basics4.cl @@ -1,9 +1,9 @@ --- It is an error to inherit from or redefine String. - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; -}; - -class A inherits String { - is_palindrome(): Bool { false }; +-- It is an error to inherit from or redefine String. + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; +}; + +class A inherits String { + is_palindrome(): Bool { false }; }; \ No newline at end of file diff --git a/tests/semantic/basics4_error.txt b/tests/semantic/basics4_error.txt index d5cd4c3db..bfe08a9a6 100644 --- a/tests/semantic/basics4_error.txt +++ b/tests/semantic/basics4_error.txt @@ -1 +1 @@ -(7, 18) - SemanticError: Class A cannot inherit class String. +(7, 18) - SemanticError: Class A cannot inherit class String. diff --git a/tests/semantic/basics5.cl b/tests/semantic/basics5.cl index bad5eff13..f0d4dafb3 100644 --- a/tests/semantic/basics5.cl +++ b/tests/semantic/basics5.cl @@ -1,9 +1,9 @@ --- It is an error to inherit from or redefine String. - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; -}; - -class String { - is_palindrome(): Bool { false }; +-- It is an error to inherit from or redefine String. + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; +}; + +class String { + is_palindrome(): Bool { false }; }; \ No newline at end of file diff --git a/tests/semantic/basics5_error.txt b/tests/semantic/basics5_error.txt index 8437accf7..47b247faa 100644 --- a/tests/semantic/basics5_error.txt +++ b/tests/semantic/basics5_error.txt @@ -1 +1 @@ -(7, 7) - SemanticError: Redefinition of basic class String. +(7, 7) - SemanticError: Redefinition of basic class String. diff --git a/tests/semantic/basics6.cl b/tests/semantic/basics6.cl index 47266ebed..c16572a31 100644 --- a/tests/semantic/basics6.cl +++ b/tests/semantic/basics6.cl @@ -1,9 +1,9 @@ --- It is an error to inherit from or redefine Bool. - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; -}; - -class A inherits Bool { - xor(b: Bool): Bool { false }; +-- It is an error to inherit from or redefine Bool. + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; +}; + +class A inherits Bool { + xor(b: Bool): Bool { false }; }; \ No newline at end of file diff --git a/tests/semantic/basics6_error.txt b/tests/semantic/basics6_error.txt index b4d22da13..9adf1d488 100644 --- a/tests/semantic/basics6_error.txt +++ b/tests/semantic/basics6_error.txt @@ -1 +1 @@ -(7, 18) - SemanticError: Class A cannot inherit class Bool. +(7, 18) - SemanticError: Class A cannot inherit class Bool. diff --git a/tests/semantic/basics7.cl b/tests/semantic/basics7.cl index 0f30aaec3..38f789245 100644 --- a/tests/semantic/basics7.cl +++ b/tests/semantic/basics7.cl @@ -1,9 +1,9 @@ --- It is an error to inherit from or redefine Bool. - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; -}; - -class Bool { - xor(b: Bool): Bool { false }; +-- It is an error to inherit from or redefine Bool. + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; +}; + +class Bool { + xor(b: Bool): Bool { false }; }; \ No newline at end of file diff --git a/tests/semantic/basics7_error.txt b/tests/semantic/basics7_error.txt index 92660ab9f..9f1347200 100644 --- a/tests/semantic/basics7_error.txt +++ b/tests/semantic/basics7_error.txt @@ -1 +1 @@ -(7, 7) - SemanticError: Redefinition of basic class Bool. +(7, 7) - SemanticError: Redefinition of basic class Bool. diff --git a/tests/semantic/basics8.cl b/tests/semantic/basics8.cl index 3b9697d4f..d45cd941d 100644 --- a/tests/semantic/basics8.cl +++ b/tests/semantic/basics8.cl @@ -1,9 +1,9 @@ --- It is an error redefine Object. - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; -}; - -class Object { - xor(b: Bool): Bool { false }; +-- It is an error redefine Object. + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; +}; + +class Object { + xor(b: Bool): Bool { false }; }; \ No newline at end of file diff --git a/tests/semantic/basics8_error.txt b/tests/semantic/basics8_error.txt index 652f47b30..45767c9c5 100644 --- a/tests/semantic/basics8_error.txt +++ b/tests/semantic/basics8_error.txt @@ -1 +1 @@ -(7, 7) - SemanticError: Redefinition of basic class Object. +(7, 7) - SemanticError: Redefinition of basic class Object. diff --git a/tests/semantic/blocks1.cl b/tests/semantic/blocks1.cl index 1e928908b..bad9093d7 100644 --- a/tests/semantic/blocks1.cl +++ b/tests/semantic/blocks1.cl @@ -1,31 +1,31 @@ ---The static type of a block is the static type of the last expression. - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; -class E inherits B { }; -class F inherits A { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test: B <- { - new A; - { - new B; - { - new C; - { - new D; - { - new E; - { - new F; - }; - }; - }; - }; - }; - }; +--The static type of a block is the static type of the last expression. + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; +class E inherits B { }; +class F inherits A { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test: B <- { + new A; + { + new B; + { + new C; + { + new D; + { + new E; + { + new F; + }; + }; + }; + }; + }; + }; }; \ No newline at end of file diff --git a/tests/semantic/blocks1_error.txt b/tests/semantic/blocks1_error.txt index 2f0e2caf3..6bd9d6118 100644 --- a/tests/semantic/blocks1_error.txt +++ b/tests/semantic/blocks1_error.txt @@ -1 +1 @@ -(13, 16) - TypeError: Inferred type F of initialization of attribute test does not conform to declared type B. +(13, 16) - TypeError: Inferred type F of initialization of attribute test does not conform to declared type B. diff --git a/tests/semantic/case1.cl b/tests/semantic/case1.cl index 82c6a4d61..af452f11c 100644 --- a/tests/semantic/case1.cl +++ b/tests/semantic/case1.cl @@ -1,23 +1,23 @@ ---For each branch, let Ti be the static type of . The static type of a case expression is Join 1≤i≤n Ti. - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; -class E inherits B { }; -class F inherits A { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - b: B <- case "true" of - i: Int => New C; - b: Bool => New D; - s: String => New E; - esac; - - test: B <- case 0 of - b: Bool => new F; - i: Int => new E; - esac; -}; +--For each branch, let Ti be the static type of . The static type of a case expression is Join 1≤i≤n Ti. + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; +class E inherits B { }; +class F inherits A { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + b: B <- case "true" of + i: Int => New C; + b: Bool => New D; + s: String => New E; + esac; + + test: B <- case 0 of + b: Bool => new F; + i: Int => new E; + esac; +}; diff --git a/tests/semantic/case1_error.txt b/tests/semantic/case1_error.txt index f05ce31b9..70c7d16ca 100644 --- a/tests/semantic/case1_error.txt +++ b/tests/semantic/case1_error.txt @@ -1 +1 @@ -(19, 16) - TypeError: Inferred type A of initialization of attribute test does not conform to declared type B. +(19, 16) - TypeError: Inferred type A of initialization of attribute test does not conform to declared type B. diff --git a/tests/semantic/case2.cl b/tests/semantic/case2.cl index ae97b41da..dbbe4148c 100644 --- a/tests/semantic/case2.cl +++ b/tests/semantic/case2.cl @@ -1,23 +1,23 @@ --- The variables declared on each branch of a case must all have distinct types. - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; -class E inherits B { }; -class F inherits A { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - b: B <- case "true" of - i: Int => New C; - b: Bool => New D; - s: String => New E; - esac; - - test: A <- case 0 of - b: Bool => new F; - i: Bool => new E; - esac; +-- The variables declared on each branch of a case must all have distinct types. + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; +class E inherits B { }; +class F inherits A { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + b: B <- case "true" of + i: Int => New C; + b: Bool => New D; + s: String => New E; + esac; + + test: A <- case 0 of + b: Bool => new F; + i: Bool => new E; + esac; }; \ No newline at end of file diff --git a/tests/semantic/case3.cl b/tests/semantic/case3.cl index da79bbfe6..9ff06336a 100644 --- a/tests/semantic/case3.cl +++ b/tests/semantic/case3.cl @@ -1,23 +1,23 @@ --- Missing type - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; -class E inherits B { }; -class F inherits A { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - b: B <- case "true" of - i: Int => New C; - b: Bool => New D; - s: String => New E; - esac; - - test: A <- case 0 of - b: Bool => new F; - i: Ball => new E; - esac; +-- Missing type + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; +class E inherits B { }; +class F inherits A { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + b: B <- case "true" of + i: Int => New C; + b: Bool => New D; + s: String => New E; + esac; + + test: A <- case 0 of + b: Bool => new F; + i: Ball => new E; + esac; }; \ No newline at end of file diff --git a/tests/semantic/class1.cl b/tests/semantic/class1.cl index ed83da9d1..576a3d0eb 100644 --- a/tests/semantic/class1.cl +++ b/tests/semantic/class1.cl @@ -1,9 +1,9 @@ --- Classes may not be redefined. - -class Repeat { - sum(a: Int, b: Int): Int { a + b }; -}; - -class Repeat { - mult(a: Int, b: Int): Int { a * b }; +-- Classes may not be redefined. + +class Repeat { + sum(a: Int, b: Int): Int { a + b }; +}; + +class Repeat { + mult(a: Int, b: Int): Int { a * b }; }; \ No newline at end of file diff --git a/tests/semantic/class1_error.txt b/tests/semantic/class1_error.txt index 19c507672..6337828d0 100644 --- a/tests/semantic/class1_error.txt +++ b/tests/semantic/class1_error.txt @@ -1,2 +1,2 @@ -(7, 5) - SemanticError: Classes may not be redefined - +(7, 5) - SemanticError: Classes may not be redefined + diff --git a/tests/semantic/conditionals1.cl b/tests/semantic/conditionals1.cl index 3446a8b0f..46af8cc73 100644 --- a/tests/semantic/conditionals1.cl +++ b/tests/semantic/conditionals1.cl @@ -1,14 +1,14 @@ ---The predicate must have static type Bool. - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; -class E inherits B { }; -class F inherits A { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - a: A <- if new F then new D else new C fi; +--The predicate must have static type Bool. + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; +class E inherits B { }; +class F inherits A { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + a: A <- if new F then new D else new C fi; }; \ No newline at end of file diff --git a/tests/semantic/conditionals1_error.txt b/tests/semantic/conditionals1_error.txt index b86345359..52db300b9 100644 --- a/tests/semantic/conditionals1_error.txt +++ b/tests/semantic/conditionals1_error.txt @@ -1 +1 @@ -(13, 16) - TypeError: Predicate of 'if' does not have type Bool. +(13, 16) - TypeError: Predicate of 'if' does not have type Bool. diff --git a/tests/semantic/conditionals2.cl b/tests/semantic/conditionals2.cl index 9d6313d75..8814177fc 100644 --- a/tests/semantic/conditionals2.cl +++ b/tests/semantic/conditionals2.cl @@ -1,24 +1,24 @@ -(* -Let T and F be the static types of the branches of the conditional. Then the static type of the -conditional is T t F. (think: Walk towards Object from each of T and F until the paths meet.) -*) - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; -class E inherits B { }; -class F inherits A { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - b: B <- if true then - new C - else - if false then new D - else new E fi - fi; - - test: B <- if not true then new F else new E fi; -}; +(* +Let T and F be the static types of the branches of the conditional. Then the static type of the +conditional is T t F. (think: Walk towards Object from each of T and F until the paths meet.) +*) + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; +class E inherits B { }; +class F inherits A { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + b: B <- if true then + new C + else + if false then new D + else new E fi + fi; + + test: B <- if not true then new F else new E fi; +}; diff --git a/tests/semantic/conditionals2_error.txt b/tests/semantic/conditionals2_error.txt index d6f5fc307..8f54d195e 100644 --- a/tests/semantic/conditionals2_error.txt +++ b/tests/semantic/conditionals2_error.txt @@ -1,2 +1,2 @@ -(23, 16) - TypeError: Inferred type A of initialization of attribute test does not conform to declared type B. - +(23, 16) - TypeError: Inferred type A of initialization of attribute test does not conform to declared type B. + diff --git a/tests/semantic/dispatch1.cl b/tests/semantic/dispatch1.cl index 1c0457fa3..bfd90f075 100644 --- a/tests/semantic/dispatch1.cl +++ b/tests/semantic/dispatch1.cl @@ -1,33 +1,33 @@ -(* -e0 .f(e1, . . . , en ) -Assume e0 has static type A. -Class A must have a method f -*) - -class A inherits IO { - f(x: Int, y: Int): Int { x + y }; - g(x: Int): Int { x + x }; -}; -class B inherits A { - f(a: Int, b: Int): Int { a - b }; -}; -class C inherits B { - ident(m: Int): Int { m }; - f(m: Int, n: Int): Int { m * n }; -}; -class D inherits B { - ident(v: String): IO { new IO.out_string(v) }; - f(v: Int, w: Int): Int { v / w }; - g(v: Int): Int { v + v + v }; - - back(s: String): B { { - out_string(s); - self; - } }; -}; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test: B <- new D.back("Hello ").back("World!"); +(* +e0 .f(e1, . . . , en ) +Assume e0 has static type A. +Class A must have a method f +*) + +class A inherits IO { + f(x: Int, y: Int): Int { x + y }; + g(x: Int): Int { x + x }; +}; +class B inherits A { + f(a: Int, b: Int): Int { a - b }; +}; +class C inherits B { + ident(m: Int): Int { m }; + f(m: Int, n: Int): Int { m * n }; +}; +class D inherits B { + ident(v: String): IO { new IO.out_string(v) }; + f(v: Int, w: Int): Int { v / w }; + g(v: Int): Int { v + v + v }; + + back(s: String): B { { + out_string(s); + self; + } }; +}; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test: B <- new D.back("Hello ").back("World!"); }; \ No newline at end of file diff --git a/tests/semantic/dispatch1_error.txt b/tests/semantic/dispatch1_error.txt index 7fb22edce..89fa22b77 100644 --- a/tests/semantic/dispatch1_error.txt +++ b/tests/semantic/dispatch1_error.txt @@ -1 +1 @@ -(32, 37) - AttributeError: Dispatch to undefined method back. +(32, 37) - AttributeError: Dispatch to undefined method back. diff --git a/tests/semantic/dispatch2.cl b/tests/semantic/dispatch2.cl index 5182912b8..ebca718ac 100644 --- a/tests/semantic/dispatch2.cl +++ b/tests/semantic/dispatch2.cl @@ -1,34 +1,34 @@ -(* -e0 .f(e1, . . . , en ) -Assume e0 has static type A. -Class A must have a method f -the dispatch and the definition of f must have the same number of arguments -*) - -class A inherits IO { - f(x: Int, y: Int): Int { x + y }; - g(x: Int): Int { x + x }; -}; -class B inherits A { - f(a: Int, b: Int): Int { a - b }; -}; -class C inherits B { - ident(m: Int): Int { m }; - f(m: Int, n: Int): Int { m * n }; -}; -class D inherits B { - ident(v: String): IO { new IO.out_string(v) }; - f(v: Int, w: Int): Int { v / w }; - g(v: Int): Int { v + v + v }; - - back(s: String): B { { - out_string(s); - self; - } }; -}; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test: Int <- new D.back("Hello ").g(2, 2); +(* +e0 .f(e1, . . . , en ) +Assume e0 has static type A. +Class A must have a method f +the dispatch and the definition of f must have the same number of arguments +*) + +class A inherits IO { + f(x: Int, y: Int): Int { x + y }; + g(x: Int): Int { x + x }; +}; +class B inherits A { + f(a: Int, b: Int): Int { a - b }; +}; +class C inherits B { + ident(m: Int): Int { m }; + f(m: Int, n: Int): Int { m * n }; +}; +class D inherits B { + ident(v: String): IO { new IO.out_string(v) }; + f(v: Int, w: Int): Int { v / w }; + g(v: Int): Int { v + v + v }; + + back(s: String): B { { + out_string(s); + self; + } }; +}; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test: Int <- new D.back("Hello ").g(2, 2); }; \ No newline at end of file diff --git a/tests/semantic/dispatch2_error.txt b/tests/semantic/dispatch2_error.txt index a86c35340..1530fb82c 100644 --- a/tests/semantic/dispatch2_error.txt +++ b/tests/semantic/dispatch2_error.txt @@ -1 +1 @@ -(33, 39) - SemanticError: Method g called with wrong number of arguments. +(33, 39) - SemanticError: Method g called with wrong number of arguments. diff --git a/tests/semantic/dispatch3.cl b/tests/semantic/dispatch3.cl index ecb1535db..98c19da77 100644 --- a/tests/semantic/dispatch3.cl +++ b/tests/semantic/dispatch3.cl @@ -1,36 +1,36 @@ -(* -e0 .f(e1, . . . , en ) -Assume e0 has static type A. -Class A must have a method f -the static type of the ith actual parameter must conform to the declared type of the ith formal parameter. -*) - -class A inherits IO { - f(x: Int, y: Int): Int { x + y }; - g(x: Int): Int { x + x }; -}; -class B inherits A { - f(a: Int, b: Int): Int { a - b }; -}; -class C inherits B { - ident(m: Int): Int { m }; - f(m: Int, n: Int): Int { m * n }; -}; -class D inherits B { - ident(v: String): IO { new IO.out_string(v) }; - f(v: Int, w: Int): Int { v / w }; - g(v: Int): Int { v + v + v }; - - back(s: String): B { { - out_string(s); - self; - } }; - - alphabet(a: A, b: B, c: C): D { self }; -}; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test: B <- new D.alphabet(new D, new D, new D.back("Hello ")).back("World!"); +(* +e0 .f(e1, . . . , en ) +Assume e0 has static type A. +Class A must have a method f +the static type of the ith actual parameter must conform to the declared type of the ith formal parameter. +*) + +class A inherits IO { + f(x: Int, y: Int): Int { x + y }; + g(x: Int): Int { x + x }; +}; +class B inherits A { + f(a: Int, b: Int): Int { a - b }; +}; +class C inherits B { + ident(m: Int): Int { m }; + f(m: Int, n: Int): Int { m * n }; +}; +class D inherits B { + ident(v: String): IO { new IO.out_string(v) }; + f(v: Int, w: Int): Int { v / w }; + g(v: Int): Int { v + v + v }; + + back(s: String): B { { + out_string(s); + self; + } }; + + alphabet(a: A, b: B, c: C): D { self }; +}; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test: B <- new D.alphabet(new D, new D, new D.back("Hello ")).back("World!"); }; \ No newline at end of file diff --git a/tests/semantic/dispatch3_error.txt b/tests/semantic/dispatch3_error.txt index 0def5cf03..77e81db72 100644 --- a/tests/semantic/dispatch3_error.txt +++ b/tests/semantic/dispatch3_error.txt @@ -1 +1 @@ -(35, 45) - TypeError: In call of method alphabet, type B of parameter c does not conform to declared type C. +(35, 45) - TypeError: In call of method alphabet, type B of parameter c does not conform to declared type C. diff --git a/tests/semantic/dispatch4.cl b/tests/semantic/dispatch4.cl index 9cadd8332..604e462a2 100644 --- a/tests/semantic/dispatch4.cl +++ b/tests/semantic/dispatch4.cl @@ -1,36 +1,36 @@ -(* -e0 .f(e1, . . . , en ) -Assume e0 has static type A. -Class A must have a method f -If f has return type B and B is a class name, then the static type of the dispatch is B. -*) - -class A inherits IO { - f(x: Int, y: Int): Int { x + y }; - g(x: Int): Int { x + x }; -}; -class B inherits A { - f(a: Int, b: Int): Int { a - b }; -}; -class C inherits B { - ident(m: Int): Int { m }; - f(m: Int, n: Int): Int { m * n }; -}; -class D inherits B { - ident(v: String): IO { new IO.out_string(v) }; - f(v: Int, w: Int): Int { v / w }; - g(v: Int): Int { v + v + v }; - - back(s: String): B { { - out_string(s); - self; - } }; - - alphabet(a: A, b: B, c: C): D { self }; -}; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test: D <- new D.alphabet(new D, new D.back("Hello "), new C).back("World!"); +(* +e0 .f(e1, . . . , en ) +Assume e0 has static type A. +Class A must have a method f +If f has return type B and B is a class name, then the static type of the dispatch is B. +*) + +class A inherits IO { + f(x: Int, y: Int): Int { x + y }; + g(x: Int): Int { x + x }; +}; +class B inherits A { + f(a: Int, b: Int): Int { a - b }; +}; +class C inherits B { + ident(m: Int): Int { m }; + f(m: Int, n: Int): Int { m * n }; +}; +class D inherits B { + ident(v: String): IO { new IO.out_string(v) }; + f(v: Int, w: Int): Int { v / w }; + g(v: Int): Int { v + v + v }; + + back(s: String): B { { + out_string(s); + self; + } }; + + alphabet(a: A, b: B, c: C): D { self }; +}; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test: D <- new D.alphabet(new D, new D.back("Hello "), new C).back("World!"); }; \ No newline at end of file diff --git a/tests/semantic/dispatch5.cl b/tests/semantic/dispatch5.cl index b4437b1b4..9820e5ee1 100644 --- a/tests/semantic/dispatch5.cl +++ b/tests/semantic/dispatch5.cl @@ -1,31 +1,31 @@ -(* -(,...,) is shorthand for self.(,...,). -*) - -class A inherits IO { - f(x: Int, y: Int): Int { x + y }; - g(x: Int): Int { x + x }; -}; -class B inherits A { - f(a: Int, b: Int): Int { a - b }; -}; -class C inherits B { - ident(m: Int): Int { m }; - f(m: Int, n: Int): Int { m * n }; - sum(m: Int, n: Int, p: Int): Int { m + n + p }; -}; -class D inherits B { - ident(v: String): IO { new IO.out_string(v) }; - f(v: Int, w: Int): Int { v / w }; - - back(s: String): B { { - out_string(s); - g(2); - sum(1, 2, 3); - self; - } }; -}; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; +(* +(,...,) is shorthand for self.(,...,). +*) + +class A inherits IO { + f(x: Int, y: Int): Int { x + y }; + g(x: Int): Int { x + x }; +}; +class B inherits A { + f(a: Int, b: Int): Int { a - b }; +}; +class C inherits B { + ident(m: Int): Int { m }; + f(m: Int, n: Int): Int { m * n }; + sum(m: Int, n: Int, p: Int): Int { m + n + p }; +}; +class D inherits B { + ident(v: String): IO { new IO.out_string(v) }; + f(v: Int, w: Int): Int { v / w }; + + back(s: String): B { { + out_string(s); + g(2); + sum(1, 2, 3); + self; + } }; +}; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; }; \ No newline at end of file diff --git a/tests/semantic/dispatch5_error.txt b/tests/semantic/dispatch5_error.txt index d26bf34a1..6a6922f32 100644 --- a/tests/semantic/dispatch5_error.txt +++ b/tests/semantic/dispatch5_error.txt @@ -1 +1 @@ -(24, 9) - AttributeError: Dispatch to undefined method sum. +(24, 9) - AttributeError: Dispatch to undefined method sum. diff --git a/tests/semantic/dispatch6.cl b/tests/semantic/dispatch6.cl index fcc033f2c..bbe58fbb1 100644 --- a/tests/semantic/dispatch6.cl +++ b/tests/semantic/dispatch6.cl @@ -1,32 +1,32 @@ -(* -e@B.f() invokes the method -f in class B on the object that is the value of e. For this form of dispatch, the static type to the left of -“@”must conform to the type specified to the right of “@”. -*) - -class A { - f(x: Int, y: Int): Int { x + y }; - g(x: Int): Int { x + x }; -}; -class B inherits A { - f(a: Int, b: Int): Int { a - b }; - sum(m: Int, n: Int, p: Int): Int { m + n + p }; -}; -class C inherits B { - ident(m: Int): Int { m }; - f(m: Int, n: Int): Int { m * n }; -}; -class D inherits B { - ident(v: String): IO { new IO.out_string(v) }; - f(v: Int, w: Int): Int { v / w }; - g(v: Int): Int { v + v + v }; - sum(v: Int, w: Int, z: Int): Int { v - w - z }; -}; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - a: A <- new D; - b: Int <- new D@B.sum(1, 2, 3); - test: Int <- a@B.sum(1, 2, 3); -}; +(* +e@B.f() invokes the method +f in class B on the object that is the value of e. For this form of dispatch, the static type to the left of +“@”must conform to the type specified to the right of “@”. +*) + +class A { + f(x: Int, y: Int): Int { x + y }; + g(x: Int): Int { x + x }; +}; +class B inherits A { + f(a: Int, b: Int): Int { a - b }; + sum(m: Int, n: Int, p: Int): Int { m + n + p }; +}; +class C inherits B { + ident(m: Int): Int { m }; + f(m: Int, n: Int): Int { m * n }; +}; +class D inherits B { + ident(v: String): IO { new IO.out_string(v) }; + f(v: Int, w: Int): Int { v / w }; + g(v: Int): Int { v + v + v }; + sum(v: Int, w: Int, z: Int): Int { v - w - z }; +}; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + a: A <- new D; + b: Int <- new D@B.sum(1, 2, 3); + test: Int <- a@B.sum(1, 2, 3); +}; diff --git a/tests/semantic/dispatch6_error.txt b/tests/semantic/dispatch6_error.txt index ae9184b2f..7d5ec3780 100644 --- a/tests/semantic/dispatch6_error.txt +++ b/tests/semantic/dispatch6_error.txt @@ -1 +1 @@ -(31, 18) - TypeError: Expression type A does not conform to declared static dispatch type B. +(31, 18) - TypeError: Expression type A does not conform to declared static dispatch type B. diff --git a/tests/semantic/eq1.cl b/tests/semantic/eq1.cl index 88f2a7ffe..dc8a0cd43 100644 --- a/tests/semantic/eq1.cl +++ b/tests/semantic/eq1.cl @@ -1,17 +1,17 @@ -(* -The comparison = is a special -case. If either or has static type Int, Bool, or String, then the other must have the -same static type. Any other types, including SELF TYPE, may be freely compared. -*) - -class A { }; -class B inherits A { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - x: Bool <- 1 = 2; - test: Bool <- 1 = new A; - y: Bool <- "1" = "2"; - z: Bool <- true = not false; +(* +The comparison = is a special +case. If either or has static type Int, Bool, or String, then the other must have the +same static type. Any other types, including SELF TYPE, may be freely compared. +*) + +class A { }; +class B inherits A { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + x: Bool <- 1 = 2; + test: Bool <- 1 = new A; + y: Bool <- "1" = "2"; + z: Bool <- true = not false; }; \ No newline at end of file diff --git a/tests/semantic/eq1_error.txt b/tests/semantic/eq1_error.txt index f81425683..0b85d2fa0 100644 --- a/tests/semantic/eq1_error.txt +++ b/tests/semantic/eq1_error.txt @@ -1 +1 @@ -(14, 21) - TypeError: Illegal comparison with a basic type. +(14, 21) - TypeError: Illegal comparison with a basic type. diff --git a/tests/semantic/eq2.cl b/tests/semantic/eq2.cl index d76852780..f4b2ffac7 100644 --- a/tests/semantic/eq2.cl +++ b/tests/semantic/eq2.cl @@ -1,17 +1,17 @@ -(* -The comparison = is a special -case. If either or has static type Int, Bool, or String, then the other must have the -same static type. Any other types, including SELF TYPE, may be freely compared. -*) - -class A { }; -class B inherits A { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - x: Bool <- 1 = 2; - y: Bool <- "1" = "2"; - test: Bool <- "1" = new B; - z: Bool <- true = not false; -}; +(* +The comparison = is a special +case. If either or has static type Int, Bool, or String, then the other must have the +same static type. Any other types, including SELF TYPE, may be freely compared. +*) + +class A { }; +class B inherits A { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + x: Bool <- 1 = 2; + y: Bool <- "1" = "2"; + test: Bool <- "1" = new B; + z: Bool <- true = not false; +}; diff --git a/tests/semantic/eq2_error.txt b/tests/semantic/eq2_error.txt index a44ab0d51..1bb29ca32 100644 --- a/tests/semantic/eq2_error.txt +++ b/tests/semantic/eq2_error.txt @@ -1 +1 @@ -(15, 23) - TypeError: Illegal comparison with a basic type. +(15, 23) - TypeError: Illegal comparison with a basic type. diff --git a/tests/semantic/eq3.cl b/tests/semantic/eq3.cl index 4dad693ee..b7ee462c5 100644 --- a/tests/semantic/eq3.cl +++ b/tests/semantic/eq3.cl @@ -1,17 +1,17 @@ -(* -The comparison = is a special -case. If either or has static type Int, Bool, or String, then the other must have the -same static type. Any other types, including SELF TYPE, may be freely compared. -*) - -class A { }; -class B inherits A { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - x: Bool <- 1 = 2; - y: Bool <- "1" = "2"; - z: Bool <- true = not false; - test: Bool <- "true" = not false; -}; +(* +The comparison = is a special +case. If either or has static type Int, Bool, or String, then the other must have the +same static type. Any other types, including SELF TYPE, may be freely compared. +*) + +class A { }; +class B inherits A { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + x: Bool <- 1 = 2; + y: Bool <- "1" = "2"; + z: Bool <- true = not false; + test: Bool <- "true" = not false; +}; diff --git a/tests/semantic/eq3_error.txt b/tests/semantic/eq3_error.txt index c4e27eb8a..d57841b95 100644 --- a/tests/semantic/eq3_error.txt +++ b/tests/semantic/eq3_error.txt @@ -1 +1 @@ -(16, 26) - TypeError: Illegal comparison with a basic type. +(16, 26) - TypeError: Illegal comparison with a basic type. diff --git a/tests/semantic/eq4.cl b/tests/semantic/eq4.cl index 11afc119f..63c1067f0 100644 --- a/tests/semantic/eq4.cl +++ b/tests/semantic/eq4.cl @@ -1,17 +1,17 @@ -(* -The comparison = is a special -case. If either or has static type Int, Bool, or String, then the other must have the -same static type. Any other types, including SELF TYPE, may be freely compared. The result is a Bool. -*) - -class A { }; -class B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - x: Bool <- 1 = 2; - y: Bool <- "1" = "2"; - z: Bool <- new A = new B; - test: Int <- new A = new B; -}; +(* +The comparison = is a special +case. If either or has static type Int, Bool, or String, then the other must have the +same static type. Any other types, including SELF TYPE, may be freely compared. The result is a Bool. +*) + +class A { }; +class B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + x: Bool <- 1 = 2; + y: Bool <- "1" = "2"; + z: Bool <- new A = new B; + test: Int <- new A = new B; +}; diff --git a/tests/semantic/eq4_error.txt b/tests/semantic/eq4_error.txt index 3ead21d0e..f075fecbe 100644 --- a/tests/semantic/eq4_error.txt +++ b/tests/semantic/eq4_error.txt @@ -1 +1 @@ -(16, 18) - TypeError: Inferred type Bool of initialization of attribute test does not conform to declared type Int. +(16, 18) - TypeError: Inferred type Bool of initialization of attribute test does not conform to declared type Int. diff --git a/tests/semantic/isvoid1.cl b/tests/semantic/isvoid1.cl index 072720d85..7c3a83a77 100644 --- a/tests/semantic/isvoid1.cl +++ b/tests/semantic/isvoid1.cl @@ -1,26 +1,26 @@ ---evaluates to true if expr is void and evaluates to false if expr is not void. - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; -class E inherits B { }; -class F inherits A { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - b: B <- if isvoid new F then - new C - else - if false then new D - else new E fi - fi; - - test: B <- isvoid if isvoid new F then - new C - else - if false then new D - else new E fi - fi; +--evaluates to true if expr is void and evaluates to false if expr is not void. + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; +class E inherits B { }; +class F inherits A { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + b: B <- if isvoid new F then + new C + else + if false then new D + else new E fi + fi; + + test: B <- isvoid if isvoid new F then + new C + else + if false then new D + else new E fi + fi; }; \ No newline at end of file diff --git a/tests/semantic/isvoid1_error.txt b/tests/semantic/isvoid1_error.txt index 0922de909..3fd0157b4 100644 --- a/tests/semantic/isvoid1_error.txt +++ b/tests/semantic/isvoid1_error.txt @@ -1 +1 @@ -(20, 16) - TypeError: Inferred type Bool of initialization of attribute test does not conform to declared type B. +(20, 16) - TypeError: Inferred type Bool of initialization of attribute test does not conform to declared type B. diff --git a/tests/semantic/let1.cl b/tests/semantic/let1.cl index 26ef63026..9220d3dbc 100644 --- a/tests/semantic/let1.cl +++ b/tests/semantic/let1.cl @@ -1,15 +1,15 @@ ---The type of an initialization expression must conform to the declared type of the identifier. - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; -class E inherits B { }; -class F inherits A { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - b: B <- let a: Bool, a: Int <- 5, a: String, a: A <- new F, b: B <- new E in b; - test: B <- let a: Bool, a: Int <- 5, a: String, a: A <- new F, b: C <- new E in b; +--The type of an initialization expression must conform to the declared type of the identifier. + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; +class E inherits B { }; +class F inherits A { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + b: B <- let a: Bool, a: Int <- 5, a: String, a: A <- new F, b: B <- new E in b; + test: B <- let a: Bool, a: Int <- 5, a: String, a: A <- new F, b: C <- new E in b; }; \ No newline at end of file diff --git a/tests/semantic/let1_error.txt b/tests/semantic/let1_error.txt index 16ecf780c..56547dae5 100644 --- a/tests/semantic/let1_error.txt +++ b/tests/semantic/let1_error.txt @@ -1 +1 @@ -(14, 76) - TypeError: Inferred type E of initialization of b does not conform to identifier's declared type C. +(14, 76) - TypeError: Inferred type E of initialization of b does not conform to identifier's declared type C. diff --git a/tests/semantic/let2.cl b/tests/semantic/let2.cl index c5956ead3..2949fb94d 100644 --- a/tests/semantic/let2.cl +++ b/tests/semantic/let2.cl @@ -1,15 +1,15 @@ ---The type of let is the type of the body. - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; -class E inherits B { }; -class F inherits A { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - b: B <- let a: Bool, a: Int <- 5, a: String, a: A <- new F, b: B <- new E in b; - test: B <- let a: Bool, a: Int <- 5, a: String, a: A <- new F, b: A <- new E in b; +--The type of let is the type of the body. + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; +class E inherits B { }; +class F inherits A { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + b: B <- let a: Bool, a: Int <- 5, a: String, a: A <- new F, b: B <- new E in b; + test: B <- let a: Bool, a: Int <- 5, a: String, a: A <- new F, b: A <- new E in b; }; \ No newline at end of file diff --git a/tests/semantic/let2_error.txt b/tests/semantic/let2_error.txt index b1e8a365d..3b7c669a3 100644 --- a/tests/semantic/let2_error.txt +++ b/tests/semantic/let2_error.txt @@ -1 +1 @@ -(14, 16) - TypeError: Inferred type A of initialization of attribute test does not conform to declared type B. +(14, 16) - TypeError: Inferred type A of initialization of attribute test does not conform to declared type B. diff --git a/tests/semantic/let3.cl b/tests/semantic/let3.cl index 8c0670ab8..0a4a9ceaf 100644 --- a/tests/semantic/let3.cl +++ b/tests/semantic/let3.cl @@ -1,15 +1,15 @@ --- Missing type - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; -class E inherits B { }; -class F inherits A { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - b: B <- let a: Bool, a: Int <- 5, a: String, a: A <- new F, b: B <- new E in b; - test: B <- let a: Bool, a: Int <- 5, a: String, a: A <- new F, b: Cadena in new B; +-- Missing type + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; +class E inherits B { }; +class F inherits A { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + b: B <- let a: Bool, a: Int <- 5, a: String, a: A <- new F, b: B <- new E in b; + test: B <- let a: Bool, a: Int <- 5, a: String, a: A <- new F, b: Cadena in new B; }; \ No newline at end of file diff --git a/tests/semantic/loops1.cl b/tests/semantic/loops1.cl index de3a624d2..6a0a81818 100644 --- a/tests/semantic/loops1.cl +++ b/tests/semantic/loops1.cl @@ -1,8 +1,8 @@ ---The predicate must have static type Bool. - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - i: Int <- 1; - test: Object <- while "true" loop i <- i + 1 pool; +--The predicate must have static type Bool. + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + i: Int <- 1; + test: Object <- while "true" loop i <- i + 1 pool; }; \ No newline at end of file diff --git a/tests/semantic/loops2.cl b/tests/semantic/loops2.cl index dea69fa14..d52169da7 100644 --- a/tests/semantic/loops2.cl +++ b/tests/semantic/loops2.cl @@ -1,9 +1,9 @@ ---The static type of a loop expression is Object. - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - i: Int <- 1; - test: Object <- while not false loop i <- i + 1 pool; - test2: Int <- while not false loop i <- i + 1 pool; -}; +--The static type of a loop expression is Object. + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + i: Int <- 1; + test: Object <- while not false loop i <- i + 1 pool; + test2: Int <- while not false loop i <- i + 1 pool; +}; diff --git a/tests/semantic/loops2_error.txt b/tests/semantic/loops2_error.txt index 9711cdf6a..ab79de8da 100644 --- a/tests/semantic/loops2_error.txt +++ b/tests/semantic/loops2_error.txt @@ -1 +1 @@ -(8, 19) - TypeError: Inferred type Object of initialization of attribute test2 does not conform to declared type Int. +(8, 19) - TypeError: Inferred type Object of initialization of attribute test2 does not conform to declared type Int. diff --git a/tests/semantic/methods1.cl b/tests/semantic/methods1.cl index d12031970..f4ff07bb0 100644 --- a/tests/semantic/methods1.cl +++ b/tests/semantic/methods1.cl @@ -1,12 +1,12 @@ ---The identifiers used in the formal parameter list must be distinct - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test(a: A, a: B): Int { 4 }; +--The identifiers used in the formal parameter list must be distinct + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test(a: A, a: B): Int { 4 }; }; \ No newline at end of file diff --git a/tests/semantic/methods1_error.txt b/tests/semantic/methods1_error.txt index 06ab88a92..809036803 100644 --- a/tests/semantic/methods1_error.txt +++ b/tests/semantic/methods1_error.txt @@ -1 +1 @@ -(11, 16) - SemanticError: Formal parameter a is multiply defined. +(11, 16) - SemanticError: Formal parameter a is multiply defined. diff --git a/tests/semantic/methods2.cl b/tests/semantic/methods2.cl index 3865f0e13..c010df01e 100644 --- a/tests/semantic/methods2.cl +++ b/tests/semantic/methods2.cl @@ -1,12 +1,12 @@ ---The type of the method body must conform to the declared return type. - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test(a: A, b: B): C { new D }; +--The type of the method body must conform to the declared return type. + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test(a: A, b: B): C { new D }; }; \ No newline at end of file diff --git a/tests/semantic/methods2_error.txt b/tests/semantic/methods2_error.txt index f7e4a330d..1a4baea17 100644 --- a/tests/semantic/methods2_error.txt +++ b/tests/semantic/methods2_error.txt @@ -1 +1 @@ -(11, 27) - TypeError: Inferred return type D of method test does not conform to declared return type C. +(11, 27) - TypeError: Inferred return type D of method test does not conform to declared return type C. diff --git a/tests/semantic/methods3.cl b/tests/semantic/methods3.cl index b92faeb97..9aff4d167 100644 --- a/tests/semantic/methods3.cl +++ b/tests/semantic/methods3.cl @@ -1,14 +1,14 @@ ---A formal parameter hides any definition of an attribute of the same name. - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - a: C <- new C; - test(a: D): D { a }; - test2(a: B): C { a }; +--A formal parameter hides any definition of an attribute of the same name. + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + a: C <- new C; + test(a: D): D { a }; + test2(a: B): C { a }; }; \ No newline at end of file diff --git a/tests/semantic/methods3_error.txt b/tests/semantic/methods3_error.txt index 1165b7595..a0f6d9db2 100644 --- a/tests/semantic/methods3_error.txt +++ b/tests/semantic/methods3_error.txt @@ -1 +1 @@ -(13, 22) - TypeError: Inferred return type B of method test2 does not conform to declared return type C. +(13, 22) - TypeError: Inferred return type B of method test2 does not conform to declared return type C. diff --git a/tests/semantic/methods4.cl b/tests/semantic/methods4.cl index be8fa36ef..e093bac1c 100644 --- a/tests/semantic/methods4.cl +++ b/tests/semantic/methods4.cl @@ -1,19 +1,19 @@ -(* -The rule is -simple: If a class C inherits a method f from an ancestor class P, then C may override the inherited -definition of f provided the number of arguments, the types of the formal parameters, and the return -type are exactly the same in both definitions. -*) - -class A { - f(x: Int, y: Int): Int { x + y }; -}; -class B inherits A { - f(x: Int, y: Object): Int { x }; -}; -class C inherits B { }; -class D inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; +(* +The rule is +simple: If a class C inherits a method f from an ancestor class P, then C may override the inherited +definition of f provided the number of arguments, the types of the formal parameters, and the return +type are exactly the same in both definitions. +*) + +class A { + f(x: Int, y: Int): Int { x + y }; +}; +class B inherits A { + f(x: Int, y: Object): Int { x }; +}; +class C inherits B { }; +class D inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; }; \ No newline at end of file diff --git a/tests/semantic/methods4_error.txt b/tests/semantic/methods4_error.txt index 9f1486dec..c9fc2d12a 100644 --- a/tests/semantic/methods4_error.txt +++ b/tests/semantic/methods4_error.txt @@ -1 +1 @@ -(12, 15) - SemanticError: In redefined method f, parameter type Object is different from original type Int. +(12, 15) - SemanticError: In redefined method f, parameter type Object is different from original type Int. diff --git a/tests/semantic/methods5.cl b/tests/semantic/methods5.cl index 3905dfdd6..732e4d408 100644 --- a/tests/semantic/methods5.cl +++ b/tests/semantic/methods5.cl @@ -1,20 +1,20 @@ -(* -The rule is -simple: If a class C inherits a method f from an ancestor class P, then C may override the inherited -definition of f provided the number of arguments, the types of the formal parameters, and the return -type are exactly the same in both definitions. -*) - -class A { - f(x: Int, y: Int): Int { x + y }; -}; -class B inherits A { - f(a: Int, b: Int): Object { a - b }; -}; -class C inherits B { }; -class D inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; -}; - +(* +The rule is +simple: If a class C inherits a method f from an ancestor class P, then C may override the inherited +definition of f provided the number of arguments, the types of the formal parameters, and the return +type are exactly the same in both definitions. +*) + +class A { + f(x: Int, y: Int): Int { x + y }; +}; +class B inherits A { + f(a: Int, b: Int): Object { a - b }; +}; +class C inherits B { }; +class D inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; +}; + diff --git a/tests/semantic/methods5_error.txt b/tests/semantic/methods5_error.txt index 8b6bdf36e..073eee8c5 100644 --- a/tests/semantic/methods5_error.txt +++ b/tests/semantic/methods5_error.txt @@ -1 +1 @@ -(12, 24) - SemanticError: In redefined method f, return type Object is different from original return type Int. +(12, 24) - SemanticError: In redefined method f, return type Object is different from original return type Int. diff --git a/tests/semantic/methods6.cl b/tests/semantic/methods6.cl index dd2b73da6..61a62b4b0 100644 --- a/tests/semantic/methods6.cl +++ b/tests/semantic/methods6.cl @@ -1,27 +1,27 @@ -(* -The rule is -simple: If a class C inherits a method f from an ancestor class P, then C may override the inherited -definition of f provided the number of arguments, the types of the formal parameters, and the return -type are exactly the same in both definitions. -*) - -class A { - f(x: Int, y: Int): Int { x + y }; - g(x: Int): Int { x + x }; -}; -class B inherits A { - f(a: Int, b: Int): Int { a - b }; -}; -class C inherits B { - ident(m: Int): Int { m }; - f(m: Int, n: Int): Int { m * n }; -}; -class D inherits B { - ident(v: String): IO { new IO.out_string(v) }; - f(v: Int, w: Int): Int { v / w }; - g(v: Int, w: Int, z: Int): Int { v + w + z }; -}; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; +(* +The rule is +simple: If a class C inherits a method f from an ancestor class P, then C may override the inherited +definition of f provided the number of arguments, the types of the formal parameters, and the return +type are exactly the same in both definitions. +*) + +class A { + f(x: Int, y: Int): Int { x + y }; + g(x: Int): Int { x + x }; +}; +class B inherits A { + f(a: Int, b: Int): Int { a - b }; +}; +class C inherits B { + ident(m: Int): Int { m }; + f(m: Int, n: Int): Int { m * n }; +}; +class D inherits B { + ident(v: String): IO { new IO.out_string(v) }; + f(v: Int, w: Int): Int { v / w }; + g(v: Int, w: Int, z: Int): Int { v + w + z }; +}; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; }; \ No newline at end of file diff --git a/tests/semantic/methods6_error.txt b/tests/semantic/methods6_error.txt index 8e32663b9..70ad02e32 100644 --- a/tests/semantic/methods6_error.txt +++ b/tests/semantic/methods6_error.txt @@ -1 +1 @@ -(22, 5) - SemanticError: Incompatible number of formal parameters in redefined method g. +(22, 5) - SemanticError: Incompatible number of formal parameters in redefined method g. diff --git a/tests/semantic/methods7.cl b/tests/semantic/methods7.cl index e5a01f682..21e8ca275 100644 --- a/tests/semantic/methods7.cl +++ b/tests/semantic/methods7.cl @@ -1,12 +1,12 @@ --- Missing type - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test(a: A, b: Ball): Int { 4 }; +-- Missing type + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test(a: A, b: Ball): Int { 4 }; }; \ No newline at end of file diff --git a/tests/semantic/methods8.cl b/tests/semantic/methods8.cl index 3fccab54c..121210748 100644 --- a/tests/semantic/methods8.cl +++ b/tests/semantic/methods8.cl @@ -1,12 +1,12 @@ --- Missing type - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test(a: A, b: B): Integrer { 4 }; +-- Missing type + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test(a: A, b: B): Integrer { 4 }; }; \ No newline at end of file diff --git a/tests/semantic/new1.cl b/tests/semantic/new1.cl index d007fc03d..40a8b9e9b 100644 --- a/tests/semantic/new1.cl +++ b/tests/semantic/new1.cl @@ -1,31 +1,31 @@ --- Missing type - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; -class E inherits B { }; -class F inherits A { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test: F <- { - new A; - { - new Ball; - { - new C; - { - new D; - { - new E; - { - new F; - }; - }; - }; - }; - }; - }; +-- Missing type + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; +class E inherits B { }; +class F inherits A { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test: F <- { + new A; + { + new Ball; + { + new C; + { + new D; + { + new E; + { + new F; + }; + }; + }; + }; + }; + }; }; \ No newline at end of file diff --git a/tests/semantic/self1.cl b/tests/semantic/self1.cl index 3387fd263..399f6ff06 100644 --- a/tests/semantic/self1.cl +++ b/tests/semantic/self1.cl @@ -1,11 +1,11 @@ -(* -But it is an error to assign to self or to bind self in a let, a -case, or as a formal parameter. It is also illegal to have attributes named self. -*) - - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test(a: Main): IO { self <- a }; -}; +(* +But it is an error to assign to self or to bind self in a let, a +case, or as a formal parameter. It is also illegal to have attributes named self. +*) + + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test(a: Main): IO { self <- a }; +}; diff --git a/tests/semantic/self1_error.txt b/tests/semantic/self1_error.txt index 6beb3cda2..f9f51b9b3 100644 --- a/tests/semantic/self1_error.txt +++ b/tests/semantic/self1_error.txt @@ -1 +1 @@ -(10, 30) - SemanticError: Cannot assign to 'self'. +(10, 30) - SemanticError: Cannot assign to 'self'. diff --git a/tests/semantic/self2.cl b/tests/semantic/self2.cl index 2e6921a92..6ef75e368 100644 --- a/tests/semantic/self2.cl +++ b/tests/semantic/self2.cl @@ -1,10 +1,10 @@ -(* -But it is an error to assign to self or to bind self in a let, a -case, or as a formal parameter. It is also illegal to have attributes named self. -*) - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test(): IO { let self: Main <- new Main in self }; -}; +(* +But it is an error to assign to self or to bind self in a let, a +case, or as a formal parameter. It is also illegal to have attributes named self. +*) + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test(): IO { let self: Main <- new Main in self }; +}; diff --git a/tests/semantic/self2_error.txt b/tests/semantic/self2_error.txt index 20c883c91..2e53bb210 100644 --- a/tests/semantic/self2_error.txt +++ b/tests/semantic/self2_error.txt @@ -1 +1 @@ -(9, 22) - SemanticError: 'self' cannot be bound in a 'let' expression. +(9, 22) - SemanticError: 'self' cannot be bound in a 'let' expression. diff --git a/tests/semantic/self3.cl b/tests/semantic/self3.cl index 81709b4b5..d314798a9 100644 --- a/tests/semantic/self3.cl +++ b/tests/semantic/self3.cl @@ -1,10 +1,10 @@ -(* -But it is an error to assign to self or to bind self in a let, a -case, or as a formal parameter. It is also illegal to have attributes named self. -*) - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test(self: IO): IO { self }; -}; +(* +But it is an error to assign to self or to bind self in a let, a +case, or as a formal parameter. It is also illegal to have attributes named self. +*) + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test(self: IO): IO { self }; +}; diff --git a/tests/semantic/self3_error.txt b/tests/semantic/self3_error.txt index 0ae382007..0015bbe0a 100644 --- a/tests/semantic/self3_error.txt +++ b/tests/semantic/self3_error.txt @@ -1 +1 @@ -(9, 10) - SemanticError: 'self' cannot be the name of a formal parameter. +(9, 10) - SemanticError: 'self' cannot be the name of a formal parameter. diff --git a/tests/semantic/self4.cl b/tests/semantic/self4.cl index 7c2b960cb..9185c8760 100644 --- a/tests/semantic/self4.cl +++ b/tests/semantic/self4.cl @@ -1,10 +1,10 @@ -(* -But it is an error to assign to self or to bind self in a let, a -case, or as a formal parameter. It is also illegal to have attributes named self. -*) - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - self: IO <- self; +(* +But it is an error to assign to self or to bind self in a let, a +case, or as a formal parameter. It is also illegal to have attributes named self. +*) + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + self: IO <- self; }; \ No newline at end of file diff --git a/tests/semantic/self4_error.txt b/tests/semantic/self4_error.txt index c19ca400f..bf8740604 100644 --- a/tests/semantic/self4_error.txt +++ b/tests/semantic/self4_error.txt @@ -1 +1 @@ -(9, 5) - SemanticError: 'self' cannot be the name of an attribute. +(9, 5) - SemanticError: 'self' cannot be the name of an attribute. diff --git a/tests/semantic_test.py b/tests/semantic_test.py index cac9cd78b..46f07439d 100644 --- a/tests/semantic_test.py +++ b/tests/semantic_test.py @@ -1,14 +1,14 @@ -import pytest -import os -from utils import compare_errors, first_error_only_line - -tests_dir = __file__.rpartition('/')[0] + '/semantic/' -tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] - -@pytest.mark.semantic -@pytest.mark.error -@pytest.mark.run(order=3) -@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', \ +import pytest +import os +from utils import compare_errors, first_error_only_line + +tests_dir = __file__.rpartition('/')[0] + '/semantic/' +tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] + +@pytest.mark.semantic +@pytest.mark.error +@pytest.mark.run(order=3) +@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 diff --git a/tests/test_cool.py b/tests/test_cool.py index 4f3c74678..adb8011cf 100644 --- a/tests/test_cool.py +++ b/tests/test_cool.py @@ -1,74 +1,74 @@ -from pathlib import Path -from typing import List, Tuple - -from cool import check_semantics, CoolLexer, CoolParser -from cool.semantics import CodeBuilder -from cool.semantics.utils.scope import Context, Scope - - -def tokenize(code): - lexer = CoolLexer() - tokens = lexer(code) - return tokens, lexer - - -def parse(tokens): - parser = CoolParser() - ast = parser(tokens) - return ast, parser - - -def get_programs(folder_name: str) -> Tuple[List[str], List[str]]: - programs = [] - results = [] - - cwd = Path.cwd() - path = cwd / folder_name if str(cwd).endswith('tests') else cwd / 'tests' / folder_name - for path in sorted(path.iterdir()): - s = path.open('r').read() - if path.name.endswith('.cl'): - programs.append(s) - else: - results.append(s) - - return programs, results - - -def test_lexer(): - programs, results = get_programs('lexer') - - for program, result in zip(programs, results): - tokens, lexer = tokenize(program) - assert lexer.contain_errors and '\n'.join(lexer.errors) == result.strip() - - -def test_parser(): - programs, results = get_programs('parser') - - for code, result in zip(programs, results): - tokens, _ = tokenize(code) - ast, parser = parse(tokens) - assert parser.contains_errors and '\n'.join(parser.errors) == result - - -def test_inference(): - programs, results = get_programs('inference') - - for program, result in zip(programs, results): - tokens, _ = tokenize(program) - ast, _ = parse(tokens) - ast, _, _, errors = check_semantics(ast, Scope(), Context(), []) - assert not errors and CodeBuilder().visit(ast, 0) == result - - -def test_semantic(): - programs, results = get_programs('semantic') - - for code, result in zip(programs, results): - tokens, _ = tokenize(code) - ast, parser = parse(tokens) - ast, _, _, errors = check_semantics(ast, Scope(), Context(), []) - assert (parser.contains_errors or errors) and '\n'.join(parser.errors + errors) == result - - -test_inference() +from pathlib import Path +from typing import List, Tuple + +from cool import check_semantics, CoolLexer, CoolParser +from cool.semantics import CodeBuilder +from cool.semantics.utils.scope import Context, Scope + + +def tokenize(code): + lexer = CoolLexer() + tokens = lexer(code) + return tokens, lexer + + +def parse(tokens): + parser = CoolParser() + ast = parser(tokens) + return ast, parser + + +def get_programs(folder_name: str) -> Tuple[List[str], List[str]]: + programs = [] + results = [] + + cwd = Path.cwd() + path = cwd / folder_name if str(cwd).endswith('tests') else cwd / 'tests' / folder_name + for path in sorted(path.iterdir()): + s = path.open('r').read() + if path.name.endswith('.cl'): + programs.append(s) + else: + results.append(s) + + return programs, results + + +def test_lexer(): + programs, results = get_programs('lexer') + + for program, result in zip(programs, results): + _, lexer = tokenize(program) + assert lexer.contain_errors and '\n'.join(lexer.errors) == result.strip() + + +def test_parser(): + programs, results = get_programs('parser') + + for code, result in zip(programs, results): + tokens, _ = tokenize(code) + _, parser = parse(tokens) + assert parser.contains_errors and '\n'.join(parser.errors) == result + + +def test_inference(): + programs, results = get_programs('inference') + + for program, result in zip(programs, results): + tokens, _ = tokenize(program) + ast, _ = parse(tokens) + ast, _, _, errors = check_semantics(ast, Scope(), Context(), []) + assert not errors and CodeBuilder().visit(ast, 0) == result + + +def test_semantic(): + programs, results = get_programs('semantic') + + for code, result in zip(programs, results): + tokens, _ = tokenize(code) + ast, parser = parse(tokens) + ast, _, _, errors = check_semantics(ast, Scope(), Context(), []) + assert (parser.contains_errors or errors) and '\n'.join(parser.errors + errors) == result + + +test_inference() diff --git a/tests/utils/utils.py b/tests/utils/utils.py index 961cf7cbc..f98d19dd0 100644 --- a/tests/utils/utils.py +++ b/tests/utils/utils.py @@ -1,91 +1,91 @@ -import subprocess -import re - - -COMPILER_TIMEOUT = 'El compilador tarda mucho en responder.' -SPIM_TIMEOUT = 'El spim tarda mucho en responder.' -TEST_MUST_FAIL = 'El test %s debe fallar al compilar' -TEST_MUST_COMPILE = 'El test %s debe compilar' -BAD_ERROR_FORMAT = '''El error no esta en formato: (,) - : - o no se encuentra en la 3ra linea\n\n%s''' -UNEXPECTED_ERROR = 'Se esperaba un %s en (%d, %d). Su error fue un %s en (%d, %d)' -UNEXPECTED_OUTPUT = 'La salida de %s no es la esperada:\n%s\nEsperada:\n%s' - -ERROR_FORMAT = r'^\s*\(\s*(\d+)\s*,\s*(\d+)\s*\)\s*-\s*(\w+)\s*:(.*)$' - -def parse_error(error: str): - merror = re.fullmatch(ERROR_FORMAT, error) - assert merror, BAD_ERROR_FORMAT % error - - return (t(x) for t, x in zip([int, int, str, str], merror.groups())) - - -def first_error(compiler_output: list, errors: list): - line, column, error_type, _ = parse_error(errors[0]) - - oline, ocolumn, oerror_type, _ = parse_error(compiler_output[0]) - - assert line == oline and column == ocolumn and error_type == oerror_type,\ - UNEXPECTED_ERROR % (error_type, line, column, oerror_type, oline, ocolumn) - -def first_error_only_line(compiler_output: list, errors: list): - line, column, error_type, _ = parse_error(errors[0]) - - oline, ocolumn, oerror_type, _ = parse_error(compiler_output[0]) - - assert line == oline and error_type == oerror_type,\ - UNEXPECTED_ERROR % (error_type, line, column, oerror_type, oline, ocolumn) - - -def get_file_name(path: str): - try: - return path[path.rindex('/') + 1:] - except ValueError: - return path - -def compare_errors(compiler_path: str, cool_file_path: str, error_file_path: str, cmp=first_error, timeout=100): - try: - sp = subprocess.run(['bash', compiler_path, cool_file_path], capture_output=True, timeout=timeout) - return_code, output = sp.returncode, sp.stdout.decode() - except subprocess.TimeoutExpired: - assert False, COMPILER_TIMEOUT - - assert return_code == 1, TEST_MUST_FAIL % get_file_name(cool_file_path) - - fd = open(error_file_path, 'r') - errors = fd.read().split('\n') - fd.close() - - # checking the errors of compiler - compiler_output = output.split('\n') - cmp(compiler_output[2:], errors) - -SPIM_HEADER = r'''^SPIM Version .+ of .+ -Copyright .+\, James R\. Larus\. -All Rights Reserved\. -See the file README for a full copyright notice\. -(?:Loaded: .+\n)*''' -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) - assert sp.returncode == 0, TEST_MUST_COMPILE % get_file_name(cool_file_path) - except subprocess.TimeoutExpired: - assert False, COMPILER_TIMEOUT - - spim_file = cool_file_path[:-2] + 'mips' - - try: - fd = open(input_file_path, 'rb') - sp = subprocess.run(['spim', '-file', spim_file], input=fd.read(), capture_output=True, timeout=timeout) - fd.close() - mo = re.match(SPIM_HEADER, sp.stdout.decode()) - if mo: - output = mo.string[mo.end():] - except subprocess.TimeoutExpired: - assert False, SPIM_TIMEOUT - - fd = open(output_file_path, 'r') - eoutput = fd.read() - fd.close() - - assert output == eoutput, UNEXPECTED_OUTPUT % (spim_file, repr(output), repr(eoutput)) +import subprocess +import re + + +COMPILER_TIMEOUT = 'El compilador tarda mucho en responder.' +SPIM_TIMEOUT = 'El spim tarda mucho en responder.' +TEST_MUST_FAIL = 'El test %s debe fallar al compilar' +TEST_MUST_COMPILE = 'El test %s debe compilar' +BAD_ERROR_FORMAT = '''El error no esta en formato: (,) - : + o no se encuentra en la 3ra linea\n\n%s''' +UNEXPECTED_ERROR = 'Se esperaba un %s en (%d, %d). Su error fue un %s en (%d, %d)' +UNEXPECTED_OUTPUT = 'La salida de %s no es la esperada:\n%s\nEsperada:\n%s' + +ERROR_FORMAT = r'^\s*\(\s*(\d+)\s*,\s*(\d+)\s*\)\s*-\s*(\w+)\s*:(.*)$' + +def parse_error(error: str): + merror = re.fullmatch(ERROR_FORMAT, error) + assert merror, BAD_ERROR_FORMAT % error + + return (t(x) for t, x in zip([int, int, str, str], merror.groups())) + + +def first_error(compiler_output: list, errors: list): + line, column, error_type, _ = parse_error(errors[0]) + + oline, ocolumn, oerror_type, _ = parse_error(compiler_output[0]) + + assert line == oline and column == ocolumn and error_type == oerror_type,\ + UNEXPECTED_ERROR % (error_type, line, column, oerror_type, oline, ocolumn) + +def first_error_only_line(compiler_output: list, errors: list): + line, column, error_type, _ = parse_error(errors[0]) + + oline, ocolumn, oerror_type, _ = parse_error(compiler_output[0]) + + assert line == oline and error_type == oerror_type,\ + UNEXPECTED_ERROR % (error_type, line, column, oerror_type, oline, ocolumn) + + +def get_file_name(path: str): + try: + return path[path.rindex('/') + 1:] + except ValueError: + return path + +def compare_errors(compiler_path: str, cool_file_path: str, error_file_path: str, cmp=first_error, timeout=100): + try: + sp = subprocess.run(['bash', compiler_path, cool_file_path], capture_output=True, timeout=timeout) + return_code, output = sp.returncode, sp.stdout.decode() + except subprocess.TimeoutExpired: + assert False, COMPILER_TIMEOUT + + assert return_code == 1, TEST_MUST_FAIL % get_file_name(cool_file_path) + + fd = open(error_file_path, 'r') + errors = fd.read().split('\n') + fd.close() + + # checking the errors of compiler + compiler_output = output.split('\n') + cmp(compiler_output[2:], errors) + +SPIM_HEADER = r'''^SPIM Version .+ of .+ +Copyright .+\, James R\. Larus\. +All Rights Reserved\. +See the file README for a full copyright notice\. +(?:Loaded: .+\n)*''' +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) + assert sp.returncode == 0, TEST_MUST_COMPILE % get_file_name(cool_file_path) + except subprocess.TimeoutExpired: + assert False, COMPILER_TIMEOUT + + spim_file = cool_file_path[:-2] + 'mips' + + try: + fd = open(input_file_path, 'rb') + sp = subprocess.run(['spim', '-file', spim_file], input=fd.read(), capture_output=True, timeout=timeout) + fd.close() + mo = re.match(SPIM_HEADER, sp.stdout.decode()) + if mo: + output = mo.string[mo.end():] + except subprocess.TimeoutExpired: + assert False, SPIM_TIMEOUT + + fd = open(output_file_path, 'r') + eoutput = fd.read() + fd.close() + + assert output == eoutput, UNEXPECTED_OUTPUT % (spim_file, repr(output), repr(eoutput)) From 6e764b912512af26883821a4124b2e41f85acc94 Mon Sep 17 00:00:00 2001 From: alejandroklever Date: Mon, 1 Mar 2021 04:55:45 -0500 Subject: [PATCH 099/143] - --- src/cool/__main__.py | 4 ++- src/coolc.sh | 13 ++++---- tests/codegen_test.py | 2 +- tests/lexer_test.py | 2 +- tests/parser_test.py | 2 +- tests/semantic_test.py | 2 +- tests/test_cool.py | 74 ------------------------------------------ 7 files changed, 14 insertions(+), 85 deletions(-) delete mode 100644 tests/test_cool.py diff --git a/src/cool/__main__.py b/src/cool/__main__.py index c3a7a18e1..96fc56bf1 100644 --- a/src/cool/__main__.py +++ b/src/cool/__main__.py @@ -95,7 +95,9 @@ def run(file: str, verbose: bool = False): for error in errors: typer.echo(error, err=True) - + exit(0) + else: + exit(1) @app.command() def serialize(): diff --git a/src/coolc.sh b/src/coolc.sh index c685089bd..65621b026 100755 --- a/src/coolc.sh +++ b/src/coolc.sh @@ -1,11 +1,12 @@ # Incluya aquí las instrucciones necesarias para ejecutar su compilador - +# INPUT_FILE=$1 OUTPUT_FILE=${INPUT_FILE:0: -2}mips - +# # Si su compilador no lo hace ya, aquí puede imprimir la información de contacto -echo "LINEA_CON_NOMBRE_Y_VERSION_DEL_COMPILADOR" # TODO: Recuerde cambiar estas -echo "Copyright (c) 2019: Nombre1, Nombre2, Nombre3" # TODO: líneas a los valores correctos - +echo "coolc 0.1.0" +echo "Copyright (c) 2019: Alejandro Klever Clemente, Laura Tamayo Blanco, Miguel Angel Gonzalez Calles" +# # Llamar al compilador -echo "Compiling $INPUT_FILE into $OUTPUT_FILE" +# echo "Compiling $INPUT_FILE into $OUTPUT_FILE" +python cool run $INPUT_FILE \ No newline at end of file diff --git a/tests/codegen_test.py b/tests/codegen_test.py index a21322273..9cf790b31 100644 --- a/tests/codegen_test.py +++ b/tests/codegen_test.py @@ -1,6 +1,6 @@ import pytest import os -from utils import compare_outputs +from .utils import compare_outputs tests_dir = __file__.rpartition('/')[0] + '/codegen/' print(tests_dir) diff --git a/tests/lexer_test.py b/tests/lexer_test.py index a21fd880a..0381d0335 100644 --- a/tests/lexer_test.py +++ b/tests/lexer_test.py @@ -1,6 +1,6 @@ import pytest import os -from utils import compare_errors +from .utils import compare_errors tests_dir = __file__.rpartition('/')[0] + '/lexer/' tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] diff --git a/tests/parser_test.py b/tests/parser_test.py index 166de45de..3c2b8ee58 100644 --- a/tests/parser_test.py +++ b/tests/parser_test.py @@ -1,6 +1,6 @@ import pytest import os -from utils import compare_errors +from .utils import compare_errors tests_dir = __file__.rpartition('/')[0] + '/parser/' tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] diff --git a/tests/semantic_test.py b/tests/semantic_test.py index 46f07439d..f0d1ab414 100644 --- a/tests/semantic_test.py +++ b/tests/semantic_test.py @@ -1,6 +1,6 @@ import pytest import os -from utils import compare_errors, first_error_only_line +from .utils import compare_errors, first_error_only_line tests_dir = __file__.rpartition('/')[0] + '/semantic/' tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] diff --git a/tests/test_cool.py b/tests/test_cool.py deleted file mode 100644 index adb8011cf..000000000 --- a/tests/test_cool.py +++ /dev/null @@ -1,74 +0,0 @@ -from pathlib import Path -from typing import List, Tuple - -from cool import check_semantics, CoolLexer, CoolParser -from cool.semantics import CodeBuilder -from cool.semantics.utils.scope import Context, Scope - - -def tokenize(code): - lexer = CoolLexer() - tokens = lexer(code) - return tokens, lexer - - -def parse(tokens): - parser = CoolParser() - ast = parser(tokens) - return ast, parser - - -def get_programs(folder_name: str) -> Tuple[List[str], List[str]]: - programs = [] - results = [] - - cwd = Path.cwd() - path = cwd / folder_name if str(cwd).endswith('tests') else cwd / 'tests' / folder_name - for path in sorted(path.iterdir()): - s = path.open('r').read() - if path.name.endswith('.cl'): - programs.append(s) - else: - results.append(s) - - return programs, results - - -def test_lexer(): - programs, results = get_programs('lexer') - - for program, result in zip(programs, results): - _, lexer = tokenize(program) - assert lexer.contain_errors and '\n'.join(lexer.errors) == result.strip() - - -def test_parser(): - programs, results = get_programs('parser') - - for code, result in zip(programs, results): - tokens, _ = tokenize(code) - _, parser = parse(tokens) - assert parser.contains_errors and '\n'.join(parser.errors) == result - - -def test_inference(): - programs, results = get_programs('inference') - - for program, result in zip(programs, results): - tokens, _ = tokenize(program) - ast, _ = parse(tokens) - ast, _, _, errors = check_semantics(ast, Scope(), Context(), []) - assert not errors and CodeBuilder().visit(ast, 0) == result - - -def test_semantic(): - programs, results = get_programs('semantic') - - for code, result in zip(programs, results): - tokens, _ = tokenize(code) - ast, parser = parse(tokens) - ast, _, _, errors = check_semantics(ast, Scope(), Context(), []) - assert (parser.contains_errors or errors) and '\n'.join(parser.errors + errors) == result - - -test_inference() From 1e41856d1300d2d749f93157bb369420ad4fc3ec Mon Sep 17 00:00:00 2001 From: alejandroklever Date: Mon, 1 Mar 2021 14:52:41 -0500 Subject: [PATCH 100/143] - --- src/coolc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coolc.sh b/src/coolc.sh index 65621b026..2ea5b9992 100755 --- a/src/coolc.sh +++ b/src/coolc.sh @@ -9,4 +9,4 @@ echo "Copyright (c) 2019: Alejandro Klever Clemente, Laura Tamayo Blanco, Miguel # # Llamar al compilador # echo "Compiling $INPUT_FILE into $OUTPUT_FILE" -python cool run $INPUT_FILE \ No newline at end of file +python cool run ${INPUT_FILE} \ No newline at end of file From 7306b67de1a68412359c8a04e1044c26d196919a Mon Sep 17 00:00:00 2001 From: alejandroklever Date: Tue, 2 Mar 2021 04:07:13 -0500 Subject: [PATCH 101/143] setup-for-test --- .gitignore | 11 ++++++----- .idea/.gitignore | 8 ++++++++ .vscode/settings.json | 3 +-- Informe.pdf | Bin 60796 -> 0 bytes Informe.md => doc/Informe.md | 0 src/cool/__main__.py | 29 +++++++++++++++++++---------- src/cool/grammar.py | 2 +- src/coolc.sh | 22 ++++++++++------------ tests/utils/utils.py | 2 +- 9 files changed, 46 insertions(+), 31 deletions(-) create mode 100644 .idea/.gitignore delete mode 100644 Informe.pdf rename Informe.md => doc/Informe.md (100%) diff --git a/.gitignore b/.gitignore index 9a60321a0..30c7fba32 100644 --- a/.gitignore +++ b/.gitignore @@ -388,16 +388,17 @@ dmypy.json .pyre/ ### VisualStudioCode ### +.vscode .vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json +# !.vscode/settings.json +# !.vscode/tasks.json +# !.vscode/launch.json +# !.vscode/extensions.json ### VisualStudioCode Patch ### # Ignore all local history of files .history - +.idea # 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) diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 000000000..f7be68ccd --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.vscode/settings.json b/.vscode/settings.json index 33dc370f9..fd0ec4fff 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,6 +4,5 @@ ], "python.testing.unittestEnabled": false, "python.testing.nosetestsEnabled": false, - "python.testing.pytestEnabled": true, - "python.testing.autoTestDiscoverOnSaveEnabled": true + "python.testing.pytestEnabled": true } \ No newline at end of file diff --git a/Informe.pdf b/Informe.pdf deleted file mode 100644 index 8ac0af9f454541a0ff6d174b79a0b8b4948810ff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 60796 zcmc$lWmH_twzdiG?j8sPx5k6J2X}|Y-Q8V-yIXK~cZUGM9fG?%d}N=!&pG$rJ?^>x zz8)>BYP~hrELo$wo}QCTR!D@Fk&YRbk(hzlTHg$oiwl-s(bT~LNKEni1|kij2Vw_e z4q^ym4dM)91wss>_pEFK7qUbFjAiL+kvmGXZe`u>`Srf42s)d2eO( zu4MqB17QSVdVgnmZy{@EZRltK{6`bHcOfwd^ZP0G_ZQn=22HK4g!CNVJrLq#Vqjum ze19@9GqEu-t5d@A@W2AC41aqH_;-(8ZGgn|!Y&S?3J&irVd)k4i5=`5e;-H_Gte782&GInf}f$3j^EV+5KzG{)=5!0Ly)$Knf%evpb_T%r8n%Db@LO3~{}!*kNlq{#EgHL zH???QeZ=%47VisN2xwq!2>fl$-r@b$vxId?Khct`Tpqw!Ti5A!^c_manegY6?Ydi{ z`yu?H7qW$-g(AI>{|C5q?fyDFncb(DpKMz%9_*ihD5KuIoL~GAgHP>I;tzPRbi7<2%kNJPwr2)+-!3M%>pQtz zcaR1<^DM4z*5`GU)SCTEl?YPTM>prUbzTn+D!nPZEUmB`RSEqnE!2Xi@p++&zUoA0 zMR(4&G@qR5czL?bbg0_{YvmKw@hpEH0E5=kGJ*wgG?E39`n}&Ct_^CRQizJAXSpgk zc~7_N;3iu+U)*0-Zj-*!dzmxSB~rs$gije>Rxn z*>Am#o*azyn(x}VLh8R8ym~aac-Sl2Jx^~SFmj-7(SiwX;VRcsmeQp3lpUW27I2oE zI8sC&>KJT>nX8QWHvqk%Iy_}O*|~Sz$kLU2a@yx_BnZxw=LYUFuNvAl9IJW>Huks% z*=A1~ium>lv}}V%5G!2gE0Q5cWw1O~)AXA*+c#U=qn!aWcek5$`ag4~sqRb76+>?e z)jdj)))rsa;)AHkPrLR%bnvTw&Q$2WGqt^b*$cAiOuTe}p!k|VWz|RGAbT?Ph&T8% zN7nUwkmz!IVx%<}_;GpbgBWUe=Jy@D$WEWF9%gFbYN!e!Z{u<8+~A~RvDrL>KhIU_ z`P~`VeF74g2Y`F*`*$HLWeBZVF0TZj*C=)z?q%26renj+Y(yrV4QNe^^+sy|LO zj|ajUe>h&GkmZG&Ln`^ZXz|IPD92+}Yg7wyW2HI|NLd#J`l%CE~ea4X%dRt31# zmv<#^jkcL}3#xDq}ewJ~MQx(ntO(cV7Y48}-@p1_|4nm>JwUACkA&bWm=qgFV zquLhZ&Xlg4+wt*dj%NV35LJ;NIP~rA*`Fo2VWy`2B=Wo;G(b>X$EkQyjf8YQXMeut z(3W-y1_s|@Dl@Jf8NHCY3q5&SptE!q`GO)*si>!PN6FmT(vxVM_4DE=si=g9Lg@(k z=Rq))rjEy>(}gB?M#s^qU#@fU;kr7DckA80(W<7-%KA-GQC4Q=Tb01m0LyJ;#i7e| zOvsn*)1$hPfQDck_(bSrTGUIXZie;VJq8Bs5!jJ^QbiiGTGfxb@PsrDI2=IzoPRjkf&_02ry_JVV}>T|np zW#g6s_02;|4xjI@7tA9uR0i%bSa#9iQy3P3cZJf5OhF@3ekVOzMAx=*iZ<1qK3bcFFD;qb7c?9O4}kI55)!%GKf#kFAw{(NU=q8GHZ>sl)yTB zCAqd@hV!-&MS|B)%cG_$#OJ#R`o0OfViV*at`)gwR8!1v```u0)X7}y?dypj=sxg=!_)K=D+-CxlK|p+I*N^V`9CDc==K{45r34#%PEX76#@yE^rdk?h=A4S-MJ z3m4Y7FO*7#6%6JG?6(AL$`TAvN!cf3hHUsmbzj@HL?yFx`1P70xsn*T9_NUfo<>uK z+i=LOWNlj4r2E12>3UUtmgUj}h3It$?yx$-jvmc_3>M!mecF%g9t20au*Y@;Kjni8 zS%ZfSEwP0W@`WW7`6wbc#nOGq2#-CeN4FD%!g?>o2-a8ERizMA18tkcK%tyY{rR|} zYvi+kD7-UDq?SB3(p{pMxgJBN+%R;rO@<;<+IiUsa*Ens5S;;^o-{?D39kzj_QxD# zu`XR#Bor_Lno}oplg1!blwsB58p@(`PgJVHGRu0GEe}5xMlO`n&PmyfL2aWpumLVT zML0FH_?^6n2Qi8bm|i>E*M?m#9lftl6N2n3dR&iE@j*Wn16jVPX$PJKxzc}}V#%}A zmBJ^>WJ>Fw-w-6nHYZFgpT4kVKhmGya;D9k-2$#(PiZRT;?Tjgf9Umr;r$gm9sxPp zh9uY>fk=E5rw>Ydk8U{1j`Qf-2D=;tQ}Vegi7JJ_6n*Rhtp@@ukjhTaZ#wsr&$tKG zFf|rf5{9+xhg=e_(Jyg0AtNF}$sxHGxHC~7ALLK49m5X5Z6@(k7LDv5dA3H)UPp^) z8Pwvzb7fl-$!y6_`4xxB1DH1-#az@==02v_r4~CN4O|6sR~F# zj@db{y{z!z`NDqQVy?Yoxy-TSdx@-zhDm*FQ0<3(uel`d6Z(ch+q_&Q1QmGA;*Bt} z)7_1*VCq_9msW{8kResn2;r3Q?=YhnrF<}RBMbYZ!IpariAD|Aey1~Wim(k95Ez0q z5rtvVrWa;k7Y~OpRCSwaV5Ej>Y=>9|#hjP4!7S;u2R_oAVwa%?n)Gm@N7BOWjfOtr zQ`|_fc2l6;8eM?{UgaRSff&kCky3N?+eNy+Zu9Btb&6hF1R%0s)wz$&l?IOMMn%>f zvt@e?dgdMYO03$HpL!&sAB`Q$Q7tUk-5nbxN7;U4iAT1o^!Li<5m4NxJEJtWs1W4- zu)QD4_O{fALWZ}o0?3agc-foWVerxr3E;Me6EHr9!Fi~mML*w4{)NC_ijujpx zX!vv*jOh-q9E7)=iX_Q7!ij%M=29ATf7+bCulBi(9? zmro*iT*)L80WyY>ncxrr5m04GY=E~b0BDPm0jn@fRRNC_Lm*$1RJUrj`H z@6emx+?q*^w)xVGfi!+RVI-a+MV2L}iZy04idvINiIXfMQxjBMaaBgvliVXt>00?m zxMV{bih_KY-nZ~zzK9}Rv(d*dDLqFlPx_3`dQ=?38oHmGb}l=BY87MYpsW>%XJMqv zyz=pws8->cGnx!UK%2ca#9i7qn_G(##*YZ_3!3HrOk}+Zz!i>g_yoH^z%m7s;`pex z-kP@Iy?T#Q{ow~$R%>po=p;)6vM&W8u0$duTub0gi;D#{d%Y$C5w%&x(&`;?CUoI} zFmR`-hnUQ>WUUP&PP#8n9*CoN*jgRofNgJ5t_c{Oy)C_EIvNv1ulSX&fZ4M^j;my$ z92-{r@*D(gp-9fNn{N>ViGiw0@HI3JtIMHf+uC(xQ>p!>Hc+FQh&TOlqijpGq1wS^;Y}pZZQ)-3tP^o%~usi4(#`TyC(}e{lO|1apNW5N%WLM3fY-Rx)3JUvZV7UD5W*&V?{ zlLo>+Bt-?I?R0#diY8j~7-`|UwLw>w<&U?#mp19l#js%5QGW@lvW7BQyg71AnUZj5 zDygU$MX5+WWW$w&9IaZxiCbG~qk0kupf;gv^|L~(VXd=x_W9v~T1Tv5Sl!n7l~ujZ zBqf|}8|BuODKyFco@?(0)1_dKBLahs--W$%=#s;?Mg+>>Q4hlJj3{xi?neQo<|@UN zdgXe#~brWHY_s3Fd_#_`&(=q(U;HCVUq5GfAoreYnlRLylzbcNVGNU#K5-KH25Z0QnH>67t+B4IQGDpt@C^r@# z-fRbz|BM84&A1-uP{j!8KOhUyBZg%=ls2A^PZgEPTWx*tcisPy z9o;dz#y%tlFJTE#KjN^I#+e z8bl-ZX|Tz=QpG-vDLoER%;XAUi{S7c;^eAToUiBY1nlB2)^8PlS{&d4FsQ;kr7w=O zTqhb_5+!R7*0jmjoi*A_vK0!#_k!5pu#LH2oOIozxWMgU2!tmp1lz<37riHwuMCgtZ6?dK}52O7P7JLA>9- zon&Z`+GP#1qfmH@6O$v7IT+8r9TiN|K>pXhm5bK`$FJZO=*HWIjd%v&&ztJcG>g#J zwl3r<3O_VYG;v(}l0Bq0M1FFq^0;M{gGMK#Q**sqjq~#w4T#LON$s*xH&olYQs;7=MCAgGZ#{C2v;IEEr*~z9+QS``|eq&D;GHiAZ0swfnrR)BL`SA$Go#8B^s)QPEd}!Iy(eq`(-|3DGsZp!| z0x+Hl7*7P!pc-tX(PeGad0i*sR$Pp4?87DlW_|{Xzb%D-%`Yvp>!wwitvPl9Srn36 zr0BaQoI_GczdwOzGg?A82J0uP3_ME3XxW+dYn%A~4lr;JVDI2Mu>{f<&B{dHH*Bc7 zKt~YOPtrNaF;K+IeOV-4g?0Q+*LfB+(XK?GoG?2K)1n!kBGRDjSgFTWQNOIjYn{m+gHmbh~{moG8hpYI|*a(mb)74Yg_brg=D8BFbJn zxYAZLkJNT_IqYDlZoN0;K;)+{Jaj%3p|KsKWb{Q;`G)wrG5yEexvz%f5tuzDV&Sa< zdy`2VoIxw#gFhMpN^Z_vzwEgfAaMb=5sZU?@lo`FK26J-U7LJE31fP^`e7?U$h2+U z5IFBl9ZRN>8*osao4C@isY?@jsfV}?SJaAyH8Y5DW<_J?r#l86qeU8M z&(BCAo|q>=B0H%=yV~@;1#Yfp9%B!)jV5WssQTATK|~BNL8Eu`MqxE}CFD6}YBQc8=S!x~}&FUxwd zTIXImNXjMkQ|;!P|0h^9A?}}{3SFs`3TB})&t7*F2gQ^bYA)E3`}^T4^k=+!qy?C1+=WhNBGta7{v z8X+7UsbrJVly;t4N|%Glq3@VSHn?de-xKKCv^wJ^?+M2?vjb6`%4qdYXit|kww5$J z*i_v$ddwCd01Ap~I$*L60w#RSThbnyqg9GHgJ7D;J*`pw-%&{A_EQnnXOp*D81W9d z!W^L83lK}Fo}BG%`+xdlxJW0Nq3GTv;<-z5i4L+6oZxnvmPSz6gXo_Rta3u^I)16T zNS$zhbUgDvn|{A1sqp6De$T5uw>h0_%fVIp7$?R10X z5r;?AK>%(R?!KE70eA!xM=c1OmekDogV6?U$C_F!C#kev`xQ#RHq{i? z)^|i?cbp_&8i-2nsd=TG??+~6Nj!m6$I~RHnhb0)IZvlXD;3)Cj%4MPnhy)OfL5`#F@uZtU zZjQDu0vT&!{G*I-PhbBNh#|lQXfD)vkUu{AflOsww$O^a#tKTRXiqM^@*t5F>eP@a zR#54CjU4+?)dy;h`%J{Li+qzdKhg57l+h|ZCc=Y~3;Xlcb9hsI@`lXLVRQdb?zB%T zN$ngW1>=^@N@z4}i`};ViIM&B3TmE*ZroLf1<~~c;;_T`I~35FaenUf}BkMgx!q)2F95=*yz~) z2f$|fC+z-rEfWCnH(JKOfcyUuI5Yi8p#KG&nf?UBe*$NwKZ*2z1kQi7`~M1@|ANc( ze}kU?H{kq77ylb@{$pJJ>dl|Pndu+Un_lEU1Lx?KCX|l5${&k9zz(7=k}kJ4#BYKi zy^tQzcF;z(jF{WP>G+p-g7pil`7OLRQV7EJMoj}tv=aGYO8suts&03ClW+U4H|wXX zt9#zgcNgoelV9dE#s}V7HYb7o;*9A%J=I?);cim;|G!Q{Jvtacc(D{;^wtw}NS?XPAuVHMZWgloedZo$+!I>02wWxdtWic5C!CEjFHRBp~u04)x9aLTSyUlWghpi%2X%(PZI* zm{BahbF(KSEo%Knxt)b+f@>|BrDSdBj>r>vVw!44acD!qVxL`}C)(($y#d|V0RPsg z(M|e1&hFN?XZyS5uC=cOyWq4c>B}FsHXHTkD2I2>pGfMWT?vT~pdJd&I*->p;T4ou zlh#{o?W_mAJ3Q7QKDF)0hnsh-*yGaLGpKA!y-V~N?qq~vvm=T4^ZEK$a4ct={>uqWmM9+AH@ z^nS$7Q|;Ej+76oiFsw^_ju?e0rWTAwDe?%=Oje37kf$9=JCHarI~qws{iQVFkSi>U zY6P3#Tye^Z^DCoSP!5zqhG|<*7rLs&TyGcC=+$(Vq1LG3Bw$B?DLc1ffELe)Jalq4 z@Y8S>4Q^DLFK#%V#C~n;VL$sq^4IJ@a~^*3ocQlFIoc6lv%yeOzkXwkQ_whvf#ye% zfQE;1H7b+y+lkhDmtDck-NJC41(<$O{`}E2xq~j(YVk7#70<Yq_zMD{9&VySzF-ROofm0&;0Z5{2v)owjMv_g^xjYsQ(TdhI>sR{+6GJ)a zcO$=??`@fj+UqF6^We4~J?$GRj`f%;R1sND!SuorePH~YHC3a1A|pLLh+^#Z##=+0 zW=y#B6(KT*i9^WndOY&8#zeDur0{j$|3JErV{RHD#~kYCPHXC2JG%H*5?Px{CA?_P z(Z0P+000v2X7VfzgG?Ds?+Jct4$F{nb`Z)0&V0cXc;TrT#sMQp=D+1<*s+NI*v06_F;d5+wbA;~pvFIm#fA%4Quz>U$~fX6Q6jg@P~@ zac24~QA`@n4HIlFfK)h^o?L!BP`!=ISO`6nGSC!eETEbc(ThG!-2{N$UnOTGA@@tQ zP9fe-PN`lFOeAx z{K>J$?z3(t6gz17yh-PBE_)SMH={&sV;~3Yc7#4VZ?|T5IHtdl9F5DND!VRT+Q!F` z{08FPqG}*C#Ko2DH)evn>4 zr`a&fMT#31=#Q--4j~NH0QGMHE5hAuVPzT#n|LaTy6k7jM&3-xirpK8+hZm!lTfF$ z1tq#TK|3SAu**Ib8G|B$LmSm$3&$&fI%9)!sjGcKS}sS=Dx$$SH$kV8HBwiEncRrf z_tz&Z7(=(m7@!D3IHHtlu2Ciq!i^T`c3gZ|smW4gty0Id27*1rV?#saB^P4P0~;aC zgsp5WCNXaqDOV)B_Qys@R6l%L>qZSl{Xl;RuvVCl+qy*`-AqkX`(Z^yAWd2k=ij9r zh@cQ=TiqcREE^{<2pku{mr^7XcH875Ld;Uw7ldAkb!r{OO#!a5fd-?manX)`L070L zGbX;U0Z|Ovb1v(tI3y zO?b?v{(zhif-;fIaC{`49L@d>DT)m<|HXI8!*3*JVW~Q^ZCnzH z6%@f^$*w@Q52FJm3}>>RAcR8|p6#VLV8MY`8YBAXca*r1Ip-9VBOwP0nAXAt*px?k z77_URpI6JWSPIGxz|js(BqHZIQw44fM*@_W7vrjHJ3H1F<2aakx@%v#2wuF{v`0-~ zcRc$I9T@-1#9!&V4>AaoFR1zrldd5taz*3LO0bdVYsSq@mx`OyrEf*s%2JO;3!F%Z zi%{>B54HPj8X1IAGj*j(WFsh|qF$@}ELuyA|g|bi5@kF4}jd7^l&CH!$!STTE*d z;5|6qxy5}|B%4%u#ce$O!4=YwElL{jG?k?*t^L+(xJ**03l0Ps_bEjMDASMw1dFTD zBMxpB8IN;e3ei&wIUqk@K?Zh~kM^$5>A-q_$%Ojed-Lh}M8E6l=le}Cc-~l_)U&?X zzqr5YhWbjF$)NUoy0q_~?k)S%5WTThCEP9?skP-kS-b#DX%T0)WOooW$L8bPuq8ww zA)wIN+RJjBMw^)vn0P0C;!z%@*qJ2wR50Nb_}Rx8#Rr+YX3F8JJEmSWcTO-#{CVe{ z0VH}^cqb_k$}N~UM*;8EQgiFS^61m$s2~|wbx#vk->fj2Q-v33dW=x4mPstW#1-`B zms*=+Ai83fd-5+G6{tQmrZc{|xdi93j4pWu)N9e|WWwf!-lQ}-KSxMrXpIL( zH^I@Z+AAxU?%2XD8^?zU#ixqJw>gEF!#tEL{^&{OGSQ=pSAZ|)L88XyMNr4)4Wg8J zapiP_S5Jo9K^H7dji@N(hszsa2%Iwg(W6LRMA5{p*z6+AA8v`+uFYF(=Ga@N&S4=j zp#*nZr;9YJOLf$fz`dpwzO7+|ae{_eU$;x!np7WUlgQEwvug|Y9ohCg7Zj}i(1DK7 z=X`K_ftKM1C|GT5rK~PrNEwfEQ->@Ob)C^o_3gZ?uI?N7g%~y`q!%KhT-^C6;&it>&lrz>+x#ZLrD9D3^2k zYw)0|w2p))>Q^xf74;{Uw3!qGzCg?aH>>F2f)n)E%SL32f# z3wY3l?c&R|l*~W3O*_Ae^&e4c7^8FZSFyl(BU~%9<|IbdK?5_pUG^^M!fp`B`X6$- zHD2+@$q7b#p3v)IF_K=`nfoL1C_ary&99#oP<#qYE=)h9Z{ejnp)zW4sKGn6EKkk_ zG{2hkqi2=)I9B);gqH?U8`&L*4}U3EY)e7!QR8*b+3z4KHv9kq)re0=owhBA^z&!p z`ap=Bmt-s1gJr}-J`$oUG({&zM{iog~{)m^gm2BX`hD% z6kxg+KQt99HeVCst#2=)ANogoLb7C<{u+Wq9vg#-b~dJzlDnrpPkGUu@r+qMP%sI!|wx8q~9tZyzWNsN{JQmZ;DDK9aH>T z2eRvr6BW#!d;s<_S&htw2jz<-<~qW(8ePId&8zX${N1X0`S_lYy16^^3glOEkVVQ` zvgn{MiRIe{mnW_kdtlcZHY+f<;>C3l9=NfvGbtFij?g-#nc{ri5LhrV(DLHoZb2?L z3)aNPUIh>>)+PlA=`MN&v=5s&rbMlvb8nXq5^d-~t5>n-XX1nX|daX%l^p*0lXnIJLqLMG=!bSz76DLGB(!BPo*Tv+%EI)yW zzCuVwo3(MXy%mpMA>KSswu9fOp@}C`HG=6A7yh_7UlW$NX21z7wWyt2pxs+&%jEog zgn?fl83J*JP&zJUXhITC3XKNNBRRl{6-SYjI3<`;gJb!fTzf+#yqw(J<&z}*N|C#b= zRN^(Fc+FQX?15-sd3^{2y(reoMuLDRB1RG>3X5wIMuu{{`q8OVp*%gYZ=yUMvSsIp zO&U6u(DZAC9UrmN^=*&-H|24^dp#KSZb@2w%j&QYIxEM1I|$-E)AfgaIkm^iU-LZG z?y&4|UT4c<%bM}-v>sUZbbT~`yzZ27^cH`6oqoqW#TR?4NkQ};%Pt2`IbfzUI^Kca z2|Z0~!Z?CvScBdK9nWXuUwIum5v-5=ktIwEc5d76&(7jQTITshdEu|desoyh{zUe4 z7=Xj`!{u=YN~1F&X8He+6F+KM*YR3zBPwo!IVc}dH6LdOpt#|**W0G2gtRM-9BmdS zV0>AG%i?TM?^T|~`8-d_M%l z4S4g11Gwf7l#oW@Mm8-3H#3?6P!1?7*(Ae^^_WKh6VXTbC11_v>%gBmb*S}-M4qVL z;Wvv&)0kQzqF$v~9Z3=}#@Rgn{28wy*En^goInyeuW`npOkvVru0{BY zXRftV!hd`M%89E*hyMTv+Vb;r^IP#f3Rv-l`7Y+-q+5x;Fk|J=VdX&F&!KOaw|Td= zS$D4*C2H6hy>zFLQ%K9IqgOHwdxx9zF9*_hz*+lEgBJvvQ^h?uHeuG$y2H&guXUc- zAiUMxkJ#qpP!?%o1&ceqz3lBC5wFhQG9f7AQob;3Y})6lGN>PJUJZ9^UwZn9tS{2P zoVU5YQ94XJOzO1S+MNx&aeFU+B56~Y$e-kO_7*ccep}#viw#%`ykO;T^v-=1;*QB0 zTK8ys4JBUB+rA7%qsRwKB$z|k+YpdHU#1WIgP zZF-}+l3|;6cIu$)QY83<2KX?EOBfEboZ-)(u)w)lTi8T-K0c6&y@nJW6_XCjv8fvu zv9!0bsP7fBm}=pc@0pZ~sk60=kC-G_rAfMXFSIobn@iTw9n~ke)#S$qCYzk5CKL3H z!D&V6mR-TLLnI$WYF@H5^KY>aJof6B>=u}m1Sv_Um<2dxd^O>xFEq>Vtj{kgfRdj5 zR)V7u`J>_rhIYSSG4j-sU#YgF7+0BPuLNbuktYYDJ-H-??l`t&*YUHXNeOGQ`uQyM z31^m#qV#kQmmBymnB!Pj4C&9p3g5+Z1ad`abDJkVD^=k0FJVfG*j4DWpvG||;wQy1 zowPKd`N$h#ZFvFb1|MZc$g$!yU0mfgaBz0vWQ`WvZiLCx0R|Y*bGMV!Qx^gI@Udt+ zUcG<okt}V$gi6MC8%+dN;M0&>32>e<~+;tiF`DpFCfp~s# zubMY@3+-KIt@0pq_6goNL=*yLK_s&<4j0DgF#33WD-=-JopsUggP%E5GIiglL zXJFPglUE#5$fE$jXU$?@X-ok*dkG}h9jH_fQIk^|D+`$qq`BpUb}nu&)H0LDGd}L- zP-$d7@=qW=nw9=caHr>41!*fjgLSiS?)@>i3EVcrYW==t6S$P6Lph`rk;vyJ*n3IF zUg5BoJ)36Q=!u~nE`Vh{68ggA16?0l`z5R41y@Op)(m0i-}dotN+h+CFjRUfs* zgGqVOi`E3;?$oWJ!}k+S>w-W{4z;fQS$;`R>{Jk!{x zUi?KyCSGVX=@ZMaA+awv!$(df$)MD_3rTYXsVRJvf`I&)d9=FG!I~M1-PfE6n^_PH zvGJ;+A_7@?7f>Vm#nCWbbdB%mlE0h1VymRbzGvf{+}7v=DVEAh9lRErQsn8Fv}uNO z?jfJTQ8jv!9ix>!mQA8BhGaGHb_*L=LqZ5ozUd)Z*uhPrujpGk? zqb)K|B`2WF`5$H*KujaY+08j}yla1ID?_!_Nc?iG3*$l3m@+1CIhU5j#EK85dQrR% z)0Fav%hhuT=dNlaOsureIoa`jkMW?ZY=vvVE-}>Cwj*(9y`;QV;i;D`__&9M{FLrC zt=l!K6)z)zn!2Q0&sf0djaT^k_>(*|4Uvstnm2VRV7jXWqmO+bm0H@?9?Qfe5K`SY zD3;01Do$bX_Vb9$h%&jA`nP-+#rsW2CvSO(e2c0sQL1c03``eSGK@-GLT z3iaZ%V|hKGjm&3X3S3nRr+XiC;7mXwoeFG2O+Ss}GP2f3RLmgY5r#y>jmTLduXbV;UhpJvBPs(j>Ov} zL7mboLZI{G$ZBiyz*h&rQjV1!UPJGv?A~BpZIRn;VARkJVSv#8+$zTm-k09BG@m<> zzSBB2nDay~8gnbGwHyxVIJv$T!B+NUE?+_>@n3@xj&ynLUZF!zuY(*4#{==cp`1&C zf)`J0khvY%>_`dgZ%z}ehEg?Uzm>;OW)ElloZfBw>k`t69fHsVD>_QZrli=G1RUS_ zq}q2oAu7+d1chB2Cy?2Lal>V&$FZ=G9j|@0dTKo$%Jwsln-q^UA<-nh>9q3<`(U<% z--nDLKHiU_d_-qhw|Ny33`1$`OHEoUmATEHd4oU}`ClbiPx2@=K>RE5nsx$9+r4 z_W%IUiEghov=&h~!M52OKC(MGbGgrU1rqjOOh+pg(#4oY-N@%N)=Yje{7_eAE+2C= zORQv^WT0pTUsT8|ltv(R-+`Ph1AIO_QG{#?u9a<*X@bpbE@z@h9twt6fJ3X#*4@6< zYVusq-e`aZIHX_ha>Y4$8aeLdU)w5I+2_>2yB`&MVD72Lp&jI-#U7L(r)Mavagz)( zZm?UWmx%_I7H~By>>WR)NzQNa)?O8JzQ#2UY38siRL5s2cNZ#EZ64xtG=L3&0AIqb zjUvU<)RgwrVp#|u%)&Fs)GDiIn(jT@^#`KtncF-1~o(Gsv1#M=oSw%hot-h z5h>wMaHNVn&%i`rQNu@OmcHOjpoKHCvOw6wcDYqCG-GKQpDLFzC=)PND)mK(u)R1e z8chn%PXa^abJhD+cqAg7#`6A`Za8HA85_XN4!n+D@~Hp-0hihNfscj-y?a`siC>R)6>F%KhBvBxZ}QRd9%o%RlsO|EfYqbbb{Y+*Bn3Mb ztR|wq{!u;6mXqCFs)Q%av#e==siR`c!j}o?S=Bu;ch3=+rY97yL?&gC7C3}?wSfIC zM=1q^dI7yUeg`GP2EoAk@rb*m3M1DOJYzwrRvmoR*->iyT4WT==%2MVYj_Kj8lX>V zU&+j^pPNAM)9A!jjUmL)d#pZ?u1fdlLkT~;1gx>`gg6F_`V;I$9G)N(&UJQ& zh^m>iO=FTEc57-FA2XfRpOqIl&iL_&3sBc znn0hx6?=1^(XSvQ6@^l6P%yre(Ab6tCW9ZXpb>H!$>RiEAW+sYi%-`Qpo&U4w_1qwRbSJY8WIMKGv89&CsLUrJqZpM^emJ*O5sNn(d3|P0^R3-+<3@^ACr*;U;}Ei)+jiI zMjiRJSl8D5?>3x4{guNE%zRR^r!uVe)&o2EI;avCR$S6&WzZ#Dq1(mWk&CLM{G9U3 zvI!(qL)z=aoj}bZbJ_S|%d6(pV|FbAVqiy$G02Av4hQ(l>%qv&Vn{4Ay6*X?r`3N% z)nV3wi9=Znl?Pwwm1pew-$0KME`)~47ag?I;jR7sCakW0!?FwlA;!a2=<@fjYmLys zQv=S5Z1p&)WisszY|tJJ;%@-YZ}RXb;Q42u5a6HLtAKwC6k_3E|C>zL_vG4t7|{4H zTEO3Bx&r$Qv|YsTT3w#nav;15f&D6x27Uq(Aq-=3#DJf1H*cR604 z?t#7PrD|_FGcOO{SfS?!CL_0*ysR=iEw$6;$M?qf&hL&2y-!ECzi!TCMVffQzr8Iz zZ)fFPB;8A{z7r%>t7R*Yir#4YgXs52A>2PAg`N%WM&DMSpS7+u*ffr?(F90MhKQCWco~smrvmI%j$!6L*RbCxtUky~A zwo*UizG@REM;!>9N77OfsE#v%>La2yAh z*T=(!=$n-L5}i^??YpR?_5+Ve;-o&t-AV!CZoy?FE#9fOyJAG^0vC4~d~C zT)QqL*G|r*fH(^ffIyOS4z$>bm{_>n`VQ?_imn zVblM5gym}|vp0;H#oH3s3of6f=9`4VF-fm+r_RipL*L>bAP&!?tFIk`; z8@YM8gvZ807qd??4vLdkFG+RhI%z9=xRHU@w=_P~UWpm2L$p#5=_~JaN9MSabTTjWH{*w7umVri-h|*u=WGW8kHgxz>7B$>- zyKC%d2*wpHjT!FSD`f*dI>ty7CGXLt&_4n#ED*L)(_Bt{Wk2OUNFv*E3@mdYk&WNjw|&V^1`(!k z!B^(a1e<=oUSjmb?~a=r$1a=x0HWp}Squs+3fDfMA0)IVf|e z5y&(Ueh7<10fe$XDq;08$k1QQ;=AM+@vUlYMWnkOh4g)CzNXEFq#KG=xou8C(}8@+ z2{k_FLO+!i>D?#{z(=RlU8<_tI{$E$s*esW6T+LB<5GBlco0pUso!g5BUSXgIia;O zqfkzGb}3|THwSRZTs_6+^-*4dI=+>RK8<=H)wW~ryo4fYyh!oNI;t~fumppEw-9yt zj=ZWoxA1k_IB4E{>-IpL3pwV{h1hw*;`EM30~bHukA9$3k!t-LT2In`uU-3a;EfErUCvRkUw zGbwRW%BG6e%cOkDy$d&Tdcg87A(?1TM?MV%I-WqbB}oc>D~8gI1A=zpaSBbLZs9^8 zDs`NV&j|%#q&^a6^tQ1eNnxa&?DZUvs_#$BMgnKj;4-x2iowc)W_vcM+I+Ua!|vm8 zf-$Bd*G=3> z$76B-GAOmC0t_ZWMM3PMQ1LH_PW{TjaKJw8~N%^jfJcou@ENg|n)wRwV^x^b`wujYt@|5Z3J1n6nEuMld2E;kcF^othrCB>Ad;6ruwt7N*%E>~r zrnyJI5=@@C)iK3cnybhJVj~SKTxhf#+;X0Ik!gKszhA8^ZEkv81yWHa!Ooo<%qE@3d}>_rl&5p4Of@a! zk(ziZ8K(kB7YVf!Q1td!Tne@m>{DTK9i8wgun0a^#O@0<57t1~?v@-yj>3f9k8#{_ z$CpoO-NLQA)YYK>9Ca?76MUdzr-PR+=7^$HeGcDIZTxJOM(?eK2rRf$5Hn5zQ1n|s z|3BisGOCWHOB;d{T!MRWcM0z94k5V1!Gl9^C%6ZKI|O%^;O+#M;O>Nc2a?>ID>L)X z_h%OCu)3)tGephU3-ImVIyoH1aBJ5%e0ZUjdz(!gx67Bl(K4VY9Mf!LN`*? zKH2suQs08CM~K>Zv2mGs1ZYM4%*yWa)j4H>H-XZMU(_0gLS(MAg5%I~YlrH2ag>cb zNvuVPyf*YRRh*A?D;i9VvF-`cEpddCTqLmrMTM@Pw3Oj>WueMeWiSD0RJzJ!Gng&f zka0+PIR>hLH_hM9UB%xv#D#-dmk^#Z#mj<=wQ4GnbB`QE)9LOR9-k!{XouGF0r;N1 zTB(S0Sk~NG^p2ap^p11#@Q#bv9KPWR`S`jHuXk#*rKOmZ-fa&3%Vj*3vh-&*2@xyG z9A`?kwD@MHaCz}tA1Qw05!}S1p%|c*NiHB#n_%hIkDko_+Wfq$F$7?hpkq89hUE`a zsjP=THHjBDK1B8P6llh`pqx-0E6jlJ!AVyeMHhv#&vHhZmRfq8Xzfvr9g_c;Y1zmE zXIho84H9mu0_|Ka+E<)_{I&-D$<&#e(Z*EcLb zzyALp*Edhs{aO+HAFpqI8OHzI67k=yZ=N3U5&3WHn8rL3^I{ma00&HI|N+=^7m1bXr%^wbwgdX}b^D-@ljKZ619(nK=>bL~JQbb@(>=&hPpH=Yh)q zQ!_l%^(R1*gUtHk{A;@ zmh_js?05&?K?>wP1l4gYzfMyx;tQ5Fu`L0DssS^C=c>*IuLJS3{r5}QQQQMXeKlvC zNAr0uzu;`gLYde$hId8}`$F9dPloi=>a1RNy0@%4ao=^Kl2kCz&O`yt{jxBPt|6)Q1SnbW>5j0h(7{@Oh}nBn-M22oVQOW|e2ghxEcIk`I?!1WH1kwW%jgc*Qe1D8TVE)gfO1^Cl9 zt?7fyU5N2a4z&rS^YIl&qcj57B_7G=i87gtu!U&BSh{Wh-c$0CT~U;rGj1DX6vsk< zz~uyVZNnEl$@zqcm(i(M7+9VaSpLIjW^=LYp8z(nhREaaS=_P(5Mq;aufpr0;VDCj zH=VToAY;4VMW6fCzoQHW{sN3s26Y>FcJk_>9qXZK+ullnw)EWfZhAaFWUF5EVXh@e zHRA{VDKz!J{~lD6QPP3&#-BZdC8Nql#^|$`u-0h&KCSkI^Y__R?1zOl=3XKXsQ!G@ zcU+{6-yiHR9Qm*6n{gqjhjdHUyaPv6IRI6Yo!fowEt^;1;X1R3KpVO1_rAAJHu8gw zC9Cf)4=o|W&QMfKC-)Xtc@#Z|BVWz{$dl86BA9?TR;Bsr`P8SVE+f5XWzeUbT&aA| z3O-Y>-6K;p*PouabV*ALYJQQR#xaE&74;Dw<+`HkJk?QP8I%M)26NdAZh8iXjcGS& z2vCexqjB+9W*=XUcXpi+iTRRkPoFk+Kuw*NQ~EVB^rLhrk@mcNjaX8|Ijtp_IJvNw zIs!(IBUdR1Hp69GP^qF`HGi`7yy=MZFm9F%wyppdkzo4KGiX;!2SE07LU9cKQ96*F z{n5#fcnP9=oSG(1Gz0YNLjU%@zG%S_BHe4Zv!<-n*+`%<$A-!1uEY%H2;UVOYbkz)+{DsSwb z^mi}hL+flBASM-cug3ukrwt&q>O`9SC9s;c-q@&FtdNt^473^Xn6OA!w`=V7{Nbof zuBqPGCbVAkpsbi^lF#$?axx`bw_9teUEauWf$`LKeq#VGH}Z4B%tR7X_&Ov03gu zg5=CpWE&2#t4m?KclbEpaHF5EH>`78Gt0A<(&c^-y6S1aaQXt;j4C#n)Q%&Oh6R(W zAQIv2kC*)10RU%axJpZ3yR&2pG|s;xv4^uhS|&+dWcC$~pc!>uSIVn;YYx&N4$G{* z_M_7j)p$s3 z7f&;AP~9PdTsTrD61#8bzz@M7W&_&PP4W&tMD0f{N+qxE@1Tj!T#! z{UG<@)F2OzJ>wHbG;d7Am0NeX2da}kg7OfcbW~-%
Yi5rWtv(QNQ|v{?a=hePr? zMlFb`@qexh+tGJ|kw@q`xKNOazrjX~Yx|W5wB}g8Nc#OtTPCvj{)TUYy`yo`G zRxz3{TpoYyJDERXmhLrbSoP*aoD$OiML{ux zsLrsh4z3+l-l3&JuOv*CFE<>np={%tX~L#0|FX~mM8p#1`C3{I?N0JoQvqCRcAmCN zQ&imm4gSE4rQ?dQgP)2=1jFZ8)M{L}w^&WtNPSfs6If~UvYIHBPPMP97pa;@2V&mR z@P!Mq`e4D787-0&xQQaOHgiWMmpqH0DJFzg#V`A!fC1A`hxv7K)_Z?_tYz zYSy#7JNPu|yrVvS(1nA*8KDb4>!+biel#>_ZE2HQR+_&AbfdD)lc!0W3Z<-Bk6(7q zjn$T>7|R!7I3@h-c9Q4SQLtodiZ_e}_^X}|@8b?-l1@SbZDJjY@|P}kws-715FE(Q zY&l~Sl$GEHRU&OtG$z=S7`fM@ZG9jd3lzSA&j7U;2QIz|G_9~n*0eAlF#1gwfr9T2vl`%i`#nYsjW=#f)#+6 zp2xZEX-c70CjTmVq&6FG=;2scxBzHlg>p)5WnL|oXU$k-l#l+vz|P>o$j;C`Y8iti zT}%G$*lE-qB2T0?;37(By!Oi>dw?iBs03i6$T)nsZ>6asuWWFiPv($WI?{VMNe>UD z{cCufj8GoeC`rbd3rAJ1T({o7cI%1@=TbmvT2W2h#Sri45(XbtJnz(MHMJBWnK)Kj zhA}?Edziv=tnk!Mp;LT&QEGn8sR^n&$tldL-L)ymbFk5H+7cY8w6Qjht`M+o93I5V zG}ok*O!V}n#J4i#+0UT9aK|aXTNn?7T>cV=jd%t#>~NV`5#ZKY-#WuAH^p>R$42pd zGy+A4qEZ2irt@22RV4a+HIkywa|(~HMJxaJ#KA(Z-01|QM`LcA@p#pC{6e>!247BV z76|Po(Iu+CqC?CZ*Tf=`|IlPoRG+=1vWHvxUZUb|(9$+_Og55#pJ_OM|GX$?5kZSO zt>W^QvNpB9pee;awvc&Kc{19}vKU-A8Io0Pb?ZwK;AAK-hlsM_J~)lms5z&2L~(m6 zE3z~aZ1_Q##S1pgBE_Y0EBB_KbUR_5k8=;k16@5#aUsBjXCrXQ%UcvZG|%O2bYE3L zY8;XzGv!e(;{ZT#7>T%Hn(A!TG$-{Yq?Uuy3IBxw7MriH>cK_bln%C`NzOZ}qGp!F zN$W+i>I7u2r1+Y|iy5jlTO>e&P!I?0n!tesGNO5J_sbQx)sk8|EBNN9ah#MFC*a;o z>d)u%NGU;yoqWJ|Y>?%GwyT^YPHDGswwG?oLQWxJ`M@`rwjz zsBpOC&6AgERSu@SD>#0r73uG4wdh`*fJfD=Sv_NF8emRet#U%DZX3d{zOU0ANp)kU(FlIF~XSi9QCxOmqRoU%}>Bqh`BV<;!K3X#lA8V{F z_2;IxwQ*>nMu}RqG6M{9^0|^TjLJ!Rr3M&7R^4?r-PIjd^(9=_@p=)+2HBFNO-6|` zJgeqRgYc7;j%R~BVfWUqd&aK5Teb%%PFhK=X5gWlQBpkJZF}2M82yZf%^!x{x+v1v zB>}BcCWW>Y!yJ@Esg{ylQlXwMBN7a&*+Ny!)#jhKTKg&`nbklxHszMUX+`51wmD7) z>(5gawq-&FwFt&`D>PrLddjr-Dbd9teg4Fhx=o{_)IR>orFlV+oIL`qnY;H(9eZj+ zJO)3mpiM=cnMm|Z^=dvTb_9#J>FhSEpbH`^jf&!QKQ*ALsX_&N&^%k!tbCR;O(^Hx zr`*cS7D=$m0v7)1#&}6EuFWGR6NqeSGVQIdq^vWchzNKI+2>KsHoCqx5=FZ*v8Xtf z;%B`o(9Ngw*IDFdC zzW$y{K5j&eF`e zmJ2|0KsQeio>|mnL!E+qcxTbbn- z8}gU?GBPp#ixrvW7t8V|bMi!i09{2p>N`C7FqSs6ws>?>4D{Zs#l*?*$4!_S8UOG} z!OY0=XFk&(zA9eB(hCCY41o@NpF9@>-9OU{JoyV&e!8=OfdkOFHLxl|dKE!4* z63?%P`bh_|{x9gD-~D3nBk3MggKZ$Sm4g!a;QGvQg!(rJRR-RFlcz0A$yQE2Og5L~ z>7=Q6B@=8IRg9rQAO(0h-AVt_`u*!t)7^RcA<@Itmprh&661BCUySq_vv)Qg_l@@2 zJ*|y_M}Y)iB0GCKdykI@0zWO~z4dzT^{ou`%bU*cUV9G@k@DA4?q<%bckOlyi10Re zo}N-(cDd33?kl?3%G2%R)3QMNG9VkYkLDG zc*m$k*L3Omc3f*P{=5|EOr!HCkbRv7U;C>HMM*WbSdaEd^VEDKi9ySZpgJdab?U{V zxx3fRxcX$!I44u>(cFE6kFc{4aV5%ZuxVQnZHG)TDH=+*6ZC3|c_=6PwV;gR?R%88 z*uWY$qY|6>Cv=4pyXlqtkj|EEbZ`?rwlL2b^Wehu~f zWSdEbWSa#HAuG$`7I7m|DnM6Y9b3dyR@X5SSoyc{31>?%82H)13?!1=#LN*cs&Wgdl{y~(6C zwbryBTbOUP#K0pUs*6TA?5KNWk;17ofWGaN;e5Touot^wckLE6 zFSP_kwgc5LQJank;H`@&Iy{@P#$DVy;Y)8N=y=)0Ht%QB>fi-yXZd~6f{bSIPOm~Z}>w_(gUZZ_4Z6m8o3=z~%B z#ZBvmKA(Ur)UJ#0@yE-Bf5AE!48O(_{BB!=TG7K2d}t6uRsAM-RL$Q~|d@7>~j!x9&rgE6R~duA0kFO}8%ot)^)ajvX9 zGB^8uqn1AVW`=n~$4q#|Gji&ZcUA4*gn3L|U!+j8yOc(%(CwNm8sD}d4QTb`Os||I zs`r|C?SG9v@h&+T6B}*TCxw8`#>OAnupRthgHVdg4Q0c}5O`e&+pp&lQ<PaSqH$vU#c6ay*gjhsfV*hg7gSJFQIhdR*v z>sxGte6@_af6oh29In7-5^Lhf_i?vCT)hF(kLT5X`(=@LLWlK+BfU%wtZv_} zts0aL0i;gdsiC4v45w?(51&KJJKex9EFr4yv(R?->XMLy4Xcx;IY5CeSTTw;_g zkXM;zmKfisO)3yhWhJ0=Q9C*G;f8toACcf_3*yL~BM;`9JZ#xN#OGEH&Ywu(35bNX zzCOaOY>F|zCn>Kpif~l?zPg4eQX6d$s)!qjE%r~fAJ$@JtPEoLJQ}rCZSW3?s zOLSmd69i5d5g(Dln_=*MD@3m^=ze<ob% z)%am%aaL|9eJa|;D|yRB3vJSq6;{nC;)C)-S)cZ0WHMqJvamb1Qr_+E#v^~mdVf&CMQ6wko zwmZn}>jQKWt6_6{)s)Kl)Tymv>w{vdGT*rP%i&a&P5aR0)TyF0l>xi-;LjS>yl++U zwCq&Dm`x51uU~T%b>eUrjZ92uRhoZ^t~9q=YN*bsdC z?WQzcXlY@$%LOYtYxg))*&#PhcChItMmiPA7Wu85jNgX`sWL(qwkO83d{Iml#pR8XWo?j)7+vK=81?7X}EUp~uJ)LqD-ifk= zM@+4!J^DdzVp=NG=};vKF`H0VU~JXy3zDih6qk>hVBK)6GgTy3JBOMLjmdNfxNIkc zRyKS=Sg%*v2X9tFrN^&Wd`-C8GeR{LWiMsJ8lukTSPSZ8T|Z#4SrZH5t;#rkF=@!| zx|{1+&)b1n;ZNZuUNzZ6b2fEa7572&R<1;yYIEsUOmilcIoI6$CVfw9j4_gVez(&e zrpDu}0>=!+4u_1#*)40zRfA%XP~APq zPEiJT?^O$FN%L_|egPSV6XE%MJ=(c|$R5)xbIhaWXv@xIcM;FFlVa`M&R$x8=~M^z zYtxyPx%Wrwi^J{K<-^`Crw2p5miAf^KGMVy{A$+)C|kNBPG&+a3kIMJch2+g>1h)y zQ1G8Y*v;}DzguP3OcCDY%K~X-2qZLY93IvRmVgSKz`s0AV{anxf19RMfy}sk6+wcJ zQc7b`^y2d57~d&}z?s{)kh!zv9a?df6W2iEO`(kiqhoM-jta7Mrd3U6;ME4|TY>i6 z96a7S*rtAjH#9;CGWFbMK6X+PsIdbvWN@wa8w)4!AEvg=_DF!Ia%sNisW2V?$_G(32 zDEVH4DAUko)pPF=NIL4bmD%uBtJlXXl=;?*CT93_Op}bOkci93%t@S#83y@oh2r<{sr^~CjL&lnq%?&6r;D>ZIJ306k@>Cajx4!A)&c7zd^=roFScDAx zs!I=V|4cm?b+rum@rZ=qHvFnU>FmnO*NaMQ@*=r<&535}7)b#aG!x|!Ndb=WKT`U+ zdan(!rz@p9xs0)=HGnC`iSp@4KnBBdBGHoSq~bNEEm`=3zPAo_$aApM9$ivhC7C-I zl*G5DW!qzgUmLlVa=7}K{E68@LuS!JW(Uze1&7QUJ{{9g=_^s_Gb?qGQR&A}>MJQA zFA#(7JJt`a*u3g_KI_@LtRJfuq5+CB8cGQI+8g{F?qvpvIKRn{1hF_j1|cX97|d5_ zlu;~kel>6y)8+d#3{uQo=%tkIm1atxE8`bU?2OKUiXRE!QOHVj62y@V+)@gSGk^;6 zXo%7oaXF3ufR%A)3#kS?=A$803e-5qL_Z}?2T#x9SVp5ujnhbPzEY1Z$1c>}i{p9X zd*sQ2>&xA=%VE-k`ZbTGnhy6g%ov*(mYkPVojo5A4Hy{A;ex^@=SLUM1XA-xw^{%* zar2Hj%{pqCLt%cLwQZ?2y2Keae3-B`Bkv^K*5h7Kgd`~p!Yg137Ovrb#hP*(wg_pL zjT*-353@$h>NXwNu3xCXK$!U2TVHhGO2^&eHqVt5@yaxfhTeX(d}rOjMA9?jtQR!U z@uO@kJcMT^>m;RpL6BKmEVTiHej#c?v$o^1*tqc?%Z3ZG3!hCIMcQ+;VDPJ-g@IK45TXRpBFxYFT?33%O~^Q&+MaXuPyC&%)w{Kvi6P@Wrl@hg2Nx31P~W zX=~a(ayFo2nxG0wh{-Ykp0cY2$dyfZ^K`;FJs`@uf@^Qxy|%maez_};D1-xvP|2ff zerL#;@oobd%llWEv|&=H3lyLl;NdUCVAmXA%4#erH8a5z76nCMYq zEWTMp%4Bv5IFjyM**us~Aem+-DV_ z$+t>ZmVKm4E?QK}nDE(5X~sJh`i-)X2m(2Pe{fgV0e!2nqFR48yY~}?hdhj8a55N& z3d)uNcA~iKS zciMsJ%j4;(1#JNz+%WnzZtR_JW;zqpz8vX2dwpD7J#B6oRsR9_(LRBeA&|uYZ+_wV zr<2clXX8r6u_8jS9-L(!-0@mG#L)JzI5FZFyRkbWtd_6Q5p_yD6WsaZbRWqmJ;Z}$ z`-K*oD^xkGWHhaxX)JObILsTUx@I1&zK9&0rn>ena1xhfK6oE%G7scdUQ+EaQuB-@SOlIqw`^{1kEOdw8=Jedq=%xL(Nu9h zH=@lciW)X-z}^WX%^DId*ZxpFQ9L$KEy_2YrAE*g8TcKHL)EbEz_Rx ziNgNtqMBLiprY`LCHS zgiliaYo;0D(P4urqA3(I3MA%G(=z8=Hlp{$X!10mZFS^vp*v;Eo9ztzVG zj2_7dj3g-ltkDEmryYpdQy|L6P?avgpBOMl4;YN{F>MH91pF@y{BHyNSwE!>faUc- z?0-kf_M<`n4XNJ0B7HPL{6#XqY!ZKw%p+1JVEwW{ERR7o?f(lz)*w%q{zF6t|BC1j zSR) zVEtWgPv?J7@PC8F@;6wIG9(1H>i-`&vwsEmL*M=Y_d|q#svrB~`F{n+3WOp8;tW(O zyGIEDWd#5#*W(c(5TFCd889xY8BmJ9;!nbrcW*Hq+xv?@=rCo|@;e;r`RtAKSmy{Kr`Nvxoih zQhI6+wjZ+j6WG)1^&h(Qs4*r$V2|&*M?LzXS1!QZ$3gv1%@P70TLFg!GvFZqIHo=+ z{O@hY`eUpHw#7e`o9S=xf8zZE{|~%BwDUK-zrQ1&4CHc-4wh!tz`(#i$CRHFh9CO( zBk||u?0*g@z@XJn*9+-6=ve|x9wQK&0PpfcUi5$5_2&~jos|Jb(gm8~?Tvn&g?)M~ zd%~yLz`fpS3Uo&k)8dAlKvLvnEgjf{qjP{{y2*PPPqQZ%@$AB{b3zFR(g z6FWP6nD9#OJz2h!!x`fu3HY9T2n;&Gf9rJr#aVIvXzS!|%jC@d%=V1&;hR0P`_<0F z(aFqr?74f|hwpA@dwlwG9m}NXDNU?ElfKbT z^(+oL)kl7^Y@wy>HWc!aauvLoAR%zLomAvnCOVNo(xJ7S|>~6319i!6`4!8ND z9A+!lyrjkXb@)tYxf~WwUNxf4WF0Hq*qfeDJD=)b5Aoo#;^W}AzX_=c&}-A+qJ z3PT?Kc0CkyoEIiT$w7dCzmk;P(j)w=B@zl#=y*N!Yu@*qvxeMToUO)l>{{t)pR z*$Wyy0{l;`Sg!B)b)9QT@%0In?%r1fYLYfDSG=s9nHMKsgBE?LSRUC#5!tupGzVxL z`l1twmylE%cnHkdg5YdG8~+60kZ_q;g7G%&j>283x0?1+l?b4#`y zR~X_mA>YFg`>~@!L0;no-~c8&&MyN#OOzW2S)$TS+zk1_eF_qp<{ZAO=ygBtw~csf z*_;-*I~%QbhfOy4OtbWAgjk3*kOZn&8kgHv#- z@tgQWq=<5U2!Dp)k|4MNlA3|&SFP#6*s~*kMwlJ&GrC`O1<)d`wCe}HW`)(oD~J#3 zlzaN^KrW`B4u+6m+I)q~E*ziKv!Pjl5(C%AJx)Y&2+`yw7nOejsV*G|#SKefL`elp zopM@pVIA&V@YdpmJGzlbEGbccXoH`MocdLGuRy~B?dk_ZWM_f>rlxgAUMjEh8O%DH`2I7epxS$`7?bA zF%QL1vkIAE%&`aJ`=vnmCq1JRIhqfjwcFM>Kl}B8w5We# z+8mdzw;b}z)j&g3&23`ZjH7(xPicRNt78?UV)T|_d$g|$+J-Nc)x+9kh!{j-t}9*@ z)RY{AvJsQ5VY(?78v%8FRz&?7(gS2fa`$Ho7&vyb(9}Aw*HYQ33Tm|t3Wu3rpV5b_ z)aPkUOL4L^h<7whOHa}8t8F8B^xQc4HnK}<%y4+oZl;WEuHIYZH^KZh{D!Xrn&vTJa+WyW4< zQPvV6)%pQdMs>O0U1eA?M64;%h?JzrrihbPqwn=7YlI4(mv6x{q0N@Irl`eOjR(n* z6lTMC7(Ecq9Z%|5gWVimF*;T)>6>u!dl<*u&kh6muJ5ssUSD#^e zv{W^;>8W9M_U4?hsFOV$VrxXP{L#Cph??VTJv%ps(+%+>a6l=N<2 zd(L}Z1q`*+y6nASe+w{&t!%)F1Mc`b+Yi~qS`ssg%VhqTiM|Cc zlHOEK`>F?H!Pa87FNi+!&O(ZZY}P=31l?_4&?=j!!bgcQ3?B+E-pK0R;OTp>5&FsE zd+W`&+Mc})lIjo|7#wl$>IM?aMZk$N@t!q=7cFOZE|$FNP{RD{My6DN8MhCn~7bBpQs`!)+iC!i*V^ZI`R=ZrEim)ChpExlftj_`M+rFF zxPk2S24i1D><#HWQBbMSEq9N@Ey&IH42vYTB14@E{qATAo=`8(UFtd98DG?1lMHoh1zDhtnfh# zvZEg`V9;l)FGlb5uJ6u5SfOrbM&%N9RX#6SYavHS;UN==tVL&>o+k>M;yRFyBXqbG65!xTM7uSeQYadLHp zfy;U-Ov?8V5e+Kk0Z48>56$^z7ZH-3h7ywUkV{hx@-wg+F56Rf9g@v4bhB(&hp^is z66>QR2Igz6E@|4!6;1Z9>n_VH?&!=PhNnH0!ypWDFV|jl^BmaM+1Wu<=I=~xHWO9N z`7rjJlOqxLBr^43Qt5>$xY=|sB5rrBZsa7RCfs)vM8c3U?OE;tjH0{luj;AsI`tLgB3^#F=O4-k)LKSHy=}&FbR>Rn_Wq#KWdYww@+>@q3 zOR+0eS=gK`Za+m#Xv5%V&*}PLum^`f411|1WnGHq|5bF|XnGupV{D|K40o#wY|BtT zKMu~t>2NSOl+Bgpg6+0V!eD*TBtIu>Me8|k;ozsP_~y5-&-?MdFj82~(VT_3WA+}U z;KF=GuFlyq`QCpOPBP+zQC-dTQaDCFDmyc5!#$Q}3S(^;pYw3sE1l=uZzv5Ns5z&QTI_?K(o zy3K_t9pG|fec6bQDvlTU7Gq(vd_eIfSG!A2JCx=8eD{`oJ=sPGCx-Hs2&2Uf4>&GQGGY9)0TQ=DLq+JMq@+P7H zYX=~yV_;`y;{dP&`aS@rW%aCp1c`!xuz-L7wVaKSwUVB-J*^=sxu&@K!LPiF*Ux&b*5fVVI z#>_y#+QiZb$cF%TO4u710nID6D^=h}{d61* zERS{nga>rwV8leo{tq($PXh=n{SP{Vkq`);33%C0c7o$4f%HGQf=E+;uC1h&%(v_z za?(xml1d$wSokFp;Y(0tWOqWJAn?p*neV_+z@JGVA>$H=%+0BmbZeTwVpgTj!CTL*S%8-M44cCE&E_mCn8TiaX%8ovYj1g#b%dBl`g82a7rMZS3#X4!?~mWw46pSB zQv#@$NM7m_N0`*7fTidx;CzDbE#TlC+bFT0#4V^^xmLneV}Hd~9nGRo^3o18f|WMH zSgp79%EGqk1Ck!Mo(sHv^0D7BlnW{mgOX=uf;dlDm_Z`UI(YmxX22boUMVeMGSvnX z4j?+-L`$4S*q)hU5G^j-WYOBVI-rgID|=}GpM;zcJeD0~uO5eSu+Mu6E5GTGE36uu z4Nmq6to=Ah|%0jBBaL$*rzNDm{lf(#dKTtgJ_E@O7`OQJA+YVEZ zDs~_$Nt`L4PS{%Vi8iW+wCY;l7%ci`>BOGDX^sRJ#!xQ0A&!OunZ3__yrrlNct@gu zBNrMEmn0`wR_Jy1Sta8$!#u_Q5SlWH7*EtQx}3o;|N;hfq(oJ=uZT!Sdci z@&Pz0Ks>9|ikK{}Hoo=L(HlA)PO>T!Pvv3wJjI==U3KX<(S3R%aYHS6H)3u2Y@wfb zd(Ho?2v&?teE?_h3HoMB3>`T|k3D=Zej?v=7h;t4|x|$o5w&5iG1va55b6mv#2#P3dSfS6HTO2 zyL%&Kmh>fMYow?={rN*u(Oje5u;sBON1$`QAa@mvWai5gOfg$%Fj1yj%6F3aLSq+b zFwsMlI%8{a_BGY;&st{a-8v`VKZsnud}}~B(V+!gE);8MB=ra065$dPctS@w%m{p2 z4!pwqHjwEbX(ksN%imp?B{pD*f)H5eIcXT;CuEL>jxQtx!MfIoF6fR6kIC%A^uavG zhxc=pgQF&MoBqzc<)`v{k2~vVvBrkev#UeULwR-->G}0dClI%rb+8&H3TgtRGCX%o z*!c5v+`!KdP{OJ(ZN+6vGZ&ABg1x%`I4+m((uY;^{yWUjg>4 zw;Yzi)@ELHKexf^S-u-7es5%D&19l|UEwBmto4vh&u_R~j+d|S5@CF*cmw-_cBXul z(|!^L>#D5ko%2a+be>_c#?Vb~s23bH)h_&pZFAYOq2WyJp!^M|fx6&P(Sol_6ttt_ z!4oN)`Bj2_n>(m}3 z6VPum)902yI!ufXVDB1Oxl+K0Frv&rWA9zGx3({RL2}w!?e9okOtk=+QN=(qg&v(Ok`}4zY+~SEu62#numX{9Z~jP$KB{yqCD=~{>s9Uj_rJZfBlS}*vR{Q9XjBy zP*+H7K9}8uDHV8X>GM z52V(EIbCe-QZP-_;-5ZGlcX3+)bB;>uVHJ4f~#RIZa3MCF*%T~8p|6F&F!bd`wk^v zP$5q#9A8c@oFA78Jf3XZl(JJq-paqSWOa3|8xTXruEV=9ovi0H={Xy(2Pq|bm-60N z@vvEq)cEBkS$J|WIN(YgZLr*FHp7YetDErCn`PaY_kstqz#|5|2Qn$|VG zOJ(v324qr$#lDO3{6$fSCMufZ5VKx!%G~X~?SR_66K<(yW6oVqk=)U(+6;9k0bu^6 z&U~GP06zCh-@rjxTAcjri-9+D1HI491+knzg0#x~m>g)b|XlgUc~Tsi zWtu>LiD|ibuA=7OoUbpm-VYi#Z&|PibP#rqg>>9%zq+}5+F>Np9FX0DcV=(gC3vD_ zK}FKRN)kL_Fg>DJWZXrT7*2V%Rk{Sws=pOV_3r3uG#+Nn!>qKYh<=64M5_3Zm#kjm zBlr;tRg1W#{dC|6+a07d$g+>;+d$qWFCt#W)^Xe<1PUtG5t_Q`x|rce#X*O3L4%HZcm{;Sbn!PQ9xTEXpP|ur$`BN{p9@ag||Q>ERBg390F^|_YRxUZfJo| z^oj+eyw9fA4DNUKfD!PH7Zy{mtuh6NTZEeMD}hcG$&(38*Wd|CFoE%JtS~aKQH{qA z4{2X@p~~R}veWT*_9kHC^IW=a8|OQ6w=R()eA?1YWE6xcOM7RW&-1qQbOC*I;cln; zFr9)(rnJkwaU&R-8$L@JhpGi`S`W3iw)G}{mUg-WN8al&^%^B8BJ0&E`c|Ry%BI?N z41Eg)zCSgI6le~efJ1!dr0cGdbV!wKq7Xca4BvV5dr}BAS8mOLxCn+7p6Cy`syVp{ z^J=lB*p^i4iVBAhd7^JGwSz+GX*^e1DmP)Tp-%0YOXiB;BwW9ZpQ+qBtDs$4?8K>f z&g`;U%;4Wm84_ptdEq%G36g@memV42lYwzo?4&Fd$Cqb4tBdHXQ3IM1|4>};_c=To z;P&-v_Mih@S$TMdz|Aa3QBEDSF`}8?Ku^hh(N}NIOb4jVa^pN-@h2U$o$OLce@lPu zR+_oAx%);{UB|P3;ZoSF&kOCv3zY*N#6rHq#da632G4Ia0y;-jI>A{=fF#I;^U%YZpc(1SCWd1*E&#d($c1DcvpIAV_yN(%mg7As`LXf^k?MGv{f>G{v%UV^YCK zzC4I>HRzpeFlLd_2vGu@3YpTxD%qsEM*DF6sb(Qe>OPeL&#84E~<5k|%P-FBbu zVebXOogdr7i|&1igoA5@$Hj32vFriYdVO zKs!Gf8e{?YQ@6S`cu@yuz-kdqe1TaDoz7zq;k|R)ftjRG{kLkhY5ZR%U13Ki5ULiX zR#>S(`>xCFqP>T)?_j73Ua?oyGg~Nq3Yzc?;V?kUH_)jLYsb+!<9;J?pfpkE^^lT_ zQ3bS<7p(w}?c6{>B_sS6T%8f`-Vu87Na7)pp`?H8u8p&>rcW+?!PhlJ9;U|C9~E4sAJ*DEv*XpHTbMb_1;5?t_QmHY_FP`k-yyxgWMkJ{4B=HK{gy96f#q z%Ab?xdhu50Fy43yj8lHbSCi)_kHk>L7@(Myb1pdv(o5Hq6>LB)zc{|mX}wTAP$ovr zc<_Eykq^ShvajK95P(JM{WetG_cLl=RKVbi3>Xmn8E>U$Gy@EQ6OIh133=$5Ff}$t z23aJ!y_A0nzidq$DrbD}YxXkenmv|%kz6^fUFNxAf`r#4P4Gk1M;Um4x;9T*{sTSA zXy3OFer-PDy;od}gZHmgL^eNzJ0BxAd(x2B=bi4XR?NuyJi-Y4$H`})ZcRP4q3 zVLvBi{HkU9et$ftGP-ia^vtc%^lPNG_=nSrUFp8@64g$VrFMI@jaHKK>I79@)cT%P zAri>pi~X>r8n0o_Z&7UI_%Fu-s1o+JiLfpE#WvjLpVURweJI&zb0~&vwikZY)w>HUKhk*{7WF>lIoOa-t|Jkl&vSDo zhVt|6jGRkg!?@@72_ACLB(TNO&3|#wtshu)aN5W#yzBy_D36I0u#?ERK9M0F&|EdP zs&oFN>m#g%G`~<9gY#n#cD3M2qJ-vV_*#$7!zF|wP&3+bqrZf48OH`=Th>Dyi$mF*eHvdtGUFtr zL@up*f?uT&DrY}vVsa6B%-xS3#e4WuXX~rki8wCCf_;#%U+y~>qz+PLsHUc$<3VvHY7$2C(e(%?)ke0z^vC z&4>VlsIP5yI|3r+M!?WZTU+SL>D%HP7y+R{^ldEctabJAb%5bEM*#TedPYFJlDo6p ze|62YEpHqDA3PsVbGe#Gn zS=m@>>*`x;n;YsQaL@xEE_@C_;Byg^&X3pkSBSjd|j-Ap9>+t*3{u8(7Kg zOto*k;s2GloAF*tq9C8B6o;rEhtR@c2=%zke42 z{@7RG3)M>E*Z*XptPNFQlq&EAy6)!%p=haRj90;Xfmk78!JBm*66F)7_ECA89TL4| z^(CO~(M|J+xV}A?U{1N2%en%M?@b$*nquy#8N^c0K7{vfg@06!n7VdX99@u6P;aU+ zR`}J!tV`b0p9PN&>pI} z$oZ`E4^9}uzhs2{S^AcqCP4~Kgf``8n~g+fe)B~l(g4iD=}X?F*WSytEwF?{{MGUX zJV;y%bnj!{G%Jewz9fyU0EKGTa6en=S?331Rt0x@d3We{KKr~oNPGNarVC-2jZ~9Q z3$CG)q$gC?goV#Hsoh41!!W=TRk2vqq-~Kp5wxp=V(J z2Fg1-U*r7jipofADFAJlC-1X)Y1fEQTQ8am%0r6i5YF_QY*lYJ4~rkQ#|IaFY85jg zPcW&~D$%2@>>MDcy=u6mj-9>?N`r?Y(Qm2{k`|j~X?<#qw-8FEGLjWUFUWH4n1^x2 z#=2oY2AVpZYFHicGLk%imUCWj!tc!!F0E%M`>#-NeMWp;JQe%dHQ)+ z2YuPeEvACu8>+8lt;rChZrso-yYhGBm1`UoTT_giA3nL*I_?pkTbAhUH1feAe5**& zjEG=N3J^(HhaE6`2*YAJHCncjIcbAoAUw15vq;B+XD6wTZmE}4heL@|#kM($e&fJl zp?OOrRDsO9l$v&1eYqgGyJtBtsXDaCV%&(kg+#L;D8&!7d@EXHe zVBO)BQ%IrOwsx91SYET5#xI8IDk380rCuC|iy*n%V|;d#u~N3g={h!TmKxI?SVPP( zJ6s~aN2v}*8ZNeq=pA~PP6{OFFTm@8tb7AXZsO=2{2|(dy21FRpN=2D3xmh`$qB0! ze0=hSVO9+U&F>iUu#};rTVob#RwFNe>Bs7peo1&R$upU#lpLWjT;1y6r-bN-5wbP% zuDBgt{*Qwz)Iz{oh9)r+$`e7yy)*`DVc40^OJ^;*DCuapHC0-|##Q3x&PS6Tx_3uR z8QWfkM;&nV%631S%xPbuPNa7lNn$nJGVcqIosvtJ78I}UMe0Dys%>n2xoqARa`JQ` zH)_)vZrE&a^JxWJ6aB^`Um2)K?7Fh=%|{dGh?q3Sjz1Sa{6HxAS8?W3=eUF4Mka_GBR z!+GS!A+Qd`^$I@rFJj?67KI#rgrN6VHQo{AKgro!<@HQ_O(92%oo?waZeXUcFn7Xq z{_X4TW42hY&)8$s^GrN##Tu)7F9gt$DGl3bbi`h-YG-}0(&+6u*hkD^WBp~H7gOd~ z8-hozQuDTZ?zmsn>#*|LA&RHGX=j zQ0Y$r!we&#2amR&oU+#_FUV?_09104?WaW-~#D-(A=HcMv>Q{lnN?q`pPhzzR?b6#5uah#k=rLJY} z?IWkgCsBWgED@9|m1(?nd2DzUmo0tB=-Ep=!P24rdMa6MSH-<{2tOufRB=DS3GeCz z6D*?p))}2IU9|>5CggE0nc5l&U9b(`V*JN1j!;*wKC8&FF;KSVOV?+ORWBEErarPU za)~(pi1_u(VwrTWK)GV{s=DACi{n8%Oj((a)o^0dsiBQ2b*$PZYd;H#k)m?EwY7P8 zJ(fW>=edfAvVwu4fbrM2vF>|M<-9x}y4cukgheNQ`SpO}F|x;a+}VXyV?>9jeXN=2 zVX|9$$G3N%{qy`6B8>*%Ft&v%tBpL6s-ZFwzG+R4ET30^-YYt?y+8;mY7*45>ORVg z0UPibb=w)7dFiS*#nC@qo@0o8YJ$SY55K({e1miHB`_#=FR%R|$bHtbQ$mhM$yZ8^=te z1V>?-i-~N*=#I3Qb?5UaR?M@q9=PjK@C5~_hGGuDBwhJtNx^Q32tS(vA7-v zm{Y4Au&8LOk-b}ht9pcb#wLmu$D4j$H>=o9maSaKQ=RRyARKgIo>P z$Bq;A_MhDrdG^IXt^Mj3W><7m)w+mova$d3a8mg`* z>7KqH%0z0*IQZ}{J5(?S3KZPH?p!!h55!}n<8WJSC>S%t0ll@e+hfzzRKIwlncU$= z_~2TvzdWjoOGt}aiKZ|!UC&6OTx~+;e2C~g{^e%8((Lr=W+849UdcW|dDQWN%sP&1cu<)*b)U(9^)QR}X|@GKLx zYo6{eJix4Bfipwd!$CrYLjH*R&9JyA@%f`nL9#w61RRTkw3HvTUbTmBQwl6IwO%~w z&7KhrlhGL4*FIJ0Uw)bB=jYS}Ln<5*LHC7>eE3l^+_srN%NK=^uub>Ah2)slA29fq z0`OxejZZ~qMOH2@syxsphT!sXWSx(e)h(v46E=)pPHL%P7c(&4v2M3j8n5dJ#xel( z71QTRpC{=vMSF6Z6{`h;H0Lz|SH8>-kIPTynhATOCKudw_1cS0FRC1guGw0rGB4Dp zp{T|#);$_Cc)PayC(68Jed<(UZ?PmC-YExgAnQK?L62)HUfXNv@P3;$MAM77~jXvbl z5mg@c==`w|dG6ch@s!nPaH`|-ap5j@!EO`7lP+xI1-Nm+IR}tCBVkZGmJIw1-@=5} zZtl^O@^PC-ZZd35mcG9fKnNuDUiF7p5grvvujD@0vE^2PVX8wLnTd!F@vmA+23j%3 zAjw}QF)A^;F?@xq_~k=n$FwwD-G+FTDwpcMjN8#Pq)DsL9rq>ph&LEMzq0aCAK06d zHjsorXRF0-+F$>QshIfH0v^ZZ_3-z(u~CH4b!4@pr-J5R!?v1V(^?xkNvX}W@Q;d* zsbqSTV9m{CAGjs3aPi=!9gO*g>|<%{pmWxezg>WCaGhq6$je>r3Vhm;hd173gXftT zG&$3!zcn7$E)1lhp8l@1soU8`8z7Y>Bxov&Q=pD{AO&Ku61}-$q(reR=zq#yl`^GP4Y+@&JF!ifqjB~UH34`$tiB?!X|g1 zD>Q|zy$O02n;ozB=d5>yU2`yIhNO?QekFx*Jfn*WRhtftbFvQWE+yL3cv2XMh#%XWsS+2rnARjTPYhPBuSI4&@Tz?D zeX|CucdGBwAO-5jhMgpKte7f?zb-50)REI|pzM4H2M`sbQW*1uJYRm-NeC78qHKX(JmLX4!4ey0b@*L|3shXJ>=c z=Pfr!dsfY7&yIFN63LETj^K^`Un5Coz-r-EL90-qzX*PorEkBZ7M1X@JAc!`Av>2L z{h~pNYv%pJXh{9sY@OrIeBV@b=fQhu+@GShkO;f2B;P_45oMVXqak@1NWb;0|8Riq?^CUq5nLlLk#PD(M!{ad^*S~dlgUu;B89tk zS{o!LzJEqeI66^F)f7*)E2hD6qXo4V*O~L7iV8B!xeLeP>41{2e(LYGs@3hcNs$wBi^k&2EhMrNY)oB$xZ>Y{n*eFn>6u&6=_R3Lkh4b9R zRiXO3&il>bYNoEqmk?vyqpfXJSl!^>D_pL2z72fE!LOEk+a8iY6m!FuzS9<#6@{(V zo|2YM1}}Hr-0dze?61CV6S1<^I_7feeBEN#7b-MyZN1L_I@=a)CN4So@d09#zjB*y ze8u)aHc{@CS7VpkK1${yWs^6@BY)>zLat0T!#OekRuh&C8CQ|E*6=2l9S~~|f0XME z6KfX^$*dYxSvmX?{(B##m#hMem$X@!v40)C=m3-!T#99u}~!p_TRQ6cIpQk5wls z-ZBCuPA;Lo@|0km04Ss}YeZEct_wAb<1QO|V|yx(tkTD73dvPvgdSfR%P>!Bi*}iE z=s;^eVOf!=oD!g%c>Jw@4fjL(bia!P*iT(kOt#xu&&eX{eEyOA$pp+#`hIbQ;r1=9 zhH+wh`1c7mOBuBW<}jZ^*qa;3hP!imDD{fVzn35DIV|JuQ#)2&6kXW(Xhh__6Wq&K zc%~m*F6$_Kn!f)NIR)7Y83tMPm4?+xrq|3+=g`vlPEG5cdS??-6iN`50*xMN=+dA| zV)P!_wP0&y^QKH2X}A03SrRc=Nx&^y?|Em~2ffg|G@eNPHuy;rWyz!;{=`)D3J1i> zBGYkAqWkn9Uq;dLXYd9nV*8e8z3rm=kI}l4g@V5Pn0!s`X-7GXaj7q2U^&7b*&AuO zA5U!4hDk`QEXbjqLfjJo%OqOvx#fWvSwy@TKOD&sEN-wBxy2tijw6B_y01y>2(42T zK^(3k8{&r)M$#7iO47>@en5g;KAg1oQs*!!w4k{Vi{I1NJ3^#JHO0H0RtACO+1`dY z&W!ishD?}mTc&Aq?)oQ@!8v}cb=6?+$qg0NZ8V$goNszyBg%voy6O>yv2n;bL_3O? z4CaU88h>AJPR@o?1!-e9sHt10{5uolLS}s4K(Gpg7~75sjY=cI!hA$85lbd1g`2nE7_uqQ`UM!N*Y-zG7@q!y2Q0AO@c}qtS2mn>l{*F zR2WKK_Dg3<6d@(cq8E?*(o~5DOv@H7AS1-5Mgy)X+*K{i5*ZT0JS3rSQPF!_O(e25 z-os}~eLEbM3EKOlR%84$Sk8>8+3hJ|m1h;g4+NjUcN%_@D&A!=C+ZAwwp0@5i~b`j zjHDrbIt38sIO+q4gnU?}nQ_qwB<{J%*FLPE+PYC=uqrA^RY(FtMY}=ET%CbfaaDP> zXG=4d__?RNWrj>#$}*gc&_WT$N{48LK6#2i)LU%i6wfJt)Nh2&o_l3KDT~A3z#_^% znz0@kH$BMp_O7g~gia*x!^mT)$;c;Ix-K2{)lQ{@9;g12h1D4t4*%SiNh`y3q|$89 z*(Q5JMRmsCAEBg-asC8C@XUY!QD-N?&%4Jr(CEYB;79n*0K+*K-w#Jo<4An5sD(yV zz+X%@Bh=7i3c90hea!OnVYY@DD^F`$J;^RD^>DFKo@dC0IBYg8dSjGkMWFXu5O(v# zks&k)S?avyhhA)!_^=V~H1xnkSVh!XN6=m;d>)G6`T=4%<>ue+a+ZH$+Au=E|Kez~ z{5!P5e>$%JPXM}qxv&4PVRQfzcDs-Le~Zz9fbHObcN_>R1mI%8{(1;KBM==41mJTF z!1+xH;B@o=z6RiQH{}f$2LZPC-(Cmu_T99-Ic5d0yjz?O#DvcbTnBvX_#ogqBM=q| z!peNB8wB8dH#ppFe*oUb2*f41`LeJAZ9pI(s1tz20eu2tq;C7V(R(Ay48&Wy>HGE= zkYj`Z7~f5QK#=&GI>uZ50KRzBAAq;r^aEnO``+3D1YBZdy}=oofjCJlz;ytd1df@2 zh);iDe*X!O{KGT{H2y!#?>C6>zrp+<00eh~`Tc{Q-NSo#xYs=bcn|0?-2-L!INKd2 zb`SkA-Q#8V#XYWfhYsGubWHc~-tTbY9o)ur2k+fue)k|D!K1Kl^jhbZrR2P*%s z;*bBVr#EbbyRaZPfZ=~Eo&P=l_^&nde+og~hOhV?g1mXV{}Y1zKiX|0b_+rBS(w{c zm}=YnH_#&l45DQKv9JQH0~#+Nyq!-yRIPZm)M3ktU5+MJ=dRDMuQH|mGsqe2u-m0aMqe9#&na`e zc2KIt?r0N#YgBjSzoAIq#4kg-ZTf|IS#$CYuZ)0>QenK0&lcvoN{zY4=E6kni3GM& zQG+F?fQ&F+;EBuW+?Z)L`GJ|`^(^b0#K9XnJ8siHKNF^{M8pfT9#w-Hdzolks`ke@ zLk-d48Qx)!XL!=-Py0TLNDN1_MD_P~Wf?u-L!^~HjCpRnj3C|Z{o3rMo^pZD*B>R1 zxh0$fI|MQzoUhZ#X4z4sG|@J8jiOV~q>0c;x_nGv^=Px1T3*UVp`$z_!qlG+Q`W1l zE#&ylM0FL{hwBg{8o-SJ{S2n5=R?HjpH)sKyF%gh-&%u-p%1?fIa8QezpsOqdpYzT zLo}$kE~niT#eCgP(fIpxP`iqqFN;_tUCi?(kqTl$240;AVzC6W5%os$5tkv#xQhj= zGZc*MWgpV`i@lgBs=%PCgy|%Tkm|Obqc>K9A*1CxLl5&InvpcmWgsyy`yrmrgdE`b zm(O$s&0n@Y7QA+JShx;O5g2e|I@_u5`qDr*QtX`S$~pv3nZ~Qgr9;~)M_MBcuhfP} zZYQ=Z0#g$+ixoD~r^Zxn_lvJJBGJ#c&}2mA&{;z=qI+?6|M=DRK;{@9yFC*mzSp0| zH18G8WBP~~vg(oVs$zQ95SCs13b<6}Cu%FtXesm}6S7IeM8XGNolrQqJBnDIW5Pjy z!h57_TNQcNK5=A+1T|R$Iuq9 zriKUgAd_Ns?8m`yC|fU0jP*hcWn4Y_M#n34-}6O%hyDBJz`eFo<=)1IJ%E}*e=_NEID21YT@eQVAb6lP#>z}Gs`+Yovyx&u1FU040uZX zP_>~;KJ7ppPVuk@y!H&C@_^;tk>(Fp)-}WL#s=U~15uLi<8IkXk9svjI#!;~EjdVW zg{`=-3$aaYkr=|k;=TJZqRZ|ZS6}_h%*3>MyatpmnQmR@^r;QSwvvo%Z43IUznOKQ znRQ}b3Y8SWm3{!=2l@qQ4*LWkRtn|4_n$gP9fLmq>3)gnL%QIGU-;&2MUD1(dyHnL z+4LsOS{qT`3GuZ{y+;DR8>h-nPNZVZgZY-TzEkBdwZepA4J@2sv_4O)uA#)e*z>`Qqm7>7$@ zMPbkP*8(wuWWw_T!u->=%#8AHX!U&>vU|eUqu{(EXE+nR3BsU0JKtK{@=3KUX}!R~ zogvI;=WBfDCJp3Z)qL8rF|r&h>goOvP(@2-w1;uqOU`VAq!x~^l^jq31`X3I8HHx; zw%CXb*k^E$II-)E5rcwEpBJ{HnVG##O0wUqGIo4zub^P>p;r7I8={iW0cK~Hqy26i zCq^}@b)EJ}!J?~ACN)yjx;_4(w!`sEZ}s~jl=5=@UGM(1(dWdePEW2l&;zAa5%xm6kp)}g3S7V8hWqjYI&F!-eQ_JzanqCRz=wY zyKD6#288(nX^BE65G5?2_TxS}I1uhK`J8qAQfp%SO=cPo&tg*e*EwlYanFb5doRtO z&YV7}d)Cm`m!aD^=rye&e%cmu?Tug)_e} zp4*3pY;zIKa&SOcM@D63a%8!}%89Xxzboicf)b0F>RY$-ON!>C1;$L4$$l`hN9b~zsJQ=OVjLT-T7*DtJMdjBX_Mo%PMO+lu*7W?3p-`5lP z6HA!y02My6bZ=2UOI|e0PFxJwkaImmTO$M=1 zO^Qli;Ud7CpEJKhI&;&55{#oNoZP_aC#+DTNb4ywE?yYAdQGec0<~rI5?PDTf-vnW zB_*dXia8f&uzN%$a(r{rBd(5+7?03mWb?}>8n7p=h`H>SUMpjX6b$? znTl(R?|tn}H;mp=(kK@A)OF&nrZkx7WHcf>>kD{rCL|irdKs=!NU2~^0?XpV^M9&V! zkad)q1HX0#8a`{oUU+il8&%>(o@?N#Z?Zv(DWWmsB=a3fwRy#kwu)`bwr@Dzb7UHx z?=FRYs4ln8-XLTAepQ_!ak=a+8g^*Lhlvb(k-YtZFghZ_OHy6q>U5UU!OBXtXM9KX z%1BSqW#-{ovUns6E6zDD=O-a8En1mzh7wQv6iDw1%v!_h=9zd}lk3p4GjZkGbtG6dxjkFWD4XWFUlcA<+msf& zjUfpaSGg5x;lpH6HbM0j?o)f_wV9r(W?0&6fvo!wd*^Z6hmPaQD$IDJ$8Xblyd|eo z<04mA^z{+Fv$MS(_4JTQ;jq=%w5@kV=_rL-#qmI2<%r13;nWh^^vT;DPCsjjh)7TF zJpY7{nkn|R`Z*?sYEgD}$!eUKVUzqiubjtN(~PtqajgoUkt3hZOXo-Q4-P21EyF3r zt0Df|F!3|yo^8AEDQ{q;2pA}ALJ&k|KR$+q^AqyJPAsy|$Jq}0e9moRg6Vq>CnPRC z+fztcX#dO9T5-c}pmA!&5)0909|T?o$)#7MmpXL5x@>P3&aPDE*va{cgc1_`uJAz% z1}ABRp1!`pW7J3rQPBqjBu+!MNop~ZdezvBPVo=5BEEk%!?1HNt*E(`@#EI=z zX~mXp{_L7l^m*=yaI0QL?LbmDd6_EwV@FF%cP{k8QgwlsEv?hNi?kK+TEe7hs4RvN z^9rwGyarweqss|_C=P{EFFfiwoi_+4-=9--1c19s|tYQkRG^6w>jZJYU81b+sWyYkt62v7!>IE~>f28}e$^AGG&Z$%~VXFM) zXc827kc|-Ew@|#kHZ@N}OW7qf?P*b7(WAp>AZHR}vB2YOEv1;-=P53&Pe$6vIr)9v zHZKNBxNv$qIkAJuUcM&UIPZhJr?bqSOw!YSeLdwdYhSR_68FuUU@2Bi&NnPR%sam*64@hJVB^wS2 zXZK}{L9sN7MHb7e(xik{J5<)=u=UMg0<4=%!sg^FDDBX+Ow4hDQoUz|_$PBA*O=qn zOI*ub_3p?v$DjS${8l_3Y9pEHyKL4?>C zh;GoAJUu(R?hd!p=x*;~@P?FDqYaJgLHxE|_@KK>^9KdJF7^=lCvZ>C&-Q`?(b#vm zDRF1&kdj&Dy0Cgl6SMbwMZ&s^qys@iYb6zj4FRg${1frU*)ya3+z(YKyc%_7Pe@7H zJ4GD%m*r(Z)J&Jm{UMbFNR0J@$S^hfkoEU5*aErh!HMP?pHFiVW1kz=@FgvVS){tb zki)ynss}~}A5(lgaoT^Hz}NIzRNk(ytK=uFMq=DN^5eOsYBH|Wp!V1g7Oa+=y@gHZ zGjMCiYf!E%6Jj_W_UfC&-`HWASA`nGaX15y8=B7^QqEg3rIG|N0M4|XQ z`UcHqcD8YhY$*fAhX&rJb#ln_r62*c07=c2w<6TT+@%bOOE5Z5dES}{w0E?DY}PTc zx0s5tw4N0l@fU0}c_CZlADg#4JPkBR(arhtt=l|=fbRUoVagT7BTjg?G`*PDn6QtC zc>KlHmaC#|kRG6I{e=1P*`)Lw6xnf5qQf)Tob-B5nwiVKOI=?1ysIK!NMmZ^n~Fk- z^dUw&@$-#5>j?ZaQuNfb{7-y<`@A&?`kdIuZ z0LSy_6H*TcPi~$-gaWUPtJ2r_xbcG*eOg@nu3+kYj)MyB>z7MJuZSZ`UlIWv zRK5iNw{v+Bz1;3T=hr)A@d~JjI*-46;34A>?S7o#+Y%~<O(Gx0AV(ukC0K8eKwb+nGqO zGM@DzWk&umKOfsyarp>`Jrkt0N%l!}XVf259d&0dA9&bjYRBG)RtYM0O;&Ses1k?{vi;VMWp%|95bMnrQvErjw(3)NMS8Ey z+pn?gYO3qO%2JG)O5;^pSiQ$X}h4u#`=d(DTTjMT;O-STnJG-Tld1L8= zbPiPwl0vg*Gr@}i!-w=|+j2FX4ZX=Zb3RWLJuAA#T%VoG)BoHbbCe4*ws2oYA+mPX7bAXzU_D}L=ly10v+WqRkdy@-dHv5Xx)_cwgXld&a>E4X zXbJN_bp3`*)XsmrUo#Y0hBIdJXWOTGN|^lAx4W9#YT2+qZH#MvtCDHYV;2bGcxY0B z*13-CKdiQI6707j^4>3Yk0c(kG~+O~bR6gTMg0>M%ob0z%(AD4HHXCnU867=+oA;%yRj}IULID(X*(DHtPpc%B=kS9`L;Htq07|M!PnK zT6bjGO`=zb+z z475!xcHDMFjfu^a)j9d+PW?#a8YwxJpPO5TWxBovv0oLnvWkn7^$lYeaH?~*_RS*s z)DYsESUo~Ju4H1Rs>I4-hCo6>@jg4g9j|{~+>Tl#Mipf!24F46F<))=%ZWXoc=gMD zAFiqxSIZJehaRq2-{pCgHTs$3jWT1aIupg43D$?{a3TjtPW62;yo{%^4b27)PNw$B z1Y}_^nc0Dei!{Z^xhjc?M9g_rf>c_5)TB*mgG-i-_9M)1SgP1+pFC=++de~*loJNU4-}3~l2gC*iO9(J0nVx$!qVt1l z6qH?bkV(^Q$=*nGLJbtfdH6Ca`+Z3dkrk1ZUu|C~&VqM$=Tg4nTU4af?K9Zm>gcLY z{*0!0vaL~S`u4r-1jR3VLKxHO^$BvA%z;e8gN~B<+4@gROy42qTU$qVb{}G2*C`hE ze8os;T6oMq%nIt{@LQ- zgLRpTSy^4->)9bHH=S9`4>C*_q+`?{m9sY!J-?@FE6!~+UY~GVULRk z^GhJ;xMa!4=$byFOMU-2_0n_dy7c7xTDRQcBP#0)B8X_H^Xm20a>{4lrg=AX>utC2 z=A3jffj1o+XdF=&%$T0%# zB;&YY=BS-D#dr9Y>7g%_>AsA^j6tMgRhT7Pg|~~nU35+wpR~4cvqxr0g|zzb+4Q#J zY4g*ErKLJ<&~7kp%t>=jdOuv#KGd}hRT#8)qH{+6MmKof43(jmqUTB~jrakE8`GJ% z@^P$B6Poo)-Iopq&Xnc;ll<>%{O&E6(IrP81}6kWbq zs?lph{vY3eQBvw#KqDWZTqOC19x7fWc_9A)yV9n$3HJ>6L_;&~A3RaQTV5qBc+k)} z&>ro%v$7ihhRX$;dmzJ&xUOrUBEP%{<+RpYR*(7M0B0oefXp>T?E6wOtYkRUwMjZf z3q}eNWvWwL>hQ502q7jReTKBI)IXi>s`MWm^P*a-V&yJUkidwQ(5oNu&yzH{ttoGL*dS zTHIDu8fbrg;GmL^>a1i8HENKjT!TrZ_}~Qj%g*Jl1HyHE5MG&l zi70bD$y%78PQ*IP6mCGjP)6fBdNliw#p$T*s7di5o#P%n)TlFfah`^g-3)Ods5sbO zKEf=|;ZL=ErQ*_`cZHCv!5Td0<%(15ad|axE$^)`k*7QMc6Po-n@~I$GYRJ129$p7 z4?%paNAOBvt=o+RKEFOGrTJW+X|)BYJW66I1*?eDF|L3x~#$(8`L-4=wzaniQ_4 zUhKThgbx``9s=C9;!1DXIXDHNHwYm_yO8ho^K^UdTU&43w*v(U_psL~AMb1X>3Co` zb0D_qdTWJ`>!*Y#69o4)!BV4BD*=MdMsZc1`1id%vI; zmbw;|{rpt@!K}TFH=zQ`XgzmGJ-v)Vq>VE(&zj`39&vRH4%f7GB98MP@maZLdS=|L zWXmuNg!1l|Poc5iHQ4r!|kbUS12;!lt5v@qt-SldpXn=+f<64jy$C2Y; zeyVfClaR9Nh^0h}_k%6FRz&BK_)`<|j&tqkHFCje=$~Tis67qIv1G!ZF{bpmOFzBx z?nf`8MiVu0N+L{1BEv1?m+Y)-J&%++dp8ys!H>RT=gkrA)4uFXZWy_yMY!#rS<@-5dQCR1egO2j4G8KJW&Y=DN~1Y0vC!xjZO zB2Q#sjAG`@(IS3{=$%Jf=SV@SI<}ORwMNobD)I9fsq&U@1+a3C^G?oEkqzrF%_0Wy z#uPl})wBYWL-{9sl-!YgCr;n$k!~a=BKjJR^SpDT$ATY#X^{?c`9Z<-P@eGXnU~CU ziyHL~;`t*6`==isN=vK|{tz~uT_sy;u@dKC!rO(*^^$H9kvSeX%iwauDIjLwoWjE= zAzMjA{20`ne`3mtjj)6CF=7xMTQdQLTF~pAAuIdpRFETl$B*E6VLgN{e$OkYAC9>8 z{4I^B+UC{-&!52QFytu@0sFS`;H9*YUv1g5kg>pdK8VzEfNqtGXjh8t%-1sIT2j?< zNtf1pYJQfs+vW+@o+sxDl7Enms7RakG7t(~d+{j~PC$Qiz}^=LtMD(Fr1}tlhvp47 zlD0@tmC*ByW*&4KPx(-kpr==>glTN#W%Oa^qEdRNGUYjE{O(+oX9>`!9&|GerkX;R~Ak;RT*Hm;!=pq_uh+7{7-tiKJK$9rMj8>y5C zH^1UNKzPa`Ow)wr&vGKZwp6HIuru(;heWBp%9iF_wqozZIeECYre-Zpi~s{}ycs^l zZ^q5lzI#3F8DhyQfq;I3-V}NFLjJIv?Vi_gWA|H2I#N*?b`f8x(Wz`m5}Ib;fk_oj zfK}v6?a+~!H&Tccs_%&nX%I#0o#FWf!N_$yn@r!@WImtCcxOEDU0p+eH` zb`!z_HLCaFrF)yFqNNa}$Si7LHX|VDo{1<&Jth_3@cJo6BC#>y5F;ta%6aO56s1$F z6Q(vlB<()0%>7gDsjSx{%h?M>CI88n%I+6+{MK$btE7<_=^&mj{V*aa?n>5I=ED}P%UG}v2XZ*E)%pa9cNL#ew;eh|9%Em8MBE7Ql1P395Bzw-PfkGT zdF0#5{uo)=wC1ml(u1d<$3;4e3UK;m`_4H=0aP0U{UiFF7V?53Y5TSMK*6~f zT@WqKhLV0;^>O>F#&Hgg<7=qnpH|y{v)pb0{u>ei3j;ml&E=b8fG+jF*(wfD%Wjwj zH;j$n!chF1A@P5Y-F8FV`0pc7@GAn;Fvc6w);~A%UxadC0dmLuKU&xSh}H!Vhi++I zzcZEY=vnu~D#km072`ee=#H~>&s4gPsc;`D0sI>U>z?ujzN19lbFY~02~zibt~;IJ zJGK?*j?Bb#M_>9Uti&BJ>z}v~zZ1vq&+fGRL)N-)eov6P55jQY?LE`%uA_U7*ge0B z@xJoTGR8ZTnD2`_4%P1ztb3x`KeV;`d${ZUA9C285dwDxGTpJX{)t#|CwWiZy64qF z?zP+%;CqwqSZMcLFYw(10Nsz^-8InNjortn_=gyG_c-o(XE#*1|EmPB|C(|2zaoJB zdpY?Z62ER&uHR!%u->M(`uBQp!)W@4^>jx=yG=@kKqqFTXM>NRig3#vLjWkMH_Hsb zXuTMu12Bn;atxTxDOym z(O>;Cf&LmldM2iuq_V&D%Rmnh0sp9@XM#Zf)(0s3Lym!-^(LL|@A?=(pg+f%0SL16 zS6c@9n;fx!wgs5df7Ahw{LgU#^sxXl{P(uNZ2WVa8301{pU;Sag@yhvTNs%D#`T~2 zSZ-pT{N4u(%S}$hKkERt_#btwAYcakUI(x#Z%Fxnv}OHk4l%GY+ytiiO%4S9`+k8Z z{?|MO>i(LiK;2(`fWRQ|pEd(^f6X;O3ShARVG9fMO|^?CK7+u_f6ZsWJRrFH zA8lEf|Lzx<_J2Ne5HR+CjtiIpe3O#zH(S6A41eom1>Iyr{zH!buXzflXSm7k{JR`I z_^&k#Owah&n1bp5z7H_)e*86ltl*oh$G`OfVr2yXUB`6ui|~gW3*^uF2Vw<2f5_bs zcmKK%27r_MryRrIYbP+Gz%GX0`vpeeuXO{6%Kz8<3$*=vOaX53pEg72A&@`s7efEH zK0xlTH5K^Xdk8b@4Vn12F@-Qg{W6^IP?ha4;D@820_$W5Bs z-}C{i)nDrs5EJe{-%DF-Z6Kw9HNs80aXBL={hQxay4wJFfU=uE8DuRifCRX}%mGer Z|NF0PZF~C@%n1D0F(HtU2uKMc{C{AhEcgHb diff --git a/Informe.md b/doc/Informe.md similarity index 100% rename from Informe.md rename to doc/Informe.md diff --git a/src/cool/__main__.py b/src/cool/__main__.py index 96fc56bf1..83c3b45e8 100644 --- a/src/cool/__main__.py +++ b/src/cool/__main__.py @@ -32,11 +32,12 @@ def check_semantics(ast, scope: Scope, context: Context, errors: List[str]): return ast, scope, context, errors -def tokenize(file: str, verbose: bool = False): - path = Path.cwd() / file +def tokenize(file: typer.FileText, verbose: bool = False): + path = Path.cwd() / file.name if not path.exists(): - typer.echo(f'File {file} does not exist.') - exit() + typer.echo(f'File {file.name} does not exist.') + return None, None + s = path.open('r').read() lexer = CoolLexer() tokens = lexer(s) @@ -52,23 +53,27 @@ def tokenize(file: str, verbose: bool = False): return tokens, lexer -def parse(file: str, verbose: bool = False): +def parse(file: typer.FileText, verbose: bool = False): tokens, lexer = tokenize(file, verbose) - if lexer.contain_errors: + if lexer is None or lexer.contain_errors: return None, None parser = CoolParser(verbose) ast = parser(tokens) if parser.contains_errors: - typer.echo(parser.errors[0], err=True) + for e in parser.errors: + typer.echo(e, err=True) return ast, parser @app.command() -def infer(file: str, verbose: bool = False): +def infer( + file: typer.FileText = typer.Argument(..., help='Cool file'), + verbose: bool = typer.Argument(False, help='Execute in verbose mode.') +): ast, _ = parse(file, verbose) if ast is not None: @@ -80,7 +85,10 @@ def infer(file: str, verbose: bool = False): @app.command() -def run(file: str, verbose: bool = False): +def run( + file: typer.FileText = typer.Argument(..., help='Cool file'), + verbose: bool = typer.Argument(False, help='Execute in verbose mode.') +): ast, parser = parse(file, verbose) if ast is not None: @@ -95,10 +103,11 @@ def run(file: str, verbose: bool = False): for error in errors: typer.echo(error, err=True) - exit(0) + sys.exit(0) else: exit(1) + @app.command() def serialize(): serialize_parser_and_lexer() diff --git a/src/cool/grammar.py b/src/cool/grammar.py index 880e69cc9..84c25a167 100644 --- a/src/cool/grammar.py +++ b/src/cool/grammar.py @@ -156,7 +156,7 @@ def multi_line_comment(lexer: Lexer): pos = lexer.position + 2 lex = '(*' - while counter > 1: + while counter > 0: if pos >= len(text): lexer.contain_errors = True lexer.position = pos diff --git a/src/coolc.sh b/src/coolc.sh index 2ea5b9992..ca9bedd69 100755 --- a/src/coolc.sh +++ b/src/coolc.sh @@ -1,12 +1,10 @@ -# Incluya aquí las instrucciones necesarias para ejecutar su compilador -# -INPUT_FILE=$1 -OUTPUT_FILE=${INPUT_FILE:0: -2}mips -# -# Si su compilador no lo hace ya, aquí puede imprimir la información de contacto -echo "coolc 0.1.0" -echo "Copyright (c) 2019: Alejandro Klever Clemente, Laura Tamayo Blanco, Miguel Angel Gonzalez Calles" -# -# Llamar al compilador -# echo "Compiling $INPUT_FILE into $OUTPUT_FILE" -python cool run ${INPUT_FILE} \ No newline at end of file +# Incluya aquí las instrucciones necesarias para ejecutar su compilador + +INPUT_FILE=$1 +OUTPUT_FILE=${INPUT_FILE:0: -2}mips + +echo "Stranger Bugs Cool Compiler v0.1" +echo "Copyright (c) 2019: Alejandro Klever Clemente, Laura Tamayo Blanco, Miguel Angel Gonzalez Calles" + +# Llamar al compilador +python cool run ${INPUT_FILE} diff --git a/tests/utils/utils.py b/tests/utils/utils.py index f98d19dd0..84cd395bf 100644 --- a/tests/utils/utils.py +++ b/tests/utils/utils.py @@ -49,7 +49,7 @@ def compare_errors(compiler_path: str, cool_file_path: str, error_file_path: str return_code, output = sp.returncode, sp.stdout.decode() except subprocess.TimeoutExpired: assert False, COMPILER_TIMEOUT - + assert return_code == 1, TEST_MUST_FAIL % get_file_name(cool_file_path) fd = open(error_file_path, 'r') From d30b3a666341c4a74707fb9f85b8e280fa32a611 Mon Sep 17 00:00:00 2001 From: alejandroklever Date: Tue, 2 Mar 2021 04:22:21 -0500 Subject: [PATCH 102/143] Arreglado los mensajes de error del parser y el lexer --- src/cool/grammar.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/cool/grammar.py b/src/cool/grammar.py index 84c25a167..309dcdaac 100644 --- a/src/cool/grammar.py +++ b/src/cool/grammar.py @@ -80,7 +80,7 @@ def string(lexer: Lexer): lexer.contain_errors = True lexer.position = pos lexer.add_error(lexer.lineno, lexer.column, - f'{lexer.lineno, lexer.column} - LexicographicError: EOF in string constant') + f'({lexer.lineno, lexer.column}) - LexicographicError: EOF in string constant') return s = text[pos] @@ -112,13 +112,13 @@ def string(lexer: Lexer): lexer.contain_errors = True lexer.position = pos lexer.add_error(lexer.lineno, lexer.column, - f'{lexer.lineno, lexer.column} - LexicographicError: Unterminated string constant') + f'({lexer.lineno, lexer.column}) - LexicographicError: Unterminated string constant') return elif s == '\0': contains_null_character = True lexer.contain_errors = True lexer.add_error(lexer.lineno, lexer.column, - f'{lexer.lineno, lexer.column} - LexicographicError: String contains null character') + f'({lexer.lineno, lexer.column}) - LexicographicError: String contains null character') pos += 1 lexer.column += 1 else: @@ -161,7 +161,7 @@ def multi_line_comment(lexer: Lexer): lexer.contain_errors = True lexer.position = pos lexer.add_error(lexer.lineno, lexer.column, - f'{lexer.lineno, lexer.column} - LexicographicError: EOF in comment') + f'({lexer.lineno, lexer.column}) - LexicographicError: EOF in comment') return None if text.startswith('(*', pos): @@ -212,7 +212,7 @@ def tab(lexer): @G.lexical_error def lexical_error(lexer): lexer.add_error(lexer.lineno, lexer.column, - f'{lexer.lineno, lexer.column} - LexicographicError: ERROR "{lexer.token.lex}"') + f'({lexer.lineno, lexer.column}) - LexicographicError: ERROR "{lexer.token.lex}"') lexer.column += len(lexer.token.lex) lexer.position += len(lexer.token.lex) @@ -304,37 +304,37 @@ def lexical_error(lexer): @G.production("feature-list -> attribute error feature-list") def feature_attribute_error(s): - s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: ERROR at or near " + f'"{s[2].lex}"' + ".") + s.add_error(2, f'({s[2].line, s[2].column}) - SyntacticError: ERROR at or near \"{s[2].lex}\"') return [s[1]] + s[3] @G.production("feature-list -> method error feature-list") def feature_method_error(s): - s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: ERROR at or near " + f'"{s[2].lex}"' + ".") + s.add_error(2, f'({s[2].line, s[2].column}) - SyntacticError: ERROR at or near \"{s[2].lex}\"') return [s[1]] + s[3] @G.production("case-list -> id : type => expr error") def case_list_error(s): - s.add_error(6, f"{s[6].line, s[6].column} - SyntacticError: ERROR at or near " + f'"{s[6].lex}"' + ".") + s.add_error(6, f'({s[6].line, s[6].column}) - SyntacticError: ERROR at or near \"{s[6].lex}\"') return [(s[1], s[3], s[5])] @G.production("case-list -> id : type => expr error case-list") def case_list_error(s): - s.add_error(6, f"{s[6].line, s[6].column} - SyntacticError:ERROR at or near " + f'"{s[6].lex}"' + ".") + s.add_error(6, f"({s[6].line, s[6].column}) - SyntacticError:ERROR at or near \"{s[6].lex}\"") return [(s[1], s[3], s[5])] + s[7] @G.production("block -> expr error") def block_single_error(s): - s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: ERROR at or near " + f'"{s[2].lex}"' + ".") + s.add_error(2, f'({s[2].line, s[2].column}) - SyntacticError: ERROR at or near \"{s[2].lex}\"') return [s[1]] @G.production("block -> expr error block") def block_single_error(s): - s.add_error(2, f"{s[2].line, s[2].column} - SyntacticError: ERROR at or near " + f'"{s[2].lex}"' + ".") + s.add_error(2, f'({s[2].line, s[2].column}) - SyntacticError: ERROR at or near \"{s[2].lex}\"') return [s[1]] + s[3] From bc9dd8451703f364a9be0fcc531b2547724c1e24 Mon Sep 17 00:00:00 2001 From: alejandroklever Date: Tue, 2 Mar 2021 04:48:02 -0500 Subject: [PATCH 103/143] Arreglando formato de error --- src/cool/__main__.py | 2 +- src/cool/grammar.py | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/cool/__main__.py b/src/cool/__main__.py index 83c3b45e8..bcb64f87f 100644 --- a/src/cool/__main__.py +++ b/src/cool/__main__.py @@ -103,7 +103,7 @@ def run( for error in errors: typer.echo(error, err=True) - sys.exit(0) + exit(0) else: exit(1) diff --git a/src/cool/grammar.py b/src/cool/grammar.py index 309dcdaac..b5fe10f1c 100644 --- a/src/cool/grammar.py +++ b/src/cool/grammar.py @@ -80,7 +80,7 @@ def string(lexer: Lexer): lexer.contain_errors = True lexer.position = pos lexer.add_error(lexer.lineno, lexer.column, - f'({lexer.lineno, lexer.column}) - LexicographicError: EOF in string constant') + f'({lexer.lineno},{lexer.column}) - LexicographicError: EOF in string constant') return s = text[pos] @@ -112,13 +112,13 @@ def string(lexer: Lexer): lexer.contain_errors = True lexer.position = pos lexer.add_error(lexer.lineno, lexer.column, - f'({lexer.lineno, lexer.column}) - LexicographicError: Unterminated string constant') + f'({lexer.lineno},{lexer.column}) - LexicographicError: Unterminated string constant') return elif s == '\0': contains_null_character = True lexer.contain_errors = True lexer.add_error(lexer.lineno, lexer.column, - f'({lexer.lineno, lexer.column}) - LexicographicError: String contains null character') + f'({lexer.lineno},{lexer.column}) - LexicographicError: String contains null character') pos += 1 lexer.column += 1 else: @@ -161,7 +161,7 @@ def multi_line_comment(lexer: Lexer): lexer.contain_errors = True lexer.position = pos lexer.add_error(lexer.lineno, lexer.column, - f'({lexer.lineno, lexer.column}) - LexicographicError: EOF in comment') + f'({lexer.lineno},{lexer.column}) - LexicographicError: EOF in comment') return None if text.startswith('(*', pos): @@ -212,7 +212,7 @@ def tab(lexer): @G.lexical_error def lexical_error(lexer): lexer.add_error(lexer.lineno, lexer.column, - f'({lexer.lineno, lexer.column}) - LexicographicError: ERROR "{lexer.token.lex}"') + f'({lexer.lineno},{lexer.column}) - LexicographicError: ERROR "{lexer.token.lex}"') lexer.column += len(lexer.token.lex) lexer.position += len(lexer.token.lex) @@ -304,37 +304,37 @@ def lexical_error(lexer): @G.production("feature-list -> attribute error feature-list") def feature_attribute_error(s): - s.add_error(2, f'({s[2].line, s[2].column}) - SyntacticError: ERROR at or near \"{s[2].lex}\"') + s.add_error(2, f'({s[2].line},{s[2].column}) - SyntacticError: ERROR at or near \"{s[2].lex}\"') return [s[1]] + s[3] @G.production("feature-list -> method error feature-list") def feature_method_error(s): - s.add_error(2, f'({s[2].line, s[2].column}) - SyntacticError: ERROR at or near \"{s[2].lex}\"') + s.add_error(2, f'({s[2].line},{s[2].column}) - SyntacticError: ERROR at or near \"{s[2].lex}\"') return [s[1]] + s[3] @G.production("case-list -> id : type => expr error") def case_list_error(s): - s.add_error(6, f'({s[6].line, s[6].column}) - SyntacticError: ERROR at or near \"{s[6].lex}\"') + s.add_error(6, f'({s[6].line},{s[6].column}) - SyntacticError: ERROR at or near \"{s[6].lex}\"') return [(s[1], s[3], s[5])] @G.production("case-list -> id : type => expr error case-list") def case_list_error(s): - s.add_error(6, f"({s[6].line, s[6].column}) - SyntacticError:ERROR at or near \"{s[6].lex}\"") + s.add_error(6, f"({s[6].line},{s[6].column}) - SyntacticError:ERROR at or near \"{s[6].lex}\"") return [(s[1], s[3], s[5])] + s[7] @G.production("block -> expr error") def block_single_error(s): - s.add_error(2, f'({s[2].line, s[2].column}) - SyntacticError: ERROR at or near \"{s[2].lex}\"') + s.add_error(2, f'({s[2].line},{s[2].column}) - SyntacticError: ERROR at or near \"{s[2].lex}\"') return [s[1]] @G.production("block -> expr error block") def block_single_error(s): - s.add_error(2, f'({s[2].line, s[2].column}) - SyntacticError: ERROR at or near \"{s[2].lex}\"') + s.add_error(2, f'({s[2].line},{s[2].column}) - SyntacticError: ERROR at or near \"{s[2].lex}\"') return [s[1]] + s[3] From e815293d48ff3352049039ec94ab91424abca408 Mon Sep 17 00:00:00 2001 From: alejandroklever Date: Tue, 9 Mar 2021 02:16:26 -0500 Subject: [PATCH 104/143] - --- requirements.txt | 2 +- src/cool/grammar.py | 20 +- src/cool/lexertab.py | 42 +- src/cool/parsertab.py | 2737 +++++++++++++++++++++-------------------- 4 files changed, 1404 insertions(+), 1397 deletions(-) diff --git a/requirements.txt b/requirements.txt index e5e391d0a..726c871b8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ pytest pytest-ordering -pyjapt~=0.2.8 +pyjapt~=0.3.0 typer~=0.3.2 diff --git a/src/cool/grammar.py b/src/cool/grammar.py index b5fe10f1c..9aa37e44a 100644 --- a/src/cool/grammar.py +++ b/src/cool/grammar.py @@ -1,7 +1,7 @@ import inspect import time -from pyjapt import Grammar, Lexer +from pyjapt import Grammar, Lexer, ShiftReduceParser import cool.semantics.utils.astnodes as ast @@ -302,39 +302,45 @@ def lexical_error(lexer): G.add_terminal_error() +@G.parsing_error +def parsing_error(parser: ShiftReduceParser): + t = parser.current_token + parser.add_error(t.line, t.column, f'({t.line},{t.column}) - SyntacticError: ERROR at or near "{t.lex}"') + + @G.production("feature-list -> attribute error feature-list") def feature_attribute_error(s): - s.add_error(2, f'({s[2].line},{s[2].column}) - SyntacticError: ERROR at or near \"{s[2].lex}\"') + s.add_error(2, f'({s[2].line},{s[2].column}) - SyntacticError: ERROR at or near "{s[2].lex}"') return [s[1]] + s[3] @G.production("feature-list -> method error feature-list") def feature_method_error(s): - s.add_error(2, f'({s[2].line},{s[2].column}) - SyntacticError: ERROR at or near \"{s[2].lex}\"') + s.add_error(2, f'({s[2].line},{s[2].column}) - SyntacticError: ERROR at or near "{s[2].lex}"') return [s[1]] + s[3] @G.production("case-list -> id : type => expr error") def case_list_error(s): - s.add_error(6, f'({s[6].line},{s[6].column}) - SyntacticError: ERROR at or near \"{s[6].lex}\"') + s.add_error(6, f'({s[6].line},{s[6].column}) - SyntacticError: ERROR at or near "{s[6].lex}"') return [(s[1], s[3], s[5])] @G.production("case-list -> id : type => expr error case-list") def case_list_error(s): - s.add_error(6, f"({s[6].line},{s[6].column}) - SyntacticError:ERROR at or near \"{s[6].lex}\"") + s.add_error(6, f'({s[6].line},{s[6].column}) - SyntacticError:ERROR at or near "{s[6].lex}"') return [(s[1], s[3], s[5])] + s[7] @G.production("block -> expr error") def block_single_error(s): - s.add_error(2, f'({s[2].line},{s[2].column}) - SyntacticError: ERROR at or near \"{s[2].lex}\"') + s.add_error(2, f'({s[2].line},{s[2].column}) - SyntacticError: ERROR at or near "{s[2].lex}"') return [s[1]] @G.production("block -> expr error block") def block_single_error(s): - s.add_error(2, f'({s[2].line},{s[2].column}) - SyntacticError: ERROR at or near \"{s[2].lex}\"') + s.add_error(2, f'({s[2].line},{s[2].column}) - SyntacticError: ERROR at or near "{s[2].lex}"') return [s[1]] + s[3] diff --git a/src/cool/lexertab.py b/src/cool/lexertab.py index b689f5888..dfa2f5eaa 100644 --- a/src/cool/lexertab.py +++ b/src/cool/lexertab.py @@ -1,21 +1,21 @@ -import re - -from pyjapt import Token, Lexer -from cool.grammar import G - - -class CoolLexer(Lexer): - def __init__(self): - self.lineno = 1 - self.column = 1 - self.position = 0 - self.token = Token('', '', 0, 0) - self.pattern = re.compile(r'(?P[a-z][a-zA-Z0-9_]*)|(?P\")|(?P--.*)|(?P\(\*)|(?P\n+)|(?P +)|(?P\t+)|(?P[A-Z][a-zA-Z0-9_]*)|(?P\d+)|(inherits)|(isvoid)|(class)|(while)|(false)|(then)|(else)|(loop)|(pool)|(case)|(esac)|(true)|(<\-)|(let)|(new)|(not)|(\{)|(\})|(\()|(\))|(\.)|(=>)|(if)|(fi)|(in)|(of)|(\+)|(\-)|(\*)|(<=)|(\~)|(,)|(:)|(;)|(@)|(/)|(<)|(=)') - self.token_rules = {key: rule for key, (_, _, rule) in G.terminal_rules.items() if rule is not None} - self.error_handler = G.lexical_error_handler if G.lexical_error_handler is not None else self.error - self._errors = [] - self.contain_errors = False - self.eof = '$' - - def __call__(self, text): - return [Token(t.lex, G[t.token_type], t.line, t.column) for t in self.tokenize(text)] +import re + +from pyjapt import Token, Lexer +from cool.grammar import G + + +class CoolLexer(Lexer): + def __init__(self): + self.lineno = 1 + self.column = 1 + self.position = 0 + self.token = Token('', '', 0, 0) + self.pattern = re.compile(r'(?P[a-z][a-zA-Z0-9_]*)|(?P\")|(?P--.*)|(?P\(\*)|(?P\n+)|(?P +)|(?P\t+)|(?P[A-Z][a-zA-Z0-9_]*)|(?P\d+)|(inherits)|(isvoid)|(class)|(while)|(false)|(then)|(else)|(loop)|(pool)|(case)|(esac)|(true)|(<\-)|(let)|(new)|(not)|(\{)|(\})|(\()|(\))|(\.)|(=>)|(if)|(fi)|(in)|(of)|(\+)|(\-)|(\*)|(<=)|(\~)|(,)|(:)|(;)|(@)|(/)|(<)|(=)') + self.token_rules = {key: rule for key, (_, _, rule) in G.terminal_rules.items() if rule is not None} + self.error_handler = G.lexical_error_handler if G.lexical_error_handler is not None else self.error + self._errors = [] + self.contain_errors = False + self.eof = '$' + + def __call__(self, text): + return [Token(t.lex, G[t.token_type], t.line, t.column) for t in self.tokenize(text)] diff --git a/src/cool/parsertab.py b/src/cool/parsertab.py index fd092dd6e..db5133bb3 100644 --- a/src/cool/parsertab.py +++ b/src/cool/parsertab.py @@ -1,1368 +1,1369 @@ -from abc import ABC -from pyjapt import ShiftReduceParser -from cool.grammar import G - - -class CoolParser(ShiftReduceParser, ABC): - def __init__(self, verbose=False): - self.grammar = G - self.verbose = verbose - self.action = self.__action_table() - self.goto = self.__goto_table() - self._errors = [] - - @staticmethod - def __action_table(): - return { - (0, G["class"]): ("SHIFT", 1), - (1, G["type"]): ("SHIFT", 2), - (2, G["inherits"]): ("SHIFT", 145), - (2, G["{"]): ("SHIFT", 3), - (3, G["}"]): ("REDUCE", G["feature-list -> e"]), - (3, G["id"]): ("SHIFT", 4), - (4, G["("]): ("SHIFT", 5), - (4, G[":"]): ("SHIFT", 129), - (5, G[")"]): ("SHIFT", 6), - (5, G["id"]): ("SHIFT", 117), - (6, G[":"]): ("SHIFT", 7), - (7, G["type"]): ("SHIFT", 8), - (8, G["{"]): ("SHIFT", 9), - (9, G["while"]): ("SHIFT", 13), - (9, G["~"]): ("SHIFT", 27), - (9, G["isvoid"]): ("SHIFT", 24), - (9, G["{"]): ("SHIFT", 10), - (9, G["if"]): ("SHIFT", 12), - (9, G["not"]): ("SHIFT", 30), - (9, G["new"]): ("SHIFT", 22), - (9, G["("]): ("SHIFT", 11), - (9, G["string"]): ("SHIFT", 34), - (9, G["int"]): ("SHIFT", 33), - (9, G["false"]): ("SHIFT", 26), - (9, G["id"]): ("SHIFT", 31), - (9, G["let"]): ("SHIFT", 14), - (9, G["true"]): ("SHIFT", 25), - (9, G["case"]): ("SHIFT", 21), - (10, G["int"]): ("SHIFT", 33), - (10, G["case"]): ("SHIFT", 21), - (10, G["false"]): ("SHIFT", 26), - (10, G["while"]): ("SHIFT", 13), - (10, G["true"]): ("SHIFT", 25), - (10, G["id"]): ("SHIFT", 31), - (10, G["{"]): ("SHIFT", 10), - (10, G["if"]): ("SHIFT", 12), - (10, G["not"]): ("SHIFT", 30), - (10, G["~"]): ("SHIFT", 27), - (10, G["new"]): ("SHIFT", 22), - (10, G["("]): ("SHIFT", 11), - (10, G["isvoid"]): ("SHIFT", 24), - (10, G["string"]): ("SHIFT", 34), - (10, G["let"]): ("SHIFT", 14), - (11, G["case"]): ("SHIFT", 21), - (11, G["while"]): ("SHIFT", 13), - (11, G["{"]): ("SHIFT", 10), - (11, G["if"]): ("SHIFT", 12), - (11, G["not"]): ("SHIFT", 30), - (11, G["new"]): ("SHIFT", 22), - (11, G["("]): ("SHIFT", 11), - (11, G["string"]): ("SHIFT", 34), - (11, G["int"]): ("SHIFT", 33), - (11, G["false"]): ("SHIFT", 26), - (11, G["~"]): ("SHIFT", 27), - (11, G["id"]): ("SHIFT", 31), - (11, G["true"]): ("SHIFT", 25), - (11, G["isvoid"]): ("SHIFT", 24), - (11, G["let"]): ("SHIFT", 14), - (12, G["while"]): ("SHIFT", 13), - (12, G["{"]): ("SHIFT", 10), - (12, G["if"]): ("SHIFT", 12), - (12, G["~"]): ("SHIFT", 27), - (12, G["not"]): ("SHIFT", 30), - (12, G["new"]): ("SHIFT", 22), - (12, G["isvoid"]): ("SHIFT", 24), - (12, G["("]): ("SHIFT", 11), - (12, G["string"]): ("SHIFT", 34), - (12, G["int"]): ("SHIFT", 33), - (12, G["false"]): ("SHIFT", 26), - (12, G["id"]): ("SHIFT", 31), - (12, G["true"]): ("SHIFT", 25), - (12, G["let"]): ("SHIFT", 14), - (12, G["case"]): ("SHIFT", 21), - (13, G["id"]): ("SHIFT", 31), - (13, G["let"]): ("SHIFT", 14), - (13, G["~"]): ("SHIFT", 27), - (13, G["new"]): ("SHIFT", 22), - (13, G["case"]): ("SHIFT", 21), - (13, G["while"]): ("SHIFT", 13), - (13, G["("]): ("SHIFT", 11), - (13, G["string"]): ("SHIFT", 34), - (13, G["isvoid"]): ("SHIFT", 24), - (13, G["int"]): ("SHIFT", 33), - (13, G["{"]): ("SHIFT", 10), - (13, G["if"]): ("SHIFT", 12), - (13, G["false"]): ("SHIFT", 26), - (13, G["not"]): ("SHIFT", 30), - (13, G["true"]): ("SHIFT", 25), - (14, G["id"]): ("SHIFT", 15), - (15, G[":"]): ("SHIFT", 16), - (16, G["type"]): ("SHIFT", 17), - (17, G["<-"]): ("SHIFT", 20), - (17, G[","]): ("SHIFT", 18), - (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), - (18, G["id"]): ("SHIFT", 15), - (19, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), - (20, G["case"]): ("SHIFT", 21), - (20, G["false"]): ("SHIFT", 26), - (20, G["true"]): ("SHIFT", 25), - (20, G["while"]): ("SHIFT", 13), - (20, G["id"]): ("SHIFT", 31), - (20, G["{"]): ("SHIFT", 10), - (20, G["if"]): ("SHIFT", 12), - (20, G["not"]): ("SHIFT", 30), - (20, G["~"]): ("SHIFT", 27), - (20, G["new"]): ("SHIFT", 22), - (20, G["isvoid"]): ("SHIFT", 24), - (20, G["("]): ("SHIFT", 11), - (20, G["string"]): ("SHIFT", 34), - (20, G["let"]): ("SHIFT", 14), - (20, G["int"]): ("SHIFT", 33), - (21, G["int"]): ("SHIFT", 33), - (21, G["~"]): ("SHIFT", 27), - (21, G["false"]): ("SHIFT", 26), - (21, G["case"]): ("SHIFT", 21), - (21, G["true"]): ("SHIFT", 25), - (21, G["isvoid"]): ("SHIFT", 24), - (21, G["while"]): ("SHIFT", 13), - (21, G["id"]): ("SHIFT", 31), - (21, G["{"]): ("SHIFT", 10), - (21, G["if"]): ("SHIFT", 12), - (21, G["not"]): ("SHIFT", 30), - (21, G["new"]): ("SHIFT", 22), - (21, G["("]): ("SHIFT", 11), - (21, G["string"]): ("SHIFT", 34), - (21, G["let"]): ("SHIFT", 14), - (22, G["type"]): ("SHIFT", 23), - (23, G["/"]): ("REDUCE", G["atom -> new type"]), - (23, G["of"]): ("REDUCE", G["atom -> new type"]), - (23, G["<"]): ("REDUCE", G["atom -> new type"]), - (23, G[")"]): ("REDUCE", G["atom -> new type"]), - (23, G["then"]): ("REDUCE", G["atom -> new type"]), - (23, G["<="]): ("REDUCE", G["atom -> new type"]), - (23, G["."]): ("REDUCE", G["atom -> new type"]), - (23, G["else"]): ("REDUCE", G["atom -> new type"]), - (23, G["="]): ("REDUCE", G["atom -> new type"]), - (23, G[","]): ("REDUCE", G["atom -> new type"]), - (23, G["fi"]): ("REDUCE", G["atom -> new type"]), - (23, G[";"]): ("REDUCE", G["atom -> new type"]), - (23, G["in"]): ("REDUCE", G["atom -> new type"]), - (23, G["loop"]): ("REDUCE", G["atom -> new type"]), - (23, G["@"]): ("REDUCE", G["atom -> new type"]), - (23, G["pool"]): ("REDUCE", G["atom -> new type"]), - (23, G["+"]): ("REDUCE", G["atom -> new type"]), - (23, G["error"]): ("REDUCE", G["atom -> new type"]), - (23, G["-"]): ("REDUCE", G["atom -> new type"]), - (23, G["*"]): ("REDUCE", G["atom -> new type"]), - (23, G["}"]): ("REDUCE", G["atom -> new type"]), - (24, G["false"]): ("SHIFT", 26), - (24, G["~"]): ("SHIFT", 27), - (24, G["true"]): ("SHIFT", 25), - (24, G["new"]): ("SHIFT", 22), - (24, G["int"]): ("SHIFT", 33), - (24, G["id"]): ("SHIFT", 28), - (24, G["isvoid"]): ("SHIFT", 24), - (24, G["("]): ("SHIFT", 11), - (24, G["string"]): ("SHIFT", 34), - (25, G["/"]): ("REDUCE", G["atom -> true"]), - (25, G["of"]): ("REDUCE", G["atom -> true"]), - (25, G["<"]): ("REDUCE", G["atom -> true"]), - (25, G[")"]): ("REDUCE", G["atom -> true"]), - (25, G["then"]): ("REDUCE", G["atom -> true"]), - (25, G["<="]): ("REDUCE", G["atom -> true"]), - (25, G["."]): ("REDUCE", G["atom -> true"]), - (25, G["else"]): ("REDUCE", G["atom -> true"]), - (25, G["="]): ("REDUCE", G["atom -> true"]), - (25, G[","]): ("REDUCE", G["atom -> true"]), - (25, G["fi"]): ("REDUCE", G["atom -> true"]), - (25, G[";"]): ("REDUCE", G["atom -> true"]), - (25, G["in"]): ("REDUCE", G["atom -> true"]), - (25, G["loop"]): ("REDUCE", G["atom -> true"]), - (25, G["@"]): ("REDUCE", G["atom -> true"]), - (25, G["pool"]): ("REDUCE", G["atom -> true"]), - (25, G["+"]): ("REDUCE", G["atom -> true"]), - (25, G["error"]): ("REDUCE", G["atom -> true"]), - (25, G["-"]): ("REDUCE", G["atom -> true"]), - (25, G["*"]): ("REDUCE", G["atom -> true"]), - (25, G["}"]): ("REDUCE", G["atom -> true"]), - (26, G["/"]): ("REDUCE", G["atom -> false"]), - (26, G["of"]): ("REDUCE", G["atom -> false"]), - (26, G["<"]): ("REDUCE", G["atom -> false"]), - (26, G[")"]): ("REDUCE", G["atom -> false"]), - (26, G["then"]): ("REDUCE", G["atom -> false"]), - (26, G["<="]): ("REDUCE", G["atom -> false"]), - (26, G["."]): ("REDUCE", G["atom -> false"]), - (26, G["else"]): ("REDUCE", G["atom -> false"]), - (26, G["="]): ("REDUCE", G["atom -> false"]), - (26, G[","]): ("REDUCE", G["atom -> false"]), - (26, G["fi"]): ("REDUCE", G["atom -> false"]), - (26, G[";"]): ("REDUCE", G["atom -> false"]), - (26, G["in"]): ("REDUCE", G["atom -> false"]), - (26, G["loop"]): ("REDUCE", G["atom -> false"]), - (26, G["@"]): ("REDUCE", G["atom -> false"]), - (26, G["pool"]): ("REDUCE", G["atom -> false"]), - (26, G["+"]): ("REDUCE", G["atom -> false"]), - (26, G["error"]): ("REDUCE", G["atom -> false"]), - (26, G["-"]): ("REDUCE", G["atom -> false"]), - (26, G["*"]): ("REDUCE", G["atom -> false"]), - (26, G["}"]): ("REDUCE", G["atom -> false"]), - (27, G["false"]): ("SHIFT", 26), - (27, G["~"]): ("SHIFT", 27), - (27, G["true"]): ("SHIFT", 25), - (27, G["new"]): ("SHIFT", 22), - (27, G["int"]): ("SHIFT", 33), - (27, G["id"]): ("SHIFT", 28), - (27, G["isvoid"]): ("SHIFT", 24), - (27, G["("]): ("SHIFT", 11), - (27, G["string"]): ("SHIFT", 34), - (28, G["/"]): ("REDUCE", G["atom -> id"]), - (28, G["of"]): ("REDUCE", G["atom -> id"]), - (28, G["<"]): ("REDUCE", G["atom -> id"]), - (28, G[")"]): ("REDUCE", G["atom -> id"]), - (28, G["then"]): ("REDUCE", G["atom -> id"]), - (28, G["<="]): ("REDUCE", G["atom -> id"]), - (28, G["."]): ("REDUCE", G["atom -> id"]), - (28, G["else"]): ("REDUCE", G["atom -> id"]), - (28, G["="]): ("REDUCE", G["atom -> id"]), - (28, G[","]): ("REDUCE", G["atom -> id"]), - (28, G["fi"]): ("REDUCE", G["atom -> id"]), - (28, G[";"]): ("REDUCE", G["atom -> id"]), - (28, G["in"]): ("REDUCE", G["atom -> id"]), - (28, G["loop"]): ("REDUCE", G["atom -> id"]), - (28, G["@"]): ("REDUCE", G["atom -> id"]), - (28, G["pool"]): ("REDUCE", G["atom -> id"]), - (28, G["+"]): ("REDUCE", G["atom -> id"]), - (28, G["error"]): ("REDUCE", G["atom -> id"]), - (28, G["-"]): ("REDUCE", G["atom -> id"]), - (28, G["*"]): ("REDUCE", G["atom -> id"]), - (28, G["}"]): ("REDUCE", G["atom -> id"]), - (28, G["("]): ("SHIFT", 29), - (29, G["true"]): ("SHIFT", 25), - (29, G["not"]): ("SHIFT", 30), - (29, G["id"]): ("SHIFT", 31), - (29, G["isvoid"]): ("SHIFT", 24), - (29, G[")"]): ("REDUCE", G["expr-list -> e"]), - (29, G["new"]): ("SHIFT", 22), - (29, G["let"]): ("SHIFT", 14), - (29, G["string"]): ("SHIFT", 34), - (29, G["("]): ("SHIFT", 11), - (29, G["case"]): ("SHIFT", 21), - (29, G["while"]): ("SHIFT", 13), - (29, G["int"]): ("SHIFT", 33), - (29, G["false"]): ("SHIFT", 26), - (29, G["{"]): ("SHIFT", 10), - (29, G["if"]): ("SHIFT", 12), - (29, G["~"]): ("SHIFT", 27), - (30, G["~"]): ("SHIFT", 27), - (30, G["isvoid"]): ("SHIFT", 24), - (30, G["id"]): ("SHIFT", 31), - (30, G["new"]): ("SHIFT", 22), - (30, G["let"]): ("SHIFT", 14), - (30, G["("]): ("SHIFT", 11), - (30, G["string"]): ("SHIFT", 34), - (30, G["case"]): ("SHIFT", 21), - (30, G["int"]): ("SHIFT", 33), - (30, G["while"]): ("SHIFT", 13), - (30, G["false"]): ("SHIFT", 26), - (30, G["{"]): ("SHIFT", 10), - (30, G["if"]): ("SHIFT", 12), - (30, G["true"]): ("SHIFT", 25), - (30, G["not"]): ("SHIFT", 30), - (31, G["<-"]): ("SHIFT", 32), - (31, G["/"]): ("REDUCE", G["atom -> id"]), - (31, G["of"]): ("REDUCE", G["atom -> id"]), - (31, G["<"]): ("REDUCE", G["atom -> id"]), - (31, G[")"]): ("REDUCE", G["atom -> id"]), - (31, G["then"]): ("REDUCE", G["atom -> id"]), - (31, G["<="]): ("REDUCE", G["atom -> id"]), - (31, G["."]): ("REDUCE", G["atom -> id"]), - (31, G["else"]): ("REDUCE", G["atom -> id"]), - (31, G["="]): ("REDUCE", G["atom -> id"]), - (31, G[","]): ("REDUCE", G["atom -> id"]), - (31, G["fi"]): ("REDUCE", G["atom -> id"]), - (31, G[";"]): ("REDUCE", G["atom -> id"]), - (31, G["in"]): ("REDUCE", G["atom -> id"]), - (31, G["loop"]): ("REDUCE", G["atom -> id"]), - (31, G["@"]): ("REDUCE", G["atom -> id"]), - (31, G["pool"]): ("REDUCE", G["atom -> id"]), - (31, G["+"]): ("REDUCE", G["atom -> id"]), - (31, G["error"]): ("REDUCE", G["atom -> id"]), - (31, G["-"]): ("REDUCE", G["atom -> id"]), - (31, G["*"]): ("REDUCE", G["atom -> id"]), - (31, G["}"]): ("REDUCE", G["atom -> id"]), - (31, G["("]): ("SHIFT", 29), - (32, G["~"]): ("SHIFT", 27), - (32, G["isvoid"]): ("SHIFT", 24), - (32, G["id"]): ("SHIFT", 31), - (32, G["new"]): ("SHIFT", 22), - (32, G["let"]): ("SHIFT", 14), - (32, G["("]): ("SHIFT", 11), - (32, G["string"]): ("SHIFT", 34), - (32, G["case"]): ("SHIFT", 21), - (32, G["int"]): ("SHIFT", 33), - (32, G["while"]): ("SHIFT", 13), - (32, G["false"]): ("SHIFT", 26), - (32, G["{"]): ("SHIFT", 10), - (32, G["if"]): ("SHIFT", 12), - (32, G["true"]): ("SHIFT", 25), - (32, G["not"]): ("SHIFT", 30), - (33, G["/"]): ("REDUCE", G["atom -> int"]), - (33, G["of"]): ("REDUCE", G["atom -> int"]), - (33, G["<"]): ("REDUCE", G["atom -> int"]), - (33, G[")"]): ("REDUCE", G["atom -> int"]), - (33, G["then"]): ("REDUCE", G["atom -> int"]), - (33, G["<="]): ("REDUCE", G["atom -> int"]), - (33, G["."]): ("REDUCE", G["atom -> int"]), - (33, G["else"]): ("REDUCE", G["atom -> int"]), - (33, G["="]): ("REDUCE", G["atom -> int"]), - (33, G[","]): ("REDUCE", G["atom -> int"]), - (33, G["fi"]): ("REDUCE", G["atom -> int"]), - (33, G[";"]): ("REDUCE", G["atom -> int"]), - (33, G["in"]): ("REDUCE", G["atom -> int"]), - (33, G["loop"]): ("REDUCE", G["atom -> int"]), - (33, G["@"]): ("REDUCE", G["atom -> int"]), - (33, G["pool"]): ("REDUCE", G["atom -> int"]), - (33, G["+"]): ("REDUCE", G["atom -> int"]), - (33, G["error"]): ("REDUCE", G["atom -> int"]), - (33, G["-"]): ("REDUCE", G["atom -> int"]), - (33, G["*"]): ("REDUCE", G["atom -> int"]), - (33, G["}"]): ("REDUCE", G["atom -> int"]), - (34, G["/"]): ("REDUCE", G["atom -> string"]), - (34, G["of"]): ("REDUCE", G["atom -> string"]), - (34, G["<"]): ("REDUCE", G["atom -> string"]), - (34, G[")"]): ("REDUCE", G["atom -> string"]), - (34, G["then"]): ("REDUCE", G["atom -> string"]), - (34, G["<="]): ("REDUCE", G["atom -> string"]), - (34, G["."]): ("REDUCE", G["atom -> string"]), - (34, G["else"]): ("REDUCE", G["atom -> string"]), - (34, G["="]): ("REDUCE", G["atom -> string"]), - (34, G[","]): ("REDUCE", G["atom -> string"]), - (34, G["fi"]): ("REDUCE", G["atom -> string"]), - (34, G[";"]): ("REDUCE", G["atom -> string"]), - (34, G["in"]): ("REDUCE", G["atom -> string"]), - (34, G["loop"]): ("REDUCE", G["atom -> string"]), - (34, G["@"]): ("REDUCE", G["atom -> string"]), - (34, G["pool"]): ("REDUCE", G["atom -> string"]), - (34, G["+"]): ("REDUCE", G["atom -> string"]), - (34, G["error"]): ("REDUCE", G["atom -> string"]), - (34, G["-"]): ("REDUCE", G["atom -> string"]), - (34, G["*"]): ("REDUCE", G["atom -> string"]), - (34, G["}"]): ("REDUCE", G["atom -> string"]), - (35, G["/"]): ("REDUCE", G["atom -> function-call"]), - (35, G["of"]): ("REDUCE", G["atom -> function-call"]), - (35, G["<"]): ("REDUCE", G["atom -> function-call"]), - (35, G[")"]): ("REDUCE", G["atom -> function-call"]), - (35, G["then"]): ("REDUCE", G["atom -> function-call"]), - (35, G["<="]): ("REDUCE", G["atom -> function-call"]), - (35, G["."]): ("REDUCE", G["atom -> function-call"]), - (35, G["else"]): ("REDUCE", G["atom -> function-call"]), - (35, G["="]): ("REDUCE", G["atom -> function-call"]), - (35, G[","]): ("REDUCE", G["atom -> function-call"]), - (35, G["fi"]): ("REDUCE", G["atom -> function-call"]), - (35, G[";"]): ("REDUCE", G["atom -> function-call"]), - (35, G["in"]): ("REDUCE", G["atom -> function-call"]), - (35, G["loop"]): ("REDUCE", G["atom -> function-call"]), - (35, G["@"]): ("REDUCE", G["atom -> function-call"]), - (35, G["pool"]): ("REDUCE", G["atom -> function-call"]), - (35, G["+"]): ("REDUCE", G["atom -> function-call"]), - (35, G["error"]): ("REDUCE", G["atom -> function-call"]), - (35, G["-"]): ("REDUCE", G["atom -> function-call"]), - (35, G["*"]): ("REDUCE", G["atom -> function-call"]), - (35, G["}"]): ("REDUCE", G["atom -> function-call"]), - (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["else"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["in"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["}"]): ("REDUCE", G["expr -> id <- expr"]), - (37, G[","]): ("REDUCE", G["expr -> comp"]), - (37, G[";"]): ("REDUCE", G["expr -> comp"]), - (37, G["loop"]): ("REDUCE", G["expr -> comp"]), - (37, G["of"]): ("REDUCE", G["expr -> comp"]), - (37, G[")"]): ("REDUCE", G["expr -> comp"]), - (37, G["pool"]): ("REDUCE", G["expr -> comp"]), - (37, G["then"]): ("REDUCE", G["expr -> comp"]), - (37, G["error"]): ("REDUCE", G["expr -> comp"]), - (37, G["else"]): ("REDUCE", G["expr -> comp"]), - (37, G["in"]): ("REDUCE", G["expr -> comp"]), - (37, G["fi"]): ("REDUCE", G["expr -> comp"]), - (37, G["}"]): ("REDUCE", G["expr -> comp"]), - (38, G["<"]): ("SHIFT", 66), - (38, G["="]): ("SHIFT", 70), - (38, G[","]): ("REDUCE", G["comp -> arith"]), - (38, G[";"]): ("REDUCE", G["comp -> arith"]), - (38, G["loop"]): ("REDUCE", G["comp -> arith"]), - (38, G["of"]): ("REDUCE", G["comp -> arith"]), - (38, G[")"]): ("REDUCE", G["comp -> arith"]), - (38, G["pool"]): ("REDUCE", G["comp -> arith"]), - (38, G["then"]): ("REDUCE", G["comp -> arith"]), - (38, G["error"]): ("REDUCE", G["comp -> arith"]), - (38, G["else"]): ("REDUCE", G["comp -> arith"]), - (38, G["in"]): ("REDUCE", G["comp -> arith"]), - (38, G["fi"]): ("REDUCE", G["comp -> arith"]), - (38, G["}"]): ("REDUCE", G["comp -> arith"]), - (38, G["<="]): ("SHIFT", 68), - (38, G["-"]): ("SHIFT", 64), - (38, G["+"]): ("SHIFT", 39), - (39, G["~"]): ("SHIFT", 27), - (39, G["int"]): ("SHIFT", 33), - (39, G["isvoid"]): ("SHIFT", 24), - (39, G["false"]): ("SHIFT", 26), - (39, G["true"]): ("SHIFT", 25), - (39, G["new"]): ("SHIFT", 22), - (39, G["id"]): ("SHIFT", 28), - (39, G["("]): ("SHIFT", 11), - (39, G["string"]): ("SHIFT", 34), - (40, G["/"]): ("SHIFT", 54), - (40, G["of"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["<"]): ("REDUCE", G["arith -> arith + term"]), - (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["then"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["<="]): ("REDUCE", G["arith -> arith + term"]), - (40, G["else"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["="]): ("REDUCE", G["arith -> arith + term"]), - (40, G[","]): ("REDUCE", G["arith -> arith + term"]), - (40, G["fi"]): ("REDUCE", G["arith -> arith + term"]), - (40, G[";"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["+"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["*"]): ("SHIFT", 41), - (41, G["false"]): ("SHIFT", 26), - (41, G["~"]): ("SHIFT", 27), - (41, G["true"]): ("SHIFT", 25), - (41, G["new"]): ("SHIFT", 22), - (41, G["int"]): ("SHIFT", 33), - (41, G["id"]): ("SHIFT", 28), - (41, G["isvoid"]): ("SHIFT", 24), - (41, G["("]): ("SHIFT", 11), - (41, G["string"]): ("SHIFT", 34), - (42, G["/"]): ("REDUCE", G["term -> term * factor"]), - (42, G["of"]): ("REDUCE", G["term -> term * factor"]), - (42, G["<"]): ("REDUCE", G["term -> term * factor"]), - (42, G[")"]): ("REDUCE", G["term -> term * factor"]), - (42, G["then"]): ("REDUCE", G["term -> term * factor"]), - (42, G["<="]): ("REDUCE", G["term -> term * factor"]), - (42, G["else"]): ("REDUCE", G["term -> term * factor"]), - (42, G["="]): ("REDUCE", G["term -> term * factor"]), - (42, G[","]): ("REDUCE", G["term -> term * factor"]), - (42, G["fi"]): ("REDUCE", G["term -> term * factor"]), - (42, G[";"]): ("REDUCE", G["term -> term * factor"]), - (42, G["in"]): ("REDUCE", G["term -> term * factor"]), - (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), - (42, G["pool"]): ("REDUCE", G["term -> term * factor"]), - (42, G["+"]): ("REDUCE", G["term -> term * factor"]), - (42, G["error"]): ("REDUCE", G["term -> term * factor"]), - (42, G["-"]): ("REDUCE", G["term -> term * factor"]), - (42, G["*"]): ("REDUCE", G["term -> term * factor"]), - (42, G["}"]): ("REDUCE", G["term -> term * factor"]), - (43, G["/"]): ("REDUCE", G["factor -> atom"]), - (43, G["of"]): ("REDUCE", G["factor -> atom"]), - (43, G["<"]): ("REDUCE", G["factor -> atom"]), - (43, G[")"]): ("REDUCE", G["factor -> atom"]), - (43, G["then"]): ("REDUCE", G["factor -> atom"]), - (43, G["<="]): ("REDUCE", G["factor -> atom"]), - (43, G["else"]): ("REDUCE", G["factor -> atom"]), - (43, G["="]): ("REDUCE", G["factor -> atom"]), - (43, G[","]): ("REDUCE", G["factor -> atom"]), - (43, G["fi"]): ("REDUCE", G["factor -> atom"]), - (43, G[";"]): ("REDUCE", G["factor -> atom"]), - (43, G["in"]): ("REDUCE", G["factor -> atom"]), - (43, G["loop"]): ("REDUCE", G["factor -> atom"]), - (43, G["pool"]): ("REDUCE", G["factor -> atom"]), - (43, G["+"]): ("REDUCE", G["factor -> atom"]), - (43, G["error"]): ("REDUCE", G["factor -> atom"]), - (43, G["-"]): ("REDUCE", G["factor -> atom"]), - (43, G["*"]): ("REDUCE", G["factor -> atom"]), - (43, G["}"]): ("REDUCE", G["factor -> atom"]), - (43, G["."]): ("SHIFT", 44), - (43, G["@"]): ("SHIFT", 57), - (44, G["id"]): ("SHIFT", 45), - (45, G["("]): ("SHIFT", 46), - (46, G["true"]): ("SHIFT", 25), - (46, G["not"]): ("SHIFT", 30), - (46, G["id"]): ("SHIFT", 31), - (46, G["isvoid"]): ("SHIFT", 24), - (46, G[")"]): ("REDUCE", G["expr-list -> e"]), - (46, G["new"]): ("SHIFT", 22), - (46, G["let"]): ("SHIFT", 14), - (46, G["string"]): ("SHIFT", 34), - (46, G["("]): ("SHIFT", 11), - (46, G["case"]): ("SHIFT", 21), - (46, G["while"]): ("SHIFT", 13), - (46, G["int"]): ("SHIFT", 33), - (46, G["false"]): ("SHIFT", 26), - (46, G["{"]): ("SHIFT", 10), - (46, G["if"]): ("SHIFT", 12), - (46, G["~"]): ("SHIFT", 27), - (47, G[")"]): ("SHIFT", 48), - (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (49, G[")"]): ("REDUCE", G["expr-list -> not-empty-expr-list"]), - (50, G[","]): ("SHIFT", 51), - (50, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), - (51, G["true"]): ("SHIFT", 25), - (51, G["not"]): ("SHIFT", 30), - (51, G["id"]): ("SHIFT", 31), - (51, G["isvoid"]): ("SHIFT", 24), - (51, G["new"]): ("SHIFT", 22), - (51, G["let"]): ("SHIFT", 14), - (51, G["string"]): ("SHIFT", 34), - (51, G["("]): ("SHIFT", 11), - (51, G["case"]): ("SHIFT", 21), - (51, G["while"]): ("SHIFT", 13), - (51, G["int"]): ("SHIFT", 33), - (51, G["false"]): ("SHIFT", 26), - (51, G["{"]): ("SHIFT", 10), - (51, G["if"]): ("SHIFT", 12), - (51, G["~"]): ("SHIFT", 27), - (52, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr , not-empty-expr-list"]), - (53, G["*"]): ("SHIFT", 41), - (53, G["/"]): ("SHIFT", 54), - (53, G["of"]): ("REDUCE", G["arith -> term"]), - (53, G["<"]): ("REDUCE", G["arith -> term"]), - (53, G[")"]): ("REDUCE", G["arith -> term"]), - (53, G["then"]): ("REDUCE", G["arith -> term"]), - (53, G["<="]): ("REDUCE", G["arith -> term"]), - (53, G["else"]): ("REDUCE", G["arith -> term"]), - (53, G["="]): ("REDUCE", G["arith -> term"]), - (53, G[","]): ("REDUCE", G["arith -> term"]), - (53, G["fi"]): ("REDUCE", G["arith -> term"]), - (53, G[";"]): ("REDUCE", G["arith -> term"]), - (53, G["loop"]): ("REDUCE", G["arith -> term"]), - (53, G["pool"]): ("REDUCE", G["arith -> term"]), - (53, G["+"]): ("REDUCE", G["arith -> term"]), - (53, G["error"]): ("REDUCE", G["arith -> term"]), - (53, G["in"]): ("REDUCE", G["arith -> term"]), - (53, G["-"]): ("REDUCE", G["arith -> term"]), - (53, G["}"]): ("REDUCE", G["arith -> term"]), - (54, G["false"]): ("SHIFT", 26), - (54, G["~"]): ("SHIFT", 27), - (54, G["true"]): ("SHIFT", 25), - (54, G["new"]): ("SHIFT", 22), - (54, G["int"]): ("SHIFT", 33), - (54, G["id"]): ("SHIFT", 28), - (54, G["isvoid"]): ("SHIFT", 24), - (54, G["("]): ("SHIFT", 11), - (54, G["string"]): ("SHIFT", 34), - (55, G["/"]): ("REDUCE", G["term -> term / factor"]), - (55, G["of"]): ("REDUCE", G["term -> term / factor"]), - (55, G["<"]): ("REDUCE", G["term -> term / factor"]), - (55, G[")"]): ("REDUCE", G["term -> term / factor"]), - (55, G["then"]): ("REDUCE", G["term -> term / factor"]), - (55, G["<="]): ("REDUCE", G["term -> term / factor"]), - (55, G["else"]): ("REDUCE", G["term -> term / factor"]), - (55, G["="]): ("REDUCE", G["term -> term / factor"]), - (55, G[","]): ("REDUCE", G["term -> term / factor"]), - (55, G["fi"]): ("REDUCE", G["term -> term / factor"]), - (55, G[";"]): ("REDUCE", G["term -> term / factor"]), - (55, G["in"]): ("REDUCE", G["term -> term / factor"]), - (55, G["loop"]): ("REDUCE", G["term -> term / factor"]), - (55, G["pool"]): ("REDUCE", G["term -> term / factor"]), - (55, G["+"]): ("REDUCE", G["term -> term / factor"]), - (55, G["error"]): ("REDUCE", G["term -> term / factor"]), - (55, G["-"]): ("REDUCE", G["term -> term / factor"]), - (55, G["*"]): ("REDUCE", G["term -> term / factor"]), - (55, G["}"]): ("REDUCE", G["term -> term / factor"]), - (56, G["/"]): ("REDUCE", G["term -> factor"]), - (56, G["of"]): ("REDUCE", G["term -> factor"]), - (56, G["<"]): ("REDUCE", G["term -> factor"]), - (56, G[")"]): ("REDUCE", G["term -> factor"]), - (56, G["then"]): ("REDUCE", G["term -> factor"]), - (56, G["<="]): ("REDUCE", G["term -> factor"]), - (56, G["else"]): ("REDUCE", G["term -> factor"]), - (56, G["="]): ("REDUCE", G["term -> factor"]), - (56, G[","]): ("REDUCE", G["term -> factor"]), - (56, G["fi"]): ("REDUCE", G["term -> factor"]), - (56, G[";"]): ("REDUCE", G["term -> factor"]), - (56, G["in"]): ("REDUCE", G["term -> factor"]), - (56, G["loop"]): ("REDUCE", G["term -> factor"]), - (56, G["pool"]): ("REDUCE", G["term -> factor"]), - (56, G["+"]): ("REDUCE", G["term -> factor"]), - (56, G["error"]): ("REDUCE", G["term -> factor"]), - (56, G["-"]): ("REDUCE", G["term -> factor"]), - (56, G["*"]): ("REDUCE", G["term -> factor"]), - (56, G["}"]): ("REDUCE", G["term -> factor"]), - (57, G["type"]): ("SHIFT", 58), - (58, G["."]): ("SHIFT", 59), - (59, G["id"]): ("SHIFT", 60), - (60, G["("]): ("SHIFT", 61), - (61, G["true"]): ("SHIFT", 25), - (61, G["not"]): ("SHIFT", 30), - (61, G["id"]): ("SHIFT", 31), - (61, G["isvoid"]): ("SHIFT", 24), - (61, G[")"]): ("REDUCE", G["expr-list -> e"]), - (61, G["new"]): ("SHIFT", 22), - (61, G["let"]): ("SHIFT", 14), - (61, G["string"]): ("SHIFT", 34), - (61, G["("]): ("SHIFT", 11), - (61, G["case"]): ("SHIFT", 21), - (61, G["while"]): ("SHIFT", 13), - (61, G["int"]): ("SHIFT", 33), - (61, G["false"]): ("SHIFT", 26), - (61, G["{"]): ("SHIFT", 10), - (61, G["if"]): ("SHIFT", 12), - (61, G["~"]): ("SHIFT", 27), - (62, G[")"]): ("SHIFT", 63), - (63, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (64, G["~"]): ("SHIFT", 27), - (64, G["int"]): ("SHIFT", 33), - (64, G["isvoid"]): ("SHIFT", 24), - (64, G["false"]): ("SHIFT", 26), - (64, G["("]): ("SHIFT", 11), - (64, G["true"]): ("SHIFT", 25), - (64, G["new"]): ("SHIFT", 22), - (64, G["id"]): ("SHIFT", 28), - (64, G["string"]): ("SHIFT", 34), - (65, G["of"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["<"]): ("REDUCE", G["arith -> arith - term"]), - (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["then"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["<="]): ("REDUCE", G["arith -> arith - term"]), - (65, G["else"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["="]): ("REDUCE", G["arith -> arith - term"]), - (65, G[","]): ("REDUCE", G["arith -> arith - term"]), - (65, G["fi"]): ("REDUCE", G["arith -> arith - term"]), - (65, G[";"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["loop"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["pool"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["+"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["error"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["-"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["}"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["*"]): ("SHIFT", 41), - (65, G["/"]): ("SHIFT", 54), - (66, G["int"]): ("SHIFT", 33), - (66, G["false"]): ("SHIFT", 26), - (66, G["~"]): ("SHIFT", 27), - (66, G["true"]): ("SHIFT", 25), - (66, G["new"]): ("SHIFT", 22), - (66, G["isvoid"]): ("SHIFT", 24), - (66, G["id"]): ("SHIFT", 28), - (66, G["("]): ("SHIFT", 11), - (66, G["string"]): ("SHIFT", 34), - (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["else"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["in"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["}"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["-"]): ("SHIFT", 64), - (67, G["+"]): ("SHIFT", 39), - (68, G["int"]): ("SHIFT", 33), - (68, G["false"]): ("SHIFT", 26), - (68, G["~"]): ("SHIFT", 27), - (68, G["true"]): ("SHIFT", 25), - (68, G["new"]): ("SHIFT", 22), - (68, G["isvoid"]): ("SHIFT", 24), - (68, G["id"]): ("SHIFT", 28), - (68, G["("]): ("SHIFT", 11), - (68, G["string"]): ("SHIFT", 34), - (69, G["-"]): ("SHIFT", 64), - (69, G["+"]): ("SHIFT", 39), - (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), - (70, G["int"]): ("SHIFT", 33), - (70, G["false"]): ("SHIFT", 26), - (70, G["~"]): ("SHIFT", 27), - (70, G["true"]): ("SHIFT", 25), - (70, G["new"]): ("SHIFT", 22), - (70, G["isvoid"]): ("SHIFT", 24), - (70, G["id"]): ("SHIFT", 28), - (70, G["("]): ("SHIFT", 11), - (70, G["string"]): ("SHIFT", 34), - (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[";"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["error"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["else"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["in"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["}"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["-"]): ("SHIFT", 64), - (71, G["+"]): ("SHIFT", 39), - (72, G[";"]): ("REDUCE", G["expr -> not expr"]), - (72, G["in"]): ("REDUCE", G["expr -> not expr"]), - (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), - (72, G["of"]): ("REDUCE", G["expr -> not expr"]), - (72, G[")"]): ("REDUCE", G["expr -> not expr"]), - (72, G["pool"]): ("REDUCE", G["expr -> not expr"]), - (72, G["then"]): ("REDUCE", G["expr -> not expr"]), - (72, G["error"]): ("REDUCE", G["expr -> not expr"]), - (72, G["else"]): ("REDUCE", G["expr -> not expr"]), - (72, G[","]): ("REDUCE", G["expr -> not expr"]), - (72, G["fi"]): ("REDUCE", G["expr -> not expr"]), - (72, G["}"]): ("REDUCE", G["expr -> not expr"]), - (73, G[")"]): ("SHIFT", 74), - (74, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G["/"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["of"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["<"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G[")"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["then"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["<="]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["else"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["="]): ("REDUCE", G["factor -> ~ factor"]), - (75, G[","]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G[";"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["+"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["-"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["*"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["}"]): ("REDUCE", G["factor -> ~ factor"]), - (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), - (77, G["of"]): ("SHIFT", 78), - (78, G["id"]): ("SHIFT", 79), - (79, G[":"]): ("SHIFT", 80), - (80, G["type"]): ("SHIFT", 81), - (81, G["=>"]): ("SHIFT", 82), - (82, G["int"]): ("SHIFT", 33), - (82, G["case"]): ("SHIFT", 21), - (82, G["false"]): ("SHIFT", 26), - (82, G["while"]): ("SHIFT", 13), - (82, G["true"]): ("SHIFT", 25), - (82, G["id"]): ("SHIFT", 31), - (82, G["{"]): ("SHIFT", 10), - (82, G["if"]): ("SHIFT", 12), - (82, G["not"]): ("SHIFT", 30), - (82, G["~"]): ("SHIFT", 27), - (82, G["new"]): ("SHIFT", 22), - (82, G["("]): ("SHIFT", 11), - (82, G["isvoid"]): ("SHIFT", 24), - (82, G["string"]): ("SHIFT", 34), - (82, G["let"]): ("SHIFT", 14), - (83, G[";"]): ("SHIFT", 84), - (83, G["error"]): ("SHIFT", 86), - (84, G["id"]): ("SHIFT", 79), - (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), - (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), - (86, G["id"]): ("SHIFT", 79), - (86, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), - (87, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error case-list"]), - (88, G["esac"]): ("SHIFT", 89), - (89, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), - (90, G[","]): ("SHIFT", 91), - (91, G["id"]): ("SHIFT", 15), - (92, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), - (93, G["in"]): ("SHIFT", 94), - (94, G["~"]): ("SHIFT", 27), - (94, G["isvoid"]): ("SHIFT", 24), - (94, G["id"]): ("SHIFT", 31), - (94, G["new"]): ("SHIFT", 22), - (94, G["let"]): ("SHIFT", 14), - (94, G["("]): ("SHIFT", 11), - (94, G["string"]): ("SHIFT", 34), - (94, G["case"]): ("SHIFT", 21), - (94, G["int"]): ("SHIFT", 33), - (94, G["while"]): ("SHIFT", 13), - (94, G["false"]): ("SHIFT", 26), - (94, G["{"]): ("SHIFT", 10), - (94, G["if"]): ("SHIFT", 12), - (94, G["true"]): ("SHIFT", 25), - (94, G["not"]): ("SHIFT", 30), - (95, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (96, G["loop"]): ("SHIFT", 97), - (97, G["id"]): ("SHIFT", 31), - (97, G["int"]): ("SHIFT", 33), - (97, G["let"]): ("SHIFT", 14), - (97, G["false"]): ("SHIFT", 26), - (97, G["true"]): ("SHIFT", 25), - (97, G["case"]): ("SHIFT", 21), - (97, G["while"]): ("SHIFT", 13), - (97, G["{"]): ("SHIFT", 10), - (97, G["if"]): ("SHIFT", 12), - (97, G["not"]): ("SHIFT", 30), - (97, G["~"]): ("SHIFT", 27), - (97, G["new"]): ("SHIFT", 22), - (97, G["isvoid"]): ("SHIFT", 24), - (97, G["("]): ("SHIFT", 11), - (97, G["string"]): ("SHIFT", 34), - (98, G["pool"]): ("SHIFT", 99), - (99, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (100, G["then"]): ("SHIFT", 101), - (101, G["~"]): ("SHIFT", 27), - (101, G["string"]): ("SHIFT", 34), - (101, G["("]): ("SHIFT", 11), - (101, G["case"]): ("SHIFT", 21), - (101, G["isvoid"]): ("SHIFT", 24), - (101, G["while"]): ("SHIFT", 13), - (101, G["int"]): ("SHIFT", 33), - (101, G["false"]): ("SHIFT", 26), - (101, G["{"]): ("SHIFT", 10), - (101, G["if"]): ("SHIFT", 12), - (101, G["true"]): ("SHIFT", 25), - (101, G["not"]): ("SHIFT", 30), - (101, G["id"]): ("SHIFT", 31), - (101, G["new"]): ("SHIFT", 22), - (101, G["let"]): ("SHIFT", 14), - (102, G["else"]): ("SHIFT", 103), - (103, G["false"]): ("SHIFT", 26), - (103, G["let"]): ("SHIFT", 14), - (103, G["true"]): ("SHIFT", 25), - (103, G["case"]): ("SHIFT", 21), - (103, G["id"]): ("SHIFT", 31), - (103, G["while"]): ("SHIFT", 13), - (103, G["~"]): ("SHIFT", 27), - (103, G["isvoid"]): ("SHIFT", 24), - (103, G["{"]): ("SHIFT", 10), - (103, G["if"]): ("SHIFT", 12), - (103, G["not"]): ("SHIFT", 30), - (103, G["new"]): ("SHIFT", 22), - (103, G["("]): ("SHIFT", 11), - (103, G["string"]): ("SHIFT", 34), - (103, G["int"]): ("SHIFT", 33), - (104, G["fi"]): ("SHIFT", 105), - (105, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (106, G[")"]): ("SHIFT", 107), - (107, G["/"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["of"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["<"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G[")"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["then"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["<="]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["."]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["else"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["="]): ("REDUCE", G["atom -> ( expr )"]), - (107, G[","]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G[";"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["in"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["@"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["+"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["error"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["-"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["*"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["}"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["}"]): ("SHIFT", 109), - (109, G[","]): ("REDUCE", G["expr -> { block }"]), - (109, G[";"]): ("REDUCE", G["expr -> { block }"]), - (109, G["loop"]): ("REDUCE", G["expr -> { block }"]), - (109, G["of"]): ("REDUCE", G["expr -> { block }"]), - (109, G["pool"]): ("REDUCE", G["expr -> { block }"]), - (109, G[")"]): ("REDUCE", G["expr -> { block }"]), - (109, G["then"]): ("REDUCE", G["expr -> { block }"]), - (109, G["error"]): ("REDUCE", G["expr -> { block }"]), - (109, G["else"]): ("REDUCE", G["expr -> { block }"]), - (109, G["in"]): ("REDUCE", G["expr -> { block }"]), - (109, G["fi"]): ("REDUCE", G["expr -> { block }"]), - (109, G["}"]): ("REDUCE", G["expr -> { block }"]), - (110, G["error"]): ("SHIFT", 113), - (110, G[";"]): ("SHIFT", 111), - (111, G["int"]): ("SHIFT", 33), - (111, G["case"]): ("SHIFT", 21), - (111, G["false"]): ("SHIFT", 26), - (111, G["}"]): ("REDUCE", G["block -> expr ;"]), - (111, G["while"]): ("SHIFT", 13), - (111, G["true"]): ("SHIFT", 25), - (111, G["id"]): ("SHIFT", 31), - (111, G["{"]): ("SHIFT", 10), - (111, G["if"]): ("SHIFT", 12), - (111, G["not"]): ("SHIFT", 30), - (111, G["~"]): ("SHIFT", 27), - (111, G["new"]): ("SHIFT", 22), - (111, G["("]): ("SHIFT", 11), - (111, G["isvoid"]): ("SHIFT", 24), - (111, G["string"]): ("SHIFT", 34), - (111, G["let"]): ("SHIFT", 14), - (112, G["}"]): ("REDUCE", G["block -> expr ; block"]), - (113, G["int"]): ("SHIFT", 33), - (113, G["case"]): ("SHIFT", 21), - (113, G["false"]): ("SHIFT", 26), - (113, G["while"]): ("SHIFT", 13), - (113, G["true"]): ("SHIFT", 25), - (113, G["id"]): ("SHIFT", 31), - (113, G["{"]): ("SHIFT", 10), - (113, G["if"]): ("SHIFT", 12), - (113, G["not"]): ("SHIFT", 30), - (113, G["}"]): ("REDUCE", G["block -> expr error"]), - (113, G["~"]): ("SHIFT", 27), - (113, G["new"]): ("SHIFT", 22), - (113, G["("]): ("SHIFT", 11), - (113, G["isvoid"]): ("SHIFT", 24), - (113, G["string"]): ("SHIFT", 34), - (113, G["let"]): ("SHIFT", 14), - (114, G["}"]): ("REDUCE", G["block -> expr error block"]), - (115, G["}"]): ("SHIFT", 116), - (116, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), - (116, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), - (117, G[":"]): ("SHIFT", 118), - (118, G["type"]): ("SHIFT", 119), - (119, G[","]): ("SHIFT", 120), - (119, G[")"]): ("REDUCE", G["param-list -> id : type"]), - (120, G["id"]): ("SHIFT", 117), - (121, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), - (122, G[")"]): ("SHIFT", 123), - (123, G[":"]): ("SHIFT", 124), - (124, G["type"]): ("SHIFT", 125), - (125, G["{"]): ("SHIFT", 126), - (126, G["while"]): ("SHIFT", 13), - (126, G["~"]): ("SHIFT", 27), - (126, G["isvoid"]): ("SHIFT", 24), - (126, G["{"]): ("SHIFT", 10), - (126, G["if"]): ("SHIFT", 12), - (126, G["not"]): ("SHIFT", 30), - (126, G["new"]): ("SHIFT", 22), - (126, G["("]): ("SHIFT", 11), - (126, G["string"]): ("SHIFT", 34), - (126, G["int"]): ("SHIFT", 33), - (126, G["false"]): ("SHIFT", 26), - (126, G["id"]): ("SHIFT", 31), - (126, G["let"]): ("SHIFT", 14), - (126, G["true"]): ("SHIFT", 25), - (126, G["case"]): ("SHIFT", 21), - (127, G["}"]): ("SHIFT", 128), - (128, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), - (128, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), - (129, G["type"]): ("SHIFT", 130), - (130, G["<-"]): ("SHIFT", 131), - (130, G["error"]): ("REDUCE", G["attribute -> id : type"]), - (130, G[";"]): ("REDUCE", G["attribute -> id : type"]), - (131, G["int"]): ("SHIFT", 33), - (131, G["case"]): ("SHIFT", 21), - (131, G["false"]): ("SHIFT", 26), - (131, G["while"]): ("SHIFT", 13), - (131, G["true"]): ("SHIFT", 25), - (131, G["id"]): ("SHIFT", 31), - (131, G["{"]): ("SHIFT", 10), - (131, G["if"]): ("SHIFT", 12), - (131, G["not"]): ("SHIFT", 30), - (131, G["~"]): ("SHIFT", 27), - (131, G["new"]): ("SHIFT", 22), - (131, G["("]): ("SHIFT", 11), - (131, G["isvoid"]): ("SHIFT", 24), - (131, G["string"]): ("SHIFT", 34), - (131, G["let"]): ("SHIFT", 14), - (132, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), - (132, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), - (133, G["}"]): ("SHIFT", 134), - (134, G[";"]): ("REDUCE", G["class-def -> class type { feature-list }"]), - (135, G[";"]): ("SHIFT", 136), - (135, G["error"]): ("SHIFT", 143), - (136, G["}"]): ("REDUCE", G["feature-list -> e"]), - (136, G["id"]): ("SHIFT", 4), - (137, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), - (138, G["error"]): ("SHIFT", 141), - (138, G[";"]): ("SHIFT", 139), - (139, G["}"]): ("REDUCE", G["feature-list -> e"]), - (139, G["id"]): ("SHIFT", 4), - (140, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), - (141, G["}"]): ("REDUCE", G["feature-list -> e"]), - (141, G["id"]): ("SHIFT", 4), - (142, G["}"]): ("REDUCE", G["feature-list -> method error feature-list"]), - (143, G["}"]): ("REDUCE", G["feature-list -> e"]), - (143, G["id"]): ("SHIFT", 4), - (144, G["}"]): ("REDUCE", G["feature-list -> attribute error feature-list"]), - (145, G["type"]): ("SHIFT", 146), - (146, G["{"]): ("SHIFT", 147), - (147, G["}"]): ("REDUCE", G["feature-list -> e"]), - (147, G["id"]): ("SHIFT", 4), - (148, G["}"]): ("SHIFT", 149), - (149, G[";"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), - (150, G["$"]): ("OK", None), - (151, G["$"]): ("REDUCE", G["program -> class-list"]), - (152, G[";"]): ("SHIFT", 153), - (153, G["class"]): ("SHIFT", 1), - (153, G["$"]): ("REDUCE", G["class-list -> class-def ;"]), - (154, G["$"]): ("REDUCE", G["class-list -> class-def ; class-list"]), - } - - @staticmethod - def __goto_table(): - return { - (0, G["class-def"]): 152, - (0, G["class-list"]): 151, - (0, G["program"]): 150, - (3, G["feature-list"]): 133, - (3, G["attribute"]): 135, - (3, G["method"]): 138, - (5, G["param-list"]): 122, - (9, G["term"]): 53, - (9, G["arith"]): 38, - (9, G["atom"]): 43, - (9, G["factor"]): 56, - (9, G["expr"]): 115, - (9, G["comp"]): 37, - (9, G["function-call"]): 35, - (10, G["term"]): 53, - (10, G["arith"]): 38, - (10, G["expr"]): 110, - (10, G["factor"]): 56, - (10, G["block"]): 108, - (10, G["function-call"]): 35, - (10, G["atom"]): 43, - (10, G["comp"]): 37, - (11, G["function-call"]): 35, - (11, G["term"]): 53, - (11, G["factor"]): 56, - (11, G["atom"]): 43, - (11, G["arith"]): 38, - (11, G["comp"]): 37, - (11, G["expr"]): 106, - (12, G["term"]): 53, - (12, G["atom"]): 43, - (12, G["arith"]): 38, - (12, G["expr"]): 100, - (12, G["factor"]): 56, - (12, G["comp"]): 37, - (12, G["function-call"]): 35, - (13, G["function-call"]): 35, - (13, G["arith"]): 38, - (13, G["term"]): 53, - (13, G["comp"]): 37, - (13, G["expr"]): 96, - (13, G["atom"]): 43, - (13, G["factor"]): 56, - (14, G["declaration-list"]): 93, - (18, G["declaration-list"]): 19, - (20, G["factor"]): 56, - (20, G["term"]): 53, - (20, G["function-call"]): 35, - (20, G["arith"]): 38, - (20, G["atom"]): 43, - (20, G["comp"]): 37, - (20, G["expr"]): 90, - (21, G["arith"]): 38, - (21, G["expr"]): 77, - (21, G["term"]): 53, - (21, G["function-call"]): 35, - (21, G["factor"]): 56, - (21, G["atom"]): 43, - (21, G["comp"]): 37, - (24, G["function-call"]): 35, - (24, G["atom"]): 43, - (24, G["factor"]): 76, - (27, G["factor"]): 75, - (27, G["function-call"]): 35, - (27, G["atom"]): 43, - (29, G["arith"]): 38, - (29, G["expr-list"]): 73, - (29, G["function-call"]): 35, - (29, G["term"]): 53, - (29, G["not-empty-expr-list"]): 49, - (29, G["factor"]): 56, - (29, G["comp"]): 37, - (29, G["atom"]): 43, - (29, G["expr"]): 50, - (30, G["function-call"]): 35, - (30, G["arith"]): 38, - (30, G["term"]): 53, - (30, G["comp"]): 37, - (30, G["atom"]): 43, - (30, G["expr"]): 72, - (30, G["factor"]): 56, - (32, G["function-call"]): 35, - (32, G["arith"]): 38, - (32, G["term"]): 53, - (32, G["expr"]): 36, - (32, G["comp"]): 37, - (32, G["atom"]): 43, - (32, G["factor"]): 56, - (39, G["function-call"]): 35, - (39, G["factor"]): 56, - (39, G["atom"]): 43, - (39, G["term"]): 40, - (41, G["function-call"]): 35, - (41, G["atom"]): 43, - (41, G["factor"]): 42, - (46, G["arith"]): 38, - (46, G["function-call"]): 35, - (46, G["term"]): 53, - (46, G["not-empty-expr-list"]): 49, - (46, G["factor"]): 56, - (46, G["comp"]): 37, - (46, G["atom"]): 43, - (46, G["expr"]): 50, - (46, G["expr-list"]): 47, - (51, G["arith"]): 38, - (51, G["function-call"]): 35, - (51, G["term"]): 53, - (51, G["factor"]): 56, - (51, G["comp"]): 37, - (51, G["atom"]): 43, - (51, G["expr"]): 50, - (51, G["not-empty-expr-list"]): 52, - (54, G["function-call"]): 35, - (54, G["atom"]): 43, - (54, G["factor"]): 55, - (61, G["arith"]): 38, - (61, G["function-call"]): 35, - (61, G["term"]): 53, - (61, G["not-empty-expr-list"]): 49, - (61, G["factor"]): 56, - (61, G["expr-list"]): 62, - (61, G["comp"]): 37, - (61, G["atom"]): 43, - (61, G["expr"]): 50, - (64, G["function-call"]): 35, - (64, G["factor"]): 56, - (64, G["atom"]): 43, - (64, G["term"]): 65, - (66, G["arith"]): 67, - (66, G["factor"]): 56, - (66, G["atom"]): 43, - (66, G["term"]): 53, - (66, G["function-call"]): 35, - (68, G["arith"]): 69, - (68, G["factor"]): 56, - (68, G["atom"]): 43, - (68, G["term"]): 53, - (68, G["function-call"]): 35, - (70, G["arith"]): 71, - (70, G["factor"]): 56, - (70, G["atom"]): 43, - (70, G["term"]): 53, - (70, G["function-call"]): 35, - (78, G["case-list"]): 88, - (82, G["term"]): 53, - (82, G["expr"]): 83, - (82, G["arith"]): 38, - (82, G["factor"]): 56, - (82, G["function-call"]): 35, - (82, G["atom"]): 43, - (82, G["comp"]): 37, - (84, G["case-list"]): 85, - (86, G["case-list"]): 87, - (91, G["declaration-list"]): 92, - (94, G["function-call"]): 35, - (94, G["arith"]): 38, - (94, G["term"]): 53, - (94, G["comp"]): 37, - (94, G["atom"]): 43, - (94, G["expr"]): 95, - (94, G["factor"]): 56, - (97, G["comp"]): 37, - (97, G["arith"]): 38, - (97, G["factor"]): 56, - (97, G["expr"]): 98, - (97, G["term"]): 53, - (97, G["function-call"]): 35, - (97, G["atom"]): 43, - (101, G["term"]): 53, - (101, G["atom"]): 43, - (101, G["arith"]): 38, - (101, G["factor"]): 56, - (101, G["expr"]): 102, - (101, G["function-call"]): 35, - (101, G["comp"]): 37, - (103, G["comp"]): 37, - (103, G["term"]): 53, - (103, G["arith"]): 38, - (103, G["atom"]): 43, - (103, G["function-call"]): 35, - (103, G["expr"]): 104, - (103, G["factor"]): 56, - (111, G["term"]): 53, - (111, G["arith"]): 38, - (111, G["expr"]): 110, - (111, G["factor"]): 56, - (111, G["function-call"]): 35, - (111, G["block"]): 112, - (111, G["atom"]): 43, - (111, G["comp"]): 37, - (113, G["term"]): 53, - (113, G["arith"]): 38, - (113, G["expr"]): 110, - (113, G["factor"]): 56, - (113, G["function-call"]): 35, - (113, G["block"]): 114, - (113, G["atom"]): 43, - (113, G["comp"]): 37, - (120, G["param-list"]): 121, - (126, G["expr"]): 127, - (126, G["term"]): 53, - (126, G["arith"]): 38, - (126, G["atom"]): 43, - (126, G["factor"]): 56, - (126, G["comp"]): 37, - (126, G["function-call"]): 35, - (131, G["term"]): 53, - (131, G["arith"]): 38, - (131, G["factor"]): 56, - (131, G["expr"]): 132, - (131, G["function-call"]): 35, - (131, G["atom"]): 43, - (131, G["comp"]): 37, - (136, G["attribute"]): 135, - (136, G["feature-list"]): 137, - (136, G["method"]): 138, - (139, G["feature-list"]): 140, - (139, G["attribute"]): 135, - (139, G["method"]): 138, - (141, G["feature-list"]): 142, - (141, G["attribute"]): 135, - (141, G["method"]): 138, - (143, G["feature-list"]): 144, - (143, G["attribute"]): 135, - (143, G["method"]): 138, - (147, G["feature-list"]): 148, - (147, G["attribute"]): 135, - (147, G["method"]): 138, - (153, G["class-def"]): 152, - (153, G["class-list"]): 154, - } +from abc import ABC +from pyjapt import ShiftReduceParser +from cool.grammar import G + + +class CoolParser(ShiftReduceParser, ABC): + def __init__(self, verbose=False): + self.grammar = G + self.verbose = verbose + self.action = self.__action_table() + self.goto = self.__goto_table() + self._errors = [] + self.error_handler = G.parsing_error_handler if G.parsing_error_handler is not None else self.error + + @staticmethod + def __action_table(): + return { + (0, G["class"]): ("SHIFT", 1), + (1, G["type"]): ("SHIFT", 2), + (2, G["inherits"]): ("SHIFT", 145), + (2, G["{"]): ("SHIFT", 3), + (3, G["id"]): ("SHIFT", 4), + (3, G["}"]): ("REDUCE", G["feature-list -> e"]), + (4, G["("]): ("SHIFT", 5), + (4, G[":"]): ("SHIFT", 129), + (5, G["id"]): ("SHIFT", 117), + (5, G[")"]): ("SHIFT", 6), + (6, G[":"]): ("SHIFT", 7), + (7, G["type"]): ("SHIFT", 8), + (8, G["{"]): ("SHIFT", 9), + (9, G["true"]): ("SHIFT", 25), + (9, G["let"]): ("SHIFT", 14), + (9, G["string"]): ("SHIFT", 34), + (9, G["id"]): ("SHIFT", 31), + (9, G["case"]): ("SHIFT", 21), + (9, G["while"]): ("SHIFT", 13), + (9, G["not"]): ("SHIFT", 30), + (9, G["isvoid"]): ("SHIFT", 24), + (9, G["if"]): ("SHIFT", 12), + (9, G["new"]): ("SHIFT", 22), + (9, G["{"]): ("SHIFT", 10), + (9, G["false"]): ("SHIFT", 26), + (9, G["~"]): ("SHIFT", 27), + (9, G["("]): ("SHIFT", 11), + (9, G["int"]): ("SHIFT", 33), + (10, G["id"]): ("SHIFT", 31), + (10, G["isvoid"]): ("SHIFT", 24), + (10, G["new"]): ("SHIFT", 22), + (10, G["let"]): ("SHIFT", 14), + (10, G["case"]): ("SHIFT", 21), + (10, G["false"]): ("SHIFT", 26), + (10, G["("]): ("SHIFT", 11), + (10, G["~"]): ("SHIFT", 27), + (10, G["int"]): ("SHIFT", 33), + (10, G["while"]): ("SHIFT", 13), + (10, G["true"]): ("SHIFT", 25), + (10, G["not"]): ("SHIFT", 30), + (10, G["string"]): ("SHIFT", 34), + (10, G["if"]): ("SHIFT", 12), + (10, G["{"]): ("SHIFT", 10), + (11, G["~"]): ("SHIFT", 27), + (11, G["while"]): ("SHIFT", 13), + (11, G["not"]): ("SHIFT", 30), + (11, G["id"]): ("SHIFT", 31), + (11, G["if"]): ("SHIFT", 12), + (11, G["new"]): ("SHIFT", 22), + (11, G["{"]): ("SHIFT", 10), + (11, G["false"]): ("SHIFT", 26), + (11, G["("]): ("SHIFT", 11), + (11, G["int"]): ("SHIFT", 33), + (11, G["isvoid"]): ("SHIFT", 24), + (11, G["true"]): ("SHIFT", 25), + (11, G["string"]): ("SHIFT", 34), + (11, G["let"]): ("SHIFT", 14), + (11, G["case"]): ("SHIFT", 21), + (12, G["true"]): ("SHIFT", 25), + (12, G["string"]): ("SHIFT", 34), + (12, G["id"]): ("SHIFT", 31), + (12, G["let"]): ("SHIFT", 14), + (12, G["case"]): ("SHIFT", 21), + (12, G["~"]): ("SHIFT", 27), + (12, G["while"]): ("SHIFT", 13), + (12, G["not"]): ("SHIFT", 30), + (12, G["if"]): ("SHIFT", 12), + (12, G["new"]): ("SHIFT", 22), + (12, G["{"]): ("SHIFT", 10), + (12, G["false"]): ("SHIFT", 26), + (12, G["("]): ("SHIFT", 11), + (12, G["isvoid"]): ("SHIFT", 24), + (12, G["int"]): ("SHIFT", 33), + (13, G["false"]): ("SHIFT", 26), + (13, G["("]): ("SHIFT", 11), + (13, G["if"]): ("SHIFT", 12), + (13, G["int"]): ("SHIFT", 33), + (13, G["id"]): ("SHIFT", 31), + (13, G["true"]): ("SHIFT", 25), + (13, G["{"]): ("SHIFT", 10), + (13, G["string"]): ("SHIFT", 34), + (13, G["not"]): ("SHIFT", 30), + (13, G["let"]): ("SHIFT", 14), + (13, G["isvoid"]): ("SHIFT", 24), + (13, G["case"]): ("SHIFT", 21), + (13, G["while"]): ("SHIFT", 13), + (13, G["new"]): ("SHIFT", 22), + (13, G["~"]): ("SHIFT", 27), + (14, G["id"]): ("SHIFT", 15), + (15, G[":"]): ("SHIFT", 16), + (16, G["type"]): ("SHIFT", 17), + (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), + (17, G["<-"]): ("SHIFT", 20), + (17, G[","]): ("SHIFT", 18), + (18, G["id"]): ("SHIFT", 15), + (19, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), + (20, G["while"]): ("SHIFT", 13), + (20, G["not"]): ("SHIFT", 30), + (20, G["if"]): ("SHIFT", 12), + (20, G["id"]): ("SHIFT", 31), + (20, G["new"]): ("SHIFT", 22), + (20, G["{"]): ("SHIFT", 10), + (20, G["isvoid"]): ("SHIFT", 24), + (20, G["false"]): ("SHIFT", 26), + (20, G["("]): ("SHIFT", 11), + (20, G["int"]): ("SHIFT", 33), + (20, G["true"]): ("SHIFT", 25), + (20, G["let"]): ("SHIFT", 14), + (20, G["~"]): ("SHIFT", 27), + (20, G["string"]): ("SHIFT", 34), + (20, G["case"]): ("SHIFT", 21), + (21, G["true"]): ("SHIFT", 25), + (21, G["if"]): ("SHIFT", 12), + (21, G["string"]): ("SHIFT", 34), + (21, G["id"]): ("SHIFT", 31), + (21, G["{"]): ("SHIFT", 10), + (21, G["isvoid"]): ("SHIFT", 24), + (21, G["~"]): ("SHIFT", 27), + (21, G["let"]): ("SHIFT", 14), + (21, G["case"]): ("SHIFT", 21), + (21, G["new"]): ("SHIFT", 22), + (21, G["false"]): ("SHIFT", 26), + (21, G["while"]): ("SHIFT", 13), + (21, G["("]): ("SHIFT", 11), + (21, G["int"]): ("SHIFT", 33), + (21, G["not"]): ("SHIFT", 30), + (22, G["type"]): ("SHIFT", 23), + (23, G["<"]): ("REDUCE", G["atom -> new type"]), + (23, G[")"]): ("REDUCE", G["atom -> new type"]), + (23, G["<="]): ("REDUCE", G["atom -> new type"]), + (23, G["error"]): ("REDUCE", G["atom -> new type"]), + (23, G["then"]): ("REDUCE", G["atom -> new type"]), + (23, G["."]): ("REDUCE", G["atom -> new type"]), + (23, G["="]): ("REDUCE", G["atom -> new type"]), + (23, G["else"]): ("REDUCE", G["atom -> new type"]), + (23, G[","]): ("REDUCE", G["atom -> new type"]), + (23, G["fi"]): ("REDUCE", G["atom -> new type"]), + (23, G[";"]): ("REDUCE", G["atom -> new type"]), + (23, G["loop"]): ("REDUCE", G["atom -> new type"]), + (23, G["@"]): ("REDUCE", G["atom -> new type"]), + (23, G["pool"]): ("REDUCE", G["atom -> new type"]), + (23, G["+"]): ("REDUCE", G["atom -> new type"]), + (23, G["-"]): ("REDUCE", G["atom -> new type"]), + (23, G["in"]): ("REDUCE", G["atom -> new type"]), + (23, G["*"]): ("REDUCE", G["atom -> new type"]), + (23, G["}"]): ("REDUCE", G["atom -> new type"]), + (23, G["/"]): ("REDUCE", G["atom -> new type"]), + (23, G["of"]): ("REDUCE", G["atom -> new type"]), + (24, G["string"]): ("SHIFT", 34), + (24, G["int"]): ("SHIFT", 33), + (24, G["new"]): ("SHIFT", 22), + (24, G["isvoid"]): ("SHIFT", 24), + (24, G["~"]): ("SHIFT", 27), + (24, G["true"]): ("SHIFT", 25), + (24, G["id"]): ("SHIFT", 28), + (24, G["false"]): ("SHIFT", 26), + (24, G["("]): ("SHIFT", 11), + (25, G["<"]): ("REDUCE", G["atom -> true"]), + (25, G[")"]): ("REDUCE", G["atom -> true"]), + (25, G["<="]): ("REDUCE", G["atom -> true"]), + (25, G["error"]): ("REDUCE", G["atom -> true"]), + (25, G["then"]): ("REDUCE", G["atom -> true"]), + (25, G["."]): ("REDUCE", G["atom -> true"]), + (25, G["="]): ("REDUCE", G["atom -> true"]), + (25, G["else"]): ("REDUCE", G["atom -> true"]), + (25, G[","]): ("REDUCE", G["atom -> true"]), + (25, G["fi"]): ("REDUCE", G["atom -> true"]), + (25, G[";"]): ("REDUCE", G["atom -> true"]), + (25, G["loop"]): ("REDUCE", G["atom -> true"]), + (25, G["@"]): ("REDUCE", G["atom -> true"]), + (25, G["pool"]): ("REDUCE", G["atom -> true"]), + (25, G["+"]): ("REDUCE", G["atom -> true"]), + (25, G["-"]): ("REDUCE", G["atom -> true"]), + (25, G["in"]): ("REDUCE", G["atom -> true"]), + (25, G["*"]): ("REDUCE", G["atom -> true"]), + (25, G["}"]): ("REDUCE", G["atom -> true"]), + (25, G["/"]): ("REDUCE", G["atom -> true"]), + (25, G["of"]): ("REDUCE", G["atom -> true"]), + (26, G["<"]): ("REDUCE", G["atom -> false"]), + (26, G[")"]): ("REDUCE", G["atom -> false"]), + (26, G["<="]): ("REDUCE", G["atom -> false"]), + (26, G["error"]): ("REDUCE", G["atom -> false"]), + (26, G["then"]): ("REDUCE", G["atom -> false"]), + (26, G["."]): ("REDUCE", G["atom -> false"]), + (26, G["="]): ("REDUCE", G["atom -> false"]), + (26, G["else"]): ("REDUCE", G["atom -> false"]), + (26, G[","]): ("REDUCE", G["atom -> false"]), + (26, G["fi"]): ("REDUCE", G["atom -> false"]), + (26, G[";"]): ("REDUCE", G["atom -> false"]), + (26, G["loop"]): ("REDUCE", G["atom -> false"]), + (26, G["@"]): ("REDUCE", G["atom -> false"]), + (26, G["pool"]): ("REDUCE", G["atom -> false"]), + (26, G["+"]): ("REDUCE", G["atom -> false"]), + (26, G["-"]): ("REDUCE", G["atom -> false"]), + (26, G["in"]): ("REDUCE", G["atom -> false"]), + (26, G["*"]): ("REDUCE", G["atom -> false"]), + (26, G["}"]): ("REDUCE", G["atom -> false"]), + (26, G["/"]): ("REDUCE", G["atom -> false"]), + (26, G["of"]): ("REDUCE", G["atom -> false"]), + (27, G["string"]): ("SHIFT", 34), + (27, G["int"]): ("SHIFT", 33), + (27, G["new"]): ("SHIFT", 22), + (27, G["isvoid"]): ("SHIFT", 24), + (27, G["~"]): ("SHIFT", 27), + (27, G["true"]): ("SHIFT", 25), + (27, G["id"]): ("SHIFT", 28), + (27, G["false"]): ("SHIFT", 26), + (27, G["("]): ("SHIFT", 11), + (28, G["("]): ("SHIFT", 29), + (28, G["<"]): ("REDUCE", G["atom -> id"]), + (28, G[")"]): ("REDUCE", G["atom -> id"]), + (28, G["<="]): ("REDUCE", G["atom -> id"]), + (28, G["error"]): ("REDUCE", G["atom -> id"]), + (28, G["then"]): ("REDUCE", G["atom -> id"]), + (28, G["."]): ("REDUCE", G["atom -> id"]), + (28, G["="]): ("REDUCE", G["atom -> id"]), + (28, G["else"]): ("REDUCE", G["atom -> id"]), + (28, G[","]): ("REDUCE", G["atom -> id"]), + (28, G["fi"]): ("REDUCE", G["atom -> id"]), + (28, G[";"]): ("REDUCE", G["atom -> id"]), + (28, G["loop"]): ("REDUCE", G["atom -> id"]), + (28, G["@"]): ("REDUCE", G["atom -> id"]), + (28, G["pool"]): ("REDUCE", G["atom -> id"]), + (28, G["+"]): ("REDUCE", G["atom -> id"]), + (28, G["-"]): ("REDUCE", G["atom -> id"]), + (28, G["in"]): ("REDUCE", G["atom -> id"]), + (28, G["*"]): ("REDUCE", G["atom -> id"]), + (28, G["}"]): ("REDUCE", G["atom -> id"]), + (28, G["/"]): ("REDUCE", G["atom -> id"]), + (28, G["of"]): ("REDUCE", G["atom -> id"]), + (29, G["id"]): ("SHIFT", 31), + (29, G["case"]): ("SHIFT", 21), + (29, G["isvoid"]): ("SHIFT", 24), + (29, G["new"]): ("SHIFT", 22), + (29, G["while"]): ("SHIFT", 13), + (29, G["false"]): ("SHIFT", 26), + (29, G["("]): ("SHIFT", 11), + (29, G["not"]): ("SHIFT", 30), + (29, G["int"]): ("SHIFT", 33), + (29, G["~"]): ("SHIFT", 27), + (29, G[")"]): ("REDUCE", G["expr-list -> e"]), + (29, G["true"]): ("SHIFT", 25), + (29, G["if"]): ("SHIFT", 12), + (29, G["string"]): ("SHIFT", 34), + (29, G["{"]): ("SHIFT", 10), + (29, G["let"]): ("SHIFT", 14), + (30, G["int"]): ("SHIFT", 33), + (30, G["if"]): ("SHIFT", 12), + (30, G["id"]): ("SHIFT", 31), + (30, G["~"]): ("SHIFT", 27), + (30, G["true"]): ("SHIFT", 25), + (30, G["{"]): ("SHIFT", 10), + (30, G["string"]): ("SHIFT", 34), + (30, G["let"]): ("SHIFT", 14), + (30, G["case"]): ("SHIFT", 21), + (30, G["while"]): ("SHIFT", 13), + (30, G["new"]): ("SHIFT", 22), + (30, G["not"]): ("SHIFT", 30), + (30, G["isvoid"]): ("SHIFT", 24), + (30, G["false"]): ("SHIFT", 26), + (30, G["("]): ("SHIFT", 11), + (31, G["<-"]): ("SHIFT", 32), + (31, G["("]): ("SHIFT", 29), + (31, G["<"]): ("REDUCE", G["atom -> id"]), + (31, G[")"]): ("REDUCE", G["atom -> id"]), + (31, G["<="]): ("REDUCE", G["atom -> id"]), + (31, G["error"]): ("REDUCE", G["atom -> id"]), + (31, G["then"]): ("REDUCE", G["atom -> id"]), + (31, G["."]): ("REDUCE", G["atom -> id"]), + (31, G["="]): ("REDUCE", G["atom -> id"]), + (31, G["else"]): ("REDUCE", G["atom -> id"]), + (31, G[","]): ("REDUCE", G["atom -> id"]), + (31, G["fi"]): ("REDUCE", G["atom -> id"]), + (31, G[";"]): ("REDUCE", G["atom -> id"]), + (31, G["loop"]): ("REDUCE", G["atom -> id"]), + (31, G["@"]): ("REDUCE", G["atom -> id"]), + (31, G["pool"]): ("REDUCE", G["atom -> id"]), + (31, G["+"]): ("REDUCE", G["atom -> id"]), + (31, G["-"]): ("REDUCE", G["atom -> id"]), + (31, G["in"]): ("REDUCE", G["atom -> id"]), + (31, G["*"]): ("REDUCE", G["atom -> id"]), + (31, G["}"]): ("REDUCE", G["atom -> id"]), + (31, G["/"]): ("REDUCE", G["atom -> id"]), + (31, G["of"]): ("REDUCE", G["atom -> id"]), + (32, G["int"]): ("SHIFT", 33), + (32, G["if"]): ("SHIFT", 12), + (32, G["id"]): ("SHIFT", 31), + (32, G["~"]): ("SHIFT", 27), + (32, G["true"]): ("SHIFT", 25), + (32, G["{"]): ("SHIFT", 10), + (32, G["string"]): ("SHIFT", 34), + (32, G["let"]): ("SHIFT", 14), + (32, G["case"]): ("SHIFT", 21), + (32, G["while"]): ("SHIFT", 13), + (32, G["new"]): ("SHIFT", 22), + (32, G["not"]): ("SHIFT", 30), + (32, G["isvoid"]): ("SHIFT", 24), + (32, G["false"]): ("SHIFT", 26), + (32, G["("]): ("SHIFT", 11), + (33, G["<"]): ("REDUCE", G["atom -> int"]), + (33, G[")"]): ("REDUCE", G["atom -> int"]), + (33, G["<="]): ("REDUCE", G["atom -> int"]), + (33, G["error"]): ("REDUCE", G["atom -> int"]), + (33, G["then"]): ("REDUCE", G["atom -> int"]), + (33, G["."]): ("REDUCE", G["atom -> int"]), + (33, G["="]): ("REDUCE", G["atom -> int"]), + (33, G["else"]): ("REDUCE", G["atom -> int"]), + (33, G[","]): ("REDUCE", G["atom -> int"]), + (33, G["fi"]): ("REDUCE", G["atom -> int"]), + (33, G[";"]): ("REDUCE", G["atom -> int"]), + (33, G["loop"]): ("REDUCE", G["atom -> int"]), + (33, G["@"]): ("REDUCE", G["atom -> int"]), + (33, G["pool"]): ("REDUCE", G["atom -> int"]), + (33, G["+"]): ("REDUCE", G["atom -> int"]), + (33, G["-"]): ("REDUCE", G["atom -> int"]), + (33, G["in"]): ("REDUCE", G["atom -> int"]), + (33, G["*"]): ("REDUCE", G["atom -> int"]), + (33, G["}"]): ("REDUCE", G["atom -> int"]), + (33, G["/"]): ("REDUCE", G["atom -> int"]), + (33, G["of"]): ("REDUCE", G["atom -> int"]), + (34, G["<"]): ("REDUCE", G["atom -> string"]), + (34, G[")"]): ("REDUCE", G["atom -> string"]), + (34, G["<="]): ("REDUCE", G["atom -> string"]), + (34, G["error"]): ("REDUCE", G["atom -> string"]), + (34, G["then"]): ("REDUCE", G["atom -> string"]), + (34, G["."]): ("REDUCE", G["atom -> string"]), + (34, G["="]): ("REDUCE", G["atom -> string"]), + (34, G["else"]): ("REDUCE", G["atom -> string"]), + (34, G[","]): ("REDUCE", G["atom -> string"]), + (34, G["fi"]): ("REDUCE", G["atom -> string"]), + (34, G[";"]): ("REDUCE", G["atom -> string"]), + (34, G["loop"]): ("REDUCE", G["atom -> string"]), + (34, G["@"]): ("REDUCE", G["atom -> string"]), + (34, G["pool"]): ("REDUCE", G["atom -> string"]), + (34, G["+"]): ("REDUCE", G["atom -> string"]), + (34, G["-"]): ("REDUCE", G["atom -> string"]), + (34, G["in"]): ("REDUCE", G["atom -> string"]), + (34, G["*"]): ("REDUCE", G["atom -> string"]), + (34, G["}"]): ("REDUCE", G["atom -> string"]), + (34, G["/"]): ("REDUCE", G["atom -> string"]), + (34, G["of"]): ("REDUCE", G["atom -> string"]), + (35, G["<"]): ("REDUCE", G["atom -> function-call"]), + (35, G[")"]): ("REDUCE", G["atom -> function-call"]), + (35, G["<="]): ("REDUCE", G["atom -> function-call"]), + (35, G["error"]): ("REDUCE", G["atom -> function-call"]), + (35, G["then"]): ("REDUCE", G["atom -> function-call"]), + (35, G["."]): ("REDUCE", G["atom -> function-call"]), + (35, G["="]): ("REDUCE", G["atom -> function-call"]), + (35, G["else"]): ("REDUCE", G["atom -> function-call"]), + (35, G[","]): ("REDUCE", G["atom -> function-call"]), + (35, G["fi"]): ("REDUCE", G["atom -> function-call"]), + (35, G[";"]): ("REDUCE", G["atom -> function-call"]), + (35, G["loop"]): ("REDUCE", G["atom -> function-call"]), + (35, G["@"]): ("REDUCE", G["atom -> function-call"]), + (35, G["pool"]): ("REDUCE", G["atom -> function-call"]), + (35, G["+"]): ("REDUCE", G["atom -> function-call"]), + (35, G["-"]): ("REDUCE", G["atom -> function-call"]), + (35, G["in"]): ("REDUCE", G["atom -> function-call"]), + (35, G["*"]): ("REDUCE", G["atom -> function-call"]), + (35, G["}"]): ("REDUCE", G["atom -> function-call"]), + (35, G["/"]): ("REDUCE", G["atom -> function-call"]), + (35, G["of"]): ("REDUCE", G["atom -> function-call"]), + (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["else"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["in"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G["}"]): ("REDUCE", G["expr -> id <- expr"]), + (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), + (37, G["loop"]): ("REDUCE", G["expr -> comp"]), + (37, G[")"]): ("REDUCE", G["expr -> comp"]), + (37, G["pool"]): ("REDUCE", G["expr -> comp"]), + (37, G["then"]): ("REDUCE", G["expr -> comp"]), + (37, G["error"]): ("REDUCE", G["expr -> comp"]), + (37, G["of"]): ("REDUCE", G["expr -> comp"]), + (37, G["else"]): ("REDUCE", G["expr -> comp"]), + (37, G[","]): ("REDUCE", G["expr -> comp"]), + (37, G["in"]): ("REDUCE", G["expr -> comp"]), + (37, G["fi"]): ("REDUCE", G["expr -> comp"]), + (37, G["}"]): ("REDUCE", G["expr -> comp"]), + (37, G[";"]): ("REDUCE", G["expr -> comp"]), + (38, G["<="]): ("SHIFT", 68), + (38, G["-"]): ("SHIFT", 64), + (38, G["loop"]): ("REDUCE", G["comp -> arith"]), + (38, G[")"]): ("REDUCE", G["comp -> arith"]), + (38, G["pool"]): ("REDUCE", G["comp -> arith"]), + (38, G["then"]): ("REDUCE", G["comp -> arith"]), + (38, G["error"]): ("REDUCE", G["comp -> arith"]), + (38, G["of"]): ("REDUCE", G["comp -> arith"]), + (38, G["else"]): ("REDUCE", G["comp -> arith"]), + (38, G[","]): ("REDUCE", G["comp -> arith"]), + (38, G["in"]): ("REDUCE", G["comp -> arith"]), + (38, G["fi"]): ("REDUCE", G["comp -> arith"]), + (38, G["}"]): ("REDUCE", G["comp -> arith"]), + (38, G[";"]): ("REDUCE", G["comp -> arith"]), + (38, G["="]): ("SHIFT", 70), + (38, G["+"]): ("SHIFT", 39), + (38, G["<"]): ("SHIFT", 66), + (39, G["int"]): ("SHIFT", 33), + (39, G["~"]): ("SHIFT", 27), + (39, G["true"]): ("SHIFT", 25), + (39, G["id"]): ("SHIFT", 28), + (39, G["string"]): ("SHIFT", 34), + (39, G["new"]): ("SHIFT", 22), + (39, G["isvoid"]): ("SHIFT", 24), + (39, G["false"]): ("SHIFT", 26), + (39, G["("]): ("SHIFT", 11), + (40, G["<"]): ("REDUCE", G["arith -> arith + term"]), + (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["<="]): ("REDUCE", G["arith -> arith + term"]), + (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["then"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["="]): ("REDUCE", G["arith -> arith + term"]), + (40, G["else"]): ("REDUCE", G["arith -> arith + term"]), + (40, G[","]): ("REDUCE", G["arith -> arith + term"]), + (40, G["fi"]): ("REDUCE", G["arith -> arith + term"]), + (40, G[";"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["+"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["of"]): ("REDUCE", G["arith -> arith + term"]), + (40, G["/"]): ("SHIFT", 54), + (40, G["*"]): ("SHIFT", 41), + (41, G["string"]): ("SHIFT", 34), + (41, G["int"]): ("SHIFT", 33), + (41, G["new"]): ("SHIFT", 22), + (41, G["isvoid"]): ("SHIFT", 24), + (41, G["~"]): ("SHIFT", 27), + (41, G["true"]): ("SHIFT", 25), + (41, G["id"]): ("SHIFT", 28), + (41, G["false"]): ("SHIFT", 26), + (41, G["("]): ("SHIFT", 11), + (42, G["<"]): ("REDUCE", G["term -> term * factor"]), + (42, G[")"]): ("REDUCE", G["term -> term * factor"]), + (42, G["<="]): ("REDUCE", G["term -> term * factor"]), + (42, G["error"]): ("REDUCE", G["term -> term * factor"]), + (42, G["then"]): ("REDUCE", G["term -> term * factor"]), + (42, G["="]): ("REDUCE", G["term -> term * factor"]), + (42, G["else"]): ("REDUCE", G["term -> term * factor"]), + (42, G[","]): ("REDUCE", G["term -> term * factor"]), + (42, G["fi"]): ("REDUCE", G["term -> term * factor"]), + (42, G[";"]): ("REDUCE", G["term -> term * factor"]), + (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), + (42, G["pool"]): ("REDUCE", G["term -> term * factor"]), + (42, G["+"]): ("REDUCE", G["term -> term * factor"]), + (42, G["-"]): ("REDUCE", G["term -> term * factor"]), + (42, G["in"]): ("REDUCE", G["term -> term * factor"]), + (42, G["*"]): ("REDUCE", G["term -> term * factor"]), + (42, G["}"]): ("REDUCE", G["term -> term * factor"]), + (42, G["/"]): ("REDUCE", G["term -> term * factor"]), + (42, G["of"]): ("REDUCE", G["term -> term * factor"]), + (43, G["<"]): ("REDUCE", G["factor -> atom"]), + (43, G[")"]): ("REDUCE", G["factor -> atom"]), + (43, G["<="]): ("REDUCE", G["factor -> atom"]), + (43, G["error"]): ("REDUCE", G["factor -> atom"]), + (43, G["then"]): ("REDUCE", G["factor -> atom"]), + (43, G["="]): ("REDUCE", G["factor -> atom"]), + (43, G["else"]): ("REDUCE", G["factor -> atom"]), + (43, G[","]): ("REDUCE", G["factor -> atom"]), + (43, G["fi"]): ("REDUCE", G["factor -> atom"]), + (43, G[";"]): ("REDUCE", G["factor -> atom"]), + (43, G["loop"]): ("REDUCE", G["factor -> atom"]), + (43, G["pool"]): ("REDUCE", G["factor -> atom"]), + (43, G["+"]): ("REDUCE", G["factor -> atom"]), + (43, G["-"]): ("REDUCE", G["factor -> atom"]), + (43, G["in"]): ("REDUCE", G["factor -> atom"]), + (43, G["*"]): ("REDUCE", G["factor -> atom"]), + (43, G["}"]): ("REDUCE", G["factor -> atom"]), + (43, G["/"]): ("REDUCE", G["factor -> atom"]), + (43, G["of"]): ("REDUCE", G["factor -> atom"]), + (43, G["."]): ("SHIFT", 44), + (43, G["@"]): ("SHIFT", 57), + (44, G["id"]): ("SHIFT", 45), + (45, G["("]): ("SHIFT", 46), + (46, G["id"]): ("SHIFT", 31), + (46, G["case"]): ("SHIFT", 21), + (46, G["isvoid"]): ("SHIFT", 24), + (46, G["new"]): ("SHIFT", 22), + (46, G["while"]): ("SHIFT", 13), + (46, G["false"]): ("SHIFT", 26), + (46, G["("]): ("SHIFT", 11), + (46, G["not"]): ("SHIFT", 30), + (46, G["int"]): ("SHIFT", 33), + (46, G["~"]): ("SHIFT", 27), + (46, G[")"]): ("REDUCE", G["expr-list -> e"]), + (46, G["true"]): ("SHIFT", 25), + (46, G["if"]): ("SHIFT", 12), + (46, G["string"]): ("SHIFT", 34), + (46, G["{"]): ("SHIFT", 10), + (46, G["let"]): ("SHIFT", 14), + (47, G[")"]): ("SHIFT", 48), + (48, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (48, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (49, G[")"]): ("REDUCE", G["expr-list -> not-empty-expr-list"]), + (50, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), + (50, G[","]): ("SHIFT", 51), + (51, G["id"]): ("SHIFT", 31), + (51, G["case"]): ("SHIFT", 21), + (51, G["isvoid"]): ("SHIFT", 24), + (51, G["new"]): ("SHIFT", 22), + (51, G["while"]): ("SHIFT", 13), + (51, G["false"]): ("SHIFT", 26), + (51, G["("]): ("SHIFT", 11), + (51, G["not"]): ("SHIFT", 30), + (51, G["int"]): ("SHIFT", 33), + (51, G["~"]): ("SHIFT", 27), + (51, G["true"]): ("SHIFT", 25), + (51, G["if"]): ("SHIFT", 12), + (51, G["string"]): ("SHIFT", 34), + (51, G["{"]): ("SHIFT", 10), + (51, G["let"]): ("SHIFT", 14), + (52, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr , not-empty-expr-list"]), + (53, G["<"]): ("REDUCE", G["arith -> term"]), + (53, G[")"]): ("REDUCE", G["arith -> term"]), + (53, G["<="]): ("REDUCE", G["arith -> term"]), + (53, G["error"]): ("REDUCE", G["arith -> term"]), + (53, G["then"]): ("REDUCE", G["arith -> term"]), + (53, G["="]): ("REDUCE", G["arith -> term"]), + (53, G["else"]): ("REDUCE", G["arith -> term"]), + (53, G[","]): ("REDUCE", G["arith -> term"]), + (53, G["fi"]): ("REDUCE", G["arith -> term"]), + (53, G[";"]): ("REDUCE", G["arith -> term"]), + (53, G["loop"]): ("REDUCE", G["arith -> term"]), + (53, G["pool"]): ("REDUCE", G["arith -> term"]), + (53, G["+"]): ("REDUCE", G["arith -> term"]), + (53, G["-"]): ("REDUCE", G["arith -> term"]), + (53, G["in"]): ("REDUCE", G["arith -> term"]), + (53, G["}"]): ("REDUCE", G["arith -> term"]), + (53, G["of"]): ("REDUCE", G["arith -> term"]), + (53, G["/"]): ("SHIFT", 54), + (53, G["*"]): ("SHIFT", 41), + (54, G["string"]): ("SHIFT", 34), + (54, G["int"]): ("SHIFT", 33), + (54, G["new"]): ("SHIFT", 22), + (54, G["isvoid"]): ("SHIFT", 24), + (54, G["~"]): ("SHIFT", 27), + (54, G["true"]): ("SHIFT", 25), + (54, G["id"]): ("SHIFT", 28), + (54, G["false"]): ("SHIFT", 26), + (54, G["("]): ("SHIFT", 11), + (55, G["<"]): ("REDUCE", G["term -> term / factor"]), + (55, G[")"]): ("REDUCE", G["term -> term / factor"]), + (55, G["<="]): ("REDUCE", G["term -> term / factor"]), + (55, G["error"]): ("REDUCE", G["term -> term / factor"]), + (55, G["then"]): ("REDUCE", G["term -> term / factor"]), + (55, G["="]): ("REDUCE", G["term -> term / factor"]), + (55, G["else"]): ("REDUCE", G["term -> term / factor"]), + (55, G[","]): ("REDUCE", G["term -> term / factor"]), + (55, G["fi"]): ("REDUCE", G["term -> term / factor"]), + (55, G[";"]): ("REDUCE", G["term -> term / factor"]), + (55, G["loop"]): ("REDUCE", G["term -> term / factor"]), + (55, G["pool"]): ("REDUCE", G["term -> term / factor"]), + (55, G["+"]): ("REDUCE", G["term -> term / factor"]), + (55, G["-"]): ("REDUCE", G["term -> term / factor"]), + (55, G["in"]): ("REDUCE", G["term -> term / factor"]), + (55, G["*"]): ("REDUCE", G["term -> term / factor"]), + (55, G["}"]): ("REDUCE", G["term -> term / factor"]), + (55, G["/"]): ("REDUCE", G["term -> term / factor"]), + (55, G["of"]): ("REDUCE", G["term -> term / factor"]), + (56, G["<"]): ("REDUCE", G["term -> factor"]), + (56, G[")"]): ("REDUCE", G["term -> factor"]), + (56, G["<="]): ("REDUCE", G["term -> factor"]), + (56, G["error"]): ("REDUCE", G["term -> factor"]), + (56, G["then"]): ("REDUCE", G["term -> factor"]), + (56, G["="]): ("REDUCE", G["term -> factor"]), + (56, G["else"]): ("REDUCE", G["term -> factor"]), + (56, G[","]): ("REDUCE", G["term -> factor"]), + (56, G["fi"]): ("REDUCE", G["term -> factor"]), + (56, G[";"]): ("REDUCE", G["term -> factor"]), + (56, G["loop"]): ("REDUCE", G["term -> factor"]), + (56, G["pool"]): ("REDUCE", G["term -> factor"]), + (56, G["+"]): ("REDUCE", G["term -> factor"]), + (56, G["-"]): ("REDUCE", G["term -> factor"]), + (56, G["in"]): ("REDUCE", G["term -> factor"]), + (56, G["*"]): ("REDUCE", G["term -> factor"]), + (56, G["}"]): ("REDUCE", G["term -> factor"]), + (56, G["/"]): ("REDUCE", G["term -> factor"]), + (56, G["of"]): ("REDUCE", G["term -> factor"]), + (57, G["type"]): ("SHIFT", 58), + (58, G["."]): ("SHIFT", 59), + (59, G["id"]): ("SHIFT", 60), + (60, G["("]): ("SHIFT", 61), + (61, G["id"]): ("SHIFT", 31), + (61, G["case"]): ("SHIFT", 21), + (61, G["isvoid"]): ("SHIFT", 24), + (61, G["new"]): ("SHIFT", 22), + (61, G["while"]): ("SHIFT", 13), + (61, G["false"]): ("SHIFT", 26), + (61, G["("]): ("SHIFT", 11), + (61, G["not"]): ("SHIFT", 30), + (61, G["int"]): ("SHIFT", 33), + (61, G["~"]): ("SHIFT", 27), + (61, G[")"]): ("REDUCE", G["expr-list -> e"]), + (61, G["true"]): ("SHIFT", 25), + (61, G["if"]): ("SHIFT", 12), + (61, G["string"]): ("SHIFT", 34), + (61, G["{"]): ("SHIFT", 10), + (61, G["let"]): ("SHIFT", 14), + (62, G[")"]): ("SHIFT", 63), + (63, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (63, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (64, G["int"]): ("SHIFT", 33), + (64, G["~"]): ("SHIFT", 27), + (64, G["true"]): ("SHIFT", 25), + (64, G["id"]): ("SHIFT", 28), + (64, G["string"]): ("SHIFT", 34), + (64, G["new"]): ("SHIFT", 22), + (64, G["isvoid"]): ("SHIFT", 24), + (64, G["false"]): ("SHIFT", 26), + (64, G["("]): ("SHIFT", 11), + (65, G["<"]): ("REDUCE", G["arith -> arith - term"]), + (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["<="]): ("REDUCE", G["arith -> arith - term"]), + (65, G["error"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["then"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["="]): ("REDUCE", G["arith -> arith - term"]), + (65, G["else"]): ("REDUCE", G["arith -> arith - term"]), + (65, G[","]): ("REDUCE", G["arith -> arith - term"]), + (65, G["fi"]): ("REDUCE", G["arith -> arith - term"]), + (65, G[";"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["loop"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["pool"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["+"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["-"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["}"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["of"]): ("REDUCE", G["arith -> arith - term"]), + (65, G["/"]): ("SHIFT", 54), + (65, G["*"]): ("SHIFT", 41), + (66, G["~"]): ("SHIFT", 27), + (66, G["true"]): ("SHIFT", 25), + (66, G["id"]): ("SHIFT", 28), + (66, G["isvoid"]): ("SHIFT", 24), + (66, G["string"]): ("SHIFT", 34), + (66, G["new"]): ("SHIFT", 22), + (66, G["false"]): ("SHIFT", 26), + (66, G["int"]): ("SHIFT", 33), + (66, G["("]): ("SHIFT", 11), + (67, G["+"]): ("SHIFT", 39), + (67, G["-"]): ("SHIFT", 64), + (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["else"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["in"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G["}"]): ("REDUCE", G["comp -> arith < arith"]), + (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), + (68, G["~"]): ("SHIFT", 27), + (68, G["true"]): ("SHIFT", 25), + (68, G["id"]): ("SHIFT", 28), + (68, G["isvoid"]): ("SHIFT", 24), + (68, G["string"]): ("SHIFT", 34), + (68, G["new"]): ("SHIFT", 22), + (68, G["false"]): ("SHIFT", 26), + (68, G["int"]): ("SHIFT", 33), + (68, G["("]): ("SHIFT", 11), + (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), + (69, G["-"]): ("SHIFT", 64), + (69, G["+"]): ("SHIFT", 39), + (70, G["~"]): ("SHIFT", 27), + (70, G["true"]): ("SHIFT", 25), + (70, G["id"]): ("SHIFT", 28), + (70, G["isvoid"]): ("SHIFT", 24), + (70, G["string"]): ("SHIFT", 34), + (70, G["new"]): ("SHIFT", 22), + (70, G["false"]): ("SHIFT", 26), + (70, G["int"]): ("SHIFT", 33), + (70, G["("]): ("SHIFT", 11), + (71, G["+"]): ("SHIFT", 39), + (71, G["-"]): ("SHIFT", 64), + (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["error"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["else"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["in"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G["}"]): ("REDUCE", G["comp -> arith = arith"]), + (71, G[";"]): ("REDUCE", G["comp -> arith = arith"]), + (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), + (72, G[";"]): ("REDUCE", G["expr -> not expr"]), + (72, G["pool"]): ("REDUCE", G["expr -> not expr"]), + (72, G[")"]): ("REDUCE", G["expr -> not expr"]), + (72, G["then"]): ("REDUCE", G["expr -> not expr"]), + (72, G["error"]): ("REDUCE", G["expr -> not expr"]), + (72, G["else"]): ("REDUCE", G["expr -> not expr"]), + (72, G[","]): ("REDUCE", G["expr -> not expr"]), + (72, G["in"]): ("REDUCE", G["expr -> not expr"]), + (72, G["fi"]): ("REDUCE", G["expr -> not expr"]), + (72, G["}"]): ("REDUCE", G["expr -> not expr"]), + (72, G["of"]): ("REDUCE", G["expr -> not expr"]), + (73, G[")"]): ("SHIFT", 74), + (74, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (74, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G["<"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G[")"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["<="]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["then"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["="]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["else"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G[","]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G[";"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["+"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["-"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["*"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["}"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["/"]): ("REDUCE", G["factor -> ~ factor"]), + (75, G["of"]): ("REDUCE", G["factor -> ~ factor"]), + (76, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), + (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), + (77, G["of"]): ("SHIFT", 78), + (78, G["id"]): ("SHIFT", 79), + (79, G[":"]): ("SHIFT", 80), + (80, G["type"]): ("SHIFT", 81), + (81, G["=>"]): ("SHIFT", 82), + (82, G["id"]): ("SHIFT", 31), + (82, G["isvoid"]): ("SHIFT", 24), + (82, G["new"]): ("SHIFT", 22), + (82, G["let"]): ("SHIFT", 14), + (82, G["case"]): ("SHIFT", 21), + (82, G["false"]): ("SHIFT", 26), + (82, G["("]): ("SHIFT", 11), + (82, G["~"]): ("SHIFT", 27), + (82, G["int"]): ("SHIFT", 33), + (82, G["while"]): ("SHIFT", 13), + (82, G["true"]): ("SHIFT", 25), + (82, G["not"]): ("SHIFT", 30), + (82, G["string"]): ("SHIFT", 34), + (82, G["if"]): ("SHIFT", 12), + (82, G["{"]): ("SHIFT", 10), + (83, G["error"]): ("SHIFT", 86), + (83, G[";"]): ("SHIFT", 84), + (84, G["id"]): ("SHIFT", 79), + (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), + (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), + (86, G["id"]): ("SHIFT", 79), + (86, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), + (87, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error case-list"]), + (88, G["esac"]): ("SHIFT", 89), + (89, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (89, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (90, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), + (90, G[","]): ("SHIFT", 91), + (91, G["id"]): ("SHIFT", 15), + (92, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), + (93, G["in"]): ("SHIFT", 94), + (94, G["int"]): ("SHIFT", 33), + (94, G["if"]): ("SHIFT", 12), + (94, G["id"]): ("SHIFT", 31), + (94, G["~"]): ("SHIFT", 27), + (94, G["true"]): ("SHIFT", 25), + (94, G["{"]): ("SHIFT", 10), + (94, G["string"]): ("SHIFT", 34), + (94, G["let"]): ("SHIFT", 14), + (94, G["case"]): ("SHIFT", 21), + (94, G["while"]): ("SHIFT", 13), + (94, G["new"]): ("SHIFT", 22), + (94, G["not"]): ("SHIFT", 30), + (94, G["isvoid"]): ("SHIFT", 24), + (94, G["false"]): ("SHIFT", 26), + (94, G["("]): ("SHIFT", 11), + (95, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (95, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (96, G["loop"]): ("SHIFT", 97), + (97, G["true"]): ("SHIFT", 25), + (97, G["{"]): ("SHIFT", 10), + (97, G["if"]): ("SHIFT", 12), + (97, G["id"]): ("SHIFT", 31), + (97, G["string"]): ("SHIFT", 34), + (97, G["isvoid"]): ("SHIFT", 24), + (97, G["let"]): ("SHIFT", 14), + (97, G["case"]): ("SHIFT", 21), + (97, G["("]): ("SHIFT", 11), + (97, G["~"]): ("SHIFT", 27), + (97, G["while"]): ("SHIFT", 13), + (97, G["not"]): ("SHIFT", 30), + (97, G["new"]): ("SHIFT", 22), + (97, G["false"]): ("SHIFT", 26), + (97, G["int"]): ("SHIFT", 33), + (98, G["pool"]): ("SHIFT", 99), + (99, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (99, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (100, G["then"]): ("SHIFT", 101), + (101, G["true"]): ("SHIFT", 25), + (101, G["string"]): ("SHIFT", 34), + (101, G["id"]): ("SHIFT", 31), + (101, G["if"]): ("SHIFT", 12), + (101, G["~"]): ("SHIFT", 27), + (101, G["{"]): ("SHIFT", 10), + (101, G["let"]): ("SHIFT", 14), + (101, G["new"]): ("SHIFT", 22), + (101, G["case"]): ("SHIFT", 21), + (101, G["while"]): ("SHIFT", 13), + (101, G["false"]): ("SHIFT", 26), + (101, G["("]): ("SHIFT", 11), + (101, G["isvoid"]): ("SHIFT", 24), + (101, G["int"]): ("SHIFT", 33), + (101, G["not"]): ("SHIFT", 30), + (102, G["else"]): ("SHIFT", 103), + (103, G["case"]): ("SHIFT", 21), + (103, G["while"]): ("SHIFT", 13), + (103, G["not"]): ("SHIFT", 30), + (103, G["id"]): ("SHIFT", 31), + (103, G["isvoid"]): ("SHIFT", 24), + (103, G["new"]): ("SHIFT", 22), + (103, G["if"]): ("SHIFT", 12), + (103, G["false"]): ("SHIFT", 26), + (103, G["("]): ("SHIFT", 11), + (103, G["~"]): ("SHIFT", 27), + (103, G["int"]): ("SHIFT", 33), + (103, G["{"]): ("SHIFT", 10), + (103, G["true"]): ("SHIFT", 25), + (103, G["string"]): ("SHIFT", 34), + (103, G["let"]): ("SHIFT", 14), + (104, G["fi"]): ("SHIFT", 105), + (105, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (105, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), + (106, G[")"]): ("SHIFT", 107), + (107, G["<"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G[")"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["<="]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["error"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["then"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["."]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["="]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["else"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G[","]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G[";"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["@"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["+"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["-"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["in"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["*"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["}"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["/"]): ("REDUCE", G["atom -> ( expr )"]), + (107, G["of"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["}"]): ("SHIFT", 109), + (109, G["loop"]): ("REDUCE", G["expr -> { block }"]), + (109, G[")"]): ("REDUCE", G["expr -> { block }"]), + (109, G["pool"]): ("REDUCE", G["expr -> { block }"]), + (109, G["then"]): ("REDUCE", G["expr -> { block }"]), + (109, G["error"]): ("REDUCE", G["expr -> { block }"]), + (109, G["of"]): ("REDUCE", G["expr -> { block }"]), + (109, G["else"]): ("REDUCE", G["expr -> { block }"]), + (109, G[","]): ("REDUCE", G["expr -> { block }"]), + (109, G["in"]): ("REDUCE", G["expr -> { block }"]), + (109, G["fi"]): ("REDUCE", G["expr -> { block }"]), + (109, G["}"]): ("REDUCE", G["expr -> { block }"]), + (109, G[";"]): ("REDUCE", G["expr -> { block }"]), + (110, G["error"]): ("SHIFT", 113), + (110, G[";"]): ("SHIFT", 111), + (111, G["id"]): ("SHIFT", 31), + (111, G["isvoid"]): ("SHIFT", 24), + (111, G["new"]): ("SHIFT", 22), + (111, G["let"]): ("SHIFT", 14), + (111, G["case"]): ("SHIFT", 21), + (111, G["false"]): ("SHIFT", 26), + (111, G["("]): ("SHIFT", 11), + (111, G["}"]): ("REDUCE", G["block -> expr ;"]), + (111, G["~"]): ("SHIFT", 27), + (111, G["int"]): ("SHIFT", 33), + (111, G["while"]): ("SHIFT", 13), + (111, G["true"]): ("SHIFT", 25), + (111, G["not"]): ("SHIFT", 30), + (111, G["string"]): ("SHIFT", 34), + (111, G["if"]): ("SHIFT", 12), + (111, G["{"]): ("SHIFT", 10), + (112, G["}"]): ("REDUCE", G["block -> expr ; block"]), + (113, G["id"]): ("SHIFT", 31), + (113, G["isvoid"]): ("SHIFT", 24), + (113, G["new"]): ("SHIFT", 22), + (113, G["let"]): ("SHIFT", 14), + (113, G["case"]): ("SHIFT", 21), + (113, G["false"]): ("SHIFT", 26), + (113, G["("]): ("SHIFT", 11), + (113, G["~"]): ("SHIFT", 27), + (113, G["int"]): ("SHIFT", 33), + (113, G["while"]): ("SHIFT", 13), + (113, G["true"]): ("SHIFT", 25), + (113, G["}"]): ("REDUCE", G["block -> expr error"]), + (113, G["not"]): ("SHIFT", 30), + (113, G["string"]): ("SHIFT", 34), + (113, G["if"]): ("SHIFT", 12), + (113, G["{"]): ("SHIFT", 10), + (114, G["}"]): ("REDUCE", G["block -> expr error block"]), + (115, G["}"]): ("SHIFT", 116), + (116, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (116, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (117, G[":"]): ("SHIFT", 118), + (118, G["type"]): ("SHIFT", 119), + (119, G[")"]): ("REDUCE", G["param-list -> id : type"]), + (119, G[","]): ("SHIFT", 120), + (120, G["id"]): ("SHIFT", 117), + (121, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), + (122, G[")"]): ("SHIFT", 123), + (123, G[":"]): ("SHIFT", 124), + (124, G["type"]): ("SHIFT", 125), + (125, G["{"]): ("SHIFT", 126), + (126, G["true"]): ("SHIFT", 25), + (126, G["let"]): ("SHIFT", 14), + (126, G["string"]): ("SHIFT", 34), + (126, G["id"]): ("SHIFT", 31), + (126, G["case"]): ("SHIFT", 21), + (126, G["while"]): ("SHIFT", 13), + (126, G["not"]): ("SHIFT", 30), + (126, G["isvoid"]): ("SHIFT", 24), + (126, G["if"]): ("SHIFT", 12), + (126, G["new"]): ("SHIFT", 22), + (126, G["{"]): ("SHIFT", 10), + (126, G["false"]): ("SHIFT", 26), + (126, G["~"]): ("SHIFT", 27), + (126, G["("]): ("SHIFT", 11), + (126, G["int"]): ("SHIFT", 33), + (127, G["}"]): ("SHIFT", 128), + (128, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (128, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (129, G["type"]): ("SHIFT", 130), + (130, G["error"]): ("REDUCE", G["attribute -> id : type"]), + (130, G[";"]): ("REDUCE", G["attribute -> id : type"]), + (130, G["<-"]): ("SHIFT", 131), + (131, G["id"]): ("SHIFT", 31), + (131, G["isvoid"]): ("SHIFT", 24), + (131, G["new"]): ("SHIFT", 22), + (131, G["let"]): ("SHIFT", 14), + (131, G["case"]): ("SHIFT", 21), + (131, G["false"]): ("SHIFT", 26), + (131, G["("]): ("SHIFT", 11), + (131, G["~"]): ("SHIFT", 27), + (131, G["int"]): ("SHIFT", 33), + (131, G["while"]): ("SHIFT", 13), + (131, G["true"]): ("SHIFT", 25), + (131, G["not"]): ("SHIFT", 30), + (131, G["string"]): ("SHIFT", 34), + (131, G["if"]): ("SHIFT", 12), + (131, G["{"]): ("SHIFT", 10), + (132, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (132, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (133, G["}"]): ("SHIFT", 134), + (134, G[";"]): ("REDUCE", G["class-def -> class type { feature-list }"]), + (135, G["error"]): ("SHIFT", 143), + (135, G[";"]): ("SHIFT", 136), + (136, G["id"]): ("SHIFT", 4), + (136, G["}"]): ("REDUCE", G["feature-list -> e"]), + (137, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), + (138, G[";"]): ("SHIFT", 139), + (138, G["error"]): ("SHIFT", 141), + (139, G["id"]): ("SHIFT", 4), + (139, G["}"]): ("REDUCE", G["feature-list -> e"]), + (140, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), + (141, G["id"]): ("SHIFT", 4), + (141, G["}"]): ("REDUCE", G["feature-list -> e"]), + (142, G["}"]): ("REDUCE", G["feature-list -> method error feature-list"]), + (143, G["id"]): ("SHIFT", 4), + (143, G["}"]): ("REDUCE", G["feature-list -> e"]), + (144, G["}"]): ("REDUCE", G["feature-list -> attribute error feature-list"]), + (145, G["type"]): ("SHIFT", 146), + (146, G["{"]): ("SHIFT", 147), + (147, G["id"]): ("SHIFT", 4), + (147, G["}"]): ("REDUCE", G["feature-list -> e"]), + (148, G["}"]): ("SHIFT", 149), + (149, G[";"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), + (150, G["$"]): ("OK", None), + (151, G["$"]): ("REDUCE", G["program -> class-list"]), + (152, G[";"]): ("SHIFT", 153), + (153, G["class"]): ("SHIFT", 1), + (153, G["$"]): ("REDUCE", G["class-list -> class-def ;"]), + (154, G["$"]): ("REDUCE", G["class-list -> class-def ; class-list"]), + } + + @staticmethod + def __goto_table(): + return { + (0, G["class-list"]): 151, + (0, G["program"]): 150, + (0, G["class-def"]): 152, + (3, G["feature-list"]): 133, + (3, G["attribute"]): 135, + (3, G["method"]): 138, + (5, G["param-list"]): 122, + (9, G["term"]): 53, + (9, G["arith"]): 38, + (9, G["function-call"]): 35, + (9, G["atom"]): 43, + (9, G["expr"]): 115, + (9, G["factor"]): 56, + (9, G["comp"]): 37, + (10, G["comp"]): 37, + (10, G["term"]): 53, + (10, G["expr"]): 110, + (10, G["arith"]): 38, + (10, G["atom"]): 43, + (10, G["function-call"]): 35, + (10, G["block"]): 108, + (10, G["factor"]): 56, + (11, G["term"]): 53, + (11, G["arith"]): 38, + (11, G["expr"]): 106, + (11, G["atom"]): 43, + (11, G["factor"]): 56, + (11, G["comp"]): 37, + (11, G["function-call"]): 35, + (12, G["comp"]): 37, + (12, G["arith"]): 38, + (12, G["function-call"]): 35, + (12, G["term"]): 53, + (12, G["expr"]): 100, + (12, G["atom"]): 43, + (12, G["factor"]): 56, + (13, G["term"]): 53, + (13, G["atom"]): 43, + (13, G["function-call"]): 35, + (13, G["expr"]): 96, + (13, G["arith"]): 38, + (13, G["comp"]): 37, + (13, G["factor"]): 56, + (14, G["declaration-list"]): 93, + (18, G["declaration-list"]): 19, + (20, G["arith"]): 38, + (20, G["atom"]): 43, + (20, G["factor"]): 56, + (20, G["comp"]): 37, + (20, G["term"]): 53, + (20, G["expr"]): 90, + (20, G["function-call"]): 35, + (21, G["arith"]): 38, + (21, G["function-call"]): 35, + (21, G["factor"]): 56, + (21, G["comp"]): 37, + (21, G["term"]): 53, + (21, G["atom"]): 43, + (21, G["expr"]): 77, + (24, G["atom"]): 43, + (24, G["factor"]): 76, + (24, G["function-call"]): 35, + (27, G["atom"]): 43, + (27, G["factor"]): 75, + (27, G["function-call"]): 35, + (29, G["term"]): 53, + (29, G["atom"]): 43, + (29, G["arith"]): 38, + (29, G["expr-list"]): 73, + (29, G["not-empty-expr-list"]): 49, + (29, G["expr"]): 50, + (29, G["function-call"]): 35, + (29, G["comp"]): 37, + (29, G["factor"]): 56, + (30, G["function-call"]): 35, + (30, G["term"]): 53, + (30, G["arith"]): 38, + (30, G["comp"]): 37, + (30, G["atom"]): 43, + (30, G["expr"]): 72, + (30, G["factor"]): 56, + (32, G["function-call"]): 35, + (32, G["expr"]): 36, + (32, G["term"]): 53, + (32, G["arith"]): 38, + (32, G["comp"]): 37, + (32, G["atom"]): 43, + (32, G["factor"]): 56, + (39, G["factor"]): 56, + (39, G["function-call"]): 35, + (39, G["term"]): 40, + (39, G["atom"]): 43, + (41, G["factor"]): 42, + (41, G["atom"]): 43, + (41, G["function-call"]): 35, + (46, G["expr-list"]): 47, + (46, G["term"]): 53, + (46, G["atom"]): 43, + (46, G["arith"]): 38, + (46, G["not-empty-expr-list"]): 49, + (46, G["expr"]): 50, + (46, G["function-call"]): 35, + (46, G["comp"]): 37, + (46, G["factor"]): 56, + (51, G["term"]): 53, + (51, G["atom"]): 43, + (51, G["arith"]): 38, + (51, G["expr"]): 50, + (51, G["not-empty-expr-list"]): 52, + (51, G["function-call"]): 35, + (51, G["comp"]): 37, + (51, G["factor"]): 56, + (54, G["factor"]): 55, + (54, G["atom"]): 43, + (54, G["function-call"]): 35, + (61, G["term"]): 53, + (61, G["expr-list"]): 62, + (61, G["atom"]): 43, + (61, G["arith"]): 38, + (61, G["not-empty-expr-list"]): 49, + (61, G["expr"]): 50, + (61, G["function-call"]): 35, + (61, G["comp"]): 37, + (61, G["factor"]): 56, + (64, G["factor"]): 56, + (64, G["term"]): 65, + (64, G["function-call"]): 35, + (64, G["atom"]): 43, + (66, G["factor"]): 56, + (66, G["arith"]): 67, + (66, G["term"]): 53, + (66, G["function-call"]): 35, + (66, G["atom"]): 43, + (68, G["factor"]): 56, + (68, G["term"]): 53, + (68, G["function-call"]): 35, + (68, G["atom"]): 43, + (68, G["arith"]): 69, + (70, G["factor"]): 56, + (70, G["term"]): 53, + (70, G["function-call"]): 35, + (70, G["arith"]): 71, + (70, G["atom"]): 43, + (78, G["case-list"]): 88, + (82, G["comp"]): 37, + (82, G["term"]): 53, + (82, G["arith"]): 38, + (82, G["expr"]): 83, + (82, G["atom"]): 43, + (82, G["function-call"]): 35, + (82, G["factor"]): 56, + (84, G["case-list"]): 85, + (86, G["case-list"]): 87, + (91, G["declaration-list"]): 92, + (94, G["expr"]): 95, + (94, G["function-call"]): 35, + (94, G["term"]): 53, + (94, G["arith"]): 38, + (94, G["comp"]): 37, + (94, G["atom"]): 43, + (94, G["factor"]): 56, + (97, G["arith"]): 38, + (97, G["factor"]): 56, + (97, G["function-call"]): 35, + (97, G["comp"]): 37, + (97, G["expr"]): 98, + (97, G["term"]): 53, + (97, G["atom"]): 43, + (101, G["function-call"]): 35, + (101, G["term"]): 53, + (101, G["arith"]): 38, + (101, G["comp"]): 37, + (101, G["atom"]): 43, + (101, G["expr"]): 102, + (101, G["factor"]): 56, + (103, G["factor"]): 56, + (103, G["arith"]): 38, + (103, G["term"]): 53, + (103, G["atom"]): 43, + (103, G["expr"]): 104, + (103, G["function-call"]): 35, + (103, G["comp"]): 37, + (111, G["comp"]): 37, + (111, G["term"]): 53, + (111, G["expr"]): 110, + (111, G["block"]): 112, + (111, G["arith"]): 38, + (111, G["atom"]): 43, + (111, G["function-call"]): 35, + (111, G["factor"]): 56, + (113, G["comp"]): 37, + (113, G["block"]): 114, + (113, G["term"]): 53, + (113, G["expr"]): 110, + (113, G["arith"]): 38, + (113, G["atom"]): 43, + (113, G["function-call"]): 35, + (113, G["factor"]): 56, + (120, G["param-list"]): 121, + (126, G["term"]): 53, + (126, G["arith"]): 38, + (126, G["function-call"]): 35, + (126, G["atom"]): 43, + (126, G["factor"]): 56, + (126, G["expr"]): 127, + (126, G["comp"]): 37, + (131, G["comp"]): 37, + (131, G["term"]): 53, + (131, G["arith"]): 38, + (131, G["expr"]): 132, + (131, G["atom"]): 43, + (131, G["function-call"]): 35, + (131, G["factor"]): 56, + (136, G["attribute"]): 135, + (136, G["feature-list"]): 137, + (136, G["method"]): 138, + (139, G["attribute"]): 135, + (139, G["method"]): 138, + (139, G["feature-list"]): 140, + (141, G["feature-list"]): 142, + (141, G["attribute"]): 135, + (141, G["method"]): 138, + (143, G["attribute"]): 135, + (143, G["feature-list"]): 144, + (143, G["method"]): 138, + (147, G["attribute"]): 135, + (147, G["feature-list"]): 148, + (147, G["method"]): 138, + (153, G["class-list"]): 154, + (153, G["class-def"]): 152, + } From 1c1784cc9b0f742d35cc41dd15bae118f119fcb8 Mon Sep 17 00:00:00 2001 From: alejandroklever Date: Tue, 9 Mar 2021 04:06:38 -0500 Subject: [PATCH 105/143] Modificando el llamado al compilador desde coolc.sh --- .idea/.gitignore | 8 -------- .vscode/settings.json | 8 -------- src/cool/__main__.py | 18 +++++++++--------- src/coolc.sh | 13 ++++++++++++- tests/conftest.py | 3 ++- 5 files changed, 23 insertions(+), 27 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .vscode/settings.json diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index f7be68ccd..000000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Datasource local storage ignored files -/ -/dataSources.local.xml -# Editor-based HTTP Client requests -/httpRequests/ diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index fd0ec4fff..000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "python.testing.pytestArgs": [ - "tests" - ], - "python.testing.unittestEnabled": false, - "python.testing.nosetestsEnabled": false, - "python.testing.pytestEnabled": true -} \ No newline at end of file diff --git a/src/cool/__main__.py b/src/cool/__main__.py index bcb64f87f..6f15284d4 100644 --- a/src/cool/__main__.py +++ b/src/cool/__main__.py @@ -35,7 +35,7 @@ def check_semantics(ast, scope: Scope, context: Context, errors: List[str]): def tokenize(file: typer.FileText, verbose: bool = False): path = Path.cwd() / file.name if not path.exists(): - typer.echo(f'File {file.name} does not exist.') + print(f'File {file.name} does not exist.') return None, None s = path.open('r').read() @@ -44,11 +44,11 @@ def tokenize(file: typer.FileText, verbose: bool = False): if lexer.contain_errors: for e in lexer.errors: - typer.echo(e, err=True) + print(e) if verbose: for t in tokens: - typer.echo(t) + print(t) return tokens, lexer @@ -64,7 +64,7 @@ def parse(file: typer.FileText, verbose: bool = False): if parser.contains_errors: for e in parser.errors: - typer.echo(e, err=True) + print(e) return ast, parser @@ -80,8 +80,8 @@ def infer( ast, _, _, errors = check_semantics(ast, Scope(), Context(), []) if errors: for e in errors: - typer.echo(e, err=True) - typer.echo(CodeBuilder().visit(ast, 0)) + print(e) + print(CodeBuilder().visit(ast, 0)) @app.command() @@ -97,12 +97,12 @@ def run( if not errors and not parser.contains_errors: try: Executor(context).visit(ast, Scope()) - typer.echo('Program finished...') + print('Program finished...') except ExecutionError as e: - typer.echo(e.text, err=True) + print(e.text) for error in errors: - typer.echo(error, err=True) + print(error) exit(0) else: exit(1) diff --git a/src/coolc.sh b/src/coolc.sh index ca9bedd69..87325b943 100755 --- a/src/coolc.sh +++ b/src/coolc.sh @@ -7,4 +7,15 @@ echo "Stranger Bugs Cool Compiler v0.1" echo "Copyright (c) 2019: Alejandro Klever Clemente, Laura Tamayo Blanco, Miguel Angel Gonzalez Calles" # Llamar al compilador -python cool run ${INPUT_FILE} +COOL_PATH="$(pwd)/src/cool" + +cd src +STD_OUT=$(python3 "${COOL_PATH}" run ${INPUT_FILE}) + +if [ $? -eq 1 ] +then + echo "${STD_OUT}" + false +else + true +fi \ No newline at end of file diff --git a/tests/conftest.py b/tests/conftest.py index 561d8bafc..572a30e5f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -3,4 +3,5 @@ @pytest.fixture def compiler_path(): - return os.path.abspath('./coolc.sh') \ No newline at end of file + # return os.path.abspath('./src/coolc.sh') + return os.path.abspath(os.path.join('src', 'coolc.sh')) From 7dcbed7f258fb97c4b88085d7e733676887bfe62 Mon Sep 17 00:00:00 2001 From: alejandroklever Date: Tue, 9 Mar 2021 04:41:09 -0500 Subject: [PATCH 106/143] Separando configuracion para pruebas locales y online --- src/coolc.sh | 22 +++++++++++++--------- tests/conftest.py | 5 ++++- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/coolc.sh b/src/coolc.sh index 87325b943..643f9aa69 100755 --- a/src/coolc.sh +++ b/src/coolc.sh @@ -7,15 +7,19 @@ echo "Stranger Bugs Cool Compiler v0.1" echo "Copyright (c) 2019: Alejandro Klever Clemente, Laura Tamayo Blanco, Miguel Angel Gonzalez Calles" # Llamar al compilador -COOL_PATH="$(pwd)/src/cool" -cd src -STD_OUT=$(python3 "${COOL_PATH}" run ${INPUT_FILE}) - -if [ $? -eq 1 ] +if [[ $(pwd) == *src ]] then - echo "${STD_OUT}" - false + python cool run ${INPUT_FILE} else - true -fi \ No newline at end of file + cd src + COOL_PATH="$(pwd)/cool" + STD_OUT=$(python3 ${COOL_PATH} run ${INPUT_FILE}) + if [ $? -eq 1 ] + then + echo "${STD_OUT}" + false + else + true + fi +fi diff --git a/tests/conftest.py b/tests/conftest.py index 572a30e5f..0d5b9dbae 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -3,5 +3,8 @@ @pytest.fixture def compiler_path(): - # return os.path.abspath('./src/coolc.sh') + if os.getcwd().endswith('src'): + return os.path.abspath('./coolc.sh') + + # For local test using the testing system of visual studio code return os.path.abspath(os.path.join('src', 'coolc.sh')) From a70f4db13eb8b65cfb987d602de1ea2361d5c48c Mon Sep 17 00:00:00 2001 From: alejandroklever Date: Tue, 9 Mar 2021 22:55:39 -0500 Subject: [PATCH 107/143] Fixed cool run api --- src/cool/__main__.py | 12 +++++++----- src/coolc.sh | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/cool/__main__.py b/src/cool/__main__.py index 6f15284d4..ce2b16806 100644 --- a/src/cool/__main__.py +++ b/src/cool/__main__.py @@ -91,6 +91,7 @@ def run( ): ast, parser = parse(file, verbose) + if ast is not None: ast, _, context, errors = check_semantics(ast, Scope(), Context(), []) @@ -98,14 +99,15 @@ def run( try: Executor(context).visit(ast, Scope()) print('Program finished...') + exit(0) except ExecutionError as e: print(e.text) + exit(1) - for error in errors: - print(error) - exit(0) - else: - exit(1) + for e in errors: + print(e) + + exit(1) @app.command() diff --git a/src/coolc.sh b/src/coolc.sh index 643f9aa69..41e6e2836 100755 --- a/src/coolc.sh +++ b/src/coolc.sh @@ -14,7 +14,7 @@ then else cd src COOL_PATH="$(pwd)/cool" - STD_OUT=$(python3 ${COOL_PATH} run ${INPUT_FILE}) + STD_OUT=$(python ${COOL_PATH} run ${INPUT_FILE}) if [ $? -eq 1 ] then echo "${STD_OUT}" From 4baa93a9fc41d9a5642503fdf9d7e89bb0524141 Mon Sep 17 00:00:00 2001 From: alejandroklever Date: Thu, 11 Mar 2021 16:59:14 -0500 Subject: [PATCH 108/143] arreglado proceso de lexing de los keywords --- src/cool/grammar.py | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/cool/grammar.py b/src/cool/grammar.py index 9aa37e44a..1b99ce2ed 100644 --- a/src/cool/grammar.py +++ b/src/cool/grammar.py @@ -2,6 +2,7 @@ import time from pyjapt import Grammar, Lexer, ShiftReduceParser +from pyjapt.lexing import Token import cool.semantics.utils.astnodes as ast @@ -52,14 +53,27 @@ # Identifiers # ############### @G.terminal('id', r'[a-z][a-zA-Z0-9_]*') -def id_terminal(lexer): - lexer.column += len(lexer.token.lex) - lexer.position += len(lexer.token.lex) - lexer.token.token_type = lexer.token.lex if lexer.token.lex in keywords_names else lexer.token.token_type +def id_terminal(lexer: Lexer): + lex = lexer.token.lex + print(lex) + lexer.column += len(lex) + lexer.position += len(lex) + lexer.token.token_type = lex.lower() if lex.lower() in keywords_names else lexer.token.token_type + print(lexer.token) + print() return lexer.token -G.add_terminal('type', regex=r'[A-Z][a-zA-Z0-9_]*') +@G.terminal('type', regex=r'[A-Z][a-zA-Z0-9_]*') +def type_terminal(lexer: Lexer): + lex = lexer.token.lex + print(lex) + lexer.column += len(lex) + lexer.position += len(lex) + lexer.token.token_type = lex.lower() if lex.lower() in keywords_names - {'true', 'false'} else lexer.token.token_type + print(lexer.token) + print() + return lexer.token ############### # Basic Types # From f9a38af6935f97dd9c0290c3cab789a593daf4e4 Mon Sep 17 00:00:00 2001 From: alejandroklever Date: Thu, 11 Mar 2021 17:08:08 -0500 Subject: [PATCH 109/143] excepcion controlada --- src/cool/grammar.py | 6 ------ src/cool/semantics/type_builder.py | 6 +++++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/cool/grammar.py b/src/cool/grammar.py index 1b99ce2ed..befc04db7 100644 --- a/src/cool/grammar.py +++ b/src/cool/grammar.py @@ -55,24 +55,18 @@ @G.terminal('id', r'[a-z][a-zA-Z0-9_]*') def id_terminal(lexer: Lexer): lex = lexer.token.lex - print(lex) lexer.column += len(lex) lexer.position += len(lex) lexer.token.token_type = lex.lower() if lex.lower() in keywords_names else lexer.token.token_type - print(lexer.token) - print() return lexer.token @G.terminal('type', regex=r'[A-Z][a-zA-Z0-9_]*') def type_terminal(lexer: Lexer): lex = lexer.token.lex - print(lex) lexer.column += len(lex) lexer.position += len(lex) lexer.token.token_type = lex.lower() if lex.lower() in keywords_names - {'true', 'false'} else lexer.token.token_type - print(lexer.token) - print() return lexer.token ############### diff --git a/src/cool/semantics/type_builder.py b/src/cool/semantics/type_builder.py index b6c653c9a..0d7479b31 100644 --- a/src/cool/semantics/type_builder.py +++ b/src/cool/semantics/type_builder.py @@ -73,4 +73,8 @@ def visit(self, node: ast.MethodDeclarationNode): return_type = ErrorType() self.errors.append(e.text) - self.current_type.define_method(node.id, param_names, param_types, return_type) + try: + self.current_type.define_method(node.id, param_names, param_types, return_type) + except SemanticError as e: + self.errors.append(e.text) + From e05173184ed5bbc4e740d1ec69afbae7d52e6997 Mon Sep 17 00:00:00 2001 From: alejandroklever Date: Sat, 13 Mar 2021 00:14:46 -0500 Subject: [PATCH 110/143] cambiando la api --- src/cool/__main__.py | 163 ++++++++++++++++++++++++++++--------------- 1 file changed, 106 insertions(+), 57 deletions(-) diff --git a/src/cool/__main__.py b/src/cool/__main__.py index ce2b16806..7a0b51f2f 100644 --- a/src/cool/__main__.py +++ b/src/cool/__main__.py @@ -7,107 +7,156 @@ sys.path.append(os.getcwd()) -from cool.grammar import serialize_parser_and_lexer +from cool.grammar import serialize_parser_and_lexer, Token from cool.lexertab import CoolLexer from cool.parsertab import CoolParser from cool.semantics import TypeCollector, TypeBuilder, OverriddenMethodChecker, TypeChecker, topological_sorting from cool.semantics.execution import Executor, ExecutionError -from cool.semantics.formatter import CodeBuilder +from cool.semantics.formatter import CodeBuilder, Formatter from cool.semantics.type_inference import InferenceChecker from cool.semantics.utils.scope import Context, Scope app = typer.Typer() -def check_semantics(ast, scope: Scope, context: Context, errors: List[str]): - TypeCollector(context, errors).visit(ast) - TypeBuilder(context, errors).visit(ast) - declarations = ast.declarations - topological_sorting(ast, context, errors) - ast.declarations = declarations - if not errors: - OverriddenMethodChecker(context, errors).visit(ast) - InferenceChecker(context, errors).visit(ast, scope) - TypeChecker(context, errors).visit(ast, scope) - return ast, scope, context, errors +def log_success(s: str): + styled_e = typer.style(s, fg=typer.colors.GREEN, bold=True) + typer.echo(styled_e) + + +def log_error(s: str): + styled_e = typer.style(s, fg=typer.colors.RED, bold=True) + typer.echo(styled_e) + +def format_tokens(tokens: List[Token]) -> str: + s = '' + last_line = 1 + for t in tokens: + if t.line != last_line: + last_line = t.line + s += '\n' + ' ' * t.column + else: + s += ' ' + s += t.token_type.name + return s -def tokenize(file: typer.FileText, verbose: bool = False): - path = Path.cwd() / file.name - if not path.exists(): - print(f'File {file.name} does not exist.') - return None, None - s = path.open('r').read() +def tokenize(program: str, verbose: bool = False): lexer = CoolLexer() - tokens = lexer(s) + tokens = lexer(program) if lexer.contain_errors: for e in lexer.errors: - print(e) + log_error(e) if verbose: - for t in tokens: - print(t) - + log_success('Tokens:') + log_success('-' * 80) + log_success(format_tokens(tokens) + '\n') + log_success('-' * 80) + print() + return tokens, lexer -def parse(file: typer.FileText, verbose: bool = False): - tokens, lexer = tokenize(file, verbose) - - if lexer is None or lexer.contain_errors: - return None, None - +def parse(tokens: List[Token], verbose: bool = False): parser = CoolParser(verbose) ast = parser(tokens) if parser.contains_errors: for e in parser.errors: - print(e) + log_error(e) return ast, parser +def check_semantics(ast, scope: Scope, context: Context, errors: List[str]): + TypeCollector(context, errors).visit(ast) + TypeBuilder(context, errors).visit(ast) + declarations = ast.declarations + topological_sorting(ast, context, errors) + ast.declarations = declarations + if not errors: + OverriddenMethodChecker(context, errors).visit(ast) + # InferenceChecker(context, errors).visit(ast, scope) + # TypeChecker(context, errors).visit(ast, scope) + return ast, scope, context, errors + + @app.command() -def infer( - file: typer.FileText = typer.Argument(..., help='Cool file'), - verbose: bool = typer.Argument(False, help='Execute in verbose mode.') +def run( + input_file: typer.FileText = typer.Argument(..., help='Cool file'), + verbose: bool = typer.Option(False, help='Execute in verbose mode.') ): - ast, _ = parse(file, verbose) + ast, parser = parse(input_file, verbose) - if ast is not None: - ast, _, _, errors = check_semantics(ast, Scope(), Context(), []) - if errors: - for e in errors: - print(e) - print(CodeBuilder().visit(ast, 0)) + + # parsing process failed + if ast is None: + exit(1) + + ast, _, context, errors = check_semantics(ast, Scope(), Context(), []) + + if errors or parser.contains_errors: + for e in errors: + log_error(e) + exit(1) + + try: + Executor(context).visit(ast, Scope()) + log_success('Program finished...') + exit(0) + except ExecutionError as e: + log_error(e.text) + exit(1) @app.command() -def run( - file: typer.FileText = typer.Argument(..., help='Cool file'), - verbose: bool = typer.Argument(False, help='Execute in verbose mode.') +def compile( + input_file: typer.FileText = typer.Argument(..., help='Cool file'), + output_file: typer.FileTextWrite = typer.Argument('a.mips', help='Mips file'), + verbose: bool = typer.Option(False, help='Run in verbose mode.') ): - ast, parser = parse(file, verbose) + program = input_file.read() + tokens, lexer = tokenize(program, verbose) + if lexer is None or lexer.contain_errors: + exit(1) - if ast is not None: - ast, _, context, errors = check_semantics(ast, Scope(), Context(), []) + if not tokens[:-1]: # there is always at least the EOF token + log_error('(0, 0) - SyntacticError: ERROR at or near EOF') + exit(1) + + ast, parser = parse(tokens, verbose) + + # parsing process failed + if ast is None: + exit(1) - if not errors and not parser.contains_errors: - try: - Executor(context).visit(ast, Scope()) - print('Program finished...') - exit(0) - except ExecutionError as e: - print(e.text) - exit(1) + ast, _, _, errors = check_semantics(ast, Scope(), Context(), []) + if errors or parser.contains_errors: for e in errors: - print(e) + log_error(e) + exit(1) - exit(1) + exit(0) + + +@app.command() +def infer( + file: typer.FileText = typer.Argument(..., help='Cool file'), + verbose: bool = typer.Argument(False, help='Execute in verbose mode.') +): + ast, _ = parse(file, verbose) + + if ast is not None: + ast, _, _, errors = check_semantics(ast, Scope(), Context(), []) + if errors: + for e in errors: + log_error(e) + log_success(CodeBuilder().visit(ast, 0)) @app.command() From 3631c3b0f6194522298761c29efc6347b260f431 Mon Sep 17 00:00:00 2001 From: alejandroklever Date: Sat, 13 Mar 2021 00:17:17 -0500 Subject: [PATCH 111/143] cambios en la gramatica --- src/cool/grammar.py | 50 +- src/cool/lexertab.py | 2 +- src/cool/parsertab.py | 2502 +++++++++++++++++++++-------------------- src/coolc.sh | 12 +- 4 files changed, 1309 insertions(+), 1257 deletions(-) diff --git a/src/cool/grammar.py b/src/cool/grammar.py index befc04db7..d841f14b8 100644 --- a/src/cool/grammar.py +++ b/src/cool/grammar.py @@ -1,8 +1,8 @@ import inspect import time -from pyjapt import Grammar, Lexer, ShiftReduceParser -from pyjapt.lexing import Token +from pyjapt import Grammar, Lexer, ShiftReduceParser, Token +from pyjapt.parsing import RuleList import cool.semantics.utils.astnodes as ast @@ -26,6 +26,7 @@ not_empty_expr_list = G.add_non_terminal('not-empty-expr-list') expr = G.add_non_terminal('expr') comp = G.add_non_terminal('comp') +negable = G.add_non_terminal('negable') arith = G.add_non_terminal('arith') term = G.add_non_terminal('term') factor = G.add_non_terminal('factor') @@ -88,7 +89,7 @@ def string(lexer: Lexer): lexer.contain_errors = True lexer.position = pos lexer.add_error(lexer.lineno, lexer.column, - f'({lexer.lineno},{lexer.column}) - LexicographicError: EOF in string constant') + f'({lexer.lineno}, {lexer.column}) - LexicographicError: EOF in string constant') return s = text[pos] @@ -120,13 +121,13 @@ def string(lexer: Lexer): lexer.contain_errors = True lexer.position = pos lexer.add_error(lexer.lineno, lexer.column, - f'({lexer.lineno},{lexer.column}) - LexicographicError: Unterminated string constant') + f'({lexer.lineno}, {lexer.column}) - LexicographicError: Unterminated string constant') return elif s == '\0': contains_null_character = True lexer.contain_errors = True lexer.add_error(lexer.lineno, lexer.column, - f'({lexer.lineno},{lexer.column}) - LexicographicError: String contains null character') + f'({lexer.lineno}, {lexer.column}) - LexicographicError: String contains null character') pos += 1 lexer.column += 1 else: @@ -162,6 +163,7 @@ def multi_line_comment(lexer: Lexer): counter = 1 text = lexer.text pos = lexer.position + 2 + lexer.column += 2 lex = '(*' while counter > 0: @@ -169,7 +171,7 @@ def multi_line_comment(lexer: Lexer): lexer.contain_errors = True lexer.position = pos lexer.add_error(lexer.lineno, lexer.column, - f'({lexer.lineno},{lexer.column}) - LexicographicError: EOF in comment') + f'({lexer.lineno}, {lexer.column}) - LexicographicError: EOF in comment') return None if text.startswith('(*', pos): @@ -220,7 +222,7 @@ def tab(lexer): @G.lexical_error def lexical_error(lexer): lexer.add_error(lexer.lineno, lexer.column, - f'({lexer.lineno},{lexer.column}) - LexicographicError: ERROR "{lexer.token.lex}"') + f'({lexer.lineno}, {lexer.column}) - LexicographicError: ERROR "{lexer.token.lex}"') lexer.column += len(lexer.token.lex) lexer.position += len(lexer.token.lex) @@ -251,17 +253,18 @@ def lexical_error(lexer): expr %= 'id <- expr', lambda s: ast.AssignNode(s[1], s[3]) expr %= '{ block }', lambda s: ast.BlockNode(s[2]) -expr %= 'if expr then expr else expr fi', lambda s: ast.ConditionalNode(s[2], s[4], s[6]) expr %= 'while expr loop expr pool', lambda s: ast.WhileNode(s[2], s[4]) expr %= 'let declaration-list in expr', lambda s: ast.LetNode(s[2], s[4]) expr %= 'case expr of case-list esac', lambda s: ast.SwitchCaseNode(s[2], s[4]) -expr %= 'not expr', lambda s: ast.NegationNode(s[2]) expr %= 'comp', lambda s: s[1] -comp %= 'arith < arith', lambda s: ast.LessThanNode(s[1], s[2], s[3]) -comp %= 'arith <= arith', lambda s: ast.LessEqualNode(s[1], s[2], s[3]) -comp %= 'arith = arith', lambda s: ast.EqualNode(s[1], s[2], s[3]) -comp %= 'arith', lambda s: s[1] +comp %= 'negable < negable', lambda s: ast.LessThanNode(s[1], s[2], s[3]) +comp %= 'negable <= negable', lambda s: ast.LessEqualNode(s[1], s[2], s[3]) +comp %= 'negable = negable', lambda s: ast.EqualNode(s[1], s[2], s[3]) +comp %= 'negable', lambda s: s[1] + +negable %= 'not arith', lambda s: ast.NegationNode(s[2]) +negable %= 'arith', lambda s: s[1] arith %= 'arith + term', lambda s: ast.PlusNode(s[1], s[2], s[3]) arith %= 'arith - term', lambda s: ast.MinusNode(s[1], s[2], s[3]) @@ -280,6 +283,7 @@ def lexical_error(lexer): atom %= 'false', lambda s: ast.BooleanNode(s[1]) atom %= 'int', lambda s: ast.IntegerNode(s[1]) atom %= 'string', lambda s: ast.StringNode(s[1]) +atom %= 'if expr then expr else expr fi', lambda s: ast.ConditionalNode(s[2], s[4], s[6]) atom %= 'function-call', lambda s: s[1] atom %= 'new type', lambda s: ast.InstantiateNode(s[2]) atom %= '( expr )', lambda s: s[2] @@ -313,42 +317,42 @@ def lexical_error(lexer): @G.parsing_error def parsing_error(parser: ShiftReduceParser): t = parser.current_token - parser.add_error(t.line, t.column, f'({t.line},{t.column}) - SyntacticError: ERROR at or near "{t.lex}"') + parser.add_error(t.line, t.column, f'({t.line}, {t.column}) - SyntacticError: ERROR at or near "{t.lex}"') @G.production("feature-list -> attribute error feature-list") def feature_attribute_error(s): - s.add_error(2, f'({s[2].line},{s[2].column}) - SyntacticError: ERROR at or near "{s[2].lex}"') + s.add_error(2, f'({s[2].line}, {s[2].column}) - SyntacticError: ERROR at or near "{s[2].lex}"') return [s[1]] + s[3] @G.production("feature-list -> method error feature-list") def feature_method_error(s): - s.add_error(2, f'({s[2].line},{s[2].column}) - SyntacticError: ERROR at or near "{s[2].lex}"') + s.add_error(2, f'({s[2].line}, {s[2].column}) - SyntacticError: ERROR at or near "{s[2].lex}"') return [s[1]] + s[3] @G.production("case-list -> id : type => expr error") def case_list_error(s): - s.add_error(6, f'({s[6].line},{s[6].column}) - SyntacticError: ERROR at or near "{s[6].lex}"') + s.add_error(6, f'({s[6].line}, {s[6].column}) - SyntacticError: ERROR at or near "{s[6].lex}"') return [(s[1], s[3], s[5])] @G.production("case-list -> id : type => expr error case-list") def case_list_error(s): - s.add_error(6, f'({s[6].line},{s[6].column}) - SyntacticError:ERROR at or near "{s[6].lex}"') + s.add_error(6, f'({s[6].line}, {s[6].column}) - SyntacticError:ERROR at or near "{s[6].lex}"') return [(s[1], s[3], s[5])] + s[7] @G.production("block -> expr error") def block_single_error(s): - s.add_error(2, f'({s[2].line},{s[2].column}) - SyntacticError: ERROR at or near "{s[2].lex}"') + s.add_error(2, f'({s[2].line}, {s[2].column}) - SyntacticError: ERROR at or near "{s[2].lex}"') return [s[1]] @G.production("block -> expr error block") def block_single_error(s): - s.add_error(2, f'({s[2].line},{s[2].column}) - SyntacticError: ERROR at or near "{s[2].lex}"') + s.add_error(2, f'({s[2].line}, {s[2].column}) - SyntacticError: ERROR at or near "{s[2].lex}"') return [s[1]] + s[3] @@ -356,10 +360,14 @@ def block_single_error(s): # Serialize API # ################# def serialize_parser_and_lexer(): + import typer + t = time.time() G.serialize_lexer('CoolLexer', inspect.getmodulename(__file__)) G.serialize_parser('lalr1', 'CoolParser', inspect.getmodulename(__file__)) - print('Serialization Time :', time.time() - t, 'seconds') + + styled_e = typer.style(f'Serialization Time : {time.time() - t} seconds', fg=typer.colors.GREEN, bold=True) + typer.echo(styled_e) if __name__ == '__main__': diff --git a/src/cool/lexertab.py b/src/cool/lexertab.py index dfa2f5eaa..993999786 100644 --- a/src/cool/lexertab.py +++ b/src/cool/lexertab.py @@ -10,7 +10,7 @@ def __init__(self): self.column = 1 self.position = 0 self.token = Token('', '', 0, 0) - self.pattern = re.compile(r'(?P[a-z][a-zA-Z0-9_]*)|(?P\")|(?P--.*)|(?P\(\*)|(?P\n+)|(?P +)|(?P\t+)|(?P[A-Z][a-zA-Z0-9_]*)|(?P\d+)|(inherits)|(isvoid)|(class)|(while)|(false)|(then)|(else)|(loop)|(pool)|(case)|(esac)|(true)|(<\-)|(let)|(new)|(not)|(\{)|(\})|(\()|(\))|(\.)|(=>)|(if)|(fi)|(in)|(of)|(\+)|(\-)|(\*)|(<=)|(\~)|(,)|(:)|(;)|(@)|(/)|(<)|(=)') + self.pattern = re.compile(r'(?P[a-z][a-zA-Z0-9_]*)|(?P[A-Z][a-zA-Z0-9_]*)|(?P\")|(?P--.*)|(?P\(\*)|(?P\n+)|(?P +)|(?P\t+)|(?P\d+)|(inherits)|(isvoid)|(class)|(while)|(false)|(then)|(else)|(loop)|(pool)|(case)|(esac)|(true)|(<\-)|(let)|(new)|(not)|(\{)|(\})|(\()|(\))|(\.)|(=>)|(if)|(fi)|(in)|(of)|(\+)|(\-)|(\*)|(<=)|(\~)|(,)|(:)|(;)|(@)|(/)|(<)|(=)') self.token_rules = {key: rule for key, (_, _, rule) in G.terminal_rules.items() if rule is not None} self.error_handler = G.lexical_error_handler if G.lexical_error_handler is not None else self.error self._errors = [] diff --git a/src/cool/parsertab.py b/src/cool/parsertab.py index db5133bb3..6a998badf 100644 --- a/src/cool/parsertab.py +++ b/src/cool/parsertab.py @@ -17,135 +17,141 @@ def __action_table(): return { (0, G["class"]): ("SHIFT", 1), (1, G["type"]): ("SHIFT", 2), - (2, G["inherits"]): ("SHIFT", 145), + (2, G["inherits"]): ("SHIFT", 146), (2, G["{"]): ("SHIFT", 3), - (3, G["id"]): ("SHIFT", 4), (3, G["}"]): ("REDUCE", G["feature-list -> e"]), + (3, G["id"]): ("SHIFT", 4), (4, G["("]): ("SHIFT", 5), - (4, G[":"]): ("SHIFT", 129), - (5, G["id"]): ("SHIFT", 117), + (4, G[":"]): ("SHIFT", 130), + (5, G["id"]): ("SHIFT", 118), (5, G[")"]): ("SHIFT", 6), (6, G[":"]): ("SHIFT", 7), (7, G["type"]): ("SHIFT", 8), (8, G["{"]): ("SHIFT", 9), - (9, G["true"]): ("SHIFT", 25), + (9, G["new"]): ("SHIFT", 22), + (9, G["{"]): ("SHIFT", 10), + (9, G["id"]): ("SHIFT", 43), (9, G["let"]): ("SHIFT", 14), - (9, G["string"]): ("SHIFT", 34), - (9, G["id"]): ("SHIFT", 31), - (9, G["case"]): ("SHIFT", 21), (9, G["while"]): ("SHIFT", 13), - (9, G["not"]): ("SHIFT", 30), + (9, G["true"]): ("SHIFT", 25), (9, G["isvoid"]): ("SHIFT", 24), - (9, G["if"]): ("SHIFT", 12), - (9, G["new"]): ("SHIFT", 22), - (9, G["{"]): ("SHIFT", 10), + (9, G["string"]): ("SHIFT", 32), (9, G["false"]): ("SHIFT", 26), + (9, G["not"]): ("SHIFT", 30), + (9, G["if"]): ("SHIFT", 12), (9, G["~"]): ("SHIFT", 27), (9, G["("]): ("SHIFT", 11), - (9, G["int"]): ("SHIFT", 33), - (10, G["id"]): ("SHIFT", 31), - (10, G["isvoid"]): ("SHIFT", 24), - (10, G["new"]): ("SHIFT", 22), - (10, G["let"]): ("SHIFT", 14), - (10, G["case"]): ("SHIFT", 21), - (10, G["false"]): ("SHIFT", 26), + (9, G["int"]): ("SHIFT", 31), + (9, G["case"]): ("SHIFT", 21), + (10, G["id"]): ("SHIFT", 43), + (10, G["if"]): ("SHIFT", 12), + (10, G["int"]): ("SHIFT", 31), (10, G["("]): ("SHIFT", 11), - (10, G["~"]): ("SHIFT", 27), - (10, G["int"]): ("SHIFT", 33), + (10, G["{"]): ("SHIFT", 10), + (10, G["let"]): ("SHIFT", 14), (10, G["while"]): ("SHIFT", 13), - (10, G["true"]): ("SHIFT", 25), + (10, G["isvoid"]): ("SHIFT", 24), (10, G["not"]): ("SHIFT", 30), - (10, G["string"]): ("SHIFT", 34), - (10, G["if"]): ("SHIFT", 12), - (10, G["{"]): ("SHIFT", 10), - (11, G["~"]): ("SHIFT", 27), - (11, G["while"]): ("SHIFT", 13), - (11, G["not"]): ("SHIFT", 30), - (11, G["id"]): ("SHIFT", 31), - (11, G["if"]): ("SHIFT", 12), - (11, G["new"]): ("SHIFT", 22), - (11, G["{"]): ("SHIFT", 10), - (11, G["false"]): ("SHIFT", 26), + (10, G["new"]): ("SHIFT", 22), + (10, G["true"]): ("SHIFT", 25), + (10, G["~"]): ("SHIFT", 27), + (10, G["string"]): ("SHIFT", 32), + (10, G["false"]): ("SHIFT", 26), + (10, G["case"]): ("SHIFT", 21), + (11, G["case"]): ("SHIFT", 21), + (11, G["id"]): ("SHIFT", 43), (11, G["("]): ("SHIFT", 11), - (11, G["int"]): ("SHIFT", 33), + (11, G["int"]): ("SHIFT", 31), + (11, G["{"]): ("SHIFT", 10), + (11, G["let"]): ("SHIFT", 14), + (11, G["new"]): ("SHIFT", 22), + (11, G["while"]): ("SHIFT", 13), (11, G["isvoid"]): ("SHIFT", 24), (11, G["true"]): ("SHIFT", 25), - (11, G["string"]): ("SHIFT", 34), - (11, G["let"]): ("SHIFT", 14), - (11, G["case"]): ("SHIFT", 21), - (12, G["true"]): ("SHIFT", 25), - (12, G["string"]): ("SHIFT", 34), - (12, G["id"]): ("SHIFT", 31), - (12, G["let"]): ("SHIFT", 14), + (11, G["string"]): ("SHIFT", 32), + (11, G["false"]): ("SHIFT", 26), + (11, G["not"]): ("SHIFT", 30), + (11, G["~"]): ("SHIFT", 27), + (11, G["if"]): ("SHIFT", 12), + (12, G["("]): ("SHIFT", 11), (12, G["case"]): ("SHIFT", 21), + (12, G["int"]): ("SHIFT", 31), + (12, G["id"]): ("SHIFT", 43), (12, G["~"]): ("SHIFT", 27), - (12, G["while"]): ("SHIFT", 13), - (12, G["not"]): ("SHIFT", 30), - (12, G["if"]): ("SHIFT", 12), (12, G["new"]): ("SHIFT", 22), (12, G["{"]): ("SHIFT", 10), + (12, G["let"]): ("SHIFT", 14), + (12, G["not"]): ("SHIFT", 30), + (12, G["while"]): ("SHIFT", 13), + (12, G["true"]): ("SHIFT", 25), + (12, G["string"]): ("SHIFT", 32), (12, G["false"]): ("SHIFT", 26), - (12, G["("]): ("SHIFT", 11), (12, G["isvoid"]): ("SHIFT", 24), - (12, G["int"]): ("SHIFT", 33), + (12, G["if"]): ("SHIFT", 12), + (13, G["id"]): ("SHIFT", 43), + (13, G["new"]): ("SHIFT", 22), + (13, G["not"]): ("SHIFT", 30), + (13, G["true"]): ("SHIFT", 25), + (13, G["isvoid"]): ("SHIFT", 24), + (13, G["string"]): ("SHIFT", 32), (13, G["false"]): ("SHIFT", 26), - (13, G["("]): ("SHIFT", 11), + (13, G["case"]): ("SHIFT", 21), (13, G["if"]): ("SHIFT", 12), - (13, G["int"]): ("SHIFT", 33), - (13, G["id"]): ("SHIFT", 31), - (13, G["true"]): ("SHIFT", 25), + (13, G["~"]): ("SHIFT", 27), + (13, G["int"]): ("SHIFT", 31), (13, G["{"]): ("SHIFT", 10), - (13, G["string"]): ("SHIFT", 34), - (13, G["not"]): ("SHIFT", 30), + (13, G["("]): ("SHIFT", 11), (13, G["let"]): ("SHIFT", 14), - (13, G["isvoid"]): ("SHIFT", 24), - (13, G["case"]): ("SHIFT", 21), (13, G["while"]): ("SHIFT", 13), - (13, G["new"]): ("SHIFT", 22), - (13, G["~"]): ("SHIFT", 27), (14, G["id"]): ("SHIFT", 15), (15, G[":"]): ("SHIFT", 16), (16, G["type"]): ("SHIFT", 17), - (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), - (17, G["<-"]): ("SHIFT", 20), (17, G[","]): ("SHIFT", 18), + (17, G["<-"]): ("SHIFT", 20), + (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), (18, G["id"]): ("SHIFT", 15), (19, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), - (20, G["while"]): ("SHIFT", 13), - (20, G["not"]): ("SHIFT", 30), - (20, G["if"]): ("SHIFT", 12), - (20, G["id"]): ("SHIFT", 31), - (20, G["new"]): ("SHIFT", 22), + (20, G["string"]): ("SHIFT", 32), (20, G["{"]): ("SHIFT", 10), - (20, G["isvoid"]): ("SHIFT", 24), (20, G["false"]): ("SHIFT", 26), - (20, G["("]): ("SHIFT", 11), - (20, G["int"]): ("SHIFT", 33), - (20, G["true"]): ("SHIFT", 25), + (20, G["id"]): ("SHIFT", 43), (20, G["let"]): ("SHIFT", 14), + (20, G["if"]): ("SHIFT", 12), + (20, G["while"]): ("SHIFT", 13), + (20, G["("]): ("SHIFT", 11), + (20, G["int"]): ("SHIFT", 31), + (20, G["not"]): ("SHIFT", 30), (20, G["~"]): ("SHIFT", 27), - (20, G["string"]): ("SHIFT", 34), + (20, G["new"]): ("SHIFT", 22), + (20, G["isvoid"]): ("SHIFT", 24), (20, G["case"]): ("SHIFT", 21), + (20, G["true"]): ("SHIFT", 25), + (21, G["isvoid"]): ("SHIFT", 24), + (21, G["not"]): ("SHIFT", 30), (21, G["true"]): ("SHIFT", 25), + (21, G["case"]): ("SHIFT", 21), + (21, G["id"]): ("SHIFT", 43), + (21, G["string"]): ("SHIFT", 32), + (21, G["false"]): ("SHIFT", 26), + (21, G["~"]): ("SHIFT", 27), (21, G["if"]): ("SHIFT", 12), - (21, G["string"]): ("SHIFT", 34), - (21, G["id"]): ("SHIFT", 31), (21, G["{"]): ("SHIFT", 10), - (21, G["isvoid"]): ("SHIFT", 24), - (21, G["~"]): ("SHIFT", 27), (21, G["let"]): ("SHIFT", 14), - (21, G["case"]): ("SHIFT", 21), - (21, G["new"]): ("SHIFT", 22), - (21, G["false"]): ("SHIFT", 26), - (21, G["while"]): ("SHIFT", 13), + (21, G["int"]): ("SHIFT", 31), (21, G["("]): ("SHIFT", 11), - (21, G["int"]): ("SHIFT", 33), - (21, G["not"]): ("SHIFT", 30), + (21, G["while"]): ("SHIFT", 13), + (21, G["new"]): ("SHIFT", 22), (22, G["type"]): ("SHIFT", 23), + (23, G["-"]): ("REDUCE", G["atom -> new type"]), + (23, G["in"]): ("REDUCE", G["atom -> new type"]), + (23, G["error"]): ("REDUCE", G["atom -> new type"]), + (23, G["*"]): ("REDUCE", G["atom -> new type"]), + (23, G["}"]): ("REDUCE", G["atom -> new type"]), + (23, G["/"]): ("REDUCE", G["atom -> new type"]), + (23, G["of"]): ("REDUCE", G["atom -> new type"]), (23, G["<"]): ("REDUCE", G["atom -> new type"]), (23, G[")"]): ("REDUCE", G["atom -> new type"]), (23, G["<="]): ("REDUCE", G["atom -> new type"]), - (23, G["error"]): ("REDUCE", G["atom -> new type"]), (23, G["then"]): ("REDUCE", G["atom -> new type"]), (23, G["."]): ("REDUCE", G["atom -> new type"]), (23, G["="]): ("REDUCE", G["atom -> new type"]), @@ -157,1213 +163,1259 @@ def __action_table(): (23, G["@"]): ("REDUCE", G["atom -> new type"]), (23, G["pool"]): ("REDUCE", G["atom -> new type"]), (23, G["+"]): ("REDUCE", G["atom -> new type"]), - (23, G["-"]): ("REDUCE", G["atom -> new type"]), - (23, G["in"]): ("REDUCE", G["atom -> new type"]), - (23, G["*"]): ("REDUCE", G["atom -> new type"]), - (23, G["}"]): ("REDUCE", G["atom -> new type"]), - (23, G["/"]): ("REDUCE", G["atom -> new type"]), - (23, G["of"]): ("REDUCE", G["atom -> new type"]), - (24, G["string"]): ("SHIFT", 34), - (24, G["int"]): ("SHIFT", 33), - (24, G["new"]): ("SHIFT", 22), - (24, G["isvoid"]): ("SHIFT", 24), (24, G["~"]): ("SHIFT", 27), + (24, G["("]): ("SHIFT", 11), (24, G["true"]): ("SHIFT", 25), - (24, G["id"]): ("SHIFT", 28), + (24, G["int"]): ("SHIFT", 31), + (24, G["isvoid"]): ("SHIFT", 24), + (24, G["string"]): ("SHIFT", 32), (24, G["false"]): ("SHIFT", 26), - (24, G["("]): ("SHIFT", 11), + (24, G["id"]): ("SHIFT", 28), + (24, G["new"]): ("SHIFT", 22), + (24, G["if"]): ("SHIFT", 12), + (25, G["-"]): ("REDUCE", G["atom -> true"]), + (25, G["in"]): ("REDUCE", G["atom -> true"]), + (25, G["*"]): ("REDUCE", G["atom -> true"]), + (25, G["}"]): ("REDUCE", G["atom -> true"]), + (25, G["/"]): ("REDUCE", G["atom -> true"]), + (25, G["of"]): ("REDUCE", G["atom -> true"]), (25, G["<"]): ("REDUCE", G["atom -> true"]), (25, G[")"]): ("REDUCE", G["atom -> true"]), (25, G["<="]): ("REDUCE", G["atom -> true"]), - (25, G["error"]): ("REDUCE", G["atom -> true"]), (25, G["then"]): ("REDUCE", G["atom -> true"]), (25, G["."]): ("REDUCE", G["atom -> true"]), (25, G["="]): ("REDUCE", G["atom -> true"]), (25, G["else"]): ("REDUCE", G["atom -> true"]), (25, G[","]): ("REDUCE", G["atom -> true"]), + (25, G["+"]): ("REDUCE", G["atom -> true"]), (25, G["fi"]): ("REDUCE", G["atom -> true"]), (25, G[";"]): ("REDUCE", G["atom -> true"]), (25, G["loop"]): ("REDUCE", G["atom -> true"]), (25, G["@"]): ("REDUCE", G["atom -> true"]), (25, G["pool"]): ("REDUCE", G["atom -> true"]), - (25, G["+"]): ("REDUCE", G["atom -> true"]), - (25, G["-"]): ("REDUCE", G["atom -> true"]), - (25, G["in"]): ("REDUCE", G["atom -> true"]), - (25, G["*"]): ("REDUCE", G["atom -> true"]), - (25, G["}"]): ("REDUCE", G["atom -> true"]), - (25, G["/"]): ("REDUCE", G["atom -> true"]), - (25, G["of"]): ("REDUCE", G["atom -> true"]), + (25, G["error"]): ("REDUCE", G["atom -> true"]), + (26, G["-"]): ("REDUCE", G["atom -> false"]), + (26, G["in"]): ("REDUCE", G["atom -> false"]), + (26, G["*"]): ("REDUCE", G["atom -> false"]), + (26, G["}"]): ("REDUCE", G["atom -> false"]), + (26, G["/"]): ("REDUCE", G["atom -> false"]), + (26, G["of"]): ("REDUCE", G["atom -> false"]), (26, G["<"]): ("REDUCE", G["atom -> false"]), (26, G[")"]): ("REDUCE", G["atom -> false"]), (26, G["<="]): ("REDUCE", G["atom -> false"]), - (26, G["error"]): ("REDUCE", G["atom -> false"]), (26, G["then"]): ("REDUCE", G["atom -> false"]), (26, G["."]): ("REDUCE", G["atom -> false"]), (26, G["="]): ("REDUCE", G["atom -> false"]), (26, G["else"]): ("REDUCE", G["atom -> false"]), (26, G[","]): ("REDUCE", G["atom -> false"]), + (26, G["+"]): ("REDUCE", G["atom -> false"]), (26, G["fi"]): ("REDUCE", G["atom -> false"]), (26, G[";"]): ("REDUCE", G["atom -> false"]), (26, G["loop"]): ("REDUCE", G["atom -> false"]), (26, G["@"]): ("REDUCE", G["atom -> false"]), (26, G["pool"]): ("REDUCE", G["atom -> false"]), - (26, G["+"]): ("REDUCE", G["atom -> false"]), - (26, G["-"]): ("REDUCE", G["atom -> false"]), - (26, G["in"]): ("REDUCE", G["atom -> false"]), - (26, G["*"]): ("REDUCE", G["atom -> false"]), - (26, G["}"]): ("REDUCE", G["atom -> false"]), - (26, G["/"]): ("REDUCE", G["atom -> false"]), - (26, G["of"]): ("REDUCE", G["atom -> false"]), - (27, G["string"]): ("SHIFT", 34), - (27, G["int"]): ("SHIFT", 33), - (27, G["new"]): ("SHIFT", 22), - (27, G["isvoid"]): ("SHIFT", 24), + (26, G["error"]): ("REDUCE", G["atom -> false"]), (27, G["~"]): ("SHIFT", 27), + (27, G["("]): ("SHIFT", 11), (27, G["true"]): ("SHIFT", 25), - (27, G["id"]): ("SHIFT", 28), + (27, G["int"]): ("SHIFT", 31), + (27, G["isvoid"]): ("SHIFT", 24), + (27, G["string"]): ("SHIFT", 32), (27, G["false"]): ("SHIFT", 26), - (27, G["("]): ("SHIFT", 11), + (27, G["id"]): ("SHIFT", 28), + (27, G["new"]): ("SHIFT", 22), + (27, G["if"]): ("SHIFT", 12), (28, G["("]): ("SHIFT", 29), + (28, G["-"]): ("REDUCE", G["atom -> id"]), + (28, G["in"]): ("REDUCE", G["atom -> id"]), + (28, G["*"]): ("REDUCE", G["atom -> id"]), + (28, G["}"]): ("REDUCE", G["atom -> id"]), + (28, G["/"]): ("REDUCE", G["atom -> id"]), + (28, G["of"]): ("REDUCE", G["atom -> id"]), (28, G["<"]): ("REDUCE", G["atom -> id"]), (28, G[")"]): ("REDUCE", G["atom -> id"]), (28, G["<="]): ("REDUCE", G["atom -> id"]), - (28, G["error"]): ("REDUCE", G["atom -> id"]), (28, G["then"]): ("REDUCE", G["atom -> id"]), (28, G["."]): ("REDUCE", G["atom -> id"]), (28, G["="]): ("REDUCE", G["atom -> id"]), (28, G["else"]): ("REDUCE", G["atom -> id"]), (28, G[","]): ("REDUCE", G["atom -> id"]), + (28, G["+"]): ("REDUCE", G["atom -> id"]), (28, G["fi"]): ("REDUCE", G["atom -> id"]), (28, G[";"]): ("REDUCE", G["atom -> id"]), (28, G["loop"]): ("REDUCE", G["atom -> id"]), (28, G["@"]): ("REDUCE", G["atom -> id"]), (28, G["pool"]): ("REDUCE", G["atom -> id"]), - (28, G["+"]): ("REDUCE", G["atom -> id"]), - (28, G["-"]): ("REDUCE", G["atom -> id"]), - (28, G["in"]): ("REDUCE", G["atom -> id"]), - (28, G["*"]): ("REDUCE", G["atom -> id"]), - (28, G["}"]): ("REDUCE", G["atom -> id"]), - (28, G["/"]): ("REDUCE", G["atom -> id"]), - (28, G["of"]): ("REDUCE", G["atom -> id"]), - (29, G["id"]): ("SHIFT", 31), - (29, G["case"]): ("SHIFT", 21), - (29, G["isvoid"]): ("SHIFT", 24), - (29, G["new"]): ("SHIFT", 22), - (29, G["while"]): ("SHIFT", 13), - (29, G["false"]): ("SHIFT", 26), - (29, G["("]): ("SHIFT", 11), - (29, G["not"]): ("SHIFT", 30), - (29, G["int"]): ("SHIFT", 33), + (28, G["error"]): ("REDUCE", G["atom -> id"]), (29, G["~"]): ("SHIFT", 27), - (29, G[")"]): ("REDUCE", G["expr-list -> e"]), - (29, G["true"]): ("SHIFT", 25), (29, G["if"]): ("SHIFT", 12), - (29, G["string"]): ("SHIFT", 34), + (29, G["int"]): ("SHIFT", 31), + (29, G["("]): ("SHIFT", 11), + (29, G["case"]): ("SHIFT", 21), + (29, G["id"]): ("SHIFT", 43), + (29, G[")"]): ("REDUCE", G["expr-list -> e"]), + (29, G["new"]): ("SHIFT", 22), (29, G["{"]): ("SHIFT", 10), (29, G["let"]): ("SHIFT", 14), - (30, G["int"]): ("SHIFT", 33), - (30, G["if"]): ("SHIFT", 12), - (30, G["id"]): ("SHIFT", 31), + (29, G["isvoid"]): ("SHIFT", 24), + (29, G["while"]): ("SHIFT", 13), + (29, G["true"]): ("SHIFT", 25), + (29, G["not"]): ("SHIFT", 30), + (29, G["string"]): ("SHIFT", 32), + (29, G["false"]): ("SHIFT", 26), (30, G["~"]): ("SHIFT", 27), + (30, G["("]): ("SHIFT", 11), (30, G["true"]): ("SHIFT", 25), - (30, G["{"]): ("SHIFT", 10), - (30, G["string"]): ("SHIFT", 34), - (30, G["let"]): ("SHIFT", 14), - (30, G["case"]): ("SHIFT", 21), - (30, G["while"]): ("SHIFT", 13), - (30, G["new"]): ("SHIFT", 22), - (30, G["not"]): ("SHIFT", 30), + (30, G["int"]): ("SHIFT", 31), (30, G["isvoid"]): ("SHIFT", 24), + (30, G["string"]): ("SHIFT", 32), (30, G["false"]): ("SHIFT", 26), - (30, G["("]): ("SHIFT", 11), - (31, G["<-"]): ("SHIFT", 32), - (31, G["("]): ("SHIFT", 29), - (31, G["<"]): ("REDUCE", G["atom -> id"]), - (31, G[")"]): ("REDUCE", G["atom -> id"]), - (31, G["<="]): ("REDUCE", G["atom -> id"]), - (31, G["error"]): ("REDUCE", G["atom -> id"]), - (31, G["then"]): ("REDUCE", G["atom -> id"]), - (31, G["."]): ("REDUCE", G["atom -> id"]), - (31, G["="]): ("REDUCE", G["atom -> id"]), - (31, G["else"]): ("REDUCE", G["atom -> id"]), - (31, G[","]): ("REDUCE", G["atom -> id"]), - (31, G["fi"]): ("REDUCE", G["atom -> id"]), - (31, G[";"]): ("REDUCE", G["atom -> id"]), - (31, G["loop"]): ("REDUCE", G["atom -> id"]), - (31, G["@"]): ("REDUCE", G["atom -> id"]), - (31, G["pool"]): ("REDUCE", G["atom -> id"]), - (31, G["+"]): ("REDUCE", G["atom -> id"]), - (31, G["-"]): ("REDUCE", G["atom -> id"]), - (31, G["in"]): ("REDUCE", G["atom -> id"]), - (31, G["*"]): ("REDUCE", G["atom -> id"]), - (31, G["}"]): ("REDUCE", G["atom -> id"]), - (31, G["/"]): ("REDUCE", G["atom -> id"]), - (31, G["of"]): ("REDUCE", G["atom -> id"]), - (32, G["int"]): ("SHIFT", 33), - (32, G["if"]): ("SHIFT", 12), - (32, G["id"]): ("SHIFT", 31), - (32, G["~"]): ("SHIFT", 27), - (32, G["true"]): ("SHIFT", 25), - (32, G["{"]): ("SHIFT", 10), - (32, G["string"]): ("SHIFT", 34), - (32, G["let"]): ("SHIFT", 14), - (32, G["case"]): ("SHIFT", 21), - (32, G["while"]): ("SHIFT", 13), - (32, G["new"]): ("SHIFT", 22), - (32, G["not"]): ("SHIFT", 30), - (32, G["isvoid"]): ("SHIFT", 24), - (32, G["false"]): ("SHIFT", 26), - (32, G["("]): ("SHIFT", 11), - (33, G["<"]): ("REDUCE", G["atom -> int"]), - (33, G[")"]): ("REDUCE", G["atom -> int"]), - (33, G["<="]): ("REDUCE", G["atom -> int"]), - (33, G["error"]): ("REDUCE", G["atom -> int"]), - (33, G["then"]): ("REDUCE", G["atom -> int"]), - (33, G["."]): ("REDUCE", G["atom -> int"]), - (33, G["="]): ("REDUCE", G["atom -> int"]), - (33, G["else"]): ("REDUCE", G["atom -> int"]), - (33, G[","]): ("REDUCE", G["atom -> int"]), - (33, G["fi"]): ("REDUCE", G["atom -> int"]), - (33, G[";"]): ("REDUCE", G["atom -> int"]), - (33, G["loop"]): ("REDUCE", G["atom -> int"]), - (33, G["@"]): ("REDUCE", G["atom -> int"]), - (33, G["pool"]): ("REDUCE", G["atom -> int"]), - (33, G["+"]): ("REDUCE", G["atom -> int"]), - (33, G["-"]): ("REDUCE", G["atom -> int"]), - (33, G["in"]): ("REDUCE", G["atom -> int"]), - (33, G["*"]): ("REDUCE", G["atom -> int"]), - (33, G["}"]): ("REDUCE", G["atom -> int"]), - (33, G["/"]): ("REDUCE", G["atom -> int"]), - (33, G["of"]): ("REDUCE", G["atom -> int"]), - (34, G["<"]): ("REDUCE", G["atom -> string"]), - (34, G[")"]): ("REDUCE", G["atom -> string"]), - (34, G["<="]): ("REDUCE", G["atom -> string"]), - (34, G["error"]): ("REDUCE", G["atom -> string"]), - (34, G["then"]): ("REDUCE", G["atom -> string"]), - (34, G["."]): ("REDUCE", G["atom -> string"]), - (34, G["="]): ("REDUCE", G["atom -> string"]), - (34, G["else"]): ("REDUCE", G["atom -> string"]), - (34, G[","]): ("REDUCE", G["atom -> string"]), - (34, G["fi"]): ("REDUCE", G["atom -> string"]), - (34, G[";"]): ("REDUCE", G["atom -> string"]), - (34, G["loop"]): ("REDUCE", G["atom -> string"]), - (34, G["@"]): ("REDUCE", G["atom -> string"]), - (34, G["pool"]): ("REDUCE", G["atom -> string"]), - (34, G["+"]): ("REDUCE", G["atom -> string"]), - (34, G["-"]): ("REDUCE", G["atom -> string"]), - (34, G["in"]): ("REDUCE", G["atom -> string"]), - (34, G["*"]): ("REDUCE", G["atom -> string"]), - (34, G["}"]): ("REDUCE", G["atom -> string"]), - (34, G["/"]): ("REDUCE", G["atom -> string"]), - (34, G["of"]): ("REDUCE", G["atom -> string"]), - (35, G["<"]): ("REDUCE", G["atom -> function-call"]), - (35, G[")"]): ("REDUCE", G["atom -> function-call"]), - (35, G["<="]): ("REDUCE", G["atom -> function-call"]), - (35, G["error"]): ("REDUCE", G["atom -> function-call"]), - (35, G["then"]): ("REDUCE", G["atom -> function-call"]), - (35, G["."]): ("REDUCE", G["atom -> function-call"]), - (35, G["="]): ("REDUCE", G["atom -> function-call"]), - (35, G["else"]): ("REDUCE", G["atom -> function-call"]), - (35, G[","]): ("REDUCE", G["atom -> function-call"]), - (35, G["fi"]): ("REDUCE", G["atom -> function-call"]), - (35, G[";"]): ("REDUCE", G["atom -> function-call"]), - (35, G["loop"]): ("REDUCE", G["atom -> function-call"]), - (35, G["@"]): ("REDUCE", G["atom -> function-call"]), - (35, G["pool"]): ("REDUCE", G["atom -> function-call"]), - (35, G["+"]): ("REDUCE", G["atom -> function-call"]), - (35, G["-"]): ("REDUCE", G["atom -> function-call"]), - (35, G["in"]): ("REDUCE", G["atom -> function-call"]), - (35, G["*"]): ("REDUCE", G["atom -> function-call"]), - (35, G["}"]): ("REDUCE", G["atom -> function-call"]), - (35, G["/"]): ("REDUCE", G["atom -> function-call"]), - (35, G["of"]): ("REDUCE", G["atom -> function-call"]), - (36, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[")"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["then"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["error"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["of"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["else"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[","]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["in"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G["}"]): ("REDUCE", G["expr -> id <- expr"]), - (36, G[";"]): ("REDUCE", G["expr -> id <- expr"]), - (37, G["loop"]): ("REDUCE", G["expr -> comp"]), - (37, G[")"]): ("REDUCE", G["expr -> comp"]), - (37, G["pool"]): ("REDUCE", G["expr -> comp"]), - (37, G["then"]): ("REDUCE", G["expr -> comp"]), - (37, G["error"]): ("REDUCE", G["expr -> comp"]), - (37, G["of"]): ("REDUCE", G["expr -> comp"]), - (37, G["else"]): ("REDUCE", G["expr -> comp"]), - (37, G[","]): ("REDUCE", G["expr -> comp"]), - (37, G["in"]): ("REDUCE", G["expr -> comp"]), - (37, G["fi"]): ("REDUCE", G["expr -> comp"]), - (37, G["}"]): ("REDUCE", G["expr -> comp"]), - (37, G[";"]): ("REDUCE", G["expr -> comp"]), - (38, G["<="]): ("SHIFT", 68), - (38, G["-"]): ("SHIFT", 64), - (38, G["loop"]): ("REDUCE", G["comp -> arith"]), - (38, G[")"]): ("REDUCE", G["comp -> arith"]), - (38, G["pool"]): ("REDUCE", G["comp -> arith"]), - (38, G["then"]): ("REDUCE", G["comp -> arith"]), - (38, G["error"]): ("REDUCE", G["comp -> arith"]), - (38, G["of"]): ("REDUCE", G["comp -> arith"]), - (38, G["else"]): ("REDUCE", G["comp -> arith"]), - (38, G[","]): ("REDUCE", G["comp -> arith"]), - (38, G["in"]): ("REDUCE", G["comp -> arith"]), - (38, G["fi"]): ("REDUCE", G["comp -> arith"]), - (38, G["}"]): ("REDUCE", G["comp -> arith"]), - (38, G[";"]): ("REDUCE", G["comp -> arith"]), - (38, G["="]): ("SHIFT", 70), - (38, G["+"]): ("SHIFT", 39), - (38, G["<"]): ("SHIFT", 66), - (39, G["int"]): ("SHIFT", 33), - (39, G["~"]): ("SHIFT", 27), - (39, G["true"]): ("SHIFT", 25), - (39, G["id"]): ("SHIFT", 28), - (39, G["string"]): ("SHIFT", 34), - (39, G["new"]): ("SHIFT", 22), - (39, G["isvoid"]): ("SHIFT", 24), - (39, G["false"]): ("SHIFT", 26), - (39, G["("]): ("SHIFT", 11), - (40, G["<"]): ("REDUCE", G["arith -> arith + term"]), - (40, G[")"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["<="]): ("REDUCE", G["arith -> arith + term"]), - (40, G["error"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["then"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["="]): ("REDUCE", G["arith -> arith + term"]), - (40, G["else"]): ("REDUCE", G["arith -> arith + term"]), - (40, G[","]): ("REDUCE", G["arith -> arith + term"]), - (40, G["fi"]): ("REDUCE", G["arith -> arith + term"]), - (40, G[";"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["loop"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["pool"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["+"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["-"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["in"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["}"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["of"]): ("REDUCE", G["arith -> arith + term"]), - (40, G["/"]): ("SHIFT", 54), - (40, G["*"]): ("SHIFT", 41), - (41, G["string"]): ("SHIFT", 34), - (41, G["int"]): ("SHIFT", 33), - (41, G["new"]): ("SHIFT", 22), - (41, G["isvoid"]): ("SHIFT", 24), - (41, G["~"]): ("SHIFT", 27), - (41, G["true"]): ("SHIFT", 25), - (41, G["id"]): ("SHIFT", 28), - (41, G["false"]): ("SHIFT", 26), - (41, G["("]): ("SHIFT", 11), - (42, G["<"]): ("REDUCE", G["term -> term * factor"]), - (42, G[")"]): ("REDUCE", G["term -> term * factor"]), - (42, G["<="]): ("REDUCE", G["term -> term * factor"]), - (42, G["error"]): ("REDUCE", G["term -> term * factor"]), - (42, G["then"]): ("REDUCE", G["term -> term * factor"]), - (42, G["="]): ("REDUCE", G["term -> term * factor"]), - (42, G["else"]): ("REDUCE", G["term -> term * factor"]), - (42, G[","]): ("REDUCE", G["term -> term * factor"]), - (42, G["fi"]): ("REDUCE", G["term -> term * factor"]), - (42, G[";"]): ("REDUCE", G["term -> term * factor"]), - (42, G["loop"]): ("REDUCE", G["term -> term * factor"]), - (42, G["pool"]): ("REDUCE", G["term -> term * factor"]), - (42, G["+"]): ("REDUCE", G["term -> term * factor"]), - (42, G["-"]): ("REDUCE", G["term -> term * factor"]), - (42, G["in"]): ("REDUCE", G["term -> term * factor"]), - (42, G["*"]): ("REDUCE", G["term -> term * factor"]), - (42, G["}"]): ("REDUCE", G["term -> term * factor"]), - (42, G["/"]): ("REDUCE", G["term -> term * factor"]), - (42, G["of"]): ("REDUCE", G["term -> term * factor"]), - (43, G["<"]): ("REDUCE", G["factor -> atom"]), - (43, G[")"]): ("REDUCE", G["factor -> atom"]), - (43, G["<="]): ("REDUCE", G["factor -> atom"]), - (43, G["error"]): ("REDUCE", G["factor -> atom"]), - (43, G["then"]): ("REDUCE", G["factor -> atom"]), - (43, G["="]): ("REDUCE", G["factor -> atom"]), - (43, G["else"]): ("REDUCE", G["factor -> atom"]), - (43, G[","]): ("REDUCE", G["factor -> atom"]), - (43, G["fi"]): ("REDUCE", G["factor -> atom"]), - (43, G[";"]): ("REDUCE", G["factor -> atom"]), - (43, G["loop"]): ("REDUCE", G["factor -> atom"]), - (43, G["pool"]): ("REDUCE", G["factor -> atom"]), - (43, G["+"]): ("REDUCE", G["factor -> atom"]), - (43, G["-"]): ("REDUCE", G["factor -> atom"]), - (43, G["in"]): ("REDUCE", G["factor -> atom"]), - (43, G["*"]): ("REDUCE", G["factor -> atom"]), - (43, G["}"]): ("REDUCE", G["factor -> atom"]), - (43, G["/"]): ("REDUCE", G["factor -> atom"]), - (43, G["of"]): ("REDUCE", G["factor -> atom"]), - (43, G["."]): ("SHIFT", 44), - (43, G["@"]): ("SHIFT", 57), - (44, G["id"]): ("SHIFT", 45), - (45, G["("]): ("SHIFT", 46), - (46, G["id"]): ("SHIFT", 31), - (46, G["case"]): ("SHIFT", 21), - (46, G["isvoid"]): ("SHIFT", 24), - (46, G["new"]): ("SHIFT", 22), - (46, G["while"]): ("SHIFT", 13), - (46, G["false"]): ("SHIFT", 26), - (46, G["("]): ("SHIFT", 11), - (46, G["not"]): ("SHIFT", 30), - (46, G["int"]): ("SHIFT", 33), - (46, G["~"]): ("SHIFT", 27), - (46, G[")"]): ("REDUCE", G["expr-list -> e"]), - (46, G["true"]): ("SHIFT", 25), - (46, G["if"]): ("SHIFT", 12), - (46, G["string"]): ("SHIFT", 34), - (46, G["{"]): ("SHIFT", 10), - (46, G["let"]): ("SHIFT", 14), - (47, G[")"]): ("SHIFT", 48), - (48, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (48, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (49, G[")"]): ("REDUCE", G["expr-list -> not-empty-expr-list"]), - (50, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), - (50, G[","]): ("SHIFT", 51), - (51, G["id"]): ("SHIFT", 31), - (51, G["case"]): ("SHIFT", 21), - (51, G["isvoid"]): ("SHIFT", 24), - (51, G["new"]): ("SHIFT", 22), - (51, G["while"]): ("SHIFT", 13), - (51, G["false"]): ("SHIFT", 26), - (51, G["("]): ("SHIFT", 11), - (51, G["not"]): ("SHIFT", 30), - (51, G["int"]): ("SHIFT", 33), + (30, G["id"]): ("SHIFT", 28), + (30, G["new"]): ("SHIFT", 22), + (30, G["if"]): ("SHIFT", 12), + (31, G["-"]): ("REDUCE", G["atom -> int"]), + (31, G["in"]): ("REDUCE", G["atom -> int"]), + (31, G["*"]): ("REDUCE", G["atom -> int"]), + (31, G["}"]): ("REDUCE", G["atom -> int"]), + (31, G["/"]): ("REDUCE", G["atom -> int"]), + (31, G["of"]): ("REDUCE", G["atom -> int"]), + (31, G["<"]): ("REDUCE", G["atom -> int"]), + (31, G[")"]): ("REDUCE", G["atom -> int"]), + (31, G["<="]): ("REDUCE", G["atom -> int"]), + (31, G["then"]): ("REDUCE", G["atom -> int"]), + (31, G["."]): ("REDUCE", G["atom -> int"]), + (31, G["="]): ("REDUCE", G["atom -> int"]), + (31, G["else"]): ("REDUCE", G["atom -> int"]), + (31, G[","]): ("REDUCE", G["atom -> int"]), + (31, G["+"]): ("REDUCE", G["atom -> int"]), + (31, G["fi"]): ("REDUCE", G["atom -> int"]), + (31, G[";"]): ("REDUCE", G["atom -> int"]), + (31, G["loop"]): ("REDUCE", G["atom -> int"]), + (31, G["@"]): ("REDUCE", G["atom -> int"]), + (31, G["pool"]): ("REDUCE", G["atom -> int"]), + (31, G["error"]): ("REDUCE", G["atom -> int"]), + (32, G["-"]): ("REDUCE", G["atom -> string"]), + (32, G["in"]): ("REDUCE", G["atom -> string"]), + (32, G["*"]): ("REDUCE", G["atom -> string"]), + (32, G["}"]): ("REDUCE", G["atom -> string"]), + (32, G["/"]): ("REDUCE", G["atom -> string"]), + (32, G["of"]): ("REDUCE", G["atom -> string"]), + (32, G["<"]): ("REDUCE", G["atom -> string"]), + (32, G[")"]): ("REDUCE", G["atom -> string"]), + (32, G["<="]): ("REDUCE", G["atom -> string"]), + (32, G["then"]): ("REDUCE", G["atom -> string"]), + (32, G["."]): ("REDUCE", G["atom -> string"]), + (32, G["="]): ("REDUCE", G["atom -> string"]), + (32, G["else"]): ("REDUCE", G["atom -> string"]), + (32, G[","]): ("REDUCE", G["atom -> string"]), + (32, G["+"]): ("REDUCE", G["atom -> string"]), + (32, G["fi"]): ("REDUCE", G["atom -> string"]), + (32, G[";"]): ("REDUCE", G["atom -> string"]), + (32, G["loop"]): ("REDUCE", G["atom -> string"]), + (32, G["@"]): ("REDUCE", G["atom -> string"]), + (32, G["pool"]): ("REDUCE", G["atom -> string"]), + (32, G["error"]): ("REDUCE", G["atom -> string"]), + (33, G["-"]): ("REDUCE", G["atom -> function-call"]), + (33, G["in"]): ("REDUCE", G["atom -> function-call"]), + (33, G["*"]): ("REDUCE", G["atom -> function-call"]), + (33, G["}"]): ("REDUCE", G["atom -> function-call"]), + (33, G["/"]): ("REDUCE", G["atom -> function-call"]), + (33, G["of"]): ("REDUCE", G["atom -> function-call"]), + (33, G["<"]): ("REDUCE", G["atom -> function-call"]), + (33, G[")"]): ("REDUCE", G["atom -> function-call"]), + (33, G["<="]): ("REDUCE", G["atom -> function-call"]), + (33, G["then"]): ("REDUCE", G["atom -> function-call"]), + (33, G["."]): ("REDUCE", G["atom -> function-call"]), + (33, G["="]): ("REDUCE", G["atom -> function-call"]), + (33, G["else"]): ("REDUCE", G["atom -> function-call"]), + (33, G[","]): ("REDUCE", G["atom -> function-call"]), + (33, G["+"]): ("REDUCE", G["atom -> function-call"]), + (33, G["fi"]): ("REDUCE", G["atom -> function-call"]), + (33, G[";"]): ("REDUCE", G["atom -> function-call"]), + (33, G["loop"]): ("REDUCE", G["atom -> function-call"]), + (33, G["@"]): ("REDUCE", G["atom -> function-call"]), + (33, G["pool"]): ("REDUCE", G["atom -> function-call"]), + (33, G["error"]): ("REDUCE", G["atom -> function-call"]), + (34, G["+"]): ("SHIFT", 35), + (34, G["-"]): ("SHIFT", 51), + (34, G["else"]): ("REDUCE", G["negable -> not arith"]), + (34, G["then"]): ("REDUCE", G["negable -> not arith"]), + (34, G["in"]): ("REDUCE", G["negable -> not arith"]), + (34, G[","]): ("REDUCE", G["negable -> not arith"]), + (34, G["fi"]): ("REDUCE", G["negable -> not arith"]), + (34, G["}"]): ("REDUCE", G["negable -> not arith"]), + (34, G["of"]): ("REDUCE", G["negable -> not arith"]), + (34, G[";"]): ("REDUCE", G["negable -> not arith"]), + (34, G["<"]): ("REDUCE", G["negable -> not arith"]), + (34, G["loop"]): ("REDUCE", G["negable -> not arith"]), + (34, G[")"]): ("REDUCE", G["negable -> not arith"]), + (34, G["pool"]): ("REDUCE", G["negable -> not arith"]), + (34, G["error"]): ("REDUCE", G["negable -> not arith"]), + (34, G["<="]): ("REDUCE", G["negable -> not arith"]), + (34, G["="]): ("REDUCE", G["negable -> not arith"]), + (35, G["~"]): ("SHIFT", 27), + (35, G["("]): ("SHIFT", 11), + (35, G["true"]): ("SHIFT", 25), + (35, G["int"]): ("SHIFT", 31), + (35, G["isvoid"]): ("SHIFT", 24), + (35, G["string"]): ("SHIFT", 32), + (35, G["false"]): ("SHIFT", 26), + (35, G["id"]): ("SHIFT", 28), + (35, G["new"]): ("SHIFT", 22), + (35, G["if"]): ("SHIFT", 12), + (36, G["/"]): ("SHIFT", 53), + (36, G["-"]): ("REDUCE", G["arith -> arith + term"]), + (36, G["in"]): ("REDUCE", G["arith -> arith + term"]), + (36, G["error"]): ("REDUCE", G["arith -> arith + term"]), + (36, G["}"]): ("REDUCE", G["arith -> arith + term"]), + (36, G["of"]): ("REDUCE", G["arith -> arith + term"]), + (36, G["<"]): ("REDUCE", G["arith -> arith + term"]), + (36, G[")"]): ("REDUCE", G["arith -> arith + term"]), + (36, G["<="]): ("REDUCE", G["arith -> arith + term"]), + (36, G["then"]): ("REDUCE", G["arith -> arith + term"]), + (36, G["="]): ("REDUCE", G["arith -> arith + term"]), + (36, G["else"]): ("REDUCE", G["arith -> arith + term"]), + (36, G[","]): ("REDUCE", G["arith -> arith + term"]), + (36, G["fi"]): ("REDUCE", G["arith -> arith + term"]), + (36, G[";"]): ("REDUCE", G["arith -> arith + term"]), + (36, G["loop"]): ("REDUCE", G["arith -> arith + term"]), + (36, G["pool"]): ("REDUCE", G["arith -> arith + term"]), + (36, G["+"]): ("REDUCE", G["arith -> arith + term"]), + (36, G["*"]): ("SHIFT", 37), + (37, G["~"]): ("SHIFT", 27), + (37, G["("]): ("SHIFT", 11), + (37, G["true"]): ("SHIFT", 25), + (37, G["int"]): ("SHIFT", 31), + (37, G["isvoid"]): ("SHIFT", 24), + (37, G["string"]): ("SHIFT", 32), + (37, G["false"]): ("SHIFT", 26), + (37, G["id"]): ("SHIFT", 28), + (37, G["new"]): ("SHIFT", 22), + (37, G["if"]): ("SHIFT", 12), + (38, G["-"]): ("REDUCE", G["term -> term * factor"]), + (38, G["in"]): ("REDUCE", G["term -> term * factor"]), + (38, G["*"]): ("REDUCE", G["term -> term * factor"]), + (38, G["}"]): ("REDUCE", G["term -> term * factor"]), + (38, G["/"]): ("REDUCE", G["term -> term * factor"]), + (38, G["of"]): ("REDUCE", G["term -> term * factor"]), + (38, G["<"]): ("REDUCE", G["term -> term * factor"]), + (38, G[")"]): ("REDUCE", G["term -> term * factor"]), + (38, G["<="]): ("REDUCE", G["term -> term * factor"]), + (38, G["then"]): ("REDUCE", G["term -> term * factor"]), + (38, G["="]): ("REDUCE", G["term -> term * factor"]), + (38, G["else"]): ("REDUCE", G["term -> term * factor"]), + (38, G[","]): ("REDUCE", G["term -> term * factor"]), + (38, G["+"]): ("REDUCE", G["term -> term * factor"]), + (38, G["fi"]): ("REDUCE", G["term -> term * factor"]), + (38, G[";"]): ("REDUCE", G["term -> term * factor"]), + (38, G["loop"]): ("REDUCE", G["term -> term * factor"]), + (38, G["pool"]): ("REDUCE", G["term -> term * factor"]), + (38, G["error"]): ("REDUCE", G["term -> term * factor"]), + (39, G["."]): ("SHIFT", 40), + (39, G["@"]): ("SHIFT", 67), + (39, G["-"]): ("REDUCE", G["factor -> atom"]), + (39, G["in"]): ("REDUCE", G["factor -> atom"]), + (39, G["error"]): ("REDUCE", G["factor -> atom"]), + (39, G["*"]): ("REDUCE", G["factor -> atom"]), + (39, G["}"]): ("REDUCE", G["factor -> atom"]), + (39, G["/"]): ("REDUCE", G["factor -> atom"]), + (39, G["of"]): ("REDUCE", G["factor -> atom"]), + (39, G["<"]): ("REDUCE", G["factor -> atom"]), + (39, G[")"]): ("REDUCE", G["factor -> atom"]), + (39, G["<="]): ("REDUCE", G["factor -> atom"]), + (39, G["then"]): ("REDUCE", G["factor -> atom"]), + (39, G["="]): ("REDUCE", G["factor -> atom"]), + (39, G["else"]): ("REDUCE", G["factor -> atom"]), + (39, G[","]): ("REDUCE", G["factor -> atom"]), + (39, G["fi"]): ("REDUCE", G["factor -> atom"]), + (39, G[";"]): ("REDUCE", G["factor -> atom"]), + (39, G["loop"]): ("REDUCE", G["factor -> atom"]), + (39, G["pool"]): ("REDUCE", G["factor -> atom"]), + (39, G["+"]): ("REDUCE", G["factor -> atom"]), + (40, G["id"]): ("SHIFT", 41), + (41, G["("]): ("SHIFT", 42), + (42, G["~"]): ("SHIFT", 27), + (42, G["if"]): ("SHIFT", 12), + (42, G["int"]): ("SHIFT", 31), + (42, G["("]): ("SHIFT", 11), + (42, G["case"]): ("SHIFT", 21), + (42, G["id"]): ("SHIFT", 43), + (42, G[")"]): ("REDUCE", G["expr-list -> e"]), + (42, G["new"]): ("SHIFT", 22), + (42, G["{"]): ("SHIFT", 10), + (42, G["let"]): ("SHIFT", 14), + (42, G["isvoid"]): ("SHIFT", 24), + (42, G["while"]): ("SHIFT", 13), + (42, G["true"]): ("SHIFT", 25), + (42, G["not"]): ("SHIFT", 30), + (42, G["string"]): ("SHIFT", 32), + (42, G["false"]): ("SHIFT", 26), + (43, G["<-"]): ("SHIFT", 44), + (43, G["("]): ("SHIFT", 29), + (43, G["-"]): ("REDUCE", G["atom -> id"]), + (43, G["in"]): ("REDUCE", G["atom -> id"]), + (43, G["*"]): ("REDUCE", G["atom -> id"]), + (43, G["}"]): ("REDUCE", G["atom -> id"]), + (43, G["/"]): ("REDUCE", G["atom -> id"]), + (43, G["of"]): ("REDUCE", G["atom -> id"]), + (43, G["<"]): ("REDUCE", G["atom -> id"]), + (43, G[")"]): ("REDUCE", G["atom -> id"]), + (43, G["<="]): ("REDUCE", G["atom -> id"]), + (43, G["then"]): ("REDUCE", G["atom -> id"]), + (43, G["."]): ("REDUCE", G["atom -> id"]), + (43, G["="]): ("REDUCE", G["atom -> id"]), + (43, G["else"]): ("REDUCE", G["atom -> id"]), + (43, G[","]): ("REDUCE", G["atom -> id"]), + (43, G["+"]): ("REDUCE", G["atom -> id"]), + (43, G["fi"]): ("REDUCE", G["atom -> id"]), + (43, G[";"]): ("REDUCE", G["atom -> id"]), + (43, G["loop"]): ("REDUCE", G["atom -> id"]), + (43, G["@"]): ("REDUCE", G["atom -> id"]), + (43, G["pool"]): ("REDUCE", G["atom -> id"]), + (43, G["error"]): ("REDUCE", G["atom -> id"]), + (44, G["case"]): ("SHIFT", 21), + (44, G["~"]): ("SHIFT", 27), + (44, G["id"]): ("SHIFT", 43), + (44, G["("]): ("SHIFT", 11), + (44, G["int"]): ("SHIFT", 31), + (44, G["{"]): ("SHIFT", 10), + (44, G["let"]): ("SHIFT", 14), + (44, G["new"]): ("SHIFT", 22), + (44, G["while"]): ("SHIFT", 13), + (44, G["true"]): ("SHIFT", 25), + (44, G["isvoid"]): ("SHIFT", 24), + (44, G["string"]): ("SHIFT", 32), + (44, G["false"]): ("SHIFT", 26), + (44, G["not"]): ("SHIFT", 30), + (44, G["if"]): ("SHIFT", 12), + (45, G["else"]): ("REDUCE", G["expr -> id <- expr"]), + (45, G["then"]): ("REDUCE", G["expr -> id <- expr"]), + (45, G[","]): ("REDUCE", G["expr -> id <- expr"]), + (45, G["in"]): ("REDUCE", G["expr -> id <- expr"]), + (45, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), + (45, G["}"]): ("REDUCE", G["expr -> id <- expr"]), + (45, G[";"]): ("REDUCE", G["expr -> id <- expr"]), + (45, G["of"]): ("REDUCE", G["expr -> id <- expr"]), + (45, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), + (45, G[")"]): ("REDUCE", G["expr -> id <- expr"]), + (45, G["error"]): ("REDUCE", G["expr -> id <- expr"]), + (45, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), + (46, G["else"]): ("REDUCE", G["expr -> comp"]), + (46, G["then"]): ("REDUCE", G["expr -> comp"]), + (46, G[","]): ("REDUCE", G["expr -> comp"]), + (46, G["in"]): ("REDUCE", G["expr -> comp"]), + (46, G["fi"]): ("REDUCE", G["expr -> comp"]), + (46, G["}"]): ("REDUCE", G["expr -> comp"]), + (46, G[";"]): ("REDUCE", G["expr -> comp"]), + (46, G["of"]): ("REDUCE", G["expr -> comp"]), + (46, G["loop"]): ("REDUCE", G["expr -> comp"]), + (46, G[")"]): ("REDUCE", G["expr -> comp"]), + (46, G["error"]): ("REDUCE", G["expr -> comp"]), + (46, G["pool"]): ("REDUCE", G["expr -> comp"]), + (47, G["<"]): ("SHIFT", 48), + (47, G["="]): ("SHIFT", 59), + (47, G["else"]): ("REDUCE", G["comp -> negable"]), + (47, G["then"]): ("REDUCE", G["comp -> negable"]), + (47, G[","]): ("REDUCE", G["comp -> negable"]), + (47, G["in"]): ("REDUCE", G["comp -> negable"]), + (47, G["fi"]): ("REDUCE", G["comp -> negable"]), + (47, G["}"]): ("REDUCE", G["comp -> negable"]), + (47, G[";"]): ("REDUCE", G["comp -> negable"]), + (47, G["of"]): ("REDUCE", G["comp -> negable"]), + (47, G["loop"]): ("REDUCE", G["comp -> negable"]), + (47, G[")"]): ("REDUCE", G["comp -> negable"]), + (47, G["error"]): ("REDUCE", G["comp -> negable"]), + (47, G["pool"]): ("REDUCE", G["comp -> negable"]), + (47, G["<="]): ("SHIFT", 57), + (48, G["false"]): ("SHIFT", 26), + (48, G["isvoid"]): ("SHIFT", 24), + (48, G["new"]): ("SHIFT", 22), + (48, G["id"]): ("SHIFT", 28), + (48, G["not"]): ("SHIFT", 30), + (48, G["if"]): ("SHIFT", 12), + (48, G["true"]): ("SHIFT", 25), + (48, G["("]): ("SHIFT", 11), + (48, G["int"]): ("SHIFT", 31), + (48, G["~"]): ("SHIFT", 27), + (48, G["string"]): ("SHIFT", 32), + (49, G["else"]): ("REDUCE", G["comp -> negable < negable"]), + (49, G["then"]): ("REDUCE", G["comp -> negable < negable"]), + (49, G[","]): ("REDUCE", G["comp -> negable < negable"]), + (49, G["in"]): ("REDUCE", G["comp -> negable < negable"]), + (49, G["fi"]): ("REDUCE", G["comp -> negable < negable"]), + (49, G["}"]): ("REDUCE", G["comp -> negable < negable"]), + (49, G[";"]): ("REDUCE", G["comp -> negable < negable"]), + (49, G["of"]): ("REDUCE", G["comp -> negable < negable"]), + (49, G["loop"]): ("REDUCE", G["comp -> negable < negable"]), + (49, G[")"]): ("REDUCE", G["comp -> negable < negable"]), + (49, G["error"]): ("REDUCE", G["comp -> negable < negable"]), + (49, G["pool"]): ("REDUCE", G["comp -> negable < negable"]), + (50, G["-"]): ("SHIFT", 51), + (50, G["+"]): ("SHIFT", 35), + (50, G["else"]): ("REDUCE", G["negable -> arith"]), + (50, G["pool"]): ("REDUCE", G["negable -> arith"]), + (50, G["in"]): ("REDUCE", G["negable -> arith"]), + (50, G[","]): ("REDUCE", G["negable -> arith"]), + (50, G["fi"]): ("REDUCE", G["negable -> arith"]), + (50, G["error"]): ("REDUCE", G["negable -> arith"]), + (50, G["}"]): ("REDUCE", G["negable -> arith"]), + (50, G["of"]): ("REDUCE", G["negable -> arith"]), + (50, G[";"]): ("REDUCE", G["negable -> arith"]), + (50, G["<"]): ("REDUCE", G["negable -> arith"]), + (50, G["loop"]): ("REDUCE", G["negable -> arith"]), + (50, G[")"]): ("REDUCE", G["negable -> arith"]), + (50, G["then"]): ("REDUCE", G["negable -> arith"]), + (50, G["<="]): ("REDUCE", G["negable -> arith"]), + (50, G["="]): ("REDUCE", G["negable -> arith"]), (51, G["~"]): ("SHIFT", 27), + (51, G["("]): ("SHIFT", 11), (51, G["true"]): ("SHIFT", 25), + (51, G["int"]): ("SHIFT", 31), + (51, G["isvoid"]): ("SHIFT", 24), + (51, G["string"]): ("SHIFT", 32), + (51, G["false"]): ("SHIFT", 26), + (51, G["id"]): ("SHIFT", 28), + (51, G["new"]): ("SHIFT", 22), (51, G["if"]): ("SHIFT", 12), - (51, G["string"]): ("SHIFT", 34), - (51, G["{"]): ("SHIFT", 10), - (51, G["let"]): ("SHIFT", 14), - (52, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr , not-empty-expr-list"]), - (53, G["<"]): ("REDUCE", G["arith -> term"]), - (53, G[")"]): ("REDUCE", G["arith -> term"]), - (53, G["<="]): ("REDUCE", G["arith -> term"]), - (53, G["error"]): ("REDUCE", G["arith -> term"]), - (53, G["then"]): ("REDUCE", G["arith -> term"]), - (53, G["="]): ("REDUCE", G["arith -> term"]), - (53, G["else"]): ("REDUCE", G["arith -> term"]), - (53, G[","]): ("REDUCE", G["arith -> term"]), - (53, G["fi"]): ("REDUCE", G["arith -> term"]), - (53, G[";"]): ("REDUCE", G["arith -> term"]), - (53, G["loop"]): ("REDUCE", G["arith -> term"]), - (53, G["pool"]): ("REDUCE", G["arith -> term"]), - (53, G["+"]): ("REDUCE", G["arith -> term"]), - (53, G["-"]): ("REDUCE", G["arith -> term"]), - (53, G["in"]): ("REDUCE", G["arith -> term"]), - (53, G["}"]): ("REDUCE", G["arith -> term"]), - (53, G["of"]): ("REDUCE", G["arith -> term"]), - (53, G["/"]): ("SHIFT", 54), - (53, G["*"]): ("SHIFT", 41), - (54, G["string"]): ("SHIFT", 34), - (54, G["int"]): ("SHIFT", 33), - (54, G["new"]): ("SHIFT", 22), - (54, G["isvoid"]): ("SHIFT", 24), - (54, G["~"]): ("SHIFT", 27), - (54, G["true"]): ("SHIFT", 25), - (54, G["id"]): ("SHIFT", 28), - (54, G["false"]): ("SHIFT", 26), - (54, G["("]): ("SHIFT", 11), - (55, G["<"]): ("REDUCE", G["term -> term / factor"]), - (55, G[")"]): ("REDUCE", G["term -> term / factor"]), - (55, G["<="]): ("REDUCE", G["term -> term / factor"]), - (55, G["error"]): ("REDUCE", G["term -> term / factor"]), - (55, G["then"]): ("REDUCE", G["term -> term / factor"]), - (55, G["="]): ("REDUCE", G["term -> term / factor"]), - (55, G["else"]): ("REDUCE", G["term -> term / factor"]), - (55, G[","]): ("REDUCE", G["term -> term / factor"]), - (55, G["fi"]): ("REDUCE", G["term -> term / factor"]), - (55, G[";"]): ("REDUCE", G["term -> term / factor"]), - (55, G["loop"]): ("REDUCE", G["term -> term / factor"]), - (55, G["pool"]): ("REDUCE", G["term -> term / factor"]), - (55, G["+"]): ("REDUCE", G["term -> term / factor"]), - (55, G["-"]): ("REDUCE", G["term -> term / factor"]), - (55, G["in"]): ("REDUCE", G["term -> term / factor"]), - (55, G["*"]): ("REDUCE", G["term -> term / factor"]), - (55, G["}"]): ("REDUCE", G["term -> term / factor"]), - (55, G["/"]): ("REDUCE", G["term -> term / factor"]), - (55, G["of"]): ("REDUCE", G["term -> term / factor"]), - (56, G["<"]): ("REDUCE", G["term -> factor"]), - (56, G[")"]): ("REDUCE", G["term -> factor"]), - (56, G["<="]): ("REDUCE", G["term -> factor"]), - (56, G["error"]): ("REDUCE", G["term -> factor"]), - (56, G["then"]): ("REDUCE", G["term -> factor"]), - (56, G["="]): ("REDUCE", G["term -> factor"]), - (56, G["else"]): ("REDUCE", G["term -> factor"]), - (56, G[","]): ("REDUCE", G["term -> factor"]), - (56, G["fi"]): ("REDUCE", G["term -> factor"]), - (56, G[";"]): ("REDUCE", G["term -> factor"]), - (56, G["loop"]): ("REDUCE", G["term -> factor"]), - (56, G["pool"]): ("REDUCE", G["term -> factor"]), - (56, G["+"]): ("REDUCE", G["term -> factor"]), - (56, G["-"]): ("REDUCE", G["term -> factor"]), - (56, G["in"]): ("REDUCE", G["term -> factor"]), - (56, G["*"]): ("REDUCE", G["term -> factor"]), - (56, G["}"]): ("REDUCE", G["term -> factor"]), - (56, G["/"]): ("REDUCE", G["term -> factor"]), - (56, G["of"]): ("REDUCE", G["term -> factor"]), - (57, G["type"]): ("SHIFT", 58), - (58, G["."]): ("SHIFT", 59), - (59, G["id"]): ("SHIFT", 60), - (60, G["("]): ("SHIFT", 61), - (61, G["id"]): ("SHIFT", 31), - (61, G["case"]): ("SHIFT", 21), - (61, G["isvoid"]): ("SHIFT", 24), - (61, G["new"]): ("SHIFT", 22), - (61, G["while"]): ("SHIFT", 13), - (61, G["false"]): ("SHIFT", 26), - (61, G["("]): ("SHIFT", 11), - (61, G["not"]): ("SHIFT", 30), - (61, G["int"]): ("SHIFT", 33), - (61, G["~"]): ("SHIFT", 27), - (61, G[")"]): ("REDUCE", G["expr-list -> e"]), - (61, G["true"]): ("SHIFT", 25), - (61, G["if"]): ("SHIFT", 12), - (61, G["string"]): ("SHIFT", 34), - (61, G["{"]): ("SHIFT", 10), - (61, G["let"]): ("SHIFT", 14), - (62, G[")"]): ("SHIFT", 63), - (63, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (63, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (64, G["int"]): ("SHIFT", 33), - (64, G["~"]): ("SHIFT", 27), - (64, G["true"]): ("SHIFT", 25), - (64, G["id"]): ("SHIFT", 28), - (64, G["string"]): ("SHIFT", 34), - (64, G["new"]): ("SHIFT", 22), - (64, G["isvoid"]): ("SHIFT", 24), - (64, G["false"]): ("SHIFT", 26), - (64, G["("]): ("SHIFT", 11), - (65, G["<"]): ("REDUCE", G["arith -> arith - term"]), - (65, G[")"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["<="]): ("REDUCE", G["arith -> arith - term"]), - (65, G["error"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["then"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["="]): ("REDUCE", G["arith -> arith - term"]), - (65, G["else"]): ("REDUCE", G["arith -> arith - term"]), - (65, G[","]): ("REDUCE", G["arith -> arith - term"]), - (65, G["fi"]): ("REDUCE", G["arith -> arith - term"]), - (65, G[";"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["loop"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["pool"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["+"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["-"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["in"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["}"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["of"]): ("REDUCE", G["arith -> arith - term"]), - (65, G["/"]): ("SHIFT", 54), - (65, G["*"]): ("SHIFT", 41), - (66, G["~"]): ("SHIFT", 27), - (66, G["true"]): ("SHIFT", 25), - (66, G["id"]): ("SHIFT", 28), - (66, G["isvoid"]): ("SHIFT", 24), - (66, G["string"]): ("SHIFT", 34), - (66, G["new"]): ("SHIFT", 22), - (66, G["false"]): ("SHIFT", 26), - (66, G["int"]): ("SHIFT", 33), - (66, G["("]): ("SHIFT", 11), - (67, G["+"]): ("SHIFT", 39), - (67, G["-"]): ("SHIFT", 64), - (67, G["loop"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[")"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["pool"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["then"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["error"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["of"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["else"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[","]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["in"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["fi"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G["}"]): ("REDUCE", G["comp -> arith < arith"]), - (67, G[";"]): ("REDUCE", G["comp -> arith < arith"]), - (68, G["~"]): ("SHIFT", 27), - (68, G["true"]): ("SHIFT", 25), - (68, G["id"]): ("SHIFT", 28), - (68, G["isvoid"]): ("SHIFT", 24), - (68, G["string"]): ("SHIFT", 34), - (68, G["new"]): ("SHIFT", 22), - (68, G["false"]): ("SHIFT", 26), - (68, G["int"]): ("SHIFT", 33), - (68, G["("]): ("SHIFT", 11), - (69, G["loop"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[")"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["pool"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["then"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["error"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["of"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["else"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[","]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["in"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["fi"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["}"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G[";"]): ("REDUCE", G["comp -> arith <= arith"]), - (69, G["-"]): ("SHIFT", 64), - (69, G["+"]): ("SHIFT", 39), - (70, G["~"]): ("SHIFT", 27), - (70, G["true"]): ("SHIFT", 25), - (70, G["id"]): ("SHIFT", 28), - (70, G["isvoid"]): ("SHIFT", 24), - (70, G["string"]): ("SHIFT", 34), - (70, G["new"]): ("SHIFT", 22), - (70, G["false"]): ("SHIFT", 26), - (70, G["int"]): ("SHIFT", 33), - (70, G["("]): ("SHIFT", 11), - (71, G["+"]): ("SHIFT", 39), - (71, G["-"]): ("SHIFT", 64), - (71, G["loop"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[")"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["pool"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["then"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["error"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["of"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["else"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[","]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["in"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["fi"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G["}"]): ("REDUCE", G["comp -> arith = arith"]), - (71, G[";"]): ("REDUCE", G["comp -> arith = arith"]), - (72, G["loop"]): ("REDUCE", G["expr -> not expr"]), - (72, G[";"]): ("REDUCE", G["expr -> not expr"]), - (72, G["pool"]): ("REDUCE", G["expr -> not expr"]), - (72, G[")"]): ("REDUCE", G["expr -> not expr"]), - (72, G["then"]): ("REDUCE", G["expr -> not expr"]), - (72, G["error"]): ("REDUCE", G["expr -> not expr"]), - (72, G["else"]): ("REDUCE", G["expr -> not expr"]), - (72, G[","]): ("REDUCE", G["expr -> not expr"]), - (72, G["in"]): ("REDUCE", G["expr -> not expr"]), - (72, G["fi"]): ("REDUCE", G["expr -> not expr"]), - (72, G["}"]): ("REDUCE", G["expr -> not expr"]), - (72, G["of"]): ("REDUCE", G["expr -> not expr"]), - (73, G[")"]): ("SHIFT", 74), - (74, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (74, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G["<"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G[")"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["<="]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["error"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["then"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["="]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["else"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G[","]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G[";"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["+"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["-"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["in"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["*"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["}"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["/"]): ("REDUCE", G["factor -> ~ factor"]), - (75, G["of"]): ("REDUCE", G["factor -> ~ factor"]), - (76, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["="]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[","]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), - (76, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), - (77, G["of"]): ("SHIFT", 78), - (78, G["id"]): ("SHIFT", 79), - (79, G[":"]): ("SHIFT", 80), - (80, G["type"]): ("SHIFT", 81), - (81, G["=>"]): ("SHIFT", 82), - (82, G["id"]): ("SHIFT", 31), - (82, G["isvoid"]): ("SHIFT", 24), - (82, G["new"]): ("SHIFT", 22), - (82, G["let"]): ("SHIFT", 14), - (82, G["case"]): ("SHIFT", 21), - (82, G["false"]): ("SHIFT", 26), - (82, G["("]): ("SHIFT", 11), - (82, G["~"]): ("SHIFT", 27), - (82, G["int"]): ("SHIFT", 33), - (82, G["while"]): ("SHIFT", 13), - (82, G["true"]): ("SHIFT", 25), - (82, G["not"]): ("SHIFT", 30), - (82, G["string"]): ("SHIFT", 34), - (82, G["if"]): ("SHIFT", 12), - (82, G["{"]): ("SHIFT", 10), - (83, G["error"]): ("SHIFT", 86), - (83, G[";"]): ("SHIFT", 84), - (84, G["id"]): ("SHIFT", 79), - (84, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), - (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), - (86, G["id"]): ("SHIFT", 79), - (86, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), - (87, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error case-list"]), - (88, G["esac"]): ("SHIFT", 89), - (89, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (89, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), - (90, G[","]): ("SHIFT", 91), - (91, G["id"]): ("SHIFT", 15), - (92, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), - (93, G["in"]): ("SHIFT", 94), - (94, G["int"]): ("SHIFT", 33), - (94, G["if"]): ("SHIFT", 12), - (94, G["id"]): ("SHIFT", 31), - (94, G["~"]): ("SHIFT", 27), - (94, G["true"]): ("SHIFT", 25), - (94, G["{"]): ("SHIFT", 10), - (94, G["string"]): ("SHIFT", 34), - (94, G["let"]): ("SHIFT", 14), - (94, G["case"]): ("SHIFT", 21), - (94, G["while"]): ("SHIFT", 13), - (94, G["new"]): ("SHIFT", 22), - (94, G["not"]): ("SHIFT", 30), - (94, G["isvoid"]): ("SHIFT", 24), - (94, G["false"]): ("SHIFT", 26), - (94, G["("]): ("SHIFT", 11), - (95, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (95, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (96, G["loop"]): ("SHIFT", 97), - (97, G["true"]): ("SHIFT", 25), - (97, G["{"]): ("SHIFT", 10), - (97, G["if"]): ("SHIFT", 12), - (97, G["id"]): ("SHIFT", 31), - (97, G["string"]): ("SHIFT", 34), - (97, G["isvoid"]): ("SHIFT", 24), - (97, G["let"]): ("SHIFT", 14), - (97, G["case"]): ("SHIFT", 21), - (97, G["("]): ("SHIFT", 11), - (97, G["~"]): ("SHIFT", 27), - (97, G["while"]): ("SHIFT", 13), - (97, G["not"]): ("SHIFT", 30), - (97, G["new"]): ("SHIFT", 22), - (97, G["false"]): ("SHIFT", 26), - (97, G["int"]): ("SHIFT", 33), - (98, G["pool"]): ("SHIFT", 99), - (99, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (99, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (100, G["then"]): ("SHIFT", 101), - (101, G["true"]): ("SHIFT", 25), - (101, G["string"]): ("SHIFT", 34), - (101, G["id"]): ("SHIFT", 31), - (101, G["if"]): ("SHIFT", 12), - (101, G["~"]): ("SHIFT", 27), - (101, G["{"]): ("SHIFT", 10), - (101, G["let"]): ("SHIFT", 14), - (101, G["new"]): ("SHIFT", 22), - (101, G["case"]): ("SHIFT", 21), - (101, G["while"]): ("SHIFT", 13), - (101, G["false"]): ("SHIFT", 26), - (101, G["("]): ("SHIFT", 11), - (101, G["isvoid"]): ("SHIFT", 24), - (101, G["int"]): ("SHIFT", 33), - (101, G["not"]): ("SHIFT", 30), - (102, G["else"]): ("SHIFT", 103), - (103, G["case"]): ("SHIFT", 21), - (103, G["while"]): ("SHIFT", 13), - (103, G["not"]): ("SHIFT", 30), - (103, G["id"]): ("SHIFT", 31), - (103, G["isvoid"]): ("SHIFT", 24), - (103, G["new"]): ("SHIFT", 22), - (103, G["if"]): ("SHIFT", 12), - (103, G["false"]): ("SHIFT", 26), - (103, G["("]): ("SHIFT", 11), - (103, G["~"]): ("SHIFT", 27), - (103, G["int"]): ("SHIFT", 33), - (103, G["{"]): ("SHIFT", 10), - (103, G["true"]): ("SHIFT", 25), - (103, G["string"]): ("SHIFT", 34), - (103, G["let"]): ("SHIFT", 14), - (104, G["fi"]): ("SHIFT", 105), - (105, G["loop"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G[")"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["pool"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["then"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["error"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["of"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["else"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G[","]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["in"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["fi"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G["}"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (105, G[";"]): ("REDUCE", G["expr -> if expr then expr else expr fi"]), - (106, G[")"]): ("SHIFT", 107), - (107, G["<"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G[")"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["<="]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["error"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["then"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["."]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["="]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["else"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G[","]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G[";"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["@"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["+"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["-"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["in"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["*"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["}"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["/"]): ("REDUCE", G["atom -> ( expr )"]), - (107, G["of"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["}"]): ("SHIFT", 109), - (109, G["loop"]): ("REDUCE", G["expr -> { block }"]), - (109, G[")"]): ("REDUCE", G["expr -> { block }"]), - (109, G["pool"]): ("REDUCE", G["expr -> { block }"]), - (109, G["then"]): ("REDUCE", G["expr -> { block }"]), - (109, G["error"]): ("REDUCE", G["expr -> { block }"]), - (109, G["of"]): ("REDUCE", G["expr -> { block }"]), - (109, G["else"]): ("REDUCE", G["expr -> { block }"]), - (109, G[","]): ("REDUCE", G["expr -> { block }"]), - (109, G["in"]): ("REDUCE", G["expr -> { block }"]), - (109, G["fi"]): ("REDUCE", G["expr -> { block }"]), - (109, G["}"]): ("REDUCE", G["expr -> { block }"]), - (109, G[";"]): ("REDUCE", G["expr -> { block }"]), - (110, G["error"]): ("SHIFT", 113), - (110, G[";"]): ("SHIFT", 111), - (111, G["id"]): ("SHIFT", 31), - (111, G["isvoid"]): ("SHIFT", 24), - (111, G["new"]): ("SHIFT", 22), - (111, G["let"]): ("SHIFT", 14), - (111, G["case"]): ("SHIFT", 21), - (111, G["false"]): ("SHIFT", 26), - (111, G["("]): ("SHIFT", 11), - (111, G["}"]): ("REDUCE", G["block -> expr ;"]), - (111, G["~"]): ("SHIFT", 27), - (111, G["int"]): ("SHIFT", 33), - (111, G["while"]): ("SHIFT", 13), - (111, G["true"]): ("SHIFT", 25), - (111, G["not"]): ("SHIFT", 30), - (111, G["string"]): ("SHIFT", 34), - (111, G["if"]): ("SHIFT", 12), - (111, G["{"]): ("SHIFT", 10), - (112, G["}"]): ("REDUCE", G["block -> expr ; block"]), - (113, G["id"]): ("SHIFT", 31), - (113, G["isvoid"]): ("SHIFT", 24), - (113, G["new"]): ("SHIFT", 22), - (113, G["let"]): ("SHIFT", 14), - (113, G["case"]): ("SHIFT", 21), - (113, G["false"]): ("SHIFT", 26), - (113, G["("]): ("SHIFT", 11), - (113, G["~"]): ("SHIFT", 27), - (113, G["int"]): ("SHIFT", 33), - (113, G["while"]): ("SHIFT", 13), - (113, G["true"]): ("SHIFT", 25), - (113, G["}"]): ("REDUCE", G["block -> expr error"]), - (113, G["not"]): ("SHIFT", 30), - (113, G["string"]): ("SHIFT", 34), - (113, G["if"]): ("SHIFT", 12), - (113, G["{"]): ("SHIFT", 10), - (114, G["}"]): ("REDUCE", G["block -> expr error block"]), - (115, G["}"]): ("SHIFT", 116), - (116, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), - (116, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), - (117, G[":"]): ("SHIFT", 118), - (118, G["type"]): ("SHIFT", 119), - (119, G[")"]): ("REDUCE", G["param-list -> id : type"]), - (119, G[","]): ("SHIFT", 120), - (120, G["id"]): ("SHIFT", 117), - (121, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), - (122, G[")"]): ("SHIFT", 123), - (123, G[":"]): ("SHIFT", 124), - (124, G["type"]): ("SHIFT", 125), - (125, G["{"]): ("SHIFT", 126), - (126, G["true"]): ("SHIFT", 25), - (126, G["let"]): ("SHIFT", 14), - (126, G["string"]): ("SHIFT", 34), - (126, G["id"]): ("SHIFT", 31), - (126, G["case"]): ("SHIFT", 21), - (126, G["while"]): ("SHIFT", 13), - (126, G["not"]): ("SHIFT", 30), - (126, G["isvoid"]): ("SHIFT", 24), - (126, G["if"]): ("SHIFT", 12), - (126, G["new"]): ("SHIFT", 22), - (126, G["{"]): ("SHIFT", 10), - (126, G["false"]): ("SHIFT", 26), - (126, G["~"]): ("SHIFT", 27), - (126, G["("]): ("SHIFT", 11), - (126, G["int"]): ("SHIFT", 33), - (127, G["}"]): ("SHIFT", 128), - (128, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), - (128, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), - (129, G["type"]): ("SHIFT", 130), - (130, G["error"]): ("REDUCE", G["attribute -> id : type"]), - (130, G[";"]): ("REDUCE", G["attribute -> id : type"]), - (130, G["<-"]): ("SHIFT", 131), - (131, G["id"]): ("SHIFT", 31), - (131, G["isvoid"]): ("SHIFT", 24), - (131, G["new"]): ("SHIFT", 22), - (131, G["let"]): ("SHIFT", 14), - (131, G["case"]): ("SHIFT", 21), - (131, G["false"]): ("SHIFT", 26), - (131, G["("]): ("SHIFT", 11), - (131, G["~"]): ("SHIFT", 27), - (131, G["int"]): ("SHIFT", 33), - (131, G["while"]): ("SHIFT", 13), - (131, G["true"]): ("SHIFT", 25), - (131, G["not"]): ("SHIFT", 30), - (131, G["string"]): ("SHIFT", 34), - (131, G["if"]): ("SHIFT", 12), - (131, G["{"]): ("SHIFT", 10), - (132, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), - (132, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), - (133, G["}"]): ("SHIFT", 134), - (134, G[";"]): ("REDUCE", G["class-def -> class type { feature-list }"]), - (135, G["error"]): ("SHIFT", 143), - (135, G[";"]): ("SHIFT", 136), - (136, G["id"]): ("SHIFT", 4), - (136, G["}"]): ("REDUCE", G["feature-list -> e"]), - (137, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), - (138, G[";"]): ("SHIFT", 139), - (138, G["error"]): ("SHIFT", 141), - (139, G["id"]): ("SHIFT", 4), - (139, G["}"]): ("REDUCE", G["feature-list -> e"]), - (140, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), - (141, G["id"]): ("SHIFT", 4), - (141, G["}"]): ("REDUCE", G["feature-list -> e"]), - (142, G["}"]): ("REDUCE", G["feature-list -> method error feature-list"]), - (143, G["id"]): ("SHIFT", 4), - (143, G["}"]): ("REDUCE", G["feature-list -> e"]), - (144, G["}"]): ("REDUCE", G["feature-list -> attribute error feature-list"]), - (145, G["type"]): ("SHIFT", 146), - (146, G["{"]): ("SHIFT", 147), - (147, G["id"]): ("SHIFT", 4), - (147, G["}"]): ("REDUCE", G["feature-list -> e"]), - (148, G["}"]): ("SHIFT", 149), - (149, G[";"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), - (150, G["$"]): ("OK", None), - (151, G["$"]): ("REDUCE", G["program -> class-list"]), - (152, G[";"]): ("SHIFT", 153), - (153, G["class"]): ("SHIFT", 1), - (153, G["$"]): ("REDUCE", G["class-list -> class-def ;"]), - (154, G["$"]): ("REDUCE", G["class-list -> class-def ; class-list"]), + (52, G["/"]): ("SHIFT", 53), + (52, G["*"]): ("SHIFT", 37), + (52, G["-"]): ("REDUCE", G["arith -> arith - term"]), + (52, G["in"]): ("REDUCE", G["arith -> arith - term"]), + (52, G["error"]): ("REDUCE", G["arith -> arith - term"]), + (52, G["}"]): ("REDUCE", G["arith -> arith - term"]), + (52, G["of"]): ("REDUCE", G["arith -> arith - term"]), + (52, G["<"]): ("REDUCE", G["arith -> arith - term"]), + (52, G[")"]): ("REDUCE", G["arith -> arith - term"]), + (52, G["<="]): ("REDUCE", G["arith -> arith - term"]), + (52, G["then"]): ("REDUCE", G["arith -> arith - term"]), + (52, G["="]): ("REDUCE", G["arith -> arith - term"]), + (52, G["else"]): ("REDUCE", G["arith -> arith - term"]), + (52, G[","]): ("REDUCE", G["arith -> arith - term"]), + (52, G["fi"]): ("REDUCE", G["arith -> arith - term"]), + (52, G[";"]): ("REDUCE", G["arith -> arith - term"]), + (52, G["loop"]): ("REDUCE", G["arith -> arith - term"]), + (52, G["pool"]): ("REDUCE", G["arith -> arith - term"]), + (52, G["+"]): ("REDUCE", G["arith -> arith - term"]), + (53, G["~"]): ("SHIFT", 27), + (53, G["("]): ("SHIFT", 11), + (53, G["true"]): ("SHIFT", 25), + (53, G["int"]): ("SHIFT", 31), + (53, G["isvoid"]): ("SHIFT", 24), + (53, G["string"]): ("SHIFT", 32), + (53, G["false"]): ("SHIFT", 26), + (53, G["id"]): ("SHIFT", 28), + (53, G["new"]): ("SHIFT", 22), + (53, G["if"]): ("SHIFT", 12), + (54, G["-"]): ("REDUCE", G["term -> term / factor"]), + (54, G["in"]): ("REDUCE", G["term -> term / factor"]), + (54, G["*"]): ("REDUCE", G["term -> term / factor"]), + (54, G["}"]): ("REDUCE", G["term -> term / factor"]), + (54, G["/"]): ("REDUCE", G["term -> term / factor"]), + (54, G["of"]): ("REDUCE", G["term -> term / factor"]), + (54, G["<"]): ("REDUCE", G["term -> term / factor"]), + (54, G[")"]): ("REDUCE", G["term -> term / factor"]), + (54, G["<="]): ("REDUCE", G["term -> term / factor"]), + (54, G["then"]): ("REDUCE", G["term -> term / factor"]), + (54, G["="]): ("REDUCE", G["term -> term / factor"]), + (54, G["else"]): ("REDUCE", G["term -> term / factor"]), + (54, G[","]): ("REDUCE", G["term -> term / factor"]), + (54, G["+"]): ("REDUCE", G["term -> term / factor"]), + (54, G["fi"]): ("REDUCE", G["term -> term / factor"]), + (54, G[";"]): ("REDUCE", G["term -> term / factor"]), + (54, G["loop"]): ("REDUCE", G["term -> term / factor"]), + (54, G["pool"]): ("REDUCE", G["term -> term / factor"]), + (54, G["error"]): ("REDUCE", G["term -> term / factor"]), + (55, G["-"]): ("REDUCE", G["term -> factor"]), + (55, G["in"]): ("REDUCE", G["term -> factor"]), + (55, G["error"]): ("REDUCE", G["term -> factor"]), + (55, G["*"]): ("REDUCE", G["term -> factor"]), + (55, G["}"]): ("REDUCE", G["term -> factor"]), + (55, G["/"]): ("REDUCE", G["term -> factor"]), + (55, G["of"]): ("REDUCE", G["term -> factor"]), + (55, G["<"]): ("REDUCE", G["term -> factor"]), + (55, G[")"]): ("REDUCE", G["term -> factor"]), + (55, G["<="]): ("REDUCE", G["term -> factor"]), + (55, G["then"]): ("REDUCE", G["term -> factor"]), + (55, G["="]): ("REDUCE", G["term -> factor"]), + (55, G["else"]): ("REDUCE", G["term -> factor"]), + (55, G[","]): ("REDUCE", G["term -> factor"]), + (55, G["fi"]): ("REDUCE", G["term -> factor"]), + (55, G[";"]): ("REDUCE", G["term -> factor"]), + (55, G["loop"]): ("REDUCE", G["term -> factor"]), + (55, G["pool"]): ("REDUCE", G["term -> factor"]), + (55, G["+"]): ("REDUCE", G["term -> factor"]), + (56, G["/"]): ("SHIFT", 53), + (56, G["*"]): ("SHIFT", 37), + (56, G["-"]): ("REDUCE", G["arith -> term"]), + (56, G["in"]): ("REDUCE", G["arith -> term"]), + (56, G["error"]): ("REDUCE", G["arith -> term"]), + (56, G["}"]): ("REDUCE", G["arith -> term"]), + (56, G["of"]): ("REDUCE", G["arith -> term"]), + (56, G["<"]): ("REDUCE", G["arith -> term"]), + (56, G[")"]): ("REDUCE", G["arith -> term"]), + (56, G["<="]): ("REDUCE", G["arith -> term"]), + (56, G["then"]): ("REDUCE", G["arith -> term"]), + (56, G["="]): ("REDUCE", G["arith -> term"]), + (56, G["else"]): ("REDUCE", G["arith -> term"]), + (56, G[","]): ("REDUCE", G["arith -> term"]), + (56, G["fi"]): ("REDUCE", G["arith -> term"]), + (56, G[";"]): ("REDUCE", G["arith -> term"]), + (56, G["loop"]): ("REDUCE", G["arith -> term"]), + (56, G["pool"]): ("REDUCE", G["arith -> term"]), + (56, G["+"]): ("REDUCE", G["arith -> term"]), + (57, G["false"]): ("SHIFT", 26), + (57, G["isvoid"]): ("SHIFT", 24), + (57, G["new"]): ("SHIFT", 22), + (57, G["id"]): ("SHIFT", 28), + (57, G["not"]): ("SHIFT", 30), + (57, G["if"]): ("SHIFT", 12), + (57, G["true"]): ("SHIFT", 25), + (57, G["("]): ("SHIFT", 11), + (57, G["int"]): ("SHIFT", 31), + (57, G["~"]): ("SHIFT", 27), + (57, G["string"]): ("SHIFT", 32), + (58, G["else"]): ("REDUCE", G["comp -> negable <= negable"]), + (58, G["then"]): ("REDUCE", G["comp -> negable <= negable"]), + (58, G[","]): ("REDUCE", G["comp -> negable <= negable"]), + (58, G["in"]): ("REDUCE", G["comp -> negable <= negable"]), + (58, G["fi"]): ("REDUCE", G["comp -> negable <= negable"]), + (58, G["}"]): ("REDUCE", G["comp -> negable <= negable"]), + (58, G[";"]): ("REDUCE", G["comp -> negable <= negable"]), + (58, G["of"]): ("REDUCE", G["comp -> negable <= negable"]), + (58, G["loop"]): ("REDUCE", G["comp -> negable <= negable"]), + (58, G[")"]): ("REDUCE", G["comp -> negable <= negable"]), + (58, G["error"]): ("REDUCE", G["comp -> negable <= negable"]), + (58, G["pool"]): ("REDUCE", G["comp -> negable <= negable"]), + (59, G["false"]): ("SHIFT", 26), + (59, G["isvoid"]): ("SHIFT", 24), + (59, G["new"]): ("SHIFT", 22), + (59, G["id"]): ("SHIFT", 28), + (59, G["not"]): ("SHIFT", 30), + (59, G["if"]): ("SHIFT", 12), + (59, G["true"]): ("SHIFT", 25), + (59, G["("]): ("SHIFT", 11), + (59, G["int"]): ("SHIFT", 31), + (59, G["~"]): ("SHIFT", 27), + (59, G["string"]): ("SHIFT", 32), + (60, G["else"]): ("REDUCE", G["comp -> negable = negable"]), + (60, G["then"]): ("REDUCE", G["comp -> negable = negable"]), + (60, G[","]): ("REDUCE", G["comp -> negable = negable"]), + (60, G["in"]): ("REDUCE", G["comp -> negable = negable"]), + (60, G["fi"]): ("REDUCE", G["comp -> negable = negable"]), + (60, G["}"]): ("REDUCE", G["comp -> negable = negable"]), + (60, G[";"]): ("REDUCE", G["comp -> negable = negable"]), + (60, G["of"]): ("REDUCE", G["comp -> negable = negable"]), + (60, G["loop"]): ("REDUCE", G["comp -> negable = negable"]), + (60, G[")"]): ("REDUCE", G["comp -> negable = negable"]), + (60, G["error"]): ("REDUCE", G["comp -> negable = negable"]), + (60, G["pool"]): ("REDUCE", G["comp -> negable = negable"]), + (61, G[")"]): ("SHIFT", 62), + (62, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (62, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (62, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (62, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (62, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (62, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (62, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (62, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (62, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (62, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (62, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (62, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (62, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (62, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (62, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (62, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (62, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (62, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (62, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (62, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (62, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (63, G[")"]): ("REDUCE", G["expr-list -> not-empty-expr-list"]), + (64, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), + (64, G[","]): ("SHIFT", 65), + (65, G["~"]): ("SHIFT", 27), + (65, G["if"]): ("SHIFT", 12), + (65, G["int"]): ("SHIFT", 31), + (65, G["("]): ("SHIFT", 11), + (65, G["case"]): ("SHIFT", 21), + (65, G["id"]): ("SHIFT", 43), + (65, G["new"]): ("SHIFT", 22), + (65, G["{"]): ("SHIFT", 10), + (65, G["let"]): ("SHIFT", 14), + (65, G["isvoid"]): ("SHIFT", 24), + (65, G["while"]): ("SHIFT", 13), + (65, G["true"]): ("SHIFT", 25), + (65, G["not"]): ("SHIFT", 30), + (65, G["string"]): ("SHIFT", 32), + (65, G["false"]): ("SHIFT", 26), + (66, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr , not-empty-expr-list"]), + (67, G["type"]): ("SHIFT", 68), + (68, G["."]): ("SHIFT", 69), + (69, G["id"]): ("SHIFT", 70), + (70, G["("]): ("SHIFT", 71), + (71, G["~"]): ("SHIFT", 27), + (71, G["if"]): ("SHIFT", 12), + (71, G["int"]): ("SHIFT", 31), + (71, G["("]): ("SHIFT", 11), + (71, G["case"]): ("SHIFT", 21), + (71, G["id"]): ("SHIFT", 43), + (71, G[")"]): ("REDUCE", G["expr-list -> e"]), + (71, G["new"]): ("SHIFT", 22), + (71, G["{"]): ("SHIFT", 10), + (71, G["let"]): ("SHIFT", 14), + (71, G["isvoid"]): ("SHIFT", 24), + (71, G["while"]): ("SHIFT", 13), + (71, G["true"]): ("SHIFT", 25), + (71, G["not"]): ("SHIFT", 30), + (71, G["string"]): ("SHIFT", 32), + (71, G["false"]): ("SHIFT", 26), + (72, G[")"]): ("SHIFT", 73), + (73, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (73, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (73, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (73, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (73, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (73, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (73, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (73, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (73, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (73, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (73, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (73, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (73, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (73, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (73, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (73, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (73, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (73, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (73, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (73, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (73, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (74, G[")"]): ("SHIFT", 75), + (75, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (75, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (76, G["-"]): ("REDUCE", G["factor -> ~ factor"]), + (76, G["in"]): ("REDUCE", G["factor -> ~ factor"]), + (76, G["*"]): ("REDUCE", G["factor -> ~ factor"]), + (76, G["}"]): ("REDUCE", G["factor -> ~ factor"]), + (76, G["/"]): ("REDUCE", G["factor -> ~ factor"]), + (76, G["of"]): ("REDUCE", G["factor -> ~ factor"]), + (76, G["<"]): ("REDUCE", G["factor -> ~ factor"]), + (76, G[")"]): ("REDUCE", G["factor -> ~ factor"]), + (76, G["<="]): ("REDUCE", G["factor -> ~ factor"]), + (76, G["then"]): ("REDUCE", G["factor -> ~ factor"]), + (76, G["="]): ("REDUCE", G["factor -> ~ factor"]), + (76, G["else"]): ("REDUCE", G["factor -> ~ factor"]), + (76, G[","]): ("REDUCE", G["factor -> ~ factor"]), + (76, G["+"]): ("REDUCE", G["factor -> ~ factor"]), + (76, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), + (76, G[";"]): ("REDUCE", G["factor -> ~ factor"]), + (76, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), + (76, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), + (76, G["error"]): ("REDUCE", G["factor -> ~ factor"]), + (77, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), + (77, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), + (77, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), + (77, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), + (77, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), + (77, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), + (77, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), + (77, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), + (77, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), + (77, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), + (77, G["="]): ("REDUCE", G["factor -> isvoid factor"]), + (77, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), + (77, G[","]): ("REDUCE", G["factor -> isvoid factor"]), + (77, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), + (77, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), + (77, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), + (77, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), + (77, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), + (77, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), + (78, G["of"]): ("SHIFT", 79), + (79, G["id"]): ("SHIFT", 80), + (80, G[":"]): ("SHIFT", 81), + (81, G["type"]): ("SHIFT", 82), + (82, G["=>"]): ("SHIFT", 83), + (83, G["id"]): ("SHIFT", 43), + (83, G["if"]): ("SHIFT", 12), + (83, G["int"]): ("SHIFT", 31), + (83, G["("]): ("SHIFT", 11), + (83, G["{"]): ("SHIFT", 10), + (83, G["let"]): ("SHIFT", 14), + (83, G["while"]): ("SHIFT", 13), + (83, G["isvoid"]): ("SHIFT", 24), + (83, G["not"]): ("SHIFT", 30), + (83, G["new"]): ("SHIFT", 22), + (83, G["true"]): ("SHIFT", 25), + (83, G["~"]): ("SHIFT", 27), + (83, G["string"]): ("SHIFT", 32), + (83, G["false"]): ("SHIFT", 26), + (83, G["case"]): ("SHIFT", 21), + (84, G[";"]): ("SHIFT", 85), + (84, G["error"]): ("SHIFT", 87), + (85, G["id"]): ("SHIFT", 80), + (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), + (86, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), + (87, G["id"]): ("SHIFT", 80), + (87, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), + (88, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error case-list"]), + (89, G["esac"]): ("SHIFT", 90), + (90, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (90, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (90, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (90, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (90, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (90, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (90, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (90, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (90, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (90, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (90, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (90, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (91, G[","]): ("SHIFT", 92), + (91, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), + (92, G["id"]): ("SHIFT", 15), + (93, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), + (94, G["in"]): ("SHIFT", 95), + (95, G["case"]): ("SHIFT", 21), + (95, G["~"]): ("SHIFT", 27), + (95, G["id"]): ("SHIFT", 43), + (95, G["("]): ("SHIFT", 11), + (95, G["int"]): ("SHIFT", 31), + (95, G["{"]): ("SHIFT", 10), + (95, G["let"]): ("SHIFT", 14), + (95, G["new"]): ("SHIFT", 22), + (95, G["while"]): ("SHIFT", 13), + (95, G["true"]): ("SHIFT", 25), + (95, G["isvoid"]): ("SHIFT", 24), + (95, G["string"]): ("SHIFT", 32), + (95, G["false"]): ("SHIFT", 26), + (95, G["not"]): ("SHIFT", 30), + (95, G["if"]): ("SHIFT", 12), + (96, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (96, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (96, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (96, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (96, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (96, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (96, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (96, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (96, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (96, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (96, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (96, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (97, G["loop"]): ("SHIFT", 98), + (98, G["~"]): ("SHIFT", 27), + (98, G["if"]): ("SHIFT", 12), + (98, G["not"]): ("SHIFT", 30), + (98, G["("]): ("SHIFT", 11), + (98, G["int"]): ("SHIFT", 31), + (98, G["case"]): ("SHIFT", 21), + (98, G["id"]): ("SHIFT", 43), + (98, G["new"]): ("SHIFT", 22), + (98, G["isvoid"]): ("SHIFT", 24), + (98, G["true"]): ("SHIFT", 25), + (98, G["{"]): ("SHIFT", 10), + (98, G["let"]): ("SHIFT", 14), + (98, G["while"]): ("SHIFT", 13), + (98, G["string"]): ("SHIFT", 32), + (98, G["false"]): ("SHIFT", 26), + (99, G["pool"]): ("SHIFT", 100), + (100, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (100, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (100, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (100, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (100, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (100, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (100, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (100, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (100, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (100, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (100, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (100, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (101, G["then"]): ("SHIFT", 102), + (102, G["("]): ("SHIFT", 11), + (102, G["int"]): ("SHIFT", 31), + (102, G["while"]): ("SHIFT", 13), + (102, G["not"]): ("SHIFT", 30), + (102, G["new"]): ("SHIFT", 22), + (102, G["~"]): ("SHIFT", 27), + (102, G["id"]): ("SHIFT", 43), + (102, G["true"]): ("SHIFT", 25), + (102, G["case"]): ("SHIFT", 21), + (102, G["string"]): ("SHIFT", 32), + (102, G["false"]): ("SHIFT", 26), + (102, G["if"]): ("SHIFT", 12), + (102, G["{"]): ("SHIFT", 10), + (102, G["isvoid"]): ("SHIFT", 24), + (102, G["let"]): ("SHIFT", 14), + (103, G["else"]): ("SHIFT", 104), + (104, G["false"]): ("SHIFT", 26), + (104, G["while"]): ("SHIFT", 13), + (104, G["id"]): ("SHIFT", 43), + (104, G["if"]): ("SHIFT", 12), + (104, G["isvoid"]): ("SHIFT", 24), + (104, G["int"]): ("SHIFT", 31), + (104, G["("]): ("SHIFT", 11), + (104, G["~"]): ("SHIFT", 27), + (104, G["not"]): ("SHIFT", 30), + (104, G["case"]): ("SHIFT", 21), + (104, G["new"]): ("SHIFT", 22), + (104, G["{"]): ("SHIFT", 10), + (104, G["true"]): ("SHIFT", 25), + (104, G["let"]): ("SHIFT", 14), + (104, G["string"]): ("SHIFT", 32), + (105, G["fi"]): ("SHIFT", 106), + (106, G["-"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (106, G["in"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (106, G["*"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (106, G["}"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (106, G["/"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (106, G["of"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (106, G["<"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (106, G[")"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (106, G["<="]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (106, G["then"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (106, G["."]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (106, G["="]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (106, G["else"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (106, G[","]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (106, G["+"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (106, G["fi"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (106, G[";"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (106, G["loop"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (106, G["@"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (106, G["pool"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (106, G["error"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (107, G[")"]): ("SHIFT", 108), + (108, G["-"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["in"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["*"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["}"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["/"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["of"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["<"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G[")"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["<="]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["then"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["."]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["="]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["else"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G[","]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["+"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G[";"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["@"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), + (108, G["error"]): ("REDUCE", G["atom -> ( expr )"]), + (109, G["}"]): ("SHIFT", 110), + (110, G["else"]): ("REDUCE", G["expr -> { block }"]), + (110, G["then"]): ("REDUCE", G["expr -> { block }"]), + (110, G[","]): ("REDUCE", G["expr -> { block }"]), + (110, G["in"]): ("REDUCE", G["expr -> { block }"]), + (110, G["fi"]): ("REDUCE", G["expr -> { block }"]), + (110, G["}"]): ("REDUCE", G["expr -> { block }"]), + (110, G[";"]): ("REDUCE", G["expr -> { block }"]), + (110, G["of"]): ("REDUCE", G["expr -> { block }"]), + (110, G["loop"]): ("REDUCE", G["expr -> { block }"]), + (110, G[")"]): ("REDUCE", G["expr -> { block }"]), + (110, G["error"]): ("REDUCE", G["expr -> { block }"]), + (110, G["pool"]): ("REDUCE", G["expr -> { block }"]), + (111, G[";"]): ("SHIFT", 112), + (111, G["error"]): ("SHIFT", 114), + (112, G["id"]): ("SHIFT", 43), + (112, G["if"]): ("SHIFT", 12), + (112, G["int"]): ("SHIFT", 31), + (112, G["("]): ("SHIFT", 11), + (112, G["{"]): ("SHIFT", 10), + (112, G["}"]): ("REDUCE", G["block -> expr ;"]), + (112, G["let"]): ("SHIFT", 14), + (112, G["while"]): ("SHIFT", 13), + (112, G["isvoid"]): ("SHIFT", 24), + (112, G["not"]): ("SHIFT", 30), + (112, G["new"]): ("SHIFT", 22), + (112, G["true"]): ("SHIFT", 25), + (112, G["~"]): ("SHIFT", 27), + (112, G["string"]): ("SHIFT", 32), + (112, G["false"]): ("SHIFT", 26), + (112, G["case"]): ("SHIFT", 21), + (113, G["}"]): ("REDUCE", G["block -> expr ; block"]), + (114, G["id"]): ("SHIFT", 43), + (114, G["if"]): ("SHIFT", 12), + (114, G["int"]): ("SHIFT", 31), + (114, G["("]): ("SHIFT", 11), + (114, G["{"]): ("SHIFT", 10), + (114, G["let"]): ("SHIFT", 14), + (114, G["}"]): ("REDUCE", G["block -> expr error"]), + (114, G["while"]): ("SHIFT", 13), + (114, G["isvoid"]): ("SHIFT", 24), + (114, G["not"]): ("SHIFT", 30), + (114, G["new"]): ("SHIFT", 22), + (114, G["true"]): ("SHIFT", 25), + (114, G["~"]): ("SHIFT", 27), + (114, G["string"]): ("SHIFT", 32), + (114, G["false"]): ("SHIFT", 26), + (114, G["case"]): ("SHIFT", 21), + (115, G["}"]): ("REDUCE", G["block -> expr error block"]), + (116, G["}"]): ("SHIFT", 117), + (117, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (117, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (118, G[":"]): ("SHIFT", 119), + (119, G["type"]): ("SHIFT", 120), + (120, G[","]): ("SHIFT", 121), + (120, G[")"]): ("REDUCE", G["param-list -> id : type"]), + (121, G["id"]): ("SHIFT", 118), + (122, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), + (123, G[")"]): ("SHIFT", 124), + (124, G[":"]): ("SHIFT", 125), + (125, G["type"]): ("SHIFT", 126), + (126, G["{"]): ("SHIFT", 127), + (127, G["new"]): ("SHIFT", 22), + (127, G["{"]): ("SHIFT", 10), + (127, G["id"]): ("SHIFT", 43), + (127, G["let"]): ("SHIFT", 14), + (127, G["while"]): ("SHIFT", 13), + (127, G["true"]): ("SHIFT", 25), + (127, G["isvoid"]): ("SHIFT", 24), + (127, G["string"]): ("SHIFT", 32), + (127, G["false"]): ("SHIFT", 26), + (127, G["not"]): ("SHIFT", 30), + (127, G["if"]): ("SHIFT", 12), + (127, G["~"]): ("SHIFT", 27), + (127, G["("]): ("SHIFT", 11), + (127, G["int"]): ("SHIFT", 31), + (127, G["case"]): ("SHIFT", 21), + (128, G["}"]): ("SHIFT", 129), + (129, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (129, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (130, G["type"]): ("SHIFT", 131), + (131, G[";"]): ("REDUCE", G["attribute -> id : type"]), + (131, G["error"]): ("REDUCE", G["attribute -> id : type"]), + (131, G["<-"]): ("SHIFT", 132), + (132, G["id"]): ("SHIFT", 43), + (132, G["if"]): ("SHIFT", 12), + (132, G["int"]): ("SHIFT", 31), + (132, G["("]): ("SHIFT", 11), + (132, G["{"]): ("SHIFT", 10), + (132, G["let"]): ("SHIFT", 14), + (132, G["while"]): ("SHIFT", 13), + (132, G["isvoid"]): ("SHIFT", 24), + (132, G["not"]): ("SHIFT", 30), + (132, G["new"]): ("SHIFT", 22), + (132, G["true"]): ("SHIFT", 25), + (132, G["~"]): ("SHIFT", 27), + (132, G["string"]): ("SHIFT", 32), + (132, G["false"]): ("SHIFT", 26), + (132, G["case"]): ("SHIFT", 21), + (133, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (133, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (134, G["}"]): ("SHIFT", 135), + (135, G[";"]): ("REDUCE", G["class-def -> class type { feature-list }"]), + (136, G["error"]): ("SHIFT", 144), + (136, G[";"]): ("SHIFT", 137), + (137, G["}"]): ("REDUCE", G["feature-list -> e"]), + (137, G["id"]): ("SHIFT", 4), + (138, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), + (139, G["error"]): ("SHIFT", 142), + (139, G[";"]): ("SHIFT", 140), + (140, G["}"]): ("REDUCE", G["feature-list -> e"]), + (140, G["id"]): ("SHIFT", 4), + (141, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), + (142, G["}"]): ("REDUCE", G["feature-list -> e"]), + (142, G["id"]): ("SHIFT", 4), + (143, G["}"]): ("REDUCE", G["feature-list -> method error feature-list"]), + (144, G["}"]): ("REDUCE", G["feature-list -> e"]), + (144, G["id"]): ("SHIFT", 4), + (145, G["}"]): ("REDUCE", G["feature-list -> attribute error feature-list"]), + (146, G["type"]): ("SHIFT", 147), + (147, G["{"]): ("SHIFT", 148), + (148, G["}"]): ("REDUCE", G["feature-list -> e"]), + (148, G["id"]): ("SHIFT", 4), + (149, G["}"]): ("SHIFT", 150), + (150, G[";"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), + (151, G["$"]): ("OK", None), + (152, G["$"]): ("REDUCE", G["program -> class-list"]), + (153, G[";"]): ("SHIFT", 154), + (154, G["class"]): ("SHIFT", 1), + (154, G["$"]): ("REDUCE", G["class-list -> class-def ;"]), + (155, G["$"]): ("REDUCE", G["class-list -> class-def ; class-list"]), } @staticmethod def __goto_table(): return { - (0, G["class-list"]): 151, - (0, G["program"]): 150, - (0, G["class-def"]): 152, - (3, G["feature-list"]): 133, - (3, G["attribute"]): 135, - (3, G["method"]): 138, - (5, G["param-list"]): 122, - (9, G["term"]): 53, - (9, G["arith"]): 38, - (9, G["function-call"]): 35, - (9, G["atom"]): 43, - (9, G["expr"]): 115, - (9, G["factor"]): 56, - (9, G["comp"]): 37, - (10, G["comp"]): 37, - (10, G["term"]): 53, - (10, G["expr"]): 110, - (10, G["arith"]): 38, - (10, G["atom"]): 43, - (10, G["function-call"]): 35, - (10, G["block"]): 108, - (10, G["factor"]): 56, - (11, G["term"]): 53, - (11, G["arith"]): 38, - (11, G["expr"]): 106, - (11, G["atom"]): 43, - (11, G["factor"]): 56, - (11, G["comp"]): 37, - (11, G["function-call"]): 35, - (12, G["comp"]): 37, - (12, G["arith"]): 38, - (12, G["function-call"]): 35, - (12, G["term"]): 53, - (12, G["expr"]): 100, - (12, G["atom"]): 43, - (12, G["factor"]): 56, - (13, G["term"]): 53, - (13, G["atom"]): 43, - (13, G["function-call"]): 35, - (13, G["expr"]): 96, - (13, G["arith"]): 38, - (13, G["comp"]): 37, - (13, G["factor"]): 56, - (14, G["declaration-list"]): 93, + (0, G["class-def"]): 153, + (0, G["program"]): 151, + (0, G["class-list"]): 152, + (3, G["method"]): 139, + (3, G["attribute"]): 136, + (3, G["feature-list"]): 134, + (5, G["param-list"]): 123, + (9, G["factor"]): 55, + (9, G["term"]): 56, + (9, G["comp"]): 46, + (9, G["negable"]): 47, + (9, G["function-call"]): 33, + (9, G["atom"]): 39, + (9, G["arith"]): 50, + (9, G["expr"]): 116, + (10, G["atom"]): 39, + (10, G["factor"]): 55, + (10, G["expr"]): 111, + (10, G["comp"]): 46, + (10, G["term"]): 56, + (10, G["negable"]): 47, + (10, G["arith"]): 50, + (10, G["function-call"]): 33, + (10, G["block"]): 109, + (11, G["negable"]): 47, + (11, G["arith"]): 50, + (11, G["term"]): 56, + (11, G["comp"]): 46, + (11, G["factor"]): 55, + (11, G["atom"]): 39, + (11, G["expr"]): 107, + (11, G["function-call"]): 33, + (12, G["negable"]): 47, + (12, G["atom"]): 39, + (12, G["comp"]): 46, + (12, G["term"]): 56, + (12, G["arith"]): 50, + (12, G["factor"]): 55, + (12, G["expr"]): 101, + (12, G["function-call"]): 33, + (13, G["factor"]): 55, + (13, G["negable"]): 47, + (13, G["expr"]): 97, + (13, G["term"]): 56, + (13, G["function-call"]): 33, + (13, G["arith"]): 50, + (13, G["atom"]): 39, + (13, G["comp"]): 46, + (14, G["declaration-list"]): 94, (18, G["declaration-list"]): 19, - (20, G["arith"]): 38, - (20, G["atom"]): 43, - (20, G["factor"]): 56, - (20, G["comp"]): 37, - (20, G["term"]): 53, - (20, G["expr"]): 90, - (20, G["function-call"]): 35, - (21, G["arith"]): 38, - (21, G["function-call"]): 35, - (21, G["factor"]): 56, - (21, G["comp"]): 37, - (21, G["term"]): 53, - (21, G["atom"]): 43, - (21, G["expr"]): 77, - (24, G["atom"]): 43, - (24, G["factor"]): 76, - (24, G["function-call"]): 35, - (27, G["atom"]): 43, - (27, G["factor"]): 75, - (27, G["function-call"]): 35, - (29, G["term"]): 53, - (29, G["atom"]): 43, - (29, G["arith"]): 38, - (29, G["expr-list"]): 73, - (29, G["not-empty-expr-list"]): 49, - (29, G["expr"]): 50, - (29, G["function-call"]): 35, - (29, G["comp"]): 37, - (29, G["factor"]): 56, - (30, G["function-call"]): 35, - (30, G["term"]): 53, - (30, G["arith"]): 38, - (30, G["comp"]): 37, - (30, G["atom"]): 43, - (30, G["expr"]): 72, - (30, G["factor"]): 56, - (32, G["function-call"]): 35, - (32, G["expr"]): 36, - (32, G["term"]): 53, - (32, G["arith"]): 38, - (32, G["comp"]): 37, - (32, G["atom"]): 43, - (32, G["factor"]): 56, - (39, G["factor"]): 56, - (39, G["function-call"]): 35, - (39, G["term"]): 40, - (39, G["atom"]): 43, - (41, G["factor"]): 42, - (41, G["atom"]): 43, - (41, G["function-call"]): 35, - (46, G["expr-list"]): 47, - (46, G["term"]): 53, - (46, G["atom"]): 43, - (46, G["arith"]): 38, - (46, G["not-empty-expr-list"]): 49, - (46, G["expr"]): 50, - (46, G["function-call"]): 35, - (46, G["comp"]): 37, - (46, G["factor"]): 56, - (51, G["term"]): 53, - (51, G["atom"]): 43, - (51, G["arith"]): 38, - (51, G["expr"]): 50, - (51, G["not-empty-expr-list"]): 52, - (51, G["function-call"]): 35, - (51, G["comp"]): 37, - (51, G["factor"]): 56, - (54, G["factor"]): 55, - (54, G["atom"]): 43, - (54, G["function-call"]): 35, - (61, G["term"]): 53, - (61, G["expr-list"]): 62, - (61, G["atom"]): 43, - (61, G["arith"]): 38, - (61, G["not-empty-expr-list"]): 49, - (61, G["expr"]): 50, - (61, G["function-call"]): 35, - (61, G["comp"]): 37, - (61, G["factor"]): 56, - (64, G["factor"]): 56, - (64, G["term"]): 65, - (64, G["function-call"]): 35, - (64, G["atom"]): 43, - (66, G["factor"]): 56, - (66, G["arith"]): 67, - (66, G["term"]): 53, - (66, G["function-call"]): 35, - (66, G["atom"]): 43, - (68, G["factor"]): 56, - (68, G["term"]): 53, - (68, G["function-call"]): 35, - (68, G["atom"]): 43, - (68, G["arith"]): 69, - (70, G["factor"]): 56, - (70, G["term"]): 53, - (70, G["function-call"]): 35, - (70, G["arith"]): 71, - (70, G["atom"]): 43, - (78, G["case-list"]): 88, - (82, G["comp"]): 37, - (82, G["term"]): 53, - (82, G["arith"]): 38, - (82, G["expr"]): 83, - (82, G["atom"]): 43, - (82, G["function-call"]): 35, - (82, G["factor"]): 56, - (84, G["case-list"]): 85, - (86, G["case-list"]): 87, - (91, G["declaration-list"]): 92, - (94, G["expr"]): 95, - (94, G["function-call"]): 35, - (94, G["term"]): 53, - (94, G["arith"]): 38, - (94, G["comp"]): 37, - (94, G["atom"]): 43, - (94, G["factor"]): 56, - (97, G["arith"]): 38, - (97, G["factor"]): 56, - (97, G["function-call"]): 35, - (97, G["comp"]): 37, - (97, G["expr"]): 98, - (97, G["term"]): 53, - (97, G["atom"]): 43, - (101, G["function-call"]): 35, - (101, G["term"]): 53, - (101, G["arith"]): 38, - (101, G["comp"]): 37, - (101, G["atom"]): 43, - (101, G["expr"]): 102, - (101, G["factor"]): 56, - (103, G["factor"]): 56, - (103, G["arith"]): 38, - (103, G["term"]): 53, - (103, G["atom"]): 43, - (103, G["expr"]): 104, - (103, G["function-call"]): 35, - (103, G["comp"]): 37, - (111, G["comp"]): 37, - (111, G["term"]): 53, - (111, G["expr"]): 110, - (111, G["block"]): 112, - (111, G["arith"]): 38, - (111, G["atom"]): 43, - (111, G["function-call"]): 35, - (111, G["factor"]): 56, - (113, G["comp"]): 37, - (113, G["block"]): 114, - (113, G["term"]): 53, - (113, G["expr"]): 110, - (113, G["arith"]): 38, - (113, G["atom"]): 43, - (113, G["function-call"]): 35, - (113, G["factor"]): 56, - (120, G["param-list"]): 121, - (126, G["term"]): 53, - (126, G["arith"]): 38, - (126, G["function-call"]): 35, - (126, G["atom"]): 43, - (126, G["factor"]): 56, - (126, G["expr"]): 127, - (126, G["comp"]): 37, - (131, G["comp"]): 37, - (131, G["term"]): 53, - (131, G["arith"]): 38, - (131, G["expr"]): 132, - (131, G["atom"]): 43, - (131, G["function-call"]): 35, - (131, G["factor"]): 56, - (136, G["attribute"]): 135, - (136, G["feature-list"]): 137, - (136, G["method"]): 138, - (139, G["attribute"]): 135, - (139, G["method"]): 138, - (139, G["feature-list"]): 140, - (141, G["feature-list"]): 142, - (141, G["attribute"]): 135, - (141, G["method"]): 138, - (143, G["attribute"]): 135, - (143, G["feature-list"]): 144, - (143, G["method"]): 138, - (147, G["attribute"]): 135, - (147, G["feature-list"]): 148, - (147, G["method"]): 138, - (153, G["class-list"]): 154, - (153, G["class-def"]): 152, + (20, G["atom"]): 39, + (20, G["comp"]): 46, + (20, G["negable"]): 47, + (20, G["factor"]): 55, + (20, G["arith"]): 50, + (20, G["term"]): 56, + (20, G["expr"]): 91, + (20, G["function-call"]): 33, + (21, G["term"]): 56, + (21, G["arith"]): 50, + (21, G["function-call"]): 33, + (21, G["negable"]): 47, + (21, G["atom"]): 39, + (21, G["comp"]): 46, + (21, G["expr"]): 78, + (21, G["factor"]): 55, + (24, G["atom"]): 39, + (24, G["factor"]): 77, + (24, G["function-call"]): 33, + (27, G["atom"]): 39, + (27, G["function-call"]): 33, + (27, G["factor"]): 76, + (29, G["expr-list"]): 74, + (29, G["atom"]): 39, + (29, G["expr"]): 64, + (29, G["not-empty-expr-list"]): 63, + (29, G["negable"]): 47, + (29, G["term"]): 56, + (29, G["factor"]): 55, + (29, G["arith"]): 50, + (29, G["comp"]): 46, + (29, G["function-call"]): 33, + (30, G["atom"]): 39, + (30, G["function-call"]): 33, + (30, G["term"]): 56, + (30, G["factor"]): 55, + (30, G["arith"]): 34, + (35, G["atom"]): 39, + (35, G["function-call"]): 33, + (35, G["term"]): 36, + (35, G["factor"]): 55, + (37, G["atom"]): 39, + (37, G["function-call"]): 33, + (37, G["factor"]): 38, + (42, G["atom"]): 39, + (42, G["expr"]): 64, + (42, G["expr-list"]): 61, + (42, G["not-empty-expr-list"]): 63, + (42, G["negable"]): 47, + (42, G["term"]): 56, + (42, G["factor"]): 55, + (42, G["arith"]): 50, + (42, G["comp"]): 46, + (42, G["function-call"]): 33, + (44, G["atom"]): 39, + (44, G["expr"]): 45, + (44, G["comp"]): 46, + (44, G["factor"]): 55, + (44, G["negable"]): 47, + (44, G["term"]): 56, + (44, G["function-call"]): 33, + (44, G["arith"]): 50, + (48, G["term"]): 56, + (48, G["atom"]): 39, + (48, G["arith"]): 50, + (48, G["factor"]): 55, + (48, G["function-call"]): 33, + (48, G["negable"]): 49, + (51, G["atom"]): 39, + (51, G["term"]): 52, + (51, G["function-call"]): 33, + (51, G["factor"]): 55, + (53, G["atom"]): 39, + (53, G["factor"]): 54, + (53, G["function-call"]): 33, + (57, G["term"]): 56, + (57, G["atom"]): 39, + (57, G["arith"]): 50, + (57, G["negable"]): 58, + (57, G["factor"]): 55, + (57, G["function-call"]): 33, + (59, G["term"]): 56, + (59, G["negable"]): 60, + (59, G["atom"]): 39, + (59, G["arith"]): 50, + (59, G["factor"]): 55, + (59, G["function-call"]): 33, + (65, G["atom"]): 39, + (65, G["expr"]): 64, + (65, G["not-empty-expr-list"]): 66, + (65, G["negable"]): 47, + (65, G["term"]): 56, + (65, G["factor"]): 55, + (65, G["arith"]): 50, + (65, G["comp"]): 46, + (65, G["function-call"]): 33, + (71, G["atom"]): 39, + (71, G["expr"]): 64, + (71, G["not-empty-expr-list"]): 63, + (71, G["negable"]): 47, + (71, G["term"]): 56, + (71, G["factor"]): 55, + (71, G["arith"]): 50, + (71, G["comp"]): 46, + (71, G["function-call"]): 33, + (71, G["expr-list"]): 72, + (79, G["case-list"]): 89, + (83, G["atom"]): 39, + (83, G["expr"]): 84, + (83, G["factor"]): 55, + (83, G["comp"]): 46, + (83, G["term"]): 56, + (83, G["negable"]): 47, + (83, G["arith"]): 50, + (83, G["function-call"]): 33, + (85, G["case-list"]): 86, + (87, G["case-list"]): 88, + (92, G["declaration-list"]): 93, + (95, G["atom"]): 39, + (95, G["comp"]): 46, + (95, G["factor"]): 55, + (95, G["negable"]): 47, + (95, G["term"]): 56, + (95, G["function-call"]): 33, + (95, G["arith"]): 50, + (95, G["expr"]): 96, + (98, G["atom"]): 39, + (98, G["expr"]): 99, + (98, G["negable"]): 47, + (98, G["arith"]): 50, + (98, G["term"]): 56, + (98, G["factor"]): 55, + (98, G["comp"]): 46, + (98, G["function-call"]): 33, + (102, G["term"]): 56, + (102, G["negable"]): 47, + (102, G["atom"]): 39, + (102, G["arith"]): 50, + (102, G["expr"]): 103, + (102, G["function-call"]): 33, + (102, G["factor"]): 55, + (102, G["comp"]): 46, + (104, G["term"]): 56, + (104, G["negable"]): 47, + (104, G["atom"]): 39, + (104, G["expr"]): 105, + (104, G["arith"]): 50, + (104, G["comp"]): 46, + (104, G["function-call"]): 33, + (104, G["factor"]): 55, + (112, G["atom"]): 39, + (112, G["factor"]): 55, + (112, G["expr"]): 111, + (112, G["comp"]): 46, + (112, G["term"]): 56, + (112, G["negable"]): 47, + (112, G["block"]): 113, + (112, G["arith"]): 50, + (112, G["function-call"]): 33, + (114, G["atom"]): 39, + (114, G["factor"]): 55, + (114, G["expr"]): 111, + (114, G["comp"]): 46, + (114, G["term"]): 56, + (114, G["negable"]): 47, + (114, G["arith"]): 50, + (114, G["block"]): 115, + (114, G["function-call"]): 33, + (121, G["param-list"]): 122, + (127, G["factor"]): 55, + (127, G["term"]): 56, + (127, G["comp"]): 46, + (127, G["negable"]): 47, + (127, G["function-call"]): 33, + (127, G["atom"]): 39, + (127, G["arith"]): 50, + (127, G["expr"]): 128, + (132, G["atom"]): 39, + (132, G["factor"]): 55, + (132, G["comp"]): 46, + (132, G["expr"]): 133, + (132, G["term"]): 56, + (132, G["negable"]): 47, + (132, G["arith"]): 50, + (132, G["function-call"]): 33, + (137, G["method"]): 139, + (137, G["attribute"]): 136, + (137, G["feature-list"]): 138, + (140, G["method"]): 139, + (140, G["attribute"]): 136, + (140, G["feature-list"]): 141, + (142, G["feature-list"]): 143, + (142, G["method"]): 139, + (142, G["attribute"]): 136, + (144, G["method"]): 139, + (144, G["attribute"]): 136, + (144, G["feature-list"]): 145, + (148, G["method"]): 139, + (148, G["feature-list"]): 149, + (148, G["attribute"]): 136, + (154, G["class-def"]): 153, + (154, G["class-list"]): 155, } diff --git a/src/coolc.sh b/src/coolc.sh index 41e6e2836..916038c20 100755 --- a/src/coolc.sh +++ b/src/coolc.sh @@ -10,16 +10,8 @@ echo "Copyright (c) 2019: Alejandro Klever Clemente, Laura Tamayo Blanco, Miguel if [[ $(pwd) == *src ]] then - python cool run ${INPUT_FILE} + python cool compile "${INPUT_FILE}" "${OUTPUT_FILE}" else cd src - COOL_PATH="$(pwd)/cool" - STD_OUT=$(python ${COOL_PATH} run ${INPUT_FILE}) - if [ $? -eq 1 ] - then - echo "${STD_OUT}" - false - else - true - fi + python cool compile "${INPUT_FILE}" "${OUTPUT_FILE}" fi From 50e54efe85e86d28d6721f4dd75abccdb97cebad Mon Sep 17 00:00:00 2001 From: alejandroklever Date: Sat, 13 Mar 2021 00:18:10 -0500 Subject: [PATCH 112/143] actualizacion de pyjapt y bloqueo de la inferencia de tipos --- requirements.txt | 2 +- src/cool/semantics/type_inference.py | 4 ++-- src/cool/semantics/utils/astnodes.py | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/requirements.txt b/requirements.txt index 726c871b8..624a299da 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ pytest pytest-ordering -pyjapt~=0.3.0 +pyjapt~=0.3.1 typer~=0.3.2 diff --git a/src/cool/semantics/type_inference.py b/src/cool/semantics/type_inference.py index aaebb8e31..0af0c4805 100644 --- a/src/cool/semantics/type_inference.py +++ b/src/cool/semantics/type_inference.py @@ -657,7 +657,7 @@ def visit(self, node: ast.AssignNode, scope: Scope): @visitor.when(ast.BlockNode) def visit(self, node: ast.BlockNode, scope: Scope): child_scope = scope.children[0] - for i, expr in enumerate(node.expressions): + for _, expr in enumerate(node.expressions): self.visit(expr, child_scope) @visitor.when(ast.ConditionalNode) @@ -674,7 +674,7 @@ def visit(self, node: ast.WhileNode, scope: Scope): @visitor.when(ast.SwitchCaseNode) def visit(self, node: ast.SwitchCaseNode, scope: Scope): self.visit(node.expr, scope) - for i, (_id, _type, _expr) in enumerate(node.cases): + for i, (_, _, _expr) in enumerate(node.cases): self.visit(_expr, scope.children[i]) @visitor.when(ast.MethodCallNode) diff --git a/src/cool/semantics/utils/astnodes.py b/src/cool/semantics/utils/astnodes.py index 2167be6fe..25ba898d6 100644 --- a/src/cool/semantics/utils/astnodes.py +++ b/src/cool/semantics/utils/astnodes.py @@ -8,7 +8,7 @@ class Node: class ProgramNode(Node): - def __init__(self, declarations): + def __init__(self, declarations: List['ClassDeclarationNode']): self.declarations: List[ClassDeclarationNode] = declarations @@ -17,14 +17,14 @@ class DeclarationNode(Node): class ClassDeclarationNode(DeclarationNode): - def __init__(self, idx, features, parent=None): + def __init__(self, idx: str, features: List[Feature], parent: Optional[str] =None): self.id: str = idx self.parent: str = parent self.features: List[Feature] = features class MethodDeclarationNode(DeclarationNode): - def __init__(self, idx, params, return_type, body): + def __init__(self, idx: str, params: List[Tuple[str, str]], return_type: str, body: 'ExprNode'): self.id: str = idx self.params: List[Tuple[str, str]] = params self.return_type: str = return_type @@ -32,7 +32,7 @@ def __init__(self, idx, params, return_type, body): class AttrDeclarationNode(DeclarationNode): - def __init__(self, idx, typex, expr=None): + def __init__(self, idx: str, typex: str, expr: 'ExprNode' = None): self.id: str = idx self.type: str = typex self.expr: ExprNode = expr @@ -43,8 +43,8 @@ class ExprNode(Node): class ParenthesisExpr(ExprNode): - def __init__(self, expr): - self.expr = expr + def __init__(self, expr: 'ExprNode'): + self.expr: 'ExprNode' = expr class BlockNode(ExprNode): From a6d2357bf45572a9a725eec94d94b7b8d319cf96 Mon Sep 17 00:00:00 2001 From: AlejandroKlever Date: Sat, 13 Mar 2021 14:28:52 -0500 Subject: [PATCH 113/143] setup for windows local testing --- src/cool/__main__.py | 4 ++++ src/coolc.py | 23 +++++++++++++++++++++++ tests/codegen_test.py | 14 +++++++++----- tests/conftest.py | 8 ++++++-- tests/lexer_test.py | 12 +++++++++--- tests/parser_test.py | 12 +++++++++--- tests/semantic_test.py | 13 +++++++++---- tests/utils/utils.py | 16 +++++++++++++--- 8 files changed, 82 insertions(+), 20 deletions(-) create mode 100644 src/coolc.py diff --git a/src/cool/__main__.py b/src/cool/__main__.py index 7a0b51f2f..b5ae3c67b 100644 --- a/src/cool/__main__.py +++ b/src/cool/__main__.py @@ -118,6 +118,10 @@ def compile( output_file: typer.FileTextWrite = typer.Argument('a.mips', help='Mips file'), verbose: bool = typer.Option(False, help='Run in verbose mode.') ): + # In case of encoding conflict + if input_file.encoding.lower != 'utf-8': + input_file = open(input_file.name, encoding='utf-8') + program = input_file.read() tokens, lexer = tokenize(program, verbose) diff --git a/src/coolc.py b/src/coolc.py new file mode 100644 index 000000000..e27c368fa --- /dev/null +++ b/src/coolc.py @@ -0,0 +1,23 @@ +import os +import sys +import subprocess + +input_file = sys.argv[1].replace('\\', '\\\\') +output_file = input_file[:-2] + 'mips' + +print('Stranger Bugs Cool Compiler v0.1') +print('Copyright (c) 2019: Alejandro Klever Clemente, Laura Tamayo Blanco, Miguel Angel Gonzalez Calles') + +def run(): + sp = subprocess.run(['python', 'cool', 'compile', input_file, output_file], capture_output=True, timeout=100) + print(sp.stdout.decode()) + print(input_file) + print(output_file) + print(sp.returncode) + exit(sp.returncode) + +if os.getcwd().endswith('src'): + run() +else: + os.chdir('src') + run() diff --git a/tests/codegen_test.py b/tests/codegen_test.py index 9cf790b31..b779e6aeb 100644 --- a/tests/codegen_test.py +++ b/tests/codegen_test.py @@ -1,9 +1,11 @@ -import pytest import os +import pathlib + +import pytest + from .utils import compare_outputs -tests_dir = __file__.rpartition('/')[0] + '/codegen/' -print(tests_dir) +tests_dir = str(pathlib.Path(__file__).parent / 'codegen') tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] # @pytest.mark.lexer @@ -14,5 +16,7 @@ @pytest.mark.run(order=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 + compare_outputs(compiler_path, + str(os.path.join(tests_dir, cool_file)), + str(os.path.join(tests_dir, cool_file[:-3] + '_input.txt')), + str(os.path.join(tests_dir, cool_file[:-3] + '_output.txt'))) diff --git a/tests/conftest.py b/tests/conftest.py index 0d5b9dbae..f357ea3da 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,10 +1,14 @@ import pytest import os +import platform + @pytest.fixture def compiler_path(): + extension = 'sh' if platform.system() != 'Windows' else 'py' + if os.getcwd().endswith('src'): - return os.path.abspath('./coolc.sh') + return os.path.abspath(f'./coolc.{extension}') # For local test using the testing system of visual studio code - return os.path.abspath(os.path.join('src', 'coolc.sh')) + return os.path.abspath(os.path.join('src', f'coolc.{extension}')) diff --git a/tests/lexer_test.py b/tests/lexer_test.py index 0381d0335..3a7d81024 100644 --- a/tests/lexer_test.py +++ b/tests/lexer_test.py @@ -1,13 +1,19 @@ -import pytest import os +import pathlib + +import pytest + from .utils import compare_errors -tests_dir = __file__.rpartition('/')[0] + '/lexer/' +tests_dir = str(pathlib.Path(__file__).parent / 'lexer') tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] + @pytest.mark.lexer @pytest.mark.error @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, + str(os.path.join(tests_dir, cool_file)), + str(os.path.join(tests_dir, cool_file[:-3] + '_error.txt'))) diff --git a/tests/parser_test.py b/tests/parser_test.py index 3c2b8ee58..7af9b9da3 100644 --- a/tests/parser_test.py +++ b/tests/parser_test.py @@ -1,13 +1,19 @@ -import pytest import os +import pathlib + +import pytest + from .utils import compare_errors -tests_dir = __file__.rpartition('/')[0] + '/parser/' +tests_dir = str(pathlib.Path(__file__).parent / 'parser') tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] + @pytest.mark.parser @pytest.mark.error @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, + str(os.path.join(tests_dir, cool_file)), + str(os.path.join(tests_dir, cool_file[:-3] + '_error.txt'))) diff --git a/tests/semantic_test.py b/tests/semantic_test.py index f0d1ab414..5cca882d9 100644 --- a/tests/semantic_test.py +++ b/tests/semantic_test.py @@ -1,8 +1,11 @@ -import pytest import os +import pathlib + +import pytest + from .utils import compare_errors, first_error_only_line -tests_dir = __file__.rpartition('/')[0] + '/semantic/' +tests_dir = str(pathlib.Path(__file__).parent / 'semantic') tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] @pytest.mark.semantic @@ -10,5 +13,7 @@ @pytest.mark.run(order=3) @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 + compare_errors(compiler_path, + str(os.path.join(tests_dir, cool_file)), + str(os.path.join(tests_dir, cool_file[:-3] + '_error.txt')), + cmp=first_error_only_line) diff --git a/tests/utils/utils.py b/tests/utils/utils.py index 84cd395bf..4a319352f 100644 --- a/tests/utils/utils.py +++ b/tests/utils/utils.py @@ -1,5 +1,6 @@ import subprocess import re +import platform COMPILER_TIMEOUT = 'El compilador tarda mucho en responder.' @@ -45,11 +46,17 @@ def get_file_name(path: str): def compare_errors(compiler_path: str, cool_file_path: str, error_file_path: str, cmp=first_error, timeout=100): try: - sp = subprocess.run(['bash', compiler_path, cool_file_path], capture_output=True, timeout=timeout) + if platform.system() == 'Windows': + sp = subprocess.run(['python', compiler_path, cool_file_path], capture_output=True, timeout=timeout) + else: + sp = subprocess.run(['bash', compiler_path, cool_file_path], capture_output=True, timeout=timeout) return_code, output = sp.returncode, sp.stdout.decode() except subprocess.TimeoutExpired: assert False, COMPILER_TIMEOUT - + + print(['python', compiler_path, cool_file_path]) + print(return_code, platform.system()) + print(output) assert return_code == 1, TEST_MUST_FAIL % get_file_name(cool_file_path) fd = open(error_file_path, 'r') @@ -67,7 +74,10 @@ def compare_errors(compiler_path: str, cool_file_path: str, error_file_path: str (?:Loaded: .+\n)*''' 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) + if platform.system() == 'Windows': + sp = subprocess.run(['python', compiler_path, cool_file_path], capture_output=True, timeout=timeout) + else: + sp = subprocess.run(['bash', compiler_path, cool_file_path], capture_output=True, timeout=timeout) assert sp.returncode == 0, TEST_MUST_COMPILE % get_file_name(cool_file_path) except subprocess.TimeoutExpired: assert False, COMPILER_TIMEOUT From ea9f406b6951cbf47bcbf5f8e98fff93f1253277 Mon Sep 17 00:00:00 2001 From: alejandroklever Date: Sat, 13 Mar 2021 23:59:18 -0500 Subject: [PATCH 114/143] deleting unnecesary code --- src/coolc.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/coolc.py b/src/coolc.py index e27c368fa..efea0322e 100644 --- a/src/coolc.py +++ b/src/coolc.py @@ -11,9 +11,6 @@ def run(): sp = subprocess.run(['python', 'cool', 'compile', input_file, output_file], capture_output=True, timeout=100) print(sp.stdout.decode()) - print(input_file) - print(output_file) - print(sp.returncode) exit(sp.returncode) if os.getcwd().endswith('src'): From 047efa80c1e47caf0e0156c3a285d53afe91d569 Mon Sep 17 00:00:00 2001 From: alejandroklever Date: Sun, 14 Mar 2021 01:01:29 -0400 Subject: [PATCH 115/143] cleaning code --- tests/utils/utils.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/utils/utils.py b/tests/utils/utils.py index 4a319352f..3a19269cc 100644 --- a/tests/utils/utils.py +++ b/tests/utils/utils.py @@ -54,9 +54,6 @@ def compare_errors(compiler_path: str, cool_file_path: str, error_file_path: str except subprocess.TimeoutExpired: assert False, COMPILER_TIMEOUT - print(['python', compiler_path, cool_file_path]) - print(return_code, platform.system()) - print(output) assert return_code == 1, TEST_MUST_FAIL % get_file_name(cool_file_path) fd = open(error_file_path, 'r') From 910c53c10b3a6b019aee2b62b9215ff393f433f6 Mon Sep 17 00:00:00 2001 From: alejandroklever Date: Sun, 14 Mar 2021 01:02:37 -0400 Subject: [PATCH 116/143] deleting semantic test case --- tests/semantic/01_program.cl | 16 ---------------- tests/semantic/01_result.txt | 9 --------- tests/semantic/02_program.cl | 7 ------- tests/semantic/02_result.txt | 1 - 4 files changed, 33 deletions(-) delete mode 100644 tests/semantic/01_program.cl delete mode 100644 tests/semantic/01_result.txt delete mode 100644 tests/semantic/02_program.cl delete mode 100644 tests/semantic/02_result.txt diff --git a/tests/semantic/01_program.cl b/tests/semantic/01_program.cl deleted file mode 100644 index 75aaf27d0..000000000 --- a/tests/semantic/01_program.cl +++ /dev/null @@ -1,16 +0,0 @@ -class Main { - a: Int - - b: String - - main () : String { - let a: Int <- "" in 0 - } - - function_with_errors() : Object { - case a of - x: Int => (new IO).out_int(x) - y: String => (new IO).out_string(x) - esac - } -} \ No newline at end of file diff --git a/tests/semantic/01_result.txt b/tests/semantic/01_result.txt deleted file mode 100644 index f8d632677..000000000 --- a/tests/semantic/01_result.txt +++ /dev/null @@ -1,9 +0,0 @@ -(4, 5) - SyntacticError: Expected ';' instead of 'b'. -(6, 5) - SyntacticError: Expected ';' instead of 'main'. -(10, 5) - SyntacticError: Expected ';' instead of 'function_with_errors'. -(13, 13) - SyntacticError: Expected ';' instead of 'y'. -(14, 9) - SyntacticError: Expected ';' instead of 'esac'. -(16, 1) - SyntacticError: Expected ';' instead of '}'. -TypeError: Cannot convert "String" into "Int". -TypeError: Cannot convert "Int" into "String". -IdentifierError: Variable "x" is not defined in "function_with_errors". \ No newline at end of file diff --git a/tests/semantic/02_program.cl b/tests/semantic/02_program.cl deleted file mode 100644 index e3fb69887..000000000 --- a/tests/semantic/02_program.cl +++ /dev/null @@ -1,7 +0,0 @@ -class Main { - -} - -class A inherits C { } -class B inherits A { } -class C inherits B { } \ No newline at end of file diff --git a/tests/semantic/02_result.txt b/tests/semantic/02_result.txt deleted file mode 100644 index a02611c57..000000000 --- a/tests/semantic/02_result.txt +++ /dev/null @@ -1 +0,0 @@ -DependencyError: Circular class dependency involving class A. \ No newline at end of file From 552ef6e4ed67020cdd1e1965e0bb3f15a0dce05e Mon Sep 17 00:00:00 2001 From: alejandroklever Date: Sun, 14 Mar 2021 01:05:56 -0400 Subject: [PATCH 117/143] uncommenting Type Checking procedure --- src/cool/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cool/__main__.py b/src/cool/__main__.py index b5ae3c67b..54bf27f41 100644 --- a/src/cool/__main__.py +++ b/src/cool/__main__.py @@ -80,7 +80,7 @@ def check_semantics(ast, scope: Scope, context: Context, errors: List[str]): if not errors: OverriddenMethodChecker(context, errors).visit(ast) # InferenceChecker(context, errors).visit(ast, scope) - # TypeChecker(context, errors).visit(ast, scope) + TypeChecker(context, errors).visit(ast, scope) return ast, scope, context, errors From 548a04a788b987dbde2e37bc0866deec507b3cd9 Mon Sep 17 00:00:00 2001 From: alejandroklever Date: Sun, 14 Mar 2021 01:11:25 -0400 Subject: [PATCH 118/143] replacing get_type method in Object by type_name --- src/cool/semantics/type_collector.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cool/semantics/type_collector.py b/src/cool/semantics/type_collector.py index 253ba943d..4c0488ad6 100644 --- a/src/cool/semantics/type_collector.py +++ b/src/cool/semantics/type_collector.py @@ -37,7 +37,7 @@ def visit(self, node): bool_type.set_parent(object_type) object_type.define_method('abort', [], [], object_type) - object_type.define_method('get_type', [], [], string_type) + object_type.define_method('type_name', [], [], string_type) object_type.define_method('copy', [], [], self_type) io_type.define_method('out_string', ['x'], [string_type], self_type) From f62d04b0e475bd35dc0aef588da6bca1cd4b1eb6 Mon Sep 17 00:00:00 2001 From: LauTB <45464137+LauTB@users.noreply.github.com> Date: Tue, 27 Jul 2021 22:32:34 -0400 Subject: [PATCH 119/143] created semantic feature --- doc/Informe.md | 373 +-- src/cool/__main__.py | 61 +- src/cool/grammar.py | 22 +- src/cool/parsertab.py | 2559 +++++++++-------- src/cool/semantics/__init__.py | 6 +- src/cool/semantics/execution.py | 351 --- src/cool/semantics/formatter.py | 207 +- src/cool/semantics/overridden.py | 98 +- src/cool/semantics/position_assigner.py | 441 +++ ...uilder.py => type_builder_for_features.py} | 174 +- .../semantics/type_builder_for_inheritance.py | 73 + src/cool/semantics/type_checker.py | 344 ++- src/cool/semantics/type_collector.py | 47 +- src/cool/semantics/type_inference.py | 237 +- src/cool/semantics/utils/astnodes.py | 57 +- src/cool/semantics/utils/errors.py | 128 +- src/cool/semantics/utils/scope.py | 148 +- tests/execution/01_program.cl | 34 - tests/execution/02_program.cl | 24 - tests/execution/03_program.cl | 19 - tests/execution/04_program.cl | 47 - tests/execution/05_program.cl | 23 - tests/execution/06_program.cl | 38 - tests/inference/01_program.cl | 16 - tests/inference/01_result.txt | 19 - tests/inference/02_program.cl | 15 - tests/inference/02_result.txt | 22 - tests/inference/03_program.cl | 17 - tests/inference/03_result.txt | 23 - tests/inference/04_program.cl | 16 - tests/inference/04_result.txt | 19 - tests/inference/05_program.cl | 16 - tests/inference/05_result.txt | 16 - tests/inference/06_program.cl | 44 - tests/inference/06_result.txt | 47 - tests/inference/07_program.cl | 19 - tests/inference/07_result.txt | 23 - tests/inference/08_program.cl | 33 - tests/inference/08_result.txt | 38 - tests/inference/09_program.cl | 16 - tests/inference/09_result.txt | 19 - tests/inference/10_program.cl | 33 - tests/inference/10_result.txt | 51 - tests/inference/11_program.cl | 35 - tests/inference/11_result.txt | 52 - 45 files changed, 2886 insertions(+), 3214 deletions(-) delete mode 100644 src/cool/semantics/execution.py create mode 100644 src/cool/semantics/position_assigner.py rename src/cool/semantics/{type_builder.py => type_builder_for_features.py} (53%) create mode 100644 src/cool/semantics/type_builder_for_inheritance.py delete mode 100644 tests/execution/01_program.cl delete mode 100644 tests/execution/02_program.cl delete mode 100644 tests/execution/03_program.cl delete mode 100644 tests/execution/04_program.cl delete mode 100644 tests/execution/05_program.cl delete mode 100644 tests/execution/06_program.cl delete mode 100644 tests/inference/01_program.cl delete mode 100644 tests/inference/01_result.txt delete mode 100644 tests/inference/02_program.cl delete mode 100644 tests/inference/02_result.txt delete mode 100644 tests/inference/03_program.cl delete mode 100644 tests/inference/03_result.txt delete mode 100644 tests/inference/04_program.cl delete mode 100644 tests/inference/04_result.txt delete mode 100644 tests/inference/05_program.cl delete mode 100644 tests/inference/05_result.txt delete mode 100644 tests/inference/06_program.cl delete mode 100644 tests/inference/06_result.txt delete mode 100644 tests/inference/07_program.cl delete mode 100644 tests/inference/07_result.txt delete mode 100644 tests/inference/08_program.cl delete mode 100644 tests/inference/08_result.txt delete mode 100644 tests/inference/09_program.cl delete mode 100644 tests/inference/09_result.txt delete mode 100644 tests/inference/10_program.cl delete mode 100644 tests/inference/10_result.txt delete mode 100644 tests/inference/11_program.cl delete mode 100644 tests/inference/11_result.txt diff --git a/doc/Informe.md b/doc/Informe.md index 939682ce7..69f3dc7cf 100644 --- a/doc/Informe.md +++ b/doc/Informe.md @@ -1,332 +1,41 @@ -Segundo Proyecto de Compilación -=============================== - -Título --------------------------------------------------------------------------------------------- - -> Inferencia de tipos en el lenguaje de programación COOL, una aproximación a través de grafos. - -Estudiantes ------------ - -> - Alejandro Klever Clemente C-311 -> - Miguel Angel Gonzalez Calles C-311 - -### 1 Inferencia de Tipos - -COOL es un lenguaje de programación estáticamente tipado, y aunque el lenguaje no presenta inferencia de tipos, esta es una característica muy útil que incorporaremos en un nuestro intérprete. - -Nuestra solución a la inferencia de tipos se apoya en el uso básico de la teoría de grafos y en el uso del patrón de diseño visitor. - -La inferencia de tipos de nuestro proyecto detecta para cada atributo, variable, parámetro de función o retorno de función el primer tipo que le puede ser asignado, modificando en el árbol de sintaxis abstracta el string `AUTO_TYPE` por el nombre del tipo correspondiente y asignando los tipos correspondientes en el contexto y el ámbito en que seon declarados. - -#### 1.1 Algoritmo y Grafo de Dependecias - -**Entrada :** Un árbol de sintaxis abstracta, un contexto con todos los tipos declarados en el programa de COOL. - -**Salida :** Un árbol de Sintaxis Abstracta, Un Contexto y un Scope con tipos bien tagueados. - -**Algoritmo :** Durante el recorrido del AST será construido un grafo dirigido cuyos nodos encerrarán el concepto de las expresiones marcadas como `AUTO_TYPE` y las aristas representan las dependencias entre las expresiones de estos nodos para inferir su tipo. Sea `E1` una expresión cuyo tipo estático es marcado como `AUTO_TYPE`, y sea `E2` una expresión a partir de a cual se puede inferir el tipo de estático de `E1` entonces en el grafo existirá la arista ``. Una vez construido el árbol se comenzará una cadena de expansión de tipos estáticos de la forma `E1, E2, ..., En` donde `Ej` se infiere de `Ei` con `1 < j = i + 1 <= n` y `E1` es una expresión con tipo estático definido, al cual llamaremos átomo. Cuando todos los átomos se hayan propagado a través del grafo los nodos que no hayan podido ser resueltos serán marcados como tipos `Object` al ser esta la clase mas general del lenguaje. - -**Implementación :** Para esto creamos una estructura llamada `DependencyGraph` donde podemos crear nodos como una estructura llamada `DependencyNode` y arcos entre ellos. La estructura `DependencyGraph` consiste en un `OrderedDict` de nodos contra lista de adyacencia. Esta lista de adyacencia contiene los nodos a los cuales la llave propagar su tipo, estos nodos de la lista tienen un orden y esto es fundamental para el algoritmo de solución de inferencia. Si tenemos un caso `{x: [y, z]}` donde `x`, `y`, `z` son nodos, entonces el algoritmo determinará el tipo de `y` y `z` antes de continuar con todas sus cadenas de expansión, por lo que si `z` forma parte de una cadena de expansión de `y` entonces `y` no propagará su tipo a `z` ya que `x` lo hizo antes. Como se puede ver el algoritmo es un BFS simple donde en la cola, al inicio, serán incluido los nodos del grafo que tengan su tipo definido, es decir que no sea `AUTO_TYPE`. - -#### 1.2 Nodos de Dependencia - -Cada nodo del grafo será una abstracción de un concepto en el que se use un tagueo explícito de `AUTO_TYPE` y tendrá las referencias a las partes del proceso de semántica del programa, además de que cada nodo contará con un método `update(type)` el cual actualiza el tipo estático de estos conceptos. - -```python -class DependencyNode: - pass - -class AtomNode(DependencyNode): - """Nodo base el cual es creado a partir de expresiones que - contienen tipo estático u operaciones aritméticas""" - pass - -class AttributeNode(DependencyNode): - """Atributo de una clase""" - pass - -class ParameterNode(DependencyNode): - """Parámetro de una función""" - pass - -class ReturnTypeNode(DependencyNode): - """Tipo de retorno de una función""" - pass - -class VariableInfoNode(DependencyNode): - """Variables declaradas en el scope.""" - pass -``` - -#### 1.3 Casos factibles - -El algoritmo funciona de manera análoga para atributos, variables, parámetros y retorno de funciones. Explicado de forma recursiva puede ser visto como: - -- Un `AUTO_TYPE` será sustituido por su tipo correspodiente si este forma parte de una operacion que permita saber su tipo, o es usado en una expresión de la cuál es posible determinar su tipo. - -- Es importante señalar en que contexto estas dependencias son tomadas en cuenta: - - - Para los atributos marcados como `AUTO_TYPE` su tipo podrá ser determinado dentro del cuerpo de cualquiera de las funciones de la clase, o si es detectable el tipo de la expresión de inicialización. - - - Para las variables su tipo será determinado dentro del scope donde estas son válidas. - -- Para los parámetros su tipo será determinado dentro del cuerpo de la función o cuando esta función sea llamada a través de una operacion de dispatch. - -- Para los retornos de funciones, su tipo será determinado con su expresión y los llamados a dicha función a través de una operacion de dispatch. - -- En las expresiones if-then-else o case-of asignan automáticamente el tipo `Object` si al menos una de sus ramificaciones devuelve una expresión que no tiene tipo definido (`AUTO_TYPE`), en caso contrario asignará el `join` de las ramificaciones. - -##### 1.3.1 Ejemplos de casos factibles para la inferencia - -En este caso la expresión `d + 1` desambigua a `d` en un `Int` y luego `c` se infiere de `d`, `b` se infiere de `c`, `a` se infiere de `b` y el retorno de la función de infiere de `a`. Quedando todos los parámetros y el retorno de la función marcados como `Int`. - -```typescript -class Main { - function(a: AUTO_TYPE, b: AUTO_TYPE, c: AUTO_TYPE, d: AUTO_TYPE): AUTO_TYPE { - { - a <- b; - b <- c; - c <- d; - d <- a; - d + 1; - a; - } - }; -} -``` - -Similar al caso anterior pero en esta ocasión incluyendo atributos, la expresión los `x + y` infiere a los parámetros `x` y `y` como `Int` y tambien al atributo `b`, `a` se infiere de `b`. El tipo de retorno de `create_point()` se infiere de su porpia cuerpo con la expression `new Point` y esta a su vez infiere el tipo de retorno de `init()`. - -```typescript -class Point { - a: AUTO_TYPE; - b: AUTO_TYPE; - - init(x: AUTO_TYPE, y: AUTO_TYPE): AUTO_TYPE {{ - a <- b; - b <- x + y; - create_point(); - }}; - - create_point(): AUTO_TYPE { new Point }; -} -``` - -Probando con funciones recursivas tenemos el caso de fibonacci tipo de `n` se infiere al ser usado en las expresiones `n <= 2`, `n - 1`, `n - 2`, las cuales lo marcan como `Int`, `fibonacci(n - 1) + fibonacci(n - 2)` marca al retorno de la función como `Int` y la expresión if-then-else lo marca como `Object`. En este último caso la expresión `fibonacci(n - 1) + fibonacci(n - 2)` termina de analizarse primero que la expresión if-then-else por lo cual el tipo de retorno será `Int` el cual fue el primero que se definido, lo cual demuestra que el orden en el que se analizan las inferencias importan. - -```typescript -class Main { - fibonacci(n: AUTO_TYPE): AUTO_TYPE { - if n <= 2 then 1 else fibonacci(n - 1) + fibonacci(n - 2) fi - }; -} -``` - -El caso de Ackerman es bastante interesante, en nuestro algoritmo importa el orden en el que fueron definidas las dependencias. `m` y `n` son inferibles como `Int` a partir de las expresiones `n + 1` y `m - 1` respectivamente, y el tipo de retorno de `ackermann` en inferible por `n` al ser usado como segundo parámetro en un llamado de si mismo, por lo cual será `Int`. La influencia de la expresión `if-then-else` se ve anulada por el orden de inferencia. - -```typescript -class Main { - - ... - - ackermann(m: AUTO_TYPE, n: AUTO_TYPE): AUTO_TYPE { - if m = 0 then n + 1 else - if n = 0 then ackermann(m - 1, 1) else - ackermann(m - 1, ackermann(m, n - 1)) - fi - fi - }; - - ... - -} -``` - -#### 1.4 Casos No factibles - -No es posible determinar el tipo de una variable, atributo, parámetro, o retorno de función si para este se cumple el caso general y su caso especifico correspondiente. - -##### 1.4.1 Casos generales - -El tipo es utilizado en expresiones que no permiten determinar su tipo, o solo se logra determinar que poseen el mismo tipo que otras variables, atributos, parámetros o retorno de funciones de las cuales tampoco se puede determinar el mismo. - -```typescript -class Main { - b: AUTO_TYPE; - c: AUTO_TYPE; - - ... - - f(a: AUTO_TYPE, d: AUTO_TYPE): AUTO_TYPE { - { - b <- a; - d <- c; - f(a); - } - }; - - factorial(n: AUTO_TYPE): AUTO_TYPE { - if n = 1 then 1 else n * factorial(n - 1) fi - }; -} -``` - -En este ejemplo solo es posible inferir el typo del parámetro `n` de la función `factorial`, su tipo de retorno, el parámetro `a` de la función `f`, su tipo de retorno y el atributo `b` de la clase `Main`, el resto será marcado como `Object`. - -```typescript -class Main { - main (): Object { - 0 - }; - - f(a: AUTO_TYPE, b: AUTO_TYPE): AUTO_TYPE { - if a = 1 then b else - g(a + 1, b / 1) - fi - }; - - g(a: AUTO_TYPE, b: AUTO_TYPE): AUTO_TYPE { - if b = 1 then a else - f(a / 2, b + 1) - fi - }; -} -``` - -En este último caso es posible determinar el tipo de los parámetros `a` y `b` de ambas funciones `f` y `g` ya que estos participan en operaciones aritmétcas, sin embargo los tipos de retorno de estas funciones no son determinables ya que no se usan en otro contexto en un llamado en una de las ramas de la clausula `if-then-else`. Como nuestro algoritmo no propaga los tipos definidos entre ramas de expresiones como los `if-then-else` o `case-of` entonces el tipo de retorno no puede ser definido, luego por defecto se etiquetan como `Object`. - -##### 1.4.2 Casos Particulares - -**Para variables:** si estas no son utilizadas en el ámbito en que son marcadas como `Object`. - -```typescript -class Main inherits IO { - - ... - - f(): Int { - let a: AUTOTYPE, b: AUTO_TYPE in { - 1; - } - }; - - ... - -} -``` - -**Para parámetros:** si dentro del cuerpo de la función estas no son utilizadas y no existe otra función que llame a esta con argumentos con tipado estático definidos, serán marcadas como `Object`: - -```typescript -class Main inherits IO { - - ... - - f(a: AUTO_TYPE): Int{ - 1 - }; - - ... - -} -``` - -**Para atributos:** si no es posible determinar el tipo de la expresión de inicializacion o si dentro del cuerpo de todas las funciones de su clase correspondiente este no son utilizadas, serán marcadas como `Objects`. - -```typescript -class Main inherits IO { - b: AUTO_TYPE; - c: AUTO_TYPE; - - ... - - f(a: AUTO_TYPE): AUTO_TYPE{ - if a < 3 then 1 else f(a - 1) + f(a - 2) fi - }; -} -``` - -**Para el retorno de funciones:** si no es posible determinar el tipo de su expresión. - -```typescript -class Main inherits IO { - - ... - - f(a: Int): AUTO_TYPE{ - if a < 3 then a else f(a - 3) fi - }; -} -``` - -#### 1.5 Expresiones atómicas - -- Valores constantes (ej: 2, "hello", true). - -- Operaciones aritméticas, las cuales influyen en sus operandos que sean `AUTO_TYPE`. - -- Operaciones lógicas, las cuales influyen en sus operandos que sean `AUTO_TYPE`. - -- Llamdos a funciones con valor de retorno conocido. - -- Instancias de clases. - -- Variables de las cuales se conoce su tipo. - -- Bloques donde se puede determinar el tipo de la última expresión. - -### 2 Lexing y Parsing - -Para el proceso de lexing y parsing usamos el paquete de Python [PyJapt](https://github.com/alejandroklever/PyJapt.git), cuyos autores coinciden con los de este proyecto. - -### 3 Proceso de Semántica - -El proceso de semantica es bastante similar al visto en clases prácticas de la 12 a la 15 con algunas pequeñas modificaciones: - -- Recoleccion de tipos. -- Construccion los métodos y atributos de los tipos. -- Comprobamos que no existan dependencias cíclicas con un ordenamiento topológico de los tipos en su árbol de jerarquía -- Chequeo del la sobreescritura de métodos. -- Inferencia de tipos. -- Chequeo de tipos. -- Ejecución del programa. - -Cada uno de estos procesos hace uso del patrón visitor visto en clases prácticas para recorrer el ast y realizar el analisis de cada uno de los procesos. - -#### 3.1 Ejecución de código - -Para la ejecución hemos creado la abstracción de una instancia de un objeto. Con esto conseguimos en todo momento saber sobre que objecto en memoria estamos ejecutando un método y también tenemos acceso a los valores particulares de sus atributos en todo momento del programa. Para guardar el orden de ejcución de las funciones llevaremos una cola donde cada vez que ocurra un llamado a función colocaremos en el tope de la pila la instancia actual en la que estamos y tomará el control de la ejecución la instancia de la cual realizamos el dispatch. Finalmente cuando termine la ejecución de una función retomará el control del programa la instancia en el tope de la pila. El proceso se retira hasta que la pila esta vacía. Para comenzar ejecución de cualquier programa en `COOL` basta con comenzar con la instrucción `(new Main).main()`. - -### 4 CLI-API - -Para la cómoda utilizacion del intérprete hemos usado el paquete de python `typer` para crear una api-cli bastante sencilla, basta con ejecutar el comando `python cool --help` y obtendrá como salida lo siguiente: - - Usage: cool [OPTIONS] COMMAND [ARGS]... - - Options: - --install-completion Install completion for the current shell. - --show-completion Show completion for the current shell, to copy it or - customize the installation. - - --help Show this message and exit. - - Commands: - infer - run - serialize - -Se se puede apreciar existen 3 comandos principales: - -- `infer` el cual recibe un archivo .cl con un programa en COOL con tipos `AUTO_TYPE` y devuelve un programa en COOL con todos los `AUTO_TYPE` reemplazados por sus tipos correspondientes. - -- `run` el cual recibe como entrada un archivo .cl con un programa en COOL y ejecuta dicho programa. - -- `serialize` el cual vuelve a generar y serializar el parser y el lexer del lenguaje tras hacer modificaciones en su gramática. (Pensado para los desarrolladores) - -- En ambos casos se tiene como parámetro adicional el `--verbose` para observar los distintos procesos por los que pasa el proceso de compilación. - -### 5 Testing - -En la carpeta `tests` se encuentra las carpetas `execution`, `inference`, `lexer`, `parser`, `semantic` las cuales contienen casos de pruebas. Para correr todas las pruebas basta con hacer `pytest tests` y se probaran todos los casos menos los de la carpeta `execution`, la cual contiene programa en cool que deberan ser ejecutados a mano usando la cli-api de nuestro intérprete. +# Informe sobre el Proyecto de Compilación + +## Estudiantes + + - Alejandro Klever Clemente (C-411) + - Laura Tamayo Blanco (C-411) + - Miguel Angel Gonzalez Calles (C-411) + +### 1. Proceso de parsing y lexing + +Para este proceso usamos la biblioteca de python `PyJapt` la cual ha sido desarrollada por este equipo y publicada bajo licencia MIT en GitHub y Pypi. + +La documentacion de PyJapt es rica en ejemplos y casos de uso. Puede ser consultada [aqui](https://github.com/alejandroklever/PyJapt). + +La gramatica del lenguaje es una gramatica `LALR(1)`, por lo que tenemos unas tablas action y goto bastante pequeñas en comparación con las de una parser `LR(1)`, y por lo tanto mucho mas rápido de construir y menos costoso espacialmente. + +Actualmente tanto los test de análisis sintáctico y lexicográficos han sido pasados sin problemas. + +### 2. Proceso de análisis semantico + +Para esta parte usamos el patrón visitor aprendido durante el curso de 3er año. Por lo cual recibimos el ast obtenido producto del proceso de parsing y pasará por diferentes clases que irán construyendo: + +- el contexto: Donde de guardara la información de las clases del programa en COOL. +- el scope: Donde se almacena la información de las atributos, variables y parámetros de cada clase y método. + +#### 2.1 Pipeline + +Para el proceso de análisis semantico usamos las siguientes clases que usan el patrón visitor para acceder a cada nodo del ast y obtener nueva información en distintos recorridos: + +- TypeCollector: Encargada de recolectar los tipos de todas las clases del programa de COOL. +- TypeBuilder: Encargado de recolectar la información de los atributos y metodos de cada clase +- OverriddenMethodChecker: Encargado comprobar que la sobreescritura de metodos es concistente. +- TypeChecker: Encargado del cumplimiento de todas las reglas entre los tipos. + +Los tests de semántica están vencidos parcialmente, pues el formato de los mensajes de error aún no es correcto. Estamos trabajando en ello con un primer recorrido que se encargara de asignar a cada nodo del ast la fila y la columna significativa de este de la produccion que generó este nodo. + +Por ejemplo, en el caso de los nodos de la instrucción `let declaration-list in expr` la fila y columna significativa será la del keyword `let`. + +### 3. Conclusiones + +Esperamos proximamente solventar el formato de los errores semanticos siguiendo esta idea. Asi que en resumen, hemos logrado superar la parte de lexing y parsing y estamos cerca de superar los tests de semántica diff --git a/src/cool/__main__.py b/src/cool/__main__.py index 54bf27f41..84e8ec1d2 100644 --- a/src/cool/__main__.py +++ b/src/cool/__main__.py @@ -7,13 +7,12 @@ sys.path.append(os.getcwd()) -from cool.grammar import serialize_parser_and_lexer, Token +from cool.grammar import Token, serialize_parser_and_lexer from cool.lexertab import CoolLexer from cool.parsertab import CoolParser -from cool.semantics import TypeCollector, TypeBuilder, OverriddenMethodChecker, TypeChecker, topological_sorting -from cool.semantics.execution import Executor, ExecutionError -from cool.semantics.formatter import CodeBuilder, Formatter -from cool.semantics.type_inference import InferenceChecker +from cool.semantics import (OverriddenMethodChecker, PositionAssigner, + TypeBuilderForFeatures, TypeBuilderForInheritance, TypeChecker, TypeCollector, + topological_sorting) from cool.semantics.utils.scope import Context, Scope app = typer.Typer() @@ -73,45 +72,14 @@ def parse(tokens: List[Token], verbose: bool = False): def check_semantics(ast, scope: Scope, context: Context, errors: List[str]): TypeCollector(context, errors).visit(ast) - TypeBuilder(context, errors).visit(ast) - declarations = ast.declarations + TypeBuilderForInheritance(context, errors).visit(ast) topological_sorting(ast, context, errors) - ast.declarations = declarations if not errors: + TypeBuilderForFeatures(context, errors).visit(ast) OverriddenMethodChecker(context, errors).visit(ast) - # InferenceChecker(context, errors).visit(ast, scope) TypeChecker(context, errors).visit(ast, scope) return ast, scope, context, errors - -@app.command() -def run( - input_file: typer.FileText = typer.Argument(..., help='Cool file'), - verbose: bool = typer.Option(False, help='Execute in verbose mode.') -): - ast, parser = parse(input_file, verbose) - - - # parsing process failed - if ast is None: - exit(1) - - ast, _, context, errors = check_semantics(ast, Scope(), Context(), []) - - if errors or parser.contains_errors: - for e in errors: - log_error(e) - exit(1) - - try: - Executor(context).visit(ast, Scope()) - log_success('Program finished...') - exit(0) - except ExecutionError as e: - log_error(e.text) - exit(1) - - @app.command() def compile( input_file: typer.FileText = typer.Argument(..., help='Cool file'), @@ -138,6 +106,7 @@ def compile( if ast is None: exit(1) + PositionAssigner(tokens).visit(ast) ast, _, _, errors = check_semantics(ast, Scope(), Context(), []) if errors or parser.contains_errors: @@ -147,22 +116,6 @@ def compile( exit(0) - -@app.command() -def infer( - file: typer.FileText = typer.Argument(..., help='Cool file'), - verbose: bool = typer.Argument(False, help='Execute in verbose mode.') -): - ast, _ = parse(file, verbose) - - if ast is not None: - ast, _, _, errors = check_semantics(ast, Scope(), Context(), []) - if errors: - for e in errors: - log_error(e) - log_success(CodeBuilder().visit(ast, 0)) - - @app.command() def serialize(): serialize_parser_and_lexer() diff --git a/src/cool/grammar.py b/src/cool/grammar.py index d841f14b8..727b65a16 100644 --- a/src/cool/grammar.py +++ b/src/cool/grammar.py @@ -2,7 +2,6 @@ import time from pyjapt import Grammar, Lexer, ShiftReduceParser, Token -from pyjapt.parsing import RuleList import cool.semantics.utils.astnodes as ast @@ -256,15 +255,18 @@ def lexical_error(lexer): expr %= 'while expr loop expr pool', lambda s: ast.WhileNode(s[2], s[4]) expr %= 'let declaration-list in expr', lambda s: ast.LetNode(s[2], s[4]) expr %= 'case expr of case-list esac', lambda s: ast.SwitchCaseNode(s[2], s[4]) -expr %= 'comp', lambda s: s[1] - -comp %= 'negable < negable', lambda s: ast.LessThanNode(s[1], s[2], s[3]) -comp %= 'negable <= negable', lambda s: ast.LessEqualNode(s[1], s[2], s[3]) -comp %= 'negable = negable', lambda s: ast.EqualNode(s[1], s[2], s[3]) -comp %= 'negable', lambda s: s[1] - -negable %= 'not arith', lambda s: ast.NegationNode(s[2]) -negable %= 'arith', lambda s: s[1] +expr %= 'negable', lambda s: s[1] + +negable %= 'not comp', lambda s: ast.NegationNode(s[2]) +negable %= 'comp', lambda s: s[1] + +comp %= 'comp < arith', lambda s: ast.LessThanNode(s[1], s[2], s[3]) +comp %= 'comp <= arith', lambda s: ast.LessEqualNode(s[1], s[2], s[3]) +comp %= 'comp = arith', lambda s: ast.EqualNode(s[1], s[2], s[3]) +comp %= 'comp = not arith', lambda s: ast.EqualNode(s[1], s[2], ast.NegationNode(s[4])) +comp %= 'comp < not arith', lambda s: ast.LessThanNode(s[1], s[2], ast.NegationNode(s[4])) +comp %= 'comp <= not arith', lambda s: ast.LessEqualNode(s[1], s[2], ast.NegationNode(s[4])) +comp %= 'arith', lambda s: s[1] arith %= 'arith + term', lambda s: ast.PlusNode(s[1], s[2], s[3]) arith %= 'arith - term', lambda s: ast.MinusNode(s[1], s[2], s[3]) diff --git a/src/cool/parsertab.py b/src/cool/parsertab.py index 6a998badf..338ba4450 100644 --- a/src/cool/parsertab.py +++ b/src/cool/parsertab.py @@ -17,162 +17,173 @@ def __action_table(): return { (0, G["class"]): ("SHIFT", 1), (1, G["type"]): ("SHIFT", 2), - (2, G["inherits"]): ("SHIFT", 146), (2, G["{"]): ("SHIFT", 3), + (2, G["inherits"]): ("SHIFT", 152), (3, G["}"]): ("REDUCE", G["feature-list -> e"]), (3, G["id"]): ("SHIFT", 4), + (4, G[":"]): ("SHIFT", 136), (4, G["("]): ("SHIFT", 5), - (4, G[":"]): ("SHIFT", 130), - (5, G["id"]): ("SHIFT", 118), + (5, G["id"]): ("SHIFT", 124), (5, G[")"]): ("SHIFT", 6), (6, G[":"]): ("SHIFT", 7), (7, G["type"]): ("SHIFT", 8), (8, G["{"]): ("SHIFT", 9), + (9, G["true"]): ("SHIFT", 25), + (9, G["case"]): ("SHIFT", 21), + (9, G["not"]): ("SHIFT", 30), + (9, G["while"]): ("SHIFT", 13), + (9, G["false"]): ("SHIFT", 26), + (9, G["id"]): ("SHIFT", 46), + (9, G["string"]): ("SHIFT", 32), + (9, G["("]): ("SHIFT", 11), (9, G["new"]): ("SHIFT", 22), (9, G["{"]): ("SHIFT", 10), - (9, G["id"]): ("SHIFT", 43), - (9, G["let"]): ("SHIFT", 14), - (9, G["while"]): ("SHIFT", 13), - (9, G["true"]): ("SHIFT", 25), + (9, G["~"]): ("SHIFT", 27), (9, G["isvoid"]): ("SHIFT", 24), - (9, G["string"]): ("SHIFT", 32), - (9, G["false"]): ("SHIFT", 26), - (9, G["not"]): ("SHIFT", 30), (9, G["if"]): ("SHIFT", 12), - (9, G["~"]): ("SHIFT", 27), - (9, G["("]): ("SHIFT", 11), (9, G["int"]): ("SHIFT", 31), - (9, G["case"]): ("SHIFT", 21), - (10, G["id"]): ("SHIFT", 43), - (10, G["if"]): ("SHIFT", 12), - (10, G["int"]): ("SHIFT", 31), + (9, G["let"]): ("SHIFT", 14), + (10, G["id"]): ("SHIFT", 46), (10, G["("]): ("SHIFT", 11), + (10, G["new"]): ("SHIFT", 22), + (10, G["~"]): ("SHIFT", 27), (10, G["{"]): ("SHIFT", 10), - (10, G["let"]): ("SHIFT", 14), - (10, G["while"]): ("SHIFT", 13), (10, G["isvoid"]): ("SHIFT", 24), - (10, G["not"]): ("SHIFT", 30), - (10, G["new"]): ("SHIFT", 22), + (10, G["if"]): ("SHIFT", 12), (10, G["true"]): ("SHIFT", 25), - (10, G["~"]): ("SHIFT", 27), - (10, G["string"]): ("SHIFT", 32), - (10, G["false"]): ("SHIFT", 26), + (10, G["int"]): ("SHIFT", 31), + (10, G["let"]): ("SHIFT", 14), + (10, G["not"]): ("SHIFT", 30), (10, G["case"]): ("SHIFT", 21), - (11, G["case"]): ("SHIFT", 21), - (11, G["id"]): ("SHIFT", 43), + (10, G["while"]): ("SHIFT", 13), + (10, G["false"]): ("SHIFT", 26), + (10, G["string"]): ("SHIFT", 32), (11, G["("]): ("SHIFT", 11), - (11, G["int"]): ("SHIFT", 31), - (11, G["{"]): ("SHIFT", 10), - (11, G["let"]): ("SHIFT", 14), (11, G["new"]): ("SHIFT", 22), - (11, G["while"]): ("SHIFT", 13), + (11, G["if"]): ("SHIFT", 12), + (11, G["{"]): ("SHIFT", 10), + (11, G["~"]): ("SHIFT", 27), + (11, G["int"]): ("SHIFT", 31), + (11, G["id"]): ("SHIFT", 46), (11, G["isvoid"]): ("SHIFT", 24), (11, G["true"]): ("SHIFT", 25), - (11, G["string"]): ("SHIFT", 32), + (11, G["let"]): ("SHIFT", 14), (11, G["false"]): ("SHIFT", 26), (11, G["not"]): ("SHIFT", 30), - (11, G["~"]): ("SHIFT", 27), - (11, G["if"]): ("SHIFT", 12), - (12, G["("]): ("SHIFT", 11), - (12, G["case"]): ("SHIFT", 21), - (12, G["int"]): ("SHIFT", 31), - (12, G["id"]): ("SHIFT", 43), + (11, G["case"]): ("SHIFT", 21), + (11, G["string"]): ("SHIFT", 32), + (11, G["while"]): ("SHIFT", 13), + (12, G["string"]): ("SHIFT", 32), + (12, G["{"]): ("SHIFT", 10), (12, G["~"]): ("SHIFT", 27), + (12, G["id"]): ("SHIFT", 46), + (12, G["("]): ("SHIFT", 11), (12, G["new"]): ("SHIFT", 22), - (12, G["{"]): ("SHIFT", 10), + (12, G["isvoid"]): ("SHIFT", 24), (12, G["let"]): ("SHIFT", 14), + (12, G["if"]): ("SHIFT", 12), + (12, G["int"]): ("SHIFT", 31), (12, G["not"]): ("SHIFT", 30), - (12, G["while"]): ("SHIFT", 13), + (12, G["case"]): ("SHIFT", 21), (12, G["true"]): ("SHIFT", 25), - (12, G["string"]): ("SHIFT", 32), + (12, G["while"]): ("SHIFT", 13), (12, G["false"]): ("SHIFT", 26), - (12, G["isvoid"]): ("SHIFT", 24), - (12, G["if"]): ("SHIFT", 12), - (13, G["id"]): ("SHIFT", 43), - (13, G["new"]): ("SHIFT", 22), - (13, G["not"]): ("SHIFT", 30), + (13, G["while"]): ("SHIFT", 13), (13, G["true"]): ("SHIFT", 25), - (13, G["isvoid"]): ("SHIFT", 24), - (13, G["string"]): ("SHIFT", 32), - (13, G["false"]): ("SHIFT", 26), - (13, G["case"]): ("SHIFT", 21), - (13, G["if"]): ("SHIFT", 12), - (13, G["~"]): ("SHIFT", 27), (13, G["int"]): ("SHIFT", 31), + (13, G["false"]): ("SHIFT", 26), (13, G["{"]): ("SHIFT", 10), + (13, G["id"]): ("SHIFT", 46), + (13, G["string"]): ("SHIFT", 32), + (13, G["new"]): ("SHIFT", 22), + (13, G["~"]): ("SHIFT", 27), (13, G["("]): ("SHIFT", 11), + (13, G["isvoid"]): ("SHIFT", 24), (13, G["let"]): ("SHIFT", 14), - (13, G["while"]): ("SHIFT", 13), + (13, G["if"]): ("SHIFT", 12), + (13, G["case"]): ("SHIFT", 21), + (13, G["not"]): ("SHIFT", 30), (14, G["id"]): ("SHIFT", 15), (15, G[":"]): ("SHIFT", 16), (16, G["type"]): ("SHIFT", 17), (17, G[","]): ("SHIFT", 18), - (17, G["<-"]): ("SHIFT", 20), (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), + (17, G["<-"]): ("SHIFT", 20), (18, G["id"]): ("SHIFT", 15), (19, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), - (20, G["string"]): ("SHIFT", 32), - (20, G["{"]): ("SHIFT", 10), - (20, G["false"]): ("SHIFT", 26), - (20, G["id"]): ("SHIFT", 43), - (20, G["let"]): ("SHIFT", 14), (20, G["if"]): ("SHIFT", 12), - (20, G["while"]): ("SHIFT", 13), - (20, G["("]): ("SHIFT", 11), + (20, G["id"]): ("SHIFT", 46), (20, G["int"]): ("SHIFT", 31), - (20, G["not"]): ("SHIFT", 30), + (20, G["true"]): ("SHIFT", 25), (20, G["~"]): ("SHIFT", 27), - (20, G["new"]): ("SHIFT", 22), + (20, G["let"]): ("SHIFT", 14), (20, G["isvoid"]): ("SHIFT", 24), + (20, G["not"]): ("SHIFT", 30), (20, G["case"]): ("SHIFT", 21), - (20, G["true"]): ("SHIFT", 25), - (21, G["isvoid"]): ("SHIFT", 24), - (21, G["not"]): ("SHIFT", 30), - (21, G["true"]): ("SHIFT", 25), - (21, G["case"]): ("SHIFT", 21), - (21, G["id"]): ("SHIFT", 43), + (20, G["false"]): ("SHIFT", 26), + (20, G["{"]): ("SHIFT", 10), + (20, G["while"]): ("SHIFT", 13), + (20, G["string"]): ("SHIFT", 32), + (20, G["("]): ("SHIFT", 11), + (20, G["new"]): ("SHIFT", 22), (21, G["string"]): ("SHIFT", 32), - (21, G["false"]): ("SHIFT", 26), - (21, G["~"]): ("SHIFT", 27), - (21, G["if"]): ("SHIFT", 12), - (21, G["{"]): ("SHIFT", 10), - (21, G["let"]): ("SHIFT", 14), - (21, G["int"]): ("SHIFT", 31), + (21, G["id"]): ("SHIFT", 46), + (21, G["new"]): ("SHIFT", 22), (21, G["("]): ("SHIFT", 11), (21, G["while"]): ("SHIFT", 13), - (21, G["new"]): ("SHIFT", 22), + (21, G["{"]): ("SHIFT", 10), + (21, G["if"]): ("SHIFT", 12), + (21, G["true"]): ("SHIFT", 25), + (21, G["int"]): ("SHIFT", 31), + (21, G["let"]): ("SHIFT", 14), + (21, G["not"]): ("SHIFT", 30), + (21, G["case"]): ("SHIFT", 21), + (21, G["~"]): ("SHIFT", 27), + (21, G["false"]): ("SHIFT", 26), + (21, G["isvoid"]): ("SHIFT", 24), (22, G["type"]): ("SHIFT", 23), - (23, G["-"]): ("REDUCE", G["atom -> new type"]), - (23, G["in"]): ("REDUCE", G["atom -> new type"]), - (23, G["error"]): ("REDUCE", G["atom -> new type"]), - (23, G["*"]): ("REDUCE", G["atom -> new type"]), - (23, G["}"]): ("REDUCE", G["atom -> new type"]), - (23, G["/"]): ("REDUCE", G["atom -> new type"]), - (23, G["of"]): ("REDUCE", G["atom -> new type"]), - (23, G["<"]): ("REDUCE", G["atom -> new type"]), - (23, G[")"]): ("REDUCE", G["atom -> new type"]), - (23, G["<="]): ("REDUCE", G["atom -> new type"]), - (23, G["then"]): ("REDUCE", G["atom -> new type"]), (23, G["."]): ("REDUCE", G["atom -> new type"]), - (23, G["="]): ("REDUCE", G["atom -> new type"]), (23, G["else"]): ("REDUCE", G["atom -> new type"]), + (23, G["="]): ("REDUCE", G["atom -> new type"]), (23, G[","]): ("REDUCE", G["atom -> new type"]), (23, G["fi"]): ("REDUCE", G["atom -> new type"]), + (23, G["error"]): ("REDUCE", G["atom -> new type"]), (23, G[";"]): ("REDUCE", G["atom -> new type"]), (23, G["loop"]): ("REDUCE", G["atom -> new type"]), (23, G["@"]): ("REDUCE", G["atom -> new type"]), (23, G["pool"]): ("REDUCE", G["atom -> new type"]), (23, G["+"]): ("REDUCE", G["atom -> new type"]), - (24, G["~"]): ("SHIFT", 27), - (24, G["("]): ("SHIFT", 11), - (24, G["true"]): ("SHIFT", 25), - (24, G["int"]): ("SHIFT", 31), - (24, G["isvoid"]): ("SHIFT", 24), - (24, G["string"]): ("SHIFT", 32), + (23, G["-"]): ("REDUCE", G["atom -> new type"]), + (23, G["in"]): ("REDUCE", G["atom -> new type"]), + (23, G["*"]): ("REDUCE", G["atom -> new type"]), + (23, G["}"]): ("REDUCE", G["atom -> new type"]), + (23, G["/"]): ("REDUCE", G["atom -> new type"]), + (23, G["of"]): ("REDUCE", G["atom -> new type"]), + (23, G["<"]): ("REDUCE", G["atom -> new type"]), + (23, G["<="]): ("REDUCE", G["atom -> new type"]), + (23, G[")"]): ("REDUCE", G["atom -> new type"]), + (23, G["then"]): ("REDUCE", G["atom -> new type"]), (24, G["false"]): ("SHIFT", 26), + (24, G["if"]): ("SHIFT", 12), (24, G["id"]): ("SHIFT", 28), + (24, G["string"]): ("SHIFT", 32), + (24, G["true"]): ("SHIFT", 25), + (24, G["int"]): ("SHIFT", 31), + (24, G["("]): ("SHIFT", 11), (24, G["new"]): ("SHIFT", 22), - (24, G["if"]): ("SHIFT", 12), + (24, G["~"]): ("SHIFT", 27), + (24, G["isvoid"]): ("SHIFT", 24), + (25, G["."]): ("REDUCE", G["atom -> true"]), + (25, G["else"]): ("REDUCE", G["atom -> true"]), + (25, G["="]): ("REDUCE", G["atom -> true"]), + (25, G[","]): ("REDUCE", G["atom -> true"]), + (25, G["fi"]): ("REDUCE", G["atom -> true"]), + (25, G["error"]): ("REDUCE", G["atom -> true"]), + (25, G[";"]): ("REDUCE", G["atom -> true"]), + (25, G["loop"]): ("REDUCE", G["atom -> true"]), + (25, G["@"]): ("REDUCE", G["atom -> true"]), + (25, G["pool"]): ("REDUCE", G["atom -> true"]), + (25, G["+"]): ("REDUCE", G["atom -> true"]), (25, G["-"]): ("REDUCE", G["atom -> true"]), (25, G["in"]): ("REDUCE", G["atom -> true"]), (25, G["*"]): ("REDUCE", G["atom -> true"]), @@ -180,20 +191,20 @@ def __action_table(): (25, G["/"]): ("REDUCE", G["atom -> true"]), (25, G["of"]): ("REDUCE", G["atom -> true"]), (25, G["<"]): ("REDUCE", G["atom -> true"]), - (25, G[")"]): ("REDUCE", G["atom -> true"]), (25, G["<="]): ("REDUCE", G["atom -> true"]), + (25, G[")"]): ("REDUCE", G["atom -> true"]), (25, G["then"]): ("REDUCE", G["atom -> true"]), - (25, G["."]): ("REDUCE", G["atom -> true"]), - (25, G["="]): ("REDUCE", G["atom -> true"]), - (25, G["else"]): ("REDUCE", G["atom -> true"]), - (25, G[","]): ("REDUCE", G["atom -> true"]), - (25, G["+"]): ("REDUCE", G["atom -> true"]), - (25, G["fi"]): ("REDUCE", G["atom -> true"]), - (25, G[";"]): ("REDUCE", G["atom -> true"]), - (25, G["loop"]): ("REDUCE", G["atom -> true"]), - (25, G["@"]): ("REDUCE", G["atom -> true"]), - (25, G["pool"]): ("REDUCE", G["atom -> true"]), - (25, G["error"]): ("REDUCE", G["atom -> true"]), + (26, G["."]): ("REDUCE", G["atom -> false"]), + (26, G["else"]): ("REDUCE", G["atom -> false"]), + (26, G["="]): ("REDUCE", G["atom -> false"]), + (26, G[","]): ("REDUCE", G["atom -> false"]), + (26, G["fi"]): ("REDUCE", G["atom -> false"]), + (26, G["error"]): ("REDUCE", G["atom -> false"]), + (26, G[";"]): ("REDUCE", G["atom -> false"]), + (26, G["loop"]): ("REDUCE", G["atom -> false"]), + (26, G["@"]): ("REDUCE", G["atom -> false"]), + (26, G["pool"]): ("REDUCE", G["atom -> false"]), + (26, G["+"]): ("REDUCE", G["atom -> false"]), (26, G["-"]): ("REDUCE", G["atom -> false"]), (26, G["in"]): ("REDUCE", G["atom -> false"]), (26, G["*"]): ("REDUCE", G["atom -> false"]), @@ -201,31 +212,31 @@ def __action_table(): (26, G["/"]): ("REDUCE", G["atom -> false"]), (26, G["of"]): ("REDUCE", G["atom -> false"]), (26, G["<"]): ("REDUCE", G["atom -> false"]), - (26, G[")"]): ("REDUCE", G["atom -> false"]), (26, G["<="]): ("REDUCE", G["atom -> false"]), + (26, G[")"]): ("REDUCE", G["atom -> false"]), (26, G["then"]): ("REDUCE", G["atom -> false"]), - (26, G["."]): ("REDUCE", G["atom -> false"]), - (26, G["="]): ("REDUCE", G["atom -> false"]), - (26, G["else"]): ("REDUCE", G["atom -> false"]), - (26, G[","]): ("REDUCE", G["atom -> false"]), - (26, G["+"]): ("REDUCE", G["atom -> false"]), - (26, G["fi"]): ("REDUCE", G["atom -> false"]), - (26, G[";"]): ("REDUCE", G["atom -> false"]), - (26, G["loop"]): ("REDUCE", G["atom -> false"]), - (26, G["@"]): ("REDUCE", G["atom -> false"]), - (26, G["pool"]): ("REDUCE", G["atom -> false"]), - (26, G["error"]): ("REDUCE", G["atom -> false"]), - (27, G["~"]): ("SHIFT", 27), - (27, G["("]): ("SHIFT", 11), - (27, G["true"]): ("SHIFT", 25), - (27, G["int"]): ("SHIFT", 31), - (27, G["isvoid"]): ("SHIFT", 24), - (27, G["string"]): ("SHIFT", 32), (27, G["false"]): ("SHIFT", 26), + (27, G["if"]): ("SHIFT", 12), (27, G["id"]): ("SHIFT", 28), + (27, G["string"]): ("SHIFT", 32), + (27, G["true"]): ("SHIFT", 25), + (27, G["int"]): ("SHIFT", 31), + (27, G["("]): ("SHIFT", 11), (27, G["new"]): ("SHIFT", 22), - (27, G["if"]): ("SHIFT", 12), + (27, G["~"]): ("SHIFT", 27), + (27, G["isvoid"]): ("SHIFT", 24), (28, G["("]): ("SHIFT", 29), + (28, G["."]): ("REDUCE", G["atom -> id"]), + (28, G["else"]): ("REDUCE", G["atom -> id"]), + (28, G["="]): ("REDUCE", G["atom -> id"]), + (28, G[","]): ("REDUCE", G["atom -> id"]), + (28, G["fi"]): ("REDUCE", G["atom -> id"]), + (28, G["error"]): ("REDUCE", G["atom -> id"]), + (28, G[";"]): ("REDUCE", G["atom -> id"]), + (28, G["loop"]): ("REDUCE", G["atom -> id"]), + (28, G["@"]): ("REDUCE", G["atom -> id"]), + (28, G["pool"]): ("REDUCE", G["atom -> id"]), + (28, G["+"]): ("REDUCE", G["atom -> id"]), (28, G["-"]): ("REDUCE", G["atom -> id"]), (28, G["in"]): ("REDUCE", G["atom -> id"]), (28, G["*"]): ("REDUCE", G["atom -> id"]), @@ -233,46 +244,46 @@ def __action_table(): (28, G["/"]): ("REDUCE", G["atom -> id"]), (28, G["of"]): ("REDUCE", G["atom -> id"]), (28, G["<"]): ("REDUCE", G["atom -> id"]), - (28, G[")"]): ("REDUCE", G["atom -> id"]), (28, G["<="]): ("REDUCE", G["atom -> id"]), + (28, G[")"]): ("REDUCE", G["atom -> id"]), (28, G["then"]): ("REDUCE", G["atom -> id"]), - (28, G["."]): ("REDUCE", G["atom -> id"]), - (28, G["="]): ("REDUCE", G["atom -> id"]), - (28, G["else"]): ("REDUCE", G["atom -> id"]), - (28, G[","]): ("REDUCE", G["atom -> id"]), - (28, G["+"]): ("REDUCE", G["atom -> id"]), - (28, G["fi"]): ("REDUCE", G["atom -> id"]), - (28, G[";"]): ("REDUCE", G["atom -> id"]), - (28, G["loop"]): ("REDUCE", G["atom -> id"]), - (28, G["@"]): ("REDUCE", G["atom -> id"]), - (28, G["pool"]): ("REDUCE", G["atom -> id"]), - (28, G["error"]): ("REDUCE", G["atom -> id"]), - (29, G["~"]): ("SHIFT", 27), - (29, G["if"]): ("SHIFT", 12), - (29, G["int"]): ("SHIFT", 31), + (29, G["string"]): ("SHIFT", 32), + (29, G["id"]): ("SHIFT", 46), (29, G["("]): ("SHIFT", 11), - (29, G["case"]): ("SHIFT", 21), - (29, G["id"]): ("SHIFT", 43), - (29, G[")"]): ("REDUCE", G["expr-list -> e"]), (29, G["new"]): ("SHIFT", 22), + (29, G[")"]): ("REDUCE", G["expr-list -> e"]), (29, G["{"]): ("SHIFT", 10), + (29, G["if"]): ("SHIFT", 12), + (29, G["int"]): ("SHIFT", 31), + (29, G["true"]): ("SHIFT", 25), (29, G["let"]): ("SHIFT", 14), + (29, G["~"]): ("SHIFT", 27), (29, G["isvoid"]): ("SHIFT", 24), (29, G["while"]): ("SHIFT", 13), - (29, G["true"]): ("SHIFT", 25), + (29, G["case"]): ("SHIFT", 21), (29, G["not"]): ("SHIFT", 30), - (29, G["string"]): ("SHIFT", 32), (29, G["false"]): ("SHIFT", 26), - (30, G["~"]): ("SHIFT", 27), - (30, G["("]): ("SHIFT", 11), - (30, G["true"]): ("SHIFT", 25), - (30, G["int"]): ("SHIFT", 31), - (30, G["isvoid"]): ("SHIFT", 24), - (30, G["string"]): ("SHIFT", 32), (30, G["false"]): ("SHIFT", 26), + (30, G["if"]): ("SHIFT", 12), (30, G["id"]): ("SHIFT", 28), + (30, G["string"]): ("SHIFT", 32), + (30, G["true"]): ("SHIFT", 25), + (30, G["int"]): ("SHIFT", 31), + (30, G["("]): ("SHIFT", 11), (30, G["new"]): ("SHIFT", 22), - (30, G["if"]): ("SHIFT", 12), + (30, G["~"]): ("SHIFT", 27), + (30, G["isvoid"]): ("SHIFT", 24), + (31, G["."]): ("REDUCE", G["atom -> int"]), + (31, G["else"]): ("REDUCE", G["atom -> int"]), + (31, G["="]): ("REDUCE", G["atom -> int"]), + (31, G[","]): ("REDUCE", G["atom -> int"]), + (31, G["fi"]): ("REDUCE", G["atom -> int"]), + (31, G["error"]): ("REDUCE", G["atom -> int"]), + (31, G[";"]): ("REDUCE", G["atom -> int"]), + (31, G["loop"]): ("REDUCE", G["atom -> int"]), + (31, G["@"]): ("REDUCE", G["atom -> int"]), + (31, G["pool"]): ("REDUCE", G["atom -> int"]), + (31, G["+"]): ("REDUCE", G["atom -> int"]), (31, G["-"]): ("REDUCE", G["atom -> int"]), (31, G["in"]): ("REDUCE", G["atom -> int"]), (31, G["*"]): ("REDUCE", G["atom -> int"]), @@ -280,20 +291,20 @@ def __action_table(): (31, G["/"]): ("REDUCE", G["atom -> int"]), (31, G["of"]): ("REDUCE", G["atom -> int"]), (31, G["<"]): ("REDUCE", G["atom -> int"]), - (31, G[")"]): ("REDUCE", G["atom -> int"]), (31, G["<="]): ("REDUCE", G["atom -> int"]), + (31, G[")"]): ("REDUCE", G["atom -> int"]), (31, G["then"]): ("REDUCE", G["atom -> int"]), - (31, G["."]): ("REDUCE", G["atom -> int"]), - (31, G["="]): ("REDUCE", G["atom -> int"]), - (31, G["else"]): ("REDUCE", G["atom -> int"]), - (31, G[","]): ("REDUCE", G["atom -> int"]), - (31, G["+"]): ("REDUCE", G["atom -> int"]), - (31, G["fi"]): ("REDUCE", G["atom -> int"]), - (31, G[";"]): ("REDUCE", G["atom -> int"]), - (31, G["loop"]): ("REDUCE", G["atom -> int"]), - (31, G["@"]): ("REDUCE", G["atom -> int"]), - (31, G["pool"]): ("REDUCE", G["atom -> int"]), - (31, G["error"]): ("REDUCE", G["atom -> int"]), + (32, G["."]): ("REDUCE", G["atom -> string"]), + (32, G["else"]): ("REDUCE", G["atom -> string"]), + (32, G["="]): ("REDUCE", G["atom -> string"]), + (32, G[","]): ("REDUCE", G["atom -> string"]), + (32, G["fi"]): ("REDUCE", G["atom -> string"]), + (32, G["error"]): ("REDUCE", G["atom -> string"]), + (32, G[";"]): ("REDUCE", G["atom -> string"]), + (32, G["loop"]): ("REDUCE", G["atom -> string"]), + (32, G["@"]): ("REDUCE", G["atom -> string"]), + (32, G["pool"]): ("REDUCE", G["atom -> string"]), + (32, G["+"]): ("REDUCE", G["atom -> string"]), (32, G["-"]): ("REDUCE", G["atom -> string"]), (32, G["in"]): ("REDUCE", G["atom -> string"]), (32, G["*"]): ("REDUCE", G["atom -> string"]), @@ -301,20 +312,20 @@ def __action_table(): (32, G["/"]): ("REDUCE", G["atom -> string"]), (32, G["of"]): ("REDUCE", G["atom -> string"]), (32, G["<"]): ("REDUCE", G["atom -> string"]), - (32, G[")"]): ("REDUCE", G["atom -> string"]), (32, G["<="]): ("REDUCE", G["atom -> string"]), + (32, G[")"]): ("REDUCE", G["atom -> string"]), (32, G["then"]): ("REDUCE", G["atom -> string"]), - (32, G["."]): ("REDUCE", G["atom -> string"]), - (32, G["="]): ("REDUCE", G["atom -> string"]), - (32, G["else"]): ("REDUCE", G["atom -> string"]), - (32, G[","]): ("REDUCE", G["atom -> string"]), - (32, G["+"]): ("REDUCE", G["atom -> string"]), - (32, G["fi"]): ("REDUCE", G["atom -> string"]), - (32, G[";"]): ("REDUCE", G["atom -> string"]), - (32, G["loop"]): ("REDUCE", G["atom -> string"]), - (32, G["@"]): ("REDUCE", G["atom -> string"]), - (32, G["pool"]): ("REDUCE", G["atom -> string"]), - (32, G["error"]): ("REDUCE", G["atom -> string"]), + (33, G["."]): ("REDUCE", G["atom -> function-call"]), + (33, G["else"]): ("REDUCE", G["atom -> function-call"]), + (33, G["="]): ("REDUCE", G["atom -> function-call"]), + (33, G[","]): ("REDUCE", G["atom -> function-call"]), + (33, G["fi"]): ("REDUCE", G["atom -> function-call"]), + (33, G["error"]): ("REDUCE", G["atom -> function-call"]), + (33, G[";"]): ("REDUCE", G["atom -> function-call"]), + (33, G["loop"]): ("REDUCE", G["atom -> function-call"]), + (33, G["@"]): ("REDUCE", G["atom -> function-call"]), + (33, G["pool"]): ("REDUCE", G["atom -> function-call"]), + (33, G["+"]): ("REDUCE", G["atom -> function-call"]), (33, G["-"]): ("REDUCE", G["atom -> function-call"]), (33, G["in"]): ("REDUCE", G["atom -> function-call"]), (33, G["*"]): ("REDUCE", G["atom -> function-call"]), @@ -322,1100 +333,1196 @@ def __action_table(): (33, G["/"]): ("REDUCE", G["atom -> function-call"]), (33, G["of"]): ("REDUCE", G["atom -> function-call"]), (33, G["<"]): ("REDUCE", G["atom -> function-call"]), - (33, G[")"]): ("REDUCE", G["atom -> function-call"]), (33, G["<="]): ("REDUCE", G["atom -> function-call"]), + (33, G[")"]): ("REDUCE", G["atom -> function-call"]), (33, G["then"]): ("REDUCE", G["atom -> function-call"]), - (33, G["."]): ("REDUCE", G["atom -> function-call"]), - (33, G["="]): ("REDUCE", G["atom -> function-call"]), - (33, G["else"]): ("REDUCE", G["atom -> function-call"]), - (33, G[","]): ("REDUCE", G["atom -> function-call"]), - (33, G["+"]): ("REDUCE", G["atom -> function-call"]), - (33, G["fi"]): ("REDUCE", G["atom -> function-call"]), - (33, G[";"]): ("REDUCE", G["atom -> function-call"]), - (33, G["loop"]): ("REDUCE", G["atom -> function-call"]), - (33, G["@"]): ("REDUCE", G["atom -> function-call"]), - (33, G["pool"]): ("REDUCE", G["atom -> function-call"]), - (33, G["error"]): ("REDUCE", G["atom -> function-call"]), - (34, G["+"]): ("SHIFT", 35), - (34, G["-"]): ("SHIFT", 51), - (34, G["else"]): ("REDUCE", G["negable -> not arith"]), - (34, G["then"]): ("REDUCE", G["negable -> not arith"]), - (34, G["in"]): ("REDUCE", G["negable -> not arith"]), - (34, G[","]): ("REDUCE", G["negable -> not arith"]), - (34, G["fi"]): ("REDUCE", G["negable -> not arith"]), - (34, G["}"]): ("REDUCE", G["negable -> not arith"]), - (34, G["of"]): ("REDUCE", G["negable -> not arith"]), - (34, G[";"]): ("REDUCE", G["negable -> not arith"]), - (34, G["<"]): ("REDUCE", G["negable -> not arith"]), - (34, G["loop"]): ("REDUCE", G["negable -> not arith"]), - (34, G[")"]): ("REDUCE", G["negable -> not arith"]), - (34, G["pool"]): ("REDUCE", G["negable -> not arith"]), - (34, G["error"]): ("REDUCE", G["negable -> not arith"]), - (34, G["<="]): ("REDUCE", G["negable -> not arith"]), - (34, G["="]): ("REDUCE", G["negable -> not arith"]), - (35, G["~"]): ("SHIFT", 27), - (35, G["("]): ("SHIFT", 11), - (35, G["true"]): ("SHIFT", 25), - (35, G["int"]): ("SHIFT", 31), - (35, G["isvoid"]): ("SHIFT", 24), - (35, G["string"]): ("SHIFT", 32), + (34, G["="]): ("SHIFT", 60), + (34, G["<"]): ("SHIFT", 35), + (34, G["else"]): ("REDUCE", G["negable -> not comp"]), + (34, G[","]): ("REDUCE", G["negable -> not comp"]), + (34, G["in"]): ("REDUCE", G["negable -> not comp"]), + (34, G["fi"]): ("REDUCE", G["negable -> not comp"]), + (34, G["}"]): ("REDUCE", G["negable -> not comp"]), + (34, G["error"]): ("REDUCE", G["negable -> not comp"]), + (34, G[";"]): ("REDUCE", G["negable -> not comp"]), + (34, G["of"]): ("REDUCE", G["negable -> not comp"]), + (34, G["loop"]): ("REDUCE", G["negable -> not comp"]), + (34, G["pool"]): ("REDUCE", G["negable -> not comp"]), + (34, G[")"]): ("REDUCE", G["negable -> not comp"]), + (34, G["then"]): ("REDUCE", G["negable -> not comp"]), + (34, G["<="]): ("SHIFT", 50), + (35, G["not"]): ("SHIFT", 36), (35, G["false"]): ("SHIFT", 26), + (35, G["if"]): ("SHIFT", 12), (35, G["id"]): ("SHIFT", 28), + (35, G["string"]): ("SHIFT", 32), + (35, G["true"]): ("SHIFT", 25), + (35, G["int"]): ("SHIFT", 31), + (35, G["("]): ("SHIFT", 11), (35, G["new"]): ("SHIFT", 22), - (35, G["if"]): ("SHIFT", 12), - (36, G["/"]): ("SHIFT", 53), - (36, G["-"]): ("REDUCE", G["arith -> arith + term"]), - (36, G["in"]): ("REDUCE", G["arith -> arith + term"]), - (36, G["error"]): ("REDUCE", G["arith -> arith + term"]), - (36, G["}"]): ("REDUCE", G["arith -> arith + term"]), - (36, G["of"]): ("REDUCE", G["arith -> arith + term"]), - (36, G["<"]): ("REDUCE", G["arith -> arith + term"]), - (36, G[")"]): ("REDUCE", G["arith -> arith + term"]), - (36, G["<="]): ("REDUCE", G["arith -> arith + term"]), - (36, G["then"]): ("REDUCE", G["arith -> arith + term"]), - (36, G["="]): ("REDUCE", G["arith -> arith + term"]), - (36, G["else"]): ("REDUCE", G["arith -> arith + term"]), - (36, G[","]): ("REDUCE", G["arith -> arith + term"]), - (36, G["fi"]): ("REDUCE", G["arith -> arith + term"]), - (36, G[";"]): ("REDUCE", G["arith -> arith + term"]), - (36, G["loop"]): ("REDUCE", G["arith -> arith + term"]), - (36, G["pool"]): ("REDUCE", G["arith -> arith + term"]), - (36, G["+"]): ("REDUCE", G["arith -> arith + term"]), - (36, G["*"]): ("SHIFT", 37), - (37, G["~"]): ("SHIFT", 27), - (37, G["("]): ("SHIFT", 11), - (37, G["true"]): ("SHIFT", 25), - (37, G["int"]): ("SHIFT", 31), - (37, G["isvoid"]): ("SHIFT", 24), - (37, G["string"]): ("SHIFT", 32), - (37, G["false"]): ("SHIFT", 26), - (37, G["id"]): ("SHIFT", 28), - (37, G["new"]): ("SHIFT", 22), - (37, G["if"]): ("SHIFT", 12), - (38, G["-"]): ("REDUCE", G["term -> term * factor"]), - (38, G["in"]): ("REDUCE", G["term -> term * factor"]), - (38, G["*"]): ("REDUCE", G["term -> term * factor"]), - (38, G["}"]): ("REDUCE", G["term -> term * factor"]), - (38, G["/"]): ("REDUCE", G["term -> term * factor"]), - (38, G["of"]): ("REDUCE", G["term -> term * factor"]), - (38, G["<"]): ("REDUCE", G["term -> term * factor"]), - (38, G[")"]): ("REDUCE", G["term -> term * factor"]), - (38, G["<="]): ("REDUCE", G["term -> term * factor"]), - (38, G["then"]): ("REDUCE", G["term -> term * factor"]), - (38, G["="]): ("REDUCE", G["term -> term * factor"]), - (38, G["else"]): ("REDUCE", G["term -> term * factor"]), - (38, G[","]): ("REDUCE", G["term -> term * factor"]), - (38, G["+"]): ("REDUCE", G["term -> term * factor"]), - (38, G["fi"]): ("REDUCE", G["term -> term * factor"]), - (38, G[";"]): ("REDUCE", G["term -> term * factor"]), - (38, G["loop"]): ("REDUCE", G["term -> term * factor"]), - (38, G["pool"]): ("REDUCE", G["term -> term * factor"]), - (38, G["error"]): ("REDUCE", G["term -> term * factor"]), - (39, G["."]): ("SHIFT", 40), - (39, G["@"]): ("SHIFT", 67), - (39, G["-"]): ("REDUCE", G["factor -> atom"]), - (39, G["in"]): ("REDUCE", G["factor -> atom"]), - (39, G["error"]): ("REDUCE", G["factor -> atom"]), - (39, G["*"]): ("REDUCE", G["factor -> atom"]), - (39, G["}"]): ("REDUCE", G["factor -> atom"]), - (39, G["/"]): ("REDUCE", G["factor -> atom"]), - (39, G["of"]): ("REDUCE", G["factor -> atom"]), - (39, G["<"]): ("REDUCE", G["factor -> atom"]), - (39, G[")"]): ("REDUCE", G["factor -> atom"]), - (39, G["<="]): ("REDUCE", G["factor -> atom"]), - (39, G["then"]): ("REDUCE", G["factor -> atom"]), - (39, G["="]): ("REDUCE", G["factor -> atom"]), - (39, G["else"]): ("REDUCE", G["factor -> atom"]), - (39, G[","]): ("REDUCE", G["factor -> atom"]), - (39, G["fi"]): ("REDUCE", G["factor -> atom"]), - (39, G[";"]): ("REDUCE", G["factor -> atom"]), - (39, G["loop"]): ("REDUCE", G["factor -> atom"]), - (39, G["pool"]): ("REDUCE", G["factor -> atom"]), - (39, G["+"]): ("REDUCE", G["factor -> atom"]), - (40, G["id"]): ("SHIFT", 41), - (41, G["("]): ("SHIFT", 42), - (42, G["~"]): ("SHIFT", 27), - (42, G["if"]): ("SHIFT", 12), - (42, G["int"]): ("SHIFT", 31), - (42, G["("]): ("SHIFT", 11), - (42, G["case"]): ("SHIFT", 21), - (42, G["id"]): ("SHIFT", 43), - (42, G[")"]): ("REDUCE", G["expr-list -> e"]), - (42, G["new"]): ("SHIFT", 22), - (42, G["{"]): ("SHIFT", 10), - (42, G["let"]): ("SHIFT", 14), - (42, G["isvoid"]): ("SHIFT", 24), - (42, G["while"]): ("SHIFT", 13), - (42, G["true"]): ("SHIFT", 25), - (42, G["not"]): ("SHIFT", 30), - (42, G["string"]): ("SHIFT", 32), - (42, G["false"]): ("SHIFT", 26), - (43, G["<-"]): ("SHIFT", 44), - (43, G["("]): ("SHIFT", 29), - (43, G["-"]): ("REDUCE", G["atom -> id"]), - (43, G["in"]): ("REDUCE", G["atom -> id"]), - (43, G["*"]): ("REDUCE", G["atom -> id"]), - (43, G["}"]): ("REDUCE", G["atom -> id"]), - (43, G["/"]): ("REDUCE", G["atom -> id"]), - (43, G["of"]): ("REDUCE", G["atom -> id"]), - (43, G["<"]): ("REDUCE", G["atom -> id"]), - (43, G[")"]): ("REDUCE", G["atom -> id"]), - (43, G["<="]): ("REDUCE", G["atom -> id"]), - (43, G["then"]): ("REDUCE", G["atom -> id"]), - (43, G["."]): ("REDUCE", G["atom -> id"]), - (43, G["="]): ("REDUCE", G["atom -> id"]), - (43, G["else"]): ("REDUCE", G["atom -> id"]), - (43, G[","]): ("REDUCE", G["atom -> id"]), - (43, G["+"]): ("REDUCE", G["atom -> id"]), - (43, G["fi"]): ("REDUCE", G["atom -> id"]), - (43, G[";"]): ("REDUCE", G["atom -> id"]), - (43, G["loop"]): ("REDUCE", G["atom -> id"]), - (43, G["@"]): ("REDUCE", G["atom -> id"]), - (43, G["pool"]): ("REDUCE", G["atom -> id"]), - (43, G["error"]): ("REDUCE", G["atom -> id"]), - (44, G["case"]): ("SHIFT", 21), - (44, G["~"]): ("SHIFT", 27), - (44, G["id"]): ("SHIFT", 43), - (44, G["("]): ("SHIFT", 11), - (44, G["int"]): ("SHIFT", 31), - (44, G["{"]): ("SHIFT", 10), - (44, G["let"]): ("SHIFT", 14), - (44, G["new"]): ("SHIFT", 22), - (44, G["while"]): ("SHIFT", 13), - (44, G["true"]): ("SHIFT", 25), - (44, G["isvoid"]): ("SHIFT", 24), - (44, G["string"]): ("SHIFT", 32), - (44, G["false"]): ("SHIFT", 26), - (44, G["not"]): ("SHIFT", 30), - (44, G["if"]): ("SHIFT", 12), - (45, G["else"]): ("REDUCE", G["expr -> id <- expr"]), - (45, G["then"]): ("REDUCE", G["expr -> id <- expr"]), - (45, G[","]): ("REDUCE", G["expr -> id <- expr"]), - (45, G["in"]): ("REDUCE", G["expr -> id <- expr"]), - (45, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), - (45, G["}"]): ("REDUCE", G["expr -> id <- expr"]), - (45, G[";"]): ("REDUCE", G["expr -> id <- expr"]), - (45, G["of"]): ("REDUCE", G["expr -> id <- expr"]), - (45, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), - (45, G[")"]): ("REDUCE", G["expr -> id <- expr"]), - (45, G["error"]): ("REDUCE", G["expr -> id <- expr"]), - (45, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), - (46, G["else"]): ("REDUCE", G["expr -> comp"]), - (46, G["then"]): ("REDUCE", G["expr -> comp"]), - (46, G[","]): ("REDUCE", G["expr -> comp"]), - (46, G["in"]): ("REDUCE", G["expr -> comp"]), - (46, G["fi"]): ("REDUCE", G["expr -> comp"]), - (46, G["}"]): ("REDUCE", G["expr -> comp"]), - (46, G[";"]): ("REDUCE", G["expr -> comp"]), - (46, G["of"]): ("REDUCE", G["expr -> comp"]), - (46, G["loop"]): ("REDUCE", G["expr -> comp"]), - (46, G[")"]): ("REDUCE", G["expr -> comp"]), - (46, G["error"]): ("REDUCE", G["expr -> comp"]), - (46, G["pool"]): ("REDUCE", G["expr -> comp"]), - (47, G["<"]): ("SHIFT", 48), - (47, G["="]): ("SHIFT", 59), - (47, G["else"]): ("REDUCE", G["comp -> negable"]), - (47, G["then"]): ("REDUCE", G["comp -> negable"]), - (47, G[","]): ("REDUCE", G["comp -> negable"]), - (47, G["in"]): ("REDUCE", G["comp -> negable"]), - (47, G["fi"]): ("REDUCE", G["comp -> negable"]), - (47, G["}"]): ("REDUCE", G["comp -> negable"]), - (47, G[";"]): ("REDUCE", G["comp -> negable"]), - (47, G["of"]): ("REDUCE", G["comp -> negable"]), - (47, G["loop"]): ("REDUCE", G["comp -> negable"]), - (47, G[")"]): ("REDUCE", G["comp -> negable"]), - (47, G["error"]): ("REDUCE", G["comp -> negable"]), - (47, G["pool"]): ("REDUCE", G["comp -> negable"]), - (47, G["<="]): ("SHIFT", 57), - (48, G["false"]): ("SHIFT", 26), - (48, G["isvoid"]): ("SHIFT", 24), - (48, G["new"]): ("SHIFT", 22), - (48, G["id"]): ("SHIFT", 28), - (48, G["not"]): ("SHIFT", 30), - (48, G["if"]): ("SHIFT", 12), - (48, G["true"]): ("SHIFT", 25), - (48, G["("]): ("SHIFT", 11), - (48, G["int"]): ("SHIFT", 31), - (48, G["~"]): ("SHIFT", 27), - (48, G["string"]): ("SHIFT", 32), - (49, G["else"]): ("REDUCE", G["comp -> negable < negable"]), - (49, G["then"]): ("REDUCE", G["comp -> negable < negable"]), - (49, G[","]): ("REDUCE", G["comp -> negable < negable"]), - (49, G["in"]): ("REDUCE", G["comp -> negable < negable"]), - (49, G["fi"]): ("REDUCE", G["comp -> negable < negable"]), - (49, G["}"]): ("REDUCE", G["comp -> negable < negable"]), - (49, G[";"]): ("REDUCE", G["comp -> negable < negable"]), - (49, G["of"]): ("REDUCE", G["comp -> negable < negable"]), - (49, G["loop"]): ("REDUCE", G["comp -> negable < negable"]), - (49, G[")"]): ("REDUCE", G["comp -> negable < negable"]), - (49, G["error"]): ("REDUCE", G["comp -> negable < negable"]), - (49, G["pool"]): ("REDUCE", G["comp -> negable < negable"]), - (50, G["-"]): ("SHIFT", 51), - (50, G["+"]): ("SHIFT", 35), - (50, G["else"]): ("REDUCE", G["negable -> arith"]), - (50, G["pool"]): ("REDUCE", G["negable -> arith"]), - (50, G["in"]): ("REDUCE", G["negable -> arith"]), - (50, G[","]): ("REDUCE", G["negable -> arith"]), - (50, G["fi"]): ("REDUCE", G["negable -> arith"]), - (50, G["error"]): ("REDUCE", G["negable -> arith"]), - (50, G["}"]): ("REDUCE", G["negable -> arith"]), - (50, G["of"]): ("REDUCE", G["negable -> arith"]), - (50, G[";"]): ("REDUCE", G["negable -> arith"]), - (50, G["<"]): ("REDUCE", G["negable -> arith"]), - (50, G["loop"]): ("REDUCE", G["negable -> arith"]), - (50, G[")"]): ("REDUCE", G["negable -> arith"]), - (50, G["then"]): ("REDUCE", G["negable -> arith"]), - (50, G["<="]): ("REDUCE", G["negable -> arith"]), - (50, G["="]): ("REDUCE", G["negable -> arith"]), - (51, G["~"]): ("SHIFT", 27), - (51, G["("]): ("SHIFT", 11), - (51, G["true"]): ("SHIFT", 25), - (51, G["int"]): ("SHIFT", 31), - (51, G["isvoid"]): ("SHIFT", 24), - (51, G["string"]): ("SHIFT", 32), + (35, G["~"]): ("SHIFT", 27), + (35, G["isvoid"]): ("SHIFT", 24), + (36, G["false"]): ("SHIFT", 26), + (36, G["if"]): ("SHIFT", 12), + (36, G["id"]): ("SHIFT", 28), + (36, G["string"]): ("SHIFT", 32), + (36, G["true"]): ("SHIFT", 25), + (36, G["int"]): ("SHIFT", 31), + (36, G["("]): ("SHIFT", 11), + (36, G["new"]): ("SHIFT", 22), + (36, G["~"]): ("SHIFT", 27), + (36, G["isvoid"]): ("SHIFT", 24), + (37, G["+"]): ("SHIFT", 38), + (37, G["-"]): ("SHIFT", 53), + (37, G["else"]): ("REDUCE", G["comp -> comp < not arith"]), + (37, G["="]): ("REDUCE", G["comp -> comp < not arith"]), + (37, G[","]): ("REDUCE", G["comp -> comp < not arith"]), + (37, G["in"]): ("REDUCE", G["comp -> comp < not arith"]), + (37, G["fi"]): ("REDUCE", G["comp -> comp < not arith"]), + (37, G["}"]): ("REDUCE", G["comp -> comp < not arith"]), + (37, G["error"]): ("REDUCE", G["comp -> comp < not arith"]), + (37, G[")"]): ("REDUCE", G["comp -> comp < not arith"]), + (37, G[";"]): ("REDUCE", G["comp -> comp < not arith"]), + (37, G["of"]): ("REDUCE", G["comp -> comp < not arith"]), + (37, G["<"]): ("REDUCE", G["comp -> comp < not arith"]), + (37, G["loop"]): ("REDUCE", G["comp -> comp < not arith"]), + (37, G["pool"]): ("REDUCE", G["comp -> comp < not arith"]), + (37, G["<="]): ("REDUCE", G["comp -> comp < not arith"]), + (37, G["then"]): ("REDUCE", G["comp -> comp < not arith"]), + (38, G["false"]): ("SHIFT", 26), + (38, G["if"]): ("SHIFT", 12), + (38, G["id"]): ("SHIFT", 28), + (38, G["string"]): ("SHIFT", 32), + (38, G["true"]): ("SHIFT", 25), + (38, G["int"]): ("SHIFT", 31), + (38, G["("]): ("SHIFT", 11), + (38, G["new"]): ("SHIFT", 22), + (38, G["~"]): ("SHIFT", 27), + (38, G["isvoid"]): ("SHIFT", 24), + (39, G["else"]): ("REDUCE", G["arith -> arith + term"]), + (39, G["="]): ("REDUCE", G["arith -> arith + term"]), + (39, G[","]): ("REDUCE", G["arith -> arith + term"]), + (39, G["fi"]): ("REDUCE", G["arith -> arith + term"]), + (39, G["error"]): ("REDUCE", G["arith -> arith + term"]), + (39, G[";"]): ("REDUCE", G["arith -> arith + term"]), + (39, G["loop"]): ("REDUCE", G["arith -> arith + term"]), + (39, G["pool"]): ("REDUCE", G["arith -> arith + term"]), + (39, G["+"]): ("REDUCE", G["arith -> arith + term"]), + (39, G["-"]): ("REDUCE", G["arith -> arith + term"]), + (39, G["in"]): ("REDUCE", G["arith -> arith + term"]), + (39, G["}"]): ("REDUCE", G["arith -> arith + term"]), + (39, G["of"]): ("REDUCE", G["arith -> arith + term"]), + (39, G["<"]): ("REDUCE", G["arith -> arith + term"]), + (39, G["<="]): ("REDUCE", G["arith -> arith + term"]), + (39, G[")"]): ("REDUCE", G["arith -> arith + term"]), + (39, G["then"]): ("REDUCE", G["arith -> arith + term"]), + (39, G["/"]): ("SHIFT", 55), + (39, G["*"]): ("SHIFT", 40), + (40, G["false"]): ("SHIFT", 26), + (40, G["if"]): ("SHIFT", 12), + (40, G["id"]): ("SHIFT", 28), + (40, G["string"]): ("SHIFT", 32), + (40, G["true"]): ("SHIFT", 25), + (40, G["int"]): ("SHIFT", 31), + (40, G["("]): ("SHIFT", 11), + (40, G["new"]): ("SHIFT", 22), + (40, G["~"]): ("SHIFT", 27), + (40, G["isvoid"]): ("SHIFT", 24), + (41, G["else"]): ("REDUCE", G["term -> term * factor"]), + (41, G["="]): ("REDUCE", G["term -> term * factor"]), + (41, G[","]): ("REDUCE", G["term -> term * factor"]), + (41, G["fi"]): ("REDUCE", G["term -> term * factor"]), + (41, G["error"]): ("REDUCE", G["term -> term * factor"]), + (41, G[";"]): ("REDUCE", G["term -> term * factor"]), + (41, G["loop"]): ("REDUCE", G["term -> term * factor"]), + (41, G["pool"]): ("REDUCE", G["term -> term * factor"]), + (41, G["+"]): ("REDUCE", G["term -> term * factor"]), + (41, G["-"]): ("REDUCE", G["term -> term * factor"]), + (41, G["in"]): ("REDUCE", G["term -> term * factor"]), + (41, G["*"]): ("REDUCE", G["term -> term * factor"]), + (41, G["}"]): ("REDUCE", G["term -> term * factor"]), + (41, G["/"]): ("REDUCE", G["term -> term * factor"]), + (41, G["of"]): ("REDUCE", G["term -> term * factor"]), + (41, G["<"]): ("REDUCE", G["term -> term * factor"]), + (41, G["<="]): ("REDUCE", G["term -> term * factor"]), + (41, G[")"]): ("REDUCE", G["term -> term * factor"]), + (41, G["then"]): ("REDUCE", G["term -> term * factor"]), + (42, G["else"]): ("REDUCE", G["factor -> atom"]), + (42, G["="]): ("REDUCE", G["factor -> atom"]), + (42, G[","]): ("REDUCE", G["factor -> atom"]), + (42, G["fi"]): ("REDUCE", G["factor -> atom"]), + (42, G["error"]): ("REDUCE", G["factor -> atom"]), + (42, G[";"]): ("REDUCE", G["factor -> atom"]), + (42, G["loop"]): ("REDUCE", G["factor -> atom"]), + (42, G["pool"]): ("REDUCE", G["factor -> atom"]), + (42, G["+"]): ("REDUCE", G["factor -> atom"]), + (42, G["-"]): ("REDUCE", G["factor -> atom"]), + (42, G["in"]): ("REDUCE", G["factor -> atom"]), + (42, G["*"]): ("REDUCE", G["factor -> atom"]), + (42, G["}"]): ("REDUCE", G["factor -> atom"]), + (42, G["/"]): ("REDUCE", G["factor -> atom"]), + (42, G["of"]): ("REDUCE", G["factor -> atom"]), + (42, G["<"]): ("REDUCE", G["factor -> atom"]), + (42, G["<="]): ("REDUCE", G["factor -> atom"]), + (42, G[")"]): ("REDUCE", G["factor -> atom"]), + (42, G["then"]): ("REDUCE", G["factor -> atom"]), + (42, G["@"]): ("SHIFT", 72), + (42, G["."]): ("SHIFT", 43), + (43, G["id"]): ("SHIFT", 44), + (44, G["("]): ("SHIFT", 45), + (45, G["string"]): ("SHIFT", 32), + (45, G["id"]): ("SHIFT", 46), + (45, G["("]): ("SHIFT", 11), + (45, G["new"]): ("SHIFT", 22), + (45, G[")"]): ("REDUCE", G["expr-list -> e"]), + (45, G["{"]): ("SHIFT", 10), + (45, G["if"]): ("SHIFT", 12), + (45, G["int"]): ("SHIFT", 31), + (45, G["true"]): ("SHIFT", 25), + (45, G["let"]): ("SHIFT", 14), + (45, G["~"]): ("SHIFT", 27), + (45, G["isvoid"]): ("SHIFT", 24), + (45, G["while"]): ("SHIFT", 13), + (45, G["case"]): ("SHIFT", 21), + (45, G["not"]): ("SHIFT", 30), + (45, G["false"]): ("SHIFT", 26), + (46, G["("]): ("SHIFT", 29), + (46, G["."]): ("REDUCE", G["atom -> id"]), + (46, G["else"]): ("REDUCE", G["atom -> id"]), + (46, G["="]): ("REDUCE", G["atom -> id"]), + (46, G[","]): ("REDUCE", G["atom -> id"]), + (46, G["fi"]): ("REDUCE", G["atom -> id"]), + (46, G["error"]): ("REDUCE", G["atom -> id"]), + (46, G[";"]): ("REDUCE", G["atom -> id"]), + (46, G["loop"]): ("REDUCE", G["atom -> id"]), + (46, G["@"]): ("REDUCE", G["atom -> id"]), + (46, G["pool"]): ("REDUCE", G["atom -> id"]), + (46, G["+"]): ("REDUCE", G["atom -> id"]), + (46, G["-"]): ("REDUCE", G["atom -> id"]), + (46, G["in"]): ("REDUCE", G["atom -> id"]), + (46, G["*"]): ("REDUCE", G["atom -> id"]), + (46, G["}"]): ("REDUCE", G["atom -> id"]), + (46, G["/"]): ("REDUCE", G["atom -> id"]), + (46, G["of"]): ("REDUCE", G["atom -> id"]), + (46, G["<"]): ("REDUCE", G["atom -> id"]), + (46, G["<="]): ("REDUCE", G["atom -> id"]), + (46, G[")"]): ("REDUCE", G["atom -> id"]), + (46, G["then"]): ("REDUCE", G["atom -> id"]), + (46, G["<-"]): ("SHIFT", 47), + (47, G["let"]): ("SHIFT", 14), + (47, G["false"]): ("SHIFT", 26), + (47, G["not"]): ("SHIFT", 30), + (47, G["id"]): ("SHIFT", 46), + (47, G["case"]): ("SHIFT", 21), + (47, G["string"]): ("SHIFT", 32), + (47, G["while"]): ("SHIFT", 13), + (47, G["("]): ("SHIFT", 11), + (47, G["new"]): ("SHIFT", 22), + (47, G["~"]): ("SHIFT", 27), + (47, G["isvoid"]): ("SHIFT", 24), + (47, G["if"]): ("SHIFT", 12), + (47, G["{"]): ("SHIFT", 10), + (47, G["true"]): ("SHIFT", 25), + (47, G["int"]): ("SHIFT", 31), + (48, G["else"]): ("REDUCE", G["expr -> id <- expr"]), + (48, G[","]): ("REDUCE", G["expr -> id <- expr"]), + (48, G["in"]): ("REDUCE", G["expr -> id <- expr"]), + (48, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), + (48, G["}"]): ("REDUCE", G["expr -> id <- expr"]), + (48, G["error"]): ("REDUCE", G["expr -> id <- expr"]), + (48, G[")"]): ("REDUCE", G["expr -> id <- expr"]), + (48, G[";"]): ("REDUCE", G["expr -> id <- expr"]), + (48, G["of"]): ("REDUCE", G["expr -> id <- expr"]), + (48, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), + (48, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), + (48, G["then"]): ("REDUCE", G["expr -> id <- expr"]), + (49, G["="]): ("SHIFT", 60), + (49, G["<"]): ("SHIFT", 35), + (49, G["else"]): ("REDUCE", G["negable -> comp"]), + (49, G[","]): ("REDUCE", G["negable -> comp"]), + (49, G["in"]): ("REDUCE", G["negable -> comp"]), + (49, G["fi"]): ("REDUCE", G["negable -> comp"]), + (49, G["}"]): ("REDUCE", G["negable -> comp"]), + (49, G["error"]): ("REDUCE", G["negable -> comp"]), + (49, G[")"]): ("REDUCE", G["negable -> comp"]), + (49, G[";"]): ("REDUCE", G["negable -> comp"]), + (49, G["of"]): ("REDUCE", G["negable -> comp"]), + (49, G["loop"]): ("REDUCE", G["negable -> comp"]), + (49, G["pool"]): ("REDUCE", G["negable -> comp"]), + (49, G["then"]): ("REDUCE", G["negable -> comp"]), + (49, G["<="]): ("SHIFT", 50), + (50, G["false"]): ("SHIFT", 26), + (50, G["if"]): ("SHIFT", 12), + (50, G["id"]): ("SHIFT", 28), + (50, G["string"]): ("SHIFT", 32), + (50, G["true"]): ("SHIFT", 25), + (50, G["int"]): ("SHIFT", 31), + (50, G["("]): ("SHIFT", 11), + (50, G["new"]): ("SHIFT", 22), + (50, G["not"]): ("SHIFT", 51), + (50, G["~"]): ("SHIFT", 27), + (50, G["isvoid"]): ("SHIFT", 24), (51, G["false"]): ("SHIFT", 26), + (51, G["if"]): ("SHIFT", 12), (51, G["id"]): ("SHIFT", 28), + (51, G["string"]): ("SHIFT", 32), + (51, G["true"]): ("SHIFT", 25), + (51, G["int"]): ("SHIFT", 31), + (51, G["("]): ("SHIFT", 11), (51, G["new"]): ("SHIFT", 22), - (51, G["if"]): ("SHIFT", 12), - (52, G["/"]): ("SHIFT", 53), - (52, G["*"]): ("SHIFT", 37), - (52, G["-"]): ("REDUCE", G["arith -> arith - term"]), - (52, G["in"]): ("REDUCE", G["arith -> arith - term"]), - (52, G["error"]): ("REDUCE", G["arith -> arith - term"]), - (52, G["}"]): ("REDUCE", G["arith -> arith - term"]), - (52, G["of"]): ("REDUCE", G["arith -> arith - term"]), - (52, G["<"]): ("REDUCE", G["arith -> arith - term"]), - (52, G[")"]): ("REDUCE", G["arith -> arith - term"]), - (52, G["<="]): ("REDUCE", G["arith -> arith - term"]), - (52, G["then"]): ("REDUCE", G["arith -> arith - term"]), - (52, G["="]): ("REDUCE", G["arith -> arith - term"]), - (52, G["else"]): ("REDUCE", G["arith -> arith - term"]), - (52, G[","]): ("REDUCE", G["arith -> arith - term"]), - (52, G["fi"]): ("REDUCE", G["arith -> arith - term"]), - (52, G[";"]): ("REDUCE", G["arith -> arith - term"]), - (52, G["loop"]): ("REDUCE", G["arith -> arith - term"]), - (52, G["pool"]): ("REDUCE", G["arith -> arith - term"]), - (52, G["+"]): ("REDUCE", G["arith -> arith - term"]), - (53, G["~"]): ("SHIFT", 27), - (53, G["("]): ("SHIFT", 11), - (53, G["true"]): ("SHIFT", 25), - (53, G["int"]): ("SHIFT", 31), - (53, G["isvoid"]): ("SHIFT", 24), - (53, G["string"]): ("SHIFT", 32), + (51, G["~"]): ("SHIFT", 27), + (51, G["isvoid"]): ("SHIFT", 24), + (52, G["+"]): ("SHIFT", 38), + (52, G["-"]): ("SHIFT", 53), + (52, G["else"]): ("REDUCE", G["comp -> comp <= not arith"]), + (52, G["="]): ("REDUCE", G["comp -> comp <= not arith"]), + (52, G[","]): ("REDUCE", G["comp -> comp <= not arith"]), + (52, G["in"]): ("REDUCE", G["comp -> comp <= not arith"]), + (52, G["fi"]): ("REDUCE", G["comp -> comp <= not arith"]), + (52, G["}"]): ("REDUCE", G["comp -> comp <= not arith"]), + (52, G["error"]): ("REDUCE", G["comp -> comp <= not arith"]), + (52, G[")"]): ("REDUCE", G["comp -> comp <= not arith"]), + (52, G[";"]): ("REDUCE", G["comp -> comp <= not arith"]), + (52, G["of"]): ("REDUCE", G["comp -> comp <= not arith"]), + (52, G["<"]): ("REDUCE", G["comp -> comp <= not arith"]), + (52, G["loop"]): ("REDUCE", G["comp -> comp <= not arith"]), + (52, G["pool"]): ("REDUCE", G["comp -> comp <= not arith"]), + (52, G["<="]): ("REDUCE", G["comp -> comp <= not arith"]), + (52, G["then"]): ("REDUCE", G["comp -> comp <= not arith"]), (53, G["false"]): ("SHIFT", 26), + (53, G["if"]): ("SHIFT", 12), (53, G["id"]): ("SHIFT", 28), + (53, G["string"]): ("SHIFT", 32), + (53, G["true"]): ("SHIFT", 25), + (53, G["int"]): ("SHIFT", 31), + (53, G["("]): ("SHIFT", 11), (53, G["new"]): ("SHIFT", 22), - (53, G["if"]): ("SHIFT", 12), - (54, G["-"]): ("REDUCE", G["term -> term / factor"]), - (54, G["in"]): ("REDUCE", G["term -> term / factor"]), - (54, G["*"]): ("REDUCE", G["term -> term / factor"]), - (54, G["}"]): ("REDUCE", G["term -> term / factor"]), - (54, G["/"]): ("REDUCE", G["term -> term / factor"]), - (54, G["of"]): ("REDUCE", G["term -> term / factor"]), - (54, G["<"]): ("REDUCE", G["term -> term / factor"]), - (54, G[")"]): ("REDUCE", G["term -> term / factor"]), - (54, G["<="]): ("REDUCE", G["term -> term / factor"]), - (54, G["then"]): ("REDUCE", G["term -> term / factor"]), - (54, G["="]): ("REDUCE", G["term -> term / factor"]), - (54, G["else"]): ("REDUCE", G["term -> term / factor"]), - (54, G[","]): ("REDUCE", G["term -> term / factor"]), - (54, G["+"]): ("REDUCE", G["term -> term / factor"]), - (54, G["fi"]): ("REDUCE", G["term -> term / factor"]), - (54, G[";"]): ("REDUCE", G["term -> term / factor"]), - (54, G["loop"]): ("REDUCE", G["term -> term / factor"]), - (54, G["pool"]): ("REDUCE", G["term -> term / factor"]), - (54, G["error"]): ("REDUCE", G["term -> term / factor"]), - (55, G["-"]): ("REDUCE", G["term -> factor"]), - (55, G["in"]): ("REDUCE", G["term -> factor"]), - (55, G["error"]): ("REDUCE", G["term -> factor"]), - (55, G["*"]): ("REDUCE", G["term -> factor"]), - (55, G["}"]): ("REDUCE", G["term -> factor"]), - (55, G["/"]): ("REDUCE", G["term -> factor"]), - (55, G["of"]): ("REDUCE", G["term -> factor"]), - (55, G["<"]): ("REDUCE", G["term -> factor"]), - (55, G[")"]): ("REDUCE", G["term -> factor"]), - (55, G["<="]): ("REDUCE", G["term -> factor"]), - (55, G["then"]): ("REDUCE", G["term -> factor"]), - (55, G["="]): ("REDUCE", G["term -> factor"]), - (55, G["else"]): ("REDUCE", G["term -> factor"]), - (55, G[","]): ("REDUCE", G["term -> factor"]), - (55, G["fi"]): ("REDUCE", G["term -> factor"]), - (55, G[";"]): ("REDUCE", G["term -> factor"]), - (55, G["loop"]): ("REDUCE", G["term -> factor"]), - (55, G["pool"]): ("REDUCE", G["term -> factor"]), - (55, G["+"]): ("REDUCE", G["term -> factor"]), - (56, G["/"]): ("SHIFT", 53), - (56, G["*"]): ("SHIFT", 37), - (56, G["-"]): ("REDUCE", G["arith -> term"]), - (56, G["in"]): ("REDUCE", G["arith -> term"]), - (56, G["error"]): ("REDUCE", G["arith -> term"]), - (56, G["}"]): ("REDUCE", G["arith -> term"]), - (56, G["of"]): ("REDUCE", G["arith -> term"]), - (56, G["<"]): ("REDUCE", G["arith -> term"]), - (56, G[")"]): ("REDUCE", G["arith -> term"]), - (56, G["<="]): ("REDUCE", G["arith -> term"]), - (56, G["then"]): ("REDUCE", G["arith -> term"]), - (56, G["="]): ("REDUCE", G["arith -> term"]), - (56, G["else"]): ("REDUCE", G["arith -> term"]), - (56, G[","]): ("REDUCE", G["arith -> term"]), - (56, G["fi"]): ("REDUCE", G["arith -> term"]), - (56, G[";"]): ("REDUCE", G["arith -> term"]), - (56, G["loop"]): ("REDUCE", G["arith -> term"]), - (56, G["pool"]): ("REDUCE", G["arith -> term"]), - (56, G["+"]): ("REDUCE", G["arith -> term"]), - (57, G["false"]): ("SHIFT", 26), - (57, G["isvoid"]): ("SHIFT", 24), - (57, G["new"]): ("SHIFT", 22), - (57, G["id"]): ("SHIFT", 28), - (57, G["not"]): ("SHIFT", 30), - (57, G["if"]): ("SHIFT", 12), - (57, G["true"]): ("SHIFT", 25), - (57, G["("]): ("SHIFT", 11), - (57, G["int"]): ("SHIFT", 31), - (57, G["~"]): ("SHIFT", 27), - (57, G["string"]): ("SHIFT", 32), - (58, G["else"]): ("REDUCE", G["comp -> negable <= negable"]), - (58, G["then"]): ("REDUCE", G["comp -> negable <= negable"]), - (58, G[","]): ("REDUCE", G["comp -> negable <= negable"]), - (58, G["in"]): ("REDUCE", G["comp -> negable <= negable"]), - (58, G["fi"]): ("REDUCE", G["comp -> negable <= negable"]), - (58, G["}"]): ("REDUCE", G["comp -> negable <= negable"]), - (58, G[";"]): ("REDUCE", G["comp -> negable <= negable"]), - (58, G["of"]): ("REDUCE", G["comp -> negable <= negable"]), - (58, G["loop"]): ("REDUCE", G["comp -> negable <= negable"]), - (58, G[")"]): ("REDUCE", G["comp -> negable <= negable"]), - (58, G["error"]): ("REDUCE", G["comp -> negable <= negable"]), - (58, G["pool"]): ("REDUCE", G["comp -> negable <= negable"]), - (59, G["false"]): ("SHIFT", 26), - (59, G["isvoid"]): ("SHIFT", 24), - (59, G["new"]): ("SHIFT", 22), - (59, G["id"]): ("SHIFT", 28), - (59, G["not"]): ("SHIFT", 30), - (59, G["if"]): ("SHIFT", 12), - (59, G["true"]): ("SHIFT", 25), - (59, G["("]): ("SHIFT", 11), - (59, G["int"]): ("SHIFT", 31), - (59, G["~"]): ("SHIFT", 27), - (59, G["string"]): ("SHIFT", 32), - (60, G["else"]): ("REDUCE", G["comp -> negable = negable"]), - (60, G["then"]): ("REDUCE", G["comp -> negable = negable"]), - (60, G[","]): ("REDUCE", G["comp -> negable = negable"]), - (60, G["in"]): ("REDUCE", G["comp -> negable = negable"]), - (60, G["fi"]): ("REDUCE", G["comp -> negable = negable"]), - (60, G["}"]): ("REDUCE", G["comp -> negable = negable"]), - (60, G[";"]): ("REDUCE", G["comp -> negable = negable"]), - (60, G["of"]): ("REDUCE", G["comp -> negable = negable"]), - (60, G["loop"]): ("REDUCE", G["comp -> negable = negable"]), - (60, G[")"]): ("REDUCE", G["comp -> negable = negable"]), - (60, G["error"]): ("REDUCE", G["comp -> negable = negable"]), - (60, G["pool"]): ("REDUCE", G["comp -> negable = negable"]), - (61, G[")"]): ("SHIFT", 62), - (62, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (62, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (62, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (62, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (62, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (62, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (62, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (62, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (62, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (62, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (62, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (62, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (62, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (62, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (62, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (62, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (62, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (62, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (62, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (62, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (62, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (63, G[")"]): ("REDUCE", G["expr-list -> not-empty-expr-list"]), - (64, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), - (64, G[","]): ("SHIFT", 65), - (65, G["~"]): ("SHIFT", 27), - (65, G["if"]): ("SHIFT", 12), - (65, G["int"]): ("SHIFT", 31), - (65, G["("]): ("SHIFT", 11), - (65, G["case"]): ("SHIFT", 21), - (65, G["id"]): ("SHIFT", 43), - (65, G["new"]): ("SHIFT", 22), - (65, G["{"]): ("SHIFT", 10), - (65, G["let"]): ("SHIFT", 14), - (65, G["isvoid"]): ("SHIFT", 24), - (65, G["while"]): ("SHIFT", 13), - (65, G["true"]): ("SHIFT", 25), - (65, G["not"]): ("SHIFT", 30), - (65, G["string"]): ("SHIFT", 32), - (65, G["false"]): ("SHIFT", 26), - (66, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr , not-empty-expr-list"]), - (67, G["type"]): ("SHIFT", 68), - (68, G["."]): ("SHIFT", 69), - (69, G["id"]): ("SHIFT", 70), - (70, G["("]): ("SHIFT", 71), - (71, G["~"]): ("SHIFT", 27), - (71, G["if"]): ("SHIFT", 12), - (71, G["int"]): ("SHIFT", 31), - (71, G["("]): ("SHIFT", 11), - (71, G["case"]): ("SHIFT", 21), - (71, G["id"]): ("SHIFT", 43), - (71, G[")"]): ("REDUCE", G["expr-list -> e"]), - (71, G["new"]): ("SHIFT", 22), - (71, G["{"]): ("SHIFT", 10), - (71, G["let"]): ("SHIFT", 14), - (71, G["isvoid"]): ("SHIFT", 24), - (71, G["while"]): ("SHIFT", 13), - (71, G["true"]): ("SHIFT", 25), - (71, G["not"]): ("SHIFT", 30), - (71, G["string"]): ("SHIFT", 32), - (71, G["false"]): ("SHIFT", 26), - (72, G[")"]): ("SHIFT", 73), - (73, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (73, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (73, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (73, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (73, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (73, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (73, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (73, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (73, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (73, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (73, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (73, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (73, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (73, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (73, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (73, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (73, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (73, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (73, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (73, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (73, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (74, G[")"]): ("SHIFT", 75), - (75, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (75, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (76, G["-"]): ("REDUCE", G["factor -> ~ factor"]), - (76, G["in"]): ("REDUCE", G["factor -> ~ factor"]), - (76, G["*"]): ("REDUCE", G["factor -> ~ factor"]), - (76, G["}"]): ("REDUCE", G["factor -> ~ factor"]), - (76, G["/"]): ("REDUCE", G["factor -> ~ factor"]), - (76, G["of"]): ("REDUCE", G["factor -> ~ factor"]), - (76, G["<"]): ("REDUCE", G["factor -> ~ factor"]), - (76, G[")"]): ("REDUCE", G["factor -> ~ factor"]), - (76, G["<="]): ("REDUCE", G["factor -> ~ factor"]), - (76, G["then"]): ("REDUCE", G["factor -> ~ factor"]), - (76, G["="]): ("REDUCE", G["factor -> ~ factor"]), - (76, G["else"]): ("REDUCE", G["factor -> ~ factor"]), - (76, G[","]): ("REDUCE", G["factor -> ~ factor"]), - (76, G["+"]): ("REDUCE", G["factor -> ~ factor"]), - (76, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), - (76, G[";"]): ("REDUCE", G["factor -> ~ factor"]), - (76, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), - (76, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), - (76, G["error"]): ("REDUCE", G["factor -> ~ factor"]), - (77, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), - (77, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), - (77, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), - (77, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), - (77, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), - (77, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), - (77, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), - (77, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), - (77, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), - (77, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), - (77, G["="]): ("REDUCE", G["factor -> isvoid factor"]), - (77, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), - (77, G[","]): ("REDUCE", G["factor -> isvoid factor"]), - (77, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), - (77, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), - (77, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), - (77, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), - (77, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), - (77, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), - (78, G["of"]): ("SHIFT", 79), - (79, G["id"]): ("SHIFT", 80), - (80, G[":"]): ("SHIFT", 81), - (81, G["type"]): ("SHIFT", 82), - (82, G["=>"]): ("SHIFT", 83), - (83, G["id"]): ("SHIFT", 43), - (83, G["if"]): ("SHIFT", 12), - (83, G["int"]): ("SHIFT", 31), - (83, G["("]): ("SHIFT", 11), - (83, G["{"]): ("SHIFT", 10), - (83, G["let"]): ("SHIFT", 14), - (83, G["while"]): ("SHIFT", 13), - (83, G["isvoid"]): ("SHIFT", 24), - (83, G["not"]): ("SHIFT", 30), - (83, G["new"]): ("SHIFT", 22), - (83, G["true"]): ("SHIFT", 25), - (83, G["~"]): ("SHIFT", 27), - (83, G["string"]): ("SHIFT", 32), - (83, G["false"]): ("SHIFT", 26), - (83, G["case"]): ("SHIFT", 21), - (84, G[";"]): ("SHIFT", 85), - (84, G["error"]): ("SHIFT", 87), - (85, G["id"]): ("SHIFT", 80), - (85, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), - (86, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), - (87, G["id"]): ("SHIFT", 80), - (87, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), - (88, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error case-list"]), - (89, G["esac"]): ("SHIFT", 90), - (90, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (90, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (91, G[","]): ("SHIFT", 92), - (91, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), - (92, G["id"]): ("SHIFT", 15), - (93, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), - (94, G["in"]): ("SHIFT", 95), - (95, G["case"]): ("SHIFT", 21), - (95, G["~"]): ("SHIFT", 27), - (95, G["id"]): ("SHIFT", 43), - (95, G["("]): ("SHIFT", 11), - (95, G["int"]): ("SHIFT", 31), - (95, G["{"]): ("SHIFT", 10), - (95, G["let"]): ("SHIFT", 14), - (95, G["new"]): ("SHIFT", 22), - (95, G["while"]): ("SHIFT", 13), - (95, G["true"]): ("SHIFT", 25), - (95, G["isvoid"]): ("SHIFT", 24), - (95, G["string"]): ("SHIFT", 32), - (95, G["false"]): ("SHIFT", 26), - (95, G["not"]): ("SHIFT", 30), - (95, G["if"]): ("SHIFT", 12), - (96, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (96, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (96, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (96, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (96, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (96, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (96, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (96, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (96, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (96, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (96, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (96, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (97, G["loop"]): ("SHIFT", 98), - (98, G["~"]): ("SHIFT", 27), - (98, G["if"]): ("SHIFT", 12), - (98, G["not"]): ("SHIFT", 30), - (98, G["("]): ("SHIFT", 11), - (98, G["int"]): ("SHIFT", 31), - (98, G["case"]): ("SHIFT", 21), - (98, G["id"]): ("SHIFT", 43), - (98, G["new"]): ("SHIFT", 22), - (98, G["isvoid"]): ("SHIFT", 24), - (98, G["true"]): ("SHIFT", 25), - (98, G["{"]): ("SHIFT", 10), - (98, G["let"]): ("SHIFT", 14), - (98, G["while"]): ("SHIFT", 13), - (98, G["string"]): ("SHIFT", 32), - (98, G["false"]): ("SHIFT", 26), - (99, G["pool"]): ("SHIFT", 100), - (100, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (100, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (100, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (100, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (100, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (100, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (100, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (100, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (100, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (100, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (100, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (100, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (101, G["then"]): ("SHIFT", 102), - (102, G["("]): ("SHIFT", 11), - (102, G["int"]): ("SHIFT", 31), - (102, G["while"]): ("SHIFT", 13), - (102, G["not"]): ("SHIFT", 30), - (102, G["new"]): ("SHIFT", 22), - (102, G["~"]): ("SHIFT", 27), - (102, G["id"]): ("SHIFT", 43), - (102, G["true"]): ("SHIFT", 25), - (102, G["case"]): ("SHIFT", 21), - (102, G["string"]): ("SHIFT", 32), - (102, G["false"]): ("SHIFT", 26), - (102, G["if"]): ("SHIFT", 12), - (102, G["{"]): ("SHIFT", 10), - (102, G["isvoid"]): ("SHIFT", 24), - (102, G["let"]): ("SHIFT", 14), - (103, G["else"]): ("SHIFT", 104), - (104, G["false"]): ("SHIFT", 26), + (53, G["~"]): ("SHIFT", 27), + (53, G["isvoid"]): ("SHIFT", 24), + (54, G["else"]): ("REDUCE", G["arith -> arith - term"]), + (54, G["="]): ("REDUCE", G["arith -> arith - term"]), + (54, G[","]): ("REDUCE", G["arith -> arith - term"]), + (54, G["fi"]): ("REDUCE", G["arith -> arith - term"]), + (54, G["error"]): ("REDUCE", G["arith -> arith - term"]), + (54, G[";"]): ("REDUCE", G["arith -> arith - term"]), + (54, G["loop"]): ("REDUCE", G["arith -> arith - term"]), + (54, G["pool"]): ("REDUCE", G["arith -> arith - term"]), + (54, G["+"]): ("REDUCE", G["arith -> arith - term"]), + (54, G["-"]): ("REDUCE", G["arith -> arith - term"]), + (54, G["in"]): ("REDUCE", G["arith -> arith - term"]), + (54, G["}"]): ("REDUCE", G["arith -> arith - term"]), + (54, G["of"]): ("REDUCE", G["arith -> arith - term"]), + (54, G["<"]): ("REDUCE", G["arith -> arith - term"]), + (54, G["<="]): ("REDUCE", G["arith -> arith - term"]), + (54, G[")"]): ("REDUCE", G["arith -> arith - term"]), + (54, G["then"]): ("REDUCE", G["arith -> arith - term"]), + (54, G["/"]): ("SHIFT", 55), + (54, G["*"]): ("SHIFT", 40), + (55, G["false"]): ("SHIFT", 26), + (55, G["if"]): ("SHIFT", 12), + (55, G["id"]): ("SHIFT", 28), + (55, G["string"]): ("SHIFT", 32), + (55, G["true"]): ("SHIFT", 25), + (55, G["int"]): ("SHIFT", 31), + (55, G["("]): ("SHIFT", 11), + (55, G["new"]): ("SHIFT", 22), + (55, G["~"]): ("SHIFT", 27), + (55, G["isvoid"]): ("SHIFT", 24), + (56, G["else"]): ("REDUCE", G["term -> term / factor"]), + (56, G["="]): ("REDUCE", G["term -> term / factor"]), + (56, G[","]): ("REDUCE", G["term -> term / factor"]), + (56, G["fi"]): ("REDUCE", G["term -> term / factor"]), + (56, G["error"]): ("REDUCE", G["term -> term / factor"]), + (56, G[";"]): ("REDUCE", G["term -> term / factor"]), + (56, G["loop"]): ("REDUCE", G["term -> term / factor"]), + (56, G["pool"]): ("REDUCE", G["term -> term / factor"]), + (56, G["+"]): ("REDUCE", G["term -> term / factor"]), + (56, G["-"]): ("REDUCE", G["term -> term / factor"]), + (56, G["in"]): ("REDUCE", G["term -> term / factor"]), + (56, G["*"]): ("REDUCE", G["term -> term / factor"]), + (56, G["}"]): ("REDUCE", G["term -> term / factor"]), + (56, G["/"]): ("REDUCE", G["term -> term / factor"]), + (56, G["of"]): ("REDUCE", G["term -> term / factor"]), + (56, G["<"]): ("REDUCE", G["term -> term / factor"]), + (56, G["<="]): ("REDUCE", G["term -> term / factor"]), + (56, G[")"]): ("REDUCE", G["term -> term / factor"]), + (56, G["then"]): ("REDUCE", G["term -> term / factor"]), + (57, G["else"]): ("REDUCE", G["term -> factor"]), + (57, G["="]): ("REDUCE", G["term -> factor"]), + (57, G[","]): ("REDUCE", G["term -> factor"]), + (57, G["fi"]): ("REDUCE", G["term -> factor"]), + (57, G["error"]): ("REDUCE", G["term -> factor"]), + (57, G[";"]): ("REDUCE", G["term -> factor"]), + (57, G["loop"]): ("REDUCE", G["term -> factor"]), + (57, G["pool"]): ("REDUCE", G["term -> factor"]), + (57, G["+"]): ("REDUCE", G["term -> factor"]), + (57, G["-"]): ("REDUCE", G["term -> factor"]), + (57, G["in"]): ("REDUCE", G["term -> factor"]), + (57, G["*"]): ("REDUCE", G["term -> factor"]), + (57, G["}"]): ("REDUCE", G["term -> factor"]), + (57, G["/"]): ("REDUCE", G["term -> factor"]), + (57, G["of"]): ("REDUCE", G["term -> factor"]), + (57, G["<"]): ("REDUCE", G["term -> factor"]), + (57, G["<="]): ("REDUCE", G["term -> factor"]), + (57, G[")"]): ("REDUCE", G["term -> factor"]), + (57, G["then"]): ("REDUCE", G["term -> factor"]), + (58, G["else"]): ("REDUCE", G["arith -> term"]), + (58, G["="]): ("REDUCE", G["arith -> term"]), + (58, G[","]): ("REDUCE", G["arith -> term"]), + (58, G["fi"]): ("REDUCE", G["arith -> term"]), + (58, G["error"]): ("REDUCE", G["arith -> term"]), + (58, G[";"]): ("REDUCE", G["arith -> term"]), + (58, G["loop"]): ("REDUCE", G["arith -> term"]), + (58, G["pool"]): ("REDUCE", G["arith -> term"]), + (58, G["+"]): ("REDUCE", G["arith -> term"]), + (58, G["-"]): ("REDUCE", G["arith -> term"]), + (58, G["in"]): ("REDUCE", G["arith -> term"]), + (58, G["}"]): ("REDUCE", G["arith -> term"]), + (58, G["of"]): ("REDUCE", G["arith -> term"]), + (58, G["<"]): ("REDUCE", G["arith -> term"]), + (58, G["<="]): ("REDUCE", G["arith -> term"]), + (58, G[")"]): ("REDUCE", G["arith -> term"]), + (58, G["then"]): ("REDUCE", G["arith -> term"]), + (58, G["/"]): ("SHIFT", 55), + (58, G["*"]): ("SHIFT", 40), + (59, G["+"]): ("SHIFT", 38), + (59, G["-"]): ("SHIFT", 53), + (59, G["else"]): ("REDUCE", G["comp -> comp <= arith"]), + (59, G["="]): ("REDUCE", G["comp -> comp <= arith"]), + (59, G[","]): ("REDUCE", G["comp -> comp <= arith"]), + (59, G["in"]): ("REDUCE", G["comp -> comp <= arith"]), + (59, G["fi"]): ("REDUCE", G["comp -> comp <= arith"]), + (59, G["}"]): ("REDUCE", G["comp -> comp <= arith"]), + (59, G["<="]): ("REDUCE", G["comp -> comp <= arith"]), + (59, G["error"]): ("REDUCE", G["comp -> comp <= arith"]), + (59, G[";"]): ("REDUCE", G["comp -> comp <= arith"]), + (59, G["of"]): ("REDUCE", G["comp -> comp <= arith"]), + (59, G["<"]): ("REDUCE", G["comp -> comp <= arith"]), + (59, G["loop"]): ("REDUCE", G["comp -> comp <= arith"]), + (59, G["pool"]): ("REDUCE", G["comp -> comp <= arith"]), + (59, G[")"]): ("REDUCE", G["comp -> comp <= arith"]), + (59, G["then"]): ("REDUCE", G["comp -> comp <= arith"]), + (60, G["false"]): ("SHIFT", 26), + (60, G["if"]): ("SHIFT", 12), + (60, G["id"]): ("SHIFT", 28), + (60, G["string"]): ("SHIFT", 32), + (60, G["true"]): ("SHIFT", 25), + (60, G["int"]): ("SHIFT", 31), + (60, G["not"]): ("SHIFT", 61), + (60, G["("]): ("SHIFT", 11), + (60, G["new"]): ("SHIFT", 22), + (60, G["~"]): ("SHIFT", 27), + (60, G["isvoid"]): ("SHIFT", 24), + (61, G["false"]): ("SHIFT", 26), + (61, G["if"]): ("SHIFT", 12), + (61, G["id"]): ("SHIFT", 28), + (61, G["string"]): ("SHIFT", 32), + (61, G["true"]): ("SHIFT", 25), + (61, G["int"]): ("SHIFT", 31), + (61, G["("]): ("SHIFT", 11), + (61, G["new"]): ("SHIFT", 22), + (61, G["~"]): ("SHIFT", 27), + (61, G["isvoid"]): ("SHIFT", 24), + (62, G["+"]): ("SHIFT", 38), + (62, G["-"]): ("SHIFT", 53), + (62, G["else"]): ("REDUCE", G["comp -> comp = not arith"]), + (62, G["="]): ("REDUCE", G["comp -> comp = not arith"]), + (62, G[","]): ("REDUCE", G["comp -> comp = not arith"]), + (62, G["in"]): ("REDUCE", G["comp -> comp = not arith"]), + (62, G["fi"]): ("REDUCE", G["comp -> comp = not arith"]), + (62, G["}"]): ("REDUCE", G["comp -> comp = not arith"]), + (62, G["error"]): ("REDUCE", G["comp -> comp = not arith"]), + (62, G[")"]): ("REDUCE", G["comp -> comp = not arith"]), + (62, G[";"]): ("REDUCE", G["comp -> comp = not arith"]), + (62, G["of"]): ("REDUCE", G["comp -> comp = not arith"]), + (62, G["<"]): ("REDUCE", G["comp -> comp = not arith"]), + (62, G["loop"]): ("REDUCE", G["comp -> comp = not arith"]), + (62, G["pool"]): ("REDUCE", G["comp -> comp = not arith"]), + (62, G["<="]): ("REDUCE", G["comp -> comp = not arith"]), + (62, G["then"]): ("REDUCE", G["comp -> comp = not arith"]), + (63, G["+"]): ("SHIFT", 38), + (63, G["-"]): ("SHIFT", 53), + (63, G["else"]): ("REDUCE", G["comp -> comp = arith"]), + (63, G["="]): ("REDUCE", G["comp -> comp = arith"]), + (63, G[","]): ("REDUCE", G["comp -> comp = arith"]), + (63, G["in"]): ("REDUCE", G["comp -> comp = arith"]), + (63, G["fi"]): ("REDUCE", G["comp -> comp = arith"]), + (63, G["}"]): ("REDUCE", G["comp -> comp = arith"]), + (63, G["<="]): ("REDUCE", G["comp -> comp = arith"]), + (63, G["error"]): ("REDUCE", G["comp -> comp = arith"]), + (63, G[";"]): ("REDUCE", G["comp -> comp = arith"]), + (63, G["of"]): ("REDUCE", G["comp -> comp = arith"]), + (63, G["<"]): ("REDUCE", G["comp -> comp = arith"]), + (63, G["loop"]): ("REDUCE", G["comp -> comp = arith"]), + (63, G["pool"]): ("REDUCE", G["comp -> comp = arith"]), + (63, G[")"]): ("REDUCE", G["comp -> comp = arith"]), + (63, G["then"]): ("REDUCE", G["comp -> comp = arith"]), + (64, G["else"]): ("REDUCE", G["expr -> negable"]), + (64, G[","]): ("REDUCE", G["expr -> negable"]), + (64, G["in"]): ("REDUCE", G["expr -> negable"]), + (64, G["fi"]): ("REDUCE", G["expr -> negable"]), + (64, G["}"]): ("REDUCE", G["expr -> negable"]), + (64, G["error"]): ("REDUCE", G["expr -> negable"]), + (64, G[")"]): ("REDUCE", G["expr -> negable"]), + (64, G[";"]): ("REDUCE", G["expr -> negable"]), + (64, G["of"]): ("REDUCE", G["expr -> negable"]), + (64, G["loop"]): ("REDUCE", G["expr -> negable"]), + (64, G["pool"]): ("REDUCE", G["expr -> negable"]), + (64, G["then"]): ("REDUCE", G["expr -> negable"]), + (65, G["+"]): ("SHIFT", 38), + (65, G["-"]): ("SHIFT", 53), + (65, G["else"]): ("REDUCE", G["comp -> arith"]), + (65, G["="]): ("REDUCE", G["comp -> arith"]), + (65, G[","]): ("REDUCE", G["comp -> arith"]), + (65, G["in"]): ("REDUCE", G["comp -> arith"]), + (65, G["fi"]): ("REDUCE", G["comp -> arith"]), + (65, G["}"]): ("REDUCE", G["comp -> arith"]), + (65, G["error"]): ("REDUCE", G["comp -> arith"]), + (65, G[")"]): ("REDUCE", G["comp -> arith"]), + (65, G[";"]): ("REDUCE", G["comp -> arith"]), + (65, G["of"]): ("REDUCE", G["comp -> arith"]), + (65, G["loop"]): ("REDUCE", G["comp -> arith"]), + (65, G["<="]): ("REDUCE", G["comp -> arith"]), + (65, G["<"]): ("REDUCE", G["comp -> arith"]), + (65, G["pool"]): ("REDUCE", G["comp -> arith"]), + (65, G["then"]): ("REDUCE", G["comp -> arith"]), + (66, G[")"]): ("SHIFT", 67), + (67, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (67, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (67, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (67, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (67, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (67, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (67, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (67, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (67, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (67, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (67, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (67, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (67, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (67, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (67, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (67, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (67, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (67, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (67, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (67, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (67, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (68, G[")"]): ("REDUCE", G["expr-list -> not-empty-expr-list"]), + (69, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), + (69, G[","]): ("SHIFT", 70), + (70, G["string"]): ("SHIFT", 32), + (70, G["id"]): ("SHIFT", 46), + (70, G["("]): ("SHIFT", 11), + (70, G["new"]): ("SHIFT", 22), + (70, G["{"]): ("SHIFT", 10), + (70, G["if"]): ("SHIFT", 12), + (70, G["int"]): ("SHIFT", 31), + (70, G["true"]): ("SHIFT", 25), + (70, G["let"]): ("SHIFT", 14), + (70, G["~"]): ("SHIFT", 27), + (70, G["isvoid"]): ("SHIFT", 24), + (70, G["while"]): ("SHIFT", 13), + (70, G["case"]): ("SHIFT", 21), + (70, G["not"]): ("SHIFT", 30), + (70, G["false"]): ("SHIFT", 26), + (71, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr , not-empty-expr-list"]), + (72, G["type"]): ("SHIFT", 73), + (73, G["."]): ("SHIFT", 74), + (74, G["id"]): ("SHIFT", 75), + (75, G["("]): ("SHIFT", 76), + (76, G["string"]): ("SHIFT", 32), + (76, G["id"]): ("SHIFT", 46), + (76, G["("]): ("SHIFT", 11), + (76, G["new"]): ("SHIFT", 22), + (76, G[")"]): ("REDUCE", G["expr-list -> e"]), + (76, G["{"]): ("SHIFT", 10), + (76, G["if"]): ("SHIFT", 12), + (76, G["int"]): ("SHIFT", 31), + (76, G["true"]): ("SHIFT", 25), + (76, G["let"]): ("SHIFT", 14), + (76, G["~"]): ("SHIFT", 27), + (76, G["isvoid"]): ("SHIFT", 24), + (76, G["while"]): ("SHIFT", 13), + (76, G["case"]): ("SHIFT", 21), + (76, G["not"]): ("SHIFT", 30), + (76, G["false"]): ("SHIFT", 26), + (77, G[")"]): ("SHIFT", 78), + (78, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (78, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (78, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (78, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (78, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (78, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (78, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (78, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (78, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (78, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (78, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (78, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (78, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (78, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (78, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (78, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (78, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (78, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (78, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (78, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (78, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (79, G["else"]): ("REDUCE", G["comp -> comp < arith"]), + (79, G["="]): ("REDUCE", G["comp -> comp < arith"]), + (79, G[","]): ("REDUCE", G["comp -> comp < arith"]), + (79, G["in"]): ("REDUCE", G["comp -> comp < arith"]), + (79, G["fi"]): ("REDUCE", G["comp -> comp < arith"]), + (79, G["}"]): ("REDUCE", G["comp -> comp < arith"]), + (79, G["<="]): ("REDUCE", G["comp -> comp < arith"]), + (79, G["error"]): ("REDUCE", G["comp -> comp < arith"]), + (79, G[";"]): ("REDUCE", G["comp -> comp < arith"]), + (79, G["of"]): ("REDUCE", G["comp -> comp < arith"]), + (79, G["<"]): ("REDUCE", G["comp -> comp < arith"]), + (79, G["loop"]): ("REDUCE", G["comp -> comp < arith"]), + (79, G["pool"]): ("REDUCE", G["comp -> comp < arith"]), + (79, G[")"]): ("REDUCE", G["comp -> comp < arith"]), + (79, G["then"]): ("REDUCE", G["comp -> comp < arith"]), + (79, G["+"]): ("SHIFT", 38), + (79, G["-"]): ("SHIFT", 53), + (80, G[")"]): ("SHIFT", 81), + (81, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (81, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (81, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (81, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (81, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (81, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (81, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (81, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (81, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (81, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (81, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (81, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (81, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (81, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (81, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (81, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (81, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (81, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (81, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (81, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (81, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (82, G["else"]): ("REDUCE", G["factor -> ~ factor"]), + (82, G["="]): ("REDUCE", G["factor -> ~ factor"]), + (82, G[","]): ("REDUCE", G["factor -> ~ factor"]), + (82, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), + (82, G["error"]): ("REDUCE", G["factor -> ~ factor"]), + (82, G[";"]): ("REDUCE", G["factor -> ~ factor"]), + (82, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), + (82, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), + (82, G["+"]): ("REDUCE", G["factor -> ~ factor"]), + (82, G["-"]): ("REDUCE", G["factor -> ~ factor"]), + (82, G["in"]): ("REDUCE", G["factor -> ~ factor"]), + (82, G["*"]): ("REDUCE", G["factor -> ~ factor"]), + (82, G["}"]): ("REDUCE", G["factor -> ~ factor"]), + (82, G["/"]): ("REDUCE", G["factor -> ~ factor"]), + (82, G["of"]): ("REDUCE", G["factor -> ~ factor"]), + (82, G["<"]): ("REDUCE", G["factor -> ~ factor"]), + (82, G["<="]): ("REDUCE", G["factor -> ~ factor"]), + (82, G[")"]): ("REDUCE", G["factor -> ~ factor"]), + (82, G["then"]): ("REDUCE", G["factor -> ~ factor"]), + (83, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), + (83, G["="]): ("REDUCE", G["factor -> isvoid factor"]), + (83, G[","]): ("REDUCE", G["factor -> isvoid factor"]), + (83, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), + (83, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), + (83, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), + (83, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), + (83, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), + (83, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), + (83, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), + (83, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), + (83, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), + (83, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), + (83, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), + (83, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), + (83, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), + (83, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), + (83, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), + (83, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), + (84, G["of"]): ("SHIFT", 85), + (85, G["id"]): ("SHIFT", 86), + (86, G[":"]): ("SHIFT", 87), + (87, G["type"]): ("SHIFT", 88), + (88, G["=>"]): ("SHIFT", 89), + (89, G["id"]): ("SHIFT", 46), + (89, G["("]): ("SHIFT", 11), + (89, G["new"]): ("SHIFT", 22), + (89, G["~"]): ("SHIFT", 27), + (89, G["{"]): ("SHIFT", 10), + (89, G["isvoid"]): ("SHIFT", 24), + (89, G["if"]): ("SHIFT", 12), + (89, G["true"]): ("SHIFT", 25), + (89, G["int"]): ("SHIFT", 31), + (89, G["let"]): ("SHIFT", 14), + (89, G["not"]): ("SHIFT", 30), + (89, G["case"]): ("SHIFT", 21), + (89, G["while"]): ("SHIFT", 13), + (89, G["false"]): ("SHIFT", 26), + (89, G["string"]): ("SHIFT", 32), + (90, G[";"]): ("SHIFT", 91), + (90, G["error"]): ("SHIFT", 93), + (91, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), + (91, G["id"]): ("SHIFT", 86), + (92, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), + (93, G["id"]): ("SHIFT", 86), + (93, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), + (94, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error case-list"]), + (95, G["esac"]): ("SHIFT", 96), + (96, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (96, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (96, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (96, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (96, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (96, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (96, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (96, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (96, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (96, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (96, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (96, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (97, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), + (97, G[","]): ("SHIFT", 98), + (98, G["id"]): ("SHIFT", 15), + (99, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), + (100, G["in"]): ("SHIFT", 101), + (101, G["let"]): ("SHIFT", 14), + (101, G["false"]): ("SHIFT", 26), + (101, G["not"]): ("SHIFT", 30), + (101, G["id"]): ("SHIFT", 46), + (101, G["case"]): ("SHIFT", 21), + (101, G["string"]): ("SHIFT", 32), + (101, G["while"]): ("SHIFT", 13), + (101, G["("]): ("SHIFT", 11), + (101, G["new"]): ("SHIFT", 22), + (101, G["~"]): ("SHIFT", 27), + (101, G["isvoid"]): ("SHIFT", 24), + (101, G["if"]): ("SHIFT", 12), + (101, G["{"]): ("SHIFT", 10), + (101, G["true"]): ("SHIFT", 25), + (101, G["int"]): ("SHIFT", 31), + (102, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (102, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (102, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (102, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (102, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (102, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (102, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (102, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (102, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (102, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (102, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (102, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (103, G["loop"]): ("SHIFT", 104), + (104, G["case"]): ("SHIFT", 21), + (104, G["new"]): ("SHIFT", 22), + (104, G["not"]): ("SHIFT", 30), + (104, G["("]): ("SHIFT", 11), (104, G["while"]): ("SHIFT", 13), - (104, G["id"]): ("SHIFT", 43), (104, G["if"]): ("SHIFT", 12), - (104, G["isvoid"]): ("SHIFT", 24), + (104, G["true"]): ("SHIFT", 25), (104, G["int"]): ("SHIFT", 31), - (104, G["("]): ("SHIFT", 11), - (104, G["~"]): ("SHIFT", 27), - (104, G["not"]): ("SHIFT", 30), - (104, G["case"]): ("SHIFT", 21), - (104, G["new"]): ("SHIFT", 22), (104, G["{"]): ("SHIFT", 10), - (104, G["true"]): ("SHIFT", 25), (104, G["let"]): ("SHIFT", 14), + (104, G["id"]): ("SHIFT", 46), + (104, G["~"]): ("SHIFT", 27), + (104, G["isvoid"]): ("SHIFT", 24), + (104, G["false"]): ("SHIFT", 26), (104, G["string"]): ("SHIFT", 32), - (105, G["fi"]): ("SHIFT", 106), - (106, G["-"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (106, G["in"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (106, G["*"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (106, G["}"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (106, G["/"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (106, G["of"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (106, G["<"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (106, G[")"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (106, G["<="]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (106, G["then"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (106, G["."]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (106, G["="]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (106, G["else"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (106, G[","]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (106, G["+"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (106, G["fi"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (106, G[";"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (106, G["loop"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (106, G["@"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (106, G["pool"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (106, G["error"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (107, G[")"]): ("SHIFT", 108), - (108, G["-"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["in"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["*"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["}"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["/"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["of"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["<"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G[")"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["<="]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["then"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["."]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["="]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["else"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G[","]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["+"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G[";"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["@"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), - (108, G["error"]): ("REDUCE", G["atom -> ( expr )"]), - (109, G["}"]): ("SHIFT", 110), - (110, G["else"]): ("REDUCE", G["expr -> { block }"]), - (110, G["then"]): ("REDUCE", G["expr -> { block }"]), - (110, G[","]): ("REDUCE", G["expr -> { block }"]), - (110, G["in"]): ("REDUCE", G["expr -> { block }"]), - (110, G["fi"]): ("REDUCE", G["expr -> { block }"]), - (110, G["}"]): ("REDUCE", G["expr -> { block }"]), - (110, G[";"]): ("REDUCE", G["expr -> { block }"]), - (110, G["of"]): ("REDUCE", G["expr -> { block }"]), - (110, G["loop"]): ("REDUCE", G["expr -> { block }"]), - (110, G[")"]): ("REDUCE", G["expr -> { block }"]), - (110, G["error"]): ("REDUCE", G["expr -> { block }"]), - (110, G["pool"]): ("REDUCE", G["expr -> { block }"]), - (111, G[";"]): ("SHIFT", 112), - (111, G["error"]): ("SHIFT", 114), - (112, G["id"]): ("SHIFT", 43), - (112, G["if"]): ("SHIFT", 12), - (112, G["int"]): ("SHIFT", 31), - (112, G["("]): ("SHIFT", 11), - (112, G["{"]): ("SHIFT", 10), - (112, G["}"]): ("REDUCE", G["block -> expr ;"]), - (112, G["let"]): ("SHIFT", 14), - (112, G["while"]): ("SHIFT", 13), - (112, G["isvoid"]): ("SHIFT", 24), - (112, G["not"]): ("SHIFT", 30), - (112, G["new"]): ("SHIFT", 22), - (112, G["true"]): ("SHIFT", 25), - (112, G["~"]): ("SHIFT", 27), - (112, G["string"]): ("SHIFT", 32), - (112, G["false"]): ("SHIFT", 26), - (112, G["case"]): ("SHIFT", 21), - (113, G["}"]): ("REDUCE", G["block -> expr ; block"]), - (114, G["id"]): ("SHIFT", 43), - (114, G["if"]): ("SHIFT", 12), - (114, G["int"]): ("SHIFT", 31), - (114, G["("]): ("SHIFT", 11), - (114, G["{"]): ("SHIFT", 10), - (114, G["let"]): ("SHIFT", 14), - (114, G["}"]): ("REDUCE", G["block -> expr error"]), - (114, G["while"]): ("SHIFT", 13), - (114, G["isvoid"]): ("SHIFT", 24), - (114, G["not"]): ("SHIFT", 30), - (114, G["new"]): ("SHIFT", 22), - (114, G["true"]): ("SHIFT", 25), - (114, G["~"]): ("SHIFT", 27), - (114, G["string"]): ("SHIFT", 32), - (114, G["false"]): ("SHIFT", 26), - (114, G["case"]): ("SHIFT", 21), - (115, G["}"]): ("REDUCE", G["block -> expr error block"]), - (116, G["}"]): ("SHIFT", 117), - (117, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), - (117, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), - (118, G[":"]): ("SHIFT", 119), - (119, G["type"]): ("SHIFT", 120), - (120, G[","]): ("SHIFT", 121), - (120, G[")"]): ("REDUCE", G["param-list -> id : type"]), - (121, G["id"]): ("SHIFT", 118), - (122, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), - (123, G[")"]): ("SHIFT", 124), + (105, G["pool"]): ("SHIFT", 106), + (106, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (106, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (106, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (106, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (106, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (106, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (106, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (106, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (106, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (106, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (106, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (106, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (107, G["then"]): ("SHIFT", 108), + (108, G["not"]): ("SHIFT", 30), + (108, G["case"]): ("SHIFT", 21), + (108, G["false"]): ("SHIFT", 26), + (108, G["id"]): ("SHIFT", 46), + (108, G["~"]): ("SHIFT", 27), + (108, G["while"]): ("SHIFT", 13), + (108, G["string"]): ("SHIFT", 32), + (108, G["isvoid"]): ("SHIFT", 24), + (108, G["new"]): ("SHIFT", 22), + (108, G["("]): ("SHIFT", 11), + (108, G["{"]): ("SHIFT", 10), + (108, G["if"]): ("SHIFT", 12), + (108, G["true"]): ("SHIFT", 25), + (108, G["int"]): ("SHIFT", 31), + (108, G["let"]): ("SHIFT", 14), + (109, G["else"]): ("SHIFT", 110), + (110, G["id"]): ("SHIFT", 46), + (110, G["("]): ("SHIFT", 11), + (110, G["new"]): ("SHIFT", 22), + (110, G["~"]): ("SHIFT", 27), + (110, G["{"]): ("SHIFT", 10), + (110, G["isvoid"]): ("SHIFT", 24), + (110, G["if"]): ("SHIFT", 12), + (110, G["int"]): ("SHIFT", 31), + (110, G["true"]): ("SHIFT", 25), + (110, G["let"]): ("SHIFT", 14), + (110, G["case"]): ("SHIFT", 21), + (110, G["not"]): ("SHIFT", 30), + (110, G["while"]): ("SHIFT", 13), + (110, G["false"]): ("SHIFT", 26), + (110, G["string"]): ("SHIFT", 32), + (111, G["fi"]): ("SHIFT", 112), + (112, G["."]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (112, G["else"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (112, G["="]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (112, G[","]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (112, G["fi"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (112, G["error"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (112, G[";"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (112, G["loop"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (112, G["@"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (112, G["pool"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (112, G["+"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (112, G["-"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (112, G["in"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (112, G["*"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (112, G["}"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (112, G["/"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (112, G["of"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (112, G["<"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (112, G["<="]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (112, G[")"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (112, G["then"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (113, G[")"]): ("SHIFT", 114), + (114, G["."]): ("REDUCE", G["atom -> ( expr )"]), + (114, G["else"]): ("REDUCE", G["atom -> ( expr )"]), + (114, G["="]): ("REDUCE", G["atom -> ( expr )"]), + (114, G[","]): ("REDUCE", G["atom -> ( expr )"]), + (114, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), + (114, G["error"]): ("REDUCE", G["atom -> ( expr )"]), + (114, G[";"]): ("REDUCE", G["atom -> ( expr )"]), + (114, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), + (114, G["@"]): ("REDUCE", G["atom -> ( expr )"]), + (114, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), + (114, G["+"]): ("REDUCE", G["atom -> ( expr )"]), + (114, G["-"]): ("REDUCE", G["atom -> ( expr )"]), + (114, G["in"]): ("REDUCE", G["atom -> ( expr )"]), + (114, G["*"]): ("REDUCE", G["atom -> ( expr )"]), + (114, G["}"]): ("REDUCE", G["atom -> ( expr )"]), + (114, G["/"]): ("REDUCE", G["atom -> ( expr )"]), + (114, G["of"]): ("REDUCE", G["atom -> ( expr )"]), + (114, G["<"]): ("REDUCE", G["atom -> ( expr )"]), + (114, G["<="]): ("REDUCE", G["atom -> ( expr )"]), + (114, G[")"]): ("REDUCE", G["atom -> ( expr )"]), + (114, G["then"]): ("REDUCE", G["atom -> ( expr )"]), + (115, G["}"]): ("SHIFT", 116), + (116, G["else"]): ("REDUCE", G["expr -> { block }"]), + (116, G[","]): ("REDUCE", G["expr -> { block }"]), + (116, G["in"]): ("REDUCE", G["expr -> { block }"]), + (116, G["fi"]): ("REDUCE", G["expr -> { block }"]), + (116, G["}"]): ("REDUCE", G["expr -> { block }"]), + (116, G["error"]): ("REDUCE", G["expr -> { block }"]), + (116, G[")"]): ("REDUCE", G["expr -> { block }"]), + (116, G[";"]): ("REDUCE", G["expr -> { block }"]), + (116, G["of"]): ("REDUCE", G["expr -> { block }"]), + (116, G["loop"]): ("REDUCE", G["expr -> { block }"]), + (116, G["pool"]): ("REDUCE", G["expr -> { block }"]), + (116, G["then"]): ("REDUCE", G["expr -> { block }"]), + (117, G[";"]): ("SHIFT", 118), + (117, G["error"]): ("SHIFT", 120), + (118, G["id"]): ("SHIFT", 46), + (118, G["("]): ("SHIFT", 11), + (118, G["new"]): ("SHIFT", 22), + (118, G["~"]): ("SHIFT", 27), + (118, G["{"]): ("SHIFT", 10), + (118, G["isvoid"]): ("SHIFT", 24), + (118, G["if"]): ("SHIFT", 12), + (118, G["true"]): ("SHIFT", 25), + (118, G["int"]): ("SHIFT", 31), + (118, G["let"]): ("SHIFT", 14), + (118, G["not"]): ("SHIFT", 30), + (118, G["case"]): ("SHIFT", 21), + (118, G["}"]): ("REDUCE", G["block -> expr ;"]), + (118, G["while"]): ("SHIFT", 13), + (118, G["false"]): ("SHIFT", 26), + (118, G["string"]): ("SHIFT", 32), + (119, G["}"]): ("REDUCE", G["block -> expr ; block"]), + (120, G["id"]): ("SHIFT", 46), + (120, G["("]): ("SHIFT", 11), + (120, G["new"]): ("SHIFT", 22), + (120, G["~"]): ("SHIFT", 27), + (120, G["{"]): ("SHIFT", 10), + (120, G["isvoid"]): ("SHIFT", 24), + (120, G["if"]): ("SHIFT", 12), + (120, G["}"]): ("REDUCE", G["block -> expr error"]), + (120, G["true"]): ("SHIFT", 25), + (120, G["int"]): ("SHIFT", 31), + (120, G["let"]): ("SHIFT", 14), + (120, G["not"]): ("SHIFT", 30), + (120, G["case"]): ("SHIFT", 21), + (120, G["while"]): ("SHIFT", 13), + (120, G["false"]): ("SHIFT", 26), + (120, G["string"]): ("SHIFT", 32), + (121, G["}"]): ("REDUCE", G["block -> expr error block"]), + (122, G["}"]): ("SHIFT", 123), + (123, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (123, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), (124, G[":"]): ("SHIFT", 125), (125, G["type"]): ("SHIFT", 126), - (126, G["{"]): ("SHIFT", 127), - (127, G["new"]): ("SHIFT", 22), - (127, G["{"]): ("SHIFT", 10), - (127, G["id"]): ("SHIFT", 43), - (127, G["let"]): ("SHIFT", 14), - (127, G["while"]): ("SHIFT", 13), - (127, G["true"]): ("SHIFT", 25), - (127, G["isvoid"]): ("SHIFT", 24), - (127, G["string"]): ("SHIFT", 32), - (127, G["false"]): ("SHIFT", 26), - (127, G["not"]): ("SHIFT", 30), - (127, G["if"]): ("SHIFT", 12), - (127, G["~"]): ("SHIFT", 27), - (127, G["("]): ("SHIFT", 11), - (127, G["int"]): ("SHIFT", 31), - (127, G["case"]): ("SHIFT", 21), - (128, G["}"]): ("SHIFT", 129), - (129, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), - (129, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), - (130, G["type"]): ("SHIFT", 131), - (131, G[";"]): ("REDUCE", G["attribute -> id : type"]), - (131, G["error"]): ("REDUCE", G["attribute -> id : type"]), - (131, G["<-"]): ("SHIFT", 132), - (132, G["id"]): ("SHIFT", 43), - (132, G["if"]): ("SHIFT", 12), - (132, G["int"]): ("SHIFT", 31), - (132, G["("]): ("SHIFT", 11), - (132, G["{"]): ("SHIFT", 10), - (132, G["let"]): ("SHIFT", 14), - (132, G["while"]): ("SHIFT", 13), - (132, G["isvoid"]): ("SHIFT", 24), - (132, G["not"]): ("SHIFT", 30), - (132, G["new"]): ("SHIFT", 22), - (132, G["true"]): ("SHIFT", 25), - (132, G["~"]): ("SHIFT", 27), - (132, G["string"]): ("SHIFT", 32), - (132, G["false"]): ("SHIFT", 26), - (132, G["case"]): ("SHIFT", 21), - (133, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), - (133, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (126, G[","]): ("SHIFT", 127), + (126, G[")"]): ("REDUCE", G["param-list -> id : type"]), + (127, G["id"]): ("SHIFT", 124), + (128, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), + (129, G[")"]): ("SHIFT", 130), + (130, G[":"]): ("SHIFT", 131), + (131, G["type"]): ("SHIFT", 132), + (132, G["{"]): ("SHIFT", 133), + (133, G["true"]): ("SHIFT", 25), + (133, G["case"]): ("SHIFT", 21), + (133, G["not"]): ("SHIFT", 30), + (133, G["while"]): ("SHIFT", 13), + (133, G["false"]): ("SHIFT", 26), + (133, G["id"]): ("SHIFT", 46), + (133, G["string"]): ("SHIFT", 32), + (133, G["("]): ("SHIFT", 11), + (133, G["new"]): ("SHIFT", 22), + (133, G["{"]): ("SHIFT", 10), + (133, G["~"]): ("SHIFT", 27), + (133, G["isvoid"]): ("SHIFT", 24), + (133, G["if"]): ("SHIFT", 12), + (133, G["int"]): ("SHIFT", 31), + (133, G["let"]): ("SHIFT", 14), (134, G["}"]): ("SHIFT", 135), - (135, G[";"]): ("REDUCE", G["class-def -> class type { feature-list }"]), - (136, G["error"]): ("SHIFT", 144), - (136, G[";"]): ("SHIFT", 137), - (137, G["}"]): ("REDUCE", G["feature-list -> e"]), - (137, G["id"]): ("SHIFT", 4), - (138, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), - (139, G["error"]): ("SHIFT", 142), - (139, G[";"]): ("SHIFT", 140), - (140, G["}"]): ("REDUCE", G["feature-list -> e"]), - (140, G["id"]): ("SHIFT", 4), - (141, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), - (142, G["}"]): ("REDUCE", G["feature-list -> e"]), - (142, G["id"]): ("SHIFT", 4), - (143, G["}"]): ("REDUCE", G["feature-list -> method error feature-list"]), - (144, G["}"]): ("REDUCE", G["feature-list -> e"]), - (144, G["id"]): ("SHIFT", 4), - (145, G["}"]): ("REDUCE", G["feature-list -> attribute error feature-list"]), - (146, G["type"]): ("SHIFT", 147), - (147, G["{"]): ("SHIFT", 148), + (135, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (135, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (136, G["type"]): ("SHIFT", 137), + (137, G["<-"]): ("SHIFT", 138), + (137, G["error"]): ("REDUCE", G["attribute -> id : type"]), + (137, G[";"]): ("REDUCE", G["attribute -> id : type"]), + (138, G["id"]): ("SHIFT", 46), + (138, G["("]): ("SHIFT", 11), + (138, G["new"]): ("SHIFT", 22), + (138, G["string"]): ("SHIFT", 32), + (138, G["~"]): ("SHIFT", 27), + (138, G["{"]): ("SHIFT", 10), + (138, G["isvoid"]): ("SHIFT", 24), + (138, G["if"]): ("SHIFT", 12), + (138, G["true"]): ("SHIFT", 25), + (138, G["int"]): ("SHIFT", 31), + (138, G["let"]): ("SHIFT", 14), + (138, G["not"]): ("SHIFT", 30), + (138, G["case"]): ("SHIFT", 21), + (138, G["while"]): ("SHIFT", 13), + (138, G["false"]): ("SHIFT", 26), + (139, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (139, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (140, G["}"]): ("SHIFT", 141), + (141, G[";"]): ("REDUCE", G["class-def -> class type { feature-list }"]), + (142, G[";"]): ("SHIFT", 143), + (142, G["error"]): ("SHIFT", 150), + (143, G["}"]): ("REDUCE", G["feature-list -> e"]), + (143, G["id"]): ("SHIFT", 4), + (144, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), + (145, G[";"]): ("SHIFT", 146), + (145, G["error"]): ("SHIFT", 148), + (146, G["}"]): ("REDUCE", G["feature-list -> e"]), + (146, G["id"]): ("SHIFT", 4), + (147, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), (148, G["}"]): ("REDUCE", G["feature-list -> e"]), (148, G["id"]): ("SHIFT", 4), - (149, G["}"]): ("SHIFT", 150), - (150, G[";"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), - (151, G["$"]): ("OK", None), - (152, G["$"]): ("REDUCE", G["program -> class-list"]), - (153, G[";"]): ("SHIFT", 154), - (154, G["class"]): ("SHIFT", 1), - (154, G["$"]): ("REDUCE", G["class-list -> class-def ;"]), - (155, G["$"]): ("REDUCE", G["class-list -> class-def ; class-list"]), + (149, G["}"]): ("REDUCE", G["feature-list -> method error feature-list"]), + (150, G["}"]): ("REDUCE", G["feature-list -> e"]), + (150, G["id"]): ("SHIFT", 4), + (151, G["}"]): ("REDUCE", G["feature-list -> attribute error feature-list"]), + (152, G["type"]): ("SHIFT", 153), + (153, G["{"]): ("SHIFT", 154), + (154, G["}"]): ("REDUCE", G["feature-list -> e"]), + (154, G["id"]): ("SHIFT", 4), + (155, G["}"]): ("SHIFT", 156), + (156, G[";"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), + (157, G["$"]): ("OK", None), + (158, G["$"]): ("REDUCE", G["program -> class-list"]), + (159, G[";"]): ("SHIFT", 160), + (160, G["class"]): ("SHIFT", 1), + (160, G["$"]): ("REDUCE", G["class-list -> class-def ;"]), + (161, G["$"]): ("REDUCE", G["class-list -> class-def ; class-list"]), } @staticmethod def __goto_table(): return { - (0, G["class-def"]): 153, - (0, G["program"]): 151, - (0, G["class-list"]): 152, - (3, G["method"]): 139, - (3, G["attribute"]): 136, - (3, G["feature-list"]): 134, - (5, G["param-list"]): 123, - (9, G["factor"]): 55, - (9, G["term"]): 56, - (9, G["comp"]): 46, - (9, G["negable"]): 47, + (0, G["class-list"]): 158, + (0, G["class-def"]): 159, + (0, G["program"]): 157, + (3, G["method"]): 145, + (3, G["attribute"]): 142, + (3, G["feature-list"]): 140, + (5, G["param-list"]): 129, + (9, G["arith"]): 65, + (9, G["atom"]): 42, + (9, G["term"]): 58, (9, G["function-call"]): 33, - (9, G["atom"]): 39, - (9, G["arith"]): 50, - (9, G["expr"]): 116, - (10, G["atom"]): 39, - (10, G["factor"]): 55, - (10, G["expr"]): 111, - (10, G["comp"]): 46, - (10, G["term"]): 56, - (10, G["negable"]): 47, - (10, G["arith"]): 50, + (9, G["comp"]): 49, + (9, G["factor"]): 57, + (9, G["expr"]): 122, + (9, G["negable"]): 64, (10, G["function-call"]): 33, - (10, G["block"]): 109, - (11, G["negable"]): 47, - (11, G["arith"]): 50, - (11, G["term"]): 56, - (11, G["comp"]): 46, - (11, G["factor"]): 55, - (11, G["atom"]): 39, - (11, G["expr"]): 107, + (10, G["factor"]): 57, + (10, G["arith"]): 65, + (10, G["block"]): 115, + (10, G["comp"]): 49, + (10, G["atom"]): 42, + (10, G["expr"]): 117, + (10, G["term"]): 58, + (10, G["negable"]): 64, + (11, G["comp"]): 49, + (11, G["atom"]): 42, + (11, G["term"]): 58, + (11, G["arith"]): 65, + (11, G["factor"]): 57, + (11, G["negable"]): 64, + (11, G["expr"]): 113, (11, G["function-call"]): 33, - (12, G["negable"]): 47, - (12, G["atom"]): 39, - (12, G["comp"]): 46, - (12, G["term"]): 56, - (12, G["arith"]): 50, - (12, G["factor"]): 55, - (12, G["expr"]): 101, + (12, G["comp"]): 49, (12, G["function-call"]): 33, - (13, G["factor"]): 55, - (13, G["negable"]): 47, - (13, G["expr"]): 97, - (13, G["term"]): 56, + (12, G["expr"]): 107, + (12, G["atom"]): 42, + (12, G["term"]): 58, + (12, G["arith"]): 65, + (12, G["negable"]): 64, + (12, G["factor"]): 57, + (13, G["atom"]): 42, + (13, G["term"]): 58, + (13, G["comp"]): 49, + (13, G["arith"]): 65, + (13, G["factor"]): 57, (13, G["function-call"]): 33, - (13, G["arith"]): 50, - (13, G["atom"]): 39, - (13, G["comp"]): 46, - (14, G["declaration-list"]): 94, + (13, G["negable"]): 64, + (13, G["expr"]): 103, + (14, G["declaration-list"]): 100, (18, G["declaration-list"]): 19, - (20, G["atom"]): 39, - (20, G["comp"]): 46, - (20, G["negable"]): 47, - (20, G["factor"]): 55, - (20, G["arith"]): 50, - (20, G["term"]): 56, - (20, G["expr"]): 91, + (20, G["arith"]): 65, + (20, G["comp"]): 49, + (20, G["expr"]): 97, + (20, G["factor"]): 57, + (20, G["negable"]): 64, + (20, G["atom"]): 42, + (20, G["term"]): 58, (20, G["function-call"]): 33, - (21, G["term"]): 56, - (21, G["arith"]): 50, + (21, G["term"]): 58, + (21, G["comp"]): 49, (21, G["function-call"]): 33, - (21, G["negable"]): 47, - (21, G["atom"]): 39, - (21, G["comp"]): 46, - (21, G["expr"]): 78, - (21, G["factor"]): 55, - (24, G["atom"]): 39, - (24, G["factor"]): 77, + (21, G["atom"]): 42, + (21, G["arith"]): 65, + (21, G["expr"]): 84, + (21, G["negable"]): 64, + (21, G["factor"]): 57, + (24, G["atom"]): 42, + (24, G["factor"]): 83, (24, G["function-call"]): 33, - (27, G["atom"]): 39, + (27, G["factor"]): 82, + (27, G["atom"]): 42, (27, G["function-call"]): 33, - (27, G["factor"]): 76, - (29, G["expr-list"]): 74, - (29, G["atom"]): 39, - (29, G["expr"]): 64, - (29, G["not-empty-expr-list"]): 63, - (29, G["negable"]): 47, - (29, G["term"]): 56, - (29, G["factor"]): 55, - (29, G["arith"]): 50, - (29, G["comp"]): 46, + (29, G["comp"]): 49, + (29, G["atom"]): 42, + (29, G["expr-list"]): 80, (29, G["function-call"]): 33, - (30, G["atom"]): 39, + (29, G["expr"]): 69, + (29, G["term"]): 58, + (29, G["factor"]): 57, + (29, G["negable"]): 64, + (29, G["not-empty-expr-list"]): 68, + (29, G["arith"]): 65, + (30, G["comp"]): 34, + (30, G["term"]): 58, + (30, G["arith"]): 65, + (30, G["atom"]): 42, + (30, G["factor"]): 57, (30, G["function-call"]): 33, - (30, G["term"]): 56, - (30, G["factor"]): 55, - (30, G["arith"]): 34, - (35, G["atom"]): 39, + (35, G["term"]): 58, + (35, G["arith"]): 79, + (35, G["atom"]): 42, + (35, G["factor"]): 57, (35, G["function-call"]): 33, - (35, G["term"]): 36, - (35, G["factor"]): 55, - (37, G["atom"]): 39, - (37, G["function-call"]): 33, - (37, G["factor"]): 38, - (42, G["atom"]): 39, - (42, G["expr"]): 64, - (42, G["expr-list"]): 61, - (42, G["not-empty-expr-list"]): 63, - (42, G["negable"]): 47, - (42, G["term"]): 56, - (42, G["factor"]): 55, - (42, G["arith"]): 50, - (42, G["comp"]): 46, - (42, G["function-call"]): 33, - (44, G["atom"]): 39, - (44, G["expr"]): 45, - (44, G["comp"]): 46, - (44, G["factor"]): 55, - (44, G["negable"]): 47, - (44, G["term"]): 56, - (44, G["function-call"]): 33, - (44, G["arith"]): 50, - (48, G["term"]): 56, - (48, G["atom"]): 39, - (48, G["arith"]): 50, - (48, G["factor"]): 55, - (48, G["function-call"]): 33, - (48, G["negable"]): 49, - (51, G["atom"]): 39, - (51, G["term"]): 52, + (36, G["term"]): 58, + (36, G["arith"]): 37, + (36, G["atom"]): 42, + (36, G["factor"]): 57, + (36, G["function-call"]): 33, + (38, G["term"]): 39, + (38, G["atom"]): 42, + (38, G["factor"]): 57, + (38, G["function-call"]): 33, + (40, G["factor"]): 41, + (40, G["atom"]): 42, + (40, G["function-call"]): 33, + (45, G["comp"]): 49, + (45, G["atom"]): 42, + (45, G["function-call"]): 33, + (45, G["expr"]): 69, + (45, G["term"]): 58, + (45, G["expr-list"]): 66, + (45, G["factor"]): 57, + (45, G["negable"]): 64, + (45, G["not-empty-expr-list"]): 68, + (45, G["arith"]): 65, + (47, G["comp"]): 49, + (47, G["arith"]): 65, + (47, G["term"]): 58, + (47, G["factor"]): 57, + (47, G["function-call"]): 33, + (47, G["atom"]): 42, + (47, G["expr"]): 48, + (47, G["negable"]): 64, + (50, G["term"]): 58, + (50, G["arith"]): 59, + (50, G["atom"]): 42, + (50, G["factor"]): 57, + (50, G["function-call"]): 33, + (51, G["term"]): 58, + (51, G["arith"]): 52, + (51, G["atom"]): 42, + (51, G["factor"]): 57, (51, G["function-call"]): 33, - (51, G["factor"]): 55, - (53, G["atom"]): 39, - (53, G["factor"]): 54, + (53, G["term"]): 54, + (53, G["atom"]): 42, + (53, G["factor"]): 57, (53, G["function-call"]): 33, - (57, G["term"]): 56, - (57, G["atom"]): 39, - (57, G["arith"]): 50, - (57, G["negable"]): 58, - (57, G["factor"]): 55, - (57, G["function-call"]): 33, - (59, G["term"]): 56, - (59, G["negable"]): 60, - (59, G["atom"]): 39, - (59, G["arith"]): 50, - (59, G["factor"]): 55, - (59, G["function-call"]): 33, - (65, G["atom"]): 39, - (65, G["expr"]): 64, - (65, G["not-empty-expr-list"]): 66, - (65, G["negable"]): 47, - (65, G["term"]): 56, - (65, G["factor"]): 55, - (65, G["arith"]): 50, - (65, G["comp"]): 46, - (65, G["function-call"]): 33, - (71, G["atom"]): 39, - (71, G["expr"]): 64, - (71, G["not-empty-expr-list"]): 63, - (71, G["negable"]): 47, - (71, G["term"]): 56, - (71, G["factor"]): 55, - (71, G["arith"]): 50, - (71, G["comp"]): 46, - (71, G["function-call"]): 33, - (71, G["expr-list"]): 72, - (79, G["case-list"]): 89, - (83, G["atom"]): 39, - (83, G["expr"]): 84, - (83, G["factor"]): 55, - (83, G["comp"]): 46, - (83, G["term"]): 56, - (83, G["negable"]): 47, - (83, G["arith"]): 50, - (83, G["function-call"]): 33, - (85, G["case-list"]): 86, - (87, G["case-list"]): 88, - (92, G["declaration-list"]): 93, - (95, G["atom"]): 39, - (95, G["comp"]): 46, - (95, G["factor"]): 55, - (95, G["negable"]): 47, - (95, G["term"]): 56, - (95, G["function-call"]): 33, - (95, G["arith"]): 50, - (95, G["expr"]): 96, - (98, G["atom"]): 39, - (98, G["expr"]): 99, - (98, G["negable"]): 47, - (98, G["arith"]): 50, - (98, G["term"]): 56, - (98, G["factor"]): 55, - (98, G["comp"]): 46, - (98, G["function-call"]): 33, - (102, G["term"]): 56, - (102, G["negable"]): 47, - (102, G["atom"]): 39, - (102, G["arith"]): 50, - (102, G["expr"]): 103, - (102, G["function-call"]): 33, - (102, G["factor"]): 55, - (102, G["comp"]): 46, - (104, G["term"]): 56, - (104, G["negable"]): 47, - (104, G["atom"]): 39, + (55, G["factor"]): 56, + (55, G["atom"]): 42, + (55, G["function-call"]): 33, + (60, G["term"]): 58, + (60, G["arith"]): 63, + (60, G["atom"]): 42, + (60, G["factor"]): 57, + (60, G["function-call"]): 33, + (61, G["term"]): 58, + (61, G["arith"]): 62, + (61, G["atom"]): 42, + (61, G["factor"]): 57, + (61, G["function-call"]): 33, + (70, G["comp"]): 49, + (70, G["atom"]): 42, + (70, G["function-call"]): 33, + (70, G["expr"]): 69, + (70, G["term"]): 58, + (70, G["factor"]): 57, + (70, G["negable"]): 64, + (70, G["arith"]): 65, + (70, G["not-empty-expr-list"]): 71, + (76, G["comp"]): 49, + (76, G["atom"]): 42, + (76, G["function-call"]): 33, + (76, G["expr-list"]): 77, + (76, G["expr"]): 69, + (76, G["term"]): 58, + (76, G["factor"]): 57, + (76, G["negable"]): 64, + (76, G["not-empty-expr-list"]): 68, + (76, G["arith"]): 65, + (85, G["case-list"]): 95, + (89, G["function-call"]): 33, + (89, G["factor"]): 57, + (89, G["arith"]): 65, + (89, G["comp"]): 49, + (89, G["atom"]): 42, + (89, G["term"]): 58, + (89, G["expr"]): 90, + (89, G["negable"]): 64, + (91, G["case-list"]): 92, + (93, G["case-list"]): 94, + (98, G["declaration-list"]): 99, + (101, G["comp"]): 49, + (101, G["arith"]): 65, + (101, G["term"]): 58, + (101, G["factor"]): 57, + (101, G["function-call"]): 33, + (101, G["atom"]): 42, + (101, G["expr"]): 102, + (101, G["negable"]): 64, + (104, G["atom"]): 42, + (104, G["term"]): 58, + (104, G["arith"]): 65, + (104, G["comp"]): 49, + (104, G["factor"]): 57, + (104, G["negable"]): 64, (104, G["expr"]): 105, - (104, G["arith"]): 50, - (104, G["comp"]): 46, (104, G["function-call"]): 33, - (104, G["factor"]): 55, - (112, G["atom"]): 39, - (112, G["factor"]): 55, - (112, G["expr"]): 111, - (112, G["comp"]): 46, - (112, G["term"]): 56, - (112, G["negable"]): 47, - (112, G["block"]): 113, - (112, G["arith"]): 50, - (112, G["function-call"]): 33, - (114, G["atom"]): 39, - (114, G["factor"]): 55, - (114, G["expr"]): 111, - (114, G["comp"]): 46, - (114, G["term"]): 56, - (114, G["negable"]): 47, - (114, G["arith"]): 50, - (114, G["block"]): 115, - (114, G["function-call"]): 33, - (121, G["param-list"]): 122, - (127, G["factor"]): 55, - (127, G["term"]): 56, - (127, G["comp"]): 46, - (127, G["negable"]): 47, - (127, G["function-call"]): 33, - (127, G["atom"]): 39, - (127, G["arith"]): 50, - (127, G["expr"]): 128, - (132, G["atom"]): 39, - (132, G["factor"]): 55, - (132, G["comp"]): 46, - (132, G["expr"]): 133, - (132, G["term"]): 56, - (132, G["negable"]): 47, - (132, G["arith"]): 50, - (132, G["function-call"]): 33, - (137, G["method"]): 139, - (137, G["attribute"]): 136, - (137, G["feature-list"]): 138, - (140, G["method"]): 139, - (140, G["attribute"]): 136, - (140, G["feature-list"]): 141, - (142, G["feature-list"]): 143, - (142, G["method"]): 139, - (142, G["attribute"]): 136, - (144, G["method"]): 139, - (144, G["attribute"]): 136, - (144, G["feature-list"]): 145, - (148, G["method"]): 139, + (108, G["comp"]): 49, + (108, G["factor"]): 57, + (108, G["expr"]): 109, + (108, G["term"]): 58, + (108, G["function-call"]): 33, + (108, G["arith"]): 65, + (108, G["atom"]): 42, + (108, G["negable"]): 64, + (110, G["factor"]): 57, + (110, G["comp"]): 49, + (110, G["arith"]): 65, + (110, G["atom"]): 42, + (110, G["term"]): 58, + (110, G["expr"]): 111, + (110, G["negable"]): 64, + (110, G["function-call"]): 33, + (118, G["function-call"]): 33, + (118, G["factor"]): 57, + (118, G["arith"]): 65, + (118, G["comp"]): 49, + (118, G["atom"]): 42, + (118, G["expr"]): 117, + (118, G["term"]): 58, + (118, G["block"]): 119, + (118, G["negable"]): 64, + (120, G["function-call"]): 33, + (120, G["factor"]): 57, + (120, G["arith"]): 65, + (120, G["comp"]): 49, + (120, G["atom"]): 42, + (120, G["expr"]): 117, + (120, G["term"]): 58, + (120, G["negable"]): 64, + (120, G["block"]): 121, + (127, G["param-list"]): 128, + (133, G["arith"]): 65, + (133, G["atom"]): 42, + (133, G["term"]): 58, + (133, G["function-call"]): 33, + (133, G["comp"]): 49, + (133, G["factor"]): 57, + (133, G["expr"]): 134, + (133, G["negable"]): 64, + (138, G["function-call"]): 33, + (138, G["factor"]): 57, + (138, G["arith"]): 65, + (138, G["comp"]): 49, + (138, G["atom"]): 42, + (138, G["term"]): 58, + (138, G["expr"]): 139, + (138, G["negable"]): 64, + (143, G["method"]): 145, + (143, G["attribute"]): 142, + (143, G["feature-list"]): 144, + (146, G["method"]): 145, + (146, G["attribute"]): 142, + (146, G["feature-list"]): 147, + (148, G["method"]): 145, + (148, G["attribute"]): 142, (148, G["feature-list"]): 149, - (148, G["attribute"]): 136, - (154, G["class-def"]): 153, - (154, G["class-list"]): 155, + (150, G["method"]): 145, + (150, G["attribute"]): 142, + (150, G["feature-list"]): 151, + (154, G["method"]): 145, + (154, G["attribute"]): 142, + (154, G["feature-list"]): 155, + (160, G["class-list"]): 161, + (160, G["class-def"]): 159, } diff --git a/src/cool/semantics/__init__.py b/src/cool/semantics/__init__.py index 9c9770569..75a02bf66 100644 --- a/src/cool/semantics/__init__.py +++ b/src/cool/semantics/__init__.py @@ -3,7 +3,9 @@ inspection. """ from .formatter import CodeBuilder, Formatter -from .type_builder import TypeBuilder -from .type_collector import TypeCollector from .overridden import OverriddenMethodChecker, topological_sorting +from .position_assigner import PositionAssigner +from .type_builder_for_features import TypeBuilderForFeatures +from .type_builder_for_inheritance import TypeBuilderForInheritance from .type_checker import TypeChecker +from .type_collector import TypeCollector diff --git a/src/cool/semantics/execution.py b/src/cool/semantics/execution.py deleted file mode 100644 index cb545cca8..000000000 --- a/src/cool/semantics/execution.py +++ /dev/null @@ -1,351 +0,0 @@ -from typing import Any, Dict - -import cool.semantics.utils.astnodes as ast -import cool.semantics.utils.errors as err -import cool.visitor as visitor -from cool.semantics.utils.scope import Context, Method, Scope, Type, SemanticError - - -class ExecutionError(Exception): - @property - def text(self): - return self.args[0] - - -def abort(obj, context): - print('Aborting Program') - exit() - - -def copy(obj, context): - x_copy = Instance(obj.type, obj.value if obj.type.name in ('Int', 'String', 'Bool') else None) - x_copy.attribute_values = obj.attribute_values - return x_copy - - -def type_name(obj, context): - return Instance(context.get_type('String'), obj.type.name) - - -def out_string(obj, s, context): - print(s.value, end='') - return obj - - -def out_int(obj, s, context): - print(s.value, end='') - return obj - - -def in_string(obj, context): - return Instance(context.get_type('Int'), input()) - - -def in_int(obj, context): - try: - return Instance(context.get_type('Int'), int(input())) - except ValueError: - raise ExecutionError(err.INPUT_INT_ERROR) - - -def length(obj, context): - return Instance(context.get_type('Int'), len(obj.value)) - - -def concat(obj, s, context): - return Instance(context.get_type('String'), obj.value + s.value) - - -def substr(obj, i, l, context): - return Instance(context.get_type('String'), obj.value[i: i + l]) - - -defaults = { - ('Object', 'abort'): abort, - ('Object', 'copy'): copy, - ('Object', 'type_name'): type_name, - ('IO', 'out_string'): out_string, - ('IO', 'out_int'): out_int, - ('IO', 'in_string'): in_string, - ('IO', 'in_int'): in_int, - ('String', 'length'): length, - ('String', 'concat'): concat, - ('String', 'substr'): substr, -} - - -class Instance: - def __init__(self, typex: Type, value: Any = None): - if value is None: - value = id(self) - - self.type: Type = typex - self.value: Any = value - self.attribute_values: Dict[str, Instance] = {} - - def set_attribute_instance(self, name: str, value: 'Instance') -> None: - self.attribute_values[name] = value - - def get_attribute_instance(self, name: str) -> 'Instance': - return self.attribute_values[name] - - def get_method(self, name: str) -> Method: - return self.type.get_method(name) - - def __str__(self): - return f'{self.type.name} {self.value}' - - -class VoidInstance(Instance): - def __init__(self): - super(VoidInstance, self).__init__(None, None) - - def __eq__(self, other): - return isinstance(other, VoidInstance) - - -class Executor: - def __init__(self, context: Context): - self.context: Context = context - self.current_type: Type = None - self.current_instance: Instance = None - self.call_stack: list = [] - - @visitor.on('node') - def visit(self, node, tabs): - pass - - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode, scope: Scope = None): - for declaration in node.declarations: - self.visit(declaration, None) - - try: - main_class = self.context.get_type('Main') - except SemanticError: - raise ExecutionError(err.MAIN_CLASS_NOT_FOUND) - - try: - main_class.get_method('main') - except SemanticError: - raise ExecutionError(err.MAIN_METHOD_NOT_FOUND) - - execution_node = ast.MethodCallNode('main', [], ast.InstantiateNode('Main')) - self.visit(execution_node, scope) - - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode, scope: Scope): - self.current_type = self.context.get_type(node.id) - - attrs = [f for f in node.features if isinstance(f, ast.AttrDeclarationNode)] - methods = [f for f in node.features if isinstance(f, ast.MethodDeclarationNode)] - - for attr in attrs: - self.visit(attr, None) - - for method in methods: - self.visit(method, None) - - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode, scope: Scope): - self.current_type.get_attribute(node.id).expr = node.expr - - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode, scope: Scope): - self.current_type.get_method(node.id).expr = node.body - - @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode, scope: Scope): - default = {'String': '', 'Int': 0, 'Bool': False} - for _id, _type, _expr in node.declarations: - - instance = self.visit(_expr, scope.create_child()) if _expr is not None else VoidInstance() - - if _expr is None and _type in default: - instance = Instance(self.context.get_type(_type), default[_type]) - - scope.define_variable(_id, instance.type).instance = instance - - return self.visit(node.expr, scope.create_child()) - - @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode, scope: Scope): - variable_info = scope.find_variable(node.id) - - if variable_info is None: - self.current_instance.set_attribute_instance(node.id, self.visit(node.expr, scope)) - return self.current_instance.get_attribute_instance(node.id) - - variable_info.instance = self.visit(node.expr, scope) - return variable_info.instance - - @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode, scope: Scope): - child_scope = scope.create_child() - instance = None - for expr in node.expressions: - instance = self.visit(expr, child_scope) - return instance - - @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode, scope: Scope): - if_instance = self.visit(node.if_expr, scope) - - if if_instance.value: - return self.visit(node.then_expr, scope.create_child()) - return self.visit(node.else_expr, scope.create_child()) - - @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode, scope: Scope): - while self.visit(node.condition, scope).value: - self.visit(node.body, scope.create_child()) - return VoidInstance() - - @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode, scope: Scope): - instance = self.visit(node.expr, scope) - - if isinstance(instance, VoidInstance): - raise ExecutionError(err.VOID_EXPRESSION) - - types = [(i, self.context.get_type(t)) for i, (_, t, _) in enumerate(node.cases) - if instance.type.conforms_to(self.context.get_type(t))] - - if not types: - raise ExecutionError(err.CASE_OF_ERROR) - - (index, most_conformable_type), *types = types - for i, t in types: - if t.conforms_to(most_conformable_type): - index, most_conformable_type = i, t - - child_scope = scope.create_child() - name, typex, expr = node.cases[index] - child_scope.define_variable(name, self.context.get_type(typex)).instance = instance - return self.visit(expr, child_scope) - - @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode, scope: Scope): - obj_instance = self.visit(node.obj, scope) - - if isinstance(obj_instance, VoidInstance): - raise ExecutionError(err.VOID_EXPRESSION) - - if obj_instance.type.conforms_to(self.context.get_type('Object')) and ('Object', node.id) in defaults: - args = (obj_instance,) + tuple(self.visit(arg, scope) for arg in node.args) + (self.context,) - return defaults['Object', node.id](*args) - - if obj_instance.type.conforms_to(self.context.get_type('IO')) and ('IO', node.id) in defaults: - args = (obj_instance,) + tuple(self.visit(arg, scope) for arg in node.args) + (self.context,) - return defaults['IO', node.id](*args) - - if obj_instance.type.conforms_to(self.context.get_type('String')) and ('String', node.id) in defaults: - args = (obj_instance,) + tuple(self.visit(arg, scope) for arg in node.args) + (self.context,) - return defaults['String', node.id](*args) - - new_scope = Scope() - - method = obj_instance.get_method(node.id) - new_scope.define_variable('self', obj_instance.type).instance = obj_instance - for name, typex, arg in zip(method.param_names, method.param_types, node.args): - new_scope.define_variable(name, typex).instance = self.visit(arg, scope) - - self.call_stack.append(self.current_instance) - self.current_instance = obj_instance - output = self.visit(method.expr, new_scope) - self.current_instance = self.call_stack.pop() - return output - - @visitor.when(ast.IntegerNode) - def visit(self, node: ast.IntegerNode, scope: Scope): - return Instance(self.context.get_type('Int'), int(node.lex)) - - @visitor.when(ast.StringNode) - def visit(self, node: ast.StringNode, scope: Scope): - return Instance(self.context.get_type('String'), str(node.lex[1:-1].replace('\\n', '\n'))) - - @visitor.when(ast.BooleanNode) - def visit(self, node: ast.BooleanNode, scope: Scope): - return Instance(self.context.get_type('Bool'), True if node.lex == 'true' else False) - - @visitor.when(ast.VariableNode) - def visit(self, node: ast.VariableNode, scope: Scope): - variable_info = scope.find_variable(node.lex) - if variable_info is not None: - return variable_info.instance - else: - return self.current_instance.get_attribute_instance(node.lex) - - @visitor.when(ast.InstantiateNode) - def visit(self, node: ast.InstantiateNode, scope: Scope): - default = None - if node.lex == 'String': - default = '' - elif node.lex == 'Int': - default = 0 - elif node.lex == 'Bool': - default = False - - instance = Instance(self.context.get_type(node.lex), default) - self.call_stack.append(self.current_instance) - self.current_instance = instance - fake_scope = Scope() - for attr, _ in instance.type.all_attributes(): - attr_instance = self.visit(attr.expr, fake_scope) if attr.expr is not None else VoidInstance() - fake_scope.define_variable(attr.name, attr.type).instance = attr_instance - self.current_instance.set_attribute_instance(attr.name, attr_instance) - self.current_instance = self.call_stack.pop() - return instance - - @visitor.when(ast.NegationNode) - def visit(self, node: ast.NegationNode, scope: Scope): - value = not self.visit(node.expr, scope).value - return Instance(self.context.get_type('Bool'), value) - - @visitor.when(ast.ComplementNode) - def visit(self, node: ast.ComplementNode, scope: Scope): - value = ~ self.visit(node.expr, scope).value - return Instance(self.context.get_type('Int'), value) - - @visitor.when(ast.IsVoidNode) - def visit(self, node: ast.IsVoidNode, scope: Scope): - value = isinstance(self.visit(node.expr, scope), VoidInstance) - return Instance(self.context.get_type('Bool'), value) - - @visitor.when(ast.PlusNode) - def visit(self, node: ast.PlusNode, scope: Scope): - value = self.visit(node.left, scope).value + self.visit(node.right, scope).value - return Instance(self.context.get_type('Int'), value) - - @visitor.when(ast.MinusNode) - def visit(self, node: ast.MinusNode, scope: Scope): - value = self.visit(node.left, scope).value - self.visit(node.right, scope).value - return Instance(self.context.get_type('Int'), value) - - @visitor.when(ast.StarNode) - def visit(self, node: ast.StarNode, scope: Scope): - value = self.visit(node.left, scope).value * self.visit(node.right, scope).value - return Instance(self.context.get_type('Int'), value) - - @visitor.when(ast.DivNode) - def visit(self, node: ast.DivNode, scope: Scope): - try: - value = self.visit(node.left, scope).value / self.visit(node.right, scope).value - return Instance(self.context.get_type('Int'), value) - except ZeroDivisionError: - raise ExecutionError(err.DIVIDE_BY_ZERO) - - @visitor.when(ast.LessEqualNode) - def visit(self, node: ast.LessEqualNode, scope: Scope): - value = self.visit(node.left, scope).value <= self.visit(node.right, scope).value - return Instance(self.context.get_type('Bool'), value) - - @visitor.when(ast.LessThanNode) - def visit(self, node: ast.LessThanNode, scope: Scope): - value = self.visit(node.left, scope).value < self.visit(node.right, scope).value - return Instance(self.context.get_type('Bool'), value) - - @visitor.when(ast.EqualNode) - def visit(self, node: ast.EqualNode, scope: Scope): - value = self.visit(node.left, scope).value == self.visit(node.right, scope).value - return Instance(self.context.get_type('Bool'), value) diff --git a/src/cool/semantics/formatter.py b/src/cool/semantics/formatter.py index 52efa7449..d5bb9793b 100644 --- a/src/cool/semantics/formatter.py +++ b/src/cool/semantics/formatter.py @@ -3,52 +3,56 @@ class CodeBuilder: - @visitor.on('node') + @visitor.on("node") def visit(self, node, tabs): pass @visitor.when(ast.ProgramNode) def visit(self, node: ast.ProgramNode, tabs: int = 0): - return '\n\n'.join(self.visit(child, tabs) for child in node.declarations) + return "\n\n".join(self.visit(child, tabs) for child in node.declarations) @visitor.when(ast.ClassDeclarationNode) def visit(self, node: ast.ClassDeclarationNode, tabs: int = 0): - parent = '' if node.parent is None else f"inherits {node.parent} " - return (f'class {node.id} {parent}{{\n' + - '\n\n'.join(self.visit(child, tabs + 1) for child in node.features) + - '\n}') + parent = "" if node.parent is None else f"inherits {node.parent} " + return ( + f"class {node.id} {parent}{{\n" + + "\n\n".join(self.visit(child, tabs + 1) for child in node.features) + + "\n}" + ) @visitor.when(ast.AttrDeclarationNode) def visit(self, node: ast.AttrDeclarationNode, tabs: int = 0): - expr = f' <- {self.visit(node.expr, 0)}' if node.expr is not None else '' - return ' ' * tabs + f'{node.id}: {node.type}{expr};' + expr = f" <- {self.visit(node.expr, 0)}" if node.expr is not None else "" + return " " * tabs + f"{node.id}: {node.type}{expr};" @visitor.when(ast.MethodDeclarationNode) def visit(self, node: ast.MethodDeclarationNode, tabs: int = 0): - params = ', '.join(': '.join(param) for param in node.params) - ans = ' ' * tabs + f'{node.id} ({params}): {node.return_type}' + params = ", ".join(": ".join(param) for param in node.params) + ans = " " * tabs + f"{node.id} ({params}): {node.return_type}" body = self.visit(node.body, tabs + 1) - return f'{ans} {{\n{body}\n }};' + return f"{ans} {{\n{body}\n }};" @visitor.when(ast.LetNode) def visit(self, node: ast.LetNode, tabs: int = 0): declarations = [] for _id, _type, _expr in node.declarations: if _expr is not None: - declarations.append(f'{_id}: {_type} <- {self.visit(_expr)}') + declarations.append(f"{_id}: {_type} <- {self.visit(_expr)}") else: - declarations.append(f'{_id} : {_type}') - declarations = (',\n' + ' ' * (tabs + 1)).join(declarations) - return ' ' * tabs + f'let {declarations} in\n{self.visit(node.expr, tabs + 1)}' + declarations.append(f"{_id} : {_type}") + declarations = (",\n" + " " * (tabs + 1)).join(declarations) + return ( + " " * tabs + f"let {declarations} in\n{self.visit(node.expr, tabs + 1)}" + ) @visitor.when(ast.AssignNode) def visit(self, node: ast.AssignNode, tabs: int = 0): - return ' ' * tabs + f'{node.id} <- {self.visit(node.expr)}' + return " " * tabs + f"{node.id} <- {self.visit(node.expr)}" @visitor.when(ast.BlockNode) def visit(self, node: ast.BlockNode, tabs: int = 0): - body = ';\n'.join(self.visit(child, tabs + 1) for child in node.expressions) - return ' ' * tabs + f'{{\n{body};\n' + ' ' * tabs + '}' + body = ";\n".join(self.visit(child, tabs + 1) for child in node.expressions) + return " " * tabs + f"{{\n{body};\n" + " " * tabs + "}" @visitor.when(ast.ConditionalNode) def visit(self, node: ast.ConditionalNode, tabs: int = 0): @@ -56,105 +60,136 @@ def visit(self, node: ast.ConditionalNode, tabs: int = 0): then = self.visit(node.then_expr, tabs + 1) elsex = self.visit(node.else_expr, tabs + 1) - return (' ' * tabs + f'if {ifx}\n' + - ' ' * tabs + f'then\n{then}\n' + - ' ' * tabs + f'else\n{elsex}\n' + - ' ' * tabs + 'fi') + return ( + " " * tabs + + f"if {ifx}\n" + + " " * tabs + + f"then\n{then}\n" + + " " * tabs + + f"else\n{elsex}\n" + + " " * tabs + + "fi" + ) @visitor.when(ast.WhileNode) def visit(self, node: ast.WhileNode, tabs: int = 0): condition = self.visit(node.condition, 0) body = self.visit(node.body, tabs + 1) - return ' ' * tabs + f'while {condition} loop\n {body}\n' + ' ' * tabs + 'pool' + return ( + " " * tabs + + f"while {condition} loop\n {body}\n" + + " " * tabs + + "pool" + ) @visitor.when(ast.SwitchCaseNode) def visit(self, node: ast.SwitchCaseNode, tabs: int = 0): cases = [] for _id, _type, _expr in node.cases: expr = self.visit(_expr, tabs + 2) - cases.append(' ' * (tabs + 1) + f'{_id} : {_type} =>\n{expr};') + cases.append(" " * (tabs + 1) + f"{_id} : {_type} =>\n{expr};") expr = self.visit(node.expr) - cases = '\n'.join(cases) + cases = "\n".join(cases) - return ' ' * tabs + f'case {expr} of\n{cases}\n' + ' ' * tabs + 'esac' + return " " * tabs + f"case {expr} of\n{cases}\n" + " " * tabs + "esac" @visitor.when(ast.MethodCallNode) def visit(self, node: ast.MethodCallNode, tabs: int = 0): - obj = f'{self.visit(node.obj, 0)}.' if node.obj is not None else '' - return ' ' * tabs + f'{obj}{node.id}({", ".join(self.visit(arg, 0) for arg in node.args)})' + obj = f"{self.visit(node.obj, 0)}." if node.obj is not None else "" + return ( + " " * tabs + + f'{obj}{node.id}({", ".join(self.visit(arg, 0) for arg in node.args)})' + ) @visitor.when(ast.BinaryNode) def visit(self, node: ast.BinaryNode, tabs: int = 0): - left = self.visit(node.left) if isinstance(node.left, ast.BinaryNode) else self.visit(node.left, tabs) + left = ( + self.visit(node.left) + if isinstance(node.left, ast.BinaryNode) + else self.visit(node.left, tabs) + ) right = self.visit(node.right) - return f'{left} {node.operation} {right}' + return f"{left} {node.operation} {right}" @visitor.when(ast.AtomicNode) def visit(self, node: ast.AtomicNode, tabs: int = 0): lex = node.lex - return ' ' * tabs + f'{lex}' + return " " * tabs + f"{lex}" @visitor.when(ast.InstantiateNode) def visit(self, node: ast.InstantiateNode, tabs: int = 0): - return ' ' * tabs + f'(new {node.lex})' + return " " * tabs + f"(new {node.lex})" class Formatter: - @visitor.on('node') + @visitor.on("node") def visit(self, node, tabs): pass @visitor.when(ast.ProgramNode) def visit(self, node: ast.ProgramNode, tabs: int = 0): - ans = ' ' * tabs + f'\\__ProgramNode [ ... ]' - statements = '\n'.join(self.visit(child, tabs + 1) for child in node.declarations) - return f'{ans}\n{statements}' + ans = " " * tabs + f"\\__ProgramNode [ ... ]" + statements = "\n".join( + self.visit(child, tabs + 1) for child in node.declarations + ) + return f"{ans}\n{statements}" @visitor.when(ast.ClassDeclarationNode) def visit(self, node: ast.ClassDeclarationNode, tabs: int = 0): - parent = '' if node.parent is None else f": {node.parent}" - ans = ' ' * 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}' + parent = "" if node.parent is None else f": {node.parent}" + ans = ( + " " * 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(ast.AttrDeclarationNode) def visit(self, node: ast.AttrDeclarationNode, tabs: int = 0): - ans = ' ' * tabs + f'\\__AttrDeclarationNode: {node.id} : {node.type}' - return f'{ans}' + ans = " " * tabs + f"\\__AttrDeclarationNode: {node.id} : {node.type}" + return f"{ans}" @visitor.when(ast.MethodDeclarationNode) def visit(self, node: ast.MethodDeclarationNode, tabs: int = 0): - params = ', '.join(':'.join(param) for param in node.params) - ans = ' ' * tabs + f'\\__FuncDeclarationNode: {node.id}({params}) : {node.return_type} -> ' + params = ", ".join(":".join(param) for param in node.params) + ans = ( + " " * tabs + + f"\\__FuncDeclarationNode: {node.id}({params}) : {node.return_type} -> " + ) body = self.visit(node.body, tabs + 1) - return f'{ans}\n{body}' + return f"{ans}\n{body}" @visitor.when(ast.LetNode) def visit(self, node: ast.LetNode, tabs: int = 0): declarations = [] for _id, _type, _expr in node.declarations: if _expr is not None: - declarations.append(' ' * tabs + f'\\__VarDeclarationNode: {_id}: {_type} <-\n{self.visit(_expr, tabs + 1)}') + declarations.append( + " " * tabs + + f"\\__VarDeclarationNode: {_id}: {_type} <-\n{self.visit(_expr, tabs + 1)}" + ) else: - declarations.append(' ' * tabs + f'\\__VarDeclarationNode: {_id} : {_type}') + declarations.append( + " " * tabs + f"\\__VarDeclarationNode: {_id} : {_type}" + ) - declarations = '\n'.join(declarations) - ans = ' ' * tabs + f'\\__LetNode: let' + declarations = "\n".join(declarations) + ans = " " * tabs + f"\\__LetNode: let" expr = self.visit(node.expr, tabs + 2) - return f'{ans}\n {declarations}\n' + ' ' * (tabs + 1) + 'in\n' + f'{expr}' + return f"{ans}\n {declarations}\n" + " " * (tabs + 1) + "in\n" + f"{expr}" @visitor.when(ast.AssignNode) def visit(self, node: ast.AssignNode, tabs: int = 0): - ans = ' ' * tabs + f'\\__AssignNode: {node.id} <- ' + ans = " " * tabs + f"\\__AssignNode: {node.id} <- " expr = self.visit(node.expr, tabs + 1) - return f'{ans}\n{expr}' + return f"{ans}\n{expr}" @visitor.when(ast.BlockNode) def visit(self, node: ast.BlockNode, tabs: int = 0): - ans = ' ' * tabs + f'\\__BlockNode:' - body = '\n'.join(self.visit(child, tabs + 1) for child in node.expressions) - return f'{ans}\n{body}' + ans = " " * tabs + f"\\__BlockNode:" + body = "\n".join(self.visit(child, tabs + 1) for child in node.expressions) + return f"{ans}\n{body}" @visitor.when(ast.ConditionalNode) def visit(self, node: ast.ConditionalNode, tabs: int = 0): @@ -162,56 +197,68 @@ def visit(self, node: ast.ConditionalNode, tabs: int = 0): then = self.visit(node.then_expr, tabs + 2) elsex = self.visit(node.else_expr, tabs + 2) - return '\n'.join([ - ' ' * tabs + f'\\__IfThenElseNode: if then else fi', - ' ' * (tabs + 1) + f'\\__if \n{ifx}', - ' ' * (tabs + 1) + f'\\__then \n{then}', - ' ' * (tabs + 1) + f'\\__else \n{elsex}', - ]) + return "\n".join( + [ + " " * tabs + + f"\\__IfThenElseNode: if then else fi", + " " * (tabs + 1) + f"\\__if \n{ifx}", + " " * (tabs + 1) + f"\\__then \n{then}", + " " * (tabs + 1) + f"\\__else \n{elsex}", + ] + ) @visitor.when(ast.WhileNode) def visit(self, node: ast.WhileNode, tabs: int = 0): condition = self.visit(node.condition, tabs + 2) body = self.visit(node.body, tabs + 2) - return '\n'.join([ - ' ' * tabs + f'\\__WhileNode: while loop pool', - ' ' * (tabs + 1) + f'\\__while \n{condition}', - ' ' * (tabs + 1) + f'\\__loop \n{body}', - ]) + return "\n".join( + [ + " " * tabs + f"\\__WhileNode: while loop pool", + " " * (tabs + 1) + f"\\__while \n{condition}", + " " * (tabs + 1) + f"\\__loop \n{body}", + ] + ) @visitor.when(ast.SwitchCaseNode) def visit(self, node: ast.SwitchCaseNode, tabs: int = 0): cases = [] for _id, _type, _expr in node.cases: expr = self.visit(_expr, tabs + 3) - cases.append(' ' * tabs + f'\\__CaseNode: {_id} : {_type} =>\n{expr}') + cases.append(" " * tabs + f"\\__CaseNode: {_id} : {_type} =>\n{expr}") expr = self.visit(node.expr, tabs + 2) - cases = '\n'.join(cases) - - return '\n'.join([ - ' ' * tabs + f'\\__SwitchCaseNode: case of [ ... ] esac', - ' ' * (tabs + 1) + f'\\__case \n{expr} of', - ]) + '\n' + cases + cases = "\n".join(cases) + + return ( + "\n".join( + [ + " " * tabs + + f"\\__SwitchCaseNode: case of [ ... ] esac", + " " * (tabs + 1) + f"\\__case \n{expr} of", + ] + ) + + "\n" + + cases + ) @visitor.when(ast.MethodCallNode) def visit(self, node: ast.MethodCallNode, tabs: int = 0): obj = self.visit(node.obj, tabs + 1) - ans = ' ' * 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}' + ans = " " * 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(ast.BinaryNode) def visit(self, node: ast.BinaryNode, tabs: int = 0): - ans = ' ' * tabs + f'\\__ {node.__class__.__name__} ' + ans = " " * 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}' + return f"{ans}\n{left}\n{right}" @visitor.when(ast.AtomicNode) def visit(self, node: ast.AtomicNode, tabs: int = 0): - return ' ' * tabs + f'\\__ {node.__class__.__name__}: {node.lex}' + return " " * tabs + f"\\__ {node.__class__.__name__}: {node.lex}" @visitor.when(ast.InstantiateNode) def visit(self, node: ast.InstantiateNode, tabs: int = 0): - return ' ' * tabs + f'\\__ InstantiateNode: new {node.lex}()' + return " " * tabs + f"\\__ InstantiateNode: new {node.lex}()" diff --git a/src/cool/semantics/overridden.py b/src/cool/semantics/overridden.py index fd0f6e07b..75ab070c9 100644 --- a/src/cool/semantics/overridden.py +++ b/src/cool/semantics/overridden.py @@ -1,14 +1,14 @@ -from typing import List, Dict, Optional +from typing import List, Dict, Optional, OrderedDict import cool.semantics.utils.astnodes as ast import cool.semantics.utils.errors as err import cool.visitor as visitor -from cool.semantics.utils.scope import Context, Type, SemanticError +from cool.semantics.utils.scope import Context, ErrorType, Type, SemanticError -def topological_sorting(program_node: ast.ProgramNode, - context: Context, - errors: List[str]) -> ast.ProgramNode: +def topological_sorting( + program_node: ast.ProgramNode, context: Context, errors: List[str] +) -> bool: """Set an order in the program node of de ast such that for all class A with parent B, class B is before A in the list, if in the process is detected a cycle an error is added to the `error` parameter @@ -22,55 +22,66 @@ def topological_sorting(program_node: ast.ProgramNode, types = context.types - graph: Dict[str, List[str]] = {name: [] for name in types if name not in ('SELF_TYPE', 'AUTO_TYPE')} + contains_dependency_errors = False + graph: Dict[str, List[str]] = { + name: [] for name in types if name not in ("SELF_TYPE", "AUTO_TYPE") + } + declarations = {d.id: d for d in program_node.declarations} for name, typex in types.items(): - if name in ('Object', 'SELF_TYPE', 'AUTO_TYPE'): + if name in ("Object", "SELF_TYPE", "AUTO_TYPE") or typex.parent is None: continue graph[typex.parent.name].append(name) - order = [] visited = set() - stack = ['Object'] + stack = ["Object"] while stack: current_name = stack.pop() if current_name in visited: - errors.append(f'DependencyError: Circular class dependency involving class {current_name}.') + line, column = declarations[current_name].parent_position + errors.append( + err.CYCLIC_DEPENDENCY % (line, column, current_name, current_name) + ) + contains_dependency_errors = True visited.add(current_name) stack += graph[current_name] - order.append(current_name) if len(visited) != len(graph): - types_names = set(x for x in context.types if x not in ('SELF_TYPE', 'AUTO_TYPE')) + types_names = set( + x for x in context.types if x not in ("SELF_TYPE", "AUTO_TYPE") + ) exclude_type_names = types_names - visited - errors.append(f'DependencyError: Circular class dependency ' - f'involving class {sorted(exclude_type_names, reverse=True).pop()}.') - declarations = {d.id: d for d in program_node.declarations} - program_node.declarations = [declarations[name] for name in order if - name not in ('Object', 'Int', 'IO', 'String', 'Bool')] + # Select the last declared class that belongs to the cycle + reference_class = max(exclude_type_names, key=lambda x: declarations[x].line) + line, column = declarations[reference_class].parent_position + errors.append( + err.CYCLIC_DEPENDENCY % (line, column, reference_class, reference_class) + ) + + contains_dependency_errors = True - return program_node + return contains_dependency_errors class OverriddenMethodChecker: """This visitor for validate the signature of the overridden methods - Params - ------ - - syntactic_and_semantic_errors: List[str] is a list of syntactic_and_semantic_errors detected in the ast travel - - context: Context the context for keeping the classes - - current_type: Optional[Type] is the current type in the building process""" + Params + ------ + - syntactic_and_semantic_errors: List[str] is a list of syntactic_and_semantic_errors detected in the ast travel + - context: Context the context for keeping the classes + - current_type: Optional[Type] is the current type in the building process""" def __init__(self, context: Context, errors: List[str]): self.context: Context = context self.current_type: Optional[Type] = None self.errors: List[str] = errors - @visitor.on('node') + @visitor.on("node") def visit(self, node): pass @@ -91,7 +102,9 @@ def visit(self, node: ast.ClassDeclarationNode): def visit(self, node: ast.AttrDeclarationNode): try: attribute, owner = self.current_type.parent.get_attribute(node.id) - self.errors.append(err.ATTRIBUTE_OVERRIDE_ERROR % (attribute.name, owner.name)) + self.errors.append( + err.ATTRIBUTE_OVERRIDE_ERROR % (attribute.name, owner.name) + ) except SemanticError: pass @@ -100,8 +113,37 @@ def visit(self, node: ast.MethodDeclarationNode): # TODO: Change the comparison overriding current_method = self.current_type.get_method(node.id) try: - method, owner = self.current_type.parent.get_method(node.id, get_owner=True) - if method != current_method: - self.errors.append(err.METHOD_OVERRIDE_ERROR % (node.id, owner.name)) + original_method, _ = self.current_type.parent.get_method( + node.id, get_owner=True + ) + + current_count = len(current_method.param_types) + original_count = len(original_method.param_types) + if current_count != original_count: + line, column = node.line, node.column + self.errors.append( + err.METHOD_OVERRIDE_PARAM_ERROR + % (line, column, node.id, original_count, current_count) + ) + + count = min(original_count, current_count) + for i in range(count): + current_type = current_method.param_types[i].name + original_type = original_method.param_types[i].name + if current_type != original_type: + line, column = node.param_types_positions[i] + self.errors.append( + err.METHOD_OVERRIDE_PARAM_ERROR + % (line, column, node.id, current_type, original_method) + ) + + current_return_type = current_method.return_type.name + original_return_type = original_method.return_type.name + if current_return_type != original_return_type: + line, column = node.return_type_position + self.errors.append( + err.METHOD_OVERRIDE_RETURN_ERROR + % (line, column, node.id, current_return_type, original_return_type) + ) except SemanticError: pass diff --git a/src/cool/semantics/position_assigner.py b/src/cool/semantics/position_assigner.py new file mode 100644 index 000000000..75c419511 --- /dev/null +++ b/src/cool/semantics/position_assigner.py @@ -0,0 +1,441 @@ +from typing import List +from cool.code_generation.cil import PlusNode + +import cool.semantics.utils.astnodes as ast +import cool.visitor as visitor +from pyjapt import Token + + +class PositionAssigner: + def __init__(self, tokens: List[Token]): + self.position = 0 + self.tokens = tokens + + def inc_position(self, count: int = 1): + self.position += count + + @visitor.on("node") + def visit(self, node): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode): + + for declaration in node.declarations: + self.visit(declaration) + self.inc_position() + + first_declaration = node.declarations[ + 0 + ] # There is always one or more declarations + node.set_main_position(first_declaration.line, first_declaration.column) + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode): + """ + * + class type [inherits type] { feature-list } + """ + token = self.tokens[self.position] + assert ( + token.lex == "class" + ), f'Expected "class" instead of "{token.lex}" in {node.id}' + + token = self.tokens[self.position + 1] + node.set_main_position(token.line, token.column) + + if node.parent is not None: + token = self.tokens[self.position + 3] + node.parent_position = token.line, token.column + + count = 3 if node.parent is None else 5 + self.inc_position(count) + + for feature in node.features: + self.visit(feature) + + token = self.tokens[self.position] + assert ( + token.lex == ";" + ), f'Expected ";" instead of "{token.lex}" in {feature.id} of class {node.id}' + + self.inc_position() # ends after `;` + + self.inc_position() # ends after `}` + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode): + """ + * + id : type [<- expr] + """ + token = self.tokens[self.position] + node.set_main_position(token.line, token.column) + + token = self.tokens[self.position + 2] + node.type_position = token.line, token.column + + if node.expr is not None: + self.inc_position(4) # ends after `<-` + + token = self.tokens[self.position] + node.expr_position = token.line, token.column + + self.visit(node.expr) + + token = self.tokens[self.position] + return + + self.inc_position(3) + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode): + """ + * + id ( [params] ) : type { expr } + """ + token = self.tokens[self.position] + node.set_main_position(token.line, token.column) + + self.inc_position(2) # ends after `(` + + for i, _ in enumerate(node.params): + # * + # id : type , + self.inc_position(2) # ends in `type` + + token = self.tokens[self.position] + node.param_types_positions.append((token.line, token.column)) + + self.inc_position() # ends in `,` + + if i < len(node.params) - 1: + self.inc_position() # ends in `,` + # ends in `)` + + self.inc_position(2) # ends in `type` + token = self.tokens[self.position] + node.return_type_position = token.line, token.column + self.inc_position(2) # ends after `{` + + self.visit(node.body) + self.inc_position() # ends after `}` + + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode): + """ + * + let declaration-list in expr + """ + token = self.tokens[self.position] + node.set_main_position(token.line, token.column) + + self.inc_position() + + for _, _, expr in node.declarations: + # * + # id : type [<- expr] , + + token = self.tokens[self.position] + node.declaration_names_positions.append((token.line, token.column)) + + token = self.tokens[self.position + 2] + node.declaration_types_positions.append((token.line, token.column)) + + if expr is not None: + self.inc_position(4) # ends after `<-` + + token = self.tokens[self.position] + self.visit(expr) + self.inc_position() # ends after `,` + else: + self.inc_position(4) # ends after `,` or `in` if last + # ends after `in` + + self.visit(node.expr) + + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode): + """ + * + id <- expr + """ + + token = self.tokens[self.position] + node.set_main_position(token.line, token.column) + + token = self.tokens[self.position + 1] + assert token.lex == "<-", f'Expected "<-" instead of "{token.lex}" in assign' + + self.inc_position(2) # ends after `<-` + self.visit(node.expr) + + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode): + """ + * + { block } + """ + token = self.tokens[self.position] + assert token.lex == "{", f'Expected "{{" instead of "{token.lex}" in block' + + node.set_main_position(token.line, token.column) + self.inc_position() # edns after `{` + + for i, expr in enumerate(node.expressions, start=1): + # * + # expr ; + self.visit(expr) + + token = self.tokens[self.position] + assert ( + token.lex == ";" + ), f'Expected ";" instead of "{token.lex}" in instruction {i} of a block' + + self.inc_position() # ends after `;` + + token = self.tokens[self.position] + assert ( + token.lex == "}" + ), f'Expected "}}" instead of "{token.lex}" at the end of a block' + + self.inc_position() # ends after `}` + + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode): + """ + * + if expr then expr else expr fi + """ + + token = self.tokens[self.position] + assert ( + token.lex == "if" + ), f'Expected "if" instead of "{token.lex}" in conditional' + node.set_main_position(token.line, token.column) + self.inc_position() # ends after `if` + self.visit(node.if_expr) + + token = self.tokens[self.position] + assert ( + token.lex == "then" + ), f'Expected "then" instead of "{token.lex}" in conditional' + self.inc_position() # ends after `then` + self.visit(node.then_expr) + + token = self.tokens[self.position] + assert ( + token.lex == "else" + ), f'Expected "else" instead of "{token.lex}" in conditional' + self.inc_position() # ends after `else` + self.visit(node.else_expr) + + token = self.tokens[self.position] + assert ( + token.lex == "fi" + ), f'Expected "fi" instead of "{token.lex}" in conditional' + self.inc_position() # ends after `fi` + + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode): + """ + * + while expr loop expr pool + """ + + token = self.tokens[self.position] + node.set_main_position(token.line, token.column) + + self.inc_position() # ends after `while` + self.visit(node.condition) + + self.inc_position() # ends after `loop` + self.visit(node.body) + + self.inc_position() # ends after `pool` + + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode): + """ + * + case expr of case-list esac + """ + + token = self.tokens[self.position] + node.set_main_position(token.line, token.column) + + self.inc_position() # ends afte `case` + self.visit(node.expr) + + self.inc_position() # ends after `of` + for _, _, expr in node.cases: + # * + # id : type => expr ; + self.inc_position(2) # ends in `type` + + token = self.tokens[self.position] + node.cases_positions.append((token.line, token.column)) + + self.inc_position(2) # ends after `=>` + self.visit(expr) + self.inc_position() # ends after `;` + + self.inc_position() # ends afte `esac` + + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode): + """ + * + id ( expr-list ) + atom . id ( expr-list ) + atom @ type . id ( expr-list ) + """ + + token = self.tokens[self.position] + node.set_main_position(token.line, token.column) + node.id_position = token.line, token.column + + obj_not_none = node.obj is not None + type_not_none = node.type is not None + + if obj_not_none: + self.visit(node.obj) + + token = self.tokens[self.position] + assert token.lex in ( + ".", + "@", + ), f"Expected '.' or '@' instead of {token.lex}" + + self.inc_position() # ends after `.` or `@` + token = self.tokens[self.position] + node.id_position = token.line, token.column + + if type_not_none: + token = self.tokens[self.position] + node.type_position = token.line, token.column + + self.inc_position(2) # ends after `.` + token = self.tokens[self.position] + node.id_position = token.line, token.column + + self.inc_position(2) # ends after `(` + + token = self.tokens[self.position] + if node.args: + for arg in node.args: + # * + # expr , expr-list + token = self.tokens[self.position] + node.args_positions.append((token.line, token.column)) + + self.visit(arg) + + token = self.tokens[self.position] + assert token.lex in ( + "," ")" + ), f"Expected ',' or ')' instead of {token.lex}" + + self.inc_position() # ends after `,` or `)` + # ends after `)` + else: + self.inc_position() + + @visitor.when(ast.IntegerNode) + def visit(self, node: ast.IntegerNode): + self._atom_node(node) + + @visitor.when(ast.StringNode) + def visit(self, node: ast.StringNode): + self._atom_node(node) + + @visitor.when(ast.BooleanNode) + def visit(self, node: ast.BooleanNode): + self._atom_node(node) + + @visitor.when(ast.VariableNode) + def visit(self, node: ast.VariableNode): + self._atom_node(node) + + @visitor.when(ast.InstantiateNode) + def visit(self, node: ast.InstantiateNode): + """ + * + new type + """ + token = self.tokens[self.position] + node.set_main_position(token.line, token.column) + + token = self.tokens[self.position + 1] + node.type_position = token.line, token.column + self.inc_position(2) # ends after `type` + + @visitor.when(ast.NegationNode) + def visit(self, node: ast.NegationNode): + self._check_unary_operation(node) + + @visitor.when(ast.ComplementNode) + def visit(self, node: ast.ComplementNode): + self._check_unary_operation(node) + + @visitor.when(ast.IsVoidNode) + def visit(self, node: ast.IsVoidNode): + self._check_unary_operation(node) + + @visitor.when(ast.PlusNode) + def visit(self, node: ast.PlusNode): + self._check_binary_operation(node) + + @visitor.when(ast.MinusNode) + def visit(self, node: ast.MinusNode): + self._check_binary_operation(node) + + @visitor.when(ast.StarNode) + def visit(self, node: ast.StarNode): + self._check_binary_operation(node) + + @visitor.when(ast.DivNode) + def visit(self, node: ast.DivNode): + self._check_binary_operation(node) + + @visitor.when(ast.LessEqualNode) + def visit(self, node: ast.LessEqualNode): + self._check_binary_operation(node) + + @visitor.when(ast.LessThanNode) + def visit(self, node: ast.LessThanNode): + self._check_binary_operation(node) + + @visitor.when(ast.EqualNode) + def visit(self, node: ast.EqualNode): + self._check_binary_operation(node) + + def _check_binary_operation(self, node: ast.BinaryNode): + """ + expr operation expr + """ + self.visit(node.left) + + token = self.tokens[self.position] + node.set_main_position(token.line, token.column) + self.inc_position() # ends after `operation` + + self.visit(node.right) + + def _check_unary_operation(self, node: ast.UnaryNode): + """ + operation expr + """ + token = self.tokens[self.position] + node.operation_position = token.line, token.column + + token = self.tokens[self.position + 1] + node.set_main_position(token.line, token.column) + + self.inc_position() # ends after `operation` + self.visit(node.expr) + + def _atom_node(self, node: ast.Node): + token = self.tokens[self.position] + node.set_main_position(token.line, token.column) + self.inc_position() # ends after `atom` diff --git a/src/cool/semantics/type_builder.py b/src/cool/semantics/type_builder_for_features.py similarity index 53% rename from src/cool/semantics/type_builder.py rename to src/cool/semantics/type_builder_for_features.py index 0d7479b31..436b1780c 100644 --- a/src/cool/semantics/type_builder.py +++ b/src/cool/semantics/type_builder_for_features.py @@ -1,80 +1,94 @@ -from typing import List, Optional - -import cool.semantics.utils.astnodes as ast -import cool.semantics.utils.errors as err -import cool.visitor as visitor -from cool.semantics.utils.scope import Context, SemanticError, Type, ErrorType - - -class TypeBuilder: - """This visitor collect all the attributes and methods in classes and set the parent to the current class - - Params - ------ - - syntactic_and_semantic_errors: List[str] is a list of syntactic_and_semantic_errors detected in the ast travel - - context: Context the context for keeping the classes - - current_type: Optional[Type] is the current type in the building process""" - - def __init__(self, context: Context, errors: List[str]): - self.context: Context = context - self.current_type: Optional[Type] = None - self.errors: List[str] = errors - - @visitor.on('node') - def visit(self, node): - pass - - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode): - for declaration in node.declarations: - self.visit(declaration) - - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode): - self.current_type = self.context.get_type(node.id) - - if node.parent is not None: - if node.parent in ("Int", "String", "Bool", "SELF_TYPE"): - self.errors.append(err.INVALID_PARENT_TYPE % (node.id, node.parent)) - - try: - self.current_type.set_parent(self.context.get_type(node.parent)) - except SemanticError as e: - self.errors.append(e.text) - else: - self.current_type.set_parent(self.context.get_type('Object')) - - for feature in node.features: - self.visit(feature) - - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode): - try: - self.current_type.define_attribute(node.id, self.context.get_type(node.type)) - except SemanticError as e: - self.errors.append(e.text) - self.current_type.define_attribute(node.id, ErrorType()) - - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode): - param_names = [] - param_types = [] - for name, typex in node.params: - param_names.append(name) - try: - param_types.append(self.context.get_type(typex)) - except SemanticError as e: - param_types.append(ErrorType()) - self.errors.append(e.text) - - try: - return_type = self.context.get_type(node.return_type) - except SemanticError as e: - return_type = ErrorType() - self.errors.append(e.text) - - try: - self.current_type.define_method(node.id, param_names, param_types, return_type) - except SemanticError as e: - self.errors.append(e.text) - +from typing import List, Optional + +import cool.semantics.utils.astnodes as ast +import cool.semantics.utils.errors as err +import cool.visitor as visitor +from cool.semantics.utils.scope import Context, SemanticError, Type, ErrorType + + +class TypeBuilderForFeatures: + """This visitor collect all the attributes and methods in classes and set the parent to the current class + + Params + ------ + - syntactic_and_semantic_errors: List[str] is a list of syntactic_and_semantic_errors detected in the ast travel + - context: Context the context for keeping the classes + - current_type: Optional[Type] is the current type in the building process""" + + def __init__(self, context: Context, errors: List[str]): + self.context: Context = context + self.current_type: Optional[Type] = None + self.errors: List[str] = errors + + @visitor.on("node") + def visit(self, node): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode): + for declaration in node.declarations: + self.visit(declaration) + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode): + self.current_type = self.context.get_type(node.id) + + for feature in node.features: + self.visit(feature) + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode): + try: + attr_type = self.context.get_type(node.type) + except SemanticError: + attr_type = ErrorType() + line, column = node.type_position + self.errors.append( + err.UNDEFINED_ATTRIBUTE_TYPE + % (line, column, node.type, node.id, self.current_type.name) + ) + + try: + self.current_type.define_attribute(node.id, attr_type) + except SemanticError: + self.errors.append( + err.ATTRIBUTE_ALREADY_DEFINED + % (node.line, node.column, node.id, self.current_type.name) + ) + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode): + param_names = [] + param_types = [] + + for i, (name, typex) in enumerate(node.params): + param_names.append(name) + try: + param_types.append(self.context.get_type(typex)) + except SemanticError: + param_types.append(ErrorType()) + line, column = node.param_types_positions[i] + self.errors.append( + err.UNDEFINED_PARAM_TYPE + % (line, column, typex, node.id, self.current_type.name) + ) + + try: + return_type = self.context.get_type(node.return_type) + except SemanticError: + return_type = ErrorType() + line, column = node.return_type_position + self.errors.append( + err.UNDEFINED_RETURN_TYPE + % (line, column, node.return_type, node.id, self.current_type.name) + ) + + try: + self.current_type.define_method( + node.id, param_names, param_types, return_type + ) + except SemanticError: + self.errors.append( + err.METHOD_ALREADY_DEFINED + % (node.line, node.column, node.id, self.current_type.name) + ) diff --git a/src/cool/semantics/type_builder_for_inheritance.py b/src/cool/semantics/type_builder_for_inheritance.py new file mode 100644 index 000000000..840b216b9 --- /dev/null +++ b/src/cool/semantics/type_builder_for_inheritance.py @@ -0,0 +1,73 @@ +from typing import List, Optional + +import cool.semantics.utils.astnodes as ast +import cool.semantics.utils.errors as err +import cool.visitor as visitor +from cool.semantics.utils.scope import Context, SemanticError, Type, ErrorType + + +class TypeBuilderForInheritance: + """This visitor collect all the attributes and methods in classes and set the parent to the current class + + Params + ------ + - syntactic_and_semantic_errors: List[str] is a list of syntactic_and_semantic_errors detected in the ast travel + - context: Context the context for keeping the classes + - current_type: Optional[Type] is the current type in the building process""" + + def __init__(self, context: Context, errors: List[str]): + self.context: Context = context + self.current_type: Optional[Type] = None + self.errors: List[str] = errors + + @visitor.on("node") + def visit(self, node): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode): + for declaration in node.declarations: + self.visit(declaration) + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode): + self.current_type = self.context.get_type(node.id) + + if node.parent is not None: + if node.parent in ("Int", "String", "Bool", "SELF_TYPE"): + line, column = node.parent_position + self.errors.append( + err.INVALID_PARENT_TYPE % (line, column, node.id, node.parent) + ) + + try: + parent_type = self.context.get_type(node.parent) + except SemanticError: + parent_type = self.context.get_type("Object") + line, column = node.parent_position + self.errors.append( + err.PARENT_UNDEFINED % (line, column, node.id, node.parent) + ) + + try: + self.current_type.set_parent(parent_type) + except SemanticError: + self.errors.append( + err.PARENT_ALREADY_SET % (node.line, node.column, node.id) + ) + + else: + try: + self.current_type.set_parent(self.context.get_type("Object")) + except SemanticError: + if node.id not in ( + "Int", + "String", + "Bool", + "IO", + "Object", + "SELF_TYPE", + ): + self.errors.append( + err.PARENT_ALREADY_SET % (node.line, node.column, node.id) + ) diff --git a/src/cool/semantics/type_checker.py b/src/cool/semantics/type_checker.py index 434e2dc45..dabfb04ae 100644 --- a/src/cool/semantics/type_checker.py +++ b/src/cool/semantics/type_checker.py @@ -1,20 +1,28 @@ -from typing import List +from inspect import Attribute +from typing import List, Optional import cool.semantics.utils.astnodes as ast import cool.semantics.utils.errors as err import cool.visitor as visitor -from cool.semantics.utils.scope import (Context, ErrorType, Method, Scope, - SemanticError, Type) +from cool.semantics.utils.scope import ( + Context, + ErrorType, + Method, + Scope, + SemanticError, + Type, +) class TypeChecker: def __init__(self, context: Context, errors: List[str]): self.context: Context = context self.errors: List[str] = errors - self.current_type: Type = None - self.current_method: Method = None + self.current_type: Optional[Type] = None + self.current_method: Optional[Method] = None + self.current_attribute: Optional[Attribute] = None - @visitor.on('node') + @visitor.on("node") def visit(self, node, scope): pass @@ -32,8 +40,16 @@ def visit(self, node: ast.ProgramNode, scope: Scope = None): def visit(self, node: ast.ClassDeclarationNode, scope: Scope): self.current_type = self.context.get_type(node.id) - attrs = [feature for feature in node.features if isinstance(feature, ast.AttrDeclarationNode)] - methods = [feature for feature in node.features if isinstance(feature, ast.MethodDeclarationNode)] + attrs = [ + feature + for feature in node.features + if isinstance(feature, ast.AttrDeclarationNode) + ] + methods = [ + feature + for feature in node.features + if isinstance(feature, ast.MethodDeclarationNode) + ] for attr, attr_owner in self.current_type.all_attributes(): if attr_owner != self.current_type: @@ -47,62 +63,119 @@ def visit(self, node: ast.ClassDeclarationNode, scope: Scope): @visitor.when(ast.AttrDeclarationNode) def visit(self, node: ast.AttrDeclarationNode, scope: Scope): - if node.id == 'self': - self.errors.append(err.SELF_INVALID_ATTRIBUTE_ID) + if node.id == "self": + self.errors.append(err.SELF_INVALID_ATTRIBUTE_ID % (node.line, node.column)) - attr_type = self.context.get_type(node.type) if node.type != 'SELF_TYPE' else self.current_type + try: + attr_type = ( + self.context.get_type(node.type) + if node.type != "SELF_TYPE" + else self.current_type + ) + except SemanticError: + attr_type = ErrorType() + + scope.define_variable("self", self.current_type) + + # set the current attribute for analyze the body + # and set the self.current_method variable to None + self.current_attribute = self.current_type.get_attribute(node.id) + self.current_method = None if node.expr is not None: expr_type = self.visit(node.expr, scope.create_child()) if not expr_type.conforms_to(attr_type): - self.errors.append(err.INCOMPATIBLE_TYPES % (expr_type.name, attr_type.name)) - + line, column = node.expr_position + self.errors.append( + err.INCOMPATIBLE_TYPES + % (line, column, expr_type.name, attr_type.name) + ) scope.define_variable(node.id, attr_type) @visitor.when(ast.MethodDeclarationNode) def visit(self, node: ast.MethodDeclarationNode, scope: Scope): self.current_method = self.current_type.get_method(node.id) + self.current_attribute = None # Parameters can hide the attribute declaration, that's why we are not checking if there is defined, # instead we are checking for local declaration. Also it is checked that the static type of a parameter is # different of SELF_TYPE. - scope.define_variable('self', self.current_type) + scope.define_variable("self", self.current_type) - for param_name, param_type in zip(self.current_method.param_names, self.current_method.param_types): + for param_name, param_type in zip( + self.current_method.param_names, self.current_method.param_types + ): if not scope.is_local(param_name): - if param_type.name == 'SELF_TYPE': - self.errors.append(err.INVALID_PARAM_TYPE % 'SELF_TYPE') + if param_type.name == "SELF_TYPE": + self.errors.append(err.INVALID_PARAM_TYPE % "SELF_TYPE") scope.define_variable(param_name, ErrorType()) else: - scope.define_variable(param_name, self.context.get_type(param_type.name)) + try: + scope.define_variable( + param_name, self.context.get_type(param_type.name) + ) + except SemanticError: + scope.define_variable(param_name, ErrorType()) else: - self.errors.append(err.LOCAL_ALREADY_DEFINED % (param_name, self.current_method.name)) + self.errors.append( + err.LOCAL_ALREADY_DEFINED + % (node.line, node.column, param_name, self.current_method.name) + ) - return_type = self.context.get_type(node.return_type) if node.return_type != 'SELF_TYPE' else self.current_type + try: + return_type = ( + self.context.get_type(node.return_type) + if node.return_type != "SELF_TYPE" + else self.current_type + ) + except SemanticError: + return_type = ErrorType() expr_type = self.visit(node.body, scope) if not expr_type.conforms_to(return_type): - self.errors.append(err.INCOMPATIBLE_TYPES % (expr_type.name, return_type.name)) + self.errors.append( + err.INCOMPATIBLE_TYPES + % (node.line, node.column, expr_type.name, return_type.name) + ) @visitor.when(ast.LetNode) def visit(self, node: ast.LetNode, scope: Scope): - for _id, _type, _expr in node.declarations: + for i, (_id, _type, _expr) in enumerate(node.declarations): + if _id == "self": + line, column = node.declaration_names_positions[i] + self.errors.append(err.SELF_USED_IN_LET % (line, column)) + continue + try: - var_static_type = self.context.get_type(_type) if _type != 'SELF_TYPE' else self.current_type - except SemanticError as e: - self.errors.append(e.text) + var_static_type = ( + self.context.get_type(_type) + if _type != "SELF_TYPE" + else self.current_type + ) + except SemanticError: + line, column = node.declaration_types_positions[i] + self.errors.append(err.UNDEFINED_TYPE % (line, column, _type)) var_static_type = ErrorType() - if scope.is_local(_id): - self.errors.append(err.LOCAL_ALREADY_DEFINED % (_id, self.current_method.name)) - else: - scope.define_variable(_id, var_static_type) - - expr_type = self.visit(_expr, scope.create_child()) if _expr is not None else None + # if scope.is_local(_id): + # feature = self.current_method or self.current_attribute + # self.errors.append( + # err.LOCAL_ALREADY_DEFINED + # % (node.line, node.column, _id, feature.name) + # ) + # else: + scope.define_variable(_id, var_static_type) + + expr_type = ( + self.visit(_expr, scope.create_child()) if _expr is not None else None + ) if expr_type is not None and not expr_type.conforms_to(var_static_type): - self.errors.append(err.INCOMPATIBLE_TYPES % (expr_type.name, var_static_type.name)) + self.errors.append( + err.INCOMPATIBLE_TYPES + % (node.line, node.column, expr_type.name, var_static_type.name) + ) return self.visit(node.expr, scope.create_child()) @@ -110,13 +183,22 @@ def visit(self, node: ast.LetNode, scope: Scope): def visit(self, node: ast.AssignNode, scope: Scope): var_info = scope.find_variable(node.id) + if var_info.name == "self": + self.errors.append(err.SELF_IS_READONLY % (node.line, node.column)) + expr_type = self.visit(node.expr, scope.create_child()) if var_info is None: - self.errors.append(err.VARIABLE_NOT_DEFINED % (node.id, self.current_method.name)) + self.errors.append( + err.UNDEFINED_VARIABLE + % (node.line, node.column, node.id, self.current_method.name) + ) else: if not expr_type.conforms_to(var_info.type): - self.errors.append(err.INCOMPATIBLE_TYPES % (expr_type.name, var_info.type.name)) + self.errors.append( + err.INCOMPATIBLE_TYPES + % (node.line, node.column, expr_type.name, var_info.type.name) + ) return expr_type @@ -133,157 +215,251 @@ def visit(self, node: ast.ConditionalNode, scope: Scope): if_type = self.visit(node.if_expr, scope) then_type = self.visit(node.then_expr, scope) else_type = self.visit(node.else_expr, scope) - if if_type != self.context.get_type('Bool'): - self.errors.append(err.INCOMPATIBLE_TYPES % (if_type.name, 'Bool')) + if if_type != self.context.get_type("Bool"): + self.errors.append( + err.INCOMPATIBLE_TYPES % (node.line, node.column, if_type.name, "Bool") + ) return then_type.join(else_type) @visitor.when(ast.WhileNode) def visit(self, node: ast.WhileNode, scope: Scope): condition = self.visit(node.condition, scope) - if condition != self.context.get_type('Bool'): - self.errors.append(err.INCOMPATIBLE_TYPES % (condition.name, 'Bool')) + if condition != self.context.get_type("Bool"): + self.errors.append( + err.INCOMPATIBLE_TYPES + % (node.line, node.column, condition.name, "Bool") + ) self.visit(node.body, scope.create_child()) - return self.context.get_type('Object') + return self.context.get_type("Object") @visitor.when(ast.SwitchCaseNode) def visit(self, node: ast.SwitchCaseNode, scope: Scope): self.visit(node.expr, scope) types = [] - for _id, _type, _expr in node.cases: + visited = set() + for i, (identifier, type_name, expr) in enumerate(node.cases): new_scope = scope.create_child() try: - if _type != 'SELF_TYPE': - new_scope.define_variable(_id, self.context.get_type(_type)) + if type_name != "SELF_TYPE": + new_scope.define_variable( + identifier, self.context.get_type(type_name) + ) else: - self.errors.append(err.INVALID_CASE_TYPE % _type) - except SemanticError as e: - new_scope.define_variable(_id, ErrorType()) - self.errors.append(e.text) - - types.append(self.visit(_expr, new_scope)) + self.errors.append(err.INVALID_CASE_TYPE % type_name) + except SemanticError: + new_scope.define_variable(identifier, ErrorType()) + line, column = node.cases_positions[i] + self.errors.append( + err.UNDEFINED_TYPE_IN_BRANCH % (line, column, type_name) + ) + + # Cannot be dublicate Branches types + if type_name in visited: + line, column = node.cases_positions[i] + self.errors.append( + err.DUPLICATE_BARNCH_IN_CASE % (line, column, type_name) + ) + + visited.add(type_name) + types.append(self.visit(expr, new_scope)) return Type.multi_join(types) @visitor.when(ast.MethodCallNode) def visit(self, node: ast.MethodCallNode, scope: Scope): if node.obj is None: - node.obj = ast.VariableNode('self') + node.obj = ast.VariableNode("self") obj_type = self.visit(node.obj, scope) if node.type is not None: try: ancestor_type = self.context.get_type(node.type) - except SemanticError as e: + except SemanticError: ancestor_type = ErrorType() - self.errors.append(e.text) + line, column = node.type_position + self.errors.append(err.UNDEFINED_TYPE % (line, column, node.type)) if not obj_type.conforms_to(ancestor_type): - self.errors.append(err.INVALID_ANCESTOR % (obj_type.name, ancestor_type.name)) + line, column = node.type_position + self.errors.append( + err.INVALID_ANCESTOR + % (line, column, obj_type.name, ancestor_type.name) + ) else: ancestor_type = obj_type try: method = ancestor_type.get_method(node.id) - except SemanticError as e: - self.errors.append(e.text) + except SemanticError: + line, column = node.id_position + self.errors.append( + err.DISPATCH_UNDEFINED_METHOD % (line, column, node.id, obj_type.name) + ) + for arg in node.args: self.visit(arg, scope) return ErrorType() - if len(node.args) != len(method.param_names): - self.errors.append(err.METHOD_OVERRIDE_ERROR % (method.name, obj_type.name)) - - for i, arg in enumerate(node.args): + args_count = len(node.args) + params_count = len(method.param_names) + if args_count != params_count: + line, column = node.id_position + self.errors.append( + err.DISPATCH_WITH_WRONG_NUMBER_OF_ARGS + % (line, column, method.name, obj_type.name, params_count, args_count) + ) + + number_of_args = min(args_count, params_count) + for i, arg in enumerate(node.args[:number_of_args]): arg_type = self.visit(arg, scope) if not arg_type.conforms_to(method.param_types[i]): - self.errors.append(err.INCOMPATIBLE_TYPES % (arg_type.name, method.param_types[i].name)) - - return method.return_type if method.return_type.name != 'SELF_TYPE' else ancestor_type + line, column = node.args_positions[i] + self.errors.append( + err.INCOMPATIBLE_TYPES + % ( + line, + column, + arg_type.name, + method.param_types[i].name, + ) + ) + + return ( + method.return_type + if method.return_type.name != "SELF_TYPE" + else ancestor_type + ) @visitor.when(ast.IntegerNode) def visit(self, node: ast.IntegerNode, scope: Scope): - return self.context.get_type('Int') + return self.context.get_type("Int") @visitor.when(ast.StringNode) def visit(self, node: ast.StringNode, scope: Scope): - return self.context.get_type('String') + return self.context.get_type("String") @visitor.when(ast.BooleanNode) def visit(self, node: ast.BooleanNode, scope: Scope): - return self.context.get_type('Bool') + return self.context.get_type("Bool") @visitor.when(ast.VariableNode) def visit(self, node: ast.VariableNode, scope: Scope): variable = scope.find_variable(node.lex) if variable is None: - self.errors.append(err.VARIABLE_NOT_DEFINED % (node.lex, self.current_method.name)) + if self.current_attribute is not None: + name = self.current_attribute.name + else: + name = self.current_method.name + + self.errors.append( + err.UNDEFINED_VARIABLE % (node.line, node.column, node.lex, name) + ) return ErrorType() return variable.type @visitor.when(ast.InstantiateNode) def visit(self, node: ast.InstantiateNode, scope: Scope): try: - return self.context.get_type(node.lex) if node.lex != 'SELF_TYPE' else self.current_type + return ( + self.context.get_type(node.lex) + if node.lex != "SELF_TYPE" + else self.current_type + ) except SemanticError as e: - self.errors.append(e.text) + line, column = node.type_position + self.errors.append(err.UNDEFINED_NEW_TYPE % (line, column, node.lex)) return ErrorType() @visitor.when(ast.NegationNode) def visit(self, node: ast.NegationNode, scope: Scope): - return self._check_unary_operation(node, scope, 'not', self.context.get_type('Bool')) + return self._check_unary_operation( + node, scope, "not", self.context.get_type("Bool") + ) @visitor.when(ast.ComplementNode) def visit(self, node: ast.ComplementNode, scope: Scope): - return self._check_unary_operation(node, scope, '~', self.context.get_type('Int')) + return self._check_unary_operation( + node, scope, "~", self.context.get_type("Int") + ) @visitor.when(ast.IsVoidNode) def visit(self, node: ast.IsVoidNode, scope: Scope): self.visit(node.expr, scope) - return self.context.get_type('Bool') + return self.context.get_type("Bool") @visitor.when(ast.PlusNode) def visit(self, node: ast.PlusNode, scope: Scope): - return self._check_int_binary_operation(node, scope, '+', self.context.get_type('Int')) + return self._check_int_binary_operation( + node, scope, "+", self.context.get_type("Int") + ) @visitor.when(ast.MinusNode) def visit(self, node: ast.MinusNode, scope: Scope): - return self._check_int_binary_operation(node, scope, '-', self.context.get_type('Int')) + return self._check_int_binary_operation( + node, scope, "-", self.context.get_type("Int") + ) @visitor.when(ast.StarNode) def visit(self, node: ast.StarNode, scope: Scope): - return self._check_int_binary_operation(node, scope, '*', self.context.get_type('Int')) + return self._check_int_binary_operation( + node, scope, "*", self.context.get_type("Int") + ) @visitor.when(ast.DivNode) def visit(self, node: ast.DivNode, scope: Scope): - return self._check_int_binary_operation(node, scope, '/', self.context.get_type('Int')) + return self._check_int_binary_operation( + node, scope, "/", self.context.get_type("Int") + ) @visitor.when(ast.LessEqualNode) def visit(self, node: ast.LessEqualNode, scope: Scope): - return self._check_int_binary_operation(node, scope, '<=', self.context.get_type('Bool')) + return self._check_int_binary_operation( + node, scope, "<=", self.context.get_type("Bool") + ) @visitor.when(ast.LessThanNode) def visit(self, node: ast.LessThanNode, scope: Scope): - return self._check_int_binary_operation(node, scope, '<', self.context.get_type('Bool')) + return self._check_int_binary_operation( + node, scope, "<", self.context.get_type("Bool") + ) @visitor.when(ast.EqualNode) def visit(self, node: ast.EqualNode, scope: Scope): - self.visit(node.left, scope) - self.visit(node.right, scope) - return self.context.get_type('Bool') + left_type = self.visit(node.left, scope) + right_type = self.visit(node.right, scope) - def _check_int_binary_operation(self, node: ast.BinaryNode, scope: Scope, operation: str, return_type: Type): + basic_types = ("Int", "String", "Bool") + if ( + left_type.name in basic_types or left_type.name in basic_types + ) and left_type.name != right_type.name: + self.errors.append( + err.INVALID_EQ_COMPARISON_OPERATION % (node.line, node.column) + ) + return self.context.get_type("Bool") + + def _check_int_binary_operation( + self, node: ast.BinaryNode, scope: Scope, operation: str, return_type: Type + ): left_type = self.visit(node.left, scope) right_type = self.visit(node.right, scope) - if left_type == right_type == self.context.get_type('Int'): + if left_type == right_type == self.context.get_type("Int"): return return_type - self.errors.append(err.INVALID_BINARY_OPERATION % (operation, left_type.name, right_type.name)) + self.errors.append( + err.INVALID_BINARY_OPERATION + % (node.line, node.column, operation, left_type.name, right_type.name) + ) return ErrorType() - def _check_unary_operation(self, node: ast.UnaryNode, scope: Scope, operation: str, expected_type: Type): + def _check_unary_operation( + self, node: ast.UnaryNode, scope: Scope, operation: str, expected_type: Type + ): typex = self.visit(node.expr, scope) if typex == expected_type: return typex - self.errors.append(err.INVALID_UNARY_OPERATION % (operation, typex.name)) + self.errors.append( + err.INVALID_UNARY_OPERATION + % (node.line, node.column, operation, typex.name) + ) return ErrorType() diff --git a/src/cool/semantics/type_collector.py b/src/cool/semantics/type_collector.py index 4c0488ad6..c16d238b9 100644 --- a/src/cool/semantics/type_collector.py +++ b/src/cool/semantics/type_collector.py @@ -1,5 +1,6 @@ from typing import List +import cool.semantics.utils.errors as err import cool.semantics.utils.astnodes as ast import cool.visitor as visitor from cool.semantics.utils.scope import Context, SemanticError @@ -17,44 +18,48 @@ def __init__(self, context: Context = Context(), errors: List[str] = []): self.errors: List[str] = errors self.context: Context = context - @visitor.on('node') + @visitor.on("node") def visit(self, node): pass @visitor.when(ast.ProgramNode) def visit(self, node): - self.context.create_type('AUTO_TYPE') - self_type = self.context.create_type('SELF_TYPE') - object_type = self.context.create_type('Object') - io_type = self.context.create_type('IO') - string_type = self.context.create_type('String') - int_type = self.context.create_type('Int') - bool_type = self.context.create_type('Bool') + self.context.create_type("AUTO_TYPE") + self_type = self.context.create_type("SELF_TYPE") + object_type = self.context.create_type("Object") + io_type = self.context.create_type("IO") + string_type = self.context.create_type("String") + int_type = self.context.create_type("Int") + bool_type = self.context.create_type("Bool") io_type.set_parent(object_type) string_type.set_parent(object_type) int_type.set_parent(object_type) bool_type.set_parent(object_type) - object_type.define_method('abort', [], [], object_type) - object_type.define_method('type_name', [], [], string_type) - object_type.define_method('copy', [], [], self_type) + object_type.define_method("abort", [], [], object_type) + object_type.define_method("type_name", [], [], string_type) + object_type.define_method("copy", [], [], self_type) - io_type.define_method('out_string', ['x'], [string_type], self_type) - io_type.define_method('out_int', ['x'], [int_type], self_type) - io_type.define_method('in_string', [], [], string_type) - io_type.define_method('in_int', [], [], int_type) + io_type.define_method("out_string", ["x"], [string_type], self_type) + io_type.define_method("out_int", ["x"], [int_type], self_type) + io_type.define_method("in_string", [], [], string_type) + io_type.define_method("in_int", [], [], int_type) - string_type.define_method('length', [], [], int_type) - string_type.define_method('concat', ['s'], [string_type], string_type) - string_type.define_method('substr', ['i', 'l'], [int_type, int_type], string_type) + string_type.define_method("length", [], [], int_type) + string_type.define_method("concat", ["s"], [string_type], string_type) + string_type.define_method( + "substr", ["i", "l"], [int_type, int_type], string_type + ) for declaration in node.declarations: self.visit(declaration) @visitor.when(ast.ClassDeclarationNode) - def visit(self, node): + def visit(self, node: ast.ClassDeclarationNode): try: self.context.create_type(node.id) - except SemanticError as e: - self.errors.append(e.text) + except SemanticError: + self.errors.append( + err.INVALID_REDEFINITION_CLASS % (node.line, node.column, node.id) + ) diff --git a/src/cool/semantics/type_inference.py b/src/cool/semantics/type_inference.py index 0af0c4805..e8b113850 100644 --- a/src/cool/semantics/type_inference.py +++ b/src/cool/semantics/type_inference.py @@ -40,8 +40,16 @@ import cool.semantics.utils.astnodes as ast import cool.semantics.utils.errors as err import cool.visitor as visitor -from cool.semantics.utils.scope import (Attribute, Context, ErrorType, Method, - Scope, SemanticError, Type, VariableInfo) +from cool.semantics.utils.scope import ( + Attribute, + Context, + ErrorType, + Method, + Scope, + SemanticError, + Type, + VariableInfo, +) class DependencyNode: @@ -66,7 +74,7 @@ def update(self, _type: Type) -> None: pass def __str__(self): - return f'Atom({self.type.name})' + return f"Atom({self.type.name})" class VariableInfoNode(DependencyNode): @@ -78,7 +86,7 @@ def update(self, _type): self.type = self.variable_info.type = _type def __str__(self): - return f'VarInfo({self.variable_info.name}, {self.type.name})' + return f"VarInfo({self.variable_info.name}, {self.type.name})" class AttributeNode(DependencyNode): @@ -90,7 +98,7 @@ def update(self, _type: Type) -> None: self.type = self.attribute.type = _type def __str__(self): - return f'Attr({self.attribute.name}, {self.type.name})' + return f"Attr({self.attribute.name}, {self.type.name})" class ParameterNode(DependencyNode): @@ -103,7 +111,7 @@ def update(self, _type): self.type = self.method.param_types[self.index] = _type def __str__(self): - return f'Param({self.method.name}, {self.index}, {self.type.name})' + return f"Param({self.method.name}, {self.index}, {self.type.name})" class ReturnTypeNode(DependencyNode): @@ -115,7 +123,7 @@ def update(self, _type): self.type = self.method.return_type = _type def __str__(self): - return f'Return({self.method.name}, {self.type.name})' + return f"Return({self.method.name}, {self.type.name})" class BranchedNode(DependencyNode, ABC): @@ -123,7 +131,7 @@ class BranchedNode(DependencyNode, ABC): @property def is_ready(self) -> bool: - return all(x.type.name != 'AUTO_TYPE' for x in self.branches) + return all(x.type.name != "AUTO_TYPE" for x in self.branches) class ConditionalNode(BranchedNode): @@ -135,7 +143,7 @@ def update(self, _type: Type) -> None: self.type = _type def __str__(self): - return f'ConditionalNode({self.type.name})' + return f"ConditionalNode({self.type.name})" class CaseOfNode(BranchedNode): @@ -147,7 +155,7 @@ def update(self, _type: Type) -> None: self.type = _type def __str__(self): - return f'CaseOfNode({self.type.name})' + return f"CaseOfNode({self.type.name})" class DependencyGraph: @@ -166,7 +174,9 @@ def add_edge(self, node: DependencyNode, other: DependencyNode): self.add_node(other) def update_dependencies(self, default_type: Type = None): - queue: Deque[DependencyNode] = deque(node for node in self.dependencies if isinstance(node, AtomNode)) + queue: Deque[DependencyNode] = deque( + node for node in self.dependencies if isinstance(node, AtomNode) + ) visited: Set[DependencyNode] = set(queue) while queue: @@ -186,8 +196,11 @@ def update_dependencies(self, default_type: Type = None): if isinstance(node, BranchedNode) and node.is_ready: node.update(Type.multi_join([x.type for x in node.branches])) - queue = deque(node for node in self.dependencies - if isinstance(node, BranchedNode) and node.type.name != 'AUTO_TYPE') + queue = deque( + node + for node in self.dependencies + if isinstance(node, BranchedNode) and node.type.name != "AUTO_TYPE" + ) visited.update(queue) while queue: node = queue.popleft() @@ -203,7 +216,11 @@ def update_dependencies(self, default_type: Type = None): node.update(default_type) def __str__(self): - return '{\n\t' + '\n\t'.join(f'{key}: {value}' for key, value in self.dependencies.items()) + '\n}' + return ( + "{\n\t" + + "\n\t".join(f"{key}: {value}" for key, value in self.dependencies.items()) + + "\n}" + ) class InferenceChecker: @@ -219,7 +236,9 @@ def __init__(self, context, errors): self.graph = DependencyGraph() @staticmethod - def build_attributes_reference(context: Context) -> Dict[Tuple[str, str], AttributeNode]: + def build_attributes_reference( + context: Context, + ) -> Dict[Tuple[str, str], AttributeNode]: attributes = {} for typex in context: @@ -229,18 +248,24 @@ def build_attributes_reference(context: Context) -> Dict[Tuple[str, str], Attrib return attributes @staticmethod - def build_methods_reference(context: Context) -> Dict[Tuple[str, str], Tuple[List[ParameterNode], ReturnTypeNode]]: + def build_methods_reference( + context: Context, + ) -> Dict[Tuple[str, str], Tuple[List[ParameterNode], ReturnTypeNode]]: methods = {} for typex in context: for method in typex.methods: methods[typex.name, method.name] = ( - [ParameterNode(t, method, i) for i, t in enumerate(method.param_types)], - ReturnTypeNode(method.return_type, method)) + [ + ParameterNode(t, method, i) + for i, t in enumerate(method.param_types) + ], + ReturnTypeNode(method.return_type, method), + ) return methods - @visitor.on('node') + @visitor.on("node") def visit(self, node, scope): pass @@ -253,7 +278,7 @@ def visit(self, node: ast.ProgramNode, scope: Scope = None): self.visit(item, scope.create_child()) # print(self.graph, '\n') - self.graph.update_dependencies(default_type=self.context.get_type('Object')) + self.graph.update_dependencies(default_type=self.context.get_type("Object")) # print(self.graph, '\n') InferenceTypeSubstitute(self.context, self.errors).visit(node, scope) @@ -261,8 +286,16 @@ def visit(self, node: ast.ProgramNode, scope: Scope = None): def visit(self, node: ast.ClassDeclarationNode, scope: Scope): self.current_type = self.context.get_type(node.id) - attrs = [feature for feature in node.features if isinstance(feature, ast.AttrDeclarationNode)] - methods = [feature for feature in node.features if isinstance(feature, ast.MethodDeclarationNode)] + attrs = [ + feature + for feature in node.features + if isinstance(feature, ast.AttrDeclarationNode) + ] + methods = [ + feature + for feature in node.features + if isinstance(feature, ast.MethodDeclarationNode) + ] for attr in attrs: self.visit(attr, scope) @@ -273,15 +306,21 @@ def visit(self, node: ast.ClassDeclarationNode, scope: Scope): @visitor.when(ast.AttrDeclarationNode) def visit(self, node: ast.AttrDeclarationNode, scope: Scope): # Solve the expression of the attribute - expr_node = self.visit(node.expr, scope.create_child()) if node.expr is not None else None + expr_node = ( + self.visit(node.expr, scope.create_child()) + if node.expr is not None + else None + ) # Define attribute in the scope var_info = scope.define_variable(node.id, self.context.get_type(node.type)) # Set and get the reference to the variable info node - var_info_node = self.variables[var_info] = VariableInfoNode(self.context.get_type(node.type), var_info) + var_info_node = self.variables[var_info] = VariableInfoNode( + self.context.get_type(node.type), var_info + ) - if node.type == 'AUTO_TYPE': + if node.type == "AUTO_TYPE": # Get the reference to the attribute node attr_node = self.attributes[self.current_type.name, node.id] @@ -299,7 +338,7 @@ def visit(self, node: ast.MethodDeclarationNode, scope: Scope): self.current_method = self.current_type.get_method(node.id) # Define 'self' as a variable in the scope - self_var = scope.define_variable('self', self.current_type) + self_var = scope.define_variable("self", self.current_type) # Set the reference of 'self' variable info node self.variables[self_var] = VariableInfoNode(self.current_type, self_var) @@ -312,11 +351,15 @@ def visit(self, node: ast.MethodDeclarationNode, scope: Scope): param_var_info = scope.define_variable(param_name, param_type) # Set the reference to the variable info node - param_var_info_node = self.variables[param_var_info] = VariableInfoNode(param_type, param_var_info) + param_var_info_node = self.variables[param_var_info] = VariableInfoNode( + param_type, param_var_info + ) - if param_type.name == 'AUTO_TYPE': + if param_type.name == "AUTO_TYPE": # Get the parameter node - parameter_node = self.methods[self.current_type.name, self.current_method.name][0][i] + parameter_node = self.methods[ + self.current_type.name, self.current_method.name + ][0][i] # Create the cycle of two nodes between param_var_info_node and parameter_node self.graph.add_edge(param_var_info_node, parameter_node) @@ -325,9 +368,11 @@ def visit(self, node: ast.MethodDeclarationNode, scope: Scope): # Solve the body of the method body_node = self.visit(node.body, scope) - if self.current_method.return_type.name == 'AUTO_TYPE': + if self.current_method.return_type.name == "AUTO_TYPE": # Get the return type node and add an edge body_node -> return_type_node - return_type_node = self.methods[self.current_type.name, self.current_method.name][1] + return_type_node = self.methods[ + self.current_type.name, self.current_method.name + ][1] self.graph.add_edge(body_node, return_type_node) @visitor.when(ast.LetNode) @@ -338,19 +383,23 @@ def visit(self, node: ast.LetNode, scope: Scope): var_info = scope.define_variable(_id, self.context.get_type(_type)) except SemanticError: var_info = scope.define_variable(_id, ErrorType()) - var_info_node = self.variables[var_info] = VariableInfoNode(var_info.type, var_info) + var_info_node = self.variables[var_info] = VariableInfoNode( + var_info.type, var_info + ) - expr_node = self.visit(_expr, scope.create_child()) if _expr is not None else None + expr_node = ( + self.visit(_expr, scope.create_child()) if _expr is not None else None + ) - if var_info.type.name == 'AUTO_TYPE': + if var_info.type.name == "AUTO_TYPE": # Create an edge or add an new node only if it is AutoType if expr_node is not None: self.graph.add_edge(expr_node, var_info_node) - if expr_node.type.name == 'AUTO_TYPE': + if expr_node.type.name == "AUTO_TYPE": self.graph.add_edge(var_info_node, expr_node) else: self.graph.add_node(var_info_node) - elif expr_node is not None and expr_node.type.name == 'AUTO_TYPE': + elif expr_node is not None and expr_node.type.name == "AUTO_TYPE": self.graph.add_edge(var_info_node, expr_node) return self.visit(node.expr, scope.create_child()) @@ -362,11 +411,17 @@ def visit(self, node: ast.AssignNode, scope: Scope): expr_node = self.visit(node.expr, scope.create_child()) if var_info is not None: - if expr_node.type.name != 'AUTO_TYPE' and var_info.type.name == 'AUTO_TYPE': + if expr_node.type.name != "AUTO_TYPE" and var_info.type.name == "AUTO_TYPE": self.graph.add_edge(expr_node, self.variables[var_info]) - elif var_info.type.name != 'AUTO_TYPE' and expr_node.type.name == 'AUTO_TYPE': - self.graph.add_edge(AtomNode(self.context.get_type(var_info.type.name)), expr_node) - elif var_info.type.name == 'AUTO_TYPE' and expr_node.type.name == 'AUTO_TYPE': + elif ( + var_info.type.name != "AUTO_TYPE" and expr_node.type.name == "AUTO_TYPE" + ): + self.graph.add_edge( + AtomNode(self.context.get_type(var_info.type.name)), expr_node + ) + elif ( + var_info.type.name == "AUTO_TYPE" and expr_node.type.name == "AUTO_TYPE" + ): # Create a cycle self.graph.add_edge(expr_node, self.variables[var_info]) self.graph.add_edge(self.variables[var_info], expr_node) @@ -388,7 +443,7 @@ def visit(self, node: ast.ConditionalNode, scope: Scope): if_node = self.visit(node.if_expr, scope) if not isinstance(if_node, AtomNode): - self.graph.add_edge(AtomNode(self.context.get_type('Bool')), if_node) + self.graph.add_edge(AtomNode(self.context.get_type("Bool")), if_node) then_node = self.visit(node.then_expr, scope.create_child()) else_node = self.visit(node.else_expr, scope.create_child()) @@ -396,7 +451,9 @@ def visit(self, node: ast.ConditionalNode, scope: Scope): if isinstance(then_node, AtomNode) and isinstance(else_node, AtomNode): return AtomNode(then_node.type.join(else_node.type)) - conditional_node = ConditionalNode(self.context.get_type('AUTO_TYPE'), then_node, else_node) + conditional_node = ConditionalNode( + self.context.get_type("AUTO_TYPE"), then_node, else_node + ) if isinstance(then_node, AtomNode) and not isinstance(else_node, AtomNode): self.graph.add_edge(then_node, else_node) elif not isinstance(then_node, AtomNode) and isinstance(else_node, AtomNode): @@ -413,7 +470,7 @@ def visit(self, node: ast.ConditionalNode, scope: Scope): def visit(self, node: ast.WhileNode, scope: Scope): self.visit(node.condition, scope) self.visit(node.body, scope.create_child()) - return AtomNode(self.context.get_type('Object')) + return AtomNode(self.context.get_type("Object")) @visitor.when(ast.SwitchCaseNode) def visit(self, node: ast.SwitchCaseNode, scope: Scope): @@ -434,12 +491,12 @@ def visit(self, node: ast.SwitchCaseNode, scope: Scope): not_defined_nodes.append(case_node) case_nodes.append(case_node) - if any(e.type.name == 'AUTO_TYPE' for e in case_nodes): + if any(e.type.name == "AUTO_TYPE" for e in case_nodes): if defined_nodes: t = Type.multi_join([x.type for x in defined_nodes]) for x in not_defined_nodes: self.graph.add_edge(AtomNode(t), x) - case_of_node = CaseOfNode(self.context.get_type('AUTO_TYPE'), case_nodes) + case_of_node = CaseOfNode(self.context.get_type("AUTO_TYPE"), case_nodes) self.graph.add_node(case_of_node) return case_of_node return AtomNode(Type.multi_join([e.type for e in case_nodes])) @@ -447,7 +504,7 @@ def visit(self, node: ast.SwitchCaseNode, scope: Scope): @visitor.when(ast.MethodCallNode) def visit(self, node: ast.MethodCallNode, scope: Scope): if node.obj is None: - node.obj = ast.VariableNode('self') + node.obj = ast.VariableNode("self") obj_node = self.visit(node.obj, scope) if isinstance(obj_node, AtomNode) and obj_node.type.contains_method(node.id): @@ -461,43 +518,47 @@ def visit(self, node: ast.MethodCallNode, scope: Scope): continue if isinstance(arg_node, AtomNode): - if param_nodes[i].type.name == 'AUTO_TYPE': + if param_nodes[i].type.name == "AUTO_TYPE": self.graph.add_edge(arg_node, param_nodes[i]) else: continue else: - if param_nodes[i].type.name != 'AUTO_TYPE': + if param_nodes[i].type.name != "AUTO_TYPE": self.graph.add_edge(param_nodes[i], arg_node) else: self.graph.add_edge(param_nodes[i], arg_node) self.graph.add_edge(arg_node, param_nodes[i]) - if return_node.type.name == 'AUTO_TYPE': + if return_node.type.name == "AUTO_TYPE": return return_node - return AtomNode(return_node.type if return_node.type.name != 'SELF_TYPE' else obj_node.type) + return AtomNode( + return_node.type + if return_node.type.name != "SELF_TYPE" + else obj_node.type + ) for arg in node.args: self.visit(arg, scope) - return AtomNode(self.context.get_type('Object')) + return AtomNode(self.context.get_type("Object")) @visitor.when(ast.IntegerNode) def visit(self, node: ast.IntegerNode, scope: Scope): - return AtomNode(self.context.get_type('Int')) + return AtomNode(self.context.get_type("Int")) @visitor.when(ast.StringNode) def visit(self, node: ast.StringNode, scope: Scope): - return AtomNode(self.context.get_type('String')) + return AtomNode(self.context.get_type("String")) @visitor.when(ast.BooleanNode) def visit(self, node: ast.BooleanNode, scope: Scope): - return AtomNode(self.context.get_type('Bool')) + return AtomNode(self.context.get_type("Bool")) @visitor.when(ast.VariableNode) def visit(self, node: ast.VariableNode, scope: Scope): var_info = scope.find_variable(node.lex) if var_info is not None: - if var_info.type.name == 'AUTO_TYPE': + if var_info.type.name == "AUTO_TYPE": return self.variables[var_info] else: return AtomNode(var_info.type) @@ -508,54 +569,68 @@ def visit(self, node: ast.VariableNode, scope: Scope): def visit(self, node: ast.InstantiateNode, scope: Scope): if node.lex in self.context.types: return AtomNode(self.context.get_type(node.lex)) - return AtomNode(self.context.get_type('Object')) + return AtomNode(self.context.get_type("Object")) @visitor.when(ast.NegationNode) def visit(self, node: ast.NegationNode, scope: Scope): self.visit(node.expr, scope) - return AtomNode(self.context.get_type('Bool')) + return AtomNode(self.context.get_type("Bool")) @visitor.when(ast.ComplementNode) def visit(self, node: ast.ComplementNode, scope: Scope): self.visit(node.expr, scope) - return AtomNode(self.context.get_type('Int')) + return AtomNode(self.context.get_type("Int")) @visitor.when(ast.IsVoidNode) def visit(self, node: ast.IsVoidNode, scope: Scope): self.visit(node.expr, scope) - return AtomNode(self.context.get_type('Bool')) + return AtomNode(self.context.get_type("Bool")) @visitor.when(ast.PlusNode) def visit(self, node: ast.PlusNode, scope: Scope): - return self._visit_arithmetic_node(node, scope, self.context.get_type('Int'), self.context.get_type('Int')) + return self._visit_arithmetic_node( + node, scope, self.context.get_type("Int"), self.context.get_type("Int") + ) @visitor.when(ast.MinusNode) def visit(self, node: ast.MinusNode, scope: Scope): - return self._visit_arithmetic_node(node, scope, self.context.get_type('Int'), self.context.get_type('Int')) + return self._visit_arithmetic_node( + node, scope, self.context.get_type("Int"), self.context.get_type("Int") + ) @visitor.when(ast.StarNode) def visit(self, node: ast.StarNode, scope: Scope): - return self._visit_arithmetic_node(node, scope, self.context.get_type('Int'), self.context.get_type('Int')) + return self._visit_arithmetic_node( + node, scope, self.context.get_type("Int"), self.context.get_type("Int") + ) @visitor.when(ast.DivNode) def visit(self, node: ast.DivNode, scope: Scope): - return self._visit_arithmetic_node(node, scope, self.context.get_type('Int'), self.context.get_type('Int')) + return self._visit_arithmetic_node( + node, scope, self.context.get_type("Int"), self.context.get_type("Int") + ) @visitor.when(ast.LessEqualNode) def visit(self, node: ast.LessEqualNode, scope: Scope): - return self._visit_arithmetic_node(node, scope, self.context.get_type('Int'), self.context.get_type('Bool')) + return self._visit_arithmetic_node( + node, scope, self.context.get_type("Int"), self.context.get_type("Bool") + ) @visitor.when(ast.LessThanNode) def visit(self, node: ast.LessThanNode, scope: Scope): - return self._visit_arithmetic_node(node, scope, self.context.get_type('Int'), self.context.get_type('Bool')) + return self._visit_arithmetic_node( + node, scope, self.context.get_type("Int"), self.context.get_type("Bool") + ) @visitor.when(ast.EqualNode) def visit(self, node: ast.EqualNode, scope: Scope): self.visit(node.left, scope) self.visit(node.right, scope) - return AtomNode(self.context.get_type('Bool')) + return AtomNode(self.context.get_type("Bool")) - def _visit_arithmetic_node(self, node: ast.BinaryNode, scope: Scope, member_types: Type, return_type: Type): + def _visit_arithmetic_node( + self, node: ast.BinaryNode, scope: Scope, member_types: Type, return_type: Type + ): left = self.visit(node.left, scope) right = self.visit(node.right, scope) @@ -575,7 +650,7 @@ def __init__(self, context: Context, errors: List[str]): self.current_type: Optional[Type] = None self.current_method: Optional[Method] = None - @visitor.on('node') + @visitor.on("node") def visit(self, node, tabs): pass @@ -589,8 +664,16 @@ def visit(self, node: ast.ProgramNode, scope: Scope): def visit(self, node: ast.ClassDeclarationNode, scope: Scope): self.current_type = self.context.get_type(node.id) - attrs = [feature for feature in node.features if isinstance(feature, ast.AttrDeclarationNode)] - methods = [feature for feature in node.features if isinstance(feature, ast.MethodDeclarationNode)] + attrs = [ + feature + for feature in node.features + if isinstance(feature, ast.AttrDeclarationNode) + ] + methods = [ + feature + for feature in node.features + if isinstance(feature, ast.MethodDeclarationNode) + ] i = 0 for attr in attrs: @@ -610,8 +693,8 @@ def visit(self, node: ast.AttrDeclarationNode, scope: Scope): if node.expr is not None: self.visit(node.expr, scope.children[node.index]) - if attr_type == self.context.get_type('AUTO_TYPE'): - if var_info.type == self.context.get_type('AUTO_TYPE'): + if attr_type == self.context.get_type("AUTO_TYPE"): + if var_info.type == self.context.get_type("AUTO_TYPE"): self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % node.id) node.type = var_info.type.name @@ -622,14 +705,14 @@ def visit(self, node: ast.MethodDeclarationNode, scope: Scope): for i, (name, expr_body_type) in enumerate(node.params): variable_info = scope.find_variable(name) - if variable_info.type == self.context.get_type('AUTO_TYPE'): + if variable_info.type == self.context.get_type("AUTO_TYPE"): self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % name) node.params[i] = (name, variable_info.type.name) self.visit(node.body, scope) - if return_type == self.context.get_type('AUTO_TYPE'): - if self.current_method.return_type == self.context.get_type('AUTO_TYPE'): + if return_type == self.context.get_type("AUTO_TYPE"): + if self.current_method.return_type == self.context.get_type("AUTO_TYPE"): self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % node.id) node.return_type = self.current_method.return_type.name @@ -643,8 +726,8 @@ def visit(self, node: ast.LetNode, scope: Scope): self.visit(_expr, scope.children[child_index]) child_index += 1 - if _type == 'AUTO_TYPE': - if variable_info.type == self.context.get_type('AUTO_TYPE'): + if _type == "AUTO_TYPE": + if variable_info.type == self.context.get_type("AUTO_TYPE"): self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % _id) node.declarations[i] = (_id, variable_info.type.name, _expr) diff --git a/src/cool/semantics/utils/astnodes.py b/src/cool/semantics/utils/astnodes.py index 25ba898d6..b09cdb748 100644 --- a/src/cool/semantics/utils/astnodes.py +++ b/src/cool/semantics/utils/astnodes.py @@ -1,14 +1,20 @@ from typing import List, Union, Tuple, Optional -Feature = Union['MethodDeclarationNode', 'AttrDeclarationNode'] +Feature = Union["MethodDeclarationNode", "AttrDeclarationNode"] class Node: - pass + line: int + column: int + + def set_main_position(self, line: int, col: int) -> "Node": + self.line = line + self.column = col + return self class ProgramNode(Node): - def __init__(self, declarations: List['ClassDeclarationNode']): + def __init__(self, declarations: List["ClassDeclarationNode"]): self.declarations: List[ClassDeclarationNode] = declarations @@ -17,34 +23,48 @@ class DeclarationNode(Node): class ClassDeclarationNode(DeclarationNode): - def __init__(self, idx: str, features: List[Feature], parent: Optional[str] =None): + def __init__(self, idx: str, features: List[Feature], parent: Optional[str] = None): self.id: str = idx self.parent: str = parent self.features: List[Feature] = features + self.parent_position: Tuple[int, int] = -1, -1 + class MethodDeclarationNode(DeclarationNode): - def __init__(self, idx: str, params: List[Tuple[str, str]], return_type: str, body: 'ExprNode'): + def __init__( + self, + idx: str, + params: List[Tuple[str, str]], + return_type: str, + body: "ExprNode", + ): self.id: str = idx self.params: List[Tuple[str, str]] = params self.return_type: str = return_type self.body: ExprNode = body + self.param_types_positions: List[Tuple[int, int]] = [] + self.return_type_position: Tuple[int, int] = -1, -1 + class AttrDeclarationNode(DeclarationNode): - def __init__(self, idx: str, typex: str, expr: 'ExprNode' = None): + def __init__(self, idx: str, typex: str, expr: "ExprNode" = None): self.id: str = idx self.type: str = typex self.expr: ExprNode = expr + self.type_position: Tuple[int, int] = -1, -1 + self.expr_position: Tuple[int, int] = -1, -1 + class ExprNode(Node): pass class ParenthesisExpr(ExprNode): - def __init__(self, expr: 'ExprNode'): - self.expr: 'ExprNode' = expr + def __init__(self, expr: "ExprNode"): + self.expr: "ExprNode" = expr class BlockNode(ExprNode): @@ -57,18 +77,16 @@ def __init__(self, declarations, expr): self.declarations: List[Tuple[str, str, Optional[ExprNode]]] = declarations self.expr: ExprNode = expr + self.declaration_names_positions: List[Tuple[int, int]] = [] + self.declaration_types_positions: List[Tuple[int, int]] = [] + class SwitchCaseNode(ExprNode): def __init__(self, expr, cases): self.expr: ExprNode = expr self.cases: List[Tuple[str, str, ExprNode]] = cases - -# class CaseNode(ExprNode): -# def __init__(self, idx, typex, expr): -# self.id: str = idx -# self.type: str = typex -# self.expr: ExprNode = expr + self.cases_positions: List[Tuple[int, int]] = [] class AssignNode(ExprNode): @@ -97,6 +115,10 @@ def __init__(self, idx, args, obj=None, typex=None): self.args: List[ExprNode] = args self.type: str = typex + self.id_position: Tuple[int, int] = -1, -1 + self.type_position: Tuple[int, int] = -1, -1 + self.args_positions: List[Tuple[int, int]] = [] + class AtomicNode(ExprNode): def __init__(self, lex): @@ -107,6 +129,8 @@ class UnaryNode(ExprNode): def __init__(self, expr): self.expr: ExprNode = expr + self.operation_position: Tuple[int, int] = -1, -1 + class BinaryNode(ExprNode): def __init__(self, left, operation, right): @@ -120,7 +144,10 @@ class VariableNode(AtomicNode): class InstantiateNode(AtomicNode): - pass + def __init__(self, lex): + super().__init__(lex) + + self.type_position: Tuple[int, int] = -1, -1 class IntegerNode(AtomicNode): diff --git a/src/cool/semantics/utils/errors.py b/src/cool/semantics/utils/errors.py index c32cd75a0..e71fc3d87 100644 --- a/src/cool/semantics/utils/errors.py +++ b/src/cool/semantics/utils/errors.py @@ -1,30 +1,98 @@ -ATTRIBUTE_OVERRIDE_ERROR = 'OverrideError: Attribute "%s" already defined in "%s", attributes cannot be overridden' -METHOD_OVERRIDE_ERROR = 'OverrideError: Method "%s" already defined in "%s" with a different signature.' - -INCOMPATIBLE_TYPES = 'TypeError: Cannot convert "%s" into "%s".' -INVALID_PARAM_TYPE = 'TypeError: "%s" cannot be a static type of a parameter.' -INVALID_CASE_TYPE = 'TypeError: "%s" cannot be a static type of a case branch.' -INVALID_PARENT_TYPE = 'TypeError: Class "%s" cannot inherits from "%s"' -INVALID_ANCESTOR = 'TypeError: Class "%s" has no an ancestor class "%s".' - -INVALID_BINARY_OPERATION = 'OperationError: Operation "%s" is not defined between "%s" and "%s".' -INVALID_UNARY_OPERATION = 'OperationError: Operation "%s" is not defined for "%s".' - -SELF_IS_READONLY = 'IdentifierError: Variable "self" is read-only.' -SELF_INVALID_ATTRIBUTE_ID = 'IdentifierError: Cannot set "self" as attribute of a class.' -SELF_INVALID_PARAM_ID = 'IdentifierError: Cannot set "self" as parameter of a method.' -LOCAL_ALREADY_DEFINED = 'IdentifierError: Variable "%s" is already defined in method "%s".' -VARIABLE_NOT_DEFINED = 'IdentifierError: Variable "%s" is not defined in "%s".' - -INFERENCE_ERROR_ATTRIBUTE = 'InferenceError: Cannot infer type for attribute "%s".' -INFERENCE_ERROR_PARAMETER = 'InferenceError: Cannot infer type for parameter "%s".' -INFERENCE_ERROR_VARIABLE = 'InferenceError: Cannot infer type for variable "%s".' -INFERENCE_ERROR_METHOD = 'InferenceError: Cannot infer return type for method "%s".' - - -DIVIDE_BY_ZERO = 'ZeroDivisionError: Division by zero.' -INPUT_INT_ERROR = 'InputError: Expected a number.' -MAIN_CLASS_NOT_FOUND = 'MainClassNotFound: no Main class in program.' -MAIN_METHOD_NOT_FOUND = 'MainMethodNotFound: no main method in class Main.' -VOID_EXPRESSION = 'VoidReferenceError: Object reference not set to an instance of an object.' -CASE_OF_ERROR = 'CaseOfError: No branch matches wit de dynamic type of the case expression.' +ATTRIBUTE_OVERRIDE_ERROR = '(%d, %d) - SemanticError: Attribute "%s" already defined in "%s", attributes cannot be overridden' +METHOD_OVERRIDE_PARAM_ERROR = '(%d, %d) - SemanticError: In redefinded method "%s", the number of parameters different from the original definition. Expected %d, instead of %d' +METHOD_OVERRIDE_PARAM_ERROR = '(%d, %d) - SemanticError: In redefinded method "%s", param type "%s" is different from original param type "%s"' +METHOD_OVERRIDE_RETURN_ERROR = '(%d, %d) - SemanticError: In redefinded method "%s", return type "%s" is different from original return type "%s"' + +INCOMPATIBLE_TYPES = '(%d, %d) - TypeError: Cannot convert "%s" into "%s".' +INVALID_PARAM_TYPE = ( + '(%d, %d) - TypeError: "%s" cannot be a static type of a parameter.' +) +INVALID_CASE_TYPE = ( + '(%d, %d) - TypeError: "%s" cannot be a static type of a case branch.' +) +INVALID_PARENT_TYPE = '(%d, %d) - SemanticError: Class "%s" cannot inherits from "%s"' +INVALID_ANCESTOR = '(%d, %d) - TypeError: Class "%s" has no an ancestor class "%s".' + +INVALID_EQ_COMPARISON_OPERATION = '(%d, %d) - TypeError: For operation "=" if one of the expression has static type Int, Bool or String, then the other must have the same static type' +INVALID_BINARY_OPERATION = ( + '(%d, %d) - TypeError: Operation "%s" is not defined between "%s" and "%s".' +) +INVALID_UNARY_OPERATION = ( + '(%d, %d) - TypeError: Operation "%s" is not defined for "%s".' +) + +DISPATCH_UNDEFINED_METHOD = ( + '(%d, %d) - AttributeError: Dispatch undefined method "%s" from type %s' +) +DISPATCH_WITH_WRONG_NUMBER_OF_ARGS = '(%d, %d) - SemanticError: Method "%s" of type "%s" called with wrong number of arguments. Expected %d instead of %d' + + +SELF_IS_READONLY = '(%d, %d) - SemanticError: Variable "self" is read-only.' +SELF_INVALID_ATTRIBUTE_ID = ( + '(%d, %d) - SemanticError: Cannot set "self" as attribute of a class.' +) +SELF_INVALID_PARAM_ID = ( + '(%d, %d) - SemanticError: Cannot set "self" as parameter of a method.' +) +SELF_USED_IN_LET = ( + '(%d, %d) - SemanticError: "self" cannot be bound in a "let" expression' +) +LOCAL_ALREADY_DEFINED = ( + '(%d, %d) - SemanticError: Variable "%s" is already defined in method "%s".' +) +UNDEFINED_VARIABLE = '(%d, %d) - NameError: Variable "%s" is not defined in "%s".' +INVALID_REDEFINITION_CLASS = ( + '(%d, %d) - SemanticError: Invalid redefinition of class "%s"' +) +PARENT_ALREADY_SET = '(%d, %d) - SemanticError: Parent type is already set for "%s"' +PARENT_UNDEFINED = ( + '(%d, %d) - TypeError: Parent type for class "%s" is an undefined type "%s"' +) +ATTRIBUTE_ALREADY_DEFINED = ( + '(%d, %d) - SemanticError: Attribute "%s" is already defined in "%s".' +) +METHOD_ALREADY_DEFINED = '(%d, %d) - SemanticError: Method "%s" already defined in %s' +DUPLICATE_BARNCH_IN_CASE = ( + '(%d, %d) - SemanticError: Duplicate branch "%s" in case statement' +) + +CYCLIC_DEPENDENCY = '(%d, %d) - SemanticError: Class "%s", or an ancestor of "%s", is involved in an inheritance cycle' + +UNDEFINDED_ATTRIBUTE = '(%d, %d) - SemanticError: Attribute "%s" is not defined in %s' +UNDEFINDED_METHOD = '(%d, %d) - SemanticError: Method "%s" is not defined in %s' +UNDEFINED_TYPE = '(%d, %d) - TypeError: Type "%s" is not defined' +UNDEFINED_NEW_TYPE = ( + '(%d, %d) - TypeError: Using "new" expresion with undefined type "%s"' +) +UNDEFINED_TYPE_IN_BRANCH = ( + '(%d, %d) - TypeError: Class "%s" of case branch is undefined' +) +UNDEFINED_RETURN_TYPE = ( + '(%d, %d) - TypeError: Undefined return type "%s" in method "%s", in class "%s"' +) +UNDEFINED_PARAM_TYPE = ( + '(%d, %d) - TypeError: Undefined param type "%s" in method "%s", in class "%s"' +) +UNDEFINED_ATTRIBUTE_TYPE = ( + '(%d, %d) - TypeError: Undefined type "%s" for attribute "%s" in class "%s"' +) + +INFERENCE_ERROR_ATTRIBUTE = ( + '(%d, %d) - InferenceError: Cannot infer type for attribute "%s".' +) +INFERENCE_ERROR_PARAMETER = ( + '(%d, %d) - InferenceError: Cannot infer type for parameter "%s".' +) +INFERENCE_ERROR_VARIABLE = ( + '(%d, %d) - InferenceError: Cannot infer type for variable "%s".' +) +INFERENCE_ERROR_METHOD = ( + '(%d, %d) - InferenceError: Cannot infer return type for method "%s".' +) + +DIVIDE_BY_ZERO = "(%d, %d) - ZeroDivisionError: Division by zero." +INPUT_INT_ERROR = "(%d, %d) - InputError: Expected a number." +MAIN_CLASS_NOT_FOUND = "(%d, %d) - MainClassNotFound: no Main class in program." +MAIN_METHOD_NOT_FOUND = "(%d, %d) - MainMethodNotFound: no main method in class Main." +VOID_EXPRESSION = "(%d, %d) - VoidReferenceError: Object reference not set to an instance of an object." +CASE_OF_ERROR = "(%d, %d) - CaseOfError: No branch matches wit de dynamic type of the case expression." diff --git a/src/cool/semantics/utils/scope.py b/src/cool/semantics/utils/scope.py index e86f7fb16..c999e5d51 100644 --- a/src/cool/semantics/utils/scope.py +++ b/src/cool/semantics/utils/scope.py @@ -11,10 +11,10 @@ def text(self): class Attribute: def __init__(self, name, typex): self.name: str = name - self.type: 'Type' = typex + self.type: "Type" = typex def __str__(self): - return f'[attrib] {self.name} : {self.type.name};' + return f"[attrib] {self.name} : {self.type.name};" def __repr__(self): return str(self) @@ -24,17 +24,21 @@ class Method: def __init__(self, name, param_names, params_types, return_type): self.name: str = name self.param_names: List[str] = param_names - self.param_types: List['Type'] = params_types - self.return_type: 'Type' = return_type + self.param_types: List["Type"] = params_types + self.return_type: "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};' + 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 - tuple(other.param_types) == tuple(self.param_types)) + return ( + other.name == self.name + and other.return_type == self.return_type + and tuple(other.param_types) == tuple(self.param_types) + ) class Type: @@ -42,7 +46,7 @@ def __init__(self, name: str): self.name: str = name self.attributes_dict: OrderedDict[str, Attribute] = OrderedDict() self.methods_dict: OrderedDict[str, Method] = OrderedDict() - self.parent: Optional['Type'] = None + self.parent: Optional["Type"] = None @property def attributes(self): @@ -52,12 +56,14 @@ def attributes(self): def methods(self): return [x for _, x in self.methods_dict.items()] - def set_parent(self, parent: 'Type') -> None: + def set_parent(self, parent: "Type") -> None: if self.parent is not None: - raise SemanticError(f'Parent type is already set for {self.name}.') + raise SemanticError(f"Parent type is already set for {self.name}.") self.parent = parent - def get_attribute(self, name: str, get_owner: bool = False) -> Union[Attribute, Tuple[Attribute, 'Type']]: + def get_attribute( + self, name: str, get_owner: bool = False + ) -> Union[Attribute, Tuple[Attribute, "Type"]]: """ Search the innermost declaration of the attribute with the given name and return it, if "get_owner" has value "True" the returned object is a tuple (attribute, type) where type is the innermost `Type` in th Type @@ -72,16 +78,24 @@ def get_attribute(self, name: str, get_owner: bool = False) -> Union[Attribute, :return: the desired attribute and it's optional type owner. """ try: - return self.attributes_dict[name] if not get_owner else (self.attributes_dict[name], self) + return ( + self.attributes_dict[name] + if not get_owner + else (self.attributes_dict[name], self) + ) except KeyError: if self.parent is None: - raise SemanticError(f'Attribute "{name}" is not defined in {self.name}.') + raise SemanticError( + f'Attribute "{name}" is not defined in {self.name}.' + ) try: return self.parent.get_attribute(name, get_owner) except SemanticError: - raise SemanticError(f'Attribute "{name}" is not defined in {self.name}.') + raise SemanticError( + f'Attribute "{name}" is not defined in {self.name}.' + ) - def define_attribute(self, name: str, typex: 'Type') -> Attribute: + def define_attribute(self, name: str, typex: "Type") -> Attribute: try: self.get_attribute(name) except SemanticError: @@ -89,12 +103,20 @@ def define_attribute(self, name: str, typex: 'Type') -> Attribute: self.attributes_dict[name] = attribute return attribute else: - raise SemanticError(f'Attribute "{name}" is already defined in {self.name}.') + raise SemanticError( + f'Attribute "{name}" is already defined in {self.name}.' + ) def contains_attribute(self, name: str) -> bool: - return name in self.attributes_dict or self.parent is not None and self.parent.contains_attribute(name) - - def get_method(self, name: str, get_owner: bool = False) -> Union[Method, Tuple[Method, 'Type']]: + return ( + name in self.attributes_dict + or self.parent is not None + and self.parent.contains_attribute(name) + ) + + def get_method( + self, name: str, get_owner: bool = False + ) -> Union[Method, Tuple[Method, "Type"]]: """ Search the innermost declaration of the method with the given name and return it, if "get_owner" has value "True" the returned object is a tuple (method, type) where type is the innermost `Type` in th Type @@ -109,7 +131,11 @@ def get_method(self, name: str, get_owner: bool = False) -> Union[Method, Tuple[ :return: the desired method and it's optional type owner. """ try: - return self.methods_dict[name] if not get_owner else (self.methods_dict[name], self) + return ( + self.methods_dict[name] + if not get_owner + else (self.methods_dict[name], self) + ) except KeyError: if self.parent is None: raise SemanticError(f'Method "{name}" is not defined in {self.name}.') @@ -118,10 +144,13 @@ def get_method(self, name: str, get_owner: bool = False) -> Union[Method, Tuple[ except SemanticError: raise SemanticError(f'Method "{name}" is not defined in {self.name}.') - def define_method(self, name: str, - param_names: List[str], - param_types: List['Type'], - return_type: 'Type') -> Method: + def define_method( + self, + name: str, + param_names: List[str], + param_types: List["Type"], + return_type: "Type", + ) -> Method: if name in self.methods_dict: raise SemanticError(f'Method "{name}" already defined in {self.name}') @@ -130,22 +159,35 @@ def define_method(self, name: str, return method def contains_method(self, name) -> bool: - return name in self.methods_dict or (self.parent is not None and self.parent.contains_method(name)) + return name in self.methods_dict or ( + self.parent is not None and self.parent.contains_method(name) + ) - def all_attributes(self) -> List[Tuple[Attribute, 'Type']]: + def all_attributes(self) -> List[Tuple[Attribute, "Type"]]: attributes = [] if self.parent is None else self.parent.all_attributes() attributes += [(x, self) for x in self.attributes] return attributes - def all_methods(self) -> List[Tuple[Method, 'Type']]: + def all_methods(self) -> List[Tuple[Method, "Type"]]: methods = [] if self.parent is None else self.parent.all_methods() methods += [(x, self) for x in self.methods] return methods - def conforms_to(self, other: 'Type') -> bool: - return other.bypass() or self == other or self.parent is not None and self.parent.conforms_to(other) + def conforms_to(self, other: "Type") -> bool: + return ( + other.bypass() + or self == other + or self.parent is not None + and self.parent.conforms_to(other) + ) + + def join(self, other: "Type") -> "Type": + if isinstance(self, ErrorType): + return other + + if isinstance(other, ErrorType): + return self - def join(self, other: 'Type') -> 'Type': self_ancestors = set(self.get_ancestors()) current_type = other @@ -156,7 +198,7 @@ def join(self, other: 'Type') -> 'Type': return current_type @staticmethod - def multi_join(types: List['Type']) -> 'Type': + def multi_join(types: List["Type"]) -> "Type": static_type = types[0] for t in types[1:]: static_type = static_type.join(t) @@ -171,16 +213,16 @@ def get_ancestors(self): return [self] + self.parent.get_ancestors() def __str__(self): - output = f'type {self.name}' - parent = '' if self.parent is None else f' : {self.parent.name}' + output = f"type {self.name}" + parent = "" if self.parent is None else f" : {self.parent.name}" output += parent - output += ' {' - output += '\n\t' if self.attributes or self.methods else '' - output += '\n\t'.join(str(x) for x in self.attributes) - output += '\n\t' if self.attributes_dict else '' - output += '\n\t'.join(str(x) for x in self.methods) - output += '\n' if self.methods_dict else '' - output += '}\n' + output += " {" + output += "\n\t" if self.attributes or self.methods else "" + output += "\n\t".join(str(x) for x in self.attributes) + output += "\n\t" if self.attributes_dict else "" + output += "\n\t".join(str(x) for x in self.methods) + output += "\n" if self.methods_dict else "" + output += "}\n" return output def __repr__(self): @@ -189,7 +231,7 @@ def __repr__(self): class ErrorType(Type): def __init__(self): - super().__init__('Error') + super().__init__("Error") def conforms_to(self, other): return True @@ -207,7 +249,7 @@ def __init__(self): def create_type(self, name: str) -> Type: if name in self.types: - raise SemanticError(f'Type with the same name ({name}) already in context.') + raise SemanticError(f"Type with the same name ({name}) already in context.") typex = self.types[name] = Type(name) return typex @@ -218,7 +260,11 @@ def get_type(self, name: str) -> Type: raise SemanticError(f'Type "{name}" is not defined.') def __str__(self): - return '{\n\t' + '\n\t'.join(y for x in self.types.values() for y in str(x).split('\n')) + '\n}' + 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) @@ -233,16 +279,16 @@ def __init__(self, name, var_type): self.type: Type = var_type def __str__(self): - return self.name + ': ' + self.type.name + return self.name + ": " + self.type.name class Scope: - def __init__(self, parent: Optional['Scope'] = None): + def __init__(self, parent: Optional["Scope"] = None): self.locals: Dict[str, VariableInfo] = {} - self.parent: Optional['Scope'] = parent + self.parent: Optional["Scope"] = parent self.children: List[Scope] = [] - def create_child(self) -> 'Scope': + def create_child(self) -> "Scope": child = Scope(self) self.children.append(child) return child @@ -256,7 +302,9 @@ def find_variable(self, var_name: str) -> Optional[VariableInfo]: try: return self.locals[var_name] except KeyError: - return self.parent.find_variable(var_name) if self.parent is not None else None + return ( + self.parent.find_variable(var_name) if self.parent is not None else None + ) def is_defined(self, var_name) -> bool: return self.find_variable(var_name) is not None diff --git a/tests/execution/01_program.cl b/tests/execution/01_program.cl deleted file mode 100644 index c87561ca0..000000000 --- a/tests/execution/01_program.cl +++ /dev/null @@ -1,34 +0,0 @@ -class Main inherits IO { - number: Int <- 5; - - main () : Object { - testing_fibonacci(number) - }; - - testing_fibonacci(n: Int) : IO {{ - out_string("Iterative Fibonacci : "); - out_int(iterative_fibonacci(5)); - out_string("\n"); - - out_string("Recursive Fibonacci : "); - out_int(recursive_fibonacci(5)); - out_string("\n"); - }}; - - recursive_fibonacci (n: AUTO_TYPE) : AUTO_TYPE { - if n <= 2 then 1 else recursive_fibonacci(n - 1) + recursive_fibonacci(n - 2) fi - }; - - iterative_fibonacci(n: AUTO_TYPE) : AUTO_TYPE { - let i: Int <- 2, n1: Int <- 1, n2: Int <- 1, temp: Int in { - while i < n loop - let temp: Int <- n2 in { - n2 <- n2 + n1; - n1 <- temp; - i <- i + 1; - } - pool; - n2; - } - }; -} \ No newline at end of file diff --git a/tests/execution/02_program.cl b/tests/execution/02_program.cl deleted file mode 100644 index eb3a70605..000000000 --- a/tests/execution/02_program.cl +++ /dev/null @@ -1,24 +0,0 @@ -class Main inherits IO { - main (): Object { - { - out_int((new Ackermann).ackermann(3, 2)); - out_string("\n"); - } - }; -} - -class Ackermann { - ackermann (m: Int, n: Int): Int { - if m = 0 - then - n + 1 - else - if n = 0 - then - self.ackermann(m - 1, 1) - else - self.ackermann(m - 1, self.ackermann(m, n - 1)) - fi - fi - }; -} \ No newline at end of file diff --git a/tests/execution/03_program.cl b/tests/execution/03_program.cl deleted file mode 100644 index bab710ec4..000000000 --- a/tests/execution/03_program.cl +++ /dev/null @@ -1,19 +0,0 @@ -class A { } - -class B inherits A { } - -class C inherits A { } - -class Main inherits IO { - main () : Object { - testing_case() - }; - - testing_case() : IO { - let a: A <- new C in - case a of - x: B => out_string("Is type B.\n"); - x: C => out_string("Is type C.\n"); - esac - }; -} \ No newline at end of file diff --git a/tests/execution/04_program.cl b/tests/execution/04_program.cl deleted file mode 100644 index ca0850a18..000000000 --- a/tests/execution/04_program.cl +++ /dev/null @@ -1,47 +0,0 @@ -class Main inherits IO { - main (): IO { - let vector: Vector2 <- (new Vector2).init(0, 0) in - vector.print_vector() - }; -} - -class Vector2 { - x: Int; - - y: Int; - - init (x_: Int, y_: Int): Vector2 { - { - x <- x_; - y <- y_; - self; - } - }; - - get_x (): Int { - x - }; - - get_y (): Int { - y - }; - - add (v: Vector2): Vector2 { - (new Vector2).init(x + v.get_x(), y + v.get_y()) - }; - - print_vector (): IO { - let io: IO <- (new IO) in - { - io.out_string("("); - io.out_int(self.get_x()); - io.out_string("; "); - io.out_int(self.get_y()); - io.out_string(")\n"); - } - }; - - clone_vector (): Vector2 { - (new Vector2).init(x, y) - }; -} \ No newline at end of file diff --git a/tests/execution/05_program.cl b/tests/execution/05_program.cl deleted file mode 100644 index b67842198..000000000 --- a/tests/execution/05_program.cl +++ /dev/null @@ -1,23 +0,0 @@ -class Main { - main (): Object { - let total: Int <- 10, - i: Int <- 1, - io: IO <- (new IO) in - while i <= total loop - { - io.out_int(self.fibonacci(i)); - io.out_string("\n"); - i <- i + 1; - } - pool - }; - - fibonacci (n: Int): Int { - if n <= 2 - then - 1 - else - self.fibonacci(n - 1) + self.fibonacci(n - 2) - fi - }; -} \ No newline at end of file diff --git a/tests/execution/06_program.cl b/tests/execution/06_program.cl deleted file mode 100644 index ec388ebd7..000000000 --- a/tests/execution/06_program.cl +++ /dev/null @@ -1,38 +0,0 @@ -class Main inherits IO { - main (): Object { - let id : Int, - name : String, - email : String in - { - self.out_string("Introduzca su id: "); - id <- self.in_int(); - self.out_string("Introduzca su nombre: "); - name <- self.in_string(); - self.out_string("Introduzca su email: "); - email <- self.in_string(); - let user: User <- (new User).init(id, name, email) in - self.out_string("Created user: ".concat(user.get_name()).concat("\n")); - } - }; -} - -class User { - id: Int; - - name: String; - - email: String; - - init (id_: Int, name_: String, email_: String): User { - { - id <- id_; - name <- name_; - email <- email_; - self; - } - }; - - get_name (): String { - name - }; -} \ No newline at end of file diff --git a/tests/inference/01_program.cl b/tests/inference/01_program.cl deleted file mode 100644 index 794f2ea3f..000000000 --- a/tests/inference/01_program.cl +++ /dev/null @@ -1,16 +0,0 @@ -class Main { - main (): Object { - 0 - }; -} - -class Point { - x: AUTO_TYPE; - y: AUTO_TYPE; - - init(x0: Int, y0: Int): AUTO_TYPE {{ - x <- x0; - y <- y0; - self; - }}; -} \ No newline at end of file diff --git a/tests/inference/01_result.txt b/tests/inference/01_result.txt deleted file mode 100644 index a09a7f345..000000000 --- a/tests/inference/01_result.txt +++ /dev/null @@ -1,19 +0,0 @@ -class Main { - main (): Object { - 0 - }; -} - -class Point { - x: Int; - - y: Int; - - init (x0: Int, y0: Int): Point { - { - x <- x0; - y <- y0; - self; - } - }; -} \ No newline at end of file diff --git a/tests/inference/02_program.cl b/tests/inference/02_program.cl deleted file mode 100644 index 0b4afe948..000000000 --- a/tests/inference/02_program.cl +++ /dev/null @@ -1,15 +0,0 @@ -class Main { - main (): Object { - let x: Int <- (new Ackermann).ackermann(5, 6) in x - }; -} - -class Ackermann { - ackermann(m: AUTO_TYPE, n: AUTO_TYPE): AUTO_TYPE { - if m = 0 then n + 1 else - if n = 0 then ackermann(m - 1, 1) else - ackermann(m - 1, ackermann(m, n - 1)) - fi - fi - }; -} \ No newline at end of file diff --git a/tests/inference/02_result.txt b/tests/inference/02_result.txt deleted file mode 100644 index 28aab1a38..000000000 --- a/tests/inference/02_result.txt +++ /dev/null @@ -1,22 +0,0 @@ -class Main { - main (): Object { - let x: Int <- (new Ackermann).ackermann(5, 6) in - x - }; -} - -class Ackermann { - ackermann (m: Int, n: Int): Int { - if m = 0 - then - n + 1 - else - if n = 0 - then - self.ackermann(m - 1, 1) - else - self.ackermann(m - 1, self.ackermann(m, n - 1)) - fi - fi - }; -} \ No newline at end of file diff --git a/tests/inference/03_program.cl b/tests/inference/03_program.cl deleted file mode 100644 index 68c4b3117..000000000 --- a/tests/inference/03_program.cl +++ /dev/null @@ -1,17 +0,0 @@ -class Main { - main (): AUTO_TYPE { - 0 - }; - - f(a: AUTO_TYPE, b: AUTO_TYPE): AUTO_TYPE { - if a = 1 then b else - g(a + 1, b / 1) - fi - }; - - g(a: AUTO_TYPE, b: AUTO_TYPE): AUTO_TYPE { - if b = 1 then a else - f(a / 2, b + 1) - fi - }; -} \ No newline at end of file diff --git a/tests/inference/03_result.txt b/tests/inference/03_result.txt deleted file mode 100644 index e65b20c1e..000000000 --- a/tests/inference/03_result.txt +++ /dev/null @@ -1,23 +0,0 @@ -class Main { - main (): Int { - 0 - }; - - f (a: Int, b: Int): Int { - if a = 1 - then - b - else - self.g(a + 1, b / 1) - fi - }; - - g (a: Int, b: Int): Int { - if b = 1 - then - a - else - self.f(a / 2, b + 1) - fi - }; -} \ No newline at end of file diff --git a/tests/inference/04_program.cl b/tests/inference/04_program.cl deleted file mode 100644 index 4eaffa71a..000000000 --- a/tests/inference/04_program.cl +++ /dev/null @@ -1,16 +0,0 @@ -class Main { - main (): Object { - 0 - }; -} - -class Point { - x: Int; - y: Int; - - init(x0: AUTO_TYPE, y0: AUTO_TYPE): AUTO_TYPE {{ - x <- x0; - y <- y0; - self; - }}; -} \ No newline at end of file diff --git a/tests/inference/04_result.txt b/tests/inference/04_result.txt deleted file mode 100644 index a09a7f345..000000000 --- a/tests/inference/04_result.txt +++ /dev/null @@ -1,19 +0,0 @@ -class Main { - main (): Object { - 0 - }; -} - -class Point { - x: Int; - - y: Int; - - init (x0: Int, y0: Int): Point { - { - x <- x0; - y <- y0; - self; - } - }; -} \ No newline at end of file diff --git a/tests/inference/05_program.cl b/tests/inference/05_program.cl deleted file mode 100644 index dbb3aaae7..000000000 --- a/tests/inference/05_program.cl +++ /dev/null @@ -1,16 +0,0 @@ -class Main { - main (): Object { - 0 - }; - - f (a: AUTO_TYPE, b: AUTO_TYPE, c: AUTO_TYPE, d: AUTO_TYPE): AUTO_TYPE { - { - a <- b; - b <- c; - c <- d; - d <- a; - d + 1; - a; - } - }; -} \ No newline at end of file diff --git a/tests/inference/05_result.txt b/tests/inference/05_result.txt deleted file mode 100644 index 19918ead2..000000000 --- a/tests/inference/05_result.txt +++ /dev/null @@ -1,16 +0,0 @@ -class Main { - main (): Object { - 0 - }; - - f (a: Int, b: Int, c: Int, d: Int): Int { - { - a <- b; - b <- c; - c <- d; - d <- a; - d + 1; - a; - } - }; -} \ No newline at end of file diff --git a/tests/inference/06_program.cl b/tests/inference/06_program.cl deleted file mode 100644 index da192644d..000000000 --- a/tests/inference/06_program.cl +++ /dev/null @@ -1,44 +0,0 @@ -class Main inherits IO { - main(): IO { - let vector: AUTO_TYPE <- (new Vector2).init(0, 0) in - vector.print_vector() - }; -} - -class Vector2 { - x: AUTO_TYPE; - y: AUTO_TYPE; - - init(x_: AUTO_TYPE, y_: AUTO_TYPE): AUTO_TYPE {{ - x <- x_; - y <- y_; - self; - }}; - - - get_x(): AUTO_TYPE { - x - }; - - get_y(): AUTO_TYPE { - y - }; - - add(v: Vector2): AUTO_TYPE { - (new Vector2).init(x + v.get_x(), y + v.get_y()) - }; - - print_vector(): AUTO_TYPE { - let io: IO <- new IO in { - io.out_string("("); - io.out_int(get_x()); - io.out_string("; "); - io.out_int(get_y()); - io.out_string(")\n"); - } - }; - - clone_vector(): AUTO_TYPE { - (new Vector2).init(x, y) - }; -} \ No newline at end of file diff --git a/tests/inference/06_result.txt b/tests/inference/06_result.txt deleted file mode 100644 index ca0850a18..000000000 --- a/tests/inference/06_result.txt +++ /dev/null @@ -1,47 +0,0 @@ -class Main inherits IO { - main (): IO { - let vector: Vector2 <- (new Vector2).init(0, 0) in - vector.print_vector() - }; -} - -class Vector2 { - x: Int; - - y: Int; - - init (x_: Int, y_: Int): Vector2 { - { - x <- x_; - y <- y_; - self; - } - }; - - get_x (): Int { - x - }; - - get_y (): Int { - y - }; - - add (v: Vector2): Vector2 { - (new Vector2).init(x + v.get_x(), y + v.get_y()) - }; - - print_vector (): IO { - let io: IO <- (new IO) in - { - io.out_string("("); - io.out_int(self.get_x()); - io.out_string("; "); - io.out_int(self.get_y()); - io.out_string(")\n"); - } - }; - - clone_vector (): Vector2 { - (new Vector2).init(x, y) - }; -} \ No newline at end of file diff --git a/tests/inference/07_program.cl b/tests/inference/07_program.cl deleted file mode 100644 index 6b9e01d8f..000000000 --- a/tests/inference/07_program.cl +++ /dev/null @@ -1,19 +0,0 @@ -(* This program prints the first 10 numbers of fibonacci *) -class Main { - - main(): Object { - let total: AUTO_TYPE <- 10, - i: AUTO_TYPE <- 1 , - io: AUTO_TYPE <- new IO in - while i <= total loop { - io.out_int(fibonacci(i)); - io.out_string("\n"); - i <- i + 1; - } - pool - }; - - fibonacci (n: AUTO_TYPE): AUTO_TYPE { - if n <= 2 then 1 else fibonacci(n - 1) + fibonacci(n - 2) fi - }; -} \ No newline at end of file diff --git a/tests/inference/07_result.txt b/tests/inference/07_result.txt deleted file mode 100644 index b67842198..000000000 --- a/tests/inference/07_result.txt +++ /dev/null @@ -1,23 +0,0 @@ -class Main { - main (): Object { - let total: Int <- 10, - i: Int <- 1, - io: IO <- (new IO) in - while i <= total loop - { - io.out_int(self.fibonacci(i)); - io.out_string("\n"); - i <- i + 1; - } - pool - }; - - fibonacci (n: Int): Int { - if n <= 2 - then - 1 - else - self.fibonacci(n - 1) + self.fibonacci(n - 2) - fi - }; -} \ No newline at end of file diff --git a/tests/inference/08_program.cl b/tests/inference/08_program.cl deleted file mode 100644 index 8a0ccf4c9..000000000 --- a/tests/inference/08_program.cl +++ /dev/null @@ -1,33 +0,0 @@ -(* Testing IO *) -class Main inherits IO { - - main(): Object { - let id: AUTO_TYPE, name: AUTO_TYPE, email: AUTO_TYPE in { - out_string("Introduzca su id: "); - id <- self.in_int(); - out_string("Introduzca su nombre: "); - name <- self.in_string(); - out_string("Introduzca su email: "); - email <- self.in_string(); - let user: AUTO_TYPE <- (new User).init(id, name, email) in - out_string("Created user: ".concat(user.get_name()).concat("\n")); - } - }; -} - -class User { - id: AUTO_TYPE; - name: AUTO_TYPE; - email: AUTO_TYPE; - - init(id_: AUTO_TYPE, name_: AUTO_TYPE, email_: AUTO_TYPE): AUTO_TYPE {{ - id <- id_; - name <- name_; - email <- email_; - self; - }}; - - get_name(): AUTO_TYPE { - name - }; -} \ No newline at end of file diff --git a/tests/inference/08_result.txt b/tests/inference/08_result.txt deleted file mode 100644 index ec388ebd7..000000000 --- a/tests/inference/08_result.txt +++ /dev/null @@ -1,38 +0,0 @@ -class Main inherits IO { - main (): Object { - let id : Int, - name : String, - email : String in - { - self.out_string("Introduzca su id: "); - id <- self.in_int(); - self.out_string("Introduzca su nombre: "); - name <- self.in_string(); - self.out_string("Introduzca su email: "); - email <- self.in_string(); - let user: User <- (new User).init(id, name, email) in - self.out_string("Created user: ".concat(user.get_name()).concat("\n")); - } - }; -} - -class User { - id: Int; - - name: String; - - email: String; - - init (id_: Int, name_: String, email_: String): User { - { - id <- id_; - name <- name_; - email <- email_; - self; - } - }; - - get_name (): String { - name - }; -} \ No newline at end of file diff --git a/tests/inference/09_program.cl b/tests/inference/09_program.cl deleted file mode 100644 index 4eaffa71a..000000000 --- a/tests/inference/09_program.cl +++ /dev/null @@ -1,16 +0,0 @@ -class Main { - main (): Object { - 0 - }; -} - -class Point { - x: Int; - y: Int; - - init(x0: AUTO_TYPE, y0: AUTO_TYPE): AUTO_TYPE {{ - x <- x0; - y <- y0; - self; - }}; -} \ No newline at end of file diff --git a/tests/inference/09_result.txt b/tests/inference/09_result.txt deleted file mode 100644 index a09a7f345..000000000 --- a/tests/inference/09_result.txt +++ /dev/null @@ -1,19 +0,0 @@ -class Main { - main (): Object { - 0 - }; -} - -class Point { - x: Int; - - y: Int; - - init (x0: Int, y0: Int): Point { - { - x <- x0; - y <- y0; - self; - } - }; -} \ No newline at end of file diff --git a/tests/inference/10_program.cl b/tests/inference/10_program.cl deleted file mode 100644 index 22e26a116..000000000 --- a/tests/inference/10_program.cl +++ /dev/null @@ -1,33 +0,0 @@ -class Main { - main (): Object { - 0 - }; - - f(): AUTO_TYPE { - if true then - if true then - create_dog() - else - create_cat() fi - else - create_reptile() fi - }; - - create_dog(): AUTO_TYPE { - new Dog - }; - - create_cat(): AUTO_TYPE { - new Cat - }; - - create_reptile(): AUTO_TYPE { - new Reptile - }; -} - -class Animal {} -class Mammal inherits Animal {} -class Reptile inherits Animal {} -class Dog inherits Mammal {} -class Cat inherits Mammal {} \ No newline at end of file diff --git a/tests/inference/10_result.txt b/tests/inference/10_result.txt deleted file mode 100644 index db2bc9341..000000000 --- a/tests/inference/10_result.txt +++ /dev/null @@ -1,51 +0,0 @@ -class Main { - main (): Object { - 0 - }; - - f (): Animal { - if true - then - if true - then - self.create_dog() - else - self.create_cat() - fi - else - self.create_reptile() - fi - }; - - create_dog (): Dog { - (new Dog) - }; - - create_cat (): Cat { - (new Cat) - }; - - create_reptile (): Reptile { - (new Reptile) - }; -} - -class Animal { - -} - -class Mammal inherits Animal { - -} - -class Reptile inherits Animal { - -} - -class Dog inherits Mammal { - -} - -class Cat inherits Mammal { - -} \ No newline at end of file diff --git a/tests/inference/11_program.cl b/tests/inference/11_program.cl deleted file mode 100644 index 80cf2ee8b..000000000 --- a/tests/inference/11_program.cl +++ /dev/null @@ -1,35 +0,0 @@ -class Main { - main (): Object { - 0 - }; - - f(): AUTO_TYPE { - let x: AUTO_TYPE <- new Dog in - case x of - m: Mammal => - case m of - c: Cat => create_cat(); - d: Dog => create_dog(); - esac; - r: Reptile => create_reptile(); - esac - }; - - create_dog(): AUTO_TYPE { - new Dog - }; - - create_cat(): AUTO_TYPE { - new Cat - }; - - create_reptile(): AUTO_TYPE { - new Reptile - }; -} - -class Animal {} -class Mammal inherits Animal {} -class Reptile inherits Animal {} -class Dog inherits Mammal {} -class Cat inherits Mammal {} \ No newline at end of file diff --git a/tests/inference/11_result.txt b/tests/inference/11_result.txt deleted file mode 100644 index f291cb86b..000000000 --- a/tests/inference/11_result.txt +++ /dev/null @@ -1,52 +0,0 @@ -class Main { - main (): Object { - 0 - }; - - f (): Animal { - let x: Dog <- (new Dog) in - case x of - m : Mammal => - case m of - c : Cat => - self.create_cat(); - d : Dog => - self.create_dog(); - esac; - r : Reptile => - self.create_reptile(); - esac - }; - - create_dog (): Dog { - (new Dog) - }; - - create_cat (): Cat { - (new Cat) - }; - - create_reptile (): Reptile { - (new Reptile) - }; -} - -class Animal { - -} - -class Mammal inherits Animal { - -} - -class Reptile inherits Animal { - -} - -class Dog inherits Mammal { - -} - -class Cat inherits Mammal { - -} \ No newline at end of file From 0499de5d27972f90dec49e1fa79ebe1b51a914b9 Mon Sep 17 00:00:00 2001 From: alejandroklever Date: Wed, 28 Jul 2021 02:28:25 -0400 Subject: [PATCH 120/143] changed grammar --- src/cool/grammar.py | 21 +- src/cool/parsertab.py | 2216 ++++++++++++++++++++--------------------- 2 files changed, 1094 insertions(+), 1143 deletions(-) diff --git a/src/cool/grammar.py b/src/cool/grammar.py index 727b65a16..550e62836 100644 --- a/src/cool/grammar.py +++ b/src/cool/grammar.py @@ -24,8 +24,9 @@ expr_list = G.add_non_terminal('expr-list') not_empty_expr_list = G.add_non_terminal('not-empty-expr-list') expr = G.add_non_terminal('expr') +negable_comp = G.add_non_terminal('negable-comp') comp = G.add_non_terminal('comp') -negable = G.add_non_terminal('negable') +negable_arith = G.add_non_terminal('negable-arith') arith = G.add_non_terminal('arith') term = G.add_non_terminal('term') factor = G.add_non_terminal('factor') @@ -255,19 +256,19 @@ def lexical_error(lexer): expr %= 'while expr loop expr pool', lambda s: ast.WhileNode(s[2], s[4]) expr %= 'let declaration-list in expr', lambda s: ast.LetNode(s[2], s[4]) expr %= 'case expr of case-list esac', lambda s: ast.SwitchCaseNode(s[2], s[4]) -expr %= 'negable', lambda s: s[1] +expr %= 'negable-comp', lambda s: s[1] -negable %= 'not comp', lambda s: ast.NegationNode(s[2]) -negable %= 'comp', lambda s: s[1] +negable_comp %= 'not comp', lambda s: ast.NegationNode(s[2]) +negable_comp %= 'comp', lambda s: s[1] -comp %= 'comp < arith', lambda s: ast.LessThanNode(s[1], s[2], s[3]) -comp %= 'comp <= arith', lambda s: ast.LessEqualNode(s[1], s[2], s[3]) -comp %= 'comp = arith', lambda s: ast.EqualNode(s[1], s[2], s[3]) -comp %= 'comp = not arith', lambda s: ast.EqualNode(s[1], s[2], ast.NegationNode(s[4])) -comp %= 'comp < not arith', lambda s: ast.LessThanNode(s[1], s[2], ast.NegationNode(s[4])) -comp %= 'comp <= not arith', lambda s: ast.LessEqualNode(s[1], s[2], ast.NegationNode(s[4])) +comp %= 'comp < negable-arith', lambda s: ast.LessThanNode(s[1], s[2], s[3]) +comp %= 'comp <= negable-arith', lambda s: ast.LessEqualNode(s[1], s[2], s[3]) +comp %= 'comp = negable-arith', lambda s: ast.EqualNode(s[1], s[2], s[3]) comp %= 'arith', lambda s: s[1] +negable_arith %= 'not arith', lambda s: ast.NegationNode(s[2]) +negable_arith %= 'arith', lambda s: s[1] + arith %= 'arith + term', lambda s: ast.PlusNode(s[1], s[2], s[3]) arith %= 'arith - term', lambda s: ast.MinusNode(s[1], s[2], s[3]) arith %= 'term', lambda s: s[1] diff --git a/src/cool/parsertab.py b/src/cool/parsertab.py index 338ba4450..1479bc252 100644 --- a/src/cool/parsertab.py +++ b/src/cool/parsertab.py @@ -17,138 +17,138 @@ def __action_table(): return { (0, G["class"]): ("SHIFT", 1), (1, G["type"]): ("SHIFT", 2), + (2, G["inherits"]): ("SHIFT", 149), (2, G["{"]): ("SHIFT", 3), - (2, G["inherits"]): ("SHIFT", 152), - (3, G["}"]): ("REDUCE", G["feature-list -> e"]), (3, G["id"]): ("SHIFT", 4), - (4, G[":"]): ("SHIFT", 136), + (3, G["}"]): ("REDUCE", G["feature-list -> e"]), + (4, G[":"]): ("SHIFT", 133), (4, G["("]): ("SHIFT", 5), - (5, G["id"]): ("SHIFT", 124), (5, G[")"]): ("SHIFT", 6), + (5, G["id"]): ("SHIFT", 121), (6, G[":"]): ("SHIFT", 7), (7, G["type"]): ("SHIFT", 8), (8, G["{"]): ("SHIFT", 9), - (9, G["true"]): ("SHIFT", 25), - (9, G["case"]): ("SHIFT", 21), - (9, G["not"]): ("SHIFT", 30), (9, G["while"]): ("SHIFT", 13), (9, G["false"]): ("SHIFT", 26), (9, G["id"]): ("SHIFT", 46), + (9, G["case"]): ("SHIFT", 21), + (9, G["not"]): ("SHIFT", 30), (9, G["string"]): ("SHIFT", 32), - (9, G["("]): ("SHIFT", 11), - (9, G["new"]): ("SHIFT", 22), (9, G["{"]): ("SHIFT", 10), - (9, G["~"]): ("SHIFT", 27), (9, G["isvoid"]): ("SHIFT", 24), (9, G["if"]): ("SHIFT", 12), - (9, G["int"]): ("SHIFT", 31), + (9, G["new"]): ("SHIFT", 22), + (9, G["("]): ("SHIFT", 11), + (9, G["~"]): ("SHIFT", 27), (9, G["let"]): ("SHIFT", 14), + (9, G["int"]): ("SHIFT", 31), + (9, G["true"]): ("SHIFT", 25), + (10, G["false"]): ("SHIFT", 26), (10, G["id"]): ("SHIFT", 46), - (10, G["("]): ("SHIFT", 11), - (10, G["new"]): ("SHIFT", 22), - (10, G["~"]): ("SHIFT", 27), - (10, G["{"]): ("SHIFT", 10), + (10, G["while"]): ("SHIFT", 13), (10, G["isvoid"]): ("SHIFT", 24), + (10, G["string"]): ("SHIFT", 32), + (10, G["~"]): ("SHIFT", 27), + (10, G["not"]): ("SHIFT", 30), + (10, G["case"]): ("SHIFT", 21), + (10, G["new"]): ("SHIFT", 22), (10, G["if"]): ("SHIFT", 12), + (10, G["{"]): ("SHIFT", 10), + (10, G["("]): ("SHIFT", 11), + (10, G["let"]): ("SHIFT", 14), (10, G["true"]): ("SHIFT", 25), (10, G["int"]): ("SHIFT", 31), - (10, G["let"]): ("SHIFT", 14), - (10, G["not"]): ("SHIFT", 30), - (10, G["case"]): ("SHIFT", 21), - (10, G["while"]): ("SHIFT", 13), - (10, G["false"]): ("SHIFT", 26), - (10, G["string"]): ("SHIFT", 32), - (11, G["("]): ("SHIFT", 11), - (11, G["new"]): ("SHIFT", 22), - (11, G["if"]): ("SHIFT", 12), (11, G["{"]): ("SHIFT", 10), - (11, G["~"]): ("SHIFT", 27), - (11, G["int"]): ("SHIFT", 31), + (11, G["string"]): ("SHIFT", 32), (11, G["id"]): ("SHIFT", 46), + (11, G["if"]): ("SHIFT", 12), + (11, G["new"]): ("SHIFT", 22), + (11, G["("]): ("SHIFT", 11), (11, G["isvoid"]): ("SHIFT", 24), - (11, G["true"]): ("SHIFT", 25), (11, G["let"]): ("SHIFT", 14), + (11, G["~"]): ("SHIFT", 27), + (11, G["int"]): ("SHIFT", 31), + (11, G["true"]): ("SHIFT", 25), + (11, G["while"]): ("SHIFT", 13), (11, G["false"]): ("SHIFT", 26), - (11, G["not"]): ("SHIFT", 30), (11, G["case"]): ("SHIFT", 21), - (11, G["string"]): ("SHIFT", 32), - (11, G["while"]): ("SHIFT", 13), - (12, G["string"]): ("SHIFT", 32), + (11, G["not"]): ("SHIFT", 30), + (12, G["case"]): ("SHIFT", 21), + (12, G["not"]): ("SHIFT", 30), + (12, G["if"]): ("SHIFT", 12), (12, G["{"]): ("SHIFT", 10), - (12, G["~"]): ("SHIFT", 27), - (12, G["id"]): ("SHIFT", 46), - (12, G["("]): ("SHIFT", 11), (12, G["new"]): ("SHIFT", 22), - (12, G["isvoid"]): ("SHIFT", 24), + (12, G["("]): ("SHIFT", 11), + (12, G["id"]): ("SHIFT", 46), (12, G["let"]): ("SHIFT", 14), - (12, G["if"]): ("SHIFT", 12), (12, G["int"]): ("SHIFT", 31), - (12, G["not"]): ("SHIFT", 30), - (12, G["case"]): ("SHIFT", 21), (12, G["true"]): ("SHIFT", 25), - (12, G["while"]): ("SHIFT", 13), + (12, G["isvoid"]): ("SHIFT", 24), (12, G["false"]): ("SHIFT", 26), - (13, G["while"]): ("SHIFT", 13), - (13, G["true"]): ("SHIFT", 25), + (12, G["~"]): ("SHIFT", 27), + (12, G["while"]): ("SHIFT", 13), + (12, G["string"]): ("SHIFT", 32), (13, G["int"]): ("SHIFT", 31), - (13, G["false"]): ("SHIFT", 26), (13, G["{"]): ("SHIFT", 10), + (13, G["true"]): ("SHIFT", 25), + (13, G["false"]): ("SHIFT", 26), (13, G["id"]): ("SHIFT", 46), + (13, G["let"]): ("SHIFT", 14), (13, G["string"]): ("SHIFT", 32), - (13, G["new"]): ("SHIFT", 22), - (13, G["~"]): ("SHIFT", 27), - (13, G["("]): ("SHIFT", 11), (13, G["isvoid"]): ("SHIFT", 24), - (13, G["let"]): ("SHIFT", 14), (13, G["if"]): ("SHIFT", 12), + (13, G["~"]): ("SHIFT", 27), + (13, G["new"]): ("SHIFT", 22), + (13, G["("]): ("SHIFT", 11), + (13, G["while"]): ("SHIFT", 13), (13, G["case"]): ("SHIFT", 21), (13, G["not"]): ("SHIFT", 30), (14, G["id"]): ("SHIFT", 15), (15, G[":"]): ("SHIFT", 16), (16, G["type"]): ("SHIFT", 17), + (17, G["<-"]): ("SHIFT", 20), (17, G[","]): ("SHIFT", 18), (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), - (17, G["<-"]): ("SHIFT", 20), (18, G["id"]): ("SHIFT", 15), (19, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), - (20, G["if"]): ("SHIFT", 12), - (20, G["id"]): ("SHIFT", 46), (20, G["int"]): ("SHIFT", 31), (20, G["true"]): ("SHIFT", 25), - (20, G["~"]): ("SHIFT", 27), + (20, G["id"]): ("SHIFT", 46), + (20, G["false"]): ("SHIFT", 26), (20, G["let"]): ("SHIFT", 14), (20, G["isvoid"]): ("SHIFT", 24), - (20, G["not"]): ("SHIFT", 30), - (20, G["case"]): ("SHIFT", 21), - (20, G["false"]): ("SHIFT", 26), - (20, G["{"]): ("SHIFT", 10), - (20, G["while"]): ("SHIFT", 13), (20, G["string"]): ("SHIFT", 32), - (20, G["("]): ("SHIFT", 11), + (20, G["~"]): ("SHIFT", 27), + (20, G["while"]): ("SHIFT", 13), + (20, G["if"]): ("SHIFT", 12), (20, G["new"]): ("SHIFT", 22), - (21, G["string"]): ("SHIFT", 32), + (20, G["("]): ("SHIFT", 11), + (20, G["case"]): ("SHIFT", 21), + (20, G["not"]): ("SHIFT", 30), + (20, G["{"]): ("SHIFT", 10), + (21, G["isvoid"]): ("SHIFT", 24), + (21, G["~"]): ("SHIFT", 27), (21, G["id"]): ("SHIFT", 46), - (21, G["new"]): ("SHIFT", 22), - (21, G["("]): ("SHIFT", 11), (21, G["while"]): ("SHIFT", 13), - (21, G["{"]): ("SHIFT", 10), - (21, G["if"]): ("SHIFT", 12), (21, G["true"]): ("SHIFT", 25), (21, G["int"]): ("SHIFT", 31), - (21, G["let"]): ("SHIFT", 14), + (21, G["false"]): ("SHIFT", 26), (21, G["not"]): ("SHIFT", 30), (21, G["case"]): ("SHIFT", 21), - (21, G["~"]): ("SHIFT", 27), - (21, G["false"]): ("SHIFT", 26), - (21, G["isvoid"]): ("SHIFT", 24), + (21, G["{"]): ("SHIFT", 10), + (21, G["string"]): ("SHIFT", 32), + (21, G["if"]): ("SHIFT", 12), + (21, G["new"]): ("SHIFT", 22), + (21, G["("]): ("SHIFT", 11), + (21, G["let"]): ("SHIFT", 14), (22, G["type"]): ("SHIFT", 23), (23, G["."]): ("REDUCE", G["atom -> new type"]), (23, G["else"]): ("REDUCE", G["atom -> new type"]), (23, G["="]): ("REDUCE", G["atom -> new type"]), (23, G[","]): ("REDUCE", G["atom -> new type"]), (23, G["fi"]): ("REDUCE", G["atom -> new type"]), - (23, G["error"]): ("REDUCE", G["atom -> new type"]), (23, G[";"]): ("REDUCE", G["atom -> new type"]), + (23, G["error"]): ("REDUCE", G["atom -> new type"]), (23, G["loop"]): ("REDUCE", G["atom -> new type"]), (23, G["@"]): ("REDUCE", G["atom -> new type"]), (23, G["pool"]): ("REDUCE", G["atom -> new type"]), @@ -159,27 +159,27 @@ def __action_table(): (23, G["}"]): ("REDUCE", G["atom -> new type"]), (23, G["/"]): ("REDUCE", G["atom -> new type"]), (23, G["of"]): ("REDUCE", G["atom -> new type"]), - (23, G["<"]): ("REDUCE", G["atom -> new type"]), (23, G["<="]): ("REDUCE", G["atom -> new type"]), + (23, G["<"]): ("REDUCE", G["atom -> new type"]), (23, G[")"]): ("REDUCE", G["atom -> new type"]), (23, G["then"]): ("REDUCE", G["atom -> new type"]), - (24, G["false"]): ("SHIFT", 26), - (24, G["if"]): ("SHIFT", 12), (24, G["id"]): ("SHIFT", 28), - (24, G["string"]): ("SHIFT", 32), - (24, G["true"]): ("SHIFT", 25), (24, G["int"]): ("SHIFT", 31), - (24, G["("]): ("SHIFT", 11), + (24, G["true"]): ("SHIFT", 25), + (24, G["if"]): ("SHIFT", 12), (24, G["new"]): ("SHIFT", 22), - (24, G["~"]): ("SHIFT", 27), + (24, G["("]): ("SHIFT", 11), + (24, G["false"]): ("SHIFT", 26), (24, G["isvoid"]): ("SHIFT", 24), + (24, G["~"]): ("SHIFT", 27), + (24, G["string"]): ("SHIFT", 32), (25, G["."]): ("REDUCE", G["atom -> true"]), (25, G["else"]): ("REDUCE", G["atom -> true"]), (25, G["="]): ("REDUCE", G["atom -> true"]), (25, G[","]): ("REDUCE", G["atom -> true"]), (25, G["fi"]): ("REDUCE", G["atom -> true"]), - (25, G["error"]): ("REDUCE", G["atom -> true"]), (25, G[";"]): ("REDUCE", G["atom -> true"]), + (25, G["error"]): ("REDUCE", G["atom -> true"]), (25, G["loop"]): ("REDUCE", G["atom -> true"]), (25, G["@"]): ("REDUCE", G["atom -> true"]), (25, G["pool"]): ("REDUCE", G["atom -> true"]), @@ -190,8 +190,8 @@ def __action_table(): (25, G["}"]): ("REDUCE", G["atom -> true"]), (25, G["/"]): ("REDUCE", G["atom -> true"]), (25, G["of"]): ("REDUCE", G["atom -> true"]), - (25, G["<"]): ("REDUCE", G["atom -> true"]), (25, G["<="]): ("REDUCE", G["atom -> true"]), + (25, G["<"]): ("REDUCE", G["atom -> true"]), (25, G[")"]): ("REDUCE", G["atom -> true"]), (25, G["then"]): ("REDUCE", G["atom -> true"]), (26, G["."]): ("REDUCE", G["atom -> false"]), @@ -199,8 +199,8 @@ def __action_table(): (26, G["="]): ("REDUCE", G["atom -> false"]), (26, G[","]): ("REDUCE", G["atom -> false"]), (26, G["fi"]): ("REDUCE", G["atom -> false"]), - (26, G["error"]): ("REDUCE", G["atom -> false"]), (26, G[";"]): ("REDUCE", G["atom -> false"]), + (26, G["error"]): ("REDUCE", G["atom -> false"]), (26, G["loop"]): ("REDUCE", G["atom -> false"]), (26, G["@"]): ("REDUCE", G["atom -> false"]), (26, G["pool"]): ("REDUCE", G["atom -> false"]), @@ -211,28 +211,27 @@ def __action_table(): (26, G["}"]): ("REDUCE", G["atom -> false"]), (26, G["/"]): ("REDUCE", G["atom -> false"]), (26, G["of"]): ("REDUCE", G["atom -> false"]), - (26, G["<"]): ("REDUCE", G["atom -> false"]), (26, G["<="]): ("REDUCE", G["atom -> false"]), + (26, G["<"]): ("REDUCE", G["atom -> false"]), (26, G[")"]): ("REDUCE", G["atom -> false"]), (26, G["then"]): ("REDUCE", G["atom -> false"]), - (27, G["false"]): ("SHIFT", 26), - (27, G["if"]): ("SHIFT", 12), (27, G["id"]): ("SHIFT", 28), - (27, G["string"]): ("SHIFT", 32), - (27, G["true"]): ("SHIFT", 25), (27, G["int"]): ("SHIFT", 31), - (27, G["("]): ("SHIFT", 11), + (27, G["true"]): ("SHIFT", 25), + (27, G["if"]): ("SHIFT", 12), (27, G["new"]): ("SHIFT", 22), - (27, G["~"]): ("SHIFT", 27), + (27, G["("]): ("SHIFT", 11), + (27, G["false"]): ("SHIFT", 26), (27, G["isvoid"]): ("SHIFT", 24), - (28, G["("]): ("SHIFT", 29), + (27, G["~"]): ("SHIFT", 27), + (27, G["string"]): ("SHIFT", 32), (28, G["."]): ("REDUCE", G["atom -> id"]), (28, G["else"]): ("REDUCE", G["atom -> id"]), (28, G["="]): ("REDUCE", G["atom -> id"]), (28, G[","]): ("REDUCE", G["atom -> id"]), (28, G["fi"]): ("REDUCE", G["atom -> id"]), - (28, G["error"]): ("REDUCE", G["atom -> id"]), (28, G[";"]): ("REDUCE", G["atom -> id"]), + (28, G["error"]): ("REDUCE", G["atom -> id"]), (28, G["loop"]): ("REDUCE", G["atom -> id"]), (28, G["@"]): ("REDUCE", G["atom -> id"]), (28, G["pool"]): ("REDUCE", G["atom -> id"]), @@ -243,43 +242,44 @@ def __action_table(): (28, G["}"]): ("REDUCE", G["atom -> id"]), (28, G["/"]): ("REDUCE", G["atom -> id"]), (28, G["of"]): ("REDUCE", G["atom -> id"]), - (28, G["<"]): ("REDUCE", G["atom -> id"]), (28, G["<="]): ("REDUCE", G["atom -> id"]), + (28, G["<"]): ("REDUCE", G["atom -> id"]), (28, G[")"]): ("REDUCE", G["atom -> id"]), (28, G["then"]): ("REDUCE", G["atom -> id"]), - (29, G["string"]): ("SHIFT", 32), + (28, G["("]): ("SHIFT", 29), + (29, G["false"]): ("SHIFT", 26), + (29, G["let"]): ("SHIFT", 14), (29, G["id"]): ("SHIFT", 46), - (29, G["("]): ("SHIFT", 11), - (29, G["new"]): ("SHIFT", 22), + (29, G["string"]): ("SHIFT", 32), (29, G[")"]): ("REDUCE", G["expr-list -> e"]), - (29, G["{"]): ("SHIFT", 10), - (29, G["if"]): ("SHIFT", 12), - (29, G["int"]): ("SHIFT", 31), - (29, G["true"]): ("SHIFT", 25), - (29, G["let"]): ("SHIFT", 14), - (29, G["~"]): ("SHIFT", 27), (29, G["isvoid"]): ("SHIFT", 24), (29, G["while"]): ("SHIFT", 13), + (29, G["if"]): ("SHIFT", 12), + (29, G["new"]): ("SHIFT", 22), + (29, G["~"]): ("SHIFT", 27), + (29, G["("]): ("SHIFT", 11), (29, G["case"]): ("SHIFT", 21), (29, G["not"]): ("SHIFT", 30), - (29, G["false"]): ("SHIFT", 26), - (30, G["false"]): ("SHIFT", 26), - (30, G["if"]): ("SHIFT", 12), + (29, G["{"]): ("SHIFT", 10), + (29, G["int"]): ("SHIFT", 31), + (29, G["true"]): ("SHIFT", 25), (30, G["id"]): ("SHIFT", 28), - (30, G["string"]): ("SHIFT", 32), - (30, G["true"]): ("SHIFT", 25), (30, G["int"]): ("SHIFT", 31), - (30, G["("]): ("SHIFT", 11), + (30, G["true"]): ("SHIFT", 25), + (30, G["if"]): ("SHIFT", 12), (30, G["new"]): ("SHIFT", 22), - (30, G["~"]): ("SHIFT", 27), + (30, G["("]): ("SHIFT", 11), (30, G["isvoid"]): ("SHIFT", 24), + (30, G["false"]): ("SHIFT", 26), + (30, G["~"]): ("SHIFT", 27), + (30, G["string"]): ("SHIFT", 32), (31, G["."]): ("REDUCE", G["atom -> int"]), (31, G["else"]): ("REDUCE", G["atom -> int"]), (31, G["="]): ("REDUCE", G["atom -> int"]), (31, G[","]): ("REDUCE", G["atom -> int"]), (31, G["fi"]): ("REDUCE", G["atom -> int"]), - (31, G["error"]): ("REDUCE", G["atom -> int"]), (31, G[";"]): ("REDUCE", G["atom -> int"]), + (31, G["error"]): ("REDUCE", G["atom -> int"]), (31, G["loop"]): ("REDUCE", G["atom -> int"]), (31, G["@"]): ("REDUCE", G["atom -> int"]), (31, G["pool"]): ("REDUCE", G["atom -> int"]), @@ -290,8 +290,8 @@ def __action_table(): (31, G["}"]): ("REDUCE", G["atom -> int"]), (31, G["/"]): ("REDUCE", G["atom -> int"]), (31, G["of"]): ("REDUCE", G["atom -> int"]), - (31, G["<"]): ("REDUCE", G["atom -> int"]), (31, G["<="]): ("REDUCE", G["atom -> int"]), + (31, G["<"]): ("REDUCE", G["atom -> int"]), (31, G[")"]): ("REDUCE", G["atom -> int"]), (31, G["then"]): ("REDUCE", G["atom -> int"]), (32, G["."]): ("REDUCE", G["atom -> string"]), @@ -299,8 +299,8 @@ def __action_table(): (32, G["="]): ("REDUCE", G["atom -> string"]), (32, G[","]): ("REDUCE", G["atom -> string"]), (32, G["fi"]): ("REDUCE", G["atom -> string"]), - (32, G["error"]): ("REDUCE", G["atom -> string"]), (32, G[";"]): ("REDUCE", G["atom -> string"]), + (32, G["error"]): ("REDUCE", G["atom -> string"]), (32, G["loop"]): ("REDUCE", G["atom -> string"]), (32, G["@"]): ("REDUCE", G["atom -> string"]), (32, G["pool"]): ("REDUCE", G["atom -> string"]), @@ -311,8 +311,8 @@ def __action_table(): (32, G["}"]): ("REDUCE", G["atom -> string"]), (32, G["/"]): ("REDUCE", G["atom -> string"]), (32, G["of"]): ("REDUCE", G["atom -> string"]), - (32, G["<"]): ("REDUCE", G["atom -> string"]), (32, G["<="]): ("REDUCE", G["atom -> string"]), + (32, G["<"]): ("REDUCE", G["atom -> string"]), (32, G[")"]): ("REDUCE", G["atom -> string"]), (32, G["then"]): ("REDUCE", G["atom -> string"]), (33, G["."]): ("REDUCE", G["atom -> function-call"]), @@ -320,8 +320,8 @@ def __action_table(): (33, G["="]): ("REDUCE", G["atom -> function-call"]), (33, G[","]): ("REDUCE", G["atom -> function-call"]), (33, G["fi"]): ("REDUCE", G["atom -> function-call"]), - (33, G["error"]): ("REDUCE", G["atom -> function-call"]), (33, G[";"]): ("REDUCE", G["atom -> function-call"]), + (33, G["error"]): ("REDUCE", G["atom -> function-call"]), (33, G["loop"]): ("REDUCE", G["atom -> function-call"]), (33, G["@"]): ("REDUCE", G["atom -> function-call"]), (33, G["pool"]): ("REDUCE", G["atom -> function-call"]), @@ -332,79 +332,80 @@ def __action_table(): (33, G["}"]): ("REDUCE", G["atom -> function-call"]), (33, G["/"]): ("REDUCE", G["atom -> function-call"]), (33, G["of"]): ("REDUCE", G["atom -> function-call"]), - (33, G["<"]): ("REDUCE", G["atom -> function-call"]), (33, G["<="]): ("REDUCE", G["atom -> function-call"]), + (33, G["<"]): ("REDUCE", G["atom -> function-call"]), (33, G[")"]): ("REDUCE", G["atom -> function-call"]), (33, G["then"]): ("REDUCE", G["atom -> function-call"]), - (34, G["="]): ("SHIFT", 60), (34, G["<"]): ("SHIFT", 35), - (34, G["else"]): ("REDUCE", G["negable -> not comp"]), - (34, G[","]): ("REDUCE", G["negable -> not comp"]), - (34, G["in"]): ("REDUCE", G["negable -> not comp"]), - (34, G["fi"]): ("REDUCE", G["negable -> not comp"]), - (34, G["}"]): ("REDUCE", G["negable -> not comp"]), - (34, G["error"]): ("REDUCE", G["negable -> not comp"]), - (34, G[";"]): ("REDUCE", G["negable -> not comp"]), - (34, G["of"]): ("REDUCE", G["negable -> not comp"]), - (34, G["loop"]): ("REDUCE", G["negable -> not comp"]), - (34, G["pool"]): ("REDUCE", G["negable -> not comp"]), - (34, G[")"]): ("REDUCE", G["negable -> not comp"]), - (34, G["then"]): ("REDUCE", G["negable -> not comp"]), - (34, G["<="]): ("SHIFT", 50), - (35, G["not"]): ("SHIFT", 36), - (35, G["false"]): ("SHIFT", 26), - (35, G["if"]): ("SHIFT", 12), + (34, G["<="]): ("SHIFT", 51), + (34, G["else"]): ("REDUCE", G["negable-comp -> not comp"]), + (34, G[","]): ("REDUCE", G["negable-comp -> not comp"]), + (34, G["in"]): ("REDUCE", G["negable-comp -> not comp"]), + (34, G["fi"]): ("REDUCE", G["negable-comp -> not comp"]), + (34, G["}"]): ("REDUCE", G["negable-comp -> not comp"]), + (34, G["pool"]): ("REDUCE", G["negable-comp -> not comp"]), + (34, G[";"]): ("REDUCE", G["negable-comp -> not comp"]), + (34, G["error"]): ("REDUCE", G["negable-comp -> not comp"]), + (34, G["loop"]): ("REDUCE", G["negable-comp -> not comp"]), + (34, G["of"]): ("REDUCE", G["negable-comp -> not comp"]), + (34, G[")"]): ("REDUCE", G["negable-comp -> not comp"]), + (34, G["then"]): ("REDUCE", G["negable-comp -> not comp"]), + (34, G["="]): ("SHIFT", 60), (35, G["id"]): ("SHIFT", 28), - (35, G["string"]): ("SHIFT", 32), - (35, G["true"]): ("SHIFT", 25), (35, G["int"]): ("SHIFT", 31), - (35, G["("]): ("SHIFT", 11), + (35, G["true"]): ("SHIFT", 25), + (35, G["if"]): ("SHIFT", 12), (35, G["new"]): ("SHIFT", 22), - (35, G["~"]): ("SHIFT", 27), + (35, G["("]): ("SHIFT", 11), (35, G["isvoid"]): ("SHIFT", 24), - (36, G["false"]): ("SHIFT", 26), - (36, G["if"]): ("SHIFT", 12), + (35, G["false"]): ("SHIFT", 26), + (35, G["~"]): ("SHIFT", 27), + (35, G["not"]): ("SHIFT", 36), + (35, G["string"]): ("SHIFT", 32), (36, G["id"]): ("SHIFT", 28), - (36, G["string"]): ("SHIFT", 32), - (36, G["true"]): ("SHIFT", 25), (36, G["int"]): ("SHIFT", 31), - (36, G["("]): ("SHIFT", 11), + (36, G["true"]): ("SHIFT", 25), + (36, G["if"]): ("SHIFT", 12), (36, G["new"]): ("SHIFT", 22), - (36, G["~"]): ("SHIFT", 27), + (36, G["("]): ("SHIFT", 11), (36, G["isvoid"]): ("SHIFT", 24), + (36, G["false"]): ("SHIFT", 26), + (36, G["~"]): ("SHIFT", 27), + (36, G["string"]): ("SHIFT", 32), + (37, G["-"]): ("SHIFT", 54), + (37, G["else"]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G["="]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G[","]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G["in"]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G["fi"]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G[")"]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G["}"]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G[";"]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G["error"]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G["<"]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G["loop"]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G["of"]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G["<="]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G["pool"]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G["then"]): ("REDUCE", G["negable-arith -> not arith"]), (37, G["+"]): ("SHIFT", 38), - (37, G["-"]): ("SHIFT", 53), - (37, G["else"]): ("REDUCE", G["comp -> comp < not arith"]), - (37, G["="]): ("REDUCE", G["comp -> comp < not arith"]), - (37, G[","]): ("REDUCE", G["comp -> comp < not arith"]), - (37, G["in"]): ("REDUCE", G["comp -> comp < not arith"]), - (37, G["fi"]): ("REDUCE", G["comp -> comp < not arith"]), - (37, G["}"]): ("REDUCE", G["comp -> comp < not arith"]), - (37, G["error"]): ("REDUCE", G["comp -> comp < not arith"]), - (37, G[")"]): ("REDUCE", G["comp -> comp < not arith"]), - (37, G[";"]): ("REDUCE", G["comp -> comp < not arith"]), - (37, G["of"]): ("REDUCE", G["comp -> comp < not arith"]), - (37, G["<"]): ("REDUCE", G["comp -> comp < not arith"]), - (37, G["loop"]): ("REDUCE", G["comp -> comp < not arith"]), - (37, G["pool"]): ("REDUCE", G["comp -> comp < not arith"]), - (37, G["<="]): ("REDUCE", G["comp -> comp < not arith"]), - (37, G["then"]): ("REDUCE", G["comp -> comp < not arith"]), - (38, G["false"]): ("SHIFT", 26), - (38, G["if"]): ("SHIFT", 12), (38, G["id"]): ("SHIFT", 28), - (38, G["string"]): ("SHIFT", 32), - (38, G["true"]): ("SHIFT", 25), (38, G["int"]): ("SHIFT", 31), - (38, G["("]): ("SHIFT", 11), + (38, G["true"]): ("SHIFT", 25), + (38, G["if"]): ("SHIFT", 12), (38, G["new"]): ("SHIFT", 22), - (38, G["~"]): ("SHIFT", 27), + (38, G["("]): ("SHIFT", 11), (38, G["isvoid"]): ("SHIFT", 24), + (38, G["false"]): ("SHIFT", 26), + (38, G["~"]): ("SHIFT", 27), + (38, G["string"]): ("SHIFT", 32), + (39, G["/"]): ("SHIFT", 56), (39, G["else"]): ("REDUCE", G["arith -> arith + term"]), (39, G["="]): ("REDUCE", G["arith -> arith + term"]), (39, G[","]): ("REDUCE", G["arith -> arith + term"]), (39, G["fi"]): ("REDUCE", G["arith -> arith + term"]), - (39, G["error"]): ("REDUCE", G["arith -> arith + term"]), (39, G[";"]): ("REDUCE", G["arith -> arith + term"]), + (39, G["error"]): ("REDUCE", G["arith -> arith + term"]), (39, G["loop"]): ("REDUCE", G["arith -> arith + term"]), (39, G["pool"]): ("REDUCE", G["arith -> arith + term"]), (39, G["+"]): ("REDUCE", G["arith -> arith + term"]), @@ -412,28 +413,27 @@ def __action_table(): (39, G["in"]): ("REDUCE", G["arith -> arith + term"]), (39, G["}"]): ("REDUCE", G["arith -> arith + term"]), (39, G["of"]): ("REDUCE", G["arith -> arith + term"]), - (39, G["<"]): ("REDUCE", G["arith -> arith + term"]), (39, G["<="]): ("REDUCE", G["arith -> arith + term"]), + (39, G["<"]): ("REDUCE", G["arith -> arith + term"]), (39, G[")"]): ("REDUCE", G["arith -> arith + term"]), (39, G["then"]): ("REDUCE", G["arith -> arith + term"]), - (39, G["/"]): ("SHIFT", 55), (39, G["*"]): ("SHIFT", 40), - (40, G["false"]): ("SHIFT", 26), - (40, G["if"]): ("SHIFT", 12), (40, G["id"]): ("SHIFT", 28), - (40, G["string"]): ("SHIFT", 32), - (40, G["true"]): ("SHIFT", 25), (40, G["int"]): ("SHIFT", 31), - (40, G["("]): ("SHIFT", 11), + (40, G["true"]): ("SHIFT", 25), + (40, G["if"]): ("SHIFT", 12), (40, G["new"]): ("SHIFT", 22), - (40, G["~"]): ("SHIFT", 27), + (40, G["("]): ("SHIFT", 11), + (40, G["false"]): ("SHIFT", 26), (40, G["isvoid"]): ("SHIFT", 24), + (40, G["~"]): ("SHIFT", 27), + (40, G["string"]): ("SHIFT", 32), (41, G["else"]): ("REDUCE", G["term -> term * factor"]), (41, G["="]): ("REDUCE", G["term -> term * factor"]), (41, G[","]): ("REDUCE", G["term -> term * factor"]), (41, G["fi"]): ("REDUCE", G["term -> term * factor"]), - (41, G["error"]): ("REDUCE", G["term -> term * factor"]), (41, G[";"]): ("REDUCE", G["term -> term * factor"]), + (41, G["error"]): ("REDUCE", G["term -> term * factor"]), (41, G["loop"]): ("REDUCE", G["term -> term * factor"]), (41, G["pool"]): ("REDUCE", G["term -> term * factor"]), (41, G["+"]): ("REDUCE", G["term -> term * factor"]), @@ -443,16 +443,16 @@ def __action_table(): (41, G["}"]): ("REDUCE", G["term -> term * factor"]), (41, G["/"]): ("REDUCE", G["term -> term * factor"]), (41, G["of"]): ("REDUCE", G["term -> term * factor"]), - (41, G["<"]): ("REDUCE", G["term -> term * factor"]), (41, G["<="]): ("REDUCE", G["term -> term * factor"]), + (41, G["<"]): ("REDUCE", G["term -> term * factor"]), (41, G[")"]): ("REDUCE", G["term -> term * factor"]), (41, G["then"]): ("REDUCE", G["term -> term * factor"]), (42, G["else"]): ("REDUCE", G["factor -> atom"]), (42, G["="]): ("REDUCE", G["factor -> atom"]), (42, G[","]): ("REDUCE", G["factor -> atom"]), (42, G["fi"]): ("REDUCE", G["factor -> atom"]), - (42, G["error"]): ("REDUCE", G["factor -> atom"]), (42, G[";"]): ("REDUCE", G["factor -> atom"]), + (42, G["error"]): ("REDUCE", G["factor -> atom"]), (42, G["loop"]): ("REDUCE", G["factor -> atom"]), (42, G["pool"]): ("REDUCE", G["factor -> atom"]), (42, G["+"]): ("REDUCE", G["factor -> atom"]), @@ -462,38 +462,37 @@ def __action_table(): (42, G["}"]): ("REDUCE", G["factor -> atom"]), (42, G["/"]): ("REDUCE", G["factor -> atom"]), (42, G["of"]): ("REDUCE", G["factor -> atom"]), - (42, G["<"]): ("REDUCE", G["factor -> atom"]), (42, G["<="]): ("REDUCE", G["factor -> atom"]), + (42, G["<"]): ("REDUCE", G["factor -> atom"]), (42, G[")"]): ("REDUCE", G["factor -> atom"]), (42, G["then"]): ("REDUCE", G["factor -> atom"]), - (42, G["@"]): ("SHIFT", 72), + (42, G["@"]): ("SHIFT", 69), (42, G["."]): ("SHIFT", 43), (43, G["id"]): ("SHIFT", 44), (44, G["("]): ("SHIFT", 45), - (45, G["string"]): ("SHIFT", 32), + (45, G["false"]): ("SHIFT", 26), + (45, G["let"]): ("SHIFT", 14), (45, G["id"]): ("SHIFT", 46), - (45, G["("]): ("SHIFT", 11), - (45, G["new"]): ("SHIFT", 22), + (45, G["string"]): ("SHIFT", 32), (45, G[")"]): ("REDUCE", G["expr-list -> e"]), - (45, G["{"]): ("SHIFT", 10), - (45, G["if"]): ("SHIFT", 12), - (45, G["int"]): ("SHIFT", 31), - (45, G["true"]): ("SHIFT", 25), - (45, G["let"]): ("SHIFT", 14), - (45, G["~"]): ("SHIFT", 27), (45, G["isvoid"]): ("SHIFT", 24), (45, G["while"]): ("SHIFT", 13), + (45, G["if"]): ("SHIFT", 12), + (45, G["new"]): ("SHIFT", 22), + (45, G["~"]): ("SHIFT", 27), + (45, G["("]): ("SHIFT", 11), (45, G["case"]): ("SHIFT", 21), (45, G["not"]): ("SHIFT", 30), - (45, G["false"]): ("SHIFT", 26), - (46, G["("]): ("SHIFT", 29), + (45, G["{"]): ("SHIFT", 10), + (45, G["int"]): ("SHIFT", 31), + (45, G["true"]): ("SHIFT", 25), (46, G["."]): ("REDUCE", G["atom -> id"]), (46, G["else"]): ("REDUCE", G["atom -> id"]), (46, G["="]): ("REDUCE", G["atom -> id"]), (46, G[","]): ("REDUCE", G["atom -> id"]), (46, G["fi"]): ("REDUCE", G["atom -> id"]), - (46, G["error"]): ("REDUCE", G["atom -> id"]), (46, G[";"]): ("REDUCE", G["atom -> id"]), + (46, G["error"]): ("REDUCE", G["atom -> id"]), (46, G["loop"]): ("REDUCE", G["atom -> id"]), (46, G["@"]): ("REDUCE", G["atom -> id"]), (46, G["pool"]): ("REDUCE", G["atom -> id"]), @@ -504,1025 +503,976 @@ def __action_table(): (46, G["}"]): ("REDUCE", G["atom -> id"]), (46, G["/"]): ("REDUCE", G["atom -> id"]), (46, G["of"]): ("REDUCE", G["atom -> id"]), - (46, G["<"]): ("REDUCE", G["atom -> id"]), (46, G["<="]): ("REDUCE", G["atom -> id"]), + (46, G["<"]): ("REDUCE", G["atom -> id"]), (46, G[")"]): ("REDUCE", G["atom -> id"]), (46, G["then"]): ("REDUCE", G["atom -> id"]), + (46, G["("]): ("SHIFT", 29), (46, G["<-"]): ("SHIFT", 47), - (47, G["let"]): ("SHIFT", 14), - (47, G["false"]): ("SHIFT", 26), - (47, G["not"]): ("SHIFT", 30), (47, G["id"]): ("SHIFT", 46), - (47, G["case"]): ("SHIFT", 21), - (47, G["string"]): ("SHIFT", 32), - (47, G["while"]): ("SHIFT", 13), - (47, G["("]): ("SHIFT", 11), + (47, G["if"]): ("SHIFT", 12), + (47, G["let"]): ("SHIFT", 14), (47, G["new"]): ("SHIFT", 22), - (47, G["~"]): ("SHIFT", 27), + (47, G["("]): ("SHIFT", 11), (47, G["isvoid"]): ("SHIFT", 24), - (47, G["if"]): ("SHIFT", 12), - (47, G["{"]): ("SHIFT", 10), - (47, G["true"]): ("SHIFT", 25), + (47, G["~"]): ("SHIFT", 27), + (47, G["while"]): ("SHIFT", 13), (47, G["int"]): ("SHIFT", 31), + (47, G["true"]): ("SHIFT", 25), + (47, G["not"]): ("SHIFT", 30), + (47, G["case"]): ("SHIFT", 21), + (47, G["false"]): ("SHIFT", 26), + (47, G["{"]): ("SHIFT", 10), + (47, G["string"]): ("SHIFT", 32), (48, G["else"]): ("REDUCE", G["expr -> id <- expr"]), - (48, G[","]): ("REDUCE", G["expr -> id <- expr"]), (48, G["in"]): ("REDUCE", G["expr -> id <- expr"]), + (48, G[","]): ("REDUCE", G["expr -> id <- expr"]), (48, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), - (48, G["}"]): ("REDUCE", G["expr -> id <- expr"]), - (48, G["error"]): ("REDUCE", G["expr -> id <- expr"]), (48, G[")"]): ("REDUCE", G["expr -> id <- expr"]), + (48, G["}"]): ("REDUCE", G["expr -> id <- expr"]), (48, G[";"]): ("REDUCE", G["expr -> id <- expr"]), - (48, G["of"]): ("REDUCE", G["expr -> id <- expr"]), + (48, G["error"]): ("REDUCE", G["expr -> id <- expr"]), (48, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), + (48, G["of"]): ("REDUCE", G["expr -> id <- expr"]), (48, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), (48, G["then"]): ("REDUCE", G["expr -> id <- expr"]), - (49, G["="]): ("SHIFT", 60), - (49, G["<"]): ("SHIFT", 35), - (49, G["else"]): ("REDUCE", G["negable -> comp"]), - (49, G[","]): ("REDUCE", G["negable -> comp"]), - (49, G["in"]): ("REDUCE", G["negable -> comp"]), - (49, G["fi"]): ("REDUCE", G["negable -> comp"]), - (49, G["}"]): ("REDUCE", G["negable -> comp"]), - (49, G["error"]): ("REDUCE", G["negable -> comp"]), - (49, G[")"]): ("REDUCE", G["negable -> comp"]), - (49, G[";"]): ("REDUCE", G["negable -> comp"]), - (49, G["of"]): ("REDUCE", G["negable -> comp"]), - (49, G["loop"]): ("REDUCE", G["negable -> comp"]), - (49, G["pool"]): ("REDUCE", G["negable -> comp"]), - (49, G["then"]): ("REDUCE", G["negable -> comp"]), - (49, G["<="]): ("SHIFT", 50), - (50, G["false"]): ("SHIFT", 26), - (50, G["if"]): ("SHIFT", 12), - (50, G["id"]): ("SHIFT", 28), - (50, G["string"]): ("SHIFT", 32), - (50, G["true"]): ("SHIFT", 25), - (50, G["int"]): ("SHIFT", 31), - (50, G["("]): ("SHIFT", 11), - (50, G["new"]): ("SHIFT", 22), - (50, G["not"]): ("SHIFT", 51), - (50, G["~"]): ("SHIFT", 27), - (50, G["isvoid"]): ("SHIFT", 24), - (51, G["false"]): ("SHIFT", 26), - (51, G["if"]): ("SHIFT", 12), + (49, G["else"]): ("REDUCE", G["expr -> negable-comp"]), + (49, G["in"]): ("REDUCE", G["expr -> negable-comp"]), + (49, G[","]): ("REDUCE", G["expr -> negable-comp"]), + (49, G["fi"]): ("REDUCE", G["expr -> negable-comp"]), + (49, G[")"]): ("REDUCE", G["expr -> negable-comp"]), + (49, G["}"]): ("REDUCE", G["expr -> negable-comp"]), + (49, G[";"]): ("REDUCE", G["expr -> negable-comp"]), + (49, G["error"]): ("REDUCE", G["expr -> negable-comp"]), + (49, G["loop"]): ("REDUCE", G["expr -> negable-comp"]), + (49, G["of"]): ("REDUCE", G["expr -> negable-comp"]), + (49, G["pool"]): ("REDUCE", G["expr -> negable-comp"]), + (49, G["then"]): ("REDUCE", G["expr -> negable-comp"]), + (50, G["="]): ("SHIFT", 60), + (50, G["<="]): ("SHIFT", 51), + (50, G["<"]): ("SHIFT", 35), + (50, G["else"]): ("REDUCE", G["negable-comp -> comp"]), + (50, G["in"]): ("REDUCE", G["negable-comp -> comp"]), + (50, G[","]): ("REDUCE", G["negable-comp -> comp"]), + (50, G["fi"]): ("REDUCE", G["negable-comp -> comp"]), + (50, G[")"]): ("REDUCE", G["negable-comp -> comp"]), + (50, G["}"]): ("REDUCE", G["negable-comp -> comp"]), + (50, G[";"]): ("REDUCE", G["negable-comp -> comp"]), + (50, G["error"]): ("REDUCE", G["negable-comp -> comp"]), + (50, G["loop"]): ("REDUCE", G["negable-comp -> comp"]), + (50, G["of"]): ("REDUCE", G["negable-comp -> comp"]), + (50, G["pool"]): ("REDUCE", G["negable-comp -> comp"]), + (50, G["then"]): ("REDUCE", G["negable-comp -> comp"]), (51, G["id"]): ("SHIFT", 28), - (51, G["string"]): ("SHIFT", 32), - (51, G["true"]): ("SHIFT", 25), (51, G["int"]): ("SHIFT", 31), - (51, G["("]): ("SHIFT", 11), + (51, G["true"]): ("SHIFT", 25), + (51, G["if"]): ("SHIFT", 12), (51, G["new"]): ("SHIFT", 22), - (51, G["~"]): ("SHIFT", 27), + (51, G["("]): ("SHIFT", 11), (51, G["isvoid"]): ("SHIFT", 24), - (52, G["+"]): ("SHIFT", 38), - (52, G["-"]): ("SHIFT", 53), - (52, G["else"]): ("REDUCE", G["comp -> comp <= not arith"]), - (52, G["="]): ("REDUCE", G["comp -> comp <= not arith"]), - (52, G[","]): ("REDUCE", G["comp -> comp <= not arith"]), - (52, G["in"]): ("REDUCE", G["comp -> comp <= not arith"]), - (52, G["fi"]): ("REDUCE", G["comp -> comp <= not arith"]), - (52, G["}"]): ("REDUCE", G["comp -> comp <= not arith"]), - (52, G["error"]): ("REDUCE", G["comp -> comp <= not arith"]), - (52, G[")"]): ("REDUCE", G["comp -> comp <= not arith"]), - (52, G[";"]): ("REDUCE", G["comp -> comp <= not arith"]), - (52, G["of"]): ("REDUCE", G["comp -> comp <= not arith"]), - (52, G["<"]): ("REDUCE", G["comp -> comp <= not arith"]), - (52, G["loop"]): ("REDUCE", G["comp -> comp <= not arith"]), - (52, G["pool"]): ("REDUCE", G["comp -> comp <= not arith"]), - (52, G["<="]): ("REDUCE", G["comp -> comp <= not arith"]), - (52, G["then"]): ("REDUCE", G["comp -> comp <= not arith"]), - (53, G["false"]): ("SHIFT", 26), - (53, G["if"]): ("SHIFT", 12), - (53, G["id"]): ("SHIFT", 28), - (53, G["string"]): ("SHIFT", 32), - (53, G["true"]): ("SHIFT", 25), - (53, G["int"]): ("SHIFT", 31), - (53, G["("]): ("SHIFT", 11), - (53, G["new"]): ("SHIFT", 22), - (53, G["~"]): ("SHIFT", 27), - (53, G["isvoid"]): ("SHIFT", 24), - (54, G["else"]): ("REDUCE", G["arith -> arith - term"]), - (54, G["="]): ("REDUCE", G["arith -> arith - term"]), - (54, G[","]): ("REDUCE", G["arith -> arith - term"]), - (54, G["fi"]): ("REDUCE", G["arith -> arith - term"]), - (54, G["error"]): ("REDUCE", G["arith -> arith - term"]), - (54, G[";"]): ("REDUCE", G["arith -> arith - term"]), - (54, G["loop"]): ("REDUCE", G["arith -> arith - term"]), - (54, G["pool"]): ("REDUCE", G["arith -> arith - term"]), - (54, G["+"]): ("REDUCE", G["arith -> arith - term"]), - (54, G["-"]): ("REDUCE", G["arith -> arith - term"]), - (54, G["in"]): ("REDUCE", G["arith -> arith - term"]), - (54, G["}"]): ("REDUCE", G["arith -> arith - term"]), - (54, G["of"]): ("REDUCE", G["arith -> arith - term"]), - (54, G["<"]): ("REDUCE", G["arith -> arith - term"]), - (54, G["<="]): ("REDUCE", G["arith -> arith - term"]), - (54, G[")"]): ("REDUCE", G["arith -> arith - term"]), - (54, G["then"]): ("REDUCE", G["arith -> arith - term"]), - (54, G["/"]): ("SHIFT", 55), - (54, G["*"]): ("SHIFT", 40), - (55, G["false"]): ("SHIFT", 26), - (55, G["if"]): ("SHIFT", 12), - (55, G["id"]): ("SHIFT", 28), - (55, G["string"]): ("SHIFT", 32), - (55, G["true"]): ("SHIFT", 25), - (55, G["int"]): ("SHIFT", 31), - (55, G["("]): ("SHIFT", 11), - (55, G["new"]): ("SHIFT", 22), - (55, G["~"]): ("SHIFT", 27), - (55, G["isvoid"]): ("SHIFT", 24), - (56, G["else"]): ("REDUCE", G["term -> term / factor"]), - (56, G["="]): ("REDUCE", G["term -> term / factor"]), - (56, G[","]): ("REDUCE", G["term -> term / factor"]), - (56, G["fi"]): ("REDUCE", G["term -> term / factor"]), - (56, G["error"]): ("REDUCE", G["term -> term / factor"]), - (56, G[";"]): ("REDUCE", G["term -> term / factor"]), - (56, G["loop"]): ("REDUCE", G["term -> term / factor"]), - (56, G["pool"]): ("REDUCE", G["term -> term / factor"]), - (56, G["+"]): ("REDUCE", G["term -> term / factor"]), - (56, G["-"]): ("REDUCE", G["term -> term / factor"]), - (56, G["in"]): ("REDUCE", G["term -> term / factor"]), - (56, G["*"]): ("REDUCE", G["term -> term / factor"]), - (56, G["}"]): ("REDUCE", G["term -> term / factor"]), - (56, G["/"]): ("REDUCE", G["term -> term / factor"]), - (56, G["of"]): ("REDUCE", G["term -> term / factor"]), - (56, G["<"]): ("REDUCE", G["term -> term / factor"]), - (56, G["<="]): ("REDUCE", G["term -> term / factor"]), - (56, G[")"]): ("REDUCE", G["term -> term / factor"]), - (56, G["then"]): ("REDUCE", G["term -> term / factor"]), - (57, G["else"]): ("REDUCE", G["term -> factor"]), - (57, G["="]): ("REDUCE", G["term -> factor"]), - (57, G[","]): ("REDUCE", G["term -> factor"]), - (57, G["fi"]): ("REDUCE", G["term -> factor"]), - (57, G["error"]): ("REDUCE", G["term -> factor"]), - (57, G[";"]): ("REDUCE", G["term -> factor"]), - (57, G["loop"]): ("REDUCE", G["term -> factor"]), - (57, G["pool"]): ("REDUCE", G["term -> factor"]), - (57, G["+"]): ("REDUCE", G["term -> factor"]), - (57, G["-"]): ("REDUCE", G["term -> factor"]), - (57, G["in"]): ("REDUCE", G["term -> factor"]), - (57, G["*"]): ("REDUCE", G["term -> factor"]), - (57, G["}"]): ("REDUCE", G["term -> factor"]), - (57, G["/"]): ("REDUCE", G["term -> factor"]), - (57, G["of"]): ("REDUCE", G["term -> factor"]), - (57, G["<"]): ("REDUCE", G["term -> factor"]), - (57, G["<="]): ("REDUCE", G["term -> factor"]), - (57, G[")"]): ("REDUCE", G["term -> factor"]), - (57, G["then"]): ("REDUCE", G["term -> factor"]), - (58, G["else"]): ("REDUCE", G["arith -> term"]), - (58, G["="]): ("REDUCE", G["arith -> term"]), - (58, G[","]): ("REDUCE", G["arith -> term"]), - (58, G["fi"]): ("REDUCE", G["arith -> term"]), - (58, G["error"]): ("REDUCE", G["arith -> term"]), - (58, G[";"]): ("REDUCE", G["arith -> term"]), - (58, G["loop"]): ("REDUCE", G["arith -> term"]), - (58, G["pool"]): ("REDUCE", G["arith -> term"]), - (58, G["+"]): ("REDUCE", G["arith -> term"]), - (58, G["-"]): ("REDUCE", G["arith -> term"]), - (58, G["in"]): ("REDUCE", G["arith -> term"]), - (58, G["}"]): ("REDUCE", G["arith -> term"]), - (58, G["of"]): ("REDUCE", G["arith -> term"]), - (58, G["<"]): ("REDUCE", G["arith -> term"]), - (58, G["<="]): ("REDUCE", G["arith -> term"]), - (58, G[")"]): ("REDUCE", G["arith -> term"]), - (58, G["then"]): ("REDUCE", G["arith -> term"]), - (58, G["/"]): ("SHIFT", 55), - (58, G["*"]): ("SHIFT", 40), - (59, G["+"]): ("SHIFT", 38), - (59, G["-"]): ("SHIFT", 53), - (59, G["else"]): ("REDUCE", G["comp -> comp <= arith"]), - (59, G["="]): ("REDUCE", G["comp -> comp <= arith"]), - (59, G[","]): ("REDUCE", G["comp -> comp <= arith"]), - (59, G["in"]): ("REDUCE", G["comp -> comp <= arith"]), - (59, G["fi"]): ("REDUCE", G["comp -> comp <= arith"]), - (59, G["}"]): ("REDUCE", G["comp -> comp <= arith"]), - (59, G["<="]): ("REDUCE", G["comp -> comp <= arith"]), - (59, G["error"]): ("REDUCE", G["comp -> comp <= arith"]), - (59, G[";"]): ("REDUCE", G["comp -> comp <= arith"]), - (59, G["of"]): ("REDUCE", G["comp -> comp <= arith"]), - (59, G["<"]): ("REDUCE", G["comp -> comp <= arith"]), - (59, G["loop"]): ("REDUCE", G["comp -> comp <= arith"]), - (59, G["pool"]): ("REDUCE", G["comp -> comp <= arith"]), - (59, G[")"]): ("REDUCE", G["comp -> comp <= arith"]), - (59, G["then"]): ("REDUCE", G["comp -> comp <= arith"]), - (60, G["false"]): ("SHIFT", 26), - (60, G["if"]): ("SHIFT", 12), + (51, G["false"]): ("SHIFT", 26), + (51, G["~"]): ("SHIFT", 27), + (51, G["not"]): ("SHIFT", 36), + (51, G["string"]): ("SHIFT", 32), + (52, G["else"]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (52, G["="]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (52, G["in"]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (52, G[","]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (52, G["fi"]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (52, G["}"]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (52, G["pool"]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (52, G[";"]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (52, G["error"]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (52, G["<"]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (52, G["loop"]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (52, G["of"]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (52, G["<="]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (52, G[")"]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (52, G["then"]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (53, G["-"]): ("SHIFT", 54), + (53, G["+"]): ("SHIFT", 38), + (53, G["else"]): ("REDUCE", G["negable-arith -> arith"]), + (53, G["="]): ("REDUCE", G["negable-arith -> arith"]), + (53, G["in"]): ("REDUCE", G["negable-arith -> arith"]), + (53, G[","]): ("REDUCE", G["negable-arith -> arith"]), + (53, G["fi"]): ("REDUCE", G["negable-arith -> arith"]), + (53, G["}"]): ("REDUCE", G["negable-arith -> arith"]), + (53, G["pool"]): ("REDUCE", G["negable-arith -> arith"]), + (53, G[";"]): ("REDUCE", G["negable-arith -> arith"]), + (53, G["error"]): ("REDUCE", G["negable-arith -> arith"]), + (53, G["<"]): ("REDUCE", G["negable-arith -> arith"]), + (53, G["loop"]): ("REDUCE", G["negable-arith -> arith"]), + (53, G["of"]): ("REDUCE", G["negable-arith -> arith"]), + (53, G["<="]): ("REDUCE", G["negable-arith -> arith"]), + (53, G[")"]): ("REDUCE", G["negable-arith -> arith"]), + (53, G["then"]): ("REDUCE", G["negable-arith -> arith"]), + (54, G["id"]): ("SHIFT", 28), + (54, G["int"]): ("SHIFT", 31), + (54, G["true"]): ("SHIFT", 25), + (54, G["if"]): ("SHIFT", 12), + (54, G["new"]): ("SHIFT", 22), + (54, G["("]): ("SHIFT", 11), + (54, G["isvoid"]): ("SHIFT", 24), + (54, G["false"]): ("SHIFT", 26), + (54, G["~"]): ("SHIFT", 27), + (54, G["string"]): ("SHIFT", 32), + (55, G["/"]): ("SHIFT", 56), + (55, G["*"]): ("SHIFT", 40), + (55, G["else"]): ("REDUCE", G["arith -> arith - term"]), + (55, G["="]): ("REDUCE", G["arith -> arith - term"]), + (55, G[","]): ("REDUCE", G["arith -> arith - term"]), + (55, G["fi"]): ("REDUCE", G["arith -> arith - term"]), + (55, G[";"]): ("REDUCE", G["arith -> arith - term"]), + (55, G["error"]): ("REDUCE", G["arith -> arith - term"]), + (55, G["loop"]): ("REDUCE", G["arith -> arith - term"]), + (55, G["pool"]): ("REDUCE", G["arith -> arith - term"]), + (55, G["+"]): ("REDUCE", G["arith -> arith - term"]), + (55, G["-"]): ("REDUCE", G["arith -> arith - term"]), + (55, G["in"]): ("REDUCE", G["arith -> arith - term"]), + (55, G["}"]): ("REDUCE", G["arith -> arith - term"]), + (55, G["of"]): ("REDUCE", G["arith -> arith - term"]), + (55, G["<="]): ("REDUCE", G["arith -> arith - term"]), + (55, G["<"]): ("REDUCE", G["arith -> arith - term"]), + (55, G[")"]): ("REDUCE", G["arith -> arith - term"]), + (55, G["then"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["id"]): ("SHIFT", 28), + (56, G["int"]): ("SHIFT", 31), + (56, G["true"]): ("SHIFT", 25), + (56, G["if"]): ("SHIFT", 12), + (56, G["new"]): ("SHIFT", 22), + (56, G["("]): ("SHIFT", 11), + (56, G["false"]): ("SHIFT", 26), + (56, G["isvoid"]): ("SHIFT", 24), + (56, G["~"]): ("SHIFT", 27), + (56, G["string"]): ("SHIFT", 32), + (57, G["else"]): ("REDUCE", G["term -> term / factor"]), + (57, G["="]): ("REDUCE", G["term -> term / factor"]), + (57, G[","]): ("REDUCE", G["term -> term / factor"]), + (57, G["fi"]): ("REDUCE", G["term -> term / factor"]), + (57, G[";"]): ("REDUCE", G["term -> term / factor"]), + (57, G["error"]): ("REDUCE", G["term -> term / factor"]), + (57, G["loop"]): ("REDUCE", G["term -> term / factor"]), + (57, G["pool"]): ("REDUCE", G["term -> term / factor"]), + (57, G["+"]): ("REDUCE", G["term -> term / factor"]), + (57, G["-"]): ("REDUCE", G["term -> term / factor"]), + (57, G["in"]): ("REDUCE", G["term -> term / factor"]), + (57, G["*"]): ("REDUCE", G["term -> term / factor"]), + (57, G["}"]): ("REDUCE", G["term -> term / factor"]), + (57, G["/"]): ("REDUCE", G["term -> term / factor"]), + (57, G["of"]): ("REDUCE", G["term -> term / factor"]), + (57, G["<="]): ("REDUCE", G["term -> term / factor"]), + (57, G["<"]): ("REDUCE", G["term -> term / factor"]), + (57, G[")"]): ("REDUCE", G["term -> term / factor"]), + (57, G["then"]): ("REDUCE", G["term -> term / factor"]), + (58, G["else"]): ("REDUCE", G["term -> factor"]), + (58, G["="]): ("REDUCE", G["term -> factor"]), + (58, G[","]): ("REDUCE", G["term -> factor"]), + (58, G["fi"]): ("REDUCE", G["term -> factor"]), + (58, G[";"]): ("REDUCE", G["term -> factor"]), + (58, G["error"]): ("REDUCE", G["term -> factor"]), + (58, G["loop"]): ("REDUCE", G["term -> factor"]), + (58, G["pool"]): ("REDUCE", G["term -> factor"]), + (58, G["+"]): ("REDUCE", G["term -> factor"]), + (58, G["-"]): ("REDUCE", G["term -> factor"]), + (58, G["in"]): ("REDUCE", G["term -> factor"]), + (58, G["*"]): ("REDUCE", G["term -> factor"]), + (58, G["}"]): ("REDUCE", G["term -> factor"]), + (58, G["/"]): ("REDUCE", G["term -> factor"]), + (58, G["of"]): ("REDUCE", G["term -> factor"]), + (58, G["<="]): ("REDUCE", G["term -> factor"]), + (58, G["<"]): ("REDUCE", G["term -> factor"]), + (58, G[")"]): ("REDUCE", G["term -> factor"]), + (58, G["then"]): ("REDUCE", G["term -> factor"]), + (59, G["/"]): ("SHIFT", 56), + (59, G["*"]): ("SHIFT", 40), + (59, G["else"]): ("REDUCE", G["arith -> term"]), + (59, G["="]): ("REDUCE", G["arith -> term"]), + (59, G[","]): ("REDUCE", G["arith -> term"]), + (59, G["fi"]): ("REDUCE", G["arith -> term"]), + (59, G[";"]): ("REDUCE", G["arith -> term"]), + (59, G["error"]): ("REDUCE", G["arith -> term"]), + (59, G["loop"]): ("REDUCE", G["arith -> term"]), + (59, G["pool"]): ("REDUCE", G["arith -> term"]), + (59, G["+"]): ("REDUCE", G["arith -> term"]), + (59, G["-"]): ("REDUCE", G["arith -> term"]), + (59, G["in"]): ("REDUCE", G["arith -> term"]), + (59, G["}"]): ("REDUCE", G["arith -> term"]), + (59, G["of"]): ("REDUCE", G["arith -> term"]), + (59, G["<="]): ("REDUCE", G["arith -> term"]), + (59, G["<"]): ("REDUCE", G["arith -> term"]), + (59, G[")"]): ("REDUCE", G["arith -> term"]), + (59, G["then"]): ("REDUCE", G["arith -> term"]), (60, G["id"]): ("SHIFT", 28), - (60, G["string"]): ("SHIFT", 32), - (60, G["true"]): ("SHIFT", 25), (60, G["int"]): ("SHIFT", 31), - (60, G["not"]): ("SHIFT", 61), - (60, G["("]): ("SHIFT", 11), + (60, G["true"]): ("SHIFT", 25), + (60, G["if"]): ("SHIFT", 12), (60, G["new"]): ("SHIFT", 22), - (60, G["~"]): ("SHIFT", 27), + (60, G["("]): ("SHIFT", 11), (60, G["isvoid"]): ("SHIFT", 24), - (61, G["false"]): ("SHIFT", 26), - (61, G["if"]): ("SHIFT", 12), - (61, G["id"]): ("SHIFT", 28), - (61, G["string"]): ("SHIFT", 32), - (61, G["true"]): ("SHIFT", 25), - (61, G["int"]): ("SHIFT", 31), - (61, G["("]): ("SHIFT", 11), - (61, G["new"]): ("SHIFT", 22), - (61, G["~"]): ("SHIFT", 27), - (61, G["isvoid"]): ("SHIFT", 24), + (60, G["false"]): ("SHIFT", 26), + (60, G["~"]): ("SHIFT", 27), + (60, G["not"]): ("SHIFT", 36), + (60, G["string"]): ("SHIFT", 32), + (61, G["else"]): ("REDUCE", G["comp -> comp = negable-arith"]), + (61, G["="]): ("REDUCE", G["comp -> comp = negable-arith"]), + (61, G["in"]): ("REDUCE", G["comp -> comp = negable-arith"]), + (61, G[","]): ("REDUCE", G["comp -> comp = negable-arith"]), + (61, G["fi"]): ("REDUCE", G["comp -> comp = negable-arith"]), + (61, G["}"]): ("REDUCE", G["comp -> comp = negable-arith"]), + (61, G["pool"]): ("REDUCE", G["comp -> comp = negable-arith"]), + (61, G[";"]): ("REDUCE", G["comp -> comp = negable-arith"]), + (61, G["error"]): ("REDUCE", G["comp -> comp = negable-arith"]), + (61, G["<"]): ("REDUCE", G["comp -> comp = negable-arith"]), + (61, G["loop"]): ("REDUCE", G["comp -> comp = negable-arith"]), + (61, G["of"]): ("REDUCE", G["comp -> comp = negable-arith"]), + (61, G["<="]): ("REDUCE", G["comp -> comp = negable-arith"]), + (61, G[")"]): ("REDUCE", G["comp -> comp = negable-arith"]), + (61, G["then"]): ("REDUCE", G["comp -> comp = negable-arith"]), + (62, G["-"]): ("SHIFT", 54), (62, G["+"]): ("SHIFT", 38), - (62, G["-"]): ("SHIFT", 53), - (62, G["else"]): ("REDUCE", G["comp -> comp = not arith"]), - (62, G["="]): ("REDUCE", G["comp -> comp = not arith"]), - (62, G[","]): ("REDUCE", G["comp -> comp = not arith"]), - (62, G["in"]): ("REDUCE", G["comp -> comp = not arith"]), - (62, G["fi"]): ("REDUCE", G["comp -> comp = not arith"]), - (62, G["}"]): ("REDUCE", G["comp -> comp = not arith"]), - (62, G["error"]): ("REDUCE", G["comp -> comp = not arith"]), - (62, G[")"]): ("REDUCE", G["comp -> comp = not arith"]), - (62, G[";"]): ("REDUCE", G["comp -> comp = not arith"]), - (62, G["of"]): ("REDUCE", G["comp -> comp = not arith"]), - (62, G["<"]): ("REDUCE", G["comp -> comp = not arith"]), - (62, G["loop"]): ("REDUCE", G["comp -> comp = not arith"]), - (62, G["pool"]): ("REDUCE", G["comp -> comp = not arith"]), - (62, G["<="]): ("REDUCE", G["comp -> comp = not arith"]), - (62, G["then"]): ("REDUCE", G["comp -> comp = not arith"]), - (63, G["+"]): ("SHIFT", 38), - (63, G["-"]): ("SHIFT", 53), - (63, G["else"]): ("REDUCE", G["comp -> comp = arith"]), - (63, G["="]): ("REDUCE", G["comp -> comp = arith"]), - (63, G[","]): ("REDUCE", G["comp -> comp = arith"]), - (63, G["in"]): ("REDUCE", G["comp -> comp = arith"]), - (63, G["fi"]): ("REDUCE", G["comp -> comp = arith"]), - (63, G["}"]): ("REDUCE", G["comp -> comp = arith"]), - (63, G["<="]): ("REDUCE", G["comp -> comp = arith"]), - (63, G["error"]): ("REDUCE", G["comp -> comp = arith"]), - (63, G[";"]): ("REDUCE", G["comp -> comp = arith"]), - (63, G["of"]): ("REDUCE", G["comp -> comp = arith"]), - (63, G["<"]): ("REDUCE", G["comp -> comp = arith"]), - (63, G["loop"]): ("REDUCE", G["comp -> comp = arith"]), - (63, G["pool"]): ("REDUCE", G["comp -> comp = arith"]), - (63, G[")"]): ("REDUCE", G["comp -> comp = arith"]), - (63, G["then"]): ("REDUCE", G["comp -> comp = arith"]), - (64, G["else"]): ("REDUCE", G["expr -> negable"]), - (64, G[","]): ("REDUCE", G["expr -> negable"]), - (64, G["in"]): ("REDUCE", G["expr -> negable"]), - (64, G["fi"]): ("REDUCE", G["expr -> negable"]), - (64, G["}"]): ("REDUCE", G["expr -> negable"]), - (64, G["error"]): ("REDUCE", G["expr -> negable"]), - (64, G[")"]): ("REDUCE", G["expr -> negable"]), - (64, G[";"]): ("REDUCE", G["expr -> negable"]), - (64, G["of"]): ("REDUCE", G["expr -> negable"]), - (64, G["loop"]): ("REDUCE", G["expr -> negable"]), - (64, G["pool"]): ("REDUCE", G["expr -> negable"]), - (64, G["then"]): ("REDUCE", G["expr -> negable"]), - (65, G["+"]): ("SHIFT", 38), - (65, G["-"]): ("SHIFT", 53), - (65, G["else"]): ("REDUCE", G["comp -> arith"]), - (65, G["="]): ("REDUCE", G["comp -> arith"]), - (65, G[","]): ("REDUCE", G["comp -> arith"]), - (65, G["in"]): ("REDUCE", G["comp -> arith"]), - (65, G["fi"]): ("REDUCE", G["comp -> arith"]), - (65, G["}"]): ("REDUCE", G["comp -> arith"]), - (65, G["error"]): ("REDUCE", G["comp -> arith"]), - (65, G[")"]): ("REDUCE", G["comp -> arith"]), - (65, G[";"]): ("REDUCE", G["comp -> arith"]), - (65, G["of"]): ("REDUCE", G["comp -> arith"]), - (65, G["loop"]): ("REDUCE", G["comp -> arith"]), - (65, G["<="]): ("REDUCE", G["comp -> arith"]), - (65, G["<"]): ("REDUCE", G["comp -> arith"]), - (65, G["pool"]): ("REDUCE", G["comp -> arith"]), - (65, G["then"]): ("REDUCE", G["comp -> arith"]), - (66, G[")"]): ("SHIFT", 67), - (67, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (67, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (67, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (67, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (67, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (67, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (67, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (67, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (67, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (67, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (67, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (67, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (67, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (67, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (67, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (67, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (67, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (67, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (67, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (67, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (67, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), - (68, G[")"]): ("REDUCE", G["expr-list -> not-empty-expr-list"]), - (69, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), - (69, G[","]): ("SHIFT", 70), - (70, G["string"]): ("SHIFT", 32), - (70, G["id"]): ("SHIFT", 46), - (70, G["("]): ("SHIFT", 11), - (70, G["new"]): ("SHIFT", 22), - (70, G["{"]): ("SHIFT", 10), - (70, G["if"]): ("SHIFT", 12), - (70, G["int"]): ("SHIFT", 31), - (70, G["true"]): ("SHIFT", 25), - (70, G["let"]): ("SHIFT", 14), - (70, G["~"]): ("SHIFT", 27), - (70, G["isvoid"]): ("SHIFT", 24), - (70, G["while"]): ("SHIFT", 13), - (70, G["case"]): ("SHIFT", 21), - (70, G["not"]): ("SHIFT", 30), - (70, G["false"]): ("SHIFT", 26), - (71, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr , not-empty-expr-list"]), - (72, G["type"]): ("SHIFT", 73), - (73, G["."]): ("SHIFT", 74), - (74, G["id"]): ("SHIFT", 75), - (75, G["("]): ("SHIFT", 76), - (76, G["string"]): ("SHIFT", 32), - (76, G["id"]): ("SHIFT", 46), - (76, G["("]): ("SHIFT", 11), - (76, G["new"]): ("SHIFT", 22), - (76, G[")"]): ("REDUCE", G["expr-list -> e"]), - (76, G["{"]): ("SHIFT", 10), - (76, G["if"]): ("SHIFT", 12), - (76, G["int"]): ("SHIFT", 31), - (76, G["true"]): ("SHIFT", 25), - (76, G["let"]): ("SHIFT", 14), - (76, G["~"]): ("SHIFT", 27), - (76, G["isvoid"]): ("SHIFT", 24), - (76, G["while"]): ("SHIFT", 13), - (76, G["case"]): ("SHIFT", 21), - (76, G["not"]): ("SHIFT", 30), - (76, G["false"]): ("SHIFT", 26), + (62, G["else"]): ("REDUCE", G["comp -> arith"]), + (62, G["="]): ("REDUCE", G["comp -> arith"]), + (62, G[","]): ("REDUCE", G["comp -> arith"]), + (62, G["in"]): ("REDUCE", G["comp -> arith"]), + (62, G["fi"]): ("REDUCE", G["comp -> arith"]), + (62, G[")"]): ("REDUCE", G["comp -> arith"]), + (62, G["}"]): ("REDUCE", G["comp -> arith"]), + (62, G[";"]): ("REDUCE", G["comp -> arith"]), + (62, G["error"]): ("REDUCE", G["comp -> arith"]), + (62, G["loop"]): ("REDUCE", G["comp -> arith"]), + (62, G["of"]): ("REDUCE", G["comp -> arith"]), + (62, G["<="]): ("REDUCE", G["comp -> arith"]), + (62, G["<"]): ("REDUCE", G["comp -> arith"]), + (62, G["pool"]): ("REDUCE", G["comp -> arith"]), + (62, G["then"]): ("REDUCE", G["comp -> arith"]), + (63, G[")"]): ("SHIFT", 64), + (64, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G[")"]): ("REDUCE", G["expr-list -> not-empty-expr-list"]), + (66, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), + (66, G[","]): ("SHIFT", 67), + (67, G["false"]): ("SHIFT", 26), + (67, G["let"]): ("SHIFT", 14), + (67, G["id"]): ("SHIFT", 46), + (67, G["string"]): ("SHIFT", 32), + (67, G["isvoid"]): ("SHIFT", 24), + (67, G["while"]): ("SHIFT", 13), + (67, G["if"]): ("SHIFT", 12), + (67, G["new"]): ("SHIFT", 22), + (67, G["~"]): ("SHIFT", 27), + (67, G["("]): ("SHIFT", 11), + (67, G["case"]): ("SHIFT", 21), + (67, G["not"]): ("SHIFT", 30), + (67, G["{"]): ("SHIFT", 10), + (67, G["int"]): ("SHIFT", 31), + (67, G["true"]): ("SHIFT", 25), + (68, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr , not-empty-expr-list"]), + (69, G["type"]): ("SHIFT", 70), + (70, G["."]): ("SHIFT", 71), + (71, G["id"]): ("SHIFT", 72), + (72, G["("]): ("SHIFT", 73), + (73, G["false"]): ("SHIFT", 26), + (73, G["let"]): ("SHIFT", 14), + (73, G["id"]): ("SHIFT", 46), + (73, G["string"]): ("SHIFT", 32), + (73, G[")"]): ("REDUCE", G["expr-list -> e"]), + (73, G["isvoid"]): ("SHIFT", 24), + (73, G["while"]): ("SHIFT", 13), + (73, G["if"]): ("SHIFT", 12), + (73, G["new"]): ("SHIFT", 22), + (73, G["~"]): ("SHIFT", 27), + (73, G["("]): ("SHIFT", 11), + (73, G["case"]): ("SHIFT", 21), + (73, G["not"]): ("SHIFT", 30), + (73, G["{"]): ("SHIFT", 10), + (73, G["int"]): ("SHIFT", 31), + (73, G["true"]): ("SHIFT", 25), + (74, G[")"]): ("SHIFT", 75), + (75, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (76, G["else"]): ("REDUCE", G["comp -> comp < negable-arith"]), + (76, G["="]): ("REDUCE", G["comp -> comp < negable-arith"]), + (76, G["in"]): ("REDUCE", G["comp -> comp < negable-arith"]), + (76, G[","]): ("REDUCE", G["comp -> comp < negable-arith"]), + (76, G["fi"]): ("REDUCE", G["comp -> comp < negable-arith"]), + (76, G["}"]): ("REDUCE", G["comp -> comp < negable-arith"]), + (76, G["pool"]): ("REDUCE", G["comp -> comp < negable-arith"]), + (76, G[";"]): ("REDUCE", G["comp -> comp < negable-arith"]), + (76, G["error"]): ("REDUCE", G["comp -> comp < negable-arith"]), + (76, G["<"]): ("REDUCE", G["comp -> comp < negable-arith"]), + (76, G["loop"]): ("REDUCE", G["comp -> comp < negable-arith"]), + (76, G["of"]): ("REDUCE", G["comp -> comp < negable-arith"]), + (76, G["<="]): ("REDUCE", G["comp -> comp < negable-arith"]), + (76, G[")"]): ("REDUCE", G["comp -> comp < negable-arith"]), + (76, G["then"]): ("REDUCE", G["comp -> comp < negable-arith"]), (77, G[")"]): ("SHIFT", 78), - (78, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (78, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (78, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (78, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (78, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (78, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (78, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (78, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (78, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (78, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (78, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (78, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (78, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (78, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (78, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (78, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (78, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (78, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (78, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (78, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (78, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (79, G["else"]): ("REDUCE", G["comp -> comp < arith"]), - (79, G["="]): ("REDUCE", G["comp -> comp < arith"]), - (79, G[","]): ("REDUCE", G["comp -> comp < arith"]), - (79, G["in"]): ("REDUCE", G["comp -> comp < arith"]), - (79, G["fi"]): ("REDUCE", G["comp -> comp < arith"]), - (79, G["}"]): ("REDUCE", G["comp -> comp < arith"]), - (79, G["<="]): ("REDUCE", G["comp -> comp < arith"]), - (79, G["error"]): ("REDUCE", G["comp -> comp < arith"]), - (79, G[";"]): ("REDUCE", G["comp -> comp < arith"]), - (79, G["of"]): ("REDUCE", G["comp -> comp < arith"]), - (79, G["<"]): ("REDUCE", G["comp -> comp < arith"]), - (79, G["loop"]): ("REDUCE", G["comp -> comp < arith"]), - (79, G["pool"]): ("REDUCE", G["comp -> comp < arith"]), - (79, G[")"]): ("REDUCE", G["comp -> comp < arith"]), - (79, G["then"]): ("REDUCE", G["comp -> comp < arith"]), - (79, G["+"]): ("SHIFT", 38), - (79, G["-"]): ("SHIFT", 53), - (80, G[")"]): ("SHIFT", 81), - (81, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (81, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (81, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (81, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (81, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (81, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (81, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (81, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (81, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (81, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (81, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (81, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (81, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (81, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (81, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (81, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (81, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (81, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (81, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (81, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (81, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), - (82, G["else"]): ("REDUCE", G["factor -> ~ factor"]), - (82, G["="]): ("REDUCE", G["factor -> ~ factor"]), - (82, G[","]): ("REDUCE", G["factor -> ~ factor"]), - (82, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), - (82, G["error"]): ("REDUCE", G["factor -> ~ factor"]), - (82, G[";"]): ("REDUCE", G["factor -> ~ factor"]), - (82, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), - (82, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), - (82, G["+"]): ("REDUCE", G["factor -> ~ factor"]), - (82, G["-"]): ("REDUCE", G["factor -> ~ factor"]), - (82, G["in"]): ("REDUCE", G["factor -> ~ factor"]), - (82, G["*"]): ("REDUCE", G["factor -> ~ factor"]), - (82, G["}"]): ("REDUCE", G["factor -> ~ factor"]), - (82, G["/"]): ("REDUCE", G["factor -> ~ factor"]), - (82, G["of"]): ("REDUCE", G["factor -> ~ factor"]), - (82, G["<"]): ("REDUCE", G["factor -> ~ factor"]), - (82, G["<="]): ("REDUCE", G["factor -> ~ factor"]), - (82, G[")"]): ("REDUCE", G["factor -> ~ factor"]), - (82, G["then"]): ("REDUCE", G["factor -> ~ factor"]), - (83, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), - (83, G["="]): ("REDUCE", G["factor -> isvoid factor"]), - (83, G[","]): ("REDUCE", G["factor -> isvoid factor"]), - (83, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), - (83, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), - (83, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), - (83, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), - (83, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), - (83, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), - (83, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), - (83, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), - (83, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), - (83, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), - (83, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), - (83, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), - (83, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), - (83, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), - (83, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), - (83, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), - (84, G["of"]): ("SHIFT", 85), - (85, G["id"]): ("SHIFT", 86), - (86, G[":"]): ("SHIFT", 87), - (87, G["type"]): ("SHIFT", 88), - (88, G["=>"]): ("SHIFT", 89), - (89, G["id"]): ("SHIFT", 46), - (89, G["("]): ("SHIFT", 11), - (89, G["new"]): ("SHIFT", 22), - (89, G["~"]): ("SHIFT", 27), - (89, G["{"]): ("SHIFT", 10), - (89, G["isvoid"]): ("SHIFT", 24), - (89, G["if"]): ("SHIFT", 12), - (89, G["true"]): ("SHIFT", 25), - (89, G["int"]): ("SHIFT", 31), - (89, G["let"]): ("SHIFT", 14), - (89, G["not"]): ("SHIFT", 30), - (89, G["case"]): ("SHIFT", 21), - (89, G["while"]): ("SHIFT", 13), - (89, G["false"]): ("SHIFT", 26), - (89, G["string"]): ("SHIFT", 32), - (90, G[";"]): ("SHIFT", 91), - (90, G["error"]): ("SHIFT", 93), - (91, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), - (91, G["id"]): ("SHIFT", 86), - (92, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), - (93, G["id"]): ("SHIFT", 86), - (93, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), - (94, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error case-list"]), - (95, G["esac"]): ("SHIFT", 96), - (96, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (96, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (96, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (96, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (96, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (96, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (96, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (96, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (96, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (96, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (96, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (96, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), - (97, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), - (97, G[","]): ("SHIFT", 98), - (98, G["id"]): ("SHIFT", 15), - (99, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), - (100, G["in"]): ("SHIFT", 101), - (101, G["let"]): ("SHIFT", 14), - (101, G["false"]): ("SHIFT", 26), - (101, G["not"]): ("SHIFT", 30), + (78, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (79, G["else"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["="]): ("REDUCE", G["factor -> ~ factor"]), + (79, G[","]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G[";"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["error"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["+"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["-"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["in"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["*"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["}"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["/"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["of"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["<="]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["<"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G[")"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["then"]): ("REDUCE", G["factor -> ~ factor"]), + (80, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["="]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G[","]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), + (81, G["of"]): ("SHIFT", 82), + (82, G["id"]): ("SHIFT", 83), + (83, G[":"]): ("SHIFT", 84), + (84, G["type"]): ("SHIFT", 85), + (85, G["=>"]): ("SHIFT", 86), + (86, G["false"]): ("SHIFT", 26), + (86, G["id"]): ("SHIFT", 46), + (86, G["while"]): ("SHIFT", 13), + (86, G["isvoid"]): ("SHIFT", 24), + (86, G["string"]): ("SHIFT", 32), + (86, G["~"]): ("SHIFT", 27), + (86, G["not"]): ("SHIFT", 30), + (86, G["case"]): ("SHIFT", 21), + (86, G["new"]): ("SHIFT", 22), + (86, G["if"]): ("SHIFT", 12), + (86, G["{"]): ("SHIFT", 10), + (86, G["("]): ("SHIFT", 11), + (86, G["let"]): ("SHIFT", 14), + (86, G["true"]): ("SHIFT", 25), + (86, G["int"]): ("SHIFT", 31), + (87, G[";"]): ("SHIFT", 88), + (87, G["error"]): ("SHIFT", 90), + (88, G["id"]): ("SHIFT", 83), + (88, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), + (89, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), + (90, G["id"]): ("SHIFT", 83), + (90, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), + (91, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error case-list"]), + (92, G["esac"]): ("SHIFT", 93), + (93, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (93, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (93, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (93, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (93, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (93, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (93, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (93, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (93, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (93, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (93, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (93, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (94, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), + (94, G[","]): ("SHIFT", 95), + (95, G["id"]): ("SHIFT", 15), + (96, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), + (97, G["in"]): ("SHIFT", 98), + (98, G["id"]): ("SHIFT", 46), + (98, G["if"]): ("SHIFT", 12), + (98, G["let"]): ("SHIFT", 14), + (98, G["new"]): ("SHIFT", 22), + (98, G["("]): ("SHIFT", 11), + (98, G["isvoid"]): ("SHIFT", 24), + (98, G["~"]): ("SHIFT", 27), + (98, G["while"]): ("SHIFT", 13), + (98, G["int"]): ("SHIFT", 31), + (98, G["true"]): ("SHIFT", 25), + (98, G["not"]): ("SHIFT", 30), + (98, G["case"]): ("SHIFT", 21), + (98, G["false"]): ("SHIFT", 26), + (98, G["{"]): ("SHIFT", 10), + (98, G["string"]): ("SHIFT", 32), + (99, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (99, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (99, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (99, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (99, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (99, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (99, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (99, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (99, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (99, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (99, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (99, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (100, G["loop"]): ("SHIFT", 101), (101, G["id"]): ("SHIFT", 46), - (101, G["case"]): ("SHIFT", 21), + (101, G["let"]): ("SHIFT", 14), + (101, G["isvoid"]): ("SHIFT", 24), (101, G["string"]): ("SHIFT", 32), + (101, G["~"]): ("SHIFT", 27), (101, G["while"]): ("SHIFT", 13), - (101, G["("]): ("SHIFT", 11), (101, G["new"]): ("SHIFT", 22), - (101, G["~"]): ("SHIFT", 27), - (101, G["isvoid"]): ("SHIFT", 24), (101, G["if"]): ("SHIFT", 12), + (101, G["("]): ("SHIFT", 11), + (101, G["case"]): ("SHIFT", 21), + (101, G["not"]): ("SHIFT", 30), (101, G["{"]): ("SHIFT", 10), (101, G["true"]): ("SHIFT", 25), (101, G["int"]): ("SHIFT", 31), - (102, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (102, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (102, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (102, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (102, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (102, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (102, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (102, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (102, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (102, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (102, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (102, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), - (103, G["loop"]): ("SHIFT", 104), - (104, G["case"]): ("SHIFT", 21), - (104, G["new"]): ("SHIFT", 22), - (104, G["not"]): ("SHIFT", 30), - (104, G["("]): ("SHIFT", 11), - (104, G["while"]): ("SHIFT", 13), - (104, G["if"]): ("SHIFT", 12), - (104, G["true"]): ("SHIFT", 25), - (104, G["int"]): ("SHIFT", 31), - (104, G["{"]): ("SHIFT", 10), - (104, G["let"]): ("SHIFT", 14), - (104, G["id"]): ("SHIFT", 46), - (104, G["~"]): ("SHIFT", 27), - (104, G["isvoid"]): ("SHIFT", 24), - (104, G["false"]): ("SHIFT", 26), - (104, G["string"]): ("SHIFT", 32), - (105, G["pool"]): ("SHIFT", 106), - (106, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (106, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (106, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (106, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (106, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (106, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (106, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (106, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (106, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (106, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (106, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (106, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), - (107, G["then"]): ("SHIFT", 108), - (108, G["not"]): ("SHIFT", 30), - (108, G["case"]): ("SHIFT", 21), - (108, G["false"]): ("SHIFT", 26), - (108, G["id"]): ("SHIFT", 46), - (108, G["~"]): ("SHIFT", 27), - (108, G["while"]): ("SHIFT", 13), - (108, G["string"]): ("SHIFT", 32), - (108, G["isvoid"]): ("SHIFT", 24), - (108, G["new"]): ("SHIFT", 22), - (108, G["("]): ("SHIFT", 11), - (108, G["{"]): ("SHIFT", 10), - (108, G["if"]): ("SHIFT", 12), - (108, G["true"]): ("SHIFT", 25), - (108, G["int"]): ("SHIFT", 31), - (108, G["let"]): ("SHIFT", 14), - (109, G["else"]): ("SHIFT", 110), - (110, G["id"]): ("SHIFT", 46), - (110, G["("]): ("SHIFT", 11), - (110, G["new"]): ("SHIFT", 22), - (110, G["~"]): ("SHIFT", 27), - (110, G["{"]): ("SHIFT", 10), - (110, G["isvoid"]): ("SHIFT", 24), - (110, G["if"]): ("SHIFT", 12), - (110, G["int"]): ("SHIFT", 31), - (110, G["true"]): ("SHIFT", 25), - (110, G["let"]): ("SHIFT", 14), - (110, G["case"]): ("SHIFT", 21), - (110, G["not"]): ("SHIFT", 30), - (110, G["while"]): ("SHIFT", 13), - (110, G["false"]): ("SHIFT", 26), - (110, G["string"]): ("SHIFT", 32), - (111, G["fi"]): ("SHIFT", 112), - (112, G["."]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (112, G["else"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (112, G["="]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (112, G[","]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (112, G["fi"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (112, G["error"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (112, G[";"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (112, G["loop"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (112, G["@"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (112, G["pool"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (112, G["+"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (112, G["-"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (112, G["in"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (112, G["*"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (112, G["}"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (112, G["/"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (112, G["of"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (112, G["<"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (112, G["<="]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (112, G[")"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (112, G["then"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), - (113, G[")"]): ("SHIFT", 114), - (114, G["."]): ("REDUCE", G["atom -> ( expr )"]), - (114, G["else"]): ("REDUCE", G["atom -> ( expr )"]), - (114, G["="]): ("REDUCE", G["atom -> ( expr )"]), - (114, G[","]): ("REDUCE", G["atom -> ( expr )"]), - (114, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), - (114, G["error"]): ("REDUCE", G["atom -> ( expr )"]), - (114, G[";"]): ("REDUCE", G["atom -> ( expr )"]), - (114, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), - (114, G["@"]): ("REDUCE", G["atom -> ( expr )"]), - (114, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), - (114, G["+"]): ("REDUCE", G["atom -> ( expr )"]), - (114, G["-"]): ("REDUCE", G["atom -> ( expr )"]), - (114, G["in"]): ("REDUCE", G["atom -> ( expr )"]), - (114, G["*"]): ("REDUCE", G["atom -> ( expr )"]), - (114, G["}"]): ("REDUCE", G["atom -> ( expr )"]), - (114, G["/"]): ("REDUCE", G["atom -> ( expr )"]), - (114, G["of"]): ("REDUCE", G["atom -> ( expr )"]), - (114, G["<"]): ("REDUCE", G["atom -> ( expr )"]), - (114, G["<="]): ("REDUCE", G["atom -> ( expr )"]), - (114, G[")"]): ("REDUCE", G["atom -> ( expr )"]), - (114, G["then"]): ("REDUCE", G["atom -> ( expr )"]), - (115, G["}"]): ("SHIFT", 116), - (116, G["else"]): ("REDUCE", G["expr -> { block }"]), - (116, G[","]): ("REDUCE", G["expr -> { block }"]), - (116, G["in"]): ("REDUCE", G["expr -> { block }"]), - (116, G["fi"]): ("REDUCE", G["expr -> { block }"]), - (116, G["}"]): ("REDUCE", G["expr -> { block }"]), - (116, G["error"]): ("REDUCE", G["expr -> { block }"]), - (116, G[")"]): ("REDUCE", G["expr -> { block }"]), - (116, G[";"]): ("REDUCE", G["expr -> { block }"]), - (116, G["of"]): ("REDUCE", G["expr -> { block }"]), - (116, G["loop"]): ("REDUCE", G["expr -> { block }"]), - (116, G["pool"]): ("REDUCE", G["expr -> { block }"]), - (116, G["then"]): ("REDUCE", G["expr -> { block }"]), - (117, G[";"]): ("SHIFT", 118), - (117, G["error"]): ("SHIFT", 120), - (118, G["id"]): ("SHIFT", 46), - (118, G["("]): ("SHIFT", 11), - (118, G["new"]): ("SHIFT", 22), - (118, G["~"]): ("SHIFT", 27), - (118, G["{"]): ("SHIFT", 10), - (118, G["isvoid"]): ("SHIFT", 24), - (118, G["if"]): ("SHIFT", 12), - (118, G["true"]): ("SHIFT", 25), - (118, G["int"]): ("SHIFT", 31), - (118, G["let"]): ("SHIFT", 14), - (118, G["not"]): ("SHIFT", 30), - (118, G["case"]): ("SHIFT", 21), - (118, G["}"]): ("REDUCE", G["block -> expr ;"]), - (118, G["while"]): ("SHIFT", 13), - (118, G["false"]): ("SHIFT", 26), - (118, G["string"]): ("SHIFT", 32), - (119, G["}"]): ("REDUCE", G["block -> expr ; block"]), - (120, G["id"]): ("SHIFT", 46), - (120, G["("]): ("SHIFT", 11), - (120, G["new"]): ("SHIFT", 22), - (120, G["~"]): ("SHIFT", 27), - (120, G["{"]): ("SHIFT", 10), - (120, G["isvoid"]): ("SHIFT", 24), - (120, G["if"]): ("SHIFT", 12), - (120, G["}"]): ("REDUCE", G["block -> expr error"]), - (120, G["true"]): ("SHIFT", 25), - (120, G["int"]): ("SHIFT", 31), - (120, G["let"]): ("SHIFT", 14), - (120, G["not"]): ("SHIFT", 30), - (120, G["case"]): ("SHIFT", 21), - (120, G["while"]): ("SHIFT", 13), - (120, G["false"]): ("SHIFT", 26), - (120, G["string"]): ("SHIFT", 32), - (121, G["}"]): ("REDUCE", G["block -> expr error block"]), - (122, G["}"]): ("SHIFT", 123), - (123, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), - (123, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), - (124, G[":"]): ("SHIFT", 125), - (125, G["type"]): ("SHIFT", 126), - (126, G[","]): ("SHIFT", 127), - (126, G[")"]): ("REDUCE", G["param-list -> id : type"]), - (127, G["id"]): ("SHIFT", 124), - (128, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), - (129, G[")"]): ("SHIFT", 130), - (130, G[":"]): ("SHIFT", 131), - (131, G["type"]): ("SHIFT", 132), - (132, G["{"]): ("SHIFT", 133), - (133, G["true"]): ("SHIFT", 25), - (133, G["case"]): ("SHIFT", 21), - (133, G["not"]): ("SHIFT", 30), - (133, G["while"]): ("SHIFT", 13), - (133, G["false"]): ("SHIFT", 26), - (133, G["id"]): ("SHIFT", 46), - (133, G["string"]): ("SHIFT", 32), - (133, G["("]): ("SHIFT", 11), - (133, G["new"]): ("SHIFT", 22), - (133, G["{"]): ("SHIFT", 10), - (133, G["~"]): ("SHIFT", 27), - (133, G["isvoid"]): ("SHIFT", 24), - (133, G["if"]): ("SHIFT", 12), - (133, G["int"]): ("SHIFT", 31), - (133, G["let"]): ("SHIFT", 14), - (134, G["}"]): ("SHIFT", 135), - (135, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), - (135, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), - (136, G["type"]): ("SHIFT", 137), - (137, G["<-"]): ("SHIFT", 138), - (137, G["error"]): ("REDUCE", G["attribute -> id : type"]), - (137, G[";"]): ("REDUCE", G["attribute -> id : type"]), - (138, G["id"]): ("SHIFT", 46), - (138, G["("]): ("SHIFT", 11), - (138, G["new"]): ("SHIFT", 22), - (138, G["string"]): ("SHIFT", 32), - (138, G["~"]): ("SHIFT", 27), - (138, G["{"]): ("SHIFT", 10), - (138, G["isvoid"]): ("SHIFT", 24), - (138, G["if"]): ("SHIFT", 12), - (138, G["true"]): ("SHIFT", 25), - (138, G["int"]): ("SHIFT", 31), - (138, G["let"]): ("SHIFT", 14), - (138, G["not"]): ("SHIFT", 30), - (138, G["case"]): ("SHIFT", 21), - (138, G["while"]): ("SHIFT", 13), - (138, G["false"]): ("SHIFT", 26), - (139, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), - (139, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), - (140, G["}"]): ("SHIFT", 141), - (141, G[";"]): ("REDUCE", G["class-def -> class type { feature-list }"]), + (101, G["false"]): ("SHIFT", 26), + (102, G["pool"]): ("SHIFT", 103), + (103, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (103, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (103, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (103, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (103, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (103, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (103, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (103, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (103, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (103, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (103, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (103, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (104, G["then"]): ("SHIFT", 105), + (105, G["id"]): ("SHIFT", 46), + (105, G["true"]): ("SHIFT", 25), + (105, G["false"]): ("SHIFT", 26), + (105, G["isvoid"]): ("SHIFT", 24), + (105, G["let"]): ("SHIFT", 14), + (105, G["~"]): ("SHIFT", 27), + (105, G["string"]): ("SHIFT", 32), + (105, G["if"]): ("SHIFT", 12), + (105, G["new"]): ("SHIFT", 22), + (105, G["while"]): ("SHIFT", 13), + (105, G["("]): ("SHIFT", 11), + (105, G["case"]): ("SHIFT", 21), + (105, G["not"]): ("SHIFT", 30), + (105, G["{"]): ("SHIFT", 10), + (105, G["int"]): ("SHIFT", 31), + (106, G["else"]): ("SHIFT", 107), + (107, G["false"]): ("SHIFT", 26), + (107, G["~"]): ("SHIFT", 27), + (107, G["id"]): ("SHIFT", 46), + (107, G["string"]): ("SHIFT", 32), + (107, G["{"]): ("SHIFT", 10), + (107, G["let"]): ("SHIFT", 14), + (107, G["if"]): ("SHIFT", 12), + (107, G["new"]): ("SHIFT", 22), + (107, G["("]): ("SHIFT", 11), + (107, G["while"]): ("SHIFT", 13), + (107, G["not"]): ("SHIFT", 30), + (107, G["case"]): ("SHIFT", 21), + (107, G["int"]): ("SHIFT", 31), + (107, G["true"]): ("SHIFT", 25), + (107, G["isvoid"]): ("SHIFT", 24), + (108, G["fi"]): ("SHIFT", 109), + (109, G["."]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["else"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["="]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G[","]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["fi"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G[";"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["error"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["loop"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["@"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["pool"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["+"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["-"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["in"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["*"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["}"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["/"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["of"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["<="]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["<"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G[")"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["then"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (110, G[")"]): ("SHIFT", 111), + (111, G["."]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["else"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["="]): ("REDUCE", G["atom -> ( expr )"]), + (111, G[","]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G[";"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["error"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["@"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["+"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["-"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["in"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["*"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["}"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["/"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["of"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["<="]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["<"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G[")"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["then"]): ("REDUCE", G["atom -> ( expr )"]), + (112, G["}"]): ("SHIFT", 113), + (113, G["else"]): ("REDUCE", G["expr -> { block }"]), + (113, G["in"]): ("REDUCE", G["expr -> { block }"]), + (113, G[","]): ("REDUCE", G["expr -> { block }"]), + (113, G["fi"]): ("REDUCE", G["expr -> { block }"]), + (113, G[")"]): ("REDUCE", G["expr -> { block }"]), + (113, G["}"]): ("REDUCE", G["expr -> { block }"]), + (113, G[";"]): ("REDUCE", G["expr -> { block }"]), + (113, G["error"]): ("REDUCE", G["expr -> { block }"]), + (113, G["loop"]): ("REDUCE", G["expr -> { block }"]), + (113, G["of"]): ("REDUCE", G["expr -> { block }"]), + (113, G["pool"]): ("REDUCE", G["expr -> { block }"]), + (113, G["then"]): ("REDUCE", G["expr -> { block }"]), + (114, G[";"]): ("SHIFT", 115), + (114, G["error"]): ("SHIFT", 117), + (115, G["false"]): ("SHIFT", 26), + (115, G["id"]): ("SHIFT", 46), + (115, G["while"]): ("SHIFT", 13), + (115, G["isvoid"]): ("SHIFT", 24), + (115, G["string"]): ("SHIFT", 32), + (115, G["~"]): ("SHIFT", 27), + (115, G["not"]): ("SHIFT", 30), + (115, G["case"]): ("SHIFT", 21), + (115, G["new"]): ("SHIFT", 22), + (115, G["if"]): ("SHIFT", 12), + (115, G["{"]): ("SHIFT", 10), + (115, G["("]): ("SHIFT", 11), + (115, G["}"]): ("REDUCE", G["block -> expr ;"]), + (115, G["let"]): ("SHIFT", 14), + (115, G["true"]): ("SHIFT", 25), + (115, G["int"]): ("SHIFT", 31), + (116, G["}"]): ("REDUCE", G["block -> expr ; block"]), + (117, G["}"]): ("REDUCE", G["block -> expr error"]), + (117, G["false"]): ("SHIFT", 26), + (117, G["id"]): ("SHIFT", 46), + (117, G["while"]): ("SHIFT", 13), + (117, G["isvoid"]): ("SHIFT", 24), + (117, G["string"]): ("SHIFT", 32), + (117, G["~"]): ("SHIFT", 27), + (117, G["not"]): ("SHIFT", 30), + (117, G["case"]): ("SHIFT", 21), + (117, G["new"]): ("SHIFT", 22), + (117, G["if"]): ("SHIFT", 12), + (117, G["{"]): ("SHIFT", 10), + (117, G["("]): ("SHIFT", 11), + (117, G["let"]): ("SHIFT", 14), + (117, G["true"]): ("SHIFT", 25), + (117, G["int"]): ("SHIFT", 31), + (118, G["}"]): ("REDUCE", G["block -> expr error block"]), + (119, G["}"]): ("SHIFT", 120), + (120, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (120, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (121, G[":"]): ("SHIFT", 122), + (122, G["type"]): ("SHIFT", 123), + (123, G[","]): ("SHIFT", 124), + (123, G[")"]): ("REDUCE", G["param-list -> id : type"]), + (124, G["id"]): ("SHIFT", 121), + (125, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), + (126, G[")"]): ("SHIFT", 127), + (127, G[":"]): ("SHIFT", 128), + (128, G["type"]): ("SHIFT", 129), + (129, G["{"]): ("SHIFT", 130), + (130, G["while"]): ("SHIFT", 13), + (130, G["false"]): ("SHIFT", 26), + (130, G["id"]): ("SHIFT", 46), + (130, G["case"]): ("SHIFT", 21), + (130, G["not"]): ("SHIFT", 30), + (130, G["string"]): ("SHIFT", 32), + (130, G["{"]): ("SHIFT", 10), + (130, G["isvoid"]): ("SHIFT", 24), + (130, G["if"]): ("SHIFT", 12), + (130, G["new"]): ("SHIFT", 22), + (130, G["("]): ("SHIFT", 11), + (130, G["~"]): ("SHIFT", 27), + (130, G["let"]): ("SHIFT", 14), + (130, G["int"]): ("SHIFT", 31), + (130, G["true"]): ("SHIFT", 25), + (131, G["}"]): ("SHIFT", 132), + (132, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (132, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (133, G["type"]): ("SHIFT", 134), + (134, G[";"]): ("REDUCE", G["attribute -> id : type"]), + (134, G["error"]): ("REDUCE", G["attribute -> id : type"]), + (134, G["<-"]): ("SHIFT", 135), + (135, G["false"]): ("SHIFT", 26), + (135, G["id"]): ("SHIFT", 46), + (135, G["while"]): ("SHIFT", 13), + (135, G["isvoid"]): ("SHIFT", 24), + (135, G["string"]): ("SHIFT", 32), + (135, G["~"]): ("SHIFT", 27), + (135, G["not"]): ("SHIFT", 30), + (135, G["case"]): ("SHIFT", 21), + (135, G["new"]): ("SHIFT", 22), + (135, G["if"]): ("SHIFT", 12), + (135, G["{"]): ("SHIFT", 10), + (135, G["("]): ("SHIFT", 11), + (135, G["let"]): ("SHIFT", 14), + (135, G["true"]): ("SHIFT", 25), + (135, G["int"]): ("SHIFT", 31), + (136, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (136, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (137, G["}"]): ("SHIFT", 138), + (138, G[";"]): ("REDUCE", G["class-def -> class type { feature-list }"]), + (139, G["error"]): ("SHIFT", 147), + (139, G[";"]): ("SHIFT", 140), + (140, G["id"]): ("SHIFT", 4), + (140, G["}"]): ("REDUCE", G["feature-list -> e"]), + (141, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), (142, G[";"]): ("SHIFT", 143), - (142, G["error"]): ("SHIFT", 150), - (143, G["}"]): ("REDUCE", G["feature-list -> e"]), + (142, G["error"]): ("SHIFT", 145), (143, G["id"]): ("SHIFT", 4), - (144, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), - (145, G[";"]): ("SHIFT", 146), - (145, G["error"]): ("SHIFT", 148), - (146, G["}"]): ("REDUCE", G["feature-list -> e"]), - (146, G["id"]): ("SHIFT", 4), - (147, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), - (148, G["}"]): ("REDUCE", G["feature-list -> e"]), - (148, G["id"]): ("SHIFT", 4), - (149, G["}"]): ("REDUCE", G["feature-list -> method error feature-list"]), - (150, G["}"]): ("REDUCE", G["feature-list -> e"]), - (150, G["id"]): ("SHIFT", 4), - (151, G["}"]): ("REDUCE", G["feature-list -> attribute error feature-list"]), - (152, G["type"]): ("SHIFT", 153), - (153, G["{"]): ("SHIFT", 154), - (154, G["}"]): ("REDUCE", G["feature-list -> e"]), - (154, G["id"]): ("SHIFT", 4), - (155, G["}"]): ("SHIFT", 156), - (156, G[";"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), - (157, G["$"]): ("OK", None), - (158, G["$"]): ("REDUCE", G["program -> class-list"]), - (159, G[";"]): ("SHIFT", 160), - (160, G["class"]): ("SHIFT", 1), - (160, G["$"]): ("REDUCE", G["class-list -> class-def ;"]), - (161, G["$"]): ("REDUCE", G["class-list -> class-def ; class-list"]), + (143, G["}"]): ("REDUCE", G["feature-list -> e"]), + (144, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), + (145, G["id"]): ("SHIFT", 4), + (145, G["}"]): ("REDUCE", G["feature-list -> e"]), + (146, G["}"]): ("REDUCE", G["feature-list -> method error feature-list"]), + (147, G["id"]): ("SHIFT", 4), + (147, G["}"]): ("REDUCE", G["feature-list -> e"]), + (148, G["}"]): ("REDUCE", G["feature-list -> attribute error feature-list"]), + (149, G["type"]): ("SHIFT", 150), + (150, G["{"]): ("SHIFT", 151), + (151, G["id"]): ("SHIFT", 4), + (151, G["}"]): ("REDUCE", G["feature-list -> e"]), + (152, G["}"]): ("SHIFT", 153), + (153, G[";"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), + (154, G["$"]): ("OK", None), + (155, G["$"]): ("REDUCE", G["program -> class-list"]), + (156, G[";"]): ("SHIFT", 157), + (157, G["class"]): ("SHIFT", 1), + (157, G["$"]): ("REDUCE", G["class-list -> class-def ;"]), + (158, G["$"]): ("REDUCE", G["class-list -> class-def ; class-list"]), } @staticmethod def __goto_table(): return { - (0, G["class-list"]): 158, - (0, G["class-def"]): 159, - (0, G["program"]): 157, - (3, G["method"]): 145, - (3, G["attribute"]): 142, - (3, G["feature-list"]): 140, - (5, G["param-list"]): 129, - (9, G["arith"]): 65, - (9, G["atom"]): 42, - (9, G["term"]): 58, + (0, G["program"]): 154, + (0, G["class-list"]): 155, + (0, G["class-def"]): 156, + (3, G["attribute"]): 139, + (3, G["method"]): 142, + (3, G["feature-list"]): 137, + (5, G["param-list"]): 126, + (9, G["comp"]): 50, (9, G["function-call"]): 33, - (9, G["comp"]): 49, - (9, G["factor"]): 57, - (9, G["expr"]): 122, - (9, G["negable"]): 64, - (10, G["function-call"]): 33, - (10, G["factor"]): 57, - (10, G["arith"]): 65, - (10, G["block"]): 115, - (10, G["comp"]): 49, + (9, G["term"]): 59, + (9, G["arith"]): 62, + (9, G["negable-comp"]): 49, + (9, G["atom"]): 42, + (9, G["factor"]): 58, + (9, G["expr"]): 119, + (10, G["term"]): 59, (10, G["atom"]): 42, - (10, G["expr"]): 117, - (10, G["term"]): 58, - (10, G["negable"]): 64, - (11, G["comp"]): 49, - (11, G["atom"]): 42, - (11, G["term"]): 58, - (11, G["arith"]): 65, - (11, G["factor"]): 57, - (11, G["negable"]): 64, - (11, G["expr"]): 113, + (10, G["expr"]): 114, + (10, G["arith"]): 62, + (10, G["comp"]): 50, + (10, G["function-call"]): 33, + (10, G["block"]): 112, + (10, G["factor"]): 58, + (10, G["negable-comp"]): 49, + (11, G["comp"]): 50, + (11, G["negable-comp"]): 49, (11, G["function-call"]): 33, - (12, G["comp"]): 49, + (11, G["atom"]): 42, + (11, G["term"]): 59, + (11, G["arith"]): 62, + (11, G["factor"]): 58, + (11, G["expr"]): 110, + (12, G["comp"]): 50, (12, G["function-call"]): 33, - (12, G["expr"]): 107, + (12, G["term"]): 59, + (12, G["arith"]): 62, + (12, G["negable-comp"]): 49, (12, G["atom"]): 42, - (12, G["term"]): 58, - (12, G["arith"]): 65, - (12, G["negable"]): 64, - (12, G["factor"]): 57, + (12, G["expr"]): 104, + (12, G["factor"]): 58, + (13, G["comp"]): 50, (13, G["atom"]): 42, - (13, G["term"]): 58, - (13, G["comp"]): 49, - (13, G["arith"]): 65, - (13, G["factor"]): 57, + (13, G["negable-comp"]): 49, + (13, G["expr"]): 100, + (13, G["term"]): 59, + (13, G["arith"]): 62, (13, G["function-call"]): 33, - (13, G["negable"]): 64, - (13, G["expr"]): 103, - (14, G["declaration-list"]): 100, + (13, G["factor"]): 58, + (14, G["declaration-list"]): 97, (18, G["declaration-list"]): 19, - (20, G["arith"]): 65, - (20, G["comp"]): 49, - (20, G["expr"]): 97, - (20, G["factor"]): 57, - (20, G["negable"]): 64, (20, G["atom"]): 42, - (20, G["term"]): 58, + (20, G["term"]): 59, + (20, G["comp"]): 50, + (20, G["arith"]): 62, (20, G["function-call"]): 33, - (21, G["term"]): 58, - (21, G["comp"]): 49, - (21, G["function-call"]): 33, + (20, G["expr"]): 94, + (20, G["factor"]): 58, + (20, G["negable-comp"]): 49, + (21, G["arith"]): 62, + (21, G["comp"]): 50, (21, G["atom"]): 42, - (21, G["arith"]): 65, - (21, G["expr"]): 84, - (21, G["negable"]): 64, - (21, G["factor"]): 57, - (24, G["atom"]): 42, - (24, G["factor"]): 83, + (21, G["expr"]): 81, + (21, G["term"]): 59, + (21, G["factor"]): 58, + (21, G["negable-comp"]): 49, + (21, G["function-call"]): 33, (24, G["function-call"]): 33, - (27, G["factor"]): 82, - (27, G["atom"]): 42, + (24, G["factor"]): 80, + (24, G["atom"]): 42, (27, G["function-call"]): 33, - (29, G["comp"]): 49, - (29, G["atom"]): 42, - (29, G["expr-list"]): 80, + (27, G["factor"]): 79, + (27, G["atom"]): 42, + (29, G["not-empty-expr-list"]): 65, + (29, G["comp"]): 50, + (29, G["expr"]): 66, (29, G["function-call"]): 33, - (29, G["expr"]): 69, - (29, G["term"]): 58, - (29, G["factor"]): 57, - (29, G["negable"]): 64, - (29, G["not-empty-expr-list"]): 68, - (29, G["arith"]): 65, + (29, G["atom"]): 42, + (29, G["term"]): 59, + (29, G["factor"]): 58, + (29, G["arith"]): 62, + (29, G["negable-comp"]): 49, + (29, G["expr-list"]): 77, + (30, G["function-call"]): 33, + (30, G["factor"]): 58, (30, G["comp"]): 34, - (30, G["term"]): 58, - (30, G["arith"]): 65, + (30, G["term"]): 59, + (30, G["arith"]): 62, (30, G["atom"]): 42, - (30, G["factor"]): 57, - (30, G["function-call"]): 33, - (35, G["term"]): 58, - (35, G["arith"]): 79, - (35, G["atom"]): 42, - (35, G["factor"]): 57, (35, G["function-call"]): 33, - (36, G["term"]): 58, + (35, G["factor"]): 58, + (35, G["term"]): 59, + (35, G["arith"]): 53, + (35, G["negable-arith"]): 76, + (35, G["atom"]): 42, + (36, G["function-call"]): 33, + (36, G["factor"]): 58, + (36, G["term"]): 59, (36, G["arith"]): 37, (36, G["atom"]): 42, - (36, G["factor"]): 57, - (36, G["function-call"]): 33, + (38, G["function-call"]): 33, + (38, G["factor"]): 58, (38, G["term"]): 39, (38, G["atom"]): 42, - (38, G["factor"]): 57, - (38, G["function-call"]): 33, - (40, G["factor"]): 41, - (40, G["atom"]): 42, (40, G["function-call"]): 33, - (45, G["comp"]): 49, - (45, G["atom"]): 42, + (40, G["atom"]): 42, + (40, G["factor"]): 41, + (45, G["not-empty-expr-list"]): 65, + (45, G["comp"]): 50, + (45, G["expr"]): 66, (45, G["function-call"]): 33, - (45, G["expr"]): 69, - (45, G["term"]): 58, - (45, G["expr-list"]): 66, - (45, G["factor"]): 57, - (45, G["negable"]): 64, - (45, G["not-empty-expr-list"]): 68, - (45, G["arith"]): 65, - (47, G["comp"]): 49, - (47, G["arith"]): 65, - (47, G["term"]): 58, - (47, G["factor"]): 57, + (45, G["atom"]): 42, + (45, G["expr-list"]): 63, + (45, G["term"]): 59, + (45, G["factor"]): 58, + (45, G["arith"]): 62, + (45, G["negable-comp"]): 49, (47, G["function-call"]): 33, - (47, G["atom"]): 42, + (47, G["comp"]): 50, + (47, G["arith"]): 62, (47, G["expr"]): 48, - (47, G["negable"]): 64, - (50, G["term"]): 58, - (50, G["arith"]): 59, - (50, G["atom"]): 42, - (50, G["factor"]): 57, - (50, G["function-call"]): 33, - (51, G["term"]): 58, - (51, G["arith"]): 52, - (51, G["atom"]): 42, - (51, G["factor"]): 57, + (47, G["atom"]): 42, + (47, G["term"]): 59, + (47, G["factor"]): 58, + (47, G["negable-comp"]): 49, (51, G["function-call"]): 33, - (53, G["term"]): 54, - (53, G["atom"]): 42, - (53, G["factor"]): 57, - (53, G["function-call"]): 33, - (55, G["factor"]): 56, - (55, G["atom"]): 42, - (55, G["function-call"]): 33, - (60, G["term"]): 58, - (60, G["arith"]): 63, - (60, G["atom"]): 42, - (60, G["factor"]): 57, + (51, G["factor"]): 58, + (51, G["term"]): 59, + (51, G["arith"]): 53, + (51, G["atom"]): 42, + (51, G["negable-arith"]): 52, + (54, G["function-call"]): 33, + (54, G["factor"]): 58, + (54, G["term"]): 55, + (54, G["atom"]): 42, + (56, G["function-call"]): 33, + (56, G["factor"]): 57, + (56, G["atom"]): 42, + (60, G["negable-arith"]): 61, (60, G["function-call"]): 33, - (61, G["term"]): 58, - (61, G["arith"]): 62, - (61, G["atom"]): 42, - (61, G["factor"]): 57, - (61, G["function-call"]): 33, - (70, G["comp"]): 49, - (70, G["atom"]): 42, - (70, G["function-call"]): 33, - (70, G["expr"]): 69, - (70, G["term"]): 58, - (70, G["factor"]): 57, - (70, G["negable"]): 64, - (70, G["arith"]): 65, - (70, G["not-empty-expr-list"]): 71, - (76, G["comp"]): 49, - (76, G["atom"]): 42, - (76, G["function-call"]): 33, - (76, G["expr-list"]): 77, - (76, G["expr"]): 69, - (76, G["term"]): 58, - (76, G["factor"]): 57, - (76, G["negable"]): 64, - (76, G["not-empty-expr-list"]): 68, - (76, G["arith"]): 65, - (85, G["case-list"]): 95, - (89, G["function-call"]): 33, - (89, G["factor"]): 57, - (89, G["arith"]): 65, - (89, G["comp"]): 49, - (89, G["atom"]): 42, - (89, G["term"]): 58, - (89, G["expr"]): 90, - (89, G["negable"]): 64, - (91, G["case-list"]): 92, - (93, G["case-list"]): 94, - (98, G["declaration-list"]): 99, - (101, G["comp"]): 49, - (101, G["arith"]): 65, - (101, G["term"]): 58, - (101, G["factor"]): 57, - (101, G["function-call"]): 33, + (60, G["factor"]): 58, + (60, G["term"]): 59, + (60, G["arith"]): 53, + (60, G["atom"]): 42, + (67, G["comp"]): 50, + (67, G["expr"]): 66, + (67, G["function-call"]): 33, + (67, G["atom"]): 42, + (67, G["term"]): 59, + (67, G["factor"]): 58, + (67, G["arith"]): 62, + (67, G["negable-comp"]): 49, + (67, G["not-empty-expr-list"]): 68, + (73, G["not-empty-expr-list"]): 65, + (73, G["comp"]): 50, + (73, G["expr-list"]): 74, + (73, G["expr"]): 66, + (73, G["function-call"]): 33, + (73, G["atom"]): 42, + (73, G["term"]): 59, + (73, G["factor"]): 58, + (73, G["arith"]): 62, + (73, G["negable-comp"]): 49, + (82, G["case-list"]): 92, + (86, G["term"]): 59, + (86, G["atom"]): 42, + (86, G["arith"]): 62, + (86, G["comp"]): 50, + (86, G["function-call"]): 33, + (86, G["expr"]): 87, + (86, G["factor"]): 58, + (86, G["negable-comp"]): 49, + (88, G["case-list"]): 89, + (90, G["case-list"]): 91, + (95, G["declaration-list"]): 96, + (98, G["function-call"]): 33, + (98, G["comp"]): 50, + (98, G["arith"]): 62, + (98, G["atom"]): 42, + (98, G["term"]): 59, + (98, G["factor"]): 58, + (98, G["negable-comp"]): 49, + (98, G["expr"]): 99, + (101, G["arith"]): 62, + (101, G["comp"]): 50, (101, G["atom"]): 42, + (101, G["term"]): 59, + (101, G["function-call"]): 33, (101, G["expr"]): 102, - (101, G["negable"]): 64, - (104, G["atom"]): 42, - (104, G["term"]): 58, - (104, G["arith"]): 65, - (104, G["comp"]): 49, - (104, G["factor"]): 57, - (104, G["negable"]): 64, - (104, G["expr"]): 105, - (104, G["function-call"]): 33, - (108, G["comp"]): 49, - (108, G["factor"]): 57, - (108, G["expr"]): 109, - (108, G["term"]): 58, - (108, G["function-call"]): 33, - (108, G["arith"]): 65, - (108, G["atom"]): 42, - (108, G["negable"]): 64, - (110, G["factor"]): 57, - (110, G["comp"]): 49, - (110, G["arith"]): 65, - (110, G["atom"]): 42, - (110, G["term"]): 58, - (110, G["expr"]): 111, - (110, G["negable"]): 64, - (110, G["function-call"]): 33, - (118, G["function-call"]): 33, - (118, G["factor"]): 57, - (118, G["arith"]): 65, - (118, G["comp"]): 49, - (118, G["atom"]): 42, - (118, G["expr"]): 117, - (118, G["term"]): 58, - (118, G["block"]): 119, - (118, G["negable"]): 64, - (120, G["function-call"]): 33, - (120, G["factor"]): 57, - (120, G["arith"]): 65, - (120, G["comp"]): 49, - (120, G["atom"]): 42, - (120, G["expr"]): 117, - (120, G["term"]): 58, - (120, G["negable"]): 64, - (120, G["block"]): 121, - (127, G["param-list"]): 128, - (133, G["arith"]): 65, - (133, G["atom"]): 42, - (133, G["term"]): 58, - (133, G["function-call"]): 33, - (133, G["comp"]): 49, - (133, G["factor"]): 57, - (133, G["expr"]): 134, - (133, G["negable"]): 64, - (138, G["function-call"]): 33, - (138, G["factor"]): 57, - (138, G["arith"]): 65, - (138, G["comp"]): 49, - (138, G["atom"]): 42, - (138, G["term"]): 58, - (138, G["expr"]): 139, - (138, G["negable"]): 64, - (143, G["method"]): 145, - (143, G["attribute"]): 142, + (101, G["factor"]): 58, + (101, G["negable-comp"]): 49, + (105, G["expr"]): 106, + (105, G["atom"]): 42, + (105, G["arith"]): 62, + (105, G["comp"]): 50, + (105, G["term"]): 59, + (105, G["factor"]): 58, + (105, G["function-call"]): 33, + (105, G["negable-comp"]): 49, + (107, G["arith"]): 62, + (107, G["comp"]): 50, + (107, G["atom"]): 42, + (107, G["term"]): 59, + (107, G["factor"]): 58, + (107, G["function-call"]): 33, + (107, G["expr"]): 108, + (107, G["negable-comp"]): 49, + (115, G["term"]): 59, + (115, G["atom"]): 42, + (115, G["expr"]): 114, + (115, G["arith"]): 62, + (115, G["comp"]): 50, + (115, G["block"]): 116, + (115, G["function-call"]): 33, + (115, G["factor"]): 58, + (115, G["negable-comp"]): 49, + (117, G["term"]): 59, + (117, G["atom"]): 42, + (117, G["expr"]): 114, + (117, G["arith"]): 62, + (117, G["comp"]): 50, + (117, G["function-call"]): 33, + (117, G["factor"]): 58, + (117, G["negable-comp"]): 49, + (117, G["block"]): 118, + (124, G["param-list"]): 125, + (130, G["comp"]): 50, + (130, G["function-call"]): 33, + (130, G["term"]): 59, + (130, G["arith"]): 62, + (130, G["negable-comp"]): 49, + (130, G["atom"]): 42, + (130, G["factor"]): 58, + (130, G["expr"]): 131, + (135, G["term"]): 59, + (135, G["atom"]): 42, + (135, G["arith"]): 62, + (135, G["comp"]): 50, + (135, G["expr"]): 136, + (135, G["function-call"]): 33, + (135, G["factor"]): 58, + (135, G["negable-comp"]): 49, + (140, G["feature-list"]): 141, + (140, G["attribute"]): 139, + (140, G["method"]): 142, + (143, G["attribute"]): 139, + (143, G["method"]): 142, (143, G["feature-list"]): 144, - (146, G["method"]): 145, - (146, G["attribute"]): 142, - (146, G["feature-list"]): 147, - (148, G["method"]): 145, - (148, G["attribute"]): 142, - (148, G["feature-list"]): 149, - (150, G["method"]): 145, - (150, G["attribute"]): 142, - (150, G["feature-list"]): 151, - (154, G["method"]): 145, - (154, G["attribute"]): 142, - (154, G["feature-list"]): 155, - (160, G["class-list"]): 161, - (160, G["class-def"]): 159, + (145, G["attribute"]): 139, + (145, G["method"]): 142, + (145, G["feature-list"]): 146, + (147, G["feature-list"]): 148, + (147, G["attribute"]): 139, + (147, G["method"]): 142, + (151, G["feature-list"]): 152, + (151, G["attribute"]): 139, + (151, G["method"]): 142, + (157, G["class-def"]): 156, + (157, G["class-list"]): 158, } From 736ee3174119f676207aa581e14175be2e8f27c5 Mon Sep 17 00:00:00 2001 From: AlejandroKlever Date: Fri, 6 Aug 2021 23:39:32 -0400 Subject: [PATCH 121/143] - --- src/cool/code_generation/notebooks/cp12.ipynb | 1073 +++++++++++++++++ src/cool/code_generation/notebooks/cp13.ipynb | 657 ++++++++++ src/cool/code_generation/notebooks/cp14.ipynb | 543 +++++++++ src/cool/code_generation/notebooks/cp15.ipynb | 481 ++++++++ src/cool/code_generation/notebooks/cp16.ipynb | 589 +++++++++ src/cool/code_generation/notebooks/lexer.py | 162 +++ 6 files changed, 3505 insertions(+) create mode 100644 src/cool/code_generation/notebooks/cp12.ipynb create mode 100644 src/cool/code_generation/notebooks/cp13.ipynb create mode 100644 src/cool/code_generation/notebooks/cp14.ipynb create mode 100644 src/cool/code_generation/notebooks/cp15.ipynb create mode 100644 src/cool/code_generation/notebooks/cp16.ipynb create mode 100644 src/cool/code_generation/notebooks/lexer.py diff --git a/src/cool/code_generation/notebooks/cp12.ipynb b/src/cool/code_generation/notebooks/cp12.ipynb new file mode 100644 index 000000000..44bfb43ab --- /dev/null +++ b/src/cool/code_generation/notebooks/cp12.ipynb @@ -0,0 +1,1073 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Clase Práctica #12 (Compilación)\n", + "\n", + "En esta clase práctica estaremos implementando la fase de análisis semántico para la extensión del lenguaje **xCOOL** presentada en conferencia. Recordemos las reglas del lenguaje.\n", + "\n", + "### Reglas sintácticas\n", + "\n", + "El lenguaje tiene tres tipos de instrucciones: `let`, `def` y `print`:\n", + "\n", + "- `let = ` define una variable denominada `` y le asigna el valor de ``.\n", + "- `def (, , ...) -> ` define una nueva función `` con los argumentos ``.\n", + "- `print ` imprime el valor de una expresión.\n", + "\n", + "Las expresiones pueden ser de varios tipos:\n", + "\n", + "- Expresiones aritméticas.\n", + "- Invocación de funciones predefinidas (`sin`, `cos`, `pow`, ...).\n", + "- Invocación de funciones definidas en el programa.\n", + "\n", + "### Reglas semánticas\n", + "\n", + "- Una variable solo puede ser definida una vez en todo el programa.\n", + "- Los nombres de variables y funciones no comparten el mismo ámbito.\n", + "- No se pueden redefinir las funciones predefinidas.\n", + "- Una función puede tener distintas definiciones siempre que tengan distinta cantidad de argumentos.\n", + "- Toda variable y función tiene que haber sido definida antes de ser usada en una expresión (salvo las funciones pre-definidas).\n", + "- Todos los argumentos definidos en una misma función tienen que ser diferentes entre sí, aunque pueden ser iguales a variables definidas globalmente o argumentos definidos en otras funciones.\n", + "- En el cuerpo de una función, los nombres de los argumentos ocultan los nombres de variables iguales." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Jerarquía del AST\n", + "\n", + "Comencemos por definir los tipos de nodos que compondrán el AST. Recordemos que estos nodos deben ser capaces de atrapar toda la semántica del programa.\n", + "\n", + "### Nivel 0\n", + "\n", + "En un primer nivel tenemos la clase `Node` que engloba todos los tipos de nodos del AST. Este nodo, a pesar de ser la raíz de la jerarquía, no coincide con la raíz del AST. Los nodos del AST son instancias concretas de las clases definidas en esta jerarquía y siguen una estructura dependiente de la cadena que se parsea." + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [], + "source": [ + "class Node:\n", + " pass" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Nivel 1\n", + "\n", + "En un segundo nivel tenemos las clases `Program`, `Statement` y `Expression`, siendo estas dos últimas una generalización de varios tipos de instrucciones del lenguaje. `ProgramNode` coincide con la raíz del AST pues representa la base de todo programa en **xCOOL**: una lista de _statements_." + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [], + "source": [ + "class ProgramNode(Node):\n", + " def __init__(self, statements):\n", + " self.statements = statements\n", + " \n", + "class StatementNode(Node):\n", + " pass\n", + " \n", + "class ExpressionNode(Node):\n", + " pass" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Nivel 2\n", + "\n", + "Continuamos explorando a lo ancho la jerarquía del AST, y encontramos los 3 tipos de _statements_ en los que se divide un programa: `VarDeclaration` para declarar variables, `FuncDeclaration` para definir métodos, y `PrintNode` para escribir el resultado de evaluar determinada expresión. Además, se proveen dos generalizaciones de expresiones: `AtomicNode` y `BinaryNode`." + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [], + "source": [ + "class VarDeclarationNode(StatementNode):\n", + " def __init__(self, idx, expr):\n", + " self.id = idx\n", + " self.expr = expr\n", + "\n", + "class FuncDeclarationNode(StatementNode):\n", + " def __init__(self, idx, params, body):\n", + " self.id = idx\n", + " self.params = params\n", + " self.body = body\n", + "\n", + "class PrintNode(StatementNode):\n", + " def __init__(self, expr):\n", + " self.expr = expr\n", + "\n", + "class AtomicNode(ExpressionNode):\n", + " def __init__(self, lex):\n", + " self.lex = lex\n", + "\n", + "class BinaryNode(ExpressionNode):\n", + " def __init__(self, left, right):\n", + " self.left = left\n", + " self.right = right" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Nivel 3\n", + "\n", + "Finalmente alcanzamos el máximo nivel de profundidad, donde tenemos definidos `ConstantNumNode` (representa literales enteros), `VariableNode` (representa acceso a una variable) y `CallNode` (representa la invocación de un método con determinados argumentos). También encontramos las operaciones aritméticas de suma, resta, multiplicación y división." + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [], + "source": [ + "class ConstantNumNode(AtomicNode):\n", + " pass\n", + "\n", + "class VariableNode(AtomicNode):\n", + " pass\n", + "\n", + "class CallNode(AtomicNode):\n", + " def __init__(self, idx, args):\n", + " AtomicNode.__init__(self, idx)\n", + " self.args = args\n", + "\n", + "class PlusNode(BinaryNode):\n", + " @staticmethod\n", + " def operate(lvalue, rvalue):\n", + " return lvalue + rvalue\n", + "\n", + "class MinusNode(BinaryNode):\n", + " @staticmethod\n", + " def operate(lvalue, rvalue):\n", + " return lvalue - rvalue\n", + "\n", + "class StarNode(BinaryNode):\n", + " @staticmethod\n", + " def operate(lvalue, rvalue):\n", + " return lvalue\n", + "\n", + "class DivNode(BinaryNode):\n", + " @staticmethod\n", + " def operate(lvalue, rvalue):\n", + " raise NotImplementedError()\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Gramática\n", + "\n", + "Habiendo diseñado la jerarquía de nodos del AST, pasemos a implementar un mecanismo que nos permita construir automáticamente el AST. Nos apoyaremos en las gramáticas atributadas que estudiamos el año pasado para resolver este problema.\n", + "\n", + "Una gramática atributada permite asociar atributos a los símbolos de la gramática y diseñar reglas que los evaluen. Convenientemente, las reglas para construir el AST suelen ser sencillas si la gramática sigue una estructura \"natural\". Gracias a la implementación de parser LR(1) de la semana anterior, podremos trabajar con una gramática sencilla para este lenguaje, la cual respeta incluso la asociatividad entre los operadores (problema que estuvimos cargando desde el semestre anterior).\n", + "\n", + "Pasemos a construir la gramática e implementar las reglas semánticas." + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Non-Terminals:\n", + "\t, , , , , , , , , , , , \n", + "Terminals:\n", + "\tlet, def, print, ;, ,, (, ), ->, =, +, -, *, /, id, int\n", + "Productions:\n", + "\t[ -> , -> ;, -> ; , -> , -> , -> , -> let id = , -> def id ( ) -> , -> print , -> id, -> id , , -> + , -> - , -> , -> * , -> / , -> , -> , -> ( ), -> int, -> id, -> , -> id ( ), -> , -> , ]\n" + ] + } + ], + "source": [ + "from cmp.pycompiler import Grammar\n", + "\n", + "G = Grammar()\n", + "\n", + "program = G.NonTerminal('', startSymbol=True)\n", + "stat_list, stat = G.NonTerminals(' ')\n", + "let_var, def_func, print_stat, arg_list = G.NonTerminals(' ')\n", + "expr, term, factor, atom = G.NonTerminals(' ')\n", + "func_call, expr_list = G.NonTerminals(' ')\n", + "\n", + "let, defx, printx = G.Terminals('let def print')\n", + "semi, comma, opar, cpar, arrow = G.Terminals('; , ( ) ->')\n", + "equal, plus, minus, star, div = G.Terminals('= + - * /')\n", + "idx, num = G.Terminals('id int')\n", + "\n", + "program %= stat_list, lambda h,s: ProgramNode(s[1])\n", + "\n", + "stat_list %= stat + semi, lambda h,s: [s[1]]\n", + "stat_list %= stat + semi + stat_list, lambda h,s: [s[1]] + s[3] \n", + "\n", + "stat %= let_var, lambda h,s: s[1]\n", + "stat %= def_func, lambda h,s: s[1]\n", + "stat %= print_stat, lambda h,s: s[1]\n", + "\n", + "let_var %= let + idx + equal + expr, lambda h,s: VarDeclarationNode(s[2], s[4])\n", + "\n", + "def_func %= defx + idx + opar + arg_list + cpar + arrow + expr, lambda h,s: FuncDeclarationNode(s[2], s[4], s[7])\n", + "\n", + "print_stat %= printx + expr, lambda h,s: PrintNode(s[2])\n", + "\n", + "arg_list %= idx, lambda h,s: [s[1]]\n", + "arg_list %= idx + comma + arg_list, lambda h,s: [s[1]] + s[3]\n", + "\n", + "expr %= expr + plus + term, lambda h,s: PlusNode(s[1], s[3])\n", + "expr %= expr + minus + term, lambda h,s: MinusNode(s[1], s[3])\n", + "expr %= term, lambda h,s: s[1]\n", + "\n", + "term %= term + star + factor, lambda h,s: StarNode(s[1], s[3])\n", + "term %= term + div + factor, lambda h,s: DivNode(s[1], s[3])\n", + "term %= factor, lambda h,s: s[1]\n", + "\n", + "factor %= atom, lambda h,s: s[1]\n", + "factor %= opar + expr + cpar, lambda h,s: s[2]\n", + "\n", + "atom %= num, lambda h,s: ConstantNumNode(s[1])\n", + "atom %= idx, lambda h,s: VariableNode(s[1])\n", + "atom %= func_call, lambda h,s: s[1]\n", + "\n", + "func_call %= idx + opar + expr_list + cpar, lambda h,s: CallNode(s[1], s[3])\n", + "\n", + "expr_list %= expr, lambda h,s: [s[1]]\n", + "expr_list %= expr + comma + expr_list, lambda h,s: [s[1]] + s[3] \n", + "\n", + "print(G)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Parseando y evaluando\n", + "\n", + "Saltemos directamente a trabajar con un array de tokens. \n", + "```\n", + "print 1 - 1 - 1;\n", + "let x = 58;\n", + "def f ( a, b ) -> 5 + 6;\n", + "print F( 5 + x, 7 + y );\n", + "```\n", + "\n", + "El siguiente array resulta de tokenizar al cadena anterior (**ojo:** los espacios en blanco ya fueron eliminados)." + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": {}, + "outputs": [], + "source": [ + "from cmp.utils import Token\n", + "\n", + "tokens = [\n", + " Token('print', printx),\n", + " Token('1', num),\n", + " Token('-', minus),\n", + " Token('1', num),\n", + " Token('-', minus),\n", + " Token('1', num),\n", + " Token(';', semi),\n", + " Token('let', let),\n", + " Token('x', idx),\n", + " Token('=', equal),\n", + " Token('58', num),\n", + " Token(';', semi),\n", + " Token('def', defx),\n", + " Token('f', idx),\n", + " Token('(', opar),\n", + " Token('a', idx),\n", + " Token(',', comma),\n", + " Token('b', idx),\n", + " Token(')', cpar),\n", + " Token('->', arrow),\n", + " Token('5', num),\n", + " Token('+', plus),\n", + " Token('6', num),\n", + " Token(';', semi),\n", + " Token('print', printx),\n", + " Token('F', idx),\n", + " Token('(', opar),\n", + " Token('5', num),\n", + " Token('+', plus),\n", + " Token('x', idx),\n", + " Token(',', comma),\n", + " Token('7', num),\n", + " Token('+', plus),\n", + " Token('y', idx),\n", + " Token(')', cpar),\n", + " Token(';', semi),\n", + " Token('$', G.EOF),\n", + "]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Parser LR(1)\n", + "\n", + "Importemos la implementación de parser LR(1) con que trabajamos la clase anterior. Recuerde que si desea ver los estados del autómata LR(1) puede usar la opción `verbose=True` al contruir el parser." + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[ -> int,\n", + " -> ,\n", + " -> ,\n", + " -> ,\n", + " -> int,\n", + " -> ,\n", + " -> ,\n", + " -> - ,\n", + " -> int,\n", + " -> ,\n", + " -> ,\n", + " -> - ,\n", + " -> print ,\n", + " -> ,\n", + " -> int,\n", + " -> ,\n", + " -> ,\n", + " -> ,\n", + " -> let id = ,\n", + " -> ,\n", + " -> id,\n", + " -> id , ,\n", + " -> int,\n", + " -> ,\n", + " -> ,\n", + " -> ,\n", + " -> int,\n", + " -> ,\n", + " -> ,\n", + " -> + ,\n", + " -> def id ( ) -> ,\n", + " -> ,\n", + " -> int,\n", + " -> ,\n", + " -> ,\n", + " -> ,\n", + " -> id,\n", + " -> ,\n", + " -> ,\n", + " -> + ,\n", + " -> int,\n", + " -> ,\n", + " -> ,\n", + " -> ,\n", + " -> id,\n", + " -> ,\n", + " -> ,\n", + " -> + ,\n", + " -> ,\n", + " -> , ,\n", + " -> id ( ),\n", + " -> ,\n", + " -> ,\n", + " -> ,\n", + " -> ,\n", + " -> print ,\n", + " -> ,\n", + " -> ;,\n", + " -> ; ,\n", + " -> ; ,\n", + " -> ; ,\n", + " -> ]" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from cmp.tools.parsing import LR1Parser\n", + "\n", + "parser = LR1Parser(G)\n", + "parse, operations = parser([t.token_type for t in tokens], get_shift_reduce=True)\n", + "parse" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Con el objetivo de evaluar los atributos de forma independiente al parseo, se provee la opción `get_shift_reduce=True` al parsear una cadena. Esto indicará al parser, que además del parse derecho (en reverso) nos interesa recuperar la secuencia de operaciones `shift` y `reduce` que aplicó el parser." + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['SHIFT', 'SHIFT', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'SHIFT', 'SHIFT', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'SHIFT', 'SHIFT', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'SHIFT', 'SHIFT', 'SHIFT', 'SHIFT', 'SHIFT', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'SHIFT', 'SHIFT', 'SHIFT', 'SHIFT', 'SHIFT', 'SHIFT', 'SHIFT', 'REDUCE', 'REDUCE', 'SHIFT', 'SHIFT', 'SHIFT', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'SHIFT', 'SHIFT', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'SHIFT', 'SHIFT', 'SHIFT', 'SHIFT', 'SHIFT', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'SHIFT', 'SHIFT', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'SHIFT', 'SHIFT', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'SHIFT', 'SHIFT', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'SHIFT', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'SHIFT', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE']\n" + ] + } + ], + "source": [ + "print(operations)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Evaluación\n", + "\n", + "El método `evaluate_reverse_parse` provisto en `cmp.evaluation` nos permitirá evaluar las reglas semánticas de la gramática atributada y obtener la raíz del AST." + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "<__main__.ProgramNode at 0x7fe668811fd0>" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from cmp.evaluation import evaluate_reverse_parse\n", + "\n", + "ast = evaluate_reverse_parse(parse, operations, tokens)\n", + "ast" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Patrón Visitor\n", + "\n", + "En conferencia discutimos el patrón visitor como una alternativa para implementar recorridos sobre el AST. En lugar de tener funciones declaradas explícitamente en la definición de los nodos (para imprimir el AST, chequear su semántica, evaluarlo, etc.), tendríamos un tipo encargado de hacer cada unos de los recorridos. Esto resulta de gran utilizadad en la confección del compilador, pues permite a partir de fases incrementales ir recopilando información de la semántica del programa, y posteriormente, ir transformándolo a lenguajes cada vez más cercanos al lenguaje destino.\n", + "\n", + "Por ejemplo, a continuación se presenta una implementación de la clase `FormatVisitor`, se que encarga de recorrer el AST y construir una representación como `string` del mismo. Nos apoyamos en el decorador `visitor` provisto en `cmp.visitor`. La decoración `@visitor.on()` indica sobre qué parámetro del método `visit` se hará el recorrido. La decoración `@visitor.when()` indica cuál implementación del método `visit` invocar, según del tipo dinámico del parámetro indicado en `@visitor.on(...)`." + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": {}, + "outputs": [], + "source": [ + "import cmp.visitor as visitor\n", + "\n", + "class FormatVisitor(object):\n", + " @visitor.on('node')\n", + " def visit(self, node, tabs):\n", + " pass\n", + " \n", + " @visitor.when(ProgramNode)\n", + " def visit(self, node, tabs=0):\n", + " ans = '\\t' * tabs + f'\\\\__ProgramNode [; ... ;]'\n", + " statements = '\\n'.join(self.visit(child, tabs + 1) for child in node.statements)\n", + " return f'{ans}\\n{statements}'\n", + " \n", + " @visitor.when(PrintNode)\n", + " def visit(self, node, tabs=0):\n", + " ans = '\\t' * tabs + f'\\\\__PrintNode '\n", + " expr = self.visit(node.expr, tabs + 1)\n", + " return f'{ans}\\n{expr}'\n", + " \n", + " @visitor.when(VarDeclarationNode)\n", + " def visit(self, node, tabs=0):\n", + " ans = '\\t' * tabs + f'\\\\__VarDeclarationNode: let {node.id} = '\n", + " expr = self.visit(node.expr, tabs + 1)\n", + " return f'{ans}\\n{expr}'\n", + " \n", + " @visitor.when(FuncDeclarationNode)\n", + " def visit(self, node, tabs=0):\n", + " params = ', '.join(node.params)\n", + " ans = '\\t' * tabs + f'\\\\__FuncDeclarationNode: def {node.id}({params}) -> '\n", + " body = self.visit(node.body, tabs + 1)\n", + " return f'{ans}\\n{body}'\n", + "\n", + " @visitor.when(BinaryNode)\n", + " def visit(self, node, tabs=0):\n", + " ans = '\\t' * tabs + f'\\\\__ {node.__class__.__name__} '\n", + " left = self.visit(node.left, tabs + 1)\n", + " right = self.visit(node.right, tabs + 1)\n", + " return f'{ans}\\n{left}\\n{right}'\n", + "\n", + " @visitor.when(AtomicNode)\n", + " def visit(self, node, tabs=0):\n", + " return '\\t' * tabs + f'\\\\__ {node.__class__.__name__}: {node.lex}'\n", + " \n", + " @visitor.when(CallNode)\n", + " def visit(self, node, tabs=0):\n", + " ans = '\\t' * tabs + f'\\\\__CallNode: {node.lex}(, ..., )'\n", + " args = '\\n'.join(self.visit(arg, tabs + 1) for arg in node.args)\n", + " return f'{ans}\\n{args}'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Construir una instancia de `FormatVisitor` y visitar la raíz del AST tiene el efecto siguiente." + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\\__ProgramNode [; ... ;]\n", + "\t\\__PrintNode \n", + "\t\t\\__ MinusNode \n", + "\t\t\t\\__ MinusNode \n", + "\t\t\t\t\\__ ConstantNumNode: 1\n", + "\t\t\t\t\\__ ConstantNumNode: 1\n", + "\t\t\t\\__ ConstantNumNode: 1\n", + "\t\\__VarDeclarationNode: let x = \n", + "\t\t\\__ ConstantNumNode: 58\n", + "\t\\__FuncDeclarationNode: def f(a, b) -> \n", + "\t\t\\__ PlusNode \n", + "\t\t\t\\__ ConstantNumNode: 5\n", + "\t\t\t\\__ ConstantNumNode: 6\n", + "\t\\__PrintNode \n", + "\t\t\\__CallNode: F(, ..., )\n", + "\t\t\t\\__ PlusNode \n", + "\t\t\t\t\\__ ConstantNumNode: 5\n", + "\t\t\t\t\\__ VariableNode: x\n", + "\t\t\t\\__ PlusNode \n", + "\t\t\t\t\\__ ConstantNumNode: 7\n", + "\t\t\t\t\\__ VariableNode: y\n" + ] + } + ], + "source": [ + "formatter = FormatVisitor()\n", + "print(formatter.visit(ast))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Contexto\n", + "\n", + "Para chequear la semántica del lenguaje en cuestión, resulta necesario registrar qué variables han sido declaradas y qué métodos han sido definidos. Utilizaremos las siguientes clases como contenedores de la información \"relevante\" por ahora de las variables y métodos definidos. De las variables nos interesa su nombre y de las funciones su nombre y el de sus parámetros." + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": {}, + "outputs": [], + "source": [ + "class VariableInfo:\n", + " def __init__(self, name):\n", + " self.name = name\n", + "\n", + "class FunctionInfo:\n", + " def __init__(self, name, params):\n", + " self.name = name\n", + " self.params = params" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Dado que la visibilidad de las variables depende del contexto, será necesario incluir un mecanismo para ocultar (1) variables definidas en ámbitos más profundos al actual, o (2) en ámbitos más hacia adelante que el actual. Para resolver lo primero, haremos que nuestra clase contexto, o ámbito, tenga una estructura jerárquica: cada nodo tiene un padre y potencialmente múltiples hijos. Para resolver lo segundo, será necesario marcar un índice al crear scopes hijos, el cual indique hasta qué sección del ambito padre deberían poder buscar (por ejemplo, no se deberían poder ver variables definidas en el padre más adelantes del momento en que se creó el scope hijo).\n", + "\n", + "Teniendo en cuenta estas restricciones, la búsqueda de un registro en el scope debería ocurrir como una búsqueda local en el scope en cuestión, pero continuada hacia el scope padre (y así consecutivamente) si no se encontró definición local." + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": {}, + "outputs": [], + "source": [ + "import itertools as itl\n", + "\n", + "class Scope:\n", + " def __init__(self, parent=None):\n", + " self.local_vars = []\n", + " self.local_funcs = []\n", + " self.parent = parent\n", + " self.children = []\n", + " self.var_index_at_parent = 0 if parent is None else len(parent.local_vars)\n", + " self.func_index_at_parent = 0 if parent is None else len(parent.local_funcs)\n", + " \n", + " def create_child_scope(self):\n", + " child_scope = Scope(self)\n", + " self.children.append(child_scope)\n", + " return child_scope\n", + "\n", + " def define_variable(self, vname):\n", + " if self.is_var_defined(vname):\n", + " return False\n", + " else:\n", + " self.local_vars.append(VariableInfo(vname))\n", + " return True\n", + " \n", + " def define_function(self, fname, params):\n", + " if self.is_func_defined(fname, len(params)):\n", + " return False\n", + " else:\n", + " self.local_funcs.append(FunctionInfo(fname, params))\n", + " return True\n", + "\n", + " def is_var_defined(self, vname):\n", + " return self.is_local_var(vname) or (self.parent is not None and self.parent.is_var_defined(vname))\n", + " \n", + " def is_func_defined(self, fname, n):\n", + " return self.is_local_func(fname, n) or (self.parent is not None and self.parent.is_func_defined(fname, n))\n", + "\n", + " def is_local_var(self, vname):\n", + " return self.get_local_variable_info(vname) is not None\n", + " \n", + " def is_local_func(self, fname, n):\n", + " return self.get_local_function_info(fname, n) is not None\n", + "\n", + " def get_local_variable_info(self, vname):\n", + " try:\n", + " return next(filter(lambda x: x.name == vname, self.local_vars))\n", + " except StopIteration:\n", + " return\n", + " \n", + " def get_local_function_info(self, fname, n):\n", + " try:\n", + " return next(filter(lambda x: x.name == fname and len(x.params) == n, self.local_funcs))\n", + " except StopIteration:\n", + " return\n", + " \n", + " \n", + "scope = Scope()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Chequeo semántico\n", + "\n", + "Finalmente, implementemos un visitor para chequear las reglas semánticas del lenguaje discutidas a inicios de la clase práctica." + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": {}, + "outputs": [], + "source": [ + "class SemanticCheckerVisitor(object):\n", + " def __init__(self):\n", + " self.errors = []\n", + " \n", + " @visitor.on('node')\n", + " def visit(self, node, scope):\n", + " pass\n", + " \n", + " @visitor.when(ProgramNode)\n", + " def visit(self, node, scope=None):\n", + " scope = Scope()\n", + " for statement in node.statements:\n", + " self.visit(statement, scope)\n", + " return self.errors\n", + " \n", + " @visitor.when(VarDeclarationNode)\n", + " def visit(self, node, scope):\n", + " if scope.define_variable(node.id):\n", + " self.visit(node.expr, scope)\n", + " else:\n", + " self.errors.append(f'Varible {node.id} declared before')\n", + " \n", + " @visitor.when(FuncDeclarationNode)\n", + " def visit(self, node, scope):\n", + " if scope.define_function(node.id, node.params):\n", + " child_scope = scope.create_child_scope()\n", + "\n", + " for param in node.params:\n", + " child_scope.define_variable(param)\n", + "\n", + " self.visit(node.body, child_scope)\n", + " else:\n", + " self.errors.append(f'Varible {node.id} declared before')\n", + " \n", + " @visitor.when(PrintNode)\n", + " def visit(self, node, scope):\n", + " self.visit(node.expr, scope)\n", + " \n", + " @visitor.when(ConstantNumNode)\n", + " def visit(self, node, scope):\n", + " return\n", + " \n", + " @visitor.when(VariableNode)\n", + " def visit(self, node, scope):\n", + " if not scope.is_var_defined(node.lex):\n", + " self.errors.append(f'Invalid variable: {node.lex}')\n", + " \n", + " @visitor.when(CallNode)\n", + " def visit(self, node, scope):\n", + " if not scope.is_func_defined(node.lex, len(node.args)):\n", + " self.errors.append(f'Function {node.lex} is not defined with {len(node.args)} arguments.')\n", + " \n", + " for arg in node.args:\n", + " self.visit(arg, scope)\n", + " \n", + " @visitor.when(BinaryNode)\n", + " def visit(self, node, scope):\n", + " self.visit(node.left, scope)\n", + " self.visit(node.right, scope)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Chequeo\n", + "\n", + "Deberían detectarse como mínimo 2 errores:\n", + "\n", + "0. Function F is not defined with 2 arguments.\n", + "1. Invalid variable: y." + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1. Function F is not defined with 2 arguments.\n", + "2. Invalid variable: y\n" + ] + } + ], + "source": [ + "semantic_checker = SemanticCheckerVisitor()\n", + "errors = semantic_checker.visit(ast)\n", + "for i, error in enumerate(errors, 1):\n", + " print(f'{i}.', error)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Propuestas\n", + "\n", + "- Incluya línea y columna en los errores detectados.\n", + "- Incluya el lexer.\n", + "- Construya una clase que siga el patrón visitor para evaluar / ejecutar el programa." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Incluyendo el lexer" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": {}, + "outputs": [], + "source": [ + "from lexer import Lexer" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": {}, + "outputs": [], + "source": [ + "digits1_9 = '|'.join([str(i) for i in range(1, 10)])\n", + "digits0_9 = '0|' + digits1_9\n", + "chars = '|'.join([chr(i) for i in range(97, 123)] + [chr(i) for i in range(65, 91)])\n", + "\n", + "lexer = Lexer([\n", + " (num, f'({digits1_9})({digits0_9})*'),\n", + " (plus, '\\+'),\n", + " (minus, '-'),\n", + " (star, '\\*'),\n", + " (div, '/'),\n", + " (semi, ';'),\n", + " (comma, ','),\n", + " (opar, '\\('),\n", + " (cpar, '\\)'),\n", + " (equal, '='),\n", + " (arrow, '->'),\n", + " (printx, 'print'),\n", + " (let, 'let'),\n", + " (defx, 'def'),\n", + " ('space', ' *'),\n", + " ('newline', '\\n\\n*'),\n", + " (idx, f'({chars})({chars}|{digits0_9})*'),\n", + "], G.EOF)" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": {}, + "outputs": [], + "source": [ + "program = '''\n", + "print 1 - 1; \n", + "let x = 58; \n", + "def sum(a, b) -> a + b; \n", + "print sum(5 + x, 7 + x);\n", + "'''\n", + "\n", + "tokens = lexer(program)\n", + "tokens = [t for t in tokens if t.token_type not in ('space', 'newline')]" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\\__ProgramNode [; ... ;]\n", + "\t\\__PrintNode \n", + "\t\t\\__ MinusNode \n", + "\t\t\t\\__ ConstantNumNode: 1\n", + "\t\t\t\\__ ConstantNumNode: 1\n", + "\t\\__VarDeclarationNode: let x = \n", + "\t\t\\__ ConstantNumNode: 58\n", + "\t\\__FuncDeclarationNode: def sum(a, b) -> \n", + "\t\t\\__ PlusNode \n", + "\t\t\t\\__ VariableNode: a\n", + "\t\t\t\\__ VariableNode: b\n", + "\t\\__PrintNode \n", + "\t\t\\__CallNode: sum(, ..., )\n", + "\t\t\t\\__ PlusNode \n", + "\t\t\t\t\\__ ConstantNumNode: 5\n", + "\t\t\t\t\\__ VariableNode: x\n", + "\t\t\t\\__ PlusNode \n", + "\t\t\t\t\\__ ConstantNumNode: 7\n", + "\t\t\t\t\\__ VariableNode: x\n" + ] + } + ], + "source": [ + "parser = LR1Parser(G)\n", + "parse, operations = parser([t.token_type for t in tokens], get_shift_reduce=True)\n", + "ast = evaluate_reverse_parse(parse, operations, tokens)\n", + "print(formatter.visit(ast))" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 42, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "semantic_checker = SemanticCheckerVisitor()\n", + "errors = semantic_checker.visit(ast)\n", + "not errors" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Clase que sigue el patrón visitor para evaluar / ejecutar el programa." + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "metadata": {}, + "outputs": [], + "source": [ + "class ExecVisitor(object):\n", + " def __init__(self):\n", + " self.errors = []\n", + " \n", + " @visitor.on('node')\n", + " def visit(self, node, scope):\n", + " pass\n", + " \n", + " @visitor.when(ProgramNode)\n", + " def visit(self, node, scope=None):\n", + " scope = Scope()\n", + " for stat in node.statements:\n", + " self.visit(stat, scope)\n", + "\n", + " @visitor.when(VarDeclarationNode)\n", + " def visit(self, node, scope):\n", + " value = self.visit(node.expr, scope)\n", + " scope.define_variable(node.id)\n", + " var_info = scope.get_local_variable_info(node.id)\n", + " var_info.value = value\n", + " \n", + " @visitor.when(FuncDeclarationNode)\n", + " def visit(self, node, scope):\n", + " scope.define_function(node.id, node.params)\n", + " func_info = scope.get_local_function_info(node.id, len(node.params))\n", + " func_info.body = node.body \n", + " \n", + " @visitor.when(PrintNode)\n", + " def visit(self, node, scope):\n", + " print(self.visit(node.expr, scope))\n", + " \n", + " @visitor.when(ConstantNumNode)\n", + " def visit(self, node, scope):\n", + " return float(node.lex)\n", + " \n", + " @visitor.when(VariableNode)\n", + " def visit(self, node, scope):\n", + " current_scope = scope\n", + " \n", + " info = None\n", + " while info is None:\n", + " info = current_scope.get_local_variable_info(node.lex)\n", + " current_scope = current_scope.parent\n", + " \n", + " return info.value\n", + " \n", + " @visitor.when(CallNode)\n", + " def visit(self, node, scope):\n", + " current_scope = scope\n", + " \n", + " info = None\n", + " while info is None:\n", + " info = current_scope.get_local_function_info(node.lex, len(node.args))\n", + " current_scope = current_scope.parent\n", + " \n", + " child_scope = scope.create_child_scope()\n", + " \n", + " for name, param in zip(info.params, node.args):\n", + " value = self.visit(param, scope)\n", + " child_scope.define_variable(name)\n", + " child_scope.get_local_variable_info(name).value = value\n", + " \n", + " return self.visit(info.body, child_scope)\n", + " \n", + "\n", + " @visitor.when(PlusNode)\n", + " def visit(self, node, scope):\n", + " return self.visit(node.left, scope) + self.visit(node.right, scope)\n", + " \n", + " @visitor.when(MinusNode)\n", + " def visit(self, node, scope):\n", + " return self.visit(node.left, scope) - self.visit(node.right, scope)\n", + " \n", + " @visitor.when(StarNode)\n", + " def visit(self, node, scope):\n", + " return self.visit(node.left, scope) * self.visit(node.right, scope)\n", + " \n", + " @visitor.when(DivNode)\n", + " def visit(self, node, scope):\n", + " return self.visit(node.left, scope) / self.visit(node.right, scope)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Corriendo el programa" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.0\n", + "128.0\n" + ] + } + ], + "source": [ + "executor = ExecVisitor()\n", + "executor.visit(ast)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3.7.3 64-bit ('datascience': virtualenv)", + "language": "python", + "name": "python37364bitdatasciencevirtualenv8396341ab8114ad8a44706706d0af3a3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.3" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/src/cool/code_generation/notebooks/cp13.ipynb b/src/cool/code_generation/notebooks/cp13.ipynb new file mode 100644 index 000000000..1259ae155 --- /dev/null +++ b/src/cool/code_generation/notebooks/cp13.ipynb @@ -0,0 +1,657 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Clase Práctica #13 (Compilación)\n", + "\n", + "En esta clase práctica estaremos extendiendo el lenguaje con el que trabajamos en la clase anterior. La principal adición al lenguaje es dar la posibilidad de definir tipos. Esto conlleva nuevos retos durante el chequeo semántico, pues es necesario chequear el uso consistente de los tipos. Varios factores deben ser considerados durante el chequeo, entre los que destacan la herencia y polimorfismo.\n", + "\n", + "Las principales reglas del lenguaje se describen a continuación.\n", + "\n", + "* Un programa consiste en una lista de definiciones de clases.\n", + "* Todas las clases se definen en el mismo espacio de nombres global.\n", + "* Cada clase tiene atributos y métodos.\n", + "* Los atributos tienen un tipo asociado.\n", + "* Los métodos tienen un tipo de retorno (que puede ser `void`), y una lista de argumentos.\n", + "* Todos los métodos son de instancia y dentro de ellos es visible `self` _(solo lectura)_, cuyo tipo estático coincide con el de la clase que implementa el método.\n", + "* Todos los atributos son privados y todos los métodos son públicos.\n", + "* Existe herencia simple.\n", + "* Un método se puede sobrescribir sí y solo sí se mantiene exactamente la misma definición para los tipos de retorno y de los argumentos.\n", + "* No existen sobrecargas de métodos ni de operadores.\n", + "\n", + "La definición de las clases sigue el formato: `class { ... }`. En la definición, los atributos y los métodos se pueden intercalar. En caso de herencia, la sintaxis cambia a: `class : { ... }`.\n", + "\n", + "La definición de atributos tiene la siguiente sintaxis: `: ;`. Note que no se incluye expresión de inicialización, sino que el atributo toma el valor por defecto del tipo ``.\n", + "\n", + "La definición de métodos cambia a: `def (:, ..., :) : { ... }`. El cuerpo del método es una lista de expresiones terminadas por `;`, y el valor de retorno coincide con el de la última expresión (en caso de que el método sea `void` simplemente no se devuelve nada).\n", + "\n", + "Se adiciona la expresión `new ()` que crea una nueva instancia del tipo ``. Note que no se pueden pasar parámetros.\n", + "\n", + "En esta extensión, la instrucción `print` se elimina, y la instrucción `let` pasa a ser una expresión. La expresión `let` tiene la sintaxis: `let : = ` y evalúa al valor de la expresión (y con el tipo estático de la expresión). La variable `` no puede estar previamente definida en ese ámbito. Se puede omitir la declaración del tipo y en tal caso la variable `` ya debe estar definida y se realiza la asignación. La expresión `let` es la expresión de menor precedencia.\n", + "\n", + "El resto de las expresiones del lenguaje se mantiene sin cambios.\n", + "\n", + "> Recordemos que, por simplicar, tanto la declaración de funciones como el llamado a funciones reciben al menos un parámetro/argumento." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Jerarquía del AST\n", + "\n", + "Comencemos por definir los tipos de nodos que compondrán el AST. Recordemos que estos nodos deben ser capaces de atrapar toda la semántica del programa.\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [], + "source": [ + "class Node:\n", + " pass" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + " " + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [], + "source": [ + "class ProgramNode(Node):\n", + " def __init__(self, declarations):\n", + " self.declarations = declarations\n", + "\n", + "class DeclarationNode(Node):\n", + " pass\n", + "class ExpressionNode(Node):\n", + " pass" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + " " + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [], + "source": [ + "class ClassDeclarationNode(DeclarationNode):\n", + " def __init__(self, idx, features, parent=None):\n", + " self.id = idx\n", + " self.parent = parent\n", + " self.features = features\n", + "\n", + "class FuncDeclarationNode(DeclarationNode):\n", + " def __init__(self, idx, params, return_type, body):\n", + " self.id = idx\n", + " self.params = params\n", + " self.type = return_type\n", + " self.body = body\n", + "\n", + "class AttrDeclarationNode(DeclarationNode):\n", + " def __init__(self, idx, typex):\n", + " self.id = idx\n", + " self.type = typex" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + " " + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [], + "source": [ + "class VarDeclarationNode(ExpressionNode):\n", + " def __init__(self, idx, typex, expr):\n", + " self.id = idx\n", + " self.type = typex\n", + " self.expr = expr\n", + "\n", + "class AssignNode(ExpressionNode):\n", + " def __init__(self, idx, expr):\n", + " self.id = idx\n", + " self.expr = expr\n", + "\n", + "class CallNode(ExpressionNode):\n", + " def __init__(self, obj, idx, args):\n", + " self.obj = obj\n", + " self.id = idx\n", + " self.args = args" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + " " + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [], + "source": [ + "class AtomicNode(ExpressionNode):\n", + " def __init__(self, lex):\n", + " self.lex = lex\n", + "\n", + "class BinaryNode(ExpressionNode):\n", + " def __init__(self, left, right):\n", + " self.left = left\n", + " self.right = right" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + " " + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": {}, + "outputs": [], + "source": [ + "class ConstantNumNode(AtomicNode):\n", + " pass\n", + "class VariableNode(AtomicNode):\n", + " pass\n", + "class InstantiateNode(AtomicNode):\n", + " pass\n", + "class PlusNode(BinaryNode):\n", + " pass\n", + "class MinusNode(BinaryNode):\n", + " pass\n", + "class StarNode(BinaryNode):\n", + " pass\n", + "class DivNode(BinaryNode):\n", + " pass" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Gramática\n", + "\n", + "Modifiquemos la gramática de la clase anterior para incluir la nueva sintaxis del lenguaje. Procedamos en 2 pasos:\n", + "1. Construyamos las producciones de forma que se garanticen las reglas sintácticas.\n", + "2. Atributemos la gramática para construir el AST.\n", + "\n", + "> Recordemos que la gramática debe ser parseable. Actualmente el parser más poderoso que tenemos es el LR(1) así que usaremos ese. Consecuentemente, los atributos de la gramática solo deben computar atributos sintetizados." + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": "Non-Terminals:\n\t, , , , , , , , , , , , , , , \nTerminals:\n\tclass, let, def, print, ;, :, ,, ., (, ), {, }, =, +, -, *, /, id, int, new\nProductions:\n\t[ -> , -> , -> , -> class id { }, -> class id : id { }, -> e, -> , -> , -> id : id ;, -> def id ( ) : id { }, -> , -> , , -> id : id, -> ;, -> ; , -> let id : id = , -> let id = , -> , -> + , -> - , -> , -> * , -> / , -> , -> ( ), -> , -> , -> int, -> id, -> new id ( ), -> . id ( ), -> , -> , ]\n" + } + ], + "source": [ + "from cmp.pycompiler import Grammar\n", + "\n", + "# grammar\n", + "G = Grammar()\n", + "\n", + "\n", + "# non-terminals\n", + "program = G.NonTerminal('', startSymbol=True)\n", + "class_list, def_class = G.NonTerminals(' ')\n", + "feature_list, def_attr, def_func = G.NonTerminals(' ')\n", + "param_list, param, expr_list = G.NonTerminals(' ')\n", + "expr, arith, term, factor, atom = G.NonTerminals(' ')\n", + "func_call, arg_list = G.NonTerminals(' ')\n", + "\n", + "\n", + "# terminals\n", + "classx, let, defx, printx = G.Terminals('class let def print')\n", + "semi, colon, comma, dot, opar, cpar, ocur, ccur = G.Terminals('; : , . ( ) { }')\n", + "equal, plus, minus, star, div = G.Terminals('= + - * /')\n", + "idx, num, new = G.Terminals('id int new')\n", + "\n", + "\n", + "# productions\n", + "program %= class_list, lambda h,s: ProgramNode(s[1])\n", + "\n", + "# \n", + "class_list %= def_class, lambda h,s: [s[1]]\n", + "class_list %= def_class + class_list, lambda h,s: [s[1]] + s[2]\n", + "\n", + "# \n", + "def_class %= classx + idx + ocur + feature_list + ccur, lambda h,s: ClassDeclarationNode(s[2], s[4])\n", + "def_class %= classx + idx + colon + idx + ocur + feature_list + ccur, lambda h,s: ClassDeclarationNode(s[2], s[6], s[4])\n", + "\n", + "# \n", + "feature_list %= G.Epsilon, lambda h,s: []\n", + "feature_list %= def_attr + feature_list, lambda h,s: [s[1]] + s[2]\n", + "feature_list %= def_func + feature_list, lambda h,s: [s[1]] + s[2]\n", + "\n", + "# \n", + "def_attr %= idx + colon + idx + semi, lambda h,s: AttrDeclarationNode(s[1], s[3])\n", + "\n", + "# \n", + "def_func %= defx + idx + opar + param_list + cpar + colon + idx + ocur + expr_list + ccur, \\\n", + " lambda h,s: FuncDeclarationNode(s[2], s[4], s[7], s[9]) \n", + "\n", + "param_list %= param, lambda h,s: [ s[1] ]\n", + "param_list %= param + comma + param_list, lambda h,s: [ s[1] ] + s[3]\n", + "\n", + "# \n", + "param %= idx + colon + idx, lambda h,s: (s[1], s[3])\n", + "\n", + "# \n", + "expr_list %= expr + semi, lambda h,s: [s[1]]\n", + "expr_list %= expr + semi + expr_list, lambda h,s: [s[1]] + s[3]\n", + "\n", + "# \n", + "expr %= let + idx + colon + idx + equal + expr, lambda h,s: VarDeclarationNode(s[2], s[4], s[6])\n", + "expr %= let + idx + equal + expr, lambda h,s: AssignNode(s[2], s[4])\n", + "expr %= arith, lambda h,s: s[1]\n", + "\n", + "# \n", + "arith %= arith + plus + term, lambda h,s: PlusNode(s[1], s[3])\n", + "arith %= arith + minus + term, lambda h,s: MinusNode(s[1], s[3])\n", + "arith %= term, lambda h,s: s[1]\n", + "\n", + "# \n", + "term %= term + star + factor, lambda h,s: StarNode(s[1], s[3])\n", + "term %= term + div + factor, lambda h,s: DivNode(s[1], s[3])\n", + "term %= factor, lambda h,s: s[1]\n", + "\n", + "# \n", + "factor %= opar + expr + cpar, lambda h,s: s[2]\n", + "factor %= func_call, lambda h,s: s[1]\n", + "factor %= atom, lambda h,s: s[1]\n", + "\n", + "# \n", + "atom %= num, lambda h,s: ConstantNumNode(s[1])\n", + "atom %= idx, lambda h,s: VariableNode(s[1])\n", + "atom %= new + idx + opar + cpar, lambda h,s: InstantiateNode(s[2])\n", + "\n", + "# \n", + "func_call %= factor + dot + idx + opar + arg_list + cpar, lambda h,s: CallNode(s[1], s[3], s[5])\n", + "\n", + "arg_list %= expr, lambda h,s: [ s[1] ]\n", + "arg_list %= expr + comma + arg_list, lambda h,s: [ s[1] ] + s[3]\n", + "\n", + "if __name__ == '__main__': \n", + " print(G)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Probando la gramática\n", + "\n", + "Trabajaremos con el siguiente código de ejemplo:\n", + "\n", + "```csharp\n", + "class A {\n", + " a : int ;\n", + " def suma ( a : int , b : int ) : int {\n", + " a + b ;\n", + " }\n", + " b : int ;\n", + "}\n", + "\n", + "class B : A {\n", + " c : A ;\n", + " def f ( d : int , a : A ) : void {\n", + " let f : int = 8 ;\n", + " let c = new A ( ) . suma ( 5 , f ) ;\n", + " c ;\n", + " }\n", + "}\n", + "```\n", + "\n", + "Note que todos los tokens están separados por espacios. Esto nos permitirá usar un tokenizer muy simple." + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [], + "source": [ + "text = '''\n", + "class A {\n", + " a : int ;\n", + " def suma ( a : int , b : int ) : int {\n", + " a + b ;\n", + " }\n", + " b : int ;\n", + "}\n", + "\n", + "class B : A {\n", + " c : A ;\n", + " def f ( d : int , a : A ) : void {\n", + " let f : int = 8 ;\n", + " let c = new A ( ) . suma ( 5 , f ) ;\n", + " c ;\n", + " }\n", + "}\n", + "'''" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Tokenizando\n", + "\n", + "Utilizaremos la implementación de tokenizer provista en `cmp.utils`. Esta implementación asume que los lexemas se encuentran separados por `whitespaces`. Luego, forma los tokens a partir de seleccionar desde `fixed_tokens` los tokens con lexema fijo, y obtiene los tokens de lexema variable a partir la implementación del método `tokenize_text` a decorar." + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": "class id {\n id : id ;\n def id ( id : id , id : id ) : id {\n id + id ;\n }\n id : id ;\n}\nclass id : id {\n id : id ;\n def id ( id : id , id : id ) : id {\n let id : id = int ;\n let id = new id ( ) . id ( int , id ) ;\n id ;\n }\n}\n$\n" + } + ], + "source": [ + "from cmp.utils import Token, tokenizer\n", + "\n", + "fixed_tokens = { t.Name: Token(t.Name, t) for t in G.terminals if t not in { idx, num }}\n", + "\n", + "feature_list %= G.Epsilon, lambda h,s: []\n", + "@tokenizer(G, fixed_tokens)\n", + "def tokenize_text(token):\n", + " lex = token.lex\n", + " try:\n", + " float(lex)\n", + " return token.transform_to(num)\n", + " except ValueError:\n", + " return token.transform_to(idx)\n", + "\n", + "if __name__ == '__main__': \n", + " tokens = tokenize_text(text)\n", + "\n", + "def pprint_tokens(tokens):\n", + " indent = 0\n", + " pending = []\n", + " for token in tokens:\n", + " pending.append(token)\n", + " if token.token_type in { ocur, ccur, semi }:\n", + " if token.token_type == ccur:\n", + " indent -= 1\n", + " print(' '*indent + ' '.join(str(t.token_type) for t in pending))\n", + " pending.clear()\n", + " if token.token_type == ocur:\n", + " indent += 1\n", + " print(' '.join([str(t.token_type) for t in pending]))\n", + "\n", + "if __name__ == '__main__': \n", + " pprint_tokens(tokens)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Parseando\n", + "\n", + "Comprobemos que la gramática quedó LR(1). De ser así no deberían haber conflictos shift-reduce ni reduce-reduce al construir el parser." + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [], + "source": [ + "from cmp.tools.parsing import LR1Parser\n", + "\n", + "if __name__ == '__main__': \n", + " parser = LR1Parser(G)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Además, la gramática debe haber atrapado la sintaxis del lenguaje. De ser así, el programa anterior debería poder parsearse sin problema. Comprobémoslo." + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": " -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> id\n -> \n -> \n -> \n -> id\n -> \n -> \n -> + \n -> \n -> ;\n -> def id ( ) : id { }\n -> id : id ;\n -> e\n -> \n -> \n -> \n -> class id { }\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> int\n -> \n -> \n -> \n -> \n -> let id : id = \n -> new id ( )\n -> \n -> int\n -> \n -> \n -> \n -> \n -> id\n -> \n -> \n -> \n -> \n -> \n -> , \n -> . id ( )\n -> \n -> \n -> \n -> \n -> let id = \n -> id\n -> \n -> \n -> \n -> \n -> ;\n -> ; \n -> ; \n -> def id ( ) : id { }\n -> e\n -> \n -> \n -> class id : id { }\n -> \n -> \n -> \n" + } + ], + "source": [ + "if __name__ == '__main__':\n", + " parse, operations = parser([t.token_type for t in tokens], get_shift_reduce=True)\n", + " print('\\n'.join(repr(x) for x in parse))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Construcción del AST\n", + "\n", + "Llegados a este punto solo queda evaluar las reglas para obtener el AST. Si las reglas fueron correctamente implementadas, no deberíamos tener problemas con lo siguiente." + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": "<__main__.ProgramNode object at 0x7f1f4c34e470>\n" + } + ], + "source": [ + "from cmp.evaluation import evaluate_reverse_parse\n", + "\n", + "if __name__ == '__main__':\n", + " ast = evaluate_reverse_parse(parse, operations, tokens)\n", + " print(ast)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Visitor para visualizar\n", + "\n", + "Construyamos un `visitor` para visualizar el AST." + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": {}, + "outputs": [], + "source": [ + "import cmp.visitor as visitor\n", + "\n", + "class FormatVisitor(object):\n", + " @visitor.on('node')\n", + " def visit(self, node, tabs):\n", + " pass\n", + " \n", + " @visitor.when(ProgramNode)\n", + " def visit(self, node, tabs=0):\n", + " ans = '\\t' * tabs + f'\\\\__ProgramNode [ ... ]'\n", + " statements = '\\n'.join(self.visit(child, tabs + 1) for child in node.declarations)\n", + " return f'{ans}\\n{statements}'\n", + " \n", + " @visitor.when(ClassDeclarationNode)\n", + " def visit(self, node, tabs=0):\n", + " parent = '' if node.parent is None else f\": {node.parent}\"\n", + " ans = '\\t' * tabs + f'\\\\__ClassDeclarationNode: class {node.id} {parent} {{ ... }}'\n", + " features = '\\n'.join(self.visit(child, tabs + 1) for child in node.features)\n", + " return f'{ans}\\n{features}'\n", + " \n", + " @visitor.when(AttrDeclarationNode)\n", + " def visit(self, node, tabs=0):\n", + " ans = '\\t' * tabs + f'\\\\__AttrDeclarationNode: {node.id} : {node.type}'\n", + " return f'{ans}'\n", + " \n", + " @visitor.when(VarDeclarationNode)\n", + " def visit(self, node, tabs=0):\n", + " ans = '\\t' * tabs + f'\\\\__VarDeclarationNode: let {node.id} : {node.type} = '\n", + " expr = self.visit(node.expr, tabs + 1)\n", + " return f'{ans}\\n{expr}'\n", + " \n", + " @visitor.when(AssignNode)\n", + " def visit(self, node, tabs=0):\n", + " ans = '\\t' * tabs + f'\\\\__AssignNode: let {node.id} = '\n", + " expr = self.visit(node.expr, tabs + 1)\n", + " return f'{ans}\\n{expr}'\n", + " \n", + " @visitor.when(FuncDeclarationNode)\n", + " def visit(self, node, tabs=0):\n", + " params = ', '.join(':'.join(param) for param in node.params)\n", + " ans = '\\t' * tabs + f'\\\\__FuncDeclarationNode: def {node.id}({params}) : {node.type} -> '\n", + " body = '\\n'.join(self.visit(child, tabs + 1) for child in node.body)\n", + " return f'{ans}\\n{body}'\n", + "\n", + " @visitor.when(BinaryNode)\n", + " def visit(self, node, tabs=0):\n", + " ans = '\\t' * tabs + f'\\\\__ {node.__class__.__name__} '\n", + " left = self.visit(node.left, tabs + 1)\n", + " right = self.visit(node.right, tabs + 1)\n", + " return f'{ans}\\n{left}\\n{right}'\n", + "\n", + " @visitor.when(AtomicNode)\n", + " def visit(self, node, tabs=0):\n", + " return '\\t' * tabs + f'\\\\__ {node.__class__.__name__}: {node.lex}'\n", + " \n", + " @visitor.when(CallNode)\n", + " def visit(self, node, tabs=0):\n", + " obj = self.visit(node.obj, tabs + 1)\n", + " ans = '\\t' * tabs + f'\\\\__CallNode: .{node.id}(, ..., )'\n", + " args = '\\n'.join(self.visit(arg, tabs + 1) for arg in node.args)\n", + " return f'{ans}\\n{obj}\\n{args}'\n", + " \n", + " @visitor.when(InstantiateNode)\n", + " def visit(self, node, tabs=0):\n", + " return '\\t' * tabs + f'\\\\__ InstantiateNode: new {node.lex}()'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Independientemente de la gramática el AST debería quedar igual. Así que la siguiente verificación no debería tener problema." + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": "\\__ProgramNode [ ... ]\n\t\\__ClassDeclarationNode: class A { ... }\n\t\t\\__AttrDeclarationNode: a : int\n\t\t\\__FuncDeclarationNode: def suma(a:int, b:int) : int -> \n\t\t\t\\__ PlusNode \n\t\t\t\t\\__ VariableNode: a\n\t\t\t\t\\__ VariableNode: b\n\t\t\\__AttrDeclarationNode: b : int\n\t\\__ClassDeclarationNode: class B : A { ... }\n\t\t\\__AttrDeclarationNode: c : A\n\t\t\\__FuncDeclarationNode: def f(d:int, a:A) : void -> \n\t\t\t\\__VarDeclarationNode: let f : int = \n\t\t\t\t\\__ ConstantNumNode: 8\n\t\t\t\\__AssignNode: let c = \n\t\t\t\t\\__CallNode: .suma(, ..., )\n\t\t\t\t\t\\__ InstantiateNode: new A()\n\t\t\t\t\t\\__ ConstantNumNode: 5\n\t\t\t\t\t\\__ VariableNode: f\n\t\t\t\\__ VariableNode: c\n" + } + ], + "source": [ + "if __name__ == '__main__':\n", + " formatter = FormatVisitor()\n", + " tree = formatter.visit(ast)\n", + " print(tree)\n", + "\n", + " assert tree == '''\\__ProgramNode [ ... ]\n", + "\t\\__ClassDeclarationNode: class A { ... }\n", + "\t\t\\__AttrDeclarationNode: a : int\n", + "\t\t\\__FuncDeclarationNode: def suma(a:int, b:int) : int -> \n", + "\t\t\t\\__ PlusNode \n", + "\t\t\t\t\\__ VariableNode: a\n", + "\t\t\t\t\\__ VariableNode: b\n", + "\t\t\\__AttrDeclarationNode: b : int\n", + "\t\\__ClassDeclarationNode: class B : A { ... }\n", + "\t\t\\__AttrDeclarationNode: c : A\n", + "\t\t\\__FuncDeclarationNode: def f(d:int, a:A) : void -> \n", + "\t\t\t\\__VarDeclarationNode: let f : int = \n", + "\t\t\t\t\\__ ConstantNumNode: 8\n", + "\t\t\t\\__AssignNode: let c = \n", + "\t\t\t\t\\__CallNode: .suma(, ..., )\n", + "\t\t\t\t\t\\__ InstantiateNode: new A()\n", + "\t\t\t\t\t\\__ ConstantNumNode: 5\n", + "\t\t\t\t\t\\__ VariableNode: f\n", + "\t\t\t\\__ VariableNode: c'''" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Propuestas\n", + "\n", + "- Implemente una clase contexto que le permita consultar la información de las clases, métodos y variables (especialmente los tipos).\n", + "- Implemente un visitor que recorre el AST recolectando los tipos.\n", + "- Implemente un visitor que recorre el AST recolectando los métodos y atributos." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.3-final" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} \ No newline at end of file diff --git a/src/cool/code_generation/notebooks/cp14.ipynb b/src/cool/code_generation/notebooks/cp14.ipynb new file mode 100644 index 000000000..a17371ac6 --- /dev/null +++ b/src/cool/code_generation/notebooks/cp14.ipynb @@ -0,0 +1,543 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Clase Práctica #14 (Compilación)\n", + "\n", + "En esta clase implementaremos las primeras fases de chequeo semántico para el lenguaje que comenzamos a estudiar en la clase anterior. Pasemos a importar lo que ya habíamos implementado." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": "importing Jupyter notebook from cp13.ipynb\n" + } + ], + "source": [ + "import cmp.nbpackage\n", + "import cmp.visitor as visitor\n", + "\n", + "from cp13 import G, text\n", + "from cp13 import Node, ProgramNode, DeclarationNode, ExpressionNode\n", + "from cp13 import ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode\n", + "from cp13 import VarDeclarationNode, AssignNode, CallNode\n", + "from cp13 import AtomicNode, BinaryNode\n", + "from cp13 import ConstantNumNode, VariableNode, InstantiateNode, PlusNode, MinusNode, StarNode, DivNode\n", + "from cp13 import FormatVisitor, tokenize_text, pprint_tokens\n", + "\n", + "from cmp.tools.parsing import LR1Parser\n", + "from cmp.evaluation import evaluate_reverse_parse" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "La gramática `G` es la gramática que diseñamos para el lenguaje. Esta debe atrapar la sintaxis del lenguaje. Por otro lado, las reglas que incluimos al atributar la gramática deberían construir una representación sobre la que fuera cómodo comprobar la semántica del programa. Estamos hablando justamente del **AST**.\n", + "\n", + "Construyamos el siguiente método `run_pipeline`, el cual recibe una cadena de texto y una gramática, y pasará por las fases de análisis lexicográfico y sintácticto, y finalmente evaluará las reglas para devolvernos el AST." + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": "=================== TEXT ======================\n\nclass A {\n a : int ;\n def suma ( a : int , b : int ) : int {\n a + b ;\n }\n b : int ;\n}\n\nclass B : A {\n c : A ;\n def f ( d : int , a : A ) : void {\n let f : int = 8 ;\n let c = new A ( ) . suma ( 5 , f ) ;\n c ;\n }\n}\n\n================== TOKENS =====================\nclass id {\n id : id ;\n def id ( id : id , id : id ) : id {\n id + id ;\n }\n id : id ;\n}\nclass id : id {\n id : id ;\n def id ( id : id , id : id ) : id {\n let id : id = int ;\n let id = new id ( ) . id ( int , id ) ;\n id ;\n }\n}\n$\n=================== PARSE =====================\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> id\n -> \n -> \n -> \n -> id\n -> \n -> \n -> + \n -> \n -> ;\n -> def id ( ) : id { }\n -> id : id ;\n -> \n -> \n -> \n -> class id { }\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> int\n -> \n -> \n -> \n -> \n -> let id : id = \n -> new id ( )\n -> \n -> int\n -> \n -> \n -> \n -> \n -> id\n -> \n -> \n -> \n -> \n -> \n -> , \n -> . id ( )\n -> \n -> \n -> \n -> \n -> let id = \n -> id\n -> \n -> \n -> \n -> \n -> ;\n -> ; \n -> ; \n -> def id ( ) : id { }\n -> \n -> \n -> class id : id { }\n -> \n -> \n -> \n==================== AST ======================\n\\__ProgramNode [ ... ]\n\t\\__ClassDeclarationNode: class A { ... }\n\t\t\\__AttrDeclarationNode: a : int\n\t\t\\__FuncDeclarationNode: def suma(a:int, b:int) : int -> \n\t\t\t\\__ PlusNode \n\t\t\t\t\\__ VariableNode: a\n\t\t\t\t\\__ VariableNode: b\n\t\t\\__AttrDeclarationNode: b : int\n\t\\__ClassDeclarationNode: class B : A { ... }\n\t\t\\__AttrDeclarationNode: c : A\n\t\t\\__FuncDeclarationNode: def f(d:int, a:A) : void -> \n\t\t\t\\__VarDeclarationNode: let f : int = \n\t\t\t\t\\__ ConstantNumNode: 8\n\t\t\t\\__AssignNode: let c = \n\t\t\t\t\\__CallNode: .suma(, ..., )\n\t\t\t\t\t\\__ InstantiateNode: new A()\n\t\t\t\t\t\\__ ConstantNumNode: 5\n\t\t\t\t\t\\__ VariableNode: f\n\t\t\t\\__ VariableNode: c\n" + } + ], + "source": [ + "def run_pipeline(G, text):\n", + " print('=================== TEXT ======================')\n", + " print(text)\n", + " print('================== TOKENS =====================')\n", + " tokens = tokenize_text(text)\n", + " pprint_tokens(tokens)\n", + " print('=================== PARSE =====================')\n", + " parser = LR1Parser(G)\n", + " parse, operations = parser([t.token_type for t in tokens], get_shift_reduce=True)\n", + " print('\\n'.join(repr(x) for x in parse))\n", + " print('==================== AST ======================')\n", + " ast = evaluate_reverse_parse(parse, operations, tokens)\n", + " formatter = FormatVisitor()\n", + " tree = formatter.visit(ast)\n", + " print(tree)\n", + " return ast\n", + " \n", + "if __name__ == '__main__': ast = run_pipeline(G, text)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Chequeo semántico\n", + "\n", + "En `cmp.semantic` se distribuyen una serie de clases que funcionarán como soporte para la fase de chequeo semántico." + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "from cmp.semantic import SemanticError\n", + "from cmp.semantic import Attribute, Method, Type\n", + "from cmp.semantic import VoidType, ErrorType\n", + "from cmp.semantic import Context" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "- La clase `SemanticError` hereda de `Exception` para funcionar como mecanismo para manejar errores en los contextos. El campo `text` que poseen las instancias de `SemanticError` permite obtener el texto de error con el que se construyó.\n", + "- Las clases `Attribute` y `Method` funcionan como contenedores de los datos necesarios para representar los atributos y métodos del lenguaje respectivamente. Del primero se almacena el nombre del campo (un `str)` y su tipo (una instancia de `Type`). Del segundo se almacenan: nombre del método (`str`), nombre de los parámetros (`list`), tipos de los parámetros (`list`) y el tipo de retorno (`Type`).\n", + "- La clase `Type` funciona como descriptor de todos los atributos y métodos con que cuentan los tipos del lenguaje. Esta clase permite crear instancias a partir del nombre del tipo (`Type(name)`) y posteriormente actualizar su definición con:\n", + " - tipo padre: `set_parent(...)`.\n", + " - atributos: `get_attributes(...)` y `define_attribute(...)`.\n", + " - métodos: `get_method(...)` y `define_method(...)`.\n", + "\n", + "> Para más información se recomienda revisar el código fuente disponible en `cmp.semantic`.\n", + "\n", + "- La clase `VoidType` puede usarse para manejar el tipo de retorno `void` de los métodos. Tiene la particularidad de que todas sus instancias son iguales entre sí.\n", + "- La clase `ErrorType` puede usarse para manejar las situaciones en las que se refiere un tipo que no ha sido declarado. Esto nos permitirá detectar más errores que detener el chequeo semántico al primer error. Las instancias de `ErrorType` tiene la particularidad de ser iguales entre sí y a cualquier instancia de `Type`. Además, el tipo `ErrorType` se conforma (en el sentido de herencia) a todo tipo y viceversa.\n", + "- La clase `Context` permite controlar los tipos que han sido definidos en el lenguaje.\n", + " - definir un tipo: `create_type(...)`.\n", + " - obtener un tipo: `get_type(...)`." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Recolectando de tipos\n", + "\n", + "Dado que en este lenguaje los tipos pueden referenciarse antes de declararse, se vuelve necesario realizar un primer recorrido del AST recolectando todos los tipos. Esto lo haremos utilizando el patrón `visitor` con el que trabajamos en clases anteriores." + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "class TypeCollector(object):\n", + " def __init__(self, errors=[]):\n", + " self.context = None\n", + " self.errors = errors\n", + " \n", + " @visitor.on('node')\n", + " def visit(self, node):\n", + " pass\n", + " \n", + " @visitor.when(ProgramNode)\n", + " def visit(self, node):\n", + " self.context = Context()\n", + " self.context.create_type('int')\n", + " self.context.create_type('void')\n", + " for declaration in node.declarations:\n", + " self.visit(declaration)\n", + " \n", + " @visitor.when(ClassDeclarationNode)\n", + " def visit(self, node):\n", + " try:\n", + " self.context.create_type(node.id)\n", + " except SemanticError as e:\n", + " self.errors.append(e)\n", + "" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Comprobemos que implementamos correctamente el recorrido. Tras visitar el AST deberíamos tener en el campo `context` del `visitor` todos los tipos definidos en el programa _... y algo más? ;-)_" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": "Errors: []\nContext:\n{\n\ttype int {}\n\t\n\ttype void {}\n\t\n\ttype A {}\n\t\n\ttype B {}\n\t\n}\n" + } + ], + "source": [ + "if __name__ == '__main__':\n", + " errors = []\n", + "\n", + " collector = TypeCollector(errors)\n", + " collector.visit(ast)\n", + "\n", + " context = collector.context\n", + "\n", + " print('Errors:', errors)\n", + " print('Context:')\n", + " print(context)\n", + "\n", + " assert errors == []" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Construyendo los tipos\n", + "\n", + "Pasemos ahora a construir los tipos. Pero _... realmente podremos comenzar ya a chequear todo el código? (incluyendo el cuerpo de los métodos)_. Resulta que no. En este lenguaje en orden en que se definen los métodos tampoco es relevante: _se pueden llamar antes de declararse_. Esto permite que haya recursividad en el lenguaje que lleva un chequeo extra antes de pasar a revisar los cuerpos de los métodos.\n", + "\n", + "Nótese que al haber recolectado ya todos los tipos, se logra que los parámetros, valores de retorno, y otras refencias a tipos, puedan ser resueltas en este recorrido sin problemas." + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "class TypeBuilder:\n", + " def __init__(self, context, errors=[]):\n", + " self.context = context\n", + " self.current_type = None\n", + " self.errors = errors\n", + " \n", + " @visitor.on('node')\n", + " def visit(self, node):\n", + " pass\n", + " \n", + " @visitor.when(ProgramNode)\n", + " def visit(self, node):\n", + " for declaration in node.declarations:\n", + " self.visit(declaration)\n", + " \n", + " @visitor.when(ClassDeclarationNode)\n", + " def visit(self, node):\n", + " try:\n", + " self.current_type = self.context.get_type(node.id)\n", + " if node.parent is not None:\n", + " self.current_type.set_parent(self.context.get_type(node.parent))\n", + " except SemanticError as e:\n", + " self.errors.append(e.text)\n", + " \n", + " for feature in node.features:\n", + " self.visit(feature)\n", + " \n", + " @visitor.when(AttrDeclarationNode)\n", + " def visit(self, node):\n", + " try:\n", + " name = node.id\n", + " typex = self.context.get_type(node.type)\n", + " self.current_type.define_attribute(name, typex)\n", + " except SemanticError as e:\n", + " self.errors.append(e.text)\n", + "\n", + " @visitor.when(FuncDeclarationNode)\n", + " def visit(self, node):\n", + " try:\n", + " name = node.id\n", + " param_names = [p[0] for p in node.params]\n", + " param_types = [self.context.get_type(p[1]) for p in node.params]\n", + " return_type = self.context.get_type(node.type)\n", + " self.current_type.define_method(name, param_names, param_types, return_type)\n", + " except SemanticError as e:\n", + " self.errors.append(e.text)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Comprobemos la implementación. Tras esta fase deberíamos tener completados todos los tipos." + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": "Errors: []\nContext:\n{\n\ttype int {}\n\t\n\ttype void {}\n\t\n\ttype A {\n\t\t[attrib] a : int;\n\t\t[attrib] b : int;\n\t\t[method] suma(self:A, a:int, b:int): int;\n\t}\n\t\n\ttype B : A {\n\t\t[attrib] c : A;\n\t\t[method] f(self:B, d:int, a:A): void;\n\t}\n\t\n}\n" + } + ], + "source": [ + "if __name__ == '__main__':\n", + " builder = TypeBuilder(context, errors)\n", + " builder.visit(ast)\n", + " \n", + " print('Errors:', errors)\n", + " print('Context:')\n", + " print(context)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Comprobando ..." + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [], + "source": [ + "deprecated_pipeline = run_pipeline" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Actualizaremos el pipeline para incluir estos 2 recorridos." + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [], + "source": [ + "def run_pipeline(G, text):\n", + " ast = deprecated_pipeline(G, text)\n", + " print('============== COLLECTING TYPES ===============')\n", + " errors = []\n", + " collector = TypeCollector(errors)\n", + " collector.visit(ast)\n", + " context = collector.context\n", + " print('Errors:', errors)\n", + " print('Context:')\n", + " print(context)\n", + " print('=============== BUILDING TYPES ================')\n", + " builder = TypeBuilder(context, errors)\n", + " builder.visit(ast)\n", + " print('Errors: [')\n", + " for error in errors:\n", + " print('\\t', error)\n", + " print(']')\n", + " print('Context:')\n", + " print(context)\n", + " return ast, errors, context" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Programa #1\n", + "\n", + "El siguiente programa es con el que hemos estado trabajando y no debería contener errores." + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": "=================== TEXT ======================\n\nclass A {\n a : int ;\n def suma ( a : int , b : int ) : int {\n a + b ;\n }\n b : int ;\n}\n\nclass B : A {\n c : A ;\n def f ( d : int , a : A ) : void {\n let f : int = 8 ;\n let c = new A ( ) . suma ( 5 , f ) ;\n c ;\n }\n}\n\n================== TOKENS =====================\nclass id {\n id : id ;\n def id ( id : id , id : id ) : id {\n id + id ;\n }\n id : id ;\n}\nclass id : id {\n id : id ;\n def id ( id : id , id : id ) : id {\n let id : id = int ;\n let id = new id ( ) . id ( int , id ) ;\n id ;\n }\n}\n$\n=================== PARSE =====================\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> id\n -> \n -> \n -> \n -> id\n -> \n -> \n -> + \n -> \n -> ;\n -> def id ( ) : id { }\n -> id : id ;\n -> \n -> \n -> \n -> class id { }\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> int\n -> \n -> \n -> \n -> \n -> let id : id = \n -> new id ( )\n -> \n -> int\n -> \n -> \n -> \n -> \n -> id\n -> \n -> \n -> \n -> \n -> \n -> , \n -> . id ( )\n -> \n -> \n -> \n -> \n -> let id = \n -> id\n -> \n -> \n -> \n -> \n -> ;\n -> ; \n -> ; \n -> def id ( ) : id { }\n -> \n -> \n -> class id : id { }\n -> \n -> \n -> \n==================== AST ======================\n\\__ProgramNode [ ... ]\n\t\\__ClassDeclarationNode: class A { ... }\n\t\t\\__AttrDeclarationNode: a : int\n\t\t\\__FuncDeclarationNode: def suma(a:int, b:int) : int -> \n\t\t\t\\__ PlusNode \n\t\t\t\t\\__ VariableNode: a\n\t\t\t\t\\__ VariableNode: b\n\t\t\\__AttrDeclarationNode: b : int\n\t\\__ClassDeclarationNode: class B : A { ... }\n\t\t\\__AttrDeclarationNode: c : A\n\t\t\\__FuncDeclarationNode: def f(d:int, a:A) : void -> \n\t\t\t\\__VarDeclarationNode: let f : int = \n\t\t\t\t\\__ ConstantNumNode: 8\n\t\t\t\\__AssignNode: let c = \n\t\t\t\t\\__CallNode: .suma(, ..., )\n\t\t\t\t\t\\__ InstantiateNode: new A()\n\t\t\t\t\t\\__ ConstantNumNode: 5\n\t\t\t\t\t\\__ VariableNode: f\n\t\t\t\\__ VariableNode: c\n============== COLLECTING TYPES ===============\nErrors: []\nContext:\n{\n\ttype int {}\n\t\n\ttype void {}\n\t\n\ttype A {}\n\t\n\ttype B {}\n\t\n}\n=============== BUILDING TYPES ================\nErrors: [\n]\nContext:\n{\n\ttype int {}\n\t\n\ttype void {}\n\t\n\ttype A {\n\t\t[attrib] a : int;\n\t\t[attrib] b : int;\n\t\t[method] suma(self:A, a:int, b:int): int;\n\t}\n\t\n\ttype B : A {\n\t\t[attrib] c : A;\n\t\t[method] f(self:B, d:int, a:A): void;\n\t}\n\t\n}\n" + } + ], + "source": [ + "from cp13 import text\n", + "\n", + "if __name__ == '__main__': \n", + " ast, errors, context = run_pipeline(G, text)\n", + " assert errors == []" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Programa #2\n", + "\n", + "Se incluyeron varios errores al programa anterior. Intente detectar todos los errores posibles." + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": "=================== TEXT ======================\n\n class A {\n a : Z ;\n def suma ( a : int , b : B ) : int {\n a + b ;\n }\n b : int ;\n c : C ;\n }\n\n class B : A {\n c : A ;\n def f ( d : int , a : A ) : void {\n let f : int = 8 ;\n let c = new A ( ) . suma ( 5 , f ) ;\n c ;\n }\n z : int ;\n z : A ;\n }\n\n class C : Z {\n }\n\n class D : A {\n def suma ( a : int , d : B ) : int {\n d ;\n }\n }\n\n class E : A {\n def suma ( a : A , b : B ) : int {\n a ;\n }\n }\n\n class F : B {\n def f ( d : int , a : A ) : void {\n a ;\n }\n }\n \n================== TOKENS =====================\nclass id {\n id : id ;\n def id ( id : id , id : id ) : id {\n id + id ;\n }\n id : id ;\n id : id ;\n}\nclass id : id {\n id : id ;\n def id ( id : id , id : id ) : id {\n let id : id = int ;\n let id = new id ( ) . id ( int , id ) ;\n id ;\n }\n id : id ;\n id : id ;\n}\nclass id : id {\n}\nclass id : id {\n def id ( id : id , id : id ) : id {\n id ;\n }\n}\nclass id : id {\n def id ( id : id , id : id ) : id {\n id ;\n }\n}\nclass id : id {\n def id ( id : id , id : id ) : id {\n id ;\n }\n}\n$\n=================== PARSE =====================\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> id\n -> \n -> \n -> \n -> id\n -> \n -> \n -> + \n -> \n -> ;\n -> def id ( ) : id { }\n -> id : id ;\n -> id : id ;\n -> \n -> \n -> \n -> \n -> class id { }\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> int\n -> \n -> \n -> \n -> \n -> let id : id = \n -> new id ( )\n -> \n -> int\n -> \n -> \n -> \n -> \n -> id\n -> \n -> \n -> \n -> \n -> \n -> , \n -> . id ( )\n -> \n -> \n -> \n -> \n -> let id = \n -> id\n -> \n -> \n -> \n -> \n -> ;\n -> ; \n -> ; \n -> def id ( ) : id { }\n -> id : id ;\n -> id : id ;\n -> \n -> \n -> \n -> \n -> class id : id { }\n -> class id : id { }\n -> id : id\n -> id : id\n -> \n -> , \n -> id\n -> \n -> \n -> \n -> \n -> ;\n -> def id ( ) : id { }\n -> \n -> class id : id { }\n -> id : id\n -> id : id\n -> \n -> , \n -> id\n -> \n -> \n -> \n -> \n -> ;\n -> def id ( ) : id { }\n -> \n -> class id : id { }\n -> id : id\n -> id : id\n -> \n -> , \n -> id\n -> \n -> \n -> \n -> \n -> ;\n -> def id ( ) : id { }\n -> \n -> class id : id { }\n -> \n -> \n -> \n -> \n -> \n -> \n -> \n==================== AST ======================\n\\__ProgramNode [ ... ]\n\t\\__ClassDeclarationNode: class A { ... }\n\t\t\\__AttrDeclarationNode: a : Z\n\t\t\\__FuncDeclarationNode: def suma(a:int, b:B) : int -> \n\t\t\t\\__ PlusNode \n\t\t\t\t\\__ VariableNode: a\n\t\t\t\t\\__ VariableNode: b\n\t\t\\__AttrDeclarationNode: b : int\n\t\t\\__AttrDeclarationNode: c : C\n\t\\__ClassDeclarationNode: class B : A { ... }\n\t\t\\__AttrDeclarationNode: c : A\n\t\t\\__FuncDeclarationNode: def f(d:int, a:A) : void -> \n\t\t\t\\__VarDeclarationNode: let f : int = \n\t\t\t\t\\__ ConstantNumNode: 8\n\t\t\t\\__AssignNode: let c = \n\t\t\t\t\\__CallNode: .suma(, ..., )\n\t\t\t\t\t\\__ InstantiateNode: new A()\n\t\t\t\t\t\\__ ConstantNumNode: 5\n\t\t\t\t\t\\__ VariableNode: f\n\t\t\t\\__ VariableNode: c\n\t\t\\__AttrDeclarationNode: z : int\n\t\t\\__AttrDeclarationNode: z : A\n\t\\__ClassDeclarationNode: class C : Z { ... }\n\n\t\\__ClassDeclarationNode: class D : A { ... }\n\t\t\\__FuncDeclarationNode: def suma(a:int, d:B) : int -> \n\t\t\t\\__ VariableNode: d\n\t\\__ClassDeclarationNode: class E : A { ... }\n\t\t\\__FuncDeclarationNode: def suma(a:A, b:B) : int -> \n\t\t\t\\__ VariableNode: a\n\t\\__ClassDeclarationNode: class F : B { ... }\n\t\t\\__FuncDeclarationNode: def f(d:int, a:A) : void -> \n\t\t\t\\__ VariableNode: a\n============== COLLECTING TYPES ===============\nErrors: []\nContext:\n{\n\ttype int {}\n\t\n\ttype void {}\n\t\n\ttype A {}\n\t\n\ttype B {}\n\t\n\ttype C {}\n\t\n\ttype D {}\n\t\n\ttype E {}\n\t\n\ttype F {}\n\t\n}\n=============== BUILDING TYPES ================\nErrors: [\n\t Type \"Z\" is not defined.\n\t Attribute \"c\" is already defined in B.\n\t Attribute \"z\" is already defined in B.\n\t Type \"Z\" is not defined.\n]\nContext:\n{\n\ttype int {}\n\t\n\ttype void {}\n\t\n\ttype A {\n\t\t[attrib] b : int;\n\t\t[attrib] c : C;\n\t\t[method] suma(self:A, a:int, b:B): int;\n\t}\n\t\n\ttype B : A {\n\t\t[attrib] z : int;\n\t\t[method] f(self:B, d:int, a:A): void;\n\t}\n\t\n\ttype C {}\n\t\n\ttype D : A {\n\t\t[method] suma(self:D, a:int, d:B): int;\n\t}\n\t\n\ttype E : A {\n\t\t[method] suma(self:E, a:A, b:B): int;\n\t}\n\t\n\ttype F : B {\n\t\t[method] f(self:F, d:int, a:A): void;\n\t}\n\t\n}\n" + } + ], + "source": [ + "if __name__ == '__main__': \n", + " text = '''\n", + " class A {\n", + " a : Z ;\n", + " def suma ( a : int , b : B ) : int {\n", + " a + b ;\n", + " }\n", + " b : int ;\n", + " c : C ;\n", + " }\n", + "\n", + " class B : A {\n", + " c : A ;\n", + " def f ( d : int , a : A ) : void {\n", + " let f : int = 8 ;\n", + " let c = new A ( ) . suma ( 5 , f ) ;\n", + " c ;\n", + " }\n", + " z : int ;\n", + " z : A ;\n", + " }\n", + "\n", + " class C : Z {\n", + " }\n", + "\n", + " class D : A {\n", + " def suma ( a : int , d : B ) : int {\n", + " d ;\n", + " }\n", + " }\n", + "\n", + " class E : A {\n", + " def suma ( a : A , b : B ) : int {\n", + " a ;\n", + " }\n", + " }\n", + "\n", + " class F : B {\n", + " def f ( d : int , a : A ) : void {\n", + " a ;\n", + " }\n", + " }\n", + " '''\n", + "\n", + " ast, errors, context = run_pipeline(G, text)\n", + "\n", + " assert sorted(errors) == sorted([\n", + " 'Type \"Z\" is not defined.',\n", + " 'Attribute \"c\" is already defined in B.',\n", + " 'Attribute \"z\" is already defined in B.',\n", + " 'Type \"Z\" is not defined.'\n", + " ])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Propuestas\n", + "\n", + "- Compruebe el hecho de que todo programa del lenguaje deba tener una clase `Main` con un método `main`.\n", + "- Garantice que no haya circularidad de tipos.\n", + "\n", + "> El siguente programa tiene un problema: la defición de `A` y `B` forma un ciclo.\n", + ">\n", + ">```python\n", + ">text = '''\n", + ">class A : B {\n", + ">}\n", + ">class B : A {\n", + ">}\n", + ">'''\n", + ">\n", + ">ast, errors, context = run_pipeline(G, text)\n", + ">assert len(errors) != 0\n", + ">```\n", + "\n", + "- Verifique que no hayan sobrecargas de métodos\n", + "\n", + "> El método `f` ya está definido en `B` con una firma distinta.\n", + ">```python\n", + ">text = '''\n", + ">class A {\n", + "> def f ( a : int , d : int ) : int {\n", + "> d ;\n", + "> }\n", + ">}\n", + ">class B : A {\n", + "> def f ( a : A , d : int ) : A {\n", + "> d ;\n", + "> }\n", + ">}\n", + ">'''\n", + ">\n", + ">ast, errors, context = run_pipeline(G, text)\n", + ">assert len(errors) != 0\n", + ">```" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Main Checker" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [], + "source": [ + "def check_main(context, errors):\n", + " try:\n", + " class_main = context.get_type('Main')\n", + " method_main = class_main.get_method('main')\n", + " except SemanticError as e:\n", + " errors.append(e.text)\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [], + "source": [ + "if __name__ == '__main__':\n", + " check_main(context, errors)\n", + " errors" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.3-final" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} \ No newline at end of file diff --git a/src/cool/code_generation/notebooks/cp15.ipynb b/src/cool/code_generation/notebooks/cp15.ipynb new file mode 100644 index 000000000..975db862d --- /dev/null +++ b/src/cool/code_generation/notebooks/cp15.ipynb @@ -0,0 +1,481 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Clase Práctica #15 (Compilación)\n", + "\n", + "En esta clase implementaremos la fase final de chequeo semántico para el lenguaje que comenzamos a estudiar en clases anteriores. Pasemos a importar lo que ya habíamos implementado." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Análisis Lexicográfico y Sintáctico" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [], + "source": [ + "import cmp.nbpackage\n", + "import cmp.visitor as visitor\n", + "\n", + "from cp13 import G, text\n", + "from cp13 import Node, ProgramNode, DeclarationNode, ExpressionNode\n", + "from cp13 import ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode\n", + "from cp13 import VarDeclarationNode, AssignNode, CallNode\n", + "from cp13 import AtomicNode, BinaryNode\n", + "from cp13 import ConstantNumNode, VariableNode, InstantiateNode, PlusNode, MinusNode, StarNode, DivNode\n", + "from cp13 import FormatVisitor, tokenize_text, pprint_tokens\n", + "\n", + "from cmp.tools.parsing import LR1Parser\n", + "from cmp.evaluation import evaluate_reverse_parse" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Análisis Semántico (Recolección y Construcción de Tipos)" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [], + "source": [ + "from cmp.semantic import SemanticError\n", + "from cmp.semantic import Attribute, Method, Type\n", + "from cmp.semantic import VoidType, ErrorType, IntType\n", + "from cmp.semantic import Context\n", + "\n", + "from cp14 import TypeCollector, TypeBuilder, run_pipeline" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Chequeo de tipos\n", + "\n", + "Estaremos validando que el programa haga un uso correcto de los tipos definidos. Recordemos algunas de las características del lenguaje que queremos comprobar:\n", + "- Todos los métodos son de instancia y dentro de ellos es visible `self` _(solo lectura)_, cuyo tipo estático coincide con el de la clase que implementa el método.\n", + "- Al invocar un método, se evalúa primero la expresión que devuelve el objeto, luego los parámetros, y por último se llama la función.\n", + "- Todos los atributos son privados y todos los métodos son públicos.\n", + "- Un método se puede sobrescribir sí y solo sí se mantiene exactamente la misma definición para los tipos de retorno y de los argumentos.\n", + "- La expresión `let` tiene la sintaxis: `let : = ` y evalúa al valor de la expresión (y con el tipo estático de la expresión). La variable `` no puede estar previamente definida en ese ámbito. Se puede omitir la declaración del tipo y en tal caso la variable `` ya debe estar definida y se realiza la asignación.\n", + "- Las operaciones `+`, `-`, `*` y `/` están definidas únicamente entre valores enteros, y devuelven enteros." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "WRONG_SIGNATURE = 'Method \"%s\" already defined in \"%s\" with a different signature.'\n", + "SELF_IS_READONLY = 'Variable \"self\" is read-only.'\n", + "LOCAL_ALREADY_DEFINED = 'Variable \"%s\" is already defined in method \"%s\".'\n", + "INCOMPATIBLE_TYPES = 'Cannot convert \"%s\" into \"%s\".'\n", + "VARIABLE_NOT_DEFINED = 'Variable \"%s\" is not defined in \"%s\".'\n", + "INVALID_OPERATION = 'Operation is not defined between \"%s\" and \"%s\".'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "La clase `Type` ha sido extendida para incluir la función `conforms_to`. Recordemos que esta relación indica que un objeto de tipo `C` puede ser usado en lugar de un objeto de tipo `P`. En tal caso decimos que `C.conforms_to(P)`. La relación de conformidad es crucial en los lenguajes de programación orientados a objetos pues restringirá las asignaciones e invocaciones para garantizar el principio de sustitución." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Ámbito (Scope)\n", + "\n", + "Se provee una implementación de la clase `Scope` en `cmp.semantic`. Esta clase nos permitirá gestionar las variables definidas en los distintos niveles de visibilidad, así como saber con qué tipo se definieron. Los métodos fundamentales son:\n", + "- `create_child`: Crea un `scope` hijo que hereda las variables visibles hasta ese momento en el `scope` padre.\n", + "- `define_variable`: Registra localmente una variable en el `scope` a partir de su nombre y tipo.\n", + "- `find_variable`: Devuelve un `VariableInfo` con la información de la variable consultada (a partir de su nombre). La variable devuelta no tiene por qué estar definida localmente. En caso de que la variable no esté definida devuelve `None`.\n", + "- `is_defined`: Indica si la variable consultada es visible en el `scope`.\n", + "- `is_local`: Indica si la variable consultada está definida localmente en el `scope`." + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": {}, + "outputs": [], + "source": [ + "from cmp.semantic import Scope" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Type Checker Visitor\n", + "\n", + "Implementaremos un nuevo recorrido sobre el AST. Como de costumbre nos apoyaremos en el patrón visitor. Debemos caminar desde la raíz del AST (`ProgramNode`) hasta el cuerpo de los métodos. En esta ocasión además, verificaremos que los métodos construidos en el recorrido anterior no hayan tenido sobrecargas distintas a lo largo del árbol de herencia." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "class TypeChecker:\n", + " def __init__(self, context, errors=[]):\n", + " self.context = context\n", + " self.current_type = None\n", + " self.current_method = None\n", + " self.errors = errors\n", + "\n", + " @visitor.on('node')\n", + " def visit(self, node, scope):\n", + " pass\n", + "\n", + " @visitor.when(ProgramNode)\n", + " def visit(self, node, scope=None):\n", + " scope = Scope()\n", + " for declaration in node.declarations:\n", + " self.visit(declaration, scope.create_child())\n", + " return scope\n", + "\n", + " @visitor.when(ClassDeclarationNode)\n", + " def visit(self, node, scope):\n", + " self.current_type = self.context.get_type(node.id)\n", + " \n", + " attrs = [f for f in node.features if isinstance(f, AttrDeclarationNode)]\n", + " funcs = [f for f in node.features if isinstance(f, FuncDeclarationNode)]\n", + " \n", + " for attr in attrs:\n", + " self.visit(attr, scope)\n", + " \n", + " for func in funcs:\n", + " self.visit(func, scope.create_child())\n", + " \n", + " @visitor.when(AttrDeclarationNode)\n", + " def visit(self, node, scope):\n", + " typex = self.context.get_type(node.type)\n", + " scope.define_variable(node.id, typex)\n", + "\n", + " @visitor.when(FuncDeclarationNode)\n", + " def visit(self, node, scope):\n", + " method = self.current_method = self.current_type.get_method(node.id)\n", + " param_types = [t.name for t in method.param_types]\n", + " return_type = method.return_type\n", + "\n", + " # checking overriding\n", + " parent = self.current_type.parent\n", + " while parent is not None:\n", + " try:\n", + " if method != parent.get_method(node.id):\n", + " self.errors.append(WRONG_SIGNATURE % (node.id, parent.name))\n", + " break\n", + " parent = parent.parent\n", + " except SemanticError:\n", + " break\n", + " \n", + " scope.define_variable('self', self.current_type)\n", + " for n, t in zip(method.param_names, method.param_types):\n", + " scope.define_variable(n, t)\n", + " \n", + " child_scope = scope.create_child()\n", + " for expr in node.body:\n", + " self.visit(expr, child_scope)\n", + " \n", + " @visitor.when(VarDeclarationNode)\n", + " def visit(self, node, scope):\n", + " if scope.is_defined(node.id):\n", + " self.errors.append(LOCAL_ALREADY_DEFINED % (node.id, self.current_method.name))\n", + " \n", + " var_type = self.context.get_type(node.type)\n", + " expr_type = self.visit(node.expr, scope)\n", + " \n", + " if not expr_type.conforms_to(var_type):\n", + " self.errors.append(INCOMPATIBLE_TYPES % (expr_type.name, var_type.name))\n", + " \n", + " scope.define_variable(node.id, var_type)\n", + " \n", + " return var_type\n", + " \n", + " @visitor.when(AssignNode)\n", + " def visit(self, node, scope):\n", + " if node.id == 'self':\n", + " self.errors.append(SELF_IS_READONLY)\n", + " \n", + " elif not scope.is_defined(node.id):\n", + " self.errors.append(VARIABLE_NOT_DEFINED % (node.id, self.current_type.name))\n", + " \n", + " var_type = scope.find_variable(node.id).type\n", + " expr_type = self.visit(node.expr, scope)\n", + " \n", + " if not expr_type.conforms_to(var_type):\n", + " self.errors.append(INCOMPATIBLE_TYPES % (expr_type.name, var_type.name))\n", + " \n", + " return var_type\n", + " \n", + " @visitor.when(CallNode)\n", + " def visit(self, node, scope):\n", + " obj_type = self.visit(node.obj, scope)\n", + " \n", + " try:\n", + " args = node.args\n", + " method = obj_type.get_method(node.id)\n", + " param_types = method.param_types\n", + " \n", + " for arg, param_type in zip(args, param_types):\n", + " arg_type = self.visit(arg, scope)\n", + " if not arg_type.conforms_to(param_type):\n", + " self.errors.append(INCOMPATIBLE_TYPES % (arg_type.name, param_type.name))\n", + " \n", + " return method.return_type\n", + " except SemanticError as e:\n", + " self.errors.append(e.text)\n", + " return ErrorType()\n", + " \n", + " @visitor.when(BinaryNode)\n", + " def visit(self, node, scope):\n", + " left_type = self.visit(node.left, scope)\n", + " right_type = self.visit(node.right, scope)\n", + " \n", + " if IntType() != left_type or IntType() != right_type:\n", + " self.errors.append(INVALID_OPERATION % (left_type.name, right_type.name))\n", + " \n", + " return IntType()\n", + " \n", + " @visitor.when(ConstantNumNode)\n", + " def visit(self, node, scope):\n", + " return IntType()\n", + "\n", + " @visitor.when(VariableNode)\n", + " def visit(self, node, scope):\n", + " var = scope.find_variable(node.lex)\n", + " if var is not None:\n", + " return var.type\n", + " else:\n", + " self.errors.append(VARIABLE_NOT_DEFINED % (node.lex, self.current_type.name))\n", + " return ErrorType()\n", + "\n", + " @visitor.when(InstantiateNode)\n", + " def visit(self, node, scope):\n", + " try:\n", + " return self.context.get_type(node.lex)\n", + " except SemanticError as e:\n", + " self.errors.append(e.text)\n", + " return ErrorType()\n", + "" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Pipeline\n", + "\n", + "Actualicemos el método `run_pipeline` para incluir esta nueva fase. Con eso deberíamos completar una línea de ejecución para llegar al final del chequeo semántico partiendo desde el programa en texto plano y la gramática." + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": {}, + "outputs": [], + "source": [ + "from cp14 import run_pipeline as deprecated_pipeline\n", + "\n", + "def run_pipeline(G, text):\n", + " ast, errors, context = deprecated_pipeline(G, text)\n", + " print('=============== CHECKING TYPES ================')\n", + " checker = TypeChecker(context, errors)\n", + " scope = checker.visit(ast)\n", + " print('Errors: [')\n", + " for error in errors:\n", + " print('\\t', error)\n", + " print(']')\n", + " return ast, errors, context, scope" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Programa #1\n", + "\n", + "El siguiente programa no debería contener errores." + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": "=================== TEXT ======================\n\nclass A {\n a : int ;\n def suma ( a : int , b : int ) : int {\n a + b ;\n }\n b : int ;\n}\n\nclass B : A {\n c : int ;\n def f ( d : int , a : A ) : void {\n let f : int = 8 ;\n let c = new A ( ) . suma ( 5 , f ) ;\n c ;\n }\n}\n\n================== TOKENS =====================\nclass id {\n id : id ;\n def id ( id : id , id : id ) : id {\n id + id ;\n }\n id : id ;\n}\nclass id : id {\n id : id ;\n def id ( id : id , id : id ) : id {\n let id : id = int ;\n let id = new id ( ) . id ( int , id ) ;\n id ;\n }\n}\n$\n=================== PARSE =====================\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> id\n -> \n -> \n -> \n -> id\n -> \n -> \n -> + \n -> \n -> ;\n -> def id ( ) : id { }\n -> id : id ;\n -> e\n -> \n -> \n -> \n -> class id { }\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> int\n -> \n -> \n -> \n -> \n -> let id : id = \n -> new id ( )\n -> \n -> int\n -> \n -> \n -> \n -> \n -> id\n -> \n -> \n -> \n -> \n -> \n -> , \n -> . id ( )\n -> \n -> \n -> \n -> \n -> let id = \n -> id\n -> \n -> \n -> \n -> \n -> ;\n -> ; \n -> ; \n -> def id ( ) : id { }\n -> e\n -> \n -> \n -> class id : id { }\n -> \n -> \n -> \n==================== AST ======================\n\\__ProgramNode [ ... ]\n\t\\__ClassDeclarationNode: class A { ... }\n\t\t\\__AttrDeclarationNode: a : int\n\t\t\\__FuncDeclarationNode: def suma(a:int, b:int) : int -> \n\t\t\t\\__ PlusNode \n\t\t\t\t\\__ VariableNode: a\n\t\t\t\t\\__ VariableNode: b\n\t\t\\__AttrDeclarationNode: b : int\n\t\\__ClassDeclarationNode: class B : A { ... }\n\t\t\\__AttrDeclarationNode: c : int\n\t\t\\__FuncDeclarationNode: def f(d:int, a:A) : void -> \n\t\t\t\\__VarDeclarationNode: let f : int = \n\t\t\t\t\\__ ConstantNumNode: 8\n\t\t\t\\__AssignNode: let c = \n\t\t\t\t\\__CallNode: .suma(, ..., )\n\t\t\t\t\t\\__ InstantiateNode: new A()\n\t\t\t\t\t\\__ ConstantNumNode: 5\n\t\t\t\t\t\\__ VariableNode: f\n\t\t\t\\__ VariableNode: c\n============== COLLECTING TYPES ===============\nErrors: []\nContext:\n{\n\ttype int {}\n\t\n\ttype void {}\n\t\n\ttype A {}\n\t\n\ttype B {}\n\t\n}\n=============== BUILDING TYPES ================\nErrors: [\n]\nContext:\n{\n\ttype int {}\n\t\n\ttype void {}\n\t\n\ttype A {\n\t\t[attrib] a : int;\n\t\t[attrib] b : int;\n\t\t[method] suma(a:int, b:int): int;\n\t}\n\t\n\ttype B : A {\n\t\t[attrib] c : int;\n\t\t[method] f(d:int, a:A): void;\n\t}\n\t\n}\n=============== CHECKING TYPES ================\nErrors: [\n]\n" + } + ], + "source": [ + "text = '''\n", + "class A {\n", + " a : int ;\n", + " def suma ( a : int , b : int ) : int {\n", + " a + b ;\n", + " }\n", + " b : int ;\n", + "}\n", + "\n", + "class B : A {\n", + " c : int ;\n", + " def f ( d : int , a : A ) : void {\n", + " let f : int = 8 ;\n", + " let c = new A ( ) . suma ( 5 , f ) ;\n", + " c ;\n", + " }\n", + "}\n", + "'''\n", + "\n", + "if __name__ == '__main__':\n", + " ast, errors, context, scope = run_pipeline(G, text)\n", + " assert not errors" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Programa #2\n", + "\n", + "Se incluyeron varios errores al programa anterior. Intente detectar todos los errores posibles." + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": "=================== TEXT ======================\n\nclass A {\n a : int ;\n def suma ( a : int , b : int ) : int {\n a + b + new B ( ) ;\n }\n b : int ;\n}\n\nclass B : A {\n c : A ;\n def f ( d : int , a : A ) : void {\n let f : int = 8 ;\n let c = new A ( ) . suma ( 5 , f ) ;\n d ; \n }\n}\n\n================== TOKENS =====================\nclass id {\n id : id ;\n def id ( id : id , id : id ) : id {\n id + id + new id ( ) ;\n }\n id : id ;\n}\nclass id : id {\n id : id ;\n def id ( id : id , id : id ) : id {\n let id : id = int ;\n let id = new id ( ) . id ( int , id ) ;\n id ;\n }\n}\n$\n=================== PARSE =====================\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> id\n -> \n -> \n -> \n -> id\n -> \n -> \n -> + \n -> new id ( )\n -> \n -> \n -> + \n -> \n -> ;\n -> def id ( ) : id { }\n -> id : id ;\n -> e\n -> \n -> \n -> \n -> class id { }\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> int\n -> \n -> \n -> \n -> \n -> let id : id = \n -> new id ( )\n -> \n -> int\n -> \n -> \n -> \n -> \n -> id\n -> \n -> \n -> \n -> \n -> \n -> , \n -> . id ( )\n -> \n -> \n -> \n -> \n -> let id = \n -> id\n -> \n -> \n -> \n -> \n -> ;\n -> ; \n -> ; \n -> def id ( ) : id { }\n -> e\n -> \n -> \n -> class id : id { }\n -> \n -> \n -> \n==================== AST ======================\n\\__ProgramNode [ ... ]\n\t\\__ClassDeclarationNode: class A { ... }\n\t\t\\__AttrDeclarationNode: a : int\n\t\t\\__FuncDeclarationNode: def suma(a:int, b:int) : int -> \n\t\t\t\\__ PlusNode \n\t\t\t\t\\__ PlusNode \n\t\t\t\t\t\\__ VariableNode: a\n\t\t\t\t\t\\__ VariableNode: b\n\t\t\t\t\\__ InstantiateNode: new B()\n\t\t\\__AttrDeclarationNode: b : int\n\t\\__ClassDeclarationNode: class B : A { ... }\n\t\t\\__AttrDeclarationNode: c : A\n\t\t\\__FuncDeclarationNode: def f(d:int, a:A) : void -> \n\t\t\t\\__VarDeclarationNode: let f : int = \n\t\t\t\t\\__ ConstantNumNode: 8\n\t\t\t\\__AssignNode: let c = \n\t\t\t\t\\__CallNode: .suma(, ..., )\n\t\t\t\t\t\\__ InstantiateNode: new A()\n\t\t\t\t\t\\__ ConstantNumNode: 5\n\t\t\t\t\t\\__ VariableNode: f\n\t\t\t\\__ VariableNode: d\n============== COLLECTING TYPES ===============\nErrors: []\nContext:\n{\n\ttype int {}\n\t\n\ttype void {}\n\t\n\ttype A {}\n\t\n\ttype B {}\n\t\n}\n=============== BUILDING TYPES ================\nErrors: [\n]\nContext:\n{\n\ttype int {}\n\t\n\ttype void {}\n\t\n\ttype A {\n\t\t[attrib] a : int;\n\t\t[attrib] b : int;\n\t\t[method] suma(a:int, b:int): int;\n\t}\n\t\n\ttype B : A {\n\t\t[attrib] c : A;\n\t\t[method] f(d:int, a:A): void;\n\t}\n\t\n}\n=============== CHECKING TYPES ================\nErrors: [\n\t Operation is not defined between \"int\" and \"B\".\n\t Cannot convert \"int\" into \"A\".\n]\n" + } + ], + "source": [ + "text = '''\n", + "class A {\n", + " a : int ;\n", + " def suma ( a : int , b : int ) : int {\n", + " a + b + new B ( ) ;\n", + " }\n", + " b : int ;\n", + "}\n", + "\n", + "class B : A {\n", + " c : A ;\n", + " def f ( d : int , a : A ) : void {\n", + " let f : int = 8 ;\n", + " let c = new A ( ) . suma ( 5 , f ) ;\n", + " d ; \n", + " }\n", + "}\n", + "'''\n", + "\n", + "if __name__ == '__main__':\n", + " ast, errors, context, scope = run_pipeline(G, text)\n", + " assert set(errors) == {\n", + "\t 'Operation is not defined between \"int\" and \"B\".',\n", + "\t 'Cannot convert \"int\" into \"A\".'\n", + " }" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Propuestas\n", + "\n", + "- Añada support (en una rama alternativa) para detectar fila y columna donde ocurrió el error." + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": {}, + "outputs": [], + "source": [ + "program = '''\n", + "class A {\n", + " a : int ;\n", + " def suma ( a : int , b : int ) : int {\n", + " a + b ;\n", + " }\n", + " b : int ;\n", + "}\n", + "\n", + "class B : A {\n", + " c : int ;\n", + " def suma ( d : int , a : int ) : int {\n", + " let f : int = 8 ;\n", + " let c = new A ( ) . suma ( 5 , f ) ;\n", + " c ;\n", + " }\n", + "}\n", + "'''" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": "=================== TEXT ======================\n\nclass A {\n a : int ;\n def suma ( a : int , b : int ) : int {\n a + b ;\n }\n b : int ;\n}\n\nclass B : A {\n c : int ;\n def suma ( d : int , a : int ) : int {\n let f : int = 8 ;\n let c = new A ( ) . suma ( 5 , f ) ;\n c ;\n }\n}\n\n================== TOKENS =====================\nclass id {\n id : id ;\n def id ( id : id , id : id ) : id {\n id + id ;\n }\n id : id ;\n}\nclass id : id {\n id : id ;\n def id ( id : id , id : id ) : id {\n let id : id = int ;\n let id = new id ( ) . id ( int , id ) ;\n id ;\n }\n}\n$\n=================== PARSE =====================\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> id\n -> \n -> \n -> \n -> id\n -> \n -> \n -> + \n -> \n -> ;\n -> def id ( ) : id { }\n -> id : id ;\n -> e\n -> \n -> \n -> \n -> class id { }\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> int\n -> \n -> \n -> \n -> \n -> let id : id = \n -> new id ( )\n -> \n -> int\n -> \n -> \n -> \n -> \n -> id\n -> \n -> \n -> \n -> \n -> \n -> , \n -> . id ( )\n -> \n -> \n -> \n -> \n -> let id = \n -> id\n -> \n -> \n -> \n -> \n -> ;\n -> ; \n -> ; \n -> def id ( ) : id { }\n -> e\n -> \n -> \n -> class id : id { }\n -> \n -> \n -> \n==================== AST ======================\n\\__ProgramNode [ ... ]\n\t\\__ClassDeclarationNode: class A { ... }\n\t\t\\__AttrDeclarationNode: a : int\n\t\t\\__FuncDeclarationNode: def suma(a:int, b:int) : int -> \n\t\t\t\\__ PlusNode \n\t\t\t\t\\__ VariableNode: a\n\t\t\t\t\\__ VariableNode: b\n\t\t\\__AttrDeclarationNode: b : int\n\t\\__ClassDeclarationNode: class B : A { ... }\n\t\t\\__AttrDeclarationNode: c : int\n\t\t\\__FuncDeclarationNode: def suma(d:int, a:int) : int -> \n\t\t\t\\__VarDeclarationNode: let f : int = \n\t\t\t\t\\__ ConstantNumNode: 8\n\t\t\t\\__AssignNode: let c = \n\t\t\t\t\\__CallNode: .suma(, ..., )\n\t\t\t\t\t\\__ InstantiateNode: new A()\n\t\t\t\t\t\\__ ConstantNumNode: 5\n\t\t\t\t\t\\__ VariableNode: f\n\t\t\t\\__ VariableNode: c\n============== COLLECTING TYPES ===============\nErrors: []\nContext:\n{\n\ttype int {}\n\t\n\ttype void {}\n\t\n\ttype A {}\n\t\n\ttype B {}\n\t\n}\n=============== BUILDING TYPES ================\nErrors: [\n]\nContext:\n{\n\ttype int {}\n\t\n\ttype void {}\n\t\n\ttype A {\n\t\t[attrib] a : int;\n\t\t[attrib] b : int;\n\t\t[method] suma(a:int, b:int): int;\n\t}\n\t\n\ttype B : A {\n\t\t[attrib] c : int;\n\t\t[method] suma(d:int, a:int): int;\n\t}\n\t\n}\n=============== CHECKING TYPES ================\nErrors: [\n]\n" + } + ], + "source": [ + "if __name__ == '__main__':\n", + " ast, errors, context, scope = run_pipeline(G, program)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.3-final" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} \ No newline at end of file diff --git a/src/cool/code_generation/notebooks/cp16.ipynb b/src/cool/code_generation/notebooks/cp16.ipynb new file mode 100644 index 000000000..b2c1e063a --- /dev/null +++ b/src/cool/code_generation/notebooks/cp16.ipynb @@ -0,0 +1,589 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Clase Práctica #16 (Compilación)\n", + "\n", + "En esta clase estaremos implementado un mecanismo para transformar _ASTs_ de un lenguaje origen hacia un lenguaje intermedio. Trabajaremos con el lenguaje estudiado en las clases anteriores y lo transformaremos al lenguaje _CIL_. Recordemos que _CIL_ es un lenguaje intermedio cuyo único objetivo es proveer una representación cómoda para transitar entre el lenguaje origen y el destino.\n", + "\n", + "Pasemos a importar el trabajo de las clases anteriores.\n", + "\n", + "### Análisis Lexicográfico y Sintáctico" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [], + "source": [ + "import cmp.nbpackage\n", + "import cmp.visitor as visitor\n", + "\n", + "from cp13 import G, text\n", + "from cp13 import Node, ProgramNode, DeclarationNode, ExpressionNode\n", + "from cp13 import ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode\n", + "from cp13 import VarDeclarationNode, AssignNode, CallNode\n", + "from cp13 import AtomicNode, BinaryNode\n", + "from cp13 import ConstantNumNode, VariableNode, InstantiateNode, PlusNode, MinusNode, StarNode, DivNode\n", + "from cp13 import FormatVisitor, tokenize_text, pprint_tokens\n", + "\n", + "from cmp.tools.parsing import LR1Parser\n", + "from cmp.evaluation import evaluate_reverse_parse" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Análisis Semántico (Recolección y Construcción de Tipos)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [], + "source": [ + "from cmp.semantic import SemanticError\n", + "from cmp.semantic import Attribute, Method, Type\n", + "from cmp.semantic import VoidType, ErrorType, IntType\n", + "from cmp.semantic import Context\n", + "\n", + "from cp14 import TypeCollector, TypeBuilder" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Análisis Semántico (Chequeo de tipos)" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [], + "source": [ + "from cmp.semantic import Scope, VariableInfo\n", + "from cp15 import TypeChecker" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Transformación a CIL\n", + "\n", + "Partiendo de un AST semánticamente anotado (lo hicimos en las clases anteriores) queremos obtener un AST en otro lenguaje. Como es usual, realizaremos un recorrido por el AST original usando el patrón `visitor` pero esta vez pretendemos generar como salida un nuevo AST. Esto se traduce en devolver en el llamado principal de `visit`, el nodo que representa la raíz del nuevo lenguaje.\n", + "\n", + "El módulo `cmp.cil` provee una implementación de todos los nodos de CIL necesarios para transformar nuestro lenguaje. Además, se provee la implementación de `BaseCOOLToCILVisitor` que usaremos como base para realizar el recorrido. Esta clase contiene métodos auxiliares para facilitar la generación del nuevo AST.\n", + "\n", + "- Las variables de instancia `dottypes`, `dotdata` y `dotcode` almacenan los nodos correspondientes a las secciones `.TYPES`, `.DATA` y `.CODE` respectivamente de un programa en CIL.\n", + "- Las variables `current_type` y `current_method` almacenan instancias de `Type` y `Method` respectivamente.\n", + "- La variable `current_function` almacena el nodo `cil.FunctionNode` que está en proceso de construcción (estos nodos pertenecen a la sección `.CODE`).\n", + "- Para definir variables locales e instrucciones dentro de `current_function` se usan las funciones auxiliares `register_local` y `register_instruction` respectivamente.\n", + "- En caso de que se necesite definir una variable no declarada por el programador (para guardar resultados intermedios), el método `define_internal_local` provee un mecanismo para hacerlo.\n", + "- Los métodos `register_function` y `register_type` almacenan instancias de `cil.FunctionNode` y `cil.TypeNode` en las variables `dotcode` y `dottypes` respectivamente." + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [], + "source": [ + "class BaseCOOLToCILVisitor:\n", + " def __init__(self, context):\n", + " self.dottypes = []\n", + " self.dotdata = []\n", + " self.dotcode = []\n", + " self.current_type = None\n", + " self.current_method = None\n", + " self.current_function = None\n", + " self.context = context\n", + "\n", + " # for faster search\n", + " self.locals_dict = {}\n", + " self.param_set = set()\n", + " self.attr_set = set()\n", + " \n", + " @property\n", + " def params(self):\n", + " return self.current_function.params\n", + " \n", + " @property\n", + " def localvars(self):\n", + " return self.current_function.localvars\n", + " \n", + " @property\n", + " def instructions(self):\n", + " return self.current_function.instructions\n", + " \n", + " def register_local(self, vinfo):\n", + " vinfo.name = f'local_{self.current_function.name[9:]}_{vinfo.name}_{len(self.localvars)}'\n", + " local_node = cil.LocalNode(vinfo.name)\n", + " self.localvars.append(local_node)\n", + " return vinfo.name\n", + "\n", + " def define_internal_local(self):\n", + " vinfo = VariableInfo('internal', None)\n", + " return self.register_local(vinfo)\n", + "\n", + " def register_instruction(self, instruction):\n", + " self.instructions.append(instruction)\n", + " return instruction\n", + " \n", + " def to_function_name(self, method_name, type_name):\n", + " return f'function_{method_name}_at_{type_name}'\n", + " \n", + " def register_function(self, function_name):\n", + " function_node = cil.FunctionNode(function_name, [], [], [])\n", + " self.dotcode.append(function_node)\n", + " return function_node\n", + " \n", + " def register_type(self, name):\n", + " type_node = cil.TypeNode(name)\n", + " self.dottypes.append(type_node)\n", + " return type_node\n", + "\n", + " def register_data(self, value):\n", + " vname = f'data_{len(self.dotdata)}'\n", + " data_node = cil.DataNode(vname, value)\n", + " self.dotdata.append(data_node)\n", + " return data_node" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Implementación\n", + "\n", + "Pasemos a implementar un `visitor` concretamente. Para simplificar la implementación, asuma que el acceso (`VariableNode`) y asignación (`AssignNode`) de variables ocurre solo sobre variables locales. Realmente sería necesario desambiguar en cuales casos es un acceso a variable y en cuales un acceso a atributo. Esto queda propuesto como estudio individual." + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [], + "source": [ + "import cmp.cil as cil\n", + "\n", + "class MiniCOOLToCILVisitor(BaseCOOLToCILVisitor):\n", + " @visitor.on('node')\n", + " def visit(self, node):\n", + " pass\n", + " \n", + " @visitor.when(ProgramNode)\n", + " def visit(self, node, scope):\n", + " ######################################################\n", + " # node.declarations -> [ ClassDeclarationNode ... ]\n", + " ######################################################\n", + " \n", + " self.current_function = self.register_function('entry')\n", + " instance = self.define_internal_local()\n", + " result = self.define_internal_local()\n", + " main_method_name = self.to_function_name('main', 'Main')\n", + " self.register_instruction(cil.AllocateNode('Main', instance))\n", + " self.register_instruction(cil.ArgNode(instance))\n", + " self.register_instruction(cil.StaticCallNode(main_method_name, result))\n", + " self.register_instruction(cil.ReturnNode(0))\n", + " self.current_function = None\n", + " \n", + "\n", + " for declaration, child_scope in zip(node.declarations, scope.children):\n", + " self.attr_set.clear()\n", + " self.visit(declaration, child_scope)\n", + "\n", + " return cil.ProgramNode(self.dottypes, self.dotdata, self.dotcode)\n", + " \n", + " @visitor.when(ClassDeclarationNode)\n", + " def visit(self, node, scope):\n", + " \"\"\"\n", + " node.id -> str\n", + " node.parent -> str\n", + " node.features -> [ FuncDeclarationNode/AttrDeclarationNode ... ]\n", + " \"\"\"\n", + " \n", + " self.current_type = self.context.get_type(node.id)\n", + "\n", + " type_node = self.register_type(node.id)\n", + " \n", + " types = []\n", + " current_type = self.current_type\n", + " while current_type is not None:\n", + " types.append(current_type)\n", + " current_type = current_type.parent\n", + " \n", + " for current_type in reversed(types):\n", + " for attribute in current_type.attributes:\n", + " self.attr_set.add(attribute.name)\n", + " type_node.attributes.append(attribute.name)\n", + "\n", + " for method in current_type.methods:\n", + " type_node.methods.append((method.name, self.to_function_name(method.name, current_type.name)))\n", + " \n", + "\n", + " func_declarations = (f for f in node.features if isinstance(f, FuncDeclarationNode))\n", + " for feature, child_scope in zip(func_declarations, scope.children):\n", + " self.visit(feature, child_scope)\n", + " \n", + " self.current_type = None\n", + " \n", + " @visitor.when(FuncDeclarationNode)\n", + " def visit(self, node, scope):\n", + " \"\"\"\n", + " node.id -> str\n", + " node.params -> [ (str, str) ... ]\n", + " node.type -> str\n", + " node.body -> [ ExpressionNode ... ]\n", + " \"\"\"\n", + " \n", + " self.current_method = self.current_type.get_method(node.id)\n", + " self.current_function = self.register_function(self.to_function_name(node.id, self.current_type.name))\n", + " \n", + " # (Handle PARAMS)\n", + " self.param_set.clear()\n", + " self.current_function.params.append(cil.ParamNode('self'))\n", + " for name, _ in node.params:\n", + " self.param_set.add(name)\n", + " self.current_function.params.append(cil.ParamNode(name))\n", + " \n", + " self.locals_dict.clear()\n", + " child_scope = scope.children[0]\n", + " for instruction in node.body:\n", + " value = self.visit(instruction, child_scope)\n", + "\n", + " # (Handle RETURN)\n", + " if node.body and 'void' != node.type:\n", + " self.register_instruction(cil.ReturnNode(value))\n", + " else:\n", + " self.register_instruction(cil.ReturnNode())\n", + " \n", + " self.current_method = None\n", + "\n", + " @visitor.when(VarDeclarationNode)\n", + " def visit(self, node, scope):\n", + " \"\"\"\n", + " node.id -> str\n", + " node.type -> str\n", + " node.expr -> ExpressionNode\n", + " \"\"\"\n", + " vinfo = scope.find_variable(node.id)\n", + " dest = self.locals_dict[vinfo.name] = self.register_local(vinfo)\n", + " self.register_instruction(cil.AssignNode(dest, self.visit(node.expr, scope)))\n", + " return dest\n", + "\n", + " @visitor.when(AssignNode)\n", + " def visit(self, node, scope):\n", + " \"\"\"\n", + " node.id -> str\n", + " node.expr -> ExpressionNode\n", + " \"\"\"\n", + " if node.id in self.locals_dict:\n", + " dest = self.locals_dict[node.id]\n", + " self.register_instruction(cil.AssignNode(dest, self.visit(node.expr, scope)))\n", + " return dest\n", + " if node.id in self.param_set:\n", + " dest = node.id\n", + " self.register_instruction(cil.AssignNode(dest, self.visit(node.expr, scope)))\n", + " return dest\n", + " if node.id in self.attr_set:\n", + " pass # for now couse we are not handling set/get attrs\n", + "\n", + " @visitor.when(CallNode)\n", + " def visit(self, node, scope):\n", + " \"\"\"\n", + " node.obj -> AtomicNode\n", + " node.id -> str\n", + " node.args -> [ ExpressionNode ... ]\n", + " \"\"\"\n", + " \n", + " obj_dest = self.visit(node.obj, scope)\n", + " type_dest = self.define_internal_local()\n", + " self.register_instruction(cil.TypeOfNode(obj_dest, type_dest))\n", + "\n", + " args_dest = [obj_dest] + [self.visit(arg, scope) for arg in node.args]\n", + " for dest in args_dest:\n", + " self.register_instruction(cil.ArgNode(dest))\n", + " \n", + " call_dest = self.define_internal_local()\n", + " self.register_instruction(cil.DynamicCallNode(type_dest, self.to_function_name(node.id), call_dest))\n", + "\n", + " return call_dest\n", + "\n", + " @visitor.when(ConstantNumNode)\n", + " def visit(self, node, scope):\n", + " \"\"\"\n", + " node.lex -> str\n", + " \"\"\"\n", + " return node.lex\n", + "\n", + " @visitor.when(VariableNode)\n", + " def visit(self, node, scope):\n", + " \"\"\"\n", + " node.lex -> str\n", + " \"\"\"\n", + " if node.lex in self.locals_dict:\n", + " return self.locals_dict[node.lex]\n", + " if node.lex in self.param_set:\n", + " return node.lex\n", + " if node.lex in self.attr_set:\n", + " return node.lex # for now couse we are not handling set/get attr\n", + "\n", + " @visitor.when(InstantiateNode)\n", + " def visit(self, node, scope):\n", + " \"\"\"\n", + " node.lex -> str\n", + " \"\"\"\n", + " dest = self.define_internal_local()\n", + " self.register_instruction(cil.AllocateNode(node.lex, dest))\n", + " return dest\n", + "\n", + " @visitor.when(PlusNode)\n", + " def visit(self, node, scope):\n", + " \"\"\"\n", + " node.left -> ExpressionNode\n", + " node.right -> ExpressionNode\n", + " \"\"\"\n", + " dest = self.define_internal_local()\n", + " left = self.visit(node.left, scope)\n", + " right = self.visit(node.right, scope)\n", + " self.register_instruction(cil.PlusNode(dest, left, right))\n", + " return dest\n", + " \n", + "\n", + " @visitor.when(MinusNode)\n", + " def visit(self, node, scope):\n", + " \"\"\"\n", + " node.left -> ExpressionNode\n", + " node.right -> ExpressionNode\n", + " \"\"\"\n", + " dest = self.define_internal_local()\n", + " left = self.visit(node.left, scope)\n", + " right = self.visit(node.right, scope)\n", + " self.register_instruction(cil.MinusNode(dest, left, right))\n", + " return dest\n", + "\n", + " @visitor.when(StarNode)\n", + " def visit(self, node, scope):\n", + " \"\"\"\n", + " node.left -> ExpressionNode\n", + " node.right -> ExpressionNode\n", + " \"\"\"\n", + " dest = self.define_internal_local()\n", + " left = self.visit(node.left, scope)\n", + " right = self.visit(node.right, scope)\n", + " self.register_instruction(cil.StarNode(dest, left, right))\n", + " return dest\n", + "\n", + " @visitor.when(DivNode)\n", + " def visit(self, node, scope):\n", + " \"\"\"\n", + " node.left -> ExpressionNode\n", + " node.right -> ExpressionNode\n", + " \"\"\"\n", + " dest = self.define_internal_local()\n", + " left = self.visit(node.left, scope)\n", + " right = self.visit(node.right, scope)\n", + " self.register_instruction(cil.DivNode(dest, left, right))\n", + " return dest\n", + " \n", + " # ======================================================================" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Auxiliar Methods" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [], + "source": [ + "def inspect_scope(scope, indent=0):\n", + " print('\\t' * indent + f'Locals: {[i.name for i in scope.locals]}')\n", + " \n", + " for child in scope.children: \n", + " inspect_scope(child, indent + 1)\n", + "\n", + "def find_unmatch(s1, s2):\n", + " if len(s1) != len(s2):\n", + " print(f'Different len {len(s1)}, {len(s2)}')\n", + "\n", + " for i, (c1, c2) in enumerate(zip(s1, s2)):\n", + " if c1 != c2:\n", + " print(f'Unmatch ({c1}, {c2}) in index {i}')\n", + " print(s1[i:])\n", + " break" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Pipeline\n", + "\n", + "Actualicemos el método `run_pipeline` para incluir esta nueva fase. Con eso deberíamos completar una línea de ejecución que, partiendo desde el programa en texto plano y la gramática, produzca una representación en CIL." + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [], + "source": [ + "from cp15 import run_pipeline as deprecated_pipeline\n", + "from cmp.cil import get_formatter\n", + "\n", + "formatter = get_formatter()\n", + "\n", + "def run_pipeline(G, text):\n", + " ast, errors, context, scope = deprecated_pipeline(G, text)\n", + " print('============= TRANSFORMING TO CIL =============')\n", + " cool_to_cil = MiniCOOLToCILVisitor(context)\n", + " cil_ast = cool_to_cil.visit(ast, scope)\n", + " formatter = get_formatter()\n", + " print(formatter(cil_ast))\n", + " return ast, errors, context, scope, cil_ast" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Programa #1\n", + "\n", + "El siguiente programa no debería contener errores." + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": "=================== TEXT ======================\n\nclass A {\n a : int ;\n def suma ( a : int , b : int ) : int {\n a + b ;\n }\n b : int ;\n}\n\nclass B : A {\n c : int ;\n def f ( d : int , a : A ) : void {\n let f : int = 8 ;\n let c = new A ( ) . suma ( 5 , f ) ;\n c ;\n }\n}\n\n================== TOKENS =====================\nclass id {\n id : id ;\n def id ( id : id , id : id ) : id {\n id + id ;\n }\n id : id ;\n}\nclass id : id {\n id : id ;\n def id ( id : id , id : id ) : id {\n let id : id = int ;\n let id = new id ( ) . id ( int , id ) ;\n id ;\n }\n}\n$\n=================== PARSE =====================\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> id\n -> \n -> \n -> \n -> id\n -> \n -> \n -> + \n -> \n -> ;\n -> def id ( ) : id { }\n -> id : id ;\n -> e\n -> \n -> \n -> \n -> class id { }\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> int\n -> \n -> \n -> \n -> \n -> let id : id = \n -> new id ( )\n -> \n -> int\n -> \n -> \n -> \n -> \n -> id\n -> \n -> \n -> \n -> \n -> \n -> , \n -> . id ( )\n -> \n -> \n -> \n -> \n -> let id = \n -> id\n -> \n -> \n -> \n -> \n -> ;\n -> ; \n -> ; \n -> def id ( ) : id { }\n -> e\n -> \n -> \n -> class id : id { }\n -> \n -> \n -> \n==================== AST ======================\n\\__ProgramNode [ ... ]\n\t\\__ClassDeclarationNode: class A { ... }\n\t\t\\__AttrDeclarationNode: a : int\n\t\t\\__FuncDeclarationNode: def suma(a:int, b:int) : int -> \n\t\t\t\\__ PlusNode \n\t\t\t\t\\__ VariableNode: a\n\t\t\t\t\\__ VariableNode: b\n\t\t\\__AttrDeclarationNode: b : int\n\t\\__ClassDeclarationNode: class B : A { ... }\n\t\t\\__AttrDeclarationNode: c : int\n\t\t\\__FuncDeclarationNode: def f(d:int, a:A) : void -> \n\t\t\t\\__VarDeclarationNode: let f : int = \n\t\t\t\t\\__ ConstantNumNode: 8\n\t\t\t\\__AssignNode: let c = \n\t\t\t\t\\__CallNode: .suma(, ..., )\n\t\t\t\t\t\\__ InstantiateNode: new A()\n\t\t\t\t\t\\__ ConstantNumNode: 5\n\t\t\t\t\t\\__ VariableNode: f\n\t\t\t\\__ VariableNode: c\n============== COLLECTING TYPES ===============\nErrors: []\nContext:\n{\n\ttype int {}\n\t\n\ttype void {}\n\t\n\ttype A {}\n\t\n\ttype B {}\n\t\n}\n=============== BUILDING TYPES ================\nErrors: [\n]\nContext:\n{\n\ttype int {}\n\t\n\ttype void {}\n\t\n\ttype A {\n\t\t[attrib] a : int;\n\t\t[attrib] b : int;\n\t\t[method] suma(a:int, b:int): int;\n\t}\n\t\n\ttype B : A {\n\t\t[attrib] c : int;\n\t\t[method] f(d:int, a:A): void;\n\t}\n\t\n}\n=============== CHECKING TYPES ================\nErrors: [\n]\n============= TRANSFORMING TO CIL =============\n.TYPES\ntype A {\n\tattribute a\n\tattribute b\n\n\tmethod suma: function_suma_at_A\n}\ntype B {\n\tattribute a\n\tattribute b\n\tattribute c\n\n\tmethod suma: function_suma_at_A\n\tmethod f: function_f_at_B\n}\n\n.DATA\n\n\n.CODE\nfunction entry {\n\t\n\n\tLOCAL local__internal_0\n\tLOCAL local__internal_1\n\n\tlocal__internal_0 = ALLOCATE Main\n\tARG local__internal_0\n\tlocal__internal_1 = CALL function_main_at_Main\n\tRETURN 0\n}\nfunction function_suma_at_A {\n\tPARAM self\n\tPARAM a\n\tPARAM b\n\n\tLOCAL local_suma_at_A_internal_0\n\n\tlocal_suma_at_A_internal_0 = a + b\n\tRETURN local_suma_at_A_internal_0\n}\nfunction function_f_at_B {\n\tPARAM self\n\tPARAM d\n\tPARAM a\n\n\tLOCAL local_f_at_B_f_0\n\n\tlocal_f_at_B_f_0 = 8\n\tRETURN \n}\n" + } + ], + "source": [ + "text = '''\n", + "class A {\n", + " a : int ;\n", + " def suma ( a : int , b : int ) : int {\n", + " a + b ;\n", + " }\n", + " b : int ;\n", + "}\n", + "\n", + "class B : A {\n", + " c : int ;\n", + " def f ( d : int , a : A ) : void {\n", + " let f : int = 8 ;\n", + " let c = new A ( ) . suma ( 5 , f ) ;\n", + " c ;\n", + " }\n", + "}\n", + "'''\n", + "\n", + "text_cil_no_attr = '''.TYPES\n", + "type A {\n", + "\tattribute a\n", + "\tattribute b\n", + "\n", + "\tmethod suma: function_suma_at_A\n", + "}\n", + "type B {\n", + "\tattribute a\n", + "\tattribute b\n", + "\tattribute c\n", + "\n", + "\tmethod suma: function_suma_at_A\n", + "\tmethod f: function_f_at_B\n", + "}\n", + "\n", + ".DATA\n", + "\n", + "\n", + ".CODE\n", + "function entry {\n", + "\t\n", + "\n", + "\tLOCAL local__internal_0\n", + "\tLOCAL local__internal_1\n", + "\n", + "\tlocal__internal_0 = ALLOCATE Main\n", + "\tARG local__internal_0\n", + "\tlocal__internal_1 = CALL function_main_at_Main\n", + "\tRETURN 0\n", + "}\n", + "function function_suma_at_A {\n", + "\tPARAM self\n", + "\tPARAM a\n", + "\tPARAM b\n", + "\n", + "\tLOCAL local_suma_at_A_internal_0\n", + "\n", + "\tlocal_suma_at_A_internal_0 = a + b\n", + "\tRETURN local_suma_at_A_internal_0\n", + "}\n", + "function function_f_at_B {\n", + "\tPARAM self\n", + "\tPARAM d\n", + "\tPARAM a\n", + "\n", + "\tLOCAL local_f_at_B_f_0\n", + "\n", + "\tlocal_f_at_B_f_0 = 8\n", + "\tRETURN \n", + "}'''\n", + "\n", + "if __name__ == '__main__':\n", + "\tast, errors, context, scope, cil_ast = run_pipeline(G, text)\n", + "\tassert formatter(cil_ast) == text_cil_no_attr" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Propuestas\n", + "\n", + "- Maneje el acceso y asignación a atributos (`GETATTR` y `SETATTR`).\n", + "- Implemente un intérprete de `CIL`." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.3-final" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} \ No newline at end of file diff --git a/src/cool/code_generation/notebooks/lexer.py b/src/cool/code_generation/notebooks/lexer.py new file mode 100644 index 000000000..8700884a6 --- /dev/null +++ b/src/cool/code_generation/notebooks/lexer.py @@ -0,0 +1,162 @@ +from cmp.ast import AtomicNode, BinaryNode, UnaryNode +from cmp.automata import State +from cmp.pycompiler import Grammar +from cmp.tools.automata import DFA, NFA, automata_closure, automata_concatenation, automata_minimization, automata_union, nfa_to_dfa +from cmp.tools.evaluation import evaluate_parse +from cmp.tools.parsing import metodo_predictivo_no_recursivo +from cmp.utils import Token + + +class EpsilonNode(AtomicNode): + def evaluate(self): + return DFA(states=1, finals=[0], transitions={}) + + +class SymbolNode(AtomicNode): + def evaluate(self): + s = self.lex + return DFA(states=2, finals=[1], transitions={(0, s): 1}) + + +class ClosureNode(UnaryNode): + @staticmethod + def operate(value): + return automata_closure(value) + + +class UnionNode(BinaryNode): + @staticmethod + def operate(lvalue, rvalue): + return automata_union(lvalue, rvalue) + + +class ConcatNode(BinaryNode): + @staticmethod + def operate(lvalue, rvalue): + return automata_concatenation(lvalue, rvalue) + + +def regex_tokenizer(text, G, skip_whitespaces=True): + tokens = [] + fixed_tokens = {x: Token(x, G[x]) for x in ['|', '*', '(', ')', 'ε']} + iter_text = iter(text) + for c in iter_text: + if c == '\\': + tokens.append(Token(next(iter_text), G['symbol'])) + continue + + if skip_whitespaces and c.isspace(): + continue + + try: + token = fixed_tokens[c] + except KeyError: + token = Token(c, G['symbol']) + tokens.append(token) + tokens.append(Token('$', G.EOF)) + return tokens + + +def build_grammar(): + G = Grammar() + E = G.NonTerminal('E', True) + T, F, A, X, Y, Z = G.NonTerminals('T F A X Y Z') + pipe, star, opar, cpar, symbol, epsilon = G.Terminals('| * ( ) symbol ε') + E %= T + X, lambda h, s: s[2], None, lambda h, s: s[1] + X %= pipe + E, lambda h, s: UnionNode(h[0], s[2]) + X %= G.Epsilon, lambda h, s: h[0] + T %= F + Y, lambda h, s: s[2], None, lambda h, s: s[1] + Y %= T, lambda h, s: ConcatNode(h[0], s[1]) + Y %= G.Epsilon, lambda h, s: h[0] + F %= A + Z, lambda h, s: s[2], None, lambda h, s: s[1] + Z %= star, lambda h, s: ClosureNode(h[0]) + Z %= G.Epsilon, lambda h, s: h[0] + A %= symbol, lambda h, s: SymbolNode(s[1]) + A %= epsilon, lambda h, s: EpsilonNode(s[1]) + A %= opar + E + cpar, lambda h, s: s[2] + return G + + +G = build_grammar() +parser = metodo_predictivo_no_recursivo(G) + + +class Regex: + def __init__(self, regex, skip_whitespaces=False): + self.regex = regex + self.automaton = self.build_automaton(regex) + + def __call__(self, text): + return self.automaton.recognize(text) + + @staticmethod + def build_automaton(regex, skip_whitespaces=False): + tokens = regex_tokenizer(regex, G, skip_whitespaces=False) + left_parse = parser(tokens) + ast = evaluate_parse(left_parse, tokens) + nfa = ast.evaluate() + dfa = nfa_to_dfa(nfa) + dfa = automata_minimization(dfa) + return dfa + + +class Lexer: + def __init__(self, table, eof): + self.eof = eof + self.regexs = self._build_regexs(table) + self.automaton = self._build_automaton() + + def _build_regexs(self, table): + regexs = [] + for n, (token_type, regex) in enumerate(table): + automaton = Regex.build_automaton(regex) + automaton, states = State.from_nfa(automaton, get_states=True) + + for state in states: + if state.final: + state.tag = (n, token_type) + + regexs.append(automaton) + return regexs + + def _build_automaton(self): + start = State('start') + regexs = self.regexs + + for regex in regexs: + start.add_epsilon_transition(regex) + + return start.to_deterministic() + + + def _walk(self, string): + state = self.automaton + final = state if state.final else None + final_lex = lex = '' + + for symbol in string: + try: + state = state[symbol][0] + lex += symbol + final, final_lex = (state, lex) if state.final else (final, final_lex) + except TypeError: + break + + return final, final_lex + + def _tokenize(self, text): + while text: + state, lex = self._walk(text) + + if state is not None: + text = text[len(lex):] + token_type = min((s for s in state.state if s.final), key=lambda x: x.tag).tag[1] + yield lex, token_type + + else: + return None + + yield '$', self.eof + + def __call__(self, text): + return [Token(lex, token_type) for lex, token_type in self._tokenize(text)] From a19c142ad7e2997e70c660345384fccc41a552cd Mon Sep 17 00:00:00 2001 From: AlejandroKlever Date: Wed, 29 Sep 2021 14:50:00 -0400 Subject: [PATCH 122/143] Added a constructor --- doc/14-code-gen.pdf | Bin 0 -> 143633 bytes doc/SPIM_Manual.pdf | Bin 0 -> 518753 bytes src/cool/__main__.py | 70 +- src/cool/code_generation/base.py | 76 +- src/cool/code_generation/cil.py | 142 ++- .../code_generation/cool_to_cil_visitor.py | 116 +++ .../cmp/.ipynb_checkpoints/ast-checkpoint.py | 29 + .../.ipynb_checkpoints/automata-checkpoint.py | 167 ++++ .../languages-checkpoint.py | 364 +++++++ .../nbpackage-checkpoint.py | 94 ++ .../pycompiler-checkpoint.py | 448 +++++++++ .../.ipynb_checkpoints/tools-checkpoint.py | 21 + .../.ipynb_checkpoints/utils-checkpoint.py | 156 +++ .../.ipynb_checkpoints/visitor-checkpoint.py | 85 ++ .../code_generation/notebooks/cmp/__init__.py | 0 src/cool/code_generation/notebooks/cmp/ast.py | 70 ++ .../code_generation/notebooks/cmp/automata.py | 224 +++++ src/cool/code_generation/notebooks/cmp/cil.py | 266 +++++ .../notebooks/cmp/evaluation.py | 36 + .../notebooks/cmp/languages.py | 399 ++++++++ .../notebooks/cmp/nbpackage.py | 94 ++ .../notebooks/cmp/pycompiler.py | 513 ++++++++++ .../code_generation/notebooks/cmp/semantic.py | 250 +++++ .../.ipynb_checkpoints/__init__-checkpoint.py | 0 .../.ipynb_checkpoints/automata-checkpoint.py | 10 + .../evaluation-checkpoint.py | 10 + .../.ipynb_checkpoints/parsing-checkpoint.py | 21 + .../notebooks/cmp/tools/__init__.py | 0 .../notebooks/cmp/tools/automata.py | 10 + .../notebooks/cmp/tools/evaluation.py | 10 + .../notebooks/cmp/tools/parsing.py | 40 + .../notebooks/cmp/tools/regex.py | 10 + .../code_generation/notebooks/cmp/utils.py | 241 +++++ .../code_generation/notebooks/cmp/visitor.py | 85 ++ src/cool/code_generation/notebooks/cp16.ipynb | 934 +++++++++++------- src/cool/code_generation/notebooks/lexer.py | 255 ++--- src/cool/grammar.py | 390 +++++--- src/cool/lexertab.py | 26 +- src/cool/parsertab.py | 151 ++- src/cool/semantics/utils/astnodes.py | 6 +- src/cool/visitor/visitor.py | 6 +- src/coolc.py | 22 +- tests/codegen_test.py | 14 +- tests/conftest.py | 12 +- tests/lexer_test.py | 12 +- tests/parser_test.py | 12 +- tests/semantic_test.py | 15 +- tests/utils/__init__.py | 2 +- tests/utils/utils.py | 116 ++- 49 files changed, 5167 insertions(+), 863 deletions(-) create mode 100644 doc/14-code-gen.pdf create mode 100644 doc/SPIM_Manual.pdf create mode 100644 src/cool/code_generation/cool_to_cil_visitor.py create mode 100644 src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/ast-checkpoint.py create mode 100644 src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/automata-checkpoint.py create mode 100644 src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/languages-checkpoint.py create mode 100644 src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/nbpackage-checkpoint.py create mode 100644 src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/pycompiler-checkpoint.py create mode 100644 src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/tools-checkpoint.py create mode 100644 src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/utils-checkpoint.py create mode 100644 src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/visitor-checkpoint.py create mode 100644 src/cool/code_generation/notebooks/cmp/__init__.py create mode 100644 src/cool/code_generation/notebooks/cmp/ast.py create mode 100644 src/cool/code_generation/notebooks/cmp/automata.py create mode 100644 src/cool/code_generation/notebooks/cmp/cil.py create mode 100644 src/cool/code_generation/notebooks/cmp/evaluation.py create mode 100644 src/cool/code_generation/notebooks/cmp/languages.py create mode 100644 src/cool/code_generation/notebooks/cmp/nbpackage.py create mode 100644 src/cool/code_generation/notebooks/cmp/pycompiler.py create mode 100644 src/cool/code_generation/notebooks/cmp/semantic.py create mode 100644 src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/__init__-checkpoint.py create mode 100644 src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/automata-checkpoint.py create mode 100644 src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/evaluation-checkpoint.py create mode 100644 src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/parsing-checkpoint.py create mode 100644 src/cool/code_generation/notebooks/cmp/tools/__init__.py create mode 100644 src/cool/code_generation/notebooks/cmp/tools/automata.py create mode 100644 src/cool/code_generation/notebooks/cmp/tools/evaluation.py create mode 100644 src/cool/code_generation/notebooks/cmp/tools/parsing.py create mode 100644 src/cool/code_generation/notebooks/cmp/tools/regex.py create mode 100644 src/cool/code_generation/notebooks/cmp/utils.py create mode 100644 src/cool/code_generation/notebooks/cmp/visitor.py diff --git a/doc/14-code-gen.pdf b/doc/14-code-gen.pdf new file mode 100644 index 0000000000000000000000000000000000000000..2be5bfe014b210864d16d681b944f8c5a6941c98 GIT binary patch literal 143633 zcmb5UV{m3&*DV~|=p-H6HafQLE4FQ$9oy;Hwr$(C)3HuJ?>TSPS9N#QcR%~buC;&e zHO820%`pe5ys#)OBONOY>CD353JfC)0Rw@pfdvc?4-CDuv5l#d838i`Gr|9TVCY57 zt(=S<2?E$>*QlmALf^h>9< zCOzP;Nro*1&Vsimq~8sm@ZN7X(6UWbfj5@aR8$NZ80I~9A3I1*bY2v-nf;BAkWF;@ zYI8mA;kE`vTsH^+DyV+B4BwxH!_D0(6|ZG4P|CJ|m$uC2!p5at){+JNHF~hwjV`nL zFrGw)=&bOVMKqo)Db^M(|9D?9#RwuaC^Iq<1ubbIPlce--W|c6W0ODT8bsqTZ`zby z^G4HUhKCZ#SO0-geSZLJ7+GfxV{Bve|90-r>OZ^A#Qe|gXXRx1*V{j-A{CRtfYf!Y zHi3-5;iJd!gKbT@bj~Kj!P0|ZAUq7j$Y1%a` zPe&poKF>=K9vs;|KL`xZvCj=GI%IL@JbKnQAxOfGew38OvPE_BN<#!@LyFSUDKG6K zQkrvxya`xtebuq}dcN0gg0m(zjA1XfiXT}*XeS=|J83N4Zu?Ws186U?ZF%_v?>*>| zb;Dv5nbMco>uoDe6%*diG!RhEt!#e955B*u0sj@AxhYsPxMC&x%Dczh0^w>@+4LQj1 zjWdIiE_C%{t;rUXC9W@X=nlE8TGaet#~#CcWaUs}`{LuwBn|5W_{j|F#ubLhlS|FF zHisYP=eP!{VH;k&ueQBYdy^MafLR%rEfq`u?6wQ_nk~KBS-|F&%(crD`c#Sd=T>Sr zDLws%zy}2NMbFV+7|QuihO)3R{A-2|D)-tfFd%hat3?fv#)VnR?F~?pM`(gkDQffq zD}wHE+@V^Ln?!Ujgc%Z{v{)OR_zG46^I$@G$C`>!nT}W; z1t$s%8kC5Trx9QrMdhc&lyjtze8%js?WY)GQ4dW8pHh`&_ZTtq$D*d!0fgj4EDv{F zaPqYx!GM`^P7e~$IuxM#r7k1gZ4 z>sI%VFk2lHGaiyIFN!vQEY(a$WnNOG=c%EY%Y7?$N{94G!0pD#SFaH!)G!_lEx&ga zI+pK^y46-F?AG!O{mg*QM%}R02G47 z(Pl|wt+l?InR4{xQo~cEZWMxT#MF8D^@z?Q8?lRtM>G`@^0bk^A35x9{pkv zv$6Zj7wvfPg1hXuh`>L&!OZ$kZZNZO{(EjH{*e1~cx=8=%VuQ~s=Zxs{6rG+Peye1 zLkU7M2rI!RER>L#`-%x9mS2<1LJIu2+S+{ip>-4s8hVbrEwn4o@$Li%SqdE;XkMh>I~86B#O4 z(LBHj9)h^akH}w}Jho~l=|_?Pg+#qIKVx}$#}u2!@W8}l()hZ_P4ZUOUEQ%469xp> za1eQZ!Z+yeB1oc)FsqjIE^O7AVTl!ug`3JUDHKiApuJ4^w)K8+o-UO~9{rh@+o77N2)z+&e3FTj$K>gPx6I9BV}KZ?EVYQ|r6n_r6{3M2iYftY74 znJZ)QU2f0UH9;oMhaVXkaaG^cWose?y#@r>)t^JqDGXs7hnWBSo~lJ|Do4D(2ekW* zm%%IhK}nu2i+PEfowUqUYgDjL?NSCp>ZmRY>5c9MXm@jh)S1k8xFKP`2q|NzIUJg0 zL16QPK9X3vonV=9hIpeDwu02f#j-zGjSpC@Qun_N->`bOEF6}+=tX^#zY!)`5jE^f zA`MHlPrO}SwoD-)&44Z)t5~OKs&dKRoG2J7f+4Q6swHn%L~xZ|*kVA{OiU`yFwnS) zVHs??zp7lFnoh?^!#>t_JG^$D)5c}N(Ec7q;_}hH<@M~uZP9t(BuD4}+{1NkYvZWi7m z6qGd)N$R!Is4pVQfDaJMXPMz*7y4hawqZ~chSuIMoCsKNeK`cfx6yH!ziCYAbkaJ~{ z7DW^f*Mu2jc8w0!uHTKdSGdY zA~5U;^uFkwm?()e+9V0`Ms_WYm}Ph9EEt7W3bv-Vd|bwQzWzUMY+5-UugzJ~rm#TK zf?#t5oIoSQsr)2J77z*BLZprl*wzou=N>rjvn0RleiUW8cxNqPa&Xa?8zhi;WEB^B zqI+{Ktt1%99BT{k_xTxYvJ?l+0rB{o6wSDJ+hlO$W=$yoE27NV>4uAYQT7P+1z8;= zbB*r{)3;9FyAspn4-3Kzn1vA4z-cWrgYJ3N)YRW}P5;Jp*I6zklK!aY-TtPt0yIx# z(|5;lEPIjODX6xcqHR!^(Bj2=YD@d>K`YuIupFO2Lc3fE4iSW^7OZ1k=4?0-FR7Vh zN5M1jx|GRUkWpbJ(G96Tw6MWS8iI*`R2!PPX?nj(!xf${GJUUN*%T`3cRxf2xxQgK z5{@?c_UW8yvtG+ofNMEMDc=tkV>IEQblYgNTcz?E*90TbX=S}j_Keb^3*XgqU!m3Ad@9mf$#)(w2QQt$8= z7P0-aR ziw1y170F?g{UiMH*fg{si35lA83rb_Z#S@gmjIrLnpH1MI@g~muzhGy^UukO`u$Ak zSBL{tx!P?Jg<&3VMPY7X#xs2?(G03$uPgiK*`>gonG3Q21zD1S_*D)7Plo!Ow=@?G|(KV zt|6>hz)CRB+TL%68Y~CEnKcCnFsWqxFPS_KJMJYA8WRKCZ$@Y}#Bb$%cD_xm6Psma zKdx04283jdNQ#WeNkWGpWBF|*P zOIV9tAB@2W-I`P+3x5-*ljtO$FPz*cRY!hOfI*B_W%~l9B!8B=={-I@YTT?|HE2D` ztO<*tI3j5$jTmDf(q{TTL^4gsbVaO}@pGD>twf~_jX23HsfAWf<4+>vsW zRWag6={c}FF5w(LAE2aNZvjWad*sReOgBZvqG!7e7;v0ByowqE9YN11dl+GUCDY~<>~q>jw~{| zyg9X!Tgu1djq)VG$@++d;sWYsT);6DDOEqaC%4`NK|~F){M8dd!#{V-f07nR(?G-* zaUzN?lwS)Ks&F`me=fx~fs?U@+~Ozg%#5bO^A>|}ts6`7bS0p)RYqo1Ij2|&VJ$tX z-k5Ifnn_|dtFHm)L#O(YIQjc_P2*@U#b}m^@9IXw!%>+j3u?nTa(VN1hlo1VjPq0LBz%8Bs)5{QrpwA4IfF$UN@S}gG8YHOEG znU~$zCAj;U+&S(9Z=RbK_K1~n*~!tLGlG?C-*i0R=kp6-9N7)zW%c?O$+7=aa;yyO z|GvcjIjGke;5v`h?AYH3L>59xt5@{F_wt4O4bp7a5oGfrAmG{?adS7Tb7(jL@y=%P zl`Fj-4bqBUF^O0e{=JJqxCC6np@=r2{^A_0g22m}L~^-}cI+?jS~I>v5q~;ad+^Ke z2+c?IBBT&QgMW_wW@g_=NzNd#P*C5_Dcv`ZG`S+IW50NqG`o@O9{E8MyWm7p$^+`> z?|@~%woUSQU8yw&YHxxWI%gS8JtFDx5a@{6m?D0-I4Y?>!Jz|O=EGtC(Boi_Y*>kg@?qOaM(TMzFN4e2ji>DuDdj1nk1fD&XsY~31%wbym$y*Hy<)35T&*P-BjjeNl7QL}9^)|YGg zC56kk*>f5@PdGcU>;6|LF$)IglJ`k?q2?^3H@EB1l{Q&tp=s^XsfN!sS?1vO(uUjs zXxE78+OTj-Q`DugZ_bPmmpSyCi2Zmsq4PNIR50 z?Y9rZBGL`BXU6nQT$d-u!5CEwztMKX7ZBuZ=W02|$@zfq-eLg%q!RnzOg!fQ;?Ae? zzf`(0!>^E!f7nIfb`nywq6nG1aWQwXvnFSVRnN*o_;^X6We=Y>5tu_i?=6y!K-*>( zA)*1=wFvTz*OaJyH)e&>X3B2`D#FZ@76kNo{k{yJ|6}CAoahEXmtfRXN95ece}7F` znljG~*CkehxKg<4xis~fcqPP&E{+0*hejj~G(t#+g7b%#loyRXu-o@8^TFoR8ylai z$h04&=G%E>rq`tGT#SNkbJ22`f96Y=9)FlS`%=}Bd<)(%8-#ZycP7Z(h0f>J_1#^g@mY<0Uu}B#tCp0&9T)Ee_I#(@mQx&i zJ|7W~rS~%O(WP5Qu9NgJY+cU<|!Hi~RlX6I84L?>cWvKGI z0w#=n^yxWL==}zYM-R4VahwwU9s{HH~lUA>Z zSj{iQ$H$#s%Ey!QpYUwQE|bbL0F)qH3`KrSWLeK-@@V4bwq}_^SwQfjh~sjjoD%D) zbt}z1i)(UG$>!%pmrDB3@6WW;>!Ug6jh}Y1!Yk~Th8*rcH^*KWCQQ*eTyD`H95`*rCi|GXUq2-;bDr=?FK`7FxR8>9xctegSsEwtrPjyg||M-v5%8VB4~l|hz6&i z45Ah#pXFD%BNQ9VgD|yjJl|-8E*fy2>wp~|Wo#Bhw0uma0Hl?wdFN=~3nV9ZYn3PYx2MJYBOk(pVB(ut21Sp03% zYQ+mfyJqSNmK@l#Ff9F^coCoz6ql2_!`XK}cmS@MqsIDOtiL2i0sjL{ABz25{sksH zq5iewk`3^U=%gzst~%g+ylg$WzY>p}ZzwlK=;hSQL^t32HshUE3W+pfU44Ggi>ua5 zm(a_X;YB9S)luAkWBky#`&^LOr_)H+5_$ysVw8wnE-sp z_iqE=%(Opuzw5>dT^2ro5rSn+(M+V5z!=;Ws~)2mBrgd zQ@3EBvM*BW;SEWAg#x-8K&2u6#~Lu(;m^RwVNV(fR9K*-;ibDDrHa%YJQmWT*9jQ} zc%mZW`X$*H(A{Qu_UQUFRy{O<3r`9D1(Uy+=FIH>g=zl(jL~~)gd(Fb%bd#rN(10V zG+`A55rbSfl?2teIk0pm!FSgS9g>q!Wkv#sx0k7>tIo`ReQ=yB9v{EH{F-MQW*noS z32}H#VpPmtve3dOC*jvWez{Py`9h6GufByx1Ul9Un_*Z(O4{cizg&|M+9!10v6;Pe z8Jj3TUb+m55D=iBPR&n?8G|Cu>~<^W%!w!%9>=!@k#|#GQDis7I(FaP2$ace+Ej1^?|UZK7S zkP$hNei)sND_WaBK$7fD6o}VKydOGSNqHQ;&p(^L^$~pD)da~m6rv!RFUweJ(@>BY zHd~WXa4xkB7+26qX3feumq`Om1Su~bE>@L3_%rTHEZeqLezR6kQ|@X~-B@vT{G@c; zQcp;cdNi4AsOqJw(*Y3A!OO+*PHTU>y5bgWVcZrRp!^fTKQp+0%tcuk|9!n3RG7A% zXF%)vqpBz=k1$id_3(Q0P+)9SgS8VPnXvp)r47Zz0pd{v)IHzfEyuh|s)rzsmF>3| z@9R~ZZ#}yoVYYcU6g;0d$OueACIt`^anKXF^$hsl9<#rqy1@$&L|LFNxIOOc z&5czrUK^!!X)%L^Dl`1O|u-V z|Gptm0LbLKbL|Zo>-*7hoO)@RMRbc`-P;HC`=`PPmYG zEScGI_emaG<||b_^NbxK&u$qpO$hb*FvlEQEz-?i!NLbH=e*_H5qcE?z#!3uE@Gnz z*3sDt8uBanmn9|fuIFP8l|7h9yV7ZunCyx6RgE|}6dBZrDQmV4=qSEN2E|IZ9>Qv` z$bRlGp&MR={H&k!p-Lh`nU3#UBh02*;zOb zQ%)3-kS-n{Gm=T_m#F40@Twd8CX;kHVfdP^hm=~ys1GnnK1p`DeJ^c}!ij2Ftl(i47;J zg2*y%qf#qUXhXkQCdp0`Am? zTDv_74a$e6{DLA(LV-cpKw4pXJst3wQK%gND2Sc0(eqGl$rl87QGf}|&O-ajR|I|* z7I$-ql(N-5Uwx=V>H$52%meC#5Fv%-7njw*4Akj0y_Qj;Js!ZwbM4MSy;>}X*n}io zExS-9ZHwfYoXNccIZ%b4Z zi@{gSG6S@<;V^lB08Z4)0&C63t8BS8mL{(<%s+bi7KIKhUwsnU85(w)-%1XBF*2ELWfuJku<{6+07?Ei(sswnfH;KiTzKWYKCr0*ONPS&+q z5!<=Eibw?8{`_$V9zl?Zj1{R;`Jo$wsfJQRl~d)%j_Gt1zU@}3AOu?1)CpGIH;qWX zb*TSO`eLfb`9K*UKFUFg?4n=Z_k}@beM=Wt%P{y zQRc94dO6ZPFXcWysgIT*xA$~#L%*A1^a%M}&)fbNvivP1#lrSqctwgbwweFQKvZM? z8R|qDVp|dDDq^#$l#8pVZKUJi+z^p~l&%8)!3N zs4K$y5t`3hESS6l5@_(7RMa6-O!&yv>OiUMkRWKxZ@u8DD340_rCLn>`VuG|EMpVf zf|QW&1~e_O$HOk&M)e7nQ~n|(Q6!;Oz|hDnAas~{Ou-d?+gmE@70ybHS@=QP9x-Fb zwWf)Y2GtAEY*f`YLRf5Wxic+E?V0#1-T72nUvzKw(id^6a#g>;Fi9z8(&on$}=Eu_6QQ?=Uw~n6Zf@l@uW+wW1%j* z`EjPqZ8o{4C>(WZemACCoQF{AXrr8o>U_K~Sd~b$<7rlBeW|m6JOc0A25kkALlu0b z<)T{}Cv(myZ>v8`3ma7JoP8N{TGaeuc0Nrmz2})uS(cHbmSZdWn61Hm@Uuo0_p>4k z_^A=Eud5AS=a@&g+@p{_ClwcNAbQIAm?MY7P1-EIYwgA4taV!Fk-`>MEo&UGS&8+$ z!fL>`v>wiz>#;R3I8t%!C_L2J#X3-GimY#yz<3o{uhog{cZ5a_+JF+68?uH zA=huzqG!QBc2*$nXN!{7%EC1(m7NDGM|&gT8-)oOFUk}azjQ!NFkB=!{uC6(z@scv z9V<9ay%xZ3y|^?98E-lq1br^W9p+3dks#;{O5I{}Wd7GTWPLphQLGc3DW&z+G6Ilx zVFg{5QL8U-%HU7vw~*rH%eiI5(X+D$~N^U5&EI`RvD5+Vw3g{7z=Em*WizNx`G9H*X-Ou_92; z+c$}IS(xZ5W07k;iUBbdnnj*~a?mfzanZ-tj<-q=8kQ5=E+4P%)|=N!<@!>v>PpZ4 zqnWi@YNH>;Ypop9%cO0Q{?EcU||fS{Hv9` zdzTuL(5b3_?qj&(8J1dHP`07=Su z%sLxV*LAfXBDj&B$bIQBrP;i5?O?t@bCD((n=RLn7ip!t1Kf=aktmHpMClFY~<7 z8nWa3x8jPrfB`jy+}ZGh&+af~Brk{eo&CGd*3Fz0wfkVCAZjWVvXMJn$`X?Zs7cCk z$vUf%^@C!UA8ljPij;Q+SEfAvoO1HhMJ1IGdLD#HYuC zq0gZ^5^&Hkfdv7IGr}SfoG&OAW|QN@t$VXa0x!#4DLz&zkM;c%PcVsTRhb#+ikL3b z`5dXX|8S`*r!ZeU-@?$Yg8iu9?6p$@6CDSF!UrbgPmq{EgSy_CGsm1aWpVx;d!7c76k^_^K}NX5 zFWre^u%EWyKV@_#mBJ?9Tk9pzj~v+8)N-ABzZ(x3Pbpw-AybH)l43q}7Gq!Wj#*n- zG_o@#gEE}P-PVAFf)ACSt+~(XZG9c~ss;6RHqitUTlQ8DP_%qC(>;OMxoaN$1m->#i zWBLfYLw+XGNe$7nEBjDJ(X<(Ncb-aahZ*shgVVIBW5oSgP#@kOub;b22Mr4zZE(L- zDNDu-f4$D{Y&J2wEmu+@My-jOZxWHewOq90Ev_w95Ce*{hMvjRI(+WQkggEaGIr=~ zHnsqACq*>;*hq9L{`x#&JnLz|CC_KD!)+wHoIpK1iY-jyq#r#weUjm^o)`~95AU)RMz$%Q^J>p518Gu z800VN|4X)xk${PfmGysP+DrsYjBKnd|NHsJ1^nM70TVML=l?aE{{I8q4Xut&o9mCf z8!HwQS1VRl>rJj!>n?LEE{5yohOABL1rmWn@0Zz**O#qNZ=Y{Jf3RhbnohAUYvwSr zan|O;bjFr;GRkjkO$BGC`G;c@P!}5*9ZyUMSHrQmHZnSZ)G#nG*7hYNL~;N}Ytvj_ z3P)@EZ2%!)!1@J*!;YXE^$rYx%OS)9tpR88ODg%*lJg^+7!;hH0vSQbV|{?5U1kAJ zqN6hfEON723vpw=9}pQ_@0=Q$+w9(P4~coaZpZm}!ZHIDL`zp(Ze~@|0*ks70hvQ^ zLilxba*LZm=hiiYVuI2}Sxo>vngFTflJU!kNNa!-?dVR75j0c?W>{ zVeLRTIW)azJ^HpN_@x4W%7eD1bFQv`CIRsq@9ypOOpcsfT}|m-on7?lT^mj9=-p%R zslZB^`n7i^umb(Q1Zx2PT*Or4R+8ri(D?a6K6g?8X-J{wW-;G1C$xNQOKQne3&;|* zj{AoBfB*B(MU&e{K&AvY-E-=goL`63QU~j`%TvP=QXMfIL#w89rs7mK)x`F@JpvT-!On)Vl^^ zV6L-=c-2e?7SO%fni93)_lr!Ro>_j&iTDz|nZN;3l0wCp$qi(Keb=2WyqLHE*7l7Q zkp8TEU51kXXjCW_XkS>^ni@jYgJB6YO>A}rh6h{x;(NRBbqH@?TN%M#1u6Y(F8s1I zHL^6{f6-0;GRy;hpG=b6+8SLNIr4Q%p4v;s<5v=q!a$Ae#(rzo9vg&Wc@uOwV&k95 ze&&v^cZB8gr18ZE0C||GK7P&mi_Q(KA)H*m>3yujLs|5HAwfKRvIBsA1w@4; zHo#ndrKNRG3|vTG$k1L+0Ml4q01=au6U(`g%@EYo)B<;;2{2p3{C>7n1d4)ld88x2 z@Cz)Dr0<#7g8qE6sH+FY4EBlq6ukfv-Q^1d?V-4XvaEJH` zrI+{`$j@l}MIbNT$_Is}^oa;EsQiq$X9U7P^(l}GH|C2(5jciF0Hde;5y+2T`XP{; zs`(|LoqHkrB|t+%phQfJs)n(H4~s;+&j)p2eTP2)F_*To?x*^D8%1?#8%1lKk1;Kc zzd_~;I1M<;H^1Hs3>os%Rn&w`-rU5O0G6US?J%dHyYaC~_NxYRkl_mw%)aKiA4)ks zxHu4e<_iBCLE0f7hhMthOE(UGq|pN+RN2B2K9cb0Bcc&R(sRtsL@vtZSCA?AZ2i~u zO$C9kXS;8KAq4v2jTn5yu^t%LZ)-mjI^TkculP^zpm(kJj84#*(`w5TzM>1?QJTxI zSvM0T_+h^NSL{}htgp40uUdW67h+cMtOj3}3Y>1%$6U+am7{KT#(Ia(*>`qk6O$Rq zcf+hy0c+P!NU*qf!wHD8slh(z=VD5$T)LK)^{;;5f!+r>UEg!Sm+5M%fYHV$BNqW` zj4!`D!t|e4qmHi!gu?>}*GJZMw;bN!Hv6@13e0@YuM^!E5?_6E402D)+>k=b6Z;E% zG6zvQ*0E4oEE34h&kw2VZj{)s)``zuS{keCU72Z^GXGCvvz=58KBliL!t!h1 zm-P1!r<-MKFfQh=XkXn)Ac7fCGm!2&Guu8?gQO)C)m?H`7A0trsX;r<=)r2rEU4Ca z&iUXN;`DAQ5Htz|E7*~Iil&sLgQa^Z=mzRV62#sH_f0FgPabdUGLjb41M=h07#cE` z?Bc21Z;7PMIP$APg5ES)Y9%T|Tq%ojD*|Bh*nG&lXJ_7F#%Ufx?UJOkl^5#teh%~+ zdNzZ0b?(=-Q4!10-8}Q~M|Y2Y$oPgV1Py}Bw(6K6taR{~Gux3}h~JcmZW^>FLcC3Y zg3*^V`adLnB(s#Ueb66;n#&s{Rai$~ap&S5PTIIfB_8c)vGex5;Uu~+U0_nBga!Rf5=byQ^36+8Uj!NuRl=uT9|`Wt6iG@?q`rp15=0 z7&%OY=~GUG+#t!1AGhywv(#)uX?Siq07$e4?0QkWXXdkJxCWM(E}Akxp`=o_(73qCVLT8-nx|EYMQ^7VvzYJih^F z$iDghQ=wAth?zzu0^~9p{YX|tH}_GKEe-BHty{Y2%t>E=B|&?N&P2=6tfxR_>}z}h)k@c=yU=*ff1m0I__&HM)%*>Ytbave}@5$>1j z#`|GcR^4KC#d{T0M?j(u*|6ns|86wb%eJyKl!<6+8 zYK9IPtQRA-H!0ympppdFh91KauiItiT%h2_+AXm*<$M=`2oN8xL!G|#d7eQ~yh3j9d?Gl9ZNNkgx3k3{KIt%I&20sX}7#5%W!H;PtnapCTD= zk;F{vu&!e6M1T+D|Am1oV3yZ5){8HBtjKpPWJ5Tf@JQ|F{06zPKG-f%@nCB@Qw;N} z5RP~dIjIbwphQ?W29_tpS2Cj&8jS`LShyW=xhQ3{Z#Q#+Xp1@^g@N3KY(w(Vs?+$O zZi|;(jqDKfRGh>(7tc6$a<;1a-h?H8F>4T`n%=lc zUDFN6)V7+q)5<+QafUZ6GIAPI0K%RIPH*9?Hc~xsws1!?g3gv1XWgTXR9V0k=q1zB zt4%87(3Xs;3hN^3T!S5&b(=M}SO*J^du>@^%T6(u+bV#k=krR1%di|>Wy zm1!Tyc9v3~q&x^duJKic?h9e&L?s&P`-* zF#@`CPlWFG6;R^YG&H9DThT?;_0y(VY_g%UIEIZkHiRh72>q8K_>!~=+e)j^W7#1h zp68D$*Tz)4v^bO~T9OK22nwwcMV_;l_fDzvpGIVqCyMIllTw62bUKSsNCZo-8)+RJ zEt?sC<4VpuBuA2;bp$;b9{V)ie9!mOy{in=G$~KOE>ILc(`Oien&r^l;?uFAaGM** z_wAdZlgo`}^@*uOSmj^zhirFmzEHohe%3B8v1RQk@d2yGoZl|Sr&Z91VVoGDS7CSu zR}qjU^emGLq4G0Q(mBjBN7CIaL!m>pJZRI8+N zm2xg~kSmoSY3*o&3mwKipfQw^335Pj?YjPsCIF(e%RQQDV}0JjZjV#im?O78m$KKh z2K6+ycS-N5hu<5^B$Um=%3`(H_u>td?~5pz||xjyr$dTDae94L6{&qqvi3 zl;l@m+SLyu@4n9+MrfXdT}x}byLzxrY2lsfCWmD-+jV|_2NEv106rboSNb^ zMIWi~Gw*ID)1ab8XlTIIdmy;6xj0SSM7S(Y5j_0*=IEkSP84Cr&0-s00u}SF4|3(v z2FLlkNZR>17>?MrSW`)vddv8g{CYa~LiK=5TvKf5b2ty1AVQ!s14PoJr=xINi}JGi zrvX)%AMrKRmq(VhaVsl>t02li7?!wyF`o{_7z^tK#Z+2;%ar?+ ztMSA4O{X1f&5<6_d%7w^dnTw#zAvt%Z~2!uP3SdNm4s{FEXeTjL^xwR1tH=S<*Tus z^Yi-Go94L{2ElCm%1D*@G*mUt?AkyGN-utZc#ZX>Zzt0mZGb(GpKT-McniIvHI3rz zu1brGPKhwHn$8z+V3+n)I zx6A@QV-$IbZFfI`=OxiV%XK^l~VNI?iox; zAbxb6+B_{Ird{bGv<9v>9d7lLUl1i5tHvHUeE>zXrCf|~$|(2lpH7z(dH-0tV{Jd# z4g*X%@!bvw#cvOu*M7iax-TeFsG5lX3patu*_wnW+?qAwd2@nm<@T73b!wZ=@2<_U5*H-mpjPJzBjt9xCg zY?w(Dq_Lnx-E-r^pwM~yz*w-)&4G*RjYUH0%(TE_Ur>^9S4CX>v-FXH0!2;t)82zi z9X0J%o~1O@*KSM+&3Bw3hi#)Dtt=()mZGB+-s57DndT7EtJumBRx? zgTEk(?FdNNzofTNw;W&UIZIhK$%W*MO8Fg$t_Td6JcSLyJ$NBkU5_%LC%wYSG6*T* zGt(XcSr;-7SZtQh9nbOb4h*$TL^g^jNv9@WgF`dh<4$26uOmF_87yAE9l_!Do03`i z#@m?NJxnxCgz5Ya{UQy?+&HxPLSQ1dgd155Y`B7T9%JI=e59dd+YSJ%xQ$jN{gP?a zxs|~OoB6jEutIoMa(!Rwd^g4&zErSdOjiH;Y=B8QTYH}%x45hT`PL;9 z)c91>RIe;r&Yetbfi!9;Ikb->SzrF~aCeDnj2*#QppDI%1&Y zDq+UmE6aBu$Visht0Kk)700heDUOv=6wR0>vfE?L(YQDIdo49}ya3iQ%T=NtkyIw) zQTT;&!+@H5>#WU%SfwKKeBcsQWdfOzwtSJv?~Q_3)T}IuTJc24qfwIS*EDyy(xWts zfvLx4ny_2ADUfdu_wxHEVT0Q`I4OhiYrh`)@f1oP=gPTc7m9&2mk@DyiE>`NHuqc=Y{j_)ojZ ztxBEhP6Xp|FGtUnylUhQ4#C^qsQZ*ajeVt_GD67nxaVhmna8=X#6B+0AT^qcDmsP7 z@8`h;8#VfubD`;5!7RQ}wrkCDIrB*?bDEPdlQS$bfe%r9Z~+oc$u4V!hqyF@dHe)* z==1Hrl#PZ}Kf$0Rx#PtIfYMCj)L5T@dtdr6gL{5UqGnGVqJ-4jqbI@}w@%m2K8mVP zCM%Q1NduQ|3vJ$+rId6L?Y))sd5jzoWD}e4A8||`V{FL8|I`hj{k;Y{ELd}R_QW80 z3X&1H*l8@^s`%S*?gey`qA_EeF=oPmBFh~7qQ-k?-~+GPA+c^bJab=rxvWz`>%9$g z0`xrHZ7A*jRp*r1u!>7Y+PEI{glH!J$-7~8iQ5W5;54;S3mxlzNntG zg-5mA+D8nBO}m0^(G0Js+XL&kJHlCe;~YPJ_u**eXsa!m+cY4ps9-b4aXT;n3T0bP zAhLm_?(NDZkeS~d9-}!3*?|OhsD&d>;hs)$e0&ulX(@`wGKs zHp_SuhwGWCR)K|hoMTNsmxWG5C@D*fRnj7@S$=M};B;7!GV$?SAT`vw@y^J$fdKm( z^{$&ANj8=XxnDJurhq!itFtFTqEX}HWhC4a?h1>}{17WfpJgwoAE4l zmj;`WDY6egvtxY6XKQR*u7ef(wH`PF#@edHh(IZ~_x}JhK+M16H!-lIP#{O6v#)ye zO!%b^XAu|fHo*MGj-a5pSZ|M$bi^iQG;2RrNe@o6FPMx>sd+Z#KOvJuk@j}0IVM`- zyePOt=D+N0Gd&O$S!`g9ZsR6Lec-MgT|1 zLN5R&L96hAKw)E+I6LYh+yBJ=8>Gxx!?CN-D|DD>h(W4?XHtIt^K8D;_e?q*Y>9XP zDzHhb$|iX*`K~}jQNw_Z^@mD19P)t)lcqFp#8(fTeY);xW`eB?U5=|Cs#l8)Xxf4> z>;2WOXQLl=fMx3MV56!z_PDS3!w>=p7!H=^a zJn?z=#I!p~b!!Fdy4||;?-F8-)?LVIf=IncP6?2-gt5JT3jeF2MQ^i0m+y=bf0XifRs=voB@YQ!Q5Oq1eSiWe3tJVD2SUI=% zmcXX>R<28@0t3&T5Q2iLufvDgTD7gS3Zc;oV%6n@Fm|s z6mjo^YM$qker8}C}gn{K5-24^k`o-ZAjpuVBYD~QhMetU{wM<@izf1q=2DiyU1kYOq0f%;9_Cd|Hbhdy4 zsrSj3038&~z^4R=r56kYJzkGV2P@LmDZJ)-Zn@*Dmm;uHr|K>*cygJKUq|w%VCJ6G zdm4c~R8xS8?{fh3p1{h8>d|6!muYp$H$$sO1u4@e=jS(NRZkRd z`8q6v(>_k+06QAU56h_)$YJPP<)>0q@oE$7&PVIP93xk2W{Dy)W3=*W*_ty%aki;a zJ&MaHY}ov50&}FN-o^u!K$8dz9Y5l9vH+4@WTVTraLL;*Nv|)yLGS}?EyBq zLM2h>W$NtX-OxHq#Y<4$z0wu>5o;&xx9+%<)HM@!S4DvpK~!3y=NWrUw1QKOYDt|x zy!*6w6uq)YJ%-B#I>711m;;^IdGMvrx6VnCl6#t(^L&%vKAx}y4(};9Ee-XXM}jXH zbBi0kn)VL~&VB(4{t_<9Ul{T|{;?u{V&OBtUQPn3ej`uKH&1CUitw;^9jwV-_w=!- zRf+=^DJlF?yx;beatKBl5xEpe7>oJeTx*IRp+b`Dx_)Ytyt~|`E*u>05npV#N9R(e zpOf-z>`mlinX?KpkW~P?-qCXXl1R3?s`+&s;_}Y#OP^3|(2ZEWQh*{YIi`;D;tV!# z?c)N0RwQrQ`G6q)DbYh#?A+v8s*XqjCxUDWP8fB!)O)(>^rjp0cAT@DgiDmXNjM}l z*vYQF@Hhy%Fiy*JYR58qen*+wO|S0uR88EdwLxig{jF*5q{oQzFH)J2*kcU>@4DVA ztT3g{HV=vO9t_e#Njtws-C`?ZXlg-E0kY&Mi?VjFch0Ng93QU^O5}Wm+q6XY8J$?x zf=&ZS@2}sLraMJT>g-N8)`k~M=VjB;WeW^MItDL66}f|x@L`x0Nwq92ohUuqx}ckj zk}_7idam{;ulLxX3KG!4L%qE&SUC-d-6?0qm1sjmH;Z`Uy`TtZ@^3FCEeyuxi*%tU=vo4z3%J$M5yWg+EKk7Z)cAW#3Gjs)d1* zMq=+eyjdp|iChaF6G93EpiCT^0zxifPE;~*qF$>-B{W3kDBCk-IDwWcn@6tl9cuU{ z>Yq*(epXC=22YOUQ1X36=h`2cLi%AmyZTvknm^l9Pd*g#AyBVnji^zAhTu_!A-oM5 z3X->IEw2W6eQdX1H#RO>@O-j zW`>^^?q6*9^oxp0pj8NghNEcjV>}hyyGeL2Mf+ZQG2OZd$Om+cboUs?`|B7=txNfb zSw|3zE}PJ|Jx}VIg6BxMgfklUu!>9r@Zhcr^67kgC`Y+&n4)w=k>lp@Pn?xV`q_^l z7cYr3myx*S{O&lmDXlZ&t~0m=e3`kZ@*yv`CZIe9i3=6KHcGY9kMG+m-ArFd#*##E z%fJ1S;$rL5StO-JaG>x^LXV8rJz21Z9FiLW!WP|0Q;Hv}N^drLpMtXvr>HhR6%`CW znkq0H@X()AwGf&4%SW}XnV!RrGgQ8Q<0Zn=(PP5fkJRd`8i<@cR6Etvw3Xy5%~TE( zF182$aMOnD%Ppbo|AjI;`P1|sV{B$H$d7dDs)F>(*7sB-AJ@@&Hunku6gvA_5v8PFleU@9BNLr@*o>agr(}8R`%wapF@6`P%H9H- zs4p?pbl;E{EyTN2)@w^8+=Y~V}(%=_sPS=wNF(M zCDhAM=U&Xm%+N5sIc;;C&+Hs%j!o-*Sq|p}gChnS4RgDeLys`ep3f-TdR&do`{pVq z5~@fA7^bCAk+ou8*4xoS-2*~pBFvxd(`N6YZ)D;TWTx}mM;o*d3~EvI12blRw!1LY z-S!Zc;ZSx#*0g9z)UJND;NtSB%qE?=4xUwe`ZSP?Ss9o~=l=$YM|3`SWd_p|6y*AD zqOBrst>wk-ouviN{QRVcp|}eWSq9oL-A@3>&bLc+>s;{?|G}0EnpqpJErxqax1qGH z4OfNZxrBcQTa;|TIuEVTJ@N~s4&_v9?GkK*9BX$l8FYCU=dd$faLl-A&wF-vmV)*0 zV>X(Yg0oSz?fuILpdQU~zU_2MzM!Gbm*@GzRF%B7jZJ2AJB{zaYMZ7$W!$*%i)6Rc zjmKi8kbsQYu`3+`%_5`A`aa>^DBG9Gyi$g1Qo$N5k{%n@FJxpp#(q$2%<=cx#^8G# zG&Gu(C)DDSYv>Z!wAJqHcB@LUN_Xn?Cp;N0lbP926H@Es?~xT0#M9tPC2V@pzIqrB zio=wxQ#l5|mX}Q3fJFd zVoZ;jAr3*%qdMTzy8xe8nY*zTwBDUu_P6bL&!3%z<^P$ zymc?$o0eLN?>QG{FZ$d#6Zolo&xHOuc~xKABa`3bf?Mx!n&7+YFyI+k$Bf&#S|oxU z$FHoOhY2OpZPCx+zxaGT_};)Wnc}dyKwpDO>N2}Us&|wlE`O~+my~weOC@+}lpiD6 z^sJruieYd+G?r8APo)h8;Nr9agx=+S(KlDe=XGwMTSJMlzkLj|!cg3kB>&WE!Y1}X z1Cgt$11|=8UwhQHHOGiAb=eBPDX^Vk>|N~C$DcBeLl?7_Tov)joY0b-bwc7$QFO{H zS-m{kZyR`Ng&~;lnhDJ5HxdJZja{iH zTgO8&R3!4Q_w=gs1YY<1VNgrC*0S;(&Bm9e%Hu1_a~_ZW3veRwG51g_r~=Uqgi)W~ zYQY8OZOxHHUpW$^a~{g;dud8THj!lCisGj8%_qf*Oci|pVB{rMk~^CNFcT}KvBP6q zOf7$N4if53$nMA}yd=kZW*CDUu>14MboiI;F&bvNI-ebW&Vi{{P04`sA^b4*)Yo&T zJ*D^GJ2n--Mn}j|l%XE>~kEnGr*bx2IAQ0a%O=R%&!~N%3cIs!T zkdrF4Jfvq&2y)9}`iF3mV%5x@kCWcjwRwJ%*!oNFz$NRxXCKJa3G}@vD z#LOBK0IpiIVH#MlvzuF z;A}!CnlLn#3J%2Er34Gm&Wqg5j0@}7vbQ9w7feEM{%%u%K2$%Jz3&C>x^{I02}1`4 zqfsZZj8A*Pnr%W$)t?PV%II~_VpoL*x3B)w;9W0;)$RyHc8Cf=$dwb`>u$LWL*icS zxO|%u{;ffL%5y4^_`7ewcQF2v%(i9p*`RO6jis9Q_x&xSc56u?se5*}gE4n|y|}Zp z_QG7v0oz%TwN0ZES?Oqth^$Y9SZ0z-s_KwhtrJE+=NCQ_P08|{FGFRBez2jse;e62 zkriB$+bYcc6@yVW{{cn}SRmg5m%5=P9Topfn=X@4I_3xCT{0nN82E1V=aDs_#pFf` z`V*O54dasSfjPrTm1FV(bEb%)Z}=?Q}mTWi;IclK^<1VdHiv>3&A z;{zkYApwLrWH+|cuM}j1?fmuWb0{U}d3o;oN7s3RDAL$!PKvdHXX@p!$1`B&ooSl& z98N|l*{g*^VXGhA<5}t~pjHxox#}lhOPFoiL*F>6Tx*f6l^DwiQa9VnC?y{TT%Fh! zAEM-YU?TL)7=K5Bv|aEyRMf-Y)xPC4;1V3{0F&q_P7YukQy}<=h+LefHikN@U5dyK z2U)B@n3AEL1QpZOTa>dw=yWdGGL+r~L(Xh*R_)oi`d(1~y@v5X!@&|XT9tb%+jYsl z!68_ue#~yYWI}yd{{0%!+W;;B+W9qa-Q%<5qcJ+sT3P(LbX`Hcr|u^r28t*3R~;XJ zvfXsaUoBQ#L19MDfP-_Rq-GDUJ zriUFLDv8c1MWIybjJAaYQo`6Fe(MPB92z1WVd5U68(pl_SMFrH6!p%|57>;=skf|o z40!kQ0sN-7p^+#Q_i_Y{T1ls~=mGiIiRPL8BVB9+OuP|xZ-I+M^eyo#{d=gXL5Xrn zyCwVapM4xdLEd|>ayt_g=|(``8niJ3OyJ;Dc?Mq2eNa4p({7qO+*vmtFQ7`QykGUI z7VRtIB}@H-&=Pzi0ycScq2w})R8{~oTMu6y$HgnW+bQ*~Ez;I4CnY>)qiTJ%^aq_T z!NRofw74D!;*Sl65QkJU@3&pL**9a&dp1RDT2I(txj%L$nmVY(NN$mPZU`72932zG>Q4COoU9OMMb(3j0!-)r@ip)Z0J~`itc9hT#I`c zGI<}1v)ye7%Jzx!LL~|9({N5hWHC+ze-G)pS}peW7p$7X8;=WHVfPbquQD_aLn57& zlKn9A6nnTF{%Mlwg{O2w#Arxg{4sLnla4d|7DE2oCr`a{e3`I2dF+z@)RDwds^fV& zU==Q_F+}6T^l)B<<`gB1Xj{Ynx8!q1YA^L`hDMnYgU;KWqz5z1k|a_&op|J&M)6?% zc$sQZ9H_&%eI*>VMH56IEGc3FDT&NN)Xi14u)X;EX^PLk_GXWL9vD&~tGp=mp)(xK4H=HJY)j zHuMn!WhsJ>F1AdP)CeZDdZZ3_2Yiq{v|-KH-t^*_+rcZ=i1f>H#rm)9RD-6Au;}MG zm+8Oz=&16E9^Len`^e#w_hF7qZE*00_7Hhn7y1_;cdPLhk{N>2wY7G&F=~b}>a8kW z7m4wvy&{*o8A3)B13k7Di63F3Mn_r2f))W_YxpJx*S`f^7IQ(Xsy ziJB$lcq# zxVl{*buKi1+|uZ)g=@6~gaQ=HWt@Xw%n0-xOsh^LdP?KteYtg3sLv=6)@KO*7g5r(I8N zmRul{DR#0$yu&D)xM}$EF7RdPiCd9ix}69-J?=Jf{CbpCFZ zY4&@`PhxqwAKGqQ`^5_x$8Vok9^KiZG+(&3VPi8RxxS3BcrS@0qbAW5N`+9`OMhD8 zx!jz@+kd&G(TxIs7^~OK_waBJ`4F5BPonWTF_hd>4j<7VAR0lno@hVQG?X`v=IiKl zkKhi>He%J%W2>Rw0wX`)l{R zQ}S14-Jt{KlKDioiC8yEMRGVJotnM|am%?cyDdqN=rip1Qh24V$GhKzFi4n)AtO-X zVw{)hTQajFPsfX0e3gKKL;+>SRyF0=%X`7E>KdD3t0E2dw-KLsXo}`OF7=JhN*dTQ zlFbAL#8y(ETcbKg$v-2$sa4ICaD;&2ny3>Y(PmA&aKj>3q?b1?isd*2r(#llaZqA3 zj?HkAFadylsc^5L=HLiQ7C^Hu-(oDOD|1TLqQAkx^eVg}+~0iU=8Ke<&KjetLgJP$oy!&|zw9C1yf%;wvVpJ&5i2YM&Bn&HR2Y+9AQZ@nMtl~j{%Io^<}CbpvY3pv-H zW{S-84@rOBF_Eh22D&$$cy&PrW>-R*mO1__JLfCN&S8ljRRpHyYqXRXw^A zbB~`RwF>nL(i0{Si|1b;J8$G)h6hoygI2rhc4ZX4uyHB%!OmqONF%UU{7eYE*J4JG zD`f?q`Xj8|QVOlb6J&PX2|>1=pH(W3r_@le_l|1{cw`|Z1qzJRkV!Sv*$n${UR$|T zC+FuF?j#ILV$(Aa#uHO(lMd=Jo5(}&4QW{&uhkLyRciAc8H7_C))`rwOY0sjq>UJU zCj4|L6xaWLoxT92sUy?%>HcUwRfZ>y@mjzcA_|Ci8Lv6S%e0-U28T5>Ur2CkpH-E7 z=0b~RpiuS_cWVos@G}C1%HgJY`DoLw^Z7L){+WK1(K%%hD3BY*oH4KWj_;M?lwL5P zV3^tXp#Uet8dZS_f>z_{g-g{_UAj#82-OBPOt-bhyPv@g6Lc#oGx(gepuYl6uKo7#A&986ddaDayAh>Mx;ugFH(eUBR6!Ao($W z8k}e`{S(#`4I<|;pGL5|!{9zPL{NE#Y(YCyX-TlL!p^HPtV$kDl?_Fyh$rbrq#_jD zf6mcBD5#^}6om`-Q;v-hIpK8FC-B7^{+T;~C{3iePbqA7!E*VWT6QS553`3b_F^gi zxH_WtGT&+~omKPhng%u(9F2tiwLw9_bYvX=@I(Ioo4UH=bWQaTHb0n2e#=tItbQEs z?I%_JFqLBsr9wwXlFw$T0UBd_td;ZqFWm*50tetnz*DykQ)Z(8^~F>wfhb#3u-&w0 zN`rYE`=yqq8grC{(QU^FTRFX)_<$1E76Dabw``2Y_0ehVoCDYR0d?VnSlnf1Z};_j z5o38Hs_N&SfN$EW$91LX3Nt=1wv&k)%ajouo~F{g$+SqmvD9(ZEA~*OPoq;*aNc;1 ztbEl&1Oq@n0~=Pu>v@%O|FYbWm31TE`@JQ!saLFOvRe2y8bJgSxi`-NC0A}zMpz}0 zZ2|>TSre|6)2E0?ypKttFEm^m?;83HDS|kln-2Y{Zzw~ny)?OOUF_u{;DMpWFFS$l zh)PRP%96k6t+Ny-LgWoSROichxX832&5yxtM4P`o=p^JYQjpv3$!^wv0Bb5(EQAV| zV^2=~`GfXw%oJ%zTjap@B1-b&N<8{fp`BrmvlTjmjA)x!O-C98D z847+UaOwc;meC5U0?c0M$2`+K#O%_o3jnmxEh*vPIzB7x_p_7=xkRX~hPcxE-Ck^0m=`Y-#A7E!JMg4Z*D(4~9oNAd&Nv27kV}DS zM3gh4n)$>hQ3P&n`9BbL-RT;K(0+EqL}s~euxD?{xlN(qydxFfBiKBGw^XdmECLUl zqLMNFRTX}K%}Vmli{^7wVx1GW1Tns-5o=UV-C=rm0>Jz^ofqHdX+0~! z+bsnHz9Jd&*b>L5302H=(RLaRS`Og|7z(;};V_B({LG1%xuNA9aTmQOgaU(X5vz$E z+?hkY9qzP5&RAROoElD|0l^FAQWF@bfEZ>l>G4b7l<$$Y)B!b7+@A$#i|K6hF(_Dyrphw#9+WP6%{`6d zO1w{nlwNf(ff-UXH(TGZn$GlmpES{Pg$z{7rG~F=d_9)~c37P6ib)scuu{h#J%@}1 z+h1arW-pn+5)NO;*4d%sNhox3Hy!mo-(7xQXsq!ZLz*&tbx30CQ<3DBvPC>dE32Xn z96fgtm@-C=j?^;5QtKqtCiHMN#Op}6ShxcNmalp92e8<8j`=34B~{>PK2+Ic=|T5r z&>b`Vq(;9AZ=5K!$ajDSV9u8}pMX!I4k>az+sMb~2g0q&rXC(&GFv}>?nq=?l=j^m zjl|V+HQDnSQHA*i^nYhMC%0Kb$2l%}!neuwO=uyI;AdkcwE+qc%RTajH*Tf-{;)dm zi`ko%s`SSQk#Uc6qW!*(%b`44Y0fpqP7w-EuAGyip{@pF=V{8Wc1JY*Js?Zm0v0y) z8lSKdpSwL*Sf@11S!<(iV}1&DK{a^JkClJKrYa}@3+nhras0JT_dW#nZkTZ_L0kmf}@GN;N3(vT@z*wiI*D6<}3;HiAmMg z;>pSBQbd1(9dWkFwo~fUu^{HUH&{>*bIq7i-TT%2HBf#D+LM^8aL3#Qr3OdqisY;0 zatIHCqM}2^&}RBvr$$LNGB{5J30ZPKg;Jz+?20dCm|xql48o&~B2^&a$$8cWT~FZz zk)XOVqCW*yo?a_mIDPo`jB!X?{P+(z(suv#QKoE;Sx!kcdWb$h=+sY`5h9j{RkP;X zTN09uSv_v^)E|2radf$y-kNyjm`5P0fFH3k2%YkMGhK!`>u?uP-N_}gxh7_oQI1!4xJ)6L;=pM5Hk~S6qfP4s9XvN~+4}7j z1o6me4W+e7cZ4=6%({84IVlaPqoAWwZt2*$a31}KjNA{aai!6~!|2h<V`O?y)s9TgYmR?Yo@8LKI_7R zU(l(+bQdsCXqb=**#KI?~i-58#(kFu86F@?<%zEB1gzWm6yR(5A=P5 z)Dl9^M=`!D@!JkHuCh%O)}{gW`6_T=EWfnT_d^(jR@YyXvFox&qkiQsfU*p{yVXz4 z)-LJ&wfa!me4~FB`jv@S!F+P`bE1r>P7uv`^Il7TsA(X8E6#i`Xx?yihl#*2-O&`A zeYt%U<1xa)-L8<}n&azpOUPXuy_&g|mptJe(4~ExvuNAW+7W5!B$V(tBh>a-m+SJS zfVb{85f1$pIxy3e3=j_JNL8YwZ|xtxyVQ5Wp1HPPr=E$mS;EgH+!;nB;0^7UY*-yt zV%68qKkzVMkj_H!6HULJg9}If=`(R*EpSZuz9u42ZmW_FqPJMQA-kvhW1_R{dZ{}* zE2gq3l{fAF+C@O@+i~*Sa-KgHgf_obD3f$P%7 z6Z5RxlclFheoO;>S z8tO(S&r<`KUeEDcL{qdMY#VC}dS%f3WNy(EG z#uau$J3Cy$1Je1NK+jpoBIuun9Q_f$AGe@T^RW;|u?O-Ft@?`x!nfT?7n|<9JE508 z@67)tx^&Xxh;xTGDy$(WwO**he8%|}n+10n`56}v34%RaU{ag=#sYcv{{_bwIOk4u zR@cQGxK=nl8msUin{W_K&;jfijCsW#?)w4FB%%S`Bt%?%aV)^opgwuF$}jlkK_)2Y z_UI?@?gmqJpL(Hb#=?#>l&E%0o)}(+38^VUwa+XjQ;?RPC>NUNbOd*q#j+5(s`w`k z2C0-!0k{dC`w7l>fLdnaCoqHb1iAHtW4z7ow|672G5lWH+p3y5O%4bXi@_buFiXDv z=nJ`^(l=JQ8l_s_`12PgL4a#C!dd4rs-(*969GdCIqVfzc7HjS3Q(Q4q@e$-rZmkhA_h^NQ|h%ol1gCh0sT(Q zE+GW6hZhY9Ys%Hf!n>RpN?$*bf#$`JIc;k{)HMC!GMhvxzdN>?q)_PO<1b6{wVAm< zbd%xv)@kYX*N=ZXJs&8YyL=U~q)8Hxzo7lY;59F#BENCy4dk*RNy{N!JijehXca*$ zk^sf30n!*WOQpS#D{&L3AmuaO@4)@jL7`cv^;=G~j2n~zt@~G53xiqjmj`;315u8KKf8c20@D{4v zb4^DJHTd8Yv1^khCF!4ukWYPIC?*2^PfYBBQqI{oh4&!j-jbFI5E7K^=U@M{wL{*m z$6MRbmcGzoP3HuIJ9%Lj9cTFVvTnMH zvwK`M+`(H6GB6EL1lt?ZI20dlbj%AAwIaPRf*09Qc5a;99jOa)%6P>3Wg}FXN$D-$ zN!6flG~OdMVqli)Ce?eCsVL#~gOiDEMnjx*#~kKw1IGR+e8&%O=oe_ke(#e_@`)V` zl}phc{(4%ozxvQ($wGErFV}o+6TioWb)Pfv?scxCAc1=?rJ6zb&e?mkh^a>Zicn|v3 z{}hHbmZBikcMd2QO%dOb#`Dr2yQ*f{AZ!kr?H#nZxo#s*x-?sYQlK09>vhOXb8)NqlC9| ze5~0%%N2kx@B)bBqNIfsH+B&NZ-e^5w81LgZzP&CIv<1KP5S^H8R<6%Lq)8UV{38Q z-MHmC5111rjH02^X?E9oHB(DtknO_U&HMw3d{_G_u%7m%2N%POBiG7QL6rRtrs-$; zTO0C{FN>XwL!G;o?+)E8zM{+?Kvq*b@^@No8Mcj`lz?*2B(v zOXzM&XA@X@N?t&d`HXn2$FY8e9geT^%MPdS{Y?+Bk%Ued^~T;Cz+6&USX3QK#?K8B z+{2m#&(;)nv`Jr+98LRjtFHjBZ8m+hPzzJ1gP1fvrEee6zPCi7*^p%sh@2-gn8izw zCowMjcL^5ztwtlgqb(A#4$=Xs@sf3mnQJ?TQ2eb#0I6}5KS32lotxmOfG1n)$u~&Av|Vh6=*o=re#$`^MxZFhTC^ zY?%2jI)TW(BfjLf@4_(lB2&B_%jeOVtiZ7>aR2QX1}Ck4ig$-cf6Ie9cz{y-5|4-h zOZmM&+QvnYqvonn6@PC)%Y%m@jM+}{Cxm)Pwn+U8WESAM?9{3IsJRddF|8f<&V23k zU5$2YjCzM}zmx{`{_MoZt8MbdCn!F6YEO+16r@5<0CSH`FkI+gbQYJK(qvD0$wGS< zN-vU`ix|%QsswZ+kVyx9-MU%v4#K6gYl}s{asD0V^G$Q}+p9ZVWDf!_S0kN5?x%C@C`s@-DKB zky>OULpm4(YdIEi2+FAo(g0N1FpxN3d@(yuWNd5pu;2mbe|KrZCx|n)Y|~i}%x^NU z#glF_Z=2^F*|bdMd&7OuBu|LrkR#&2MyQ9n-9+jd6JUFd@hYo_TT*ZQcB23HCWS}8 z|Jjhba7f?nq)Se z4po*{oQ~2BygedzPJ01yAPzY;Rc!jWVo5%*tr-P#&iL z4D%;f*)@q4=^&rEP35&zomRu+a`7gjDu*HQHe^8 z*?lL5e_)%IH6S=*iR;(QwlNPM_}IPw+F?8)ob*Qf0wHn7H-CP;CE(GL+jvbgE_f1& z!i2p?m~eo!fa3%0?2-$C(Mqxm&jXVjm#Gx$8qQ7TDB!AN9Zs3<27uxG7?(+?>w`kV zcRb^c9>WtVD6w1zU8zz1=u7Bo)(6u0Vse{BLphWrV^6e%P=K>KH3Fk8Z~2^BWv^Xq z)@J_;hVKnfmYYHIn#}Y&=W}7s+5#R^dFSbE+Svt~J%2maI49zd7u9^|{*kGUgkk)D znrLuv1lT3Jzl8mnlma6X?L>r06*BCnn!G;d3;;1EWvJgJHy~KlF{&5=Uij(qOsG&8 zXkC=rK%l|8$Bp9dCOAa!k<68lzS26!99%T?Yw7g=7F0kPY7VxLz4Ce!j`UcXc8C0z z8r}NRU?IlIoH~rU3t3^z)49X#EM4;ils~isW^+qSag#id&yu?Acm7~ISF|xd`C3HQ zuK=_%*oL7l_MgFj)$#Q`3(yvtN^fBlqFpr+E+{a_T~!%b3AiA%T=r|a{dzfPfmal2 z(Rp5@-w!7xXn%pvoC^Nd7s1^eb zN6t~JijK3^>E@!kBz-kF*Fk9bI4Zqe8rH?KnT8YnrmRcq0fwMb{IM)3+3d0OJg7?yamv&+Bk`e-U7LF7k^5n>z z-o%gib@Oldq9e?Fd~(r}z_E7l1IKhZfnh3#Gg_%YSoaOn>G~$g4#OLC-9<)qZ}``J zT85LRt6(x%yJ|0H&t|C&f!*k-h9IE(exOXqg(6gUOo=|yPVgyk&o9oa;Y1BS%Wc%6 z0FyfgPor%&3T>h*lFztDvJmDrofGk0ATMT(S$A{Qmh9*aO}4;?r}EOEA0pa{(Z5(B zg8SmP$k@^8+FWrm@MZNv{8a%A10$P~K}y4LrBP-HX>9Ek%ColDZcQwpcJmO7#i?t!<|>%PLGZ)4mhykD_< zSUnlMT!-hSmX$&SV6TwRqJ1BUSDEXqTLEmJ3kArDt$+~;i$y9F@~2$Vqy~z@_A-wh zNUoWR%kpOa8~)-cYe%|LhdGW6)AjAVp!`I_Tny*oDTVll*sexMI-JWnV`9q6xP_yZ zZ{>jtzfsZ=M1kZ&bD(Ns#^oxUCHM&(tBt9$@N%G|Vn#g->{e?1Ecmgy$*>}NcYia` zjosaM2TU3AN^%bN-UqSaxg$B3S18NlQ4hu91VFb0D=94pa)f1jIUr2o5*V zHS37@4Hz>412~K=*5HNSpyB>kpZ9TC_mu|_GjSP^IwG_wd1R$D@Zkstio0Xa+rD3s z$p}z@fx>Lb2@Vu>Qv)m)XPJXrL$N7ts(5{lH+|b`MUIYuo$Tyl@-GDOgDXL}K9w?% z+Yc1)d+!C^3@?X^ljsRkZjgt}3dPR+=QK=Or*KCuVZ6{zNh?-ND;hFM=scU$OUrP= zgmVA(;`kL5pYB&OBA}9jrc{nOyAa>KeIP5$`S=e5D%|}5#ATqU2B)vqlyS~$2ML-c zrJ;`d!|R!k@<)OPw62G1%-q=Y=U)YHr4U`1V?hUrHfw9-0bv5>1rmJ z<0<}6u7;#ptlfb}HHy?<&LHGE{ces8dPf~8on2e=yY}Fhd`#MGJ_%_n?Xo#~jDb1n zefY_oYnD_sF5f4;V`77RDz4GAhx~=mdv}!?gZ3!nelW|QgPRVRD4w$0wHY<`Z}LST zhQ8>Lo3n&KUfDX|3`z)Y3ykXQLU&ipF^7<|sl4e0B=1Pxek2YYG9-uLcl#xKKbSWG zy=ciz1j>UHm;^0T3cz~Erff<5asLc~(Yp5+WSVv6)#YX-*c}%J2A*h>4GD>n!4tHJ zu%hc%6ohB~Bs7|RkosB47_8kAfI2^eNF0?Y0zy;Q>e9eqSDu1)Bvvm7^ugC-05AyN zdLIx+^mv0cp6kVFVsLXZVP8bI+}n_*x)Phgp7b3Xnjl4SR`9QAQeKYaJMcYK6tZRA`%OqeuC z%%k%@y@rGlid!S!w4zU?#53=r$}LX3&)Q2~Ve6Tdyinur0s4$HV@`L*ui$*h8Oaz{ znVw3L$9iCkoxip5@@|C5$ABg!kX_Yx`6eAgkdVpPNsoDtssx)=^2yJ5!SMGl>kc$h zOj78XDF$tJHJ9h6#_oHL=dQ6`4xMloibo!mx?v{)!}Gp#`mBzQgEo_{=pEnbwT{b^ zIjtOwaDmH9t$|Cw3<+Mp;qUaj4$*sl%23<1!xZylcE`k#YixXiAjN>YHDKKLV6bz9 zCovv#^$YBcD*6J$Bp$QotE(t*Z# zJymqC2(FC2{C%LBv*<xB4hYEb9r>WG3s7tPraxi{Sl>*L_TY$99=>;IA4g{ zqx3#!%?*rtVzg{B__qgqFFDPsmKk~m>`#R;l6Y4M`$OVIN}$7~X&t&Aw#WNrymUI+FTW#0!>?+21BP#2jGFO?|DiB*T1aH?mt*K7>f&b?S0;oVjN`&q9$2Km`nxv=`AM|B5 zG9wap+dmf*d}n2Y$o&7=P~i%)awGVE%8(Yii)D4Nud;q2<}4oJeWH;sMy6_>vD7QS zVk#+S61=^(!rga@eO<^NgKN9ygW1@_bC7m|!?i{Bz;lpnUOkFoq3@o0TMPJqu?Am5 zTj--hYHE4*nNnc>B_e9Ep2CbkOROnvwgY|zY^|!!@TT+^YJa@_4L6wL)kMYNv8ie> z8#j7?gm16g`$vHk*}3itdQG#0OcoB=GEc=adBf$8&JQE)UQ#bLKI4qtLy#_A)Ft4u zZQHhO+wU#g)-BtvTefZ6wr$(S|4q81Bf1AY$TQ4Q#>qT8Rz551cgJzGNQp!Fl9Dy{ zjnGA2!<;D!MR)(mqtkTOAPOFoxnZZb5LanKNO*@8pv9!Sk@FnW^9ZfPc#}ojRqs_; zMC&Ac3fv-NkC(x<2eoA}zDD>uETM+-$+^x0xpVK`hGOhupDq6`{btd5wFmD(65)6f^ zMN3Gedbo8DCnvyqsmJy=`vsNGg5*qjcNZ1CFJO7i zj55dXs&nC2eL@eu%a)c8&1+5Dk*^jW(~6ks&&*VBliEr zVgKKCt^aY@EFAwEy=Ea|=Hz1K{$B?6|H)x9bF(o2e{lkPyrqlsjk(SQl^244~*O;0K}j{ESZicyuA-H%z4lXAou_Y@Y7QfEF{1 z7NHGyOlDp$cS%@Q=eb<0tLSJylJ9#AQ;;z%9Kd=zkG3`toUJ?%i`;`85IFCudp@}T z$P9)77#n932l!e#$dbPfkgGa0x_Tcay0|O3x=zV!U&YMJi(BmPptzj6{5LA7&>t~j zc@Ur_10Zh|P4&-5Rd|cfncZmMyu6p1-=x#+ySUD-;EeE$mP9bx$6Qt*Eno&ANy;ce z%ik#6WnR|4-K8B}dHide9~q!LX2^i6_q23fUETDltZX4Uw^%c|mleNzRn}GqkhTqO z9pD{7{D76dUYJ80>jyoBc7ZHueZNx1c4tqiwONUYczq*t0~laU>`m;xoM702S=m7PKZ)Ibpz>wE;z&?P z&TcMWNuob~>ao8HkG)Ic*E@_*Pl1_Z;c&5(N$Ynzr|km(#Euayd+frphHIVyKcB&@we_5zcY}u<)-1`Z=k8K@e>*={82|L~6@;f7kUDn= zPf)pQy#3!T3QS6W?W4Fe{czkqx);s^a3xOOpO~HW@?YHho=@zb7!RN+3BSTus*zubTX0hj-`tVj zYHjVE^2{&L9%slO+=lwzQg9p`-XQ;9CePILZ_u7mwqM>sURGy!FXy~#LAo7NjNkBg zh1G*z;~va`2g18=xRqc3+pxNK+=d?2A4!iD_X#(@uv3px^H=?S?cLkHAN$zbpO?_v zs3jZ=m=D0jhv0%=%yBQ{2mjWmljBDv;1@qW>e{}1{FC5Avf|Z=>j$(acl-RmJ7?wj z^}VWa{et!oZXPqf*-0nyuunD8|?o$6Cm9F-m(9zlAhP1 zzX_E6M*Z?30tw~e&SCj__RpjV&at!;w=GGM_*K9~CZ?V@fdG_bDG;2vZ7X7cH2KWK z;HcF0c8^jO)D0*phf7bB&g=n2;@IJ)-yQQ`)lLs1V%i?7bCNq@K-wZEY=9tXej;7p z@!G1O=ocvpUd7HdV~TF_nh>l!fxmPkn=9{F!yNaaZvVte04ohCu*W)FqZ{Gp7BM$1 z!I8TPb!^KB2!FkXq9fR@khM!PzY{T|`Ds9Hcef)PmGbRlX9f{u;fPbG!X~gtBkHdH zcs^h&ERQG|9X2& z)RQ1_;ArGL^W}<_2n$0eiUGp~P|wd*$$g2h6?>-1k99JkHUMQIwBkQ!q32slImN0) zGr(B;g>&_=Esojjipil=3k0J*I><=HlXKDd>$&R7ypLD7>VBkKD!P#s<&FT?iBJQh zSjHK%3iLpEQ8W4LYfm1F6IR{jZZQs4z4Kf2Zjaa?zHE`z=4Z3aT&7$KFoP3V4T8;7 zZz^OG-15dJ?h3sXDV8itrm|s%I1+3+laXIBGIf25KzNqLH5zR}fA~NDC~=~Fv6I(C z?offq;k)3^G_d(T6g!B_z?GUhklFVfZIGFU$y+moulyLF5|!w-h`iBb}$0vaoa+iNa0E0kt5hC z7u~P*R~y23jJAuR*6#eKzBTn?Q===K_}&4N(Pxp~>}HUhFt8Or@t(&M(NYWgWE)&^ zsdJ)BmQkh1xQoY7`R+HNn?oN1#FuOR6C@$GONM7-=l5}3;OVnS@vL)^#X9p~n zI}Z(~Zlf1Ud~hlXoY(OlqEqpJPGT5995vO;ONIn9Jf=cDuj_>|HfwX8gQ+%mV_KXO z`fuvXBqE4+J6jDehR>u<4JjgqMlDjj70gPUtEcj!RmU;Oj}dBHmV^(78& zDT}=|_n!FcNTkdE=4ck9r&$g2($A6O8gl+1nS=;TmXT!Pe3GPBt1=?RVcc=?T#|Yf zXZ^bavRWp&)`x<9WM5qH5R_HI&DZ&P<#c0ZdPE6pSDy+fDU52NTg+45AnX6t$-=yD zHe3mybL^?;WZONV{6nhO6lwblSjuspOUIIEiFi&Js{CC(J-%M4{)CoB93A&WF^Y7( zWD?BO)%o13FX4%HQDW4$pXRVmH}x{kntRuKVNW_SY5Ij;GF=w^&kC(?qV^O_zzDVP!v z3x_hJ8c_Qs(RdWR>&DAUrnaJs@f%<@*LOzY;J`QAei4|nuY(yn4NoiX`dU9LPRTX% z%oIicGgDc~JW|@Zl{j~R1YJRDHSF{z`*X*%Fa~jar^8EEG%^FNoqt#TYw0~;W!x_x zNSd@?F@Ft*Gqbuw9*EL`qk8Nt*;ELz@Iv$@kO5!OslvRFA3-uTz-OUj`VZP;tQZYa z+8@6dZNIf<-vrXq$O!H?x-+mVx0i}vjXKex#y-U!zY)?a*+`ms`~2Gaa!BI|FrCti zOqr)AnYb2fYhngtcR!%P`el|FDo?Cjqr^1r2jo#{@wFGRcCn=ti{@m1@8X3prD-I1 zy>5-<(5ap-+DUl-BHikk$UJxQ=6Z`wxR=P_moScu488k0j)&>fni7;jLEGA@=yPsx zKO-WoJLwcVi4r_4RWTm?skMjOj@@8yrR&#M_2^8dF8TgZnAm@V-6FVk?5g9(SQ@tk z^@VpWv@Cm?&;~hzCi64Ua~?<2c20%n7`sC6>U@k@`5hpk+yR9myHpiSS09S<(=!Kn zg0z4PfsB%STDUKF=2Odp*T(uRo3oIXgSd7X0#1uFj>sV#+J#TfH%C&Z zvK^3_zbNE|Ef=0`{aht#S@p>GR=>4s0H)i}tADiY@C?ZA5(2-e8!gpCSJVSQ$#^qg z61IVJ&eqxOjifIl|0~>Siv;UZM2B0%LG3vizGvaXW#Y)a291>`!aW->^Z;_{@^ zEcoZNH-e~sXkZI|daQ3bkK3Ruw=H6)UxWMCN=BexnEGKxwZQ7ra>^7hA@FRjRNCO( zhG52Gak5%uv1W&AD5g_G3ewT7xP>QrUQkKScY+0qW%cMwU3Kr=`?X$?KZ%}DHZ^_A zpwmWzC2c99lneOAkShYYU?2#3{H1H17TGRMW5#Y+xN9fA!@-%0Nu6IlZKgl zKiTf`HA04VR<}DpE2~mJ8?s-Eq$qj%yY7u^w#`}nkRbVIh>rb>3u4`y&{2h=}FMc}+mF5!k_b^CabxP=!CO=wjp|*{z`=ViW z(5dvB=;|+Ix^rUX(7xl2>Fwv8+SeTj!~TO6E#*gv5=RNNkDS9HpI_iXNiAS&Q_>5D zyY{6(9%`&+>dK{`(A?5&6?wd=PY(rLs`=zkiJl=9=Zk1Hhk%%>syIdjmuo1rD1R8V z%Nh7^$5JXjg{j#>%aB!u#)_U2o~Rs!pZ-QDk@C%>(87ls#x8o$Bi_DXWM8SdT7Cpb zI;6ulkKQ!;$Kv|Xc*mGJx>x#+zRcgtLDC`XP0Fv30QG>7*clAl09`}F7>Pv0UD>1p z_5P#hJh*=e(F9+B`KgZt7*p3oP$Us&(yJ#{5UMI4)T|hU7Cqv!q?dF*2M9?q(O&f) zFtq4<4YwpT(;8~v5iq7WO1RAzMShf8N1>hkVZ9C+2U<3=CUd*zT$mIv$wy&cUe7uE z$eBMy7G5I`LoU3em-yiHip>Sh6c=7GjBUWM^8?DspS}ImteB}aml$?ymzdGCINQkt zO-|*@V`B^y&o)3e6u2;Uk)?uT`Q&;{&Fj^lw z1*ax4?2jl1Mx&Op>z z6l6$cXx=aw4wthvnG=>NYt8+J**=}jr;dJ3mLIwR7C8BU5(B_&QX$0!7NpzlqDJq@ z;zF0o4gP(JGv4RX4ITq|C-V(VTAT}`k1$YUA0+5%00djVoO8yV14sGcu`H#R-U z(vJ*T-T05R;93;I!cLl+6*^)%Opjqt&E=6n3h(y-xUqc@o!#%K&esAA1*xNQ^nZ}U z*7Cwc4k2u3!uD$;2bsa^Qy_^}8jhXoCas!Y?_!q9i!1^)3v_Q&W|RJhJ{(pdH=ze$ z9X$^fm9b|mr8V7GX->q}7?;F;fOmg-Sv>zLJn`LwpIXlFs8sprOp-wB&G{b-qv+j+ zVuzbLPQnX3{^#S&>(R)zH^z-V`Z;1ye9`HmZGr=X^<>{BW(fUK2y1^ngwrzA&82OO z{=65240`|o21zzNvp$aTdupS%e-rUgt^YNzbyF*PNrE~#&cFty8Lok#Bz<>I3rC>i zo2F?#w2Z+4KaQ!QVbd&2FUf{N*Xn&Z=DEOeNiM?^=kFnphD2mi(ufQgrY|v$jcNp7^2RG4WeU`JH)2bY)9hm; z3cx`920~m!#&imCCuK?UA);@ptE>dmP`hrfX#dXYn&_;RUAAXu(Rej+nQf=V_7`C( zz?B_TANm(8|D&kZrCnL!?mw}|6YUthk-?g^Z7fD<(?#19>nZh`d}obby(&jAyWz_$ z!rd4- z;!XsIs?GvS%ykiW(wryDUQkg^a`Z06BIQ= zP00c)Zn^UG*w{$u!d-(Yb6}J>&KJ7kV$zHq2bRD6s!+bxPYiQ!&p$`f#;3HH^j4%a?+i<8Ryb~F>5PKTMWOI=54N@sZ)Jf6zR)BlmD z(_*m`4vi@s8DG))&$b?M7wWdnTwjEzvQH(r$$S@rc(fZ=`7NHto*O~q2fCm*dkKn=qDp;0h3gt zAFmGZlT+?%u|H$e5iRNtN!WHTVaJpwaoheSfFvz62uc+b4 zWgMZs>QE#L^~|+ZjsmRI8fxQ=-ZRS-e3VQ;qiJ?VjO7*@5T@^p)x}Oe8EAPpSS!r80?+ z6tC!n$5PNP7;-Wcj8O6P=KX!>dfakArlfC_3L)vxQjE7q-c-QY#NlO?Sj*UCJ+7In zQ}6mp?wMhLRK+fdE6k)bg2DTPj-RlCi~`ZBExKihrVNxPCF{@xD=k6%S%Wirz^_7@ zoOSGv(M}^5%b7cS@TB>JL_0LQ_d|xGO7kz7z>XeKd zGW&>++uC~#Q2(Ua7Gv)8(2Uv38jXG$RXG#~i)o^c`A?+kWDcF;l2*KjgOMqEPoI9e zjqHF8K6|uVe5|?IZbXJ+)cJ;$0*gY%xED)L$AeXH1EvSl-c)LCjd(-d9Evu*YmfDa z4>#BkIh_SjzM!s0<6?VJpX%(makq{~FpnDuc}h4`QWrx6!M3o!%SzNHHY>5%oA3Fx22jw+vk}Aa;f2T3! zv>E;2^n6`Yqmw3%G72 zw~|94QDPdfxrJNWy3UGMU;Ulwk+V|${k_zRUiNzir2hUcE)9|{TD`1opY9LL1hm!? zmFkUxYSpy+#-|QQ&uxgQs1Sz8VdaO{>(;TdhWCaV$cfN78jzMg-0b%hbtHen3^p$S z$@AF#s_SnXV|IAX80rAbur9;Wv&Fr5qhUL)!7#8PO%alPJFj66C}Ol?0VLPv%Vv-w z!Jfhu6Ay&U>dmYtQ|%s6Q)sWY2LSqyt|ft8Lml&1#Xt2z#!cHKJSrB9wm!K^ljt%K z^+n0ZT)8KipyWgfk-_vG+Z8;{y~1~Hcs&->Q6D2}(sHXz2w32Wp~)+5(g!odq(3<| z$F%QLBW6QK5$|Qcj-Ct4CUFMNvVDevZR;|6W=0v<`$^RkHbcg;8JWA^?E+c>PS5$S z770|gq2Vru{{oG~Dd2*!`}-eYLD!alN3CtPH&d_wna*;l8o6{XKOCgp$WwIE>VtpB zkdPs~R%Ogf&INfBU&!{&MY{e-RcwH33h^vVw@$b!)U~&M)sK&OuQ>SPGAz%>4r7jS zWTbj&s8Ts(_18{@ft3(8$>Q+z_YzI!ecO$*&dTt6N5b4oEl$OjX$nIR#n2)VIVrBm z2nH?j^7?*()3lz-T;^E@N6gb{863}jM1XnP7FOHZZmmoWhoWOxYtu%0Zj+~bZ91WQ zh0NfJtML3{toLa18&y!;U3s*Py!&fxNWt%Fx(Lq5lu^9Er4>c=we2wNKnyM~gmw5O!1M z0a01bsiijd4~gAKv;CwHuei~hA});?MOA!lEzE+#Xt*v9%V0Q}rxX zWsl34I_i_D27iu!CiTE7r-3&Bphxm-7BT5c&h0apvW+;{e@{@#;D1m zhdvHFr^-YNH`zXi_G)A=FW}TZq#On0N=&XFyvhR2=2$mHp0NLG5_Sp>$MZ5 zt4IZq$g{eb(iJKX^XSX!YHxd)S8T;dX!~^DaAR{y`2} zloB;98t;DW-EzJDgQqZ<(*sF$=a~OyYMSE~vv+c>odUOfOOr&lj!31&xQw1;aDmlO z8VFRpn{}x1s#?End01AP{mhR%;x#OHY5%-UMbhdwY*&fG}{*`R`CmTAZ-$I{Rb20}?ymO>l7Gbq}h)7$k!{ zPI$I+;iF0vWCx8)iFPlUNG$F8QQq4?a;V&3+X|NHkK&h2b zU?!l3HYv1fN{#&=8B$$6%JJac>YIXy2Y-&57Kaf5zTxS_q8u#j^A7)(ryqaeOsFN< z?mw9Rc7=FiocAS+kACv`fUUmXtXL<3^)H!4ajZMkK7UwqUjLzO@#=KxWHtq}Qc~^& z+WojZ3}|=vSU12nliw35mFHt)4DgCYAEe{zp!B?gio3OnU^biNX>8fr<4p#LZ8uWm z9#)N1<=F;4)AF3hF~dUAxp5)>`hd6onWgo3m)O8Wz{poi=?Z&1%UdNOx=Cac@G~JG zG5LlE^9QcX;l2q)HT$!*PM8233MuIbpYgs*(N()E+o84Bu8V^){XKgZts~qIZ}{-Z z|4mzbf~?m0MCLY@Dj^F&lHqIb)hd2sE%iL&<7nT7FDkO5T2$E3q?x(3vbbJ$@x>c9 zB!s*+ize`JKVt)HS~=PFZlKgn#$~s5rIB|LuC@|eQ$rrzykb=7%BQJqSKBO*sVI}q zJGv_79!3P0m+OZ+g{|+Y`@*{W0F^(?=0Xug#jEv>hbT#TTmTg6#>(3g4P%R zy!6fZr);hjyL=(sL4nSUPOzivfzaEgDJh?1bc~p(tV@e#H~zgw0IeuweMh|_EH2ob zdN1V|0;TfO*PW)5KN&+W~4xB^Vtn&moBS-VN0qzD`-J2@pjd=f5pkI znkb<{wP?`y=li1VFTI^}*WKtK5$>(!wQ7S8-<8k}VnXL@YtDCo&2}_Bh`}{-&~C@v zzcpj9qE)rBwiDc3+gtfPJ_ijv*Y}zV?ZMA$gUch#P3!HdIp(FyD8!55x0mNYc<$)# z(HD@yvwWz61jtMg{5To_m<`mS=j)_|C58p(T<1uw0BG}>vdwflN@oWYzzMm34FS=k zsBHr=stP0eiT7yI+M6GDXiZ1V7a|9<0BZ+sATP)~X_y~9zei#s#u_6PZg(J${EA5U zt$+N-ZF%a5(Q^0U*FuEp*pE*we=xmC2U>C$>eY$cdC*4k2+%^VMWu8qzUg1&(S>1g z=^hLeTRgEQY~|j0K8ZiEW$be}#Mg>psxw$@8Sj+PxOBGF}{UrOTV z1Mx8;-;1>qxsB)KK@IT^#{3W7D{K4VX{q=%sAkz7rJo8#5l(^R-kdIaUZ*3U_G62O zd;MS2_cGEmMM{`w?AnY~hDZ!U1rQ0}-FhDFBR#5|mVjp#j@$W=U5q_;qO=`@P)uav z*}tuuiX+mX(GZxqP%kQmMQ`N=<>u8}?AVTj$;)9`_-iF-qNhZd?M2%WTnET7ThBDW}$A z#p&ABWUA>3&g#==Ii{xT6^=k=>i?c(7q8Fi(pZPRAA~sNhJ2lhtGR~>H1*<4xWSmx z@(`qkb!+$1*s1PKzG4ur_#HPS=0n&(oba?FX%kq6p>kC=H8X?f2ub?!lu}%)puN|R z>-B7e1*-kgfa5x@(}xRR7MHz)Z@M{hLM!)hf4UpwRqf$^t6jPzwlBV}I(sAS9Th8A z@k~(Z`<~erXVQ1M}A-X`( z$f>HQ@Llwe%V8UuTT#W|!TL|L9S=q9vSBF&9v}bry|ARZZ&6N9dk)KlBHu$) zcQ-D1i@p<(ZZRlx7|m>3;ZCBmC?ir?6>p1SFQJJ&3^+1iqttaV5Bp|Q`couSuq!MJ zBenE{6gK6K$KyKOO~P%MRA$GW(K;GJ+7%>Hk#?6P<@ro*O-7?{<#&p&7RQRCnoJh0 zZ=h!Za-5-!lnm2ZE08L}-1_=fE8tfLVANm!@zlH4-)$Qgb91ELj7tq;Zv3s2`G||3 zWd`K8?e)uxqXZ>qu4PXMbTG(Ty9*!>-9%n^aw&e8ko<%P7RW<`7aAXH z7a)@fLTWon)HRZC@GCK z;CRzm0bjKfgx&kYf3c zR8M5LyjxR+Th+QB=q6+P`_<@gyN;ob4t%Ud-6;N$RAB&Da9>Ia@KBP&+HPsw!LMfGrCJ+DY3Qeqnc$)OEy0SPjbCuwDMR@O)w^B8U+xcK^{cQL-)T@AG1&+%OK|NL*Gkq% zdRyBGv+Q>JDbPLoR6{|TgzfjiyQGkVv7F^o{As&(&&^C-3grGc85v&P6G88R-crR}9l_|HZaz;_mUYM?Oga7_lL0!BOs-N;P3s49%jd z^w}$_CKtmemcR`-4H)Sv6U1<~d#IC!C(YqvH2bYWP=l&hiJQ6_SnS_>+z^KSRs$M4 z&%={!t*aM^-YEo7c>2=#hIOMNH4sFw+z`pQphYa9rE3FgOkXJ4%-5V4DYYaPtG;}j zg{qG<2{*o5vO@BgJ1(7X*9tsws`+BE>>yT)TRY-HnAt&*B>8Ujd}Z9ylo%z-f1g{z%o}LPxCNxRZj9#0MJos zyT+_OK&N3;@AUSkCdNSk7J6Gx#zox^&!F9mQ@qEq&6!c=!1YhX?<^lA0ArX6@dRsR z1|e8;&CY8jU7wY#PAiv-$R%xQ%TpO;SqsMgJBZPx#7-G;G#Amj;%jtLelK+yp*MBH z-$@s{T#F*yF)o$3+8$st*LaZu98AzHi-_INTV?#ck(T>K$`r(&on;5i{7Ux6#_Iz( z)6KkVOETVU({=;)8|#8`i1HW{7(UxB$eAig;L%E72ur( zcGHw3YO=qldbs^Kqmllt^mU)02A!7(QpV{L$Mg?Gw5tdw#@9U&Bx_33A*;i(Hn21G z%Z6qWuKqFeC(VlzUE0O^o@^P%!?T6W6*$>$(ua^IhTQ>%CaeQ!uUry_?rhq5IisfW}g7 ztNkT2)}9WuNPdRc#XbxTlE&du!n;Yv-pYsrKjMR%;& z0R$)#ikPG!zh^SN^OmfnZI182kdfjeL5fQ5lxxMTv2m4d5$PS%+$fVESDHftvO>|= z$vEt?>pd(y4k4r3i{O0;@?B#%>WSs$Jx7+OM_EbsIT&u|IxK4yf;O3L`;9-!Xnr8A z+KW~9piW9EjR`ZZuZMOzF4>mYwlDrc0P9}GphZ`xNd?6=R4!iIJ?TJD=xmqPoc>Ru zH?;2xs`fdo^G(KP4LfHCYGCbyI}&6wP)R6z2nE!(4JY?yEK-j%B7-K(LR{ma z{Jxl9roH|oRXd^9cmM9ZfYu8Wg4;sT9{Bv!|2DNf;lqg^;8F5e0aFDWI+OyZoQ?61 z767rMAv3J$a>X12(E%Pz9J5x0UA0BBR%4PmY_aWCSi#>4-$)L`$`oNN9JOJ08sZGX zxZWF_^M{%DZf$H9hE{-WA=L-z)qhO4FoTa1>q~EFj|a~8OBdT=w6V1r{pXmSKuls> z&oPwwVxgsU0{WWg5e?>1;AY}OUUTZzRrhR&2l(p z0!9qp?2j7=+obeQL;541Cg47@ZairLEw`IHkYtxCh`&e)^NBc+}qU*(B*! z_LS#VpsK@!LiphBzW)CeD!C6k+n_)Z5@|N`)YK#1cy-#ioC=>X&%lw2H{g2;a89*) zUQUOmFm_qs+kY;W?9Di0QQm9LVEt(Jx*BLuqK?P40$db+enw?NSU!!iZUzMq%s59F zA686Ukp+Zjmy^w6UC+(j^uG|r%=Y%}{3_eOs)*#_?-vg|O&f?zX;}G6hI)Z0z_+Nv z@HDMNd_}*@@Ie{UXhoz%D15wlS{(z6wJduds&&UG&Zqb)eGxyMnCa*o69C1oYEBQ=bXQL!5NaKsqK5DbF^J$Yz*ge0@4v=?c`L zh9pSA9j+YL2C6>k_~V);pV7GVx&w5`(M0hB(_Exfg4!Zgp_!jl3!vLrd|gL9wP>o> zXOoAx*Kn6%E7-G;xGgz+j2k|3kfziuCoV|mw~H(r=kAzb#=;-VgB;q{By3=d8%UPE z!>@MVuBFUl1)Z4u&pFSb^lWQWl?!~IE$;K^N4p>8+P`8P-IFKYxuDO>&vt}Qxo@4&AkCo;7lQ^z-(%2mmZuWKEm<+AuV9(WOr0jXC!$edpfhxo zP}iqK;c1Y=Sm;|*yOBsEX*?lD>|ifvBhuf45erm8XD;EU1*bbkx)pd|1~K`d4adD@ z5unsD@`Qkotn95YXcty%^i~jkWh7%XG0`wxDszL`UCGxcWWOwxe!#*y@J(wZ4@clh z3A+UC%`la1=?w96nCcmw90AnaN%?(wg(~ogu?-4D;OSdnH@)3bAr@RRL9CF zuQmAi;A2k+->75s2`)_>x9QDs;?o^S^ zWV>~SS+*V8YO#gY)v;xmDUb=p`|uQ4yDziSyC!Hl958l_MErq~^BUe2FPbIHasRoL z%o>j1_AC2m8vhT1jGM{YWch6oMzKxMmw9`w@ zZ3}W@Q}VcFeY!|H>osKrp@R60DOSbYyRdVVOi{8EwTRW6eBa&Pvtv6qBV!FleGb!i zXct^wbC-l(;=qQ(-f2`wkU9eNi1jp$TW7gW+fN2Pn7mlzU`geAktbRwDGF2Qb~Bh;&Atg8VHz^>Ut)l{P1Io09z{E>jVf^3+tz|Mmt z7_rkN82884;d@n0Auo-DCDD_q+@PI*vE(;1>JB+r*%F(zf@|=Zlf?6DhYP0iM4)4V zSa%2=WIH)XD1-@DTl2pZ4P0B3ez2>QO8R^1^JA7_l6%Mv0tdQLvWyD3VZjOF$LyeA4vBAxZ{A z75EuJ1+n_Iu)vhYIRa{RW-b~<7bNJ>x4ykr7yM8zXK7*d??BsW@N?oC6~>4MF+_A6 z;)&uBgvhtH9NfcHt%th)W}XtTjVq&gRm3N~()l^~;o#?G*-xHdW~yeP&p+%FkAth{ zY;exIiuy%XBoxlJk)?c^NH+Z^LfZ+Y{iH{1cQ^G0=>;YunPr&^K;@%=!XmxvWr%iB}37A=NbqY@k`&(SbBNyeg`V+oVZyiIn~e^YvgLAvovuoG}t;g6~)fs+vk* zeyT~&o<2NBC<>0m_2A_RD;SsM9fimn8>vk z05m)}#0`m^HY9%Qfk5eHB8<}GgYn*)rQ@~zm!709_bhjdVX^GL>{O(#G5QL95vCNc z2#dhO${mYxClYUs(v|Dr%K(1A-j(x=RACl7PBpM9?o5`DW zkT~>jgn(6@U|_ghpsk}oPH9<};c{CWYwEhi2{ZO8x|eZ-j$;gsbhrmt0JV}$>0Umx zp(=5*hchDGu_NYkVydUnoDmBf006Wv1;vYF-?T_;r~Cpwc`%*2$v)3!GFeZEmJVYzo}wX^(f>kdL7J znJ7j(t5|FA9o=G)O?nu*;JJq^`=5AEl^|NrrHvyp35mU4O=ZT80#2+wjj`Rm5^Jh& zmbECjQO&?9jsQzVqT!c?xJyJO6365S7UG7h{NF1z4-8mbV9*!Kp95JeXR+A4eKuRD zqJ`mz?4Q1bQUi1=#f$f{T|9ww?o0s2a_(hU5V}><)-#K4#GDxeKBaW_?;75dIxNV-N3Ep-C*i4{8`MgD}%)J2ZYLp=!=g|`Q5A2TBn zlBv+~GI~MPomvz3D0C;0YH2Gb?Ajg>;ozVX7sPab(fj>~71smCaByI`L+UR9dYBem z9pwC(@R!L@Kh{=A&r?Cw*B2@g@p-p;5-XH?S{dMk_q-;@sWOoY2kJx!73g zP)ntwm*yY{c)>5GFnxI0*9jt4p;rMQ&gqYjLO)^6f@xJA@Dx~rc@g0YSp(1s#8PNZ z*RVPChy1XMv5SPrk501w{2N1F#lLv{`p`h&m(=a`ArhIj>$ekyk99p_diA(0!JF&5IRSYA4Yn%HjwCOub@L-_L3|WgmhL!TE@hw z*8SENtJue`y2AvtJsU+>rdU~#z)w;(N9WgmT~WQ6VhA>RvRaWUGWdCGH(Ad#d1fe28261r)*qPSG@c~! zRyAcMw$!fBaiJZGF4`s%(~rKQynt3|6k{r3rO!G9wGyrN*FPK3xaUmvTK#g?LN6l%&jzZ3QI9rp2oPI7>9D=oDi-cQEZ^tz?^skyKq7)7E$XNEI?KJOzt2!d;JMTO@nR5IC|8){0Z--*oyX=vv8xdJq= zl0)zNdCmGon1Bm;oJ@=0t?R%2_f0J^L42<{tRug601l67~C}&n+3GWF;-EAlOBZzmMull_P zMq(Qh6Bgt)+Gf05?W*z-Wvb&8rwGjMd_5er^1D=EjkC4GpVEV+-a6^)Rs6DMYqhj99zsPh`dLv;7b8>gJxf)y@y@2H zFzl*^WbJK{#Wx#aMU@{=f|m}xL~Sh)^2+je2=U4PCz?Wx4FOc#FR$C1nPd>d31r5=g z^cOuBmP~?<-2eGoF43k<-r;L{mNRr{JtYdB=EJD8vY%0(6N%@AEAzO*iRud&rd#;P zq@@c^KQ3y&*8bB`^$)Zp-YgCoeLu@Xj}14+_JP))V0jJ6yDSZ;YMWb6IDcu2KxCL2 zzCZ<5HT|ac@Rf2s0>^K5=a2!qP8mzw*-Ta3_24}st9xf+9P0MjbHetGvx%5*kb9x| znxM`V|74gT@}0+rOi7MLMmFzVvfmldI(a97_OtwMKcUsH$o4c+tj0Z3**RK%RX>-U z3@aMVpmY8QBuCyqgaOHiZ4$q#igKoWwYM}lu88{OXlIEC*)gnF7fKAS92y`FqjDDc z>!n(2WHoxB>+D)`vuX(L#n;eKKL^Af2izq=C)}ot|3~qUCd<|%(EVSQ@1xbkgxVQ& zILWfQgQObBuN)-sz5PlpTS#VQUIhcPQi;FFjD?;}hR>KbFa1m$?YXs}AujV_Ubhgn zcVW-yQ}>IN^xTDE?|&T5b8@BMirjl-e?PRn|A_OfUptbJgFEe-?+_zMz_gEA#*^r) zrT=6MMvjv;9XO^Nt=@G0q7$oecKC6vB_f2%!xI-1D&ZQSN1D8sR~ZHOiYteyZ=m1v z{*zj!SPFMYx?ymLEX}3#uh1#0mKWFVox;hcQT$dN4-N~RPfzGVquO4LI|TgFWa_%p zkyJP_s46tyXXWfZ3+-_QeZQJ$21B=U-*+~S3cW!gMMMN#W$vbAC>0X4JgG6qprUem zNSFHf=B8|!i?#6irywr$(CZQHhO+qP}nwr%_D zukl9Q#$CPq2`e(^n4!5VaVD0FGL~qJVSrfm=J`*`=~eRUE$*kO)o2JCtp~n;zRffQ z)+Sb`>p6sWK7(8+_VGzyVK7a=W=g;Lov||S8s8+v+^cP$Uw3xw1dJm_qW0ZuGzTFk zKZJ+9cWRTQYANFQCs_HqM%{d$YzqHU%)mTiBuxE@Xe0igcWC6PidSBGgRhoTZFB_kR!4v zt~*0hS;9C{)>bLa#jBJZLA_F-z|mpTEy(0m`h8SlT|fz`l()TkOM}KQK}q|sXm}Jt zo9`Ss>UYW0dX}Mz*B+w5bVQ^&=R;!%XBoLurMc-(?ed))Vd*{#vI)7<2^iq>oyu=m zAyOr%bx=CWab_M}dY2k7WdB`gd;Wzr=SZrzT zH6GITF7^`vElax~ERO>wKdU_&W>dzqPT2-H{!zs?3i z9%tT@NzyYS1>-y!S6ouhI@lKXxbXePN|P0!BN5V!6KpE)&N7Z+(?B#L;K>PX(XX!N+u zX@fBiv6hAskh^Z~nrZw93cvdRY#|a}wSA0O_Ybm**r(SO_m$*dCN(h zlSZ-D65H5Jds*Z98FpO@olz@)Y z9n<^MGrO57O&X5Fc9dyL2VtT;LQc86sO-0H2b7NfViIX%$m11^O)Ntu5#xxGKy#Eq zL_-lI3&A!Jn!GFx31v6Ke653az!n=sdiYKCi&IaNNPn4wnTHm$+Z+=^D|lv|5P4D@ zQ4f2L1(xHr0H>(kq^%4MJ!shSriiZO-jxE4${Mf@Flr5m3`Z*4kehzT!5D+W=>nT^ z#0-6|1*O>gg2R#Apuq_w6@S{4K@c0>`z8Jk{B00f#m^nlj>UvFKwl&b^L1^7*~XGk z>Lca|NZQ=|UnIJNUr?aL6w^Wru$MU$E;rgyTw|%>29)rs7x^JtB9={&3M^dKmN}vk~kAqu$9jR zW`11Qg9QYJ!el^-F`RMa6`=S+0~}ep!+kqXCAP_&B$c{2{vfwlYQ0G=#xs`pA0RgkuR>^h>v5#^v_Z{3Wto`Ok2bc{ErEku2~jvQF{*`O5l(o7MA z!T!&ccY)Ac&WmX;eatS6u^zWrIT)%f(wT6#nbiv7aC)cjTHLoEqVYN}TCiu-iMr$( z-tvGPd6dFG8;ao937lF$Ak$Flr@SsHlnG>xO=zMJ@&WQC-@iG%nwF)vI-$5BZJ}Kl zO}RB*!M*n@ce-kbS$DOp;Rc+DBrs`yhh)e&DPEcBg#7vwiH{Ygu;OMA@a7*S+0*(H zGB(t@qiuX|BR``8l2Wx2{MRbjb-6fP8CAF6EGa!%##;<9a@`P*w0LHhrz&h;qqrA^ z>}4-_`!K$or8ONtkY0sapI*R2JE88`g{|UWG81vpR-m(FsG5C5@eGc}vWp3A8Z}F50OQ z7>6&hJG|P^&x3^o_)FP({1^!gtA%&W=@NoH@nw8*SCrs#zoIRWF$gFq%XwQex{pnJ zD3Z+4Cq#UGdOd#=2`G@moI;n6Y|`{&s{t2XiU;l(fppT8NR!2)5+(iHU;buS?Iwz_ zrNL{Vd7?N+>cE~1l9&|IU4QJ3M20L|1*(hr$;4d?x!G1>gLq$|`+zdtl)37uD(wMA zFzYnn5q%VMq4MEKDz6@`yvvyj&}@2fHbA) z+rDpGcs1;>^TB|nQ3JQo|8lnWz(iU8nVspXOt7T3H=9#!KVBbdm5L*UBWOOXdO7U5^LOv&6HAbhcRqqyyzrGI5OM%#2ob@bek$$(2IE9$t zBTq|6I9dNKENt0_0^&B>HC#BlOe<3b@1S};wrSe(jw*9y7K}e3!j-TB#PH*YZe8}?$BgLtMDf+X*5>*W)`*GUC=z z!4jg4pq~t5HSTM-aO$_7u_*5gUy1bI@hN-H7cU^Y72E_`FdNJHXFM%o&Ww)J&}2&b z132S`mLyb+mm3B5Hb_${RBHryD6s_03x6@*PKUT4c$4Me{AvVN-Qvm9m$o;NjI=h( z@nLj{D(NV3w4Hq63k2#qBs$_8=CV<(X}JxJQh){Gnow20Da;;8J*=>dHOjNCOYZ%3 zq5kXR!mAy!rT#*e63SW3-*U~*oXl9lG8A;Nz3P;{WvQJc`obt*3pbI*{mEn97uV~LswrdhK` zP#2{p#_1l8VsFA_FQ*>%-+C^ohqZ&8d+@2iIFE_n>C4Mgg{8EdtckqdYBM~9^T}x? zLlfdc5zzW)*O{=yb5TPL0D?(6yOXF#U5eQW01fNz+w26wzt8+Nuc9n;JKVFiqq%jy zK)Aq_>`X(|_~G!~V(hj0#j+(R{iW+e6%}6wc0d{lbByirKaDsUc8KEpVvQE8({l5k z&}1$9G!Wq!PLQf>4Tw>N!08~?uq7b6n`13UizJxDrH3u|W+M|?U_ zYXfH!VG|=eV-rYTUPvcrM-u}ZNcYX=4in`pt4-GEF4Qofft~+*5V!wvTyErw+nU?| z)oxln2qqlL9u#@yW^8z^e!XdFOynFbAMu_@stO7eR*&Kv-kL)uJ39j~)YCIQ0Ue_( zOJi$mq+t28=^pgX7P9M{5`>t4q6@s+!No zu#S%YEBtvxGx;x`g`vsi*}kO(ES)_a*cbx^9WXK$_fF6Xprr`7AKBc*&4mCRyLOQZ%jm5Mn@(@aoULH+hO(9j^;L`~X0M(yseq`lSZu9Rz^kWwKUeEHb7L_*k z)sF-~UMqlKwp&^n7Z*1=)wUL2R18f@l&q`oy+TW)3y2$A#~ScX4J{w%zHYFcBfT#T z$r$uo&7Thka9k@35Jx+}FPj+WucXE5yk z&fcB$-t5@i@R1*v>EZtA09dRTY&%RTR%%oR$+a{kc5$p ziHMe$(2sXPXZ`v6@47hPqVZ(sbXR;2!ow#XfZNmA0I0aG08d}>lI-bG9GhExO|ByE zO1utNZ=3myXJzGjbhD}O9`pLHlD9(!_5V&GhK{v7i_ z0TK%c&%BV!e}C5Nf5(Z=O-)M74d9A@MY(@g#)ft_XD@I~e+~0MzXXy$fA=k}Db24S znN(Uq)78H!OMVk3{G@llbcgyD;NEv*dW122T*hy_)py{rFL_Up{r!WpAAFr}9L!BF z0G*vc?Hj*}fO}N;e9n7QzhTt=5&~MPV!}DMc}pKuNcx9|hKC{j z-@E|T*w_Gg|Mj4-f_wh55CD*hf{V>}LG@3-9D~=}I}5xoiOAXlB)#J;=!IwD^cVl) z4G)3pGk(x{wlV*}8Tz#`d*wa;U23Ff07{?w1yKW#?)%|mZE-y^H!(H*)q#>t^_iUB z9sRJ$!2%?`?CpCQcJ&G10xazX)_0rzWYJA|NssjnxMkA%1>Gg+{DE-*O6ULa$GWM- zr$F8J6?5zw1#$o4-u4jM{smO~J=>C++T!o;N$+lS{(=5&NS*M3uj^q=e(#!rGLH{QBANG+A?RATY;PCjMuXAJo zLRa727$11naX>*~b?xza&-}WK|F&%2DZSf$p9KR01myBF1+S2ZG4;x4MW5b7`b89O zNSZ_9jxJeR3)pNBm#BE{d6m>J#1^8*k3sta+kf-iky|pgW zF|nOe4tkOPLjHn~BN8HgWJY5Sa6nQ8r0f(k^O-zBxlFE~Ic_FxMgU+UjTv(1@WeS( zFWH@|T@-(&++gJu@JOPnYtrjn^SamOAGje@PrC*L?cy>Z8OnT$s9K!GKn*pJ85?AO zdeXlR7)b@^l4G8_K4fP?%-Wy{dk(!%(&_j6HpUPR7#;O1C4WzUQW6W0{x)!-|5C@0 z#%?klvCYAuw}QDE;uZE-%TG-R9w(ZmJ7|HqET&fVI2Mo2c~@0)Q^SB z4=6RvDkL;Z@IfD)(nJm$3ATBNUlGRouf59dv5+iD;$A5U^Nw6QXv-L zr7v#{EeLOL&ZffRQlJ6T;fjZia@;<{n2}vjPsT}gH+LdAoJpoJa^uCRGy?wlmqOXG4-r( z;{!x&8jppp%bFx6HC!?RGn2e^kG!?Q7+s$lh-OQV2~3C*u8~h27}MpNtw4iOX(2Yn z)RKrMD1@_>!(BbkM(++^*%d1X4Aj;m@|xJg|p7?*9I8v5q*wkY{vg zY_15!{R1_rC__wMl=;=GVR~2o)WTY?i^reb=4WZG49|ve=yqJjp%vzzmM90zTWP`T zNT#TEp18$D5?fb2LQd7ukvXbu8j~k$ltQ13RTdY;6YEKT054<`GD9@6-#{0ma-+ui zus(WY9swV=@0%bl9rTr9T((?I8$)(k1MDE75?M4%of9jWbnXCW8Zzb@|0p_UY-k-8 z4Zrr5;a->dqWYSkLk;jszS6-XNTq=NHC;p%Q z7+j-Mf4{w)=I53jo}7UB$igcWe{1#g?6MY}ULsiyX0oO5>tcQAR*%Mp;V!q%LtKuS zWbSZ%&&~*5@43Njk3X0Fq~vyu{2e&T732FU#^jLswd1IR`7EFay!R?erC06h!~jPU zHFmrgmMj(vhRBb^DFfMb#47kVlI48&*0|nCmPY^-nQdRzWpzz{+fmF50nP;0;a2ZD z>jV#fcbqld%_-5RyjaxhS2ngwEvJ>f@vDUA?21oS&cAJ>!j^hKnU%f~^D&vfd|B^4 zDpd@BpDA91I`_(nhYLi~*R(hSn3rDv>aN3{nXq*iq-Pv=srTB`6b6)ITuQvuRoqT{ zHkygruYmUXe#YflR=EDG!!x!9kUlhKpQ%8N(0!%ec0o(e)>g-;?>;{Q;n%= zg@^8FoZrAnO71Xo0|%}+sPmL)6$eP``k_Uza+$ZAV9j1-%ZfcO%&Tv1i`Wkd$er_N zf{G$&O{vS}*Ux9@2i9YlLiWA>|B6?AW-8qzUO8(cU)~&n@+gj$Ju3X5&RFS7h@lsV zu(P@p4*9uJvK@M8E3&eD82*MiqcT@OS|VT`xFPcKLK8z52lNA>W zoyjmAEz~O-N#HWgSxZo`blZMntw?wRqSWdKhMNUKG2>=X3z)Ifk1Fwe7dufpTnT3FBTB6UW@@2gl2X?j~vd7qcvE9vFs# zvtCm*&+Xxhw}fXIv7M@-SdXK;4w}azZpvBLC7IPp{SnKmZzoAe?QZ=J zu?3FN(?O~?5isJ1?i5aEB&IZsiZHF^!5Tb+;?&%VW7hq?!)zg}>mCcS=x*icMqQ~v zCXfO=4AG}ewu7vSOsm}m>r4@`i;N{xckj_vAFs-n7xh^(M&48vN=!(w17cgi$t#Z; zC0VQym9{djwaG_@rqVD72c6F{Ybo@Yo^|hj#f+SdV-(l2W#ybmw#x(nWIa-K3M15t zwlBMhehORf$d5_ZV}%pS@hnM#=%5$*(3iF!K5tLbrI!W?4BxFCfoDn#vkkPK4$15(&y5U-V0oA>QfkQLzCy=;Uc zE0!Tx3~O9tL;|WrOwN4IS4Nslg~w?H?glc18m8;_nx&A0+rPVg+rGOtCgAe&G#!Ii zy}N}`am=FY0$+IIhmDB$qTX9c$}LmhJ%dnsmbpaiB;fN7L5lJM2{0{60E$~JK5C#e? z8rRUzDa#(#pB(^Mko5o_RUuFaEnFEvp`8gb+OTl235kErF*ZV}b^f4$KaJf^fEe;Q zE zKKxxTlYd6d1+ADPH&*S%W!bLRuW#kIK|zMMuI?0ECL`bvy_b8_UPCHYDlG(VXfLn} z=B;a@5u@pm0?Y(G!O%*e)nQJno7V}PtK=0Bm)z*ctU|+9>LbbL_y=mg3s;_OsSBE9qEKUzI64KfO#@cXZKdbjoXL@xw$5!9I zbXgSbEf4(b(3J((hEbm7xt-hVS|gqAMKHS~TBccU5_!7N**m$)599au+Z>R1L;rus043#~DSa_GMlZkp+ zAf+;Uq;v^QYMkRHkl-pkL~F$!#)++qn#Il30_t*gxC&ITdetg|Z{H!OlHfzE#2V8* zm8q&4$w>|A)jICXMq zQZ@<{Ua%26J%v27U;{u&*MEI*sX=a*!;@}R4Ew6rQLL(8!RUxmq)YE6sn=8uL$0T1 zH<&daW}oNks^Tp3I8}l{6nadq=11$6l2;+!F8p-XGQX5|-I1>6;)>8KutDHRvW^zs zAX1YPWBdqc!-`oED%CrE+~M;Wlb+dqf(eT5_+jC(BPia(HG7#bWZ{P!9T@8|8sm}0 z?%Zp-lC7hRR{(r{{u76N{N`|bNo6<~*4PxVXt5aYOr*hX63A2SPJZz!2cN|oovCjVX2ZL3K_@whh3aJ( zvC(j0K)a13?-@iaAOJbdD|hRI@m8U8R)5)(Gy5?r-E5cqg#c8FA=+^WFKJ>e9euP# zAg?Qu-HC}va#_386S>6#Y3a#Jp(^+yYuk9+(S(s5eo1Jzf4h>Msi7D2H;+q_+iE@5KIzwpZRXr7pB~(4q7~=#9e38| zJc6~}O!?rkOYVCc6TRLN+gsaU{Y>8z{*1I zA;7x^9Xb_96({Yttsx-T8NJC9>rEXQTF%9O@lXZz?;7B{8}v(q*}gC;9BzvIoF z#%1|2r@=2N7}?;B>?~T63x4Z5I$&LI#PPfEziWu<4hIhV4aagW0;8)?{h`i-50N&8 zkvHia84j5+8-=N!W&bs>Gp*mIggOm)wi)B0so683m8omR=Px0Cf-c>)!v&i?6UeK2Rs0teQQd^eH3IX)4si0K$Uf{4w%7^Qkg%OstsHg zd5RZqy_O3z;cjmUK2Io5Lv{>te-hQ4LT`)hG@SdkF5-b*N{6LCvz|OV&k$CIlrT%r zM@Yfl7Gtk&i)HUFXmyl{ws=}{+2|16^6cctCd?eGB*+|X2HW?b_Ok3<{jx<~7fUVo zfcE|(hDoW8=xP5$`7m>`4i8ytu<`(15&qJ}2o5p1Koe9o2%*?`>%Heq#bd)!IWrb^a=G>RpCNt8IDl_o)m~EMsAPpVp zb?k8D*N$UytY(KUqe*GepMsc3+}wBxfL4Tb6pY72f5`XI(PG|7@h}(^@9lfN?pL7W z7TneCv58YU!V0;>3Yjge-AsY+8)($!BCt_gujj6|p^p&b>UrLKVr}_m1SI;X(Xx^L zko;*&?)s!>LL*1US!6P-*C^ZBlS0t6LZP-UDSca3s0KW8i;iDHoDSZAE36Z|xkXgb z><$g(8T3gMxY>hTd}nB3aI_A>j82+KZ#%Zjl$x4>4kqg=dw&!tc?p((0&-AI^;%AY zi>#b5Pgp2$5o`LUqcs*G;A5w}dlpO0)dQfT`pn7vAwU|MNwsDfsVfM8OLFk_X^`fq z_jqE;Q-7vx?(R*%no2!3lkcC5mmR>{R94>Qjqh~M0=F_z`)_R;?9tIZv+vtdlA=o0 z21LAl2%ZPCyvv->L}XQf3vs7!DDa#xZ0UZF1~ccUH;o?CWor`yuAq24Ide65>2(2A zrvppUqZ@O*nDBYyc+rUxXCu*)y8ulGfjMEOv#L%l7&AT6i(Pj@3WI+$7#sL6S%eoX zNBEq8Z(=1lFi@`m{_9jzF_uO*ejB(~x-(gDRTp~fOr53Bw*2GRCxLqEM#QSeowOwn z20hF%ax81BE*$K@$dbXMdX!9n@zpw5rfxU1Z)9@{)sU3%l2cX=ekT5g`N$kU2B%0r zBZwfvP;aX;O59^nfd})nVZ1C%Iy#FiVG@I6)==iJ5y6ak zs8f*_J{zCx7}NJmqJU%$jLo!S~`W%f=-F72x$!)v+4Da11RjAVd)HD`Mq zM=ze#PWX7$6SBpob4=#{q9=qmmi-LnjZvj-V##9KFu3~rUS16dK~1V|6oaGBcIn)Y zj1NyLmH4OYt<*=A5NC1R*Ll2rcL^%#L-=xXd|fm^npW(>Us#ovU$ko?T}1>ZHZ{1N z({t&TA5JS*AX&PXeKX%Jz-E+h>Pl7{HV)KPOpuV!vkJ3N)2g@molYBHLL(lA-kny2 zwa&qHju;Fvi}e}HB{Oz>k>3eK#$Bh8%T%*9U7Lfrx%4(7INpP%+PPdzoioyRy{|-n zF$Ax)fM;xNiDS{}JVx=>X*SaJ$R@88PECVZpTVVT`8pD@oPYIo_Jnuzkf}@}Z%>Uj zR5cym04nI@C7%~|-wYYNKM)D2S}XQ~U7N6mZCnzXT0Rlq3Z{tH}4t_qc?p%y|rUwD0>v`S~GbhFX-oZFAc4>F` zP_!_4a`)2?{)?&S(IYW*w%!O)n6u^VD-!y3;N)NoAhPMR-xLqic1S{{;T2g*pI6%OY{&&4SC2wL$D+1?>JnDw!&T zvzV!gTAYAa3h=-UAEM8rmk5Eh`555OI+C9*?^N~i+4mlOPgpX*hT5Y_c`QoR6o~Ig zAmKE1%5*Van%I>X5GUj%lbNrswPlE=Hy$Q2_){yVh#963pjU7ojFhn1iF$d4N9Neo z8J{aNraK<@Xh5QO7qQGZ)++Z9MNbYw3~!WMm@C&iLZWX>N12_{bh)m(>#PAEIb2is zl}4N-yB}d_0w~@RrYI+WDflKOgt0DYEesbkU=yRAEc{-31De6rxM`m^EevAsbGD(o zBKVNw@`O&o^C7vo6PhT%;SVIhYrxI(W=Vb=@lx-4PEvYyahHd@^nXD*Y;-eWDPeX5nu%?`IS!D7$j7o|YIq6iN`DT>DaSTHmHh= zi2sJ;!*C1OQ#?55Wboz;UrO5E|zP&^0`sPW6EgXi=#HPa{GeECK$h0g08~*g?(Kv&w9V3 zs`M_+R?ICZC=*>A^%k!qPL(IOpLV19=U}wc#rZu{w_@L zpZl-&8cCWr@Ui5AGpQMlz?kq0H(SY%q}RD>U~J9-xpc#{VflcGoh21`O9G|zxkb_` zasr+)c!3Au(3SbkiLPDjC)r)^=-pu1o}w14T#XmS^L)F*Br%&Y2QrH;5kyf&__yWV zY#%>L-XW;Zc!2&Luic`xx<-&sbez){yEtQA@%$%m_wBz}u9GaOG|QH=#CBA2 zTo3Miqp^6Fai9XD_prNuwos_?!v*xye#^i`0OL%0{=aG$>a01N%WUZNt6-8ArOad3 zGr9S-K^Pv`_m}rQDx2o3PXoJTrC%P0us1-Yh0qYA59XK z!r6T$6UG=-bdS^h3#QLXXoZMpkcGHYADJHM=t5t{f-@P33DJ%oW3;M%!IN@q#*?h_ z2CU4a=$9RD-nU7~DQ9QJbP^S#GPy+f~7!f(AF(t(fkX**DtG@L5twdee~x<=Yq!{h84=yz;j^kp16M zrr9q+ksj&w02*$%Q394be{DhGLeM|cnMr)kOvPaOKpy;jXCluad$K)48$>~4VK%I% zpp1#HE@j#O$S&ZkvG0jv``fhNJx}>CiU#{+_a23$Y%}`O$rO!>Jj(C};&e@+LJ_B` zH;2+PC^h%Mc$N#%DlmL|<0)pYB<|bvB5pj^Y-ZXz+KeAue=$&`|B?j7m^+0%P^~;VGED|Rx5gP6 zsIsR@c|m4o$f-s$mRD4WLslGXP9Il2;>@x%sS|=!)z3NRHZT9+mRVrj+JHHJz2n~7 zt|?<60Qoi=duOoFYWIv(Gjv%9+o{TMO;bYyncjHI$?ql}u8oR&iPW3U*&|55n7*%( ziIHrk0ryblNkSLg#S7<+!Ogrr)B)#E^vd?kA1EOvJZswRPi9<0&B-jc1`w0O+!u{$ zu$$*C%d>JHKihFyhwI?wX|Hx-Bec zA+cmQ@j48d9d=8wdqdZu&)ZDbzfUoX$SW@P9>8 zo?80AnGae2uWZ+$#FzmeWq<5_r~`aj3OiqOJrllnEv`a}jPA`_Hux@d?Fy5&LNAVa zj0u#pMB~>S+19>cE=;P;u=zO^7IfXp^L-mU{F(3WbUGtcavH{`wu=(Bm|nW(F>%4M z_BQhcez%n|xN*Z`O6{S&DJjK>{!@C1+vL4pU`i}*m=Y;K5ZhYT>;&!>RAU6lf^kX= z_wEjC*FyGa3{Po@ZMCaDX-@76pySli*nU=t{}}=;Ew877iTY*geS&PI6Q|2RV{!R5 z{WA~waEzFnD;ZAazWCTzpd>@vtU`Y3Cq836*V91T$%RuofcTeAiL;AM@V&S*6JkL& z=QR(RCOop=;7SRGG0wNu(9!}x8*A;z(!o%@A~3!QQ%IWreOaoFm9TtRTh-T7@xKob zjvDKQM0nayA~UJ0FGk@$44whQUCp2HD&{g`vpWD2zI3&24s7Dk;aB!qgOAogl)N4E z(sCAL$rBB=c>fNh0Z{I^{m#d_7GduOvP)qrabT`xhe$z&t7Bi_LT=B%raoYxrVU2d zhc`!ME_6?WE>qAIbT4;17_rIxwJpvU7fa8Y`Pi;Hx5XhUXrE*O?I6Gm9eMm%EAk{k zWo-XX%@#+!ubq|N+7DJCo%Zp}mFNgo%i@+*mS%;BBBg^+s6MI82UBZnVySAEudG0F zAJf6s30;;gYsGiN4Rm-pJgI0>@duSCYY~;g#0#9ODFy{IpI#doHVag-^-KIMJA~_z ztC}}+WA18KEF$KjiVK3HLeb81P#y5Pq>=t8we?nZ&2a5U_K2#;@cVzprW~|!6I<^e zHOVTsIWyB-P^?%I%u%MEfRfgZWnW5RAPRJh!Szk`!>WO-JgYh1xWYIC6#XD`mFLkX zr^!xE&-UdWnf;#i#%dk-kIVpjc57rrYhmGupg4@AQ$;(Zpv*SD|Mi4zyvZwfZM|L> zFe$JpQj6^R-%^=mo4PNeA(U?b9lRPi81n%YLFynPGA|ppgrcB6x>JIJURYP3`@hviGs1~QCMh8ZorjecSaK5=yGkR?>_X4umz1&! za%(Zn`xIk#a^lycq94wQa5V|w4i*ltH<$6;8h1MUIjjgMhvH2RdZBbK*?=xlwKgAx zo9v&}F#XW-jP_XYCjopGyVLLqF%zMc#x-BY+Smv&6Kp%9FU}|fP3XK&B+}yd-dk!C z#Lm=Eu#e|#ieNB~miXomDDL&Yr`^=EV3%pR)rbd1VjN2+bIoDxdv(7VUh<<8(*UN< zQwx-1^rSnm()?H#FIELmwbc(|B4v(TM0Dx76i4zcL^O5qwEvV+gy0jS>2%LJw^FiL ztzWP$)x?bkht{9mxl@*$iwWzt`0^Re&g=lGh!|oo>dy>CS%_(wLFRT3qgiKr?fl}V z(OT;y5O~7aVLQgPAvEcDiJV+Pn}Egbgv>*6R=&@*WcYBb?7S>>hmTHMRmud-W@xWUB$(bh>yLEgrOifZ(k4HsB_XhU@cCViAA=L zbDYww;fl>Dya>MaD-OucsH*lKlN9mXJy-BR_TZ}13#0B#;S!Ec!uxz_M`BP)PO<)45kiAi~(t1SlM8VY=`env@A7by2#{rpH(=$K&RCfH2?lJ-h4(h1U-@6p^5*gT ziWrTL6%E=Cp}GvSuP-erO=ikn>@j3!RYKG$6APH?C+r^HS1P#)W$>p6)Cw!rrL?o<&AS@rv1U^z#OeUJf)*ZiHvnx zC!#qq&zm*IMQVIrPibAp?C{4^jrP||f6HK#G(}d>IA67ia0*;gF*$11eaSe$5y^&A zWOQ!qBgZW-@jv@v5Gpg?^@Utt$bB~w&0E9qus5~pjZ*-Z;mWq;jyKgYnMSq-i6{eXOlyjUF2yA z?bqaIw^|dUEyULH`2z}4keq{FodTU>*BZ!53yv$3Zh-|%Yrs<5?xW%wANj$DEP=9N zCb12KEUVarjXAndwAKrDy^sRwRLh*Y*x4N{{?H+KlANZP13`T4bbHkJ(^q8r!t`h% zD9tJVJ9(DTFuXTd01th0a0Cpcqjbh+Bd7Cd_!|;#;OvY1b8&1hJq}8bdNR zS9zNyUx2QM_Rlwy89qyXYbLfmh*QqWTK;ExBc>+2F!D2;L(Sh5uXt|rD~bVz*UmT- zMaFQp@NS~$C%rJ)LbW8Hc#IGjCVuhE!VuP5vjWPWY0d_qqTy!l(hk6}aFGKKD&jWj zYaY_e_q_FAeWF?LmRDmQm3e}4Zy*8a3i7Ez%1z_pdIk5-df>Z?PZ!Ut|6>hE)GNw*tA!+lzz1%=PU%b2p<~> zbTYXoiV4x{`xC-*X*F*gNF6ir5w8c?{>8owxzgO5=m-=;vr3T0=MqpswjjS!>Qfnm zh?N)q5D{*bv3=qGwCljat{jKN`dv=^fLQa%hs}LLxJK0xpj=uYp!1WQcp!;S(W{eT z3fWOeRK+OFM>}H-fo*QicCgP_p|)pD<|Xd{mVT;Y9oU7zWVE>fJBE6p1ek0suVC@e z2{p>V`tb?>sOi5ZU#tRqUr3%4Px@Ne%w;*SKx+^_j?0^sFSQthKXIx~#2i9$GO+aa)I~poOPE-%xJisDG^k->Az)*&AkgjI$1e z2w$Lm5f*8+FV9R7Vt6^dbf@?yJ3)d~)t-!=d8mu0AFRU0{K0FeTuoaoi5h*bB$Nr~ za{~ppFW+U%_~Dj2FyMzYyLMB6jBu*rk*j2ISPqLVy#7gD6hnoX7I~SMSxxEGY0+QVjVoOl}#6@LX+65<7Tl{B(%`uB(W07v8CZn%f4FD56r&; z=GM_EAQ=nA$F*w+$5;4vdS|ELdSj~O|320Kk_-X(gy;JrSw?&TO>?DS-&?p(& zRb(>`$~7Q~8WN0wU>PUi(vb$4J($==){Mre&tpZpv<}DUlglTUjEU9ZKI9y1eTkr|d0DuliIO$l!Wn8jF<{g*0yk&mC3~U~ z`Ocv)Qr-X^5pvWQUbMbFk}vm%3$6>ip6J;;J!ZU zm=diNv7+h1pUa87K)EQ{dceJUKe+EjA!fX9_%gqhm*~PzsC!k z>mjPP(qy4bcp~TnO!t0KY{_Ln@SL|cUfguZciT>Sj!AypYuU1wSQHjil!$bo9a9qP z`ye@h&|imc(Cw^lq%ai3WLYYOo5rUreFshn-M%o@8tq3##2sMhR_OGo zmVk^$+2u(F@?gyAPZF^yGw>5T5ZKQv&)1DJB&J0E0V>@(BV~YHZ2}WnQSya8e^Roo<0sClz z5BW7ADU2+h4@Rt(4fHCW2T`w%b{Q*FMx~FqAZzOL#otZ~>?GZIiy>L#@)?#R&9Z85 z1Un6v7Jm456-po9lY^Aqp7pc(2~R@1e>VA57$$q>VZ4xo<6TIwGxtTWURZS71|57U ztnK>KtlbEck!H~ZTFdJsP za~4FqNqO!}m>Z5I@r)5=J(Q$4ozJF3|9Ox#obZCV;c!Z?Sx$8~1;eEOUlF@Q4&caw z{^w;8R5LSd%ZlZ)`dpk60JH8CwuEywU0wQ1y!;?m3+M&=%xx4~ttun{C_VRcUi;k< z)SL={wR%TfSFF6b#fra0bZD*O(6ejTNb@l*Y#K_olwnE6ozYXS~vp@w=U)l zhyG{8p#=?k&BV|w~Nq~=ol>?R&^>epXUzKH+U8cmxC@l5fKy<1K zRM&Rj=v>s~&0+i-`~Dzf;BBl}|LK<;oG0k0XMk%CyH7yjWFBwJGI>kYbYa-kV)nQF ze(343=^?Iy9jeu3&$Uns%pTtAK!fO!c`)d$pjbAbUz3K18UJjX-G>c21^shg zH6b|g=29Vhmz%OL8aJWOtJhFAEfu(Y*fWBf~jq+Ste++?cwFsKR6%H56uS1~jIt zV!}%M!ex?Pq9g_YAFWe0kGVWtuv7364pL8;-iuPQ|e#BL>%8jTy zI_B>_5})k0-n*M}p|)%pVkFCV1`ut#{;??h_+VP5Kd4Sqr8pA`E%%Wsg$b|`X7JzcZ3dAUnKJAeCrxZm+=xgVOSOwex>GN&M57AfKlc&Ts1U)_sbQqbFQ z5{r!4W|_rh+i`jUH^X{Se@}^BtO5>(smlZ?*twhq#19=sz2e&rXEVvGhPrGeXnT8f zN%AP8V=@UhJBc)K$Jo41Sf0ZfmG#$x|4HL~bZ4H6wBX!8^1 zW=*56+WigCh&~e7B>%2ux&g)UaV2}qPVN=x+LQ#&mV z<*#OW=D1^w{oRifX8x6*&>l-UV-0eb0}hk4D?@qOXS4s-PTuw!byYn+67M})g}){5 z4&NmsA{;>*zytK{yz+Ki;wT5xpzXDDZu&`OY>?7?2y|VVaZtE-G;q8zs=GIYQAqf^ zuxW9q)yNnlw~o3^ygy9~O9?h7?06fKn6r+7HoEjmDN}rQTrT0n{=Idbw;VGDQh&YQ z*j*j|L+6t?z8v{LRQGvko@~Ba;XREI&t$n~X09AJH|m=|*mjceYOGEtDDWQ!xiPEQj^^l; zeK*7XK6T;WCi^*@#_IO={YX-A8{|C{zt=+k$pwpdAiVY@+$r#7g0Jnn{T>?h+;b1A zJ7xsTF9W1#QOWewiBo8t%4n^-JdvPgS93HW`?mi5u0f_@rJ7tuIypDbAAgVGPjYqh zj+9-VnWsKtf9 ziEz2K0-zir#!&cF6Qmf4+)4HJuJyq4mqlV#s&rsEGY(Vi+Z+;!;jozflt?nlZMo`JKMsfxM;iZmfodAR?PU0ov1fXOm+bmcJ`W4c*^SfbX~+op@7j;9ywGsa>e zY0lYIQQv&n!Lxv@S@0THrtiZCjHKdHigs=y^8mpz-f1lfv{yDnTvpR)cDawRCb+}Z zLHn8XBH}XVq==FjMd0M7P%RWMdpMR|3~K-!Z=@w5ZXvXa_jdWDeRqB+$6fqfo2@}M z1tz2cDpJa?>rAavR<~6!<4=sMXkF(-dAje^V1by_=GJfKtGKc;ENi)nC506C7L(Sg zmv@KS`yTD|zNiOq;g(@X5pdo6$(yWy8+!3~rG*(^K8W;^FM#T(EZ!+FqMc@wraa%g zvm=$u$&%HObSbC6!vr`N5Ov!erI>B~-)vsTo&VYE$lg8ENa~-u97weI{TeICNct)HOMlqXe}J^H zlW49flf{D(v`Nm1K|x(+{~Ug-{2ipD3Y869npBAFaP;p`>teZ&FoE)2PZKrurI(w( zcmPLKk8y~U7g6NAOlxBd(5C&Wj$PF}V`J`!ygaASa--_!@*8-k0U_?0UIBO|Z8>jc zh49OuTP^>8>o-m$q0ixKR36negVx7UEC*i7Ol{`Xh=#Sn(B)vTFU5+?nlvKvMI=7mdLAS$M#&RK;buiX(m}u zo9iqX*AdfY_TE4bhzR)QEQ@_+2#G$9ymKOT?LOVMsE>DRqW*%FSn#0rxe&Q zC>wMduss=lIERC+=8PRC#NTTSCwwE!%0+d9NPnHn7G=l?H#9OQt;;$5O`t<{mR-2FJy==-3>AC2uo^#*VrM}Zxi`K7DPJ=mp{GT z)$FdtqqjXw@ z$I^pH8@-A*8;g~HQS;D~g~d>>g4pVg`q-bBGjmqJInxUYKU{Xd-64=3SeP*y#J#Ou zpnV{vyr!f0C;a}+>f|-0y?)4DT0MC|6$;60q^#cZ1(x}O!hy_99!8(592SwQ@18(%7rBtIPX>V|&zPbjam( zH1p<$N9OYz5ODi**X^Ol6MueO4?0_o2Yp@g4N~qtAK!i#{r(RlXGXt*$ADAg#(lmm zzGwd2a-YZb?&~D+Q}~MC029Beq?gQWrn zHSKh;Bp_c09{scbu&udIg(#E#j})UTFfF=})Y|RNgivh*?6_m)*AR#O4emUxsYq$yrDi0NcF?>Op+HuLp?5)WN~5W zR_R#ujh&?+{1c>?i!R9YtQ=%H8V=YyFCCNkfjihHr`UU3f+9rlLt>fx9?fu1z(a#g zrq!eZzK1?tw!HHCmFT+%*GEx`g8V|`N;c*I*(s@2JlwCGeh52DfGBudj_!ksI9bk@ zmMeloKIhTYCn{51`Lttk1PL{=wGy#>9JS?dsQym%Jd0N`TK1F7VeUWS==e7rJl-B^ zqfLXWR8wNNS$f+8RKT4il%o3E<^x;;bdLDZZh0-d^)H>+D0AEdOiJCPcjZIr`6B-}iBqrMV1~<+qgr@=nrO185zdU>&(6i0Hi^ zR4_r>yOj|-G;?=La3QDVJzFRf?b1m)@7c^As2U)Lr393YaU-Z#d!Evw&?AaOp~Lgm zxMBQ1qFH3s6@NRlqk>p}P{y6n<`|(d4k*V1vwh&7SbUJ{=Q&z`p5t$<^0lC#mtBA3 zBhh$XznJ5)hLlA;EU@ay&)EwXHIe=`T#|b>=(tL+5(=*Jwpr9>97~n}M@4s_ve0963;>_4z4%;)} z_1k~Ol=z+YE3sx9w<%AcT^PyfQpS!2@W1Rrn8#L3vA61~5p_3B9T})XcM{QXT7^`r z-_|f4EOI=(MDiZvq9zxuldFD_1~EH*`Q01>P3PS|b*$3QGOxc~Gplji$#tbmMcVb{ z5tF@asn}as2|uMsi_$CT1btF>gAo$J)xRO_bUm7hr<`C(h?!4_#fQ9`Bpwiad64B%vL&wAvzC~aWl8;GydKmxV%DJYse8SgvTirPEP?H z@184R%>#`DF$mGkS5qJSW>ZUu#}Un>Me01!*>E@uy%8zMl7R9&&A5BNHg1b_athwD;x=|sv!)JxK4%`uoweo^fkx+rF-wjufPwhZ;neP{iw~D zXo!f~O+&JZk8=8bi)Q}z{u_d=zF#*)3(tK)0^z{^$lu32^QKSUS+Ib1^CVogs%3zI zDTShdeAG(mPNkGr`346<$_ZUndI===+FY^u!8<0@3o-JRDacHSaRUXnaf9zOkX*@=5lzkMK!#MYrKe&Y24?FqeNA86pQM^`iO;;h zATiB0mDg{2c#4bV2T-2BLb&Hgw57BS>QB8WpVp~yURMP+hKsvMLY|ERP4TL)=1W&y z1pBGZ-?AErcXbOGjX7RZNu}SVz@lxS{SGs1fp0F|V}^WX$#8A^H_ezCB`D}bp{!-7 z9!OZe)-*!AI5WWETDbD?2tlZVb4D=c3-qf%B%06A)y8+48Lomf*M2m;$=vl)KSA;H zb#YAH@2kM!&?0A?MR9Ukd{l{>io~@FDW!ColGa)}E<|)j)ktjC=ImEIW+FEXk2ep=!*=_B@8fe~=1uL5q5?9~7!51_IExoTF73s6Thb^XOZ<)4M9 z(boM>{2}bNe3L%mpqt$h!)|D^uq`I_nm&72Jg|Fg6YRYIiluevqW^Yy($|f7eZ47t zkkRQs%*Xep0Qe9ab+5I^9~oRShof=Z&+NG30b~%Ps{Z9Y=r2iKzT}eJtE{eTA|D&k zp3KnvnrOoL*9}{KpRgID^MH>|F7tI3_?NZ7jblf&$pyvq{mj}_ti33aIzuTUof#i6 zfg?SbRL3t`XmyatI*(r?p!aFMv(fC1Aup0t*t5h>qe$c7#KNyH7+z6U?u^kpyw}Xb1BIa* z{ACMQ)SSxQkfpioFj_}lin2L(Q?$!*RE;97GyPju=)X7XI2_ZIi2r3XmxpnwBrCt@SB+}*%>ZMIc@fmtDH3!E1-?m zL?QY{S?`mdxSkKZbG*bbZl&Xy*rVhBVr~O@1odOL`eQ)tauMg{Mm!A{=FsV8PFXhn zA%=j>f%tSi35kE!khmmB_d!4nw`1fFoR*9yU#)LKf+G)0k*$8sr(yt0opiDMl1?^? zU1w|xgAG4!-g#uFL_0O)M|lx=dHw9n_%wEG@W9NakBdSTIBcqnK~qS0yflamW{-dfi~7urL^ELjm%8*&2sO~d0vvc z%P$U7#OFmSga>mDcUoXtEz|NCoaS%-eBT34rFw%%P6vGq8M&yUVuHPqkr;0TZEyZ%in-p) zq6GUQ0(>pWNIe0|4bZaOz707Z54}}9phJQ?LnL$4TcgC6scpMnzFy%&HY=1gPu&$* z?lPr()*Z2uU|J2S?Y-?kBDmp%qye(BGf-NiFVy3Rs{p5};VO}oNvUctvrD$PdG_Rh zvH8}kare|*@9`cdPRE|Xo%6`}%#<>*H$k?*9rPnLaZ8wmn7?6Jo{JAbVa5*RBMfJ zHfoO$!SB2h$Wt2v_qb2=AfG_mqJ{2iQrT+Kp^NBwL`Mj3F2$Fdom`za#NW&X&#&o< zh@!lS73&C>@aBG3_#nK&m4sp4G)ar5YH60H3YC#laUn`n?;f_xRk3nZ+utr@oQ zDVmm`qX~yOc6(*X9Yq!95fb0@n){iI>Y$G?X!mvW_~cH7@t1Q zn{)A&o%6CaiO+itz4e(_;Au0hZp7|#)0Qe)jjL=Qj6lH^-G%hs^7{=2_k7u)%j-|s z+XI>`RmMNj=0`W!Y56bRzuzz{-$*%H#g?8ou1P$z{cp{-8BrTNjjf-4XdKNNxzgXfpt=|9k+6JOp_f;C&G062DM2PVyt zX@fnPldg&GFLA7DIaY%%2?L-C_&tYCC>pv%m_+nN9=Y?cThv&I$Y$*VcS*UG$u1S_ z+&zZJyr4|^TU5jW$7~=c3>d?W(Yov*t2~`VG&XzPDldkIiv7GD*1>I_un>^QNkA|d zbD_qK*lLvw(5I}IAQ4E46lLw!Bc*SOw z+0HZ*9^<%T8s?3Yemc9oXEG0R@oW|f0)Gd)6=mZ&HtJ$Z@iQgZhIC>-05oEA+7O%2 zg3%@yTIBY|;U;Qda;Kgwt2SRt0i6EEc=tD3nS5K@^#LJ>cB~eH1iu!8?w047G)&Ch z_&wpdnW}^}g2-&I&o_d6aUS&uY~5h=f_TLG)tl|FIs7rHn) z_!V@&Ii5&pP%@{bWuAU5+vXW@p`5{ZhD6Td_=a4T{-GU`Crq?f$AWA~)9!+0|Av9C zZv1@!7qkC#F|CLYu4%LaH0e13Vy%^()0;(sxcbHw_ir`2Pj$I@reXR`7ih!17Isp_ z1c5VO=1gLOlEe|$*LCZ;E1G>8AcIkZ1BN+35l7T+2<_uVQUP}I$pvn4py{a3#EMhS z)1-)ur}z%Wc0>`Cnw8q4K|{$d%P7~}gdeUD(e=9v@KZsAJH*?BUM)M99{w`7W!~x! zp=B`gBd70k$jU>?|HNY?yveip^DW!;bY;DbLSiqFDVGNLyz*N8LP`3rxr?2SUIdmJ zcvon>@W_}zq@Tui^L_@smoJU1g?JI-%}L{}=o>Hfs_t?vrxs-D1)<67j!wW{p;WNT zJe=bm8te5h;Sd-F~H;6V8l5KwTHeo;Wfs|~GUYnmChcZqRSm=RC3 zYBM)X1k^$4ZWO7oos+&Fp;Y*Sa>~-QB-h(ch=?it?Pg;7MEG{;H#G=xRqWwRboQ6* zl-v##eSQeOj)NY;vwJvFHg=~Ai}Lo8h7U)0l5H%fBq4NLmniY=(g6+eX-6 zi57hor?T@w*^?a!z`)?~evEb1^E)~uoZRoMvc0#|Ebos<{AKkzrI8}|yW7rXMdICX zdkV5+aw=_iiqs2tP;ziYq7pU+54I*ykf1)NgAMhPgpsC(fJ_Ibk<=K1!TE@ z<0fyT*=|;PK+&QmIUnbyOPkL)eQD8q{1)nx>TL(YwVcmFKAQnNGCs(GNRZ^*nTI!^pL}DKNo@G^MCx^(=-@rQGWz663+W_k^pTqvH&^L@l!}2KFcK*UYLKEtaI`A*I%vZ z{+|x(`2Yn`e=Wk?Tn$BkiDO__?M;?IvPd2129Yl;6ytwaz=ltpw@ju7 zxHo!-lTfX??LySzzpwrAJWJPArYgqdX0v<*!ruB8MKI8>bf-i~^Y9Ahr&G**ybKZ3 zA;)q0c_}bC`qBfCp1Ryx?N#dhJ}$Z^Ow>Ogy3zP<>Zm}`6#)VFfbt3MJElPsG_)0( zCLy-k!;fKgm=rh@UNQnl3^G0vnz~tMYA7G$OcSAf>VlJeJsBEJ4Nu?Q#0X*t$im*w zfoSeWip-1!SL|pF%vxTQ!?#U%%I~VK>)5N93D7!5K1m+kWox=-Q$2dVk$&=EA~rni zWo15NvXype1t)HWpYEV>*<@gS`@w}p126f$x;5+ITOo@VsBQ?>?Eiz_JU>y?tO-xm z!TotDr4^z?C%GTG$u~V1W5AqYC*UB~0x18Z(sv)Dg91JnbMpF;x+Ca?j~_s|_wkt) z8Qi2q5}m`-gi(=^dp|98emKy7Zd+Ybv%|N_%`6MGFZ)87JXP6dk12 zK#qLAn77`e?VvWh|I8CJ0hwd!3dvSg>T{v6x!n{lWpz~_o4eoMwW_Kor6IBOATB9p zJo*80pBA+J4~;bo<9}+b8UN2){ZC`fz{J4vpBigM7Dm?pug1FF*#qxlg>S39u{Lsf zt<{zrl^YdTHhF{%ce53j-OQM+HOuFG=hkzU@AUioQ`Z^(=J?caMay|wA%U`T0XCa6 z1Be{&O7Lk4PKF1F(^J*h8`F%!OB7X`=9fBAKxklOBz#7I-6g(Y)CyEieTdRVe z&{W=plWozZ{`tlAi2;Pn;r?+7%Om*?mE-~FwSRaKSKzrc`C z)f7-6fmr!~$(B`@0o_%=*SnW(Z(s@v-m5?3k9KdPx_UaY8nW7wIhpsf*#ET4>;=uy z%lR!os<_AArUCxxFE>^b)W_0q*Bf8fWM7O4(!{PZgZ#J%H2B6{b0Pv zft|_AZ1zn9(+TYPmo&1ty-%vkNlGFZnA?~lf^6V!X7}O-#R%5X0TuU|+{zbVFYkhb z02kHG%=kNv{YW2w^;rT`J0k`^$DeF^d}FtNK1X7%b#=P|{nP#gn@jyW!xP{~5AGsF zf43$u-pakw`Q6P-f6`_2Gz7JTbW~&YZhG#o&X4hT)*H=%JOcnt091JmnK;P5!$ZIZ zCuX1wJ?xe3J((53x!c~$bPoP!sLfud&_{b$<8S^S8zVdY+dH2>6VtU<(^EeT_9qu( z6?Q-36u)2iS8hq#{U>Pyh=5Rm&cJ}YGPIZglCSD*U&zcq$bE}@m)B=|Pz>y?uD~B! znV`G7d)>M*+W|lc%`|hXpZQTgA`bsd+RQY{bKb>$h_GAw^QG6*_&{6!(YrM7=@;A_{{|xA=46UF_KkTJHw&phGrkC%8 zX+Nfg&|k_le}aOWa~rSy&uetZYIp+7q|}I%C;KA5wdvrQ{BC^>ydI-3<~&Z-2-9B`oit;&IZsMnHl{%e1kH9 zVg>#L+|JhkfOkpP0ieC%O`q&0eu$<&h;IZF`-BPLf6w0f?s9d-#0#2J2l<_tn}M-% ze}H$LyS_ksy#xMz7JvPL_@T7I&BTn=< z#C2c~u47CaLxb0&`dfCQ!aco2AfsAt{pyzCwoW08`Zr9!UfYcAg~iaMeCt;E8|P~U z6^g!{JNzi+D1@s2eN6q7t|#u?k)_o=4LKy7z0c~ta5&X(Tac*|Rts(GXa^b=9g=}S0;uDpH~;tFd0 zG2v>V71?;U1qSQSr&!BaG2q->#ilO__fa^OhV;r$a(v4niIu>I<|Ev|jr3{??0POk zzAGRh%BhNHPeP+;LJ|_gQ1D?v|6)^j8CR5@c+&02Y|O#t^&5v{H$d7(D%&BStWN=^ zVd#Bl-0OvDo~l&H@(bA%td}Insl~ACuo%nQXSlxiEGGfaVI`{ZsPHWzfOoDwc8ALL z-Sr4Ld6KKsa@s$=i!fLu{xtp3ii9~KIau>Z@KKh@aF7T8@m| z`-hB?bKx>c!m&@*8(}OW20@V_rIZ1!D{;fwPiLL-?C8Xvg`%pCQCb8#$i42<{OBgO zpWteuZFR4^xm%~@tu#3cQ%b3c84rM336|d5Qi_U=G+euwYD?Y_fYC2cDp$F>N#k!$ ztU5=LUg2C318F}J3 zcER0vK%?>CDy0S!*UbG+1gjFa)-6bWLX}UMr+2Mcs4mf@~@wVOI@^2xga_ zaJr4~6x5bWEX!}twNn-9=?xVc^vlEBxazQ4E_=l-*dTOydk)ljAezTspiqGOE)r5L zIDS{NIC?SH6X7obv28~HPVU}sN$Y3*9X7SOz}a+w{e2ATuDkybp3DHg1g9E1F1puK zfZk>DuVv;ku#vJbP*yB|==RB^C#$yKB{Joq?Sj%@ug9&c;>6^69CeAyRNv^Qya%kAuH@y3cm5q+344lib@EEFrSHx@NezV z>Mip`RnPv6R^*cPhc!_;{YB8DBj9nB?VE-m1Lx?kR9rg@_JG?*{3lBPY}G^0vsUtm zeABu9x%cKNM{uH@^q*OlI#mr*iaooSxmq5NpxFrG#5v=gEFd4NjqrY~^Cv*mk-mfy z+GoSVCRxFrq|)jo7b>4a9c4C7n36BpqJYh}+aeoR&M`!WzWm+C!OFJ`5c4E7QeKc@ zR@LH8;y{HSNOYZ5cm=be<-Ge^O(*JyU23=6$SQB26n!FZD_#6XdZG-hk640EX%vk) z_BB!sU5o#zol;{Bo={8X}cDq&7Y`UZaVt>2g=6>5}7>;^V_apj&ke7kq_8u;74N8TRqPD~kn zCtRJn&kCnqP;|+1FQ8r73wgqi!c<(|=>Vd~EXgUIkvb9?fx$|31rPwcP}pYd4;pk{ ziX+)g!SJTuH%h-;Z}m8qU>-02SOTie=l0SKN1xuZhj4q4J^kL#(LiIvD32~KLLp?H zLo5;AjU&8w+qS9RIvhH2Ntpz*-F+?`c6%-wmy3n2p0wIhg3npHY@8}o701tG^^c&# zb}nL|<7VZY9xzO27>JjL$8cTll)rB3Ac6qqlj6TnE;yzU#J-X+a#F_FL>#agZ$HxyGX?;X9c>6Ii-f&9 zK*KH{obM)W0}{e4Ay@QwBoP_hG4&e>KZ55v8q{^)yO@cW8M$Y-%~{Lu=%IGHLmxMc z%=jwVgMC;smVH1*QP%q%qd(&_+{!zrjzLS4cNA!bPggUA_dtjp>b%%*``{Lh3wN^} z!R?Rcq?PPX54$=8b@G`)1Hm%gE>YQ3p7zoMaB;?|2XyVC5+Y=vjm`Sc@#r+S#J1hP z7#}r)J%xteM(a!$KYA^JHjVmOM%(sEp5*#E;?w5S7{T=<@ z(!nlm*Z+!q0E7y?oM%wTNL#e;@~EzJ6-G4m0%8FBg;z{%ls1J7C=L*|E2d1pv{IwrWV700t@{M3uDMT?z0qop z`F=Ia6kV!J-*6f}OWGG%bSLjR&V6NEiO=8IcksP7-1f8M$4zEx)&qF^-CD}~fC>68 zDPRYlj2Gbpm2>SS&<2CkR(QXdP^r089Jd#M;qZQlCLGo>QBX5w3 z-(T+6#314WQKBQGR8)t_hR#1T+xl>|Syv|QKFW6}QGk{o7+)s^{8?(zW9b!TrBB=G z#sUHsm4Aap60nQT-s6dWT&a3*9e3>Q;7HVJUI%W8FGiflIb)p1ol61x?Vtbr=QxV5 z_*h89*n?nULL@(r$tS?S;o~SY2(8K;rm5JV2$Lx!=JrYJeNW|Hmp>twA1|E22j(fG zjHZR%Vhy?dglpSYwfR`E<;0Q9VnsWC2+!C)^7hFWG+GN!NRXWyYQn11%NJj<)rJK4VkXsX^ZpA;!TE; z=}_Q|n?ea}5^M*m_O^TM#hTH#$j7H{%;IE{d&F*So7`AeL!JhL&??utEiDRt=nh1h zofP!GzH~nMg4jmZ`Fc6N_%M-`mIEVZQFZxy)l5_mu!)t$@d%nV*^Y#Qix7js2CG` zFG2?ey+zQMSva3k9k&V|Pum-Jkk%)AX5|lyg$a|HWP=-8H6%mI9~bsPg>LP9?B<(! z?f=O9lvJ6#CBx_^&hzIHxE_ksS%+X4Z8YK?G`<)uP^q1^FZDiW{ALe;@o!epUA!0sz;{_L25 z?x2@`-P9xdLB%gn@D6IlO<1rQpwu^fk4W$l*o##|egao@VLevc%H+FEgUM z66Z)rb?p|r`JF82+iDDv1!Z%gGsAD3QFu1qnaeu$%)f0g87`TsRN@D+v_Y{q5p@Y` z+WgD=XK1EwB+^+P4SwSS()zT|(q}3YbMk*cWxSL^tdWPvOZ1I3aoCt%ve|p*xPc(H`np z)xYuDIp8@6g60V!xVGD!)S;GWUAyXmku0Mi=$lUU4C6~D*>scZ?|PhFD|U(hiYa~U zFPd(FSFJ4MfjiT|%H+{Df@JoOYG}Tg&JQudk)fFt102!HI>v6HnTD=g!xSvPi?p6x z<^o9O6nT%Wsp-oBtRGaDl~0~cOoZz5-V@bQq>p%uCqu!4Q%977MiykzjpW#4>iV|X z7CW-kExIxcF4XLM@$`1ZoT^LaiFN^7D^K5BtJPruxCK!`OPL3s+IH3V zLkb!~Bhx@)G&xb;gR!vZJc-l{V{cqDQbpkP2`smH!)MTyx}g6IsC_IG!4jKTdF8&V z;T*#HuEtV(pP%nFc*enw7ZQJ+35gql1@(y|qPAoNY|&-BsZvzD{eBtncj{49a?)~) z_b0HZv>Mk@zVxPGQ~mz4Bg~3h&n-LgEBK{W}M27jCYP{x3M}seaOvP3UlzFtuXbfd`W)$fNjcR!- zJmC`=OYY}u{%;+aYP2m3#_Z|BE3>!{LSWt=@(>vD3*4t&Z;}#X*={sJ&`S? zuE6XI{HX*gClWiAaOt&7#w7~8q938I^ftez{t=*yx@t^-ZV<+j(Ky2T@R|@gB0)8> z_IOvY5)OZqAYy4_zu9&W1*2}Zu=gxY`>sY$Yud&S))Wb&WFMuRUc|bFR<^@GvZXa; z&A!U4sBW^R*<^`y0f#iNNgIYx2;#sp{G9T-dQ`#ZiPhZppg+ILlvH!7kb01=Ez=x}=w z`U^kZrSbaRX4A?)X7P7Vry~6MK=8YyrYDZ@`>f#o6RnarzTgch(h67%-9r$DFHH;M z;X*gpe6%N!y9MV{2W+^L|1kSgf`T6E8DsK z(LxUQ#|G{DLU>0@G8L6#)Y!IbJ^n)=z$YQu9zNi>q8fSjC8JIAadL*MO~>nF0VK8{ zawuhEuj9_zOKODCyqR&mQyKfXEA?mff?-gQtKHgPidbR#eQ1EN2lcwGyYC&=DIH6) zCvH*!M)??FNx7$i%`t3sB0?51Q@=_`URkq`yoa~bH z8vh~{F>l-i6*IM?En6HhJg47r+&WJ8+^vI;$z>;>W)qle>RLB_fhl7?^i3&|SfWj&@_!}7xheE`6_OvUV11z)${uvn?FEBmGt)<8c?v5% z$BxFe|A(=Ah7zu6+66qeZSx)5wr$(CZQHhO+qP}nGyjvE>*8gVF3j+8GRMUsW_q?DGISHf17$2>T>!}FccDMyO8yQ)E5pHt#0msP3U7XGSZEkUooygUy8=eyR07RUOE2_~Gqu9?dl4g0gE2G)Yp* zwRHox7gky0dPLm5c+>3&i3jQ_0TbTEJ~<1rK8+ZZz0ZUq-J)40f8r_mzR+_?_oYd? z%GxDFZTWOy95aJtz3NXwmQ=xcI={jp_1OuBk=SB9yiZB&7K?(H_0OW_C_*$@iwqaJzoDkMS?Zd8wQ zKFM)U7Q(_#(l&j=s;aZI5~nOX>WAtb@`e2?iKKtGjC|#(otv`s+zjVnIS%{ zD^+b#-(lYp;=EeM1gk{OFe8ZOCerc z$Rq%n&-~R7TIsL6F#nQNW<@$C*-e0P&+vcZIW4E8IRG84+UuXnK7+XCUEuI9n`f&O z?V^v!qCeJuXtg#_TebQQXmn$ye~N~+&ND|~ZxtV3c*9nikijUoDn>m!fN`jJO&^uq z2NNnqzO_&-o(lT`a*MzHQa_v*_qL~?H5F6AclN3I?782`nHYq?J+x~>+t{{~@sZ!z zVUKO$=AmLC7C~)wWWNlHiCp60An?_)<0hNbh&Y>Vn;~9_hvg1Z3)Q8*YG1UilWWGy ziAMLeOhWDk&xWHTed)Kho?6e|%k?Pj(gGfOoK?o-nrdCM`c+;lm8Z`1xUuoFsYYe zx7bolJAoo6l~&Gs$T4B#iyS_(JrIjpU@w|NgpSU^l*+AW=mcv6n|C$dl^(CIm54`v6x-I3NJPq-amcIP=@B14o3F zUNl){Qi52>fFyN>;CA`(q{y`u4Y7wX^ITR^xi_^dwd*hPDv>NVE?VN$I5(ujH4pPj z@g#X!T%Evx+J!(DDc#<~Xqzrl3Hytu9zCz4o8}?@lmg`{>6}(eEbHq5z!N8+&4~sG zBmMDV_Fu6GWL;)(AcNJA(Q@a^3_OuGt0s1w(km94w+1BjWhwWo7-F8QWvZtXV$PX$ z6Px<1;3gBfZ&6-gbQP2yRzNi^wxP?Gn+>4hg3OW(X{sR(F_yJTj!o*x&{)oyZ(hMb z77#3FZQG)UsR8PXz8H3+oyV1S_s?t4VCP4h_=^%``HxhW7oD)i``+Pu5e!p$n#m%} zwpmRkMJyN!d9gd)lxbe($$7Oh5BpOVqL<;2X$G$!(8}z)y!zxrsWy1M&2OMjm%seX z@iR1;qPFJoq7VzgjK}9?g?WHvSF_L`E=M7Ze0;Al)NE4=uZ=^+B7%0-ch}NGt|?{{ z@uDWj&GeU{%OWBe|DYR|h})o0n56koDUmzo5t4}2w~$U0v~+8pL&8O5s3kQUu_M@& zh)G|J?}6Zl>egfI8I!c%xfGM~SBy)_99-MuzCV}~o5`uTRG~fcIS8jo^uq~#Hs9)U zBtC)ZEGL=Bdemc}!m6WiMfscwP{Az%lfy#FA8w7?bOro}baBP$hTkFC%VLv{Fj|0=_5F9r$g< zQ>%O&D|os)S`I&=`n1&z*Ecs3@+iL()61Y~pIqZe1=pQhrc^4Hq8oBk`wzAnxFE(2 z7^I*0BdG21dCK5)MVP^3@hQJgmxKYDl||KNNR^oiZZRE+>^25(r-zl|Ba}(u4$t)S zL>7~tHgy8I!_sf4zZlt)>kFtGCEwF5W zG)gKY5I?tH`m;W>UORxc9Yp$XQAfItS?9Oa&$6?sE|KUNfE;4!XKFrLA`n9b=dK3* z?60TQzCU0mG$wzV|2qyF0!4LdCF~)>)UG$mQVKM^%?%y^%T@QOh+ownR^2DjUqn*{ zBRMPF-jCYG`I*^;R*iEj_zlSum*C2XeBZ-lNpLhU92XIqq`WBWhOJ(TwQFVR&u|Fy z?qGa}s}_@~)wwJfEjW zxG!SOOTY%evuehI6AP^m-dnyXiRJ>jIN$YaVA$6=BhLP)9JCLHfB`DGNk&CCbtg5L zXTEx}|9etywvx&^2E*iYXI1t=T&N!T2#I#mAx)fsR!6FskT9t&TiwVr2V08KQA5GW zV?Eaf=NYu zDuk)i9p0s}lXKEZxhtHcq~FqaYaf|9=BSe>?vXK*Mlqdz{g1I+Hkey&?PDFzt zMB;YnjA4i1>Cs*Nt5o4t=_1%q$g_D-me7Hy(eZ7xk_FjGm80Gs5(x5T7q7+{_KU?Zpm;%J#W8B81MQp&yq(C7O?3VbKR(k5#S z(A-jrzKzJc|CzY#eDg+y%026xrSnSIbEoZ*bY5L-0R1TW%tO0#)TROkSB#a>A9;#X zb+P0n^mjYjxbr~{I;C)UdiqrBcy_ARBDCXQRG|x>aRK2R%$TQo!|1gnsK6Ldb0f7R ztZ>t%3i}+EwSY77HCnHXF%6fHXi&h}blC^hB%p|$E`A#?(~`p}kL0Ht zTD<2f{!QXfejTOg7Aa})zd@Wf?|3SKG8_?K*+CEXv`>ll6#5@d4GdKEfCDW?+H*f6 z0r^fSyAaxyJqJ{H@WSo}K|d}bwRG4dr|8>>7P%W-{WxsSoGUKshcVWB1i!*Gi!NAh z&M)G4xX875wqj^BOrh#ADj!bElmKyEqefST{!2Z^X$Rht5jop4-uq+{C2W(YpDW<(9(LJZcj0`=GBQS6^ba3Uobmq?VM! z*s=?o#fSs@o>ICs?Rv+~@|OK7s9}9ne8nrWqvaZ+aOJYU=Q?wm9W~lQj|G0q5@qHi zE%D@p-5`=*6b`i?Cb8~;W47YecBv;pzXV2x^suO2k!kNc)_nmn+#F;(w*bucKdosrm_}69}!ebiPAs`9u4q6o^ zVGtl(jL}RXSdtuSJ5a83y9)vgGqZ=L8 z-b(6|FGM3?et{r;q?cOTVfB1ZI%(bc(M$HECD4!2K^nkv`PAvd4QJn#0 z7$_o^I2nOlgG2($>b)oRD~$VB_6v`#Pv>wCF}j#JKwYZijP9qiS*0&{NjgBlV1K3h z&!)`h@NlzmkM&iU7c=}$My{T_#6rj<3W*vL2i$wt;Kk^}qcUwNUSvXWZ1T{Pyq0>s z_%yC@Eh&j6hd`n21@!OqWxuF{iC0=Ux{8&48^8lj?^|HolZRP5*vH`oR3!!I%wR(D zjQ_Wz)m2yAYRqq)=|(7WXFh3^=9j8=h4-$>pJoLd>ot5h0E&$LfQ!GeH7cLBldA#2}`WW0K7-jN}l|`~$*?(Bii$aH%(n0A*ck z%4d2)c)Hx0otjZiFtLd=zt_Z)<&3M5W)E~MA+t6xmoR&Psg><6pfk2vehpAU$?4DQ3 zkb~96JQecB3u*k3l;b3X`76jwZ0<0Kt&(9%GgT)WEdt9|6ssag50wPNY@qi0byP#; zG4-ycEArY+iF&S1HBe%fUJYBLM!o~+J{T$e{FCfy%U3raP-wA5)!rV4MFzc68E$7% z$zba#c4I=nq*RsAI}&7+Gz7v72wO4ViNJpHApV1Ii#$wR^^&mkxYwte;e91R4n^WX zg={<7aYhD(Iv&*Pz}98@wQo{fgY$h@N)Y+Piy&ZlH{iRgU8F}0BDwm#p(bJxs-Vx# zUe(ExeoLM%Ay%E$RjL1e3qxU`BI=hUYc1@^?jpUu+RSAV5=S;sytln4kM2p5Fy4Fy z%N6gSeU5D#WcJi|}l+?@Qi=hniUBc$9-0g-s=M|jq0 z&>o9%lrb8t@OMAIYoIZCBwDC>+>@8B=h56wG=0$iyB96w+XHP>g5V#+@WK%umiVbC^`S+uT0}nJYKAsGcYxYAR6}nM!;s1XAoDKTM^1LO^fI0jm(~ z(E<@owz+vv>!lcm6H>d&FA)_~=jA0bjdY?$x($6tq_SX;$jNJXwj0Mg*CFVI$!8Pn zd@4g7bzXNI*B069Ov01^N%tFw{>pf{H(vl;V@T$$Djq$ns~BW56PkKRVmQ=5a|oB9 z%vf|HaER?5PI96G#376SEWaUTgs{DSyT_Y-x!Lc|(s`eT@;2hC(mtL{_S>D`TH`_! zRi_hwnmbww%*w>JY8^~dCTslg=Eia$3Q7dkk*7Xfbx^e0cN#lL9G>j; zzJ8)8bO?)?T0S!hG0CL4(aT%@$fY!w&B{2+M_=v}ty!(>#i(z>At(Uu(V2@^kuI+? zXGB&Wh0(0_O{Z#P{laXi2Dwx`;r*=MOm0O>6dy-D^yRBo>ObB}17lne9iQF}8L+t* z;CpA1IEPx{`_lF}0UaUZBE5<%yq^wDu*t; zY+9)rXYnJ5?m=IYKx$%pLE`6Vz|*{dp!5yMkyIQjDeC%smq)&8!Y@@{aF!6-XvaE7 zH&MM2j;pk>My6vFSF2Y~wI&)}CcTt^b$N!zB|3~0V-`bK=0PS2vPvQ;N%x7eRQp`WMNYN>!^P`faaLA+0)!u%Y;erjZ06R$?m0%Ar-_1r z{Nej4FW8nZ?B=j=4=4K$Ie&<3f}*INe7wsb8IzQEr9JZwb`TB+zf108N6Tl%LlUxD zxTd>k^{t85NK<*eAyMW6b1FZd)8rs9c11bo5E;odT=y;`2OpXrMYCRhHH<(vt%lX^ zr+Ki8bujdK1#g6YdgI*r4F!As)5lE4!><-Wu;b#lL)EL+5TZ6QngI40eNSjFECt4o zjDR{x!&kEK9fAe)GDwVq>)Vq6^B$TFd$pZJi>NRoKk4|j0j7)oMkxUc#^5NBc3YEO zB*?v4!m-Am4X+1C2rw52DbU{Lz&>my0;ck?I@&@C>z@XyH=CORl+3Ab;J3jCM?@p2 zH+`iFxZ2f?xJ|oI66IhDI<5H7OzmZxk2yK$<&yNe!zm7;bnb&W88Zb}+iw7JYjmzr zlJU6eJU6|yWm0{^zNZfRd)wgN{k4WQl~nj#j%ne0V@*)I0Ae6jJj$G7Rj67VjivjD zK6|R}WJYNIvhj=|g`I=cH*1gY`6vb%CAffe_11qWP5Yx* z7w*#VQ?kPO1O8VI!YyIk@4aBhnSVTM!-I6*J5ymp75XmLfFpMg65@{IJk^L)|9MzC zD+@dtGvK5l&66ak;V4IX(F~Xo_Swy||MyYmYB$pPh0ieHC$@`UNYR}49mpoq{0l3v z8(RUi%?lRbW|a4@pX7AoYTwBFX}SN~UU_4&WDYA+atQTZ^b~!p*UImtJC?gjDVy)V zs#_4+Y|?i}(V<|@F9+c02iqCdALzHwx>q)%u~rFr{NXy%9+lJ>7rr}1Ac|Ew)J%%T zg1$El?YsK$_&|G{AZnPS(r&G7uKP5dpjza{ppgvoYy#~xI_ay8xzfM{hH2@!tG@5P zRjL(rjRe9@vnF zQ>*Z`=_%R;i}1(>QQJjzV*{fy46fm?d{OgsA+2JSt0Gc1 zP2Hc1=JO9kOphaiHq~%>)$UN0o-76lX8h*=-oX@@HB_twwe?SnsE_15m9a}F@vF#? zK?$WhmdUDK-J*F9P^BPE9uN-MB{ zm`Vo1Bb#~2BI2`wKR_#i-u4^Pot7K;VY9s-i3aDDm@`Z;E0|zR~0+dcco@a%YgQ zhjbg28_~J94u^94hk73x5Nqljw??A|aQDrGJ(=OHUbLqmC!+7+R@NzsxEp)QfztvE7*)19Va+h02yqUILwj6?TiVACxtR{c*^@Ta z8$?kT47YAAZ+OD+x9LBSc!J7WJ5oDMFih;_xY7nek@{Xl5nk6?oNVX$?*{dn60O$1 zhlvm87pU+n4|>SW9r~e?#OcbmYZM$41h@kWN<(+>C#NqfLshUZ4yafHLXTS4jvYvw zDa9}p4H-DifgY@T-#zb^bXf!~5QF8oL6KtX@TR7R7U>CZ%&V}U!rEIlLN%!ovP7N{ z^I1a3Bk8$ME`jTi+i$a4>^nqx)?2u*n!Nt`&uFn$&dmHdheN#dRzEsPidHaB& zSy-(f)|OPlZ-@k}URQBWd_tGsqo?@C)@cyJ?7yYx4e1nvLGFYZcQoB&;`THH@f1>}^Xl!55v%D7vRt*2-j1m-=sYYaB2mYb&!fu*e{h6|w3 zQN;0K>hgj*DNn=Q(iHhz`{arHF(7u6(kXG8X>HNV-P8Ws9b5^?C`Am4u)0ow*~}1Y zTSr<8Q?~fXKikVRPV9nxklxEwD7A|G%V~pr3Dz@2;o}bg-(03-)o*`nQOe)|yJQB_ z0pqcB{NK&h`(Vv#zM*Xlh13kt%;o?-6U$LtDGJFILzHdtgh-#<^#ozWI^XW&P5ssp zQ7raJOn zf*biH{l4QHgOLh$Yq^1turazl^CpYu^&;ZYQu0LM-Nj$V2jZ5XE(R%cUHu#vMZRF< z+Vf2XmgOlGc`xBZ)(&d`#oSq;IvG*=8N}4}{}fDW0f@~x_5ywq=H21LOwqV*9ampz zudu893L~%5qlLNK^1*cZ+6r_=*LKDj%3_(?Cn2?g(0QqL%Au(Tw(;=LT4nPQfC|rL zY&F5&;y%Wf9H!x($lEB^(bxH zK0msnVM$vJ(CW2kD_Qa&4}8%c%q~V-wn$z|e%bHI)dTwVFb*XNd)F-`U`=TplZC)ijQw&%-(QkJv>C zE7n|?^^al)&0D80Nk3I(_t5D2z1Y_h=~ue3X@B%hCUI6dPnIzh&zWq}933(9E!igZ zbPPuu$5C4;RL)c#ZPIMHSITti8&7KWd|jvndpzKUZC*l4wOesUfUxzc$XVwq$xyjz z$65xW<@H_FA*bw}y8t^P&&ooW+2Cp2#eotPjL95=W_k1S`cGInO|`k@qfSYR1;q!s zcu*qFot=gz>)Q6+tX;s@Z9^zF?t~X|YjbgHnOI+-;c?kgC0DRAe+F{sJNmo>3F)q7 zPN+1_VeHcmSBo`FZA1Q1?=9$^47SYlR1h-G+V4!(CL4B92O)yv37WvaIli#=>;|(F z0iWWb&Yzqi@>=!UZ)q;MpbKw7R_a!s8FeWW zw&fuPkvxpMQoPut^qsj9Zr}3UCx(-h=a*TR;or{{T~}+)LN6M)->S%Gma}V3>-giV zW<4(AC|ncSbfxhFGH`x$;wt8&rD+!O&^F#Ua!!-`FiMr>xb6dD*MJq}93v{+OiS*J zCdKTSj)lvwX-uuc0ZV6&et6{NfSu;p;w^(XDKf(FB0zkY1uy9gq43;E;KMM%ZD2OwwBr_w83{uk9*euv|fV<*{68 zHB|V9AtN4C@VO>0U-VA1Mb+U294V=jT3?L1yu`n3j{nqjdX=d2$Nh;K9=2nkO~d)T zbX%k**p=ylhCDfK6aQ1n6=XRwy7IuTdWBpLEE!WF>xm!oA5X+7ltqXN#f;W%i3Fw@ zXH2GH_8Gg`CEz=kx>M9H!{1{PG=AbBBP`(TvF96O!nQ`MmT(l&G0DswNiyl^<-D@E z70>)vs*vM^+ida0KOs+&ds0n_>cWVT005xwl3)We&~go}=^A-DOH*EF@FYA*Uvmai znb2u~!jGM+xh+PWL*&p{v}MnbRy|Lr=pHiEAUr)w%2-+tM0#iap|u9j6@DZ)W!KYH z*(CaYUU2XLY>(?xO3rUL>5prHKqL`;0O;GLrT2K037K;KTy1>|Ib2JH0$Il~*g3t6CA$& zrIG$6cw}9K%L6oo-uWi$M8In9Z3j(T3bz_H|NFIhYATqS@*4<43jl+gV>%y<{3w|j zz_Kb2bd`1K>#c6iBSX%C;*~eR?{g=;*M%Wlz$nWUk#NWkP#Vy5a0q=B#5zvajA&m-<-I z9!pIAdqC)*&Ti3Ux9QAWtLpVrJFu26toiL-6be^f9VpNUs68x>{a*Z0GG&w^WQFMy zWCrBtsdk#B0W4|gqKbsBm9oVRhU%L~lW<@}bUM+FmzKxk&}tf z#L|MsV8Gm(XUsMwD;!~1QFSx7LUhcH1?AzMg{V3&vHOzJJ!$0g%a5W5JTU#oi}5J! zexo7j)h9UmmH{uu2=#Rzo>;BaVjZnOtV)h@emyzTXs5rl9g!w876S4t=DfzjiN*|7 zk<=GN%8K0SKxh05UE8F$eINZ7pJ{HcKgX?SF|4Fj47zmaOBUT5>(Gx=5mY%v!qGB< zp!q>b7G;(I+aR%2-l6YN%z@mskc>gFqjNnMyP|yuOizZ<-A8EwS>FASDO;Z(#uu_Z(ytnmC;kSVj=UM8@v zJn;GzVZ1LQuFEzP*o}XZSdj1j4q0(Nq&C|^19xt^vTc{b^GbZSl!g;O@K2zFme!d9PP{R#-HAp zFh|f7NWioDN?BIP9>*Os(FR!h%G4-JZcBx~qpEBJ@%^iivfV{G2`D8!g~E57NCk|* z3Scyt4X^v8Rpm!)A=T6v#znLJUwZ+w<}F_WGC>uycQr>i=&x%b+)IY7QyY@FLp946 zqHN}KfK#X#b)a(LHCjiQ$Xy`6u-LfoGB{Xa5mUMnURQ_Ftl<+Mj0PEBfhEG2WnN=`9U8u#v>U5 zKyruojnCp-@ge&X>F2PEZ{6x!sY8}&C9m{b0c_~tDOW@HT}z;KU?1C%qeapzEmza? z%vH4|@}e|QI!I5s9@P^j{GS#h>w|=wvK213-o)a*$tV)d(Z(WzqryurD1N-)(|-W6 zfGPc#bv(BTYyxPIv_Pq$$JKCT8P`+rEcSR*@J8=s_D3JskJ&JJ#2}0+@uwR30gVgG zvmM9qpQAl=LBKDOYi6>fEn>aoukZLTzQT*n1*YJ*A&dA7<^~MDjBZc-5qIcH_@h z-Q86XjCbI?ETBVIg-}BzyDg?JE9Y1d%dUY__+uNO#DDk(W$j77s&e|nt(C5>$fAp) zQf9RkOxr&FzJn_$8kMwyX?r@Md?q~li8wnPy$X`6I#S`BuB73MLm zglKOhAw0bEqr{2e^LV&qm1Vd@s)4IMX3SfK$9s!MTwW`BUUUgwhKVVgv_W7Yw#Opv zkdHU+H8-10n{ug#Wxr~}HY}#^uJZ9`l_xp=O104CTU=BB^$TQ5!2}SLT;4jZo>QMa zTLbU(-uSIQfx?w~Bx_AtIvg|RwDI~;LWYHH*u+qeSG2OGAi(qu@)W*CNhF1$VM{H1 zul)CpMG|YC2rW3rqE6}O5cyPy981XxmiYCM(pTvr7JN6`E5({ktXHH6z_9OQSn`TeGHzO z3s-F{q;>2cA!p?m;JbB&iuSK6o|=>eP!+2xgaM)|wHr_u!&p|?P&}Ufz!%u=$`4|r%ZY38dHFgCiNv(Uk zbaBw6N`xH(DOAMd!%fm%A&ayeNM1xy2_4Y4A70%SbGz|$3r)^2hYn0q=31gr-|70iZGkUFFuQ9)l+M} z@|PdKKU~&>Y2_|at7p5td90=)isKG9*`vguES2+sbA<^1CEnLgL`bbmoL^1~jvzjT z_cr^qEC(Y^ejqB2R(j<|FsrCc%G^!U_8&I1vHH#1Og2mxOlcY2EE5grr5`?Zm`P3J zi(wncMJnY^v2o0eC#x6lGx+3yH%`lOD;}HDJ6^g#A_;tVR~&r03u}7;YoBq9S)=YX zKZmR*R{jGInbQm37;s1Bh52>v+#s95-0*^(55YsA3~#movm)epZuAQHFDdSswH~WQ z_F$H=Gtrj0{Cx=DHO3a3z)2jhN}i?6FUxvdW41hcRwK3V@Eg4p=~$jA8{Sk+7MNo2 z+;}%I(5_@pwGK()xE7+u7mfJYEc>w)V3xI~Wt&}^QW3K0V!SCJRF{fZO)@v#jM=ZK_C8I4wq@Yrk>5dQO=6Y_OF2iMu3cia5@-g4kQx;ms zYD6fNXx;%v70jmGD9jY1y>V>~M~X^gQ(O{Xuv}OY(17g#DBSQMhwRT6`SPz{Ik+AW zHym<#*Px=r9sM{}lSZ&I!u=ryvwo*~RJ@4c^aUl(B@D+E+sjY861xpwCNc2Lb$I!_n9ur+p9fVezXPL`13Cmrkq=x zBt_t-m2jS#^+I-CI#Ufo7`wLY1tlwo6g4nM6lbg&097}MuIQzS-{=GixIvhayFX}S z<$juYOoAs3CvuIW`-V?~^bNtJyTwC!cuF%UGG&mA zw$|%0nQ%+kXXAC4IMQL@Ndce80rNH5_CQ#*+IuP2F&f0GIIz+nqaj2BF|}(~-t$d@ z&uTVWOVIwcVnW5~uvN(E5jLf{udpRQRE=REV!g6{VD&~`6Eq+Z+!~}obkE8=8U0}< zVrOgN^R;oD%W-scyHt&{4sw`-P(=&~-cA3Ma^v$Uc|lIxv6x%=y$s5a|C9wZxsD+^ zLG252px4sTa(;9@B2^=a>8G}{ihf^~+kLYG<3r7t3pY8J*56L`R*zD3RDZ>vaHc3R zp*CzTylh7q^MRIeH`EkF9cCLE{NnR{1W`^n8$w57 zzhh;a>n_`;PcrAS3fuX%tpkEYd#5cwX`qtc=ZfOJIlT3y{4U1g_X7`^k+0Uaa`0%b zCNw5246Arshn2sMLt<}N>MyhKYo1RfKZtE2fEbtph@#+hUwoS59>du!0}4VMI(fx2 zrIceV$H527a1v!7vp{esY7$-Bil0Z^3~4njn*7lpzrD!}G@RNIhCE2begOJC@hyv< z8LlRT3F#C^MiQR}r-R%WpzcZgz}?y89+loc^$%C?c%^uj_)<1f41)EB1R>C57we^Pu;Zl)~ZL7 z_>sjYgT%93tNTz%Yh}*>IaMCf*TgNy|5N9Fm*{PA(!Mee7~B!@Khiq1*8uq;cM-iE zB40BWBAXjuxANxw77S|qJit-6TRsw=7$QGJ@^6i<8JKkhEy{y6uW4Y68jR$3; zXsF249hxw_4nk``*ceZ{f42Rf@*=(pV5Ak{kg%NZvKe*N36>`Q-4J!vRd94h#%G(Y z?Ty@C+w*x{l>6-^3j+Jjb10D)(r3jg0U{^H0!D|237oMdKv&T~CBW#Inwo9?@%a6N zC<-waxjM_kh~fsE7#(5PzKW|(6>N2|grINcwF8S-^N+(R(8l}#MWTNF0hPi5v23!A zBEo|!_-{uU25ZCCc_FshzC?s#CF3>SGRJP_7J4WJx9oM=e?^a0$0^;WGG1inioEb8 z*N~ljtz?`Z-<^a4i*CkO2=kFnuKX_q3g6-mlR%EOz)sp7E3v7KnAZu@?GGH&qTr3@!o^J zu#6hH{$3$}i5+!^q{RM|q{&(LImKF!{xJ<(gA6Ymd~VF<{GTLcf=LT|2l&!!qJGh8 z?Z)nrZ2)kS-%&Ydg>#!IC*VHbK2rz}cV1Oqz2*NtDV%uu_mNj9Kh$ zl>c%37f2-hq5`{f_z9dG{hx~mCE2;!>?!~WIxQ=l6k1LND|rJYlZZD;Ch2TmEZ@JR z3r$1#INTJY-z;iro*YoIPi5!Y&}Vx*Ey|qf#Jlbf9-~-D0sa?8wFe98dS35Q9hrZ6 zFF{1Om%a*1?~jLEtKjZcsT|^L146W(u=>XtZ!Q8o+8b;q>dMo1h@-|0(E|6+ONP#6 zI`&x%f->>wbv#=J*yi<&DD-8lmAb8N^4uqJqp>4)6I%#VZIv3w?oMA$U z9&zZx{ambIrnHcSI&}N8f*Q-g3yTXZ5z61%)J>Vo!LoVRzabEGoLkBJwpQCy^g^3P zW!PH(L)i7+X=C(qy!-sDV=;D%oTj&?$4qLd{4uweF1W4Zi>}c(x0S!M3C#p|eS$zzfHOGIeiXIPB zH-#L*Iz(r6A5qqpPH@XIh`u<RAXq~xcFXU5L1iIlr+&LLjCN`HYNc4$N=J zDSEIAY|B(8nyW5Bq>}hEOV6AIk>vK0?SVZGZ*(e^nWqQ5^t3TCki9hIJ@bVpM5bJU zhsu(6oE%Le%Lao~FEe){lbUgQ_NxmcE7F2Cyo%r;0F5;|jnF#28E^8`0KIU)ECTO} zwagW#ee|z4WsCtDUvV?ixYv78^S$FgDpbT~Ui=PB8INRps+8)FBB4!0RoGgY0Zqgx z0L^bGYl$IAwuzq}#fLUgi%BhHsiTePY)V!Lm((HvZxl# z|4P3vo47mWYW*5HL$ePNVkbQbR}rco z?8|$QicSsqid{dFx-hTU#JmPjf-yw$qbZQiLBLa2at0O_ZiI;E&|_m@JK_ximtpGC zBq=N=DNfyC0Sy@V(9hyPmEE(mP^TNY|0PB@h7|759+?se4bAp2Zl<{AqtQa5QhA5g zt9TJS`_X+%{IoasVTF2i;%HB`j{teA%8NrJ76s0|w2LmyT#~s&*c7qbTsBF^X}vbQW6qhIvheZ4 z<|F&EKKAALEC#V0p{<|()R$~QK@9ICOO>SmFCUcYfB2w`9Q5@64+Q<^gL1Gj{7)a0 ziGhjr|KA67QAhdbgTgEl#5B_fCp){jxvc>R4bAW9Ebc545bo?0I7?B&F48>2c=esN zzkU4t=xEb#Q{A=XzJPQSE2$bGFaT%ylMKAl!ca#~cLR8Ug4Xk-hhzw#8Xs6fI|J1- zGBPz0_j!?@f&g`@2i%MV&=TkZq(zbPPb`BTLN(}{o(lMa#{+EyWfMp;`A3lR10Dk@ zzc~Xm0GRvx0h-h|K?gz3V-|vKXsK@mnG@0)>VwOXQ$b6m?J=xlVEBrC-q1`!#DivT z`tRh}R0Ht;145~bfQb1Kui+3i0nPhg0g&TK=T~t6Si#GKngOvakt!_#C{;*dO;|KV z#r0X#z`^U6{u~gMl-A-4!Na2{Dy0DUGoJw{VOd`G_*Mj75q{C00YqHFf8FrH5A57P zAzct%a7`f5O7~a*)B$V>$jz$uEdIiynZEyHHVR zH8XV4`Xtbzpc}pKWty67z*~KCY=Gk>NMq>FDu&uu(|FfT^}t`adoKlmN7YgSFSB_& za*6vrNiK0JLRo~4DZdB-tb<3c(wn_g05gPhJqzl9S-+1-Dyk{qYk$>OS^}^99?Ic) z(DTE~e~*{%^3V$*PAP7z_j-NR~2YmmP{gr;eyC~2XGx})R>E(a@)nd%=u54W4 z_k6f*lu12&i)r|JmlXqZZ52>XXZr{+ZR~xpwrH9<`<) zwO}lQ>e_(U0rlaUUBEsxGlB^4$9HG>*%10iCQy&Be&j~_5E-G-`==+DK^f2EX9B;~ zoH4ze=>5;^7=kDKl>gX(nEh;&HOFaLfVZ|hfu{LS$E73n(Z~7czyF%%e#z5{t7>Y9 z=HY~&`e=UixbkySYR>wo|HcHNpR=f9h}I|I%)j_Jsmvs(;NvqIQ=%$P^mM+psE>ex zqkF@9LTDfw$^0UieecM$#@7X7@v8R7(ftELlCJ!m<0F_`8o)WYfZ08M6$1!#-tl|m zSN}|*^%LjgR~Ht%|Nf$<^-PgoOZAzkyr2Q7z{vs5k3pV=O+%*vsldVevp^XaO$p-q zz(D(l&EZ`G+5vF1b-V#j^~sO-q9!H)^^rbkKCvBu(uMyBXaSPe@rPmck^X|*3A%ry z+S3806a5gN{Ut8p4MFK8{sgQ6$TIjK66Jp31CN#7g9tuQ{s_c*Oa6###d%Nu9SFR@ z2O7(N1+4>0U-}^wYsUQB(|P*0xAqxCu+j4GW7nKNBD`?Y`@ZlLR3sD#W)~O0p9X*T ztZxAXU$XcG*H%zYtzWgtK`27YLlEW=oS{?NKLn@my!X4Dr#%8{zbG4i+P}s#gRi=8 zKOBN=nZGD@f@tZ1)_9BWxZs?hw&B@ZIa2EB_||`vsi5L-MMMg0BINTOCx@RFdnb_1 zAJxay_|P(%`CA-&{O8OceSmtpR!6{ZL6|u8?{KiX*7v^w^s`@lWQYyE8l$l0@x`S9 zB;!AL=`y@DGvB64+J&5C&$Mo$?2)e znYa_0Kg4HNC%^^#D;R*Ig#EU|x{j~c|MHtR3_!WQ7lV~J0tnXj|I;*aP5n#y^@`ab zMCITI1N}Bz@ilXT$Iq;lK6veuy}OvcTE$a7^7}uY;om_^ zT3LPU_|z24W5iE*WKaU*Gmmoyp<4m8aGb}NygiuTl>MDNs&D+=!a{v`J1|%AFN}2p z+!Mq913y5(zhn8m@i=||8KEk;d&#^S)IN4%(EMX9K5-m-2Lc6@&vbTJk!nSyQT46yof-+6u9&|e)In3Q5aLgLYcf0f^4|!rP!Gw7=BKX8ZE?hG#dii283>4vC z7Xv|1ADy7Z_C8B3jWMYm5A%=bml}`Zj0Ku7b05$tv~bE z7~CJ0F`Q<`m9lG*p+xb}#&#`eWW@&eW$so7K*}j+Jga*TZ+E?N+VK+>@LvvJES@!k zE6HcZyuj|1fu~y?BP?YfhXn>S_qFjI3G99qeXi10d=4$K$yIP8L*RvOnA%omi-~tH z2?*506)MubHbXTN6WwUPW5ITgi^?z4%${=Ji+XiqSa*Vx5?BgW9$$tsqn?Rbw7jMnv9<0nts-_-)?FVWIq) z$O`9o;#~J%GtUy|%iVs^C_!z#hgw@5^Ua*)&VwoEpW=;O(D1CaLGTPfZbLi;J;~yI zp)%C$W4L6pa1*ys_P5wWn#Zl9|006fTuH~UjU7S4+%(9e`y`OeWY$PH6bxZzQe4eG}dKLFV|%i+1Q)g?1(B*G;cUyBvLl)W!6a*1RS^@)@#~EKNs}QO{}5)T>3~ z`IuIa7sRo?n!a2e{!oB?>4QPGZ(fVtApcatt)luVHpRL-agzFCf{@6XhDh(1Ok85r z$C?i@FADuwyG80cdNcc;P!{Q(d9@ZJQjTe!>nNNpM#{jti3|mi)58i~I%1I@57=Fl zUuFC+oEf}}zeFYU5L(J`=BDw5!@8IUC|H*VhGZ6&xn`z^G#g5U>){H`m0I$-H zbI)V#z^~nY9em7{QAhZnGl%h642{R;v*h^L6C}HETREZ5-zl~2Y-e$OX&^p8EGFbd zQ+X(PeHoP<)CpC8R=W*#aBthM=ts{#8BvV)49+%;uxalUR%caBTmIoR^CMPwB(#qW z5o-Xu%8xf-Q7zb*rCK~2OfQDVkm?Uw4CJg$=VYhq;aAIl!JL6#vx07%t9-*h{Sryy zNjJ7ELymR!{G8+7g6^dpdtawWCFa3^-A%bDI&lVi$Sp#`=D<^BvBrbaJ3_XP)n#U! zY;8QhcRIH@Fa)xx0?2wrN{Mq{i9aKO9M4?Ne0nQ-H)!RbkD)k{ZS9#~nSsARJ4aQv zR;hMOP506J&ZVsUd<4CfP0AjB30G#_(%G-beIeyBWdTHoiq~1CoVlyQ(Q(yJpr82e ze>rt)PLte7Al0zUxFaaN&$}TYzutMQ&i5+_poWLqRFz&QCR=n1k|aUVG0yO6d_@`X zjzJUiW2!P{EeEA*cw=k5jR|I037@1_ydujp^O=9>Q`ZVKekvlB z0z84ci1%yfjL$G+>Tg^4mW@e-YvSiEPFS@oh?!;s540jbJ5Iu?BgoJe2=?IYUQX|B z+4Q_5b z3LH9RF};g#=eQUTRyPJFPSw;pN>5{U-@JVjRl0Dsx~q6CLp1XtqT^K#OvkZm!s5~i_qz?+i2Y7bZfpT|>H>N4BJ{O%`3;JF zEMGOM&-{|#r!sVpTHE+GPn!C9d<^zvNe_;q#D$L5=G6!g3LYbr^GaYhka>G=VfI$x z`l-(kI#auOC?gK9dC5)z%s{M0DJ}2ZqYvyK54`CN`cjsAA&_18%qtdp^z13qA}q4^ zalBIe;4@d#VW7T%!%DwwPe^Sw+Nbm=Vv6CGWORdfmXH0aO5n(YkRXoA1s6dpdJ@&0 zXBBmRLs4S!^j|)X4=J-MO0Z*@jkwPxCc#X6)UR;B27!4ZvOQ%Fk*Gxa0d*nrGoJ1+ z13L%bDB1I9fl?v;Y&qSKKlf9}YRK`xx4t>5H{&0y9<)B83VSNVGUk3BBY0gfX12U! z8%QCeAo*j9l6K(d_l4A5)aMJQl-+I@%C5ORi-`XWN^v^T%p_71*&*XSHDh}V@`{dN7Br? z#gV&_hH~~sr%HzyY)M{(OTSTX_mB$<5(&~760I-FXPpW_=Lhv$v3H)B93;z%3)&`; z+7A81h;`EsPr}(@U5cpo-d>bjoIYv6K#i1a(#3d3pwam_b5^c>T8Brp9@graf+vRLK%A3&PewN* zEsZmRALr>87Nz~od6~9v``CYSzaA>iE{Nbp#-mAKxMbVdH2CI*^D71a2YySBooVc= z2h(EZ*nx#BA!$EZ8|G3T+uaaBt(Png`SHVIdxc4su7||(jSp@ESK0b^-I&pt>yWor z_H6c{08JBlR4i|*2S%XBrQkSnv;n(4PE6i#*Ps1eMw0`Lh9e4U zW+Cb<2Jw?`IA(P9LFMBp{lCtOfAoD9XQF}Z{B>#z3$^gEh}rLy17|S;qHtI3d2_20 z>xO<)_JPWRty3zm1bZI4K++;e6mX>BTKEsWmfQPe<>*$kzY&kc#XLS2IhAjV z-}WvdH*ca1L|us%*Up=Ej$jcLn8Glm;p<`)Ry zM6=nu?>NiBb!&1vw7TxLO^^NIQ9E@@|Kr)dVb>XB+%N2+a0H_z$g*vyK#H8BPMwUV z{p%~^eiOj;HP@ZT$~1?(pSz#i8PC80=O%NRTGos!D(tXmgxTR z0jqFRceK@cDVVKqx<^FAi8=^P*Ve=DZ{hTo0+>$fzPjz7JuG!k>rs_F%7sZ_YDXEZ z2$T&5jj*O7U<3qE3AWPb+^ifG_wCl;Zeos+zDGmUYBExqv;0wv_^Ai>6ptv#7V9VS zFguiyCx)B&#JS9k*s-ynRjZ!KEh}EmCE`ooB*`@0c(Al)L6KeXL_F%tdzIv*(c{;6KW|~$@;~tK=C}2Eyp85W(=A%H z;X3L2436I9eIzQ2U|Ej7oVZXKHB{y5l1&ndPd|5F>VBDBRqhH@=Pn$u4amXti>CCx zR_V;^Q)#cfZ%`)h!y?b{z!rLq3tt&s*Gw%Tsc2v?^kefcqUb*v)4=oybJ zqM3vcdfrLdAetVvvn8ckWEpZtkvW>ml(S$D~Iu~;|;?U=H>HE4oR=z*Y~^Jaq@iDPB*OQ zIHA721a2geTSFiB*HSQa$?+(2WiI zorrQ;r=42DzhP_(h)1<~!|EL-qMCFPa?09c)NZOKgGWS>5PQ$R-A%)>4)9w$?i65;~Rd*V8N2q{i
@he`+_x*0(~qyV~q}qG-v4? zdfR1+r-01Str+c1`ICf_C=W@^68oqc)k6RXF!e9*MhRM2wdo=OKh$D>O^md<=@R6NzTo5uy(sN?_&(BMmzj#@ zf?Lx0_80B`>%^JB8k9lYY6IJWEjM*psjy75U0%36PefgY(93h^N|I*_cL5PKv|=;? z{!(t{pE^anEgo-%sDl{l7q&F5_t65*BR=&5x%#kuHy4k(DJX`Ohg{ys#i}jh8OX+; zMU4rE3aA@AY`M3r3R;9U?emRS znR3=bU7H>YTcN-a%^$w>kM}r+^DvOV?C8qS%~7^c0 zHMW`ugFLPHo0QeMHQ{NU*7YUi#a-4Jb9xcU;PP>Y&1Zuuk6_^Pjrc{>HR;3_c`xztG z5GatyA7!>lmifk(w+9YNTTTm$x!SHoGewGGB~d7;s~bT}owg}GCJn1q<3gkYM2xA_?2@ViSERRaodoPDAq1`OnjWY3}Iz$6& zaRbtDH;$?|)IMhKKT#re<<}7?1#x}CmEcQ~frA&8O-ss(yLhr>8obhC^f}(!kq+@1 zV9H}J;x`b*rvrpf@Dwe#XjGsK)oC-42*Lxu8lSh~$26QwjHmdi8qXaXJr z)Yn*;!>sur7hJvn5hQq+k1PfICW{>}Qo+aZ2%}Z%hc*QwOWqllT2poBdW_(nX5VYP z;HTL(;3aT?0KvJ&<)@yvA`)j(0_put(wt7OfkZ<-6%r3$3UbBmngY?x%AgZykt{(g zg2?3~F?$_sO=86wM*~;$8Z-v5_Eg)zG5(@YDKqnpWA!c^%~(}`f zh{heRTE;Kjip7F@gz@9{H2#hUM{jhrv<#3|AyCW;9K`V&3+ROz;Iwiu{8)Z_sLN#? z5L?gRx(g?Gno;#O0Ix0g8A;oKEDtaN36M+Pp;+sdxy2BucBQ_nO+|o z69xJ5#)ad!5~|rubT{W8#eUuj@{~dzWLslUz7*DVA#T1kmux70DRpZf1LfeNI&Mfp z@KC4HM23D>CO`{3snv5ows_n_Vvceh8n*@=+U zciE&yd{vdd9-uDEDdozz3XR#7U1D0N7Un^j!;zSucn@saU>i!EX2NsI+!w6J?Yr6v zo-jTJppDVk(uu>Qk?FhR53|->H|c$|^ASjX&WsFqwrYktEg+At{}zb7O2jQV8W(JF zToAq*F5m7HjX7x$q>$AjExD+vLMa+noVJbhN>h@tWk46Y2&R|JE1ECZI@!g1lAwDP z`@+xvW3-+9_Re%6fU0rfO|V{M4=0{wq1gKp%WLL08sq+H+e>9Uv2pCuUsYE2kImdq zkLxU!ojrb#W++QMVG%ETMl3?TOQ(q~=oRQp7Y1O}+avMQDcR(q>@X;iQfnVebD@1w zB$_oUAFm<%M)ZhJ$#_&!TrD9=q*}pDrk-i$7LE5jS=zUUEF5;B61-Br6sk@d^ENa` z;?fW>s3C{y)Mrw_KQ3K2lv+KV{dC2A$ElAoynF44-o`F~I~kOa=;Tt$8ptbCxk-(ig2e61YtR%4`lz1T?; zXNk60?ssC|LDRZkMd!_PI5$_ct-*J#fgj_FWUN*F)fU+FEG@qibmZSmGZVo{qThb3 zau{8efs;LDFoiPqtV#CQO;gY{I=$XmH` z*F>=k3G5qXm)swt1t-QDILGACP1fY3f5n#Lhz2Ur1u_ZO_QNi7@bD=ZZpBkDWH_Uk3b3cxGBuK*aBeavKZmPIDh58srDK zTunM&BGE&*^=}958j6CK1bkNC7f2VH&u`Hxzob!sHEO^e%Qa}Y?xItjXxKzQwV_#B zy@hJ1S}ml?_P!_B?=A9)O=fyYAfjH6b`^tzYQ3S5|q=j7CGZFFx4&lpq;Gah9m$cq1_pKrjUaE)lI z#6&seP3%Y&Qzil=Ur72EM6MqpFcsz+KqJEmPwgDl36b0_T^hSsa zi@lH!II+`qtQ;l}uLpdlJ4T54dSpC)<>{gm^A_;FO6S)CLA1=pu(n3EBG7VJ<2uOJ zPyEy9Mahkwn=)#zPN4p)c`2dL=^47QJ-Qr`A{16B%%3N>gfZM8Y+jE7mme9Z7X}gV zK3^wSpIxsR0IZXIA4W-Aq_fxeJIMJ(1J}lke9KVgd+94yt6xhnHhbqbp^WUWRvL;^ zR!qH?{0Z-RzJNYi+caZcAm;9deh5BEetIIYMh?DYTeKGI{e+Q1sP~ery@pg!W<vO z#s2MCyFu4+?%-)-Jkncop{Ey`U4~5EU^%DJVqV(rt}orpgsAT0Hv52qxgT*k+ulp0 zU>$m)ZSp0)lNr4JsDl}MEg6sdlwCn;@wAO4hmj?Da2pcGv(2~Ckl8?NIOM z=^hJkC*AQJl%f^NB%V2iYk1#Eftm%;Fy0l3Q7*Ge^_L9>&KaD0v%XDR+Vu@s(no7a z|68szHVNA1I(D@+ssuOH2wZi zZuVt({wvr@M)#c`V>Ixj2}eT+x3E4u0gmSfO=nV`?D-u9(A20BIW%D(M!z|=Ehtla zMtA!}GT-Wj0SpfLmG14x!#t`r#QGSgje9|AMb$KLnq+{SNcHL4ie(;v$vBwQTPk?< z<4{Z00hIr)#J7F79k>aH_g6=8U)?NTxb57|+qSAcygf7CK%^q?R1{RMjU*RX)Dhrx zscyQf^Hn(ErV7=tH|i_vB155!Q$BWzeB Z{&w!k&SA!$@u!dLc%0Myjau)|4BvH zm3qzXhw_E}VT)mDWsQsHjnA{Z&COvInQ2}4+f_FiSBFtV;N|iC)q--2WKB16iNE2T zStzWJPD{y^9!r~did5ix8h!ZEAb3$q-Gr8uO?)0z&!7^eOf;vmA-|qX9j+N`BzYH< zNE5r&x9h+7zZcr&PGyG}^zk;HGhI0h$rdldN%dHz_g$lXoDw@xqoM52>>Q%8bLFCH2iE+Nvq}PTYZ^s zC!rVj)qE7G85WMaac@1KX&ug>FNR34wrt_@G(0THBQ&~n_W*x>+e}7PR}QfxM7DUc zawm5sdA9u>X%-&M7CpIkh?Pz37$MWPE*BXwybb)}fO_9CBXZCpy0a5Vrzpeazt7tYP{Q!jhrC*dx?#F=@yoSuwO>2C+Sox&}(tU$J~lp9uK6_%xj8^TaVjn~3MV8eJ zPvMjil|(e%b{T=tjijguH`Y~m#mU zTjABp?Kkr09xX$sZD#~ZR$yd(c=+H!_N(Y_Vu)ifn_D!q^ObbA34InpDn!8{pz5d;%TM~7vOh4F!~*H|kE+bc8@l#G*j z`au^_>b0JFRTP*w#7uDV(HEEr7kC7CS3t})tMGdP@zOf3^W(SqKIIiUyFz4 z1{9Ey)XeO%Y4apY-df|CF1nUhv4SFlf-%_5ajrBS*YD=hg2??6K#iQN4(%u|1lRAA zvqa#`S#sBtGInaI7bG7(mjM~Zh(}huc%L_6dcQYFi7*K;E?lv0$WFM_jUfzB=PEUS z=5mM+5+^482uC`jt!DJ$%BXPQ148i}pY$B6z>ijVhNA~)+en^Bo@NF@5@~n9oG8%gp5&%N!_qF9kq69^lVz*igr@@OAFO)3Jd9iN#T_>mw2~c z!M2{vh}p{d=^XNH+9ks%NHeilcR)Y5CQW;=aI=V8N~Uxvdar`@?5r@KK`L8%!2|b9cIwBs41vMvtGt@&?$fzD{v$%M zhu8P}Fo9c%h$a;J=0fIB$$mSb-(DVu=T5V$GEZrNV{s)b2R&ZIGs}!(1nu& zs96$l?WZ!Erazn%$9HGAp)m{|Z%k|_(nF!ZadJL}6o2hJxpM@r%h;GIJY-tFTp+i; z7nVlz_>nS@HOE(7po7} zbYc1`V=wELfvPAxNtt|Qxo*9Z!EBq&x^AHkcWu!hi%SJr3-nxH z-r8!YiyN=6Cnm~gv zns(wjC-sY_ZGuRTh0{A@7N>kN2|^+(-l7*edS8A~-Fplhd1g^#sm7}>zOZ#N z$JZcPxNOlkXwd$pPXZIW846>yHx;pijO)P9Vu_q^g72qjy!crJ zNyW~51=iMu`zlS!PsM{bt>iw)00>#M=-4rrm4fqoG&7K}Z{Pzn%_srkfVNZ>YKG?C z!P{H^Dt=^EulOzF#69Zq_Z84I8HUXxi(?5ZU6T#OcCEobgA>B%B*tJUWM_}s!5y~k z)QCocc@;mgr|i8(y}0c;Ns{VPC>#|2i@FZV3$3g@)BdEM*HwK@ zSF$2%*4v!(-fRtnmUIiu(d$dT8q!T|4d=m}LhRk4Y+cb*E96U;ut6f8`LvuGUBJyk zCjH)>`X|%LB|-3}C-rl?M^qNYNY9BO@%rl|1fT(9Zg^Y^i)6iX;anei-4&r8Hi4cw z8P#N3%Mrcd+$P%(gNBR>(L>X+FPb$&@2w*`2}j<-E%g&+vv^>01y#;U>gyNG>08F} z8vn%Om8^HnaSA9$D}{+-GL7%R=Urs`!H1u6ch6xG5>Sn@;RHR`A1>ZF`tDU>e;_`X z=hO8)nrcA^91G$}SrTqDO0P1XA3N_CqU02PJ-GIF>PWwa9;|+C5aRRJCgZ!Te*P55 zfu2VmTug7WlkRYYjcwK)zH27VlZJy%ru$ZidA0-_H~s0R(NK>FbFeyk@z<(%$pI2I zm<#Sq-<6SmK6y&-4W58*Xz5@q!j|Jj1bgko5+SphQE=d~g+Ef}@jP&+X9A+>ldLe_MoQ2xAq7rlOI{Fa8gtAJ^ z2&~a|q;LcrDg9KL;ZH-@Hsj2(1nY(IO#E!$HP7hY%o>uo&VpF^X)7p6$!Fb|-2L&q zYOVJck|gg%EQU~q?kK12yAImPQ4=zBYw&9QjY@=_-;sN*qL>YTfoVYBcYtRd+f<7m zKSbqX68D#U_U_ThTYs#BW6t>~QLIaEVY<205ruL^X>mieJOjkkS%-x$b3S54UmTD~ zpmbuIcfb6QDN*k1>fLKQ2nP$p@@}RiiU3{o3QA|YkA5ZQu7&T>a%hOi4ZcwOAdkyQ zy)|%bJGf=E45g~#I1cyKnDj5B#BO+|Ygr;c7EdNP&XA1S)bJe`ygCn^CgT0Pz>q3S z(HG4NuW|?H`a^k=L>dcR(CepSpHs`oUGdBo_Tz?A|Cs*n!c^L|x5Ii)_Bl#n$+Ja= zwOuKh_TnC&W|${&LbM)sOgzjq&R-#u!Biv1+`z=vuX+-(zzQo_b%{W4tQC_xrQ3y6 zeEUTopgaxr)}*3sVv~2N;2x-I8igoF;zq?F!#-evr02a97>(4r({TH9*`@YZ&bScx zCAQ&oiJeRsJf`(Q|9ZjIc5OITrT~hNae^ZmFEH9m!K;E4f0woFQMw_qSjB ze2g>9s&z!ae5Zi^hUg4OZmRdXhBl8k^V{PEQUc9%zotIesBbBKL${m%bpg{mq3s{j zJN9BsAl(=WS!P`GAR`~VPTY@gpM0gSo*hfVvPB=SL>uOr`rHJ#u}C)|q<#3NK#Q+0 zo1mQP6=mStNC?;0MuTlV5_mkV7r|tCv{G^^>7-jMykqFJTm5_i2S&RKcVrW0DJ9>7ikP9Vt{QIVf%*K(8y!fL#}aNmdf*lQ z+#2zDvOM_L!_5tB-`Fq$^@V)nMV(+$;kW~z$vuWk(fQ9WNErfv9!bQ^^g}&|P1^&z z9@rG76gF^=i!q~>)=JvigUMuO&qP2fRXcVTPe%+Hx|*FbqSJFKu}Owrr%|6Vn5IAD zgTJPMkp|Bpb%=Y%TX;01Q>{|P3i*@j@~C?TL)REuWUXw*f?pMgcc0%lr%sxVAFoDO zOjKf=8Jk#9`Hw9xw0_rgysy;B6z=z?Qfv^OYpasLD738*&^KTN4n2kNn^}cHxq13;IvZy zmJdp;wHh_oz*P3sm$L1_B62vTh|;qC3yw>AcMAgGGv0As&TUz`0hkKlQiDS z+rY2=9InqK^7c_B`+J#shsVwguWc|4wAgbSDF2M6iB-sFkU0{{56@uAgHwl}K* z{9BPaAx5TquFy``CrUmTx{HK{uonn)lkDJ?yB`53H*_uK4o>G3%h)76vQqiN50^1} zXd44TWV2JKwz7kjrLKYDV{xx90E;}GCRJLA6R;YvG5&?a6f48tW`%3|IL%iW4&QDh z2M=b$iI=i)NuUkpjoxOwm|QhM$%2^z+wA3F-gsRxtrGCEe0N>wg?ZS|AEDN49hj_X zwoS!&{}}At`U`^<=Ti^6uzrh{VV}WFGMNT-Jd%Wj^ya+t;g51w)E zW|-!_rsa+`a_)80XPtmXv?M#Pwf96u2uJy~6*B{Z(U~+nYlqw13KYB*A|g-^_d3$= zIa%SGbS02`XdV`jYo7uQQSwJ}y*YMH5XKE|-hnVDl@98!C76W}npSB1%Y9)}zQ=Go z=d(3&P;{PuuzXFd+!8OiM1e`wqbS5J>_S!ZL>{#{yDP1M%7NwVLuukzlVCdW{TQ^d zGcFp+q3j0OWbRwV-NLLq#r?#olb!c={P8IC$1xJ)Xrt)HU79I1Y68{*bO+-7N~}Kd zTb8^G4jWICaEbK{$&L`MwKW$16I;EPne>+3!kx&lK{+4355rR1OCi?DUG~3docY06 zhbwCX>FC@h zx+|Vj7V6Xd=l#|nzpOT(v_jCG^BVb$%cDIH2K{!wPoQ*`Dmbx$1L49dD9FHC6)R2z zBnDRVF$cD!*CNIk*d7x!%1iH6iaQdblpbDftW&S0s`=VToIiAn5aqVQ*^D`q{%F=J z!$!I6K#0cEK{YvWgw{gP{>tueJR1xZdR^Br8*ol&`pFCjQ;dE5iW`{IcR$t`?D!IzYW|Y#BmRDwB%l?^GmRq#J5(K<4fXD zUs7pR)YBoi0q5zn(CCgssN56<+2pmKK6|hH=6NEya4u-p_7-A?Q#r?FKNjE2H-Gf` z8Ra~Uj`{tS?x+B~N) zj9z{;9WNYEn9-&?Uaj+1%B38%b5~$3*uIDC31aQAwj*e=DAJNCX=x$PiC2 zLHqt@bS;0lUjJhG>?*Oi%=~Vx8ELCQm{#=cbNZePdyHjd5&;>dq2;B^J72Q1Ks+#@AizA;^5f%Bxlwt{tq+mOi zITMl@lNJ-Xt!?oWJuT>5pyRGf^r{48Lg#$b;}EgfXY3PCpWgQDVN9Rj;GfIM>4H#2gWsI1mX{iL{KRI;)y=IwEZ%pHYu6{(g`aiXT=xgV&9 z?^bu`v7$XH>Eb6OtWhFC>{Z@l6ug%{UzNXxp{HPWk|0$_zqs!`yp_bnbHgmKlSr!)>UFY zQ{K}-IN7}GHm}59;P0R(6W($Hx#Sc)yhH3_thF(NTb8?)Y+&|vFxYpIKoqv?4y)Q9EOvw0ZFe4~25m>A`V=qU>d_7qaih-Q4d7Wq-(sH?Fs8{R@O(8@4HPT1&~kdB+N&0(8`DrMTCsKUe@ zpz?)hF9Mwhh6WbjmEa}Y7Y3D2VQ#7Ff{?N}Eb}LOovq~Ky+bq=*5lVuE|<~K5VB3d zB+a11FezW~Zp1u@!bk6zEanq-&8mvLud1%X2I>fZX2NS69m_`wf2_dwDclz8rDwS0 z#Pza8M*t1-UltnB#_TRudF@#4tqSO&WBgU zEn~K!a^MrMqA$+ww`Tr1Z+0*)yFyM4Zc@bJcdq3K=Vfb0c_F7gxLH>cM&R9?9 z&8vlENol~1B&$&jrF_)$oAV6#baYEX`}wxpk^trN z`!U)Lr$8(bSg#o7g++&+7raoCb5hL3cUz5*{JX|D(Y*006I640f4V6h6T=xh#r^y- zI85Cv$xh%!OnjPJq4hZo_sqe?3?vA5!$`gLHmWXlvQqdYf}8JGxyzH0>}*8i1@L$h z7AuMTSV55ZR!rS*77OJn1#^IdVkMi3t|hd_iq)4>YOr|C&C^|zFn0Ud?}*H%RPB>= zxb+96A>_8U3%?b#^VnZ8cU;ztNv0r3hw_hDU&SZw&U;pQS7}mqs?#r#MD`#KB0mAZa zpX9$j9vC)Xt-X(kZzdr)lvy!WhlfV9Kx<4}kG9bQPe0432i|GU1UZI2# z5y}~-(nr~2%7duXWWx)o^A9$cY0XB&XuckNWjrcD!PiBi3YW-Z@9N06bK@7@-wl-4 zqV9P{J0=Gof1Ys0j1vyhk&j&L4~f4W9Ada*Tg|$~k?7^L2-BNQN|P&UT&$D2=8EPz zGf=Bit@8@Ta#M7~4ax1hw~wEz!Nl`y)!HF@kUq-Fg>hf%BjR`j<(-*uNB?w^jgiK^h$n{GWNYIDoH5;LvI%e`n=wvq zCRHsp9mWg0UJb>-NO+9Y7~mbHAC)uVVNa6>do)3Y*SgMYw>P3thJfVn4t5L1VJ4Ne z5GnSC>+b>+Rlk*OKuxYp|(v%1Ynq&aBMV~G-mQCsr#_q;lKGXC% zW1m{3W^N-b-|Z(`I13(v(edJ&sX~a7v*T&zo+lXv?2#Hp4r$Y=D=#T_uBT~m$~WVP z(UTtF#ycXME~-fBaVPe5+ZLP)3Hg=xe*R^FK|~A9EsRGkYR=4Du&H#1S4vQ6faE)- zWZ|)k0XhN5(9rVnOBZsI=%u#Xv!ymP_aH7MAj4|akA00b#NNU;y6!~|*+TdWpQ`9% z%V&!0<_%`4m>0e$TV{o&_Q00$yP9L84*DV3oU)}+z%AOXm*m$IgU>B_E1-#(aoGgG zut;*8*WIfL%@+C;4JmbPx~rX$~LdZl>u)Iar za2;LhY1V+9HiPZtV+YU z#TWGWR(6P`djiQtw1d`rG1%qf342}n5IF$3RsLL?Xyn2c2GVZp~ zO2pGBiwKH^izpLr-AcxmwLxy^aAMIE&$gUAw#QEM6Jc=uuD$jj5CCQb3`IiL=!<>G zMi51ictIZ=_LU1neS)ZtHM*@)pMvXj-f>1vCaYnazKh3nnY7tfK zwjf5ZaDG7!Wi%+sPoJUq3hmrOkK|67hGmC1(f5ikUkD~&T1?nga2qV(FRqQPT}`x; z5?eW?x--{=Rdn*ZcU>niuZxY!{kiQTl;ZBe-+^Vk;!`{vyeH-%zQ8{%zWLjJ-p%FkBE`du-dbZQHhO+qP}nwr$(zJ+|$9 zNh-H8$l&f-@BRZ%S9Py713mEbHC|)Sz6r_zQd`BU_dXS8{ImQs#i_K3a>ifxS-aUf zMmzuD(7ut8sn!fzdCV~#^u!(A4W|sO8h4a=Yn5it#a7Xl8J zywZQ3EC+*V&zw->Sk$~U#uSgAY4RuMob5OZKYAX5Xf@@E#Ew_LGdU}`t3HSYr`)wS z6a1N9knxxC5#XP@jYy!1!w=?ihH;h*4+jkk>+VSR* z@+bW^((b@ghg7k_7xf>Mj60iBwF9rJhG}1o(^`DzNPAc$Gx%1ZP>o!TU^BYZ%p}rP zOtrtV&$kkjQo1>!sRobizlG*YZ8V6=M8ZL-f1}IR*BHo=p|eZ1?sBUL7O{QqslS$+ z<3lVr*p&`WJ}CyXDWrIg|B4M5YB0-evOwXfmpLqg7}8ay&Q2C-BEm5{7dCc99E+st zYh!Nrk1GNLdkB|>>zvl92bE|LDn1p);tWEJ8_(`ja4531@A@03_Kj;b>1+jB2uSfU6CRHTEjXc zH5Hj9o>^_^KeFKjILcLYPTfe_{MU(7)q3yen#UV8L^pEmyR+nTG@I9*xZJs1%%E;9 zX*=G;EGbU)L(Bpayq7_8ds;-`f=NK!xtlz}(N=r2=}0JO7vOb?E?dmX;4>(Ag{mi% zm&>w^eThCetF{ft^dz8iH33C_^?tgcA&y{^!GAGmeo$>w?6IqT`Ltz+67FyADcFdf zF(aiS+v&RxMmxe>dukvW)B5o}CS<-{-Bg9atC0C%l=s8`nvp4WoY)yQcBD!2mYFC@ zmot^u5_E^CUhbY~!vmhl0Z(g48w~&a0Lk&0$kj?lVdR>Vlmnpu95P(lHvkYY)mxcn zKwJut`%Q{C5^`tVNk+24IN9gVC}NE4inz+gHkPIl5+N7W)k;EapVgZ8;CJ=TQH7SF zfgcTaH7j{zgOL)PN!n#&&tIwJ?CGR@rYBgmJiNS~iHgv1A%?f)*{@m1Tt11#2v8}vVLf* z1L!W-yV~hXxr?G1|MgzBzUeg6vSjU|N5CrmcQafOKEaZAM*2%W(;;PDZHa-1vfFL*yI9PE!G$W5lO8Z)?|sgdhM+^}LP$PIt?!8eJY`Rl$-v)zPAg>PL8&(iJ`?&tK_^ z-8oy)AFV@E(>yde#A%p#&UHzmnpRz$A5AB&^;o& zm++u?lje#Y@kQ(`*ONGv|FPAS5v)KE(W}P~9|Qb{=~3p3vjieQcgn^u#+XmYf{r_x z&ON|pEiCU{=oa(aBAR^8+xis~7>LtazPS4B;6`Loi})5tia3ginXtVs`hus*gz!aZ zm*mSd{TCQt>@d2PDQk+whPg9EJx| zNcNDFOmf**M8_2#YCz1Y7y|t%3UM?k(2k zuOfqESx82Fu^5kJ_K;L_%{+hb{sk zqLAG2CDLIBAit~g1LPt2kn%BI zq;6$pBKHS%B6ZY`fIIWZK_%dcCD-B|wQ0@R$h`m-tJ{BaC_(w>_rC5IdTYvvmSI0h z+gEejMt6Rlivl}?I1H`xcITYsDA3#%fXdHCTi%3we>ND^W7}Wonk6N0(q`N<5x=@z zXm<`WbW$pZ!btZKOVpU=K0oFO39cz4Wte52CJ5+;p`iAjfs+iJY>Sn{==*%Cc)D8N z1;gKrh^VHH^ML*>bBg`-CV9JPO`HxDh-%i>uO}J=1M^;E?iFF(b(2ebLrci`C?CHy54cq6Y7!6f9wwYqQRG!cXeAq5AH8K84YBtDxY<{L#f9kExKGCDO=Il45h>k&FJXMM`&_Tcpow5{hq`c6Q0 z_UN~g;SG7LH{8KNk7nxXwt!6+=b0cla(GVJMeKwpFDrnR_nmHDm7q6?b z;84w7eOyF|Jg^FtN6cM#}lm7M2XR%aRaJ}cMTuC1!JtbS0)M=7;zj|o5v)+EF{zS16NFGgr z{UINVUJ1kJRj_Lu+1oaTh+t&|-Vz4EqtOGXyth)c)##i%1`kX_%ZP01>hM!s-~KOn zoJFV>SJ%uOK^Aw-x?zEy^czRnSV?UWSX?@5^;SC`sk$!v=wT=Mu&$^79Oewtmg81%c>DMn-+i~zWnV0~ zt%_DwSUR%d-ji+fv3ZhmXrNk%+NZzsZq?*{U5=m#&5@(_euxfsw6AOwU2ZbCvKnLF znJK;1L-1Yj1R8x#oq($LLAPL1EvT2~Z_)2G`<|fq<_N~i!`QEVw>#K)&=TctHX?OM zWhu_Z@v4FUSuoMjZ+HUG>z*K0S#kBKoUAvJlOW;8GTVbOzy3DdfXfBUF zlW*=eI)N7TPp)1W)V|)!Ndy^R;usq+HHY(&G}8?Y=nWyX*wuvMYBUkLGBQaGfXM55 zS(~a1!7!5)V2K2l+1EA2(xMsZE@JNj{a10ILLy3x_L_+S4}ODu$%bLTsg#_G&<7Zk8z!c zEaZ*@a{k*>up5ztVvn_{^?zblj$tAJA*wzkS{3G67m@fDcT>^DJZeBe(*{3U+TCvT zgFcGNhNlt-K>Aed{r-_CdC5{L_+j3$+s7emKCH@BX2b^y+6qu)sa=*vfg)ER&k}Q5 zpKds&|F+6%az(tl2r39rNr6ZG#nTDk<*H3Gfx%x~5M|4MP;1y*hRe8g+DQdObw)Ja zPjuB~iv6SnMT_oNX`*D!rRjJMXV+&25kk0>AD3paJz4w~m#f(5Tv^mwF$I-_zk_Eur7OR#WH1i+4vdpscpb9S*~IU}v6!ezr?zMes<8O4=i?>EKkB zh&j;~LIJ``YOn@u_CF|N)0Kk@0ve(9NyT=p+i2jHJkE->nb4~HEkej?sTno9b6<~V z_^FKZQl$E_e@77gS|lFSAh|(G^d#vPp0+X@(t#zPZ7ohhs3}oJ6zOUO@IS<)tJ&#% zU`RILcgdOEUY+^7+{wg6ooyUBM*<&tSo7slX4_qiO)Kj<_K$}UzH}!dsC7lc>O9RJeVQFCnFnxLkb#vDu#Ra!A8Q_2K;j6KA@zlX2D81MY zgG_45>43N=kcHQ@1>x;KeW~iGppl-aHTu>0(Q9e+A^| zKEBgvk73b;jlN10LZszSYwN7RuUP(+)?Q97TB5E63Z?JNq3fNt>)5z7z&$Wlff|u? zZIn;<597+uMU;ot4@dtA&1>*^dz$Xfi>P(`gHLft4|jOIYk<&ax4|6oJWB%B}dG?MHqtD z4=jxEIEsQUz}JH-$P@ZT*cm1O=G!ygl5}XV>ZknuTw6C$UQameO&oEQ*sP?pv zMt~{rxB&>4T$fAUJ@q3m$zm<6{sWS_uwGWUMt~%9PGkh2EE=4$lC-$?1Zd zQWF)t_Dw|xxM-V(AB;$n;CF$S+7s#Hm()&VO9`lFLs7oSt=;*2-HmOqAUt?Tfsc!+ ze&8;9MXyp&!TDQh6GJd}MQdtUtxD?|=^;ncR$PFb=aIRyBujXrW78jX3qw{9qXAr1 zYuj^7-9#!>auH!qLDI}B+qB$1)m&_N#+aM1zdz6`oiTaag2|CZyG_gv#~b8kc@kBQ z{t~U2*G-v1>Od=^Ssl{GJjMhtyl$h=@-7qfQef@xt)H!>|N1pRMZt0o`SQon5bg5s z63(<@Hmk7!VOKk}+0cd^0Ej=H&0YAbx~D{}l9fu$i4tSG-o3pfFU8u>eFi>bGGVl( z;~T_7oA|UX!(|`gE=Vh5vh_wZsfwRdfWo1%fBWDgnS8M(X1YAVyM^+m7ZKqiHo(86 zci+Y_Q*sL|^{{WS)@Y{5L9&PXx_Mey2UBh6(?Y_p#jiB()ijHuR^^gK25*HC>C9A>e6U=(eAqy=)EJfI2 zVo|5$bc1&&l*AaN6d^S4+*hD6phz+|>b)l^nPC0{07BrgNY6{E{T=5JX~yXXj&j$0 z`>JO$9tt!CnH@GmTVIz%ESC!+ytnB53O|Ur_n1zzakhR1pGlq(uGJW^7zLSr7@kd3 z$@G&imIErV{@rH|XDhfUGN)Vdsn;r~9>*nC% zlng-*U04t|OUbs9&eg+@V80YPGmxD;k{f`ch_Tya-WZ-81Se${k>QZv0(SLj^^|Ji z0cGP+S3OJ8>h=qzdd4*&v!= z*Qbh)tQA~=E0^}}QZlA}2>$k-pO`B4Ek9>kOXnjkIv&<$|fs@0RgK8X*32`xMU zhEd9FJ2B@%=(sxM{76|E^ji2QiDiZHcPf*=|ElV|lSprGhloYrl6rV>-%C60Y9Kmz zFPF=8Zr`Oo{8eZ8i-aN8fiQ@VoImF+gl8uT8#(FIzenNM3FX_^B`PZ7hC9Ks^viWS z_gGq6HXNP7tmP`(QOGb;H(Kbyxo)!q3RX0e0bL0tfLk^^MyV%kR0<}#1Z*{9y7Z#@ zUmUdYikLHv;^{;VC`$q$;xQ1-h8xE8p`V6sZQb9H1~9L(GGJc+Y3vaK=DVdcrAVS= ztTK!XoO!?|O;IMppzL)jXY5}|e>!hmY|5~LIhXQPg);RuCaVp6#Y_xWbI`HZC5?A< zEZ)5)q~f_O=}QWe)NK0y;I9m8zt>%C4qZP%EWfXx!7Uo^lSPdnjZB+qc+}dMV3axk zCN@QW5PQa8)P6@3(ZN*1?__ds?4O3W-?-$Ek|3wz^QxavoK>V-iqkFWEEZ>{)e@hm zl7k9OIyKDb6^geHP{W!P;gEbQPLkSbtM>u)dtr)ijixR(ZMH@afp^|k3JRZUa{6u4 zD#Sz1|D9s*Ho085NtiUc@hcBa!{}sUXK4xCU-2Y75o);F!f^lfp~Dzf@%|sz@Bmi-LRXNX8eDIuMCW(8E14F$_=*G3Ul*CGB&gIGb$hDMJ;XDL9&6SK3B?7&pn zHDk%$Qmi*`cG!QEO34yQc8trZA(f3=wW#eZ&;$h$iD{yiW4ev_>B0z;N2qcXmjdN~ zb##4+ZV8=O!rggzd*{=z@{hqS6q%$N#vJNp_&XVBZ&}%3gpsTBOW-xiJ18=Io;X6k z&00(5x+Td?6Yi;&b`Fl4_$_OXZ_O0adcvNn8E(}6?a{ecU~-V453lK;-bF#iA*5+4 z`-&3=e@s2?3xip&=ZpxO<7zUAYwGP`;ES0QotcT;;>u~V)*LXqMJa*K9X(1PW!{t( zQhlx}=;b?f8&LBAPw=I3fQU{~1DDFDc#e9c3PiTvsJXTo9h}5py;tfR6~RqrKwGh- z<0>+$f4#Npgg~@FJ6vYI+y{Y+*%f_p)ODB(bMIKAr#sTibe6esv!w6p?-i+vnmYzV z39IGSdx+RQNL|N=PO<6yt}J6E>&TrlR;Bz6R*n0f0Kp$B-OC0l4ieZwcDeOAGW^JP zr@_N>HADwGMOkBqDqs>)2k$ACg(&>~spg{gSjy1vqo2v~qzaH?@uN;+C*<%(eUBMC zM{R{TpO(8IbtfTGmT;dcX)1A)^}+1k2sOwvw1G)g_KK-#92%36Gpb3a0!mOkwVRzm z;L1)1iat5fY_+~nPhqL_5iE)unFmUO#CoFePJ83UC7_4fP!*XLYcl=|C!NN2`Nimb zYVY6t&Ilz>`0U)%gUs#xu?f^s-)Ny>j^>lTo{#|}HUgq3P~p2s(QTN8%)wjr1BF#@ z(0vL+(;j%iwz3LWPHW&5IL{u=nIAz+T|7UMJ%K$_R2i7D}UYgx@D~ zEt=foN05sr5`OOu?qyM=(XQQB4*!XEXz#(L>@bKo1T~lF@(<6XD0F;LfuP^#xySn& zpWm3@<=O*F-7(3e?1i|j2<%4dce)l?1M48ZS|(U?9@HB)J;6<7&BwMMVF!JxwZonw_E_>f z06HRR9Y@UAB>qtkx3IXPq^Odx1N3ejSsitw<`A;V7?bXmlOwo~#8@SPhnIpy+hMJe zm96Y;+hrrL8c7ceoI=OeMk<&#BgJbqJ-pMrLaO;1+9>FOoxX4yMZGfceY~xYx#@eB z@9iCUUhM82Lv+N^5$9yp3n<87qwHwhVQXwGMkeOFhWutQElzumU~Z6{Dg=xLE&o<- z1r6o}Vi{-hGLSX0w{YB(_k(ileW97I#>ngt<*x@5H zq6+69v9E~v(eh^oC}SH2$clsXm*r?zAOUx`C|oC2+I#pQ%O= zs<|m82m3N=sTjD10@E%B&GHYHfKjhNZ_u~D+z$aHscqzU8o$}~>ApU?8}S_9U5k2P z?|8;&Ir~?~Xn2kI)4vh~J_IJCHLU9$_E_7MUs5@;Hrn&srAXc!1sSk2~Drq$7H80xfHU9fK6QXA91nnl;tOf-hq{m@Ny z^6RPr<_gxhHdp#@WJq%rt(QYD%eMs2UmezT%6;B7vM^VWETVqhZGWsUp|0LU&EI zzmIhCcRTJ+{u1J?$D2P+P(MD=Mp)9$I!@(DC+k1P1-a@C&MoxlaQPD`h3QmaL5p0g zSm{usX<#}uLbpgJl{O+wD$w$q3r>7Vi=5Vrk-a(z$p>7}oXz!?dB`Ssf)FAF9(Tz7 zw9F!*2i^6XaQ9psnG^zBPznhL&aeuu6mW!KnFr`%We)Ku02sk1rbKYv76P3bwTF}n zVb0wg(O%N|$s8sOtf3iY%)ss~(@>IlTl*%$uk4b2V)yDJr@nV(RV_23 zqE#Q-G1#4`Y2N z1v*c@+iOPf6&Yh|NaG{o{YKMMp7L|)g^8`|%QcftxdiD~D_@=qc2$5XdA5aq5Iriw zJg_-cXd6}R{NLNX-YHHtv3nvftK7^^_GKU6THTwcg(yi>Q+VjLwYn(k#@2xH@!8|R zvhbp@_ovnI?>?P3D3UIHJXw1Bm6FK0wUT>8uD@trr5Pi6(kzV+5)f`M@0jf=sW+}l zgR}gr--y*<%l)nNcSi>2YcN`uhxXB+$aaUoOLh#O;|8q=d>IUbg|5}P7S3Y z2yLJS3DYb;mcn$LMnVTRy-M+{fb@Qh(Nzk-qr#`fsnZ4*-NoGKucs(=O6Efi4??Ve zK{@7N3MVeMCRT!E!C6`m$d6AoULqiE=kV5Z&+ctTV)YoD&Sfg|F4NtBoZ$CSdKa$! zg~nQ=&%N7BFe&a`UagNU^g1fdZEonCR8r7iJ|sUjz>4bJ1L667d#A!SIG{)&WQylw z{iwN23Z=qfX>#t0O^g%6`mJC=lF0&vjPSfa+RNpYg0AK998GO54f52b^)Zgaq9AeN zYZ`IMMqND3Ff?ReedpGqVz^8gMN@o(wk}8vQys-d&0gZqpTZzy&&%XRf(`)=T=Ad1 z3CK=N8jw11XGhhzfWU> zIgiVZZeoo!pIR2!&;XD~C%%n_o1i)jWd%A$wMIXNd2G_#mB{ie_U{Yug?N}Mp6m2d znU@M6bUIup*74jh$oOKput`LS>dHF9)Cjnb7w(!|%5(I!kT^`GL0y_-04ILCo z7=LS0(l)9NeJTfG3Fg7_#a3vv+Q%e)JiI39z@w7dv??h4H_eCIE^4P%2LU!L7#fpW z2eZ|#(rzzlUW=2Y`ox+mCFmME(zX2~)mIrPm&bB2k@in^H2RkMl<91_H7|2(7_dNk z%9WT9vmod&<_D)yiCLU!ozS>lQ^dXPfKlo=XK#b9dGQc|6}%ZIn_{$$f!%-o2)J2Xv(MAqaPV&P7)4GGMe%JM-W1k$}uOlW7*v!5qd%PBi z+cF+dj{3_eGR3Iz6w~Qtyntjt>$VRHDYSKSK-bTV2O2fE!}( z`URJ-Hl}5NTlMHMXhD{y$?oT*4n#g!K7cIuVK4OKz8m2LF&1d!UAz?cv(=q}-*8o1 z>EUwGlQOc==*m~7u|kN&?g|CQ?xU#XfVv{twtI%U?^Y^$)11Sti?_Z7K8-}{)*!2< z9j1$Ib%SMw?S2d1&|b?oIHfMk0`W`dhCywZbN(`kg&kEK(@;=wW(A#^M{55$u-7ue z)w1osJZiO@3U$mKt&2{D+fK6(n+pWcX

Xy6 zyb>f5Bh!NGnF62KN3d@)5GWn_Wx(HDc&HfZeX~~J$$hpbRn&@Z=Dvl4>qh*n>motg zF9;czUv~hJhCIH?7Djkd-DltT5*F|L&Tl%ZIQK`!F>ybkcN=0QFV&Rbf;h_s`%gRz z9)1m&FXA`Z& z_&}}C7BrRZ(Jy96A|BX%P9Zwycc7_&vXJnBsb6;;pKP`F#M6KP_fFV(0y02rRW_ z5KE-u|7jW=x%Fy4)$GZ^NEx%=HyF7-mssL=5t@`X_$ZgZ%S0-67Pv1jg9FB1qrngF zazd9JXWmcMhHa1Hc^qX}v7>q!s4uKD6^C8L9DNvy8n3bXz4hDluLy1TvCxs&p(rwT zsYvBFUlFfi2(l|v(xiZ~&^Ru99QA@dVrha8$b_|3$-LJh9J*i!)Rx#=!LJK-ksa0x0EqnRz$pKVux3bh>-c z(7zftw2R1;KG%E5I)?jjZ--H!{oV~d0gZXm)tv0#grX3j=*tKN+wcB%Z1L!QEOP7b zIL*>!8S!b>Z1`O2bYO(QFeraMt6;aKoUZ`iTzo$7h5Qh)0tDavP5Vx<%Y8ddBDyUb z3WI!qGv-k9lQ6)&#@9-YGOu+6S|(qd^qK$WmBYO9yO4(YJn+_g1qunK2X2@(v)mdl zd+P}Iq{F5O9{IX>uSSmblJ_xhsPWcBPyL+aaoHD8FWPX2^y%dO@fb5gAtnC)oZ%km zlvnVB)*Cue;4O~%K2@{@ygc9TStN&KYo(k5qa&uzt|UyNDkg5NF{e!1Tk%T34QE-Li45#>STX#M>du!L_Ag9ahei-P~nyEIZRm?p^bu@ zi1rs;KxxhX-*8f#ji9np)=SxNtyK_Z5C=Mfm>-%8J8nnZx?@ekc-j#x=5aUdUDkFD z+nPKC*3eM94gLB5VjYgmA4}tI|lAX03r#O zl(9JFf7jPa{1o+%+c3UT=jS(Xe&7dzvCSH2Xp~flVr^>ND&N@{ZX2$i3?Pq%&DVs? zOCff$b&>~DSZprkry3r`IbW5=&|}MK+z%CfyKSB{VFM>V!i)xmC)aVvt43{A2;eSM z4&c>MA7@b(1tlmJtaXrsLhC?7cu;PTKiT;=__EVFGux~U;!+<4LT@wYY{<+{xSzL* zfymRKj0k9%C!9$C$r<|<*oNJ4tveTfLp=8wS#s+;=H`l%uMbK+<`^bHtwMzY&5B#y z__um&Ka~Z9XGvpxT|C?_%rO02TUxq5GiUFO!W7d`JY48b@Y{>pgwX+K(Tg@{Ib2#E zGvc~-pCN0Zp)|g^R+Z;USLM)Joe>i?wnb71bs+R_38gv$63MgKq=)?zPyzOY0EKuD zIAtGQGB|r$rZQfr44}n52c($VDnq*N>dk<|@2gmgWK}Fj@ZHH`FFv^B9#i^B@{W_J zmywsgoGeDs`P&V|FB_VW?Pyuv?0OMw3-9T~?z z4rKgS-x6Y3Hy@(>U6p>)6O$_Rv76=n(+rAx+;S5e>CISG;CrQ275s>f+ezg&JV?z7 z@94qu82Pj{63yu*RwxMtUlO&)_WqMfM`}Yr{*WX8`kh?=D(t;9;N3-`{A5WO&-|Qa zyRtu3Y0;k&M^4yshyxJt(y_?C8Sq6aVPLTuZWNFB0e~$# z4Tm4*HG$9+uw*%7yH>Tb?r_}N>v9F)7F0}dqZ)1)uqwKM9QRbPZ_aWGm*uiE(E#vcUbgziBm)|eaf)sDR5mSG+Go+&|#M*=G zHVPw!ksOX9n7<>SD^B$7R}0FaAndMHZkTXAhVps}$ikn>VUP=w*zljw`GhSH4rj)U zLAg@E0!Les1z@;KT86`{-=Dc(c_^O0v@T{#D~ojye-X29qTy_*<+8%XGSlR~(_dcx6wSzDG;Z-w+y$cf|G-NUpRkpKu5wekyF?yoy_*pwMI2CD8Cx zFou2F-cK1gU-G6f=*WmyaqHe?SSHM86d{f5p(~`v4c84{cbT$`ID=g%)MV)qpsvWC&|m`mfX-9t zPsyba0!Xy>zq@C|D$6RVS%Nf{<&I&Tx@JecIs+2z{wmiexMah@;$DUB{!(5h&+e0@ z6I@gS^aaK1K9zA$aBCgIS&Jni%~?NtJ1`!*Vv6lxaEu9ROU5}XmHBHQ?wP2z2Fxp) zcZ$zJeyoLJiW=RkFC|0zi#;gb4dGStX|;<06)eH+H;GL;=K;nHPC*SAGU%=QuUs-+ zJ2dG6ta3c2DxFMg7s6UHRLi7TUJSaWhuC+dm=@Sg&Ti)~5!wbAbFb_)mhq1)aKJ`k zr#&Zy^I1BAHDJ_3{9;xWYnCJ_N?WTTKI?7gZ`?S^ZrY%sY%C&NwoxG;qyW2vV2NJdwQ3ioa1*ad}!%icFCUxVrs$6!} z6!iKl*d>cThK@YYDDjHJ#N^$PbERH9V6OPWdKaNbVG4bbzZ4eij&a4=6{!J0TO zH(xnnS4&*MBS_g|Je^taeDG>nu8}-#D1P?d{K^GL4lDnYsk5r~)8MX;D=VnQs2nGK zzK<`A!FSBh!tvnR9U;~_H%$_{SKFjbU`nBCQH+*g&#q9gT309q-Whzum_-eqW4~GT zT&Uk{L}3e7o!`cGIEeuaUZ<@RzrF}UGU9g6U*hV=_MqbgH00LSl>?znRK?JjS{ugS zrXs(4*V(czW-P>M=G!;NT+FM3)s3Ub1Fl7mds7a)#1$*%!t`P}47I2Q%di<2%H!>$ zYshSFPc?t|12BO&nEgNO*Np#{{947+!IXer-pESX#TJTQj)3uhIv6GMW-sn3Sm>EAa+p^Di)U#(mwcai!5hdi28tfeOVFY zD5O%vg(4+_5(-zONeY8n1yw<)Qi=kYOt_elLO4LF&;}Kx%jkBY*+i@YWcHe|ee~Tx z(a7hSf{{;EuRxMC8|2sJ1h^)M6_K=NsbORY2v-Ik%rZKZvu12iBHRtV$U)6w{&iUC zymWOW0%=-y3mUw4lKg-dtz;2Ta3TvYD<)3QgJ$KN1gJwJ23jMjUZH4rSVPZg#Fd6| zXd}Q8a*9}{+Q5GRi7MMm(fHyY5^Y+E0#^zH+(fOU;0Q%c@DJn>&$YPvl_7tc74WsZ z08*m|$4ps)7i5|GR8)zg(c*mwF*6>J!lND})o=SVuc29OZIae)k?m%WNS zVM7l%YiZFv;5w?&jCdR}jC@`ZbA*Cw8WA{Zhgu*v*@6lH1Jq2x25#LYWt0f4(i8#) zxHV-Lb#>*W1MHK61=VA3(La-VYB&#JVcJtx6wfH3CAEc03Jk`T=e~EL31Y&0`F)vC z9)vpvZ&E#IPY$gfbbY_bE8dUO^lGh%JFqiXdA?jZv=_p5@hfA@XhzRiOsbXl4D%QOmn!D==DYKt@48Bee8{0j@@ z=mzu&M2wno<9Bz3);3+2YU+Wjapld$)q@RaWbhw$4H_%WkrpgGUo9SfEf_Rb97$MS zj|c%Cw&4-rB0^=6P(VSKJzJYD9xC)B+~?dJD37u~mV|3ydlA~%R~@Zg{ySaV!*RNA zLkf6AU5tym9%X3r4d8i=-1G0|k1fxI4(NFTF0tjC!dwh(%=2-&e^orTtB06x1I(^x znRsmTYCc=MBjq=E`LFQt^W4lXwHYn$@sj3s%-49y|9wr)p3U)&mp`pLg3txv;0BCzKd zc0r#lbfH6B{&I%jz5xmT@p6u%nfHUw6>^{5w}13R*J8xE#~+;6H^%N7b6kSE<3-nc zZ(zI*G<@;e_-wp2RK7@1UwoZq%9!WjcK@1swjDCx5b`PihjEAJ=2KnuJJq@&6uRK_ zIuox<^>px5R;`?6ybd<*0Udw8=h(Z)4e0Xbp+c<-R%wTjcmV)bQnyWTq$gOW6(|FT zXnM(zw`_(_*xEbXCi^nqyS?KYa_{Hef*?Fz{n%W+{ub%c-X?>;j4w9)`TRis9lOtk zE5r{iuD9gwdyJqFme%Ts=+k=nX`q$8UVbZaSuGV+psC}kc3=ft ze})))Ta{9;(-wc_UUwfFk1{2g^h$2M;>4;%5xbDU@?h;u8+VQ$gIYU5Y1OdUtjmu2 zWJa`GwMjgENMk)sOHd#5W$SHb>0v{LT{Gp;T%8$koxkbalQ71n4V~YxYYl#dozXny z%d}0?tA|W)BG7T7JBjiX?E9B*na-rWTtl$DK)n@fGGu!y3thW!1A(oJKu7w?8X`Sc zYEnh|k>p?2OG=PcdS#INa5vi2+Wn~@D*tkU8ZDLgY$hY$-I!zx3Nij-C z`LF-3_lc8+h;oLBY%hc+x7cQe3aC;V6GzLjLw03T#drT2zS@(#v4jp0vAHWPmE~(f zHCKPuA}!HfeGMx+S8NY*jGq*s)o$StI?H{aX)L_Xq=-diZ&{k;$+b8OqrMPix?D&MefGjRLPf*YiKrOPjaRfoR6X>BaN z$~1gc#9JDT(RWx&qHIqae8P>J=Hti9o44xUc=MlSnnCip7NtZmVDf^R7)ib{^z468@bi^Hp$!YPsD);z_!leGT+;Z2$7cE0iQ^U zAGly~7MEP%xh17xBeXMs;i<^qxV`gksf2ZWnWX*)-_#Q;*&%T%AYAe~66w*c5^;PT9_JSU>+>f*+@~**oK3j~6fd@oR-3F5`+r8MC z#5BofmRa$SFbm19LTx5G(kHsg^lRn|+6&qnl55xIs0-8^Y`sM$=2wBqzLZQ+ZL|1P zybaQ1(lXEd8=2f=So{x1pdY&OkzV02Dw~44gi>rNO)$?yf<1Kj#|zF^L04$)>81OS^L+5?+ZVS|?jEvZ-n>G3p{G7T#3+<8V`6{TPOaDkrX=%smb}1nP$I~{A2n@^$%;_>|bVMejLD5tKSd*tL)5OIA3QUhx!V4xfNY@2I}YD0IPi4YL4Y~A zfG1J^ZY6fclI?=e9tIDh$@T5;d$=&;{{`<8q&!8+yF>MhOVtB2+`tT&Z({~y*gELc zvc1eI8m-zg@O=G_K0Lq=+&gh){@Q7|wm_r8!KJ8DpRl9oNRfj2b(a;i?je%*nHa3h zYPRk~Y-hgw$K3Mi&efL(8_qvH8vGW@n*kfndc$6S^eeuUe=*vP@#|S^5QeMmrYA2f3e}?y31*uY*arw$x(Kj8^1pH^yQpF+v`A0 zOIDs?&Y7d&|LdU^-hT1V{e}OzflBy)WNH@H|0`6>nA(}USTGVWGBf>`rvG=vM8L+% z!1;eFW`h5(LBP(!$n^g=TgSS9s;Jy-u@UYTv@l4#Effa1oCQck0>d!C%nZyd5D@N4 zNJ>aaxTgpGH&5px5fMm4_?%yP&w0-O)xY>!|HroTyZ!3=>cV$J(?#gdVI4v$iU}zG z2n7jP0-#OENkc#Y0EvPC2pkHzz6Mih0Y0|>?_k>)0tr-fp!5&8Fd!sgk)27D;S(JJ z5WJ$B10X~MK8YLCp4oo-X^{!6z+jz#EhuKTW%O+ioN43} zC@AvEJj})+VLb=ITJgf{A~?9U)m7N;SUPCf8O_j4j7@mS73dpsI>Z?~W3&eib`hcz z#7DIZD02SpZuH0}IcTxPytVGnh?`QIP)&i|D%>tGERTu2EU zD~0toqJ$M0ti5)#CVnyL0Cor_T0K5bLc_JQy{5R{T0AMMuM))*R=Rb-H(q<`|{(S2-v@0b3Oi&pzQvY{vy;*3~ICHz|eo6 z8?`~In?&FZ?XRG*s3$~05KeMknEJ0AJ!_l;f`<&ugXDnyAp->kEN0slSNB1#olDP@ zu;oiw8R05Cbo>M3N+#$vyY83_+2M5w!>(J{*OJmM90l6pHS@qs1eiBBE_e8M>~4eR zuW;hutE-<^FF!d{-5ebrst%q|F8&_Ƒi{lt`ILC4(n{}2uEKdr#;Cp_AI*wEqP zd@zIC-E2nxYej}zjOrSueJnPu>E>Uz`-9j?{LO!vp{ELS{%5m+k50Z!up}0>@v58K=`)tT3 zD_>NFEXEUSfNEsFeV3mSi;B?EaNS8!KHWb+r>iVZWGCG349+;g#ZF#&4-NulGRw`` z^kBBVVpi7R^kN~@4D~c?`!HUKnM!0o6@iH-a~F=V6h0&iZZ-%82}4qWLuuzzI0?*$ zA3Mn3(+fTae%{sE?k%^Q!l_O)VHsj+ibpT2)f-V1tVW$%7GXsoV~RS&KbKYe^eV7F zjmkTeTtbr7R&k)F8j8$SNo^!X;>AkALb6mTntyWx?F zAA(C~;8>uX79v^O8RfAlJV|Q^6P>S%Hr}we`uxx;twq29vClBv3`Wb4TiTz$PP~d5d8{!C?AP!5I(-D@0Kjt22=tJaQ@PqQZZ^rYOo!i9$ zLC$+LPaNa&_eb#9nM9LSiSp7=Cd)H){^Xxlua`Y`es`4wG68c1h?~g+=w}e<96tW5 zLTm$pi%b7pNrLs#OT}z(q=~lsUOrW4IDiMJwcY!GfEU z7b2x86Zu;GCr6Z1l|8UlH@KWqN`F)pzdz>u;w|sDGo=B~XW(#@m`uQv;H9#O`7y1Y z+=_}RT=Di)cWaNG1RIEcdC&tVXE0YVHuYV3mW3E7Y}JQXKXu1 zvbV9%61TT%YurT1NkOZgq-l$+dkaa&8W+J$YsT_OuZt2xvt0S+>1Hl(!iZ`7=@Y5Wee8u% zX1>Y(VsBTgc-s31CzOSKEhTv-b+fEkvOxZTBk6hLCh&H)=5wT<#I(^8H}RGRa7Io2b2CN= zk=%Kb>`^{lLTZY6u=KWb7{@@TE{)f@VNLn|U7w--Y-^8hrHYcIKapj| z{$lp7=Pmw3+P`c6?V~l<)wS{L+XFP&55@j=lyXt^V7zlX>*|hrWm^lg`y?Y-?}_3? zBhJop!3*)}NwIjqKGvwMXGR!+e>KaSY=Lje6zJ#a6r*PsB)4c!8%x6BIKIAU@ROy$ zE93V;`f5VKHGLD)p=ep8hbd(}?2a;*ZL-MFuikYTRml$<2cPX30=2|+`4lf^2sZ@F zzx6kZxV$A*73Dy%ida+9TerpTALpu~xLBAL#FBR5_s(iZ@8p;L&{KW;=0STglecN`#Ij`}<~B^x7CwECv?dASbS3R!|V{BEgaO8eIJX;nraC$7Wi zM@@AQZO+tlYyFQ?DAwMd8-7G#P@XAw_$^sIB+PlO%HP2~s}L<79*S!IR#UR=JWWG5 z-|RPN4BBs*Vpb?YV+oy~>SR5Wd^Gt;;71U zEoM|zHLLr9x2#Q8Ci1RwKM1jgnmG#vB@VB<51`FH#s1Bm3NK-W>-@r``>mTWcS)(; z<1r0~r(tORS(}jNIvQ+EDXX~?e4meqXG(z~qGB3?BN2{xmML%r(W5(Ki?FcK{WyJ90YmYnyE|&KJyz+sgG^f8oE|eb zYofPZO8!2=0I7$7%~WS3HUU|5*%pmxgzTLk>sTYMJpPI)lcNi2(~?&c|13mUu`{nH zv^LCPlw9}NBYH! z6Z?uwNfjdYdQ-+l{^GsjW5J3zizQ>gLu#)f-d>O``xq_Hb^8>$M->;j{LoCFnD=ap zHG9vK$Rm*P93wlu-QGiSqlj3)UrsCGcD>JE*i%@(b=x?^h{=_~I~_ zLrY7lm+4kn&RmLVZ~IEyh!yp4q{>;}pAWll7$SZvtWG~`OoSSpY)5LBQhy0g+`yLF zn|5CoUKn^>{==Bd5MA(wr*LcM2f<)Qt@S{Ub4Dcz8XkA@M2a%{`r{yds&QwghpI5J zBf|q4ZkCkOJYBxjh|{X(f$BpT6G4)eU1l4E314tx#a>g=AEgF_LjG(#QJs;2*F4*L zy;{um3RfDE>azSi7MhCd$B%rEV>1L6)n|e#X1@)4i1Nt1{Jv%% zvBX23la_tjOli)j8Ge*gN{9Tm`oT9^C$QBUSa{v&gdjENC@RE|y4e6lz7mAVOkJ4d zOSfX`amC|k7Ygko+7|e;xG67pnryFxrIY(ID52i3MTd&fjwpko#|+O4^rzP1C?59G zn+>~@pxKkl{P5wVNqY7pRd$3pG((YQVwGM|&*QuBt%GRbd$wNF#Ajq<+`WwJbo)^Oal`wF6*dwe)$-)JP=Z z9A3-EG;>iiyjni8v0jQ4Crv$jI{P~l?uTyz4SU&QA#&@&Q*t}0x;)r?zRK(8Wbr>h z5*jrHJjAVvn%(_vSmYnS)zTVVh&sg!$N);sZhN9_OV;j|J2>cN#*U;v`*3L7a6V@4 z;e#_*S#-r4sRAR4jZs$uUGU%i|SbUf|x>?O{V;b z`KyovD$`bdj4*t@EI*6HlH2-k#m-KC+}C(!sbz1K&Jtu;c)p|G$2-UX+K9Lb(QdP(kY5K3|BX+KA4tMG;Up z1h8v^F8eGMv)uc>z{>MPayTG|D}VDkQ_KzA6(TCAZ5h4+=iiqVmU8!ag_%;v+E2Aq zbgx5{{7kI77R+I6OCf>#VBzH7qv6skirGOI>WTY`DY6})^LR{5LuGmTHD*muK&7jD zknPS)U4P(V!!$pNMqf@Gj7y*8?QQ6ikP7d^?jDe$?(MGIqjUa)yZ*k9YFj!XPY~<` zX=awgxtQ6(lT(&p{!BK_PPN+GWiac$I!749R`Q;B$4S`+OPtl6lQK)$gz|oIN^qcN zV#TD;MeF1}D#?2JXnW&SuX#?g-$aRR5yvL&o0N81tmM__u{%#JTW@g+CB)27aTH_r5N8{N+bW zp%zUxh3%BL`t-!R2h8Yhm?Gc4=}V1a=A_vbxY*`5?sYZjv7j1gZW`fH5PtTW4nzUS7^4yo??= zlIA)BJg&Ph>!b(Ye#IP5x3F)xj-GJYLa~8E_xuqRI!U#B>`?h<{IlpEKO6LoIOjG# zeH`cmkI^AUx#6l)J~f|XaKW8P7`$zgm?E?@z3mDu~#iHL69Jrf={oB|g02&H9s zgwIioLPAtuH^_)-!k0&m`-x>RbUYGI*MN2^66QA^6Qu%1$fFd7w{FzM`~#wUzDA>N zv8Yi@lj*s&S#9_$cRfBW;_T7c(ByHX@$Y}bN~?6#orp1*CNKAPRHlzaHx_PCti@Lo zxY6#M5YaWmU1uBZ>Vx|#Lnh{8cEc59eKT3?COf!h<$2<4Z7sq~UF8Ls`^=bUVZpNg zU`A1)FFwSYKir;2m9d42XV8~5_8@_J=@gPbk(tN?@Gg0|!oK7UuDdRpR(&&nE2EPU zOG(q5`%EoeJD3iRce^&OoN#>_4Nn;)(Q``|P1Q%gkv(k7PEWL6+?L3%?f9y;yg-f- z+Fu~uWT&LUmt?wj@y$}RaAMXde#VTdl+N( ziOJ6=Giy2l{mde8ZQr};=}tM`6_u=sm8Ai;OyPTCbKfA&nua+fp~zw3ovkvZEdAMj zMeS!i;K%unorMjnGH9DjG7+7ODFkkDR?b@H;;VjX7~W0%bzhP9<$m2Ua@Bofx`6Q8 z@5Zv*xn=X+o}Vk~VS~HrBH--#9RVro11B?~a`ec&9^aCN^LCTfAw81G z{b6AOt6yPEet2OnRebUvr*3%3E(#w-Th7CeD1rzfR&@KZ#x(noraoH=GSqa;sFhaB z6u}}*w8kC9-|MB5pTa{0bWW+Q0SjMSMf2=9NL=gVA^~!yP;dL+z8nRD7`+PsnF)n;)vyX0cpX77(;1n;q*~^H2}ia4M>{X)~^6DtGeG7Qg5po)%qXv zefUE4hm#3omwQZQia6NnLenI^!9@f*r=GO`@Vbjeyg)=UX%RnDXCjw#iTA#%%|Q+* zWAd$^YNZI|_j+c%qiE_qr7(5s&JW?oDB_Vj?|jzLEaP04PKTwqEbFXtgR|#L+!*j5 z+(E=0SkH?(IV(`)dR!bM$kF8sXOr7dda+S32XXzcv>NS)M$v1g%lph zHS9u|mLHTb74a>k1mjg7UAW4uD?I-+V^*p+luu+yLz4pGg+@}KW+!5%BH8Ihn9lB< z_-MNU{uJgZ*N8(C^y!gwNV0!pFpS<6@!|e}w<7~{=9-XcEvA7h)-0SO$t0|V^)W+c zxuahw&!UJy56`4}^{BP=cESiE_zWX!@pH#mD51v66F67NRt;7>3bC4!54hAjQ86iy zAj8cJiZfN#>numFhQ?LE0H4+0tzy#QBpW$F)a<3x_E9{oXCF5^nKS+vq*;;P7$J?~ zpHvN=x>{et({9BcI4LJN$88fkLC^mYwen@X5~p@}ry=@yc)Z8>V~@6>C7S~FI&-%c zFT{F*u3f++8M$hffVJS4fvs%E7DkoThyJ&&kDbM{C^NZIut`kCMW)jN$(7jS zaB&pWJaR%y{dhTupl~&e1pO(%Uf2L#yGif6>qu%6ix}~@9HMji*5U|w^rZ*OTp_Nw z0eBJ@e0dO1BWH>gZtu{CNKoAC(HMw2Jby_t`O%;umnqdmti+GuW>PN=?i526`CE9d z=|n!+9LnH30s4h4(}90`ahyqu@8qverKlPB7@0PB*P=}`{P+R9(MlbPtZM;KCOV*P zs6$UlDT^SyIK61sI4eB+1q?#%@s<>ui0-6lqd@Qx2NXz3O|}kbq7{&<$ju)lb{<}wv5(DVeZvF_J@u4A-0Xo1p2kTUtP{K34Y=lMP#U8T$nKKi^7C3%Z~nfz7JQNAJX6NBTos^@ z#29Tey`xy@t_!OD5yrFx(@{4(SXR7Dl;<%P&ARykEuv_al3jnR=98@vb4(OsE=8}t z3brRQ#kpIE+Vumi?An?{T5MQcz6P>Lz2L^5#WhXk?xYsuDp150G z#A#h%+&pgjQT2zDUAxvBDiu}CSH$6W^3XsopdpvOwYE&Ig{|VQskEa`MiUvfQ#Gi- z?x*cWYQC~nDXIsfgQ@uvb$uMGLJkgFN1))eKNk(+@wK6=rOe{W?Tk06mn;%WDz=ZW zsoPY;=rdTk4O^}FUA8msq{n%03@Iawv|D!tqJpOObPCnPbYp>syXV%j2H~(r*~yO9GSsi?0>L{@;A9qOL9$_D*yPY9=fIQ5%RA*v{0+ z9-wRqHU%iyJDHhTI@7bNTe{dl=%gWb5GSySr5*=}!wz5y0f_%oGPN|f2gumHBN}ZX zrk3^qJvwn2c|Cf1Ry9{+D~O2;9X+e~JFwB^eGGZ9Iz$`bZs}qH5POF@zGEOwY{1UW z05^z}v!%TqfP;ktM9-@1WN+$f0&${qFg1IZX9luxvatZ)Z^%JB-R+%Bo$2V2|MkfC zJ`(Q`N&uY%A3Gb6myLs+lbwSN#0g?%>w^?b{5co>G>}IK1q2? zHwfTeDK1tCh_NNujvip`0Cur(hJgP)TM!F73y}UFmr4=iN| z{THs39r$lIH~`4W4*b9RzN@rW>{fU%eebm{fKt;WmnA5eu;DvqvmnJbS1+VUfnOk7 zYprj3GH0j9?xE^7OY*9Dzi`6(wzB%R$mt#N>c2W-arEHrAVrz>dW>yL)M1hYh!McS zX36xl{3gdC-^p;MnIanrw;cAM@?@3rXX4xu=#>xTs5a)rJ^|xn1%E94Kod;yz6*~) z)G-pv2(XmEosBo9NZ`@8rU}x%;R%!#MRE<6if-XEQ@a5L#FN6Npug#aM+=i{F=?9no55&J_CC8JaKBA70oyd(D zFi@~WC}aL=C(W8yQ{!Zkm%x~qxeXb{9}TsPK|%}}obp*K@&pMo1b&w2l6*}g}Kln6pAiKlTd7ho+qIp}M_N}2(8(;;>%^bm1 zQ)^%q2(HPj2R6v$WO_E7E_P^x(o^J=}dR z(X&_eUzaP{&G$;Gd)}4jWnxGIm53Ra*wxn?<%g<$?EZwhg_qU0;Q(Fp1-F+vdK0;N zizEuJBMi9Ojqre&yUDToe%L6IE&ZE5$ex?`<-oGD$YLy0Z8Oq6hemErgd~Lr^I>u>jlht)3q#t!=jX-o0@< z)zPNsRD8*-f=OE5X$v>yFC83fz2*{hBa`uVUtqktvT3G_N&BvZE85KR6k^cvk6eSF zpMJIw$IKS&_l(|~)eXx1p`kELikbAB9@b3*>X zEba70qHaC#*&9{6)2BvXX6=tHgVj-z=wz?nWPG4`t|L8|_(J9W1XOUMYSC&eUaR3M4_%=Y1AQDN5!AumhGLdJQYTU z_UJ~2OP^=?`HaWb+da!oz%M@f#9o}VM64|yLs8+Z)J;*%Tc!D4;8mgZ+m9-Xl{<<# zrFCwDnB|kxYf*oFC6?iXxsjabfeQ!zq)V*9k55V0q;n0pe+xz=C)b|Z5&BZ%!%i1) zV`4|r12CFe*Eu~k)0X*IXCsD>cT8HAE00*A3D09a{_Y0r%H>g4Qcow&t6I=oTQ)W} zi8YE@OIk?IM@~mprR1fwj6oOMsW3(NZNc`FVAIl_)$#;5h7BUc@(U<_T_tx4+(l2q zp>zM9Wz^b-7tBap4Or!8qR^{RaO7+9S3Hv~oq5C1k=8@}-;DA*qzUkk84wUaX8qU4 zUt1MohRiBsXA1EE=&}KTAWnT`Ry9j6$UjA7RxN-o5WoQdzBj7c+q=9s{u7v>`cDrt z`}f*ER{o!w1VC4So0CmaOiGlUolP9bE6&5lEhWmv#v#Vb&GX*IBgrEK_|GEmgj7{>$h9{&O?~$&8#T4)|lpmh*B^5+*qej1(*dB6La=1w&*YH*60h!}_JFok+#% zR~%`@H{;#K`qi)1eGEe^-6T9%SAI#QicdEif7D}(dKGCj$a-l664h5N6U325l%WU4 z>;Gazn$qc%4-BE+iR4RCP*)eTFEGUGz7cb$ex;DK3IkQJ;n?Ec&FmK`9@bvnT3FX& zc;$^Uyhare-HDTURgI+5J#9jvc8gZD;YkV;Z%1vvqW9&^y>Ts*TXfT*>NcIyNo^ty zJ(SHMeQanOod$uknm=a*7ivyQH4bg^WPPQtI5)?gW&7alFjM|F(imUyvI8_Dkk$OO zA>|D}(F@08j>cKYgMs3J#G)g9ONS3es_ubQTyjS;I^b!7mk5UoThJLDaO|`T8&oQL z_-gR|m-Jg8T-=47XzrWPs|_?=(sj`Hy!b?3s7jmk0zn5Cy%{g~w9S=D!W5m2ev{H( z5GBSL>t_?n86xu(_aZ9u9Wsi6cx~+?sQsigC1b5J6m3Og-Uyju10&9e>7urVI^n7V mh0X;QQB1Lb|G5mEUBFH*9!~G;?tN#$3*tbgrj}HaLjHf)9K_K8 literal 0 HcmV?d00001 diff --git a/doc/SPIM_Manual.pdf b/doc/SPIM_Manual.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b785613c8afa1a36aceadee59326205abd729b94 GIT binary patch literal 518753 zcmd43by$^67d|Q=EiEbC4V%4bq`OnPTN*YF0s?wAzVG*b zD){65e%HCqb^c(k&3^X%%$ha#ntA4a)(n-Rs5ldVnGFSrYI$XF6a|Tml$F%Z=rIZs zA0G-5izul!0P=-0DT{`t7OAbXwKXXhC)bY;x+qBe{3uAKwkAJ*4!jM=&cSvQ4s;ui zgPr>(9Q*A!&`mgw+i>ha_M32=x8Z=?oHyaPZpGbPANOrIHZH(T^#NFK1#;dDyz1!x z_PmIrsUg_X&Q{bAY)VQi$^+o$=4J)3asdFW+#nDggd2*Eb|%iorjDevIzUbi$RDQ; zD=VweRbhNpI9?TYSB244VR%)5uL{zuLiDPzyegcoiXRt#{A+#n?~lUt>eG+A{6GM& z{$;)@Sg#7eRq^A3+0~~X75(?e>Q~?WxS#FSCzF4E^5p81)0O=~&R`2Wi1nIwww9)( zIsi`2t8Y~;!Pbxl3)$O4m~H7Q#BAnhXk&VH<%dVE0OD8Q$QfEen$FG)UHIxC}>J~q|_Ns*B$8c=Fa_fBPJuXWeZN|rOpKUF#K zf+OQ!Z>iZAn!<5dxfA$6nb5N_l6QJiLW-_p_Ee z3*@Ayp+iV5cjA@rA&ox93)%kEUPHKfZ@tF(S=fTWAsUSA#_$k|uRT$&n8;iK>SoGk zcibl%6K|&j71Cogaq?%3n zay;X%WEl=6x6ktX*a_ZI(&r?=;v{!iaiNQ9g0>K4cD58Oa!X_}jG@g%mc-Et za&``J4=s5y&;;^NVSFE>8TZ6u6~Q>?ky?S&5%W6};SjSSH@sO8`GfIg8G?3ZUOw=w znUfC=#{&ea#<4H9t(klpK>K1D%SDicg)ni^YXfBYrisW4uPYbrE&cT2Yb)cYLC8SMM~idXlnw zw|8AU?#w3~nZWJfi$6fXsTnIPo*L_v%GSRa)_tizf+`_GBvDF82UHT%Gtg4BnqHR?IrZ}F*tn9H6;m*&HVb6_C1p`Hbp?|`1_KsxJ6rHyF(?isWxE>6AwkC?&OyrdV;a8t z%tgv}HNgBGj4WcVU~{?b;=Xa3X8U!JfILrJLju`voN(EG_1H~Fc1VkE7)F8Drod};{t5Z(9C%ZmoLs;g z>%2DTU#pXojI`Zbh8+dKhzmB~5;R5pQ&vX5a?SwG)Cg0x9Ax_qtJ#;&V zIJj>1(Cr-JxcQj|csqwUZe}0ob`Ehs?tX)ZK(}*<0}`P(A#djp2kVU<0^QCbcJ3RW z96+~o=*rR?&ApvO?7$m`6VUA>`V;bY68+)%9dtX1{)GIEM5a!Var;`N{RC!Fb+b1m zWf8KqwF5&&Y!zoC@Q*KKEp4qJ|0|msLv8?ojIoudilp-KCS zdaS=a8bU^ZUn2I05$spL{CW5W0smQJ{d*%Ifqu1?-~a+{HR3m#{bj_D+32SQB8c^$ zPXG5tK*kI<4pveQ0Q;>*{6@RKjJTrl&z|^+KmXbYcF6F<23e)Db93Kn#BV(O%ZMKj z$v=656S5TeJI?>T5s;CLjhlm%oeOxY5jPPNLaSdr!O8K@B>C@+fDDR2b|5J`$F0QV zxQUpMp8VAacF_NYCm`c15X4OiS-RZj367hH3F*mSjo|pNa`Epy0U4@+tdQ;i-bzf4 zn~2GAjhLMO$P)kF2*{|<1_^d{z^%lDJY!rRCm;;?)f1rq3nM^~2?WRmi4N9ViOF#j zF*$xGCI{rn=YNe35GRC~kS+mn-AYVI99{PW=QUzNZumbN0hw;uAh!px-^vNj-=_2* zk8$oc??7f;J%_3q-WVUt^)1RKdXHf zdB}49uiyT>j)2tqvuFQa_yf7w01))QSozPY%Q(%5V>TB{e>V*K5C?0VhDTVH+{vR> zC^tUc^L_w|oD2hi$a>d8>$~^cG#b(hBfHA{7~Px(?$IN!xrcKPO_h)z;UJOhE-dKk z$L@Mu95amW_PKU@8+`Ppn_B<6ef-1@)`PIDjB5vvUq;g+FNf*gjK02QVRT(%v%81a z@yu~7W8$i;)qDC2H|w%8Z?ntev4xKYd)mERjUJ>TA>WpQom%N(_RE%JF$ywQ)DBo$;ndIF%9q_k z+9vefeJdU%dwhAnLf^}yYP+wWuxC&=z8HHn6@EYxKB_Q9@!*SEs!5#8Yu9XrnE{`b zjM};z<$J>bu?*0`o@ZDezpZzTQ4{(D8(J+VWUC)f*BC$OzQ5b)!nLb~Gce61yl&7fk~OSCb>@L531@8%v{+vTb`Kc7?4dHY$TiNTNA_4Orql0A@47a#5^bG293 zHaQV&m>`kfe{O$j8ITtyS!bGR%ZMmU6%im|BaErg2kKdul@F@ z2F>3lv|m{9Hna&xMel6M^02aILLZ;!+UXr^Yrb#PSxcMXAftSooVw>$i=^{_#A4jj zx*-+$OZ9Pye7N?P+ygxyE4?^1E+*(Vs)73Z5lzg}uW;-aUJYyj>#HYyxb914PZYe* zVyYQ!KG?M7?tE-5gZ)9QFTZ`eIDxk@&xema+y?p(-aS+?-T5-ttA!jP*R+K!v}smu zx&w3i)l_iHh$0{>ru$@L9cS$OoBKS@DK%(PVC0QhE~2~eey*^(2|vGe@p|0Gm_}H`Qz3`8{Tukgos9i+%XZ2#sjO& zss&DuiIp!R;q9&NUOdEwX)Uz8pbvqTC3p&|UzCziyW(9^*o!-Db7GRik@;|1J`I)f z60j*w85kSD3s5L}>GvV(P1b(MrCm6I^?*T2mXnye+{RB78)J7A+881}vF~i!-Y=BM zdKZoRUG-Je1sYYos+y3)I?sZ2+e!0Ws1J4e8c8v*k{&q-iB;k`56t(B_g_>_4pzyR zN0x^O^HE`poJ<1c7|ELGLsBOqCYj(=llTPcrL1{(IauImz%g<__I5^swcS_tZ8|9W zxJbtN%b2EGfY2#*k1{^bd2P1Jnl$#w9-Ry>l>PV=XTxO71ewI@mdvikxAcznt1dxm zs_VV)ji{Z?=`J>UC3^hhQgO3QM-ws4lii!Qumj=>i`%|GQ3`~qid7bVYfiH2=U*{@-pgQr#m73O5p1-i-w6j;i zj-?2~ZW>5=v&ps7f|sl=2_x=YgT98pkrAo(ewZ%`)*qWzH>e7iXyfVMw+!z~6z{Ce z_@;`afTu1vj@%;DnpsHKb;q2x%f773z;_ctM5Vh4I;?E7QXE++4Fi<`orMXOTSKtC zen1{2i-J(G4I9I>x_lKtv71zJAcPaU!B}3SWsgeG2Lt_VQJi8c5Xy~_Mi-rE14&AK z1H0%hMIw_Zw^JAarK`S<}B+y%NlUC|jd{5WYMTbFd5H0BnvM=B%6a1nU z<39|!S;}*9Uk|ZbDvgK_u_inefniR980w-i!!1#rAyrg0FYv5LOhxt{D>X&IAzOZ6 zOMr^~#Hq6Cfg{?Pu+me|TfxO4Uu$uz- zC@IU@Ge$0u?ScvCn8A`OiB}BYRR=1-$Fu`Wv{SQ=H~A5%0>ewm>WI}oZVQtwTZ_u4 z$x_4eSDpHkle82s9YZ4Tku;sqTg^&?UR~-uw-ZsyD>c*U>yge)LC!J`NonnAf<7ry zo)V6l!(XCymDBA?$|7VWm65S>)bseuQGRS18ixsh8rAxe@XBLdq#F869HlUVdzj!? z)=T>ckE21|--W=Z0P%wjq&QXTkVRJsVUX3b8WB$x0~{N70JU!XAb$ zh0&|ny2sK$gdwJbp(KusOq{l_a3le}-3Uf)17gKKO(;58zE`AMklRDHp+k*=vgxFT z&~E);T`1mFQ*6p=&xl0zQCF_C!G*r?Qx-o4TOfAY3+yMU^G4H%HFd9W=(qQq9GQnZ zMAb~slyePx89C`sAasbEpFT53$WU`%5}u{iW)7mkE}}s@eYK+-uNtWSs;Ev$(?c^C zsk?Zs1DU>|o6WW)_DunFuU7BoYN;KYiw36$t>mYK$PrS@KIfRu|?GAK*6zI^#^)Oji6BNd?L_< z;)qm?Occ}moZg;|%6A{xY(LR+h3hGD<+#|f-X~m2v@}d*v`)wpoIk};A2|krUIngd z9maD^jqN0=o6q~KTNKpHPn3p3h0#AhH`GhcAs21>+@Cw{LLJ@c$tg=8qd!q$;JfZ~ zDim2|Ec%>Kk5B6&{EQKkb8FcK~KWtlUDK^MY;6>MokCatcR7B)f(xV6Jv&=ef=e$s)hAB;9 zx8qilXR0w0?xG0~)3 z4L_?!tP0Pc(_Q7F*#oILo;}tmYuU2>lcL|-eFs>sXL|S*^#gpJl&E%9soEIbdHyyn zUTY;>L5h7C-=SKRLNf1S3i}cv=2jt;O(dys;Zb509dI%oj3)O4rSW+L^(T3< z*El#e_0ea;G!GEpi_oL*gnqId>7ptPLzv?w^zg@PNMr z267I4khG*JnHV|2qH9a!R59F9NXBBVL6+KktdBIl;zF}LX=O_90WA;ZG!m+?Zj7yL zjDV>9p@Gx&vrCYDh2|`N?xzKDL$<o$T1X3(GXM}HpSCMpQknN8Y=Bn_=zAD45M%J&h3K1M0@DJ${=)qQ)tLZdF)h-M_w z1YBdPCSP>60D15h_I_iY+N^7=l~nq-R6dEX>AlD=c@8WGq-d4~E$f<2vuAYlJT(Nv zzaTfg(N182MxnoW$FixzLr2c-^%eIEvjoB)pO3uEIXGrd|oE~l0 zbWU*I1%RF3x~0~HpO5Vvxj0=;EUTZ)e^)7@@69ZzrarKTdnWJquA+-dZ*G2w>*Su! z`g?o~2|6KmLP|WYw$}Q&y%)zP4hb$c7N><4bv5$wJJ29J_6ntq3ZY5^k%!3&gUKYX z3hs4F%p+6;e6u6-h>Bgw5@mBCG|%c zt@d%V0aCEr!C00;Nv_ZO9ZEAFoUseQCora7V5M@!bE(ahMYi}5i zJnPQBFE{Q1sB3+-GLphTWt)ELg7c1go1Mpv zZyO<^#?LGC|4-gFvPh@^NjZNgO@F=W|3xymroMAti4s36wp_p)Ur=!VrX`VTUqfE$ zwts6lKiA21rS<$bp#}1i>pGJ4A6fDjGyrE7G zi0*U~@>evWAl-!W^uz^U~A?*VFqfq|nD#&$tQtlfRO734n;y(%{E62ag zO)63Eb)4zKo~wHKeMp9tihL7ZPezW-WtTuLMY2%S)eOp)36TR~$ogI7H~xHm(mOq2 zvUz#p)C8N&Wln<+FHP$+a>#pO!x8c+!|inG18JWjb1FxIOxU}>`4DiHFCjEY5V3k)y!T9-^C z!NFF=w+A6TLX8kU$7&`iMohPt$(N>6@_YRAZe&#Il_W2CS(aTaw*(-E1Blksx#Qq$ zE5x+Se$(IUj#8Qe(bqs#qL<=OXv!EHbHKvj^-LCG%EF{ls^lU%)WOqN4XyOZUmb0Z z>hl;yV?s(S13OL|_b@OTrNL@51ra5#JkV5AB#%JI(`93iqI_pb=-<_ru0Bg}w$zuQ zN-iCOzf)77FVy2w`;m9mCiUea+JKQ5d9H(vZvA<%kWdo$jOtb>k=+2U*Gsi2b>Fmcxngwb=xi)x_}PPU)(9tMa^|ABzb-N#a_L#V}LnV)4H0 zHY+Yc_WRzH6$3}+_Pk)V7P>o9J>D5U-`qJsa+Fm{rNs$~6$!pW*YLT;*p8Pw)MiTh z7^y>y?1h6zS>HVS23ZlSAd%Qono~_Iy@#M@Fg-ez49qO{Jp2S%BY7p=(@RSw7g}yD z8SkB(m34=s&|tgN^1V7YYVE?|SqlWvVYl$8OOk_1Bj+I?i4^4il|j!071KdKF4l*V8&I zH+fg`JPTe8)EgpuO;eq$a3^m;I~5*F(bT#v;?XHjG}zLUwM z+>G}(#x*@3b@s)TIaYig&Op}$K#I@ZW|+(Dk`w8{uuy)T?lOzGB-xS7-H>Du&1r@E zCQ+(>K!kwvTq^)bNisvDOn9ym&PRLK$`1S@?@&&EOjpuYYfSD%NSKaV&pm{XF-LGF za=}`!^_p~Ebyric;SPaxzX3r`+EKX?~2Qg4$AC>E_PNxHc7u0 z)KmMikd%T5eTLA7fXCnFrI`u<*;WD!{V^Oxjym(YpJc(A)L);wUk)21G`fAX)*7(! zphbTwdF-)?$;cKCf?UL!b)P2=-pRkk;UE;jp{SrK=0RZwEJw(n&a zi#WpLtJY{+HnzmpF%n3cR7Rr9RJIWr$fOYuE2wS2cbUe@4cspeO0#@w!GlxowIb@R z?GvjV-l-Fwk3szXBZA~WYOezV%0LwN>*?u7vJgg5q^xWoYlpm}%mG_vXMBDnp+JVW>YoGi{!CETc#Ej8XThI1_nXV3P`ZBrMn& zFa$XO&D_I*T1ZdTP?IbIhtuRN$k-ZXD!LR-8r24TU9e#l?MC$GYxI%rF>K{%=eyOm zdytx6*`j!QhAY=9XbsSB6*_p^1=m*{=T3ai2p`)zE>ab$`|w)twGa>Whl%>mFGKwn zGm@su(Cim{N=(bN`cTZKo~oDf>9*e9TdCg4?uhAK@NSB$^IDUcaDtSfSwYr%L6mjk zdlx(UzwTqB)O)vCn!gCth5MOE`3xKi85+uOQX;d3~=Un-Px?O(y)SBxdVl! zSBWFNTV$fSsaox^df+<67T*8Jt(z|haIAKe^hHX&r2|@YnXvU+xW7l$`;d9u z)5D<*@OO*!&$^xVto*)q%}RQMU9-pDW?BL;#!ce!{ZEuK?e3Eg_Oo|7vK>ph9qsS= ze7h`e{_<-4j`MvBHD5Nv5O^lI*Oln(43eK~Smb0PvB>ZF7#*0>I9!J09W}bb<&tgk zRZhNm@riF1tVo5X^3b!SRd6VhA^L+oRX^z@A&rAaK9c;YO@b7b{~{uuKgZ}3DwBz#E`QytO`;Juem+L6|lwS!+ z&PBPU*cHjivnt8K*`M_+DYQhfcAAXS9*o0LAMK6;x@f?hN zvOnbVk3W1VIYZDKLdJf9SP&Az(~yz zKahIt=Ss)!o0`+X)UOPzU8S5ZCLn?u)%P=KbfouI?X=5u8A;=sg3%0zZk$Q>m#AoE{^5`?p+cqpo z8Mc&nX5y0uCI_udDBjap>yZYX6n&>oVV_d%u_R>|VMwWrY9>ig#VL3z?@xK+XrX-a zTxGtKw&hD@;1o!gDpuX*TIkYjFBd=TK$q&nzRdEGSNV8hpqRAV5dFm^ZS=HY3(Oa) zH~ZfQ8H`I3Z1YFIl#k}3utgzazHx0Oss8>hZFjS()%|NUBoeY((?5?#ii1z1_kF)p zT?C1o(C{Prko#&4Bkse+T0L|wz!#?Xd@`Vwt8mqm89DIo(!hv!hwOj+B^w;v36Z%fMcZQttE!l$S{ zK7eV+tRb5?F#w;UNEV+PjGw4ON`XOYY|!|!aKs0LqK2_?d2W)e?{QXRppJhEE?Quh ze`6qFL!c)nIVKc2T#Z!%{hP(eC#{Wq_c_KNfM;KJgbVDz!WNnZG&Z~P@|dL$5BgTY z$`D*Kq8#*}Th4#5w@bcU9XiKX&=LrG>J3+O0#tJ(x_=n-OqB~)Bt=7X2i=7wUSg?l zkL&Z;Tg|+OZCq3Iw)t@Ov(jM>D7?*-&%x*!AG2ikvTbTkbsh|hgzI?7A5Am9OmwWF z;$5!#`Wjm7`yFyayww|Z6v)!!=M~!jD>@2`I3#ZulHm1YeRHKc{4XiokUd5}8w6Rf zUt2H!K}X^KZN+;75(HVW-LTY$tR-)&6SCO72?>B~(76rDd9!!}V7;cnTx%&OL~^*n zUI0YYxwY1tbFl%CG{jq>?0=~B*EQ!&UBe0b1N2v#-3SH#0eVe`x$Y)N_Wq4-x}8g$ zkkp|Yp|_KX^X5!t$nLRQJ znwx56{{x$T?5_DgxAhOgGT_H%oLiuOVAGGiJGVgpz@{JDdTxRKflUzk>^2Xx|A9?E zl(<`Jg-mESjS|=Q8(m}573^m0?Ss=#!syT9J>dG5qifav3Htlap&w!>;Kxp+pCwrk zMBV(m!T(B}-(i)mt-H0gx>IU%KlrGa$n9uc9mmB$4!gF#`zsJpl4Z z1LT72Cu6yVE=KeNB`uCLPS{rL;?Tj0q37R zaKCL>`j0Hj&cy|J3i?-xqjF9&T$pbliK9>wmc2%Id>1TOZ4bNG4r_19Nc7t2!mO>CPqVIj5QycC6n3F2+ zU7sXB@3rg~Sv<2vNps)F5px5vTe-w0A4{4;@$7<$I$2Lzo#EIkLEg;7`*;I@F61!na)t)hz3;h8-0Y@*r>r#DcNR&m2^Mf@n@{k%~3l7w3^zUA&*-?^p!F1 zk`~D|Eb^l5UiJrXL?+X+6&Wnk3c*)l9oI(u{zMm5J3AdQxYVB5P(J zSyg(Dz)N=fiXm*iW!m1EvR5DDRW6-y7g^Ac&<$!Q!r$+~;gyp5n!i_RwT*4rV>%`} z9S2%{CB|5DDlnG(<`aJ>JsUmQrS6kE1MJiVyAf3WAly(8LAJtKeVQPspWFS z8|~wot(lyHPNSTWShbo!TNT3J;%IbieC6^cvRGTHghGpUBFB1SwY(S}5%yE_o{M(t z$8CKcDC5k*6M>OBxTX>g=i&@9F0`@I{c&7JhC<@rJrR{N)zjh&qi#!I>`(eQa^)3* z{DnwSZfY4Xj6Ud+>3A0s7&W}ea^{XH>u{ky3BEw7PjBO@HVPSVA#z5|rapSo+Cg_Y zRZfK%%=Sfil0&Z6dLErqezdlY2}>!h(|pBc3F-3qz0BYugC0iXsFzfvI3fvDaw0*Q zOV2ysUf@QvZJGIw7DdOK!|ZK+v~yVvd=J=Npk<#D_0!a&VF#L)&se&vBK`xx;*x|E zzSPvoo#hNO&2+=Sp7Q>PHE+_LuNbSL>bj$^adQ^RhP=LV;-JWQH(R`3hRpr6nA*D0%Qw~m@uSbk%RfXXYaZ7X z5yLri#+!`BG&al$x;ZN}Xscq1KX=)*TgNSOvAWpnj2Ec#)O#2hyN9)9#SRO`Lka5u zTpoGZxi4yI(W>96MCcN`pIIGyXc~NSAhL}I2YXfPYz19O^bqKs&#EB6%El5c=mZ^Me+5+WqD?n+^@yForzFS z->y?XoWsp$G;-}WE_^FpW**RL$lS&_Jue_Cx%Z^lmPmbg&VXhoeb=^*-)FsM!xE>R zoWw9jsan$wNE6Rg&!oN)U8x?d8%(~V6>qND2Am{ZBVd_jz?NT8TzVsnPe4DlW+0Lq z<=MJv>Oee($&qjm(G1>c%_rj3c4nN&m?g64_SZxP88aV>uKlPUwQ|R{NwgxC`NuBL z2`}$TMRQ4y%G$Nsym)(h%5t80m|e1stCVTP`8?`T_OqmKT@vmAtAvl~IWx1WyyT-p zLFu*J-)L#eKJZmarLHFoAt!|p%@Dewoup5;y;W3kGV2s#n>Owj3<_m>kwkWam9l$p zVAu)A@0*5-KsC)EUj&ByPMlI%zs};oGGCq#<{;?=bnO?XZ=mqabZ!clj<^n|)zpTe zaK+8bL6ffFF$W#D%;m{EfrQZuu4LyPdG@O6@3^W@{OW6fuuVh*5T{I@_$ zb!S_LN8i7lM>d5op9w=Jd%d|heo*mI&6cN4PBqcco>RZAw0C7BmdJ%ge``pAgq3>R zFn_^rxY$`j?P2g*;=a}gb`J}$h4>NTbhV<_#!p@sy5Q*)Eh(xoAxKu;!2y{|H$Po| zwpgnC0kde~?mJm~3`WpsHz#c*O0z4b(w%py52zeo#+M_MVIf~qz<3v<`XV-cw{N@W zmALHwLMm=u3Ch?d$kZ(+7hvcsCWhH%i3!j`54p6ZlgZ|a4i7=(GOr6s#ii(F5+uLJ zp9|fDk2UWX3&Y~l4P8OaI7GqB5Uuu+-)F^S^!rNpJb^Xh#Ebg^jTwFRupEPIZ{)s7 z11qqY#$!BC?nnjqX_r?z8b%bsN{O4a;YXMNhP83Ub+$4X&>yw>R^x~>f`AWmlpMdK z(cmj-v_FaLwM(*UVNENKDAz>i%L*dYsG?Q5XF80VR*r*h_^h7cgn$n=y#;bp8fzRj z3;>x8J`DGLqjf|pB@7PIk{7U+Od%SsE%)s7?zdKW!jD=g#wpo_T(8Rt;&^p$)uAl`tpEdC8>Z#4M#OkapxC>b2w7vV zCWk!4PQ`xV7BeA)oR`(lsMC9>W1pj*_`NPbFqf=pv7)^1SyyXdDly6YPK^w$ouCUU z@+=CFMQ$yqfr31ug;#Olm+L`56~&C3#H{0lF~W{~&^;>pP}0xZVKN#ypgj=jp_Xl$ zD@u%mI1KWmFW`RRj;xgYHhe)0wsl=RrD67en$|#AMxRkUh`Z)h#w+y5@3MzEkWqR> z_>CR4Y+nBE8ue*C78L=ysnim?Vn<>hzt#Jmv~o>FR(uCIMZXY-jh4WdP3a1t~lVBrPkfJvpNK`b9D29Sg+D%2pa930!T~Rc{st+J;+M4z! zmtKkCf+-O0@C;_n%CdsAE?`;%(mF5}*&yfGMsm`TSjkGc;S?;Cc4dKb1|+{x%M~Q9 z>h~;A47kov&Fr0lH2C7eE}rRo`JU8$G~7sV*k1WUs}k_Y`6iH%<-s4AixAaIQM zN=$4rqnrRWw}N#YgLS~Pw&xgQ$?086MN_L4 zij^q}g!h=}@$fJ;3djN``N|DUJ4cxp)09zW2?VjSDxPGDy>9g_C&0;hjb1sVi9qS3Kp@6BoYhZ&eUR1Mz_T ziK7(=T0$1NNcWxy?)t-0fITUea40orv_LQ;`%PrEFSS5e=3h~%4&*6>u`^#Q)VrI3A$$7VhgEW*6_}5W*Hr`6dz$p_0OHsy6Tx=_F16>bUp6$i>fI)MBLh^dR?@=ZAwRN^}uYhS|Ni*(B{%CzaECOK$ zYmQrRl*nzaUYn*pyZ(I4Qb@~l=qYm%4nZZf5V^zFJ)yV+T@frR+PV)!NNp)CP|A-w z#yWWsv&WbvpiwM0H}AcI$yGCe+o>FbGuFX%>9u_kcKKY4B(%bAs?Lh#}a- zyDG%cqbo<)aVC@RMLC98G1kahvkke9x?8PP6RIaa_oPZX{E*~3{W(dgs(^yCjSl-7 zvf+Wtw&$kP${6%6GqA4A@)qqFikU1!(&9K&nN0XJ_dTCr!du9QTVPWiXD;g}e=Z5# z`!b}Z+!$OfL186kV&gBkK2a|M$A1Z}NjA#PY@*2((;%&B>F(wKS;fSrup}VpVAD`0 zQK396#6e+*v>dwtwnB;~MDlHNa@^wd>xuq#N_;fU2WpQE;YXf=CF~3l7j_jTC~39E z3#VjC$H(TZ_Da_XYY=*KReRAkE%q9%-0i%RbtOV_zZJBB_p&%M3y+o0&hFI>wbJ79 zh{$Zt?PF=O34{v>r@h+mrm5WWj$J(52Tbp`HFjD!x(AxS>f$*rTO%G{)U9?-K<|O- zjWbfu^y{FTAV0;bXB@EmENfTvxt)Pl{A-aH8d6(r4I<+6p2uV7MB|4=A%v1 z5TrUFM6LosPS^l~Zq5DsOQrc);`vJ{gQzi(t-)7$cMyH`D(~(eiRVAbc2^P)L@>NA z@%(no#(yLp4sPy$EAi+$t<+#&oeBm+d`Rld2uF(G>j|z+eg%}Gc{P^@+~FI-WO9&; z43m82a=zoi%#SboY|@ba#=fB;sB(S~^xkS;+PFnZd+FgWOK+J82s zZ#OX5{9TCcz3u+spkv3UcwnMrp31Jx;2@W_$m*PP-#F1L+qm^3dv6Zoqhz!Vb33R{ zgBuZG0=hUeP0HwtyR*I$DV=amF7=Y|O$+*lE@rAGtQ znyGmi#UJ@ErVKJSmd?(Pt(7(!2td-w&Xhq6<95<6m%U?yyA9L(J6U#5juvdatEIU; zo_OO_kz^jitSGt~_*SJ)oiA`{yLk@?@bx(N7z8d)S!DAIG;$2M0^Adi>K9*-eCwus zpyNm{-AUs|{YJS*vZpO2d#K=p+iH>FP9@zFF_ign{B%uS(2iFH^OUi!=e~xI#gr{` zrKWZ~QDdsJX}5R5xJQ+G<(Y79RWI$EREb?U+s0V7Ip<6JHXd8Dtc1kyyUXDh@xSeaHBN2T{i*a%Tfy-6NVPma)}2|k4q;jTT8dkD-G3FvM`Pi z@H7LvN({=@9eT>P)X&s5DW$PaV>e*Xa>R=mJMy&baGcL7N&>1+sm;yx*LF3!X?yd< zTc&9JE*+m28QN(y8o#|iS6N`Uap16!6;OV7;&oh6(3_X;m-TqEMx&0^Br;BrIO}Nv z&vvieSd5>CYHUr9eBF!82m@i==`Y7jOR{fEWuq9w4n-@tCMXn~U)f;GEFk3w4w2zR z4XV_g#vSD8tIGh?m0ngkcSKX{$?*;x>K_!jdxk zIy||4Qq|1rtrwpe+&o{Rf_gb(7>$5I6_k*`9^BV0#+c33X%~&3;V6)pZdQK;@O=A# z8u6?lV;qOA*)TxPpI)?EDV(7*cU){RjJWKJ8B7H$p#OTNh)%KDMnsHr za7D9`o`29Ey$ZR;60M+lj_}O>8CEZJzNOh1KLYQE`j54oJ^(K!hsU*RHFIhoawGMg zP-z`8_cb8b*fdHFP8v-N!z?XJ?XmbGEmK#k7(Emva2e03{8FQS!Z<0vlCt?oZsOzm zl=a));+o7vozIHmE_>bY4pr*gaQl{h5?Td4v!+L32yBt&3Ln7E&K;}iRy{tS+;>0R z?;i5+atSxBPjXfAc(EC#dn{lN=8U8=pa%;+P8MVmcsOn|Ruy{b<$U0HVmjP76P#U7 z#~)XcS)==5&t2ce8nfO!U&%cBoc4Xpp_}eWvddd>U*$aPZ{OS&m?N3HKEAm0JnlWN z$QEyQveo2^?`v7emMv24Pg0aan%bViF^dDQdbI5UJ!@Xk%3yf$%Dfya%1UT;QixiV zddw{rqr$bqHz_pL;~Mg&zQG%~DPmTCCOLIX673%U-T9qLoa(9x`pMIk?z>wz}5OTCXL~=kswgxXUFbFy22raD4uuI<+N} ziSEm$t30yl{O9o?HgIqFSP`H6p_Cfhlykw?P$iWT{wx8-*vL4QFV1WzEP1Cpz~aPNz%}aW zfx~oZ&>)b)_5FIAq^yqS33g8P`{%0b{&lY1yi<#*Dxx(f&b&{HKCzTP{^%2gP360k zA@5XYB~2SM&#`Zg(Uhacl<*x6hQ=s6QmWJADnR8NwCbl<#oMtkPl^B?gj>JQS!WkaCTqhgviHBKSE(fxI^C>Sz%2~S{Evxe5nDt zS&Af_q;&rBT;FcWl+uuL!&6+OiJ^vyf`8NOJdHRUT-*X?f6}ocu^Nw7Cb%vm9xo7! zaF3B#fQo%q?;C%!!VC?rS;s@&HICNSNQuN{Gr=HP8W-{UqndE-^yu1P#L*q!LG2p31ZrMl4T+6i}>gUu-@K9^Q8!jb$d`iE+MOle?6%lobz)nD$(W82w^;n>A%FOuUwoH9Uh% zs38@#7L=0upBqD)3oZevJ1VF`FeA?V%4eYbhDL@mJQ(UV4-7)I30fwH*(4VuGwTr$ zyonIbQ)7gMgw9z1eIw9A!9IK;yk2(q?*PH5GuDfB2D%VY9c!JU_) zoeDwELR>MU2AI0j@SLPKgrKt(RD?bJ3?EX~EJ(e!F(npaxEHC&XKTsD%h2RkJ3=Ar zc6Xp6iSLg!SrFZjXfB+JJvQDJ>O(ah72Z$2tnXTj194&2K<064eS#!B^LyDP+g_rPbP(MnYVFJb@Yg9j?`hUG!eU)y+jaRZ}dnVGo7YcR!CY*KDC)J zrN}^iZUqTTGo-MyyB1^6~_2#*MJ1Ma}N9RmoevM^R9QlFgC??onL`?q`EVig4*C6^~H zno^S*^tWfDz~e5T^XbWg zdt}?xBlH`Kc@zmmuF7l2v`$c>1i2MNYD$5|E|MF#d@Er#hTSu2A_P3}GcL%BX{Xjt z9*H@OYnCHEC_pBgQ9pLBq6Z^ExKxOy|zv2E5U14QASUL^Us| zs85IrN>>*ZDR#CGAF)H1@+4~DJ6@^ykCKW&e=&Ap1T?fX1c}^bMG`teyhCX_A&hUi zU!mG1-#EiUz19;sMS45C`Nh}3h#*GqI8hzp2|I?5N)BLOQ6e+D!1bBphol`j0`*n5 zer)sl4+^9WeXvm{Pg~8GpZVNPr+eufFr}ZE)4Hd@yRXmoQS|u#cU`c|j4j-1K@G%*F~C_WpI{Z_u7F54i;BKk4C6 z+=@9Vo`DHR%y_msp;gd@5!gn>tV_l$^V%InPEABfJA8x{`|pR}bPpe)ZIbdHTznkDCst_^+#Wpd6?yUiXsd+NeJQ@g05F*) z+X+;RPL<6n!0pD8_;wmtR_wJM+JNTi<5Zr%53efsPX96@$_#DT-l?((cJ;%N_;Yw| zx*YP3T5H_J`pqE>3Bl0)p~w(c0UCc3ouMytQaTw4A(OGRg=j?IU*`^*X%<$&e&i~g z7tu7SRPr;mx@$wMpTRI?!rbrFU0%&jC{4>{WVm_EuJ_;!{ef(XR=P`%QyO`-rtyx3Z)NSLC%5N!WEtsE3XnEN~{s6Y<{yk zzZQ60>7id5>*(3S_#{`$TTtFhbmH^;E=N60$98zLf&!yE>YmnM>f3oJmd}dx5ZjqQ zm!5>~vb_y^3(=I;yE!p;_#N!6KI0ibDH>i0!Z-?~fr~Tw7RrW(-;^ANio8ur&Ua5v zMNQbTrwZ{Kp^p4OWLh|mWNOoMqnvbpV?{;Ja}9LhrrPWEzJR{6o)`Q92fgj4i4nnb z0fDDZY*U;h^_B_WQSV5t(QVwUC_%P7{=BgN|DB@r;0251UXIcR_vc-FvyPC+p#w%uL2+^8QzNhqd3I=n@n?) zvwlhj`qk0bWWVd3^hfNk1pI4{?A3{(za;=c(i;EP!~UH-1d(rmkkdKYA(@mwz^w^D zfE&+t1YA4ZkrTql|HTY;h_?E}42Zh*Z_M~1H2s(Eill!jbbqN-kVGU%tA5Et`X~A5 zN~QYi6v*FBuK(@4$iG!8z`s7bK1W^KZieH&H|OGadqwb5J`F~xxsx~}xd|hW$?YsO z2NH{*irB4XDOKf@iI0l4k`<|39MH6EVrjjd;TxV8c07jYtzaXiay%|ncr<-v?o`j` z);w-+6XfT0wci;y@TQ&$ej0@Dee%x9fiYE{w#1>QlZ9|R_uFfPoec=^owWmJs;3~9 z4@p%UbTHTASN@9K#ez2vR$i7TcGKo|kd$9^N#O?wCLL(r3!y&@3e?!rFymj zt>wgM&KmLmF!z>WS#I0=HqzbQ4N7-+r*wyOcXxM6H%N!HbO@5tNQZ=UgLJ=-uD$nK zOIZK4_VL>v-cKGLdOdSKH}lqU%`wI~q$zZFEwercoN%(=nSeQ_d}iwBt1v^{S|o?( zsrtSkYMf(#r6Jk)N-DJ?4)5+|jT6~)O~Z|+?@`6Qb2^sQ;hUn8?HA_;<2zIm{_;9RKxR(R1@LrmaLo-3*L?ir;>ZDfa4!HiFEyGe+JJ-Nl zixKP$IGpnISe*y=c)CyqI(x6*BSWRTwlSc%(Z&1KHGoOm8h{;r175ermWTEvuhrPA!8I-!9M6GApT0eO*T}^7;Wf>-o^b@1zOjl z;YxsoHV%-2F;er86=@7(a##-nFUL^dH;!a5fHy+3W+pUML1mh#jVkELL{$SZ2m>`eNFnh*^RR#92QlZ+>={K0hQiOXe--1^4V* ztIx6S>=`q`GU$kXT?Imn3tunTAPN^Z)j@-1dy()F{EpyMjZi}*w@CtuKt5-^Y@1>E zcq(az{z*uO6v^+B5fx1Z+U}-;XuOZ6qnGiFk=0|6I(WlxVP!s}v0_FrZyiCI&RVuw z(Zt&T@oo1WEEi<0R{$R}%E$Ndo{1lH6_6TudOn11se#~}H!Pb^yyhFvnkzFmwugah zqiJv`CYbKmyryTO>AQ$*2ud-q(%elQoHLc2ltEIWTTb`SB-_3?8OI;lxOi9uIW;D) zVDr7ro4bXgaBJtuIF5RIc9Fp4V_y21q#RKh-;_Qf26{akf+6h8%j51reyR>o+ z&DG5+9=P(T>m00Ao}O6b7zvgh$Trg_j$+Zx90BYC(%=?VeLdck$~R)bZ76u=vkQz) zT!PFWleLjAIicKVujI|)~5`w*=3-Sp~!SN-<)9#6K9=h$Z;ahfYcjyFgeXBqhPth!fTbvgdKyUX*r+HZp5Md)}+){qm)N z4F`-HfUd@U8hUV>$ItwNt2#8{lTOr4SyvmhkkSjg`e4vh)#-1DI2a=nb^UB<9`S`^ zWU=j@KAeq_NVib=UMw6i3L~SwlfAb|=b&G_2<7+oIggvoMWGrNPuwO?K7M0AH28Gj zkh5OwW$D-na^Xstz9B;tybr7t5Kn9FMGY@xW*%igGUKxC#^PT%v=|9&g zxng(3K2(+&N26$!5W3hPro?i7P}vet{{2;ium>3Famdhdv$MQJ)yP_PfP@?D2Kv!x zEaDuMG(QX$sF7lf&S8SCSf_w!-qv0jkbiv`R7giR{-{2%%*l;leyr2dy z)Y-^zCXNHv2xr&`i;s9s)+}30Ru-An4^N2l$`7qkKGU0t2x)TC`X8dM*1neGmgLRl zjT~=;eTf=lLjPr|KXPrX0L=((`v3(hp~W$gq8xU+#FZeKA)H1|LrGN4Qdvlfy0jSD z-q7}i)Sx{|SlSBbh;SUUaHcMBy+imkM{ZN21stfL2NgSx)g|hAL!}FkV6`{A(7UhW zM@W;iCdzRslISmqix3r2)th68K9oqG9uDydN~|*7xclzpqopL#Qo)Y-1vIbQ5vIzv zOH(`|01cqXCp;hb{)83(;Xm5{#gGa*(f=ls`Xhq+Qxx?pR2dL~J*k6c0^lD06@UC$ z`!srcs(pSy0>iHy<>%J@t5EkR>G=1@_#;eyvMwv&SwFkyUn0Nfw11UB{mB*nn|1$U z@CC!KwB+a3{juL?H~lN+_&M<(iq-%0Lt=aC3!Xl#-wWOUtbOVWo@oD&LjAM$sW14) z+MhAy?++RPRQ|0+;P<@gkJ9)*=1u>TEd3FZ{t=S&pW67J#r3~`=D$KxMh14qf0j6n zRJDp(=tX*<<$u(Bn+vp&p>{~CyV}?>C831_w{lUj4Ux@vOev`mLI*8zZ4dW-`F7|q zPU~dE`i&YzwDVGyo3ZoNpnFfM{$3(%$~tv8sMK*C)lAuAm2un6!h!pFG6C7zzVk;N zBkGQikwFa6J+V`J${q0R-#108gkHaH2zu~TtK_b4y8oba4}|h~7gs=fL4saXLf5sA z<*?9!0Q}C%eP+S2=5mk#l52`q0ThR$)0?JMKA`V)UfMaY>r9d2-2P3g^6CheQOchHKZ`5q7xQ^mEB77u)MFFx#sR z*A8!e0$y-SwoQ{0s5|N~EZ{KzNhGDcsVMNZvMDK=P42Pl)z_F5D5RsxJ0-z>!UJQk zOYlL%2)a|j@=f>R1#hHTgc?>$W)4S0=4u@j6TZd@-SmIIz2G+G2UkvhZ+h!j=P{i% zKue&s08|}6&g1CT#=;I}Ip}qDn{^jP`r*MGXlVED?NtL>v`|(qrGqi8^^9Q}J3yN22i>E=dbgM;qz-$Jd6HuZ zUTShbYTlqY+-ZW7>N*qpY3%T1&d_(9912Nj0dcpYfiP}bGeVcs8C1FQ7^)J;l;5hC zQRV%8BnX0-GVWV_1iRf#7;QS02MzSCcV}~&f&TsC?m>zeVNq^GWA+VHFFx%kmFQD9 zeTKIb&=H>rBj6Y9SHEv))%UVE=Ffz3>IlHz9}M{dX7^3>t8>hI_R@HZkNYf_qVwaI zFG+LhkjGuGdx@(@-svFr864T<_8au|-OBE0Nq4x}s!i9$la>?S>Riw!>8KIrty zz%9%E9m|219G1(<*8`-K`b!>`tZAkD{YW5Ku`D0X%K()?NdUl1MKof+P&pr!$W^TnmI zDs$VW^7v7+_lR|x(90WU4yI72c`&fL4K{G|Q&q?YV0a&>pv$r!=8ID=d;YH5(Uz8$ z&2*}p6YI70_4~t$0w2?uEDK!ky57N4W0(j~-)gdlmHVrU;g65!AT1XpEs+YqUyZ34 zD+^wD*pbMAd?cT@?r9`P+`#Y@0Rx&yqG(^YW0qxNh>rhk;Mw%R=^xkw)q5bHZmV(La>i&6=w0f(>;*2Zj%vXCZ7i6|bBo)7k^fVUV zu=k!`c1u^xPd$&L&Fz>{PjBEJb}t*2W1&zB14#t3Iz6x5ZaV~$GT{pbW49jP2J&!G z%vb3|P3IzM1>Kbkm@Y&cG=1-xlOdQcB~L6PZ*oMDl+G7LrY7?FB4|NG<&@)kO0UtV z@ant^a!wb;nm0XTP0K<_q1Pk~+Ad<+o zA6tx(wY>Dh8CeMjYn*6}f19133U47i>0z}jOwKO!_GX)rB2$9V2t`tlRFM&;9EMUT zO!X~)^UENu8|1uQMlx;0mr-bruMfhBX|SnYmUFz7O>{)13h@cl;haEVa(}>(e$R>XOVZ}T#{d|A(0dP4D>zgb;ONOB@Ew{n91}9VQ_e0fndc%`bCqYH}P*k zmXD8RtOA!J@`rZ}rH>uJ-{&&r#as{MMObGGJ2d2piZZ+03ZCQ&(Qir5%T5I7ge8nR zh0@28N2p`i(b$`42ddYkIH`;`W(VWqeGsC}Ees`>-w3tUo|O}Rbsw8@6KSfFkNYjK zg}7nxWr9euB76ib#aEGJO%X17s9C~^^Vb>Sv5;lj-;{(S{Kpp+?3l$0VmII9=cO~& z60@mC^5}_Rnwcf>P}!rN!^T!@8*_l_(e3VP%h@@Jq2Lq${+7v|I54d--q4(*+=}JAPNjm$&d^`F_VAn@nmEF&tQ;0#f^YT zNq_u4KZ5%wT2{bi_jAGhQ##~REeqf_^I7fFIQhxCEPv7d3xM$b?VefwqF*2I82(nv z3@96XcF#`@*podo{nht=-<-~WF3_KJ^8V-6 z{D)oniK$fh#h3rQg8%(9|7}<38QK1sU3sr66SL5d)CM!=Q=Eq?4x5g8ZkJKF7KNcs z*eM$uV1htXO;#tv%3-PSeZTUxvX9*G+x4OOPT*Q5<~il_-Knyf(KRFxs5N2cr0DaSym_qASLr!-g-qd>N-$UA$~2VKC>p1t=yV-u;)#QJMc@J+ z>ogCDwh19?t%wxzvxURz3BK1SS6RS45p^(1wocnu0^9`>g?g%qb=1NjVikI$Co|ms zE{E@eFA93)zc|XO_60{9YH71(IDKwceK?sIYC%Ta8pZTgp?Hi zF|$NVAM9t)7N@*nxa(y>&ZPTFy{MG3sYC^iT~|LYg|*fWkL4K6p@kL{b4J~B6I7eB zllZ2r#Ui&;N-MG!_BDiU#)9}+Hb#fKt|%!574W@Ka&`yOZ5`6e_fkfk!g5^b*Or>f z2o(*SegW}b9+bpy+DzbT4hW)TfygXiWdZs#Q+{(Fe39Zdq_?}>)(5RLAT?R_m+xWn z)@{FugcR!`1(-7N2P*epm(2>uy%v=04a^MkVuK^?O}vZ1WW)`qpve5hQB>R=+K<22 z?QbO>y`)*Q@QECOl3#3{|1%%T@+pccO)12S-a7ORbg9!gL3a_~@8!%OUsZ%}bK_{X zHHM;;+R@4DrL}mt!WfT32nP%XDHR6~uvP+B1X|z2Ffbi3H%`;}j#|jN=WmkPNbtaS z&Qvm+Z9s{KfG?)Ya}7w6h%}PZBXKKy)mrH!gNl=%BZ?DIo&w(}#~i5ubWfMlvezTl z7iY7-+La4cof0{|luOqcroTWIEB)lh7^5M%0giHG=%3@815;sUlp#NI*h_#&xYLq- z&B^;JezM&H56MJ`l)h&N*TH4iZM83~`zSX+JW9|TDM+tJWyQhHLy?S!D8J^E-{{RQ zU91#I%4@S`VHt~^eB{1JQMk|B`b|BQ&SGTQ!&TZzyK-N6JgtvRU%fC_kMMu+Cv1I- z$Jvgk8#eno-bGAj0$+<)#zsJVP=CtC`9(sFAlNyCLU1Bd7MD<9prUfsRF_YC?Wz~I z_a_$X3z(ONRlw3f+7S?{ix(X@#;aRry92P z0%I|lt7Z%1OU|KvP2X@W8)m5Mm#g@TTHW&vZ6Mz#z_ee3 z9bG<-_jYURoMqWrZ(9VuV*@K@WH+Qq4fhkS1cyFg>a=rQ7{7vUIlCil+{T1<>VeS% zWuAkpG>YD9dBsV>J>?Cgvq@t>uc&auSw5T#Qb{sl$)P6)U4g6BKx|HtA!juXyy_kf z9&~j@f||Wnm88&wmB@3**<6|zn3tKXDq3j7q-ygtc7E2CL4o?2OlEFSuC)= zYQM&Ua&fm?vxFQqEw7<*i%JvukuA<>WzhV!(f8J3Je~TZ9h)zCdg*TQiOby*m+z@; z)fUUQqHk(?dY1iN4@ot6nm>Jg$5XlvXBV>~Wa_kC>=N)ouf4b`-E|(q?HJ!FoK6N` zj=D;ib+`s9y%(j5Drz8wBi=ePtvm@;!sQ(;+p&_W0DJBQ`3a;P{d+HMZTspK+yP7 zrHW_19-D0v->j5Ik>si&SJN^?6Ay1Gfgu=$W(&WKbD!5lvZM?L(>utY(lSQ;-akIS?xbYEt=*O`sWOHoS2YvEkhJExl(}^)IHnl>D z5AQ+j-+^9@gKUc~^JYq1m@ zAF>$92Ok9rpYD|1T%rqk=?Ug1Pvp44m|kfk?wAg59*OPtnzzf zj=Abm6ikSPc$~0QLcNsG-4`z!8%MXsj=SX-Kzm*)JkNWAUzpSXr6>5`48vvs#GStc zwok^X{*?##1uqTo08gZUL3#gyU-`RLS^gq5@RJ$$d&u?Ns?2~&ndbuWr`WhB8)gE0 z{Ik+O`?qITeSVzr4+#0+eOKn^rHoI(aZfhj&1_Noe#^=L6UD1L5kUmrr89{57927#uAtZsNAHo@rLOV;U>{BxFRP3j9n z4PzJOOiriL-97uxRQJ@%_rJUZ9cwSyNl_w^FzTV_pFv*xD&AbcRz!}*eoyeR~Aq`|^zJX?h(SN&S! zjqIM?aOTOUN|!4<3mgWRMy}Hf%?CINSJ%C1$HRzowV9fsNh%Mm&X;}F_zNoN3tFrP zAh$A!qc;KxSbOksUJqMz*??p+uEV(U@NUd-Wp8npw+^k=1(h@}0|fZ%NUnX9+wUP= zHALux#m**R zMfDjcHmcOwQzxm2Xye^>>>2kMlmXNBfDD$|)1|Mrc#(uBLET3ficIktnu{SkUbNEl zY~t;`GJYUt^q+XsuvtHN*0&kp+_lw4Ko7gl1>6qt2pcmXTWnub&2y-kUfycjKcBjh zyGYQZ!+8BlVa`&7LX*>K-|8W^-1oG1fSS5Kv4p)oPMNE)StTTUQ1)BzS!%mwi!qvJ z-v=)2J=R+fWmIL3zISpPStXWUdNhpF)XHc%3Ler3(jP2G9&HM_JxMmkTcMXqMi(3^ zAZ!G)gJkIomlRr9R$d-CZ_$90yEHm@jKB$U*$2S5w5xSsaZnkC;mU2EmX^NIw6o;O zhkU6@I5EN>ozIdhjZl**|LR4m-CqAI_oz8AgI3A!mUl zKZ>ueAwbGe0h=zzj=exNqaok1CA!xmEJyZpE+9%?mpgdIqx2QI^wNjL*2R@TB}lx0 zFNqrS$uajCL6R=6>FbrZx@wS4Gz=JNR9L=nbX0yDgHZQgey;NGCVnV^YExzDc zoqGlKUTndnka8j3a`U2*4;0GKcXTGtk}Js8Tdf=fa_Vk=l<%%fo?6mq|dc@3m>Q zH!j%J`8M=5S^Vj*R;_(H6UxBhXmy#lFL_!y_L{>E`aJFBvmx-B4*j}^`j6tl8OqS= zc#@#Y%`BotWAOy4fE^VJGCr^Q;;JemC(nk+;G+ydKbnC&X9Oh4~sax{al$tyID*7!HFiFJCi#%itt2M4N>Q$}lGtH>A#~JK3Ukn%TZbSAuG=UvaWahU)}$?y*-lFX`R9 zKijg#7u4^grA-lBS*sK3Ok-zuu)IK+`~)L_q=qTniy5`$p*|pb*{B{jori2Lb;?c| zY3lE}T~A)F@u_&x6uHKEyT)R)8d^&`OPykVYZ^1tBsB4c#TpIU3MhTUetL785k9s2 zJBIBy1++YYM3E%3Jl9G*(hBJ^X&1%v5DPj|5mJtKnhm9-RScyW>TcBa;!Q~B6@HkN zR6zJ{)6uBLR4wrdWUJ0EWA60fagU9yXbMs}MDsPlB$P^aN6P4d2#^rdjXyq$_~qJA z$=!HCueShx^_h5-2ss`Jg7-=Wj-tJQUIzt%;vhiX4zRSC+UYH|XtGo$k6IQkF71#D zQ8K~WC@PE$%|aB$UyduQ+k;KDBjJi(OI2v>&2=(YnmIomnLj;I+15_(S9_aBske*T ztbS?b9xIscmHW;246Aba48{f}K-+>&On>A1ROmjvqn7;y&Z^zjtg^g&7bdB038kyP zo`T@qxqSweUs|^?H%{mY_bzMJUVCaY{;4%o~crfX=99vaK_Ivd*_IfD{D@~Rnmu*d33y}jKUW=*9w}yZq2hO4^kSH^|nBGOQt1+O)7ok%YF($ z{!UJRLzddRZx{!;M=E1snbew*#YF*v@g+S?My4u-GH`V)uS7gV2a9@OfDDE4V6$RU zb5t}2;!Din`sCbC+uvxbw6HQ69?kpTo2XE}=c`5A#k>E=V{*0(w`k{Q555yFv-`f! ztya{7dO>Rx#vjSfzLs~f%CwIU<(3E2XHHaF` z5jW#^;X|FMPSL%L>OXIMvlq1$J1KC0P>xv>_Mojt%g;*8-4;XV>DkVVTYrJiojg?n zDs^&$28-dL$Sf^z56n#dlF6^`gPiecV=vnfIeVea5cWbAoj^pO;LcO=FdNWIq7jAb?Fm3wBDRM1K=lQesK*bs^;hPGaC=PV zsCf{2j%jRhkymuYeXdg(N?Dljzd#batB zJ+jhi*jgN`*3QloG?*-`9MznHZtp5taIi+6`<$q#`(8l2vqqLs8T;C0 z_fkOhKxlcj$;5%+QXYgs@J+_Jh>r5;sKT^yaEL9saW>X{YnBRw^Q<>AFeE6X7ZfaF z%TY>|0gCAmun)G%wMWD~E zjqJrDWqlWY8lF4utGs(_{M3b230ny9nGnyJhBo%b<8Ab!M_8Z%3km3FeHtU6RQ!(t z{QtzK0rEJEKX0%96Q=z){A<8Kqd#p4U`H5#VuAlb>W1+t$@i)DN3i^i4PtzX@_nlP zi&O^VQjEh_*I`s}*D1m(|tUlzb+{Il98>6fSLG6M|hv)Vt0%+EgOAG+toe?B+Q zidg|9+-DblVj7=r`meOVB7OfyMv4iLR$~Sb&VSG~m|6aInAMLA(H~!%|5e(D3E-!H zd^R)SJpF_06XUO_;s4RoU;#X3Ccvp-0nl-n|DGcInl6+$P1!w$kKgYlh$U*-Tj%>cFw#~x84?p)vAEQK6y{H{We5;V(z-AVpiCV6` z7;?oc_f1k?kOuAThi^X1srNbJVG77N;FhW14zn^j95#n$b^--nOoT!5(}xnnOWnC9 z06?-ih4CMGWGQ^S>3loaj5#F;JF-D_4XPqf=Dazf-b7S-x~^1}?|kg5d+&T;(txVNV;i;A^h6gVqM=Ybob2Xd}@5BhIwqeOCww_kp>|Xp9Xs2U?~*vw zXZl!A+8%wb(jw2>jG8ocV}+&F9(|l)H)+HGB$T=$)#sKjSftHkGgDb4lla3-%82N;V%ncu*n^j z)(^e#7`UdCG{VH@edC%H(X1wqQffK3U)I`_mj!BqV~PGpIbll<`dSmN=qA zK)$>?n=pq!PDtQfqLpxq089)zsdEbJgc&q(bL6N4oxD$D$}TXQH`7gF=j0?8PzBqX zj(Ke!i)Fm3Wd#zq642^O`(4EYHkYwoesbztuqq<0osqGEuW}j8ZA7VTo!{H7X`8WC z%<393Ap(2|aR;~9SA8>+u|bOkG>R(KWu+PEhjPVqDc_B@hr?1am(Zq(bS$)q-b#Nv zp7e`hRMtQ*BT*@acT|K!Fl^--!=`>^h`~x))TXG+i-JVEd;MMGs-!r*Ip#8)y0J(G zv^V>L`WzWLC6PXGvGla5Kg%M0W=s4dTO9kI!GnBes3N(}l?2>(J)(Y%S8<}ykzZS_ zAt&6$rb_BHK#y+^!#`yE1duMqcHd^dilF1Mj!(;jw{nR<_Co}%v#Ko@o~plXXIH!3 zFR;L+YTEt~P=Vf5rZ<)5j|mr*P}f3!-wYky)nP~}YJj#f4V1YEdZCqj(xzh~HElWb!MLwGJ!J=N-Yw>AXO1qpar6nN;>mid-#4?(`7fEmkQtvp1)4Htg?gzJ zr>7z|hURTwV5BR#szsSX4Wv;gncK!|MDQ>3m|}QBXrvH-AZ&w*$~coTMT+nYrfv!j zzU%m~R8BO4nK|0W^-0_Mdv}q_r0yQ5F9Vz1m*I2F4XqH?PU|!^ zC{Nqv)|*Wt8Em|*v-=~BVzp+QMzSujSft^n2QC+LS?q*PZ}1o-QQntf3c_xyQ6h+a zh)iFQ5GI({<*XubSg36r%@q)E)MG_4T#aO&bJ^>*f^>vu4#v)^tq~D|{kSKhA`pBY zUgvJrJ)^7{H`p4j3XkJ3i@%7g5AOfb*@*i6BBD7P&V730n^%n}j4&MxpsVrim^Lev z3@#*jG?Kz^Z<+#?dS6J()LoHAkNDt9T#jtCcr|lV}xELp$`V0~)?bvuMep~R|>D#XQ z#NHu_*2&m8Mm8UcY+So`;DVpA<_IU+LfcA~7Ea&&64ZiN+7np1!O&OC{Ui1oqx%#u zIZ}v0inWi$xRwDT(#MWt*(nM)e2fP^AljoetmhrqFVhzOSB~qyU>W`>cKc(&8zW%e z$Dg8EfCKqC*x{czuBW3Ip3wqWbPqj>GvJwJ7rPoDD+%kixC zsl$At{b5_4)&7HX^+Wfp_?KBIfPulk-2(h|mgqm3p&zc|Cs*@VSMdum^WUz5p6wsH z3QyGq>jiP-A6cT}5Vst3)?$a@HO@$aY935(pkKScBg7G!D zpgCwYEqh8+C5lrGx97VP$v~L<2z$!l_z#1GVP7G?F*^m&2YA)#xY>3)eO$V=-JdDT z+;Y!Cxb@gdPPVI) zB8VRM9{x}6MvKRb)L}3DgmpMQ-+>mq2V;gf8?yFN-jjNl;l(_d?H(I& z;n1f=Flq2eXOz{`+xk8PJo!A9O?hE5S2SK>J=aCg2f2;@apBW7={WO@iO|TP0&33d z$1^fk+1s}`q);1K`|Jg-NQv9Z3d_VOjgi$I@2^)ai-gF?Pu0=60_I+Sr61mGgxh?Z zY->GP2>f=+;GEs48E?-M^O`Un`#Z{!EAI*$MmsZJD27g5!R#weIYb)3;J#`7TvVGA zy1`J`>b^yGS*3YY_0-%I1c=k1o$pLr$(;-OX(#fmG8Qqdf*?Jclu=8jIdl8&@`l`l z>Fz5vhc7q^3@%59X$6f@z7-Cq3wFE~fY8|_w`-@%3y!rH269Y` zuIY;vTn^Vl-aEd0O%x;^&J4>N7p81EfMdsNyS!e&r*}mqTEf~3pMwD8Q zjQq%vh#xvIo;C#$_KpWnhz(}V5gEd$Vl%NSEw)L$H;&Aak9kZUMcEAH%gd!!N@ht^ zh1wis<%u>~Z2zOH9NwH3p$3Ue236oM>(`+-GcEHs4+Qi0weRNX^!*?vNh3L&Fvq(} zID~rk*tiDTtG$Lb+L(pBk{9kJM1Jbj-l*maKg`pyGxaAGm=8*=z_E~V-SxLfgf#+7mm<=xl8ih+Kt)#y=N|>ezS}9qSG}x>BRirVG>(3&i=s;jwS7x`NHbdQ|C$iG zBjDW%NESDt36&v+@u3Ux_uLT-=Pz$ok!4B6oi(DnX3wh)xiEN@&yNCyrmW)kdU>`& zkQ8{Xia*hUW@?bQm*|<3Xe`o#;~9fzMkwHUfT&NSYFJHW)cdMO;!UCSLR3!&jgK|~ zM&ghqU{9x+l!L_|8QbSp=Xb|`7}zMpw0ke;)&E*pXm>x^ZA%OnjFz+$9y*OypBIrf z;Dt+w*^r;v`<3$+{~N;5fpSA^sZuecDD*YD=)fr`%cu{;c1nne-SQChUC?2+0ieAf z*(W%U$U`H(oLSbTdc&7(qZrxKz8qE$%>-EKsS#Lz*!iY~9{xH{0PmiU> zKjf57UI+;Wr9#c`RCN>7TKtGN+f}N6n5$9qRp56Ooy%@9k%9+W5l;ltmNmZ_Te1j)p%I2o^M8XsZVe4wr3DrQ2pl#S+LU9)|$={0nN z#W@Lg?|mst>E7Cds#L2%jY#*IH5i;Jrus%gxXyPh@z`b(iKQHZa#=upDr*%qU`>@` zx@`F!`SSL+t)`OKqoBwbObl+sAtNQb*Bb}2W}>_l?8{SKqf z0u|PW24tsJ_D<*zh8!=2kktBx@p?=Yw^ z;b*ndqnmf)+n^ZPpsMKT=09N2^lWpYDanj$3Fo!!j1~t(Zt{fN@3!SLv^6H+54|x6 zoKnKtfgUjn(0@M`SCG6P*_n0*8}zs+F_2#PC6SYv4H20lNmRoqPN_sXFj;4|q-Y!q zIrX(JFb<>cU=#wWK5r7;XZQosCOuo`iScsoU8$E->|nH#I~U@1543i!JKgy)j|4!l zGLbgV$N9e?w*UVS=QICOg#?Iu0e9Yi1`e?SCWk#2%RMDwKh?4V;;U!1Ph-d@>#_o_ zy`R-SjUk_C|DvIW@fT9{kC^$X7EnI*?7B~r6i>APFZZ1G=k@oWea#asGoWMVS?yDA z@>C1>VLYpS>P?<%pNGjaK81HZeO63>^xCuQ{)2PH1gP12R{PYOJlXRP-SgsqaIl!3 z?|NbcWPE-#kWUu=OYJY&ub+9BXP(#ZOaH^>BSu1I0FjFkP|V59_P5PPzj>VB&l$iX z{btSnlXwAS4gZAA`cJOqheKldal(IfNI%J6zklSv9TFhH`Ooq$398yL3#{l~0Blx= zm>W`AZZSfs4GMF-jIX|5Zx8R#nLv`MW(iGGp_a+T%uy5RxseB>8E`*-#QHt^WtPX4 zH%s>Y86~Dk*{~U980 z070Xy%e_+8{iJXA)H5kHo)P_YeK+4|1wz0S{un<=i&{l@s}_NZ^K8u%y=HXwG7)Un zNss%@$C@HOV3iS*3}x8S4tMk`^)z~1j0o4WE^ppj#_TrTaly40yjt|~rXVM^h(&9a zzM1vfluIFA?bfnxnk?s|y?NRAZre3qdXRg=2qbuMMK~B%Z5_l{9I|Sr!1}!At6GiS zk`qjjdee6D6v)b$%i#Mq4c{NnA{dIA>D~)MfO1zqd~o~PZg2o!wjfnISU<+o-`3dQ0h&j=|e20qPq0_A5lcs`1->#o5WU`txqDnQPbep z*0>x???M>}-?0S1Tph1wq^6H0Cjir%4CCR$o8ti_}rFDc35`)rm1}7T#KytE{uC{%kptNG=G!$%>F3#n^f*k{tZeV4wi^RKedmp7cPwW?EWv#U+x1zqUjXoIb(d708d?#_}o4D(|lCbwH za#+KiZhp8Hc#?))?7a7VkncI)7{-08odT_}3i$GFiM5GkHZ*n-8Z1Y!HNr@`r7Zq> znngi>mzNx@!#K~zYNo6$luwUr;DHfz09#@>+_u3?xa z!d-)ki1)O)B%ESdO~d?&xuOBZ#)ILC9EU8ZROjAW6W9WJF`%CfW8y%5zm3VF%(-== z(m~`Q82^05v{ml7#aI_RB=+sV_z>|f3_dmGRVb~0zp`iYCZbtA%R+fu3=5j0SPFcL zCOtY75=IsWPxSPTvBv;{B~rk|E?%s(WNgJl5#&K$&r;)*Q!L9IS^ZhdyD2DAd<|tJPGuyc>Udz*^hb3c zk(af7&^))|t3iG){R@Yfb9fG9vboIXL5Q+B$KJ$nrQxkTxMl-P%{A33`+;A0HA5#o zii`O2a%Yd6&dUwJ`VsErRhmW8*+YN>s=;Q}CkKokv2>Ay>UeOv!g;QCPQPt=hYwPH z#!DY>2OP_d<(Kr}P{s)~K4e%G<~Q8Q7f zPcdZTh`D_`em(S2R0f*Ea8lqB9deE4k{?o{4#9E&g`#z^by&BDP_pI>9=s_rl8%*c zcN_SqX;Qh6;|4mAeFPjf$tK_p!sp8z&E!Xc=JqVFtyyDkRW5b*9Db($Az8&&^)a0O z?l3vq1ZRDQCsg@w^9{a;-_G&3AEpz#Xuz|0W0o9uk_%JOT7sx3O9%lTOB8>ApRIZDLN9=hV0 zrM=NfgSV)&vs>KflCKtmL<>kUo>*;A4klcmVBQ)lF6hE;aS5-L4C^6cT0m8ld=D9q z{4$2{w$03%%YPrF&F@Sn2jJGwbvFs0cWb|JQ2$qM?GJTufT}n^ThqT;rGVc78q9w} zN&z9*|A}?L_!OYV_!IN?PtrH6Pb26j+P`RYVtfivd%7;m^PFMErvSBQw9gN(Vgz81 ze~sLq?3oz=EPKvwJO!vdU6=WJ#scG0fZ8)!z<8`@*L`Zup6(gYoAj*qY1-(CmI(l~ zepdU`nmy6}&^<5y#hd+)%FBLKxH0_z9Q>G>&h+u6?UO)DxPrmP@B3z*JME1)POAwg?z zWNUBaU}Wv6_w&zfjA;!__3ZTw9F6Q9Xk~32jc6TB^&Dvp^lZ%>^#Iv@YeQN~8y6${ zmp@)qLP{Z1zy}-IGtnB`>scA;(b^gs1ODVkLiHb+JZ8Y?cSZnWgcQ9G z*6M_jDa2$1)@P0mgO3N4@Qsfat-{Jx_9s?jq;82%{`5g!by~LUtF6mfp6ojt`dwIC zy!*8qpBAiy8|QtrX_0GLUm$(dmS#G+Zr1WVaZZjXJ^jYDuY%Lbap|m4wkubvQn?zF z`(WJO&lz&~er4x$jl%U+X?ue9M8(7WW4o5;;)L}_8VugMX!4K1VgZ$e?4JH~K6d@d zFfYKUF=$~&zF5I-i+9J*Mc6mFYS4N!0FlB2b;_V#5!D-8Q>r0?vcmQT*$V8Bvv6F& zB|DQLSAM>gHao*j>rzd0I>rUHE1`#-6PTXNq&CM57Lp&lfHsb*kxEoyUqq9!B3Xpo z3~<}`VF^YtY2d(C%IH+2q6$!=hRL>J|-!wKdSMzz_`?SsOLm?asn3G)UejTH%?A3bImxjVmW2vR-@a zRIOPN`>=_n*o(&W!nPbHjER@iFs2$fAVF`4eP{-d)2R38RAc*w%S$@ccgNo5lDI&D zC9ahoTH-p1jdf}|VtKZ+RZ?`vIKz&l_L zN)1Fs6xa|fwA>az3Y+p(0Go@c(qzMTcY7N*A3QIhW~?-0#HqcS+6e^Xrd)t65!kC7 zUIq#fVF-ihg>B;j(jWO68bPO);hjsYCIc z_BC~)AQMV>NbI6BAg1+j+e!%j5TRl-3hCx{XR+x7I`+N?c1}n0cu?^)=k^r!ym-=F zl`BemBHkRHw^ZrABBChtENw9b+|1=fd!wS@KJJJQnQ1rP1D}NX18W$=Uv4Z+LzAE^ z_~j$?Tjlpel)~8C@~jr@Sj0f&kqWL8PvH?)OL$dw=?$XMP>Fq%8T#Uwj*Zv(Q9v@V zPSOO6qs*R6kdA~_b5`U{-HY>Cef$|pic6zk;tjYJ3L=@0dE~AR8E*R7onB5)r z5AD9=PDNeH5uC>rJ=%Do*m{II#mAP<62ND1b#`@a1}CGfW957XfgRIUcoeQ7Kt34P zPjh;n!rbe3OGw@fmlz>#fa)d0+ynu2T^+`Qk+3ogW7R`ldMpFqoCAz9neM9(Ep8U4 zTw~x8rG_ZR^xjxpEI<-r2{W>U(dVJc&bcb@l}>Qv2}wPg4GMXq+1CsvB94GFHIj^e zgp$><0ZuNe{RQ(NH$kx7oL~~PmkZ<%n#Ax;Sxgie0qfAqtp6W#ZyA;4x^@kNlypg# zAPo}UbW3+gcY`1x-6bL2-O}A5-3`*+E!`;s-;MiOd+i1IuC>Sed}F--{NePB>jdXK zVjkL!J0yH4y`>?iwz457FU!-~31UTT1MGgVlnaDroN&?L<}jQk^NqVv2qP^C=xFa0 z$%Pv_!U>Vol_Ju`#y94LFRB??jfW4`F(V7eelz*L2Qe{YHEJv99ytaPtV7{q8X!5n zox%*+udDezXD7CZ1cjBo?}zoMuK6N*=-Uq^o~;xO92Ag{ zP(G!g&4^k{Os(cBmK7OUd4aOC-F$>UE3h~+2`b~S+bc{$oGRkbqTMLiS9(7ig@cr3 zj2?`FGmRaRa^8yc+<)wN{B%r#l|$>Dp}-Ndaq_`I5Q_X1x6VQLCwgMa?159CpI0@V zSS@Zt(^6lBzni<(@xBYV=8{E~SBbM}KPXjZWb<{w*=E<_{J?_c-0VLjIzK&7O6-mM zp@EuxmetfOHYPZ!J`7b9bLBvZQxH*@Y_mckC#)_TF(f2bS3g9cIRUgul#jOAi*S%D zaou|&&hDdA%O}Pe`>!xnW{Ulzq+};!P2xw~#jdvmUEhUf?LtEEipV>m%XrOCkUl(j z{z*jSXtE_QTHN0_OFy8=7h63zRlsOnN!2iXE%Rx*NZ zc{Wzn%QqJ?TE&?6 zQdf4egT+lM`yNsiyu5cm(*32o1gOqpB{`tQ~FpCFVb4(EnikhYB1CQ=k`la zO|qWGhMX(UTvbA-pw~_o^#kn_yA@dGQP!nxbGcc;t}u>pN>ZIjl?J}!z1=C*IWA4X z{Y7R>F5ku_sAiS-kqAvD4ma#ubL%9CrQxo`yN=|w&Wpe{ov@dut(CAZ6D77yTBJ1=84G$-{p!k-roaK6azKFHL)xXnb0+Ja(gd zjAi^y!5J`j`A``?UKg16cuFa;JkAF_#{R}s;-MKGFwyuJ3v8-+a@_}%_9-mWZ<2)% zoD}X8oR8LJ_>CfcVDI)c_BYAG2ktIUVgbKNtUfkndA#S}D$>WcERVs=KymccML+gs z`7f~l;9)TU)6Gw=`wt%0@30SSEP+bnU+Vo|N&^@~dF1Q&@3h{%(g2zmK2GsH@ND@* zX)rR-{WGQEr8pZr`!A(|`Q`OXjA-6>7mcRzu-FW=LD!M!5I~{9R9l@^AAE9_L`b1( z+kit|QkTYJWiZf>`>t5=WIErD&|JxMqZ|(NR}8;(65|P$=W8?PJCSCE z(b2rvK`tl6PfC}G^c$S-3*&7H9UCs4&a}Dug0gXSlIQG?m78Pf5bB{)x&p>mozHCr zBo_w_pK*Pee??cp_RR1Qnd|P`m&8F9IrpZxpg;(Rc#ztFHv2N^LBo`d@=4O%c9M=b zKZv{Mf==lyFlBU>M$`OUy=j_<{X1%x#S8iaD&P*u-tU_nJ!io>b(QdXz%xpvUux6( zyge&i>`tAM-$U0^^>C>x)=$MAM<@vskXLMj{+xuX^>H~lFC2F>@91?20Yu`VGyZch zqfLL@jYfr`938S*QD!>pq2ABC%;>v|V9&nIoOR`)@9i_9klcb?Bc_<08UitjF zWq$++1>-UZ&UpG{_I|(!WEK{zPIU$vtL;?e^z1k9f)6YTZ36`uNy_Khte=PF{T&x8 zN!HJa)ML(-c-39rq9c5$GsnzRSl-q+lVEhOPXplf*@~nbx7RA$@fY_DMwQA7g??y{ zhQwr256KspWVjq6^vYOYif6DAc=bt4sVUC! zhytUbY(l(in9Nkh*M9Ain}~v`Sd}qQSiZ#FX&lU+chlDlr!OWF@-#1rPG2x}MAVLx zK{h@oGCUGAMd!H4aWzmN<80u9XL(Iib!={c2h@Xoo=10m&zoQQgr*x{(|0xThW_j{ z!X*}Q46`y@=LoIM$@}QOj!M-oB{!vBgTV=YJ|fr8L&cR{8^g@P>AfUq zKMC9jU5^?YC z$;ZhX5Lt3w=M*NLG&58X0{|e6e#RJ6)&BXPnxAM9W z{%%2`UeHF0<<5Zy3Bw0lY}tpx-@T3DMt`osH(UPG*R%s|&fXdAnxn&4Vc*~1QsEt) zn`hZu}y7DUlUiC~MqKqg>Wz3J~O;EeFU(|=!jzbV_ zLvD;Q3;C>+l9G<-8V=xSacom;3<-pMVuYQ3K3gGz4@V+Yevx4TZuB`rZz%sN5PROy z#dYv%c8$8EHTW|KzQB|MbUUl4ff;+us8CE2;z6N&U*F^iAgqIa!~c~n>h#G+b#Xf) zKYOIlKT-THhPGdcwq5WdVdWX&a-+5;eI5M#awL?iiIi||s-YU=$pi}Eft}a? z7DN3HPWs=nP{3oWulpjThb;8TQYye>udgStPsiK=bdO^0PhkHn4f;>!40!0!^-}dQ z_BX95fM3Q~e}*N2tn3La(D302l5$_@^nf`(#xgujtnTOh{XO>S(m(*v)};DP(ZzZo4X<3D3`iT7O2}#1;R3sV=)4?vs5ZtrSwBS z8RVE^RpZ+_n<&5*7ItD1RZ)^mRd5TPgv9$!c>!9ciIr(84003O2_kSPH{L^tBOY*2 z3y0?k{VFUaT~@`#Si4joN^N~t>84ByfidMQoti71*Uwy-K`3483nW)|dQ|476uWd2 zg?gB)Rf=*~S2j;9Y_+r{MY)KzM@}2;h9?H9#AVHm>UQ{!rSL3&>^x!O57XF}!-Q58(Cvp+ z+LF`e4q^oSA~hMG@ILOWaeZc!92EtSuw$pve0isrEBhlqk0!zyQKV=Q?~J*lF><=F zuf8|5cB9>H_$D5ue^+x8Ckb*Ux6qsq?Vy~cm^L>qljty17skVTRc`F)t7AA!jAiT9 zQknM3WUJJ%4bCflVmJrd&S*K}_gGW#Gt|eTN0DRi(Fkp2P<46ccTkDvXsAB=%Q_Rp zQ0X!EeCV(xJvj(vp2pjrmQIl?i5LfU;YsTk5*e0@AJA1!B;+!0u}|NH z|1rj;bJo$|ZGNI$tK}XWS4TO*NTY$PPfxwWvjbQx8%FB%oIom)oZ9z{e%f_%a4*kS zK1Tcmw}qyBh7_`_vpW-%gm%$O^&P)8l}h^Z2yELY4J=J}EC?(Z1r0O3N(&oCW9R+Q zm(sK<2+>>QmzsJrpu^VtFT^yuhv!n>NX!amHIWBE!qPAyz35|V0XmNxK@z@-~K#5i^o~UUB)Qd=fUxpoZT>nv^p!vZ?VwU0Od~E8r9294yM4 z#RG&vjP#u!z!G_o(&D>pywP+Ua@^KfZj{9!O8#+GOa7@UCA_6Z8F(2q3fBq7*D3Z~ z@vO`=5bmSV$pA)hE_@w;7mc;{fqxTTseH%qwh%MB6(yhGSIPtXTI2mZw%i0q7m=Fd z@1+x(xS+@Rrkrb7+zgNjH=z0eFCBgtMgGN@$ae|NS$z3EVuMM>H|o}o8?i=K;_FrG zqMn>2XWIP&_$ea?-*c|<7qQ*G7EzU`I3Y-&eaL6wGN>a&W2vF2uHFdTT0Yw7_maY- z5q5!fk>L1dboFU%uxJ~eOz>vjqdZKHZykIx$LICX2eW^}iO>XX$ev=uG2eUcS*qbj~=aMIU zivvO#qXzvn5d`+H{^$Sb|1S_hVByVwZV5hCBV;8&6TpA_yXEW>YT_Tx_bM?3x<^npE@ zG;qH5FER6HC=giE@z-kqKf-_a#PL_3{zKyUpaK7Xh$FBrhxMNkM`y*J@cR)T0FOIq zC;}d#a!B$QRW&TcLBwM8Fzi`d5e!hFqXPYlv z4lc^BvT9vVzV8E3MgXh;kIUZviSLcHr$z_kOu|fc#XIA(c*@RA8qnv+-y7c$WG5>x zl}qiOq;OG9*;LYbCFLm$}wT2S1`^rBQIm&AtI8bXRmfkt#T3a z4EMtDW_USEzGojFwh!dZn(!@;uMd^a0f$Yr$YPb4HbdM>FiFV0(4s6HKOsHWdU-M< z8#7tCJvCHT#ww?qsx(V~)>hAH(`k)##1ObD&_1lk&{HsM%kfG+7b>SZT7ny?a|#DB z(igv5zRl9M^D7Zu@-*p5Z*mch0L0f8mKeq1%dIsQ;eyq9R1;izu0T3G{^S|roIE=<62c5*c>*9Z1izQ263@?zhfnjZ~i4ERoXvo?Ac59gu=iE0(~o;>!XbMW_Bg{ zNz?Qm0gdS4iT0c2b-2Fv6%{Ll{U|OL{ah0se7!W2DhxlQBe}f(r9;UmXc1-)9uJS* ztN<>jsFhv#Lpoy6b$_)Q-wacLgF()Z8!jq*B}6X7U3ZRysC294AMGrSgVc)#;()aA zb(P~!L`_=YZ{c*z5g;l&iG+uIHW^W;b;_ufC9$SPfrkSG;*hrR32g5lJkmf&0UM%#-dh&=P9xs#H;)w&Vm&Z)Ii@8bJe2T8nPhG9l$ zgJa*lHIlonk1BScjhcZ^wdFYWG3Z;Up=$*$o|W~f0#178ta}ooER{1YtVH<_f?Z8= zRu`(4%Y{fhc!rYNJt*6@$*NKb8?0CX3p^#3K|$2mi@7LI8hSMHHSNeb?ajGdsdeZV z(+a*{fO9DmJAZmvs7EcnaB7<-YkhA7i1Kj^N;97dIHI!{wXert9u+=nYtAx}vfZ{4 z8Mjvbqyn2rPQk3lewfpgaF9nK50Ji|0(I!zrK79u;7@}F0rSTSm%(C+9phBLTn|h* z;zu9M?_>xtppcPMi|YHyQDK@Hz`vIMX*2{Rnbx+TqEE(4&C954mxziP;rq!q(sdEi z{Rr{uo6|4(hn*Rm0w{2~Dg~4HTj5yy&7XO6=d@bVf+KhqTHf`klD|cNy$|P2I01HE zVfKS=!zg<0#kAB$Ms0(|yPyT(SdXHUQdVY^G7t<|oq!Zek<|f#Oq}O+y-6o-Z1nGO zs}V7xk~4z1MNqmdV}wWHoO@L`NcP^Dy90SQp1ga`AcPc?h9Va=lILr{$Gs1KXhEK^4w)@zC6e8X zcID0pD<2h}g&ib-g978LZmkN|-@qVYI#7>YZV;YIQ|Mv%j?L^XqLtmR3YD(SBCRaDR`|oN|4|#NRCsQ8`Hb+*nE-!Fcrv(2`f3Fv?(USx=k4&Ik>p4e~lz_ikXz51+HlHQ^` z_-r_%)tYJk%rh|x4+lpqr0NI4&y6;IHLY?mym#Ir*uu&in=~fkA*O}V;e^G)a&L|D z;&VPKGtj?o-DpLr6lcFMrdGK@(mK0C+d;t}ZS!xKH@hzrymFyf6F}^gd|tD_IEb-z zYOO6MtXn)ZQXf~!cZd*=j(wvKnz=&r&>1Ds6&RKnRoS->$Gm`!(SWd!kcu}3p`FZ+2hdaCV zIzEy*=|0&fSBt)}*9(C{j($V=fwK5ZMgV`_ce#!s)$qLe_L}gDxCzXm;;(2{mR1Tr zcFdtg&GGR<8Xk2J9RgzVStkbz@e~z1uFnMdsQI7;GN4g3^nA)$bZ*FF6VJnjD zP7rm#C@S;TT(*uhdnkd#%#Fr}Y{VUEe8FT~ z7fWIvt$crYq$Sxl=kE60VjN^Mgb^(h@_*`Y6)Ashbo})vSpz9aj1o~_`DfCFm>>gk zd}vGlqRA@<@~^hLLRz2$-wNnX(mSn(jI3BGt!=Bh&TNHPd%#bYQE%%|{gU1Ls11mM zl-J5%-?CL|fUfP}y+y!V8{-jtzDa>hhb(|?+N{;#)X~->5IR6AfTB4&76Ms9Tsbz* zEEwKpq2ozr)ucPC8>Er>4VORd)u|k|dSadTC*h;eHq>2-7h540de^T4rT}g8DtcYy z*ujF@dfamR7+3*U7(d)K@ehaxV?VhDAd}wiXG_Mq9}PulNA!7hgvK+_8ZO=Svl~+a zq?(h6NAYOEU=EmH(*?I#gN4mryQ9tFop{C*-7bQ#ok7_=EupXTRp0+$-KR~Y0KjsNzu)uIjmrR_H|pPF znVz072`qa52iV_4pMMz}{Y8B|zN`B%@l&ejf&URuxjcb=x(fmDz|Y`G>~AF#um*#>Z0%HI`?|4V%R`OSa^ zx%X$fZ(aCJz4*W5{P)uBmuGr^n;g6U<%Re0^U!bV`5r-Mc^_M|zeyfhdUQ0c= zSpqn;N<~gob~PfEU)khz+fdQU<)Yo^HGH)at3P}%CoxPEyRY=vbfhTj*ajAF%q_t2TQMT(GZow3yff)CSgkWiFhUBC`6WEpO@}sn3N*PE7p%6q!3a2#aDRCZFKfzt zzae)GxE>*>M;-ZLh;ULNx;Vvpn-(uIp)VTmPJ9-BpaWFYJS{)^{B$(kS9G%|QBh~g zxo7rM+>H{Bv=pPF(q)QGS}meIF%Evvn%^c&dSvW(|aB**9iD~ zu9Lg@6Lrd>aI}6T)DRJ7b}3i;3m*kG9j2@^i*@rQxB0Pf^a%S!$)K61NnhlH+MU z0TM1A`e6f-SYpR34ye5ZWIR)CwQi(g+N$#F-WDR3s6uQnRi=b`s`%P7|0xDlSoV;L zX9*woQ;n;9Mp|WMqK8aK51kyDe7X#?od(0%!x+Yv?`rqX1E|?d>Jh~S8eLc_Vw2dr zCrxGX*>KMH>M>0lO81yCgI7C4*wxE z_x;2XxeM6~TPcgJR{o9I{JG04Yi=!@ar1;Jt!vEMPhs(dtbI%I7h~|a+l4lcywj0a zGtsYc%*A0m&53p1jo?GbIWTXIy9(6q)O(%Rs4(mAV6u(j`}DP(ze9lBKY{fS_}UBp z)ypLi6SY$-b!4-a>nxDSJ!{_yRvhGImeq4qa2wB0yCHLk#t7MH>`Lk5_HgU$7d3o6 zD>%IZ35w{(KRcFm_adz6FMBr_*S^Cbe&SefOe@xM*$gd05Ue`>aka&jD1e+&5y-QO z6;KxPeU&-x?XvX+c}`W|0VD=L$M`#QZ`;=&RvMu%#bpwKjTlN56fsX2>>hlda&s7 z^8_A##XLeeiN7I|a2J{$#4TFMX=t0b{_vgnvFUDAu2edrmqOn64m^;zi|W(f)Pr|4InSkc+wODH=O0xCPpa+H z)V^GeH4E$He6B{U;mgSYVwAB8wH20|U7#7Su`+l$E}C?N(|}dUnfX1bn!O6XV^Vud$?i``yT7*bF>&@Uxkw=*M3egh*(gm`{!PX?$*$s^*p)Ib?u# z5DD)LH_-LF!&RyK@OjYi%!NWJ+x-BB`Doc++*z}Fq`fh^`f74HTsO)h^E5NO zR}Sl2#zb5AMlSPPX_3Uh!Ap{Wg^$v*+9EQt1BV}3c(tGPWL%7JucCXuNu<#RNIxq) zv}NC2IXcQ+c381jf|>g9%5k?L=GMUqpPtQ3Q;wrYDh-)}yG?@TThkAm$!0uT4jnZj zyI6|~B+SOpiZp4smm{&6xy@aXSe#s_mvG=p(oQWgAm4^Vb5Su|t&nAkC?_uY zM*0fYX^ZO81?YZ^#q#e|9-fHQXSwPMg=P4yS3O{(hNoY|0=-_m(m!;n zAHL=+gyWFx10kVyXj0LsTknPD&lo6Hun&)1ptEolqJp8})HudzSZsmaf2W_Wx$bzk@y{J{a#m*?<1@F#l<) z^^dg2oBJ6dz>j)g_49`DZ>KHZ7eM{xL;sRM|JS#H+SX9~VtFEH#rO7$lqM17MtQ7g z>s^>9n)mhIXDu4BvSCkSu4|T*hOfwb&iod7rAsj(6hUpoBF^H0V7?=f2+YCR%I$SL z$r;y$mPWj6YQ%Wn6jph?y07BjVfR)V3*>eukE*Lua+uJj*+^xO3+H&4Nlc4U@>4|< z=ZO~Mav~S5AQAu6OA?B+ONPbW_~5okD+F%to^jW>yrsvf4Kt{9ay)m^uE2i$|m=sd4fz2e$JQ7=;D-YR= zOX=;rk~@x?e1FieJ)qQUnL5=jvr_9AE+BlTmf_(ry;^n2)}{rC@yap!yr5yO{?a4g zWmmoDqv@;Ti7C(Ygp>%IPGbtt3Q> zf@T(J_K$7zYF<)kcYQFlAP>j#bK&a2;xkZn|I#a&&r-Fr0-J$WLGa$47KPW=E-V(T z2uk>QBX#)f_&XpRo~H6BWrQI4R%~#S^<;VECqRj|Vk#3*^$^8p(QWa)2A%(5xpa+_*i=MmV#-P3l0K_X zx1Gwe7u{R&O$Woe1`KY$hFiS%P$gz@LCrn%1kJ}gtZVcOH(qJY`_{0_V_rCSYv&gSE-QO)3PSc_0exRT6_~j&i z1>hhgw2;o7UzWGyB*9I`X!jPR;Y991xC|X{8S3a#aEK1-2p^De)Esk(78u@ULZk9-JIFJ9l}U*=8Md)4W_Zc;}Ob`ZPUrWp-!L*xaA+?bk-T^n?}>F zS$x)O>IF$+e;XPY{+=8@xipR*)K;`sQp?*|Ww^rDwRQ+UL$D<!URW}TpL;@Smmp0};g6BwR6f54Ug}h!k7g2XI;r>xrS-BU({9NV**YxLp zG?zHB^|RhJ=HTn{Ob3u5$tBm}qB&MfhVy2B1NiS@dJ#*npk#aXJ;i|B0gH^ojy1`DT9@>Q8RUjR*=S_Il>tj^z2 z*gnz~bCa`)d5`3jh#8McHW4so)ra5emO8)SW;$&w#;ZGrc%{ymvkK7?V$!aV9AzDk zIl3P3>B`J}Y@N>$U}uauvzOpsa*(p@8gwC9@CKRDemp3GMf?IsbQNBI)9=z~&DnN) zkv2j*#QY#e32ns27alOJf4=@E3(&Osd25Mip&?dn)#fbf8;ec!yX&l8s0ejzGbYu$ zqTUVH$uyqtrKFk@sCM+33~hC<=RywV+b-Qe%3$L{o>mDD>~#KDRKkBEze`<)BTfx$F4k&piIA^z>iIN9zhv_hkA$|pM>@#^Z~Vd z0?G``RXz!Qz{ma@=wqeuaKmqYQ`_~xL+73WKZ5>7P(3uDc>;QW&ZiIiSSmbR_CNUV zUpgUv%>@4|@&2dK2VIj-ANFa@`oM4R;y9w zaSpl1-ZlEN5(zX!$IT*I>tbVybL8uxSBTHvF%-J9Im-myHl1YwpqS1Ckw{`@;QHN?~WtyFeh1ImOK8|wJI z5-K5?v~es=mapAI(yans(UTf*fLHM@8sE&cDWrTE75Erm3#OiDGn#fXaS^odKY_c6 z#z2F`-FS1gRHL*j5po@jfKHI35$vJMfxe*TQ!$P+l=nKwtYz%H!e*2MaJfr>?qpLk zH^*!t+M5r#Rq9v@`46dmfgOM3hJ`}n$!;;Ck$Pub$pPTIk2YEr;jhVA5 zeLz8&m&Nwaa(&CtkWJF*B~8c^l{YvLs{5{MNo-UlF+XePwG?D^yZa<4)^4}+4xR~i zhWY%dRvzD|vf$G9ZZ?JYL7&Gu@y*X;o$#ewvnf`lNrb-GnnjVag2^+U?ZcaqE7Nc& ze#jdEd$vae8%*Lj$tcM}k$}45o#><+V=h^^<)q&B0}iJ=(@=F!BNYm29#<3&L7koP zbP(jbzjhlit@X}kyuy$=GgK?p|4q2^iwJW@4yb>jXLQ|Mz_;S{NZRJUe6*(-QnUT zI23Vi<0u4PA2t*V9VXm#NMG$ay70njig|s*)6A#@ftn&<9mJ(~gj}Nd5UNNo@$O^n zOZ8IJ^BhR{@PW4>#y?jo>~{}@mZ8B3(RH3%q&uEj_|jJiH<|k)NzLP{t~97OzJTr% zrX+22M1ctQ#u;pqU5)KBb6FuoH3~<}!gq{Zd)8fv6GM!u9IYu$5C&~#-_~}B(I56k zkHT0Y(pQsSNEDaAT-qOn)c|2jH3Yy1_04fhrWrI!Fi(cWf|~%GTLzJhKjgF&aA)js zSYsy1IF&|RQ-F|l%DXZVWsvVAYm|YIP4fH;Fi`G*{Qep15lJ~~m6v;8NW3^Iu|nQU zhnHgQ{AOHBWYAT`);D zGhr$uUlx)j-#$vph23L&R#S}+nY|~M>U|0cg+^meTSeyq={&WaBu#Uxnn}6G=^kk$ zRXDXvXEl&-WPdc|9ADXowb8|9GMhsn)Cr-BxQARk$mfOwXfh z@>OZ4+2ER)@tT=Q1*|T1!|0B{w~!QWHL|O^wxjhb%9}L`h-eXXso+>gYj|zPmQ`|Z zj&;R!;nI(qcegtLt+pfPI_@#7Y(rz}s@&JnGU$mI%GiOR9qhPWvp6$0-~C^7IXg5I z!6VMud}H$=66&53BmZg~=*{S@zQBTKfm?)Zn+zL?Y+=KGXu+E4q0o@C5p7PpCsb}|ICmhS>INOk*%G(R)f8`QJZ|z99=`r z=~WH_r5!{jXrk-N%=h6d;!s7hqf8;MA(zwr8_T_QQ|bjoyKU>vGV-o;VssadXQ#9U ziRS_zXYCc6Ci7+9pS4q&MUF8 z@W!aBgy>Tr=1>pL=iY|l8g5&{biHdC3;s4MWT}I%UBh_5%yxqDiX1FXnA8?Ig(Lic zo;ZlQ5Iow5y7&b}GMOjHw$y;V?}n-Dtu;IOl2gku%TapYwyi=dn~t9_eJ--CDLy6vZw&Ah__K~tJsds@FdFmCx@(J#Q7q`y=s0gHWDf3d*- zF?U1ok&Ay^jrEp1?jmLmeeCb@1ok&YRlgq9 zU&O{^EF-Ys=P5x49M*{$-ryO|F9^6v}0sqhCW?%s4-Eq77( zywT)mO*q&;cvjWfiik+4`r!wYX8hpj%{<0IA%Tc0Caf4?_ z(q^c|3HOsj0<*t^2%lqWVUcrgu>sJcPs4(bsd-2R*FWQX&HEe!|LQGGN3LJ*b@gm+ zT4do27oa95#D7bnYCRmSEUI9v|MGgnWkfmTCmj+6LhK#qPb6YfI`N5Yav5>| zbwM18rD|)^(Gt;^RqyJ{({huF*^Qq8T~+I8Vc*I*T}h?ih9!X|!N02HBA6+Aw=3hD zL5bujPj{kL>66uJr;v-P+MMvQK%+FNWzEYfSdBY!{GE13*}`65q4Cr^1^M|}y_~o+ z?OQ`1h~?ndz50DjXMTGKeL>~VsoHQ;diSb|J-!(>D8j##EsS%WD4a=s=ERcUF+D%k09UR)O@K+EYUu7S;{V(cZOnU8PD^(j zc6J*6MvmYd=EFSaWmRM*#?PjoEm1Sa68gC`MQ@7HL}(~D$cO?_Wos6RheBV54x~F; zA2Dm}^fb+oKmhZDEp@{A%TM_$&*IXAvMSRVN1dSGb33Yh${Q5wnNhZ)$=G!~ftRZDG^J#1AYE{1O zc~G_2B-upCWu_kLU@ng%~uldWOj-7RSbB^(ErIp!D~WSB`6jA^104X^*4D8Wq%GraOO zk4qjLUm2Gq){39AEq))-(GvxC-4;YHF?P*19{;ecsz49HKI!G)4jXRCvtTV*P5?6Y z4o!6M9j-T$#kp3c{Bf5{?`p79|C%XtRe`afxxRn{HRG8iH(RY9W(XBSU*klrn#mT< zn`1GTcS7UhBi#wMWd&Muwjsd7#uHi-he2^BSEN>$PS0!E3TDW*eBSgc@RhGMNuTphNE7L8sH2 zIIqN(n@VEcg&$?7Im-=EKwTn;`B7kXob-m+LH+WYV zVv(&bv&~t$4KB#KZcA%zJ)9lEJCd-$^hj-nFL%3dh!Ra-!$z>pPu%E@n*w_3J(tz? zh`l{|_kE!I12_0*@?kz`Pp4I#4@Q+WiDbssj|CLl7hj7gF$I#9L%7Qozh4*S!x;La zI7_8H9CmC^`kWg(80>AvaibXs4RnXdNM@DHyA3I(?v+-{knh{I9vE^W0^LRaNCNJV zf>pj9ALM<*n?ssah$JE9-LDUalS>3ghoqe(2#}TqIdGJ*wmk`gTly$TAyi_0(_Ft_ z?&~&O?k$OKIXVUU5@?Ccl{Ph7M(+ecRHn(+g4P8 zsmFwHSh}0S7z?7Ba_XR^L><`@L=T^p%LC7)6%^et(U`kAF3(3W8}lOLAUJ2PtJ? zf^fs)R4Vg@*LluR$k5&k99eRd7-t6wKQypa#dW_yK|TiV`Fa=+PLTMI5L7aH7Dyw8 z#*ohqFo|oaic-%)dUVxozm_+YmEXE;JG8uoF$!LQ{kV~!vXZF>Tgyf2T=6yLWVMkv zE3N0o*>fy=_oT~>Gn9HOD*bSjd|7wCua3ss9&|4G!b}>YSEB@^4q1ZJu^0-U@DP&+ zY;T@8@9cKHxs(iJ>;1<`Bh>hx$F-AbEFrZTsvmbC*mN~L)#$y7tnFfL*f9L8FVKW5 zs_F`oA$s8CqG6H|OMz3kUrIUW*9+ztx^zYZLK3*dHxC;ueM=~VG+>Gg6T@v z?ATwn=Qka8EPQG6(;|Y5HAp2H!bJv8%mXSZ;7$#c%ttW7xxv>VFe~Y2mY_7z%Jjsh zNS+$)C=|xqV#NTyA~*REj9OfvljIKIS=Tc)MVH(Ts)v^qciD3=pLI*x^;k}<* zn;ryyF~U;wB`DoQv^HilVEdgfG&iaba-hB&XBg(fjQ~hW1D0AuaFsx^+;9}tX?Y@I zWrc(QLD|;(8NNy1b0YQu8RImHQJ?irbDhy{!#$jAw`5sL9;#0%t-6sniv*j2Qq%@y zpGPp^k-R-pQA&O1V@xkT``CkzU3{#AQaaKS_bI_%_GH{y!0je!dC_qvIKN1!d$1A7 zJ!~WN{s<|p=?l@EH?e>yG-6^)=tY2ue}qY-pGTyOSq}5cSdd)0kK_0`Y|d&!$QV7< z+~|+)J4_J2$(KMoczrXyKfJktfBZ%882;b0NMiWaLi{KFybpKZN9_M9iJtV!WO(eZ z^cebdk2=F+bEQX6CZN)Lf^0K9_EvfXWdzdVC!vqCClAlc2uwsh3B4!f|L1FB{M}g} zse?xwW&oNXHt9nCpUU%uW@LQ~P9zs65LUQ`w#AXu3N;1ecvl}48aD~}giobgLsqWh#*SebG*ol{;RZd zx*+*sIphq?TF5~});0&DaA5y?R0UzGxaS4aE()OI*7IseH-uH0y(0z2Z;R&1^Pmym zVjGSC1lU#0BoK~*(jme{qsFFTUUrMxv&#+@_}z*bSSm)vb29K>UXzMcBz5Ex=6vBI zfkgCruA=_EspmZ0`TEC=1y8`{b8sFOodC7Q;3Q8k#-%O_UMWD7VS;HyQ&?ql=TLND zZ9liAQ!aw#4gGK$IW7c@Q|qG$9Y232$J4za9Rue zpSs2Zo{5d~zGaxyK5QW;Vj0=nVCO)xLE}j_+;woZgF8*bNtH_X)wEk(7i7|j>HOr@ z0&hA8Kg1T^E`i8`_#RV$nL|sFbBQZ^m;^TvZ29EpN-R#b;;E{X<|G%q!+X2PgELtI zqFmb{_W0N_oVDtqv$3Bh5Y!+!+2cMA-YkB zle+w`q_Og6&g|2XoKrffS22TqI9g@R2nNvnUF8{}Q!b zGAHIC4wkeUO_XupwRH#A3>lj`tNI~t5%_6@hQ6u2;_Utao$Y7*y7R9hqPHa4)WaYY zFP+>PwADLv32LH?T;jAA7m!^E6*nfc3dQ(VNe z@m0=4XZlu11CxVcE_TtT-aa5_T7DEn*@+SErj3 zUTESe95IM2tIb!FpnVDiXCKgromD~epY`nLVHa1rsen4Y0~4!sD2cRuIiDnOKt%5i z+7Ohi%}nXg=y0A-kPTYoiKtrIHVm*#sMs#;4> zMC6)foB&^(5QMvZbqi5mvMX@(o&7N{;wj*Uqy z%ks<0=zVl_U5DEw2{M)AH_YJ+-?AOvZku1UAStoU|5SAN|7iQ_xGJ}ySrm= zx`{cX zG&5fiA2&NXR!c9z;9G&`Q%^n~!|oWLu>%>irm(8;MNeSZZFY0v-98&EuP*xI;ai}= zu^$e&J_tE-Ca)(_9T0!yTI=Yzj(!Tbs{)wGiL6J5ONDGE;wVH9qYfC zu~I_s($L(J122R5?TgN{oN*m97j>5(rA88hR}ZX!e2tb~27@~6{r6H;Mk1b_!glv# zw+95u9EGHt+ld05+Vh?j?MJ|}*EwhM7L=8mFFm~|5%X_0w7+2%8l6Ut5q(OL7NW0)!j+w;Kt3&Ab%G|iYJPvY zFWmNIY+=P%*qNXsDYVEO*5ID2e+TSAq*9}?!#QnS%8QSqzmUctF=@ zkdBw&Mh_6;-i8G`{QnE=UGfUl8v}98cgd^UuwdtZ2y4Ct3vToP0Sih3NNWc7dH5ID zyX4hvaqp5>khQ!3&|~=Le7+5Pm;LHC>|OE-vL^=McXQ`I{r=vDy-Qx*hP^{xaf2?? zA>{^mJ1BT=+=>OOEd2}Y9rEgy0XqQjj!+13Z+Rbqw}k!+>>cuo8?w|J@LNIf54mwG z_73~it=K!{6*s7h6Jl=MC9iJ5f;Wajc+R(B?~+%y@Eq{YPzZ5v!`@-P;=T=ghy98h z)bkDLIp0u+LwxVwioL^rbu0ERc?BYl5Z8Q{yt)m0m%O?K3*M9h;rsn>^X^|oH~{dj zlz)M}%YJoR+`Hrz|qA+Grjd37uH4*S)u*gNDE0CH^v2tK|E!gIb2dxyNb zHSQhq>iR$e={bW74Ir%fHtZett6SsVC9fdYMu6a20|;xr4SScox($1myn>c*2>w+M}@Aocw1-Ui?1RsC_Va>N-K|lUS9t-NEg}CM$g?Y$(9pu^w5PSv( zgf-uWy~}=e8}<%)#Ra)01H4PU{Z{N9_N!a5cgU+-Os}r#z(0P!*ZBzf3%~|dAQTs+Ac7_`>Xt#Le<%R^>nCAP1Feo>t>bE@QedSC!sXcrS^x;7SuhgT* z(u336z3>4I-dhtcmq)ad(H1233@!eqz$)(JiZT7+} zc+Z-=Q69wO%~Z(BAU<_Pohu_SwEd~gI%i)R8QBl#uXH*`Cc0Oql?nU8_hSCO%^PGS zf(5os2U&ck`}O+obA}~b^=4V{M3(I0>R?X|@hGUEuSSH$x35S|waavfoqQLl&>Jnc zScAxfH-1*qZ*o&zJyGwEavZkB9g#Wit#R+OE>y4{y!SR=vE*CF*pMJWA(3OHk}QmQ zGAWarHz!1Npf#T~plQkPt3`?5D#u>#|h>v;tv?7K3hq%9?w8 zMGw~ck&tHdJ0EfE0Bsav&D>E}sRZLIv<5_k*4x+Y%hPZ-V+l!6FMv%bbt+=f-#$0s z>eZXQ3L+NLDG(1(kz`9t*JB`IEFvlY={_rxnNcFlORFQVvF)!yB9(0DNLh%;5Js%{ zqU1-+`DL$blc^=sR`Np%6~c}t6tsn=mnp@>Hahkt;wkGB3McQKh*i}i%}iE;YAfn4 zO!C4_`DBEt)sM$t8$BEapp8@)rodwPp)3jcrlGxl%OkhRkX$ZFX*%MDl^uwe#lp`* zQ5TR37hj}sWb$?|q;p4YZf?wQc`4s<7H{eGqYyf~*=5eKels6yiKQ}>*42s=vm*5mm?!uzAz?Ep&#ZX!}T!D=0c(iV3k7lF{9f;Kaf;Es^`hxi~D+C zMW6B&&x0fh)z>dsIhACG3#G?cDDM;2h{S35*`7S|AwzQD)p$!?*4Jo9#PTAxxm$_k zvGpZZ{JFK&LZtmCC1UZXmo zLWyF(;;S`E;<=m3?ewhh^n~kuiJ41`b~1fMWQz1AAdV*=|EkV2l<+Hlynvayrq{_RBQ@SvNbFFvz8ADppO6*blO@k|~cdh$O z-ATAx`AS_rlpL2A=^@iG*Ho^oRrb-a@Amb@>l(2zxA1`)N)lbYS4UVXaTC50Yu0-t zxW=z`UjJ#HIH8IE&2iA`$Ta2@&xS#&j{7F^*c4HGLlfQw{MRrwerfOH?*^%g?;noc z*Est82!XD$x7zRJ*N&PZq}VpNo~5aKYhR0aDYQDqej((K6Wh4%!I^q661ueNO}NsK z68Du_%EKw#Z)*0Ec`m~k+bo-(&8M@Yl%J0@Y{B`pjvOR?mmRUdKb?b)K_d}7hxr(a z_5td>R^u)wqg!cA%a65C;*SP2bAr)Lv3t+xisT(jk!0TL%2yC}yO(lwk+ya&SIMN5 zGP4GLWK*`9&0ext#6A)}-8<-=f8mY3EB=9v4dOK9s0IagK3^3lqV z?yFip^(K5iJcIev^UKfX0f#orOQf!eocJ!d0#0moR93||-%*tOhWvy6Z=As`51G zC-Q~gK>xNt-Ak@JU)@ITVS&1n+{1izGjW>3fIhU|5^Hgqu>iRb_v1+-v^?V@Sk8;8 z;>o#6URc|7AATy%Akz#!6%e4TEi!lG8)S#lr&u9_WSP+fB#((!4*63Z4B4Bv9%4&lfy1`t)8D; zP&}L>x)605z#DT3{$J@dZXLn!Z*>|#@Oy3G?|BG+)dJr#bO8uHzyJakWHS$m+k+1< zfPjVU0eWq;d4onlz(O9n00bXk0FJ$7=mHS@UK;`ya*r<%{9YRz3xur22ZGNpfPe*M z8l>k806Q0eV*!vQ^+51@Z3tM%HTi4h_CJ0{*ABxF*9>+p0FQe;R}mr>>|6kj+^ScxZ$GpSqeR{Aj9B?vKWNxj0ALp6d^zF=^=7jaqme4cF5>zZV>N z9WTyFpgp!3 zUVax`vBAOC4c->ydycymx_d}eaiJ5bJ@aSR&&m(r+(@`WOcP{u}RfN9_vCWGl>M<~6 zC_AtYMqFq9Ec=Md>BEc=B|XhU-{%pkkLzl6c&p&r9-IX^W6+4D_~lhNB)zg*onnpo zHStn3^(~g$NWR8M3{cuVqyFB<(wFtSOO2=5wI{BSc}T_Cvy?*+z{N(BWveJo-4e!uS@O`2F@TF;M+E(q_3{U0w31v`YHxjO z`u5ksS1ROwYTcB24l!@VotjhQYd=5gLv>DUBwE|kn+a_hI&1@EeVMs@Zf*aO>=Ff~ zoFqu-<%Zo`px9LF>3xGVYFR+u$3+U$#zEJ7X4khhh|v9FUV~`LWMib;dOi~8IU$df zu{7*e`WVq{-=iXz6c+Gdd-i44W$pNm$dM{fjxpmkqvUY~tfm+vRwgWC7<`4DAytR| zfM)dl?o4Goy4puqf})KTHv$)k-UlFj?3`P1 zVTnUjBlF3N;*~3-s4TWA;xl7T66!Y6T;vWo<&DMZ6F+Pgr&pEeN;o=M$_PlVrh$}d zDw7--Uy9%nKA3$|?!ehM4Lv@yL#If2@_{puD-m6fXN3y_eYInJ!3EHAsrSwKTVn*7JUB&lET`bQ_By%g0PCd1!0i}S76jiH{j=N$?#Z2KX7 z1SH!ni3%vLILL3%s>-Xg$K2!aF|+|>c@!tU52J%ZtULb7r0^rCf+r9md?6sG2A)lh z@BaJ&(v;f+UHva>rHz~6BTt3Ve8RGkwUnQUE(~BUS`3#AhHWp)&n8Af`-TnQIfv6dgdz*0}QrYq(CWrgU=4BUr^9#lnaU#ON=-~K3< zykCi=b%tcELgH?l!WHzBs?YXp`s6}2pj7omRb`mCY}rYZvEOM_u0d%cV#MWC0Bmn8mzpGi0Gp4Pd6=F<4PK+d8!|`phS6mHrdUcJhzq7VTkZ z;fnCZ4mZ#0o~<)lvifv%WJ?r(hGbg0=V__4P-bB~{Gg%LEKw7uYvib%2M4C3bIzmD z76|Mvv^F!m+)JZU$ZXZ$eN5G*-ZOrR8^q@I4YDQ!l7|;5A2I*JG6Q$n&Uj1W_AYQrYDaTxyYGV zLZs>F7R+9`t6_!i(7N1{da-xF{#;Pto-j$eMx7U#n4;IS!(fUPIF}e+tS4ear?lHK zuy(G>Av^T-ixQqxhxFB^FGqsOY_g_W>Wyp!8|(ySzr8=QqlJ>b=oagVM8owCz&?)guS@2C7?RrJ>na(&2It`_BRg* zOL{a;cRE)i5nVcelAG`atCg<|jZI(Yz<{elTwA_lK!%!6g^l%-yqb*}lGmEg22`{? z5LQF8JC~FdS^U#gJ>{{fr7prqjGoGS)P`jKDF>-_sT~uh4R= z<%aAu3;bPT{x6vXU1osC1>6=FtWFLAdrMq!K^{2vRw52*RKxXJZeihntB8Xu^1uWC zg~9&~dt>4Vs6hXpgY;i2^fx9H{8^R1rrzAw2eq5j`^M;nKdCq89j%z+v}7HZxpA*M zTJHt(DXX!-BH#0qb{%=@Y^`ehxkvyZ+0Tp?dy|5JX`mt_`1R5gnxgWzEQt1JbNfQg z@0yObf=`H5Y6VKQkRF^CU?}k6$}k4Hr)Gb(YN6af#1on2aq< zb35U$(YJ9VGQ_^~NQ!Rx(Tj=X*tcQU8dlIVVq8)W==+UIQYzEc;}geik6(ElO;Bo( zGSE!mopy&b^xyk|Q}QramQqkWh-XGJYD3s_f*!&0vAyo8XJj(S4@Vf+wjc!;2WN{E z$Pbv7HLYD_Y@9)S;Qqjg{~ZbE^WzCe&2;B&N{Nm@mTnB+3_W(YB?W=_vUKfpQoatd zxzQ;JIkDi^Y?n{0Uh%ww>3_OpQv`Hm^K z{l;hI4yn1wJvlrZ`NN5(a(3jxf-QFHnDXP8OJa=eFEn@TFEV*GRa?JH#I|fn$Y*LV z(~z}3oafmPBeT}JN6(Z6{c6i{YboGMcAu?KgU1wT(k+TdX0l~+{@cuUxI8bRX;qu3 zpUblA`eBWP-s^hMm3fQ;T4$!3Bv}JBFvL^UKqU6_t=-vj@hAKVVX%%rA~8GN`~poR zhMx-4pC~I2Q%(k=v&o2TufYlF{35yEVCfvGgFwNwEx7Fz#;LxEY~95COQ?3U_q-al zqwD^?8gDv6R|zUYm=x+DPW&FkuV|t%CUEn6+RQ-h)mV=KZgAm6w&Y(jM z=br3~UASQf3u}l9Je=Ix_feeQ<%Z(+C3WzlL7>uVH~4{;`&4;&)`kHCJ7aftTtYk5N>1FcIE@&*252t9EezE)LMWUb)m z>g%{9TaGpDg%4oYHJ3Tjk_wQX;Zr|yx3-V7F5Q!H5F}!;sMY^^IG3UHME>%Ma0#hU z?|sF&OU`Q(%4eTeXPXc`lU6&(!mv-HPTm$G9Q+&&{`JB;_&a;vi-ngT4YnMEw_wJ` z3yYw0=NRB}68&GZFN9E0>sl?_bXlh4${9a!+zNbyu}rPdb&|kZ#yW#VyB4%aNZ%Kh zGt`nX+6qV_iJ#@n=cJnFdV>G+tl`;oF~24ERq()I+Q+rz=y_TbWV;PSqxoaWls3F5v4X z$;ldfqic;fjG?#s5WG)zpN1uVuO#d^+WNAX&Ig~Cp!}#Px56Ah&PG&Q+Q>dVpf5zbDR0dizOpFGN(emIK1P*OE16r_DcIIZ+#_Mch7N=4K_E?h*YRx0kWhP zhK%0E*_`U~h?#2kzS$h?7>@ypcor|aS34gZaj{|aVZQi>ZQe(Oa^eB>erCfCLVt$?W8Z4PLSv zF^*eF#E|p(p*oMUoN}|`#Ewgb?*i)+Uq@5ve2lyfXgsu8XoOwU1)0QA7xYUc&n$dI zF5m++1oL_^V+s7PhzN>8Kq6Kw7p~W)%$b+?>K_vNV1XVj{HNw)Zp2;iNN?1%jc`h9 zpf%AyMq{(vVqr6R&b!&DKi77=&&xvJg_5{!7O~XvfD6rmW|3aX2sgsS6@bfJhAtY= z^R_9Y{S8L+dxj%Ad87Mtyy~V(G+7c#3^nP;^Qx_TEcEV8HTHpS``Qae0vebrpE@^q z`5K=J9z7CxFQ4vtwJ=?BZXqYzoT+{&$0s;VkC4Z{`l%&Wz)$Z`daXwFyBzdx@U{iU zYq-8N8D30GePDal!>#`9 z6U>V#&dKken=0P43O~*)dqtV3sm_-o@ZK1m&pT&f(mM7N zjR@$BP;dzoC3`~Biidkkrwyy6nr1r_<s#DyL$jh(f(SL zgpB>KQ~uwW8l*WB*Cpq_#l5AD53cElux60>2oelod zcK~3|`4;yfAh@ODIf**On;&R<`Z^3hi zytUC_R@|?T0KW%T+&lu@5c~gm1mI=A z{?)XyaWa2S&L(AJ>|`!!Zfb94{vS`AKdi%KLUXT&lu2QF<7K|IM9}d;dXLuRe)3&d zzS?D?gYfA$dL=IRg(#L#ZhMfc4V~Ce?~-$I6~fQFV(dOam`!#C#flm)-|4WndT(P% zanGz$(vV)}QAb$HWK(Coh>B5Y(Q`9HSbtH!YDV`4c`_%x_am(#Ybwzj>5|XAtCT9$ z_l<|uj0Nv!^sX)qG;Hz@W3O5~uX&!d?mqB3F8f8HB-`YQi1~r6kePy5Pz(7xvbh$z zcjiKx(?iE489XAac=p_dJHe}dv1A=9(o4P_RK}$4O5a}`%T(#HtH!K$1}qK(A`p2o zJwAR5wr;4`XKhu3qK1cBE23W@3mc#IQJFu{z;_*(0a@B?J?qAIoak#IZbcS5$9Y7| z5$;X(aVUN6aAh$%WRQ|9xO%#1{++Exo%AIw!tlpQe(K2ja9XniHn&^@eEd>;{f1{7 ze7kQQpXN~$Oh+gP$JxTLRWE+>4JWR)#(p}Yp~D)tuvtfcsB4=b7Gjk6w5!K*I`NBHL z2=TIuLdpqDyO1xQq2 zDL7xI*efEQ^&AGjRom;M=og8$%@~KqV(ksi8r)aw8%Ngp`6{wc`HHj9muwV@9A$Zr zzqr~HcbpuBoZ@HFH@;$GBc;Xnu-j=^^4cb^jZnyX8`XYpTMxVvhoPc5Q#)ELKoJLt zsy?<7%4G%g~5ULd^n;;m40N4>tJT8Sa?sC|V8ok~>q(K1rrawKXm*fvf`nw=S}QwV3_iIHaR zb(CQI>L=h5^>rY^O5v4reUT;suJLVmnpQstK zLtWo8A*M37xa$7yF@5_l4UCSVKnaZ$obn~FaRO>C^GyWy33rcTPD4ky4FbvUTm03* z>18<|8U^W%q>e(rZW(W@uhNOlwOu$grN_3`GW_I~6E!HV4C!X!g2{Z^5AP4eczP^| zU}uf|Bza0jT(yqooGjD7M#^MUmXdE@ev`@%QCydX@7`jwuzK%0Tyj4ZmSMDK63pCMmm0u=TY%ArL&)8^n922I>+G78*_;hq*b7jUQ=7LLo_JziphTNjNM@8;3}-$=nFZbG2peLV ziP2=nWnKEgzeqRN!tdQ1Ni#G+Z|?nd-dt#+lJ_U$Vc-)3 zhRT_a0TlVuJ>G@vwvIXIhjNl+9ZdtItgs8ag(u@YDXUArV4zN(vJgN%INX?E^)C+& z+~mI{@V^fZe>+6ns##)_0v$DgAiu#s>!1I|X$E*>xYYGY;6F}*?EZ&5ITcL##U$iXK`fMahNV|?9Edh_H1_IZJj=Tig0CrN^*} z#Hzu&1HrLew3Hy9;l! z>Kh{_{*bSZmv{NnUaPpOUC!n za42PJ8Ub4T}leBEe z7)1Qi5tgw_@P*;Zs)0i!@?hHkfb^nV`aZ?LyW-hgS+%?k)7141Qysy)hiUPF7v5*) z!eQZOh_YK5NhgT30R$xjo{@0h_j|pLt%|(8(g*R+q1RuKLl;DZU>@QKdC}1)4bu04 zO6#`uu+qMf?Wrr(Cy`#lO&Np2__;Bi&ja4i2MUantC5A#DfStu!2q zubV3C#F&nDMjNS0{0O7k?7tpA(PVuU20I>E^!d?Ob+}itxmUT^jftdtK8qb@J{p1q znHa=eQqs^)xEoLpaxpYRP2%D{^D7CNelUghfL3%@#;v_1i7@Jqt(?E= zkI{JE0K{kHIUi;0-Ue@eI>!w5i-3hr`fMGjPGbKe+ZJb6EoB^vi#15+b>Zi&Ru$mm zfpxp6LRXoy^(cf~fm|?HXU2y-< z+^Z0qo2OWZr@U8ZLx5+ia%euaffV`S#--nPCHDyiD6V`Q6$9KRtW(mUh?w!=qf8ht zAyH&0%`c~Ya82@(U&`$=wgAQK`E-s~qcdH8=Q#!af>plLgh!}8pK&#e((-JjxE%J7mC!E$>JmIg3+B!_k8G4~0S|Kw)lmm(&r>96pobWzQaZ3-_gc zNiE<1-H&|M66OJfDywS2_i|!5HH|xmrBkbW?dA9tujh~}$$SdlgmQAYls-Mipuukt zbeOY03ekgS@kNCWlEi=QH&LbNAB02uaPQn<@;#x^5NF$Cy)5Y|Mlk@&3KA3a=SL#M zsk}Q`Z^92TGc2~{98Xeo#bx-Dk|f}+8q)InlueMfubiC}E5;J2sochQ<7-niEd!i& zL^_MVB#aA}`(Czhf48YBrmgT4;2uA)!1!KKrX3}gStE&YdGTeNhNvCs8`;}ay9%zd zy-oa4VP5wM4taUpxcYRnP6X@Ii7|FWO^Y&O5RWy38=?FtN{o5ne?T?hYaz~VrtH>= zf%ysl$UV8uR?S9{5!;5HxsLX!?aDK@gcK2xPC7$a?nGlT*1&4EjFE@~lg4^?O17ZZ zPAV)khw>sy8wa<7!9+Upw~LM8`1FnUKm8ia3|C|tPFf#&Q&I5HCEWcDj?u|U1l-?n$i>ExY$)zL<}idAXl?B`H<+Rwgg6;B|+6380&X4{R6 z7B9b@m6c$oV!yN=2^t|mv7(5tjeSfyQ1^MqToK4JV9q|g^hRsXkaq6}i`U%avsLfe zB#%*k(pMeLMDnHM#oxDheon1HHh^mZ{qQl94c( zm+!4yX>7LhLrbutTwD$Ecjy6MtT@ptS7~)))2?`bI=fuT{-6cmxyL**(PY z_YEG!8f&&_9hK5(@GI2L444T0EPJCfWaRA5*Du~A;$f? zt`_3wy^R!ID>nXl(ICAF#K2(vo)8v&8}^!d{kOy^`CI19&3;|!{cC;z|J!zbN0~F| z+yJWia)NpaIC**hQRaNZGUB=$@_+Ob*X@v?ukSY}1TlARAkX!GrupCMDu@$u|L%6b z!3nuREb^}(?GH`};J%~SB2`OQX_goJMP%GBhul>PwFi?fsqZ(t$}QiilMiKcjtCD4 z=W?Y}(7aJ$9r|7|Zz^#AK6{r-VBGzx!PSd_?%v%u5$&42Q(NV~ zxJQSap(583o3GOSPH+4(ho0GLn!9X2u=X8NdBp(hB0p23plylA4`=u9{A6z)&(KXS zIz-U6!94UwZ>QJm{H%rabkaD=cl(f?UUms_C_1X|WALnVx&C?!h3GLXyS4HHde~=! z4jBwsT==X|cJgK#50{dW#z1S+SpZ72khuvtra5Z-X}^S6Kw=RmEa#&ITK&3~Q%5#8 zVyuDe1~RGdJ^mgYxmwP)nv7FL9%|zcO`CNzy33!Aa+kNr8 zu7s)Z2SrdnC?7_DnXnRDC=JvE+QK9SCKIC0lq;Jf>%iz9w8`meEPFgQ0W8?Sn2(dD zT&c0`OuQ|5v|Q+Ha@LcWCu@H!{8<3*ljWH`{0YHhXXn_jC6{!iBZAVfwmHw$9}5v4 zGiy~yM)gQ$zkGmt60{elb^fj2l%0Kfs~01<%y_n%h53`j zsL3!f)M5dB&QpT)^CVK4HGFaRL$gnde(@OmtlSHXigtBUirmE8wXBh#*Pf>Q@xnih zQD4G}FNanmyZuT3>l53VpEY|htfo|+P8}+0)F#-Th6Srzngt5?+hDv`hH^{kg;DniIly*b))@PY%aMh`+LRhJ7nixj2#&;48@*6nY_oZBINa#MliOJ9Gs;@ zlXDU!Pvi^ss3^p35x58s-xLq1dTsZ`m!ELRVV$=5?OAzoPIP^y;M}^FPqR$D?2u5U)9(0z<*|Xs8Y~7CBkk+7zwEWv4=YMpmOVuy--di)up8W< znhFv%Yv#RZu15Rjr?xU&hwi*$3&lODO3l`J6KO9{1&;t96+Val#4u+jsBxc}MuGmc z@m_!;T*6UTXvzzi2_H@MX*-XPjVFPNrMFT};en?;{C z@HEdQQO5^n@WYm|;Jt~Y6-+nmU;OE!%9tt~SfoFube7|JgCswgRXih-mO_V9jkIHP z_Ypc+d}|#vMo7>3s?t6dF*u4LzFKKa^~$YpzE?eCe$~6Kx@KjxNRI7mkyhm^pJ)sO z3(_FZs_)XFHI5iGT#M0`T=x=TEI-7BP;<(WE?Nl)rUIN%M+Qp}(wLTu#Eskqa!P#l zA8#K=6LGT+DE@->>?{3&SV{GgE6u=`JGmX}R2SWDTTTI4u!7Oc%oWKrr>|-X7|``F zxJ9Q+8ts>TdcX+orDXRdym4fg2(2qqj6>=YobbW{UCR|Qo7%Af9<1B6_(AucucMXl z)J$BvXQKY12OHV(mz2r9j_+y7Men{?Fc(7sY46DeV?091eZM&144^D=|CRoOmFKO8 z9p6HG<%AXfy-A)nNkX*5)?p8_m$}`nT0ugnSM&FvWQ`KhAyTnxjo)A21^<$Y-C6_t zU(hmcaJLii*De5Zy@?xqt_nDo3-UxwZje#jUmpdCrhsEPLA(zV(*Son0mt%yic%1< zU@Qe3d&|u;H|V4MHuzVw-X3)K|)c8YX-Y{hJXbLMImDUPCp<%=UYGT z-_sQ$765tLDmS>>3HX|?*9&pc;C3hA;JkMu`Uhg^f6bXc=pT?1aJQ1+nAXSVGrSlrAg%3CFmWLRG6gPcqHfGH zL0JuJ)v7h@^>*c`_Z$iy_1Yij2Vq22t5AjNT?C7N z`+|kON#cEpJ>ns}td3zIv1|9i2@`99l7NII?qC|E)_-n}nug$Z@Zgp9`9>nHsFqvS z6M-H)y@cuY#*a2oZ32<$ZEGf(*5MB&In)?LM0K(;P_@vy;1jld3&#hBC{ZW6L3+Mr zqnaV#4#OI4Dc_>!5*Z5bc=EH+f_CSc+wz-Ro7m(=l{L%0ZgCHyhdm6dD?M0YHO+U< zw)&XVj$ZcD;YGmaiZr19S;X8sq5Y%yi8`yIVgY9SKFd)v*P!p)*<128%CZh(wy&w4 z*_m>YCfW|W%te2rU=q~|^)7R@JW8SSQ$m}PUKb1Ea+!LwtZtfMdu%j;rWziFj02BH zijZ64>%>Yhd5Yb*5h1xeB%QpelcK2G>vf+t)@t3YJ93c1sk&EZSohkU zj)@51$Hn1RA{SCWDwFx~iIe*19@yK{bZ-oL*prG{!ipDd=#BJK4)VjknS3hKr`{7r zeBRHM`y#w6<2hkaDq0Qkxfd%rykFezj{oQZHm0hatM`mb!g{{#qWB}*H>>abn~xv9 z%c+qMi=uhle;|)A_~l~s@k%Am4>czgFY^7X@}PXO>gsnWTBb3JrYg1!j!};&v~$ng zQ8!`8MFvv&0|*e-q+S)$9CWX=nAS|49*|Q$^(8F0X#Fa-Rmb*B8ivS}EQKAfRW>wB z_D2AE+N#PZiQI-zW?=dy1}A>^o`o4&co z9P?ahT`sg)Ad+aIsMwtMX%v5c8NI8Q(Qq;NJfxz|UzP`LW<*KU&VAJa;#Z-+Ss zc`kNnY7d-U6O-28!F1r1s^i!2Mv(j<^PjXY|M}BFmJJ`TOMl^9d3i_s$%NA6+>pGq zen`;@+%gAk5!GakPu`!XLU#u>M=Rj zW5c@Ys3`nY+~Yjsz9gXSGkfm@JFL*&<(n;CXncxXn7M|nA#$(SWlvPR z+TlAb(HpJlLFbrEapMo#Y5j5Ec=&V7Xl2^y-I^Gh?8Ms&rfK=%|(XFPdd& zZ&fL3HFfJ;dfBR%awD5I7ZFF(+5(OC41vF5Oky}Z-YBLHDiYS))_KlmNw5DTf^xADmVBv z3GUx!S${3<@PIBpA@LV*b1QHxH%Lwh5ew$V2LTJ>8W6GI{1j}>z*|axH|#mCc@r3x z3v$WvdcNde`2u9@ZE?Z*DR^AS?ibev+5a3D^8GJ2xa$V^=e?cl{k`O<3@W4jF8lq5 zbAk95h+_Rs-1uji?V5A_Hto2{xo)^|{K2`n*m>{9xpG0H=2N7wy``5#^orcu%P6?I zT)(_|{Y5eqvuNbpHVq-X*Pt4o8Q$fy=GATs7mUFkA!gCzGLBDI$z2WW5%U%D%R2~o z^rbHO4`4dl@H^XoP=rwS9+_y9$osdG?g-CuP9cw0hDsp%YgiLbyxxiF-fFUv?BjtZ zY<5XVI6X5Xbe;J8<3pIOi(g8h!hMQ~*BFliF*$&9`7m{E^-S1 z+*RLdYkJ7>{MN*@(*0cn2wz5{i3Opn%Xl`fi z1xn4A$GqCV3iH07Ie24x2m9)t!YJw&G97DnZ|5`m{G7na7Ev;S(eG2O3}4Ny;kK*$ zaiB^&(o|0~VSam<)23=3a#G7b|Bc`r#?Kv!Reo9syQKmZV4)wPcnh9h(Dd zXP-~S1u1eKH<&xUKkB*PCvrDe9i+ znCv-}z$~j432O#TpXEHUn+j7G;G^S!ZITNzf2S~3T^yXgFE#y|nZ8^!4uh6S*09Z1 z>4How?k}=>BsvGaqO1k{D%PwAUc_#s){%h`y(W8JCyZnEn4G9}>wLm_RP$M+kDtCd znwyOE{80k6ykf)Ouwwqr;L%U$437r~7t$<|RsenRc=?0{tohJoH;-Qtb^?>mCg?lx zx!J-*PD4ovr~B_wq!;9aaliL_AxFy2?L|OI14L^mUMJ#hiT6nxFyO9EM@$lM*3K4P z2p?dkf3GVrT6Fh)RvYsIYLv&&BX6ARoI`S}Ub z<&hKxYX#@8u;+9JgxPq`IwKM*#zb8!!s>%U9O*i*=-mp$55sbJv!?;bDG%0k?B74T zztu&>MxOm~w9|#akp?GWp}MYCGEkG&EY8M~8L`-Yh-e0|7kY%8I$)Q>iFWEYV4j)t zt+9j#F;zQUPs%p9Cr4YoCmXBEft!7obK<~^nbx!_RGYQu6|3p^r2}(GuC*tc{A;|P zr7*M@fYD;6bkKS5Cl-gyZ#CjjB0p+XKG#@rWQqCm3Gjw11d%2mAg2ihUy%3RjoZig>5^VF=!8L^38mhS`st@EoU=cSs zZq0}(RSZtCIi1V+h)Sveo|9zw4?gEiy{MTQN~GtD635WTb+oWO{vbhUivQVanp)df zsdhMYA3-lC`lU);AmRWt&N*-XZ1g&cl4U@PLT7ZtEXwN_F?86GB0tR24w$o^g^UiR z3^a@>_!AGK=H$Z%D>T?%=&)~8{=CXFSD~x!cQIFUZcOLq1sVDc#5`i(?YG?CFKWn& z^tjS_Bs_w}`VpN*I7&81~bwAXeIYMIt)6EZis z;a~K>;U@o^LKe845%+I*q`#94h_+GO;C4n3u%HfLNJIhL&IkhbmKQd-oe?;e8zd@% z7#IA74fc7tZ@F#*AJYRK_gd8jF)nyP2`ug{mQ&on`xgFk%?BbzU|0a;u{GQ`osb}6 zA&cs`Z!}R~lPd7IkgcD%Z}=2J#BzaDY>=MS4eJ4j*lQd_@C`pQ5Hb1>nfq@sitF#i zs6Pu(*Tm?zslZKQbi*y+4`Rf@d&go_>3{WU_?a)rk)PG@%$+CXDnzxjAW7P5l4^%m zZ>r`N>&sQO3D@+8$%dK`XCjJntbE)5l*DDxyPI$@oq`UH&;0H{2NwI+!*&xfFU0H+ zM1rp8JQ*tWz3q{Pyt7OPZL41lln$oT4iaF?d+GBA=7XQ7*%eD5?ZyfQpO`#3s?(4_mJ*s<)S}1)sKFzro!_&+&p@U6D*96@T;a$QQ#?<<81^2S$Op_F zyKI4<0e)-?8Q6@0LkE&nCOmOyMJg$$cEf2kl1Ohgs<`2Tvjsa^2b?kh0b<^chC9kQ zNN-m=M)F6Tb!?=xsbW_gaFaWYlf^L7)g0HUQxsM`1ovRpX|s^)Rcw4Mw^@q1NkVYX z%LViG*||EJ(e!?L{76ojto?P)@ljvNVcykgzhYaK4C@STk5qF2%gu*Km~COE&-S1p zU)-=qo5?+2yeGxOi;>w-C+o1|b!s1HS*5VM`*YI>=azCs>;}?+AL5*diaXmdD=&wJ4{i?-R}YaOrGCz%jwjlmvd5h+nTCW!JNdxZp zcW{DN+V!gEZ{UuWkA0>H3%K%z(1Ed1@8N`-;&LA+KIe%Tj=v~kdiP_B@?%94+zw6x zyUV?ffC*Kr7VAKi!WT0}9aUtskC??XB$=TZ-n-!uSGf9y@P#5US>>R}3?U4oIJ2}8 zla_onAo%*utwpnoBXqSPAnlFKh>v>IExo6{l~JAlOd3^sKFj-nN%gZJJQmq8NOyNPBHay=(%s!94N_8) z0@5Mf-KBuiAt511cgnYLKl{G7vUqjB@#Fgi3phB>>s)hPYmS*?W~{sGbuB%mX>sG< zrK4yPI}2;3B6;iz*ZP?8D6!+uh6^3tw5poeYrn| z{@$7%=>5)dzu5WSF+B+Vy)``);JRPxe1BDd5+B$x-LG{1bLjnW-mfRj`p~Mswijzqh6bp})7L2cf^WCe{a@68Gnp-9O=np!a#fy%T;2`UlnoT;0j>OC2+?Tb=bG z=>6#My$wGE{R3+PWP^d3#Qlk7_fPmC=pR_qL(tz_)7@r)@A&uTbk|E5=*9m2;q(yn z2Y>l5RRpk~zZlzp!oth|(*AQ?`0rTo9sT)H&h#t&`K3Qr>2xHDadM8`q)$VX8bvzN$Wz6 zh-)3^;;4@9sp!Xv_uG9d-<%H3v#Pyc%VA%_Qe+~7zR(hZxeVU*MUI!HL|-%GsjxxD z3jqU-@e_FwWWdvqDkoq8Mj{PDJ_~nVZgY=;q4G6!F6w_UBbthL$K^HC7U};YC>&XU*@XH9C zAQzO+UI|=AKE=xcqbqKeYHBVU<=7)o{9Hrz?vOzqHr_1xTWh>3bO%Hz1{iB4`;(1$ z!;U8lX$BHG&l95KLng)76f~1kTVK6CP_OkK%YtU~O5W_AW^>OiaW1euvM7DE>R0|tDUFsY!*>k0au_iUi6fE~Mo}74(B(tmJ z{OGb64(Eg#VI=E|Sfbk6BzAO1^}UlC1vziHntCtMN@j!tbHz!{qSH9oqSl=hjnxyJ zYHE=Sl25uhW9iMGkKRfxq{J~UDMH>noiNH#wQ9_2NImoQD;{yD(Tc>3=0>kKHj!^f z+!*a{HKaKbKKY8G1{=ipPC)}#^NCKgFVlVmo1*pFjADGRR@Zs1 z`%+1=u-oEGVRb3BQaT-Wh!<9{&Re9JkJWP!mJ8HYh-)QKhsBM;?hVv$w~ozJ{E$th zN+Fka`fXoPLLKph)RwvhyJSeIP)yLyHYgW!Fsipmp*`v*fV$SoYEe}c8@K0=)SxDw zes}6;Cu-k`66sT1cc{TpH5vk@qy*kp;?VN`@;J>@NlRlwRMA$|1^iaN?k zgw07ksNJJ@{N%mcVie}aobM7wc;2U2XU|tEFyBylEg&z?`32Y7C6HM~8m4Q?m$?+J zlpRb46*uu;a-@ET=F8-dq3-aZlhdSE-zag2(&+ylqDr8T)0bcBvQYxdZVF}l4FA|; zB(l*|sQtP(V4p1X6mJ=?R|@RaB=aLP`Y*i*H3DCJ&}^)>KU z5oP?imqYaMAjCR!7H?hQBZVd5nUB{#3V5MGc1H_0@}h5XzLf7=BI#vvW_Af(@k}kr zrA0TnfMaj5$iEPSoLUG-y__}%sXbG5lNv5u^_Hn@E2}IK%Db$NeT4ex5rqxc;(`{x zvVocga$m=;8Kp{nQC=4BLH1(|0(eWh(6FickCNYD*CVCUkzTOEhz&tqGE4Dz(#@QR zl^Kyv_&>`xUu3iBX9{tTl*CiUc;PokRS=Af1S0Id=qx!^2hxcZ0Gd3Vvv07k)b2&m zJf8r9*RUh6gHb7!7$hR?oQ^B2lK5oGJu=Lay@(nPC30-kXd82|9LY6-G@LH!O0mXs zLBcWjm8wZFOGrP_=%*%S&STd|Lyl#grLcL#hak}d^|PIw0pIPHq@cK zTV^GNUu0+I^~{h$scZSm;MQ7iE1D%PoN-<5XFR4BlvSL@NlpOVMIn&D zOZ!sPSps&Ff|bZ7C%EG)rNOCj#6ueAKPu3m{`dm>hG45wIyli63WPQzD4r@V^r1zr=t4 zJy3Yh37Cxf+jZH1=O#FRs4RYCR}W(EQ-XVE^&s{S?1~N0FAIo0bN*6G1@vBc5PP3w z-rw^B>jDwU-^T(UV+yET|AY7FA?zR6)dM3?If01e@9+7)^>qK#P;&yBFaO@I9>U(I znt#6TpV$@f93LkjefRr4KZN~*=M~#S*gvr=;Bh}rAR_tuXY~;FPweU;?4Q^baA6$h z50(4xo*NHg|HQ5y!v2X}{dWw`Pxkyn)cCtSKZN}gyLt%w2X@5*Jm1X;L^OHNHdug* z2swd>ChuV%iuZ8-80z_(!(w^hK?xYS``erFLF_Ldgn!il-`n>;;D1&F4DiYBv~C?PCq{Tok@dt#zIDe=)e+hqa{vy--pYRt8z-#(5 zS!9X2mhBuDrVrB6ZM(R;VsW$7N-KE_ar&mrn43w3#JW($W_PJEWMX>tt&gBCnX*!x ztbewjGJf2ms}0}AzLfyC`;9KL*n07Rq!872j6m~Pnm7zmnzs~377kAb5IB75msayC zo*w~v&m^a5Q{ zeqcC6>cBwH>guqDCWQ23=f)-Za@9(eM<`Y`9$X2}nCum8&(?5Ec5D%-lZF=JF~ZDo zl-{L1lD=A~mOzBF%s?%Y;Nbg39C zqU*yeI%S9NRFbL;S#X6is(U^$4i)8>Tur-Pr~-x|9okNWpJ&X?edgr_A8 zwdF@vtfFJaWxV%U96WEEgIoeX$kUBaT#~Yz=x&u9xSkX#@wdNKc!d+gi|WWpk3T&7 zok;zukxA9Dxyt2BBlDCV8*hXy%c?@cycEj9zB+>KdAHZi&lmAJUn@^brOaJ+q}o?7 zo`vM~d97-yyW%Q8CZospslUnmAox7SMCU!G-9g5^S%C_jU)LFHY+UW zC!Q3-o#te(hkUNrUiV6hs@Ti$_%W}2qSvT9gZg0B3i;N49rkrTm?;!fsa%qz;VpY!ILLH+(~2r^2`xxLG%)w@hyf)vs(e%WP6k zPI^ts*!%MstY(uvtAt!+L^IOl5~R}P80@DIBI!6E*`Vdq=F*h+J}IZba}1RS&6X=k zMb%_mo%zIJ#!<|p`%P*L)fBU;X*W7oF^S*KVIz9xV>0i@?V%pd4QJ13R=!vqmJRdR zH4({)h{95lS}q^frqY?_-kZ<-ud!OQsfnR5=qs{3I2a#`2fFVS3`z43OIOtpc=NDQ zOT)2)W$T=B*#<`(rtt=@7OwO>`f55)Tqvc{OJE;5)kQhr5mdj>P(H!gROzthxg+IL zkC+BZVR&1}$#CJZrc?&<=Ls7ruD)CX)BL z_*v#shwghjIV(I1Ly7uGdJo4Y-Iml@6I<{|f(BYk`gK4d_Z~D{kg0Id+Q^u@9MI0YvQ6GOmj#w|N)mZXwO<_qd z*?T@d>lMzXvr7v#nISFuO=%J%hM;W6NTH{Lv{SaNK%4MXuD+BWD=H^){vFn-m}XMz zmB6<({jt;P+Nbmi_Lue+l=OrWoN}|1Q^l4Hj%lCmD=r#rOpGlsBV=@eQO)EYgLj^30E3!btI%bZc$c-O@cmNP$LL zEzJH1dVXskY%b4A^2WlITKJt1=7Q0zIL}_Zx2B> zyU^_%exsQgUyFOP{+WMytcvBTXJ_Krcr|YY7FZkTQvFo`{PU&gvN`DLBi=xstGIBUrjNr^~BlUO7d-n1A3G{+hcEL5tk#V`MmL_#v)uO-%I2%rsf}!!N zZ|T%+3lsHX6+DUh!K@AY?+SA$7TAS0Gb{PD$LKBs+IF*7tn*Rd643C_c;js%wyDo^ z?=5l3*S|0v$o%x!aA0xwj32CEx!WNGO!xJThtQU1l~z_T5_6w%^4g$_Uet%zRiDXj zzF&7efBqR|7zB(h{-Y6rV0;O8R+CIDzkaRVNxYW`caSiF#1uA50%kH&v6`Q_WQzWf ziGzba_*KXE>6_ZdBZYW78+?njUlQH0o4j9u&nDZk6&1HG>PKh@B4Pjs!OkO+l!rK4p3@{g6-mCy>d?TRL>G=oY7Tdsqm_s0%aW0 zyRnNgM4y45Ta*MYkRJ?+)V-|GR19SId)F&9ts|vp^uhC4DOD#am==umt#TBTvl`B~>N4igV|7UHhUg%=xW+YFys(u@zDb2cf zuv*s#WJ}sj;H{>!uEJ7PhIa19>ijeWz zr0MLMgno(Wm@bOB_x6A!OHn4)QYP#}|IjL@;Z>_tt;x|WxWd`C@mC=^NNh#Ob zm}k_KhOR+FJsZ($887WSrm2`w8Ho}mRpcP!LgruNGByQcQ<<~P_chqu z7DB|H1Ybouz};>7s^wy}^BVg-!;MIcEAvB#sT}xtFf8Oubmek_<2_e@@Q8I-GR4TpNz11p-4Y>(4 z9X$34uovXfiL-uOW~{5xcLP zgWEe|TszE7hkYCciz*!Uxeu>2*Wax(bQb9|?#9d7A(u|n=d!KI;Rk=an5(Qo(9OaU zy#*RT=KNJI>tJiBZ0tm&#i$@6M#QLM?B+yt=lhG<+BgyM@!fsLO7w$&-}%&He_A33 z-~oRZ#r@j|GUqR4Nr33peOkc*kmv%7eElM_2a4qcl)eMS-is96U-vFd1r&Ra(A~#A z(20ukzN#Jw7I<4w&iktR``Ekv0^jt#P{DohKls}}c^4-@qVfxa{TJAKp@REZHULEi zdeHYm1%HnHrFIX%75`$*0K@*PZPl;SdH*AixZ{d{4-@$57=BUP|IHOynEtS9Rs3Ds z0twU>)_~iX5CK0lGHuoA4T_O|3+~ym3{2j2y%SKfa56eND-iVDw#;G8@|ZZ1Uc^@> z#I#dM7pR$2M>F}11a{B%)~g_}zsnNAE`W4$x$q16J9B3;Pv^`pyzukp%`8nGO7=T( z5pc9o%V>Lcn>J$L%n3!H`>sHRZ1M&fGSs1N;ah!^ zVQ{vi-Gx;k{N`(z%z!p&G%J*1EQPxjkUW-|ylKgCMY69W7~UcObc!{K7y2SwicN&F zv)@?K&%mB=5eb?gy;;e;k3^;N*;7?lzX~?Ap&jOh!M+~UFLbc4^}(L-9&AdR9a7cf zhGazdQo)Mnn&x^vbDx(DlnBPgNHM^8`$_NnlHX%dE~<2ELq+^PAx*9&zz8 zb39@jB8IWv`^>x`J)N5mhRZt9!^D1ZMW)3!zgZw<(Qm(h(*Js5oQ6bH3xDGAnyiZ= zO6{;?Yl3hb2SRupTL2}yfJT$XX911<5{k#i25?c-d15{m<8@ffD4!Ab<#Np<$H=XB z#*R8^=qV)h=bvrsMq9AGWU;8?#CP$=K7@=`Bs7XMm=YVUXek-J$#$DiNJ)nCaI~#K z%&RWRBsVfo`iKN^s!#&ED|lmLrPD3FtcyOp2gh+971}fymO`1=VO~OHrB51hDZ|v$ zNJAvg^5lz!HoKvOEYk$#hHw;ifAPj;*rmjkhH{?-WJ<7!6zsFSL_L3cO66vzFXPl6sCV5`*egzJXzNS5 zd<-j3CnCq!LDLAwQjv?gp|tcaX^%QT&m=s4T@7;^R~eCD{OD5z_>}a@fKChMmr2pC zZ^A*Z_PEjOF zwDob_na?7LtM`P#O%&1Jlx}lF!b9D$a`+57eB<@>6EzF%q?#HcS0!I{t-`CPC-A4b zDY9SXo=MZ#;cdI{>qWy2@z7ATm|H;EFB9-S&zrgW(llbl%e(!Z-4a(^(N?+V zFhbRj^?2-}9)pBN0ff&TH)dRmkPW=mDX_o)%iOIv>rzt?@Cl2O~ zn}YLrhASVUebqS1vGeyb$47IChQr(LQ-cAYw;v^?nlF&q6vbZ&Y(lk;lcl<1l4(rj z-+&Hi8^YU@#Mypou`R;;74kS|?7JwN$SeDjk3rABRe9Am zMH;lYCK3gS)F`j-2)$JEQc*=qO|<85Ff|30Bh<)EeOmje2i0}Mqq#0ygu4XW{8in@ z{lT3Sbl)D$On+>hQaHu8wE}du?JHwK%$fWOCTO6;J!d3PzVl;y?b?VipXnUHy)_8! z1Qnn!D;FbR<77)pIE;|0w-+a~Mx#5rd}*5#m*U3yFSgqhmJO$0Mdlkp=wd8EgQ@9$ zr6msB^Q96{>O6SWvmYn`0Y(k_&JMz0Tc~~E(FG*T==^fl9xUS)WPJ!P*XVkggTw@$#B@)8#N^Eb2TVXDaqt=dLyh1L?WDDD|egt z_5GnEFtUSr)9BU0LarmBNyJvL8e8kx^)2+*ntZVPimuZ3JgP>mdbAn4QX+>8n#uhB5d{*~RIIiy z+aq0V`gh|w@C<}y(e?P2mEte*q}SGJ;K<0qI9HW*PR-tad+P1J10ks|OFEMJwNji^ z2WxA{k}}*whZoMtp=^}hG8#p3ezdU3zjy+s8kRK!rLKP*5GTjn9^!^vfC8l z%eVbVzAKu(Y;l#|0&$IIH{Zf0M@9695n{6;m1-WLhL-z_m3lMZ#ynPyX!A8UvmGjY z>R1Hw!M+-*8ru-i{<@%ULZu5)I*jHL^KuachHVxRID7b|Lh%2V{Nx`6tpL99f508? zR}ymmC`|lk{RSsM3=Pb+{6$K8#~tot0nI&tV(+`s_po=p@PT6QyVCctY=E&4K(Y5- z>3djK;Pon;_p4;?U+>+TKo|a{L{;I(kcXcVFMwp?Pl=cRBwOyB=^te_zb0OOq;CG3 z%lTV(4Csq;M?HT(Y%3m+c$t+z_W|^yz$#b`&iF45^EH2W|jI&^82Ium7 zxlL?zHnsOUqC(bhhXNLvb>n;bUYffgKBA3)y&h9K5;Tm$wX9!mS|Bnx%rZ&PrU}=Z z^7a>*dtlGT*W1iZo}YDf+q8Tx#$RYPvM4^PED*wEJy$YQRc$IQ>l4g>9`a(m zNS@eeEcOzHJRVBz+t-D_kT08`?Cf~iIRucPLA^v9DBn=kK#MKo&fmUe!bQYh^?Nto zAT5a_?zi=nz=fbB@7CU_tvCotjZNP6rDP9AC~9=)~~@BnW!jGHV9Xb#RES11gl zaUzGau1XqM@rTX|)+yEgp4WE5ms6TcJ5bhPW?I1i5=}+d@^$Hxq*LZ+l>70F5X*`r z9w=|R`#$2*#i!K7(Rw)67;t<|l@F6A%;E4nUysA0NVEIEuU6s;k#kJY=~PH$I|?FA zSf^VA#<5ma^j`d&h*=5ua_0;w`K73Cj)*mc^hTZiw1>40N1-0WLJrd6trdA_jjLRG zNxbZtni|ev1M5Plyj7ZP_G8CcMMR5S7!n-k{+Sw-%Q=g!Mi`BT(m|OCXARJG&$i*J z+`=;EG3Kc%lzeLl59-wIaqCtuKJM8vm)GWu`x9JYCPJiiv@WkhE6B1tSfx=-%~(eY z3b#&X;=+-6i81*R5Up~C5{3DqO`_-sc{aljjyMd3M7*q6zO6m-UmZ0#;yXxw#5B*g z3uxru$zH=$Uxriz2C?2%5Tt!{t#4HUrNg9y$Ynw%HWzFw2i2Ut0WNka%~W1ygY-=8h0nUUs|*;Hbk*B-tdi-u|*;l+~}cwDM4?)sbj&=H_{u4XBXL2wCt?V9!8>H zFwMO~WWpO=(mz7Ic&+{J7Ti7nEu0BWex`F@sceWn)5lMl*fOfgc-ApIt50L4<(g(FW2)rn5YM8_`(F74$8KWdwM+1Qfx+s8|7t5? z+`69VEF-V6aar6`fnzcrO3H51=}x}=hKz`W32m6B5Nq~pXk?V>m+*s-)<>YWOA)0m zrb}suq(sN%b9@ZPf_f8?rRr6c3i-nvxUiL{9raGVjH^N!L&EA2l3n5HvcgrH*h`gU~*QVW4M|i8VU^+Nqih}Z}?W?TONBdh-s2r^t9A=7~(~r_FTfJ z{(194S9%8tTROLePvjpxT1K2}j|(l;Rhwy+q7J_9!Fg5%uFqCp<_OzH?|Om@o%`#} z3s2b(u+K`Po!A&!CsS`(26vkFzAdKH_46p>v_#08r8&{nddan(;gVXKZj!rK=pvYr z^v$`U?)eI5zuXR#al+NkDB_rpQ(OC)P$)aEy&@ak`D8d;r$+Me*N9juj10snPgg=* zRzk_GdS2Gg~XtXto_wx(^QU?HODxtq*4hYQN35`t7GJxcRpP6QU7>6s(3=h9Sb! zfz4riFbk^64!^gutQ>#MMp~I7NuN$jSvhUgLvgj^h6?Q@a%#*DK8ugek(A%snvNrp z2dYpVW_Ers^Yt1wxnNw61Qo_A#TUCWS*XW@s~#8eJ3h$jrBN?%U+9;j&41|&{S-<4 zhyU}h!=*q9K<|Q)KYKht3k5lUnV5N}6TAlnJ`t6Zjt8Vk_eb5{JEsSszu3fIk|2Qg>St?Y2lVIopR@WiNf2NJ6${{|o4b?#Q6e;ACd*V8ozrXXjw6Z)nEgWDEF-F@qr>N#bB@#bBoIp%3`Ap}v)su@Qrj zv6a3%;4Af=*GfbsY^HAq7!%9EVB(-}ZOmY2WCHlbkGovO-OiYZQOL%|)(P;Z%FYH( zKYk!%Zes~}tz>KnNXxJQ0__|C4HFCCUIla({O!g6Qoj!H%m3m7cmMFO(F_2Q?oaiA z{|Rj0`Q<+b|NiQi|5EMxcaWQn{f~p(=FvEks5epFzM;`Qupbkgr@SmZw`T}mPE2xq zj5LZ?gCSGc<(V$(WV`htJuHBmEj|HdOULN*L}4UZe78~Mn(4Jv{&~cdy8fIqh|7Rj zM6&amD9D*Pv%#+2v5nu;&TPFZVMu%G#a)n_K+UK6nQ!I@>WLK?U!!-j+{!m&fvYXP zG`Y%o<9GYz&+Mn1(?jxNdnl5es{#cp4@JF^*AQoO0yh|=Gnct(KQx#DhBKU9o?UEz zNh!JE$aLT5ZM;Tg;AsYNU1s&VnG0I*>Lq@0G5mJ9k}V1Z9A?32UsNEIf5dce4BJ(8 z``jb|i4UJknx8F7ut9+os)_5h>JBeQ9CQ669n33xmZ0}9d8Xq=Q5U8t zmfBu%NjwSw!7Roe=$)PY6d@Vln3y+U%{ORZMd!m6jur<$RtLGxs7WN{t)-~a_$&gU zrJclC^HO0mvm~167)k&NKL(;Vq?6s@1Hxs8D~)GK*Oo#ASc+5=J*~n-ZDq}Bjy@Yl zDf!Em2y%nSoC=~hgW5BL+TBq-yp?XapKl?l6Qgs2ie+%suoPX?^KUJBS*gxQb!*U zC8YH_-$^P=vhZvnBB1KsVRNI=nh>XIyW1)yKevw+?BSOrB&+41MA7IA{j_-}6pEe( z`gnQOmsGG@bL2)>iZb}a;e(~^+clL#Q>A=`i`pW>vXpwt5e}YgbUDbL(^|@LFSNo^ z^WM$i9KYM5!j7+kYKniigW#gDq#Sr8RwRsXWvJkeC6>S5tJGdfK3o_h^+0-M7F+n_})H?YrDK6x|Riq==?aj!W|^~kp(WG*ul z3k@s{Y6mD^0&@RI=a;c6c~5j8%SAcMor^A!jGJ|d7>vU<8BeG_s~J<*(W3_67E8~} zh{sgGLa-f@DFl(FTNP;=s3#N?yJU=A=r~s>T}{Cvjg1J}ouWA?&&X>O257QdM$@6 zm#6C<84>W>4oaRNFdbC`PcoG~E*rvF1a<*=jufm;ln-}-c4`ZL=Y))sCF{zPgmH3& zjiY}2al+tet=!mQp5`*F3SD+>$0nkZxY+y&zj!3+B6wVEo9Gs?lKfhELjtdsq#LT> zif}0+^K)+||& z8fk#rB>^tw-iiPAO_gZPt2}#(*7z2EU%i{X5SIE_8W02fWZ5T|g_Mg4vyOp~#1@&U zm%JvWN)kHEjQOzQK^T>|*-&KEUpF6rYWRxA4qJ!Ny=s#6`1Cav`7oUFzVew(=1ukc z=J+oXFycsB{K6X)0xA0{YvZsGAqm)!0#SYJ7%D+SG_po>CIpDS)#ceiut_SP%*#GY zr&pZE@>m=!N~qX(e#`&35)?TpJzvkXwR9^zgM|F9pOD`wAt>~QdfErQ96Kqyj_(#p zQQG_M7Q&Q8U61}`bvDK6PU6ugw_~=$oUb-)P@jEGC*~lZNT*~*$wcn?J7I*SY2ytm zXhYIT+&I0>tXN>01n*%vk~5c|9L0Vr+B_On|H`Q*-WYBJbwimG#kweVVU9ErBEvKh zN6B=8h~-K@H(!3Bj~|-2Qam9rw6G%~dII}Wk+AvG3d1LK4QUGwC~CcDZMtoWqAp*z zXh)cmZJtD;d%ZKxQfRp)d6z0xVCyp5K3XNJ=8i}5P19%*54ov?dl@Qd>ZuJ0X$(gB zn;R5JGMCcfcf!Xr60KcPPa83%BCTOabH^i=+uKmZu5D6uH`GcyHfnL+QxH5err$@c z#^8n`uj_-gR$WVvBsfWXc1j!jQNs~~Z*7Ld@+FM)xq?=cpT6UcSvI#H4?l@nH>D~P zu?^y^2A^JJB7&o@0qNlU=m*`FVE7jVGO;FX3(j?W#g6M9r%j>7qylDu;aC{qldT>nb6CGE4PNGc^^zz4L7gLea75t~)#f3AgdrRb^ zbY*Z3BZt-`ZCHn;Ho)9#RL^vDGV9&J%S8sJ)8M+BH7QNzXt<;!Eeg#gLJvK7QSO1dbpH z1;*Lve?Xp&A47W?+jSE&a-GV-6kO`MkxK za9d4OAYk8@P%~R0PlcU3y&AWC7TQxmJDf`NbdFF&h`6l!+N$VuI^RaMUer&aMI8Le zky{@#WV{LZ!qw1!#?smbaZ`wizTj{YJnsy z?LR9&A;hSMqMEMBI52PM{*;_JIP(L&Pa4DX!KWag0$(YY``fMgZt+2y5o@0Tr?dc0 z@K068zofJewt@P;R$a>Z%QV`%82vqd!3Mm`#$DL|pBD!d`#>Wf&R?c71I4lcZ_Rx- z>EyTTKG5-q^L`tY``63>N5(NkcFyE0V z!2kQte7pZ7H10?gu%;?^b9Vk|1%D?uxVTsV|Md@&8{_ID(Q~z^t+@NQ?K#@rbdriB z&N8zU5`NiFCVO~|JV$5eYj8AXH4klW7F~k{$)rwgW<#dBq(MqW5ln+w7rj`$>NFTy zeKS$zIL?NGDB!BG^(@CuJFHy;` za?VB9C}T)Yl1AT+R6nJDvCn<=$#5~YtMEnFgpTwsJhQC3dMbV)&c{83hRvbxvlrTWHa$Dq4EMLD!P+VGiBmky-K zoTue-)lAA345qJH>gQSWZ-p%%TVj z=wFLZ(y>IBbN3XfJV3s_odbEzi08GyNbEp!81RUm`qQil*G#G)eYY6)BR_cPEO@;) z&@y?Q&@iup{EOx`oGtn1J03g7CtD;sJu-Xlp)gJkV$#GIy@n}xvLRk|)b}bLFdt>q zB*QZm8FBu4B5hAI>Ei+fGbmOE>bKFp2Es1S2CX_-?^;!uRyL&G5Vs?I&8o$WvpiyQ z^I^wT1_}ax3U&NT`0(O&eOOtU?*)7y?kh?1Rh#%F0nw&>%2au_!Y#J`7-itvg^!kE z2sie9Bkapq+4Y>OR?;Z@DmM{T7u!}A@s83y(S5oEJ8nInqGn2rpK*&~98f^|Oe@5i zZu}ycHt0>d-jZD`%wR*{Qwj5wR&9`mx3K#R-Os=z{P~Lfo+Fdqh&~QgAJkhSF(RQO zmMDkmQ;m;Mky!@J+&Nu)1zNPQE2-nnKDk}Xe`&@CrbE2-9fi3pUWUpY`rII96D8A3 zP0H3qYf@sPt`HfVVwt?Fv#YJvXI<3z;K_hEAt>B()IR6rI{`4MYCuN^`Z}$n=@IQQ ze-M)(w?zU;%d0~6waD^fvBp-gxO!e^g-?A&NRXFbBj4pix%VF^PdwejfsZ;^DL@lO z<$St$sSAhbQ)l@Vq7|MQpfP`f8L$TqUELH0b5Ti*7X7AWa(!TY ziAm|T5L^3hQi0hU-2Mq?%viqYXR92tN4`?{k5$-cb@QTZPbHV&8I(_U#0sg8>-pBB zXjjYAW5HFL0^+_rZIMEx9=3=fM_l0Ajn)?1-Y1;m%NV>gV!}&4`aBI^Q^v66qO}5l z9IQ8^yOUcdDT?5Y7GUR1B#VJuxdJX8#BlTdOUQGqM{_<#-Cqz~DjP9W}pO62CY%8#Kg{wbU*i?h1;?atG%c=)ha@ z`=&ykS~$V|5e2YOy^Nuel~_^WN9v<^#!NajCtf+7&uf)=OlsT zYkgf@%9HXX3g;+w_~qS4O0yCER3KAep$BG(5uW3ruAqqWc?0S(4A_v*Oo(*bVWI13 zdSM7T-2BtvXcUQD(e|nQzDw3W(+=&7l)@uJ$~RVaxH2q~>x2HccXkU@mCt+czjY;oJkbx4*h;6lyH zz$FLbAHI6NBirk%q_QQGJ&;C=5`X#G*0QNI-L`7W=yl5ss1|u~Bsn~xZ`l%u3({?; zQ|_uAwLMk`gj?W3SukzkFeE()GPg3O6$igZW#A@gAO?q_mo}bc-vfJLG7xY-JSuXWVE+vEUJ3LU!Kfch|PW zq@?}LPt=tPv8K%^_N@_N<51N5Ng}xVl_N|;pYhSXTyaDQk>)*F>+QDyT?_X;ZTgP{%s-Pn8~_gkSPJ5Y#`(X#%w5jp*CO4!!O=jWzmysS zg97RafI@%C1pt9QEvgR}4N_#x;$HUk6-)SS5PPtE>w=+EZ#U`~gXjhUN4 zOqfB;+|(J6yAcMYUhXnGVv^#jN}>#aA)5?B%EFS83=YP24#tkgHco$Ker!z`49)Z% z^bG-t8b<~>TPI^cen;O4kkPR-cha|F(6=#Su(EYEcKA7`!}?cFNB`d@byxu>aW@T! z70|;0(Cq)WbmRx2`0p(YNb3AWdjH}hfcu3RFedcpq|V=o8~`8T`g>5&KS>%FU{)zG zKEln;{AYZ`NqsST7SQBTe8o4pRS0q%s>}aULFZ#$OMzlBo)YcaW%+c(Oj?U{%cABH&>y^byxeE2SxyI>8b3Hx&JMb1s3T~m8-IOcW?61Mf8M~S1X zy6sN&k*~V&rHDsRX?6Z=!L!FW&txPG z!z!K#A9_>ts`TAcv*fZ}inHiFLINWGFsZjSB~P9y;0P2n7v>$fkm%QhP90BPz2f@h zzsWZvrzWqA{M|31F?iOlqHt^y-2v1${jE!l7*jOXqmvPa?-U0Io98}_5flldwJPij zH&q3Y^_GstoA}1dN@F1&y`b|UBu$+{6Y-N;Q_Y->>o4-`xVPKR=%c;&_2JK&60{|% z{cd0u-#)6vRF81uXjFrguui##sG%WGL#EaUtx9;TzW1dLv~XIkl)jsQ)=PtiKAdoq z^G3`W`gMwurd3IQ(8qYy{7Lt=YNJg8&r< zMV1F(1oIfq`K;&u9L~5FIDH33y$yO<1j$0YSI!K=aL=)@9~C-S&kw<8V0*R_LVPGK z;EJ^VsIt-*k{9gbs2yxQ9A>`ds4OUpRe~b2Mvyt>Dv&v%gx-IPiuC3BYWTZ#ynHyf zaI7NFtR3bs9P^5Zp$c_#mO@GlS6E8$fUv+`&<)ENOR4Ska)6EhYx2oHS`nK$Zf6`3 z)#n-snEM?nM7L;b&3&_e`wcNvhJCY?(>tV5qNDfEkN!2i#H`SsPHk7iOwDClAQhATWISd<@K?$7; zp!J`8>U=xmm73`tneB}mTw^N6gV{vK3we;tQ}`9MF@l%J&IRq2l;vY@xpCBh%A(Dy zMrtH%C}=wc4Ega1w$N5?N6p-?t_-jwF&Qyp%>l5686E0lFMOc5*05C3wc%>zH=bSF zu9G}}ik1MU-hcVhtVJR%H_1#1sabgHC6$83{QH8u0Avm-_}w@cQ_AKF)VA`t6Id*@ zPB=?2KBvXcHpMy)ypg+) z3ufwk%+YUfg-hI=q|AWWjnXG+%)!ng_ej0HNAcN}PD$)&iGve{PWpiGtBtp-&+-M& zvsp5ta+>|Phor`x+9G%u$E&u3W`aBvWS^_dzHherh&By&@qS^7$R^uPS-u+<0pDLO zCCWxi>DIx%bOT1&U7fzt1UmZqG6G7;y z!1sD3TEn)0sS~HjA0u}M;J1r=V|>aKfCRmbm* zn=gaE3Hd3TdfJ8)0-HnCbfJOL-|i7po6R!M6zY0cP~fD0QVd^l3K>!z6>DaTjOLPB z$OuyOUI*tgZr*O58WI(nM&6?g4c;e->-Dq>*k6cd@FZ?l@G{59Ya*R0lu>YMuj!?y z9Bbv$_id$U+1^UI2#=B(y3>(SB|(Tqlsc8>Ttk6*@P0aT|JIH|J*$S04eb%zT@xI; zY-F6z- z>~VDQ8k*7=ZqQsTv1nRxxPG8Hbhc`|{Lb=h%qXnYp=sB9(;4v=2_!PhArC02;rexG z^Z#z)@4pqOaRHh>{nOI`__$m@8r1!hyl?{V?!%U_?}nYS11gQ#*?+54<6{2#&UonJ*_hb?#N~gbR1{mZ zolH^-ini2QaXa{Rq z3A@uKCgeM2No@!G(UR0pGeh#DOH}e5r^3ZXG;(LkWbXiTf_jG5g2|wn6fsqVAnZ2}XTecG}}BqT?m&hoc8CMk%7IjuiSaGwsnQPn+?k z!=^qX3O41B$o6P;oE9+)sIgy6+qo?uo5b0d_LxU>dpHW`a4SHj6Oig) z|BStT@O8<79I4lgUYC|^1kz8$qPDJ2jUlxsJlvnUx)oL8^wy*jE$Jvb98LbvAi(Wp&%-|{rJkKJkgNHmOy zHX?b2p=28wk(S_V|9QKtk2=oIrRegGDcM&e5QP+jpH@SWu%tt|@;Bel1MMJO`1pHp zT+r(nRI>#8es@8xf;6ov5-k2Oq>`Cx9dM_MbpA04{DYe!H3Y?(gL)|xFVCzcggbo3 zYOb*O*gCXQ@lLml-b1+&%Jg@JT261T7Dr@)hzoQs4F%=Xx#+g`IQW?3xV+V~I8mcf z$nH6G@#dKV2$su6L}S<#5Iuu#6z)V>L?crOGyv(D0T@eNT+{&v$PJbGpfeI*E2LA) z7N|%uhMFmY(c6*hwUCXuuSHP^pbYDvwPj{2Q?sfVy&d0oTs?0&ND+ifbZ~_6sS|b4 zjZ3-nwKF~XCNpK)*IRkq4~H%&sX{gia#|(a6m0U=dPqU|N)pDHh_sxSUtgj)dz6mH zvJ~%_C9iJ!l+nsee~AqQ6?>N|*&R3Gsg+pHB+1{Pkg`M;8G<1r(}u|kVs>M%??$K> zJ&6?8wT~pBV6UeeMj@oM;ci%#7N!xQh!1o5in1sBN{+EWJVPT9W3Zb}{XVzc>N`xu zJ+v*kv%Y=jl()dO+EKdO2U2xIe&2jpjMdh#q4y<8t1SG3c*$7n<$~t%sX&|gHd`j_ zmnV8&Z!W4K6+cKX0OI4M-f>N^V@vfKNUGA+k63Ups$VqnGwKzB8ctbpf?7u33xILD zXM`K3BM2tU8cF)#!@P?{Q0UaB_jX4rSvrlXt*w~>k&cqJp5 z!)>UBS`~&FkCeULDy7jjKBpwLb7Td14N3QE&kV^0J5X6vJL-@|G!O=7pgHHe;h;k@ zDn6UButSH+*pLz$$35w^pr26@64_4KLBN}1bsp-Orc}EM5+}7ZHW(#fCe6t&-rN}` z-8_qac)UnOVKpkyO}0Dg3)boFBzeO?X0KRpzg`toRF5VJbdwh@)TR%=>R{2hQZTXL z&Hl% z%)arluBT`_d>9i$abfX`U=k~$@ch-$2edI|(P~1o55fo{?z`cqyHl9=b)O7WdiTO? zf?!ty%PVbjtLLMKTRs&R;`kAzch(5sHDMYd1vfNsjj2usc!b`45M(`Ng&szultqmk z*5jLecc)uxkynfRuwd-qkO}RM8Q$1yS$AHs*x$K(R0it_Z{l2ymrX|0F>WYtsagI0 zUXP9?FFl%h6x58c;B=yE2vWIU3B0b+)ietE%@dgTFfzL_N!qp1Pb6U6D(wDgr z573S;)SIlIo31R0uap^(n3`$GR48vq58@^Rjf^OlNj5D)I)QkVtqZ|TucN0f$NM!y z&*LX5JHgo5aYOH}<3;XB1My=?lWqu}eZ0HG<;di}D1rNjI+ zatP;}!G!d;7$I>Az4pi**AC+);Ieay-9>JMRswl^Hg@TmhHfr=59F1=4rOL!pHaLR z>cSLJDxxqr<3I#EQe|_fs~Ea{!Vx_}81rGF`#S>uGrIppG5q%|>P1#07P{w|!E;*x9{o~q|C|%}xnCy0 z*!7FH&l7`Ze*b~bpXHZ`>%YUp7x&Bf@(c^hb57vrYi4{|riXPnQ@nE`MpFZ%s2o~wV*?Pd9$1Nfz9k{&RN^rGLt z*B@To?@zmzjsKoC3jFF4WBEng``6zG`hR!E{a0;bw17$;J)p=(2Wai0Xa0}FHY~rh zjs0sGKeM{OE`#~sga7~KGH7rZ00U)o00aXt`2Qa>sb9&^zkgL^02QB~=ku?2wV&mo zpR@P?Qsw_?SNorm(9c}zPr{0Cg4MJ$ZyKT4u}${X^oErMCaQjTj4lNVh=s(}0Fw>2Rtnfa`eo9x8V>=^7DEf%Ezvwi?NuI`PqdQi`C+zL)&tr#dMf3eXk=%;xNi)^tI~_ zd+eR|rYyy6Pgr1Kswv@*Hq6MAPqPk`1BN%9TGB>KHW-HvlR+D}D5*vRKl%oU@A%cI zRGW~GZgw6a9aE7sGwP;|E?j;*IA1wR6+SXyH5@r<+@aWgSWmDC1oRwdV%A|qvJB2S z=XHHJB6x#_g}`ESigM>{&yMwo2OPu*v=lA7<|k}hHflL~X@E*+rY)q~Z%kRj$3Q`j zrZsEiKs86dlA&m*UmdyqV=<0$f&)dINca8@^A={|3(rQlbS9)DMqnX|Ex4V$@y8Xf zd!^OTW120$;Wzf?162X}S5qKSBU^9jnX5D-uIa7tL)%JHInpyZ$iG@N^k)e69}N5V zD%CFJeH;q1|?e;BF@)h*WOk2vCh?7|+W~%XqkmqpcNk z_mItrCIaY|6F~&xLha?nR2qdoLsp9H)0@BVB0N$qf*#BezOQ3gEochhG?s)o4vgw+ zW`wF0Evkmw-I%Ky9)M+7L^F8bkS~H_PSW183o(2~B~WrAXIxH~XA5fSsi_nv&XnvD zU2A-XbZ}qy4v@r+&aMxqk}ri@&W1xSD!T4PwToo?V}6@9CFh+tI!<{M1uyJBns;A# z`j~B_bNQ+l&gAHTKbB`-;wkNEh;)!C6_h*YZcV24`)p+WgQJijKKqKOSa?DHsA)ps z)sACX&_vmcn+QLQNElUYlynyJit6HVf>mv3;eyZ2%t^x35-IW@Y z9-NsD5`-dA>;m&b!PJ0z%VMc$c+nl38Ca@=v@~XW>lrUNW0cDw8n7aBlvmWd)MVVWtW*4vM)`%1N3< zMZq_MNa;Nc!QH8vl#`HTBlve61G-CVzkKQH2;n4hnsJZ$qQq!JK}2dJxY1zT`!?zL z=^gk750uN154XI)eMMTfPgbu?eAhBp!qp^})`pfv(4nIpi5Uk3;Jfm-<$Hu2B_|g{ z(YK8?M|5BLAwYN4cs3?6&SJL?HD)$9`h!bjh$6$`OWON(OCQl8n^|1mRkDqvWt*ZT zjojmC96kcOdcniMK1OVHQ_b(wOLwxrnd^e|@d4^HHgHi%G|GKb(P1M#>9@9ygSan_`4jTqv($aO=;r&Th@qGKK%KvQklZBe8 zK1%iGO(ayMo2CQn2$Bnx_NQq?N*^|#5?R+{-l`u24s9w(dj&}?&EJ~!G&+_;d9pf; zEQ8kLCDaug$3B;5#PohDP4O&9mgB9&gA*zUB9QX2rztXF=!8Zkc3o)pduTR0p3n6cxfgr`c91kzl&K#)@&n?N>?*UDE7>R z*5!jDBr<1ynVCzreTG>;Zn@Kx2*K)i5B&WHQ~jPuHxU!|w~fj3AhQz)!gT{R+=VX0 zc@^F1YFSG3U4S-`o&NR_*K)^K6J4par(F-J>Nh((v7cg{m@{8#1(&2W(+%v z`LiVA@K_hBA&E*v4z3MV-wAfun3crc&@0IV=9z>e+r2mVHYJe@19l{(Q}a=b;F7H8 zbFB^viujzth|v)hzt^IV?Wo@hkJ*qa^zsO9D~g50J6a0fMDi{6Uo?skhO3XZXii$s z5^F5uH|_NZPb`xw+%O5AqWgBh+IkCbve%^dK%l{dBflbXLr7eu;skdeT8YNs_-L)x zpMJT)(#rqjVKgHCJ!ycNVzmnUk<{*_410OYlP;MsSpPBgYkz4!G=H3+mo#Q=R&nK8 zcPO^(=25EGjb75Z6aN-E!L>G}JM{r#-0#^+H&5N25RLXOy zXu;?5bHdemblSqKNsl{_R1fqng$>mG1QK|~e}%bA2__Jgs@ChdEmA3K5u`2=r-NMu zMP1`da1)cvhjM>9Q!k0PirB=KSuhML^Z}m^=t?8!rhgLFnncWB!w9PAb)%E23C z@X;0rOLza$xyrT-5qf|Da4?>_Lc<2`Bc5iB!6^Zxe;v99t@I^amDNSU6avsec4?n=gZKVh?Z!ACr?nGfU6Bs(+HyTdk zPoz8e``%A3vYG{z6-DW(#CU@z3A(dV&fByb9q8lt;3F=gQ1Fk2HYb5gd6%Qn#G&k?+EZa<=25l2Ak@ zCn=Y^8<}uWdtkIV*-eT~0s{+p%Z<-0fx{N6_DIX7))6S6ZTE_|JLMr$4XsGg_5~$D z;ol2F)qVf=4P|;evTdMu^vTn$((8RaS%gX^@KFKHd_#amSC{v)0(1BwMWt_W*qII! z_PRu1P)FA|X4IU<_g9SEgnJU5N~ofjABx}&Cs0lzwc8p*t^)bm%qOT%K%fHbYQiNy zgP__K8Rw^zSAHNo1!g4&3+?ws(L$qFBKXvv+r^o5>o+u%w{`R1bsTN`_KMpd5le zP6%B*7sq2ZOZ=#Lg)UdFO4<>>YbK^_Hr-#;e+5}E;l1Y?A=l-%=pNt+9M+EFk$3_; zOOG2#r6Pg+iNgJ36$4yhgyeai86)9Wc~=DY@Wx0C*enbg8d^}M0(`2Fq= z2%b%Hd^^lGn_5v~MYL8ikd_+viH7vUNL&UlYj~7&ef5ImicEMtX}if*IMH3BX5MtD z#mcvKc*;jGW(&ma;JNwtVs>fpc-__HRFcCG;mL48YJ|-5b4eyL4O-mZQ?Ie!AWX+oLT20b;{ zRBRX6FKSFwn>I}<7|#JJMKYo8;OM^z7OE5%|At4Os zKnH5EgF*5~beNM5UttR53o_SDXW%y4>@R%-V)WnII`c<#Z?DiC0o}6QyOcsS<29FG z{-)OWnP+Po%&$&HCjSAVvv;K=ej*Rl@bJ;!Hzn5D+dpx7ZHSult_P*sfy5cejKi3d z$Hv#%-J2$8$m+O!WtHc>x6G=farx+1zqd`b+h!JiynnN=_XRjLGkzj}@|f2-P-U7#2V z6&#bq2YoI?B>FN`)1Logu-Gep;Q#co{FZTtGHE|E7X^DP!J%Pi6Omr-WGNK+{?(?)-UnTdHTER%;` z_NB6#6`N}d)-#hmKK!D8#0WYig#%CQ4(l-J)xc>|z}R_ie?qNe(`DCzJi{A*C|+xd zTO8JK`tBb~!4{_6Uqqvxuz_SaR%>1cp?~9r|9=2NQwsrruAj^@zrdpZ)YwBUEKiT~ zXJ7Hp|NM8r=sAw~0v`9`umB4Hn))l)^b-qwZu@T`vA_F$jw3#^{YM;;;Wy%!!2YKQ0d8FT<9ODo$p1-bHcOb7!4}Z zrBLsnp|smjwk}tMLbvU0S>1S3V_A*EhF7$k?~b>+HjeElSRw)xG*B??gwWod%*=;2 zY!HW1PxhC7%y;8Ve|3R;^1z3>bj`zp-xfUx7p5UioVEo2E!BaMc3~<7NRyBp%%ULn zcCvpSgmK+!tv0WDqxE&_`yZa4zh<_%JkB~*^g#_Unr(=Mm`VTO^7_)y^5cfb$_lP@ zxnE;&zRg=-K$K~Of>v#dA8dC`*C7G#fb(M3VvgvTj zsdm0xIb+~GwoOM+bbWTEloBC$LZoDJ!#*pUV5B|f^ddFcY_lAD{&4%M z;>H|_^H=jK?^WdJ-x!c?DR`F;p1?x#@N8yb0NmSaW^|*`ejYH(eq919uq5q6k%cfR} z8!7uCje_A)#sYf-!n7bOhL0XbIFFBhxCvxasJ%^v9@}_S1yXmI1F`A$6X^+p{;<1? zN_Dx9$iYLXi%0WODcun*7wJt>oIOvi#uNwW2{&Olge>g5*XjVv=ybfJ{t*yb%D|gkY25PAE z2f7eHYRFf2w*HL}Af|iNTY|zNeDOp213&jC`cSf+ld{5EP}HTk61R(5e0YIDkHdYD zb2rt6#g-gvQhgbsbCc)Mlm!bn4W7beq;1of6(2f;5LOZTM!D__w131#< z9s_Wg(SIB!`4MgN!5!Uf12un`2WvooBB;MR8t(`%sOg8fDCWDWqSA>(!7@5+jSI zv~XL8+_g0b%-4#6dzxi~-`v$xl0#j%kV{>7!$#tGsw$81uYIEj<+ZjYq1@SK4}9*; zvXjVujf_*A5ULixn^XmRM7xLajsqfH{~mB@Lrx>Ko6s1{pog-hxwU*)_*p5Pi60Y^ zsTWc2Y~SQk3zOW@1*G{wOssvzrM@u4b#0|^J{k1gZVlU5`?ZqnavvV_dnlLj=o}fs z%cQDBN?)0YR=_Fd{5-`E@q-r__(xy1c9VebqI(e$L4Q7!|2jv&Ln+#dvH0iC_6FaI zwWi_xxw9DR-i27|-ka~5*$?gLn}6*4uigyj0Jl>x1qKzRFer%BVkaRBd6Q%x5&ZMw zK!0v+ayQ8aA|lP_x@dY_O*c|kax{^3&;w2HXpmN-6$58$@Rcnrx`lV3t zvUx1vRvmT*S#DY}vbP3b+rkLQt!fX2x;MxW-X`S$wl+4HRiQ>?77cux8DsmUfuomZ zlD+q8TN+DV4%%gi1+;g#-F51~q^w<^#RccAenO!?<*ZV~syS8NlclsM$LuOh z73U?vYU9Lji#H?uX~3!=UYm)&AIItRT3W@xz>drIK&x$ns;l%(%%lX>5^zL0(yR{E zUbcmB<3*+hcJ?xXyL|w9qxPQUtENkDNdD;;P-L&qZQ%Em_*NWS zeB=5dzi2(N<~#Sj>fX(1-g-?*!@#xPk2YT-Kg_RBuSpj`?Jy}KZ$w%n{l|A2QW{DGS9I;-Xkt;G~aR6ipf|4;cxN*cXSnKpy$vjTx#x zxG`7F!bGVB(?QVdaN7kcP;ljVS zqTYGXUOeb+-G1#m4UJw!!EeJB{;`XFSF$-ItW{*Y12Yf4&(x zUQngH&K|=7k4iHmldTg^cOnm~^cprUM7XbK!CoBQuQOn#mgwjEaDG&NZB-{oe*Oc3 zXl)jBtGT`wHYn6A%r+74dnhy~C+{!irez4`Ax!}OHvZOTm;epX=&4(j%X{Z}WpEKL zwc(oh@*~I4te-Cli7C9FFNtkN48z)Gejyjg*AU9b;fnl{nkJarPyRhPg;4=?{80Ldo263QJ>G@H=19NqeZXyuL$ryX9o4e4IR5vXTA7@|D z;--xB9=w6z{+6^2>(AH8TnN^w)(MG2wB&AHk-0VKPP^$B$q#;T1@--ldad^9Jt6ve zE&>ce*;k(6riVr1{fzRlDb3!NH?yU~n*GFv*M1jydJ5;+7dL^^lkU|>`uIhkrg_2#hf9_@MZeic!vtDlA=o?|yDDCge)W>c0x_R1Ku54~ zz-g;beTc9hA!nIB4;dmSBamM%^{jN|hbV=)p?DBZwaf;1=`j zmYki{ctB=QT*QH0&`2Llqy??9`sf|R=BAI5O~yJf6<4&hSC?Xqr%8PX3&ExjD)!`^ zkTmD4nLdA;k`1+J(YAULMro~ij{s%3WxKetgm>I_Y{karD8_Q&^fdZdwQL_*>U~@k zKEiIUI;-~G9o4FA8R+(hRZ;y+!K3oN;$$upw7^qHWSPRJ?w)s@T8#^uie-&*;1d~p zxL|?dV(;R>$bNWa245P6xfVqwTsvnN_h3gd8?BU`V7QyjwiQ==Oyb_vQOhAU|BPX~ zX;Yt-yyY(u=!@l!!~wnbbkAJlA&+A5mfB-|Lx&Y-^8*L`rVj?(&ZZAKoQbJ;J`;xs z@zEk|^Ov!epv*A45jFlf^trvxrFH1Tqvqq8g9{#WB(2gbwOy^!3$=dp@K20ZZe?$y zdDg)4MDBwL5Wd-0ci~H$NDX*=!;@*M4Cj0M#WN@acf)`)e@Y36vrdpM1}s}Acq?Us z#FXL_Y3^KR4K@x8MG78q&j&mxp(voNx*y*v2Qk-fY}XD1 zmT?_$*DP;(Dw8*^t~!$r`Jjkf8d%vQGpiy|(1m=8cvSfD4zabh=TplMnkkYtXvyhs zC`qM69dvcU&?EJ&fu*<4<+dMg11!1nQX_k)=S1G3deyb)gs(Olk&m< zng1ZJkS}*49=w`W!0wnLuSUmdoS9ZV{YKL?lfrnKVtB_}Jw3R2c?dN)5JE`74xDsT zjA$5JnBtUTbaDlapjittNhy%zH|G)qM zpO^rj{?$J6GiRk1bha0k2h2$u{=uUwEDvDw`U_(4x4ibb{07T2ISOU~wbV-uLC@tk zUa)(lnTeG?jg@|P=;7G*e6k`;rpiNu$`+wBGc6CGxIi!n(qmUumJk|+vA$%TiD!G1 z5Gsl4uPadZu&sA()s=gFb7&jA--MRke{9I{`bjGxbhOk-6916@JiJ-m+5|PA)Jc=L zRFib^#OJ&0l=MA{EVhVO%+{nfHdlfwyG2pL(mnt zGUBVEA~(T|=>|f{rh<7fOm$fgUD>5*F{Kg@EVG=l6168!J0-~XNqob*@m1J;hkG=6 zjMC+%%f+qA@lq6|js0l>yge=_7rE;S{pIh3@91Jh+c)P7pDy2g3eJFrTjy`ppCmYo z-KG%PTnd%BgkZz++au{$@Y}v zsUsEv``(h4M-@&`#mHzD82ApDlVrhRK)Fs%hmt=wnD({w+RPDlRsF~Kn6xQyKRy9d zhMGeQhw@<5E+GD>Ehv4_#p|f<9IlOYzX>Ec18rn)BSpA~+(UJx+&5B2X-2Z`r1&;$ z={8{&OzX0!kcea4triFoM9vo45{||^iju8+CTtDLXL283(MLH+(@VF)Uz=FlYtL-S zT@ibf#6@xzBTkKT#eu7C)M~+3O*Oj5jGBw>li`?LdL448>Efp-Tvt&vJ@AC-!RiA| z#EdZm(GIBa@IT!E2^6X1qT5gi)J zxcA=M>|<_bIqVWa!b+tDyqV8aPe=hC8Mr_Ersm2ZgU~nGu+lkdTFJgjZ2+}FPLe=_ zj^O6Xa;U=X+P4yLz+R-eLG&;*HlAh_@?sfPpJ0c|jWkJh;q(`1|4=~%!hm66#3=+mIE7XL8*>Cpa)GG*_NRjOe)j&6Og>gcU0MY4%Lo|En)ewDD6;oCSIDl$l4Wwd{=%od?MGkh)L6fO*< zQ^XTaQ2Zb|m9mM$mS@4ik~};nZXmlFH*~-+oe$h0Bt>CatE3u8UI?y@?tC_X)tX_1 zHZ%$yXT$aS=7yt<{4?spWE1NUg?h+F{C+1d7GBLxa~mBanjdT=5k3tFI(ST3`a7h$ z3Ir3I145Rtv>!baAh9<^oox7BR^Ump=~;O^uludW6!A%?P1nLZFtwv0Nyx~G)$3zt z0^;ooY~oaLw_1sxf-WqSV&{F|L%WXf723Z|`dX>v$P9dFMCQ)P@4wm$62_OVS5RM3 z%vN0J62()(TDYRf9&o&4P^rgwo8A#-A{y(=6f!#o!qC4F%oDbi(RXa*pMY3?U(&xl zYoX&+(mE%eJ4}_J|0oJA&B$doH;Sbt$}&dvhC89hg%}3kSLp?5$((J`msXjef5rWdX<3Jr5|NI-nowHpUlUzh0U67(2;N zRbMLL@^&=62iypeqvqC-M5KYjuQ;w1*RV+UEk^Dje@}B~^fJ9nnQNyucmaHCEohg> zX=u^9zQb}~6~)cn;&5_#AmwRYBKbL(fJOUOggQfez5-&**D`bzfw>LMck>az;khUAb!)6aWxK_mW#jv%YkS+ulKb{;?voC~uBQaON$ zA~^me0pvz@%hJKhtm)P)V}|jizAPjo(D_{{?MV)pP69egHd*^!ht_%*F!Vqdh=4|Z zVac0y`0CKJ)(BCbt&4g1uTr&-m_{LfX*=)Em$f5VOqiv1TTT=edB=Ai3sm9r`{P#I z85m!ca(sNJ-!4zAH`II?YXl!0`fBTX!WZPUFZbh@=@CoCsT}u@PtJX~1Y$W?mI~P5 z$xcorw>bM|AER0j+&3br%x*B58*X^CFLbtQ&Qnw>WPG9P8fCNvC>#%rNW*=QAPb_e)*m_}8!lTqvrp%BDHOy$FLTZki|c1mIG_6+IzKn1N# zPnDgXORUPYh2ylldAtKIL2$k0Z(}Ss zi<L7Uopn0Pqck@cLV1>%*lL30oGDS_S+VkS&2p6j3|K@!LWrU#l>3()e$>J|bv z<%`Zya$okdom8wXd*_8}H`W}Vss`n5Z6Vo{^#*+cJWTgV>=jI!VbXz8Q1{e!KXWOw zztZ4D;NEwI?8-}unAm5=2tqnL*WK;KSq%t}avsFSIhRcnZ`xX)MSM%pCtD0U1PLzw z(I-DySq0{>b6A(!J-0D(S8S#Qw*GDUkGq(d>j=54GmP;YeIN6}$+s~NIvH1kjt$?Q zfJy?l(O=GRevz#HrH}o8kD=fn*@yo!b@RVh@cbF!{yoZlo@P8_uws5$Fo)&2bPdZh zTgHC~_nDrj8P9D0X|CkCc+GRa^#3rw16a=QY1K2o|Cna{rsfAoGyX_X{zx-^lIZ@N zO86^@F3X=1+dtEcU-CDAWc65yx1( zOo-%Vg4hm-CLS;<`ts;2>{k%Hujg^Npg;MGFmNssegODA3 zbtNE1AYx>NQ^cnJo2T2QC+`l|%8I}dT-w73NZLX*jZWtL zY#T^jW6NvRjx+AhwBQ`6#Lzo>Z{b==06%+a<-5^@s3x1Pj$TKoxJZD;t967N7I@i| zs;?O_^D~yc2aJbIDGpzis%IOG8%k8pRi=kElSa-S3ryy#Jaxs>OIxQu?Wt%fr<0W= ztjpFeCKDfO$`?s3hJYR6ZuLE6_GsgTx6N0Rxed>QtR#5MP9u>|%O$#gmC*FOgBME_ z3K)}=JSX#wBev;@Az{zcJ3wD(tV>^MxZG8Q$J>(Y&h7d^rfQcs;%eaY>HSWXv&B?G z*NQ6?6phi1h`;130*z<;}CSm&;g~o6>{fN*3#k-z6<=rz$ z;eny|Qb3#(nhCCil+2NjRjYVLZ5y<4SQ2s%srsPsDth?a*Gb z7dQ!Gqdd(TiNL~+czt-pFI!x7^|dNeQw*sHnU+tot6yWf%BpcNxCc!-_uMqGNbvNU zj+jsLvhtK%YF z{M|F@gTZ)U+!n+`JGnCp-mNSZReY?jWbqa*Tf%G<8z#ZhMQslW{=ze~z>$5g(<&38 zF!kGQvm}Z`pS%gM%OZ9&SmV2ll&+XpmNEyX$|#Dv>>d1~w)Xc+oMBS))*5eKiw)Ub9wjbF`R`M&sK$&$zx4uyrtSfQBOKB0};^R~4 z^Y0Jq3E?Q+tU70&)hagvDwh-{vY<6~1k-2{4!eLiY1n!ScMIE13%XrmJh7QOVaLnz z+^wKlr-SbC;JEep^u6P_T>l|QExYI;XK_ucCR%Dr1Lv!^LYCa=w%FwQv#J*+jYgITurHGByQ zaEq0ccW@cBkco4vv7)k61nf}X4b(Vq6OA|2=yZOaCZOaPkbGRh z`6@ds@b>B;Z@@a}U9y2YRgv^&=Kg3HK?O!S*UfGbv0(c)MkK5oU5b_H)duTDTQG?b zxKi&(4%hL`b(Ums=!zJ!IeI{7lEjVVG+H1kY$XO7%T_4M_eNYA{4SMgzcxO z?+m0`y%!p`(Y`o-AJ7MtYxAM;GWgb@rJugk#rc5QcMGmsn~IYX_7*swxGPW)Q&E%J z0a15*(hDda6z&#Y2WctmG(><6lUmwGEQFq5=x_^>PC*unB#Bh_%c;yJ>V71Hjf^;H zH(Q6q<>BCN@)01d2?J9rK&zlwFozOpufE$m(j9;E*nAmsVut9ixOA9LQZ65k^C`px z50-r25#}VuBNa(Xbs7hJ4@7a_+9|IwItPu#(1mS}128**8<4Y((@E3wou+%wW{h1E z5%zE_F_`mJFPp0uoBl2M#yOoPCG8?pBg4cLv}Bq>ji|<)q+Eq*$mLz^chwc zSZVky-#s{+$Fb3{;^%;599I}mBQl{mwjzDs$!rtHxuN=@i|Hz;_0D6^*#<6n_Xq&Z z86wqpTNEgh4VH{I15)J?aeN-16tv7JsAol`MW|@EJj+Gsf}N3r_r2q^o$Xai<9X*~ z7mN{lg<=(5(b4zGg`bEW1Ny4*=80WYKFDVXsB|oiG#-!k(Sk7PKY72#IZre@6mn{q zUTi$STAHDXu*{E$dk4-Tin}V@FJNa}ss#r+Gb*@TpWDjIt;`7AIytPy?n`&kpH_P1 zNx>2s{-tCX%Z^*=rmolct~)@j5pz8S3m#s$IH{T>8OyhTArY7iA1n8uYci1X^0rZ9 zK3=eby-pC9!EK_VPhT7DGs(dnBs=L_A!GvLjX_G$>YPb+4asTtgRe0Y`uq19-0F;$ zmh}nnm#wDb?_^fK&99WOo|f2@p(b$Sv6_XSjeSSPII>nj+xj#fnIzR{%85Ws0={Dq zlZFlk&3OhvnX70X%NvaGNNr+1jAZMkFCxANjdM0N8hK;iSE&L62Pa%}3?rv1^0YoT zX3C%iwZRXWCD7Zf5e>0w??InJ#H#QfhQ`g!Qh2gBE4(JZ_;aD+f!T!(O)rLVbdnZa zIq|6#M@qtkwlRa_`yhD#X&p)SRb=uo6MlK7j?Ee8g}%xAF8s8*tOW_qdQ{ny*(`M4 z<{lm+M2Xwu_l;qwtm49jk>of*#a49|%gRQ<=JO&F(=O#|?viW?z^R9=SB)9S6h#N; zje8wGh?fau>zVzHs;ocTwd+C>ZYQ1H3rK>&5qkD}ibWgYO7qdO9itAyCOFF9u9a1l zXQEaSNtD~CGJhSRSL~UjL3|hUPEdCZ6$eDeiZNzh1*+Qx0_XjGIM+LSwQCD|)WeW6 zChkKykDgPzEr@#g%X&>U(JiZ`t$yx zSMg8uW&n=e-vey=XSV-9GxnRz;mdvj)tr~=7QebU|HGP@UX~4K`ArS*MZZjdG~q?R zFZ4|QzF#H)ht!L<&y$g7XT?PGvh8!}7nWzXi~#1N|B;7)^|vSX*E0U^90s6R z`tva8nE&%({HB`=z#aa;EdIb9ewH@@+xj~j!k;D0pST0yTkn6m;SH?}etk)@0IdG{ zJ^e4-ffk_J^xxqQpOojV7FiGhz13bg_XKcw33$bpD-%d)H74H9G@t~69euV#N{cFT z32m8!f)UMq=U}m5(K?q}8Fq71hhrJr5axC8=3Ow|f5q|gjkZyk3Yif1osMe z#bt44+cLUhk^V|hsqHGX2)Rgod+*?4gS;`uP&=qxYqWLr=|g&?-S%<_AtFP6*NO=?3Vv75%F+{)vy%wdr&-#!~KI;NG0#Z`h)#bY@0D60Ma(Y+= z#=@mDI9^{6>o9HBW6e#-WCctM+qdQ|H-t)mWW$3nyzHjzM1ExqzI5u7cj0%CU*Ozj zqT>PKE&{hV-7xdZuetZ$H$TJKzAl2b#DjW7(3VV2Z(1srQtJIYrn84uN#3 zpZN$sF};3xL`}s}a(G)1*#E6wFI_q&8+X2vQ6Ua8WiF*2JPqHceV#(38N;LHOEX`7 zpVFIczau4w)$D@d2SLixI`vV6icyKm{gTY50<&Opg$3i5nVPS9xYJ~PSk36GmZhCC zGoj6b;XjI66GPp7tTN+<`!cTy1CZ0cE_LnYSiE^%XSA*$N*B?E`cc-F#q8;d?zF%h zVMveWed;25J8|9{U(XNn<5G#~!&7}zZ{F=tEJ((^Id0K#;_P-Hm#+xkbthB@^BUO4 z(++9fI~$)=8qNXkFY)QD4$91OL2hpiFrI#`daRh&HaIiM z$i{o|RpP?lS6?x++tz~nb6%Wk0=AjLG>=p)=bSpv6Axkrt1B5+;aLzOtY?sLJ@PO^ zD9{1+0)W!%40WfcHqeMmveRTueyUTVw+=L&-nWY9E_Z?t=cCdYDPpFQjY`$Y_g30C z)B<4R(U6kt6ce-pqVR|EA-gLWgYOlJS{+y^sj|e#cAJOuyy=E5=zFelKaK_q6sHxZ zlE<`(1s(|m*k9WurRe*+Y?_Aoy~+?XLwJW_9nXF6b(9ub6ihtF<~w2lJ-wjLw~y;4 z0XhgOQE=qRWis>i%LNO82iBL@Ekj|@7GJz+l+>&r-x|gQFo~vTq@{Rip(^~t3rnfOX}0YLor~Cz^Aq3= zoRI@EFeU3&py5JQvTKT4hEKO>O57RI+8;;OS_7*3sMnK9Qy9>#?3I-G3g`!N}6VOJRxDPv%GD!xNLvd~ ze<_+Or)!gnLCcJ*+N58u+I%=7VJ<{IwWTDFQdQ_g6I|+O=oNXjFdbTEQ?<`@${qEJ zNF+@FcP>|FP5sf*QH6&#(*E4=gF+@UoX{7<51eY>qo{{lDnoZciI;Sa)?&-NF9S#1 zlM}D+`;HYV$O)?R-C zs2-tZAfT|{;A+;?T;u!RKPg{_9o>$XZ3%Iu)N*tsOKAE4n(KDN1NN$s134j$4koDg+_10 zC{fAUS(e$+UQHdiVvR@~fRIB2yKN5eSeV;o)3tJqXzs281HEl7R(&~(`Aw$e{|{Nr za}5)gUy3MyjUWE0a|@u${@1tT&j9L~Efb(;?1hMt^|^@2bK8IDzG8i@V)BA5pf&78 zzkla9dU4H+fI#6z+u!1xm-fr>vKkL7AVK+$XT|U`Wfto%9gn|fZO_j6AG*z0f0O%o zaliC{i+pjv&m;3^e(7KC%wzqCdteAe3YMMLhmn35oSLM)5yONOY|KHL;bt^`a26CtysDCUUAXWhA^lha@UTG#Z3A zwDzW-Dx{JnA^9wauy}4kyUmy?Pb4^Rizw)5&hBK_eV4t>A|Vu;%SK>)$E6_%-ly$t z4s9>jo19m6Z*wJEHQ;Of0^649Yf7)5m=?D;Iv%_?r&AF4njg5iy;L7-?>riU!Xr@c z7+5ANiIU)r1X|$C*DIK`6GJ24mz~sa`)055o{;0=T!)bGYL9hkgAopb3zGUu>v`a@ zz=DDuxS!m5Mp2^N4t}L3!XVS&pyi-hX;&5+vg4)Q{k{cP`{R@O<}h3)9Zi+wNbjIJET*jyCnrdx;q8w7NkRv?nXK#MYX9?)bR~HsOC9u6pNh%WoNNT!)|Ok z&avJLwBAUUSXVy(o|hZ?W?4N~tA=FAvge|(K>jpSP9s}}jx`%A^8|05j`2OYPr98l zTXFakb4W~9bf3h5(iy}`US|m3An|v?{{6})S^GzCQxHjo@RX7|v$(CtHCYqw z(fktR1W=v)o05w^!a;wDPxzSBBmP`7R7BeMg5d0Ji$K~(bxyl$%hCLy?ly-C2hQ1v zD&~yft|E_Q8K!{a@OE#T*@^x{@efZ;+BdZHz{#1mTP;4gwAf&tpyBX^I2;Znh0*3Z z%zSaPmq&)f4p;Lys*|6O6C)qXd=puc45+ypus?Htjo$%@e9~9|PQ5?OW(LnPWFq~E zQ1WB-;sIS^eVIwXo2_gwbGdgH)r_aMOTpepVp@#GacV_&?;Pdf3FRXW#Kgexr5Q~R ziMdbBvx#al_&mG}A$-AuPj4|=$&UmvA-CUhDYQ^1resRm`-kYv!HC-6`nP+TB3h*( zQbbcstdEwxbi_0(Cy3ia-j)e7Qi*@sSg;RXhB47SLuq-+NPu%Xd-9%;hgv>D4_=@R z%2=veE{o34pp+T2ORCXwV&O~Ba}y1MjOgd4H2B=H*tWZD%t0-U8vDkS1T^VI_>D#m z%%r#%s5i5H#lo72#&jdi7Q7|%xHCQ%GRpp+24A)?rE@sH7v_Cpd25}|1!(~3wGw>X z)#xKW%qY(k^KMTo{_$*h-ZtBGgMB56ZT}NpRo6rOxN@#GWFLdh=ZjV zCe>b@At%GNbJ`B27}fOF0NK`D{uE+5@OI27y^c=BAng;}PH^A6+g3n8N9Ob3VwT6S zhQpQD87kOHFQ>yuqaYKQ!MIZJ7koDIKKQ(ixD-%yRuRvQJ+OGj=>+>sU}Fr@miaTB zz{q>05T+TIJ*c+Ub{i58-uGDGZV*$6EQ5iUtOMX5wFpDhh}R^kt6uI@NfVCI9K`p! z7Gl7i0bCwq!8piC`3|ta*_ZEGGc}QnBVj zVvyOfwZ+;+_N5;Y25gq# zK;-Hx3|N0+C{AKblzlPpt^?=_nCs`2I30WR^&MB=Ol3AA6Tnv9vivj-27xIh-_W+&eo&Lt#2+`a45Q@*cJijpaq$h9l!%vo z5#I61M=!iGoCatusxrPcme`g{LBCJXTl~s}^Iv znoG}Ca*gHesk-z;DVRM%=g*PptHd*+0Aq(NA>!@tS@%F;rZ8(9S{wNi`i=xwsZZhc zl$fok9HAn0hzj2q0i%IuE}t6#mVJFMcscm|Pl8XunR4Jho9Wh&qjPiJti5?X08cOW zYFezoau^#QoW{Z=>WjMPX^%@8zfoxJYGRbKZ2+6WLF`5y`;}`xfzXJxDl!eSDIw|+ z1A>Ie>*VlI(F8EWt!K{V+rnHdr}JgUVTXLgK?hvpHoF1*J7(6xi8%wd(0()a6i>fj ziOQCan0G-TdsiNNH8&f$azj+$!dxqpdPL2x9<_ZUF8cR zKxpmcN-3yzxO!NIn9ew(vP>R0-H~@m8vTGxo@ORxkhiUiH&cP-iH&sGCfk?<4a>mh$s+)9Vj&%Hf_*#hI2q6>;CySeKnf>k%&JeY%7omoy4S1QyDF zRiwhjswvfDOEJi>P(vBcQgKR!!JkSuFa-&lUNO;b`i_eF>VO{tuXgl9 z`2i1juw#SqqgZUS=r+B6Ir@iRxmFy~v&q%@Or3Y5eFojMNNdQQ)GwjjQzXBthw1>j zz&;TwW!s)fP=|E0m2-KXd=X*pu6&X%_jW$fMm&i$)Buk)oH&b_2{8 z=Sg1_7?kU2lZ)gmS{~X4ePGv%Iq(V-VPo)H`sO}1R-MMCmJWhABS}9Gu#}F$E3*>G zynIuNerm7Ak7#v{Wy+5HEpyI8aH*!!Bpiah6a^+>e7uBT&=E{O3varUzwheYnsa`4 zNSEl`qkgcjAU=}`UR~GJ(1aVN_Ow1}J8u*2q3tAZa~)l49kQFALnB=)>89JBUCv{2fpOTSGYJgQ%y&5^Z@a!+ zmBF$^<)07svpiF_KtPt!06VrCoSm(g?jp>D!1gu|gjr39YEO|Ck<2G0Cxk;`I$JgQ z5vlbK{n{L)fZ_hFwaWj3fMFE>XU59Eb;@uv16|R%f3|eFhn(RC?!f{AdxxxG{?$+j zxMqXE0@5u&U9*8(uz4?SPnoVdXVD+Nk0%+(1|zP zzm=^8xmO$jrhyvww^kn@vFrfP4M;4I^aGwVJD?~ENbEg$^~1Id5(^~#K#U6@5J>Dj zcy&hvAUALYZ{Ts+Kv&Y{X1NEi?x-xy4P3z+#JG1o-+S z%s;d3{<$0fI9cvB4K~0+*Z>BSA8co5{$o+@zl;yR*e?FEnf&dBVgocd`lTrMe_T&L zY#0AY$@{0Lk{i%#`JYSskL`kqmFs?Ps2@eS$-2>R!#X@^#4edcbDdpX-^n|WQ%}!R z%!Fp*(njuW6?((SIwg>P3Gu$(wLU{cVPdLUk5x}BDdAC`$a{XvgonJ~t|z4b0T-F& z=$P7?#Q~}Qdaw8IbwnK+eLx?07wLGBv|Y>vL7g5kSI>ZCW(WV zm#nzHKA|S5gimi0_aG;=mMs+P^8sIN9=~l5Tpox{)0$~q zeC~ElAsN-5YF6tFYt4Y&K)Yitu?p8GLM$E;|6w6Sp)_&AMOg}>+4|%IM_6}E6q6o! z2raw@!(k)Fqa}sTX4rC!id^iD8EVnl+?jJ|$=rEKKz;Dk_|UCqEc`MjjTc$${8Ghl z(IEpYbp%yp9u$V`HfS|5AJG`5dY39QEbopXq{1w4ID7B1cp+=h+lL%B5E!fg;))UH z=V1!253**cco&gm>99UjbP;%N1K!<~aPln6;s_FXvArYU+dQDo_SkN^Xi<6NN^36J!?W&VD&^S99EapWek4#36bWj5+-_6 z%tRI2)(!Rp-lW5^IA=9c-Wd%&Jm zHH{Qo3f6fQw;lPB2tSW~kAXOgMOmPeAbMs4HcoWUhZs4&Sq^7@-;|dD)cy7tXi@vo zLfG-bTt3K>=&R7wQ2Xx2RE#qV`+Z4=O%Swf%8=hQPjkFxZT-GjFZMp#W{|EQu@cqU za2yQ2@pRXkZ(3=Y@LwXBM>#OoJDW)%k=^3%9k+Nb*+U^E3}<-8(q2)PN6^}A3R6eO zCekYuUdp7e>rAvX7e4wWb9dJ*$`6X5sGW8JmGU_soP~Wt5}!I@V+#6`mTbOZUkS}q z^qhccVZxrTEme`9w%D&@ptrq0>UBMH3nZ~wFi^CcYNG93St@cry_16F=!O{SB27JMHqJ8;k77sedABQ`I%^YEzZCS@Yj@)ly;2qge0{&V;rD( zGcTh)I#CcRp-RcxzkT~bT&KNl39TTGh*NhkH^uxG?YUhkMxyao9XI-n)amaf^jB4} zRRw+D_GyCnXgXCy*x`z1;#IVQ^BP`KNTp05BqnPSrI^4PqP;F@y>OSWL?JM1U6#i* zC&W=$k>15OL2%hCJgaScIenC!MIn${x8)Kl_QcYgFxEPq_S6$4*jK0=|Ip?f;R6Nd zlo+^`>1Q%#CTvF)p*;q&2dfdH>aUDms&8z(>}=muXWrr zRJ(l-6)+Pd0^EynWkj;Pe23zm>kanhFlio~K8oQaNuDPEppX{vAW$~kyIEt#AIY2m zrh8fATTOY&v9)0*y}&}|C>lW&qCwjzlc}Qq^)}I#9}!!KEy3p~Xs!?Mc#jsY&2KhM zLnxBsPhTQ7FU?fqg&J-={wi%|>a4x=;YmSl_=-%A44Qk>G4})B+QIqf4iDiF<@SyD zpT-QdZ`nD@tXaBCFp)s&`3Too*=XoZS}%D+w@S!QxzzgACs|`ETguC9i@`M;1xg}b z%cEW`>?atbWD%g&JGR=Q;wguIxoG(Qs!+s+K^u$FBUeR=V(FlI>bXR`>2tZ8hnl>% zQu2iO2?5V3kL)Y4WQDD(`7!&1-|Xt0ceRYW1!sLEXF}RUOOwh`-qBas8nLVvo+{>w zq|vd>)p|c2@+{?oM(KR`X}Ku^M6?9^*L@h1x;ocSn_S$rCm$v?p7)aFP%0H5b2A^% zm^C8$v$7<=KZtAwv!^<tw3>aqRB6OSqe{E4p*DWeSP=uE^|o?C~u_slGmh77=Vd+-4j0aTHhk!9Yp= z*9OMHBe#lckt6O=pCW1A<+8ScDH=jl^}Kw^Kp?}8ea0}#Lj5(_NvfX3wj1bl+T{(2b&xmO&3 zLKPsf!14}wTmT6`VSlT033}W+yv@JWPyvZ$ze9rm%wGEgC)ohagFwz1Sl$7xmkm&Z z1tj(!ykZ3e41&bogIBC~@Cvvt3h;N3xcICg4GhP)ky*%H>*Xg>`8#Pna(4drl|p zYVzC4G~Z3EK!4W0Ry6h}_o{sHLCB?kiMXsnnsV-`as$M71OC9~A|rjBwuN%ba^0x; z?*SeHbFQ;eM`<}%p_m(xM1d!eMszItP{Y#KS#4v5OQCwlLS3laLeAOzXYgYh`bwZ-3-y4-L{9d{&i(bJo zrKDZ;qfx^{t6r@fMn}V`j|G(F-X^$;Ir&0U217lO4-2V%igBE5v}8GY3Q?W6{Id)w z8U0KO#*MoUE!(t@^&KYjqY8wX+~p)ft46wBdI&$rOxA#6Q2Pvp=xdB&u{q9JU1A=} zuqyV+Bd8D+kJV2&*qtFTbMH;M*$AMP?5f>Z5nuh=wsg5J|AiZ4$SzB#9BjwJt)6(< zcvW}ZckdGlUS+UaMes~%tj!{|q^#?CV0P%JC1a}0nSac3pE0T4-iJ{6|O+rIYZYZO+_wFYS<_5Y* z{hF``TEBHLtM4nO91vHw+`17{0wtbHBB_ z%$~DJrs#>j+1u*lHAW77@@%P2x`5x})G;Z2B5Ls6qXSU|f|2K=tgTr-e)iSzid34$ zNEG41@&v-?3g|&9#>G(V?I>jecyV-kKG~^Z=?tvYtKkrx`oSgQ#MLLRO`9J)Q8Kx{ zmnaX7TP1W$k;Nl!`I)3GxbeS@&<^@Y^CCRBmD#Y)@W_W!jg6)PIRN`HEW}V6qwsJG za<@sK&X)vqmnWNYs~ z`hd+DTO1=JEiR(VmzbXkb67LgGda<>@B-HP1uw&ZzUqr<{xO!)d9aKx#YZCbwv?Gk z42GE9_)kZ_Y~&Xb!hH|vJ9W|2LFGV;T~@JoGqKrU}fhTi>{GPg^FGj}&r z>&e2zxk_OjXG2?+wL&d0A!)2Ou^|%8`(9@5l zp1y_9H|<4Nm2}BDiNkKvSyB5)N+&`T9-1Yy`xu>DsODqV!%zVUBQYUI-iq0E|MjO> zNfJ@^nCfr1#iElw4F<%~)^XF=JJ)V!U^=7Xe`F8L=zPrL7I0NiRp2_tE2=wt7Koh_4j<>9LtjcEPp8YJ=VE4|U zASgzyud0pE-}F41JO_ol9c+6w`ifb3xG#2h6@8Zf6S(K*n!`xU?dMbBZ}?BOrb7{$ ztLc>!2FJInC&%ot=qE$98tY*%nuW77*D0_jp3z}_Ui71mMbJRdsnf^^uY_1d-x87E z)QqruEsO3LlMM)N%Ibs3lAq2TF~6P^7y*0ps^v=xPE#-|X~0rpMBL$|@LmW;N|3Uh zr|H9)x5(4Yluy7U_mSo@r!}lJBt4t)!oLxKy^i3$1T9AX_p3hqYwzLDiuixu1OV3; zE}&!z4nTees2j-7WP?9pL8lsV18$GMU7LW%We1&l!wsUo1kjw>L8snugQzb7gk`(q zDi5N*1Q7Ngo`+v=M?kkV;PrCeG3VdXJU~7p&O5w3zm<{rcUT}V4~RM6H7<}0_!n3p z82|zcaOHyHB#2Z&pl8H+7Zylf{)=&eWWc|`0;vFCEXUsoO~3Gp^B%mqqh~QUh*UwK zy}A<%h0N0!|$r2IWq5Y$VB{SKSQ&q4n1Qn?fR+ky4dANuoc@lR_S2it#V zgWk&>$^!U~0V>&$umD`5tek9r^veEJ$A7N?Ag=#1fc)(a{UNUZ=??vG7w8Xh{WG=j z_fYPi{?fny=6|yC02aXeiR&0uOY2!K^lw%z-}TEHQBFu#PQ+sJ`R4*Y&N66dd3Sa$ zMs+?Z$CIf45EH#tQ>*LAnoaR6Y@Y+pV0zqUBQfB#>!R;+Z&MZlik^6*0+Z`oPDF>a zhy{|OJVM{TTbI7CUGx0Y&upjaJ$RewaqlnbYmmt+)V^`2;Z;w01?pN;N#4v2y{K+I z8;gECb;((yVBkegUV-s$@ymLLqdS|ur!y)S~pQ9k}UP=ogpQ>-dyf8zDgcz9%!4A6IGZA=w2**SO z?!(J?G*XKOpBr;x#q^GDQ#69J>{C!%38^)K&B6B@+5-pE+|iiNYTtq~FBpsc3w37e zFm`3cLb@aOI;}WuS(Xx(Wk)=30X)#x%lBJy6$j!seScW$;{34IjY!r0PVXFL?t(;O^T@H z6fFk?;?xj5Lj8xSwn1N`dpB&0U~YTgaimbuOATslsJ=iz1pYBF=62uDs9kH=%nv@Y|T-?6c>IDz0;6LV<7%qvh`?Iwcg-?Kwy&g$d%3P zjHPn((lg@tvcgXseSHmcUvUvJOfc!%^G3D9_J~j0uJ)s)6JYkzM+puvUl+$nW;08T zG04^^Xuqqunlyg3s(90s87_In){oW3OX+C;1)&TZ&5LSQqi6175a&hJkO2=HEpL_t zej#k0zUoT&3Uu$5cKdpf7`jZ^Bi=_Mlpd+W%9{r#hlV)5NFKLeGt4SDN~Pq~jz?JB z7&JA#mKUYn*3J3qm@_UA_>QsAzO!qt8*8$MGa#jS4`PiwRy>mLB#Ui5YZfH@NF;^0 zi}-YL!|%%odHoKW?P~kpMvmD&wt$|c^`Pp5YKa`e)yF%$zG2<4Gs?%CZlM85Pb$Rx zhd;;Vp9h4}2ZUB&V_)h%EhehLP(@ZmMuc9qCJo;_ILTHq_x$DD0j>qy#x9wdE z(G>+1k1>_2tio=P9<0JVMlOH-`p8ka_%Y9%8e-bXz~HQx|9C4q#@qHWl~h11`yl1NA>s~xLtiO)JzsCUNIVYdh;HO(wesjC3>&aAf0lx-Lu&4kUP?=p+7+AHO&MY^ z)6=^ksoBob#^}V6G9QK|9jZ&ytyRGl_8gD6i#mHV4E-YWd&z0X4qqTFDI?V5t_T)t zx%7Qlw%amPTd&s5lcR#R3h&LL7PUrAy@E4kFNl)uXCy?L_3!(hTLda)jP#=x1eTUU z%GSrN@RUl(1o|vJXr-0;L_wz%>Gs;@Btg=U>NPA((@+!Hc_;K33Xb&Z!^C&YGHZ*p zvC{d(%%V3J+Bv1LpQjz8!pzQX_v(-*!U76u3i;U?REgj1q@W|WYv~}^cVay&n|{qGQzd+iTv!+sHar7jKZ-{%~}GsXlP6~A**X=O!b2^{mXD@ zwUU*F6e{y6Vg6rnF3vliHRu`*&<%aBhO<3E@<{r6K9I=zNwYX#D{IH+nD_$iJ#21Y=?0BOaMBL*B7>)7;QV!yEOzIE`vu#Rhf58t=* zJNargfx9i7N7`iiP&>$CmGW4XiH0{jQv-@5PxFMO`v%0*hzk>jrqXy$Z!mkS^N$2f?S#BQ&jgtkfjoUQTDIh%zw=+ZLq` zo3Wf@57eDvIoX^ptcEkRO0H8_Q>jP>9p*{vX}1SeIzE>viDOXuGG^(4cbCg1BQax( z1vbMu>t0fJ&r-kSDY=<#=(rxO>+^6{R^wMl+22h$kk7Y4xAOb48WkqkIg%#E_I)b( zQaYFRSuITHJmrXVHiV3r-0US1ziTt0E`EspP|YNb4d2A))N8uOV6o7L+ZtyjL$cHR z?Hirs)l;7B`uM&~5UF4KEw+N5G7)xaJw0=8iNfzpCJjz_%e+=n)PTm-*(13nh2Y_Z ztc%LMpmNUCW(mdm_RYR2?J~W1IRrsG6a6xJ4h6=jbdsGqS z(#>p9!dI_&TG{A{n9%w=3U;8gF%LGkjDM)+jg!_j(TD%qzK02y#{m7Ul7I zZD5-vSgiEvM|ioTw&S`K8lz#QZ%5%25AiuAN^1Rm!L0C_bJM<_mG_aFz#>nSP+|hN0}V} z7Dylgje9p1NO=DXERaC@7g!*H1dIjkngy&ENFe7uY}Ziu0~H|CX2u>YKm` zFgAhY)o=L-{|Q3xEcm;SC zAfGRAngQ@Lx)Xa3Ufqek2e0nJ0;d@O&lwOi4syMKFrYuZe>v~O-h)?nV()QY-HH7( zuQ&h~A<*mnGq3K({+U;IWB+_!-HrV-uQ))LePd?&Ex-=c`{+*WPrKOv{N2AB`)6L= zjr}vPH~{4rK|WvLxH+Kj!rj<=@aoQS@4>4(vG?E=XfrS~6L8;X;Pu{#y$7%E#Qyob zy2B^J%mf@a2Rvuc=4Sx*&%C-L^bLUhGq3K({`tK6!AH=f1a2q>v|u(s0Zx#F25urU*SiN$u;MG6zF~aEj|v^ zL3ua!H*)-y=*0w7aF7k)()+K6d@t7q8^9CF0$4s9Kmh~X9Dj0c05;&a6YMV!%MaTB z;$ita#qyrh090NCq_F--IAi5z{nIr5a*_P~-T)NK`O7u+KZGy-d~yJ<3c$kxSjCUC z^fwm^;L~5p{GXIFK%v$9`B+j^C9P+lVmBcUd*+KEkCPa@)Q{|hxmx-{;q8k|6^PYO zYQ;wLHfnmA%;xRBr{JM7ma6$_OPNKXn)T(vMb*Xo%e{GtC%EeS8?0h9H#BX+%Tg#~>)5k6c}v8bWz5C1n_;ZBif@@j zrs%3OGB3_hqjzcxS3@i^*@^?J4(BB{)NM%vhnre;A9~U7U>DpPb~UqvRe4goSQ(~i>Hk+xQcPx3ULjvYx zEBYNJAOsYOlYnm2(|O|20F>h_|I4C3hVvuHl5&M=D0i~>n}632{G z$rG6wi)c65mw`491y_O@E>}tEvSf(jv8J)iH29pX*`^heo37$*Wo(jRcWWpj%L6E` z8<@UZX&V&rieW9<`;w5nqn0ICnV{SfY>#U>`}|ZC_OpnRS^aw&-*B#Au#Ylgd)0vO zzPH)Ebs?W#_*#z8KTeVsqEJW4RV4R&VK!9L$ER0}D&ao8zgow$4SkWn%gS9hznQ^E z-_KB6%!{wY5%svEDR!scM-s-49T5rg==4t{tNb#F$a`8~N) zWRVAJ-dXg$Sv*y^$xP~B6CPp3i?G<4^?pqlM5AhikoyEFcADDd)CX>pEGeiCI&BE&&VM-1o4i6TR7-~uWqG5D zA{K2Wse`+$o`SW0$`Xtm@amb>;%&ejuW|@?a{&h2m(ceII3?$((2k=XT*UIKR}Fe0 z`p(>%#ZXl^rmU^UNTrkOLu2|EwU4@-uk&BGa_u=PZU`ya(U6=mF*;o3bZ$_q*sjt~ zW4b($m*A0p1h%Oci=e9x;rb|ZpX13~9gUFTS;LVrE|cf`zR<|m{aB)3_h_t+747Os z4TIB}I*=Hh&l(GZeY*-?XvyZUDdl69~3J!sK2c`KH)CbYf&}pxbEiGfS-=M4nbZvE9YlIbuOnk)+JDC;gilwczz} zj0BplMIqCSQESBrG(pQ1NMSIxQKKn+-tjnPxUJIcqU5+Bajd+I3FGKi={x{2g9^nh zZ2)D{7EG%r4 zh`g{>$OFeXE#G|HMOdX0sj-x#{~{x9oHQ_NS*vEZtmf)LTlJVVj4}}mEnlEBJ>Uu( zEEN-e121H7mXabh=goF@azHkW{bSvQsO|tLuDDKlD_X5JFeaUeGUut+m=4UQz0qsK z5fP9)%tE^`k(Fh;ETQQyn0mx{>~jw<)V=iwdP`|6yVRFm3df8Q4<54ciD$0lR#;K{ z(L*ezx6i|Mjrgd{q<;$hZR6!imd zFDG~XnV>&JKaG{8eh@kCTyEb81s^&b@%exxT_7OqA*{WICKQZ32SvHqHkSnIoQFL= zs~-uYO*vhjF<4z|Fh%0%?4S;@im479d&^lFYRu~+JUTC*CquBV*Q4vhgYjS{ctbC| zdaftRTxlMJ`{Y2|tb-rxe>}bw%4+X6Tf|9I?)6b1ec1$Z5?>E+R|P!626e* z46CdZrxzYVrT0g#RHY4CWanwLsiscl=*h9Q%vV*IWu{ZemSmftxABASuYa`W z93?$qT!VOIg^{I|fXQw+Mr)4Cl~aotY>1fAtAN;#tg!mhbjklw`Z7*Nxm^k;Zx`b> zwg*^egKAiNye*g}Y8)mGb! z0T0)lYlQ;yxeJEc#ZP$Iop^^bIv<^xzI-_Ku=pl<2+4ic6q2?72m!*1Bc8uI#Hi|4 zlEzPe>rvjk*?}#I>qtO73oO5y%?RxWlcq~YG!n^jkE>f5T&R9ywHO96NTLl~meK;a z(dJw=gSnW_uBp#Z{Ua|KNVD{^kc{$j#Y~)`S^ABecC2__bn(9;MnbxBW)z{me)&@9 zwK8qwNfJ*`eq{&((#ucGt_H3;y=XALkM>vj||jV{<6rnKYnxApP*1Yc|+XLqF{ zoRy(faGpg-=<5137(&0A-*d9PJkMT*U`ZzPoSo%BMXS%A^6fu&V;|?GaW_jj+zkk} zImPjB)`%A@6-(AtK57p(J^h}wbXu}BCZxH*Kxxu_nJTJ2A_T2VH<-9UY7^TSgXR66 z3AgxYw~v06;bLOANHs?NJQKWAws!(LF7eYr+2p6~+*Xol+wju>4K`_FYeDz#=iYNQ zNPVz5ALro;TVWJxUtkk|o)cn1i!%R0N%`z6k@QZ#8n`F!UJk-e>{7pIVHWaM-uzDM zxEe*kAbYHto{&&0`z=cz6DAT|p7<$R^ zEIh!V6sUKbg`YFMdYn3RAU8~X)51&0ML)n0dnVgfVXfd+p*T!LpnnTZUy^_9|7zLA zB!umxz8eGK>h!tD^@Jo=O}cG;y0LFJ1|8rNvFiyTf4@p;WN$WIBt20h$U+&*A$Nwe z)uWiP5n4WE*#i93w$&vihT5K@)X3G;2jMOVL6r|@5aQ*yM5B*=~`UA`mNOb`|`~B|E3Oa}t@S8w_ z9t8T1?gD^1=0M5|6#6cW3mgRt3Js|00a79V)`hj7}3RwuDg5^d!kZ* z84@Ki{@S^($B;Mev6&Pt`TH}sI4ycg?V_gs7q#li7;?u3#c!L3PNz55R&4UmldqcB z49cOT%#PKW==zn3YIx_

|vsGhftq|S3x<-Cq#3)oR}!ZJIb#knC} zukx5vCHO#F&q9g#juHov7ULvMvG#E1z<<1$^0F`1E+H<0#lS=5dz%+8BGm?@O&qqc zjbDi)(&!v1NEeAP$X ziaAZQES)l5Y&zC$Yl}FoHwkQsXhx0+%sJS_e|-S6JccZrB*}NvXZ#KV76M{a>l`-R zN2YrJ)ak=%d*pheG~SU-fee543U;dVTX<%5PA3<)d1G%{s_8T*S{msoe}-A>GR%m) zpx_FIv+~Pa%~r)ior^0T`3zHp6~d8vu^p95I-U~0l+{lu$&_i)?=KDo+})lr$gO=! z<2EA36NuvEOhfX2pDb%8w=?Ra|5ju(hOit-v!X~y*h`Bk>SGVncPMU^(`nzwW)C5= z_y+9!cZRdTwENKzazCL58L2vz@){!aktAIl;4&&aximkh>5-lmTs;t`UX8LJYDhK!E9~iVe%{6A!z^(nZ&jUEzsx=5AUT2R_>gvz|0m^5S_ke|yN;1F<9NR~=7a zWe*Y{(u{Nncx~i+yooDYZAi3Q(2^d6FXPnnQtsoO}w{p(C3Vj!ffn>qPZ;>fZ&Gh~=2|^_cw)luC zw|u^TsNu`Lx5AI*MXOS1##hvhe*7nwO!GPBOVa&<$J8gSlj~_Ft_EGX5@sdd(Ugz! zOK+SGu(_PFOc+MVhU9U=6->^DC5>7?LKUx!7KBCn@z9ORV-P)`7VUl}oXR)ao5#b{ zxku@ZoNRC&CHEp|`WXb#L;Vdjlb=7(^s&)Q@bu&U>j##;3Yy7}9~<;-DPjqyaP|-N z2g&1S^XdsFSi)=~R8d?hh;M>+$IgH*#+vo_3g#1ylnr1) zBh$Qs?u$&i?b2WJ2Jh$U!YsO+SId@gaKqwakfc$daY$Zr!kE9-C~aZzBbUi<6Gm)* zf4;2p3a!(8U61tHM9*7yT}?IY098Ca4Gcpn^D#si5&q@?FS1oMb4>rDMBECeL(*L# ze}C*ZQ?%w?-9^lf5=HZ`d+GpyFf|k%;YrBm2=297pn5B`Zl+IBTm9Ekz+&wT;bv&ENAqcyX z8oDt}nvLPv-?i!~K+@iB_$D9!S)M`z!CfbY4;~X*O^O}O@$>f(x;khm$ z?8;CQp1grao{ViHF*4W&F7Fr|GHo(&Xm=1D7^6l}7h%d#K3t^IQ2i{)1-1agiY{|J9S(3tCsocgpL+Bm#0KO*)hn6rXBN%J zx}N!qN5Y5RH}zMcU{7<9WHm`zuQC?D+>TbGv%>f_iX+-I;M2;%w_hz!D8G@*4(`@# z5oJY<7}DIF&NxGRBav41Sy#;}SNKt}jfxTM6Ji$Ek`I}!%r&0Af;hUc|)=S*sP zq*EEqNVuN^&6_<$^*bELHLub|wew$vFfwC2a*l^w8X}{}8){gzT@ z$<9C{t*j-MCgMn=)ni#KOmYWn>jk8)vbe-^Z&fPKsbiwfw^ip?hN7?Bd89-M8)s5ujx+BKrw``;z zmvvz9T|u?Kg*bx-gDz?Vm^QFX03I21(NX{ySS0{~IRHH_K?)S$5M*L)9#vEI4c_h1<7of`(MLV>4!hn)yO?mzD~%U#n3 zjzEuXpWS$j4{bvA0Y3(frn)^~lnNk|UT zZu@o_>ks7IyPtBE)SKRxj7Nag+Sp{k3(XBo<-IlmgIE$fDMWZ?%RHYao7U7X3y1{h zmW{IcFf;H1P5+3Ij4y7S`U$3dfx!p54Oa2pFQ)N#h2#q@-Fv+FTCx}%hp1e z54Vp`Sud--!q-H!^E#gd>P?dXh>@A50(b62~%(LcL( zJGb@s@JJkjy2Kj1eU6*LgErWMad|>O-s{#SDZbQ8ZzR6TM4~qs|7|JQP2lyrArFn^ zU>NWlJ9#>N^6YZ3-6KKquxkeKL&Flz33*O+zVQ3A>DX3%rOwT-6`<3U5Y}7IzgqNB`K?@Uf)A4n-V;so8}b_9p4I@~GAE zb)mGRql19^QDUqkWE$4R%wu%0fYH=Tb1+XaHLgb1Pz;h>WHcDa{Q35Fp9C*+Aq!CItH&l6NX#TAR**Dk^fW>q9_#7{UgCl`1Jrce~c zTZ8=4BH8`=7?%xDxMwn3ZnI=4cXtHVfVU>QyT;q+=<=cq(4F*PjsI|^R7kG|; zFAM2SddDAB)PehI3lZg@ufUg#+r9`dq9S!D+AM< z6tV=t&BlY;F8UZYv|lL0nCCDXqvjwbmS<@3Aq2eH-e#K@8Tj(2BbM!w2kKI8bTvne zb;j}b4@JZJXJoo@=Ho>$kx%HdgUPtJt?1#Gxl1V4Gw}8FJq}44SeOTDM0u8;tyWqE zH^mi>4eZ#llDyGqLXY8c7UFi=A;|lDG@?`K>)qC%oysvhPi7r}5zy+V-lgM>f`bX` zBi0X#^;$(i&^V;ku&UcayWfXlRo8K0C7UFyR+9$uwR8xIlBmmi@V@7;OL(#vt^G2 zUito8An`;JahDccF)&oDF+-Ku<>PGBH_^zj8(;-z*WKR#x;RAMj}(Q!PXL zs_6EGN`N%IxWLpc-#J*l3i46GQ+0MjaEN3AT#1Ym8W*;8e8)}=qAHW%Lpy!X)}yN= zs`>M`?hN>pN=~Xi(E|w1Wn(*$d;@dnBVNs5}wI@;_l0a7{J%D?<;G(Ut4ZPLpR_Lt@L8O;l15nXIJ_g zvqaVPwh(LQ7q2`yOXa);BE4k?!ZcFqshn7ow#0dFhna#bYoQftdMc z`W;#IYc=eRP`O)Pu^$IZT)0&BN`e#ce6dR?7L3TN630Tl2_C#w(yCrNM|1#ZC4a`TF(AG&yCVzSaP=AAu=)q_fvtQ~L z-i-LD@6nbaKegBxf^7khzL+CCUZ27HfbLWt%3B^Q2yuhQ*;=ZmqdaY1m&M3J8 zo3&FjRHnMHEo*nhLOX_`GU2N2(e5AP+19yatS0sa28X`2@vLq;uk8V6Zlz~w@^T*) z^zNCi#bsLr2d6xB>E=+lY*{}M@&uZOAX0^suV!3wlx%of8Z4r46t@c}-W<}xVya

=FH+i0=Y1?WOAY#8S}0y+Mx%+qU%^EGEvFB5#4xTj|6+Y@h!&-u8*`@HHUrysXTe+kavN!Rbc&bbOg z{6vPGQce8%LD0v1Emn;Pnb}43PaH$>WkQ(h1sRYpLJ==lU;apy{Z7Lc4_bdS1B#da z(?$4yK!5*?mi-}X{@+M$W}Sd5zaqDXYVNW3;0c7bpQely4WuO4J;2p zph1`W1>Dhr6(|Ta=oX>?G_XSy7=1_ST>u(bgMvWcVJ~0?eE#P>XTM8G0t!3d0}Z-= z4q)cL@)Pv)2J}@2t*U@q*??dR8$bbpRI$KWW}wi3^?^p;hij~$i}(W8eIKr|g3j~? zD6;!-?SBxXzdmq)B>YQ5|F=ICV72?jp9)aUKSunIBK(=I2BZi9iGcqk!hg!|aB_10 zFvOWzI2hZJFp68~I~a=^8(JF~KS21Qa_t@LjP)%aAUu7$r}_*~eh0OQ;K(yU1mzQ% ziKM)&Ub#?^z;GwF8c9SA1}w{CG)=D%O449;RK}Shwpi;5?F|snjQ8#F?D`RB1g4 zXqPI~OaOM;#rU53_~O*=SZ|&PnQW0taOuFLlO|^}HHK_9dxge&xs>92uAt~8_9qGO z3s27*s0&Gz9C>v@>!zabS_})t${$hs{2zF(MCy94cn`JExcLMyVpjD*`$EMbD#B1^ z9D-A=jHaK8)oIN!;#jkR^_!u#z_P)7jlaCI4L}>LEfK{T+-Z}fSf#jx|G>9%rQ3`m zjU?^}cVk!|!sJ#>kR`s_TBmwe)`DL5JS1xEbv~lo?E-5CAG&LQx882`tF;b!Kjt0w z?*SA6(ng)fVyp40W_5I(%+F5pF(YC+8u(R<2lC#}H|PaEsHgOsYoij>{XmQ!exj4U z9TiZ?1E)MZ$-@W!dao|y^3WGrR$c?XfG$p%5Ro>Tx*sJvMs5!Yfir|Tm~FHF|6%Se zpt9Q5zHeHPltxh+6p*}00qGKu?hZku8w8Y=kQSt*l$H+Z25As52oXiPr9-}(z0Y&b z+1_gnm*4li@A$?z!=roepL4Fc{#pk8+m0r(K9=Z;MXVX|@iJ1xnln*7f4p3b zOnzu>$yf@V3o4<*r0uW<$uEbFD7@;RlDXHCFzuhS=N3GXDU-Jm zVLDQ}w9Vi<3F8p>u&7YpaHEjyvKwE2#XDNngV%Uc{Te6JCMt_{5 zaP64LXu+HBdLpgc5%V>+0Yg~?sg?I-P1)nix?8B77lu50L>X^)dg`Nw@cXix-Vz(* zLuw##yj-(^hTuHzn@#krLfemRr_cKImw>6#wQqk-ob0H4qdq|B8EBixWT1VP zW2(x>A(nkFQ(PytWeF*GAnJ=UrAEm!T{jEM@zDEU?+cGSH)Au+&GMO_3MV=d>D0)+ zANb`q!=*9HHKNehAv)h(DV2m$O_+9=s`kf!IwWvL%7kv9H@fG?toDt$I!HOLF_y_45NLBikOiYn36joj_M(K?qTvVYjS&kdVJH_QJKYA%yX~pHklDly~3!xSHQBAn(+b;OKLq>Z96-=w8x<(ynUVHYvKFURh@G!goE zD1kU_+I|W7MQiV#_g6vf{H8d?jG)Y#AJvJwGa|EN4(`UP$}!;!LwwD>^8`jI7vbN{o~dk(N6uH4OAD&B5X>M$EB2HmSh2?nX53PYr@<(bjsAJ)Yh)+ng; z`*x@i11VF_re*BH-n1m_I_BSYFS;!xBcs9OcZ}vESFh`Rc_$e4^nO4D@pv_P7PT+s z&Ny9ny|})O6n6NDh5kWhoqiB@`Y`E)x$grjmDMPfg#48Unl#SJjOl2}qaPJ^i{%wR zs9h4ifhQ!jv`opx=%$epr#fBXg?=1qQPkbbbkv!l`AR3>0(tO~FkQtqK_|++2)(Ct zS4~Z(Urju&VSeOv|4p85ZNrx#?T2DTCArJ+%3$X2we_z)9kTsEUYxwpP45d6|Tb=*@ zivDkH*#AG2vw?3n5I1Rmr;1UtYwPI#wLPK+-IM>?e+|B)M}&dfXTnEDJPshjpt~f* z9U2163om^GxV=M6*+!f;5B#1S5Jt?|27tk~hVZ1@|5m{HmKb5$U?ISqh}}*AVED5E zPy3(R100zfq<#q}yza$sr_BxA`V;O!cY_j2LGkSe>xoz9OaiVpVjef*YJ!Xn~!^%@~ z7r?=_U`JhEB2Cmlx};+7I{ zXFcTZy9eQz?}y`^4`sCSjBPHd-H@C}Tgt~6BrVJedW2VC9bWyGhnQrs-7D>ZLBqWA zyv1~bKnk{6t8$w^;XNKCNJr*+B(%G%PN9)VdcN zgS5tpcg5Nbd0qz}bp|KpYx)iHSr}GrQckfb(4&Wzvh7$KpqQ#pvx)`cMt3ZUPCTQ2 zJ`*Gn&qzPJUHxgk*ualAk=N&RUel&kK(13@+OMG8ouF5?m;MQ?aXq$ag)rRI-+1-T zv4YUhlf>nN04}CZp@1hJv4qg63SHAo?zeJvEXdak*tA+XXxB&?Ea5dJ&NtH19KEJ+ zl|5Cr!E3^f4pM#lXw|(S4`#DMcipn6w2RRG;zitAN5&zXJd&a?c^-S^tGybZ`@deN z9!&b)te>36x2y8HrnJ~Sq`b{YO_2_qK#B-56^pF>-!LH^8n%0-Bq zgzM+QkO2WNw(ZaC-5dNdINxXm-KAy8zYkVb^VVXFla#7j6hB1g5`MXVSXaspqpU&K zoE$@qzOb@;RJzZaM;U&EvppumQ9NoPFWgo#A7Amr;r>SnecKVQM-R2XJP${wdQ$hZ zqtb1bW?tC*>awk|f`~JzlQq$(%tYHloOB?k`ZV0fQ}_55f7bF~*aH?^i`SEv92^Nx zaz*A#ireQiR=950_`TZ4J~lute<6i?AuXV{yiF+Iz*0{_4?ibl#V^g;wuMfstCL~^ zyO!@c3A=RPo%Q&n&~{IK7Blm*lJI5PUbT(1viR2Jf$z6qOQd)W1&(D@yZMt3)0Q~v zU7y%7*1}_d4QFOFXSoAva#jdk+-nGNtZ%7YepVl;1iWfr{BmQ<*ijgWR@&y zAi{xitK|}_b@NbR(E;+}N!<-i^0orInrfM@Ppk?-{dqMyt7>FsaJN^TuyIGiQVrYb zr!tm+`wy}`N`6RaMvZS6%o~OGYxJbTyfA{zFWmmVr*oT*68-7}tC_t+%w~z}bMjt!moG=bU^X*rS>DrUwp%z- zmg1qTkcZIhjv%Ra=7h_J_;!n1>z1Td|4LYB%j>~K=SO9MaU78tx{j7_ddvqe1Pdj2 zaG-At(uNhpY#)pJeC|kiBOIr#U^+E+RGxeD*7_Ho7n`!#ms#$!6kqDhRYI+&I*?g) z$=o_V+a{W%-BET58L({Zi%30OVZ-$D3r8ijJT7nH+?joWz-_G zt0&H3iewqA>U?ENE?eJ;{^~fH&W-CXc1l2F>%p#c^Rq%Pt)f=v{z(R=9rwmad3XLn z+&KDHRKpk5j5@A5$-%-4`*xqRq6x$JP%FL~_35c3@S<|YG?g$&5`QS-5Tj@?OtNix z?UaW3tY$;~qXVViNR3;aT5aY%WU*ILXqSh`iji;@?)b+xvfR`BV%4laG2kbbDLzYd zu(pipk?)?BcJsLav!&4qnV%f*CO z-WhJgg>T3zYibMv#aTn%F@e9QqrM;a>y4T>lmlOj zcCMLc++KCN-9wx$SA5Idt~Tg9+PJ{@EXky@^z{!$D{3DY{jzU5n-$rh*6~)5aiM5$ zDH?u%I#J6qaG$Q+PsI25gk(ZmW5Q-S1LFgIR8sk#=eAe>_sWJhj}BhZF_PI9 zd&EVh(op+PIFB$LC-1S!5%)Zpb?X#2<#1>I9$YrzsvfbLF1_u)=`h}-&vQ4ZzNSV_ zT2j(a)%Srtiygb2tWj#O-{uf~1Ovajv{L}{bijpfblI1yiBFw`s3PZlFJDeI^EBUH zk@gfnkX_F$Yh_?Vztnth$5XoN-VoiL%k8p5(*^c8IgRTN$^~HjSCb>B?T7NUqqUXC z+>!+qJWR2-RFl6}RVHy>vhpTi?FvCB5qt20_D3LolIIh%hcCKlg8SPd<+aHwC#@aM zLSL~zE5-03c%PAala?9P?`+Cw+dpPd;K@Kkhro#92jrmmkgFe;?rjejEm3;y_)b)8 zskYJYPC5^#ltz-RZAIP5-ogH|tKM=chlr6*&uz-g4Eg&KdWGJt)lI2oB@X?AsnE(> zt!5AXM_oMHnitcaNDH2Xf5sAcPtz^f<-1u%b?HjySEC)%)-U}gWAA+UjQY*aSS~(k zbw5VAE2PA9MunuK5b+V@0_m3|;Qy@)B+%-}@Q7=E_#W}E?BV}cE?K^ zWaoK4CHx#9!2kQ>!e5*H{~QzH$A!O7iU0N`!e8${eTjdcF#hMT@K+8qf-muxjy?Z6 zEO7I2b3pYaDmudt3yt-?XUH-S``W&yNLD*NAG@cTl&`*KS6LOZMY$vPsaH8mTvapH zs2P`lAcdHyH-GmYp4-l=AW!sOrzu9rR2#^dNbUaYiXvGe8Id%_sJYjh2Kc9Ap~n8_X~~Bx5 zJGtmmK1CXyiJW$J%1f{o-)FuVnDSHDIRCL!&OU|b^Y6z+w4Gt*6`jJh&)%6I#`gC< zcwuPqvW^{3PnFEvK#P7zlV`UgRZnN!TxITf;Qd35mv*!7^|;bCC}xW?xv^LoQ@3Fw zFR+zW7?qQ36Mem&-Mr{wvw0a!LQ`tVh_s%rak8+Mj=naVv45>9e9?RPxXQ8#XN+>% zH7J)YY=CWOne|Mez@S?D;X{efa-TNSes=yK;@V_!(-A2A(3xPKPWq{MFEt{-meAKx zc%+ncHQ3?c!52QinVsM_9dCBCG}r==)UKi%qC9h|_E2uaanLr{J})VF7ZDehWp(7WF9I}D zOFjt(>1f9=&!7n_ZkEFCm#@gjg;b_1n{aYT;`Z}B5<@k|+U_>{TM#m%E%Z%QUO9U^ zDKjDz>}}Cs({t$=4!^@giR2>(2Hg^>4BZle1+Dl7;Q|k$WLizecu&3IJF(w2+#XwR zb7YFp=ucg1Du|m`*G&_VXJSQjFngi9=-qPXs^MM!ggw2&HLO(W#TAV*_LXDbGZw9T zt9wWGbE*A-IjJk%8c6q+)%TNZ>w9ZDP(LYMxc0u~Vd|A!M$Wxk$#`Xj%AN-pmvL{Y zVDX6etuLp(>NnffHgJAemTljRDt?(Ib?YS#8VgmeJZhcZx%-y2HJR z`lev#q&Pmj4YJK6q#t+=)-mpLH8T`Cb%_s96ltn%<-5w`Uat=g9y@aM_1yYQgQVb` z^#J=B=}Eui$2UGWN?4LA@|V7tS|!V?-b*AqqtPQHRIR|0s}0Zm5}iUHy0t;`>XD&g zgEbowFMZO%q@*}&kwrmh8R?+z(gu;10}@}Dtm~Lgw@-i1itGKsmzlwiev|&Y1-rFkzM=sRs54jd^{yS@$i7Hi7^)VE;EE|&*gcFZ z#;;>gc=<9Re{7oQr62pWG#$}tS*Mfpye)^_egRm{xr z`ERUl_h>wlAXL6BUcV;m+*c;uxlUT?Nz=c!+p{c#X*&{Z!`tCBvZra~>>u!m&Tj~i_Tp#(OW*NWnfkvP+vZs|3W2ouyC#J8F62qGx zM$UmeORXbMPX7<(*@b-H&;goLSP%uxb9%Yh)<;g5gJvZ%Dt1 z@8>8Np?LJgcU#ZSqf?0xa`+um_?N{5iC(#LHC!wFOoCEQ4I}j1>0_5i4JjGouj=aU z#||4Pt*uL`-fsnEVQH27Y*kUzTh*wCTCuOp?W3hi?WOO1K9^L`b%OvM!nv3oN0MdHUcjY`y!ED|q{=ON^zZXrYR^Ywuy`<3h)q z{8grvsjnC5>^BC#+QC-I|HHuYSukG^s&u`N$eJUWfmYQm59&^}Vp_bn1XnbS+VAzj(9a@L+uQq51W$!?tyyrbq53HJ_#hI(_S2yRZ;8@zA3x zct7%%RMb4&dJ+7psJC@RPh&8PV&+lH@hrpwYvS=vxR0!13$@= zD|DtyLKtn9jq#0YJ^iFz$y+HEN6q*odOieb8_(2?W(M90I3*yhJSHH1eu=Qs&hoM0 zKy{y+GWC|oY-=?+sS|$`bIwRfWvJ{8HLTT?8{Tcw@w;K(H0*M|&bkk;ejH7fNvCD+ z;qrFE@@G1YYAKwT2pJ)6dh;abeaA*I!DG*m52J?fnhg!FZ%2y8g~r1zia*B{by?UA zZV$^((HeQkg@JLb+Cd{Qa*9o~kT^1-DhFSj{>OI}lSOy0zwnn5m0_ZW+v3lBGo>Ld zA7t-L=gwjTW8mG7qg3?#mPujtmU!<;PJ^HGWXKQocRr5fs}zb~4htM(6?SH`ZlJ|8 zW|Cr>MH%;|yi{Cnu)$$O^Deb^g_*EF*2H~3!ty*iF*+xTMA0+5S#9)g;1JbjY;=N} zNOE*y%JY`>kcKQQGl2qe_fr2G`xZz+47V=5c9rr+#bBZ=b!^+BB@82ro^VhOH+)2_ zwA3My;i25^i?aQWS`)<`bCsl&pzukMl@#k7Nm;4ZoW(oYpKn>7qa?h$vG>j{D?6+K zC4q1vL`-`mu+doY$gnl=BVEbcYY)*`2QK?!vLq9bZii`qWHD`Z+S9xapHB>Jg7Z!o zBV}2qptPiRE4GOgd*Jtpad-Lbhc+Lq!j2_2*s^AGXc#!(8~6(&7YEIJ%?f?+@mp;W z=LtT|WZAYFnVmdr>7KigIJv!j_DSNJ^@pl&!G4X%XYDuEXs70ieS=Ah8?!=-#QDahAmyxj(wE-+L8z9V9g4Fq z6sIFm2?Z4w*fX`Bu#LAnTr7LRQ#)a5f6?;EJFUN&7%US>_nQT!l-|MqPYU0L+H{3A zcC!#RNBQv$mM`H=1iq>xG^9SQddE$riAtuHNSn&$Z&=VtleZR@cgOR(q=&#>J*Cy_ z6lyneBmbRPq$K-TB=rXRqZN9^(L3c&dOi@0xk-(^5+WAY7R0SDinTBQXp(y8lf|>6 zXpITB!X3r;utwJK=c%}2Ye&%*Ld3MUbZl13x7nC)$fgKq{eeLI!>C1xpy2IoxNANO!UV(41_y_MJD>6ncimh zGifsxPMeM*G`~5(^JatXN!;;z0WEKCe0Jnl@nQ6>w>kvY^~}qvv==kstF1PR>HWwB zMW&-aipBnA_V;Rs0mD}VJfA2!%uA#anv_PD^e_2PWI%8t6>|G4t-+vG+o+vo`= zx^9F9+^Uy080tvtpqz=2rc=188(*iCkbkx6-dqZ5CstF}Sglx1Q6n`5OVyf&gPTjv%zi+`}z97=G zT$fO2espA!?Yzra)<*Oiseyj%ihp3?28Cs+`2e|)tL}tQtVM*!)M6fe5o~_6;y~l> zDQ0a?yiKo&Yg)N}t0@xm1CKj#S>@%DSUx5y7ZI}%>3sdOb4`FVPLeA|g~n0B9NYwgYqP(UkNfWgcz8Cv!1=#Bcdwowzop?}D)2x4%XN2tH}Oa5 z@tp8nY=o*&{%zdk_Z4a=&B(`a3IorARW>;5j(R1s0EDX0;q}r zeQYj(vIvMYFGvg=7h-=lfSH5SP_zb4BZhJO$;_c>4SZ}Ub`6|{V%NZFC|U!j{~4hH zY#n$(LN&Pn>LUQGIVcUqu7Qt@7%}uGV?)v!=*%H$4U~qYHIQ~0Tz_T8{pa!>kGN+9B9;UQim6)<9`US_7kja_ykc94OcB4`@hQ1D!b}t-&oX&{vQPDAx{g=Abkr zt%1^z>>4Ny$*zIYkhBI$L(v)!$QPIkDAx{Q&B19Xb`6|{qBU?Diq^nsD0U5;hN3kd z_}T*M93W=^(Vm0TP_zb4L(v*I4Ml4(keXp!0C@w5&kcj0eE?StAaUSNXee3(9~+9+ zz-cI21E-;A4F>ns1Fsqsy9Q1}(Hb}nMQh+RB&~s*OSk|s2msUqN<*=0Fi;wj)<9`U zS_7paX$_Qyq%}|)lGZ?JC|cu&*R=-J`ClpCzuPN<(@?YqN(1B)AZiVqhN3la8j9Ay zX((Fb2K$cv+6fNuu7?{QX#@Di{;IGaW!EnEZVsZTv|w?ao;GU!F5_OWSjUtdbScTPR$s$te8K7ap{bzfo+_adsZkEm9rB;rZD}t> zE34F*Wk@HN0%LfXo9al+eRc{v4Gz4YD~YJ{#aDbvQpAYAilm&_{8Y4raGEjt%ZpdO2%#-`=(^0_et2K4j6Ymd+X=5r`G$p7@$%`R zq>|Bt@>MDEJ)_}CFK40g3xsW6d$EP)W0{%C)F(Gda(jDT%qr7g3wPnaw*Kxg-7HpD zCDY)N2EPn%{R)b*{yWaI!XuB%IHEViUe%K$DTc6(UVC{z{E3V9Yu={Mb7s4bJE)I0 zc;1QjEoaByJKJ<5^=x^ouV#xI-5HMEy{8@O7uSxi@vbVSrb_5VjVE%{Hxl!R%dfl= zjz}nrsZ^8b_7*bX(=*i$S;N4@zsz1l>ho=w;UxHRU3CS7?tFN zcHMCzZ*|>rcgCh>*Seykk54J1(>}Xf8dDuc(sTGdhckD4lEl2N*zteD!nG!8tc(=t7Sgx}%zZ<32s5f57>iU5Q<4qlq97q;^Xfg60y?&Mk~h!wbkZEq^$$rF#(PUzf>EbR!%hi`lH4TYRIWCBb*&^l zE=gZ$Y?d8aygM`>wsLXP=;RKcG=^$n<$Zg-x))D=p3olD@ zdX-iAJ0g+Ov(Nn$?a6B&uS7qX>2A@#Ui%H}a9vJorlT&JI5C^ zjWR_0PN&ss+4GEPwQVVo6!Sku-AYHsctT;Wa3K&4N%AM^_M;qys;5-#`$$G++1+-? zrp#}?P^n0NCZN3cSSWg_13#8vUis|QdGew|&Ul``eXhAmy9%4XG+{>YBgTechamX> zFyeVLDoy0CVS8}K3Y z9<-p48dr{EYWq`vh%T;S|8{lcbH?!Sd)P(Ms#+Hn3BFxf6lL4aH!Bb5#d0z)UXhEw zzxWRRH^e)><%)csigSn1T-!xmn#Ggtglh(OfOQ7nza@2(r#-*e2+i-AL9-QX!uJx7 z@#r2ER8JOmUJ4gYyq<{I9|G6ba zoH;MNEEh11xIIFo&x^MM(}>$602-tlHrHQQcE6iB4@h}7E&x|I;@B{Fc02IQ5x3$1 zG)SK=E&x|IBFzoo_5zQMxD^MWLEjkSRveM$0~;H_)%_S|T;0%T&JA}R{2Gh`K*QZ_ zK&!?Lzp#Nq17F*61M~m@8XJs;q&1KdIouqOv<6B;(i$j@c*XE1&kady9AIw@lGeaz z09QA_%t2{LS_7paX$_QyV%K;{NQ0y8w4Ml68o<^4Cp09jfsPHyu7T1}w8jl`7UTvflZW`+;4~Difzwd5 z#truUhSw|ny>$Smp=b@9hGN&w?FyiA`P;McpTqyTYvk_`o_}Yl!w){cWU2p8V)}Ux zB<{bQ<-fW{xPPgm_dl)?7(c{{*KpU!Ulp&hhaY`WG3;QSp^dsxck?nV9BJ!C>@|J8 z&~aD#68i47=8b5t=c=sZhO8(Zi~^}i_VXzeN2jznpMB<@WOb^MlS_UX%Fs3mjeq|f zJAjnkM0A+@txuihVl7U9Kx-gJrFM{*i*TZK^}#iaiRtkt1vQDU=}&G4wo14(PBMHF zJoPKKbe6{qE$-v;Jgim>+rH={SMg{n(V|*7o9=cs&!t+3&_kHJ)6YdUt} zni@HW3o2tX9SR2i6GE5pYfXfec&K5j#2C0Z{)$Be{IsEaywxTSR2Um%_WEQvEF`x+ zP-WpSJ*ZO}Hgl0J#O*bTGv(D1@|qJG#E+_&p!1)<$a3{g<-z8>YEwzqdgF0k%3HOs z-jAauux_Bur`}@Hb(PvqP0&!KCfjhQ%C{QDAk+W)CC)JvYg8DW&8TuvONF;)M)#h$ ziI~QQby_{9&#`BYXLi|hE~BT(3mwKj6GGBPvELtjCEwZ*DS1aSfw`n^Flo=!bUJrHKFX{>Xa82qWtE8$5igybPnRi$Kip@$k$@vNsC3jI z*IkiE&MUcJ>}GPpQes1#NYKb6`gq$wRh#;LX!)F{&a09hjevq5ZzPY4{H#g|GwLK{ zIe4-#wAW)bj^Y^~+#xBP-TN^utV>#`sLN1jZA8yzy3(QfD0I6Y>-F|3iBnP=*Q4@V zgM(kAstrV^M8y)c58D|HY?p(PL`aTt_&BZVwVES>a?Ua%7@8`BZTYgQh3o9vpNjc& zW2)eA;-ET&tGQAVtE_rgh{h|GPpI%t_C{cbo+B`|5kg;$>Oi zs^l1W8L#oXum;}fBe-evoV*Gr_|qE`snT*zVH5s=f|GtyQC!9?v;$YwNIpgyY8UbJ zZIfhw{i{rJF7-2-OLoVj(~I~KiyK7>>D+l~WJXr0WD23z@R(Pu@7ubl+{hI`Zo$FX z&a8937X*8r^m#y#9v_z``H;6w>Um2?#N^c>bZ(s0E+(A);11r~{Xg2OOHjRGjp%D( z-i=08aoJ1v<4q{8l-SBNFAxQNz$GEha!9^QL>F}V+wySp^6luz0E;*gdvAh;NW5ZW zmln#a&UU75n;!@99NTJVIMO(mcqSu*n{8h-M&5eE`_pRKn5aK9(7cdVH@D<%)3sYD zD(_{*(NWn}oKBz0`I~gncB(%myrx)A!;#d=YDv$0PeGc2HSk{P^9R>7Dg<2IZKd95 zGSl8(EZ+^Q+EO2kR76_L9TX^~<``)x%b3HtrW+GTR+`}`Y005ct0B)r7ULE0gWM*? z7)vKhu{32BY4bGb?Q2rc8*Z7;+wCICJ~k_wCWa}}BqmNo}=rf`lR>Eu=-YW-vmXh z0f&hk9|j_q02{+$;7TYuEd-;TV zeY@VeBq~!eD~I!XGn2#);|1@P7r9^RNHA`$)e4v0Ig8g>IB~8iv(3C?5LLlON+|Dl zR8|VF0THA=Au!(AmYByENyy`JH|x_T{qojVxv?uR0y%x|rr-{ZV!VE~L|;_r)t;!F zo(_2XQlezM+8ToZyDXx&OLJ0HEO?PQXI| z58?&|fCh=J=7wiI{eEm-kfONU0P#_XWAnm~DZn#F+@Ju^VAnDL@ll904@hUq^G2J$ ze{LRlCtSdp|J4lgKYOF|gBRl1u>VvY{YMQWZh&&D05s3PYnJ{(L(v)xe(eN2b0}Kl z261I^{}mhayXWSH0lRd#;XQ7xfi&9siX@0#z1L+_$b6T22MlK z8ZW$kG2j~mDD{OnHaLxV@cI)Piq?3+EYmMhP{3;rPD8P4;4~Di@xZfEf!7?0*1%~f zb`6vUa5f{pF>o4+*1+k1et3c37&r|@Yv42#t%1`}>>3X|3;^(b1LRc$tT`wRNo$}q zB&~tckhBIy12~)i;JM+J`u7%@2h5cPkXH>bHYg2AYap4?+yHsih-1UxeIWqV0?=sw zPiQE14SZ}US_7w{Xbqf(qBSrY2HRX((FbhL=DE`Wb_F9D`t6KxqJHGvXTqr=i$2a2kr%z-cIU4V;Fe zwezzN;F|x^_Z0Z+4^BhT8aNF_Yv42#t)1U!13xzut%1@2&Spfdoo569jt!7kjYyx9 zfcW2c?Eg8C!7u6mPG=uebED zU)r1g`<9-E6aIHV=u26t)nhj)OVEfte0wJbB}-|eZ=_YhpOZ0(dL%WKk~mz2T-H=n zrP{JdWE?x6QPEnA;7Y>yz_RY=!UDD?T?Hm~BWKBxuPZL51b#*VdEd2ZEpX=BvO3)a zX{>Pl?M1jMKi7|c{rpHoiOKyFZjL!`ZeaB4n$gDXEPR}%tdvuc8Q)JQAwLb*--mn` zO!qOIQet|aQYx!D&dtg6oM4{ElFvEcGJIpSCmq{zVZfzr_-5*HBxb6YWPC==;ySlj z;Zk50N-Gl<8<9XGNpzVtK?ALXf>-jumr;N<$IMCFjAzbM=%P3x`M-Zl@3N(wse zHT#31eC(?1VF@MFx$&mD+^rL5%QqR%w_ou6q|{y4%w1!S45j45ar^YffUXRgBLs)6 zzOI4Qg$C_jd}Mc1@4l-#QdbrcD}QVB@Z(g9ZDhU>3~X8EX~qu*du&GRE0n^ld?6bNW~}IGkLB;sOhK*c$k33D;7$ztS|*hSTTdWEZ7NeKU7@`g+yNNjPbW z`H|OHP+F>MNMB*-MJ!2XD*kT*Q z+)%0S(_45xDH1lT_O5}*MC_0i+>5qvmwCQl3?SVJS2<=P52nDews`9|io=~J=xR<* zGHKhy{H0u|ou?`%?#a6YxjmdUOKtbGZ%OmvvLS{v3JX@;pM4Sj*h<5E4)QctQh2(p+c#-MvjaCv-9o6Kn-Bb(gJYaz;>$dWwQA+w6-lxBtv z8|mdT(YMc+UUmkTb4XZlyiL3?cifLXcVU|BI>jxGZ#k{~fBy&Su^%x zO%_bA_8IIa(l|ZcT?M}On-5gwJqwHPw`8=Udm78TXXaF! zlKkK^qZSjByTz#_-}Dk5i|$Z2!-+y_mpH0Jhx79 z7oB{S_T;{nCi+Xg7SxI9!-jyAI3!vHK94tKRnhKu*+j+Y1N%Hh#g9K$xyZ`CaW6OR za;e6p%FevPA*m5ad7a}a7K5e8!KYO00&YQ~%~g7o2_9}Gufut4c0*~6rZv|h>pYA5 ztUI-H&RQs9HBUrsvt(dt9N#ZW%VId!H6woweyl|~zkzfw08JeYo3J{@Aq|h7zsex= zO^oc57m@H^^P2F+KaA`L?4LTYyQFDbvz7SgzVR2EdUL2=>-F5QjJLS!qYDRw*vstL;y7Wn+;4OZd?&*9{5!# zFpaoz1)$-ZL|__mG~&h;fCh>7hXM53M5NEJ-GRqO+_(bJAPy85K(|dq z8tiHq#tlhpAh`lCfM}vW7#kp(2$ALmaYMiW3TONY4Ml6;56ca{7;@6 ziq^o#Mm!|_$=Fb|#tQ?n4)A~ed#eaa0~F2xm^s+kzr+lkA58y*hNLynu_0*RX-Haw-)#WBZytawWPs-er6Fkz zl!j#2Kxs%?1EnEp4U7hG3?r@@SYbOJcuDEs+ZJ#diq^nsC|U!jp=b@9hGN&iX((C) zr=e&KoQ9$`Zus5^@Mnw@iq=4B0LL(Z*1*OFa18$m4M}UDV?)v!C=EqxTp(v)p1*GW zf45fzr=e&KoQ9&cbEN>vJ<52Y^ZkUpttU-S zJv?P@lO`!k>+?%J^3smk?pdKG3RQc}in(3AU`*ZVfmlkDgYU9E3e@?oT^^B|Av*pe zqz)Si#I}<<&(arDHl*|ai=0Zqdy!Gq5sfhDwsz|WQX<528(R?mt$j=0qrWgXN@4DQ{GJQnTSJP8Nk~Iov1C&XAD0_bI66#)LZlIEK*4 z-d*Fc{S7%i{#O*)A8a$@svZ2epY`S1<}a`FYdel(l3B)t=PG`Tx8=K!(j%a3T=`MQ zSlwaW=~?FONCT`TWk5rAQ#oTL zkXe@BAzgDH_p+?v>=aX|(%r_+zhp`5reQqC>UW*PlnITSq?LX@z?r8*oiq$hWn%AH z>cl&=M=5G)hqC)V=K9M1F_{_fz8BZ63^&0Zb=y|4?YZ5Q#!iyMCFUvfLehrux>hYwP4rz$I$hQPm_}=3!mGe#Lp23eCG3ep>6mrN?rIBmzniT ztB&paVQM*C3_Bl#;a$Frn_s@qXLlY_T|~9j8e1U@b3nCoi)g+3O@= zYptiihlYM9&|_lE%#6j#>crActv`L9cjPc>@*c;4t@T5K+s?O6%PNhN9eE8!>>iJL z(y)%kOWjJxe>?X6=c$8IWv*~#`q2e^tU>P1ol1k0B_i>+5u$gSD_I&1r_l&+tM4zE zSw1&CAejvHdz+JFKK6khHb7MFb3{^}oA_|&LddG(7{$15Tcq2#kKPO3?gG2|`AXht zj?b3J*iXy}J&TS9+Pq&6Yd5~O+o#U>_-+^HzH}AR9V|l0o!#&%CWhcb z(Lwcze%Fb%TSLwsd^Jgx0W>?exL*oRx7@zO>UxVUZw`(0m@CVN@Z~hAIKE-q`=rU} z+Pn$e@7}GU3PA)vg6^>fUC2ZU5Mt}0;R~C{3cM3A^z<$x+Er1qoJ7-AZM z4*p0qrdMg-XPRDRe%C7ZvK<=*Ey{b#zk;Gvt^`=JyHZXC-{0h%^X77k3sRh@Xf zDH8%r+oxQ<(bs4isg#gv(AR`5xWxIz9!HnqQLGG?;ay$&Qg&6SI^f4!GIsuB(^PKf zDZ){@2tg*yOAf;L3no_grUj%sT5din-J+qYm3S+XYl!s3PtQAI(;umo?y4aHwR(|+ zlpuerSs)o2COjC&L+nd<6us5bf-S2t`QU_}3co!%YE8zch}upx3gt(lEnBd@P*LBUNFI|=+oKWK$@U#4+9P`IPV1T-y7-w+W`iD+_sGe9+2?g6F$E+ zJa6_6Euw%2URMwT4H8jso`eR0hM%GV_ptDj(C=wpkP3i2@ERHrXpkl%JOI9N#8u+~ zi3#8V@Qnk|APE9I0KRcV8myYld5ezUKQ|2QWDnpQ2N)Z~e|3KU`}?uEK~g$+;K_Fo zXt47!K&1`DnRCHg!vSgyz8=3Hn+qiTm34au&7(vY+UN<-2b zC=Eqx=l55@YYs(g;4~DifzklJam4oxPD9ZeI1REt zNp|PaTfevG;4~Dw22MlK+IjRH@R~!>8aNF_YhW}lfNvb&je*RZ7r-};NQ1@2^8!@p z{u3ICT>~E*iq^nsC|U!jp=b@9hN87|zYvhtc;OiizyB!#r=e&Klm_sP1H5mrnFIL7 z5os=vTZ{9C$-jSYa2kr%&bxR3t~o%3Zp4|NlYsc&KD&Q-{r=^r{oCtzo`QSs_4`K( z?!U8c&%J)|u3+$o|JCcq`%9nd|MB|qaYIbO{hvaaSI)hD7@DjzQD*g%q&F{D%6e;4 zFSV9g$OM^PsMfdK|F97qZyr`g`B0Bov2E7DaHe~9aoU65DK63T5NQiYrh4#mXCG z_|Kwd2QH|62qAn#?mM0v+Lijl;WCk(x0Eh+XV#QvC&svDUfzH<|8gNxb5hpxi{qT% zS;Qn@DQoxSAGRBJnM%cpp0rNl+zj^&TIWiCJB>Mg7Elm^GC-ZvW38Lv#KV$Hu+YDT z=HO*Y+-pjE&_k|cAJJybdgIo$Z{|D_ck7woxErge z+BWsh%Tbh1N>-ObzyS7gK%arP)2*f`1J9Dy0!>rXMZv9rgQfa3a5mnoz=JUQ_LCKf zZu`vma*IVIw+45;9`Rj#Mt@yPo8sokK?z;=`}%?n zbAP|+ulyMPlc*SWjx8ByO_=%hR^~I*u`Rua4Ihak6IVRLyZ7j+Q{`+TmbBO2l~dss za|TooJ^! zuc7b%eEV)UyXmx~ft&|xnaj*eG$(T$z`7+@bieyuge4!ya8 z;mrF{-i%JCc~Z?7^=^ks3E5*@NsS%JiQJapV#TpCB&C3XAb(AbfHhHODyncDth=2L ztcWgF5)L@at}JYlOd0v5nIiXe})q3wsK@CvGxn)aqv3r4HO1vZ_weWXKB?s+TlA+1xQVdLKtIAuKHRZeiO`_Z`j6 z2muifdu9$({P}B)eTTk{Ndl_;OUOZS{f~Q;B-rny!N$>9PRAa{bU2I(Oscj^Y<$J+ z=^Bv=G)BY5WBiFvlgFFL8y8HlHNr+S{O0DOkB)7MX?2ZF`HkV~$0=`uDURk&b7QZr zH+L`Fw3y`CPo9z}kduAs!Eq7vh%>!n`ArV(edWs8wqYMhHyTDm6Q&`><`n(QjxutG z+3Jn3{srf$GS{+P=z4Bz@&0M2)|FBPA?TZne(ar`0_fw_eHKg*=h>T zBwG_2oB%0156xD2)mhE>d)zg#T~ry#=5tA9^W1?vyBePhQKB%A&oXrfsqlBVe~w)z zQ@7w??AuKA+Pdj{z2=ynSh{)#59#o;%k_@+Sb6e!mf48j8C~qpM%e8!!_C@QGD2dq zcN!!ZF3Sr&WHgk=+SfiCpHLgsp=l-?6UW&&nMD+wn4*3%3A6%$Tv zij$e-LqUZ|G11%$nUoV`qIb0L^67g-o@VGr&C1-yrG9joEu*Cah8ItHxGE!1NuM?n z^SDv#PD_S_ORe&4);P4fbEHnsh_3UIo$KgGD!gmWN|j%^t!AY60cl*Q z`njG!b*1}QLwnw+pe$Fi#3=)cd*)oyS(L^p{>77tpM=kkVqSkGDwwGDwMrS+E~+3H z+V7atYx^Mcm}1bkyXG8n57g5cm05Tm>r?Ph-5To1j*_6h{es&xUh_b>+vTZ|+l$>t z^Cn)ADn7I}JsiZztj-DJ3_6m>$V^BSAEp_w?k$RY@w^*H zbp4)rAXnRc8yeFqrIU%B`3E~DjA?OHG~Bag)5f$lwic5UGcWIUTCtFb-Yps_yrN30 z%z`Q6re_TlaP0|HViOj#$3)2bkGaLb#~HJ@C~6U& zsACG(Zqqx2*Q;I#hSf5mSrb6>t03FF)S8=xQQUn=p3i9B{A@;XRDgM8Y z9AXh)%kL)}EOHk3J#q-P*sy>cG60P<@dTc106Am;8fk9?rt!~Y_%s&rW`k+`GZ}z} zG!Mf5R)M}5Z^fr2k#^(YvGLFU02*@J+vZJd|NMzbK(gPkfZB8Xv0;%zETHxrKtm#j zSj7AN&ohTwE{Go&1&ur(aLs>3!~cB@27h8wNL&?6qtP0iMx!-2jc;q>uQ{AXqcu2< zMr&{y-`3p9%<*l_t-ejNg;b|t0rB;%&}g&<9~+Im`B(G$jYj z9MXvd3#dKc3XNu8gU=kzz6PgJX$|_^sI&&@f`SFa*8!^rrP1tbo9-gu_Z!fZd@Ez4 z(i(JZH2WHS=BV~HNS6dGpeZ@vxuG;FtwCv2T7%MPv<7Qoj|Ifn@t+%(U55q4*SA8W z+1KD>qtP0iMx!-2jYeydkX+2oJ?Ed#$Z#5s*5EW6t-)zDT9ZIBU4VNFAij>T7C4P& zUxU+Vv?h*3Wx+E?qcu22=xwo6=xPR6foJONHIE_YYo9hi;bmTShpHoLF zq5h1h{6{5}_-~a^|0;g^6%#=^^8;cczlGlaiit>wiK457dTKK2j8sBhWV-wFa?Fz6 zqI%Ww%%#_WSeni*C$cTg5gT@O)t zW&&A`j?XVVlZ|gI%zqx&OMR+d-RZ&O5dN02Py)B1-d-D%e7dzSm5y$;W?YRd^eOxH z-e1sSYt}a6Y$3K|bnCUD??}>JWgIc!_HmZXj0=Y&|vqun}bR&%o0x^~_N!jiCvL$W5G8mubs ztLB-m6gDWw#oCu2=u_<+sANi_uPNYyzSwqq7 z#HD?9M45bzG2L7>^Dcq?sjLF~AI_7l zE2?>CRwNP3=cEVtYepC?Q{+C(I-j8z%6OHA?7MMKc-$WO|6H6%9Kf1b~}Ed3qz6Lsv5ifd-2OJeoxJ0o@!6Q-W&X#2!P zu}JQ5K3{VELQX=-^$lk8vF!b4#-Hy~VPZ;1%q;%4{pNKMp%-ehWsfqLjUH{NUQwtX zV!KECkw!b=^2C0D`v<1`Ub&@YOHh1eJj9r)XUFRw%6jni*^)$yJD-ByzIZt?@ZR&r z;0y0B<@?TkEDd!~J3jFGRAW&5H@bQIjnLJ1Gi!5S&nxuk*BGg!-CoqRRSgNHU>G5a zr9N|5%FJ4CRp-&dBU+hU>$?vxDLS3;3Z^q>`5ylH+`9s877J%fy? z6df49CefHI624DX$uDV=_#R?8V>Dk*ySlHyIBz>$L##)=5MyO&%Aqb;%pf8yEc)&6WTTdq0K}RBX z@}&~BkGj+%AK6LE8fhBjim!@0pXzLlc{gn3$Ygn91D_nmcJ3g08=IiUaG+M=F&U9v z9D`~uGgshUC3UfmPBNZgmN{Dzx?lf}Aa?OSopRL!+G8=&yrLX};dEUqGkkJk!Nvpe z?@ONr)-cTa4P0`WZGL>4tSITv>3sk`DQ8ymHAzV8VkuB~ z7;nv?G$=g01saXk#36SmN&UJw;&&jn?2a8m(<=94K_`FXQsxQ%B6xKb;x> zPT51g-G5Kn`&X9Urg&M8m^2AoTDywensM=@AbqMbcc2R)%{HdywFPUr z^5eJd7%0Q6PfPAyQ2VIpMdp|i(q1Cat%H3qoOwM>H@2Ww_@XOCdtaJ=FXPQ4Gd6Xt z{^zb~UQrFDA!ZL|b8n-PP^a;f@$67_iZCYakuE9Cs(qnub*GKf4?}0g(QyqY6V@~J zsOik`Ai*q~X}#+!9Szfs2f5Zhk2yLX8SwkKq$y0c$PV$RGx;ovzTk<-y25Z^>U``_ zt}IE6C|#!!#{v%xU2SQXZD80}!uv+~@rU(B9nVaDZOh2nd-XFB9WimJUwG%sHOfHu zG-n0T@CJJOi)?w`GvSx0A8|iDFL>(T^+pz4_GRTa;ffo(tDV(xNA9=jc8z zg{@QgSmsklCeC5W=h0B1afx@QE-g#a`Q{>`5t+Bg2yc~~&->;&SQHpX_`oeMKfXAx zB~41#tT?CqvYp6qT<*5HOJZpY>{NydG;A-{uu}XT0lKCY)j@%T!t_2*g7{@qx$ec+ zzK=DoTA*Kl#_kiIjw@-N^A$OBImyZ+?Z&tLwGx5sat&HE{Y`D#1s>8Ri4*Kjne8lh z=-NAcPuFNTJ6o&Lzi*dkZ%O}JaC1!1m7*=v6=(iQOs}Sq&~Pv(_tS1C>G zzTBv@f7~MU>IU-{4vUhJBmIX{?IY;buN}=ZIOH1Lb3bHx`n-MY!~8Oa{L67ku6il6 zDbXqHU*;~Hz!}pt1*P*#Ji07z)V!PQm{A{th;i!vcXd40dXDoaDve#QPZG3Q%^7!8 zy?ofAC*7yQ+dZ;?i(ffFN_wdNY+OTec&5SK{G*1Mmts2IDA==XJ!NqNxAxv-<4Ly| z4LtVMOK+%{c==v(FQeX}oCg7uM_juz4)X2SG+ME1=rBEM#Jq2iJ>y|pH1ng+hc!)D zp7;+61(+SHHSx|+-u@t$Fp1RHZd$IO@$po(NRIQaUCOr8@`aZ<>@nn)s*#U#uf5Gy zyEfUwT9kCE1;edcm$FUk{CLx4?cQ#Yk%h2lpZWa#9pHzm%Ppzg<4SO~v4 zDg8{zy!2&k*Oi@YYSa%C+gsf4N;k3Xo+Z^+)3-6z1P%M#S$2TL29+2LM?%_%s%BeXkUtiv@s2 zx;6lhhsd1%dFGPH5dci%zq0Yi-t4;orty!5__PFK9E0hO{4vD)+0lHWKXyh0Od~QIN4L%Jug8*GDwnF2ZB3q%+XbnDdG+KkxXtV~W z(P&Ky$rAv7V)&*AVAY^BzA3U58sF^Q0u9Kr0nmt{27GQnmJNu8>`X|f@PFQ!q#&JQ zq>zfH|At1THR#x=v<9V7X$_JsDuwKKD4rWiqtY6bMx`|v4al;=SIcJZG*D}RE*4v% z(P#}mHX5zLX*61c(`d8?r_pE)i#Wf)YmP>1a2k!);4~VoL1{pi4Zd0=k^3@%&ke}3 z0ny;>e=UTv?hsU+Jk3~Mr&{yjn?2a8m&o+!PXp&*5EW6t-)zDT7%MnEF1jK zd-K*W;3tMuB>eM!4yV!VYj7Hk*5EW6t-)zDT7%PQv?c+`$leU{p;>dtu87!a{|${s zYtWhhmP!M*iNqzq6*f}8#cW|TM5({r#Q*lcZk0x(HF3y|TvCAWEB<#3PNUHpoJONH zal~Q-e!l_XSHR4nG#ahJ$3~+y7>xsjU-4(Y`OM%4|E(qXrn~-+K*N7zlZpP8P4#o;!N3zK(9aMi>#~3!A{6w|X5!4-{CEog! z{@u(JS4%>zVIo^xKKsvaABecfyAltSx(bL#mw1~mR27#KjJE9ZkgWTRmfriSN#)yEb^^lc4)Yo0`_T8{}6m zIya_&o?8A^HejB3-bE(a?S-k^F{6gwhOz-8fkm~_wc(8~@Wet{pn(N=~bKxKdxp&y{0K!n#*F38EY!5~eA~iJ8M~%ubue zsGXhcyg3-uaa}#?vGDTesaB^dGr!P=FTPUA5&H*)BXWj5)Px20JPs|FIBIb3&Y*~T zOXXz7sl@wx+dn_@y{(}A+S~1@xBN?zE79oO_({0tfQpsouwT?{wduCH);1(j-PCSvx%=9O8oF zi84oO^O<8_9z0KBuD@G7y;jMDh-T@=y_P$&0+IZlrunn`1o!nUB5v6$>7OU}u-nu> zzM9mhq|ebxx{rvxkbYc%ONW3jQRr1{!F2G=)0MaSr)?xFUnkyVal)R_p35W~+Ss2+ z{bc+58#TH$-HOS}!wS^y@{==KR>* zqvRhsziJj_e7JYM>tlqGSueBoOV)i^b_d@J@c)Rh%Urep=qV*w%9&7ZFX9l`B0=x= z$X!Z;zTJ0a`G5%o?JxQg_x@Uzrt%E`be+Z($-;YfeAiCur1svKO|u`b zB0Kd^Xw;u{k7VPAqXp&)l$w0IsyL(LO`9vIKB`}tG+EzyO0B?)?hKAt)?tN_rXq)7iA}W$g%kJ@cvTdR# z&Qw{ps^6rs-zGiYMM7=daH!+#j5Uev3>nuQUv)xGy}QdTEUGEr4`%2{9gmaek!PyV zWTz3+`cX4-y~ScGZ}qTR_G}5yo-qvVYG=rd`Eoyou`#QuJ}B{1#VRvL z8tJvB+u7t%tn8-rf!P8M_W~5PW81e&T3=z#j${51S^MZlE6MHL$%w${W7|Gn3Jf}4 zqrsQG=W2a-OPTXsD_ZYU3?KHXGsh@61*;`(aLd>1t&~ zqAJoVlh<*oVy|+}g?DX_oOX8ab}zvmjq3W0J9;6c-2z^?i1t<2X}2ZhCB<``O7l+(Ajd<(ZiveU+SnPr0C z1mOa?BZ!H4MSbo1>_RvujaVfd`yF+UCJ$C+?i7hXq)p!0%`oAweJWVWgG|Iam@Jem zj^+(ns9^M6W^3ORU!|*$GK-x?RZIkRsLisn#q}Oi-RR?$(RK{7UGJf!ZKLJRU|wAe zWuBlv6(komSyN-q@vuK@nK{olKHbyVR&tm5vgCb{vfG)#b9Q@~-#M`GR-`F;lk+P7 zYb{6`$hzA@BC9f24V>9IHyT^2i3u)`GRA{r9Jt?7eEz3m92hQ)=;m8{^Bt&)^tky~ z!~^*+EEnciwa~Bshr}+##C{p7zy1?B>LM@9%@aBDpIh#fjRPd^;1E9!@~@$Yj^F_O zj{r2}jyv41=l%P+5$aEK-RyBz_b zAwCKmp#Kp*Edi;u$NiS-zj>Ai(2%Ne93XKApN8G;gZr%+1bA$5$UTy{UtJjfNiE`# z#2p+UaR-0q7)T#K93XKApN7R4aDcuJTcPnS{jJbwv<9C!zNNpFvGJ|1t!U6g^;IBEH#`h|1g+`+_=-7aWGhl2;?KKV%aR$+l zeGL$C-U^LIYm$&64jiDb!&b&dqc!;0XtX8)xgP`vh&bcV98ROr8k|O>H7E^;I0I&m z*dM^}7$D-j6&lUHCIKBAjn-f#AUMFi3HURI(`d8?r_pE)gG3_0YmOh8!Jj#tMx!-2 zjYexwfA=5W>VF$1h`;+!Z}}ho?#+&}cCz?caa(2Vsn%z&%%iMcZP}%-c3Y*()I7lo!BY-3~Yg?kqr zG3Tq>>z*rlu#3yEh##?Ao+y_8*ksAZ(d4P0q5Gs&YH3~K`1{OUk7ZXkDK^vMV7`dA zZ97k~9BsCkn)7|wV7p|8TlEZlSHVe*D-H6wLl$Dz9<0A~S=KM(v>2OcA^)Q0q0=nG z%JgJe!S>A9y5}1%F5=QJ^_NWF?U@R9kXM#klej4#@2HBk(~n(pO^I7>aVp~$v6EwQ zr+4%hHYw((ZF~^9buPJsUwA>-TPac zyfpgE^k>SYWp-t(rndFBc$RTJac*-iH)pid=+jiA<~zlxG-t`>aXY_Hgq=%BT4vEw*)K!#ZJf65GSyW2JQz*>h=lEH{tdz9raL*6N z%!DYj*t<8@?VfSn^!)Nw{~R~`UE{&LHzU?ne-XnX>e@9?LuhWNqHU1nkp7zEgQwwim1Akn4Q`7eR zk;7UWSF)R?`-5bXLQZOecfCTRpQpsCXuit%|K*+vNmtwRth}_nr;~Bb|=z2cI?f zUm~+Vx!01=fP<81xj}u5J9ciRvR2z)7Mol36}Mpf;{HNEC3Bu+-Hl^UCWoV2GSW}{ zj2aQer0cCyujo8&x(#6U+`;-?%IDnI;~8`bX2+B)HMeyt?j#Z zg1eLFNLI=5cNAA<+4Bhph8I~}Ua%FmM6B%9WXc+nn9OW_o_jqY$MvLRsWXs4IugNsQ$0aUgw{ z*&g$il_D?sF?E7*@<)@ruNHy*RwwR!>O6O?Dz?IV_I@t^k|^CsTI-wBKkF~E{HcI?VxJch#5m~4b{CEP;cBO=tIp) zc4BY$+7H)rJ?633PAApJabJHw-~L+p;;Hb28SUjpU7a+Vm39NIRoVCScZ5UrM}v)| ztnKK%cOR#}9*gb&_WdcnQtdqOK@s<}Y$pe0!U)}d*Cnk`Vm+dR z8MKczM$R4cvK47x zVrvdl{6R;jwZA5=^HJ(n8t5x|6ku4^5}GgRx$VBacBPtu!!aMj2-o3Hi=m-m^Dp#n zG0Q#P7H##wl}pqkRIpVR88gT5=5}WVnggR!mU-Dy4^lLb`;Z(8RP2oq8~#FuPz&{B zp+ibb)X`S9;~jEL%YzrJaL%^Ag2OB(y#n=L2?LZi_dd~7sYgOw8F0L>lnXAY;)Xbn!I+1Fr&$T(>A`d5th-)18C8!8T^(d=t*8jaTA7Vd9J z)rf`rr)~a+g^PR-kXQWXwPjdIDGTIx#{ZGSwQ1l=|B5pIZs1D)7Crvcz(tZY(b>24 ziNj7q3bdgg53I4zbQxMd5fJ%urVFc|Zk!YRQBRoiT=>yO9mn*iKHu8%qiAT!j8yjS zxk@Ac^OgLa^QBkKXTKjI2%2m2JbZVR-1=TP&0ezbSZ?K*d?o9Ub_-qUhe!H%A3ZD- zW;-GCy1}$be|cQyaun62>`|-FdjjOk+g_D>`*sat)<~Js#nKaena*T$&SncYi?61f zmS2d$9Y5?@VEt{QMJkCu=AA_T(n$~2(UP{=m#53U*r}xi*9aI$?_Abj-S*`84$Xe+ z*h}vu9QAhUFj#TRQTZ|%^e30Koq2k+Y)U!%$^riw3r5#xC1J8bMq(`P6K_kpNc$Mi zdP*|9kW*E;^V*xG&n)>Nrt)E3TS4Fp57j(b4tsw~a-QHv-&nIcr9YmEerBX`yTR@o z>r9cs_2W0=A3ls&sT~O^DZJ6;oqtsQ!`+VD3<;wFv0Ij6rODWcL7z$e9V!V)3lUFz zU#XbwH@#+6?2_$Q`+!Bc|L9jPp-u{iAS$W4Q=$9^*(|pSwpzd9H_duyW&C`B>Q$gd zaD1zVR33Y^UmtzLtJ_8Edc~A)DQm55tB;>c{OFh{uG$mq_|_}@LI(M0g^^N)AN}j` z-budRGiL7hF6K}6WQNPJ`DPH?Ti!3?`WETg{7ggMo9Q<5-X``>ygo}}+c{PH8Qb^k z<l)T%}ltCGtMe}sr;U_WBC+Mh)EbNR3s!W z8YT3~I-w%Vpx}m2dx2x+C;qz|@2oxgSkvB+9KITFRoHoCWqmneenluG^iYxeUY!v` zXFY+Bd%H!9r#Y2hxvi>QA|zN6o%I3R8q&WdS^Q7g8vl`?vSo8Z8jyS;{VSd0?@1@% z1EMq_`2s*g%0s0A$rk_`QXVP|NWQ?QvB)75bi9-XBwqk%NKvgcAo&77BU!TGvGETK z__QQ+)$k7t02iEMfltFOQIrNGUjS$%Fa~^XK=K8Eh9vq(1G=W*)8dH90v;Rx zzyP3;Fe;eFKb+#zu*(Ldf6Kz&JZ@}-#y>D@g+`+__{`C04R%$5G@#rcFmp(Oh%_Mi z0-werE`8u921vdD(crL?G$8q6D>NFdVX?5W(P#~pOec+WB>Vkf4465@WS9Qc+Trg9 zV|-c?wxewnF0@-CLpY4WX^jXtV}hH3>9YgC$Q&BUZ*g zYYk4L+1KDSntcsUqtY5AX;d01koqs48<2bf_`DJ08n~|kk}p6sG@5rP zoJONHIE_YYo6ih+a8xf*m{b7~Iee+Y>iz%l=KcG?w&@Q1Bh>JRI}n)gg8M7S<(EJ3 zS4qpXYaE<%LYo4=kKJejEy#3*hnoBNbP(wOZm z+rdW(8sEOUi)b`u7|ixEKGI%VT1s`N;q<9aYJVL-8ywfr;AcY~@-tCXz+UBPQBiF4 z{`^_-BgV9=pAxPah2=Gr{;as!-WG9QGW|@0;QfXhx)<-n7qA7ypSS2g@pIt&o;x?+ z&p$IOn*Q3*D0`=xH?C$Q``Z{#pt9;tGL{3-ufF z+NgSn+vn82zTz}Yx=8QOTu_7!cy?!ou6n~NJ>_cXb=#{ZLp{dfv_IRw_!V2^i}^eu zyq@ne7@+p8CGnx_$|F%b-!7?jqv3wB^#X_cdveVpLL`Ry1|Jsxlp{PMV-ZQVV_%J* zz9nHyD)whlK!us`SI7Ri(GX{+;q})+cQZ~(GOWftmr+TvtK?hvD*EuvOP9xnpVxM~ zLZ##Q&4cPZ(s9N%HFVO)&Q{Ado9YQBy|f9tp8w|@31i}US$S~ADo9ST>(Tg%c@gy!uXPg5U?n9=-j);O>?MRDM1t=e~m z6GwdrSy)u}+^^<$tyqlDNs+m!9ku6W@tY5B{s9_^?^WE(-yUQ*@yL04GLcp_di}t$ zH!3=`BbT>Nx3mS0J*dvlJ2jZoo-c3OSaNPYPFwtt8R;(lJMHB*YZc=0Q6(J2}GQcgD5}c)=el5<`=(kNTc$qkLQk!eMo-C^FfJ+6&yeoKaFB$1R?}HZ< zX3O8*9ImpUj(?Zb)bnaDRcXghmHpkyrY8>0_RxOTc6m0sQq^H~xoY&wBzAD2jWvP% zRNrxzx+i<{9z4AMQhn+|#`|xRMT{p8|8!}UcU8u?40tp7UJv-bFf3%C?${Ak6e3bk zV^kp*sxD_wuJwJ#1d~+eOa$HZvWu@9z4N&f#(f$`6*3EV=9oS|MKbb6e%+dP>2m%T zGs)9WmCgKkt>kc{3A@D7X80yM_AiTGIPGE;)y~vFlcg}iVA48sKY{Ctufmav+YHyL z6*UfTtPmf$Q26n6?5AM=_-hHT&JvVs?&9w7Z%Q-r;4`lxJrFWO>ZNb8-=CN>E|u|v zzL!DAgG4eMab;n=7SoO&A(pzG3@-O|_l51b!%voQ_0#9Zdsh_C`09Sj!0ZSoY|MWs zapPr?!3z!MXEAQ{7*YmP{Rg{U3RlZ)WPa%BJ_$$PCi>vq=#Q*UpW**++5x_w;YIN!B1A!G^HxHeL z`zrm0jOP{a*Elp-;ymaWtP7vHkf{kzNJkb`&b`=J)tpZDdYoFA8K#|n8VC!iHfd?M49_Li`c=r1!G$n7ByjM?lD{ZPLh((`Y`lMR?sT%G~ zoN{2DnoDAolDo3d{nny{+NonlN;EMC#CYt5l3I9As_ol`TT9)*(L?c63(i^fj zd(2O&)$-XBni(8;lpMX|n!|1x)uLcyAMKEMA8j$7+-$v*5A0|Ku7tB|1m9FG(NN|} z91mwFkA6vd3L~7x8>N?A{a6}vrf;gsN_Do%s&A&MCj1qXhVp_s&(t2Z1)MU;N%H7{ zxbbjVF3o1*n{OX0ns)}Uj9BEVZ18Hk3xCH7JcrYfu`M z)}S;htwCv2S_3zfMAjUY)?hR;Cp_Ob{wD^d(d=uGhLRXjPy`rnY)C^%ghsQkK^!dz zjYey58jaTAG#ahJX*61c(`d8?Y0HSL8XB!ZX;1_h|MN!n5a7E66an4>jb>ki++2kb z1vGre-;v=o8m+-;G+KkxXtV~W(P#}$qtTiK*qTGu9F5kXG$;a$rxrMkW?zHTXtX8{ z&UC zH8_n*Yv9Z3F`|Hm@A&(gIFv@EH7JcrYfu`M)}S;htwCv2S_8LRK-L_U)?hR!0*tRU zD2+;MP#TTaHs9T#7r2=8Z`EcB{V2$Tl)P@5@P*VHlZsnE^=%YH`#)PrF(}~ zJ0f+5-(DSY{*pUwBgbnZpHr&)<^2U#A>tX!7Z)cSjackM$gUi1>{4=@Tyo`j`IM(K zGWrDNb=4iq;%n@k-Gk?(#y%cA=z1*iene7a;6rS0;=)WzZ&k`i^}93gFT`di8iv@v zxya2tZT>Xyvr4dDy+!ZM>#+)w3I_`o8TqayblU5(sZ6eY-4XdN`G^n)l{$-(*&t`f zw;U<1E6wp=Y!#ee_WHl9*C0u?sU%65cG7*`#7t>`WxK0J7@)!WU76`{%eTk+FBCoV znz0uAMoc#ySDqvgPLjU%>eN}Qk~&Kr?`9)29L7_B!+@f==wU`CZIK_Hp|`k&2*;!A zFKQW{++|UHkz(&)m|%Q-S?$E!jp~H=fnF;#zJ5hHFRQezFv+zn&!Q@Xy4c=vByW%oh+XY35g%joMyv>~EU3BB#tFX*j~FA9J-`_qq-rS@ zzv8EV$kjx$X4Ky2=!Ta0CHfO5C-;L961PO0G^r*e*-~HT*WRH#U~{=Yz361u!5w2I zPkXEyB)_<_bQzsf{&GuG_I{FngHyfHG$&KaO27-t3>qHg>*w93U(i_U3ZNt+02E*XHyCk9=3zlax1`Ld)UC z+cms$Nj=Ket-Zae@q_9}Yg?vfHz|foMNelBdj3k~HU3S*YLkc)Q$~ zQJI=?_F>yeGu7uYS@%t%(yl;icKN~URfjpMNrJV*%a^R#E4c*@E=_yr)F|j~KTMvp ziV3VCYaFi{zc{^{FyAtmu4BQlsYEd>E+%;5qu!E&UT>GS=&|u0tM69yRH;YVNJnhz zv=#1Vcq=3Y)ADmwc(^NzN{~H2D0eSS(W>RyWO(R)>fJSSe0k-&z9tnc;qLanla01D zFS*MQ5RqgjI!<#u{NP-0hgghNP29^&EuZallvIZm8r39DhZoW#KV9o3r-`qU%?dNS zkwlxU$;kN%2bae?8Xt8QHPa^M$+bJ&BU!|*ESmH%lby5EsxZat&E}AluP%3L9y`D9 zgP5hHr}ku-U9aJQj&{h~o*wRFk}BTinbJJWT3MO9d03F2W^A2S)b{hDc`4hJqLH6v zYV9EhOGzGNX1=aDeYE>hhqg97kI_{{RywNPf#>~{m4ad){+gSWl^jin-RLY~SyA&I zqdZUNMY8ib69uJZna^v|X1ew$=a`DR^z|5e(mwCtBKf!)9=eU&Od#6!<(rzCk(9cg zKOQTrPe!gUIqwh7X_m8MdUB> zj%*+rd~r4Mmv~1u5DmU^8zYLJNClv=Naz#j_V}$;4U&chqLI{HFpYO)1JU3Le`Mx( zrYL}xL}myc`|k%c@XRH__xmAZ|6Q&S8g^9u?W_r=C1Amx-?F73G*bQoer_~cgVd8E z&y7ZF;@~heMif8%4*0|{NbnLkbNui-fQAG$k+IQe4Njxc8k|O>H7Ri2G%|BET7%Pg zrYLCDpkt%i*RY6@1OCL&Xbn!I(HfM-55EJRTN0dZfi&dCGex&VqtP0CY&2SvK#~)H zYmR?!3Sj1N8jaTAG#ahJX*61c(`d8?r_pE)(pwuNh97^tts0a@r8OvxN^4LWmDZp%8m&RP}y z)}S;htwCutTHAbof?uM)e7S!sboevy@UKD#BwtGsse1o+-;+Na$Vh3!rZZUVR{;OF zItS#pe^=pO&R~o*7Qs~Q&Uu`1;}TIlXYFxD`OGQj(`Wv;*Tdbz?Tob})eiM56(*W7 zNMp}GoWZKRp>^o zYTAkRtZO%%NeD63H+A+~ubw5xDgJT=vnOA?sl!~V_Pkgsb;RU{-48xLj?8Pr3%f|M zEtka-{r$c+QmtK^)LqKSX?AW|;az()F!GV<>-56s?;9R(0x8rO<}OF3>c8-Qlv>$b zl-ydaBT(I1d8fFWT;QYr$9>ihJQ1(2n%jDE+({Y2LY~#8lP|Bzq?4x{J?zQY*WJ|W zvE=(>k6Kf9AOG~6|CkNuv&cY(;SDznj%Vd&!dk}l&{D_{a zhlcN1`;FX`@0FJ4=8ZPg870ZhD*e(~4_=xOx|}&veQ)NTpw}5AzO)y+v)ZIbU&i)k zzK*x>sm_^qGm&Ieda?PS_K_@~+($Fo+Rjg^v5_nD0Y@26zi(N3WI9Hb)2#j> z`^|H9CV_SBU0;4gQAH4j?mzXCfi3u&+Z5@XoQT|+Cf!eVGa7HsR5|C`Pq(*MMcLM{ ze-I=lWpYvDOCDCg%^V<%o7dEKyDOVwt1fxWEINR%@bIyIejn+q5=_tIDzD;OrxRX@ zt#6|#%n5Il6}i|movA>Z7&BQxtawY}Z2E8kr|K$og6nynXA7ie9~=q?`zG6{(rcH* zX4gNzj+42&AoOw4??%d<+4Tl?Ew}E8b942F+IGlIE%f>s8HzjPkH5RyAEkIFo?t~h zb*hTuYr=X0TMdn@{nC_?>5ZD|>_a2wr}=z}v+aMf7H-_|EgCg^Ot8^KPIarx^XZKk zPnM(rqQE;XTs`pULxvaZtq47 zoE$IQ{C?v4`pNR8*1cb{({d~HUs6eaN}QS2YyJ>sub%#E$aSzp;usfIQS!Kv0)-NhdL~N+VUeXV`(eY5moZ?Dd zv3iZvDE+1V8F7H0Q; z%=aG2iA0|Sm#AP-#lx50X=a2(2eS>RQ>c+QZFkKG(P3jwVp84LS~d15X4Hb*aOF!~ zZJEYZ2iB<}t&Md$5Al_qWjBRPWJr2#hT_yI*vX|I#W6~@91 zg8Yo{`s#qq4&!Bq9id+xb{KzgnCJ7Ae6Rkm;jSc^3PeBcxWYSq*|^MSwef@S-es3? zicfuC+X+mWWa`0w#Lb4w|9PnVU+^RTS0xF^I|2XwF81pV6EvPfG5nM#P46B4*b} zDNlfzL+*gWh~eKj0-}+7rodz4pC$2Uj)C}s#PCy|0As^^e`5G4Pg|n@eqscx1wJ+! zt-)!0y9IyM;4~Vo!D%#FgWTeT5yMY;0}!y_kPsS;*5EW6t-)zDT7%PQv<9cqXbp0c5=IO^HOPHL$js4b4NjxcnmBTb2Y%jwSS|kNje!(His6?^ z1KuSVNI4_Yiv`6e2B*(PjqLFp?7vk}|K(uEVle0&?DZx{wzVp475(_d0p5_%oBs0Dhj8ljdu%(1jCH-J z3snZSR$Nqabe7&7T)(G&Byk$6V67l=Hth52%<$l#RJZJfjcDG8%t+ZM;Wc+uj#*zx z5KE$n%*>VLougiUZHe*dpEA=B<)+kj{`{~+@OrXV^;GhwF&5?CiAEjz0M5?~IVIlS z5BffT+gFy9kU(o-E}>miW@bD*v+G;YiJxzOCg;sQs4VE1{>Ukp*5X@qyltq}Ysu%E zSbIRSjKjyzSJPs~mne9~7wPl^<- z!FyvuiY?Y8o-eZOrn>(EPZWUZE? z45uf1`M_HJM{X{WBcohV(yk+R*|sXynnjT(zhQfytjaAZKcXGkb4%DnRL+5h(%{wo zO#RZN*4g7OvY3~Tim=j^dqq=-PDGL$HMog8yjx-S9q4(7O%hJ7PZ7FuB*IMo)o7WM z{^%aVqXcY330TracJ@8#=Wb|y62FJrn?WUhIy!-|yZe=yaU}Cz#rw6*1h=^#r_T?6 z`%pFdb$kDv+_gJ4++f>o1% z%=!j8RTUY1CaQHKyl-qX{>HraNNAB^`rLPuXanJrFzxOhsTOD3;@bz_m3vBZ_9q)W zB+(bKI_6r|6WBR<|F*MNM@!ibx&GZHak1AIy?kBv>Axnh{yEgz=QtXmv{F`ADorI3 zq}{yDW;;%5csMJLk#RMD8|QiTg4wJMdxfN1URMJSFKf&O+G|P5f2cV0Kp<54qPgUn z)#Q)P#}5YkR|1}yr&=1lh%xdk_0jS=(e++BOz!kH)%JqyDbttM%0Jz{&T)oG1=Y>& zu4sReBIHZ?j_J+=A_}aim)wi!vPaI}IDc}oM-=lCPvxVKD& zvrqforObv8&+??+@n4eNyHiUuTRmibS%V-@uJ@cJS=L4Vr5Y!jh4If%(#|S4-wUmx zUw%LH)ROEN>yM{nKE1O3drQeFQ#sxJQob2J;8;1N6^YZ#@9@7h@H&KYykw2;IEMgf zcwCogk3>xISm(14JD(axHG-c9u97Kxf1Hr#7h+sA>^L|nI8SZJB(c_9Kyi$p!d@4b zO)s?W?kDxtv(0MJ{ic=tYD3zRFOhqd(X#;^K_M1(BU37o`;saLg-ECGt+pOGz<>W_ z!@cYw5+co#eRqO~t!ZVoA2JRozPTkx&PXY;XEl&J?Jj*9pHL5B>iWr&HI3SH2@!OK z?v#4$6)j9@`y}o*RO%-$o)J2{biH*Xns=w$Sqy=75;4&mF9lOxLNe21!4HJAoUaav z-6Kq+ZQ)kvnCGJmA>>dv9TRiu%I@)rF0$=0O79qCKV-k$`{rhV@BV{@Q_4 z;fC#8hg+HHa4iGejk0_0b9HodbWgb|WnkHTqSJ|)y2LwNsYtxK!ew0@Bt(mqx>l2%j@)u~gB9jL85&=sSzr{XdlbKvC=N}kKxB`|U7bHW!%{FQ%5 zcq?}#g&fpk2+P)4Z#lsry6sd+^#?KDiqJ*V0vSTvl5`RY++(FE!8yCdxXquYhpzJO z@O4$N(%Jnm!?XC!iS^w57RS0}BKwWEnW)*?>#^O&tPnZ*>***7Q0)?@B69N6)2Yje zQ>9&y#IX*B2i^|VeaNK7u>8j5hB>>(wo(#B%b?-sG8Ny9ZWLbXC`<7r90}iP`)igcBz`tPVb7j(CP@RZ3#_7m1C znD!sL2@3S{G{IpCqzA*_&Mf~6VT%9BbZ4a0`ft27!?cFq^8=t%aftDc#2wI#jVKbR z7NkP+KVy-QZwa^)60+uKv<7paBi8?aH8vWp!N*3UH7E^8I>P^s!D%#FgVSiV26NtH z5Cx<7ykXyx-)tg?TA(y4twCv2T7%MPw1!0jVZd(*AOMd4d1E0ZBp5&ddF$^F84wyNVMx!2L+q8WPO-=kJ&# zBw-nY-}3`-Zh_K(061XHVPgXV;9H?lX$?9yDy@O1s zMx`|jL`>l6NVD4o074XV=ZB)4NkR)ABZ4)f%W8^ zO}*fwQJJJG(0;;Qxzq2^EnDSrU0!=!qPksFsi3Q9VRW>Q`9A2te)?X0!zCI{q9Oaj$Fntj;NI?Dm$ z+?>4m(UZh9A96Ae(6myyxyfG8Rw1zFdVH;m$cpG_GY0{8Ps>`-j@L}PZ3hqf?#57f z?-xjCqrbniA1CnAOGtpYlc#=@n6;jg+0rc0+ZpcBFP4eTg&cC*4UVhK8<` z$tgq~J3Ev+?U(nZv@Vv|fOyR>2$qxt>4p}c0|A*pFsBLUi> zf=EV3ri+P-dG>x{OzZxoI0Bv``A)g6I`c7Y0#Lyl}N^s*LD_bkd~8NXt&^W>myWgyaxT=QEtDa)6yRkFoDSH;l(SakgJ7bF3vv%54S0s5TpK06iYM1;C3H$O-W$ty~ z%H(l|i7Rq`Vd8hQ)6Pv?oyZ_odW;e6zTzCkX(AIyp}-cm@M2C=oxx3F?puyj*=?<#N$#TbbalFJkF|`_9?Mm3ZBtC^u7xBU2Lm zZblo(94<<9uafMrXds0bb+G)gPT!+-&kM_2zPi*D{ou;|PVjO!v8Bt0eYc_vl}}m^ zWb1bZofNF|JodifYvJ|zi1N!(p4+#_h4*BizjN@bdpF&(Xh-`ThT*xj`EJ*3 zM>2ZqemK71K4M^1E7I(4dcAd;ky>TaW1y!0V?`$9U(A+~JoCiY_>S@-_#5u&apOlIt}VGPx$m(Od*&3RJ<@;kMyPU{Iiyk4T* z*1F)NC3{AXf>v8UAh~&3@qksES-H63qUdyX&4-3vI$`-WgN&-%=eui?-yhns|BB0r zAFTVvzwika7QcLCluUW^)+;xC+P88OD}q6CX%fd3i`BE=?@cFddTE*9d8kfCrun{} z*J&P=_nHM%!lUF-PM1Vds46FUSF|^DfI(6dOd-`{i@azyvi4_k}vX> z(&_~SHpnFS2bzTN1f5?O2s1tKz>GzPuq{_mZaSrpbM?Y^DhA7?eqMX=nP{5}A1|^f z51(4m*CRS~k>!4g`;fGX-7t-Lm>IFut>I94)OVR%Y|hU`2xwlBpZC-J-v47Rf$-S- z?3zI4-111F-14F!!Hx!29y#h7S|3_Aa*1JlB8rHJU}ewV)GwMDX3YA1Vgs}MBYln6_i}Tx77=Y#LXnNre&{p>bm_Ri5B&Y7ik#4{G_wDH!$th3(as$@KkP3DVb8^Kgdh^rgmzkq z{2o05>|H@5ra{o?bP`Ap5~7F*CM|+4q5w@p_<$HA2ku=#B&K27Mnd-#781hj;UNS; zgZyrY#57DA0kjRV-oUtS1R&{kyGsSeItzma9UKwD?BM}%-Jo%PVW@ci9&E$X8lZBzFjPDr(>8P;NFiaUc>W$} zSXu+xhNU$i4NGf48kW{TG*mnv{#}EL=VQ`<1CYW{@%%l|u(SrW4QpNl(y-<=APq}v zKpKwL5P$=a!sz|-Kfi&&G#sq~X{dNU#`6Z#aOO2I4d)#Srr~G}OvBL{n1-V@(7w3v zu2b;P?-DQ#OKX5*!opDTe9Y$!q+w|dL_@{%;oF8d(2nWt2?O%8w)e~b{2dbpl*$uE z`_BIx8jjY$w&7?EOv9Piz%(4KfoVAN8kmNoHDPoY0;sitFjPDrLu+6f&b$VuVQCFG za#&ge(y+7!q~U07`+h^-^k0F9e-~!@J1YLKgCl~!m+2S!75?}ulp&1Rmh0|NhA`rH z8U7v05EFpefx7Ttm6_7;%Jd3+LaA<_?V}=~V}4!!Vs4e$U@1@EpjY2D>H8+>k?3RR zyFRnpQa{ffc4qqI!w@l;H&Ku}=pxr{Cy{Eq9n0Wwxn&t`%7@UOpA^2%bZVi*Ac$#Z z!+!hhNUq58`LEVl4dyFrK5^YI2-25a3)%x(JA6E7UU+%GZOU1{KFAXnOHTPBYu4x0 z;CS#i+%4nSpWR1n6VfIG&y=JNUXv@S`%$WNZ|2$h#T7HDO?RuDEs<2guULjZ!tqg( zEQ)Ps+}3EMdwfo7_)iF@;#TRO#rCgdC%~@QnDdajLR8OH@Vq9T%$S^h-RP^M?n4y~ zDV~$s@;&$0tOgjUl}=}jW**DV_rTiv%J*g8xe=bIE=r5Lmp+^BYm3D*!^!gX`8iE} zA`_|Deq!>igm->~$cGLy>6pj8W9~+bZN6GeYqR}tmx$Xpaqh>6JobJ|W*hVI@o^2K zSS1=VX{DQKQm<$qA-+f*@ep&>Sys`I{c3urV7%Psbz+solZaUg#$%Q5Fi|cTtQ8qJ=I6EnPoJuM1SSwu)Frl52nEaZ(cDI3|m7))VSzlG402_iAI~MExubBi<(=VjAzG|KRe7A&3 zSnn&=@YRk~q88RCy&T0)rDR3qL;XBHJpU4E@>=_jn7Fo1T+cx>Ea5Zh{xLmNn+&iXXSeH(lEbcnPr>~7tfqGb|S5#L&fI# zD+ZmOeY$$iJCpHj4(`VJbroT`)@0ED4YlEroMhmw(c;R%IA8?9K-Hbd%-p7 z`oYk13J6s_CnqIb!VkX34s#i9=_>~~pKz$Bikp}+3fO1pnZ0bGV|1Zb{F63khpT{) z?uLi7RiV-m^<>c?_Rl>f@^9iE*2Z417_$DH>A(8!)5(Xy=|P#3dG50ZKdXOy`ab93 zr`FUT&b}WItG0YXQ>{+8?=BA+Qt`E-Z*|UrrccURRWS2}MJr-M#-IC+%wj zYxe1RsdzJc=ar2_wuh#p33E~di!*^uB5%mn6NqWUo(Dyk_Ri?xp0w|&y;C!6H|?-8 z@b#+yR^IA|M?b%@me!v;UNQcia_F6HdES$O=Zyn4?;`~3>6!;9o8;<5CNHdty*FHl z6d~oa;lC*QS?;9l6M;A$_f6}8*c-*ZpHj@%qLv9eNSft?i^*d|!-DwseOwlZj*!l4 zymwj1&X{suf+m=awRE_0KmYRK?y*k3*Vsh3rBpwLzf+1}?eCD@V!{=T6}zwx7g0kq zS!=!?5Z}?}{8P*D5mh0wZuDkd0gpW57Udof@O9)-h9t9U*01cshE zDEr~(T^%EO7{-wy9?@LFdYpBUclb)hkc(E$4fP5CIt^U1#3(LDqIbRDAGmX3(N4`% z9rd0KsqoBYE7K#q``Ubc@@gYd*Vm5m#k0QUOw2KETW=qfAw{A@HdJkw^{yGbe@m{E zd~q(C^mGhALZVBnxer&nv zMXc+vQSHv%T{Pr8{#CpX_0@+i-3r~NfI9v;NwzF^r}OoKpaYz3XkM1s-c$O%;H?{E zqs~LvWuDTJVQ*@tzAidnSC@S|C@z_(P0^Py+04rsIqA*y$i+Is4%wSX`Tipsy+N{# zQjj^+%F@@M)&)qVakqIQ_6xC9iWQDJ%@(D{Pn49q_qZytuc~Z+#{Eg}$2u8S5eM5Y zsSqq&MAKEcB9+W-A;BUeY2juJKD5EiHw-J88*rivJOu(JNW$7nn5Y)XcUY3WG*x*Ft*A5LtPcwn1?ZVTi0e2pV0S3fea2 z>I9Ppm4y~Y@0b4hx)JDtV9>TPS0|XZg#l%!gfTmD2|>{4VsDVPA+qu?Y0x&~UUS0%-Ch3{jQ_(>9ofqct!MM{8gj&b$Vu;b;v^!_gX;hNCqQjev;$ z!+&B3h!!FcG&*hz^)^7DV~&6J_C$a*oOumQ!_peiHY}|HX;@kV(y+7!q~T}{l;whe zIL(jwypez+!U%}y|6XV~{uju(r<~6Ww zSXu+xhNU$i4NGf48kW{TG(_|t;+_M}DI*|G^Y4X*r8S^!SXu+pu;w)&4NGf48kW|8 zG%T$FX;@kV(y+7!IG>Gx6*oWtX;||bkcOo-APq}vKpK|TfHW+v0cki|69%*&L%@m~ zfN3~d1JiJ{2BgvZjeqvIz%(4KfoV8e1JiJ{2BzU?Z97LF@(sMJdpWef2Bu+Y4QLzA zyau)nOKU*eu(SrEVZ{x$?>FR4|CP!0&o(srRQq4qn*TY~zTH~&w=R9?f3ZC)YzK4E zUHT9^-OJHGY#(9!&tbc5C+*)~fxmOXL{Y-q@!>so=`-jg{PZB=Y%dA=RC~L-S{Or; zQJ>3DQOq5Y+t)rFmSVq|ZzW+HBX44CEPn_jtLNhmJ)u|aLgr0e{=8u&UdEdef6KUq_F+;SnE}@_E_?3fmT@*j&dT~7tyXOtpZ0ekglL-;= z%4A5Z8j40N#9I~(@Y6jL*)07umq?D+GuJTc`XcMzIGYRNM1{4GXV&Zd3|c99oTzhx zi*gB%ytIQ$f>{*p-e#M>&}Eahd~R&-;XcaRzhEdS*mJ|B;bvS;^qWzei25`x?mOdW zM!E-Lyn8%92}>&}VToICT)uLE>A}||rlBRrR~4TS_qIr>!jQI1smxJ_CccI*yIqj`NqZi(CEWq*XHG!$CK(oN!C|= zEoe&XZmV5Z&`?P{VH;=GbdtaL^#`W1-p+^@LhC3=1$Ie`7^|&(qb}3UE%VE^8RPsZ zA6?VWMLzjXz#D(1{QmfR-D{=e5%n(R>qU(`=3_WMv>uVS+o{KKgVh#{)Iyxv1WTM>A2zG+XIfCJVz#a) z`?l4ZsQKFTL{HME_P9wTd;B*}q~+)7>p{vUTf;$;bZ@4EBpKcuCb2D#sLa8U?Moi8 zdjI%6ol>Bmu@g+?!HJz2G z4|q@AMKRea;&^3P{0yfjWS~zkTRj{X`{bGQS8fY|19}e$zZWiAn7Si1ncp~ikGlY`D3QR(l+ zt8m_Ddfi#lXcv^qd4;2t+b84_S}PPq{MhfBP2+VIPFl7HO99S;IR}}?zKdrmVig>j zXUIKRm8(?xQ5^4B)CooQ(Tv#j7qQ9=ta4?931yTnh0NS`NeAtvt5kGYQTDm3H%J?7 z-#w+yH9RQ&<5A|@X*)BaX{OAy3C4$Yx@(p6)9j^#f|t_mObZX3SeHbeU#v&v+@1J- zv;BS4bq`h5I3-&_0lLl5Z~g5=cdlgH z5tGCO9BpoJn>d#f^E4@(R6nybEA9HHLec9Vi4~0x>dWYvG`L-t$PS@)cCH%UY$F`1 zzmK)Qgvi(nTZ?op1f5$|i5p<5eS`v=KxT$`7>A%bS^HQu5hXUm0p9=`H~hu|g&WM$ zL#?@pK4yjdz^@dS7jK_7zX~eP*ad3$}`*4#o_HeI|tU*m_tpFdvBWl%g?CsxCiXF`5 zGTYxE*qNRi@;KHcQ(u=jYmk84?0d2dVV90Gl?&Zv?KaXwPdIPh*Rcq!YJJIYNS=TY zS1;mbI<{4C@!adU2L}vtxugkrUQmtV5Xdz8+06D5h~q|59WSdX#79ix9J}6;!W8#d zyZgP&nxo4(|(;egrFX^sQNJlcuS+n6&2E22a>OajC+%Ot>Yv;ECGZ*Nw z&lX2YU9VE?%)pJ$>LU57wSZ0PU(+;D$d;;Vs#jql!aCBwvLE%luZ;WK_8ns_*nSL? zB5sasw`Ip%6!cfNKR@8}U!OEX-oe_IMDqZ@#@k!3c#>AQ=Y`+&obhXA5B^hf3&xSm z*O{donopCvh0t3Hh-O?8_TpkCtNVl2lpNoILN&in~Wg&Jvf`8nIZQl*C({SeZ)9BE7Hi%s{Z~!!*mN5b%4i8}) z(13Bfsr$cgFSKn?14abIDSS-ZB7g>r2#7d5CXED~!bd>F;UQ?iiBSaVcLxpnxFF>NEzwR<5weTY-|m^A2&5CY;9J_HTgMSzIIW741;pY1k5e^v{ahNCqwjk!+P z!^k1x@Oz;#*Q9%);b;wb-4Jp3z1YTFlS0sd3?T%%i3*J84Wu#Gq#0Rp?`nbLeGj|+i&&*MK93IEB9#+px3-ylz-p17xxzA*$*_j2uYA z(i)J4r8OW8OKU(H&b$U{xVc>^7{c6rz%(4KApxgkkPvOh{HpS91x#GB4KF_NW;<^h(@nZ|NIW! z&KifjZiw@Hd$?|N&eQ+KHY}|HM-FFR69#m5Lqf#iF|Qj;!_peiHk^44Y#WZ&z%(4K z0cnUhJj7i?7fylH+D;JtPu~4@upXL*qct!MM{8gjmeznHhcmB%ZNt(U&^9cs0cluT z19TEZ!ipP!8l)p(#SOqToV5X%hNU&ob;F7qfNjIk+V(dD@@w)dQ{|s889LYHuYA#8 zxh~rcv(Zr^d{=wWxR3vyRT;qP1*^uZH&xh^@nDwq01$X{Fv`iXTW z`=H=Du9sV{xTczL%;DLIu_3wqrp`FSsN&`2igo5PKe_Wala*OrzdY++Tcuz=$+I-K zRmOaa$8jm=DAkXy+NpCCM%oV}k>~p-4|A0GZF)8~I^4T(37xajIC3TB(1lAi7s8Hs z>6DcnGV{KiFJJw$)yqRW>4aoXSJMQi*u9p+4+~Kj`#x-yRD3A*J@dn{>t}h`>`JuT z&zy$w$yZWQO%p%9d@k>^zhFW`x^-OvO(YRQl|@#wHvu4M;ox zc;=7O`0dLN`kb;J(k9W1`9=dG4tO6`H`gYWS9t@pjSdd$>SX8mH>w_LUi+L$QgFE` zUO@iwUB87EhhZt*ZW_(7!xW^ly~0IPz|!}8xrd%j!HbO zHGd?e33z2RI%V`InA}+AeU3~z1EZGJp&zvrYCcbp3~v%%M^MTbmoxS ziMJxr%kd5edtCyYuG38?*?z+3yKgGysvYwZ%Y>oqOHyHiId!bIl3(>{W{8|T(>`uK%&oUU|VA7ZQb)T(D9svk77 zdoQ7Udhkn0#%0o}`)lQopJj^4`Sn}~nYFnpcmJNFpKp-;xnyy6&oy0!rr~|Lg?IBN z{VcM0%FM6K9A=Q<5!3JD%Pylcer+mvw2*UgD~mgRT)6D~OST$o^NM-byXQ2fm)5yS zTZH;gi7?J7lo6hx*lO&yCw+9|IM;VNyMF$;jk*@)$LWFewsR!9b(D^e(*;5ct{#{; zVKT4NSu6BGS$f5TcX;;l#pxbHAtSE!(Wh>yme*fKj~=AQE@MW3D(H zWE_~KDQmjXFTaJ`9B97j{ll=BQ;6o~tMjcUL%coQR~+Z!kL%jD&PUii_%t?D$e2j> zvz*3C{e7cp!AqNckLggY+U->&KD{cBH7@Cg*d9aReK9!}aOF^j1ogAIzL;*^loP(~ z*iN;K?)* z)@j@n@4p{MS;TFp-o%Q~Q3`!~2>CdWLP~(O67~Cs)P&tA4cIqA`Ssad1+pWr@ioqj zI!ip}xX5^=>1u-fpzA`T9&cDk<^RYQ`tj%yT?sqGedyx!fed}++QI19H-q^h4F;4V zc?|}%!w1+{Lxfpn_OVz-vtg5?NB+Pa+vPMLi(lziZ-J<(D!Dn{yHw#d^Y`P_-RF2& zo^%_?baWd~Q+N@vp)cIig`5?eT;`}4`UBpJ%jpNx;JFZB)pFQioqtBXN`3q7@virH zJk>_dC%l{RI=jg_*t{p#{phYJ%HP7r3K%*YL4FGV&V;&cL?LNZ7mIB*2R3;;b8a0m z{=Ij20y1B0485F=eICR+?Nqk!$(yTMq*bRUwN9ij9776LqyL^=%x52)R-)`fu^ro% z1T;rp8^)eI#iDfbbD=5K?Op=H+nf8C`IhH?V(sf>bm@f72|?}(L;s)52|+?coRK?~ zw}EEdn?hibVH4`18m`09B=t5D{lg z+emZ=FzAtEdc+VkdT$w;#`K6W>Frz}Xd2TahMO0%n14NSwC*T6KKc@0d%n%6*g4LxK1`8x)-4M%HW8jjXP(2)qp=Z&uD z0%PPr8kW|8G%T%wXo!e2gw}vGEUf`)I9fxBLBB({Bhi1p=SXy~5XdJ6(Z?P0y1_IY zt$}GcS_9K?v<9Z(Xbnum(HfA3h&V&sbF}LT`NSaVzVC&Gr8S^!SXu+paOSmbmmB)J zVQCFW!_pcchgSq5;tX-mfix_w0cluT1JMu>=RJ%ZJ!8R`TY$DNZ%xmD0 z!_pdX$9CJIfxzHlX{7$j-U4f5LcsrQytL;E}`98gS&Wv<9SMX$_rC4>_+vM4Tb+IiMDY z2t>qrFEku~4OCS^1mdLHUTnje*TA-6&1=BB21{!|8jjYs`(;8tZ}f`e&%Ppc6rz%-nBZTo&h-t=Gj0sl-*=nR9ua)5qi7@#8tg6RFw->Yf-r+~(G zH4TxS!*07X47OV-|NCM7one4LBH(2h6zcZ5qB9J9Cy9Sz-PYo~?q3(~qr9DB@P4|} zTWRUOTz>W~KBkzPeXkZqWGDmJ^;5D}^{A+u>clGWh}H*qS{)s6hAmekFL0Qx8&Db( zWQXu69k-OX?vu2z42)P<@XxW6Nc6pw+Um8M<*6igPg%?&XMMfz$l93N>!)K5M*Jlv zqCX?amIr18On5m>tS_Sz5IByfm#W6y6?#is+ECY*MG@1pCb{Wu{n0D+!l}=TFBSrZ z4O#<)m!f>WRX4D|HBbV)dBp0;!~wr1wLdLo#0vEqNxsiW@V#v|nn&(9b;a_P{>PRjTdF`r z;&qd>4xknVQ6i6nO2p%4O){*y#`s6~%?cnQYI1_r>Ea?VW1k z>&B1us>FC%#xMDsOUvEd@-0iuusP?CyS(wa)}=1SYPfQy$s8}_c2tMc@V@8!4?T}?InmDEMmx~;o5jmoRGSqfTv+u`&xhd*Hk z5nU?T!L*xnc<;Nh9-I5$Ak<6ilaV#xo{y`EyRfM4=2b!zXb@napq3duD>HoiXXfor zA)X|y>r2BQI-~PU&h`drSQPdY*(iPabe72I=$cD~{H?F&-Ygezi~m6KPu%}1Mqcin zwOGm(ot&Ls<)2;ue&1w=-?fD>j|} z|E5ik2s$kA?>E-AlP-cj!~w5Oj|fByaR?d^{1-vHL@;avg8!lrp=3qelP z!$RAJqcvf`7Q86Bc;TOIgF@({5QmpBuNz21gp&6{W4gK!G#~&k3UPROFEr+|YA^Kf z{w(zD015_+LL6Skv<;@=Xbnum(HfYBqct!MXI=x+5TWEf+%<^9%X^{W%xj?Vy(mN| z8NxOoj4cWgO5O_%XI=x39G2FABZs9mAPq-rpzysY#NlPky9Np+i$a8w_d>&&*TA;n zXbnumnb*KHoOumQ!_gX;hNCr57+Vw~lnn92K<`j=)51T$L&3J;%xgdzB9y#`kwb)% z_d>(b+IG<>NWTT*@G_=tFbzj*U>c6rz%(4KfoVAN8kmNowe6yC(DxjU)_^obC>i33 zfowyBlJ`Qx(i))TnkYo`Q3%^W8kW|8G%T$FX;@kV(y+7!D9|Sgad;Wxt^sLSS_9D# zp=3{o4f7&LfO{w z;`a8nl?D0(5a=R|Lg*qC+pR2wkb*|&zmRcqwX||&HrUR<7C`^vw>r?j_OpN65&tW8 zv;C3G20Lf&1a_Ud`_D1E?HzH^orBc7cf>_Set%E@y(2Cx0&_<^M_0+I4@LfxsO{R2 z8JUo}ppT|_W`#<-IT6*xPti;aO7F5SHU)8%OuzbcI69g`%%i;fs2@A&Yf8t2E z_G2-$`N_OXf&Jy+p7^>qDDRR}4hy3Sk+)5kxXnx#C5CVLu&$ZV9vcaXxml~>S7qZ! zf^`Pbgd3p3&@wtTKho^Z@mR2{>}qOryZv#?bJ2Lm<{f)g_`Swo}wPns(t;kn2rK4h1F7*_~9OO^Plzx0M)WyL@ zp#Q^ZSJ4RbOFs5wP1+{ZkMXjr)nm?^(9&?os2I9_?9-9CQSeqmDWTa=mgChz@utP> zvcA@=yBF82_F0eFrUb`tTB4(dq8~F-4BnQ}iV5BN_RaP6f&F}H_%fOITc7rfC1jQf zu(e0EG_BNC84)P9=6=(NEoC|IoK1VP1Bc<9}Q0Q`7M486o+=34VDqeK>PIj50 z`z_Td@3qR~YYs(El9!LzEz;nID=ap~jK0Lt?+E%pc$ogAUA;SxyVPBmYj@@;DF%^f0$)~P;_Ya@=*e8JN zFs2oB{^pmU$Wqj62KQ%!kw`}NTW*+zl=9iL-AA4qoePFeXGyMtus6E}Y_?pF9JNb*l*e+eo zJlg&2bU(hwPsb*4c8nm;*!EmLOUo4UazkzEj_mF1ugLFn@x!9dHe4G&+ncIB@Z3L{ z)1-^VO{RxSbJQ8@=trr6eUWVTHT&4FP|qnU;`r0c(Y!v$T&k*|WrZ|!@RCvzCLTUy zns+8}{LwJpL34riys@aVWo)ZWNxL4b15LNa*Nfl2-t=63^OsR zR&M*xuUf$=Gk3qSJi5vyQbmb>fM*|Rg0xb}ZHZEb&qDS&!!OxTq~Ed9i7)%~rR;mT z#HY^~Je@v{fBdp)nN8#W{5flpk0wvKrwEL-*%y*2_1{UT$bR;+SWL++8+uT!u2nO$z)2Cm+1Q(l7VzuNrsOozS|y%2?&1CyKrFl1~z= z&FwjY@r*7_%Dz_n5R2C=t*E8YJEv&%unJ0pCE3(Ym^GN?w@dMC-F|-!Z=ZzvO+fKt zQIX#rhyU~Y)}olHNa&#L@9#`ekUzikcKzpFhu+n~WC2BtMMW_D6igQ6bro#j2L5HFOdE7e6?*8U>Jt50M%$wn89MqK?B%d zOY(ml4s@E^Upo`O7WL>45=763zo)tVC$nvPQIFaQHt$~4qtII+|8^+;TGR^(2#BFS z7)H~mTe?lIef5+B1vh`TDJ@bHSS+6Q$Tt_$8Hs&6lFLKIfBJQ#9I-jAq#U=&wTels z{r95{E99=!zoqA_Ey^=^E$15f4h-_sBnTx**N!9%hfjK^ zJe?C0y~nQa@KcXZ%D(a2oAK)4E1jDMBs;|qEDs4w`mWs9*KaeTc~$2kBnO2ob)Z|UH4~O7iCb*f0W~2l8chkeX9P&`_uA^eH?5*=9ISD z_6K(;sF~hmcO&7)ZeYw^7-G)uIIY`xgXEI$9h62BlOEN|8#=mHVsw%UOhqdu=@zd#bQh)ReZanp{r7kPj_b_ehqnEPUUyR1q+bCNW zFSq1gGVWsB|1|B+8LaPa*>4TM;0T^?#vLP|sp}4nx2iv@n=Vu@l}%7MZeo6dzyF@Q z#24KL?$CkS3f0bRJm{B9Cy4R<`Nv5LBh+qUUq04J z<{3xX>myQou#HEGrbYCQpI^xB$Uua}-Xs|>*0n#)Fqt_ga8T>JbT-!^rE6r@Q43E< z>rS5vA7%T1`?JAzi(2qamc5aKpQlu0va?(qermXrm}0DP)%_J&qrwBIE$y#mGXBSM zaY)&SE{u5h=ZoKLVJCi&aU_w;evZ$+{phgMvvW7D9arXT6%UaS{$bD1~%hKqFcn8CgkSq z?_!Ts4Pm#qFp8~^e|RNt)TwUUb;`g$mdhHYEpb`a=H}gyJn9Sdiw_>1Xe~D2>(vnv z78$9nmpaWZG3ZfT+vE)s?;wFjdwq7j1mKW1=Cvg$A@Eni)#npr(kw0suE)VDBgr36ve*SgYoSib?V&f@N z9y2}$T8bArmtHjAd8%7LAfeyh0k(*Gv}KQE*r(dU$dA`z@n_pxb$aw4Ytb4q6Sw zmX1oL$^LvoRB(`kXn=eT zJ8j4<9=P!>R@55j!#RW3&)vsD@|Zrnt*(wqUI>z=ObD+(GO^Smoo9B4-Sh1E8X6iV zoD`fO%bz9Lk*L@ibQ7u8#pj(Zl?b|g_luXKkLcXPcak6@5#dphQ*PB63oid&@aRJR z%RBjYPv55wFMjc{Ab%sx@C5aoR1`Iepkbh;@RyY{sfb+b}kt8-_&gV6tyb1JYZ0@<;ed$@bX zH*@}N_BjqG7bPxF3j=RX;t!EF`AqYJBG%Ns_l=HQF_ixBOUeswB{6#ECZTSSNUt+C zJsWa$>3PNX5b3!$HH>URx{^*sXBWjYMK0QRv46ECu=tiIMMNLsG<%4&=XxGp zt0fOi6QY>HdVrN9!V;E@|8tu2#%N7kbUe%Xfk@iEISQ}W{Q_ZM>VvUZiWZ+zG~sxA zy-IFY4QF_zN6xlI8<6$r65b}(7RjI*m5*!P`!L&+p_9c4?+7|Bt5Ooj*wbdDJXg$h zJnYh;fVJ(<_dwLB+WOjC}RnIA-=nLH=7*KU&+Xef!gO& zxW#UjOMnZ?_hPwu`Y6$FM7mUI{|8zdNr`&sSIobgwX0Oc-`Wfn$cDDf$R9%q{aIHcfLvmf(4TcB0@!6mVP>9T-YdY4778=(43h}l?#|(PDm>FgeEa3T~qeXwb&wvIpD9r3KOuL}xi-4gk(03oR zNC}4B?fDgYlHIAc{Lju3)JqfzdhsLvJYj*^KMP9~(1#O+__MHp?CylJoh%)6ylq#+ z5$zBC^-hA7r6Ytcc(#4sK?ps!pxZk9F-r%vJ2UN9ve0&T@89kz@}J-(%wY&I3!`5n zLg?3lurQoq?2`L`YZz$rXfGID?HfIuKj$o=cIV3d_l6;a{!(r~6d@!M#zWclCHyaG z1D&0?qYZS4RCwCh^`7`I-3@ebap$3+mjLh{%C1+=ue-7Rwf(n5|Mf+KDN*#@K+jk^ z-xQ=MjEAyolGzysY9~7M?{OginOR|tLl_+o7eq6{=-VNP6oxU5T@%)?r?PwEK%y66 zdzm;8=!0q7!$6>4@UVul>(H1w^RFPnf0FyqFY@2(>HjC4Zzl|ZF1mz%e!Fr8QM)o9 z|IY0b6%>XS28h-DHhJ* z?1wmiZhcm0jGjXbkh6QR5BgsIv^A!7Z)0xdsS>_v!M)b5q0v@49fB~Hvzo=Xx}IfC z2p?JX{5;@*f8|6fug}CLi+%n^bA@qE^plqO4W6R>W7v%k1(IuDz1f(1SK&yfFLJ@Z*m8lT z@=OE&5Ze&N{v%Sa2QD00+TiiqKT+_GBsEu;;6BUq)Ci{7<(_$;)ff)ud3=1IS)8jV z(Gi4M)A;+cs_ULT5-x|{Fm*Z<9U>ef{akmDHtjeG-VbI|ZaETphfeKCZy_h)sL@wb z>S_L$e+aK{Fy~)cdS5nP!)n?v!+$_`K`{%dtM)90(DjRLnet3ERel%t%)V4hqW=8^ zHnYlHH57`UX;DS8ZUp->@(EdqMvMwxpLTRUX?e9$HFDoYY@#^n3;6wYsl&l)W>iK6 z>m>a*Z{_%LOZwZH7ph#y?oPjl=M|u+MHznj0)5^sB<-i64Mn@r9DO%+&Ugn^G4B^- zqDP#hPuj8_ZyCyn4)5HrDZ{Eu81X%{vNbH2m4C+fwl!)0&}Fkibe1Ex*^54(+jMKu z@rmw(5gVqqt@7)vH1D2Ow4H2^tn@!wr*Y`CUZwIxbx@Y(4fe~(z^~oe)oRKd)FWqN z^Vyy2%(h4kdFMT?-{sI!x*q0iCW{Gu_JoJ*Rsi+k-cYtB&CcG(UAR-#R*HV^3`Y;P z#`Al94rhJkeL$3s@W2R`3*wX5Z83jto7jGCG8>w7?pP8HwW`FoU{yeoh}at ztfUP-HpxF^ZJ=V67hE{%C+M}`NK56|DM{<}=d5_f{4dYBP6>#e3Qe}yv|2n9?#`yg zVxZDqn_^h?TmbK5sro_2jQrxFAg@T8#L;6aFI2fci0Jur-PIhYcoJ2^#XA_IW{p267&a0n_qaF=O{^U0KF@Sh`Bb3%t3!TUZ364}vK{wFxzRF^9qvSOyiT0= zJDnLl?(r_1JA}Ph3z_YvnudfyYM3j7_2*UWbwN}gL|?>VSUlaQgcMjM)*8G5~W ziqtHUQwYyapq4v0(uK$Og!YU=Nvo@dIfMH#5_f0fxDj^`Q|D2HOns53m0H(Gdy>!0 zskqroqJ(%>rM*N?qJPZZ>E-d)JgvMmWI5h<`=lCW*1bjJPcK3S4ci`Yh(rXlN+^f4 z;q}CcJ6me*==mdSRp!V2`MT{Ep;S+b^9WQ+4i#+l z4Ton;uC-sfWy?lC7PHEJ;7Vd|l6qoS((w=10=>!o5lWkedjH>xBK6>jIZ_hZQb9nfO`jwd<6k(CM>^GU~hlZb0 zF8Ab_9N8?zbtI_2{o14efzM3PzeL-%Uxi-Rb3eg|v~9@dRDuqJp^mPluErGs{PWQ{ zL4p07Bp=_AIQU;UJSN8$B9nB|`~%JEAmE+TlfX?dD5PEex|RkjwsSa zUyhkHi7VY_1GBx(Dz(3iHTbTxl*<)-5S7pEbF)dDujPU3Gcps#f%)_^17b?p#z+P? z@?jYngF6}3D(z1?YovQc2PPG2e3>f{51sTlp04r6O*K&YjDObjZdMsh876r$&nI0= zy^&24{)TY_K|NL7aXcLBI+2U7SMg}V)T26`Y^AI~ocVRrFP$2OT}%S3C_Ka26DQk7 z$ypq8K8UdDj6|EO5#5YUlQ{E%isPiMRI4IyvR6+?D~kccNt)^Fw^gFB#@|m3YZl$% z=uWovw6jr28Fy=VF5J>AY|x|z9IF-uCKU#Mp^w^RE6c@O`VzmM9LXOCWx388*vF@p=<-P{ZKnz z&~M9F2pWmbMT8zX#)1-xMgp#TXSMw&+lYTwl)pc3%)Cqp+uNgt9{TRo%wKNl_Cn@2 z?-*Ue?XN3`de1(WPW+++u1r8MXCOiptIwq?B&4%=?}569O(hoyRNw9E{glOR_3Sg7Q`uP)t;cEmi=s@|GAl<8QV%Qdu< z{?^Gh#)Fm+QS4J0KN-<_$vc@0kAE;|NcO5I!-JvWS5)75ECtzZ-&S+osAM9Q)Jq$# zxVKLy@#Xlqv$I6G=~Yz9x0K0nz9Xf_11G${3tl_PU|Fw;`#d$tE77}odH<-Xn_zNF z{l=r=AtBC33qd#b4UU$n4Gm}Ut}_|d%%35PtMMn>zj&?Hdg8f#+`jU#n)NAZBtt(j z-qTA$h{Hoibd|>n1c;3UMZ^oLOe$53wy>5*c&aQm=;OJVy3?l}zEfOH!P9W7$~PGz z<4ru&?^9Zy@>(Y}PPUyVZM-~izldU8hoqDB>zUfjj6wtPms=i`84Wu?Lf*85n_wq zhQB<%+evk!EmKW8tms?g&j22&c>ThWlxy^Q{KZxH*RW~C4^9ws2s{%g&39fcmXT%a z^NkGMXn*LsFK%P7xxVdUk9KT9w!Ee(jzN1~OIqT^aDf_0;_FW)UOuj+3ZH2e3u|$ooJc>5O@O(!KKuJ<9gRC$GLN+*Z~$>cIo1 z1Yy@vKU80@GO~@G82wE39-l6dkq3UaQ&iEX2m)eJqjjd};&rK*VwEJ)Ee{>Jke7G-F&!}SVztd{fO`Bwspjd`$YS@B9)%C9 zfek?|Zz5wN6UpC*&xjQ&_SmFdNq(?pU!zO+s5AAHfZ$ZX)EGBUsFFimU^|(>nugv3 zm92zo+MXZTLJxRIYYvdSW^2ugpTCw#GXGM&LbvU+NI>~Tqw4oO4XWN3oZ9hqZP)Ex4tz8e7p zS3*%oQi*vh_4h|;RHSrsG=6vEi^fvgV)tR187&$Z_j7wbwB=JCet4|{m!>Q|aaAVN zO}M6I9Gg>Dwx~wZ<;R?=yb-rEp{>yb_v>R-ELuT!FOy%YIZ2#E9s42WYb#L@>A*c3 z8s?mN>hSVt=g+4U&dW02>Q0?VU?HA#X8){M>}s)~*q*ZXw6Cp}XZ~4fPJ2=UcWJZ& zPPJhN-9~xvS4;cq=K5y>8646K-Qnqc9#aR`ke3oYG!KTX(|%I4D~K7TN#pc2ym%_Z z$L9+hO@@sJC%?+-U=wb}>g1OTd^Ri#BrP6}I){ak`Rm(6$ylgz(46AA z;iSwZ$?qV@NSW6@Pq=mwA#fwhzCIu++<4B3WXtsMdkOrOb^{VS(uuX%=UrbJZPsNk z8qd#NOk!!}@UNKoP#@~oo;4cYZA85AoM*LSNh+cvx5)>!etBPtnsze4`$q4P{yXln zNADY0ZtGv3IR9xuw3EK$UH`xG%Q4Sa2%&b)Yy8{K5(PAbMq!??fTGb}0;GS6ZiMvj zyR+lfW7tLl>JFhG%DG~W90@3jio!f+0WtFb!9V?dGaH?`{MTycmoJ1qjx2<(W%2u# zCF<{8${k+_wd2h0-m=_j4Em3U^_MS%6oBap-HI8$m?1!0{|ayEq~sbeuie4E^G(lh zMD&Hz>(X{QU1IpG+-HxZwkWA``MFtVlV)WkA@}LAT8e0EtLGhcp>@H4Q~CET_dDJu zsMm1z=Zd&7Y;*m={QwJFchO~XCE3u{1Mg(nuW^}aUSn8`=2SEn6%7g*RCA17Mfd7F zanDiY+~f>NM+!e`(%$YC57WndA*QRxw&rjX-f28#pSXPT!rdq474K&9XHKw}#2Rvj z_mOb0I65?OI`=Iex^5A)i5HPXiG`zBPAhr$7F&0q;iBh4RbsRlhc2lf?L5AozlG@& zT8Rw>Yz>6RS$k)e0HSJKU#ju2fS_afEBc9aWkRjEVc9&UGdbBB@p@dj&4dOSUn!Sz z^MtfQiBDLxtxwclMB4p1?Ymp zUp)ywsTme)>r;k(^5M)kTNBR;)ptF!i4R{qb##1RGNNK7@l<w<-2vjX)Aoj*fWM z+EebL+QqB&wOIWPQTK}4m{w<$r&OjJ=t~#eaW_oRzhiyS>}L ze)ZdB{WAB@bNin!OAtNG)2>!7?pBT#Ud$*lKJ*zD^sl5HFW6f#BepME)7i=Gw7a8) zo2`@M|HIy!KwExP<>G;Wgh&J-3=bap9}y&h^vyl8&ehG8y%j>*fRC=nc5|W6UaUj%z(ju_UO_bksP`E0 z(^%QaS*r&}ODl~_w_yjc!G9Ru*g0C+KQ@@69ZMVQJH~6fMh6dJtOItv^cZ~4{e5i~ zCeG}ON=wTdxRT?vbCwb1J8QgWbuV~?lwaRi8;=g2aQt~sJ?q2g@3`&p#~icc?6c19 z{p@XS_A6(ceY2b0?Kz{Lz56ZR_sUZ){o5};@?l^7+z0l2Z)Nkn54h^&mz;9&UN64Y zIrq5Po?m|FZEktu%}>19**|-mU%u=%*Z;>$e(A?IT=a%xF4?~8XTJTuKm5k;-}E+5 z`}pvm?s>QE$K3ptmt6Frk3RgqCtY^jsqbDq{hV_@ap3v)xZmQl*4MxKq-Q+snA@Lu z+z+qb^Yyd$Uh?Rh|Hi#K|9tQ_?!EWKKYq=_FaP69Up4GL|GfYHu+cRiTKbhM@BYl6 z`;+T`{xjDNxBvVz@9`^_Jbn4pmt6VnpL+BAZ~w_#U3IHZ{?zy>ANk$C`|p4I_CNp1 zdq4Q`@9h1;BR_GUkG%e?FZ=X)AX9`uU0 z{LU}DYwwe^Gz1DvU&P5ezEma z7e4aKU;W@!$3EpZ_pQC+r@!)%1Mghe-G1xZLk?X1zW%+JcYo{KFZ;$7fBmS>z3KGT z7k})z=brn`2mR=oufOzTJH9-)9iB7(+RowK{`Ir(e)R+Xxa z@0L$}Z}Y7`dfW?N{;#+F!)Nv1cH%dNm)_~b+rIAOUpV29et6rDyyrG&ov`{>zxR)C z{N|zKo_p&5eDRAO+9@%AVF{9SH%@Uf)d7hn7GJ6`w6m)-FlH@)edb{zk% zYu-%qi z!?#!d?VQKn;b-6S#h2aVcTOK(^n?9h`|hv)$x}Z1s&gOx^=JQ&`#j>Mmpb`^y`2B@sGaa*Sf_MGvcTRukou7K;@z;Lop}+F7JAUNy<1T*L-@N1hTyy-Fk9*{uUiLp; z|I#l%a`f^?-t4#D@Ue^D{E_Bu7N2{!zdvx#y_>K8)?fW_@AdDy=j;CTxJQm|`Qq#D z^X>D__>DW<A3Si8ueo<6rtSC%*L6fBSRo^EOU=(HT$Mc+Q>gfBvhF`~2^ma?0g*?>=hv zWiR^LWv~CySD*g%PkiNj$KUKe@BYDSuYJo~p8c_pe&_xFbje@--r*~MaQv~K+q<^! zPag5%gD-!>>Y?2?{Lv+^eaAa~_^fTOz4*C*@vis$diz#){=4RzcD7pI`nPMpJUab_ zul?NWv;OBpU-!g+AKmNH_w0Y-_E$Z4w0P?4-};X0?|IJ`zUqd%KKtF*{PoAb^4Yh4 z_L|e~aogW|#MO7X_b)u}aUXp1Tkm?@S-1P*-`(ZG&wJd*-u%?}+fRSk>tC?)?1wEp^BJw5I{bkz{O(hJ`hCBB$tT;t_UvsZe);Raz3uW3{`+Un zc*j@%>Wg2z_TT^X(HGqPw%>i$1^0Z-bzj*3)Bo+*Kfm_d*X?=JN3MLwvrl{NEB^j* z@A=#ruekUzD{uclC*A48_qoH}{^p^teD2$Z5BF{V!|3^MUpQuK3UkK6J-FA8h~IcfRq!;kUixFP`)8UwYdgzx8&{ z_?zc`@d*!m;dPh)!_Td*-r^6=|Ky%qfA3Cre(q;~-2VKxKKd{J_RSys!*5@3uYdff zAKq}Q{kPitusc5aub%MKw;uY;=Rg0_8_s#%9d7wIpI!gVp_9J%XV1QN+vUIYYuB${ zeZL@mk(J^1-szwXUX`R;vAddXLhJ@#8SX?*SppL)`7U;peA zzj@M^e*aF-x%DwuJ??+s@SbBoeeBnt@TJj(g%Wc7E;0Prt=?AN`H%j{VN>zG3~xclZ`iee$m! z^P69K!!gGm^Uh|L8@$R z96@tU?#+5bJwjWaA7K7vq_uL+6c` z_8*9!S(4vwYxZR0EsyrEVIwv4u>bZ7rNCg)!P`4BIj$`Ta$sgSg!7 zoVC%)qn4Le&RyL&u(W5}dE?O)SD}IPH%7}#douB~F+TX2jrD9$L!zDrg?rxc5e6#;rGB$PH4%u~h5{HA!a~F5fF`jIYR3p>?$XNYHX8=M z%g3{=DN9`=8t`(sIH1k|2vppWl9$DfO0zU;K!a?SbSa(BQWHmsx3v(;f;-Y|3|l&P zSQyYwxCSeg@oY7k9yHA4Xe!BDGp46imzNMdsElkI1>0%6 zBp_za(&UlspKxqb7!OJ*W4!is#ye|#aH%pVXT0X*d=)saWZ7;h^k#70BF$-&;t&(f zK6!<01@+Vf=NbFqB*(DVnp{sg`)#A7*m6*c!$bkmrRz{xO_QecPc~1Px~=k{tJ@~x zqI0R+*-SV??^bdreQcmsy0n#0vUO1Vc5r%aedEjnqct-cE*OPR$VEWGhb-;gIIxb0 z5<-S;bkW664}bHgkMyTLwv6;0f8!^9M;MRg@Hb&693Q`#^;@llT6x(Mj^~9sJ+zsA zLVsQ0!Iud6LmWH&%p*bg%|qjSx`jW$A$(G4mdIKhq9#kJb^MN_iN9I)gyTE-w~K!C zgZBBGSmy9J0)EH8i9;-R!ttufZ`cZ2U`@8bze!Df&z1pW8MTJrEEC6&C;(U-okkq% zSAV0uNK2oIh-dsAaf~Im`fV*lyz^3;3DTHj!4DjI8z85IE8EaL;rKWlM~mOv{~9y~ z0Kx@kvkp16>@5C^mO0t@Q8ye#qzh>>L=&VuD2`7mLgwX99I&+(k#6D}LddrKp(^C( z&^!KOJ=Sk7qV32h={F0o@$4tg4F{Zfi%sK4je#u0j&ByTVO)TOv=jSb*ZiC4op3xQ z;@K;R*et8N$;KU_D&q5X z_i#{-ee>@wvg-)XapCub58*Qr&L40CN~>1*HhyMpm1OHYf`=cDi2cXkh66u!&}Ikw z{2fdKp>2%0h4$m9_&0x8j=$L>ap7m918cLEen?e(%i6>vw!+e}@Az9(;7B8$VLWk! z!i?Bee}HN1?}X#yUlGsvJK|WaE$oP4_z7dkI3eO3e`}^NTei9bdthB756LFNrk4Ui zRnV{r5dO=-@&{$GaZhBdLni|3q`LT9-H>m@1*8us4o3{^ffQb=ZBiuQ97oLgH554G zO>zZFLzuBa$L@@3}5O z=;!aO2#~G(6^N*rpT zY>ED~?2$g&$6;RnO~&T+^8+OPw~@?FT>3cd!taLIWgZ|gng?&FP9RS37axo3;u;5@ z+0}f42gG4fdQ6ufLLWJ)M2nqtaQ26tYK7r6O$&S1%x&do{>?KoUBJ6QhDZQqsv&H> zcW`dGO;oYXi^w-nMXhF7tAUquDJBUL84)C4?{Rn>$X0}vOaPX|6sA=83w!e1mrp+t zN8*|P5WD=xCR2tNaEyHt&mPwtr-QN{Kf^#7QilSh18m#CU{Zjv?UDfDYY%J<7^5cH z&sTg|fJD+@j)&OK=am_=*Zn zs})5E4-euyLpc(|gjQLE1lo`uaq5lrrkNl_9_znqf)K_Z8!kDSKb)2cUP(Md5rVnQ ze~1TvC^O?6MKKb|QvJ;VS7AqIf=on*YjQ;K?5Y`3x!r6&F{1G3T!u*WAnCZ#QR9ys zJc>*5d-#dp@pFrgA%4@*GoLbkJMDM1C6+apkl_$&aQUfdlTIZ+ccOEOzv;)yQOEZZ zb)g)~f*tU$+*d+Fi5^`}!0CIlAO6kX5p(_)4){$kAe2H0_NyAPbilNQ&m24Z=ijMi z{0$uNui9q`{Lp>o=NQD{@95{V?>wj!$DnbrUK|g9hjwH8`R^Q4$3S?ZR{WjUnD)2L zGkuHTm2m+=vLp) zf*+AQ$#Z>e|c zIKcS#jpj(z9Elv1|0Wf4K|+&+KP*!=O!C@L+bDOVal+jj$c!!bYIsz{H-hV;g#oIX zXd&=OMGHf&ar1~WD{KX2m_2lKXx~{tclT&xeKN$$_}mfqsG~c1k0ExP^|Gik5Er`FLSYmLpeump0(#U z&*DO5Krr&sjeacz8N9I@{o2S8q6Xy9|AjC+rU9(UAIh>DgX|%JD5N~pjj}?Jy^RAJ zM=nEjo_ww#do+xyG6cyHW(Z_jj2y-C+IYZke%@LaM*fSxqqK^j`J22MPA=oGsPOn( z#z+QZZ5k=sxWaF4*2MC_fo5G`v)Haaqa@=m+D74Tl!-by{<(7oK7CX*~QK>QDQfZPlSh#Ff9N z)yluKxfGR2tL%rRh)@0GG6oY!jIX1gLs*;!{%!xqpqK|0!(JUHPeibPZK6{+3}0rH z;kIDq+_H!o2^x?#QnS54;Yg1tkZi1xC)tGd>BL^FLW1LWw1Hzm{*Duq_UV99go)fJ zLk8fI(y?Xy);=BEGpTsj#)}0X>=rWsGQq#Z}{yLk1Vf zYPJWzxAjZC%un%O5FL;dh5O3HTA2 zAQczpD0cH9OO9eYzjNa@k$ z{Fh{LAK|u8IM-9%bBi0TlNnbeA?&`ZZfU4RNA%QftzQ6 z&5jZ9-+=rEUt(Jf7u>F|Zmw}adWf8$GjT){WdMnXj?P?LJ*11VkV}k|%`Tp&>4*1Y z8kZvR5luDhOjKn^#eKG!n4}wp6DE29M!0Q>$@Z0%Rp5N7o{`;&d`w}bH%ReGryGE{ z0hLLI93OqcfQY|dNy0BHf)r)~b^ZarXt3^NHs2YIOZ6xYKjd>)x#`{<Ycm&fv6^saLb-o0O(r z6bF;&h3`noCNiYz2LQ$tpv`+u%cjDdb0Uc3StlGW`zavStURec=OpujB{V&O zneiM!Gx@n`*XAR?MC=-vuxXEnRk*NOd3=3d43R-t#ZU}Aopx9YP2KQUT?|d+4<8MW z8S_pMD&8kP523#O9FR-*Ko;PM0zH#G3^YvApOilV+(1Oh8qQ6%bvHZVp=?MTE$fDU}jz2 z(1WNFvn{DRby*M(WQP_gR(Yts%=-mAY+dDCM~5h&Hk)L~cF#y;i?vFk%KLqDqozQ~ z&hzq%gUx^aJ&R;bS|bI>bzv~dSv0Bt$Dz=K)*b$WE!#ZjPP`Y&g)wzSFgnIsyx zo1u;dZ#p9h2|Nl4nc+2o8Ls!78?#`=wN2Ru zo^G2_S6PlqIzI{w^*GJMYHY_>Y^JbuqMa?~h?&+^jmvS{#L*CsK53v-Ty1!hK7yul zd2zK#rcI|%$5aF6%SC#})J8ss44lt9haK}b0);x}k5uNaBRAv7QR|winWNS+cSB6VmfL(KPDkSR45po)i--BFOJ zZcFy&vn6@kSpg5kIgW}RQZ18HWub>zEYp+PtkHvPKb;)C{BR!Q2T&3!6pM%KSdtge_q<@K`{Uh68i%r}9$7EW8yRFdL*GL9Rmv z68uNL5(mjzOCi;P8*5wY_Jo>QW{p9z$+!}E+7+{1SpkFM8xpfwZ(zPfz7hwW=+JF# zp(PYe*67X{LrN%0kk?R@5IPDf)`i7jK4CE^3X8!U!eWp@g)ZOytxcazmmgcsCa26~ zN_EQSh))#pu(Hd70K#F!4T#7E6!ffs4uJNnC6{bSf@UoPr8*_e?z0#I?QkRftkYO)QTF#D$1V_1WPrN6<`K zaJ3<5MsJnLo0ZpaOCr8Z!4PntpkN5bPo*Hayk#bI6&Z`&PZyqLWZE8HO4Mq*A+x32 zA~Nk1Zkpipwt`qkgA8v@uBg9e$3g)!DH8$^Rmybc*ncWhrdtonH}McpL~tr)cujeM zsV!J|G?eM3J7tnhhaKP9BAnCIGf`HhOs{yHWYQ8ZQ^viU3>o*krcx$E8fwVQ5kn{= z(^t~Lgmu^CMd5*urXtg~096&4{v2_pX7Iqkmzki(TgkEGw3-I#_2=mdY+$cOSCKIv zaR$$nk*V9?&B1&IILei5BY-)+qd_LvrxQYNI7gh43_L7GC7Wg$9~Cn7I7V|gM<7GU z6vGv$PRVc-$Y6uN79|BN3BqX%jB+JQ1K>H7XNhO9Y7)%UGh&G|O2P_86_ae`rX=(f1DTVZ=VXJEh*wWd-gX!j~*c=`R&QKs!@m(ny@ z=C=glRAk!eEK{zv@wCCwGH}O^yiHK11y9}Hf6fDgfj_lkFfOls{iW%@2t5@qBv}IqlyfvSDH%P8hP3SmiFQVvlb!V9N@ymV;A~mI~;hPQ=jZ4Dv#5K&*uH& zRK32o!-I@^<1F_kPJ8RYk96`|btaE5;~`qqoQ_t@EC(DN4-9VN1{`6Z?T8l6TH8Xf zBTD#at01s`+h+F&P&2o0I%>9x8g@7YU54nSorJ(=3x(nC2E(*#QX7eZMq|EzLt6LJ zZo#~CGe>DUawbppyw%%(LMZh-w=>J8|2tfd?t1IxlJ#^qP)Z6k3DW zt3`zo0XMF*=rRtM+x|M>#&3b1Ar1&WbTKw3!v$AwI(i|XhV}yuL(m8S3(nw=c&HJv z3ZoR_2_|Km;p7faPTTx8!yFs|_XSgN2A<|m0-K=Y@JE==;KSf6^B-{PG6ZHD!EWYh zTXPKYhq*0$hDu?GBS19Bujz=k%X33}XyG#i{weD?ba7$#z1iY=lc2%j3q$=Zr^djn#dP_3_%$>gIZ5 zY31_GwW}I?M$AxYjFwkd#*NE2*Eg2-UDa6MJalMnys)rv3aE*D(Kn*_KkbrVd1zy0 zb9ou5Q62rkkp_B)5zyehXnf@q{D^f8zwPVmsR>OqQ8Y$0O8y(&~ z+ViM&&i6D_f`WEbx`^3rjY_0nBv+i}K&}dr2(6)ZF(&hjrTvW^OM5mp*D|t1J?^-4 za7tk|E`cnTgwM&1W{}P0(1Vql%gSTYp?nR^2kyRnyl10v&JtG6Ijd_2M;ktY(b8~C zdq~WwV;Y$#Qb`i4Hi3lJy5GKc@6yK7>dI)jan5MZ(lS1b*E0-)Vss3;FwwWhAkJGP zjbSu2`3|;E>pkOq%sKBvy-_4NOgS9Uy7-o0z%_4UU3AyB%pZxz@9`$KE1``1PX7aA8In9x>r1Q8_M8bRX&r*A|!2)YVU zi_*UhgjWw?nL@FyZ>(+Z;ra#gP+)sU8>7a)wbg@@1fPy@8wc}eBOEB2mQ6`X46Daz zjSD&n;nCXu&4Ws6Bcv5u?<3Y3vg^Q}AyU;j)1(I;I zy!055nbUu8wC4bLv#~bbzqAfUU1yQT{_)CqZM1x9V+O)FB{Cb~s9z#W1Q}XEn9v#z z_ZAxW-#mB-sIG#E*EdFM8{0MyHP%))H;DAcfzd`|kMT_4KQsKCve~h=x@Wu> zrbOe+(eiSpB%|ByLaGgKzlyi-1x38lxuPJRd$IQAWcQR>)7q6PMh=eQl2q zP-cyT5Fz!fctXITr9m9HD1JAAprFvSN_=+bL zFDa>DTvS+K)g7ycL{u>%EW@G@fRU>&)|Vz(wT>|&i(At)VjNi{&^RVQPGT%*ZE?X; z+^I?CI=UPdjTVyGh|w&EOo&EU4DI(Rzk` za(HRufTDrZuxb|qYPB^SDU`4(`cB&Ks$r#YbPE85&WYSDrA`#+}kE!+* zqLk%#+@5Icx@u)(bfwQw*k;Vk-Cn_HtI3~8h=fehrO*ld8e!t)YmE!f-?0nJ$^%Xr zT48t6=ZnWqXVa+SH^jVv3XLeHYG`GM)S~8bv((Y)Vl#3!Iu)lNCF(|ZJ>38n+;vO& zK@2;%>(!XGOA{L;RE2^?5q{z3 z^2XAk<*Nc3h!i#E!=zmbW+hC55g2Jz!K7&VZ(oC^JviQ2+M^ie1*`j)U|es-YjNY- zXLl~kAR!opw;kf~9f@H|{tB~e``13ZeEy*_nxdPqefRq6@+PD!eU!`)Ogr`&;@D%Z z&uK-f$2_%4-$kiD7i-lC*u(Llt?`I6S`qW{#(_z^swr-!{VI5E$!i7FFmJO_s|bEO z#ZsNF>Xil+)Rqn&iz_T2i39a!KRswRmEVBN6IVYDvI$5td4+OJe@rov5JhhC}xdZMHwIU zcE;m%@^njPVQsxvBznx`pCpfDb>dD-I?gZMs+IOVApnDyYrN;5 z74dCnY-`+I6yGxl&_PDp?EWiK+Hw|}q zMwX&gz3afzzKzE6nE#l=nK5h~pI#|)S;MCyj$`Ukg+4`bT*n8JZ*7UErKTf>c;n28 zi-bvpDvDtp^{Y*sA-1-({{W8eCQp4TPTkVhTa8#1@f&kQE5s^_-!e|~5v*H^Y1WXd z7}^#DtZ`OR_~yvX!&=4t-x@*{13TV#QlVB+7#9$lk5nD(+0W*!ij=l<^fgiyrS#6# z4XSvq!l?|^o=2ZYk|ZV%(yBtDqPPx-h|4ofVgkjH%B709ww!`0Nvg?vaihSFXH2zt z3V7k<-R!BV$nTgbKS?1$>tY}r8<}Nc*HP=i2%L#pBvG8am|R;yttiURzH-m<=K2!O z7fopWIwoDP$ZSk1LOjL+E0`38_$6DY{W>Zg9AcY|N(hiwx~6QZ%@6LWz#jj~#JcN=j%@4G=6;_p<)oF+{zdsw^T^jtTBcfWy4kxa#g5}<$~4G z-UjkQu!mg=>C~y&MtWq8nkm8?BfbHd3N?!|To}yRH;zhg-FFDwM8Z`1E{bbx_8x+w zUB@2z7Sk8gxqSMH=2CTYyh@OCpGlg&D7V7&`K^+6D8E_T;ix9L1{pS{WrY)oI1ICr ziPHk!rQm5|t2l8*L0-L$qR@3?Gejw-Ju1QJx*XGO~5JMz%)6bg4Wo1S5A&1 zN7o6{g8?ubsfs+0_eNKcDn?8uk&1+x6T2?bjAvpONfbqTe9NJNT~VYHyYZuOGGyw^ zbxN_e#64l=B2f|=!S1Y}QIzLIW503(m;*3cnFlAFC!I~2AlMU5MSHw@{g!ih9jEzN zy$$1RHgXliJf@yk2v#=CD+J4@FQos@5L&hAt61Xkd|?Hfq7<)9Uu5&?XqEQ&YiL#M zaV6Lz9kGH|QNT|wy&9X>=+uKpJ$u%os*M6F2&@W1gw7C9La4}3b<9e3d5u(2lt#>o z;=FnTi8DKMMrRX=cbUy5QjsXqgEgX@u{K)Sb6`sqT%$!X#$8jv6STmE0Z|Y{6`Zbu zlnO?HXpKe-s+Oyu8e3t%+49OdQ1bk zN_j9NCXLUK2nmfK&=ZLwT1A1beC7Gj+BaHWpMh6t53Gh)oXdz;QK**_dIPh;8YSslg*sHu2%N~ULRPAg(QrueH{Z%R3J*HWk_lDkC{14w^58kU6U3Y&I73m8Mdv6kh~OM`CVi7op~h=OJ!7r{ zwsq4mbJZetML}QAauu-(W=y?nUi?&tuk_Zb}`Dn)^=q}Jl#lYyKP>86r{Po~Yr zX~LohjzxhkXc?!N(>E2BZv7Z(fjnh$6vedy{ab|D>$6k5dnAt34rylSgxN{i7m1Cd zSPE>Mazz3gH`_HnW{n!zg!{-6SEf>}aQGHz#?=*>s3@%~7lnmuchvK4q!3N*me=ss z`6hN7c{vgzpb--vCnaGyTU2O7p^S{tNqlNIP8AH3j0_Qrbjr-N zyknAUqD&A!6=aI?_CdHL%?>>;bA!6Rs7grH!_ox`#p#QzQxwHY@2pMN7DyG$`T};n zx~*Ekt|FnMx|$@JptG=>IfuNja`s9ql1FN`hQKb}*HBjQ1%h;uBvk3YdL=_fpfFuA z-6&jc*Itato^}kPy_m9pf`YGHi4iJnf%~LdE8$!}%!?K)0h9Q=Qf1O8v$p7WF81zV zF<0o7^&M1dB1fQCOvS6UapTf=p3T+d?bpjRH13oGqWtHqpC_Y*Q4~ zO55CmG)2W>k9F+KoYQVS;9j6jMMjs>GEs}7sfLZqXuCe9u(S$T)l>EgSXE?mlr)nw zCg@D8DvPX+QKx?QXaS?5a4zRwp2gb=FGSWcuLRs8m{8!JHeSW3a8F%Gr-c@{C#CR2 zFDxY+1}`k;V8v|i%2m9O;zdK7=)3V)!WL-@6>QN~MLd^MEm5i{p4p?_@pxcqYR|2b zlaYE3LNSpcDzjo(qnvZ;m@H>|g6THz8KSU;Nku%DQZ7N0qIec2xchK|BJoyn$D>z2 z0GiE3q)0_1my#?|t0Xy;i5T zsUNcrE4USCip?Ig7$-TtoXlCrY7Sa;ApB?3D%kBYFjmU#Y%i8`JCS>WJB&6O zhKufUSI91t^L1La>*qe|w2HJzSQX{I(i>}mtLVqq(5guIQlcj~YYPc) zoaMv{vzf70om$=c?Rf>(s)+egiYL(8Ld;hgelE1|3e(JW7^#ycG03orbSTRDimu*k z_t4bjR-Is-dQNPCU=>MUO7sN5ijuyJ*&G~J$XF;~R+01Zt@aAdigI3CFZ-hDZANR2 zV)3!4BNY=BNgtCOC-ExhftK*9(W`)0{d`k_UKLqi$^&gLmh(W(vpiyY6|TIf;}z)> zdB2nd3cR+A!!#=MI0wCY*kql#CL?_kUPW=QGdDGHU*Y_CT~6IvtbT7(vnnz^#!V)1D<_6-h1(o-n@?^P>7>w4jkAzM zKi0+4IvjRB-!fR+JhWvPs!pwL-IJ|{p^|MFW-?~;rLEJLB$~od(e>Txh@UFdMiVZP z*Gov_II_%UETCW7Zb?zHh;C8v>)o*$3cKuTV?Glwwc}3xI(WRI5cdaymz~HG5hdc#Pi80fd^ck5oW--MrB)&Rakpo4$efvTaugJ6; zmv$f4_{GccM(Os2?tL4({CydG#`9?Fd)AhA1hy};;cuz1!pAS84jF9N*l*juhGYF2*#B9ui_K0>$ z%)6{$UOWj2hBeHa6PWXzr}ZU1kb%blqrO32{a(BZg-2BmPrjH^BY3-hNm-rXk-!P< zV#uhRwYq(wSLKu8eeudFuTtSd45v1X&v}#^?*-yQtQEcXGo9Lns~ihxM~NR+W$C?L zyu3~^T;P-b5u$AjK7n?6@py*Sm{fLHmoY0i(Yq+2%W1FM7Y6?|h{Mj9$={K}3GrZR zRQS87(zY)Q4e^%qH#p@Xl7h}1c4d9sS2dO=`MW^zUMX@_qj;cjLcHk9NEsDa zrMW1~p>r1T)N&N#rgeI!HZZa+IDQtl6fVLpuz7*Vco}z6i0r`Qx=FY0Y+TxbXTlpJ zdvL^i1HNW`+Jjjn(E%@THaKB^H~Dr!)q7P$YbAp2Ant{reWax8rnHzI{q#X!oGm=guj3DLy=| zt_HgTh;UY-hZf_*Au2Hhc1^q?pE_xy(N;((Vu>C)9op4~YNFRig_a#KG{8Ur@1&1m zpoGY;5`ByV08N?!&?W#u#j}?_dIdz<(~1!FmJV1MG5Y9t7`BgDV@P7yP*h=v76w_T zLmRteF~rzG9q(d@7TfWpq?!aRI^n@}e8$wB(&#$cpe(yc^VM7=Y4Xn`-5|Umq6RP_ z@eWXZ22Nc&{6m~UTz+;kfDQlzb5#X^QQJ%(RcHbOdR~EJnoVGU9@ChbL!xZa4^<$Q zx)y@4&p@$j*1UZNhTSM}*dxgn-*bK8wekaxE?u9`6Z+Xpt~Irvp|EKPN)r%|?87 zu5LBaWzXr?A=C9-#sff> zakDh4yt0FG3GX?^5IU$x88a|U% zZKFQ`*oiG;18~ZerYSYj>YC&T76Gy7YEjzpL#x7BHR~aKCWY->paD3|W`o#gPO8}r z;WMe{Dzb&wHwkb~?Q+_&KM2mX1w!%Dx5pl>3C@sZgoV$VA%$fOzzMPREc;AaTFRI{ zlPmi65}kb}9V}7EK68*tPuf`*G?Q*eX3VsD7&?g7rogEP8h+Kcgd6LDRI%(I`;0MT zx%%oNTLR!?l4;S-n7@ZXqD0c+tsX`RfUhvKHR9P(PA83xVJ7+elpA&@iO}eCkvHX_ z7)SJh*DzBBTnj^2nRr8hpR+E3)G!mDeY7_;X=rmf0O^OBI2;fo*SRe&ouTPmVKks{ zgyKzdY(QDqbUOkTGYOGNhQmaGqSSxthq|~qvL_n`t z0yZ%KZD$eyKs&w)7bGlm>;Q1q#}PFhB z2Y|d{?yn{Z%78R#y9EG<*vG^gX#gYK$|OPpLP9bzH7+!O#6o6tSv6_}6iOCLyGgm< zp55H_7@ z0o;&mO=q3Sgyuz(32AaRYGuP9uL6<{gUs3N#Y6&;k&+xBpY`TI4Y^8bHwQv7pN@f= z&Zk3c-E+a(ZpsADBq<=IVlSHwGbn@VsY@n$8ATHa5(!g8{5#BbK3zwc}jaYFaxP7t$GIHJ_{&*B&4~S*@0+ z?nm^X~;vfdBp==y9UQo?> zPR0lz*)X&$GE2PO>WZCQ5CNirWlN{k6+6X^cg|vqQUfa?sf%{YR+Ag?fT(Gg-GEp_ z8Pc|NTzNttb?DciD<4;fMiU?!SHOpE13+2RR3Ct31EW9&BpVpzF(A&cAWH+{)6=1S4M;W$vNRysD7w~8Hj1vblZ`^! zcF|U5U5>HCvK*5KK!$^4u81*x1v%xCxuZ2PM21up`nczg*k-y*{s3fIHfpXCK(bMD z1ptzbnkxX1Y}9?x!TJhQPEC$NK5QE3O_(bQpB{xMJVbA&M-~JmE2A(*E8~G4#VQ1# zGeM8)9uOZpZc!E_)1}xZ7s#i)N1FiEeDJ-NHROZuQLLhj557mS3P^@D#VQ~f(r6fu zJZ8;Ms)aloBaaMR=p`ox=#C;8dgvK|3_D6azJCzs(+phqF>zg>syMQ=;?PD`#TJlI zHAMPi;btZnWE!;Gjl{cH9AG}4zIeKs@kC!d4c+h9(OpF?CyN9p!ZTiko(PI$lB+Ks zMXV|-#A#|;7*;x}Pum|5Cm!u^L}i=-`lJntI63>WXfxx!-S1n&K23cwHcSzA9>}9v za7VP=r&ZKK1jrGjQ3Oavb{a*1WWDUBetwc*(m5Z03V<40ewqAe7-3lK~A6VfjqYm4h`r~<6)kBz6Txk zmFeUGoePx7rWZxfa)ypvzz}xRR19c(p;9(ZIfXg@4YY!T2nzVn^n!(&H4PG?uWX<_ zO;;w#Reg9cSTnE znGLLvLoQ*4(meglC|0}x4Lf%uOv0|RJrvloBx*k=vz*Sp1+{H*BxE3D9Uu9eeUCA> z5insp9%TlEtkKWxn4x^mex`%9n}r3)hU?Oc3|*F9LyBBTuMV7`0|hP7a#o85Ja{69uoA>~ zlCP!`F|p$<%QKoDVM!vP?QTYt42RQHInFlXZyi`Sj*W+we|+4#sWfGe1m*4wD<^!xI7KH0zQK$_qP&L#@h%x^W#%FP;si^cv2`mMoCOt8hT>x2u?e}g zu)VTDDKrtbPmMYdoGvovfGQ08mN?cD*%Xj-G2c@D7*gxh`RFd5+Lfz zJl4ASA}bcf7b=1^NzEQCyh-cJzJp!w3qmS3^Q7S28@A3jO`6T9Hs7{gJ#bqBWvpcv1@Qez47Vjv##(k(V(bGbI|X6$!Tbp)do?$(p9FEi zEvuz%D>0xW^L5d+UI*F$Ef3u@>L|ho!_Ud12p=Fm#S+{IStStzgA<)M-6+5%kw6*# zLWT}|YUjdBkvg{k@J=R6WOJtt8Q)OFy$vdm6njU?f!8$!Qw;zjl0GVanYrE_i~bm! z8BHYPGtaxDrH=SuYD6Nxl}R2geZ&jB1X&fE;|^fp*(s>7MdnF%x{L+~H^|WFDv;qW zLWkxy+RPeJU?US9QZubgkV)ROGO;CT)AERFN1;(fF%zPaKKaHD!rNfbY?}c9OdQTf zWpywO*feqg)j-Sb6$O%jdsc#LFxwo0BoV+#NYT=0nXyurO>C(wn|fS5Sot_FRuxV9 z3J0$fp167zv*H00U;(_ar{pC>bhnWa00RVjOj!xwi8P}O00gk5owi3T;Mfuox9hq(vC?*C?b=SG zYl*J>&9;kjob6&8F3E8YQUIZ96p=h^yEE5C!aq3Amr+*&vhD1w;|GY$I7KAy+Aa^f z5@sD|=dNTIb_)`TB)i(C?F|tLFT~2ch!lwXhg}ITM5eri^n*KoUD?!#(Rc|FAe(Oq zqPBZ|lp`RKIej%jBU72dx(L6jh zO0?XW0|5Ncae;tyeVEHm#&tMTMS!n=6k#2ALjb@sgVOYVxy(8l*V&N>SAN|dmsuxc z!yY3j9S@tK1bcDK4*+|~+;~9Pjc-ABWg_OI>2s}S;S`imH%>&Hlwt`dB92B8;Df=* zCjyc%!_|CjG~0~^gsr-92mo7kivj?)>Xsk?Y}E}xoIOyhzT9z8h9xpoxpsNsU7TJV zWFbJP8n@%=BSJDV0PMw$b)4l?FIu_* z5sCyD3f>L9Ay@$!K;2}cp@jscpOsKI*xN^cY}E}Q0NASA zJ6-tH# zYy*JZWTIKy0-a0}Bl5)(8SePZ0Fn2i^=u|}T@aCSWkG~6msvyuEW1f>4Z?}^$b>uM zT?AxvDT$CtT|}K&BAZK!P`GD~s3bxrhH>i&s$^ogFNqM-4kaZe5;8g5mqf_q@IV5< zgKyn|1VAQ52ND386vc}+?APZKaS;L>cLgWlxe<4pTGcyb8PVa9CFx2RLr%B_t6%_JtCpyIEoZ5s3sh#ZW}8X2??_gtJdFd9{lGqsF`8 zHe%Opvo69n1h^1EtcHLLcS?k=nZN-NR6#e+i14OaBpVGS0$dpHmqtU^jWxXJs&2BG zV3Z8Dlvj~5cT*In#@UNm1OXAs2v}EH9d?t6L_`n>$VNjE(aj_Rxfz4W5TS_ZW{Vl& zA_B6(P(*Z%zXKwa5nbORz=?Ksla0o-a}HoP9)Ro)Xs>rOyK+Dg(ar2ioYN*C8w^E6 z*v|-v0Dur}HsO>J*#-xW)~lOrG_hjDW3ERm(T;m*Eh;@{stOi?wIn)+G^{ zt1O9ht`Mso$E~V@NMH3bEEIx4v^RCCtr~39I{+iY;GI50E~@z0F@=hPHVDXi6|RS# z?~iu1-x6{#jHL1r5D@h`lJ*%dE7IO}wbN6^0fIEKioD2XW{Kzs0sx8Y;6-BX_FQ8C zfN5a{QWQjhpyTX75&#giFqBd^*dik!F&Q?J&?*e2tOO>i@5T#CfMfb@yx^)(646Z} z06-$_#b=06X7t?vKoPd;20)Lv1DI$A0NAkab_Ph!Zd|!6Nv zs65hc#-WP72g#ucQe+*mo`jkLay?(ONF+d`2;F!IlCtM3l+pxcU5kVP?`px}gMLcM56)vW!(c3V;MD0ete!`^ZGA0#w0(H$=?F&t#3x>0}l>@}1PG zb0Kvi`gK&z>dWK?l_Z3ZFK9)mGJ9Q)GD-+lLqrj(%wU)6jPYjuibQT)D`ba8oFa-) zb=fAQPpXLj@!~b(`hDZ3=z{liwz)@9nEjOK!v7;i6t9JBw4@4ZEG*)IQ%c+OfN*sXv8nlsF%JTAYR>MbU$3k3E zQI4>RP_4@$4yh=I6diz~p~o}np6MI3=wmen=W7ZnHtN%dYKq1UYox@mM2I$jm0TRGG{s?kgG@ zY+^%%iWcW}oMEId5c*70D}B-Rut?vI%ectwYySojN3SBx++5N5#b(#TB7Nmrbj=1b zM5GZAaZHU!0d(D>f%!vJJqn@&jsQ3TwENQaD2O5)*tu{nlty6cdt_Y6e*_Q-FhryP zx-K*OQUKVbNp)m2AcE)sVdg=PzBEFX2;7%OKvd4FP^KW}<^XX~X0Z090J6jzotH!% zpBh;mS-P;oBq-siN+Tc!le&=t$daNJH(^lKOK9>e9$^&G76rlsUW78F>*g6lvIIC; zr4isArz+A2a9bUqh2|m?$AHv^qbk=DejTeABHDY-vYQn;LBCE`IbT`6vmzxp6yOw* zybme5G!k%N2K{E~vVBQ+*mwz5Mov&dgQ?3QHeHlMI>3n@;CEIHB7KD>6FC%n0U+V2 zvz`DXawzr!KtgL^$MJkOcOcOow)i+Sg42nL_mp^(bb zk9CL`fNYeM9wC`H&<5B6;!`E1o5dLh+Iq~+#{j@lyL!aIU&B6)84{b@)h-RRu@JB6 zjzXpp^k-d2v0_I>=V7g(NoNmh0YEau7f?tBoGlY1t>vLkBxRwmp{(mHjx|)z*qKUn zfzV?kZfu|k?Jr1upCuE{ZW`j67ZMy&Jhda?1Bg#HQqEK+E!`oKQ3dhdk&FxoUy}(I zB+i_(Oxq1rK&*^7!X`?oeJJE3#||&6xotYMvr}!~kQ-tzPGuZv_?UoXJIq5w^i;-? zhSR_@zWIyfa@utH1~EXamhCDJ;U^H{Thl|FOi-DmE{5Ucq>lo&ri%EQLUJ@9UEiI? z23LOw6`wtGm~oCH zp%R=mS1-6qfV|G!y7@LP#Aq z&jF$Q@av5Lu%q+I#sI{QH(MM(prg2+-+6>W3heo{NQ8)2lb1?}FiegtA?iN)sSqr( zD+Vc~28bj+EP+HH%WcPUA*3$8IAbO8g{G*kIk`iq&k6ArzJqdi=E4b3&}NvC561)v zNlpmPI*SFuW{R3NMTZU&y11f+wX#9tjut_j0inJG5wjbO+af!%cDx~p3}o$O5H+3T z0rJooJw*Pp*TP08A<1+@8ER*g@piB^pfZk7$a*$5Fobju5*o^ywnXT3b^=W^jE-v_ zeAOUMO-MREg)$r%ATC!BsTRa(hETO2zW5QV7DT-pLY8ZgqM%?MauY1xL?7))z~apS z!Y?`Ps3ZI^|6a!MO9}{OgdZrDl_7rkhLC`b5X6!7tPm;hDYtA07y{x0Rs0L)b*iNB z7c`0kxQPG*(CcVN01y`{I)Da9MjYJJrD~3IpJEU93OY3uN(96SrdT2%-gKWr1Q73D z!9zft4=nk)oq~s85-Mngs6`J$r_^N28h#8AtpeaSCR0=G8xY+$OMQF zOjg=3g|eB4Pr`@oSeq{$N5C+=Whr(zHi`5S0O8_HEpFW`gk~H+?ehcTW3WY(?tn=z-c0%FbC5zQYu1MhS*^ z(TLAJY*0ab_T^y0F!#|=r3}rMG|DRD4?;S_g?$5(7)@6eLAEAZ+dZEsk{Z@^ktmY7 zwhKN{B!fswIPsgZI6(_yCuEvRjDzPB@dbc`^o?Jn*lJ<;-Y_6EE8q)xC5h)`x1xlN zIxzwOY}U7eS;Pjdi4Vv~qatF_8Q6vEa06QAEq636-VBpFS z5X!e;0U0v7#}El2&aLvT;eC1E(lp5{M&BZp3lsR=BzR`lK`9bFH;e%gdMPZ6RxI?G zS$KlOYPNQPC|O6~gr#bntMt zi6smXodWT5KPV!?xit;|AUMmNTE*c!0-ONaCWH#`5~LBfJ~IGt_rM@}5zS2W2Sh|h zc!gd`bcBDGK{#aicMj32bl(b_la#NEuF?VFh~V92mDu~DyLBi-rbK!<%LIIMa0ULI zR}ML9EmIwiFE^AoBa#s(#gFpvfe1?vE12}J9OOZ%; zZyCh;a-n7C$&t#Qm9f6EVJWf#H_Xc@x`CK*22sl+P)&@XBB!dCnRIeJf;5pJrs!s@C=riGzQBae z0=TmTBSaEHR)kc*88(LifJ#{rtwAUt7BO68jN!(MR7tj2E^TCjATH!3&@-C#esshh zc6inZ*c?Ti8MQZyIFUDE1Ih#_r2*>rnCV-=>-I6rt;@xXwuc-s?eln_ik5nh3Y9w2 zk|W^~StAAAA@t|7FP9{jPud7ZWIK(5ClgR5>r=zZWRW(35xR_3FsrJPhKV5)U}B># znn=^4XhOFVP24m^HGlO0!b)q{#SQ?R50^UVj$?HZgOCfUpYD`F8@diD?FcZCLBw57 zS+f1WgRi&+2?gwxOJgp@<=``>8H5+iBJTF#Mh5{B=O`Z@jigCH=DJFxS=LRKbVL(H zsdxcMlK{_608PE77EYHSJ`2>lsN=Jsly7MC)GGBbJhZfUkW?;!qZ&e6-mjKE1?FLVG$2Zzo9T8|c# zFhsN|4sk&i<&chOz(itPcTx`7;SJol>wRiX zxo@Y#9KhS>NyjX3hRUmOaYHdXKqPke9O>XJ;cgAyD-b|qH;T%o$89R95tSiGue zO^JX~?f#|%stB`e>l#@Os^iE@xBGQQI2a@nxnqc&23GMH4RRU;a8#w+{U#!`A*4nk;=QBEM?{rmHY>>85K@P{k3^POE1L;zlqblJeaE5Q*&cw|E43 zx$4)E*Lh371O#;qv$TYealk6BymWF1fHXC_Yz2U%RdkXFfV8$1v;)AW#*RR?-P+OZ zD+qjNb%d(#$JilBPtV3-GNI~nx624O+VIh7quH~Qv3$jNCU%V?(&wJ?iz1|==kEeQ zDthKD0L07_WdYz4@Vr<6h?ze{1^_YhELZ?Iy*L#{j;PBaPI6HW;kh~aWemtn${~FN zLF;TNode06m`*y!Gs9|#@%V{W^ zQ>)TBo?-^KOf+}H45=a{kJ|?diBi^h8zQmq-RdeDP*md&h!~BX0Ma>rDGt0piXFcd z1pqE?zZ3)jVdiQ|5mXvM2@!d2etQL~h-O(x28keQ)%jAPAl#gn8j;Qj_a;!x+K#{H zKm#DmJPL|D5H{+rjZOpu;44TvBV5;D6fvcd@rZPWU*LdlL^F4)k@mrE++sr7hXBqa zQX+m`1Fm}0Rsp zq%-`+9+VJfre_Ti1zr3+C5mYFJfwn+TG83LNJ_*n=s^|H%p)R-)xs=HBvPmrfHXCB z8Cy7_DMS>zMUf=l?Q%6gH3_?3n0drix2>T{B9YzI@5$$|{55&5R+010!FXIxfn5NE zYF!R-xfSJ*^4!6v$XKb!A$@}ueXP<#exDDplKk{gqP-2^_xYfNXzm`iy%pf8y|@a{ zMwVtp>Fp4IQn5x+?Mi!UFY0K;xX!W11w6GEC4`xK*orfwRi7297|&}&6;8hAHR3`+ zVivOM4H2oBa0Li?TXAR<@m8gCJTDO?$f$nd2LPOWSP5}C=!QE0oB&cWo|lL!!ps6U zhKSrwPfUcHM|SZ0JpdqyJTDOdA>u|j-UCvJB#7}GkN`=z;WZ!u998KIm<_}|AR^Q} za)XC_SjVLs-kB4?mylG1Cn~}t6=uG_)011`cXgnIFmtOK@Aarrp=yZ8FY(KF;MN)< zPFAT1*bRyBQV~edaDZr*t#$?XJcSaCie?@jQ9d|q05O0eA{F6zd8i{2Wvg8(0)|BD zS0Ms_O%(pNXqK&ZsR)0e7A1s;AGyG5n52j;RzpN8!p}OR4waW@&;cOKJRYWd(NMxU zKq|s7Z-8SDs+MAhJ~gy#wM)go)JO!Bit(&e zRME(?)ov=rEn8j11~h%BQZb&Cijaob(yT6{s8oz+rJ{&1bF<5i%6V2QN{Hreb}4-v zmPJx+N*@Oxi4dia)Aop?)8TgjoY|F64oKo4<&y)DrbX%FP&A1|N*|{&;;o8AzR#r_ z-%!G+SaB`8%x=7Y7WneaUnq$8<>$jlAVigj?%F_EcIeZGDi6Y+0z?&&*k!-HuHz2@qJ&1~vfm!p39kSeMWrwN zVOczk$%P4(pGd4QRCsAtjWtN*HEoUE1S7egzgvNXoeERt7n(gowK`$N_MHsQdf?Nisw^Xj{ zB+Xo8DuWz=!~ym;kUyKvlY*?`Athyy10bquYLr3_h~p}G@2^&)5pleq6;@6;syM20 z06c{r#~sC19y8D-fvDoB$^n2KKoS`u+B3qPtchrfI^kj&2M7`0%hj!c*vjy!kpl1s zn;|7QHJ&>T04d^cDNBwJpsA_LAvRr6}YsCPFpsovalOalEGb`ZGsE5}B5|K(dg0Lvj>f~|x(*SF)|pV^K0CsQbEB-1 zEjr0mf9wa_03uPg=wyS3S9}Z+$xuk+guH~CKjMRoBq8qy3Y5(a;hO}862hU5lGsHS z1Tpi-oieupNNlCdZ2+_ig@{tO0ZDwN)NKgPL;#)5p}dZ$Ds`Lk+5r@hkk<|n0X!_F z6Fex9=1OOH01)nmi0n|@2;z-sYCJ5Zglmj9iV*EdMZC2imA1tY@FYf|DcgziYG5^& zf7(Ox^CH?oO4Fj;B;VH7Zc=K8DjZ3?u@fqAKgOk9Bs_DGz6CoT~7jG^=qvP2}vB-BOn%L zQqN&4JGDjG;hbwb3W-B(KOu@1UG|RMlUP@Vf3nEKPC~-cf<&TxT?lZ3Nk}u0fNetfyjs91&6~Lo32k#898cNBX%y06K8+?5{96z^Z2gN~G~H8_PFn%K?XQb# zeVbd`0LX!j^r2Go9c}FZwA1Mw#s9-2KU^?0)kDT2`?Xkq90D%f<+pLXiu-#qqoV%p z~*SNn%%zDsW`mvYbpvKb~QmPo#hT&a{35iYsAL{%6A z3^z5XV+Pti{Hfbg>Gp<6R7~A3ZP1+)9>r8V-D8;Wwb52uAPTN~98jV4>~1;*(nBDP zh*7Y4&`dFO4_(2(#Bth%Q_K z76;Av2Vx%SBQ~Dg!Ie#8bQ+7q7){X$pnQ z7RX){dm&X!A3-g@FHHBQ;$jij)qoiX@s|)4^!97Qa9bR{O;Qn#EX?CVe_&2wZ+~45*O2ksH06wV`(bXyyZvQ9MZ3c*ejG6+EMA`t zcqsIZyWC^Pifemrq=MR>HK&laXRqtN7kECYEz%ibY;+I$GK^D&lRUF-~t0;x{MIz(l=blIqR6p(P#2R0Z8s}< zri23BNIvlTSPJ;;_31{2yB9QW3Vaku>@6wgZ)d?k044lbncbo484>ub@6!~~Rz`bK z{osLT>hmPY?1t5lrXU2g{`?Z!kU5pKogS(|_JlVGUPSUl8X-+$e2$(Fl$k!KsgvLA zKD(Z_M|mME1gI|nNGqCg9(+#B&oB=@Cj_W5@LWRTQ3ieRIekxpA!EWnvppOLj!ev$ z5Izgxx{M&+MHxYjaPql~I!?+6!qHrsVMfc5Kb|Ip+5n#&9To7kuTVL>&`3bLTD6^Q zEPN)yo^%KRyU0?B0AVMKDKc)ivHFD`_)MbUecnI>07#X^w1o)($KjXL0ARhuc>usV zi6gNaUhzUX+vH3Fpk7i)0RZ)q_A~)dFUb)GK)oal2Y`A>I!?O)$WV7Q@) zGj`LSYkloyU^WuT=!)UWl{7p>oQ7%VZ@^t{+#HdHt6dAfAiy>)aQR#$k2WB}<0G2J zkZPD3u;7u?Pn!)8#IXTIkKAw@XsaPaYe`?ZRk+qJl?PKGQz=cLr5KuA7Xk_c;k06` zpzUAmm#5Ec0O9ZS854|cEdL%9!W~a(Su2?1_i*CwHGS{(p}V0ck{ydXP6%+4a>?Pi zcIrTT82)UAt~JEryTruW!SF{0V929B4t+<2wI}RX$itM!_d$q=0=6aWve0&fodP9xGuAl!T&N5Hk8 zcKPjUCs-)yThb2}N%*X*b@4gUFYLu6B?b3G<&$97&P!7Cc42PXwzMr4_sVRC#hqB& zEpZ=LnpET+(uSu>!Rfk=*6+#E z?Nxq@m@c03Cs?`gVV{cRb*VvoN>W4j(4KsLbAgw&SN1jZUC8DTHkcznA+Gyrkt7%A zgi79%2Ow{dou7gmxDAURfvFI`rVHcw!0>hWF`>l`U$?4tO_&?iaCPu)vZ>)0@nb?uVf>8H zx?3e_VBC2pHOwsVttG_-BMWCOs{VtI>^Yv4NB>6#SJ zYpFoOSAyEFW5(lJ`aTg-$9DWdv7v(QeyQ?Mg4yp>9_mDAxKh~=kYGug0q<7Qq_^q`;LN8jU;;?8WLpS;F%P08C4j_xI(SQve7z{{ z2_RuorZxdEGBDLVQea$UFfu$0;|!!rgK(TM1L;^+ID=Ui94uK79BdzA7UVhk!r=n) zv4_2dbIx2iXKDZD+IZp2(V>l{)s=;F&Oi4-JI`L&-s~;x+HwAc>kF40URv3^dU#=J zWn;XyZ?tE;u(7dl<@%wegA+!Jw~qCgjfm%m;8F(uKq=kHfTa^yRuD{S-1FjRzP^Q8 zi*b?-MpjNabp|5yq~tDvl$sT8s|C9ljN&M*34s(BM+Z(+W>yQ;Xr!o|u7SkPK%zYo zp=qn&{^1D_I)Id#fXP+{duQeBc!9Zx5ji_y5cl=fshu&1#$^COkf)QK0YpB{xUj{0 zN62H|BL|*tO=c~HfU@bqc~X=}W)F(63T*b&28DOl2_dNEnIwHyl};6d2_tJu)1$y zJlb<$Vc*htdGEpqYis?$>fx1zjn##vjrE1)@xBd=Ac-9I2ZyPv6=RS)ZauI9_5zzz@Ea^_Us-t2%F>k)m+{)dp|#b$n|naI(aHh@7n%j}Kmg&k zj-q>))-e)**T;L%U5+2lPjnV`U6e?7(dNP3Xp$ac3~drC%>Oj3h6@*rt^&C@c?ZV_ zSJ$qhV9BVC{ei)hQ8k-c1EYoYjnSS*E$mz4ERZwouS2Vnp$q#CE$Gj6vc$##5HP&@ zgarUxaRF<)Rp5qZ3-d5u+q1MjUMGu3o@W(YXE9Bfw~vr1&Rab^z5-MPatmT{ij^Q& z)E%~7rch&`?v|HU9)&j6$D_492RONCYI!+uIOv?sG-rM<*M zq8&>du^ZNztassP&)O>aF$UpT47(O3yqb$9H+SOdr$wKF3xX_?T+ir=0DZeKI;?{S zjIUa_c)WJd)Xib@SRK*;`rMbSacT=KFY(83E=IV!qvq4=O4RW@MZII#Q zsI3(U)Scr!n``Tkf(tv=R`-n2AeM7VN>OE;h5$+%<104~FYSe}%`L2}zy}AhMAoiY zg8UN!f@zAX{~0D4>{Rhf-AW|Y3RWWfg@A3A2p^|xyarTH-T~!5VFJ!w6((R>Jvh9w zIGi$NUCEMyD&wS`nU*ItQq*Z6V~jHpC0xZ(8clcMLJ9hX2dzU7(nxVW!kHN|a80Xh zr=gl7kL;>x$Tv+JW9gqc+FXZ5_LZM0Cmfs^P7|k1kpO}SEJFD++L+Lo~d+D|7 zy3#Y;7oh*3PIYOTq(l-h+=wfMTnZ?mF0Dcuv_-{6EUBPN;>xejGv+yG^X&1ia?}y` zcjj7S&D)scKL273{`}$h4$O0EI$s};`QhL{e)!&GJy~sLJVaK!yqMiLFaG|A58oI^ zL-8cZPIEB`FJJr@8|Rnb|MBC8Z(jVTfB*U8i+}j>o8e#YA8fP_OvQO=p#O?S@$UKV z|J~RBa=6Xkef=-9?4QEghvJyrFFtS>)*n6|E#=|7xE%sIc#E7rFOZ;e@q({D?NRe# zyZ`Qo@BjD5?;qLfQ`+cxfh&IhT2CGpB^LhOpT5T`oeF>WVVJbz?VA^ljczHZ=<$aizH>Bud^~%}CND-XeR9qnaw9eMe0lxi@6Xw8+;4SYrn%Jnt8phB z8Rc^?Z+P4Bp=OaH8kbiz*$lU;xM_wRrH@Rxb~$qeNae){G2^QWIb{7A;N z`yQ_dd>EF8Kh6^Ur-wJs!u4ji=G?yXQyVk--5mNvuaC5oc}&~eMLJ*8Y>fMpHsR+O zZ=T{S{G^+y+Vb#XKVSR#q-gm`@nS%}{dE+@htO1?>d&M2J?Z&=j&=AcdfQK0-K}Jf zpQ9B%jm_6D(Eaq}1Qg#~qWLC( z5B1YG-YW0==^JluJU@NoEp_ng7wFt#C;ak}x1={eedI0U%TFJ9OYZU0v$xz0KYb&^ z!qY$=>%`M0_gCL|v!naz8y`~^PJhQ-Dh2EI@SI3btjme)*X_l}l=S2<@HgLhQyTpA zjgm&5UNnmRt@!&n+O3=aKy;XgE<^`U8E#AAKF;<5wk2<*^ze3*g1_qFtz5jHI(WOt z#ZMii?mrqNzJ7tiV?e=BI%Zg#{pr;YcGw4#?-{NKOYBoXfCqHb=Kb_KBj&idjoE`S z_9>uCd*4dAx((BVIrd37^mkvY4&tW|n9qI8Yds$@&p(;MzkV@(GKmGZp%~)^VdX}C z%(uL|k4!`R`P^sIa*Q9h=qrDp;b3EZ>i;q4zI?FKKae-LQ|$lN!1po~-M;r&OP=j& z&2KdtzkYFyz3!EJdio(a`^m}U?>=`*sNDYUbLj|AY+VDxOL@EX=U97h)*OE~JT%!) z1m<(!J$a4%eLnXV6X&<#mDqE8-;DmJ)-(41!J0jv@M+Ed_dk8}(-;4WT|L;9{Nq6) z^^b?4@{fmJ`NzZ8`NxB3?jH}s=N}If=^qaZgl*>G)BNM<&5zL{kf%3426K-g=M0>G zoHu{|nSVXK`q8rnd3yDucUslCr&m8Z^B_;Je&i~Ur&m8(2_R2zezfL6p5FXu?tlH{ z>i3VwDfF+WS3kP+Ay2PkS z<{X{>o@28!7k1Xl#zq=k*y-8EX5%jG+%~kZ6SuyxvA8en+^)Vb35;pSzglcugZIyp zj#ht#*B=-2eLIz4%No!{Kz8zg=zmEZZ z*x6k>@%Xc8pJQStPUY&2jn`sf$56JgqwsEQR{g?Gj>yKwA+fMijA>&XQ^H$mD7=*S z9XIcK-#L{wHZe*I6Z=wZf+knH6YzPDDHw{$Zfwt`9e23tYG-leS=B0oo%*5c*;7RE zIi`r>saNzIL-!Q@dXA~Bcyb(`W5W@K|3AmHJGbOK$FyV7+U+=X);iVhTzUBXS@tx= zeD9x~%NpkZx^HK{WeoUR*0W3wC)nlrv)*?M`Oh)!q@&!^(C*YAyK5)(W?W*=G3}1% z{TvhQaIRQ*j%jz2J)UFQog&50G3`$Bz`~C6=?jHozU9rSTD_hXi*T5utkzPNk8|r6Zu&sT{lLo_j(Ub~0l(c0q$Qbw4f= z5l&H;^{i4(Y4JWs^S&7=MKt&L3A4PwB1_393Qv?zANds4z9|q?8m}*CoLbz^znPS+ntHzZlsR1O zPUWVBNkUl9s%_o51n4|V^bY2H+q~0q9uwvL``l!(*PlGd=#9!A?zuFk(GA>U z*S!ymE>3EXjP%B-mpP&n7kd}}LNB|ZaWYWv`)lv#eI~P5?Qlv>mxhYmS*Q5H1-9ix zt51QYJs*nRXFYQW?6b!O0$cxJ=rc?A?_*~;Cg=MxP#Sg3ISKRE;Z3m3o3tZ!-P3?M z8H!!dIAz4ww-A2vthzSAPPx$a>?!xRFd2ROSv(@|lbe>kpnkyKM_+Q}Zuvls)vR3s zA!GG_{w>D7HWXH*oIS97-GFWNg2W@wfpw{~;d#e`} zxd}Fov-RvLbG@;g)41+<30AvP1n(Zh+Sgt+&Zq48Y8TraC*jGbTJ25=*^Nb>w6`Kp z!m@^FTamM=my-#yXuK~CLz;GM3c*z9Sp2}LRl5pJXkzp3=?cHyJV!KFbTC-wNRgYY z7X@guXVjoseCQ=RP2>&O#8j>CJ7sbDLR=CNB0HRdE=aIyHl%WecvfxvanM*V`HJAtkXU#NHphO$h&7rInlRF=F6m?bC9(?J|#JMktf+`!=E*azBT@ey+7=% z$jY#7d&Njj9@hQ%xl(2C%kgz=o})@r$3Q)@eSWCF)G<&3Z1Wt_clDX6uv(r`3} zt_lFfPVmqD`(|VAZ?^D@oov7L>?zN?#*nX|SubUH7>#Q|Sd(8XQPz$542I zm4=Yd)y`Pezxqy2MdV30e`L;u7;c?O?oH%zUhL?Nu-M2%&BaCri+xB@)#&FctCoh% zu=Q0rqR}g0u>r8YL^oimk1kGCtId)MvBw3s-+JRqSad6?644Q1S@)uHqrXYkD-CRI z>u>KB@4CQBL->2!o!ipy*0YkYrQs6My@pg`${d;Tt^4tH5Mb{2hgMuF_n45oQw8|` zTd;_=#tOXm5ZSp+_x@W{!(Pwoud)UE`>>&m z0RvXCQrdSeq!_F&2`=!d40BV6z|z-($3~Db}HlDe=|Ex+c9wL`BnP2*eT1u-glDVo?~{t zB5rx#xd3vtI|)$FG5hWPw$q5lJXbK?wNq+*+xpN=4g&1d8GHWhV0#Q;=kC$fj`8rm zAKIPty4CL7IkmA18mDmheLI&?mxk(7o38xyg#pf8hxhLj)v@@!4Sh;9t#+rH(8jj> zazdEM}3cj6^M(X+LZE?m~wWky)enRT^lZ?%=fY7t~1ZGi35PW-mwOQ?RXVf^w7b!{SS6- zeOUcCRi8GtgNOKsIlJxmI|8 zb7Kv(i);ZCgpp_8Y+s$FpxwD%aL4%gK z#(pYC6iZAX$4O!W2P+LLCht?qu~>ZN-uJrmA-A*7I(&9Ngyj}Hcf{O}m1N1bJ9Rl% zyYd5h&KES26QUpIGKlrQ_w9$Yw!M!;RBnCMh@J%1=kLQL1=8*@s1Jxjm;9*N(_0_p zn2rBvs!;DZ-zl`V|EX8rprEs&1Gcn=<3y)Rm zJo3SW#4MS{_$e~J=n7%!8j?D<*V^PStoK>F=PuN{IlstXa59!hz@i(FsKbX~;X~sV z-+YKwYTMixxuSQ&qIVA#ol_Zu%$tavjH#^c@SMp(So_yl#a_ola4uZ9A3wIG%n=o$ zSn>zG?_4;u-p9zj=Un>R1$IG$l9Ol871N7G;v;-Z^3Vp`G!!H|g|^rG5+|cwWz18l zZG9h!b=$`&Bsj-v$K(-RP3A-Pk*SQ#1&chSlzQYLSoSJ6MD{sTtBan@ zinQ&MV_6Ena+KvfXT91nvz|RQq3+h7R@;Z6-MRStz8yVk^XGBTEIw(Izllvj2FJFo zYggM6Y}?kgqbRTWfL+i?JrB>?aCufG_l;RX7g%YKo7yh9uNox>8WtUUu<(1Q{^s{0 zAWz|(`}r6_JN-!B4$fY^%+1DGyAxBs=GU5xt(g_`Tt9RFEpl5jE<}|JEawM%?DjMH z=5sOBJ&oqIX-CZ5W5D!ZEHULXE;-+fXwE^ZRk5#litp(ftK{-fqmtW9jjD{!Oc-4a z7WsuXvtxg~PjKG-x4@DoeAKtLORk%C$#om-f`-!aq3d4AVi)~L3^N+%`pEk^7e1c% z2?)8sN`n~IcIWo$dm7R&vtF2Ev$wF9-Hzvd?^V0<6u`Tqp%TrOOYEZdgEU?m3`C(@ zpC&cAwp^-n_!Tqo1&!JrMYx71!om~XQ+z?Ayj^z6ML){hg+E`=C~qIrb;qT=opmE} zHY|Kse0Jm}9*pgy7ko-NSZkc6FEZws!uR?U^&c4%7F(_hiT8Rzw{k4(f=1<7To}4jodvGy_*`8mwkQF;uAm5L@)YrB<*R9^SV@pdr0Vc(gGivZy;`aAl z=o%!S3mVvVo+U^WyP%O8Wxl2M7uW@ji!(*pnbOTUgN8_%eBb-fa2}-}u+Sj=WzKmu zLSsU>M5eLJLj18))$0#=3Jf9MfpDN#(n-WkLTQf%lE#|b7>v1 zt-~(9C9&dT3E#2FQ;#{ZE-eN0o-E7v{#M$q&ZDRV zYYc&%5Iza(n2ISXjdL~Po!lwoF?`5s*|~?~PVO4QvNIn9iS)w(y!ip|QFt+|^TuAB zey|s3y|5Q&?Oxc6xxjNCiDd8Eb?mnvjcegT3%?(?TGlwbPx^s5r5`qW`oZqA`8cmt z&O9e~+TyCvG=75#`iZXvcqJYXI-XQEb*N#r_G+>0gtZ@7TzRAJ^UUPem^nl z?Z?}_p7kR&S750zI9T{Su9kC^CK-MY%bsSLiyd7gc6cW&dWwvO$QH1~SXlY zt$@XUB!VS6jtHBa-LS~E#Lk@qLtwCA_Wp3FWDjD-S-W$?U7nRuvN3tMp<(NX#xTk} zo4R0_(5voqwxH5D_o&^;2VCmi=ftq|gC5X+P>}L{=LVHUqjn3TeD}GekkUxbnf@m4 z#G(>Ge*Z17#ETBL_c=_oRh~_K2JLc2!IFnI*xu)`)W3qI9?xKVpTiQv3`^YCV0)j# zQb%~OZ7*?#CT0hg*pI>XK4;xXjSB6~?PJf^0k1~lrN}BdXU6-nWwXJy4+C~Cv05~e z7p>i!ts}zX8yjrrAiz@VZ?K(@2xF1hYpDKY?aqxk>zgAxDm$GV-odtv4vQUWu&u+w z&TV1$bh*oxEUKNtYP%o&$xBw&F1fjbZF>$ZdF6v`*%s!|3*F>{X@?o79m7SjEt@G% zojS9y#03qub!=E_9l(-fGT7D;VVr3D`=sckA73UP%(Dzrd6xGiSaO>^8(Yg@TmOJb zY|Hyn_echL^66j#O!l)JqL~l5k)grtoqovC$ygC{N+a<|z9o52u=sTc>plmS1`AgD zmU|1lFR|i-ZCwbTv_tm$C~Ki1jv`|<2HrdyTNN6y+rku1&a;VY)-JWoV6jI~?2{v= zUGh13tizu@89Rt}kv9h0@&+vO#$a2ofJNSbMcx=}%NwxB8-s1Vg7c{IhERyDS7=vx zLw-->4J!NAD?D3yV-oq6Y^Gi14afP`E3~V;F$rc{ZkhzH(x|*4zbEpB(EY7fpj&x^ zg?8%|g3>B)fFf^*B;I<3XWc5k);MhI71}A*nRdzd(=Kt5u=qX)+j<2obtMPedIc=C zFk!i`W3a7PNOMrAeD`B!xY*V!JR3jVVB3BGi`^S0P&G7?r>>odxU@@tlyc)g z-Gt_1Fm1;* zdp5ZlgGHv9RJ?tL!nW<2F)Z~XU|zY$nHZb#WBV@+4vRdS+RSLA?&@GWKLwUr?Xbl0 z3>KM2@JwVHSY#T~Msye6{q1|Qtdc(nJJ(s>=@oAC>ROw^jeA_!$TC)JWLy4I#dZ6l z(Ty*9u;?yMkG;mVi!XYx=q{6znK{RX+K>36RZ)sBda&p&B7dX1z@odza@~Gd?~5;b zu;?x%knID~F23l&qPtA)VdjI4Ec;^|FMEDDF)~(cWSMiNF+zilEHqlHZXzbS&&5lH z1{+yv$RgU`+8AXncu^63Jm3toxiRKmG7|87qF+j1^Tp{g{hxcR$|dJ|N$cI-i4epA#KRBlWL5 z%SaZw0yBzrpHt~VV*=Rrvx31wL;iVaa9?Juh`Xhc_@-AfP`l49gVK<-m+wn0AMeZE z5-^d{c{X)YwM!1$VA})F&J)<02|I<04`w;{uCZ z>}u`sKiYZ51s466WE=hm>$p%l_Zs3A3jc#e|CL)Gx!BFi;eW93KQ6xTKUnzRYl6;R zL(DJXf3V2Kw4?ApSoohvgYZ9=>+nBV_#d}q5n}+|vBInro(SKp#f6QFre?~rX4lMjn3BT|^SoojYCc^*b`n;@N{?*Ml z<{rw;o0#Fk|6t*NPLIeruAHo4a#_`XR`$&!*-Xl_YycaC`l4n0x#w z!|?Z6;o*HQQ0Q>LJyvfiIl)wN2uAoW7JrImAAbrg@f&Wpk3U7U&yLgb&8h1Q%e_m~ zG9umnzTV}h9gjfTu^I(S4ROyVUv04XQ(iLzmqzN0dDewWp_^J^+I zA7abW55t#! z2-izL*wRWP_el8W?NPOF}iGldAZ z`Ln*|O$AzDc_*`Ch;iq%`d3oK1pU$1s(NkFY%j+)ubj-lz zbr*iR37=eRh+tMf9jv_W!cV8Fb9vo`pH3B)^12H@ohp#!b+%yUO|*dtFU!w7t(KZETO#+{?YkYVPGOjr!^Aj@To(5)$`?6(=5P?r~rG z0^aEWx#zJgK|O0>Icr(mvi^h!=d6Wg{ZVzZ{$M$4MFnO3iNwkJgJt~*_sLlc>-uxj zWZuXsnKxB4GjGhSnYRnS-`pWn8a->(TI>3|@cW5e?fSd$`(51C&Gl5jAFS(-8lN?O z;rDY>K+YM}N+VOla?bGJ#vTUCIpezC&Km}pF(n_Y^=ysTCv3)Jd*Et|?Ex0sgAnz| zG)i>G_5e#PCr-TgAVUiQb?-rWhTDcBv@EsKCQWYm>sH>9WUzjxO#dq=8<{*%e zvKL^;+ijnn~HQ zx5Kg*WO`&TI6kr$V6mUFn8)7E(vrOZ%U%%4l)V7UnI}v-d%-TxnFq^WaO7n#OuGH% zmQDrZ%*6qA#5^&EvQgO~aSk64vq;uv?iGcLO(%5`M2usd9X2%%a3V);@(iTgjXPzD1eNNyAzpBitzdiFrEp?w`(3x|0 z*@uQgv*`zhntotT8LQ?<2%+kkN9^oASMs7Xdgjd?x$Q^KJdtnR=h8zr4erbG&eq1T z*;@NVx#rlUr_{#Q{dgs#`>|%n_5h3SCxtRLMp$$|X3^Lltg7gKu-G1m=&?P_5VRix z;`Sb#A|J(Kdyw`S-EZnymWCw7^}eZRxoJ#2%OzWgE|Im8XLDD8cDYvpmV2*ZynK0I zYF%m9oF7>HDQZ{7#>lG{e+n!%#wo+H$4W?GY>cq@Q=D$GF~YKTWzWRMsOn5?jIh{v zgbT#RLw$>l2NoL-&unZwu-JIyTWxugG%ofL2T10PGa>WFSYH|!`^Ye-9}KOb@#V!n;(8Aa zVYKOoAt;TDeZ)wXeyHPB8W;PBA*nPj_7THHXSKkAcXTFQ9|>v@S8 zXRK_G(7+@zR&VQ*vkIcyt31|yPPH$M=FTyP#U}^rJ{P;ye$*%D`m*kGbqBMq#BOEI zTX&G=T%R1Q`&`|@(x^{Pc0l(zHnhhI8}IzKR=Z0=l20-rciF2d6GZ=2`6P0&A&6W& z!?Mp5CdTN$u;{-NYQJ@ecj_N(*&7!9mxLbumlrYmFD&}6X^YKwrZWAIFuu;gxr#3O z@1zH$A8cCb$0SuRnc>|eC)nN&i)AzV?<~L4sGUptLhM|V(vW^!*ty(P8~qoy zWrm4RivH{BmFT~)=)bdN(vJ%}7fV6(-$}!0KWgVv!7uu+Y>4Q;u;{;TGKl^Qi~cLh zE&4B$dF))U*tygoj{eKC6#W+#JD1Zp`Y){e{KC$K4RxPi*twYbyU#D|T$ApS`M9ui zsY~2_eqrY_Yu)D;b}p>5`~1Sr#Wm4=eqraD6rJ{?b}kizyU#D|T<HFMnBhouj)n5?3(M0__`N zpfqrk%}<^CrSZP!8-H2);ou4l{<6@(ctZmdTVpS^O7h75J{zetBsHX+h>&7E-}uW) zgEc76Dp(cFiBzoXp1&+K_{&0rzbrHyQK9i(V)UlVUsf8a*E|_N@#9RWRcT1#4UOE7 z?R~A+0_*waSS<}wO=#pk5j1ia>|n9)PI%a+A<8`G8!UbtH=XBvdoPx0&j&2~+$orS z4$D5L5oe#9^6c{oX=^_y3~Q`ZR?j|%WuLz%C$=A|&+hk;6GKDIfxWIKEoQG>%QX8O zw)eSAvf3Ec*^b_$RQA?6@#5;2OthN@LoN&c?i(*@`XNCj{otC&SYg>2D`n$DL#l6R zFw=yF1cA_SM_OnI0V)kb&F&jpP-&!Aw&?cM${sAdql>as^ChIOCI<7+=6Kfh9|z55)A^n-$)u_B&^2E{S`poC>UC^V(f z+Lc^rl^K*dDUH^yoRXfU(b|=666!v8#Y1Vdb|s`Tg9A8YCAD1!T8l<5_!JJH@!tPBGSEd%tvC_57IZ-+NU}h~1S=ynS`#F7|;sj~;W%rvP_0kaO zk!Kal4#u)vY@e&Xg@nJ`O|WUPeXhzTNezR+wk{4!4TH%<={_errXQA2`avbhd@yIX zAE{x0ZfY37Qo{h28U}-Pp9>7iSdksm56eFNphl%1Oz`Q4poG#$4Fkzm6x%&-%JY{- zY8ZGnH4I=BfxIs@475uP0~ld1&!&cfcBx@7SkKjQtnK%Wld4$v`8ZF~jw7O2_c^0^ zX)reD+1y!7I2G)db^_;uz3o014_6xRy3eu1(r6qC4@>vC7`f0OJ7%oNj-eq&F8yGD z$ykYzD-D^hdknDg()gaixQ041|$o3}BIIXj>Tr=DLi*lnu=oC{($}S@vLf9W1<# z|xW)BSk&>1U1 z!l9w~Q)mcLFAWSZbOp!;d((YR94`$ECeO;238o{(y3YlTl?Lx;o|PE5G5+q*;J(aQ zQ6WNuNjfwH<7^r{kUO55!jyai#e%B;@(yObDE$;48f?cupYoV1hHt7i?mUOVcHAZ` z_qD-tU)x|iZWAV>ZjCc+$8BmS7$WUji)KoCwjUhcd6uPcV@!gfF_-_Ooj|f+g0g}U zJ&WzSQ4`&?<2DD|ahtH**9N0_heqye(=PY5!E#^QU^~wNmiyWU+i{zcylU&4(y1A% zx&2~)vviX5gXuN%F~#5WZ0>9GExE4^*1Xv%pj{fdug$Z$uWhg$pAE}>ZLr+eHrS5O z79gB_CRp;B2HWx3u;eoh)_tzbUFJi9(aeW*gUkmLcgBjimiZ7KQ5wl-@_jA<-g7A= zx-^o{%^;z5Sxye~EPw7WRpn7#Y#+lzh(rVEV={w#&E?RX~lv)q!! zF8GU(w(O4ySYGcVDM!vxVmf*SwwCwNoOdqDl#||h1cQZ_FtF`>9PLue5te&yMRF!r zVX)G0?r$E(P?K|?`Jnw6L&F{`>C?q}Zc(T&Xb42f`;v#IALY9wxQl+sY|Hy{uY&g_ ze`~PzqqWti{k~wQgg~TSC)cZ z&=8~<8i~Ub$zHqdS*ZKjne<==Fj(&SL8JbFsgJ(T->HS(_oa5P*VRuvqD9^}#Z&k9 z38UEhkx;+zHJ_JrdctJ393f19$9wBq>hum4IgI$yH6#x$-z-G4bW^7njnwIdrB1J5 zu6`-CVCO<w?$R*qR+^&pVM~#ZjQtsEzEfo<{f8)5- z_Bkj!D)v)3Sdkqk?K9sjk7~=OETyqyPA*jF@;PLzhdyTVZ$3A|Me>7Tc z^kiPi@RxT&!8Sh-o*0`iFGTo(2)WqrZPoY!xu>IJPYO)NfSEPlq6kjLk3N|BAU0+E z@W1Rgu@HG5T`lWR@r2Etb;wrBniSFzpOUn(?0rXf_OEEO$n7j? zIV~C(3Zc=gXH-#})?PrDNWek+!Up&II;Ty1v`H-8o_Nq}y+%PP4U0}IG0hWAXSbUXp zMb(xG$MmrEEm(P?@cTWc>=BLUhb1O~1tqaAqDpJGxR7atRYljpA!2`#bsYI+!m8FB z(X1LTz-!-U-I=r2frG3u{xbU_msqBIe#eBDGgS46_`79V=Ill`XRXnTZG^=#X8^a$ zu3cn)9X@-Fzs>lW^7ytHpb{rIk#Ae>oEwaG42x-ttx7;v>L{6w*eF;}Q`1CXZO%*A zetos&)8Q`p7JmD^hHUck#JQV%^OA9&uQT3qPJJoMKJi?ZWNH|okoXb_-?3SeFcS}A z0U3lfmvcvCFyWKI`2B)W-F6ivDYBM str: - s = '' + s = "" last_line = 1 for t in tokens: if t.line != last_line: last_line = t.line - s += '\n' + ' ' * t.column + s += "\n" + " " * t.column else: - s += ' ' + s += " " s += t.token_type.name return s @@ -50,12 +56,12 @@ def tokenize(program: str, verbose: bool = False): log_error(e) if verbose: - log_success('Tokens:') - log_success('-' * 80) - log_success(format_tokens(tokens) + '\n') - log_success('-' * 80) + log_success("Tokens:") + log_success("-" * 80) + log_success(format_tokens(tokens) + "\n") + log_success("-" * 80) print() - + return tokens, lexer @@ -80,16 +86,17 @@ def check_semantics(ast, scope: Scope, context: Context, errors: List[str]): TypeChecker(context, errors).visit(ast, scope) return ast, scope, context, errors + @app.command() def compile( - input_file: typer.FileText = typer.Argument(..., help='Cool file'), - output_file: typer.FileTextWrite = typer.Argument('a.mips', help='Mips file'), - verbose: bool = typer.Option(False, help='Run in verbose mode.') + input_file: typer.FileText = typer.Argument(..., help="Cool file"), + output_file: typer.FileTextWrite = typer.Argument("a.mips", help="Mips file"), + verbose: bool = typer.Option(False, help="Run in verbose mode."), ): # In case of encoding conflict - if input_file.encoding.lower != 'utf-8': - input_file = open(input_file.name, encoding='utf-8') - + if input_file.encoding.lower != "utf-8": + input_file = open(input_file.name, encoding="utf-8") + program = input_file.read() tokens, lexer = tokenize(program, verbose) @@ -97,9 +104,9 @@ def compile( exit(1) if not tokens[:-1]: # there is always at least the EOF token - log_error('(0, 0) - SyntacticError: ERROR at or near EOF') + log_error("(0, 0) - SyntacticError: ERROR at or near EOF") exit(1) - + ast, parser = parse(tokens, verbose) # parsing process failed @@ -113,36 +120,37 @@ def compile( for e in errors: log_error(e) exit(1) - + exit(0) + @app.command() def serialize(): serialize_parser_and_lexer() cwd = os.getcwd() - lexertab = os.path.join(cwd, 'lexertab.py') - parsertab = os.path.join(cwd, 'parsertab.py') + lexertab = os.path.join(cwd, "lexertab.py") + parsertab = os.path.join(cwd, "parsertab.py") - cool_lexertab = Path(os.path.join(cwd, 'cool', 'lexertab.py')) - cool_parsertab = Path(os.path.join(cwd, 'cool', 'parsertab.py')) + cool_lexertab = Path(os.path.join(cwd, "cool", "lexertab.py")) + cool_parsertab = Path(os.path.join(cwd, "cool", "parsertab.py")) - mode = 'w' if cool_lexertab.exists() else 'x' - fr = open(lexertab, 'r') + mode = "w" if cool_lexertab.exists() else "x" + fr = open(lexertab, "r") with cool_lexertab.open(mode) as fw: - fw.write(fr.read().replace('from grammar', 'from cool.grammar')) + fw.write(fr.read().replace("from grammar", "from cool.grammar")) fr.close() - mode = 'w' if cool_parsertab.exists() else 'x' - fr = open(parsertab, 'r') + mode = "w" if cool_parsertab.exists() else "x" + fr = open(parsertab, "r") with cool_parsertab.open(mode) as fw: - fw.write(fr.read().replace('from grammar', 'from cool.grammar')) + fw.write(fr.read().replace("from grammar", "from cool.grammar")) fr.close() os.remove(lexertab) os.remove(parsertab) -if __name__ == '__main__': +if __name__ == "__main__": app() diff --git a/src/cool/code_generation/base.py b/src/cool/code_generation/base.py index 943acb94e..1ead52823 100644 --- a/src/cool/code_generation/base.py +++ b/src/cool/code_generation/base.py @@ -1,55 +1,65 @@ +from typing import Any, List, Optional + import cool.code_generation.cil as cil +from cool.semantics.utils.scope import Context, Method, Type + class BaseCOOLToCILVisitor: - def __init__(self, context): - self.dottypes = [] - self.dotdata = [] - self.dotcode = [] - self.current_type = None - self.current_method = None - self.current_function = None - self.context = context - + def __init__(self, context: Context): + self.dottypes: List[cil.TypeNode] = [] + self.dotdata: List[cil.DataNode] = [] + self.dotcode: List[cil.FunctionNode] = [] + + self.current_type: Optional[Type] = None + self.current_method: Optional[Method] = None + self.current_function: Optional[cil.FunctionNode] = None + + self.context: Context = context + @property - def params(self): + def params(self) -> List[cil.ParamNode]: return self.current_function.params - + @property - def localvars(self): - return self.current_function.localvars - + def localvars(self) -> List[cil.LocalNode]: + return self.current_function.local_vars + @property - def instructions(self): + def instructions(self) -> List[cil.InstructionNode]: return self.current_function.instructions - - def register_local(self, var_name): - name = f'local_{self.current_function.name[9:]}_{var_name}_{len(self.localvars)}' - local_node = cil.LocalNode(name) + + def register_local(self, var_name: str) -> str: + local_name = ( + f"local_{self.current_function.name[9:]}_{var_name}_{len(self.localvars)}" + ) + local_node = cil.LocalNode(local_name) self.localvars.append(local_node) - return name + return local_name - def define_internal_local(self): - return self.register_local('internal') + def define_internal_local(self) -> str: + return self.register_local("internal") - def register_instruction(self, instruction): + def register_instruction( + self, instruction: cil.InstructionNode + ) -> cil.InstructionNode: self.instructions.append(instruction) return instruction - - def to_function_name(self, method_name, type_name): - return f'function_{method_name}_at_{type_name}' - - def register_function(self, function_name): + + def to_function_name(self, method_name: str, type_name: str) -> str: + return f"function_{method_name}_at_{type_name}" + + def register_function(self, function_name: str) -> cil.FunctionNode: function_node = cil.FunctionNode(function_name, [], [], []) self.dotcode.append(function_node) return function_node - - def register_type(self, name): + + def register_type(self, name: str) -> cil.TypeNode: type_node = cil.TypeNode(name) self.dottypes.append(type_node) return type_node - def register_data(self, value): - vname = f'data_{len(self.dotdata)}' - data_node = cil.DataNode(vname, value) + def register_data(self, value: Any) -> cil.DataNode: + data_name = f"data_{len(self.dotdata)}" + data_node = cil.DataNode(data_name, value) self.dotdata.append(data_node) return data_node diff --git a/src/cool/code_generation/cil.py b/src/cool/code_generation/cil.py index aa1c212d6..8237ba5eb 100644 --- a/src/cool/code_generation/cil.py +++ b/src/cool/code_generation/cil.py @@ -1,230 +1,278 @@ +from typing import Any, List, Tuple import cool.visitor as visitor class Node: pass + class ProgramNode(Node): - def __init__(self, dottypes, dotdata, dotcode): - self.dottypes = dottypes - self.dotdata = dotdata - self.dotcode = dotcode + def __init__( + self, + dottypes: List["TypeNode"], + dotdata: List["DataNode"], + dotcode: List["FunctionNode"], + ): + self.dottypes: List[TypeNode] = dottypes + self.dotdata: List[DataNode] = dotdata + self.dotcode: List[FunctionNode] = dotcode + class TypeNode(Node): - def __init__(self, name): - self.name = name - self.attributes = [] - self.methods = [] + def __init__(self, name: str): + self.name: str = name + self.attributes: List[str] = [] + self.methods: List[Tuple[str, str]] = [] + class DataNode(Node): - def __init__(self, vname, value): - self.name = vname - self.value = value + def __init__(self, name: str, value: Any): + self.name: str = name + self.value: Any = value + class FunctionNode(Node): - def __init__(self, fname, params, localvars, instructions): - self.name = fname - self.params = params - self.localvars = localvars - self.instructions = instructions + def __init__( + self, + name: str, + params: List["ParamNode"], + local_vars: List["LoadNode"], + instructions: List["InstructionNode"], + ): + self.name: str = name + self.params: List[ParamNode] = params + self.local_vars: List[LocalNode] = local_vars + self.instructions: List[InstructionNode] = instructions + class ParamNode(Node): - def __init__(self, name): - self.name = name + def __init__(self, name: str): + self.name: str = name + class LocalNode(Node): - def __init__(self, name): - self.name = name + def __init__(self, name: str): + self.name: str = name + class InstructionNode(Node): pass + class AssignNode(InstructionNode): def __init__(self, dest, source): self.dest = dest self.source = source + class ArithmeticNode(InstructionNode): def __init__(self, dest, left, right): self.dest = dest self.left = left self.right = right + class PlusNode(ArithmeticNode): pass + class MinusNode(ArithmeticNode): pass + class StarNode(ArithmeticNode): pass + class DivNode(ArithmeticNode): pass + class GetAttribNode(InstructionNode): pass + class SetAttribNode(InstructionNode): pass + class GetIndexNode(InstructionNode): pass + class SetIndexNode(InstructionNode): pass + class AllocateNode(InstructionNode): def __init__(self, itype, dest): self.type = itype self.dest = dest + class ArrayNode(InstructionNode): pass + class TypeOfNode(InstructionNode): def __init__(self, obj, dest): self.obj = obj self.dest = dest + class LabelNode(InstructionNode): pass + class GotoNode(InstructionNode): pass + class GotoIfNode(InstructionNode): pass + class StaticCallNode(InstructionNode): def __init__(self, function, dest): self.function = function self.dest = dest + class DynamicCallNode(InstructionNode): def __init__(self, xtype, method, dest): self.type = xtype self.method = method self.dest = dest + class ArgNode(InstructionNode): - def __init__(self, name): - self.name = name + def __init__(self, name: str): + self.name: str = name + class ReturnNode(InstructionNode): def __init__(self, value=None): self.value = value + class LoadNode(InstructionNode): def __init__(self, dest, msg): self.dest = dest self.msg = msg + class LengthNode(InstructionNode): pass + class ConcatNode(InstructionNode): pass + class PrefixNode(InstructionNode): pass + class SubstringNode(InstructionNode): pass + class ToStrNode(InstructionNode): def __init__(self, dest, ivalue): self.dest = dest self.ivalue = ivalue + class ReadNode(InstructionNode): def __init__(self, dest): self.dest = dest + class PrintNode(InstructionNode): def __init__(self, str_addr): self.str_addr = str_addr + def get_formatter(): class PrintVisitor(object): - @visitor.on('node') + @visitor.on("node") def visit(self, node): pass @visitor.when(ProgramNode) def visit(self, node): - 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) + 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}' + return f".TYPES\n{dottypes}\n\n.DATA\n{dotdata}\n\n.CODE\n{dotcode}" @visitor.when(TypeNode) def visit(self, node): - attributes = '\n\t'.join(f'attribute {x}' for x in node.attributes) - methods = '\n\t'.join(f'method {x}: {y}' for x, y in node.methods) + attributes = "\n\t".join(f"attribute {x}" for x 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}}' + return f"type {node.name} {{\n\t{attributes}\n\n\t{methods}\n}}" @visitor.when(FunctionNode) def visit(self, node): - 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) + params = "\n\t".join(self.visit(x) for x in node.params) + local_vars = "\n\t".join(self.visit(x) for x in node.local_vars) + 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}}' + return f"function {node.name} {{\n\t{params}\n\n\t{local_vars}\n\n\t{instructions}\n}}" @visitor.when(ParamNode) def visit(self, node): - return f'PARAM {node.name}' + return f"PARAM {node.name}" @visitor.when(LocalNode) def visit(self, node): - return f'LOCAL {node.name}' + return f"LOCAL {node.name}" @visitor.when(AssignNode) def visit(self, node): - return f'{node.dest} = {node.source}' + return f"{node.dest} = {node.source}" @visitor.when(PlusNode) def visit(self, node): - return f'{node.dest} = {node.left} + {node.right}' + return f"{node.dest} = {node.left} + {node.right}" @visitor.when(MinusNode) def visit(self, node): - return f'{node.dest} = {node.left} - {node.right}' + return f"{node.dest} = {node.left} - {node.right}" @visitor.when(StarNode) def visit(self, node): - return f'{node.dest} = {node.left} * {node.right}' + return f"{node.dest} = {node.left} * {node.right}" @visitor.when(DivNode) def visit(self, node): - return f'{node.dest} = {node.left} / {node.right}' + return f"{node.dest} = {node.left} / {node.right}" @visitor.when(AllocateNode) def visit(self, node): - return f'{node.dest} = ALLOCATE {node.type}' + return f"{node.dest} = ALLOCATE {node.type}" @visitor.when(TypeOfNode) def visit(self, node): - return f'{node.dest} = TYPEOF {node.type}' + return f"{node.dest} = TYPEOF {node.type}" @visitor.when(StaticCallNode) def visit(self, node): - return f'{node.dest} = CALL {node.function}' + return f"{node.dest} = CALL {node.function}" @visitor.when(DynamicCallNode) def visit(self, node): - return f'{node.dest} = VCALL {node.type} {node.method}' + return f"{node.dest} = VCALL {node.type} {node.method}" @visitor.when(ArgNode) def visit(self, node): - return f'ARG {node.name}' + return f"ARG {node.name}" @visitor.when(ReturnNode) def visit(self, node): return f'RETURN {node.value if node.value is not None else ""}' printer = PrintVisitor() - return (lambda ast: printer.visit(ast)) \ No newline at end of file + return lambda ast: printer.visit(ast) diff --git a/src/cool/code_generation/cool_to_cil_visitor.py b/src/cool/code_generation/cool_to_cil_visitor.py new file mode 100644 index 000000000..eb870a8bd --- /dev/null +++ b/src/cool/code_generation/cool_to_cil_visitor.py @@ -0,0 +1,116 @@ +from typing import Dict, List, Optional + +import cool.code_generation.cil as cil +import cool.semantics.utils.astnodes as ast +import cool.visitor.visitor as visitor +from cool.code_generation.base import BaseCOOLToCILVisitor +from cool.semantics.utils.scope import Attribute, Context, Method, Scope, Type + + +class ConstructorCreator: + def __init__(self, context: Context): + self.current_type: Optional[Type] = None + self.current_method: Optional[Method] = None + self.context: Context = context + self.class_declarations = {} # type: Dict[str, ast.ClassDeclarationNode] + + @visitor.on("node") + def visit(self, node, scope): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode, scope: Scope): + declarations: List[ast.ClassDeclarationNode] = [] + + for declaration in node.declarations: + self.class_declarations[declaration.id] = declaration + + for declaration in node.declarations: + declarations.append(self.visit(declaration, scope)) + + return ast.ProgramNode(declarations) + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode, scope: Scope): + self.current_type = self.context.get_type(node.id) + + ancestors = [ + self.class_declarations[owner.name] + for _, owner in self.current_type.all_attributes() + ] + + attrs = [] + visited = set() + for ancestor in ancestors: + if ancestor.id in visited: + continue + + visited.add(ancestor.id) + attrs += [ + feature + for feature in ancestor.features + if isinstance(feature, ast.Attribute) + ] + + expressions: List[ast.ExprNode] = [] + for attr in attrs: + expr = self.visit(attr, scope) + + if expr: + expressions.append(expr) + + body = ast.BlockNode(expr) + constructor = ast.MethodDeclarationNode( + "__init__", [], self.current_type.name, body + ) + return ast.ClassDeclarationNode( + node.id, [constructor] + node.features, node.parent + ) + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode, scope: Scope): + if node.expr is None: + return None + + return ast.AssignNode(node.id, node.expr) + + +class CoolToCILVisitor(BaseCOOLToCILVisitor): + @visitor.on("node") + def visit(self, node, scope): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode, scope: Scope): + for declaration in node.declarations: + self.visit(declaration, scope) + + return cil.ProgramNode(self.dottypes, self.dotdata, self.dotcode) + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode, scope: Scope): + self.current_type = self.context.get_type(node.id) + + type_node = self.register_type(self.current_type.name) + + methods = [ + feature + for feature in node.features + if isinstance(feature, ast.MethodDeclarationNode) + ] + + for attr, _ in self.current_type.all_attributes(): + self.visit(attr, scope) + type_node.attributes.append(attr.name) + + for method, child_scope in zip(methods, scope.children): + self.visit(method, child_scope) + type_node.methods.append( + (method.id, self.to_function_name(method.id, node.id)) + ) + + self.dottypes.append(type_node) + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode, scope: Scope): + pass diff --git a/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/ast-checkpoint.py b/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/ast-checkpoint.py new file mode 100644 index 000000000..14f4c1c4d --- /dev/null +++ b/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/ast-checkpoint.py @@ -0,0 +1,29 @@ +import cmp.visitor as visitor + + +def get_printer(ConstantNumberNode, BinaryNode): + class PrintVisitor(object): + @visitor.on("node") + def visit(self, node, tabs): + pass + + @visitor.when(BinaryNode) + def visit(self, node, tabs=0): + ans = ( + "\t" * tabs + + "\\__" + + " " + + node.__class__.__name__ + + " \n" + + self.visit(node.left, tabs + 1) + + "\n" + + self.visit(node.right, tabs + 1) + ) + return ans + + @visitor.when(ConstantNumberNode) + def visit(self, node, tabs=0): + return "\t" * tabs + "\\__" + "num: " + node.lex + + printer = PrintVisitor() + return lambda ast: printer.visit(ast) diff --git a/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/automata-checkpoint.py b/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/automata-checkpoint.py new file mode 100644 index 000000000..c343d5ca3 --- /dev/null +++ b/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/automata-checkpoint.py @@ -0,0 +1,167 @@ +try: + import pydot +except: + pass + + +class State: + def __init__(self, state, final=False): + self.state = state + self.final = final + self.transitions = {} + self.epsilon_transitions = set() + self.tag = None + + def has_transition(self, symbol): + return symbol in self.transitions + + def add_transition(self, symbol, state): + try: + self.transitions[symbol].append(state) + except: + self.transitions[symbol] = [state] + return self + + def add_epsilon_transition(self, state): + self.epsilon_transitions.add(state) + return self + + def recognize(self, string): + states = self.epsilon_closure + for symbol in string: + states = self.move_by_state(symbol, *states) + states = self.epsilon_closure_by_state(*states) + return any(s.final for s in states) + + def to_deterministic(self): + closure = self.epsilon_closure + start = State(tuple(closure), any(s.final for s in closure)) + + closures = [closure] + states = [start] + pending = [start] + + while pending: + state = pending.pop() + symbols = {symbol for s in state.state for symbol in s.transitions} + + for symbol in symbols: + move = self.move_by_state(symbol, *state.state) + closure = self.epsilon_closure_by_state(*move) + + if closure not in closures: + new_state = State(tuple(closure), any(s.final for s in closure)) + closures.append(closure) + states.append(new_state) + pending.append(new_state) + else: + index = closures.index(closure) + new_state = states[index] + + state.add_transition(symbol, new_state) + + return start + + @staticmethod + def from_nfa(nfa, get_states=False): + states = [] + for n in range(nfa.states): + state = State(n, n in nfa.finals) + states.append(state) + + for (origin, symbol), destinations in nfa.map.items(): + origin = states[origin] + origin[symbol] = [states[d] for d in destinations] + + if get_states: + return states[nfa.start], states + return states[nfa.start] + + @staticmethod + def move_by_state(symbol, *states): + return { + s for state in states if state.has_transition(symbol) for s in state[symbol] + } + + @staticmethod + def epsilon_closure_by_state(*states): + closure = {state for state in states} + + l = 0 + while l != len(closure): + l = len(closure) + tmp = [s for s in closure] + for s in tmp: + for epsilon_state in s.epsilon_transitions: + closure.add(epsilon_state) + return closure + + @property + def epsilon_closure(self): + return self.epsilon_closure_by_state(self) + + @property + def name(self): + return str(self.state) + + def __getitem__(self, symbol): + if symbol == "": + return self.epsilon_transitions + try: + return self.transitions[symbol] + except KeyError: + return None + + def __setitem__(self, symbol, value): + if symbol == "": + self.epsilon_transitions = value + else: + self.transitions[symbol] = value + + def __repr__(self): + return str(self) + + def __str__(self): + return str(self.state) + + def __hash__(self): + return hash(self.state) + + def graph(self): + G = pydot.Dot(rankdir="LR", margin=0.1) + G.add_node(pydot.Node("start", shape="plaintext", label="", width=0, height=0)) + + visited = set() + + def visit(start): + ids = id(start) + if ids not in visited: + visited.add(ids) + G.add_node( + pydot.Node( + ids, + label=start.name, + shape="circle", + style="bold" if start.final else "", + ) + ) + for tran, destinations in start.transitions.items(): + for end in destinations: + visit(end) + G.add_edge( + pydot.Edge(ids, id(end), label=tran, labeldistance=2) + ) + for end in start.epsilon_transitions: + visit(end) + G.add_edge(pydot.Edge(ids, id(end), label="ε", labeldistance=2)) + + visit(self) + G.add_edge(pydot.Edge("start", id(self), label="", style="dashed")) + + return G + + def _repr_svg_(self): + try: + return self.graph().create_svg().decode("utf8") + except: + pass diff --git a/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/languages-checkpoint.py b/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/languages-checkpoint.py new file mode 100644 index 000000000..779e72916 --- /dev/null +++ b/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/languages-checkpoint.py @@ -0,0 +1,364 @@ +from cmp.pycompiler import Sentence, Production +from cmp.utils import ContainerSet, Token, UnknownToken +from cmp.tools import build_parsing_table, metodo_predictivo_no_recursivo + + +class BasicXCool: + def __init__(self, G): + self.G = G + self.fixed_tokens = {lex: Token(lex, G[lex]) for lex in "+ - * / ( )".split()} + + @property + def firsts(self): + G = self.G + return { + G["+"]: ContainerSet(G["+"], contains_epsilon=False), + G["-"]: ContainerSet(G["-"], contains_epsilon=False), + G["*"]: ContainerSet(G["*"], contains_epsilon=False), + G["/"]: ContainerSet(G["/"], contains_epsilon=False), + G["("]: ContainerSet(G["("], contains_epsilon=False), + G[")"]: ContainerSet(G[")"], contains_epsilon=False), + G["num"]: ContainerSet(G["num"], contains_epsilon=False), + G["E"]: ContainerSet(G["num"], G["("], contains_epsilon=False), + G["T"]: ContainerSet(G["num"], G["("], contains_epsilon=False), + G["F"]: ContainerSet(G["num"], G["("], contains_epsilon=False), + G["X"]: ContainerSet(G["-"], G["+"], contains_epsilon=True), + G["Y"]: ContainerSet(G["/"], G["*"], contains_epsilon=True), + Sentence(G["T"], G["X"]): ContainerSet( + G["num"], G["("], contains_epsilon=False + ), + Sentence(G["+"], G["T"], G["X"]): ContainerSet( + G["+"], contains_epsilon=False + ), + Sentence(G["-"], G["T"], G["X"]): ContainerSet( + G["-"], contains_epsilon=False + ), + G.Epsilon: ContainerSet(contains_epsilon=True), + Sentence(G["F"], G["Y"]): ContainerSet( + G["num"], G["("], contains_epsilon=False + ), + Sentence(G["*"], G["F"], G["Y"]): ContainerSet( + G["*"], contains_epsilon=False + ), + Sentence(G["/"], G["F"], G["Y"]): ContainerSet( + G["/"], contains_epsilon=False + ), + Sentence(G["num"]): ContainerSet(G["num"], contains_epsilon=False), + Sentence(G["("], G["E"], G[")"]): ContainerSet( + G["("], contains_epsilon=False + ), + } + + @property + def follows(self): + G = self.G + return { + G["E"]: ContainerSet(G[")"], G.EOF, contains_epsilon=False), + G["T"]: ContainerSet(G[")"], G["-"], G.EOF, G["+"], contains_epsilon=False), + G["F"]: ContainerSet( + G["-"], G.EOF, G["*"], G["/"], G[")"], G["+"], contains_epsilon=False + ), + G["X"]: ContainerSet(G[")"], G.EOF, contains_epsilon=False), + G["Y"]: ContainerSet(G[")"], G["-"], G.EOF, G["+"], contains_epsilon=False), + } + + @property + def table(self): + G = self.G + return { + (G["E"], G["num"],): [ + Production(G["E"], Sentence(G["T"], G["X"])), + ], + (G["E"], G["("],): [ + Production(G["E"], Sentence(G["T"], G["X"])), + ], + (G["X"], G["+"],): [ + Production(G["X"], Sentence(G["+"], G["T"], G["X"])), + ], + (G["X"], G["-"],): [ + Production(G["X"], Sentence(G["-"], G["T"], G["X"])), + ], + (G["X"], G[")"],): [ + Production(G["X"], G.Epsilon), + ], + (G["X"], G.EOF,): [ + Production(G["X"], G.Epsilon), + ], + (G["T"], G["num"],): [ + Production(G["T"], Sentence(G["F"], G["Y"])), + ], + (G["T"], G["("],): [ + Production(G["T"], Sentence(G["F"], G["Y"])), + ], + (G["Y"], G["*"],): [ + Production(G["Y"], Sentence(G["*"], G["F"], G["Y"])), + ], + (G["Y"], G["/"],): [ + Production(G["Y"], Sentence(G["/"], G["F"], G["Y"])), + ], + (G["Y"], G[")"],): [ + Production(G["Y"], G.Epsilon), + ], + (G["Y"], G["-"],): [ + Production(G["Y"], G.Epsilon), + ], + (G["Y"], G.EOF,): [ + Production(G["Y"], G.Epsilon), + ], + (G["Y"], G["+"],): [ + Production(G["Y"], G.Epsilon), + ], + (G["F"], G["num"],): [ + Production(G["F"], Sentence(G["num"])), + ], + (G["F"], G["("],): [ + Production(G["F"], Sentence(G["("], G["E"], G[")"])), + ], + } + + @property + def tokenizer(self): + G = self.G + fixed_tokens = self.fixed_tokens + + def tokenize_text(text): + tokens = [] + for item in text.split(): + try: + float(item) + token = Token(item, G["num"]) + except ValueError: + try: + token = fixed_tokens[item] + except: + token = UnknownToken(item) + tokens.append(token) + eof = Token("$", G.EOF) + tokens.append(eof) + return tokens + + return tokenize_text + + +class PowXCool: + def __init__(self, G): + self.G = G + + @property + def firsts(self): + G = self.G + return { + G["+"]: ContainerSet(G["+"], contains_epsilon=False), + G["-"]: ContainerSet(G["-"], contains_epsilon=False), + G["*"]: ContainerSet(G["*"], contains_epsilon=False), + G["/"]: ContainerSet(G["/"], contains_epsilon=False), + G["^"]: ContainerSet(G["^"], contains_epsilon=False), + G["("]: ContainerSet(G["("], contains_epsilon=False), + G[")"]: ContainerSet(G[")"], contains_epsilon=False), + G["num"]: ContainerSet(G["num"], contains_epsilon=False), + G["E"]: ContainerSet(G["num"], G["("], contains_epsilon=False), + G["T"]: ContainerSet(G["num"], G["("], contains_epsilon=False), + G["F"]: ContainerSet(G["num"], G["("], contains_epsilon=False), + G["A"]: ContainerSet(G["num"], G["("], contains_epsilon=False), + G["X"]: ContainerSet(G["-"], G["+"], contains_epsilon=True), + G["Y"]: ContainerSet(G["/"], G["*"], contains_epsilon=True), + G["Z"]: ContainerSet(G["^"], contains_epsilon=True), + Sentence(G["T"], G["X"]): ContainerSet( + G["num"], G["("], contains_epsilon=False + ), + Sentence(G["+"], G["T"], G["X"]): ContainerSet( + G["+"], contains_epsilon=False + ), + Sentence(G["-"], G["T"], G["X"]): ContainerSet( + G["-"], contains_epsilon=False + ), + G.Epsilon: ContainerSet(contains_epsilon=True), + Sentence(G["F"], G["Y"]): ContainerSet( + G["num"], G["("], contains_epsilon=False + ), + Sentence(G["*"], G["F"], G["Y"]): ContainerSet( + G["*"], contains_epsilon=False + ), + Sentence(G["/"], G["F"], G["Y"]): ContainerSet( + G["/"], contains_epsilon=False + ), + Sentence(G["A"], G["Z"]): ContainerSet( + G["num"], G["("], contains_epsilon=False + ), + Sentence(G["^"], G["F"]): ContainerSet(G["^"], contains_epsilon=False), + Sentence(G["num"]): ContainerSet(G["num"], contains_epsilon=False), + Sentence(G["("], G["E"], G[")"]): ContainerSet( + G["("], contains_epsilon=False + ), + } + + @property + def follows(self): + G = self.G + return { + G["E"]: ContainerSet(G[")"], G.EOF, contains_epsilon=False), + G["T"]: ContainerSet(G["-"], G[")"], G.EOF, G["+"], contains_epsilon=False), + G["F"]: ContainerSet( + G["-"], G["*"], G["/"], G[")"], G.EOF, G["+"], contains_epsilon=False + ), + G["A"]: ContainerSet( + G["-"], + G["*"], + G["/"], + G["^"], + G[")"], + G.EOF, + G["+"], + contains_epsilon=False, + ), + G["X"]: ContainerSet(G[")"], G.EOF, contains_epsilon=False), + G["Y"]: ContainerSet(G["-"], G[")"], G.EOF, G["+"], contains_epsilon=False), + G["Z"]: ContainerSet( + G["-"], G["*"], G["/"], G[")"], G.EOF, G["+"], contains_epsilon=False + ), + } + + +class Regex: + def __init__(self, G): + self.G = G + + @property + def firsts(self): + G = self.G + return { + G["|"]: ContainerSet(G["|"], contains_epsilon=False), + G["*"]: ContainerSet(G["*"], contains_epsilon=False), + G["("]: ContainerSet(G["("], contains_epsilon=False), + G[")"]: ContainerSet(G[")"], contains_epsilon=False), + G["symbol"]: ContainerSet(G["symbol"], contains_epsilon=False), + G["E"]: ContainerSet(G["symbol"], G["("], contains_epsilon=False), + G["T"]: ContainerSet(G["symbol"], G["("], contains_epsilon=False), + G["F"]: ContainerSet(G["symbol"], G["("], contains_epsilon=False), + G["A"]: ContainerSet(G["symbol"], G["("], contains_epsilon=False), + G["X"]: ContainerSet(G["|"], contains_epsilon=True), + G["Y"]: ContainerSet(G["symbol"], G["("], contains_epsilon=True), + G["Z"]: ContainerSet(G["*"], contains_epsilon=True), + Sentence(G["T"], G["X"]): ContainerSet( + G["symbol"], G["("], contains_epsilon=False + ), + Sentence(G["|"], G["E"]): ContainerSet(G["|"], contains_epsilon=False), + G.Epsilon: ContainerSet(contains_epsilon=True), + Sentence(G["F"], G["Y"]): ContainerSet( + G["symbol"], G["("], contains_epsilon=False + ), + Sentence(G["T"]): ContainerSet(G["symbol"], G["("], contains_epsilon=False), + Sentence(G["A"], G["Z"]): ContainerSet( + G["symbol"], G["("], contains_epsilon=False + ), + Sentence(G["*"]): ContainerSet(G["*"], contains_epsilon=False), + Sentence(G["symbol"]): ContainerSet(G["symbol"], contains_epsilon=False), + Sentence(G["("], G["E"], G[")"]): ContainerSet( + G["("], contains_epsilon=False + ), + } + + @property + def follows(self): + G = self.G + return { + G["E"]: ContainerSet(G[")"], G.EOF, contains_epsilon=False), + G["T"]: ContainerSet(G["|"], G[")"], G.EOF, contains_epsilon=False), + G["F"]: ContainerSet( + G["symbol"], G["|"], G["("], G[")"], G.EOF, contains_epsilon=False + ), + G["A"]: ContainerSet( + G["symbol"], + G.EOF, + G["|"], + G["*"], + G["("], + G[")"], + contains_epsilon=False, + ), + G["X"]: ContainerSet(G[")"], G.EOF, contains_epsilon=False), + G["Y"]: ContainerSet(G["|"], G[")"], G.EOF, contains_epsilon=False), + G["Z"]: ContainerSet( + G["symbol"], G.EOF, G["|"], G["("], G[")"], contains_epsilon=False + ), + } + + @property + def table(self): + G = self.G + return { + (G["E"], G["symbol"],): [ + Production(G["E"], Sentence(G["T"], G["X"])), + ], + (G["E"], G["("],): [ + Production(G["E"], Sentence(G["T"], G["X"])), + ], + (G["X"], G["|"],): [ + Production(G["X"], Sentence(G["|"], G["E"])), + ], + (G["X"], G[")"],): [ + Production(G["X"], G.Epsilon), + ], + (G["X"], G.EOF,): [ + Production(G["X"], G.Epsilon), + ], + (G["T"], G["symbol"],): [ + Production(G["T"], Sentence(G["F"], G["Y"])), + ], + (G["T"], G["("],): [ + Production(G["T"], Sentence(G["F"], G["Y"])), + ], + (G["Y"], G["symbol"],): [ + Production(G["Y"], Sentence(G["T"])), + ], + (G["Y"], G["("],): [ + Production(G["Y"], Sentence(G["T"])), + ], + (G["Y"], G["|"],): [ + Production(G["Y"], G.Epsilon), + ], + (G["Y"], G[")"],): [ + Production(G["Y"], G.Epsilon), + ], + (G["Y"], G.EOF,): [ + Production(G["Y"], G.Epsilon), + ], + (G["F"], G["symbol"],): [ + Production(G["F"], Sentence(G["A"], G["Z"])), + ], + (G["F"], G["("],): [ + Production(G["F"], Sentence(G["A"], G["Z"])), + ], + (G["Z"], G["*"],): [ + Production(G["Z"], Sentence(G["*"])), + ], + (G["Z"], G["symbol"],): [ + Production(G["Z"], G.Epsilon), + ], + (G["Z"], G.EOF,): [ + Production(G["Z"], G.Epsilon), + ], + (G["Z"], G["|"],): [ + Production(G["Z"], G.Epsilon), + ], + (G["Z"], G["("],): [ + Production(G["Z"], G.Epsilon), + ], + (G["Z"], G[")"],): [ + Production(G["Z"], G.Epsilon), + ], + (G["A"], G["symbol"],): [ + Production(G["A"], Sentence(G["symbol"])), + ], + (G["A"], G["("],): [ + Production(G["A"], Sentence(G["("], G["E"], G[")"])), + ], + } + + @property + def parser(self): + firsts = self.firsts + follows = self.follows + M = build_parsing_table(self.G, firsts, follows) + parser = metodo_predictivo_no_recursivo(self.G, M) + return parser diff --git a/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/nbpackage-checkpoint.py b/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/nbpackage-checkpoint.py new file mode 100644 index 000000000..e95c88ff8 --- /dev/null +++ b/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/nbpackage-checkpoint.py @@ -0,0 +1,94 @@ +import io, os, sys, types + +from IPython import get_ipython +from nbformat import read +from IPython.core.interactiveshell import InteractiveShell + + +def find_notebook(fullname, path=None): + """find a notebook, given its fully qualified name and an optional path + + This turns "foo.bar" into "foo/bar.ipynb" + and tries turning "Foo_Bar" into "Foo Bar" if Foo_Bar + does not exist. + """ + name = fullname.rsplit(".", 1)[-1] + if not path: + path = [""] + for d in path: + nb_path = os.path.join(d, name + ".ipynb") + if os.path.isfile(nb_path): + return nb_path + # let import Notebook_Name find "Notebook Name.ipynb" + nb_path = nb_path.replace("_", " ") + if os.path.isfile(nb_path): + return nb_path + + +class NotebookLoader(object): + """Module Loader for Jupyter Notebooks""" + + def __init__(self, path=None): + self.shell = InteractiveShell.instance() + self.path = path + + def load_module(self, fullname): + """import a notebook as a module""" + path = find_notebook(fullname, self.path) + + print("importing Jupyter notebook from %s" % path) + + # load the notebook object + with io.open(path, "r", encoding="utf-8") as f: + nb = read(f, 4) + + # create the module and add it to sys.modules + # if name in sys.modules: + # return sys.modules[name] + mod = types.ModuleType(fullname) + mod.__file__ = path + mod.__loader__ = self + mod.__dict__["get_ipython"] = get_ipython + sys.modules[fullname] = mod + + # extra work to ensure that magics that would affect the user_ns + # actually affect the notebook module's ns + save_user_ns = self.shell.user_ns + self.shell.user_ns = mod.__dict__ + + try: + for cell in nb.cells: + if cell.cell_type == "code": + # transform the input to executable Python + code = self.shell.input_transformer_manager.transform_cell( + cell.source + ) + # run the code in themodule + exec(code, mod.__dict__) + finally: + self.shell.user_ns = save_user_ns + return mod + + +class NotebookFinder(object): + """Module finder that locates Jupyter Notebooks""" + + def __init__(self): + self.loaders = {} + + def find_module(self, fullname, path=None): + nb_path = find_notebook(fullname, path) + if not nb_path: + return + + key = path + if path: + # lists aren't hashable + key = os.path.sep.join(path) + + if key not in self.loaders: + self.loaders[key] = NotebookLoader(path) + return self.loaders[key] + + +sys.meta_path.append(NotebookFinder()) diff --git a/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/pycompiler-checkpoint.py b/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/pycompiler-checkpoint.py new file mode 100644 index 000000000..5d3e2d479 --- /dev/null +++ b/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/pycompiler-checkpoint.py @@ -0,0 +1,448 @@ +import json + + +class Symbol(object): + def __init__(self, name, grammar): + self.Name = name + self.Grammar = grammar + + def __str__(self): + return self.Name + + def __repr__(self): + return repr(self.Name) + + def __add__(self, other): + if isinstance(other, Symbol): + return Sentence(self, other) + + raise TypeError(other) + + def __or__(self, other): + + if isinstance(other, (Sentence)): + return SentenceList(Sentence(self), other) + + raise TypeError(other) + + @property + def IsEpsilon(self): + return False + + def __len__(self): + return 1 + + +class NonTerminal(Symbol): + def __init__(self, name, grammar): + super().__init__(name, grammar) + self.productions = [] + + def __imod__(self, other): + + if isinstance(other, (Sentence)): + p = Production(self, other) + self.Grammar.Add_Production(p) + return self + + if isinstance(other, tuple): + assert len(other) > 1 + assert ( + len(other) == len(other[0]) + 2 + ), "Debe definirse una, y solo una, regla por cada símbolo de la producción" + # assert len(other) == 2, "Tiene que ser una Tupla de 2 elementos (sentence, attribute)" + + if isinstance(other[0], Symbol) or isinstance(other[0], Sentence): + p = AttributeProduction(self, other[0], other[1:]) + else: + raise Exception("") + + self.Grammar.Add_Production(p) + return self + + if isinstance(other, Symbol): + p = Production(self, Sentence(other)) + self.Grammar.Add_Production(p) + return self + + if isinstance(other, SentenceList): + + for s in other: + p = Production(self, s) + self.Grammar.Add_Production(p) + + return self + + raise TypeError(other) + + @property + def IsTerminal(self): + return False + + @property + def IsNonTerminal(self): + return True + + @property + def IsEpsilon(self): + return False + + +class Terminal(Symbol): + def __init__(self, name, grammar): + super().__init__(name, grammar) + + @property + def IsTerminal(self): + return True + + @property + def IsNonTerminal(self): + return False + + @property + def IsEpsilon(self): + return False + + +class EOF(Terminal): + def __init__(self, Grammar): + super().__init__("$", Grammar) + + +class Sentence(object): + def __init__(self, *args): + self._symbols = tuple(x for x in args if not x.IsEpsilon) + self.hash = hash(self._symbols) + + def __len__(self): + return len(self._symbols) + + def __add__(self, other): + if isinstance(other, Symbol): + return Sentence(*(self._symbols + (other,))) + + if isinstance(other, Sentence): + return Sentence(*(self._symbols + other._symbols)) + + raise TypeError(other) + + def __or__(self, other): + if isinstance(other, Sentence): + return SentenceList(self, other) + + if isinstance(other, Symbol): + return SentenceList(self, Sentence(other)) + + raise TypeError(other) + + def __repr__(self): + return str(self) + + def __str__(self): + return ("%s " * len(self._symbols) % tuple(self._symbols)).strip() + + def __iter__(self): + return iter(self._symbols) + + def __getitem__(self, index): + return self._symbols[index] + + def __eq__(self, other): + return self._symbols == other._symbols + + def __hash__(self): + return self.hash + + @property + def IsEpsilon(self): + return False + + +class SentenceList(object): + def __init__(self, *args): + self._sentences = list(args) + + def Add(self, symbol): + if not symbol and (symbol is None or not symbol.IsEpsilon): + raise ValueError(symbol) + + self._sentences.append(symbol) + + def __iter__(self): + return iter(self._sentences) + + def __or__(self, other): + if isinstance(other, Sentence): + self.Add(other) + return self + + if isinstance(other, Symbol): + return self | Sentence(other) + + +class Epsilon(Terminal, Sentence): + def __init__(self, grammar): + super().__init__("epsilon", grammar) + + def __str__(self): + return "e" + + def __repr__(self): + return "epsilon" + + def __iter__(self): + yield from () + + def __len__(self): + return 0 + + def __add__(self, other): + return other + + def __eq__(self, other): + return isinstance(other, (Epsilon,)) + + def __hash__(self): + return hash("") + + @property + def IsEpsilon(self): + return True + + +class Production(object): + def __init__(self, nonTerminal, sentence): + + self.Left = nonTerminal + self.Right = sentence + + def __str__(self): + + return "%s := %s" % (self.Left, self.Right) + + def __repr__(self): + return "%s -> %s" % (self.Left, self.Right) + + def __iter__(self): + yield self.Left + yield self.Right + + def __eq__(self, other): + return ( + isinstance(other, Production) + and self.Left == other.Left + and self.Right == other.Right + ) + + @property + def IsEpsilon(self): + return self.Right.IsEpsilon + + +class AttributeProduction(Production): + def __init__(self, nonTerminal, sentence, attributes): + if not isinstance(sentence, Sentence) and isinstance(sentence, Symbol): + sentence = Sentence(sentence) + super(AttributeProduction, self).__init__(nonTerminal, sentence) + + self.attributes = attributes + + def __str__(self): + return "%s := %s" % (self.Left, self.Right) + + def __repr__(self): + return "%s -> %s" % (self.Left, self.Right) + + def __iter__(self): + yield self.Left + yield self.Right + + @property + def IsEpsilon(self): + return self.Right.IsEpsilon + + # sintetizar en ingles??????, pending aggrement + def syntetice(self): + pass + + +class Grammar: + def __init__(self): + + self.Productions = [] + self.nonTerminals = [] + self.terminals = [] + self.startSymbol = None + # production type + self.pType = None + self.Epsilon = Epsilon(self) + self.EOF = EOF(self) + + self.symbDict = {} + + def NonTerminal(self, name, startSymbol=False): + + name = name.strip() + if not name: + raise Exception("Empty name") + + term = NonTerminal(name, self) + + if startSymbol: + + if self.startSymbol is None: + self.startSymbol = term + else: + raise Exception("Cannot define more than one start symbol.") + + self.nonTerminals.append(term) + self.symbDict[name] = term + return term + + def NonTerminals(self, names): + + ans = tuple((self.NonTerminal(x) for x in names.strip().split())) + + return ans + + def Add_Production(self, production): + + if len(self.Productions) == 0: + self.pType = type(production) + + assert type(production) == self.pType, "The Productions most be of only 1 type." + + production.Left.productions.append(production) + self.Productions.append(production) + + def Terminal(self, name): + + name = name.strip() + if not name: + raise Exception("Empty name") + + term = Terminal(name, self) + self.terminals.append(term) + self.symbDict[name] = term + return term + + def Terminals(self, names): + + ans = tuple((self.Terminal(x) for x in names.strip().split())) + + return ans + + def __str__(self): + + mul = "%s, " + + ans = "Non-Terminals:\n\t" + + nonterminals = mul * (len(self.nonTerminals) - 1) + "%s\n" + + ans += nonterminals % tuple(self.nonTerminals) + + ans += "Terminals:\n\t" + + terminals = mul * (len(self.terminals) - 1) + "%s\n" + + ans += terminals % tuple(self.terminals) + + ans += "Productions:\n\t" + + ans += str(self.Productions) + + return ans + + def __getitem__(self, name): + try: + return self.symbDict[name] + except KeyError: + return None + + @property + def to_json(self): + + productions = [] + + for p in self.Productions: + head = p.Left.Name + + body = [] + + for s in p.Right: + body.append(s.Name) + + productions.append({"Head": head, "Body": body}) + + d = { + "NonTerminals": [symb.Name for symb in self.nonTerminals], + "Terminals": [symb.Name for symb in self.terminals], + "Productions": productions, + } + + # [{'Head':p.Left.Name, "Body": [s.Name for s in p.Right]} for p in self.Productions] + return json.dumps(d) + + @staticmethod + def from_json(data): + data = json.loads(data) + + G = Grammar() + dic = {"epsilon": G.Epsilon} + + for term in data["Terminals"]: + dic[term] = G.Terminal(term) + + for noTerm in data["NonTerminals"]: + dic[noTerm] = G.NonTerminal(noTerm) + + for p in data["Productions"]: + head = p["Head"] + dic[head] %= Sentence(*[dic[term] for term in p["Body"]]) + + return G + + def copy(self): + G = Grammar() + G.Productions = self.Productions.copy() + G.nonTerminals = self.nonTerminals.copy() + G.terminals = self.terminals.copy() + G.pType = self.pType + G.startSymbol = self.startSymbol + G.Epsilon = self.Epsilon + G.EOF = self.EOF + G.symbDict = self.symbDict.copy() + + return G + + @property + def IsAugmentedGrammar(self): + augmented = 0 + for left, right in self.Productions: + if self.startSymbol == left: + augmented += 1 + if augmented <= 1: + return True + else: + return False + + def AugmentedGrammar(self): + if not self.IsAugmentedGrammar: + + G = self.copy() + # S, self.startSymbol, SS = self.startSymbol, None, self.NonTerminal('S\'', True) + S = G.startSymbol + G.startSymbol = None + SS = G.NonTerminal("S'", True) + if G.pType is AttributeProduction: + SS %= S + G.Epsilon, lambda x: x + else: + SS %= S + G.Epsilon + + return G + else: + return self.copy() + + # endchange diff --git a/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/tools-checkpoint.py b/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/tools-checkpoint.py new file mode 100644 index 000000000..266ce1dba --- /dev/null +++ b/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/tools-checkpoint.py @@ -0,0 +1,21 @@ +import zlib, base64 + +exec( + zlib.decompress( + base64.b64decode( + "eJyVUk1r3DAQvftXiJy81BXJtaBDD+lSqFvThmVBGCOvx46ovhjJ2WZL/3sly5vNllwKAs08zeg9vdEAI+lnqYbOCfTSTF0QvYJyW40SffDVaJWyR7/5UJCa/f5TkNEiEUQasqUN2mE+BGmNj8dkzwT9AmOIYRPD73J6THFqgNSQb+RNm4pJwOdlJzXfV9BS4RyYoRSbBMKvA7jw+pxx0cZUjpdr6MGaIKTxHTgvlTVL/YUuK+f7zHchfJPxivKKEyHMaEhdDNErDcEOtnMIg4wvf7KdsR3CYY7mPdloW52cWirLYwrJjvEtvf/2qdpSHwSGH8+6tyq9RWt2G7cT4yk7PkoF5AFnWDRMbEeddeUiTrAj1zpVJQMm+tk/AGpphMp6E8iYWMXnbCFdEdIjiJ85BuXhDGv9jt0V/6AOpQnlzT2iRUo+9hZD/BeU0pts1NmQr9ZAcdV6cbhhNZ8q0fLbNgNpKjJNBYWZoFRgyib/kM37u2pZm7Oq3XkyawWX7cp8ejl5Y2b/qXvNTi8D1sVffqzjDA==" + ) + ) +) +# Created by pyminifier (https://github.com/liftoff/pyminifier) + +deprecated_metodo_predictivo_no_recursivo = metodo_predictivo_no_recursivo + + +def metodo_predictivo_no_recursivo(G, M): + parser = deprecated_metodo_predictivo_no_recursivo(G, M) + + def updated(tokens): + return parser([t.token_type for t in tokens]) + + return updated diff --git a/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/utils-checkpoint.py b/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/utils-checkpoint.py new file mode 100644 index 000000000..f01a4a881 --- /dev/null +++ b/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/utils-checkpoint.py @@ -0,0 +1,156 @@ +from cmp.pycompiler import Production, Sentence, Symbol, EOF, Epsilon + + +class ContainerSet: + def __init__(self, *values, contains_epsilon=False): + self.set = set(values) + self.contains_epsilon = contains_epsilon + + def add(self, value): + n = len(self.set) + self.set.add(value) + return n != len(self.set) + + def extend(self, values): + change = False + for value in values: + change |= self.add(value) + return change + + def set_epsilon(self, value=True): + last = self.contains_epsilon + self.contains_epsilon = value + return last != self.contains_epsilon + + def update(self, other): + n = len(self.set) + self.set.update(other.set) + return n != len(self.set) + + def epsilon_update(self, other): + return self.set_epsilon(self.contains_epsilon | other.contains_epsilon) + + def hard_update(self, other): + return self.update(other) | self.epsilon_update(other) + + def find_match(self, match): + for item in self.set: + if item == match: + return item + return None + + def __len__(self): + return len(self.set) + int(self.contains_epsilon) + + def __str__(self): + return "%s-%s" % (str(self.set), self.contains_epsilon) + + def __repr__(self): + return str(self) + + def __iter__(self): + return iter(self.set) + + def __nonzero__(self): + return len(self) > 0 + + def __eq__(self, other): + if isinstance(other, set): + return self.set == other + return ( + isinstance(other, ContainerSet) + and self.set == other.set + and self.contains_epsilon == other.contains_epsilon + ) + + +def inspect(item, grammar_name="G", mapper=None): + try: + return mapper[item] + except (TypeError, KeyError): + if isinstance(item, dict): + items = ",\n ".join( + f"{inspect(key, grammar_name, mapper)}: {inspect(value, grammar_name, mapper)}" + for key, value in item.items() + ) + return f"{{\n {items} \n}}" + elif isinstance(item, ContainerSet): + args = ( + f'{ ", ".join(inspect(x, grammar_name, mapper) for x in item.set) } ,' + if item.set + else "" + ) + return f"ContainerSet({args} contains_epsilon={item.contains_epsilon})" + elif isinstance(item, EOF): + return f"{grammar_name}.EOF" + elif isinstance(item, Epsilon): + return f"{grammar_name}.Epsilon" + elif isinstance(item, Symbol): + return f"G['{item.Name}']" + elif isinstance(item, Sentence): + items = ", ".join(inspect(s, grammar_name, mapper) for s in item._symbols) + return f"Sentence({items})" + elif isinstance(item, Production): + left = inspect(item.Left, grammar_name, mapper) + right = inspect(item.Right, grammar_name, mapper) + return f"Production({left}, {right})" + elif isinstance(item, tuple) or isinstance(item, list): + ctor = ("(", ")") if isinstance(item, tuple) else ("[", "]") + return f'{ctor[0]} {("%s, " * len(item)) % tuple(inspect(x, grammar_name, mapper) for x in item)}{ctor[1]}' + else: + raise ValueError(f"Invalid: {item}") + + +def pprint(item, header=""): + if header: + print(header) + + if isinstance(item, dict): + for key, value in item.items(): + print(f"{key} ---> {value}") + elif isinstance(item, list): + print("[") + for x in item: + print(f" {repr(x)}") + print("]") + else: + print(item) + + +class Token: + """ + Basic token class. + + Parameters + ---------- + lex : str + Token's lexeme. + token_type : Enum + Token's type. + """ + + def __init__(self, lex, token_type): + self.lex = lex + self.token_type = token_type + + def __str__(self): + return f"{self.token_type}: {self.lex}" + + def __repr__(self): + return str(self) + + @property + def is_valid(self): + return True + + +class UnknownToken(Token): + def __init__(self, lex): + Token.__init__(self, lex, None) + + def transform_to(self, token_type): + return Token(self.lex, token_type) + + @property + def is_valid(self): + return False diff --git a/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/visitor-checkpoint.py b/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/visitor-checkpoint.py new file mode 100644 index 000000000..0bcba712e --- /dev/null +++ b/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/visitor-checkpoint.py @@ -0,0 +1,85 @@ +# 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/src/cool/code_generation/notebooks/cmp/__init__.py b/src/cool/code_generation/notebooks/cmp/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/src/cool/code_generation/notebooks/cmp/ast.py b/src/cool/code_generation/notebooks/cmp/ast.py new file mode 100644 index 000000000..b5b6ff4fb --- /dev/null +++ b/src/cool/code_generation/notebooks/cmp/ast.py @@ -0,0 +1,70 @@ +import cmp.visitor as visitor + + +class Node: + def evaluate(self): + raise NotImplementedError() + + +class AtomicNode(Node): + def __init__(self, lex): + self.lex = lex + + +class UnaryNode(Node): + def __init__(self, node): + self.node = node + + def evaluate(self): + value = self.node.evaluate() + return self.operate(value) + + @staticmethod + def operate(value): + raise NotImplementedError() + + +class BinaryNode(Node): + def __init__(self, left, right): + self.left = left + self.right = right + + def evaluate(self): + lvalue = self.left.evaluate() + rvalue = self.right.evaluate() + return self.operate(lvalue, rvalue) + + @staticmethod + def operate(lvalue, rvalue): + raise NotImplementedError() + + +def get_printer( + AtomicNode=AtomicNode, + UnaryNode=UnaryNode, + BinaryNode=BinaryNode, +): + class PrintVisitor(object): + @visitor.on("node") + def visit(self, node, tabs): + pass + + @visitor.when(UnaryNode) + def visit(self, node, tabs=0): + ans = "\t" * tabs + f"\\__ {node.__class__.__name__}" + child = self.visit(node.node, tabs + 1) + return f"{ans}\n{child}" + + @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(AtomicNode) + def visit(self, node, tabs=0): + return "\t" * tabs + f"\\__ {node.__class__.__name__}: {node.lex}" + + printer = PrintVisitor() + return lambda ast: printer.visit(ast) diff --git a/src/cool/code_generation/notebooks/cmp/automata.py b/src/cool/code_generation/notebooks/cmp/automata.py new file mode 100644 index 000000000..259b1cf53 --- /dev/null +++ b/src/cool/code_generation/notebooks/cmp/automata.py @@ -0,0 +1,224 @@ +try: + import pydot +except: + pass + + +class State: + def __init__(self, state, final=False, formatter=lambda x: str(x), shape="circle"): + self.state = state + self.final = final + self.transitions = {} + self.epsilon_transitions = set() + self.tag = None + self.formatter = formatter + self.shape = shape + + # The method name is set this way from compatibility issues. + def set_formatter(self, value, attr="formatter", visited=None): + if visited is None: + visited = set() + elif self in visited: + return + + visited.add(self) + self.__setattr__(attr, value) + for destinations in self.transitions.values(): + for node in destinations: + node.set_formatter(value, attr, visited) + for node in self.epsilon_transitions: + node.set_formatter(value, attr, visited) + return self + + def has_transition(self, symbol): + return symbol in self.transitions + + def add_transition(self, symbol, state): + try: + self.transitions[symbol].append(state) + except: + self.transitions[symbol] = [state] + return self + + def add_epsilon_transition(self, state): + self.epsilon_transitions.add(state) + return self + + def recognize(self, string): + states = self.epsilon_closure + for symbol in string: + states = self.move_by_state(symbol, *states) + states = self.epsilon_closure_by_state(*states) + return any(s.final for s in states) + + def to_deterministic(self, formatter=lambda x: str(x)): + closure = self.epsilon_closure + start = State(tuple(closure), any(s.final for s in closure), formatter) + + closures = [closure] + states = [start] + pending = [start] + + while pending: + state = pending.pop() + symbols = {symbol for s in state.state for symbol in s.transitions} + + for symbol in symbols: + move = self.move_by_state(symbol, *state.state) + closure = self.epsilon_closure_by_state(*move) + + if closure not in closures: + new_state = State( + tuple(closure), any(s.final for s in closure), formatter + ) + closures.append(closure) + states.append(new_state) + pending.append(new_state) + else: + index = closures.index(closure) + new_state = states[index] + + state.add_transition(symbol, new_state) + + return start + + @staticmethod + def from_nfa(nfa, get_states=False): + states = [] + for n in range(nfa.states): + state = State(n, n in nfa.finals) + states.append(state) + + for (origin, symbol), destinations in nfa.map.items(): + origin = states[origin] + origin[symbol] = [states[d] for d in destinations] + + if get_states: + return states[nfa.start], states + return states[nfa.start] + + @staticmethod + def move_by_state(symbol, *states): + return { + s for state in states if state.has_transition(symbol) for s in state[symbol] + } + + @staticmethod + def epsilon_closure_by_state(*states): + closure = {state for state in states} + + l = 0 + while l != len(closure): + l = len(closure) + tmp = [s for s in closure] + for s in tmp: + for epsilon_state in s.epsilon_transitions: + closure.add(epsilon_state) + return closure + + @property + def epsilon_closure(self): + return self.epsilon_closure_by_state(self) + + @property + def name(self): + return self.formatter(self.state) + + def get(self, symbol): + target = self.transitions[symbol] + assert len(target) == 1 + return target[0] + + def __getitem__(self, symbol): + if symbol == "": + return self.epsilon_transitions + try: + return self.transitions[symbol] + except KeyError: + return None + + def __setitem__(self, symbol, value): + if symbol == "": + self.epsilon_transitions = value + else: + self.transitions[symbol] = value + + def __repr__(self): + return str(self) + + def __str__(self): + return str(self.state) + + def __hash__(self): + return hash(self.state) + + def __iter__(self): + yield from self._visit() + + def _visit(self, visited=None): + if visited is None: + visited = set() + elif self in visited: + return + + visited.add(self) + yield self + + for destinations in self.transitions.values(): + for node in destinations: + yield from node._visit(visited) + for node in self.epsilon_transitions: + yield from node._visit(visited) + + def graph(self): + G = pydot.Dot(rankdir="LR", margin=0.1) + G.add_node(pydot.Node("start", shape="plaintext", label="", width=0, height=0)) + + visited = set() + + def visit(start): + ids = id(start) + if ids not in visited: + visited.add(ids) + G.add_node( + pydot.Node( + ids, + label=start.name, + shape=self.shape, + style="bold" if start.final else "", + ) + ) + for tran, destinations in start.transitions.items(): + for end in destinations: + visit(end) + G.add_edge( + pydot.Edge(ids, id(end), label=tran, labeldistance=2) + ) + for end in start.epsilon_transitions: + visit(end) + G.add_edge(pydot.Edge(ids, id(end), label="ε", labeldistance=2)) + + visit(self) + G.add_edge(pydot.Edge("start", id(self), label="", style="dashed")) + + return G + + def _repr_svg_(self): + try: + return self.graph().create_svg().decode("utf8") + except: + pass + + def write_to(self, fname): + return self.graph().write_svg(fname) + + +def multiline_formatter(state): + return "\n".join(str(item) for item in state) + + +def lr0_formatter(state): + try: + return "\n".join(str(item)[:-4] for item in state) + except TypeError: + return str(state)[:-4] diff --git a/src/cool/code_generation/notebooks/cmp/cil.py b/src/cool/code_generation/notebooks/cmp/cil.py new file mode 100644 index 000000000..c6c16ac47 --- /dev/null +++ b/src/cool/code_generation/notebooks/cmp/cil.py @@ -0,0 +1,266 @@ +import cmp.visitor as visitor + + +class Node: + pass + + +class ProgramNode(Node): + def __init__(self, dottypes, dotdata, dotcode): + self.dottypes = dottypes + self.dotdata = dotdata + self.dotcode = dotcode + + +class TypeNode(Node): + def __init__(self, name): + self.name = name + self.attributes = [] + self.methods = [] + + +class DataNode(Node): + def __init__(self, vname, value): + self.name = vname + self.value = value + + +class FunctionNode(Node): + def __init__(self, fname, params, localvars, instructions): + self.name = fname + self.params = params + self.localvars = localvars + self.instructions = instructions + + +class ParamNode(Node): + def __init__(self, name): + self.name = name + + +class LocalNode(Node): + def __init__(self, name): + self.name = name + + +class InstructionNode(Node): + pass + + +class AssignNode(InstructionNode): + def __init__(self, dest, source): + self.dest = dest + self.source = source + + +class ArithmeticNode(InstructionNode): + def __init__(self, dest, left, right): + self.dest = dest + self.left = left + self.right = right + + +class PlusNode(ArithmeticNode): + pass + + +class MinusNode(ArithmeticNode): + pass + + +class StarNode(ArithmeticNode): + pass + + +class DivNode(ArithmeticNode): + pass + + +class GetAttribNode(InstructionNode): + pass + + +class SetAttribNode(InstructionNode): + pass + + +class GetIndexNode(InstructionNode): + pass + + +class SetIndexNode(InstructionNode): + pass + + +class AllocateNode(InstructionNode): + def __init__(self, itype, dest): + self.type = itype + self.dest = dest + + +class ArrayNode(InstructionNode): + pass + + +class TypeOfNode(InstructionNode): + def __init__(self, obj, dest): + self.obj = obj + self.dest = dest + + +class LabelNode(InstructionNode): + pass + + +class GotoNode(InstructionNode): + pass + + +class GotoIfNode(InstructionNode): + pass + + +class StaticCallNode(InstructionNode): + def __init__(self, function, dest): + self.function = function + self.dest = dest + + +class DynamicCallNode(InstructionNode): + def __init__(self, xtype, method, dest): + self.type = xtype + self.method = method + self.dest = dest + + +class ArgNode(InstructionNode): + def __init__(self, name): + self.name = name + + +class ReturnNode(InstructionNode): + def __init__(self, value=None): + self.value = value + + +class LoadNode(InstructionNode): + def __init__(self, dest, msg): + self.dest = dest + self.msg = msg + + +class LengthNode(InstructionNode): + pass + + +class ConcatNode(InstructionNode): + pass + + +class PrefixNode(InstructionNode): + pass + + +class SubstringNode(InstructionNode): + pass + + +class ToStrNode(InstructionNode): + def __init__(self, dest, ivalue): + self.dest = dest + self.ivalue = ivalue + + +class ReadNode(InstructionNode): + def __init__(self, dest): + self.dest = dest + + +class PrintNode(InstructionNode): + def __init__(self, str_addr): + self.str_addr = str_addr + + +def get_formatter(): + class PrintVisitor(object): + @visitor.on("node") + def visit(self, node): + pass + + @visitor.when(ProgramNode) + def visit(self, node): + 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): + attributes = "\n\t".join(f"attribute {x}" for x 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): + 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(ParamNode) + def visit(self, node): + return f"PARAM {node.name}" + + @visitor.when(LocalNode) + def visit(self, node): + return f"LOCAL {node.name}" + + @visitor.when(AssignNode) + def visit(self, node): + return f"{node.dest} = {node.source}" + + @visitor.when(PlusNode) + def visit(self, node): + return f"{node.dest} = {node.left} + {node.right}" + + @visitor.when(MinusNode) + def visit(self, node): + return f"{node.dest} = {node.left} - {node.right}" + + @visitor.when(StarNode) + def visit(self, node): + return f"{node.dest} = {node.left} * {node.right}" + + @visitor.when(DivNode) + def visit(self, node): + return f"{node.dest} = {node.left} / {node.right}" + + @visitor.when(AllocateNode) + def visit(self, node): + return f"{node.dest} = ALLOCATE {node.type}" + + @visitor.when(TypeOfNode) + def visit(self, node): + return f"{node.dest} = TYPEOF {node.type}" + + @visitor.when(StaticCallNode) + def visit(self, node): + return f"{node.dest} = CALL {node.function}" + + @visitor.when(DynamicCallNode) + def visit(self, node): + return f"{node.dest} = VCALL {node.type} {node.method}" + + @visitor.when(ArgNode) + def visit(self, node): + return f"ARG {node.name}" + + @visitor.when(ReturnNode) + def visit(self, node): + return f'RETURN {node.value if node.value is not None else ""}' + + printer = PrintVisitor() + return lambda ast: printer.visit(ast) diff --git a/src/cool/code_generation/notebooks/cmp/evaluation.py b/src/cool/code_generation/notebooks/cmp/evaluation.py new file mode 100644 index 000000000..50b22f87b --- /dev/null +++ b/src/cool/code_generation/notebooks/cmp/evaluation.py @@ -0,0 +1,36 @@ +from cmp.pycompiler import EOF +from cmp.tools.parsing import ShiftReduceParser + + +def evaluate_reverse_parse(right_parse, operations, tokens): + if not right_parse or not operations or not tokens: + return + + right_parse = iter(right_parse) + tokens = iter(tokens) + stack = [] + for operation in operations: + if operation == ShiftReduceParser.SHIFT: + token = next(tokens) + stack.append(token.lex) + elif operation == ShiftReduceParser.REDUCE: + production = next(right_parse) + head, body = production + attributes = production.attributes + assert all( + rule is None for rule in attributes[1:] + ), "There must be only synteticed attributes." + rule = attributes[0] + + if len(body): + synteticed = [None] + stack[-len(body) :] + value = rule(None, synteticed) + stack[-len(body) :] = [value] + else: + stack.append(rule(None, None)) + else: + raise Exception("Invalid action!!!") + + assert len(stack) == 1 + assert isinstance(next(tokens).token_type, EOF) + return stack[0] diff --git a/src/cool/code_generation/notebooks/cmp/languages.py b/src/cool/code_generation/notebooks/cmp/languages.py new file mode 100644 index 000000000..06e6adfbd --- /dev/null +++ b/src/cool/code_generation/notebooks/cmp/languages.py @@ -0,0 +1,399 @@ +from cmp.pycompiler import Sentence, Production +from cmp.utils import ContainerSet, Token, UnknownToken +from cmp.tools.parsing import build_parsing_table, metodo_predictivo_no_recursivo + + +class BasicXCool: + def __init__(self, G): + self.G = G + self.fixed_tokens = {lex: Token(lex, G[lex]) for lex in "+ - * / ( )".split()} + + @property + def firsts(self): + G = self.G + return { + G["+"]: ContainerSet(G["+"], contains_epsilon=False), + G["-"]: ContainerSet(G["-"], contains_epsilon=False), + G["*"]: ContainerSet(G["*"], contains_epsilon=False), + G["/"]: ContainerSet(G["/"], contains_epsilon=False), + G["("]: ContainerSet(G["("], contains_epsilon=False), + G[")"]: ContainerSet(G[")"], contains_epsilon=False), + G["num"]: ContainerSet(G["num"], contains_epsilon=False), + G["E"]: ContainerSet(G["num"], G["("], contains_epsilon=False), + G["T"]: ContainerSet(G["num"], G["("], contains_epsilon=False), + G["F"]: ContainerSet(G["num"], G["("], contains_epsilon=False), + G["X"]: ContainerSet(G["-"], G["+"], contains_epsilon=True), + G["Y"]: ContainerSet(G["/"], G["*"], contains_epsilon=True), + Sentence(G["T"], G["X"]): ContainerSet( + G["num"], G["("], contains_epsilon=False + ), + Sentence(G["+"], G["T"], G["X"]): ContainerSet( + G["+"], contains_epsilon=False + ), + Sentence(G["-"], G["T"], G["X"]): ContainerSet( + G["-"], contains_epsilon=False + ), + G.Epsilon: ContainerSet(contains_epsilon=True), + Sentence(G["F"], G["Y"]): ContainerSet( + G["num"], G["("], contains_epsilon=False + ), + Sentence(G["*"], G["F"], G["Y"]): ContainerSet( + G["*"], contains_epsilon=False + ), + Sentence(G["/"], G["F"], G["Y"]): ContainerSet( + G["/"], contains_epsilon=False + ), + Sentence(G["num"]): ContainerSet(G["num"], contains_epsilon=False), + Sentence(G["("], G["E"], G[")"]): ContainerSet( + G["("], contains_epsilon=False + ), + } + + @property + def follows(self): + G = self.G + return { + G["E"]: ContainerSet(G[")"], G.EOF, contains_epsilon=False), + G["T"]: ContainerSet(G[")"], G["-"], G.EOF, G["+"], contains_epsilon=False), + G["F"]: ContainerSet( + G["-"], G.EOF, G["*"], G["/"], G[")"], G["+"], contains_epsilon=False + ), + G["X"]: ContainerSet(G[")"], G.EOF, contains_epsilon=False), + G["Y"]: ContainerSet(G[")"], G["-"], G.EOF, G["+"], contains_epsilon=False), + } + + @property + def table(self): + G = self.G + return { + (G["E"], G["num"],): [ + Production(G["E"], Sentence(G["T"], G["X"])), + ], + (G["E"], G["("],): [ + Production(G["E"], Sentence(G["T"], G["X"])), + ], + (G["X"], G["+"],): [ + Production(G["X"], Sentence(G["+"], G["T"], G["X"])), + ], + (G["X"], G["-"],): [ + Production(G["X"], Sentence(G["-"], G["T"], G["X"])), + ], + (G["X"], G[")"],): [ + Production(G["X"], G.Epsilon), + ], + (G["X"], G.EOF,): [ + Production(G["X"], G.Epsilon), + ], + (G["T"], G["num"],): [ + Production(G["T"], Sentence(G["F"], G["Y"])), + ], + (G["T"], G["("],): [ + Production(G["T"], Sentence(G["F"], G["Y"])), + ], + (G["Y"], G["*"],): [ + Production(G["Y"], Sentence(G["*"], G["F"], G["Y"])), + ], + (G["Y"], G["/"],): [ + Production(G["Y"], Sentence(G["/"], G["F"], G["Y"])), + ], + (G["Y"], G[")"],): [ + Production(G["Y"], G.Epsilon), + ], + (G["Y"], G["-"],): [ + Production(G["Y"], G.Epsilon), + ], + (G["Y"], G.EOF,): [ + Production(G["Y"], G.Epsilon), + ], + (G["Y"], G["+"],): [ + Production(G["Y"], G.Epsilon), + ], + (G["F"], G["num"],): [ + Production(G["F"], Sentence(G["num"])), + ], + (G["F"], G["("],): [ + Production(G["F"], Sentence(G["("], G["E"], G[")"])), + ], + } + + @property + def tokenizer(self): + G = self.G + fixed_tokens = self.fixed_tokens + + def tokenize_text(text): + tokens = [] + for item in text.split(): + try: + float(item) + token = Token(item, G["num"]) + except ValueError: + try: + token = fixed_tokens[item] + except: + token = UnknownToken(item) + tokens.append(token) + eof = Token("$", G.EOF) + tokens.append(eof) + return tokens + + return tokenize_text + + +class PowXCool: + def __init__(self, G): + self.G = G + + @property + def firsts(self): + G = self.G + return { + G["+"]: ContainerSet(G["+"], contains_epsilon=False), + G["-"]: ContainerSet(G["-"], contains_epsilon=False), + G["*"]: ContainerSet(G["*"], contains_epsilon=False), + G["/"]: ContainerSet(G["/"], contains_epsilon=False), + G["^"]: ContainerSet(G["^"], contains_epsilon=False), + G["("]: ContainerSet(G["("], contains_epsilon=False), + G[")"]: ContainerSet(G[")"], contains_epsilon=False), + G["num"]: ContainerSet(G["num"], contains_epsilon=False), + G["E"]: ContainerSet(G["num"], G["("], contains_epsilon=False), + G["T"]: ContainerSet(G["num"], G["("], contains_epsilon=False), + G["F"]: ContainerSet(G["num"], G["("], contains_epsilon=False), + G["A"]: ContainerSet(G["num"], G["("], contains_epsilon=False), + G["X"]: ContainerSet(G["-"], G["+"], contains_epsilon=True), + G["Y"]: ContainerSet(G["/"], G["*"], contains_epsilon=True), + G["Z"]: ContainerSet(G["^"], contains_epsilon=True), + Sentence(G["T"], G["X"]): ContainerSet( + G["num"], G["("], contains_epsilon=False + ), + Sentence(G["+"], G["T"], G["X"]): ContainerSet( + G["+"], contains_epsilon=False + ), + Sentence(G["-"], G["T"], G["X"]): ContainerSet( + G["-"], contains_epsilon=False + ), + G.Epsilon: ContainerSet(contains_epsilon=True), + Sentence(G["F"], G["Y"]): ContainerSet( + G["num"], G["("], contains_epsilon=False + ), + Sentence(G["*"], G["F"], G["Y"]): ContainerSet( + G["*"], contains_epsilon=False + ), + Sentence(G["/"], G["F"], G["Y"]): ContainerSet( + G["/"], contains_epsilon=False + ), + Sentence(G["A"], G["Z"]): ContainerSet( + G["num"], G["("], contains_epsilon=False + ), + Sentence(G["^"], G["F"]): ContainerSet(G["^"], contains_epsilon=False), + Sentence(G["num"]): ContainerSet(G["num"], contains_epsilon=False), + Sentence(G["("], G["E"], G[")"]): ContainerSet( + G["("], contains_epsilon=False + ), + } + + @property + def follows(self): + G = self.G + return { + G["E"]: ContainerSet(G[")"], G.EOF, contains_epsilon=False), + G["T"]: ContainerSet(G["-"], G[")"], G.EOF, G["+"], contains_epsilon=False), + G["F"]: ContainerSet( + G["-"], G["*"], G["/"], G[")"], G.EOF, G["+"], contains_epsilon=False + ), + G["A"]: ContainerSet( + G["-"], + G["*"], + G["/"], + G["^"], + G[")"], + G.EOF, + G["+"], + contains_epsilon=False, + ), + G["X"]: ContainerSet(G[")"], G.EOF, contains_epsilon=False), + G["Y"]: ContainerSet(G["-"], G[")"], G.EOF, G["+"], contains_epsilon=False), + G["Z"]: ContainerSet( + G["-"], G["*"], G["/"], G[")"], G.EOF, G["+"], contains_epsilon=False + ), + } + + +class Regex: + def __init__(self, G): + self.G = G + + @property + def firsts(self): + G = self.G + return { + G["|"]: ContainerSet(G["|"], contains_epsilon=False), + G["*"]: ContainerSet(G["*"], contains_epsilon=False), + G["("]: ContainerSet(G["("], contains_epsilon=False), + G[")"]: ContainerSet(G[")"], contains_epsilon=False), + G["symbol"]: ContainerSet(G["symbol"], contains_epsilon=False), + G["ε"]: ContainerSet(G["ε"], contains_epsilon=False), + G["E"]: ContainerSet(G["symbol"], G["ε"], G["("], contains_epsilon=False), + G["T"]: ContainerSet(G["symbol"], G["ε"], G["("], contains_epsilon=False), + G["F"]: ContainerSet(G["symbol"], G["ε"], G["("], contains_epsilon=False), + G["A"]: ContainerSet(G["ε"], G["symbol"], G["("], contains_epsilon=False), + G["X"]: ContainerSet(G["|"], contains_epsilon=True), + G["Y"]: ContainerSet(G["symbol"], G["ε"], G["("], contains_epsilon=True), + G["Z"]: ContainerSet(G["*"], contains_epsilon=True), + Sentence(G["T"], G["X"]): ContainerSet( + G["symbol"], G["ε"], G["("], contains_epsilon=False + ), + Sentence(G["|"], G["E"]): ContainerSet(G["|"], contains_epsilon=False), + G.Epsilon: ContainerSet(contains_epsilon=True), + Sentence(G["F"], G["Y"]): ContainerSet( + G["symbol"], G["ε"], G["("], contains_epsilon=False + ), + Sentence(G["T"]): ContainerSet( + G["symbol"], G["ε"], G["("], contains_epsilon=False + ), + Sentence(G["A"], G["Z"]): ContainerSet( + G["symbol"], G["ε"], G["("], contains_epsilon=False + ), + Sentence(G["*"]): ContainerSet(G["*"], contains_epsilon=False), + Sentence(G["symbol"]): ContainerSet(G["symbol"], contains_epsilon=False), + Sentence(G["ε"]): ContainerSet(G["ε"], contains_epsilon=False), + Sentence(G["("], G["E"], G[")"]): ContainerSet( + G["("], contains_epsilon=False + ), + } + + @property + def follows(self): + G = self.G + return { + G["E"]: ContainerSet(G[")"], G.EOF, contains_epsilon=False), + G["T"]: ContainerSet(G[")"], G.EOF, G["|"], contains_epsilon=False), + G["F"]: ContainerSet( + G[")"], + G.EOF, + G["symbol"], + G["|"], + G["ε"], + G["("], + contains_epsilon=False, + ), + G["A"]: ContainerSet( + G.EOF, + G["|"], + G["*"], + G["("], + G[")"], + G["symbol"], + G["ε"], + contains_epsilon=False, + ), + G["X"]: ContainerSet(G[")"], G.EOF, contains_epsilon=False), + G["Y"]: ContainerSet(G[")"], G.EOF, G["|"], contains_epsilon=False), + G["Z"]: ContainerSet( + G.EOF, + G["|"], + G["("], + G[")"], + G["symbol"], + G["ε"], + contains_epsilon=False, + ), + } + + @property + def table(self): + G = self.G + return { + (G["E"], G["symbol"],): [ + Production(G["E"], Sentence(G["T"], G["X"])), + ], + (G["E"], G["ε"],): [ + Production(G["E"], Sentence(G["T"], G["X"])), + ], + (G["E"], G["("],): [ + Production(G["E"], Sentence(G["T"], G["X"])), + ], + (G["X"], G["|"],): [ + Production(G["X"], Sentence(G["|"], G["E"])), + ], + (G["X"], G[")"],): [ + Production(G["X"], G.Epsilon), + ], + (G["X"], G.EOF,): [ + Production(G["X"], G.Epsilon), + ], + (G["T"], G["symbol"],): [ + Production(G["T"], Sentence(G["F"], G["Y"])), + ], + (G["T"], G["ε"],): [ + Production(G["T"], Sentence(G["F"], G["Y"])), + ], + (G["T"], G["("],): [ + Production(G["T"], Sentence(G["F"], G["Y"])), + ], + (G["Y"], G["symbol"],): [ + Production(G["Y"], Sentence(G["T"])), + ], + (G["Y"], G["ε"],): [ + Production(G["Y"], Sentence(G["T"])), + ], + (G["Y"], G["("],): [ + Production(G["Y"], Sentence(G["T"])), + ], + (G["Y"], G[")"],): [ + Production(G["Y"], G.Epsilon), + ], + (G["Y"], G.EOF,): [ + Production(G["Y"], G.Epsilon), + ], + (G["Y"], G["|"],): [ + Production(G["Y"], G.Epsilon), + ], + (G["F"], G["symbol"],): [ + Production(G["F"], Sentence(G["A"], G["Z"])), + ], + (G["F"], G["ε"],): [ + Production(G["F"], Sentence(G["A"], G["Z"])), + ], + (G["F"], G["("],): [ + Production(G["F"], Sentence(G["A"], G["Z"])), + ], + (G["Z"], G["*"],): [ + Production(G["Z"], Sentence(G["*"])), + ], + (G["Z"], G.EOF,): [ + Production(G["Z"], G.Epsilon), + ], + (G["Z"], G["|"],): [ + Production(G["Z"], G.Epsilon), + ], + (G["Z"], G["("],): [ + Production(G["Z"], G.Epsilon), + ], + (G["Z"], G[")"],): [ + Production(G["Z"], G.Epsilon), + ], + (G["Z"], G["symbol"],): [ + Production(G["Z"], G.Epsilon), + ], + (G["Z"], G["ε"],): [ + Production(G["Z"], G.Epsilon), + ], + (G["A"], G["symbol"],): [ + Production(G["A"], Sentence(G["symbol"])), + ], + (G["A"], G["ε"],): [ + Production(G["A"], Sentence(G["ε"])), + ], + (G["A"], G["("],): [ + Production(G["A"], Sentence(G["("], G["E"], G[")"])), + ], + } + + @property + def parser(self): + firsts = self.firsts + follows = self.follows + M = build_parsing_table(self.G, firsts, follows) + parser = metodo_predictivo_no_recursivo(self.G, M) + return parser diff --git a/src/cool/code_generation/notebooks/cmp/nbpackage.py b/src/cool/code_generation/notebooks/cmp/nbpackage.py new file mode 100644 index 000000000..e95c88ff8 --- /dev/null +++ b/src/cool/code_generation/notebooks/cmp/nbpackage.py @@ -0,0 +1,94 @@ +import io, os, sys, types + +from IPython import get_ipython +from nbformat import read +from IPython.core.interactiveshell import InteractiveShell + + +def find_notebook(fullname, path=None): + """find a notebook, given its fully qualified name and an optional path + + This turns "foo.bar" into "foo/bar.ipynb" + and tries turning "Foo_Bar" into "Foo Bar" if Foo_Bar + does not exist. + """ + name = fullname.rsplit(".", 1)[-1] + if not path: + path = [""] + for d in path: + nb_path = os.path.join(d, name + ".ipynb") + if os.path.isfile(nb_path): + return nb_path + # let import Notebook_Name find "Notebook Name.ipynb" + nb_path = nb_path.replace("_", " ") + if os.path.isfile(nb_path): + return nb_path + + +class NotebookLoader(object): + """Module Loader for Jupyter Notebooks""" + + def __init__(self, path=None): + self.shell = InteractiveShell.instance() + self.path = path + + def load_module(self, fullname): + """import a notebook as a module""" + path = find_notebook(fullname, self.path) + + print("importing Jupyter notebook from %s" % path) + + # load the notebook object + with io.open(path, "r", encoding="utf-8") as f: + nb = read(f, 4) + + # create the module and add it to sys.modules + # if name in sys.modules: + # return sys.modules[name] + mod = types.ModuleType(fullname) + mod.__file__ = path + mod.__loader__ = self + mod.__dict__["get_ipython"] = get_ipython + sys.modules[fullname] = mod + + # extra work to ensure that magics that would affect the user_ns + # actually affect the notebook module's ns + save_user_ns = self.shell.user_ns + self.shell.user_ns = mod.__dict__ + + try: + for cell in nb.cells: + if cell.cell_type == "code": + # transform the input to executable Python + code = self.shell.input_transformer_manager.transform_cell( + cell.source + ) + # run the code in themodule + exec(code, mod.__dict__) + finally: + self.shell.user_ns = save_user_ns + return mod + + +class NotebookFinder(object): + """Module finder that locates Jupyter Notebooks""" + + def __init__(self): + self.loaders = {} + + def find_module(self, fullname, path=None): + nb_path = find_notebook(fullname, path) + if not nb_path: + return + + key = path + if path: + # lists aren't hashable + key = os.path.sep.join(path) + + if key not in self.loaders: + self.loaders[key] = NotebookLoader(path) + return self.loaders[key] + + +sys.meta_path.append(NotebookFinder()) diff --git a/src/cool/code_generation/notebooks/cmp/pycompiler.py b/src/cool/code_generation/notebooks/cmp/pycompiler.py new file mode 100644 index 000000000..9d1100913 --- /dev/null +++ b/src/cool/code_generation/notebooks/cmp/pycompiler.py @@ -0,0 +1,513 @@ +import json + + +class Symbol(object): + def __init__(self, name, grammar): + self.Name = name + self.Grammar = grammar + + def __str__(self): + return self.Name + + def __repr__(self): + return repr(self.Name) + + def __add__(self, other): + if isinstance(other, Symbol): + return Sentence(self, other) + + raise TypeError(other) + + def __or__(self, other): + + if isinstance(other, (Sentence)): + return SentenceList(Sentence(self), other) + + raise TypeError(other) + + @property + def IsEpsilon(self): + return False + + def __len__(self): + return 1 + + +class NonTerminal(Symbol): + def __init__(self, name, grammar): + super().__init__(name, grammar) + self.productions = [] + + def __imod__(self, other): + + if isinstance(other, (Sentence)): + p = Production(self, other) + self.Grammar.Add_Production(p) + return self + + if isinstance(other, tuple): + assert len(other) > 1 + + if len(other) == 2: + other += (None,) * len(other[0]) + + assert ( + len(other) == len(other[0]) + 2 + ), "Debe definirse una, y solo una, regla por cada símbolo de la producción" + # assert len(other) == 2, "Tiene que ser una Tupla de 2 elementos (sentence, attribute)" + + if isinstance(other[0], Symbol) or isinstance(other[0], Sentence): + p = AttributeProduction(self, other[0], other[1:]) + else: + raise Exception("") + + self.Grammar.Add_Production(p) + return self + + if isinstance(other, Symbol): + p = Production(self, Sentence(other)) + self.Grammar.Add_Production(p) + return self + + if isinstance(other, SentenceList): + + for s in other: + p = Production(self, s) + self.Grammar.Add_Production(p) + + return self + + raise TypeError(other) + + @property + def IsTerminal(self): + return False + + @property + def IsNonTerminal(self): + return True + + @property + def IsEpsilon(self): + return False + + +class Terminal(Symbol): + def __init__(self, name, grammar): + super().__init__(name, grammar) + + @property + def IsTerminal(self): + return True + + @property + def IsNonTerminal(self): + return False + + @property + def IsEpsilon(self): + return False + + +class EOF(Terminal): + def __init__(self, Grammar): + super().__init__("$", Grammar) + + +class Sentence(object): + def __init__(self, *args): + self._symbols = tuple(x for x in args if not x.IsEpsilon) + self.hash = hash(self._symbols) + + def __len__(self): + return len(self._symbols) + + def __add__(self, other): + if isinstance(other, Symbol): + return Sentence(*(self._symbols + (other,))) + + if isinstance(other, Sentence): + return Sentence(*(self._symbols + other._symbols)) + + raise TypeError(other) + + def __or__(self, other): + if isinstance(other, Sentence): + return SentenceList(self, other) + + if isinstance(other, Symbol): + return SentenceList(self, Sentence(other)) + + raise TypeError(other) + + def __repr__(self): + return str(self) + + def __str__(self): + return ("%s " * len(self._symbols) % tuple(self._symbols)).strip() + + def __iter__(self): + return iter(self._symbols) + + def __getitem__(self, index): + return self._symbols[index] + + def __eq__(self, other): + return self._symbols == other._symbols + + def __hash__(self): + return self.hash + + @property + def IsEpsilon(self): + return False + + +class SentenceList(object): + def __init__(self, *args): + self._sentences = list(args) + + def Add(self, symbol): + if not symbol and (symbol is None or not symbol.IsEpsilon): + raise ValueError(symbol) + + self._sentences.append(symbol) + + def __iter__(self): + return iter(self._sentences) + + def __or__(self, other): + if isinstance(other, Sentence): + self.Add(other) + return self + + if isinstance(other, Symbol): + return self | Sentence(other) + + +class Epsilon(Terminal, Sentence): + def __init__(self, grammar): + super().__init__("epsilon", grammar) + + def __str__(self): + return "e" + + def __repr__(self): + return "epsilon" + + def __iter__(self): + yield from () + + def __len__(self): + return 0 + + def __add__(self, other): + return other + + def __eq__(self, other): + return isinstance(other, (Epsilon,)) + + def __hash__(self): + return hash("") + + @property + def IsEpsilon(self): + return True + + +class Production(object): + def __init__(self, nonTerminal, sentence): + + self.Left = nonTerminal + self.Right = sentence + + def __str__(self): + + return "%s := %s" % (self.Left, self.Right) + + def __repr__(self): + return "%s -> %s" % (self.Left, self.Right) + + def __iter__(self): + yield self.Left + yield self.Right + + def __eq__(self, other): + return ( + isinstance(other, Production) + and self.Left == other.Left + and self.Right == other.Right + ) + + def __hash__(self): + return hash((self.Left, self.Right)) + + @property + def IsEpsilon(self): + return self.Right.IsEpsilon + + +class AttributeProduction(Production): + def __init__(self, nonTerminal, sentence, attributes): + if not isinstance(sentence, Sentence) and isinstance(sentence, Symbol): + sentence = Sentence(sentence) + super(AttributeProduction, self).__init__(nonTerminal, sentence) + + self.attributes = attributes + + def __str__(self): + return "%s := %s" % (self.Left, self.Right) + + def __repr__(self): + return "%s -> %s" % (self.Left, self.Right) + + def __iter__(self): + yield self.Left + yield self.Right + + @property + def IsEpsilon(self): + return self.Right.IsEpsilon + + # sintetizar en ingles??????, pending aggrement + def syntetice(self): + pass + + +class Grammar: + def __init__(self): + + self.Productions = [] + self.nonTerminals = [] + self.terminals = [] + self.startSymbol = None + # production type + self.pType = None + self.Epsilon = Epsilon(self) + self.EOF = EOF(self) + + self.symbDict = {"$": self.EOF} + + def NonTerminal(self, name, startSymbol=False): + + name = name.strip() + if not name: + raise Exception("Empty name") + + term = NonTerminal(name, self) + + if startSymbol: + + if self.startSymbol is None: + self.startSymbol = term + else: + raise Exception("Cannot define more than one start symbol.") + + self.nonTerminals.append(term) + self.symbDict[name] = term + return term + + def NonTerminals(self, names): + + ans = tuple((self.NonTerminal(x) for x in names.strip().split())) + + return ans + + def Add_Production(self, production): + + if len(self.Productions) == 0: + self.pType = type(production) + + assert type(production) == self.pType, "The Productions most be of only 1 type." + + production.Left.productions.append(production) + self.Productions.append(production) + + def Terminal(self, name): + + name = name.strip() + if not name: + raise Exception("Empty name") + + term = Terminal(name, self) + self.terminals.append(term) + self.symbDict[name] = term + return term + + def Terminals(self, names): + + ans = tuple((self.Terminal(x) for x in names.strip().split())) + + return ans + + def __str__(self): + + mul = "%s, " + + ans = "Non-Terminals:\n\t" + + nonterminals = mul * (len(self.nonTerminals) - 1) + "%s\n" + + ans += nonterminals % tuple(self.nonTerminals) + + ans += "Terminals:\n\t" + + terminals = mul * (len(self.terminals) - 1) + "%s\n" + + ans += terminals % tuple(self.terminals) + + ans += "Productions:\n\t" + + ans += str(self.Productions) + + return ans + + def __getitem__(self, name): + try: + return self.symbDict[name] + except KeyError: + return None + + @property + def to_json(self): + + productions = [] + + for p in self.Productions: + head = p.Left.Name + + body = [] + + for s in p.Right: + body.append(s.Name) + + productions.append({"Head": head, "Body": body}) + + d = { + "NonTerminals": [symb.Name for symb in self.nonTerminals], + "Terminals": [symb.Name for symb in self.terminals], + "Productions": productions, + } + + # [{'Head':p.Left.Name, "Body": [s.Name for s in p.Right]} for p in self.Productions] + return json.dumps(d) + + @staticmethod + def from_json(data): + data = json.loads(data) + + G = Grammar() + dic = {"epsilon": G.Epsilon} + + for term in data["Terminals"]: + dic[term] = G.Terminal(term) + + for noTerm in data["NonTerminals"]: + dic[noTerm] = G.NonTerminal(noTerm) + + for p in data["Productions"]: + head = p["Head"] + dic[head] %= Sentence(*[dic[term] for term in p["Body"]]) + + return G + + def copy(self): + G = Grammar() + G.Productions = self.Productions.copy() + G.nonTerminals = self.nonTerminals.copy() + G.terminals = self.terminals.copy() + G.pType = self.pType + G.startSymbol = self.startSymbol + G.Epsilon = self.Epsilon + G.EOF = self.EOF + G.symbDict = self.symbDict.copy() + + return G + + @property + def IsAugmentedGrammar(self): + augmented = 0 + for left, right in self.Productions: + if self.startSymbol == left: + augmented += 1 + if augmented <= 1: + return True + else: + return False + + def AugmentedGrammar(self, force=False): + if not self.IsAugmentedGrammar or force: + + G = self.copy() + # S, self.startSymbol, SS = self.startSymbol, None, self.NonTerminal('S\'', True) + S = G.startSymbol + G.startSymbol = None + SS = G.NonTerminal("S'", True) + if G.pType is AttributeProduction: + SS %= S + G.Epsilon, lambda x: x + else: + SS %= S + G.Epsilon + + return G + else: + return self.copy() + + # endchange + + +class Item: + def __init__(self, production, pos, lookaheads=[]): + self.production = production + self.pos = pos + self.lookaheads = frozenset(look for look in lookaheads) + + def __str__(self): + s = str(self.production.Left) + " -> " + if len(self.production.Right) > 0: + for i, c in enumerate(self.production.Right): + if i == self.pos: + s += "." + s += str(self.production.Right[i]) + if self.pos == len(self.production.Right): + s += "." + else: + s += "." + s += ", " + str(self.lookaheads)[10:-1] + return s + + def __repr__(self): + return str(self) + + def __eq__(self, other): + return ( + (self.pos == other.pos) + and (self.production == other.production) + and (set(self.lookaheads) == set(other.lookaheads)) + ) + + def __hash__(self): + return hash((self.production, self.pos, self.lookaheads)) + + @property + def IsReduceItem(self): + return len(self.production.Right) == self.pos + + @property + def NextSymbol(self): + if self.pos < len(self.production.Right): + return self.production.Right[self.pos] + else: + return None + + def NextItem(self): + if self.pos < len(self.production.Right): + return Item(self.production, self.pos + 1, self.lookaheads) + else: + return None + + def Preview(self, skip=1): + unseen = self.production.Right[self.pos + skip :] + return [unseen + (lookahead,) for lookahead in self.lookaheads] + + def Center(self): + return Item(self.production, self.pos) diff --git a/src/cool/code_generation/notebooks/cmp/semantic.py b/src/cool/code_generation/notebooks/cmp/semantic.py new file mode 100644 index 000000000..a94be4146 --- /dev/null +++ b/src/cool/code_generation/notebooks/cmp/semantic.py @@ -0,0 +1,250 @@ +import itertools as itt +from collections import OrderedDict + + +class SemanticError(Exception): + @property + def text(self): + return self.args[0] + + +class Attribute: + def __init__(self, name, typex): + self.name = name + self.type = typex + + def __str__(self): + return f"[attrib] {self.name} : {self.type.name};" + + def __repr__(self): + return str(self) + + +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 Type: + def __init__(self, name: str): + self.name = name + self.attributes = [] + self.methods = [] + self.parent = None + + def set_parent(self, parent): + if self.parent is not None: + raise SemanticError(f"Parent type is already set for {self.name}.") + self.parent = parent + + def get_attribute(self, name: str): + try: + return next(attr for attr in self.attributes if attr.name == name) + except StopIteration: + if self.parent is None: + raise SemanticError( + f'Attribute "{name}" is not defined in {self.name}.' + ) + try: + return self.parent.get_attribute(name) + except SemanticError: + raise SemanticError( + f'Attribute "{name}" is not defined in {self.name}.' + ) + + def define_attribute(self, name: str, typex): + try: + self.get_attribute(name) + except SemanticError: + attribute = Attribute(name, typex) + self.attributes.append(attribute) + return attribute + else: + raise SemanticError( + f'Attribute "{name}" is already defined in {self.name}.' + ) + + def get_method(self, name: str): + try: + return next(method for method in self.methods if method.name == name) + except StopIteration: + if self.parent is None: + raise SemanticError(f'Method "{name}" is not defined in {self.name}.') + try: + return self.parent.get_method(name) + except SemanticError: + raise SemanticError(f'Method "{name}" is not defined in {self.name}.') + + def define_method( + self, name: str, param_names: list, param_types: list, return_type + ): + if name in (method.name for method in self.methods): + raise SemanticError(f'Method "{name}" already defined in {self.name}') + + method = Method(name, param_names, param_types, return_type) + self.methods.append(method) + return method + + def all_attributes(self, clean=True): + plain = ( + OrderedDict() if self.parent is None else self.parent.all_attributes(False) + ) + for attr in self.attributes: + 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: + 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) + output += "\n\t" if self.attributes else "" + output += "\n\t".join(str(x) for x in self.methods) + output += "\n" if self.methods else "" + output += "}\n" + return output + + def __repr__(self): + return str(self) + + +class ErrorType(Type): + def __init__(self): + Type.__init__(self, "") + + def conforms_to(self, other): + return True + + def bypass(self): + return True + + def __eq__(self, other): + return isinstance(other, Type) + + +class VoidType(Type): + def __init__(self): + Type.__init__(self, "") + + def conforms_to(self, other): + raise Exception("Invalid type: void type.") + + def bypass(self): + return True + + def __eq__(self, other): + return isinstance(other, VoidType) + + +class IntType(Type): + def __init__(self): + Type.__init__(self, "int") + + def __eq__(self, other): + return other.name == self.name or isinstance(other, IntType) + + +class Context: + def __init__(self): + self.types = {} + + def create_type(self, name: str): + if name in self.types: + raise SemanticError(f"Type with the same name ({name}) already in context.") + typex = self.types[name] = Type(name) + return typex + + def get_type(self, name: str): + try: + return self.types[name] + except KeyError: + raise SemanticError(f'Type "{name}" is not defined.') + + 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): + self.name = name + self.type = vtype + + +class Scope: + def __init__(self, parent=None): + self.locals = [] + self.parent = parent + self.children = [] + self.index = 0 if parent is None else len(parent) + + def __len__(self): + return len(self.locals) + + def create_child(self): + child = Scope(self) + self.children.append(child) + return child + + def define_variable(self, vname, vtype): + info = VariableInfo(vname, vtype) + self.locals.append(info) + return info + + def find_variable(self, vname, index=None): + locals = self.locals if index is None else itt.islice(self.locals, index) + try: + return next(x for x in locals if x.name == vname) + except StopIteration: + return ( + self.parent.find_variable(vname, self.index) + if self.parent is not None + else None + ) + + def is_defined(self, vname): + return self.find_variable(vname) is not None + + def is_local(self, vname): + return any(True for x in self.locals if x.name == vname) diff --git a/src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/__init__-checkpoint.py b/src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/__init__-checkpoint.py new file mode 100644 index 000000000..e69de29bb diff --git a/src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/automata-checkpoint.py b/src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/automata-checkpoint.py new file mode 100644 index 000000000..8c48eaccd --- /dev/null +++ b/src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/automata-checkpoint.py @@ -0,0 +1,10 @@ +import zlib, base64 + +exec( + zlib.decompress( + base64.b64decode( + "eJzNWN1um0gUvucp6BWwRSjx1SrSrBRt4iR20rRJW9VCCI1hbE+LgTBDGjvKY+1r7DPtmR9gjIm3q+5KexPDzPn9zjdnDuGIEW4xVOF8SawHtMIMc15ZZ2hKNudVVVTWNcJZZm0QZTRnHOcJsQiiObeWKCO5tUIfNyVRojka44wRa4o+VjWxPiOcbyyMtrS0OEckr9ekwhz2tUBZIl6XGbFYEwGvNieWTddlUXG73KQFt8hTQkpuX8k16QckSsyYtaiKtZ2sy6DmNGON1u9FzjHNSXUPmSUZCNrvxqegk5KFHcc0pzyOXUayhQ/pcML8Bc0hbJ9DCIxyWuRM7FQcHXmgZgvRQIki9WMsgpT82ywpW4i76sFr1tcYcu0cNMuPRYLndYarDai0woYget6ePL8sisre2jS3masi8F5AFlbdU3/u+bdiy1AKKCdr5srobQCAACwP7q3vQPqcVHHseL5zlT/ijKZ2UmQZSYSeXSxsZd4Riv1QwtMonEfott3rgg9wmrpzbz+rIKUswVXqOo6nKkBKRrMijw3DRjFkyDpiuSCT7gXSxS5FRLCKN7ZdEV5X+xqhFIxCx4lASjPqzNBwdXTLCpcrGY+M5AJJDgZnBXfB2reUVsi5vnP8Na6WNEdHwbFI+kLkH+dFSlwl/048OpIYjs9WuCTIKTNgJSdPsJLhOcmQ4/jfacpX6MhfEbpcCb55uqyZT3VZG/bs1JQi588/HJsu4Ans2AROnU3FznAoWRNEQqskIxAT32TwOi+yVJrJWleKt8oiFE0EJCKyx0LiVnp/xcn475yMDzrRVkm6bKyei8fMH2u8qPoFRskuhEZeh31fq8W+PaYd6DqsFLMVSZVzTZsL3SQqUlYxe1zGHROGCKbI4gVJRYBdQgFeUpLI4td88avgvGabVJZdS7Wks/GpC23J+4m+pI/Jtbtx4TTUxCeeKJR87jcEuQjs8Uy9JRzZ345kdaGN9FQ8mbTRh76RzUko7URCA179QVeap6JBQYLBP8qs7SBJXVUkb3urhGhdPBJtZbMGUkkQgFbqzc4LPtQsQtNeZNYw33N2UDVUfqLwKOoYM20ZA/dox5Z9s0YiFTBkmdNtkwyvaL7s1LQt3QnsRCYlZdTRX8hMlaiEJFE9wUzLZKkOo3f2LBGJVMc1L9aYF3lTnA7dG3UpdbePFBDeUtSq7SC2jYyzcovSBrR+171FMsGboC5TsOnewpsO+sYyr4kkK1hd7UcpwpuhkMngWBcceHpCz3vLwMbvK5oReybcb9EsKItShjBwHxm5Dd1W26Y0F8L+gERTp4uGk0+qQE/ymrxQ3W4W4LIkuXrXqZuji/vLkyeRyBc45kWcLnAHgsg+Qc+QVYZeRyrs8pD0i8BTFtAUHclfFksqoM+uBKoT1t25hTADvQkKRRVn6ucVLIXGfNdWNwpIDG5Qj3NbX44N9uWBPG48g/iXCssEoKI5zJBq57KBeqK2L0WaS3fiNW8/nOylUpk05bnslUu9i5tLeSrQJKB5Sp4ayUs0CQtB+PYc2Em4hXj8uVxt+m/ejTFwGbx580YOXTunpFNEIiHLvkdyoTuRE5H8tk0PHLxH4moRqfv3ftJx670kk84bx3UOTHXxsY9HJpmAGekxOoa/I4SP9dT7NoWFGuFR+z6yesMnyPZmlCQ8BT0R+vMYHowZ4mVPeTSoPGqUR7vKSZj5MMihUAVYceFHBSeeR5HqWOmTfy+tuyHsw7IvFPTNA+LqKZL+WjzvT3YK9wVBBd6CJTU49qpj7urx3f4iz3gtT0wHYAfdSBTxuX5p6wJ3pDsRpfIzb7dEQPEEdHLMD5Tq6H9dqhbXFnlzltL4HfsDY7m5p7FV0BqFNq+mtqADDkYHHIz2HPw7tWua2PHg6ap7FfupCg2ehzr6T9CvjUJ03nqIHcZp+Kv9jLKvBXwfiY92gaSY8mHkqSlbxcqse+d3V8JUwPJJwnqOytIdunA0PWqBwJ1Ia/bK0FKr8VigcI1cdxYyMeSJyVKoztRnyrsiV/O1XDwXOEyEZ3caplEgvhhgbIPrm9NHIppyKsSmgfhIYj0LcuvaM2rxKZxEzQWjo/H6NREyyIhVYRveySTvhMlP7ZgfSQwlbvEa5u813eouYk4QU2Sg7v7CmLszMIgpC6KYBmtSwSeVcUf2b89hqSF7ElR9VQ9YUXPFdCo5/0PRddlP4XusqEs1fYnVlVj9ER6Ji1aHv/LUN8USpmoEA4Ten8MX3jd4mKLE6kb/nRN/COaDhbDsq505dtojE5Nj17PuptRv/y3CuXslw3tUDlT1NSRj/3oXY5Pwj9HOfxPmaBpeA+P7NBZ7X9GVHm/UnNZejbOQ+uPdgWb/hlRC6Ktlf0AhHUyAap4G7cdknxfg5KGNYro31PaC7iYeNQddef4Hf+Y/eNZffhu9yA==" + ) + ) +) +# Created by pyminifier (https://github.com/liftoff/pyminifier) diff --git a/src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/evaluation-checkpoint.py b/src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/evaluation-checkpoint.py new file mode 100644 index 000000000..c1735b595 --- /dev/null +++ b/src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/evaluation-checkpoint.py @@ -0,0 +1,10 @@ +import zlib, base64 + +exec( + zlib.decompress( + base64.b64decode( + "eJxdUMFuwjAMvecrfGy3qoLrJN86YGViCO2GECrF1SLSpErcqf37OUWwsZPtZ/v5+TXetVC3Xd6NtWs7bciDbjvnGV4/FmqJmsmrE1oaWFnUQdvAla1JFbhxltQaDVm1QLJ9S75iUmdqgL4r00tx7CofKGmyMn1RoBuwjqEB56ekFAw8ce+tggaXSZMqKCWWEge8kSQnaWSRQ0EVAok2K1iZ5uwuZI88dpSJWmlfyWB4EJF03p37mrWzkSXT9ou8/HU+xgHCImrbZAZ/5xSMf6q8Yvb61DMFBYz74vCUrBOTPs/l5OV/vZ8d8N8J+U5e1tkOtIVFYrJ5PBn92OVv4ZN8q21lInR78LLXBx2giBBLjtO/hgYByASaZld4miy7b+0QV/k7NRyxLY6yGDO5swVhi54X0+bEj9vkknF6P3H3azXZFEekGWlmh7u1150HxkmQSP0BhJm25Q==" + ) + ) +) +# Created by pyminifier (https://github.com/liftoff/pyminifier) diff --git a/src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/parsing-checkpoint.py b/src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/parsing-checkpoint.py new file mode 100644 index 000000000..af4ca2a41 --- /dev/null +++ b/src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/parsing-checkpoint.py @@ -0,0 +1,21 @@ +import zlib, base64 + +exec( + zlib.decompress( + base64.b64decode( + "eJytVVtr2zAUfvevEH2yqWfa14AeypKGlXlNL5SCMUZO5FTMlhRZbpZu++87ujiOm3QwGJRU56pzvu8cuVKiQUxTpYWoW8QaKZRGrK3ZkgaVMS4bmXSaDcbPgmvCOFUPVAcrWqGlaGSnaVGLJamLiqlWh/a3jUktX0g0CVCFnSZAEltlgKb4MFMYBUirHbiiBZbJl3YmW1YLHiD6Y0mldoZrUrc0QKxCC6OYJi3VBXWeJgMFszFUQqE5YhxJI6EUV9k8N6dp0skV0TRMIyNCIi40SpOlK6Xtk9kwVCpKvsOpT3t8oaK6UxxNR0C4VsO5a/zn7wDN8KPqoHBTV2nqmieAecM49GPrzcp8DEcZOW/tvLngj+MAnR/ht31hNUUzY5/1UNkkty7JQolVt9RMcJsDPePb5CuttDlLON+z9YsVrgCvZ4uXpwQ6B5W0qoGPXntUCEI3+ORUxNJaZ7/wNHkhalV4Nm569dWR2iNcjREWdS22AHHssB6P2GaEObXSX7DcnMJyk82TVhOlH3ZNKep3DvNkdnv9PxG/xxuPuIlmcbszCSjvGqoMEjJygMPAtjvYjm9DD86A7iBDu8udsKcN8pWYZjJm3nLI3oHxA7rcQxCCx/llDHfSKHKRQNVdv0pV6ZVQXFV+sErjkPuB2I0ltuxYvSokUS3j60KTsqZ7cmPP9pjkCo5OH8B+9xSTk7g/Y9LDvoBjj7oJoCagyhb5ZDTuafYc0zwhUlK+Ckn0fvCdHWfEwGr6hgynOx8uMTvlogd6Tt0z5ujwJg9ZaiFrqBYrUUhFVwxafRUFF4Wiyw4wfBWAXooNYx5Ef3aIWcHCyQY8xYAnNJTCRwAZt4lvkB0qTODRa+cdxdhR4FNLa5xT/BHrUCc42CbDrZ38J5zZnYvHWwmWpsEX8O8NZ0ZyC2kW396+xk+JFNK9SQRvs6bJ/bu/hi0ar5BRYkwm+2EGyV7aT3D/OUAHXwRkKjjHl8E7rVSM6/BsppRQCboq4csJPSZJcuaXxXNpgApGocNwLHCarWOSZxd+ee3bYGZJEb6mYU15uHDTHH26jO1f1Ff11A+V98hY7m9+21tOjNs/1u2lt/1sNsEfuhaMXQ==" + ) + ) +) +# Created by pyminifier (https://github.com/liftoff/pyminifier) + +deprecated_metodo_predictivo_no_recursivo = metodo_predictivo_no_recursivo + + +def metodo_predictivo_no_recursivo(G, M=None, firsts=None, follows=None): + parser = deprecated_metodo_predictivo_no_recursivo(G, M, firsts, follows) + + def updated(tokens): + return parser([t.token_type for t in tokens]) + + return updated diff --git a/src/cool/code_generation/notebooks/cmp/tools/__init__.py b/src/cool/code_generation/notebooks/cmp/tools/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/src/cool/code_generation/notebooks/cmp/tools/automata.py b/src/cool/code_generation/notebooks/cmp/tools/automata.py new file mode 100644 index 000000000..8c48eaccd --- /dev/null +++ b/src/cool/code_generation/notebooks/cmp/tools/automata.py @@ -0,0 +1,10 @@ +import zlib, base64 + +exec( + zlib.decompress( + base64.b64decode( + "eJzNWN1um0gUvucp6BWwRSjx1SrSrBRt4iR20rRJW9VCCI1hbE+LgTBDGjvKY+1r7DPtmR9gjIm3q+5KexPDzPn9zjdnDuGIEW4xVOF8SawHtMIMc15ZZ2hKNudVVVTWNcJZZm0QZTRnHOcJsQiiObeWKCO5tUIfNyVRojka44wRa4o+VjWxPiOcbyyMtrS0OEckr9ekwhz2tUBZIl6XGbFYEwGvNieWTddlUXG73KQFt8hTQkpuX8k16QckSsyYtaiKtZ2sy6DmNGON1u9FzjHNSXUPmSUZCNrvxqegk5KFHcc0pzyOXUayhQ/pcML8Bc0hbJ9DCIxyWuRM7FQcHXmgZgvRQIki9WMsgpT82ywpW4i76sFr1tcYcu0cNMuPRYLndYarDai0woYget6ePL8sisre2jS3masi8F5AFlbdU3/u+bdiy1AKKCdr5srobQCAACwP7q3vQPqcVHHseL5zlT/ijKZ2UmQZSYSeXSxsZd4Riv1QwtMonEfott3rgg9wmrpzbz+rIKUswVXqOo6nKkBKRrMijw3DRjFkyDpiuSCT7gXSxS5FRLCKN7ZdEV5X+xqhFIxCx4lASjPqzNBwdXTLCpcrGY+M5AJJDgZnBXfB2reUVsi5vnP8Na6WNEdHwbFI+kLkH+dFSlwl/048OpIYjs9WuCTIKTNgJSdPsJLhOcmQ4/jfacpX6MhfEbpcCb55uqyZT3VZG/bs1JQi588/HJsu4Ans2AROnU3FznAoWRNEQqskIxAT32TwOi+yVJrJWleKt8oiFE0EJCKyx0LiVnp/xcn475yMDzrRVkm6bKyei8fMH2u8qPoFRskuhEZeh31fq8W+PaYd6DqsFLMVSZVzTZsL3SQqUlYxe1zGHROGCKbI4gVJRYBdQgFeUpLI4td88avgvGabVJZdS7Wks/GpC23J+4m+pI/Jtbtx4TTUxCeeKJR87jcEuQjs8Uy9JRzZ345kdaGN9FQ8mbTRh76RzUko7URCA179QVeap6JBQYLBP8qs7SBJXVUkb3urhGhdPBJtZbMGUkkQgFbqzc4LPtQsQtNeZNYw33N2UDVUfqLwKOoYM20ZA/dox5Z9s0YiFTBkmdNtkwyvaL7s1LQt3QnsRCYlZdTRX8hMlaiEJFE9wUzLZKkOo3f2LBGJVMc1L9aYF3lTnA7dG3UpdbePFBDeUtSq7SC2jYyzcovSBrR+171FMsGboC5TsOnewpsO+sYyr4kkK1hd7UcpwpuhkMngWBcceHpCz3vLwMbvK5oReybcb9EsKItShjBwHxm5Dd1W26Y0F8L+gERTp4uGk0+qQE/ymrxQ3W4W4LIkuXrXqZuji/vLkyeRyBc45kWcLnAHgsg+Qc+QVYZeRyrs8pD0i8BTFtAUHclfFksqoM+uBKoT1t25hTADvQkKRRVn6ucVLIXGfNdWNwpIDG5Qj3NbX44N9uWBPG48g/iXCssEoKI5zJBq57KBeqK2L0WaS3fiNW8/nOylUpk05bnslUu9i5tLeSrQJKB5Sp4ayUs0CQtB+PYc2Em4hXj8uVxt+m/ejTFwGbx580YOXTunpFNEIiHLvkdyoTuRE5H8tk0PHLxH4moRqfv3ftJx670kk84bx3UOTHXxsY9HJpmAGekxOoa/I4SP9dT7NoWFGuFR+z6yesMnyPZmlCQ8BT0R+vMYHowZ4mVPeTSoPGqUR7vKSZj5MMihUAVYceFHBSeeR5HqWOmTfy+tuyHsw7IvFPTNA+LqKZL+WjzvT3YK9wVBBd6CJTU49qpj7urx3f4iz3gtT0wHYAfdSBTxuX5p6wJ3pDsRpfIzb7dEQPEEdHLMD5Tq6H9dqhbXFnlzltL4HfsDY7m5p7FV0BqFNq+mtqADDkYHHIz2HPw7tWua2PHg6ap7FfupCg2ehzr6T9CvjUJ03nqIHcZp+Kv9jLKvBXwfiY92gaSY8mHkqSlbxcqse+d3V8JUwPJJwnqOytIdunA0PWqBwJ1Ia/bK0FKr8VigcI1cdxYyMeSJyVKoztRnyrsiV/O1XDwXOEyEZ3caplEgvhhgbIPrm9NHIppyKsSmgfhIYj0LcuvaM2rxKZxEzQWjo/H6NREyyIhVYRveySTvhMlP7ZgfSQwlbvEa5u813eouYk4QU2Sg7v7CmLszMIgpC6KYBmtSwSeVcUf2b89hqSF7ElR9VQ9YUXPFdCo5/0PRddlP4XusqEs1fYnVlVj9ER6Ji1aHv/LUN8USpmoEA4Ten8MX3jd4mKLE6kb/nRN/COaDhbDsq505dtojE5Nj17PuptRv/y3CuXslw3tUDlT1NSRj/3oXY5Pwj9HOfxPmaBpeA+P7NBZ7X9GVHm/UnNZejbOQ+uPdgWb/hlRC6Ktlf0AhHUyAap4G7cdknxfg5KGNYro31PaC7iYeNQddef4Hf+Y/eNZffhu9yA==" + ) + ) +) +# Created by pyminifier (https://github.com/liftoff/pyminifier) diff --git a/src/cool/code_generation/notebooks/cmp/tools/evaluation.py b/src/cool/code_generation/notebooks/cmp/tools/evaluation.py new file mode 100644 index 000000000..c1735b595 --- /dev/null +++ b/src/cool/code_generation/notebooks/cmp/tools/evaluation.py @@ -0,0 +1,10 @@ +import zlib, base64 + +exec( + zlib.decompress( + base64.b64decode( + "eJxdUMFuwjAMvecrfGy3qoLrJN86YGViCO2GECrF1SLSpErcqf37OUWwsZPtZ/v5+TXetVC3Xd6NtWs7bciDbjvnGV4/FmqJmsmrE1oaWFnUQdvAla1JFbhxltQaDVm1QLJ9S75iUmdqgL4r00tx7CofKGmyMn1RoBuwjqEB56ekFAw8ce+tggaXSZMqKCWWEge8kSQnaWSRQ0EVAok2K1iZ5uwuZI88dpSJWmlfyWB4EJF03p37mrWzkSXT9ou8/HU+xgHCImrbZAZ/5xSMf6q8Yvb61DMFBYz74vCUrBOTPs/l5OV/vZ8d8N8J+U5e1tkOtIVFYrJ5PBn92OVv4ZN8q21lInR78LLXBx2giBBLjtO/hgYByASaZld4miy7b+0QV/k7NRyxLY6yGDO5swVhi54X0+bEj9vkknF6P3H3azXZFEekGWlmh7u1150HxkmQSP0BhJm25Q==" + ) + ) +) +# Created by pyminifier (https://github.com/liftoff/pyminifier) diff --git a/src/cool/code_generation/notebooks/cmp/tools/parsing.py b/src/cool/code_generation/notebooks/cmp/tools/parsing.py new file mode 100644 index 000000000..0b54d9177 --- /dev/null +++ b/src/cool/code_generation/notebooks/cmp/tools/parsing.py @@ -0,0 +1,40 @@ +import zlib, base64 + +exec( + zlib.decompress( + base64.b64decode( + "eJytVVtr2zAUfvevEH2yqWfa14AeypKGlXlNL5SCMUZO5FTMlhRZbpZu++87ujiOm3QwGJRU56pzvu8cuVKiQUxTpYWoW8QaKZRGrK3ZkgaVMS4bmXSaDcbPgmvCOFUPVAcrWqGlaGSnaVGLJamLiqlWh/a3jUktX0g0CVCFnSZAEltlgKb4MFMYBUirHbiiBZbJl3YmW1YLHiD6Y0mldoZrUrc0QKxCC6OYJi3VBXWeJgMFszFUQqE5YhxJI6EUV9k8N6dp0skV0TRMIyNCIi40SpOlK6Xtk9kwVCpKvsOpT3t8oaK6UxxNR0C4VsO5a/zn7wDN8KPqoHBTV2nqmieAecM49GPrzcp8DEcZOW/tvLngj+MAnR/ht31hNUUzY5/1UNkkty7JQolVt9RMcJsDPePb5CuttDlLON+z9YsVrgCvZ4uXpwQ6B5W0qoGPXntUCEI3+ORUxNJaZ7/wNHkhalV4Nm569dWR2iNcjREWdS22AHHssB6P2GaEObXSX7DcnMJyk82TVhOlH3ZNKep3DvNkdnv9PxG/xxuPuIlmcbszCSjvGqoMEjJygMPAtjvYjm9DD86A7iBDu8udsKcN8pWYZjJm3nLI3oHxA7rcQxCCx/llDHfSKHKRQNVdv0pV6ZVQXFV+sErjkPuB2I0ltuxYvSokUS3j60KTsqZ7cmPP9pjkCo5OH8B+9xSTk7g/Y9LDvoBjj7oJoCagyhb5ZDTuafYc0zwhUlK+Ckn0fvCdHWfEwGr6hgynOx8uMTvlogd6Tt0z5ujwJg9ZaiFrqBYrUUhFVwxafRUFF4Wiyw4wfBWAXooNYx5Ef3aIWcHCyQY8xYAnNJTCRwAZt4lvkB0qTODRa+cdxdhR4FNLa5xT/BHrUCc42CbDrZ38J5zZnYvHWwmWpsEX8O8NZ0ZyC2kW396+xk+JFNK9SQRvs6bJ/bu/hi0ar5BRYkwm+2EGyV7aT3D/OUAHXwRkKjjHl8E7rVSM6/BsppRQCboq4csJPSZJcuaXxXNpgApGocNwLHCarWOSZxd+ee3bYGZJEb6mYU15uHDTHH26jO1f1Ff11A+V98hY7m9+21tOjNs/1u2lt/1sNsEfuhaMXQ==" + ) + ) +) +# Created by pyminifier (https://github.com/liftoff/pyminifier) + +deprecated_metodo_predictivo_no_recursivo = metodo_predictivo_no_recursivo + + +def metodo_predictivo_no_recursivo(G, M=None, firsts=None, follows=None): + parser = deprecated_metodo_predictivo_no_recursivo(G, M, firsts, follows) + + def updated(tokens): + return parser([t.token_type for t in tokens]) + + return updated + + +exec( + zlib.decompress( + base64.b64decode( + "eJx9U8GO2jAQvfMVZi9JtCFarqiuVLUsRUilWranCEUmGcBaY0e2s3TV7b/X9iQhpaiXxJ4Zv3nzZqYUzBiyOfK9fYKqKeE70wb0bEQ2X5ePzzQKv2hEnuZffnye0wj/zrBe0Wi9cocK9qQouOS2KGIDYp8u0lfQO2WAPjJhIHFoxDuyBV10xy6i/XdmVlquJP31uzMclFWDa7FruKiK2rHk8lBYthMQJy2JWz7/KhDQjBsg35RdnmoBJ5AWqrnWSvfPi5IJ0dVwTg9gC+OFKXRQZliMZeULzR+27lw22ihNH9xRNbZuLM29WdWgma/F4P185ALIs27AA3gECzTg5JOpDyBCqRd2BFbRc46gwcz3fwk2qzWXNg4v0+jDZDJ5f3efj1HavZptE3wXhyRpj5tIZQmXQ6EDF4KQ/4QnA+ddkCojn3ZKW6dulmV36NdgGy2dsNI3kSBuatmBDvLkV9hdZW27MTSMGjK6qJexugZZxZcITBsEuKd5D+lTBti2I/d06m8grtPgBP83D4ZgImxq53ZJ0BxS7lT1Rp0pWPZKE/N22inhRdbgGmagin1MgtmQdFarOkYQ4pYPtB3aHcmA0RV5PSUkLES/Gq2wvaa9LoGfj9jeVmG9mo1uUbrJKOxu5mzabi7s2lABEsfRRU6HI4HK+Tb7wbteJ8fJQIwx6aUPCdI1uCbt1s5/llB7dxwt5SsTvGqLGY/HUTL6AyImjec=" + ) + ) +) +# Created by pyminifier (https://github.com/liftoff/pyminifier) + +exec( + zlib.decompress( + base64.b64decode( + "eJyFVltP4zoQfu+v8D41OcfHWl6RLJ0KekEgqLg+dKtiGrf1ktiR7RS6iP9+ZuykSYE9ywOKLzPzzTffjLuypiDLomSVV7kjqiiN9eTEaC+UlvZG+t6queKNyR0rhXVKr5urS1OUlZeLlbLOO9osc7MUedxsHZQ7PFa5tI31mZdFL5MrIl9LobMkozo97pEdz9ilfPU3u+LJ5D2iVmRHlCOXRktiLNHGkx07c7C+lbZQWuRgRaz0ldWzeY/c824KSdojKzAbEqVJxqZWbpV8STASeeZfQE40HYINuWdVmQkvk2dYCeckQMbY92wZ3buFLJ3Kje41wTGjpLQmo9/pfYpRcYGBdwy/qqVXRrt5yBpDW+lcMkAsOX97j0DD/QHCWwETJ1J7aTEJ4u0OdyG/fLaCPIG3pSw9OZe7obXGhkM84vfcxcTbJDKWG/MsNlJkLm0AvwXArx1sFBbGUTR/TkMGr/QZAeVMwV2XpO8RfG5cZYE3e5QMYt0mh7T/NYAwV/zWVrJHXjZQeHKFCK/4SOQO9oj4VKc2/0lIRjDQgQRpdBSSBh+TJi+xT6YldJIGjGvjTQ1wSqNEOYqI/qycXzxLq2UewSD8usKdMxRbNEP5YemDdf8xbj6SAu6SJ4lF3qpMZijVx0/OH/s9MuDQB7+kRl6jugPzaVtvtO3qnvNpm1k47SKT4PdDDSKotG04UXlTCC+adrvxwBctqhyaHThfQGw4BnEFsp4qlWeLi+ujRW1ndDLu8JJLWDPnha0BdgWdcn5E+2MrikLYPS2iWheo3gwI0PxwVoBv2JyN2fBqND/UQdiD0zP+23iz7yB/wwOHZ9BrrbR5NKcoE98hfWbmKUq0y5kHNQHFPBCTtHcnKUXVwtmWzzxE2vA3f2zfGxlvUZsXfAudUgbV3vHN7GJey3eK5RwzX48m9/eY6XZSuaDrQxwXAQcha75X7AQU2xVSjYegDlCI6+CG4CBSGhusnQ7kBdCsEc2X8+FD7HUdu7b6Hy7gb8tEWWI7rsP6joksW3grtFNYlmTKLkUh6QuyysC6lVjyhexaeds/PDM3G7Xy1xKqL6dwAopd5iBLAmqN6+TTDVQuynoRdV07XHjxlMvkIQz/MX9gYzZoRFqrN2nStfzrlqjLrOgpFlrqqpAWOQshQ4Ee2FbaJ+PkcWmV9omi/R++D//0D0/67KdROnHeJq9xvqKbU1S6lyle6gdyT5nKXrmqo4VYsYCShyP83E+P2jwWOAySMxfZwBaJ26SE16TtobgHd0t2IVeeHzZbbQKpLKxcK4clfGAiPhGJpLFHKexdnVOcimlUSBhMjfG+G7pvT3P4W9fT4PZ6eHp3MqRl7bfjdvrh5wEJnXPK1qDWKMC04SfkNwUuur8T/hz7ZnI2uqXrr1I6NMR2rc2wI/7FIqhlIf3GZLX89rdHFIgKEqkH6nloZGBnhO/MaHY+5/yS9oOS/4nFw4P41WxAw69ytfTfvn2DoRqtLnv/ATLgLos=" + ) + ) +) +# Created by pyminifier (https://github.com/liftoff/pyminifier) diff --git a/src/cool/code_generation/notebooks/cmp/tools/regex.py b/src/cool/code_generation/notebooks/cmp/tools/regex.py new file mode 100644 index 000000000..84d31b26d --- /dev/null +++ b/src/cool/code_generation/notebooks/cmp/tools/regex.py @@ -0,0 +1,10 @@ +import zlib, base64 + +exec( + zlib.decompress( + base64.b64decode( + "eJytVsFu2zgQvesreFhDVE0IdY8BCNTZtVRg2yyaOKgdwxAYiYrZSKRK0qnttp+1v7HftCQlWbLWTXPYgwzyzXDem9Fw5FyKEqRlFRKlASsrITWYalGy9EpkFF0yTuTeLW/blZe3Z6p9KsqKFVS2R2NJypLIzkULUaiQbE1IoknjBv+IpujKPC2epIVQW0l7gOAp0ZQTzQTv4JJxVrLDAN1yu+U5SbRIspwEQ376RIqtO9QKbRCaVEQqOvS3IOMPrXNJtchEUkmasVSzJ5FwkUiabo3Xk+gObzUrVHtoLh4p975gk6uXFkQpMKsUKwS3NYRdjYMLD2Q0PyqCiha5BYGkeis5+AKVNrjCE5Sb11EovHq9RloSrphNSeFvPwJP4l74hvBmX96L4sV8CttlWNDdGfI3R/LJgBy+Riq4mBgNKe4YGwm/1y/WaTh2kGV7a+Oy1JR2I7JakaiotIKsMNqvwLBNGg/vI+6FbwhvbS84uq53f8FXuHBI/pzXNdjAz7vGR642Wde0/zf5yVUYiogi3LF6NrCkD3RnLoLpPnagEmq60yhG6pFVydcNM++yIql5oXNZ823wau2BOMbfdheuZ+EOxavdOsiFBDvA+Mr/7iP/lXmgeQLz/PO3v/7hAetwMA7AUljlLAdDGkB4Bg4hU24LXYLAZKQZ31Kz1nLvoM84jlcHIwTQXUorDf6k+5mUQjbWWtnBKPOV6zF/HRiL68miDrEJSVVRnsHPxnLc1Af933wUh7O/osDYmgJvXLnut6zIkod6bjl9MY7bnQdmOA6vBJ9TWVoq6M985CrngTmK0BQt0BLdnTop6M9BBKZgAZbgzjeuFfqAbtAlIujWuPb8voNXAIIA1DkBU1jLOcLz8QIVpLzPCNggdaFWb9bIMNBTcGLqtRjhajzr49dwYweEPRM4u0m8Hg19L+tjchjhaLx8IdXS6OqjUdQyTSzT8lmmaISn47sXMt2N8Ic++tERBc7wDMd0hEkfTWEjzRhu+wbZM9yMZ+PLoa5jk8RejAct4r3Hz38QYBw0A+Ha3sVm3iaJ+XbpJHHzFrlb+t9LGZmuqKfAJzeM7SJ0vtj9un0zGQTHn8Ja2xGBzitoGVNzOVpGe0lPIzcp9gIaqlQ82LnhxkZwdnKdpXwulQ0ezqT6yJmhVB+yFxu/hxu7mOPTTzXMkcPf4Xl4/IRZYIG7PwDwnUUe8dn/DXARdMk/ev8C0IsPHg==" + ) + ) +) +# Created by pyminifier (https://github.com/liftoff/pyminifier) diff --git a/src/cool/code_generation/notebooks/cmp/utils.py b/src/cool/code_generation/notebooks/cmp/utils.py new file mode 100644 index 000000000..f1481286f --- /dev/null +++ b/src/cool/code_generation/notebooks/cmp/utils.py @@ -0,0 +1,241 @@ +from cmp.pycompiler import Production, Sentence, Symbol, EOF, Epsilon + + +class ContainerSet: + def __init__(self, *values, contains_epsilon=False): + self.set = set(values) + self.contains_epsilon = contains_epsilon + + def add(self, value): + n = len(self.set) + self.set.add(value) + return n != len(self.set) + + def extend(self, values): + change = False + for value in values: + change |= self.add(value) + return change + + def set_epsilon(self, value=True): + last = self.contains_epsilon + self.contains_epsilon = value + return last != self.contains_epsilon + + def update(self, other): + n = len(self.set) + self.set.update(other.set) + return n != len(self.set) + + def epsilon_update(self, other): + return self.set_epsilon(self.contains_epsilon | other.contains_epsilon) + + def hard_update(self, other): + return self.update(other) | self.epsilon_update(other) + + def find_match(self, match): + for item in self.set: + if item == match: + return item + return None + + def __len__(self): + return len(self.set) + int(self.contains_epsilon) + + def __str__(self): + return "%s-%s" % (str(self.set), self.contains_epsilon) + + def __repr__(self): + return str(self) + + def __iter__(self): + return iter(self.set) + + def __nonzero__(self): + return len(self) > 0 + + def __eq__(self, other): + if isinstance(other, set): + return self.set == other + return ( + isinstance(other, ContainerSet) + and self.set == other.set + and self.contains_epsilon == other.contains_epsilon + ) + + +def inspect(item, grammar_name="G", mapper=None): + try: + return mapper[item] + except (TypeError, KeyError): + if isinstance(item, dict): + items = ",\n ".join( + f"{inspect(key, grammar_name, mapper)}: {inspect(value, grammar_name, mapper)}" + for key, value in item.items() + ) + return f"{{\n {items} \n}}" + elif isinstance(item, ContainerSet): + args = ( + f'{ ", ".join(inspect(x, grammar_name, mapper) for x in item.set) } ,' + if item.set + else "" + ) + return f"ContainerSet({args} contains_epsilon={item.contains_epsilon})" + elif isinstance(item, EOF): + return f"{grammar_name}.EOF" + elif isinstance(item, Epsilon): + return f"{grammar_name}.Epsilon" + elif isinstance(item, Symbol): + return f"G['{item.Name}']" + elif isinstance(item, Sentence): + items = ", ".join(inspect(s, grammar_name, mapper) for s in item._symbols) + return f"Sentence({items})" + elif isinstance(item, Production): + left = inspect(item.Left, grammar_name, mapper) + right = inspect(item.Right, grammar_name, mapper) + return f"Production({left}, {right})" + elif isinstance(item, tuple) or isinstance(item, list): + ctor = ("(", ")") if isinstance(item, tuple) else ("[", "]") + return f'{ctor[0]} {("%s, " * len(item)) % tuple(inspect(x, grammar_name, mapper) for x in item)}{ctor[1]}' + else: + raise ValueError(f"Invalid: {item}") + + +def pprint(item, header=""): + if header: + print(header) + + if isinstance(item, dict): + for key, value in item.items(): + print(f"{key} ---> {value}") + elif isinstance(item, list): + print("[") + for x in item: + print(f" {repr(x)}") + print("]") + else: + print(item) + + +class Token: + """ + Basic token class. + + Parameters + ---------- + lex : str + Token's lexeme. + token_type : Enum + Token's type. + """ + + def __init__(self, lex, token_type): + self.lex = lex + self.token_type = token_type + + def __str__(self): + return f"{self.token_type}: {self.lex}" + + def __repr__(self): + return str(self) + + @property + def is_valid(self): + return True + + +class UnknownToken(Token): + def __init__(self, lex): + Token.__init__(self, lex, None) + + def transform_to(self, token_type): + return Token(self.lex, token_type) + + @property + def is_valid(self): + return False + + +def tokenizer(G, fixed_tokens): + def decorate(func): + def tokenize_text(text): + tokens = [] + for lex in text.split(): + try: + token = fixed_tokens[lex] + except KeyError: + token = UnknownToken(lex) + try: + token = func(token) + except TypeError: + pass + tokens.append(token) + tokens.append(Token("$", G.EOF)) + return tokens + + if hasattr(func, "__call__"): + return tokenize_text + elif isinstance(func, str): + return tokenize_text(func) + else: + raise TypeError('Argument must be "str" or a callable object.') + + return decorate + + +class DisjointSet: + def __init__(self, *items): + self.nodes = {x: DisjointNode(x) for x in items} + + def merge(self, items): + items = (self.nodes[x] for x in items) + try: + head, *others = items + for other in others: + head.merge(other) + except ValueError: + pass + + @property + def representatives(self): + return {n.representative for n in self.nodes.values()} + + @property + def groups(self): + return [ + [n for n in self.nodes.values() if n.representative == r] + for r in self.representatives + ] + + def __len__(self): + return len(self.representatives) + + def __getitem__(self, item): + return self.nodes[item] + + def __str__(self): + return str(self.groups) + + def __repr__(self): + return str(self) + + +class DisjointNode: + def __init__(self, value): + self.value = value + self.parent = self + + @property + def representative(self): + if self.parent != self: + self.parent = self.parent.representative + return self.parent + + def merge(self, other): + other.representative.parent = self.representative + + def __str__(self): + return str(self.value) + + def __repr__(self): + return str(self) diff --git a/src/cool/code_generation/notebooks/cmp/visitor.py b/src/cool/code_generation/notebooks/cmp/visitor.py new file mode 100644 index 000000000..0bcba712e --- /dev/null +++ b/src/cool/code_generation/notebooks/cmp/visitor.py @@ -0,0 +1,85 @@ +# 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/src/cool/code_generation/notebooks/cp16.ipynb b/src/cool/code_generation/notebooks/cp16.ipynb index b2c1e063a..943b4a69f 100644 --- a/src/cool/code_generation/notebooks/cp16.ipynb +++ b/src/cool/code_generation/notebooks/cp16.ipynb @@ -2,7 +2,6 @@ "cells": [ { "cell_type": "markdown", - "metadata": {}, "source": [ "# Clase Práctica #16 (Compilación)\n", "\n", @@ -11,70 +10,70 @@ "Pasemos a importar el trabajo de las clases anteriores.\n", "\n", "### Análisis Lexicográfico y Sintáctico" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 9, - "metadata": {}, - "outputs": [], + "execution_count": 10, "source": [ - "import cmp.nbpackage\n", - "import cmp.visitor as visitor\n", - "\n", - "from cp13 import G, text\n", - "from cp13 import Node, ProgramNode, DeclarationNode, ExpressionNode\n", - "from cp13 import ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode\n", - "from cp13 import VarDeclarationNode, AssignNode, CallNode\n", - "from cp13 import AtomicNode, BinaryNode\n", - "from cp13 import ConstantNumNode, VariableNode, InstantiateNode, PlusNode, MinusNode, StarNode, DivNode\n", - "from cp13 import FormatVisitor, tokenize_text, pprint_tokens\n", - "\n", - "from cmp.tools.parsing import LR1Parser\n", + "import cmp.nbpackage\r\n", + "import cmp.visitor as visitor\r\n", + "\r\n", + "from cp13 import G, text\r\n", + "from cp13 import Node, ProgramNode, DeclarationNode, ExpressionNode\r\n", + "from cp13 import ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode\r\n", + "from cp13 import VarDeclarationNode, AssignNode, CallNode\r\n", + "from cp13 import AtomicNode, BinaryNode\r\n", + "from cp13 import ConstantNumNode, VariableNode, InstantiateNode, PlusNode, MinusNode, StarNode, DivNode\r\n", + "from cp13 import FormatVisitor, tokenize_text, pprint_tokens\r\n", + "\r\n", + "from cmp.tools.parsing import LR1Parser\r\n", "from cmp.evaluation import evaluate_reverse_parse" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "### Análisis Semántico (Recolección y Construcción de Tipos)" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 10, - "metadata": {}, - "outputs": [], + "execution_count": 11, "source": [ - "from cmp.semantic import SemanticError\n", - "from cmp.semantic import Attribute, Method, Type\n", - "from cmp.semantic import VoidType, ErrorType, IntType\n", - "from cmp.semantic import Context\n", - "\n", + "from cmp.semantic import SemanticError\r\n", + "from cmp.semantic import Attribute, Method, Type\r\n", + "from cmp.semantic import VoidType, ErrorType, IntType\r\n", + "from cmp.semantic import Context\r\n", + "\r\n", "from cp14 import TypeCollector, TypeBuilder" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "### Análisis Semántico (Chequeo de tipos)" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 11, - "metadata": {}, - "outputs": [], + "execution_count": 12, "source": [ - "from cmp.semantic import Scope, VariableInfo\n", + "from cmp.semantic import Scope, VariableInfo\r\n", "from cp15 import TypeChecker" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "## Transformación a CIL\n", "\n", @@ -88,327 +87,326 @@ "- Para definir variables locales e instrucciones dentro de `current_function` se usan las funciones auxiliares `register_local` y `register_instruction` respectivamente.\n", "- En caso de que se necesite definir una variable no declarada por el programador (para guardar resultados intermedios), el método `define_internal_local` provee un mecanismo para hacerlo.\n", "- Los métodos `register_function` y `register_type` almacenan instancias de `cil.FunctionNode` y `cil.TypeNode` en las variables `dotcode` y `dottypes` respectivamente." - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 12, - "metadata": {}, - "outputs": [], + "execution_count": 13, "source": [ - "class BaseCOOLToCILVisitor:\n", - " def __init__(self, context):\n", - " self.dottypes = []\n", - " self.dotdata = []\n", - " self.dotcode = []\n", - " self.current_type = None\n", - " self.current_method = None\n", - " self.current_function = None\n", - " self.context = context\n", - "\n", - " # for faster search\n", - " self.locals_dict = {}\n", - " self.param_set = set()\n", - " self.attr_set = set()\n", - " \n", - " @property\n", - " def params(self):\n", - " return self.current_function.params\n", - " \n", - " @property\n", - " def localvars(self):\n", - " return self.current_function.localvars\n", - " \n", - " @property\n", - " def instructions(self):\n", - " return self.current_function.instructions\n", - " \n", - " def register_local(self, vinfo):\n", - " vinfo.name = f'local_{self.current_function.name[9:]}_{vinfo.name}_{len(self.localvars)}'\n", - " local_node = cil.LocalNode(vinfo.name)\n", - " self.localvars.append(local_node)\n", - " return vinfo.name\n", - "\n", - " def define_internal_local(self):\n", - " vinfo = VariableInfo('internal', None)\n", - " return self.register_local(vinfo)\n", - "\n", - " def register_instruction(self, instruction):\n", - " self.instructions.append(instruction)\n", - " return instruction\n", - " \n", - " def to_function_name(self, method_name, type_name):\n", - " return f'function_{method_name}_at_{type_name}'\n", - " \n", - " def register_function(self, function_name):\n", - " function_node = cil.FunctionNode(function_name, [], [], [])\n", - " self.dotcode.append(function_node)\n", - " return function_node\n", - " \n", - " def register_type(self, name):\n", - " type_node = cil.TypeNode(name)\n", - " self.dottypes.append(type_node)\n", - " return type_node\n", - "\n", - " def register_data(self, value):\n", - " vname = f'data_{len(self.dotdata)}'\n", - " data_node = cil.DataNode(vname, value)\n", - " self.dotdata.append(data_node)\n", + "class BaseCOOLToCILVisitor:\r\n", + " def __init__(self, context):\r\n", + " self.dottypes = []\r\n", + " self.dotdata = []\r\n", + " self.dotcode = []\r\n", + " self.current_type = None\r\n", + " self.current_method = None\r\n", + " self.current_function = None\r\n", + " self.context = context\r\n", + "\r\n", + " # for faster search\r\n", + " self.locals_dict = {}\r\n", + " self.param_set = set()\r\n", + " self.attr_set = set()\r\n", + " \r\n", + " @property\r\n", + " def params(self):\r\n", + " return self.current_function.params\r\n", + " \r\n", + " @property\r\n", + " def localvars(self):\r\n", + " return self.current_function.localvars\r\n", + " \r\n", + " @property\r\n", + " def instructions(self):\r\n", + " return self.current_function.instructions\r\n", + " \r\n", + " def register_local(self, vinfo):\r\n", + " vinfo.name = f'local_{self.current_function.name[9:]}_{vinfo.name}_{len(self.localvars)}'\r\n", + " local_node = cil.LocalNode(vinfo.name)\r\n", + " self.localvars.append(local_node)\r\n", + " return vinfo.name\r\n", + "\r\n", + " def define_internal_local(self):\r\n", + " vinfo = VariableInfo('internal', None)\r\n", + " return self.register_local(vinfo)\r\n", + "\r\n", + " def register_instruction(self, instruction):\r\n", + " self.instructions.append(instruction)\r\n", + " return instruction\r\n", + " \r\n", + " def to_function_name(self, method_name, type_name):\r\n", + " return f'function_{method_name}_at_{type_name}'\r\n", + " \r\n", + " def register_function(self, function_name):\r\n", + " function_node = cil.FunctionNode(function_name, [], [], [])\r\n", + " self.dotcode.append(function_node)\r\n", + " return function_node\r\n", + " \r\n", + " def register_type(self, name):\r\n", + " type_node = cil.TypeNode(name)\r\n", + " self.dottypes.append(type_node)\r\n", + " return type_node\r\n", + "\r\n", + " def register_data(self, value):\r\n", + " vname = f'data_{len(self.dotdata)}'\r\n", + " data_node = cil.DataNode(vname, value)\r\n", + " self.dotdata.append(data_node)\r\n", " return data_node" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "### Implementación\n", "\n", "Pasemos a implementar un `visitor` concretamente. Para simplificar la implementación, asuma que el acceso (`VariableNode`) y asignación (`AssignNode`) de variables ocurre solo sobre variables locales. Realmente sería necesario desambiguar en cuales casos es un acceso a variable y en cuales un acceso a atributo. Esto queda propuesto como estudio individual." - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 13, - "metadata": {}, - "outputs": [], + "execution_count": 14, "source": [ - "import cmp.cil as cil\n", - "\n", - "class MiniCOOLToCILVisitor(BaseCOOLToCILVisitor):\n", - " @visitor.on('node')\n", - " def visit(self, node):\n", - " pass\n", - " \n", - " @visitor.when(ProgramNode)\n", - " def visit(self, node, scope):\n", - " ######################################################\n", - " # node.declarations -> [ ClassDeclarationNode ... ]\n", - " ######################################################\n", - " \n", - " self.current_function = self.register_function('entry')\n", - " instance = self.define_internal_local()\n", - " result = self.define_internal_local()\n", - " main_method_name = self.to_function_name('main', 'Main')\n", - " self.register_instruction(cil.AllocateNode('Main', instance))\n", - " self.register_instruction(cil.ArgNode(instance))\n", - " self.register_instruction(cil.StaticCallNode(main_method_name, result))\n", - " self.register_instruction(cil.ReturnNode(0))\n", - " self.current_function = None\n", - " \n", - "\n", - " for declaration, child_scope in zip(node.declarations, scope.children):\n", - " self.attr_set.clear()\n", - " self.visit(declaration, child_scope)\n", - "\n", - " return cil.ProgramNode(self.dottypes, self.dotdata, self.dotcode)\n", - " \n", - " @visitor.when(ClassDeclarationNode)\n", - " def visit(self, node, scope):\n", - " \"\"\"\n", - " node.id -> str\n", - " node.parent -> str\n", - " node.features -> [ FuncDeclarationNode/AttrDeclarationNode ... ]\n", - " \"\"\"\n", - " \n", - " self.current_type = self.context.get_type(node.id)\n", - "\n", - " type_node = self.register_type(node.id)\n", - " \n", - " types = []\n", - " current_type = self.current_type\n", - " while current_type is not None:\n", - " types.append(current_type)\n", - " current_type = current_type.parent\n", - " \n", - " for current_type in reversed(types):\n", - " for attribute in current_type.attributes:\n", - " self.attr_set.add(attribute.name)\n", - " type_node.attributes.append(attribute.name)\n", - "\n", - " for method in current_type.methods:\n", - " type_node.methods.append((method.name, self.to_function_name(method.name, current_type.name)))\n", - " \n", - "\n", - " func_declarations = (f for f in node.features if isinstance(f, FuncDeclarationNode))\n", - " for feature, child_scope in zip(func_declarations, scope.children):\n", - " self.visit(feature, child_scope)\n", - " \n", - " self.current_type = None\n", - " \n", - " @visitor.when(FuncDeclarationNode)\n", - " def visit(self, node, scope):\n", - " \"\"\"\n", - " node.id -> str\n", - " node.params -> [ (str, str) ... ]\n", - " node.type -> str\n", - " node.body -> [ ExpressionNode ... ]\n", - " \"\"\"\n", - " \n", - " self.current_method = self.current_type.get_method(node.id)\n", - " self.current_function = self.register_function(self.to_function_name(node.id, self.current_type.name))\n", - " \n", - " # (Handle PARAMS)\n", - " self.param_set.clear()\n", - " self.current_function.params.append(cil.ParamNode('self'))\n", - " for name, _ in node.params:\n", - " self.param_set.add(name)\n", - " self.current_function.params.append(cil.ParamNode(name))\n", - " \n", - " self.locals_dict.clear()\n", - " child_scope = scope.children[0]\n", - " for instruction in node.body:\n", - " value = self.visit(instruction, child_scope)\n", - "\n", - " # (Handle RETURN)\n", - " if node.body and 'void' != node.type:\n", - " self.register_instruction(cil.ReturnNode(value))\n", - " else:\n", - " self.register_instruction(cil.ReturnNode())\n", - " \n", - " self.current_method = None\n", - "\n", - " @visitor.when(VarDeclarationNode)\n", - " def visit(self, node, scope):\n", - " \"\"\"\n", - " node.id -> str\n", - " node.type -> str\n", - " node.expr -> ExpressionNode\n", - " \"\"\"\n", - " vinfo = scope.find_variable(node.id)\n", - " dest = self.locals_dict[vinfo.name] = self.register_local(vinfo)\n", - " self.register_instruction(cil.AssignNode(dest, self.visit(node.expr, scope)))\n", - " return dest\n", - "\n", - " @visitor.when(AssignNode)\n", - " def visit(self, node, scope):\n", - " \"\"\"\n", - " node.id -> str\n", - " node.expr -> ExpressionNode\n", - " \"\"\"\n", - " if node.id in self.locals_dict:\n", - " dest = self.locals_dict[node.id]\n", - " self.register_instruction(cil.AssignNode(dest, self.visit(node.expr, scope)))\n", - " return dest\n", - " if node.id in self.param_set:\n", - " dest = node.id\n", - " self.register_instruction(cil.AssignNode(dest, self.visit(node.expr, scope)))\n", - " return dest\n", - " if node.id in self.attr_set:\n", - " pass # for now couse we are not handling set/get attrs\n", - "\n", - " @visitor.when(CallNode)\n", - " def visit(self, node, scope):\n", - " \"\"\"\n", - " node.obj -> AtomicNode\n", - " node.id -> str\n", - " node.args -> [ ExpressionNode ... ]\n", - " \"\"\"\n", - " \n", - " obj_dest = self.visit(node.obj, scope)\n", - " type_dest = self.define_internal_local()\n", - " self.register_instruction(cil.TypeOfNode(obj_dest, type_dest))\n", - "\n", - " args_dest = [obj_dest] + [self.visit(arg, scope) for arg in node.args]\n", - " for dest in args_dest:\n", - " self.register_instruction(cil.ArgNode(dest))\n", - " \n", - " call_dest = self.define_internal_local()\n", - " self.register_instruction(cil.DynamicCallNode(type_dest, self.to_function_name(node.id), call_dest))\n", - "\n", - " return call_dest\n", - "\n", - " @visitor.when(ConstantNumNode)\n", - " def visit(self, node, scope):\n", - " \"\"\"\n", - " node.lex -> str\n", - " \"\"\"\n", - " return node.lex\n", - "\n", - " @visitor.when(VariableNode)\n", - " def visit(self, node, scope):\n", - " \"\"\"\n", - " node.lex -> str\n", - " \"\"\"\n", - " if node.lex in self.locals_dict:\n", - " return self.locals_dict[node.lex]\n", - " if node.lex in self.param_set:\n", - " return node.lex\n", - " if node.lex in self.attr_set:\n", - " return node.lex # for now couse we are not handling set/get attr\n", - "\n", - " @visitor.when(InstantiateNode)\n", - " def visit(self, node, scope):\n", - " \"\"\"\n", - " node.lex -> str\n", - " \"\"\"\n", - " dest = self.define_internal_local()\n", - " self.register_instruction(cil.AllocateNode(node.lex, dest))\n", - " return dest\n", - "\n", - " @visitor.when(PlusNode)\n", - " def visit(self, node, scope):\n", - " \"\"\"\n", - " node.left -> ExpressionNode\n", - " node.right -> ExpressionNode\n", - " \"\"\"\n", - " dest = self.define_internal_local()\n", - " left = self.visit(node.left, scope)\n", - " right = self.visit(node.right, scope)\n", - " self.register_instruction(cil.PlusNode(dest, left, right))\n", - " return dest\n", - " \n", - "\n", - " @visitor.when(MinusNode)\n", - " def visit(self, node, scope):\n", - " \"\"\"\n", - " node.left -> ExpressionNode\n", - " node.right -> ExpressionNode\n", - " \"\"\"\n", - " dest = self.define_internal_local()\n", - " left = self.visit(node.left, scope)\n", - " right = self.visit(node.right, scope)\n", - " self.register_instruction(cil.MinusNode(dest, left, right))\n", - " return dest\n", - "\n", - " @visitor.when(StarNode)\n", - " def visit(self, node, scope):\n", - " \"\"\"\n", - " node.left -> ExpressionNode\n", - " node.right -> ExpressionNode\n", - " \"\"\"\n", - " dest = self.define_internal_local()\n", - " left = self.visit(node.left, scope)\n", - " right = self.visit(node.right, scope)\n", - " self.register_instruction(cil.StarNode(dest, left, right))\n", - " return dest\n", - "\n", - " @visitor.when(DivNode)\n", - " def visit(self, node, scope):\n", - " \"\"\"\n", - " node.left -> ExpressionNode\n", - " node.right -> ExpressionNode\n", - " \"\"\"\n", - " dest = self.define_internal_local()\n", - " left = self.visit(node.left, scope)\n", - " right = self.visit(node.right, scope)\n", - " self.register_instruction(cil.DivNode(dest, left, right))\n", - " return dest\n", - " \n", + "import cmp.cil as cil\r\n", + "\r\n", + "class MiniCOOLToCILVisitor(BaseCOOLToCILVisitor):\r\n", + " @visitor.on('node')\r\n", + " def visit(self, node):\r\n", + " pass\r\n", + " \r\n", + " @visitor.when(ProgramNode)\r\n", + " def visit(self, node, scope):\r\n", + " ######################################################\r\n", + " # node.declarations -> [ ClassDeclarationNode ... ]\r\n", + " ######################################################\r\n", + " \r\n", + " self.current_function = self.register_function('entry')\r\n", + " instance = self.define_internal_local()\r\n", + " result = self.define_internal_local()\r\n", + " main_method_name = self.to_function_name('main', 'Main')\r\n", + " self.register_instruction(cil.AllocateNode('Main', instance))\r\n", + " self.register_instruction(cil.ArgNode(instance))\r\n", + " self.register_instruction(cil.StaticCallNode(main_method_name, result))\r\n", + " self.register_instruction(cil.ReturnNode(0))\r\n", + " self.current_function = None\r\n", + " \r\n", + "\r\n", + " for declaration, child_scope in zip(node.declarations, scope.children):\r\n", + " self.attr_set.clear()\r\n", + " self.visit(declaration, child_scope)\r\n", + "\r\n", + " return cil.ProgramNode(self.dottypes, self.dotdata, self.dotcode)\r\n", + " \r\n", + " @visitor.when(ClassDeclarationNode)\r\n", + " def visit(self, node, scope):\r\n", + " \"\"\"\r\n", + " node.id -> str\r\n", + " node.parent -> str\r\n", + " node.features -> [ FuncDeclarationNode/AttrDeclarationNode ... ]\r\n", + " \"\"\"\r\n", + " \r\n", + " self.current_type = self.context.get_type(node.id)\r\n", + "\r\n", + " type_node = self.register_type(node.id)\r\n", + " \r\n", + " types = []\r\n", + " current_type = self.current_type\r\n", + " while current_type is not None:\r\n", + " types.append(current_type)\r\n", + " current_type = current_type.parent\r\n", + " \r\n", + " for current_type in reversed(types):\r\n", + " for attribute in current_type.attributes:\r\n", + " self.attr_set.add(attribute.name)\r\n", + " type_node.attributes.append(attribute.name)\r\n", + "\r\n", + " for method in current_type.methods:\r\n", + " type_node.methods.append((method.name, self.to_function_name(method.name, current_type.name)))\r\n", + " \r\n", + "\r\n", + " func_declarations = (f for f in node.features if isinstance(f, FuncDeclarationNode))\r\n", + " for feature, child_scope in zip(func_declarations, scope.children):\r\n", + " self.visit(feature, child_scope)\r\n", + " \r\n", + " self.current_type = None\r\n", + " \r\n", + " @visitor.when(FuncDeclarationNode)\r\n", + " def visit(self, node, scope):\r\n", + " \"\"\"\r\n", + " node.id -> str\r\n", + " node.params -> [ (str, str) ... ]\r\n", + " node.type -> str\r\n", + " node.body -> [ ExpressionNode ... ]\r\n", + " \"\"\"\r\n", + " \r\n", + " self.current_method = self.current_type.get_method(node.id)\r\n", + " self.current_function = self.register_function(self.to_function_name(node.id, self.current_type.name))\r\n", + " \r\n", + " # (Handle PARAMS)\r\n", + " self.param_set.clear()\r\n", + " self.current_function.params.append(cil.ParamNode('self'))\r\n", + " for name, _ in node.params:\r\n", + " self.param_set.add(name)\r\n", + " self.current_function.params.append(cil.ParamNode(name))\r\n", + " \r\n", + " self.locals_dict.clear()\r\n", + " child_scope = scope.children[0]\r\n", + " for instruction in node.body:\r\n", + " value = self.visit(instruction, child_scope)\r\n", + "\r\n", + " # (Handle RETURN)\r\n", + " if node.body and 'void' != node.type:\r\n", + " self.register_instruction(cil.ReturnNode(value))\r\n", + " else:\r\n", + " self.register_instruction(cil.ReturnNode())\r\n", + " \r\n", + " self.current_method = None\r\n", + "\r\n", + " @visitor.when(VarDeclarationNode)\r\n", + " def visit(self, node, scope):\r\n", + " \"\"\"\r\n", + " node.id -> str\r\n", + " node.type -> str\r\n", + " node.expr -> ExpressionNode\r\n", + " \"\"\"\r\n", + " vinfo = scope.find_variable(node.id)\r\n", + " dest = self.locals_dict[vinfo.name] = self.register_local(vinfo)\r\n", + " self.register_instruction(cil.AssignNode(dest, self.visit(node.expr, scope)))\r\n", + " return dest\r\n", + "\r\n", + " @visitor.when(AssignNode)\r\n", + " def visit(self, node, scope):\r\n", + " \"\"\"\r\n", + " node.id -> str\r\n", + " node.expr -> ExpressionNode\r\n", + " \"\"\"\r\n", + " if node.id in self.locals_dict:\r\n", + " dest = self.locals_dict[node.id]\r\n", + " self.register_instruction(cil.AssignNode(dest, self.visit(node.expr, scope)))\r\n", + " return dest\r\n", + " if node.id in self.param_set:\r\n", + " dest = node.id\r\n", + " self.register_instruction(cil.AssignNode(dest, self.visit(node.expr, scope)))\r\n", + " return dest\r\n", + " if node.id in self.attr_set:\r\n", + " pass # for now couse we are not handling set/get attrs\r\n", + "\r\n", + " @visitor.when(CallNode)\r\n", + " def visit(self, node, scope):\r\n", + " \"\"\"\r\n", + " node.obj -> AtomicNode\r\n", + " node.id -> str\r\n", + " node.args -> [ ExpressionNode ... ]\r\n", + " \"\"\"\r\n", + " \r\n", + " obj_dest = self.visit(node.obj, scope)\r\n", + " type_dest = self.define_internal_local()\r\n", + " self.register_instruction(cil.TypeOfNode(obj_dest, type_dest))\r\n", + "\r\n", + " args_dest = [obj_dest] + [self.visit(arg, scope) for arg in node.args]\r\n", + " for dest in args_dest:\r\n", + " self.register_instruction(cil.ArgNode(dest))\r\n", + " \r\n", + " call_dest = self.define_internal_local()\r\n", + " self.register_instruction(cil.DynamicCallNode(type_dest, self.to_function_name(node.id), call_dest))\r\n", + "\r\n", + " return call_dest\r\n", + "\r\n", + " @visitor.when(ConstantNumNode)\r\n", + " def visit(self, node, scope):\r\n", + " \"\"\"\r\n", + " node.lex -> str\r\n", + " \"\"\"\r\n", + " return node.lex\r\n", + "\r\n", + " @visitor.when(VariableNode)\r\n", + " def visit(self, node, scope):\r\n", + " \"\"\"\r\n", + " node.lex -> str\r\n", + " \"\"\"\r\n", + " if node.lex in self.locals_dict:\r\n", + " return self.locals_dict[node.lex]\r\n", + " if node.lex in self.param_set:\r\n", + " return node.lex\r\n", + " if node.lex in self.attr_set:\r\n", + " return node.lex # for now couse we are not handling set/get attr\r\n", + "\r\n", + " @visitor.when(InstantiateNode)\r\n", + " def visit(self, node, scope):\r\n", + " \"\"\"\r\n", + " node.lex -> str\r\n", + " \"\"\"\r\n", + " dest = self.define_internal_local()\r\n", + " self.register_instruction(cil.AllocateNode(node.lex, dest))\r\n", + " return dest\r\n", + "\r\n", + " @visitor.when(PlusNode)\r\n", + " def visit(self, node, scope):\r\n", + " \"\"\"\r\n", + " node.left -> ExpressionNode\r\n", + " node.right -> ExpressionNode\r\n", + " \"\"\"\r\n", + " dest = self.define_internal_local()\r\n", + " left = self.visit(node.left, scope)\r\n", + " right = self.visit(node.right, scope)\r\n", + " self.register_instruction(cil.PlusNode(dest, left, right))\r\n", + " return dest\r\n", + " \r\n", + "\r\n", + " @visitor.when(MinusNode)\r\n", + " def visit(self, node, scope):\r\n", + " \"\"\"\r\n", + " node.left -> ExpressionNode\r\n", + " node.right -> ExpressionNode\r\n", + " \"\"\"\r\n", + " dest = self.define_internal_local()\r\n", + " left = self.visit(node.left, scope)\r\n", + " right = self.visit(node.right, scope)\r\n", + " self.register_instruction(cil.MinusNode(dest, left, right))\r\n", + " return dest\r\n", + "\r\n", + " @visitor.when(StarNode)\r\n", + " def visit(self, node, scope):\r\n", + " \"\"\"\r\n", + " node.left -> ExpressionNode\r\n", + " node.right -> ExpressionNode\r\n", + " \"\"\"\r\n", + " dest = self.define_internal_local()\r\n", + " left = self.visit(node.left, scope)\r\n", + " right = self.visit(node.right, scope)\r\n", + " self.register_instruction(cil.StarNode(dest, left, right))\r\n", + " return dest\r\n", + "\r\n", + " @visitor.when(DivNode)\r\n", + " def visit(self, node, scope):\r\n", + " \"\"\"\r\n", + " node.left -> ExpressionNode\r\n", + " node.right -> ExpressionNode\r\n", + " \"\"\"\r\n", + " dest = self.define_internal_local()\r\n", + " left = self.visit(node.left, scope)\r\n", + " right = self.visit(node.right, scope)\r\n", + " self.register_instruction(cil.DivNode(dest, left, right))\r\n", + " return dest\r\n", + " \r\n", " # ======================================================================" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "### Auxiliar Methods" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 14, - "metadata": {}, - "outputs": [], + "execution_count": 15, "source": [ "def inspect_scope(scope, indent=0):\n", " print('\\t' * indent + f'Locals: {[i.name for i in scope.locals]}')\n", @@ -425,22 +423,22 @@ " print(f'Unmatch ({c1}, {c2}) in index {i}')\n", " print(s1[i:])\n", " break" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "### Pipeline\n", "\n", "Actualicemos el método `run_pipeline` para incluir esta nueva fase. Con eso deberíamos completar una línea de ejecución que, partiendo desde el programa en texto plano y la gramática, produzca una representación en CIL." - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 15, - "metadata": {}, - "outputs": [], + "execution_count": 16, "source": [ "from cp15 import run_pipeline as deprecated_pipeline\n", "from cmp.cil import get_formatter\n", @@ -455,28 +453,22 @@ " formatter = get_formatter()\n", " print(formatter(cil_ast))\n", " return ast, errors, context, scope, cil_ast" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "### Programa #1\n", "\n", "El siguiente programa no debería contener errores." - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 16, - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": "=================== TEXT ======================\n\nclass A {\n a : int ;\n def suma ( a : int , b : int ) : int {\n a + b ;\n }\n b : int ;\n}\n\nclass B : A {\n c : int ;\n def f ( d : int , a : A ) : void {\n let f : int = 8 ;\n let c = new A ( ) . suma ( 5 , f ) ;\n c ;\n }\n}\n\n================== TOKENS =====================\nclass id {\n id : id ;\n def id ( id : id , id : id ) : id {\n id + id ;\n }\n id : id ;\n}\nclass id : id {\n id : id ;\n def id ( id : id , id : id ) : id {\n let id : id = int ;\n let id = new id ( ) . id ( int , id ) ;\n id ;\n }\n}\n$\n=================== PARSE =====================\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> id\n -> \n -> \n -> \n -> id\n -> \n -> \n -> + \n -> \n -> ;\n -> def id ( ) : id { }\n -> id : id ;\n -> e\n -> \n -> \n -> \n -> class id { }\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> int\n -> \n -> \n -> \n -> \n -> let id : id = \n -> new id ( )\n -> \n -> int\n -> \n -> \n -> \n -> \n -> id\n -> \n -> \n -> \n -> \n -> \n -> , \n -> . id ( )\n -> \n -> \n -> \n -> \n -> let id = \n -> id\n -> \n -> \n -> \n -> \n -> ;\n -> ; \n -> ; \n -> def id ( ) : id { }\n -> e\n -> \n -> \n -> class id : id { }\n -> \n -> \n -> \n==================== AST ======================\n\\__ProgramNode [ ... ]\n\t\\__ClassDeclarationNode: class A { ... }\n\t\t\\__AttrDeclarationNode: a : int\n\t\t\\__FuncDeclarationNode: def suma(a:int, b:int) : int -> \n\t\t\t\\__ PlusNode \n\t\t\t\t\\__ VariableNode: a\n\t\t\t\t\\__ VariableNode: b\n\t\t\\__AttrDeclarationNode: b : int\n\t\\__ClassDeclarationNode: class B : A { ... }\n\t\t\\__AttrDeclarationNode: c : int\n\t\t\\__FuncDeclarationNode: def f(d:int, a:A) : void -> \n\t\t\t\\__VarDeclarationNode: let f : int = \n\t\t\t\t\\__ ConstantNumNode: 8\n\t\t\t\\__AssignNode: let c = \n\t\t\t\t\\__CallNode: .suma(, ..., )\n\t\t\t\t\t\\__ InstantiateNode: new A()\n\t\t\t\t\t\\__ ConstantNumNode: 5\n\t\t\t\t\t\\__ VariableNode: f\n\t\t\t\\__ VariableNode: c\n============== COLLECTING TYPES ===============\nErrors: []\nContext:\n{\n\ttype int {}\n\t\n\ttype void {}\n\t\n\ttype A {}\n\t\n\ttype B {}\n\t\n}\n=============== BUILDING TYPES ================\nErrors: [\n]\nContext:\n{\n\ttype int {}\n\t\n\ttype void {}\n\t\n\ttype A {\n\t\t[attrib] a : int;\n\t\t[attrib] b : int;\n\t\t[method] suma(a:int, b:int): int;\n\t}\n\t\n\ttype B : A {\n\t\t[attrib] c : int;\n\t\t[method] f(d:int, a:A): void;\n\t}\n\t\n}\n=============== CHECKING TYPES ================\nErrors: [\n]\n============= TRANSFORMING TO CIL =============\n.TYPES\ntype A {\n\tattribute a\n\tattribute b\n\n\tmethod suma: function_suma_at_A\n}\ntype B {\n\tattribute a\n\tattribute b\n\tattribute c\n\n\tmethod suma: function_suma_at_A\n\tmethod f: function_f_at_B\n}\n\n.DATA\n\n\n.CODE\nfunction entry {\n\t\n\n\tLOCAL local__internal_0\n\tLOCAL local__internal_1\n\n\tlocal__internal_0 = ALLOCATE Main\n\tARG local__internal_0\n\tlocal__internal_1 = CALL function_main_at_Main\n\tRETURN 0\n}\nfunction function_suma_at_A {\n\tPARAM self\n\tPARAM a\n\tPARAM b\n\n\tLOCAL local_suma_at_A_internal_0\n\n\tlocal_suma_at_A_internal_0 = a + b\n\tRETURN local_suma_at_A_internal_0\n}\nfunction function_f_at_B {\n\tPARAM self\n\tPARAM d\n\tPARAM a\n\n\tLOCAL local_f_at_B_f_0\n\n\tlocal_f_at_B_f_0 = 8\n\tRETURN \n}\n" - } - ], + "execution_count": 17, "source": [ "text = '''\n", "class A {\n", @@ -552,24 +544,247 @@ "if __name__ == '__main__':\n", "\tast, errors, context, scope, cil_ast = run_pipeline(G, text)\n", "\tassert formatter(cil_ast) == text_cil_no_attr" - ] + ], + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "=================== TEXT ======================\n", + "\n", + "class A {\n", + " a : int ;\n", + " def suma ( a : int , b : int ) : int {\n", + " a + b ;\n", + " }\n", + " b : int ;\n", + "}\n", + "\n", + "class B : A {\n", + " c : int ;\n", + " def f ( d : int , a : A ) : void {\n", + " let f : int = 8 ;\n", + " let c = new A ( ) . suma ( 5 , f ) ;\n", + " c ;\n", + " }\n", + "}\n", + "\n", + "================== TOKENS =====================\n", + "class id {\n", + " id : id ;\n", + " def id ( id : id , id : id ) : id {\n", + " id + id ;\n", + " }\n", + " id : id ;\n", + "}\n", + "class id : id {\n", + " id : id ;\n", + " def id ( id : id , id : id ) : id {\n", + " let id : id = int ;\n", + " let id = new id ( ) . id ( int , id ) ;\n", + " id ;\n", + " }\n", + "}\n", + "$\n", + "=================== PARSE =====================\n", + " -> id : id ;\n", + " -> id : id\n", + " -> id : id\n", + " -> \n", + " -> , \n", + " -> id\n", + " -> \n", + " -> \n", + " -> \n", + " -> id\n", + " -> \n", + " -> \n", + " -> + \n", + " -> \n", + " -> ;\n", + " -> def id ( ) : id { }\n", + " -> id : id ;\n", + " -> e\n", + " -> \n", + " -> \n", + " -> \n", + " -> class id { }\n", + " -> id : id ;\n", + " -> id : id\n", + " -> id : id\n", + " -> \n", + " -> , \n", + " -> int\n", + " -> \n", + " -> \n", + " -> \n", + " -> \n", + " -> let id : id = \n", + " -> new id ( )\n", + " -> \n", + " -> int\n", + " -> \n", + " -> \n", + " -> \n", + " -> \n", + " -> id\n", + " -> \n", + " -> \n", + " -> \n", + " -> \n", + " -> \n", + " -> , \n", + " -> . id ( )\n", + " -> \n", + " -> \n", + " -> \n", + " -> \n", + " -> let id = \n", + " -> id\n", + " -> \n", + " -> \n", + " -> \n", + " -> \n", + " -> ;\n", + " -> ; \n", + " -> ; \n", + " -> def id ( ) : id { }\n", + " -> e\n", + " -> \n", + " -> \n", + " -> class id : id { }\n", + " -> \n", + " -> \n", + " -> \n", + "==================== AST ======================\n", + "\\__ProgramNode [ ... ]\n", + "\t\\__ClassDeclarationNode: class A { ... }\n", + "\t\t\\__AttrDeclarationNode: a : int\n", + "\t\t\\__FuncDeclarationNode: def suma(a:int, b:int) : int -> \n", + "\t\t\t\\__ PlusNode \n", + "\t\t\t\t\\__ VariableNode: a\n", + "\t\t\t\t\\__ VariableNode: b\n", + "\t\t\\__AttrDeclarationNode: b : int\n", + "\t\\__ClassDeclarationNode: class B : A { ... }\n", + "\t\t\\__AttrDeclarationNode: c : int\n", + "\t\t\\__FuncDeclarationNode: def f(d:int, a:A) : void -> \n", + "\t\t\t\\__VarDeclarationNode: let f : int = \n", + "\t\t\t\t\\__ ConstantNumNode: 8\n", + "\t\t\t\\__AssignNode: let c = \n", + "\t\t\t\t\\__CallNode: .suma(, ..., )\n", + "\t\t\t\t\t\\__ InstantiateNode: new A()\n", + "\t\t\t\t\t\\__ ConstantNumNode: 5\n", + "\t\t\t\t\t\\__ VariableNode: f\n", + "\t\t\t\\__ VariableNode: c\n", + "============== COLLECTING TYPES ===============\n", + "Errors: []\n", + "Context:\n", + "{\n", + "\ttype int {}\n", + "\t\n", + "\ttype void {}\n", + "\t\n", + "\ttype A {}\n", + "\t\n", + "\ttype B {}\n", + "\t\n", + "}\n", + "=============== BUILDING TYPES ================\n", + "Errors: [\n", + "]\n", + "Context:\n", + "{\n", + "\ttype int {}\n", + "\t\n", + "\ttype void {}\n", + "\t\n", + "\ttype A {\n", + "\t\t[attrib] a : int;\n", + "\t\t[attrib] b : int;\n", + "\t\t[method] suma(a:int, b:int): int;\n", + "\t}\n", + "\t\n", + "\ttype B : A {\n", + "\t\t[attrib] c : int;\n", + "\t\t[method] f(d:int, a:A): void;\n", + "\t}\n", + "\t\n", + "}\n", + "=============== CHECKING TYPES ================\n", + "Errors: [\n", + "]\n", + "============= TRANSFORMING TO CIL =============\n", + ".TYPES\n", + "type A {\n", + "\tattribute a\n", + "\tattribute b\n", + "\n", + "\tmethod suma: function_suma_at_A\n", + "}\n", + "type B {\n", + "\tattribute a\n", + "\tattribute b\n", + "\tattribute c\n", + "\n", + "\tmethod suma: function_suma_at_A\n", + "\tmethod f: function_f_at_B\n", + "}\n", + "\n", + ".DATA\n", + "\n", + "\n", + ".CODE\n", + "function entry {\n", + "\t\n", + "\n", + "\tLOCAL local__internal_0\n", + "\tLOCAL local__internal_1\n", + "\n", + "\tlocal__internal_0 = ALLOCATE Main\n", + "\tARG local__internal_0\n", + "\tlocal__internal_1 = CALL function_main_at_Main\n", + "\tRETURN 0\n", + "}\n", + "function function_suma_at_A {\n", + "\tPARAM self\n", + "\tPARAM a\n", + "\tPARAM b\n", + "\n", + "\tLOCAL local_suma_at_A_internal_0\n", + "\n", + "\tlocal_suma_at_A_internal_0 = a + b\n", + "\tRETURN local_suma_at_A_internal_0\n", + "}\n", + "function function_f_at_B {\n", + "\tPARAM self\n", + "\tPARAM d\n", + "\tPARAM a\n", + "\n", + "\tLOCAL local_f_at_B_f_0\n", + "\n", + "\tlocal_f_at_B_f_0 = 8\n", + "\tRETURN \n", + "}\n" + ] + } + ], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "## Propuestas\n", "\n", "- Maneje el acceso y asignación a atributos (`GETATTR` y `SETATTR`).\n", "- Implemente un intérprete de `CIL`." - ] + ], + "metadata": {} } ], "metadata": { "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" + "name": "python3", + "display_name": "Python 3.9.0 64-bit ('cool': virtualenv)" }, "language_info": { "codemirror_mode": { @@ -581,7 +796,10 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.3-final" + "version": "3.9.0" + }, + "interpreter": { + "hash": "7b7a60189ab2a9790105c6813c86fd6387dfcad969adb968418f9c1145203b58" } }, "nbformat": 4, diff --git a/src/cool/code_generation/notebooks/lexer.py b/src/cool/code_generation/notebooks/lexer.py index 8700884a6..0f75d63d8 100644 --- a/src/cool/code_generation/notebooks/lexer.py +++ b/src/cool/code_generation/notebooks/lexer.py @@ -1,80 +1,88 @@ from cmp.ast import AtomicNode, BinaryNode, UnaryNode from cmp.automata import State from cmp.pycompiler import Grammar -from cmp.tools.automata import DFA, NFA, automata_closure, automata_concatenation, automata_minimization, automata_union, nfa_to_dfa +from cmp.tools.automata import ( + DFA, + NFA, + automata_closure, + automata_concatenation, + automata_minimization, + automata_union, + nfa_to_dfa, +) from cmp.tools.evaluation import evaluate_parse from cmp.tools.parsing import metodo_predictivo_no_recursivo from cmp.utils import Token class EpsilonNode(AtomicNode): - def evaluate(self): - return DFA(states=1, finals=[0], transitions={}) + def evaluate(self): + return DFA(states=1, finals=[0], transitions={}) class SymbolNode(AtomicNode): - def evaluate(self): - s = self.lex - return DFA(states=2, finals=[1], transitions={(0, s): 1}) + def evaluate(self): + s = self.lex + return DFA(states=2, finals=[1], transitions={(0, s): 1}) class ClosureNode(UnaryNode): - @staticmethod - def operate(value): - return automata_closure(value) + @staticmethod + def operate(value): + return automata_closure(value) class UnionNode(BinaryNode): - @staticmethod - def operate(lvalue, rvalue): - return automata_union(lvalue, rvalue) + @staticmethod + def operate(lvalue, rvalue): + return automata_union(lvalue, rvalue) class ConcatNode(BinaryNode): - @staticmethod - def operate(lvalue, rvalue): - return automata_concatenation(lvalue, rvalue) + @staticmethod + def operate(lvalue, rvalue): + return automata_concatenation(lvalue, rvalue) def regex_tokenizer(text, G, skip_whitespaces=True): - tokens = [] - fixed_tokens = {x: Token(x, G[x]) for x in ['|', '*', '(', ')', 'ε']} - iter_text = iter(text) - for c in iter_text: - if c == '\\': - tokens.append(Token(next(iter_text), G['symbol'])) - continue - - if skip_whitespaces and c.isspace(): - continue - - try: - token = fixed_tokens[c] - except KeyError: - token = Token(c, G['symbol']) - tokens.append(token) - tokens.append(Token('$', G.EOF)) - return tokens + tokens = [] + fixed_tokens = {x: Token(x, G[x]) for x in ["|", "*", "(", ")", "ε"]} + iter_text = iter(text) + for c in iter_text: + if c == "\\": + tokens.append(Token(next(iter_text), G["symbol"])) + continue + + if skip_whitespaces and c.isspace(): + continue + + try: + token = fixed_tokens[c] + except KeyError: + token = Token(c, G["symbol"]) + tokens.append(token) + tokens.append(Token("$", G.EOF)) + return tokens def build_grammar(): - G = Grammar() - E = G.NonTerminal('E', True) - T, F, A, X, Y, Z = G.NonTerminals('T F A X Y Z') - pipe, star, opar, cpar, symbol, epsilon = G.Terminals('| * ( ) symbol ε') - E %= T + X, lambda h, s: s[2], None, lambda h, s: s[1] - X %= pipe + E, lambda h, s: UnionNode(h[0], s[2]) - X %= G.Epsilon, lambda h, s: h[0] - T %= F + Y, lambda h, s: s[2], None, lambda h, s: s[1] - Y %= T, lambda h, s: ConcatNode(h[0], s[1]) - Y %= G.Epsilon, lambda h, s: h[0] - F %= A + Z, lambda h, s: s[2], None, lambda h, s: s[1] - Z %= star, lambda h, s: ClosureNode(h[0]) - Z %= G.Epsilon, lambda h, s: h[0] - A %= symbol, lambda h, s: SymbolNode(s[1]) - A %= epsilon, lambda h, s: EpsilonNode(s[1]) - A %= opar + E + cpar, lambda h, s: s[2] - return G + G = Grammar() + E = G.NonTerminal("E", True) + T, F, A, X, Y, Z = G.NonTerminals("T F A X Y Z") + pipe, star, opar, cpar, symbol, epsilon = G.Terminals("| * ( ) symbol ε") + E %= T + X, lambda h, s: s[2], None, lambda h, s: s[1] + X %= pipe + E, lambda h, s: UnionNode(h[0], s[2]) + X %= G.Epsilon, lambda h, s: h[0] + T %= F + Y, lambda h, s: s[2], None, lambda h, s: s[1] + Y %= T, lambda h, s: ConcatNode(h[0], s[1]) + Y %= G.Epsilon, lambda h, s: h[0] + F %= A + Z, lambda h, s: s[2], None, lambda h, s: s[1] + Z %= star, lambda h, s: ClosureNode(h[0]) + Z %= G.Epsilon, lambda h, s: h[0] + A %= symbol, lambda h, s: SymbolNode(s[1]) + A %= epsilon, lambda h, s: EpsilonNode(s[1]) + A %= opar + E + cpar, lambda h, s: s[2] + return G G = build_grammar() @@ -82,81 +90,82 @@ def build_grammar(): class Regex: - def __init__(self, regex, skip_whitespaces=False): - self.regex = regex - self.automaton = self.build_automaton(regex) + def __init__(self, regex, skip_whitespaces=False): + self.regex = regex + self.automaton = self.build_automaton(regex) - def __call__(self, text): - return self.automaton.recognize(text) + def __call__(self, text): + return self.automaton.recognize(text) - @staticmethod - def build_automaton(regex, skip_whitespaces=False): - tokens = regex_tokenizer(regex, G, skip_whitespaces=False) - left_parse = parser(tokens) - ast = evaluate_parse(left_parse, tokens) - nfa = ast.evaluate() - dfa = nfa_to_dfa(nfa) - dfa = automata_minimization(dfa) - return dfa + @staticmethod + def build_automaton(regex, skip_whitespaces=False): + tokens = regex_tokenizer(regex, G, skip_whitespaces=False) + left_parse = parser(tokens) + ast = evaluate_parse(left_parse, tokens) + nfa = ast.evaluate() + dfa = nfa_to_dfa(nfa) + dfa = automata_minimization(dfa) + return dfa class Lexer: - def __init__(self, table, eof): - self.eof = eof - self.regexs = self._build_regexs(table) - self.automaton = self._build_automaton() - - def _build_regexs(self, table): - regexs = [] - for n, (token_type, regex) in enumerate(table): - automaton = Regex.build_automaton(regex) - automaton, states = State.from_nfa(automaton, get_states=True) - - for state in states: - if state.final: - state.tag = (n, token_type) - - regexs.append(automaton) - return regexs - - def _build_automaton(self): - start = State('start') - regexs = self.regexs - - for regex in regexs: - start.add_epsilon_transition(regex) - - return start.to_deterministic() - - - def _walk(self, string): - state = self.automaton - final = state if state.final else None - final_lex = lex = '' - - for symbol in string: - try: - state = state[symbol][0] - lex += symbol - final, final_lex = (state, lex) if state.final else (final, final_lex) - except TypeError: - break - - return final, final_lex - - def _tokenize(self, text): - while text: - state, lex = self._walk(text) - - if state is not None: - text = text[len(lex):] - token_type = min((s for s in state.state if s.final), key=lambda x: x.tag).tag[1] - yield lex, token_type - - else: - return None - - yield '$', self.eof - - def __call__(self, text): - return [Token(lex, token_type) for lex, token_type in self._tokenize(text)] + def __init__(self, table, eof): + self.eof = eof + self.regexs = self._build_regexs(table) + self.automaton = self._build_automaton() + + def _build_regexs(self, table): + regexs = [] + for n, (token_type, regex) in enumerate(table): + automaton = Regex.build_automaton(regex) + automaton, states = State.from_nfa(automaton, get_states=True) + + for state in states: + if state.final: + state.tag = (n, token_type) + + regexs.append(automaton) + return regexs + + def _build_automaton(self): + start = State("start") + regexs = self.regexs + + for regex in regexs: + start.add_epsilon_transition(regex) + + return start.to_deterministic() + + def _walk(self, string): + state = self.automaton + final = state if state.final else None + final_lex = lex = "" + + for symbol in string: + try: + state = state[symbol][0] + lex += symbol + final, final_lex = (state, lex) if state.final else (final, final_lex) + except TypeError: + break + + return final, final_lex + + def _tokenize(self, text): + while text: + state, lex = self._walk(text) + + if state is not None: + text = text[len(lex) :] + token_type = min( + (s for s in state.state if s.final), key=lambda x: x.tag + ).tag[1] + yield lex, token_type + + else: + return None + + yield "$", self.eof + + def __call__(self, text): + return [Token(lex, token_type) for lex, token_type in self._tokenize(text)] diff --git a/src/cool/grammar.py b/src/cool/grammar.py index 550e62836..35b641b30 100644 --- a/src/cool/grammar.py +++ b/src/cool/grammar.py @@ -10,105 +10,116 @@ ################# # Non-Terminals # ################# -program = G.add_non_terminal('program', start_symbol=True) -class_list = G.add_non_terminal('class-list') -class_def = G.add_non_terminal('class-def') -feature_list = G.add_non_terminal('feature-list') -attribute = G.add_non_terminal('attribute') -method = G.add_non_terminal('method') -param_list = G.add_non_terminal('param-list') -block = G.add_non_terminal('block') -declaration_list = G.add_non_terminal('declaration-list') -case_list = G.add_non_terminal('case-list') -function_call = G.add_non_terminal('function-call') -expr_list = G.add_non_terminal('expr-list') -not_empty_expr_list = G.add_non_terminal('not-empty-expr-list') -expr = G.add_non_terminal('expr') -negable_comp = G.add_non_terminal('negable-comp') -comp = G.add_non_terminal('comp') -negable_arith = G.add_non_terminal('negable-arith') -arith = G.add_non_terminal('arith') -term = G.add_non_terminal('term') -factor = G.add_non_terminal('factor') -atom = G.add_non_terminal('atom') +program = G.add_non_terminal("program", start_symbol=True) +class_list = G.add_non_terminal("class-list") +class_def = G.add_non_terminal("class-def") +feature_list = G.add_non_terminal("feature-list") +attribute = G.add_non_terminal("attribute") +method = G.add_non_terminal("method") +param_list = G.add_non_terminal("param-list") +block = G.add_non_terminal("block") +declaration_list = G.add_non_terminal("declaration-list") +case_list = G.add_non_terminal("case-list") +function_call = G.add_non_terminal("function-call") +expr_list = G.add_non_terminal("expr-list") +not_empty_expr_list = G.add_non_terminal("not-empty-expr-list") +expr = G.add_non_terminal("expr") +negable_comp = G.add_non_terminal("negable-comp") +comp = G.add_non_terminal("comp") +negable_arith = G.add_non_terminal("negable-arith") +arith = G.add_non_terminal("arith") +term = G.add_non_terminal("term") +factor = G.add_non_terminal("factor") +atom = G.add_non_terminal("atom") ########### # Symbols # ########### -G.add_terminals('{ } ( ) . , : ; @ <- =>') +G.add_terminals("{ } ( ) . , : ; @ <- =>") ############ # Keywords # ############ keywords = G.add_terminals( - 'class inherits if then else fi while loop pool let in case of esac new isvoid true false not') + "class inherits if then else fi while loop pool let in case of esac new isvoid true false not" +) keywords_names = {x.name for x in keywords} ############# # Symbols # ############# -G.add_terminals('+ - * / < <= = ~') +G.add_terminals("+ - * / < <= = ~") ############### # Identifiers # ############### -@G.terminal('id', r'[a-z][a-zA-Z0-9_]*') +@G.terminal("id", r"[a-z][a-zA-Z0-9_]*") def id_terminal(lexer: Lexer): lex = lexer.token.lex lexer.column += len(lex) lexer.position += len(lex) - lexer.token.token_type = lex.lower() if lex.lower() in keywords_names else lexer.token.token_type + lexer.token.token_type = ( + lex.lower() if lex.lower() in keywords_names else lexer.token.token_type + ) return lexer.token -@G.terminal('type', regex=r'[A-Z][a-zA-Z0-9_]*') +@G.terminal("type", regex=r"[A-Z][a-zA-Z0-9_]*") def type_terminal(lexer: Lexer): lex = lexer.token.lex lexer.column += len(lex) lexer.position += len(lex) - lexer.token.token_type = lex.lower() if lex.lower() in keywords_names - {'true', 'false'} else lexer.token.token_type + lexer.token.token_type = ( + lex.lower() + if lex.lower() in keywords_names - {"true", "false"} + else lexer.token.token_type + ) return lexer.token + ############### # Basic Types # ############### -G.add_terminal('int', regex=r'\d+') +G.add_terminal("int", regex=r"\d+") -@G.terminal('string', regex=r'\"') +@G.terminal("string", regex=r"\"") def string(lexer: Lexer): text = lexer.text pos = lexer.position + 1 lexer.column += 1 - lex = '\"' + lex = '"' contains_null_character = False while True: if pos >= len(text): lexer.contain_errors = True lexer.position = pos - lexer.add_error(lexer.lineno, lexer.column, - f'({lexer.lineno}, {lexer.column}) - LexicographicError: EOF in string constant') + lexer.add_error( + lexer.lineno, + lexer.column, + f"({lexer.lineno}, {lexer.column}) - LexicographicError: EOF in string constant", + ) return s = text[pos] - if s == '\\': - if text[pos + 1] == '\n': - lex += '\n' + if s == "\\": + if text[pos + 1] == "\n": + lex += "\n" pos += 2 lexer.lineno += 1 lexer.column = 1 - elif text[pos + 1] in ('b', 'f', 't', 'n'): - if text[pos + 1] == 'b': - lex += '\\b' - elif text[pos + 1] == 'f': - lex += '\\f' - elif text[pos + 1] == 't': - lex += '\\t' + elif text[pos + 1] in ("b", "f", "t", "n"): + if text[pos + 1] == "b": + lex += "\\b" + elif text[pos + 1] == "f": + lex += "\\f" + elif text[pos + 1] == "t": + lex += "\\t" else: - lex += '\\n' + lex += "\\n" pos += 2 lexer.column += 2 @@ -116,18 +127,24 @@ def string(lexer: Lexer): lex += text[pos + 1] pos += 2 lexer.column += 2 - elif s == '\n': + elif s == "\n": # Unterminated String lexer.contain_errors = True lexer.position = pos - lexer.add_error(lexer.lineno, lexer.column, - f'({lexer.lineno}, {lexer.column}) - LexicographicError: Unterminated string constant') + lexer.add_error( + lexer.lineno, + lexer.column, + f"({lexer.lineno}, {lexer.column}) - LexicographicError: Unterminated string constant", + ) return - elif s == '\0': + elif s == "\0": contains_null_character = True lexer.contain_errors = True - lexer.add_error(lexer.lineno, lexer.column, - f'({lexer.lineno}, {lexer.column}) - LexicographicError: String contains null character') + lexer.add_error( + lexer.lineno, + lexer.column, + f"({lexer.lineno}, {lexer.column}) - LexicographicError: String contains null character", + ) pos += 1 lexer.column += 1 else: @@ -135,7 +152,7 @@ def string(lexer: Lexer): pos += 1 lexer.column += 1 - if s == '\"': + if s == '"': break lexer.position = pos @@ -147,48 +164,51 @@ def string(lexer: Lexer): ############ # Comments # ############ -@G.terminal('single_line_comment', r'--.*') +@G.terminal("single_line_comment", r"--.*") def single_line_comment(lexer): lex = lexer.token.lex for s in lex: - if s == '\n': + if s == "\n": lexer.lineno += 1 lexer.column = 0 lexer.column += 1 lexer.position += len(lex) -@G.terminal('multi_line_comment', r'\(\*') +@G.terminal("multi_line_comment", r"\(\*") def multi_line_comment(lexer: Lexer): counter = 1 text = lexer.text pos = lexer.position + 2 lexer.column += 2 - lex = '(*' + lex = "(*" while counter > 0: if pos >= len(text): lexer.contain_errors = True lexer.position = pos - lexer.add_error(lexer.lineno, lexer.column, - f'({lexer.lineno}, {lexer.column}) - LexicographicError: EOF in comment') + lexer.add_error( + lexer.lineno, + lexer.column, + f"({lexer.lineno}, {lexer.column}) - LexicographicError: EOF in comment", + ) return None - if text.startswith('(*', pos): + if text.startswith("(*", pos): counter += 1 pos += 2 - lex += '(*' + lex += "(*" lexer.column += 2 - elif text.startswith('*)', pos): + elif text.startswith("*)", pos): counter -= 1 pos += 2 - lex += '*)' + lex += "*)" lexer.column += 2 else: - if text[pos] == '\n': + if text[pos] == "\n": lexer.lineno += 1 lexer.column = 0 - elif text[pos] == '\t': + elif text[pos] == "\t": lexer.column += 3 lex += text[pos] pos += 1 @@ -200,20 +220,20 @@ def multi_line_comment(lexer: Lexer): ################## # Ignored Tokens # ################## -@G.terminal('newline', r'\n+') +@G.terminal("newline", r"\n+") def newline(lexer: Lexer): lexer.lineno += len(lexer.token.lex) lexer.position += len(lexer.token.lex) lexer.column = 1 -@G.terminal('whitespace', r' +') +@G.terminal("whitespace", r" +") def whitespace(lexer): lexer.column += len(lexer.token.lex) lexer.position += len(lexer.token.lex) -@G.terminal('tabulation', r'\t+') +@G.terminal("tabulation", r"\t+") def tab(lexer): lexer.column += 4 * len(lexer.token.lex) lexer.position += len(lexer.token.lex) @@ -221,8 +241,11 @@ def tab(lexer): @G.lexical_error def lexical_error(lexer): - lexer.add_error(lexer.lineno, lexer.column, - f'({lexer.lineno}, {lexer.column}) - LexicographicError: ERROR "{lexer.token.lex}"') + lexer.add_error( + lexer.lineno, + lexer.column, + f'({lexer.lineno}, {lexer.column}) - LexicographicError: ERROR "{lexer.token.lex}"', + ) lexer.column += len(lexer.token.lex) lexer.position += len(lexer.token.lex) @@ -230,86 +253,107 @@ def lexical_error(lexer): ############### # Productions # ############### -program %= 'class-list', lambda s: ast.ProgramNode(s[1]) - -class_list %= 'class-def ;', lambda s: [s[1]] -class_list %= 'class-def ; class-list', lambda s: [s[1]] + s[3] - -class_def %= 'class type { feature-list }', lambda s: ast.ClassDeclarationNode(s[2], s[4]) -class_def %= 'class type inherits type { feature-list }', lambda s: ast.ClassDeclarationNode(s[2], s[6], s[4]) - -feature_list %= '', lambda s: [] -feature_list %= 'attribute ; feature-list', lambda s: [s[1]] + s[3] -feature_list %= 'method ; feature-list', lambda s: [s[1]] + s[3] - -attribute %= 'id : type', lambda s: ast.AttrDeclarationNode(s[1], s[3]) -attribute %= 'id : type <- expr', lambda s: ast.AttrDeclarationNode(s[1], s[3], s[5]) - -method %= 'id ( ) : type { expr }', lambda s: ast.MethodDeclarationNode(s[1], [], s[5], s[7]) -method %= 'id ( param-list ) : type { expr }', lambda s: ast.MethodDeclarationNode(s[1], s[3], s[6], s[8]) - -param_list %= 'id : type', lambda s: [(s[1], s[3])] -param_list %= 'id : type , param-list', lambda s: [(s[1], s[3])] + s[5] - -expr %= 'id <- expr', lambda s: ast.AssignNode(s[1], s[3]) -expr %= '{ block }', lambda s: ast.BlockNode(s[2]) -expr %= 'while expr loop expr pool', lambda s: ast.WhileNode(s[2], s[4]) -expr %= 'let declaration-list in expr', lambda s: ast.LetNode(s[2], s[4]) -expr %= 'case expr of case-list esac', lambda s: ast.SwitchCaseNode(s[2], s[4]) -expr %= 'negable-comp', lambda s: s[1] - -negable_comp %= 'not comp', lambda s: ast.NegationNode(s[2]) -negable_comp %= 'comp', lambda s: s[1] - -comp %= 'comp < negable-arith', lambda s: ast.LessThanNode(s[1], s[2], s[3]) -comp %= 'comp <= negable-arith', lambda s: ast.LessEqualNode(s[1], s[2], s[3]) -comp %= 'comp = negable-arith', lambda s: ast.EqualNode(s[1], s[2], s[3]) -comp %= 'arith', lambda s: s[1] - -negable_arith %= 'not arith', lambda s: ast.NegationNode(s[2]) -negable_arith %= 'arith', lambda s: s[1] - -arith %= 'arith + term', lambda s: ast.PlusNode(s[1], s[2], s[3]) -arith %= 'arith - term', lambda s: ast.MinusNode(s[1], s[2], s[3]) -arith %= 'term', lambda s: s[1] - -term %= 'term * factor', lambda s: ast.StarNode(s[1], s[2], s[3]) -term %= 'term / factor', lambda s: ast.DivNode(s[1], s[2], s[3]) -term %= 'factor', lambda s: s[1] - -factor %= 'isvoid factor', lambda s: ast.IsVoidNode(s[2]) -factor %= '~ factor', lambda s: ast.ComplementNode(s[2]) -factor %= 'atom', lambda s: s[1] - -atom %= 'id', lambda s: ast.VariableNode(s[1]) -atom %= 'true', lambda s: ast.BooleanNode(s[1]) -atom %= 'false', lambda s: ast.BooleanNode(s[1]) -atom %= 'int', lambda s: ast.IntegerNode(s[1]) -atom %= 'string', lambda s: ast.StringNode(s[1]) -atom %= 'if expr then expr else expr fi', lambda s: ast.ConditionalNode(s[2], s[4], s[6]) -atom %= 'function-call', lambda s: s[1] -atom %= 'new type', lambda s: ast.InstantiateNode(s[2]) -atom %= '( expr )', lambda s: s[2] - -block %= 'expr ;', lambda s: [s[1]] -block %= 'expr ; block', lambda s: [s[1]] + s[3] - -declaration_list %= 'id : type', lambda s: [(s[1], s[3], None)] -declaration_list %= 'id : type <- expr', lambda s: [(s[1], s[3], s[5])] -declaration_list %= 'id : type , declaration-list', lambda s: [(s[1], s[3], None)] + s[5] -declaration_list %= 'id : type <- expr , declaration-list', lambda s: [(s[1], s[3], s[5])] + s[7] - -case_list %= 'id : type => expr ;', lambda s: [(s[1], s[3], s[5])] -case_list %= 'id : type => expr ; case-list', lambda s: [(s[1], s[3], s[5])] + s[7] - -function_call %= 'id ( expr-list )', lambda s: ast.MethodCallNode(s[1], s[3]) -function_call %= 'atom . id ( expr-list )', lambda s: ast.MethodCallNode(s[3], s[5], s[1]) -function_call %= 'atom @ type . id ( expr-list )', lambda s: ast.MethodCallNode(s[5], s[7], s[1], s[3]) - -expr_list %= '', lambda s: [] -expr_list %= 'not-empty-expr-list', lambda s: s[1] -not_empty_expr_list %= 'expr', lambda s: [s[1]] -not_empty_expr_list %= 'expr , not-empty-expr-list', lambda s: [s[1]] + s[3] +program %= "class-list", lambda s: ast.ProgramNode(s[1]) + +class_list %= "class-def ;", lambda s: [s[1]] +class_list %= "class-def ; class-list", lambda s: [s[1]] + s[3] + +class_def %= "class type { feature-list }", lambda s: ast.ClassDeclarationNode( + s[2], s[4] +) +class_def %= ( + "class type inherits type { feature-list }", + lambda s: ast.ClassDeclarationNode(s[2], s[6], s[4]), +) + +feature_list %= "", lambda s: [] +feature_list %= "attribute ; feature-list", lambda s: [s[1]] + s[3] +feature_list %= "method ; feature-list", lambda s: [s[1]] + s[3] + +attribute %= "id : type", lambda s: ast.AttrDeclarationNode(s[1], s[3]) +attribute %= "id : type <- expr", lambda s: ast.AttrDeclarationNode(s[1], s[3], s[5]) + +method %= "id ( ) : type { expr }", lambda s: ast.MethodDeclarationNode( + s[1], [], s[5], s[7] +) +method %= "id ( param-list ) : type { expr }", lambda s: ast.MethodDeclarationNode( + s[1], s[3], s[6], s[8] +) + +param_list %= "id : type", lambda s: [(s[1], s[3])] +param_list %= "id : type , param-list", lambda s: [(s[1], s[3])] + s[5] + +expr %= "id <- expr", lambda s: ast.AssignNode(s[1], s[3]) +expr %= "{ block }", lambda s: ast.BlockNode(s[2]) +expr %= "while expr loop expr pool", lambda s: ast.WhileNode(s[2], s[4]) +expr %= "let declaration-list in expr", lambda s: ast.LetNode(s[2], s[4]) +expr %= "case expr of case-list esac", lambda s: ast.SwitchCaseNode(s[2], s[4]) +expr %= "negable-comp", lambda s: s[1] + +negable_comp %= "not comp", lambda s: ast.NegationNode(s[2]) +negable_comp %= "comp", lambda s: s[1] + +comp %= "comp < negable-arith", lambda s: ast.LessThanNode(s[1], s[2], s[3]) +comp %= "comp <= negable-arith", lambda s: ast.LessEqualNode(s[1], s[2], s[3]) +comp %= "comp = negable-arith", lambda s: ast.EqualNode(s[1], s[2], s[3]) +comp %= "arith", lambda s: s[1] + +negable_arith %= "not arith", lambda s: ast.NegationNode(s[2]) +negable_arith %= "arith", lambda s: s[1] + +arith %= "arith + term", lambda s: ast.PlusNode(s[1], s[2], s[3]) +arith %= "arith - term", lambda s: ast.MinusNode(s[1], s[2], s[3]) +arith %= "term", lambda s: s[1] + +term %= "term * factor", lambda s: ast.StarNode(s[1], s[2], s[3]) +term %= "term / factor", lambda s: ast.DivNode(s[1], s[2], s[3]) +term %= "factor", lambda s: s[1] + +factor %= "isvoid factor", lambda s: ast.IsVoidNode(s[2]) +factor %= "~ factor", lambda s: ast.ComplementNode(s[2]) +factor %= "atom", lambda s: s[1] + +atom %= "id", lambda s: ast.VariableNode(s[1]) +atom %= "true", lambda s: ast.BooleanNode(s[1]) +atom %= "false", lambda s: ast.BooleanNode(s[1]) +atom %= "int", lambda s: ast.IntegerNode(s[1]) +atom %= "string", lambda s: ast.StringNode(s[1]) +atom %= "if expr then expr else expr fi", lambda s: ast.ConditionalNode( + s[2], s[4], s[6] +) +atom %= "function-call", lambda s: s[1] +atom %= "new type", lambda s: ast.InstantiateNode(s[2]) +atom %= "( expr )", lambda s: s[2] + +block %= "expr ;", lambda s: [s[1]] +block %= "expr ; block", lambda s: [s[1]] + s[3] + +declaration_list %= "id : type", lambda s: [(s[1], s[3], None)] +declaration_list %= "id : type <- expr", lambda s: [(s[1], s[3], s[5])] +declaration_list %= ( + "id : type , declaration-list", + lambda s: [(s[1], s[3], None)] + s[5], +) +declaration_list %= ( + "id : type <- expr , declaration-list", + lambda s: [(s[1], s[3], s[5])] + s[7], +) + +case_list %= "id : type => expr ;", lambda s: [(s[1], s[3], s[5])] +case_list %= "id : type => expr ; case-list", lambda s: [(s[1], s[3], s[5])] + s[7] + +function_call %= "id ( expr-list )", lambda s: ast.MethodCallNode(s[1], s[3]) +function_call %= "atom . id ( expr-list )", lambda s: ast.MethodCallNode( + s[3], s[5], s[1] +) +function_call %= "atom @ type . id ( expr-list )", lambda s: ast.MethodCallNode( + s[5], s[7], s[1], s[3] +) + +expr_list %= "", lambda s: [] +expr_list %= "not-empty-expr-list", lambda s: s[1] +not_empty_expr_list %= "expr", lambda s: [s[1]] +not_empty_expr_list %= "expr , not-empty-expr-list", lambda s: [s[1]] + s[3] ##################### # Error Productions # @@ -320,42 +364,64 @@ def lexical_error(lexer): @G.parsing_error def parsing_error(parser: ShiftReduceParser): t = parser.current_token - parser.add_error(t.line, t.column, f'({t.line}, {t.column}) - SyntacticError: ERROR at or near "{t.lex}"') + parser.add_error( + t.line, + t.column, + f'({t.line}, {t.column}) - SyntacticError: ERROR at or near "{t.lex}"', + ) @G.production("feature-list -> attribute error feature-list") def feature_attribute_error(s): - s.add_error(2, f'({s[2].line}, {s[2].column}) - SyntacticError: ERROR at or near "{s[2].lex}"') + s.add_error( + 2, + f'({s[2].line}, {s[2].column}) - SyntacticError: ERROR at or near "{s[2].lex}"', + ) return [s[1]] + s[3] @G.production("feature-list -> method error feature-list") def feature_method_error(s): - s.add_error(2, f'({s[2].line}, {s[2].column}) - SyntacticError: ERROR at or near "{s[2].lex}"') + s.add_error( + 2, + f'({s[2].line}, {s[2].column}) - SyntacticError: ERROR at or near "{s[2].lex}"', + ) return [s[1]] + s[3] @G.production("case-list -> id : type => expr error") def case_list_error(s): - s.add_error(6, f'({s[6].line}, {s[6].column}) - SyntacticError: ERROR at or near "{s[6].lex}"') + s.add_error( + 6, + f'({s[6].line}, {s[6].column}) - SyntacticError: ERROR at or near "{s[6].lex}"', + ) return [(s[1], s[3], s[5])] @G.production("case-list -> id : type => expr error case-list") def case_list_error(s): - s.add_error(6, f'({s[6].line}, {s[6].column}) - SyntacticError:ERROR at or near "{s[6].lex}"') + s.add_error( + 6, + f'({s[6].line}, {s[6].column}) - SyntacticError:ERROR at or near "{s[6].lex}"', + ) return [(s[1], s[3], s[5])] + s[7] @G.production("block -> expr error") def block_single_error(s): - s.add_error(2, f'({s[2].line}, {s[2].column}) - SyntacticError: ERROR at or near "{s[2].lex}"') + s.add_error( + 2, + f'({s[2].line}, {s[2].column}) - SyntacticError: ERROR at or near "{s[2].lex}"', + ) return [s[1]] @G.production("block -> expr error block") def block_single_error(s): - s.add_error(2, f'({s[2].line}, {s[2].column}) - SyntacticError: ERROR at or near "{s[2].lex}"') + s.add_error( + 2, + f'({s[2].line}, {s[2].column}) - SyntacticError: ERROR at or near "{s[2].lex}"', + ) return [s[1]] + s[3] @@ -366,12 +432,16 @@ def serialize_parser_and_lexer(): import typer t = time.time() - G.serialize_lexer('CoolLexer', inspect.getmodulename(__file__)) - G.serialize_parser('lalr1', 'CoolParser', inspect.getmodulename(__file__)) - - styled_e = typer.style(f'Serialization Time : {time.time() - t} seconds', fg=typer.colors.GREEN, bold=True) + G.serialize_lexer("CoolLexer", inspect.getmodulename(__file__)) + G.serialize_parser("lalr1", "CoolParser", inspect.getmodulename(__file__)) + + styled_e = typer.style( + f"Serialization Time : {time.time() - t} seconds", + fg=typer.colors.GREEN, + bold=True, + ) typer.echo(styled_e) -if __name__ == '__main__': +if __name__ == "__main__": serialize_parser_and_lexer() diff --git a/src/cool/lexertab.py b/src/cool/lexertab.py index 993999786..8cccfd0ba 100644 --- a/src/cool/lexertab.py +++ b/src/cool/lexertab.py @@ -9,13 +9,25 @@ def __init__(self): self.lineno = 1 self.column = 1 self.position = 0 - self.token = Token('', '', 0, 0) - self.pattern = re.compile(r'(?P[a-z][a-zA-Z0-9_]*)|(?P[A-Z][a-zA-Z0-9_]*)|(?P\")|(?P--.*)|(?P\(\*)|(?P\n+)|(?P +)|(?P\t+)|(?P\d+)|(inherits)|(isvoid)|(class)|(while)|(false)|(then)|(else)|(loop)|(pool)|(case)|(esac)|(true)|(<\-)|(let)|(new)|(not)|(\{)|(\})|(\()|(\))|(\.)|(=>)|(if)|(fi)|(in)|(of)|(\+)|(\-)|(\*)|(<=)|(\~)|(,)|(:)|(;)|(@)|(/)|(<)|(=)') - self.token_rules = {key: rule for key, (_, _, rule) in G.terminal_rules.items() if rule is not None} - self.error_handler = G.lexical_error_handler if G.lexical_error_handler is not None else self.error + self.token = Token("", "", 0, 0) + self.pattern = re.compile( + r"(?P[a-z][a-zA-Z0-9_]*)|(?P[A-Z][a-zA-Z0-9_]*)|(?P\")|(?P--.*)|(?P\(\*)|(?P\n+)|(?P +)|(?P\t+)|(?P\d+)|(inherits)|(isvoid)|(class)|(while)|(false)|(then)|(else)|(loop)|(pool)|(case)|(esac)|(true)|(<\-)|(let)|(new)|(not)|(\{)|(\})|(\()|(\))|(\.)|(=>)|(if)|(fi)|(in)|(of)|(\+)|(\-)|(\*)|(<=)|(\~)|(,)|(:)|(;)|(@)|(/)|(<)|(=)" + ) + self.token_rules = { + key: rule + for key, (_, _, rule) in G.terminal_rules.items() + if rule is not None + } + self.error_handler = ( + G.lexical_error_handler + if G.lexical_error_handler is not None + else self.error + ) self._errors = [] self.contain_errors = False - self.eof = '$' - + self.eof = "$" + def __call__(self, text): - return [Token(t.lex, G[t.token_type], t.line, t.column) for t in self.tokenize(text)] + return [ + Token(t.lex, G[t.token_type], t.line, t.column) for t in self.tokenize(text) + ] diff --git a/src/cool/parsertab.py b/src/cool/parsertab.py index 1479bc252..2888ce2f3 100644 --- a/src/cool/parsertab.py +++ b/src/cool/parsertab.py @@ -10,7 +10,11 @@ def __init__(self, verbose=False): self.action = self.__action_table() self.goto = self.__goto_table() self._errors = [] - self.error_handler = G.parsing_error_handler if G.parsing_error_handler is not None else self.error + self.error_handler = ( + G.parsing_error_handler + if G.parsing_error_handler is not None + else self.error + ) @staticmethod def __action_table(): @@ -110,7 +114,10 @@ def __action_table(): (17, G[","]): ("SHIFT", 18), (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), (18, G["id"]): ("SHIFT", 15), - (19, G["in"]): ("REDUCE", G["declaration-list -> id : type , declaration-list"]), + (19, G["in"]): ( + "REDUCE", + G["declaration-list -> id : type , declaration-list"], + ), (20, G["int"]): ("SHIFT", 31), (20, G["true"]): ("SHIFT", 25), (20, G["id"]): ("SHIFT", 46), @@ -785,7 +792,10 @@ def __action_table(): (67, G["{"]): ("SHIFT", 10), (67, G["int"]): ("SHIFT", 31), (67, G["true"]): ("SHIFT", 25), - (68, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr , not-empty-expr-list"]), + (68, G[")"]): ( + "REDUCE", + G["not-empty-expr-list -> expr , not-empty-expr-list"], + ), (69, G["type"]): ("SHIFT", 70), (70, G["."]): ("SHIFT", 71), (71, G["id"]): ("SHIFT", 72), @@ -807,27 +817,90 @@ def __action_table(): (73, G["int"]): ("SHIFT", 31), (73, G["true"]): ("SHIFT", 25), (74, G[")"]): ("SHIFT", 75), - (75, G["."]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["else"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G[","]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["fi"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G[";"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["error"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["loop"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["@"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["pool"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["+"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["-"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["in"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["*"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["}"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["/"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["of"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["<="]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["<"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G[")"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), - (75, G["then"]): ("REDUCE", G["function-call -> atom @ type . id ( expr-list )"]), + (75, G["."]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["else"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["="]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G[","]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["fi"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G[";"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["error"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["loop"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["@"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["pool"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["+"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["-"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["in"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["*"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["}"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["/"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["of"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["<="]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["<"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G[")"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["then"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), (76, G["else"]): ("REDUCE", G["comp -> comp < negable-arith"]), (76, G["="]): ("REDUCE", G["comp -> comp < negable-arith"]), (76, G["in"]): ("REDUCE", G["comp -> comp < negable-arith"]), @@ -927,10 +1000,16 @@ def __action_table(): (87, G["error"]): ("SHIFT", 90), (88, G["id"]): ("SHIFT", 83), (88, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), - (89, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ; case-list"]), + (89, G["esac"]): ( + "REDUCE", + G["case-list -> id : type => expr ; case-list"], + ), (90, G["id"]): ("SHIFT", 83), (90, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), - (91, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error case-list"]), + (91, G["esac"]): ( + "REDUCE", + G["case-list -> id : type => expr error case-list"], + ), (92, G["esac"]): ("SHIFT", 93), (93, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), (93, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), @@ -947,7 +1026,10 @@ def __action_table(): (94, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), (94, G[","]): ("SHIFT", 95), (95, G["id"]): ("SHIFT", 15), - (96, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr , declaration-list"]), + (96, G["in"]): ( + "REDUCE", + G["declaration-list -> id : type <- expr , declaration-list"], + ), (97, G["in"]): ("SHIFT", 98), (98, G["id"]): ("SHIFT", 46), (98, G["if"]): ("SHIFT", 12), @@ -1160,7 +1242,10 @@ def __action_table(): (130, G["true"]): ("SHIFT", 25), (131, G["}"]): ("SHIFT", 132), (132, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), - (132, G["error"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (132, G["error"]): ( + "REDUCE", + G["method -> id ( param-list ) : type { expr }"], + ), (133, G["type"]): ("SHIFT", 134), (134, G[";"]): ("REDUCE", G["attribute -> id : type"]), (134, G["error"]): ("REDUCE", G["attribute -> id : type"]), @@ -1199,13 +1284,19 @@ def __action_table(): (146, G["}"]): ("REDUCE", G["feature-list -> method error feature-list"]), (147, G["id"]): ("SHIFT", 4), (147, G["}"]): ("REDUCE", G["feature-list -> e"]), - (148, G["}"]): ("REDUCE", G["feature-list -> attribute error feature-list"]), + (148, G["}"]): ( + "REDUCE", + G["feature-list -> attribute error feature-list"], + ), (149, G["type"]): ("SHIFT", 150), (150, G["{"]): ("SHIFT", 151), (151, G["id"]): ("SHIFT", 4), (151, G["}"]): ("REDUCE", G["feature-list -> e"]), (152, G["}"]): ("SHIFT", 153), - (153, G[";"]): ("REDUCE", G["class-def -> class type inherits type { feature-list }"]), + (153, G[";"]): ( + "REDUCE", + G["class-def -> class type inherits type { feature-list }"], + ), (154, G["$"]): ("OK", None), (155, G["$"]): ("REDUCE", G["program -> class-list"]), (156, G[";"]): ("SHIFT", 157), diff --git a/src/cool/semantics/utils/astnodes.py b/src/cool/semantics/utils/astnodes.py index b09cdb748..85e27acce 100644 --- a/src/cool/semantics/utils/astnodes.py +++ b/src/cool/semantics/utils/astnodes.py @@ -68,12 +68,14 @@ def __init__(self, expr: "ExprNode"): class BlockNode(ExprNode): - def __init__(self, expressions): + def __init__(self, expressions: List[ExprNode]): self.expressions: List[ExprNode] = expressions class LetNode(ExprNode): - def __init__(self, declarations, expr): + def __init__( + self, declarations: List[Tuple[str, str, Optional[ExprNode]]], expr: ExprNode + ): self.declarations: List[Tuple[str, str, Optional[ExprNode]]] = declarations self.expr: ExprNode = expr diff --git a/src/cool/visitor/visitor.py b/src/cool/visitor/visitor.py index c7f5e8175..3d605865f 100644 --- a/src/cool/visitor/visitor.py +++ b/src/cool/visitor/visitor.py @@ -22,7 +22,7 @@ import inspect -__all__ = ['on', 'when'] +__all__ = ["on", "when"] def on(param_name): @@ -36,7 +36,7 @@ def f(fn): 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__ + 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 @@ -78,7 +78,7 @@ def add_target(self, typ, target): @staticmethod def __argspec(fn): # Support for Python 3 type hints requires inspect.getfullargspec - if hasattr(inspect, 'getfullargspec'): + if hasattr(inspect, "getfullargspec"): return inspect.getfullargspec(fn) else: return inspect.getargspec(fn) diff --git a/src/coolc.py b/src/coolc.py index efea0322e..21ac15b23 100644 --- a/src/coolc.py +++ b/src/coolc.py @@ -2,19 +2,27 @@ import sys import subprocess -input_file = sys.argv[1].replace('\\', '\\\\') -output_file = input_file[:-2] + 'mips' +input_file = sys.argv[1].replace("\\", "\\\\") +output_file = input_file[:-2] + "mips" + +print("Stranger Bugs Cool Compiler v0.1") +print( + "Copyright (c) 2019: Alejandro Klever Clemente, Laura Tamayo Blanco, Miguel Angel Gonzalez Calles" +) -print('Stranger Bugs Cool Compiler v0.1') -print('Copyright (c) 2019: Alejandro Klever Clemente, Laura Tamayo Blanco, Miguel Angel Gonzalez Calles') def run(): - sp = subprocess.run(['python', 'cool', 'compile', input_file, output_file], capture_output=True, timeout=100) + sp = subprocess.run( + ["python", "cool", "compile", input_file, output_file], + capture_output=True, + timeout=100, + ) print(sp.stdout.decode()) exit(sp.returncode) -if os.getcwd().endswith('src'): + +if os.getcwd().endswith("src"): run() else: - os.chdir('src') + os.chdir("src") run() diff --git a/tests/codegen_test.py b/tests/codegen_test.py index b779e6aeb..299bc9eb6 100644 --- a/tests/codegen_test.py +++ b/tests/codegen_test.py @@ -5,8 +5,8 @@ from .utils import compare_outputs -tests_dir = str(pathlib.Path(__file__).parent / 'codegen') -tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] +tests_dir = str(pathlib.Path(__file__).parent / "codegen") +tests = [(file) for file in os.listdir(tests_dir) if file.endswith(".cl")] # @pytest.mark.lexer # @pytest.mark.parser @@ -16,7 +16,9 @@ @pytest.mark.run(order=4) @pytest.mark.parametrize("cool_file", tests) def test_codegen(compiler_path, cool_file): - compare_outputs(compiler_path, - str(os.path.join(tests_dir, cool_file)), - str(os.path.join(tests_dir, cool_file[:-3] + '_input.txt')), - str(os.path.join(tests_dir, cool_file[:-3] + '_output.txt'))) + compare_outputs( + compiler_path, + str(os.path.join(tests_dir, cool_file)), + str(os.path.join(tests_dir, cool_file[:-3] + "_input.txt")), + str(os.path.join(tests_dir, cool_file[:-3] + "_output.txt")), + ) diff --git a/tests/conftest.py b/tests/conftest.py index f357ea3da..66f97fe6a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -5,10 +5,10 @@ @pytest.fixture def compiler_path(): - extension = 'sh' if platform.system() != 'Windows' else 'py' + extension = "sh" if platform.system() != "Windows" else "py" - if os.getcwd().endswith('src'): - return os.path.abspath(f'./coolc.{extension}') - - # For local test using the testing system of visual studio code - return os.path.abspath(os.path.join('src', f'coolc.{extension}')) + if os.getcwd().endswith("src"): + return os.path.abspath(f"./coolc.{extension}") + + # For local test using the testing system of visual studio code + return os.path.abspath(os.path.join("src", f"coolc.{extension}")) diff --git a/tests/lexer_test.py b/tests/lexer_test.py index 3a7d81024..30170bdd3 100644 --- a/tests/lexer_test.py +++ b/tests/lexer_test.py @@ -5,8 +5,8 @@ from .utils import compare_errors -tests_dir = str(pathlib.Path(__file__).parent / 'lexer') -tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] +tests_dir = str(pathlib.Path(__file__).parent / "lexer") +tests = [(file) for file in os.listdir(tests_dir) if file.endswith(".cl")] @pytest.mark.lexer @@ -14,6 +14,8 @@ @pytest.mark.run(order=1) @pytest.mark.parametrize("cool_file", tests) def test_lexer_errors(compiler_path, cool_file): - compare_errors(compiler_path, - str(os.path.join(tests_dir, cool_file)), - str(os.path.join(tests_dir, cool_file[:-3] + '_error.txt'))) + compare_errors( + compiler_path, + str(os.path.join(tests_dir, cool_file)), + str(os.path.join(tests_dir, cool_file[:-3] + "_error.txt")), + ) diff --git a/tests/parser_test.py b/tests/parser_test.py index 7af9b9da3..3793fabc0 100644 --- a/tests/parser_test.py +++ b/tests/parser_test.py @@ -5,8 +5,8 @@ from .utils import compare_errors -tests_dir = str(pathlib.Path(__file__).parent / 'parser') -tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] +tests_dir = str(pathlib.Path(__file__).parent / "parser") +tests = [(file) for file in os.listdir(tests_dir) if file.endswith(".cl")] @pytest.mark.parser @@ -14,6 +14,8 @@ @pytest.mark.run(order=2) @pytest.mark.parametrize("cool_file", tests) def test_parser_errors(compiler_path, cool_file): - compare_errors(compiler_path, - str(os.path.join(tests_dir, cool_file)), - str(os.path.join(tests_dir, cool_file[:-3] + '_error.txt'))) + compare_errors( + compiler_path, + str(os.path.join(tests_dir, cool_file)), + str(os.path.join(tests_dir, cool_file[:-3] + "_error.txt")), + ) diff --git a/tests/semantic_test.py b/tests/semantic_test.py index 5cca882d9..6dee3cfd3 100644 --- a/tests/semantic_test.py +++ b/tests/semantic_test.py @@ -5,15 +5,18 @@ from .utils import compare_errors, first_error_only_line -tests_dir = str(pathlib.Path(__file__).parent / 'semantic') -tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] +tests_dir = str(pathlib.Path(__file__).parent / "semantic") +tests = [(file) for file in os.listdir(tests_dir) if file.endswith(".cl")] + @pytest.mark.semantic @pytest.mark.error @pytest.mark.run(order=3) @pytest.mark.parametrize("cool_file", tests) def test_semantic_errors(compiler_path, cool_file): - compare_errors(compiler_path, - str(os.path.join(tests_dir, cool_file)), - str(os.path.join(tests_dir, cool_file[:-3] + '_error.txt')), - cmp=first_error_only_line) + compare_errors( + compiler_path, + str(os.path.join(tests_dir, cool_file)), + str(os.path.join(tests_dir, cool_file[:-3] + "_error.txt")), + cmp=first_error_only_line, + ) diff --git a/tests/utils/__init__.py b/tests/utils/__init__.py index 90f60fdd8..16281fe0b 100644 --- a/tests/utils/__init__.py +++ b/tests/utils/__init__.py @@ -1 +1 @@ -from .utils import * \ No newline at end of file +from .utils import * diff --git a/tests/utils/utils.py b/tests/utils/utils.py index 3a19269cc..b52a8a7c0 100644 --- a/tests/utils/utils.py +++ b/tests/utils/utils.py @@ -3,16 +3,17 @@ import platform -COMPILER_TIMEOUT = 'El compilador tarda mucho en responder.' -SPIM_TIMEOUT = 'El spim tarda mucho en responder.' -TEST_MUST_FAIL = 'El test %s debe fallar al compilar' -TEST_MUST_COMPILE = 'El test %s debe compilar' -BAD_ERROR_FORMAT = '''El error no esta en formato: (,) - : - o no se encuentra en la 3ra linea\n\n%s''' -UNEXPECTED_ERROR = 'Se esperaba un %s en (%d, %d). Su error fue un %s en (%d, %d)' -UNEXPECTED_OUTPUT = 'La salida de %s no es la esperada:\n%s\nEsperada:\n%s' +COMPILER_TIMEOUT = "El compilador tarda mucho en responder." +SPIM_TIMEOUT = "El spim tarda mucho en responder." +TEST_MUST_FAIL = "El test %s debe fallar al compilar" +TEST_MUST_COMPILE = "El test %s debe compilar" +BAD_ERROR_FORMAT = """El error no esta en formato: (,) - : + o no se encuentra en la 3ra linea\n\n%s""" +UNEXPECTED_ERROR = "Se esperaba un %s en (%d, %d). Su error fue un %s en (%d, %d)" +UNEXPECTED_OUTPUT = "La salida de %s no es la esperada:\n%s\nEsperada:\n%s" + +ERROR_FORMAT = r"^\s*\(\s*(\d+)\s*,\s*(\d+)\s*\)\s*-\s*(\w+)\s*:(.*)$" -ERROR_FORMAT = r'^\s*\(\s*(\d+)\s*,\s*(\d+)\s*\)\s*-\s*(\w+)\s*:(.*)$' def parse_error(error: str): merror = re.fullmatch(ERROR_FORMAT, error) @@ -26,73 +27,122 @@ def first_error(compiler_output: list, errors: list): oline, ocolumn, oerror_type, _ = parse_error(compiler_output[0]) - assert line == oline and column == ocolumn and error_type == oerror_type,\ - UNEXPECTED_ERROR % (error_type, line, column, oerror_type, oline, ocolumn) + assert ( + line == oline and column == ocolumn and error_type == oerror_type + ), UNEXPECTED_ERROR % (error_type, line, column, oerror_type, oline, ocolumn) + def first_error_only_line(compiler_output: list, errors: list): line, column, error_type, _ = parse_error(errors[0]) oline, ocolumn, oerror_type, _ = parse_error(compiler_output[0]) - assert line == oline and error_type == oerror_type,\ - UNEXPECTED_ERROR % (error_type, line, column, oerror_type, oline, ocolumn) + assert line == oline and error_type == oerror_type, UNEXPECTED_ERROR % ( + error_type, + line, + column, + oerror_type, + oline, + ocolumn, + ) def get_file_name(path: str): try: - return path[path.rindex('/') + 1:] + return path[path.rindex("/") + 1 :] except ValueError: return path -def compare_errors(compiler_path: str, cool_file_path: str, error_file_path: str, cmp=first_error, timeout=100): + +def compare_errors( + compiler_path: str, + cool_file_path: str, + error_file_path: str, + cmp=first_error, + timeout=100, +): try: - if platform.system() == 'Windows': - sp = subprocess.run(['python', compiler_path, cool_file_path], capture_output=True, timeout=timeout) + if platform.system() == "Windows": + sp = subprocess.run( + ["python", compiler_path, cool_file_path], + capture_output=True, + timeout=timeout, + ) else: - sp = subprocess.run(['bash', compiler_path, cool_file_path], capture_output=True, timeout=timeout) + sp = subprocess.run( + ["bash", compiler_path, cool_file_path], + capture_output=True, + timeout=timeout, + ) return_code, output = sp.returncode, sp.stdout.decode() except subprocess.TimeoutExpired: assert False, COMPILER_TIMEOUT assert return_code == 1, TEST_MUST_FAIL % get_file_name(cool_file_path) - fd = open(error_file_path, 'r') - errors = fd.read().split('\n') + fd = open(error_file_path, "r") + errors = fd.read().split("\n") fd.close() # checking the errors of compiler - compiler_output = output.split('\n') + compiler_output = output.split("\n") cmp(compiler_output[2:], errors) -SPIM_HEADER = r'''^SPIM Version .+ of .+ + +SPIM_HEADER = r"""^SPIM Version .+ of .+ Copyright .+\, James R\. Larus\. All Rights Reserved\. See the file README for a full copyright notice\. -(?:Loaded: .+\n)*''' -def compare_outputs(compiler_path: str, cool_file_path: str, input_file_path: str, output_file_path: str, timeout=100): +(?:Loaded: .+\n)*""" + + +def compare_outputs( + compiler_path: str, + cool_file_path: str, + input_file_path: str, + output_file_path: str, + timeout=100, +): try: - if platform.system() == 'Windows': - sp = subprocess.run(['python', compiler_path, cool_file_path], capture_output=True, timeout=timeout) + if platform.system() == "Windows": + sp = subprocess.run( + ["python", compiler_path, cool_file_path], + capture_output=True, + timeout=timeout, + ) else: - sp = subprocess.run(['bash', compiler_path, cool_file_path], capture_output=True, timeout=timeout) + sp = subprocess.run( + ["bash", compiler_path, cool_file_path], + capture_output=True, + timeout=timeout, + ) assert sp.returncode == 0, TEST_MUST_COMPILE % get_file_name(cool_file_path) except subprocess.TimeoutExpired: assert False, COMPILER_TIMEOUT - spim_file = cool_file_path[:-2] + 'mips' + spim_file = cool_file_path[:-2] + "mips" try: - fd = open(input_file_path, 'rb') - sp = subprocess.run(['spim', '-file', spim_file], input=fd.read(), capture_output=True, timeout=timeout) + fd = open(input_file_path, "rb") + sp = subprocess.run( + ["spim", "-file", spim_file], + input=fd.read(), + capture_output=True, + timeout=timeout, + ) fd.close() mo = re.match(SPIM_HEADER, sp.stdout.decode()) if mo: - output = mo.string[mo.end():] + output = mo.string[mo.end() :] except subprocess.TimeoutExpired: assert False, SPIM_TIMEOUT - fd = open(output_file_path, 'r') + fd = open(output_file_path, "r") eoutput = fd.read() fd.close() - assert output == eoutput, UNEXPECTED_OUTPUT % (spim_file, repr(output), repr(eoutput)) + assert output == eoutput, UNEXPECTED_OUTPUT % ( + spim_file, + repr(output), + repr(eoutput), + ) From fe949e305157d90f92888cde1ee8c4245a736683 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Fri, 8 Oct 2021 03:23:13 -0400 Subject: [PATCH 123/143] created a constructor creator --- main.cl | 34 +++++++++++++++++++ src/cool/__main__.py | 7 +++- src/cool/code_generation/__init__.py | 1 + .../code_generation/cool_to_cil_visitor.py | 4 +-- src/cool/semantics/formatter.py | 4 ++- src/cool/semantics/position_assigner.py | 15 ++++++++ 6 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 main.cl diff --git a/main.cl b/main.cl new file mode 100644 index 000000000..162bba94d --- /dev/null +++ b/main.cl @@ -0,0 +1,34 @@ +class Main { + + main() : Object { + let io: IO <- new IO, p: Point <- (new Point).init(5, 6) in { + io.out_string("("); + io.out_int(p.get_x()); + io.out_string(","); + io.out_int(p.get_y()); + io.out_string(")"); + io.out_string("\n"); + } + }; +}; + +class Point { + x: Int <- 0; + y: Int <- 0; + + init (x0: Int, y0: Int ): Point{ + { + x <- x0; + y <- y0; + self; + } + }; + + get_x(): Int { + x + }; + + get_y(): Int { + y + }; +}; \ No newline at end of file diff --git a/src/cool/__main__.py b/src/cool/__main__.py index 1622c8b07..8bef9bef5 100644 --- a/src/cool/__main__.py +++ b/src/cool/__main__.py @@ -11,6 +11,7 @@ from cool.lexertab import CoolLexer from cool.parsertab import CoolParser from cool.semantics import ( + CodeBuilder, OverriddenMethodChecker, PositionAssigner, TypeBuilderForFeatures, @@ -19,6 +20,7 @@ TypeCollector, topological_sorting, ) +from cool.code_generation import ConstructorCreator from cool.semantics.utils.scope import Context, Scope app = typer.Typer() @@ -114,13 +116,16 @@ def compile( exit(1) PositionAssigner(tokens).visit(ast) - ast, _, _, errors = check_semantics(ast, Scope(), Context(), []) + ast, scope, context, errors = check_semantics(ast, Scope(), Context(), []) if errors or parser.contains_errors: for e in errors: log_error(e) exit(1) + ast = ConstructorCreator(context).visit(ast, scope) + log_success(CodeBuilder().visit(ast)) + exit(0) diff --git a/src/cool/code_generation/__init__.py b/src/cool/code_generation/__init__.py index e69de29bb..245cb0fbc 100644 --- a/src/cool/code_generation/__init__.py +++ b/src/cool/code_generation/__init__.py @@ -0,0 +1 @@ +from .cool_to_cil_visitor import ConstructorCreator diff --git a/src/cool/code_generation/cool_to_cil_visitor.py b/src/cool/code_generation/cool_to_cil_visitor.py index eb870a8bd..b362f55cb 100644 --- a/src/cool/code_generation/cool_to_cil_visitor.py +++ b/src/cool/code_generation/cool_to_cil_visitor.py @@ -49,7 +49,7 @@ def visit(self, node: ast.ClassDeclarationNode, scope: Scope): attrs += [ feature for feature in ancestor.features - if isinstance(feature, ast.Attribute) + if isinstance(feature, ast.AttrDeclarationNode) ] expressions: List[ast.ExprNode] = [] @@ -59,7 +59,7 @@ def visit(self, node: ast.ClassDeclarationNode, scope: Scope): if expr: expressions.append(expr) - body = ast.BlockNode(expr) + body = ast.BlockNode(expressions) constructor = ast.MethodDeclarationNode( "__init__", [], self.current_type.name, body ) diff --git a/src/cool/semantics/formatter.py b/src/cool/semantics/formatter.py index d5bb9793b..0478b010f 100644 --- a/src/cool/semantics/formatter.py +++ b/src/cool/semantics/formatter.py @@ -52,7 +52,9 @@ def visit(self, node: ast.AssignNode, tabs: int = 0): @visitor.when(ast.BlockNode) def visit(self, node: ast.BlockNode, tabs: int = 0): body = ";\n".join(self.visit(child, tabs + 1) for child in node.expressions) - return " " * tabs + f"{{\n{body};\n" + " " * tabs + "}" + if body: + body += ";" + return " " * tabs + f"{{\n{body}\n" + " " * tabs + "}" @visitor.when(ast.ConditionalNode) def visit(self, node: ast.ConditionalNode, tabs: int = 0): diff --git a/src/cool/semantics/position_assigner.py b/src/cool/semantics/position_assigner.py index 75c419511..163145691 100644 --- a/src/cool/semantics/position_assigner.py +++ b/src/cool/semantics/position_assigner.py @@ -363,13 +363,28 @@ def visit(self, node: ast.InstantiateNode): * new type """ + token = self.tokens[self.position] + + count = 0 + while token.lex == "(": + count += 1 + self.inc_position() + token = self.tokens[self.position] + + + assert token.lex == "new", f"Expected 'new' instead of '{token.lex}'" + node.set_main_position(token.line, token.column) token = self.tokens[self.position + 1] node.type_position = token.line, token.column self.inc_position(2) # ends after `type` + while count: + self.inc_position() + count -= 1 + @visitor.when(ast.NegationNode) def visit(self, node: ast.NegationNode): self._check_unary_operation(node) From aeebee6687e7ce6c3638221b718834a917564b85 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Sat, 30 Oct 2021 05:33:59 -0400 Subject: [PATCH 124/143] Generating cil --- main.cl | 21 +- src/cool/__main__.py | 23 ++- src/cool/code_generation/__init__.py | 3 +- src/cool/code_generation/base.py | 7 +- src/cool/code_generation/cil.py | 132 ++++++------ .../code_generation/cool_to_cil_visitor.py | 188 ++++++++++++++---- src/cool/code_generation/icool.py | 6 + src/cool/grammar.py | 68 +++---- src/cool/semantics/formatter.py | 119 +++++------ src/cool/semantics/overridden.py | 22 +- src/cool/semantics/position_assigner.py | 117 ++++++----- .../semantics/type_builder_for_features.py | 18 +- .../semantics/type_builder_for_inheritance.py | 10 +- src/cool/semantics/type_checker.py | 116 +++++------ src/cool/semantics/type_collector.py | 8 +- src/cool/semantics/type_inference.py | 174 ++++++++-------- src/cool/semantics/utils/astnodes.py | 10 +- src/cool/semantics/utils/scope.py | 2 +- 18 files changed, 599 insertions(+), 445 deletions(-) create mode 100644 src/cool/code_generation/icool.py diff --git a/main.cl b/main.cl index 162bba94d..8174685fd 100644 --- a/main.cl +++ b/main.cl @@ -1,7 +1,6 @@ class Main { - main() : Object { - let io: IO <- new IO, p: Point <- (new Point).init(5, 6) in { + let io: IO <- new IO, p: Point <- (new Point).init(1, 2) in { io.out_string("("); io.out_int(p.get_x()); io.out_string(","); @@ -15,8 +14,9 @@ class Main { class Point { x: Int <- 0; y: Int <- 0; + point: Point; - init (x0: Int, y0: Int ): Point{ + init (x0: Int, y0: Int): Point{ { x <- x0; y <- y0; @@ -31,4 +31,19 @@ class Point { get_y(): Int { y }; +}; + +class Point3D inherits Point { + z: Int <- 0; + + init (x0: Int, y0: Int): Point{ + { + z <- 0; + self@Point.init(x0, y0); + } + }; + + get_z(): Int { + z + }; }; \ No newline at end of file diff --git a/src/cool/__main__.py b/src/cool/__main__.py index 8bef9bef5..95371a4a7 100644 --- a/src/cool/__main__.py +++ b/src/cool/__main__.py @@ -20,7 +20,7 @@ TypeCollector, topological_sorting, ) -from cool.code_generation import ConstructorCreator +from cool.code_generation import ConstructorCreator, CoolToCILVisitor, CILFormatter from cool.semantics.utils.scope import Context, Scope app = typer.Typer() @@ -89,6 +89,10 @@ def check_semantics(ast, scope: Scope, context: Context, errors: List[str]): return ast, scope, context, errors +def cool_to_cil(): + pass + + @app.command() def compile( input_file: typer.FileText = typer.Argument(..., help="Cool file"), @@ -123,8 +127,21 @@ def compile( log_error(e) exit(1) - ast = ConstructorCreator(context).visit(ast, scope) - log_success(CodeBuilder().visit(ast)) + ################### + # Code Generation # + ################### + # icool_ast = ConstructorCreator(context).visit(ast, scope) + + # if verbose: + # log_success(CodeBuilder().visit(icool_ast)) + + # cil_ast = CoolToCILVisitor(context).visit(icool_ast, scope) + + # if verbose or True: + # log_success(CILFormatter().visit(cil_ast)) + ####### + # End # + ####### exit(0) diff --git a/src/cool/code_generation/__init__.py b/src/cool/code_generation/__init__.py index 245cb0fbc..404fa3849 100644 --- a/src/cool/code_generation/__init__.py +++ b/src/cool/code_generation/__init__.py @@ -1 +1,2 @@ -from .cool_to_cil_visitor import ConstructorCreator +from .cool_to_cil_visitor import ConstructorCreator, CoolToCILVisitor +from .cil import CILFormatter diff --git a/src/cool/code_generation/base.py b/src/cool/code_generation/base.py index 1ead52823..058ffcec7 100644 --- a/src/cool/code_generation/base.py +++ b/src/cool/code_generation/base.py @@ -16,6 +16,10 @@ def __init__(self, context: Context): self.context: Context = context + self.locals_dict = {} + self.param_set = set() + self.attr_set = set() + @property def params(self) -> List[cil.ParamNode]: return self.current_function.params @@ -32,12 +36,13 @@ def register_local(self, var_name: str) -> str: local_name = ( f"local_{self.current_function.name[9:]}_{var_name}_{len(self.localvars)}" ) + local_name = var_name local_node = cil.LocalNode(local_name) self.localvars.append(local_node) return local_name def define_internal_local(self) -> str: - return self.register_local("internal") + return self.register_local(f"internal_{len(self.localvars)}") def register_instruction( self, instruction: cil.InstructionNode diff --git a/src/cool/code_generation/cil.py b/src/cool/code_generation/cil.py index 8237ba5eb..b455f5ab7 100644 --- a/src/cool/code_generation/cil.py +++ b/src/cool/code_generation/cil.py @@ -105,9 +105,9 @@ class SetIndexNode(InstructionNode): class AllocateNode(InstructionNode): - def __init__(self, itype, dest): - self.type = itype - self.dest = dest + def __init__(self, itype: str, dest: str): + self.type: str = itype + self.dest: str = dest class ArrayNode(InstructionNode): @@ -139,7 +139,7 @@ def __init__(self, function, dest): class DynamicCallNode(InstructionNode): - def __init__(self, xtype, method, dest): + def __init__(self, xtype: str, method: str, dest: str): self.type = xtype self.method = method self.dest = dest @@ -193,86 +193,82 @@ def __init__(self, str_addr): self.str_addr = str_addr -def get_formatter(): - class PrintVisitor(object): - @visitor.on("node") - def visit(self, node): - pass - - @visitor.when(ProgramNode) - def visit(self, node): - 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) +class CILFormatter(object): + @visitor.on("node") + def visit(self, node): + pass - return f".TYPES\n{dottypes}\n\n.DATA\n{dotdata}\n\n.CODE\n{dotcode}" + @visitor.when(ProgramNode) + def visit(self, node): + 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) - @visitor.when(TypeNode) - def visit(self, node): - attributes = "\n\t".join(f"attribute {x}" for x in node.attributes) - methods = "\n\t".join(f"method {x}: {y}" for x, y in node.methods) + return f".TYPES\n{dottypes}\n\n.DATA\n{dotdata}\n\n.CODE\n{dotcode}" - return f"type {node.name} {{\n\t{attributes}\n\n\t{methods}\n}}" + @visitor.when(TypeNode) + def visit(self, node): + attributes = "\n\t".join(f"attribute {x}" for x in node.attributes) + methods = "\n\t".join(f"method {x}: {y}" for x, y in node.methods) - @visitor.when(FunctionNode) - def visit(self, node): - params = "\n\t".join(self.visit(x) for x in node.params) - local_vars = "\n\t".join(self.visit(x) for x in node.local_vars) - instructions = "\n\t".join(self.visit(x) for x in node.instructions) + return f"type {node.name} {{\n\t{attributes}\n\n\t{methods}\n}}" - return f"function {node.name} {{\n\t{params}\n\n\t{local_vars}\n\n\t{instructions}\n}}" + @visitor.when(FunctionNode) + def visit(self, node): + params = "\n\t".join(self.visit(x) for x in node.params) + local_vars = "\n\t".join(self.visit(x) for x in node.local_vars) + instructions = "\n\t".join(self.visit(x) for x in node.instructions) - @visitor.when(ParamNode) - def visit(self, node): - return f"PARAM {node.name}" + return f"function {node.name} {{\n\t{params}\n\n\t{local_vars}\n\n\t{instructions}\n}}" - @visitor.when(LocalNode) - def visit(self, node): - return f"LOCAL {node.name}" + @visitor.when(ParamNode) + def visit(self, node): + return f"PARAM {node.name}" - @visitor.when(AssignNode) - def visit(self, node): - return f"{node.dest} = {node.source}" + @visitor.when(LocalNode) + def visit(self, node): + return f"LOCAL {node.name}" - @visitor.when(PlusNode) - def visit(self, node): - return f"{node.dest} = {node.left} + {node.right}" + @visitor.when(AssignNode) + def visit(self, node): + return f"{node.dest} = {node.source}" - @visitor.when(MinusNode) - def visit(self, node): - return f"{node.dest} = {node.left} - {node.right}" + @visitor.when(PlusNode) + def visit(self, node): + return f"{node.dest} = {node.left} + {node.right}" - @visitor.when(StarNode) - def visit(self, node): - return f"{node.dest} = {node.left} * {node.right}" + @visitor.when(MinusNode) + def visit(self, node): + return f"{node.dest} = {node.left} - {node.right}" - @visitor.when(DivNode) - def visit(self, node): - return f"{node.dest} = {node.left} / {node.right}" + @visitor.when(StarNode) + def visit(self, node): + return f"{node.dest} = {node.left} * {node.right}" - @visitor.when(AllocateNode) - def visit(self, node): - return f"{node.dest} = ALLOCATE {node.type}" + @visitor.when(DivNode) + def visit(self, node): + return f"{node.dest} = {node.left} / {node.right}" - @visitor.when(TypeOfNode) - def visit(self, node): - return f"{node.dest} = TYPEOF {node.type}" + @visitor.when(AllocateNode) + def visit(self, node): + return f"{node.dest} = ALLOCATE {node.type}" - @visitor.when(StaticCallNode) - def visit(self, node): - return f"{node.dest} = CALL {node.function}" + @visitor.when(TypeOfNode) + def visit(self, node): + return f"{node.dest} = TYPEOF {node.type}" - @visitor.when(DynamicCallNode) - def visit(self, node): - return f"{node.dest} = VCALL {node.type} {node.method}" + @visitor.when(StaticCallNode) + def visit(self, node): + return f"{node.dest} = CALL {node.function}" - @visitor.when(ArgNode) - def visit(self, node): - return f"ARG {node.name}" + @visitor.when(DynamicCallNode) + def visit(self, node): + return f"{node.dest} = VCALL {node.type} {node.method}" - @visitor.when(ReturnNode) - def visit(self, node): - return f'RETURN {node.value if node.value is not None else ""}' + @visitor.when(ArgNode) + def visit(self, node): + return f"ARG {node.name}" - printer = PrintVisitor() - return lambda ast: printer.visit(ast) + @visitor.when(ReturnNode) + def visit(self, node): + return f'\n\tRETURN {node.value if node.value is not None else ""}' diff --git a/src/cool/code_generation/cool_to_cil_visitor.py b/src/cool/code_generation/cool_to_cil_visitor.py index b362f55cb..887ad9e49 100644 --- a/src/cool/code_generation/cool_to_cil_visitor.py +++ b/src/cool/code_generation/cool_to_cil_visitor.py @@ -1,10 +1,11 @@ from typing import Dict, List, Optional import cool.code_generation.cil as cil -import cool.semantics.utils.astnodes as ast +import cool.code_generation.icool as icool +import cool.semantics.utils.astnodes as cool import cool.visitor.visitor as visitor from cool.code_generation.base import BaseCOOLToCILVisitor -from cool.semantics.utils.scope import Attribute, Context, Method, Scope, Type +from cool.semantics.utils.scope import Context, Method, Scope, Type class ConstructorCreator: @@ -12,15 +13,15 @@ def __init__(self, context: Context): self.current_type: Optional[Type] = None self.current_method: Optional[Method] = None self.context: Context = context - self.class_declarations = {} # type: Dict[str, ast.ClassDeclarationNode] + self.class_declarations = {} # type: Dict[str, cool.ClassDeclarationNode] @visitor.on("node") def visit(self, node, scope): pass - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode, scope: Scope): - declarations: List[ast.ClassDeclarationNode] = [] + @visitor.when(cool.ProgramNode) + def visit(self, node: cool.ProgramNode, scope: Scope): + declarations: List[cool.ClassDeclarationNode] = [] for declaration in node.declarations: self.class_declarations[declaration.id] = declaration @@ -28,10 +29,10 @@ def visit(self, node: ast.ProgramNode, scope: Scope): for declaration in node.declarations: declarations.append(self.visit(declaration, scope)) - return ast.ProgramNode(declarations) + return cool.ProgramNode(declarations) - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode, scope: Scope): + @visitor.when(cool.ClassDeclarationNode) + def visit(self, node: cool.ClassDeclarationNode, scope: Scope): self.current_type = self.context.get_type(node.id) ancestors = [ @@ -49,30 +50,58 @@ def visit(self, node: ast.ClassDeclarationNode, scope: Scope): attrs += [ feature for feature in ancestor.features - if isinstance(feature, ast.AttrDeclarationNode) + if isinstance(feature, cool.AttrDeclarationNode) ] - expressions: List[ast.ExprNode] = [] + expressions: List[cool.ExprNode] = [] for attr in attrs: - expr = self.visit(attr, scope) + expressions.append(self.visit(attr, scope)) + expressions.append(cool.VariableNode("self")) - if expr: - expressions.append(expr) - - body = ast.BlockNode(expressions) - constructor = ast.MethodDeclarationNode( + body = cool.BlockNode(expressions) + constructor = cool.MethodDeclarationNode( "__init__", [], self.current_type.name, body ) - return ast.ClassDeclarationNode( - node.id, [constructor] + node.features, node.parent - ) - - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode, scope: Scope): + + # Added the Type + self.current_type.define_method("__init__", [], [], self.current_type) + + attr = [ + feature + for feature in node.features + if isinstance(feature, cool.AttrDeclarationNode) + ] + methods = [ + feature + for feature in node.features + if isinstance(feature, cool.MethodDeclarationNode) + ] + features = attrs + [constructor] + methods + + return cool.ClassDeclarationNode(node.id, features, node.parent) + + @visitor.when(cool.AttrDeclarationNode) + def visit(self, node: cool.AttrDeclarationNode, scope: Scope): if node.expr is None: - return None - - return ast.AssignNode(node.id, node.expr) + expr = None + if node.type == "Int": + expr = cool.IntegerNode("0") + elif node.type == "Bool": + expr = cool.BooleanNode("false") + elif node.type == "String": + expr = cool.StringNode('""') + else: + expr = ( + icool.VoidNode() + ) # cool.WhileNode(cool.BooleanNode("false"), cool.IntegerNode("0")) + + return cool.AssignNode(node.id, expr) + + return cool.AssignNode(node.id, node.expr) + + +# Notes: +# 1 - All the expression nodes are going to return a tuple [str, Type] class CoolToCILVisitor(BaseCOOLToCILVisitor): @@ -80,15 +109,15 @@ class CoolToCILVisitor(BaseCOOLToCILVisitor): def visit(self, node, scope): pass - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode, scope: Scope): + @visitor.when(cool.ProgramNode) + def visit(self, node: cool.ProgramNode, scope: Scope): for declaration in node.declarations: self.visit(declaration, scope) return cil.ProgramNode(self.dottypes, self.dotdata, self.dotcode) - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode, scope: Scope): + @visitor.when(cool.ClassDeclarationNode) + def visit(self, node: cool.ClassDeclarationNode, scope: Scope): self.current_type = self.context.get_type(node.id) type_node = self.register_type(self.current_type.name) @@ -96,21 +125,106 @@ def visit(self, node: ast.ClassDeclarationNode, scope: Scope): methods = [ feature for feature in node.features - if isinstance(feature, ast.MethodDeclarationNode) + if isinstance(feature, cool.MethodDeclarationNode) ] for attr, _ in self.current_type.all_attributes(): self.visit(attr, scope) type_node.attributes.append(attr.name) - for method, child_scope in zip(methods, scope.children): - self.visit(method, child_scope) + visited = set() + for method, _ in self.current_type.all_methods(): + + if method.name in visited: + continue + + visited.add(method.name) + _, ancestor = self.current_type.get_method(method.name, get_owner=True) + type_node.methods.append( - (method.id, self.to_function_name(method.id, node.id)) + (method.name, self.to_function_name(method.name, ancestor.name)) ) - self.dottypes.append(type_node) + for method, child_scope in zip(methods, scope.children): + self.visit(method, child_scope) - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode, scope: Scope): + @visitor.when(cool.AttrDeclarationNode) + def visit(self, node: cool.AttrDeclarationNode, scope: Scope): pass + + @visitor.when(cool.MethodDeclarationNode) + def visit(self, node: cool.MethodDeclarationNode, scope: Scope): + self.current_method, owner_type = self.current_type.get_method( + node.id, get_owner=True + ) + function_name = self.to_function_name(self.current_method.name, owner_type.name) + self.current_function = self.register_function(function_name) + + self.current_function.params = [cil.ParamNode("self")] + [ + cil.ParamNode(param_name) for param_name, _ in node.params + ] + + self.visit(node.body, scope) + + @visitor.when(cool.LetNode) + def visit(self, node: cool.LetNode, scope: Scope): + i = 0 + for name, _, expr in node.declarations: + self.register_local(name) + + if expr: + source, _ = self.visit(expr, scope.children[i]) + if source: + self.register_instruction(cil.AssignNode(name, source)) + i += 1 + + self.register_instruction(cil.ReturnNode(0)) + + @visitor.when(cool.BlockNode) + def visit(self, node: cool.BlockNode, scope: Scope): + child_scope = scope.create_child() + return_type = ErrorType() + for expr in node.expressions: + return_type = self.visit(expr, child_scope) + return return_type + + @visitor.when(cool.MethodCallNode) + def visit(self, node: cool.MethodCallNode, scope: Scope): + obj_source, obj_type = self.visit(node.obj, scope) + + args_sources = [] + for arg in node.args: + arg_source, _ = self.visit(arg, scope) + args_sources.append(arg_source) + + self.register_instruction(cil.ArgNode(obj_source)) + for arg_source in args_sources: + self.register_instruction(cil.ArgNode(arg_source)) + + call_dest = self.define_internal_local() + method = obj_type.get_method(node.id) + self.register_instruction( + cil.DynamicCallNode( + obj_type.name, self.to_function_name(node.id, obj_type.name), call_dest + ) + ) + return call_dest, method.return_type + + @visitor.when(cool.IntegerNode) + def visit(self, node: cool.IntegerNode, scope: Scope): + return node.lex, self.context.get_type("Int") + + + @visitor.when(cool.StringNode) + def visit(self, node: cool.StringNode, scope: Scope): + return node.lex, self.context.get_type("String") + + @visitor.when(cool.BooleanNode) + def visit(self, node: cool.BooleanNode, scope: Scope): + return node.lex, self.context.get_type("Bool") + + @visitor.when(cool.InstantiateNode) + def visit(self, node: cool.InstantiateNode, scope: Scope): + local = self.define_internal_local() + self.instructions.append(cil.AllocateNode(node.lex, local)) + return local, self.context.get_type(node.lex) diff --git a/src/cool/code_generation/icool.py b/src/cool/code_generation/icool.py new file mode 100644 index 000000000..486b1f78d --- /dev/null +++ b/src/cool/code_generation/icool.py @@ -0,0 +1,6 @@ +import cool.semantics.utils.astnodes as cool + + +class VoidNode(cool.AtomicNode): + def __init__(self): + super().__init__("null") diff --git a/src/cool/grammar.py b/src/cool/grammar.py index 35b641b30..1a15e430c 100644 --- a/src/cool/grammar.py +++ b/src/cool/grammar.py @@ -3,7 +3,7 @@ from pyjapt import Grammar, Lexer, ShiftReduceParser, Token -import cool.semantics.utils.astnodes as ast +import cool.semantics.utils.astnodes as cool G = Grammar() @@ -253,76 +253,76 @@ def lexical_error(lexer): ############### # Productions # ############### -program %= "class-list", lambda s: ast.ProgramNode(s[1]) +program %= "class-list", lambda s: cool.ProgramNode(s[1]) class_list %= "class-def ;", lambda s: [s[1]] class_list %= "class-def ; class-list", lambda s: [s[1]] + s[3] -class_def %= "class type { feature-list }", lambda s: ast.ClassDeclarationNode( +class_def %= "class type { feature-list }", lambda s: cool.ClassDeclarationNode( s[2], s[4] ) class_def %= ( "class type inherits type { feature-list }", - lambda s: ast.ClassDeclarationNode(s[2], s[6], s[4]), + lambda s: cool.ClassDeclarationNode(s[2], s[6], s[4]), ) feature_list %= "", lambda s: [] feature_list %= "attribute ; feature-list", lambda s: [s[1]] + s[3] feature_list %= "method ; feature-list", lambda s: [s[1]] + s[3] -attribute %= "id : type", lambda s: ast.AttrDeclarationNode(s[1], s[3]) -attribute %= "id : type <- expr", lambda s: ast.AttrDeclarationNode(s[1], s[3], s[5]) +attribute %= "id : type", lambda s: cool.AttrDeclarationNode(s[1], s[3]) +attribute %= "id : type <- expr", lambda s: cool.AttrDeclarationNode(s[1], s[3], s[5]) -method %= "id ( ) : type { expr }", lambda s: ast.MethodDeclarationNode( +method %= "id ( ) : type { expr }", lambda s: cool.MethodDeclarationNode( s[1], [], s[5], s[7] ) -method %= "id ( param-list ) : type { expr }", lambda s: ast.MethodDeclarationNode( +method %= "id ( param-list ) : type { expr }", lambda s: cool.MethodDeclarationNode( s[1], s[3], s[6], s[8] ) param_list %= "id : type", lambda s: [(s[1], s[3])] param_list %= "id : type , param-list", lambda s: [(s[1], s[3])] + s[5] -expr %= "id <- expr", lambda s: ast.AssignNode(s[1], s[3]) -expr %= "{ block }", lambda s: ast.BlockNode(s[2]) -expr %= "while expr loop expr pool", lambda s: ast.WhileNode(s[2], s[4]) -expr %= "let declaration-list in expr", lambda s: ast.LetNode(s[2], s[4]) -expr %= "case expr of case-list esac", lambda s: ast.SwitchCaseNode(s[2], s[4]) +expr %= "id <- expr", lambda s: cool.AssignNode(s[1], s[3]) +expr %= "{ block }", lambda s: cool.BlockNode(s[2]) +expr %= "while expr loop expr pool", lambda s: cool.WhileNode(s[2], s[4]) +expr %= "let declaration-list in expr", lambda s: cool.LetNode(s[2], s[4]) +expr %= "case expr of case-list esac", lambda s: cool.SwitchCaseNode(s[2], s[4]) expr %= "negable-comp", lambda s: s[1] -negable_comp %= "not comp", lambda s: ast.NegationNode(s[2]) +negable_comp %= "not comp", lambda s: cool.NegationNode(s[2]) negable_comp %= "comp", lambda s: s[1] -comp %= "comp < negable-arith", lambda s: ast.LessThanNode(s[1], s[2], s[3]) -comp %= "comp <= negable-arith", lambda s: ast.LessEqualNode(s[1], s[2], s[3]) -comp %= "comp = negable-arith", lambda s: ast.EqualNode(s[1], s[2], s[3]) +comp %= "comp < negable-arith", lambda s: cool.LessThanNode(s[1], s[2], s[3]) +comp %= "comp <= negable-arith", lambda s: cool.LessEqualNode(s[1], s[2], s[3]) +comp %= "comp = negable-arith", lambda s: cool.EqualNode(s[1], s[2], s[3]) comp %= "arith", lambda s: s[1] -negable_arith %= "not arith", lambda s: ast.NegationNode(s[2]) +negable_arith %= "not arith", lambda s: cool.NegationNode(s[2]) negable_arith %= "arith", lambda s: s[1] -arith %= "arith + term", lambda s: ast.PlusNode(s[1], s[2], s[3]) -arith %= "arith - term", lambda s: ast.MinusNode(s[1], s[2], s[3]) +arith %= "arith + term", lambda s: cool.PlusNode(s[1], s[2], s[3]) +arith %= "arith - term", lambda s: cool.MinusNode(s[1], s[2], s[3]) arith %= "term", lambda s: s[1] -term %= "term * factor", lambda s: ast.StarNode(s[1], s[2], s[3]) -term %= "term / factor", lambda s: ast.DivNode(s[1], s[2], s[3]) +term %= "term * factor", lambda s: cool.StarNode(s[1], s[2], s[3]) +term %= "term / factor", lambda s: cool.DivNode(s[1], s[2], s[3]) term %= "factor", lambda s: s[1] -factor %= "isvoid factor", lambda s: ast.IsVoidNode(s[2]) -factor %= "~ factor", lambda s: ast.ComplementNode(s[2]) +factor %= "isvoid factor", lambda s: cool.IsVoidNode(s[2]) +factor %= "~ factor", lambda s: cool.ComplementNode(s[2]) factor %= "atom", lambda s: s[1] -atom %= "id", lambda s: ast.VariableNode(s[1]) -atom %= "true", lambda s: ast.BooleanNode(s[1]) -atom %= "false", lambda s: ast.BooleanNode(s[1]) -atom %= "int", lambda s: ast.IntegerNode(s[1]) -atom %= "string", lambda s: ast.StringNode(s[1]) -atom %= "if expr then expr else expr fi", lambda s: ast.ConditionalNode( +atom %= "id", lambda s: cool.VariableNode(s[1]) +atom %= "true", lambda s: cool.BooleanNode(s[1]) +atom %= "false", lambda s: cool.BooleanNode(s[1]) +atom %= "int", lambda s: cool.IntegerNode(s[1]) +atom %= "string", lambda s: cool.StringNode(s[1]) +atom %= "if expr then expr else expr fi", lambda s: cool.ConditionalNode( s[2], s[4], s[6] ) atom %= "function-call", lambda s: s[1] -atom %= "new type", lambda s: ast.InstantiateNode(s[2]) +atom %= "new type", lambda s: cool.InstantiateNode(s[2]) atom %= "( expr )", lambda s: s[2] block %= "expr ;", lambda s: [s[1]] @@ -342,11 +342,11 @@ def lexical_error(lexer): case_list %= "id : type => expr ;", lambda s: [(s[1], s[3], s[5])] case_list %= "id : type => expr ; case-list", lambda s: [(s[1], s[3], s[5])] + s[7] -function_call %= "id ( expr-list )", lambda s: ast.MethodCallNode(s[1], s[3]) -function_call %= "atom . id ( expr-list )", lambda s: ast.MethodCallNode( +function_call %= "id ( expr-list )", lambda s: cool.MethodCallNode(s[1], s[3]) +function_call %= "atom . id ( expr-list )", lambda s: cool.MethodCallNode( s[3], s[5], s[1] ) -function_call %= "atom @ type . id ( expr-list )", lambda s: ast.MethodCallNode( +function_call %= "atom @ type . id ( expr-list )", lambda s: cool.MethodCallNode( s[5], s[7], s[1], s[3] ) diff --git a/src/cool/semantics/formatter.py b/src/cool/semantics/formatter.py index 0478b010f..f4c23e4d1 100644 --- a/src/cool/semantics/formatter.py +++ b/src/cool/semantics/formatter.py @@ -1,4 +1,4 @@ -import cool.semantics.utils.astnodes as ast +import cool.semantics.utils.astnodes as cool import cool.visitor as visitor @@ -7,12 +7,12 @@ class CodeBuilder: def visit(self, node, tabs): pass - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode, tabs: int = 0): + @visitor.when(cool.ProgramNode) + def visit(self, node: cool.ProgramNode, tabs: int = 0): return "\n\n".join(self.visit(child, tabs) for child in node.declarations) - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode, tabs: int = 0): + @visitor.when(cool.ClassDeclarationNode) + def visit(self, node: cool.ClassDeclarationNode, tabs: int = 0): parent = "" if node.parent is None else f"inherits {node.parent} " return ( f"class {node.id} {parent}{{\n" @@ -20,20 +20,20 @@ def visit(self, node: ast.ClassDeclarationNode, tabs: int = 0): + "\n}" ) - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode, tabs: int = 0): + @visitor.when(cool.AttrDeclarationNode) + def visit(self, node: cool.AttrDeclarationNode, tabs: int = 0): expr = f" <- {self.visit(node.expr, 0)}" if node.expr is not None else "" return " " * tabs + f"{node.id}: {node.type}{expr};" - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode, tabs: int = 0): + @visitor.when(cool.MethodDeclarationNode) + def visit(self, node: cool.MethodDeclarationNode, tabs: int = 0): params = ", ".join(": ".join(param) for param in node.params) ans = " " * tabs + f"{node.id} ({params}): {node.return_type}" body = self.visit(node.body, tabs + 1) return f"{ans} {{\n{body}\n }};" - @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode, tabs: int = 0): + @visitor.when(cool.LetNode) + def visit(self, node: cool.LetNode, tabs: int = 0): declarations = [] for _id, _type, _expr in node.declarations: if _expr is not None: @@ -45,19 +45,20 @@ def visit(self, node: ast.LetNode, tabs: int = 0): " " * tabs + f"let {declarations} in\n{self.visit(node.expr, tabs + 1)}" ) - @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode, tabs: int = 0): - return " " * tabs + f"{node.id} <- {self.visit(node.expr)}" + @visitor.when(cool.AssignNode) + def visit(self, node: cool.AssignNode, tabs: int = 0): + expr = self.visit(node.expr).replace("\n", "\n" + " " * tabs) + return " " * tabs + f"{node.id} <- {expr}" - @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode, tabs: int = 0): + @visitor.when(cool.BlockNode) + def visit(self, node: cool.BlockNode, tabs: int = 0): body = ";\n".join(self.visit(child, tabs + 1) for child in node.expressions) if body: body += ";" return " " * tabs + f"{{\n{body}\n" + " " * tabs + "}" - @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode, tabs: int = 0): + @visitor.when(cool.ConditionalNode) + def visit(self, node: cool.ConditionalNode, tabs: int = 0): ifx = self.visit(node.if_expr) then = self.visit(node.then_expr, tabs + 1) elsex = self.visit(node.else_expr, tabs + 1) @@ -73,8 +74,8 @@ def visit(self, node: ast.ConditionalNode, tabs: int = 0): + "fi" ) - @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode, tabs: int = 0): + @visitor.when(cool.WhileNode) + def visit(self, node: cool.WhileNode, tabs: int = 0): condition = self.visit(node.condition, 0) body = self.visit(node.body, tabs + 1) @@ -85,8 +86,8 @@ def visit(self, node: ast.WhileNode, tabs: int = 0): + "pool" ) - @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode, tabs: int = 0): + @visitor.when(cool.SwitchCaseNode) + def visit(self, node: cool.SwitchCaseNode, tabs: int = 0): cases = [] for _id, _type, _expr in node.cases: expr = self.visit(_expr, tabs + 2) @@ -96,31 +97,31 @@ def visit(self, node: ast.SwitchCaseNode, tabs: int = 0): return " " * tabs + f"case {expr} of\n{cases}\n" + " " * tabs + "esac" - @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode, tabs: int = 0): + @visitor.when(cool.MethodCallNode) + def visit(self, node: cool.MethodCallNode, tabs: int = 0): obj = f"{self.visit(node.obj, 0)}." if node.obj is not None else "" return ( " " * tabs + f'{obj}{node.id}({", ".join(self.visit(arg, 0) for arg in node.args)})' ) - @visitor.when(ast.BinaryNode) - def visit(self, node: ast.BinaryNode, tabs: int = 0): + @visitor.when(cool.BinaryNode) + def visit(self, node: cool.BinaryNode, tabs: int = 0): left = ( self.visit(node.left) - if isinstance(node.left, ast.BinaryNode) + if isinstance(node.left, cool.BinaryNode) else self.visit(node.left, tabs) ) right = self.visit(node.right) return f"{left} {node.operation} {right}" - @visitor.when(ast.AtomicNode) - def visit(self, node: ast.AtomicNode, tabs: int = 0): + @visitor.when(cool.AtomicNode) + def visit(self, node: cool.AtomicNode, tabs: int = 0): lex = node.lex return " " * tabs + f"{lex}" - @visitor.when(ast.InstantiateNode) - def visit(self, node: ast.InstantiateNode, tabs: int = 0): + @visitor.when(cool.InstantiateNode) + def visit(self, node: cool.InstantiateNode, tabs: int = 0): return " " * tabs + f"(new {node.lex})" @@ -129,16 +130,16 @@ class Formatter: def visit(self, node, tabs): pass - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode, tabs: int = 0): + @visitor.when(cool.ProgramNode) + def visit(self, node: cool.ProgramNode, tabs: int = 0): ans = " " * tabs + f"\\__ProgramNode [ ... ]" statements = "\n".join( self.visit(child, tabs + 1) for child in node.declarations ) return f"{ans}\n{statements}" - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode, tabs: int = 0): + @visitor.when(cool.ClassDeclarationNode) + def visit(self, node: cool.ClassDeclarationNode, tabs: int = 0): parent = "" if node.parent is None else f": {node.parent}" ans = ( " " * tabs @@ -147,13 +148,13 @@ def visit(self, node: ast.ClassDeclarationNode, tabs: int = 0): features = "\n".join(self.visit(child, tabs + 1) for child in node.features) return f"{ans}\n{features}" - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode, tabs: int = 0): + @visitor.when(cool.AttrDeclarationNode) + def visit(self, node: cool.AttrDeclarationNode, tabs: int = 0): ans = " " * tabs + f"\\__AttrDeclarationNode: {node.id} : {node.type}" return f"{ans}" - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode, tabs: int = 0): + @visitor.when(cool.MethodDeclarationNode) + def visit(self, node: cool.MethodDeclarationNode, tabs: int = 0): params = ", ".join(":".join(param) for param in node.params) ans = ( " " * tabs @@ -162,8 +163,8 @@ def visit(self, node: ast.MethodDeclarationNode, tabs: int = 0): body = self.visit(node.body, tabs + 1) return f"{ans}\n{body}" - @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode, tabs: int = 0): + @visitor.when(cool.LetNode) + def visit(self, node: cool.LetNode, tabs: int = 0): declarations = [] for _id, _type, _expr in node.declarations: if _expr is not None: @@ -181,20 +182,20 @@ def visit(self, node: ast.LetNode, tabs: int = 0): expr = self.visit(node.expr, tabs + 2) return f"{ans}\n {declarations}\n" + " " * (tabs + 1) + "in\n" + f"{expr}" - @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode, tabs: int = 0): + @visitor.when(cool.AssignNode) + def visit(self, node: cool.AssignNode, tabs: int = 0): ans = " " * tabs + f"\\__AssignNode: {node.id} <- " expr = self.visit(node.expr, tabs + 1) return f"{ans}\n{expr}" - @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode, tabs: int = 0): + @visitor.when(cool.BlockNode) + def visit(self, node: cool.BlockNode, tabs: int = 0): ans = " " * tabs + f"\\__BlockNode:" body = "\n".join(self.visit(child, tabs + 1) for child in node.expressions) return f"{ans}\n{body}" - @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode, tabs: int = 0): + @visitor.when(cool.ConditionalNode) + def visit(self, node: cool.ConditionalNode, tabs: int = 0): ifx = self.visit(node.if_expr, tabs + 2) then = self.visit(node.then_expr, tabs + 2) elsex = self.visit(node.else_expr, tabs + 2) @@ -209,8 +210,8 @@ def visit(self, node: ast.ConditionalNode, tabs: int = 0): ] ) - @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode, tabs: int = 0): + @visitor.when(cool.WhileNode) + def visit(self, node: cool.WhileNode, tabs: int = 0): condition = self.visit(node.condition, tabs + 2) body = self.visit(node.body, tabs + 2) @@ -222,8 +223,8 @@ def visit(self, node: ast.WhileNode, tabs: int = 0): ] ) - @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode, tabs: int = 0): + @visitor.when(cool.SwitchCaseNode) + def visit(self, node: cool.SwitchCaseNode, tabs: int = 0): cases = [] for _id, _type, _expr in node.cases: expr = self.visit(_expr, tabs + 3) @@ -243,24 +244,24 @@ def visit(self, node: ast.SwitchCaseNode, tabs: int = 0): + cases ) - @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode, tabs: int = 0): + @visitor.when(cool.MethodCallNode) + def visit(self, node: cool.MethodCallNode, tabs: int = 0): obj = self.visit(node.obj, tabs + 1) ans = " " * 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(ast.BinaryNode) - def visit(self, node: ast.BinaryNode, tabs: int = 0): + @visitor.when(cool.BinaryNode) + def visit(self, node: cool.BinaryNode, tabs: int = 0): ans = " " * 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(ast.AtomicNode) - def visit(self, node: ast.AtomicNode, tabs: int = 0): + @visitor.when(cool.AtomicNode) + def visit(self, node: cool.AtomicNode, tabs: int = 0): return " " * tabs + f"\\__ {node.__class__.__name__}: {node.lex}" - @visitor.when(ast.InstantiateNode) - def visit(self, node: ast.InstantiateNode, tabs: int = 0): + @visitor.when(cool.InstantiateNode) + def visit(self, node: cool.InstantiateNode, tabs: int = 0): return " " * tabs + f"\\__ InstantiateNode: new {node.lex}()" diff --git a/src/cool/semantics/overridden.py b/src/cool/semantics/overridden.py index 75ab070c9..6fae12c83 100644 --- a/src/cool/semantics/overridden.py +++ b/src/cool/semantics/overridden.py @@ -1,13 +1,13 @@ from typing import List, Dict, Optional, OrderedDict -import cool.semantics.utils.astnodes as ast +import cool.semantics.utils.astnodes as cool import cool.semantics.utils.errors as err import cool.visitor as visitor from cool.semantics.utils.scope import Context, ErrorType, Type, SemanticError def topological_sorting( - program_node: ast.ProgramNode, context: Context, errors: List[str] + program_node: cool.ProgramNode, context: Context, errors: List[str] ) -> bool: """Set an order in the program node of de ast such that for all class A with parent B, class B is before A in the list, if in the process is detected a cycle an error is added to the `error` parameter @@ -85,21 +85,21 @@ def __init__(self, context: Context, errors: List[str]): def visit(self, node): pass - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode): + @visitor.when(cool.ProgramNode) + def visit(self, node: cool.ProgramNode): for declaration in node.declarations: self.visit(declaration) - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode): + @visitor.when(cool.ClassDeclarationNode) + def visit(self, node: cool.ClassDeclarationNode): self.current_type = self.context.get_type(node.id) for feature in node.features: - if isinstance(feature, ast.MethodDeclarationNode): + if isinstance(feature, cool.MethodDeclarationNode): self.visit(feature) - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode): + @visitor.when(cool.AttrDeclarationNode) + def visit(self, node: cool.AttrDeclarationNode): try: attribute, owner = self.current_type.parent.get_attribute(node.id) self.errors.append( @@ -108,8 +108,8 @@ def visit(self, node: ast.AttrDeclarationNode): except SemanticError: pass - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode): + @visitor.when(cool.MethodDeclarationNode) + def visit(self, node: cool.MethodDeclarationNode): # TODO: Change the comparison overriding current_method = self.current_type.get_method(node.id) try: diff --git a/src/cool/semantics/position_assigner.py b/src/cool/semantics/position_assigner.py index 163145691..211098d4e 100644 --- a/src/cool/semantics/position_assigner.py +++ b/src/cool/semantics/position_assigner.py @@ -1,7 +1,7 @@ from typing import List from cool.code_generation.cil import PlusNode -import cool.semantics.utils.astnodes as ast +import cool.semantics.utils.astnodes as cool import cool.visitor as visitor from pyjapt import Token @@ -18,8 +18,8 @@ def inc_position(self, count: int = 1): def visit(self, node): pass - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode): + @visitor.when(cool.ProgramNode) + def visit(self, node: cool.ProgramNode): for declaration in node.declarations: self.visit(declaration) @@ -30,8 +30,8 @@ def visit(self, node: ast.ProgramNode): ] # There is always one or more declarations node.set_main_position(first_declaration.line, first_declaration.column) - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode): + @visitor.when(cool.ClassDeclarationNode) + def visit(self, node: cool.ClassDeclarationNode): """ * class type [inherits type] { feature-list } @@ -63,8 +63,8 @@ class type [inherits type] { feature-list } self.inc_position() # ends after `}` - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode): + @visitor.when(cool.AttrDeclarationNode) + def visit(self, node: cool.AttrDeclarationNode): """ * id : type [<- expr] @@ -88,8 +88,8 @@ def visit(self, node: ast.AttrDeclarationNode): self.inc_position(3) - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode): + @visitor.when(cool.MethodDeclarationNode) + def visit(self, node: cool.MethodDeclarationNode): """ * id ( [params] ) : type { expr } @@ -121,8 +121,8 @@ def visit(self, node: ast.MethodDeclarationNode): self.visit(node.body) self.inc_position() # ends after `}` - @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode): + @visitor.when(cool.LetNode) + def visit(self, node: cool.LetNode): """ * let declaration-list in expr @@ -154,8 +154,8 @@ def visit(self, node: ast.LetNode): self.visit(node.expr) - @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode): + @visitor.when(cool.AssignNode) + def visit(self, node: cool.AssignNode): """ * id <- expr @@ -170,8 +170,8 @@ def visit(self, node: ast.AssignNode): self.inc_position(2) # ends after `<-` self.visit(node.expr) - @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode): + @visitor.when(cool.BlockNode) + def visit(self, node: cool.BlockNode): """ * { block } @@ -201,8 +201,8 @@ def visit(self, node: ast.BlockNode): self.inc_position() # ends after `}` - @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode): + @visitor.when(cool.ConditionalNode) + def visit(self, node: cool.ConditionalNode): """ * if expr then expr else expr fi @@ -236,8 +236,8 @@ def visit(self, node: ast.ConditionalNode): ), f'Expected "fi" instead of "{token.lex}" in conditional' self.inc_position() # ends after `fi` - @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode): + @visitor.when(cool.WhileNode) + def visit(self, node: cool.WhileNode): """ * while expr loop expr pool @@ -254,8 +254,8 @@ def visit(self, node: ast.WhileNode): self.inc_position() # ends after `pool` - @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode): + @visitor.when(cool.SwitchCaseNode) + def visit(self, node: cool.SwitchCaseNode): """ * case expr of case-list esac @@ -282,8 +282,8 @@ def visit(self, node: ast.SwitchCaseNode): self.inc_position() # ends afte `esac` - @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode): + @visitor.when(cool.MethodCallNode) + def visit(self, node: cool.MethodCallNode): """ * id ( expr-list ) @@ -341,29 +341,29 @@ def visit(self, node: ast.MethodCallNode): else: self.inc_position() - @visitor.when(ast.IntegerNode) - def visit(self, node: ast.IntegerNode): + @visitor.when(cool.IntegerNode) + def visit(self, node: cool.IntegerNode): self._atom_node(node) - @visitor.when(ast.StringNode) - def visit(self, node: ast.StringNode): + @visitor.when(cool.StringNode) + def visit(self, node: cool.StringNode): self._atom_node(node) - @visitor.when(ast.BooleanNode) - def visit(self, node: ast.BooleanNode): + @visitor.when(cool.BooleanNode) + def visit(self, node: cool.BooleanNode): self._atom_node(node) - @visitor.when(ast.VariableNode) - def visit(self, node: ast.VariableNode): + @visitor.when(cool.VariableNode) + def visit(self, node: cool.VariableNode): self._atom_node(node) - @visitor.when(ast.InstantiateNode) - def visit(self, node: ast.InstantiateNode): + @visitor.when(cool.InstantiateNode) + def visit(self, node: cool.InstantiateNode): """ * new type """ - + token = self.tokens[self.position] count = 0 @@ -372,8 +372,7 @@ def visit(self, node: ast.InstantiateNode): self.inc_position() token = self.tokens[self.position] - - assert token.lex == "new", f"Expected 'new' instead of '{token.lex}'" + assert token.lex == "new", f"Expected 'new' instead of '{token.lex}'" node.set_main_position(token.line, token.column) @@ -385,47 +384,47 @@ def visit(self, node: ast.InstantiateNode): self.inc_position() count -= 1 - @visitor.when(ast.NegationNode) - def visit(self, node: ast.NegationNode): + @visitor.when(cool.NegationNode) + def visit(self, node: cool.NegationNode): self._check_unary_operation(node) - @visitor.when(ast.ComplementNode) - def visit(self, node: ast.ComplementNode): + @visitor.when(cool.ComplementNode) + def visit(self, node: cool.ComplementNode): self._check_unary_operation(node) - @visitor.when(ast.IsVoidNode) - def visit(self, node: ast.IsVoidNode): + @visitor.when(cool.IsVoidNode) + def visit(self, node: cool.IsVoidNode): self._check_unary_operation(node) - @visitor.when(ast.PlusNode) - def visit(self, node: ast.PlusNode): + @visitor.when(cool.PlusNode) + def visit(self, node: cool.PlusNode): self._check_binary_operation(node) - @visitor.when(ast.MinusNode) - def visit(self, node: ast.MinusNode): + @visitor.when(cool.MinusNode) + def visit(self, node: cool.MinusNode): self._check_binary_operation(node) - @visitor.when(ast.StarNode) - def visit(self, node: ast.StarNode): + @visitor.when(cool.StarNode) + def visit(self, node: cool.StarNode): self._check_binary_operation(node) - @visitor.when(ast.DivNode) - def visit(self, node: ast.DivNode): + @visitor.when(cool.DivNode) + def visit(self, node: cool.DivNode): self._check_binary_operation(node) - @visitor.when(ast.LessEqualNode) - def visit(self, node: ast.LessEqualNode): + @visitor.when(cool.LessEqualNode) + def visit(self, node: cool.LessEqualNode): self._check_binary_operation(node) - @visitor.when(ast.LessThanNode) - def visit(self, node: ast.LessThanNode): + @visitor.when(cool.LessThanNode) + def visit(self, node: cool.LessThanNode): self._check_binary_operation(node) - @visitor.when(ast.EqualNode) - def visit(self, node: ast.EqualNode): + @visitor.when(cool.EqualNode) + def visit(self, node: cool.EqualNode): self._check_binary_operation(node) - def _check_binary_operation(self, node: ast.BinaryNode): + def _check_binary_operation(self, node: cool.BinaryNode): """ expr operation expr """ @@ -437,7 +436,7 @@ def _check_binary_operation(self, node: ast.BinaryNode): self.visit(node.right) - def _check_unary_operation(self, node: ast.UnaryNode): + def _check_unary_operation(self, node: cool.UnaryNode): """ operation expr """ @@ -450,7 +449,7 @@ def _check_unary_operation(self, node: ast.UnaryNode): self.inc_position() # ends after `operation` self.visit(node.expr) - def _atom_node(self, node: ast.Node): + def _atom_node(self, node: cool.Node): token = self.tokens[self.position] node.set_main_position(token.line, token.column) self.inc_position() # ends after `atom` diff --git a/src/cool/semantics/type_builder_for_features.py b/src/cool/semantics/type_builder_for_features.py index 436b1780c..3487e82b9 100644 --- a/src/cool/semantics/type_builder_for_features.py +++ b/src/cool/semantics/type_builder_for_features.py @@ -1,6 +1,6 @@ from typing import List, Optional -import cool.semantics.utils.astnodes as ast +import cool.semantics.utils.astnodes as cool import cool.semantics.utils.errors as err import cool.visitor as visitor from cool.semantics.utils.scope import Context, SemanticError, Type, ErrorType @@ -24,20 +24,20 @@ def __init__(self, context: Context, errors: List[str]): def visit(self, node): pass - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode): + @visitor.when(cool.ProgramNode) + def visit(self, node: cool.ProgramNode): for declaration in node.declarations: self.visit(declaration) - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode): + @visitor.when(cool.ClassDeclarationNode) + def visit(self, node: cool.ClassDeclarationNode): self.current_type = self.context.get_type(node.id) for feature in node.features: self.visit(feature) - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode): + @visitor.when(cool.AttrDeclarationNode) + def visit(self, node: cool.AttrDeclarationNode): try: attr_type = self.context.get_type(node.type) except SemanticError: @@ -56,8 +56,8 @@ def visit(self, node: ast.AttrDeclarationNode): % (node.line, node.column, node.id, self.current_type.name) ) - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode): + @visitor.when(cool.MethodDeclarationNode) + def visit(self, node: cool.MethodDeclarationNode): param_names = [] param_types = [] diff --git a/src/cool/semantics/type_builder_for_inheritance.py b/src/cool/semantics/type_builder_for_inheritance.py index 840b216b9..6fb7b47dc 100644 --- a/src/cool/semantics/type_builder_for_inheritance.py +++ b/src/cool/semantics/type_builder_for_inheritance.py @@ -1,6 +1,6 @@ from typing import List, Optional -import cool.semantics.utils.astnodes as ast +import cool.semantics.utils.astnodes as cool import cool.semantics.utils.errors as err import cool.visitor as visitor from cool.semantics.utils.scope import Context, SemanticError, Type, ErrorType @@ -24,13 +24,13 @@ def __init__(self, context: Context, errors: List[str]): def visit(self, node): pass - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode): + @visitor.when(cool.ProgramNode) + def visit(self, node: cool.ProgramNode): for declaration in node.declarations: self.visit(declaration) - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode): + @visitor.when(cool.ClassDeclarationNode) + def visit(self, node: cool.ClassDeclarationNode): self.current_type = self.context.get_type(node.id) if node.parent is not None: diff --git a/src/cool/semantics/type_checker.py b/src/cool/semantics/type_checker.py index dabfb04ae..d1d8dbb53 100644 --- a/src/cool/semantics/type_checker.py +++ b/src/cool/semantics/type_checker.py @@ -1,7 +1,7 @@ from inspect import Attribute from typing import List, Optional -import cool.semantics.utils.astnodes as ast +import cool.semantics.utils.astnodes as cool import cool.semantics.utils.errors as err import cool.visitor as visitor from cool.semantics.utils.scope import ( @@ -26,8 +26,8 @@ def __init__(self, context: Context, errors: List[str]): def visit(self, node, scope): pass - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode, scope: Scope = None): + @visitor.when(cool.ProgramNode) + def visit(self, node: cool.ProgramNode, scope: Scope = None): if scope is None: scope = Scope() @@ -36,19 +36,19 @@ def visit(self, node: ast.ProgramNode, scope: Scope = None): return scope - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode, scope: Scope): + @visitor.when(cool.ClassDeclarationNode) + def visit(self, node: cool.ClassDeclarationNode, scope: Scope): self.current_type = self.context.get_type(node.id) attrs = [ feature for feature in node.features - if isinstance(feature, ast.AttrDeclarationNode) + if isinstance(feature, cool.AttrDeclarationNode) ] methods = [ feature for feature in node.features - if isinstance(feature, ast.MethodDeclarationNode) + if isinstance(feature, cool.MethodDeclarationNode) ] for attr, attr_owner in self.current_type.all_attributes(): @@ -61,8 +61,8 @@ def visit(self, node: ast.ClassDeclarationNode, scope: Scope): for method in methods: self.visit(method, scope.create_child()) - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode, scope: Scope): + @visitor.when(cool.AttrDeclarationNode) + def visit(self, node: cool.AttrDeclarationNode, scope: Scope): if node.id == "self": self.errors.append(err.SELF_INVALID_ATTRIBUTE_ID % (node.line, node.column)) @@ -92,8 +92,8 @@ def visit(self, node: ast.AttrDeclarationNode, scope: Scope): ) scope.define_variable(node.id, attr_type) - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode, scope: Scope): + @visitor.when(cool.MethodDeclarationNode) + def visit(self, node: cool.MethodDeclarationNode, scope: Scope): self.current_method = self.current_type.get_method(node.id) self.current_attribute = None @@ -140,8 +140,8 @@ def visit(self, node: ast.MethodDeclarationNode, scope: Scope): % (node.line, node.column, expr_type.name, return_type.name) ) - @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode, scope: Scope): + @visitor.when(cool.LetNode) + def visit(self, node: cool.LetNode, scope: Scope): for i, (_id, _type, _expr) in enumerate(node.declarations): if _id == "self": line, column = node.declaration_names_positions[i] @@ -179,8 +179,8 @@ def visit(self, node: ast.LetNode, scope: Scope): return self.visit(node.expr, scope.create_child()) - @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode, scope: Scope): + @visitor.when(cool.AssignNode) + def visit(self, node: cool.AssignNode, scope: Scope): var_info = scope.find_variable(node.id) if var_info.name == "self": @@ -202,16 +202,16 @@ def visit(self, node: ast.AssignNode, scope: Scope): return expr_type - @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode, scope: Scope): + @visitor.when(cool.BlockNode) + def visit(self, node: cool.BlockNode, scope: Scope): child_scope = scope.create_child() return_type = ErrorType() for expr in node.expressions: return_type = self.visit(expr, child_scope) return return_type - @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode, scope: Scope): + @visitor.when(cool.ConditionalNode) + def visit(self, node: cool.ConditionalNode, scope: Scope): if_type = self.visit(node.if_expr, scope) then_type = self.visit(node.then_expr, scope) else_type = self.visit(node.else_expr, scope) @@ -221,8 +221,8 @@ def visit(self, node: ast.ConditionalNode, scope: Scope): ) return then_type.join(else_type) - @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode, scope: Scope): + @visitor.when(cool.WhileNode) + def visit(self, node: cool.WhileNode, scope: Scope): condition = self.visit(node.condition, scope) if condition != self.context.get_type("Bool"): self.errors.append( @@ -233,8 +233,8 @@ def visit(self, node: ast.WhileNode, scope: Scope): self.visit(node.body, scope.create_child()) return self.context.get_type("Object") - @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode, scope: Scope): + @visitor.when(cool.SwitchCaseNode) + def visit(self, node: cool.SwitchCaseNode, scope: Scope): self.visit(node.expr, scope) types = [] visited = set() @@ -266,10 +266,10 @@ def visit(self, node: ast.SwitchCaseNode, scope: Scope): return Type.multi_join(types) - @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode, scope: Scope): + @visitor.when(cool.MethodCallNode) + def visit(self, node: cool.MethodCallNode, scope: Scope): if node.obj is None: - node.obj = ast.VariableNode("self") + node.obj = cool.VariableNode("self") obj_type = self.visit(node.obj, scope) if node.type is not None: @@ -331,20 +331,20 @@ def visit(self, node: ast.MethodCallNode, scope: Scope): else ancestor_type ) - @visitor.when(ast.IntegerNode) - def visit(self, node: ast.IntegerNode, scope: Scope): + @visitor.when(cool.IntegerNode) + def visit(self, node: cool.IntegerNode, scope: Scope): return self.context.get_type("Int") - @visitor.when(ast.StringNode) - def visit(self, node: ast.StringNode, scope: Scope): + @visitor.when(cool.StringNode) + def visit(self, node: cool.StringNode, scope: Scope): return self.context.get_type("String") - @visitor.when(ast.BooleanNode) - def visit(self, node: ast.BooleanNode, scope: Scope): + @visitor.when(cool.BooleanNode) + def visit(self, node: cool.BooleanNode, scope: Scope): return self.context.get_type("Bool") - @visitor.when(ast.VariableNode) - def visit(self, node: ast.VariableNode, scope: Scope): + @visitor.when(cool.VariableNode) + def visit(self, node: cool.VariableNode, scope: Scope): variable = scope.find_variable(node.lex) if variable is None: if self.current_attribute is not None: @@ -358,8 +358,8 @@ def visit(self, node: ast.VariableNode, scope: Scope): return ErrorType() return variable.type - @visitor.when(ast.InstantiateNode) - def visit(self, node: ast.InstantiateNode, scope: Scope): + @visitor.when(cool.InstantiateNode) + def visit(self, node: cool.InstantiateNode, scope: Scope): try: return ( self.context.get_type(node.lex) @@ -371,61 +371,61 @@ def visit(self, node: ast.InstantiateNode, scope: Scope): self.errors.append(err.UNDEFINED_NEW_TYPE % (line, column, node.lex)) return ErrorType() - @visitor.when(ast.NegationNode) - def visit(self, node: ast.NegationNode, scope: Scope): + @visitor.when(cool.NegationNode) + def visit(self, node: cool.NegationNode, scope: Scope): return self._check_unary_operation( node, scope, "not", self.context.get_type("Bool") ) - @visitor.when(ast.ComplementNode) - def visit(self, node: ast.ComplementNode, scope: Scope): + @visitor.when(cool.ComplementNode) + def visit(self, node: cool.ComplementNode, scope: Scope): return self._check_unary_operation( node, scope, "~", self.context.get_type("Int") ) - @visitor.when(ast.IsVoidNode) - def visit(self, node: ast.IsVoidNode, scope: Scope): + @visitor.when(cool.IsVoidNode) + def visit(self, node: cool.IsVoidNode, scope: Scope): self.visit(node.expr, scope) return self.context.get_type("Bool") - @visitor.when(ast.PlusNode) - def visit(self, node: ast.PlusNode, scope: Scope): + @visitor.when(cool.PlusNode) + def visit(self, node: cool.PlusNode, scope: Scope): return self._check_int_binary_operation( node, scope, "+", self.context.get_type("Int") ) - @visitor.when(ast.MinusNode) - def visit(self, node: ast.MinusNode, scope: Scope): + @visitor.when(cool.MinusNode) + def visit(self, node: cool.MinusNode, scope: Scope): return self._check_int_binary_operation( node, scope, "-", self.context.get_type("Int") ) - @visitor.when(ast.StarNode) - def visit(self, node: ast.StarNode, scope: Scope): + @visitor.when(cool.StarNode) + def visit(self, node: cool.StarNode, scope: Scope): return self._check_int_binary_operation( node, scope, "*", self.context.get_type("Int") ) - @visitor.when(ast.DivNode) - def visit(self, node: ast.DivNode, scope: Scope): + @visitor.when(cool.DivNode) + def visit(self, node: cool.DivNode, scope: Scope): return self._check_int_binary_operation( node, scope, "/", self.context.get_type("Int") ) - @visitor.when(ast.LessEqualNode) - def visit(self, node: ast.LessEqualNode, scope: Scope): + @visitor.when(cool.LessEqualNode) + def visit(self, node: cool.LessEqualNode, scope: Scope): return self._check_int_binary_operation( node, scope, "<=", self.context.get_type("Bool") ) - @visitor.when(ast.LessThanNode) - def visit(self, node: ast.LessThanNode, scope: Scope): + @visitor.when(cool.LessThanNode) + def visit(self, node: cool.LessThanNode, scope: Scope): return self._check_int_binary_operation( node, scope, "<", self.context.get_type("Bool") ) - @visitor.when(ast.EqualNode) - def visit(self, node: ast.EqualNode, scope: Scope): + @visitor.when(cool.EqualNode) + def visit(self, node: cool.EqualNode, scope: Scope): left_type = self.visit(node.left, scope) right_type = self.visit(node.right, scope) @@ -439,7 +439,7 @@ def visit(self, node: ast.EqualNode, scope: Scope): return self.context.get_type("Bool") def _check_int_binary_operation( - self, node: ast.BinaryNode, scope: Scope, operation: str, return_type: Type + self, node: cool.BinaryNode, scope: Scope, operation: str, return_type: Type ): left_type = self.visit(node.left, scope) right_type = self.visit(node.right, scope) @@ -453,7 +453,7 @@ def _check_int_binary_operation( return ErrorType() def _check_unary_operation( - self, node: ast.UnaryNode, scope: Scope, operation: str, expected_type: Type + self, node: cool.UnaryNode, scope: Scope, operation: str, expected_type: Type ): typex = self.visit(node.expr, scope) if typex == expected_type: diff --git a/src/cool/semantics/type_collector.py b/src/cool/semantics/type_collector.py index c16d238b9..a1125d3aa 100644 --- a/src/cool/semantics/type_collector.py +++ b/src/cool/semantics/type_collector.py @@ -1,7 +1,7 @@ from typing import List import cool.semantics.utils.errors as err -import cool.semantics.utils.astnodes as ast +import cool.semantics.utils.astnodes as cool import cool.visitor as visitor from cool.semantics.utils.scope import Context, SemanticError @@ -22,7 +22,7 @@ def __init__(self, context: Context = Context(), errors: List[str] = []): def visit(self, node): pass - @visitor.when(ast.ProgramNode) + @visitor.when(cool.ProgramNode) def visit(self, node): self.context.create_type("AUTO_TYPE") self_type = self.context.create_type("SELF_TYPE") @@ -55,8 +55,8 @@ def visit(self, node): for declaration in node.declarations: self.visit(declaration) - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode): + @visitor.when(cool.ClassDeclarationNode) + def visit(self, node: cool.ClassDeclarationNode): try: self.context.create_type(node.id) except SemanticError: diff --git a/src/cool/semantics/type_inference.py b/src/cool/semantics/type_inference.py index e8b113850..6c7595280 100644 --- a/src/cool/semantics/type_inference.py +++ b/src/cool/semantics/type_inference.py @@ -37,7 +37,7 @@ from collections import OrderedDict, deque from typing import Dict, List, Optional, Set, Tuple, Deque -import cool.semantics.utils.astnodes as ast +import cool.semantics.utils.astnodes as cool import cool.semantics.utils.errors as err import cool.visitor as visitor from cool.semantics.utils.scope import ( @@ -269,8 +269,8 @@ def build_methods_reference( def visit(self, node, scope): pass - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode, scope: Scope = None): + @visitor.when(cool.ProgramNode) + def visit(self, node: cool.ProgramNode, scope: Scope = None): if scope is None: scope = Scope() @@ -282,19 +282,19 @@ def visit(self, node: ast.ProgramNode, scope: Scope = None): # print(self.graph, '\n') InferenceTypeSubstitute(self.context, self.errors).visit(node, scope) - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode, scope: Scope): + @visitor.when(cool.ClassDeclarationNode) + def visit(self, node: cool.ClassDeclarationNode, scope: Scope): self.current_type = self.context.get_type(node.id) attrs = [ feature for feature in node.features - if isinstance(feature, ast.AttrDeclarationNode) + if isinstance(feature, cool.AttrDeclarationNode) ] methods = [ feature for feature in node.features - if isinstance(feature, ast.MethodDeclarationNode) + if isinstance(feature, cool.MethodDeclarationNode) ] for attr in attrs: @@ -303,8 +303,8 @@ def visit(self, node: ast.ClassDeclarationNode, scope: Scope): for method in methods: self.visit(method, scope.create_child()) - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode, scope: Scope): + @visitor.when(cool.AttrDeclarationNode) + def visit(self, node: cool.AttrDeclarationNode, scope: Scope): # Solve the expression of the attribute expr_node = ( self.visit(node.expr, scope.create_child()) @@ -333,8 +333,8 @@ def visit(self, node: ast.AttrDeclarationNode, scope: Scope): self.graph.add_edge(var_info_node, attr_node) self.graph.add_edge(attr_node, var_info_node) - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode, scope: Scope): + @visitor.when(cool.MethodDeclarationNode) + def visit(self, node: cool.MethodDeclarationNode, scope: Scope): self.current_method = self.current_type.get_method(node.id) # Define 'self' as a variable in the scope @@ -375,8 +375,8 @@ def visit(self, node: ast.MethodDeclarationNode, scope: Scope): ][1] self.graph.add_edge(body_node, return_type_node) - @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode, scope: Scope): + @visitor.when(cool.LetNode) + def visit(self, node: cool.LetNode, scope: Scope): for _id, _type, _expr in node.declarations: try: # Define and get the var_info @@ -404,8 +404,8 @@ def visit(self, node: ast.LetNode, scope: Scope): return self.visit(node.expr, scope.create_child()) - @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode, scope: Scope): + @visitor.when(cool.AssignNode) + def visit(self, node: cool.AssignNode, scope: Scope): var_info = scope.find_variable(node.id) expr_node = self.visit(node.expr, scope.create_child()) @@ -430,16 +430,16 @@ def visit(self, node: ast.AssignNode, scope: Scope): return expr_node - @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode, scope: Scope): + @visitor.when(cool.BlockNode) + def visit(self, node: cool.BlockNode, scope: Scope): child_scope = scope.create_child() result_node = None for expr in node.expressions: result_node = self.visit(expr, child_scope) return result_node - @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode, scope: Scope): + @visitor.when(cool.ConditionalNode) + def visit(self, node: cool.ConditionalNode, scope: Scope): if_node = self.visit(node.if_expr, scope) if not isinstance(if_node, AtomNode): @@ -466,14 +466,14 @@ def visit(self, node: ast.ConditionalNode, scope: Scope): return conditional_node - @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode, scope: Scope): + @visitor.when(cool.WhileNode) + def visit(self, node: cool.WhileNode, scope: Scope): self.visit(node.condition, scope) self.visit(node.body, scope.create_child()) return AtomNode(self.context.get_type("Object")) - @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode, scope: Scope): + @visitor.when(cool.SwitchCaseNode) + def visit(self, node: cool.SwitchCaseNode, scope: Scope): self.visit(node.expr, scope) defined_nodes = [] @@ -501,10 +501,10 @@ def visit(self, node: ast.SwitchCaseNode, scope: Scope): return case_of_node return AtomNode(Type.multi_join([e.type for e in case_nodes])) - @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode, scope: Scope): + @visitor.when(cool.MethodCallNode) + def visit(self, node: cool.MethodCallNode, scope: Scope): if node.obj is None: - node.obj = ast.VariableNode("self") + node.obj = cool.VariableNode("self") obj_node = self.visit(node.obj, scope) if isinstance(obj_node, AtomNode) and obj_node.type.contains_method(node.id): @@ -541,20 +541,20 @@ def visit(self, node: ast.MethodCallNode, scope: Scope): self.visit(arg, scope) return AtomNode(self.context.get_type("Object")) - @visitor.when(ast.IntegerNode) - def visit(self, node: ast.IntegerNode, scope: Scope): + @visitor.when(cool.IntegerNode) + def visit(self, node: cool.IntegerNode, scope: Scope): return AtomNode(self.context.get_type("Int")) - @visitor.when(ast.StringNode) - def visit(self, node: ast.StringNode, scope: Scope): + @visitor.when(cool.StringNode) + def visit(self, node: cool.StringNode, scope: Scope): return AtomNode(self.context.get_type("String")) - @visitor.when(ast.BooleanNode) - def visit(self, node: ast.BooleanNode, scope: Scope): + @visitor.when(cool.BooleanNode) + def visit(self, node: cool.BooleanNode, scope: Scope): return AtomNode(self.context.get_type("Bool")) - @visitor.when(ast.VariableNode) - def visit(self, node: ast.VariableNode, scope: Scope): + @visitor.when(cool.VariableNode) + def visit(self, node: cool.VariableNode, scope: Scope): var_info = scope.find_variable(node.lex) if var_info is not None: @@ -565,71 +565,71 @@ def visit(self, node: ast.VariableNode, scope: Scope): else: return None - @visitor.when(ast.InstantiateNode) - def visit(self, node: ast.InstantiateNode, scope: Scope): + @visitor.when(cool.InstantiateNode) + def visit(self, node: cool.InstantiateNode, scope: Scope): if node.lex in self.context.types: return AtomNode(self.context.get_type(node.lex)) return AtomNode(self.context.get_type("Object")) - @visitor.when(ast.NegationNode) - def visit(self, node: ast.NegationNode, scope: Scope): + @visitor.when(cool.NegationNode) + def visit(self, node: cool.NegationNode, scope: Scope): self.visit(node.expr, scope) return AtomNode(self.context.get_type("Bool")) - @visitor.when(ast.ComplementNode) - def visit(self, node: ast.ComplementNode, scope: Scope): + @visitor.when(cool.ComplementNode) + def visit(self, node: cool.ComplementNode, scope: Scope): self.visit(node.expr, scope) return AtomNode(self.context.get_type("Int")) - @visitor.when(ast.IsVoidNode) - def visit(self, node: ast.IsVoidNode, scope: Scope): + @visitor.when(cool.IsVoidNode) + def visit(self, node: cool.IsVoidNode, scope: Scope): self.visit(node.expr, scope) return AtomNode(self.context.get_type("Bool")) - @visitor.when(ast.PlusNode) - def visit(self, node: ast.PlusNode, scope: Scope): + @visitor.when(cool.PlusNode) + def visit(self, node: cool.PlusNode, scope: Scope): return self._visit_arithmetic_node( node, scope, self.context.get_type("Int"), self.context.get_type("Int") ) - @visitor.when(ast.MinusNode) - def visit(self, node: ast.MinusNode, scope: Scope): + @visitor.when(cool.MinusNode) + def visit(self, node: cool.MinusNode, scope: Scope): return self._visit_arithmetic_node( node, scope, self.context.get_type("Int"), self.context.get_type("Int") ) - @visitor.when(ast.StarNode) - def visit(self, node: ast.StarNode, scope: Scope): + @visitor.when(cool.StarNode) + def visit(self, node: cool.StarNode, scope: Scope): return self._visit_arithmetic_node( node, scope, self.context.get_type("Int"), self.context.get_type("Int") ) - @visitor.when(ast.DivNode) - def visit(self, node: ast.DivNode, scope: Scope): + @visitor.when(cool.DivNode) + def visit(self, node: cool.DivNode, scope: Scope): return self._visit_arithmetic_node( node, scope, self.context.get_type("Int"), self.context.get_type("Int") ) - @visitor.when(ast.LessEqualNode) - def visit(self, node: ast.LessEqualNode, scope: Scope): + @visitor.when(cool.LessEqualNode) + def visit(self, node: cool.LessEqualNode, scope: Scope): return self._visit_arithmetic_node( node, scope, self.context.get_type("Int"), self.context.get_type("Bool") ) - @visitor.when(ast.LessThanNode) - def visit(self, node: ast.LessThanNode, scope: Scope): + @visitor.when(cool.LessThanNode) + def visit(self, node: cool.LessThanNode, scope: Scope): return self._visit_arithmetic_node( node, scope, self.context.get_type("Int"), self.context.get_type("Bool") ) - @visitor.when(ast.EqualNode) - def visit(self, node: ast.EqualNode, scope: Scope): + @visitor.when(cool.EqualNode) + def visit(self, node: cool.EqualNode, scope: Scope): self.visit(node.left, scope) self.visit(node.right, scope) return AtomNode(self.context.get_type("Bool")) def _visit_arithmetic_node( - self, node: ast.BinaryNode, scope: Scope, member_types: Type, return_type: Type + self, node: cool.BinaryNode, scope: Scope, member_types: Type, return_type: Type ): left = self.visit(node.left, scope) right = self.visit(node.right, scope) @@ -654,25 +654,25 @@ def __init__(self, context: Context, errors: List[str]): def visit(self, node, tabs): pass - @visitor.when(ast.ProgramNode) - def visit(self, node: ast.ProgramNode, scope: Scope): + @visitor.when(cool.ProgramNode) + def visit(self, node: cool.ProgramNode, scope: Scope): for i, elem in enumerate(node.declarations): self.visit(elem, scope.children[i]) return scope - @visitor.when(ast.ClassDeclarationNode) - def visit(self, node: ast.ClassDeclarationNode, scope: Scope): + @visitor.when(cool.ClassDeclarationNode) + def visit(self, node: cool.ClassDeclarationNode, scope: Scope): self.current_type = self.context.get_type(node.id) attrs = [ feature for feature in node.features - if isinstance(feature, ast.AttrDeclarationNode) + if isinstance(feature, cool.AttrDeclarationNode) ] methods = [ feature for feature in node.features - if isinstance(feature, ast.MethodDeclarationNode) + if isinstance(feature, cool.MethodDeclarationNode) ] i = 0 @@ -685,8 +685,8 @@ def visit(self, node: ast.ClassDeclarationNode, scope: Scope): for i, method in enumerate(methods, i): self.visit(method, scope.children[i]) - @visitor.when(ast.AttrDeclarationNode) - def visit(self, node: ast.AttrDeclarationNode, scope: Scope): + @visitor.when(cool.AttrDeclarationNode) + def visit(self, node: cool.AttrDeclarationNode, scope: Scope): attr_type = self.context.get_type(node.type) var_info = scope.find_variable(node.id) @@ -698,8 +698,8 @@ def visit(self, node: ast.AttrDeclarationNode, scope: Scope): self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % node.id) node.type = var_info.type.name - @visitor.when(ast.MethodDeclarationNode) - def visit(self, node: ast.MethodDeclarationNode, scope: Scope): + @visitor.when(cool.MethodDeclarationNode) + def visit(self, node: cool.MethodDeclarationNode, scope: Scope): self.current_method = self.current_type.get_method(node.id) return_type = self.context.get_type(node.return_type) @@ -716,8 +716,8 @@ def visit(self, node: ast.MethodDeclarationNode, scope: Scope): self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % node.id) node.return_type = self.current_method.return_type.name - @visitor.when(ast.LetNode) - def visit(self, node: ast.LetNode, scope: Scope): + @visitor.when(cool.LetNode) + def visit(self, node: cool.LetNode, scope: Scope): child_index = 0 for i, (_id, _type, _expr) in enumerate(node.declarations): variable_info = scope.find_variable(_id) @@ -733,49 +733,49 @@ def visit(self, node: ast.LetNode, scope: Scope): self.visit(node.expr, scope.children[child_index]) - @visitor.when(ast.AssignNode) - def visit(self, node: ast.AssignNode, scope: Scope): + @visitor.when(cool.AssignNode) + def visit(self, node: cool.AssignNode, scope: Scope): self.visit(node.expr, scope.children[0]) - @visitor.when(ast.BlockNode) - def visit(self, node: ast.BlockNode, scope: Scope): + @visitor.when(cool.BlockNode) + def visit(self, node: cool.BlockNode, scope: Scope): child_scope = scope.children[0] for _, expr in enumerate(node.expressions): self.visit(expr, child_scope) - @visitor.when(ast.ConditionalNode) - def visit(self, node: ast.ConditionalNode, scope: Scope): + @visitor.when(cool.ConditionalNode) + def visit(self, node: cool.ConditionalNode, scope: Scope): self.visit(node.if_expr, scope) self.visit(node.then_expr, scope.children[0]) self.visit(node.else_expr, scope.children[1]) - @visitor.when(ast.WhileNode) - def visit(self, node: ast.WhileNode, scope: Scope): + @visitor.when(cool.WhileNode) + def visit(self, node: cool.WhileNode, scope: Scope): self.visit(node.condition, scope) self.visit(node.body, scope.children[0]) - @visitor.when(ast.SwitchCaseNode) - def visit(self, node: ast.SwitchCaseNode, scope: Scope): + @visitor.when(cool.SwitchCaseNode) + def visit(self, node: cool.SwitchCaseNode, scope: Scope): self.visit(node.expr, scope) for i, (_, _, _expr) in enumerate(node.cases): self.visit(_expr, scope.children[i]) - @visitor.when(ast.MethodCallNode) - def visit(self, node: ast.MethodCallNode, scope: Scope): + @visitor.when(cool.MethodCallNode) + def visit(self, node: cool.MethodCallNode, scope: Scope): self.visit(node.obj, scope) for arg in node.args: self.visit(arg, scope) - @visitor.when(ast.AtomicNode) - def visit(self, node: ast.AtomicNode, scope: Scope): + @visitor.when(cool.AtomicNode) + def visit(self, node: cool.AtomicNode, scope: Scope): pass - @visitor.when(ast.UnaryNode) - def visit(self, node: ast.UnaryNode, scope: Scope): + @visitor.when(cool.UnaryNode) + def visit(self, node: cool.UnaryNode, scope: Scope): self.visit(node.expr, scope) - @visitor.when(ast.BinaryNode) - def visit(self, node: ast.BinaryNode, scope: Scope): + @visitor.when(cool.BinaryNode) + def visit(self, node: cool.BinaryNode, scope: Scope): self.visit(node.left, scope) self.visit(node.right, scope) diff --git a/src/cool/semantics/utils/astnodes.py b/src/cool/semantics/utils/astnodes.py index 85e27acce..5f77280ea 100644 --- a/src/cool/semantics/utils/astnodes.py +++ b/src/cool/semantics/utils/astnodes.py @@ -92,20 +92,20 @@ def __init__(self, expr, cases): class AssignNode(ExprNode): - def __init__(self, idx, expr): + def __init__(self, idx: str, expr: ExprNode): self.id: str = idx self.expr: ExprNode = expr class ConditionalNode(ExprNode): - def __init__(self, ifx, then, elsex): + def __init__(self, ifx: ExprNode, then: ExprNode, elsex: ExprNode): self.if_expr: ExprNode = ifx self.then_expr: ExprNode = then self.else_expr: ExprNode = elsex class WhileNode(ExprNode): - def __init__(self, condition, body): + def __init__(self, condition: ExprNode, body: ExprNode): self.condition: ExprNode = condition self.body: ExprNode = body @@ -123,12 +123,12 @@ def __init__(self, idx, args, obj=None, typex=None): class AtomicNode(ExprNode): - def __init__(self, lex): + def __init__(self, lex: str): self.lex: str = lex class UnaryNode(ExprNode): - def __init__(self, expr): + def __init__(self, expr: ExprNode): self.expr: ExprNode = expr self.operation_position: Tuple[int, int] = -1, -1 diff --git a/src/cool/semantics/utils/scope.py b/src/cool/semantics/utils/scope.py index c999e5d51..dee442384 100644 --- a/src/cool/semantics/utils/scope.py +++ b/src/cool/semantics/utils/scope.py @@ -207,7 +207,7 @@ def multi_join(types: List["Type"]) -> "Type": def bypass(self) -> bool: return False - def get_ancestors(self): + def get_ancestors(self) -> List["Type"]: if self.parent is None: return [self] return [self] + self.parent.get_ancestors() From 3bc2de03b7d896ecd447bd608d84c4e8b19f0352 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Sun, 31 Oct 2021 01:15:04 -0400 Subject: [PATCH 125/143] Added inference type feature --- src/cool/__main__.py | 4 +- .../code_generation/cool_to_cil_visitor.py | 3 +- src/cool/semantics/__init__.py | 1 + src/cool/semantics/position_assigner.py | 127 +++++++--------- src/cool/semantics/type_checker.py | 5 +- src/cool/semantics/type_inference.py | 137 +++++++++++------- 6 files changed, 151 insertions(+), 126 deletions(-) diff --git a/src/cool/__main__.py b/src/cool/__main__.py index 95371a4a7..b969d8bf4 100644 --- a/src/cool/__main__.py +++ b/src/cool/__main__.py @@ -7,11 +7,13 @@ sys.path.append(os.getcwd()) +from cool.code_generation import CILFormatter, ConstructorCreator, CoolToCILVisitor from cool.grammar import Token, serialize_parser_and_lexer from cool.lexertab import CoolLexer from cool.parsertab import CoolParser from cool.semantics import ( CodeBuilder, + InferenceChecker, OverriddenMethodChecker, PositionAssigner, TypeBuilderForFeatures, @@ -20,7 +22,6 @@ TypeCollector, topological_sorting, ) -from cool.code_generation import ConstructorCreator, CoolToCILVisitor, CILFormatter from cool.semantics.utils.scope import Context, Scope app = typer.Typer() @@ -85,6 +86,7 @@ def check_semantics(ast, scope: Scope, context: Context, errors: List[str]): if not errors: TypeBuilderForFeatures(context, errors).visit(ast) OverriddenMethodChecker(context, errors).visit(ast) + InferenceChecker(context, errors).visit(ast, Scope()) TypeChecker(context, errors).visit(ast, scope) return ast, scope, context, errors diff --git a/src/cool/code_generation/cool_to_cil_visitor.py b/src/cool/code_generation/cool_to_cil_visitor.py index 887ad9e49..74881edcd 100644 --- a/src/cool/code_generation/cool_to_cil_visitor.py +++ b/src/cool/code_generation/cool_to_cil_visitor.py @@ -214,11 +214,10 @@ def visit(self, node: cool.MethodCallNode, scope: Scope): def visit(self, node: cool.IntegerNode, scope: Scope): return node.lex, self.context.get_type("Int") - @visitor.when(cool.StringNode) def visit(self, node: cool.StringNode, scope: Scope): return node.lex, self.context.get_type("String") - + @visitor.when(cool.BooleanNode) def visit(self, node: cool.BooleanNode, scope: Scope): return node.lex, self.context.get_type("Bool") diff --git a/src/cool/semantics/__init__.py b/src/cool/semantics/__init__.py index 75a02bf66..699114073 100644 --- a/src/cool/semantics/__init__.py +++ b/src/cool/semantics/__init__.py @@ -7,5 +7,6 @@ from .position_assigner import PositionAssigner from .type_builder_for_features import TypeBuilderForFeatures from .type_builder_for_inheritance import TypeBuilderForInheritance +from .type_inference import InferenceChecker from .type_checker import TypeChecker from .type_collector import TypeCollector diff --git a/src/cool/semantics/position_assigner.py b/src/cool/semantics/position_assigner.py index 211098d4e..bd0f154af 100644 --- a/src/cool/semantics/position_assigner.py +++ b/src/cool/semantics/position_assigner.py @@ -1,7 +1,6 @@ from typing import List -from cool.code_generation.cil import PlusNode -import cool.semantics.utils.astnodes as cool +import cool.semantics.utils.astnodes as ast import cool.visitor as visitor from pyjapt import Token @@ -18,8 +17,8 @@ def inc_position(self, count: int = 1): def visit(self, node): pass - @visitor.when(cool.ProgramNode) - def visit(self, node: cool.ProgramNode): + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode): for declaration in node.declarations: self.visit(declaration) @@ -30,8 +29,8 @@ def visit(self, node: cool.ProgramNode): ] # There is always one or more declarations node.set_main_position(first_declaration.line, first_declaration.column) - @visitor.when(cool.ClassDeclarationNode) - def visit(self, node: cool.ClassDeclarationNode): + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode): """ * class type [inherits type] { feature-list } @@ -63,8 +62,8 @@ class type [inherits type] { feature-list } self.inc_position() # ends after `}` - @visitor.when(cool.AttrDeclarationNode) - def visit(self, node: cool.AttrDeclarationNode): + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode): """ * id : type [<- expr] @@ -88,8 +87,8 @@ def visit(self, node: cool.AttrDeclarationNode): self.inc_position(3) - @visitor.when(cool.MethodDeclarationNode) - def visit(self, node: cool.MethodDeclarationNode): + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode): """ * id ( [params] ) : type { expr } @@ -121,8 +120,8 @@ def visit(self, node: cool.MethodDeclarationNode): self.visit(node.body) self.inc_position() # ends after `}` - @visitor.when(cool.LetNode) - def visit(self, node: cool.LetNode): + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode): """ * let declaration-list in expr @@ -154,8 +153,8 @@ def visit(self, node: cool.LetNode): self.visit(node.expr) - @visitor.when(cool.AssignNode) - def visit(self, node: cool.AssignNode): + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode): """ * id <- expr @@ -170,8 +169,8 @@ def visit(self, node: cool.AssignNode): self.inc_position(2) # ends after `<-` self.visit(node.expr) - @visitor.when(cool.BlockNode) - def visit(self, node: cool.BlockNode): + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode): """ * { block } @@ -201,8 +200,8 @@ def visit(self, node: cool.BlockNode): self.inc_position() # ends after `}` - @visitor.when(cool.ConditionalNode) - def visit(self, node: cool.ConditionalNode): + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode): """ * if expr then expr else expr fi @@ -236,8 +235,8 @@ def visit(self, node: cool.ConditionalNode): ), f'Expected "fi" instead of "{token.lex}" in conditional' self.inc_position() # ends after `fi` - @visitor.when(cool.WhileNode) - def visit(self, node: cool.WhileNode): + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode): """ * while expr loop expr pool @@ -254,8 +253,8 @@ def visit(self, node: cool.WhileNode): self.inc_position() # ends after `pool` - @visitor.when(cool.SwitchCaseNode) - def visit(self, node: cool.SwitchCaseNode): + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode): """ * case expr of case-list esac @@ -282,8 +281,8 @@ def visit(self, node: cool.SwitchCaseNode): self.inc_position() # ends afte `esac` - @visitor.when(cool.MethodCallNode) - def visit(self, node: cool.MethodCallNode): + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode): """ * id ( expr-list ) @@ -341,90 +340,76 @@ def visit(self, node: cool.MethodCallNode): else: self.inc_position() - @visitor.when(cool.IntegerNode) - def visit(self, node: cool.IntegerNode): + @visitor.when(ast.IntegerNode) + def visit(self, node: ast.IntegerNode): self._atom_node(node) - @visitor.when(cool.StringNode) - def visit(self, node: cool.StringNode): + @visitor.when(ast.StringNode) + def visit(self, node: ast.StringNode): self._atom_node(node) - @visitor.when(cool.BooleanNode) - def visit(self, node: cool.BooleanNode): + @visitor.when(ast.BooleanNode) + def visit(self, node: ast.BooleanNode): self._atom_node(node) - @visitor.when(cool.VariableNode) - def visit(self, node: cool.VariableNode): + @visitor.when(ast.VariableNode) + def visit(self, node: ast.VariableNode): self._atom_node(node) - @visitor.when(cool.InstantiateNode) - def visit(self, node: cool.InstantiateNode): + @visitor.when(ast.InstantiateNode) + def visit(self, node: ast.InstantiateNode): """ * new type """ - token = self.tokens[self.position] - - count = 0 - while token.lex == "(": - count += 1 - self.inc_position() - token = self.tokens[self.position] - - assert token.lex == "new", f"Expected 'new' instead of '{token.lex}'" - node.set_main_position(token.line, token.column) token = self.tokens[self.position + 1] node.type_position = token.line, token.column self.inc_position(2) # ends after `type` - while count: - self.inc_position() - count -= 1 - - @visitor.when(cool.NegationNode) - def visit(self, node: cool.NegationNode): + @visitor.when(ast.NegationNode) + def visit(self, node: ast.NegationNode): self._check_unary_operation(node) - @visitor.when(cool.ComplementNode) - def visit(self, node: cool.ComplementNode): + @visitor.when(ast.ComplementNode) + def visit(self, node: ast.ComplementNode): self._check_unary_operation(node) - @visitor.when(cool.IsVoidNode) - def visit(self, node: cool.IsVoidNode): + @visitor.when(ast.IsVoidNode) + def visit(self, node: ast.IsVoidNode): self._check_unary_operation(node) - @visitor.when(cool.PlusNode) - def visit(self, node: cool.PlusNode): + @visitor.when(ast.PlusNode) + def visit(self, node: ast.PlusNode): self._check_binary_operation(node) - @visitor.when(cool.MinusNode) - def visit(self, node: cool.MinusNode): + @visitor.when(ast.MinusNode) + def visit(self, node: ast.MinusNode): self._check_binary_operation(node) - @visitor.when(cool.StarNode) - def visit(self, node: cool.StarNode): + @visitor.when(ast.StarNode) + def visit(self, node: ast.StarNode): self._check_binary_operation(node) - @visitor.when(cool.DivNode) - def visit(self, node: cool.DivNode): + @visitor.when(ast.DivNode) + def visit(self, node: ast.DivNode): self._check_binary_operation(node) - @visitor.when(cool.LessEqualNode) - def visit(self, node: cool.LessEqualNode): + @visitor.when(ast.LessEqualNode) + def visit(self, node: ast.LessEqualNode): self._check_binary_operation(node) - @visitor.when(cool.LessThanNode) - def visit(self, node: cool.LessThanNode): + @visitor.when(ast.LessThanNode) + def visit(self, node: ast.LessThanNode): self._check_binary_operation(node) - @visitor.when(cool.EqualNode) - def visit(self, node: cool.EqualNode): + @visitor.when(ast.EqualNode) + def visit(self, node: ast.EqualNode): self._check_binary_operation(node) - def _check_binary_operation(self, node: cool.BinaryNode): + def _check_binary_operation(self, node: ast.BinaryNode): """ expr operation expr """ @@ -436,7 +421,7 @@ def _check_binary_operation(self, node: cool.BinaryNode): self.visit(node.right) - def _check_unary_operation(self, node: cool.UnaryNode): + def _check_unary_operation(self, node: ast.UnaryNode): """ operation expr """ @@ -449,7 +434,7 @@ def _check_unary_operation(self, node: cool.UnaryNode): self.inc_position() # ends after `operation` self.visit(node.expr) - def _atom_node(self, node: cool.Node): + def _atom_node(self, node: ast.Node): token = self.tokens[self.position] node.set_main_position(token.line, token.column) self.inc_position() # ends after `atom` diff --git a/src/cool/semantics/type_checker.py b/src/cool/semantics/type_checker.py index d1d8dbb53..0735b3aac 100644 --- a/src/cool/semantics/type_checker.py +++ b/src/cool/semantics/type_checker.py @@ -204,10 +204,9 @@ def visit(self, node: cool.AssignNode, scope: Scope): @visitor.when(cool.BlockNode) def visit(self, node: cool.BlockNode, scope: Scope): - child_scope = scope.create_child() return_type = ErrorType() for expr in node.expressions: - return_type = self.visit(expr, child_scope) + return_type = self.visit(expr, scope) return return_type @visitor.when(cool.ConditionalNode) @@ -230,7 +229,7 @@ def visit(self, node: cool.WhileNode, scope: Scope): % (node.line, node.column, condition.name, "Bool") ) - self.visit(node.body, scope.create_child()) + self.visit(node.body, scope) return self.context.get_type("Object") @visitor.when(cool.SwitchCaseNode) diff --git a/src/cool/semantics/type_inference.py b/src/cool/semantics/type_inference.py index 6c7595280..dc8c6605d 100644 --- a/src/cool/semantics/type_inference.py +++ b/src/cool/semantics/type_inference.py @@ -297,6 +297,10 @@ def visit(self, node: cool.ClassDeclarationNode, scope: Scope): if isinstance(feature, cool.MethodDeclarationNode) ] + for attr, attr_owner in self.current_type.all_attributes(): + if attr_owner != self.current_type: + scope.define_variable(attr.name, attr.type) + for attr in attrs: self.visit(attr, scope) @@ -305,6 +309,13 @@ def visit(self, node: cool.ClassDeclarationNode, scope: Scope): @visitor.when(cool.AttrDeclarationNode) def visit(self, node: cool.AttrDeclarationNode, scope: Scope): + if node.id == "self": + if node.expr is not None: + scope.create_child() + return + + scope.define_variable("self", self.current_type) + # Solve the expression of the attribute expr_node = ( self.visit(node.expr, scope.create_child()) @@ -312,26 +323,29 @@ def visit(self, node: cool.AttrDeclarationNode, scope: Scope): else None ) - # Define attribute in the scope - var_info = scope.define_variable(node.id, self.context.get_type(node.type)) + try: + # Define attribute in the scope + var_info = scope.define_variable(node.id, self.context.get_type(node.type)) - # Set and get the reference to the variable info node - var_info_node = self.variables[var_info] = VariableInfoNode( - self.context.get_type(node.type), var_info - ) + # Set and get the reference to the variable info node + var_info_node = self.variables[var_info] = VariableInfoNode( + self.context.get_type(node.type), var_info + ) - if node.type == "AUTO_TYPE": - # Get the reference to the attribute node - attr_node = self.attributes[self.current_type.name, node.id] + if node.type == "AUTO_TYPE": + # Get the reference to the attribute node + attr_node = self.attributes[self.current_type.name, node.id] - # If the expression node is not None then two edges are creates in the graph - if expr_node is not None: - self.graph.add_edge(expr_node, var_info_node) - self.graph.add_edge(expr_node, attr_node) + # If the expression node is not None then two edges are creates in the graph + if expr_node is not None: + self.graph.add_edge(expr_node, var_info_node) + self.graph.add_edge(expr_node, attr_node) - # Finally a cycle of two nodes is created between var_info_node and attr_node - self.graph.add_edge(var_info_node, attr_node) - self.graph.add_edge(attr_node, var_info_node) + # Finally a cycle of two nodes is created between var_info_node and attr_node + self.graph.add_edge(var_info_node, attr_node) + self.graph.add_edge(attr_node, var_info_node) + except SemanticError: + pass @visitor.when(cool.MethodDeclarationNode) def visit(self, node: cool.MethodDeclarationNode, scope: Scope): @@ -432,19 +446,18 @@ def visit(self, node: cool.AssignNode, scope: Scope): @visitor.when(cool.BlockNode) def visit(self, node: cool.BlockNode, scope: Scope): - child_scope = scope.create_child() result_node = None for expr in node.expressions: - result_node = self.visit(expr, child_scope) + result_node = self.visit(expr, scope) return result_node @visitor.when(cool.ConditionalNode) def visit(self, node: cool.ConditionalNode, scope: Scope): if_node = self.visit(node.if_expr, scope) - - if not isinstance(if_node, AtomNode): + + if if_node is not None and not isinstance(if_node, AtomNode): self.graph.add_edge(AtomNode(self.context.get_type("Bool")), if_node) - + then_node = self.visit(node.then_expr, scope.create_child()) else_node = self.visit(node.else_expr, scope.create_child()) @@ -454,6 +467,10 @@ def visit(self, node: cool.ConditionalNode, scope: Scope): conditional_node = ConditionalNode( self.context.get_type("AUTO_TYPE"), then_node, else_node ) + + if then_node is None or else_node is None: + return conditional_node + if isinstance(then_node, AtomNode) and not isinstance(else_node, AtomNode): self.graph.add_edge(then_node, else_node) elif not isinstance(then_node, AtomNode) and isinstance(else_node, AtomNode): @@ -469,7 +486,7 @@ def visit(self, node: cool.ConditionalNode, scope: Scope): @visitor.when(cool.WhileNode) def visit(self, node: cool.WhileNode, scope: Scope): self.visit(node.condition, scope) - self.visit(node.body, scope.create_child()) + self.visit(node.body, scope) return AtomNode(self.context.get_type("Object")) @visitor.when(cool.SwitchCaseNode) @@ -481,8 +498,13 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): case_nodes = [] for _id, _type, _expr in node.cases: new_scope = scope.create_child() - var_info = new_scope.define_variable(_id, self.context.get_type(_type)) - self.variables[var_info] = VariableInfoNode(var_info.type, var_info) + + try: + case_type = self.context.get_type(_type) + var_info = new_scope.define_variable(_id, case_type) + self.variables[var_info] = VariableInfoNode(var_info.type, var_info) + except SemanticError: + pass case_node = self.visit(_expr, new_scope) if isinstance(case_node, AtomNode): @@ -510,7 +532,10 @@ def visit(self, node: cool.MethodCallNode, scope: Scope): if isinstance(obj_node, AtomNode) and obj_node.type.contains_method(node.id): method, owner = obj_node.type.get_method(node.id, get_owner=True) param_nodes, return_node = self.methods[owner.name, method.name] - for i, arg in enumerate(node.args): + + count_of_args = min(len(node.args), len(param_nodes)) + for i in range(count_of_args): + arg = node.args[i] arg_node = self.visit(arg, scope) if arg_node is None: @@ -555,13 +580,13 @@ def visit(self, node: cool.BooleanNode, scope: Scope): @visitor.when(cool.VariableNode) def visit(self, node: cool.VariableNode, scope: Scope): - var_info = scope.find_variable(node.lex) + variable = scope.find_variable(node.lex) - if var_info is not None: - if var_info.type.name == "AUTO_TYPE": - return self.variables[var_info] + if variable is not None: + if variable.type.name == "AUTO_TYPE": + return self.variables[variable] else: - return AtomNode(var_info.type) + return AtomNode(variable.type) else: return None @@ -634,10 +659,10 @@ def _visit_arithmetic_node( left = self.visit(node.left, scope) right = self.visit(node.right, scope) - if not isinstance(left, AtomNode): + if left is not None and not isinstance(left, AtomNode): self.graph.add_edge(AtomNode(member_types), left) - if not isinstance(right, AtomNode): + if right is not None and not isinstance(right, AtomNode): self.graph.add_edge(AtomNode(member_types), right) return AtomNode(return_type) @@ -677,41 +702,56 @@ def visit(self, node: cool.ClassDeclarationNode, scope: Scope): i = 0 for attr in attrs: + count = len(scope.children) + if attr.expr is not None: attr.index = i i += 1 + self.visit(attr, scope) + + if count < len(scope.children): + i -= 1 + + # print(scope.children, len(methods), i) for i, method in enumerate(methods, i): self.visit(method, scope.children[i]) @visitor.when(cool.AttrDeclarationNode) def visit(self, node: cool.AttrDeclarationNode, scope: Scope): - attr_type = self.context.get_type(node.type) - var_info = scope.find_variable(node.id) + try: + attr_type = self.context.get_type(node.type) + var_info = scope.find_variable(node.id) - if node.expr is not None: - self.visit(node.expr, scope.children[node.index]) + if node.expr is not None: + self.visit(node.expr, scope.children[node.index]) - if attr_type == self.context.get_type("AUTO_TYPE"): - if var_info.type == self.context.get_type("AUTO_TYPE"): - self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % node.id) - node.type = var_info.type.name + if attr_type == self.context.get_type("AUTO_TYPE"): + if var_info.type == self.context.get_type("AUTO_TYPE"): + self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % node.id) + node.type = var_info.type.name + except SemanticError: + pass @visitor.when(cool.MethodDeclarationNode) def visit(self, node: cool.MethodDeclarationNode, scope: Scope): self.current_method = self.current_type.get_method(node.id) - return_type = self.context.get_type(node.return_type) + + try: + return_type = self.context.get_type(node.return_type) + except SemanticError: + return_type = None - for i, (name, expr_body_type) in enumerate(node.params): + for i, (name, _) in enumerate(node.params): variable_info = scope.find_variable(name) if variable_info.type == self.context.get_type("AUTO_TYPE"): - self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % name) + self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % (node.param_types_positions[i][0], node.param_types_positions[i][1], name)) node.params[i] = (name, variable_info.type.name) self.visit(node.body, scope) - if return_type == self.context.get_type("AUTO_TYPE"): + if return_type is not None and return_type == self.context.get_type("AUTO_TYPE"): if self.current_method.return_type == self.context.get_type("AUTO_TYPE"): self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % node.id) node.return_type = self.current_method.return_type.name @@ -739,20 +779,19 @@ def visit(self, node: cool.AssignNode, scope: Scope): @visitor.when(cool.BlockNode) def visit(self, node: cool.BlockNode, scope: Scope): - child_scope = scope.children[0] for _, expr in enumerate(node.expressions): - self.visit(expr, child_scope) + self.visit(expr, scope) @visitor.when(cool.ConditionalNode) def visit(self, node: cool.ConditionalNode, scope: Scope): self.visit(node.if_expr, scope) - self.visit(node.then_expr, scope.children[0]) - self.visit(node.else_expr, scope.children[1]) + self.visit(node.then_expr, scope) + self.visit(node.else_expr, scope) @visitor.when(cool.WhileNode) def visit(self, node: cool.WhileNode, scope: Scope): self.visit(node.condition, scope) - self.visit(node.body, scope.children[0]) + self.visit(node.body, scope) @visitor.when(cool.SwitchCaseNode) def visit(self, node: cool.SwitchCaseNode, scope: Scope): From 24db1059b48bfcb0999019f3ca75da4a83da362a Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Thu, 25 Nov 2021 20:58:49 -0500 Subject: [PATCH 126/143] A mitad de camino --- main.cl | 4 +- src/cool/__main__.py | 20 +- src/cool/code_generation/__init__.py | 2 +- src/cool/code_generation/cil.py | 50 +- .../code_generation/cool_to_cil_visitor.py | 598 +++++++++++++++++- src/cool/code_generation/icool.py | 17 +- src/cool/semantics/position_assigner.py | 10 + src/cool/semantics/type_checker.py | 2 +- src/cool/semantics/type_inference.py | 33 +- src/cool/semantics/utils/scope.py | 29 + 10 files changed, 704 insertions(+), 61 deletions(-) diff --git a/main.cl b/main.cl index 8174685fd..aa9a73e05 100644 --- a/main.cl +++ b/main.cl @@ -1,6 +1,8 @@ class Main { + number: Int <- 0; + main() : Object { - let io: IO <- new IO, p: Point <- (new Point).init(1, 2) in { + let x: Int <- number + 2, io: IO <- new IO, p: Point <- (new Point).init(1, 2) in { io.out_string("("); io.out_int(p.get_x()); io.out_string(","); diff --git a/src/cool/__main__.py b/src/cool/__main__.py index b969d8bf4..fec1f2d1c 100644 --- a/src/cool/__main__.py +++ b/src/cool/__main__.py @@ -7,7 +7,12 @@ sys.path.append(os.getcwd()) -from cool.code_generation import CILFormatter, ConstructorCreator, CoolToCILVisitor +from cool.code_generation import ( + CILFormatter, + ICoolTranslator, + ICoolTypeChecker, + CoolToCilTranslator, +) from cool.grammar import Token, serialize_parser_and_lexer from cool.lexertab import CoolLexer from cool.parsertab import CoolParser @@ -132,15 +137,18 @@ def compile( ################### # Code Generation # ################### - # icool_ast = ConstructorCreator(context).visit(ast, scope) + icool_ast = ICoolTranslator(context).visit(ast) + + scope = Scope() + ICoolTypeChecker(context, errors).visit(icool_ast, scope) - # if verbose: + # if verbose or True: # log_success(CodeBuilder().visit(icool_ast)) - # cil_ast = CoolToCILVisitor(context).visit(icool_ast, scope) + cil_ast = CoolToCilTranslator(context).visit(icool_ast, scope) - # if verbose or True: - # log_success(CILFormatter().visit(cil_ast)) + if verbose or True: + log_success(CILFormatter().visit(cil_ast)) ####### # End # ####### diff --git a/src/cool/code_generation/__init__.py b/src/cool/code_generation/__init__.py index 404fa3849..292568a7c 100644 --- a/src/cool/code_generation/__init__.py +++ b/src/cool/code_generation/__init__.py @@ -1,2 +1,2 @@ -from .cool_to_cil_visitor import ConstructorCreator, CoolToCILVisitor +from .cool_to_cil_visitor import ICoolTranslator, ICoolTypeChecker, CoolToCilTranslator from .cil import CILFormatter diff --git a/src/cool/code_generation/cil.py b/src/cool/code_generation/cil.py index b455f5ab7..ba1673b0b 100644 --- a/src/cool/code_generation/cil.py +++ b/src/cool/code_generation/cil.py @@ -60,16 +60,16 @@ class InstructionNode(Node): class AssignNode(InstructionNode): - def __init__(self, dest, source): - self.dest = dest - self.source = source + def __init__(self, dest: str, source: str): + self.dest: str = dest + self.source: str = source class ArithmeticNode(InstructionNode): - def __init__(self, dest, left, right): - self.dest = dest - self.left = left - self.right = right + def __init__(self, dest: str, left: str, right: str): + self.dest: str = dest + self.left: str = left + self.right: str = right class PlusNode(ArithmeticNode): @@ -88,14 +88,32 @@ class DivNode(ArithmeticNode): pass -class GetAttribNode(InstructionNode): +class LessEqualNode(ArithmeticNode): pass -class SetAttribNode(InstructionNode): +class LessThanNode(ArithmeticNode): pass +class EqualNode(ArithmeticNode): + pass + + +class GetAttribNode(InstructionNode): + def __init__(self, dest: str, instance: str, attr: str) -> None: + self.dest: str = dest + self.instance: str = instance + self.attr: str = attr + + +class SetAttribNode(InstructionNode): + def __init__(self, instance: str, attr: str, source: str) -> None: + self.instance: str = instance + self.attr: str = attr + self.source: str = source + + class GetIndexNode(InstructionNode): pass @@ -115,9 +133,9 @@ class ArrayNode(InstructionNode): class TypeOfNode(InstructionNode): - def __init__(self, obj, dest): - self.obj = obj - self.dest = dest + def __init__(self, obj: str, dest: str): + self.obj: str = obj + self.dest: str = dest class LabelNode(InstructionNode): @@ -265,6 +283,14 @@ def visit(self, node): def visit(self, node): return f"{node.dest} = VCALL {node.type} {node.method}" + @visitor.when(GetAttribNode) + def visit(self, node: GetAttribNode): + return f"{node.dest} = GETATTR {node.instance} {node.attr}" + + @visitor.when(SetAttribNode) + def visit(self, node: SetAttribNode): + return f"SETATTR {node.instance} {node.attr} {node.source}" + @visitor.when(ArgNode) def visit(self, node): return f"ARG {node.name}" diff --git a/src/cool/code_generation/cool_to_cil_visitor.py b/src/cool/code_generation/cool_to_cil_visitor.py index 74881edcd..a70aa4c6f 100644 --- a/src/cool/code_generation/cool_to_cil_visitor.py +++ b/src/cool/code_generation/cool_to_cil_visitor.py @@ -1,14 +1,25 @@ -from typing import Dict, List, Optional +from typing import Dict, List, Optional, Tuple import cool.code_generation.cil as cil import cool.code_generation.icool as icool import cool.semantics.utils.astnodes as cool +import cool.semantics.utils.errors as err +import cool.visitor as visitor import cool.visitor.visitor as visitor from cool.code_generation.base import BaseCOOLToCILVisitor -from cool.semantics.utils.scope import Context, Method, Scope, Type - - -class ConstructorCreator: +from cool.semantics import TypeChecker +from cool.semantics.utils.scope import ( + Attribute, + Context, + ErrorType, + Method, + Scope, + SemanticError, + Type, +) + + +class ICoolTranslator: def __init__(self, context: Context): self.current_type: Optional[Type] = None self.current_method: Optional[Method] = None @@ -16,23 +27,23 @@ def __init__(self, context: Context): self.class_declarations = {} # type: Dict[str, cool.ClassDeclarationNode] @visitor.on("node") - def visit(self, node, scope): + def visit(self, node): pass @visitor.when(cool.ProgramNode) - def visit(self, node: cool.ProgramNode, scope: Scope): + def visit(self, node: cool.ProgramNode): declarations: List[cool.ClassDeclarationNode] = [] for declaration in node.declarations: self.class_declarations[declaration.id] = declaration for declaration in node.declarations: - declarations.append(self.visit(declaration, scope)) + declarations.append(self.visit(declaration)) return cool.ProgramNode(declarations) @visitor.when(cool.ClassDeclarationNode) - def visit(self, node: cool.ClassDeclarationNode, scope: Scope): + def visit(self, node: cool.ClassDeclarationNode): self.current_type = self.context.get_type(node.id) ancestors = [ @@ -55,7 +66,7 @@ def visit(self, node: cool.ClassDeclarationNode, scope: Scope): expressions: List[cool.ExprNode] = [] for attr in attrs: - expressions.append(self.visit(attr, scope)) + expressions.append(self.visit(attr)) expressions.append(cool.VariableNode("self")) body = cool.BlockNode(expressions) @@ -66,7 +77,7 @@ def visit(self, node: cool.ClassDeclarationNode, scope: Scope): # Added the Type self.current_type.define_method("__init__", [], [], self.current_type) - attr = [ + attrs = [ feature for feature in node.features if isinstance(feature, cool.AttrDeclarationNode) @@ -76,12 +87,13 @@ def visit(self, node: cool.ClassDeclarationNode, scope: Scope): for feature in node.features if isinstance(feature, cool.MethodDeclarationNode) ] + features = attrs + [constructor] + methods return cool.ClassDeclarationNode(node.id, features, node.parent) @visitor.when(cool.AttrDeclarationNode) - def visit(self, node: cool.AttrDeclarationNode, scope: Scope): + def visit(self, node: cool.AttrDeclarationNode): if node.expr is None: expr = None if node.type == "Int": @@ -92,7 +104,7 @@ def visit(self, node: cool.AttrDeclarationNode, scope: Scope): expr = cool.StringNode('""') else: expr = ( - icool.VoidNode() + icool.NullNode() ) # cool.WhileNode(cool.BooleanNode("false"), cool.IntegerNode("0")) return cool.AssignNode(node.id, expr) @@ -100,19 +112,473 @@ def visit(self, node: cool.AttrDeclarationNode, scope: Scope): return cool.AssignNode(node.id, node.expr) +class ICoolTypeChecker: + def __init__(self, context: Context, errors: List[str]): + self.context: Context = context + self.errors: List[str] = errors + self.current_type: Optional[Type] = None + self.current_method: Optional[Method] = None + self.current_attribute: Optional[Attribute] = None + + @visitor.on("node") + def visit(self, node, scope): + pass + + @visitor.when(cool.ProgramNode) + def visit(self, node: cool.ProgramNode, scope: Scope = None): + if scope is None: + scope = Scope() + + for elem in node.declarations: + self.visit(elem, scope.create_child()) + + return scope + + @visitor.when(cool.ClassDeclarationNode) + def visit(self, node: cool.ClassDeclarationNode, scope: Scope): + self.current_type = self.context.get_type(node.id) + + attrs = [ + feature + for feature in node.features + if isinstance(feature, cool.AttrDeclarationNode) + ] + methods = [ + feature + for feature in node.features + if isinstance(feature, cool.MethodDeclarationNode) + ] + + for attr, attr_owner in self.current_type.all_attributes(): + if attr_owner != self.current_type: + scope.define_variable(attr.name, attr.type) + + for attr in attrs: + self.visit(attr, scope) + + for method in methods: + self.visit(method, scope.create_child()) + + @visitor.when(cool.AttrDeclarationNode) + def visit(self, node: cool.AttrDeclarationNode, scope: Scope): + if node.id == "self": + self.errors.append(err.SELF_INVALID_ATTRIBUTE_ID % (node.line, node.column)) + + try: + attr_type = ( + self.context.get_type(node.type) + if node.type != "SELF_TYPE" + else self.current_type + ) + except SemanticError: + attr_type = ErrorType() + + scope.define_variable("self", self.current_type) + + # set the current attribute for analyze the body + # and set the self.current_method variable to None + self.current_attribute = self.current_type.get_attribute(node.id) + self.current_method = None + + if node.expr is not None: + expr_type = self.visit(node.expr, scope.create_child()) + if not expr_type.conforms_to(attr_type): + line, column = node.expr_position + self.errors.append( + err.INCOMPATIBLE_TYPES + % (line, column, expr_type.name, attr_type.name) + ) + scope.define_variable(node.id, attr_type) + + @visitor.when(cool.MethodDeclarationNode) + def visit(self, node: cool.MethodDeclarationNode, scope: Scope): + self.current_method = self.current_type.get_method(node.id) + self.current_attribute = None + + # Parameters can hide the attribute declaration, that's why we are not checking if there is defined, + # instead we are checking for local declaration. Also it is checked that the static type of a parameter is + # different of SELF_TYPE. + + scope.define_variable("self", self.current_type) + + for param_name, param_type in zip( + self.current_method.param_names, self.current_method.param_types + ): + if not scope.is_local(param_name): + if param_type.name == "SELF_TYPE": + self.errors.append(err.INVALID_PARAM_TYPE % "SELF_TYPE") + scope.define_variable(param_name, ErrorType()) + else: + try: + scope.define_variable( + param_name, self.context.get_type(param_type.name) + ) + except SemanticError: + scope.define_variable(param_name, ErrorType()) + else: + self.errors.append( + err.LOCAL_ALREADY_DEFINED + % (node.line, node.column, param_name, self.current_method.name) + ) + + try: + return_type = ( + self.context.get_type(node.return_type) + if node.return_type != "SELF_TYPE" + else self.current_type + ) + except SemanticError: + return_type = ErrorType() + + expr_type = self.visit(node.body, scope) + + if not expr_type.conforms_to(return_type): + self.errors.append( + err.INCOMPATIBLE_TYPES + % (node.line, node.column, expr_type.name, return_type.name) + ) + + @visitor.when(cool.LetNode) + def visit(self, node: cool.LetNode, scope: Scope): + for i, (_id, _type, _expr) in enumerate(node.declarations): + if _id == "self": + line, column = node.declaration_names_positions[i] + self.errors.append(err.SELF_USED_IN_LET % (line, column)) + continue + + try: + var_static_type = ( + self.context.get_type(_type) + if _type != "SELF_TYPE" + else self.current_type + ) + except SemanticError: + line, column = node.declaration_types_positions[i] + self.errors.append(err.UNDEFINED_TYPE % (line, column, _type)) + var_static_type = ErrorType() + + # if scope.is_local(_id): + # feature = self.current_method or self.current_attribute + # self.errors.append( + # err.LOCAL_ALREADY_DEFINED + # % (node.line, node.column, _id, feature.name) + # ) + # else: + scope.define_variable(_id, var_static_type) + + expr_type = ( + self.visit(_expr, scope.create_child()) if _expr is not None else None + ) + if expr_type is not None and not expr_type.conforms_to(var_static_type): + self.errors.append( + err.INCOMPATIBLE_TYPES + % (node.line, node.column, expr_type.name, var_static_type.name) + ) + + return self.visit(node.expr, scope.create_child()) + + @visitor.when(cool.AssignNode) + def visit(self, node: cool.AssignNode, scope: Scope): + var_info = scope.find_variable(node.id) + + if var_info.name == "self": + self.errors.append(err.SELF_IS_READONLY % (node.line, node.column)) + + expr_type = self.visit(node.expr, scope) + + if var_info is None: + self.errors.append( + err.UNDEFINED_VARIABLE + % (node.line, node.column, node.id, self.current_method.name) + ) + else: + if not expr_type.conforms_to(var_info.type): + self.errors.append( + err.INCOMPATIBLE_TYPES + % (node.line, node.column, expr_type.name, var_info.type.name) + ) + + return expr_type + + @visitor.when(cool.BlockNode) + def visit(self, node: cool.BlockNode, scope: Scope): + return_type = ErrorType() + for expr in node.expressions: + return_type = self.visit(expr, scope) + return return_type + + @visitor.when(cool.ConditionalNode) + def visit(self, node: cool.ConditionalNode, scope: Scope): + if_type = self.visit(node.if_expr, scope) + then_type = self.visit(node.then_expr, scope) + else_type = self.visit(node.else_expr, scope) + if if_type != self.context.get_type("Bool"): + self.errors.append( + err.INCOMPATIBLE_TYPES % (node.line, node.column, if_type.name, "Bool") + ) + return then_type.join(else_type) + + @visitor.when(cool.WhileNode) + def visit(self, node: cool.WhileNode, scope: Scope): + condition = self.visit(node.condition, scope) + if condition != self.context.get_type("Bool"): + self.errors.append( + err.INCOMPATIBLE_TYPES + % (node.line, node.column, condition.name, "Bool") + ) + + self.visit(node.body, scope) + return self.context.get_type("Object") + + @visitor.when(cool.SwitchCaseNode) + def visit(self, node: cool.SwitchCaseNode, scope: Scope): + self.visit(node.expr, scope) + types = [] + visited = set() + for i, (identifier, type_name, expr) in enumerate(node.cases): + new_scope = scope.create_child() + try: + if type_name != "SELF_TYPE": + new_scope.define_variable( + identifier, self.context.get_type(type_name) + ) + else: + self.errors.append(err.INVALID_CASE_TYPE % type_name) + except SemanticError: + new_scope.define_variable(identifier, ErrorType()) + line, column = node.cases_positions[i] + self.errors.append( + err.UNDEFINED_TYPE_IN_BRANCH % (line, column, type_name) + ) + + # Cannot be dublicate Branches types + if type_name in visited: + line, column = node.cases_positions[i] + self.errors.append( + err.DUPLICATE_BARNCH_IN_CASE % (line, column, type_name) + ) + + visited.add(type_name) + types.append(self.visit(expr, new_scope)) + + return Type.multi_join(types) + + @visitor.when(cool.MethodCallNode) + def visit(self, node: cool.MethodCallNode, scope: Scope): + if node.obj is None: + node.obj = cool.VariableNode("self") + obj_type = self.visit(node.obj, scope) + + if node.type is not None: + try: + ancestor_type = self.context.get_type(node.type) + except SemanticError: + ancestor_type = ErrorType() + line, column = node.type_position + self.errors.append(err.UNDEFINED_TYPE % (line, column, node.type)) + + if not obj_type.conforms_to(ancestor_type): + line, column = node.type_position + self.errors.append( + err.INVALID_ANCESTOR + % (line, column, obj_type.name, ancestor_type.name) + ) + else: + ancestor_type = obj_type + + try: + method = ancestor_type.get_method(node.id) + except SemanticError: + line, column = node.id_position + self.errors.append( + err.DISPATCH_UNDEFINED_METHOD % (line, column, node.id, obj_type.name) + ) + + for arg in node.args: + self.visit(arg, scope) + return ErrorType() + + args_count = len(node.args) + params_count = len(method.param_names) + if args_count != params_count: + line, column = node.id_position + self.errors.append( + err.DISPATCH_WITH_WRONG_NUMBER_OF_ARGS + % (line, column, method.name, obj_type.name, params_count, args_count) + ) + + number_of_args = min(args_count, params_count) + for i, arg in enumerate(node.args[:number_of_args]): + arg_type = self.visit(arg, scope) + if not arg_type.conforms_to(method.param_types[i]): + line, column = node.args_positions[i] + self.errors.append( + err.INCOMPATIBLE_TYPES + % ( + line, + column, + arg_type.name, + method.param_types[i].name, + ) + ) + + return ( + method.return_type + if method.return_type.name != "SELF_TYPE" + else ancestor_type + ) + + @visitor.when(cool.IntegerNode) + def visit(self, node: cool.IntegerNode, scope: Scope): + return self.context.get_type("Int") + + @visitor.when(cool.StringNode) + def visit(self, node: cool.StringNode, scope: Scope): + return self.context.get_type("String") + + @visitor.when(cool.BooleanNode) + def visit(self, node: cool.BooleanNode, scope: Scope): + return self.context.get_type("Bool") + + @visitor.when(icool.NullNode) + def visit(self, node: icool.NullNode, scope: Scope): + return icool.NullType() + + @visitor.when(cool.VariableNode) + def visit(self, node: cool.VariableNode, scope: Scope): + variable = scope.find_variable(node.lex) + if variable is None: + if self.current_attribute is not None: + name = self.current_attribute.name + else: + name = self.current_method.name + + self.errors.append( + err.UNDEFINED_VARIABLE % (node.line, node.column, node.lex, name) + ) + return ErrorType() + return variable.type + + @visitor.when(cool.InstantiateNode) + def visit(self, node: cool.InstantiateNode, scope: Scope): + try: + return ( + self.context.get_type(node.lex) + if node.lex != "SELF_TYPE" + else self.current_type + ) + except SemanticError as e: + line, column = node.type_position + self.errors.append(err.UNDEFINED_NEW_TYPE % (line, column, node.lex)) + return ErrorType() + + @visitor.when(cool.NegationNode) + def visit(self, node: cool.NegationNode, scope: Scope): + return self._check_unary_operation( + node, scope, "not", self.context.get_type("Bool") + ) + + @visitor.when(cool.ComplementNode) + def visit(self, node: cool.ComplementNode, scope: Scope): + return self._check_unary_operation( + node, scope, "~", self.context.get_type("Int") + ) + + @visitor.when(cool.IsVoidNode) + def visit(self, node: cool.IsVoidNode, scope: Scope): + self.visit(node.expr, scope) + return self.context.get_type("Bool") + + @visitor.when(cool.PlusNode) + def visit(self, node: cool.PlusNode, scope: Scope): + return self._check_int_binary_operation( + node, scope, "+", self.context.get_type("Int") + ) + + @visitor.when(cool.MinusNode) + def visit(self, node: cool.MinusNode, scope: Scope): + return self._check_int_binary_operation( + node, scope, "-", self.context.get_type("Int") + ) + + @visitor.when(cool.StarNode) + def visit(self, node: cool.StarNode, scope: Scope): + return self._check_int_binary_operation( + node, scope, "*", self.context.get_type("Int") + ) + + @visitor.when(cool.DivNode) + def visit(self, node: cool.DivNode, scope: Scope): + return self._check_int_binary_operation( + node, scope, "/", self.context.get_type("Int") + ) + + @visitor.when(cool.LessEqualNode) + def visit(self, node: cool.LessEqualNode, scope: Scope): + return self._check_int_binary_operation( + node, scope, "<=", self.context.get_type("Bool") + ) + + @visitor.when(cool.LessThanNode) + def visit(self, node: cool.LessThanNode, scope: Scope): + return self._check_int_binary_operation( + node, scope, "<", self.context.get_type("Bool") + ) + + @visitor.when(cool.EqualNode) + def visit(self, node: cool.EqualNode, scope: Scope): + left_type = self.visit(node.left, scope) + right_type = self.visit(node.right, scope) + + basic_types = ("Int", "String", "Bool") + if ( + left_type.name in basic_types or left_type.name in basic_types + ) and left_type.name != right_type.name: + self.errors.append( + err.INVALID_EQ_COMPARISON_OPERATION % (node.line, node.column) + ) + return self.context.get_type("Bool") + + def _check_int_binary_operation( + self, node: cool.BinaryNode, scope: Scope, operation: str, return_type: Type + ): + left_type = self.visit(node.left, scope) + right_type = self.visit(node.right, scope) + + if left_type == right_type == self.context.get_type("Int"): + return return_type + self.errors.append( + err.INVALID_BINARY_OPERATION + % (node.line, node.column, operation, left_type.name, right_type.name) + ) + return ErrorType() + + def _check_unary_operation( + self, node: cool.UnaryNode, scope: Scope, operation: str, expected_type: Type + ): + typex = self.visit(node.expr, scope) + if typex == expected_type: + return typex + self.errors.append( + err.INVALID_UNARY_OPERATION + % (node.line, node.column, operation, typex.name) + ) + return ErrorType() + + # Notes: # 1 - All the expression nodes are going to return a tuple [str, Type] -class CoolToCILVisitor(BaseCOOLToCILVisitor): +class CoolToCilTranslator(BaseCOOLToCILVisitor): @visitor.on("node") def visit(self, node, scope): pass @visitor.when(cool.ProgramNode) def visit(self, node: cool.ProgramNode, scope: Scope): - for declaration in node.declarations: - self.visit(declaration, scope) + for i, declaration in enumerate(node.declarations): + self.visit(declaration, scope.children[i]) return cil.ProgramNode(self.dottypes, self.dotdata, self.dotcode) @@ -122,6 +588,12 @@ def visit(self, node: cool.ClassDeclarationNode, scope: Scope): type_node = self.register_type(self.current_type.name) + attrs = [ + feature + for feature in node.features + if isinstance(feature, cool.AttrDeclarationNode) + ] + methods = [ feature for feature in node.features @@ -145,8 +617,9 @@ def visit(self, node: cool.ClassDeclarationNode, scope: Scope): (method.name, self.to_function_name(method.name, ancestor.name)) ) - for method, child_scope in zip(methods, scope.children): - self.visit(method, child_scope) + i = len([attr for attr in attrs if attr.expr is not None]) + for i, method in enumerate(methods, start=i): + self.visit(method, scope.children[i]) @visitor.when(cool.AttrDeclarationNode) def visit(self, node: cool.AttrDeclarationNode, scope: Scope): @@ -164,7 +637,9 @@ def visit(self, node: cool.MethodDeclarationNode, scope: Scope): cil.ParamNode(param_name) for param_name, _ in node.params ] - self.visit(node.body, scope) + source, _ = self.visit(node.body, scope) + + self.register_instruction(cil.ReturnNode(source)) @visitor.when(cool.LetNode) def visit(self, node: cool.LetNode, scope: Scope): @@ -178,15 +653,33 @@ def visit(self, node: cool.LetNode, scope: Scope): self.register_instruction(cil.AssignNode(name, source)) i += 1 - self.register_instruction(cil.ReturnNode(0)) + source, t = self.visit(node.expr, scope.children[i]) + + return source, t + + @visitor.when(cool.AssignNode) + def visit(self, node: cool.AssignNode, scope: Scope): + variable = scope.find_variable(node.id) + variables = scope.find_all_variables(node.id) + source, _ = self.visit(node.expr, scope) + + is_attribute = ( + self.current_type.contains_attribute(node.id) and len(variables) == 1 + ) + + if is_attribute: + self.register_instruction(cil.SetAttribNode("self", variable.name, source)) + else: + self.register_instruction(cil.AssignNode(variable.name, source)) + + return variable.name, variable.type @visitor.when(cool.BlockNode) def visit(self, node: cool.BlockNode, scope: Scope): - child_scope = scope.create_child() - return_type = ErrorType() + source, inst_type = None, None for expr in node.expressions: - return_type = self.visit(expr, child_scope) - return return_type + source, inst_type = self.visit(expr, scope) + return source, inst_type @visitor.when(cool.MethodCallNode) def visit(self, node: cool.MethodCallNode, scope: Scope): @@ -222,8 +715,65 @@ def visit(self, node: cool.StringNode, scope: Scope): def visit(self, node: cool.BooleanNode, scope: Scope): return node.lex, self.context.get_type("Bool") + @visitor.when(icool.NullNode) + def visit(self, node: icool.NullNode, scope: Scope): + return node.lex, icool.NullType() + + @visitor.when(cool.VariableNode) + def visit(self, node: cool.VariableNode, scope: Scope): + variable = scope.find_variable(node.lex) + variables = scope.find_all_variables(node.lex) + + is_attribute = ( + self.current_type.contains_attribute(node.lex) and len(variables) == 1 + ) + + if is_attribute: + dest = self.define_internal_local() + self.register_instruction(cil.GetAttribNode(dest, "self", variable.name)) + return dest, variable.type + return variable.name, variable.type + @visitor.when(cool.InstantiateNode) def visit(self, node: cool.InstantiateNode, scope: Scope): local = self.define_internal_local() self.instructions.append(cil.AllocateNode(node.lex, local)) return local, self.context.get_type(node.lex) + + @visitor.when(cool.PlusNode) + def visit(self, node: cool.PlusNode, scope: Scope): + return self.visit_arith_node(node, scope, cil.PlusNode) + + @visitor.when(cool.MinusNode) + def visit(self, node: cool.MinusNode, scope: Scope): + return self.visit_arith_node(node, scope, cil.MinusNode) + + @visitor.when(cool.StarNode) + def visit(self, node: cool.StarNode, scope: Scope): + return self.visit_arith_node(node, scope, cil.StarNode) + + @visitor.when(cool.DivNode) + def visit(self, node: cool.DivNode, scope: Scope): + return self.visit_arith_node(node, scope, cil.DivNode) + + @visitor.when(cool.LessEqualNode) + def visit(self, node: cool.LessEqualNode, scope: Scope): + return self.visit_arith_node(node, scope, cil.LessEqualNode) + + @visitor.when(cool.LessThanNode) + def visit(self, node: cool.LessThanNode, scope: Scope): + return self.visit_arith_node(node, scope, cil.LessThanNode) + + @visitor.when(cool.EqualNode) + def visit(self, node: cool.EqualNode, scope: Scope): + return self.visit_arith_node(node, scope, cil.EqualNode) + + + def visit_arith_node( + self, node: cool.BinaryNode, scope: Scope, cil_type: type + ) -> Tuple[str, Type]: + left, _ = self.visit(node.left, scope) + right, _ = self.visit(node.right, scope) + dest = self.define_internal_local() + self.register_instruction(cil_type(dest, left, right)) + return dest, self.context.get_type("Int") diff --git a/src/cool/code_generation/icool.py b/src/cool/code_generation/icool.py index 486b1f78d..304e63b18 100644 --- a/src/cool/code_generation/icool.py +++ b/src/cool/code_generation/icool.py @@ -1,6 +1,21 @@ import cool.semantics.utils.astnodes as cool +from cool.semantics.utils.scope import Type -class VoidNode(cool.AtomicNode): +class NullType(Type): + def __init__(self): + super().__init__("null") + + def conforms_to(self, other: "Type") -> bool: + return True + + def bypass(self) -> bool: + return True + + def __str__(self): + return self.name + + +class NullNode(cool.AtomicNode): def __init__(self): super().__init__("null") diff --git a/src/cool/semantics/position_assigner.py b/src/cool/semantics/position_assigner.py index bd0f154af..a99b97c89 100644 --- a/src/cool/semantics/position_assigner.py +++ b/src/cool/semantics/position_assigner.py @@ -362,13 +362,23 @@ def visit(self, node: ast.InstantiateNode): * new type """ + counter = 0 token = self.tokens[self.position] + + while token.lex == "(": + counter += 1 + self.inc_position() + token = self.tokens[self.position] + node.set_main_position(token.line, token.column) token = self.tokens[self.position + 1] node.type_position = token.line, token.column self.inc_position(2) # ends after `type` + for _ in range(counter): + self.inc_position() + @visitor.when(ast.NegationNode) def visit(self, node: ast.NegationNode): self._check_unary_operation(node) diff --git a/src/cool/semantics/type_checker.py b/src/cool/semantics/type_checker.py index 0735b3aac..e77aa2d40 100644 --- a/src/cool/semantics/type_checker.py +++ b/src/cool/semantics/type_checker.py @@ -186,7 +186,7 @@ def visit(self, node: cool.AssignNode, scope: Scope): if var_info.name == "self": self.errors.append(err.SELF_IS_READONLY % (node.line, node.column)) - expr_type = self.visit(node.expr, scope.create_child()) + expr_type = self.visit(node.expr, scope) if var_info is None: self.errors.append( diff --git a/src/cool/semantics/type_inference.py b/src/cool/semantics/type_inference.py index dc8c6605d..1897252d4 100644 --- a/src/cool/semantics/type_inference.py +++ b/src/cool/semantics/type_inference.py @@ -315,7 +315,7 @@ def visit(self, node: cool.AttrDeclarationNode, scope: Scope): return scope.define_variable("self", self.current_type) - + # Solve the expression of the attribute expr_node = ( self.visit(node.expr, scope.create_child()) @@ -454,10 +454,10 @@ def visit(self, node: cool.BlockNode, scope: Scope): @visitor.when(cool.ConditionalNode) def visit(self, node: cool.ConditionalNode, scope: Scope): if_node = self.visit(node.if_expr, scope) - + if if_node is not None and not isinstance(if_node, AtomNode): self.graph.add_edge(AtomNode(self.context.get_type("Bool")), if_node) - + then_node = self.visit(node.then_expr, scope.create_child()) else_node = self.visit(node.else_expr, scope.create_child()) @@ -470,7 +470,7 @@ def visit(self, node: cool.ConditionalNode, scope: Scope): if then_node is None or else_node is None: return conditional_node - + if isinstance(then_node, AtomNode) and not isinstance(else_node, AtomNode): self.graph.add_edge(then_node, else_node) elif not isinstance(then_node, AtomNode) and isinstance(else_node, AtomNode): @@ -532,7 +532,7 @@ def visit(self, node: cool.MethodCallNode, scope: Scope): if isinstance(obj_node, AtomNode) and obj_node.type.contains_method(node.id): method, owner = obj_node.type.get_method(node.id, get_owner=True) param_nodes, return_node = self.methods[owner.name, method.name] - + count_of_args = min(len(node.args), len(param_nodes)) for i in range(count_of_args): arg = node.args[i] @@ -702,17 +702,11 @@ def visit(self, node: cool.ClassDeclarationNode, scope: Scope): i = 0 for attr in attrs: - count = len(scope.children) - if attr.expr is not None: attr.index = i i += 1 - - self.visit(attr, scope) - - if count < len(scope.children): - i -= 1 + self.visit(attr, scope) # print(scope.children, len(methods), i) for i, method in enumerate(methods, i): @@ -737,7 +731,7 @@ def visit(self, node: cool.AttrDeclarationNode, scope: Scope): @visitor.when(cool.MethodDeclarationNode) def visit(self, node: cool.MethodDeclarationNode, scope: Scope): self.current_method = self.current_type.get_method(node.id) - + try: return_type = self.context.get_type(node.return_type) except SemanticError: @@ -746,12 +740,21 @@ def visit(self, node: cool.MethodDeclarationNode, scope: Scope): for i, (name, _) in enumerate(node.params): variable_info = scope.find_variable(name) if variable_info.type == self.context.get_type("AUTO_TYPE"): - self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % (node.param_types_positions[i][0], node.param_types_positions[i][1], name)) + self.errors.append( + err.INFERENCE_ERROR_ATTRIBUTE + % ( + node.param_types_positions[i][0], + node.param_types_positions[i][1], + name, + ) + ) node.params[i] = (name, variable_info.type.name) self.visit(node.body, scope) - if return_type is not None and return_type == self.context.get_type("AUTO_TYPE"): + if return_type is not None and return_type == self.context.get_type( + "AUTO_TYPE" + ): if self.current_method.return_type == self.context.get_type("AUTO_TYPE"): self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % node.id) node.return_type = self.current_method.return_type.name diff --git a/src/cool/semantics/utils/scope.py b/src/cool/semantics/utils/scope.py index dee442384..e3d558d81 100644 --- a/src/cool/semantics/utils/scope.py +++ b/src/cool/semantics/utils/scope.py @@ -306,6 +306,17 @@ def find_variable(self, var_name: str) -> Optional[VariableInfo]: self.parent.find_variable(var_name) if self.parent is not None else None ) + def find_all_variables(self, var_name: str) -> List[VariableInfo]: + vars = [] + scope = self + while scope is not None: + if var_name in scope.locals: + vars.append(scope.locals[var_name]) + + scope = scope.parent + + return vars + def is_defined(self, var_name) -> bool: return self.find_variable(var_name) is not None @@ -315,5 +326,23 @@ def is_local(self, var_name: str) -> bool: def clear(self): self.children = [] + def scope_to_string(self, tab: int = 0) -> str: + s = " " * tab + "{" + for local in self.locals.values(): + s += "\n" + " " * (tab + 1) + f"{local.name}: {local.type.name}" + + s += "\n" + " " * (tab + 1) + f"children ({len(self.children)}): [\n" + + for child in self.children: + s += child.scope_to_string(tab + 2) + ",\n" + + s += "\n" + " " * (tab + 1) + f"]" + + s += "\n" + " " * tab + "}" + return s + def __len__(self): return len(self.locals) + + def __str__(self) -> str: + return self.scope_to_string() From 01b03a45321b461a8070f04db4ea489e73986022 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Thu, 10 Feb 2022 11:07:51 -0500 Subject: [PATCH 127/143] Switch dando problemas --- main.cl | 21 ++ src/cool/code_generation/base.py | 8 +- src/cool/code_generation/cil.py | 228 ++++++++++++++++-- .../code_generation/cool_to_cil_visitor.py | 173 ++++++++++++- src/cool/semantics/type_checker.py | 2 +- 5 files changed, 400 insertions(+), 32 deletions(-) diff --git a/main.cl b/main.cl index aa9a73e05..839c5688b 100644 --- a/main.cl +++ b/main.cl @@ -1,3 +1,4 @@ +(* class Main { number: Int <- 0; @@ -48,4 +49,24 @@ class Point3D inherits Point { get_z(): Int { z }; +}; +*) + +class Main { + number: Int <- 0; + + main() : Object { + { + -- if true then "Hello" else "World" fi; + -- while true loop + -- number <- number + 1 + -- pool; + + case 1 of + a: Int => 0; + b: Bool => 1; + c: String => 2; + esac; + } + }; }; \ No newline at end of file diff --git a/src/cool/code_generation/base.py b/src/cool/code_generation/base.py index 058ffcec7..cd6ac80a6 100644 --- a/src/cool/code_generation/base.py +++ b/src/cool/code_generation/base.py @@ -32,17 +32,17 @@ def localvars(self) -> List[cil.LocalNode]: def instructions(self) -> List[cil.InstructionNode]: return self.current_function.instructions - def register_local(self, var_name: str) -> str: + def register_local(self, var_name: str, comment: str = "") -> str: local_name = ( f"local_{self.current_function.name[9:]}_{var_name}_{len(self.localvars)}" ) local_name = var_name - local_node = cil.LocalNode(local_name) + local_node = cil.LocalNode(local_name).set_comment(comment) self.localvars.append(local_node) return local_name - def define_internal_local(self) -> str: - return self.register_local(f"internal_{len(self.localvars)}") + def define_internal_local(self, comment: str = "") -> str: + return self.register_local(f"internal_{len(self.localvars)}", comment) def register_instruction( self, instruction: cil.InstructionNode diff --git a/src/cool/code_generation/cil.py b/src/cool/code_generation/cil.py index ba1673b0b..307b4603d 100644 --- a/src/cool/code_generation/cil.py +++ b/src/cool/code_generation/cil.py @@ -3,7 +3,11 @@ class Node: - pass + comment: str = "" + + def set_comment(self, comment: str) -> "Node": + self.comment = comment + return self class ProgramNode(Node): @@ -115,11 +119,17 @@ def __init__(self, instance: str, attr: str, source: str) -> None: class GetIndexNode(InstructionNode): - pass + def __init__(self, dest: str, instance: str, index: str) -> None: + self.dest: str = dest + self.instance: str = instance + self.index: str = index class SetIndexNode(InstructionNode): - pass + def __init__(self, instance: str, index: int, source: str) -> None: + self.instance: str = instance + self.index: int = index + self.source: str = source class AllocateNode(InstructionNode): @@ -129,7 +139,9 @@ def __init__(self, itype: str, dest: str): class ArrayNode(InstructionNode): - pass + def __init__(self, dest: str, size: int) -> None: + self.dest: str = dest + self.size: int = size class TypeOfNode(InstructionNode): @@ -138,16 +150,26 @@ def __init__(self, obj: str, dest: str): self.dest: str = dest +class AncestorNode(InstructionNode): + def __init__(self, obj: str, dest: str): + self.obj: str = obj + self.dest: str = dest + + class LabelNode(InstructionNode): - pass + def __init__(self, label: str): + self.label: str = label class GotoNode(InstructionNode): - pass + def __init__(self, address: str): + self.address: str = address class GotoIfNode(InstructionNode): - pass + def __init__(self, condition: str, address: str): + self.condition: str = condition + self.address: str = address class StaticCallNode(InstructionNode): @@ -211,7 +233,17 @@ def __init__(self, str_addr): self.str_addr = str_addr -class CILFormatter(object): +class CommentNode(InstructionNode): + def __init__(self, comment): + self.comment = comment + + +class EmptyInstruction(InstructionNode): + def __init__(self): + pass + + +class CILFormatter: @visitor.on("node") def visit(self, node): pass @@ -240,61 +272,209 @@ def visit(self, node): return f"function {node.name} {{\n\t{params}\n\n\t{local_vars}\n\n\t{instructions}\n}}" @visitor.when(ParamNode) - def visit(self, node): - return f"PARAM {node.name}" + def visit(self, node: ParamNode): + return ( + f"PARAM {node.name}" + if node.comment == "" + else f"PARAM {node.name} # {node.comment}" + ) @visitor.when(LocalNode) def visit(self, node): - return f"LOCAL {node.name}" + return ( + f"LOCAL {node.name}" + if node.comment == "" + else f"LOCAL {node.name} # {node.comment}" + ) @visitor.when(AssignNode) def visit(self, node): - return f"{node.dest} = {node.source}" + return ( + f"{node.dest} = {node.source}" + if node.comment == "" + else f"{node.dest} = {node.source} # {node.comment}" + ) @visitor.when(PlusNode) def visit(self, node): - return f"{node.dest} = {node.left} + {node.right}" + return ( + f"{node.dest} = {node.left} + {node.right}" + if node.comment == "" + else f"{node.dest} = {node.left} + {node.right} # {node.comment}" + ) @visitor.when(MinusNode) def visit(self, node): - return f"{node.dest} = {node.left} - {node.right}" + return ( + f"{node.dest} = {node.left} - {node.right}" + if node.comment == "" + else f"{node.dest} = {node.left} - {node.right} # {node.comment}" + ) @visitor.when(StarNode) def visit(self, node): - return f"{node.dest} = {node.left} * {node.right}" + return ( + f"{node.dest} = {node.left} * {node.right}" + if node.comment == "" + else f"{node.dest} = {node.left} * {node.right} # {node.comment}" + ) @visitor.when(DivNode) def visit(self, node): - return f"{node.dest} = {node.left} / {node.right}" + return ( + f"{node.dest} = {node.left} / {node.right}" + if node.comment == "" + else f"{node.dest} = {node.left} / {node.right} # {node.comment}" + ) + + @visitor.when(EqualNode) + def visit(self, node: EqualNode): + return ( + f"{node.dest} = {node.left} == {node.right}" + if node.comment == "" + else f"{node.dest} = {node.left} + {node.right} # {node.comment}" + ) + + @visitor.when(LessThanNode) + def visit(self, node: LessThanNode): + return ( + f"{node.dest} = {node.left} < {node.right}" + if node.comment == "" + else f"{node.dest} = {node.left} < {node.right} # {node.comment}" + ) + + @visitor.when(LessEqualNode) + def visit(self, node: LessEqualNode): + return ( + f"{node.dest} = {node.left} <= {node.right}" + if node.comment == "" + else f"{node.dest} = {node.left} <= {node.right} # {node.comment}" + ) @visitor.when(AllocateNode) def visit(self, node): - return f"{node.dest} = ALLOCATE {node.type}" + return ( + f"{node.dest} = ALLOCATE {node.type}" + if node.comment == "" + else f"{node.dest} = ALLOCATE {node.type} # {node.comment}" + ) @visitor.when(TypeOfNode) def visit(self, node): - return f"{node.dest} = TYPEOF {node.type}" + return ( + f"{node.dest} = TYPEOF {node.obj}" + if node.comment == "" + else f"{node.dest} = TYPEOF {node.obj} # {node.comment}" + ) + + @visitor.when(AncestorNode) + def visit(self, node): + return ( + f"{node.dest} = ANCESTOR {node.obj}" + if node.comment == "" + else f"{node.dest} = ANCESTOR {node.obj} # {node.comment}" + ) @visitor.when(StaticCallNode) def visit(self, node): - return f"{node.dest} = CALL {node.function}" + return ( + f"{node.dest} = CALL {node.function}" + if node.comment == "" + else f"{node.dest} = CALL {node.function} # {node.comment}" + ) @visitor.when(DynamicCallNode) def visit(self, node): - return f"{node.dest} = VCALL {node.type} {node.method}" + return ( + f"{node.dest} = VCALL {node.type} {node.method}" + if node.comment == "" + else f"{node.dest} = VCALL {node.type} {node.method} # {node.comment}" + ) @visitor.when(GetAttribNode) def visit(self, node: GetAttribNode): - return f"{node.dest} = GETATTR {node.instance} {node.attr}" + return ( + f"{node.dest} = GETATTR {node.instance} {node.attr}" + if node.comment == "" + else f"{node.dest} = GETATTR {node.instance} {node.attr} # {node.comment}" + ) @visitor.when(SetAttribNode) def visit(self, node: SetAttribNode): - return f"SETATTR {node.instance} {node.attr} {node.source}" + return ( + f"SETATTR {node.instance} {node.attr} {node.source}" + if node.comment == "" + else f"SETATTR {node.instance} {node.attr} {node.source} # {node.comment}" + ) @visitor.when(ArgNode) def visit(self, node): - return f"ARG {node.name}" + return ( + f"ARG {node.name}" + if node.comment == "" + else f"ARG {node.name} # {node.comment}" + ) @visitor.when(ReturnNode) def visit(self, node): - return f'\n\tRETURN {node.value if node.value is not None else ""}' + return ( + f"\n\tRETURN {node.value if node.value is not None else 0}" + if node.comment == "" + else f"\n\tRETURN {node.value if node.value is not None else 0} # {node.comment}" + ) + + @visitor.when(GotoNode) + def visit(self, node: GotoNode): + return ( + f"GOTO {node.address}" + if node.comment == "" + else f"GOTO {node.address} # {node.comment}" + ) + + @visitor.when(GotoIfNode) + def visit(self, node: GotoNode): + return ( + f"IF {node.condition} GOTO {node.address}" + if node.comment == "" + else f"IF {node.condition} GOTO {node.address} # {node.comment}" + ) + + @visitor.when(LabelNode) + def visit(self, node): + return ( + f"{node.label}:" + if node.comment == "" + else f"{node.label}: # {node.comment}" + ) + + @visitor.when(ArrayNode) + def visit(self, node: ArrayNode): + return ( + f"{node.dest} = ARRAY {node.size}" + if node.comment == "" + else f"{node.dest} = ARRAY {node.size} # {node.comment}" + ) + + @visitor.when(GetIndexNode) + def visit(self, node: GetIndexNode): + return ( + f"{node.dest} = GETINDEX {node.instance} {node.index}" + if node.comment == "" + else f"{node.dest} = GETINDEX {node.instance} {node.index} # {node.comment}" + ) + + @visitor.when(SetIndexNode) + def visit(self, node: SetIndexNode): + return ( + f"SETINDEX {node.instance} {node.index} {node.source}" + if node.comment == "" + else f"SETINDEX {node.instance} {node.index} {node.source} # {node.comment}" + ) + + @visitor.when(CommentNode) + def visit(self, node): + return f"# {node.comment}" + + @visitor.when(EmptyInstruction) + def visit(self, node): + return "" diff --git a/src/cool/code_generation/cool_to_cil_visitor.py b/src/cool/code_generation/cool_to_cil_visitor.py index a70aa4c6f..6f8ddd44c 100644 --- a/src/cool/code_generation/cool_to_cil_visitor.py +++ b/src/cool/code_generation/cool_to_cil_visitor.py @@ -681,6 +681,161 @@ def visit(self, node: cool.BlockNode, scope: Scope): source, inst_type = self.visit(expr, scope) return source, inst_type + @visitor.when(cool.ConditionalNode) + def visit(self, node: cool.ConditionalNode, scope: Scope): + self.register_instruction(cil.CommentNode("Conditional")) + + node_id = hash(node) + result_address = self.define_internal_local() + conditional_address = self.define_internal_local() + source, _ = self.visit(node.if_expr, scope) + + self.register_instruction(cil.AssignNode(conditional_address, source)) + self.register_instruction( + cil.GotoIfNode(conditional_address, f"then_{node_id}") + ) + self.register_instruction(cil.GotoNode(f"else_{node_id}")) + + self.register_instruction(cil.EmptyInstruction()) + self.register_instruction(cil.LabelNode(f"then_{node_id}")) + then_source, then_type = self.visit(node.then_expr, scope) + self.register_instruction(cil.AssignNode(result_address, then_source)) + self.register_instruction(cil.GotoNode(f"end_{node_id}")) + + self.register_instruction(cil.EmptyInstruction()) + self.register_instruction(cil.LabelNode(f"else_{node_id}")) + else_source, else_type = self.visit(node.else_expr, scope) + self.register_instruction(cil.AssignNode(result_address, else_source)) + self.register_instruction(cil.GotoNode(f"end_{node_id}")) + + self.register_instruction(cil.EmptyInstruction()) + self.register_instruction(cil.LabelNode(f"endif_{node_id}")) + + return result_address, then_type.join(else_type) + + @visitor.when(cool.WhileNode) + def visit(self, node: cool.WhileNode, scope: Scope): + # result_addres = self.define_internal_local() + node_id = hash(node) + conditional_address = self.define_internal_local() + + # self.register_instruction(cil.AssignNode(result_addres, 0)) + self.register_instruction(cil.LabelNode(f"while_start_{node_id}")) + + conditional_source, _ = self.visit(node.condition, scope) + self.register_instruction( + cil.AssignNode(conditional_address, conditional_source) + ) + self.register_instruction( + cil.GotoIfNode(conditional_address, f"while_continue_{node_id}") + ) + self.register_instruction(cil.GotoNode(f"while_end_{node_id}")) + + self.register_instruction(cil.EmptyInstruction()) + self.register_instruction(cil.LabelNode(f"while_continue_{node_id}")) + self.visit(node.body, scope) + self.register_instruction(cil.GotoNode(f"while_start_{node_id}")) + + self.register_instruction(cil.EmptyInstruction()) + self.register_instruction(cil.LabelNode(f"while_end_{node_id}")) + + return 0, self.context.get_type("Object") + + @visitor.when(cool.SwitchCaseNode) + def visit(self, node: cool.SwitchCaseNode, scope: Scope): + node_id = hash(node) + expr_address, _ = self.visit(node.expr, scope) + counter = self.define_internal_local( + "Counter to know how many ancestors has the expression type" + ) + expr_type_address = self.define_internal_local("Expression type") + # boolean_array_address = self.define_internal_local() + ancestor_type = self.define_internal_local("Ancestor type") + comparisson_address = self.define_internal_local("Comparison result") + array = self.define_internal_local("Array of ancestors") + resutl_address = self.define_internal_local( + "Result of the switch expression address" + ) + + types = [self.context.get_type(type_name) for _, type_name, _ in node.cases] + + self.register_instruction( + cil.TypeOfNode(expr_address, expr_type_address).set_comment( + "Get the switch expression type" + ) + ) + self.register_instruction( + cil.AssignNode(ancestor_type, expr_type_address).set_comment( + "The first ancestor will be the type itself" + ) + ) + + self.register_instruction(cil.EmptyInstruction()) + self.register_instruction(cil.LabelNode("while_start")) + self.register_instruction( + cil.EqualNode(comparisson_address, ancestor_type, "0") + ) + self.register_instruction(cil.GotoIfNode(comparisson_address, "while_end")) + + self.register_instruction( + cil.PlusNode(counter, counter, "1").set_comment( + "Increment the counter" + ) + ) + self.register_instruction( + cil.AncestorNode(ancestor_type, ancestor_type) + ) + self.register_instruction(cil.GotoNode("while_start")) + + self.register_instruction(cil.LabelNode("while_end")) + self.register_instruction(cil.EmptyInstruction()) + + self.register_instruction( + cil.AssignNode(ancestor_type, expr_type_address).set_comment( + "The first ancestor will be the type itself" + ) + ) + self.register_instruction(cil.ArrayNode(array, counter).set_comment("Create an array of ancestors")) + index = self.define_internal_local("Iteration index") + comparison = self.define_internal_local("Foreach comparison") + self.register_instruction(cil.AssignNode(index, "0").set_comment("Initialize the index with the value 0")) + self.register_instruction(cil.LabelNode("foreach_start")) + self.register_instruction(cil.LessThanNode(comparison, index, counter).set_comment("Check if the index is less than the counter")) + self.register_instruction(cil.GotoIfNode(comparison, "foreach_body")) + self.register_instruction(cil.GotoNode("foreach_end")) + self.register_instruction(cil.LabelNode("foreach_body")) + + self.register_instruction(cil.SetIndexNode(array, index, ancestor_type).set_comment("Set the index of the array with the ancestor type")) + self.register_instruction(cil.AncestorNode(ancestor_type, ancestor_type).set_comment("Get the next ancestor")) + self.register_instruction(cil.PlusNode(index, index, "1").set_comment("Increment index")) + self.register_instruction(cil.GotoNode("foreach_start")) + self.register_instruction(cil.LabelNode("foreach_end")) + + # for type in types: + # self.register_instruction(cil.TypeOfNode(expr_address, type_address)) + # comparison_address = self.define_internal_local() + # self.register_instruction( + # cil.EqualNode(comparison_address, type_address, type.name) + # ) # TODO: type.name is temporal + # self.register_instruction( + # cil.GotoIfNode(comparison_address, f"case_{type.name}_{node_id}") + # ) + + # self.register_instruction(cil.EmptyInstruction()) + # for i, (id, type, expr) in enumerate(node.cases): + # self.register_instruction(cil.LabelNode(f"case_{type}_{node_id}")) + # local_var = self.register_local(id) + # self.register_instruction(cil.AssignNode(local_var, expr_address)) + + # source, _ = self.visit(expr, scope.children[i]) + # self.register_instruction(cil.AssignNode(resutl_address, source)) + # self.register_instruction(cil.GotoNode(f"case_end_{node_id}")) + # self.register_instruction(cil.EmptyInstruction()) + + # self.register_instruction(cil.LabelNode(f"case_end_{node_id}")) + + return resutl_address, Type.multi_join(types) + @visitor.when(cool.MethodCallNode) def visit(self, node: cool.MethodCallNode, scope: Scope): obj_source, obj_type = self.visit(node.obj, scope) @@ -713,11 +868,11 @@ def visit(self, node: cool.StringNode, scope: Scope): @visitor.when(cool.BooleanNode) def visit(self, node: cool.BooleanNode, scope: Scope): - return node.lex, self.context.get_type("Bool") + return (1 if node.lex == "true" else 0), self.context.get_type("Bool") @visitor.when(icool.NullNode) def visit(self, node: icool.NullNode, scope: Scope): - return node.lex, icool.NullType() + return node.lex, icool.NullType @visitor.when(cool.VariableNode) def visit(self, node: cool.VariableNode, scope: Scope): @@ -768,7 +923,6 @@ def visit(self, node: cool.LessThanNode, scope: Scope): def visit(self, node: cool.EqualNode, scope: Scope): return self.visit_arith_node(node, scope, cil.EqualNode) - def visit_arith_node( self, node: cool.BinaryNode, scope: Scope, cil_type: type ) -> Tuple[str, Type]: @@ -777,3 +931,16 @@ def visit_arith_node( dest = self.define_internal_local() self.register_instruction(cil_type(dest, left, right)) return dest, self.context.get_type("Int") + + def foreach(self, start: int, end: int, list_of_instructions: List[int]): + index = self.define_internal_local("Iteration index") + comparison = self.define_internal_local("Iteration comparison") + self.register_instruction(cil.AssignNode(index, start)) + self.register_instruction(cil.LabelNode("foreach_start")) + self.register_instruction(cil.LessThanNode(comparison, index, end)) + self.register_instruction(cil.GotoIfNode(comparison, "foreach_body")) + self.register_instruction(cil.GotoNode("foreach_end")) + self.register_instruction(cil.LabelNode("foreach_body")) + self.register_instruction(cil.PlusNode(index, index, "1").set_comment("Increment")) + self.register_instruction(cil.GotoNode("foreach_start")) + self.register_instruction(cil.LabelNode("foreach_end")) \ No newline at end of file diff --git a/src/cool/semantics/type_checker.py b/src/cool/semantics/type_checker.py index e77aa2d40..2d4f34a1d 100644 --- a/src/cool/semantics/type_checker.py +++ b/src/cool/semantics/type_checker.py @@ -253,7 +253,7 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): err.UNDEFINED_TYPE_IN_BRANCH % (line, column, type_name) ) - # Cannot be dublicate Branches types + # Cannot be duplicated Branches types if type_name in visited: line, column = node.cases_positions[i] self.errors.append( From 4c43a8e1f7141c615ea8be2770145a8e4304f7f6 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Mon, 14 Feb 2022 00:46:54 -0500 Subject: [PATCH 128/143] Switch case cil Algorithm finished --- src/cool/code_generation/base.py | 6 + src/cool/code_generation/cil.py | 27 +- .../code_generation/cool_to_cil_visitor.py | 270 ++++++++++++------ 3 files changed, 216 insertions(+), 87 deletions(-) diff --git a/src/cool/code_generation/base.py b/src/cool/code_generation/base.py index cd6ac80a6..cf87d5eba 100644 --- a/src/cool/code_generation/base.py +++ b/src/cool/code_generation/base.py @@ -68,3 +68,9 @@ def register_data(self, value: Any) -> cil.DataNode: data_node = cil.DataNode(data_name, value) self.dotdata.append(data_node) return data_node + + def register_comment(self, comment: str) -> cil.CommentNode: + self.register_instruction(cil.CommentNode(comment)) + + def register_empty_instruction(self): + self.register_instruction(cil.EmptyInstruction()) diff --git a/src/cool/code_generation/cil.py b/src/cool/code_generation/cil.py index 307b4603d..2cd89101e 100644 --- a/src/cool/code_generation/cil.py +++ b/src/cool/code_generation/cil.py @@ -145,17 +145,22 @@ def __init__(self, dest: str, size: int) -> None: class TypeOfNode(InstructionNode): - def __init__(self, obj: str, dest: str): + def __init__(self, dest: str, obj: str, ): self.obj: str = obj self.dest: str = dest class AncestorNode(InstructionNode): - def __init__(self, obj: str, dest: str): + def __init__(self, dest: str, obj: str): self.obj: str = obj self.dest: str = dest +class TypeDirectionNode(InstructionNode): + def __init__(self, dest: str, name: str): + self.name: str = name + self.dest: str = dest + class LabelNode(InstructionNode): def __init__(self, label: str): self.label: str = label @@ -332,9 +337,9 @@ def visit(self, node: EqualNode): return ( f"{node.dest} = {node.left} == {node.right}" if node.comment == "" - else f"{node.dest} = {node.left} + {node.right} # {node.comment}" + else f"{node.dest} = {node.left} == {node.right} # {node.comment}" ) - + @visitor.when(LessThanNode) def visit(self, node: LessThanNode): return ( @@ -342,7 +347,7 @@ def visit(self, node: LessThanNode): if node.comment == "" else f"{node.dest} = {node.left} < {node.right} # {node.comment}" ) - + @visitor.when(LessEqualNode) def visit(self, node: LessEqualNode): return ( @@ -367,6 +372,14 @@ def visit(self, node): else f"{node.dest} = TYPEOF {node.obj} # {node.comment}" ) + @visitor.when(TypeDirectionNode) + def visit(self, node: TypeDirectionNode): + return ( + f"{node.dest} = TYPEDIR {node.name}" + if node.comment == "" + else f"{node.dest} = TYPEDIR {node.name} # {node.comment}" + ) + @visitor.when(AncestorNode) def visit(self, node): return ( @@ -476,5 +489,5 @@ def visit(self, node): return f"# {node.comment}" @visitor.when(EmptyInstruction) - def visit(self, node): - return "" + def visit(self, node: EmptyInstruction): + return "" if node.comment == "" else f"# {node.comment}" diff --git a/src/cool/code_generation/cool_to_cil_visitor.py b/src/cool/code_generation/cool_to_cil_visitor.py index 6f8ddd44c..e845ca784 100644 --- a/src/cool/code_generation/cool_to_cil_visitor.py +++ b/src/cool/code_generation/cool_to_cil_visitor.py @@ -1,3 +1,4 @@ +from itertools import count from typing import Dict, List, Optional, Tuple import cool.code_generation.cil as cil @@ -744,95 +745,202 @@ def visit(self, node: cool.WhileNode, scope: Scope): @visitor.when(cool.SwitchCaseNode) def visit(self, node: cool.SwitchCaseNode, scope: Scope): node_id = hash(node) - expr_address, _ = self.visit(node.expr, scope) - counter = self.define_internal_local( - "Counter to know how many ancestors has the expression type" - ) - expr_type_address = self.define_internal_local("Expression type") - # boolean_array_address = self.define_internal_local() + swicth_expression, _ = self.visit(node.expr, scope) + count_of_ancestors = self.define_internal_local("Count of ancestors of the switch expression") + switch_expr_type = self.define_internal_local("Switch expression type") ancestor_type = self.define_internal_local("Ancestor type") - comparisson_address = self.define_internal_local("Comparison result") - array = self.define_internal_local("Array of ancestors") - resutl_address = self.define_internal_local( - "Result of the switch expression address" - ) - - types = [self.context.get_type(type_name) for _, type_name, _ in node.cases] - - self.register_instruction( - cil.TypeOfNode(expr_address, expr_type_address).set_comment( - "Get the switch expression type" - ) - ) - self.register_instruction( - cil.AssignNode(ancestor_type, expr_type_address).set_comment( - "The first ancestor will be the type itself" - ) - ) - - self.register_instruction(cil.EmptyInstruction()) + step1_comparison = self.define_internal_local("Step 1 comparison result") + array_of_ancestors = self.define_internal_local("Step 1 Array of ancestors") + + self.register_comment("Steps:") + self.register_comment(" 1 - Count how many ancestors has the dynamic type of the expression") + self.register_comment(" 2 - Create an array of the same size where to store the ancestors") + self.register_comment(" 3 - For each branch type, store the ancestor index that match with it, if no one match, store `count of ancestors`") + self.register_comment(" 4 - Find the minimum of the ancestors indexes") + self.register_comment(" 5 - With the minimum index, get the correct branch type") + + ############################################ + # While loop to get the count of ancestors # + ############################################ + self.register_empty_instruction() + self.register_comment("######################################################################## #") + self.register_comment("Step 1 - Count how many ancestors has the dynamic type of the expression #") + self.register_comment("######################################################################## #") + self.register_instruction(cil.TypeOfNode(switch_expr_type, swicth_expression).set_comment("Get the switch expression type")) + self.register_instruction(cil.AssignNode(ancestor_type, switch_expr_type).set_comment("The first ancestor will be the type itself")) + self.register_instruction(cil.AssignNode(count_of_ancestors, 0).set_comment("Initialize the counter")) self.register_instruction(cil.LabelNode("while_start")) - self.register_instruction( - cil.EqualNode(comparisson_address, ancestor_type, "0") - ) - self.register_instruction(cil.GotoIfNode(comparisson_address, "while_end")) - - self.register_instruction( - cil.PlusNode(counter, counter, "1").set_comment( - "Increment the counter" - ) - ) - self.register_instruction( - cil.AncestorNode(ancestor_type, ancestor_type) - ) + self.register_instruction(cil.EqualNode(step1_comparison, ancestor_type, "0")) + self.register_instruction(cil.GotoIfNode(step1_comparison, "while_end")) + self.register_instruction(cil.PlusNode(count_of_ancestors, count_of_ancestors, "1").set_comment("Increment the counter")) + self.register_instruction(cil.AncestorNode(ancestor_type, ancestor_type)) self.register_instruction(cil.GotoNode("while_start")) - self.register_instruction(cil.LabelNode("while_end")) - self.register_instruction(cil.EmptyInstruction()) + ################################################# + # End While loop to get the count of ancestors # + ################################################# + + + ####################################################################### + # Foreach to create the array of ancestors and fill it with the types # + ####################################################################### + self.register_empty_instruction() - self.register_instruction( - cil.AssignNode(ancestor_type, expr_type_address).set_comment( - "The first ancestor will be the type itself" - ) - ) - self.register_instruction(cil.ArrayNode(array, counter).set_comment("Create an array of ancestors")) - index = self.define_internal_local("Iteration index") - comparison = self.define_internal_local("Foreach comparison") - self.register_instruction(cil.AssignNode(index, "0").set_comment("Initialize the index with the value 0")) + self.register_comment("###################################################################### #") + self.register_comment("Step 2 - Create an array of the same size where to store the ancestors #") + self.register_comment("###################################################################### #") + self.register_instruction(cil.AssignNode(ancestor_type, switch_expr_type).set_comment("The first ancestor will be the type itself")) + self.register_instruction(cil.ArrayNode(array_of_ancestors, count_of_ancestors).set_comment("Create an array of ancestors")) + step2_iter_index = self.define_internal_local("Step 2 iteration index") + step2_comparison = self.define_internal_local("Step 2 comparison result") + self.register_instruction(cil.AssignNode(step2_iter_index, "0").set_comment("Initialize the index with the value 0")) self.register_instruction(cil.LabelNode("foreach_start")) - self.register_instruction(cil.LessThanNode(comparison, index, counter).set_comment("Check if the index is less than the counter")) - self.register_instruction(cil.GotoIfNode(comparison, "foreach_body")) + self.register_instruction(cil.LessThanNode(step2_comparison, step2_iter_index, count_of_ancestors).set_comment("Check if the index is less than the counter")) + self.register_instruction(cil.GotoIfNode(step2_comparison, "foreach_body")) self.register_instruction(cil.GotoNode("foreach_end")) self.register_instruction(cil.LabelNode("foreach_body")) - - self.register_instruction(cil.SetIndexNode(array, index, ancestor_type).set_comment("Set the index of the array with the ancestor type")) + self.register_instruction(cil.SetIndexNode(array_of_ancestors, step2_iter_index, ancestor_type).set_comment("Set the index of the array with the ancestor type")) self.register_instruction(cil.AncestorNode(ancestor_type, ancestor_type).set_comment("Get the next ancestor")) - self.register_instruction(cil.PlusNode(index, index, "1").set_comment("Increment index")) + self.register_instruction(cil.PlusNode(step2_iter_index, step2_iter_index, "1").set_comment("Increment index")) self.register_instruction(cil.GotoNode("foreach_start")) self.register_instruction(cil.LabelNode("foreach_end")) + self.register_empty_instruction() + ########################################################################### + # End Foreach to create the array of ancestors and fill it with the types # + ########################################################################### - # for type in types: - # self.register_instruction(cil.TypeOfNode(expr_address, type_address)) - # comparison_address = self.define_internal_local() - # self.register_instruction( - # cil.EqualNode(comparison_address, type_address, type.name) - # ) # TODO: type.name is temporal - # self.register_instruction( - # cil.GotoIfNode(comparison_address, f"case_{type.name}_{node_id}") - # ) - - # self.register_instruction(cil.EmptyInstruction()) - # for i, (id, type, expr) in enumerate(node.cases): - # self.register_instruction(cil.LabelNode(f"case_{type}_{node_id}")) - # local_var = self.register_local(id) - # self.register_instruction(cil.AssignNode(local_var, expr_address)) - - # source, _ = self.visit(expr, scope.children[i]) - # self.register_instruction(cil.AssignNode(resutl_address, source)) - # self.register_instruction(cil.GotoNode(f"case_end_{node_id}")) - # self.register_instruction(cil.EmptyInstruction()) - - # self.register_instruction(cil.LabelNode(f"case_end_{node_id}")) + types = [self.context.get_type(type_name) for _, type_name, _ in node.cases] + type_branch_array = self.define_internal_local("Array to store the branch types") + nearest_ancestor_array = self.define_internal_local("Array to store the nearest ancestor index of the expression type of the i-th branch type ") + self.register_instruction(cil.ArrayNode(type_branch_array, f"{len(types)}")) + self.register_instruction(cil.ArrayNode(nearest_ancestor_array, f"{len(types)}")) + for i, t in enumerate(types): + x = self.define_internal_local(f"Address of the type {t.name}") + self.register_instruction(cil.TypeDirectionNode(x, t.name)) + self.register_instruction(cil.SetIndexNode(type_branch_array, f"{i}", x)) + self.register_instruction(cil.SetIndexNode(nearest_ancestor_array, f"{i}", count_of_ancestors)) + self.register_empty_instruction() + + i = self.define_internal_local("Step 3 - Iteration index of the branch types array") + comp_i = self.define_internal_local("Step 3 - Comparison for the index of the branch types array") + type_i = self.define_internal_local("Step 3 - Type of the i-th branch") + j = self.define_internal_local("Step 3 - Index of the ancestor") + comp_j = self.define_internal_local("Step 3 - Comparison for the index of the ancestor") + type_j = self.define_internal_local("Step 3 - Type of the j-th ancestor") + types_comparison = self.define_internal_local("Step 3 - Comparison for the branch type nad the ancestor type") + + self.register_comment("#################################################################################################### #") + self.register_comment("Step 3 - For each branch type, store the ancestor index that match with it (Simulating a double for) #") + self.register_comment("#################################################################################################### #") + + self.register_comment("############# #") + self.register_comment("Outer Foreach #") + self.register_comment("############# #") + self.register_instruction(cil.AssignNode(i, "0").set_comment("Initialize the index i of the case to 0")) + self.register_instruction(cil.LabelNode("foreach_type_start")) + self.register_instruction(cil.LessThanNode(comp_i, i, f"{len(types)}").set_comment("Check if the type index is less than the count of branches")) + self.register_instruction(cil.GotoIfNode(comp_i, "foreach_type_body")) + self.register_instruction(cil.GotoNode("foreach_type_end")) + self.register_instruction(cil.LabelNode("foreach_type_body")) + self.register_instruction(cil.GetIndexNode(type_i, type_branch_array, i).set_comment("Get the type of the i-th branch")) + + ################# + # Inner Foreach # + ################# + self.register_empty_instruction() + self.register_comment("############# #") + self.register_comment("Inner Foreach #") + self.register_comment("############# #") + self.register_instruction(cil.AssignNode(j, "0").set_comment("Initialize the index j of the case to 0")) + self.register_instruction(cil.LabelNode("foreach_ancestor_start")) + self.register_instruction(cil.LessThanNode(comp_j, j, count_of_ancestors).set_comment("Check if the case index is less than the count of ancestors")) + self.register_instruction(cil.GotoIfNode(comp_j, "foreach_ancestor_body")) + self.register_instruction(cil.GotoNode("foreach_ancestor_end")) + self.register_instruction(cil.LabelNode("foreach_ancestor_body")) + self.register_instruction(cil.GetIndexNode(type_j, array_of_ancestors, j).set_comment("Get the j-th ancestor type")) + self.register_instruction(cil.EqualNode(types_comparison, type_i, type_j).set_comment("Compare if the type of the i-th branch is equal to the j-th ancestor")) + self.register_instruction(cil.GotoIfNode(types_comparison, "foreach_ancestor_end").set_comment("If the types are equal, we have a match, then we can exit")) + self.register_instruction(cil.PlusNode(j, j, "1").set_comment("Increment the ancestor index")) + self.register_instruction(cil.GotoNode("foreach_ancestor_start")) + self.register_instruction(cil.LabelNode("foreach_ancestor_end")) + self.register_instruction(cil.SetIndexNode(nearest_ancestor_array, i, j).set_comment("Set the counter of the i-th branch equals to j")) + self.register_comment("#################### #") + self.register_comment("End of Inner Foreach #") + self.register_comment("#################### #") + self.register_empty_instruction() + ####################### + # End Inner Foreach 1 # + ####################### + + self.register_instruction(cil.PlusNode(i, i, "1").set_comment("Increment type index")) + self.register_instruction(cil.GotoNode("foreach_type_start")) + self.register_instruction(cil.LabelNode("foreach_type_end")) + self.register_comment("################# #") + self.register_comment("End Outer Foreach #") + self.register_comment("################# #") + + self.register_empty_instruction() + self.register_comment("######################################## #") + self.register_comment("Step 4 - Find the minimum ancestor index #") + self.register_comment("######################################## #") + step4_index = self.define_internal_local("Step 4 - Iteration index") + step4_current_min_index = self.define_internal_local("Step 4 - Index of the minimum counter in the counter array") + step4_temp = self.define_internal_local("Step 4 - Temporary variable") + step4_current_min = self.define_internal_local("Step 4 - Current minimum of the counter array") + step4_comparison = self.define_internal_local("Step 4 - Comparison for the minimum of the counter array") + self.register_instruction(cil.AssignNode(step4_index, "0").set_comment("Initialize the index of the counter array to 0")) + self.register_instruction(cil.AssignNode(step4_current_min_index, "0").set_comment("Initialize the index of the lower counter to 0")) + self.register_instruction(cil.AssignNode(step4_current_min, count_of_ancestors).set_comment("Initialize the current minimum to `count of ancestors`")) + self.register_instruction(cil.LabelNode("foreach_min_start")) + self.register_instruction(cil.LessThanNode(step4_comparison, step4_index, f"{len(types)}").set_comment("Check if the index of the lower counter is less than the count of branches")) + self.register_instruction(cil.GotoIfNode(step4_comparison, "foreach_min_body")) + self.register_instruction(cil.GotoNode("foreach_min_end")) + self.register_instruction(cil.LabelNode("foreach_min_body")) + self.register_instruction(cil.GetIndexNode(step4_temp, nearest_ancestor_array, step4_index).set_comment("Get the nearest ancestor index of the i-th branch type")) + self.register_instruction(cil.LessThanNode(step4_comparison, step4_temp, step4_current_min).set_comment("Compare if the nearest ancestor index is less than the current minimum")) + self.register_instruction(cil.GotoIfNode(step4_comparison, "update_min")) + self.register_instruction(cil.GotoNode("foreach_min_end")) + self.register_instruction(cil.LabelNode("update_min")) + self.register_instruction(cil.AssignNode(step4_current_min, step4_temp).set_comment("Update the current minimum")) + self.register_instruction(cil.AssignNode(step4_current_min_index, step4_index).set_comment("Update the index of the lower counter")) + self.register_instruction(cil.LabelNode("update_min_end")) + self.register_instruction(cil.PlusNode(step4_index, step4_index, "1").set_comment("Increment the index of the counter array")) + self.register_instruction(cil.GotoNode("foreach_min_start")) + self.register_instruction(cil.LabelNode("foreach_min_end")) + + self.register_empty_instruction() + self.register_comment("################################################################# #") + self.register_comment("Step 5 - Using the minimun ancestor index find the correct branch #") + self.register_comment("################################################################# #") + bool_array = self.define_internal_local("Step 5 - Bool array") + self.register_instruction(cil.ArrayNode(bool_array, f"{len(types)}").set_comment("Create the bool array")) + for i, _ in enumerate(types): + self.register_instruction(cil.SetIndexNode(bool_array, f"{i}", "0").set_comment("Initialize the bool array")) + + self.register_empty_instruction() + exists_error = self.define_internal_local("Step 5 - Exists an error") + self.register_instruction(cil.EqualNode(exists_error, step4_current_min_index, count_of_ancestors).set_comment("Check if the minimum index is equal to the count of ancestors")) + self.register_instruction(cil.GotoIfNode(exists_error, "error_branch")) + self.register_instruction(cil.SetIndexNode(bool_array, step4_current_min_index, "1").set_comment("Set the bool array in the correct index to 1")) + + step5_comparison = self.define_internal_local("Step 5 - Comparison for the correct branch result") + self.register_empty_instruction() + for i, t in enumerate(types): + self.register_instruction(cil.GetIndexNode(step5_comparison, bool_array, f"{i}").set_comment(f"Get the bool value of the branch {t.name}")) + self.register_instruction(cil.GotoIfNode(step5_comparison, f"branch_{t.name}").set_comment("If the bool value is 1, then we have a match")) + self.register_empty_instruction() + + resutl_address = self.define_internal_local("Result of the switch expression address") + for i, (var_name, type_name, expr) in enumerate(node.cases): + self.register_instruction(cil.LabelNode(f"branch_{type_name}")) + self.register_local(var_name, f"Specialiced variable for the branch {type_name}") + expr_source, _ = self.visit(expr, scope.children[i]) + self.register_instruction(cil.AssignNode(resutl_address, expr_source).set_comment("Assign the result")) + self.register_instruction(cil.GotoNode(f"branch_end")) + self.register_empty_instruction() + self.register_instruction(cil.LabelNode("error_branch")) + self.register_comment("Insert an error call") + self.register_instruction(cil.LabelNode(f"branch_end")) return resutl_address, Type.multi_join(types) @@ -931,7 +1039,7 @@ def visit_arith_node( dest = self.define_internal_local() self.register_instruction(cil_type(dest, left, right)) return dest, self.context.get_type("Int") - + def foreach(self, start: int, end: int, list_of_instructions: List[int]): index = self.define_internal_local("Iteration index") comparison = self.define_internal_local("Iteration comparison") @@ -941,6 +1049,8 @@ def foreach(self, start: int, end: int, list_of_instructions: List[int]): self.register_instruction(cil.GotoIfNode(comparison, "foreach_body")) self.register_instruction(cil.GotoNode("foreach_end")) self.register_instruction(cil.LabelNode("foreach_body")) - self.register_instruction(cil.PlusNode(index, index, "1").set_comment("Increment")) + self.register_instruction( + cil.PlusNode(index, index, "1").set_comment("Increment") + ) self.register_instruction(cil.GotoNode("foreach_start")) - self.register_instruction(cil.LabelNode("foreach_end")) \ No newline at end of file + self.register_instruction(cil.LabelNode("foreach_end")) From 67212c01bb3adff0d50bf14d44cc6cb33a72d2ba Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Tue, 15 Feb 2022 00:15:47 -0500 Subject: [PATCH 129/143] Visitor Cool to Cil finished. A revision of the labels and comments is needed, specially on the switch case node. --- main.cl | 4 +- src/cool/code_generation/cil.py | 12 +++++ .../code_generation/cool_to_cil_visitor.py | 45 +++++++++++-------- 3 files changed, 41 insertions(+), 20 deletions(-) diff --git a/main.cl b/main.cl index 839c5688b..abbddd1cb 100644 --- a/main.cl +++ b/main.cl @@ -64,8 +64,8 @@ class Main { case 1 of a: Int => 0; - b: Bool => 1; - c: String => 2; + b: Bool => not true; + c: String => new IO; esac; } }; diff --git a/src/cool/code_generation/cil.py b/src/cool/code_generation/cil.py index 2cd89101e..c63b31002 100644 --- a/src/cool/code_generation/cil.py +++ b/src/cool/code_generation/cil.py @@ -104,6 +104,10 @@ class EqualNode(ArithmeticNode): pass +class XorNode(ArithmeticNode): + pass + + class GetAttribNode(InstructionNode): def __init__(self, dest: str, instance: str, attr: str) -> None: self.dest: str = dest @@ -356,6 +360,14 @@ def visit(self, node: LessEqualNode): else f"{node.dest} = {node.left} <= {node.right} # {node.comment}" ) + @visitor.when(XorNode) + def visit(self, node: XorNode): + return ( + f"{node.dest} = XOR {node.left} {node.right}" + if node.comment == "" + else f"{node.dest} = XOR {node.left} {node.right} # {node.comment}" + ) + @visitor.when(AllocateNode) def visit(self, node): return ( diff --git a/src/cool/code_generation/cool_to_cil_visitor.py b/src/cool/code_generation/cool_to_cil_visitor.py index e845ca784..77bb9e36a 100644 --- a/src/cool/code_generation/cool_to_cil_visitor.py +++ b/src/cool/code_generation/cool_to_cil_visitor.py @@ -976,7 +976,7 @@ def visit(self, node: cool.StringNode, scope: Scope): @visitor.when(cool.BooleanNode) def visit(self, node: cool.BooleanNode, scope: Scope): - return (1 if node.lex == "true" else 0), self.context.get_type("Bool") + return ("1" if node.lex == "true" else "0"), self.context.get_type("Bool") @visitor.when(icool.NullNode) def visit(self, node: icool.NullNode, scope: Scope): @@ -999,10 +999,34 @@ def visit(self, node: cool.VariableNode, scope: Scope): @visitor.when(cool.InstantiateNode) def visit(self, node: cool.InstantiateNode, scope: Scope): - local = self.define_internal_local() - self.instructions.append(cil.AllocateNode(node.lex, local)) + local = self.define_internal_local(f"Store an instance of the class {node.lex}") + self.register_instruction(cil.AllocateNode(node.lex, local).set_comment(f"Allocate the object {node.lex}")) + self.register_instruction(cil.ArgNode(local).set_comment("Pass the instance to the constructor")) + self.register_instruction(cil.DynamicCallNode(node.lex, self.to_function_name("__init__", node.lex), local).set_comment("Call the constructor")) return local, self.context.get_type(node.lex) + @visitor.when(cool.NegationNode) + def visit(self, node: cool.NegationNode, scope: Scope): + source, _ = self.visit(node.expr, scope) + result = self.define_internal_local(f"Store the negation of {source}") + self.register_instruction(cil.XorNode(result, source, "1").set_comment(f"not {source}")) + return result, self.context.get_type("Bool") + + @visitor.when(cool.ComplementNode) + def visit(self, node: cool.ComplementNode, scope: Scope): + source, _ = self.visit(node.expr, scope) + result = self.define_internal_local(f"Store the complement a2 of {source}") + self.register_instruction(cil.XorNode(result, source, f"{2**32 - 1}").set_comment(f"Getting the complement a1 of {source}")) + self.register_instruction(cil.PlusNode(result, result, "1").set_comment(f"Adding 1 to the complement a1 we get the complement a2 of {source}")) + return result, self.context.get_type("Int") + + @visitor.when(cool.IsVoidNode) + def visit(self, node: cool.IsVoidNode, scope: Scope): + source, _ = self.visit(node.expr, scope) + result = self.define_internal_local(f"Store if {source} is null") + self.register_instruction(cil.EqualNode(result, source, "null")) + return result, self.context.get_type("Bool") + @visitor.when(cool.PlusNode) def visit(self, node: cool.PlusNode, scope: Scope): return self.visit_arith_node(node, scope, cil.PlusNode) @@ -1039,18 +1063,3 @@ def visit_arith_node( dest = self.define_internal_local() self.register_instruction(cil_type(dest, left, right)) return dest, self.context.get_type("Int") - - def foreach(self, start: int, end: int, list_of_instructions: List[int]): - index = self.define_internal_local("Iteration index") - comparison = self.define_internal_local("Iteration comparison") - self.register_instruction(cil.AssignNode(index, start)) - self.register_instruction(cil.LabelNode("foreach_start")) - self.register_instruction(cil.LessThanNode(comparison, index, end)) - self.register_instruction(cil.GotoIfNode(comparison, "foreach_body")) - self.register_instruction(cil.GotoNode("foreach_end")) - self.register_instruction(cil.LabelNode("foreach_body")) - self.register_instruction( - cil.PlusNode(index, index, "1").set_comment("Increment") - ) - self.register_instruction(cil.GotoNode("foreach_start")) - self.register_instruction(cil.LabelNode("foreach_end")) From 14b2a2b4aff6546690def6e167b2c1659fb495b2 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Tue, 15 Feb 2022 23:35:13 -0500 Subject: [PATCH 130/143] Improved labels of the switch case transformation to cil --- .../code_generation/cool_to_cil_visitor.py | 99 +++++++++---------- 1 file changed, 48 insertions(+), 51 deletions(-) diff --git a/src/cool/code_generation/cool_to_cil_visitor.py b/src/cool/code_generation/cool_to_cil_visitor.py index 77bb9e36a..942034c71 100644 --- a/src/cool/code_generation/cool_to_cil_visitor.py +++ b/src/cool/code_generation/cool_to_cil_visitor.py @@ -724,16 +724,12 @@ def visit(self, node: cool.WhileNode, scope: Scope): self.register_instruction(cil.LabelNode(f"while_start_{node_id}")) conditional_source, _ = self.visit(node.condition, scope) - self.register_instruction( - cil.AssignNode(conditional_address, conditional_source) - ) - self.register_instruction( - cil.GotoIfNode(conditional_address, f"while_continue_{node_id}") - ) + self.register_instruction(cil.AssignNode(conditional_address, conditional_source)) + self.register_instruction(cil.GotoIfNode(conditional_address, f"while_body_{node_id}")) self.register_instruction(cil.GotoNode(f"while_end_{node_id}")) self.register_instruction(cil.EmptyInstruction()) - self.register_instruction(cil.LabelNode(f"while_continue_{node_id}")) + self.register_instruction(cil.LabelNode(f"while_body_{node_id}")) self.visit(node.body, scope) self.register_instruction(cil.GotoNode(f"while_start_{node_id}")) @@ -752,7 +748,7 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): step1_comparison = self.define_internal_local("Step 1 comparison result") array_of_ancestors = self.define_internal_local("Step 1 Array of ancestors") - self.register_comment("Steps:") + self.register_comment("Switch Case Algorithm Steps:") self.register_comment(" 1 - Count how many ancestors has the dynamic type of the expression") self.register_comment(" 2 - Create an array of the same size where to store the ancestors") self.register_comment(" 3 - For each branch type, store the ancestor index that match with it, if no one match, store `count of ancestors`") @@ -769,13 +765,13 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): self.register_instruction(cil.TypeOfNode(switch_expr_type, swicth_expression).set_comment("Get the switch expression type")) self.register_instruction(cil.AssignNode(ancestor_type, switch_expr_type).set_comment("The first ancestor will be the type itself")) self.register_instruction(cil.AssignNode(count_of_ancestors, 0).set_comment("Initialize the counter")) - self.register_instruction(cil.LabelNode("while_start")) + self.register_instruction(cil.LabelNode(f"while_start_{node_id}")) self.register_instruction(cil.EqualNode(step1_comparison, ancestor_type, "0")) - self.register_instruction(cil.GotoIfNode(step1_comparison, "while_end")) + self.register_instruction(cil.GotoIfNode(step1_comparison, f"while_end_{node_id}")) self.register_instruction(cil.PlusNode(count_of_ancestors, count_of_ancestors, "1").set_comment("Increment the counter")) self.register_instruction(cil.AncestorNode(ancestor_type, ancestor_type)) - self.register_instruction(cil.GotoNode("while_start")) - self.register_instruction(cil.LabelNode("while_end")) + self.register_instruction(cil.GotoNode(f"while_start_{node_id}")) + self.register_instruction(cil.LabelNode(f"while_end_{node_id}")) ################################################# # End While loop to get the count of ancestors # ################################################# @@ -794,21 +790,26 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): step2_iter_index = self.define_internal_local("Step 2 iteration index") step2_comparison = self.define_internal_local("Step 2 comparison result") self.register_instruction(cil.AssignNode(step2_iter_index, "0").set_comment("Initialize the index with the value 0")) - self.register_instruction(cil.LabelNode("foreach_start")) + self.register_instruction(cil.LabelNode(f"foreach_start_{node_id}")) self.register_instruction(cil.LessThanNode(step2_comparison, step2_iter_index, count_of_ancestors).set_comment("Check if the index is less than the counter")) - self.register_instruction(cil.GotoIfNode(step2_comparison, "foreach_body")) - self.register_instruction(cil.GotoNode("foreach_end")) - self.register_instruction(cil.LabelNode("foreach_body")) + self.register_instruction(cil.GotoIfNode(step2_comparison, f"foreach_body_{node_id}")) + self.register_instruction(cil.GotoNode(f"foreach_end_{node_id}")) + self.register_instruction(cil.LabelNode(f"foreach_body_{node_id}")) self.register_instruction(cil.SetIndexNode(array_of_ancestors, step2_iter_index, ancestor_type).set_comment("Set the index of the array with the ancestor type")) self.register_instruction(cil.AncestorNode(ancestor_type, ancestor_type).set_comment("Get the next ancestor")) self.register_instruction(cil.PlusNode(step2_iter_index, step2_iter_index, "1").set_comment("Increment index")) - self.register_instruction(cil.GotoNode("foreach_start")) - self.register_instruction(cil.LabelNode("foreach_end")) + self.register_instruction(cil.GotoNode(f"foreach_start_{node_id}")) + self.register_instruction(cil.LabelNode(f"foreach_end_{node_id}")) self.register_empty_instruction() ########################################################################### # End Foreach to create the array of ancestors and fill it with the types # ########################################################################### + + self.register_comment("#################################################################################################### #") + self.register_comment("Step 3 - For each branch type, store the ancestor index that match with it (Simulating a double for) #") + self.register_comment("#################################################################################################### #") + types = [self.context.get_type(type_name) for _, type_name, _ in node.cases] type_branch_array = self.define_internal_local("Array to store the branch types") nearest_ancestor_array = self.define_internal_local("Array to store the nearest ancestor index of the expression type of the i-th branch type ") @@ -829,19 +830,15 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): type_j = self.define_internal_local("Step 3 - Type of the j-th ancestor") types_comparison = self.define_internal_local("Step 3 - Comparison for the branch type nad the ancestor type") - self.register_comment("#################################################################################################### #") - self.register_comment("Step 3 - For each branch type, store the ancestor index that match with it (Simulating a double for) #") - self.register_comment("#################################################################################################### #") - self.register_comment("############# #") self.register_comment("Outer Foreach #") self.register_comment("############# #") self.register_instruction(cil.AssignNode(i, "0").set_comment("Initialize the index i of the case to 0")) - self.register_instruction(cil.LabelNode("foreach_type_start")) + self.register_instruction(cil.LabelNode(f"foreach_type_start_{node_id}")) self.register_instruction(cil.LessThanNode(comp_i, i, f"{len(types)}").set_comment("Check if the type index is less than the count of branches")) - self.register_instruction(cil.GotoIfNode(comp_i, "foreach_type_body")) - self.register_instruction(cil.GotoNode("foreach_type_end")) - self.register_instruction(cil.LabelNode("foreach_type_body")) + self.register_instruction(cil.GotoIfNode(comp_i, f"foreach_type_body_{node_id}")) + self.register_instruction(cil.GotoNode(f"foreach_type_end_{node_id}")) + self.register_instruction(cil.LabelNode(f"foreach_type_body_{node_id}")) self.register_instruction(cil.GetIndexNode(type_i, type_branch_array, i).set_comment("Get the type of the i-th branch")) ################# @@ -852,17 +849,17 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): self.register_comment("Inner Foreach #") self.register_comment("############# #") self.register_instruction(cil.AssignNode(j, "0").set_comment("Initialize the index j of the case to 0")) - self.register_instruction(cil.LabelNode("foreach_ancestor_start")) + self.register_instruction(cil.LabelNode(f"foreach_ancestor_start_{node_id}")) self.register_instruction(cil.LessThanNode(comp_j, j, count_of_ancestors).set_comment("Check if the case index is less than the count of ancestors")) - self.register_instruction(cil.GotoIfNode(comp_j, "foreach_ancestor_body")) - self.register_instruction(cil.GotoNode("foreach_ancestor_end")) - self.register_instruction(cil.LabelNode("foreach_ancestor_body")) + self.register_instruction(cil.GotoIfNode(comp_j, f"foreach_ancestor_body_{node_id}")) + self.register_instruction(cil.GotoNode(f"foreach_ancestor_end_{node_id}")) + self.register_instruction(cil.LabelNode(f"foreach_ancestor_body_{node_id}")) self.register_instruction(cil.GetIndexNode(type_j, array_of_ancestors, j).set_comment("Get the j-th ancestor type")) self.register_instruction(cil.EqualNode(types_comparison, type_i, type_j).set_comment("Compare if the type of the i-th branch is equal to the j-th ancestor")) - self.register_instruction(cil.GotoIfNode(types_comparison, "foreach_ancestor_end").set_comment("If the types are equal, we have a match, then we can exit")) + self.register_instruction(cil.GotoIfNode(types_comparison, f"foreach_ancestor_end_{node_id}").set_comment("If the types are equal, we have a match, then we can exit")) self.register_instruction(cil.PlusNode(j, j, "1").set_comment("Increment the ancestor index")) - self.register_instruction(cil.GotoNode("foreach_ancestor_start")) - self.register_instruction(cil.LabelNode("foreach_ancestor_end")) + self.register_instruction(cil.GotoNode(f"foreach_ancestor_start_{node_id}")) + self.register_instruction(cil.LabelNode(f"foreach_ancestor_end_{node_id}")) self.register_instruction(cil.SetIndexNode(nearest_ancestor_array, i, j).set_comment("Set the counter of the i-th branch equals to j")) self.register_comment("#################### #") self.register_comment("End of Inner Foreach #") @@ -873,8 +870,8 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): ####################### self.register_instruction(cil.PlusNode(i, i, "1").set_comment("Increment type index")) - self.register_instruction(cil.GotoNode("foreach_type_start")) - self.register_instruction(cil.LabelNode("foreach_type_end")) + self.register_instruction(cil.GotoNode(f"foreach_type_start_{node_id}")) + self.register_instruction(cil.LabelNode(f"foreach_type_end_{node_id}")) self.register_comment("################# #") self.register_comment("End Outer Foreach #") self.register_comment("################# #") @@ -891,22 +888,22 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): self.register_instruction(cil.AssignNode(step4_index, "0").set_comment("Initialize the index of the counter array to 0")) self.register_instruction(cil.AssignNode(step4_current_min_index, "0").set_comment("Initialize the index of the lower counter to 0")) self.register_instruction(cil.AssignNode(step4_current_min, count_of_ancestors).set_comment("Initialize the current minimum to `count of ancestors`")) - self.register_instruction(cil.LabelNode("foreach_min_start")) + self.register_instruction(cil.LabelNode(f"foreach_min_start_{node_id}")) self.register_instruction(cil.LessThanNode(step4_comparison, step4_index, f"{len(types)}").set_comment("Check if the index of the lower counter is less than the count of branches")) - self.register_instruction(cil.GotoIfNode(step4_comparison, "foreach_min_body")) - self.register_instruction(cil.GotoNode("foreach_min_end")) - self.register_instruction(cil.LabelNode("foreach_min_body")) + self.register_instruction(cil.GotoIfNode(step4_comparison, f"foreach_min_body_{node_id}")) + self.register_instruction(cil.GotoNode(f"foreach_min_end_{node_id}")) + self.register_instruction(cil.LabelNode(f"foreach_min_body_{node_id}")) self.register_instruction(cil.GetIndexNode(step4_temp, nearest_ancestor_array, step4_index).set_comment("Get the nearest ancestor index of the i-th branch type")) self.register_instruction(cil.LessThanNode(step4_comparison, step4_temp, step4_current_min).set_comment("Compare if the nearest ancestor index is less than the current minimum")) - self.register_instruction(cil.GotoIfNode(step4_comparison, "update_min")) - self.register_instruction(cil.GotoNode("foreach_min_end")) - self.register_instruction(cil.LabelNode("update_min")) + self.register_instruction(cil.GotoIfNode(step4_comparison, f"update_min_{node_id}")) + self.register_instruction(cil.GotoNode(f"foreach_min_end_{node_id}")) + self.register_instruction(cil.LabelNode(f"update_min_{node_id}")) self.register_instruction(cil.AssignNode(step4_current_min, step4_temp).set_comment("Update the current minimum")) self.register_instruction(cil.AssignNode(step4_current_min_index, step4_index).set_comment("Update the index of the lower counter")) - self.register_instruction(cil.LabelNode("update_min_end")) + self.register_instruction(cil.LabelNode(f"update_min_end_{node_id}")) self.register_instruction(cil.PlusNode(step4_index, step4_index, "1").set_comment("Increment the index of the counter array")) - self.register_instruction(cil.GotoNode("foreach_min_start")) - self.register_instruction(cil.LabelNode("foreach_min_end")) + self.register_instruction(cil.GotoNode(f"foreach_min_start_{node_id}")) + self.register_instruction(cil.LabelNode(f"foreach_min_end_{node_id}")) self.register_empty_instruction() self.register_comment("################################################################# #") @@ -920,27 +917,27 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): self.register_empty_instruction() exists_error = self.define_internal_local("Step 5 - Exists an error") self.register_instruction(cil.EqualNode(exists_error, step4_current_min_index, count_of_ancestors).set_comment("Check if the minimum index is equal to the count of ancestors")) - self.register_instruction(cil.GotoIfNode(exists_error, "error_branch")) + self.register_instruction(cil.GotoIfNode(exists_error, f"error_branch_{node_id}")) self.register_instruction(cil.SetIndexNode(bool_array, step4_current_min_index, "1").set_comment("Set the bool array in the correct index to 1")) step5_comparison = self.define_internal_local("Step 5 - Comparison for the correct branch result") self.register_empty_instruction() for i, t in enumerate(types): self.register_instruction(cil.GetIndexNode(step5_comparison, bool_array, f"{i}").set_comment(f"Get the bool value of the branch {t.name}")) - self.register_instruction(cil.GotoIfNode(step5_comparison, f"branch_{t.name}").set_comment("If the bool value is 1, then we have a match")) + self.register_instruction(cil.GotoIfNode(step5_comparison, f"branch_{t.name}_{node_id}").set_comment("If the bool value is 1, then we have a match")) self.register_empty_instruction() resutl_address = self.define_internal_local("Result of the switch expression address") for i, (var_name, type_name, expr) in enumerate(node.cases): - self.register_instruction(cil.LabelNode(f"branch_{type_name}")) + self.register_instruction(cil.LabelNode(f"branch_{type_name}_{node_id}")) self.register_local(var_name, f"Specialiced variable for the branch {type_name}") expr_source, _ = self.visit(expr, scope.children[i]) self.register_instruction(cil.AssignNode(resutl_address, expr_source).set_comment("Assign the result")) - self.register_instruction(cil.GotoNode(f"branch_end")) + self.register_instruction(cil.GotoNode(f"branch_end_{node_id}")) self.register_empty_instruction() - self.register_instruction(cil.LabelNode("error_branch")) + self.register_instruction(cil.LabelNode(f"error_branch_{node_id}")) self.register_comment("Insert an error call") - self.register_instruction(cil.LabelNode(f"branch_end")) + self.register_instruction(cil.LabelNode(f"branch_end_{node_id}")) return resutl_address, Type.multi_join(types) From 692543eeda9b91eaa5f870a0940cbf3a94fbd7da Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Wed, 16 Feb 2022 23:39:22 -0500 Subject: [PATCH 131/143] - --- main.cl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.cl b/main.cl index abbddd1cb..87eb0de98 100644 --- a/main.cl +++ b/main.cl @@ -58,6 +58,7 @@ class Main { main() : Object { { -- if true then "Hello" else "World" fi; + -- while true loop -- number <- number + 1 -- pool; @@ -66,6 +67,7 @@ class Main { a: Int => 0; b: Bool => not true; c: String => new IO; + d: Object => ~25; esac; } }; From 6c7c0db516aed9ba25f8488b7dbb2e5eec0fb489 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Fri, 18 Feb 2022 01:16:11 -0500 Subject: [PATCH 132/143] Starting to create the structure for the MIPS AST --- src/cool/__main__.py | 8 ++--- src/cool/code_generation/__init__.py | 2 +- .../code_generation/cool_to_cil_visitor.py | 34 ++++++++++--------- src/cool/code_generation/icool.py | 21 ------------ 4 files changed, 23 insertions(+), 42 deletions(-) delete mode 100644 src/cool/code_generation/icool.py diff --git a/src/cool/__main__.py b/src/cool/__main__.py index fec1f2d1c..4100b5e0c 100644 --- a/src/cool/__main__.py +++ b/src/cool/__main__.py @@ -9,8 +9,8 @@ from cool.code_generation import ( CILFormatter, - ICoolTranslator, - ICoolTypeChecker, + ExtendedCoolTranslator, + ExtendedCoolTypeChecker, CoolToCilTranslator, ) from cool.grammar import Token, serialize_parser_and_lexer @@ -137,10 +137,10 @@ def compile( ################### # Code Generation # ################### - icool_ast = ICoolTranslator(context).visit(ast) + icool_ast = ExtendedCoolTranslator(context).visit(ast) scope = Scope() - ICoolTypeChecker(context, errors).visit(icool_ast, scope) + ExtendedCoolTypeChecker(context, errors).visit(icool_ast, scope) # if verbose or True: # log_success(CodeBuilder().visit(icool_ast)) diff --git a/src/cool/code_generation/__init__.py b/src/cool/code_generation/__init__.py index 292568a7c..e743cee89 100644 --- a/src/cool/code_generation/__init__.py +++ b/src/cool/code_generation/__init__.py @@ -1,2 +1,2 @@ -from .cool_to_cil_visitor import ICoolTranslator, ICoolTypeChecker, CoolToCilTranslator +from .cool_to_cil_visitor import ExtendedCoolTranslator, ExtendedCoolTypeChecker, CoolToCilTranslator from .cil import CILFormatter diff --git a/src/cool/code_generation/cool_to_cil_visitor.py b/src/cool/code_generation/cool_to_cil_visitor.py index 942034c71..5e07aa232 100644 --- a/src/cool/code_generation/cool_to_cil_visitor.py +++ b/src/cool/code_generation/cool_to_cil_visitor.py @@ -1,14 +1,12 @@ -from itertools import count from typing import Dict, List, Optional, Tuple import cool.code_generation.cil as cil -import cool.code_generation.icool as icool +import cool.code_generation.extended_cool as extended_cool import cool.semantics.utils.astnodes as cool import cool.semantics.utils.errors as err import cool.visitor as visitor import cool.visitor.visitor as visitor from cool.code_generation.base import BaseCOOLToCILVisitor -from cool.semantics import TypeChecker from cool.semantics.utils.scope import ( Attribute, Context, @@ -20,7 +18,12 @@ ) -class ICoolTranslator: +class ExtendedCoolTranslator: + """ + This class translate the Cool AST to a ExtendedCool AST, adding the new + features like the new keyword null in the asignments and the creation of + a default constructor for every class defined in the program. + """ def __init__(self, context: Context): self.current_type: Optional[Type] = None self.current_method: Optional[Method] = None @@ -105,7 +108,7 @@ def visit(self, node: cool.AttrDeclarationNode): expr = cool.StringNode('""') else: expr = ( - icool.NullNode() + extended_cool.NullNode() ) # cool.WhileNode(cool.BooleanNode("false"), cool.IntegerNode("0")) return cool.AssignNode(node.id, expr) @@ -113,7 +116,7 @@ def visit(self, node: cool.AttrDeclarationNode): return cool.AssignNode(node.id, node.expr) -class ICoolTypeChecker: +class ExtendedCoolTypeChecker: def __init__(self, context: Context, errors: List[str]): self.context: Context = context self.errors: List[str] = errors @@ -441,9 +444,9 @@ def visit(self, node: cool.StringNode, scope: Scope): def visit(self, node: cool.BooleanNode, scope: Scope): return self.context.get_type("Bool") - @visitor.when(icool.NullNode) - def visit(self, node: icool.NullNode, scope: Scope): - return icool.NullType() + @visitor.when(extended_cool.NullNode) + def visit(self, node: extended_cool.NullNode, scope: Scope): + return extended_cool.NullType() @visitor.when(cool.VariableNode) def visit(self, node: cool.VariableNode, scope: Scope): @@ -567,11 +570,10 @@ def _check_unary_operation( return ErrorType() -# Notes: -# 1 - All the expression nodes are going to return a tuple [str, Type] - - class CoolToCilTranslator(BaseCOOLToCILVisitor): + # Notes: + # 1 - All the expression nodes are going to return a tuple [str, Type] + @visitor.on("node") def visit(self, node, scope): pass @@ -975,9 +977,9 @@ def visit(self, node: cool.StringNode, scope: Scope): def visit(self, node: cool.BooleanNode, scope: Scope): return ("1" if node.lex == "true" else "0"), self.context.get_type("Bool") - @visitor.when(icool.NullNode) - def visit(self, node: icool.NullNode, scope: Scope): - return node.lex, icool.NullType + @visitor.when(extended_cool.NullNode) + def visit(self, node: extended_cool.NullNode, scope: Scope): + return node.lex, extended_cool.NullType @visitor.when(cool.VariableNode) def visit(self, node: cool.VariableNode, scope: Scope): diff --git a/src/cool/code_generation/icool.py b/src/cool/code_generation/icool.py deleted file mode 100644 index 304e63b18..000000000 --- a/src/cool/code_generation/icool.py +++ /dev/null @@ -1,21 +0,0 @@ -import cool.semantics.utils.astnodes as cool -from cool.semantics.utils.scope import Type - - -class NullType(Type): - def __init__(self): - super().__init__("null") - - def conforms_to(self, other: "Type") -> bool: - return True - - def bypass(self) -> bool: - return True - - def __str__(self): - return self.name - - -class NullNode(cool.AtomicNode): - def __init__(self): - super().__init__("null") From 81badc728c800d09585fb7afb3c72a077d3baa73 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Fri, 18 Feb 2022 01:16:21 -0500 Subject: [PATCH 133/143] Starting to create the structure for the MIPS AST --- main.cil | 212 ++++++++++++++++++++++ src/cool/code_generation/extended_cool.py | 27 +++ src/cool/code_generation/mips.py | 21 +++ 3 files changed, 260 insertions(+) create mode 100644 main.cil create mode 100644 src/cool/code_generation/extended_cool.py create mode 100644 src/cool/code_generation/mips.py diff --git a/main.cil b/main.cil new file mode 100644 index 000000000..27aa26d1f --- /dev/null +++ b/main.cil @@ -0,0 +1,212 @@ +.TYPES +type Main { + attribute number + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method main: function_main_at_Main + method __init__: function___init___at_Main +} + +.DATA + + +.CODE +function function___init___at_Main { + PARAM self + + + + SETATTR self number 0 + + RETURN self +} +function function_main_at_Main { + PARAM self + + LOCAL internal_0 # Count of ancestors of the switch expression + LOCAL internal_1 # Switch expression type + LOCAL internal_2 # Ancestor type + LOCAL internal_3 # Step 1 comparison result + LOCAL internal_4 # Step 1 Array of ancestors + LOCAL internal_5 # Step 2 iteration index + LOCAL internal_6 # Step 2 comparison result + LOCAL internal_7 # Array to store the branch types + LOCAL internal_8 # Array to store the nearest ancestor index of the expression type of the i-th branch type + LOCAL internal_9 # Address of the type Int + LOCAL internal_10 # Address of the type Bool + LOCAL internal_11 # Address of the type String + LOCAL internal_12 # Step 3 - Iteration index of the branch types array + LOCAL internal_13 # Step 3 - Comparison for the index of the branch types array + LOCAL internal_14 # Step 3 - Type of the i-th branch + LOCAL internal_15 # Step 3 - Index of the ancestor + LOCAL internal_16 # Step 3 - Comparison for the index of the ancestor + LOCAL internal_17 # Step 3 - Type of the j-th ancestor + LOCAL internal_18 # Step 3 - Comparison for the branch type nad the ancestor type + LOCAL internal_19 # Step 4 - Iteration index + LOCAL internal_20 # Step 4 - Index of the minimum counter in the counter array + LOCAL internal_21 # Step 4 - Temporary variable + LOCAL internal_22 # Step 4 - Current minimum of the counter array + LOCAL internal_23 # Step 4 - Comparison for the minimum of the counter array + LOCAL internal_24 # Step 5 - Bool array + LOCAL internal_25 # Step 5 - Exists an error + LOCAL internal_26 # Step 5 - Comparison for the correct branch result + LOCAL internal_27 # Result of the switch expression address + LOCAL a # Specialiced variable for the branch Int + LOCAL b # Specialiced variable for the branch Bool + LOCAL c # Specialiced variable for the branch String + + # Steps: + # 1 - Count how many ancestors has the dynamic type of the expression + # 2 - Create an array of the same size where to store the ancestors + # 3 - For each branch type, store the ancestor index that match with it, if no one match, store `count of ancestors` + # 4 - Find the minimum of the ancestors indexes + # 5 - With the minimum index, get the correct branch type + + # ######################################################################## # + # Step 1 - Count how many ancestors has the dynamic type of the expression # + # ######################################################################## # + internal_1 = TYPEOF 1 # Get the switch expression type + internal_2 = internal_1 # The first ancestor will be the type itself + internal_0 = 0 # Initialize the counter + while_start: + internal_3 = internal_2 == 0 + IF internal_3 GOTO while_end + internal_0 = internal_0 + 1 # Increment the counter + internal_2 = ANCESTOR internal_2 + GOTO while_start + while_end: + + # ###################################################################### # + # Step 2 - Create an array of the same size where to store the ancestors # + # ###################################################################### # + internal_2 = internal_1 # The first ancestor will be the type itself + internal_4 = ARRAY internal_0 # Create an array of ancestors + internal_5 = 0 # Initialize the index with the value 0 + foreach_start: + internal_6 = internal_5 < internal_0 # Check if the index is less than the counter + IF internal_6 GOTO foreach_body + GOTO foreach_end + foreach_body: + SETINDEX internal_4 internal_5 internal_2 # Set the index of the array with the ancestor type + internal_2 = ANCESTOR internal_2 # Get the next ancestor + internal_5 = internal_5 + 1 # Increment index + GOTO foreach_start + foreach_end: + + internal_7 = ARRAY 3 + internal_8 = ARRAY 3 + internal_9 = TYPEDIR Int + SETINDEX internal_7 0 internal_9 + SETINDEX internal_8 0 internal_0 + internal_10 = TYPEDIR Bool + SETINDEX internal_7 1 internal_10 + SETINDEX internal_8 1 internal_0 + internal_11 = TYPEDIR String + SETINDEX internal_7 2 internal_11 + SETINDEX internal_8 2 internal_0 + + # #################################################################################################### # + # Step 3 - For each branch type, store the ancestor index that match with it (Simulating a double for) # + # #################################################################################################### # + # ############# # + # Outer Foreach # + # ############# # + internal_12 = 0 # Initialize the index i of the case to 0 + foreach_type_start: + internal_13 = internal_12 < 3 # Check if the type index is less than the count of branches + IF internal_13 GOTO foreach_type_body + GOTO foreach_type_end + foreach_type_body: + internal_14 = GETINDEX internal_7 internal_12 # Get the type of the i-th branch + + # ############# # + # Inner Foreach # + # ############# # + internal_15 = 0 # Initialize the index j of the case to 0 + foreach_ancestor_start: + internal_16 = internal_15 < internal_0 # Check if the case index is less than the count of ancestors + IF internal_16 GOTO foreach_ancestor_body + GOTO foreach_ancestor_end + foreach_ancestor_body: + internal_17 = GETINDEX internal_4 internal_15 # Get the j-th ancestor type + internal_18 = internal_14 == internal_17 # Compare if the type of the i-th branch is equal to the j-th ancestor + IF internal_18 GOTO foreach_ancestor_end # If the types are equal, we have a match, then we can exit + internal_15 = internal_15 + 1 # Increment the ancestor index + GOTO foreach_ancestor_start + foreach_ancestor_end: + SETINDEX internal_8 internal_12 internal_15 # Set the counter of the i-th branch equals to j + # #################### # + # End of Inner Foreach # + # #################### # + + internal_12 = internal_12 + 1 # Increment type index + GOTO foreach_type_start + foreach_type_end: + # ################# # + # End Outer Foreach # + # ################# # + + # ######################################## # + # Step 4 - Find the minimum ancestor index # + # ######################################## # + internal_19 = 0 # Initialize the index of the counter array to 0 + internal_20 = 0 # Initialize the index of the lower counter to 0 + internal_22 = internal_0 # Initialize the current minimum to `count of ancestors` + foreach_min_start: + internal_23 = internal_19 < 3 # Check if the index of the lower counter is less than the count of branches + IF internal_23 GOTO foreach_min_body + GOTO foreach_min_end + foreach_min_body: + internal_21 = GETINDEX internal_8 internal_19 # Get the nearest ancestor index of the i-th branch type + internal_23 = internal_21 < internal_22 # Compare if the nearest ancestor index is less than the current minimum + IF internal_23 GOTO update_min + GOTO foreach_min_end + update_min: + internal_22 = internal_21 # Update the current minimum + internal_20 = internal_19 # Update the index of the lower counter + update_min_end: + internal_19 = internal_19 + 1 # Increment the index of the counter array + GOTO foreach_min_start + foreach_min_end: + + # ################################################################# # + # Step 5 - Using the minimun ancestor index find the correct branch # + # ################################################################# # + internal_24 = ARRAY 3 # Create the bool array + SETINDEX internal_24 0 0 # Initialize the bool array + SETINDEX internal_24 1 0 # Initialize the bool array + SETINDEX internal_24 2 0 # Initialize the bool array + + internal_25 = internal_20 == internal_0 # Check if the minimum index is equal to the count of ancestors + IF internal_25 GOTO error_branch + SETINDEX internal_24 internal_20 1 # Set the bool array in the correct index to 1 + + internal_26 = GETINDEX internal_24 0 # Get the bool value of the branch Int + IF internal_26 GOTO branch_Int # If the bool value is 1, then we have a match + + internal_26 = GETINDEX internal_24 1 # Get the bool value of the branch Bool + IF internal_26 GOTO branch_Bool # If the bool value is 1, then we have a match + + internal_26 = GETINDEX internal_24 2 # Get the bool value of the branch String + IF internal_26 GOTO branch_String # If the bool value is 1, then we have a match + + branch_Int: + internal_27 = 0 # Assign the result + GOTO branch_end + + branch_Bool: + internal_27 = 1 # Assign the result + GOTO branch_end + + branch_String: + internal_27 = 2 # Assign the result + GOTO branch_end + + error_branch: + # Insert an error call + branch_end: + + RETURN internal_27 +} diff --git a/src/cool/code_generation/extended_cool.py b/src/cool/code_generation/extended_cool.py new file mode 100644 index 000000000..6a89cfb0a --- /dev/null +++ b/src/cool/code_generation/extended_cool.py @@ -0,0 +1,27 @@ +""" +ExtendedCool is a language similar to Cool, but with some additional +features like the new keyword null in the asignments and the creation of +a default constructor for every class defined in the program. +""" + +import cool.semantics.utils.astnodes as cool +from cool.semantics.utils.scope import Type + + +class NullType(Type): + def __init__(self): + super().__init__("null") + + def conforms_to(self, other: "Type") -> bool: + return True + + def bypass(self) -> bool: + return True + + def __str__(self): + return self.name + + +class NullNode(cool.AtomicNode): + def __init__(self): + super().__init__("null") diff --git a/src/cool/code_generation/mips.py b/src/cool/code_generation/mips.py new file mode 100644 index 000000000..3d441c089 --- /dev/null +++ b/src/cool/code_generation/mips.py @@ -0,0 +1,21 @@ +from ast import List + + +class Node: + pass + + +class ProgramNode(Node): + def __init__(self, dotdata: List["DataNode"], dottext: List["InstructionNode"]): + self.dotdata = dotdata + self.dottext = dottext + + +class DataNode(Node): + def __init__(self): + pass + + +class InstructionNode(Node): + def __init__(self): + pass From bfb2e46f1b1cf9697949c6585395c3e7ea6b2996 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Tue, 22 Feb 2022 02:05:32 -0500 Subject: [PATCH 134/143] Fixed an error in the dynamic call translation to cil. Completed the translation to cil of all the default types and their methods. --- main.cil | 212 ---- src/cool/__main__.py | 22 +- src/cool/code_generation/__init__.py | 5 +- src/cool/code_generation/ast_cil.py | 292 +++++ .../{extended_cool.py => ast_ecool.py} | 0 src/cool/code_generation/ast_mips.py | 238 ++++ src/cool/code_generation/base.py | 76 -- src/cool/code_generation/cil.py | 505 -------- src/cool/code_generation/formatters.py | 386 ++++++ src/cool/code_generation/mips.py | 21 - .../cmp/.ipynb_checkpoints/ast-checkpoint.py | 29 - .../.ipynb_checkpoints/automata-checkpoint.py | 167 --- .../languages-checkpoint.py | 364 ------ .../nbpackage-checkpoint.py | 94 -- .../pycompiler-checkpoint.py | 448 ------- .../.ipynb_checkpoints/tools-checkpoint.py | 21 - .../.ipynb_checkpoints/utils-checkpoint.py | 156 --- .../.ipynb_checkpoints/visitor-checkpoint.py | 85 -- .../code_generation/notebooks/cmp/__init__.py | 0 src/cool/code_generation/notebooks/cmp/ast.py | 70 -- .../code_generation/notebooks/cmp/automata.py | 224 ---- src/cool/code_generation/notebooks/cmp/cil.py | 266 ---- .../notebooks/cmp/evaluation.py | 36 - .../notebooks/cmp/languages.py | 399 ------ .../notebooks/cmp/nbpackage.py | 94 -- .../notebooks/cmp/pycompiler.py | 513 -------- .../code_generation/notebooks/cmp/semantic.py | 250 ---- .../.ipynb_checkpoints/__init__-checkpoint.py | 0 .../.ipynb_checkpoints/automata-checkpoint.py | 10 - .../evaluation-checkpoint.py | 10 - .../.ipynb_checkpoints/parsing-checkpoint.py | 21 - .../notebooks/cmp/tools/__init__.py | 0 .../notebooks/cmp/tools/automata.py | 10 - .../notebooks/cmp/tools/evaluation.py | 10 - .../notebooks/cmp/tools/parsing.py | 40 - .../notebooks/cmp/tools/regex.py | 10 - .../code_generation/notebooks/cmp/utils.py | 241 ---- .../code_generation/notebooks/cmp/visitor.py | 85 -- src/cool/code_generation/notebooks/cp12.ipynb | 1073 ----------------- src/cool/code_generation/notebooks/cp13.ipynb | 657 ---------- src/cool/code_generation/notebooks/cp14.ipynb | 543 --------- src/cool/code_generation/notebooks/cp15.ipynb | 481 -------- src/cool/code_generation/notebooks/cp16.ipynb | 807 ------------- src/cool/code_generation/notebooks/lexer.py | 171 --- .../code_generation/translator_cil_to_mips.py | 77 ++ ...l_visitor.py => translator_cool_to_cil.py} | 188 ++- src/main..asm | 49 + src/main..cil | 190 +++ main.cl => src/main.cl | 19 +- 49 files changed, 1428 insertions(+), 8237 deletions(-) delete mode 100644 main.cil create mode 100644 src/cool/code_generation/ast_cil.py rename src/cool/code_generation/{extended_cool.py => ast_ecool.py} (100%) create mode 100644 src/cool/code_generation/ast_mips.py delete mode 100644 src/cool/code_generation/base.py delete mode 100644 src/cool/code_generation/cil.py create mode 100644 src/cool/code_generation/formatters.py delete mode 100644 src/cool/code_generation/mips.py delete mode 100644 src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/ast-checkpoint.py delete mode 100644 src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/automata-checkpoint.py delete mode 100644 src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/languages-checkpoint.py delete mode 100644 src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/nbpackage-checkpoint.py delete mode 100644 src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/pycompiler-checkpoint.py delete mode 100644 src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/tools-checkpoint.py delete mode 100644 src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/utils-checkpoint.py delete mode 100644 src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/visitor-checkpoint.py delete mode 100644 src/cool/code_generation/notebooks/cmp/__init__.py delete mode 100644 src/cool/code_generation/notebooks/cmp/ast.py delete mode 100644 src/cool/code_generation/notebooks/cmp/automata.py delete mode 100644 src/cool/code_generation/notebooks/cmp/cil.py delete mode 100644 src/cool/code_generation/notebooks/cmp/evaluation.py delete mode 100644 src/cool/code_generation/notebooks/cmp/languages.py delete mode 100644 src/cool/code_generation/notebooks/cmp/nbpackage.py delete mode 100644 src/cool/code_generation/notebooks/cmp/pycompiler.py delete mode 100644 src/cool/code_generation/notebooks/cmp/semantic.py delete mode 100644 src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/__init__-checkpoint.py delete mode 100644 src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/automata-checkpoint.py delete mode 100644 src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/evaluation-checkpoint.py delete mode 100644 src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/parsing-checkpoint.py delete mode 100644 src/cool/code_generation/notebooks/cmp/tools/__init__.py delete mode 100644 src/cool/code_generation/notebooks/cmp/tools/automata.py delete mode 100644 src/cool/code_generation/notebooks/cmp/tools/evaluation.py delete mode 100644 src/cool/code_generation/notebooks/cmp/tools/parsing.py delete mode 100644 src/cool/code_generation/notebooks/cmp/tools/regex.py delete mode 100644 src/cool/code_generation/notebooks/cmp/utils.py delete mode 100644 src/cool/code_generation/notebooks/cmp/visitor.py delete mode 100644 src/cool/code_generation/notebooks/cp12.ipynb delete mode 100644 src/cool/code_generation/notebooks/cp13.ipynb delete mode 100644 src/cool/code_generation/notebooks/cp14.ipynb delete mode 100644 src/cool/code_generation/notebooks/cp15.ipynb delete mode 100644 src/cool/code_generation/notebooks/cp16.ipynb delete mode 100644 src/cool/code_generation/notebooks/lexer.py create mode 100644 src/cool/code_generation/translator_cil_to_mips.py rename src/cool/code_generation/{cool_to_cil_visitor.py => translator_cool_to_cil.py} (85%) create mode 100644 src/main..asm create mode 100644 src/main..cil rename main.cl => src/main.cl (70%) diff --git a/main.cil b/main.cil deleted file mode 100644 index 27aa26d1f..000000000 --- a/main.cil +++ /dev/null @@ -1,212 +0,0 @@ -.TYPES -type Main { - attribute number - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method main: function_main_at_Main - method __init__: function___init___at_Main -} - -.DATA - - -.CODE -function function___init___at_Main { - PARAM self - - - - SETATTR self number 0 - - RETURN self -} -function function_main_at_Main { - PARAM self - - LOCAL internal_0 # Count of ancestors of the switch expression - LOCAL internal_1 # Switch expression type - LOCAL internal_2 # Ancestor type - LOCAL internal_3 # Step 1 comparison result - LOCAL internal_4 # Step 1 Array of ancestors - LOCAL internal_5 # Step 2 iteration index - LOCAL internal_6 # Step 2 comparison result - LOCAL internal_7 # Array to store the branch types - LOCAL internal_8 # Array to store the nearest ancestor index of the expression type of the i-th branch type - LOCAL internal_9 # Address of the type Int - LOCAL internal_10 # Address of the type Bool - LOCAL internal_11 # Address of the type String - LOCAL internal_12 # Step 3 - Iteration index of the branch types array - LOCAL internal_13 # Step 3 - Comparison for the index of the branch types array - LOCAL internal_14 # Step 3 - Type of the i-th branch - LOCAL internal_15 # Step 3 - Index of the ancestor - LOCAL internal_16 # Step 3 - Comparison for the index of the ancestor - LOCAL internal_17 # Step 3 - Type of the j-th ancestor - LOCAL internal_18 # Step 3 - Comparison for the branch type nad the ancestor type - LOCAL internal_19 # Step 4 - Iteration index - LOCAL internal_20 # Step 4 - Index of the minimum counter in the counter array - LOCAL internal_21 # Step 4 - Temporary variable - LOCAL internal_22 # Step 4 - Current minimum of the counter array - LOCAL internal_23 # Step 4 - Comparison for the minimum of the counter array - LOCAL internal_24 # Step 5 - Bool array - LOCAL internal_25 # Step 5 - Exists an error - LOCAL internal_26 # Step 5 - Comparison for the correct branch result - LOCAL internal_27 # Result of the switch expression address - LOCAL a # Specialiced variable for the branch Int - LOCAL b # Specialiced variable for the branch Bool - LOCAL c # Specialiced variable for the branch String - - # Steps: - # 1 - Count how many ancestors has the dynamic type of the expression - # 2 - Create an array of the same size where to store the ancestors - # 3 - For each branch type, store the ancestor index that match with it, if no one match, store `count of ancestors` - # 4 - Find the minimum of the ancestors indexes - # 5 - With the minimum index, get the correct branch type - - # ######################################################################## # - # Step 1 - Count how many ancestors has the dynamic type of the expression # - # ######################################################################## # - internal_1 = TYPEOF 1 # Get the switch expression type - internal_2 = internal_1 # The first ancestor will be the type itself - internal_0 = 0 # Initialize the counter - while_start: - internal_3 = internal_2 == 0 - IF internal_3 GOTO while_end - internal_0 = internal_0 + 1 # Increment the counter - internal_2 = ANCESTOR internal_2 - GOTO while_start - while_end: - - # ###################################################################### # - # Step 2 - Create an array of the same size where to store the ancestors # - # ###################################################################### # - internal_2 = internal_1 # The first ancestor will be the type itself - internal_4 = ARRAY internal_0 # Create an array of ancestors - internal_5 = 0 # Initialize the index with the value 0 - foreach_start: - internal_6 = internal_5 < internal_0 # Check if the index is less than the counter - IF internal_6 GOTO foreach_body - GOTO foreach_end - foreach_body: - SETINDEX internal_4 internal_5 internal_2 # Set the index of the array with the ancestor type - internal_2 = ANCESTOR internal_2 # Get the next ancestor - internal_5 = internal_5 + 1 # Increment index - GOTO foreach_start - foreach_end: - - internal_7 = ARRAY 3 - internal_8 = ARRAY 3 - internal_9 = TYPEDIR Int - SETINDEX internal_7 0 internal_9 - SETINDEX internal_8 0 internal_0 - internal_10 = TYPEDIR Bool - SETINDEX internal_7 1 internal_10 - SETINDEX internal_8 1 internal_0 - internal_11 = TYPEDIR String - SETINDEX internal_7 2 internal_11 - SETINDEX internal_8 2 internal_0 - - # #################################################################################################### # - # Step 3 - For each branch type, store the ancestor index that match with it (Simulating a double for) # - # #################################################################################################### # - # ############# # - # Outer Foreach # - # ############# # - internal_12 = 0 # Initialize the index i of the case to 0 - foreach_type_start: - internal_13 = internal_12 < 3 # Check if the type index is less than the count of branches - IF internal_13 GOTO foreach_type_body - GOTO foreach_type_end - foreach_type_body: - internal_14 = GETINDEX internal_7 internal_12 # Get the type of the i-th branch - - # ############# # - # Inner Foreach # - # ############# # - internal_15 = 0 # Initialize the index j of the case to 0 - foreach_ancestor_start: - internal_16 = internal_15 < internal_0 # Check if the case index is less than the count of ancestors - IF internal_16 GOTO foreach_ancestor_body - GOTO foreach_ancestor_end - foreach_ancestor_body: - internal_17 = GETINDEX internal_4 internal_15 # Get the j-th ancestor type - internal_18 = internal_14 == internal_17 # Compare if the type of the i-th branch is equal to the j-th ancestor - IF internal_18 GOTO foreach_ancestor_end # If the types are equal, we have a match, then we can exit - internal_15 = internal_15 + 1 # Increment the ancestor index - GOTO foreach_ancestor_start - foreach_ancestor_end: - SETINDEX internal_8 internal_12 internal_15 # Set the counter of the i-th branch equals to j - # #################### # - # End of Inner Foreach # - # #################### # - - internal_12 = internal_12 + 1 # Increment type index - GOTO foreach_type_start - foreach_type_end: - # ################# # - # End Outer Foreach # - # ################# # - - # ######################################## # - # Step 4 - Find the minimum ancestor index # - # ######################################## # - internal_19 = 0 # Initialize the index of the counter array to 0 - internal_20 = 0 # Initialize the index of the lower counter to 0 - internal_22 = internal_0 # Initialize the current minimum to `count of ancestors` - foreach_min_start: - internal_23 = internal_19 < 3 # Check if the index of the lower counter is less than the count of branches - IF internal_23 GOTO foreach_min_body - GOTO foreach_min_end - foreach_min_body: - internal_21 = GETINDEX internal_8 internal_19 # Get the nearest ancestor index of the i-th branch type - internal_23 = internal_21 < internal_22 # Compare if the nearest ancestor index is less than the current minimum - IF internal_23 GOTO update_min - GOTO foreach_min_end - update_min: - internal_22 = internal_21 # Update the current minimum - internal_20 = internal_19 # Update the index of the lower counter - update_min_end: - internal_19 = internal_19 + 1 # Increment the index of the counter array - GOTO foreach_min_start - foreach_min_end: - - # ################################################################# # - # Step 5 - Using the minimun ancestor index find the correct branch # - # ################################################################# # - internal_24 = ARRAY 3 # Create the bool array - SETINDEX internal_24 0 0 # Initialize the bool array - SETINDEX internal_24 1 0 # Initialize the bool array - SETINDEX internal_24 2 0 # Initialize the bool array - - internal_25 = internal_20 == internal_0 # Check if the minimum index is equal to the count of ancestors - IF internal_25 GOTO error_branch - SETINDEX internal_24 internal_20 1 # Set the bool array in the correct index to 1 - - internal_26 = GETINDEX internal_24 0 # Get the bool value of the branch Int - IF internal_26 GOTO branch_Int # If the bool value is 1, then we have a match - - internal_26 = GETINDEX internal_24 1 # Get the bool value of the branch Bool - IF internal_26 GOTO branch_Bool # If the bool value is 1, then we have a match - - internal_26 = GETINDEX internal_24 2 # Get the bool value of the branch String - IF internal_26 GOTO branch_String # If the bool value is 1, then we have a match - - branch_Int: - internal_27 = 0 # Assign the result - GOTO branch_end - - branch_Bool: - internal_27 = 1 # Assign the result - GOTO branch_end - - branch_String: - internal_27 = 2 # Assign the result - GOTO branch_end - - error_branch: - # Insert an error call - branch_end: - - RETURN internal_27 -} diff --git a/src/cool/__main__.py b/src/cool/__main__.py index 4100b5e0c..ec22a724e 100644 --- a/src/cool/__main__.py +++ b/src/cool/__main__.py @@ -8,10 +8,12 @@ sys.path.append(os.getcwd()) from cool.code_generation import ( - CILFormatter, + CilFormatter, + MipsFormatter, ExtendedCoolTranslator, ExtendedCoolTypeChecker, CoolToCilTranslator, + CilToMipsTranslator ) from cool.grammar import Token, serialize_parser_and_lexer from cool.lexertab import CoolLexer @@ -105,13 +107,14 @@ def compile( input_file: typer.FileText = typer.Argument(..., help="Cool file"), output_file: typer.FileTextWrite = typer.Argument("a.mips", help="Mips file"), verbose: bool = typer.Option(False, help="Run in verbose mode."), + cil: bool = typer.Option(False, help="Output CIL code instead of MIPS code."), ): # In case of encoding conflict if input_file.encoding.lower != "utf-8": input_file = open(input_file.name, encoding="utf-8") - program = input_file.read() - tokens, lexer = tokenize(program, verbose) + cil_program = input_file.read() + tokens, lexer = tokenize(cil_program, verbose) if lexer is None or lexer.contain_errors: exit(1) @@ -146,9 +149,20 @@ def compile( # log_success(CodeBuilder().visit(icool_ast)) cil_ast = CoolToCilTranslator(context).visit(icool_ast, scope) + mips_ast = CilToMipsTranslator(context).visit(cil_ast) if verbose or True: - log_success(CILFormatter().visit(cil_ast)) + if cil: + with open(f"{input_file.name[:-2]}.cil", "w+") as cil_file: + cil_program = CilFormatter().visit(cil_ast) + output_file.name = f"{input_file.name[:-2]}.cil" + cil_file.write(cil_program) + + mips_program = MipsFormatter().visit(mips_ast) + output_file.name = f"{input_file.name[:-2]}.asm" + output_file.write(mips_program) + output_file.close() + ####### # End # ####### diff --git a/src/cool/code_generation/__init__.py b/src/cool/code_generation/__init__.py index e743cee89..b60429f9a 100644 --- a/src/cool/code_generation/__init__.py +++ b/src/cool/code_generation/__init__.py @@ -1,2 +1,3 @@ -from .cool_to_cil_visitor import ExtendedCoolTranslator, ExtendedCoolTypeChecker, CoolToCilTranslator -from .cil import CILFormatter +from .translator_cool_to_cil import ExtendedCoolTranslator, ExtendedCoolTypeChecker, CoolToCilTranslator +from .translator_cil_to_mips import CilToMipsTranslator +from .formatters import CilFormatter, MipsFormatter diff --git a/src/cool/code_generation/ast_cil.py b/src/cool/code_generation/ast_cil.py new file mode 100644 index 000000000..94753d4c2 --- /dev/null +++ b/src/cool/code_generation/ast_cil.py @@ -0,0 +1,292 @@ +from typing import Any, List, Optional, Tuple + + +class Node: + comment: str = "" + + def set_comment(self, comment: str) -> "Node": + self.comment = comment + return self + + +class ProgramNode(Node): + def __init__( + self, + dottypes: List["TypeNode"], + dotdata: List["DataNode"], + dotcode: List["FunctionNode"], + ): + self.dottypes: List[TypeNode] = dottypes + self.dotdata: List[DataNode] = dotdata + self.dotcode: List[FunctionNode] = dotcode + + +class TypeNode(Node): + def __init__(self, name: str, parent: Optional[str] = None): + self.name: str = name + self.parent: str = parent or "null" + self.attributes: List[str] = [] + self.methods: List[Tuple[str, str]] = [] + + +class DataNode(Node): + def __init__(self, name: str, value: Any): + self.name: str = name + self.value: Any = value + + +class FunctionNode(Node): + def __init__( + self, + name: str, + params: List["ParamNode"], + local_vars: List["LoadNode"], + instructions: List["InstructionNode"], + ): + self.name: str = name + self.params: List[ParamNode] = params + self.local_vars: List[LocalNode] = local_vars + self.instructions: List[InstructionNode] = instructions + + +class ParamNode(Node): + def __init__(self, name: str): + self.name: str = name + + +class LocalNode(Node): + def __init__(self, name: str): + self.name: str = name + + +class InstructionNode(Node): + pass + + +class AssignNode(InstructionNode): + def __init__(self, dest: str, source: str): + self.dest: str = dest + self.source: str = source + + +class ArithmeticNode(InstructionNode): + def __init__(self, dest: str, left: str, right: str): + self.dest: str = dest + self.left: str = left + self.right: str = right + + +class PlusNode(ArithmeticNode): + pass + + +class MinusNode(ArithmeticNode): + pass + + +class StarNode(ArithmeticNode): + pass + + +class DivNode(ArithmeticNode): + pass + + +class LessEqualNode(ArithmeticNode): + pass + + +class LessThanNode(ArithmeticNode): + pass + + +class EqualNode(ArithmeticNode): + pass + + +class XorNode(ArithmeticNode): + pass + + +class GetAttribNode(InstructionNode): + def __init__(self, dest: str, instance: str, attr: str) -> None: + self.dest: str = dest + self.instance: str = instance + self.attr: str = attr + + +class SetAttribNode(InstructionNode): + def __init__(self, instance: str, attr: str, source: str) -> None: + self.instance: str = instance + self.attr: str = attr + self.source: str = source + + +class GetIndexNode(InstructionNode): + def __init__(self, dest: str, instance: str, index: str) -> None: + self.dest: str = dest + self.instance: str = instance + self.index: str = index + + +class SetIndexNode(InstructionNode): + def __init__(self, instance: str, index: int, source: str) -> None: + self.instance: str = instance + self.index: int = index + self.source: str = source + + +class AllocateNode(InstructionNode): + def __init__(self, itype: str, dest: str): + self.type: str = itype + self.dest: str = dest + + +class ArrayNode(InstructionNode): + def __init__(self, dest: str, size: int) -> None: + self.dest: str = dest + self.size: int = size + + +class TypeOfNode(InstructionNode): + def __init__( + self, + dest: str, + obj: str, + ): + self.obj: str = obj + self.dest: str = dest + + +class AncestorNode(InstructionNode): + def __init__(self, dest: str, obj: str): + self.obj: str = obj + self.dest: str = dest + + +class TypeDirectionNode(InstructionNode): + def __init__(self, dest: str, name: str): + self.name: str = name + self.dest: str = dest + + +class LabelNode(InstructionNode): + def __init__(self, label: str): + self.label: str = label + + +class GotoNode(InstructionNode): + def __init__(self, address: str): + self.address: str = address + + +class GotoIfNode(InstructionNode): + def __init__(self, condition: str, address: str): + self.condition: str = condition + self.address: str = address + + +class StaticCallNode(InstructionNode): + def __init__(self, function, dest): + self.function = function + self.dest = dest + + +class DynamicCallNode(InstructionNode): + def __init__(self, xtype: str, method: str, dest: str): + self.type = xtype + self.method = method + self.dest = dest + + +class ArgNode(InstructionNode): + def __init__(self, name: str): + self.name: str = name + + +class ReturnNode(InstructionNode): + def __init__(self, value=None): + self.value = value + + +class LoadNode(InstructionNode): + def __init__(self, dest, msg): + self.dest = dest + self.msg = msg + + +class LengthNode(InstructionNode): + def __init__(self, dest: str, str_address: str) -> None: + self.dest: str = dest + self.str_address: str = str_address + + +class ConcatNode(InstructionNode): + def __init__(self, dest: str, str1: str, str2: str): + self.dest: str = dest + self.str1: str = str1 + self.str2: str = str2 + + +class PrefixNode(InstructionNode): + pass + + +class SubstringNode(InstructionNode): + def __init__(self, dest: str, str_address: str, start: int, length: int): + self.dest: str = dest + self.str_address: str = str_address + self.start: int = start + self.length: int = length + +class ToStrNode(InstructionNode): + def __init__(self, dest, ivalue): + self.dest = dest + self.ivalue = ivalue + + +class ReadStringNode(InstructionNode): + def __init__(self, dest): + self.dest = dest + + +class ReadIntNode(InstructionNode): + def __init__(self, dest): + self.dest = dest + + +class PrintStringNode(InstructionNode): + def __init__(self, str_addr): + self.str_addr = str_addr + + +class PrintIntNode(InstructionNode): + def __init__(self, value): + self.value = value + + +class CopyNode(InstructionNode): + def __init__(self, dest: str, source: str) -> None: + self.dest: str = dest + self.source: str = source + + +class CommentNode(InstructionNode): + def __init__(self, comment): + self.comment = comment + + +class EmptyInstruction(InstructionNode): + def __init__(self): + pass + + +class TypeNameNode(InstructionNode): + def __init__(self, dest, source): + self.dest = dest + self.source = source + + +class HaltNode(InstructionNode): + def __init__(self): + pass diff --git a/src/cool/code_generation/extended_cool.py b/src/cool/code_generation/ast_ecool.py similarity index 100% rename from src/cool/code_generation/extended_cool.py rename to src/cool/code_generation/ast_ecool.py diff --git a/src/cool/code_generation/ast_mips.py b/src/cool/code_generation/ast_mips.py new file mode 100644 index 000000000..b6b36da42 --- /dev/null +++ b/src/cool/code_generation/ast_mips.py @@ -0,0 +1,238 @@ +from typing import List + + +class Node: + pass + + +class ProgramNode(Node): + def __init__(self, dotdata: List["DataNode"], dottext: List["InstructionNode"]): + self.dotdata: List[DataNode] = dotdata + self.dottext: List[InstructionNode] = dottext + + +class DataNode(Node): + data_type: str = "" + + def __init__(self, name: str, value: str): + self.name = name + self.value = value + + +class EmptyDataNode(Node): + pass + + +class WordDataNode(DataNode): + data_type = ".word" + + +class AsciizDataNode(DataNode): + data_type = ".asciiz" + + +class InstructionNode(Node): + code: str = "" + + def __init__(self): + pass + + +class OneAddressInstructionNode(InstructionNode): + def __init__(self, dest: str): + self.dest: str = dest + + +class TwoAddressIntructionNode(InstructionNode): + def __init__(self, dest: str, source: str): + self.dest: str = dest + self.source: str = source + + +class ThreeAddressIntructionNode(InstructionNode): + def __init__(self, dest: str, source1: str, source2: str): + self.dest: str = dest + self.source1: str = source1 + self.source2: str = source2 + + +##################################### +# Arithmetic and Logic Instructions # +##################################### +class AddNode(ThreeAddressIntructionNode): + code = "add" + + +class AddiNode(ThreeAddressIntructionNode): + code = "addi" + + +class AdduNode(ThreeAddressIntructionNode): + code = "addu" + + +class AddiuNode(ThreeAddressIntructionNode): + code = "addiu" + + +class AndNode(ThreeAddressIntructionNode): + code = "and" + + +class AndiNode(ThreeAddressIntructionNode): + code = "andi" + + +class DivNode(TwoAddressIntructionNode): + code = "div" + + +class DivuNode(TwoAddressIntructionNode): + code = "divu" + + +class MultNode(TwoAddressIntructionNode): + code = "mult" + + +class MultuNode(TwoAddressIntructionNode): + code = "multu" + + +class NorNode(ThreeAddressIntructionNode): + code = "nor" + + +class OrNode(ThreeAddressIntructionNode): + code = "or" + + +class OriNode(ThreeAddressIntructionNode): + code = "ori" + + +class SllNode(ThreeAddressIntructionNode): + code = "sll" + + +class SllvNode(ThreeAddressIntructionNode): + code = "sllv" + + +class SraNode(ThreeAddressIntructionNode): + code = "sra" + + +class SravNode(ThreeAddressIntructionNode): + code = "srav" + + +class SrlNode(ThreeAddressIntructionNode): + code = "srl" + + +class SrlvNode(ThreeAddressIntructionNode): + code = "srlv" + + +class SubNode(ThreeAddressIntructionNode): + code = "sub" + + +class SubuNode(ThreeAddressIntructionNode): + code = "subu" + + +class XorNode(ThreeAddressIntructionNode): + code = "xor" + + +class XoriNode(ThreeAddressIntructionNode): + code = "xori" + + +class LuiNode(TwoAddressIntructionNode): + code = "lui" + + +class SltNode(ThreeAddressIntructionNode): + code = "slt" + + +class SltiNode(ThreeAddressIntructionNode): + code = "slti" + + +class SltuNode(ThreeAddressIntructionNode): + code = "sltu" + + +class SltiuNode(ThreeAddressIntructionNode): + code = "sltiu" + + +######################################### +# End Arithmetic and Logic Instructions # +######################################### + +################################ +# Branch and Jump Instructions # +################################ + + +class BeqNode(ThreeAddressIntructionNode): + code = "beq" + + +class BgezNode(TwoAddressIntructionNode): + code = "bgez" + + +class BgezalNode(TwoAddressIntructionNode): + code = "bgezal" + + +class BgtzNode(TwoAddressIntructionNode): + code = "bgtz" + + +class BlezNode(TwoAddressIntructionNode): + code = "blez" + + +class BltzalNode(TwoAddressIntructionNode): + code = "bltzal" + + +class BltzNode(TwoAddressIntructionNode): + code = "bltz" + + +class BneNode(ThreeAddressIntructionNode): + code = "bne" + + +class JumpNode(OneAddressInstructionNode): + code = "j" + + +class JumpAndLinkNode(OneAddressInstructionNode): + code = "jal" + + +class JumpAndLinkRegisterNode(OneAddressInstructionNode): + code = "jalr" + + +class JumpRegisterNode(OneAddressInstructionNode): + code = "jr" + + +#################################### +# End Branch and Jump Instructions # +#################################### + + +class LabelNode(InstructionNode): + def __init__(self, name: str): + self.name: str = name \ No newline at end of file diff --git a/src/cool/code_generation/base.py b/src/cool/code_generation/base.py deleted file mode 100644 index cf87d5eba..000000000 --- a/src/cool/code_generation/base.py +++ /dev/null @@ -1,76 +0,0 @@ -from typing import Any, List, Optional - -import cool.code_generation.cil as cil -from cool.semantics.utils.scope import Context, Method, Type - - -class BaseCOOLToCILVisitor: - def __init__(self, context: Context): - self.dottypes: List[cil.TypeNode] = [] - self.dotdata: List[cil.DataNode] = [] - self.dotcode: List[cil.FunctionNode] = [] - - self.current_type: Optional[Type] = None - self.current_method: Optional[Method] = None - self.current_function: Optional[cil.FunctionNode] = None - - self.context: Context = context - - self.locals_dict = {} - self.param_set = set() - self.attr_set = set() - - @property - def params(self) -> List[cil.ParamNode]: - return self.current_function.params - - @property - def localvars(self) -> List[cil.LocalNode]: - return self.current_function.local_vars - - @property - def instructions(self) -> List[cil.InstructionNode]: - return self.current_function.instructions - - def register_local(self, var_name: str, comment: str = "") -> str: - local_name = ( - f"local_{self.current_function.name[9:]}_{var_name}_{len(self.localvars)}" - ) - local_name = var_name - local_node = cil.LocalNode(local_name).set_comment(comment) - self.localvars.append(local_node) - return local_name - - def define_internal_local(self, comment: str = "") -> str: - return self.register_local(f"internal_{len(self.localvars)}", comment) - - def register_instruction( - self, instruction: cil.InstructionNode - ) -> cil.InstructionNode: - self.instructions.append(instruction) - return instruction - - def to_function_name(self, method_name: str, type_name: str) -> str: - return f"function_{method_name}_at_{type_name}" - - def register_function(self, function_name: str) -> cil.FunctionNode: - function_node = cil.FunctionNode(function_name, [], [], []) - self.dotcode.append(function_node) - return function_node - - def register_type(self, name: str) -> cil.TypeNode: - type_node = cil.TypeNode(name) - self.dottypes.append(type_node) - return type_node - - def register_data(self, value: Any) -> cil.DataNode: - data_name = f"data_{len(self.dotdata)}" - data_node = cil.DataNode(data_name, value) - self.dotdata.append(data_node) - return data_node - - def register_comment(self, comment: str) -> cil.CommentNode: - self.register_instruction(cil.CommentNode(comment)) - - def register_empty_instruction(self): - self.register_instruction(cil.EmptyInstruction()) diff --git a/src/cool/code_generation/cil.py b/src/cool/code_generation/cil.py deleted file mode 100644 index c63b31002..000000000 --- a/src/cool/code_generation/cil.py +++ /dev/null @@ -1,505 +0,0 @@ -from typing import Any, List, Tuple -import cool.visitor as visitor - - -class Node: - comment: str = "" - - def set_comment(self, comment: str) -> "Node": - self.comment = comment - return self - - -class ProgramNode(Node): - def __init__( - self, - dottypes: List["TypeNode"], - dotdata: List["DataNode"], - dotcode: List["FunctionNode"], - ): - self.dottypes: List[TypeNode] = dottypes - self.dotdata: List[DataNode] = dotdata - self.dotcode: List[FunctionNode] = dotcode - - -class TypeNode(Node): - def __init__(self, name: str): - self.name: str = name - self.attributes: List[str] = [] - self.methods: List[Tuple[str, str]] = [] - - -class DataNode(Node): - def __init__(self, name: str, value: Any): - self.name: str = name - self.value: Any = value - - -class FunctionNode(Node): - def __init__( - self, - name: str, - params: List["ParamNode"], - local_vars: List["LoadNode"], - instructions: List["InstructionNode"], - ): - self.name: str = name - self.params: List[ParamNode] = params - self.local_vars: List[LocalNode] = local_vars - self.instructions: List[InstructionNode] = instructions - - -class ParamNode(Node): - def __init__(self, name: str): - self.name: str = name - - -class LocalNode(Node): - def __init__(self, name: str): - self.name: str = name - - -class InstructionNode(Node): - pass - - -class AssignNode(InstructionNode): - def __init__(self, dest: str, source: str): - self.dest: str = dest - self.source: str = source - - -class ArithmeticNode(InstructionNode): - def __init__(self, dest: str, left: str, right: str): - self.dest: str = dest - self.left: str = left - self.right: str = right - - -class PlusNode(ArithmeticNode): - pass - - -class MinusNode(ArithmeticNode): - pass - - -class StarNode(ArithmeticNode): - pass - - -class DivNode(ArithmeticNode): - pass - - -class LessEqualNode(ArithmeticNode): - pass - - -class LessThanNode(ArithmeticNode): - pass - - -class EqualNode(ArithmeticNode): - pass - - -class XorNode(ArithmeticNode): - pass - - -class GetAttribNode(InstructionNode): - def __init__(self, dest: str, instance: str, attr: str) -> None: - self.dest: str = dest - self.instance: str = instance - self.attr: str = attr - - -class SetAttribNode(InstructionNode): - def __init__(self, instance: str, attr: str, source: str) -> None: - self.instance: str = instance - self.attr: str = attr - self.source: str = source - - -class GetIndexNode(InstructionNode): - def __init__(self, dest: str, instance: str, index: str) -> None: - self.dest: str = dest - self.instance: str = instance - self.index: str = index - - -class SetIndexNode(InstructionNode): - def __init__(self, instance: str, index: int, source: str) -> None: - self.instance: str = instance - self.index: int = index - self.source: str = source - - -class AllocateNode(InstructionNode): - def __init__(self, itype: str, dest: str): - self.type: str = itype - self.dest: str = dest - - -class ArrayNode(InstructionNode): - def __init__(self, dest: str, size: int) -> None: - self.dest: str = dest - self.size: int = size - - -class TypeOfNode(InstructionNode): - def __init__(self, dest: str, obj: str, ): - self.obj: str = obj - self.dest: str = dest - - -class AncestorNode(InstructionNode): - def __init__(self, dest: str, obj: str): - self.obj: str = obj - self.dest: str = dest - - -class TypeDirectionNode(InstructionNode): - def __init__(self, dest: str, name: str): - self.name: str = name - self.dest: str = dest - -class LabelNode(InstructionNode): - def __init__(self, label: str): - self.label: str = label - - -class GotoNode(InstructionNode): - def __init__(self, address: str): - self.address: str = address - - -class GotoIfNode(InstructionNode): - def __init__(self, condition: str, address: str): - self.condition: str = condition - self.address: str = address - - -class StaticCallNode(InstructionNode): - def __init__(self, function, dest): - self.function = function - self.dest = dest - - -class DynamicCallNode(InstructionNode): - def __init__(self, xtype: str, method: str, dest: str): - self.type = xtype - self.method = method - self.dest = dest - - -class ArgNode(InstructionNode): - def __init__(self, name: str): - self.name: str = name - - -class ReturnNode(InstructionNode): - def __init__(self, value=None): - self.value = value - - -class LoadNode(InstructionNode): - def __init__(self, dest, msg): - self.dest = dest - self.msg = msg - - -class LengthNode(InstructionNode): - pass - - -class ConcatNode(InstructionNode): - pass - - -class PrefixNode(InstructionNode): - pass - - -class SubstringNode(InstructionNode): - pass - - -class ToStrNode(InstructionNode): - def __init__(self, dest, ivalue): - self.dest = dest - self.ivalue = ivalue - - -class ReadNode(InstructionNode): - def __init__(self, dest): - self.dest = dest - - -class PrintNode(InstructionNode): - def __init__(self, str_addr): - self.str_addr = str_addr - - -class CommentNode(InstructionNode): - def __init__(self, comment): - self.comment = comment - - -class EmptyInstruction(InstructionNode): - def __init__(self): - pass - - -class CILFormatter: - @visitor.on("node") - def visit(self, node): - pass - - @visitor.when(ProgramNode) - def visit(self, node): - 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): - attributes = "\n\t".join(f"attribute {x}" for x 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): - params = "\n\t".join(self.visit(x) for x in node.params) - local_vars = "\n\t".join(self.visit(x) for x in node.local_vars) - instructions = "\n\t".join(self.visit(x) for x in node.instructions) - - return f"function {node.name} {{\n\t{params}\n\n\t{local_vars}\n\n\t{instructions}\n}}" - - @visitor.when(ParamNode) - def visit(self, node: ParamNode): - return ( - f"PARAM {node.name}" - if node.comment == "" - else f"PARAM {node.name} # {node.comment}" - ) - - @visitor.when(LocalNode) - def visit(self, node): - return ( - f"LOCAL {node.name}" - if node.comment == "" - else f"LOCAL {node.name} # {node.comment}" - ) - - @visitor.when(AssignNode) - def visit(self, node): - return ( - f"{node.dest} = {node.source}" - if node.comment == "" - else f"{node.dest} = {node.source} # {node.comment}" - ) - - @visitor.when(PlusNode) - def visit(self, node): - return ( - f"{node.dest} = {node.left} + {node.right}" - if node.comment == "" - else f"{node.dest} = {node.left} + {node.right} # {node.comment}" - ) - - @visitor.when(MinusNode) - def visit(self, node): - return ( - f"{node.dest} = {node.left} - {node.right}" - if node.comment == "" - else f"{node.dest} = {node.left} - {node.right} # {node.comment}" - ) - - @visitor.when(StarNode) - def visit(self, node): - return ( - f"{node.dest} = {node.left} * {node.right}" - if node.comment == "" - else f"{node.dest} = {node.left} * {node.right} # {node.comment}" - ) - - @visitor.when(DivNode) - def visit(self, node): - return ( - f"{node.dest} = {node.left} / {node.right}" - if node.comment == "" - else f"{node.dest} = {node.left} / {node.right} # {node.comment}" - ) - - @visitor.when(EqualNode) - def visit(self, node: EqualNode): - return ( - f"{node.dest} = {node.left} == {node.right}" - if node.comment == "" - else f"{node.dest} = {node.left} == {node.right} # {node.comment}" - ) - - @visitor.when(LessThanNode) - def visit(self, node: LessThanNode): - return ( - f"{node.dest} = {node.left} < {node.right}" - if node.comment == "" - else f"{node.dest} = {node.left} < {node.right} # {node.comment}" - ) - - @visitor.when(LessEqualNode) - def visit(self, node: LessEqualNode): - return ( - f"{node.dest} = {node.left} <= {node.right}" - if node.comment == "" - else f"{node.dest} = {node.left} <= {node.right} # {node.comment}" - ) - - @visitor.when(XorNode) - def visit(self, node: XorNode): - return ( - f"{node.dest} = XOR {node.left} {node.right}" - if node.comment == "" - else f"{node.dest} = XOR {node.left} {node.right} # {node.comment}" - ) - - @visitor.when(AllocateNode) - def visit(self, node): - return ( - f"{node.dest} = ALLOCATE {node.type}" - if node.comment == "" - else f"{node.dest} = ALLOCATE {node.type} # {node.comment}" - ) - - @visitor.when(TypeOfNode) - def visit(self, node): - return ( - f"{node.dest} = TYPEOF {node.obj}" - if node.comment == "" - else f"{node.dest} = TYPEOF {node.obj} # {node.comment}" - ) - - @visitor.when(TypeDirectionNode) - def visit(self, node: TypeDirectionNode): - return ( - f"{node.dest} = TYPEDIR {node.name}" - if node.comment == "" - else f"{node.dest} = TYPEDIR {node.name} # {node.comment}" - ) - - @visitor.when(AncestorNode) - def visit(self, node): - return ( - f"{node.dest} = ANCESTOR {node.obj}" - if node.comment == "" - else f"{node.dest} = ANCESTOR {node.obj} # {node.comment}" - ) - - @visitor.when(StaticCallNode) - def visit(self, node): - return ( - f"{node.dest} = CALL {node.function}" - if node.comment == "" - else f"{node.dest} = CALL {node.function} # {node.comment}" - ) - - @visitor.when(DynamicCallNode) - def visit(self, node): - return ( - f"{node.dest} = VCALL {node.type} {node.method}" - if node.comment == "" - else f"{node.dest} = VCALL {node.type} {node.method} # {node.comment}" - ) - - @visitor.when(GetAttribNode) - def visit(self, node: GetAttribNode): - return ( - f"{node.dest} = GETATTR {node.instance} {node.attr}" - if node.comment == "" - else f"{node.dest} = GETATTR {node.instance} {node.attr} # {node.comment}" - ) - - @visitor.when(SetAttribNode) - def visit(self, node: SetAttribNode): - return ( - f"SETATTR {node.instance} {node.attr} {node.source}" - if node.comment == "" - else f"SETATTR {node.instance} {node.attr} {node.source} # {node.comment}" - ) - - @visitor.when(ArgNode) - def visit(self, node): - return ( - f"ARG {node.name}" - if node.comment == "" - else f"ARG {node.name} # {node.comment}" - ) - - @visitor.when(ReturnNode) - def visit(self, node): - return ( - f"\n\tRETURN {node.value if node.value is not None else 0}" - if node.comment == "" - else f"\n\tRETURN {node.value if node.value is not None else 0} # {node.comment}" - ) - - @visitor.when(GotoNode) - def visit(self, node: GotoNode): - return ( - f"GOTO {node.address}" - if node.comment == "" - else f"GOTO {node.address} # {node.comment}" - ) - - @visitor.when(GotoIfNode) - def visit(self, node: GotoNode): - return ( - f"IF {node.condition} GOTO {node.address}" - if node.comment == "" - else f"IF {node.condition} GOTO {node.address} # {node.comment}" - ) - - @visitor.when(LabelNode) - def visit(self, node): - return ( - f"{node.label}:" - if node.comment == "" - else f"{node.label}: # {node.comment}" - ) - - @visitor.when(ArrayNode) - def visit(self, node: ArrayNode): - return ( - f"{node.dest} = ARRAY {node.size}" - if node.comment == "" - else f"{node.dest} = ARRAY {node.size} # {node.comment}" - ) - - @visitor.when(GetIndexNode) - def visit(self, node: GetIndexNode): - return ( - f"{node.dest} = GETINDEX {node.instance} {node.index}" - if node.comment == "" - else f"{node.dest} = GETINDEX {node.instance} {node.index} # {node.comment}" - ) - - @visitor.when(SetIndexNode) - def visit(self, node: SetIndexNode): - return ( - f"SETINDEX {node.instance} {node.index} {node.source}" - if node.comment == "" - else f"SETINDEX {node.instance} {node.index} {node.source} # {node.comment}" - ) - - @visitor.when(CommentNode) - def visit(self, node): - return f"# {node.comment}" - - @visitor.when(EmptyInstruction) - def visit(self, node: EmptyInstruction): - return "" if node.comment == "" else f"# {node.comment}" diff --git a/src/cool/code_generation/formatters.py b/src/cool/code_generation/formatters.py new file mode 100644 index 000000000..683fe2187 --- /dev/null +++ b/src/cool/code_generation/formatters.py @@ -0,0 +1,386 @@ +import cool.code_generation.ast_cil as cil +import cool.code_generation.ast_mips as mips +import cool.visitor as visitor + + +class CilFormatter: + @visitor.on("node") + def visit(self, node): + pass + + @visitor.when(cil.ProgramNode) + def visit(self, node: cil.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(cil.TypeNode) + def visit(self, node: cil.TypeNode): + parent = f"inherits from {node.parent}" + attributes = "\n\t".join(f"attribute {x}" for x in node.attributes) + methods = "\n\t".join(f"method {x}: {y}" for x, y in node.methods) + + r = f"type {node.name} {{\n\t{parent}" + if attributes: + r += f"\n\n\t{attributes}" + if methods: + r += f"\n\n\t{methods}" + r += "\n}" + return r + + @visitor.when(cil.FunctionNode) + def visit(self, node: cil.FunctionNode): + params = "\n\t".join(self.visit(x) for x in node.params) + local_vars = "\n\t".join(self.visit(x) for x in node.local_vars) + instructions = "\n\t".join(self.visit(x) for x in node.instructions) + + s = f"function {node.name}{{\n\t{params}" + if local_vars: + s += f"\n\n\t{local_vars}" + if instructions: + if len(node.instructions) >= 2: + s += f"\n\n\t{instructions}" + else: + s += f"\n\t{instructions}" + s += "\n}" + + return s + + @visitor.when(cil.ParamNode) + def visit(self, node: cil.ParamNode): + return ( + f"PARAM {node.name}" + if node.comment == "" + else f"PARAM {node.name} # {node.comment}" + ) + + @visitor.when(cil.LocalNode) + def visit(self, node: cil.LocalNode): + return ( + f"LOCAL {node.name}" + if node.comment == "" + else f"LOCAL {node.name} # {node.comment}" + ) + + @visitor.when(cil.AssignNode) + def visit(self, node: cil.AssignNode): + return ( + f"{node.dest} = {node.source}" + if node.comment == "" + else f"{node.dest} = {node.source} # {node.comment}" + ) + + @visitor.when(cil.PlusNode) + def visit(self, node: cil.PlusNode): + return ( + f"{node.dest} = {node.left} + {node.right}" + if node.comment == "" + else f"{node.dest} = {node.left} + {node.right} # {node.comment}" + ) + + @visitor.when(cil.MinusNode) + def visit(self, node: cil.MinusNode): + return ( + f"{node.dest} = {node.left} - {node.right}" + if node.comment == "" + else f"{node.dest} = {node.left} - {node.right} # {node.comment}" + ) + + @visitor.when(cil.StarNode) + def visit(self, node: cil.StarNode): + return ( + f"{node.dest} = {node.left} * {node.right}" + if node.comment == "" + else f"{node.dest} = {node.left} * {node.right} # {node.comment}" + ) + + @visitor.when(cil.DivNode) + def visit(self, node: cil.DivNode): + return ( + f"{node.dest} = {node.left} / {node.right}" + if node.comment == "" + else f"{node.dest} = {node.left} / {node.right} # {node.comment}" + ) + + @visitor.when(cil.EqualNode) + def visit(self, node: cil.EqualNode): + return ( + f"{node.dest} = {node.left} == {node.right}" + if node.comment == "" + else f"{node.dest} = {node.left} == {node.right} # {node.comment}" + ) + + @visitor.when(cil.LessThanNode) + def visit(self, node: cil.LessThanNode): + return ( + f"{node.dest} = {node.left} < {node.right}" + if node.comment == "" + else f"{node.dest} = {node.left} < {node.right} # {node.comment}" + ) + + @visitor.when(cil.LessEqualNode) + def visit(self, node: cil.LessEqualNode): + return ( + f"{node.dest} = {node.left} <= {node.right}" + if node.comment == "" + else f"{node.dest} = {node.left} <= {node.right} # {node.comment}" + ) + + @visitor.when(cil.XorNode) + def visit(self, node: cil.XorNode): + return ( + f"{node.dest} = XOR {node.left} {node.right}" + if node.comment == "" + else f"{node.dest} = XOR {node.left} {node.right} # {node.comment}" + ) + + @visitor.when(cil.AllocateNode) + def visit(self, node: cil.AllocateNode): + return ( + f"{node.dest} = ALLOCATE {node.type}" + if node.comment == "" + else f"{node.dest} = ALLOCATE {node.type} # {node.comment}" + ) + + @visitor.when(cil.TypeOfNode) + def visit(self, node: cil.TypeOfNode): + return ( + f"{node.dest} = TYPEOF {node.obj}" + if node.comment == "" + else f"{node.dest} = TYPEOF {node.obj} # {node.comment}" + ) + + @visitor.when(cil.TypeDirectionNode) + def visit(self, node: cil.TypeDirectionNode): + return ( + f"{node.dest} = TYPEDIR {node.name}" + if node.comment == "" + else f"{node.dest} = TYPEDIR {node.name} # {node.comment}" + ) + + @visitor.when(cil.AncestorNode) + def visit(self, node: cil.AncestorNode): + return ( + f"{node.dest} = ANCESTOR {node.obj}" + if node.comment == "" + else f"{node.dest} = ANCESTOR {node.obj} # {node.comment}" + ) + + @visitor.when(cil.StaticCallNode) + def visit(self, node: cil.StaticCallNode): + return ( + f"{node.dest} = CALL {node.function}" + if node.comment == "" + else f"{node.dest} = CALL {node.function} # {node.comment}" + ) + + @visitor.when(cil.DynamicCallNode) + def visit(self, node: cil.DynamicCallNode): + return ( + f"{node.dest} = VCALL {node.type} {node.method}" + if node.comment == "" + else f"{node.dest} = VCALL {node.type} {node.method} # {node.comment}" + ) + + @visitor.when(cil.GetAttribNode) + def visit(self, node: cil.GetAttribNode): + return ( + f"{node.dest} = GETATTR {node.instance} {node.attr}" + if node.comment == "" + else f"{node.dest} = GETATTR {node.instance} {node.attr} # {node.comment}" + ) + + @visitor.when(cil.SetAttribNode) + def visit(self, node: cil.SetAttribNode): + return ( + f"SETATTR {node.instance} {node.attr} {node.source}" + if node.comment == "" + else f"SETATTR {node.instance} {node.attr} {node.source} # {node.comment}" + ) + + @visitor.when(cil.ArgNode) + def visit(self, node: cil.ArgNode): + return ( + f"ARG {node.name}" + if node.comment == "" + else f"ARG {node.name} # {node.comment}" + ) + + @visitor.when(cil.ReturnNode) + def visit(self, node: cil.ReturnNode): + return ( + f"\n\tRETURN {node.value if node.value is not None else 0}" + if node.comment == "" + else f"\n\tRETURN {node.value if node.value is not None else 0} # {node.comment}" + ) + + @visitor.when(cil.GotoNode) + def visit(self, node: cil.GotoNode): + return ( + f"GOTO {node.address}" + if node.comment == "" + else f"GOTO {node.address} # {node.comment}" + ) + + @visitor.when(cil.GotoIfNode) + def visit(self, node: cil.GotoNode): + return ( + f"IF {node.condition} GOTO {node.address}" + if node.comment == "" + else f"IF {node.condition} GOTO {node.address} # {node.comment}" + ) + + @visitor.when(cil.LabelNode) + def visit(self, node: cil.LabelNode): + return ( + f"{node.label}:" + if node.comment == "" + else f"{node.label}: # {node.comment}" + ) + + @visitor.when(cil.ArrayNode) + def visit(self, node: cil.ArrayNode): + return ( + f"{node.dest} = ARRAY {node.size}" + if node.comment == "" + else f"{node.dest} = ARRAY {node.size} # {node.comment}" + ) + + @visitor.when(cil.GetIndexNode) + def visit(self, node: cil.GetIndexNode): + return ( + f"{node.dest} = GETINDEX {node.instance} {node.index}" + if node.comment == "" + else f"{node.dest} = GETINDEX {node.instance} {node.index} # {node.comment}" + ) + + @visitor.when(cil.SetIndexNode) + def visit(self, node: cil.SetIndexNode): + return ( + f"SETINDEX {node.instance} {node.index} {node.source}" + if node.comment == "" + else f"SETINDEX {node.instance} {node.index} {node.source} # {node.comment}" + ) + + @visitor.when(cil.HaltNode) + def visit(self, node: cil.HaltNode): + return "HALT" if node.comment == "" else f"HALT # {node.comment}" + + @visitor.when(cil.TypeNameNode) + def visit(self, node: cil.TypeNameNode): + return ( + f"{node.dest} = TYPENAME {node.source}" + if node.comment == "" + else f"{node.dest} = TYPENAME {node.source} # {node.comment}" + ) + + @visitor.when(cil.CopyNode) + def visit(self, node: cil.CopyNode): + return ( + f"{node.dest} = COPY {node.source}" + if node.comment == "" + else f"{node.dest} = COPY {node.source} # {node.comment}" + ) + + @visitor.when(cil.PrintStringNode) + def visit(self, node: cil.PrintStringNode): + return ( + f"PRINTSTR {node.str_addr}" + if node.comment == "" + else f"PRINTSTR {node.str_addr} # {node.comment}" + ) + + @visitor.when(cil.PrintIntNode) + def visit(self, node: cil.PrintIntNode): + return ( + f"PRINTINT {node.value}" + if node.comment == "" + else f"PRININT {node.value} # {node.comment}" + ) + + @visitor.when(cil.ReadStringNode) + def visit(self, node: cil.ReadStringNode): + return ( + f"READSTR {node.dest}" + if node.comment == "" + else f"PRININT {node.dest} # {node.comment}" + ) + + @visitor.when(cil.ReadIntNode) + def visit(self, node: cil.ReadIntNode): + return ( + f"READINT {node.dest}" + if node.comment == "" + else f"READINT {node.dest} # {node.comment}" + ) + + @visitor.when(cil.LengthNode) + def visit(self, node: cil.LengthNode): + return ( + f"{node.dest} = LENGTH {node.str_address}" + if node.comment == "" + else f"{node.dest} = LENGTH {node.str_address} # {node.comment}" + ) + + @visitor.when(cil.ConcatNode) + def visit(self, node: cil.ConcatNode): + return ( + f"{node.dest} = CONCAT {node.str1} {node.str2}" + if node.comment == "" + else f"{node.dest} = CONCAT {node.str1} {node.str2} # {node.comment}" + ) + + @visitor.when(cil.SubstringNode) + def visit(self, node: cil.SubstringNode): + return ( + f"{node.dest} = SUBSTRING {node.str_address} {node.start} {node.length}" + if node.comment == "" + else f"{node.dest} = SUBSTRING {node.str_address} {node.start} {node.length} # {node.comment}" + ) + + @visitor.when(cil.CommentNode) + def visit(self, node: cil.CommentNode): + return f"# {node.comment}" + + @visitor.when(cil.EmptyInstruction) + def visit(self, node: cil.EmptyInstruction): + return "" if node.comment == "" else f"# {node.comment}" + + +class MipsFormatter: + @visitor.on("node") + def visit(self, node): + pass + + @visitor.when(mips.ProgramNode) + def visit(self, node: mips.ProgramNode): + dotdata = "\n\t".join([self.visit(data) for data in node.dotdata]) + dottext = "\n\t".join([self.visit(data) for data in node.dottext]) + + return f".data\n\t{dotdata}\n\n.text\n\t{dottext}" + + @visitor.when(mips.DataNode) + def visit(self, node: mips.DataNode): + return f"{node.name}: {node.data_type} {node.value}" + + @visitor.when(mips.OneAddressInstructionNode) + def visit(self, node: mips.OneAddressInstructionNode): + return f"{node.code} {node.dest}" + + @visitor.when(mips.TwoAddressIntructionNode) + def visit(self, node: mips.TwoAddressIntructionNode): + return f"{node.code} {node.dest} {node.source}" + + @visitor.when(mips.ThreeAddressIntructionNode) + def visit(self, node: mips.ThreeAddressIntructionNode): + return f"{node.code} {node.dest}, {node.source1}, {node.source2}" + + @visitor.when(mips.LabelNode) + def visit(self, node: mips.LabelNode): + return f"{node.name}:" + + @visitor.when(mips.EmptyDataNode) + def visit(self, node: mips.EmptyDataNode): + return "" diff --git a/src/cool/code_generation/mips.py b/src/cool/code_generation/mips.py deleted file mode 100644 index 3d441c089..000000000 --- a/src/cool/code_generation/mips.py +++ /dev/null @@ -1,21 +0,0 @@ -from ast import List - - -class Node: - pass - - -class ProgramNode(Node): - def __init__(self, dotdata: List["DataNode"], dottext: List["InstructionNode"]): - self.dotdata = dotdata - self.dottext = dottext - - -class DataNode(Node): - def __init__(self): - pass - - -class InstructionNode(Node): - def __init__(self): - pass diff --git a/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/ast-checkpoint.py b/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/ast-checkpoint.py deleted file mode 100644 index 14f4c1c4d..000000000 --- a/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/ast-checkpoint.py +++ /dev/null @@ -1,29 +0,0 @@ -import cmp.visitor as visitor - - -def get_printer(ConstantNumberNode, BinaryNode): - class PrintVisitor(object): - @visitor.on("node") - def visit(self, node, tabs): - pass - - @visitor.when(BinaryNode) - def visit(self, node, tabs=0): - ans = ( - "\t" * tabs - + "\\__" - + " " - + node.__class__.__name__ - + " \n" - + self.visit(node.left, tabs + 1) - + "\n" - + self.visit(node.right, tabs + 1) - ) - return ans - - @visitor.when(ConstantNumberNode) - def visit(self, node, tabs=0): - return "\t" * tabs + "\\__" + "num: " + node.lex - - printer = PrintVisitor() - return lambda ast: printer.visit(ast) diff --git a/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/automata-checkpoint.py b/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/automata-checkpoint.py deleted file mode 100644 index c343d5ca3..000000000 --- a/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/automata-checkpoint.py +++ /dev/null @@ -1,167 +0,0 @@ -try: - import pydot -except: - pass - - -class State: - def __init__(self, state, final=False): - self.state = state - self.final = final - self.transitions = {} - self.epsilon_transitions = set() - self.tag = None - - def has_transition(self, symbol): - return symbol in self.transitions - - def add_transition(self, symbol, state): - try: - self.transitions[symbol].append(state) - except: - self.transitions[symbol] = [state] - return self - - def add_epsilon_transition(self, state): - self.epsilon_transitions.add(state) - return self - - def recognize(self, string): - states = self.epsilon_closure - for symbol in string: - states = self.move_by_state(symbol, *states) - states = self.epsilon_closure_by_state(*states) - return any(s.final for s in states) - - def to_deterministic(self): - closure = self.epsilon_closure - start = State(tuple(closure), any(s.final for s in closure)) - - closures = [closure] - states = [start] - pending = [start] - - while pending: - state = pending.pop() - symbols = {symbol for s in state.state for symbol in s.transitions} - - for symbol in symbols: - move = self.move_by_state(symbol, *state.state) - closure = self.epsilon_closure_by_state(*move) - - if closure not in closures: - new_state = State(tuple(closure), any(s.final for s in closure)) - closures.append(closure) - states.append(new_state) - pending.append(new_state) - else: - index = closures.index(closure) - new_state = states[index] - - state.add_transition(symbol, new_state) - - return start - - @staticmethod - def from_nfa(nfa, get_states=False): - states = [] - for n in range(nfa.states): - state = State(n, n in nfa.finals) - states.append(state) - - for (origin, symbol), destinations in nfa.map.items(): - origin = states[origin] - origin[symbol] = [states[d] for d in destinations] - - if get_states: - return states[nfa.start], states - return states[nfa.start] - - @staticmethod - def move_by_state(symbol, *states): - return { - s for state in states if state.has_transition(symbol) for s in state[symbol] - } - - @staticmethod - def epsilon_closure_by_state(*states): - closure = {state for state in states} - - l = 0 - while l != len(closure): - l = len(closure) - tmp = [s for s in closure] - for s in tmp: - for epsilon_state in s.epsilon_transitions: - closure.add(epsilon_state) - return closure - - @property - def epsilon_closure(self): - return self.epsilon_closure_by_state(self) - - @property - def name(self): - return str(self.state) - - def __getitem__(self, symbol): - if symbol == "": - return self.epsilon_transitions - try: - return self.transitions[symbol] - except KeyError: - return None - - def __setitem__(self, symbol, value): - if symbol == "": - self.epsilon_transitions = value - else: - self.transitions[symbol] = value - - def __repr__(self): - return str(self) - - def __str__(self): - return str(self.state) - - def __hash__(self): - return hash(self.state) - - def graph(self): - G = pydot.Dot(rankdir="LR", margin=0.1) - G.add_node(pydot.Node("start", shape="plaintext", label="", width=0, height=0)) - - visited = set() - - def visit(start): - ids = id(start) - if ids not in visited: - visited.add(ids) - G.add_node( - pydot.Node( - ids, - label=start.name, - shape="circle", - style="bold" if start.final else "", - ) - ) - for tran, destinations in start.transitions.items(): - for end in destinations: - visit(end) - G.add_edge( - pydot.Edge(ids, id(end), label=tran, labeldistance=2) - ) - for end in start.epsilon_transitions: - visit(end) - G.add_edge(pydot.Edge(ids, id(end), label="ε", labeldistance=2)) - - visit(self) - G.add_edge(pydot.Edge("start", id(self), label="", style="dashed")) - - return G - - def _repr_svg_(self): - try: - return self.graph().create_svg().decode("utf8") - except: - pass diff --git a/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/languages-checkpoint.py b/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/languages-checkpoint.py deleted file mode 100644 index 779e72916..000000000 --- a/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/languages-checkpoint.py +++ /dev/null @@ -1,364 +0,0 @@ -from cmp.pycompiler import Sentence, Production -from cmp.utils import ContainerSet, Token, UnknownToken -from cmp.tools import build_parsing_table, metodo_predictivo_no_recursivo - - -class BasicXCool: - def __init__(self, G): - self.G = G - self.fixed_tokens = {lex: Token(lex, G[lex]) for lex in "+ - * / ( )".split()} - - @property - def firsts(self): - G = self.G - return { - G["+"]: ContainerSet(G["+"], contains_epsilon=False), - G["-"]: ContainerSet(G["-"], contains_epsilon=False), - G["*"]: ContainerSet(G["*"], contains_epsilon=False), - G["/"]: ContainerSet(G["/"], contains_epsilon=False), - G["("]: ContainerSet(G["("], contains_epsilon=False), - G[")"]: ContainerSet(G[")"], contains_epsilon=False), - G["num"]: ContainerSet(G["num"], contains_epsilon=False), - G["E"]: ContainerSet(G["num"], G["("], contains_epsilon=False), - G["T"]: ContainerSet(G["num"], G["("], contains_epsilon=False), - G["F"]: ContainerSet(G["num"], G["("], contains_epsilon=False), - G["X"]: ContainerSet(G["-"], G["+"], contains_epsilon=True), - G["Y"]: ContainerSet(G["/"], G["*"], contains_epsilon=True), - Sentence(G["T"], G["X"]): ContainerSet( - G["num"], G["("], contains_epsilon=False - ), - Sentence(G["+"], G["T"], G["X"]): ContainerSet( - G["+"], contains_epsilon=False - ), - Sentence(G["-"], G["T"], G["X"]): ContainerSet( - G["-"], contains_epsilon=False - ), - G.Epsilon: ContainerSet(contains_epsilon=True), - Sentence(G["F"], G["Y"]): ContainerSet( - G["num"], G["("], contains_epsilon=False - ), - Sentence(G["*"], G["F"], G["Y"]): ContainerSet( - G["*"], contains_epsilon=False - ), - Sentence(G["/"], G["F"], G["Y"]): ContainerSet( - G["/"], contains_epsilon=False - ), - Sentence(G["num"]): ContainerSet(G["num"], contains_epsilon=False), - Sentence(G["("], G["E"], G[")"]): ContainerSet( - G["("], contains_epsilon=False - ), - } - - @property - def follows(self): - G = self.G - return { - G["E"]: ContainerSet(G[")"], G.EOF, contains_epsilon=False), - G["T"]: ContainerSet(G[")"], G["-"], G.EOF, G["+"], contains_epsilon=False), - G["F"]: ContainerSet( - G["-"], G.EOF, G["*"], G["/"], G[")"], G["+"], contains_epsilon=False - ), - G["X"]: ContainerSet(G[")"], G.EOF, contains_epsilon=False), - G["Y"]: ContainerSet(G[")"], G["-"], G.EOF, G["+"], contains_epsilon=False), - } - - @property - def table(self): - G = self.G - return { - (G["E"], G["num"],): [ - Production(G["E"], Sentence(G["T"], G["X"])), - ], - (G["E"], G["("],): [ - Production(G["E"], Sentence(G["T"], G["X"])), - ], - (G["X"], G["+"],): [ - Production(G["X"], Sentence(G["+"], G["T"], G["X"])), - ], - (G["X"], G["-"],): [ - Production(G["X"], Sentence(G["-"], G["T"], G["X"])), - ], - (G["X"], G[")"],): [ - Production(G["X"], G.Epsilon), - ], - (G["X"], G.EOF,): [ - Production(G["X"], G.Epsilon), - ], - (G["T"], G["num"],): [ - Production(G["T"], Sentence(G["F"], G["Y"])), - ], - (G["T"], G["("],): [ - Production(G["T"], Sentence(G["F"], G["Y"])), - ], - (G["Y"], G["*"],): [ - Production(G["Y"], Sentence(G["*"], G["F"], G["Y"])), - ], - (G["Y"], G["/"],): [ - Production(G["Y"], Sentence(G["/"], G["F"], G["Y"])), - ], - (G["Y"], G[")"],): [ - Production(G["Y"], G.Epsilon), - ], - (G["Y"], G["-"],): [ - Production(G["Y"], G.Epsilon), - ], - (G["Y"], G.EOF,): [ - Production(G["Y"], G.Epsilon), - ], - (G["Y"], G["+"],): [ - Production(G["Y"], G.Epsilon), - ], - (G["F"], G["num"],): [ - Production(G["F"], Sentence(G["num"])), - ], - (G["F"], G["("],): [ - Production(G["F"], Sentence(G["("], G["E"], G[")"])), - ], - } - - @property - def tokenizer(self): - G = self.G - fixed_tokens = self.fixed_tokens - - def tokenize_text(text): - tokens = [] - for item in text.split(): - try: - float(item) - token = Token(item, G["num"]) - except ValueError: - try: - token = fixed_tokens[item] - except: - token = UnknownToken(item) - tokens.append(token) - eof = Token("$", G.EOF) - tokens.append(eof) - return tokens - - return tokenize_text - - -class PowXCool: - def __init__(self, G): - self.G = G - - @property - def firsts(self): - G = self.G - return { - G["+"]: ContainerSet(G["+"], contains_epsilon=False), - G["-"]: ContainerSet(G["-"], contains_epsilon=False), - G["*"]: ContainerSet(G["*"], contains_epsilon=False), - G["/"]: ContainerSet(G["/"], contains_epsilon=False), - G["^"]: ContainerSet(G["^"], contains_epsilon=False), - G["("]: ContainerSet(G["("], contains_epsilon=False), - G[")"]: ContainerSet(G[")"], contains_epsilon=False), - G["num"]: ContainerSet(G["num"], contains_epsilon=False), - G["E"]: ContainerSet(G["num"], G["("], contains_epsilon=False), - G["T"]: ContainerSet(G["num"], G["("], contains_epsilon=False), - G["F"]: ContainerSet(G["num"], G["("], contains_epsilon=False), - G["A"]: ContainerSet(G["num"], G["("], contains_epsilon=False), - G["X"]: ContainerSet(G["-"], G["+"], contains_epsilon=True), - G["Y"]: ContainerSet(G["/"], G["*"], contains_epsilon=True), - G["Z"]: ContainerSet(G["^"], contains_epsilon=True), - Sentence(G["T"], G["X"]): ContainerSet( - G["num"], G["("], contains_epsilon=False - ), - Sentence(G["+"], G["T"], G["X"]): ContainerSet( - G["+"], contains_epsilon=False - ), - Sentence(G["-"], G["T"], G["X"]): ContainerSet( - G["-"], contains_epsilon=False - ), - G.Epsilon: ContainerSet(contains_epsilon=True), - Sentence(G["F"], G["Y"]): ContainerSet( - G["num"], G["("], contains_epsilon=False - ), - Sentence(G["*"], G["F"], G["Y"]): ContainerSet( - G["*"], contains_epsilon=False - ), - Sentence(G["/"], G["F"], G["Y"]): ContainerSet( - G["/"], contains_epsilon=False - ), - Sentence(G["A"], G["Z"]): ContainerSet( - G["num"], G["("], contains_epsilon=False - ), - Sentence(G["^"], G["F"]): ContainerSet(G["^"], contains_epsilon=False), - Sentence(G["num"]): ContainerSet(G["num"], contains_epsilon=False), - Sentence(G["("], G["E"], G[")"]): ContainerSet( - G["("], contains_epsilon=False - ), - } - - @property - def follows(self): - G = self.G - return { - G["E"]: ContainerSet(G[")"], G.EOF, contains_epsilon=False), - G["T"]: ContainerSet(G["-"], G[")"], G.EOF, G["+"], contains_epsilon=False), - G["F"]: ContainerSet( - G["-"], G["*"], G["/"], G[")"], G.EOF, G["+"], contains_epsilon=False - ), - G["A"]: ContainerSet( - G["-"], - G["*"], - G["/"], - G["^"], - G[")"], - G.EOF, - G["+"], - contains_epsilon=False, - ), - G["X"]: ContainerSet(G[")"], G.EOF, contains_epsilon=False), - G["Y"]: ContainerSet(G["-"], G[")"], G.EOF, G["+"], contains_epsilon=False), - G["Z"]: ContainerSet( - G["-"], G["*"], G["/"], G[")"], G.EOF, G["+"], contains_epsilon=False - ), - } - - -class Regex: - def __init__(self, G): - self.G = G - - @property - def firsts(self): - G = self.G - return { - G["|"]: ContainerSet(G["|"], contains_epsilon=False), - G["*"]: ContainerSet(G["*"], contains_epsilon=False), - G["("]: ContainerSet(G["("], contains_epsilon=False), - G[")"]: ContainerSet(G[")"], contains_epsilon=False), - G["symbol"]: ContainerSet(G["symbol"], contains_epsilon=False), - G["E"]: ContainerSet(G["symbol"], G["("], contains_epsilon=False), - G["T"]: ContainerSet(G["symbol"], G["("], contains_epsilon=False), - G["F"]: ContainerSet(G["symbol"], G["("], contains_epsilon=False), - G["A"]: ContainerSet(G["symbol"], G["("], contains_epsilon=False), - G["X"]: ContainerSet(G["|"], contains_epsilon=True), - G["Y"]: ContainerSet(G["symbol"], G["("], contains_epsilon=True), - G["Z"]: ContainerSet(G["*"], contains_epsilon=True), - Sentence(G["T"], G["X"]): ContainerSet( - G["symbol"], G["("], contains_epsilon=False - ), - Sentence(G["|"], G["E"]): ContainerSet(G["|"], contains_epsilon=False), - G.Epsilon: ContainerSet(contains_epsilon=True), - Sentence(G["F"], G["Y"]): ContainerSet( - G["symbol"], G["("], contains_epsilon=False - ), - Sentence(G["T"]): ContainerSet(G["symbol"], G["("], contains_epsilon=False), - Sentence(G["A"], G["Z"]): ContainerSet( - G["symbol"], G["("], contains_epsilon=False - ), - Sentence(G["*"]): ContainerSet(G["*"], contains_epsilon=False), - Sentence(G["symbol"]): ContainerSet(G["symbol"], contains_epsilon=False), - Sentence(G["("], G["E"], G[")"]): ContainerSet( - G["("], contains_epsilon=False - ), - } - - @property - def follows(self): - G = self.G - return { - G["E"]: ContainerSet(G[")"], G.EOF, contains_epsilon=False), - G["T"]: ContainerSet(G["|"], G[")"], G.EOF, contains_epsilon=False), - G["F"]: ContainerSet( - G["symbol"], G["|"], G["("], G[")"], G.EOF, contains_epsilon=False - ), - G["A"]: ContainerSet( - G["symbol"], - G.EOF, - G["|"], - G["*"], - G["("], - G[")"], - contains_epsilon=False, - ), - G["X"]: ContainerSet(G[")"], G.EOF, contains_epsilon=False), - G["Y"]: ContainerSet(G["|"], G[")"], G.EOF, contains_epsilon=False), - G["Z"]: ContainerSet( - G["symbol"], G.EOF, G["|"], G["("], G[")"], contains_epsilon=False - ), - } - - @property - def table(self): - G = self.G - return { - (G["E"], G["symbol"],): [ - Production(G["E"], Sentence(G["T"], G["X"])), - ], - (G["E"], G["("],): [ - Production(G["E"], Sentence(G["T"], G["X"])), - ], - (G["X"], G["|"],): [ - Production(G["X"], Sentence(G["|"], G["E"])), - ], - (G["X"], G[")"],): [ - Production(G["X"], G.Epsilon), - ], - (G["X"], G.EOF,): [ - Production(G["X"], G.Epsilon), - ], - (G["T"], G["symbol"],): [ - Production(G["T"], Sentence(G["F"], G["Y"])), - ], - (G["T"], G["("],): [ - Production(G["T"], Sentence(G["F"], G["Y"])), - ], - (G["Y"], G["symbol"],): [ - Production(G["Y"], Sentence(G["T"])), - ], - (G["Y"], G["("],): [ - Production(G["Y"], Sentence(G["T"])), - ], - (G["Y"], G["|"],): [ - Production(G["Y"], G.Epsilon), - ], - (G["Y"], G[")"],): [ - Production(G["Y"], G.Epsilon), - ], - (G["Y"], G.EOF,): [ - Production(G["Y"], G.Epsilon), - ], - (G["F"], G["symbol"],): [ - Production(G["F"], Sentence(G["A"], G["Z"])), - ], - (G["F"], G["("],): [ - Production(G["F"], Sentence(G["A"], G["Z"])), - ], - (G["Z"], G["*"],): [ - Production(G["Z"], Sentence(G["*"])), - ], - (G["Z"], G["symbol"],): [ - Production(G["Z"], G.Epsilon), - ], - (G["Z"], G.EOF,): [ - Production(G["Z"], G.Epsilon), - ], - (G["Z"], G["|"],): [ - Production(G["Z"], G.Epsilon), - ], - (G["Z"], G["("],): [ - Production(G["Z"], G.Epsilon), - ], - (G["Z"], G[")"],): [ - Production(G["Z"], G.Epsilon), - ], - (G["A"], G["symbol"],): [ - Production(G["A"], Sentence(G["symbol"])), - ], - (G["A"], G["("],): [ - Production(G["A"], Sentence(G["("], G["E"], G[")"])), - ], - } - - @property - def parser(self): - firsts = self.firsts - follows = self.follows - M = build_parsing_table(self.G, firsts, follows) - parser = metodo_predictivo_no_recursivo(self.G, M) - return parser diff --git a/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/nbpackage-checkpoint.py b/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/nbpackage-checkpoint.py deleted file mode 100644 index e95c88ff8..000000000 --- a/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/nbpackage-checkpoint.py +++ /dev/null @@ -1,94 +0,0 @@ -import io, os, sys, types - -from IPython import get_ipython -from nbformat import read -from IPython.core.interactiveshell import InteractiveShell - - -def find_notebook(fullname, path=None): - """find a notebook, given its fully qualified name and an optional path - - This turns "foo.bar" into "foo/bar.ipynb" - and tries turning "Foo_Bar" into "Foo Bar" if Foo_Bar - does not exist. - """ - name = fullname.rsplit(".", 1)[-1] - if not path: - path = [""] - for d in path: - nb_path = os.path.join(d, name + ".ipynb") - if os.path.isfile(nb_path): - return nb_path - # let import Notebook_Name find "Notebook Name.ipynb" - nb_path = nb_path.replace("_", " ") - if os.path.isfile(nb_path): - return nb_path - - -class NotebookLoader(object): - """Module Loader for Jupyter Notebooks""" - - def __init__(self, path=None): - self.shell = InteractiveShell.instance() - self.path = path - - def load_module(self, fullname): - """import a notebook as a module""" - path = find_notebook(fullname, self.path) - - print("importing Jupyter notebook from %s" % path) - - # load the notebook object - with io.open(path, "r", encoding="utf-8") as f: - nb = read(f, 4) - - # create the module and add it to sys.modules - # if name in sys.modules: - # return sys.modules[name] - mod = types.ModuleType(fullname) - mod.__file__ = path - mod.__loader__ = self - mod.__dict__["get_ipython"] = get_ipython - sys.modules[fullname] = mod - - # extra work to ensure that magics that would affect the user_ns - # actually affect the notebook module's ns - save_user_ns = self.shell.user_ns - self.shell.user_ns = mod.__dict__ - - try: - for cell in nb.cells: - if cell.cell_type == "code": - # transform the input to executable Python - code = self.shell.input_transformer_manager.transform_cell( - cell.source - ) - # run the code in themodule - exec(code, mod.__dict__) - finally: - self.shell.user_ns = save_user_ns - return mod - - -class NotebookFinder(object): - """Module finder that locates Jupyter Notebooks""" - - def __init__(self): - self.loaders = {} - - def find_module(self, fullname, path=None): - nb_path = find_notebook(fullname, path) - if not nb_path: - return - - key = path - if path: - # lists aren't hashable - key = os.path.sep.join(path) - - if key not in self.loaders: - self.loaders[key] = NotebookLoader(path) - return self.loaders[key] - - -sys.meta_path.append(NotebookFinder()) diff --git a/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/pycompiler-checkpoint.py b/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/pycompiler-checkpoint.py deleted file mode 100644 index 5d3e2d479..000000000 --- a/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/pycompiler-checkpoint.py +++ /dev/null @@ -1,448 +0,0 @@ -import json - - -class Symbol(object): - def __init__(self, name, grammar): - self.Name = name - self.Grammar = grammar - - def __str__(self): - return self.Name - - def __repr__(self): - return repr(self.Name) - - def __add__(self, other): - if isinstance(other, Symbol): - return Sentence(self, other) - - raise TypeError(other) - - def __or__(self, other): - - if isinstance(other, (Sentence)): - return SentenceList(Sentence(self), other) - - raise TypeError(other) - - @property - def IsEpsilon(self): - return False - - def __len__(self): - return 1 - - -class NonTerminal(Symbol): - def __init__(self, name, grammar): - super().__init__(name, grammar) - self.productions = [] - - def __imod__(self, other): - - if isinstance(other, (Sentence)): - p = Production(self, other) - self.Grammar.Add_Production(p) - return self - - if isinstance(other, tuple): - assert len(other) > 1 - assert ( - len(other) == len(other[0]) + 2 - ), "Debe definirse una, y solo una, regla por cada símbolo de la producción" - # assert len(other) == 2, "Tiene que ser una Tupla de 2 elementos (sentence, attribute)" - - if isinstance(other[0], Symbol) or isinstance(other[0], Sentence): - p = AttributeProduction(self, other[0], other[1:]) - else: - raise Exception("") - - self.Grammar.Add_Production(p) - return self - - if isinstance(other, Symbol): - p = Production(self, Sentence(other)) - self.Grammar.Add_Production(p) - return self - - if isinstance(other, SentenceList): - - for s in other: - p = Production(self, s) - self.Grammar.Add_Production(p) - - return self - - raise TypeError(other) - - @property - def IsTerminal(self): - return False - - @property - def IsNonTerminal(self): - return True - - @property - def IsEpsilon(self): - return False - - -class Terminal(Symbol): - def __init__(self, name, grammar): - super().__init__(name, grammar) - - @property - def IsTerminal(self): - return True - - @property - def IsNonTerminal(self): - return False - - @property - def IsEpsilon(self): - return False - - -class EOF(Terminal): - def __init__(self, Grammar): - super().__init__("$", Grammar) - - -class Sentence(object): - def __init__(self, *args): - self._symbols = tuple(x for x in args if not x.IsEpsilon) - self.hash = hash(self._symbols) - - def __len__(self): - return len(self._symbols) - - def __add__(self, other): - if isinstance(other, Symbol): - return Sentence(*(self._symbols + (other,))) - - if isinstance(other, Sentence): - return Sentence(*(self._symbols + other._symbols)) - - raise TypeError(other) - - def __or__(self, other): - if isinstance(other, Sentence): - return SentenceList(self, other) - - if isinstance(other, Symbol): - return SentenceList(self, Sentence(other)) - - raise TypeError(other) - - def __repr__(self): - return str(self) - - def __str__(self): - return ("%s " * len(self._symbols) % tuple(self._symbols)).strip() - - def __iter__(self): - return iter(self._symbols) - - def __getitem__(self, index): - return self._symbols[index] - - def __eq__(self, other): - return self._symbols == other._symbols - - def __hash__(self): - return self.hash - - @property - def IsEpsilon(self): - return False - - -class SentenceList(object): - def __init__(self, *args): - self._sentences = list(args) - - def Add(self, symbol): - if not symbol and (symbol is None or not symbol.IsEpsilon): - raise ValueError(symbol) - - self._sentences.append(symbol) - - def __iter__(self): - return iter(self._sentences) - - def __or__(self, other): - if isinstance(other, Sentence): - self.Add(other) - return self - - if isinstance(other, Symbol): - return self | Sentence(other) - - -class Epsilon(Terminal, Sentence): - def __init__(self, grammar): - super().__init__("epsilon", grammar) - - def __str__(self): - return "e" - - def __repr__(self): - return "epsilon" - - def __iter__(self): - yield from () - - def __len__(self): - return 0 - - def __add__(self, other): - return other - - def __eq__(self, other): - return isinstance(other, (Epsilon,)) - - def __hash__(self): - return hash("") - - @property - def IsEpsilon(self): - return True - - -class Production(object): - def __init__(self, nonTerminal, sentence): - - self.Left = nonTerminal - self.Right = sentence - - def __str__(self): - - return "%s := %s" % (self.Left, self.Right) - - def __repr__(self): - return "%s -> %s" % (self.Left, self.Right) - - def __iter__(self): - yield self.Left - yield self.Right - - def __eq__(self, other): - return ( - isinstance(other, Production) - and self.Left == other.Left - and self.Right == other.Right - ) - - @property - def IsEpsilon(self): - return self.Right.IsEpsilon - - -class AttributeProduction(Production): - def __init__(self, nonTerminal, sentence, attributes): - if not isinstance(sentence, Sentence) and isinstance(sentence, Symbol): - sentence = Sentence(sentence) - super(AttributeProduction, self).__init__(nonTerminal, sentence) - - self.attributes = attributes - - def __str__(self): - return "%s := %s" % (self.Left, self.Right) - - def __repr__(self): - return "%s -> %s" % (self.Left, self.Right) - - def __iter__(self): - yield self.Left - yield self.Right - - @property - def IsEpsilon(self): - return self.Right.IsEpsilon - - # sintetizar en ingles??????, pending aggrement - def syntetice(self): - pass - - -class Grammar: - def __init__(self): - - self.Productions = [] - self.nonTerminals = [] - self.terminals = [] - self.startSymbol = None - # production type - self.pType = None - self.Epsilon = Epsilon(self) - self.EOF = EOF(self) - - self.symbDict = {} - - def NonTerminal(self, name, startSymbol=False): - - name = name.strip() - if not name: - raise Exception("Empty name") - - term = NonTerminal(name, self) - - if startSymbol: - - if self.startSymbol is None: - self.startSymbol = term - else: - raise Exception("Cannot define more than one start symbol.") - - self.nonTerminals.append(term) - self.symbDict[name] = term - return term - - def NonTerminals(self, names): - - ans = tuple((self.NonTerminal(x) for x in names.strip().split())) - - return ans - - def Add_Production(self, production): - - if len(self.Productions) == 0: - self.pType = type(production) - - assert type(production) == self.pType, "The Productions most be of only 1 type." - - production.Left.productions.append(production) - self.Productions.append(production) - - def Terminal(self, name): - - name = name.strip() - if not name: - raise Exception("Empty name") - - term = Terminal(name, self) - self.terminals.append(term) - self.symbDict[name] = term - return term - - def Terminals(self, names): - - ans = tuple((self.Terminal(x) for x in names.strip().split())) - - return ans - - def __str__(self): - - mul = "%s, " - - ans = "Non-Terminals:\n\t" - - nonterminals = mul * (len(self.nonTerminals) - 1) + "%s\n" - - ans += nonterminals % tuple(self.nonTerminals) - - ans += "Terminals:\n\t" - - terminals = mul * (len(self.terminals) - 1) + "%s\n" - - ans += terminals % tuple(self.terminals) - - ans += "Productions:\n\t" - - ans += str(self.Productions) - - return ans - - def __getitem__(self, name): - try: - return self.symbDict[name] - except KeyError: - return None - - @property - def to_json(self): - - productions = [] - - for p in self.Productions: - head = p.Left.Name - - body = [] - - for s in p.Right: - body.append(s.Name) - - productions.append({"Head": head, "Body": body}) - - d = { - "NonTerminals": [symb.Name for symb in self.nonTerminals], - "Terminals": [symb.Name for symb in self.terminals], - "Productions": productions, - } - - # [{'Head':p.Left.Name, "Body": [s.Name for s in p.Right]} for p in self.Productions] - return json.dumps(d) - - @staticmethod - def from_json(data): - data = json.loads(data) - - G = Grammar() - dic = {"epsilon": G.Epsilon} - - for term in data["Terminals"]: - dic[term] = G.Terminal(term) - - for noTerm in data["NonTerminals"]: - dic[noTerm] = G.NonTerminal(noTerm) - - for p in data["Productions"]: - head = p["Head"] - dic[head] %= Sentence(*[dic[term] for term in p["Body"]]) - - return G - - def copy(self): - G = Grammar() - G.Productions = self.Productions.copy() - G.nonTerminals = self.nonTerminals.copy() - G.terminals = self.terminals.copy() - G.pType = self.pType - G.startSymbol = self.startSymbol - G.Epsilon = self.Epsilon - G.EOF = self.EOF - G.symbDict = self.symbDict.copy() - - return G - - @property - def IsAugmentedGrammar(self): - augmented = 0 - for left, right in self.Productions: - if self.startSymbol == left: - augmented += 1 - if augmented <= 1: - return True - else: - return False - - def AugmentedGrammar(self): - if not self.IsAugmentedGrammar: - - G = self.copy() - # S, self.startSymbol, SS = self.startSymbol, None, self.NonTerminal('S\'', True) - S = G.startSymbol - G.startSymbol = None - SS = G.NonTerminal("S'", True) - if G.pType is AttributeProduction: - SS %= S + G.Epsilon, lambda x: x - else: - SS %= S + G.Epsilon - - return G - else: - return self.copy() - - # endchange diff --git a/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/tools-checkpoint.py b/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/tools-checkpoint.py deleted file mode 100644 index 266ce1dba..000000000 --- a/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/tools-checkpoint.py +++ /dev/null @@ -1,21 +0,0 @@ -import zlib, base64 - -exec( - zlib.decompress( - base64.b64decode( - "eJyVUk1r3DAQvftXiJy81BXJtaBDD+lSqFvThmVBGCOvx46ovhjJ2WZL/3sly5vNllwKAs08zeg9vdEAI+lnqYbOCfTSTF0QvYJyW40SffDVaJWyR7/5UJCa/f5TkNEiEUQasqUN2mE+BGmNj8dkzwT9AmOIYRPD73J6THFqgNSQb+RNm4pJwOdlJzXfV9BS4RyYoRSbBMKvA7jw+pxx0cZUjpdr6MGaIKTxHTgvlTVL/YUuK+f7zHchfJPxivKKEyHMaEhdDNErDcEOtnMIg4wvf7KdsR3CYY7mPdloW52cWirLYwrJjvEtvf/2qdpSHwSGH8+6tyq9RWt2G7cT4yk7PkoF5AFnWDRMbEeddeUiTrAj1zpVJQMm+tk/AGpphMp6E8iYWMXnbCFdEdIjiJ85BuXhDGv9jt0V/6AOpQnlzT2iRUo+9hZD/BeU0pts1NmQr9ZAcdV6cbhhNZ8q0fLbNgNpKjJNBYWZoFRgyib/kM37u2pZm7Oq3XkyawWX7cp8ejl5Y2b/qXvNTi8D1sVffqzjDA==" - ) - ) -) -# Created by pyminifier (https://github.com/liftoff/pyminifier) - -deprecated_metodo_predictivo_no_recursivo = metodo_predictivo_no_recursivo - - -def metodo_predictivo_no_recursivo(G, M): - parser = deprecated_metodo_predictivo_no_recursivo(G, M) - - def updated(tokens): - return parser([t.token_type for t in tokens]) - - return updated diff --git a/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/utils-checkpoint.py b/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/utils-checkpoint.py deleted file mode 100644 index f01a4a881..000000000 --- a/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/utils-checkpoint.py +++ /dev/null @@ -1,156 +0,0 @@ -from cmp.pycompiler import Production, Sentence, Symbol, EOF, Epsilon - - -class ContainerSet: - def __init__(self, *values, contains_epsilon=False): - self.set = set(values) - self.contains_epsilon = contains_epsilon - - def add(self, value): - n = len(self.set) - self.set.add(value) - return n != len(self.set) - - def extend(self, values): - change = False - for value in values: - change |= self.add(value) - return change - - def set_epsilon(self, value=True): - last = self.contains_epsilon - self.contains_epsilon = value - return last != self.contains_epsilon - - def update(self, other): - n = len(self.set) - self.set.update(other.set) - return n != len(self.set) - - def epsilon_update(self, other): - return self.set_epsilon(self.contains_epsilon | other.contains_epsilon) - - def hard_update(self, other): - return self.update(other) | self.epsilon_update(other) - - def find_match(self, match): - for item in self.set: - if item == match: - return item - return None - - def __len__(self): - return len(self.set) + int(self.contains_epsilon) - - def __str__(self): - return "%s-%s" % (str(self.set), self.contains_epsilon) - - def __repr__(self): - return str(self) - - def __iter__(self): - return iter(self.set) - - def __nonzero__(self): - return len(self) > 0 - - def __eq__(self, other): - if isinstance(other, set): - return self.set == other - return ( - isinstance(other, ContainerSet) - and self.set == other.set - and self.contains_epsilon == other.contains_epsilon - ) - - -def inspect(item, grammar_name="G", mapper=None): - try: - return mapper[item] - except (TypeError, KeyError): - if isinstance(item, dict): - items = ",\n ".join( - f"{inspect(key, grammar_name, mapper)}: {inspect(value, grammar_name, mapper)}" - for key, value in item.items() - ) - return f"{{\n {items} \n}}" - elif isinstance(item, ContainerSet): - args = ( - f'{ ", ".join(inspect(x, grammar_name, mapper) for x in item.set) } ,' - if item.set - else "" - ) - return f"ContainerSet({args} contains_epsilon={item.contains_epsilon})" - elif isinstance(item, EOF): - return f"{grammar_name}.EOF" - elif isinstance(item, Epsilon): - return f"{grammar_name}.Epsilon" - elif isinstance(item, Symbol): - return f"G['{item.Name}']" - elif isinstance(item, Sentence): - items = ", ".join(inspect(s, grammar_name, mapper) for s in item._symbols) - return f"Sentence({items})" - elif isinstance(item, Production): - left = inspect(item.Left, grammar_name, mapper) - right = inspect(item.Right, grammar_name, mapper) - return f"Production({left}, {right})" - elif isinstance(item, tuple) or isinstance(item, list): - ctor = ("(", ")") if isinstance(item, tuple) else ("[", "]") - return f'{ctor[0]} {("%s, " * len(item)) % tuple(inspect(x, grammar_name, mapper) for x in item)}{ctor[1]}' - else: - raise ValueError(f"Invalid: {item}") - - -def pprint(item, header=""): - if header: - print(header) - - if isinstance(item, dict): - for key, value in item.items(): - print(f"{key} ---> {value}") - elif isinstance(item, list): - print("[") - for x in item: - print(f" {repr(x)}") - print("]") - else: - print(item) - - -class Token: - """ - Basic token class. - - Parameters - ---------- - lex : str - Token's lexeme. - token_type : Enum - Token's type. - """ - - def __init__(self, lex, token_type): - self.lex = lex - self.token_type = token_type - - def __str__(self): - return f"{self.token_type}: {self.lex}" - - def __repr__(self): - return str(self) - - @property - def is_valid(self): - return True - - -class UnknownToken(Token): - def __init__(self, lex): - Token.__init__(self, lex, None) - - def transform_to(self, token_type): - return Token(self.lex, token_type) - - @property - def is_valid(self): - return False diff --git a/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/visitor-checkpoint.py b/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/visitor-checkpoint.py deleted file mode 100644 index 0bcba712e..000000000 --- a/src/cool/code_generation/notebooks/cmp/.ipynb_checkpoints/visitor-checkpoint.py +++ /dev/null @@ -1,85 +0,0 @@ -# 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/src/cool/code_generation/notebooks/cmp/__init__.py b/src/cool/code_generation/notebooks/cmp/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/cool/code_generation/notebooks/cmp/ast.py b/src/cool/code_generation/notebooks/cmp/ast.py deleted file mode 100644 index b5b6ff4fb..000000000 --- a/src/cool/code_generation/notebooks/cmp/ast.py +++ /dev/null @@ -1,70 +0,0 @@ -import cmp.visitor as visitor - - -class Node: - def evaluate(self): - raise NotImplementedError() - - -class AtomicNode(Node): - def __init__(self, lex): - self.lex = lex - - -class UnaryNode(Node): - def __init__(self, node): - self.node = node - - def evaluate(self): - value = self.node.evaluate() - return self.operate(value) - - @staticmethod - def operate(value): - raise NotImplementedError() - - -class BinaryNode(Node): - def __init__(self, left, right): - self.left = left - self.right = right - - def evaluate(self): - lvalue = self.left.evaluate() - rvalue = self.right.evaluate() - return self.operate(lvalue, rvalue) - - @staticmethod - def operate(lvalue, rvalue): - raise NotImplementedError() - - -def get_printer( - AtomicNode=AtomicNode, - UnaryNode=UnaryNode, - BinaryNode=BinaryNode, -): - class PrintVisitor(object): - @visitor.on("node") - def visit(self, node, tabs): - pass - - @visitor.when(UnaryNode) - def visit(self, node, tabs=0): - ans = "\t" * tabs + f"\\__ {node.__class__.__name__}" - child = self.visit(node.node, tabs + 1) - return f"{ans}\n{child}" - - @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(AtomicNode) - def visit(self, node, tabs=0): - return "\t" * tabs + f"\\__ {node.__class__.__name__}: {node.lex}" - - printer = PrintVisitor() - return lambda ast: printer.visit(ast) diff --git a/src/cool/code_generation/notebooks/cmp/automata.py b/src/cool/code_generation/notebooks/cmp/automata.py deleted file mode 100644 index 259b1cf53..000000000 --- a/src/cool/code_generation/notebooks/cmp/automata.py +++ /dev/null @@ -1,224 +0,0 @@ -try: - import pydot -except: - pass - - -class State: - def __init__(self, state, final=False, formatter=lambda x: str(x), shape="circle"): - self.state = state - self.final = final - self.transitions = {} - self.epsilon_transitions = set() - self.tag = None - self.formatter = formatter - self.shape = shape - - # The method name is set this way from compatibility issues. - def set_formatter(self, value, attr="formatter", visited=None): - if visited is None: - visited = set() - elif self in visited: - return - - visited.add(self) - self.__setattr__(attr, value) - for destinations in self.transitions.values(): - for node in destinations: - node.set_formatter(value, attr, visited) - for node in self.epsilon_transitions: - node.set_formatter(value, attr, visited) - return self - - def has_transition(self, symbol): - return symbol in self.transitions - - def add_transition(self, symbol, state): - try: - self.transitions[symbol].append(state) - except: - self.transitions[symbol] = [state] - return self - - def add_epsilon_transition(self, state): - self.epsilon_transitions.add(state) - return self - - def recognize(self, string): - states = self.epsilon_closure - for symbol in string: - states = self.move_by_state(symbol, *states) - states = self.epsilon_closure_by_state(*states) - return any(s.final for s in states) - - def to_deterministic(self, formatter=lambda x: str(x)): - closure = self.epsilon_closure - start = State(tuple(closure), any(s.final for s in closure), formatter) - - closures = [closure] - states = [start] - pending = [start] - - while pending: - state = pending.pop() - symbols = {symbol for s in state.state for symbol in s.transitions} - - for symbol in symbols: - move = self.move_by_state(symbol, *state.state) - closure = self.epsilon_closure_by_state(*move) - - if closure not in closures: - new_state = State( - tuple(closure), any(s.final for s in closure), formatter - ) - closures.append(closure) - states.append(new_state) - pending.append(new_state) - else: - index = closures.index(closure) - new_state = states[index] - - state.add_transition(symbol, new_state) - - return start - - @staticmethod - def from_nfa(nfa, get_states=False): - states = [] - for n in range(nfa.states): - state = State(n, n in nfa.finals) - states.append(state) - - for (origin, symbol), destinations in nfa.map.items(): - origin = states[origin] - origin[symbol] = [states[d] for d in destinations] - - if get_states: - return states[nfa.start], states - return states[nfa.start] - - @staticmethod - def move_by_state(symbol, *states): - return { - s for state in states if state.has_transition(symbol) for s in state[symbol] - } - - @staticmethod - def epsilon_closure_by_state(*states): - closure = {state for state in states} - - l = 0 - while l != len(closure): - l = len(closure) - tmp = [s for s in closure] - for s in tmp: - for epsilon_state in s.epsilon_transitions: - closure.add(epsilon_state) - return closure - - @property - def epsilon_closure(self): - return self.epsilon_closure_by_state(self) - - @property - def name(self): - return self.formatter(self.state) - - def get(self, symbol): - target = self.transitions[symbol] - assert len(target) == 1 - return target[0] - - def __getitem__(self, symbol): - if symbol == "": - return self.epsilon_transitions - try: - return self.transitions[symbol] - except KeyError: - return None - - def __setitem__(self, symbol, value): - if symbol == "": - self.epsilon_transitions = value - else: - self.transitions[symbol] = value - - def __repr__(self): - return str(self) - - def __str__(self): - return str(self.state) - - def __hash__(self): - return hash(self.state) - - def __iter__(self): - yield from self._visit() - - def _visit(self, visited=None): - if visited is None: - visited = set() - elif self in visited: - return - - visited.add(self) - yield self - - for destinations in self.transitions.values(): - for node in destinations: - yield from node._visit(visited) - for node in self.epsilon_transitions: - yield from node._visit(visited) - - def graph(self): - G = pydot.Dot(rankdir="LR", margin=0.1) - G.add_node(pydot.Node("start", shape="plaintext", label="", width=0, height=0)) - - visited = set() - - def visit(start): - ids = id(start) - if ids not in visited: - visited.add(ids) - G.add_node( - pydot.Node( - ids, - label=start.name, - shape=self.shape, - style="bold" if start.final else "", - ) - ) - for tran, destinations in start.transitions.items(): - for end in destinations: - visit(end) - G.add_edge( - pydot.Edge(ids, id(end), label=tran, labeldistance=2) - ) - for end in start.epsilon_transitions: - visit(end) - G.add_edge(pydot.Edge(ids, id(end), label="ε", labeldistance=2)) - - visit(self) - G.add_edge(pydot.Edge("start", id(self), label="", style="dashed")) - - return G - - def _repr_svg_(self): - try: - return self.graph().create_svg().decode("utf8") - except: - pass - - def write_to(self, fname): - return self.graph().write_svg(fname) - - -def multiline_formatter(state): - return "\n".join(str(item) for item in state) - - -def lr0_formatter(state): - try: - return "\n".join(str(item)[:-4] for item in state) - except TypeError: - return str(state)[:-4] diff --git a/src/cool/code_generation/notebooks/cmp/cil.py b/src/cool/code_generation/notebooks/cmp/cil.py deleted file mode 100644 index c6c16ac47..000000000 --- a/src/cool/code_generation/notebooks/cmp/cil.py +++ /dev/null @@ -1,266 +0,0 @@ -import cmp.visitor as visitor - - -class Node: - pass - - -class ProgramNode(Node): - def __init__(self, dottypes, dotdata, dotcode): - self.dottypes = dottypes - self.dotdata = dotdata - self.dotcode = dotcode - - -class TypeNode(Node): - def __init__(self, name): - self.name = name - self.attributes = [] - self.methods = [] - - -class DataNode(Node): - def __init__(self, vname, value): - self.name = vname - self.value = value - - -class FunctionNode(Node): - def __init__(self, fname, params, localvars, instructions): - self.name = fname - self.params = params - self.localvars = localvars - self.instructions = instructions - - -class ParamNode(Node): - def __init__(self, name): - self.name = name - - -class LocalNode(Node): - def __init__(self, name): - self.name = name - - -class InstructionNode(Node): - pass - - -class AssignNode(InstructionNode): - def __init__(self, dest, source): - self.dest = dest - self.source = source - - -class ArithmeticNode(InstructionNode): - def __init__(self, dest, left, right): - self.dest = dest - self.left = left - self.right = right - - -class PlusNode(ArithmeticNode): - pass - - -class MinusNode(ArithmeticNode): - pass - - -class StarNode(ArithmeticNode): - pass - - -class DivNode(ArithmeticNode): - pass - - -class GetAttribNode(InstructionNode): - pass - - -class SetAttribNode(InstructionNode): - pass - - -class GetIndexNode(InstructionNode): - pass - - -class SetIndexNode(InstructionNode): - pass - - -class AllocateNode(InstructionNode): - def __init__(self, itype, dest): - self.type = itype - self.dest = dest - - -class ArrayNode(InstructionNode): - pass - - -class TypeOfNode(InstructionNode): - def __init__(self, obj, dest): - self.obj = obj - self.dest = dest - - -class LabelNode(InstructionNode): - pass - - -class GotoNode(InstructionNode): - pass - - -class GotoIfNode(InstructionNode): - pass - - -class StaticCallNode(InstructionNode): - def __init__(self, function, dest): - self.function = function - self.dest = dest - - -class DynamicCallNode(InstructionNode): - def __init__(self, xtype, method, dest): - self.type = xtype - self.method = method - self.dest = dest - - -class ArgNode(InstructionNode): - def __init__(self, name): - self.name = name - - -class ReturnNode(InstructionNode): - def __init__(self, value=None): - self.value = value - - -class LoadNode(InstructionNode): - def __init__(self, dest, msg): - self.dest = dest - self.msg = msg - - -class LengthNode(InstructionNode): - pass - - -class ConcatNode(InstructionNode): - pass - - -class PrefixNode(InstructionNode): - pass - - -class SubstringNode(InstructionNode): - pass - - -class ToStrNode(InstructionNode): - def __init__(self, dest, ivalue): - self.dest = dest - self.ivalue = ivalue - - -class ReadNode(InstructionNode): - def __init__(self, dest): - self.dest = dest - - -class PrintNode(InstructionNode): - def __init__(self, str_addr): - self.str_addr = str_addr - - -def get_formatter(): - class PrintVisitor(object): - @visitor.on("node") - def visit(self, node): - pass - - @visitor.when(ProgramNode) - def visit(self, node): - 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): - attributes = "\n\t".join(f"attribute {x}" for x 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): - 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(ParamNode) - def visit(self, node): - return f"PARAM {node.name}" - - @visitor.when(LocalNode) - def visit(self, node): - return f"LOCAL {node.name}" - - @visitor.when(AssignNode) - def visit(self, node): - return f"{node.dest} = {node.source}" - - @visitor.when(PlusNode) - def visit(self, node): - return f"{node.dest} = {node.left} + {node.right}" - - @visitor.when(MinusNode) - def visit(self, node): - return f"{node.dest} = {node.left} - {node.right}" - - @visitor.when(StarNode) - def visit(self, node): - return f"{node.dest} = {node.left} * {node.right}" - - @visitor.when(DivNode) - def visit(self, node): - return f"{node.dest} = {node.left} / {node.right}" - - @visitor.when(AllocateNode) - def visit(self, node): - return f"{node.dest} = ALLOCATE {node.type}" - - @visitor.when(TypeOfNode) - def visit(self, node): - return f"{node.dest} = TYPEOF {node.type}" - - @visitor.when(StaticCallNode) - def visit(self, node): - return f"{node.dest} = CALL {node.function}" - - @visitor.when(DynamicCallNode) - def visit(self, node): - return f"{node.dest} = VCALL {node.type} {node.method}" - - @visitor.when(ArgNode) - def visit(self, node): - return f"ARG {node.name}" - - @visitor.when(ReturnNode) - def visit(self, node): - return f'RETURN {node.value if node.value is not None else ""}' - - printer = PrintVisitor() - return lambda ast: printer.visit(ast) diff --git a/src/cool/code_generation/notebooks/cmp/evaluation.py b/src/cool/code_generation/notebooks/cmp/evaluation.py deleted file mode 100644 index 50b22f87b..000000000 --- a/src/cool/code_generation/notebooks/cmp/evaluation.py +++ /dev/null @@ -1,36 +0,0 @@ -from cmp.pycompiler import EOF -from cmp.tools.parsing import ShiftReduceParser - - -def evaluate_reverse_parse(right_parse, operations, tokens): - if not right_parse or not operations or not tokens: - return - - right_parse = iter(right_parse) - tokens = iter(tokens) - stack = [] - for operation in operations: - if operation == ShiftReduceParser.SHIFT: - token = next(tokens) - stack.append(token.lex) - elif operation == ShiftReduceParser.REDUCE: - production = next(right_parse) - head, body = production - attributes = production.attributes - assert all( - rule is None for rule in attributes[1:] - ), "There must be only synteticed attributes." - rule = attributes[0] - - if len(body): - synteticed = [None] + stack[-len(body) :] - value = rule(None, synteticed) - stack[-len(body) :] = [value] - else: - stack.append(rule(None, None)) - else: - raise Exception("Invalid action!!!") - - assert len(stack) == 1 - assert isinstance(next(tokens).token_type, EOF) - return stack[0] diff --git a/src/cool/code_generation/notebooks/cmp/languages.py b/src/cool/code_generation/notebooks/cmp/languages.py deleted file mode 100644 index 06e6adfbd..000000000 --- a/src/cool/code_generation/notebooks/cmp/languages.py +++ /dev/null @@ -1,399 +0,0 @@ -from cmp.pycompiler import Sentence, Production -from cmp.utils import ContainerSet, Token, UnknownToken -from cmp.tools.parsing import build_parsing_table, metodo_predictivo_no_recursivo - - -class BasicXCool: - def __init__(self, G): - self.G = G - self.fixed_tokens = {lex: Token(lex, G[lex]) for lex in "+ - * / ( )".split()} - - @property - def firsts(self): - G = self.G - return { - G["+"]: ContainerSet(G["+"], contains_epsilon=False), - G["-"]: ContainerSet(G["-"], contains_epsilon=False), - G["*"]: ContainerSet(G["*"], contains_epsilon=False), - G["/"]: ContainerSet(G["/"], contains_epsilon=False), - G["("]: ContainerSet(G["("], contains_epsilon=False), - G[")"]: ContainerSet(G[")"], contains_epsilon=False), - G["num"]: ContainerSet(G["num"], contains_epsilon=False), - G["E"]: ContainerSet(G["num"], G["("], contains_epsilon=False), - G["T"]: ContainerSet(G["num"], G["("], contains_epsilon=False), - G["F"]: ContainerSet(G["num"], G["("], contains_epsilon=False), - G["X"]: ContainerSet(G["-"], G["+"], contains_epsilon=True), - G["Y"]: ContainerSet(G["/"], G["*"], contains_epsilon=True), - Sentence(G["T"], G["X"]): ContainerSet( - G["num"], G["("], contains_epsilon=False - ), - Sentence(G["+"], G["T"], G["X"]): ContainerSet( - G["+"], contains_epsilon=False - ), - Sentence(G["-"], G["T"], G["X"]): ContainerSet( - G["-"], contains_epsilon=False - ), - G.Epsilon: ContainerSet(contains_epsilon=True), - Sentence(G["F"], G["Y"]): ContainerSet( - G["num"], G["("], contains_epsilon=False - ), - Sentence(G["*"], G["F"], G["Y"]): ContainerSet( - G["*"], contains_epsilon=False - ), - Sentence(G["/"], G["F"], G["Y"]): ContainerSet( - G["/"], contains_epsilon=False - ), - Sentence(G["num"]): ContainerSet(G["num"], contains_epsilon=False), - Sentence(G["("], G["E"], G[")"]): ContainerSet( - G["("], contains_epsilon=False - ), - } - - @property - def follows(self): - G = self.G - return { - G["E"]: ContainerSet(G[")"], G.EOF, contains_epsilon=False), - G["T"]: ContainerSet(G[")"], G["-"], G.EOF, G["+"], contains_epsilon=False), - G["F"]: ContainerSet( - G["-"], G.EOF, G["*"], G["/"], G[")"], G["+"], contains_epsilon=False - ), - G["X"]: ContainerSet(G[")"], G.EOF, contains_epsilon=False), - G["Y"]: ContainerSet(G[")"], G["-"], G.EOF, G["+"], contains_epsilon=False), - } - - @property - def table(self): - G = self.G - return { - (G["E"], G["num"],): [ - Production(G["E"], Sentence(G["T"], G["X"])), - ], - (G["E"], G["("],): [ - Production(G["E"], Sentence(G["T"], G["X"])), - ], - (G["X"], G["+"],): [ - Production(G["X"], Sentence(G["+"], G["T"], G["X"])), - ], - (G["X"], G["-"],): [ - Production(G["X"], Sentence(G["-"], G["T"], G["X"])), - ], - (G["X"], G[")"],): [ - Production(G["X"], G.Epsilon), - ], - (G["X"], G.EOF,): [ - Production(G["X"], G.Epsilon), - ], - (G["T"], G["num"],): [ - Production(G["T"], Sentence(G["F"], G["Y"])), - ], - (G["T"], G["("],): [ - Production(G["T"], Sentence(G["F"], G["Y"])), - ], - (G["Y"], G["*"],): [ - Production(G["Y"], Sentence(G["*"], G["F"], G["Y"])), - ], - (G["Y"], G["/"],): [ - Production(G["Y"], Sentence(G["/"], G["F"], G["Y"])), - ], - (G["Y"], G[")"],): [ - Production(G["Y"], G.Epsilon), - ], - (G["Y"], G["-"],): [ - Production(G["Y"], G.Epsilon), - ], - (G["Y"], G.EOF,): [ - Production(G["Y"], G.Epsilon), - ], - (G["Y"], G["+"],): [ - Production(G["Y"], G.Epsilon), - ], - (G["F"], G["num"],): [ - Production(G["F"], Sentence(G["num"])), - ], - (G["F"], G["("],): [ - Production(G["F"], Sentence(G["("], G["E"], G[")"])), - ], - } - - @property - def tokenizer(self): - G = self.G - fixed_tokens = self.fixed_tokens - - def tokenize_text(text): - tokens = [] - for item in text.split(): - try: - float(item) - token = Token(item, G["num"]) - except ValueError: - try: - token = fixed_tokens[item] - except: - token = UnknownToken(item) - tokens.append(token) - eof = Token("$", G.EOF) - tokens.append(eof) - return tokens - - return tokenize_text - - -class PowXCool: - def __init__(self, G): - self.G = G - - @property - def firsts(self): - G = self.G - return { - G["+"]: ContainerSet(G["+"], contains_epsilon=False), - G["-"]: ContainerSet(G["-"], contains_epsilon=False), - G["*"]: ContainerSet(G["*"], contains_epsilon=False), - G["/"]: ContainerSet(G["/"], contains_epsilon=False), - G["^"]: ContainerSet(G["^"], contains_epsilon=False), - G["("]: ContainerSet(G["("], contains_epsilon=False), - G[")"]: ContainerSet(G[")"], contains_epsilon=False), - G["num"]: ContainerSet(G["num"], contains_epsilon=False), - G["E"]: ContainerSet(G["num"], G["("], contains_epsilon=False), - G["T"]: ContainerSet(G["num"], G["("], contains_epsilon=False), - G["F"]: ContainerSet(G["num"], G["("], contains_epsilon=False), - G["A"]: ContainerSet(G["num"], G["("], contains_epsilon=False), - G["X"]: ContainerSet(G["-"], G["+"], contains_epsilon=True), - G["Y"]: ContainerSet(G["/"], G["*"], contains_epsilon=True), - G["Z"]: ContainerSet(G["^"], contains_epsilon=True), - Sentence(G["T"], G["X"]): ContainerSet( - G["num"], G["("], contains_epsilon=False - ), - Sentence(G["+"], G["T"], G["X"]): ContainerSet( - G["+"], contains_epsilon=False - ), - Sentence(G["-"], G["T"], G["X"]): ContainerSet( - G["-"], contains_epsilon=False - ), - G.Epsilon: ContainerSet(contains_epsilon=True), - Sentence(G["F"], G["Y"]): ContainerSet( - G["num"], G["("], contains_epsilon=False - ), - Sentence(G["*"], G["F"], G["Y"]): ContainerSet( - G["*"], contains_epsilon=False - ), - Sentence(G["/"], G["F"], G["Y"]): ContainerSet( - G["/"], contains_epsilon=False - ), - Sentence(G["A"], G["Z"]): ContainerSet( - G["num"], G["("], contains_epsilon=False - ), - Sentence(G["^"], G["F"]): ContainerSet(G["^"], contains_epsilon=False), - Sentence(G["num"]): ContainerSet(G["num"], contains_epsilon=False), - Sentence(G["("], G["E"], G[")"]): ContainerSet( - G["("], contains_epsilon=False - ), - } - - @property - def follows(self): - G = self.G - return { - G["E"]: ContainerSet(G[")"], G.EOF, contains_epsilon=False), - G["T"]: ContainerSet(G["-"], G[")"], G.EOF, G["+"], contains_epsilon=False), - G["F"]: ContainerSet( - G["-"], G["*"], G["/"], G[")"], G.EOF, G["+"], contains_epsilon=False - ), - G["A"]: ContainerSet( - G["-"], - G["*"], - G["/"], - G["^"], - G[")"], - G.EOF, - G["+"], - contains_epsilon=False, - ), - G["X"]: ContainerSet(G[")"], G.EOF, contains_epsilon=False), - G["Y"]: ContainerSet(G["-"], G[")"], G.EOF, G["+"], contains_epsilon=False), - G["Z"]: ContainerSet( - G["-"], G["*"], G["/"], G[")"], G.EOF, G["+"], contains_epsilon=False - ), - } - - -class Regex: - def __init__(self, G): - self.G = G - - @property - def firsts(self): - G = self.G - return { - G["|"]: ContainerSet(G["|"], contains_epsilon=False), - G["*"]: ContainerSet(G["*"], contains_epsilon=False), - G["("]: ContainerSet(G["("], contains_epsilon=False), - G[")"]: ContainerSet(G[")"], contains_epsilon=False), - G["symbol"]: ContainerSet(G["symbol"], contains_epsilon=False), - G["ε"]: ContainerSet(G["ε"], contains_epsilon=False), - G["E"]: ContainerSet(G["symbol"], G["ε"], G["("], contains_epsilon=False), - G["T"]: ContainerSet(G["symbol"], G["ε"], G["("], contains_epsilon=False), - G["F"]: ContainerSet(G["symbol"], G["ε"], G["("], contains_epsilon=False), - G["A"]: ContainerSet(G["ε"], G["symbol"], G["("], contains_epsilon=False), - G["X"]: ContainerSet(G["|"], contains_epsilon=True), - G["Y"]: ContainerSet(G["symbol"], G["ε"], G["("], contains_epsilon=True), - G["Z"]: ContainerSet(G["*"], contains_epsilon=True), - Sentence(G["T"], G["X"]): ContainerSet( - G["symbol"], G["ε"], G["("], contains_epsilon=False - ), - Sentence(G["|"], G["E"]): ContainerSet(G["|"], contains_epsilon=False), - G.Epsilon: ContainerSet(contains_epsilon=True), - Sentence(G["F"], G["Y"]): ContainerSet( - G["symbol"], G["ε"], G["("], contains_epsilon=False - ), - Sentence(G["T"]): ContainerSet( - G["symbol"], G["ε"], G["("], contains_epsilon=False - ), - Sentence(G["A"], G["Z"]): ContainerSet( - G["symbol"], G["ε"], G["("], contains_epsilon=False - ), - Sentence(G["*"]): ContainerSet(G["*"], contains_epsilon=False), - Sentence(G["symbol"]): ContainerSet(G["symbol"], contains_epsilon=False), - Sentence(G["ε"]): ContainerSet(G["ε"], contains_epsilon=False), - Sentence(G["("], G["E"], G[")"]): ContainerSet( - G["("], contains_epsilon=False - ), - } - - @property - def follows(self): - G = self.G - return { - G["E"]: ContainerSet(G[")"], G.EOF, contains_epsilon=False), - G["T"]: ContainerSet(G[")"], G.EOF, G["|"], contains_epsilon=False), - G["F"]: ContainerSet( - G[")"], - G.EOF, - G["symbol"], - G["|"], - G["ε"], - G["("], - contains_epsilon=False, - ), - G["A"]: ContainerSet( - G.EOF, - G["|"], - G["*"], - G["("], - G[")"], - G["symbol"], - G["ε"], - contains_epsilon=False, - ), - G["X"]: ContainerSet(G[")"], G.EOF, contains_epsilon=False), - G["Y"]: ContainerSet(G[")"], G.EOF, G["|"], contains_epsilon=False), - G["Z"]: ContainerSet( - G.EOF, - G["|"], - G["("], - G[")"], - G["symbol"], - G["ε"], - contains_epsilon=False, - ), - } - - @property - def table(self): - G = self.G - return { - (G["E"], G["symbol"],): [ - Production(G["E"], Sentence(G["T"], G["X"])), - ], - (G["E"], G["ε"],): [ - Production(G["E"], Sentence(G["T"], G["X"])), - ], - (G["E"], G["("],): [ - Production(G["E"], Sentence(G["T"], G["X"])), - ], - (G["X"], G["|"],): [ - Production(G["X"], Sentence(G["|"], G["E"])), - ], - (G["X"], G[")"],): [ - Production(G["X"], G.Epsilon), - ], - (G["X"], G.EOF,): [ - Production(G["X"], G.Epsilon), - ], - (G["T"], G["symbol"],): [ - Production(G["T"], Sentence(G["F"], G["Y"])), - ], - (G["T"], G["ε"],): [ - Production(G["T"], Sentence(G["F"], G["Y"])), - ], - (G["T"], G["("],): [ - Production(G["T"], Sentence(G["F"], G["Y"])), - ], - (G["Y"], G["symbol"],): [ - Production(G["Y"], Sentence(G["T"])), - ], - (G["Y"], G["ε"],): [ - Production(G["Y"], Sentence(G["T"])), - ], - (G["Y"], G["("],): [ - Production(G["Y"], Sentence(G["T"])), - ], - (G["Y"], G[")"],): [ - Production(G["Y"], G.Epsilon), - ], - (G["Y"], G.EOF,): [ - Production(G["Y"], G.Epsilon), - ], - (G["Y"], G["|"],): [ - Production(G["Y"], G.Epsilon), - ], - (G["F"], G["symbol"],): [ - Production(G["F"], Sentence(G["A"], G["Z"])), - ], - (G["F"], G["ε"],): [ - Production(G["F"], Sentence(G["A"], G["Z"])), - ], - (G["F"], G["("],): [ - Production(G["F"], Sentence(G["A"], G["Z"])), - ], - (G["Z"], G["*"],): [ - Production(G["Z"], Sentence(G["*"])), - ], - (G["Z"], G.EOF,): [ - Production(G["Z"], G.Epsilon), - ], - (G["Z"], G["|"],): [ - Production(G["Z"], G.Epsilon), - ], - (G["Z"], G["("],): [ - Production(G["Z"], G.Epsilon), - ], - (G["Z"], G[")"],): [ - Production(G["Z"], G.Epsilon), - ], - (G["Z"], G["symbol"],): [ - Production(G["Z"], G.Epsilon), - ], - (G["Z"], G["ε"],): [ - Production(G["Z"], G.Epsilon), - ], - (G["A"], G["symbol"],): [ - Production(G["A"], Sentence(G["symbol"])), - ], - (G["A"], G["ε"],): [ - Production(G["A"], Sentence(G["ε"])), - ], - (G["A"], G["("],): [ - Production(G["A"], Sentence(G["("], G["E"], G[")"])), - ], - } - - @property - def parser(self): - firsts = self.firsts - follows = self.follows - M = build_parsing_table(self.G, firsts, follows) - parser = metodo_predictivo_no_recursivo(self.G, M) - return parser diff --git a/src/cool/code_generation/notebooks/cmp/nbpackage.py b/src/cool/code_generation/notebooks/cmp/nbpackage.py deleted file mode 100644 index e95c88ff8..000000000 --- a/src/cool/code_generation/notebooks/cmp/nbpackage.py +++ /dev/null @@ -1,94 +0,0 @@ -import io, os, sys, types - -from IPython import get_ipython -from nbformat import read -from IPython.core.interactiveshell import InteractiveShell - - -def find_notebook(fullname, path=None): - """find a notebook, given its fully qualified name and an optional path - - This turns "foo.bar" into "foo/bar.ipynb" - and tries turning "Foo_Bar" into "Foo Bar" if Foo_Bar - does not exist. - """ - name = fullname.rsplit(".", 1)[-1] - if not path: - path = [""] - for d in path: - nb_path = os.path.join(d, name + ".ipynb") - if os.path.isfile(nb_path): - return nb_path - # let import Notebook_Name find "Notebook Name.ipynb" - nb_path = nb_path.replace("_", " ") - if os.path.isfile(nb_path): - return nb_path - - -class NotebookLoader(object): - """Module Loader for Jupyter Notebooks""" - - def __init__(self, path=None): - self.shell = InteractiveShell.instance() - self.path = path - - def load_module(self, fullname): - """import a notebook as a module""" - path = find_notebook(fullname, self.path) - - print("importing Jupyter notebook from %s" % path) - - # load the notebook object - with io.open(path, "r", encoding="utf-8") as f: - nb = read(f, 4) - - # create the module and add it to sys.modules - # if name in sys.modules: - # return sys.modules[name] - mod = types.ModuleType(fullname) - mod.__file__ = path - mod.__loader__ = self - mod.__dict__["get_ipython"] = get_ipython - sys.modules[fullname] = mod - - # extra work to ensure that magics that would affect the user_ns - # actually affect the notebook module's ns - save_user_ns = self.shell.user_ns - self.shell.user_ns = mod.__dict__ - - try: - for cell in nb.cells: - if cell.cell_type == "code": - # transform the input to executable Python - code = self.shell.input_transformer_manager.transform_cell( - cell.source - ) - # run the code in themodule - exec(code, mod.__dict__) - finally: - self.shell.user_ns = save_user_ns - return mod - - -class NotebookFinder(object): - """Module finder that locates Jupyter Notebooks""" - - def __init__(self): - self.loaders = {} - - def find_module(self, fullname, path=None): - nb_path = find_notebook(fullname, path) - if not nb_path: - return - - key = path - if path: - # lists aren't hashable - key = os.path.sep.join(path) - - if key not in self.loaders: - self.loaders[key] = NotebookLoader(path) - return self.loaders[key] - - -sys.meta_path.append(NotebookFinder()) diff --git a/src/cool/code_generation/notebooks/cmp/pycompiler.py b/src/cool/code_generation/notebooks/cmp/pycompiler.py deleted file mode 100644 index 9d1100913..000000000 --- a/src/cool/code_generation/notebooks/cmp/pycompiler.py +++ /dev/null @@ -1,513 +0,0 @@ -import json - - -class Symbol(object): - def __init__(self, name, grammar): - self.Name = name - self.Grammar = grammar - - def __str__(self): - return self.Name - - def __repr__(self): - return repr(self.Name) - - def __add__(self, other): - if isinstance(other, Symbol): - return Sentence(self, other) - - raise TypeError(other) - - def __or__(self, other): - - if isinstance(other, (Sentence)): - return SentenceList(Sentence(self), other) - - raise TypeError(other) - - @property - def IsEpsilon(self): - return False - - def __len__(self): - return 1 - - -class NonTerminal(Symbol): - def __init__(self, name, grammar): - super().__init__(name, grammar) - self.productions = [] - - def __imod__(self, other): - - if isinstance(other, (Sentence)): - p = Production(self, other) - self.Grammar.Add_Production(p) - return self - - if isinstance(other, tuple): - assert len(other) > 1 - - if len(other) == 2: - other += (None,) * len(other[0]) - - assert ( - len(other) == len(other[0]) + 2 - ), "Debe definirse una, y solo una, regla por cada símbolo de la producción" - # assert len(other) == 2, "Tiene que ser una Tupla de 2 elementos (sentence, attribute)" - - if isinstance(other[0], Symbol) or isinstance(other[0], Sentence): - p = AttributeProduction(self, other[0], other[1:]) - else: - raise Exception("") - - self.Grammar.Add_Production(p) - return self - - if isinstance(other, Symbol): - p = Production(self, Sentence(other)) - self.Grammar.Add_Production(p) - return self - - if isinstance(other, SentenceList): - - for s in other: - p = Production(self, s) - self.Grammar.Add_Production(p) - - return self - - raise TypeError(other) - - @property - def IsTerminal(self): - return False - - @property - def IsNonTerminal(self): - return True - - @property - def IsEpsilon(self): - return False - - -class Terminal(Symbol): - def __init__(self, name, grammar): - super().__init__(name, grammar) - - @property - def IsTerminal(self): - return True - - @property - def IsNonTerminal(self): - return False - - @property - def IsEpsilon(self): - return False - - -class EOF(Terminal): - def __init__(self, Grammar): - super().__init__("$", Grammar) - - -class Sentence(object): - def __init__(self, *args): - self._symbols = tuple(x for x in args if not x.IsEpsilon) - self.hash = hash(self._symbols) - - def __len__(self): - return len(self._symbols) - - def __add__(self, other): - if isinstance(other, Symbol): - return Sentence(*(self._symbols + (other,))) - - if isinstance(other, Sentence): - return Sentence(*(self._symbols + other._symbols)) - - raise TypeError(other) - - def __or__(self, other): - if isinstance(other, Sentence): - return SentenceList(self, other) - - if isinstance(other, Symbol): - return SentenceList(self, Sentence(other)) - - raise TypeError(other) - - def __repr__(self): - return str(self) - - def __str__(self): - return ("%s " * len(self._symbols) % tuple(self._symbols)).strip() - - def __iter__(self): - return iter(self._symbols) - - def __getitem__(self, index): - return self._symbols[index] - - def __eq__(self, other): - return self._symbols == other._symbols - - def __hash__(self): - return self.hash - - @property - def IsEpsilon(self): - return False - - -class SentenceList(object): - def __init__(self, *args): - self._sentences = list(args) - - def Add(self, symbol): - if not symbol and (symbol is None or not symbol.IsEpsilon): - raise ValueError(symbol) - - self._sentences.append(symbol) - - def __iter__(self): - return iter(self._sentences) - - def __or__(self, other): - if isinstance(other, Sentence): - self.Add(other) - return self - - if isinstance(other, Symbol): - return self | Sentence(other) - - -class Epsilon(Terminal, Sentence): - def __init__(self, grammar): - super().__init__("epsilon", grammar) - - def __str__(self): - return "e" - - def __repr__(self): - return "epsilon" - - def __iter__(self): - yield from () - - def __len__(self): - return 0 - - def __add__(self, other): - return other - - def __eq__(self, other): - return isinstance(other, (Epsilon,)) - - def __hash__(self): - return hash("") - - @property - def IsEpsilon(self): - return True - - -class Production(object): - def __init__(self, nonTerminal, sentence): - - self.Left = nonTerminal - self.Right = sentence - - def __str__(self): - - return "%s := %s" % (self.Left, self.Right) - - def __repr__(self): - return "%s -> %s" % (self.Left, self.Right) - - def __iter__(self): - yield self.Left - yield self.Right - - def __eq__(self, other): - return ( - isinstance(other, Production) - and self.Left == other.Left - and self.Right == other.Right - ) - - def __hash__(self): - return hash((self.Left, self.Right)) - - @property - def IsEpsilon(self): - return self.Right.IsEpsilon - - -class AttributeProduction(Production): - def __init__(self, nonTerminal, sentence, attributes): - if not isinstance(sentence, Sentence) and isinstance(sentence, Symbol): - sentence = Sentence(sentence) - super(AttributeProduction, self).__init__(nonTerminal, sentence) - - self.attributes = attributes - - def __str__(self): - return "%s := %s" % (self.Left, self.Right) - - def __repr__(self): - return "%s -> %s" % (self.Left, self.Right) - - def __iter__(self): - yield self.Left - yield self.Right - - @property - def IsEpsilon(self): - return self.Right.IsEpsilon - - # sintetizar en ingles??????, pending aggrement - def syntetice(self): - pass - - -class Grammar: - def __init__(self): - - self.Productions = [] - self.nonTerminals = [] - self.terminals = [] - self.startSymbol = None - # production type - self.pType = None - self.Epsilon = Epsilon(self) - self.EOF = EOF(self) - - self.symbDict = {"$": self.EOF} - - def NonTerminal(self, name, startSymbol=False): - - name = name.strip() - if not name: - raise Exception("Empty name") - - term = NonTerminal(name, self) - - if startSymbol: - - if self.startSymbol is None: - self.startSymbol = term - else: - raise Exception("Cannot define more than one start symbol.") - - self.nonTerminals.append(term) - self.symbDict[name] = term - return term - - def NonTerminals(self, names): - - ans = tuple((self.NonTerminal(x) for x in names.strip().split())) - - return ans - - def Add_Production(self, production): - - if len(self.Productions) == 0: - self.pType = type(production) - - assert type(production) == self.pType, "The Productions most be of only 1 type." - - production.Left.productions.append(production) - self.Productions.append(production) - - def Terminal(self, name): - - name = name.strip() - if not name: - raise Exception("Empty name") - - term = Terminal(name, self) - self.terminals.append(term) - self.symbDict[name] = term - return term - - def Terminals(self, names): - - ans = tuple((self.Terminal(x) for x in names.strip().split())) - - return ans - - def __str__(self): - - mul = "%s, " - - ans = "Non-Terminals:\n\t" - - nonterminals = mul * (len(self.nonTerminals) - 1) + "%s\n" - - ans += nonterminals % tuple(self.nonTerminals) - - ans += "Terminals:\n\t" - - terminals = mul * (len(self.terminals) - 1) + "%s\n" - - ans += terminals % tuple(self.terminals) - - ans += "Productions:\n\t" - - ans += str(self.Productions) - - return ans - - def __getitem__(self, name): - try: - return self.symbDict[name] - except KeyError: - return None - - @property - def to_json(self): - - productions = [] - - for p in self.Productions: - head = p.Left.Name - - body = [] - - for s in p.Right: - body.append(s.Name) - - productions.append({"Head": head, "Body": body}) - - d = { - "NonTerminals": [symb.Name for symb in self.nonTerminals], - "Terminals": [symb.Name for symb in self.terminals], - "Productions": productions, - } - - # [{'Head':p.Left.Name, "Body": [s.Name for s in p.Right]} for p in self.Productions] - return json.dumps(d) - - @staticmethod - def from_json(data): - data = json.loads(data) - - G = Grammar() - dic = {"epsilon": G.Epsilon} - - for term in data["Terminals"]: - dic[term] = G.Terminal(term) - - for noTerm in data["NonTerminals"]: - dic[noTerm] = G.NonTerminal(noTerm) - - for p in data["Productions"]: - head = p["Head"] - dic[head] %= Sentence(*[dic[term] for term in p["Body"]]) - - return G - - def copy(self): - G = Grammar() - G.Productions = self.Productions.copy() - G.nonTerminals = self.nonTerminals.copy() - G.terminals = self.terminals.copy() - G.pType = self.pType - G.startSymbol = self.startSymbol - G.Epsilon = self.Epsilon - G.EOF = self.EOF - G.symbDict = self.symbDict.copy() - - return G - - @property - def IsAugmentedGrammar(self): - augmented = 0 - for left, right in self.Productions: - if self.startSymbol == left: - augmented += 1 - if augmented <= 1: - return True - else: - return False - - def AugmentedGrammar(self, force=False): - if not self.IsAugmentedGrammar or force: - - G = self.copy() - # S, self.startSymbol, SS = self.startSymbol, None, self.NonTerminal('S\'', True) - S = G.startSymbol - G.startSymbol = None - SS = G.NonTerminal("S'", True) - if G.pType is AttributeProduction: - SS %= S + G.Epsilon, lambda x: x - else: - SS %= S + G.Epsilon - - return G - else: - return self.copy() - - # endchange - - -class Item: - def __init__(self, production, pos, lookaheads=[]): - self.production = production - self.pos = pos - self.lookaheads = frozenset(look for look in lookaheads) - - def __str__(self): - s = str(self.production.Left) + " -> " - if len(self.production.Right) > 0: - for i, c in enumerate(self.production.Right): - if i == self.pos: - s += "." - s += str(self.production.Right[i]) - if self.pos == len(self.production.Right): - s += "." - else: - s += "." - s += ", " + str(self.lookaheads)[10:-1] - return s - - def __repr__(self): - return str(self) - - def __eq__(self, other): - return ( - (self.pos == other.pos) - and (self.production == other.production) - and (set(self.lookaheads) == set(other.lookaheads)) - ) - - def __hash__(self): - return hash((self.production, self.pos, self.lookaheads)) - - @property - def IsReduceItem(self): - return len(self.production.Right) == self.pos - - @property - def NextSymbol(self): - if self.pos < len(self.production.Right): - return self.production.Right[self.pos] - else: - return None - - def NextItem(self): - if self.pos < len(self.production.Right): - return Item(self.production, self.pos + 1, self.lookaheads) - else: - return None - - def Preview(self, skip=1): - unseen = self.production.Right[self.pos + skip :] - return [unseen + (lookahead,) for lookahead in self.lookaheads] - - def Center(self): - return Item(self.production, self.pos) diff --git a/src/cool/code_generation/notebooks/cmp/semantic.py b/src/cool/code_generation/notebooks/cmp/semantic.py deleted file mode 100644 index a94be4146..000000000 --- a/src/cool/code_generation/notebooks/cmp/semantic.py +++ /dev/null @@ -1,250 +0,0 @@ -import itertools as itt -from collections import OrderedDict - - -class SemanticError(Exception): - @property - def text(self): - return self.args[0] - - -class Attribute: - def __init__(self, name, typex): - self.name = name - self.type = typex - - def __str__(self): - return f"[attrib] {self.name} : {self.type.name};" - - def __repr__(self): - return str(self) - - -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 Type: - def __init__(self, name: str): - self.name = name - self.attributes = [] - self.methods = [] - self.parent = None - - def set_parent(self, parent): - if self.parent is not None: - raise SemanticError(f"Parent type is already set for {self.name}.") - self.parent = parent - - def get_attribute(self, name: str): - try: - return next(attr for attr in self.attributes if attr.name == name) - except StopIteration: - if self.parent is None: - raise SemanticError( - f'Attribute "{name}" is not defined in {self.name}.' - ) - try: - return self.parent.get_attribute(name) - except SemanticError: - raise SemanticError( - f'Attribute "{name}" is not defined in {self.name}.' - ) - - def define_attribute(self, name: str, typex): - try: - self.get_attribute(name) - except SemanticError: - attribute = Attribute(name, typex) - self.attributes.append(attribute) - return attribute - else: - raise SemanticError( - f'Attribute "{name}" is already defined in {self.name}.' - ) - - def get_method(self, name: str): - try: - return next(method for method in self.methods if method.name == name) - except StopIteration: - if self.parent is None: - raise SemanticError(f'Method "{name}" is not defined in {self.name}.') - try: - return self.parent.get_method(name) - except SemanticError: - raise SemanticError(f'Method "{name}" is not defined in {self.name}.') - - def define_method( - self, name: str, param_names: list, param_types: list, return_type - ): - if name in (method.name for method in self.methods): - raise SemanticError(f'Method "{name}" already defined in {self.name}') - - method = Method(name, param_names, param_types, return_type) - self.methods.append(method) - return method - - def all_attributes(self, clean=True): - plain = ( - OrderedDict() if self.parent is None else self.parent.all_attributes(False) - ) - for attr in self.attributes: - 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: - 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) - output += "\n\t" if self.attributes else "" - output += "\n\t".join(str(x) for x in self.methods) - output += "\n" if self.methods else "" - output += "}\n" - return output - - def __repr__(self): - return str(self) - - -class ErrorType(Type): - def __init__(self): - Type.__init__(self, "") - - def conforms_to(self, other): - return True - - def bypass(self): - return True - - def __eq__(self, other): - return isinstance(other, Type) - - -class VoidType(Type): - def __init__(self): - Type.__init__(self, "") - - def conforms_to(self, other): - raise Exception("Invalid type: void type.") - - def bypass(self): - return True - - def __eq__(self, other): - return isinstance(other, VoidType) - - -class IntType(Type): - def __init__(self): - Type.__init__(self, "int") - - def __eq__(self, other): - return other.name == self.name or isinstance(other, IntType) - - -class Context: - def __init__(self): - self.types = {} - - def create_type(self, name: str): - if name in self.types: - raise SemanticError(f"Type with the same name ({name}) already in context.") - typex = self.types[name] = Type(name) - return typex - - def get_type(self, name: str): - try: - return self.types[name] - except KeyError: - raise SemanticError(f'Type "{name}" is not defined.') - - 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): - self.name = name - self.type = vtype - - -class Scope: - def __init__(self, parent=None): - self.locals = [] - self.parent = parent - self.children = [] - self.index = 0 if parent is None else len(parent) - - def __len__(self): - return len(self.locals) - - def create_child(self): - child = Scope(self) - self.children.append(child) - return child - - def define_variable(self, vname, vtype): - info = VariableInfo(vname, vtype) - self.locals.append(info) - return info - - def find_variable(self, vname, index=None): - locals = self.locals if index is None else itt.islice(self.locals, index) - try: - return next(x for x in locals if x.name == vname) - except StopIteration: - return ( - self.parent.find_variable(vname, self.index) - if self.parent is not None - else None - ) - - def is_defined(self, vname): - return self.find_variable(vname) is not None - - def is_local(self, vname): - return any(True for x in self.locals if x.name == vname) diff --git a/src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/__init__-checkpoint.py b/src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/__init__-checkpoint.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/automata-checkpoint.py b/src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/automata-checkpoint.py deleted file mode 100644 index 8c48eaccd..000000000 --- a/src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/automata-checkpoint.py +++ /dev/null @@ -1,10 +0,0 @@ -import zlib, base64 - -exec( - zlib.decompress( - base64.b64decode( - "eJzNWN1um0gUvucp6BWwRSjx1SrSrBRt4iR20rRJW9VCCI1hbE+LgTBDGjvKY+1r7DPtmR9gjIm3q+5KexPDzPn9zjdnDuGIEW4xVOF8SawHtMIMc15ZZ2hKNudVVVTWNcJZZm0QZTRnHOcJsQiiObeWKCO5tUIfNyVRojka44wRa4o+VjWxPiOcbyyMtrS0OEckr9ekwhz2tUBZIl6XGbFYEwGvNieWTddlUXG73KQFt8hTQkpuX8k16QckSsyYtaiKtZ2sy6DmNGON1u9FzjHNSXUPmSUZCNrvxqegk5KFHcc0pzyOXUayhQ/pcML8Bc0hbJ9DCIxyWuRM7FQcHXmgZgvRQIki9WMsgpT82ywpW4i76sFr1tcYcu0cNMuPRYLndYarDai0woYget6ePL8sisre2jS3masi8F5AFlbdU3/u+bdiy1AKKCdr5srobQCAACwP7q3vQPqcVHHseL5zlT/ijKZ2UmQZSYSeXSxsZd4Riv1QwtMonEfott3rgg9wmrpzbz+rIKUswVXqOo6nKkBKRrMijw3DRjFkyDpiuSCT7gXSxS5FRLCKN7ZdEV5X+xqhFIxCx4lASjPqzNBwdXTLCpcrGY+M5AJJDgZnBXfB2reUVsi5vnP8Na6WNEdHwbFI+kLkH+dFSlwl/048OpIYjs9WuCTIKTNgJSdPsJLhOcmQ4/jfacpX6MhfEbpcCb55uqyZT3VZG/bs1JQi588/HJsu4Ans2AROnU3FznAoWRNEQqskIxAT32TwOi+yVJrJWleKt8oiFE0EJCKyx0LiVnp/xcn475yMDzrRVkm6bKyei8fMH2u8qPoFRskuhEZeh31fq8W+PaYd6DqsFLMVSZVzTZsL3SQqUlYxe1zGHROGCKbI4gVJRYBdQgFeUpLI4td88avgvGabVJZdS7Wks/GpC23J+4m+pI/Jtbtx4TTUxCeeKJR87jcEuQjs8Uy9JRzZ345kdaGN9FQ8mbTRh76RzUko7URCA179QVeap6JBQYLBP8qs7SBJXVUkb3urhGhdPBJtZbMGUkkQgFbqzc4LPtQsQtNeZNYw33N2UDVUfqLwKOoYM20ZA/dox5Z9s0YiFTBkmdNtkwyvaL7s1LQt3QnsRCYlZdTRX8hMlaiEJFE9wUzLZKkOo3f2LBGJVMc1L9aYF3lTnA7dG3UpdbePFBDeUtSq7SC2jYyzcovSBrR+171FMsGboC5TsOnewpsO+sYyr4kkK1hd7UcpwpuhkMngWBcceHpCz3vLwMbvK5oReybcb9EsKItShjBwHxm5Dd1W26Y0F8L+gERTp4uGk0+qQE/ymrxQ3W4W4LIkuXrXqZuji/vLkyeRyBc45kWcLnAHgsg+Qc+QVYZeRyrs8pD0i8BTFtAUHclfFksqoM+uBKoT1t25hTADvQkKRRVn6ucVLIXGfNdWNwpIDG5Qj3NbX44N9uWBPG48g/iXCssEoKI5zJBq57KBeqK2L0WaS3fiNW8/nOylUpk05bnslUu9i5tLeSrQJKB5Sp4ayUs0CQtB+PYc2Em4hXj8uVxt+m/ejTFwGbx580YOXTunpFNEIiHLvkdyoTuRE5H8tk0PHLxH4moRqfv3ftJx670kk84bx3UOTHXxsY9HJpmAGekxOoa/I4SP9dT7NoWFGuFR+z6yesMnyPZmlCQ8BT0R+vMYHowZ4mVPeTSoPGqUR7vKSZj5MMihUAVYceFHBSeeR5HqWOmTfy+tuyHsw7IvFPTNA+LqKZL+WjzvT3YK9wVBBd6CJTU49qpj7urx3f4iz3gtT0wHYAfdSBTxuX5p6wJ3pDsRpfIzb7dEQPEEdHLMD5Tq6H9dqhbXFnlzltL4HfsDY7m5p7FV0BqFNq+mtqADDkYHHIz2HPw7tWua2PHg6ap7FfupCg2ehzr6T9CvjUJ03nqIHcZp+Kv9jLKvBXwfiY92gaSY8mHkqSlbxcqse+d3V8JUwPJJwnqOytIdunA0PWqBwJ1Ia/bK0FKr8VigcI1cdxYyMeSJyVKoztRnyrsiV/O1XDwXOEyEZ3caplEgvhhgbIPrm9NHIppyKsSmgfhIYj0LcuvaM2rxKZxEzQWjo/H6NREyyIhVYRveySTvhMlP7ZgfSQwlbvEa5u813eouYk4QU2Sg7v7CmLszMIgpC6KYBmtSwSeVcUf2b89hqSF7ElR9VQ9YUXPFdCo5/0PRddlP4XusqEs1fYnVlVj9ER6Ji1aHv/LUN8USpmoEA4Ten8MX3jd4mKLE6kb/nRN/COaDhbDsq505dtojE5Nj17PuptRv/y3CuXslw3tUDlT1NSRj/3oXY5Pwj9HOfxPmaBpeA+P7NBZ7X9GVHm/UnNZejbOQ+uPdgWb/hlRC6Ktlf0AhHUyAap4G7cdknxfg5KGNYro31PaC7iYeNQddef4Hf+Y/eNZffhu9yA==" - ) - ) -) -# Created by pyminifier (https://github.com/liftoff/pyminifier) diff --git a/src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/evaluation-checkpoint.py b/src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/evaluation-checkpoint.py deleted file mode 100644 index c1735b595..000000000 --- a/src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/evaluation-checkpoint.py +++ /dev/null @@ -1,10 +0,0 @@ -import zlib, base64 - -exec( - zlib.decompress( - base64.b64decode( - "eJxdUMFuwjAMvecrfGy3qoLrJN86YGViCO2GECrF1SLSpErcqf37OUWwsZPtZ/v5+TXetVC3Xd6NtWs7bciDbjvnGV4/FmqJmsmrE1oaWFnUQdvAla1JFbhxltQaDVm1QLJ9S75iUmdqgL4r00tx7CofKGmyMn1RoBuwjqEB56ekFAw8ce+tggaXSZMqKCWWEge8kSQnaWSRQ0EVAok2K1iZ5uwuZI88dpSJWmlfyWB4EJF03p37mrWzkSXT9ou8/HU+xgHCImrbZAZ/5xSMf6q8Yvb61DMFBYz74vCUrBOTPs/l5OV/vZ8d8N8J+U5e1tkOtIVFYrJ5PBn92OVv4ZN8q21lInR78LLXBx2giBBLjtO/hgYByASaZld4miy7b+0QV/k7NRyxLY6yGDO5swVhi54X0+bEj9vkknF6P3H3azXZFEekGWlmh7u1150HxkmQSP0BhJm25Q==" - ) - ) -) -# Created by pyminifier (https://github.com/liftoff/pyminifier) diff --git a/src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/parsing-checkpoint.py b/src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/parsing-checkpoint.py deleted file mode 100644 index af4ca2a41..000000000 --- a/src/cool/code_generation/notebooks/cmp/tools/.ipynb_checkpoints/parsing-checkpoint.py +++ /dev/null @@ -1,21 +0,0 @@ -import zlib, base64 - -exec( - zlib.decompress( - base64.b64decode( - "eJytVVtr2zAUfvevEH2yqWfa14AeypKGlXlNL5SCMUZO5FTMlhRZbpZu++87ujiOm3QwGJRU56pzvu8cuVKiQUxTpYWoW8QaKZRGrK3ZkgaVMS4bmXSaDcbPgmvCOFUPVAcrWqGlaGSnaVGLJamLiqlWh/a3jUktX0g0CVCFnSZAEltlgKb4MFMYBUirHbiiBZbJl3YmW1YLHiD6Y0mldoZrUrc0QKxCC6OYJi3VBXWeJgMFszFUQqE5YhxJI6EUV9k8N6dp0skV0TRMIyNCIi40SpOlK6Xtk9kwVCpKvsOpT3t8oaK6UxxNR0C4VsO5a/zn7wDN8KPqoHBTV2nqmieAecM49GPrzcp8DEcZOW/tvLngj+MAnR/ht31hNUUzY5/1UNkkty7JQolVt9RMcJsDPePb5CuttDlLON+z9YsVrgCvZ4uXpwQ6B5W0qoGPXntUCEI3+ORUxNJaZ7/wNHkhalV4Nm569dWR2iNcjREWdS22AHHssB6P2GaEObXSX7DcnMJyk82TVhOlH3ZNKep3DvNkdnv9PxG/xxuPuIlmcbszCSjvGqoMEjJygMPAtjvYjm9DD86A7iBDu8udsKcN8pWYZjJm3nLI3oHxA7rcQxCCx/llDHfSKHKRQNVdv0pV6ZVQXFV+sErjkPuB2I0ltuxYvSokUS3j60KTsqZ7cmPP9pjkCo5OH8B+9xSTk7g/Y9LDvoBjj7oJoCagyhb5ZDTuafYc0zwhUlK+Ckn0fvCdHWfEwGr6hgynOx8uMTvlogd6Tt0z5ujwJg9ZaiFrqBYrUUhFVwxafRUFF4Wiyw4wfBWAXooNYx5Ef3aIWcHCyQY8xYAnNJTCRwAZt4lvkB0qTODRa+cdxdhR4FNLa5xT/BHrUCc42CbDrZ38J5zZnYvHWwmWpsEX8O8NZ0ZyC2kW396+xk+JFNK9SQRvs6bJ/bu/hi0ar5BRYkwm+2EGyV7aT3D/OUAHXwRkKjjHl8E7rVSM6/BsppRQCboq4csJPSZJcuaXxXNpgApGocNwLHCarWOSZxd+ee3bYGZJEb6mYU15uHDTHH26jO1f1Ff11A+V98hY7m9+21tOjNs/1u2lt/1sNsEfuhaMXQ==" - ) - ) -) -# Created by pyminifier (https://github.com/liftoff/pyminifier) - -deprecated_metodo_predictivo_no_recursivo = metodo_predictivo_no_recursivo - - -def metodo_predictivo_no_recursivo(G, M=None, firsts=None, follows=None): - parser = deprecated_metodo_predictivo_no_recursivo(G, M, firsts, follows) - - def updated(tokens): - return parser([t.token_type for t in tokens]) - - return updated diff --git a/src/cool/code_generation/notebooks/cmp/tools/__init__.py b/src/cool/code_generation/notebooks/cmp/tools/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/cool/code_generation/notebooks/cmp/tools/automata.py b/src/cool/code_generation/notebooks/cmp/tools/automata.py deleted file mode 100644 index 8c48eaccd..000000000 --- a/src/cool/code_generation/notebooks/cmp/tools/automata.py +++ /dev/null @@ -1,10 +0,0 @@ -import zlib, base64 - -exec( - zlib.decompress( - base64.b64decode( - "eJzNWN1um0gUvucp6BWwRSjx1SrSrBRt4iR20rRJW9VCCI1hbE+LgTBDGjvKY+1r7DPtmR9gjIm3q+5KexPDzPn9zjdnDuGIEW4xVOF8SawHtMIMc15ZZ2hKNudVVVTWNcJZZm0QZTRnHOcJsQiiObeWKCO5tUIfNyVRojka44wRa4o+VjWxPiOcbyyMtrS0OEckr9ekwhz2tUBZIl6XGbFYEwGvNieWTddlUXG73KQFt8hTQkpuX8k16QckSsyYtaiKtZ2sy6DmNGON1u9FzjHNSXUPmSUZCNrvxqegk5KFHcc0pzyOXUayhQ/pcML8Bc0hbJ9DCIxyWuRM7FQcHXmgZgvRQIki9WMsgpT82ywpW4i76sFr1tcYcu0cNMuPRYLndYarDai0woYget6ePL8sisre2jS3masi8F5AFlbdU3/u+bdiy1AKKCdr5srobQCAACwP7q3vQPqcVHHseL5zlT/ijKZ2UmQZSYSeXSxsZd4Riv1QwtMonEfott3rgg9wmrpzbz+rIKUswVXqOo6nKkBKRrMijw3DRjFkyDpiuSCT7gXSxS5FRLCKN7ZdEV5X+xqhFIxCx4lASjPqzNBwdXTLCpcrGY+M5AJJDgZnBXfB2reUVsi5vnP8Na6WNEdHwbFI+kLkH+dFSlwl/048OpIYjs9WuCTIKTNgJSdPsJLhOcmQ4/jfacpX6MhfEbpcCb55uqyZT3VZG/bs1JQi588/HJsu4Ans2AROnU3FznAoWRNEQqskIxAT32TwOi+yVJrJWleKt8oiFE0EJCKyx0LiVnp/xcn475yMDzrRVkm6bKyei8fMH2u8qPoFRskuhEZeh31fq8W+PaYd6DqsFLMVSZVzTZsL3SQqUlYxe1zGHROGCKbI4gVJRYBdQgFeUpLI4td88avgvGabVJZdS7Wks/GpC23J+4m+pI/Jtbtx4TTUxCeeKJR87jcEuQjs8Uy9JRzZ345kdaGN9FQ8mbTRh76RzUko7URCA179QVeap6JBQYLBP8qs7SBJXVUkb3urhGhdPBJtZbMGUkkQgFbqzc4LPtQsQtNeZNYw33N2UDVUfqLwKOoYM20ZA/dox5Z9s0YiFTBkmdNtkwyvaL7s1LQt3QnsRCYlZdTRX8hMlaiEJFE9wUzLZKkOo3f2LBGJVMc1L9aYF3lTnA7dG3UpdbePFBDeUtSq7SC2jYyzcovSBrR+171FMsGboC5TsOnewpsO+sYyr4kkK1hd7UcpwpuhkMngWBcceHpCz3vLwMbvK5oReybcb9EsKItShjBwHxm5Dd1W26Y0F8L+gERTp4uGk0+qQE/ymrxQ3W4W4LIkuXrXqZuji/vLkyeRyBc45kWcLnAHgsg+Qc+QVYZeRyrs8pD0i8BTFtAUHclfFksqoM+uBKoT1t25hTADvQkKRRVn6ucVLIXGfNdWNwpIDG5Qj3NbX44N9uWBPG48g/iXCssEoKI5zJBq57KBeqK2L0WaS3fiNW8/nOylUpk05bnslUu9i5tLeSrQJKB5Sp4ayUs0CQtB+PYc2Em4hXj8uVxt+m/ejTFwGbx580YOXTunpFNEIiHLvkdyoTuRE5H8tk0PHLxH4moRqfv3ftJx670kk84bx3UOTHXxsY9HJpmAGekxOoa/I4SP9dT7NoWFGuFR+z6yesMnyPZmlCQ8BT0R+vMYHowZ4mVPeTSoPGqUR7vKSZj5MMihUAVYceFHBSeeR5HqWOmTfy+tuyHsw7IvFPTNA+LqKZL+WjzvT3YK9wVBBd6CJTU49qpj7urx3f4iz3gtT0wHYAfdSBTxuX5p6wJ3pDsRpfIzb7dEQPEEdHLMD5Tq6H9dqhbXFnlzltL4HfsDY7m5p7FV0BqFNq+mtqADDkYHHIz2HPw7tWua2PHg6ap7FfupCg2ehzr6T9CvjUJ03nqIHcZp+Kv9jLKvBXwfiY92gaSY8mHkqSlbxcqse+d3V8JUwPJJwnqOytIdunA0PWqBwJ1Ia/bK0FKr8VigcI1cdxYyMeSJyVKoztRnyrsiV/O1XDwXOEyEZ3caplEgvhhgbIPrm9NHIppyKsSmgfhIYj0LcuvaM2rxKZxEzQWjo/H6NREyyIhVYRveySTvhMlP7ZgfSQwlbvEa5u813eouYk4QU2Sg7v7CmLszMIgpC6KYBmtSwSeVcUf2b89hqSF7ElR9VQ9YUXPFdCo5/0PRddlP4XusqEs1fYnVlVj9ER6Ji1aHv/LUN8USpmoEA4Ten8MX3jd4mKLE6kb/nRN/COaDhbDsq505dtojE5Nj17PuptRv/y3CuXslw3tUDlT1NSRj/3oXY5Pwj9HOfxPmaBpeA+P7NBZ7X9GVHm/UnNZejbOQ+uPdgWb/hlRC6Ktlf0AhHUyAap4G7cdknxfg5KGNYro31PaC7iYeNQddef4Hf+Y/eNZffhu9yA==" - ) - ) -) -# Created by pyminifier (https://github.com/liftoff/pyminifier) diff --git a/src/cool/code_generation/notebooks/cmp/tools/evaluation.py b/src/cool/code_generation/notebooks/cmp/tools/evaluation.py deleted file mode 100644 index c1735b595..000000000 --- a/src/cool/code_generation/notebooks/cmp/tools/evaluation.py +++ /dev/null @@ -1,10 +0,0 @@ -import zlib, base64 - -exec( - zlib.decompress( - base64.b64decode( - "eJxdUMFuwjAMvecrfGy3qoLrJN86YGViCO2GECrF1SLSpErcqf37OUWwsZPtZ/v5+TXetVC3Xd6NtWs7bciDbjvnGV4/FmqJmsmrE1oaWFnUQdvAla1JFbhxltQaDVm1QLJ9S75iUmdqgL4r00tx7CofKGmyMn1RoBuwjqEB56ekFAw8ce+tggaXSZMqKCWWEge8kSQnaWSRQ0EVAok2K1iZ5uwuZI88dpSJWmlfyWB4EJF03p37mrWzkSXT9ou8/HU+xgHCImrbZAZ/5xSMf6q8Yvb61DMFBYz74vCUrBOTPs/l5OV/vZ8d8N8J+U5e1tkOtIVFYrJ5PBn92OVv4ZN8q21lInR78LLXBx2giBBLjtO/hgYByASaZld4miy7b+0QV/k7NRyxLY6yGDO5swVhi54X0+bEj9vkknF6P3H3azXZFEekGWlmh7u1150HxkmQSP0BhJm25Q==" - ) - ) -) -# Created by pyminifier (https://github.com/liftoff/pyminifier) diff --git a/src/cool/code_generation/notebooks/cmp/tools/parsing.py b/src/cool/code_generation/notebooks/cmp/tools/parsing.py deleted file mode 100644 index 0b54d9177..000000000 --- a/src/cool/code_generation/notebooks/cmp/tools/parsing.py +++ /dev/null @@ -1,40 +0,0 @@ -import zlib, base64 - -exec( - zlib.decompress( - base64.b64decode( - "eJytVVtr2zAUfvevEH2yqWfa14AeypKGlXlNL5SCMUZO5FTMlhRZbpZu++87ujiOm3QwGJRU56pzvu8cuVKiQUxTpYWoW8QaKZRGrK3ZkgaVMS4bmXSaDcbPgmvCOFUPVAcrWqGlaGSnaVGLJamLiqlWh/a3jUktX0g0CVCFnSZAEltlgKb4MFMYBUirHbiiBZbJl3YmW1YLHiD6Y0mldoZrUrc0QKxCC6OYJi3VBXWeJgMFszFUQqE5YhxJI6EUV9k8N6dp0skV0TRMIyNCIi40SpOlK6Xtk9kwVCpKvsOpT3t8oaK6UxxNR0C4VsO5a/zn7wDN8KPqoHBTV2nqmieAecM49GPrzcp8DEcZOW/tvLngj+MAnR/ht31hNUUzY5/1UNkkty7JQolVt9RMcJsDPePb5CuttDlLON+z9YsVrgCvZ4uXpwQ6B5W0qoGPXntUCEI3+ORUxNJaZ7/wNHkhalV4Nm569dWR2iNcjREWdS22AHHssB6P2GaEObXSX7DcnMJyk82TVhOlH3ZNKep3DvNkdnv9PxG/xxuPuIlmcbszCSjvGqoMEjJygMPAtjvYjm9DD86A7iBDu8udsKcN8pWYZjJm3nLI3oHxA7rcQxCCx/llDHfSKHKRQNVdv0pV6ZVQXFV+sErjkPuB2I0ltuxYvSokUS3j60KTsqZ7cmPP9pjkCo5OH8B+9xSTk7g/Y9LDvoBjj7oJoCagyhb5ZDTuafYc0zwhUlK+Ckn0fvCdHWfEwGr6hgynOx8uMTvlogd6Tt0z5ujwJg9ZaiFrqBYrUUhFVwxafRUFF4Wiyw4wfBWAXooNYx5Ef3aIWcHCyQY8xYAnNJTCRwAZt4lvkB0qTODRa+cdxdhR4FNLa5xT/BHrUCc42CbDrZ38J5zZnYvHWwmWpsEX8O8NZ0ZyC2kW396+xk+JFNK9SQRvs6bJ/bu/hi0ar5BRYkwm+2EGyV7aT3D/OUAHXwRkKjjHl8E7rVSM6/BsppRQCboq4csJPSZJcuaXxXNpgApGocNwLHCarWOSZxd+ee3bYGZJEb6mYU15uHDTHH26jO1f1Ff11A+V98hY7m9+21tOjNs/1u2lt/1sNsEfuhaMXQ==" - ) - ) -) -# Created by pyminifier (https://github.com/liftoff/pyminifier) - -deprecated_metodo_predictivo_no_recursivo = metodo_predictivo_no_recursivo - - -def metodo_predictivo_no_recursivo(G, M=None, firsts=None, follows=None): - parser = deprecated_metodo_predictivo_no_recursivo(G, M, firsts, follows) - - def updated(tokens): - return parser([t.token_type for t in tokens]) - - return updated - - -exec( - zlib.decompress( - base64.b64decode( - "eJx9U8GO2jAQvfMVZi9JtCFarqiuVLUsRUilWranCEUmGcBaY0e2s3TV7b/X9iQhpaiXxJ4Zv3nzZqYUzBiyOfK9fYKqKeE70wb0bEQ2X5ePzzQKv2hEnuZffnye0wj/zrBe0Wi9cocK9qQouOS2KGIDYp8u0lfQO2WAPjJhIHFoxDuyBV10xy6i/XdmVlquJP31uzMclFWDa7FruKiK2rHk8lBYthMQJy2JWz7/KhDQjBsg35RdnmoBJ5AWqrnWSvfPi5IJ0dVwTg9gC+OFKXRQZliMZeULzR+27lw22ihNH9xRNbZuLM29WdWgma/F4P185ALIs27AA3gECzTg5JOpDyBCqRd2BFbRc46gwcz3fwk2qzWXNg4v0+jDZDJ5f3efj1HavZptE3wXhyRpj5tIZQmXQ6EDF4KQ/4QnA+ddkCojn3ZKW6dulmV36NdgGy2dsNI3kSBuatmBDvLkV9hdZW27MTSMGjK6qJexugZZxZcITBsEuKd5D+lTBti2I/d06m8grtPgBP83D4ZgImxq53ZJ0BxS7lT1Rp0pWPZKE/N22inhRdbgGmagin1MgtmQdFarOkYQ4pYPtB3aHcmA0RV5PSUkLES/Gq2wvaa9LoGfj9jeVmG9mo1uUbrJKOxu5mzabi7s2lABEsfRRU6HI4HK+Tb7wbteJ8fJQIwx6aUPCdI1uCbt1s5/llB7dxwt5SsTvGqLGY/HUTL6AyImjec=" - ) - ) -) -# Created by pyminifier (https://github.com/liftoff/pyminifier) - -exec( - zlib.decompress( - base64.b64decode( - "eJyFVltP4zoQfu+v8D41OcfHWl6RLJ0KekEgqLg+dKtiGrf1ktiR7RS6iP9+ZuykSYE9ywOKLzPzzTffjLuypiDLomSVV7kjqiiN9eTEaC+UlvZG+t6queKNyR0rhXVKr5urS1OUlZeLlbLOO9osc7MUedxsHZQ7PFa5tI31mZdFL5MrIl9LobMkozo97pEdz9ilfPU3u+LJ5D2iVmRHlCOXRktiLNHGkx07c7C+lbZQWuRgRaz0ldWzeY/c824KSdojKzAbEqVJxqZWbpV8STASeeZfQE40HYINuWdVmQkvk2dYCeckQMbY92wZ3buFLJ3Kje41wTGjpLQmo9/pfYpRcYGBdwy/qqVXRrt5yBpDW+lcMkAsOX97j0DD/QHCWwETJ1J7aTEJ4u0OdyG/fLaCPIG3pSw9OZe7obXGhkM84vfcxcTbJDKWG/MsNlJkLm0AvwXArx1sFBbGUTR/TkMGr/QZAeVMwV2XpO8RfG5cZYE3e5QMYt0mh7T/NYAwV/zWVrJHXjZQeHKFCK/4SOQO9oj4VKc2/0lIRjDQgQRpdBSSBh+TJi+xT6YldJIGjGvjTQ1wSqNEOYqI/qycXzxLq2UewSD8usKdMxRbNEP5YemDdf8xbj6SAu6SJ4lF3qpMZijVx0/OH/s9MuDQB7+kRl6jugPzaVtvtO3qnvNpm1k47SKT4PdDDSKotG04UXlTCC+adrvxwBctqhyaHThfQGw4BnEFsp4qlWeLi+ujRW1ndDLu8JJLWDPnha0BdgWdcn5E+2MrikLYPS2iWheo3gwI0PxwVoBv2JyN2fBqND/UQdiD0zP+23iz7yB/wwOHZ9BrrbR5NKcoE98hfWbmKUq0y5kHNQHFPBCTtHcnKUXVwtmWzzxE2vA3f2zfGxlvUZsXfAudUgbV3vHN7GJey3eK5RwzX48m9/eY6XZSuaDrQxwXAQcha75X7AQU2xVSjYegDlCI6+CG4CBSGhusnQ7kBdCsEc2X8+FD7HUdu7b6Hy7gb8tEWWI7rsP6joksW3grtFNYlmTKLkUh6QuyysC6lVjyhexaeds/PDM3G7Xy1xKqL6dwAopd5iBLAmqN6+TTDVQuynoRdV07XHjxlMvkIQz/MX9gYzZoRFqrN2nStfzrlqjLrOgpFlrqqpAWOQshQ4Ee2FbaJ+PkcWmV9omi/R++D//0D0/67KdROnHeJq9xvqKbU1S6lyle6gdyT5nKXrmqo4VYsYCShyP83E+P2jwWOAySMxfZwBaJ26SE16TtobgHd0t2IVeeHzZbbQKpLKxcK4clfGAiPhGJpLFHKexdnVOcimlUSBhMjfG+G7pvT3P4W9fT4PZ6eHp3MqRl7bfjdvrh5wEJnXPK1qDWKMC04SfkNwUuur8T/hz7ZnI2uqXrr1I6NMR2rc2wI/7FIqhlIf3GZLX89rdHFIgKEqkH6nloZGBnhO/MaHY+5/yS9oOS/4nFw4P41WxAw69ytfTfvn2DoRqtLnv/ATLgLos=" - ) - ) -) -# Created by pyminifier (https://github.com/liftoff/pyminifier) diff --git a/src/cool/code_generation/notebooks/cmp/tools/regex.py b/src/cool/code_generation/notebooks/cmp/tools/regex.py deleted file mode 100644 index 84d31b26d..000000000 --- a/src/cool/code_generation/notebooks/cmp/tools/regex.py +++ /dev/null @@ -1,10 +0,0 @@ -import zlib, base64 - -exec( - zlib.decompress( - base64.b64decode( - "eJytVsFu2zgQvesreFhDVE0IdY8BCNTZtVRg2yyaOKgdwxAYiYrZSKRK0qnttp+1v7HftCQlWbLWTXPYgwzyzXDem9Fw5FyKEqRlFRKlASsrITWYalGy9EpkFF0yTuTeLW/blZe3Z6p9KsqKFVS2R2NJypLIzkULUaiQbE1IoknjBv+IpujKPC2epIVQW0l7gOAp0ZQTzQTv4JJxVrLDAN1yu+U5SbRIspwEQ376RIqtO9QKbRCaVEQqOvS3IOMPrXNJtchEUkmasVSzJ5FwkUiabo3Xk+gObzUrVHtoLh4p975gk6uXFkQpMKsUKwS3NYRdjYMLD2Q0PyqCiha5BYGkeis5+AKVNrjCE5Sb11EovHq9RloSrphNSeFvPwJP4l74hvBmX96L4sV8CttlWNDdGfI3R/LJgBy+Riq4mBgNKe4YGwm/1y/WaTh2kGV7a+Oy1JR2I7JakaiotIKsMNqvwLBNGg/vI+6FbwhvbS84uq53f8FXuHBI/pzXNdjAz7vGR642Wde0/zf5yVUYiogi3LF6NrCkD3RnLoLpPnagEmq60yhG6pFVydcNM++yIql5oXNZ823wau2BOMbfdheuZ+EOxavdOsiFBDvA+Mr/7iP/lXmgeQLz/PO3v/7hAetwMA7AUljlLAdDGkB4Bg4hU24LXYLAZKQZ31Kz1nLvoM84jlcHIwTQXUorDf6k+5mUQjbWWtnBKPOV6zF/HRiL68miDrEJSVVRnsHPxnLc1Af933wUh7O/osDYmgJvXLnut6zIkod6bjl9MY7bnQdmOA6vBJ9TWVoq6M985CrngTmK0BQt0BLdnTop6M9BBKZgAZbgzjeuFfqAbtAlIujWuPb8voNXAIIA1DkBU1jLOcLz8QIVpLzPCNggdaFWb9bIMNBTcGLqtRjhajzr49dwYweEPRM4u0m8Hg19L+tjchjhaLx8IdXS6OqjUdQyTSzT8lmmaISn47sXMt2N8Ic++tERBc7wDMd0hEkfTWEjzRhu+wbZM9yMZ+PLoa5jk8RejAct4r3Hz38QYBw0A+Ha3sVm3iaJ+XbpJHHzFrlb+t9LGZmuqKfAJzeM7SJ0vtj9un0zGQTHn8Ja2xGBzitoGVNzOVpGe0lPIzcp9gIaqlQ82LnhxkZwdnKdpXwulQ0ezqT6yJmhVB+yFxu/hxu7mOPTTzXMkcPf4Xl4/IRZYIG7PwDwnUUe8dn/DXARdMk/ev8C0IsPHg==" - ) - ) -) -# Created by pyminifier (https://github.com/liftoff/pyminifier) diff --git a/src/cool/code_generation/notebooks/cmp/utils.py b/src/cool/code_generation/notebooks/cmp/utils.py deleted file mode 100644 index f1481286f..000000000 --- a/src/cool/code_generation/notebooks/cmp/utils.py +++ /dev/null @@ -1,241 +0,0 @@ -from cmp.pycompiler import Production, Sentence, Symbol, EOF, Epsilon - - -class ContainerSet: - def __init__(self, *values, contains_epsilon=False): - self.set = set(values) - self.contains_epsilon = contains_epsilon - - def add(self, value): - n = len(self.set) - self.set.add(value) - return n != len(self.set) - - def extend(self, values): - change = False - for value in values: - change |= self.add(value) - return change - - def set_epsilon(self, value=True): - last = self.contains_epsilon - self.contains_epsilon = value - return last != self.contains_epsilon - - def update(self, other): - n = len(self.set) - self.set.update(other.set) - return n != len(self.set) - - def epsilon_update(self, other): - return self.set_epsilon(self.contains_epsilon | other.contains_epsilon) - - def hard_update(self, other): - return self.update(other) | self.epsilon_update(other) - - def find_match(self, match): - for item in self.set: - if item == match: - return item - return None - - def __len__(self): - return len(self.set) + int(self.contains_epsilon) - - def __str__(self): - return "%s-%s" % (str(self.set), self.contains_epsilon) - - def __repr__(self): - return str(self) - - def __iter__(self): - return iter(self.set) - - def __nonzero__(self): - return len(self) > 0 - - def __eq__(self, other): - if isinstance(other, set): - return self.set == other - return ( - isinstance(other, ContainerSet) - and self.set == other.set - and self.contains_epsilon == other.contains_epsilon - ) - - -def inspect(item, grammar_name="G", mapper=None): - try: - return mapper[item] - except (TypeError, KeyError): - if isinstance(item, dict): - items = ",\n ".join( - f"{inspect(key, grammar_name, mapper)}: {inspect(value, grammar_name, mapper)}" - for key, value in item.items() - ) - return f"{{\n {items} \n}}" - elif isinstance(item, ContainerSet): - args = ( - f'{ ", ".join(inspect(x, grammar_name, mapper) for x in item.set) } ,' - if item.set - else "" - ) - return f"ContainerSet({args} contains_epsilon={item.contains_epsilon})" - elif isinstance(item, EOF): - return f"{grammar_name}.EOF" - elif isinstance(item, Epsilon): - return f"{grammar_name}.Epsilon" - elif isinstance(item, Symbol): - return f"G['{item.Name}']" - elif isinstance(item, Sentence): - items = ", ".join(inspect(s, grammar_name, mapper) for s in item._symbols) - return f"Sentence({items})" - elif isinstance(item, Production): - left = inspect(item.Left, grammar_name, mapper) - right = inspect(item.Right, grammar_name, mapper) - return f"Production({left}, {right})" - elif isinstance(item, tuple) or isinstance(item, list): - ctor = ("(", ")") if isinstance(item, tuple) else ("[", "]") - return f'{ctor[0]} {("%s, " * len(item)) % tuple(inspect(x, grammar_name, mapper) for x in item)}{ctor[1]}' - else: - raise ValueError(f"Invalid: {item}") - - -def pprint(item, header=""): - if header: - print(header) - - if isinstance(item, dict): - for key, value in item.items(): - print(f"{key} ---> {value}") - elif isinstance(item, list): - print("[") - for x in item: - print(f" {repr(x)}") - print("]") - else: - print(item) - - -class Token: - """ - Basic token class. - - Parameters - ---------- - lex : str - Token's lexeme. - token_type : Enum - Token's type. - """ - - def __init__(self, lex, token_type): - self.lex = lex - self.token_type = token_type - - def __str__(self): - return f"{self.token_type}: {self.lex}" - - def __repr__(self): - return str(self) - - @property - def is_valid(self): - return True - - -class UnknownToken(Token): - def __init__(self, lex): - Token.__init__(self, lex, None) - - def transform_to(self, token_type): - return Token(self.lex, token_type) - - @property - def is_valid(self): - return False - - -def tokenizer(G, fixed_tokens): - def decorate(func): - def tokenize_text(text): - tokens = [] - for lex in text.split(): - try: - token = fixed_tokens[lex] - except KeyError: - token = UnknownToken(lex) - try: - token = func(token) - except TypeError: - pass - tokens.append(token) - tokens.append(Token("$", G.EOF)) - return tokens - - if hasattr(func, "__call__"): - return tokenize_text - elif isinstance(func, str): - return tokenize_text(func) - else: - raise TypeError('Argument must be "str" or a callable object.') - - return decorate - - -class DisjointSet: - def __init__(self, *items): - self.nodes = {x: DisjointNode(x) for x in items} - - def merge(self, items): - items = (self.nodes[x] for x in items) - try: - head, *others = items - for other in others: - head.merge(other) - except ValueError: - pass - - @property - def representatives(self): - return {n.representative for n in self.nodes.values()} - - @property - def groups(self): - return [ - [n for n in self.nodes.values() if n.representative == r] - for r in self.representatives - ] - - def __len__(self): - return len(self.representatives) - - def __getitem__(self, item): - return self.nodes[item] - - def __str__(self): - return str(self.groups) - - def __repr__(self): - return str(self) - - -class DisjointNode: - def __init__(self, value): - self.value = value - self.parent = self - - @property - def representative(self): - if self.parent != self: - self.parent = self.parent.representative - return self.parent - - def merge(self, other): - other.representative.parent = self.representative - - def __str__(self): - return str(self.value) - - def __repr__(self): - return str(self) diff --git a/src/cool/code_generation/notebooks/cmp/visitor.py b/src/cool/code_generation/notebooks/cmp/visitor.py deleted file mode 100644 index 0bcba712e..000000000 --- a/src/cool/code_generation/notebooks/cmp/visitor.py +++ /dev/null @@ -1,85 +0,0 @@ -# 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/src/cool/code_generation/notebooks/cp12.ipynb b/src/cool/code_generation/notebooks/cp12.ipynb deleted file mode 100644 index 44bfb43ab..000000000 --- a/src/cool/code_generation/notebooks/cp12.ipynb +++ /dev/null @@ -1,1073 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Clase Práctica #12 (Compilación)\n", - "\n", - "En esta clase práctica estaremos implementando la fase de análisis semántico para la extensión del lenguaje **xCOOL** presentada en conferencia. Recordemos las reglas del lenguaje.\n", - "\n", - "### Reglas sintácticas\n", - "\n", - "El lenguaje tiene tres tipos de instrucciones: `let`, `def` y `print`:\n", - "\n", - "- `let = ` define una variable denominada `` y le asigna el valor de ``.\n", - "- `def (, , ...) -> ` define una nueva función `` con los argumentos ``.\n", - "- `print ` imprime el valor de una expresión.\n", - "\n", - "Las expresiones pueden ser de varios tipos:\n", - "\n", - "- Expresiones aritméticas.\n", - "- Invocación de funciones predefinidas (`sin`, `cos`, `pow`, ...).\n", - "- Invocación de funciones definidas en el programa.\n", - "\n", - "### Reglas semánticas\n", - "\n", - "- Una variable solo puede ser definida una vez en todo el programa.\n", - "- Los nombres de variables y funciones no comparten el mismo ámbito.\n", - "- No se pueden redefinir las funciones predefinidas.\n", - "- Una función puede tener distintas definiciones siempre que tengan distinta cantidad de argumentos.\n", - "- Toda variable y función tiene que haber sido definida antes de ser usada en una expresión (salvo las funciones pre-definidas).\n", - "- Todos los argumentos definidos en una misma función tienen que ser diferentes entre sí, aunque pueden ser iguales a variables definidas globalmente o argumentos definidos en otras funciones.\n", - "- En el cuerpo de una función, los nombres de los argumentos ocultan los nombres de variables iguales." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Jerarquía del AST\n", - "\n", - "Comencemos por definir los tipos de nodos que compondrán el AST. Recordemos que estos nodos deben ser capaces de atrapar toda la semántica del programa.\n", - "\n", - "### Nivel 0\n", - "\n", - "En un primer nivel tenemos la clase `Node` que engloba todos los tipos de nodos del AST. Este nodo, a pesar de ser la raíz de la jerarquía, no coincide con la raíz del AST. Los nodos del AST son instancias concretas de las clases definidas en esta jerarquía y siguen una estructura dependiente de la cadena que se parsea." - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "metadata": {}, - "outputs": [], - "source": [ - "class Node:\n", - " pass" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Nivel 1\n", - "\n", - "En un segundo nivel tenemos las clases `Program`, `Statement` y `Expression`, siendo estas dos últimas una generalización de varios tipos de instrucciones del lenguaje. `ProgramNode` coincide con la raíz del AST pues representa la base de todo programa en **xCOOL**: una lista de _statements_." - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "metadata": {}, - "outputs": [], - "source": [ - "class ProgramNode(Node):\n", - " def __init__(self, statements):\n", - " self.statements = statements\n", - " \n", - "class StatementNode(Node):\n", - " pass\n", - " \n", - "class ExpressionNode(Node):\n", - " pass" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Nivel 2\n", - "\n", - "Continuamos explorando a lo ancho la jerarquía del AST, y encontramos los 3 tipos de _statements_ en los que se divide un programa: `VarDeclaration` para declarar variables, `FuncDeclaration` para definir métodos, y `PrintNode` para escribir el resultado de evaluar determinada expresión. Además, se proveen dos generalizaciones de expresiones: `AtomicNode` y `BinaryNode`." - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "metadata": {}, - "outputs": [], - "source": [ - "class VarDeclarationNode(StatementNode):\n", - " def __init__(self, idx, expr):\n", - " self.id = idx\n", - " self.expr = expr\n", - "\n", - "class FuncDeclarationNode(StatementNode):\n", - " def __init__(self, idx, params, body):\n", - " self.id = idx\n", - " self.params = params\n", - " self.body = body\n", - "\n", - "class PrintNode(StatementNode):\n", - " def __init__(self, expr):\n", - " self.expr = expr\n", - "\n", - "class AtomicNode(ExpressionNode):\n", - " def __init__(self, lex):\n", - " self.lex = lex\n", - "\n", - "class BinaryNode(ExpressionNode):\n", - " def __init__(self, left, right):\n", - " self.left = left\n", - " self.right = right" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Nivel 3\n", - "\n", - "Finalmente alcanzamos el máximo nivel de profundidad, donde tenemos definidos `ConstantNumNode` (representa literales enteros), `VariableNode` (representa acceso a una variable) y `CallNode` (representa la invocación de un método con determinados argumentos). También encontramos las operaciones aritméticas de suma, resta, multiplicación y división." - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "metadata": {}, - "outputs": [], - "source": [ - "class ConstantNumNode(AtomicNode):\n", - " pass\n", - "\n", - "class VariableNode(AtomicNode):\n", - " pass\n", - "\n", - "class CallNode(AtomicNode):\n", - " def __init__(self, idx, args):\n", - " AtomicNode.__init__(self, idx)\n", - " self.args = args\n", - "\n", - "class PlusNode(BinaryNode):\n", - " @staticmethod\n", - " def operate(lvalue, rvalue):\n", - " return lvalue + rvalue\n", - "\n", - "class MinusNode(BinaryNode):\n", - " @staticmethod\n", - " def operate(lvalue, rvalue):\n", - " return lvalue - rvalue\n", - "\n", - "class StarNode(BinaryNode):\n", - " @staticmethod\n", - " def operate(lvalue, rvalue):\n", - " return lvalue\n", - "\n", - "class DivNode(BinaryNode):\n", - " @staticmethod\n", - " def operate(lvalue, rvalue):\n", - " raise NotImplementedError()\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Gramática\n", - "\n", - "Habiendo diseñado la jerarquía de nodos del AST, pasemos a implementar un mecanismo que nos permita construir automáticamente el AST. Nos apoyaremos en las gramáticas atributadas que estudiamos el año pasado para resolver este problema.\n", - "\n", - "Una gramática atributada permite asociar atributos a los símbolos de la gramática y diseñar reglas que los evaluen. Convenientemente, las reglas para construir el AST suelen ser sencillas si la gramática sigue una estructura \"natural\". Gracias a la implementación de parser LR(1) de la semana anterior, podremos trabajar con una gramática sencilla para este lenguaje, la cual respeta incluso la asociatividad entre los operadores (problema que estuvimos cargando desde el semestre anterior).\n", - "\n", - "Pasemos a construir la gramática e implementar las reglas semánticas." - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Non-Terminals:\n", - "\t, , , , , , , , , , , , \n", - "Terminals:\n", - "\tlet, def, print, ;, ,, (, ), ->, =, +, -, *, /, id, int\n", - "Productions:\n", - "\t[ -> , -> ;, -> ; , -> , -> , -> , -> let id = , -> def id ( ) -> , -> print , -> id, -> id , , -> + , -> - , -> , -> * , -> / , -> , -> , -> ( ), -> int, -> id, -> , -> id ( ), -> , -> , ]\n" - ] - } - ], - "source": [ - "from cmp.pycompiler import Grammar\n", - "\n", - "G = Grammar()\n", - "\n", - "program = G.NonTerminal('', startSymbol=True)\n", - "stat_list, stat = G.NonTerminals(' ')\n", - "let_var, def_func, print_stat, arg_list = G.NonTerminals(' ')\n", - "expr, term, factor, atom = G.NonTerminals(' ')\n", - "func_call, expr_list = G.NonTerminals(' ')\n", - "\n", - "let, defx, printx = G.Terminals('let def print')\n", - "semi, comma, opar, cpar, arrow = G.Terminals('; , ( ) ->')\n", - "equal, plus, minus, star, div = G.Terminals('= + - * /')\n", - "idx, num = G.Terminals('id int')\n", - "\n", - "program %= stat_list, lambda h,s: ProgramNode(s[1])\n", - "\n", - "stat_list %= stat + semi, lambda h,s: [s[1]]\n", - "stat_list %= stat + semi + stat_list, lambda h,s: [s[1]] + s[3] \n", - "\n", - "stat %= let_var, lambda h,s: s[1]\n", - "stat %= def_func, lambda h,s: s[1]\n", - "stat %= print_stat, lambda h,s: s[1]\n", - "\n", - "let_var %= let + idx + equal + expr, lambda h,s: VarDeclarationNode(s[2], s[4])\n", - "\n", - "def_func %= defx + idx + opar + arg_list + cpar + arrow + expr, lambda h,s: FuncDeclarationNode(s[2], s[4], s[7])\n", - "\n", - "print_stat %= printx + expr, lambda h,s: PrintNode(s[2])\n", - "\n", - "arg_list %= idx, lambda h,s: [s[1]]\n", - "arg_list %= idx + comma + arg_list, lambda h,s: [s[1]] + s[3]\n", - "\n", - "expr %= expr + plus + term, lambda h,s: PlusNode(s[1], s[3])\n", - "expr %= expr + minus + term, lambda h,s: MinusNode(s[1], s[3])\n", - "expr %= term, lambda h,s: s[1]\n", - "\n", - "term %= term + star + factor, lambda h,s: StarNode(s[1], s[3])\n", - "term %= term + div + factor, lambda h,s: DivNode(s[1], s[3])\n", - "term %= factor, lambda h,s: s[1]\n", - "\n", - "factor %= atom, lambda h,s: s[1]\n", - "factor %= opar + expr + cpar, lambda h,s: s[2]\n", - "\n", - "atom %= num, lambda h,s: ConstantNumNode(s[1])\n", - "atom %= idx, lambda h,s: VariableNode(s[1])\n", - "atom %= func_call, lambda h,s: s[1]\n", - "\n", - "func_call %= idx + opar + expr_list + cpar, lambda h,s: CallNode(s[1], s[3])\n", - "\n", - "expr_list %= expr, lambda h,s: [s[1]]\n", - "expr_list %= expr + comma + expr_list, lambda h,s: [s[1]] + s[3] \n", - "\n", - "print(G)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Parseando y evaluando\n", - "\n", - "Saltemos directamente a trabajar con un array de tokens. \n", - "```\n", - "print 1 - 1 - 1;\n", - "let x = 58;\n", - "def f ( a, b ) -> 5 + 6;\n", - "print F( 5 + x, 7 + y );\n", - "```\n", - "\n", - "El siguiente array resulta de tokenizar al cadena anterior (**ojo:** los espacios en blanco ya fueron eliminados)." - ] - }, - { - "cell_type": "code", - "execution_count": 28, - "metadata": {}, - "outputs": [], - "source": [ - "from cmp.utils import Token\n", - "\n", - "tokens = [\n", - " Token('print', printx),\n", - " Token('1', num),\n", - " Token('-', minus),\n", - " Token('1', num),\n", - " Token('-', minus),\n", - " Token('1', num),\n", - " Token(';', semi),\n", - " Token('let', let),\n", - " Token('x', idx),\n", - " Token('=', equal),\n", - " Token('58', num),\n", - " Token(';', semi),\n", - " Token('def', defx),\n", - " Token('f', idx),\n", - " Token('(', opar),\n", - " Token('a', idx),\n", - " Token(',', comma),\n", - " Token('b', idx),\n", - " Token(')', cpar),\n", - " Token('->', arrow),\n", - " Token('5', num),\n", - " Token('+', plus),\n", - " Token('6', num),\n", - " Token(';', semi),\n", - " Token('print', printx),\n", - " Token('F', idx),\n", - " Token('(', opar),\n", - " Token('5', num),\n", - " Token('+', plus),\n", - " Token('x', idx),\n", - " Token(',', comma),\n", - " Token('7', num),\n", - " Token('+', plus),\n", - " Token('y', idx),\n", - " Token(')', cpar),\n", - " Token(';', semi),\n", - " Token('$', G.EOF),\n", - "]" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Parser LR(1)\n", - "\n", - "Importemos la implementación de parser LR(1) con que trabajamos la clase anterior. Recuerde que si desea ver los estados del autómata LR(1) puede usar la opción `verbose=True` al contruir el parser." - ] - }, - { - "cell_type": "code", - "execution_count": 29, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ -> int,\n", - " -> ,\n", - " -> ,\n", - " -> ,\n", - " -> int,\n", - " -> ,\n", - " -> ,\n", - " -> - ,\n", - " -> int,\n", - " -> ,\n", - " -> ,\n", - " -> - ,\n", - " -> print ,\n", - " -> ,\n", - " -> int,\n", - " -> ,\n", - " -> ,\n", - " -> ,\n", - " -> let id = ,\n", - " -> ,\n", - " -> id,\n", - " -> id , ,\n", - " -> int,\n", - " -> ,\n", - " -> ,\n", - " -> ,\n", - " -> int,\n", - " -> ,\n", - " -> ,\n", - " -> + ,\n", - " -> def id ( ) -> ,\n", - " -> ,\n", - " -> int,\n", - " -> ,\n", - " -> ,\n", - " -> ,\n", - " -> id,\n", - " -> ,\n", - " -> ,\n", - " -> + ,\n", - " -> int,\n", - " -> ,\n", - " -> ,\n", - " -> ,\n", - " -> id,\n", - " -> ,\n", - " -> ,\n", - " -> + ,\n", - " -> ,\n", - " -> , ,\n", - " -> id ( ),\n", - " -> ,\n", - " -> ,\n", - " -> ,\n", - " -> ,\n", - " -> print ,\n", - " -> ,\n", - " -> ;,\n", - " -> ; ,\n", - " -> ; ,\n", - " -> ; ,\n", - " -> ]" - ] - }, - "execution_count": 29, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "from cmp.tools.parsing import LR1Parser\n", - "\n", - "parser = LR1Parser(G)\n", - "parse, operations = parser([t.token_type for t in tokens], get_shift_reduce=True)\n", - "parse" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Con el objetivo de evaluar los atributos de forma independiente al parseo, se provee la opción `get_shift_reduce=True` al parsear una cadena. Esto indicará al parser, que además del parse derecho (en reverso) nos interesa recuperar la secuencia de operaciones `shift` y `reduce` que aplicó el parser." - ] - }, - { - "cell_type": "code", - "execution_count": 30, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "['SHIFT', 'SHIFT', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'SHIFT', 'SHIFT', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'SHIFT', 'SHIFT', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'SHIFT', 'SHIFT', 'SHIFT', 'SHIFT', 'SHIFT', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'SHIFT', 'SHIFT', 'SHIFT', 'SHIFT', 'SHIFT', 'SHIFT', 'SHIFT', 'REDUCE', 'REDUCE', 'SHIFT', 'SHIFT', 'SHIFT', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'SHIFT', 'SHIFT', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'SHIFT', 'SHIFT', 'SHIFT', 'SHIFT', 'SHIFT', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'SHIFT', 'SHIFT', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'SHIFT', 'SHIFT', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'SHIFT', 'SHIFT', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'SHIFT', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'SHIFT', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE', 'REDUCE']\n" - ] - } - ], - "source": [ - "print(operations)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Evaluación\n", - "\n", - "El método `evaluate_reverse_parse` provisto en `cmp.evaluation` nos permitirá evaluar las reglas semánticas de la gramática atributada y obtener la raíz del AST." - ] - }, - { - "cell_type": "code", - "execution_count": 31, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "<__main__.ProgramNode at 0x7fe668811fd0>" - ] - }, - "execution_count": 31, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "from cmp.evaluation import evaluate_reverse_parse\n", - "\n", - "ast = evaluate_reverse_parse(parse, operations, tokens)\n", - "ast" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Patrón Visitor\n", - "\n", - "En conferencia discutimos el patrón visitor como una alternativa para implementar recorridos sobre el AST. En lugar de tener funciones declaradas explícitamente en la definición de los nodos (para imprimir el AST, chequear su semántica, evaluarlo, etc.), tendríamos un tipo encargado de hacer cada unos de los recorridos. Esto resulta de gran utilizadad en la confección del compilador, pues permite a partir de fases incrementales ir recopilando información de la semántica del programa, y posteriormente, ir transformándolo a lenguajes cada vez más cercanos al lenguaje destino.\n", - "\n", - "Por ejemplo, a continuación se presenta una implementación de la clase `FormatVisitor`, se que encarga de recorrer el AST y construir una representación como `string` del mismo. Nos apoyamos en el decorador `visitor` provisto en `cmp.visitor`. La decoración `@visitor.on()` indica sobre qué parámetro del método `visit` se hará el recorrido. La decoración `@visitor.when()` indica cuál implementación del método `visit` invocar, según del tipo dinámico del parámetro indicado en `@visitor.on(...)`." - ] - }, - { - "cell_type": "code", - "execution_count": 32, - "metadata": {}, - "outputs": [], - "source": [ - "import cmp.visitor as visitor\n", - "\n", - "class FormatVisitor(object):\n", - " @visitor.on('node')\n", - " def visit(self, node, tabs):\n", - " pass\n", - " \n", - " @visitor.when(ProgramNode)\n", - " def visit(self, node, tabs=0):\n", - " ans = '\\t' * tabs + f'\\\\__ProgramNode [; ... ;]'\n", - " statements = '\\n'.join(self.visit(child, tabs + 1) for child in node.statements)\n", - " return f'{ans}\\n{statements}'\n", - " \n", - " @visitor.when(PrintNode)\n", - " def visit(self, node, tabs=0):\n", - " ans = '\\t' * tabs + f'\\\\__PrintNode '\n", - " expr = self.visit(node.expr, tabs + 1)\n", - " return f'{ans}\\n{expr}'\n", - " \n", - " @visitor.when(VarDeclarationNode)\n", - " def visit(self, node, tabs=0):\n", - " ans = '\\t' * tabs + f'\\\\__VarDeclarationNode: let {node.id} = '\n", - " expr = self.visit(node.expr, tabs + 1)\n", - " return f'{ans}\\n{expr}'\n", - " \n", - " @visitor.when(FuncDeclarationNode)\n", - " def visit(self, node, tabs=0):\n", - " params = ', '.join(node.params)\n", - " ans = '\\t' * tabs + f'\\\\__FuncDeclarationNode: def {node.id}({params}) -> '\n", - " body = self.visit(node.body, tabs + 1)\n", - " return f'{ans}\\n{body}'\n", - "\n", - " @visitor.when(BinaryNode)\n", - " def visit(self, node, tabs=0):\n", - " ans = '\\t' * tabs + f'\\\\__ {node.__class__.__name__} '\n", - " left = self.visit(node.left, tabs + 1)\n", - " right = self.visit(node.right, tabs + 1)\n", - " return f'{ans}\\n{left}\\n{right}'\n", - "\n", - " @visitor.when(AtomicNode)\n", - " def visit(self, node, tabs=0):\n", - " return '\\t' * tabs + f'\\\\__ {node.__class__.__name__}: {node.lex}'\n", - " \n", - " @visitor.when(CallNode)\n", - " def visit(self, node, tabs=0):\n", - " ans = '\\t' * tabs + f'\\\\__CallNode: {node.lex}(, ..., )'\n", - " args = '\\n'.join(self.visit(arg, tabs + 1) for arg in node.args)\n", - " return f'{ans}\\n{args}'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Construir una instancia de `FormatVisitor` y visitar la raíz del AST tiene el efecto siguiente." - ] - }, - { - "cell_type": "code", - "execution_count": 33, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\\__ProgramNode [; ... ;]\n", - "\t\\__PrintNode \n", - "\t\t\\__ MinusNode \n", - "\t\t\t\\__ MinusNode \n", - "\t\t\t\t\\__ ConstantNumNode: 1\n", - "\t\t\t\t\\__ ConstantNumNode: 1\n", - "\t\t\t\\__ ConstantNumNode: 1\n", - "\t\\__VarDeclarationNode: let x = \n", - "\t\t\\__ ConstantNumNode: 58\n", - "\t\\__FuncDeclarationNode: def f(a, b) -> \n", - "\t\t\\__ PlusNode \n", - "\t\t\t\\__ ConstantNumNode: 5\n", - "\t\t\t\\__ ConstantNumNode: 6\n", - "\t\\__PrintNode \n", - "\t\t\\__CallNode: F(, ..., )\n", - "\t\t\t\\__ PlusNode \n", - "\t\t\t\t\\__ ConstantNumNode: 5\n", - "\t\t\t\t\\__ VariableNode: x\n", - "\t\t\t\\__ PlusNode \n", - "\t\t\t\t\\__ ConstantNumNode: 7\n", - "\t\t\t\t\\__ VariableNode: y\n" - ] - } - ], - "source": [ - "formatter = FormatVisitor()\n", - "print(formatter.visit(ast))" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Contexto\n", - "\n", - "Para chequear la semántica del lenguaje en cuestión, resulta necesario registrar qué variables han sido declaradas y qué métodos han sido definidos. Utilizaremos las siguientes clases como contenedores de la información \"relevante\" por ahora de las variables y métodos definidos. De las variables nos interesa su nombre y de las funciones su nombre y el de sus parámetros." - ] - }, - { - "cell_type": "code", - "execution_count": 34, - "metadata": {}, - "outputs": [], - "source": [ - "class VariableInfo:\n", - " def __init__(self, name):\n", - " self.name = name\n", - "\n", - "class FunctionInfo:\n", - " def __init__(self, name, params):\n", - " self.name = name\n", - " self.params = params" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Dado que la visibilidad de las variables depende del contexto, será necesario incluir un mecanismo para ocultar (1) variables definidas en ámbitos más profundos al actual, o (2) en ámbitos más hacia adelante que el actual. Para resolver lo primero, haremos que nuestra clase contexto, o ámbito, tenga una estructura jerárquica: cada nodo tiene un padre y potencialmente múltiples hijos. Para resolver lo segundo, será necesario marcar un índice al crear scopes hijos, el cual indique hasta qué sección del ambito padre deberían poder buscar (por ejemplo, no se deberían poder ver variables definidas en el padre más adelantes del momento en que se creó el scope hijo).\n", - "\n", - "Teniendo en cuenta estas restricciones, la búsqueda de un registro en el scope debería ocurrir como una búsqueda local en el scope en cuestión, pero continuada hacia el scope padre (y así consecutivamente) si no se encontró definición local." - ] - }, - { - "cell_type": "code", - "execution_count": 35, - "metadata": {}, - "outputs": [], - "source": [ - "import itertools as itl\n", - "\n", - "class Scope:\n", - " def __init__(self, parent=None):\n", - " self.local_vars = []\n", - " self.local_funcs = []\n", - " self.parent = parent\n", - " self.children = []\n", - " self.var_index_at_parent = 0 if parent is None else len(parent.local_vars)\n", - " self.func_index_at_parent = 0 if parent is None else len(parent.local_funcs)\n", - " \n", - " def create_child_scope(self):\n", - " child_scope = Scope(self)\n", - " self.children.append(child_scope)\n", - " return child_scope\n", - "\n", - " def define_variable(self, vname):\n", - " if self.is_var_defined(vname):\n", - " return False\n", - " else:\n", - " self.local_vars.append(VariableInfo(vname))\n", - " return True\n", - " \n", - " def define_function(self, fname, params):\n", - " if self.is_func_defined(fname, len(params)):\n", - " return False\n", - " else:\n", - " self.local_funcs.append(FunctionInfo(fname, params))\n", - " return True\n", - "\n", - " def is_var_defined(self, vname):\n", - " return self.is_local_var(vname) or (self.parent is not None and self.parent.is_var_defined(vname))\n", - " \n", - " def is_func_defined(self, fname, n):\n", - " return self.is_local_func(fname, n) or (self.parent is not None and self.parent.is_func_defined(fname, n))\n", - "\n", - " def is_local_var(self, vname):\n", - " return self.get_local_variable_info(vname) is not None\n", - " \n", - " def is_local_func(self, fname, n):\n", - " return self.get_local_function_info(fname, n) is not None\n", - "\n", - " def get_local_variable_info(self, vname):\n", - " try:\n", - " return next(filter(lambda x: x.name == vname, self.local_vars))\n", - " except StopIteration:\n", - " return\n", - " \n", - " def get_local_function_info(self, fname, n):\n", - " try:\n", - " return next(filter(lambda x: x.name == fname and len(x.params) == n, self.local_funcs))\n", - " except StopIteration:\n", - " return\n", - " \n", - " \n", - "scope = Scope()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Chequeo semántico\n", - "\n", - "Finalmente, implementemos un visitor para chequear las reglas semánticas del lenguaje discutidas a inicios de la clase práctica." - ] - }, - { - "cell_type": "code", - "execution_count": 36, - "metadata": {}, - "outputs": [], - "source": [ - "class SemanticCheckerVisitor(object):\n", - " def __init__(self):\n", - " self.errors = []\n", - " \n", - " @visitor.on('node')\n", - " def visit(self, node, scope):\n", - " pass\n", - " \n", - " @visitor.when(ProgramNode)\n", - " def visit(self, node, scope=None):\n", - " scope = Scope()\n", - " for statement in node.statements:\n", - " self.visit(statement, scope)\n", - " return self.errors\n", - " \n", - " @visitor.when(VarDeclarationNode)\n", - " def visit(self, node, scope):\n", - " if scope.define_variable(node.id):\n", - " self.visit(node.expr, scope)\n", - " else:\n", - " self.errors.append(f'Varible {node.id} declared before')\n", - " \n", - " @visitor.when(FuncDeclarationNode)\n", - " def visit(self, node, scope):\n", - " if scope.define_function(node.id, node.params):\n", - " child_scope = scope.create_child_scope()\n", - "\n", - " for param in node.params:\n", - " child_scope.define_variable(param)\n", - "\n", - " self.visit(node.body, child_scope)\n", - " else:\n", - " self.errors.append(f'Varible {node.id} declared before')\n", - " \n", - " @visitor.when(PrintNode)\n", - " def visit(self, node, scope):\n", - " self.visit(node.expr, scope)\n", - " \n", - " @visitor.when(ConstantNumNode)\n", - " def visit(self, node, scope):\n", - " return\n", - " \n", - " @visitor.when(VariableNode)\n", - " def visit(self, node, scope):\n", - " if not scope.is_var_defined(node.lex):\n", - " self.errors.append(f'Invalid variable: {node.lex}')\n", - " \n", - " @visitor.when(CallNode)\n", - " def visit(self, node, scope):\n", - " if not scope.is_func_defined(node.lex, len(node.args)):\n", - " self.errors.append(f'Function {node.lex} is not defined with {len(node.args)} arguments.')\n", - " \n", - " for arg in node.args:\n", - " self.visit(arg, scope)\n", - " \n", - " @visitor.when(BinaryNode)\n", - " def visit(self, node, scope):\n", - " self.visit(node.left, scope)\n", - " self.visit(node.right, scope)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Chequeo\n", - "\n", - "Deberían detectarse como mínimo 2 errores:\n", - "\n", - "0. Function F is not defined with 2 arguments.\n", - "1. Invalid variable: y." - ] - }, - { - "cell_type": "code", - "execution_count": 37, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1. Function F is not defined with 2 arguments.\n", - "2. Invalid variable: y\n" - ] - } - ], - "source": [ - "semantic_checker = SemanticCheckerVisitor()\n", - "errors = semantic_checker.visit(ast)\n", - "for i, error in enumerate(errors, 1):\n", - " print(f'{i}.', error)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Propuestas\n", - "\n", - "- Incluya línea y columna en los errores detectados.\n", - "- Incluya el lexer.\n", - "- Construya una clase que siga el patrón visitor para evaluar / ejecutar el programa." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Incluyendo el lexer" - ] - }, - { - "cell_type": "code", - "execution_count": 38, - "metadata": {}, - "outputs": [], - "source": [ - "from lexer import Lexer" - ] - }, - { - "cell_type": "code", - "execution_count": 39, - "metadata": {}, - "outputs": [], - "source": [ - "digits1_9 = '|'.join([str(i) for i in range(1, 10)])\n", - "digits0_9 = '0|' + digits1_9\n", - "chars = '|'.join([chr(i) for i in range(97, 123)] + [chr(i) for i in range(65, 91)])\n", - "\n", - "lexer = Lexer([\n", - " (num, f'({digits1_9})({digits0_9})*'),\n", - " (plus, '\\+'),\n", - " (minus, '-'),\n", - " (star, '\\*'),\n", - " (div, '/'),\n", - " (semi, ';'),\n", - " (comma, ','),\n", - " (opar, '\\('),\n", - " (cpar, '\\)'),\n", - " (equal, '='),\n", - " (arrow, '->'),\n", - " (printx, 'print'),\n", - " (let, 'let'),\n", - " (defx, 'def'),\n", - " ('space', ' *'),\n", - " ('newline', '\\n\\n*'),\n", - " (idx, f'({chars})({chars}|{digits0_9})*'),\n", - "], G.EOF)" - ] - }, - { - "cell_type": "code", - "execution_count": 40, - "metadata": {}, - "outputs": [], - "source": [ - "program = '''\n", - "print 1 - 1; \n", - "let x = 58; \n", - "def sum(a, b) -> a + b; \n", - "print sum(5 + x, 7 + x);\n", - "'''\n", - "\n", - "tokens = lexer(program)\n", - "tokens = [t for t in tokens if t.token_type not in ('space', 'newline')]" - ] - }, - { - "cell_type": "code", - "execution_count": 41, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\\__ProgramNode [; ... ;]\n", - "\t\\__PrintNode \n", - "\t\t\\__ MinusNode \n", - "\t\t\t\\__ ConstantNumNode: 1\n", - "\t\t\t\\__ ConstantNumNode: 1\n", - "\t\\__VarDeclarationNode: let x = \n", - "\t\t\\__ ConstantNumNode: 58\n", - "\t\\__FuncDeclarationNode: def sum(a, b) -> \n", - "\t\t\\__ PlusNode \n", - "\t\t\t\\__ VariableNode: a\n", - "\t\t\t\\__ VariableNode: b\n", - "\t\\__PrintNode \n", - "\t\t\\__CallNode: sum(, ..., )\n", - "\t\t\t\\__ PlusNode \n", - "\t\t\t\t\\__ ConstantNumNode: 5\n", - "\t\t\t\t\\__ VariableNode: x\n", - "\t\t\t\\__ PlusNode \n", - "\t\t\t\t\\__ ConstantNumNode: 7\n", - "\t\t\t\t\\__ VariableNode: x\n" - ] - } - ], - "source": [ - "parser = LR1Parser(G)\n", - "parse, operations = parser([t.token_type for t in tokens], get_shift_reduce=True)\n", - "ast = evaluate_reverse_parse(parse, operations, tokens)\n", - "print(formatter.visit(ast))" - ] - }, - { - "cell_type": "code", - "execution_count": 42, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 42, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "semantic_checker = SemanticCheckerVisitor()\n", - "errors = semantic_checker.visit(ast)\n", - "not errors" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Clase que sigue el patrón visitor para evaluar / ejecutar el programa." - ] - }, - { - "cell_type": "code", - "execution_count": 43, - "metadata": {}, - "outputs": [], - "source": [ - "class ExecVisitor(object):\n", - " def __init__(self):\n", - " self.errors = []\n", - " \n", - " @visitor.on('node')\n", - " def visit(self, node, scope):\n", - " pass\n", - " \n", - " @visitor.when(ProgramNode)\n", - " def visit(self, node, scope=None):\n", - " scope = Scope()\n", - " for stat in node.statements:\n", - " self.visit(stat, scope)\n", - "\n", - " @visitor.when(VarDeclarationNode)\n", - " def visit(self, node, scope):\n", - " value = self.visit(node.expr, scope)\n", - " scope.define_variable(node.id)\n", - " var_info = scope.get_local_variable_info(node.id)\n", - " var_info.value = value\n", - " \n", - " @visitor.when(FuncDeclarationNode)\n", - " def visit(self, node, scope):\n", - " scope.define_function(node.id, node.params)\n", - " func_info = scope.get_local_function_info(node.id, len(node.params))\n", - " func_info.body = node.body \n", - " \n", - " @visitor.when(PrintNode)\n", - " def visit(self, node, scope):\n", - " print(self.visit(node.expr, scope))\n", - " \n", - " @visitor.when(ConstantNumNode)\n", - " def visit(self, node, scope):\n", - " return float(node.lex)\n", - " \n", - " @visitor.when(VariableNode)\n", - " def visit(self, node, scope):\n", - " current_scope = scope\n", - " \n", - " info = None\n", - " while info is None:\n", - " info = current_scope.get_local_variable_info(node.lex)\n", - " current_scope = current_scope.parent\n", - " \n", - " return info.value\n", - " \n", - " @visitor.when(CallNode)\n", - " def visit(self, node, scope):\n", - " current_scope = scope\n", - " \n", - " info = None\n", - " while info is None:\n", - " info = current_scope.get_local_function_info(node.lex, len(node.args))\n", - " current_scope = current_scope.parent\n", - " \n", - " child_scope = scope.create_child_scope()\n", - " \n", - " for name, param in zip(info.params, node.args):\n", - " value = self.visit(param, scope)\n", - " child_scope.define_variable(name)\n", - " child_scope.get_local_variable_info(name).value = value\n", - " \n", - " return self.visit(info.body, child_scope)\n", - " \n", - "\n", - " @visitor.when(PlusNode)\n", - " def visit(self, node, scope):\n", - " return self.visit(node.left, scope) + self.visit(node.right, scope)\n", - " \n", - " @visitor.when(MinusNode)\n", - " def visit(self, node, scope):\n", - " return self.visit(node.left, scope) - self.visit(node.right, scope)\n", - " \n", - " @visitor.when(StarNode)\n", - " def visit(self, node, scope):\n", - " return self.visit(node.left, scope) * self.visit(node.right, scope)\n", - " \n", - " @visitor.when(DivNode)\n", - " def visit(self, node, scope):\n", - " return self.visit(node.left, scope) / self.visit(node.right, scope)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Corriendo el programa" - ] - }, - { - "cell_type": "code", - "execution_count": 44, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.0\n", - "128.0\n" - ] - } - ], - "source": [ - "executor = ExecVisitor()\n", - "executor.visit(ast)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3.7.3 64-bit ('datascience': virtualenv)", - "language": "python", - "name": "python37364bitdatasciencevirtualenv8396341ab8114ad8a44706706d0af3a3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.3" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} diff --git a/src/cool/code_generation/notebooks/cp13.ipynb b/src/cool/code_generation/notebooks/cp13.ipynb deleted file mode 100644 index 1259ae155..000000000 --- a/src/cool/code_generation/notebooks/cp13.ipynb +++ /dev/null @@ -1,657 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Clase Práctica #13 (Compilación)\n", - "\n", - "En esta clase práctica estaremos extendiendo el lenguaje con el que trabajamos en la clase anterior. La principal adición al lenguaje es dar la posibilidad de definir tipos. Esto conlleva nuevos retos durante el chequeo semántico, pues es necesario chequear el uso consistente de los tipos. Varios factores deben ser considerados durante el chequeo, entre los que destacan la herencia y polimorfismo.\n", - "\n", - "Las principales reglas del lenguaje se describen a continuación.\n", - "\n", - "* Un programa consiste en una lista de definiciones de clases.\n", - "* Todas las clases se definen en el mismo espacio de nombres global.\n", - "* Cada clase tiene atributos y métodos.\n", - "* Los atributos tienen un tipo asociado.\n", - "* Los métodos tienen un tipo de retorno (que puede ser `void`), y una lista de argumentos.\n", - "* Todos los métodos son de instancia y dentro de ellos es visible `self` _(solo lectura)_, cuyo tipo estático coincide con el de la clase que implementa el método.\n", - "* Todos los atributos son privados y todos los métodos son públicos.\n", - "* Existe herencia simple.\n", - "* Un método se puede sobrescribir sí y solo sí se mantiene exactamente la misma definición para los tipos de retorno y de los argumentos.\n", - "* No existen sobrecargas de métodos ni de operadores.\n", - "\n", - "La definición de las clases sigue el formato: `class { ... }`. En la definición, los atributos y los métodos se pueden intercalar. En caso de herencia, la sintaxis cambia a: `class : { ... }`.\n", - "\n", - "La definición de atributos tiene la siguiente sintaxis: `: ;`. Note que no se incluye expresión de inicialización, sino que el atributo toma el valor por defecto del tipo ``.\n", - "\n", - "La definición de métodos cambia a: `def (:, ..., :) : { ... }`. El cuerpo del método es una lista de expresiones terminadas por `;`, y el valor de retorno coincide con el de la última expresión (en caso de que el método sea `void` simplemente no se devuelve nada).\n", - "\n", - "Se adiciona la expresión `new ()` que crea una nueva instancia del tipo ``. Note que no se pueden pasar parámetros.\n", - "\n", - "En esta extensión, la instrucción `print` se elimina, y la instrucción `let` pasa a ser una expresión. La expresión `let` tiene la sintaxis: `let : = ` y evalúa al valor de la expresión (y con el tipo estático de la expresión). La variable `` no puede estar previamente definida en ese ámbito. Se puede omitir la declaración del tipo y en tal caso la variable `` ya debe estar definida y se realiza la asignación. La expresión `let` es la expresión de menor precedencia.\n", - "\n", - "El resto de las expresiones del lenguaje se mantiene sin cambios.\n", - "\n", - "> Recordemos que, por simplicar, tanto la declaración de funciones como el llamado a funciones reciben al menos un parámetro/argumento." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Jerarquía del AST\n", - "\n", - "Comencemos por definir los tipos de nodos que compondrán el AST. Recordemos que estos nodos deben ser capaces de atrapar toda la semántica del programa.\n", - "\n" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": {}, - "outputs": [], - "source": [ - "class Node:\n", - " pass" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - " " - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": {}, - "outputs": [], - "source": [ - "class ProgramNode(Node):\n", - " def __init__(self, declarations):\n", - " self.declarations = declarations\n", - "\n", - "class DeclarationNode(Node):\n", - " pass\n", - "class ExpressionNode(Node):\n", - " pass" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - " " - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": {}, - "outputs": [], - "source": [ - "class ClassDeclarationNode(DeclarationNode):\n", - " def __init__(self, idx, features, parent=None):\n", - " self.id = idx\n", - " self.parent = parent\n", - " self.features = features\n", - "\n", - "class FuncDeclarationNode(DeclarationNode):\n", - " def __init__(self, idx, params, return_type, body):\n", - " self.id = idx\n", - " self.params = params\n", - " self.type = return_type\n", - " self.body = body\n", - "\n", - "class AttrDeclarationNode(DeclarationNode):\n", - " def __init__(self, idx, typex):\n", - " self.id = idx\n", - " self.type = typex" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - " " - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": {}, - "outputs": [], - "source": [ - "class VarDeclarationNode(ExpressionNode):\n", - " def __init__(self, idx, typex, expr):\n", - " self.id = idx\n", - " self.type = typex\n", - " self.expr = expr\n", - "\n", - "class AssignNode(ExpressionNode):\n", - " def __init__(self, idx, expr):\n", - " self.id = idx\n", - " self.expr = expr\n", - "\n", - "class CallNode(ExpressionNode):\n", - " def __init__(self, obj, idx, args):\n", - " self.obj = obj\n", - " self.id = idx\n", - " self.args = args" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - " " - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": {}, - "outputs": [], - "source": [ - "class AtomicNode(ExpressionNode):\n", - " def __init__(self, lex):\n", - " self.lex = lex\n", - "\n", - "class BinaryNode(ExpressionNode):\n", - " def __init__(self, left, right):\n", - " self.left = left\n", - " self.right = right" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - " " - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": {}, - "outputs": [], - "source": [ - "class ConstantNumNode(AtomicNode):\n", - " pass\n", - "class VariableNode(AtomicNode):\n", - " pass\n", - "class InstantiateNode(AtomicNode):\n", - " pass\n", - "class PlusNode(BinaryNode):\n", - " pass\n", - "class MinusNode(BinaryNode):\n", - " pass\n", - "class StarNode(BinaryNode):\n", - " pass\n", - "class DivNode(BinaryNode):\n", - " pass" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Gramática\n", - "\n", - "Modifiquemos la gramática de la clase anterior para incluir la nueva sintaxis del lenguaje. Procedamos en 2 pasos:\n", - "1. Construyamos las producciones de forma que se garanticen las reglas sintácticas.\n", - "2. Atributemos la gramática para construir el AST.\n", - "\n", - "> Recordemos que la gramática debe ser parseable. Actualmente el parser más poderoso que tenemos es el LR(1) así que usaremos ese. Consecuentemente, los atributos de la gramática solo deben computar atributos sintetizados." - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": "Non-Terminals:\n\t, , , , , , , , , , , , , , , \nTerminals:\n\tclass, let, def, print, ;, :, ,, ., (, ), {, }, =, +, -, *, /, id, int, new\nProductions:\n\t[ -> , -> , -> , -> class id { }, -> class id : id { }, -> e, -> , -> , -> id : id ;, -> def id ( ) : id { }, -> , -> , , -> id : id, -> ;, -> ; , -> let id : id = , -> let id = , -> , -> + , -> - , -> , -> * , -> / , -> , -> ( ), -> , -> , -> int, -> id, -> new id ( ), -> . id ( ), -> , -> , ]\n" - } - ], - "source": [ - "from cmp.pycompiler import Grammar\n", - "\n", - "# grammar\n", - "G = Grammar()\n", - "\n", - "\n", - "# non-terminals\n", - "program = G.NonTerminal('', startSymbol=True)\n", - "class_list, def_class = G.NonTerminals(' ')\n", - "feature_list, def_attr, def_func = G.NonTerminals(' ')\n", - "param_list, param, expr_list = G.NonTerminals(' ')\n", - "expr, arith, term, factor, atom = G.NonTerminals(' ')\n", - "func_call, arg_list = G.NonTerminals(' ')\n", - "\n", - "\n", - "# terminals\n", - "classx, let, defx, printx = G.Terminals('class let def print')\n", - "semi, colon, comma, dot, opar, cpar, ocur, ccur = G.Terminals('; : , . ( ) { }')\n", - "equal, plus, minus, star, div = G.Terminals('= + - * /')\n", - "idx, num, new = G.Terminals('id int new')\n", - "\n", - "\n", - "# productions\n", - "program %= class_list, lambda h,s: ProgramNode(s[1])\n", - "\n", - "# \n", - "class_list %= def_class, lambda h,s: [s[1]]\n", - "class_list %= def_class + class_list, lambda h,s: [s[1]] + s[2]\n", - "\n", - "# \n", - "def_class %= classx + idx + ocur + feature_list + ccur, lambda h,s: ClassDeclarationNode(s[2], s[4])\n", - "def_class %= classx + idx + colon + idx + ocur + feature_list + ccur, lambda h,s: ClassDeclarationNode(s[2], s[6], s[4])\n", - "\n", - "# \n", - "feature_list %= G.Epsilon, lambda h,s: []\n", - "feature_list %= def_attr + feature_list, lambda h,s: [s[1]] + s[2]\n", - "feature_list %= def_func + feature_list, lambda h,s: [s[1]] + s[2]\n", - "\n", - "# \n", - "def_attr %= idx + colon + idx + semi, lambda h,s: AttrDeclarationNode(s[1], s[3])\n", - "\n", - "# \n", - "def_func %= defx + idx + opar + param_list + cpar + colon + idx + ocur + expr_list + ccur, \\\n", - " lambda h,s: FuncDeclarationNode(s[2], s[4], s[7], s[9]) \n", - "\n", - "param_list %= param, lambda h,s: [ s[1] ]\n", - "param_list %= param + comma + param_list, lambda h,s: [ s[1] ] + s[3]\n", - "\n", - "# \n", - "param %= idx + colon + idx, lambda h,s: (s[1], s[3])\n", - "\n", - "# \n", - "expr_list %= expr + semi, lambda h,s: [s[1]]\n", - "expr_list %= expr + semi + expr_list, lambda h,s: [s[1]] + s[3]\n", - "\n", - "# \n", - "expr %= let + idx + colon + idx + equal + expr, lambda h,s: VarDeclarationNode(s[2], s[4], s[6])\n", - "expr %= let + idx + equal + expr, lambda h,s: AssignNode(s[2], s[4])\n", - "expr %= arith, lambda h,s: s[1]\n", - "\n", - "# \n", - "arith %= arith + plus + term, lambda h,s: PlusNode(s[1], s[3])\n", - "arith %= arith + minus + term, lambda h,s: MinusNode(s[1], s[3])\n", - "arith %= term, lambda h,s: s[1]\n", - "\n", - "# \n", - "term %= term + star + factor, lambda h,s: StarNode(s[1], s[3])\n", - "term %= term + div + factor, lambda h,s: DivNode(s[1], s[3])\n", - "term %= factor, lambda h,s: s[1]\n", - "\n", - "# \n", - "factor %= opar + expr + cpar, lambda h,s: s[2]\n", - "factor %= func_call, lambda h,s: s[1]\n", - "factor %= atom, lambda h,s: s[1]\n", - "\n", - "# \n", - "atom %= num, lambda h,s: ConstantNumNode(s[1])\n", - "atom %= idx, lambda h,s: VariableNode(s[1])\n", - "atom %= new + idx + opar + cpar, lambda h,s: InstantiateNode(s[2])\n", - "\n", - "# \n", - "func_call %= factor + dot + idx + opar + arg_list + cpar, lambda h,s: CallNode(s[1], s[3], s[5])\n", - "\n", - "arg_list %= expr, lambda h,s: [ s[1] ]\n", - "arg_list %= expr + comma + arg_list, lambda h,s: [ s[1] ] + s[3]\n", - "\n", - "if __name__ == '__main__': \n", - " print(G)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Probando la gramática\n", - "\n", - "Trabajaremos con el siguiente código de ejemplo:\n", - "\n", - "```csharp\n", - "class A {\n", - " a : int ;\n", - " def suma ( a : int , b : int ) : int {\n", - " a + b ;\n", - " }\n", - " b : int ;\n", - "}\n", - "\n", - "class B : A {\n", - " c : A ;\n", - " def f ( d : int , a : A ) : void {\n", - " let f : int = 8 ;\n", - " let c = new A ( ) . suma ( 5 , f ) ;\n", - " c ;\n", - " }\n", - "}\n", - "```\n", - "\n", - "Note que todos los tokens están separados por espacios. Esto nos permitirá usar un tokenizer muy simple." - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": {}, - "outputs": [], - "source": [ - "text = '''\n", - "class A {\n", - " a : int ;\n", - " def suma ( a : int , b : int ) : int {\n", - " a + b ;\n", - " }\n", - " b : int ;\n", - "}\n", - "\n", - "class B : A {\n", - " c : A ;\n", - " def f ( d : int , a : A ) : void {\n", - " let f : int = 8 ;\n", - " let c = new A ( ) . suma ( 5 , f ) ;\n", - " c ;\n", - " }\n", - "}\n", - "'''" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Tokenizando\n", - "\n", - "Utilizaremos la implementación de tokenizer provista en `cmp.utils`. Esta implementación asume que los lexemas se encuentran separados por `whitespaces`. Luego, forma los tokens a partir de seleccionar desde `fixed_tokens` los tokens con lexema fijo, y obtiene los tokens de lexema variable a partir la implementación del método `tokenize_text` a decorar." - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": "class id {\n id : id ;\n def id ( id : id , id : id ) : id {\n id + id ;\n }\n id : id ;\n}\nclass id : id {\n id : id ;\n def id ( id : id , id : id ) : id {\n let id : id = int ;\n let id = new id ( ) . id ( int , id ) ;\n id ;\n }\n}\n$\n" - } - ], - "source": [ - "from cmp.utils import Token, tokenizer\n", - "\n", - "fixed_tokens = { t.Name: Token(t.Name, t) for t in G.terminals if t not in { idx, num }}\n", - "\n", - "feature_list %= G.Epsilon, lambda h,s: []\n", - "@tokenizer(G, fixed_tokens)\n", - "def tokenize_text(token):\n", - " lex = token.lex\n", - " try:\n", - " float(lex)\n", - " return token.transform_to(num)\n", - " except ValueError:\n", - " return token.transform_to(idx)\n", - "\n", - "if __name__ == '__main__': \n", - " tokens = tokenize_text(text)\n", - "\n", - "def pprint_tokens(tokens):\n", - " indent = 0\n", - " pending = []\n", - " for token in tokens:\n", - " pending.append(token)\n", - " if token.token_type in { ocur, ccur, semi }:\n", - " if token.token_type == ccur:\n", - " indent -= 1\n", - " print(' '*indent + ' '.join(str(t.token_type) for t in pending))\n", - " pending.clear()\n", - " if token.token_type == ocur:\n", - " indent += 1\n", - " print(' '.join([str(t.token_type) for t in pending]))\n", - "\n", - "if __name__ == '__main__': \n", - " pprint_tokens(tokens)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Parseando\n", - "\n", - "Comprobemos que la gramática quedó LR(1). De ser así no deberían haber conflictos shift-reduce ni reduce-reduce al construir el parser." - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "metadata": {}, - "outputs": [], - "source": [ - "from cmp.tools.parsing import LR1Parser\n", - "\n", - "if __name__ == '__main__': \n", - " parser = LR1Parser(G)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Además, la gramática debe haber atrapado la sintaxis del lenguaje. De ser así, el programa anterior debería poder parsearse sin problema. Comprobémoslo." - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": " -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> id\n -> \n -> \n -> \n -> id\n -> \n -> \n -> + \n -> \n -> ;\n -> def id ( ) : id { }\n -> id : id ;\n -> e\n -> \n -> \n -> \n -> class id { }\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> int\n -> \n -> \n -> \n -> \n -> let id : id = \n -> new id ( )\n -> \n -> int\n -> \n -> \n -> \n -> \n -> id\n -> \n -> \n -> \n -> \n -> \n -> , \n -> . id ( )\n -> \n -> \n -> \n -> \n -> let id = \n -> id\n -> \n -> \n -> \n -> \n -> ;\n -> ; \n -> ; \n -> def id ( ) : id { }\n -> e\n -> \n -> \n -> class id : id { }\n -> \n -> \n -> \n" - } - ], - "source": [ - "if __name__ == '__main__':\n", - " parse, operations = parser([t.token_type for t in tokens], get_shift_reduce=True)\n", - " print('\\n'.join(repr(x) for x in parse))" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Construcción del AST\n", - "\n", - "Llegados a este punto solo queda evaluar las reglas para obtener el AST. Si las reglas fueron correctamente implementadas, no deberíamos tener problemas con lo siguiente." - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": "<__main__.ProgramNode object at 0x7f1f4c34e470>\n" - } - ], - "source": [ - "from cmp.evaluation import evaluate_reverse_parse\n", - "\n", - "if __name__ == '__main__':\n", - " ast = evaluate_reverse_parse(parse, operations, tokens)\n", - " print(ast)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Visitor para visualizar\n", - "\n", - "Construyamos un `visitor` para visualizar el AST." - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "metadata": {}, - "outputs": [], - "source": [ - "import cmp.visitor as visitor\n", - "\n", - "class FormatVisitor(object):\n", - " @visitor.on('node')\n", - " def visit(self, node, tabs):\n", - " pass\n", - " \n", - " @visitor.when(ProgramNode)\n", - " def visit(self, node, tabs=0):\n", - " ans = '\\t' * tabs + f'\\\\__ProgramNode [ ... ]'\n", - " statements = '\\n'.join(self.visit(child, tabs + 1) for child in node.declarations)\n", - " return f'{ans}\\n{statements}'\n", - " \n", - " @visitor.when(ClassDeclarationNode)\n", - " def visit(self, node, tabs=0):\n", - " parent = '' if node.parent is None else f\": {node.parent}\"\n", - " ans = '\\t' * tabs + f'\\\\__ClassDeclarationNode: class {node.id} {parent} {{ ... }}'\n", - " features = '\\n'.join(self.visit(child, tabs + 1) for child in node.features)\n", - " return f'{ans}\\n{features}'\n", - " \n", - " @visitor.when(AttrDeclarationNode)\n", - " def visit(self, node, tabs=0):\n", - " ans = '\\t' * tabs + f'\\\\__AttrDeclarationNode: {node.id} : {node.type}'\n", - " return f'{ans}'\n", - " \n", - " @visitor.when(VarDeclarationNode)\n", - " def visit(self, node, tabs=0):\n", - " ans = '\\t' * tabs + f'\\\\__VarDeclarationNode: let {node.id} : {node.type} = '\n", - " expr = self.visit(node.expr, tabs + 1)\n", - " return f'{ans}\\n{expr}'\n", - " \n", - " @visitor.when(AssignNode)\n", - " def visit(self, node, tabs=0):\n", - " ans = '\\t' * tabs + f'\\\\__AssignNode: let {node.id} = '\n", - " expr = self.visit(node.expr, tabs + 1)\n", - " return f'{ans}\\n{expr}'\n", - " \n", - " @visitor.when(FuncDeclarationNode)\n", - " def visit(self, node, tabs=0):\n", - " params = ', '.join(':'.join(param) for param in node.params)\n", - " ans = '\\t' * tabs + f'\\\\__FuncDeclarationNode: def {node.id}({params}) : {node.type} -> '\n", - " body = '\\n'.join(self.visit(child, tabs + 1) for child in node.body)\n", - " return f'{ans}\\n{body}'\n", - "\n", - " @visitor.when(BinaryNode)\n", - " def visit(self, node, tabs=0):\n", - " ans = '\\t' * tabs + f'\\\\__ {node.__class__.__name__} '\n", - " left = self.visit(node.left, tabs + 1)\n", - " right = self.visit(node.right, tabs + 1)\n", - " return f'{ans}\\n{left}\\n{right}'\n", - "\n", - " @visitor.when(AtomicNode)\n", - " def visit(self, node, tabs=0):\n", - " return '\\t' * tabs + f'\\\\__ {node.__class__.__name__}: {node.lex}'\n", - " \n", - " @visitor.when(CallNode)\n", - " def visit(self, node, tabs=0):\n", - " obj = self.visit(node.obj, tabs + 1)\n", - " ans = '\\t' * tabs + f'\\\\__CallNode: .{node.id}(, ..., )'\n", - " args = '\\n'.join(self.visit(arg, tabs + 1) for arg in node.args)\n", - " return f'{ans}\\n{obj}\\n{args}'\n", - " \n", - " @visitor.when(InstantiateNode)\n", - " def visit(self, node, tabs=0):\n", - " return '\\t' * tabs + f'\\\\__ InstantiateNode: new {node.lex}()'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Independientemente de la gramática el AST debería quedar igual. Así que la siguiente verificación no debería tener problema." - ] - }, - { - "cell_type": "code", - "execution_count": 28, - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": "\\__ProgramNode [ ... ]\n\t\\__ClassDeclarationNode: class A { ... }\n\t\t\\__AttrDeclarationNode: a : int\n\t\t\\__FuncDeclarationNode: def suma(a:int, b:int) : int -> \n\t\t\t\\__ PlusNode \n\t\t\t\t\\__ VariableNode: a\n\t\t\t\t\\__ VariableNode: b\n\t\t\\__AttrDeclarationNode: b : int\n\t\\__ClassDeclarationNode: class B : A { ... }\n\t\t\\__AttrDeclarationNode: c : A\n\t\t\\__FuncDeclarationNode: def f(d:int, a:A) : void -> \n\t\t\t\\__VarDeclarationNode: let f : int = \n\t\t\t\t\\__ ConstantNumNode: 8\n\t\t\t\\__AssignNode: let c = \n\t\t\t\t\\__CallNode: .suma(, ..., )\n\t\t\t\t\t\\__ InstantiateNode: new A()\n\t\t\t\t\t\\__ ConstantNumNode: 5\n\t\t\t\t\t\\__ VariableNode: f\n\t\t\t\\__ VariableNode: c\n" - } - ], - "source": [ - "if __name__ == '__main__':\n", - " formatter = FormatVisitor()\n", - " tree = formatter.visit(ast)\n", - " print(tree)\n", - "\n", - " assert tree == '''\\__ProgramNode [ ... ]\n", - "\t\\__ClassDeclarationNode: class A { ... }\n", - "\t\t\\__AttrDeclarationNode: a : int\n", - "\t\t\\__FuncDeclarationNode: def suma(a:int, b:int) : int -> \n", - "\t\t\t\\__ PlusNode \n", - "\t\t\t\t\\__ VariableNode: a\n", - "\t\t\t\t\\__ VariableNode: b\n", - "\t\t\\__AttrDeclarationNode: b : int\n", - "\t\\__ClassDeclarationNode: class B : A { ... }\n", - "\t\t\\__AttrDeclarationNode: c : A\n", - "\t\t\\__FuncDeclarationNode: def f(d:int, a:A) : void -> \n", - "\t\t\t\\__VarDeclarationNode: let f : int = \n", - "\t\t\t\t\\__ ConstantNumNode: 8\n", - "\t\t\t\\__AssignNode: let c = \n", - "\t\t\t\t\\__CallNode: .suma(, ..., )\n", - "\t\t\t\t\t\\__ InstantiateNode: new A()\n", - "\t\t\t\t\t\\__ ConstantNumNode: 5\n", - "\t\t\t\t\t\\__ VariableNode: f\n", - "\t\t\t\\__ VariableNode: c'''" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Propuestas\n", - "\n", - "- Implemente una clase contexto que le permita consultar la información de las clases, métodos y variables (especialmente los tipos).\n", - "- Implemente un visitor que recorre el AST recolectando los tipos.\n", - "- Implemente un visitor que recorre el AST recolectando los métodos y atributos." - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.3-final" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} \ No newline at end of file diff --git a/src/cool/code_generation/notebooks/cp14.ipynb b/src/cool/code_generation/notebooks/cp14.ipynb deleted file mode 100644 index a17371ac6..000000000 --- a/src/cool/code_generation/notebooks/cp14.ipynb +++ /dev/null @@ -1,543 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Clase Práctica #14 (Compilación)\n", - "\n", - "En esta clase implementaremos las primeras fases de chequeo semántico para el lenguaje que comenzamos a estudiar en la clase anterior. Pasemos a importar lo que ya habíamos implementado." - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": "importing Jupyter notebook from cp13.ipynb\n" - } - ], - "source": [ - "import cmp.nbpackage\n", - "import cmp.visitor as visitor\n", - "\n", - "from cp13 import G, text\n", - "from cp13 import Node, ProgramNode, DeclarationNode, ExpressionNode\n", - "from cp13 import ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode\n", - "from cp13 import VarDeclarationNode, AssignNode, CallNode\n", - "from cp13 import AtomicNode, BinaryNode\n", - "from cp13 import ConstantNumNode, VariableNode, InstantiateNode, PlusNode, MinusNode, StarNode, DivNode\n", - "from cp13 import FormatVisitor, tokenize_text, pprint_tokens\n", - "\n", - "from cmp.tools.parsing import LR1Parser\n", - "from cmp.evaluation import evaluate_reverse_parse" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "La gramática `G` es la gramática que diseñamos para el lenguaje. Esta debe atrapar la sintaxis del lenguaje. Por otro lado, las reglas que incluimos al atributar la gramática deberían construir una representación sobre la que fuera cómodo comprobar la semántica del programa. Estamos hablando justamente del **AST**.\n", - "\n", - "Construyamos el siguiente método `run_pipeline`, el cual recibe una cadena de texto y una gramática, y pasará por las fases de análisis lexicográfico y sintácticto, y finalmente evaluará las reglas para devolvernos el AST." - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": "=================== TEXT ======================\n\nclass A {\n a : int ;\n def suma ( a : int , b : int ) : int {\n a + b ;\n }\n b : int ;\n}\n\nclass B : A {\n c : A ;\n def f ( d : int , a : A ) : void {\n let f : int = 8 ;\n let c = new A ( ) . suma ( 5 , f ) ;\n c ;\n }\n}\n\n================== TOKENS =====================\nclass id {\n id : id ;\n def id ( id : id , id : id ) : id {\n id + id ;\n }\n id : id ;\n}\nclass id : id {\n id : id ;\n def id ( id : id , id : id ) : id {\n let id : id = int ;\n let id = new id ( ) . id ( int , id ) ;\n id ;\n }\n}\n$\n=================== PARSE =====================\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> id\n -> \n -> \n -> \n -> id\n -> \n -> \n -> + \n -> \n -> ;\n -> def id ( ) : id { }\n -> id : id ;\n -> \n -> \n -> \n -> class id { }\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> int\n -> \n -> \n -> \n -> \n -> let id : id = \n -> new id ( )\n -> \n -> int\n -> \n -> \n -> \n -> \n -> id\n -> \n -> \n -> \n -> \n -> \n -> , \n -> . id ( )\n -> \n -> \n -> \n -> \n -> let id = \n -> id\n -> \n -> \n -> \n -> \n -> ;\n -> ; \n -> ; \n -> def id ( ) : id { }\n -> \n -> \n -> class id : id { }\n -> \n -> \n -> \n==================== AST ======================\n\\__ProgramNode [ ... ]\n\t\\__ClassDeclarationNode: class A { ... }\n\t\t\\__AttrDeclarationNode: a : int\n\t\t\\__FuncDeclarationNode: def suma(a:int, b:int) : int -> \n\t\t\t\\__ PlusNode \n\t\t\t\t\\__ VariableNode: a\n\t\t\t\t\\__ VariableNode: b\n\t\t\\__AttrDeclarationNode: b : int\n\t\\__ClassDeclarationNode: class B : A { ... }\n\t\t\\__AttrDeclarationNode: c : A\n\t\t\\__FuncDeclarationNode: def f(d:int, a:A) : void -> \n\t\t\t\\__VarDeclarationNode: let f : int = \n\t\t\t\t\\__ ConstantNumNode: 8\n\t\t\t\\__AssignNode: let c = \n\t\t\t\t\\__CallNode: .suma(, ..., )\n\t\t\t\t\t\\__ InstantiateNode: new A()\n\t\t\t\t\t\\__ ConstantNumNode: 5\n\t\t\t\t\t\\__ VariableNode: f\n\t\t\t\\__ VariableNode: c\n" - } - ], - "source": [ - "def run_pipeline(G, text):\n", - " print('=================== TEXT ======================')\n", - " print(text)\n", - " print('================== TOKENS =====================')\n", - " tokens = tokenize_text(text)\n", - " pprint_tokens(tokens)\n", - " print('=================== PARSE =====================')\n", - " parser = LR1Parser(G)\n", - " parse, operations = parser([t.token_type for t in tokens], get_shift_reduce=True)\n", - " print('\\n'.join(repr(x) for x in parse))\n", - " print('==================== AST ======================')\n", - " ast = evaluate_reverse_parse(parse, operations, tokens)\n", - " formatter = FormatVisitor()\n", - " tree = formatter.visit(ast)\n", - " print(tree)\n", - " return ast\n", - " \n", - "if __name__ == '__main__': ast = run_pipeline(G, text)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Chequeo semántico\n", - "\n", - "En `cmp.semantic` se distribuyen una serie de clases que funcionarán como soporte para la fase de chequeo semántico." - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [], - "source": [ - "from cmp.semantic import SemanticError\n", - "from cmp.semantic import Attribute, Method, Type\n", - "from cmp.semantic import VoidType, ErrorType\n", - "from cmp.semantic import Context" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "- La clase `SemanticError` hereda de `Exception` para funcionar como mecanismo para manejar errores en los contextos. El campo `text` que poseen las instancias de `SemanticError` permite obtener el texto de error con el que se construyó.\n", - "- Las clases `Attribute` y `Method` funcionan como contenedores de los datos necesarios para representar los atributos y métodos del lenguaje respectivamente. Del primero se almacena el nombre del campo (un `str)` y su tipo (una instancia de `Type`). Del segundo se almacenan: nombre del método (`str`), nombre de los parámetros (`list`), tipos de los parámetros (`list`) y el tipo de retorno (`Type`).\n", - "- La clase `Type` funciona como descriptor de todos los atributos y métodos con que cuentan los tipos del lenguaje. Esta clase permite crear instancias a partir del nombre del tipo (`Type(name)`) y posteriormente actualizar su definición con:\n", - " - tipo padre: `set_parent(...)`.\n", - " - atributos: `get_attributes(...)` y `define_attribute(...)`.\n", - " - métodos: `get_method(...)` y `define_method(...)`.\n", - "\n", - "> Para más información se recomienda revisar el código fuente disponible en `cmp.semantic`.\n", - "\n", - "- La clase `VoidType` puede usarse para manejar el tipo de retorno `void` de los métodos. Tiene la particularidad de que todas sus instancias son iguales entre sí.\n", - "- La clase `ErrorType` puede usarse para manejar las situaciones en las que se refiere un tipo que no ha sido declarado. Esto nos permitirá detectar más errores que detener el chequeo semántico al primer error. Las instancias de `ErrorType` tiene la particularidad de ser iguales entre sí y a cualquier instancia de `Type`. Además, el tipo `ErrorType` se conforma (en el sentido de herencia) a todo tipo y viceversa.\n", - "- La clase `Context` permite controlar los tipos que han sido definidos en el lenguaje.\n", - " - definir un tipo: `create_type(...)`.\n", - " - obtener un tipo: `get_type(...)`." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Recolectando de tipos\n", - "\n", - "Dado que en este lenguaje los tipos pueden referenciarse antes de declararse, se vuelve necesario realizar un primer recorrido del AST recolectando todos los tipos. Esto lo haremos utilizando el patrón `visitor` con el que trabajamos en clases anteriores." - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [], - "source": [ - "class TypeCollector(object):\n", - " def __init__(self, errors=[]):\n", - " self.context = None\n", - " self.errors = errors\n", - " \n", - " @visitor.on('node')\n", - " def visit(self, node):\n", - " pass\n", - " \n", - " @visitor.when(ProgramNode)\n", - " def visit(self, node):\n", - " self.context = Context()\n", - " self.context.create_type('int')\n", - " self.context.create_type('void')\n", - " for declaration in node.declarations:\n", - " self.visit(declaration)\n", - " \n", - " @visitor.when(ClassDeclarationNode)\n", - " def visit(self, node):\n", - " try:\n", - " self.context.create_type(node.id)\n", - " except SemanticError as e:\n", - " self.errors.append(e)\n", - "" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Comprobemos que implementamos correctamente el recorrido. Tras visitar el AST deberíamos tener en el campo `context` del `visitor` todos los tipos definidos en el programa _... y algo más? ;-)_" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": "Errors: []\nContext:\n{\n\ttype int {}\n\t\n\ttype void {}\n\t\n\ttype A {}\n\t\n\ttype B {}\n\t\n}\n" - } - ], - "source": [ - "if __name__ == '__main__':\n", - " errors = []\n", - "\n", - " collector = TypeCollector(errors)\n", - " collector.visit(ast)\n", - "\n", - " context = collector.context\n", - "\n", - " print('Errors:', errors)\n", - " print('Context:')\n", - " print(context)\n", - "\n", - " assert errors == []" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Construyendo los tipos\n", - "\n", - "Pasemos ahora a construir los tipos. Pero _... realmente podremos comenzar ya a chequear todo el código? (incluyendo el cuerpo de los métodos)_. Resulta que no. En este lenguaje en orden en que se definen los métodos tampoco es relevante: _se pueden llamar antes de declararse_. Esto permite que haya recursividad en el lenguaje que lleva un chequeo extra antes de pasar a revisar los cuerpos de los métodos.\n", - "\n", - "Nótese que al haber recolectado ya todos los tipos, se logra que los parámetros, valores de retorno, y otras refencias a tipos, puedan ser resueltas en este recorrido sin problemas." - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": {}, - "outputs": [], - "source": [ - "class TypeBuilder:\n", - " def __init__(self, context, errors=[]):\n", - " self.context = context\n", - " self.current_type = None\n", - " self.errors = errors\n", - " \n", - " @visitor.on('node')\n", - " def visit(self, node):\n", - " pass\n", - " \n", - " @visitor.when(ProgramNode)\n", - " def visit(self, node):\n", - " for declaration in node.declarations:\n", - " self.visit(declaration)\n", - " \n", - " @visitor.when(ClassDeclarationNode)\n", - " def visit(self, node):\n", - " try:\n", - " self.current_type = self.context.get_type(node.id)\n", - " if node.parent is not None:\n", - " self.current_type.set_parent(self.context.get_type(node.parent))\n", - " except SemanticError as e:\n", - " self.errors.append(e.text)\n", - " \n", - " for feature in node.features:\n", - " self.visit(feature)\n", - " \n", - " @visitor.when(AttrDeclarationNode)\n", - " def visit(self, node):\n", - " try:\n", - " name = node.id\n", - " typex = self.context.get_type(node.type)\n", - " self.current_type.define_attribute(name, typex)\n", - " except SemanticError as e:\n", - " self.errors.append(e.text)\n", - "\n", - " @visitor.when(FuncDeclarationNode)\n", - " def visit(self, node):\n", - " try:\n", - " name = node.id\n", - " param_names = [p[0] for p in node.params]\n", - " param_types = [self.context.get_type(p[1]) for p in node.params]\n", - " return_type = self.context.get_type(node.type)\n", - " self.current_type.define_method(name, param_names, param_types, return_type)\n", - " except SemanticError as e:\n", - " self.errors.append(e.text)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Comprobemos la implementación. Tras esta fase deberíamos tener completados todos los tipos." - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": "Errors: []\nContext:\n{\n\ttype int {}\n\t\n\ttype void {}\n\t\n\ttype A {\n\t\t[attrib] a : int;\n\t\t[attrib] b : int;\n\t\t[method] suma(self:A, a:int, b:int): int;\n\t}\n\t\n\ttype B : A {\n\t\t[attrib] c : A;\n\t\t[method] f(self:B, d:int, a:A): void;\n\t}\n\t\n}\n" - } - ], - "source": [ - "if __name__ == '__main__':\n", - " builder = TypeBuilder(context, errors)\n", - " builder.visit(ast)\n", - " \n", - " print('Errors:', errors)\n", - " print('Context:')\n", - " print(context)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Comprobando ..." - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": {}, - "outputs": [], - "source": [ - "deprecated_pipeline = run_pipeline" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Actualizaremos el pipeline para incluir estos 2 recorridos." - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": {}, - "outputs": [], - "source": [ - "def run_pipeline(G, text):\n", - " ast = deprecated_pipeline(G, text)\n", - " print('============== COLLECTING TYPES ===============')\n", - " errors = []\n", - " collector = TypeCollector(errors)\n", - " collector.visit(ast)\n", - " context = collector.context\n", - " print('Errors:', errors)\n", - " print('Context:')\n", - " print(context)\n", - " print('=============== BUILDING TYPES ================')\n", - " builder = TypeBuilder(context, errors)\n", - " builder.visit(ast)\n", - " print('Errors: [')\n", - " for error in errors:\n", - " print('\\t', error)\n", - " print(']')\n", - " print('Context:')\n", - " print(context)\n", - " return ast, errors, context" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Programa #1\n", - "\n", - "El siguiente programa es con el que hemos estado trabajando y no debería contener errores." - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": "=================== TEXT ======================\n\nclass A {\n a : int ;\n def suma ( a : int , b : int ) : int {\n a + b ;\n }\n b : int ;\n}\n\nclass B : A {\n c : A ;\n def f ( d : int , a : A ) : void {\n let f : int = 8 ;\n let c = new A ( ) . suma ( 5 , f ) ;\n c ;\n }\n}\n\n================== TOKENS =====================\nclass id {\n id : id ;\n def id ( id : id , id : id ) : id {\n id + id ;\n }\n id : id ;\n}\nclass id : id {\n id : id ;\n def id ( id : id , id : id ) : id {\n let id : id = int ;\n let id = new id ( ) . id ( int , id ) ;\n id ;\n }\n}\n$\n=================== PARSE =====================\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> id\n -> \n -> \n -> \n -> id\n -> \n -> \n -> + \n -> \n -> ;\n -> def id ( ) : id { }\n -> id : id ;\n -> \n -> \n -> \n -> class id { }\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> int\n -> \n -> \n -> \n -> \n -> let id : id = \n -> new id ( )\n -> \n -> int\n -> \n -> \n -> \n -> \n -> id\n -> \n -> \n -> \n -> \n -> \n -> , \n -> . id ( )\n -> \n -> \n -> \n -> \n -> let id = \n -> id\n -> \n -> \n -> \n -> \n -> ;\n -> ; \n -> ; \n -> def id ( ) : id { }\n -> \n -> \n -> class id : id { }\n -> \n -> \n -> \n==================== AST ======================\n\\__ProgramNode [ ... ]\n\t\\__ClassDeclarationNode: class A { ... }\n\t\t\\__AttrDeclarationNode: a : int\n\t\t\\__FuncDeclarationNode: def suma(a:int, b:int) : int -> \n\t\t\t\\__ PlusNode \n\t\t\t\t\\__ VariableNode: a\n\t\t\t\t\\__ VariableNode: b\n\t\t\\__AttrDeclarationNode: b : int\n\t\\__ClassDeclarationNode: class B : A { ... }\n\t\t\\__AttrDeclarationNode: c : A\n\t\t\\__FuncDeclarationNode: def f(d:int, a:A) : void -> \n\t\t\t\\__VarDeclarationNode: let f : int = \n\t\t\t\t\\__ ConstantNumNode: 8\n\t\t\t\\__AssignNode: let c = \n\t\t\t\t\\__CallNode: .suma(, ..., )\n\t\t\t\t\t\\__ InstantiateNode: new A()\n\t\t\t\t\t\\__ ConstantNumNode: 5\n\t\t\t\t\t\\__ VariableNode: f\n\t\t\t\\__ VariableNode: c\n============== COLLECTING TYPES ===============\nErrors: []\nContext:\n{\n\ttype int {}\n\t\n\ttype void {}\n\t\n\ttype A {}\n\t\n\ttype B {}\n\t\n}\n=============== BUILDING TYPES ================\nErrors: [\n]\nContext:\n{\n\ttype int {}\n\t\n\ttype void {}\n\t\n\ttype A {\n\t\t[attrib] a : int;\n\t\t[attrib] b : int;\n\t\t[method] suma(self:A, a:int, b:int): int;\n\t}\n\t\n\ttype B : A {\n\t\t[attrib] c : A;\n\t\t[method] f(self:B, d:int, a:A): void;\n\t}\n\t\n}\n" - } - ], - "source": [ - "from cp13 import text\n", - "\n", - "if __name__ == '__main__': \n", - " ast, errors, context = run_pipeline(G, text)\n", - " assert errors == []" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Programa #2\n", - "\n", - "Se incluyeron varios errores al programa anterior. Intente detectar todos los errores posibles." - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": "=================== TEXT ======================\n\n class A {\n a : Z ;\n def suma ( a : int , b : B ) : int {\n a + b ;\n }\n b : int ;\n c : C ;\n }\n\n class B : A {\n c : A ;\n def f ( d : int , a : A ) : void {\n let f : int = 8 ;\n let c = new A ( ) . suma ( 5 , f ) ;\n c ;\n }\n z : int ;\n z : A ;\n }\n\n class C : Z {\n }\n\n class D : A {\n def suma ( a : int , d : B ) : int {\n d ;\n }\n }\n\n class E : A {\n def suma ( a : A , b : B ) : int {\n a ;\n }\n }\n\n class F : B {\n def f ( d : int , a : A ) : void {\n a ;\n }\n }\n \n================== TOKENS =====================\nclass id {\n id : id ;\n def id ( id : id , id : id ) : id {\n id + id ;\n }\n id : id ;\n id : id ;\n}\nclass id : id {\n id : id ;\n def id ( id : id , id : id ) : id {\n let id : id = int ;\n let id = new id ( ) . id ( int , id ) ;\n id ;\n }\n id : id ;\n id : id ;\n}\nclass id : id {\n}\nclass id : id {\n def id ( id : id , id : id ) : id {\n id ;\n }\n}\nclass id : id {\n def id ( id : id , id : id ) : id {\n id ;\n }\n}\nclass id : id {\n def id ( id : id , id : id ) : id {\n id ;\n }\n}\n$\n=================== PARSE =====================\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> id\n -> \n -> \n -> \n -> id\n -> \n -> \n -> + \n -> \n -> ;\n -> def id ( ) : id { }\n -> id : id ;\n -> id : id ;\n -> \n -> \n -> \n -> \n -> class id { }\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> int\n -> \n -> \n -> \n -> \n -> let id : id = \n -> new id ( )\n -> \n -> int\n -> \n -> \n -> \n -> \n -> id\n -> \n -> \n -> \n -> \n -> \n -> , \n -> . id ( )\n -> \n -> \n -> \n -> \n -> let id = \n -> id\n -> \n -> \n -> \n -> \n -> ;\n -> ; \n -> ; \n -> def id ( ) : id { }\n -> id : id ;\n -> id : id ;\n -> \n -> \n -> \n -> \n -> class id : id { }\n -> class id : id { }\n -> id : id\n -> id : id\n -> \n -> , \n -> id\n -> \n -> \n -> \n -> \n -> ;\n -> def id ( ) : id { }\n -> \n -> class id : id { }\n -> id : id\n -> id : id\n -> \n -> , \n -> id\n -> \n -> \n -> \n -> \n -> ;\n -> def id ( ) : id { }\n -> \n -> class id : id { }\n -> id : id\n -> id : id\n -> \n -> , \n -> id\n -> \n -> \n -> \n -> \n -> ;\n -> def id ( ) : id { }\n -> \n -> class id : id { }\n -> \n -> \n -> \n -> \n -> \n -> \n -> \n==================== AST ======================\n\\__ProgramNode [ ... ]\n\t\\__ClassDeclarationNode: class A { ... }\n\t\t\\__AttrDeclarationNode: a : Z\n\t\t\\__FuncDeclarationNode: def suma(a:int, b:B) : int -> \n\t\t\t\\__ PlusNode \n\t\t\t\t\\__ VariableNode: a\n\t\t\t\t\\__ VariableNode: b\n\t\t\\__AttrDeclarationNode: b : int\n\t\t\\__AttrDeclarationNode: c : C\n\t\\__ClassDeclarationNode: class B : A { ... }\n\t\t\\__AttrDeclarationNode: c : A\n\t\t\\__FuncDeclarationNode: def f(d:int, a:A) : void -> \n\t\t\t\\__VarDeclarationNode: let f : int = \n\t\t\t\t\\__ ConstantNumNode: 8\n\t\t\t\\__AssignNode: let c = \n\t\t\t\t\\__CallNode: .suma(, ..., )\n\t\t\t\t\t\\__ InstantiateNode: new A()\n\t\t\t\t\t\\__ ConstantNumNode: 5\n\t\t\t\t\t\\__ VariableNode: f\n\t\t\t\\__ VariableNode: c\n\t\t\\__AttrDeclarationNode: z : int\n\t\t\\__AttrDeclarationNode: z : A\n\t\\__ClassDeclarationNode: class C : Z { ... }\n\n\t\\__ClassDeclarationNode: class D : A { ... }\n\t\t\\__FuncDeclarationNode: def suma(a:int, d:B) : int -> \n\t\t\t\\__ VariableNode: d\n\t\\__ClassDeclarationNode: class E : A { ... }\n\t\t\\__FuncDeclarationNode: def suma(a:A, b:B) : int -> \n\t\t\t\\__ VariableNode: a\n\t\\__ClassDeclarationNode: class F : B { ... }\n\t\t\\__FuncDeclarationNode: def f(d:int, a:A) : void -> \n\t\t\t\\__ VariableNode: a\n============== COLLECTING TYPES ===============\nErrors: []\nContext:\n{\n\ttype int {}\n\t\n\ttype void {}\n\t\n\ttype A {}\n\t\n\ttype B {}\n\t\n\ttype C {}\n\t\n\ttype D {}\n\t\n\ttype E {}\n\t\n\ttype F {}\n\t\n}\n=============== BUILDING TYPES ================\nErrors: [\n\t Type \"Z\" is not defined.\n\t Attribute \"c\" is already defined in B.\n\t Attribute \"z\" is already defined in B.\n\t Type \"Z\" is not defined.\n]\nContext:\n{\n\ttype int {}\n\t\n\ttype void {}\n\t\n\ttype A {\n\t\t[attrib] b : int;\n\t\t[attrib] c : C;\n\t\t[method] suma(self:A, a:int, b:B): int;\n\t}\n\t\n\ttype B : A {\n\t\t[attrib] z : int;\n\t\t[method] f(self:B, d:int, a:A): void;\n\t}\n\t\n\ttype C {}\n\t\n\ttype D : A {\n\t\t[method] suma(self:D, a:int, d:B): int;\n\t}\n\t\n\ttype E : A {\n\t\t[method] suma(self:E, a:A, b:B): int;\n\t}\n\t\n\ttype F : B {\n\t\t[method] f(self:F, d:int, a:A): void;\n\t}\n\t\n}\n" - } - ], - "source": [ - "if __name__ == '__main__': \n", - " text = '''\n", - " class A {\n", - " a : Z ;\n", - " def suma ( a : int , b : B ) : int {\n", - " a + b ;\n", - " }\n", - " b : int ;\n", - " c : C ;\n", - " }\n", - "\n", - " class B : A {\n", - " c : A ;\n", - " def f ( d : int , a : A ) : void {\n", - " let f : int = 8 ;\n", - " let c = new A ( ) . suma ( 5 , f ) ;\n", - " c ;\n", - " }\n", - " z : int ;\n", - " z : A ;\n", - " }\n", - "\n", - " class C : Z {\n", - " }\n", - "\n", - " class D : A {\n", - " def suma ( a : int , d : B ) : int {\n", - " d ;\n", - " }\n", - " }\n", - "\n", - " class E : A {\n", - " def suma ( a : A , b : B ) : int {\n", - " a ;\n", - " }\n", - " }\n", - "\n", - " class F : B {\n", - " def f ( d : int , a : A ) : void {\n", - " a ;\n", - " }\n", - " }\n", - " '''\n", - "\n", - " ast, errors, context = run_pipeline(G, text)\n", - "\n", - " assert sorted(errors) == sorted([\n", - " 'Type \"Z\" is not defined.',\n", - " 'Attribute \"c\" is already defined in B.',\n", - " 'Attribute \"z\" is already defined in B.',\n", - " 'Type \"Z\" is not defined.'\n", - " ])" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Propuestas\n", - "\n", - "- Compruebe el hecho de que todo programa del lenguaje deba tener una clase `Main` con un método `main`.\n", - "- Garantice que no haya circularidad de tipos.\n", - "\n", - "> El siguente programa tiene un problema: la defición de `A` y `B` forma un ciclo.\n", - ">\n", - ">```python\n", - ">text = '''\n", - ">class A : B {\n", - ">}\n", - ">class B : A {\n", - ">}\n", - ">'''\n", - ">\n", - ">ast, errors, context = run_pipeline(G, text)\n", - ">assert len(errors) != 0\n", - ">```\n", - "\n", - "- Verifique que no hayan sobrecargas de métodos\n", - "\n", - "> El método `f` ya está definido en `B` con una firma distinta.\n", - ">```python\n", - ">text = '''\n", - ">class A {\n", - "> def f ( a : int , d : int ) : int {\n", - "> d ;\n", - "> }\n", - ">}\n", - ">class B : A {\n", - "> def f ( a : A , d : int ) : A {\n", - "> d ;\n", - "> }\n", - ">}\n", - ">'''\n", - ">\n", - ">ast, errors, context = run_pipeline(G, text)\n", - ">assert len(errors) != 0\n", - ">```" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Main Checker" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": {}, - "outputs": [], - "source": [ - "def check_main(context, errors):\n", - " try:\n", - " class_main = context.get_type('Main')\n", - " method_main = class_main.get_method('main')\n", - " except SemanticError as e:\n", - " errors.append(e.text)\n", - "" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": {}, - "outputs": [], - "source": [ - "if __name__ == '__main__':\n", - " check_main(context, errors)\n", - " errors" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.3-final" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} \ No newline at end of file diff --git a/src/cool/code_generation/notebooks/cp15.ipynb b/src/cool/code_generation/notebooks/cp15.ipynb deleted file mode 100644 index 975db862d..000000000 --- a/src/cool/code_generation/notebooks/cp15.ipynb +++ /dev/null @@ -1,481 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Clase Práctica #15 (Compilación)\n", - "\n", - "En esta clase implementaremos la fase final de chequeo semántico para el lenguaje que comenzamos a estudiar en clases anteriores. Pasemos a importar lo que ya habíamos implementado." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Análisis Lexicográfico y Sintáctico" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": {}, - "outputs": [], - "source": [ - "import cmp.nbpackage\n", - "import cmp.visitor as visitor\n", - "\n", - "from cp13 import G, text\n", - "from cp13 import Node, ProgramNode, DeclarationNode, ExpressionNode\n", - "from cp13 import ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode\n", - "from cp13 import VarDeclarationNode, AssignNode, CallNode\n", - "from cp13 import AtomicNode, BinaryNode\n", - "from cp13 import ConstantNumNode, VariableNode, InstantiateNode, PlusNode, MinusNode, StarNode, DivNode\n", - "from cp13 import FormatVisitor, tokenize_text, pprint_tokens\n", - "\n", - "from cmp.tools.parsing import LR1Parser\n", - "from cmp.evaluation import evaluate_reverse_parse" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Análisis Semántico (Recolección y Construcción de Tipos)" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": {}, - "outputs": [], - "source": [ - "from cmp.semantic import SemanticError\n", - "from cmp.semantic import Attribute, Method, Type\n", - "from cmp.semantic import VoidType, ErrorType, IntType\n", - "from cmp.semantic import Context\n", - "\n", - "from cp14 import TypeCollector, TypeBuilder, run_pipeline" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Chequeo de tipos\n", - "\n", - "Estaremos validando que el programa haga un uso correcto de los tipos definidos. Recordemos algunas de las características del lenguaje que queremos comprobar:\n", - "- Todos los métodos son de instancia y dentro de ellos es visible `self` _(solo lectura)_, cuyo tipo estático coincide con el de la clase que implementa el método.\n", - "- Al invocar un método, se evalúa primero la expresión que devuelve el objeto, luego los parámetros, y por último se llama la función.\n", - "- Todos los atributos son privados y todos los métodos son públicos.\n", - "- Un método se puede sobrescribir sí y solo sí se mantiene exactamente la misma definición para los tipos de retorno y de los argumentos.\n", - "- La expresión `let` tiene la sintaxis: `let : = ` y evalúa al valor de la expresión (y con el tipo estático de la expresión). La variable `` no puede estar previamente definida en ese ámbito. Se puede omitir la declaración del tipo y en tal caso la variable `` ya debe estar definida y se realiza la asignación.\n", - "- Las operaciones `+`, `-`, `*` y `/` están definidas únicamente entre valores enteros, y devuelven enteros." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "WRONG_SIGNATURE = 'Method \"%s\" already defined in \"%s\" with a different signature.'\n", - "SELF_IS_READONLY = 'Variable \"self\" is read-only.'\n", - "LOCAL_ALREADY_DEFINED = 'Variable \"%s\" is already defined in method \"%s\".'\n", - "INCOMPATIBLE_TYPES = 'Cannot convert \"%s\" into \"%s\".'\n", - "VARIABLE_NOT_DEFINED = 'Variable \"%s\" is not defined in \"%s\".'\n", - "INVALID_OPERATION = 'Operation is not defined between \"%s\" and \"%s\".'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "La clase `Type` ha sido extendida para incluir la función `conforms_to`. Recordemos que esta relación indica que un objeto de tipo `C` puede ser usado en lugar de un objeto de tipo `P`. En tal caso decimos que `C.conforms_to(P)`. La relación de conformidad es crucial en los lenguajes de programación orientados a objetos pues restringirá las asignaciones e invocaciones para garantizar el principio de sustitución." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Ámbito (Scope)\n", - "\n", - "Se provee una implementación de la clase `Scope` en `cmp.semantic`. Esta clase nos permitirá gestionar las variables definidas en los distintos niveles de visibilidad, así como saber con qué tipo se definieron. Los métodos fundamentales son:\n", - "- `create_child`: Crea un `scope` hijo que hereda las variables visibles hasta ese momento en el `scope` padre.\n", - "- `define_variable`: Registra localmente una variable en el `scope` a partir de su nombre y tipo.\n", - "- `find_variable`: Devuelve un `VariableInfo` con la información de la variable consultada (a partir de su nombre). La variable devuelta no tiene por qué estar definida localmente. En caso de que la variable no esté definida devuelve `None`.\n", - "- `is_defined`: Indica si la variable consultada es visible en el `scope`.\n", - "- `is_local`: Indica si la variable consultada está definida localmente en el `scope`." - ] - }, - { - "cell_type": "code", - "execution_count": 28, - "metadata": {}, - "outputs": [], - "source": [ - "from cmp.semantic import Scope" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Type Checker Visitor\n", - "\n", - "Implementaremos un nuevo recorrido sobre el AST. Como de costumbre nos apoyaremos en el patrón visitor. Debemos caminar desde la raíz del AST (`ProgramNode`) hasta el cuerpo de los métodos. En esta ocasión además, verificaremos que los métodos construidos en el recorrido anterior no hayan tenido sobrecargas distintas a lo largo del árbol de herencia." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "class TypeChecker:\n", - " def __init__(self, context, errors=[]):\n", - " self.context = context\n", - " self.current_type = None\n", - " self.current_method = None\n", - " self.errors = errors\n", - "\n", - " @visitor.on('node')\n", - " def visit(self, node, scope):\n", - " pass\n", - "\n", - " @visitor.when(ProgramNode)\n", - " def visit(self, node, scope=None):\n", - " scope = Scope()\n", - " for declaration in node.declarations:\n", - " self.visit(declaration, scope.create_child())\n", - " return scope\n", - "\n", - " @visitor.when(ClassDeclarationNode)\n", - " def visit(self, node, scope):\n", - " self.current_type = self.context.get_type(node.id)\n", - " \n", - " attrs = [f for f in node.features if isinstance(f, AttrDeclarationNode)]\n", - " funcs = [f for f in node.features if isinstance(f, FuncDeclarationNode)]\n", - " \n", - " for attr in attrs:\n", - " self.visit(attr, scope)\n", - " \n", - " for func in funcs:\n", - " self.visit(func, scope.create_child())\n", - " \n", - " @visitor.when(AttrDeclarationNode)\n", - " def visit(self, node, scope):\n", - " typex = self.context.get_type(node.type)\n", - " scope.define_variable(node.id, typex)\n", - "\n", - " @visitor.when(FuncDeclarationNode)\n", - " def visit(self, node, scope):\n", - " method = self.current_method = self.current_type.get_method(node.id)\n", - " param_types = [t.name for t in method.param_types]\n", - " return_type = method.return_type\n", - "\n", - " # checking overriding\n", - " parent = self.current_type.parent\n", - " while parent is not None:\n", - " try:\n", - " if method != parent.get_method(node.id):\n", - " self.errors.append(WRONG_SIGNATURE % (node.id, parent.name))\n", - " break\n", - " parent = parent.parent\n", - " except SemanticError:\n", - " break\n", - " \n", - " scope.define_variable('self', self.current_type)\n", - " for n, t in zip(method.param_names, method.param_types):\n", - " scope.define_variable(n, t)\n", - " \n", - " child_scope = scope.create_child()\n", - " for expr in node.body:\n", - " self.visit(expr, child_scope)\n", - " \n", - " @visitor.when(VarDeclarationNode)\n", - " def visit(self, node, scope):\n", - " if scope.is_defined(node.id):\n", - " self.errors.append(LOCAL_ALREADY_DEFINED % (node.id, self.current_method.name))\n", - " \n", - " var_type = self.context.get_type(node.type)\n", - " expr_type = self.visit(node.expr, scope)\n", - " \n", - " if not expr_type.conforms_to(var_type):\n", - " self.errors.append(INCOMPATIBLE_TYPES % (expr_type.name, var_type.name))\n", - " \n", - " scope.define_variable(node.id, var_type)\n", - " \n", - " return var_type\n", - " \n", - " @visitor.when(AssignNode)\n", - " def visit(self, node, scope):\n", - " if node.id == 'self':\n", - " self.errors.append(SELF_IS_READONLY)\n", - " \n", - " elif not scope.is_defined(node.id):\n", - " self.errors.append(VARIABLE_NOT_DEFINED % (node.id, self.current_type.name))\n", - " \n", - " var_type = scope.find_variable(node.id).type\n", - " expr_type = self.visit(node.expr, scope)\n", - " \n", - " if not expr_type.conforms_to(var_type):\n", - " self.errors.append(INCOMPATIBLE_TYPES % (expr_type.name, var_type.name))\n", - " \n", - " return var_type\n", - " \n", - " @visitor.when(CallNode)\n", - " def visit(self, node, scope):\n", - " obj_type = self.visit(node.obj, scope)\n", - " \n", - " try:\n", - " args = node.args\n", - " method = obj_type.get_method(node.id)\n", - " param_types = method.param_types\n", - " \n", - " for arg, param_type in zip(args, param_types):\n", - " arg_type = self.visit(arg, scope)\n", - " if not arg_type.conforms_to(param_type):\n", - " self.errors.append(INCOMPATIBLE_TYPES % (arg_type.name, param_type.name))\n", - " \n", - " return method.return_type\n", - " except SemanticError as e:\n", - " self.errors.append(e.text)\n", - " return ErrorType()\n", - " \n", - " @visitor.when(BinaryNode)\n", - " def visit(self, node, scope):\n", - " left_type = self.visit(node.left, scope)\n", - " right_type = self.visit(node.right, scope)\n", - " \n", - " if IntType() != left_type or IntType() != right_type:\n", - " self.errors.append(INVALID_OPERATION % (left_type.name, right_type.name))\n", - " \n", - " return IntType()\n", - " \n", - " @visitor.when(ConstantNumNode)\n", - " def visit(self, node, scope):\n", - " return IntType()\n", - "\n", - " @visitor.when(VariableNode)\n", - " def visit(self, node, scope):\n", - " var = scope.find_variable(node.lex)\n", - " if var is not None:\n", - " return var.type\n", - " else:\n", - " self.errors.append(VARIABLE_NOT_DEFINED % (node.lex, self.current_type.name))\n", - " return ErrorType()\n", - "\n", - " @visitor.when(InstantiateNode)\n", - " def visit(self, node, scope):\n", - " try:\n", - " return self.context.get_type(node.lex)\n", - " except SemanticError as e:\n", - " self.errors.append(e.text)\n", - " return ErrorType()\n", - "" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Pipeline\n", - "\n", - "Actualicemos el método `run_pipeline` para incluir esta nueva fase. Con eso deberíamos completar una línea de ejecución para llegar al final del chequeo semántico partiendo desde el programa en texto plano y la gramática." - ] - }, - { - "cell_type": "code", - "execution_count": 32, - "metadata": {}, - "outputs": [], - "source": [ - "from cp14 import run_pipeline as deprecated_pipeline\n", - "\n", - "def run_pipeline(G, text):\n", - " ast, errors, context = deprecated_pipeline(G, text)\n", - " print('=============== CHECKING TYPES ================')\n", - " checker = TypeChecker(context, errors)\n", - " scope = checker.visit(ast)\n", - " print('Errors: [')\n", - " for error in errors:\n", - " print('\\t', error)\n", - " print(']')\n", - " return ast, errors, context, scope" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Programa #1\n", - "\n", - "El siguiente programa no debería contener errores." - ] - }, - { - "cell_type": "code", - "execution_count": 34, - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": "=================== TEXT ======================\n\nclass A {\n a : int ;\n def suma ( a : int , b : int ) : int {\n a + b ;\n }\n b : int ;\n}\n\nclass B : A {\n c : int ;\n def f ( d : int , a : A ) : void {\n let f : int = 8 ;\n let c = new A ( ) . suma ( 5 , f ) ;\n c ;\n }\n}\n\n================== TOKENS =====================\nclass id {\n id : id ;\n def id ( id : id , id : id ) : id {\n id + id ;\n }\n id : id ;\n}\nclass id : id {\n id : id ;\n def id ( id : id , id : id ) : id {\n let id : id = int ;\n let id = new id ( ) . id ( int , id ) ;\n id ;\n }\n}\n$\n=================== PARSE =====================\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> id\n -> \n -> \n -> \n -> id\n -> \n -> \n -> + \n -> \n -> ;\n -> def id ( ) : id { }\n -> id : id ;\n -> e\n -> \n -> \n -> \n -> class id { }\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> int\n -> \n -> \n -> \n -> \n -> let id : id = \n -> new id ( )\n -> \n -> int\n -> \n -> \n -> \n -> \n -> id\n -> \n -> \n -> \n -> \n -> \n -> , \n -> . id ( )\n -> \n -> \n -> \n -> \n -> let id = \n -> id\n -> \n -> \n -> \n -> \n -> ;\n -> ; \n -> ; \n -> def id ( ) : id { }\n -> e\n -> \n -> \n -> class id : id { }\n -> \n -> \n -> \n==================== AST ======================\n\\__ProgramNode [ ... ]\n\t\\__ClassDeclarationNode: class A { ... }\n\t\t\\__AttrDeclarationNode: a : int\n\t\t\\__FuncDeclarationNode: def suma(a:int, b:int) : int -> \n\t\t\t\\__ PlusNode \n\t\t\t\t\\__ VariableNode: a\n\t\t\t\t\\__ VariableNode: b\n\t\t\\__AttrDeclarationNode: b : int\n\t\\__ClassDeclarationNode: class B : A { ... }\n\t\t\\__AttrDeclarationNode: c : int\n\t\t\\__FuncDeclarationNode: def f(d:int, a:A) : void -> \n\t\t\t\\__VarDeclarationNode: let f : int = \n\t\t\t\t\\__ ConstantNumNode: 8\n\t\t\t\\__AssignNode: let c = \n\t\t\t\t\\__CallNode: .suma(, ..., )\n\t\t\t\t\t\\__ InstantiateNode: new A()\n\t\t\t\t\t\\__ ConstantNumNode: 5\n\t\t\t\t\t\\__ VariableNode: f\n\t\t\t\\__ VariableNode: c\n============== COLLECTING TYPES ===============\nErrors: []\nContext:\n{\n\ttype int {}\n\t\n\ttype void {}\n\t\n\ttype A {}\n\t\n\ttype B {}\n\t\n}\n=============== BUILDING TYPES ================\nErrors: [\n]\nContext:\n{\n\ttype int {}\n\t\n\ttype void {}\n\t\n\ttype A {\n\t\t[attrib] a : int;\n\t\t[attrib] b : int;\n\t\t[method] suma(a:int, b:int): int;\n\t}\n\t\n\ttype B : A {\n\t\t[attrib] c : int;\n\t\t[method] f(d:int, a:A): void;\n\t}\n\t\n}\n=============== CHECKING TYPES ================\nErrors: [\n]\n" - } - ], - "source": [ - "text = '''\n", - "class A {\n", - " a : int ;\n", - " def suma ( a : int , b : int ) : int {\n", - " a + b ;\n", - " }\n", - " b : int ;\n", - "}\n", - "\n", - "class B : A {\n", - " c : int ;\n", - " def f ( d : int , a : A ) : void {\n", - " let f : int = 8 ;\n", - " let c = new A ( ) . suma ( 5 , f ) ;\n", - " c ;\n", - " }\n", - "}\n", - "'''\n", - "\n", - "if __name__ == '__main__':\n", - " ast, errors, context, scope = run_pipeline(G, text)\n", - " assert not errors" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Programa #2\n", - "\n", - "Se incluyeron varios errores al programa anterior. Intente detectar todos los errores posibles." - ] - }, - { - "cell_type": "code", - "execution_count": 36, - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": "=================== TEXT ======================\n\nclass A {\n a : int ;\n def suma ( a : int , b : int ) : int {\n a + b + new B ( ) ;\n }\n b : int ;\n}\n\nclass B : A {\n c : A ;\n def f ( d : int , a : A ) : void {\n let f : int = 8 ;\n let c = new A ( ) . suma ( 5 , f ) ;\n d ; \n }\n}\n\n================== TOKENS =====================\nclass id {\n id : id ;\n def id ( id : id , id : id ) : id {\n id + id + new id ( ) ;\n }\n id : id ;\n}\nclass id : id {\n id : id ;\n def id ( id : id , id : id ) : id {\n let id : id = int ;\n let id = new id ( ) . id ( int , id ) ;\n id ;\n }\n}\n$\n=================== PARSE =====================\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> id\n -> \n -> \n -> \n -> id\n -> \n -> \n -> + \n -> new id ( )\n -> \n -> \n -> + \n -> \n -> ;\n -> def id ( ) : id { }\n -> id : id ;\n -> e\n -> \n -> \n -> \n -> class id { }\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> int\n -> \n -> \n -> \n -> \n -> let id : id = \n -> new id ( )\n -> \n -> int\n -> \n -> \n -> \n -> \n -> id\n -> \n -> \n -> \n -> \n -> \n -> , \n -> . id ( )\n -> \n -> \n -> \n -> \n -> let id = \n -> id\n -> \n -> \n -> \n -> \n -> ;\n -> ; \n -> ; \n -> def id ( ) : id { }\n -> e\n -> \n -> \n -> class id : id { }\n -> \n -> \n -> \n==================== AST ======================\n\\__ProgramNode [ ... ]\n\t\\__ClassDeclarationNode: class A { ... }\n\t\t\\__AttrDeclarationNode: a : int\n\t\t\\__FuncDeclarationNode: def suma(a:int, b:int) : int -> \n\t\t\t\\__ PlusNode \n\t\t\t\t\\__ PlusNode \n\t\t\t\t\t\\__ VariableNode: a\n\t\t\t\t\t\\__ VariableNode: b\n\t\t\t\t\\__ InstantiateNode: new B()\n\t\t\\__AttrDeclarationNode: b : int\n\t\\__ClassDeclarationNode: class B : A { ... }\n\t\t\\__AttrDeclarationNode: c : A\n\t\t\\__FuncDeclarationNode: def f(d:int, a:A) : void -> \n\t\t\t\\__VarDeclarationNode: let f : int = \n\t\t\t\t\\__ ConstantNumNode: 8\n\t\t\t\\__AssignNode: let c = \n\t\t\t\t\\__CallNode: .suma(, ..., )\n\t\t\t\t\t\\__ InstantiateNode: new A()\n\t\t\t\t\t\\__ ConstantNumNode: 5\n\t\t\t\t\t\\__ VariableNode: f\n\t\t\t\\__ VariableNode: d\n============== COLLECTING TYPES ===============\nErrors: []\nContext:\n{\n\ttype int {}\n\t\n\ttype void {}\n\t\n\ttype A {}\n\t\n\ttype B {}\n\t\n}\n=============== BUILDING TYPES ================\nErrors: [\n]\nContext:\n{\n\ttype int {}\n\t\n\ttype void {}\n\t\n\ttype A {\n\t\t[attrib] a : int;\n\t\t[attrib] b : int;\n\t\t[method] suma(a:int, b:int): int;\n\t}\n\t\n\ttype B : A {\n\t\t[attrib] c : A;\n\t\t[method] f(d:int, a:A): void;\n\t}\n\t\n}\n=============== CHECKING TYPES ================\nErrors: [\n\t Operation is not defined between \"int\" and \"B\".\n\t Cannot convert \"int\" into \"A\".\n]\n" - } - ], - "source": [ - "text = '''\n", - "class A {\n", - " a : int ;\n", - " def suma ( a : int , b : int ) : int {\n", - " a + b + new B ( ) ;\n", - " }\n", - " b : int ;\n", - "}\n", - "\n", - "class B : A {\n", - " c : A ;\n", - " def f ( d : int , a : A ) : void {\n", - " let f : int = 8 ;\n", - " let c = new A ( ) . suma ( 5 , f ) ;\n", - " d ; \n", - " }\n", - "}\n", - "'''\n", - "\n", - "if __name__ == '__main__':\n", - " ast, errors, context, scope = run_pipeline(G, text)\n", - " assert set(errors) == {\n", - "\t 'Operation is not defined between \"int\" and \"B\".',\n", - "\t 'Cannot convert \"int\" into \"A\".'\n", - " }" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Propuestas\n", - "\n", - "- Añada support (en una rama alternativa) para detectar fila y columna donde ocurrió el error." - ] - }, - { - "cell_type": "code", - "execution_count": 37, - "metadata": {}, - "outputs": [], - "source": [ - "program = '''\n", - "class A {\n", - " a : int ;\n", - " def suma ( a : int , b : int ) : int {\n", - " a + b ;\n", - " }\n", - " b : int ;\n", - "}\n", - "\n", - "class B : A {\n", - " c : int ;\n", - " def suma ( d : int , a : int ) : int {\n", - " let f : int = 8 ;\n", - " let c = new A ( ) . suma ( 5 , f ) ;\n", - " c ;\n", - " }\n", - "}\n", - "'''" - ] - }, - { - "cell_type": "code", - "execution_count": 38, - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": "=================== TEXT ======================\n\nclass A {\n a : int ;\n def suma ( a : int , b : int ) : int {\n a + b ;\n }\n b : int ;\n}\n\nclass B : A {\n c : int ;\n def suma ( d : int , a : int ) : int {\n let f : int = 8 ;\n let c = new A ( ) . suma ( 5 , f ) ;\n c ;\n }\n}\n\n================== TOKENS =====================\nclass id {\n id : id ;\n def id ( id : id , id : id ) : id {\n id + id ;\n }\n id : id ;\n}\nclass id : id {\n id : id ;\n def id ( id : id , id : id ) : id {\n let id : id = int ;\n let id = new id ( ) . id ( int , id ) ;\n id ;\n }\n}\n$\n=================== PARSE =====================\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> id\n -> \n -> \n -> \n -> id\n -> \n -> \n -> + \n -> \n -> ;\n -> def id ( ) : id { }\n -> id : id ;\n -> e\n -> \n -> \n -> \n -> class id { }\n -> id : id ;\n -> id : id\n -> id : id\n -> \n -> , \n -> int\n -> \n -> \n -> \n -> \n -> let id : id = \n -> new id ( )\n -> \n -> int\n -> \n -> \n -> \n -> \n -> id\n -> \n -> \n -> \n -> \n -> \n -> , \n -> . id ( )\n -> \n -> \n -> \n -> \n -> let id = \n -> id\n -> \n -> \n -> \n -> \n -> ;\n -> ; \n -> ; \n -> def id ( ) : id { }\n -> e\n -> \n -> \n -> class id : id { }\n -> \n -> \n -> \n==================== AST ======================\n\\__ProgramNode [ ... ]\n\t\\__ClassDeclarationNode: class A { ... }\n\t\t\\__AttrDeclarationNode: a : int\n\t\t\\__FuncDeclarationNode: def suma(a:int, b:int) : int -> \n\t\t\t\\__ PlusNode \n\t\t\t\t\\__ VariableNode: a\n\t\t\t\t\\__ VariableNode: b\n\t\t\\__AttrDeclarationNode: b : int\n\t\\__ClassDeclarationNode: class B : A { ... }\n\t\t\\__AttrDeclarationNode: c : int\n\t\t\\__FuncDeclarationNode: def suma(d:int, a:int) : int -> \n\t\t\t\\__VarDeclarationNode: let f : int = \n\t\t\t\t\\__ ConstantNumNode: 8\n\t\t\t\\__AssignNode: let c = \n\t\t\t\t\\__CallNode: .suma(, ..., )\n\t\t\t\t\t\\__ InstantiateNode: new A()\n\t\t\t\t\t\\__ ConstantNumNode: 5\n\t\t\t\t\t\\__ VariableNode: f\n\t\t\t\\__ VariableNode: c\n============== COLLECTING TYPES ===============\nErrors: []\nContext:\n{\n\ttype int {}\n\t\n\ttype void {}\n\t\n\ttype A {}\n\t\n\ttype B {}\n\t\n}\n=============== BUILDING TYPES ================\nErrors: [\n]\nContext:\n{\n\ttype int {}\n\t\n\ttype void {}\n\t\n\ttype A {\n\t\t[attrib] a : int;\n\t\t[attrib] b : int;\n\t\t[method] suma(a:int, b:int): int;\n\t}\n\t\n\ttype B : A {\n\t\t[attrib] c : int;\n\t\t[method] suma(d:int, a:int): int;\n\t}\n\t\n}\n=============== CHECKING TYPES ================\nErrors: [\n]\n" - } - ], - "source": [ - "if __name__ == '__main__':\n", - " ast, errors, context, scope = run_pipeline(G, program)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.3-final" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} \ No newline at end of file diff --git a/src/cool/code_generation/notebooks/cp16.ipynb b/src/cool/code_generation/notebooks/cp16.ipynb deleted file mode 100644 index 943b4a69f..000000000 --- a/src/cool/code_generation/notebooks/cp16.ipynb +++ /dev/null @@ -1,807 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "source": [ - "# Clase Práctica #16 (Compilación)\n", - "\n", - "En esta clase estaremos implementado un mecanismo para transformar _ASTs_ de un lenguaje origen hacia un lenguaje intermedio. Trabajaremos con el lenguaje estudiado en las clases anteriores y lo transformaremos al lenguaje _CIL_. Recordemos que _CIL_ es un lenguaje intermedio cuyo único objetivo es proveer una representación cómoda para transitar entre el lenguaje origen y el destino.\n", - "\n", - "Pasemos a importar el trabajo de las clases anteriores.\n", - "\n", - "### Análisis Lexicográfico y Sintáctico" - ], - "metadata": {} - }, - { - "cell_type": "code", - "execution_count": 10, - "source": [ - "import cmp.nbpackage\r\n", - "import cmp.visitor as visitor\r\n", - "\r\n", - "from cp13 import G, text\r\n", - "from cp13 import Node, ProgramNode, DeclarationNode, ExpressionNode\r\n", - "from cp13 import ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode\r\n", - "from cp13 import VarDeclarationNode, AssignNode, CallNode\r\n", - "from cp13 import AtomicNode, BinaryNode\r\n", - "from cp13 import ConstantNumNode, VariableNode, InstantiateNode, PlusNode, MinusNode, StarNode, DivNode\r\n", - "from cp13 import FormatVisitor, tokenize_text, pprint_tokens\r\n", - "\r\n", - "from cmp.tools.parsing import LR1Parser\r\n", - "from cmp.evaluation import evaluate_reverse_parse" - ], - "outputs": [], - "metadata": {} - }, - { - "cell_type": "markdown", - "source": [ - "### Análisis Semántico (Recolección y Construcción de Tipos)" - ], - "metadata": {} - }, - { - "cell_type": "code", - "execution_count": 11, - "source": [ - "from cmp.semantic import SemanticError\r\n", - "from cmp.semantic import Attribute, Method, Type\r\n", - "from cmp.semantic import VoidType, ErrorType, IntType\r\n", - "from cmp.semantic import Context\r\n", - "\r\n", - "from cp14 import TypeCollector, TypeBuilder" - ], - "outputs": [], - "metadata": {} - }, - { - "cell_type": "markdown", - "source": [ - "### Análisis Semántico (Chequeo de tipos)" - ], - "metadata": {} - }, - { - "cell_type": "code", - "execution_count": 12, - "source": [ - "from cmp.semantic import Scope, VariableInfo\r\n", - "from cp15 import TypeChecker" - ], - "outputs": [], - "metadata": {} - }, - { - "cell_type": "markdown", - "source": [ - "## Transformación a CIL\n", - "\n", - "Partiendo de un AST semánticamente anotado (lo hicimos en las clases anteriores) queremos obtener un AST en otro lenguaje. Como es usual, realizaremos un recorrido por el AST original usando el patrón `visitor` pero esta vez pretendemos generar como salida un nuevo AST. Esto se traduce en devolver en el llamado principal de `visit`, el nodo que representa la raíz del nuevo lenguaje.\n", - "\n", - "El módulo `cmp.cil` provee una implementación de todos los nodos de CIL necesarios para transformar nuestro lenguaje. Además, se provee la implementación de `BaseCOOLToCILVisitor` que usaremos como base para realizar el recorrido. Esta clase contiene métodos auxiliares para facilitar la generación del nuevo AST.\n", - "\n", - "- Las variables de instancia `dottypes`, `dotdata` y `dotcode` almacenan los nodos correspondientes a las secciones `.TYPES`, `.DATA` y `.CODE` respectivamente de un programa en CIL.\n", - "- Las variables `current_type` y `current_method` almacenan instancias de `Type` y `Method` respectivamente.\n", - "- La variable `current_function` almacena el nodo `cil.FunctionNode` que está en proceso de construcción (estos nodos pertenecen a la sección `.CODE`).\n", - "- Para definir variables locales e instrucciones dentro de `current_function` se usan las funciones auxiliares `register_local` y `register_instruction` respectivamente.\n", - "- En caso de que se necesite definir una variable no declarada por el programador (para guardar resultados intermedios), el método `define_internal_local` provee un mecanismo para hacerlo.\n", - "- Los métodos `register_function` y `register_type` almacenan instancias de `cil.FunctionNode` y `cil.TypeNode` en las variables `dotcode` y `dottypes` respectivamente." - ], - "metadata": {} - }, - { - "cell_type": "code", - "execution_count": 13, - "source": [ - "class BaseCOOLToCILVisitor:\r\n", - " def __init__(self, context):\r\n", - " self.dottypes = []\r\n", - " self.dotdata = []\r\n", - " self.dotcode = []\r\n", - " self.current_type = None\r\n", - " self.current_method = None\r\n", - " self.current_function = None\r\n", - " self.context = context\r\n", - "\r\n", - " # for faster search\r\n", - " self.locals_dict = {}\r\n", - " self.param_set = set()\r\n", - " self.attr_set = set()\r\n", - " \r\n", - " @property\r\n", - " def params(self):\r\n", - " return self.current_function.params\r\n", - " \r\n", - " @property\r\n", - " def localvars(self):\r\n", - " return self.current_function.localvars\r\n", - " \r\n", - " @property\r\n", - " def instructions(self):\r\n", - " return self.current_function.instructions\r\n", - " \r\n", - " def register_local(self, vinfo):\r\n", - " vinfo.name = f'local_{self.current_function.name[9:]}_{vinfo.name}_{len(self.localvars)}'\r\n", - " local_node = cil.LocalNode(vinfo.name)\r\n", - " self.localvars.append(local_node)\r\n", - " return vinfo.name\r\n", - "\r\n", - " def define_internal_local(self):\r\n", - " vinfo = VariableInfo('internal', None)\r\n", - " return self.register_local(vinfo)\r\n", - "\r\n", - " def register_instruction(self, instruction):\r\n", - " self.instructions.append(instruction)\r\n", - " return instruction\r\n", - " \r\n", - " def to_function_name(self, method_name, type_name):\r\n", - " return f'function_{method_name}_at_{type_name}'\r\n", - " \r\n", - " def register_function(self, function_name):\r\n", - " function_node = cil.FunctionNode(function_name, [], [], [])\r\n", - " self.dotcode.append(function_node)\r\n", - " return function_node\r\n", - " \r\n", - " def register_type(self, name):\r\n", - " type_node = cil.TypeNode(name)\r\n", - " self.dottypes.append(type_node)\r\n", - " return type_node\r\n", - "\r\n", - " def register_data(self, value):\r\n", - " vname = f'data_{len(self.dotdata)}'\r\n", - " data_node = cil.DataNode(vname, value)\r\n", - " self.dotdata.append(data_node)\r\n", - " return data_node" - ], - "outputs": [], - "metadata": {} - }, - { - "cell_type": "markdown", - "source": [ - "### Implementación\n", - "\n", - "Pasemos a implementar un `visitor` concretamente. Para simplificar la implementación, asuma que el acceso (`VariableNode`) y asignación (`AssignNode`) de variables ocurre solo sobre variables locales. Realmente sería necesario desambiguar en cuales casos es un acceso a variable y en cuales un acceso a atributo. Esto queda propuesto como estudio individual." - ], - "metadata": {} - }, - { - "cell_type": "code", - "execution_count": 14, - "source": [ - "import cmp.cil as cil\r\n", - "\r\n", - "class MiniCOOLToCILVisitor(BaseCOOLToCILVisitor):\r\n", - " @visitor.on('node')\r\n", - " def visit(self, node):\r\n", - " pass\r\n", - " \r\n", - " @visitor.when(ProgramNode)\r\n", - " def visit(self, node, scope):\r\n", - " ######################################################\r\n", - " # node.declarations -> [ ClassDeclarationNode ... ]\r\n", - " ######################################################\r\n", - " \r\n", - " self.current_function = self.register_function('entry')\r\n", - " instance = self.define_internal_local()\r\n", - " result = self.define_internal_local()\r\n", - " main_method_name = self.to_function_name('main', 'Main')\r\n", - " self.register_instruction(cil.AllocateNode('Main', instance))\r\n", - " self.register_instruction(cil.ArgNode(instance))\r\n", - " self.register_instruction(cil.StaticCallNode(main_method_name, result))\r\n", - " self.register_instruction(cil.ReturnNode(0))\r\n", - " self.current_function = None\r\n", - " \r\n", - "\r\n", - " for declaration, child_scope in zip(node.declarations, scope.children):\r\n", - " self.attr_set.clear()\r\n", - " self.visit(declaration, child_scope)\r\n", - "\r\n", - " return cil.ProgramNode(self.dottypes, self.dotdata, self.dotcode)\r\n", - " \r\n", - " @visitor.when(ClassDeclarationNode)\r\n", - " def visit(self, node, scope):\r\n", - " \"\"\"\r\n", - " node.id -> str\r\n", - " node.parent -> str\r\n", - " node.features -> [ FuncDeclarationNode/AttrDeclarationNode ... ]\r\n", - " \"\"\"\r\n", - " \r\n", - " self.current_type = self.context.get_type(node.id)\r\n", - "\r\n", - " type_node = self.register_type(node.id)\r\n", - " \r\n", - " types = []\r\n", - " current_type = self.current_type\r\n", - " while current_type is not None:\r\n", - " types.append(current_type)\r\n", - " current_type = current_type.parent\r\n", - " \r\n", - " for current_type in reversed(types):\r\n", - " for attribute in current_type.attributes:\r\n", - " self.attr_set.add(attribute.name)\r\n", - " type_node.attributes.append(attribute.name)\r\n", - "\r\n", - " for method in current_type.methods:\r\n", - " type_node.methods.append((method.name, self.to_function_name(method.name, current_type.name)))\r\n", - " \r\n", - "\r\n", - " func_declarations = (f for f in node.features if isinstance(f, FuncDeclarationNode))\r\n", - " for feature, child_scope in zip(func_declarations, scope.children):\r\n", - " self.visit(feature, child_scope)\r\n", - " \r\n", - " self.current_type = None\r\n", - " \r\n", - " @visitor.when(FuncDeclarationNode)\r\n", - " def visit(self, node, scope):\r\n", - " \"\"\"\r\n", - " node.id -> str\r\n", - " node.params -> [ (str, str) ... ]\r\n", - " node.type -> str\r\n", - " node.body -> [ ExpressionNode ... ]\r\n", - " \"\"\"\r\n", - " \r\n", - " self.current_method = self.current_type.get_method(node.id)\r\n", - " self.current_function = self.register_function(self.to_function_name(node.id, self.current_type.name))\r\n", - " \r\n", - " # (Handle PARAMS)\r\n", - " self.param_set.clear()\r\n", - " self.current_function.params.append(cil.ParamNode('self'))\r\n", - " for name, _ in node.params:\r\n", - " self.param_set.add(name)\r\n", - " self.current_function.params.append(cil.ParamNode(name))\r\n", - " \r\n", - " self.locals_dict.clear()\r\n", - " child_scope = scope.children[0]\r\n", - " for instruction in node.body:\r\n", - " value = self.visit(instruction, child_scope)\r\n", - "\r\n", - " # (Handle RETURN)\r\n", - " if node.body and 'void' != node.type:\r\n", - " self.register_instruction(cil.ReturnNode(value))\r\n", - " else:\r\n", - " self.register_instruction(cil.ReturnNode())\r\n", - " \r\n", - " self.current_method = None\r\n", - "\r\n", - " @visitor.when(VarDeclarationNode)\r\n", - " def visit(self, node, scope):\r\n", - " \"\"\"\r\n", - " node.id -> str\r\n", - " node.type -> str\r\n", - " node.expr -> ExpressionNode\r\n", - " \"\"\"\r\n", - " vinfo = scope.find_variable(node.id)\r\n", - " dest = self.locals_dict[vinfo.name] = self.register_local(vinfo)\r\n", - " self.register_instruction(cil.AssignNode(dest, self.visit(node.expr, scope)))\r\n", - " return dest\r\n", - "\r\n", - " @visitor.when(AssignNode)\r\n", - " def visit(self, node, scope):\r\n", - " \"\"\"\r\n", - " node.id -> str\r\n", - " node.expr -> ExpressionNode\r\n", - " \"\"\"\r\n", - " if node.id in self.locals_dict:\r\n", - " dest = self.locals_dict[node.id]\r\n", - " self.register_instruction(cil.AssignNode(dest, self.visit(node.expr, scope)))\r\n", - " return dest\r\n", - " if node.id in self.param_set:\r\n", - " dest = node.id\r\n", - " self.register_instruction(cil.AssignNode(dest, self.visit(node.expr, scope)))\r\n", - " return dest\r\n", - " if node.id in self.attr_set:\r\n", - " pass # for now couse we are not handling set/get attrs\r\n", - "\r\n", - " @visitor.when(CallNode)\r\n", - " def visit(self, node, scope):\r\n", - " \"\"\"\r\n", - " node.obj -> AtomicNode\r\n", - " node.id -> str\r\n", - " node.args -> [ ExpressionNode ... ]\r\n", - " \"\"\"\r\n", - " \r\n", - " obj_dest = self.visit(node.obj, scope)\r\n", - " type_dest = self.define_internal_local()\r\n", - " self.register_instruction(cil.TypeOfNode(obj_dest, type_dest))\r\n", - "\r\n", - " args_dest = [obj_dest] + [self.visit(arg, scope) for arg in node.args]\r\n", - " for dest in args_dest:\r\n", - " self.register_instruction(cil.ArgNode(dest))\r\n", - " \r\n", - " call_dest = self.define_internal_local()\r\n", - " self.register_instruction(cil.DynamicCallNode(type_dest, self.to_function_name(node.id), call_dest))\r\n", - "\r\n", - " return call_dest\r\n", - "\r\n", - " @visitor.when(ConstantNumNode)\r\n", - " def visit(self, node, scope):\r\n", - " \"\"\"\r\n", - " node.lex -> str\r\n", - " \"\"\"\r\n", - " return node.lex\r\n", - "\r\n", - " @visitor.when(VariableNode)\r\n", - " def visit(self, node, scope):\r\n", - " \"\"\"\r\n", - " node.lex -> str\r\n", - " \"\"\"\r\n", - " if node.lex in self.locals_dict:\r\n", - " return self.locals_dict[node.lex]\r\n", - " if node.lex in self.param_set:\r\n", - " return node.lex\r\n", - " if node.lex in self.attr_set:\r\n", - " return node.lex # for now couse we are not handling set/get attr\r\n", - "\r\n", - " @visitor.when(InstantiateNode)\r\n", - " def visit(self, node, scope):\r\n", - " \"\"\"\r\n", - " node.lex -> str\r\n", - " \"\"\"\r\n", - " dest = self.define_internal_local()\r\n", - " self.register_instruction(cil.AllocateNode(node.lex, dest))\r\n", - " return dest\r\n", - "\r\n", - " @visitor.when(PlusNode)\r\n", - " def visit(self, node, scope):\r\n", - " \"\"\"\r\n", - " node.left -> ExpressionNode\r\n", - " node.right -> ExpressionNode\r\n", - " \"\"\"\r\n", - " dest = self.define_internal_local()\r\n", - " left = self.visit(node.left, scope)\r\n", - " right = self.visit(node.right, scope)\r\n", - " self.register_instruction(cil.PlusNode(dest, left, right))\r\n", - " return dest\r\n", - " \r\n", - "\r\n", - " @visitor.when(MinusNode)\r\n", - " def visit(self, node, scope):\r\n", - " \"\"\"\r\n", - " node.left -> ExpressionNode\r\n", - " node.right -> ExpressionNode\r\n", - " \"\"\"\r\n", - " dest = self.define_internal_local()\r\n", - " left = self.visit(node.left, scope)\r\n", - " right = self.visit(node.right, scope)\r\n", - " self.register_instruction(cil.MinusNode(dest, left, right))\r\n", - " return dest\r\n", - "\r\n", - " @visitor.when(StarNode)\r\n", - " def visit(self, node, scope):\r\n", - " \"\"\"\r\n", - " node.left -> ExpressionNode\r\n", - " node.right -> ExpressionNode\r\n", - " \"\"\"\r\n", - " dest = self.define_internal_local()\r\n", - " left = self.visit(node.left, scope)\r\n", - " right = self.visit(node.right, scope)\r\n", - " self.register_instruction(cil.StarNode(dest, left, right))\r\n", - " return dest\r\n", - "\r\n", - " @visitor.when(DivNode)\r\n", - " def visit(self, node, scope):\r\n", - " \"\"\"\r\n", - " node.left -> ExpressionNode\r\n", - " node.right -> ExpressionNode\r\n", - " \"\"\"\r\n", - " dest = self.define_internal_local()\r\n", - " left = self.visit(node.left, scope)\r\n", - " right = self.visit(node.right, scope)\r\n", - " self.register_instruction(cil.DivNode(dest, left, right))\r\n", - " return dest\r\n", - " \r\n", - " # ======================================================================" - ], - "outputs": [], - "metadata": {} - }, - { - "cell_type": "markdown", - "source": [ - "### Auxiliar Methods" - ], - "metadata": {} - }, - { - "cell_type": "code", - "execution_count": 15, - "source": [ - "def inspect_scope(scope, indent=0):\n", - " print('\\t' * indent + f'Locals: {[i.name for i in scope.locals]}')\n", - " \n", - " for child in scope.children: \n", - " inspect_scope(child, indent + 1)\n", - "\n", - "def find_unmatch(s1, s2):\n", - " if len(s1) != len(s2):\n", - " print(f'Different len {len(s1)}, {len(s2)}')\n", - "\n", - " for i, (c1, c2) in enumerate(zip(s1, s2)):\n", - " if c1 != c2:\n", - " print(f'Unmatch ({c1}, {c2}) in index {i}')\n", - " print(s1[i:])\n", - " break" - ], - "outputs": [], - "metadata": {} - }, - { - "cell_type": "markdown", - "source": [ - "### Pipeline\n", - "\n", - "Actualicemos el método `run_pipeline` para incluir esta nueva fase. Con eso deberíamos completar una línea de ejecución que, partiendo desde el programa en texto plano y la gramática, produzca una representación en CIL." - ], - "metadata": {} - }, - { - "cell_type": "code", - "execution_count": 16, - "source": [ - "from cp15 import run_pipeline as deprecated_pipeline\n", - "from cmp.cil import get_formatter\n", - "\n", - "formatter = get_formatter()\n", - "\n", - "def run_pipeline(G, text):\n", - " ast, errors, context, scope = deprecated_pipeline(G, text)\n", - " print('============= TRANSFORMING TO CIL =============')\n", - " cool_to_cil = MiniCOOLToCILVisitor(context)\n", - " cil_ast = cool_to_cil.visit(ast, scope)\n", - " formatter = get_formatter()\n", - " print(formatter(cil_ast))\n", - " return ast, errors, context, scope, cil_ast" - ], - "outputs": [], - "metadata": {} - }, - { - "cell_type": "markdown", - "source": [ - "### Programa #1\n", - "\n", - "El siguiente programa no debería contener errores." - ], - "metadata": {} - }, - { - "cell_type": "code", - "execution_count": 17, - "source": [ - "text = '''\n", - "class A {\n", - " a : int ;\n", - " def suma ( a : int , b : int ) : int {\n", - " a + b ;\n", - " }\n", - " b : int ;\n", - "}\n", - "\n", - "class B : A {\n", - " c : int ;\n", - " def f ( d : int , a : A ) : void {\n", - " let f : int = 8 ;\n", - " let c = new A ( ) . suma ( 5 , f ) ;\n", - " c ;\n", - " }\n", - "}\n", - "'''\n", - "\n", - "text_cil_no_attr = '''.TYPES\n", - "type A {\n", - "\tattribute a\n", - "\tattribute b\n", - "\n", - "\tmethod suma: function_suma_at_A\n", - "}\n", - "type B {\n", - "\tattribute a\n", - "\tattribute b\n", - "\tattribute c\n", - "\n", - "\tmethod suma: function_suma_at_A\n", - "\tmethod f: function_f_at_B\n", - "}\n", - "\n", - ".DATA\n", - "\n", - "\n", - ".CODE\n", - "function entry {\n", - "\t\n", - "\n", - "\tLOCAL local__internal_0\n", - "\tLOCAL local__internal_1\n", - "\n", - "\tlocal__internal_0 = ALLOCATE Main\n", - "\tARG local__internal_0\n", - "\tlocal__internal_1 = CALL function_main_at_Main\n", - "\tRETURN 0\n", - "}\n", - "function function_suma_at_A {\n", - "\tPARAM self\n", - "\tPARAM a\n", - "\tPARAM b\n", - "\n", - "\tLOCAL local_suma_at_A_internal_0\n", - "\n", - "\tlocal_suma_at_A_internal_0 = a + b\n", - "\tRETURN local_suma_at_A_internal_0\n", - "}\n", - "function function_f_at_B {\n", - "\tPARAM self\n", - "\tPARAM d\n", - "\tPARAM a\n", - "\n", - "\tLOCAL local_f_at_B_f_0\n", - "\n", - "\tlocal_f_at_B_f_0 = 8\n", - "\tRETURN \n", - "}'''\n", - "\n", - "if __name__ == '__main__':\n", - "\tast, errors, context, scope, cil_ast = run_pipeline(G, text)\n", - "\tassert formatter(cil_ast) == text_cil_no_attr" - ], - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "=================== TEXT ======================\n", - "\n", - "class A {\n", - " a : int ;\n", - " def suma ( a : int , b : int ) : int {\n", - " a + b ;\n", - " }\n", - " b : int ;\n", - "}\n", - "\n", - "class B : A {\n", - " c : int ;\n", - " def f ( d : int , a : A ) : void {\n", - " let f : int = 8 ;\n", - " let c = new A ( ) . suma ( 5 , f ) ;\n", - " c ;\n", - " }\n", - "}\n", - "\n", - "================== TOKENS =====================\n", - "class id {\n", - " id : id ;\n", - " def id ( id : id , id : id ) : id {\n", - " id + id ;\n", - " }\n", - " id : id ;\n", - "}\n", - "class id : id {\n", - " id : id ;\n", - " def id ( id : id , id : id ) : id {\n", - " let id : id = int ;\n", - " let id = new id ( ) . id ( int , id ) ;\n", - " id ;\n", - " }\n", - "}\n", - "$\n", - "=================== PARSE =====================\n", - " -> id : id ;\n", - " -> id : id\n", - " -> id : id\n", - " -> \n", - " -> , \n", - " -> id\n", - " -> \n", - " -> \n", - " -> \n", - " -> id\n", - " -> \n", - " -> \n", - " -> + \n", - " -> \n", - " -> ;\n", - " -> def id ( ) : id { }\n", - " -> id : id ;\n", - " -> e\n", - " -> \n", - " -> \n", - " -> \n", - " -> class id { }\n", - " -> id : id ;\n", - " -> id : id\n", - " -> id : id\n", - " -> \n", - " -> , \n", - " -> int\n", - " -> \n", - " -> \n", - " -> \n", - " -> \n", - " -> let id : id = \n", - " -> new id ( )\n", - " -> \n", - " -> int\n", - " -> \n", - " -> \n", - " -> \n", - " -> \n", - " -> id\n", - " -> \n", - " -> \n", - " -> \n", - " -> \n", - " -> \n", - " -> , \n", - " -> . id ( )\n", - " -> \n", - " -> \n", - " -> \n", - " -> \n", - " -> let id = \n", - " -> id\n", - " -> \n", - " -> \n", - " -> \n", - " -> \n", - " -> ;\n", - " -> ; \n", - " -> ; \n", - " -> def id ( ) : id { }\n", - " -> e\n", - " -> \n", - " -> \n", - " -> class id : id { }\n", - " -> \n", - " -> \n", - " -> \n", - "==================== AST ======================\n", - "\\__ProgramNode [ ... ]\n", - "\t\\__ClassDeclarationNode: class A { ... }\n", - "\t\t\\__AttrDeclarationNode: a : int\n", - "\t\t\\__FuncDeclarationNode: def suma(a:int, b:int) : int -> \n", - "\t\t\t\\__ PlusNode \n", - "\t\t\t\t\\__ VariableNode: a\n", - "\t\t\t\t\\__ VariableNode: b\n", - "\t\t\\__AttrDeclarationNode: b : int\n", - "\t\\__ClassDeclarationNode: class B : A { ... }\n", - "\t\t\\__AttrDeclarationNode: c : int\n", - "\t\t\\__FuncDeclarationNode: def f(d:int, a:A) : void -> \n", - "\t\t\t\\__VarDeclarationNode: let f : int = \n", - "\t\t\t\t\\__ ConstantNumNode: 8\n", - "\t\t\t\\__AssignNode: let c = \n", - "\t\t\t\t\\__CallNode: .suma(, ..., )\n", - "\t\t\t\t\t\\__ InstantiateNode: new A()\n", - "\t\t\t\t\t\\__ ConstantNumNode: 5\n", - "\t\t\t\t\t\\__ VariableNode: f\n", - "\t\t\t\\__ VariableNode: c\n", - "============== COLLECTING TYPES ===============\n", - "Errors: []\n", - "Context:\n", - "{\n", - "\ttype int {}\n", - "\t\n", - "\ttype void {}\n", - "\t\n", - "\ttype A {}\n", - "\t\n", - "\ttype B {}\n", - "\t\n", - "}\n", - "=============== BUILDING TYPES ================\n", - "Errors: [\n", - "]\n", - "Context:\n", - "{\n", - "\ttype int {}\n", - "\t\n", - "\ttype void {}\n", - "\t\n", - "\ttype A {\n", - "\t\t[attrib] a : int;\n", - "\t\t[attrib] b : int;\n", - "\t\t[method] suma(a:int, b:int): int;\n", - "\t}\n", - "\t\n", - "\ttype B : A {\n", - "\t\t[attrib] c : int;\n", - "\t\t[method] f(d:int, a:A): void;\n", - "\t}\n", - "\t\n", - "}\n", - "=============== CHECKING TYPES ================\n", - "Errors: [\n", - "]\n", - "============= TRANSFORMING TO CIL =============\n", - ".TYPES\n", - "type A {\n", - "\tattribute a\n", - "\tattribute b\n", - "\n", - "\tmethod suma: function_suma_at_A\n", - "}\n", - "type B {\n", - "\tattribute a\n", - "\tattribute b\n", - "\tattribute c\n", - "\n", - "\tmethod suma: function_suma_at_A\n", - "\tmethod f: function_f_at_B\n", - "}\n", - "\n", - ".DATA\n", - "\n", - "\n", - ".CODE\n", - "function entry {\n", - "\t\n", - "\n", - "\tLOCAL local__internal_0\n", - "\tLOCAL local__internal_1\n", - "\n", - "\tlocal__internal_0 = ALLOCATE Main\n", - "\tARG local__internal_0\n", - "\tlocal__internal_1 = CALL function_main_at_Main\n", - "\tRETURN 0\n", - "}\n", - "function function_suma_at_A {\n", - "\tPARAM self\n", - "\tPARAM a\n", - "\tPARAM b\n", - "\n", - "\tLOCAL local_suma_at_A_internal_0\n", - "\n", - "\tlocal_suma_at_A_internal_0 = a + b\n", - "\tRETURN local_suma_at_A_internal_0\n", - "}\n", - "function function_f_at_B {\n", - "\tPARAM self\n", - "\tPARAM d\n", - "\tPARAM a\n", - "\n", - "\tLOCAL local_f_at_B_f_0\n", - "\n", - "\tlocal_f_at_B_f_0 = 8\n", - "\tRETURN \n", - "}\n" - ] - } - ], - "metadata": {} - }, - { - "cell_type": "markdown", - "source": [ - "## Propuestas\n", - "\n", - "- Maneje el acceso y asignación a atributos (`GETATTR` y `SETATTR`).\n", - "- Implemente un intérprete de `CIL`." - ], - "metadata": {} - } - ], - "metadata": { - "kernelspec": { - "name": "python3", - "display_name": "Python 3.9.0 64-bit ('cool': virtualenv)" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.9.0" - }, - "interpreter": { - "hash": "7b7a60189ab2a9790105c6813c86fd6387dfcad969adb968418f9c1145203b58" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} \ No newline at end of file diff --git a/src/cool/code_generation/notebooks/lexer.py b/src/cool/code_generation/notebooks/lexer.py deleted file mode 100644 index 0f75d63d8..000000000 --- a/src/cool/code_generation/notebooks/lexer.py +++ /dev/null @@ -1,171 +0,0 @@ -from cmp.ast import AtomicNode, BinaryNode, UnaryNode -from cmp.automata import State -from cmp.pycompiler import Grammar -from cmp.tools.automata import ( - DFA, - NFA, - automata_closure, - automata_concatenation, - automata_minimization, - automata_union, - nfa_to_dfa, -) -from cmp.tools.evaluation import evaluate_parse -from cmp.tools.parsing import metodo_predictivo_no_recursivo -from cmp.utils import Token - - -class EpsilonNode(AtomicNode): - def evaluate(self): - return DFA(states=1, finals=[0], transitions={}) - - -class SymbolNode(AtomicNode): - def evaluate(self): - s = self.lex - return DFA(states=2, finals=[1], transitions={(0, s): 1}) - - -class ClosureNode(UnaryNode): - @staticmethod - def operate(value): - return automata_closure(value) - - -class UnionNode(BinaryNode): - @staticmethod - def operate(lvalue, rvalue): - return automata_union(lvalue, rvalue) - - -class ConcatNode(BinaryNode): - @staticmethod - def operate(lvalue, rvalue): - return automata_concatenation(lvalue, rvalue) - - -def regex_tokenizer(text, G, skip_whitespaces=True): - tokens = [] - fixed_tokens = {x: Token(x, G[x]) for x in ["|", "*", "(", ")", "ε"]} - iter_text = iter(text) - for c in iter_text: - if c == "\\": - tokens.append(Token(next(iter_text), G["symbol"])) - continue - - if skip_whitespaces and c.isspace(): - continue - - try: - token = fixed_tokens[c] - except KeyError: - token = Token(c, G["symbol"]) - tokens.append(token) - tokens.append(Token("$", G.EOF)) - return tokens - - -def build_grammar(): - G = Grammar() - E = G.NonTerminal("E", True) - T, F, A, X, Y, Z = G.NonTerminals("T F A X Y Z") - pipe, star, opar, cpar, symbol, epsilon = G.Terminals("| * ( ) symbol ε") - E %= T + X, lambda h, s: s[2], None, lambda h, s: s[1] - X %= pipe + E, lambda h, s: UnionNode(h[0], s[2]) - X %= G.Epsilon, lambda h, s: h[0] - T %= F + Y, lambda h, s: s[2], None, lambda h, s: s[1] - Y %= T, lambda h, s: ConcatNode(h[0], s[1]) - Y %= G.Epsilon, lambda h, s: h[0] - F %= A + Z, lambda h, s: s[2], None, lambda h, s: s[1] - Z %= star, lambda h, s: ClosureNode(h[0]) - Z %= G.Epsilon, lambda h, s: h[0] - A %= symbol, lambda h, s: SymbolNode(s[1]) - A %= epsilon, lambda h, s: EpsilonNode(s[1]) - A %= opar + E + cpar, lambda h, s: s[2] - return G - - -G = build_grammar() -parser = metodo_predictivo_no_recursivo(G) - - -class Regex: - def __init__(self, regex, skip_whitespaces=False): - self.regex = regex - self.automaton = self.build_automaton(regex) - - def __call__(self, text): - return self.automaton.recognize(text) - - @staticmethod - def build_automaton(regex, skip_whitespaces=False): - tokens = regex_tokenizer(regex, G, skip_whitespaces=False) - left_parse = parser(tokens) - ast = evaluate_parse(left_parse, tokens) - nfa = ast.evaluate() - dfa = nfa_to_dfa(nfa) - dfa = automata_minimization(dfa) - return dfa - - -class Lexer: - def __init__(self, table, eof): - self.eof = eof - self.regexs = self._build_regexs(table) - self.automaton = self._build_automaton() - - def _build_regexs(self, table): - regexs = [] - for n, (token_type, regex) in enumerate(table): - automaton = Regex.build_automaton(regex) - automaton, states = State.from_nfa(automaton, get_states=True) - - for state in states: - if state.final: - state.tag = (n, token_type) - - regexs.append(automaton) - return regexs - - def _build_automaton(self): - start = State("start") - regexs = self.regexs - - for regex in regexs: - start.add_epsilon_transition(regex) - - return start.to_deterministic() - - def _walk(self, string): - state = self.automaton - final = state if state.final else None - final_lex = lex = "" - - for symbol in string: - try: - state = state[symbol][0] - lex += symbol - final, final_lex = (state, lex) if state.final else (final, final_lex) - except TypeError: - break - - return final, final_lex - - def _tokenize(self, text): - while text: - state, lex = self._walk(text) - - if state is not None: - text = text[len(lex) :] - token_type = min( - (s for s in state.state if s.final), key=lambda x: x.tag - ).tag[1] - yield lex, token_type - - else: - return None - - yield "$", self.eof - - def __call__(self, text): - return [Token(lex, token_type) for lex, token_type in self._tokenize(text)] diff --git a/src/cool/code_generation/translator_cil_to_mips.py b/src/cool/code_generation/translator_cil_to_mips.py new file mode 100644 index 000000000..5f39662f4 --- /dev/null +++ b/src/cool/code_generation/translator_cil_to_mips.py @@ -0,0 +1,77 @@ +from typing import List + +import cool.code_generation.ast_cil as cil +import cool.code_generation.ast_mips as mips +import cool.visitor.visitor as visitor +from cool.semantics.utils.scope import Context + + +class BaseCilToMipsVisitor: + def __init__(self, context: Context) -> None: + self.dotdata: List[mips.DataNode] = [] + self.dottext: List[mips.InstructionNode] = [] + + self.context = context + + def register_word(self, name: str, value: str) -> mips.WordDataNode: + data = mips.WordDataNode(name, value) + self.dotdata.append(data) + return data + + def register_ascii(self, name: str, value: str) -> mips.AsciizDataNode: + data = mips.AsciizDataNode(name, value) + self.dotdata.append(data) + return data + + def register_instruction(self, instruction: mips.InstructionNode) -> mips.InstructionNode: + self.dottext.append(instruction) + return instruction + + def register_empty_data(self): + self.dotdata.append(mips.EmptyDataNode()) + + def to_data_type(self, data_name: str, type_name: str) -> str: + return f"type_{type_name}_{data_name}" + + +class CilToMipsTranslator(BaseCilToMipsVisitor): + @visitor.on('node') + def visit(self, node): + pass + + @visitor.when(cil.ProgramNode) + def visit(self, node: cil.ProgramNode): + + for type_node in node.dottypes: + self.visit(type_node) + + for function_node in node.dotcode: + self.visit(function_node) + + self.register_instruction(mips.LabelNode("main")) + + + return mips.ProgramNode(self.dotdata, self.dottext) + + @visitor.when(cil.TypeNode) + def visit(self, node: cil.TypeNode): + size = 4 * (1 + len(node.attributes)) + + self.register_word(f"type_{node.name}", str(size)) + self.register_word(self.to_data_type("inherits_from", node.name), f"type_{node.parent}" if node.parent != "null" else "0") + self.register_word(self.to_data_type("attributes", node.name), str(len(node.attributes))) + self.register_ascii(self.to_data_type("name", node.name), f"\"{node.name}\"") + + self.register_empty_data() + + @visitor.when(cil.FunctionNode) + def visit(self, node: cil.FunctionNode): + self.register_instruction(mips.LabelNode(node.name)) + + + # for instruction in node.instructions: + # self.visit(instruction) + + # @visitor.when(cil.InstructionNode) + # def visit(self, node: cil.InstructionNode): + # pass diff --git a/src/cool/code_generation/cool_to_cil_visitor.py b/src/cool/code_generation/translator_cool_to_cil.py similarity index 85% rename from src/cool/code_generation/cool_to_cil_visitor.py rename to src/cool/code_generation/translator_cool_to_cil.py index 5e07aa232..dc3dcfa41 100644 --- a/src/cool/code_generation/cool_to_cil_visitor.py +++ b/src/cool/code_generation/translator_cool_to_cil.py @@ -1,12 +1,10 @@ -from typing import Dict, List, Optional, Tuple +from typing import Any, Dict, List, Optional, Tuple -import cool.code_generation.cil as cil -import cool.code_generation.extended_cool as extended_cool +import cool.code_generation.ast_cil as cil +import cool.code_generation.ast_ecool as ecool import cool.semantics.utils.astnodes as cool import cool.semantics.utils.errors as err -import cool.visitor as visitor import cool.visitor.visitor as visitor -from cool.code_generation.base import BaseCOOLToCILVisitor from cool.semantics.utils.scope import ( Attribute, Context, @@ -108,7 +106,7 @@ def visit(self, node: cool.AttrDeclarationNode): expr = cool.StringNode('""') else: expr = ( - extended_cool.NullNode() + ecool.NullNode() ) # cool.WhileNode(cool.BooleanNode("false"), cool.IntegerNode("0")) return cool.AssignNode(node.id, expr) @@ -444,9 +442,9 @@ def visit(self, node: cool.StringNode, scope: Scope): def visit(self, node: cool.BooleanNode, scope: Scope): return self.context.get_type("Bool") - @visitor.when(extended_cool.NullNode) - def visit(self, node: extended_cool.NullNode, scope: Scope): - return extended_cool.NullType() + @visitor.when(ecool.NullNode) + def visit(self, node: ecool.NullNode, scope: Scope): + return ecool.NullType() @visitor.when(cool.VariableNode) def visit(self, node: cool.VariableNode, scope: Scope): @@ -570,7 +568,79 @@ def _check_unary_operation( return ErrorType() -class CoolToCilTranslator(BaseCOOLToCILVisitor): +class BaseCoolToCilVisitor: + def __init__(self, context: Context): + self.dottypes: List[cil.TypeNode] = [] + self.dotdata: List[cil.DataNode] = [] + self.dotcode: List[cil.FunctionNode] = [] + + self.current_type: Optional[Type] = None + self.current_method: Optional[Method] = None + self.current_function: Optional[cil.FunctionNode] = None + + self.context: Context = context + + self.locals_dict = {} + self.param_set = set() + self.attr_set = set() + + @property + def params(self) -> List[cil.ParamNode]: + return self.current_function.params + + @property + def localvars(self) -> List[cil.LocalNode]: + return self.current_function.local_vars + + @property + def instructions(self) -> List[cil.InstructionNode]: + return self.current_function.instructions + + def register_local(self, var_name: str, comment: str = "") -> str: + local_name = ( + f"local_{self.current_function.name[9:]}_{var_name}_{len(self.localvars)}" + ) + local_name = var_name + local_node = cil.LocalNode(local_name).set_comment(comment) + self.localvars.append(local_node) + return local_name + + def define_internal_local(self, comment: str = "") -> str: + return self.register_local(f"internal_{len(self.localvars)}", comment) + + def register_instruction( + self, instruction: cil.InstructionNode + ) -> cil.InstructionNode: + self.instructions.append(instruction) + return instruction + + def to_function_name(self, method_name: str, type_name: str) -> str: + return f"function_{method_name}_at_{type_name}" + + def register_function(self, function_name: str) -> cil.FunctionNode: + function_node = cil.FunctionNode(function_name, [], [], []) + self.dotcode.append(function_node) + return function_node + + def register_type(self, name: str, parent_name: Optional[str] = None) -> cil.TypeNode: + type_node = cil.TypeNode(name, parent_name) + self.dottypes.append(type_node) + return type_node + + def register_data(self, value: Any) -> cil.DataNode: + data_name = f"data_{len(self.dotdata)}" + data_node = cil.DataNode(data_name, value) + self.dotdata.append(data_node) + return data_node + + def register_comment(self, comment: str) -> cil.CommentNode: + self.register_instruction(cil.CommentNode(comment)) + + def register_empty_instruction(self): + self.register_instruction(cil.EmptyInstruction()) + + +class CoolToCilTranslator(BaseCoolToCilVisitor): # Notes: # 1 - All the expression nodes are going to return a tuple [str, Type] @@ -580,6 +650,92 @@ def visit(self, node, scope): @visitor.when(cool.ProgramNode) def visit(self, node: cool.ProgramNode, scope: Scope): + default_class_names = ["Object", "IO", "Int", "String", "Bool"] + for name in default_class_names: + t = self.context.get_type(name) + self.current_type = t + cil_type_node = self.register_type(t.name, t.parent.name if t.parent is not None else None) + for method, owner in t.all_methods(): + cil_type_node.methods.append((method.name, self.to_function_name(method.name, owner.name))) + cil_type_node.methods.append(("__init__", self.to_function_name("__init__", t.name))) + + + self.current_function = self.register_function(self.to_function_name("__init__", "Object")) + self.current_function.params.append(cil.ParamNode("self")) + self.register_instruction(cil.ReturnNode("self")) + + self.current_function = self.register_function(self.to_function_name("abort", "Object")) + self.current_function.params.append(cil.ParamNode("self")) + self.register_instruction(cil.HaltNode()) + self.register_instruction(cil.ReturnNode()) + + self.current_function = self.register_function(self.to_function_name("type_name", "Object")) + self.current_function.params.append(cil.ParamNode("self")) + type_name = self.register_local("type_name") + self.register_instruction(cil.TypeNameNode(type_name, "self")) + self.register_instruction(cil.ReturnNode(type_name)) + + self.current_function = self.register_function(self.to_function_name("copy", "Object")) + self.current_function.params.append(cil.ParamNode("self")) + local_copy = self.define_internal_local() + self.register_instruction(cil.CopyNode(local_copy, "self")) + self.register_instruction(cil.ReturnNode(local_copy)) + + self.current_function = self.register_function(self.to_function_name("__init__", "IO")) + self.current_function.params.append(cil.ParamNode("self")) + self.register_instruction(cil.ReturnNode("self")) + + self.current_function = self.register_function(self.to_function_name("out_string", "IO")) + self.current_function.params.append(cil.ParamNode("self")) + self.current_function.params.append(cil.ParamNode("x")) + self.register_instruction(cil.PrintIntNode("x")) + self.register_instruction(cil.ReturnNode("self")) + + self.current_function = self.register_function(self.to_function_name("out_int", "IO")) + self.current_function.params.append(cil.ParamNode("self")) + self.current_function.params.append(cil.ParamNode("x")) + self.register_instruction(cil.PrintIntNode("x")) + self.register_instruction(cil.ReturnNode("self")) + + self.current_function = self.register_function(self.to_function_name("in_string", "IO")) + self.current_function.params.append(cil.ParamNode("self")) + local_int = self.define_internal_local() + self.register_instruction(cil.ReadIntNode(local_int)) + self.register_instruction(cil.ReturnNode(local_int)) + + self.current_function = self.register_function(self.to_function_name("in_int", "IO")) + self.current_function.params.append(cil.ParamNode("self")) + local_int = self.define_internal_local() + self.register_instruction(cil.ReadIntNode(local_int)) + self.register_instruction(cil.ReturnNode(local_int)) + + self.current_function = self.register_function(self.to_function_name("__init__", "S")) + self.current_function.params.append(cil.ParamNode("self")) + self.register_instruction(cil.ReturnNode("self")) + + self.current_function = self.register_function(self.to_function_name("length", "String")) + self.current_function.params.append(cil.ParamNode("self")) + len_local = self.define_internal_local() + self.register_instruction(cil.LengthNode(len_local, "self")) + self.register_instruction(cil.ReturnNode(len_local)) + + self.current_function = self.register_function(self.to_function_name("concat", "String")) + self.current_function.params.append(cil.ParamNode("self")) + self.current_function.params.append(cil.ParamNode("s")) + new_str = self.define_internal_local() + self.register_instruction(cil.ConcatNode(new_str, "self", "s")) + self.register_instruction(cil.ReturnNode(new_str)) + + self.current_function = self.register_function(self.to_function_name("substr", "String")) + self.current_function.params.append(cil.ParamNode("self")) + self.current_function.params.append(cil.ParamNode("i")) + self.current_function.params.append(cil.ParamNode("l")) + substr = self.define_internal_local() + self.register_instruction(cil.SubstringNode(substr, "self", "i", "l")) + self.register_instruction(cil.ReturnNode(substr)) + + + for i, declaration in enumerate(node.declarations): self.visit(declaration, scope.children[i]) @@ -589,7 +745,7 @@ def visit(self, node: cool.ProgramNode, scope: Scope): def visit(self, node: cool.ClassDeclarationNode, scope: Scope): self.current_type = self.context.get_type(node.id) - type_node = self.register_type(self.current_type.name) + type_node = self.register_type(self.current_type.name, self.current_type.parent.name) attrs = [ feature @@ -957,10 +1113,10 @@ def visit(self, node: cool.MethodCallNode, scope: Scope): self.register_instruction(cil.ArgNode(arg_source)) call_dest = self.define_internal_local() - method = obj_type.get_method(node.id) + method, owner = obj_type.get_method(node.id, get_owner=True) self.register_instruction( cil.DynamicCallNode( - obj_type.name, self.to_function_name(node.id, obj_type.name), call_dest + obj_type.name, self.to_function_name(node.id, owner.name), call_dest ) ) return call_dest, method.return_type @@ -977,9 +1133,9 @@ def visit(self, node: cool.StringNode, scope: Scope): def visit(self, node: cool.BooleanNode, scope: Scope): return ("1" if node.lex == "true" else "0"), self.context.get_type("Bool") - @visitor.when(extended_cool.NullNode) - def visit(self, node: extended_cool.NullNode, scope: Scope): - return node.lex, extended_cool.NullType + @visitor.when(ecool.NullNode) + def visit(self, node: ecool.NullNode, scope: Scope): + return node.lex, ecool.NullType @visitor.when(cool.VariableNode) def visit(self, node: cool.VariableNode, scope: Scope): diff --git a/src/main..asm b/src/main..asm new file mode 100644 index 000000000..cfea16ec6 --- /dev/null +++ b/src/main..asm @@ -0,0 +1,49 @@ +.data + type_Object: .word 4 + type_Object_inherits_from: .word 0 + type_Object_attributes: .word 0 + type_Object_name: .asciiz "Object" + + type_IO: .word 4 + type_IO_inherits_from: .word type_Object + type_IO_attributes: .word 0 + type_IO_name: .asciiz "IO" + + type_Int: .word 4 + type_Int_inherits_from: .word type_Object + type_Int_attributes: .word 0 + type_Int_name: .asciiz "Int" + + type_String: .word 4 + type_String_inherits_from: .word type_Object + type_String_attributes: .word 0 + type_String_name: .asciiz "String" + + type_Bool: .word 4 + type_Bool_inherits_from: .word type_Object + type_Bool_attributes: .word 0 + type_Bool_name: .asciiz "Bool" + + type_Main: .word 8 + type_Main_inherits_from: .word type_IO + type_Main_attributes: .word 1 + type_Main_name: .asciiz "Main" + + +.text + function___init___at_Object: + function_abort_at_Object: + function_type_name_at_Object: + function_copy_at_Object: + function___init___at_IO: + function_out_string_at_IO: + function_out_int_at_IO: + function_in_string_at_IO: + function_in_int_at_IO: + function___init___at_S: + function_length_at_String: + function_concat_at_String: + function_substr_at_String: + function___init___at_Main: + function_main_at_Main: + main: \ No newline at end of file diff --git a/src/main..cil b/src/main..cil new file mode 100644 index 000000000..ab7e59380 --- /dev/null +++ b/src/main..cil @@ -0,0 +1,190 @@ +.TYPES +type Object { + inherits from null + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method __init__: function___init___at_Object +} +type IO { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method out_string: function_out_string_at_IO + method out_int: function_out_int_at_IO + method in_string: function_in_string_at_IO + method in_int: function_in_int_at_IO + method __init__: function___init___at_IO +} +type Int { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method __init__: function___init___at_Int +} +type String { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method length: function_length_at_String + method concat: function_concat_at_String + method substr: function_substr_at_String + method __init__: function___init___at_String +} +type Bool { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method __init__: function___init___at_Bool +} +type Main { + inherits from IO + + attribute number + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method out_string: function_out_string_at_IO + method out_int: function_out_int_at_IO + method in_string: function_in_string_at_IO + method in_int: function_in_int_at_IO + method main: function_main_at_Main + method __init__: function___init___at_Main +} + +.DATA + + +.CODE +function function___init___at_Object{ + PARAM self + + RETURN self +} +function function_abort_at_Object{ + PARAM self + + HALT + + RETURN 0 +} +function function_type_name_at_Object{ + PARAM self + + LOCAL type_name + + type_name = TYPENAME self + + RETURN type_name +} +function function_copy_at_Object{ + PARAM self + + LOCAL internal_0 + + internal_0 = COPY self + + RETURN internal_0 +} +function function___init___at_IO{ + PARAM self + + RETURN self +} +function function_out_string_at_IO{ + PARAM self + PARAM x + + PRINTINT x + + RETURN self +} +function function_out_int_at_IO{ + PARAM self + PARAM x + + PRINTINT x + + RETURN self +} +function function_in_string_at_IO{ + PARAM self + + LOCAL internal_0 + + READINT internal_0 + + RETURN internal_0 +} +function function_in_int_at_IO{ + PARAM self + + LOCAL internal_0 + + READINT internal_0 + + RETURN internal_0 +} +function function___init___at_S{ + PARAM self + + RETURN self +} +function function_length_at_String{ + PARAM self + + LOCAL internal_0 + + internal_0 = LENGTH self + + RETURN internal_0 +} +function function_concat_at_String{ + PARAM self + PARAM s + + LOCAL internal_0 + + internal_0 = CONCAT self s + + RETURN internal_0 +} +function function_substr_at_String{ + PARAM self + PARAM i + PARAM l + + LOCAL internal_0 + + internal_0 = SUBSTRING self i l + + RETURN internal_0 +} +function function___init___at_Main{ + PARAM self + + SETATTR self number 0 + + RETURN self +} +function function_main_at_Main{ + PARAM self + + LOCAL internal_0 + + ARG self + ARG "Hello, World!\n" + internal_0 = VCALL Main function_out_string_at_IO + + RETURN internal_0 +} \ No newline at end of file diff --git a/main.cl b/src/main.cl similarity index 70% rename from main.cl rename to src/main.cl index 87eb0de98..448d414d9 100644 --- a/main.cl +++ b/src/main.cl @@ -52,23 +52,10 @@ class Point3D inherits Point { }; *) -class Main { +class Main inherits IO{ number: Int <- 0; main() : Object { - { - -- if true then "Hello" else "World" fi; - - -- while true loop - -- number <- number + 1 - -- pool; - - case 1 of - a: Int => 0; - b: Bool => not true; - c: String => new IO; - d: Object => ~25; - esac; - } + out_string("Hello, World!\n") }; -}; \ No newline at end of file +}; From 143c79ea98b9c037b6f4084fb8d62d096735885a Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Tue, 22 Feb 2022 02:10:13 -0500 Subject: [PATCH 135/143] Added an empty instruction to the mips ast nodes --- src/cool/code_generation/ast_mips.py | 6 +++++- src/cool/code_generation/formatters.py | 4 ++++ .../code_generation/translator_cil_to_mips.py | 5 +++++ src/main..asm | 15 +++++++++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/cool/code_generation/ast_mips.py b/src/cool/code_generation/ast_mips.py index b6b36da42..f7c9367ab 100644 --- a/src/cool/code_generation/ast_mips.py +++ b/src/cool/code_generation/ast_mips.py @@ -235,4 +235,8 @@ class JumpRegisterNode(OneAddressInstructionNode): class LabelNode(InstructionNode): def __init__(self, name: str): - self.name: str = name \ No newline at end of file + self.name: str = name + + +class EmptyInstructionNode(InstructionNode): + pass diff --git a/src/cool/code_generation/formatters.py b/src/cool/code_generation/formatters.py index 683fe2187..25a0420b9 100644 --- a/src/cool/code_generation/formatters.py +++ b/src/cool/code_generation/formatters.py @@ -381,6 +381,10 @@ def visit(self, node: mips.ThreeAddressIntructionNode): def visit(self, node: mips.LabelNode): return f"{node.name}:" + @visitor.when(mips.EmptyInstructionNode) + def visit(self, node: mips.EmptyInstructionNode): + return "" + @visitor.when(mips.EmptyDataNode) def visit(self, node: mips.EmptyDataNode): return "" diff --git a/src/cool/code_generation/translator_cil_to_mips.py b/src/cool/code_generation/translator_cil_to_mips.py index 5f39662f4..7d93c31f2 100644 --- a/src/cool/code_generation/translator_cil_to_mips.py +++ b/src/cool/code_generation/translator_cil_to_mips.py @@ -27,6 +27,10 @@ def register_instruction(self, instruction: mips.InstructionNode) -> mips.Instru self.dottext.append(instruction) return instruction + def register_empty_instruction(self) -> mips.EmptyInstructionNode: + self.dottext.append(mips.EmptyInstructionNode()) + return self.dottext[-1] + def register_empty_data(self): self.dotdata.append(mips.EmptyDataNode()) @@ -67,6 +71,7 @@ def visit(self, node: cil.TypeNode): @visitor.when(cil.FunctionNode) def visit(self, node: cil.FunctionNode): self.register_instruction(mips.LabelNode(node.name)) + self.register_empty_instruction() # for instruction in node.instructions: diff --git a/src/main..asm b/src/main..asm index cfea16ec6..b1ea17b2e 100644 --- a/src/main..asm +++ b/src/main..asm @@ -32,18 +32,33 @@ .text function___init___at_Object: + function_abort_at_Object: + function_type_name_at_Object: + function_copy_at_Object: + function___init___at_IO: + function_out_string_at_IO: + function_out_int_at_IO: + function_in_string_at_IO: + function_in_int_at_IO: + function___init___at_S: + function_length_at_String: + function_concat_at_String: + function_substr_at_String: + function___init___at_Main: + function_main_at_Main: + main: \ No newline at end of file From f9a071434af7ba89c24392c1db6b45fa9ce4563d Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Tue, 22 Feb 2022 02:21:10 -0500 Subject: [PATCH 136/143] Added instruction `jr $ra` at the end of each function label in the mips file --- src/cool/code_generation/formatters.py | 17 ++++++- .../code_generation/translator_cil_to_mips.py | 1 + src/main..asm | 45 ++++++++++++------- 3 files changed, 47 insertions(+), 16 deletions(-) diff --git a/src/cool/code_generation/formatters.py b/src/cool/code_generation/formatters.py index 25a0420b9..66828cf5e 100644 --- a/src/cool/code_generation/formatters.py +++ b/src/cool/code_generation/formatters.py @@ -356,8 +356,23 @@ def visit(self, node): @visitor.when(mips.ProgramNode) def visit(self, node: mips.ProgramNode): + def is_function_label(node: mips.InstructionNode): + return isinstance(node, mips.LabelNode) and ( + node.name.startswith("function_") or node.name == "main" + ) + dotdata = "\n\t".join([self.visit(data) for data in node.dotdata]) - dottext = "\n\t".join([self.visit(data) for data in node.dottext]) + + instructions = [ + ( + f"{self.visit(inst)}" + if is_function_label(inst) + else f"\t{self.visit(inst)}" + ) + for inst in node.dottext + ] + + dottext = "\n\t".join(instructions) return f".data\n\t{dotdata}\n\n.text\n\t{dottext}" diff --git a/src/cool/code_generation/translator_cil_to_mips.py b/src/cool/code_generation/translator_cil_to_mips.py index 7d93c31f2..94809529d 100644 --- a/src/cool/code_generation/translator_cil_to_mips.py +++ b/src/cool/code_generation/translator_cil_to_mips.py @@ -71,6 +71,7 @@ def visit(self, node: cil.TypeNode): @visitor.when(cil.FunctionNode) def visit(self, node: cil.FunctionNode): self.register_instruction(mips.LabelNode(node.name)) + self.register_instruction(mips.JumpRegisterNode("$ra")) self.register_empty_instruction() diff --git a/src/main..asm b/src/main..asm index b1ea17b2e..eea8623fa 100644 --- a/src/main..asm +++ b/src/main..asm @@ -32,33 +32,48 @@ .text function___init___at_Object: - + jr $ra + function_abort_at_Object: - + jr $ra + function_type_name_at_Object: - + jr $ra + function_copy_at_Object: - + jr $ra + function___init___at_IO: - + jr $ra + function_out_string_at_IO: - + jr $ra + function_out_int_at_IO: - + jr $ra + function_in_string_at_IO: - + jr $ra + function_in_int_at_IO: - + jr $ra + function___init___at_S: - + jr $ra + function_length_at_String: - + jr $ra + function_concat_at_String: - + jr $ra + function_substr_at_String: - + jr $ra + function___init___at_Main: - + jr $ra + function_main_at_Main: - + jr $ra + main: \ No newline at end of file From 073d3e9f71f413d37600806b734b4cc12b232fc3 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Tue, 22 Feb 2022 02:28:10 -0500 Subject: [PATCH 137/143] Fixed an error in the naming of the mips and cil file names --- src/cool/__main__.py | 4 +--- src/{main..asm => main.asm} | 0 src/{main..cil => main.cil} | 0 3 files changed, 1 insertion(+), 3 deletions(-) rename src/{main..asm => main.asm} (100%) rename src/{main..cil => main.cil} (100%) diff --git a/src/cool/__main__.py b/src/cool/__main__.py index ec22a724e..0fbf27543 100644 --- a/src/cool/__main__.py +++ b/src/cool/__main__.py @@ -153,13 +153,11 @@ def compile( if verbose or True: if cil: - with open(f"{input_file.name[:-2]}.cil", "w+") as cil_file: + with open(f"{input_file.name[:-2]}cil", "w+") as cil_file: cil_program = CilFormatter().visit(cil_ast) - output_file.name = f"{input_file.name[:-2]}.cil" cil_file.write(cil_program) mips_program = MipsFormatter().visit(mips_ast) - output_file.name = f"{input_file.name[:-2]}.asm" output_file.write(mips_program) output_file.close() diff --git a/src/main..asm b/src/main.asm similarity index 100% rename from src/main..asm rename to src/main.asm diff --git a/src/main..cil b/src/main.cil similarity index 100% rename from src/main..cil rename to src/main.cil From 31c04a2be2b915c7d0bb6128f1c8323cdabb8ab6 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Wed, 23 Feb 2022 02:50:20 -0500 Subject: [PATCH 138/143] Translation of arithmetic operations to mips already done --- src/cool/code_generation/ast_cil.py | 4 +- src/cool/code_generation/ast_mips.py | 34 ++- src/cool/code_generation/formatters.py | 32 ++- .../code_generation/translator_cil_to_mips.py | 140 ++++++++-- .../code_generation/translator_cool_to_cil.py | 4 +- src/main.asm | 257 +++++++++++++++++- src/main.cil | 50 +++- src/main.cl | 19 +- 8 files changed, 504 insertions(+), 36 deletions(-) diff --git a/src/cool/code_generation/ast_cil.py b/src/cool/code_generation/ast_cil.py index 94753d4c2..4bc75369f 100644 --- a/src/cool/code_generation/ast_cil.py +++ b/src/cool/code_generation/ast_cil.py @@ -205,8 +205,8 @@ def __init__(self, name: str): class ReturnNode(InstructionNode): - def __init__(self, value=None): - self.value = value + def __init__(self, value: str = None): + self.value: str = value class LoadNode(InstructionNode): diff --git a/src/cool/code_generation/ast_mips.py b/src/cool/code_generation/ast_mips.py index f7c9367ab..216504da2 100644 --- a/src/cool/code_generation/ast_mips.py +++ b/src/cool/code_generation/ast_mips.py @@ -2,7 +2,11 @@ class Node: - pass + comment: str = "" + + def set_comment(self, comment: str) -> "Node": + self.comment = comment + return self class ProgramNode(Node): @@ -233,10 +237,38 @@ class JumpRegisterNode(OneAddressInstructionNode): #################################### +####################################### +# Memory Access and Load Instructions # +####################################### + +class LoadWordNode(TwoAddressIntructionNode): + code = "lw" + + +class StoreWordNode(TwoAddressIntructionNode): + code = "sw" + + +class MoveFromLowNode(OneAddressInstructionNode): + code = "mflo" + + +class MoveFromHighNode(OneAddressInstructionNode): + code = "mfhi" + + +########################################### +# End Memory Access and Load Instructions # +########################################### + class LabelNode(InstructionNode): def __init__(self, name: str): self.name: str = name +class CommentNode(InstructionNode): + def __init__(self, comment: str): + self.comment: str = comment + class EmptyInstructionNode(InstructionNode): pass diff --git a/src/cool/code_generation/formatters.py b/src/cool/code_generation/formatters.py index 66828cf5e..0ad0fba66 100644 --- a/src/cool/code_generation/formatters.py +++ b/src/cool/code_generation/formatters.py @@ -378,23 +378,45 @@ def is_function_label(node: mips.InstructionNode): @visitor.when(mips.DataNode) def visit(self, node: mips.DataNode): - return f"{node.name}: {node.data_type} {node.value}" + return ( + f"{node.name}: {node.data_type} {node.value}" + if node.comment == "" + else f"{node.name}: {node.data_type} {node.value} # {node.comment}" + ) @visitor.when(mips.OneAddressInstructionNode) def visit(self, node: mips.OneAddressInstructionNode): - return f"{node.code} {node.dest}" + return ( + f"{node.code} {node.dest}" + if node.comment == "" + else f"{node.code} {node.dest} # {node.comment}" + ) @visitor.when(mips.TwoAddressIntructionNode) def visit(self, node: mips.TwoAddressIntructionNode): - return f"{node.code} {node.dest} {node.source}" + return ( + f"{node.code} {node.dest}, {node.source}" + if node.comment == "" + else f"{node.code} {node.dest}, {node.source} # {node.comment}" + ) @visitor.when(mips.ThreeAddressIntructionNode) def visit(self, node: mips.ThreeAddressIntructionNode): - return f"{node.code} {node.dest}, {node.source1}, {node.source2}" + return ( + f"{node.code} {node.dest}, {node.source1}, {node.source2}" + if node.comment == "" + else f"{node.code} {node.dest}, {node.source1}, {node.source2} # {node.comment}" + ) @visitor.when(mips.LabelNode) def visit(self, node: mips.LabelNode): - return f"{node.name}:" + return ( + f"{node.name}:" if node.comment == "" else f"{node.name}: # {node.comment}" + ) + + @visitor.when(mips.CommentNode) + def visit(self, node: mips.CommentNode): + return f"# {node.comment}" @visitor.when(mips.EmptyInstructionNode) def visit(self, node: mips.EmptyInstructionNode): diff --git a/src/cool/code_generation/translator_cil_to_mips.py b/src/cool/code_generation/translator_cil_to_mips.py index 94809529d..6fe57503b 100644 --- a/src/cool/code_generation/translator_cil_to_mips.py +++ b/src/cool/code_generation/translator_cil_to_mips.py @@ -1,4 +1,6 @@ -from typing import List +from operator import index +from threading import stack_size +from typing import List, Optional import cool.code_generation.ast_cil as cil import cool.code_generation.ast_mips as mips @@ -11,41 +13,55 @@ def __init__(self, context: Context) -> None: self.dotdata: List[mips.DataNode] = [] self.dottext: List[mips.InstructionNode] = [] + self.current_function: Optional[cil.FunctionNode] = None + self.current_function_stack: List[str] = [] + self.context = context def register_word(self, name: str, value: str) -> mips.WordDataNode: data = mips.WordDataNode(name, value) self.dotdata.append(data) return data - + def register_ascii(self, name: str, value: str) -> mips.AsciizDataNode: data = mips.AsciizDataNode(name, value) self.dotdata.append(data) return data - - def register_instruction(self, instruction: mips.InstructionNode) -> mips.InstructionNode: + + def register_instruction( + self, instruction: mips.InstructionNode + ) -> mips.InstructionNode: self.dottext.append(instruction) return instruction - + def register_empty_instruction(self) -> mips.EmptyInstructionNode: self.dottext.append(mips.EmptyInstructionNode()) return self.dottext[-1] - + def register_empty_data(self): self.dotdata.append(mips.EmptyDataNode()) + def register_comment(self, comment: str) -> mips.CommentNode: + self.dottext.append(mips.CommentNode(comment)) + return self.dottext[-1] + def to_data_type(self, data_name: str, type_name: str) -> str: return f"type_{type_name}_{data_name}" + def offset_of(self, local_name: str) -> int: + stack_size = 4 * len(self.current_function_stack) + index = 4 * self.current_function_stack.index(local_name) + return stack_size - index - 4 + class CilToMipsTranslator(BaseCilToMipsVisitor): - @visitor.on('node') + @visitor.on("node") def visit(self, node): pass @visitor.when(cil.ProgramNode) def visit(self, node: cil.ProgramNode): - + for type_node in node.dottypes: self.visit(type_node) @@ -54,7 +70,6 @@ def visit(self, node: cil.ProgramNode): self.register_instruction(mips.LabelNode("main")) - return mips.ProgramNode(self.dotdata, self.dottext) @visitor.when(cil.TypeNode) @@ -62,22 +77,109 @@ def visit(self, node: cil.TypeNode): size = 4 * (1 + len(node.attributes)) self.register_word(f"type_{node.name}", str(size)) - self.register_word(self.to_data_type("inherits_from", node.name), f"type_{node.parent}" if node.parent != "null" else "0") - self.register_word(self.to_data_type("attributes", node.name), str(len(node.attributes))) - self.register_ascii(self.to_data_type("name", node.name), f"\"{node.name}\"") - + self.register_word( + self.to_data_type("inherits_from", node.name), + f"type_{node.parent}" if node.parent != "null" else "0", + ) + self.register_word( + self.to_data_type("attributes", node.name), str(len(node.attributes)) + ) + self.register_ascii(self.to_data_type("name", node.name), f'"{node.name}"') + self.register_empty_data() @visitor.when(cil.FunctionNode) def visit(self, node: cil.FunctionNode): + self.current_function = node self.register_instruction(mips.LabelNode(node.name)) - self.register_instruction(mips.JumpRegisterNode("$ra")) + + param_names = [x.name for x in self.current_function.params] + local_names = [x.name for x in self.current_function.local_vars] + self.current_function_stack = ["$ra"] + param_names + local_names + + locals_size = 4 * len(self.current_function.local_vars) + stack_size = 4 * len(self.current_function_stack) + + self.register_comment("Function parameters") + self.register_comment(f" $ra = {stack_size - 4}($sp)") + for i, param_name in enumerate(param_names, start=2): + self.register_comment(f" {param_name} = {stack_size - (4 * i)}($sp)") self.register_empty_instruction() + if self.current_function.local_vars: + self.register_comment("Reserving space for local variables") + self.register_instruction(mips.AddiNode("$sp", "$sp", f"{-locals_size}")) + self.register_empty_instruction() - # for instruction in node.instructions: - # self.visit(instruction) + for instruction in node.instructions: + # TODO: Remove the try/except block when the visitor is fixed + try: + self.visit(instruction) + except Exception as e: + continue + self.register_empty_instruction() + + if self.current_function.local_vars: + self.register_comment("Freeing space for local variables") + self.register_instruction(mips.AddiNode("$sp", "$sp", f"{locals_size}")) + self.register_empty_instruction() + + self.register_instruction(mips.JumpRegisterNode("$ra")) + self.register_empty_instruction() + + @visitor.when(cil.PlusNode) + def visit(self, node: cil.PlusNode): + self.register_comment("addition operation") + self.preprocess_binary_operation(node) + self.register_instruction(mips.AddNode("$t0", "$t0", "$t1").set_comment("$t0 = $t0 + $t1")) + self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment("Storing result of addition")) + + @visitor.when(cil.MinusNode) + def visit(self, node: cil.MinusNode): + self.register_comment("Subtraction operation") + self.preprocess_binary_operation(node) + self.register_instruction(mips.SubNode("$t0", "$t0", "$t1").set_comment("$t0 = $t0 - $t1")) + self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment("Store result of subtraction")) + + @visitor.when(cil.StarNode) + def visit(self, node: cil.StarNode): + self.register_comment("Multiplication operation") + self.preprocess_binary_operation(node) + self.register_instruction(mips.MultNode("$t0", "$t1").set_comment("$t0 = $t0 * $t1")) + self.register_instruction(mips.MoveFromLowNode("$t0")) + self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment("Store result of multiplication")) + + @visitor.when(cil.DivNode) + def visit(self, node: cil.DivNode): + self.register_comment("Division operation") + self.preprocess_binary_operation(node) + self.register_instruction(mips.DivNode("$t0", "$t1").set_comment("$t0 = $t0 / $t1")) + self.register_instruction(mips.MoveFromLowNode("$t0")) + self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment("Store result of division")) - # @visitor.when(cil.InstructionNode) - # def visit(self, node: cil.InstructionNode): - # pass + @visitor.when(cil.XorNode) + def visit(self, node: cil.XorNode): + self.register_comment("Xor operation") + self.preprocess_binary_operation(node) + self.register_instruction(mips.XorNode("$t0", "$t0", "$t1").set_comment("$t0 = $t0 ^ $t1")) + self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment("Store result of xor")) + + @visitor.when(cil.ReturnNode) + def visit(self, node: cil.ReturnNode): + offset = self.offset_of(node.value) + self.register_comment("Loading return value in $v1") + self.register_instruction(mips.LoadWordNode("$v1", f"{offset}($sp)")) + + def preprocess_binary_operation(self, node: cil.ArithmeticNode): + if node.left.isdigit() and node.right.isdigit(): + self.register_instruction(mips.AddiNode("$t0", "$zero", node.left).set_comment("Save in $t0 the left operand")) + self.register_instruction(mips.AddiNode("$t1", "$zero", node.right).set_comment("Save in $t1 the right operand")) + elif node.left.isdigit(): + self.register_instruction(mips.AddiNode("$t0", "$zero", node.left).set_comment("Save in $t0 the left operand")) + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.right)}($sp)").set_comment("Save in $t1 the right operand")) + elif node.right.isdigit(): + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.left)}($sp)").set_comment("Save in $t0 the left operand")) + self.register_instruction(mips.AddiNode("$t1", "$zero", node.right).set_comment("Save in $t1 the right operand")) + else: + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.left)}($sp)").set_comment("Save in $t0 the left operand")) + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.right)}($sp)").set_comment("Save in $t1 the right operand")) \ No newline at end of file diff --git a/src/cool/code_generation/translator_cool_to_cil.py b/src/cool/code_generation/translator_cool_to_cil.py index dc3dcfa41..6b2cff4e3 100644 --- a/src/cool/code_generation/translator_cool_to_cil.py +++ b/src/cool/code_generation/translator_cool_to_cil.py @@ -709,7 +709,7 @@ def visit(self, node: cool.ProgramNode, scope: Scope): self.register_instruction(cil.ReadIntNode(local_int)) self.register_instruction(cil.ReturnNode(local_int)) - self.current_function = self.register_function(self.to_function_name("__init__", "S")) + self.current_function = self.register_function(self.to_function_name("__init__", "String")) self.current_function.params.append(cil.ParamNode("self")) self.register_instruction(cil.ReturnNode("self")) @@ -734,8 +734,6 @@ def visit(self, node: cool.ProgramNode, scope: Scope): self.register_instruction(cil.SubstringNode(substr, "self", "i", "l")) self.register_instruction(cil.ReturnNode(substr)) - - for i, declaration in enumerate(node.declarations): self.visit(declaration, scope.children[i]) diff --git a/src/main.asm b/src/main.asm index eea8623fa..f70ff0424 100644 --- a/src/main.asm +++ b/src/main.asm @@ -32,48 +32,303 @@ .text function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + jr $ra function_abort_at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + jr $ra function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + jr $ra function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + jr $ra function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + jr $ra function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + + # Loading return value in $v1 + lw $v1, 4($sp) + jr $ra function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + + # Loading return value in $v1 + lw $v1, 4($sp) + jr $ra function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + jr $ra function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + jr $ra - function___init___at_S: + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + jr $ra function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + jr $ra function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + jr $ra function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + jr $ra function___init___at_Main: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + + # Loading return value in $v1 + lw $v1, 0($sp) + jr $ra function_main_at_Main: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + jr $ra + + function_plus_at_Main: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # addition operation + lw $t0, 8($sp) # Save in $t0 the left operand + lw $t1, 4($sp) # Save in $t1 the right operand + add $t0, $t0, $t1 # $t0 = $t0 + $t1 + sw $t0, 0($sp) # Storing result of addition + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_minus_at_Main: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand + lw $t1, 4($sp) # Save in $t1 the right operand + sub $t0, $t0, $t1 # $t0 = $t0 - $t1 + sw $t0, 0($sp) # Store result of subtraction + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult_at_Main: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand + lw $t1, 4($sp) # Save in $t1 the right operand + mult $t0, $t1 # $t0 = $t0 * $t1 + mflo $t0 + sw $t0, 0($sp) # Store result of multiplication + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div_at_Main: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand + lw $t1, 4($sp) # Save in $t1 the right operand + div $t0, $t1 # $t0 = $t0 / $t1 + mflo $t0 + sw $t0, 0($sp) # Store result of division + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + jr $ra main: \ No newline at end of file diff --git a/src/main.cil b/src/main.cil index ab7e59380..eb0c8d5a2 100644 --- a/src/main.cil +++ b/src/main.cil @@ -59,6 +59,10 @@ type Main { method in_string: function_in_string_at_IO method in_int: function_in_int_at_IO method main: function_main_at_Main + method plus: function_plus_at_Main + method minus: function_minus_at_Main + method mult: function_mult_at_Main + method div: function_div_at_Main method __init__: function___init___at_Main } @@ -135,7 +139,7 @@ function function_in_int_at_IO{ RETURN internal_0 } -function function___init___at_S{ +function function___init___at_String{ PARAM self RETURN self @@ -179,12 +183,50 @@ function function___init___at_Main{ } function function_main_at_Main{ PARAM self + + RETURN 0 +} +function function_plus_at_Main{ + PARAM self + PARAM a + PARAM b + + LOCAL internal_0 + + internal_0 = a + b + + RETURN internal_0 +} +function function_minus_at_Main{ + PARAM self + PARAM a + PARAM b + + LOCAL internal_0 + + internal_0 = a - b + + RETURN internal_0 +} +function function_mult_at_Main{ + PARAM self + PARAM a + PARAM b + + LOCAL internal_0 + + internal_0 = a * b + + RETURN internal_0 +} +function function_div_at_Main{ + PARAM self + PARAM a + PARAM b LOCAL internal_0 - ARG self - ARG "Hello, World!\n" - internal_0 = VCALL Main function_out_string_at_IO + internal_0 = a / b RETURN internal_0 } \ No newline at end of file diff --git a/src/main.cl b/src/main.cl index 448d414d9..27c7e6efc 100644 --- a/src/main.cl +++ b/src/main.cl @@ -56,6 +56,23 @@ class Main inherits IO{ number: Int <- 0; main() : Object { - out_string("Hello, World!\n") + -- out_string("Hello, World!\n") + 0 + }; + + plus(a: Int, b: Int) : Int { + a + b + }; + + minus(a: Int, b: Int) : Int { + a - b + }; + + mult(a: Int, b: Int) : Int { + a * b + }; + + div(a: Int, b: Int) : Int { + a / b }; }; From 5841feb01dcb755f499dedafa71b93f2df29d4d0 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Fri, 25 Feb 2022 00:59:27 -0500 Subject: [PATCH 139/143] Cil to Mips translation terminated, its time to fin bugs. --- src/cool/code_generation/ast_cil.py | 48 +- src/cool/code_generation/ast_mips.py | 40 ++ src/cool/code_generation/formatters.py | 24 +- .../code_generation/translator_cil_to_mips.py | 481 +++++++++++++++++- .../code_generation/translator_cool_to_cil.py | 49 +- src/cool/grammar.py | 22 +- src/main.asm | 447 +++++++++++++--- src/main.cil | 79 +-- src/main.cl | 47 +- 9 files changed, 1008 insertions(+), 229 deletions(-) diff --git a/src/cool/code_generation/ast_cil.py b/src/cool/code_generation/ast_cil.py index 4bc75369f..7070e52ff 100644 --- a/src/cool/code_generation/ast_cil.py +++ b/src/cool/code_generation/ast_cil.py @@ -1,3 +1,4 @@ +from operator import le from typing import Any, List, Optional, Tuple @@ -109,18 +110,19 @@ class XorNode(ArithmeticNode): class GetAttribNode(InstructionNode): - def __init__(self, dest: str, instance: str, attr: str) -> None: + def __init__(self, dest: str, instance: str, attr: str, attr_index: int) -> None: self.dest: str = dest self.instance: str = instance self.attr: str = attr + self.attr_index: int = attr_index -class SetAttribNode(InstructionNode): - def __init__(self, instance: str, attr: str, source: str) -> None: +class SetAttributeNode(InstructionNode): + def __init__(self, instance: str, attr: str, source: str, attr_index: int) -> None: self.instance: str = instance self.attr: str = attr self.source: str = source - + self.attr_index: int = attr_index class GetIndexNode(InstructionNode): def __init__(self, dest: str, instance: str, index: str) -> None: @@ -154,13 +156,13 @@ def __init__( dest: str, obj: str, ): - self.obj: str = obj + self.source: str = obj self.dest: str = dest class AncestorNode(InstructionNode): - def __init__(self, dest: str, obj: str): - self.obj: str = obj + def __init__(self, dest: str, source: str): + self.source: str = source self.dest: str = dest @@ -193,15 +195,18 @@ def __init__(self, function, dest): class DynamicCallNode(InstructionNode): - def __init__(self, xtype: str, method: str, dest: str): + def __init__(self, xtype: str, method: str, dest: str, total_args: int): self.type = xtype self.method = method self.dest = dest + self.total_args = total_args class ArgNode(InstructionNode): - def __init__(self, name: str): + def __init__(self, name: str, arg_index: int, total_args: int): self.name: str = name + self.arg_index: int = arg_index + self.total_args: int = total_args class ReturnNode(InstructionNode): @@ -239,11 +244,26 @@ def __init__(self, dest: str, str_address: str, start: int, length: int): self.start: int = start self.length: int = length -class ToStrNode(InstructionNode): - def __init__(self, dest, ivalue): - self.dest = dest - self.ivalue = ivalue +class AllocateStrNode(InstructionNode): + def __init__(self, dest: str, value: str): + self.dest: str = dest + self.value: str = value + @property + def string(self): + s = self.value.replace('\\n', '\n') + s = s.replace('\\t', '\t') + s = s.replace('\\b', '\b') + s = s.replace('\\f', '\f') + return s[1:-1] + + @property + def length(self): + x = self.value.count('\\n') + x += self.value.count('\\t') + x += self.value.count('\\b') + x += self.value.count('\\f') + return len(self.value) - x - 2 class ReadStringNode(InstructionNode): def __init__(self, dest): @@ -262,7 +282,7 @@ def __init__(self, str_addr): class PrintIntNode(InstructionNode): def __init__(self, value): - self.value = value + self.source = value class CopyNode(InstructionNode): diff --git a/src/cool/code_generation/ast_mips.py b/src/cool/code_generation/ast_mips.py index 216504da2..ad6b686bc 100644 --- a/src/cool/code_generation/ast_mips.py +++ b/src/cool/code_generation/ast_mips.py @@ -31,6 +31,10 @@ class WordDataNode(DataNode): data_type = ".word" +class SpaceDataNode(DataNode): + data_type = ".space" + + class AsciizDataNode(DataNode): data_type = ".asciiz" @@ -175,6 +179,13 @@ class SltiuNode(ThreeAddressIntructionNode): code = "sltiu" +class SleNode(ThreeAddressIntructionNode): + code = "sle" + + +class SeqNode(ThreeAddressIntructionNode): + code = "seq" + ######################################### # End Arithmetic and Logic Instructions # ######################################### @@ -188,6 +199,10 @@ class BeqNode(ThreeAddressIntructionNode): code = "beq" +class BgeNode(ThreeAddressIntructionNode): + code = "bge" + + class BgezNode(TwoAddressIntructionNode): code = "bgez" @@ -241,6 +256,19 @@ class JumpRegisterNode(OneAddressInstructionNode): # Memory Access and Load Instructions # ####################################### + +class LoadInmediateNode(TwoAddressIntructionNode): + code = "li" + + +class LoadAddressNode(TwoAddressIntructionNode): + code = "la" + + +class LoadByteNode(TwoAddressIntructionNode): + code = "lb" + + class LoadWordNode(TwoAddressIntructionNode): code = "lw" @@ -249,6 +277,14 @@ class StoreWordNode(TwoAddressIntructionNode): code = "sw" +class StoreByteNode(TwoAddressIntructionNode): + code = "sb" + + +class MoveNode(TwoAddressIntructionNode): + code = "move" + + class MoveFromLowNode(OneAddressInstructionNode): code = "mflo" @@ -261,6 +297,10 @@ class MoveFromHighNode(OneAddressInstructionNode): # End Memory Access and Load Instructions # ########################################### +class SystemCallNode(InstructionNode): + code = "syscall" + + class LabelNode(InstructionNode): def __init__(self, name: str): self.name: str = name diff --git a/src/cool/code_generation/formatters.py b/src/cool/code_generation/formatters.py index 0ad0fba66..686d0b073 100644 --- a/src/cool/code_generation/formatters.py +++ b/src/cool/code_generation/formatters.py @@ -147,9 +147,9 @@ def visit(self, node: cil.AllocateNode): @visitor.when(cil.TypeOfNode) def visit(self, node: cil.TypeOfNode): return ( - f"{node.dest} = TYPEOF {node.obj}" + f"{node.dest} = TYPEOF {node.source}" if node.comment == "" - else f"{node.dest} = TYPEOF {node.obj} # {node.comment}" + else f"{node.dest} = TYPEOF {node.source} # {node.comment}" ) @visitor.when(cil.TypeDirectionNode) @@ -163,9 +163,9 @@ def visit(self, node: cil.TypeDirectionNode): @visitor.when(cil.AncestorNode) def visit(self, node: cil.AncestorNode): return ( - f"{node.dest} = ANCESTOR {node.obj}" + f"{node.dest} = ANCESTOR {node.source}" if node.comment == "" - else f"{node.dest} = ANCESTOR {node.obj} # {node.comment}" + else f"{node.dest} = ANCESTOR {node.source} # {node.comment}" ) @visitor.when(cil.StaticCallNode) @@ -192,8 +192,8 @@ def visit(self, node: cil.GetAttribNode): else f"{node.dest} = GETATTR {node.instance} {node.attr} # {node.comment}" ) - @visitor.when(cil.SetAttribNode) - def visit(self, node: cil.SetAttribNode): + @visitor.when(cil.SetAttributeNode) + def visit(self, node: cil.SetAttributeNode): return ( f"SETATTR {node.instance} {node.attr} {node.source}" if node.comment == "" @@ -295,9 +295,9 @@ def visit(self, node: cil.PrintStringNode): @visitor.when(cil.PrintIntNode) def visit(self, node: cil.PrintIntNode): return ( - f"PRINTINT {node.value}" + f"PRINTINT {node.source}" if node.comment == "" - else f"PRININT {node.value} # {node.comment}" + else f"PRININT {node.source} # {node.comment}" ) @visitor.when(cil.ReadStringNode) @@ -340,6 +340,10 @@ def visit(self, node: cil.SubstringNode): else f"{node.dest} = SUBSTRING {node.str_address} {node.start} {node.length} # {node.comment}" ) + @visitor.when(cil.AllocateStrNode) + def visit(self, node: cil.AllocateStrNode): + return (f"{node.dest} = ALLOCSTR {node.value}") if node.comment == "" else f"{node.dest} = ALLOCSTR {node.value} # {node.comment}" + @visitor.when(cil.CommentNode) def visit(self, node: cil.CommentNode): return f"# {node.comment}" @@ -408,6 +412,10 @@ def visit(self, node: mips.ThreeAddressIntructionNode): else f"{node.code} {node.dest}, {node.source1}, {node.source2} # {node.comment}" ) + @visitor.when(mips.SystemCallNode) + def visit(self, node: mips.SystemCallNode): + return node.code + @visitor.when(mips.LabelNode) def visit(self, node: mips.LabelNode): return ( diff --git a/src/cool/code_generation/translator_cil_to_mips.py b/src/cool/code_generation/translator_cil_to_mips.py index 6fe57503b..5bb94df9e 100644 --- a/src/cool/code_generation/translator_cil_to_mips.py +++ b/src/cool/code_generation/translator_cil_to_mips.py @@ -1,6 +1,6 @@ from operator import index from threading import stack_size -from typing import List, Optional +from typing import List, Optional, Union import cool.code_generation.ast_cil as cil import cool.code_generation.ast_mips as mips @@ -27,10 +27,13 @@ def register_ascii(self, name: str, value: str) -> mips.AsciizDataNode: data = mips.AsciizDataNode(name, value) self.dotdata.append(data) return data + + def register_space(self, name: str, value: str) -> mips.AsciizDataNode: + data = mips.SpaceDataNode(name, value) + self.dotdata.append(data) + return data - def register_instruction( - self, instruction: mips.InstructionNode - ) -> mips.InstructionNode: + def register_instruction(self, instruction: mips.InstructionNode) -> mips.InstructionNode: self.dottext.append(instruction) return instruction @@ -38,6 +41,14 @@ def register_empty_instruction(self) -> mips.EmptyInstructionNode: self.dottext.append(mips.EmptyInstructionNode()) return self.dottext[-1] + def register_instantiation(self, size: Union[int, str]) -> mips.InstructionNode: + self.register_instruction(mips.LoadInmediateNode("$v0", "9")) + if isinstance(size, int): + self.register_instruction(mips.AddiNode("$a0", "$zero", f"{size}")) + if isinstance(size, str): + self.register_instruction(mips.MoveNode("$a0", size)) + self.register_instruction(mips.SystemCallNode()) + def register_empty_data(self): self.dotdata.append(mips.EmptyDataNode()) @@ -64,26 +75,22 @@ def visit(self, node: cil.ProgramNode): for type_node in node.dottypes: self.visit(type_node) + + self.register_space("buffer_input", 1024) for function_node in node.dotcode: self.visit(function_node) - self.register_instruction(mips.LabelNode("main")) - return mips.ProgramNode(self.dotdata, self.dottext) @visitor.when(cil.TypeNode) def visit(self, node: cil.TypeNode): - size = 4 * (1 + len(node.attributes)) + size = 4 * (2 + len(node.attributes)) self.register_word(f"type_{node.name}", str(size)) - self.register_word( - self.to_data_type("inherits_from", node.name), - f"type_{node.parent}" if node.parent != "null" else "0", - ) - self.register_word( - self.to_data_type("attributes", node.name), str(len(node.attributes)) - ) + self.register_word(self.to_data_type("inherits_from", node.name),f"type_{node.parent}" if node.parent != "null" else "0") + self.register_word(self.to_data_type("attributes", node.name), str(len(node.attributes))) + self.register_word(self.to_data_type("name_size", node.name), str(len(node.name))) self.register_ascii(self.to_data_type("name", node.name), f'"{node.name}"') self.register_empty_data() @@ -100,11 +107,12 @@ def visit(self, node: cil.FunctionNode): locals_size = 4 * len(self.current_function.local_vars) stack_size = 4 * len(self.current_function_stack) - self.register_comment("Function parameters") - self.register_comment(f" $ra = {stack_size - 4}($sp)") - for i, param_name in enumerate(param_names, start=2): - self.register_comment(f" {param_name} = {stack_size - (4 * i)}($sp)") - self.register_empty_instruction() + if node.name != "main": + self.register_comment("Function parameters") + self.register_comment(f" $ra = {stack_size - 4}($sp)") + for i, param_name in enumerate(param_names, start=2): + self.register_comment(f" {param_name} = {stack_size - (4 * i)}($sp)") + self.register_empty_instruction() if self.current_function.local_vars: self.register_comment("Reserving space for local variables") @@ -114,32 +122,417 @@ def visit(self, node: cil.FunctionNode): for instruction in node.instructions: # TODO: Remove the try/except block when the visitor is fixed try: + if isinstance(instruction, cil.EmptyInstruction): + continue self.visit(instruction) + self.register_empty_instruction() except Exception as e: - continue - self.register_empty_instruction() + print(f"error {e} in {node.name} {type(instruction)}") - if self.current_function.local_vars: + if node.name != "main" and self.current_function.local_vars: self.register_comment("Freeing space for local variables") self.register_instruction(mips.AddiNode("$sp", "$sp", f"{locals_size}")) self.register_empty_instruction() - self.register_instruction(mips.JumpRegisterNode("$ra")) + if node.name != "main": + self.register_instruction(mips.JumpRegisterNode("$ra")) + self.register_empty_instruction() + + @visitor.when(cil.AssignNode) + def visit(self, node: cil.AssignNode): + self.register_comment(f"{node.dest} = {node.source}") + if node.source.isdigit(): + self.register_instruction(mips.AddiNode("$t0", "$zero", node.source)) + else: + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.source)}(sp)")) + self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}(sp)")) + + @visitor.when(cil.ArgNode) + def visit(self, node: cil.ArgNode): + if node.arg_index == 0: + self.register_comment("Passing function arguments") + self.register_instruction(mips.AddiNode("$sp", "$sp", f"-{4 * node.total_args + 4}").set_comment("Reserving space for arguments")) + self.register_instruction(mips.StoreWordNode("$ra", f"{4 * (node.total_args)}($sp)").set_comment("Storing return address")) + self.register_empty_instruction() + self.register_comment(f"Argument {node.name}") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.name) + 4 * node.total_args + 4}($sp)")) + self.register_instruction(mips.StoreWordNode("$t1", f"{4 * (node.total_args - node.arg_index - 1)}($sp)").set_comment(f"Storing {node.name}")) + + @visitor.when(cil.DynamicCallNode) + def visit(self, node: cil.DynamicCallNode): + self.register_comment(f"Calling function {node.method}") + self.register_instruction(mips.JumpAndLinkNode(node.method)) + self.register_instruction(mips.StoreWordNode("$v1", f"{self.offset_of(node.dest) + 4 * node.total_args + 4}($sp)").set_comment(f"{node.dest} = result of {node.method}")) + self.register_instruction(mips.AddiNode("$sp", "$sp", f"{4 * node.total_args + 4}").set_comment("Freeing space for arguments")) + + @visitor.when(cil.AllocateNode) + def visit(self, node: cil.AllocateNode): + self.register_comment(f"Allocating {node.type}") + self.register_instruction(mips.LoadInmediateNode("$v0", "9")) + self.register_instruction(mips.LoadWordNode("$a0", f"type_{node.type}")) + self.register_instruction(mips.SystemCallNode()) + self.register_instruction(mips.LoadAddressNode("$t0", f"type_{node.type}").set_comment("$t0 = address of the type")) + self.register_instruction(mips.StoreWordNode("$t0", "0($v0)").set_comment("Setting type in the first word of th object")) + self.register_instruction(mips.StoreWordNode("$a0", "4($v0)").set_comment("Setting size in the second word of th object")) + self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = address of allocated object {node.type}")) + + @visitor.when(cil.AllocateStrNode) + def visit(self, node: cil.AllocateStrNode): + self.register_comment(f"Allocating String") + self.register_instruction(mips.LoadInmediateNode("$v0", "9")) + self.register_instruction(mips.AddiNode("$a0", "$zero", f"{9 + node.length}").set_comment("$a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator")) + self.register_instruction(mips.SystemCallNode()) + self.register_empty_instruction() + + self.register_instruction(mips.LoadAddressNode("$t0", "type_String")) + self.register_instruction(mips.StoreWordNode("$t0", f"0($v0)").set_comment("Setting type in the first word of the object")) + self.register_empty_instruction() + + self.register_instruction(mips.AddiNode("$t0", "$zero", f"{node.length}")) + self.register_instruction(mips.StoreWordNode("$t0", f"4($v0)").set_comment("Setting length of the string in the second word of the object")) + self.register_empty_instruction() + + for i, c in enumerate(node.string): + ec = c.replace('\n', '\\n') + ec = ec.replace('\t', '\\t') + ec = ec.replace('\b', '\\b') + ec = ec.replace('\f', '\\f') + self.register_instruction(mips.AddiNode("$t0", "$zero", f"{ord(c)}")) + self.register_instruction(mips.StoreByteNode("$t1", f"{i + 8}($v0)").set_comment(f"{node.dest}[{i}] = '{ec}'")) + self.register_empty_instruction() + + self.register_instruction(mips.StoreByteNode("$zero", f"{i + 9}($v0)").set_comment(f"Null-terminator at the end of the string")) + self.register_empty_instruction() + self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = {node.value}")) + + @visitor.when(cil.LengthNode) + def visit(self, node: cil.LengthNode): + self.register_comment(f"{node.dest} = length of {node.str_address}") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.str_address)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t1", "4($t0)")) + self.register_instruction(mips.AddiNode("$t1", "$t1", "-9").set_comment("Subtracting 9 for the type, length, and null-terminator")) + self.register_instruction(mips.StoreWordNode("$t1", f"{self.offset_of(node.dest)}($sp)")) + + @visitor.when(cil.ConcatNode) + def visit(self, node: cil.ConcatNode): + self.register_comment(f"{node.dest} = {node.str1} + {node.str2}") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.str1)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.str2)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t2", "4($t0)").set_comment("$t2 = length of str1")) + self.register_instruction(mips.LoadWordNode("$t3", "4($t1)").set_comment("$t3 = length of str2")) + self.register_instruction(mips.AddNode("$t4", "$t2", "$t3").set_comment("$t4 = length of str1 + str2")) + self.register_instruction(mips.AddiNode("$t4", "$t4", "9").set_comment("Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte)")) + self.register_empty_instruction() + + self.register_instruction(mips.LoadInmediateNode("$v0", "9")) + self.register_instruction(mips.MoveNode("$a0", "$t4")) + self.register_instruction(mips.SystemCallNode()) + self.register_instruction(mips.AddiNode("$t4", "$t4", "-9").set_comment("Restoring $t4 = length of str1 + str2")) + self.register_instruction(mips.AddNode("$t5", "$zero", "$v0").set_comment("$t5 = address of the new string object")) + self.register_instruction(mips.AddiNode("$t5", "$t5", "8").set_comment("$t5 = address of the first byte of the new string")) + self.register_empty_instruction() + + self.register_instruction(mips.LoadAddressNode("$t8", "type_String")) + self.register_instruction(mips.StoreWordNode("$t8", f"0($v0)").set_comment("Setting type in the first word of th object")) + self.register_empty_instruction() + + self.register_instruction(mips.StoreWordNode("$a0", f"4($v0)").set_comment("Setting length of the string in the second word of the object")) + self.register_empty_instruction() + + self.register_comment(f"Copying str1 to the new string") + self.register_instruction(mips.XorNode("$t6", "$t6", "$t6").set_comment("$t6 = 0 Initializing counter")) + self.register_instruction(mips.LabelNode("while_copy_str1_start")) + self.register_instruction(mips.BeqNode("$t6", "$t2", "while_copy_str1_end")) + self.register_instruction(mips.LoadByteNode("$t7", f"0($t0)")) + self.register_instruction(mips.StoreByteNode("$t7", f"0($t5)")) + self.register_instruction(mips.AddNode("$t0", "$t0", "1").set_comment("$t0 = $t0 + 1 Incrementing the address of str1")) + self.register_instruction(mips.AddNode("$t5", "$t5", "1").set_comment("$t5 = $t5 + 1 Incrementing the address of the new string")) + self.register_instruction(mips.AddiNode("$t6", "$t6", "1").set_comment("$t6 = $t6 + 1 Incrementing counter")) + self.register_instruction(mips.JumpNode("while_copy_str1_start")) + self.register_instruction(mips.LabelNode("while_copy_str1_end")) + self.register_empty_instruction() + + self.register_comment(f"Copying str2 to the new string") + self.register_instruction(mips.LabelNode("while_copy_str2_start")) + self.register_instruction(mips.BeqNode("$t6", "$t4", "while_copy_str2_end")) + self.register_instruction(mips.LoadByteNode("$t7", f"0($t1)")) + self.register_instruction(mips.StoreByteNode("$t7", f"0($t5)")) + self.register_instruction(mips.AddNode("$t1", "$t1", "1").set_comment("$t0 = $t0 + 1 Incrementing the address of str1")) + self.register_instruction(mips.AddNode("$t5", "$t5", "1").set_comment("$t5 = $t5 + 1 Incrementing the address of the new string")) + self.register_instruction(mips.AddiNode("$t6", "$t6", "1").set_comment("$t6 = $t6 + 1 Incrementing counter")) + self.register_instruction(mips.JumpNode("while_copy_str2_start")) + self.register_instruction(mips.LabelNode("while_copy_str2_end")) + self.register_empty_instruction() + + self.register_instruction(mips.StoreByteNode("$zero", f"0($t5)").set_comment("Setting the null-terminator")) + self.register_empty_instruction() + + self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = {node.str1} + {node.str2}")) + + @visitor.when(cil.SubstringNode) + def visit(self, node: cil.SubstringNode): + self.register_comment(f"{node.dest} = {node.str_address}[{node.start}:{node.start} + {node.length}]") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.str_address)}($sp)").set_comment("$t0 = address of the string")) + self.register_instruction(mips.LoadWordNode("$t1", f"4($t0)").set_comment("$t1 = length of the string")) + self.register_instruction(mips.LoadWordNode("$t2", f"{self.offset_of(node.start)}($sp)").set_comment("$t2 = start of the substring")) + self.register_instruction(mips.LoadWordNode("$t3", f"{self.offset_of(node.length)}($sp)").set_comment("$t3 = length of the substring")) + self.register_instruction(mips.AddNode("t4", "$t2", "$t3").set_comment("$t4 = start of the substring + length of the substring")) + + self.register_empty_instruction() + self.register_instruction(mips.BgeNode("$t4", "$t1", "substring_out_of_bounds")) + + self.register_empty_instruction() + self.register_instruction(mips.AddiNode("$t3", "$t3", "9")) + self.register_instantiation("$t3") + self.register_instruction(mips.AddiNode("$t3", "$t3", "-9")) + + self.register_empty_instruction() + self.register_instruction(mips.LoadAddressNode("$t5", "type_String")) + self.register_instruction(mips.StoreWordNode("$t5", f"0($v0)").set_comment("Setting type in the first word of the object")) + + self.register_empty_instruction() + self.register_instruction(mips.StoreWordNode("$a0", f"4($v0)").set_comment("Setting length in the second word of the object")) + + self.register_empty_instruction() + self.register_instruction(mips.AddiNode("$t0", "$t0", "8").set_comment("pointing to the first byte of the string")) + self.register_instruction(mips.AddNode("$t0", "$t0", "$t2").set_comment("pointing to the first byte of the substring")) + self.register_instruction(mips.MoveNode("$t5", "$v0").set_comment("$t5 = address of the new string")) + self.register_instruction(mips.AddNode("$t5", "$t5", "8").set_comment("pointing to the first byte of the string")) + self.register_instruction(mips.XorNode("$t6", "$t6", "$t6").set_comment("$t6 = 0 Initializing counter")) + self.register_instruction(mips.LabelNode("while_copy_substr_start")) + self.register_instruction(mips.BeqNode("$t6", "$t3", "while_copy_substr_end")) + self.register_instruction(mips.LoadByteNode("$t7", f"0($t0)")) + self.register_instruction(mips.StoreByteNode("$t7", f"0($t5)")) + self.register_instruction(mips.AddiNode("$t0", "$t0", "1").set_comment("$t0 = $t0 + 1 Incrementing the address of the string")) + self.register_instruction(mips.AddNode("$t5", "$t5", "1").set_comment("$t5 = $t5 + 1 Incrementing the address of the new string")) + self.register_instruction(mips.AddiNode("$t6", "$t6", "1").set_comment("$t6 = $t6 + 1 Incrementing counter")) + self.register_instruction(mips.JumpNode("while_copy_substr_start")) + self.register_instruction(mips.LabelNode("while_copy_substr_end")) + + self.register_empty_instruction() + self.register_instruction(mips.StoreByteNode("$zero", f"0($t5)").set_comment("Setting the null-terminator")) + + self.register_empty_instruction() + self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = {node.str_address}[{node.start}:{node.start} + {node.length}]")) + + self.register_instruction(mips.JumpNode("substring_not_out_of_bounds")) + self.register_empty_instruction() + self.register_instruction(mips.LabelNode("substring_out_of_bounds")) + # TODO: Throw an exception + self.register_instruction(mips.LoadInmediateNode("$v0", "17")) + self.register_instruction(mips.AddiNode("$a0", "$zero", "1")) + self.register_instruction(mips.SystemCallNode()) + + self.register_empty_instruction() + self.register_instruction(mips.LabelNode("substring_not_out_of_bounds")) + + @visitor.when(cil.GetAttribNode) + def visit(self, node: cil.GetAttribNode): + self.register_comment(f"Get attribute {node.attr} of {node.instance}") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.instance)}($sp)").set_comment(f"Get the address of {node.instance}")) + self.register_instruction(mips.LoadWordNode("$t1", f"{4 * (node.attr_index + 2)}($t0)").set_comment(f"Get the attribute '{node.attr}' from the instance")) + self.register_instruction(mips.StoreWordNode("$t1",f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = {node.attr}")) + + @visitor.when(cil.SetAttributeNode) + def visit(self, node: cil.SetAttributeNode): + self.register_comment(f"Set attribute {node.attr} of {node.instance}") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.instance)}($sp)").set_comment(f"$t0 = {node.instance}")) + if node.source.isdigit(): + self.register_instruction(mips.AddiNode("$t1", "$zero", node.source).set_comment(f"$t1 {node.source}")) + self.register_instruction(mips.StoreWordNode("$t1", f"{4 * (node.attr_index + 2)}($t0)").set_comment(f"Set the attribute {node.attr} of {node.instance}")) + else: + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.source)}($sp)").set_comment(f"$t1 = {node.source}")) + self.register_instruction(mips.StoreWordNode("$t1", f"{4 * (node.attr_index + 2)}($t0)").set_comment(f"{node.instance}.{node.attr} = {node.source}")) + + @visitor.when(cil.TypeOfNode) + def visit(self, node: cil.TypeOfNode): + self.register_comment(f"{node.dest} = typeof {node.source} that is the first word of the object") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.source)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t1", "0($t0)")) + self.register_instruction(mips.StoreWordNode("$t1", f"{self.offset_of(node.dest)}($sp)")) + + @visitor.when(cil.AncestorNode) + def visit(self, node: cil.AncestorNode): + self.register_comment(f"{node.dest} = ancestor of {node.source} that is the first word of the object") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.source)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t1", "4($t0)")) + self.register_instruction(mips.StoreWordNode("$t1", f"{self.offset_of(node.dest)}($sp)")) + + @visitor.when(cil.TypeDirectionNode) + def visit(self, node: cil.TypeDirectionNode): + self.register_comment(f"{node.dest} = direction of {node.name}") + self.register_instruction(mips.LoadAddressNode("$t0", f"type_{node.name}")) + self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)")) + + @visitor.when(cil.TypeNameNode) + def visit(self, node: cil.TypeNameNode): + self.register_comment(f"{node.dest} = name of {node.source}") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.source)}($sp)").set_comment(f"$t0 = {node.source}")) + self.register_instruction(mips.LoadWordNode("$t1", "0($t0)").set_comment(f"$t1 = type of {node.source}")) + self.register_instruction(mips.LoadWordNode("$t2", "12($t1)").set_comment(f"$t1 = length of the name of {node.source}")) + self.register_instruction(mips.LoadWordNode("$t3", "16($t1)").set_comment(f"$t1 = name of {node.source}")) + self.register_empty_instruction() + + self.register_instruction(mips.AddiNode("$t2", "$t2", "9").set_comment(f"Setting space for the type, the size and the null byte")) + self.register_instantiation("$t2") + self.register_instruction(mips.AddiNode("$t2", "$t2", "-9").set_comment(f"Restoring space for the type, the size and the null byte")) + self.register_empty_instruction() + + self.register_instruction(mips.LoadAddressNode("$t4", "type_String")) + self.register_instruction(mips.StoreWordNode("$t4", f"0($v0)").set_comment("Setting type in the first word of the object")) + self.register_empty_instruction() + + self.register_instruction(mips.StoreWordNode("$a0", f"4($v0)").set_comment("Setting length in the second word of the object")) + self.register_empty_instruction() + + self.register_instruction(mips.MoveNode("$t4", "$v0").set_comment("$t4 = direction of the new string")) + self.register_instruction(mips.AddiNode("$t4", "$t4", "8").set_comment("Pointer to the first character of the string")) + self.register_instruction(mips.AddiNode("$t0", "$t0", "8").set_comment(f"Pointer to the first character of the string in {node.source}")) + self.register_instruction(mips.XorNode("$t5", "$t5", "$t5").set_comment("Initializing counter")) + self.register_instruction(mips.LabelNode("while_copy_start")) + self.register_instruction(mips.BeqNode("$t5", "$t1", "while_copy_end")) + self.register_instruction(mips.LoadByteNode("$t6", "0($t0)").set_comment("Loading the character")) + self.register_instruction(mips.StoreByteNode("$t6", "0($t4)")) + self.register_instruction(mips.AddiNode("$t4", "$t4", "1").set_comment("Incrementing the pointer to the new string")) + self.register_instruction(mips.AddiNode("$t0", "$t0", "1").set_comment(f"Incrementing the pointer to the string in {node.source}")) + self.register_instruction(mips.AddiNode("$t5", "$t5", "1").set_comment("Incrementing counter")) + self.register_instruction(mips.JumpNode("while_copy_start")) + self.register_instruction(mips.LabelNode("while_copy_end")) + self.register_empty_instruction() + + self.register_instruction(mips.StoreByteNode("$zero", "0($t4)").set_comment("Setting the null byte")) + self.register_empty_instruction() + + self.register_instruction(mips.StoreWordNode("$t4", f"{self.offset_of(node.dest)}($sp)").set_comment(f"Storing the new string in {node.dest}")) + + @visitor.when(cil.CopyNode) + def visit(self, node: cil.CopyNode): + self.register_comment(f"{node.dest} = copy of {node.source}") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.source)}($sp)").set_comment(f"$t0 = {node.source}")) + self.register_instruction(mips.LoadWordNode("$t1", "0($t0)").set_comment(f"$t1 = type of {node.source}")) + self.register_instruction(mips.LoadWordNode("$t2", "4($t0)").set_comment(f"$t2 = length of {node.source} in bytes")) + self.register_empty_instruction() + + self.register_comment("Allocating space for the new object") + self.register_instantiation("$t2") + self.register_instruction(mips.MoveNode("$t3", "$v0").set_comment("$t3 = direction of the new object")) + self.register_instruction(mips.StoreWordNode("$t1", "0($v0)").set_comment("Setting type in the first word of the object")) + self.register_instruction(mips.StoreWordNode("$a0", "4($v0)").set_comment("Setting length in the second word of the object")) + self.register_empty_instruction() + + self.register_comment("Initializing the variable of the loop") + self.register_instruction(mips.AddiNode("$t0", "$t0", "8").set_comment("Pointer to the first character of the object")) + self.register_instruction(mips.AddiNode("$t3", "$t3", "8").set_comment("Pointer to the first character of the object")) + self.register_instruction(mips.AddiNode("$t2", "$2", "-8").set_comment("Decrementing in 8 the length of the object")) + self.register_instruction(mips.XorNode("$t4", "$t4", "$t4").set_comment("Initializing counter")) + self.register_empty_instruction() + + self.register_comment("Loop copying the object") + self.register_instruction(mips.LabelNode("while_copy_start")) + self.register_instruction(mips.BeqNode("$t4", "$t2", "while_copy_end")) + self.register_instruction(mips.LoadByteNode("$t5", "0($t0)").set_comment("Loading the byte")) + self.register_instruction(mips.StoreByteNode("$t5", "0($t3)").set_comment("Storing the byte")) + self.register_instruction(mips.AddiNode("$t0", "$t0", "1").set_comment("Incrementing the pointer to the object")) + self.register_instruction(mips.AddiNode("$t3", "$t3", "1").set_comment("Incrementing the pointer to the new object")) + self.register_instruction(mips.AddiNode("$t4", "$t4", "1").set_comment("Incrementing counter")) + self.register_instruction(mips.JumpNode("while_copy_start")) + self.register_instruction(mips.LabelNode("while_copy_end")) + + self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"Storing the new object in {node.dest}")) + + @visitor.when(cil.PrintStringNode) + def visit(self, node: cil.PrintStringNode): + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.str_addr)}($sp)").set_comment(f"$t0 = {node.str_addr}")) + self.register_instruction(mips.AddiNode("$t0", "$t0", "8").set_comment("Pointer to the first character of the string")) + self.register_empty_instruction() + + self.register_comment(f"Printing the string {node.str_addr}") + self.register_instruction(mips.LoadInmediateNode("$v0", "4")) + self.register_instruction(mips.MoveNode("$a0", "$t0")) + self.register_instruction(mips.SystemCallNode()) + + @visitor.when(cil.PrintIntNode) + def visit(self, node: cil.PrintIntNode): + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.source)}($sp)").set_comment(f"$t0 = {node.source}")) + self.register_empty_instruction() + + self.register_comment(f"Printing the string {node.source}") + self.register_instruction(mips.LoadInmediateNode("$v0", "1")) + self.register_instruction(mips.LoadWordNode("$a0", "8($t0)")) + self.register_instruction(mips.SystemCallNode()) + + @visitor.when(cil.ReadStringNode) + def visit(self, node: cil.ReadStringNode): + self.register_instruction(mips.LoadInmediateNode("$v0", "8")) + self.register_instruction(mips.LoadAddressNode("$a0", "buffer_input")) + self.register_instruction(mips.LoadInmediateNode("$a1", "1024")) + self.register_instruction(mips.SystemCallNode()) + self.register_empty_instruction() + self.register_instruction(mips.XorNode("$t0", "$t0", "$t0").set_comment("Initializing counter")) + self.register_instruction(mips.LabelNode("while_read_start")) + self.register_instruction(mips.LoadWordNode("$t1", "buffer_input($t0)").set_comment("Loading the byte")) + self.register_instruction(mips.BeqNode("$t1", "$zero", "while_read_end")) + self.register_instruction(mips.AddiNode("$t0", "$t0", "1").set_comment("Incrementing counter")) + self.register_instruction(mips.JumpNode("while_read_start")) + self.register_instruction(mips.LabelNode("while_read_end")) + self.register_empty_instruction() + self.register_instruction(mips.AddiNode("$t0", "$t0", "9").set_comment("Adding space for the type, the size and the null byte")) + self.register_instantiation("$t0") + self.register_instruction(mips.LoadAddressNode("$t2", "type_String")) + self.register_instruction(mips.StoreWordNode("$t2", "0($v0)").set_comment("Setting type in the first word of the object")) + self.register_instruction(mips.StoreWordNode("$a0", "4($v0)").set_comment("Setting length in the second word of the object")) + self.register_empty_instruction() + self.register_instruction(mips.AddiNode("$t3", "$v0", "8").set_comment("Pointer to the first character of the string")) + self.register_instruction(mips.XorNode("$t4", "$t4", "$t4").set_comment("Initializing counter")) + self.register_empty_instruction() + self.register_instruction(mips.LabelNode("while_copy_from_buffer_start")) + self.register_instruction(mips.BeqNode("$t4", "$t0", "while_copy_from_buffer_end")) + self.register_instruction(mips.LoadWordNode("$t5", "buffer_input($t4)").set_comment("Loading the byte")) + self.register_instruction(mips.StoreByteNode("$t5", "0($t3)").set_comment("Storing the byte")) + self.register_instruction(mips.AddiNode("$t3", "$t3", "1").set_comment("Imcremeenting pointer")) + self.register_instruction(mips.AddiNode("$t4", "$t4", "1").set_comment("Incrementing counter")) + self.register_instruction(mips.JumpNode("while_copy_from_buffer_start")) + self.register_instruction(mips.LabelNode("while_copy_from_buffer_end")) + self.register_empty_instruction() + self.register_instruction(mips.StoreByteNode("$zero", "0($t3)").set_comment("Storing the null byte")) + self.register_empty_instruction() + self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"Storing the new object in {node.dest}")) + + @visitor.when(cil.ReadIntNode) + def visit(self, node: cil.ReadIntNode): + self.register_instruction(mips.LoadInmediateNode("$v0", "5")) + self.register_instruction(mips.SystemCallNode()) + + self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"Storing the new object in {node.dest}")) + + @visitor.when(cil.LabelNode) + def visit(self, node: cil.LabelNode): + self.register_instruction(mips.LabelNode(node.label)) + + @visitor.when(cil.GotoNode) + def visit(self, node: cil.GotoNode): + self.register_instruction(mips.JumpNode(node.address)) + + @visitor.when(cil.GotoIfNode) + def visit(self, node: cil.GotoIfNode): + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.condition)}($sp)")) + self.register_instruction(mips.AddiNode("$t1", "$zero", "1")) + self.register_instruction(mips.BeqNode("$t0", "$t1", node.address)) @visitor.when(cil.PlusNode) def visit(self, node: cil.PlusNode): self.register_comment("addition operation") self.preprocess_binary_operation(node) self.register_instruction(mips.AddNode("$t0", "$t0", "$t1").set_comment("$t0 = $t0 + $t1")) - self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment("Storing result of addition")) + self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"Store result of addition in {node.dest}")) @visitor.when(cil.MinusNode) def visit(self, node: cil.MinusNode): self.register_comment("Subtraction operation") self.preprocess_binary_operation(node) self.register_instruction(mips.SubNode("$t0", "$t0", "$t1").set_comment("$t0 = $t0 - $t1")) - self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment("Store result of subtraction")) + self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"Store result of subtraction in {node.dest}")) @visitor.when(cil.StarNode) def visit(self, node: cil.StarNode): @@ -147,7 +540,7 @@ def visit(self, node: cil.StarNode): self.preprocess_binary_operation(node) self.register_instruction(mips.MultNode("$t0", "$t1").set_comment("$t0 = $t0 * $t1")) self.register_instruction(mips.MoveFromLowNode("$t0")) - self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment("Store result of multiplication")) + self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"Store result of multiplication in {node.dest}")) @visitor.when(cil.DivNode) def visit(self, node: cil.DivNode): @@ -155,17 +548,49 @@ def visit(self, node: cil.DivNode): self.preprocess_binary_operation(node) self.register_instruction(mips.DivNode("$t0", "$t1").set_comment("$t0 = $t0 / $t1")) self.register_instruction(mips.MoveFromLowNode("$t0")) - self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment("Store result of division")) + self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"Store result of division in {node.dest}")) @visitor.when(cil.XorNode) def visit(self, node: cil.XorNode): self.register_comment("Xor operation") self.preprocess_binary_operation(node) self.register_instruction(mips.XorNode("$t0", "$t0", "$t1").set_comment("$t0 = $t0 ^ $t1")) - self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment("Store result of xor")) + self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"Store result of xor in {node.dest}")) + + @visitor.when(cil.EqualNode) + def visit(self, node: cil.EqualNode): + self.register_comment("Equal operation") + self.preprocess_binary_operation(node) + self.register_instruction(mips.XorNode("$t0", "$t0", "$t1").set_comment("$t0 = $t0 ^ $t1")) + self.register_instruction(mips.SeqNode("$t0", "$t0", "$zero").set_comment("$t0 = $t0 == 0")) + self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"Store result of equal in {node.dest}")) + + @visitor.when(cil.LessThanNode) + def visit(self, node: cil.LessThanNode): + self.register_comment("Less than operation") + self.preprocess_binary_operation(node) + self.register_instruction(mips.SltNode("$t0", "$t0", "$t1").set_comment("$t0 = $t0 < $t1")) + self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"Store result of less than in {node.dest}")) + + @visitor.when(cil.LessEqualNode) + def visit(self, node: cil.LessEqualNode): + self.register_comment("Less than operation") + self.preprocess_binary_operation(node) + self.register_instruction(mips.SleNode("$t0", "$t0", "$t1").set_comment("$t0 = $t0 <= $t1")) + self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"Store result of less than or equal in {node.dest}")) + + @visitor.when(cil.HaltNode) + def visit(self, node: cil.HaltNode): + self.register_comment("Exit program") + self.register_instruction(mips.LoadInmediateNode("$v0", "10")) + self.register_instruction(mips.SystemCallNode()) @visitor.when(cil.ReturnNode) def visit(self, node: cil.ReturnNode): + if node.value.isdigit(): + self.register_comment("Loading return value in $v1") + self.register_instruction(mips.AddiNode("$v1", "$zero", f"{node.value}")) + return offset = self.offset_of(node.value) self.register_comment("Loading return value in $v1") self.register_instruction(mips.LoadWordNode("$v1", f"{offset}($sp)")) diff --git a/src/cool/code_generation/translator_cool_to_cil.py b/src/cool/code_generation/translator_cool_to_cil.py index 6b2cff4e3..56e88c6de 100644 --- a/src/cool/code_generation/translator_cool_to_cil.py +++ b/src/cool/code_generation/translator_cool_to_cil.py @@ -1,4 +1,5 @@ from typing import Any, Dict, List, Optional, Tuple +from unittest import result import cool.code_generation.ast_cil as cil import cool.code_generation.ast_ecool as ecool @@ -667,11 +668,11 @@ def visit(self, node: cool.ProgramNode, scope: Scope): self.current_function = self.register_function(self.to_function_name("abort", "Object")) self.current_function.params.append(cil.ParamNode("self")) self.register_instruction(cil.HaltNode()) - self.register_instruction(cil.ReturnNode()) + self.register_instruction(cil.ReturnNode("self")) self.current_function = self.register_function(self.to_function_name("type_name", "Object")) self.current_function.params.append(cil.ParamNode("self")) - type_name = self.register_local("type_name") + type_name = self.define_internal_local("type_name") self.register_instruction(cil.TypeNameNode(type_name, "self")) self.register_instruction(cil.ReturnNode(type_name)) @@ -688,7 +689,7 @@ def visit(self, node: cool.ProgramNode, scope: Scope): self.current_function = self.register_function(self.to_function_name("out_string", "IO")) self.current_function.params.append(cil.ParamNode("self")) self.current_function.params.append(cil.ParamNode("x")) - self.register_instruction(cil.PrintIntNode("x")) + self.register_instruction(cil.PrintStringNode("x")) self.register_instruction(cil.ReturnNode("self")) self.current_function = self.register_function(self.to_function_name("out_int", "IO")) @@ -700,7 +701,7 @@ def visit(self, node: cool.ProgramNode, scope: Scope): self.current_function = self.register_function(self.to_function_name("in_string", "IO")) self.current_function.params.append(cil.ParamNode("self")) local_int = self.define_internal_local() - self.register_instruction(cil.ReadIntNode(local_int)) + self.register_instruction(cil.ReadStringNode(local_int)) self.register_instruction(cil.ReturnNode(local_int)) self.current_function = self.register_function(self.to_function_name("in_int", "IO")) @@ -737,6 +738,18 @@ def visit(self, node: cool.ProgramNode, scope: Scope): for i, declaration in enumerate(node.declarations): self.visit(declaration, scope.children[i]) + self.current_function = self.register_function("main") + local_main = self.define_internal_local() + local_result = self.define_internal_local() + self.register_instruction(cil.AllocateNode("Main", local_main)) + self.register_instruction(cil.ArgNode(local_main, 0, 1)) + self.register_instruction(cil.DynamicCallNode("Main", self.to_function_name("__init__", "Main"), local_main, 1)) + self.register_empty_instruction() + self.register_instruction(cil.ArgNode(local_main, 0, 1)) + self.register_instruction(cil.DynamicCallNode("Main", self.to_function_name("main", "Main"), local_result, 1)) + self.register_empty_instruction() + self.register_instruction(cil.HaltNode()) + return cil.ProgramNode(self.dottypes, self.dotdata, self.dotcode) @visitor.when(cool.ClassDeclarationNode) @@ -825,11 +838,14 @@ def visit(self, node: cool.AssignNode, scope: Scope): ) if is_attribute: - self.register_instruction(cil.SetAttribNode("self", variable.name, source)) + attr_names = [attr.name for attr, _ in self.current_type.all_attributes()] + # local_var = self.define_internal_local() + self.register_instruction(cil.SetAttributeNode("self", variable.name, source, attr_names.index(variable.name))) + # self.register_instruction(cil.AssignNode(local_var, source)) + return source, variable.type else: self.register_instruction(cil.AssignNode(variable.name, source)) - - return variable.name, variable.type + return variable.name, variable.type @visitor.when(cool.BlockNode) def visit(self, node: cool.BlockNode, scope: Scope): @@ -1106,15 +1122,15 @@ def visit(self, node: cool.MethodCallNode, scope: Scope): arg_source, _ = self.visit(arg, scope) args_sources.append(arg_source) - self.register_instruction(cil.ArgNode(obj_source)) - for arg_source in args_sources: - self.register_instruction(cil.ArgNode(arg_source)) + self.register_instruction(cil.ArgNode(obj_source, 0, len(args_sources) + 1)) + for index, arg_source in enumerate(args_sources, start=1): + self.register_instruction(cil.ArgNode(arg_source, index, len(args_sources) + 1)) call_dest = self.define_internal_local() method, owner = obj_type.get_method(node.id, get_owner=True) self.register_instruction( cil.DynamicCallNode( - obj_type.name, self.to_function_name(node.id, owner.name), call_dest + obj_type.name, self.to_function_name(node.id, owner.name), call_dest, len(args_sources) + 1 ) ) return call_dest, method.return_type @@ -1125,7 +1141,9 @@ def visit(self, node: cool.IntegerNode, scope: Scope): @visitor.when(cool.StringNode) def visit(self, node: cool.StringNode, scope: Scope): - return node.lex, self.context.get_type("String") + local_str_var = self.define_internal_local(f"String {node.lex}") + self.register_instruction(cil.AllocateStrNode(local_str_var, node.lex)) + return local_str_var, self.context.get_type("String") @visitor.when(cool.BooleanNode) def visit(self, node: cool.BooleanNode, scope: Scope): @@ -1146,7 +1164,8 @@ def visit(self, node: cool.VariableNode, scope: Scope): if is_attribute: dest = self.define_internal_local() - self.register_instruction(cil.GetAttribNode(dest, "self", variable.name)) + attr_names = [a.name for a, _ in self.current_type.all_attributes()] + self.register_instruction(cil.GetAttribNode(dest, "self", variable.name, attr_names.index(variable.name))) return dest, variable.type return variable.name, variable.type @@ -1154,8 +1173,8 @@ def visit(self, node: cool.VariableNode, scope: Scope): def visit(self, node: cool.InstantiateNode, scope: Scope): local = self.define_internal_local(f"Store an instance of the class {node.lex}") self.register_instruction(cil.AllocateNode(node.lex, local).set_comment(f"Allocate the object {node.lex}")) - self.register_instruction(cil.ArgNode(local).set_comment("Pass the instance to the constructor")) - self.register_instruction(cil.DynamicCallNode(node.lex, self.to_function_name("__init__", node.lex), local).set_comment("Call the constructor")) + self.register_instruction(cil.ArgNode(local, 0, 1).set_comment("Pass the instance to the constructor")) + self.register_instruction(cil.DynamicCallNode(node.lex, self.to_function_name("__init__", node.lex), local, 1).set_comment("Call the constructor")) return local, self.context.get_type(node.lex) @visitor.when(cool.NegationNode) diff --git a/src/cool/grammar.py b/src/cool/grammar.py index 1a15e430c..a42d0ec6d 100644 --- a/src/cool/grammar.py +++ b/src/cool/grammar.py @@ -318,9 +318,7 @@ def lexical_error(lexer): atom %= "false", lambda s: cool.BooleanNode(s[1]) atom %= "int", lambda s: cool.IntegerNode(s[1]) atom %= "string", lambda s: cool.StringNode(s[1]) -atom %= "if expr then expr else expr fi", lambda s: cool.ConditionalNode( - s[2], s[4], s[6] -) +atom %= "if expr then expr else expr fi", lambda s: cool.ConditionalNode(s[2], s[4], s[6]) atom %= "function-call", lambda s: s[1] atom %= "new type", lambda s: cool.InstantiateNode(s[2]) atom %= "( expr )", lambda s: s[2] @@ -330,25 +328,15 @@ def lexical_error(lexer): declaration_list %= "id : type", lambda s: [(s[1], s[3], None)] declaration_list %= "id : type <- expr", lambda s: [(s[1], s[3], s[5])] -declaration_list %= ( - "id : type , declaration-list", - lambda s: [(s[1], s[3], None)] + s[5], -) -declaration_list %= ( - "id : type <- expr , declaration-list", - lambda s: [(s[1], s[3], s[5])] + s[7], -) +declaration_list %= "id : type , declaration-list",lambda s: [(s[1], s[3], None)] + s[5] +declaration_list %= "id : type <- expr , declaration-list",lambda s: [(s[1], s[3], s[5])] + s[7] case_list %= "id : type => expr ;", lambda s: [(s[1], s[3], s[5])] case_list %= "id : type => expr ; case-list", lambda s: [(s[1], s[3], s[5])] + s[7] function_call %= "id ( expr-list )", lambda s: cool.MethodCallNode(s[1], s[3]) -function_call %= "atom . id ( expr-list )", lambda s: cool.MethodCallNode( - s[3], s[5], s[1] -) -function_call %= "atom @ type . id ( expr-list )", lambda s: cool.MethodCallNode( - s[5], s[7], s[1], s[3] -) +function_call %= "atom . id ( expr-list )", lambda s: cool.MethodCallNode(s[3], s[5], s[1]) +function_call %= "atom @ type . id ( expr-list )", lambda s: cool.MethodCallNode(s[5], s[7], s[1], s[3]) expr_list %= "", lambda s: [] expr_list %= "not-empty-expr-list", lambda s: s[1] diff --git a/src/main.asm b/src/main.asm index f70ff0424..077a42ef9 100644 --- a/src/main.asm +++ b/src/main.asm @@ -1,34 +1,41 @@ .data - type_Object: .word 4 + type_Object: .word 8 type_Object_inherits_from: .word 0 type_Object_attributes: .word 0 + type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" - type_IO: .word 4 + type_IO: .word 8 type_IO_inherits_from: .word type_Object type_IO_attributes: .word 0 + type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" - type_Int: .word 4 + type_Int: .word 8 type_Int_inherits_from: .word type_Object type_Int_attributes: .word 0 + type_Int_name_size: .word 3 type_Int_name: .asciiz "Int" - type_String: .word 4 + type_String: .word 8 type_String_inherits_from: .word type_Object type_String_attributes: .word 0 + type_String_name_size: .word 6 type_String_name: .asciiz "String" - type_Bool: .word 4 + type_Bool: .word 8 type_Bool_inherits_from: .word type_Object type_Bool_attributes: .word 0 + type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" - type_Main: .word 8 - type_Main_inherits_from: .word type_IO - type_Main_attributes: .word 1 + type_Main: .word 16 + type_Main_inherits_from: .word type_Object + type_Main_attributes: .word 2 + type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" + buffer_input: .space 1024 .text function___init___at_Object: @@ -46,6 +53,12 @@ # $ra = 4($sp) # self = 0($sp) + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 0($sp) jr $ra @@ -57,6 +70,40 @@ # Reserving space for local variables addi $sp, $sp, -4 + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 12($t1) # $t1 = length of the name of self + lw $t3, 16($t1) # $t1 = name of self + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + move $t4, $v0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + addi $t0, $t0, 8 # Pointer to the first character of the string in self + xor $t5, $t5, $t5 # Initializing counter + while_copy_start: + beq $t5, $t1, while_copy_end + lb $t6, 0($t0) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t0, $t0, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_start + while_copy_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $t4, 0($sp) # Storing the new string in internal_0 # Loading return value in $v1 lw $v1, 0($sp) @@ -74,6 +121,36 @@ # Reserving space for local variables addi $sp, $sp, -4 + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 # Loading return value in $v1 lw $v1, 0($sp) @@ -99,6 +176,13 @@ # self = 4($sp) # x = 0($sp) + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string x + li $v0, 4 + move $a0, $t0 + syscall # Loading return value in $v1 lw $v1, 4($sp) @@ -111,6 +195,12 @@ # self = 4($sp) # x = 0($sp) + lw $t0, 0($sp) # $t0 = x + + # Printing the string x + li $v0, 1 + lw $a0, 8($t0) + syscall # Loading return value in $v1 lw $v1, 4($sp) @@ -125,6 +215,42 @@ # Reserving space for local variables addi $sp, $sp, -4 + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lw $t1, buffer_input($t0) # Loading the byte + beq $t1, $zero, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lw $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 # Loading return value in $v1 lw $v1, 0($sp) @@ -142,6 +268,9 @@ # Reserving space for local variables addi $sp, $sp, -4 + li $v0, 5 + syscall + sw $v0, 0($sp) # Storing the new object in internal_0 # Loading return value in $v1 lw $v1, 0($sp) @@ -169,6 +298,11 @@ # Reserving space for local variables addi $sp, $sp, -4 + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + sw $t1, 0($sp) # Loading return value in $v1 lw $v1, 0($sp) @@ -187,6 +321,52 @@ # Reserving space for local variables addi $sp, $sp, -4 + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 0($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 0($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s # Loading return value in $v1 lw $v1, 0($sp) @@ -206,6 +386,52 @@ # Reserving space for local variables addi $sp, $sp, -4 + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + lw $t2, 8($sp) # $t2 = start of the substring + lw $t3, 4($sp) # $t3 = length of the substring + add t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bge $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: # Loading return value in $v1 lw $v1, 0($sp) @@ -220,6 +446,15 @@ # $ra = 4($sp) # self = 0($sp) + # Set attribute number of self + lw $t0, 0($sp) # $t0 = self + addi $t1, $zero, 0 # $t1 0 + sw $t1, 8($t0) # Set the attribute number of self + + # Set attribute data of self + lw $t0, 0($sp) # $t0 = self + addi $t1, $zero, 2 # $t1 2 + sw $t1, 12($t0) # Set the attribute data of self # Loading return value in $v1 lw $v1, 0($sp) @@ -227,108 +462,158 @@ jr $ra function_main_at_Main: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - jr $ra - - function_plus_at_Main: # Function parameters # $ra = 16($sp) # self = 12($sp) - # a = 8($sp) - # b = 4($sp) # Reserving space for local variables - addi $sp, $sp, -4 + addi $sp, $sp, -12 - # addition operation - lw $t0, 8($sp) # Save in $t0 the left operand - lw $t1, 4($sp) # Save in $t1 the right operand - add $t0, $t0, $t1 # $t0 = $t0 + $t1 - sw $t0, 0($sp) # Storing result of addition + # Allocating IO + li $v0, 9 + lw $a0, type_IO + syscall + la $t0, type_IO # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 8($sp) # internal_0 = address of allocated object IO - # Loading return value in $v1 - lw $v1, 0($sp) + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - # Freeing space for local variables - addi $sp, $sp, 4 + # Argument internal_0 + lw $t0, 16($sp) + sw $t1, 0($sp) # Storing internal_0 - jr $ra + # Calling function function___init___at_IO + jal function___init___at_IO + sw $v1, 16($sp) # internal_0 = result of function___init___at_IO + addi $sp, $sp, 8 # Freeing space for arguments - function_minus_at_Main: - # Function parameters - # $ra = 16($sp) - # self = 12($sp) - # a = 8($sp) - # b = 4($sp) + # Allocating String + li $v0, 9 + addi $a0, $zero, 23 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - # Reserving space for local variables - addi $sp, $sp, -4 + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - # Subtraction operation - lw $t0, 8($sp) # Save in $t0 the left operand - lw $t1, 4($sp) # Save in $t1 the right operand - sub $t0, $t0, $t1 # $t0 = $t0 - $t1 - sw $t0, 0($sp) # Store result of subtraction + addi $t0, $zero, 14 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - # Loading return value in $v1 - lw $v1, 0($sp) + addi $t0, $zero, 72 + sb $t1, 8($v0) # internal_1[0] = 'H' - # Freeing space for local variables - addi $sp, $sp, 4 + addi $t0, $zero, 101 + sb $t1, 9($v0) # internal_1[1] = 'e' - jr $ra + addi $t0, $zero, 108 + sb $t1, 10($v0) # internal_1[2] = 'l' - function_mult_at_Main: - # Function parameters - # $ra = 16($sp) - # self = 12($sp) - # a = 8($sp) - # b = 4($sp) + addi $t0, $zero, 108 + sb $t1, 11($v0) # internal_1[3] = 'l' - # Reserving space for local variables - addi $sp, $sp, -4 + addi $t0, $zero, 111 + sb $t1, 12($v0) # internal_1[4] = 'o' - # Multiplication operation - lw $t0, 8($sp) # Save in $t0 the left operand - lw $t1, 4($sp) # Save in $t1 the right operand - mult $t0, $t1 # $t0 = $t0 * $t1 - mflo $t0 - sw $t0, 0($sp) # Store result of multiplication + addi $t0, $zero, 44 + sb $t1, 13($v0) # internal_1[5] = ',' - # Loading return value in $v1 - lw $v1, 0($sp) + addi $t0, $zero, 32 + sb $t1, 14($v0) # internal_1[6] = ' ' - # Freeing space for local variables - addi $sp, $sp, 4 + addi $t0, $zero, 87 + sb $t1, 15($v0) # internal_1[7] = 'W' - jr $ra + addi $t0, $zero, 111 + sb $t1, 16($v0) # internal_1[8] = 'o' - function_div_at_Main: - # Function parameters - # $ra = 16($sp) - # self = 12($sp) - # a = 8($sp) - # b = 4($sp) + addi $t0, $zero, 114 + sb $t1, 17($v0) # internal_1[9] = 'r' - # Reserving space for local variables - addi $sp, $sp, -4 + addi $t0, $zero, 108 + sb $t1, 18($v0) # internal_1[10] = 'l' + + addi $t0, $zero, 100 + sb $t1, 19($v0) # internal_1[11] = 'd' + + addi $t0, $zero, 33 + sb $t1, 20($v0) # internal_1[12] = '!' + + addi $t0, $zero, 10 + sb $t1, 21($v0) # internal_1[13] = '\n' + + sb $zero, 22($v0) # Null-terminator at the end of the string - # Division operation - lw $t0, 8($sp) # Save in $t0 the left operand - lw $t1, 4($sp) # Save in $t1 the right operand - div $t0, $t1 # $t0 = $t0 / $t1 - mflo $t0 - sw $t0, 0($sp) # Store result of division + sw $v0, 4($sp) # internal_1 = "Hello, World!\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t1, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 16($sp) + sw $t1, 0($sp) # Storing internal_1 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + sw $v1, 12($sp) # internal_2 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 lw $v1, 0($sp) # Freeing space for local variables - addi $sp, $sp, 4 + addi $sp, $sp, 12 jr $ra - main: \ No newline at end of file + main: + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t1, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t1, 0($sp) # Storing internal_0 + + # Calling function function_main_at_Main + jal function_main_at_Main + sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/src/main.cil b/src/main.cil index eb0c8d5a2..0af38dd0b 100644 --- a/src/main.cil +++ b/src/main.cil @@ -47,22 +47,15 @@ type Bool { method __init__: function___init___at_Bool } type Main { - inherits from IO + inherits from Object attribute number + attribute data method abort: function_abort_at_Object method type_name: function_type_name_at_Object method copy: function_copy_at_Object - method out_string: function_out_string_at_IO - method out_int: function_out_int_at_IO - method in_string: function_in_string_at_IO - method in_int: function_in_int_at_IO method main: function_main_at_Main - method plus: function_plus_at_Main - method minus: function_minus_at_Main - method mult: function_mult_at_Main - method div: function_div_at_Main method __init__: function___init___at_Main } @@ -80,16 +73,16 @@ function function_abort_at_Object{ HALT - RETURN 0 + RETURN self } function function_type_name_at_Object{ PARAM self - LOCAL type_name + LOCAL internal_0 # type_name - type_name = TYPENAME self + internal_0 = TYPENAME self - RETURN type_name + RETURN internal_0 } function function_copy_at_Object{ PARAM self @@ -109,7 +102,7 @@ function function_out_string_at_IO{ PARAM self PARAM x - PRINTINT x + PRINTSTR x RETURN self } @@ -126,7 +119,7 @@ function function_in_string_at_IO{ LOCAL internal_0 - READINT internal_0 + READSTR internal_0 RETURN internal_0 } @@ -178,55 +171,39 @@ function function___init___at_Main{ PARAM self SETATTR self number 0 + SETATTR self data 2 RETURN self } function function_main_at_Main{ PARAM self - - RETURN 0 -} -function function_plus_at_Main{ - PARAM self - PARAM a - PARAM b - LOCAL internal_0 + LOCAL internal_0 # Store an instance of the class IO + LOCAL internal_1 # String "Hello, World!\n" + LOCAL internal_2 - internal_0 = a + b + internal_0 = ALLOCATE IO # Allocate the object IO + ARG internal_0 # Pass the instance to the constructor + internal_0 = VCALL IO function___init___at_IO # Call the constructor + internal_1 = ALLOCSTR "Hello, World!\n" + ARG internal_0 + ARG internal_1 + internal_2 = VCALL IO function_out_string_at_IO - RETURN internal_0 + RETURN internal_2 } -function function_minus_at_Main{ - PARAM self - PARAM a - PARAM b - - LOCAL internal_0 - - internal_0 = a - b +function main{ - RETURN internal_0 -} -function function_mult_at_Main{ - PARAM self - PARAM a - PARAM b LOCAL internal_0 + LOCAL internal_1 - internal_0 = a * b + internal_0 = ALLOCATE Main + ARG internal_0 + internal_0 = VCALL Main function___init___at_Main - RETURN internal_0 -} -function function_div_at_Main{ - PARAM self - PARAM a - PARAM b - - LOCAL internal_0 - - internal_0 = a / b + ARG internal_0 + internal_1 = VCALL Main function_main_at_Main - RETURN internal_0 + HALT } \ No newline at end of file diff --git a/src/main.cl b/src/main.cl index 27c7e6efc..ba352b2c6 100644 --- a/src/main.cl +++ b/src/main.cl @@ -52,27 +52,44 @@ class Point3D inherits Point { }; *) -class Main inherits IO{ +class Main { number: Int <- 0; + data: Int <- 2; main() : Object { - -- out_string("Hello, World!\n") - 0 - }; + -- let s: String <- "Hello, World!\n", x: Int <- 0 in { + -- x <- number + data; + -- self.out_string(s); + -- } - plus(a: Int, b: Int) : Int { - a + b + (new IO).out_string("Hello, World!\n") }; - minus(a: Int, b: Int) : Int { - a - b - }; +-- plus(a: Int, b: Int) : Int { +-- a + b +-- }; - mult(a: Int, b: Int) : Int { - a * b - }; +-- minus(a: Int, b: Int) : Int { +-- a - b +-- }; - div(a: Int, b: Int) : Int { - a / b - }; +-- mult(a: Int, b: Int) : Int { +-- a * b +-- }; + +-- div(a: Int, b: Int) : Int { +-- a / b +-- }; + +-- equals(a: Bool, b: Bool) : Bool { +-- a = b +-- }; + +-- less(a: Int, b: Int) : Bool { +-- a < b +-- }; + +-- less_equals(a: Int, b: Int) : Bool { +-- a <= b +-- }; }; From 2b64b1c824054392ad62bedffcc6bc4f36aa78c2 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Fri, 25 Feb 2022 16:10:19 -0500 Subject: [PATCH 140/143] Redefined type Int, Bool and String. Fixing errors in switch case translation --- src/arith.asm | 15302 +++++++++++++++ src/arith.cil | 3288 ++++ src/arith.cl | 473 + src/cool/code_generation/ast_cil.py | 45 +- src/cool/code_generation/ast_ecool.py | 2 +- src/cool/code_generation/formatters.py | 40 +- .../code_generation/translator_cil_to_mips.py | 243 +- .../code_generation/translator_cool_to_cil.py | 249 +- src/cool/semantics/position_assigner.py | 60 +- src/cool/semantics/type_checker.py | 34 +- src/cool/semantics/type_inference.py | 52 +- src/cool/semantics/utils/astnodes.py | 4 + src/io.asm | 1230 ++ src/io.cil | 371 + src/io.cl | 103 + src/logs.txt | 253 + src/main.asm | 637 +- src/main.cil | 163 +- src/main.cl | 13 +- tests/codegen/arith.mips | 15302 +++++++++++++++ tests/codegen/atoi.mips | 5747 ++++++ tests/codegen/cells.mips | 2917 +++ tests/codegen/fib.mips | 1516 ++ tests/codegen/graph.mips | 6947 +++++++ tests/codegen/hairyscary.mips | 7176 +++++++ tests/codegen/hello_world.mips | 1051 + tests/codegen/io.mips | 1693 ++ tests/codegen/life.mips | 16106 ++++++++++++++++ tests/codegen/list.mips | 1846 ++ tests/codegen/palindrome.mips | 2075 ++ tests/codegen/primes.mips | 2139 ++ 31 files changed, 86824 insertions(+), 253 deletions(-) create mode 100644 src/arith.asm create mode 100644 src/arith.cil create mode 100755 src/arith.cl create mode 100644 src/io.asm create mode 100644 src/io.cil create mode 100755 src/io.cl create mode 100644 src/logs.txt create mode 100644 tests/codegen/arith.mips create mode 100644 tests/codegen/atoi.mips create mode 100644 tests/codegen/cells.mips create mode 100644 tests/codegen/fib.mips create mode 100644 tests/codegen/graph.mips create mode 100644 tests/codegen/hairyscary.mips create mode 100644 tests/codegen/hello_world.mips create mode 100644 tests/codegen/io.mips create mode 100644 tests/codegen/life.mips create mode 100644 tests/codegen/list.mips create mode 100644 tests/codegen/palindrome.mips create mode 100644 tests/codegen/primes.mips diff --git a/src/arith.asm b/src/arith.asm new file mode 100644 index 000000000..bdb8721dd --- /dev/null +++ b/src/arith.asm @@ -0,0 +1,15302 @@ +.data + type_Object: .word 8 + type_Object_inherits_from: .word 0 + type_Object_attributes: .word 0 + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO: .word 8 + type_IO_inherits_from: .word type_Object + type_IO_attributes: .word 0 + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_Int: .word 8 + type_Int_inherits_from: .word type_Object + type_Int_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_String: .word 8 + type_String_inherits_from: .word type_Object + type_String_attributes: .word 0 + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Bool: .word 8 + type_Bool_inherits_from: .word type_Object + type_Bool_attributes: .word 0 + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_A: .word 12 + type_A_inherits_from: .word type_Object + type_A_attributes: .word 1 + type_A_name_size: .word 1 + type_A_name: .asciiz "A" + + type_B: .word 12 + type_B_inherits_from: .word type_A + type_B_attributes: .word 1 + type_B_name_size: .word 1 + type_B_name: .asciiz "B" + + type_C: .word 12 + type_C_inherits_from: .word type_B + type_C_attributes: .word 1 + type_C_name_size: .word 1 + type_C_name: .asciiz "C" + + type_D: .word 12 + type_D_inherits_from: .word type_B + type_D_attributes: .word 1 + type_D_name_size: .word 1 + type_D_name: .asciiz "D" + + type_E: .word 12 + type_E_inherits_from: .word type_D + type_E_attributes: .word 1 + type_E_name_size: .word 1 + type_E_name: .asciiz "E" + + type_A2I: .word 8 + type_A2I_inherits_from: .word type_Object + type_A2I_attributes: .word 0 + type_A2I_name_size: .word 3 + type_A2I_name: .asciiz "A2I" + + type_Main: .word 24 + type_Main_inherits_from: .word type_IO + type_Main_attributes: .word 4 + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 40($sp) + # a = 36($sp) + # b = 32($sp) + + # Reserving space for local variables + addi $sp, $sp, -32 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_0 = address of allocated object Int + + # internal_1 = typeof a that is the first word of the object + lw $t0, 36($sp) + lw $t1, 0($t0) + sw $t1, 24($sp) + + # internal_2 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_3 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_4 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_7 = address of allocated object Int + + # internal_5 = EqualAddress(internal_1, internal_2) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_1, internal_3) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_7 = EqualAddress(internal_1, internal_4) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_6 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_7 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 36($sp) + lw $t0, 8($t0) + lw $t1, 32($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 36($sp) + lw $t1, 32($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 28($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 28($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 36($sp) # Save in $t0 the left operand address + lw $t1, 32($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 28($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 28($sp) + + # Freeing space for local variables + addi $sp, $sp, 32 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 12($t1) # $t1 = length of the name of self + lw $t3, 16($t1) # $t1 = name of self + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + move $t4, $v0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + addi $t0, $t0, 8 # Pointer to the first character of the string in self + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t1, while_copy_name_end + lb $t6, 0($t0) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t0, $t0, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $t4, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the string x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lw $t1, buffer_input($t0) # Loading the byte + beq $t1, $zero, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lw $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 5 + syscall + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + sw $t1, 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 0($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 0($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + lw $t2, 8($sp) # $t2 = start of the substring + lw $t3, 4($sp) # $t3 = length of the substring + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bge $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_A: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.var = internal_0 + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_value_at_A: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute var of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'var' from the instance + sw $t1, 0($sp) # internal_0 = var + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_set_var_at_A: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # num = 0($sp) + + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = num + sw $t1, 8($t0) # self.var = num + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_method1_at_A: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # num = 0($sp) + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_method2_at_A: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + # num1 = 20($sp) + # num2 = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num1 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing num1 + + # Argument num2 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing num2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_1 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 12($sp) + j end_assign + not_is_Bool_or_Int: + # x = internal_1 + lw $t0, 8($sp) + sw $t0, 12($sp) + end_assign: + + # Allocating B + li $v0, 9 + lw $a0, type_B + syscall + la $t0, type_B # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_2 = address of allocated object B + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_2 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function___init___at_B + jal function___init___at_B + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_2 = result of function___init___at_B + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument x + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_method3_at_A: + # Function parameters + # $ra = 32($sp) + # self = 28($sp) + # num = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Xor operation + lw $t0, 24($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 12($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 8($sp) # $t0 = internal_3 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 16($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 8($sp) # $t0 = internal_3 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 20($sp) + j end_assign + not_is_Bool_or_Int: + # x = internal_3 + lw $t0, 8($sp) + sw $t0, 20($sp) + end_assign: + + # Allocating C + li $v0, 9 + lw $a0, type_C + syscall + la $t0, type_C # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_4 = address of allocated object C + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_4 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function___init___at_C + jal function___init___at_C + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_4 = result of function___init___at_C + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument x + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_5 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_method4_at_A: + # Function parameters + # $ra = 56($sp) + # self = 52($sp) + # num1 = 48($sp) + # num2 = 44($sp) + + # Reserving space for local variables + addi $sp, $sp, -44 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num2 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing num2 + + # Argument num1 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing num1 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_2 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 32($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 36($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_2 + lw $t0, 32($sp) + sw $t0, 36($sp) + end_assign: + + # If internal_1 then goto then_8792981814074 + lw $t0, 36($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981814074 + + # Jumping to else_8792981814074 + j else_8792981814074 + + then_8792981814074: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num1 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing num1 + + # Argument num2 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing num2 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_4 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 24($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 28($sp) + j end_assign + not_is_Bool_or_Int: + # x = internal_4 + lw $t0, 24($sp) + sw $t0, 28($sp) + end_assign: + + # Allocating D + li $v0, 9 + lw $a0, type_D + syscall + la $t0, type_D # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 20($sp) # internal_5 = address of allocated object D + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_5 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function___init___at_D + jal function___init___at_D + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_5 = result of function___init___at_D + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_5 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_5 + + # Argument x + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_6 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_6 + lw $t0, 16($sp) + sw $t0, 40($sp) + end_assign: + + # Jumping to endif_8792981814074 + j endif_8792981814074 + + else_8792981814074: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num2 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing num2 + + # Argument num1 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing num1 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_8 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 28($sp) + j end_assign + not_is_Bool_or_Int: + # x = internal_8 + lw $t0, 8($sp) + sw $t0, 28($sp) + end_assign: + + # Allocating D + li $v0, 9 + lw $a0, type_D + syscall + la $t0, type_D # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_9 = address of allocated object D + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_9 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function___init___at_D + jal function___init___at_D + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_9 = result of function___init___at_D + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_9 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_9 + + # Argument x + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_10 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_10 + lw $t0, 0($sp) + sw $t0, 40($sp) + end_assign: + + # Jumping to endif_8792981814074 + j endif_8792981814074 + + endif_8792981814074: + + # Loading return value in $v1 + lw $v1, 40($sp) + + # Freeing space for local variables + addi $sp, $sp, 44 + + jr $ra + + function_method5_at_A: + # Function parameters + # $ra = 52($sp) + # self = 48($sp) + # num = 44($sp) + + # Reserving space for local variables + addi $sp, $sp, -44 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_1 = address of allocated object Int + + lw $t0, 36($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # x = internal_1 + lw $t0, 36($sp) + sw $t0, 40($sp) + end_assign: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_3 = address of allocated object Int + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 32($sp) + j end_assign + not_is_Bool_or_Int: + # y = internal_3 + lw $t0, 28($sp) + sw $t0, 32($sp) + end_assign: + + while_start_8792981814158: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument y + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing y + + # Argument num + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_less_than_or_equal + jal function_less_than_or_equal + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_5 = result of function_less_than_or_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 20($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # internal_4 = internal_5 + lw $t0, 20($sp) + sw $t0, 24($sp) + end_assign: + + # If internal_4 then goto while_body_8792981814158 + lw $t0, 24($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8792981814158 + + # Jumping to while_end_8792981814158 + j while_end_8792981814158 + + while_body_8792981814158: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing x + + # Argument y + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing y + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_6 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # x = internal_6 + lw $t0, 16($sp) + sw $t0, 40($sp) + end_assign: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument y + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing y + + # Argument internal_7 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_8 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 32($sp) + j end_assign + not_is_Bool_or_Int: + # y = internal_8 + lw $t0, 8($sp) + sw $t0, 32($sp) + end_assign: + + # Jumping to while_start_8792981814158 + j while_start_8792981814158 + + while_end_8792981814158: + + # Allocating E + li $v0, 9 + lw $a0, type_E + syscall + la $t0, type_E # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_9 = address of allocated object E + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_9 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function___init___at_E + jal function___init___at_E + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_9 = result of function___init___at_E + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_9 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_9 + + # Argument x + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_10 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 44 + + jr $ra + + function___init___at_B: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.var = internal_0 + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_method5_at_B: + # Function parameters + # $ra = 24($sp) + # self = 20($sp) + # num = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing num + + # Argument num + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_1 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 12($sp) + j end_assign + not_is_Bool_or_Int: + # x = internal_1 + lw $t0, 8($sp) + sw $t0, 12($sp) + end_assign: + + # Allocating E + li $v0, 9 + lw $a0, type_E + syscall + la $t0, type_E # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_2 = address of allocated object E + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_2 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function___init___at_E + jal function___init___at_E + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_2 = result of function___init___at_E + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument x + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function___init___at_C: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.var = internal_0 + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_method6_at_C: + # Function parameters + # $ra = 32($sp) + # self = 28($sp) + # num = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Xor operation + lw $t0, 24($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 12($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 8($sp) # $t0 = internal_3 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 16($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 8($sp) # $t0 = internal_3 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 20($sp) + j end_assign + not_is_Bool_or_Int: + # x = internal_3 + lw $t0, 8($sp) + sw $t0, 20($sp) + end_assign: + + # Allocating A + li $v0, 9 + lw $a0, type_A + syscall + la $t0, type_A # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_4 = address of allocated object A + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_4 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function___init___at_A + jal function___init___at_A + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_4 = result of function___init___at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument x + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_5 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_method5_at_C: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + # num = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing num + + # Argument num + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_1 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument num + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_2 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 16($sp) + j end_assign + not_is_Bool_or_Int: + # x = internal_2 + lw $t0, 8($sp) + sw $t0, 16($sp) + end_assign: + + # Allocating E + li $v0, 9 + lw $a0, type_E + syscall + la $t0, type_E # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_3 = address of allocated object E + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_3 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function___init___at_E + jal function___init___at_E + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_3 = result of function___init___at_E + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument x + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_4 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 20 + + jr $ra + + function___init___at_D: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.var = internal_0 + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_method7_at_D: + # Function parameters + # $ra = 116($sp) + # self = 112($sp) + # num = 108($sp) + + # Reserving space for local variables + addi $sp, $sp, -108 + + lw $t0, 108($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 104($sp) + j end_assign + not_is_Bool_or_Int: + # x = num + lw $t0, 108($sp) + sw $t0, 104($sp) + end_assign: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_2 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 92($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_3 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_4 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 88($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 96($sp) + j end_assign + not_is_Bool_or_Int: + # internal_2 = internal_4 + lw $t0, 88($sp) + sw $t0, 96($sp) + end_assign: + + # If internal_2 then goto then_8792981815568 + lw $t0, 96($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981815568 + + # Jumping to else_8792981815568 + j else_8792981815568 + + then_8792981815568: + + # Xor operation + lw $t0, 104($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 80($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 76($sp) # $t0 = internal_7 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Addition operation + lw $t0, 76($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 84($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 76($sp) # $t0 = internal_7 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_7 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_method7_at_D + jal function_method7_at_D + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_8 = result of function_method7_at_D + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 72($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 100($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_8 + lw $t0, 72($sp) + sw $t0, 100($sp) + end_assign: + + # Jumping to endif_8792981815568 + j endif_8792981815568 + + else_8792981815568: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_10 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_11 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_11 + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing internal_11 + + # Argument x + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_12 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 56($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 64($sp) + j end_assign + not_is_Bool_or_Int: + # internal_10 = internal_12 + lw $t0, 56($sp) + sw $t0, 64($sp) + end_assign: + + # If internal_10 then goto then_8792981815559 + lw $t0, 64($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981815559 + + # Jumping to else_8792981815559 + j else_8792981815559 + + then_8792981815559: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_13 = address of allocated object Int + + lw $t0, 52($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 68($sp) + j end_assign + not_is_Bool_or_Int: + # internal_9 = internal_13 + lw $t0, 52($sp) + sw $t0, 68($sp) + end_assign: + + # Jumping to endif_8792981815559 + j endif_8792981815559 + + else_8792981815559: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_15 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_16 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_16 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_16 + + # Argument x + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_17 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 36($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # internal_15 = internal_17 + lw $t0, 36($sp) + sw $t0, 44($sp) + end_assign: + + # If internal_15 then goto then_8792981815290 + lw $t0, 44($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981815290 + + # Jumping to else_8792981815290 + j else_8792981815290 + + then_8792981815290: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_18 = address of allocated object Int + + lw $t0, 32($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 48($sp) + j end_assign + not_is_Bool_or_Int: + # internal_14 = internal_18 + lw $t0, 32($sp) + sw $t0, 48($sp) + end_assign: + + # Jumping to endif_8792981815290 + j endif_8792981815290 + + else_8792981815290: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_20 = address of allocated object Int + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_21 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_21 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_21 + + # Argument x + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_22 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # internal_20 = internal_22 + lw $t0, 16($sp) + sw $t0, 24($sp) + end_assign: + + # If internal_20 then goto then_8792981815556 + lw $t0, 24($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981815556 + + # Jumping to else_8792981815556 + j else_8792981815556 + + then_8792981815556: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_23 = address of allocated object Int + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 28($sp) + j end_assign + not_is_Bool_or_Int: + # internal_19 = internal_23 + lw $t0, 12($sp) + sw $t0, 28($sp) + end_assign: + + # Jumping to endif_8792981815556 + j endif_8792981815556 + + else_8792981815556: + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_24 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_24 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_24 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_25 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_25 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_25 + + # Calling function function_method7_at_D + jal function_method7_at_D + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_26 = result of function_method7_at_D + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 28($sp) + j end_assign + not_is_Bool_or_Int: + # internal_19 = internal_26 + lw $t0, 0($sp) + sw $t0, 28($sp) + end_assign: + + # Jumping to endif_8792981815556 + j endif_8792981815556 + + endif_8792981815556: + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 48($sp) + j end_assign + not_is_Bool_or_Int: + # internal_14 = internal_19 + lw $t0, 28($sp) + sw $t0, 48($sp) + end_assign: + + # Jumping to endif_8792981815290 + j endif_8792981815290 + + endif_8792981815290: + + lw $t0, 48($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 68($sp) + j end_assign + not_is_Bool_or_Int: + # internal_9 = internal_14 + lw $t0, 48($sp) + sw $t0, 68($sp) + end_assign: + + # Jumping to endif_8792981815559 + j endif_8792981815559 + + endif_8792981815559: + + lw $t0, 68($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 100($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_9 + lw $t0, 68($sp) + sw $t0, 100($sp) + end_assign: + + # Jumping to endif_8792981815568 + j endif_8792981815568 + + endif_8792981815568: + + # Loading return value in $v1 + lw $v1, 100($sp) + + # Freeing space for local variables + addi $sp, $sp, 108 + + jr $ra + + function___init___at_E: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.var = internal_0 + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_method6_at_E: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + # num = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_1 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_div + jal function_div + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_2 = result of function_div + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 16($sp) + j end_assign + not_is_Bool_or_Int: + # x = internal_2 + lw $t0, 8($sp) + sw $t0, 16($sp) + end_assign: + + # Allocating A + li $v0, 9 + lw $a0, type_A + syscall + la $t0, type_A # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_3 = address of allocated object A + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_3 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function___init___at_A + jal function___init___at_A + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_3 = result of function___init___at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument x + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_4 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 20 + + jr $ra + + function___init___at_A2I: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_c2i_at_A2I: + # Function parameters + # $ra = 216($sp) + # self = 212($sp) + # char = 208($sp) + + # Reserving space for local variables + addi $sp, $sp, -208 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 200($sp) # internal_1 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 48 + sb $t0, 8($v0) # internal_2[0] = '0' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 196($sp) # internal_2 = "0" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_2 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 204($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 192($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 200($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_3 + lw $t0, 192($sp) + sw $t0, 200($sp) + end_assign: + + # If internal_1 then goto then_8792981816474 + lw $t0, 200($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981816474 + + # Jumping to else_8792981816474 + j else_8792981816474 + + then_8792981816474: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 188($sp) # internal_4 = address of allocated object Int + + lw $t0, 188($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 204($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_4 + lw $t0, 188($sp) + sw $t0, 204($sp) + end_assign: + + # Jumping to endif_8792981816474 + j endif_8792981816474 + + else_8792981816474: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 180($sp) # internal_6 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 49 + sb $t0, 8($v0) # internal_7[0] = '1' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 176($sp) # internal_7 = "1" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_7 + lw $t0, 188($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 184($sp) # internal_8 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 172($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 180($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_8 + lw $t0, 172($sp) + sw $t0, 180($sp) + end_assign: + + # If internal_6 then goto then_8792981816468 + lw $t0, 180($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981816468 + + # Jumping to else_8792981816468 + j else_8792981816468 + + then_8792981816468: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 168($sp) # internal_9 = address of allocated object Int + + lw $t0, 168($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 184($sp) + j end_assign + not_is_Bool_or_Int: + # internal_5 = internal_9 + lw $t0, 168($sp) + sw $t0, 184($sp) + end_assign: + + # Jumping to endif_8792981816468 + j endif_8792981816468 + + else_8792981816468: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_11 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 50 + sb $t0, 8($v0) # internal_12[0] = '2' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 156($sp) # internal_12 = "2" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_12 + lw $t0, 168($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 164($sp) # internal_13 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 152($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 160($sp) + j end_assign + not_is_Bool_or_Int: + # internal_11 = internal_13 + lw $t0, 152($sp) + sw $t0, 160($sp) + end_assign: + + # If internal_11 then goto then_8792981816462 + lw $t0, 160($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981816462 + + # Jumping to else_8792981816462 + j else_8792981816462 + + then_8792981816462: + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 148($sp) # internal_14 = address of allocated object Int + + lw $t0, 148($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 164($sp) + j end_assign + not_is_Bool_or_Int: + # internal_10 = internal_14 + lw $t0, 148($sp) + sw $t0, 164($sp) + end_assign: + + # Jumping to endif_8792981816462 + j endif_8792981816462 + + else_8792981816462: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 140($sp) # internal_16 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 51 + sb $t0, 8($v0) # internal_17[0] = '3' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 136($sp) # internal_17 = "3" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_17 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_17 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 144($sp) # internal_18 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 132($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 140($sp) + j end_assign + not_is_Bool_or_Int: + # internal_16 = internal_18 + lw $t0, 132($sp) + sw $t0, 140($sp) + end_assign: + + # If internal_16 then goto then_8792981816456 + lw $t0, 140($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981816456 + + # Jumping to else_8792981816456 + j else_8792981816456 + + then_8792981816456: + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_19 = address of allocated object Int + + lw $t0, 128($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 144($sp) + j end_assign + not_is_Bool_or_Int: + # internal_15 = internal_19 + lw $t0, 128($sp) + sw $t0, 144($sp) + end_assign: + + # Jumping to endif_8792981816456 + j endif_8792981816456 + + else_8792981816456: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_21 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 52 + sb $t0, 8($v0) # internal_22[0] = '4' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 116($sp) # internal_22 = "4" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_22 + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 124($sp) # internal_23 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 112($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 120($sp) + j end_assign + not_is_Bool_or_Int: + # internal_21 = internal_23 + lw $t0, 112($sp) + sw $t0, 120($sp) + end_assign: + + # If internal_21 then goto then_8792981816450 + lw $t0, 120($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981816450 + + # Jumping to else_8792981816450 + j else_8792981816450 + + then_8792981816450: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_24 = address of allocated object Int + + lw $t0, 108($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 124($sp) + j end_assign + not_is_Bool_or_Int: + # internal_20 = internal_24 + lw $t0, 108($sp) + sw $t0, 124($sp) + end_assign: + + # Jumping to endif_8792981816450 + j endif_8792981816450 + + else_8792981816450: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_26 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 53 + sb $t0, 8($v0) # internal_27[0] = '5' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 96($sp) # internal_27 = "5" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_27 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_27 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 104($sp) # internal_28 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 92($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 100($sp) + j end_assign + not_is_Bool_or_Int: + # internal_26 = internal_28 + lw $t0, 92($sp) + sw $t0, 100($sp) + end_assign: + + # If internal_26 then goto then_8792981816444 + lw $t0, 100($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981816444 + + # Jumping to else_8792981816444 + j else_8792981816444 + + then_8792981816444: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_29 = address of allocated object Int + + lw $t0, 88($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 104($sp) + j end_assign + not_is_Bool_or_Int: + # internal_25 = internal_29 + lw $t0, 88($sp) + sw $t0, 104($sp) + end_assign: + + # Jumping to endif_8792981816444 + j endif_8792981816444 + + else_8792981816444: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_31 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 54 + sb $t0, 8($v0) # internal_32[0] = '6' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 76($sp) # internal_32 = "6" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_32 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_32 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_33 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 72($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 80($sp) + j end_assign + not_is_Bool_or_Int: + # internal_31 = internal_33 + lw $t0, 72($sp) + sw $t0, 80($sp) + end_assign: + + # If internal_31 then goto then_8792981816438 + lw $t0, 80($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981816438 + + # Jumping to else_8792981816438 + j else_8792981816438 + + then_8792981816438: + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_34 = address of allocated object Int + + lw $t0, 68($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 84($sp) + j end_assign + not_is_Bool_or_Int: + # internal_30 = internal_34 + lw $t0, 68($sp) + sw $t0, 84($sp) + end_assign: + + # Jumping to endif_8792981816438 + j endif_8792981816438 + + else_8792981816438: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_36 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 55 + sb $t0, 8($v0) # internal_37[0] = '7' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 56($sp) # internal_37 = "7" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_37 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_37 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 64($sp) # internal_38 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 52($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # internal_36 = internal_38 + lw $t0, 52($sp) + sw $t0, 60($sp) + end_assign: + + # If internal_36 then goto then_8792981816432 + lw $t0, 60($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981816432 + + # Jumping to else_8792981816432 + j else_8792981816432 + + then_8792981816432: + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_39 = address of allocated object Int + + lw $t0, 48($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 64($sp) + j end_assign + not_is_Bool_or_Int: + # internal_35 = internal_39 + lw $t0, 48($sp) + sw $t0, 64($sp) + end_assign: + + # Jumping to endif_8792981816432 + j endif_8792981816432 + + else_8792981816432: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_41 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 56 + sb $t0, 8($v0) # internal_42[0] = '8' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 36($sp) # internal_42 = "8" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_42 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_42 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_43 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 32($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # internal_41 = internal_43 + lw $t0, 32($sp) + sw $t0, 40($sp) + end_assign: + + # If internal_41 then goto then_8792981816426 + lw $t0, 40($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981816426 + + # Jumping to else_8792981816426 + j else_8792981816426 + + then_8792981816426: + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_44 = address of allocated object Int + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # internal_40 = internal_44 + lw $t0, 28($sp) + sw $t0, 44($sp) + end_assign: + + # Jumping to endif_8792981816426 + j endif_8792981816426 + + else_8792981816426: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_46 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 57 + sb $t0, 8($v0) # internal_47[0] = '9' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 16($sp) # internal_47 = "9" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_47 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_47 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_48 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 20($sp) + j end_assign + not_is_Bool_or_Int: + # internal_46 = internal_48 + lw $t0, 12($sp) + sw $t0, 20($sp) + end_assign: + + # If internal_46 then goto then_8792981816405 + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981816405 + + # Jumping to else_8792981816405 + j else_8792981816405 + + then_8792981816405: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_49 = address of allocated object Int + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # internal_45 = internal_49 + lw $t0, 8($sp) + sw $t0, 24($sp) + end_assign: + + # Jumping to endif_8792981816405 + j endif_8792981816405 + + else_8792981816405: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_abort_at_Object + jal function_abort_at_Object + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_50 = result of function_abort_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_51 = address of allocated object Int + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # internal_45 = internal_51 + lw $t0, 0($sp) + sw $t0, 24($sp) + end_assign: + + # Jumping to endif_8792981816405 + j endif_8792981816405 + + endif_8792981816405: + + lw $t0, 24($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # internal_40 = internal_45 + lw $t0, 24($sp) + sw $t0, 44($sp) + end_assign: + + # Jumping to endif_8792981816426 + j endif_8792981816426 + + endif_8792981816426: + + lw $t0, 44($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 64($sp) + j end_assign + not_is_Bool_or_Int: + # internal_35 = internal_40 + lw $t0, 44($sp) + sw $t0, 64($sp) + end_assign: + + # Jumping to endif_8792981816432 + j endif_8792981816432 + + endif_8792981816432: + + lw $t0, 64($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 84($sp) + j end_assign + not_is_Bool_or_Int: + # internal_30 = internal_35 + lw $t0, 64($sp) + sw $t0, 84($sp) + end_assign: + + # Jumping to endif_8792981816438 + j endif_8792981816438 + + endif_8792981816438: + + lw $t0, 84($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 104($sp) + j end_assign + not_is_Bool_or_Int: + # internal_25 = internal_30 + lw $t0, 84($sp) + sw $t0, 104($sp) + end_assign: + + # Jumping to endif_8792981816444 + j endif_8792981816444 + + endif_8792981816444: + + lw $t0, 104($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 124($sp) + j end_assign + not_is_Bool_or_Int: + # internal_20 = internal_25 + lw $t0, 104($sp) + sw $t0, 124($sp) + end_assign: + + # Jumping to endif_8792981816450 + j endif_8792981816450 + + endif_8792981816450: + + lw $t0, 124($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 144($sp) + j end_assign + not_is_Bool_or_Int: + # internal_15 = internal_20 + lw $t0, 124($sp) + sw $t0, 144($sp) + end_assign: + + # Jumping to endif_8792981816456 + j endif_8792981816456 + + endif_8792981816456: + + lw $t0, 144($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 164($sp) + j end_assign + not_is_Bool_or_Int: + # internal_10 = internal_15 + lw $t0, 144($sp) + sw $t0, 164($sp) + end_assign: + + # Jumping to endif_8792981816462 + j endif_8792981816462 + + endif_8792981816462: + + lw $t0, 164($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 184($sp) + j end_assign + not_is_Bool_or_Int: + # internal_5 = internal_10 + lw $t0, 164($sp) + sw $t0, 184($sp) + end_assign: + + # Jumping to endif_8792981816468 + j endif_8792981816468 + + endif_8792981816468: + + lw $t0, 184($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 204($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_5 + lw $t0, 184($sp) + sw $t0, 204($sp) + end_assign: + + # Jumping to endif_8792981816474 + j endif_8792981816474 + + endif_8792981816474: + + # Loading return value in $v1 + lw $v1, 204($sp) + + # Freeing space for local variables + addi $sp, $sp, 208 + + jr $ra + + function_i2c_at_A2I: + # Function parameters + # $ra = 216($sp) + # self = 212($sp) + # i = 208($sp) + + # Reserving space for local variables + addi $sp, $sp, -208 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 200($sp) # internal_1 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 196($sp) # internal_2 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_2 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 204($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 192($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 200($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_3 + lw $t0, 192($sp) + sw $t0, 200($sp) + end_assign: + + # If internal_1 then goto then_8792981817308 + lw $t0, 200($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981817308 + + # Jumping to else_8792981817308 + j else_8792981817308 + + then_8792981817308: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 48 + sb $t0, 8($v0) # internal_4[0] = '0' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 188($sp) # internal_4 = "0" + + lw $t0, 188($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 204($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_4 + lw $t0, 188($sp) + sw $t0, 204($sp) + end_assign: + + # Jumping to endif_8792981817308 + j endif_8792981817308 + + else_8792981817308: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 180($sp) # internal_6 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 176($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_7 + lw $t0, 188($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 184($sp) # internal_8 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 172($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 180($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_8 + lw $t0, 172($sp) + sw $t0, 180($sp) + end_assign: + + # If internal_6 then goto then_8792981817302 + lw $t0, 180($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981817302 + + # Jumping to else_8792981817302 + j else_8792981817302 + + then_8792981817302: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 49 + sb $t0, 8($v0) # internal_9[0] = '1' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 168($sp) # internal_9 = "1" + + lw $t0, 168($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 184($sp) + j end_assign + not_is_Bool_or_Int: + # internal_5 = internal_9 + lw $t0, 168($sp) + sw $t0, 184($sp) + end_assign: + + # Jumping to endif_8792981817302 + j endif_8792981817302 + + else_8792981817302: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_11 = address of allocated object Int + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 156($sp) # internal_12 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_12 + lw $t0, 168($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 164($sp) # internal_13 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 152($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 160($sp) + j end_assign + not_is_Bool_or_Int: + # internal_11 = internal_13 + lw $t0, 152($sp) + sw $t0, 160($sp) + end_assign: + + # If internal_11 then goto then_8792981817296 + lw $t0, 160($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981817296 + + # Jumping to else_8792981817296 + j else_8792981817296 + + then_8792981817296: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 50 + sb $t0, 8($v0) # internal_14[0] = '2' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 148($sp) # internal_14 = "2" + + lw $t0, 148($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 164($sp) + j end_assign + not_is_Bool_or_Int: + # internal_10 = internal_14 + lw $t0, 148($sp) + sw $t0, 164($sp) + end_assign: + + # Jumping to endif_8792981817296 + j endif_8792981817296 + + else_8792981817296: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 140($sp) # internal_16 = address of allocated object Int + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_17 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_17 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_17 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 144($sp) # internal_18 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 132($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 140($sp) + j end_assign + not_is_Bool_or_Int: + # internal_16 = internal_18 + lw $t0, 132($sp) + sw $t0, 140($sp) + end_assign: + + # If internal_16 then goto then_8792981817290 + lw $t0, 140($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981817290 + + # Jumping to else_8792981817290 + j else_8792981817290 + + then_8792981817290: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 51 + sb $t0, 8($v0) # internal_19[0] = '3' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 128($sp) # internal_19 = "3" + + lw $t0, 128($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 144($sp) + j end_assign + not_is_Bool_or_Int: + # internal_15 = internal_19 + lw $t0, 128($sp) + sw $t0, 144($sp) + end_assign: + + # Jumping to endif_8792981817290 + j endif_8792981817290 + + else_8792981817290: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_21 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 116($sp) # internal_22 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_22 + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 124($sp) # internal_23 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 112($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 120($sp) + j end_assign + not_is_Bool_or_Int: + # internal_21 = internal_23 + lw $t0, 112($sp) + sw $t0, 120($sp) + end_assign: + + # If internal_21 then goto then_8792981817284 + lw $t0, 120($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981817284 + + # Jumping to else_8792981817284 + j else_8792981817284 + + then_8792981817284: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 52 + sb $t0, 8($v0) # internal_24[0] = '4' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 108($sp) # internal_24 = "4" + + lw $t0, 108($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 124($sp) + j end_assign + not_is_Bool_or_Int: + # internal_20 = internal_24 + lw $t0, 108($sp) + sw $t0, 124($sp) + end_assign: + + # Jumping to endif_8792981817284 + j endif_8792981817284 + + else_8792981817284: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_26 = address of allocated object Int + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_27 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_27 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_27 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 104($sp) # internal_28 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 92($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 100($sp) + j end_assign + not_is_Bool_or_Int: + # internal_26 = internal_28 + lw $t0, 92($sp) + sw $t0, 100($sp) + end_assign: + + # If internal_26 then goto then_8792981817278 + lw $t0, 100($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981817278 + + # Jumping to else_8792981817278 + j else_8792981817278 + + then_8792981817278: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 53 + sb $t0, 8($v0) # internal_29[0] = '5' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 88($sp) # internal_29 = "5" + + lw $t0, 88($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 104($sp) + j end_assign + not_is_Bool_or_Int: + # internal_25 = internal_29 + lw $t0, 88($sp) + sw $t0, 104($sp) + end_assign: + + # Jumping to endif_8792981817278 + j endif_8792981817278 + + else_8792981817278: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_31 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_32 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_32 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_32 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_33 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 72($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 80($sp) + j end_assign + not_is_Bool_or_Int: + # internal_31 = internal_33 + lw $t0, 72($sp) + sw $t0, 80($sp) + end_assign: + + # If internal_31 then goto then_8792981817272 + lw $t0, 80($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981817272 + + # Jumping to else_8792981817272 + j else_8792981817272 + + then_8792981817272: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 54 + sb $t0, 8($v0) # internal_34[0] = '6' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 68($sp) # internal_34 = "6" + + lw $t0, 68($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 84($sp) + j end_assign + not_is_Bool_or_Int: + # internal_30 = internal_34 + lw $t0, 68($sp) + sw $t0, 84($sp) + end_assign: + + # Jumping to endif_8792981817272 + j endif_8792981817272 + + else_8792981817272: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_36 = address of allocated object Int + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_37 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_37 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_37 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 64($sp) # internal_38 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 52($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # internal_36 = internal_38 + lw $t0, 52($sp) + sw $t0, 60($sp) + end_assign: + + # If internal_36 then goto then_8792981817266 + lw $t0, 60($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981817266 + + # Jumping to else_8792981817266 + j else_8792981817266 + + then_8792981817266: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 55 + sb $t0, 8($v0) # internal_39[0] = '7' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 48($sp) # internal_39 = "7" + + lw $t0, 48($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 64($sp) + j end_assign + not_is_Bool_or_Int: + # internal_35 = internal_39 + lw $t0, 48($sp) + sw $t0, 64($sp) + end_assign: + + # Jumping to endif_8792981817266 + j endif_8792981817266 + + else_8792981817266: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_41 = address of allocated object Int + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_42 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_42 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_42 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_43 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 32($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # internal_41 = internal_43 + lw $t0, 32($sp) + sw $t0, 40($sp) + end_assign: + + # If internal_41 then goto then_8792981817260 + lw $t0, 40($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981817260 + + # Jumping to else_8792981817260 + j else_8792981817260 + + then_8792981817260: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 56 + sb $t0, 8($v0) # internal_44[0] = '8' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 28($sp) # internal_44 = "8" + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # internal_40 = internal_44 + lw $t0, 28($sp) + sw $t0, 44($sp) + end_assign: + + # Jumping to endif_8792981817260 + j endif_8792981817260 + + else_8792981817260: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_46 = address of allocated object Int + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_47 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_47 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_47 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_48 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 20($sp) + j end_assign + not_is_Bool_or_Int: + # internal_46 = internal_48 + lw $t0, 12($sp) + sw $t0, 20($sp) + end_assign: + + # If internal_46 then goto then_8792981817239 + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981817239 + + # Jumping to else_8792981817239 + j else_8792981817239 + + then_8792981817239: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 57 + sb $t0, 8($v0) # internal_49[0] = '9' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_49 = "9" + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # internal_45 = internal_49 + lw $t0, 8($sp) + sw $t0, 24($sp) + end_assign: + + # Jumping to endif_8792981817239 + j endif_8792981817239 + + else_8792981817239: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_abort_at_Object + jal function_abort_at_Object + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_50 = result of function_abort_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 0 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_51 = "" + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # internal_45 = internal_51 + lw $t0, 0($sp) + sw $t0, 24($sp) + end_assign: + + # Jumping to endif_8792981817239 + j endif_8792981817239 + + endif_8792981817239: + + lw $t0, 24($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # internal_40 = internal_45 + lw $t0, 24($sp) + sw $t0, 44($sp) + end_assign: + + # Jumping to endif_8792981817260 + j endif_8792981817260 + + endif_8792981817260: + + lw $t0, 44($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 64($sp) + j end_assign + not_is_Bool_or_Int: + # internal_35 = internal_40 + lw $t0, 44($sp) + sw $t0, 64($sp) + end_assign: + + # Jumping to endif_8792981817266 + j endif_8792981817266 + + endif_8792981817266: + + lw $t0, 64($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 84($sp) + j end_assign + not_is_Bool_or_Int: + # internal_30 = internal_35 + lw $t0, 64($sp) + sw $t0, 84($sp) + end_assign: + + # Jumping to endif_8792981817272 + j endif_8792981817272 + + endif_8792981817272: + + lw $t0, 84($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 104($sp) + j end_assign + not_is_Bool_or_Int: + # internal_25 = internal_30 + lw $t0, 84($sp) + sw $t0, 104($sp) + end_assign: + + # Jumping to endif_8792981817278 + j endif_8792981817278 + + endif_8792981817278: + + lw $t0, 104($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 124($sp) + j end_assign + not_is_Bool_or_Int: + # internal_20 = internal_25 + lw $t0, 104($sp) + sw $t0, 124($sp) + end_assign: + + # Jumping to endif_8792981817284 + j endif_8792981817284 + + endif_8792981817284: + + lw $t0, 124($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 144($sp) + j end_assign + not_is_Bool_or_Int: + # internal_15 = internal_20 + lw $t0, 124($sp) + sw $t0, 144($sp) + end_assign: + + # Jumping to endif_8792981817290 + j endif_8792981817290 + + endif_8792981817290: + + lw $t0, 144($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 164($sp) + j end_assign + not_is_Bool_or_Int: + # internal_10 = internal_15 + lw $t0, 144($sp) + sw $t0, 164($sp) + end_assign: + + # Jumping to endif_8792981817296 + j endif_8792981817296 + + endif_8792981817296: + + lw $t0, 164($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 184($sp) + j end_assign + not_is_Bool_or_Int: + # internal_5 = internal_10 + lw $t0, 164($sp) + sw $t0, 184($sp) + end_assign: + + # Jumping to endif_8792981817302 + j endif_8792981817302 + + endif_8792981817302: + + lw $t0, 184($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 204($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_5 + lw $t0, 184($sp) + sw $t0, 204($sp) + end_assign: + + # Jumping to endif_8792981817308 + j endif_8792981817308 + + endif_8792981817308: + + # Loading return value in $v1 + lw $v1, 204($sp) + + # Freeing space for local variables + addi $sp, $sp, 208 + + jr $ra + + function_a2i_at_A2I: + # Function parameters + # $ra = 152($sp) + # self = 148($sp) + # s = 144($sp) + + # Reserving space for local variables + addi $sp, $sp, -144 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 140($sp) # internal_2 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 144($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 140($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 136($sp) # internal_4 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 124($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 136($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_4 + lw $t0, 124($sp) + sw $t0, 136($sp) + end_assign: + + # If internal_1 then goto then_8792981817498 + lw $t0, 136($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981817498 + + # Jumping to else_8792981817498 + j else_8792981817498 + + then_8792981817498: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_5 = address of allocated object Int + + lw $t0, 120($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 140($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_5 + lw $t0, 120($sp) + sw $t0, 140($sp) + end_assign: + + # Jumping to endif_8792981817498 + j endif_8792981817498 + + else_8792981817498: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_7 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_8 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_9 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 160($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_8 + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument internal_9 + lw $t0, 120($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 116($sp) # internal_10 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 45 + sb $t0, 8($v0) # internal_11[0] = '-' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 96($sp) # internal_11 = "-" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_11 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 104($sp) # internal_12 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 92($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 112($sp) + j end_assign + not_is_Bool_or_Int: + # internal_7 = internal_12 + lw $t0, 92($sp) + sw $t0, 112($sp) + end_assign: + + # If internal_7 then goto then_8792981817513 + lw $t0, 112($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981817513 + + # Jumping to else_8792981817513 + j else_8792981817513 + + then_8792981817513: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_13 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 92($sp) # internal_14 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_15 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_14 + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing internal_14 + + # Argument internal_15 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 88($sp) # internal_16 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 160($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_13 + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing internal_13 + + # Argument internal_16 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 88($sp) # internal_17 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_17 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_17 + + # Calling function function_a2i_aux_at_A2I + jal function_a2i_aux_at_A2I + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_18 = result of function_a2i_aux_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + # Xor operation + lw $t0, 68($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 60($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 56($sp) # $t0 = internal_21 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Addition operation + lw $t0, 56($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 64($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 56($sp) # $t0 = internal_21 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + lw $t0, 56($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 116($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_21 + lw $t0, 56($sp) + sw $t0, 116($sp) + end_assign: + + # Jumping to endif_8792981817513 + j endif_8792981817513 + + else_8792981817513: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_23 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_24 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_25 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 160($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_24 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing internal_24 + + # Argument internal_25 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_25 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 52($sp) # internal_26 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 43 + sb $t0, 8($v0) # internal_27[0] = '+' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 32($sp) # internal_27 = "+" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_26 + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing internal_26 + + # Argument internal_27 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_27 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_28 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 48($sp) + j end_assign + not_is_Bool_or_Int: + # internal_23 = internal_28 + lw $t0, 28($sp) + sw $t0, 48($sp) + end_assign: + + # If internal_23 then goto then_8792981817507 + lw $t0, 48($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981817507 + + # Jumping to else_8792981817507 + j else_8792981817507 + + then_8792981817507: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_29 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_30 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_31 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_30 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_30 + + # Argument internal_31 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_31 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_32 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 160($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_29 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_29 + + # Argument internal_32 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_32 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 24($sp) # internal_33 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_33 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_33 + + # Calling function function_a2i_aux_at_A2I + jal function_a2i_aux_at_A2I + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_34 = result of function_a2i_aux_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 4($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # internal_22 = internal_34 + lw $t0, 4($sp) + sw $t0, 52($sp) + end_assign: + + # Jumping to endif_8792981817507 + j endif_8792981817507 + + else_8792981817507: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing self + + # Argument s + lw $t0, 156($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_a2i_aux_at_A2I + jal function_a2i_aux_at_A2I + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_35 = result of function_a2i_aux_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # internal_22 = internal_35 + lw $t0, 0($sp) + sw $t0, 52($sp) + end_assign: + + # Jumping to endif_8792981817507 + j endif_8792981817507 + + endif_8792981817507: + + lw $t0, 52($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 116($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_22 + lw $t0, 52($sp) + sw $t0, 116($sp) + end_assign: + + # Jumping to endif_8792981817513 + j endif_8792981817513 + + endif_8792981817513: + + lw $t0, 116($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 140($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_6 + lw $t0, 116($sp) + sw $t0, 140($sp) + end_assign: + + # Jumping to endif_8792981817498 + j endif_8792981817498 + + endif_8792981817498: + + # Loading return value in $v1 + lw $v1, 140($sp) + + # Freeing space for local variables + addi $sp, $sp, 144 + + jr $ra + + function_a2i_aux_at_A2I: + # Function parameters + # $ra = 72($sp) + # self = 68($sp) + # s = 64($sp) + + # Reserving space for local variables + addi $sp, $sp, -64 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_1 = address of allocated object Int + + lw $t0, 56($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # int = internal_1 + lw $t0, 56($sp) + sw $t0, 60($sp) + end_assign: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 56($sp) # internal_3 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 48($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # j = internal_3 + lw $t0, 48($sp) + sw $t0, 52($sp) + end_assign: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_5 = address of allocated object Int + + lw $t0, 40($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # i = internal_5 + lw $t0, 40($sp) + sw $t0, 44($sp) + end_assign: + + while_start_8792981818167: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing i + + # Argument j + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing j + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_7 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 32($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 36($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_7 + lw $t0, 32($sp) + sw $t0, 36($sp) + end_assign: + + # If internal_6 then goto while_body_8792981818167 + lw $t0, 36($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8792981818167 + + # Jumping to while_end_8792981818167 + j while_end_8792981818167 + + while_body_8792981818167: + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_8 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument int + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing int + + # Argument internal_8 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_9 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_10 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 80($sp) + sw $t0, 8($sp) # Storing s + + # Argument i + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_10 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 32($sp) # internal_11 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_11 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_c2i_at_A2I + jal function_c2i_at_A2I + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_12 = result of function_c2i_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_9 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_9 + + # Argument internal_12 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_13 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # int = internal_13 + lw $t0, 8($sp) + sw $t0, 60($sp) + end_assign: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_14 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_14 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_14 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_15 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # i = internal_15 + lw $t0, 0($sp) + sw $t0, 44($sp) + end_assign: + + # Jumping to while_start_8792981818167 + j while_start_8792981818167 + + while_end_8792981818167: + + # Loading return value in $v1 + lw $v1, 60($sp) + + # Freeing space for local variables + addi $sp, $sp, 64 + + jr $ra + + function_i2a_at_A2I: + # Function parameters + # $ra = 80($sp) + # self = 76($sp) + # i = 72($sp) + + # Reserving space for local variables + addi $sp, $sp, -72 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_1 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_2 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_2 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 56($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 64($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_3 + lw $t0, 56($sp) + sw $t0, 64($sp) + end_assign: + + # If internal_1 then goto then_8792981818296 + lw $t0, 64($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981818296 + + # Jumping to else_8792981818296 + j else_8792981818296 + + then_8792981818296: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 48 + sb $t0, 8($v0) # internal_4[0] = '0' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 52($sp) # internal_4 = "0" + + lw $t0, 52($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 68($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_4 + lw $t0, 52($sp) + sw $t0, 68($sp) + end_assign: + + # Jumping to endif_8792981818296 + j endif_8792981818296 + + else_8792981818296: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_6 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_7 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_7 + + # Argument i + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing i + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_8 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 36($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_8 + lw $t0, 36($sp) + sw $t0, 44($sp) + end_assign: + + # If internal_6 then goto then_8792981818302 + lw $t0, 44($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981818302 + + # Jumping to else_8792981818302 + j else_8792981818302 + + then_8792981818302: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing self + + # Argument i + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing i + + # Calling function function_i2a_aux_at_A2I + jal function_i2a_aux_at_A2I + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_9 = result of function_i2a_aux_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 32($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 48($sp) + j end_assign + not_is_Bool_or_Int: + # internal_5 = internal_9 + lw $t0, 32($sp) + sw $t0, 48($sp) + end_assign: + + # Jumping to endif_8792981818302 + j endif_8792981818302 + + else_8792981818302: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 45 + sb $t0, 8($v0) # internal_10[0] = '-' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 28($sp) # internal_10 = "-" + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_11 = address of allocated object Int + + # Xor operation + lw $t0, 24($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 16($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 12($sp) # $t0 = internal_14 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Addition operation + lw $t0, 12($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 20($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 12($sp) # $t0 = internal_14 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_14 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_14 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_15 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_15 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_i2a_aux_at_A2I + jal function_i2a_aux_at_A2I + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_16 = result of function_i2a_aux_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_16 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_17 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 48($sp) + j end_assign + not_is_Bool_or_Int: + # internal_5 = internal_17 + lw $t0, 0($sp) + sw $t0, 48($sp) + end_assign: + + # Jumping to endif_8792981818302 + j endif_8792981818302 + + endif_8792981818302: + + lw $t0, 48($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 68($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_5 + lw $t0, 48($sp) + sw $t0, 68($sp) + end_assign: + + # Jumping to endif_8792981818296 + j endif_8792981818296 + + endif_8792981818296: + + # Loading return value in $v1 + lw $v1, 68($sp) + + # Freeing space for local variables + addi $sp, $sp, 72 + + jr $ra + + function_i2a_aux_at_A2I: + # Function parameters + # $ra = 64($sp) + # self = 60($sp) + # i = 56($sp) + + # Reserving space for local variables + addi $sp, $sp, -56 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_1 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_2 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_2 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 40($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 48($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_3 + lw $t0, 40($sp) + sw $t0, 48($sp) + end_assign: + + # If internal_1 then goto then_8792981818670 + lw $t0, 48($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981818670 + + # Jumping to else_8792981818670 + j else_8792981818670 + + then_8792981818670: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 0 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 36($sp) # internal_4 = "" + + lw $t0, 36($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_4 + lw $t0, 36($sp) + sw $t0, 52($sp) + end_assign: + + # Jumping to endif_8792981818670 + j endif_8792981818670 + + else_8792981818670: + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_6 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_6 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_div + jal function_div + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_7 = result of function_div + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 24($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 32($sp) + j end_assign + not_is_Bool_or_Int: + # next = internal_7 + lw $t0, 24($sp) + sw $t0, 32($sp) + end_assign: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing self + + # Argument next + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing next + + # Calling function function_i2a_aux_at_A2I + jal function_i2a_aux_at_A2I + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_8 = result of function_i2a_aux_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_9 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument next + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing next + + # Argument internal_9 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_10 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_10 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_11 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_11 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_i2c_at_A2I + jal function_i2c_at_A2I + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_12 = result of function_i2c_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_8 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument internal_12 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_13 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_13 + lw $t0, 0($sp) + sw $t0, 52($sp) + end_assign: + + # Jumping to endif_8792981818670 + j endif_8792981818670 + + endif_8792981818670: + + # Loading return value in $v1 + lw $v1, 52($sp) + + # Freeing space for local variables + addi $sp, $sp, 56 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 0 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_0 = "" + + # Set attribute char of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.char = internal_0 + + # Set attribute avar of self + lw $t0, 8($sp) # $t0 = self + sw $zero, 12($t0) # Set the attribute avar of self + + # Set attribute a_var of self + lw $t0, 8($sp) # $t0 = self + sw $zero, 16($t0) # Set the attribute a_var of self + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_1 = address of allocated object Int + + # Set attribute flag of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_1 + sw $t1, 20($t0) # self.flag = internal_1 + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_menu_at_Main: + # Function parameters + # $ra = 216($sp) + # self = 212($sp) + + # Reserving space for local variables + addi $sp, $sp, -212 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 30 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 21 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_0[0] = '\n' + + addi $t0, $zero, 9 + sb $t0, 9($v0) # internal_0[1] = '\t' + + addi $t0, $zero, 84 + sb $t0, 10($v0) # internal_0[2] = 'T' + + addi $t0, $zero, 111 + sb $t0, 11($v0) # internal_0[3] = 'o' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_0[4] = ' ' + + addi $t0, $zero, 97 + sb $t0, 13($v0) # internal_0[5] = 'a' + + addi $t0, $zero, 100 + sb $t0, 14($v0) # internal_0[6] = 'd' + + addi $t0, $zero, 100 + sb $t0, 15($v0) # internal_0[7] = 'd' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_0[8] = ' ' + + addi $t0, $zero, 97 + sb $t0, 17($v0) # internal_0[9] = 'a' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_0[10] = ' ' + + addi $t0, $zero, 110 + sb $t0, 19($v0) # internal_0[11] = 'n' + + addi $t0, $zero, 117 + sb $t0, 20($v0) # internal_0[12] = 'u' + + addi $t0, $zero, 109 + sb $t0, 21($v0) # internal_0[13] = 'm' + + addi $t0, $zero, 98 + sb $t0, 22($v0) # internal_0[14] = 'b' + + addi $t0, $zero, 101 + sb $t0, 23($v0) # internal_0[15] = 'e' + + addi $t0, $zero, 114 + sb $t0, 24($v0) # internal_0[16] = 'r' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 116 + sb $t0, 26($v0) # internal_0[18] = 't' + + addi $t0, $zero, 111 + sb $t0, 27($v0) # internal_0[19] = 'o' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_0[20] = ' ' + + sb $zero, 29($v0) # Null-terminator at the end of the string + + sw $v0, 208($sp) # internal_0 = "\n\tTo add a number to " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 216($sp) # internal_1 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 212($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 200($sp) # internal_2 = avar + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_2 + lw $t0, 212($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 208($sp) # internal_3 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 46 + sb $t0, 8($v0) # internal_4[0] = '.' + + addi $t0, $zero, 46 + sb $t0, 9($v0) # internal_4[1] = '.' + + addi $t0, $zero, 46 + sb $t0, 10($v0) # internal_4[2] = '.' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_4[3] = 'e' + + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_4[4] = 'n' + + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_4[5] = 't' + + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_4[6] = 'e' + + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_4[7] = 'r' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_4[8] = ' ' + + addi $t0, $zero, 97 + sb $t0, 17($v0) # internal_4[9] = 'a' + + addi $t0, $zero, 58 + sb $t0, 18($v0) # internal_4[10] = ':' + + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_4[11] = '\n' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 192($sp) # internal_4 = "...enter a:\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_4 + lw $t0, 204($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 200($sp) # internal_5 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 11 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_6[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_6[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_6[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_6[3] = ' ' + + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_6[4] = 'n' + + addi $t0, $zero, 101 + sb $t0, 13($v0) # internal_6[5] = 'e' + + addi $t0, $zero, 103 + sb $t0, 14($v0) # internal_6[6] = 'g' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_6[7] = 'a' + + addi $t0, $zero, 116 + sb $t0, 16($v0) # internal_6[8] = 't' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_6[9] = 'e' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_6[10] = ' ' + + sb $zero, 19($v0) # Null-terminator at the end of the string + + sw $v0, 184($sp) # internal_6 = "\tTo negate " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_6 + lw $t0, 196($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 192($sp) # internal_7 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 212($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 176($sp) # internal_8 = avar + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_8 + lw $t0, 188($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 184($sp) # internal_9 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 46 + sb $t0, 8($v0) # internal_10[0] = '.' + + addi $t0, $zero, 46 + sb $t0, 9($v0) # internal_10[1] = '.' + + addi $t0, $zero, 46 + sb $t0, 10($v0) # internal_10[2] = '.' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_10[3] = 'e' + + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_10[4] = 'n' + + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_10[5] = 't' + + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_10[6] = 'e' + + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_10[7] = 'r' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_10[8] = ' ' + + addi $t0, $zero, 98 + sb $t0, 17($v0) # internal_10[9] = 'b' + + addi $t0, $zero, 58 + sb $t0, 18($v0) # internal_10[10] = ':' + + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_10[11] = '\n' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 168($sp) # internal_10 = "...enter b:\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_10 + lw $t0, 180($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 176($sp) # internal_11 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 41 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 32 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_12[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_12[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_12[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_12[3] = ' ' + + addi $t0, $zero, 102 + sb $t0, 12($v0) # internal_12[4] = 'f' + + addi $t0, $zero, 105 + sb $t0, 13($v0) # internal_12[5] = 'i' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_12[6] = 'n' + + addi $t0, $zero, 100 + sb $t0, 15($v0) # internal_12[7] = 'd' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_12[8] = ' ' + + addi $t0, $zero, 116 + sb $t0, 17($v0) # internal_12[9] = 't' + + addi $t0, $zero, 104 + sb $t0, 18($v0) # internal_12[10] = 'h' + + addi $t0, $zero, 101 + sb $t0, 19($v0) # internal_12[11] = 'e' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_12[12] = ' ' + + addi $t0, $zero, 100 + sb $t0, 21($v0) # internal_12[13] = 'd' + + addi $t0, $zero, 105 + sb $t0, 22($v0) # internal_12[14] = 'i' + + addi $t0, $zero, 102 + sb $t0, 23($v0) # internal_12[15] = 'f' + + addi $t0, $zero, 102 + sb $t0, 24($v0) # internal_12[16] = 'f' + + addi $t0, $zero, 101 + sb $t0, 25($v0) # internal_12[17] = 'e' + + addi $t0, $zero, 114 + sb $t0, 26($v0) # internal_12[18] = 'r' + + addi $t0, $zero, 101 + sb $t0, 27($v0) # internal_12[19] = 'e' + + addi $t0, $zero, 110 + sb $t0, 28($v0) # internal_12[20] = 'n' + + addi $t0, $zero, 99 + sb $t0, 29($v0) # internal_12[21] = 'c' + + addi $t0, $zero, 101 + sb $t0, 30($v0) # internal_12[22] = 'e' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_12[23] = ' ' + + addi $t0, $zero, 98 + sb $t0, 32($v0) # internal_12[24] = 'b' + + addi $t0, $zero, 101 + sb $t0, 33($v0) # internal_12[25] = 'e' + + addi $t0, $zero, 116 + sb $t0, 34($v0) # internal_12[26] = 't' + + addi $t0, $zero, 119 + sb $t0, 35($v0) # internal_12[27] = 'w' + + addi $t0, $zero, 101 + sb $t0, 36($v0) # internal_12[28] = 'e' + + addi $t0, $zero, 101 + sb $t0, 37($v0) # internal_12[29] = 'e' + + addi $t0, $zero, 110 + sb $t0, 38($v0) # internal_12[30] = 'n' + + addi $t0, $zero, 32 + sb $t0, 39($v0) # internal_12[31] = ' ' + + sb $zero, 40($v0) # Null-terminator at the end of the string + + sw $v0, 160($sp) # internal_12 = "\tTo find the difference between " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_12 + lw $t0, 172($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 168($sp) # internal_13 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 212($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 152($sp) # internal_14 = avar + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_14 + lw $t0, 164($sp) + sw $t0, 0($sp) # Storing internal_14 + + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 160($sp) # internal_15 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 39 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 30 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 97 + sb $t0, 8($v0) # internal_16[0] = 'a' + + addi $t0, $zero, 110 + sb $t0, 9($v0) # internal_16[1] = 'n' + + addi $t0, $zero, 100 + sb $t0, 10($v0) # internal_16[2] = 'd' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_16[3] = ' ' + + addi $t0, $zero, 97 + sb $t0, 12($v0) # internal_16[4] = 'a' + + addi $t0, $zero, 110 + sb $t0, 13($v0) # internal_16[5] = 'n' + + addi $t0, $zero, 111 + sb $t0, 14($v0) # internal_16[6] = 'o' + + addi $t0, $zero, 116 + sb $t0, 15($v0) # internal_16[7] = 't' + + addi $t0, $zero, 104 + sb $t0, 16($v0) # internal_16[8] = 'h' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_16[9] = 'e' + + addi $t0, $zero, 114 + sb $t0, 18($v0) # internal_16[10] = 'r' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_16[11] = ' ' + + addi $t0, $zero, 110 + sb $t0, 20($v0) # internal_16[12] = 'n' + + addi $t0, $zero, 117 + sb $t0, 21($v0) # internal_16[13] = 'u' + + addi $t0, $zero, 109 + sb $t0, 22($v0) # internal_16[14] = 'm' + + addi $t0, $zero, 98 + sb $t0, 23($v0) # internal_16[15] = 'b' + + addi $t0, $zero, 101 + sb $t0, 24($v0) # internal_16[16] = 'e' + + addi $t0, $zero, 114 + sb $t0, 25($v0) # internal_16[17] = 'r' + + addi $t0, $zero, 46 + sb $t0, 26($v0) # internal_16[18] = '.' + + addi $t0, $zero, 46 + sb $t0, 27($v0) # internal_16[19] = '.' + + addi $t0, $zero, 46 + sb $t0, 28($v0) # internal_16[20] = '.' + + addi $t0, $zero, 101 + sb $t0, 29($v0) # internal_16[21] = 'e' + + addi $t0, $zero, 110 + sb $t0, 30($v0) # internal_16[22] = 'n' + + addi $t0, $zero, 116 + sb $t0, 31($v0) # internal_16[23] = 't' + + addi $t0, $zero, 101 + sb $t0, 32($v0) # internal_16[24] = 'e' + + addi $t0, $zero, 114 + sb $t0, 33($v0) # internal_16[25] = 'r' + + addi $t0, $zero, 32 + sb $t0, 34($v0) # internal_16[26] = ' ' + + addi $t0, $zero, 99 + sb $t0, 35($v0) # internal_16[27] = 'c' + + addi $t0, $zero, 58 + sb $t0, 36($v0) # internal_16[28] = ':' + + addi $t0, $zero, 10 + sb $t0, 37($v0) # internal_16[29] = '\n' + + sb $zero, 38($v0) # Null-terminator at the end of the string + + sw $v0, 144($sp) # internal_16 = "and another number...enter c:\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_16 + lw $t0, 156($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 152($sp) # internal_17 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 35 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 26 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_18[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_18[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_18[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_18[3] = ' ' + + addi $t0, $zero, 102 + sb $t0, 12($v0) # internal_18[4] = 'f' + + addi $t0, $zero, 105 + sb $t0, 13($v0) # internal_18[5] = 'i' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_18[6] = 'n' + + addi $t0, $zero, 100 + sb $t0, 15($v0) # internal_18[7] = 'd' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_18[8] = ' ' + + addi $t0, $zero, 116 + sb $t0, 17($v0) # internal_18[9] = 't' + + addi $t0, $zero, 104 + sb $t0, 18($v0) # internal_18[10] = 'h' + + addi $t0, $zero, 101 + sb $t0, 19($v0) # internal_18[11] = 'e' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_18[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_18[13] = 'f' + + addi $t0, $zero, 97 + sb $t0, 22($v0) # internal_18[14] = 'a' + + addi $t0, $zero, 99 + sb $t0, 23($v0) # internal_18[15] = 'c' + + addi $t0, $zero, 116 + sb $t0, 24($v0) # internal_18[16] = 't' + + addi $t0, $zero, 111 + sb $t0, 25($v0) # internal_18[17] = 'o' + + addi $t0, $zero, 114 + sb $t0, 26($v0) # internal_18[18] = 'r' + + addi $t0, $zero, 105 + sb $t0, 27($v0) # internal_18[19] = 'i' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_18[20] = 'a' + + addi $t0, $zero, 108 + sb $t0, 29($v0) # internal_18[21] = 'l' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_18[22] = ' ' + + addi $t0, $zero, 111 + sb $t0, 31($v0) # internal_18[23] = 'o' + + addi $t0, $zero, 102 + sb $t0, 32($v0) # internal_18[24] = 'f' + + addi $t0, $zero, 32 + sb $t0, 33($v0) # internal_18[25] = ' ' + + sb $zero, 34($v0) # Null-terminator at the end of the string + + sw $v0, 136($sp) # internal_18 = "\tTo find the factorial of " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_18 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_18 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 144($sp) # internal_19 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 212($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 128($sp) # internal_20 = avar + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_20 + lw $t0, 140($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 136($sp) # internal_21 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 46 + sb $t0, 8($v0) # internal_22[0] = '.' + + addi $t0, $zero, 46 + sb $t0, 9($v0) # internal_22[1] = '.' + + addi $t0, $zero, 46 + sb $t0, 10($v0) # internal_22[2] = '.' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_22[3] = 'e' + + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_22[4] = 'n' + + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_22[5] = 't' + + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_22[6] = 'e' + + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_22[7] = 'r' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_22[8] = ' ' + + addi $t0, $zero, 100 + sb $t0, 17($v0) # internal_22[9] = 'd' + + addi $t0, $zero, 58 + sb $t0, 18($v0) # internal_22[10] = ':' + + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_22[11] = '\n' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 120($sp) # internal_22 = "...enter d:\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_22 + lw $t0, 132($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 128($sp) # internal_23 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 11 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_24[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_24[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_24[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_24[3] = ' ' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_24[4] = 's' + + addi $t0, $zero, 113 + sb $t0, 13($v0) # internal_24[5] = 'q' + + addi $t0, $zero, 117 + sb $t0, 14($v0) # internal_24[6] = 'u' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_24[7] = 'a' + + addi $t0, $zero, 114 + sb $t0, 16($v0) # internal_24[8] = 'r' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_24[9] = 'e' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_24[10] = ' ' + + sb $zero, 19($v0) # Null-terminator at the end of the string + + sw $v0, 112($sp) # internal_24 = "\tTo square " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_24 + lw $t0, 124($sp) + sw $t0, 0($sp) # Storing internal_24 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 120($sp) # internal_25 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 212($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 104($sp) # internal_26 = avar + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_26 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_26 + + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 112($sp) # internal_27 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 46 + sb $t0, 8($v0) # internal_28[0] = '.' + + addi $t0, $zero, 46 + sb $t0, 9($v0) # internal_28[1] = '.' + + addi $t0, $zero, 46 + sb $t0, 10($v0) # internal_28[2] = '.' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_28[3] = 'e' + + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_28[4] = 'n' + + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_28[5] = 't' + + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_28[6] = 'e' + + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_28[7] = 'r' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_28[8] = ' ' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_28[9] = 'e' + + addi $t0, $zero, 58 + sb $t0, 18($v0) # internal_28[10] = ':' + + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_28[11] = '\n' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 96($sp) # internal_28 = "...enter e:\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_28 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_28 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 104($sp) # internal_29 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 18 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_30[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_30[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_30[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_30[3] = ' ' + + addi $t0, $zero, 99 + sb $t0, 12($v0) # internal_30[4] = 'c' + + addi $t0, $zero, 117 + sb $t0, 13($v0) # internal_30[5] = 'u' + + addi $t0, $zero, 98 + sb $t0, 14($v0) # internal_30[6] = 'b' + + addi $t0, $zero, 101 + sb $t0, 15($v0) # internal_30[7] = 'e' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_30[8] = ' ' + + sb $zero, 17($v0) # Null-terminator at the end of the string + + sw $v0, 88($sp) # internal_30 = "\tTo cube " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_30 + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing internal_30 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 96($sp) # internal_31 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 212($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 80($sp) # internal_32 = avar + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_32 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_32 + + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 88($sp) # internal_33 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 46 + sb $t0, 8($v0) # internal_34[0] = '.' + + addi $t0, $zero, 46 + sb $t0, 9($v0) # internal_34[1] = '.' + + addi $t0, $zero, 46 + sb $t0, 10($v0) # internal_34[2] = '.' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_34[3] = 'e' + + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_34[4] = 'n' + + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_34[5] = 't' + + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_34[6] = 'e' + + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_34[7] = 'r' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_34[8] = ' ' + + addi $t0, $zero, 102 + sb $t0, 17($v0) # internal_34[9] = 'f' + + addi $t0, $zero, 58 + sb $t0, 18($v0) # internal_34[10] = ':' + + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_34[11] = '\n' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 72($sp) # internal_34 = "...enter f:\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_34 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_34 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_35 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 25 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 16 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_36[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_36[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_36[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_36[3] = ' ' + + addi $t0, $zero, 102 + sb $t0, 12($v0) # internal_36[4] = 'f' + + addi $t0, $zero, 105 + sb $t0, 13($v0) # internal_36[5] = 'i' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_36[6] = 'n' + + addi $t0, $zero, 100 + sb $t0, 15($v0) # internal_36[7] = 'd' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_36[8] = ' ' + + addi $t0, $zero, 111 + sb $t0, 17($v0) # internal_36[9] = 'o' + + addi $t0, $zero, 117 + sb $t0, 18($v0) # internal_36[10] = 'u' + + addi $t0, $zero, 116 + sb $t0, 19($v0) # internal_36[11] = 't' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_36[12] = ' ' + + addi $t0, $zero, 105 + sb $t0, 21($v0) # internal_36[13] = 'i' + + addi $t0, $zero, 102 + sb $t0, 22($v0) # internal_36[14] = 'f' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_36[15] = ' ' + + sb $zero, 24($v0) # Null-terminator at the end of the string + + sw $v0, 64($sp) # internal_36 = "\tTo find out if " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_36 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_36 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 72($sp) # internal_37 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 212($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 56($sp) # internal_38 = avar + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_38 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_38 + + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 64($sp) # internal_39 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 39 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 30 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 105 + sb $t0, 8($v0) # internal_40[0] = 'i' + + addi $t0, $zero, 115 + sb $t0, 9($v0) # internal_40[1] = 's' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_40[2] = ' ' + + addi $t0, $zero, 97 + sb $t0, 11($v0) # internal_40[3] = 'a' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_40[4] = ' ' + + addi $t0, $zero, 109 + sb $t0, 13($v0) # internal_40[5] = 'm' + + addi $t0, $zero, 117 + sb $t0, 14($v0) # internal_40[6] = 'u' + + addi $t0, $zero, 108 + sb $t0, 15($v0) # internal_40[7] = 'l' + + addi $t0, $zero, 116 + sb $t0, 16($v0) # internal_40[8] = 't' + + addi $t0, $zero, 105 + sb $t0, 17($v0) # internal_40[9] = 'i' + + addi $t0, $zero, 112 + sb $t0, 18($v0) # internal_40[10] = 'p' + + addi $t0, $zero, 108 + sb $t0, 19($v0) # internal_40[11] = 'l' + + addi $t0, $zero, 101 + sb $t0, 20($v0) # internal_40[12] = 'e' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_40[13] = ' ' + + addi $t0, $zero, 111 + sb $t0, 22($v0) # internal_40[14] = 'o' + + addi $t0, $zero, 102 + sb $t0, 23($v0) # internal_40[15] = 'f' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_40[16] = ' ' + + addi $t0, $zero, 51 + sb $t0, 25($v0) # internal_40[17] = '3' + + addi $t0, $zero, 46 + sb $t0, 26($v0) # internal_40[18] = '.' + + addi $t0, $zero, 46 + sb $t0, 27($v0) # internal_40[19] = '.' + + addi $t0, $zero, 46 + sb $t0, 28($v0) # internal_40[20] = '.' + + addi $t0, $zero, 101 + sb $t0, 29($v0) # internal_40[21] = 'e' + + addi $t0, $zero, 110 + sb $t0, 30($v0) # internal_40[22] = 'n' + + addi $t0, $zero, 116 + sb $t0, 31($v0) # internal_40[23] = 't' + + addi $t0, $zero, 101 + sb $t0, 32($v0) # internal_40[24] = 'e' + + addi $t0, $zero, 114 + sb $t0, 33($v0) # internal_40[25] = 'r' + + addi $t0, $zero, 32 + sb $t0, 34($v0) # internal_40[26] = ' ' + + addi $t0, $zero, 103 + sb $t0, 35($v0) # internal_40[27] = 'g' + + addi $t0, $zero, 58 + sb $t0, 36($v0) # internal_40[28] = ':' + + addi $t0, $zero, 10 + sb $t0, 37($v0) # internal_40[29] = '\n' + + sb $zero, 38($v0) # Null-terminator at the end of the string + + sw $v0, 48($sp) # internal_40 = "is a multiple of 3...enter g:\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_40 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_40 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 56($sp) # internal_41 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 11 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_42[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_42[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_42[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_42[3] = ' ' + + addi $t0, $zero, 100 + sb $t0, 12($v0) # internal_42[4] = 'd' + + addi $t0, $zero, 105 + sb $t0, 13($v0) # internal_42[5] = 'i' + + addi $t0, $zero, 118 + sb $t0, 14($v0) # internal_42[6] = 'v' + + addi $t0, $zero, 105 + sb $t0, 15($v0) # internal_42[7] = 'i' + + addi $t0, $zero, 100 + sb $t0, 16($v0) # internal_42[8] = 'd' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_42[9] = 'e' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_42[10] = ' ' + + sb $zero, 19($v0) # Null-terminator at the end of the string + + sw $v0, 40($sp) # internal_42 = "\tTo divide " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_42 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_42 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_43 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 212($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 32($sp) # internal_44 = avar + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_44 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_44 + + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_45 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 25 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 16 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 98 + sb $t0, 8($v0) # internal_46[0] = 'b' + + addi $t0, $zero, 121 + sb $t0, 9($v0) # internal_46[1] = 'y' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_46[2] = ' ' + + addi $t0, $zero, 56 + sb $t0, 11($v0) # internal_46[3] = '8' + + addi $t0, $zero, 46 + sb $t0, 12($v0) # internal_46[4] = '.' + + addi $t0, $zero, 46 + sb $t0, 13($v0) # internal_46[5] = '.' + + addi $t0, $zero, 46 + sb $t0, 14($v0) # internal_46[6] = '.' + + addi $t0, $zero, 101 + sb $t0, 15($v0) # internal_46[7] = 'e' + + addi $t0, $zero, 110 + sb $t0, 16($v0) # internal_46[8] = 'n' + + addi $t0, $zero, 116 + sb $t0, 17($v0) # internal_46[9] = 't' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_46[10] = 'e' + + addi $t0, $zero, 114 + sb $t0, 19($v0) # internal_46[11] = 'r' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_46[12] = ' ' + + addi $t0, $zero, 104 + sb $t0, 21($v0) # internal_46[13] = 'h' + + addi $t0, $zero, 58 + sb $t0, 22($v0) # internal_46[14] = ':' + + addi $t0, $zero, 10 + sb $t0, 23($v0) # internal_46[15] = '\n' + + sb $zero, 24($v0) # Null-terminator at the end of the string + + sw $v0, 24($sp) # internal_46 = "by 8...enter h:\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_46 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_46 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_47 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 41 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 32 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_48[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_48[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_48[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_48[3] = ' ' + + addi $t0, $zero, 103 + sb $t0, 12($v0) # internal_48[4] = 'g' + + addi $t0, $zero, 101 + sb $t0, 13($v0) # internal_48[5] = 'e' + + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_48[6] = 't' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_48[7] = ' ' + + addi $t0, $zero, 97 + sb $t0, 16($v0) # internal_48[8] = 'a' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_48[9] = ' ' + + addi $t0, $zero, 110 + sb $t0, 18($v0) # internal_48[10] = 'n' + + addi $t0, $zero, 101 + sb $t0, 19($v0) # internal_48[11] = 'e' + + addi $t0, $zero, 119 + sb $t0, 20($v0) # internal_48[12] = 'w' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_48[13] = ' ' + + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_48[14] = 'n' + + addi $t0, $zero, 117 + sb $t0, 23($v0) # internal_48[15] = 'u' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_48[16] = 'm' + + addi $t0, $zero, 98 + sb $t0, 25($v0) # internal_48[17] = 'b' + + addi $t0, $zero, 101 + sb $t0, 26($v0) # internal_48[18] = 'e' + + addi $t0, $zero, 114 + sb $t0, 27($v0) # internal_48[19] = 'r' + + addi $t0, $zero, 46 + sb $t0, 28($v0) # internal_48[20] = '.' + + addi $t0, $zero, 46 + sb $t0, 29($v0) # internal_48[21] = '.' + + addi $t0, $zero, 46 + sb $t0, 30($v0) # internal_48[22] = '.' + + addi $t0, $zero, 101 + sb $t0, 31($v0) # internal_48[23] = 'e' + + addi $t0, $zero, 110 + sb $t0, 32($v0) # internal_48[24] = 'n' + + addi $t0, $zero, 116 + sb $t0, 33($v0) # internal_48[25] = 't' + + addi $t0, $zero, 101 + sb $t0, 34($v0) # internal_48[26] = 'e' + + addi $t0, $zero, 114 + sb $t0, 35($v0) # internal_48[27] = 'r' + + addi $t0, $zero, 32 + sb $t0, 36($v0) # internal_48[28] = ' ' + + addi $t0, $zero, 106 + sb $t0, 37($v0) # internal_48[29] = 'j' + + addi $t0, $zero, 58 + sb $t0, 38($v0) # internal_48[30] = ':' + + addi $t0, $zero, 10 + sb $t0, 39($v0) # internal_48[31] = '\n' + + sb $zero, 40($v0) # Null-terminator at the end of the string + + sw $v0, 16($sp) # internal_48 = "\tTo get a new number...enter j:\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_48 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_48 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_49 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 30 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 21 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_50[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_50[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_50[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_50[3] = ' ' + + addi $t0, $zero, 113 + sb $t0, 12($v0) # internal_50[4] = 'q' + + addi $t0, $zero, 117 + sb $t0, 13($v0) # internal_50[5] = 'u' + + addi $t0, $zero, 105 + sb $t0, 14($v0) # internal_50[6] = 'i' + + addi $t0, $zero, 116 + sb $t0, 15($v0) # internal_50[7] = 't' + + addi $t0, $zero, 46 + sb $t0, 16($v0) # internal_50[8] = '.' + + addi $t0, $zero, 46 + sb $t0, 17($v0) # internal_50[9] = '.' + + addi $t0, $zero, 46 + sb $t0, 18($v0) # internal_50[10] = '.' + + addi $t0, $zero, 101 + sb $t0, 19($v0) # internal_50[11] = 'e' + + addi $t0, $zero, 110 + sb $t0, 20($v0) # internal_50[12] = 'n' + + addi $t0, $zero, 116 + sb $t0, 21($v0) # internal_50[13] = 't' + + addi $t0, $zero, 101 + sb $t0, 22($v0) # internal_50[14] = 'e' + + addi $t0, $zero, 114 + sb $t0, 23($v0) # internal_50[15] = 'r' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_50[16] = ' ' + + addi $t0, $zero, 113 + sb $t0, 25($v0) # internal_50[17] = 'q' + + addi $t0, $zero, 58 + sb $t0, 26($v0) # internal_50[18] = ':' + + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_50[19] = '\n' + + addi $t0, $zero, 10 + sb $t0, 28($v0) # internal_50[20] = '\n' + + sb $zero, 29($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_50 = "\tTo quit...enter q:\n\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_50 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_50 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_51 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_in_string_at_IO + jal function_in_string_at_IO + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_52 = result of function_in_string_at_IO + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 212 + + jr $ra + + function_prompt_at_Main: + # Function parameters + # $ra = 24($sp) + # self = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_0[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 16($sp) # internal_0 = "\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_1 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 35 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 26 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 80 + sb $t0, 8($v0) # internal_2[0] = 'P' + + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_2[1] = 'l' + + addi $t0, $zero, 101 + sb $t0, 10($v0) # internal_2[2] = 'e' + + addi $t0, $zero, 97 + sb $t0, 11($v0) # internal_2[3] = 'a' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_2[4] = 's' + + addi $t0, $zero, 101 + sb $t0, 13($v0) # internal_2[5] = 'e' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_2[6] = ' ' + + addi $t0, $zero, 101 + sb $t0, 15($v0) # internal_2[7] = 'e' + + addi $t0, $zero, 110 + sb $t0, 16($v0) # internal_2[8] = 'n' + + addi $t0, $zero, 116 + sb $t0, 17($v0) # internal_2[9] = 't' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_2[10] = 'e' + + addi $t0, $zero, 114 + sb $t0, 19($v0) # internal_2[11] = 'r' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_2[12] = ' ' + + addi $t0, $zero, 97 + sb $t0, 21($v0) # internal_2[13] = 'a' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_2[14] = ' ' + + addi $t0, $zero, 110 + sb $t0, 23($v0) # internal_2[15] = 'n' + + addi $t0, $zero, 117 + sb $t0, 24($v0) # internal_2[16] = 'u' + + addi $t0, $zero, 109 + sb $t0, 25($v0) # internal_2[17] = 'm' + + addi $t0, $zero, 98 + sb $t0, 26($v0) # internal_2[18] = 'b' + + addi $t0, $zero, 101 + sb $t0, 27($v0) # internal_2[19] = 'e' + + addi $t0, $zero, 114 + sb $t0, 28($v0) # internal_2[20] = 'r' + + addi $t0, $zero, 46 + sb $t0, 29($v0) # internal_2[21] = '.' + + addi $t0, $zero, 46 + sb $t0, 30($v0) # internal_2[22] = '.' + + addi $t0, $zero, 46 + sb $t0, 31($v0) # internal_2[23] = '.' + + addi $t0, $zero, 32 + sb $t0, 32($v0) # internal_2[24] = ' ' + + addi $t0, $zero, 32 + sb $t0, 33($v0) # internal_2[25] = ' ' + + sb $zero, 34($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_2 = "Please enter a number... " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_2 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_3 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_in_string_at_IO + jal function_in_string_at_IO + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_4 = result of function_in_string_at_IO + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 20 + + jr $ra + + function_get_int_at_Main: + # Function parameters + # $ra = 24($sp) + # self = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # Allocating A2I + li $v0, 9 + lw $a0, type_A2I + syscall + la $t0, type_A2I # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_1 = address of allocated object A2I + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_A2I + jal function___init___at_A2I + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_1 = result of function___init___at_A2I + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 16($sp) + j end_assign + not_is_Bool_or_Int: + # z = internal_1 + lw $t0, 12($sp) + sw $t0, 16($sp) + end_assign: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_prompt_at_Main + jal function_prompt_at_Main + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_3 = result of function_prompt_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 4($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 8($sp) + j end_assign + not_is_Bool_or_Int: + # s = internal_3 + lw $t0, 4($sp) + sw $t0, 8($sp) + end_assign: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument z + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing z + + # Argument s + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_a2i_at_A2I + jal function_a2i_at_A2I + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_4 = result of function_a2i_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 20 + + jr $ra + + function_is_even_at_Main: + # Function parameters + # $ra = 96($sp) + # self = 92($sp) + # num = 88($sp) + + # Reserving space for local variables + addi $sp, $sp, -88 + + lw $t0, 88($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 84($sp) + j end_assign + not_is_Bool_or_Int: + # x = num + lw $t0, 88($sp) + sw $t0, 84($sp) + end_assign: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_2 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_3 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_4 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 68($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 76($sp) + j end_assign + not_is_Bool_or_Int: + # internal_2 = internal_4 + lw $t0, 68($sp) + sw $t0, 76($sp) + end_assign: + + # If internal_2 then goto then_8792981820167 + lw $t0, 76($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981820167 + + # Jumping to else_8792981820167 + j else_8792981820167 + + then_8792981820167: + + # Xor operation + lw $t0, 84($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 60($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 56($sp) # $t0 = internal_7 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Addition operation + lw $t0, 56($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 64($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 56($sp) # $t0 = internal_7 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_7 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_is_even_at_Main + jal function_is_even_at_Main + lw $ra, 8($sp) + sw $v1, 64($sp) # internal_8 = result of function_is_even_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 52($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 80($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_8 + lw $t0, 52($sp) + sw $t0, 80($sp) + end_assign: + + # Jumping to endif_8792981820167 + j endif_8792981820167 + + else_8792981820167: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_10 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_11 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_11 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_11 + + # Argument x + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_12 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 36($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # internal_10 = internal_12 + lw $t0, 36($sp) + sw $t0, 44($sp) + end_assign: + + # If internal_10 then goto then_8792981820170 + lw $t0, 44($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981820170 + + # Jumping to else_8792981820170 + j else_8792981820170 + + then_8792981820170: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_13 = address of allocated object Int + + lw $t0, 32($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 48($sp) + j end_assign + not_is_Bool_or_Int: + # internal_9 = internal_13 + lw $t0, 32($sp) + sw $t0, 48($sp) + end_assign: + + # Jumping to endif_8792981820170 + j endif_8792981820170 + + else_8792981820170: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_15 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_16 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_16 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_16 + + # Argument x + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_17 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # internal_15 = internal_17 + lw $t0, 16($sp) + sw $t0, 24($sp) + end_assign: + + # If internal_15 then goto then_8792981820176 + lw $t0, 24($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981820176 + + # Jumping to else_8792981820176 + j else_8792981820176 + + then_8792981820176: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_18 = address of allocated object Int + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 28($sp) + j end_assign + not_is_Bool_or_Int: + # internal_14 = internal_18 + lw $t0, 12($sp) + sw $t0, 28($sp) + end_assign: + + # Jumping to endif_8792981820176 + j endif_8792981820176 + + else_8792981820176: + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_19 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_19 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_19 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_20 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_20 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function function_is_even_at_Main + jal function_is_even_at_Main + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_21 = result of function_is_even_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 28($sp) + j end_assign + not_is_Bool_or_Int: + # internal_14 = internal_21 + lw $t0, 0($sp) + sw $t0, 28($sp) + end_assign: + + # Jumping to endif_8792981820176 + j endif_8792981820176 + + endif_8792981820176: + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 48($sp) + j end_assign + not_is_Bool_or_Int: + # internal_9 = internal_14 + lw $t0, 28($sp) + sw $t0, 48($sp) + end_assign: + + # Jumping to endif_8792981820170 + j endif_8792981820170 + + endif_8792981820170: + + lw $t0, 48($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 80($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_9 + lw $t0, 48($sp) + sw $t0, 80($sp) + end_assign: + + # Jumping to endif_8792981820167 + j endif_8792981820167 + + endif_8792981820167: + + # Loading return value in $v1 + lw $v1, 80($sp) + + # Freeing space for local variables + addi $sp, $sp, 88 + + jr $ra + + function_class_type_at_Main: + # Function parameters + # $ra = 212($sp) + # self = 208($sp) + # var = 204($sp) + + # Reserving space for local variables + addi $sp, $sp, -204 + + + + + + + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 180($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 188($sp) # internal_3 = address of allocated object Int + + + + + # internal_1 = typeof var that is the first word of the object + lw $t0, 204($sp) + lw $t1, 0($t0) + sw $t1, 196($sp) + + lw $t0, 196($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 192($sp) + j end_assign + not_is_Bool_or_Int: + # internal_2 = internal_1 + lw $t0, 196($sp) + sw $t0, 192($sp) + end_assign: + + lw $t0, 180($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 200($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_5 + lw $t0, 180($sp) + sw $t0, 200($sp) + end_assign: + + while_start_8792981820269: + + # Equal operation + lw $t0, 192($sp) # Save in $t0 the left operand address + # If internal_3 then goto while_end_8792981820269 + lw $t0, 188($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8792981820269 + + # Addition operation + lw $t0, 200($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # internal_2 = ancestor of internal_2 that is the first word of the object + lw $t0, 192($sp) + lw $t1, 4($t0) + sw $t1, 192($sp) + + # Jumping to while_start_8792981820269 + j while_start_8792981820269 + + while_end_8792981820269: + + + + + lw $t0, 196($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 192($sp) + j end_assign + not_is_Bool_or_Int: + # internal_2 = internal_1 + lw $t0, 196($sp) + sw $t0, 192($sp) + end_assign: + + + foreach_start_8792981820269: + + # Less than operation + lw $t0, 172($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 200($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 168($sp) # $t0 = internal_8 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_8 then goto foreach_body_8792981820269 + lw $t0, 168($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8792981820269 + + # Jumping to foreach_end_8792981820269 + j foreach_end_8792981820269 + + foreach_body_8792981820269: + + + # internal_2 = ancestor of internal_2 that is the first word of the object + lw $t0, 192($sp) + lw $t1, 4($t0) + sw $t1, 192($sp) + + # Addition operation + lw $t0, 172($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_start_8792981820269 + j foreach_start_8792981820269 + + foreach_end_8792981820269: + + + + + + + # internal_11 = direction of A + la $t0, type_A + sw $t0, 156($sp) + + + + # internal_12 = direction of B + la $t0, type_B + sw $t0, 152($sp) + + + + # internal_13 = direction of C + la $t0, type_C + sw $t0, 148($sp) + + + + # internal_14 = direction of D + la $t0, type_D + sw $t0, 144($sp) + + + + # internal_15 = direction of E + la $t0, type_E + sw $t0, 140($sp) + + + + # internal_16 = direction of Object + la $t0, type_Object + sw $t0, 136($sp) + + + + + + + foreach_type_start_8792981820269: + + # Less than operation + lw $t0, 132($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # If internal_18 then goto foreach_type_body_8792981820269 + lw $t0, 128($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8792981820269 + + # Jumping to foreach_type_end_8792981820269 + j foreach_type_end_8792981820269 + + foreach_type_body_8792981820269: + + + + + + foreach_ancestor_start_8792981820269: + + # Less than operation + lw $t0, 120($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 200($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 116($sp) # $t0 = internal_21 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_21 then goto foreach_ancestor_body_8792981820269 + lw $t0, 116($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8792981820269 + + # Jumping to foreach_ancestor_end_8792981820269 + j foreach_ancestor_end_8792981820269 + + foreach_ancestor_body_8792981820269: + + + # Equal operation + lw $t0, 124($sp) # Save in $t0 the left operand address + lw $t1, 112($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 108($sp) # $t0 = internal_23 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_23 then goto foreach_ancestor_end_8792981820269 + lw $t0, 108($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8792981820269 + + # Addition operation + lw $t0, 120($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_ancestor_start_8792981820269 + j foreach_ancestor_start_8792981820269 + + foreach_ancestor_end_8792981820269: + + + + + + # Addition operation + lw $t0, 132($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_type_start_8792981820269 + j foreach_type_start_8792981820269 + + foreach_type_end_8792981820269: + + + + + + + + lw $t0, 200($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 92($sp) + j end_assign + not_is_Bool_or_Int: + # internal_27 = internal_0 + lw $t0, 200($sp) + sw $t0, 92($sp) + end_assign: + + foreach_min_start_8792981820269: + + # Less than operation + lw $t0, 104($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # If internal_28 then goto foreach_min_body_8792981820269 + lw $t0, 88($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8792981820269 + + # Jumping to foreach_min_end_8792981820269 + j foreach_min_end_8792981820269 + + foreach_min_body_8792981820269: + + + # Less than operation + lw $t0, 96($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 92($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 88($sp) # $t0 = internal_28 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_28 then goto update_min_8792981820269 + lw $t0, 88($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8792981820269 + + # Jumping to foreach_min_end_8792981820269 + j foreach_min_end_8792981820269 + + update_min_8792981820269: + + lw $t0, 96($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 92($sp) + j end_assign + not_is_Bool_or_Int: + # internal_27 = internal_26 + lw $t0, 96($sp) + sw $t0, 92($sp) + end_assign: + + lw $t0, 104($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 100($sp) + j end_assign + not_is_Bool_or_Int: + # internal_25 = internal_24 + lw $t0, 104($sp) + sw $t0, 100($sp) + end_assign: + + update_min_end_8792981820269: + + # Addition operation + lw $t0, 104($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_min_start_8792981820269 + j foreach_min_start_8792981820269 + + foreach_min_end_8792981820269: + + + + + + + + + + + + # Equal operation + lw $t0, 100($sp) # Save in $t0 the left operand address + lw $t1, 200($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 80($sp) # $t0 = internal_30 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_30 then goto error_branch_8792981820269 + lw $t0, 80($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8792981820269 + + + + # If internal_31 then goto branch_A_8792981820269 + lw $t0, 76($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_A_8792981820269 + + + # If internal_31 then goto branch_B_8792981820269 + lw $t0, 76($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_B_8792981820269 + + + # If internal_31 then goto branch_C_8792981820269 + lw $t0, 76($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_C_8792981820269 + + + # If internal_31 then goto branch_D_8792981820269 + lw $t0, 76($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_D_8792981820269 + + + # If internal_31 then goto branch_E_8792981820269 + lw $t0, 76($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_E_8792981820269 + + + # If internal_31 then goto branch_Object_8792981820269 + lw $t0, 76($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Object_8792981820269 + + branch_A_8792981820269: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 20 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_34[0] = 'C' + + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_34[1] = 'l' + + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_34[2] = 'a' + + addi $t0, $zero, 115 + sb $t0, 11($v0) # internal_34[3] = 's' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_34[4] = 's' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_34[5] = ' ' + + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_34[6] = 't' + + addi $t0, $zero, 121 + sb $t0, 15($v0) # internal_34[7] = 'y' + + addi $t0, $zero, 112 + sb $t0, 16($v0) # internal_34[8] = 'p' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_34[9] = 'e' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_34[10] = ' ' + + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_34[11] = 'i' + + addi $t0, $zero, 115 + sb $t0, 20($v0) # internal_34[12] = 's' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_34[13] = ' ' + + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_34[14] = 'n' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_34[15] = 'o' + + addi $t0, $zero, 119 + sb $t0, 24($v0) # internal_34[16] = 'w' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_34[17] = ' ' + + addi $t0, $zero, 65 + sb $t0, 26($v0) # internal_34[18] = 'A' + + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_34[19] = '\n' + + sb $zero, 28($v0) # Null-terminator at the end of the string + + sw $v0, 64($sp) # internal_34 = "Class type is now A\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_34 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_34 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 72($sp) # internal_35 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 60($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 72($sp) + j end_assign + not_is_Bool_or_Int: + # internal_32 = internal_35 + lw $t0, 60($sp) + sw $t0, 72($sp) + end_assign: + + # Jumping to branch_end_8792981820269 + j branch_end_8792981820269 + + branch_B_8792981820269: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 20 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_37[0] = 'C' + + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_37[1] = 'l' + + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_37[2] = 'a' + + addi $t0, $zero, 115 + sb $t0, 11($v0) # internal_37[3] = 's' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_37[4] = 's' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_37[5] = ' ' + + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_37[6] = 't' + + addi $t0, $zero, 121 + sb $t0, 15($v0) # internal_37[7] = 'y' + + addi $t0, $zero, 112 + sb $t0, 16($v0) # internal_37[8] = 'p' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_37[9] = 'e' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_37[10] = ' ' + + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_37[11] = 'i' + + addi $t0, $zero, 115 + sb $t0, 20($v0) # internal_37[12] = 's' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_37[13] = ' ' + + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_37[14] = 'n' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_37[15] = 'o' + + addi $t0, $zero, 119 + sb $t0, 24($v0) # internal_37[16] = 'w' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_37[17] = ' ' + + addi $t0, $zero, 66 + sb $t0, 26($v0) # internal_37[18] = 'B' + + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_37[19] = '\n' + + sb $zero, 28($v0) # Null-terminator at the end of the string + + sw $v0, 52($sp) # internal_37 = "Class type is now B\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_37 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_37 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 60($sp) # internal_38 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 48($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 72($sp) + j end_assign + not_is_Bool_or_Int: + # internal_32 = internal_38 + lw $t0, 48($sp) + sw $t0, 72($sp) + end_assign: + + # Jumping to branch_end_8792981820269 + j branch_end_8792981820269 + + branch_C_8792981820269: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 20 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_40[0] = 'C' + + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_40[1] = 'l' + + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_40[2] = 'a' + + addi $t0, $zero, 115 + sb $t0, 11($v0) # internal_40[3] = 's' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_40[4] = 's' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_40[5] = ' ' + + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_40[6] = 't' + + addi $t0, $zero, 121 + sb $t0, 15($v0) # internal_40[7] = 'y' + + addi $t0, $zero, 112 + sb $t0, 16($v0) # internal_40[8] = 'p' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_40[9] = 'e' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_40[10] = ' ' + + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_40[11] = 'i' + + addi $t0, $zero, 115 + sb $t0, 20($v0) # internal_40[12] = 's' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_40[13] = ' ' + + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_40[14] = 'n' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_40[15] = 'o' + + addi $t0, $zero, 119 + sb $t0, 24($v0) # internal_40[16] = 'w' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_40[17] = ' ' + + addi $t0, $zero, 67 + sb $t0, 26($v0) # internal_40[18] = 'C' + + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_40[19] = '\n' + + sb $zero, 28($v0) # Null-terminator at the end of the string + + sw $v0, 40($sp) # internal_40 = "Class type is now C\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_40 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_40 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_41 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 36($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 72($sp) + j end_assign + not_is_Bool_or_Int: + # internal_32 = internal_41 + lw $t0, 36($sp) + sw $t0, 72($sp) + end_assign: + + # Jumping to branch_end_8792981820269 + j branch_end_8792981820269 + + branch_D_8792981820269: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 20 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_43[0] = 'C' + + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_43[1] = 'l' + + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_43[2] = 'a' + + addi $t0, $zero, 115 + sb $t0, 11($v0) # internal_43[3] = 's' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_43[4] = 's' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_43[5] = ' ' + + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_43[6] = 't' + + addi $t0, $zero, 121 + sb $t0, 15($v0) # internal_43[7] = 'y' + + addi $t0, $zero, 112 + sb $t0, 16($v0) # internal_43[8] = 'p' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_43[9] = 'e' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_43[10] = ' ' + + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_43[11] = 'i' + + addi $t0, $zero, 115 + sb $t0, 20($v0) # internal_43[12] = 's' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_43[13] = ' ' + + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_43[14] = 'n' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_43[15] = 'o' + + addi $t0, $zero, 119 + sb $t0, 24($v0) # internal_43[16] = 'w' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_43[17] = ' ' + + addi $t0, $zero, 68 + sb $t0, 26($v0) # internal_43[18] = 'D' + + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_43[19] = '\n' + + sb $zero, 28($v0) # Null-terminator at the end of the string + + sw $v0, 28($sp) # internal_43 = "Class type is now D\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_43 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_43 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_44 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 24($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 72($sp) + j end_assign + not_is_Bool_or_Int: + # internal_32 = internal_44 + lw $t0, 24($sp) + sw $t0, 72($sp) + end_assign: + + # Jumping to branch_end_8792981820269 + j branch_end_8792981820269 + + branch_E_8792981820269: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 20 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_46[0] = 'C' + + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_46[1] = 'l' + + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_46[2] = 'a' + + addi $t0, $zero, 115 + sb $t0, 11($v0) # internal_46[3] = 's' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_46[4] = 's' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_46[5] = ' ' + + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_46[6] = 't' + + addi $t0, $zero, 121 + sb $t0, 15($v0) # internal_46[7] = 'y' + + addi $t0, $zero, 112 + sb $t0, 16($v0) # internal_46[8] = 'p' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_46[9] = 'e' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_46[10] = ' ' + + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_46[11] = 'i' + + addi $t0, $zero, 115 + sb $t0, 20($v0) # internal_46[12] = 's' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_46[13] = ' ' + + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_46[14] = 'n' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_46[15] = 'o' + + addi $t0, $zero, 119 + sb $t0, 24($v0) # internal_46[16] = 'w' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_46[17] = ' ' + + addi $t0, $zero, 69 + sb $t0, 26($v0) # internal_46[18] = 'E' + + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_46[19] = '\n' + + sb $zero, 28($v0) # Null-terminator at the end of the string + + sw $v0, 16($sp) # internal_46 = "Class type is now E\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_46 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_46 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_47 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 72($sp) + j end_assign + not_is_Bool_or_Int: + # internal_32 = internal_47 + lw $t0, 12($sp) + sw $t0, 72($sp) + end_assign: + + # Jumping to branch_end_8792981820269 + j branch_end_8792981820269 + + branch_Object_8792981820269: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 7 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 79 + sb $t0, 8($v0) # internal_49[0] = 'O' + + addi $t0, $zero, 111 + sb $t0, 9($v0) # internal_49[1] = 'o' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_49[2] = 'o' + + addi $t0, $zero, 111 + sb $t0, 11($v0) # internal_49[3] = 'o' + + addi $t0, $zero, 112 + sb $t0, 12($v0) # internal_49[4] = 'p' + + addi $t0, $zero, 115 + sb $t0, 13($v0) # internal_49[5] = 's' + + addi $t0, $zero, 10 + sb $t0, 14($v0) # internal_49[6] = '\n' + + sb $zero, 15($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_49 = "Oooops\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_49 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_49 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_50 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 72($sp) + j end_assign + not_is_Bool_or_Int: + # internal_32 = internal_50 + lw $t0, 0($sp) + sw $t0, 72($sp) + end_assign: + + # Jumping to branch_end_8792981820269 + j branch_end_8792981820269 + + error_branch_8792981820269: + + + branch_end_8792981820269: + + # Loading return value in $v1 + lw $v1, 72($sp) + + # Freeing space for local variables + addi $sp, $sp, 204 + + jr $ra + + function_print_at_Main: + # Function parameters + # $ra = 36($sp) + # self = 32($sp) + # var = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating A2I + li $v0, 9 + lw $a0, type_A2I + syscall + la $t0, type_A2I # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 20($sp) # internal_1 = address of allocated object A2I + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_A2I + jal function___init___at_A2I + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_1 = result of function___init___at_A2I + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 20($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # z = internal_1 + lw $t0, 20($sp) + sw $t0, 24($sp) + end_assign: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument var + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing var + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_2 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument z + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing z + + # Argument internal_2 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_i2a_at_A2I + jal function_i2a_at_A2I + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_3 = result of function_i2a_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_3 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_4 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_5[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_5 = " " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_5 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_6 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 772($sp) + # self = 768($sp) + + # Reserving space for local variables + addi $sp, $sp, -768 + + # Allocating A + li $v0, 9 + lw $a0, type_A + syscall + la $t0, type_A # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 764($sp) # internal_0 = address of allocated object A + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 772($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_A + jal function___init___at_A + lw $ra, 4($sp) + sw $v1, 772($sp) # internal_0 = result of function___init___at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 764($sp) # $t1 = internal_0 + sw $t1, 12($t0) # self.avar = internal_0 + + while_start_8792981790296: + + # Get attribute flag of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'flag' from the instance + sw $t1, 756($sp) # internal_2 = flag + + lw $t0, 756($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 760($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_2 + lw $t0, 756($sp) + sw $t0, 760($sp) + end_assign: + + # If internal_1 then goto while_body_8792981790296 + lw $t0, 760($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8792981790296 + + # Jumping to while_end_8792981790296 + j while_end_8792981790296 + + while_body_8792981790296: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 7 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 110 + sb $t0, 8($v0) # internal_3[0] = 'n' + + addi $t0, $zero, 117 + sb $t0, 9($v0) # internal_3[1] = 'u' + + addi $t0, $zero, 109 + sb $t0, 10($v0) # internal_3[2] = 'm' + + addi $t0, $zero, 98 + sb $t0, 11($v0) # internal_3[3] = 'b' + + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_3[4] = 'e' + + addi $t0, $zero, 114 + sb $t0, 13($v0) # internal_3[5] = 'r' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_3[6] = ' ' + + sb $zero, 15($v0) # Null-terminator at the end of the string + + sw $v0, 752($sp) # internal_3 = "number " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_3 + lw $t0, 764($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 760($sp) # internal_4 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 744($sp) # internal_5 = avar + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_5 + lw $t0, 756($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 752($sp) # internal_6 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 732($sp) # internal_8 = address of allocated object Int + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 728($sp) # internal_9 = avar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_9 + lw $t0, 736($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 732($sp) # internal_10 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_10 + lw $t0, 736($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_is_even_at_Main + jal function_is_even_at_Main + lw $ra, 8($sp) + sw $v1, 732($sp) # internal_11 = result of function_is_even_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 720($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 732($sp) + j end_assign + not_is_Bool_or_Int: + # internal_8 = internal_11 + lw $t0, 720($sp) + sw $t0, 732($sp) + end_assign: + + # If internal_8 then goto then_8792981820386 + lw $t0, 732($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981820386 + + # Jumping to else_8792981820386 + j else_8792981820386 + + then_8792981820386: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 18 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 105 + sb $t0, 8($v0) # internal_12[0] = 'i' + + addi $t0, $zero, 115 + sb $t0, 9($v0) # internal_12[1] = 's' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_12[2] = ' ' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_12[3] = 'e' + + addi $t0, $zero, 118 + sb $t0, 12($v0) # internal_12[4] = 'v' + + addi $t0, $zero, 101 + sb $t0, 13($v0) # internal_12[5] = 'e' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_12[6] = 'n' + + addi $t0, $zero, 33 + sb $t0, 15($v0) # internal_12[7] = '!' + + addi $t0, $zero, 10 + sb $t0, 16($v0) # internal_12[8] = '\n' + + sb $zero, 17($v0) # Null-terminator at the end of the string + + sw $v0, 716($sp) # internal_12 = "is even!\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_12 + lw $t0, 728($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 724($sp) # internal_13 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 712($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 736($sp) + j end_assign + not_is_Bool_or_Int: + # internal_7 = internal_13 + lw $t0, 712($sp) + sw $t0, 736($sp) + end_assign: + + # Jumping to endif_8792981820386 + j endif_8792981820386 + + else_8792981820386: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 17 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 8 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 105 + sb $t0, 8($v0) # internal_14[0] = 'i' + + addi $t0, $zero, 115 + sb $t0, 9($v0) # internal_14[1] = 's' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_14[2] = ' ' + + addi $t0, $zero, 111 + sb $t0, 11($v0) # internal_14[3] = 'o' + + addi $t0, $zero, 100 + sb $t0, 12($v0) # internal_14[4] = 'd' + + addi $t0, $zero, 100 + sb $t0, 13($v0) # internal_14[5] = 'd' + + addi $t0, $zero, 33 + sb $t0, 14($v0) # internal_14[6] = '!' + + addi $t0, $zero, 10 + sb $t0, 15($v0) # internal_14[7] = '\n' + + sb $zero, 16($v0) # Null-terminator at the end of the string + + sw $v0, 708($sp) # internal_14 = "is odd!\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_14 + lw $t0, 720($sp) + sw $t0, 0($sp) # Storing internal_14 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 716($sp) # internal_15 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 704($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 736($sp) + j end_assign + not_is_Bool_or_Int: + # internal_7 = internal_15 + lw $t0, 704($sp) + sw $t0, 736($sp) + end_assign: + + # Jumping to endif_8792981820386 + j endif_8792981820386 + + endif_8792981820386: + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 700($sp) # internal_16 = avar + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_16 + lw $t0, 712($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_class_type_at_Main + jal function_class_type_at_Main + lw $ra, 8($sp) + sw $v1, 708($sp) # internal_17 = result of function_class_type_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 776($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_menu_at_Main + jal function_menu_at_Main + lw $ra, 4($sp) + sw $v1, 700($sp) # internal_18 = result of function_menu_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute char of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 692($sp) # $t1 = internal_18 + sw $t1, 8($t0) # self.char = internal_18 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 684($sp) # internal_20 = address of allocated object Int + + # Get attribute char of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the instance + sw $t1, 680($sp) # internal_21 = char + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 97 + sb $t0, 8($v0) # internal_22[0] = 'a' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 676($sp) # internal_22 = "a" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_21 + lw $t0, 692($sp) + sw $t0, 4($sp) # Storing internal_21 + + # Argument internal_22 + lw $t0, 688($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 684($sp) # internal_23 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 672($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 684($sp) + j end_assign + not_is_Bool_or_Int: + # internal_20 = internal_23 + lw $t0, 672($sp) + sw $t0, 684($sp) + end_assign: + + # If internal_20 then goto then_8792981790281 + lw $t0, 684($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981790281 + + # Jumping to else_8792981790281 + j else_8792981790281 + + then_8792981790281: + + # Allocating A + li $v0, 9 + lw $a0, type_A + syscall + la $t0, type_A # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 668($sp) # internal_24 = address of allocated object A + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_24 + lw $t0, 676($sp) + sw $t0, 0($sp) # Storing internal_24 + + # Calling function function___init___at_A + jal function___init___at_A + lw $ra, 4($sp) + sw $v1, 676($sp) # internal_24 = result of function___init___at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 776($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_get_int_at_Main + jal function_get_int_at_Main + lw $ra, 4($sp) + sw $v1, 672($sp) # internal_25 = result of function_get_int_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_24 + lw $t0, 680($sp) + sw $t0, 4($sp) # Storing internal_24 + + # Argument internal_25 + lw $t0, 676($sp) + sw $t0, 0($sp) # Storing internal_25 + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 672($sp) # internal_26 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute a_var of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 660($sp) # $t1 = internal_26 + sw $t1, 16($t0) # self.a_var = internal_26 + + # Allocating B + li $v0, 9 + lw $a0, type_B + syscall + la $t0, type_B # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 656($sp) # internal_27 = address of allocated object B + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_27 + lw $t0, 664($sp) + sw $t0, 0($sp) # Storing internal_27 + + # Calling function function___init___at_B + jal function___init___at_B + lw $ra, 4($sp) + sw $v1, 664($sp) # internal_27 = result of function___init___at_B + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 652($sp) # internal_28 = avar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_28 + lw $t0, 660($sp) + sw $t0, 0($sp) # Storing internal_28 + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 656($sp) # internal_29 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute a_var of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'a_var' from the instance + sw $t1, 644($sp) # internal_30 = a_var + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_30 + lw $t0, 652($sp) + sw $t0, 0($sp) # Storing internal_30 + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 648($sp) # internal_31 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_27 + lw $t0, 672($sp) + sw $t0, 8($sp) # Storing internal_27 + + # Argument internal_29 + lw $t0, 664($sp) + sw $t0, 4($sp) # Storing internal_29 + + # Argument internal_31 + lw $t0, 656($sp) + sw $t0, 0($sp) # Storing internal_31 + + # Calling function function_method2_at_A + jal function_method2_at_A + lw $ra, 12($sp) + sw $v1, 652($sp) # internal_32 = result of function_method2_at_A + addi $sp, $sp, 16 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 636($sp) # $t1 = internal_32 + sw $t1, 12($t0) # self.avar = internal_32 + + lw $t0, 636($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 688($sp) + j end_assign + not_is_Bool_or_Int: + # internal_19 = internal_32 + lw $t0, 636($sp) + sw $t0, 688($sp) + end_assign: + + # Jumping to endif_8792981790281 + j endif_8792981790281 + + else_8792981790281: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 628($sp) # internal_34 = address of allocated object Int + + # Get attribute char of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the instance + sw $t1, 624($sp) # internal_35 = char + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 98 + sb $t0, 8($v0) # internal_36[0] = 'b' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 620($sp) # internal_36 = "b" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_35 + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing internal_35 + + # Argument internal_36 + lw $t0, 632($sp) + sw $t0, 0($sp) # Storing internal_36 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 628($sp) # internal_37 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 616($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 628($sp) + j end_assign + not_is_Bool_or_Int: + # internal_34 = internal_37 + lw $t0, 616($sp) + sw $t0, 628($sp) + end_assign: + + # If internal_34 then goto then_8792981790275 + lw $t0, 628($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981790275 + + # Jumping to else_8792981790275 + j else_8792981790275 + + then_8792981790275: + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 612($sp) # internal_38 = avar + + + + + + + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 588($sp) # internal_44 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 596($sp) # internal_42 = address of allocated object Int + + + + + # internal_40 = typeof internal_38 that is the first word of the object + lw $t0, 612($sp) + lw $t1, 0($t0) + sw $t1, 604($sp) + + lw $t0, 604($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 600($sp) + j end_assign + not_is_Bool_or_Int: + # internal_41 = internal_40 + lw $t0, 604($sp) + sw $t0, 600($sp) + end_assign: + + lw $t0, 588($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 608($sp) + j end_assign + not_is_Bool_or_Int: + # internal_39 = internal_44 + lw $t0, 588($sp) + sw $t0, 608($sp) + end_assign: + + while_start_8792981788591: + + # Equal operation + lw $t0, 600($sp) # Save in $t0 the left operand address + # If internal_42 then goto while_end_8792981788591 + lw $t0, 596($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8792981788591 + + # Addition operation + lw $t0, 608($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # internal_41 = ancestor of internal_41 that is the first word of the object + lw $t0, 600($sp) + lw $t1, 4($t0) + sw $t1, 600($sp) + + # Jumping to while_start_8792981788591 + j while_start_8792981788591 + + while_end_8792981788591: + + + + + lw $t0, 604($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 600($sp) + j end_assign + not_is_Bool_or_Int: + # internal_41 = internal_40 + lw $t0, 604($sp) + sw $t0, 600($sp) + end_assign: + + + foreach_start_8792981788591: + + # Less than operation + lw $t0, 580($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 608($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 576($sp) # $t0 = internal_47 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_47 then goto foreach_body_8792981788591 + lw $t0, 576($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8792981788591 + + # Jumping to foreach_end_8792981788591 + j foreach_end_8792981788591 + + foreach_body_8792981788591: + + + # internal_41 = ancestor of internal_41 that is the first word of the object + lw $t0, 600($sp) + lw $t1, 4($t0) + sw $t1, 600($sp) + + # Addition operation + lw $t0, 580($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_start_8792981788591 + j foreach_start_8792981788591 + + foreach_end_8792981788591: + + + + + + + # internal_50 = direction of C + la $t0, type_C + sw $t0, 564($sp) + + + + # internal_51 = direction of A + la $t0, type_A + sw $t0, 560($sp) + + + + # internal_52 = direction of Object + la $t0, type_Object + sw $t0, 556($sp) + + + + + + + foreach_type_start_8792981788591: + + # Less than operation + lw $t0, 552($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # If internal_54 then goto foreach_type_body_8792981788591 + lw $t0, 548($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8792981788591 + + # Jumping to foreach_type_end_8792981788591 + j foreach_type_end_8792981788591 + + foreach_type_body_8792981788591: + + + + + + foreach_ancestor_start_8792981788591: + + # Less than operation + lw $t0, 540($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 608($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 536($sp) # $t0 = internal_57 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_57 then goto foreach_ancestor_body_8792981788591 + lw $t0, 536($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8792981788591 + + # Jumping to foreach_ancestor_end_8792981788591 + j foreach_ancestor_end_8792981788591 + + foreach_ancestor_body_8792981788591: + + + # Equal operation + lw $t0, 544($sp) # Save in $t0 the left operand address + lw $t1, 532($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 528($sp) # $t0 = internal_59 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_59 then goto foreach_ancestor_end_8792981788591 + lw $t0, 528($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8792981788591 + + # Addition operation + lw $t0, 540($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_ancestor_start_8792981788591 + j foreach_ancestor_start_8792981788591 + + foreach_ancestor_end_8792981788591: + + + + + + # Addition operation + lw $t0, 552($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_type_start_8792981788591 + j foreach_type_start_8792981788591 + + foreach_type_end_8792981788591: + + + + + + + + lw $t0, 608($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 512($sp) + j end_assign + not_is_Bool_or_Int: + # internal_63 = internal_39 + lw $t0, 608($sp) + sw $t0, 512($sp) + end_assign: + + foreach_min_start_8792981788591: + + # Less than operation + lw $t0, 524($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # If internal_64 then goto foreach_min_body_8792981788591 + lw $t0, 508($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8792981788591 + + # Jumping to foreach_min_end_8792981788591 + j foreach_min_end_8792981788591 + + foreach_min_body_8792981788591: + + + # Less than operation + lw $t0, 516($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 512($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 508($sp) # $t0 = internal_64 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_64 then goto update_min_8792981788591 + lw $t0, 508($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8792981788591 + + # Jumping to foreach_min_end_8792981788591 + j foreach_min_end_8792981788591 + + update_min_8792981788591: + + lw $t0, 516($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 512($sp) + j end_assign + not_is_Bool_or_Int: + # internal_63 = internal_62 + lw $t0, 516($sp) + sw $t0, 512($sp) + end_assign: + + lw $t0, 524($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 520($sp) + j end_assign + not_is_Bool_or_Int: + # internal_61 = internal_60 + lw $t0, 524($sp) + sw $t0, 520($sp) + end_assign: + + update_min_end_8792981788591: + + # Addition operation + lw $t0, 524($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_min_start_8792981788591 + j foreach_min_start_8792981788591 + + foreach_min_end_8792981788591: + + + + + + + + + # Equal operation + lw $t0, 520($sp) # Save in $t0 the left operand address + lw $t1, 608($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 500($sp) # $t0 = internal_66 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_66 then goto error_branch_8792981788591 + lw $t0, 500($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8792981788591 + + + + # If internal_67 then goto branch_C_8792981788591 + lw $t0, 496($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_C_8792981788591 + + + # If internal_67 then goto branch_A_8792981788591 + lw $t0, 496($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_A_8792981788591 + + + # If internal_67 then goto branch_Object_8792981788591 + lw $t0, 496($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Object_8792981788591 + + branch_C_8792981788591: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument c + lw $t0, 496($sp) + sw $t0, 0($sp) # Storing c + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 492($sp) # internal_70 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument c + lw $t0, 500($sp) + sw $t0, 4($sp) # Storing c + + # Argument internal_70 + lw $t0, 496($sp) + sw $t0, 0($sp) # Storing internal_70 + + # Calling function function_method6_at_C + jal function_method6_at_C + lw $ra, 8($sp) + sw $v1, 492($sp) # internal_71 = result of function_method6_at_C + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 480($sp) # $t1 = internal_71 + sw $t1, 12($t0) # self.avar = internal_71 + + lw $t0, 480($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 492($sp) + j end_assign + not_is_Bool_or_Int: + # internal_68 = internal_71 + lw $t0, 480($sp) + sw $t0, 492($sp) + end_assign: + + # Jumping to branch_end_8792981788591 + j branch_end_8792981788591 + + branch_A_8792981788591: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument a + lw $t0, 484($sp) + sw $t0, 0($sp) # Storing a + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 480($sp) # internal_73 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument a + lw $t0, 488($sp) + sw $t0, 4($sp) # Storing a + + # Argument internal_73 + lw $t0, 484($sp) + sw $t0, 0($sp) # Storing internal_73 + + # Calling function function_method3_at_A + jal function_method3_at_A + lw $ra, 8($sp) + sw $v1, 480($sp) # internal_74 = result of function_method3_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 468($sp) # $t1 = internal_74 + sw $t1, 12($t0) # self.avar = internal_74 + + lw $t0, 468($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 492($sp) + j end_assign + not_is_Bool_or_Int: + # internal_68 = internal_74 + lw $t0, 468($sp) + sw $t0, 492($sp) + end_assign: + + # Jumping to branch_end_8792981788591 + j branch_end_8792981788591 + + branch_Object_8792981788591: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 7 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 79 + sb $t0, 8($v0) # internal_76[0] = 'O' + + addi $t0, $zero, 111 + sb $t0, 9($v0) # internal_76[1] = 'o' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_76[2] = 'o' + + addi $t0, $zero, 111 + sb $t0, 11($v0) # internal_76[3] = 'o' + + addi $t0, $zero, 112 + sb $t0, 12($v0) # internal_76[4] = 'p' + + addi $t0, $zero, 115 + sb $t0, 13($v0) # internal_76[5] = 's' + + addi $t0, $zero, 10 + sb $t0, 14($v0) # internal_76[6] = '\n' + + sb $zero, 15($v0) # Null-terminator at the end of the string + + sw $v0, 460($sp) # internal_76 = "Oooops\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_76 + lw $t0, 472($sp) + sw $t0, 0($sp) # Storing internal_76 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 468($sp) # internal_77 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 776($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_abort_at_Object + jal function_abort_at_Object + lw $ra, 4($sp) + sw $v1, 460($sp) # internal_78 = result of function_abort_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 448($sp) # internal_79 = address of allocated object Int + + lw $t0, 448($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 492($sp) + j end_assign + not_is_Bool_or_Int: + # internal_68 = internal_79 + lw $t0, 448($sp) + sw $t0, 492($sp) + end_assign: + + # Jumping to branch_end_8792981788591 + j branch_end_8792981788591 + + error_branch_8792981788591: + + + branch_end_8792981788591: + + lw $t0, 492($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 632($sp) + j end_assign + not_is_Bool_or_Int: + # internal_33 = internal_68 + lw $t0, 492($sp) + sw $t0, 632($sp) + end_assign: + + # Jumping to endif_8792981790275 + j endif_8792981790275 + + else_8792981790275: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 440($sp) # internal_81 = address of allocated object Int + + # Get attribute char of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the instance + sw $t1, 436($sp) # internal_82 = char + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 99 + sb $t0, 8($v0) # internal_83[0] = 'c' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 432($sp) # internal_83 = "c" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_82 + lw $t0, 448($sp) + sw $t0, 4($sp) # Storing internal_82 + + # Argument internal_83 + lw $t0, 444($sp) + sw $t0, 0($sp) # Storing internal_83 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 440($sp) # internal_84 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 428($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 440($sp) + j end_assign + not_is_Bool_or_Int: + # internal_81 = internal_84 + lw $t0, 428($sp) + sw $t0, 440($sp) + end_assign: + + # If internal_81 then goto then_8792981790269 + lw $t0, 440($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981790269 + + # Jumping to else_8792981790269 + j else_8792981790269 + + then_8792981790269: + + # Allocating A + li $v0, 9 + lw $a0, type_A + syscall + la $t0, type_A # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 424($sp) # internal_85 = address of allocated object A + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_85 + lw $t0, 432($sp) + sw $t0, 0($sp) # Storing internal_85 + + # Calling function function___init___at_A + jal function___init___at_A + lw $ra, 4($sp) + sw $v1, 432($sp) # internal_85 = result of function___init___at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 776($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_get_int_at_Main + jal function_get_int_at_Main + lw $ra, 4($sp) + sw $v1, 428($sp) # internal_86 = result of function_get_int_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_85 + lw $t0, 436($sp) + sw $t0, 4($sp) # Storing internal_85 + + # Argument internal_86 + lw $t0, 432($sp) + sw $t0, 0($sp) # Storing internal_86 + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 428($sp) # internal_87 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute a_var of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 416($sp) # $t1 = internal_87 + sw $t1, 16($t0) # self.a_var = internal_87 + + # Allocating D + li $v0, 9 + lw $a0, type_D + syscall + la $t0, type_D # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 412($sp) # internal_88 = address of allocated object D + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_88 + lw $t0, 420($sp) + sw $t0, 0($sp) # Storing internal_88 + + # Calling function function___init___at_D + jal function___init___at_D + lw $ra, 4($sp) + sw $v1, 420($sp) # internal_88 = result of function___init___at_D + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 408($sp) # internal_89 = avar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_89 + lw $t0, 416($sp) + sw $t0, 0($sp) # Storing internal_89 + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 412($sp) # internal_90 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute a_var of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'a_var' from the instance + sw $t1, 400($sp) # internal_91 = a_var + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_91 + lw $t0, 408($sp) + sw $t0, 0($sp) # Storing internal_91 + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 404($sp) # internal_92 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_88 + lw $t0, 428($sp) + sw $t0, 8($sp) # Storing internal_88 + + # Argument internal_90 + lw $t0, 420($sp) + sw $t0, 4($sp) # Storing internal_90 + + # Argument internal_92 + lw $t0, 412($sp) + sw $t0, 0($sp) # Storing internal_92 + + # Calling function function_method4_at_A + jal function_method4_at_A + lw $ra, 12($sp) + sw $v1, 408($sp) # internal_93 = result of function_method4_at_A + addi $sp, $sp, 16 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 392($sp) # $t1 = internal_93 + sw $t1, 12($t0) # self.avar = internal_93 + + lw $t0, 392($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 444($sp) + j end_assign + not_is_Bool_or_Int: + # internal_80 = internal_93 + lw $t0, 392($sp) + sw $t0, 444($sp) + end_assign: + + # Jumping to endif_8792981790269 + j endif_8792981790269 + + else_8792981790269: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 384($sp) # internal_95 = address of allocated object Int + + # Get attribute char of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the instance + sw $t1, 380($sp) # internal_96 = char + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 100 + sb $t0, 8($v0) # internal_97[0] = 'd' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 376($sp) # internal_97 = "d" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_96 + lw $t0, 392($sp) + sw $t0, 4($sp) # Storing internal_96 + + # Argument internal_97 + lw $t0, 388($sp) + sw $t0, 0($sp) # Storing internal_97 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 384($sp) # internal_98 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 372($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 384($sp) + j end_assign + not_is_Bool_or_Int: + # internal_95 = internal_98 + lw $t0, 372($sp) + sw $t0, 384($sp) + end_assign: + + # If internal_95 then goto then_8792981790263 + lw $t0, 384($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981790263 + + # Jumping to else_8792981790263 + j else_8792981790263 + + then_8792981790263: + + # Allocating C + li $v0, 9 + lw $a0, type_C + syscall + la $t0, type_C # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 368($sp) # internal_99 = address of allocated object C + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_99 + lw $t0, 376($sp) + sw $t0, 0($sp) # Storing internal_99 + + # Calling function function___init___at_C + jal function___init___at_C + lw $ra, 4($sp) + sw $v1, 376($sp) # internal_99 = result of function___init___at_C + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 364($sp) # internal_100 = avar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_100 + lw $t0, 372($sp) + sw $t0, 0($sp) # Storing internal_100 + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 368($sp) # internal_101 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_99 + lw $t0, 380($sp) + sw $t0, 4($sp) # Storing internal_99 + + # Argument internal_101 + lw $t0, 372($sp) + sw $t0, 0($sp) # Storing internal_101 + + # Calling function function_method5_at_C + jal function_method5_at_C + lw $ra, 8($sp) + sw $v1, 368($sp) # internal_102 = result of function_method5_at_C + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 356($sp) # $t1 = internal_102 + sw $t1, 12($t0) # self.avar = internal_102 + + lw $t0, 356($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 388($sp) + j end_assign + not_is_Bool_or_Int: + # internal_94 = internal_102 + lw $t0, 356($sp) + sw $t0, 388($sp) + end_assign: + + # Jumping to endif_8792981790263 + j endif_8792981790263 + + else_8792981790263: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 348($sp) # internal_104 = address of allocated object Int + + # Get attribute char of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the instance + sw $t1, 344($sp) # internal_105 = char + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 101 + sb $t0, 8($v0) # internal_106[0] = 'e' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 340($sp) # internal_106 = "e" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_105 + lw $t0, 356($sp) + sw $t0, 4($sp) # Storing internal_105 + + # Argument internal_106 + lw $t0, 352($sp) + sw $t0, 0($sp) # Storing internal_106 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 348($sp) # internal_107 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 336($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 348($sp) + j end_assign + not_is_Bool_or_Int: + # internal_104 = internal_107 + lw $t0, 336($sp) + sw $t0, 348($sp) + end_assign: + + # If internal_104 then goto then_8792981790257 + lw $t0, 348($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981790257 + + # Jumping to else_8792981790257 + j else_8792981790257 + + then_8792981790257: + + # Allocating C + li $v0, 9 + lw $a0, type_C + syscall + la $t0, type_C # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 332($sp) # internal_108 = address of allocated object C + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_108 + lw $t0, 340($sp) + sw $t0, 0($sp) # Storing internal_108 + + # Calling function function___init___at_C + jal function___init___at_C + lw $ra, 4($sp) + sw $v1, 340($sp) # internal_108 = result of function___init___at_C + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 328($sp) # internal_109 = avar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_109 + lw $t0, 336($sp) + sw $t0, 0($sp) # Storing internal_109 + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 332($sp) # internal_110 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_108 + lw $t0, 344($sp) + sw $t0, 4($sp) # Storing internal_108 + + # Argument internal_110 + lw $t0, 336($sp) + sw $t0, 0($sp) # Storing internal_110 + + # Calling function function_method5_at_C + jal function_method5_at_C + lw $ra, 8($sp) + sw $v1, 332($sp) # internal_111 = result of function_method5_at_C + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 320($sp) # $t1 = internal_111 + sw $t1, 12($t0) # self.avar = internal_111 + + lw $t0, 320($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 352($sp) + j end_assign + not_is_Bool_or_Int: + # internal_103 = internal_111 + lw $t0, 320($sp) + sw $t0, 352($sp) + end_assign: + + # Jumping to endif_8792981790257 + j endif_8792981790257 + + else_8792981790257: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 312($sp) # internal_113 = address of allocated object Int + + # Get attribute char of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the instance + sw $t1, 308($sp) # internal_114 = char + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 102 + sb $t0, 8($v0) # internal_115[0] = 'f' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 304($sp) # internal_115 = "f" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_114 + lw $t0, 320($sp) + sw $t0, 4($sp) # Storing internal_114 + + # Argument internal_115 + lw $t0, 316($sp) + sw $t0, 0($sp) # Storing internal_115 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 312($sp) # internal_116 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 300($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 312($sp) + j end_assign + not_is_Bool_or_Int: + # internal_113 = internal_116 + lw $t0, 300($sp) + sw $t0, 312($sp) + end_assign: + + # If internal_113 then goto then_8792981790251 + lw $t0, 312($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981790251 + + # Jumping to else_8792981790251 + j else_8792981790251 + + then_8792981790251: + + # Allocating C + li $v0, 9 + lw $a0, type_C + syscall + la $t0, type_C # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 296($sp) # internal_117 = address of allocated object C + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_117 + lw $t0, 304($sp) + sw $t0, 0($sp) # Storing internal_117 + + # Calling function function___init___at_C + jal function___init___at_C + lw $ra, 4($sp) + sw $v1, 304($sp) # internal_117 = result of function___init___at_C + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 292($sp) # internal_118 = avar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_118 + lw $t0, 300($sp) + sw $t0, 0($sp) # Storing internal_118 + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 296($sp) # internal_119 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_117 + lw $t0, 308($sp) + sw $t0, 4($sp) # Storing internal_117 + + # Argument internal_119 + lw $t0, 300($sp) + sw $t0, 0($sp) # Storing internal_119 + + # Calling function function_method5_at_C + jal function_method5_at_C + lw $ra, 8($sp) + sw $v1, 296($sp) # internal_120 = result of function_method5_at_C + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 284($sp) # $t1 = internal_120 + sw $t1, 12($t0) # self.avar = internal_120 + + lw $t0, 284($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 316($sp) + j end_assign + not_is_Bool_or_Int: + # internal_112 = internal_120 + lw $t0, 284($sp) + sw $t0, 316($sp) + end_assign: + + # Jumping to endif_8792981790251 + j endif_8792981790251 + + else_8792981790251: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 276($sp) # internal_122 = address of allocated object Int + + # Get attribute char of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the instance + sw $t1, 272($sp) # internal_123 = char + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 103 + sb $t0, 8($v0) # internal_124[0] = 'g' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 268($sp) # internal_124 = "g" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_123 + lw $t0, 284($sp) + sw $t0, 4($sp) # Storing internal_123 + + # Argument internal_124 + lw $t0, 280($sp) + sw $t0, 0($sp) # Storing internal_124 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 276($sp) # internal_125 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 264($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 276($sp) + j end_assign + not_is_Bool_or_Int: + # internal_122 = internal_125 + lw $t0, 264($sp) + sw $t0, 276($sp) + end_assign: + + # If internal_122 then goto then_8792981790245 + lw $t0, 276($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981790245 + + # Jumping to else_8792981790245 + j else_8792981790245 + + then_8792981790245: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 256($sp) # internal_127 = address of allocated object Int + + # Allocating D + li $v0, 9 + lw $a0, type_D + syscall + la $t0, type_D # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 252($sp) # internal_128 = address of allocated object D + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_128 + lw $t0, 260($sp) + sw $t0, 0($sp) # Storing internal_128 + + # Calling function function___init___at_D + jal function___init___at_D + lw $ra, 4($sp) + sw $v1, 260($sp) # internal_128 = result of function___init___at_D + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 248($sp) # internal_129 = avar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_129 + lw $t0, 256($sp) + sw $t0, 0($sp) # Storing internal_129 + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 252($sp) # internal_130 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_128 + lw $t0, 264($sp) + sw $t0, 4($sp) # Storing internal_128 + + # Argument internal_130 + lw $t0, 256($sp) + sw $t0, 0($sp) # Storing internal_130 + + # Calling function function_method7_at_D + jal function_method7_at_D + lw $ra, 8($sp) + sw $v1, 252($sp) # internal_131 = result of function_method7_at_D + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 240($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 256($sp) + j end_assign + not_is_Bool_or_Int: + # internal_127 = internal_131 + lw $t0, 240($sp) + sw $t0, 256($sp) + end_assign: + + # If internal_127 then goto then_8792981789148 + lw $t0, 256($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981789148 + + # Jumping to else_8792981789148 + j else_8792981789148 + + then_8792981789148: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 7 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 110 + sb $t0, 8($v0) # internal_132[0] = 'n' + + addi $t0, $zero, 117 + sb $t0, 9($v0) # internal_132[1] = 'u' + + addi $t0, $zero, 109 + sb $t0, 10($v0) # internal_132[2] = 'm' + + addi $t0, $zero, 98 + sb $t0, 11($v0) # internal_132[3] = 'b' + + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_132[4] = 'e' + + addi $t0, $zero, 114 + sb $t0, 13($v0) # internal_132[5] = 'r' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_132[6] = ' ' + + sb $zero, 15($v0) # Null-terminator at the end of the string + + sw $v0, 236($sp) # internal_132 = "number " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_132 + lw $t0, 248($sp) + sw $t0, 0($sp) # Storing internal_132 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 244($sp) # internal_133 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 228($sp) # internal_134 = avar + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_134 + lw $t0, 240($sp) + sw $t0, 0($sp) # Storing internal_134 + + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 236($sp) # internal_135 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 28 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 19 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 105 + sb $t0, 8($v0) # internal_136[0] = 'i' + + addi $t0, $zero, 115 + sb $t0, 9($v0) # internal_136[1] = 's' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_136[2] = ' ' + + addi $t0, $zero, 100 + sb $t0, 11($v0) # internal_136[3] = 'd' + + addi $t0, $zero, 105 + sb $t0, 12($v0) # internal_136[4] = 'i' + + addi $t0, $zero, 118 + sb $t0, 13($v0) # internal_136[5] = 'v' + + addi $t0, $zero, 105 + sb $t0, 14($v0) # internal_136[6] = 'i' + + addi $t0, $zero, 115 + sb $t0, 15($v0) # internal_136[7] = 's' + + addi $t0, $zero, 105 + sb $t0, 16($v0) # internal_136[8] = 'i' + + addi $t0, $zero, 98 + sb $t0, 17($v0) # internal_136[9] = 'b' + + addi $t0, $zero, 108 + sb $t0, 18($v0) # internal_136[10] = 'l' + + addi $t0, $zero, 101 + sb $t0, 19($v0) # internal_136[11] = 'e' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_136[12] = ' ' + + addi $t0, $zero, 98 + sb $t0, 21($v0) # internal_136[13] = 'b' + + addi $t0, $zero, 121 + sb $t0, 22($v0) # internal_136[14] = 'y' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_136[15] = ' ' + + addi $t0, $zero, 51 + sb $t0, 24($v0) # internal_136[16] = '3' + + addi $t0, $zero, 46 + sb $t0, 25($v0) # internal_136[17] = '.' + + addi $t0, $zero, 10 + sb $t0, 26($v0) # internal_136[18] = '\n' + + sb $zero, 27($v0) # Null-terminator at the end of the string + + sw $v0, 220($sp) # internal_136 = "is divisible by 3.\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_136 + lw $t0, 232($sp) + sw $t0, 0($sp) # Storing internal_136 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 228($sp) # internal_137 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 216($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 260($sp) + j end_assign + not_is_Bool_or_Int: + # internal_126 = internal_137 + lw $t0, 216($sp) + sw $t0, 260($sp) + end_assign: + + # Jumping to endif_8792981789148 + j endif_8792981789148 + + else_8792981789148: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 7 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 110 + sb $t0, 8($v0) # internal_138[0] = 'n' + + addi $t0, $zero, 117 + sb $t0, 9($v0) # internal_138[1] = 'u' + + addi $t0, $zero, 109 + sb $t0, 10($v0) # internal_138[2] = 'm' + + addi $t0, $zero, 98 + sb $t0, 11($v0) # internal_138[3] = 'b' + + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_138[4] = 'e' + + addi $t0, $zero, 114 + sb $t0, 13($v0) # internal_138[5] = 'r' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_138[6] = ' ' + + sb $zero, 15($v0) # Null-terminator at the end of the string + + sw $v0, 212($sp) # internal_138 = "number " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_138 + lw $t0, 224($sp) + sw $t0, 0($sp) # Storing internal_138 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 220($sp) # internal_139 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 204($sp) # internal_140 = avar + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_140 + lw $t0, 216($sp) + sw $t0, 0($sp) # Storing internal_140 + + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 212($sp) # internal_141 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 32 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 23 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 105 + sb $t0, 8($v0) # internal_142[0] = 'i' + + addi $t0, $zero, 115 + sb $t0, 9($v0) # internal_142[1] = 's' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_142[2] = ' ' + + addi $t0, $zero, 110 + sb $t0, 11($v0) # internal_142[3] = 'n' + + addi $t0, $zero, 111 + sb $t0, 12($v0) # internal_142[4] = 'o' + + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_142[5] = 't' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_142[6] = ' ' + + addi $t0, $zero, 100 + sb $t0, 15($v0) # internal_142[7] = 'd' + + addi $t0, $zero, 105 + sb $t0, 16($v0) # internal_142[8] = 'i' + + addi $t0, $zero, 118 + sb $t0, 17($v0) # internal_142[9] = 'v' + + addi $t0, $zero, 105 + sb $t0, 18($v0) # internal_142[10] = 'i' + + addi $t0, $zero, 115 + sb $t0, 19($v0) # internal_142[11] = 's' + + addi $t0, $zero, 105 + sb $t0, 20($v0) # internal_142[12] = 'i' + + addi $t0, $zero, 98 + sb $t0, 21($v0) # internal_142[13] = 'b' + + addi $t0, $zero, 108 + sb $t0, 22($v0) # internal_142[14] = 'l' + + addi $t0, $zero, 101 + sb $t0, 23($v0) # internal_142[15] = 'e' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_142[16] = ' ' + + addi $t0, $zero, 98 + sb $t0, 25($v0) # internal_142[17] = 'b' + + addi $t0, $zero, 121 + sb $t0, 26($v0) # internal_142[18] = 'y' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_142[19] = ' ' + + addi $t0, $zero, 51 + sb $t0, 28($v0) # internal_142[20] = '3' + + addi $t0, $zero, 46 + sb $t0, 29($v0) # internal_142[21] = '.' + + addi $t0, $zero, 10 + sb $t0, 30($v0) # internal_142[22] = '\n' + + sb $zero, 31($v0) # Null-terminator at the end of the string + + sw $v0, 196($sp) # internal_142 = "is not divisible by 3.\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_142 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_142 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 204($sp) # internal_143 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 192($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 260($sp) + j end_assign + not_is_Bool_or_Int: + # internal_126 = internal_143 + lw $t0, 192($sp) + sw $t0, 260($sp) + end_assign: + + # Jumping to endif_8792981789148 + j endif_8792981789148 + + endif_8792981789148: + + lw $t0, 260($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 280($sp) + j end_assign + not_is_Bool_or_Int: + # internal_121 = internal_126 + lw $t0, 260($sp) + sw $t0, 280($sp) + end_assign: + + # Jumping to endif_8792981790245 + j endif_8792981790245 + + else_8792981790245: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 184($sp) # internal_145 = address of allocated object Int + + # Get attribute char of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the instance + sw $t1, 180($sp) # internal_146 = char + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 104 + sb $t0, 8($v0) # internal_147[0] = 'h' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 176($sp) # internal_147 = "h" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_146 + lw $t0, 192($sp) + sw $t0, 4($sp) # Storing internal_146 + + # Argument internal_147 + lw $t0, 188($sp) + sw $t0, 0($sp) # Storing internal_147 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 184($sp) # internal_148 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 172($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 184($sp) + j end_assign + not_is_Bool_or_Int: + # internal_145 = internal_148 + lw $t0, 172($sp) + sw $t0, 184($sp) + end_assign: + + # If internal_145 then goto then_8792981790239 + lw $t0, 184($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981790239 + + # Jumping to else_8792981790239 + j else_8792981790239 + + then_8792981790239: + + # Allocating E + li $v0, 9 + lw $a0, type_E + syscall + la $t0, type_E # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 164($sp) # internal_150 = address of allocated object E + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_150 + lw $t0, 172($sp) + sw $t0, 0($sp) # Storing internal_150 + + # Calling function function___init___at_E + jal function___init___at_E + lw $ra, 4($sp) + sw $v1, 172($sp) # internal_150 = result of function___init___at_E + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 160($sp) # internal_151 = avar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_151 + lw $t0, 168($sp) + sw $t0, 0($sp) # Storing internal_151 + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 164($sp) # internal_152 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_150 + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing internal_150 + + # Argument internal_152 + lw $t0, 168($sp) + sw $t0, 0($sp) # Storing internal_152 + + # Calling function function_method6_at_E + jal function_method6_at_E + lw $ra, 8($sp) + sw $v1, 164($sp) # internal_153 = result of function_method6_at_E + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 152($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 168($sp) + j end_assign + not_is_Bool_or_Int: + # x = internal_153 + lw $t0, 152($sp) + sw $t0, 168($sp) + end_assign: + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 144($sp) # internal_155 = avar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_155 + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing internal_155 + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 148($sp) # internal_156 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument x + lw $t0, 176($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 144($sp) # internal_157 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 132($sp) # internal_158 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_157 + lw $t0, 148($sp) + sw $t0, 4($sp) # Storing internal_157 + + # Argument internal_158 + lw $t0, 144($sp) + sw $t0, 0($sp) # Storing internal_158 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 140($sp) # internal_159 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_156 + lw $t0, 152($sp) + sw $t0, 4($sp) # Storing internal_156 + + # Argument internal_159 + lw $t0, 140($sp) + sw $t0, 0($sp) # Storing internal_159 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 136($sp) # internal_160 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 124($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 148($sp) + j end_assign + not_is_Bool_or_Int: + # r = internal_160 + lw $t0, 124($sp) + sw $t0, 148($sp) + end_assign: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 7 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 110 + sb $t0, 8($v0) # internal_161[0] = 'n' + + addi $t0, $zero, 117 + sb $t0, 9($v0) # internal_161[1] = 'u' + + addi $t0, $zero, 109 + sb $t0, 10($v0) # internal_161[2] = 'm' + + addi $t0, $zero, 98 + sb $t0, 11($v0) # internal_161[3] = 'b' + + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_161[4] = 'e' + + addi $t0, $zero, 114 + sb $t0, 13($v0) # internal_161[5] = 'r' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_161[6] = ' ' + + sb $zero, 15($v0) # Null-terminator at the end of the string + + sw $v0, 120($sp) # internal_161 = "number " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_161 + lw $t0, 132($sp) + sw $t0, 0($sp) # Storing internal_161 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 128($sp) # internal_162 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 112($sp) # internal_163 = avar + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_163 + lw $t0, 124($sp) + sw $t0, 0($sp) # Storing internal_163 + + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 120($sp) # internal_164 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 105 + sb $t0, 8($v0) # internal_165[0] = 'i' + + addi $t0, $zero, 115 + sb $t0, 9($v0) # internal_165[1] = 's' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_165[2] = ' ' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_165[3] = 'e' + + addi $t0, $zero, 113 + sb $t0, 12($v0) # internal_165[4] = 'q' + + addi $t0, $zero, 117 + sb $t0, 13($v0) # internal_165[5] = 'u' + + addi $t0, $zero, 97 + sb $t0, 14($v0) # internal_165[6] = 'a' + + addi $t0, $zero, 108 + sb $t0, 15($v0) # internal_165[7] = 'l' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_165[8] = ' ' + + addi $t0, $zero, 116 + sb $t0, 17($v0) # internal_165[9] = 't' + + addi $t0, $zero, 111 + sb $t0, 18($v0) # internal_165[10] = 'o' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_165[11] = ' ' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 104($sp) # internal_165 = "is equal to " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_165 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_165 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 112($sp) # internal_166 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument x + lw $t0, 180($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 108($sp) # internal_167 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 37 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 28 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 116 + sb $t0, 8($v0) # internal_168[0] = 't' + + addi $t0, $zero, 105 + sb $t0, 9($v0) # internal_168[1] = 'i' + + addi $t0, $zero, 109 + sb $t0, 10($v0) # internal_168[2] = 'm' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_168[3] = 'e' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_168[4] = 's' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_168[5] = ' ' + + addi $t0, $zero, 56 + sb $t0, 14($v0) # internal_168[6] = '8' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_168[7] = ' ' + + addi $t0, $zero, 119 + sb $t0, 16($v0) # internal_168[8] = 'w' + + addi $t0, $zero, 105 + sb $t0, 17($v0) # internal_168[9] = 'i' + + addi $t0, $zero, 116 + sb $t0, 18($v0) # internal_168[10] = 't' + + addi $t0, $zero, 104 + sb $t0, 19($v0) # internal_168[11] = 'h' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_168[12] = ' ' + + addi $t0, $zero, 97 + sb $t0, 21($v0) # internal_168[13] = 'a' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_168[14] = ' ' + + addi $t0, $zero, 114 + sb $t0, 23($v0) # internal_168[15] = 'r' + + addi $t0, $zero, 101 + sb $t0, 24($v0) # internal_168[16] = 'e' + + addi $t0, $zero, 109 + sb $t0, 25($v0) # internal_168[17] = 'm' + + addi $t0, $zero, 97 + sb $t0, 26($v0) # internal_168[18] = 'a' + + addi $t0, $zero, 105 + sb $t0, 27($v0) # internal_168[19] = 'i' + + addi $t0, $zero, 110 + sb $t0, 28($v0) # internal_168[20] = 'n' + + addi $t0, $zero, 100 + sb $t0, 29($v0) # internal_168[21] = 'd' + + addi $t0, $zero, 101 + sb $t0, 30($v0) # internal_168[22] = 'e' + + addi $t0, $zero, 114 + sb $t0, 31($v0) # internal_168[23] = 'r' + + addi $t0, $zero, 32 + sb $t0, 32($v0) # internal_168[24] = ' ' + + addi $t0, $zero, 111 + sb $t0, 33($v0) # internal_168[25] = 'o' + + addi $t0, $zero, 102 + sb $t0, 34($v0) # internal_168[26] = 'f' + + addi $t0, $zero, 32 + sb $t0, 35($v0) # internal_168[27] = ' ' + + sb $zero, 36($v0) # Null-terminator at the end of the string + + sw $v0, 92($sp) # internal_168 = "times 8 with a remainder of " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_168 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_168 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_169 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating A2I + li $v0, 9 + lw $a0, type_A2I + syscall + la $t0, type_A2I # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 80($sp) # internal_171 = address of allocated object A2I + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_171 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_171 + + # Calling function function___init___at_A2I + jal function___init___at_A2I + lw $ra, 4($sp) + sw $v1, 88($sp) # internal_171 = result of function___init___at_A2I + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 80($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 476($sp) + j end_assign + not_is_Bool_or_Int: + # a = internal_171 + lw $t0, 80($sp) + sw $t0, 476($sp) + end_assign: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument a + lw $t0, 488($sp) + sw $t0, 4($sp) # Storing a + + # Argument r + lw $t0, 160($sp) + sw $t0, 0($sp) # Storing r + + # Calling function function_i2a_at_A2I + jal function_i2a_at_A2I + lw $ra, 8($sp) + sw $v1, 88($sp) # internal_172 = result of function_i2a_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_172 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_172 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_173 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_174[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 68($sp) # internal_174 = "\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_174 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_174 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 76($sp) # internal_175 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 168($sp) # $t1 = x + sw $t1, 12($t0) # self.avar = x + + lw $t0, 168($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 188($sp) + j end_assign + not_is_Bool_or_Int: + # internal_144 = x + lw $t0, 168($sp) + sw $t0, 188($sp) + end_assign: + + # Jumping to endif_8792981790239 + j endif_8792981790239 + + else_8792981790239: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_177 = address of allocated object Int + + # Get attribute char of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the instance + sw $t1, 52($sp) # internal_178 = char + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 106 + sb $t0, 8($v0) # internal_179[0] = 'j' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 48($sp) # internal_179 = "j" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_178 + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing internal_178 + + # Argument internal_179 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_179 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 56($sp) # internal_180 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 44($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 56($sp) + j end_assign + not_is_Bool_or_Int: + # internal_177 = internal_180 + lw $t0, 44($sp) + sw $t0, 56($sp) + end_assign: + + # If internal_177 then goto then_8792981790233 + lw $t0, 56($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981790233 + + # Jumping to else_8792981790233 + j else_8792981790233 + + then_8792981790233: + + # Allocating A + li $v0, 9 + lw $a0, type_A + syscall + la $t0, type_A # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 40($sp) # internal_181 = address of allocated object A + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_181 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_181 + + # Calling function function___init___at_A + jal function___init___at_A + lw $ra, 4($sp) + sw $v1, 48($sp) # internal_181 = result of function___init___at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 40($sp) # $t1 = internal_181 + sw $t1, 12($t0) # self.avar = internal_181 + + lw $t0, 40($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # internal_176 = internal_181 + lw $t0, 40($sp) + sw $t0, 60($sp) + end_assign: + + # Jumping to endif_8792981790233 + j endif_8792981790233 + + else_8792981790233: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_183 = address of allocated object Int + + # Get attribute char of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the instance + sw $t1, 28($sp) # internal_184 = char + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 113 + sb $t0, 8($v0) # internal_185[0] = 'q' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 24($sp) # internal_185 = "q" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_184 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_184 + + # Argument internal_185 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_185 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_186 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 20($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 32($sp) + j end_assign + not_is_Bool_or_Int: + # internal_183 = internal_186 + lw $t0, 20($sp) + sw $t0, 32($sp) + end_assign: + + # If internal_183 then goto then_8792981789693 + lw $t0, 32($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8792981789693 + + # Jumping to else_8792981789693 + j else_8792981789693 + + then_8792981789693: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_187 = address of allocated object Int + + # Set attribute flag of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 16($sp) # $t1 = internal_187 + sw $t1, 20($t0) # self.flag = internal_187 + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 36($sp) + j end_assign + not_is_Bool_or_Int: + # internal_182 = internal_187 + lw $t0, 16($sp) + sw $t0, 36($sp) + end_assign: + + # Jumping to endif_8792981789693 + j endif_8792981789693 + + else_8792981789693: + + # Allocating A + li $v0, 9 + lw $a0, type_A + syscall + la $t0, type_A # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_188 = address of allocated object A + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_188 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_188 + + # Calling function function___init___at_A + jal function___init___at_A + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_188 = result of function___init___at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 8($sp) # internal_189 = avar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_189 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_189 + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_190 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_188 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_188 + + # Argument internal_190 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_190 + + # Calling function function_method1_at_A + jal function_method1_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_191 = result of function_method1_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_191 + sw $t1, 12($t0) # self.avar = internal_191 + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 36($sp) + j end_assign + not_is_Bool_or_Int: + # internal_182 = internal_191 + lw $t0, 0($sp) + sw $t0, 36($sp) + end_assign: + + # Jumping to endif_8792981789693 + j endif_8792981789693 + + endif_8792981789693: + + lw $t0, 36($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # internal_176 = internal_182 + lw $t0, 36($sp) + sw $t0, 60($sp) + end_assign: + + # Jumping to endif_8792981790233 + j endif_8792981790233 + + endif_8792981790233: + + lw $t0, 60($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 188($sp) + j end_assign + not_is_Bool_or_Int: + # internal_144 = internal_176 + lw $t0, 60($sp) + sw $t0, 188($sp) + end_assign: + + # Jumping to endif_8792981790239 + j endif_8792981790239 + + endif_8792981790239: + + lw $t0, 188($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 280($sp) + j end_assign + not_is_Bool_or_Int: + # internal_121 = internal_144 + lw $t0, 188($sp) + sw $t0, 280($sp) + end_assign: + + # Jumping to endif_8792981790245 + j endif_8792981790245 + + endif_8792981790245: + + lw $t0, 280($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 316($sp) + j end_assign + not_is_Bool_or_Int: + # internal_112 = internal_121 + lw $t0, 280($sp) + sw $t0, 316($sp) + end_assign: + + # Jumping to endif_8792981790251 + j endif_8792981790251 + + endif_8792981790251: + + lw $t0, 316($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 352($sp) + j end_assign + not_is_Bool_or_Int: + # internal_103 = internal_112 + lw $t0, 316($sp) + sw $t0, 352($sp) + end_assign: + + # Jumping to endif_8792981790257 + j endif_8792981790257 + + endif_8792981790257: + + lw $t0, 352($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 388($sp) + j end_assign + not_is_Bool_or_Int: + # internal_94 = internal_103 + lw $t0, 352($sp) + sw $t0, 388($sp) + end_assign: + + # Jumping to endif_8792981790263 + j endif_8792981790263 + + endif_8792981790263: + + lw $t0, 388($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 444($sp) + j end_assign + not_is_Bool_or_Int: + # internal_80 = internal_94 + lw $t0, 388($sp) + sw $t0, 444($sp) + end_assign: + + # Jumping to endif_8792981790269 + j endif_8792981790269 + + endif_8792981790269: + + lw $t0, 444($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 632($sp) + j end_assign + not_is_Bool_or_Int: + # internal_33 = internal_80 + lw $t0, 444($sp) + sw $t0, 632($sp) + end_assign: + + # Jumping to endif_8792981790275 + j endif_8792981790275 + + endif_8792981790275: + + lw $t0, 632($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 688($sp) + j end_assign + not_is_Bool_or_Int: + # internal_19 = internal_33 + lw $t0, 632($sp) + sw $t0, 688($sp) + end_assign: + + # Jumping to endif_8792981790281 + j endif_8792981790281 + + endif_8792981790281: + + # Jumping to while_start_8792981790296 + j while_start_8792981790296 + + while_end_8792981790296: + + # Loading return value in $v1 + addi $v1, $zero, 0 + + # Freeing space for local variables + addi $sp, $sp, 768 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_main_at_Main + jal function_main_at_Main + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/src/arith.cil b/src/arith.cil new file mode 100644 index 000000000..c6827d87e --- /dev/null +++ b/src/arith.cil @@ -0,0 +1,3288 @@ +.TYPES +type Object { + inherits from null + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method __init__: function___init___at_Object +} +type IO { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method out_string: function_out_string_at_IO + method out_int: function_out_int_at_IO + method in_string: function_in_string_at_IO + method in_int: function_in_int_at_IO + method __init__: function___init___at_IO +} +type Int { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method __init__: function___init___at_Int +} +type String { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method length: function_length_at_String + method concat: function_concat_at_String + method substr: function_substr_at_String + method __init__: function___init___at_String +} +type Bool { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method __init__: function___init___at_Bool +} +type A { + inherits from Object + + attribute var + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method value: function_value_at_A + method set_var: function_set_var_at_A + method method1: function_method1_at_A + method method2: function_method2_at_A + method method3: function_method3_at_A + method method4: function_method4_at_A + method method5: function_method5_at_A + method __init__: function___init___at_A +} +type B { + inherits from A + + attribute var + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method value: function_value_at_A + method set_var: function_set_var_at_A + method method1: function_method1_at_A + method method2: function_method2_at_A + method method3: function_method3_at_A + method method4: function_method4_at_A + method method5: function_method5_at_B + method __init__: function___init___at_B +} +type C { + inherits from B + + attribute var + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method value: function_value_at_A + method set_var: function_set_var_at_A + method method1: function_method1_at_A + method method2: function_method2_at_A + method method3: function_method3_at_A + method method4: function_method4_at_A + method method5: function_method5_at_C + method __init__: function___init___at_C + method method6: function_method6_at_C +} +type D { + inherits from B + + attribute var + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method value: function_value_at_A + method set_var: function_set_var_at_A + method method1: function_method1_at_A + method method2: function_method2_at_A + method method3: function_method3_at_A + method method4: function_method4_at_A + method method5: function_method5_at_B + method __init__: function___init___at_D + method method7: function_method7_at_D +} +type E { + inherits from D + + attribute var + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method value: function_value_at_A + method set_var: function_set_var_at_A + method method1: function_method1_at_A + method method2: function_method2_at_A + method method3: function_method3_at_A + method method4: function_method4_at_A + method method5: function_method5_at_B + method __init__: function___init___at_E + method method7: function_method7_at_D + method method6: function_method6_at_E +} +type A2I { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method c2i: function_c2i_at_A2I + method i2c: function_i2c_at_A2I + method a2i: function_a2i_at_A2I + method a2i_aux: function_a2i_aux_at_A2I + method i2a: function_i2a_at_A2I + method i2a_aux: function_i2a_aux_at_A2I + method __init__: function___init___at_A2I +} +type Main { + inherits from IO + + attribute char + attribute avar + attribute a_var + attribute flag + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method out_string: function_out_string_at_IO + method out_int: function_out_int_at_IO + method in_string: function_in_string_at_IO + method in_int: function_in_int_at_IO + method menu: function_menu_at_Main + method prompt: function_prompt_at_Main + method get_int: function_get_int_at_Main + method is_even: function_is_even_at_Main + method class_type: function_class_type_at_Main + method print: function_print_at_Main + method main: function_main_at_Main + method __init__: function___init___at_Main +} + +.DATA + + +.CODE +function function_add{ + PARAM a + PARAM b + + LOCAL internal_0 # Adding result + + internal_0 = ALLOCINT 0 + internal_0 = a + b + + RETURN internal_0 +} +function function_sub{ + PARAM a + PARAM b + + LOCAL internal_0 # Substracting result + + internal_0 = ALLOCINT 0 + internal_0 = a - b + + RETURN internal_0 +} +function function_mult{ + PARAM a + PARAM b + + LOCAL internal_0 # Multiting result + + internal_0 = ALLOCINT 0 + internal_0 = a * b + + RETURN internal_0 +} +function function_div{ + PARAM a + PARAM b + + LOCAL internal_0 # Dividing result + + internal_0 = ALLOCINT 0 + internal_0 = a / b + + RETURN internal_0 +} +function function_xor{ + PARAM a + PARAM b + + LOCAL internal_0 # Xor result + + internal_0 = ALLOCINT 0 + internal_0 = XOR a b + + RETURN internal_0 +} +function function_less_than{ + PARAM a + PARAM b + + LOCAL internal_0 # Less than result + + internal_0 = ALLOCBOOL 0 + internal_0 = a < b + + RETURN internal_0 +} +function function_less_than_or_equal{ + PARAM a + PARAM b + + LOCAL internal_0 # Less than or equal result + + internal_0 = ALLOCBOOL 0 + internal_0 = a <= b + + RETURN internal_0 +} +function function_equal{ + PARAM a + PARAM b + + LOCAL internal_0 # Equal result + LOCAL internal_1 # Type of a + LOCAL internal_2 # Type Int + LOCAL internal_3 # Type Bool + LOCAL internal_4 # Type String + LOCAL internal_5 # Type of a equals int + LOCAL internal_6 # Type of a equals bool + LOCAL internal_7 # Type of a equals string + + internal_0 = ALLOCBOOL 0 + internal_1 = TYPEOF a + internal_2 = TYPEADDR Int + internal_3 = TYPEADDR Bool + internal_4 = TYPEADDR String + internal_5 = ALLOCBOOL 0 + internal_6 = ALLOCBOOL 0 + internal_7 = ALLOCBOOL 0 + internal_5 = EQUALADDR internal_1 internal_2 + internal_6 = EQUALADDR internal_1 internal_3 + internal_7 = EQUALADDR internal_1 internal_4 + + IF internal_5 GOTO a_is_type_int_or_bool + IF internal_6 GOTO a_is_type_int_or_bool + IF internal_7 GOTO a_is_type_string + GOTO a_is_type_object + + a_is_type_int_or_bool: + internal_0 = EQUALINT a b + GOTO end_of_equal + + a_is_type_string: + internal_0 = EQUALSTR a b + GOTO end_of_equal + + a_is_type_object: + internal_0 = a == b + GOTO end_of_equal + + end_of_equal: + + RETURN internal_0 +} +function function___init___at_Object{ + PARAM self + + RETURN self +} +function function_abort_at_Object{ + PARAM self + + HALT + + RETURN self +} +function function_type_name_at_Object{ + PARAM self + + LOCAL internal_0 # type_name + + internal_0 = TYPENAME self + + RETURN internal_0 +} +function function_copy_at_Object{ + PARAM self + + LOCAL internal_0 + + internal_0 = COPY self + + RETURN internal_0 +} +function function___init___at_IO{ + PARAM self + + RETURN self +} +function function_out_string_at_IO{ + PARAM self + PARAM x + + PRINTSTR x + + RETURN self +} +function function_out_int_at_IO{ + PARAM self + PARAM x + + PRINTINT x + + RETURN self +} +function function_in_string_at_IO{ + PARAM self + + LOCAL internal_0 + + READSTR internal_0 + + RETURN internal_0 +} +function function_in_int_at_IO{ + PARAM self + + LOCAL internal_0 + + READINT internal_0 + + RETURN internal_0 +} +function function___init___at_String{ + PARAM self + + RETURN self +} +function function_length_at_String{ + PARAM self + + LOCAL internal_0 + + internal_0 = LENGTH self + + RETURN internal_0 +} +function function_concat_at_String{ + PARAM self + PARAM s + + LOCAL internal_0 + + internal_0 = CONCAT self s + + RETURN internal_0 +} +function function_substr_at_String{ + PARAM self + PARAM i + PARAM l + + LOCAL internal_0 + + internal_0 = SUBSTRING self i l + + RETURN internal_0 +} +function function___init___at_A{ + PARAM self + + LOCAL internal_0 # Integer 0 + + internal_0 = ALLOCINT 0 + SETATTR self var internal_0 + + RETURN self +} +function function_value_at_A{ + PARAM self + + LOCAL internal_0 + + internal_0 = GETATTR self var + + RETURN internal_0 +} +function function_set_var_at_A{ + PARAM self + PARAM num + + SETATTR self var num + + RETURN self +} +function function_method1_at_A{ + PARAM self + PARAM num + + RETURN self +} +function function_method2_at_A{ + PARAM self + PARAM num1 + PARAM num2 + + LOCAL x + LOCAL internal_1 # Store the result of the operation function_add + LOCAL internal_2 # Store an instance of the class B + LOCAL internal_3 + + x = 0 + + ARG num1 + ARG num2 + internal_1 = CALL function_add + x = internal_1 + internal_2 = ALLOCATE B # Allocate the object B + ARG internal_2 # Pass the instance to the constructor + internal_2 = VCALL B function___init___at_B # Call the constructor + ARG internal_2 + ARG x + internal_3 = VCALL B function_set_var_at_A + + RETURN internal_3 +} +function function_method3_at_A{ + PARAM self + PARAM num + + LOCAL x + LOCAL internal_1 # Integer 1 + LOCAL internal_2 # Integer 4294967295 + LOCAL internal_3 # Store the complement a2 of num + LOCAL internal_4 # Store an instance of the class C + LOCAL internal_5 + + x = 0 + internal_3 = XOR num internal_2 # Getting the complement a1 of num + internal_3 = internal_3 + internal_1 # Adding 1 to the complement a1 we get the complement a2 of num + x = internal_3 + internal_4 = ALLOCATE C # Allocate the object C + ARG internal_4 # Pass the instance to the constructor + internal_4 = VCALL C function___init___at_C # Call the constructor + ARG internal_4 + ARG x + internal_5 = VCALL C function_set_var_at_A + + RETURN internal_5 +} +function function_method4_at_A{ + PARAM self + PARAM num1 + PARAM num2 + + LOCAL internal_0 + LOCAL internal_1 + LOCAL internal_2 # Store the result of the operation function_less_than + LOCAL x + LOCAL internal_4 # Store the result of the operation function_sub + LOCAL internal_5 # Store an instance of the class D + LOCAL internal_6 + LOCAL x + LOCAL internal_8 # Store the result of the operation function_sub + LOCAL internal_9 # Store an instance of the class D + LOCAL internal_10 + + # Conditional + internal_1 = ALLOCBOOL 0 + + ARG num2 + ARG num1 + internal_2 = CALL function_less_than + internal_1 = internal_2 + IF internal_1 GOTO then_8792981814074 + GOTO else_8792981814074 + + then_8792981814074: + x = 0 + + ARG num1 + ARG num2 + internal_4 = CALL function_sub + x = internal_4 + internal_5 = ALLOCATE D # Allocate the object D + ARG internal_5 # Pass the instance to the constructor + internal_5 = VCALL D function___init___at_D # Call the constructor + ARG internal_5 + ARG x + internal_6 = VCALL D function_set_var_at_A + internal_0 = internal_6 + GOTO endif_8792981814074 + + else_8792981814074: + x = 0 + + ARG num2 + ARG num1 + internal_8 = CALL function_sub + x = internal_8 + internal_9 = ALLOCATE D # Allocate the object D + ARG internal_9 # Pass the instance to the constructor + internal_9 = VCALL D function___init___at_D # Call the constructor + ARG internal_9 + ARG x + internal_10 = VCALL D function_set_var_at_A + internal_0 = internal_10 + GOTO endif_8792981814074 + + endif_8792981814074: + + RETURN internal_0 +} +function function_method5_at_A{ + PARAM self + PARAM num + + LOCAL x + LOCAL internal_1 # Integer 1 + LOCAL y + LOCAL internal_3 # Integer 1 + LOCAL internal_4 + LOCAL internal_5 # Store the result of the operation function_less_than_or_equal + LOCAL internal_6 # Store the result of the operation function_mult + LOCAL internal_7 # Integer 1 + LOCAL internal_8 # Store the result of the operation function_add + LOCAL internal_9 # Store an instance of the class E + LOCAL internal_10 + + internal_1 = ALLOCINT 1 + x = internal_1 + internal_3 = ALLOCINT 1 + y = internal_3 + while_start_8792981814158: + + ARG y + ARG num + internal_5 = CALL function_less_than_or_equal + internal_4 = internal_5 + IF internal_4 GOTO while_body_8792981814158 + GOTO while_end_8792981814158 + + while_body_8792981814158: + + ARG x + ARG y + internal_6 = CALL function_mult + x = internal_6 + internal_7 = ALLOCINT 1 + + ARG y + ARG internal_7 + internal_8 = CALL function_add + y = internal_8 + GOTO while_start_8792981814158 + + while_end_8792981814158: + internal_9 = ALLOCATE E # Allocate the object E + ARG internal_9 # Pass the instance to the constructor + internal_9 = VCALL E function___init___at_E # Call the constructor + ARG internal_9 + ARG x + internal_10 = VCALL E function_set_var_at_A + + RETURN internal_10 +} +function function___init___at_B{ + PARAM self + + LOCAL internal_0 # Integer 0 + + internal_0 = ALLOCINT 0 + SETATTR self var internal_0 + + RETURN self +} +function function_method5_at_B{ + PARAM self + PARAM num + + LOCAL x + LOCAL internal_1 # Store the result of the operation function_mult + LOCAL internal_2 # Store an instance of the class E + LOCAL internal_3 + + x = 0 + + ARG num + ARG num + internal_1 = CALL function_mult + x = internal_1 + internal_2 = ALLOCATE E # Allocate the object E + ARG internal_2 # Pass the instance to the constructor + internal_2 = VCALL E function___init___at_E # Call the constructor + ARG internal_2 + ARG x + internal_3 = VCALL E function_set_var_at_A + + RETURN internal_3 +} +function function___init___at_C{ + PARAM self + + LOCAL internal_0 # Integer 0 + + internal_0 = ALLOCINT 0 + SETATTR self var internal_0 + + RETURN self +} +function function_method6_at_C{ + PARAM self + PARAM num + + LOCAL x + LOCAL internal_1 # Integer 1 + LOCAL internal_2 # Integer 4294967295 + LOCAL internal_3 # Store the complement a2 of num + LOCAL internal_4 # Store an instance of the class A + LOCAL internal_5 + + x = 0 + internal_3 = XOR num internal_2 # Getting the complement a1 of num + internal_3 = internal_3 + internal_1 # Adding 1 to the complement a1 we get the complement a2 of num + x = internal_3 + internal_4 = ALLOCATE A # Allocate the object A + ARG internal_4 # Pass the instance to the constructor + internal_4 = VCALL A function___init___at_A # Call the constructor + ARG internal_4 + ARG x + internal_5 = VCALL A function_set_var_at_A + + RETURN internal_5 +} +function function_method5_at_C{ + PARAM self + PARAM num + + LOCAL x + LOCAL internal_1 # Store the result of the operation function_mult + LOCAL internal_2 # Store the result of the operation function_mult + LOCAL internal_3 # Store an instance of the class E + LOCAL internal_4 + + x = 0 + + ARG num + ARG num + internal_1 = CALL function_mult + + ARG internal_1 + ARG num + internal_2 = CALL function_mult + x = internal_2 + internal_3 = ALLOCATE E # Allocate the object E + ARG internal_3 # Pass the instance to the constructor + internal_3 = VCALL E function___init___at_E # Call the constructor + ARG internal_3 + ARG x + internal_4 = VCALL E function_set_var_at_A + + RETURN internal_4 +} +function function___init___at_D{ + PARAM self + + LOCAL internal_0 # Integer 0 + + internal_0 = ALLOCINT 0 + SETATTR self var internal_0 + + RETURN self +} +function function_method7_at_D{ + PARAM self + PARAM num + + LOCAL x + LOCAL internal_1 + LOCAL internal_2 + LOCAL internal_3 # Integer 0 + LOCAL internal_4 # Store the result of the operation function_less_than + LOCAL internal_5 # Integer 1 + LOCAL internal_6 # Integer 4294967295 + LOCAL internal_7 # Store the complement a2 of x + LOCAL internal_8 + LOCAL internal_9 + LOCAL internal_10 + LOCAL internal_11 # Integer 0 + LOCAL internal_12 # Store the result of the operation function_equal + LOCAL internal_13 # Boolean true + LOCAL internal_14 + LOCAL internal_15 + LOCAL internal_16 # Integer 1 + LOCAL internal_17 # Store the result of the operation function_equal + LOCAL internal_18 # Boolean false + LOCAL internal_19 + LOCAL internal_20 + LOCAL internal_21 # Integer 2 + LOCAL internal_22 # Store the result of the operation function_equal + LOCAL internal_23 # Boolean false + LOCAL internal_24 # Integer 3 + LOCAL internal_25 # Store the result of the operation function_sub + LOCAL internal_26 + + x = num + # Conditional + internal_2 = ALLOCBOOL 0 + internal_3 = ALLOCINT 0 + + ARG x + ARG internal_3 + internal_4 = CALL function_less_than + internal_2 = internal_4 + IF internal_2 GOTO then_8792981815568 + GOTO else_8792981815568 + + then_8792981815568: + internal_7 = XOR x internal_6 # Getting the complement a1 of x + internal_7 = internal_7 + internal_5 # Adding 1 to the complement a1 we get the complement a2 of x + ARG self + ARG internal_7 + internal_8 = VCALL D function_method7_at_D + internal_1 = internal_8 + GOTO endif_8792981815568 + + else_8792981815568: + # Conditional + internal_10 = ALLOCBOOL 0 + internal_11 = ALLOCINT 0 + + ARG internal_11 + ARG x + internal_12 = CALL function_equal + internal_10 = internal_12 + IF internal_10 GOTO then_8792981815559 + GOTO else_8792981815559 + + then_8792981815559: + internal_13 = ALLOCBOOL 1 + internal_9 = internal_13 + GOTO endif_8792981815559 + + else_8792981815559: + # Conditional + internal_15 = ALLOCBOOL 0 + internal_16 = ALLOCINT 1 + + ARG internal_16 + ARG x + internal_17 = CALL function_equal + internal_15 = internal_17 + IF internal_15 GOTO then_8792981815290 + GOTO else_8792981815290 + + then_8792981815290: + internal_18 = ALLOCBOOL 0 + internal_14 = internal_18 + GOTO endif_8792981815290 + + else_8792981815290: + # Conditional + internal_20 = ALLOCBOOL 0 + internal_21 = ALLOCINT 2 + + ARG internal_21 + ARG x + internal_22 = CALL function_equal + internal_20 = internal_22 + IF internal_20 GOTO then_8792981815556 + GOTO else_8792981815556 + + then_8792981815556: + internal_23 = ALLOCBOOL 0 + internal_19 = internal_23 + GOTO endif_8792981815556 + + else_8792981815556: + internal_24 = ALLOCINT 3 + + ARG x + ARG internal_24 + internal_25 = CALL function_sub + ARG self + ARG internal_25 + internal_26 = VCALL D function_method7_at_D + internal_19 = internal_26 + GOTO endif_8792981815556 + + endif_8792981815556: + internal_14 = internal_19 + GOTO endif_8792981815290 + + endif_8792981815290: + internal_9 = internal_14 + GOTO endif_8792981815559 + + endif_8792981815559: + internal_1 = internal_9 + GOTO endif_8792981815568 + + endif_8792981815568: + + RETURN internal_1 +} +function function___init___at_E{ + PARAM self + + LOCAL internal_0 # Integer 0 + + internal_0 = ALLOCINT 0 + SETATTR self var internal_0 + + RETURN self +} +function function_method6_at_E{ + PARAM self + PARAM num + + LOCAL x + LOCAL internal_1 # Integer 8 + LOCAL internal_2 # Store the result of the operation function_div + LOCAL internal_3 # Store an instance of the class A + LOCAL internal_4 + + x = 0 + internal_1 = ALLOCINT 8 + + ARG num + ARG internal_1 + internal_2 = CALL function_div + x = internal_2 + internal_3 = ALLOCATE A # Allocate the object A + ARG internal_3 # Pass the instance to the constructor + internal_3 = VCALL A function___init___at_A # Call the constructor + ARG internal_3 + ARG x + internal_4 = VCALL A function_set_var_at_A + + RETURN internal_4 +} +function function___init___at_A2I{ + PARAM self + + RETURN self +} +function function_c2i_at_A2I{ + PARAM self + PARAM char + + LOCAL internal_0 + LOCAL internal_1 + LOCAL internal_2 # String "0" + LOCAL internal_3 # Store the result of the operation function_equal + LOCAL internal_4 # Integer 0 + LOCAL internal_5 + LOCAL internal_6 + LOCAL internal_7 # String "1" + LOCAL internal_8 # Store the result of the operation function_equal + LOCAL internal_9 # Integer 1 + LOCAL internal_10 + LOCAL internal_11 + LOCAL internal_12 # String "2" + LOCAL internal_13 # Store the result of the operation function_equal + LOCAL internal_14 # Integer 2 + LOCAL internal_15 + LOCAL internal_16 + LOCAL internal_17 # String "3" + LOCAL internal_18 # Store the result of the operation function_equal + LOCAL internal_19 # Integer 3 + LOCAL internal_20 + LOCAL internal_21 + LOCAL internal_22 # String "4" + LOCAL internal_23 # Store the result of the operation function_equal + LOCAL internal_24 # Integer 4 + LOCAL internal_25 + LOCAL internal_26 + LOCAL internal_27 # String "5" + LOCAL internal_28 # Store the result of the operation function_equal + LOCAL internal_29 # Integer 5 + LOCAL internal_30 + LOCAL internal_31 + LOCAL internal_32 # String "6" + LOCAL internal_33 # Store the result of the operation function_equal + LOCAL internal_34 # Integer 6 + LOCAL internal_35 + LOCAL internal_36 + LOCAL internal_37 # String "7" + LOCAL internal_38 # Store the result of the operation function_equal + LOCAL internal_39 # Integer 7 + LOCAL internal_40 + LOCAL internal_41 + LOCAL internal_42 # String "8" + LOCAL internal_43 # Store the result of the operation function_equal + LOCAL internal_44 # Integer 8 + LOCAL internal_45 + LOCAL internal_46 + LOCAL internal_47 # String "9" + LOCAL internal_48 # Store the result of the operation function_equal + LOCAL internal_49 # Integer 9 + LOCAL internal_50 + LOCAL internal_51 # Integer 0 + + # Conditional + internal_1 = ALLOCBOOL 0 + internal_2 = ALLOCSTR "0" + + ARG char + ARG internal_2 + internal_3 = CALL function_equal + internal_1 = internal_3 + IF internal_1 GOTO then_8792981816474 + GOTO else_8792981816474 + + then_8792981816474: + internal_4 = ALLOCINT 0 + internal_0 = internal_4 + GOTO endif_8792981816474 + + else_8792981816474: + # Conditional + internal_6 = ALLOCBOOL 0 + internal_7 = ALLOCSTR "1" + + ARG char + ARG internal_7 + internal_8 = CALL function_equal + internal_6 = internal_8 + IF internal_6 GOTO then_8792981816468 + GOTO else_8792981816468 + + then_8792981816468: + internal_9 = ALLOCINT 1 + internal_5 = internal_9 + GOTO endif_8792981816468 + + else_8792981816468: + # Conditional + internal_11 = ALLOCBOOL 0 + internal_12 = ALLOCSTR "2" + + ARG char + ARG internal_12 + internal_13 = CALL function_equal + internal_11 = internal_13 + IF internal_11 GOTO then_8792981816462 + GOTO else_8792981816462 + + then_8792981816462: + internal_14 = ALLOCINT 2 + internal_10 = internal_14 + GOTO endif_8792981816462 + + else_8792981816462: + # Conditional + internal_16 = ALLOCBOOL 0 + internal_17 = ALLOCSTR "3" + + ARG char + ARG internal_17 + internal_18 = CALL function_equal + internal_16 = internal_18 + IF internal_16 GOTO then_8792981816456 + GOTO else_8792981816456 + + then_8792981816456: + internal_19 = ALLOCINT 3 + internal_15 = internal_19 + GOTO endif_8792981816456 + + else_8792981816456: + # Conditional + internal_21 = ALLOCBOOL 0 + internal_22 = ALLOCSTR "4" + + ARG char + ARG internal_22 + internal_23 = CALL function_equal + internal_21 = internal_23 + IF internal_21 GOTO then_8792981816450 + GOTO else_8792981816450 + + then_8792981816450: + internal_24 = ALLOCINT 4 + internal_20 = internal_24 + GOTO endif_8792981816450 + + else_8792981816450: + # Conditional + internal_26 = ALLOCBOOL 0 + internal_27 = ALLOCSTR "5" + + ARG char + ARG internal_27 + internal_28 = CALL function_equal + internal_26 = internal_28 + IF internal_26 GOTO then_8792981816444 + GOTO else_8792981816444 + + then_8792981816444: + internal_29 = ALLOCINT 5 + internal_25 = internal_29 + GOTO endif_8792981816444 + + else_8792981816444: + # Conditional + internal_31 = ALLOCBOOL 0 + internal_32 = ALLOCSTR "6" + + ARG char + ARG internal_32 + internal_33 = CALL function_equal + internal_31 = internal_33 + IF internal_31 GOTO then_8792981816438 + GOTO else_8792981816438 + + then_8792981816438: + internal_34 = ALLOCINT 6 + internal_30 = internal_34 + GOTO endif_8792981816438 + + else_8792981816438: + # Conditional + internal_36 = ALLOCBOOL 0 + internal_37 = ALLOCSTR "7" + + ARG char + ARG internal_37 + internal_38 = CALL function_equal + internal_36 = internal_38 + IF internal_36 GOTO then_8792981816432 + GOTO else_8792981816432 + + then_8792981816432: + internal_39 = ALLOCINT 7 + internal_35 = internal_39 + GOTO endif_8792981816432 + + else_8792981816432: + # Conditional + internal_41 = ALLOCBOOL 0 + internal_42 = ALLOCSTR "8" + + ARG char + ARG internal_42 + internal_43 = CALL function_equal + internal_41 = internal_43 + IF internal_41 GOTO then_8792981816426 + GOTO else_8792981816426 + + then_8792981816426: + internal_44 = ALLOCINT 8 + internal_40 = internal_44 + GOTO endif_8792981816426 + + else_8792981816426: + # Conditional + internal_46 = ALLOCBOOL 0 + internal_47 = ALLOCSTR "9" + + ARG char + ARG internal_47 + internal_48 = CALL function_equal + internal_46 = internal_48 + IF internal_46 GOTO then_8792981816405 + GOTO else_8792981816405 + + then_8792981816405: + internal_49 = ALLOCINT 9 + internal_45 = internal_49 + GOTO endif_8792981816405 + + else_8792981816405: + ARG self + internal_50 = VCALL A2I function_abort_at_Object + internal_51 = ALLOCINT 0 + internal_45 = internal_51 + GOTO endif_8792981816405 + + endif_8792981816405: + internal_40 = internal_45 + GOTO endif_8792981816426 + + endif_8792981816426: + internal_35 = internal_40 + GOTO endif_8792981816432 + + endif_8792981816432: + internal_30 = internal_35 + GOTO endif_8792981816438 + + endif_8792981816438: + internal_25 = internal_30 + GOTO endif_8792981816444 + + endif_8792981816444: + internal_20 = internal_25 + GOTO endif_8792981816450 + + endif_8792981816450: + internal_15 = internal_20 + GOTO endif_8792981816456 + + endif_8792981816456: + internal_10 = internal_15 + GOTO endif_8792981816462 + + endif_8792981816462: + internal_5 = internal_10 + GOTO endif_8792981816468 + + endif_8792981816468: + internal_0 = internal_5 + GOTO endif_8792981816474 + + endif_8792981816474: + + RETURN internal_0 +} +function function_i2c_at_A2I{ + PARAM self + PARAM i + + LOCAL internal_0 + LOCAL internal_1 + LOCAL internal_2 # Integer 0 + LOCAL internal_3 # Store the result of the operation function_equal + LOCAL internal_4 # String "0" + LOCAL internal_5 + LOCAL internal_6 + LOCAL internal_7 # Integer 1 + LOCAL internal_8 # Store the result of the operation function_equal + LOCAL internal_9 # String "1" + LOCAL internal_10 + LOCAL internal_11 + LOCAL internal_12 # Integer 2 + LOCAL internal_13 # Store the result of the operation function_equal + LOCAL internal_14 # String "2" + LOCAL internal_15 + LOCAL internal_16 + LOCAL internal_17 # Integer 3 + LOCAL internal_18 # Store the result of the operation function_equal + LOCAL internal_19 # String "3" + LOCAL internal_20 + LOCAL internal_21 + LOCAL internal_22 # Integer 4 + LOCAL internal_23 # Store the result of the operation function_equal + LOCAL internal_24 # String "4" + LOCAL internal_25 + LOCAL internal_26 + LOCAL internal_27 # Integer 5 + LOCAL internal_28 # Store the result of the operation function_equal + LOCAL internal_29 # String "5" + LOCAL internal_30 + LOCAL internal_31 + LOCAL internal_32 # Integer 6 + LOCAL internal_33 # Store the result of the operation function_equal + LOCAL internal_34 # String "6" + LOCAL internal_35 + LOCAL internal_36 + LOCAL internal_37 # Integer 7 + LOCAL internal_38 # Store the result of the operation function_equal + LOCAL internal_39 # String "7" + LOCAL internal_40 + LOCAL internal_41 + LOCAL internal_42 # Integer 8 + LOCAL internal_43 # Store the result of the operation function_equal + LOCAL internal_44 # String "8" + LOCAL internal_45 + LOCAL internal_46 + LOCAL internal_47 # Integer 9 + LOCAL internal_48 # Store the result of the operation function_equal + LOCAL internal_49 # String "9" + LOCAL internal_50 + LOCAL internal_51 # String "" + + # Conditional + internal_1 = ALLOCBOOL 0 + internal_2 = ALLOCINT 0 + + ARG i + ARG internal_2 + internal_3 = CALL function_equal + internal_1 = internal_3 + IF internal_1 GOTO then_8792981817308 + GOTO else_8792981817308 + + then_8792981817308: + internal_4 = ALLOCSTR "0" + internal_0 = internal_4 + GOTO endif_8792981817308 + + else_8792981817308: + # Conditional + internal_6 = ALLOCBOOL 0 + internal_7 = ALLOCINT 1 + + ARG i + ARG internal_7 + internal_8 = CALL function_equal + internal_6 = internal_8 + IF internal_6 GOTO then_8792981817302 + GOTO else_8792981817302 + + then_8792981817302: + internal_9 = ALLOCSTR "1" + internal_5 = internal_9 + GOTO endif_8792981817302 + + else_8792981817302: + # Conditional + internal_11 = ALLOCBOOL 0 + internal_12 = ALLOCINT 2 + + ARG i + ARG internal_12 + internal_13 = CALL function_equal + internal_11 = internal_13 + IF internal_11 GOTO then_8792981817296 + GOTO else_8792981817296 + + then_8792981817296: + internal_14 = ALLOCSTR "2" + internal_10 = internal_14 + GOTO endif_8792981817296 + + else_8792981817296: + # Conditional + internal_16 = ALLOCBOOL 0 + internal_17 = ALLOCINT 3 + + ARG i + ARG internal_17 + internal_18 = CALL function_equal + internal_16 = internal_18 + IF internal_16 GOTO then_8792981817290 + GOTO else_8792981817290 + + then_8792981817290: + internal_19 = ALLOCSTR "3" + internal_15 = internal_19 + GOTO endif_8792981817290 + + else_8792981817290: + # Conditional + internal_21 = ALLOCBOOL 0 + internal_22 = ALLOCINT 4 + + ARG i + ARG internal_22 + internal_23 = CALL function_equal + internal_21 = internal_23 + IF internal_21 GOTO then_8792981817284 + GOTO else_8792981817284 + + then_8792981817284: + internal_24 = ALLOCSTR "4" + internal_20 = internal_24 + GOTO endif_8792981817284 + + else_8792981817284: + # Conditional + internal_26 = ALLOCBOOL 0 + internal_27 = ALLOCINT 5 + + ARG i + ARG internal_27 + internal_28 = CALL function_equal + internal_26 = internal_28 + IF internal_26 GOTO then_8792981817278 + GOTO else_8792981817278 + + then_8792981817278: + internal_29 = ALLOCSTR "5" + internal_25 = internal_29 + GOTO endif_8792981817278 + + else_8792981817278: + # Conditional + internal_31 = ALLOCBOOL 0 + internal_32 = ALLOCINT 6 + + ARG i + ARG internal_32 + internal_33 = CALL function_equal + internal_31 = internal_33 + IF internal_31 GOTO then_8792981817272 + GOTO else_8792981817272 + + then_8792981817272: + internal_34 = ALLOCSTR "6" + internal_30 = internal_34 + GOTO endif_8792981817272 + + else_8792981817272: + # Conditional + internal_36 = ALLOCBOOL 0 + internal_37 = ALLOCINT 7 + + ARG i + ARG internal_37 + internal_38 = CALL function_equal + internal_36 = internal_38 + IF internal_36 GOTO then_8792981817266 + GOTO else_8792981817266 + + then_8792981817266: + internal_39 = ALLOCSTR "7" + internal_35 = internal_39 + GOTO endif_8792981817266 + + else_8792981817266: + # Conditional + internal_41 = ALLOCBOOL 0 + internal_42 = ALLOCINT 8 + + ARG i + ARG internal_42 + internal_43 = CALL function_equal + internal_41 = internal_43 + IF internal_41 GOTO then_8792981817260 + GOTO else_8792981817260 + + then_8792981817260: + internal_44 = ALLOCSTR "8" + internal_40 = internal_44 + GOTO endif_8792981817260 + + else_8792981817260: + # Conditional + internal_46 = ALLOCBOOL 0 + internal_47 = ALLOCINT 9 + + ARG i + ARG internal_47 + internal_48 = CALL function_equal + internal_46 = internal_48 + IF internal_46 GOTO then_8792981817239 + GOTO else_8792981817239 + + then_8792981817239: + internal_49 = ALLOCSTR "9" + internal_45 = internal_49 + GOTO endif_8792981817239 + + else_8792981817239: + ARG self + internal_50 = VCALL A2I function_abort_at_Object + internal_51 = ALLOCSTR "" + internal_45 = internal_51 + GOTO endif_8792981817239 + + endif_8792981817239: + internal_40 = internal_45 + GOTO endif_8792981817260 + + endif_8792981817260: + internal_35 = internal_40 + GOTO endif_8792981817266 + + endif_8792981817266: + internal_30 = internal_35 + GOTO endif_8792981817272 + + endif_8792981817272: + internal_25 = internal_30 + GOTO endif_8792981817278 + + endif_8792981817278: + internal_20 = internal_25 + GOTO endif_8792981817284 + + endif_8792981817284: + internal_15 = internal_20 + GOTO endif_8792981817290 + + endif_8792981817290: + internal_10 = internal_15 + GOTO endif_8792981817296 + + endif_8792981817296: + internal_5 = internal_10 + GOTO endif_8792981817302 + + endif_8792981817302: + internal_0 = internal_5 + GOTO endif_8792981817308 + + endif_8792981817308: + + RETURN internal_0 +} +function function_a2i_at_A2I{ + PARAM self + PARAM s + + LOCAL internal_0 + LOCAL internal_1 + LOCAL internal_2 + LOCAL internal_3 # Integer 0 + LOCAL internal_4 # Store the result of the operation function_equal + LOCAL internal_5 # Integer 0 + LOCAL internal_6 + LOCAL internal_7 + LOCAL internal_8 # Integer 0 + LOCAL internal_9 # Integer 1 + LOCAL internal_10 + LOCAL internal_11 # String "-" + LOCAL internal_12 # Store the result of the operation function_equal + LOCAL internal_13 # Integer 1 + LOCAL internal_14 + LOCAL internal_15 # Integer 1 + LOCAL internal_16 # Store the result of the operation function_sub + LOCAL internal_17 + LOCAL internal_18 + LOCAL internal_19 # Integer 1 + LOCAL internal_20 # Integer 4294967295 + LOCAL internal_21 # Store the complement a2 of internal_18 + LOCAL internal_22 + LOCAL internal_23 + LOCAL internal_24 # Integer 0 + LOCAL internal_25 # Integer 1 + LOCAL internal_26 + LOCAL internal_27 # String "+" + LOCAL internal_28 # Store the result of the operation function_equal + LOCAL internal_29 # Integer 1 + LOCAL internal_30 + LOCAL internal_31 # Integer 1 + LOCAL internal_32 # Store the result of the operation function_sub + LOCAL internal_33 + LOCAL internal_34 + LOCAL internal_35 + + # Conditional + internal_1 = ALLOCBOOL 0 + ARG s + internal_2 = VCALL String function_length_at_String + internal_3 = ALLOCINT 0 + + ARG internal_2 + ARG internal_3 + internal_4 = CALL function_equal + internal_1 = internal_4 + IF internal_1 GOTO then_8792981817498 + GOTO else_8792981817498 + + then_8792981817498: + internal_5 = ALLOCINT 0 + internal_0 = internal_5 + GOTO endif_8792981817498 + + else_8792981817498: + # Conditional + internal_7 = ALLOCBOOL 0 + internal_8 = ALLOCINT 0 + internal_9 = ALLOCINT 1 + ARG s + ARG internal_8 + ARG internal_9 + internal_10 = VCALL String function_substr_at_String + internal_11 = ALLOCSTR "-" + + ARG internal_10 + ARG internal_11 + internal_12 = CALL function_equal + internal_7 = internal_12 + IF internal_7 GOTO then_8792981817513 + GOTO else_8792981817513 + + then_8792981817513: + internal_13 = ALLOCINT 1 + ARG s + internal_14 = VCALL String function_length_at_String + internal_15 = ALLOCINT 1 + + ARG internal_14 + ARG internal_15 + internal_16 = CALL function_sub + ARG s + ARG internal_13 + ARG internal_16 + internal_17 = VCALL String function_substr_at_String + ARG self + ARG internal_17 + internal_18 = VCALL A2I function_a2i_aux_at_A2I + internal_21 = XOR internal_18 internal_20 # Getting the complement a1 of internal_18 + internal_21 = internal_21 + internal_19 # Adding 1 to the complement a1 we get the complement a2 of internal_18 + internal_6 = internal_21 + GOTO endif_8792981817513 + + else_8792981817513: + # Conditional + internal_23 = ALLOCBOOL 0 + internal_24 = ALLOCINT 0 + internal_25 = ALLOCINT 1 + ARG s + ARG internal_24 + ARG internal_25 + internal_26 = VCALL String function_substr_at_String + internal_27 = ALLOCSTR "+" + + ARG internal_26 + ARG internal_27 + internal_28 = CALL function_equal + internal_23 = internal_28 + IF internal_23 GOTO then_8792981817507 + GOTO else_8792981817507 + + then_8792981817507: + internal_29 = ALLOCINT 1 + ARG s + internal_30 = VCALL String function_length_at_String + internal_31 = ALLOCINT 1 + + ARG internal_30 + ARG internal_31 + internal_32 = CALL function_sub + ARG s + ARG internal_29 + ARG internal_32 + internal_33 = VCALL String function_substr_at_String + ARG self + ARG internal_33 + internal_34 = VCALL A2I function_a2i_aux_at_A2I + internal_22 = internal_34 + GOTO endif_8792981817507 + + else_8792981817507: + ARG self + ARG s + internal_35 = VCALL A2I function_a2i_aux_at_A2I + internal_22 = internal_35 + GOTO endif_8792981817507 + + endif_8792981817507: + internal_6 = internal_22 + GOTO endif_8792981817513 + + endif_8792981817513: + internal_0 = internal_6 + GOTO endif_8792981817498 + + endif_8792981817498: + + RETURN internal_0 +} +function function_a2i_aux_at_A2I{ + PARAM self + PARAM s + + LOCAL int + LOCAL internal_1 # Integer 0 + LOCAL j + LOCAL internal_3 + LOCAL i + LOCAL internal_5 # Integer 0 + LOCAL internal_6 + LOCAL internal_7 # Store the result of the operation function_less_than + LOCAL internal_8 # Integer 10 + LOCAL internal_9 # Store the result of the operation function_mult + LOCAL internal_10 # Integer 1 + LOCAL internal_11 + LOCAL internal_12 + LOCAL internal_13 # Store the result of the operation function_add + LOCAL internal_14 # Integer 1 + LOCAL internal_15 # Store the result of the operation function_add + + internal_1 = ALLOCINT 0 + int = internal_1 + ARG s + internal_3 = VCALL String function_length_at_String + j = internal_3 + internal_5 = ALLOCINT 0 + i = internal_5 + while_start_8792981818167: + + ARG i + ARG j + internal_7 = CALL function_less_than + internal_6 = internal_7 + IF internal_6 GOTO while_body_8792981818167 + GOTO while_end_8792981818167 + + while_body_8792981818167: + internal_8 = ALLOCINT 10 + + ARG int + ARG internal_8 + internal_9 = CALL function_mult + internal_10 = ALLOCINT 1 + ARG s + ARG i + ARG internal_10 + internal_11 = VCALL String function_substr_at_String + ARG self + ARG internal_11 + internal_12 = VCALL A2I function_c2i_at_A2I + + ARG internal_9 + ARG internal_12 + internal_13 = CALL function_add + int = internal_13 + internal_14 = ALLOCINT 1 + + ARG i + ARG internal_14 + internal_15 = CALL function_add + i = internal_15 + GOTO while_start_8792981818167 + + while_end_8792981818167: + + RETURN int +} +function function_i2a_at_A2I{ + PARAM self + PARAM i + + LOCAL internal_0 + LOCAL internal_1 + LOCAL internal_2 # Integer 0 + LOCAL internal_3 # Store the result of the operation function_equal + LOCAL internal_4 # String "0" + LOCAL internal_5 + LOCAL internal_6 + LOCAL internal_7 # Integer 0 + LOCAL internal_8 # Store the result of the operation function_less_than + LOCAL internal_9 + LOCAL internal_10 # String "-" + LOCAL internal_11 # Integer 1 + LOCAL internal_12 # Integer 1 + LOCAL internal_13 # Integer 4294967295 + LOCAL internal_14 # Store the complement a2 of internal_11 + LOCAL internal_15 # Store the result of the operation function_mult + LOCAL internal_16 + LOCAL internal_17 + + # Conditional + internal_1 = ALLOCBOOL 0 + internal_2 = ALLOCINT 0 + + ARG i + ARG internal_2 + internal_3 = CALL function_equal + internal_1 = internal_3 + IF internal_1 GOTO then_8792981818296 + GOTO else_8792981818296 + + then_8792981818296: + internal_4 = ALLOCSTR "0" + internal_0 = internal_4 + GOTO endif_8792981818296 + + else_8792981818296: + # Conditional + internal_6 = ALLOCBOOL 0 + internal_7 = ALLOCINT 0 + + ARG internal_7 + ARG i + internal_8 = CALL function_less_than + internal_6 = internal_8 + IF internal_6 GOTO then_8792981818302 + GOTO else_8792981818302 + + then_8792981818302: + ARG self + ARG i + internal_9 = VCALL A2I function_i2a_aux_at_A2I + internal_5 = internal_9 + GOTO endif_8792981818302 + + else_8792981818302: + internal_10 = ALLOCSTR "-" + internal_11 = ALLOCINT 1 + internal_14 = XOR internal_11 internal_13 # Getting the complement a1 of internal_11 + internal_14 = internal_14 + internal_12 # Adding 1 to the complement a1 we get the complement a2 of internal_11 + + ARG i + ARG internal_14 + internal_15 = CALL function_mult + ARG self + ARG internal_15 + internal_16 = VCALL A2I function_i2a_aux_at_A2I + ARG internal_10 + ARG internal_16 + internal_17 = VCALL String function_concat_at_String + internal_5 = internal_17 + GOTO endif_8792981818302 + + endif_8792981818302: + internal_0 = internal_5 + GOTO endif_8792981818296 + + endif_8792981818296: + + RETURN internal_0 +} +function function_i2a_aux_at_A2I{ + PARAM self + PARAM i + + LOCAL internal_0 + LOCAL internal_1 + LOCAL internal_2 # Integer 0 + LOCAL internal_3 # Store the result of the operation function_equal + LOCAL internal_4 # String "" + LOCAL next + LOCAL internal_6 # Integer 10 + LOCAL internal_7 # Store the result of the operation function_div + LOCAL internal_8 + LOCAL internal_9 # Integer 10 + LOCAL internal_10 # Store the result of the operation function_mult + LOCAL internal_11 # Store the result of the operation function_sub + LOCAL internal_12 + LOCAL internal_13 + + # Conditional + internal_1 = ALLOCBOOL 0 + internal_2 = ALLOCINT 0 + + ARG i + ARG internal_2 + internal_3 = CALL function_equal + internal_1 = internal_3 + IF internal_1 GOTO then_8792981818670 + GOTO else_8792981818670 + + then_8792981818670: + internal_4 = ALLOCSTR "" + internal_0 = internal_4 + GOTO endif_8792981818670 + + else_8792981818670: + internal_6 = ALLOCINT 10 + + ARG i + ARG internal_6 + internal_7 = CALL function_div + next = internal_7 + ARG self + ARG next + internal_8 = VCALL A2I function_i2a_aux_at_A2I + internal_9 = ALLOCINT 10 + + ARG next + ARG internal_9 + internal_10 = CALL function_mult + + ARG i + ARG internal_10 + internal_11 = CALL function_sub + ARG self + ARG internal_11 + internal_12 = VCALL A2I function_i2c_at_A2I + ARG internal_8 + ARG internal_12 + internal_13 = VCALL String function_concat_at_String + internal_0 = internal_13 + GOTO endif_8792981818670 + + endif_8792981818670: + + RETURN internal_0 +} +function function___init___at_Main{ + PARAM self + + LOCAL internal_0 # String "" + LOCAL internal_1 # Boolean true + + internal_0 = ALLOCSTR "" + SETATTR self char internal_0 + SETATTR self avar NULL + SETATTR self a_var NULL + internal_1 = ALLOCBOOL 1 + SETATTR self flag internal_1 + + RETURN self +} +function function_menu_at_Main{ + PARAM self + + LOCAL internal_0 # String "\n\tTo add a number to " + LOCAL internal_1 + LOCAL internal_2 + LOCAL internal_3 + LOCAL internal_4 # String "...enter a:\n" + LOCAL internal_5 + LOCAL internal_6 # String "\tTo negate " + LOCAL internal_7 + LOCAL internal_8 + LOCAL internal_9 + LOCAL internal_10 # String "...enter b:\n" + LOCAL internal_11 + LOCAL internal_12 # String "\tTo find the difference between " + LOCAL internal_13 + LOCAL internal_14 + LOCAL internal_15 + LOCAL internal_16 # String "and another number...enter c:\n" + LOCAL internal_17 + LOCAL internal_18 # String "\tTo find the factorial of " + LOCAL internal_19 + LOCAL internal_20 + LOCAL internal_21 + LOCAL internal_22 # String "...enter d:\n" + LOCAL internal_23 + LOCAL internal_24 # String "\tTo square " + LOCAL internal_25 + LOCAL internal_26 + LOCAL internal_27 + LOCAL internal_28 # String "...enter e:\n" + LOCAL internal_29 + LOCAL internal_30 # String "\tTo cube " + LOCAL internal_31 + LOCAL internal_32 + LOCAL internal_33 + LOCAL internal_34 # String "...enter f:\n" + LOCAL internal_35 + LOCAL internal_36 # String "\tTo find out if " + LOCAL internal_37 + LOCAL internal_38 + LOCAL internal_39 + LOCAL internal_40 # String "is a multiple of 3...enter g:\n" + LOCAL internal_41 + LOCAL internal_42 # String "\tTo divide " + LOCAL internal_43 + LOCAL internal_44 + LOCAL internal_45 + LOCAL internal_46 # String "by 8...enter h:\n" + LOCAL internal_47 + LOCAL internal_48 # String "\tTo get a new number...enter j:\n" + LOCAL internal_49 + LOCAL internal_50 # String "\tTo quit...enter q:\n\n" + LOCAL internal_51 + LOCAL internal_52 + + internal_0 = ALLOCSTR "\n\tTo add a number to " + ARG self + ARG internal_0 + internal_1 = VCALL Main function_out_string_at_IO + internal_2 = GETATTR self avar + ARG self + ARG internal_2 + internal_3 = VCALL Main function_print_at_Main + internal_4 = ALLOCSTR "...enter a:\n" + ARG self + ARG internal_4 + internal_5 = VCALL Main function_out_string_at_IO + internal_6 = ALLOCSTR "\tTo negate " + ARG self + ARG internal_6 + internal_7 = VCALL Main function_out_string_at_IO + internal_8 = GETATTR self avar + ARG self + ARG internal_8 + internal_9 = VCALL Main function_print_at_Main + internal_10 = ALLOCSTR "...enter b:\n" + ARG self + ARG internal_10 + internal_11 = VCALL Main function_out_string_at_IO + internal_12 = ALLOCSTR "\tTo find the difference between " + ARG self + ARG internal_12 + internal_13 = VCALL Main function_out_string_at_IO + internal_14 = GETATTR self avar + ARG self + ARG internal_14 + internal_15 = VCALL Main function_print_at_Main + internal_16 = ALLOCSTR "and another number...enter c:\n" + ARG self + ARG internal_16 + internal_17 = VCALL Main function_out_string_at_IO + internal_18 = ALLOCSTR "\tTo find the factorial of " + ARG self + ARG internal_18 + internal_19 = VCALL Main function_out_string_at_IO + internal_20 = GETATTR self avar + ARG self + ARG internal_20 + internal_21 = VCALL Main function_print_at_Main + internal_22 = ALLOCSTR "...enter d:\n" + ARG self + ARG internal_22 + internal_23 = VCALL Main function_out_string_at_IO + internal_24 = ALLOCSTR "\tTo square " + ARG self + ARG internal_24 + internal_25 = VCALL Main function_out_string_at_IO + internal_26 = GETATTR self avar + ARG self + ARG internal_26 + internal_27 = VCALL Main function_print_at_Main + internal_28 = ALLOCSTR "...enter e:\n" + ARG self + ARG internal_28 + internal_29 = VCALL Main function_out_string_at_IO + internal_30 = ALLOCSTR "\tTo cube " + ARG self + ARG internal_30 + internal_31 = VCALL Main function_out_string_at_IO + internal_32 = GETATTR self avar + ARG self + ARG internal_32 + internal_33 = VCALL Main function_print_at_Main + internal_34 = ALLOCSTR "...enter f:\n" + ARG self + ARG internal_34 + internal_35 = VCALL Main function_out_string_at_IO + internal_36 = ALLOCSTR "\tTo find out if " + ARG self + ARG internal_36 + internal_37 = VCALL Main function_out_string_at_IO + internal_38 = GETATTR self avar + ARG self + ARG internal_38 + internal_39 = VCALL Main function_print_at_Main + internal_40 = ALLOCSTR "is a multiple of 3...enter g:\n" + ARG self + ARG internal_40 + internal_41 = VCALL Main function_out_string_at_IO + internal_42 = ALLOCSTR "\tTo divide " + ARG self + ARG internal_42 + internal_43 = VCALL Main function_out_string_at_IO + internal_44 = GETATTR self avar + ARG self + ARG internal_44 + internal_45 = VCALL Main function_print_at_Main + internal_46 = ALLOCSTR "by 8...enter h:\n" + ARG self + ARG internal_46 + internal_47 = VCALL Main function_out_string_at_IO + internal_48 = ALLOCSTR "\tTo get a new number...enter j:\n" + ARG self + ARG internal_48 + internal_49 = VCALL Main function_out_string_at_IO + internal_50 = ALLOCSTR "\tTo quit...enter q:\n\n" + ARG self + ARG internal_50 + internal_51 = VCALL Main function_out_string_at_IO + ARG self + internal_52 = VCALL Main function_in_string_at_IO + + RETURN internal_52 +} +function function_prompt_at_Main{ + PARAM self + + LOCAL internal_0 # String "\n" + LOCAL internal_1 + LOCAL internal_2 # String "Please enter a number... " + LOCAL internal_3 + LOCAL internal_4 + + internal_0 = ALLOCSTR "\n" + ARG self + ARG internal_0 + internal_1 = VCALL Main function_out_string_at_IO + internal_2 = ALLOCSTR "Please enter a number... " + ARG self + ARG internal_2 + internal_3 = VCALL Main function_out_string_at_IO + ARG self + internal_4 = VCALL Main function_in_string_at_IO + + RETURN internal_4 +} +function function_get_int_at_Main{ + PARAM self + + LOCAL z + LOCAL internal_1 # Store an instance of the class A2I + LOCAL s + LOCAL internal_3 + LOCAL internal_4 + + internal_1 = ALLOCATE A2I # Allocate the object A2I + ARG internal_1 # Pass the instance to the constructor + internal_1 = VCALL A2I function___init___at_A2I # Call the constructor + z = internal_1 + ARG self + internal_3 = VCALL Main function_prompt_at_Main + s = internal_3 + ARG z + ARG s + internal_4 = VCALL A2I function_a2i_at_A2I + + RETURN internal_4 +} +function function_is_even_at_Main{ + PARAM self + PARAM num + + LOCAL x + LOCAL internal_1 + LOCAL internal_2 + LOCAL internal_3 # Integer 0 + LOCAL internal_4 # Store the result of the operation function_less_than + LOCAL internal_5 # Integer 1 + LOCAL internal_6 # Integer 4294967295 + LOCAL internal_7 # Store the complement a2 of x + LOCAL internal_8 + LOCAL internal_9 + LOCAL internal_10 + LOCAL internal_11 # Integer 0 + LOCAL internal_12 # Store the result of the operation function_equal + LOCAL internal_13 # Boolean true + LOCAL internal_14 + LOCAL internal_15 + LOCAL internal_16 # Integer 1 + LOCAL internal_17 # Store the result of the operation function_equal + LOCAL internal_18 # Boolean false + LOCAL internal_19 # Integer 2 + LOCAL internal_20 # Store the result of the operation function_sub + LOCAL internal_21 + + x = num + # Conditional + internal_2 = ALLOCBOOL 0 + internal_3 = ALLOCINT 0 + + ARG x + ARG internal_3 + internal_4 = CALL function_less_than + internal_2 = internal_4 + IF internal_2 GOTO then_8792981820167 + GOTO else_8792981820167 + + then_8792981820167: + internal_7 = XOR x internal_6 # Getting the complement a1 of x + internal_7 = internal_7 + internal_5 # Adding 1 to the complement a1 we get the complement a2 of x + ARG self + ARG internal_7 + internal_8 = VCALL Main function_is_even_at_Main + internal_1 = internal_8 + GOTO endif_8792981820167 + + else_8792981820167: + # Conditional + internal_10 = ALLOCBOOL 0 + internal_11 = ALLOCINT 0 + + ARG internal_11 + ARG x + internal_12 = CALL function_equal + internal_10 = internal_12 + IF internal_10 GOTO then_8792981820170 + GOTO else_8792981820170 + + then_8792981820170: + internal_13 = ALLOCBOOL 1 + internal_9 = internal_13 + GOTO endif_8792981820170 + + else_8792981820170: + # Conditional + internal_15 = ALLOCBOOL 0 + internal_16 = ALLOCINT 1 + + ARG internal_16 + ARG x + internal_17 = CALL function_equal + internal_15 = internal_17 + IF internal_15 GOTO then_8792981820176 + GOTO else_8792981820176 + + then_8792981820176: + internal_18 = ALLOCBOOL 0 + internal_14 = internal_18 + GOTO endif_8792981820176 + + else_8792981820176: + internal_19 = ALLOCINT 2 + + ARG x + ARG internal_19 + internal_20 = CALL function_sub + ARG self + ARG internal_20 + internal_21 = VCALL Main function_is_even_at_Main + internal_14 = internal_21 + GOTO endif_8792981820176 + + endif_8792981820176: + internal_9 = internal_14 + GOTO endif_8792981820170 + + endif_8792981820170: + internal_1 = internal_9 + GOTO endif_8792981820167 + + endif_8792981820167: + + RETURN internal_1 +} +function function_class_type_at_Main{ + PARAM self + PARAM var + + LOCAL internal_0 # Count of ancestors of the switch expression + LOCAL internal_1 # Switch expression type + LOCAL internal_2 # Ancestor type + LOCAL internal_3 # Step 1 comparison result + LOCAL internal_4 # Step 1 Array of ancestors + LOCAL internal_5 # Integer 0 + LOCAL internal_6 # Null pointer + LOCAL internal_7 # Step 2 iteration index + LOCAL internal_8 # Step 2 comparison result + LOCAL internal_9 # Array to store the branch types + LOCAL internal_10 # Array to store the nearest ancestor index of the expression type of the i-th branch type + LOCAL internal_11 # Address of the type A + LOCAL internal_12 # Address of the type B + LOCAL internal_13 # Address of the type C + LOCAL internal_14 # Address of the type D + LOCAL internal_15 # Address of the type E + LOCAL internal_16 # Address of the type Object + LOCAL internal_17 # Step 3 - Iteration index of the branch types array + LOCAL internal_18 # Step 3 - Comparison for the index of the branch types array + LOCAL internal_19 # Step 3 - Type of the i-th branch + LOCAL internal_20 # Step 3 - Index of the ancestor + LOCAL internal_21 # Step 3 - Comparison for the index of the ancestor + LOCAL internal_22 # Step 3 - Type of the j-th ancestor + LOCAL internal_23 # Step 3 - Comparison for the branch type nad the ancestor type + LOCAL internal_24 # Step 4 - Iteration index + LOCAL internal_25 # Step 4 - Index of the minimum counter in the counter array + LOCAL internal_26 # Step 4 - Temporary variable + LOCAL internal_27 # Step 4 - Current minimum of the counter array + LOCAL internal_28 # Step 4 - Comparison for the minimum of the counter array + LOCAL internal_29 # Step 5 - Bool array + LOCAL internal_30 # Step 5 - Exists an error + LOCAL internal_31 # Step 5 - Comparison for the correct branch result + LOCAL internal_32 # Result of the switch expression address + LOCAL a # Specialiced variable for the branch A + LOCAL internal_34 # String "Class type is now A\n" + LOCAL internal_35 + LOCAL b # Specialiced variable for the branch B + LOCAL internal_37 # String "Class type is now B\n" + LOCAL internal_38 + LOCAL c # Specialiced variable for the branch C + LOCAL internal_40 # String "Class type is now C\n" + LOCAL internal_41 + LOCAL d # Specialiced variable for the branch D + LOCAL internal_43 # String "Class type is now D\n" + LOCAL internal_44 + LOCAL e # Specialiced variable for the branch E + LOCAL internal_46 # String "Class type is now E\n" + LOCAL internal_47 + LOCAL o # Specialiced variable for the branch Object + LOCAL internal_49 # String "Oooops\n" + LOCAL internal_50 + + # Switch Case Algorithm Steps: + # 1 - Count how many ancestors has the dynamic type of the expression + # 2 - Create an array of the same size where to store the ancestors + # 3 - For each branch type, store the ancestor index that match with it, if no one match, store `count of ancestors` + # 4 - Find the minimum of the ancestors indexes + # 5 - With the minimum index, get the correct branch type + internal_5 = ALLOCINT 0 + internal_3 = ALLOCBOOL 0 # Initialize the comparison result + + # ######################################################################## # + # Step 1 - Count how many ancestors has the dynamic type of the expression # + # ######################################################################## # + internal_1 = TYPEOF var # Get the switch expression type + internal_2 = internal_1 # The first ancestor will be the type itself + internal_0 = internal_5 # Initialize the counter + while_start_8792981820269: + internal_3 = internal_2 == 0 + IF internal_3 GOTO while_end_8792981820269 + internal_0 = internal_0 + 1 # Increment the counter + internal_2 = ANCESTOR internal_2 + GOTO while_start_8792981820269 + while_end_8792981820269: + + # ###################################################################### # + # Step 2 - Create an array of the same size where to store the ancestors # + # ###################################################################### # + internal_2 = internal_1 # The first ancestor will be the type itself + internal_4 = ARRAY internal_0 # Create an array of ancestors + internal_7 = 0 # Initialize the index with the value 0 + foreach_start_8792981820269: + internal_8 = internal_7 < internal_0 # Check if the index is less than the counter + IF internal_8 GOTO foreach_body_8792981820269 + GOTO foreach_end_8792981820269 + foreach_body_8792981820269: + SETINDEX internal_4 internal_7 internal_2 # Set the index of the array with the ancestor type + internal_2 = ANCESTOR internal_2 # Get the next ancestor + internal_7 = internal_7 + 1 # Increment index + GOTO foreach_start_8792981820269 + foreach_end_8792981820269: + + # #################################################################################################### # + # Step 3 - For each branch type, store the ancestor index that match with it (Simulating a double for) # + # #################################################################################################### # + internal_9 = ARRAY 6 + internal_10 = ARRAY 6 + internal_11 = TYPEADDR A + SETINDEX internal_9 0 internal_11 + SETINDEX internal_10 0 internal_0 + internal_12 = TYPEADDR B + SETINDEX internal_9 1 internal_12 + SETINDEX internal_10 1 internal_0 + internal_13 = TYPEADDR C + SETINDEX internal_9 2 internal_13 + SETINDEX internal_10 2 internal_0 + internal_14 = TYPEADDR D + SETINDEX internal_9 3 internal_14 + SETINDEX internal_10 3 internal_0 + internal_15 = TYPEADDR E + SETINDEX internal_9 4 internal_15 + SETINDEX internal_10 4 internal_0 + internal_16 = TYPEADDR Object + SETINDEX internal_9 5 internal_16 + SETINDEX internal_10 5 internal_0 + + # ############# # + # Outer Foreach # + # ############# # + internal_17 = 0 # Initialize the index i of the case to 0 + foreach_type_start_8792981820269: + internal_18 = internal_17 < 6 # Check if the type index is less than the count of branches + IF internal_18 GOTO foreach_type_body_8792981820269 + GOTO foreach_type_end_8792981820269 + foreach_type_body_8792981820269: + internal_19 = GETINDEX internal_9 internal_17 # Get the type of the i-th branch + + # ############# # + # Inner Foreach # + # ############# # + internal_20 = 0 # Initialize the index j of the case to 0 + foreach_ancestor_start_8792981820269: + internal_21 = internal_20 < internal_0 # Check if the case index is less than the count of ancestors + IF internal_21 GOTO foreach_ancestor_body_8792981820269 + GOTO foreach_ancestor_end_8792981820269 + foreach_ancestor_body_8792981820269: + internal_22 = GETINDEX internal_4 internal_20 # Get the j-th ancestor type + internal_23 = internal_19 == internal_22 # Compare if the type of the i-th branch is equal to the j-th ancestor + IF internal_23 GOTO foreach_ancestor_end_8792981820269 # If the types are equal, we have a match, then we can exit + internal_20 = internal_20 + 1 # Increment the ancestor index + GOTO foreach_ancestor_start_8792981820269 + foreach_ancestor_end_8792981820269: + SETINDEX internal_10 internal_17 internal_20 # Set the counter of the i-th branch equals to j + # #################### # + # End of Inner Foreach # + # #################### # + + internal_17 = internal_17 + 1 # Increment type index + GOTO foreach_type_start_8792981820269 + foreach_type_end_8792981820269: + # ################# # + # End Outer Foreach # + # ################# # + + # ######################################## # + # Step 4 - Find the minimum ancestor index # + # ######################################## # + internal_24 = 0 # Initialize the index of the counter array to 0 + internal_25 = 0 # Initialize the index of the lower counter to 0 + internal_27 = internal_0 # Initialize the current minimum to `count of ancestors` + foreach_min_start_8792981820269: + internal_28 = internal_24 < 6 # Check if the index of the lower counter is less than the count of branches + IF internal_28 GOTO foreach_min_body_8792981820269 + GOTO foreach_min_end_8792981820269 + foreach_min_body_8792981820269: + internal_26 = GETINDEX internal_10 internal_24 # Get the nearest ancestor index of the i-th branch type + internal_28 = internal_26 < internal_27 # Compare if the nearest ancestor index is less than the current minimum + IF internal_28 GOTO update_min_8792981820269 + GOTO foreach_min_end_8792981820269 + update_min_8792981820269: + internal_27 = internal_26 # Update the current minimum + internal_25 = internal_24 # Update the index of the lower counter + update_min_end_8792981820269: + internal_24 = internal_24 + 1 # Increment the index of the counter array + GOTO foreach_min_start_8792981820269 + foreach_min_end_8792981820269: + + # ################################################################# # + # Step 5 - Using the minimun ancestor index find the correct branch # + # ################################################################# # + internal_29 = ARRAY 6 # Create the bool array + SETINDEX internal_29 0 0 # Initialize the bool array + SETINDEX internal_29 1 0 # Initialize the bool array + SETINDEX internal_29 2 0 # Initialize the bool array + SETINDEX internal_29 3 0 # Initialize the bool array + SETINDEX internal_29 4 0 # Initialize the bool array + SETINDEX internal_29 5 0 # Initialize the bool array + + internal_30 = internal_25 == internal_0 # Check if the minimum index is equal to the count of ancestors + IF internal_30 GOTO error_branch_8792981820269 + SETINDEX internal_29 internal_25 1 # Set the bool array in the correct index to 1 + + internal_31 = GETINDEX internal_29 0 # Get the bool value of the branch A + IF internal_31 GOTO branch_A_8792981820269 # If the bool value is 1, then we have a match + + internal_31 = GETINDEX internal_29 1 # Get the bool value of the branch B + IF internal_31 GOTO branch_B_8792981820269 # If the bool value is 1, then we have a match + + internal_31 = GETINDEX internal_29 2 # Get the bool value of the branch C + IF internal_31 GOTO branch_C_8792981820269 # If the bool value is 1, then we have a match + + internal_31 = GETINDEX internal_29 3 # Get the bool value of the branch D + IF internal_31 GOTO branch_D_8792981820269 # If the bool value is 1, then we have a match + + internal_31 = GETINDEX internal_29 4 # Get the bool value of the branch E + IF internal_31 GOTO branch_E_8792981820269 # If the bool value is 1, then we have a match + + internal_31 = GETINDEX internal_29 5 # Get the bool value of the branch Object + IF internal_31 GOTO branch_Object_8792981820269 # If the bool value is 1, then we have a match + + branch_A_8792981820269: + internal_34 = ALLOCSTR "Class type is now A\n" + ARG self + ARG internal_34 + internal_35 = VCALL Main function_out_string_at_IO + internal_32 = internal_35 # Assign the result + GOTO branch_end_8792981820269 + + branch_B_8792981820269: + internal_37 = ALLOCSTR "Class type is now B\n" + ARG self + ARG internal_37 + internal_38 = VCALL Main function_out_string_at_IO + internal_32 = internal_38 # Assign the result + GOTO branch_end_8792981820269 + + branch_C_8792981820269: + internal_40 = ALLOCSTR "Class type is now C\n" + ARG self + ARG internal_40 + internal_41 = VCALL Main function_out_string_at_IO + internal_32 = internal_41 # Assign the result + GOTO branch_end_8792981820269 + + branch_D_8792981820269: + internal_43 = ALLOCSTR "Class type is now D\n" + ARG self + ARG internal_43 + internal_44 = VCALL Main function_out_string_at_IO + internal_32 = internal_44 # Assign the result + GOTO branch_end_8792981820269 + + branch_E_8792981820269: + internal_46 = ALLOCSTR "Class type is now E\n" + ARG self + ARG internal_46 + internal_47 = VCALL Main function_out_string_at_IO + internal_32 = internal_47 # Assign the result + GOTO branch_end_8792981820269 + + branch_Object_8792981820269: + internal_49 = ALLOCSTR "Oooops\n" + ARG self + ARG internal_49 + internal_50 = VCALL Main function_out_string_at_IO + internal_32 = internal_50 # Assign the result + GOTO branch_end_8792981820269 + + error_branch_8792981820269: + # Insert an error call + branch_end_8792981820269: + + RETURN internal_32 +} +function function_print_at_Main{ + PARAM self + PARAM var + + LOCAL z + LOCAL internal_1 # Store an instance of the class A2I + LOCAL internal_2 + LOCAL internal_3 + LOCAL internal_4 + LOCAL internal_5 # String " " + LOCAL internal_6 + + internal_1 = ALLOCATE A2I # Allocate the object A2I + ARG internal_1 # Pass the instance to the constructor + internal_1 = VCALL A2I function___init___at_A2I # Call the constructor + z = internal_1 + ARG var + internal_2 = VCALL A function_value_at_A + ARG z + ARG internal_2 + internal_3 = VCALL A2I function_i2a_at_A2I + ARG self + ARG internal_3 + internal_4 = VCALL Main function_out_string_at_IO + internal_5 = ALLOCSTR " " + ARG self + ARG internal_5 + internal_6 = VCALL Main function_out_string_at_IO + + RETURN internal_6 +} +function function_main_at_Main{ + PARAM self + + LOCAL internal_0 # Store an instance of the class A + LOCAL internal_1 + LOCAL internal_2 + LOCAL internal_3 # String "number " + LOCAL internal_4 + LOCAL internal_5 + LOCAL internal_6 + LOCAL internal_7 + LOCAL internal_8 + LOCAL internal_9 + LOCAL internal_10 + LOCAL internal_11 + LOCAL internal_12 # String "is even!\n" + LOCAL internal_13 + LOCAL internal_14 # String "is odd!\n" + LOCAL internal_15 + LOCAL internal_16 + LOCAL internal_17 + LOCAL internal_18 + LOCAL internal_19 + LOCAL internal_20 + LOCAL internal_21 + LOCAL internal_22 # String "a" + LOCAL internal_23 # Store the result of the operation function_equal + LOCAL internal_24 # Store an instance of the class A + LOCAL internal_25 + LOCAL internal_26 + LOCAL internal_27 # Store an instance of the class B + LOCAL internal_28 + LOCAL internal_29 + LOCAL internal_30 + LOCAL internal_31 + LOCAL internal_32 + LOCAL internal_33 + LOCAL internal_34 + LOCAL internal_35 + LOCAL internal_36 # String "b" + LOCAL internal_37 # Store the result of the operation function_equal + LOCAL internal_38 + LOCAL internal_39 # Count of ancestors of the switch expression + LOCAL internal_40 # Switch expression type + LOCAL internal_41 # Ancestor type + LOCAL internal_42 # Step 1 comparison result + LOCAL internal_43 # Step 1 Array of ancestors + LOCAL internal_44 # Integer 0 + LOCAL internal_45 # Null pointer + LOCAL internal_46 # Step 2 iteration index + LOCAL internal_47 # Step 2 comparison result + LOCAL internal_48 # Array to store the branch types + LOCAL internal_49 # Array to store the nearest ancestor index of the expression type of the i-th branch type + LOCAL internal_50 # Address of the type C + LOCAL internal_51 # Address of the type A + LOCAL internal_52 # Address of the type Object + LOCAL internal_53 # Step 3 - Iteration index of the branch types array + LOCAL internal_54 # Step 3 - Comparison for the index of the branch types array + LOCAL internal_55 # Step 3 - Type of the i-th branch + LOCAL internal_56 # Step 3 - Index of the ancestor + LOCAL internal_57 # Step 3 - Comparison for the index of the ancestor + LOCAL internal_58 # Step 3 - Type of the j-th ancestor + LOCAL internal_59 # Step 3 - Comparison for the branch type nad the ancestor type + LOCAL internal_60 # Step 4 - Iteration index + LOCAL internal_61 # Step 4 - Index of the minimum counter in the counter array + LOCAL internal_62 # Step 4 - Temporary variable + LOCAL internal_63 # Step 4 - Current minimum of the counter array + LOCAL internal_64 # Step 4 - Comparison for the minimum of the counter array + LOCAL internal_65 # Step 5 - Bool array + LOCAL internal_66 # Step 5 - Exists an error + LOCAL internal_67 # Step 5 - Comparison for the correct branch result + LOCAL internal_68 # Result of the switch expression address + LOCAL c # Specialiced variable for the branch C + LOCAL internal_70 + LOCAL internal_71 + LOCAL a # Specialiced variable for the branch A + LOCAL internal_73 + LOCAL internal_74 + LOCAL o # Specialiced variable for the branch Object + LOCAL internal_76 # String "Oooops\n" + LOCAL internal_77 + LOCAL internal_78 + LOCAL internal_79 # Integer 0 + LOCAL internal_80 + LOCAL internal_81 + LOCAL internal_82 + LOCAL internal_83 # String "c" + LOCAL internal_84 # Store the result of the operation function_equal + LOCAL internal_85 # Store an instance of the class A + LOCAL internal_86 + LOCAL internal_87 + LOCAL internal_88 # Store an instance of the class D + LOCAL internal_89 + LOCAL internal_90 + LOCAL internal_91 + LOCAL internal_92 + LOCAL internal_93 + LOCAL internal_94 + LOCAL internal_95 + LOCAL internal_96 + LOCAL internal_97 # String "d" + LOCAL internal_98 # Store the result of the operation function_equal + LOCAL internal_99 # Store an instance of the class C + LOCAL internal_100 + LOCAL internal_101 + LOCAL internal_102 + LOCAL internal_103 + LOCAL internal_104 + LOCAL internal_105 + LOCAL internal_106 # String "e" + LOCAL internal_107 # Store the result of the operation function_equal + LOCAL internal_108 # Store an instance of the class C + LOCAL internal_109 + LOCAL internal_110 + LOCAL internal_111 + LOCAL internal_112 + LOCAL internal_113 + LOCAL internal_114 + LOCAL internal_115 # String "f" + LOCAL internal_116 # Store the result of the operation function_equal + LOCAL internal_117 # Store an instance of the class C + LOCAL internal_118 + LOCAL internal_119 + LOCAL internal_120 + LOCAL internal_121 + LOCAL internal_122 + LOCAL internal_123 + LOCAL internal_124 # String "g" + LOCAL internal_125 # Store the result of the operation function_equal + LOCAL internal_126 + LOCAL internal_127 + LOCAL internal_128 # Store an instance of the class D + LOCAL internal_129 + LOCAL internal_130 + LOCAL internal_131 + LOCAL internal_132 # String "number " + LOCAL internal_133 + LOCAL internal_134 + LOCAL internal_135 + LOCAL internal_136 # String "is divisible by 3.\n" + LOCAL internal_137 + LOCAL internal_138 # String "number " + LOCAL internal_139 + LOCAL internal_140 + LOCAL internal_141 + LOCAL internal_142 # String "is not divisible by 3.\n" + LOCAL internal_143 + LOCAL internal_144 + LOCAL internal_145 + LOCAL internal_146 + LOCAL internal_147 # String "h" + LOCAL internal_148 # Store the result of the operation function_equal + LOCAL x + LOCAL internal_150 # Store an instance of the class E + LOCAL internal_151 + LOCAL internal_152 + LOCAL internal_153 + LOCAL r + LOCAL internal_155 + LOCAL internal_156 + LOCAL internal_157 + LOCAL internal_158 # Integer 8 + LOCAL internal_159 # Store the result of the operation function_mult + LOCAL internal_160 # Store the result of the operation function_sub + LOCAL internal_161 # String "number " + LOCAL internal_162 + LOCAL internal_163 + LOCAL internal_164 + LOCAL internal_165 # String "is equal to " + LOCAL internal_166 + LOCAL internal_167 + LOCAL internal_168 # String "times 8 with a remainder of " + LOCAL internal_169 + LOCAL a + LOCAL internal_171 # Store an instance of the class A2I + LOCAL internal_172 + LOCAL internal_173 + LOCAL internal_174 # String "\n" + LOCAL internal_175 + LOCAL internal_176 + LOCAL internal_177 + LOCAL internal_178 + LOCAL internal_179 # String "j" + LOCAL internal_180 # Store the result of the operation function_equal + LOCAL internal_181 # Store an instance of the class A + LOCAL internal_182 + LOCAL internal_183 + LOCAL internal_184 + LOCAL internal_185 # String "q" + LOCAL internal_186 # Store the result of the operation function_equal + LOCAL internal_187 # Boolean false + LOCAL internal_188 # Store an instance of the class A + LOCAL internal_189 + LOCAL internal_190 + LOCAL internal_191 + + internal_0 = ALLOCATE A # Allocate the object A + ARG internal_0 # Pass the instance to the constructor + internal_0 = VCALL A function___init___at_A # Call the constructor + SETATTR self avar internal_0 + while_start_8792981790296: + internal_2 = GETATTR self flag + internal_1 = internal_2 + IF internal_1 GOTO while_body_8792981790296 + GOTO while_end_8792981790296 + + while_body_8792981790296: + internal_3 = ALLOCSTR "number " + ARG self + ARG internal_3 + internal_4 = VCALL Main function_out_string_at_IO + internal_5 = GETATTR self avar + ARG self + ARG internal_5 + internal_6 = VCALL Main function_print_at_Main + # Conditional + internal_8 = ALLOCBOOL 0 + internal_9 = GETATTR self avar + ARG internal_9 + internal_10 = VCALL A function_value_at_A + ARG self + ARG internal_10 + internal_11 = VCALL Main function_is_even_at_Main + internal_8 = internal_11 + IF internal_8 GOTO then_8792981820386 + GOTO else_8792981820386 + + then_8792981820386: + internal_12 = ALLOCSTR "is even!\n" + ARG self + ARG internal_12 + internal_13 = VCALL Main function_out_string_at_IO + internal_7 = internal_13 + GOTO endif_8792981820386 + + else_8792981820386: + internal_14 = ALLOCSTR "is odd!\n" + ARG self + ARG internal_14 + internal_15 = VCALL Main function_out_string_at_IO + internal_7 = internal_15 + GOTO endif_8792981820386 + + endif_8792981820386: + internal_16 = GETATTR self avar + ARG self + ARG internal_16 + internal_17 = VCALL Main function_class_type_at_Main + ARG self + internal_18 = VCALL Main function_menu_at_Main + SETATTR self char internal_18 + # Conditional + internal_20 = ALLOCBOOL 0 + internal_21 = GETATTR self char + internal_22 = ALLOCSTR "a" + + ARG internal_21 + ARG internal_22 + internal_23 = CALL function_equal + internal_20 = internal_23 + IF internal_20 GOTO then_8792981790281 + GOTO else_8792981790281 + + then_8792981790281: + internal_24 = ALLOCATE A # Allocate the object A + ARG internal_24 # Pass the instance to the constructor + internal_24 = VCALL A function___init___at_A # Call the constructor + ARG self + internal_25 = VCALL Main function_get_int_at_Main + ARG internal_24 + ARG internal_25 + internal_26 = VCALL A function_set_var_at_A + SETATTR self a_var internal_26 + internal_27 = ALLOCATE B # Allocate the object B + ARG internal_27 # Pass the instance to the constructor + internal_27 = VCALL B function___init___at_B # Call the constructor + internal_28 = GETATTR self avar + ARG internal_28 + internal_29 = VCALL A function_value_at_A + internal_30 = GETATTR self a_var + ARG internal_30 + internal_31 = VCALL A function_value_at_A + ARG internal_27 + ARG internal_29 + ARG internal_31 + internal_32 = VCALL B function_method2_at_A + SETATTR self avar internal_32 + internal_19 = internal_32 + GOTO endif_8792981790281 + + else_8792981790281: + # Conditional + internal_34 = ALLOCBOOL 0 + internal_35 = GETATTR self char + internal_36 = ALLOCSTR "b" + + ARG internal_35 + ARG internal_36 + internal_37 = CALL function_equal + internal_34 = internal_37 + IF internal_34 GOTO then_8792981790275 + GOTO else_8792981790275 + + then_8792981790275: + internal_38 = GETATTR self avar + # Switch Case Algorithm Steps: + # 1 - Count how many ancestors has the dynamic type of the expression + # 2 - Create an array of the same size where to store the ancestors + # 3 - For each branch type, store the ancestor index that match with it, if no one match, store `count of ancestors` + # 4 - Find the minimum of the ancestors indexes + # 5 - With the minimum index, get the correct branch type + internal_44 = ALLOCINT 0 + internal_42 = ALLOCBOOL 0 # Initialize the comparison result + + # ######################################################################## # + # Step 1 - Count how many ancestors has the dynamic type of the expression # + # ######################################################################## # + internal_40 = TYPEOF internal_38 # Get the switch expression type + internal_41 = internal_40 # The first ancestor will be the type itself + internal_39 = internal_44 # Initialize the counter + while_start_8792981788591: + internal_42 = internal_41 == 0 + IF internal_42 GOTO while_end_8792981788591 + internal_39 = internal_39 + 1 # Increment the counter + internal_41 = ANCESTOR internal_41 + GOTO while_start_8792981788591 + while_end_8792981788591: + + # ###################################################################### # + # Step 2 - Create an array of the same size where to store the ancestors # + # ###################################################################### # + internal_41 = internal_40 # The first ancestor will be the type itself + internal_43 = ARRAY internal_39 # Create an array of ancestors + internal_46 = 0 # Initialize the index with the value 0 + foreach_start_8792981788591: + internal_47 = internal_46 < internal_39 # Check if the index is less than the counter + IF internal_47 GOTO foreach_body_8792981788591 + GOTO foreach_end_8792981788591 + foreach_body_8792981788591: + SETINDEX internal_43 internal_46 internal_41 # Set the index of the array with the ancestor type + internal_41 = ANCESTOR internal_41 # Get the next ancestor + internal_46 = internal_46 + 1 # Increment index + GOTO foreach_start_8792981788591 + foreach_end_8792981788591: + + # #################################################################################################### # + # Step 3 - For each branch type, store the ancestor index that match with it (Simulating a double for) # + # #################################################################################################### # + internal_48 = ARRAY 3 + internal_49 = ARRAY 3 + internal_50 = TYPEADDR C + SETINDEX internal_48 0 internal_50 + SETINDEX internal_49 0 internal_39 + internal_51 = TYPEADDR A + SETINDEX internal_48 1 internal_51 + SETINDEX internal_49 1 internal_39 + internal_52 = TYPEADDR Object + SETINDEX internal_48 2 internal_52 + SETINDEX internal_49 2 internal_39 + + # ############# # + # Outer Foreach # + # ############# # + internal_53 = 0 # Initialize the index i of the case to 0 + foreach_type_start_8792981788591: + internal_54 = internal_53 < 3 # Check if the type index is less than the count of branches + IF internal_54 GOTO foreach_type_body_8792981788591 + GOTO foreach_type_end_8792981788591 + foreach_type_body_8792981788591: + internal_55 = GETINDEX internal_48 internal_53 # Get the type of the i-th branch + + # ############# # + # Inner Foreach # + # ############# # + internal_56 = 0 # Initialize the index j of the case to 0 + foreach_ancestor_start_8792981788591: + internal_57 = internal_56 < internal_39 # Check if the case index is less than the count of ancestors + IF internal_57 GOTO foreach_ancestor_body_8792981788591 + GOTO foreach_ancestor_end_8792981788591 + foreach_ancestor_body_8792981788591: + internal_58 = GETINDEX internal_43 internal_56 # Get the j-th ancestor type + internal_59 = internal_55 == internal_58 # Compare if the type of the i-th branch is equal to the j-th ancestor + IF internal_59 GOTO foreach_ancestor_end_8792981788591 # If the types are equal, we have a match, then we can exit + internal_56 = internal_56 + 1 # Increment the ancestor index + GOTO foreach_ancestor_start_8792981788591 + foreach_ancestor_end_8792981788591: + SETINDEX internal_49 internal_53 internal_56 # Set the counter of the i-th branch equals to j + # #################### # + # End of Inner Foreach # + # #################### # + + internal_53 = internal_53 + 1 # Increment type index + GOTO foreach_type_start_8792981788591 + foreach_type_end_8792981788591: + # ################# # + # End Outer Foreach # + # ################# # + + # ######################################## # + # Step 4 - Find the minimum ancestor index # + # ######################################## # + internal_60 = 0 # Initialize the index of the counter array to 0 + internal_61 = 0 # Initialize the index of the lower counter to 0 + internal_63 = internal_39 # Initialize the current minimum to `count of ancestors` + foreach_min_start_8792981788591: + internal_64 = internal_60 < 3 # Check if the index of the lower counter is less than the count of branches + IF internal_64 GOTO foreach_min_body_8792981788591 + GOTO foreach_min_end_8792981788591 + foreach_min_body_8792981788591: + internal_62 = GETINDEX internal_49 internal_60 # Get the nearest ancestor index of the i-th branch type + internal_64 = internal_62 < internal_63 # Compare if the nearest ancestor index is less than the current minimum + IF internal_64 GOTO update_min_8792981788591 + GOTO foreach_min_end_8792981788591 + update_min_8792981788591: + internal_63 = internal_62 # Update the current minimum + internal_61 = internal_60 # Update the index of the lower counter + update_min_end_8792981788591: + internal_60 = internal_60 + 1 # Increment the index of the counter array + GOTO foreach_min_start_8792981788591 + foreach_min_end_8792981788591: + + # ################################################################# # + # Step 5 - Using the minimun ancestor index find the correct branch # + # ################################################################# # + internal_65 = ARRAY 3 # Create the bool array + SETINDEX internal_65 0 0 # Initialize the bool array + SETINDEX internal_65 1 0 # Initialize the bool array + SETINDEX internal_65 2 0 # Initialize the bool array + + internal_66 = internal_61 == internal_39 # Check if the minimum index is equal to the count of ancestors + IF internal_66 GOTO error_branch_8792981788591 + SETINDEX internal_65 internal_61 1 # Set the bool array in the correct index to 1 + + internal_67 = GETINDEX internal_65 0 # Get the bool value of the branch C + IF internal_67 GOTO branch_C_8792981788591 # If the bool value is 1, then we have a match + + internal_67 = GETINDEX internal_65 1 # Get the bool value of the branch A + IF internal_67 GOTO branch_A_8792981788591 # If the bool value is 1, then we have a match + + internal_67 = GETINDEX internal_65 2 # Get the bool value of the branch Object + IF internal_67 GOTO branch_Object_8792981788591 # If the bool value is 1, then we have a match + + branch_C_8792981788591: + ARG c + internal_70 = VCALL C function_value_at_A + ARG c + ARG internal_70 + internal_71 = VCALL C function_method6_at_C + SETATTR self avar internal_71 + internal_68 = internal_71 # Assign the result + GOTO branch_end_8792981788591 + + branch_A_8792981788591: + ARG a + internal_73 = VCALL A function_value_at_A + ARG a + ARG internal_73 + internal_74 = VCALL A function_method3_at_A + SETATTR self avar internal_74 + internal_68 = internal_74 # Assign the result + GOTO branch_end_8792981788591 + + branch_Object_8792981788591: + internal_76 = ALLOCSTR "Oooops\n" + ARG self + ARG internal_76 + internal_77 = VCALL Main function_out_string_at_IO + ARG self + internal_78 = VCALL Main function_abort_at_Object + internal_79 = ALLOCINT 0 + internal_68 = internal_79 # Assign the result + GOTO branch_end_8792981788591 + + error_branch_8792981788591: + # Insert an error call + branch_end_8792981788591: + internal_33 = internal_68 + GOTO endif_8792981790275 + + else_8792981790275: + # Conditional + internal_81 = ALLOCBOOL 0 + internal_82 = GETATTR self char + internal_83 = ALLOCSTR "c" + + ARG internal_82 + ARG internal_83 + internal_84 = CALL function_equal + internal_81 = internal_84 + IF internal_81 GOTO then_8792981790269 + GOTO else_8792981790269 + + then_8792981790269: + internal_85 = ALLOCATE A # Allocate the object A + ARG internal_85 # Pass the instance to the constructor + internal_85 = VCALL A function___init___at_A # Call the constructor + ARG self + internal_86 = VCALL Main function_get_int_at_Main + ARG internal_85 + ARG internal_86 + internal_87 = VCALL A function_set_var_at_A + SETATTR self a_var internal_87 + internal_88 = ALLOCATE D # Allocate the object D + ARG internal_88 # Pass the instance to the constructor + internal_88 = VCALL D function___init___at_D # Call the constructor + internal_89 = GETATTR self avar + ARG internal_89 + internal_90 = VCALL A function_value_at_A + internal_91 = GETATTR self a_var + ARG internal_91 + internal_92 = VCALL A function_value_at_A + ARG internal_88 + ARG internal_90 + ARG internal_92 + internal_93 = VCALL D function_method4_at_A + SETATTR self avar internal_93 + internal_80 = internal_93 + GOTO endif_8792981790269 + + else_8792981790269: + # Conditional + internal_95 = ALLOCBOOL 0 + internal_96 = GETATTR self char + internal_97 = ALLOCSTR "d" + + ARG internal_96 + ARG internal_97 + internal_98 = CALL function_equal + internal_95 = internal_98 + IF internal_95 GOTO then_8792981790263 + GOTO else_8792981790263 + + then_8792981790263: + internal_99 = ALLOCATE C # Allocate the object C + ARG internal_99 # Pass the instance to the constructor + internal_99 = VCALL C function___init___at_C # Call the constructor + internal_100 = GETATTR self avar + ARG internal_100 + internal_101 = VCALL A function_value_at_A + ARG internal_99 + ARG internal_101 + internal_102 = VCALL C function_method5_at_C + SETATTR self avar internal_102 + internal_94 = internal_102 + GOTO endif_8792981790263 + + else_8792981790263: + # Conditional + internal_104 = ALLOCBOOL 0 + internal_105 = GETATTR self char + internal_106 = ALLOCSTR "e" + + ARG internal_105 + ARG internal_106 + internal_107 = CALL function_equal + internal_104 = internal_107 + IF internal_104 GOTO then_8792981790257 + GOTO else_8792981790257 + + then_8792981790257: + internal_108 = ALLOCATE C # Allocate the object C + ARG internal_108 # Pass the instance to the constructor + internal_108 = VCALL C function___init___at_C # Call the constructor + internal_109 = GETATTR self avar + ARG internal_109 + internal_110 = VCALL A function_value_at_A + ARG internal_108 + ARG internal_110 + internal_111 = VCALL C function_method5_at_C + SETATTR self avar internal_111 + internal_103 = internal_111 + GOTO endif_8792981790257 + + else_8792981790257: + # Conditional + internal_113 = ALLOCBOOL 0 + internal_114 = GETATTR self char + internal_115 = ALLOCSTR "f" + + ARG internal_114 + ARG internal_115 + internal_116 = CALL function_equal + internal_113 = internal_116 + IF internal_113 GOTO then_8792981790251 + GOTO else_8792981790251 + + then_8792981790251: + internal_117 = ALLOCATE C # Allocate the object C + ARG internal_117 # Pass the instance to the constructor + internal_117 = VCALL C function___init___at_C # Call the constructor + internal_118 = GETATTR self avar + ARG internal_118 + internal_119 = VCALL A function_value_at_A + ARG internal_117 + ARG internal_119 + internal_120 = VCALL C function_method5_at_C + SETATTR self avar internal_120 + internal_112 = internal_120 + GOTO endif_8792981790251 + + else_8792981790251: + # Conditional + internal_122 = ALLOCBOOL 0 + internal_123 = GETATTR self char + internal_124 = ALLOCSTR "g" + + ARG internal_123 + ARG internal_124 + internal_125 = CALL function_equal + internal_122 = internal_125 + IF internal_122 GOTO then_8792981790245 + GOTO else_8792981790245 + + then_8792981790245: + # Conditional + internal_127 = ALLOCBOOL 0 + internal_128 = ALLOCATE D # Allocate the object D + ARG internal_128 # Pass the instance to the constructor + internal_128 = VCALL D function___init___at_D # Call the constructor + internal_129 = GETATTR self avar + ARG internal_129 + internal_130 = VCALL A function_value_at_A + ARG internal_128 + ARG internal_130 + internal_131 = VCALL D function_method7_at_D + internal_127 = internal_131 + IF internal_127 GOTO then_8792981789148 + GOTO else_8792981789148 + + then_8792981789148: + internal_132 = ALLOCSTR "number " + ARG self + ARG internal_132 + internal_133 = VCALL Main function_out_string_at_IO + internal_134 = GETATTR self avar + ARG self + ARG internal_134 + internal_135 = VCALL Main function_print_at_Main + internal_136 = ALLOCSTR "is divisible by 3.\n" + ARG self + ARG internal_136 + internal_137 = VCALL Main function_out_string_at_IO + internal_126 = internal_137 + GOTO endif_8792981789148 + + else_8792981789148: + internal_138 = ALLOCSTR "number " + ARG self + ARG internal_138 + internal_139 = VCALL Main function_out_string_at_IO + internal_140 = GETATTR self avar + ARG self + ARG internal_140 + internal_141 = VCALL Main function_print_at_Main + internal_142 = ALLOCSTR "is not divisible by 3.\n" + ARG self + ARG internal_142 + internal_143 = VCALL Main function_out_string_at_IO + internal_126 = internal_143 + GOTO endif_8792981789148 + + endif_8792981789148: + internal_121 = internal_126 + GOTO endif_8792981790245 + + else_8792981790245: + # Conditional + internal_145 = ALLOCBOOL 0 + internal_146 = GETATTR self char + internal_147 = ALLOCSTR "h" + + ARG internal_146 + ARG internal_147 + internal_148 = CALL function_equal + internal_145 = internal_148 + IF internal_145 GOTO then_8792981790239 + GOTO else_8792981790239 + + then_8792981790239: + x = NULL + internal_150 = ALLOCATE E # Allocate the object E + ARG internal_150 # Pass the instance to the constructor + internal_150 = VCALL E function___init___at_E # Call the constructor + internal_151 = GETATTR self avar + ARG internal_151 + internal_152 = VCALL A function_value_at_A + ARG internal_150 + ARG internal_152 + internal_153 = VCALL E function_method6_at_E + x = internal_153 + internal_155 = GETATTR self avar + ARG internal_155 + internal_156 = VCALL A function_value_at_A + ARG x + internal_157 = VCALL A function_value_at_A + internal_158 = ALLOCINT 8 + + ARG internal_157 + ARG internal_158 + internal_159 = CALL function_mult + + ARG internal_156 + ARG internal_159 + internal_160 = CALL function_sub + r = internal_160 + internal_161 = ALLOCSTR "number " + ARG self + ARG internal_161 + internal_162 = VCALL Main function_out_string_at_IO + internal_163 = GETATTR self avar + ARG self + ARG internal_163 + internal_164 = VCALL Main function_print_at_Main + internal_165 = ALLOCSTR "is equal to " + ARG self + ARG internal_165 + internal_166 = VCALL Main function_out_string_at_IO + ARG self + ARG x + internal_167 = VCALL Main function_print_at_Main + internal_168 = ALLOCSTR "times 8 with a remainder of " + ARG self + ARG internal_168 + internal_169 = VCALL Main function_out_string_at_IO + internal_171 = ALLOCATE A2I # Allocate the object A2I + ARG internal_171 # Pass the instance to the constructor + internal_171 = VCALL A2I function___init___at_A2I # Call the constructor + a = internal_171 + ARG a + ARG r + internal_172 = VCALL A2I function_i2a_at_A2I + ARG self + ARG internal_172 + internal_173 = VCALL Main function_out_string_at_IO + internal_174 = ALLOCSTR "\n" + ARG self + ARG internal_174 + internal_175 = VCALL Main function_out_string_at_IO + SETATTR self avar x + internal_144 = x + GOTO endif_8792981790239 + + else_8792981790239: + # Conditional + internal_177 = ALLOCBOOL 0 + internal_178 = GETATTR self char + internal_179 = ALLOCSTR "j" + + ARG internal_178 + ARG internal_179 + internal_180 = CALL function_equal + internal_177 = internal_180 + IF internal_177 GOTO then_8792981790233 + GOTO else_8792981790233 + + then_8792981790233: + internal_181 = ALLOCATE A # Allocate the object A + ARG internal_181 # Pass the instance to the constructor + internal_181 = VCALL A function___init___at_A # Call the constructor + SETATTR self avar internal_181 + internal_176 = internal_181 + GOTO endif_8792981790233 + + else_8792981790233: + # Conditional + internal_183 = ALLOCBOOL 0 + internal_184 = GETATTR self char + internal_185 = ALLOCSTR "q" + + ARG internal_184 + ARG internal_185 + internal_186 = CALL function_equal + internal_183 = internal_186 + IF internal_183 GOTO then_8792981789693 + GOTO else_8792981789693 + + then_8792981789693: + internal_187 = ALLOCBOOL 0 + SETATTR self flag internal_187 + internal_182 = internal_187 + GOTO endif_8792981789693 + + else_8792981789693: + internal_188 = ALLOCATE A # Allocate the object A + ARG internal_188 # Pass the instance to the constructor + internal_188 = VCALL A function___init___at_A # Call the constructor + internal_189 = GETATTR self avar + ARG internal_189 + internal_190 = VCALL A function_value_at_A + ARG internal_188 + ARG internal_190 + internal_191 = VCALL A function_method1_at_A + SETATTR self avar internal_191 + internal_182 = internal_191 + GOTO endif_8792981789693 + + endif_8792981789693: + internal_176 = internal_182 + GOTO endif_8792981790233 + + endif_8792981790233: + internal_144 = internal_176 + GOTO endif_8792981790239 + + endif_8792981790239: + internal_121 = internal_144 + GOTO endif_8792981790245 + + endif_8792981790245: + internal_112 = internal_121 + GOTO endif_8792981790251 + + endif_8792981790251: + internal_103 = internal_112 + GOTO endif_8792981790257 + + endif_8792981790257: + internal_94 = internal_103 + GOTO endif_8792981790263 + + endif_8792981790263: + internal_80 = internal_94 + GOTO endif_8792981790269 + + endif_8792981790269: + internal_33 = internal_80 + GOTO endif_8792981790275 + + endif_8792981790275: + internal_19 = internal_33 + GOTO endif_8792981790281 + + endif_8792981790281: + GOTO while_start_8792981790296 + + while_end_8792981790296: + + RETURN 0 +} +function main{ + + + LOCAL internal_0 + LOCAL internal_1 + + internal_0 = ALLOCATE Main + ARG internal_0 + internal_0 = VCALL Main function___init___at_Main + + ARG internal_0 + internal_1 = VCALL Main function_main_at_Main + + HALT +} \ No newline at end of file diff --git a/src/arith.cl b/src/arith.cl new file mode 100755 index 000000000..462068516 --- /dev/null +++ b/src/arith.cl @@ -0,0 +1,473 @@ +(* + * 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/src/cool/code_generation/ast_cil.py b/src/cool/code_generation/ast_cil.py index 7070e52ff..663b575b5 100644 --- a/src/cool/code_generation/ast_cil.py +++ b/src/cool/code_generation/ast_cil.py @@ -56,8 +56,9 @@ def __init__(self, name: str): class LocalNode(Node): - def __init__(self, name: str): + def __init__(self, name: str, type: str = "Object"): self.name: str = name + self.type: str = type class InstructionNode(Node): @@ -102,6 +103,7 @@ class LessThanNode(ArithmeticNode): class EqualNode(ArithmeticNode): + equality_type: str = "Object" pass @@ -144,6 +146,18 @@ def __init__(self, itype: str, dest: str): self.dest: str = dest +class AllocateIntNode(InstructionNode): + def __init__(self, dest: str, value: str): + self.dest: str = dest + self.value: str = value + + +class AllocateBoolNode(InstructionNode): + def __init__(self, dest: str, value: str): + self.dest: str = dest + self.value: str = value + + class ArrayNode(InstructionNode): def __init__(self, dest: str, size: int) -> None: self.dest: str = dest @@ -166,12 +180,32 @@ def __init__(self, dest: str, source: str): self.dest: str = dest -class TypeDirectionNode(InstructionNode): +class TypeAddressNode(InstructionNode): def __init__(self, dest: str, name: str): self.name: str = name self.dest: str = dest +class EqualAddressNode(InstructionNode): + def __init__(self, dest: str, left: str, right: str): + self.left: str = left + self.right: str = right + self.dest: str = dest + + +class EqualIntNode(InstructionNode): + def __init__(self, dest: str, left: str, right: str): + self.left: str = left + self.right: str = right + self.dest: str = dest + + +class EqualStrNode(InstructionNode): + def __init__(self, dest: str, left: str, right: str): + self.left: str = left + self.right: str = right + self.dest: str = dest + class LabelNode(InstructionNode): def __init__(self, label: str): self.label: str = label @@ -189,9 +223,10 @@ def __init__(self, condition: str, address: str): class StaticCallNode(InstructionNode): - def __init__(self, function, dest): - self.function = function - self.dest = dest + def __init__(self, function: str, dest: str, total_args: int): + self.function: str = function + self.dest: str = dest + self.total_args: str = total_args class DynamicCallNode(InstructionNode): diff --git a/src/cool/code_generation/ast_ecool.py b/src/cool/code_generation/ast_ecool.py index 6a89cfb0a..7ac09a799 100644 --- a/src/cool/code_generation/ast_ecool.py +++ b/src/cool/code_generation/ast_ecool.py @@ -24,4 +24,4 @@ def __str__(self): class NullNode(cool.AtomicNode): def __init__(self): - super().__init__("null") + super().__init__("NULL") diff --git a/src/cool/code_generation/formatters.py b/src/cool/code_generation/formatters.py index 686d0b073..cae38531e 100644 --- a/src/cool/code_generation/formatters.py +++ b/src/cool/code_generation/formatters.py @@ -152,12 +152,12 @@ def visit(self, node: cil.TypeOfNode): else f"{node.dest} = TYPEOF {node.source} # {node.comment}" ) - @visitor.when(cil.TypeDirectionNode) - def visit(self, node: cil.TypeDirectionNode): + @visitor.when(cil.TypeAddressNode) + def visit(self, node: cil.TypeAddressNode): return ( - f"{node.dest} = TYPEDIR {node.name}" + f"{node.dest} = TYPEADDR {node.name}" if node.comment == "" - else f"{node.dest} = TYPEDIR {node.name} # {node.comment}" + else f"{node.dest} = TYPEADDR {node.name} # {node.comment}" ) @visitor.when(cil.AncestorNode) @@ -168,6 +168,30 @@ def visit(self, node: cil.AncestorNode): else f"{node.dest} = ANCESTOR {node.source} # {node.comment}" ) + @visitor.when(cil.EqualAddressNode) + def visit(self, node: cil.EqualAddressNode): + return ( + f"{node.dest} = EQUALADDR {node.left} {node.right}" + if node.comment == "" + else f"{node.dest} = EQUALADDR {node.left} {node.right} # {node.comment}" + ) + + @visitor.when(cil.EqualIntNode) + def visit(self, node: cil.EqualIntNode): + return ( + f"{node.dest} = EQUALINT {node.left} {node.right}" + if node.comment == "" + else f"{node.dest} = EQUALINT {node.left} {node.right} # {node.comment}" + ) + + @visitor.when(cil.EqualStrNode) + def visit(self, node: cil.EqualStrNode): + return ( + f"{node.dest} = EQUALSTR {node.left} {node.right}" + if node.comment == "" + else f"{node.dest} = EQUALSTR {node.left} {node.right} # {node.comment}" + ) + @visitor.when(cil.StaticCallNode) def visit(self, node: cil.StaticCallNode): return ( @@ -343,6 +367,14 @@ def visit(self, node: cil.SubstringNode): @visitor.when(cil.AllocateStrNode) def visit(self, node: cil.AllocateStrNode): return (f"{node.dest} = ALLOCSTR {node.value}") if node.comment == "" else f"{node.dest} = ALLOCSTR {node.value} # {node.comment}" + + @visitor.when(cil.AllocateIntNode) + def visit(self, node: cil.AllocateIntNode): + return (f"{node.dest} = ALLOCINT {node.value}") if node.comment == "" else f"{node.dest} = ALLOCINT {node.value} # {node.comment}" + + @visitor.when(cil.AllocateBoolNode) + def visit(self, node: cil.AllocateBoolNode): + return (f"{node.dest} = ALLOCBOOL {node.value}") if node.comment == "" else f"{node.dest} = ALLOCBOOL {node.value} # {node.comment}" @visitor.when(cil.CommentNode) def visit(self, node: cil.CommentNode): diff --git a/src/cool/code_generation/translator_cil_to_mips.py b/src/cool/code_generation/translator_cil_to_mips.py index 5bb94df9e..3916a85e3 100644 --- a/src/cool/code_generation/translator_cil_to_mips.py +++ b/src/cool/code_generation/translator_cil_to_mips.py @@ -77,6 +77,7 @@ def visit(self, node: cil.ProgramNode): self.visit(type_node) self.register_space("buffer_input", 1024) + self.register_ascii("debug_log", "\"debug_log\\n\"") for function_node in node.dotcode: self.visit(function_node) @@ -140,12 +141,29 @@ def visit(self, node: cil.FunctionNode): @visitor.when(cil.AssignNode) def visit(self, node: cil.AssignNode): + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.source)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t1", "0($t0)")) + self.register_instruction(mips.LoadAddressNode("$t2", "type_Main")) + self.register_instruction(mips.LoadAddressNode("$t3", "type_Bool")) + self.register_instruction(mips.BeqNode("$t1", "$t2", "is_Bool_or_Int")) + self.register_instruction(mips.BeqNode("$t1", "$t3", "is_Bool_or_Int")) + self.register_instruction(mips.JumpNode("not_is_Bool_or_Int")) + self.register_instruction(mips.LabelNode("is_Bool_or_Int")) + self.register_instruction(mips.LoadWordNode("$t4", "8($t0)")) + self.register_instruction(mips.LoadWordNode("$t5", f"{self.offset_of(node.dest)}($sp)")) + + self.register_instruction(mips.JumpNode("end_assign")) + + self.register_instruction(mips.LabelNode("not_is_Bool_or_Int")) self.register_comment(f"{node.dest} = {node.source}") if node.source.isdigit(): self.register_instruction(mips.AddiNode("$t0", "$zero", node.source)) + elif node.source == "NULL": + self.register_instruction(mips.AddiNode("$t0", "$zero", "0")) else: - self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.source)}(sp)")) - self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}(sp)")) + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.source)}($sp)")) + self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)")) + self.register_instruction(mips.LabelNode("end_assign")) @visitor.when(cil.ArgNode) def visit(self, node: cil.ArgNode): @@ -156,15 +174,24 @@ def visit(self, node: cil.ArgNode): self.register_empty_instruction() self.register_comment(f"Argument {node.name}") self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.name) + 4 * node.total_args + 4}($sp)")) - self.register_instruction(mips.StoreWordNode("$t1", f"{4 * (node.total_args - node.arg_index - 1)}($sp)").set_comment(f"Storing {node.name}")) + self.register_instruction(mips.StoreWordNode("$t0", f"{4 * (node.total_args - node.arg_index - 1)}($sp)").set_comment(f"Storing {node.name}")) @visitor.when(cil.DynamicCallNode) def visit(self, node: cil.DynamicCallNode): self.register_comment(f"Calling function {node.method}") self.register_instruction(mips.JumpAndLinkNode(node.method)) + self.register_instruction(mips.LoadWordNode("$ra", f"{4 * node.total_args}($sp)")) self.register_instruction(mips.StoreWordNode("$v1", f"{self.offset_of(node.dest) + 4 * node.total_args + 4}($sp)").set_comment(f"{node.dest} = result of {node.method}")) self.register_instruction(mips.AddiNode("$sp", "$sp", f"{4 * node.total_args + 4}").set_comment("Freeing space for arguments")) + @visitor.when(cil.StaticCallNode) + def visit(self, node: cil.StaticCallNode): + self.register_comment(f"Calling function {node.function}") + self.register_instruction(mips.JumpAndLinkNode(node.function)) + self.register_instruction(mips.LoadWordNode("$ra", f"{4 * node.total_args}($sp)")) + self.register_instruction(mips.StoreWordNode("$v1", f"{self.offset_of(node.dest) + 4 * node.total_args + 4}($sp)").set_comment(f"{node.dest} = result of {node.function}")) + self.register_instruction(mips.AddiNode("$sp", "$sp", f"{4 * node.total_args + 4}").set_comment("Freeing space for arguments")) + @visitor.when(cil.AllocateNode) def visit(self, node: cil.AllocateNode): self.register_comment(f"Allocating {node.type}") @@ -176,6 +203,58 @@ def visit(self, node: cil.AllocateNode): self.register_instruction(mips.StoreWordNode("$a0", "4($v0)").set_comment("Setting size in the second word of th object")) self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = address of allocated object {node.type}")) + @visitor.when(cil.AllocateIntNode) + def visit(self, node: cil.AllocateIntNode): + self.register_comment(f"Allocating {node.value}") + + self.register_instruction(mips.LoadInmediateNode("$v0", "9")) + self.register_instruction(mips.AddiNode("$a0", "$zero", "12")) + self.register_instruction(mips.SystemCallNode()) + + self.register_instruction(mips.LoadAddressNode("$t0", "type_Int").set_comment("$t0 = address of the type")) + self.register_instruction(mips.StoreWordNode("$t0", "0($v0)").set_comment("Setting type in the first word of th object")) + + self.register_instruction(mips.StoreWordNode("$a0", "4($v0)").set_comment("Setting size in the second word of th object")) + + self.register_instruction(mips.AddiNode("$t0", "$zero", node.value)) + self.register_instruction(mips.StoreWordNode("$t0", "8($v0)").set_comment("Setting value in the third word of th object")) + + self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = address of allocated object Int")) + + @visitor.when(cil.AllocateIntNode) + def visit(self, node: cil.AllocateIntNode): + self.register_comment(f"Allocating Int {node.value}") + + self.register_instruction(mips.LoadInmediateNode("$v0", "9")) + self.register_instruction(mips.AddiNode("$a0", "$zero", "12")) + self.register_instruction(mips.SystemCallNode()) + self.register_empty_instruction() + + self.register_instruction(mips.LoadAddressNode("$t0", "type_Int").set_comment("$t0 = address of the type")) + self.register_instruction(mips.StoreWordNode("$t0", "0($v0)").set_comment("Setting type in the first word of the object")) + self.register_instruction(mips.StoreWordNode("$a0", "4($v0)").set_comment("Setting size in the second word of the object")) + self.register_instruction(mips.AddiNode("$t0", "$zero", node.value)) + self.register_instruction(mips.StoreWordNode("$t0", "8($v0)").set_comment("Setting value in the third word of the object")) + + self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = address of allocated object Int")) + + @visitor.when(cil.AllocateBoolNode) + def visit(self, node: cil.AllocateBoolNode): + self.register_comment(f"Allocating Bool {node.value}") + + self.register_instruction(mips.LoadInmediateNode("$v0", "9")) + self.register_instruction(mips.AddiNode("$a0", "$zero", "12")) + self.register_instruction(mips.SystemCallNode()) + self.register_empty_instruction() + + self.register_instruction(mips.LoadAddressNode("$t0", "type_Bool").set_comment("$t0 = address of the type")) + self.register_instruction(mips.StoreWordNode("$t0", "0($v0)").set_comment("Setting type in the first word of the object")) + self.register_instruction(mips.StoreWordNode("$a0", "4($v0)").set_comment("Setting size in the second word of the object")) + self.register_instruction(mips.AddiNode("$t0", "$zero", node.value)) + self.register_instruction(mips.StoreWordNode("$t0", "8($v0)").set_comment("Setting value in the third word of the object")) + + self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = address of allocated object Int")) + @visitor.when(cil.AllocateStrNode) def visit(self, node: cil.AllocateStrNode): self.register_comment(f"Allocating String") @@ -198,10 +277,10 @@ def visit(self, node: cil.AllocateStrNode): ec = ec.replace('\b', '\\b') ec = ec.replace('\f', '\\f') self.register_instruction(mips.AddiNode("$t0", "$zero", f"{ord(c)}")) - self.register_instruction(mips.StoreByteNode("$t1", f"{i + 8}($v0)").set_comment(f"{node.dest}[{i}] = '{ec}'")) + self.register_instruction(mips.StoreByteNode("$t0", f"{i + 8}($v0)").set_comment(f"{node.dest}[{i}] = '{ec}'")) self.register_empty_instruction() - self.register_instruction(mips.StoreByteNode("$zero", f"{i + 9}($v0)").set_comment(f"Null-terminator at the end of the string")) + self.register_instruction(mips.StoreByteNode("$zero", f"{node.length + 8}($v0)").set_comment(f"Null-terminator at the end of the string")) self.register_empty_instruction() self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = {node.value}")) @@ -276,7 +355,7 @@ def visit(self, node: cil.SubstringNode): self.register_instruction(mips.LoadWordNode("$t1", f"4($t0)").set_comment("$t1 = length of the string")) self.register_instruction(mips.LoadWordNode("$t2", f"{self.offset_of(node.start)}($sp)").set_comment("$t2 = start of the substring")) self.register_instruction(mips.LoadWordNode("$t3", f"{self.offset_of(node.length)}($sp)").set_comment("$t3 = length of the substring")) - self.register_instruction(mips.AddNode("t4", "$t2", "$t3").set_comment("$t4 = start of the substring + length of the substring")) + self.register_instruction(mips.AddNode("$t4", "$t2", "$t3").set_comment("$t4 = start of the substring + length of the substring")) self.register_empty_instruction() self.register_instruction(mips.BgeNode("$t4", "$t1", "substring_out_of_bounds")) @@ -341,6 +420,8 @@ def visit(self, node: cil.SetAttributeNode): if node.source.isdigit(): self.register_instruction(mips.AddiNode("$t1", "$zero", node.source).set_comment(f"$t1 {node.source}")) self.register_instruction(mips.StoreWordNode("$t1", f"{4 * (node.attr_index + 2)}($t0)").set_comment(f"Set the attribute {node.attr} of {node.instance}")) + elif node.source == "NULL": + self.register_instruction(mips.StoreWordNode("$zero", f"{4 * (node.attr_index + 2)}($t0)").set_comment(f"Set the attribute {node.attr} of {node.instance}")) else: self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.source)}($sp)").set_comment(f"$t1 = {node.source}")) self.register_instruction(mips.StoreWordNode("$t1", f"{4 * (node.attr_index + 2)}($t0)").set_comment(f"{node.instance}.{node.attr} = {node.source}")) @@ -359,12 +440,66 @@ def visit(self, node: cil.AncestorNode): self.register_instruction(mips.LoadWordNode("$t1", "4($t0)")) self.register_instruction(mips.StoreWordNode("$t1", f"{self.offset_of(node.dest)}($sp)")) - @visitor.when(cil.TypeDirectionNode) - def visit(self, node: cil.TypeDirectionNode): + @visitor.when(cil.TypeAddressNode) + def visit(self, node: cil.TypeAddressNode): self.register_comment(f"{node.dest} = direction of {node.name}") self.register_instruction(mips.LoadAddressNode("$t0", f"type_{node.name}")) self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)")) + @visitor.when(cil.EqualAddressNode) + def visit(self, node: cil.EqualAddressNode): + self.register_comment(f"{node.dest} = EqualAddress({node.left}, {node.right})") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.left)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.right)}($sp)")) + self.register_instruction(mips.SeqNode("$t2", "$t0", "$t1")) + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.dest)}($sp)")) + self.register_instruction(mips.StoreWordNode("$t2", f"8($t0)")) + + @visitor.when(cil.EqualIntNode) + def visit(self, node: cil.EqualIntNode): + self.register_comment(f"{node.dest} = EqualInt({node.left}, {node.right})") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.left)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t0", f"8($t0)")) + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.right)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t1", f"8($t1)")) + self.register_instruction(mips.SeqNode("$t2", "$t0", "$t1")) + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.dest)}($sp)")) + self.register_instruction(mips.StoreWordNode("$t2", f"8($t0)")) + + @visitor.when(cil.EqualStrNode) + def visit(self, node: cil.EqualStrNode): + self.register_comment(f"{node.dest} = EqualStr({node.left}, {node.right})") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.left)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.right)}($sp)")) + self.register_instruction(mips.AddiNode("$t0", "$t0", "8")) + self.register_instruction(mips.AddiNode("$t1", "$t1", "8")) + + self.register_empty_instruction() + self.register_comment(f"By default we assume the strings are equals") + self.register_instruction(mips.AddiNode("$t4", "$zero", "1")) + self.register_instruction(mips.LoadWordNode("$t5", f"{self.offset_of(node.dest)}($sp)")) + self.register_instruction(mips.StoreWordNode("$t4", f"8($t5)")) + + self.register_empty_instruction() + self.register_instruction(mips.LabelNode("while_compare_strings_start")) + self.register_instruction(mips.LoadByteNode("$t2", "0($t0)")) + self.register_instruction(mips.LoadByteNode("$t3", "0($t1)")) + self.register_instruction(mips.BeqNode("$t2", "$t3", "while_compare_strings_update")) + + self.register_empty_instruction() + self.register_comment(f"The strings are no equals") + self.register_instruction(mips.LoadWordNode("$t5", f"{self.offset_of(node.dest)}($sp)")) + self.register_instruction(mips.StoreWordNode("$zero", f"8($t5)")) + self.register_instruction(mips.JumpNode("while_compare_strings_end")) + + self.register_empty_instruction() + self.register_instruction(mips.LabelNode("while_compare_strings_update")) + self.register_instruction(mips.AddiNode("$t0", "$t0", "1")) + self.register_instruction(mips.AddiNode("$t1", "$t1", "1")) + self.register_instruction(mips.BeqNode("$t2", "$zero", "while_compare_strings_end")) + self.register_instruction(mips.JumpNode("while_compare_strings_start")) + self.register_instruction(mips.LabelNode("while_compare_strings_end")) + @visitor.when(cil.TypeNameNode) def visit(self, node: cil.TypeNameNode): self.register_comment(f"{node.dest} = name of {node.source}") @@ -390,15 +525,15 @@ def visit(self, node: cil.TypeNameNode): self.register_instruction(mips.AddiNode("$t4", "$t4", "8").set_comment("Pointer to the first character of the string")) self.register_instruction(mips.AddiNode("$t0", "$t0", "8").set_comment(f"Pointer to the first character of the string in {node.source}")) self.register_instruction(mips.XorNode("$t5", "$t5", "$t5").set_comment("Initializing counter")) - self.register_instruction(mips.LabelNode("while_copy_start")) - self.register_instruction(mips.BeqNode("$t5", "$t1", "while_copy_end")) + self.register_instruction(mips.LabelNode("while_copy_name_start")) + self.register_instruction(mips.BeqNode("$t5", "$t1", "while_copy_name_end")) self.register_instruction(mips.LoadByteNode("$t6", "0($t0)").set_comment("Loading the character")) self.register_instruction(mips.StoreByteNode("$t6", "0($t4)")) self.register_instruction(mips.AddiNode("$t4", "$t4", "1").set_comment("Incrementing the pointer to the new string")) self.register_instruction(mips.AddiNode("$t0", "$t0", "1").set_comment(f"Incrementing the pointer to the string in {node.source}")) self.register_instruction(mips.AddiNode("$t5", "$t5", "1").set_comment("Incrementing counter")) - self.register_instruction(mips.JumpNode("while_copy_start")) - self.register_instruction(mips.LabelNode("while_copy_end")) + self.register_instruction(mips.JumpNode("while_copy_name_start")) + self.register_instruction(mips.LabelNode("while_copy_name_end")) self.register_empty_instruction() self.register_instruction(mips.StoreByteNode("$zero", "0($t4)").set_comment("Setting the null byte")) @@ -454,12 +589,10 @@ def visit(self, node: cil.PrintStringNode): @visitor.when(cil.PrintIntNode) def visit(self, node: cil.PrintIntNode): - self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.source)}($sp)").set_comment(f"$t0 = {node.source}")) - self.register_empty_instruction() - self.register_comment(f"Printing the string {node.source}") self.register_instruction(mips.LoadInmediateNode("$v0", "1")) - self.register_instruction(mips.LoadWordNode("$a0", "8($t0)")) + self.register_instruction(mips.LoadWordNode("$a0", f"{self.offset_of(node.source)}($sp)")) + self.register_instruction(mips.LoadWordNode("$a0", "8($a0)")) self.register_instruction(mips.SystemCallNode()) @visitor.when(cil.ReadStringNode) @@ -512,73 +645,76 @@ def visit(self, node: cil.LabelNode): @visitor.when(cil.GotoNode) def visit(self, node: cil.GotoNode): + self.register_comment(f"Jumping to {node.address}") self.register_instruction(mips.JumpNode(node.address)) @visitor.when(cil.GotoIfNode) def visit(self, node: cil.GotoIfNode): - self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.condition)}($sp)")) - self.register_instruction(mips.AddiNode("$t1", "$zero", "1")) + self.register_comment(f"If {node.condition} then goto {node.address}") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.condition)}($sp)").set_comment("Loading the address of the condition")) + self.register_instruction(mips.LoadWordNode("$t0", f"8($t0)").set_comment("Loading the value of the condition")) + self.register_instruction(mips.AddiNode("$t1", "$zero", "1").set_comment("Setting the value to 1 for comparison")) self.register_instruction(mips.BeqNode("$t0", "$t1", node.address)) @visitor.when(cil.PlusNode) def visit(self, node: cil.PlusNode): - self.register_comment("addition operation") + self.register_comment("Addition operation") self.preprocess_binary_operation(node) - self.register_instruction(mips.AddNode("$t0", "$t0", "$t1").set_comment("$t0 = $t0 + $t1")) - self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"Store result of addition in {node.dest}")) + self.register_instruction(mips.AddNode("$t2", "$t0", "$t1").set_comment("$t2 = $t0 + $t1")) + self.postprocess_binary_int_operation(node, "Int") @visitor.when(cil.MinusNode) def visit(self, node: cil.MinusNode): self.register_comment("Subtraction operation") self.preprocess_binary_operation(node) - self.register_instruction(mips.SubNode("$t0", "$t0", "$t1").set_comment("$t0 = $t0 - $t1")) - self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"Store result of subtraction in {node.dest}")) - + self.register_instruction(mips.SubNode("$t2", "$t0", "$t1").set_comment("$t2 = $t0 - $t1")) + self.postprocess_binary_int_operation(node, "Int") + @visitor.when(cil.StarNode) def visit(self, node: cil.StarNode): self.register_comment("Multiplication operation") self.preprocess_binary_operation(node) - self.register_instruction(mips.MultNode("$t0", "$t1").set_comment("$t0 = $t0 * $t1")) - self.register_instruction(mips.MoveFromLowNode("$t0")) - self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"Store result of multiplication in {node.dest}")) + self.register_instruction(mips.MultNode("$t0", "$t1").set_comment("$t2 = $t0 * $t1")) + self.register_instruction(mips.MoveFromLowNode("$t2")) + self.postprocess_binary_int_operation(node, "Int") @visitor.when(cil.DivNode) def visit(self, node: cil.DivNode): self.register_comment("Division operation") self.preprocess_binary_operation(node) - self.register_instruction(mips.DivNode("$t0", "$t1").set_comment("$t0 = $t0 / $t1")) - self.register_instruction(mips.MoveFromLowNode("$t0")) - self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"Store result of division in {node.dest}")) + self.register_instruction(mips.DivNode("$t0", "$t1").set_comment("$t2 = $t0 / $t1")) + self.register_instruction(mips.MoveFromLowNode("$t2")) + self.postprocess_binary_int_operation(node, "Int") @visitor.when(cil.XorNode) def visit(self, node: cil.XorNode): self.register_comment("Xor operation") self.preprocess_binary_operation(node) - self.register_instruction(mips.XorNode("$t0", "$t0", "$t1").set_comment("$t0 = $t0 ^ $t1")) - self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"Store result of xor in {node.dest}")) + self.register_instruction(mips.XorNode("$t2", "$t0", "$t1").set_comment("$t0 = $t0 ^ $t1")) + self.postprocess_binary_int_operation(node, "Int") @visitor.when(cil.EqualNode) def visit(self, node: cil.EqualNode): self.register_comment("Equal operation") - self.preprocess_binary_operation(node) - self.register_instruction(mips.XorNode("$t0", "$t0", "$t1").set_comment("$t0 = $t0 ^ $t1")) - self.register_instruction(mips.SeqNode("$t0", "$t0", "$zero").set_comment("$t0 = $t0 == 0")) - self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"Store result of equal in {node.dest}")) + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.left)}($sp)").set_comment("Save in $t0 the left operand address")) + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.right)}($sp)").set_comment("Save in $t1 the right operand address")) + self.register_instruction(mips.SeqNode("$t2", "$t0", "$t1").set_comment("$t2 = $t0 == $t1")) + self.postprocess_binary_int_operation(node, "Bool") @visitor.when(cil.LessThanNode) def visit(self, node: cil.LessThanNode): self.register_comment("Less than operation") self.preprocess_binary_operation(node) - self.register_instruction(mips.SltNode("$t0", "$t0", "$t1").set_comment("$t0 = $t0 < $t1")) - self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"Store result of less than in {node.dest}")) - + self.register_instruction(mips.SltNode("$t2", "$t0", "$t1").set_comment("$t2 = $t0 < $t1")) + self.postprocess_binary_int_operation(node, "Bool") + @visitor.when(cil.LessEqualNode) def visit(self, node: cil.LessEqualNode): self.register_comment("Less than operation") self.preprocess_binary_operation(node) - self.register_instruction(mips.SleNode("$t0", "$t0", "$t1").set_comment("$t0 = $t0 <= $t1")) - self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"Store result of less than or equal in {node.dest}")) - + self.register_instruction(mips.SleNode("$t2", "$t0", "$t1").set_comment("$t2 = $t0 <= $t1")) + self.postprocess_binary_int_operation(node, "Bool") + @visitor.when(cil.HaltNode) def visit(self, node: cil.HaltNode): self.register_comment("Exit program") @@ -596,15 +732,14 @@ def visit(self, node: cil.ReturnNode): self.register_instruction(mips.LoadWordNode("$v1", f"{offset}($sp)")) def preprocess_binary_operation(self, node: cil.ArithmeticNode): - if node.left.isdigit() and node.right.isdigit(): - self.register_instruction(mips.AddiNode("$t0", "$zero", node.left).set_comment("Save in $t0 the left operand")) - self.register_instruction(mips.AddiNode("$t1", "$zero", node.right).set_comment("Save in $t1 the right operand")) - elif node.left.isdigit(): - self.register_instruction(mips.AddiNode("$t0", "$zero", node.left).set_comment("Save in $t0 the left operand")) - self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.right)}($sp)").set_comment("Save in $t1 the right operand")) - elif node.right.isdigit(): - self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.left)}($sp)").set_comment("Save in $t0 the left operand")) - self.register_instruction(mips.AddiNode("$t1", "$zero", node.right).set_comment("Save in $t1 the right operand")) - else: - self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.left)}($sp)").set_comment("Save in $t0 the left operand")) - self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.right)}($sp)").set_comment("Save in $t1 the right operand")) \ No newline at end of file + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.left)}($sp)").set_comment("Save in $t0 the left operand address")) + self.register_instruction(mips.LoadWordNode("$t0", "8($t0)").set_comment("Save in $t0 the left operand value")) + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.right)}($sp)").set_comment("Save in $t1 the right operand address")) + self.register_instruction(mips.LoadWordNode("$t1", "8($t1)").set_comment("Save in $t1 the rigth operand value")) + + def postprocess_binary_int_operation(self, node: cil.ArithmeticNode, t: str): + # self.register_instantiation(12) + self.register_empty_instruction() + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"$t0 = {node.dest}")) + self.register_instruction(mips.StoreWordNode("$t2", "8($t0)").set_comment(f"Setting value in the third word of the {t} object")) + diff --git a/src/cool/code_generation/translator_cool_to_cil.py b/src/cool/code_generation/translator_cool_to_cil.py index 56e88c6de..b25a61c84 100644 --- a/src/cool/code_generation/translator_cool_to_cil.py +++ b/src/cool/code_generation/translator_cool_to_cil.py @@ -1,5 +1,4 @@ from typing import Any, Dict, List, Optional, Tuple -from unittest import result import cool.code_generation.ast_cil as cil import cool.code_generation.ast_ecool as ecool @@ -77,7 +76,6 @@ def visit(self, node: cool.ClassDeclarationNode): "__init__", [], self.current_type.name, body ) - # Added the Type self.current_type.define_method("__init__", [], [], self.current_type) attrs = [ @@ -132,6 +130,8 @@ def visit(self, node: cool.ProgramNode, scope: Scope = None): if scope is None: scope = Scope() + node.scope = scope + for elem in node.declarations: self.visit(elem, scope.create_child()) @@ -139,6 +139,7 @@ def visit(self, node: cool.ProgramNode, scope: Scope = None): @visitor.when(cool.ClassDeclarationNode) def visit(self, node: cool.ClassDeclarationNode, scope: Scope): + node.scope = scope self.current_type = self.context.get_type(node.id) attrs = [ @@ -164,6 +165,7 @@ def visit(self, node: cool.ClassDeclarationNode, scope: Scope): @visitor.when(cool.AttrDeclarationNode) def visit(self, node: cool.AttrDeclarationNode, scope: Scope): + node.scope = scope if node.id == "self": self.errors.append(err.SELF_INVALID_ATTRIBUTE_ID % (node.line, node.column)) @@ -195,6 +197,7 @@ def visit(self, node: cool.AttrDeclarationNode, scope: Scope): @visitor.when(cool.MethodDeclarationNode) def visit(self, node: cool.MethodDeclarationNode, scope: Scope): + node.scope = scope self.current_method = self.current_type.get_method(node.id) self.current_attribute = None @@ -243,6 +246,7 @@ def visit(self, node: cool.MethodDeclarationNode, scope: Scope): @visitor.when(cool.LetNode) def visit(self, node: cool.LetNode, scope: Scope): + node.scope = scope for i, (_id, _type, _expr) in enumerate(node.declarations): if _id == "self": line, column = node.declaration_names_positions[i] @@ -260,13 +264,6 @@ def visit(self, node: cool.LetNode, scope: Scope): self.errors.append(err.UNDEFINED_TYPE % (line, column, _type)) var_static_type = ErrorType() - # if scope.is_local(_id): - # feature = self.current_method or self.current_attribute - # self.errors.append( - # err.LOCAL_ALREADY_DEFINED - # % (node.line, node.column, _id, feature.name) - # ) - # else: scope.define_variable(_id, var_static_type) expr_type = ( @@ -282,6 +279,7 @@ def visit(self, node: cool.LetNode, scope: Scope): @visitor.when(cool.AssignNode) def visit(self, node: cool.AssignNode, scope: Scope): + node.scope = scope var_info = scope.find_variable(node.id) if var_info.name == "self": @@ -305,6 +303,7 @@ def visit(self, node: cool.AssignNode, scope: Scope): @visitor.when(cool.BlockNode) def visit(self, node: cool.BlockNode, scope: Scope): + node.scope = scope return_type = ErrorType() for expr in node.expressions: return_type = self.visit(expr, scope) @@ -312,6 +311,7 @@ def visit(self, node: cool.BlockNode, scope: Scope): @visitor.when(cool.ConditionalNode) def visit(self, node: cool.ConditionalNode, scope: Scope): + node.scope = scope if_type = self.visit(node.if_expr, scope) then_type = self.visit(node.then_expr, scope) else_type = self.visit(node.else_expr, scope) @@ -323,6 +323,7 @@ def visit(self, node: cool.ConditionalNode, scope: Scope): @visitor.when(cool.WhileNode) def visit(self, node: cool.WhileNode, scope: Scope): + node.scope = scope condition = self.visit(node.condition, scope) if condition != self.context.get_type("Bool"): self.errors.append( @@ -335,6 +336,7 @@ def visit(self, node: cool.WhileNode, scope: Scope): @visitor.when(cool.SwitchCaseNode) def visit(self, node: cool.SwitchCaseNode, scope: Scope): + node.scope = scope self.visit(node.expr, scope) types = [] visited = set() @@ -368,6 +370,7 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): @visitor.when(cool.MethodCallNode) def visit(self, node: cool.MethodCallNode, scope: Scope): + node.scope = scope if node.obj is None: node.obj = cool.VariableNode("self") obj_type = self.visit(node.obj, scope) @@ -433,22 +436,27 @@ def visit(self, node: cool.MethodCallNode, scope: Scope): @visitor.when(cool.IntegerNode) def visit(self, node: cool.IntegerNode, scope: Scope): + node.scope = scope return self.context.get_type("Int") @visitor.when(cool.StringNode) def visit(self, node: cool.StringNode, scope: Scope): + node.scope = scope return self.context.get_type("String") @visitor.when(cool.BooleanNode) def visit(self, node: cool.BooleanNode, scope: Scope): + node.scope = scope return self.context.get_type("Bool") @visitor.when(ecool.NullNode) def visit(self, node: ecool.NullNode, scope: Scope): + node.scope = scope return ecool.NullType() @visitor.when(cool.VariableNode) def visit(self, node: cool.VariableNode, scope: Scope): + node.scope = scope variable = scope.find_variable(node.lex) if variable is None: if self.current_attribute is not None: @@ -464,6 +472,7 @@ def visit(self, node: cool.VariableNode, scope: Scope): @visitor.when(cool.InstantiateNode) def visit(self, node: cool.InstantiateNode, scope: Scope): + node.scope = scope try: return ( self.context.get_type(node.lex) @@ -477,59 +486,69 @@ def visit(self, node: cool.InstantiateNode, scope: Scope): @visitor.when(cool.NegationNode) def visit(self, node: cool.NegationNode, scope: Scope): + node.scope = scope return self._check_unary_operation( node, scope, "not", self.context.get_type("Bool") ) @visitor.when(cool.ComplementNode) def visit(self, node: cool.ComplementNode, scope: Scope): + node.scope = scope return self._check_unary_operation( node, scope, "~", self.context.get_type("Int") ) @visitor.when(cool.IsVoidNode) def visit(self, node: cool.IsVoidNode, scope: Scope): + node.scope = scope self.visit(node.expr, scope) return self.context.get_type("Bool") @visitor.when(cool.PlusNode) def visit(self, node: cool.PlusNode, scope: Scope): + node.scope = scope return self._check_int_binary_operation( node, scope, "+", self.context.get_type("Int") ) @visitor.when(cool.MinusNode) def visit(self, node: cool.MinusNode, scope: Scope): + node.scope = scope return self._check_int_binary_operation( node, scope, "-", self.context.get_type("Int") ) @visitor.when(cool.StarNode) def visit(self, node: cool.StarNode, scope: Scope): + node.scope = scope return self._check_int_binary_operation( node, scope, "*", self.context.get_type("Int") ) @visitor.when(cool.DivNode) def visit(self, node: cool.DivNode, scope: Scope): + node.scope = scope return self._check_int_binary_operation( node, scope, "/", self.context.get_type("Int") ) @visitor.when(cool.LessEqualNode) def visit(self, node: cool.LessEqualNode, scope: Scope): + node.scope = scope return self._check_int_binary_operation( node, scope, "<=", self.context.get_type("Bool") ) @visitor.when(cool.LessThanNode) def visit(self, node: cool.LessThanNode, scope: Scope): + node.scope = scope return self._check_int_binary_operation( node, scope, "<", self.context.get_type("Bool") ) @visitor.when(cool.EqualNode) def visit(self, node: cool.EqualNode, scope: Scope): + node.scope = scope left_type = self.visit(node.left, scope) right_type = self.visit(node.right, scope) @@ -651,6 +670,7 @@ def visit(self, node, scope): @visitor.when(cool.ProgramNode) def visit(self, node: cool.ProgramNode, scope: Scope): + scope = node.scope default_class_names = ["Object", "IO", "Int", "String", "Bool"] for name in default_class_names: t = self.context.get_type(name) @@ -660,6 +680,109 @@ def visit(self, node: cool.ProgramNode, scope: Scope): cil_type_node.methods.append((method.name, self.to_function_name(method.name, owner.name))) cil_type_node.methods.append(("__init__", self.to_function_name("__init__", t.name))) + self.current_function = self.register_function("function_add") + self.current_function.params.append(cil.ParamNode("a")) + self.current_function.params.append(cil.ParamNode("b")) + result = self.define_internal_local("Adding result") + self.register_instruction(cil.AllocateIntNode(result, "0")) + self.register_instruction(cil.PlusNode(result, "a", "b")) + self.register_instruction(cil.ReturnNode(result)) + + self.current_function = self.register_function("function_sub") + self.current_function.params.append(cil.ParamNode("a")) + self.current_function.params.append(cil.ParamNode("b")) + result = self.define_internal_local("Substracting result") + self.register_instruction(cil.AllocateIntNode(result, "0")) + self.register_instruction(cil.MinusNode(result, "a", "b")) + self.register_instruction(cil.ReturnNode(result)) + + self.current_function = self.register_function("function_mult") + self.current_function.params.append(cil.ParamNode("a")) + self.current_function.params.append(cil.ParamNode("b")) + result = self.define_internal_local("Multiting result") + self.register_instruction(cil.AllocateIntNode(result, "0")) + self.register_instruction(cil.StarNode(result, "a", "b")) + self.register_instruction(cil.ReturnNode(result)) + + self.current_function = self.register_function("function_div") + self.current_function.params.append(cil.ParamNode("a")) + self.current_function.params.append(cil.ParamNode("b")) + result = self.define_internal_local("Dividing result") + self.register_instruction(cil.AllocateIntNode(result, "0")) + self.register_instruction(cil.DivNode(result, "a", "b")) + self.register_instruction(cil.ReturnNode(result)) + + self.current_function = self.register_function("function_xor") + self.current_function.params.append(cil.ParamNode("a")) + self.current_function.params.append(cil.ParamNode("b")) + result = self.define_internal_local("Xor result") + self.register_instruction(cil.AllocateIntNode(result, "0")) + self.register_instruction(cil.XorNode(result, "a", "b")) + self.register_instruction(cil.ReturnNode(result)) + + self.current_function = self.register_function("function_less_than") + self.current_function.params.append(cil.ParamNode("a")) + self.current_function.params.append(cil.ParamNode("b")) + result = self.define_internal_local("Less than result") + self.register_instruction(cil.AllocateBoolNode(result, "0")) + self.register_instruction(cil.LessThanNode(result, "a", "b")) + self.register_instruction(cil.ReturnNode(result)) + + self.current_function = self.register_function("function_less_than_or_equal") + self.current_function.params.append(cil.ParamNode("a")) + self.current_function.params.append(cil.ParamNode("b")) + result = self.define_internal_local("Less than or equal result") + self.register_instruction(cil.AllocateBoolNode(result, "0")) + self.register_instruction(cil.LessEqualNode(result, "a", "b")) + self.register_instruction(cil.ReturnNode(result)) + + self.current_function = self.register_function("function_equal") + self.current_function.params.append(cil.ParamNode("a")) + self.current_function.params.append(cil.ParamNode("b")) + result = self.define_internal_local("Equal result") + type_of_a = self.define_internal_local("Type of a") + type_int = self.define_internal_local("Type Int") + type_bool = self.define_internal_local("Type Bool") + type_string = self.define_internal_local("Type String") + type_a_equals_int = self.define_internal_local("Type of a equals int") + type_a_equals_bool = self.define_internal_local("Type of a equals bool") + type_a_equals_string = self.define_internal_local("Type of a equals string") + self.register_instruction(cil.AllocateBoolNode(result, "0")) + self.register_instruction(cil.TypeOfNode(type_of_a, "a")) + self.register_instruction(cil.TypeAddressNode(type_int, "Int")) + self.register_instruction(cil.TypeAddressNode(type_bool, "Bool")) + self.register_instruction(cil.TypeAddressNode(type_string, "String")) + self.register_instruction(cil.AllocateBoolNode(type_a_equals_int, "0")) + self.register_instruction(cil.AllocateBoolNode(type_a_equals_bool, "0")) + self.register_instruction(cil.AllocateBoolNode(type_a_equals_string, "0")) + self.register_instruction(cil.EqualAddressNode(type_a_equals_int, type_of_a, type_int)) + self.register_instruction(cil.EqualAddressNode(type_a_equals_bool, type_of_a, type_bool)) + self.register_instruction(cil.EqualAddressNode(type_a_equals_string, type_of_a, type_string)) + self.register_empty_instruction() + self.register_instruction(cil.GotoIfNode(type_a_equals_int, "a_is_type_int_or_bool")) + self.register_instruction(cil.GotoIfNode(type_a_equals_bool, "a_is_type_int_or_bool")) + self.register_instruction(cil.GotoIfNode(type_a_equals_string, "a_is_type_string")) + self.register_instruction(cil.GotoNode("a_is_type_object")) + + self.register_empty_instruction() + self.register_instruction(cil.LabelNode("a_is_type_int_or_bool")) + self.register_instruction(cil.EqualIntNode(result, "a", "b")) + self.register_instruction(cil.GotoNode("end_of_equal")) + + self.register_empty_instruction() + self.register_instruction(cil.LabelNode("a_is_type_string")) + self.register_instruction(cil.EqualStrNode(result, "a", "b")) + self.register_instruction(cil.GotoNode("end_of_equal")) + + self.register_empty_instruction() + self.register_instruction(cil.LabelNode("a_is_type_object")) + self.register_instruction(cil.EqualNode(result, "a", "b")) + self.register_instruction(cil.GotoNode("end_of_equal")) + + self.register_empty_instruction() + self.register_instruction(cil.LabelNode("end_of_equal")) + + self.register_instruction(cil.ReturnNode(result)) self.current_function = self.register_function(self.to_function_name("__init__", "Object")) self.current_function.params.append(cil.ParamNode("self")) @@ -754,6 +877,7 @@ def visit(self, node: cool.ProgramNode, scope: Scope): @visitor.when(cool.ClassDeclarationNode) def visit(self, node: cool.ClassDeclarationNode, scope: Scope): + scope = node.scope self.current_type = self.context.get_type(node.id) type_node = self.register_type(self.current_type.name, self.current_type.parent.name) @@ -793,10 +917,12 @@ def visit(self, node: cool.ClassDeclarationNode, scope: Scope): @visitor.when(cool.AttrDeclarationNode) def visit(self, node: cool.AttrDeclarationNode, scope: Scope): + scope = node.scope pass @visitor.when(cool.MethodDeclarationNode) def visit(self, node: cool.MethodDeclarationNode, scope: Scope): + scope = node.scope self.current_method, owner_type = self.current_type.get_method( node.id, get_owner=True ) @@ -813,8 +939,9 @@ def visit(self, node: cool.MethodDeclarationNode, scope: Scope): @visitor.when(cool.LetNode) def visit(self, node: cool.LetNode, scope: Scope): + scope = node.scope i = 0 - for name, _, expr in node.declarations: + for name, type_name, expr in node.declarations: self.register_local(name) if expr: @@ -822,13 +949,20 @@ def visit(self, node: cool.LetNode, scope: Scope): if source: self.register_instruction(cil.AssignNode(name, source)) i += 1 - + else: + if type_name in ("Int", "Bool"): + self.register_instruction(cil.AssignNode(name, "0")) + elif type_name == "String": + self.register_instruction(cil.AllocateStrNode(name, "\"\"")) + else: + self.register_instruction(cil.AssignNode(name, "NULL")) source, t = self.visit(node.expr, scope.children[i]) return source, t @visitor.when(cool.AssignNode) def visit(self, node: cool.AssignNode, scope: Scope): + scope = node.scope variable = scope.find_variable(node.id) variables = scope.find_all_variables(node.id) source, _ = self.visit(node.expr, scope) @@ -839,9 +973,7 @@ def visit(self, node: cool.AssignNode, scope: Scope): if is_attribute: attr_names = [attr.name for attr, _ in self.current_type.all_attributes()] - # local_var = self.define_internal_local() self.register_instruction(cil.SetAttributeNode("self", variable.name, source, attr_names.index(variable.name))) - # self.register_instruction(cil.AssignNode(local_var, source)) return source, variable.type else: self.register_instruction(cil.AssignNode(variable.name, source)) @@ -849,6 +981,7 @@ def visit(self, node: cool.AssignNode, scope: Scope): @visitor.when(cool.BlockNode) def visit(self, node: cool.BlockNode, scope: Scope): + scope = node.scope source, inst_type = None, None for expr in node.expressions: source, inst_type = self.visit(expr, scope) @@ -856,30 +989,32 @@ def visit(self, node: cool.BlockNode, scope: Scope): @visitor.when(cool.ConditionalNode) def visit(self, node: cool.ConditionalNode, scope: Scope): + scope = node.scope self.register_instruction(cil.CommentNode("Conditional")) node_id = hash(node) result_address = self.define_internal_local() conditional_address = self.define_internal_local() + + self.register_instruction(cil.AllocateBoolNode(conditional_address, "0")) + source, _ = self.visit(node.if_expr, scope) self.register_instruction(cil.AssignNode(conditional_address, source)) - self.register_instruction( - cil.GotoIfNode(conditional_address, f"then_{node_id}") - ) + self.register_instruction(cil.GotoIfNode(conditional_address, f"then_{node_id}")) self.register_instruction(cil.GotoNode(f"else_{node_id}")) self.register_instruction(cil.EmptyInstruction()) self.register_instruction(cil.LabelNode(f"then_{node_id}")) then_source, then_type = self.visit(node.then_expr, scope) self.register_instruction(cil.AssignNode(result_address, then_source)) - self.register_instruction(cil.GotoNode(f"end_{node_id}")) + self.register_instruction(cil.GotoNode(f"endif_{node_id}")) self.register_instruction(cil.EmptyInstruction()) self.register_instruction(cil.LabelNode(f"else_{node_id}")) else_source, else_type = self.visit(node.else_expr, scope) self.register_instruction(cil.AssignNode(result_address, else_source)) - self.register_instruction(cil.GotoNode(f"end_{node_id}")) + self.register_instruction(cil.GotoNode(f"endif_{node_id}")) self.register_instruction(cil.EmptyInstruction()) self.register_instruction(cil.LabelNode(f"endif_{node_id}")) @@ -888,6 +1023,7 @@ def visit(self, node: cool.ConditionalNode, scope: Scope): @visitor.when(cool.WhileNode) def visit(self, node: cool.WhileNode, scope: Scope): + scope = node.scope # result_addres = self.define_internal_local() node_id = hash(node) conditional_address = self.define_internal_local() @@ -908,10 +1044,11 @@ def visit(self, node: cool.WhileNode, scope: Scope): self.register_instruction(cil.EmptyInstruction()) self.register_instruction(cil.LabelNode(f"while_end_{node_id}")) - return 0, self.context.get_type("Object") + return "0", self.context.get_type("Object") @visitor.when(cool.SwitchCaseNode) def visit(self, node: cool.SwitchCaseNode, scope: Scope): + scope = node.scope node_id = hash(node) swicth_expression, _ = self.visit(node.expr, scope) count_of_ancestors = self.define_internal_local("Count of ancestors of the switch expression") @@ -919,6 +1056,8 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): ancestor_type = self.define_internal_local("Ancestor type") step1_comparison = self.define_internal_local("Step 1 comparison result") array_of_ancestors = self.define_internal_local("Step 1 Array of ancestors") + constant_zero_int = self.define_internal_local("Integer 0 ") + constant_null_ptr = self.define_internal_local("Null pointer") self.register_comment("Switch Case Algorithm Steps:") self.register_comment(" 1 - Count how many ancestors has the dynamic type of the expression") @@ -930,13 +1069,17 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): ############################################ # While loop to get the count of ancestors # ############################################ + + self.register_instruction(cil.AllocateIntNode(constant_zero_int, 0)) + self.register_instruction(cil.AllocateBoolNode(step1_comparison, "0").set_comment("Initialize the comparison result")) + self.register_empty_instruction() self.register_comment("######################################################################## #") self.register_comment("Step 1 - Count how many ancestors has the dynamic type of the expression #") self.register_comment("######################################################################## #") self.register_instruction(cil.TypeOfNode(switch_expr_type, swicth_expression).set_comment("Get the switch expression type")) self.register_instruction(cil.AssignNode(ancestor_type, switch_expr_type).set_comment("The first ancestor will be the type itself")) - self.register_instruction(cil.AssignNode(count_of_ancestors, 0).set_comment("Initialize the counter")) + self.register_instruction(cil.AssignNode(count_of_ancestors, constant_zero_int).set_comment("Initialize the counter")) self.register_instruction(cil.LabelNode(f"while_start_{node_id}")) self.register_instruction(cil.EqualNode(step1_comparison, ancestor_type, "0")) self.register_instruction(cil.GotoIfNode(step1_comparison, f"while_end_{node_id}")) @@ -989,7 +1132,7 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): self.register_instruction(cil.ArrayNode(nearest_ancestor_array, f"{len(types)}")) for i, t in enumerate(types): x = self.define_internal_local(f"Address of the type {t.name}") - self.register_instruction(cil.TypeDirectionNode(x, t.name)) + self.register_instruction(cil.TypeAddressNode(x, t.name)) self.register_instruction(cil.SetIndexNode(type_branch_array, f"{i}", x)) self.register_instruction(cil.SetIndexNode(nearest_ancestor_array, f"{i}", count_of_ancestors)) self.register_empty_instruction() @@ -1115,6 +1258,7 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): @visitor.when(cool.MethodCallNode) def visit(self, node: cool.MethodCallNode, scope: Scope): + scope = node.scope obj_source, obj_type = self.visit(node.obj, scope) args_sources = [] @@ -1137,24 +1281,33 @@ def visit(self, node: cool.MethodCallNode, scope: Scope): @visitor.when(cool.IntegerNode) def visit(self, node: cool.IntegerNode, scope: Scope): - return node.lex, self.context.get_type("Int") + scope = node.scope + local_int = self.define_internal_local(f"Integer {node.lex}") + self.register_instruction(cil.AllocateIntNode(local_int, node.lex)) + return local_int, self.context.get_type("Int") @visitor.when(cool.StringNode) def visit(self, node: cool.StringNode, scope: Scope): + scope = node.scope local_str_var = self.define_internal_local(f"String {node.lex}") self.register_instruction(cil.AllocateStrNode(local_str_var, node.lex)) return local_str_var, self.context.get_type("String") @visitor.when(cool.BooleanNode) def visit(self, node: cool.BooleanNode, scope: Scope): - return ("1" if node.lex == "true" else "0"), self.context.get_type("Bool") + scope = node.scope + local_bool_var = self.define_internal_local(f"Boolean {node.lex}") + self.register_instruction(cil.AllocateBoolNode(local_bool_var, ("1" if node.lex == "true" else "0"))) + return local_bool_var, self.context.get_type("Bool") @visitor.when(ecool.NullNode) def visit(self, node: ecool.NullNode, scope: Scope): + scope = node.scope return node.lex, ecool.NullType @visitor.when(cool.VariableNode) def visit(self, node: cool.VariableNode, scope: Scope): + scope = node.scope variable = scope.find_variable(node.lex) variables = scope.find_all_variables(node.lex) @@ -1171,6 +1324,7 @@ def visit(self, node: cool.VariableNode, scope: Scope): @visitor.when(cool.InstantiateNode) def visit(self, node: cool.InstantiateNode, scope: Scope): + scope = node.scope local = self.define_internal_local(f"Store an instance of the class {node.lex}") self.register_instruction(cil.AllocateNode(node.lex, local).set_comment(f"Allocate the object {node.lex}")) self.register_instruction(cil.ArgNode(local, 0, 1).set_comment("Pass the instance to the constructor")) @@ -1179,59 +1333,76 @@ def visit(self, node: cool.InstantiateNode, scope: Scope): @visitor.when(cool.NegationNode) def visit(self, node: cool.NegationNode, scope: Scope): + scope = node.scope source, _ = self.visit(node.expr, scope) + local_int = self.define_internal_local("Integer 1") result = self.define_internal_local(f"Store the negation of {source}") - self.register_instruction(cil.XorNode(result, source, "1").set_comment(f"not {source}")) + self.register_instruction(cil.AllocateIntNode(local_int, "1")) + self.register_instruction(cil.XorNode(result, source, local_int).set_comment(f"not {source}")) return result, self.context.get_type("Bool") @visitor.when(cool.ComplementNode) def visit(self, node: cool.ComplementNode, scope: Scope): + scope = node.scope source, _ = self.visit(node.expr, scope) + local_int_0 = self.define_internal_local("Integer 1") + local_int_1 = self.define_internal_local(f"Integer {2**32 - 1}") result = self.define_internal_local(f"Store the complement a2 of {source}") - self.register_instruction(cil.XorNode(result, source, f"{2**32 - 1}").set_comment(f"Getting the complement a1 of {source}")) - self.register_instruction(cil.PlusNode(result, result, "1").set_comment(f"Adding 1 to the complement a1 we get the complement a2 of {source}")) + self.register_instruction(cil.XorNode(result, source,local_int_1 ).set_comment(f"Getting the complement a1 of {source}")) + self.register_instruction(cil.PlusNode(result, result, local_int_0).set_comment(f"Adding 1 to the complement a1 we get the complement a2 of {source}")) return result, self.context.get_type("Int") @visitor.when(cool.IsVoidNode) def visit(self, node: cool.IsVoidNode, scope: Scope): + scope = node.scope source, _ = self.visit(node.expr, scope) - result = self.define_internal_local(f"Store if {source} is null") - self.register_instruction(cil.EqualNode(result, source, "null")) + result = self.define_internal_local(f"Store if {source} is NULL") + self.register_instruction(cil.EqualNode(result, source, "0")) return result, self.context.get_type("Bool") @visitor.when(cool.PlusNode) def visit(self, node: cool.PlusNode, scope: Scope): - return self.visit_arith_node(node, scope, cil.PlusNode) + scope = node.scope + return self.visit_arith_node(node, scope, "function_add", "Int") @visitor.when(cool.MinusNode) def visit(self, node: cool.MinusNode, scope: Scope): - return self.visit_arith_node(node, scope, cil.MinusNode) + scope = node.scope + return self.visit_arith_node(node, scope, "function_sub", "Int") @visitor.when(cool.StarNode) def visit(self, node: cool.StarNode, scope: Scope): - return self.visit_arith_node(node, scope, cil.StarNode) + scope = node.scope + return self.visit_arith_node(node, scope, "function_mult", "Int") @visitor.when(cool.DivNode) def visit(self, node: cool.DivNode, scope: Scope): - return self.visit_arith_node(node, scope, cil.DivNode) + scope = node.scope + return self.visit_arith_node(node, scope, "function_div", "Int") @visitor.when(cool.LessEqualNode) def visit(self, node: cool.LessEqualNode, scope: Scope): - return self.visit_arith_node(node, scope, cil.LessEqualNode) + scope = node.scope + return self.visit_arith_node(node, scope, "function_less_than_or_equal", "Bool") @visitor.when(cool.LessThanNode) def visit(self, node: cool.LessThanNode, scope: Scope): - return self.visit_arith_node(node, scope, cil.LessThanNode) + scope = node.scope + return self.visit_arith_node(node, scope, "function_less_than", "Bool") @visitor.when(cool.EqualNode) def visit(self, node: cool.EqualNode, scope: Scope): - return self.visit_arith_node(node, scope, cil.EqualNode) + scope = node.scope + return self.visit_arith_node(node, scope, "function_equal", "Bool") def visit_arith_node( - self, node: cool.BinaryNode, scope: Scope, cil_type: type + self, node: cool.BinaryNode, scope: Scope, operation_function: str, return_type_name: str = "Int" ) -> Tuple[str, Type]: left, _ = self.visit(node.left, scope) right, _ = self.visit(node.right, scope) - dest = self.define_internal_local() - self.register_instruction(cil_type(dest, left, right)) - return dest, self.context.get_type("Int") + dest = self.define_internal_local(f"Store the result of the operation {operation_function}") + self.register_empty_instruction() + self.register_instruction(cil.ArgNode(left, 0, 2)) + self.register_instruction(cil.ArgNode(right, 1, 2)) + self.register_instruction(cil.StaticCallNode(operation_function, dest, 2)) + return dest, self.context.get_type(return_type_name) diff --git a/src/cool/semantics/position_assigner.py b/src/cool/semantics/position_assigner.py index a99b97c89..916138bc0 100644 --- a/src/cool/semantics/position_assigner.py +++ b/src/cool/semantics/position_assigner.py @@ -10,6 +10,8 @@ def __init__(self, tokens: List[Token]): self.position = 0 self.tokens = tokens + self.opar = 0 + def inc_position(self, count: int = 1): self.position += count @@ -127,6 +129,9 @@ def visit(self, node: ast.LetNode): let declaration-list in expr """ token = self.tokens[self.position] + + counter, token = self._skip_open_parentheses() + node.set_main_position(token.line, token.column) self.inc_position() @@ -153,6 +158,8 @@ def visit(self, node: ast.LetNode): self.visit(node.expr) + self._skip_closed_parentheses() + @visitor.when(ast.AssignNode) def visit(self, node: ast.AssignNode): """ @@ -176,7 +183,7 @@ def visit(self, node: ast.BlockNode): { block } """ token = self.tokens[self.position] - assert token.lex == "{", f'Expected "{{" instead of "{token.lex}" in block' + assert token.lex == "{", f'{token.line, token.column} Expected "{{" instead of "{token.lex}" in block' node.set_main_position(token.line, token.column) self.inc_position() # edns after `{` @@ -291,6 +298,9 @@ def visit(self, node: ast.MethodCallNode): """ token = self.tokens[self.position] + + counter, token = self._skip_open_parentheses() + node.set_main_position(token.line, token.column) node.id_position = token.line, token.column @@ -304,7 +314,7 @@ def visit(self, node: ast.MethodCallNode): assert token.lex in ( ".", "@", - ), f"Expected '.' or '@' instead of {token.lex}" + ), f"{token.line, token.column, counter} Expected '.' or '@' instead of {token.lex}" self.inc_position() # ends after `.` or `@` token = self.tokens[self.position] @@ -331,14 +341,16 @@ def visit(self, node: ast.MethodCallNode): self.visit(arg) token = self.tokens[self.position] - assert token.lex in ( - "," ")" - ), f"Expected ',' or ')' instead of {token.lex}" - - self.inc_position() # ends after `,` or `)` + # assert token.lex in ( + # "," ")" + # ), f"{token.line, token.column} Expected ',' or ')' instead of {token.lex}" + if token.lex == ",": + self.inc_position() # ends after `,` or `)` # ends after `)` else: self.inc_position() + + self._skip_closed_parentheses() # ends after `)` @visitor.when(ast.IntegerNode) def visit(self, node: ast.IntegerNode): @@ -362,22 +374,15 @@ def visit(self, node: ast.InstantiateNode): * new type """ - counter = 0 token = self.tokens[self.position] - - while token.lex == "(": - counter += 1 - self.inc_position() - token = self.tokens[self.position] - + _, token = self._skip_open_parentheses() node.set_main_position(token.line, token.column) token = self.tokens[self.position + 1] node.type_position = token.line, token.column self.inc_position(2) # ends after `type` - for _ in range(counter): - self.inc_position() + _, token = self._skip_closed_parentheses() @visitor.when(ast.NegationNode) def visit(self, node: ast.NegationNode): @@ -423,6 +428,8 @@ def _check_binary_operation(self, node: ast.BinaryNode): """ expr operation expr """ + self._skip_open_parentheses() + self.visit(node.left) token = self.tokens[self.position] @@ -430,11 +437,13 @@ def _check_binary_operation(self, node: ast.BinaryNode): self.inc_position() # ends after `operation` self.visit(node.right) + self._skip_closed_parentheses() def _check_unary_operation(self, node: ast.UnaryNode): """ operation expr """ + self._skip_open_parentheses() token = self.tokens[self.position] node.operation_position = token.line, token.column @@ -443,8 +452,27 @@ def _check_unary_operation(self, node: ast.UnaryNode): self.inc_position() # ends after `operation` self.visit(node.expr) + self._skip_closed_parentheses() def _atom_node(self, node: ast.Node): token = self.tokens[self.position] node.set_main_position(token.line, token.column) self.inc_position() # ends after `atom` + + def _skip_open_parentheses(self): + token = self.tokens[self.position] + while token.lex == "(": + self.opar += 1 + self.inc_position() + token = self.tokens[self.position] + + return self.opar, token + + def _skip_closed_parentheses(self): + token = self.tokens[self.position] + while token.lex == ")": + self.opar -= 1 + self.inc_position() + token = self.tokens[self.position] + + return self.opar, token \ No newline at end of file diff --git a/src/cool/semantics/type_checker.py b/src/cool/semantics/type_checker.py index 2d4f34a1d..ee5429694 100644 --- a/src/cool/semantics/type_checker.py +++ b/src/cool/semantics/type_checker.py @@ -31,6 +31,8 @@ def visit(self, node: cool.ProgramNode, scope: Scope = None): if scope is None: scope = Scope() + node.scope = scope + for elem in node.declarations: self.visit(elem, scope.create_child()) @@ -38,6 +40,7 @@ def visit(self, node: cool.ProgramNode, scope: Scope = None): @visitor.when(cool.ClassDeclarationNode) def visit(self, node: cool.ClassDeclarationNode, scope: Scope): + node.scope = scope self.current_type = self.context.get_type(node.id) attrs = [ @@ -63,6 +66,7 @@ def visit(self, node: cool.ClassDeclarationNode, scope: Scope): @visitor.when(cool.AttrDeclarationNode) def visit(self, node: cool.AttrDeclarationNode, scope: Scope): + node.scope = scope if node.id == "self": self.errors.append(err.SELF_INVALID_ATTRIBUTE_ID % (node.line, node.column)) @@ -94,6 +98,7 @@ def visit(self, node: cool.AttrDeclarationNode, scope: Scope): @visitor.when(cool.MethodDeclarationNode) def visit(self, node: cool.MethodDeclarationNode, scope: Scope): + node.scope = scope self.current_method = self.current_type.get_method(node.id) self.current_attribute = None @@ -142,6 +147,7 @@ def visit(self, node: cool.MethodDeclarationNode, scope: Scope): @visitor.when(cool.LetNode) def visit(self, node: cool.LetNode, scope: Scope): + node.scope = scope for i, (_id, _type, _expr) in enumerate(node.declarations): if _id == "self": line, column = node.declaration_names_positions[i] @@ -159,13 +165,6 @@ def visit(self, node: cool.LetNode, scope: Scope): self.errors.append(err.UNDEFINED_TYPE % (line, column, _type)) var_static_type = ErrorType() - # if scope.is_local(_id): - # feature = self.current_method or self.current_attribute - # self.errors.append( - # err.LOCAL_ALREADY_DEFINED - # % (node.line, node.column, _id, feature.name) - # ) - # else: scope.define_variable(_id, var_static_type) expr_type = ( @@ -181,6 +180,7 @@ def visit(self, node: cool.LetNode, scope: Scope): @visitor.when(cool.AssignNode) def visit(self, node: cool.AssignNode, scope: Scope): + node.scope = scope var_info = scope.find_variable(node.id) if var_info.name == "self": @@ -204,6 +204,7 @@ def visit(self, node: cool.AssignNode, scope: Scope): @visitor.when(cool.BlockNode) def visit(self, node: cool.BlockNode, scope: Scope): + node.scope = scope return_type = ErrorType() for expr in node.expressions: return_type = self.visit(expr, scope) @@ -211,6 +212,7 @@ def visit(self, node: cool.BlockNode, scope: Scope): @visitor.when(cool.ConditionalNode) def visit(self, node: cool.ConditionalNode, scope: Scope): + node.scope = scope if_type = self.visit(node.if_expr, scope) then_type = self.visit(node.then_expr, scope) else_type = self.visit(node.else_expr, scope) @@ -222,6 +224,7 @@ def visit(self, node: cool.ConditionalNode, scope: Scope): @visitor.when(cool.WhileNode) def visit(self, node: cool.WhileNode, scope: Scope): + node.scope = scope condition = self.visit(node.condition, scope) if condition != self.context.get_type("Bool"): self.errors.append( @@ -234,6 +237,7 @@ def visit(self, node: cool.WhileNode, scope: Scope): @visitor.when(cool.SwitchCaseNode) def visit(self, node: cool.SwitchCaseNode, scope: Scope): + node.scope = scope self.visit(node.expr, scope) types = [] visited = set() @@ -267,6 +271,7 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): @visitor.when(cool.MethodCallNode) def visit(self, node: cool.MethodCallNode, scope: Scope): + node.scope = scope if node.obj is None: node.obj = cool.VariableNode("self") obj_type = self.visit(node.obj, scope) @@ -332,18 +337,22 @@ def visit(self, node: cool.MethodCallNode, scope: Scope): @visitor.when(cool.IntegerNode) def visit(self, node: cool.IntegerNode, scope: Scope): + node.scope = scope return self.context.get_type("Int") @visitor.when(cool.StringNode) def visit(self, node: cool.StringNode, scope: Scope): + node.scope = scope return self.context.get_type("String") @visitor.when(cool.BooleanNode) def visit(self, node: cool.BooleanNode, scope: Scope): + node.scope = scope return self.context.get_type("Bool") @visitor.when(cool.VariableNode) def visit(self, node: cool.VariableNode, scope: Scope): + node.scope = scope variable = scope.find_variable(node.lex) if variable is None: if self.current_attribute is not None: @@ -359,6 +368,7 @@ def visit(self, node: cool.VariableNode, scope: Scope): @visitor.when(cool.InstantiateNode) def visit(self, node: cool.InstantiateNode, scope: Scope): + node.scope = scope try: return ( self.context.get_type(node.lex) @@ -372,59 +382,69 @@ def visit(self, node: cool.InstantiateNode, scope: Scope): @visitor.when(cool.NegationNode) def visit(self, node: cool.NegationNode, scope: Scope): + node.scope = scope return self._check_unary_operation( node, scope, "not", self.context.get_type("Bool") ) @visitor.when(cool.ComplementNode) def visit(self, node: cool.ComplementNode, scope: Scope): + node.scope = scope return self._check_unary_operation( node, scope, "~", self.context.get_type("Int") ) @visitor.when(cool.IsVoidNode) def visit(self, node: cool.IsVoidNode, scope: Scope): + node.scope = scope self.visit(node.expr, scope) return self.context.get_type("Bool") @visitor.when(cool.PlusNode) def visit(self, node: cool.PlusNode, scope: Scope): + node.scope = scope return self._check_int_binary_operation( node, scope, "+", self.context.get_type("Int") ) @visitor.when(cool.MinusNode) def visit(self, node: cool.MinusNode, scope: Scope): + node.scope = scope return self._check_int_binary_operation( node, scope, "-", self.context.get_type("Int") ) @visitor.when(cool.StarNode) def visit(self, node: cool.StarNode, scope: Scope): + node.scope = scope return self._check_int_binary_operation( node, scope, "*", self.context.get_type("Int") ) @visitor.when(cool.DivNode) def visit(self, node: cool.DivNode, scope: Scope): + node.scope = scope return self._check_int_binary_operation( node, scope, "/", self.context.get_type("Int") ) @visitor.when(cool.LessEqualNode) def visit(self, node: cool.LessEqualNode, scope: Scope): + node.scope = scope return self._check_int_binary_operation( node, scope, "<=", self.context.get_type("Bool") ) @visitor.when(cool.LessThanNode) def visit(self, node: cool.LessThanNode, scope: Scope): + node.scope = scope return self._check_int_binary_operation( node, scope, "<", self.context.get_type("Bool") ) @visitor.when(cool.EqualNode) def visit(self, node: cool.EqualNode, scope: Scope): + node.scope = scope left_type = self.visit(node.left, scope) right_type = self.visit(node.right, scope) diff --git a/src/cool/semantics/type_inference.py b/src/cool/semantics/type_inference.py index 1897252d4..a32ffd203 100644 --- a/src/cool/semantics/type_inference.py +++ b/src/cool/semantics/type_inference.py @@ -274,6 +274,8 @@ def visit(self, node: cool.ProgramNode, scope: Scope = None): if scope is None: scope = Scope() + node.scope = scope + for item in node.declarations: self.visit(item, scope.create_child()) @@ -284,6 +286,7 @@ def visit(self, node: cool.ProgramNode, scope: Scope = None): @visitor.when(cool.ClassDeclarationNode) def visit(self, node: cool.ClassDeclarationNode, scope: Scope): + node.scope = scope self.current_type = self.context.get_type(node.id) attrs = [ @@ -309,6 +312,7 @@ def visit(self, node: cool.ClassDeclarationNode, scope: Scope): @visitor.when(cool.AttrDeclarationNode) def visit(self, node: cool.AttrDeclarationNode, scope: Scope): + node.scope = scope if node.id == "self": if node.expr is not None: scope.create_child() @@ -349,6 +353,7 @@ def visit(self, node: cool.AttrDeclarationNode, scope: Scope): @visitor.when(cool.MethodDeclarationNode) def visit(self, node: cool.MethodDeclarationNode, scope: Scope): + node.scope = scope self.current_method = self.current_type.get_method(node.id) # Define 'self' as a variable in the scope @@ -391,6 +396,7 @@ def visit(self, node: cool.MethodDeclarationNode, scope: Scope): @visitor.when(cool.LetNode) def visit(self, node: cool.LetNode, scope: Scope): + node.scope = scope for _id, _type, _expr in node.declarations: try: # Define and get the var_info @@ -420,9 +426,10 @@ def visit(self, node: cool.LetNode, scope: Scope): @visitor.when(cool.AssignNode) def visit(self, node: cool.AssignNode, scope: Scope): + node.scope = scope var_info = scope.find_variable(node.id) - expr_node = self.visit(node.expr, scope.create_child()) + expr_node = self.visit(node.expr, scope) if var_info is not None: if expr_node.type.name != "AUTO_TYPE" and var_info.type.name == "AUTO_TYPE": @@ -446,6 +453,7 @@ def visit(self, node: cool.AssignNode, scope: Scope): @visitor.when(cool.BlockNode) def visit(self, node: cool.BlockNode, scope: Scope): + node.scope = scope result_node = None for expr in node.expressions: result_node = self.visit(expr, scope) @@ -453,13 +461,14 @@ def visit(self, node: cool.BlockNode, scope: Scope): @visitor.when(cool.ConditionalNode) def visit(self, node: cool.ConditionalNode, scope: Scope): + node.scope = scope if_node = self.visit(node.if_expr, scope) if if_node is not None and not isinstance(if_node, AtomNode): self.graph.add_edge(AtomNode(self.context.get_type("Bool")), if_node) - then_node = self.visit(node.then_expr, scope.create_child()) - else_node = self.visit(node.else_expr, scope.create_child()) + then_node = self.visit(node.then_expr, scope) + else_node = self.visit(node.else_expr, scope) if isinstance(then_node, AtomNode) and isinstance(else_node, AtomNode): return AtomNode(then_node.type.join(else_node.type)) @@ -485,12 +494,14 @@ def visit(self, node: cool.ConditionalNode, scope: Scope): @visitor.when(cool.WhileNode) def visit(self, node: cool.WhileNode, scope: Scope): + node.scope = scope self.visit(node.condition, scope) self.visit(node.body, scope) return AtomNode(self.context.get_type("Object")) @visitor.when(cool.SwitchCaseNode) def visit(self, node: cool.SwitchCaseNode, scope: Scope): + node.scope = scope self.visit(node.expr, scope) defined_nodes = [] @@ -525,6 +536,7 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): @visitor.when(cool.MethodCallNode) def visit(self, node: cool.MethodCallNode, scope: Scope): + node.scope = scope if node.obj is None: node.obj = cool.VariableNode("self") obj_node = self.visit(node.obj, scope) @@ -568,18 +580,22 @@ def visit(self, node: cool.MethodCallNode, scope: Scope): @visitor.when(cool.IntegerNode) def visit(self, node: cool.IntegerNode, scope: Scope): + node.scope = scope return AtomNode(self.context.get_type("Int")) @visitor.when(cool.StringNode) def visit(self, node: cool.StringNode, scope: Scope): + node.scope = scope return AtomNode(self.context.get_type("String")) @visitor.when(cool.BooleanNode) def visit(self, node: cool.BooleanNode, scope: Scope): + node.scope = scope return AtomNode(self.context.get_type("Bool")) @visitor.when(cool.VariableNode) def visit(self, node: cool.VariableNode, scope: Scope): + node.scope = scope variable = scope.find_variable(node.lex) if variable is not None: @@ -592,63 +608,74 @@ def visit(self, node: cool.VariableNode, scope: Scope): @visitor.when(cool.InstantiateNode) def visit(self, node: cool.InstantiateNode, scope: Scope): + node.scope = scope if node.lex in self.context.types: return AtomNode(self.context.get_type(node.lex)) return AtomNode(self.context.get_type("Object")) @visitor.when(cool.NegationNode) def visit(self, node: cool.NegationNode, scope: Scope): + node.scope = scope self.visit(node.expr, scope) return AtomNode(self.context.get_type("Bool")) @visitor.when(cool.ComplementNode) def visit(self, node: cool.ComplementNode, scope: Scope): + node.scope = scope self.visit(node.expr, scope) return AtomNode(self.context.get_type("Int")) @visitor.when(cool.IsVoidNode) def visit(self, node: cool.IsVoidNode, scope: Scope): + node.scope = scope self.visit(node.expr, scope) return AtomNode(self.context.get_type("Bool")) @visitor.when(cool.PlusNode) def visit(self, node: cool.PlusNode, scope: Scope): + node.scope = scope return self._visit_arithmetic_node( node, scope, self.context.get_type("Int"), self.context.get_type("Int") ) @visitor.when(cool.MinusNode) def visit(self, node: cool.MinusNode, scope: Scope): + node.scope = scope return self._visit_arithmetic_node( node, scope, self.context.get_type("Int"), self.context.get_type("Int") ) @visitor.when(cool.StarNode) def visit(self, node: cool.StarNode, scope: Scope): + node.scope = scope return self._visit_arithmetic_node( node, scope, self.context.get_type("Int"), self.context.get_type("Int") ) @visitor.when(cool.DivNode) def visit(self, node: cool.DivNode, scope: Scope): + node.scope = scope return self._visit_arithmetic_node( node, scope, self.context.get_type("Int"), self.context.get_type("Int") ) @visitor.when(cool.LessEqualNode) def visit(self, node: cool.LessEqualNode, scope: Scope): + node.scope = scope return self._visit_arithmetic_node( node, scope, self.context.get_type("Int"), self.context.get_type("Bool") ) @visitor.when(cool.LessThanNode) def visit(self, node: cool.LessThanNode, scope: Scope): + node.scope = scope return self._visit_arithmetic_node( node, scope, self.context.get_type("Int"), self.context.get_type("Bool") ) @visitor.when(cool.EqualNode) def visit(self, node: cool.EqualNode, scope: Scope): + node.scope = scope self.visit(node.left, scope) self.visit(node.right, scope) return AtomNode(self.context.get_type("Bool")) @@ -681,12 +708,14 @@ def visit(self, node, tabs): @visitor.when(cool.ProgramNode) def visit(self, node: cool.ProgramNode, scope: Scope): + scope = node.scope for i, elem in enumerate(node.declarations): self.visit(elem, scope.children[i]) return scope @visitor.when(cool.ClassDeclarationNode) def visit(self, node: cool.ClassDeclarationNode, scope: Scope): + scope = node.scope self.current_type = self.context.get_type(node.id) attrs = [ @@ -709,11 +738,12 @@ def visit(self, node: cool.ClassDeclarationNode, scope: Scope): self.visit(attr, scope) # print(scope.children, len(methods), i) - for i, method in enumerate(methods, i): + for i, method in enumerate(methods, start=i): self.visit(method, scope.children[i]) @visitor.when(cool.AttrDeclarationNode) def visit(self, node: cool.AttrDeclarationNode, scope: Scope): + scope = node.scope try: attr_type = self.context.get_type(node.type) var_info = scope.find_variable(node.id) @@ -730,6 +760,7 @@ def visit(self, node: cool.AttrDeclarationNode, scope: Scope): @visitor.when(cool.MethodDeclarationNode) def visit(self, node: cool.MethodDeclarationNode, scope: Scope): + scope = node.scope self.current_method = self.current_type.get_method(node.id) try: @@ -761,6 +792,7 @@ def visit(self, node: cool.MethodDeclarationNode, scope: Scope): @visitor.when(cool.LetNode) def visit(self, node: cool.LetNode, scope: Scope): + scope = node.scope child_index = 0 for i, (_id, _type, _expr) in enumerate(node.declarations): variable_info = scope.find_variable(_id) @@ -778,32 +810,38 @@ def visit(self, node: cool.LetNode, scope: Scope): @visitor.when(cool.AssignNode) def visit(self, node: cool.AssignNode, scope: Scope): - self.visit(node.expr, scope.children[0]) + scope = node.scope + self.visit(node.expr, scope) @visitor.when(cool.BlockNode) def visit(self, node: cool.BlockNode, scope: Scope): + scope = node.scope for _, expr in enumerate(node.expressions): self.visit(expr, scope) @visitor.when(cool.ConditionalNode) def visit(self, node: cool.ConditionalNode, scope: Scope): + scope = node.scope self.visit(node.if_expr, scope) self.visit(node.then_expr, scope) self.visit(node.else_expr, scope) @visitor.when(cool.WhileNode) def visit(self, node: cool.WhileNode, scope: Scope): + scope = node.scope self.visit(node.condition, scope) self.visit(node.body, scope) @visitor.when(cool.SwitchCaseNode) def visit(self, node: cool.SwitchCaseNode, scope: Scope): + scope = node.scope self.visit(node.expr, scope) for i, (_, _, _expr) in enumerate(node.cases): self.visit(_expr, scope.children[i]) @visitor.when(cool.MethodCallNode) def visit(self, node: cool.MethodCallNode, scope: Scope): + scope = node.scope self.visit(node.obj, scope) for arg in node.args: @@ -811,13 +849,15 @@ def visit(self, node: cool.MethodCallNode, scope: Scope): @visitor.when(cool.AtomicNode) def visit(self, node: cool.AtomicNode, scope: Scope): - pass + scope = node.scope @visitor.when(cool.UnaryNode) def visit(self, node: cool.UnaryNode, scope: Scope): + scope = node.scope self.visit(node.expr, scope) @visitor.when(cool.BinaryNode) def visit(self, node: cool.BinaryNode, scope: Scope): + scope = node.scope self.visit(node.left, scope) self.visit(node.right, scope) diff --git a/src/cool/semantics/utils/astnodes.py b/src/cool/semantics/utils/astnodes.py index 5f77280ea..9bf305b9f 100644 --- a/src/cool/semantics/utils/astnodes.py +++ b/src/cool/semantics/utils/astnodes.py @@ -1,11 +1,14 @@ from typing import List, Union, Tuple, Optional +from cool.semantics.utils.scope import Scope + Feature = Union["MethodDeclarationNode", "AttrDeclarationNode"] class Node: line: int column: int + scope: Scope def set_main_position(self, line: int, col: int) -> "Node": self.line = line @@ -125,6 +128,7 @@ def __init__(self, idx, args, obj=None, typex=None): class AtomicNode(ExprNode): def __init__(self, lex: str): self.lex: str = lex + self.scope = None class UnaryNode(ExprNode): diff --git a/src/io.asm b/src/io.asm new file mode 100644 index 000000000..a2e52645c --- /dev/null +++ b/src/io.asm @@ -0,0 +1,1230 @@ +.data + type_Object: .word 8 + type_Object_inherits_from: .word 0 + type_Object_attributes: .word 0 + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO: .word 8 + type_IO_inherits_from: .word type_Object + type_IO_attributes: .word 0 + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_Int: .word 8 + type_Int_inherits_from: .word type_Object + type_Int_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_String: .word 8 + type_String_inherits_from: .word type_Object + type_String_attributes: .word 0 + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Bool: .word 8 + type_Bool_inherits_from: .word type_Object + type_Bool_attributes: .word 0 + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_A: .word 12 + type_A_inherits_from: .word type_Object + type_A_attributes: .word 1 + type_A_name_size: .word 1 + type_A_name: .asciiz "A" + + type_B: .word 12 + type_B_inherits_from: .word type_A + type_B_attributes: .word 1 + type_B_name_size: .word 1 + type_B_name: .asciiz "B" + + type_C: .word 8 + type_C_inherits_from: .word type_IO + type_C_attributes: .word 0 + type_C_name_size: .word 1 + type_C_name: .asciiz "C" + + type_D: .word 8 + type_D_inherits_from: .word type_C + type_D_attributes: .word 0 + type_D_name_size: .word 1 + type_D_name: .asciiz "D" + + type_Main: .word 8 + type_Main_inherits_from: .word type_IO + type_Main_attributes: .word 0 + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + +.text + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 12($t1) # $t1 = length of the name of self + lw $t3, 16($t1) # $t1 = name of self + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + move $t4, $v0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + addi $t0, $t0, 8 # Pointer to the first character of the string in self + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t1, while_copy_name_end + lb $t6, 0($t0) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t0, $t0, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $t4, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the string x + li $v0, 1 + lw $a0, 0($sp) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lw $t1, buffer_input($t0) # Loading the byte + beq $t1, $zero, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lw $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 5 + syscall + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + sw $t1, 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 0($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 0($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + lw $t2, 8($sp) # $t2 = start of the substring + lw $t3, 4($sp) # $t3 = length of the substring + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bge $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_A: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating IO + li $v0, 9 + lw $a0, type_IO + syscall + la $t0, type_IO # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 0($sp) # internal_0 = address of allocated object IO + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 8($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_IO + jal function___init___at_IO + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_0 = result of function___init___at_IO + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute io of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.io = internal_0 + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_out_a_at_A: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + # Get attribute io of self + lw $t0, 12($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'io' from the instance + sw $t1, 8($sp) # internal_0 = io + + # Allocating String + li $v0, 9 + addi $a0, $zero, 24 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 15 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_1[0] = 'A' + + addi $t0, $zero, 58 + sb $t0, 9($v0) # internal_1[1] = ':' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_1[2] = ' ' + + addi $t0, $zero, 72 + sb $t0, 11($v0) # internal_1[3] = 'H' + + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_1[4] = 'e' + + addi $t0, $zero, 108 + sb $t0, 13($v0) # internal_1[5] = 'l' + + addi $t0, $zero, 108 + sb $t0, 14($v0) # internal_1[6] = 'l' + + addi $t0, $zero, 111 + sb $t0, 15($v0) # internal_1[7] = 'o' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_1[8] = ' ' + + addi $t0, $zero, 119 + sb $t0, 17($v0) # internal_1[9] = 'w' + + addi $t0, $zero, 111 + sb $t0, 18($v0) # internal_1[10] = 'o' + + addi $t0, $zero, 114 + sb $t0, 19($v0) # internal_1[11] = 'r' + + addi $t0, $zero, 108 + sb $t0, 20($v0) # internal_1[12] = 'l' + + addi $t0, $zero, 100 + sb $t0, 21($v0) # internal_1[13] = 'd' + + addi $t0, $zero, 10 + sb $t0, 22($v0) # internal_1[14] = '\n' + + sb $zero, 23($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_1 = "A: Hello world\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_2 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + function___init___at_B: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating IO + li $v0, 9 + lw $a0, type_IO + syscall + la $t0, type_IO # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 0($sp) # internal_0 = address of allocated object IO + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 8($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_IO + jal function___init___at_IO + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_0 = result of function___init___at_IO + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute io of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.io = internal_0 + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_out_b_at_B: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + # Get attribute io of self + lw $t0, 12($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'io' from the instance + sw $t1, 8($sp) # internal_0 = io + + # Allocating String + li $v0, 9 + addi $a0, $zero, 24 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 15 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 66 + sb $t0, 8($v0) # internal_1[0] = 'B' + + addi $t0, $zero, 58 + sb $t0, 9($v0) # internal_1[1] = ':' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_1[2] = ' ' + + addi $t0, $zero, 72 + sb $t0, 11($v0) # internal_1[3] = 'H' + + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_1[4] = 'e' + + addi $t0, $zero, 108 + sb $t0, 13($v0) # internal_1[5] = 'l' + + addi $t0, $zero, 108 + sb $t0, 14($v0) # internal_1[6] = 'l' + + addi $t0, $zero, 111 + sb $t0, 15($v0) # internal_1[7] = 'o' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_1[8] = ' ' + + addi $t0, $zero, 119 + sb $t0, 17($v0) # internal_1[9] = 'w' + + addi $t0, $zero, 111 + sb $t0, 18($v0) # internal_1[10] = 'o' + + addi $t0, $zero, 114 + sb $t0, 19($v0) # internal_1[11] = 'r' + + addi $t0, $zero, 108 + sb $t0, 20($v0) # internal_1[12] = 'l' + + addi $t0, $zero, 100 + sb $t0, 21($v0) # internal_1[13] = 'd' + + addi $t0, $zero, 10 + sb $t0, 22($v0) # internal_1[14] = '\n' + + sb $zero, 23($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_1 = "B: Hello world\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_2 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + function___init___at_C: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_c_at_C: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 24 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 15 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_0[0] = 'C' + + addi $t0, $zero, 58 + sb $t0, 9($v0) # internal_0[1] = ':' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_0[2] = ' ' + + addi $t0, $zero, 72 + sb $t0, 11($v0) # internal_0[3] = 'H' + + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_0[4] = 'e' + + addi $t0, $zero, 108 + sb $t0, 13($v0) # internal_0[5] = 'l' + + addi $t0, $zero, 108 + sb $t0, 14($v0) # internal_0[6] = 'l' + + addi $t0, $zero, 111 + sb $t0, 15($v0) # internal_0[7] = 'o' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_0[8] = ' ' + + addi $t0, $zero, 119 + sb $t0, 17($v0) # internal_0[9] = 'w' + + addi $t0, $zero, 111 + sb $t0, 18($v0) # internal_0[10] = 'o' + + addi $t0, $zero, 114 + sb $t0, 19($v0) # internal_0[11] = 'r' + + addi $t0, $zero, 108 + sb $t0, 20($v0) # internal_0[12] = 'l' + + addi $t0, $zero, 100 + sb $t0, 21($v0) # internal_0[13] = 'd' + + addi $t0, $zero, 10 + sb $t0, 22($v0) # internal_0[14] = '\n' + + sb $zero, 23($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_0 = "C: Hello world\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_1 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function___init___at_D: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_d_at_D: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 24 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 15 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 68 + sb $t0, 8($v0) # internal_0[0] = 'D' + + addi $t0, $zero, 58 + sb $t0, 9($v0) # internal_0[1] = ':' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_0[2] = ' ' + + addi $t0, $zero, 72 + sb $t0, 11($v0) # internal_0[3] = 'H' + + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_0[4] = 'e' + + addi $t0, $zero, 108 + sb $t0, 13($v0) # internal_0[5] = 'l' + + addi $t0, $zero, 108 + sb $t0, 14($v0) # internal_0[6] = 'l' + + addi $t0, $zero, 111 + sb $t0, 15($v0) # internal_0[7] = 'o' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_0[8] = ' ' + + addi $t0, $zero, 119 + sb $t0, 17($v0) # internal_0[9] = 'w' + + addi $t0, $zero, 111 + sb $t0, 18($v0) # internal_0[10] = 'o' + + addi $t0, $zero, 114 + sb $t0, 19($v0) # internal_0[11] = 'r' + + addi $t0, $zero, 108 + sb $t0, 20($v0) # internal_0[12] = 'l' + + addi $t0, $zero, 100 + sb $t0, 21($v0) # internal_0[13] = 'd' + + addi $t0, $zero, 10 + sb $t0, 22($v0) # internal_0[14] = '\n' + + sb $zero, 23($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_0 = "D: Hello world\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_1 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 44($sp) + # self = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating A + li $v0, 9 + lw $a0, type_A + syscall + la $t0, type_A # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 36($sp) # internal_0 = address of allocated object A + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_A + jal function___init___at_A + lw $ra, 4($sp) + sw $v1, 44($sp) # internal_0 = result of function___init___at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_out_a_at_A + jal function_out_a_at_A + lw $ra, 4($sp) + sw $v1, 40($sp) # internal_1 = result of function_out_a_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating B + li $v0, 9 + lw $a0, type_B + syscall + la $t0, type_B # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 28($sp) # internal_2 = address of allocated object B + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_2 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function___init___at_B + jal function___init___at_B + lw $ra, 4($sp) + sw $v1, 36($sp) # internal_2 = result of function___init___at_B + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_2 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_out_b_at_B + jal function_out_b_at_B + lw $ra, 4($sp) + sw $v1, 32($sp) # internal_3 = result of function_out_b_at_B + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating C + li $v0, 9 + lw $a0, type_C + syscall + la $t0, type_C # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 20($sp) # internal_4 = address of allocated object C + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_4 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function___init___at_C + jal function___init___at_C + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_4 = result of function___init___at_C + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_4 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_out_c_at_C + jal function_out_c_at_C + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_5 = result of function_out_c_at_C + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating D + li $v0, 9 + lw $a0, type_D + syscall + la $t0, type_D # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_6 = address of allocated object D + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_6 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function___init___at_D + jal function___init___at_D + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_6 = result of function___init___at_D + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_6 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_out_d_at_D + jal function_out_d_at_D + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_7 = result of function_out_d_at_D + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 15 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 6 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 68 + sb $t0, 8($v0) # internal_8[0] = 'D' + + addi $t0, $zero, 111 + sb $t0, 9($v0) # internal_8[1] = 'o' + + addi $t0, $zero, 110 + sb $t0, 10($v0) # internal_8[2] = 'n' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_8[3] = 'e' + + addi $t0, $zero, 46 + sb $t0, 12($v0) # internal_8[4] = '.' + + addi $t0, $zero, 10 + sb $t0, 13($v0) # internal_8[5] = '\n' + + sb $zero, 14($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_8 = "Done.\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_8 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_9 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_main_at_Main + jal function_main_at_Main + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/src/io.cil b/src/io.cil new file mode 100644 index 000000000..a9898adc6 --- /dev/null +++ b/src/io.cil @@ -0,0 +1,371 @@ +.TYPES +type Object { + inherits from null + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method __init__: function___init___at_Object +} +type IO { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method out_string: function_out_string_at_IO + method out_int: function_out_int_at_IO + method in_string: function_in_string_at_IO + method in_int: function_in_int_at_IO + method __init__: function___init___at_IO +} +type Int { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method __init__: function___init___at_Int +} +type String { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method length: function_length_at_String + method concat: function_concat_at_String + method substr: function_substr_at_String + method __init__: function___init___at_String +} +type Bool { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method __init__: function___init___at_Bool +} +type A { + inherits from Object + + attribute io + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method out_a: function_out_a_at_A + method __init__: function___init___at_A +} +type B { + inherits from A + + attribute io + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method out_a: function_out_a_at_A + method __init__: function___init___at_B + method out_b: function_out_b_at_B +} +type C { + inherits from IO + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method out_string: function_out_string_at_IO + method out_int: function_out_int_at_IO + method in_string: function_in_string_at_IO + method in_int: function_in_int_at_IO + method out_c: function_out_c_at_C + method __init__: function___init___at_C +} +type D { + inherits from C + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method out_string: function_out_string_at_IO + method out_int: function_out_int_at_IO + method in_string: function_in_string_at_IO + method in_int: function_in_int_at_IO + method out_c: function_out_c_at_C + method __init__: function___init___at_D + method out_d: function_out_d_at_D +} +type Main { + inherits from IO + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method out_string: function_out_string_at_IO + method out_int: function_out_int_at_IO + method in_string: function_in_string_at_IO + method in_int: function_in_int_at_IO + method main: function_main_at_Main + method __init__: function___init___at_Main +} + +.DATA + + +.CODE +function function___init___at_Object{ + PARAM self + + RETURN self +} +function function_abort_at_Object{ + PARAM self + + HALT + + RETURN self +} +function function_type_name_at_Object{ + PARAM self + + LOCAL internal_0 # type_name + + internal_0 = TYPENAME self + + RETURN internal_0 +} +function function_copy_at_Object{ + PARAM self + + LOCAL internal_0 + + internal_0 = COPY self + + RETURN internal_0 +} +function function___init___at_IO{ + PARAM self + + RETURN self +} +function function_out_string_at_IO{ + PARAM self + PARAM x + + PRINTSTR x + + RETURN self +} +function function_out_int_at_IO{ + PARAM self + PARAM x + + PRINTINT x + + RETURN self +} +function function_in_string_at_IO{ + PARAM self + + LOCAL internal_0 + + READSTR internal_0 + + RETURN internal_0 +} +function function_in_int_at_IO{ + PARAM self + + LOCAL internal_0 + + READINT internal_0 + + RETURN internal_0 +} +function function___init___at_String{ + PARAM self + + RETURN self +} +function function_length_at_String{ + PARAM self + + LOCAL internal_0 + + internal_0 = LENGTH self + + RETURN internal_0 +} +function function_concat_at_String{ + PARAM self + PARAM s + + LOCAL internal_0 + + internal_0 = CONCAT self s + + RETURN internal_0 +} +function function_substr_at_String{ + PARAM self + PARAM i + PARAM l + + LOCAL internal_0 + + internal_0 = SUBSTRING self i l + + RETURN internal_0 +} +function function___init___at_A{ + PARAM self + + LOCAL internal_0 # Store an instance of the class IO + + internal_0 = ALLOCATE IO # Allocate the object IO + ARG internal_0 # Pass the instance to the constructor + internal_0 = VCALL IO function___init___at_IO # Call the constructor + SETATTR self io internal_0 + + RETURN self +} +function function_out_a_at_A{ + PARAM self + + LOCAL internal_0 + LOCAL internal_1 # String "A: Hello world\n" + LOCAL internal_2 + + internal_0 = GETATTR self io + internal_1 = ALLOCSTR "A: Hello world\n" + ARG internal_0 + ARG internal_1 + internal_2 = VCALL IO function_out_string_at_IO + + RETURN internal_2 +} +function function___init___at_B{ + PARAM self + + LOCAL internal_0 # Store an instance of the class IO + + internal_0 = ALLOCATE IO # Allocate the object IO + ARG internal_0 # Pass the instance to the constructor + internal_0 = VCALL IO function___init___at_IO # Call the constructor + SETATTR self io internal_0 + + RETURN self +} +function function_out_b_at_B{ + PARAM self + + LOCAL internal_0 + LOCAL internal_1 # String "B: Hello world\n" + LOCAL internal_2 + + internal_0 = GETATTR self io + internal_1 = ALLOCSTR "B: Hello world\n" + ARG internal_0 + ARG internal_1 + internal_2 = VCALL IO function_out_string_at_IO + + RETURN internal_2 +} +function function___init___at_C{ + PARAM self + + RETURN self +} +function function_out_c_at_C{ + PARAM self + + LOCAL internal_0 # String "C: Hello world\n" + LOCAL internal_1 + + internal_0 = ALLOCSTR "C: Hello world\n" + ARG self + ARG internal_0 + internal_1 = VCALL C function_out_string_at_IO + + RETURN internal_1 +} +function function___init___at_D{ + PARAM self + + RETURN self +} +function function_out_d_at_D{ + PARAM self + + LOCAL internal_0 # String "D: Hello world\n" + LOCAL internal_1 + + internal_0 = ALLOCSTR "D: Hello world\n" + ARG self + ARG internal_0 + internal_1 = VCALL D function_out_string_at_IO + + RETURN internal_1 +} +function function___init___at_Main{ + PARAM self + + RETURN self +} +function function_main_at_Main{ + PARAM self + + LOCAL internal_0 # Store an instance of the class A + LOCAL internal_1 + LOCAL internal_2 # Store an instance of the class B + LOCAL internal_3 + LOCAL internal_4 # Store an instance of the class C + LOCAL internal_5 + LOCAL internal_6 # Store an instance of the class D + LOCAL internal_7 + LOCAL internal_8 # String "Done.\n" + LOCAL internal_9 + + internal_0 = ALLOCATE A # Allocate the object A + ARG internal_0 # Pass the instance to the constructor + internal_0 = VCALL A function___init___at_A # Call the constructor + ARG internal_0 + internal_1 = VCALL A function_out_a_at_A + internal_2 = ALLOCATE B # Allocate the object B + ARG internal_2 # Pass the instance to the constructor + internal_2 = VCALL B function___init___at_B # Call the constructor + ARG internal_2 + internal_3 = VCALL B function_out_b_at_B + internal_4 = ALLOCATE C # Allocate the object C + ARG internal_4 # Pass the instance to the constructor + internal_4 = VCALL C function___init___at_C # Call the constructor + ARG internal_4 + internal_5 = VCALL C function_out_c_at_C + internal_6 = ALLOCATE D # Allocate the object D + ARG internal_6 # Pass the instance to the constructor + internal_6 = VCALL D function___init___at_D # Call the constructor + ARG internal_6 + internal_7 = VCALL D function_out_d_at_D + internal_8 = ALLOCSTR "Done.\n" + ARG self + ARG internal_8 + internal_9 = VCALL Main function_out_string_at_IO + + RETURN internal_9 +} +function main{ + + + LOCAL internal_0 + LOCAL internal_1 + + internal_0 = ALLOCATE Main + ARG internal_0 + internal_0 = VCALL Main function___init___at_Main + + ARG internal_0 + internal_1 = VCALL Main function_main_at_Main + + HALT +} \ No newline at end of file diff --git a/src/io.cl b/src/io.cl new file mode 100755 index 000000000..3e5ef4a94 --- /dev/null +++ b/src/io.cl @@ -0,0 +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"); + } + }; + +}; diff --git a/src/logs.txt b/src/logs.txt new file mode 100644 index 000000000..fc0e9b168 --- /dev/null +++ b/src/logs.txt @@ -0,0 +1,253 @@ +r +{ + self: Main + children (6): [ + { + children (0): [ + + ] + }, + { + children (0): [ + + ] + }, + { + children (0): [ + + ] + }, + { + children (0): [ + + ] + }, + { + children (2): [ + { + children (0): [ + + ] + }, + { + children (0): [ + + ] + }, + + ] + }, + { + children (2): [ + { + children (3): [ + { + c: C + children (1): [ + { + children (0): [ + + ] + }, + + ] + }, + { + a: A + children (1): [ + { + children (0): [ + + ] + }, + + ] + }, + { + o: Object + children (0): [ + + ] + }, + + ] + }, + { + children (2): [ + { + children (2): [ + { + children (0): [ + + ] + }, + { + children (0): [ + + ] + }, + + ] + }, + { + children (2): [ + { + children (1): [ + { + children (0): [ + + ] + }, + + ] + }, + { + children (2): [ + { + children (1): [ + { + children (0): [ + + ] + }, + + ] + }, + { + children (2): [ + { + children (1): [ + { + children (0): [ + + ] + }, + + ] + }, + { + children (2): [ + { + children (2): [ + { + children (0): [ + + ] + }, + { + children (0): [ + + ] + }, + + ] + }, + { + children (2): [ + { + x: A + children (1): [ + { + r: Int + children (4): [ + { + children (0): [ + + ] + }, + { + children (0): [ + + ] + }, + { + a: A2I + children (2): [ + { + children (0): [ + + ] + }, + { + children (0): [ + + ] + }, + + ] + }, + { + children (0): [ + + ] + }, + + ] + }, + + ] + }, + { + children (2): [ + { + children (1): [ + { + children (0): [ + + ] + }, + + ] + }, + { + children (2): [ + { + children (1): [ + { + children (0): [ + + ] + }, + + ] + }, + { + children (1): [ + { + children (0): [ + + ] + }, + + ] + }, + + ] + }, + + ] + }, + + ] + }, + + ] + }, + + ] + }, + + ] + }, + + ] + }, + + ] + }, + + ] + }, + + ] +} diff --git a/src/main.asm b/src/main.asm index 077a42ef9..604cc7cb2 100644 --- a/src/main.asm +++ b/src/main.asm @@ -29,15 +29,477 @@ type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" - type_Main: .word 16 - type_Main_inherits_from: .word type_Object - type_Main_attributes: .word 2 + type_Main: .word 8 + type_Main_inherits_from: .word type_IO + type_Main_attributes: .word 0 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" .text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 40($sp) + # a = 36($sp) + # b = 32($sp) + + # Reserving space for local variables + addi $sp, $sp, -32 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_0 = address of allocated object Int + + # internal_1 = typeof a that is the first word of the object + lw $t0, 36($sp) + lw $t1, 0($t0) + sw $t1, 24($sp) + + # internal_2 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_3 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_4 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_7 = address of allocated object Int + + # internal_5 = EqualAddress(internal_1, internal_2) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_1, internal_3) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_7 = EqualAddress(internal_1, internal_4) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_6 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_7 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 36($sp) + lw $t0, 8($t0) + lw $t1, 32($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 36($sp) + lw $t1, 32($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 28($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 28($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 36($sp) # Save in $t0 the left operand address + lw $t1, 32($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 28($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 28($sp) + + # Freeing space for local variables + addi $sp, $sp, 32 + + jr $ra + function___init___at_Object: # Function parameters # $ra = 4($sp) @@ -91,15 +553,15 @@ addi $t4, $t4, 8 # Pointer to the first character of the string addi $t0, $t0, 8 # Pointer to the first character of the string in self xor $t5, $t5, $t5 # Initializing counter - while_copy_start: - beq $t5, $t1, while_copy_end + while_copy_name_start: + beq $t5, $t1, while_copy_name_end lb $t6, 0($t0) # Loading the character sb $t6, 0($t4) addi $t4, $t4, 1 # Incrementing the pointer to the new string addi $t0, $t0, 1 # Incrementing the pointer to the string in self addi $t5, $t5, 1 # Incrementing counter - j while_copy_start - while_copy_end: + j while_copy_name_start + while_copy_name_end: sb $zero, 0($t4) # Setting the null byte @@ -195,11 +657,10 @@ # self = 4($sp) # x = 0($sp) - lw $t0, 0($sp) # $t0 = x - # Printing the string x li $v0, 1 - lw $a0, 8($t0) + lw $a0, 0($sp) + lw $a0, 8($a0) syscall # Loading return value in $v1 @@ -391,7 +852,7 @@ lw $t1, 4($t0) # $t1 = length of the string lw $t2, 8($sp) # $t2 = start of the substring lw $t3, 4($sp) # $t3 = length of the substring - add t4, $t2, $t3 # $t4 = start of the substring + length of the substring + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring bge $t4, $t1, substring_out_of_bounds @@ -446,16 +907,6 @@ # $ra = 4($sp) # self = 0($sp) - # Set attribute number of self - lw $t0, 0($sp) # $t0 = self - addi $t1, $zero, 0 # $t1 0 - sw $t1, 8($t0) # Set the attribute number of self - - # Set attribute data of self - lw $t0, 0($sp) # $t0 = self - addi $t1, $zero, 2 # $t1 2 - sw $t1, 12($t0) # Set the attribute data of self - # Loading return value in $v1 lw $v1, 0($sp) @@ -463,113 +914,107 @@ function_main_at_Main: # Function parameters - # $ra = 16($sp) - # self = 12($sp) + # $ra = 28($sp) + # self = 24($sp) # Reserving space for local variables - addi $sp, $sp, -12 + addi $sp, $sp, -24 - # Allocating IO + # Allocating Int 2 li $v0, 9 - lw $a0, type_IO + addi $a0, $zero, 12 syscall - la $t0, type_IO # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 8($sp) # internal_0 = address of allocated object IO - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 16($sp) - sw $t1, 0($sp) # Storing internal_0 - # Calling function function___init___at_IO - jal function___init___at_IO - sw $v1, 16($sp) # internal_0 = result of function___init___at_IO - addi $sp, $sp, 8 # Freeing space for arguments + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_0 = address of allocated object Int - # Allocating String + # Allocating Int 2 li $v0, 9 - addi $a0, $zero, 23 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_1 = address of allocated object Int - addi $t0, $zero, 14 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 72 - sb $t1, 8($v0) # internal_1[0] = 'H' - - addi $t0, $zero, 101 - sb $t1, 9($v0) # internal_1[1] = 'e' - - addi $t0, $zero, 108 - sb $t1, 10($v0) # internal_1[2] = 'l' - - addi $t0, $zero, 108 - sb $t1, 11($v0) # internal_1[3] = 'l' - - addi $t0, $zero, 111 - sb $t1, 12($v0) # internal_1[4] = 'o' - - addi $t0, $zero, 44 - sb $t1, 13($v0) # internal_1[5] = ',' - - addi $t0, $zero, 32 - sb $t1, 14($v0) # internal_1[6] = ' ' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 87 - sb $t1, 15($v0) # internal_1[7] = 'W' + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_0 - addi $t0, $zero, 111 - sb $t1, 16($v0) # internal_1[8] = 'o' + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 - addi $t0, $zero, 114 - sb $t1, 17($v0) # internal_1[9] = 'r' + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 108 - sb $t1, 18($v0) # internal_1[10] = 'l' + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 100 - sb $t1, 19($v0) # internal_1[11] = 'd' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_3 = address of allocated object Int - addi $t0, $zero, 33 - sb $t1, 20($v0) # internal_1[12] = '!' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 10 - sb $t1, 21($v0) # internal_1[13] = '\n' + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 - sb $zero, 22($v0) # Null-terminator at the end of the string + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 - sw $v0, 4($sp) # internal_1 = "Hello, World!\n" + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_4 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_0 - lw $t0, 20($sp) - sw $t1, 4($sp) # Storing internal_0 + # Argument self + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing self - # Argument internal_1 + # Argument internal_4 lw $t0, 16($sp) - sw $t1, 0($sp) # Storing internal_1 + sw $t0, 0($sp) # Storing internal_4 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - sw $v1, 12($sp) # internal_2 = result of function_out_string_at_IO + # Calling function function_out_int_at_IO + jal function_out_int_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_5 = result of function_out_int_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 lw $v1, 0($sp) # Freeing space for local variables - addi $sp, $sp, 12 + addi $sp, $sp, 24 jr $ra @@ -592,10 +1037,11 @@ # Argument internal_0 lw $t0, 12($sp) - sw $t1, 0($sp) # Storing internal_0 + sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_Main jal function___init___at_Main + lw $ra, 4($sp) sw $v1, 12($sp) # internal_0 = result of function___init___at_Main addi $sp, $sp, 8 # Freeing space for arguments @@ -605,10 +1051,11 @@ # Argument internal_0 lw $t0, 12($sp) - sw $t1, 0($sp) # Storing internal_0 + sw $t0, 0($sp) # Storing internal_0 # Calling function function_main_at_Main jal function_main_at_Main + lw $ra, 4($sp) sw $v1, 8($sp) # internal_1 = result of function_main_at_Main addi $sp, $sp, 8 # Freeing space for arguments diff --git a/src/main.cil b/src/main.cil index 0af38dd0b..e379ab08d 100644 --- a/src/main.cil +++ b/src/main.cil @@ -47,14 +47,15 @@ type Bool { method __init__: function___init___at_Bool } type Main { - inherits from Object - - attribute number - attribute data + inherits from IO method abort: function_abort_at_Object method type_name: function_type_name_at_Object method copy: function_copy_at_Object + method out_string: function_out_string_at_IO + method out_int: function_out_int_at_IO + method in_string: function_in_string_at_IO + method in_int: function_in_int_at_IO method main: function_main_at_Main method __init__: function___init___at_Main } @@ -63,6 +64,129 @@ type Main { .CODE +function function_add{ + PARAM a + PARAM b + + LOCAL internal_0 # Adding result + + internal_0 = ALLOCINT 0 + internal_0 = a + b + + RETURN internal_0 +} +function function_sub{ + PARAM a + PARAM b + + LOCAL internal_0 # Substracting result + + internal_0 = ALLOCINT 0 + internal_0 = a - b + + RETURN internal_0 +} +function function_mult{ + PARAM a + PARAM b + + LOCAL internal_0 # Multiting result + + internal_0 = ALLOCINT 0 + internal_0 = a * b + + RETURN internal_0 +} +function function_div{ + PARAM a + PARAM b + + LOCAL internal_0 # Dividing result + + internal_0 = ALLOCINT 0 + internal_0 = a / b + + RETURN internal_0 +} +function function_xor{ + PARAM a + PARAM b + + LOCAL internal_0 # Xor result + + internal_0 = ALLOCINT 0 + internal_0 = XOR a b + + RETURN internal_0 +} +function function_less_than{ + PARAM a + PARAM b + + LOCAL internal_0 # Less than result + + internal_0 = ALLOCBOOL 0 + internal_0 = a < b + + RETURN internal_0 +} +function function_less_than_or_equal{ + PARAM a + PARAM b + + LOCAL internal_0 # Less than or equal result + + internal_0 = ALLOCBOOL 0 + internal_0 = a <= b + + RETURN internal_0 +} +function function_equal{ + PARAM a + PARAM b + + LOCAL internal_0 # Equal result + LOCAL internal_1 # Type of a + LOCAL internal_2 # Type Int + LOCAL internal_3 # Type Bool + LOCAL internal_4 # Type String + LOCAL internal_5 # Type of a equals int + LOCAL internal_6 # Type of a equals bool + LOCAL internal_7 # Type of a equals string + + internal_0 = ALLOCBOOL 0 + internal_1 = TYPEOF a + internal_2 = TYPEADDR Int + internal_3 = TYPEADDR Bool + internal_4 = TYPEADDR String + internal_5 = ALLOCBOOL 0 + internal_6 = ALLOCBOOL 0 + internal_7 = ALLOCBOOL 0 + internal_5 = EQUALADDR internal_1 internal_2 + internal_6 = EQUALADDR internal_1 internal_3 + internal_7 = EQUALADDR internal_1 internal_4 + + IF internal_5 GOTO a_is_type_int_or_bool + IF internal_6 GOTO a_is_type_int_or_bool + IF internal_7 GOTO a_is_type_string + GOTO a_is_type_object + + a_is_type_int_or_bool: + internal_0 = EQUALINT a b + GOTO end_of_equal + + a_is_type_string: + internal_0 = EQUALSTR a b + GOTO end_of_equal + + a_is_type_object: + internal_0 = a == b + GOTO end_of_equal + + end_of_equal: + + RETURN internal_0 +} function function___init___at_Object{ PARAM self @@ -169,28 +293,35 @@ function function_substr_at_String{ } function function___init___at_Main{ PARAM self - - SETATTR self number 0 - SETATTR self data 2 RETURN self } function function_main_at_Main{ PARAM self - LOCAL internal_0 # Store an instance of the class IO - LOCAL internal_1 # String "Hello, World!\n" - LOCAL internal_2 + LOCAL internal_0 # Integer 2 + LOCAL internal_1 # Integer 2 + LOCAL internal_2 # Store the result of the operation function_add + LOCAL internal_3 # Integer 2 + LOCAL internal_4 # Store the result of the operation function_mult + LOCAL internal_5 - internal_0 = ALLOCATE IO # Allocate the object IO - ARG internal_0 # Pass the instance to the constructor - internal_0 = VCALL IO function___init___at_IO # Call the constructor - internal_1 = ALLOCSTR "Hello, World!\n" + internal_0 = ALLOCINT 2 + internal_1 = ALLOCINT 2 + ARG internal_0 ARG internal_1 - internal_2 = VCALL IO function_out_string_at_IO + internal_2 = CALL function_add + internal_3 = ALLOCINT 2 + + ARG internal_2 + ARG internal_3 + internal_4 = CALL function_mult + ARG self + ARG internal_4 + internal_5 = VCALL Main function_out_int_at_IO - RETURN internal_2 + RETURN internal_5 } function main{ diff --git a/src/main.cl b/src/main.cl index ba352b2c6..6c0fae74f 100644 --- a/src/main.cl +++ b/src/main.cl @@ -52,17 +52,10 @@ class Point3D inherits Point { }; *) -class Main { - number: Int <- 0; - data: Int <- 2; - +class Main inherits IO { main() : Object { - -- let s: String <- "Hello, World!\n", x: Int <- 0 in { - -- x <- number + data; - -- self.out_string(s); - -- } - - (new IO).out_string("Hello, World!\n") + -- out_string("Hello, World!\n") + out_int((2 + 2) * 2) }; -- plus(a: Int, b: Int) : Int { diff --git a/tests/codegen/arith.mips b/tests/codegen/arith.mips new file mode 100644 index 000000000..f54b67128 --- /dev/null +++ b/tests/codegen/arith.mips @@ -0,0 +1,15302 @@ +.data + type_Object: .word 8 + type_Object_inherits_from: .word 0 + type_Object_attributes: .word 0 + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO: .word 8 + type_IO_inherits_from: .word type_Object + type_IO_attributes: .word 0 + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_Int: .word 8 + type_Int_inherits_from: .word type_Object + type_Int_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_String: .word 8 + type_String_inherits_from: .word type_Object + type_String_attributes: .word 0 + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Bool: .word 8 + type_Bool_inherits_from: .word type_Object + type_Bool_attributes: .word 0 + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_A: .word 12 + type_A_inherits_from: .word type_Object + type_A_attributes: .word 1 + type_A_name_size: .word 1 + type_A_name: .asciiz "A" + + type_B: .word 12 + type_B_inherits_from: .word type_A + type_B_attributes: .word 1 + type_B_name_size: .word 1 + type_B_name: .asciiz "B" + + type_C: .word 12 + type_C_inherits_from: .word type_B + type_C_attributes: .word 1 + type_C_name_size: .word 1 + type_C_name: .asciiz "C" + + type_D: .word 12 + type_D_inherits_from: .word type_B + type_D_attributes: .word 1 + type_D_name_size: .word 1 + type_D_name: .asciiz "D" + + type_E: .word 12 + type_E_inherits_from: .word type_D + type_E_attributes: .word 1 + type_E_name_size: .word 1 + type_E_name: .asciiz "E" + + type_A2I: .word 8 + type_A2I_inherits_from: .word type_Object + type_A2I_attributes: .word 0 + type_A2I_name_size: .word 3 + type_A2I_name: .asciiz "A2I" + + type_Main: .word 24 + type_Main_inherits_from: .word type_IO + type_Main_attributes: .word 4 + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 40($sp) + # a = 36($sp) + # b = 32($sp) + + # Reserving space for local variables + addi $sp, $sp, -32 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_0 = address of allocated object Int + + # internal_1 = typeof a that is the first word of the object + lw $t0, 36($sp) + lw $t1, 0($t0) + sw $t1, 24($sp) + + # internal_2 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_3 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_4 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_7 = address of allocated object Int + + # internal_5 = EqualAddress(internal_1, internal_2) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_1, internal_3) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_7 = EqualAddress(internal_1, internal_4) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_6 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_7 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 36($sp) + lw $t0, 8($t0) + lw $t1, 32($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 36($sp) + lw $t1, 32($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 28($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 28($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 36($sp) # Save in $t0 the left operand address + lw $t1, 32($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 28($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 28($sp) + + # Freeing space for local variables + addi $sp, $sp, 32 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 12($t1) # $t1 = length of the name of self + lw $t3, 16($t1) # $t1 = name of self + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + move $t4, $v0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + addi $t0, $t0, 8 # Pointer to the first character of the string in self + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t1, while_copy_name_end + lb $t6, 0($t0) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t0, $t0, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $t4, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the string x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lw $t1, buffer_input($t0) # Loading the byte + beq $t1, $zero, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lw $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 5 + syscall + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + sw $t1, 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 0($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 0($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + lw $t2, 8($sp) # $t2 = start of the substring + lw $t3, 4($sp) # $t3 = length of the substring + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bge $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_A: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.var = internal_0 + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_value_at_A: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute var of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'var' from the instance + sw $t1, 0($sp) # internal_0 = var + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_set_var_at_A: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # num = 0($sp) + + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = num + sw $t1, 8($t0) # self.var = num + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_method1_at_A: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # num = 0($sp) + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_method2_at_A: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + # num1 = 20($sp) + # num2 = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num1 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing num1 + + # Argument num2 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing num2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_1 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 12($sp) + j end_assign + not_is_Bool_or_Int: + # x = internal_1 + lw $t0, 8($sp) + sw $t0, 12($sp) + end_assign: + + # Allocating B + li $v0, 9 + lw $a0, type_B + syscall + la $t0, type_B # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_2 = address of allocated object B + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_2 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function___init___at_B + jal function___init___at_B + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_2 = result of function___init___at_B + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument x + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_method3_at_A: + # Function parameters + # $ra = 32($sp) + # self = 28($sp) + # num = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Xor operation + lw $t0, 24($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 12($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 8($sp) # $t0 = internal_3 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 16($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 8($sp) # $t0 = internal_3 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 20($sp) + j end_assign + not_is_Bool_or_Int: + # x = internal_3 + lw $t0, 8($sp) + sw $t0, 20($sp) + end_assign: + + # Allocating C + li $v0, 9 + lw $a0, type_C + syscall + la $t0, type_C # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_4 = address of allocated object C + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_4 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function___init___at_C + jal function___init___at_C + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_4 = result of function___init___at_C + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument x + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_5 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_method4_at_A: + # Function parameters + # $ra = 56($sp) + # self = 52($sp) + # num1 = 48($sp) + # num2 = 44($sp) + + # Reserving space for local variables + addi $sp, $sp, -44 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num2 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing num2 + + # Argument num1 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing num1 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_2 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 32($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 36($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_2 + lw $t0, 32($sp) + sw $t0, 36($sp) + end_assign: + + # If internal_1 then goto then_8743762782775 + lw $t0, 36($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762782775 + + # Jumping to else_8743762782775 + j else_8743762782775 + + then_8743762782775: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num1 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing num1 + + # Argument num2 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing num2 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_4 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 24($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 28($sp) + j end_assign + not_is_Bool_or_Int: + # x = internal_4 + lw $t0, 24($sp) + sw $t0, 28($sp) + end_assign: + + # Allocating D + li $v0, 9 + lw $a0, type_D + syscall + la $t0, type_D # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 20($sp) # internal_5 = address of allocated object D + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_5 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function___init___at_D + jal function___init___at_D + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_5 = result of function___init___at_D + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_5 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_5 + + # Argument x + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_6 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_6 + lw $t0, 16($sp) + sw $t0, 40($sp) + end_assign: + + # Jumping to endif_8743762782775 + j endif_8743762782775 + + else_8743762782775: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num2 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing num2 + + # Argument num1 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing num1 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_8 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 28($sp) + j end_assign + not_is_Bool_or_Int: + # x = internal_8 + lw $t0, 8($sp) + sw $t0, 28($sp) + end_assign: + + # Allocating D + li $v0, 9 + lw $a0, type_D + syscall + la $t0, type_D # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_9 = address of allocated object D + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_9 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function___init___at_D + jal function___init___at_D + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_9 = result of function___init___at_D + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_9 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_9 + + # Argument x + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_10 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_10 + lw $t0, 0($sp) + sw $t0, 40($sp) + end_assign: + + # Jumping to endif_8743762782775 + j endif_8743762782775 + + endif_8743762782775: + + # Loading return value in $v1 + lw $v1, 40($sp) + + # Freeing space for local variables + addi $sp, $sp, 44 + + jr $ra + + function_method5_at_A: + # Function parameters + # $ra = 52($sp) + # self = 48($sp) + # num = 44($sp) + + # Reserving space for local variables + addi $sp, $sp, -44 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_1 = address of allocated object Int + + lw $t0, 36($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # x = internal_1 + lw $t0, 36($sp) + sw $t0, 40($sp) + end_assign: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_3 = address of allocated object Int + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 32($sp) + j end_assign + not_is_Bool_or_Int: + # y = internal_3 + lw $t0, 28($sp) + sw $t0, 32($sp) + end_assign: + + while_start_8743762782859: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument y + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing y + + # Argument num + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_less_than_or_equal + jal function_less_than_or_equal + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_5 = result of function_less_than_or_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 20($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # internal_4 = internal_5 + lw $t0, 20($sp) + sw $t0, 24($sp) + end_assign: + + # If internal_4 then goto while_body_8743762782859 + lw $t0, 24($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8743762782859 + + # Jumping to while_end_8743762782859 + j while_end_8743762782859 + + while_body_8743762782859: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing x + + # Argument y + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing y + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_6 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # x = internal_6 + lw $t0, 16($sp) + sw $t0, 40($sp) + end_assign: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument y + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing y + + # Argument internal_7 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_8 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 32($sp) + j end_assign + not_is_Bool_or_Int: + # y = internal_8 + lw $t0, 8($sp) + sw $t0, 32($sp) + end_assign: + + # Jumping to while_start_8743762782859 + j while_start_8743762782859 + + while_end_8743762782859: + + # Allocating E + li $v0, 9 + lw $a0, type_E + syscall + la $t0, type_E # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_9 = address of allocated object E + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_9 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function___init___at_E + jal function___init___at_E + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_9 = result of function___init___at_E + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_9 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_9 + + # Argument x + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_10 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 44 + + jr $ra + + function___init___at_B: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.var = internal_0 + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_method5_at_B: + # Function parameters + # $ra = 24($sp) + # self = 20($sp) + # num = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing num + + # Argument num + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_1 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 12($sp) + j end_assign + not_is_Bool_or_Int: + # x = internal_1 + lw $t0, 8($sp) + sw $t0, 12($sp) + end_assign: + + # Allocating E + li $v0, 9 + lw $a0, type_E + syscall + la $t0, type_E # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_2 = address of allocated object E + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_2 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function___init___at_E + jal function___init___at_E + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_2 = result of function___init___at_E + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument x + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function___init___at_C: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.var = internal_0 + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_method6_at_C: + # Function parameters + # $ra = 32($sp) + # self = 28($sp) + # num = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Xor operation + lw $t0, 24($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 12($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 8($sp) # $t0 = internal_3 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 16($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 8($sp) # $t0 = internal_3 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 20($sp) + j end_assign + not_is_Bool_or_Int: + # x = internal_3 + lw $t0, 8($sp) + sw $t0, 20($sp) + end_assign: + + # Allocating A + li $v0, 9 + lw $a0, type_A + syscall + la $t0, type_A # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_4 = address of allocated object A + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_4 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function___init___at_A + jal function___init___at_A + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_4 = result of function___init___at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument x + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_5 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_method5_at_C: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + # num = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing num + + # Argument num + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_1 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument num + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_2 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 16($sp) + j end_assign + not_is_Bool_or_Int: + # x = internal_2 + lw $t0, 8($sp) + sw $t0, 16($sp) + end_assign: + + # Allocating E + li $v0, 9 + lw $a0, type_E + syscall + la $t0, type_E # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_3 = address of allocated object E + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_3 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function___init___at_E + jal function___init___at_E + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_3 = result of function___init___at_E + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument x + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_4 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 20 + + jr $ra + + function___init___at_D: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.var = internal_0 + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_method7_at_D: + # Function parameters + # $ra = 116($sp) + # self = 112($sp) + # num = 108($sp) + + # Reserving space for local variables + addi $sp, $sp, -108 + + lw $t0, 108($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 104($sp) + j end_assign + not_is_Bool_or_Int: + # x = num + lw $t0, 108($sp) + sw $t0, 104($sp) + end_assign: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_2 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 92($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_3 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_4 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 88($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 96($sp) + j end_assign + not_is_Bool_or_Int: + # internal_2 = internal_4 + lw $t0, 88($sp) + sw $t0, 96($sp) + end_assign: + + # If internal_2 then goto then_8743762784269 + lw $t0, 96($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762784269 + + # Jumping to else_8743762784269 + j else_8743762784269 + + then_8743762784269: + + # Xor operation + lw $t0, 104($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 80($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 76($sp) # $t0 = internal_7 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Addition operation + lw $t0, 76($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 84($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 76($sp) # $t0 = internal_7 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_7 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_method7_at_D + jal function_method7_at_D + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_8 = result of function_method7_at_D + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 72($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 100($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_8 + lw $t0, 72($sp) + sw $t0, 100($sp) + end_assign: + + # Jumping to endif_8743762784269 + j endif_8743762784269 + + else_8743762784269: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_10 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_11 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_11 + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing internal_11 + + # Argument x + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_12 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 56($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 64($sp) + j end_assign + not_is_Bool_or_Int: + # internal_10 = internal_12 + lw $t0, 56($sp) + sw $t0, 64($sp) + end_assign: + + # If internal_10 then goto then_8743762784260 + lw $t0, 64($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762784260 + + # Jumping to else_8743762784260 + j else_8743762784260 + + then_8743762784260: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_13 = address of allocated object Int + + lw $t0, 52($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 68($sp) + j end_assign + not_is_Bool_or_Int: + # internal_9 = internal_13 + lw $t0, 52($sp) + sw $t0, 68($sp) + end_assign: + + # Jumping to endif_8743762784260 + j endif_8743762784260 + + else_8743762784260: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_15 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_16 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_16 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_16 + + # Argument x + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_17 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 36($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # internal_15 = internal_17 + lw $t0, 36($sp) + sw $t0, 44($sp) + end_assign: + + # If internal_15 then goto then_8743762783991 + lw $t0, 44($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762783991 + + # Jumping to else_8743762783991 + j else_8743762783991 + + then_8743762783991: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_18 = address of allocated object Int + + lw $t0, 32($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 48($sp) + j end_assign + not_is_Bool_or_Int: + # internal_14 = internal_18 + lw $t0, 32($sp) + sw $t0, 48($sp) + end_assign: + + # Jumping to endif_8743762783991 + j endif_8743762783991 + + else_8743762783991: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_20 = address of allocated object Int + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_21 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_21 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_21 + + # Argument x + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_22 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # internal_20 = internal_22 + lw $t0, 16($sp) + sw $t0, 24($sp) + end_assign: + + # If internal_20 then goto then_8743762783997 + lw $t0, 24($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762783997 + + # Jumping to else_8743762783997 + j else_8743762783997 + + then_8743762783997: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_23 = address of allocated object Int + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 28($sp) + j end_assign + not_is_Bool_or_Int: + # internal_19 = internal_23 + lw $t0, 12($sp) + sw $t0, 28($sp) + end_assign: + + # Jumping to endif_8743762783997 + j endif_8743762783997 + + else_8743762783997: + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_24 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_24 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_24 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_25 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_25 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_25 + + # Calling function function_method7_at_D + jal function_method7_at_D + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_26 = result of function_method7_at_D + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 28($sp) + j end_assign + not_is_Bool_or_Int: + # internal_19 = internal_26 + lw $t0, 0($sp) + sw $t0, 28($sp) + end_assign: + + # Jumping to endif_8743762783997 + j endif_8743762783997 + + endif_8743762783997: + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 48($sp) + j end_assign + not_is_Bool_or_Int: + # internal_14 = internal_19 + lw $t0, 28($sp) + sw $t0, 48($sp) + end_assign: + + # Jumping to endif_8743762783991 + j endif_8743762783991 + + endif_8743762783991: + + lw $t0, 48($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 68($sp) + j end_assign + not_is_Bool_or_Int: + # internal_9 = internal_14 + lw $t0, 48($sp) + sw $t0, 68($sp) + end_assign: + + # Jumping to endif_8743762784260 + j endif_8743762784260 + + endif_8743762784260: + + lw $t0, 68($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 100($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_9 + lw $t0, 68($sp) + sw $t0, 100($sp) + end_assign: + + # Jumping to endif_8743762784269 + j endif_8743762784269 + + endif_8743762784269: + + # Loading return value in $v1 + lw $v1, 100($sp) + + # Freeing space for local variables + addi $sp, $sp, 108 + + jr $ra + + function___init___at_E: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.var = internal_0 + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_method6_at_E: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + # num = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_1 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_div + jal function_div + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_2 = result of function_div + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 16($sp) + j end_assign + not_is_Bool_or_Int: + # x = internal_2 + lw $t0, 8($sp) + sw $t0, 16($sp) + end_assign: + + # Allocating A + li $v0, 9 + lw $a0, type_A + syscall + la $t0, type_A # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_3 = address of allocated object A + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_3 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function___init___at_A + jal function___init___at_A + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_3 = result of function___init___at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument x + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_4 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 20 + + jr $ra + + function___init___at_A2I: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_c2i_at_A2I: + # Function parameters + # $ra = 216($sp) + # self = 212($sp) + # char = 208($sp) + + # Reserving space for local variables + addi $sp, $sp, -208 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 200($sp) # internal_1 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 48 + sb $t0, 8($v0) # internal_2[0] = '0' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 196($sp) # internal_2 = "0" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_2 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 204($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 192($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 200($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_3 + lw $t0, 192($sp) + sw $t0, 200($sp) + end_assign: + + # If internal_1 then goto then_8743762785175 + lw $t0, 200($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762785175 + + # Jumping to else_8743762785175 + j else_8743762785175 + + then_8743762785175: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 188($sp) # internal_4 = address of allocated object Int + + lw $t0, 188($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 204($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_4 + lw $t0, 188($sp) + sw $t0, 204($sp) + end_assign: + + # Jumping to endif_8743762785175 + j endif_8743762785175 + + else_8743762785175: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 180($sp) # internal_6 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 49 + sb $t0, 8($v0) # internal_7[0] = '1' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 176($sp) # internal_7 = "1" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_7 + lw $t0, 188($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 184($sp) # internal_8 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 172($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 180($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_8 + lw $t0, 172($sp) + sw $t0, 180($sp) + end_assign: + + # If internal_6 then goto then_8743762785169 + lw $t0, 180($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762785169 + + # Jumping to else_8743762785169 + j else_8743762785169 + + then_8743762785169: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 168($sp) # internal_9 = address of allocated object Int + + lw $t0, 168($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 184($sp) + j end_assign + not_is_Bool_or_Int: + # internal_5 = internal_9 + lw $t0, 168($sp) + sw $t0, 184($sp) + end_assign: + + # Jumping to endif_8743762785169 + j endif_8743762785169 + + else_8743762785169: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_11 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 50 + sb $t0, 8($v0) # internal_12[0] = '2' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 156($sp) # internal_12 = "2" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_12 + lw $t0, 168($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 164($sp) # internal_13 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 152($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 160($sp) + j end_assign + not_is_Bool_or_Int: + # internal_11 = internal_13 + lw $t0, 152($sp) + sw $t0, 160($sp) + end_assign: + + # If internal_11 then goto then_8743762785163 + lw $t0, 160($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762785163 + + # Jumping to else_8743762785163 + j else_8743762785163 + + then_8743762785163: + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 148($sp) # internal_14 = address of allocated object Int + + lw $t0, 148($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 164($sp) + j end_assign + not_is_Bool_or_Int: + # internal_10 = internal_14 + lw $t0, 148($sp) + sw $t0, 164($sp) + end_assign: + + # Jumping to endif_8743762785163 + j endif_8743762785163 + + else_8743762785163: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 140($sp) # internal_16 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 51 + sb $t0, 8($v0) # internal_17[0] = '3' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 136($sp) # internal_17 = "3" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_17 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_17 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 144($sp) # internal_18 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 132($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 140($sp) + j end_assign + not_is_Bool_or_Int: + # internal_16 = internal_18 + lw $t0, 132($sp) + sw $t0, 140($sp) + end_assign: + + # If internal_16 then goto then_8743762785157 + lw $t0, 140($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762785157 + + # Jumping to else_8743762785157 + j else_8743762785157 + + then_8743762785157: + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_19 = address of allocated object Int + + lw $t0, 128($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 144($sp) + j end_assign + not_is_Bool_or_Int: + # internal_15 = internal_19 + lw $t0, 128($sp) + sw $t0, 144($sp) + end_assign: + + # Jumping to endif_8743762785157 + j endif_8743762785157 + + else_8743762785157: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_21 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 52 + sb $t0, 8($v0) # internal_22[0] = '4' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 116($sp) # internal_22 = "4" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_22 + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 124($sp) # internal_23 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 112($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 120($sp) + j end_assign + not_is_Bool_or_Int: + # internal_21 = internal_23 + lw $t0, 112($sp) + sw $t0, 120($sp) + end_assign: + + # If internal_21 then goto then_8743762785151 + lw $t0, 120($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762785151 + + # Jumping to else_8743762785151 + j else_8743762785151 + + then_8743762785151: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_24 = address of allocated object Int + + lw $t0, 108($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 124($sp) + j end_assign + not_is_Bool_or_Int: + # internal_20 = internal_24 + lw $t0, 108($sp) + sw $t0, 124($sp) + end_assign: + + # Jumping to endif_8743762785151 + j endif_8743762785151 + + else_8743762785151: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_26 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 53 + sb $t0, 8($v0) # internal_27[0] = '5' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 96($sp) # internal_27 = "5" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_27 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_27 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 104($sp) # internal_28 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 92($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 100($sp) + j end_assign + not_is_Bool_or_Int: + # internal_26 = internal_28 + lw $t0, 92($sp) + sw $t0, 100($sp) + end_assign: + + # If internal_26 then goto then_8743762785145 + lw $t0, 100($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762785145 + + # Jumping to else_8743762785145 + j else_8743762785145 + + then_8743762785145: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_29 = address of allocated object Int + + lw $t0, 88($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 104($sp) + j end_assign + not_is_Bool_or_Int: + # internal_25 = internal_29 + lw $t0, 88($sp) + sw $t0, 104($sp) + end_assign: + + # Jumping to endif_8743762785145 + j endif_8743762785145 + + else_8743762785145: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_31 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 54 + sb $t0, 8($v0) # internal_32[0] = '6' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 76($sp) # internal_32 = "6" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_32 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_32 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_33 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 72($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 80($sp) + j end_assign + not_is_Bool_or_Int: + # internal_31 = internal_33 + lw $t0, 72($sp) + sw $t0, 80($sp) + end_assign: + + # If internal_31 then goto then_8743762785139 + lw $t0, 80($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762785139 + + # Jumping to else_8743762785139 + j else_8743762785139 + + then_8743762785139: + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_34 = address of allocated object Int + + lw $t0, 68($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 84($sp) + j end_assign + not_is_Bool_or_Int: + # internal_30 = internal_34 + lw $t0, 68($sp) + sw $t0, 84($sp) + end_assign: + + # Jumping to endif_8743762785139 + j endif_8743762785139 + + else_8743762785139: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_36 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 55 + sb $t0, 8($v0) # internal_37[0] = '7' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 56($sp) # internal_37 = "7" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_37 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_37 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 64($sp) # internal_38 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 52($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # internal_36 = internal_38 + lw $t0, 52($sp) + sw $t0, 60($sp) + end_assign: + + # If internal_36 then goto then_8743762785133 + lw $t0, 60($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762785133 + + # Jumping to else_8743762785133 + j else_8743762785133 + + then_8743762785133: + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_39 = address of allocated object Int + + lw $t0, 48($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 64($sp) + j end_assign + not_is_Bool_or_Int: + # internal_35 = internal_39 + lw $t0, 48($sp) + sw $t0, 64($sp) + end_assign: + + # Jumping to endif_8743762785133 + j endif_8743762785133 + + else_8743762785133: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_41 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 56 + sb $t0, 8($v0) # internal_42[0] = '8' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 36($sp) # internal_42 = "8" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_42 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_42 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_43 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 32($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # internal_41 = internal_43 + lw $t0, 32($sp) + sw $t0, 40($sp) + end_assign: + + # If internal_41 then goto then_8743762785127 + lw $t0, 40($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762785127 + + # Jumping to else_8743762785127 + j else_8743762785127 + + then_8743762785127: + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_44 = address of allocated object Int + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # internal_40 = internal_44 + lw $t0, 28($sp) + sw $t0, 44($sp) + end_assign: + + # Jumping to endif_8743762785127 + j endif_8743762785127 + + else_8743762785127: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_46 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 57 + sb $t0, 8($v0) # internal_47[0] = '9' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 16($sp) # internal_47 = "9" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_47 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_47 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_48 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 20($sp) + j end_assign + not_is_Bool_or_Int: + # internal_46 = internal_48 + lw $t0, 12($sp) + sw $t0, 20($sp) + end_assign: + + # If internal_46 then goto then_8743762785106 + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762785106 + + # Jumping to else_8743762785106 + j else_8743762785106 + + then_8743762785106: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_49 = address of allocated object Int + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # internal_45 = internal_49 + lw $t0, 8($sp) + sw $t0, 24($sp) + end_assign: + + # Jumping to endif_8743762785106 + j endif_8743762785106 + + else_8743762785106: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_abort_at_Object + jal function_abort_at_Object + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_50 = result of function_abort_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_51 = address of allocated object Int + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # internal_45 = internal_51 + lw $t0, 0($sp) + sw $t0, 24($sp) + end_assign: + + # Jumping to endif_8743762785106 + j endif_8743762785106 + + endif_8743762785106: + + lw $t0, 24($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # internal_40 = internal_45 + lw $t0, 24($sp) + sw $t0, 44($sp) + end_assign: + + # Jumping to endif_8743762785127 + j endif_8743762785127 + + endif_8743762785127: + + lw $t0, 44($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 64($sp) + j end_assign + not_is_Bool_or_Int: + # internal_35 = internal_40 + lw $t0, 44($sp) + sw $t0, 64($sp) + end_assign: + + # Jumping to endif_8743762785133 + j endif_8743762785133 + + endif_8743762785133: + + lw $t0, 64($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 84($sp) + j end_assign + not_is_Bool_or_Int: + # internal_30 = internal_35 + lw $t0, 64($sp) + sw $t0, 84($sp) + end_assign: + + # Jumping to endif_8743762785139 + j endif_8743762785139 + + endif_8743762785139: + + lw $t0, 84($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 104($sp) + j end_assign + not_is_Bool_or_Int: + # internal_25 = internal_30 + lw $t0, 84($sp) + sw $t0, 104($sp) + end_assign: + + # Jumping to endif_8743762785145 + j endif_8743762785145 + + endif_8743762785145: + + lw $t0, 104($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 124($sp) + j end_assign + not_is_Bool_or_Int: + # internal_20 = internal_25 + lw $t0, 104($sp) + sw $t0, 124($sp) + end_assign: + + # Jumping to endif_8743762785151 + j endif_8743762785151 + + endif_8743762785151: + + lw $t0, 124($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 144($sp) + j end_assign + not_is_Bool_or_Int: + # internal_15 = internal_20 + lw $t0, 124($sp) + sw $t0, 144($sp) + end_assign: + + # Jumping to endif_8743762785157 + j endif_8743762785157 + + endif_8743762785157: + + lw $t0, 144($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 164($sp) + j end_assign + not_is_Bool_or_Int: + # internal_10 = internal_15 + lw $t0, 144($sp) + sw $t0, 164($sp) + end_assign: + + # Jumping to endif_8743762785163 + j endif_8743762785163 + + endif_8743762785163: + + lw $t0, 164($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 184($sp) + j end_assign + not_is_Bool_or_Int: + # internal_5 = internal_10 + lw $t0, 164($sp) + sw $t0, 184($sp) + end_assign: + + # Jumping to endif_8743762785169 + j endif_8743762785169 + + endif_8743762785169: + + lw $t0, 184($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 204($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_5 + lw $t0, 184($sp) + sw $t0, 204($sp) + end_assign: + + # Jumping to endif_8743762785175 + j endif_8743762785175 + + endif_8743762785175: + + # Loading return value in $v1 + lw $v1, 204($sp) + + # Freeing space for local variables + addi $sp, $sp, 208 + + jr $ra + + function_i2c_at_A2I: + # Function parameters + # $ra = 216($sp) + # self = 212($sp) + # i = 208($sp) + + # Reserving space for local variables + addi $sp, $sp, -208 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 200($sp) # internal_1 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 196($sp) # internal_2 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_2 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 204($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 192($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 200($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_3 + lw $t0, 192($sp) + sw $t0, 200($sp) + end_assign: + + # If internal_1 then goto then_8743762786009 + lw $t0, 200($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762786009 + + # Jumping to else_8743762786009 + j else_8743762786009 + + then_8743762786009: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 48 + sb $t0, 8($v0) # internal_4[0] = '0' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 188($sp) # internal_4 = "0" + + lw $t0, 188($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 204($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_4 + lw $t0, 188($sp) + sw $t0, 204($sp) + end_assign: + + # Jumping to endif_8743762786009 + j endif_8743762786009 + + else_8743762786009: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 180($sp) # internal_6 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 176($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_7 + lw $t0, 188($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 184($sp) # internal_8 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 172($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 180($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_8 + lw $t0, 172($sp) + sw $t0, 180($sp) + end_assign: + + # If internal_6 then goto then_8743762786003 + lw $t0, 180($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762786003 + + # Jumping to else_8743762786003 + j else_8743762786003 + + then_8743762786003: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 49 + sb $t0, 8($v0) # internal_9[0] = '1' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 168($sp) # internal_9 = "1" + + lw $t0, 168($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 184($sp) + j end_assign + not_is_Bool_or_Int: + # internal_5 = internal_9 + lw $t0, 168($sp) + sw $t0, 184($sp) + end_assign: + + # Jumping to endif_8743762786003 + j endif_8743762786003 + + else_8743762786003: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_11 = address of allocated object Int + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 156($sp) # internal_12 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_12 + lw $t0, 168($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 164($sp) # internal_13 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 152($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 160($sp) + j end_assign + not_is_Bool_or_Int: + # internal_11 = internal_13 + lw $t0, 152($sp) + sw $t0, 160($sp) + end_assign: + + # If internal_11 then goto then_8743762785997 + lw $t0, 160($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762785997 + + # Jumping to else_8743762785997 + j else_8743762785997 + + then_8743762785997: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 50 + sb $t0, 8($v0) # internal_14[0] = '2' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 148($sp) # internal_14 = "2" + + lw $t0, 148($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 164($sp) + j end_assign + not_is_Bool_or_Int: + # internal_10 = internal_14 + lw $t0, 148($sp) + sw $t0, 164($sp) + end_assign: + + # Jumping to endif_8743762785997 + j endif_8743762785997 + + else_8743762785997: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 140($sp) # internal_16 = address of allocated object Int + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_17 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_17 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_17 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 144($sp) # internal_18 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 132($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 140($sp) + j end_assign + not_is_Bool_or_Int: + # internal_16 = internal_18 + lw $t0, 132($sp) + sw $t0, 140($sp) + end_assign: + + # If internal_16 then goto then_8743762785991 + lw $t0, 140($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762785991 + + # Jumping to else_8743762785991 + j else_8743762785991 + + then_8743762785991: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 51 + sb $t0, 8($v0) # internal_19[0] = '3' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 128($sp) # internal_19 = "3" + + lw $t0, 128($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 144($sp) + j end_assign + not_is_Bool_or_Int: + # internal_15 = internal_19 + lw $t0, 128($sp) + sw $t0, 144($sp) + end_assign: + + # Jumping to endif_8743762785991 + j endif_8743762785991 + + else_8743762785991: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_21 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 116($sp) # internal_22 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_22 + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 124($sp) # internal_23 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 112($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 120($sp) + j end_assign + not_is_Bool_or_Int: + # internal_21 = internal_23 + lw $t0, 112($sp) + sw $t0, 120($sp) + end_assign: + + # If internal_21 then goto then_8743762785985 + lw $t0, 120($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762785985 + + # Jumping to else_8743762785985 + j else_8743762785985 + + then_8743762785985: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 52 + sb $t0, 8($v0) # internal_24[0] = '4' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 108($sp) # internal_24 = "4" + + lw $t0, 108($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 124($sp) + j end_assign + not_is_Bool_or_Int: + # internal_20 = internal_24 + lw $t0, 108($sp) + sw $t0, 124($sp) + end_assign: + + # Jumping to endif_8743762785985 + j endif_8743762785985 + + else_8743762785985: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_26 = address of allocated object Int + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_27 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_27 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_27 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 104($sp) # internal_28 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 92($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 100($sp) + j end_assign + not_is_Bool_or_Int: + # internal_26 = internal_28 + lw $t0, 92($sp) + sw $t0, 100($sp) + end_assign: + + # If internal_26 then goto then_8743762785979 + lw $t0, 100($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762785979 + + # Jumping to else_8743762785979 + j else_8743762785979 + + then_8743762785979: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 53 + sb $t0, 8($v0) # internal_29[0] = '5' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 88($sp) # internal_29 = "5" + + lw $t0, 88($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 104($sp) + j end_assign + not_is_Bool_or_Int: + # internal_25 = internal_29 + lw $t0, 88($sp) + sw $t0, 104($sp) + end_assign: + + # Jumping to endif_8743762785979 + j endif_8743762785979 + + else_8743762785979: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_31 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_32 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_32 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_32 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_33 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 72($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 80($sp) + j end_assign + not_is_Bool_or_Int: + # internal_31 = internal_33 + lw $t0, 72($sp) + sw $t0, 80($sp) + end_assign: + + # If internal_31 then goto then_8743762785973 + lw $t0, 80($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762785973 + + # Jumping to else_8743762785973 + j else_8743762785973 + + then_8743762785973: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 54 + sb $t0, 8($v0) # internal_34[0] = '6' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 68($sp) # internal_34 = "6" + + lw $t0, 68($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 84($sp) + j end_assign + not_is_Bool_or_Int: + # internal_30 = internal_34 + lw $t0, 68($sp) + sw $t0, 84($sp) + end_assign: + + # Jumping to endif_8743762785973 + j endif_8743762785973 + + else_8743762785973: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_36 = address of allocated object Int + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_37 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_37 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_37 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 64($sp) # internal_38 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 52($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # internal_36 = internal_38 + lw $t0, 52($sp) + sw $t0, 60($sp) + end_assign: + + # If internal_36 then goto then_8743762785967 + lw $t0, 60($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762785967 + + # Jumping to else_8743762785967 + j else_8743762785967 + + then_8743762785967: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 55 + sb $t0, 8($v0) # internal_39[0] = '7' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 48($sp) # internal_39 = "7" + + lw $t0, 48($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 64($sp) + j end_assign + not_is_Bool_or_Int: + # internal_35 = internal_39 + lw $t0, 48($sp) + sw $t0, 64($sp) + end_assign: + + # Jumping to endif_8743762785967 + j endif_8743762785967 + + else_8743762785967: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_41 = address of allocated object Int + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_42 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_42 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_42 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_43 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 32($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # internal_41 = internal_43 + lw $t0, 32($sp) + sw $t0, 40($sp) + end_assign: + + # If internal_41 then goto then_8743762785961 + lw $t0, 40($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762785961 + + # Jumping to else_8743762785961 + j else_8743762785961 + + then_8743762785961: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 56 + sb $t0, 8($v0) # internal_44[0] = '8' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 28($sp) # internal_44 = "8" + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # internal_40 = internal_44 + lw $t0, 28($sp) + sw $t0, 44($sp) + end_assign: + + # Jumping to endif_8743762785961 + j endif_8743762785961 + + else_8743762785961: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_46 = address of allocated object Int + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_47 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_47 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_47 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_48 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 20($sp) + j end_assign + not_is_Bool_or_Int: + # internal_46 = internal_48 + lw $t0, 12($sp) + sw $t0, 20($sp) + end_assign: + + # If internal_46 then goto then_8743762785940 + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762785940 + + # Jumping to else_8743762785940 + j else_8743762785940 + + then_8743762785940: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 57 + sb $t0, 8($v0) # internal_49[0] = '9' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_49 = "9" + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # internal_45 = internal_49 + lw $t0, 8($sp) + sw $t0, 24($sp) + end_assign: + + # Jumping to endif_8743762785940 + j endif_8743762785940 + + else_8743762785940: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_abort_at_Object + jal function_abort_at_Object + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_50 = result of function_abort_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 0 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_51 = "" + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # internal_45 = internal_51 + lw $t0, 0($sp) + sw $t0, 24($sp) + end_assign: + + # Jumping to endif_8743762785940 + j endif_8743762785940 + + endif_8743762785940: + + lw $t0, 24($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # internal_40 = internal_45 + lw $t0, 24($sp) + sw $t0, 44($sp) + end_assign: + + # Jumping to endif_8743762785961 + j endif_8743762785961 + + endif_8743762785961: + + lw $t0, 44($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 64($sp) + j end_assign + not_is_Bool_or_Int: + # internal_35 = internal_40 + lw $t0, 44($sp) + sw $t0, 64($sp) + end_assign: + + # Jumping to endif_8743762785967 + j endif_8743762785967 + + endif_8743762785967: + + lw $t0, 64($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 84($sp) + j end_assign + not_is_Bool_or_Int: + # internal_30 = internal_35 + lw $t0, 64($sp) + sw $t0, 84($sp) + end_assign: + + # Jumping to endif_8743762785973 + j endif_8743762785973 + + endif_8743762785973: + + lw $t0, 84($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 104($sp) + j end_assign + not_is_Bool_or_Int: + # internal_25 = internal_30 + lw $t0, 84($sp) + sw $t0, 104($sp) + end_assign: + + # Jumping to endif_8743762785979 + j endif_8743762785979 + + endif_8743762785979: + + lw $t0, 104($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 124($sp) + j end_assign + not_is_Bool_or_Int: + # internal_20 = internal_25 + lw $t0, 104($sp) + sw $t0, 124($sp) + end_assign: + + # Jumping to endif_8743762785985 + j endif_8743762785985 + + endif_8743762785985: + + lw $t0, 124($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 144($sp) + j end_assign + not_is_Bool_or_Int: + # internal_15 = internal_20 + lw $t0, 124($sp) + sw $t0, 144($sp) + end_assign: + + # Jumping to endif_8743762785991 + j endif_8743762785991 + + endif_8743762785991: + + lw $t0, 144($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 164($sp) + j end_assign + not_is_Bool_or_Int: + # internal_10 = internal_15 + lw $t0, 144($sp) + sw $t0, 164($sp) + end_assign: + + # Jumping to endif_8743762785997 + j endif_8743762785997 + + endif_8743762785997: + + lw $t0, 164($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 184($sp) + j end_assign + not_is_Bool_or_Int: + # internal_5 = internal_10 + lw $t0, 164($sp) + sw $t0, 184($sp) + end_assign: + + # Jumping to endif_8743762786003 + j endif_8743762786003 + + endif_8743762786003: + + lw $t0, 184($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 204($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_5 + lw $t0, 184($sp) + sw $t0, 204($sp) + end_assign: + + # Jumping to endif_8743762786009 + j endif_8743762786009 + + endif_8743762786009: + + # Loading return value in $v1 + lw $v1, 204($sp) + + # Freeing space for local variables + addi $sp, $sp, 208 + + jr $ra + + function_a2i_at_A2I: + # Function parameters + # $ra = 152($sp) + # self = 148($sp) + # s = 144($sp) + + # Reserving space for local variables + addi $sp, $sp, -144 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 140($sp) # internal_2 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 144($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 140($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 136($sp) # internal_4 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 124($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 136($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_4 + lw $t0, 124($sp) + sw $t0, 136($sp) + end_assign: + + # If internal_1 then goto then_8743762786199 + lw $t0, 136($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762786199 + + # Jumping to else_8743762786199 + j else_8743762786199 + + then_8743762786199: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_5 = address of allocated object Int + + lw $t0, 120($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 140($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_5 + lw $t0, 120($sp) + sw $t0, 140($sp) + end_assign: + + # Jumping to endif_8743762786199 + j endif_8743762786199 + + else_8743762786199: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_7 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_8 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_9 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 160($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_8 + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument internal_9 + lw $t0, 120($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 116($sp) # internal_10 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 45 + sb $t0, 8($v0) # internal_11[0] = '-' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 96($sp) # internal_11 = "-" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_11 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 104($sp) # internal_12 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 92($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 112($sp) + j end_assign + not_is_Bool_or_Int: + # internal_7 = internal_12 + lw $t0, 92($sp) + sw $t0, 112($sp) + end_assign: + + # If internal_7 then goto then_8743762786214 + lw $t0, 112($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762786214 + + # Jumping to else_8743762786214 + j else_8743762786214 + + then_8743762786214: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_13 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 92($sp) # internal_14 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_15 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_14 + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing internal_14 + + # Argument internal_15 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 88($sp) # internal_16 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 160($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_13 + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing internal_13 + + # Argument internal_16 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 88($sp) # internal_17 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_17 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_17 + + # Calling function function_a2i_aux_at_A2I + jal function_a2i_aux_at_A2I + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_18 = result of function_a2i_aux_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + # Xor operation + lw $t0, 68($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 60($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 56($sp) # $t0 = internal_21 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Addition operation + lw $t0, 56($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 64($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 56($sp) # $t0 = internal_21 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + lw $t0, 56($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 116($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_21 + lw $t0, 56($sp) + sw $t0, 116($sp) + end_assign: + + # Jumping to endif_8743762786214 + j endif_8743762786214 + + else_8743762786214: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_23 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_24 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_25 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 160($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_24 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing internal_24 + + # Argument internal_25 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_25 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 52($sp) # internal_26 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 43 + sb $t0, 8($v0) # internal_27[0] = '+' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 32($sp) # internal_27 = "+" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_26 + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing internal_26 + + # Argument internal_27 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_27 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_28 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 48($sp) + j end_assign + not_is_Bool_or_Int: + # internal_23 = internal_28 + lw $t0, 28($sp) + sw $t0, 48($sp) + end_assign: + + # If internal_23 then goto then_8743762786208 + lw $t0, 48($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762786208 + + # Jumping to else_8743762786208 + j else_8743762786208 + + then_8743762786208: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_29 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_30 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_31 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_30 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_30 + + # Argument internal_31 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_31 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_32 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 160($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_29 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_29 + + # Argument internal_32 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_32 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 24($sp) # internal_33 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_33 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_33 + + # Calling function function_a2i_aux_at_A2I + jal function_a2i_aux_at_A2I + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_34 = result of function_a2i_aux_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 4($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # internal_22 = internal_34 + lw $t0, 4($sp) + sw $t0, 52($sp) + end_assign: + + # Jumping to endif_8743762786208 + j endif_8743762786208 + + else_8743762786208: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing self + + # Argument s + lw $t0, 156($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_a2i_aux_at_A2I + jal function_a2i_aux_at_A2I + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_35 = result of function_a2i_aux_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # internal_22 = internal_35 + lw $t0, 0($sp) + sw $t0, 52($sp) + end_assign: + + # Jumping to endif_8743762786208 + j endif_8743762786208 + + endif_8743762786208: + + lw $t0, 52($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 116($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_22 + lw $t0, 52($sp) + sw $t0, 116($sp) + end_assign: + + # Jumping to endif_8743762786214 + j endif_8743762786214 + + endif_8743762786214: + + lw $t0, 116($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 140($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_6 + lw $t0, 116($sp) + sw $t0, 140($sp) + end_assign: + + # Jumping to endif_8743762786199 + j endif_8743762786199 + + endif_8743762786199: + + # Loading return value in $v1 + lw $v1, 140($sp) + + # Freeing space for local variables + addi $sp, $sp, 144 + + jr $ra + + function_a2i_aux_at_A2I: + # Function parameters + # $ra = 72($sp) + # self = 68($sp) + # s = 64($sp) + + # Reserving space for local variables + addi $sp, $sp, -64 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_1 = address of allocated object Int + + lw $t0, 56($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # int = internal_1 + lw $t0, 56($sp) + sw $t0, 60($sp) + end_assign: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 56($sp) # internal_3 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 48($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # j = internal_3 + lw $t0, 48($sp) + sw $t0, 52($sp) + end_assign: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_5 = address of allocated object Int + + lw $t0, 40($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # i = internal_5 + lw $t0, 40($sp) + sw $t0, 44($sp) + end_assign: + + while_start_8743762786868: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing i + + # Argument j + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing j + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_7 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 32($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 36($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_7 + lw $t0, 32($sp) + sw $t0, 36($sp) + end_assign: + + # If internal_6 then goto while_body_8743762786868 + lw $t0, 36($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8743762786868 + + # Jumping to while_end_8743762786868 + j while_end_8743762786868 + + while_body_8743762786868: + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_8 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument int + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing int + + # Argument internal_8 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_9 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_10 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 80($sp) + sw $t0, 8($sp) # Storing s + + # Argument i + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_10 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 32($sp) # internal_11 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_11 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_c2i_at_A2I + jal function_c2i_at_A2I + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_12 = result of function_c2i_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_9 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_9 + + # Argument internal_12 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_13 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # int = internal_13 + lw $t0, 8($sp) + sw $t0, 60($sp) + end_assign: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_14 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_14 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_14 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_15 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # i = internal_15 + lw $t0, 0($sp) + sw $t0, 44($sp) + end_assign: + + # Jumping to while_start_8743762786868 + j while_start_8743762786868 + + while_end_8743762786868: + + # Loading return value in $v1 + lw $v1, 60($sp) + + # Freeing space for local variables + addi $sp, $sp, 64 + + jr $ra + + function_i2a_at_A2I: + # Function parameters + # $ra = 80($sp) + # self = 76($sp) + # i = 72($sp) + + # Reserving space for local variables + addi $sp, $sp, -72 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_1 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_2 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_2 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 56($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 64($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_3 + lw $t0, 56($sp) + sw $t0, 64($sp) + end_assign: + + # If internal_1 then goto then_8743762786997 + lw $t0, 64($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762786997 + + # Jumping to else_8743762786997 + j else_8743762786997 + + then_8743762786997: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 48 + sb $t0, 8($v0) # internal_4[0] = '0' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 52($sp) # internal_4 = "0" + + lw $t0, 52($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 68($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_4 + lw $t0, 52($sp) + sw $t0, 68($sp) + end_assign: + + # Jumping to endif_8743762786997 + j endif_8743762786997 + + else_8743762786997: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_6 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_7 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_7 + + # Argument i + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing i + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_8 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 36($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_8 + lw $t0, 36($sp) + sw $t0, 44($sp) + end_assign: + + # If internal_6 then goto then_8743762787003 + lw $t0, 44($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762787003 + + # Jumping to else_8743762787003 + j else_8743762787003 + + then_8743762787003: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing self + + # Argument i + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing i + + # Calling function function_i2a_aux_at_A2I + jal function_i2a_aux_at_A2I + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_9 = result of function_i2a_aux_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 32($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 48($sp) + j end_assign + not_is_Bool_or_Int: + # internal_5 = internal_9 + lw $t0, 32($sp) + sw $t0, 48($sp) + end_assign: + + # Jumping to endif_8743762787003 + j endif_8743762787003 + + else_8743762787003: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 45 + sb $t0, 8($v0) # internal_10[0] = '-' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 28($sp) # internal_10 = "-" + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_11 = address of allocated object Int + + # Xor operation + lw $t0, 24($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 16($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 12($sp) # $t0 = internal_14 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Addition operation + lw $t0, 12($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 20($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 12($sp) # $t0 = internal_14 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_14 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_14 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_15 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_15 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_i2a_aux_at_A2I + jal function_i2a_aux_at_A2I + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_16 = result of function_i2a_aux_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_16 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_17 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 48($sp) + j end_assign + not_is_Bool_or_Int: + # internal_5 = internal_17 + lw $t0, 0($sp) + sw $t0, 48($sp) + end_assign: + + # Jumping to endif_8743762787003 + j endif_8743762787003 + + endif_8743762787003: + + lw $t0, 48($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 68($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_5 + lw $t0, 48($sp) + sw $t0, 68($sp) + end_assign: + + # Jumping to endif_8743762786997 + j endif_8743762786997 + + endif_8743762786997: + + # Loading return value in $v1 + lw $v1, 68($sp) + + # Freeing space for local variables + addi $sp, $sp, 72 + + jr $ra + + function_i2a_aux_at_A2I: + # Function parameters + # $ra = 64($sp) + # self = 60($sp) + # i = 56($sp) + + # Reserving space for local variables + addi $sp, $sp, -56 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_1 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_2 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_2 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 40($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 48($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_3 + lw $t0, 40($sp) + sw $t0, 48($sp) + end_assign: + + # If internal_1 then goto then_8743762787371 + lw $t0, 48($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762787371 + + # Jumping to else_8743762787371 + j else_8743762787371 + + then_8743762787371: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 0 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 36($sp) # internal_4 = "" + + lw $t0, 36($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_4 + lw $t0, 36($sp) + sw $t0, 52($sp) + end_assign: + + # Jumping to endif_8743762787371 + j endif_8743762787371 + + else_8743762787371: + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_6 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_6 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_div + jal function_div + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_7 = result of function_div + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 24($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 32($sp) + j end_assign + not_is_Bool_or_Int: + # next = internal_7 + lw $t0, 24($sp) + sw $t0, 32($sp) + end_assign: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing self + + # Argument next + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing next + + # Calling function function_i2a_aux_at_A2I + jal function_i2a_aux_at_A2I + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_8 = result of function_i2a_aux_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_9 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument next + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing next + + # Argument internal_9 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_10 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_10 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_11 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_11 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_i2c_at_A2I + jal function_i2c_at_A2I + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_12 = result of function_i2c_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_8 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument internal_12 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_13 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_13 + lw $t0, 0($sp) + sw $t0, 52($sp) + end_assign: + + # Jumping to endif_8743762787371 + j endif_8743762787371 + + endif_8743762787371: + + # Loading return value in $v1 + lw $v1, 52($sp) + + # Freeing space for local variables + addi $sp, $sp, 56 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 0 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_0 = "" + + # Set attribute char of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.char = internal_0 + + # Set attribute avar of self + lw $t0, 8($sp) # $t0 = self + sw $zero, 12($t0) # Set the attribute avar of self + + # Set attribute a_var of self + lw $t0, 8($sp) # $t0 = self + sw $zero, 16($t0) # Set the attribute a_var of self + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_1 = address of allocated object Int + + # Set attribute flag of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_1 + sw $t1, 20($t0) # self.flag = internal_1 + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_menu_at_Main: + # Function parameters + # $ra = 216($sp) + # self = 212($sp) + + # Reserving space for local variables + addi $sp, $sp, -212 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 30 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 21 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_0[0] = '\n' + + addi $t0, $zero, 9 + sb $t0, 9($v0) # internal_0[1] = '\t' + + addi $t0, $zero, 84 + sb $t0, 10($v0) # internal_0[2] = 'T' + + addi $t0, $zero, 111 + sb $t0, 11($v0) # internal_0[3] = 'o' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_0[4] = ' ' + + addi $t0, $zero, 97 + sb $t0, 13($v0) # internal_0[5] = 'a' + + addi $t0, $zero, 100 + sb $t0, 14($v0) # internal_0[6] = 'd' + + addi $t0, $zero, 100 + sb $t0, 15($v0) # internal_0[7] = 'd' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_0[8] = ' ' + + addi $t0, $zero, 97 + sb $t0, 17($v0) # internal_0[9] = 'a' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_0[10] = ' ' + + addi $t0, $zero, 110 + sb $t0, 19($v0) # internal_0[11] = 'n' + + addi $t0, $zero, 117 + sb $t0, 20($v0) # internal_0[12] = 'u' + + addi $t0, $zero, 109 + sb $t0, 21($v0) # internal_0[13] = 'm' + + addi $t0, $zero, 98 + sb $t0, 22($v0) # internal_0[14] = 'b' + + addi $t0, $zero, 101 + sb $t0, 23($v0) # internal_0[15] = 'e' + + addi $t0, $zero, 114 + sb $t0, 24($v0) # internal_0[16] = 'r' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 116 + sb $t0, 26($v0) # internal_0[18] = 't' + + addi $t0, $zero, 111 + sb $t0, 27($v0) # internal_0[19] = 'o' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_0[20] = ' ' + + sb $zero, 29($v0) # Null-terminator at the end of the string + + sw $v0, 208($sp) # internal_0 = "\n\tTo add a number to " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 216($sp) # internal_1 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 212($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 200($sp) # internal_2 = avar + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_2 + lw $t0, 212($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 208($sp) # internal_3 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 46 + sb $t0, 8($v0) # internal_4[0] = '.' + + addi $t0, $zero, 46 + sb $t0, 9($v0) # internal_4[1] = '.' + + addi $t0, $zero, 46 + sb $t0, 10($v0) # internal_4[2] = '.' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_4[3] = 'e' + + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_4[4] = 'n' + + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_4[5] = 't' + + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_4[6] = 'e' + + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_4[7] = 'r' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_4[8] = ' ' + + addi $t0, $zero, 97 + sb $t0, 17($v0) # internal_4[9] = 'a' + + addi $t0, $zero, 58 + sb $t0, 18($v0) # internal_4[10] = ':' + + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_4[11] = '\n' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 192($sp) # internal_4 = "...enter a:\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_4 + lw $t0, 204($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 200($sp) # internal_5 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 11 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_6[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_6[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_6[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_6[3] = ' ' + + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_6[4] = 'n' + + addi $t0, $zero, 101 + sb $t0, 13($v0) # internal_6[5] = 'e' + + addi $t0, $zero, 103 + sb $t0, 14($v0) # internal_6[6] = 'g' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_6[7] = 'a' + + addi $t0, $zero, 116 + sb $t0, 16($v0) # internal_6[8] = 't' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_6[9] = 'e' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_6[10] = ' ' + + sb $zero, 19($v0) # Null-terminator at the end of the string + + sw $v0, 184($sp) # internal_6 = "\tTo negate " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_6 + lw $t0, 196($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 192($sp) # internal_7 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 212($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 176($sp) # internal_8 = avar + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_8 + lw $t0, 188($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 184($sp) # internal_9 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 46 + sb $t0, 8($v0) # internal_10[0] = '.' + + addi $t0, $zero, 46 + sb $t0, 9($v0) # internal_10[1] = '.' + + addi $t0, $zero, 46 + sb $t0, 10($v0) # internal_10[2] = '.' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_10[3] = 'e' + + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_10[4] = 'n' + + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_10[5] = 't' + + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_10[6] = 'e' + + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_10[7] = 'r' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_10[8] = ' ' + + addi $t0, $zero, 98 + sb $t0, 17($v0) # internal_10[9] = 'b' + + addi $t0, $zero, 58 + sb $t0, 18($v0) # internal_10[10] = ':' + + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_10[11] = '\n' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 168($sp) # internal_10 = "...enter b:\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_10 + lw $t0, 180($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 176($sp) # internal_11 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 41 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 32 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_12[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_12[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_12[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_12[3] = ' ' + + addi $t0, $zero, 102 + sb $t0, 12($v0) # internal_12[4] = 'f' + + addi $t0, $zero, 105 + sb $t0, 13($v0) # internal_12[5] = 'i' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_12[6] = 'n' + + addi $t0, $zero, 100 + sb $t0, 15($v0) # internal_12[7] = 'd' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_12[8] = ' ' + + addi $t0, $zero, 116 + sb $t0, 17($v0) # internal_12[9] = 't' + + addi $t0, $zero, 104 + sb $t0, 18($v0) # internal_12[10] = 'h' + + addi $t0, $zero, 101 + sb $t0, 19($v0) # internal_12[11] = 'e' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_12[12] = ' ' + + addi $t0, $zero, 100 + sb $t0, 21($v0) # internal_12[13] = 'd' + + addi $t0, $zero, 105 + sb $t0, 22($v0) # internal_12[14] = 'i' + + addi $t0, $zero, 102 + sb $t0, 23($v0) # internal_12[15] = 'f' + + addi $t0, $zero, 102 + sb $t0, 24($v0) # internal_12[16] = 'f' + + addi $t0, $zero, 101 + sb $t0, 25($v0) # internal_12[17] = 'e' + + addi $t0, $zero, 114 + sb $t0, 26($v0) # internal_12[18] = 'r' + + addi $t0, $zero, 101 + sb $t0, 27($v0) # internal_12[19] = 'e' + + addi $t0, $zero, 110 + sb $t0, 28($v0) # internal_12[20] = 'n' + + addi $t0, $zero, 99 + sb $t0, 29($v0) # internal_12[21] = 'c' + + addi $t0, $zero, 101 + sb $t0, 30($v0) # internal_12[22] = 'e' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_12[23] = ' ' + + addi $t0, $zero, 98 + sb $t0, 32($v0) # internal_12[24] = 'b' + + addi $t0, $zero, 101 + sb $t0, 33($v0) # internal_12[25] = 'e' + + addi $t0, $zero, 116 + sb $t0, 34($v0) # internal_12[26] = 't' + + addi $t0, $zero, 119 + sb $t0, 35($v0) # internal_12[27] = 'w' + + addi $t0, $zero, 101 + sb $t0, 36($v0) # internal_12[28] = 'e' + + addi $t0, $zero, 101 + sb $t0, 37($v0) # internal_12[29] = 'e' + + addi $t0, $zero, 110 + sb $t0, 38($v0) # internal_12[30] = 'n' + + addi $t0, $zero, 32 + sb $t0, 39($v0) # internal_12[31] = ' ' + + sb $zero, 40($v0) # Null-terminator at the end of the string + + sw $v0, 160($sp) # internal_12 = "\tTo find the difference between " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_12 + lw $t0, 172($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 168($sp) # internal_13 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 212($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 152($sp) # internal_14 = avar + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_14 + lw $t0, 164($sp) + sw $t0, 0($sp) # Storing internal_14 + + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 160($sp) # internal_15 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 39 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 30 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 97 + sb $t0, 8($v0) # internal_16[0] = 'a' + + addi $t0, $zero, 110 + sb $t0, 9($v0) # internal_16[1] = 'n' + + addi $t0, $zero, 100 + sb $t0, 10($v0) # internal_16[2] = 'd' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_16[3] = ' ' + + addi $t0, $zero, 97 + sb $t0, 12($v0) # internal_16[4] = 'a' + + addi $t0, $zero, 110 + sb $t0, 13($v0) # internal_16[5] = 'n' + + addi $t0, $zero, 111 + sb $t0, 14($v0) # internal_16[6] = 'o' + + addi $t0, $zero, 116 + sb $t0, 15($v0) # internal_16[7] = 't' + + addi $t0, $zero, 104 + sb $t0, 16($v0) # internal_16[8] = 'h' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_16[9] = 'e' + + addi $t0, $zero, 114 + sb $t0, 18($v0) # internal_16[10] = 'r' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_16[11] = ' ' + + addi $t0, $zero, 110 + sb $t0, 20($v0) # internal_16[12] = 'n' + + addi $t0, $zero, 117 + sb $t0, 21($v0) # internal_16[13] = 'u' + + addi $t0, $zero, 109 + sb $t0, 22($v0) # internal_16[14] = 'm' + + addi $t0, $zero, 98 + sb $t0, 23($v0) # internal_16[15] = 'b' + + addi $t0, $zero, 101 + sb $t0, 24($v0) # internal_16[16] = 'e' + + addi $t0, $zero, 114 + sb $t0, 25($v0) # internal_16[17] = 'r' + + addi $t0, $zero, 46 + sb $t0, 26($v0) # internal_16[18] = '.' + + addi $t0, $zero, 46 + sb $t0, 27($v0) # internal_16[19] = '.' + + addi $t0, $zero, 46 + sb $t0, 28($v0) # internal_16[20] = '.' + + addi $t0, $zero, 101 + sb $t0, 29($v0) # internal_16[21] = 'e' + + addi $t0, $zero, 110 + sb $t0, 30($v0) # internal_16[22] = 'n' + + addi $t0, $zero, 116 + sb $t0, 31($v0) # internal_16[23] = 't' + + addi $t0, $zero, 101 + sb $t0, 32($v0) # internal_16[24] = 'e' + + addi $t0, $zero, 114 + sb $t0, 33($v0) # internal_16[25] = 'r' + + addi $t0, $zero, 32 + sb $t0, 34($v0) # internal_16[26] = ' ' + + addi $t0, $zero, 99 + sb $t0, 35($v0) # internal_16[27] = 'c' + + addi $t0, $zero, 58 + sb $t0, 36($v0) # internal_16[28] = ':' + + addi $t0, $zero, 10 + sb $t0, 37($v0) # internal_16[29] = '\n' + + sb $zero, 38($v0) # Null-terminator at the end of the string + + sw $v0, 144($sp) # internal_16 = "and another number...enter c:\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_16 + lw $t0, 156($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 152($sp) # internal_17 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 35 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 26 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_18[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_18[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_18[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_18[3] = ' ' + + addi $t0, $zero, 102 + sb $t0, 12($v0) # internal_18[4] = 'f' + + addi $t0, $zero, 105 + sb $t0, 13($v0) # internal_18[5] = 'i' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_18[6] = 'n' + + addi $t0, $zero, 100 + sb $t0, 15($v0) # internal_18[7] = 'd' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_18[8] = ' ' + + addi $t0, $zero, 116 + sb $t0, 17($v0) # internal_18[9] = 't' + + addi $t0, $zero, 104 + sb $t0, 18($v0) # internal_18[10] = 'h' + + addi $t0, $zero, 101 + sb $t0, 19($v0) # internal_18[11] = 'e' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_18[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_18[13] = 'f' + + addi $t0, $zero, 97 + sb $t0, 22($v0) # internal_18[14] = 'a' + + addi $t0, $zero, 99 + sb $t0, 23($v0) # internal_18[15] = 'c' + + addi $t0, $zero, 116 + sb $t0, 24($v0) # internal_18[16] = 't' + + addi $t0, $zero, 111 + sb $t0, 25($v0) # internal_18[17] = 'o' + + addi $t0, $zero, 114 + sb $t0, 26($v0) # internal_18[18] = 'r' + + addi $t0, $zero, 105 + sb $t0, 27($v0) # internal_18[19] = 'i' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_18[20] = 'a' + + addi $t0, $zero, 108 + sb $t0, 29($v0) # internal_18[21] = 'l' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_18[22] = ' ' + + addi $t0, $zero, 111 + sb $t0, 31($v0) # internal_18[23] = 'o' + + addi $t0, $zero, 102 + sb $t0, 32($v0) # internal_18[24] = 'f' + + addi $t0, $zero, 32 + sb $t0, 33($v0) # internal_18[25] = ' ' + + sb $zero, 34($v0) # Null-terminator at the end of the string + + sw $v0, 136($sp) # internal_18 = "\tTo find the factorial of " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_18 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_18 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 144($sp) # internal_19 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 212($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 128($sp) # internal_20 = avar + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_20 + lw $t0, 140($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 136($sp) # internal_21 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 46 + sb $t0, 8($v0) # internal_22[0] = '.' + + addi $t0, $zero, 46 + sb $t0, 9($v0) # internal_22[1] = '.' + + addi $t0, $zero, 46 + sb $t0, 10($v0) # internal_22[2] = '.' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_22[3] = 'e' + + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_22[4] = 'n' + + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_22[5] = 't' + + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_22[6] = 'e' + + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_22[7] = 'r' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_22[8] = ' ' + + addi $t0, $zero, 100 + sb $t0, 17($v0) # internal_22[9] = 'd' + + addi $t0, $zero, 58 + sb $t0, 18($v0) # internal_22[10] = ':' + + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_22[11] = '\n' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 120($sp) # internal_22 = "...enter d:\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_22 + lw $t0, 132($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 128($sp) # internal_23 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 11 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_24[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_24[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_24[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_24[3] = ' ' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_24[4] = 's' + + addi $t0, $zero, 113 + sb $t0, 13($v0) # internal_24[5] = 'q' + + addi $t0, $zero, 117 + sb $t0, 14($v0) # internal_24[6] = 'u' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_24[7] = 'a' + + addi $t0, $zero, 114 + sb $t0, 16($v0) # internal_24[8] = 'r' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_24[9] = 'e' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_24[10] = ' ' + + sb $zero, 19($v0) # Null-terminator at the end of the string + + sw $v0, 112($sp) # internal_24 = "\tTo square " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_24 + lw $t0, 124($sp) + sw $t0, 0($sp) # Storing internal_24 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 120($sp) # internal_25 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 212($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 104($sp) # internal_26 = avar + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_26 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_26 + + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 112($sp) # internal_27 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 46 + sb $t0, 8($v0) # internal_28[0] = '.' + + addi $t0, $zero, 46 + sb $t0, 9($v0) # internal_28[1] = '.' + + addi $t0, $zero, 46 + sb $t0, 10($v0) # internal_28[2] = '.' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_28[3] = 'e' + + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_28[4] = 'n' + + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_28[5] = 't' + + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_28[6] = 'e' + + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_28[7] = 'r' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_28[8] = ' ' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_28[9] = 'e' + + addi $t0, $zero, 58 + sb $t0, 18($v0) # internal_28[10] = ':' + + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_28[11] = '\n' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 96($sp) # internal_28 = "...enter e:\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_28 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_28 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 104($sp) # internal_29 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 18 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_30[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_30[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_30[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_30[3] = ' ' + + addi $t0, $zero, 99 + sb $t0, 12($v0) # internal_30[4] = 'c' + + addi $t0, $zero, 117 + sb $t0, 13($v0) # internal_30[5] = 'u' + + addi $t0, $zero, 98 + sb $t0, 14($v0) # internal_30[6] = 'b' + + addi $t0, $zero, 101 + sb $t0, 15($v0) # internal_30[7] = 'e' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_30[8] = ' ' + + sb $zero, 17($v0) # Null-terminator at the end of the string + + sw $v0, 88($sp) # internal_30 = "\tTo cube " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_30 + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing internal_30 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 96($sp) # internal_31 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 212($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 80($sp) # internal_32 = avar + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_32 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_32 + + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 88($sp) # internal_33 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 46 + sb $t0, 8($v0) # internal_34[0] = '.' + + addi $t0, $zero, 46 + sb $t0, 9($v0) # internal_34[1] = '.' + + addi $t0, $zero, 46 + sb $t0, 10($v0) # internal_34[2] = '.' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_34[3] = 'e' + + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_34[4] = 'n' + + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_34[5] = 't' + + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_34[6] = 'e' + + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_34[7] = 'r' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_34[8] = ' ' + + addi $t0, $zero, 102 + sb $t0, 17($v0) # internal_34[9] = 'f' + + addi $t0, $zero, 58 + sb $t0, 18($v0) # internal_34[10] = ':' + + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_34[11] = '\n' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 72($sp) # internal_34 = "...enter f:\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_34 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_34 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_35 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 25 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 16 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_36[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_36[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_36[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_36[3] = ' ' + + addi $t0, $zero, 102 + sb $t0, 12($v0) # internal_36[4] = 'f' + + addi $t0, $zero, 105 + sb $t0, 13($v0) # internal_36[5] = 'i' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_36[6] = 'n' + + addi $t0, $zero, 100 + sb $t0, 15($v0) # internal_36[7] = 'd' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_36[8] = ' ' + + addi $t0, $zero, 111 + sb $t0, 17($v0) # internal_36[9] = 'o' + + addi $t0, $zero, 117 + sb $t0, 18($v0) # internal_36[10] = 'u' + + addi $t0, $zero, 116 + sb $t0, 19($v0) # internal_36[11] = 't' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_36[12] = ' ' + + addi $t0, $zero, 105 + sb $t0, 21($v0) # internal_36[13] = 'i' + + addi $t0, $zero, 102 + sb $t0, 22($v0) # internal_36[14] = 'f' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_36[15] = ' ' + + sb $zero, 24($v0) # Null-terminator at the end of the string + + sw $v0, 64($sp) # internal_36 = "\tTo find out if " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_36 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_36 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 72($sp) # internal_37 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 212($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 56($sp) # internal_38 = avar + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_38 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_38 + + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 64($sp) # internal_39 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 39 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 30 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 105 + sb $t0, 8($v0) # internal_40[0] = 'i' + + addi $t0, $zero, 115 + sb $t0, 9($v0) # internal_40[1] = 's' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_40[2] = ' ' + + addi $t0, $zero, 97 + sb $t0, 11($v0) # internal_40[3] = 'a' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_40[4] = ' ' + + addi $t0, $zero, 109 + sb $t0, 13($v0) # internal_40[5] = 'm' + + addi $t0, $zero, 117 + sb $t0, 14($v0) # internal_40[6] = 'u' + + addi $t0, $zero, 108 + sb $t0, 15($v0) # internal_40[7] = 'l' + + addi $t0, $zero, 116 + sb $t0, 16($v0) # internal_40[8] = 't' + + addi $t0, $zero, 105 + sb $t0, 17($v0) # internal_40[9] = 'i' + + addi $t0, $zero, 112 + sb $t0, 18($v0) # internal_40[10] = 'p' + + addi $t0, $zero, 108 + sb $t0, 19($v0) # internal_40[11] = 'l' + + addi $t0, $zero, 101 + sb $t0, 20($v0) # internal_40[12] = 'e' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_40[13] = ' ' + + addi $t0, $zero, 111 + sb $t0, 22($v0) # internal_40[14] = 'o' + + addi $t0, $zero, 102 + sb $t0, 23($v0) # internal_40[15] = 'f' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_40[16] = ' ' + + addi $t0, $zero, 51 + sb $t0, 25($v0) # internal_40[17] = '3' + + addi $t0, $zero, 46 + sb $t0, 26($v0) # internal_40[18] = '.' + + addi $t0, $zero, 46 + sb $t0, 27($v0) # internal_40[19] = '.' + + addi $t0, $zero, 46 + sb $t0, 28($v0) # internal_40[20] = '.' + + addi $t0, $zero, 101 + sb $t0, 29($v0) # internal_40[21] = 'e' + + addi $t0, $zero, 110 + sb $t0, 30($v0) # internal_40[22] = 'n' + + addi $t0, $zero, 116 + sb $t0, 31($v0) # internal_40[23] = 't' + + addi $t0, $zero, 101 + sb $t0, 32($v0) # internal_40[24] = 'e' + + addi $t0, $zero, 114 + sb $t0, 33($v0) # internal_40[25] = 'r' + + addi $t0, $zero, 32 + sb $t0, 34($v0) # internal_40[26] = ' ' + + addi $t0, $zero, 103 + sb $t0, 35($v0) # internal_40[27] = 'g' + + addi $t0, $zero, 58 + sb $t0, 36($v0) # internal_40[28] = ':' + + addi $t0, $zero, 10 + sb $t0, 37($v0) # internal_40[29] = '\n' + + sb $zero, 38($v0) # Null-terminator at the end of the string + + sw $v0, 48($sp) # internal_40 = "is a multiple of 3...enter g:\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_40 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_40 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 56($sp) # internal_41 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 11 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_42[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_42[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_42[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_42[3] = ' ' + + addi $t0, $zero, 100 + sb $t0, 12($v0) # internal_42[4] = 'd' + + addi $t0, $zero, 105 + sb $t0, 13($v0) # internal_42[5] = 'i' + + addi $t0, $zero, 118 + sb $t0, 14($v0) # internal_42[6] = 'v' + + addi $t0, $zero, 105 + sb $t0, 15($v0) # internal_42[7] = 'i' + + addi $t0, $zero, 100 + sb $t0, 16($v0) # internal_42[8] = 'd' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_42[9] = 'e' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_42[10] = ' ' + + sb $zero, 19($v0) # Null-terminator at the end of the string + + sw $v0, 40($sp) # internal_42 = "\tTo divide " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_42 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_42 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_43 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 212($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 32($sp) # internal_44 = avar + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_44 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_44 + + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_45 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 25 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 16 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 98 + sb $t0, 8($v0) # internal_46[0] = 'b' + + addi $t0, $zero, 121 + sb $t0, 9($v0) # internal_46[1] = 'y' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_46[2] = ' ' + + addi $t0, $zero, 56 + sb $t0, 11($v0) # internal_46[3] = '8' + + addi $t0, $zero, 46 + sb $t0, 12($v0) # internal_46[4] = '.' + + addi $t0, $zero, 46 + sb $t0, 13($v0) # internal_46[5] = '.' + + addi $t0, $zero, 46 + sb $t0, 14($v0) # internal_46[6] = '.' + + addi $t0, $zero, 101 + sb $t0, 15($v0) # internal_46[7] = 'e' + + addi $t0, $zero, 110 + sb $t0, 16($v0) # internal_46[8] = 'n' + + addi $t0, $zero, 116 + sb $t0, 17($v0) # internal_46[9] = 't' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_46[10] = 'e' + + addi $t0, $zero, 114 + sb $t0, 19($v0) # internal_46[11] = 'r' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_46[12] = ' ' + + addi $t0, $zero, 104 + sb $t0, 21($v0) # internal_46[13] = 'h' + + addi $t0, $zero, 58 + sb $t0, 22($v0) # internal_46[14] = ':' + + addi $t0, $zero, 10 + sb $t0, 23($v0) # internal_46[15] = '\n' + + sb $zero, 24($v0) # Null-terminator at the end of the string + + sw $v0, 24($sp) # internal_46 = "by 8...enter h:\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_46 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_46 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_47 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 41 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 32 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_48[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_48[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_48[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_48[3] = ' ' + + addi $t0, $zero, 103 + sb $t0, 12($v0) # internal_48[4] = 'g' + + addi $t0, $zero, 101 + sb $t0, 13($v0) # internal_48[5] = 'e' + + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_48[6] = 't' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_48[7] = ' ' + + addi $t0, $zero, 97 + sb $t0, 16($v0) # internal_48[8] = 'a' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_48[9] = ' ' + + addi $t0, $zero, 110 + sb $t0, 18($v0) # internal_48[10] = 'n' + + addi $t0, $zero, 101 + sb $t0, 19($v0) # internal_48[11] = 'e' + + addi $t0, $zero, 119 + sb $t0, 20($v0) # internal_48[12] = 'w' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_48[13] = ' ' + + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_48[14] = 'n' + + addi $t0, $zero, 117 + sb $t0, 23($v0) # internal_48[15] = 'u' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_48[16] = 'm' + + addi $t0, $zero, 98 + sb $t0, 25($v0) # internal_48[17] = 'b' + + addi $t0, $zero, 101 + sb $t0, 26($v0) # internal_48[18] = 'e' + + addi $t0, $zero, 114 + sb $t0, 27($v0) # internal_48[19] = 'r' + + addi $t0, $zero, 46 + sb $t0, 28($v0) # internal_48[20] = '.' + + addi $t0, $zero, 46 + sb $t0, 29($v0) # internal_48[21] = '.' + + addi $t0, $zero, 46 + sb $t0, 30($v0) # internal_48[22] = '.' + + addi $t0, $zero, 101 + sb $t0, 31($v0) # internal_48[23] = 'e' + + addi $t0, $zero, 110 + sb $t0, 32($v0) # internal_48[24] = 'n' + + addi $t0, $zero, 116 + sb $t0, 33($v0) # internal_48[25] = 't' + + addi $t0, $zero, 101 + sb $t0, 34($v0) # internal_48[26] = 'e' + + addi $t0, $zero, 114 + sb $t0, 35($v0) # internal_48[27] = 'r' + + addi $t0, $zero, 32 + sb $t0, 36($v0) # internal_48[28] = ' ' + + addi $t0, $zero, 106 + sb $t0, 37($v0) # internal_48[29] = 'j' + + addi $t0, $zero, 58 + sb $t0, 38($v0) # internal_48[30] = ':' + + addi $t0, $zero, 10 + sb $t0, 39($v0) # internal_48[31] = '\n' + + sb $zero, 40($v0) # Null-terminator at the end of the string + + sw $v0, 16($sp) # internal_48 = "\tTo get a new number...enter j:\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_48 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_48 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_49 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 30 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 21 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_50[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_50[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_50[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_50[3] = ' ' + + addi $t0, $zero, 113 + sb $t0, 12($v0) # internal_50[4] = 'q' + + addi $t0, $zero, 117 + sb $t0, 13($v0) # internal_50[5] = 'u' + + addi $t0, $zero, 105 + sb $t0, 14($v0) # internal_50[6] = 'i' + + addi $t0, $zero, 116 + sb $t0, 15($v0) # internal_50[7] = 't' + + addi $t0, $zero, 46 + sb $t0, 16($v0) # internal_50[8] = '.' + + addi $t0, $zero, 46 + sb $t0, 17($v0) # internal_50[9] = '.' + + addi $t0, $zero, 46 + sb $t0, 18($v0) # internal_50[10] = '.' + + addi $t0, $zero, 101 + sb $t0, 19($v0) # internal_50[11] = 'e' + + addi $t0, $zero, 110 + sb $t0, 20($v0) # internal_50[12] = 'n' + + addi $t0, $zero, 116 + sb $t0, 21($v0) # internal_50[13] = 't' + + addi $t0, $zero, 101 + sb $t0, 22($v0) # internal_50[14] = 'e' + + addi $t0, $zero, 114 + sb $t0, 23($v0) # internal_50[15] = 'r' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_50[16] = ' ' + + addi $t0, $zero, 113 + sb $t0, 25($v0) # internal_50[17] = 'q' + + addi $t0, $zero, 58 + sb $t0, 26($v0) # internal_50[18] = ':' + + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_50[19] = '\n' + + addi $t0, $zero, 10 + sb $t0, 28($v0) # internal_50[20] = '\n' + + sb $zero, 29($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_50 = "\tTo quit...enter q:\n\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_50 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_50 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_51 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_in_string_at_IO + jal function_in_string_at_IO + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_52 = result of function_in_string_at_IO + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 212 + + jr $ra + + function_prompt_at_Main: + # Function parameters + # $ra = 24($sp) + # self = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_0[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 16($sp) # internal_0 = "\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_1 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 35 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 26 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 80 + sb $t0, 8($v0) # internal_2[0] = 'P' + + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_2[1] = 'l' + + addi $t0, $zero, 101 + sb $t0, 10($v0) # internal_2[2] = 'e' + + addi $t0, $zero, 97 + sb $t0, 11($v0) # internal_2[3] = 'a' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_2[4] = 's' + + addi $t0, $zero, 101 + sb $t0, 13($v0) # internal_2[5] = 'e' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_2[6] = ' ' + + addi $t0, $zero, 101 + sb $t0, 15($v0) # internal_2[7] = 'e' + + addi $t0, $zero, 110 + sb $t0, 16($v0) # internal_2[8] = 'n' + + addi $t0, $zero, 116 + sb $t0, 17($v0) # internal_2[9] = 't' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_2[10] = 'e' + + addi $t0, $zero, 114 + sb $t0, 19($v0) # internal_2[11] = 'r' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_2[12] = ' ' + + addi $t0, $zero, 97 + sb $t0, 21($v0) # internal_2[13] = 'a' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_2[14] = ' ' + + addi $t0, $zero, 110 + sb $t0, 23($v0) # internal_2[15] = 'n' + + addi $t0, $zero, 117 + sb $t0, 24($v0) # internal_2[16] = 'u' + + addi $t0, $zero, 109 + sb $t0, 25($v0) # internal_2[17] = 'm' + + addi $t0, $zero, 98 + sb $t0, 26($v0) # internal_2[18] = 'b' + + addi $t0, $zero, 101 + sb $t0, 27($v0) # internal_2[19] = 'e' + + addi $t0, $zero, 114 + sb $t0, 28($v0) # internal_2[20] = 'r' + + addi $t0, $zero, 46 + sb $t0, 29($v0) # internal_2[21] = '.' + + addi $t0, $zero, 46 + sb $t0, 30($v0) # internal_2[22] = '.' + + addi $t0, $zero, 46 + sb $t0, 31($v0) # internal_2[23] = '.' + + addi $t0, $zero, 32 + sb $t0, 32($v0) # internal_2[24] = ' ' + + addi $t0, $zero, 32 + sb $t0, 33($v0) # internal_2[25] = ' ' + + sb $zero, 34($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_2 = "Please enter a number... " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_2 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_3 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_in_string_at_IO + jal function_in_string_at_IO + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_4 = result of function_in_string_at_IO + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 20 + + jr $ra + + function_get_int_at_Main: + # Function parameters + # $ra = 24($sp) + # self = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # Allocating A2I + li $v0, 9 + lw $a0, type_A2I + syscall + la $t0, type_A2I # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_1 = address of allocated object A2I + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_A2I + jal function___init___at_A2I + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_1 = result of function___init___at_A2I + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 16($sp) + j end_assign + not_is_Bool_or_Int: + # z = internal_1 + lw $t0, 12($sp) + sw $t0, 16($sp) + end_assign: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_prompt_at_Main + jal function_prompt_at_Main + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_3 = result of function_prompt_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 4($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 8($sp) + j end_assign + not_is_Bool_or_Int: + # s = internal_3 + lw $t0, 4($sp) + sw $t0, 8($sp) + end_assign: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument z + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing z + + # Argument s + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_a2i_at_A2I + jal function_a2i_at_A2I + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_4 = result of function_a2i_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 20 + + jr $ra + + function_is_even_at_Main: + # Function parameters + # $ra = 96($sp) + # self = 92($sp) + # num = 88($sp) + + # Reserving space for local variables + addi $sp, $sp, -88 + + lw $t0, 88($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 84($sp) + j end_assign + not_is_Bool_or_Int: + # x = num + lw $t0, 88($sp) + sw $t0, 84($sp) + end_assign: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_2 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_3 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_4 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 68($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 76($sp) + j end_assign + not_is_Bool_or_Int: + # internal_2 = internal_4 + lw $t0, 68($sp) + sw $t0, 76($sp) + end_assign: + + # If internal_2 then goto then_8743762788868 + lw $t0, 76($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762788868 + + # Jumping to else_8743762788868 + j else_8743762788868 + + then_8743762788868: + + # Xor operation + lw $t0, 84($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 60($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 56($sp) # $t0 = internal_7 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Addition operation + lw $t0, 56($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 64($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 56($sp) # $t0 = internal_7 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_7 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_is_even_at_Main + jal function_is_even_at_Main + lw $ra, 8($sp) + sw $v1, 64($sp) # internal_8 = result of function_is_even_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 52($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 80($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_8 + lw $t0, 52($sp) + sw $t0, 80($sp) + end_assign: + + # Jumping to endif_8743762788868 + j endif_8743762788868 + + else_8743762788868: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_10 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_11 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_11 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_11 + + # Argument x + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_12 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 36($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # internal_10 = internal_12 + lw $t0, 36($sp) + sw $t0, 44($sp) + end_assign: + + # If internal_10 then goto then_8743762788871 + lw $t0, 44($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762788871 + + # Jumping to else_8743762788871 + j else_8743762788871 + + then_8743762788871: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_13 = address of allocated object Int + + lw $t0, 32($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 48($sp) + j end_assign + not_is_Bool_or_Int: + # internal_9 = internal_13 + lw $t0, 32($sp) + sw $t0, 48($sp) + end_assign: + + # Jumping to endif_8743762788871 + j endif_8743762788871 + + else_8743762788871: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_15 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_16 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_16 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_16 + + # Argument x + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_17 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # internal_15 = internal_17 + lw $t0, 16($sp) + sw $t0, 24($sp) + end_assign: + + # If internal_15 then goto then_8743762788877 + lw $t0, 24($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762788877 + + # Jumping to else_8743762788877 + j else_8743762788877 + + then_8743762788877: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_18 = address of allocated object Int + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 28($sp) + j end_assign + not_is_Bool_or_Int: + # internal_14 = internal_18 + lw $t0, 12($sp) + sw $t0, 28($sp) + end_assign: + + # Jumping to endif_8743762788877 + j endif_8743762788877 + + else_8743762788877: + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_19 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_19 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_19 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_20 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_20 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function function_is_even_at_Main + jal function_is_even_at_Main + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_21 = result of function_is_even_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 28($sp) + j end_assign + not_is_Bool_or_Int: + # internal_14 = internal_21 + lw $t0, 0($sp) + sw $t0, 28($sp) + end_assign: + + # Jumping to endif_8743762788877 + j endif_8743762788877 + + endif_8743762788877: + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 48($sp) + j end_assign + not_is_Bool_or_Int: + # internal_9 = internal_14 + lw $t0, 28($sp) + sw $t0, 48($sp) + end_assign: + + # Jumping to endif_8743762788871 + j endif_8743762788871 + + endif_8743762788871: + + lw $t0, 48($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 80($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_9 + lw $t0, 48($sp) + sw $t0, 80($sp) + end_assign: + + # Jumping to endif_8743762788868 + j endif_8743762788868 + + endif_8743762788868: + + # Loading return value in $v1 + lw $v1, 80($sp) + + # Freeing space for local variables + addi $sp, $sp, 88 + + jr $ra + + function_class_type_at_Main: + # Function parameters + # $ra = 212($sp) + # self = 208($sp) + # var = 204($sp) + + # Reserving space for local variables + addi $sp, $sp, -204 + + + + + + + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 180($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 188($sp) # internal_3 = address of allocated object Int + + + + + # internal_1 = typeof var that is the first word of the object + lw $t0, 204($sp) + lw $t1, 0($t0) + sw $t1, 196($sp) + + lw $t0, 196($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 192($sp) + j end_assign + not_is_Bool_or_Int: + # internal_2 = internal_1 + lw $t0, 196($sp) + sw $t0, 192($sp) + end_assign: + + lw $t0, 180($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 200($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_5 + lw $t0, 180($sp) + sw $t0, 200($sp) + end_assign: + + while_start_8743762788970: + + # Equal operation + lw $t0, 192($sp) # Save in $t0 the left operand address + # If internal_3 then goto while_end_8743762788970 + lw $t0, 188($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8743762788970 + + # Addition operation + lw $t0, 200($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # internal_2 = ancestor of internal_2 that is the first word of the object + lw $t0, 192($sp) + lw $t1, 4($t0) + sw $t1, 192($sp) + + # Jumping to while_start_8743762788970 + j while_start_8743762788970 + + while_end_8743762788970: + + + + + lw $t0, 196($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 192($sp) + j end_assign + not_is_Bool_or_Int: + # internal_2 = internal_1 + lw $t0, 196($sp) + sw $t0, 192($sp) + end_assign: + + + foreach_start_8743762788970: + + # Less than operation + lw $t0, 172($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 200($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 168($sp) # $t0 = internal_8 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_8 then goto foreach_body_8743762788970 + lw $t0, 168($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8743762788970 + + # Jumping to foreach_end_8743762788970 + j foreach_end_8743762788970 + + foreach_body_8743762788970: + + + # internal_2 = ancestor of internal_2 that is the first word of the object + lw $t0, 192($sp) + lw $t1, 4($t0) + sw $t1, 192($sp) + + # Addition operation + lw $t0, 172($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_start_8743762788970 + j foreach_start_8743762788970 + + foreach_end_8743762788970: + + + + + + + # internal_11 = direction of A + la $t0, type_A + sw $t0, 156($sp) + + + + # internal_12 = direction of B + la $t0, type_B + sw $t0, 152($sp) + + + + # internal_13 = direction of C + la $t0, type_C + sw $t0, 148($sp) + + + + # internal_14 = direction of D + la $t0, type_D + sw $t0, 144($sp) + + + + # internal_15 = direction of E + la $t0, type_E + sw $t0, 140($sp) + + + + # internal_16 = direction of Object + la $t0, type_Object + sw $t0, 136($sp) + + + + + + + foreach_type_start_8743762788970: + + # Less than operation + lw $t0, 132($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # If internal_18 then goto foreach_type_body_8743762788970 + lw $t0, 128($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8743762788970 + + # Jumping to foreach_type_end_8743762788970 + j foreach_type_end_8743762788970 + + foreach_type_body_8743762788970: + + + + + + foreach_ancestor_start_8743762788970: + + # Less than operation + lw $t0, 120($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 200($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 116($sp) # $t0 = internal_21 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_21 then goto foreach_ancestor_body_8743762788970 + lw $t0, 116($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8743762788970 + + # Jumping to foreach_ancestor_end_8743762788970 + j foreach_ancestor_end_8743762788970 + + foreach_ancestor_body_8743762788970: + + + # Equal operation + lw $t0, 124($sp) # Save in $t0 the left operand address + lw $t1, 112($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 108($sp) # $t0 = internal_23 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_23 then goto foreach_ancestor_end_8743762788970 + lw $t0, 108($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8743762788970 + + # Addition operation + lw $t0, 120($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_ancestor_start_8743762788970 + j foreach_ancestor_start_8743762788970 + + foreach_ancestor_end_8743762788970: + + + + + + # Addition operation + lw $t0, 132($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_type_start_8743762788970 + j foreach_type_start_8743762788970 + + foreach_type_end_8743762788970: + + + + + + + + lw $t0, 200($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 92($sp) + j end_assign + not_is_Bool_or_Int: + # internal_27 = internal_0 + lw $t0, 200($sp) + sw $t0, 92($sp) + end_assign: + + foreach_min_start_8743762788970: + + # Less than operation + lw $t0, 104($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # If internal_28 then goto foreach_min_body_8743762788970 + lw $t0, 88($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8743762788970 + + # Jumping to foreach_min_end_8743762788970 + j foreach_min_end_8743762788970 + + foreach_min_body_8743762788970: + + + # Less than operation + lw $t0, 96($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 92($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 88($sp) # $t0 = internal_28 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_28 then goto update_min_8743762788970 + lw $t0, 88($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8743762788970 + + # Jumping to foreach_min_end_8743762788970 + j foreach_min_end_8743762788970 + + update_min_8743762788970: + + lw $t0, 96($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 92($sp) + j end_assign + not_is_Bool_or_Int: + # internal_27 = internal_26 + lw $t0, 96($sp) + sw $t0, 92($sp) + end_assign: + + lw $t0, 104($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 100($sp) + j end_assign + not_is_Bool_or_Int: + # internal_25 = internal_24 + lw $t0, 104($sp) + sw $t0, 100($sp) + end_assign: + + update_min_end_8743762788970: + + # Addition operation + lw $t0, 104($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_min_start_8743762788970 + j foreach_min_start_8743762788970 + + foreach_min_end_8743762788970: + + + + + + + + + + + + # Equal operation + lw $t0, 100($sp) # Save in $t0 the left operand address + lw $t1, 200($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 80($sp) # $t0 = internal_30 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_30 then goto error_branch_8743762788970 + lw $t0, 80($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8743762788970 + + + + # If internal_31 then goto branch_A_8743762788970 + lw $t0, 76($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_A_8743762788970 + + + # If internal_31 then goto branch_B_8743762788970 + lw $t0, 76($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_B_8743762788970 + + + # If internal_31 then goto branch_C_8743762788970 + lw $t0, 76($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_C_8743762788970 + + + # If internal_31 then goto branch_D_8743762788970 + lw $t0, 76($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_D_8743762788970 + + + # If internal_31 then goto branch_E_8743762788970 + lw $t0, 76($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_E_8743762788970 + + + # If internal_31 then goto branch_Object_8743762788970 + lw $t0, 76($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Object_8743762788970 + + branch_A_8743762788970: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 20 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_34[0] = 'C' + + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_34[1] = 'l' + + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_34[2] = 'a' + + addi $t0, $zero, 115 + sb $t0, 11($v0) # internal_34[3] = 's' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_34[4] = 's' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_34[5] = ' ' + + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_34[6] = 't' + + addi $t0, $zero, 121 + sb $t0, 15($v0) # internal_34[7] = 'y' + + addi $t0, $zero, 112 + sb $t0, 16($v0) # internal_34[8] = 'p' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_34[9] = 'e' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_34[10] = ' ' + + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_34[11] = 'i' + + addi $t0, $zero, 115 + sb $t0, 20($v0) # internal_34[12] = 's' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_34[13] = ' ' + + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_34[14] = 'n' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_34[15] = 'o' + + addi $t0, $zero, 119 + sb $t0, 24($v0) # internal_34[16] = 'w' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_34[17] = ' ' + + addi $t0, $zero, 65 + sb $t0, 26($v0) # internal_34[18] = 'A' + + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_34[19] = '\n' + + sb $zero, 28($v0) # Null-terminator at the end of the string + + sw $v0, 64($sp) # internal_34 = "Class type is now A\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_34 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_34 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 72($sp) # internal_35 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 60($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 72($sp) + j end_assign + not_is_Bool_or_Int: + # internal_32 = internal_35 + lw $t0, 60($sp) + sw $t0, 72($sp) + end_assign: + + # Jumping to branch_end_8743762788970 + j branch_end_8743762788970 + + branch_B_8743762788970: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 20 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_37[0] = 'C' + + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_37[1] = 'l' + + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_37[2] = 'a' + + addi $t0, $zero, 115 + sb $t0, 11($v0) # internal_37[3] = 's' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_37[4] = 's' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_37[5] = ' ' + + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_37[6] = 't' + + addi $t0, $zero, 121 + sb $t0, 15($v0) # internal_37[7] = 'y' + + addi $t0, $zero, 112 + sb $t0, 16($v0) # internal_37[8] = 'p' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_37[9] = 'e' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_37[10] = ' ' + + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_37[11] = 'i' + + addi $t0, $zero, 115 + sb $t0, 20($v0) # internal_37[12] = 's' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_37[13] = ' ' + + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_37[14] = 'n' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_37[15] = 'o' + + addi $t0, $zero, 119 + sb $t0, 24($v0) # internal_37[16] = 'w' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_37[17] = ' ' + + addi $t0, $zero, 66 + sb $t0, 26($v0) # internal_37[18] = 'B' + + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_37[19] = '\n' + + sb $zero, 28($v0) # Null-terminator at the end of the string + + sw $v0, 52($sp) # internal_37 = "Class type is now B\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_37 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_37 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 60($sp) # internal_38 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 48($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 72($sp) + j end_assign + not_is_Bool_or_Int: + # internal_32 = internal_38 + lw $t0, 48($sp) + sw $t0, 72($sp) + end_assign: + + # Jumping to branch_end_8743762788970 + j branch_end_8743762788970 + + branch_C_8743762788970: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 20 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_40[0] = 'C' + + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_40[1] = 'l' + + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_40[2] = 'a' + + addi $t0, $zero, 115 + sb $t0, 11($v0) # internal_40[3] = 's' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_40[4] = 's' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_40[5] = ' ' + + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_40[6] = 't' + + addi $t0, $zero, 121 + sb $t0, 15($v0) # internal_40[7] = 'y' + + addi $t0, $zero, 112 + sb $t0, 16($v0) # internal_40[8] = 'p' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_40[9] = 'e' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_40[10] = ' ' + + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_40[11] = 'i' + + addi $t0, $zero, 115 + sb $t0, 20($v0) # internal_40[12] = 's' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_40[13] = ' ' + + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_40[14] = 'n' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_40[15] = 'o' + + addi $t0, $zero, 119 + sb $t0, 24($v0) # internal_40[16] = 'w' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_40[17] = ' ' + + addi $t0, $zero, 67 + sb $t0, 26($v0) # internal_40[18] = 'C' + + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_40[19] = '\n' + + sb $zero, 28($v0) # Null-terminator at the end of the string + + sw $v0, 40($sp) # internal_40 = "Class type is now C\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_40 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_40 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_41 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 36($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 72($sp) + j end_assign + not_is_Bool_or_Int: + # internal_32 = internal_41 + lw $t0, 36($sp) + sw $t0, 72($sp) + end_assign: + + # Jumping to branch_end_8743762788970 + j branch_end_8743762788970 + + branch_D_8743762788970: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 20 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_43[0] = 'C' + + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_43[1] = 'l' + + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_43[2] = 'a' + + addi $t0, $zero, 115 + sb $t0, 11($v0) # internal_43[3] = 's' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_43[4] = 's' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_43[5] = ' ' + + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_43[6] = 't' + + addi $t0, $zero, 121 + sb $t0, 15($v0) # internal_43[7] = 'y' + + addi $t0, $zero, 112 + sb $t0, 16($v0) # internal_43[8] = 'p' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_43[9] = 'e' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_43[10] = ' ' + + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_43[11] = 'i' + + addi $t0, $zero, 115 + sb $t0, 20($v0) # internal_43[12] = 's' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_43[13] = ' ' + + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_43[14] = 'n' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_43[15] = 'o' + + addi $t0, $zero, 119 + sb $t0, 24($v0) # internal_43[16] = 'w' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_43[17] = ' ' + + addi $t0, $zero, 68 + sb $t0, 26($v0) # internal_43[18] = 'D' + + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_43[19] = '\n' + + sb $zero, 28($v0) # Null-terminator at the end of the string + + sw $v0, 28($sp) # internal_43 = "Class type is now D\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_43 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_43 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_44 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 24($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 72($sp) + j end_assign + not_is_Bool_or_Int: + # internal_32 = internal_44 + lw $t0, 24($sp) + sw $t0, 72($sp) + end_assign: + + # Jumping to branch_end_8743762788970 + j branch_end_8743762788970 + + branch_E_8743762788970: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 20 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_46[0] = 'C' + + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_46[1] = 'l' + + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_46[2] = 'a' + + addi $t0, $zero, 115 + sb $t0, 11($v0) # internal_46[3] = 's' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_46[4] = 's' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_46[5] = ' ' + + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_46[6] = 't' + + addi $t0, $zero, 121 + sb $t0, 15($v0) # internal_46[7] = 'y' + + addi $t0, $zero, 112 + sb $t0, 16($v0) # internal_46[8] = 'p' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_46[9] = 'e' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_46[10] = ' ' + + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_46[11] = 'i' + + addi $t0, $zero, 115 + sb $t0, 20($v0) # internal_46[12] = 's' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_46[13] = ' ' + + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_46[14] = 'n' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_46[15] = 'o' + + addi $t0, $zero, 119 + sb $t0, 24($v0) # internal_46[16] = 'w' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_46[17] = ' ' + + addi $t0, $zero, 69 + sb $t0, 26($v0) # internal_46[18] = 'E' + + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_46[19] = '\n' + + sb $zero, 28($v0) # Null-terminator at the end of the string + + sw $v0, 16($sp) # internal_46 = "Class type is now E\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_46 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_46 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_47 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 72($sp) + j end_assign + not_is_Bool_or_Int: + # internal_32 = internal_47 + lw $t0, 12($sp) + sw $t0, 72($sp) + end_assign: + + # Jumping to branch_end_8743762788970 + j branch_end_8743762788970 + + branch_Object_8743762788970: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 7 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 79 + sb $t0, 8($v0) # internal_49[0] = 'O' + + addi $t0, $zero, 111 + sb $t0, 9($v0) # internal_49[1] = 'o' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_49[2] = 'o' + + addi $t0, $zero, 111 + sb $t0, 11($v0) # internal_49[3] = 'o' + + addi $t0, $zero, 112 + sb $t0, 12($v0) # internal_49[4] = 'p' + + addi $t0, $zero, 115 + sb $t0, 13($v0) # internal_49[5] = 's' + + addi $t0, $zero, 10 + sb $t0, 14($v0) # internal_49[6] = '\n' + + sb $zero, 15($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_49 = "Oooops\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_49 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_49 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_50 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 72($sp) + j end_assign + not_is_Bool_or_Int: + # internal_32 = internal_50 + lw $t0, 0($sp) + sw $t0, 72($sp) + end_assign: + + # Jumping to branch_end_8743762788970 + j branch_end_8743762788970 + + error_branch_8743762788970: + + + branch_end_8743762788970: + + # Loading return value in $v1 + lw $v1, 72($sp) + + # Freeing space for local variables + addi $sp, $sp, 204 + + jr $ra + + function_print_at_Main: + # Function parameters + # $ra = 36($sp) + # self = 32($sp) + # var = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating A2I + li $v0, 9 + lw $a0, type_A2I + syscall + la $t0, type_A2I # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 20($sp) # internal_1 = address of allocated object A2I + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_A2I + jal function___init___at_A2I + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_1 = result of function___init___at_A2I + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 20($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # z = internal_1 + lw $t0, 20($sp) + sw $t0, 24($sp) + end_assign: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument var + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing var + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_2 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument z + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing z + + # Argument internal_2 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_i2a_at_A2I + jal function_i2a_at_A2I + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_3 = result of function_i2a_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_3 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_4 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_5[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_5 = " " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_5 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_6 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 772($sp) + # self = 768($sp) + + # Reserving space for local variables + addi $sp, $sp, -768 + + # Allocating A + li $v0, 9 + lw $a0, type_A + syscall + la $t0, type_A # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 764($sp) # internal_0 = address of allocated object A + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 772($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_A + jal function___init___at_A + lw $ra, 4($sp) + sw $v1, 772($sp) # internal_0 = result of function___init___at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 764($sp) # $t1 = internal_0 + sw $t1, 12($t0) # self.avar = internal_0 + + while_start_8743762758997: + + # Get attribute flag of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'flag' from the instance + sw $t1, 756($sp) # internal_2 = flag + + lw $t0, 756($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 760($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_2 + lw $t0, 756($sp) + sw $t0, 760($sp) + end_assign: + + # If internal_1 then goto while_body_8743762758997 + lw $t0, 760($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8743762758997 + + # Jumping to while_end_8743762758997 + j while_end_8743762758997 + + while_body_8743762758997: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 7 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 110 + sb $t0, 8($v0) # internal_3[0] = 'n' + + addi $t0, $zero, 117 + sb $t0, 9($v0) # internal_3[1] = 'u' + + addi $t0, $zero, 109 + sb $t0, 10($v0) # internal_3[2] = 'm' + + addi $t0, $zero, 98 + sb $t0, 11($v0) # internal_3[3] = 'b' + + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_3[4] = 'e' + + addi $t0, $zero, 114 + sb $t0, 13($v0) # internal_3[5] = 'r' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_3[6] = ' ' + + sb $zero, 15($v0) # Null-terminator at the end of the string + + sw $v0, 752($sp) # internal_3 = "number " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_3 + lw $t0, 764($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 760($sp) # internal_4 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 744($sp) # internal_5 = avar + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_5 + lw $t0, 756($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 752($sp) # internal_6 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 732($sp) # internal_8 = address of allocated object Int + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 728($sp) # internal_9 = avar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_9 + lw $t0, 736($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 732($sp) # internal_10 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_10 + lw $t0, 736($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_is_even_at_Main + jal function_is_even_at_Main + lw $ra, 8($sp) + sw $v1, 732($sp) # internal_11 = result of function_is_even_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 720($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 732($sp) + j end_assign + not_is_Bool_or_Int: + # internal_8 = internal_11 + lw $t0, 720($sp) + sw $t0, 732($sp) + end_assign: + + # If internal_8 then goto then_8743762789087 + lw $t0, 732($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762789087 + + # Jumping to else_8743762789087 + j else_8743762789087 + + then_8743762789087: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 18 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 105 + sb $t0, 8($v0) # internal_12[0] = 'i' + + addi $t0, $zero, 115 + sb $t0, 9($v0) # internal_12[1] = 's' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_12[2] = ' ' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_12[3] = 'e' + + addi $t0, $zero, 118 + sb $t0, 12($v0) # internal_12[4] = 'v' + + addi $t0, $zero, 101 + sb $t0, 13($v0) # internal_12[5] = 'e' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_12[6] = 'n' + + addi $t0, $zero, 33 + sb $t0, 15($v0) # internal_12[7] = '!' + + addi $t0, $zero, 10 + sb $t0, 16($v0) # internal_12[8] = '\n' + + sb $zero, 17($v0) # Null-terminator at the end of the string + + sw $v0, 716($sp) # internal_12 = "is even!\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_12 + lw $t0, 728($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 724($sp) # internal_13 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 712($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 736($sp) + j end_assign + not_is_Bool_or_Int: + # internal_7 = internal_13 + lw $t0, 712($sp) + sw $t0, 736($sp) + end_assign: + + # Jumping to endif_8743762789087 + j endif_8743762789087 + + else_8743762789087: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 17 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 8 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 105 + sb $t0, 8($v0) # internal_14[0] = 'i' + + addi $t0, $zero, 115 + sb $t0, 9($v0) # internal_14[1] = 's' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_14[2] = ' ' + + addi $t0, $zero, 111 + sb $t0, 11($v0) # internal_14[3] = 'o' + + addi $t0, $zero, 100 + sb $t0, 12($v0) # internal_14[4] = 'd' + + addi $t0, $zero, 100 + sb $t0, 13($v0) # internal_14[5] = 'd' + + addi $t0, $zero, 33 + sb $t0, 14($v0) # internal_14[6] = '!' + + addi $t0, $zero, 10 + sb $t0, 15($v0) # internal_14[7] = '\n' + + sb $zero, 16($v0) # Null-terminator at the end of the string + + sw $v0, 708($sp) # internal_14 = "is odd!\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_14 + lw $t0, 720($sp) + sw $t0, 0($sp) # Storing internal_14 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 716($sp) # internal_15 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 704($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 736($sp) + j end_assign + not_is_Bool_or_Int: + # internal_7 = internal_15 + lw $t0, 704($sp) + sw $t0, 736($sp) + end_assign: + + # Jumping to endif_8743762789087 + j endif_8743762789087 + + endif_8743762789087: + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 700($sp) # internal_16 = avar + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_16 + lw $t0, 712($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_class_type_at_Main + jal function_class_type_at_Main + lw $ra, 8($sp) + sw $v1, 708($sp) # internal_17 = result of function_class_type_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 776($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_menu_at_Main + jal function_menu_at_Main + lw $ra, 4($sp) + sw $v1, 700($sp) # internal_18 = result of function_menu_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute char of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 692($sp) # $t1 = internal_18 + sw $t1, 8($t0) # self.char = internal_18 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 684($sp) # internal_20 = address of allocated object Int + + # Get attribute char of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the instance + sw $t1, 680($sp) # internal_21 = char + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 97 + sb $t0, 8($v0) # internal_22[0] = 'a' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 676($sp) # internal_22 = "a" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_21 + lw $t0, 692($sp) + sw $t0, 4($sp) # Storing internal_21 + + # Argument internal_22 + lw $t0, 688($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 684($sp) # internal_23 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 672($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 684($sp) + j end_assign + not_is_Bool_or_Int: + # internal_20 = internal_23 + lw $t0, 672($sp) + sw $t0, 684($sp) + end_assign: + + # If internal_20 then goto then_8743762758982 + lw $t0, 684($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762758982 + + # Jumping to else_8743762758982 + j else_8743762758982 + + then_8743762758982: + + # Allocating A + li $v0, 9 + lw $a0, type_A + syscall + la $t0, type_A # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 668($sp) # internal_24 = address of allocated object A + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_24 + lw $t0, 676($sp) + sw $t0, 0($sp) # Storing internal_24 + + # Calling function function___init___at_A + jal function___init___at_A + lw $ra, 4($sp) + sw $v1, 676($sp) # internal_24 = result of function___init___at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 776($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_get_int_at_Main + jal function_get_int_at_Main + lw $ra, 4($sp) + sw $v1, 672($sp) # internal_25 = result of function_get_int_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_24 + lw $t0, 680($sp) + sw $t0, 4($sp) # Storing internal_24 + + # Argument internal_25 + lw $t0, 676($sp) + sw $t0, 0($sp) # Storing internal_25 + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 672($sp) # internal_26 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute a_var of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 660($sp) # $t1 = internal_26 + sw $t1, 16($t0) # self.a_var = internal_26 + + # Allocating B + li $v0, 9 + lw $a0, type_B + syscall + la $t0, type_B # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 656($sp) # internal_27 = address of allocated object B + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_27 + lw $t0, 664($sp) + sw $t0, 0($sp) # Storing internal_27 + + # Calling function function___init___at_B + jal function___init___at_B + lw $ra, 4($sp) + sw $v1, 664($sp) # internal_27 = result of function___init___at_B + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 652($sp) # internal_28 = avar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_28 + lw $t0, 660($sp) + sw $t0, 0($sp) # Storing internal_28 + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 656($sp) # internal_29 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute a_var of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'a_var' from the instance + sw $t1, 644($sp) # internal_30 = a_var + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_30 + lw $t0, 652($sp) + sw $t0, 0($sp) # Storing internal_30 + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 648($sp) # internal_31 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_27 + lw $t0, 672($sp) + sw $t0, 8($sp) # Storing internal_27 + + # Argument internal_29 + lw $t0, 664($sp) + sw $t0, 4($sp) # Storing internal_29 + + # Argument internal_31 + lw $t0, 656($sp) + sw $t0, 0($sp) # Storing internal_31 + + # Calling function function_method2_at_A + jal function_method2_at_A + lw $ra, 12($sp) + sw $v1, 652($sp) # internal_32 = result of function_method2_at_A + addi $sp, $sp, 16 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 636($sp) # $t1 = internal_32 + sw $t1, 12($t0) # self.avar = internal_32 + + lw $t0, 636($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 688($sp) + j end_assign + not_is_Bool_or_Int: + # internal_19 = internal_32 + lw $t0, 636($sp) + sw $t0, 688($sp) + end_assign: + + # Jumping to endif_8743762758982 + j endif_8743762758982 + + else_8743762758982: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 628($sp) # internal_34 = address of allocated object Int + + # Get attribute char of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the instance + sw $t1, 624($sp) # internal_35 = char + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 98 + sb $t0, 8($v0) # internal_36[0] = 'b' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 620($sp) # internal_36 = "b" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_35 + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing internal_35 + + # Argument internal_36 + lw $t0, 632($sp) + sw $t0, 0($sp) # Storing internal_36 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 628($sp) # internal_37 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 616($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 628($sp) + j end_assign + not_is_Bool_or_Int: + # internal_34 = internal_37 + lw $t0, 616($sp) + sw $t0, 628($sp) + end_assign: + + # If internal_34 then goto then_8743762758976 + lw $t0, 628($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762758976 + + # Jumping to else_8743762758976 + j else_8743762758976 + + then_8743762758976: + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 612($sp) # internal_38 = avar + + + + + + + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 588($sp) # internal_44 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 596($sp) # internal_42 = address of allocated object Int + + + + + # internal_40 = typeof internal_38 that is the first word of the object + lw $t0, 612($sp) + lw $t1, 0($t0) + sw $t1, 604($sp) + + lw $t0, 604($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 600($sp) + j end_assign + not_is_Bool_or_Int: + # internal_41 = internal_40 + lw $t0, 604($sp) + sw $t0, 600($sp) + end_assign: + + lw $t0, 588($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 608($sp) + j end_assign + not_is_Bool_or_Int: + # internal_39 = internal_44 + lw $t0, 588($sp) + sw $t0, 608($sp) + end_assign: + + while_start_8743762757292: + + # Equal operation + lw $t0, 600($sp) # Save in $t0 the left operand address + # If internal_42 then goto while_end_8743762757292 + lw $t0, 596($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8743762757292 + + # Addition operation + lw $t0, 608($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # internal_41 = ancestor of internal_41 that is the first word of the object + lw $t0, 600($sp) + lw $t1, 4($t0) + sw $t1, 600($sp) + + # Jumping to while_start_8743762757292 + j while_start_8743762757292 + + while_end_8743762757292: + + + + + lw $t0, 604($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 600($sp) + j end_assign + not_is_Bool_or_Int: + # internal_41 = internal_40 + lw $t0, 604($sp) + sw $t0, 600($sp) + end_assign: + + + foreach_start_8743762757292: + + # Less than operation + lw $t0, 580($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 608($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 576($sp) # $t0 = internal_47 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_47 then goto foreach_body_8743762757292 + lw $t0, 576($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8743762757292 + + # Jumping to foreach_end_8743762757292 + j foreach_end_8743762757292 + + foreach_body_8743762757292: + + + # internal_41 = ancestor of internal_41 that is the first word of the object + lw $t0, 600($sp) + lw $t1, 4($t0) + sw $t1, 600($sp) + + # Addition operation + lw $t0, 580($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_start_8743762757292 + j foreach_start_8743762757292 + + foreach_end_8743762757292: + + + + + + + # internal_50 = direction of C + la $t0, type_C + sw $t0, 564($sp) + + + + # internal_51 = direction of A + la $t0, type_A + sw $t0, 560($sp) + + + + # internal_52 = direction of Object + la $t0, type_Object + sw $t0, 556($sp) + + + + + + + foreach_type_start_8743762757292: + + # Less than operation + lw $t0, 552($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # If internal_54 then goto foreach_type_body_8743762757292 + lw $t0, 548($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8743762757292 + + # Jumping to foreach_type_end_8743762757292 + j foreach_type_end_8743762757292 + + foreach_type_body_8743762757292: + + + + + + foreach_ancestor_start_8743762757292: + + # Less than operation + lw $t0, 540($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 608($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 536($sp) # $t0 = internal_57 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_57 then goto foreach_ancestor_body_8743762757292 + lw $t0, 536($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8743762757292 + + # Jumping to foreach_ancestor_end_8743762757292 + j foreach_ancestor_end_8743762757292 + + foreach_ancestor_body_8743762757292: + + + # Equal operation + lw $t0, 544($sp) # Save in $t0 the left operand address + lw $t1, 532($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 528($sp) # $t0 = internal_59 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_59 then goto foreach_ancestor_end_8743762757292 + lw $t0, 528($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8743762757292 + + # Addition operation + lw $t0, 540($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_ancestor_start_8743762757292 + j foreach_ancestor_start_8743762757292 + + foreach_ancestor_end_8743762757292: + + + + + + # Addition operation + lw $t0, 552($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_type_start_8743762757292 + j foreach_type_start_8743762757292 + + foreach_type_end_8743762757292: + + + + + + + + lw $t0, 608($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 512($sp) + j end_assign + not_is_Bool_or_Int: + # internal_63 = internal_39 + lw $t0, 608($sp) + sw $t0, 512($sp) + end_assign: + + foreach_min_start_8743762757292: + + # Less than operation + lw $t0, 524($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # If internal_64 then goto foreach_min_body_8743762757292 + lw $t0, 508($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8743762757292 + + # Jumping to foreach_min_end_8743762757292 + j foreach_min_end_8743762757292 + + foreach_min_body_8743762757292: + + + # Less than operation + lw $t0, 516($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 512($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 508($sp) # $t0 = internal_64 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_64 then goto update_min_8743762757292 + lw $t0, 508($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8743762757292 + + # Jumping to foreach_min_end_8743762757292 + j foreach_min_end_8743762757292 + + update_min_8743762757292: + + lw $t0, 516($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 512($sp) + j end_assign + not_is_Bool_or_Int: + # internal_63 = internal_62 + lw $t0, 516($sp) + sw $t0, 512($sp) + end_assign: + + lw $t0, 524($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 520($sp) + j end_assign + not_is_Bool_or_Int: + # internal_61 = internal_60 + lw $t0, 524($sp) + sw $t0, 520($sp) + end_assign: + + update_min_end_8743762757292: + + # Addition operation + lw $t0, 524($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_min_start_8743762757292 + j foreach_min_start_8743762757292 + + foreach_min_end_8743762757292: + + + + + + + + + # Equal operation + lw $t0, 520($sp) # Save in $t0 the left operand address + lw $t1, 608($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 500($sp) # $t0 = internal_66 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_66 then goto error_branch_8743762757292 + lw $t0, 500($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8743762757292 + + + + # If internal_67 then goto branch_C_8743762757292 + lw $t0, 496($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_C_8743762757292 + + + # If internal_67 then goto branch_A_8743762757292 + lw $t0, 496($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_A_8743762757292 + + + # If internal_67 then goto branch_Object_8743762757292 + lw $t0, 496($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Object_8743762757292 + + branch_C_8743762757292: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument c + lw $t0, 496($sp) + sw $t0, 0($sp) # Storing c + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 492($sp) # internal_70 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument c + lw $t0, 500($sp) + sw $t0, 4($sp) # Storing c + + # Argument internal_70 + lw $t0, 496($sp) + sw $t0, 0($sp) # Storing internal_70 + + # Calling function function_method6_at_C + jal function_method6_at_C + lw $ra, 8($sp) + sw $v1, 492($sp) # internal_71 = result of function_method6_at_C + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 480($sp) # $t1 = internal_71 + sw $t1, 12($t0) # self.avar = internal_71 + + lw $t0, 480($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 492($sp) + j end_assign + not_is_Bool_or_Int: + # internal_68 = internal_71 + lw $t0, 480($sp) + sw $t0, 492($sp) + end_assign: + + # Jumping to branch_end_8743762757292 + j branch_end_8743762757292 + + branch_A_8743762757292: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument a + lw $t0, 484($sp) + sw $t0, 0($sp) # Storing a + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 480($sp) # internal_73 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument a + lw $t0, 488($sp) + sw $t0, 4($sp) # Storing a + + # Argument internal_73 + lw $t0, 484($sp) + sw $t0, 0($sp) # Storing internal_73 + + # Calling function function_method3_at_A + jal function_method3_at_A + lw $ra, 8($sp) + sw $v1, 480($sp) # internal_74 = result of function_method3_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 468($sp) # $t1 = internal_74 + sw $t1, 12($t0) # self.avar = internal_74 + + lw $t0, 468($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 492($sp) + j end_assign + not_is_Bool_or_Int: + # internal_68 = internal_74 + lw $t0, 468($sp) + sw $t0, 492($sp) + end_assign: + + # Jumping to branch_end_8743762757292 + j branch_end_8743762757292 + + branch_Object_8743762757292: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 7 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 79 + sb $t0, 8($v0) # internal_76[0] = 'O' + + addi $t0, $zero, 111 + sb $t0, 9($v0) # internal_76[1] = 'o' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_76[2] = 'o' + + addi $t0, $zero, 111 + sb $t0, 11($v0) # internal_76[3] = 'o' + + addi $t0, $zero, 112 + sb $t0, 12($v0) # internal_76[4] = 'p' + + addi $t0, $zero, 115 + sb $t0, 13($v0) # internal_76[5] = 's' + + addi $t0, $zero, 10 + sb $t0, 14($v0) # internal_76[6] = '\n' + + sb $zero, 15($v0) # Null-terminator at the end of the string + + sw $v0, 460($sp) # internal_76 = "Oooops\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_76 + lw $t0, 472($sp) + sw $t0, 0($sp) # Storing internal_76 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 468($sp) # internal_77 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 776($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_abort_at_Object + jal function_abort_at_Object + lw $ra, 4($sp) + sw $v1, 460($sp) # internal_78 = result of function_abort_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 448($sp) # internal_79 = address of allocated object Int + + lw $t0, 448($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 492($sp) + j end_assign + not_is_Bool_or_Int: + # internal_68 = internal_79 + lw $t0, 448($sp) + sw $t0, 492($sp) + end_assign: + + # Jumping to branch_end_8743762757292 + j branch_end_8743762757292 + + error_branch_8743762757292: + + + branch_end_8743762757292: + + lw $t0, 492($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 632($sp) + j end_assign + not_is_Bool_or_Int: + # internal_33 = internal_68 + lw $t0, 492($sp) + sw $t0, 632($sp) + end_assign: + + # Jumping to endif_8743762758976 + j endif_8743762758976 + + else_8743762758976: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 440($sp) # internal_81 = address of allocated object Int + + # Get attribute char of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the instance + sw $t1, 436($sp) # internal_82 = char + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 99 + sb $t0, 8($v0) # internal_83[0] = 'c' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 432($sp) # internal_83 = "c" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_82 + lw $t0, 448($sp) + sw $t0, 4($sp) # Storing internal_82 + + # Argument internal_83 + lw $t0, 444($sp) + sw $t0, 0($sp) # Storing internal_83 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 440($sp) # internal_84 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 428($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 440($sp) + j end_assign + not_is_Bool_or_Int: + # internal_81 = internal_84 + lw $t0, 428($sp) + sw $t0, 440($sp) + end_assign: + + # If internal_81 then goto then_8743762758970 + lw $t0, 440($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762758970 + + # Jumping to else_8743762758970 + j else_8743762758970 + + then_8743762758970: + + # Allocating A + li $v0, 9 + lw $a0, type_A + syscall + la $t0, type_A # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 424($sp) # internal_85 = address of allocated object A + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_85 + lw $t0, 432($sp) + sw $t0, 0($sp) # Storing internal_85 + + # Calling function function___init___at_A + jal function___init___at_A + lw $ra, 4($sp) + sw $v1, 432($sp) # internal_85 = result of function___init___at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 776($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_get_int_at_Main + jal function_get_int_at_Main + lw $ra, 4($sp) + sw $v1, 428($sp) # internal_86 = result of function_get_int_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_85 + lw $t0, 436($sp) + sw $t0, 4($sp) # Storing internal_85 + + # Argument internal_86 + lw $t0, 432($sp) + sw $t0, 0($sp) # Storing internal_86 + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 428($sp) # internal_87 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute a_var of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 416($sp) # $t1 = internal_87 + sw $t1, 16($t0) # self.a_var = internal_87 + + # Allocating D + li $v0, 9 + lw $a0, type_D + syscall + la $t0, type_D # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 412($sp) # internal_88 = address of allocated object D + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_88 + lw $t0, 420($sp) + sw $t0, 0($sp) # Storing internal_88 + + # Calling function function___init___at_D + jal function___init___at_D + lw $ra, 4($sp) + sw $v1, 420($sp) # internal_88 = result of function___init___at_D + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 408($sp) # internal_89 = avar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_89 + lw $t0, 416($sp) + sw $t0, 0($sp) # Storing internal_89 + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 412($sp) # internal_90 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute a_var of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'a_var' from the instance + sw $t1, 400($sp) # internal_91 = a_var + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_91 + lw $t0, 408($sp) + sw $t0, 0($sp) # Storing internal_91 + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 404($sp) # internal_92 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_88 + lw $t0, 428($sp) + sw $t0, 8($sp) # Storing internal_88 + + # Argument internal_90 + lw $t0, 420($sp) + sw $t0, 4($sp) # Storing internal_90 + + # Argument internal_92 + lw $t0, 412($sp) + sw $t0, 0($sp) # Storing internal_92 + + # Calling function function_method4_at_A + jal function_method4_at_A + lw $ra, 12($sp) + sw $v1, 408($sp) # internal_93 = result of function_method4_at_A + addi $sp, $sp, 16 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 392($sp) # $t1 = internal_93 + sw $t1, 12($t0) # self.avar = internal_93 + + lw $t0, 392($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 444($sp) + j end_assign + not_is_Bool_or_Int: + # internal_80 = internal_93 + lw $t0, 392($sp) + sw $t0, 444($sp) + end_assign: + + # Jumping to endif_8743762758970 + j endif_8743762758970 + + else_8743762758970: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 384($sp) # internal_95 = address of allocated object Int + + # Get attribute char of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the instance + sw $t1, 380($sp) # internal_96 = char + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 100 + sb $t0, 8($v0) # internal_97[0] = 'd' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 376($sp) # internal_97 = "d" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_96 + lw $t0, 392($sp) + sw $t0, 4($sp) # Storing internal_96 + + # Argument internal_97 + lw $t0, 388($sp) + sw $t0, 0($sp) # Storing internal_97 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 384($sp) # internal_98 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 372($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 384($sp) + j end_assign + not_is_Bool_or_Int: + # internal_95 = internal_98 + lw $t0, 372($sp) + sw $t0, 384($sp) + end_assign: + + # If internal_95 then goto then_8743762758964 + lw $t0, 384($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762758964 + + # Jumping to else_8743762758964 + j else_8743762758964 + + then_8743762758964: + + # Allocating C + li $v0, 9 + lw $a0, type_C + syscall + la $t0, type_C # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 368($sp) # internal_99 = address of allocated object C + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_99 + lw $t0, 376($sp) + sw $t0, 0($sp) # Storing internal_99 + + # Calling function function___init___at_C + jal function___init___at_C + lw $ra, 4($sp) + sw $v1, 376($sp) # internal_99 = result of function___init___at_C + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 364($sp) # internal_100 = avar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_100 + lw $t0, 372($sp) + sw $t0, 0($sp) # Storing internal_100 + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 368($sp) # internal_101 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_99 + lw $t0, 380($sp) + sw $t0, 4($sp) # Storing internal_99 + + # Argument internal_101 + lw $t0, 372($sp) + sw $t0, 0($sp) # Storing internal_101 + + # Calling function function_method5_at_C + jal function_method5_at_C + lw $ra, 8($sp) + sw $v1, 368($sp) # internal_102 = result of function_method5_at_C + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 356($sp) # $t1 = internal_102 + sw $t1, 12($t0) # self.avar = internal_102 + + lw $t0, 356($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 388($sp) + j end_assign + not_is_Bool_or_Int: + # internal_94 = internal_102 + lw $t0, 356($sp) + sw $t0, 388($sp) + end_assign: + + # Jumping to endif_8743762758964 + j endif_8743762758964 + + else_8743762758964: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 348($sp) # internal_104 = address of allocated object Int + + # Get attribute char of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the instance + sw $t1, 344($sp) # internal_105 = char + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 101 + sb $t0, 8($v0) # internal_106[0] = 'e' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 340($sp) # internal_106 = "e" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_105 + lw $t0, 356($sp) + sw $t0, 4($sp) # Storing internal_105 + + # Argument internal_106 + lw $t0, 352($sp) + sw $t0, 0($sp) # Storing internal_106 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 348($sp) # internal_107 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 336($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 348($sp) + j end_assign + not_is_Bool_or_Int: + # internal_104 = internal_107 + lw $t0, 336($sp) + sw $t0, 348($sp) + end_assign: + + # If internal_104 then goto then_8743762758958 + lw $t0, 348($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762758958 + + # Jumping to else_8743762758958 + j else_8743762758958 + + then_8743762758958: + + # Allocating C + li $v0, 9 + lw $a0, type_C + syscall + la $t0, type_C # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 332($sp) # internal_108 = address of allocated object C + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_108 + lw $t0, 340($sp) + sw $t0, 0($sp) # Storing internal_108 + + # Calling function function___init___at_C + jal function___init___at_C + lw $ra, 4($sp) + sw $v1, 340($sp) # internal_108 = result of function___init___at_C + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 328($sp) # internal_109 = avar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_109 + lw $t0, 336($sp) + sw $t0, 0($sp) # Storing internal_109 + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 332($sp) # internal_110 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_108 + lw $t0, 344($sp) + sw $t0, 4($sp) # Storing internal_108 + + # Argument internal_110 + lw $t0, 336($sp) + sw $t0, 0($sp) # Storing internal_110 + + # Calling function function_method5_at_C + jal function_method5_at_C + lw $ra, 8($sp) + sw $v1, 332($sp) # internal_111 = result of function_method5_at_C + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 320($sp) # $t1 = internal_111 + sw $t1, 12($t0) # self.avar = internal_111 + + lw $t0, 320($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 352($sp) + j end_assign + not_is_Bool_or_Int: + # internal_103 = internal_111 + lw $t0, 320($sp) + sw $t0, 352($sp) + end_assign: + + # Jumping to endif_8743762758958 + j endif_8743762758958 + + else_8743762758958: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 312($sp) # internal_113 = address of allocated object Int + + # Get attribute char of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the instance + sw $t1, 308($sp) # internal_114 = char + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 102 + sb $t0, 8($v0) # internal_115[0] = 'f' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 304($sp) # internal_115 = "f" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_114 + lw $t0, 320($sp) + sw $t0, 4($sp) # Storing internal_114 + + # Argument internal_115 + lw $t0, 316($sp) + sw $t0, 0($sp) # Storing internal_115 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 312($sp) # internal_116 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 300($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 312($sp) + j end_assign + not_is_Bool_or_Int: + # internal_113 = internal_116 + lw $t0, 300($sp) + sw $t0, 312($sp) + end_assign: + + # If internal_113 then goto then_8743762758952 + lw $t0, 312($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762758952 + + # Jumping to else_8743762758952 + j else_8743762758952 + + then_8743762758952: + + # Allocating C + li $v0, 9 + lw $a0, type_C + syscall + la $t0, type_C # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 296($sp) # internal_117 = address of allocated object C + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_117 + lw $t0, 304($sp) + sw $t0, 0($sp) # Storing internal_117 + + # Calling function function___init___at_C + jal function___init___at_C + lw $ra, 4($sp) + sw $v1, 304($sp) # internal_117 = result of function___init___at_C + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 292($sp) # internal_118 = avar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_118 + lw $t0, 300($sp) + sw $t0, 0($sp) # Storing internal_118 + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 296($sp) # internal_119 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_117 + lw $t0, 308($sp) + sw $t0, 4($sp) # Storing internal_117 + + # Argument internal_119 + lw $t0, 300($sp) + sw $t0, 0($sp) # Storing internal_119 + + # Calling function function_method5_at_C + jal function_method5_at_C + lw $ra, 8($sp) + sw $v1, 296($sp) # internal_120 = result of function_method5_at_C + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 284($sp) # $t1 = internal_120 + sw $t1, 12($t0) # self.avar = internal_120 + + lw $t0, 284($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 316($sp) + j end_assign + not_is_Bool_or_Int: + # internal_112 = internal_120 + lw $t0, 284($sp) + sw $t0, 316($sp) + end_assign: + + # Jumping to endif_8743762758952 + j endif_8743762758952 + + else_8743762758952: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 276($sp) # internal_122 = address of allocated object Int + + # Get attribute char of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the instance + sw $t1, 272($sp) # internal_123 = char + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 103 + sb $t0, 8($v0) # internal_124[0] = 'g' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 268($sp) # internal_124 = "g" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_123 + lw $t0, 284($sp) + sw $t0, 4($sp) # Storing internal_123 + + # Argument internal_124 + lw $t0, 280($sp) + sw $t0, 0($sp) # Storing internal_124 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 276($sp) # internal_125 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 264($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 276($sp) + j end_assign + not_is_Bool_or_Int: + # internal_122 = internal_125 + lw $t0, 264($sp) + sw $t0, 276($sp) + end_assign: + + # If internal_122 then goto then_8743762758946 + lw $t0, 276($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762758946 + + # Jumping to else_8743762758946 + j else_8743762758946 + + then_8743762758946: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 256($sp) # internal_127 = address of allocated object Int + + # Allocating D + li $v0, 9 + lw $a0, type_D + syscall + la $t0, type_D # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 252($sp) # internal_128 = address of allocated object D + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_128 + lw $t0, 260($sp) + sw $t0, 0($sp) # Storing internal_128 + + # Calling function function___init___at_D + jal function___init___at_D + lw $ra, 4($sp) + sw $v1, 260($sp) # internal_128 = result of function___init___at_D + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 248($sp) # internal_129 = avar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_129 + lw $t0, 256($sp) + sw $t0, 0($sp) # Storing internal_129 + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 252($sp) # internal_130 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_128 + lw $t0, 264($sp) + sw $t0, 4($sp) # Storing internal_128 + + # Argument internal_130 + lw $t0, 256($sp) + sw $t0, 0($sp) # Storing internal_130 + + # Calling function function_method7_at_D + jal function_method7_at_D + lw $ra, 8($sp) + sw $v1, 252($sp) # internal_131 = result of function_method7_at_D + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 240($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 256($sp) + j end_assign + not_is_Bool_or_Int: + # internal_127 = internal_131 + lw $t0, 240($sp) + sw $t0, 256($sp) + end_assign: + + # If internal_127 then goto then_8743762757849 + lw $t0, 256($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762757849 + + # Jumping to else_8743762757849 + j else_8743762757849 + + then_8743762757849: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 7 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 110 + sb $t0, 8($v0) # internal_132[0] = 'n' + + addi $t0, $zero, 117 + sb $t0, 9($v0) # internal_132[1] = 'u' + + addi $t0, $zero, 109 + sb $t0, 10($v0) # internal_132[2] = 'm' + + addi $t0, $zero, 98 + sb $t0, 11($v0) # internal_132[3] = 'b' + + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_132[4] = 'e' + + addi $t0, $zero, 114 + sb $t0, 13($v0) # internal_132[5] = 'r' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_132[6] = ' ' + + sb $zero, 15($v0) # Null-terminator at the end of the string + + sw $v0, 236($sp) # internal_132 = "number " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_132 + lw $t0, 248($sp) + sw $t0, 0($sp) # Storing internal_132 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 244($sp) # internal_133 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 228($sp) # internal_134 = avar + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_134 + lw $t0, 240($sp) + sw $t0, 0($sp) # Storing internal_134 + + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 236($sp) # internal_135 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 28 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 19 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 105 + sb $t0, 8($v0) # internal_136[0] = 'i' + + addi $t0, $zero, 115 + sb $t0, 9($v0) # internal_136[1] = 's' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_136[2] = ' ' + + addi $t0, $zero, 100 + sb $t0, 11($v0) # internal_136[3] = 'd' + + addi $t0, $zero, 105 + sb $t0, 12($v0) # internal_136[4] = 'i' + + addi $t0, $zero, 118 + sb $t0, 13($v0) # internal_136[5] = 'v' + + addi $t0, $zero, 105 + sb $t0, 14($v0) # internal_136[6] = 'i' + + addi $t0, $zero, 115 + sb $t0, 15($v0) # internal_136[7] = 's' + + addi $t0, $zero, 105 + sb $t0, 16($v0) # internal_136[8] = 'i' + + addi $t0, $zero, 98 + sb $t0, 17($v0) # internal_136[9] = 'b' + + addi $t0, $zero, 108 + sb $t0, 18($v0) # internal_136[10] = 'l' + + addi $t0, $zero, 101 + sb $t0, 19($v0) # internal_136[11] = 'e' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_136[12] = ' ' + + addi $t0, $zero, 98 + sb $t0, 21($v0) # internal_136[13] = 'b' + + addi $t0, $zero, 121 + sb $t0, 22($v0) # internal_136[14] = 'y' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_136[15] = ' ' + + addi $t0, $zero, 51 + sb $t0, 24($v0) # internal_136[16] = '3' + + addi $t0, $zero, 46 + sb $t0, 25($v0) # internal_136[17] = '.' + + addi $t0, $zero, 10 + sb $t0, 26($v0) # internal_136[18] = '\n' + + sb $zero, 27($v0) # Null-terminator at the end of the string + + sw $v0, 220($sp) # internal_136 = "is divisible by 3.\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_136 + lw $t0, 232($sp) + sw $t0, 0($sp) # Storing internal_136 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 228($sp) # internal_137 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 216($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 260($sp) + j end_assign + not_is_Bool_or_Int: + # internal_126 = internal_137 + lw $t0, 216($sp) + sw $t0, 260($sp) + end_assign: + + # Jumping to endif_8743762757849 + j endif_8743762757849 + + else_8743762757849: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 7 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 110 + sb $t0, 8($v0) # internal_138[0] = 'n' + + addi $t0, $zero, 117 + sb $t0, 9($v0) # internal_138[1] = 'u' + + addi $t0, $zero, 109 + sb $t0, 10($v0) # internal_138[2] = 'm' + + addi $t0, $zero, 98 + sb $t0, 11($v0) # internal_138[3] = 'b' + + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_138[4] = 'e' + + addi $t0, $zero, 114 + sb $t0, 13($v0) # internal_138[5] = 'r' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_138[6] = ' ' + + sb $zero, 15($v0) # Null-terminator at the end of the string + + sw $v0, 212($sp) # internal_138 = "number " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_138 + lw $t0, 224($sp) + sw $t0, 0($sp) # Storing internal_138 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 220($sp) # internal_139 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 204($sp) # internal_140 = avar + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_140 + lw $t0, 216($sp) + sw $t0, 0($sp) # Storing internal_140 + + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 212($sp) # internal_141 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 32 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 23 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 105 + sb $t0, 8($v0) # internal_142[0] = 'i' + + addi $t0, $zero, 115 + sb $t0, 9($v0) # internal_142[1] = 's' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_142[2] = ' ' + + addi $t0, $zero, 110 + sb $t0, 11($v0) # internal_142[3] = 'n' + + addi $t0, $zero, 111 + sb $t0, 12($v0) # internal_142[4] = 'o' + + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_142[5] = 't' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_142[6] = ' ' + + addi $t0, $zero, 100 + sb $t0, 15($v0) # internal_142[7] = 'd' + + addi $t0, $zero, 105 + sb $t0, 16($v0) # internal_142[8] = 'i' + + addi $t0, $zero, 118 + sb $t0, 17($v0) # internal_142[9] = 'v' + + addi $t0, $zero, 105 + sb $t0, 18($v0) # internal_142[10] = 'i' + + addi $t0, $zero, 115 + sb $t0, 19($v0) # internal_142[11] = 's' + + addi $t0, $zero, 105 + sb $t0, 20($v0) # internal_142[12] = 'i' + + addi $t0, $zero, 98 + sb $t0, 21($v0) # internal_142[13] = 'b' + + addi $t0, $zero, 108 + sb $t0, 22($v0) # internal_142[14] = 'l' + + addi $t0, $zero, 101 + sb $t0, 23($v0) # internal_142[15] = 'e' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_142[16] = ' ' + + addi $t0, $zero, 98 + sb $t0, 25($v0) # internal_142[17] = 'b' + + addi $t0, $zero, 121 + sb $t0, 26($v0) # internal_142[18] = 'y' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_142[19] = ' ' + + addi $t0, $zero, 51 + sb $t0, 28($v0) # internal_142[20] = '3' + + addi $t0, $zero, 46 + sb $t0, 29($v0) # internal_142[21] = '.' + + addi $t0, $zero, 10 + sb $t0, 30($v0) # internal_142[22] = '\n' + + sb $zero, 31($v0) # Null-terminator at the end of the string + + sw $v0, 196($sp) # internal_142 = "is not divisible by 3.\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_142 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_142 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 204($sp) # internal_143 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 192($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 260($sp) + j end_assign + not_is_Bool_or_Int: + # internal_126 = internal_143 + lw $t0, 192($sp) + sw $t0, 260($sp) + end_assign: + + # Jumping to endif_8743762757849 + j endif_8743762757849 + + endif_8743762757849: + + lw $t0, 260($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 280($sp) + j end_assign + not_is_Bool_or_Int: + # internal_121 = internal_126 + lw $t0, 260($sp) + sw $t0, 280($sp) + end_assign: + + # Jumping to endif_8743762758946 + j endif_8743762758946 + + else_8743762758946: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 184($sp) # internal_145 = address of allocated object Int + + # Get attribute char of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the instance + sw $t1, 180($sp) # internal_146 = char + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 104 + sb $t0, 8($v0) # internal_147[0] = 'h' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 176($sp) # internal_147 = "h" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_146 + lw $t0, 192($sp) + sw $t0, 4($sp) # Storing internal_146 + + # Argument internal_147 + lw $t0, 188($sp) + sw $t0, 0($sp) # Storing internal_147 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 184($sp) # internal_148 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 172($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 184($sp) + j end_assign + not_is_Bool_or_Int: + # internal_145 = internal_148 + lw $t0, 172($sp) + sw $t0, 184($sp) + end_assign: + + # If internal_145 then goto then_8743762758940 + lw $t0, 184($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762758940 + + # Jumping to else_8743762758940 + j else_8743762758940 + + then_8743762758940: + + # Allocating E + li $v0, 9 + lw $a0, type_E + syscall + la $t0, type_E # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 164($sp) # internal_150 = address of allocated object E + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_150 + lw $t0, 172($sp) + sw $t0, 0($sp) # Storing internal_150 + + # Calling function function___init___at_E + jal function___init___at_E + lw $ra, 4($sp) + sw $v1, 172($sp) # internal_150 = result of function___init___at_E + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 160($sp) # internal_151 = avar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_151 + lw $t0, 168($sp) + sw $t0, 0($sp) # Storing internal_151 + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 164($sp) # internal_152 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_150 + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing internal_150 + + # Argument internal_152 + lw $t0, 168($sp) + sw $t0, 0($sp) # Storing internal_152 + + # Calling function function_method6_at_E + jal function_method6_at_E + lw $ra, 8($sp) + sw $v1, 164($sp) # internal_153 = result of function_method6_at_E + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 152($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 168($sp) + j end_assign + not_is_Bool_or_Int: + # x = internal_153 + lw $t0, 152($sp) + sw $t0, 168($sp) + end_assign: + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 144($sp) # internal_155 = avar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_155 + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing internal_155 + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 148($sp) # internal_156 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument x + lw $t0, 176($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 144($sp) # internal_157 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 132($sp) # internal_158 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_157 + lw $t0, 148($sp) + sw $t0, 4($sp) # Storing internal_157 + + # Argument internal_158 + lw $t0, 144($sp) + sw $t0, 0($sp) # Storing internal_158 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 140($sp) # internal_159 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_156 + lw $t0, 152($sp) + sw $t0, 4($sp) # Storing internal_156 + + # Argument internal_159 + lw $t0, 140($sp) + sw $t0, 0($sp) # Storing internal_159 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 136($sp) # internal_160 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 124($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 148($sp) + j end_assign + not_is_Bool_or_Int: + # r = internal_160 + lw $t0, 124($sp) + sw $t0, 148($sp) + end_assign: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 7 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 110 + sb $t0, 8($v0) # internal_161[0] = 'n' + + addi $t0, $zero, 117 + sb $t0, 9($v0) # internal_161[1] = 'u' + + addi $t0, $zero, 109 + sb $t0, 10($v0) # internal_161[2] = 'm' + + addi $t0, $zero, 98 + sb $t0, 11($v0) # internal_161[3] = 'b' + + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_161[4] = 'e' + + addi $t0, $zero, 114 + sb $t0, 13($v0) # internal_161[5] = 'r' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_161[6] = ' ' + + sb $zero, 15($v0) # Null-terminator at the end of the string + + sw $v0, 120($sp) # internal_161 = "number " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_161 + lw $t0, 132($sp) + sw $t0, 0($sp) # Storing internal_161 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 128($sp) # internal_162 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 112($sp) # internal_163 = avar + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_163 + lw $t0, 124($sp) + sw $t0, 0($sp) # Storing internal_163 + + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 120($sp) # internal_164 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 105 + sb $t0, 8($v0) # internal_165[0] = 'i' + + addi $t0, $zero, 115 + sb $t0, 9($v0) # internal_165[1] = 's' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_165[2] = ' ' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_165[3] = 'e' + + addi $t0, $zero, 113 + sb $t0, 12($v0) # internal_165[4] = 'q' + + addi $t0, $zero, 117 + sb $t0, 13($v0) # internal_165[5] = 'u' + + addi $t0, $zero, 97 + sb $t0, 14($v0) # internal_165[6] = 'a' + + addi $t0, $zero, 108 + sb $t0, 15($v0) # internal_165[7] = 'l' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_165[8] = ' ' + + addi $t0, $zero, 116 + sb $t0, 17($v0) # internal_165[9] = 't' + + addi $t0, $zero, 111 + sb $t0, 18($v0) # internal_165[10] = 'o' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_165[11] = ' ' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 104($sp) # internal_165 = "is equal to " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_165 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_165 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 112($sp) # internal_166 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument x + lw $t0, 180($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 108($sp) # internal_167 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 37 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 28 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 116 + sb $t0, 8($v0) # internal_168[0] = 't' + + addi $t0, $zero, 105 + sb $t0, 9($v0) # internal_168[1] = 'i' + + addi $t0, $zero, 109 + sb $t0, 10($v0) # internal_168[2] = 'm' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_168[3] = 'e' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_168[4] = 's' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_168[5] = ' ' + + addi $t0, $zero, 56 + sb $t0, 14($v0) # internal_168[6] = '8' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_168[7] = ' ' + + addi $t0, $zero, 119 + sb $t0, 16($v0) # internal_168[8] = 'w' + + addi $t0, $zero, 105 + sb $t0, 17($v0) # internal_168[9] = 'i' + + addi $t0, $zero, 116 + sb $t0, 18($v0) # internal_168[10] = 't' + + addi $t0, $zero, 104 + sb $t0, 19($v0) # internal_168[11] = 'h' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_168[12] = ' ' + + addi $t0, $zero, 97 + sb $t0, 21($v0) # internal_168[13] = 'a' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_168[14] = ' ' + + addi $t0, $zero, 114 + sb $t0, 23($v0) # internal_168[15] = 'r' + + addi $t0, $zero, 101 + sb $t0, 24($v0) # internal_168[16] = 'e' + + addi $t0, $zero, 109 + sb $t0, 25($v0) # internal_168[17] = 'm' + + addi $t0, $zero, 97 + sb $t0, 26($v0) # internal_168[18] = 'a' + + addi $t0, $zero, 105 + sb $t0, 27($v0) # internal_168[19] = 'i' + + addi $t0, $zero, 110 + sb $t0, 28($v0) # internal_168[20] = 'n' + + addi $t0, $zero, 100 + sb $t0, 29($v0) # internal_168[21] = 'd' + + addi $t0, $zero, 101 + sb $t0, 30($v0) # internal_168[22] = 'e' + + addi $t0, $zero, 114 + sb $t0, 31($v0) # internal_168[23] = 'r' + + addi $t0, $zero, 32 + sb $t0, 32($v0) # internal_168[24] = ' ' + + addi $t0, $zero, 111 + sb $t0, 33($v0) # internal_168[25] = 'o' + + addi $t0, $zero, 102 + sb $t0, 34($v0) # internal_168[26] = 'f' + + addi $t0, $zero, 32 + sb $t0, 35($v0) # internal_168[27] = ' ' + + sb $zero, 36($v0) # Null-terminator at the end of the string + + sw $v0, 92($sp) # internal_168 = "times 8 with a remainder of " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_168 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_168 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_169 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating A2I + li $v0, 9 + lw $a0, type_A2I + syscall + la $t0, type_A2I # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 80($sp) # internal_171 = address of allocated object A2I + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_171 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_171 + + # Calling function function___init___at_A2I + jal function___init___at_A2I + lw $ra, 4($sp) + sw $v1, 88($sp) # internal_171 = result of function___init___at_A2I + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 80($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 476($sp) + j end_assign + not_is_Bool_or_Int: + # a = internal_171 + lw $t0, 80($sp) + sw $t0, 476($sp) + end_assign: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument a + lw $t0, 488($sp) + sw $t0, 4($sp) # Storing a + + # Argument r + lw $t0, 160($sp) + sw $t0, 0($sp) # Storing r + + # Calling function function_i2a_at_A2I + jal function_i2a_at_A2I + lw $ra, 8($sp) + sw $v1, 88($sp) # internal_172 = result of function_i2a_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_172 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_172 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_173 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_174[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 68($sp) # internal_174 = "\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 780($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_174 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_174 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 76($sp) # internal_175 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 168($sp) # $t1 = x + sw $t1, 12($t0) # self.avar = x + + lw $t0, 168($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 188($sp) + j end_assign + not_is_Bool_or_Int: + # internal_144 = x + lw $t0, 168($sp) + sw $t0, 188($sp) + end_assign: + + # Jumping to endif_8743762758940 + j endif_8743762758940 + + else_8743762758940: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_177 = address of allocated object Int + + # Get attribute char of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the instance + sw $t1, 52($sp) # internal_178 = char + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 106 + sb $t0, 8($v0) # internal_179[0] = 'j' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 48($sp) # internal_179 = "j" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_178 + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing internal_178 + + # Argument internal_179 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_179 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 56($sp) # internal_180 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 44($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 56($sp) + j end_assign + not_is_Bool_or_Int: + # internal_177 = internal_180 + lw $t0, 44($sp) + sw $t0, 56($sp) + end_assign: + + # If internal_177 then goto then_8743762758934 + lw $t0, 56($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762758934 + + # Jumping to else_8743762758934 + j else_8743762758934 + + then_8743762758934: + + # Allocating A + li $v0, 9 + lw $a0, type_A + syscall + la $t0, type_A # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 40($sp) # internal_181 = address of allocated object A + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_181 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_181 + + # Calling function function___init___at_A + jal function___init___at_A + lw $ra, 4($sp) + sw $v1, 48($sp) # internal_181 = result of function___init___at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 40($sp) # $t1 = internal_181 + sw $t1, 12($t0) # self.avar = internal_181 + + lw $t0, 40($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # internal_176 = internal_181 + lw $t0, 40($sp) + sw $t0, 60($sp) + end_assign: + + # Jumping to endif_8743762758934 + j endif_8743762758934 + + else_8743762758934: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_183 = address of allocated object Int + + # Get attribute char of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the instance + sw $t1, 28($sp) # internal_184 = char + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 113 + sb $t0, 8($v0) # internal_185[0] = 'q' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 24($sp) # internal_185 = "q" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_184 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_184 + + # Argument internal_185 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_185 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_186 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 20($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 32($sp) + j end_assign + not_is_Bool_or_Int: + # internal_183 = internal_186 + lw $t0, 20($sp) + sw $t0, 32($sp) + end_assign: + + # If internal_183 then goto then_8743762758394 + lw $t0, 32($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743762758394 + + # Jumping to else_8743762758394 + j else_8743762758394 + + then_8743762758394: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_187 = address of allocated object Int + + # Set attribute flag of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 16($sp) # $t1 = internal_187 + sw $t1, 20($t0) # self.flag = internal_187 + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 36($sp) + j end_assign + not_is_Bool_or_Int: + # internal_182 = internal_187 + lw $t0, 16($sp) + sw $t0, 36($sp) + end_assign: + + # Jumping to endif_8743762758394 + j endif_8743762758394 + + else_8743762758394: + + # Allocating A + li $v0, 9 + lw $a0, type_A + syscall + la $t0, type_A # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_188 = address of allocated object A + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_188 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_188 + + # Calling function function___init___at_A + jal function___init___at_A + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_188 = result of function___init___at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 768($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + sw $t1, 8($sp) # internal_189 = avar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_189 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_189 + + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_190 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_188 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_188 + + # Argument internal_190 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_190 + + # Calling function function_method1_at_A + jal function_method1_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_191 = result of function_method1_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 768($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_191 + sw $t1, 12($t0) # self.avar = internal_191 + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 36($sp) + j end_assign + not_is_Bool_or_Int: + # internal_182 = internal_191 + lw $t0, 0($sp) + sw $t0, 36($sp) + end_assign: + + # Jumping to endif_8743762758394 + j endif_8743762758394 + + endif_8743762758394: + + lw $t0, 36($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # internal_176 = internal_182 + lw $t0, 36($sp) + sw $t0, 60($sp) + end_assign: + + # Jumping to endif_8743762758934 + j endif_8743762758934 + + endif_8743762758934: + + lw $t0, 60($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 188($sp) + j end_assign + not_is_Bool_or_Int: + # internal_144 = internal_176 + lw $t0, 60($sp) + sw $t0, 188($sp) + end_assign: + + # Jumping to endif_8743762758940 + j endif_8743762758940 + + endif_8743762758940: + + lw $t0, 188($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 280($sp) + j end_assign + not_is_Bool_or_Int: + # internal_121 = internal_144 + lw $t0, 188($sp) + sw $t0, 280($sp) + end_assign: + + # Jumping to endif_8743762758946 + j endif_8743762758946 + + endif_8743762758946: + + lw $t0, 280($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 316($sp) + j end_assign + not_is_Bool_or_Int: + # internal_112 = internal_121 + lw $t0, 280($sp) + sw $t0, 316($sp) + end_assign: + + # Jumping to endif_8743762758952 + j endif_8743762758952 + + endif_8743762758952: + + lw $t0, 316($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 352($sp) + j end_assign + not_is_Bool_or_Int: + # internal_103 = internal_112 + lw $t0, 316($sp) + sw $t0, 352($sp) + end_assign: + + # Jumping to endif_8743762758958 + j endif_8743762758958 + + endif_8743762758958: + + lw $t0, 352($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 388($sp) + j end_assign + not_is_Bool_or_Int: + # internal_94 = internal_103 + lw $t0, 352($sp) + sw $t0, 388($sp) + end_assign: + + # Jumping to endif_8743762758964 + j endif_8743762758964 + + endif_8743762758964: + + lw $t0, 388($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 444($sp) + j end_assign + not_is_Bool_or_Int: + # internal_80 = internal_94 + lw $t0, 388($sp) + sw $t0, 444($sp) + end_assign: + + # Jumping to endif_8743762758970 + j endif_8743762758970 + + endif_8743762758970: + + lw $t0, 444($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 632($sp) + j end_assign + not_is_Bool_or_Int: + # internal_33 = internal_80 + lw $t0, 444($sp) + sw $t0, 632($sp) + end_assign: + + # Jumping to endif_8743762758976 + j endif_8743762758976 + + endif_8743762758976: + + lw $t0, 632($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 688($sp) + j end_assign + not_is_Bool_or_Int: + # internal_19 = internal_33 + lw $t0, 632($sp) + sw $t0, 688($sp) + end_assign: + + # Jumping to endif_8743762758982 + j endif_8743762758982 + + endif_8743762758982: + + # Jumping to while_start_8743762758997 + j while_start_8743762758997 + + while_end_8743762758997: + + # Loading return value in $v1 + addi $v1, $zero, 0 + + # Freeing space for local variables + addi $sp, $sp, 768 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_main_at_Main + jal function_main_at_Main + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/atoi.mips b/tests/codegen/atoi.mips new file mode 100644 index 000000000..dcebf84f1 --- /dev/null +++ b/tests/codegen/atoi.mips @@ -0,0 +1,5747 @@ +.data + type_Object: .word 8 + type_Object_inherits_from: .word 0 + type_Object_attributes: .word 0 + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO: .word 8 + type_IO_inherits_from: .word type_Object + type_IO_attributes: .word 0 + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_Int: .word 8 + type_Int_inherits_from: .word type_Object + type_Int_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_String: .word 8 + type_String_inherits_from: .word type_Object + type_String_attributes: .word 0 + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Bool: .word 8 + type_Bool_inherits_from: .word type_Object + type_Bool_attributes: .word 0 + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_A2I: .word 8 + type_A2I_inherits_from: .word type_Object + type_A2I_attributes: .word 0 + type_A2I_name_size: .word 3 + type_A2I_name: .asciiz "A2I" + + type_Main: .word 8 + type_Main_inherits_from: .word type_IO + type_Main_attributes: .word 0 + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 40($sp) + # a = 36($sp) + # b = 32($sp) + + # Reserving space for local variables + addi $sp, $sp, -32 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_0 = address of allocated object Int + + # internal_1 = typeof a that is the first word of the object + lw $t0, 36($sp) + lw $t1, 0($t0) + sw $t1, 24($sp) + + # internal_2 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_3 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_4 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_7 = address of allocated object Int + + # internal_5 = EqualAddress(internal_1, internal_2) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_1, internal_3) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_7 = EqualAddress(internal_1, internal_4) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_6 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_7 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 36($sp) + lw $t0, 8($t0) + lw $t1, 32($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 36($sp) + lw $t1, 32($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 28($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 28($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 36($sp) # Save in $t0 the left operand address + lw $t1, 32($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 28($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 28($sp) + + # Freeing space for local variables + addi $sp, $sp, 32 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 12($t1) # $t1 = length of the name of self + lw $t3, 16($t1) # $t1 = name of self + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + move $t4, $v0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + addi $t0, $t0, 8 # Pointer to the first character of the string in self + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t1, while_copy_name_end + lb $t6, 0($t0) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t0, $t0, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $t4, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the string x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lw $t1, buffer_input($t0) # Loading the byte + beq $t1, $zero, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lw $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 5 + syscall + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + sw $t1, 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 0($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 0($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + lw $t2, 8($sp) # $t2 = start of the substring + lw $t3, 4($sp) # $t3 = length of the substring + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bge $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_A2I: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_c2i_at_A2I: + # Function parameters + # $ra = 216($sp) + # self = 212($sp) + # char = 208($sp) + + # Reserving space for local variables + addi $sp, $sp, -208 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 200($sp) # internal_1 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 48 + sb $t0, 8($v0) # internal_2[0] = '0' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 196($sp) # internal_2 = "0" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_2 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 204($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 192($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 200($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_3 + lw $t0, 192($sp) + sw $t0, 200($sp) + end_assign: + + # If internal_1 then goto then_8790281930397 + lw $t0, 200($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8790281930397 + + # Jumping to else_8790281930397 + j else_8790281930397 + + then_8790281930397: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 188($sp) # internal_4 = address of allocated object Int + + lw $t0, 188($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 204($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_4 + lw $t0, 188($sp) + sw $t0, 204($sp) + end_assign: + + # Jumping to endif_8790281930397 + j endif_8790281930397 + + else_8790281930397: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 180($sp) # internal_6 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 49 + sb $t0, 8($v0) # internal_7[0] = '1' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 176($sp) # internal_7 = "1" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_7 + lw $t0, 188($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 184($sp) # internal_8 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 172($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 180($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_8 + lw $t0, 172($sp) + sw $t0, 180($sp) + end_assign: + + # If internal_6 then goto then_8790281930391 + lw $t0, 180($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8790281930391 + + # Jumping to else_8790281930391 + j else_8790281930391 + + then_8790281930391: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 168($sp) # internal_9 = address of allocated object Int + + lw $t0, 168($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 184($sp) + j end_assign + not_is_Bool_or_Int: + # internal_5 = internal_9 + lw $t0, 168($sp) + sw $t0, 184($sp) + end_assign: + + # Jumping to endif_8790281930391 + j endif_8790281930391 + + else_8790281930391: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_11 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 50 + sb $t0, 8($v0) # internal_12[0] = '2' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 156($sp) # internal_12 = "2" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_12 + lw $t0, 168($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 164($sp) # internal_13 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 152($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 160($sp) + j end_assign + not_is_Bool_or_Int: + # internal_11 = internal_13 + lw $t0, 152($sp) + sw $t0, 160($sp) + end_assign: + + # If internal_11 then goto then_8790281930385 + lw $t0, 160($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8790281930385 + + # Jumping to else_8790281930385 + j else_8790281930385 + + then_8790281930385: + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 148($sp) # internal_14 = address of allocated object Int + + lw $t0, 148($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 164($sp) + j end_assign + not_is_Bool_or_Int: + # internal_10 = internal_14 + lw $t0, 148($sp) + sw $t0, 164($sp) + end_assign: + + # Jumping to endif_8790281930385 + j endif_8790281930385 + + else_8790281930385: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 140($sp) # internal_16 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 51 + sb $t0, 8($v0) # internal_17[0] = '3' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 136($sp) # internal_17 = "3" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_17 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_17 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 144($sp) # internal_18 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 132($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 140($sp) + j end_assign + not_is_Bool_or_Int: + # internal_16 = internal_18 + lw $t0, 132($sp) + sw $t0, 140($sp) + end_assign: + + # If internal_16 then goto then_8790281930379 + lw $t0, 140($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8790281930379 + + # Jumping to else_8790281930379 + j else_8790281930379 + + then_8790281930379: + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_19 = address of allocated object Int + + lw $t0, 128($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 144($sp) + j end_assign + not_is_Bool_or_Int: + # internal_15 = internal_19 + lw $t0, 128($sp) + sw $t0, 144($sp) + end_assign: + + # Jumping to endif_8790281930379 + j endif_8790281930379 + + else_8790281930379: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_21 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 52 + sb $t0, 8($v0) # internal_22[0] = '4' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 116($sp) # internal_22 = "4" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_22 + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 124($sp) # internal_23 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 112($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 120($sp) + j end_assign + not_is_Bool_or_Int: + # internal_21 = internal_23 + lw $t0, 112($sp) + sw $t0, 120($sp) + end_assign: + + # If internal_21 then goto then_8790281930373 + lw $t0, 120($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8790281930373 + + # Jumping to else_8790281930373 + j else_8790281930373 + + then_8790281930373: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_24 = address of allocated object Int + + lw $t0, 108($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 124($sp) + j end_assign + not_is_Bool_or_Int: + # internal_20 = internal_24 + lw $t0, 108($sp) + sw $t0, 124($sp) + end_assign: + + # Jumping to endif_8790281930373 + j endif_8790281930373 + + else_8790281930373: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_26 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 53 + sb $t0, 8($v0) # internal_27[0] = '5' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 96($sp) # internal_27 = "5" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_27 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_27 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 104($sp) # internal_28 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 92($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 100($sp) + j end_assign + not_is_Bool_or_Int: + # internal_26 = internal_28 + lw $t0, 92($sp) + sw $t0, 100($sp) + end_assign: + + # If internal_26 then goto then_8790281930367 + lw $t0, 100($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8790281930367 + + # Jumping to else_8790281930367 + j else_8790281930367 + + then_8790281930367: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_29 = address of allocated object Int + + lw $t0, 88($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 104($sp) + j end_assign + not_is_Bool_or_Int: + # internal_25 = internal_29 + lw $t0, 88($sp) + sw $t0, 104($sp) + end_assign: + + # Jumping to endif_8790281930367 + j endif_8790281930367 + + else_8790281930367: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_31 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 54 + sb $t0, 8($v0) # internal_32[0] = '6' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 76($sp) # internal_32 = "6" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_32 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_32 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_33 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 72($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 80($sp) + j end_assign + not_is_Bool_or_Int: + # internal_31 = internal_33 + lw $t0, 72($sp) + sw $t0, 80($sp) + end_assign: + + # If internal_31 then goto then_8790281930361 + lw $t0, 80($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8790281930361 + + # Jumping to else_8790281930361 + j else_8790281930361 + + then_8790281930361: + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_34 = address of allocated object Int + + lw $t0, 68($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 84($sp) + j end_assign + not_is_Bool_or_Int: + # internal_30 = internal_34 + lw $t0, 68($sp) + sw $t0, 84($sp) + end_assign: + + # Jumping to endif_8790281930361 + j endif_8790281930361 + + else_8790281930361: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_36 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 55 + sb $t0, 8($v0) # internal_37[0] = '7' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 56($sp) # internal_37 = "7" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_37 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_37 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 64($sp) # internal_38 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 52($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # internal_36 = internal_38 + lw $t0, 52($sp) + sw $t0, 60($sp) + end_assign: + + # If internal_36 then goto then_8790281930355 + lw $t0, 60($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8790281930355 + + # Jumping to else_8790281930355 + j else_8790281930355 + + then_8790281930355: + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_39 = address of allocated object Int + + lw $t0, 48($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 64($sp) + j end_assign + not_is_Bool_or_Int: + # internal_35 = internal_39 + lw $t0, 48($sp) + sw $t0, 64($sp) + end_assign: + + # Jumping to endif_8790281930355 + j endif_8790281930355 + + else_8790281930355: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_41 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 56 + sb $t0, 8($v0) # internal_42[0] = '8' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 36($sp) # internal_42 = "8" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_42 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_42 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_43 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 32($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # internal_41 = internal_43 + lw $t0, 32($sp) + sw $t0, 40($sp) + end_assign: + + # If internal_41 then goto then_8790281930349 + lw $t0, 40($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8790281930349 + + # Jumping to else_8790281930349 + j else_8790281930349 + + then_8790281930349: + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_44 = address of allocated object Int + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # internal_40 = internal_44 + lw $t0, 28($sp) + sw $t0, 44($sp) + end_assign: + + # Jumping to endif_8790281930349 + j endif_8790281930349 + + else_8790281930349: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_46 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 57 + sb $t0, 8($v0) # internal_47[0] = '9' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 16($sp) # internal_47 = "9" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_47 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_47 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_48 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 20($sp) + j end_assign + not_is_Bool_or_Int: + # internal_46 = internal_48 + lw $t0, 12($sp) + sw $t0, 20($sp) + end_assign: + + # If internal_46 then goto then_8790281930328 + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8790281930328 + + # Jumping to else_8790281930328 + j else_8790281930328 + + then_8790281930328: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_49 = address of allocated object Int + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # internal_45 = internal_49 + lw $t0, 8($sp) + sw $t0, 24($sp) + end_assign: + + # Jumping to endif_8790281930328 + j endif_8790281930328 + + else_8790281930328: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_abort_at_Object + jal function_abort_at_Object + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_50 = result of function_abort_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_51 = address of allocated object Int + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # internal_45 = internal_51 + lw $t0, 0($sp) + sw $t0, 24($sp) + end_assign: + + # Jumping to endif_8790281930328 + j endif_8790281930328 + + endif_8790281930328: + + lw $t0, 24($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # internal_40 = internal_45 + lw $t0, 24($sp) + sw $t0, 44($sp) + end_assign: + + # Jumping to endif_8790281930349 + j endif_8790281930349 + + endif_8790281930349: + + lw $t0, 44($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 64($sp) + j end_assign + not_is_Bool_or_Int: + # internal_35 = internal_40 + lw $t0, 44($sp) + sw $t0, 64($sp) + end_assign: + + # Jumping to endif_8790281930355 + j endif_8790281930355 + + endif_8790281930355: + + lw $t0, 64($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 84($sp) + j end_assign + not_is_Bool_or_Int: + # internal_30 = internal_35 + lw $t0, 64($sp) + sw $t0, 84($sp) + end_assign: + + # Jumping to endif_8790281930361 + j endif_8790281930361 + + endif_8790281930361: + + lw $t0, 84($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 104($sp) + j end_assign + not_is_Bool_or_Int: + # internal_25 = internal_30 + lw $t0, 84($sp) + sw $t0, 104($sp) + end_assign: + + # Jumping to endif_8790281930367 + j endif_8790281930367 + + endif_8790281930367: + + lw $t0, 104($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 124($sp) + j end_assign + not_is_Bool_or_Int: + # internal_20 = internal_25 + lw $t0, 104($sp) + sw $t0, 124($sp) + end_assign: + + # Jumping to endif_8790281930373 + j endif_8790281930373 + + endif_8790281930373: + + lw $t0, 124($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 144($sp) + j end_assign + not_is_Bool_or_Int: + # internal_15 = internal_20 + lw $t0, 124($sp) + sw $t0, 144($sp) + end_assign: + + # Jumping to endif_8790281930379 + j endif_8790281930379 + + endif_8790281930379: + + lw $t0, 144($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 164($sp) + j end_assign + not_is_Bool_or_Int: + # internal_10 = internal_15 + lw $t0, 144($sp) + sw $t0, 164($sp) + end_assign: + + # Jumping to endif_8790281930385 + j endif_8790281930385 + + endif_8790281930385: + + lw $t0, 164($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 184($sp) + j end_assign + not_is_Bool_or_Int: + # internal_5 = internal_10 + lw $t0, 164($sp) + sw $t0, 184($sp) + end_assign: + + # Jumping to endif_8790281930391 + j endif_8790281930391 + + endif_8790281930391: + + lw $t0, 184($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 204($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_5 + lw $t0, 184($sp) + sw $t0, 204($sp) + end_assign: + + # Jumping to endif_8790281930397 + j endif_8790281930397 + + endif_8790281930397: + + # Loading return value in $v1 + lw $v1, 204($sp) + + # Freeing space for local variables + addi $sp, $sp, 208 + + jr $ra + + function_i2c_at_A2I: + # Function parameters + # $ra = 216($sp) + # self = 212($sp) + # i = 208($sp) + + # Reserving space for local variables + addi $sp, $sp, -208 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 200($sp) # internal_1 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 196($sp) # internal_2 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_2 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 204($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 192($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 200($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_3 + lw $t0, 192($sp) + sw $t0, 200($sp) + end_assign: + + # If internal_1 then goto then_8790281930975 + lw $t0, 200($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8790281930975 + + # Jumping to else_8790281930975 + j else_8790281930975 + + then_8790281930975: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 48 + sb $t0, 8($v0) # internal_4[0] = '0' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 188($sp) # internal_4 = "0" + + lw $t0, 188($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 204($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_4 + lw $t0, 188($sp) + sw $t0, 204($sp) + end_assign: + + # Jumping to endif_8790281930975 + j endif_8790281930975 + + else_8790281930975: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 180($sp) # internal_6 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 176($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_7 + lw $t0, 188($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 184($sp) # internal_8 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 172($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 180($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_8 + lw $t0, 172($sp) + sw $t0, 180($sp) + end_assign: + + # If internal_6 then goto then_8790281930969 + lw $t0, 180($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8790281930969 + + # Jumping to else_8790281930969 + j else_8790281930969 + + then_8790281930969: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 49 + sb $t0, 8($v0) # internal_9[0] = '1' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 168($sp) # internal_9 = "1" + + lw $t0, 168($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 184($sp) + j end_assign + not_is_Bool_or_Int: + # internal_5 = internal_9 + lw $t0, 168($sp) + sw $t0, 184($sp) + end_assign: + + # Jumping to endif_8790281930969 + j endif_8790281930969 + + else_8790281930969: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_11 = address of allocated object Int + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 156($sp) # internal_12 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_12 + lw $t0, 168($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 164($sp) # internal_13 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 152($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 160($sp) + j end_assign + not_is_Bool_or_Int: + # internal_11 = internal_13 + lw $t0, 152($sp) + sw $t0, 160($sp) + end_assign: + + # If internal_11 then goto then_8790281930963 + lw $t0, 160($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8790281930963 + + # Jumping to else_8790281930963 + j else_8790281930963 + + then_8790281930963: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 50 + sb $t0, 8($v0) # internal_14[0] = '2' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 148($sp) # internal_14 = "2" + + lw $t0, 148($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 164($sp) + j end_assign + not_is_Bool_or_Int: + # internal_10 = internal_14 + lw $t0, 148($sp) + sw $t0, 164($sp) + end_assign: + + # Jumping to endif_8790281930963 + j endif_8790281930963 + + else_8790281930963: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 140($sp) # internal_16 = address of allocated object Int + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_17 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_17 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_17 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 144($sp) # internal_18 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 132($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 140($sp) + j end_assign + not_is_Bool_or_Int: + # internal_16 = internal_18 + lw $t0, 132($sp) + sw $t0, 140($sp) + end_assign: + + # If internal_16 then goto then_8790281930957 + lw $t0, 140($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8790281930957 + + # Jumping to else_8790281930957 + j else_8790281930957 + + then_8790281930957: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 51 + sb $t0, 8($v0) # internal_19[0] = '3' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 128($sp) # internal_19 = "3" + + lw $t0, 128($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 144($sp) + j end_assign + not_is_Bool_or_Int: + # internal_15 = internal_19 + lw $t0, 128($sp) + sw $t0, 144($sp) + end_assign: + + # Jumping to endif_8790281930957 + j endif_8790281930957 + + else_8790281930957: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_21 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 116($sp) # internal_22 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_22 + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 124($sp) # internal_23 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 112($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 120($sp) + j end_assign + not_is_Bool_or_Int: + # internal_21 = internal_23 + lw $t0, 112($sp) + sw $t0, 120($sp) + end_assign: + + # If internal_21 then goto then_8790281930951 + lw $t0, 120($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8790281930951 + + # Jumping to else_8790281930951 + j else_8790281930951 + + then_8790281930951: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 52 + sb $t0, 8($v0) # internal_24[0] = '4' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 108($sp) # internal_24 = "4" + + lw $t0, 108($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 124($sp) + j end_assign + not_is_Bool_or_Int: + # internal_20 = internal_24 + lw $t0, 108($sp) + sw $t0, 124($sp) + end_assign: + + # Jumping to endif_8790281930951 + j endif_8790281930951 + + else_8790281930951: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_26 = address of allocated object Int + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_27 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_27 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_27 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 104($sp) # internal_28 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 92($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 100($sp) + j end_assign + not_is_Bool_or_Int: + # internal_26 = internal_28 + lw $t0, 92($sp) + sw $t0, 100($sp) + end_assign: + + # If internal_26 then goto then_8790281930945 + lw $t0, 100($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8790281930945 + + # Jumping to else_8790281930945 + j else_8790281930945 + + then_8790281930945: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 53 + sb $t0, 8($v0) # internal_29[0] = '5' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 88($sp) # internal_29 = "5" + + lw $t0, 88($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 104($sp) + j end_assign + not_is_Bool_or_Int: + # internal_25 = internal_29 + lw $t0, 88($sp) + sw $t0, 104($sp) + end_assign: + + # Jumping to endif_8790281930945 + j endif_8790281930945 + + else_8790281930945: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_31 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_32 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_32 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_32 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_33 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 72($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 80($sp) + j end_assign + not_is_Bool_or_Int: + # internal_31 = internal_33 + lw $t0, 72($sp) + sw $t0, 80($sp) + end_assign: + + # If internal_31 then goto then_8790281930939 + lw $t0, 80($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8790281930939 + + # Jumping to else_8790281930939 + j else_8790281930939 + + then_8790281930939: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 54 + sb $t0, 8($v0) # internal_34[0] = '6' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 68($sp) # internal_34 = "6" + + lw $t0, 68($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 84($sp) + j end_assign + not_is_Bool_or_Int: + # internal_30 = internal_34 + lw $t0, 68($sp) + sw $t0, 84($sp) + end_assign: + + # Jumping to endif_8790281930939 + j endif_8790281930939 + + else_8790281930939: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_36 = address of allocated object Int + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_37 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_37 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_37 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 64($sp) # internal_38 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 52($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # internal_36 = internal_38 + lw $t0, 52($sp) + sw $t0, 60($sp) + end_assign: + + # If internal_36 then goto then_8790281930933 + lw $t0, 60($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8790281930933 + + # Jumping to else_8790281930933 + j else_8790281930933 + + then_8790281930933: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 55 + sb $t0, 8($v0) # internal_39[0] = '7' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 48($sp) # internal_39 = "7" + + lw $t0, 48($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 64($sp) + j end_assign + not_is_Bool_or_Int: + # internal_35 = internal_39 + lw $t0, 48($sp) + sw $t0, 64($sp) + end_assign: + + # Jumping to endif_8790281930933 + j endif_8790281930933 + + else_8790281930933: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_41 = address of allocated object Int + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_42 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_42 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_42 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_43 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 32($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # internal_41 = internal_43 + lw $t0, 32($sp) + sw $t0, 40($sp) + end_assign: + + # If internal_41 then goto then_8790281930927 + lw $t0, 40($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8790281930927 + + # Jumping to else_8790281930927 + j else_8790281930927 + + then_8790281930927: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 56 + sb $t0, 8($v0) # internal_44[0] = '8' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 28($sp) # internal_44 = "8" + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # internal_40 = internal_44 + lw $t0, 28($sp) + sw $t0, 44($sp) + end_assign: + + # Jumping to endif_8790281930927 + j endif_8790281930927 + + else_8790281930927: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_46 = address of allocated object Int + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_47 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_47 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_47 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_48 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 20($sp) + j end_assign + not_is_Bool_or_Int: + # internal_46 = internal_48 + lw $t0, 12($sp) + sw $t0, 20($sp) + end_assign: + + # If internal_46 then goto then_8790281930906 + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8790281930906 + + # Jumping to else_8790281930906 + j else_8790281930906 + + then_8790281930906: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 57 + sb $t0, 8($v0) # internal_49[0] = '9' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_49 = "9" + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # internal_45 = internal_49 + lw $t0, 8($sp) + sw $t0, 24($sp) + end_assign: + + # Jumping to endif_8790281930906 + j endif_8790281930906 + + else_8790281930906: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_abort_at_Object + jal function_abort_at_Object + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_50 = result of function_abort_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 0 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_51 = "" + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # internal_45 = internal_51 + lw $t0, 0($sp) + sw $t0, 24($sp) + end_assign: + + # Jumping to endif_8790281930906 + j endif_8790281930906 + + endif_8790281930906: + + lw $t0, 24($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # internal_40 = internal_45 + lw $t0, 24($sp) + sw $t0, 44($sp) + end_assign: + + # Jumping to endif_8790281930927 + j endif_8790281930927 + + endif_8790281930927: + + lw $t0, 44($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 64($sp) + j end_assign + not_is_Bool_or_Int: + # internal_35 = internal_40 + lw $t0, 44($sp) + sw $t0, 64($sp) + end_assign: + + # Jumping to endif_8790281930933 + j endif_8790281930933 + + endif_8790281930933: + + lw $t0, 64($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 84($sp) + j end_assign + not_is_Bool_or_Int: + # internal_30 = internal_35 + lw $t0, 64($sp) + sw $t0, 84($sp) + end_assign: + + # Jumping to endif_8790281930939 + j endif_8790281930939 + + endif_8790281930939: + + lw $t0, 84($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 104($sp) + j end_assign + not_is_Bool_or_Int: + # internal_25 = internal_30 + lw $t0, 84($sp) + sw $t0, 104($sp) + end_assign: + + # Jumping to endif_8790281930945 + j endif_8790281930945 + + endif_8790281930945: + + lw $t0, 104($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 124($sp) + j end_assign + not_is_Bool_or_Int: + # internal_20 = internal_25 + lw $t0, 104($sp) + sw $t0, 124($sp) + end_assign: + + # Jumping to endif_8790281930951 + j endif_8790281930951 + + endif_8790281930951: + + lw $t0, 124($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 144($sp) + j end_assign + not_is_Bool_or_Int: + # internal_15 = internal_20 + lw $t0, 124($sp) + sw $t0, 144($sp) + end_assign: + + # Jumping to endif_8790281930957 + j endif_8790281930957 + + endif_8790281930957: + + lw $t0, 144($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 164($sp) + j end_assign + not_is_Bool_or_Int: + # internal_10 = internal_15 + lw $t0, 144($sp) + sw $t0, 164($sp) + end_assign: + + # Jumping to endif_8790281930963 + j endif_8790281930963 + + endif_8790281930963: + + lw $t0, 164($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 184($sp) + j end_assign + not_is_Bool_or_Int: + # internal_5 = internal_10 + lw $t0, 164($sp) + sw $t0, 184($sp) + end_assign: + + # Jumping to endif_8790281930969 + j endif_8790281930969 + + endif_8790281930969: + + lw $t0, 184($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 204($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_5 + lw $t0, 184($sp) + sw $t0, 204($sp) + end_assign: + + # Jumping to endif_8790281930975 + j endif_8790281930975 + + endif_8790281930975: + + # Loading return value in $v1 + lw $v1, 204($sp) + + # Freeing space for local variables + addi $sp, $sp, 208 + + jr $ra + + function_a2i_at_A2I: + # Function parameters + # $ra = 152($sp) + # self = 148($sp) + # s = 144($sp) + + # Reserving space for local variables + addi $sp, $sp, -144 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 140($sp) # internal_2 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 144($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 140($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 136($sp) # internal_4 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 124($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 136($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_4 + lw $t0, 124($sp) + sw $t0, 136($sp) + end_assign: + + # If internal_1 then goto then_8790281931421 + lw $t0, 136($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8790281931421 + + # Jumping to else_8790281931421 + j else_8790281931421 + + then_8790281931421: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_5 = address of allocated object Int + + lw $t0, 120($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 140($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_5 + lw $t0, 120($sp) + sw $t0, 140($sp) + end_assign: + + # Jumping to endif_8790281931421 + j endif_8790281931421 + + else_8790281931421: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_7 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_8 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_9 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 160($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_8 + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument internal_9 + lw $t0, 120($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 116($sp) # internal_10 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 45 + sb $t0, 8($v0) # internal_11[0] = '-' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 96($sp) # internal_11 = "-" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_11 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 104($sp) # internal_12 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 92($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 112($sp) + j end_assign + not_is_Bool_or_Int: + # internal_7 = internal_12 + lw $t0, 92($sp) + sw $t0, 112($sp) + end_assign: + + # If internal_7 then goto then_8790281931436 + lw $t0, 112($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8790281931436 + + # Jumping to else_8790281931436 + j else_8790281931436 + + then_8790281931436: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_13 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 92($sp) # internal_14 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_15 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_14 + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing internal_14 + + # Argument internal_15 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 88($sp) # internal_16 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 160($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_13 + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing internal_13 + + # Argument internal_16 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 88($sp) # internal_17 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_17 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_17 + + # Calling function function_a2i_aux_at_A2I + jal function_a2i_aux_at_A2I + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_18 = result of function_a2i_aux_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + # Xor operation + lw $t0, 68($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 60($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 56($sp) # $t0 = internal_21 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Addition operation + lw $t0, 56($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 64($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 56($sp) # $t0 = internal_21 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + lw $t0, 56($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 116($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_21 + lw $t0, 56($sp) + sw $t0, 116($sp) + end_assign: + + # Jumping to endif_8790281931436 + j endif_8790281931436 + + else_8790281931436: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_23 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_24 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_25 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 160($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_24 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing internal_24 + + # Argument internal_25 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_25 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 52($sp) # internal_26 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 43 + sb $t0, 8($v0) # internal_27[0] = '+' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 32($sp) # internal_27 = "+" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_26 + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing internal_26 + + # Argument internal_27 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_27 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_28 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 48($sp) + j end_assign + not_is_Bool_or_Int: + # internal_23 = internal_28 + lw $t0, 28($sp) + sw $t0, 48($sp) + end_assign: + + # If internal_23 then goto then_8790281931430 + lw $t0, 48($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8790281931430 + + # Jumping to else_8790281931430 + j else_8790281931430 + + then_8790281931430: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_29 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_30 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_31 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_30 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_30 + + # Argument internal_31 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_31 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_32 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 160($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_29 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_29 + + # Argument internal_32 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_32 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 24($sp) # internal_33 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_33 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_33 + + # Calling function function_a2i_aux_at_A2I + jal function_a2i_aux_at_A2I + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_34 = result of function_a2i_aux_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 4($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # internal_22 = internal_34 + lw $t0, 4($sp) + sw $t0, 52($sp) + end_assign: + + # Jumping to endif_8790281931430 + j endif_8790281931430 + + else_8790281931430: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing self + + # Argument s + lw $t0, 156($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_a2i_aux_at_A2I + jal function_a2i_aux_at_A2I + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_35 = result of function_a2i_aux_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # internal_22 = internal_35 + lw $t0, 0($sp) + sw $t0, 52($sp) + end_assign: + + # Jumping to endif_8790281931430 + j endif_8790281931430 + + endif_8790281931430: + + lw $t0, 52($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 116($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_22 + lw $t0, 52($sp) + sw $t0, 116($sp) + end_assign: + + # Jumping to endif_8790281931436 + j endif_8790281931436 + + endif_8790281931436: + + lw $t0, 116($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 140($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_6 + lw $t0, 116($sp) + sw $t0, 140($sp) + end_assign: + + # Jumping to endif_8790281931421 + j endif_8790281931421 + + endif_8790281931421: + + # Loading return value in $v1 + lw $v1, 140($sp) + + # Freeing space for local variables + addi $sp, $sp, 144 + + jr $ra + + function_a2i_aux_at_A2I: + # Function parameters + # $ra = 72($sp) + # self = 68($sp) + # s = 64($sp) + + # Reserving space for local variables + addi $sp, $sp, -64 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_1 = address of allocated object Int + + lw $t0, 56($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # int = internal_1 + lw $t0, 56($sp) + sw $t0, 60($sp) + end_assign: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 56($sp) # internal_3 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 48($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # j = internal_3 + lw $t0, 48($sp) + sw $t0, 52($sp) + end_assign: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_5 = address of allocated object Int + + lw $t0, 40($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # i = internal_5 + lw $t0, 40($sp) + sw $t0, 44($sp) + end_assign: + + while_start_8790281931834: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing i + + # Argument j + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing j + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_7 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 32($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 36($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_7 + lw $t0, 32($sp) + sw $t0, 36($sp) + end_assign: + + # If internal_6 then goto while_body_8790281931834 + lw $t0, 36($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8790281931834 + + # Jumping to while_end_8790281931834 + j while_end_8790281931834 + + while_body_8790281931834: + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_8 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument int + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing int + + # Argument internal_8 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_9 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_10 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 80($sp) + sw $t0, 8($sp) # Storing s + + # Argument i + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_10 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 32($sp) # internal_11 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_11 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_c2i_at_A2I + jal function_c2i_at_A2I + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_12 = result of function_c2i_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_9 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_9 + + # Argument internal_12 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_13 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # int = internal_13 + lw $t0, 8($sp) + sw $t0, 60($sp) + end_assign: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_14 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_14 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_14 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_15 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # i = internal_15 + lw $t0, 0($sp) + sw $t0, 44($sp) + end_assign: + + # Jumping to while_start_8790281931834 + j while_start_8790281931834 + + while_end_8790281931834: + + # Loading return value in $v1 + lw $v1, 60($sp) + + # Freeing space for local variables + addi $sp, $sp, 64 + + jr $ra + + function_i2a_at_A2I: + # Function parameters + # $ra = 80($sp) + # self = 76($sp) + # i = 72($sp) + + # Reserving space for local variables + addi $sp, $sp, -72 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_1 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_2 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_2 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 56($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 64($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_3 + lw $t0, 56($sp) + sw $t0, 64($sp) + end_assign: + + # If internal_1 then goto then_8790281931963 + lw $t0, 64($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8790281931963 + + # Jumping to else_8790281931963 + j else_8790281931963 + + then_8790281931963: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 48 + sb $t0, 8($v0) # internal_4[0] = '0' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 52($sp) # internal_4 = "0" + + lw $t0, 52($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 68($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_4 + lw $t0, 52($sp) + sw $t0, 68($sp) + end_assign: + + # Jumping to endif_8790281931963 + j endif_8790281931963 + + else_8790281931963: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_6 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_7 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_7 + + # Argument i + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing i + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_8 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 36($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_8 + lw $t0, 36($sp) + sw $t0, 44($sp) + end_assign: + + # If internal_6 then goto then_8790281931969 + lw $t0, 44($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8790281931969 + + # Jumping to else_8790281931969 + j else_8790281931969 + + then_8790281931969: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing self + + # Argument i + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing i + + # Calling function function_i2a_aux_at_A2I + jal function_i2a_aux_at_A2I + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_9 = result of function_i2a_aux_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 32($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 48($sp) + j end_assign + not_is_Bool_or_Int: + # internal_5 = internal_9 + lw $t0, 32($sp) + sw $t0, 48($sp) + end_assign: + + # Jumping to endif_8790281931969 + j endif_8790281931969 + + else_8790281931969: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 45 + sb $t0, 8($v0) # internal_10[0] = '-' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 28($sp) # internal_10 = "-" + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_11 = address of allocated object Int + + # Xor operation + lw $t0, 24($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 16($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 12($sp) # $t0 = internal_14 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Addition operation + lw $t0, 12($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 20($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 12($sp) # $t0 = internal_14 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_14 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_14 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_15 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_15 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_i2a_aux_at_A2I + jal function_i2a_aux_at_A2I + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_16 = result of function_i2a_aux_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_16 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_17 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 48($sp) + j end_assign + not_is_Bool_or_Int: + # internal_5 = internal_17 + lw $t0, 0($sp) + sw $t0, 48($sp) + end_assign: + + # Jumping to endif_8790281931969 + j endif_8790281931969 + + endif_8790281931969: + + lw $t0, 48($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 68($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_5 + lw $t0, 48($sp) + sw $t0, 68($sp) + end_assign: + + # Jumping to endif_8790281931963 + j endif_8790281931963 + + endif_8790281931963: + + # Loading return value in $v1 + lw $v1, 68($sp) + + # Freeing space for local variables + addi $sp, $sp, 72 + + jr $ra + + function_i2a_aux_at_A2I: + # Function parameters + # $ra = 64($sp) + # self = 60($sp) + # i = 56($sp) + + # Reserving space for local variables + addi $sp, $sp, -56 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_1 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_2 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_2 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 40($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 48($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_3 + lw $t0, 40($sp) + sw $t0, 48($sp) + end_assign: + + # If internal_1 then goto then_8790281932849 + lw $t0, 48($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8790281932849 + + # Jumping to else_8790281932849 + j else_8790281932849 + + then_8790281932849: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 0 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 36($sp) # internal_4 = "" + + lw $t0, 36($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_4 + lw $t0, 36($sp) + sw $t0, 52($sp) + end_assign: + + # Jumping to endif_8790281932849 + j endif_8790281932849 + + else_8790281932849: + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_6 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_6 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_div + jal function_div + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_7 = result of function_div + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 24($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 32($sp) + j end_assign + not_is_Bool_or_Int: + # next = internal_7 + lw $t0, 24($sp) + sw $t0, 32($sp) + end_assign: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing self + + # Argument next + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing next + + # Calling function function_i2a_aux_at_A2I + jal function_i2a_aux_at_A2I + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_8 = result of function_i2a_aux_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_9 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument next + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing next + + # Argument internal_9 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_10 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_10 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_11 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_11 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_i2c_at_A2I + jal function_i2c_at_A2I + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_12 = result of function_i2c_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_8 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument internal_12 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_13 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_13 + lw $t0, 0($sp) + sw $t0, 52($sp) + end_assign: + + # Jumping to endif_8790281932849 + j endif_8790281932849 + + endif_8790281932849: + + # Loading return value in $v1 + lw $v1, 52($sp) + + # Freeing space for local variables + addi $sp, $sp, 56 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 60($sp) + # self = 56($sp) + + # Reserving space for local variables + addi $sp, $sp, -56 + + # Allocating A2I + li $v0, 9 + lw $a0, type_A2I + syscall + la $t0, type_A2I # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 48($sp) # internal_1 = address of allocated object A2I + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_A2I + jal function___init___at_A2I + lw $ra, 4($sp) + sw $v1, 56($sp) # internal_1 = result of function___init___at_A2I + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 15 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 6 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 54 + sb $t0, 8($v0) # internal_2[0] = '6' + + addi $t0, $zero, 55 + sb $t0, 9($v0) # internal_2[1] = '7' + + addi $t0, $zero, 56 + sb $t0, 10($v0) # internal_2[2] = '8' + + addi $t0, $zero, 57 + sb $t0, 11($v0) # internal_2[3] = '9' + + addi $t0, $zero, 56 + sb $t0, 12($v0) # internal_2[4] = '8' + + addi $t0, $zero, 55 + sb $t0, 13($v0) # internal_2[5] = '7' + + sb $zero, 14($v0) # Null-terminator at the end of the string + + sw $v0, 44($sp) # internal_2 = "678987" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_2 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_a2i_at_A2I + jal function_a2i_at_A2I + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_3 = result of function_a2i_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 40($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # a = internal_3 + lw $t0, 40($sp) + sw $t0, 52($sp) + end_assign: + + # Allocating A2I + li $v0, 9 + lw $a0, type_A2I + syscall + la $t0, type_A2I # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 32($sp) # internal_5 = address of allocated object A2I + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_5 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function___init___at_A2I + jal function___init___at_A2I + lw $ra, 4($sp) + sw $v1, 40($sp) # internal_5 = result of function___init___at_A2I + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 678987 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 678987 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_6 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_5 + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing internal_5 + + # Argument internal_6 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_i2a_at_A2I + jal function_i2a_at_A2I + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_7 = result of function_i2a_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 24($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 36($sp) + j end_assign + not_is_Bool_or_Int: + # b = internal_7 + lw $t0, 24($sp) + sw $t0, 36($sp) + end_assign: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing self + + # Argument a + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing a + + # Calling function function_out_int_at_IO + jal function_out_int_at_IO + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_8 = result of function_out_int_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 13 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 4 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_9[0] = ' ' + + addi $t0, $zero, 61 + sb $t0, 9($v0) # internal_9[1] = '=' + + addi $t0, $zero, 61 + sb $t0, 10($v0) # internal_9[2] = '=' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_9[3] = ' ' + + sb $zero, 12($v0) # Null-terminator at the end of the string + + sw $v0, 16($sp) # internal_9 = " == " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_9 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_10 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing self + + # Argument b + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing b + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_11 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_12[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_12 = "\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_12 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_13 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 56 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_main_at_Main + jal function_main_at_Main + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/cells.mips b/tests/codegen/cells.mips new file mode 100644 index 000000000..5c0e83b20 --- /dev/null +++ b/tests/codegen/cells.mips @@ -0,0 +1,2917 @@ +.data + type_Object: .word 8 + type_Object_inherits_from: .word 0 + type_Object_attributes: .word 0 + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO: .word 8 + type_IO_inherits_from: .word type_Object + type_IO_attributes: .word 0 + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_Int: .word 8 + type_Int_inherits_from: .word type_Object + type_Int_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_String: .word 8 + type_String_inherits_from: .word type_Object + type_String_attributes: .word 0 + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Bool: .word 8 + type_Bool_inherits_from: .word type_Object + type_Bool_attributes: .word 0 + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_CellularAutomaton: .word 12 + type_CellularAutomaton_inherits_from: .word type_IO + type_CellularAutomaton_attributes: .word 1 + type_CellularAutomaton_name_size: .word 17 + type_CellularAutomaton_name: .asciiz "CellularAutomaton" + + type_Main: .word 12 + type_Main_inherits_from: .word type_Object + type_Main_attributes: .word 1 + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 40($sp) + # a = 36($sp) + # b = 32($sp) + + # Reserving space for local variables + addi $sp, $sp, -32 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_0 = address of allocated object Int + + # internal_1 = typeof a that is the first word of the object + lw $t0, 36($sp) + lw $t1, 0($t0) + sw $t1, 24($sp) + + # internal_2 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_3 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_4 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_7 = address of allocated object Int + + # internal_5 = EqualAddress(internal_1, internal_2) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_1, internal_3) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_7 = EqualAddress(internal_1, internal_4) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_6 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_7 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 36($sp) + lw $t0, 8($t0) + lw $t1, 32($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 36($sp) + lw $t1, 32($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 28($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 28($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 36($sp) # Save in $t0 the left operand address + lw $t1, 32($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 28($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 28($sp) + + # Freeing space for local variables + addi $sp, $sp, 32 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 12($t1) # $t1 = length of the name of self + lw $t3, 16($t1) # $t1 = name of self + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + move $t4, $v0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + addi $t0, $t0, 8 # Pointer to the first character of the string in self + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t1, while_copy_name_end + lb $t6, 0($t0) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t0, $t0, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $t4, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the string x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lw $t1, buffer_input($t0) # Loading the byte + beq $t1, $zero, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lw $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 5 + syscall + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + sw $t1, 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 0($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 0($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + lw $t2, 8($sp) # $t2 = start of the substring + lw $t3, 4($sp) # $t3 = length of the substring + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bge $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_CellularAutomaton: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 0 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_0 = "" + + # Set attribute population_map of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.population_map = internal_0 + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_init_at_CellularAutomaton: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # map = 0($sp) + + # Set attribute population_map of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = map + sw $t1, 8($t0) # self.population_map = map + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_print_at_CellularAutomaton: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Get attribute population_map of self + lw $t0, 16($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'population_map' from the instance + sw $t1, 12($sp) # internal_0 = population_map + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_1[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_1 = "\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_2 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_num_cells_at_CellularAutomaton: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Get attribute population_map of self + lw $t0, 8($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'population_map' from the instance + sw $t1, 4($sp) # internal_0 = population_map + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_cell_at_CellularAutomaton: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + # position = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + # Get attribute population_map of self + lw $t0, 16($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'population_map' from the instance + sw $t1, 8($sp) # internal_0 = population_map + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 8($sp) # Storing internal_0 + + # Argument position + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 16($sp) # internal_2 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + function_cell_left_neighbor_at_CellularAutomaton: + # Function parameters + # $ra = 52($sp) + # self = 48($sp) + # position = 44($sp) + + # Reserving space for local variables + addi $sp, $sp, -44 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_1 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_2 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_2 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 36($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_3 + lw $t0, 28($sp) + sw $t0, 36($sp) + end_assign: + + # If internal_1 then goto then_8762753578975 + lw $t0, 36($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8762753578975 + + # Jumping to else_8762753578975 + j else_8762753578975 + + then_8762753578975: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_num_cells_at_CellularAutomaton + jal function_num_cells_at_CellularAutomaton + lw $ra, 4($sp) + sw $v1, 32($sp) # internal_4 = result of function_num_cells_at_CellularAutomaton + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_5 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument internal_5 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_6 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_6 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_cell_at_CellularAutomaton + jal function_cell_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_7 = result of function_cell_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_7 + lw $t0, 12($sp) + sw $t0, 40($sp) + end_assign: + + # Jumping to endif_8762753578975 + j endif_8762753578975 + + else_8762753578975: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_8 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_8 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_9 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_9 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_cell_at_CellularAutomaton + jal function_cell_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_10 = result of function_cell_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_10 + lw $t0, 0($sp) + sw $t0, 40($sp) + end_assign: + + # Jumping to endif_8762753578975 + j endif_8762753578975 + + endif_8762753578975: + + # Loading return value in $v1 + lw $v1, 40($sp) + + # Freeing space for local variables + addi $sp, $sp, 44 + + jr $ra + + function_cell_right_neighbor_at_CellularAutomaton: + # Function parameters + # $ra = 52($sp) + # self = 48($sp) + # position = 44($sp) + + # Reserving space for local variables + addi $sp, $sp, -44 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_num_cells_at_CellularAutomaton + jal function_num_cells_at_CellularAutomaton + lw $ra, 4($sp) + sw $v1, 40($sp) # internal_2 = result of function_num_cells_at_CellularAutomaton + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_4 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_4 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_5 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 20($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 36($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_5 + lw $t0, 20($sp) + sw $t0, 36($sp) + end_assign: + + # If internal_1 then goto then_8762753555237 + lw $t0, 36($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8762753555237 + + # Jumping to else_8762753555237 + j else_8762753555237 + + then_8762753555237: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_6 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_6 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_cell_at_CellularAutomaton + jal function_cell_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_7 = result of function_cell_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_7 + lw $t0, 12($sp) + sw $t0, 40($sp) + end_assign: + + # Jumping to endif_8762753555237 + j endif_8762753555237 + + else_8762753555237: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_8 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_8 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_9 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_9 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_cell_at_CellularAutomaton + jal function_cell_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_10 = result of function_cell_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_10 + lw $t0, 0($sp) + sw $t0, 40($sp) + end_assign: + + # Jumping to endif_8762753555237 + j endif_8762753555237 + + endif_8762753555237: + + # Loading return value in $v1 + lw $v1, 40($sp) + + # Freeing space for local variables + addi $sp, $sp, 44 + + jr $ra + + function_cell_at_next_evolution_at_CellularAutomaton: + # Function parameters + # $ra = 124($sp) + # self = 120($sp) + # position = 116($sp) + + # Reserving space for local variables + addi $sp, $sp, -116 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_1 = address of allocated object Int + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing position + + # Calling function function_cell_at_CellularAutomaton + jal function_cell_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 108($sp) # internal_4 = result of function_cell_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_5[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 92($sp) # internal_5 = "X" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument internal_5 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_6 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 88($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 100($sp) + j end_assign + not_is_Bool_or_Int: + # internal_3 = internal_6 + lw $t0, 88($sp) + sw $t0, 100($sp) + end_assign: + + # If internal_3 then goto then_8762753555273 + lw $t0, 100($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8762753555273 + + # Jumping to else_8762753555273 + j else_8762753555273 + + then_8762753555273: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_7 = address of allocated object Int + + lw $t0, 84($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 104($sp) + j end_assign + not_is_Bool_or_Int: + # internal_2 = internal_7 + lw $t0, 84($sp) + sw $t0, 104($sp) + end_assign: + + # Jumping to endif_8762753555273 + j endif_8762753555273 + + else_8762753555273: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_8 = address of allocated object Int + + lw $t0, 80($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 104($sp) + j end_assign + not_is_Bool_or_Int: + # internal_2 = internal_8 + lw $t0, 80($sp) + sw $t0, 104($sp) + end_assign: + + # Jumping to endif_8762753555273 + j endif_8762753555273 + + endif_8762753555273: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_10 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing position + + # Calling function function_cell_left_neighbor_at_CellularAutomaton + jal function_cell_left_neighbor_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_11 = result of function_cell_left_neighbor_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_12[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 64($sp) # internal_12 = "X" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_11 + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing internal_11 + + # Argument internal_12 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 72($sp) # internal_13 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 60($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 72($sp) + j end_assign + not_is_Bool_or_Int: + # internal_10 = internal_13 + lw $t0, 60($sp) + sw $t0, 72($sp) + end_assign: + + # If internal_10 then goto then_8762753555312 + lw $t0, 72($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8762753555312 + + # Jumping to else_8762753555312 + j else_8762753555312 + + then_8762753555312: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_14 = address of allocated object Int + + lw $t0, 56($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 76($sp) + j end_assign + not_is_Bool_or_Int: + # internal_9 = internal_14 + lw $t0, 56($sp) + sw $t0, 76($sp) + end_assign: + + # Jumping to endif_8762753555312 + j endif_8762753555312 + + else_8762753555312: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_15 = address of allocated object Int + + lw $t0, 52($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 76($sp) + j end_assign + not_is_Bool_or_Int: + # internal_9 = internal_15 + lw $t0, 52($sp) + sw $t0, 76($sp) + end_assign: + + # Jumping to endif_8762753555312 + j endif_8762753555312 + + endif_8762753555312: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_9 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 60($sp) # internal_16 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_18 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing position + + # Calling function function_cell_right_neighbor_at_CellularAutomaton + jal function_cell_right_neighbor_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_19 = result of function_cell_right_neighbor_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_20[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 32($sp) # internal_20 = "X" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_19 + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing internal_19 + + # Argument internal_20 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_21 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # internal_18 = internal_21 + lw $t0, 28($sp) + sw $t0, 40($sp) + end_assign: + + # If internal_18 then goto then_8762753555357 + lw $t0, 40($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8762753555357 + + # Jumping to else_8762753555357 + j else_8762753555357 + + then_8762753555357: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_22 = address of allocated object Int + + lw $t0, 24($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # internal_17 = internal_22 + lw $t0, 24($sp) + sw $t0, 44($sp) + end_assign: + + # Jumping to endif_8762753555357 + j endif_8762753555357 + + else_8762753555357: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_23 = address of allocated object Int + + lw $t0, 20($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # internal_17 = internal_23 + lw $t0, 20($sp) + sw $t0, 44($sp) + end_assign: + + # Jumping to endif_8762753555357 + j endif_8762753555357 + + endif_8762753555357: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_16 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing internal_16 + + # Argument internal_17 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_17 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_24 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_25 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_24 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_24 + + # Argument internal_25 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_25 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_26 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 108($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_26 + lw $t0, 8($sp) + sw $t0, 108($sp) + end_assign: + + # If internal_1 then goto then_8762753555393 + lw $t0, 108($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8762753555393 + + # Jumping to else_8762753555393 + j else_8762753555393 + + then_8762753555393: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_27[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_27 = "X" + + lw $t0, 4($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 112($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_27 + lw $t0, 4($sp) + sw $t0, 112($sp) + end_assign: + + # Jumping to endif_8762753555393 + j endif_8762753555393 + + else_8762753555393: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 46 + sb $t0, 8($v0) # internal_28[0] = '.' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_28 = "." + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 112($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_28 + lw $t0, 0($sp) + sw $t0, 112($sp) + end_assign: + + # Jumping to endif_8762753555393 + j endif_8762753555393 + + endif_8762753555393: + + # Loading return value in $v1 + lw $v1, 112($sp) + + # Freeing space for local variables + addi $sp, $sp, 116 + + jr $ra + + function_evolve_at_CellularAutomaton: + # Function parameters + # $ra = 44($sp) + # self = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_num_cells_at_CellularAutomaton + jal function_num_cells_at_CellularAutomaton + lw $ra, 4($sp) + sw $v1, 36($sp) # internal_2 = result of function_num_cells_at_CellularAutomaton + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 32($sp) + j end_assign + not_is_Bool_or_Int: + # num = internal_2 + lw $t0, 28($sp) + sw $t0, 32($sp) + end_assign: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 0 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 24($sp) # temp = "" + + while_start_8762753555481: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing position + + # Argument num + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_5 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 20($sp) + j end_assign + not_is_Bool_or_Int: + # internal_4 = internal_5 + lw $t0, 16($sp) + sw $t0, 20($sp) + end_assign: + + # If internal_4 then goto while_body_8762753555481 + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8762753555481 + + # Jumping to while_end_8762753555481 + j while_end_8762753555481 + + while_body_8762753555481: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing position + + # Calling function function_cell_at_next_evolution_at_CellularAutomaton + jal function_cell_at_next_evolution_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_6 = result of function_cell_at_next_evolution_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument temp + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing temp + + # Argument internal_6 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_7 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # temp = internal_7 + lw $t0, 8($sp) + sw $t0, 24($sp) + end_assign: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_8 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_8 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_9 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 36($sp) + j end_assign + not_is_Bool_or_Int: + # position = internal_9 + lw $t0, 0($sp) + sw $t0, 36($sp) + end_assign: + + # Jumping to while_start_8762753555481 + j while_start_8762753555481 + + while_end_8762753555481: + + # Set attribute population_map of self + lw $t0, 40($sp) # $t0 = self + lw $t1, 24($sp) # $t1 = temp + sw $t1, 8($t0) # self.population_map = temp + + # Loading return value in $v1 + lw $v1, 40($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Set attribute cells of self + lw $t0, 0($sp) # $t0 = self + sw $zero, 8($t0) # Set the attribute cells of self + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 68($sp) + # self = 64($sp) + + # Reserving space for local variables + addi $sp, $sp, -64 + + # Allocating CellularAutomaton + li $v0, 9 + lw $a0, type_CellularAutomaton + syscall + la $t0, type_CellularAutomaton # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 60($sp) # internal_0 = address of allocated object CellularAutomaton + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_CellularAutomaton + jal function___init___at_CellularAutomaton + lw $ra, 4($sp) + sw $v1, 68($sp) # internal_0 = result of function___init___at_CellularAutomaton + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 28 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 19 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_1[0] = ' ' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_1[1] = ' ' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_1[2] = ' ' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_1[3] = ' ' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_1[4] = ' ' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_1[5] = ' ' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_1[6] = ' ' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_1[7] = ' ' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_1[8] = ' ' + + addi $t0, $zero, 88 + sb $t0, 17($v0) # internal_1[9] = 'X' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_1[10] = ' ' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_1[11] = ' ' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_1[12] = ' ' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_1[13] = ' ' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_1[14] = ' ' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_1[15] = ' ' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_1[16] = ' ' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_1[17] = ' ' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_1[18] = ' ' + + sb $zero, 27($v0) # Null-terminator at the end of the string + + sw $v0, 56($sp) # internal_1 = " X " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_init_at_CellularAutomaton + jal function_init_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 64($sp) # internal_2 = result of function_init_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute cells of self + lw $t0, 64($sp) # $t0 = self + lw $t1, 52($sp) # $t1 = internal_2 + sw $t1, 8($t0) # self.cells = internal_2 + + # Get attribute cells of self + lw $t0, 64($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'cells' from the instance + sw $t1, 48($sp) # internal_3 = cells + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_3 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_print_at_CellularAutomaton + jal function_print_at_CellularAutomaton + lw $ra, 4($sp) + sw $v1, 52($sp) # internal_4 = result of function_print_at_CellularAutomaton + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 20 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 20 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_6 = address of allocated object Int + + lw $t0, 36($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # countdown = internal_6 + lw $t0, 36($sp) + sw $t0, 40($sp) + end_assign: + + while_start_8762753555634: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_8 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_8 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument countdown + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing countdown + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_9 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 24($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 32($sp) + j end_assign + not_is_Bool_or_Int: + # internal_7 = internal_9 + lw $t0, 24($sp) + sw $t0, 32($sp) + end_assign: + + # If internal_7 then goto while_body_8762753555634 + lw $t0, 32($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8762753555634 + + # Jumping to while_end_8762753555634 + j while_end_8762753555634 + + while_body_8762753555634: + + # Get attribute cells of self + lw $t0, 64($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'cells' from the instance + sw $t1, 20($sp) # internal_10 = cells + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_10 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_evolve_at_CellularAutomaton + jal function_evolve_at_CellularAutomaton + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_11 = result of function_evolve_at_CellularAutomaton + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute cells of self + lw $t0, 64($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'cells' from the instance + sw $t1, 12($sp) # internal_12 = cells + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_12 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_print_at_CellularAutomaton + jal function_print_at_CellularAutomaton + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_13 = result of function_print_at_CellularAutomaton + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_14 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument countdown + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing countdown + + # Argument internal_14 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_14 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_15 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # countdown = internal_15 + lw $t0, 0($sp) + sw $t0, 40($sp) + end_assign: + + # Jumping to while_start_8762753555634 + j while_start_8762753555634 + + while_end_8762753555634: + + # Loading return value in $v1 + lw $v1, 64($sp) + + # Freeing space for local variables + addi $sp, $sp, 64 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_main_at_Main + jal function_main_at_Main + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/fib.mips b/tests/codegen/fib.mips new file mode 100644 index 000000000..b3a18db93 --- /dev/null +++ b/tests/codegen/fib.mips @@ -0,0 +1,1516 @@ +.data + type_Object: .word 8 + type_Object_inherits_from: .word 0 + type_Object_attributes: .word 0 + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO: .word 8 + type_IO_inherits_from: .word type_Object + type_IO_attributes: .word 0 + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_Int: .word 8 + type_Int_inherits_from: .word type_Object + type_Int_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_String: .word 8 + type_String_inherits_from: .word type_Object + type_String_attributes: .word 0 + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Bool: .word 8 + type_Bool_inherits_from: .word type_Object + type_Bool_attributes: .word 0 + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_Main: .word 8 + type_Main_inherits_from: .word type_IO + type_Main_attributes: .word 0 + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 40($sp) + # a = 36($sp) + # b = 32($sp) + + # Reserving space for local variables + addi $sp, $sp, -32 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_0 = address of allocated object Int + + # internal_1 = typeof a that is the first word of the object + lw $t0, 36($sp) + lw $t1, 0($t0) + sw $t1, 24($sp) + + # internal_2 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_3 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_4 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_7 = address of allocated object Int + + # internal_5 = EqualAddress(internal_1, internal_2) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_1, internal_3) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_7 = EqualAddress(internal_1, internal_4) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_6 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_7 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 36($sp) + lw $t0, 8($t0) + lw $t1, 32($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 36($sp) + lw $t1, 32($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 28($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 28($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 36($sp) # Save in $t0 the left operand address + lw $t1, 32($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 28($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 28($sp) + + # Freeing space for local variables + addi $sp, $sp, 32 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 12($t1) # $t1 = length of the name of self + lw $t3, 16($t1) # $t1 = name of self + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + move $t4, $v0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + addi $t0, $t0, 8 # Pointer to the first character of the string in self + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t1, while_copy_name_end + lb $t6, 0($t0) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t0, $t0, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $t4, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the string x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lw $t1, buffer_input($t0) # Loading the byte + beq $t1, $zero, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lw $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 5 + syscall + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + sw $t1, 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 0($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 0($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + lw $t2, 8($sp) # $t2 = start of the substring + lw $t3, 4($sp) # $t3 = length of the substring + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bge $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 32($sp) + # self = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 47 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 38 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 69 + sb $t0, 8($v0) # internal_0[0] = 'E' + + addi $t0, $zero, 110 + sb $t0, 9($v0) # internal_0[1] = 'n' + + addi $t0, $zero, 116 + sb $t0, 10($v0) # internal_0[2] = 't' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_0[3] = 'e' + + addi $t0, $zero, 114 + sb $t0, 12($v0) # internal_0[4] = 'r' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_0[6] = 'n' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_0[7] = ' ' + + addi $t0, $zero, 116 + sb $t0, 16($v0) # internal_0[8] = 't' + + addi $t0, $zero, 111 + sb $t0, 17($v0) # internal_0[9] = 'o' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_0[10] = ' ' + + addi $t0, $zero, 102 + sb $t0, 19($v0) # internal_0[11] = 'f' + + addi $t0, $zero, 105 + sb $t0, 20($v0) # internal_0[12] = 'i' + + addi $t0, $zero, 110 + sb $t0, 21($v0) # internal_0[13] = 'n' + + addi $t0, $zero, 100 + sb $t0, 22($v0) # internal_0[14] = 'd' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_0[15] = ' ' + + addi $t0, $zero, 110 + sb $t0, 24($v0) # internal_0[16] = 'n' + + addi $t0, $zero, 116 + sb $t0, 25($v0) # internal_0[17] = 't' + + addi $t0, $zero, 104 + sb $t0, 26($v0) # internal_0[18] = 'h' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_0[19] = ' ' + + addi $t0, $zero, 102 + sb $t0, 28($v0) # internal_0[20] = 'f' + + addi $t0, $zero, 105 + sb $t0, 29($v0) # internal_0[21] = 'i' + + addi $t0, $zero, 98 + sb $t0, 30($v0) # internal_0[22] = 'b' + + addi $t0, $zero, 111 + sb $t0, 31($v0) # internal_0[23] = 'o' + + addi $t0, $zero, 110 + sb $t0, 32($v0) # internal_0[24] = 'n' + + addi $t0, $zero, 97 + sb $t0, 33($v0) # internal_0[25] = 'a' + + addi $t0, $zero, 99 + sb $t0, 34($v0) # internal_0[26] = 'c' + + addi $t0, $zero, 99 + sb $t0, 35($v0) # internal_0[27] = 'c' + + addi $t0, $zero, 105 + sb $t0, 36($v0) # internal_0[28] = 'i' + + addi $t0, $zero, 32 + sb $t0, 37($v0) # internal_0[29] = ' ' + + addi $t0, $zero, 110 + sb $t0, 38($v0) # internal_0[30] = 'n' + + addi $t0, $zero, 117 + sb $t0, 39($v0) # internal_0[31] = 'u' + + addi $t0, $zero, 109 + sb $t0, 40($v0) # internal_0[32] = 'm' + + addi $t0, $zero, 98 + sb $t0, 41($v0) # internal_0[33] = 'b' + + addi $t0, $zero, 101 + sb $t0, 42($v0) # internal_0[34] = 'e' + + addi $t0, $zero, 114 + sb $t0, 43($v0) # internal_0[35] = 'r' + + addi $t0, $zero, 33 + sb $t0, 44($v0) # internal_0[36] = '!' + + addi $t0, $zero, 10 + sb $t0, 45($v0) # internal_0[37] = '\n' + + sb $zero, 46($v0) # Null-terminator at the end of the string + + sw $v0, 24($sp) # internal_0 = "Enter n to find nth fibonacci number!\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_1 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_in_int_at_IO + jal function_in_int_at_IO + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_2 = result of function_in_int_at_IO + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_2 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_fib_at_Main + jal function_fib_at_Main + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_3 = result of function_fib_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_3 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_out_int_at_IO + jal function_out_int_at_IO + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_4 = result of function_out_int_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_5[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_5 = "\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_5 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_6 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function_fib_at_Main: + # Function parameters + # $ra = 64($sp) + # self = 60($sp) + # i = 56($sp) + + # Reserving space for local variables + addi $sp, $sp, -56 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_1 = address of allocated object Int + + lw $t0, 48($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # a = internal_1 + lw $t0, 48($sp) + sw $t0, 52($sp) + end_assign: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_3 = address of allocated object Int + + lw $t0, 40($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # b = internal_3 + lw $t0, 40($sp) + sw $t0, 44($sp) + end_assign: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_5 = address of allocated object Int + + lw $t0, 32($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 36($sp) + j end_assign + not_is_Bool_or_Int: + # c = internal_5 + lw $t0, 32($sp) + sw $t0, 36($sp) + end_assign: + + while_start_8736343769098: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_7 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_8 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_9 = address of allocated object Int + + # Xor operation + lw $t0, 20($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 16($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 12($sp) # $t0 = internal_10 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 28($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_10 + lw $t0, 12($sp) + sw $t0, 28($sp) + end_assign: + + # If internal_6 then goto while_body_8736343769098 + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8736343769098 + + # Jumping to while_end_8736343769098 + j while_end_8736343769098 + + while_body_8736343769098: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument a + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing a + + # Argument b + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing b + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_11 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 36($sp) + j end_assign + not_is_Bool_or_Int: + # c = internal_11 + lw $t0, 8($sp) + sw $t0, 36($sp) + end_assign: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_12 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_12 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_13 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 56($sp) + j end_assign + not_is_Bool_or_Int: + # i = internal_13 + lw $t0, 0($sp) + sw $t0, 56($sp) + end_assign: + + lw $t0, 52($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # b = a + lw $t0, 52($sp) + sw $t0, 44($sp) + end_assign: + + lw $t0, 36($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # a = c + lw $t0, 36($sp) + sw $t0, 52($sp) + end_assign: + + # Jumping to while_start_8736343769098 + j while_start_8736343769098 + + while_end_8736343769098: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 56 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_main_at_Main + jal function_main_at_Main + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/graph.mips b/tests/codegen/graph.mips new file mode 100644 index 000000000..480851612 --- /dev/null +++ b/tests/codegen/graph.mips @@ -0,0 +1,6947 @@ +.data + type_Object: .word 8 + type_Object_inherits_from: .word 0 + type_Object_attributes: .word 0 + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO: .word 8 + type_IO_inherits_from: .word type_Object + type_IO_attributes: .word 0 + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_Int: .word 8 + type_Int_inherits_from: .word type_Object + type_Int_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_String: .word 8 + type_String_inherits_from: .word type_Object + type_String_attributes: .word 0 + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Bool: .word 8 + type_Bool_inherits_from: .word type_Object + type_Bool_attributes: .word 0 + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_Graph: .word 16 + type_Graph_inherits_from: .word type_Object + type_Graph_attributes: .word 2 + type_Graph_name_size: .word 5 + type_Graph_name: .asciiz "Graph" + + type_Vertice: .word 16 + type_Vertice_inherits_from: .word type_IO + type_Vertice_attributes: .word 2 + type_Vertice_name_size: .word 7 + type_Vertice_name: .asciiz "Vertice" + + type_Edge: .word 20 + type_Edge_inherits_from: .word type_IO + type_Edge_attributes: .word 3 + type_Edge_name_size: .word 4 + type_Edge_name: .asciiz "Edge" + + type_EList: .word 12 + type_EList_inherits_from: .word type_IO + type_EList_attributes: .word 1 + type_EList_name_size: .word 5 + type_EList_name: .asciiz "EList" + + type_ECons: .word 16 + type_ECons_inherits_from: .word type_EList + type_ECons_attributes: .word 2 + type_ECons_name_size: .word 5 + type_ECons_name: .asciiz "ECons" + + type_VList: .word 12 + type_VList_inherits_from: .word type_IO + type_VList_attributes: .word 1 + type_VList_name_size: .word 5 + type_VList_name: .asciiz "VList" + + type_VCons: .word 16 + type_VCons_inherits_from: .word type_VList + type_VCons_attributes: .word 2 + type_VCons_name_size: .word 5 + type_VCons_name: .asciiz "VCons" + + type_Parse: .word 16 + type_Parse_inherits_from: .word type_IO + type_Parse_attributes: .word 2 + type_Parse_name_size: .word 5 + type_Parse_name: .asciiz "Parse" + + type_Main: .word 20 + type_Main_inherits_from: .word type_Parse + type_Main_attributes: .word 3 + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + type_BoolOp: .word 8 + type_BoolOp_inherits_from: .word type_Object + type_BoolOp_attributes: .word 0 + type_BoolOp_name_size: .word 6 + type_BoolOp_name: .asciiz "BoolOp" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 40($sp) + # a = 36($sp) + # b = 32($sp) + + # Reserving space for local variables + addi $sp, $sp, -32 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_0 = address of allocated object Int + + # internal_1 = typeof a that is the first word of the object + lw $t0, 36($sp) + lw $t1, 0($t0) + sw $t1, 24($sp) + + # internal_2 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_3 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_4 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_7 = address of allocated object Int + + # internal_5 = EqualAddress(internal_1, internal_2) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_1, internal_3) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_7 = EqualAddress(internal_1, internal_4) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_6 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_7 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 36($sp) + lw $t0, 8($t0) + lw $t1, 32($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 36($sp) + lw $t1, 32($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 28($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 28($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 36($sp) # Save in $t0 the left operand address + lw $t1, 32($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 28($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 28($sp) + + # Freeing space for local variables + addi $sp, $sp, 32 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 12($t1) # $t1 = length of the name of self + lw $t3, 16($t1) # $t1 = name of self + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + move $t4, $v0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + addi $t0, $t0, 8 # Pointer to the first character of the string in self + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t1, while_copy_name_end + lb $t6, 0($t0) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t0, $t0, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $t4, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the string x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lw $t1, buffer_input($t0) # Loading the byte + beq $t1, $zero, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lw $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 5 + syscall + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + sw $t1, 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 0($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 0($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + lw $t2, 8($sp) # $t2 = start of the substring + lw $t3, 4($sp) # $t3 = length of the substring + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bge $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Graph: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating VList + li $v0, 9 + lw $a0, type_VList + syscall + la $t0, type_VList # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object VList + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_VList + jal function___init___at_VList + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_VList + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute vertices of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.vertices = internal_0 + + # Allocating EList + li $v0, 9 + lw $a0, type_EList + syscall + la $t0, type_EList # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 0($sp) # internal_1 = address of allocated object EList + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 8($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_EList + jal function___init___at_EList + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function___init___at_EList + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute edges of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_1 + sw $t1, 12($t0) # self.edges = internal_1 + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_add_vertice_at_Graph: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + # v = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument v + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing v + + # Calling function function_outgoing_at_Vertice + jal function_outgoing_at_Vertice + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_0 = result of function_outgoing_at_Vertice + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute edges of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'edges' from the instance + sw $t1, 12($sp) # internal_1 = edges + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_append_at_EList + jal function_append_at_EList + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_2 = result of function_append_at_EList + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute edges of self + lw $t0, 24($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_2 + sw $t1, 12($t0) # self.edges = internal_2 + + # Get attribute vertices of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'vertices' from the instance + sw $t1, 4($sp) # internal_3 = vertices + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument v + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing v + + # Calling function function_cons_at_VList + jal function_cons_at_VList + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_4 = result of function_cons_at_VList + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute vertices of self + lw $t0, 24($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_4 + sw $t1, 8($t0) # self.vertices = internal_4 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 20 + + jr $ra + + function_print_E_at_Graph: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Get attribute edges of self + lw $t0, 8($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'edges' from the instance + sw $t1, 4($sp) # internal_0 = edges + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_print_at_EList + jal function_print_at_EList + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function_print_at_EList + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_print_V_at_Graph: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Get attribute vertices of self + lw $t0, 8($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'vertices' from the instance + sw $t1, 4($sp) # internal_0 = vertices + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_print_at_VList + jal function_print_at_VList + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function_print_at_VList + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function___init___at_Vertice: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_0 = address of allocated object Int + + # Set attribute num of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.num = internal_0 + + # Allocating EList + li $v0, 9 + lw $a0, type_EList + syscall + la $t0, type_EList # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 0($sp) # internal_1 = address of allocated object EList + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 8($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_EList + jal function___init___at_EList + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function___init___at_EList + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute out of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_1 + sw $t1, 12($t0) # self.out = internal_1 + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_outgoing_at_Vertice: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute out of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'out' from the instance + sw $t1, 0($sp) # internal_0 = out + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_number_at_Vertice: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute num of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'num' from the instance + sw $t1, 0($sp) # internal_0 = num + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_init_at_Vertice: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # n = 0($sp) + + # Set attribute num of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = n + sw $t1, 8($t0) # self.num = n + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_add_out_at_Vertice: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # s = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Get attribute out of self + lw $t0, 12($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'out' from the instance + sw $t1, 4($sp) # internal_0 = out + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument s + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_cons_at_EList + jal function_cons_at_EList + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_1 = result of function_cons_at_EList + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute out of self + lw $t0, 12($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_1 + sw $t1, 12($t0) # self.out = internal_1 + + # Loading return value in $v1 + lw $v1, 12($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_print_at_Vertice: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Get attribute num of self + lw $t0, 16($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'num' from the instance + sw $t1, 12($sp) # internal_0 = num + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_out_int_at_IO + jal function_out_int_at_IO + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_1 = result of function_out_int_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute out of self + lw $t0, 16($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'out' from the instance + sw $t1, 4($sp) # internal_2 = out + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_2 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_print_at_EList + jal function_print_at_EList + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_3 = result of function_print_at_EList + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function___init___at_Edge: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_0 = address of allocated object Int + + # Set attribute from of self + lw $t0, 12($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.from = internal_0 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + # Set attribute to of self + lw $t0, 12($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_1 + sw $t1, 12($t0) # self.to = internal_1 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_2 = address of allocated object Int + + # Set attribute weight of self + lw $t0, 12($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_2 + sw $t1, 16($t0) # self.weight = internal_2 + + # Loading return value in $v1 + lw $v1, 12($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + function_init_at_Edge: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # f = 8($sp) + # t = 4($sp) + # w = 0($sp) + + # Set attribute from of self + lw $t0, 12($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = f + sw $t1, 8($t0) # self.from = f + + # Set attribute to of self + lw $t0, 12($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = t + sw $t1, 12($t0) # self.to = t + + # Set attribute weight of self + lw $t0, 12($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = w + sw $t1, 16($t0) # self.weight = w + + # Loading return value in $v1 + lw $v1, 12($sp) + + jr $ra + + function_print_at_Edge: + # Function parameters + # $ra = 52($sp) + # self = 48($sp) + + # Reserving space for local variables + addi $sp, $sp, -48 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 11 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 2 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_0[0] = ' ' + + addi $t0, $zero, 40 + sb $t0, 9($v0) # internal_0[1] = '(' + + sb $zero, 10($v0) # Null-terminator at the end of the string + + sw $v0, 44($sp) # internal_0 = " (" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_1 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute from of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'from' from the instance + sw $t1, 36($sp) # internal_2 = from + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_2 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_out_int_at_IO + jal function_out_int_at_IO + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_3 = result of function_out_int_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 44 + sb $t0, 8($v0) # internal_4[0] = ',' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 28($sp) # internal_4 = "," + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_4 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_5 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute to of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'to' from the instance + sw $t1, 20($sp) # internal_6 = to + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_6 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_out_int_at_IO + jal function_out_int_at_IO + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_7 = result of function_out_int_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 41 + sb $t0, 8($v0) # internal_8[0] = ')' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_8 = ")" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_8 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_9 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute weight of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'weight' from the instance + sw $t1, 4($sp) # internal_10 = weight + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_10 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_out_int_at_IO + jal function_out_int_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_11 = result of function_out_int_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 48 + + jr $ra + + function___init___at_EList: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Set attribute car of self + lw $t0, 0($sp) # $t0 = self + sw $zero, 8($t0) # Set the attribute car of self + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_isNil_at_EList: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_head_at_EList: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_abort_at_Object + jal function_abort_at_Object + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function_abort_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute car of self + lw $t0, 8($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'car' from the instance + sw $t1, 0($sp) # internal_1 = car + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_tail_at_EList: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_abort_at_Object + jal function_abort_at_Object + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_0 = result of function_abort_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_cons_at_EList: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # e = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating ECons + li $v0, 9 + lw $a0, type_ECons + syscall + la $t0, type_ECons # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object ECons + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_ECons + jal function___init___at_ECons + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_ECons + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 8($sp) # Storing internal_0 + + # Argument e + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing e + + # Argument self + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_init_at_ECons + jal function_init_at_ECons + lw $ra, 12($sp) + sw $v1, 16($sp) # internal_1 = result of function_init_at_ECons + addi $sp, $sp, 16 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_append_at_EList: + # Function parameters + # $ra = 36($sp) + # self = 32($sp) + # l = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_isNil_at_EList + jal function_isNil_at_EList + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_2 = result of function_isNil_at_EList + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 20($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_2 + lw $t0, 16($sp) + sw $t0, 20($sp) + end_assign: + + # If internal_1 then goto then_8763448684201 + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8763448684201 + + # Jumping to else_8763448684201 + j else_8763448684201 + + then_8763448684201: + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = l + lw $t0, 28($sp) + sw $t0, 24($sp) + end_assign: + + # Jumping to endif_8763448684201 + j endif_8763448684201 + + else_8763448684201: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_tail_at_EList + jal function_tail_at_EList + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_3 = result of function_tail_at_EList + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument l + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing l + + # Calling function function_append_at_EList + jal function_append_at_EList + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_4 = result of function_append_at_EList + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_head_at_EList + jal function_head_at_EList + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_5 = result of function_head_at_EList + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument internal_5 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_cons_at_EList + jal function_cons_at_EList + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_6 = result of function_cons_at_EList + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_6 + lw $t0, 0($sp) + sw $t0, 24($sp) + end_assign: + + # Jumping to endif_8763448684201 + j endif_8763448684201 + + endif_8763448684201: + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function_print_at_EList: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_0[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_0 = "\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_1 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function___init___at_ECons: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Set attribute car of self + lw $t0, 0($sp) # $t0 = self + sw $zero, 8($t0) # Set the attribute car of self + + # Set attribute cdr of self + lw $t0, 0($sp) # $t0 = self + sw $zero, 12($t0) # Set the attribute cdr of self + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_isNil_at_ECons: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_head_at_ECons: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute car of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'car' from the instance + sw $t1, 0($sp) # internal_0 = car + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_tail_at_ECons: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute cdr of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'cdr' from the instance + sw $t1, 0($sp) # internal_0 = cdr + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_init_at_ECons: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # e = 4($sp) + # rest = 0($sp) + + # Set attribute car of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = e + sw $t1, 8($t0) # self.car = e + + # Set attribute cdr of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = rest + sw $t1, 12($t0) # self.cdr = rest + + # Loading return value in $v1 + lw $v1, 8($sp) + + jr $ra + + function_print_at_ECons: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Get attribute car of self + lw $t0, 16($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'car' from the instance + sw $t1, 12($sp) # internal_0 = car + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_print_at_Edge + jal function_print_at_Edge + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_print_at_Edge + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute cdr of self + lw $t0, 16($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'cdr' from the instance + sw $t1, 4($sp) # internal_2 = cdr + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_2 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_print_at_EList + jal function_print_at_EList + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_3 = result of function_print_at_EList + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function___init___at_VList: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Set attribute car of self + lw $t0, 0($sp) # $t0 = self + sw $zero, 8($t0) # Set the attribute car of self + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_isNil_at_VList: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_head_at_VList: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_abort_at_Object + jal function_abort_at_Object + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function_abort_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute car of self + lw $t0, 8($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'car' from the instance + sw $t1, 0($sp) # internal_1 = car + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_tail_at_VList: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_abort_at_Object + jal function_abort_at_Object + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_0 = result of function_abort_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_cons_at_VList: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # v = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating VCons + li $v0, 9 + lw $a0, type_VCons + syscall + la $t0, type_VCons # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object VCons + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_VCons + jal function___init___at_VCons + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_VCons + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 8($sp) # Storing internal_0 + + # Argument v + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing v + + # Argument self + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_init_at_VCons + jal function_init_at_VCons + lw $ra, 12($sp) + sw $v1, 16($sp) # internal_1 = result of function_init_at_VCons + addi $sp, $sp, 16 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_print_at_VList: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_0[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_0 = "\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_1 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function___init___at_VCons: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Set attribute car of self + lw $t0, 0($sp) # $t0 = self + sw $zero, 8($t0) # Set the attribute car of self + + # Set attribute cdr of self + lw $t0, 0($sp) # $t0 = self + sw $zero, 12($t0) # Set the attribute cdr of self + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_isNil_at_VCons: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_head_at_VCons: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute car of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'car' from the instance + sw $t1, 0($sp) # internal_0 = car + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_tail_at_VCons: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute cdr of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'cdr' from the instance + sw $t1, 0($sp) # internal_0 = cdr + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_init_at_VCons: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # v = 4($sp) + # rest = 0($sp) + + # Set attribute car of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = v + sw $t1, 8($t0) # self.car = v + + # Set attribute cdr of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = rest + sw $t1, 12($t0) # self.cdr = rest + + # Loading return value in $v1 + lw $v1, 8($sp) + + jr $ra + + function_print_at_VCons: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Get attribute car of self + lw $t0, 16($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'car' from the instance + sw $t1, 12($sp) # internal_0 = car + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_print_at_Vertice + jal function_print_at_Vertice + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_print_at_Vertice + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute cdr of self + lw $t0, 16($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'cdr' from the instance + sw $t1, 4($sp) # internal_2 = cdr + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_2 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_print_at_VList + jal function_print_at_VList + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_3 = result of function_print_at_VList + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function___init___at_Parse: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating BoolOp + li $v0, 9 + lw $a0, type_BoolOp + syscall + la $t0, type_BoolOp # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object BoolOp + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_BoolOp + jal function___init___at_BoolOp + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_BoolOp + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute boolop of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.boolop = internal_0 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 0 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_1 = "" + + # Set attribute rest of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_1 + sw $t1, 12($t0) # self.rest = internal_1 + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_read_input_at_Parse: + # Function parameters + # $ra = 76($sp) + # self = 72($sp) + + # Reserving space for local variables + addi $sp, $sp, -72 + + # Allocating Graph + li $v0, 9 + lw $a0, type_Graph + syscall + la $t0, type_Graph # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 64($sp) # internal_1 = address of allocated object Graph + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_Graph + jal function___init___at_Graph + lw $ra, 4($sp) + sw $v1, 72($sp) # internal_1 = result of function___init___at_Graph + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 64($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 68($sp) + j end_assign + not_is_Bool_or_Int: + # g = internal_1 + lw $t0, 64($sp) + sw $t0, 68($sp) + end_assign: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_in_string_at_IO + jal function_in_string_at_IO + lw $ra, 4($sp) + sw $v1, 64($sp) # internal_3 = result of function_in_string_at_IO + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 56($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # line = internal_3 + lw $t0, 56($sp) + sw $t0, 60($sp) + end_assign: + + while_start_8763448686180: + + # Get attribute boolop of self + lw $t0, 72($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'boolop' from the instance + sw $t1, 48($sp) # internal_5 = boolop + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_6[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 44($sp) # internal_6 = "\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument line + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing line + + # Argument internal_6 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_7 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_8 = address of allocated object Int + + # Xor operation + lw $t0, 40($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 36($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 32($sp) # $t0 = internal_9 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 0 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 28($sp) # internal_10 = "" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument line + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing line + + # Argument internal_10 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_11 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_12 = address of allocated object Int + + # Xor operation + lw $t0, 24($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 20($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 16($sp) # $t0 = internal_13 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_5 + lw $t0, 64($sp) + sw $t0, 8($sp) # Storing internal_5 + + # Argument internal_9 + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing internal_9 + + # Argument internal_13 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function function_and_at_BoolOp + jal function_and_at_BoolOp + lw $ra, 12($sp) + sw $v1, 28($sp) # internal_14 = result of function_and_at_BoolOp + addi $sp, $sp, 16 # Freeing space for arguments + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # internal_4 = internal_14 + lw $t0, 12($sp) + sw $t0, 52($sp) + end_assign: + + # If internal_4 then goto while_body_8763448686180 + lw $t0, 52($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8763448686180 + + # Jumping to while_end_8763448686180 + j while_end_8763448686180 + + while_body_8763448686180: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing self + + # Argument line + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing line + + # Calling function function_parse_line_at_Parse + jal function_parse_line_at_Parse + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_15 = result of function_parse_line_at_Parse + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument g + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing g + + # Argument internal_15 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_add_vertice_at_Graph + jal function_add_vertice_at_Graph + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_16 = result of function_add_vertice_at_Graph + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_in_string_at_IO + jal function_in_string_at_IO + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_17 = result of function_in_string_at_IO + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # line = internal_17 + lw $t0, 0($sp) + sw $t0, 60($sp) + end_assign: + + # Jumping to while_start_8763448686180 + j while_start_8763448686180 + + while_end_8763448686180: + + # Loading return value in $v1 + lw $v1, 68($sp) + + # Freeing space for local variables + addi $sp, $sp, 72 + + jr $ra + + function_parse_line_at_Parse: + # Function parameters + # $ra = 92($sp) + # self = 88($sp) + # s = 84($sp) + + # Reserving space for local variables + addi $sp, $sp, -84 + + # Allocating Vertice + li $v0, 9 + lw $a0, type_Vertice + syscall + la $t0, type_Vertice # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 76($sp) # internal_1 = address of allocated object Vertice + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_Vertice + jal function___init___at_Vertice + lw $ra, 4($sp) + sw $v1, 84($sp) # internal_1 = result of function___init___at_Vertice + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing self + + # Argument s + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_a2i_at_Parse + jal function_a2i_at_Parse + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_2 = result of function_a2i_at_Parse + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_2 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_init_at_Vertice + jal function_init_at_Vertice + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_3 = result of function_init_at_Vertice + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 68($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 80($sp) + j end_assign + not_is_Bool_or_Int: + # v = internal_3 + lw $t0, 68($sp) + sw $t0, 80($sp) + end_assign: + + while_start_8763448687114: + + # Get attribute rest of self + lw $t0, 88($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'rest' from the instance + sw $t1, 60($sp) # internal_5 = rest + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_5 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 64($sp) # internal_6 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_6 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_6 + + # Argument internal_7 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 60($sp) # internal_8 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_9 = address of allocated object Int + + # Xor operation + lw $t0, 48($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 44($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 40($sp) # $t0 = internal_10 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + lw $t0, 40($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 64($sp) + j end_assign + not_is_Bool_or_Int: + # internal_4 = internal_10 + lw $t0, 40($sp) + sw $t0, 64($sp) + end_assign: + + # If internal_4 then goto while_body_8763448687114 + lw $t0, 64($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8763448687114 + + # Jumping to while_end_8763448687114 + j while_end_8763448687114 + + while_body_8763448687114: + + # Get attribute rest of self + lw $t0, 88($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'rest' from the instance + sw $t1, 32($sp) # internal_12 = rest + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_12 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_a2i_at_Parse + jal function_a2i_at_Parse + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_13 = result of function_a2i_at_Parse + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 36($sp) + j end_assign + not_is_Bool_or_Int: + # succ = internal_13 + lw $t0, 28($sp) + sw $t0, 36($sp) + end_assign: + + # Get attribute rest of self + lw $t0, 88($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'rest' from the instance + sw $t1, 20($sp) # internal_15 = rest + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_15 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_a2i_at_Parse + jal function_a2i_at_Parse + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_16 = result of function_a2i_at_Parse + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # weight = internal_16 + lw $t0, 16($sp) + sw $t0, 24($sp) + end_assign: + + # Allocating Edge + li $v0, 9 + lw $a0, type_Edge + syscall + la $t0, type_Edge # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_17 = address of allocated object Edge + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_17 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_17 + + # Calling function function___init___at_Edge + jal function___init___at_Edge + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_17 = result of function___init___at_Edge + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument v + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing v + + # Calling function function_number_at_Vertice + jal function_number_at_Vertice + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_18 = result of function_number_at_Vertice + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -20 # Reserving space for arguments + sw $ra, 16($sp) # Storing return address + + # Argument internal_17 + lw $t0, 32($sp) + sw $t0, 12($sp) # Storing internal_17 + + # Argument internal_18 + lw $t0, 28($sp) + sw $t0, 8($sp) # Storing internal_18 + + # Argument succ + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing succ + + # Argument weight + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing weight + + # Calling function function_init_at_Edge + jal function_init_at_Edge + lw $ra, 16($sp) + sw $v1, 24($sp) # internal_19 = result of function_init_at_Edge + addi $sp, $sp, 20 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument v + lw $t0, 92($sp) + sw $t0, 4($sp) # Storing v + + # Argument internal_19 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_19 + + # Calling function function_add_out_at_Vertice + jal function_add_out_at_Vertice + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_20 = result of function_add_out_at_Vertice + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to while_start_8763448687114 + j while_start_8763448687114 + + while_end_8763448687114: + + # Loading return value in $v1 + lw $v1, 80($sp) + + # Freeing space for local variables + addi $sp, $sp, 84 + + jr $ra + + function_c2i_at_Parse: + # Function parameters + # $ra = 216($sp) + # self = 212($sp) + # char = 208($sp) + + # Reserving space for local variables + addi $sp, $sp, -208 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 200($sp) # internal_1 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 48 + sb $t0, 8($v0) # internal_2[0] = '0' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 196($sp) # internal_2 = "0" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_2 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 204($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 192($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 200($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_3 + lw $t0, 192($sp) + sw $t0, 200($sp) + end_assign: + + # If internal_1 then goto then_8763448687707 + lw $t0, 200($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8763448687707 + + # Jumping to else_8763448687707 + j else_8763448687707 + + then_8763448687707: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 188($sp) # internal_4 = address of allocated object Int + + lw $t0, 188($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 204($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_4 + lw $t0, 188($sp) + sw $t0, 204($sp) + end_assign: + + # Jumping to endif_8763448687707 + j endif_8763448687707 + + else_8763448687707: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 180($sp) # internal_6 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 49 + sb $t0, 8($v0) # internal_7[0] = '1' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 176($sp) # internal_7 = "1" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_7 + lw $t0, 188($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 184($sp) # internal_8 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 172($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 180($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_8 + lw $t0, 172($sp) + sw $t0, 180($sp) + end_assign: + + # If internal_6 then goto then_8763448687701 + lw $t0, 180($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8763448687701 + + # Jumping to else_8763448687701 + j else_8763448687701 + + then_8763448687701: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 168($sp) # internal_9 = address of allocated object Int + + lw $t0, 168($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 184($sp) + j end_assign + not_is_Bool_or_Int: + # internal_5 = internal_9 + lw $t0, 168($sp) + sw $t0, 184($sp) + end_assign: + + # Jumping to endif_8763448687701 + j endif_8763448687701 + + else_8763448687701: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_11 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 50 + sb $t0, 8($v0) # internal_12[0] = '2' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 156($sp) # internal_12 = "2" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_12 + lw $t0, 168($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 164($sp) # internal_13 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 152($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 160($sp) + j end_assign + not_is_Bool_or_Int: + # internal_11 = internal_13 + lw $t0, 152($sp) + sw $t0, 160($sp) + end_assign: + + # If internal_11 then goto then_8763448687695 + lw $t0, 160($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8763448687695 + + # Jumping to else_8763448687695 + j else_8763448687695 + + then_8763448687695: + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 148($sp) # internal_14 = address of allocated object Int + + lw $t0, 148($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 164($sp) + j end_assign + not_is_Bool_or_Int: + # internal_10 = internal_14 + lw $t0, 148($sp) + sw $t0, 164($sp) + end_assign: + + # Jumping to endif_8763448687695 + j endif_8763448687695 + + else_8763448687695: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 140($sp) # internal_16 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 51 + sb $t0, 8($v0) # internal_17[0] = '3' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 136($sp) # internal_17 = "3" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_17 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_17 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 144($sp) # internal_18 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 132($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 140($sp) + j end_assign + not_is_Bool_or_Int: + # internal_16 = internal_18 + lw $t0, 132($sp) + sw $t0, 140($sp) + end_assign: + + # If internal_16 then goto then_8763448687689 + lw $t0, 140($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8763448687689 + + # Jumping to else_8763448687689 + j else_8763448687689 + + then_8763448687689: + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_19 = address of allocated object Int + + lw $t0, 128($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 144($sp) + j end_assign + not_is_Bool_or_Int: + # internal_15 = internal_19 + lw $t0, 128($sp) + sw $t0, 144($sp) + end_assign: + + # Jumping to endif_8763448687689 + j endif_8763448687689 + + else_8763448687689: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_21 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 52 + sb $t0, 8($v0) # internal_22[0] = '4' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 116($sp) # internal_22 = "4" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_22 + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 124($sp) # internal_23 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 112($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 120($sp) + j end_assign + not_is_Bool_or_Int: + # internal_21 = internal_23 + lw $t0, 112($sp) + sw $t0, 120($sp) + end_assign: + + # If internal_21 then goto then_8763448687683 + lw $t0, 120($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8763448687683 + + # Jumping to else_8763448687683 + j else_8763448687683 + + then_8763448687683: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_24 = address of allocated object Int + + lw $t0, 108($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 124($sp) + j end_assign + not_is_Bool_or_Int: + # internal_20 = internal_24 + lw $t0, 108($sp) + sw $t0, 124($sp) + end_assign: + + # Jumping to endif_8763448687683 + j endif_8763448687683 + + else_8763448687683: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_26 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 53 + sb $t0, 8($v0) # internal_27[0] = '5' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 96($sp) # internal_27 = "5" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_27 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_27 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 104($sp) # internal_28 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 92($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 100($sp) + j end_assign + not_is_Bool_or_Int: + # internal_26 = internal_28 + lw $t0, 92($sp) + sw $t0, 100($sp) + end_assign: + + # If internal_26 then goto then_8763448687677 + lw $t0, 100($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8763448687677 + + # Jumping to else_8763448687677 + j else_8763448687677 + + then_8763448687677: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_29 = address of allocated object Int + + lw $t0, 88($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 104($sp) + j end_assign + not_is_Bool_or_Int: + # internal_25 = internal_29 + lw $t0, 88($sp) + sw $t0, 104($sp) + end_assign: + + # Jumping to endif_8763448687677 + j endif_8763448687677 + + else_8763448687677: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_31 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 54 + sb $t0, 8($v0) # internal_32[0] = '6' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 76($sp) # internal_32 = "6" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_32 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_32 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_33 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 72($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 80($sp) + j end_assign + not_is_Bool_or_Int: + # internal_31 = internal_33 + lw $t0, 72($sp) + sw $t0, 80($sp) + end_assign: + + # If internal_31 then goto then_8763448687671 + lw $t0, 80($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8763448687671 + + # Jumping to else_8763448687671 + j else_8763448687671 + + then_8763448687671: + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_34 = address of allocated object Int + + lw $t0, 68($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 84($sp) + j end_assign + not_is_Bool_or_Int: + # internal_30 = internal_34 + lw $t0, 68($sp) + sw $t0, 84($sp) + end_assign: + + # Jumping to endif_8763448687671 + j endif_8763448687671 + + else_8763448687671: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_36 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 55 + sb $t0, 8($v0) # internal_37[0] = '7' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 56($sp) # internal_37 = "7" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_37 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_37 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 64($sp) # internal_38 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 52($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # internal_36 = internal_38 + lw $t0, 52($sp) + sw $t0, 60($sp) + end_assign: + + # If internal_36 then goto then_8763448687665 + lw $t0, 60($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8763448687665 + + # Jumping to else_8763448687665 + j else_8763448687665 + + then_8763448687665: + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_39 = address of allocated object Int + + lw $t0, 48($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 64($sp) + j end_assign + not_is_Bool_or_Int: + # internal_35 = internal_39 + lw $t0, 48($sp) + sw $t0, 64($sp) + end_assign: + + # Jumping to endif_8763448687665 + j endif_8763448687665 + + else_8763448687665: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_41 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 56 + sb $t0, 8($v0) # internal_42[0] = '8' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 36($sp) # internal_42 = "8" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_42 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_42 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_43 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 32($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # internal_41 = internal_43 + lw $t0, 32($sp) + sw $t0, 40($sp) + end_assign: + + # If internal_41 then goto then_8763448687659 + lw $t0, 40($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8763448687659 + + # Jumping to else_8763448687659 + j else_8763448687659 + + then_8763448687659: + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_44 = address of allocated object Int + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # internal_40 = internal_44 + lw $t0, 28($sp) + sw $t0, 44($sp) + end_assign: + + # Jumping to endif_8763448687659 + j endif_8763448687659 + + else_8763448687659: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_46 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 57 + sb $t0, 8($v0) # internal_47[0] = '9' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 16($sp) # internal_47 = "9" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_47 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_47 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_48 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 20($sp) + j end_assign + not_is_Bool_or_Int: + # internal_46 = internal_48 + lw $t0, 12($sp) + sw $t0, 20($sp) + end_assign: + + # If internal_46 then goto then_8763448687638 + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8763448687638 + + # Jumping to else_8763448687638 + j else_8763448687638 + + then_8763448687638: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_49 = address of allocated object Int + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # internal_45 = internal_49 + lw $t0, 8($sp) + sw $t0, 24($sp) + end_assign: + + # Jumping to endif_8763448687638 + j endif_8763448687638 + + else_8763448687638: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_abort_at_Object + jal function_abort_at_Object + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_50 = result of function_abort_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_51 = address of allocated object Int + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # internal_45 = internal_51 + lw $t0, 0($sp) + sw $t0, 24($sp) + end_assign: + + # Jumping to endif_8763448687638 + j endif_8763448687638 + + endif_8763448687638: + + lw $t0, 24($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # internal_40 = internal_45 + lw $t0, 24($sp) + sw $t0, 44($sp) + end_assign: + + # Jumping to endif_8763448687659 + j endif_8763448687659 + + endif_8763448687659: + + lw $t0, 44($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 64($sp) + j end_assign + not_is_Bool_or_Int: + # internal_35 = internal_40 + lw $t0, 44($sp) + sw $t0, 64($sp) + end_assign: + + # Jumping to endif_8763448687665 + j endif_8763448687665 + + endif_8763448687665: + + lw $t0, 64($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 84($sp) + j end_assign + not_is_Bool_or_Int: + # internal_30 = internal_35 + lw $t0, 64($sp) + sw $t0, 84($sp) + end_assign: + + # Jumping to endif_8763448687671 + j endif_8763448687671 + + endif_8763448687671: + + lw $t0, 84($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 104($sp) + j end_assign + not_is_Bool_or_Int: + # internal_25 = internal_30 + lw $t0, 84($sp) + sw $t0, 104($sp) + end_assign: + + # Jumping to endif_8763448687677 + j endif_8763448687677 + + endif_8763448687677: + + lw $t0, 104($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 124($sp) + j end_assign + not_is_Bool_or_Int: + # internal_20 = internal_25 + lw $t0, 104($sp) + sw $t0, 124($sp) + end_assign: + + # Jumping to endif_8763448687683 + j endif_8763448687683 + + endif_8763448687683: + + lw $t0, 124($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 144($sp) + j end_assign + not_is_Bool_or_Int: + # internal_15 = internal_20 + lw $t0, 124($sp) + sw $t0, 144($sp) + end_assign: + + # Jumping to endif_8763448687689 + j endif_8763448687689 + + endif_8763448687689: + + lw $t0, 144($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 164($sp) + j end_assign + not_is_Bool_or_Int: + # internal_10 = internal_15 + lw $t0, 144($sp) + sw $t0, 164($sp) + end_assign: + + # Jumping to endif_8763448687695 + j endif_8763448687695 + + endif_8763448687695: + + lw $t0, 164($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 184($sp) + j end_assign + not_is_Bool_or_Int: + # internal_5 = internal_10 + lw $t0, 164($sp) + sw $t0, 184($sp) + end_assign: + + # Jumping to endif_8763448687701 + j endif_8763448687701 + + endif_8763448687701: + + lw $t0, 184($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 204($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_5 + lw $t0, 184($sp) + sw $t0, 204($sp) + end_assign: + + # Jumping to endif_8763448687707 + j endif_8763448687707 + + endif_8763448687707: + + # Loading return value in $v1 + lw $v1, 204($sp) + + # Freeing space for local variables + addi $sp, $sp, 208 + + jr $ra + + function_a2i_at_Parse: + # Function parameters + # $ra = 152($sp) + # self = 148($sp) + # s = 144($sp) + + # Reserving space for local variables + addi $sp, $sp, -144 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 140($sp) # internal_2 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 144($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 140($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 136($sp) # internal_4 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 124($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 136($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_4 + lw $t0, 124($sp) + sw $t0, 136($sp) + end_assign: + + # If internal_1 then goto then_8763448688159 + lw $t0, 136($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8763448688159 + + # Jumping to else_8763448688159 + j else_8763448688159 + + then_8763448688159: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_5 = address of allocated object Int + + lw $t0, 120($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 140($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_5 + lw $t0, 120($sp) + sw $t0, 140($sp) + end_assign: + + # Jumping to endif_8763448688159 + j endif_8763448688159 + + else_8763448688159: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_7 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_8 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_9 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 160($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_8 + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument internal_9 + lw $t0, 120($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 116($sp) # internal_10 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 45 + sb $t0, 8($v0) # internal_11[0] = '-' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 96($sp) # internal_11 = "-" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_11 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 104($sp) # internal_12 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 92($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 112($sp) + j end_assign + not_is_Bool_or_Int: + # internal_7 = internal_12 + lw $t0, 92($sp) + sw $t0, 112($sp) + end_assign: + + # If internal_7 then goto then_8763448688174 + lw $t0, 112($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8763448688174 + + # Jumping to else_8763448688174 + j else_8763448688174 + + then_8763448688174: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_13 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 92($sp) # internal_14 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_15 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_14 + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing internal_14 + + # Argument internal_15 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 88($sp) # internal_16 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 160($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_13 + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing internal_13 + + # Argument internal_16 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 88($sp) # internal_17 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_17 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_17 + + # Calling function function_a2i_aux_at_Parse + jal function_a2i_aux_at_Parse + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_18 = result of function_a2i_aux_at_Parse + addi $sp, $sp, 12 # Freeing space for arguments + + # Xor operation + lw $t0, 68($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 60($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 56($sp) # $t0 = internal_21 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Addition operation + lw $t0, 56($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 64($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 56($sp) # $t0 = internal_21 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + lw $t0, 56($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 116($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_21 + lw $t0, 56($sp) + sw $t0, 116($sp) + end_assign: + + # Jumping to endif_8763448688174 + j endif_8763448688174 + + else_8763448688174: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_23 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_24 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_25 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 160($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_24 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing internal_24 + + # Argument internal_25 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_25 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 52($sp) # internal_26 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_27[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 32($sp) # internal_27 = " " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_26 + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing internal_26 + + # Argument internal_27 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_27 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_28 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 48($sp) + j end_assign + not_is_Bool_or_Int: + # internal_23 = internal_28 + lw $t0, 28($sp) + sw $t0, 48($sp) + end_assign: + + # If internal_23 then goto then_8763448688168 + lw $t0, 48($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8763448688168 + + # Jumping to else_8763448688168 + j else_8763448688168 + + then_8763448688168: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_29 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_30 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_31 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_30 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_30 + + # Argument internal_31 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_31 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_32 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 160($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_29 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_29 + + # Argument internal_32 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_32 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 24($sp) # internal_33 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_33 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_33 + + # Calling function function_a2i_at_Parse + jal function_a2i_at_Parse + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_34 = result of function_a2i_at_Parse + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 4($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # internal_22 = internal_34 + lw $t0, 4($sp) + sw $t0, 52($sp) + end_assign: + + # Jumping to endif_8763448688168 + j endif_8763448688168 + + else_8763448688168: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing self + + # Argument s + lw $t0, 156($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_a2i_aux_at_Parse + jal function_a2i_aux_at_Parse + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_35 = result of function_a2i_aux_at_Parse + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # internal_22 = internal_35 + lw $t0, 0($sp) + sw $t0, 52($sp) + end_assign: + + # Jumping to endif_8763448688168 + j endif_8763448688168 + + endif_8763448688168: + + lw $t0, 52($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 116($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_22 + lw $t0, 52($sp) + sw $t0, 116($sp) + end_assign: + + # Jumping to endif_8763448688174 + j endif_8763448688174 + + endif_8763448688174: + + lw $t0, 116($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 140($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_6 + lw $t0, 116($sp) + sw $t0, 140($sp) + end_assign: + + # Jumping to endif_8763448688159 + j endif_8763448688159 + + endif_8763448688159: + + # Loading return value in $v1 + lw $v1, 140($sp) + + # Freeing space for local variables + addi $sp, $sp, 144 + + jr $ra + + function_a2i_aux_at_Parse: + # Function parameters + # $ra = 192($sp) + # self = 188($sp) + # s = 184($sp) + + # Reserving space for local variables + addi $sp, $sp, -184 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 176($sp) # internal_1 = address of allocated object Int + + lw $t0, 176($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 180($sp) + j end_assign + not_is_Bool_or_Int: + # int = internal_1 + lw $t0, 176($sp) + sw $t0, 180($sp) + end_assign: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 192($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 176($sp) # internal_3 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 168($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 172($sp) + j end_assign + not_is_Bool_or_Int: + # j = internal_3 + lw $t0, 168($sp) + sw $t0, 172($sp) + end_assign: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_5 = address of allocated object Int + + lw $t0, 160($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 164($sp) + j end_assign + not_is_Bool_or_Int: + # i = internal_5 + lw $t0, 160($sp) + sw $t0, 164($sp) + end_assign: + + while_start_8763448689122: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing i + + # Argument j + lw $t0, 184($sp) + sw $t0, 0($sp) # Storing j + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 164($sp) # internal_7 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 152($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 156($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_7 + lw $t0, 152($sp) + sw $t0, 156($sp) + end_assign: + + # If internal_6 then goto while_body_8763448689122 + lw $t0, 156($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8763448689122 + + # Jumping to while_end_8763448689122 + j while_end_8763448689122 + + while_body_8763448689122: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_9 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 200($sp) + sw $t0, 8($sp) # Storing s + + # Argument i + lw $t0, 180($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_9 + lw $t0, 160($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 156($sp) # internal_10 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + lw $t0, 140($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 148($sp) + j end_assign + not_is_Bool_or_Int: + # c = internal_10 + lw $t0, 140($sp) + sw $t0, 148($sp) + end_assign: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 132($sp) # internal_12 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_13[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 128($sp) # internal_13 = " " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument c + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing c + + # Argument internal_13 + lw $t0, 140($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 136($sp) # internal_14 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 124($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 132($sp) + j end_assign + not_is_Bool_or_Int: + # internal_12 = internal_14 + lw $t0, 124($sp) + sw $t0, 132($sp) + end_assign: + + # If internal_12 then goto then_8763448689101 + lw $t0, 132($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8763448689101 + + # Jumping to else_8763448689101 + j else_8763448689101 + + then_8763448689101: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_15 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_15 + lw $t0, 132($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 128($sp) # internal_16 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 192($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 120($sp) # internal_17 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_17 + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing internal_17 + + # Argument i + lw $t0, 176($sp) + sw $t0, 0($sp) # Storing i + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 120($sp) # internal_18 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_19 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_18 + lw $t0, 120($sp) + sw $t0, 4($sp) # Storing internal_18 + + # Argument internal_19 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_19 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 112($sp) # internal_20 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 200($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_16 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_16 + + # Argument internal_20 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 112($sp) # internal_21 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Set attribute rest of self + lw $t0, 188($sp) # $t0 = self + lw $t1, 96($sp) # $t1 = internal_21 + sw $t1, 12($t0) # self.rest = internal_21 + + lw $t0, 172($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 164($sp) + j end_assign + not_is_Bool_or_Int: + # i = j + lw $t0, 172($sp) + sw $t0, 164($sp) + end_assign: + + lw $t0, 164($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 136($sp) + j end_assign + not_is_Bool_or_Int: + # internal_11 = i + lw $t0, 164($sp) + sw $t0, 136($sp) + end_assign: + + # Jumping to endif_8763448689101 + j endif_8763448689101 + + else_8763448689101: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_23 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 44 + sb $t0, 8($v0) # internal_24[0] = ',' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 84($sp) # internal_24 = "," + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument c + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing c + + # Argument internal_24 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_24 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 92($sp) # internal_25 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 80($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 88($sp) + j end_assign + not_is_Bool_or_Int: + # internal_23 = internal_25 + lw $t0, 80($sp) + sw $t0, 88($sp) + end_assign: + + # If internal_23 then goto then_8763448689089 + lw $t0, 88($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8763448689089 + + # Jumping to else_8763448689089 + j else_8763448689089 + + then_8763448689089: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_26 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_26 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_26 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_27 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 192($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 76($sp) # internal_28 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_28 + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing internal_28 + + # Argument i + lw $t0, 176($sp) + sw $t0, 0($sp) # Storing i + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 76($sp) # internal_29 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_30 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_29 + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing internal_29 + + # Argument internal_30 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_30 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_31 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 200($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_27 + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing internal_27 + + # Argument internal_31 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_31 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 68($sp) # internal_32 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Set attribute rest of self + lw $t0, 188($sp) # $t0 = self + lw $t1, 52($sp) # $t1 = internal_32 + sw $t1, 12($t0) # self.rest = internal_32 + + lw $t0, 172($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 164($sp) + j end_assign + not_is_Bool_or_Int: + # i = j + lw $t0, 172($sp) + sw $t0, 164($sp) + end_assign: + + lw $t0, 164($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 92($sp) + j end_assign + not_is_Bool_or_Int: + # internal_22 = i + lw $t0, 164($sp) + sw $t0, 92($sp) + end_assign: + + # Jumping to endif_8763448689089 + j endif_8763448689089 + + else_8763448689089: + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_33 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument int + lw $t0, 192($sp) + sw $t0, 4($sp) # Storing int + + # Argument internal_33 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_33 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 56($sp) # internal_34 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_35 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 200($sp) + sw $t0, 8($sp) # Storing s + + # Argument i + lw $t0, 180($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_35 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_35 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 52($sp) # internal_36 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 200($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_36 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_36 + + # Calling function function_c2i_at_Parse + jal function_c2i_at_Parse + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_37 = result of function_c2i_at_Parse + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_34 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_34 + + # Argument internal_37 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_37 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_38 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 180($sp) + j end_assign + not_is_Bool_or_Int: + # int = internal_38 + lw $t0, 28($sp) + sw $t0, 180($sp) + end_assign: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_39 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_39 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_39 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_40 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 20($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 164($sp) + j end_assign + not_is_Bool_or_Int: + # i = internal_40 + lw $t0, 20($sp) + sw $t0, 164($sp) + end_assign: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_42 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing i + + # Argument j + lw $t0, 184($sp) + sw $t0, 0($sp) # Storing j + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_43 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 12($sp) + j end_assign + not_is_Bool_or_Int: + # internal_42 = internal_43 + lw $t0, 8($sp) + sw $t0, 12($sp) + end_assign: + + # If internal_42 then goto then_8763448689083 + lw $t0, 12($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8763448689083 + + # Jumping to else_8763448689083 + j else_8763448689083 + + then_8763448689083: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 0 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_44 = "" + + # Set attribute rest of self + lw $t0, 188($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_44 + sw $t1, 12($t0) # self.rest = internal_44 + + lw $t0, 4($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 16($sp) + j end_assign + not_is_Bool_or_Int: + # internal_41 = internal_44 + lw $t0, 4($sp) + sw $t0, 16($sp) + end_assign: + + # Jumping to endif_8763448689083 + j endif_8763448689083 + + else_8763448689083: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 0 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_45 = "" + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 16($sp) + j end_assign + not_is_Bool_or_Int: + # internal_41 = internal_45 + lw $t0, 0($sp) + sw $t0, 16($sp) + end_assign: + + # Jumping to endif_8763448689083 + j endif_8763448689083 + + endif_8763448689083: + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 92($sp) + j end_assign + not_is_Bool_or_Int: + # internal_22 = internal_41 + lw $t0, 16($sp) + sw $t0, 92($sp) + end_assign: + + # Jumping to endif_8763448689089 + j endif_8763448689089 + + endif_8763448689089: + + lw $t0, 92($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 136($sp) + j end_assign + not_is_Bool_or_Int: + # internal_11 = internal_22 + lw $t0, 92($sp) + sw $t0, 136($sp) + end_assign: + + # Jumping to endif_8763448689101 + j endif_8763448689101 + + endif_8763448689101: + + # Jumping to while_start_8763448689122 + j while_start_8763448689122 + + while_end_8763448689122: + + # Loading return value in $v1 + lw $v1, 180($sp) + + # Freeing space for local variables + addi $sp, $sp, 184 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + # Allocating BoolOp + li $v0, 9 + lw $a0, type_BoolOp + syscall + la $t0, type_BoolOp # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 8($sp) # internal_0 = address of allocated object BoolOp + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_BoolOp + jal function___init___at_BoolOp + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_0 = result of function___init___at_BoolOp + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute boolop of self + lw $t0, 12($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.boolop = internal_0 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 0 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_1 = "" + + # Set attribute rest of self + lw $t0, 12($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_1 + sw $t1, 12($t0) # self.rest = internal_1 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_read_input_at_Parse + jal function_read_input_at_Parse + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_2 = result of function_read_input_at_Parse + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute g of self + lw $t0, 12($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_2 + sw $t1, 16($t0) # self.g = internal_2 + + # Loading return value in $v1 + lw $v1, 12($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Get attribute g of self + lw $t0, 16($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'g' from the instance + sw $t1, 12($sp) # internal_0 = g + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_print_V_at_Graph + jal function_print_V_at_Graph + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_print_V_at_Graph + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute g of self + lw $t0, 16($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'g' from the instance + sw $t1, 4($sp) # internal_2 = g + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_2 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_print_E_at_Graph + jal function_print_E_at_Graph + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_3 = result of function_print_E_at_Graph + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function___init___at_BoolOp: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_and_at_BoolOp: + # Function parameters + # $ra = 24($sp) + # self = 20($sp) + # b1 = 16($sp) + # b2 = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 4($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = b1 + lw $t0, 16($sp) + sw $t0, 4($sp) + end_assign: + + # If internal_1 then goto then_8763448689478 + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8763448689478 + + # Jumping to else_8763448689478 + j else_8763448689478 + + then_8763448689478: + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 8($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = b2 + lw $t0, 12($sp) + sw $t0, 8($sp) + end_assign: + + # Jumping to endif_8763448689478 + j endif_8763448689478 + + else_8763448689478: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_2 = address of allocated object Int + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 8($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_2 + lw $t0, 0($sp) + sw $t0, 8($sp) + end_assign: + + # Jumping to endif_8763448689478 + j endif_8763448689478 + + endif_8763448689478: + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + function_or_at_BoolOp: + # Function parameters + # $ra = 24($sp) + # self = 20($sp) + # b1 = 16($sp) + # b2 = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 4($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = b1 + lw $t0, 16($sp) + sw $t0, 4($sp) + end_assign: + + # If internal_1 then goto then_8763448689505 + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8763448689505 + + # Jumping to else_8763448689505 + j else_8763448689505 + + then_8763448689505: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_2 = address of allocated object Int + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 8($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_2 + lw $t0, 0($sp) + sw $t0, 8($sp) + end_assign: + + # Jumping to endif_8763448689505 + j endif_8763448689505 + + else_8763448689505: + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 8($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = b2 + lw $t0, 12($sp) + sw $t0, 8($sp) + end_assign: + + # Jumping to endif_8763448689505 + j endif_8763448689505 + + endif_8763448689505: + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_main_at_Main + jal function_main_at_Main + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/hairyscary.mips b/tests/codegen/hairyscary.mips new file mode 100644 index 000000000..b27a35d58 --- /dev/null +++ b/tests/codegen/hairyscary.mips @@ -0,0 +1,7176 @@ +.data + type_Object: .word 8 + type_Object_inherits_from: .word 0 + type_Object_attributes: .word 0 + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO: .word 8 + type_IO_inherits_from: .word type_Object + type_IO_attributes: .word 0 + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_Int: .word 8 + type_Int_inherits_from: .word type_Object + type_Int_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_String: .word 8 + type_String_inherits_from: .word type_Object + type_String_attributes: .word 0 + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Bool: .word 8 + type_Bool_inherits_from: .word type_Object + type_Bool_attributes: .word 0 + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_Foo: .word 28 + type_Foo_inherits_from: .word type_Bazz + type_Foo_attributes: .word 5 + type_Foo_name_size: .word 3 + type_Foo_name: .asciiz "Foo" + + type_Bar: .word 44 + type_Bar_inherits_from: .word type_Razz + type_Bar_attributes: .word 9 + type_Bar_name_size: .word 3 + type_Bar_name: .asciiz "Bar" + + type_Razz: .word 36 + type_Razz_inherits_from: .word type_Foo + type_Razz_attributes: .word 7 + type_Razz_name_size: .word 4 + type_Razz_name: .asciiz "Razz" + + type_Bazz: .word 20 + type_Bazz_inherits_from: .word type_IO + type_Bazz_attributes: .word 3 + type_Bazz_name_size: .word 4 + type_Bazz_name: .asciiz "Bazz" + + type_Main: .word 24 + type_Main_inherits_from: .word type_Object + type_Main_attributes: .word 4 + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 40($sp) + # a = 36($sp) + # b = 32($sp) + + # Reserving space for local variables + addi $sp, $sp, -32 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_0 = address of allocated object Int + + # internal_1 = typeof a that is the first word of the object + lw $t0, 36($sp) + lw $t1, 0($t0) + sw $t1, 24($sp) + + # internal_2 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_3 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_4 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_7 = address of allocated object Int + + # internal_5 = EqualAddress(internal_1, internal_2) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_1, internal_3) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_7 = EqualAddress(internal_1, internal_4) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_6 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_7 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 36($sp) + lw $t0, 8($t0) + lw $t1, 32($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 36($sp) + lw $t1, 32($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 28($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 28($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 36($sp) # Save in $t0 the left operand address + lw $t1, 32($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 28($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 28($sp) + + # Freeing space for local variables + addi $sp, $sp, 32 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 12($t1) # $t1 = length of the name of self + lw $t3, 16($t1) # $t1 = name of self + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + move $t4, $v0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + addi $t0, $t0, 8 # Pointer to the first character of the string in self + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t1, while_copy_name_end + lb $t6, 0($t0) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t0, $t0, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $t4, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the string x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lw $t1, buffer_input($t0) # Loading the byte + beq $t1, $zero, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lw $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 5 + syscall + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + sw $t1, 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 0($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 0($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + lw $t2, 8($sp) # $t2 = start of the substring + lw $t3, 4($sp) # $t3 = length of the substring + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bge $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Foo: + # Function parameters + # $ra = 340($sp) + # self = 336($sp) + + # Reserving space for local variables + addi $sp, $sp, -336 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 332($sp) # internal_0 = address of allocated object Int + + # Set attribute h of self + lw $t0, 336($sp) # $t0 = self + lw $t1, 332($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.h = internal_0 + + + + + + + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 308($sp) # internal_6 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 316($sp) # internal_4 = address of allocated object Int + + + + + # internal_2 = typeof self that is the first word of the object + lw $t0, 336($sp) + lw $t1, 0($t0) + sw $t1, 324($sp) + + lw $t0, 324($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 320($sp) + j end_assign + not_is_Bool_or_Int: + # internal_3 = internal_2 + lw $t0, 324($sp) + sw $t0, 320($sp) + end_assign: + + lw $t0, 308($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 328($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_6 + lw $t0, 308($sp) + sw $t0, 328($sp) + end_assign: + + while_start_8779768528306: + + # Equal operation + lw $t0, 320($sp) # Save in $t0 the left operand address + # If internal_4 then goto while_end_8779768528306 + lw $t0, 316($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8779768528306 + + # Addition operation + lw $t0, 328($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # internal_3 = ancestor of internal_3 that is the first word of the object + lw $t0, 320($sp) + lw $t1, 4($t0) + sw $t1, 320($sp) + + # Jumping to while_start_8779768528306 + j while_start_8779768528306 + + while_end_8779768528306: + + + + + lw $t0, 324($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 320($sp) + j end_assign + not_is_Bool_or_Int: + # internal_3 = internal_2 + lw $t0, 324($sp) + sw $t0, 320($sp) + end_assign: + + + foreach_start_8779768528306: + + # Less than operation + lw $t0, 300($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 328($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 296($sp) # $t0 = internal_9 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_9 then goto foreach_body_8779768528306 + lw $t0, 296($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8779768528306 + + # Jumping to foreach_end_8779768528306 + j foreach_end_8779768528306 + + foreach_body_8779768528306: + + + # internal_3 = ancestor of internal_3 that is the first word of the object + lw $t0, 320($sp) + lw $t1, 4($t0) + sw $t1, 320($sp) + + # Addition operation + lw $t0, 300($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_start_8779768528306 + j foreach_start_8779768528306 + + foreach_end_8779768528306: + + + + + + + # internal_12 = direction of Bazz + la $t0, type_Bazz + sw $t0, 284($sp) + + + + # internal_13 = direction of Razz + la $t0, type_Razz + sw $t0, 280($sp) + + + + # internal_14 = direction of Foo + la $t0, type_Foo + sw $t0, 276($sp) + + + + # internal_15 = direction of Bar + la $t0, type_Bar + sw $t0, 272($sp) + + + + + + + foreach_type_start_8779768528306: + + # Less than operation + lw $t0, 268($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # If internal_17 then goto foreach_type_body_8779768528306 + lw $t0, 264($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8779768528306 + + # Jumping to foreach_type_end_8779768528306 + j foreach_type_end_8779768528306 + + foreach_type_body_8779768528306: + + + + + + foreach_ancestor_start_8779768528306: + + # Less than operation + lw $t0, 256($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 328($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 252($sp) # $t0 = internal_20 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_20 then goto foreach_ancestor_body_8779768528306 + lw $t0, 252($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8779768528306 + + # Jumping to foreach_ancestor_end_8779768528306 + j foreach_ancestor_end_8779768528306 + + foreach_ancestor_body_8779768528306: + + + # Equal operation + lw $t0, 260($sp) # Save in $t0 the left operand address + lw $t1, 248($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 244($sp) # $t0 = internal_22 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_22 then goto foreach_ancestor_end_8779768528306 + lw $t0, 244($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8779768528306 + + # Addition operation + lw $t0, 256($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_ancestor_start_8779768528306 + j foreach_ancestor_start_8779768528306 + + foreach_ancestor_end_8779768528306: + + + + + + # Addition operation + lw $t0, 268($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_type_start_8779768528306 + j foreach_type_start_8779768528306 + + foreach_type_end_8779768528306: + + + + + + + + lw $t0, 328($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 228($sp) + j end_assign + not_is_Bool_or_Int: + # internal_26 = internal_1 + lw $t0, 328($sp) + sw $t0, 228($sp) + end_assign: + + foreach_min_start_8779768528306: + + # Less than operation + lw $t0, 240($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # If internal_27 then goto foreach_min_body_8779768528306 + lw $t0, 224($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8779768528306 + + # Jumping to foreach_min_end_8779768528306 + j foreach_min_end_8779768528306 + + foreach_min_body_8779768528306: + + + # Less than operation + lw $t0, 232($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 228($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 224($sp) # $t0 = internal_27 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_27 then goto update_min_8779768528306 + lw $t0, 224($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8779768528306 + + # Jumping to foreach_min_end_8779768528306 + j foreach_min_end_8779768528306 + + update_min_8779768528306: + + lw $t0, 232($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 228($sp) + j end_assign + not_is_Bool_or_Int: + # internal_26 = internal_25 + lw $t0, 232($sp) + sw $t0, 228($sp) + end_assign: + + lw $t0, 240($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 236($sp) + j end_assign + not_is_Bool_or_Int: + # internal_24 = internal_23 + lw $t0, 240($sp) + sw $t0, 236($sp) + end_assign: + + update_min_end_8779768528306: + + # Addition operation + lw $t0, 240($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_min_start_8779768528306 + j foreach_min_start_8779768528306 + + foreach_min_end_8779768528306: + + + + + + + + + + # Equal operation + lw $t0, 236($sp) # Save in $t0 the left operand address + lw $t1, 328($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 216($sp) # $t0 = internal_29 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_29 then goto error_branch_8779768528306 + lw $t0, 216($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8779768528306 + + + + # If internal_30 then goto branch_Bazz_8779768528306 + lw $t0, 212($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bazz_8779768528306 + + + # If internal_30 then goto branch_Razz_8779768528306 + lw $t0, 212($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Razz_8779768528306 + + + # If internal_30 then goto branch_Foo_8779768528306 + lw $t0, 212($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Foo_8779768528306 + + + # If internal_30 then goto branch_Bar_8779768528306 + lw $t0, 212($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bar_8779768528306 + + branch_Bazz_8779768528306: + + # Allocating Foo + li $v0, 9 + lw $a0, type_Foo + syscall + la $t0, type_Foo # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 200($sp) # internal_33 = address of allocated object Foo + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_33 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_33 + + # Calling function function___init___at_Foo + jal function___init___at_Foo + lw $ra, 4($sp) + sw $v1, 208($sp) # internal_33 = result of function___init___at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 200($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 208($sp) + j end_assign + not_is_Bool_or_Int: + # internal_31 = internal_33 + lw $t0, 200($sp) + sw $t0, 208($sp) + end_assign: + + # Jumping to branch_end_8779768528306 + j branch_end_8779768528306 + + branch_Razz_8779768528306: + + # Allocating Bar + li $v0, 9 + lw $a0, type_Bar + syscall + la $t0, type_Bar # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 192($sp) # internal_35 = address of allocated object Bar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_35 + lw $t0, 200($sp) + sw $t0, 0($sp) # Storing internal_35 + + # Calling function function___init___at_Bar + jal function___init___at_Bar + lw $ra, 4($sp) + sw $v1, 200($sp) # internal_35 = result of function___init___at_Bar + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 192($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 208($sp) + j end_assign + not_is_Bool_or_Int: + # internal_31 = internal_35 + lw $t0, 192($sp) + sw $t0, 208($sp) + end_assign: + + # Jumping to branch_end_8779768528306 + j branch_end_8779768528306 + + branch_Foo_8779768528306: + + # Allocating Razz + li $v0, 9 + lw $a0, type_Razz + syscall + la $t0, type_Razz # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 184($sp) # internal_37 = address of allocated object Razz + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_37 + lw $t0, 192($sp) + sw $t0, 0($sp) # Storing internal_37 + + # Calling function function___init___at_Razz + jal function___init___at_Razz + lw $ra, 4($sp) + sw $v1, 192($sp) # internal_37 = result of function___init___at_Razz + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 184($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 208($sp) + j end_assign + not_is_Bool_or_Int: + # internal_31 = internal_37 + lw $t0, 184($sp) + sw $t0, 208($sp) + end_assign: + + # Jumping to branch_end_8779768528306 + j branch_end_8779768528306 + + branch_Bar_8779768528306: + + lw $t0, 204($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 208($sp) + j end_assign + not_is_Bool_or_Int: + # internal_31 = n + lw $t0, 204($sp) + sw $t0, 208($sp) + end_assign: + + # Jumping to branch_end_8779768528306 + j branch_end_8779768528306 + + error_branch_8779768528306: + + + branch_end_8779768528306: + + # Set attribute g of self + lw $t0, 336($sp) # $t0 = self + lw $t1, 208($sp) # $t1 = internal_31 + sw $t1, 12($t0) # self.g = internal_31 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 344($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_printh_at_Bazz + jal function_printh_at_Bazz + lw $ra, 4($sp) + sw $v1, 184($sp) # internal_39 = result of function_printh_at_Bazz + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute i of self + lw $t0, 336($sp) # $t0 = self + lw $t1, 176($sp) # $t1 = internal_39 + sw $t1, 16($t0) # self.i = internal_39 + + + + + + + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 152($sp) # internal_45 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_43 = address of allocated object Int + + + + + # internal_41 = typeof self that is the first word of the object + lw $t0, 336($sp) + lw $t1, 0($t0) + sw $t1, 168($sp) + + lw $t0, 168($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 164($sp) + j end_assign + not_is_Bool_or_Int: + # internal_42 = internal_41 + lw $t0, 168($sp) + sw $t0, 164($sp) + end_assign: + + lw $t0, 152($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 172($sp) + j end_assign + not_is_Bool_or_Int: + # internal_40 = internal_45 + lw $t0, 152($sp) + sw $t0, 172($sp) + end_assign: + + while_start_8779768552376: + + # Equal operation + lw $t0, 164($sp) # Save in $t0 the left operand address + # If internal_43 then goto while_end_8779768552376 + lw $t0, 160($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8779768552376 + + # Addition operation + lw $t0, 172($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # internal_42 = ancestor of internal_42 that is the first word of the object + lw $t0, 164($sp) + lw $t1, 4($t0) + sw $t1, 164($sp) + + # Jumping to while_start_8779768552376 + j while_start_8779768552376 + + while_end_8779768552376: + + + + + lw $t0, 168($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 164($sp) + j end_assign + not_is_Bool_or_Int: + # internal_42 = internal_41 + lw $t0, 168($sp) + sw $t0, 164($sp) + end_assign: + + + foreach_start_8779768552376: + + # Less than operation + lw $t0, 144($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 172($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 140($sp) # $t0 = internal_48 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_48 then goto foreach_body_8779768552376 + lw $t0, 140($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8779768552376 + + # Jumping to foreach_end_8779768552376 + j foreach_end_8779768552376 + + foreach_body_8779768552376: + + + # internal_42 = ancestor of internal_42 that is the first word of the object + lw $t0, 164($sp) + lw $t1, 4($t0) + sw $t1, 164($sp) + + # Addition operation + lw $t0, 144($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_start_8779768552376 + j foreach_start_8779768552376 + + foreach_end_8779768552376: + + + + + + + # internal_51 = direction of Razz + la $t0, type_Razz + sw $t0, 128($sp) + + + + # internal_52 = direction of Foo + la $t0, type_Foo + sw $t0, 124($sp) + + + + # internal_53 = direction of Bar + la $t0, type_Bar + sw $t0, 120($sp) + + + + + + + foreach_type_start_8779768552376: + + # Less than operation + lw $t0, 116($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # If internal_55 then goto foreach_type_body_8779768552376 + lw $t0, 112($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8779768552376 + + # Jumping to foreach_type_end_8779768552376 + j foreach_type_end_8779768552376 + + foreach_type_body_8779768552376: + + + + + + foreach_ancestor_start_8779768552376: + + # Less than operation + lw $t0, 104($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 172($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 100($sp) # $t0 = internal_58 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_58 then goto foreach_ancestor_body_8779768552376 + lw $t0, 100($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8779768552376 + + # Jumping to foreach_ancestor_end_8779768552376 + j foreach_ancestor_end_8779768552376 + + foreach_ancestor_body_8779768552376: + + + # Equal operation + lw $t0, 108($sp) # Save in $t0 the left operand address + lw $t1, 96($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 92($sp) # $t0 = internal_60 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_60 then goto foreach_ancestor_end_8779768552376 + lw $t0, 92($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8779768552376 + + # Addition operation + lw $t0, 104($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_ancestor_start_8779768552376 + j foreach_ancestor_start_8779768552376 + + foreach_ancestor_end_8779768552376: + + + + + + # Addition operation + lw $t0, 116($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_type_start_8779768552376 + j foreach_type_start_8779768552376 + + foreach_type_end_8779768552376: + + + + + + + + lw $t0, 172($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 76($sp) + j end_assign + not_is_Bool_or_Int: + # internal_64 = internal_40 + lw $t0, 172($sp) + sw $t0, 76($sp) + end_assign: + + foreach_min_start_8779768552376: + + # Less than operation + lw $t0, 88($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # If internal_65 then goto foreach_min_body_8779768552376 + lw $t0, 72($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8779768552376 + + # Jumping to foreach_min_end_8779768552376 + j foreach_min_end_8779768552376 + + foreach_min_body_8779768552376: + + + # Less than operation + lw $t0, 80($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 76($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 72($sp) # $t0 = internal_65 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_65 then goto update_min_8779768552376 + lw $t0, 72($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8779768552376 + + # Jumping to foreach_min_end_8779768552376 + j foreach_min_end_8779768552376 + + update_min_8779768552376: + + lw $t0, 80($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 76($sp) + j end_assign + not_is_Bool_or_Int: + # internal_64 = internal_63 + lw $t0, 80($sp) + sw $t0, 76($sp) + end_assign: + + lw $t0, 88($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 84($sp) + j end_assign + not_is_Bool_or_Int: + # internal_62 = internal_61 + lw $t0, 88($sp) + sw $t0, 84($sp) + end_assign: + + update_min_end_8779768552376: + + # Addition operation + lw $t0, 88($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_min_start_8779768552376 + j foreach_min_start_8779768552376 + + foreach_min_end_8779768552376: + + + + + + + + + # Equal operation + lw $t0, 84($sp) # Save in $t0 the left operand address + lw $t1, 172($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 64($sp) # $t0 = internal_67 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_67 then goto error_branch_8779768552376 + lw $t0, 64($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8779768552376 + + + + # If internal_68 then goto branch_Razz_8779768552376 + lw $t0, 60($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Razz_8779768552376 + + + # If internal_68 then goto branch_Foo_8779768552376 + lw $t0, 60($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Foo_8779768552376 + + + # If internal_68 then goto branch_Bar_8779768552376 + lw $t0, 60($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bar_8779768552376 + + branch_Razz_8779768552376: + + # Allocating Bar + li $v0, 9 + lw $a0, type_Bar + syscall + la $t0, type_Bar # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 48($sp) # internal_71 = address of allocated object Bar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_71 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_71 + + # Calling function function___init___at_Bar + jal function___init___at_Bar + lw $ra, 4($sp) + sw $v1, 56($sp) # internal_71 = result of function___init___at_Bar + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 48($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 56($sp) + j end_assign + not_is_Bool_or_Int: + # internal_69 = internal_71 + lw $t0, 48($sp) + sw $t0, 56($sp) + end_assign: + + # Jumping to branch_end_8779768552376 + j branch_end_8779768552376 + + branch_Foo_8779768552376: + + # Allocating Razz + li $v0, 9 + lw $a0, type_Razz + syscall + la $t0, type_Razz # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 40($sp) # internal_73 = address of allocated object Razz + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_73 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_73 + + # Calling function function___init___at_Razz + jal function___init___at_Razz + lw $ra, 4($sp) + sw $v1, 48($sp) # internal_73 = result of function___init___at_Razz + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 40($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 56($sp) + j end_assign + not_is_Bool_or_Int: + # internal_69 = internal_73 + lw $t0, 40($sp) + sw $t0, 56($sp) + end_assign: + + # Jumping to branch_end_8779768552376 + j branch_end_8779768552376 + + branch_Bar_8779768552376: + + lw $t0, 204($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 56($sp) + j end_assign + not_is_Bool_or_Int: + # internal_69 = n + lw $t0, 204($sp) + sw $t0, 56($sp) + end_assign: + + # Jumping to branch_end_8779768552376 + j branch_end_8779768552376 + + error_branch_8779768552376: + + + branch_end_8779768552376: + + # Set attribute a of self + lw $t0, 336($sp) # $t0 = self + lw $t1, 56($sp) # $t1 = internal_69 + sw $t1, 20($t0) # self.a = internal_69 + + # Get attribute a of self + lw $t0, 336($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'a' from the instance + sw $t1, 32($sp) # internal_75 = a + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_75 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_75 + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 36($sp) # internal_76 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute g of self + lw $t0, 336($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'g' from the instance + sw $t1, 24($sp) # internal_77 = g + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_77 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_77 + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_78 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_76 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_76 + + # Argument internal_78 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_78 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_79 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 344($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_80 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_79 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_79 + + # Argument internal_80 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_80 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_81 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 344($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_printh_at_Bazz + jal function_printh_at_Bazz + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_82 = result of function_printh_at_Bazz + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_81 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_81 + + # Argument internal_82 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_82 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_83 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute b of self + lw $t0, 336($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_83 + sw $t1, 24($t0) # self.b = internal_83 + + # Loading return value in $v1 + lw $v1, 336($sp) + + # Freeing space for local variables + addi $sp, $sp, 336 + + jr $ra + + function_doh_at_Foo: + # Function parameters + # $ra = 24($sp) + # self = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # Get attribute h of self + lw $t0, 20($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'h' from the instance + sw $t1, 12($sp) # internal_1 = h + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 16($sp) + j end_assign + not_is_Bool_or_Int: + # i = internal_1 + lw $t0, 12($sp) + sw $t0, 16($sp) + end_assign: + + # Get attribute h of self + lw $t0, 20($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'h' from the instance + sw $t1, 8($sp) # internal_2 = h + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_4 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute h of self + lw $t0, 20($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_4 + sw $t1, 8($t0) # self.h = internal_4 + + # Loading return value in $v1 + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 20 + + jr $ra + + function___init___at_Bar: + # Function parameters + # $ra = 524($sp) + # self = 520($sp) + + # Reserving space for local variables + addi $sp, $sp, -520 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 516($sp) # internal_0 = address of allocated object Int + + # Set attribute h of self + lw $t0, 520($sp) # $t0 = self + lw $t1, 516($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.h = internal_0 + + + + + + + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 492($sp) # internal_6 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 500($sp) # internal_4 = address of allocated object Int + + + + + # internal_2 = typeof self that is the first word of the object + lw $t0, 520($sp) + lw $t1, 0($t0) + sw $t1, 508($sp) + + lw $t0, 508($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 504($sp) + j end_assign + not_is_Bool_or_Int: + # internal_3 = internal_2 + lw $t0, 508($sp) + sw $t0, 504($sp) + end_assign: + + lw $t0, 492($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 512($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_6 + lw $t0, 492($sp) + sw $t0, 512($sp) + end_assign: + + while_start_8779768528306: + + # Equal operation + lw $t0, 504($sp) # Save in $t0 the left operand address + # If internal_4 then goto while_end_8779768528306 + lw $t0, 500($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8779768528306 + + # Addition operation + lw $t0, 512($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # internal_3 = ancestor of internal_3 that is the first word of the object + lw $t0, 504($sp) + lw $t1, 4($t0) + sw $t1, 504($sp) + + # Jumping to while_start_8779768528306 + j while_start_8779768528306 + + while_end_8779768528306: + + + + + lw $t0, 508($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 504($sp) + j end_assign + not_is_Bool_or_Int: + # internal_3 = internal_2 + lw $t0, 508($sp) + sw $t0, 504($sp) + end_assign: + + + foreach_start_8779768528306: + + # Less than operation + lw $t0, 484($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 512($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 480($sp) # $t0 = internal_9 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_9 then goto foreach_body_8779768528306 + lw $t0, 480($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8779768528306 + + # Jumping to foreach_end_8779768528306 + j foreach_end_8779768528306 + + foreach_body_8779768528306: + + + # internal_3 = ancestor of internal_3 that is the first word of the object + lw $t0, 504($sp) + lw $t1, 4($t0) + sw $t1, 504($sp) + + # Addition operation + lw $t0, 484($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_start_8779768528306 + j foreach_start_8779768528306 + + foreach_end_8779768528306: + + + + + + + # internal_12 = direction of Bazz + la $t0, type_Bazz + sw $t0, 468($sp) + + + + # internal_13 = direction of Razz + la $t0, type_Razz + sw $t0, 464($sp) + + + + # internal_14 = direction of Foo + la $t0, type_Foo + sw $t0, 460($sp) + + + + # internal_15 = direction of Bar + la $t0, type_Bar + sw $t0, 456($sp) + + + + + + + foreach_type_start_8779768528306: + + # Less than operation + lw $t0, 452($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # If internal_17 then goto foreach_type_body_8779768528306 + lw $t0, 448($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8779768528306 + + # Jumping to foreach_type_end_8779768528306 + j foreach_type_end_8779768528306 + + foreach_type_body_8779768528306: + + + + + + foreach_ancestor_start_8779768528306: + + # Less than operation + lw $t0, 440($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 512($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 436($sp) # $t0 = internal_20 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_20 then goto foreach_ancestor_body_8779768528306 + lw $t0, 436($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8779768528306 + + # Jumping to foreach_ancestor_end_8779768528306 + j foreach_ancestor_end_8779768528306 + + foreach_ancestor_body_8779768528306: + + + # Equal operation + lw $t0, 444($sp) # Save in $t0 the left operand address + lw $t1, 432($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 428($sp) # $t0 = internal_22 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_22 then goto foreach_ancestor_end_8779768528306 + lw $t0, 428($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8779768528306 + + # Addition operation + lw $t0, 440($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_ancestor_start_8779768528306 + j foreach_ancestor_start_8779768528306 + + foreach_ancestor_end_8779768528306: + + + + + + # Addition operation + lw $t0, 452($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_type_start_8779768528306 + j foreach_type_start_8779768528306 + + foreach_type_end_8779768528306: + + + + + + + + lw $t0, 512($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 412($sp) + j end_assign + not_is_Bool_or_Int: + # internal_26 = internal_1 + lw $t0, 512($sp) + sw $t0, 412($sp) + end_assign: + + foreach_min_start_8779768528306: + + # Less than operation + lw $t0, 424($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # If internal_27 then goto foreach_min_body_8779768528306 + lw $t0, 408($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8779768528306 + + # Jumping to foreach_min_end_8779768528306 + j foreach_min_end_8779768528306 + + foreach_min_body_8779768528306: + + + # Less than operation + lw $t0, 416($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 412($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 408($sp) # $t0 = internal_27 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_27 then goto update_min_8779768528306 + lw $t0, 408($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8779768528306 + + # Jumping to foreach_min_end_8779768528306 + j foreach_min_end_8779768528306 + + update_min_8779768528306: + + lw $t0, 416($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 412($sp) + j end_assign + not_is_Bool_or_Int: + # internal_26 = internal_25 + lw $t0, 416($sp) + sw $t0, 412($sp) + end_assign: + + lw $t0, 424($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 420($sp) + j end_assign + not_is_Bool_or_Int: + # internal_24 = internal_23 + lw $t0, 424($sp) + sw $t0, 420($sp) + end_assign: + + update_min_end_8779768528306: + + # Addition operation + lw $t0, 424($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_min_start_8779768528306 + j foreach_min_start_8779768528306 + + foreach_min_end_8779768528306: + + + + + + + + + + # Equal operation + lw $t0, 420($sp) # Save in $t0 the left operand address + lw $t1, 512($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 400($sp) # $t0 = internal_29 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_29 then goto error_branch_8779768528306 + lw $t0, 400($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8779768528306 + + + + # If internal_30 then goto branch_Bazz_8779768528306 + lw $t0, 396($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bazz_8779768528306 + + + # If internal_30 then goto branch_Razz_8779768528306 + lw $t0, 396($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Razz_8779768528306 + + + # If internal_30 then goto branch_Foo_8779768528306 + lw $t0, 396($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Foo_8779768528306 + + + # If internal_30 then goto branch_Bar_8779768528306 + lw $t0, 396($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bar_8779768528306 + + branch_Bazz_8779768528306: + + # Allocating Foo + li $v0, 9 + lw $a0, type_Foo + syscall + la $t0, type_Foo # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 384($sp) # internal_33 = address of allocated object Foo + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_33 + lw $t0, 392($sp) + sw $t0, 0($sp) # Storing internal_33 + + # Calling function function___init___at_Foo + jal function___init___at_Foo + lw $ra, 4($sp) + sw $v1, 392($sp) # internal_33 = result of function___init___at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 384($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 392($sp) + j end_assign + not_is_Bool_or_Int: + # internal_31 = internal_33 + lw $t0, 384($sp) + sw $t0, 392($sp) + end_assign: + + # Jumping to branch_end_8779768528306 + j branch_end_8779768528306 + + branch_Razz_8779768528306: + + # Allocating Bar + li $v0, 9 + lw $a0, type_Bar + syscall + la $t0, type_Bar # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 376($sp) # internal_35 = address of allocated object Bar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_35 + lw $t0, 384($sp) + sw $t0, 0($sp) # Storing internal_35 + + # Calling function function___init___at_Bar + jal function___init___at_Bar + lw $ra, 4($sp) + sw $v1, 384($sp) # internal_35 = result of function___init___at_Bar + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 376($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 392($sp) + j end_assign + not_is_Bool_or_Int: + # internal_31 = internal_35 + lw $t0, 376($sp) + sw $t0, 392($sp) + end_assign: + + # Jumping to branch_end_8779768528306 + j branch_end_8779768528306 + + branch_Foo_8779768528306: + + # Allocating Razz + li $v0, 9 + lw $a0, type_Razz + syscall + la $t0, type_Razz # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 368($sp) # internal_37 = address of allocated object Razz + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_37 + lw $t0, 376($sp) + sw $t0, 0($sp) # Storing internal_37 + + # Calling function function___init___at_Razz + jal function___init___at_Razz + lw $ra, 4($sp) + sw $v1, 376($sp) # internal_37 = result of function___init___at_Razz + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 368($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 392($sp) + j end_assign + not_is_Bool_or_Int: + # internal_31 = internal_37 + lw $t0, 368($sp) + sw $t0, 392($sp) + end_assign: + + # Jumping to branch_end_8779768528306 + j branch_end_8779768528306 + + branch_Bar_8779768528306: + + lw $t0, 388($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 392($sp) + j end_assign + not_is_Bool_or_Int: + # internal_31 = n + lw $t0, 388($sp) + sw $t0, 392($sp) + end_assign: + + # Jumping to branch_end_8779768528306 + j branch_end_8779768528306 + + error_branch_8779768528306: + + + branch_end_8779768528306: + + # Set attribute g of self + lw $t0, 520($sp) # $t0 = self + lw $t1, 392($sp) # $t1 = internal_31 + sw $t1, 12($t0) # self.g = internal_31 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 528($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_printh_at_Bazz + jal function_printh_at_Bazz + lw $ra, 4($sp) + sw $v1, 368($sp) # internal_39 = result of function_printh_at_Bazz + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute i of self + lw $t0, 520($sp) # $t0 = self + lw $t1, 360($sp) # $t1 = internal_39 + sw $t1, 16($t0) # self.i = internal_39 + + + + + + + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 336($sp) # internal_45 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 344($sp) # internal_43 = address of allocated object Int + + + + + # internal_41 = typeof self that is the first word of the object + lw $t0, 520($sp) + lw $t1, 0($t0) + sw $t1, 352($sp) + + lw $t0, 352($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 348($sp) + j end_assign + not_is_Bool_or_Int: + # internal_42 = internal_41 + lw $t0, 352($sp) + sw $t0, 348($sp) + end_assign: + + lw $t0, 336($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 356($sp) + j end_assign + not_is_Bool_or_Int: + # internal_40 = internal_45 + lw $t0, 336($sp) + sw $t0, 356($sp) + end_assign: + + while_start_8779768552376: + + # Equal operation + lw $t0, 348($sp) # Save in $t0 the left operand address + # If internal_43 then goto while_end_8779768552376 + lw $t0, 344($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8779768552376 + + # Addition operation + lw $t0, 356($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # internal_42 = ancestor of internal_42 that is the first word of the object + lw $t0, 348($sp) + lw $t1, 4($t0) + sw $t1, 348($sp) + + # Jumping to while_start_8779768552376 + j while_start_8779768552376 + + while_end_8779768552376: + + + + + lw $t0, 352($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 348($sp) + j end_assign + not_is_Bool_or_Int: + # internal_42 = internal_41 + lw $t0, 352($sp) + sw $t0, 348($sp) + end_assign: + + + foreach_start_8779768552376: + + # Less than operation + lw $t0, 328($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 356($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 324($sp) # $t0 = internal_48 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_48 then goto foreach_body_8779768552376 + lw $t0, 324($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8779768552376 + + # Jumping to foreach_end_8779768552376 + j foreach_end_8779768552376 + + foreach_body_8779768552376: + + + # internal_42 = ancestor of internal_42 that is the first word of the object + lw $t0, 348($sp) + lw $t1, 4($t0) + sw $t1, 348($sp) + + # Addition operation + lw $t0, 328($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_start_8779768552376 + j foreach_start_8779768552376 + + foreach_end_8779768552376: + + + + + + + # internal_51 = direction of Razz + la $t0, type_Razz + sw $t0, 312($sp) + + + + # internal_52 = direction of Foo + la $t0, type_Foo + sw $t0, 308($sp) + + + + # internal_53 = direction of Bar + la $t0, type_Bar + sw $t0, 304($sp) + + + + + + + foreach_type_start_8779768552376: + + # Less than operation + lw $t0, 300($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # If internal_55 then goto foreach_type_body_8779768552376 + lw $t0, 296($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8779768552376 + + # Jumping to foreach_type_end_8779768552376 + j foreach_type_end_8779768552376 + + foreach_type_body_8779768552376: + + + + + + foreach_ancestor_start_8779768552376: + + # Less than operation + lw $t0, 288($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 356($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 284($sp) # $t0 = internal_58 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_58 then goto foreach_ancestor_body_8779768552376 + lw $t0, 284($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8779768552376 + + # Jumping to foreach_ancestor_end_8779768552376 + j foreach_ancestor_end_8779768552376 + + foreach_ancestor_body_8779768552376: + + + # Equal operation + lw $t0, 292($sp) # Save in $t0 the left operand address + lw $t1, 280($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 276($sp) # $t0 = internal_60 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_60 then goto foreach_ancestor_end_8779768552376 + lw $t0, 276($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8779768552376 + + # Addition operation + lw $t0, 288($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_ancestor_start_8779768552376 + j foreach_ancestor_start_8779768552376 + + foreach_ancestor_end_8779768552376: + + + + + + # Addition operation + lw $t0, 300($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_type_start_8779768552376 + j foreach_type_start_8779768552376 + + foreach_type_end_8779768552376: + + + + + + + + lw $t0, 356($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 260($sp) + j end_assign + not_is_Bool_or_Int: + # internal_64 = internal_40 + lw $t0, 356($sp) + sw $t0, 260($sp) + end_assign: + + foreach_min_start_8779768552376: + + # Less than operation + lw $t0, 272($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # If internal_65 then goto foreach_min_body_8779768552376 + lw $t0, 256($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8779768552376 + + # Jumping to foreach_min_end_8779768552376 + j foreach_min_end_8779768552376 + + foreach_min_body_8779768552376: + + + # Less than operation + lw $t0, 264($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 260($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 256($sp) # $t0 = internal_65 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_65 then goto update_min_8779768552376 + lw $t0, 256($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8779768552376 + + # Jumping to foreach_min_end_8779768552376 + j foreach_min_end_8779768552376 + + update_min_8779768552376: + + lw $t0, 264($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 260($sp) + j end_assign + not_is_Bool_or_Int: + # internal_64 = internal_63 + lw $t0, 264($sp) + sw $t0, 260($sp) + end_assign: + + lw $t0, 272($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 268($sp) + j end_assign + not_is_Bool_or_Int: + # internal_62 = internal_61 + lw $t0, 272($sp) + sw $t0, 268($sp) + end_assign: + + update_min_end_8779768552376: + + # Addition operation + lw $t0, 272($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_min_start_8779768552376 + j foreach_min_start_8779768552376 + + foreach_min_end_8779768552376: + + + + + + + + + # Equal operation + lw $t0, 268($sp) # Save in $t0 the left operand address + lw $t1, 356($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 248($sp) # $t0 = internal_67 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_67 then goto error_branch_8779768552376 + lw $t0, 248($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8779768552376 + + + + # If internal_68 then goto branch_Razz_8779768552376 + lw $t0, 244($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Razz_8779768552376 + + + # If internal_68 then goto branch_Foo_8779768552376 + lw $t0, 244($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Foo_8779768552376 + + + # If internal_68 then goto branch_Bar_8779768552376 + lw $t0, 244($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bar_8779768552376 + + branch_Razz_8779768552376: + + # Allocating Bar + li $v0, 9 + lw $a0, type_Bar + syscall + la $t0, type_Bar # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 232($sp) # internal_71 = address of allocated object Bar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_71 + lw $t0, 240($sp) + sw $t0, 0($sp) # Storing internal_71 + + # Calling function function___init___at_Bar + jal function___init___at_Bar + lw $ra, 4($sp) + sw $v1, 240($sp) # internal_71 = result of function___init___at_Bar + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 232($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 240($sp) + j end_assign + not_is_Bool_or_Int: + # internal_69 = internal_71 + lw $t0, 232($sp) + sw $t0, 240($sp) + end_assign: + + # Jumping to branch_end_8779768552376 + j branch_end_8779768552376 + + branch_Foo_8779768552376: + + # Allocating Razz + li $v0, 9 + lw $a0, type_Razz + syscall + la $t0, type_Razz # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 224($sp) # internal_73 = address of allocated object Razz + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_73 + lw $t0, 232($sp) + sw $t0, 0($sp) # Storing internal_73 + + # Calling function function___init___at_Razz + jal function___init___at_Razz + lw $ra, 4($sp) + sw $v1, 232($sp) # internal_73 = result of function___init___at_Razz + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 224($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 240($sp) + j end_assign + not_is_Bool_or_Int: + # internal_69 = internal_73 + lw $t0, 224($sp) + sw $t0, 240($sp) + end_assign: + + # Jumping to branch_end_8779768552376 + j branch_end_8779768552376 + + branch_Bar_8779768552376: + + lw $t0, 388($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 240($sp) + j end_assign + not_is_Bool_or_Int: + # internal_69 = n + lw $t0, 388($sp) + sw $t0, 240($sp) + end_assign: + + # Jumping to branch_end_8779768552376 + j branch_end_8779768552376 + + error_branch_8779768552376: + + + branch_end_8779768552376: + + # Set attribute a of self + lw $t0, 520($sp) # $t0 = self + lw $t1, 240($sp) # $t1 = internal_69 + sw $t1, 20($t0) # self.a = internal_69 + + # Get attribute a of self + lw $t0, 520($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'a' from the instance + sw $t1, 216($sp) # internal_75 = a + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_75 + lw $t0, 224($sp) + sw $t0, 0($sp) # Storing internal_75 + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 220($sp) # internal_76 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute g of self + lw $t0, 520($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'g' from the instance + sw $t1, 208($sp) # internal_77 = g + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_77 + lw $t0, 216($sp) + sw $t0, 0($sp) # Storing internal_77 + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 212($sp) # internal_78 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_76 + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing internal_76 + + # Argument internal_78 + lw $t0, 216($sp) + sw $t0, 0($sp) # Storing internal_78 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 212($sp) # internal_79 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 528($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 204($sp) # internal_80 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_79 + lw $t0, 212($sp) + sw $t0, 4($sp) # Storing internal_79 + + # Argument internal_80 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_80 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 204($sp) # internal_81 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 528($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_printh_at_Bazz + jal function_printh_at_Bazz + lw $ra, 4($sp) + sw $v1, 196($sp) # internal_82 = result of function_printh_at_Bazz + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_81 + lw $t0, 204($sp) + sw $t0, 4($sp) # Storing internal_81 + + # Argument internal_82 + lw $t0, 200($sp) + sw $t0, 0($sp) # Storing internal_82 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 196($sp) # internal_83 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute b of self + lw $t0, 520($sp) # $t0 = self + lw $t1, 184($sp) # $t1 = internal_83 + sw $t1, 24($t0) # self.b = internal_83 + + + + + + + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_89 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 168($sp) # internal_87 = address of allocated object Int + + + + + # internal_85 = typeof self that is the first word of the object + lw $t0, 520($sp) + lw $t1, 0($t0) + sw $t1, 176($sp) + + lw $t0, 176($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 172($sp) + j end_assign + not_is_Bool_or_Int: + # internal_86 = internal_85 + lw $t0, 176($sp) + sw $t0, 172($sp) + end_assign: + + lw $t0, 160($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 180($sp) + j end_assign + not_is_Bool_or_Int: + # internal_84 = internal_89 + lw $t0, 160($sp) + sw $t0, 180($sp) + end_assign: + + while_start_8779768528207: + + # Equal operation + lw $t0, 172($sp) # Save in $t0 the left operand address + # If internal_87 then goto while_end_8779768528207 + lw $t0, 168($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8779768528207 + + # Addition operation + lw $t0, 180($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # internal_86 = ancestor of internal_86 that is the first word of the object + lw $t0, 172($sp) + lw $t1, 4($t0) + sw $t1, 172($sp) + + # Jumping to while_start_8779768528207 + j while_start_8779768528207 + + while_end_8779768528207: + + + + + lw $t0, 176($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 172($sp) + j end_assign + not_is_Bool_or_Int: + # internal_86 = internal_85 + lw $t0, 176($sp) + sw $t0, 172($sp) + end_assign: + + + foreach_start_8779768528207: + + # Less than operation + lw $t0, 152($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 180($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 148($sp) # $t0 = internal_92 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_92 then goto foreach_body_8779768528207 + lw $t0, 148($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8779768528207 + + # Jumping to foreach_end_8779768528207 + j foreach_end_8779768528207 + + foreach_body_8779768528207: + + + # internal_86 = ancestor of internal_86 that is the first word of the object + lw $t0, 172($sp) + lw $t1, 4($t0) + sw $t1, 172($sp) + + # Addition operation + lw $t0, 152($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_start_8779768528207 + j foreach_start_8779768528207 + + foreach_end_8779768528207: + + + + + + + # internal_95 = direction of Razz + la $t0, type_Razz + sw $t0, 136($sp) + + + + # internal_96 = direction of Bar + la $t0, type_Bar + sw $t0, 132($sp) + + + + + + + foreach_type_start_8779768528207: + + # Less than operation + lw $t0, 128($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # If internal_98 then goto foreach_type_body_8779768528207 + lw $t0, 124($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8779768528207 + + # Jumping to foreach_type_end_8779768528207 + j foreach_type_end_8779768528207 + + foreach_type_body_8779768528207: + + + + + + foreach_ancestor_start_8779768528207: + + # Less than operation + lw $t0, 116($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 180($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 112($sp) # $t0 = internal_101 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_101 then goto foreach_ancestor_body_8779768528207 + lw $t0, 112($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8779768528207 + + # Jumping to foreach_ancestor_end_8779768528207 + j foreach_ancestor_end_8779768528207 + + foreach_ancestor_body_8779768528207: + + + # Equal operation + lw $t0, 120($sp) # Save in $t0 the left operand address + lw $t1, 108($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 104($sp) # $t0 = internal_103 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_103 then goto foreach_ancestor_end_8779768528207 + lw $t0, 104($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8779768528207 + + # Addition operation + lw $t0, 116($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_ancestor_start_8779768528207 + j foreach_ancestor_start_8779768528207 + + foreach_ancestor_end_8779768528207: + + + + + + # Addition operation + lw $t0, 128($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_type_start_8779768528207 + j foreach_type_start_8779768528207 + + foreach_type_end_8779768528207: + + + + + + + + lw $t0, 180($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 88($sp) + j end_assign + not_is_Bool_or_Int: + # internal_107 = internal_84 + lw $t0, 180($sp) + sw $t0, 88($sp) + end_assign: + + foreach_min_start_8779768528207: + + # Less than operation + lw $t0, 100($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # If internal_108 then goto foreach_min_body_8779768528207 + lw $t0, 84($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8779768528207 + + # Jumping to foreach_min_end_8779768528207 + j foreach_min_end_8779768528207 + + foreach_min_body_8779768528207: + + + # Less than operation + lw $t0, 92($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 88($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 84($sp) # $t0 = internal_108 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_108 then goto update_min_8779768528207 + lw $t0, 84($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8779768528207 + + # Jumping to foreach_min_end_8779768528207 + j foreach_min_end_8779768528207 + + update_min_8779768528207: + + lw $t0, 92($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 88($sp) + j end_assign + not_is_Bool_or_Int: + # internal_107 = internal_106 + lw $t0, 92($sp) + sw $t0, 88($sp) + end_assign: + + lw $t0, 100($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 96($sp) + j end_assign + not_is_Bool_or_Int: + # internal_105 = internal_104 + lw $t0, 100($sp) + sw $t0, 96($sp) + end_assign: + + update_min_end_8779768528207: + + # Addition operation + lw $t0, 100($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_min_start_8779768528207 + j foreach_min_start_8779768528207 + + foreach_min_end_8779768528207: + + + + + + + + # Equal operation + lw $t0, 96($sp) # Save in $t0 the left operand address + lw $t1, 180($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 76($sp) # $t0 = internal_110 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_110 then goto error_branch_8779768528207 + lw $t0, 76($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8779768528207 + + + + # If internal_111 then goto branch_Razz_8779768528207 + lw $t0, 72($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Razz_8779768528207 + + + # If internal_111 then goto branch_Bar_8779768528207 + lw $t0, 72($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bar_8779768528207 + + branch_Razz_8779768528207: + + # Allocating Bar + li $v0, 9 + lw $a0, type_Bar + syscall + la $t0, type_Bar # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 60($sp) # internal_114 = address of allocated object Bar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_114 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_114 + + # Calling function function___init___at_Bar + jal function___init___at_Bar + lw $ra, 4($sp) + sw $v1, 68($sp) # internal_114 = result of function___init___at_Bar + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 60($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 68($sp) + j end_assign + not_is_Bool_or_Int: + # internal_112 = internal_114 + lw $t0, 60($sp) + sw $t0, 68($sp) + end_assign: + + # Jumping to branch_end_8779768528207 + j branch_end_8779768528207 + + branch_Bar_8779768528207: + + lw $t0, 388($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 68($sp) + j end_assign + not_is_Bool_or_Int: + # internal_112 = n + lw $t0, 388($sp) + sw $t0, 68($sp) + end_assign: + + # Jumping to branch_end_8779768528207 + j branch_end_8779768528207 + + error_branch_8779768528207: + + + branch_end_8779768528207: + + # Set attribute e of self + lw $t0, 520($sp) # $t0 = self + lw $t1, 68($sp) # $t1 = internal_112 + sw $t1, 28($t0) # self.e = internal_112 + + # Get attribute a of self + lw $t0, 520($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'a' from the instance + sw $t1, 52($sp) # internal_116 = a + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_116 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_116 + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 56($sp) # internal_117 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute g of self + lw $t0, 520($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'g' from the instance + sw $t1, 44($sp) # internal_118 = g + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_118 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_118 + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 48($sp) # internal_119 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_117 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing internal_117 + + # Argument internal_119 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_119 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_120 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute e of self + lw $t0, 520($sp) # Get the address of self + lw $t1, 28($t0) # Get the attribute 'e' from the instance + sw $t1, 32($sp) # internal_121 = e + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_121 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_121 + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 36($sp) # internal_122 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_120 + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing internal_120 + + # Argument internal_122 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_122 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_123 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 528($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_124 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_123 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_123 + + # Argument internal_124 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_124 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_125 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 528($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_printh_at_Bazz + jal function_printh_at_Bazz + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_126 = result of function_printh_at_Bazz + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_125 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_125 + + # Argument internal_126 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_126 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_127 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute f of self + lw $t0, 520($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_127 + sw $t1, 32($t0) # self.f = internal_127 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 528($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_128 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute c of self + lw $t0, 520($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_128 + sw $t1, 36($t0) # self.c = internal_128 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 528($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_printh_at_Bazz + jal function_printh_at_Bazz + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_129 = result of function_printh_at_Bazz + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute d of self + lw $t0, 520($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_129 + sw $t1, 40($t0) # self.d = internal_129 + + # Loading return value in $v1 + lw $v1, 520($sp) + + # Freeing space for local variables + addi $sp, $sp, 520 + + jr $ra + + function___init___at_Razz: + # Function parameters + # $ra = 516($sp) + # self = 512($sp) + + # Reserving space for local variables + addi $sp, $sp, -512 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 508($sp) # internal_0 = address of allocated object Int + + # Set attribute h of self + lw $t0, 512($sp) # $t0 = self + lw $t1, 508($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.h = internal_0 + + + + + + + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 484($sp) # internal_6 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 492($sp) # internal_4 = address of allocated object Int + + + + + # internal_2 = typeof self that is the first word of the object + lw $t0, 512($sp) + lw $t1, 0($t0) + sw $t1, 500($sp) + + lw $t0, 500($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 496($sp) + j end_assign + not_is_Bool_or_Int: + # internal_3 = internal_2 + lw $t0, 500($sp) + sw $t0, 496($sp) + end_assign: + + lw $t0, 484($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 504($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_6 + lw $t0, 484($sp) + sw $t0, 504($sp) + end_assign: + + while_start_8779768528306: + + # Equal operation + lw $t0, 496($sp) # Save in $t0 the left operand address + # If internal_4 then goto while_end_8779768528306 + lw $t0, 492($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8779768528306 + + # Addition operation + lw $t0, 504($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # internal_3 = ancestor of internal_3 that is the first word of the object + lw $t0, 496($sp) + lw $t1, 4($t0) + sw $t1, 496($sp) + + # Jumping to while_start_8779768528306 + j while_start_8779768528306 + + while_end_8779768528306: + + + + + lw $t0, 500($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 496($sp) + j end_assign + not_is_Bool_or_Int: + # internal_3 = internal_2 + lw $t0, 500($sp) + sw $t0, 496($sp) + end_assign: + + + foreach_start_8779768528306: + + # Less than operation + lw $t0, 476($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 504($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 472($sp) # $t0 = internal_9 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_9 then goto foreach_body_8779768528306 + lw $t0, 472($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8779768528306 + + # Jumping to foreach_end_8779768528306 + j foreach_end_8779768528306 + + foreach_body_8779768528306: + + + # internal_3 = ancestor of internal_3 that is the first word of the object + lw $t0, 496($sp) + lw $t1, 4($t0) + sw $t1, 496($sp) + + # Addition operation + lw $t0, 476($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_start_8779768528306 + j foreach_start_8779768528306 + + foreach_end_8779768528306: + + + + + + + # internal_12 = direction of Bazz + la $t0, type_Bazz + sw $t0, 460($sp) + + + + # internal_13 = direction of Razz + la $t0, type_Razz + sw $t0, 456($sp) + + + + # internal_14 = direction of Foo + la $t0, type_Foo + sw $t0, 452($sp) + + + + # internal_15 = direction of Bar + la $t0, type_Bar + sw $t0, 448($sp) + + + + + + + foreach_type_start_8779768528306: + + # Less than operation + lw $t0, 444($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # If internal_17 then goto foreach_type_body_8779768528306 + lw $t0, 440($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8779768528306 + + # Jumping to foreach_type_end_8779768528306 + j foreach_type_end_8779768528306 + + foreach_type_body_8779768528306: + + + + + + foreach_ancestor_start_8779768528306: + + # Less than operation + lw $t0, 432($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 504($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 428($sp) # $t0 = internal_20 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_20 then goto foreach_ancestor_body_8779768528306 + lw $t0, 428($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8779768528306 + + # Jumping to foreach_ancestor_end_8779768528306 + j foreach_ancestor_end_8779768528306 + + foreach_ancestor_body_8779768528306: + + + # Equal operation + lw $t0, 436($sp) # Save in $t0 the left operand address + lw $t1, 424($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 420($sp) # $t0 = internal_22 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_22 then goto foreach_ancestor_end_8779768528306 + lw $t0, 420($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8779768528306 + + # Addition operation + lw $t0, 432($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_ancestor_start_8779768528306 + j foreach_ancestor_start_8779768528306 + + foreach_ancestor_end_8779768528306: + + + + + + # Addition operation + lw $t0, 444($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_type_start_8779768528306 + j foreach_type_start_8779768528306 + + foreach_type_end_8779768528306: + + + + + + + + lw $t0, 504($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 404($sp) + j end_assign + not_is_Bool_or_Int: + # internal_26 = internal_1 + lw $t0, 504($sp) + sw $t0, 404($sp) + end_assign: + + foreach_min_start_8779768528306: + + # Less than operation + lw $t0, 416($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # If internal_27 then goto foreach_min_body_8779768528306 + lw $t0, 400($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8779768528306 + + # Jumping to foreach_min_end_8779768528306 + j foreach_min_end_8779768528306 + + foreach_min_body_8779768528306: + + + # Less than operation + lw $t0, 408($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 404($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 400($sp) # $t0 = internal_27 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_27 then goto update_min_8779768528306 + lw $t0, 400($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8779768528306 + + # Jumping to foreach_min_end_8779768528306 + j foreach_min_end_8779768528306 + + update_min_8779768528306: + + lw $t0, 408($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 404($sp) + j end_assign + not_is_Bool_or_Int: + # internal_26 = internal_25 + lw $t0, 408($sp) + sw $t0, 404($sp) + end_assign: + + lw $t0, 416($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 412($sp) + j end_assign + not_is_Bool_or_Int: + # internal_24 = internal_23 + lw $t0, 416($sp) + sw $t0, 412($sp) + end_assign: + + update_min_end_8779768528306: + + # Addition operation + lw $t0, 416($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_min_start_8779768528306 + j foreach_min_start_8779768528306 + + foreach_min_end_8779768528306: + + + + + + + + + + # Equal operation + lw $t0, 412($sp) # Save in $t0 the left operand address + lw $t1, 504($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 392($sp) # $t0 = internal_29 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_29 then goto error_branch_8779768528306 + lw $t0, 392($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8779768528306 + + + + # If internal_30 then goto branch_Bazz_8779768528306 + lw $t0, 388($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bazz_8779768528306 + + + # If internal_30 then goto branch_Razz_8779768528306 + lw $t0, 388($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Razz_8779768528306 + + + # If internal_30 then goto branch_Foo_8779768528306 + lw $t0, 388($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Foo_8779768528306 + + + # If internal_30 then goto branch_Bar_8779768528306 + lw $t0, 388($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bar_8779768528306 + + branch_Bazz_8779768528306: + + # Allocating Foo + li $v0, 9 + lw $a0, type_Foo + syscall + la $t0, type_Foo # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 376($sp) # internal_33 = address of allocated object Foo + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_33 + lw $t0, 384($sp) + sw $t0, 0($sp) # Storing internal_33 + + # Calling function function___init___at_Foo + jal function___init___at_Foo + lw $ra, 4($sp) + sw $v1, 384($sp) # internal_33 = result of function___init___at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 376($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 384($sp) + j end_assign + not_is_Bool_or_Int: + # internal_31 = internal_33 + lw $t0, 376($sp) + sw $t0, 384($sp) + end_assign: + + # Jumping to branch_end_8779768528306 + j branch_end_8779768528306 + + branch_Razz_8779768528306: + + # Allocating Bar + li $v0, 9 + lw $a0, type_Bar + syscall + la $t0, type_Bar # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 368($sp) # internal_35 = address of allocated object Bar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_35 + lw $t0, 376($sp) + sw $t0, 0($sp) # Storing internal_35 + + # Calling function function___init___at_Bar + jal function___init___at_Bar + lw $ra, 4($sp) + sw $v1, 376($sp) # internal_35 = result of function___init___at_Bar + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 368($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 384($sp) + j end_assign + not_is_Bool_or_Int: + # internal_31 = internal_35 + lw $t0, 368($sp) + sw $t0, 384($sp) + end_assign: + + # Jumping to branch_end_8779768528306 + j branch_end_8779768528306 + + branch_Foo_8779768528306: + + # Allocating Razz + li $v0, 9 + lw $a0, type_Razz + syscall + la $t0, type_Razz # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 360($sp) # internal_37 = address of allocated object Razz + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_37 + lw $t0, 368($sp) + sw $t0, 0($sp) # Storing internal_37 + + # Calling function function___init___at_Razz + jal function___init___at_Razz + lw $ra, 4($sp) + sw $v1, 368($sp) # internal_37 = result of function___init___at_Razz + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 360($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 384($sp) + j end_assign + not_is_Bool_or_Int: + # internal_31 = internal_37 + lw $t0, 360($sp) + sw $t0, 384($sp) + end_assign: + + # Jumping to branch_end_8779768528306 + j branch_end_8779768528306 + + branch_Bar_8779768528306: + + lw $t0, 380($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 384($sp) + j end_assign + not_is_Bool_or_Int: + # internal_31 = n + lw $t0, 380($sp) + sw $t0, 384($sp) + end_assign: + + # Jumping to branch_end_8779768528306 + j branch_end_8779768528306 + + error_branch_8779768528306: + + + branch_end_8779768528306: + + # Set attribute g of self + lw $t0, 512($sp) # $t0 = self + lw $t1, 384($sp) # $t1 = internal_31 + sw $t1, 12($t0) # self.g = internal_31 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 520($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_printh_at_Bazz + jal function_printh_at_Bazz + lw $ra, 4($sp) + sw $v1, 360($sp) # internal_39 = result of function_printh_at_Bazz + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute i of self + lw $t0, 512($sp) # $t0 = self + lw $t1, 352($sp) # $t1 = internal_39 + sw $t1, 16($t0) # self.i = internal_39 + + + + + + + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 328($sp) # internal_45 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 336($sp) # internal_43 = address of allocated object Int + + + + + # internal_41 = typeof self that is the first word of the object + lw $t0, 512($sp) + lw $t1, 0($t0) + sw $t1, 344($sp) + + lw $t0, 344($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 340($sp) + j end_assign + not_is_Bool_or_Int: + # internal_42 = internal_41 + lw $t0, 344($sp) + sw $t0, 340($sp) + end_assign: + + lw $t0, 328($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 348($sp) + j end_assign + not_is_Bool_or_Int: + # internal_40 = internal_45 + lw $t0, 328($sp) + sw $t0, 348($sp) + end_assign: + + while_start_8779768552376: + + # Equal operation + lw $t0, 340($sp) # Save in $t0 the left operand address + # If internal_43 then goto while_end_8779768552376 + lw $t0, 336($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8779768552376 + + # Addition operation + lw $t0, 348($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # internal_42 = ancestor of internal_42 that is the first word of the object + lw $t0, 340($sp) + lw $t1, 4($t0) + sw $t1, 340($sp) + + # Jumping to while_start_8779768552376 + j while_start_8779768552376 + + while_end_8779768552376: + + + + + lw $t0, 344($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 340($sp) + j end_assign + not_is_Bool_or_Int: + # internal_42 = internal_41 + lw $t0, 344($sp) + sw $t0, 340($sp) + end_assign: + + + foreach_start_8779768552376: + + # Less than operation + lw $t0, 320($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 348($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 316($sp) # $t0 = internal_48 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_48 then goto foreach_body_8779768552376 + lw $t0, 316($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8779768552376 + + # Jumping to foreach_end_8779768552376 + j foreach_end_8779768552376 + + foreach_body_8779768552376: + + + # internal_42 = ancestor of internal_42 that is the first word of the object + lw $t0, 340($sp) + lw $t1, 4($t0) + sw $t1, 340($sp) + + # Addition operation + lw $t0, 320($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_start_8779768552376 + j foreach_start_8779768552376 + + foreach_end_8779768552376: + + + + + + + # internal_51 = direction of Razz + la $t0, type_Razz + sw $t0, 304($sp) + + + + # internal_52 = direction of Foo + la $t0, type_Foo + sw $t0, 300($sp) + + + + # internal_53 = direction of Bar + la $t0, type_Bar + sw $t0, 296($sp) + + + + + + + foreach_type_start_8779768552376: + + # Less than operation + lw $t0, 292($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # If internal_55 then goto foreach_type_body_8779768552376 + lw $t0, 288($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8779768552376 + + # Jumping to foreach_type_end_8779768552376 + j foreach_type_end_8779768552376 + + foreach_type_body_8779768552376: + + + + + + foreach_ancestor_start_8779768552376: + + # Less than operation + lw $t0, 280($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 348($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 276($sp) # $t0 = internal_58 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_58 then goto foreach_ancestor_body_8779768552376 + lw $t0, 276($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8779768552376 + + # Jumping to foreach_ancestor_end_8779768552376 + j foreach_ancestor_end_8779768552376 + + foreach_ancestor_body_8779768552376: + + + # Equal operation + lw $t0, 284($sp) # Save in $t0 the left operand address + lw $t1, 272($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 268($sp) # $t0 = internal_60 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_60 then goto foreach_ancestor_end_8779768552376 + lw $t0, 268($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8779768552376 + + # Addition operation + lw $t0, 280($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_ancestor_start_8779768552376 + j foreach_ancestor_start_8779768552376 + + foreach_ancestor_end_8779768552376: + + + + + + # Addition operation + lw $t0, 292($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_type_start_8779768552376 + j foreach_type_start_8779768552376 + + foreach_type_end_8779768552376: + + + + + + + + lw $t0, 348($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 252($sp) + j end_assign + not_is_Bool_or_Int: + # internal_64 = internal_40 + lw $t0, 348($sp) + sw $t0, 252($sp) + end_assign: + + foreach_min_start_8779768552376: + + # Less than operation + lw $t0, 264($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # If internal_65 then goto foreach_min_body_8779768552376 + lw $t0, 248($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8779768552376 + + # Jumping to foreach_min_end_8779768552376 + j foreach_min_end_8779768552376 + + foreach_min_body_8779768552376: + + + # Less than operation + lw $t0, 256($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 252($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 248($sp) # $t0 = internal_65 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_65 then goto update_min_8779768552376 + lw $t0, 248($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8779768552376 + + # Jumping to foreach_min_end_8779768552376 + j foreach_min_end_8779768552376 + + update_min_8779768552376: + + lw $t0, 256($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 252($sp) + j end_assign + not_is_Bool_or_Int: + # internal_64 = internal_63 + lw $t0, 256($sp) + sw $t0, 252($sp) + end_assign: + + lw $t0, 264($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 260($sp) + j end_assign + not_is_Bool_or_Int: + # internal_62 = internal_61 + lw $t0, 264($sp) + sw $t0, 260($sp) + end_assign: + + update_min_end_8779768552376: + + # Addition operation + lw $t0, 264($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_min_start_8779768552376 + j foreach_min_start_8779768552376 + + foreach_min_end_8779768552376: + + + + + + + + + # Equal operation + lw $t0, 260($sp) # Save in $t0 the left operand address + lw $t1, 348($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 240($sp) # $t0 = internal_67 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_67 then goto error_branch_8779768552376 + lw $t0, 240($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8779768552376 + + + + # If internal_68 then goto branch_Razz_8779768552376 + lw $t0, 236($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Razz_8779768552376 + + + # If internal_68 then goto branch_Foo_8779768552376 + lw $t0, 236($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Foo_8779768552376 + + + # If internal_68 then goto branch_Bar_8779768552376 + lw $t0, 236($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bar_8779768552376 + + branch_Razz_8779768552376: + + # Allocating Bar + li $v0, 9 + lw $a0, type_Bar + syscall + la $t0, type_Bar # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 224($sp) # internal_71 = address of allocated object Bar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_71 + lw $t0, 232($sp) + sw $t0, 0($sp) # Storing internal_71 + + # Calling function function___init___at_Bar + jal function___init___at_Bar + lw $ra, 4($sp) + sw $v1, 232($sp) # internal_71 = result of function___init___at_Bar + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 224($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 232($sp) + j end_assign + not_is_Bool_or_Int: + # internal_69 = internal_71 + lw $t0, 224($sp) + sw $t0, 232($sp) + end_assign: + + # Jumping to branch_end_8779768552376 + j branch_end_8779768552376 + + branch_Foo_8779768552376: + + # Allocating Razz + li $v0, 9 + lw $a0, type_Razz + syscall + la $t0, type_Razz # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 216($sp) # internal_73 = address of allocated object Razz + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_73 + lw $t0, 224($sp) + sw $t0, 0($sp) # Storing internal_73 + + # Calling function function___init___at_Razz + jal function___init___at_Razz + lw $ra, 4($sp) + sw $v1, 224($sp) # internal_73 = result of function___init___at_Razz + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 216($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 232($sp) + j end_assign + not_is_Bool_or_Int: + # internal_69 = internal_73 + lw $t0, 216($sp) + sw $t0, 232($sp) + end_assign: + + # Jumping to branch_end_8779768552376 + j branch_end_8779768552376 + + branch_Bar_8779768552376: + + lw $t0, 380($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 232($sp) + j end_assign + not_is_Bool_or_Int: + # internal_69 = n + lw $t0, 380($sp) + sw $t0, 232($sp) + end_assign: + + # Jumping to branch_end_8779768552376 + j branch_end_8779768552376 + + error_branch_8779768552376: + + + branch_end_8779768552376: + + # Set attribute a of self + lw $t0, 512($sp) # $t0 = self + lw $t1, 232($sp) # $t1 = internal_69 + sw $t1, 20($t0) # self.a = internal_69 + + # Get attribute a of self + lw $t0, 512($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'a' from the instance + sw $t1, 208($sp) # internal_75 = a + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_75 + lw $t0, 216($sp) + sw $t0, 0($sp) # Storing internal_75 + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 212($sp) # internal_76 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute g of self + lw $t0, 512($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'g' from the instance + sw $t1, 200($sp) # internal_77 = g + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_77 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_77 + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 204($sp) # internal_78 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_76 + lw $t0, 216($sp) + sw $t0, 4($sp) # Storing internal_76 + + # Argument internal_78 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_78 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 204($sp) # internal_79 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 520($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 196($sp) # internal_80 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_79 + lw $t0, 204($sp) + sw $t0, 4($sp) # Storing internal_79 + + # Argument internal_80 + lw $t0, 200($sp) + sw $t0, 0($sp) # Storing internal_80 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 196($sp) # internal_81 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 520($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_printh_at_Bazz + jal function_printh_at_Bazz + lw $ra, 4($sp) + sw $v1, 188($sp) # internal_82 = result of function_printh_at_Bazz + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_81 + lw $t0, 196($sp) + sw $t0, 4($sp) # Storing internal_81 + + # Argument internal_82 + lw $t0, 192($sp) + sw $t0, 0($sp) # Storing internal_82 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 188($sp) # internal_83 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute b of self + lw $t0, 512($sp) # $t0 = self + lw $t1, 176($sp) # $t1 = internal_83 + sw $t1, 24($t0) # self.b = internal_83 + + + + + + + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 152($sp) # internal_89 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_87 = address of allocated object Int + + + + + # internal_85 = typeof self that is the first word of the object + lw $t0, 512($sp) + lw $t1, 0($t0) + sw $t1, 168($sp) + + lw $t0, 168($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 164($sp) + j end_assign + not_is_Bool_or_Int: + # internal_86 = internal_85 + lw $t0, 168($sp) + sw $t0, 164($sp) + end_assign: + + lw $t0, 152($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 172($sp) + j end_assign + not_is_Bool_or_Int: + # internal_84 = internal_89 + lw $t0, 152($sp) + sw $t0, 172($sp) + end_assign: + + while_start_8779768528207: + + # Equal operation + lw $t0, 164($sp) # Save in $t0 the left operand address + # If internal_87 then goto while_end_8779768528207 + lw $t0, 160($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8779768528207 + + # Addition operation + lw $t0, 172($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # internal_86 = ancestor of internal_86 that is the first word of the object + lw $t0, 164($sp) + lw $t1, 4($t0) + sw $t1, 164($sp) + + # Jumping to while_start_8779768528207 + j while_start_8779768528207 + + while_end_8779768528207: + + + + + lw $t0, 168($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 164($sp) + j end_assign + not_is_Bool_or_Int: + # internal_86 = internal_85 + lw $t0, 168($sp) + sw $t0, 164($sp) + end_assign: + + + foreach_start_8779768528207: + + # Less than operation + lw $t0, 144($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 172($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 140($sp) # $t0 = internal_92 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_92 then goto foreach_body_8779768528207 + lw $t0, 140($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8779768528207 + + # Jumping to foreach_end_8779768528207 + j foreach_end_8779768528207 + + foreach_body_8779768528207: + + + # internal_86 = ancestor of internal_86 that is the first word of the object + lw $t0, 164($sp) + lw $t1, 4($t0) + sw $t1, 164($sp) + + # Addition operation + lw $t0, 144($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_start_8779768528207 + j foreach_start_8779768528207 + + foreach_end_8779768528207: + + + + + + + # internal_95 = direction of Razz + la $t0, type_Razz + sw $t0, 128($sp) + + + + # internal_96 = direction of Bar + la $t0, type_Bar + sw $t0, 124($sp) + + + + + + + foreach_type_start_8779768528207: + + # Less than operation + lw $t0, 120($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # If internal_98 then goto foreach_type_body_8779768528207 + lw $t0, 116($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8779768528207 + + # Jumping to foreach_type_end_8779768528207 + j foreach_type_end_8779768528207 + + foreach_type_body_8779768528207: + + + + + + foreach_ancestor_start_8779768528207: + + # Less than operation + lw $t0, 108($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 172($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 104($sp) # $t0 = internal_101 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_101 then goto foreach_ancestor_body_8779768528207 + lw $t0, 104($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8779768528207 + + # Jumping to foreach_ancestor_end_8779768528207 + j foreach_ancestor_end_8779768528207 + + foreach_ancestor_body_8779768528207: + + + # Equal operation + lw $t0, 112($sp) # Save in $t0 the left operand address + lw $t1, 100($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 96($sp) # $t0 = internal_103 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_103 then goto foreach_ancestor_end_8779768528207 + lw $t0, 96($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8779768528207 + + # Addition operation + lw $t0, 108($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_ancestor_start_8779768528207 + j foreach_ancestor_start_8779768528207 + + foreach_ancestor_end_8779768528207: + + + + + + # Addition operation + lw $t0, 120($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_type_start_8779768528207 + j foreach_type_start_8779768528207 + + foreach_type_end_8779768528207: + + + + + + + + lw $t0, 172($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 80($sp) + j end_assign + not_is_Bool_or_Int: + # internal_107 = internal_84 + lw $t0, 172($sp) + sw $t0, 80($sp) + end_assign: + + foreach_min_start_8779768528207: + + # Less than operation + lw $t0, 92($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # If internal_108 then goto foreach_min_body_8779768528207 + lw $t0, 76($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8779768528207 + + # Jumping to foreach_min_end_8779768528207 + j foreach_min_end_8779768528207 + + foreach_min_body_8779768528207: + + + # Less than operation + lw $t0, 84($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 80($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 76($sp) # $t0 = internal_108 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_108 then goto update_min_8779768528207 + lw $t0, 76($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8779768528207 + + # Jumping to foreach_min_end_8779768528207 + j foreach_min_end_8779768528207 + + update_min_8779768528207: + + lw $t0, 84($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 80($sp) + j end_assign + not_is_Bool_or_Int: + # internal_107 = internal_106 + lw $t0, 84($sp) + sw $t0, 80($sp) + end_assign: + + lw $t0, 92($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 88($sp) + j end_assign + not_is_Bool_or_Int: + # internal_105 = internal_104 + lw $t0, 92($sp) + sw $t0, 88($sp) + end_assign: + + update_min_end_8779768528207: + + # Addition operation + lw $t0, 92($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_min_start_8779768528207 + j foreach_min_start_8779768528207 + + foreach_min_end_8779768528207: + + + + + + + + # Equal operation + lw $t0, 88($sp) # Save in $t0 the left operand address + lw $t1, 172($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 68($sp) # $t0 = internal_110 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_110 then goto error_branch_8779768528207 + lw $t0, 68($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8779768528207 + + + + # If internal_111 then goto branch_Razz_8779768528207 + lw $t0, 64($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Razz_8779768528207 + + + # If internal_111 then goto branch_Bar_8779768528207 + lw $t0, 64($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bar_8779768528207 + + branch_Razz_8779768528207: + + # Allocating Bar + li $v0, 9 + lw $a0, type_Bar + syscall + la $t0, type_Bar # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 52($sp) # internal_114 = address of allocated object Bar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_114 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_114 + + # Calling function function___init___at_Bar + jal function___init___at_Bar + lw $ra, 4($sp) + sw $v1, 60($sp) # internal_114 = result of function___init___at_Bar + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 52($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # internal_112 = internal_114 + lw $t0, 52($sp) + sw $t0, 60($sp) + end_assign: + + # Jumping to branch_end_8779768528207 + j branch_end_8779768528207 + + branch_Bar_8779768528207: + + lw $t0, 380($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # internal_112 = n + lw $t0, 380($sp) + sw $t0, 60($sp) + end_assign: + + # Jumping to branch_end_8779768528207 + j branch_end_8779768528207 + + error_branch_8779768528207: + + + branch_end_8779768528207: + + # Set attribute e of self + lw $t0, 512($sp) # $t0 = self + lw $t1, 60($sp) # $t1 = internal_112 + sw $t1, 28($t0) # self.e = internal_112 + + # Get attribute a of self + lw $t0, 512($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'a' from the instance + sw $t1, 44($sp) # internal_116 = a + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_116 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_116 + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 48($sp) # internal_117 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute g of self + lw $t0, 512($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'g' from the instance + sw $t1, 36($sp) # internal_118 = g + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_118 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_118 + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 40($sp) # internal_119 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_117 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_117 + + # Argument internal_119 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_119 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_120 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute e of self + lw $t0, 512($sp) # Get the address of self + lw $t1, 28($t0) # Get the attribute 'e' from the instance + sw $t1, 24($sp) # internal_121 = e + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_121 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_121 + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_122 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_120 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_120 + + # Argument internal_122 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_122 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_123 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 520($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_124 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_123 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_123 + + # Argument internal_124 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_124 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_125 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 520($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_printh_at_Bazz + jal function_printh_at_Bazz + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_126 = result of function_printh_at_Bazz + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_125 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_125 + + # Argument internal_126 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_126 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_127 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute f of self + lw $t0, 512($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_127 + sw $t1, 32($t0) # self.f = internal_127 + + # Loading return value in $v1 + lw $v1, 512($sp) + + # Freeing space for local variables + addi $sp, $sp, 512 + + jr $ra + + function___init___at_Bazz: + # Function parameters + # $ra = 164($sp) + # self = 160($sp) + + # Reserving space for local variables + addi $sp, $sp, -160 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 156($sp) # internal_0 = address of allocated object Int + + # Set attribute h of self + lw $t0, 160($sp) # $t0 = self + lw $t1, 156($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.h = internal_0 + + + + + + + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 132($sp) # internal_6 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 140($sp) # internal_4 = address of allocated object Int + + + + + # internal_2 = typeof self that is the first word of the object + lw $t0, 160($sp) + lw $t1, 0($t0) + sw $t1, 148($sp) + + lw $t0, 148($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 144($sp) + j end_assign + not_is_Bool_or_Int: + # internal_3 = internal_2 + lw $t0, 148($sp) + sw $t0, 144($sp) + end_assign: + + lw $t0, 132($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 152($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_6 + lw $t0, 132($sp) + sw $t0, 152($sp) + end_assign: + + while_start_8779768528306: + + # Equal operation + lw $t0, 144($sp) # Save in $t0 the left operand address + # If internal_4 then goto while_end_8779768528306 + lw $t0, 140($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8779768528306 + + # Addition operation + lw $t0, 152($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # internal_3 = ancestor of internal_3 that is the first word of the object + lw $t0, 144($sp) + lw $t1, 4($t0) + sw $t1, 144($sp) + + # Jumping to while_start_8779768528306 + j while_start_8779768528306 + + while_end_8779768528306: + + + + + lw $t0, 148($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 144($sp) + j end_assign + not_is_Bool_or_Int: + # internal_3 = internal_2 + lw $t0, 148($sp) + sw $t0, 144($sp) + end_assign: + + + foreach_start_8779768528306: + + # Less than operation + lw $t0, 124($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 152($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 120($sp) # $t0 = internal_9 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_9 then goto foreach_body_8779768528306 + lw $t0, 120($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8779768528306 + + # Jumping to foreach_end_8779768528306 + j foreach_end_8779768528306 + + foreach_body_8779768528306: + + + # internal_3 = ancestor of internal_3 that is the first word of the object + lw $t0, 144($sp) + lw $t1, 4($t0) + sw $t1, 144($sp) + + # Addition operation + lw $t0, 124($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_start_8779768528306 + j foreach_start_8779768528306 + + foreach_end_8779768528306: + + + + + + + # internal_12 = direction of Bazz + la $t0, type_Bazz + sw $t0, 108($sp) + + + + # internal_13 = direction of Razz + la $t0, type_Razz + sw $t0, 104($sp) + + + + # internal_14 = direction of Foo + la $t0, type_Foo + sw $t0, 100($sp) + + + + # internal_15 = direction of Bar + la $t0, type_Bar + sw $t0, 96($sp) + + + + + + + foreach_type_start_8779768528306: + + # Less than operation + lw $t0, 92($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # If internal_17 then goto foreach_type_body_8779768528306 + lw $t0, 88($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8779768528306 + + # Jumping to foreach_type_end_8779768528306 + j foreach_type_end_8779768528306 + + foreach_type_body_8779768528306: + + + + + + foreach_ancestor_start_8779768528306: + + # Less than operation + lw $t0, 80($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 152($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 76($sp) # $t0 = internal_20 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_20 then goto foreach_ancestor_body_8779768528306 + lw $t0, 76($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8779768528306 + + # Jumping to foreach_ancestor_end_8779768528306 + j foreach_ancestor_end_8779768528306 + + foreach_ancestor_body_8779768528306: + + + # Equal operation + lw $t0, 84($sp) # Save in $t0 the left operand address + lw $t1, 72($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 68($sp) # $t0 = internal_22 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_22 then goto foreach_ancestor_end_8779768528306 + lw $t0, 68($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8779768528306 + + # Addition operation + lw $t0, 80($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_ancestor_start_8779768528306 + j foreach_ancestor_start_8779768528306 + + foreach_ancestor_end_8779768528306: + + + + + + # Addition operation + lw $t0, 92($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_type_start_8779768528306 + j foreach_type_start_8779768528306 + + foreach_type_end_8779768528306: + + + + + + + + lw $t0, 152($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # internal_26 = internal_1 + lw $t0, 152($sp) + sw $t0, 52($sp) + end_assign: + + foreach_min_start_8779768528306: + + # Less than operation + lw $t0, 64($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # If internal_27 then goto foreach_min_body_8779768528306 + lw $t0, 48($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8779768528306 + + # Jumping to foreach_min_end_8779768528306 + j foreach_min_end_8779768528306 + + foreach_min_body_8779768528306: + + + # Less than operation + lw $t0, 56($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 52($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 48($sp) # $t0 = internal_27 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_27 then goto update_min_8779768528306 + lw $t0, 48($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8779768528306 + + # Jumping to foreach_min_end_8779768528306 + j foreach_min_end_8779768528306 + + update_min_8779768528306: + + lw $t0, 56($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # internal_26 = internal_25 + lw $t0, 56($sp) + sw $t0, 52($sp) + end_assign: + + lw $t0, 64($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # internal_24 = internal_23 + lw $t0, 64($sp) + sw $t0, 60($sp) + end_assign: + + update_min_end_8779768528306: + + # Addition operation + lw $t0, 64($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + # Jumping to foreach_min_start_8779768528306 + j foreach_min_start_8779768528306 + + foreach_min_end_8779768528306: + + + + + + + + + + # Equal operation + lw $t0, 60($sp) # Save in $t0 the left operand address + lw $t1, 152($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 40($sp) # $t0 = internal_29 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # If internal_29 then goto error_branch_8779768528306 + lw $t0, 40($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8779768528306 + + + + # If internal_30 then goto branch_Bazz_8779768528306 + lw $t0, 36($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bazz_8779768528306 + + + # If internal_30 then goto branch_Razz_8779768528306 + lw $t0, 36($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Razz_8779768528306 + + + # If internal_30 then goto branch_Foo_8779768528306 + lw $t0, 36($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Foo_8779768528306 + + + # If internal_30 then goto branch_Bar_8779768528306 + lw $t0, 36($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bar_8779768528306 + + branch_Bazz_8779768528306: + + # Allocating Foo + li $v0, 9 + lw $a0, type_Foo + syscall + la $t0, type_Foo # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 24($sp) # internal_33 = address of allocated object Foo + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_33 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_33 + + # Calling function function___init___at_Foo + jal function___init___at_Foo + lw $ra, 4($sp) + sw $v1, 32($sp) # internal_33 = result of function___init___at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 24($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 32($sp) + j end_assign + not_is_Bool_or_Int: + # internal_31 = internal_33 + lw $t0, 24($sp) + sw $t0, 32($sp) + end_assign: + + # Jumping to branch_end_8779768528306 + j branch_end_8779768528306 + + branch_Razz_8779768528306: + + # Allocating Bar + li $v0, 9 + lw $a0, type_Bar + syscall + la $t0, type_Bar # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 16($sp) # internal_35 = address of allocated object Bar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_35 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_35 + + # Calling function function___init___at_Bar + jal function___init___at_Bar + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_35 = result of function___init___at_Bar + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 32($sp) + j end_assign + not_is_Bool_or_Int: + # internal_31 = internal_35 + lw $t0, 16($sp) + sw $t0, 32($sp) + end_assign: + + # Jumping to branch_end_8779768528306 + j branch_end_8779768528306 + + branch_Foo_8779768528306: + + # Allocating Razz + li $v0, 9 + lw $a0, type_Razz + syscall + la $t0, type_Razz # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 8($sp) # internal_37 = address of allocated object Razz + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_37 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_37 + + # Calling function function___init___at_Razz + jal function___init___at_Razz + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_37 = result of function___init___at_Razz + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 32($sp) + j end_assign + not_is_Bool_or_Int: + # internal_31 = internal_37 + lw $t0, 8($sp) + sw $t0, 32($sp) + end_assign: + + # Jumping to branch_end_8779768528306 + j branch_end_8779768528306 + + branch_Bar_8779768528306: + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 32($sp) + j end_assign + not_is_Bool_or_Int: + # internal_31 = n + lw $t0, 28($sp) + sw $t0, 32($sp) + end_assign: + + # Jumping to branch_end_8779768528306 + j branch_end_8779768528306 + + error_branch_8779768528306: + + + branch_end_8779768528306: + + # Set attribute g of self + lw $t0, 160($sp) # $t0 = self + lw $t1, 32($sp) # $t1 = internal_31 + sw $t1, 12($t0) # self.g = internal_31 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 168($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_printh_at_Bazz + jal function_printh_at_Bazz + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_39 = result of function_printh_at_Bazz + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute i of self + lw $t0, 160($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_39 + sw $t1, 16($t0) # self.i = internal_39 + + # Loading return value in $v1 + lw $v1, 160($sp) + + # Freeing space for local variables + addi $sp, $sp, 160 + + jr $ra + + function_printh_at_Bazz: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + # Get attribute h of self + lw $t0, 12($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'h' from the instance + sw $t1, 8($sp) # internal_0 = h + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_out_int_at_IO + jal function_out_int_at_IO + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_1 = result of function_out_int_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_2 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + function_doh_at_Bazz: + # Function parameters + # $ra = 24($sp) + # self = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # Get attribute h of self + lw $t0, 20($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'h' from the instance + sw $t1, 12($sp) # internal_1 = h + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 16($sp) + j end_assign + not_is_Bool_or_Int: + # i = internal_1 + lw $t0, 12($sp) + sw $t0, 16($sp) + end_assign: + + # Get attribute h of self + lw $t0, 20($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'h' from the instance + sw $t1, 8($sp) # internal_2 = h + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_4 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute h of self + lw $t0, 20($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_4 + sw $t1, 8($t0) # self.h = internal_4 + + # Loading return value in $v1 + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 20 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Bazz + li $v0, 9 + lw $a0, type_Bazz + syscall + la $t0, type_Bazz # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_0 = address of allocated object Bazz + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Bazz + jal function___init___at_Bazz + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of function___init___at_Bazz + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute a of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 12($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.a = internal_0 + + # Allocating Foo + li $v0, 9 + lw $a0, type_Foo + syscall + la $t0, type_Foo # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 8($sp) # internal_1 = address of allocated object Foo + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_Foo + jal function___init___at_Foo + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function___init___at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute b of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_1 + sw $t1, 12($t0) # self.b = internal_1 + + # Allocating Razz + li $v0, 9 + lw $a0, type_Razz + syscall + la $t0, type_Razz # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_2 = address of allocated object Razz + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_2 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function___init___at_Razz + jal function___init___at_Razz + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_2 = result of function___init___at_Razz + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute c of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_2 + sw $t1, 16($t0) # self.c = internal_2 + + # Allocating Bar + li $v0, 9 + lw $a0, type_Bar + syscall + la $t0, type_Bar # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 0($sp) # internal_3 = address of allocated object Bar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_3 + lw $t0, 8($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function___init___at_Bar + jal function___init___at_Bar + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_3 = result of function___init___at_Bar + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute d of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_3 + sw $t1, 20($t0) # self.d = internal_3 + + # Loading return value in $v1 + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 19 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 100 + sb $t0, 8($v0) # internal_0[0] = 'd' + + addi $t0, $zero, 111 + sb $t0, 9($v0) # internal_0[1] = 'o' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_0[2] = ' ' + + addi $t0, $zero, 110 + sb $t0, 11($v0) # internal_0[3] = 'n' + + addi $t0, $zero, 111 + sb $t0, 12($v0) # internal_0[4] = 'o' + + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_0[5] = 't' + + addi $t0, $zero, 104 + sb $t0, 14($v0) # internal_0[6] = 'h' + + addi $t0, $zero, 105 + sb $t0, 15($v0) # internal_0[7] = 'i' + + addi $t0, $zero, 110 + sb $t0, 16($v0) # internal_0[8] = 'n' + + addi $t0, $zero, 103 + sb $t0, 17($v0) # internal_0[9] = 'g' + + sb $zero, 18($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_0 = "do nothing" + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_main_at_Main + jal function_main_at_Main + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/hello_world.mips b/tests/codegen/hello_world.mips new file mode 100644 index 000000000..13b7ed03d --- /dev/null +++ b/tests/codegen/hello_world.mips @@ -0,0 +1,1051 @@ +.data + type_Object: .word 8 + type_Object_inherits_from: .word 0 + type_Object_attributes: .word 0 + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO: .word 8 + type_IO_inherits_from: .word type_Object + type_IO_attributes: .word 0 + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_Int: .word 8 + type_Int_inherits_from: .word type_Object + type_Int_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_String: .word 8 + type_String_inherits_from: .word type_Object + type_String_attributes: .word 0 + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Bool: .word 8 + type_Bool_inherits_from: .word type_Object + type_Bool_attributes: .word 0 + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_Main: .word 8 + type_Main_inherits_from: .word type_IO + type_Main_attributes: .word 0 + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 40($sp) + # a = 36($sp) + # b = 32($sp) + + # Reserving space for local variables + addi $sp, $sp, -32 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_0 = address of allocated object Int + + # internal_1 = typeof a that is the first word of the object + lw $t0, 36($sp) + lw $t1, 0($t0) + sw $t1, 24($sp) + + # internal_2 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_3 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_4 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_7 = address of allocated object Int + + # internal_5 = EqualAddress(internal_1, internal_2) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_1, internal_3) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_7 = EqualAddress(internal_1, internal_4) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_6 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_7 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 36($sp) + lw $t0, 8($t0) + lw $t1, 32($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 36($sp) + lw $t1, 32($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 28($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 28($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 36($sp) # Save in $t0 the left operand address + lw $t1, 32($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 28($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 28($sp) + + # Freeing space for local variables + addi $sp, $sp, 32 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 12($t1) # $t1 = length of the name of self + lw $t3, 16($t1) # $t1 = name of self + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + move $t4, $v0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + addi $t0, $t0, 8 # Pointer to the first character of the string in self + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t1, while_copy_name_end + lb $t6, 0($t0) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t0, $t0, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $t4, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the string x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lw $t1, buffer_input($t0) # Loading the byte + beq $t1, $zero, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lw $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 5 + syscall + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + sw $t1, 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 0($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 0($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + lw $t2, 8($sp) # $t2 = start of the substring + lw $t3, 4($sp) # $t3 = length of the substring + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bge $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 23 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 14 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 72 + sb $t0, 8($v0) # internal_0[0] = 'H' + + addi $t0, $zero, 101 + sb $t0, 9($v0) # internal_0[1] = 'e' + + addi $t0, $zero, 108 + sb $t0, 10($v0) # internal_0[2] = 'l' + + addi $t0, $zero, 108 + sb $t0, 11($v0) # internal_0[3] = 'l' + + addi $t0, $zero, 111 + sb $t0, 12($v0) # internal_0[4] = 'o' + + addi $t0, $zero, 44 + sb $t0, 13($v0) # internal_0[5] = ',' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_0[6] = ' ' + + addi $t0, $zero, 87 + sb $t0, 15($v0) # internal_0[7] = 'W' + + addi $t0, $zero, 111 + sb $t0, 16($v0) # internal_0[8] = 'o' + + addi $t0, $zero, 114 + sb $t0, 17($v0) # internal_0[9] = 'r' + + addi $t0, $zero, 108 + sb $t0, 18($v0) # internal_0[10] = 'l' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 46 + sb $t0, 20($v0) # internal_0[12] = '.' + + addi $t0, $zero, 10 + sb $t0, 21($v0) # internal_0[13] = '\n' + + sb $zero, 22($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_0 = "Hello, World.\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_1 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_main_at_Main + jal function_main_at_Main + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/io.mips b/tests/codegen/io.mips new file mode 100644 index 000000000..0bcd6c0cb --- /dev/null +++ b/tests/codegen/io.mips @@ -0,0 +1,1693 @@ +.data + type_Object: .word 8 + type_Object_inherits_from: .word 0 + type_Object_attributes: .word 0 + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO: .word 8 + type_IO_inherits_from: .word type_Object + type_IO_attributes: .word 0 + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_Int: .word 8 + type_Int_inherits_from: .word type_Object + type_Int_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_String: .word 8 + type_String_inherits_from: .word type_Object + type_String_attributes: .word 0 + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Bool: .word 8 + type_Bool_inherits_from: .word type_Object + type_Bool_attributes: .word 0 + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_A: .word 12 + type_A_inherits_from: .word type_Object + type_A_attributes: .word 1 + type_A_name_size: .word 1 + type_A_name: .asciiz "A" + + type_B: .word 12 + type_B_inherits_from: .word type_A + type_B_attributes: .word 1 + type_B_name_size: .word 1 + type_B_name: .asciiz "B" + + type_C: .word 8 + type_C_inherits_from: .word type_IO + type_C_attributes: .word 0 + type_C_name_size: .word 1 + type_C_name: .asciiz "C" + + type_D: .word 8 + type_D_inherits_from: .word type_C + type_D_attributes: .word 0 + type_D_name_size: .word 1 + type_D_name: .asciiz "D" + + type_Main: .word 8 + type_Main_inherits_from: .word type_IO + type_Main_attributes: .word 0 + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 40($sp) + # a = 36($sp) + # b = 32($sp) + + # Reserving space for local variables + addi $sp, $sp, -32 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_0 = address of allocated object Int + + # internal_1 = typeof a that is the first word of the object + lw $t0, 36($sp) + lw $t1, 0($t0) + sw $t1, 24($sp) + + # internal_2 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_3 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_4 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_7 = address of allocated object Int + + # internal_5 = EqualAddress(internal_1, internal_2) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_1, internal_3) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_7 = EqualAddress(internal_1, internal_4) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_6 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_7 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 36($sp) + lw $t0, 8($t0) + lw $t1, 32($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 36($sp) + lw $t1, 32($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 28($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 28($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 36($sp) # Save in $t0 the left operand address + lw $t1, 32($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 28($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 28($sp) + + # Freeing space for local variables + addi $sp, $sp, 32 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 12($t1) # $t1 = length of the name of self + lw $t3, 16($t1) # $t1 = name of self + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + move $t4, $v0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + addi $t0, $t0, 8 # Pointer to the first character of the string in self + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t1, while_copy_name_end + lb $t6, 0($t0) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t0, $t0, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $t4, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the string x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lw $t1, buffer_input($t0) # Loading the byte + beq $t1, $zero, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lw $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 5 + syscall + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + sw $t1, 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 0($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 0($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + lw $t2, 8($sp) # $t2 = start of the substring + lw $t3, 4($sp) # $t3 = length of the substring + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bge $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_A: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating IO + li $v0, 9 + lw $a0, type_IO + syscall + la $t0, type_IO # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 0($sp) # internal_0 = address of allocated object IO + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 8($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_IO + jal function___init___at_IO + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_0 = result of function___init___at_IO + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute io of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.io = internal_0 + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_out_a_at_A: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + # Get attribute io of self + lw $t0, 12($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'io' from the instance + sw $t1, 8($sp) # internal_0 = io + + # Allocating String + li $v0, 9 + addi $a0, $zero, 24 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 15 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_1[0] = 'A' + + addi $t0, $zero, 58 + sb $t0, 9($v0) # internal_1[1] = ':' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_1[2] = ' ' + + addi $t0, $zero, 72 + sb $t0, 11($v0) # internal_1[3] = 'H' + + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_1[4] = 'e' + + addi $t0, $zero, 108 + sb $t0, 13($v0) # internal_1[5] = 'l' + + addi $t0, $zero, 108 + sb $t0, 14($v0) # internal_1[6] = 'l' + + addi $t0, $zero, 111 + sb $t0, 15($v0) # internal_1[7] = 'o' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_1[8] = ' ' + + addi $t0, $zero, 119 + sb $t0, 17($v0) # internal_1[9] = 'w' + + addi $t0, $zero, 111 + sb $t0, 18($v0) # internal_1[10] = 'o' + + addi $t0, $zero, 114 + sb $t0, 19($v0) # internal_1[11] = 'r' + + addi $t0, $zero, 108 + sb $t0, 20($v0) # internal_1[12] = 'l' + + addi $t0, $zero, 100 + sb $t0, 21($v0) # internal_1[13] = 'd' + + addi $t0, $zero, 10 + sb $t0, 22($v0) # internal_1[14] = '\n' + + sb $zero, 23($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_1 = "A: Hello world\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_2 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + function___init___at_B: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating IO + li $v0, 9 + lw $a0, type_IO + syscall + la $t0, type_IO # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 0($sp) # internal_0 = address of allocated object IO + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 8($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_IO + jal function___init___at_IO + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_0 = result of function___init___at_IO + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute io of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.io = internal_0 + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_out_b_at_B: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + # Get attribute io of self + lw $t0, 12($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'io' from the instance + sw $t1, 8($sp) # internal_0 = io + + # Allocating String + li $v0, 9 + addi $a0, $zero, 24 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 15 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 66 + sb $t0, 8($v0) # internal_1[0] = 'B' + + addi $t0, $zero, 58 + sb $t0, 9($v0) # internal_1[1] = ':' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_1[2] = ' ' + + addi $t0, $zero, 72 + sb $t0, 11($v0) # internal_1[3] = 'H' + + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_1[4] = 'e' + + addi $t0, $zero, 108 + sb $t0, 13($v0) # internal_1[5] = 'l' + + addi $t0, $zero, 108 + sb $t0, 14($v0) # internal_1[6] = 'l' + + addi $t0, $zero, 111 + sb $t0, 15($v0) # internal_1[7] = 'o' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_1[8] = ' ' + + addi $t0, $zero, 119 + sb $t0, 17($v0) # internal_1[9] = 'w' + + addi $t0, $zero, 111 + sb $t0, 18($v0) # internal_1[10] = 'o' + + addi $t0, $zero, 114 + sb $t0, 19($v0) # internal_1[11] = 'r' + + addi $t0, $zero, 108 + sb $t0, 20($v0) # internal_1[12] = 'l' + + addi $t0, $zero, 100 + sb $t0, 21($v0) # internal_1[13] = 'd' + + addi $t0, $zero, 10 + sb $t0, 22($v0) # internal_1[14] = '\n' + + sb $zero, 23($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_1 = "B: Hello world\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_2 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + function___init___at_C: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_c_at_C: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 24 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 15 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_0[0] = 'C' + + addi $t0, $zero, 58 + sb $t0, 9($v0) # internal_0[1] = ':' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_0[2] = ' ' + + addi $t0, $zero, 72 + sb $t0, 11($v0) # internal_0[3] = 'H' + + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_0[4] = 'e' + + addi $t0, $zero, 108 + sb $t0, 13($v0) # internal_0[5] = 'l' + + addi $t0, $zero, 108 + sb $t0, 14($v0) # internal_0[6] = 'l' + + addi $t0, $zero, 111 + sb $t0, 15($v0) # internal_0[7] = 'o' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_0[8] = ' ' + + addi $t0, $zero, 119 + sb $t0, 17($v0) # internal_0[9] = 'w' + + addi $t0, $zero, 111 + sb $t0, 18($v0) # internal_0[10] = 'o' + + addi $t0, $zero, 114 + sb $t0, 19($v0) # internal_0[11] = 'r' + + addi $t0, $zero, 108 + sb $t0, 20($v0) # internal_0[12] = 'l' + + addi $t0, $zero, 100 + sb $t0, 21($v0) # internal_0[13] = 'd' + + addi $t0, $zero, 10 + sb $t0, 22($v0) # internal_0[14] = '\n' + + sb $zero, 23($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_0 = "C: Hello world\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_1 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function___init___at_D: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_d_at_D: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 24 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 15 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 68 + sb $t0, 8($v0) # internal_0[0] = 'D' + + addi $t0, $zero, 58 + sb $t0, 9($v0) # internal_0[1] = ':' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_0[2] = ' ' + + addi $t0, $zero, 72 + sb $t0, 11($v0) # internal_0[3] = 'H' + + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_0[4] = 'e' + + addi $t0, $zero, 108 + sb $t0, 13($v0) # internal_0[5] = 'l' + + addi $t0, $zero, 108 + sb $t0, 14($v0) # internal_0[6] = 'l' + + addi $t0, $zero, 111 + sb $t0, 15($v0) # internal_0[7] = 'o' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_0[8] = ' ' + + addi $t0, $zero, 119 + sb $t0, 17($v0) # internal_0[9] = 'w' + + addi $t0, $zero, 111 + sb $t0, 18($v0) # internal_0[10] = 'o' + + addi $t0, $zero, 114 + sb $t0, 19($v0) # internal_0[11] = 'r' + + addi $t0, $zero, 108 + sb $t0, 20($v0) # internal_0[12] = 'l' + + addi $t0, $zero, 100 + sb $t0, 21($v0) # internal_0[13] = 'd' + + addi $t0, $zero, 10 + sb $t0, 22($v0) # internal_0[14] = '\n' + + sb $zero, 23($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_0 = "D: Hello world\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_1 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 44($sp) + # self = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating A + li $v0, 9 + lw $a0, type_A + syscall + la $t0, type_A # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 36($sp) # internal_0 = address of allocated object A + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_A + jal function___init___at_A + lw $ra, 4($sp) + sw $v1, 44($sp) # internal_0 = result of function___init___at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_out_a_at_A + jal function_out_a_at_A + lw $ra, 4($sp) + sw $v1, 40($sp) # internal_1 = result of function_out_a_at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating B + li $v0, 9 + lw $a0, type_B + syscall + la $t0, type_B # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 28($sp) # internal_2 = address of allocated object B + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_2 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function___init___at_B + jal function___init___at_B + lw $ra, 4($sp) + sw $v1, 36($sp) # internal_2 = result of function___init___at_B + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_2 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_out_b_at_B + jal function_out_b_at_B + lw $ra, 4($sp) + sw $v1, 32($sp) # internal_3 = result of function_out_b_at_B + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating C + li $v0, 9 + lw $a0, type_C + syscall + la $t0, type_C # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 20($sp) # internal_4 = address of allocated object C + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_4 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function___init___at_C + jal function___init___at_C + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_4 = result of function___init___at_C + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_4 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_out_c_at_C + jal function_out_c_at_C + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_5 = result of function_out_c_at_C + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating D + li $v0, 9 + lw $a0, type_D + syscall + la $t0, type_D # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_6 = address of allocated object D + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_6 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function___init___at_D + jal function___init___at_D + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_6 = result of function___init___at_D + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_6 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_out_d_at_D + jal function_out_d_at_D + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_7 = result of function_out_d_at_D + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 15 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 6 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 68 + sb $t0, 8($v0) # internal_8[0] = 'D' + + addi $t0, $zero, 111 + sb $t0, 9($v0) # internal_8[1] = 'o' + + addi $t0, $zero, 110 + sb $t0, 10($v0) # internal_8[2] = 'n' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_8[3] = 'e' + + addi $t0, $zero, 46 + sb $t0, 12($v0) # internal_8[4] = '.' + + addi $t0, $zero, 10 + sb $t0, 13($v0) # internal_8[5] = '\n' + + sb $zero, 14($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_8 = "Done.\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_8 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_9 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_main_at_Main + jal function_main_at_Main + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/life.mips b/tests/codegen/life.mips new file mode 100644 index 000000000..7ee334565 --- /dev/null +++ b/tests/codegen/life.mips @@ -0,0 +1,16106 @@ +.data + type_Object: .word 8 + type_Object_inherits_from: .word 0 + type_Object_attributes: .word 0 + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO: .word 8 + type_IO_inherits_from: .word type_Object + type_IO_attributes: .word 0 + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_Int: .word 8 + type_Int_inherits_from: .word type_Object + type_Int_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_String: .word 8 + type_String_inherits_from: .word type_Object + type_String_attributes: .word 0 + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Bool: .word 8 + type_Bool_inherits_from: .word type_Object + type_Bool_attributes: .word 0 + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_Board: .word 20 + type_Board_inherits_from: .word type_IO + type_Board_attributes: .word 3 + type_Board_name_size: .word 5 + type_Board_name: .asciiz "Board" + + type_CellularAutomaton: .word 24 + type_CellularAutomaton_inherits_from: .word type_Board + type_CellularAutomaton_attributes: .word 4 + type_CellularAutomaton_name_size: .word 17 + type_CellularAutomaton_name: .asciiz "CellularAutomaton" + + type_Main: .word 28 + type_Main_inherits_from: .word type_CellularAutomaton + type_Main_attributes: .word 5 + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 40($sp) + # a = 36($sp) + # b = 32($sp) + + # Reserving space for local variables + addi $sp, $sp, -32 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_0 = address of allocated object Int + + # internal_1 = typeof a that is the first word of the object + lw $t0, 36($sp) + lw $t1, 0($t0) + sw $t1, 24($sp) + + # internal_2 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_3 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_4 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_7 = address of allocated object Int + + # internal_5 = EqualAddress(internal_1, internal_2) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_1, internal_3) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_7 = EqualAddress(internal_1, internal_4) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_6 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_7 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 36($sp) + lw $t0, 8($t0) + lw $t1, 32($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 36($sp) + lw $t1, 32($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 28($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 28($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 36($sp) # Save in $t0 the left operand address + lw $t1, 32($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 28($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 28($sp) + + # Freeing space for local variables + addi $sp, $sp, 32 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 12($t1) # $t1 = length of the name of self + lw $t3, 16($t1) # $t1 = name of self + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + move $t4, $v0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + addi $t0, $t0, 8 # Pointer to the first character of the string in self + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t1, while_copy_name_end + lb $t6, 0($t0) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t0, $t0, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $t4, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the string x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lw $t1, buffer_input($t0) # Loading the byte + beq $t1, $zero, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lw $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 5 + syscall + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + sw $t1, 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 0($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 0($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + lw $t2, 8($sp) # $t2 = start of the substring + lw $t3, 4($sp) # $t3 = length of the substring + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bge $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Board: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_0 = address of allocated object Int + + # Set attribute rows of self + lw $t0, 12($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.rows = internal_0 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + # Set attribute columns of self + lw $t0, 12($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_1 + sw $t1, 12($t0) # self.columns = internal_1 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_2 = address of allocated object Int + + # Set attribute board_size of self + lw $t0, 12($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_2 + sw $t1, 16($t0) # self.board_size = internal_2 + + # Loading return value in $v1 + lw $v1, 12($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + function_size_of_board_at_Board: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # initial = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument initial + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing initial + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_0 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_board_init_at_Board: + # Function parameters + # $ra = 168($sp) + # self = 164($sp) + # start = 160($sp) + + # Reserving space for local variables + addi $sp, $sp, -160 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing self + + # Argument start + lw $t0, 172($sp) + sw $t0, 0($sp) # Storing start + + # Calling function function_size_of_board_at_Board + jal function_size_of_board_at_Board + lw $ra, 8($sp) + sw $v1, 164($sp) # internal_1 = result of function_size_of_board_at_Board + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 152($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 156($sp) + j end_assign + not_is_Bool_or_Int: + # size = internal_1 + lw $t0, 152($sp) + sw $t0, 156($sp) + end_assign: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_3 = address of allocated object Int + + # Allocating Int 15 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 15 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 140($sp) # internal_4 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument size + lw $t0, 168($sp) + sw $t0, 4($sp) # Storing size + + # Argument internal_4 + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 148($sp) # internal_5 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 136($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 144($sp) + j end_assign + not_is_Bool_or_Int: + # internal_3 = internal_5 + lw $t0, 136($sp) + sw $t0, 144($sp) + end_assign: + + # If internal_3 then goto then_8789948665158 + lw $t0, 144($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948665158 + + # Jumping to else_8789948665158 + j else_8789948665158 + + then_8789948665158: + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 132($sp) # internal_6 = address of allocated object Int + + # Set attribute rows of self + lw $t0, 164($sp) # $t0 = self + lw $t1, 132($sp) # $t1 = internal_6 + sw $t1, 8($t0) # self.rows = internal_6 + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_7 = address of allocated object Int + + # Set attribute columns of self + lw $t0, 164($sp) # $t0 = self + lw $t1, 128($sp) # $t1 = internal_7 + sw $t1, 12($t0) # self.columns = internal_7 + + # Set attribute board_size of self + lw $t0, 164($sp) # $t0 = self + lw $t1, 156($sp) # $t1 = size + sw $t1, 16($t0) # self.board_size = size + + lw $t0, 156($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 148($sp) + j end_assign + not_is_Bool_or_Int: + # internal_2 = size + lw $t0, 156($sp) + sw $t0, 148($sp) + end_assign: + + # Jumping to endif_8789948665158 + j endif_8789948665158 + + else_8789948665158: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_9 = address of allocated object Int + + # Allocating Int 16 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 16 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 116($sp) # internal_10 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument size + lw $t0, 168($sp) + sw $t0, 4($sp) # Storing size + + # Argument internal_10 + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 124($sp) # internal_11 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 112($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 120($sp) + j end_assign + not_is_Bool_or_Int: + # internal_9 = internal_11 + lw $t0, 112($sp) + sw $t0, 120($sp) + end_assign: + + # If internal_9 then goto then_8789948665152 + lw $t0, 120($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948665152 + + # Jumping to else_8789948665152 + j else_8789948665152 + + then_8789948665152: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_12 = address of allocated object Int + + # Set attribute rows of self + lw $t0, 164($sp) # $t0 = self + lw $t1, 108($sp) # $t1 = internal_12 + sw $t1, 8($t0) # self.rows = internal_12 + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_13 = address of allocated object Int + + # Set attribute columns of self + lw $t0, 164($sp) # $t0 = self + lw $t1, 104($sp) # $t1 = internal_13 + sw $t1, 12($t0) # self.columns = internal_13 + + # Set attribute board_size of self + lw $t0, 164($sp) # $t0 = self + lw $t1, 156($sp) # $t1 = size + sw $t1, 16($t0) # self.board_size = size + + lw $t0, 156($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 124($sp) + j end_assign + not_is_Bool_or_Int: + # internal_8 = size + lw $t0, 156($sp) + sw $t0, 124($sp) + end_assign: + + # Jumping to endif_8789948665152 + j endif_8789948665152 + + else_8789948665152: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_15 = address of allocated object Int + + # Allocating Int 20 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 20 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 92($sp) # internal_16 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument size + lw $t0, 168($sp) + sw $t0, 4($sp) # Storing size + + # Argument internal_16 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_17 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 88($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 96($sp) + j end_assign + not_is_Bool_or_Int: + # internal_15 = internal_17 + lw $t0, 88($sp) + sw $t0, 96($sp) + end_assign: + + # If internal_15 then goto then_8789948665146 + lw $t0, 96($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948665146 + + # Jumping to else_8789948665146 + j else_8789948665146 + + then_8789948665146: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_18 = address of allocated object Int + + # Set attribute rows of self + lw $t0, 164($sp) # $t0 = self + lw $t1, 84($sp) # $t1 = internal_18 + sw $t1, 8($t0) # self.rows = internal_18 + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_19 = address of allocated object Int + + # Set attribute columns of self + lw $t0, 164($sp) # $t0 = self + lw $t1, 80($sp) # $t1 = internal_19 + sw $t1, 12($t0) # self.columns = internal_19 + + # Set attribute board_size of self + lw $t0, 164($sp) # $t0 = self + lw $t1, 156($sp) # $t1 = size + sw $t1, 16($t0) # self.board_size = size + + lw $t0, 156($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 100($sp) + j end_assign + not_is_Bool_or_Int: + # internal_14 = size + lw $t0, 156($sp) + sw $t0, 100($sp) + end_assign: + + # Jumping to endif_8789948665146 + j endif_8789948665146 + + else_8789948665146: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_21 = address of allocated object Int + + # Allocating Int 21 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 21 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_22 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument size + lw $t0, 168($sp) + sw $t0, 4($sp) # Storing size + + # Argument internal_22 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 76($sp) # internal_23 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 64($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 72($sp) + j end_assign + not_is_Bool_or_Int: + # internal_21 = internal_23 + lw $t0, 64($sp) + sw $t0, 72($sp) + end_assign: + + # If internal_21 then goto then_8789948665140 + lw $t0, 72($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948665140 + + # Jumping to else_8789948665140 + j else_8789948665140 + + then_8789948665140: + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_24 = address of allocated object Int + + # Set attribute rows of self + lw $t0, 164($sp) # $t0 = self + lw $t1, 60($sp) # $t1 = internal_24 + sw $t1, 8($t0) # self.rows = internal_24 + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_25 = address of allocated object Int + + # Set attribute columns of self + lw $t0, 164($sp) # $t0 = self + lw $t1, 56($sp) # $t1 = internal_25 + sw $t1, 12($t0) # self.columns = internal_25 + + # Set attribute board_size of self + lw $t0, 164($sp) # $t0 = self + lw $t1, 156($sp) # $t1 = size + sw $t1, 16($t0) # self.board_size = size + + lw $t0, 156($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 76($sp) + j end_assign + not_is_Bool_or_Int: + # internal_20 = size + lw $t0, 156($sp) + sw $t0, 76($sp) + end_assign: + + # Jumping to endif_8789948665140 + j endif_8789948665140 + + else_8789948665140: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_27 = address of allocated object Int + + # Allocating Int 25 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 25 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_28 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument size + lw $t0, 168($sp) + sw $t0, 4($sp) # Storing size + + # Argument internal_28 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_28 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_29 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 40($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 48($sp) + j end_assign + not_is_Bool_or_Int: + # internal_27 = internal_29 + lw $t0, 40($sp) + sw $t0, 48($sp) + end_assign: + + # If internal_27 then goto then_8789948665134 + lw $t0, 48($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948665134 + + # Jumping to else_8789948665134 + j else_8789948665134 + + then_8789948665134: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_30 = address of allocated object Int + + # Set attribute rows of self + lw $t0, 164($sp) # $t0 = self + lw $t1, 36($sp) # $t1 = internal_30 + sw $t1, 8($t0) # self.rows = internal_30 + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_31 = address of allocated object Int + + # Set attribute columns of self + lw $t0, 164($sp) # $t0 = self + lw $t1, 32($sp) # $t1 = internal_31 + sw $t1, 12($t0) # self.columns = internal_31 + + # Set attribute board_size of self + lw $t0, 164($sp) # $t0 = self + lw $t1, 156($sp) # $t1 = size + sw $t1, 16($t0) # self.board_size = size + + lw $t0, 156($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # internal_26 = size + lw $t0, 156($sp) + sw $t0, 52($sp) + end_assign: + + # Jumping to endif_8789948665134 + j endif_8789948665134 + + else_8789948665134: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_33 = address of allocated object Int + + # Allocating Int 28 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 28 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_34 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument size + lw $t0, 168($sp) + sw $t0, 4($sp) # Storing size + + # Argument internal_34 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_34 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_35 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # internal_33 = internal_35 + lw $t0, 16($sp) + sw $t0, 24($sp) + end_assign: + + # If internal_33 then goto then_8789948665122 + lw $t0, 24($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948665122 + + # Jumping to else_8789948665122 + j else_8789948665122 + + then_8789948665122: + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_36 = address of allocated object Int + + # Set attribute rows of self + lw $t0, 164($sp) # $t0 = self + lw $t1, 12($sp) # $t1 = internal_36 + sw $t1, 8($t0) # self.rows = internal_36 + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_37 = address of allocated object Int + + # Set attribute columns of self + lw $t0, 164($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_37 + sw $t1, 12($t0) # self.columns = internal_37 + + # Set attribute board_size of self + lw $t0, 164($sp) # $t0 = self + lw $t1, 156($sp) # $t1 = size + sw $t1, 16($t0) # self.board_size = size + + lw $t0, 156($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 28($sp) + j end_assign + not_is_Bool_or_Int: + # internal_32 = size + lw $t0, 156($sp) + sw $t0, 28($sp) + end_assign: + + # Jumping to endif_8789948665122 + j endif_8789948665122 + + else_8789948665122: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_38 = address of allocated object Int + + # Set attribute rows of self + lw $t0, 164($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_38 + sw $t1, 8($t0) # self.rows = internal_38 + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_39 = address of allocated object Int + + # Set attribute columns of self + lw $t0, 164($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_39 + sw $t1, 12($t0) # self.columns = internal_39 + + # Set attribute board_size of self + lw $t0, 164($sp) # $t0 = self + lw $t1, 156($sp) # $t1 = size + sw $t1, 16($t0) # self.board_size = size + + lw $t0, 156($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 28($sp) + j end_assign + not_is_Bool_or_Int: + # internal_32 = size + lw $t0, 156($sp) + sw $t0, 28($sp) + end_assign: + + # Jumping to endif_8789948665122 + j endif_8789948665122 + + endif_8789948665122: + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # internal_26 = internal_32 + lw $t0, 28($sp) + sw $t0, 52($sp) + end_assign: + + # Jumping to endif_8789948665134 + j endif_8789948665134 + + endif_8789948665134: + + lw $t0, 52($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 76($sp) + j end_assign + not_is_Bool_or_Int: + # internal_20 = internal_26 + lw $t0, 52($sp) + sw $t0, 76($sp) + end_assign: + + # Jumping to endif_8789948665140 + j endif_8789948665140 + + endif_8789948665140: + + lw $t0, 76($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 100($sp) + j end_assign + not_is_Bool_or_Int: + # internal_14 = internal_20 + lw $t0, 76($sp) + sw $t0, 100($sp) + end_assign: + + # Jumping to endif_8789948665146 + j endif_8789948665146 + + endif_8789948665146: + + lw $t0, 100($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 124($sp) + j end_assign + not_is_Bool_or_Int: + # internal_8 = internal_14 + lw $t0, 100($sp) + sw $t0, 124($sp) + end_assign: + + # Jumping to endif_8789948665152 + j endif_8789948665152 + + endif_8789948665152: + + lw $t0, 124($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 148($sp) + j end_assign + not_is_Bool_or_Int: + # internal_2 = internal_8 + lw $t0, 124($sp) + sw $t0, 148($sp) + end_assign: + + # Jumping to endif_8789948665158 + j endif_8789948665158 + + endif_8789948665158: + + # Loading return value in $v1 + lw $v1, 164($sp) + + # Freeing space for local variables + addi $sp, $sp, 160 + + jr $ra + + function___init___at_CellularAutomaton: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_0 = address of allocated object Int + + # Set attribute rows of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 12($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.rows = internal_0 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_1 = address of allocated object Int + + # Set attribute columns of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_1 + sw $t1, 12($t0) # self.columns = internal_1 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Set attribute board_size of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_2 + sw $t1, 16($t0) # self.board_size = internal_2 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 0 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_3 = "" + + # Set attribute population_map of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_3 + sw $t1, 20($t0) # self.population_map = internal_3 + + # Loading return value in $v1 + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_init_at_CellularAutomaton: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # map = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Set attribute population_map of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = map + sw $t1, 20($t0) # self.population_map = map + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing self + + # Argument map + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing map + + # Calling function function_board_init_at_Board + jal function_board_init_at_Board + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_0 = result of function_board_init_at_Board + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_print_at_CellularAutomaton: + # Function parameters + # $ra = 76($sp) + # self = 72($sp) + + # Reserving space for local variables + addi $sp, $sp, -72 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_1 = address of allocated object Int + + lw $t0, 64($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 68($sp) + j end_assign + not_is_Bool_or_Int: + # i = internal_1 + lw $t0, 64($sp) + sw $t0, 68($sp) + end_assign: + + # Get attribute board_size of self + lw $t0, 72($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'board_size' from the instance + sw $t1, 56($sp) # internal_3 = board_size + + lw $t0, 56($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # num = internal_3 + lw $t0, 56($sp) + sw $t0, 60($sp) + end_assign: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_4[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 52($sp) # internal_4 = "\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_4 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 60($sp) # internal_5 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + while_start_8789948665326: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing i + + # Argument num + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_7 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 40($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_7 + lw $t0, 40($sp) + sw $t0, 44($sp) + end_assign: + + # If internal_6 then goto while_body_8789948665326 + lw $t0, 44($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8789948665326 + + # Jumping to while_end_8789948665326 + j while_end_8789948665326 + + while_body_8789948665326: + + # Get attribute population_map of self + lw $t0, 72($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'population_map' from the instance + sw $t1, 36($sp) # internal_8 = population_map + + # Get attribute columns of self + lw $t0, 72($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the instance + sw $t1, 32($sp) # internal_9 = columns + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_8 + lw $t0, 52($sp) + sw $t0, 8($sp) # Storing internal_8 + + # Argument i + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_9 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 44($sp) # internal_10 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_10 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_11 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_12[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_12 = "\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_12 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_13 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute columns of self + lw $t0, 72($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the instance + sw $t1, 12($sp) # internal_14 = columns + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_14 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_14 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_15 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 68($sp) + j end_assign + not_is_Bool_or_Int: + # i = internal_15 + lw $t0, 8($sp) + sw $t0, 68($sp) + end_assign: + + # Jumping to while_start_8789948665326 + j while_start_8789948665326 + + while_end_8789948665326: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_16[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_16 = "\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_16 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_17 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 72($sp) + + # Freeing space for local variables + addi $sp, $sp, 72 + + jr $ra + + function_num_cells_at_CellularAutomaton: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Get attribute population_map of self + lw $t0, 8($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'population_map' from the instance + sw $t1, 4($sp) # internal_0 = population_map + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_cell_at_CellularAutomaton: + # Function parameters + # $ra = 48($sp) + # self = 44($sp) + # position = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_1 = address of allocated object Int + + # Get attribute board_size of self + lw $t0, 44($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'board_size' from the instance + sw $t1, 28($sp) # internal_2 = board_size + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_4 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument position + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing position + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_5 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 32($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_5 + lw $t0, 16($sp) + sw $t0, 32($sp) + end_assign: + + # If internal_1 then goto then_8789948666483 + lw $t0, 32($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948666483 + + # Jumping to else_8789948666483 + j else_8789948666483 + + then_8789948666483: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_6[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_6 = " " + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 36($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_6 + lw $t0, 12($sp) + sw $t0, 36($sp) + end_assign: + + # Jumping to endif_8789948666483 + j endif_8789948666483 + + else_8789948666483: + + # Get attribute population_map of self + lw $t0, 44($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'population_map' from the instance + sw $t1, 8($sp) # internal_7 = population_map + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_8 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_7 + lw $t0, 24($sp) + sw $t0, 8($sp) # Storing internal_7 + + # Argument position + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_8 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 16($sp) # internal_9 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 36($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_9 + lw $t0, 0($sp) + sw $t0, 36($sp) + end_assign: + + # Jumping to endif_8789948666483 + j endif_8789948666483 + + endif_8789948666483: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_north_at_CellularAutomaton: + # Function parameters + # $ra = 48($sp) + # self = 44($sp) + # position = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_1 = address of allocated object Int + + # Get attribute columns of self + lw $t0, 44($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the instance + sw $t1, 28($sp) # internal_2 = columns + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_2 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_3 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_4 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_4 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_5 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 32($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_5 + lw $t0, 16($sp) + sw $t0, 32($sp) + end_assign: + + # If internal_1 then goto then_8789948666549 + lw $t0, 32($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948666549 + + # Jumping to else_8789948666549 + j else_8789948666549 + + then_8789948666549: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_6[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_6 = " " + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 36($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_6 + lw $t0, 12($sp) + sw $t0, 36($sp) + end_assign: + + # Jumping to endif_8789948666549 + j endif_8789948666549 + + else_8789948666549: + + # Get attribute columns of self + lw $t0, 44($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the instance + sw $t1, 8($sp) # internal_7 = columns + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_7 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_8 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_8 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_cell_at_CellularAutomaton + jal function_cell_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_9 = result of function_cell_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 36($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_9 + lw $t0, 0($sp) + sw $t0, 36($sp) + end_assign: + + # Jumping to endif_8789948666549 + j endif_8789948666549 + + endif_8789948666549: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_south_at_CellularAutomaton: + # Function parameters + # $ra = 48($sp) + # self = 44($sp) + # position = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_1 = address of allocated object Int + + # Get attribute board_size of self + lw $t0, 44($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'board_size' from the instance + sw $t1, 28($sp) # internal_2 = board_size + + # Get attribute columns of self + lw $t0, 44($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the instance + sw $t1, 24($sp) # internal_3 = columns + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_3 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_4 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_4 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_5 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 32($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_5 + lw $t0, 16($sp) + sw $t0, 32($sp) + end_assign: + + # If internal_1 then goto then_8789948666615 + lw $t0, 32($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948666615 + + # Jumping to else_8789948666615 + j else_8789948666615 + + then_8789948666615: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_6[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_6 = " " + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 36($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_6 + lw $t0, 12($sp) + sw $t0, 36($sp) + end_assign: + + # Jumping to endif_8789948666615 + j endif_8789948666615 + + else_8789948666615: + + # Get attribute columns of self + lw $t0, 44($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the instance + sw $t1, 8($sp) # internal_7 = columns + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_7 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_8 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_8 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_cell_at_CellularAutomaton + jal function_cell_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_9 = result of function_cell_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 36($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_9 + lw $t0, 0($sp) + sw $t0, 36($sp) + end_assign: + + # Jumping to endif_8789948666615 + j endif_8789948666615 + + endif_8789948666615: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_east_at_CellularAutomaton: + # Function parameters + # $ra = 68($sp) + # self = 64($sp) + # position = 60($sp) + + # Reserving space for local variables + addi $sp, $sp, -60 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_1 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_2 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_2 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 56($sp) # internal_3 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute columns of self + lw $t0, 64($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the instance + sw $t1, 40($sp) # internal_4 = columns + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_4 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_div + jal function_div + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_5 = result of function_div + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute columns of self + lw $t0, 64($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the instance + sw $t1, 32($sp) # internal_6 = columns + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_5 + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing internal_5 + + # Argument internal_6 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_7 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_8 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_8 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_9 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_7 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_7 + + # Argument internal_9 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_10 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_10 + lw $t0, 16($sp) + sw $t0, 52($sp) + end_assign: + + # If internal_1 then goto then_8789948666977 + lw $t0, 52($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948666977 + + # Jumping to else_8789948666977 + j else_8789948666977 + + then_8789948666977: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_11[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_11 = " " + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 56($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_11 + lw $t0, 12($sp) + sw $t0, 56($sp) + end_assign: + + # Jumping to endif_8789948666977 + j endif_8789948666977 + + else_8789948666977: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_12 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_12 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_13 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_13 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function function_cell_at_CellularAutomaton + jal function_cell_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_14 = result of function_cell_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 56($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_14 + lw $t0, 0($sp) + sw $t0, 56($sp) + end_assign: + + # Jumping to endif_8789948666977 + j endif_8789948666977 + + endif_8789948666977: + + # Loading return value in $v1 + lw $v1, 56($sp) + + # Freeing space for local variables + addi $sp, $sp, 60 + + jr $ra + + function_west_at_CellularAutomaton: + # Function parameters + # $ra = 72($sp) + # self = 68($sp) + # position = 64($sp) + + # Reserving space for local variables + addi $sp, $sp, -64 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_1 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_2 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_2 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 60($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 48($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 56($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_3 + lw $t0, 48($sp) + sw $t0, 56($sp) + end_assign: + + # If internal_1 then goto then_8789948667073 + lw $t0, 56($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948667073 + + # Jumping to else_8789948667073 + j else_8789948667073 + + then_8789948667073: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_4[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 44($sp) # internal_4 = " " + + lw $t0, 44($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_4 + lw $t0, 44($sp) + sw $t0, 60($sp) + end_assign: + + # Jumping to endif_8789948667073 + j endif_8789948667073 + + else_8789948667073: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_6 = address of allocated object Int + + # Get attribute columns of self + lw $t0, 68($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the instance + sw $t1, 32($sp) # internal_7 = columns + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_7 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_div + jal function_div + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_8 = result of function_div + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute columns of self + lw $t0, 68($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the instance + sw $t1, 24($sp) # internal_9 = columns + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_8 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument internal_9 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_10 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument position + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing position + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_11 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 36($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_11 + lw $t0, 16($sp) + sw $t0, 36($sp) + end_assign: + + # If internal_6 then goto then_8789948667079 + lw $t0, 36($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948667079 + + # Jumping to else_8789948667079 + j else_8789948667079 + + then_8789948667079: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_12[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_12 = " " + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # internal_5 = internal_12 + lw $t0, 12($sp) + sw $t0, 40($sp) + end_assign: + + # Jumping to endif_8789948667079 + j endif_8789948667079 + + else_8789948667079: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_13 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_13 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_14 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_14 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_14 + + # Calling function function_cell_at_CellularAutomaton + jal function_cell_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_15 = result of function_cell_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # internal_5 = internal_15 + lw $t0, 0($sp) + sw $t0, 40($sp) + end_assign: + + # Jumping to endif_8789948667079 + j endif_8789948667079 + + endif_8789948667079: + + lw $t0, 40($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_5 + lw $t0, 40($sp) + sw $t0, 60($sp) + end_assign: + + # Jumping to endif_8789948667073 + j endif_8789948667073 + + endif_8789948667073: + + # Loading return value in $v1 + lw $v1, 60($sp) + + # Freeing space for local variables + addi $sp, $sp, 64 + + jr $ra + + function_northwest_at_CellularAutomaton: + # Function parameters + # $ra = 80($sp) + # self = 76($sp) + # position = 72($sp) + + # Reserving space for local variables + addi $sp, $sp, -72 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_1 = address of allocated object Int + + # Get attribute columns of self + lw $t0, 76($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the instance + sw $t1, 60($sp) # internal_2 = columns + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_2 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_3 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_4 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_4 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 60($sp) # internal_5 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 48($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 64($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_5 + lw $t0, 48($sp) + sw $t0, 64($sp) + end_assign: + + # If internal_1 then goto then_8789948667965 + lw $t0, 64($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948667965 + + # Jumping to else_8789948667965 + j else_8789948667965 + + then_8789948667965: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_6[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 44($sp) # internal_6 = " " + + lw $t0, 44($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 68($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_6 + lw $t0, 44($sp) + sw $t0, 68($sp) + end_assign: + + # Jumping to endif_8789948667965 + j endif_8789948667965 + + else_8789948667965: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_8 = address of allocated object Int + + # Get attribute columns of self + lw $t0, 76($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the instance + sw $t1, 32($sp) # internal_9 = columns + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_9 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_div + jal function_div + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_10 = result of function_div + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute columns of self + lw $t0, 76($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the instance + sw $t1, 24($sp) # internal_11 = columns + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_11 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_12 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_12 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_12 + + # Argument position + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing position + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_13 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 36($sp) + j end_assign + not_is_Bool_or_Int: + # internal_8 = internal_13 + lw $t0, 16($sp) + sw $t0, 36($sp) + end_assign: + + # If internal_8 then goto then_8789948667971 + lw $t0, 36($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948667971 + + # Jumping to else_8789948667971 + j else_8789948667971 + + then_8789948667971: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_14[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_14 = " " + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # internal_7 = internal_14 + lw $t0, 12($sp) + sw $t0, 40($sp) + end_assign: + + # Jumping to endif_8789948667971 + j endif_8789948667971 + + else_8789948667971: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_15 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_15 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_16 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_16 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_north_at_CellularAutomaton + jal function_north_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_17 = result of function_north_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # internal_7 = internal_17 + lw $t0, 0($sp) + sw $t0, 40($sp) + end_assign: + + # Jumping to endif_8789948667971 + j endif_8789948667971 + + endif_8789948667971: + + lw $t0, 40($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 68($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_7 + lw $t0, 40($sp) + sw $t0, 68($sp) + end_assign: + + # Jumping to endif_8789948667965 + j endif_8789948667965 + + endif_8789948667965: + + # Loading return value in $v1 + lw $v1, 68($sp) + + # Freeing space for local variables + addi $sp, $sp, 72 + + jr $ra + + function_northeast_at_CellularAutomaton: + # Function parameters + # $ra = 96($sp) + # self = 92($sp) + # position = 88($sp) + + # Reserving space for local variables + addi $sp, $sp, -88 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_1 = address of allocated object Int + + # Get attribute columns of self + lw $t0, 92($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the instance + sw $t1, 76($sp) # internal_2 = columns + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_2 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_3 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_4 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_4 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 76($sp) # internal_5 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 64($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 80($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_5 + lw $t0, 64($sp) + sw $t0, 80($sp) + end_assign: + + # If internal_1 then goto then_8789948668109 + lw $t0, 80($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948668109 + + # Jumping to else_8789948668109 + j else_8789948668109 + + then_8789948668109: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_6[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 60($sp) # internal_6 = " " + + lw $t0, 60($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 84($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_6 + lw $t0, 60($sp) + sw $t0, 84($sp) + end_assign: + + # Jumping to endif_8789948668109 + j endif_8789948668109 + + else_8789948668109: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_8 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_9 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_9 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 56($sp) # internal_10 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute columns of self + lw $t0, 92($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the instance + sw $t1, 40($sp) # internal_11 = columns + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_11 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_div + jal function_div + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_12 = result of function_div + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute columns of self + lw $t0, 92($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the instance + sw $t1, 32($sp) # internal_13 = columns + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_12 + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing internal_12 + + # Argument internal_13 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_14 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_15 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_15 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_16 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_14 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_14 + + # Argument internal_16 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_17 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # internal_8 = internal_17 + lw $t0, 16($sp) + sw $t0, 52($sp) + end_assign: + + # If internal_8 then goto then_8789948668115 + lw $t0, 52($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948668115 + + # Jumping to else_8789948668115 + j else_8789948668115 + + then_8789948668115: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_18[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_18 = " " + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 56($sp) + j end_assign + not_is_Bool_or_Int: + # internal_7 = internal_18 + lw $t0, 12($sp) + sw $t0, 56($sp) + end_assign: + + # Jumping to endif_8789948668115 + j endif_8789948668115 + + else_8789948668115: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_19 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_19 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_19 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_20 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_20 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function function_north_at_CellularAutomaton + jal function_north_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_21 = result of function_north_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 56($sp) + j end_assign + not_is_Bool_or_Int: + # internal_7 = internal_21 + lw $t0, 0($sp) + sw $t0, 56($sp) + end_assign: + + # Jumping to endif_8789948668115 + j endif_8789948668115 + + endif_8789948668115: + + lw $t0, 56($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 84($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_7 + lw $t0, 56($sp) + sw $t0, 84($sp) + end_assign: + + # Jumping to endif_8789948668109 + j endif_8789948668109 + + endif_8789948668109: + + # Loading return value in $v1 + lw $v1, 84($sp) + + # Freeing space for local variables + addi $sp, $sp, 88 + + jr $ra + + function_southeast_at_CellularAutomaton: + # Function parameters + # $ra = 96($sp) + # self = 92($sp) + # position = 88($sp) + + # Reserving space for local variables + addi $sp, $sp, -88 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_1 = address of allocated object Int + + # Get attribute board_size of self + lw $t0, 92($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'board_size' from the instance + sw $t1, 76($sp) # internal_2 = board_size + + # Get attribute columns of self + lw $t0, 92($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the instance + sw $t1, 72($sp) # internal_3 = columns + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_3 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_4 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_4 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 76($sp) # internal_5 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 64($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 80($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_5 + lw $t0, 64($sp) + sw $t0, 80($sp) + end_assign: + + # If internal_1 then goto then_8789948668513 + lw $t0, 80($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948668513 + + # Jumping to else_8789948668513 + j else_8789948668513 + + then_8789948668513: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_6[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 60($sp) # internal_6 = " " + + lw $t0, 60($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 84($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_6 + lw $t0, 60($sp) + sw $t0, 84($sp) + end_assign: + + # Jumping to endif_8789948668513 + j endif_8789948668513 + + else_8789948668513: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_8 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_9 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_9 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 56($sp) # internal_10 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute columns of self + lw $t0, 92($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the instance + sw $t1, 40($sp) # internal_11 = columns + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_11 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_div + jal function_div + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_12 = result of function_div + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute columns of self + lw $t0, 92($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the instance + sw $t1, 32($sp) # internal_13 = columns + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_12 + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing internal_12 + + # Argument internal_13 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_14 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_15 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_15 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_16 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_14 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_14 + + # Argument internal_16 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_17 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # internal_8 = internal_17 + lw $t0, 16($sp) + sw $t0, 52($sp) + end_assign: + + # If internal_8 then goto then_8789948668519 + lw $t0, 52($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948668519 + + # Jumping to else_8789948668519 + j else_8789948668519 + + then_8789948668519: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_18[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_18 = " " + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 56($sp) + j end_assign + not_is_Bool_or_Int: + # internal_7 = internal_18 + lw $t0, 12($sp) + sw $t0, 56($sp) + end_assign: + + # Jumping to endif_8789948668519 + j endif_8789948668519 + + else_8789948668519: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_19 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_19 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_19 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_20 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_20 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function function_south_at_CellularAutomaton + jal function_south_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_21 = result of function_south_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 56($sp) + j end_assign + not_is_Bool_or_Int: + # internal_7 = internal_21 + lw $t0, 0($sp) + sw $t0, 56($sp) + end_assign: + + # Jumping to endif_8789948668519 + j endif_8789948668519 + + endif_8789948668519: + + lw $t0, 56($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 84($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_7 + lw $t0, 56($sp) + sw $t0, 84($sp) + end_assign: + + # Jumping to endif_8789948668513 + j endif_8789948668513 + + endif_8789948668513: + + # Loading return value in $v1 + lw $v1, 84($sp) + + # Freeing space for local variables + addi $sp, $sp, 88 + + jr $ra + + function_southwest_at_CellularAutomaton: + # Function parameters + # $ra = 80($sp) + # self = 76($sp) + # position = 72($sp) + + # Reserving space for local variables + addi $sp, $sp, -72 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_1 = address of allocated object Int + + # Get attribute board_size of self + lw $t0, 76($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'board_size' from the instance + sw $t1, 60($sp) # internal_2 = board_size + + # Get attribute columns of self + lw $t0, 76($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the instance + sw $t1, 56($sp) # internal_3 = columns + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_3 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 64($sp) # internal_4 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_4 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 60($sp) # internal_5 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 48($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 64($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_5 + lw $t0, 48($sp) + sw $t0, 64($sp) + end_assign: + + # If internal_1 then goto then_8789948668633 + lw $t0, 64($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948668633 + + # Jumping to else_8789948668633 + j else_8789948668633 + + then_8789948668633: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_6[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 44($sp) # internal_6 = " " + + lw $t0, 44($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 68($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_6 + lw $t0, 44($sp) + sw $t0, 68($sp) + end_assign: + + # Jumping to endif_8789948668633 + j endif_8789948668633 + + else_8789948668633: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_8 = address of allocated object Int + + # Get attribute columns of self + lw $t0, 76($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the instance + sw $t1, 32($sp) # internal_9 = columns + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_9 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_div + jal function_div + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_10 = result of function_div + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute columns of self + lw $t0, 76($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the instance + sw $t1, 24($sp) # internal_11 = columns + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_11 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_12 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_12 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_12 + + # Argument position + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing position + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_13 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 36($sp) + j end_assign + not_is_Bool_or_Int: + # internal_8 = internal_13 + lw $t0, 16($sp) + sw $t0, 36($sp) + end_assign: + + # If internal_8 then goto then_8789948668639 + lw $t0, 36($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948668639 + + # Jumping to else_8789948668639 + j else_8789948668639 + + then_8789948668639: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_14[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_14 = " " + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # internal_7 = internal_14 + lw $t0, 12($sp) + sw $t0, 40($sp) + end_assign: + + # Jumping to endif_8789948668639 + j endif_8789948668639 + + else_8789948668639: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_15 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_15 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_16 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_16 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_south_at_CellularAutomaton + jal function_south_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_17 = result of function_south_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # internal_7 = internal_17 + lw $t0, 0($sp) + sw $t0, 40($sp) + end_assign: + + # Jumping to endif_8789948668639 + j endif_8789948668639 + + endif_8789948668639: + + lw $t0, 40($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 68($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_7 + lw $t0, 40($sp) + sw $t0, 68($sp) + end_assign: + + # Jumping to endif_8789948668633 + j endif_8789948668633 + + endif_8789948668633: + + # Loading return value in $v1 + lw $v1, 68($sp) + + # Freeing space for local variables + addi $sp, $sp, 72 + + jr $ra + + function_neighbors_at_CellularAutomaton: + # Function parameters + # $ra = 260($sp) + # self = 256($sp) + # position = 252($sp) + + # Reserving space for local variables + addi $sp, $sp, -252 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 244($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 268($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 264($sp) + sw $t0, 0($sp) # Storing position + + # Calling function function_north_at_CellularAutomaton + jal function_north_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 252($sp) # internal_2 = result of function_north_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_3[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 236($sp) # internal_3 = "X" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 252($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 248($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 244($sp) # internal_4 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 232($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 244($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_4 + lw $t0, 232($sp) + sw $t0, 244($sp) + end_assign: + + # If internal_1 then goto then_8789948668685 + lw $t0, 244($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948668685 + + # Jumping to else_8789948668685 + j else_8789948668685 + + then_8789948668685: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 228($sp) # internal_5 = address of allocated object Int + + lw $t0, 228($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 248($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_5 + lw $t0, 228($sp) + sw $t0, 248($sp) + end_assign: + + # Jumping to endif_8789948668685 + j endif_8789948668685 + + else_8789948668685: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 224($sp) # internal_6 = address of allocated object Int + + lw $t0, 224($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 248($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_6 + lw $t0, 224($sp) + sw $t0, 248($sp) + end_assign: + + # Jumping to endif_8789948668685 + j endif_8789948668685 + + endif_8789948668685: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 216($sp) # internal_8 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 268($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 264($sp) + sw $t0, 0($sp) # Storing position + + # Calling function function_south_at_CellularAutomaton + jal function_south_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 224($sp) # internal_9 = result of function_south_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_10[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 208($sp) # internal_10 = "X" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_9 + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing internal_9 + + # Argument internal_10 + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 216($sp) # internal_11 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 204($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 216($sp) + j end_assign + not_is_Bool_or_Int: + # internal_8 = internal_11 + lw $t0, 204($sp) + sw $t0, 216($sp) + end_assign: + + # If internal_8 then goto then_8789948668724 + lw $t0, 216($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948668724 + + # Jumping to else_8789948668724 + j else_8789948668724 + + then_8789948668724: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 200($sp) # internal_12 = address of allocated object Int + + lw $t0, 200($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 220($sp) + j end_assign + not_is_Bool_or_Int: + # internal_7 = internal_12 + lw $t0, 200($sp) + sw $t0, 220($sp) + end_assign: + + # Jumping to endif_8789948668724 + j endif_8789948668724 + + else_8789948668724: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 196($sp) # internal_13 = address of allocated object Int + + lw $t0, 196($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 220($sp) + j end_assign + not_is_Bool_or_Int: + # internal_7 = internal_13 + lw $t0, 196($sp) + sw $t0, 220($sp) + end_assign: + + # Jumping to endif_8789948668724 + j endif_8789948668724 + + endif_8789948668724: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 260($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_7 + lw $t0, 232($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 204($sp) # internal_14 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 184($sp) # internal_16 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 268($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 264($sp) + sw $t0, 0($sp) # Storing position + + # Calling function function_east_at_CellularAutomaton + jal function_east_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 192($sp) # internal_17 = result of function_east_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_18[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 176($sp) # internal_18 = "X" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_17 + lw $t0, 192($sp) + sw $t0, 4($sp) # Storing internal_17 + + # Argument internal_18 + lw $t0, 188($sp) + sw $t0, 0($sp) # Storing internal_18 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 184($sp) # internal_19 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 172($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 184($sp) + j end_assign + not_is_Bool_or_Int: + # internal_16 = internal_19 + lw $t0, 172($sp) + sw $t0, 184($sp) + end_assign: + + # If internal_16 then goto then_8789948668769 + lw $t0, 184($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948668769 + + # Jumping to else_8789948668769 + j else_8789948668769 + + then_8789948668769: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 168($sp) # internal_20 = address of allocated object Int + + lw $t0, 168($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 188($sp) + j end_assign + not_is_Bool_or_Int: + # internal_15 = internal_20 + lw $t0, 168($sp) + sw $t0, 188($sp) + end_assign: + + # Jumping to endif_8789948668769 + j endif_8789948668769 + + else_8789948668769: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 164($sp) # internal_21 = address of allocated object Int + + lw $t0, 164($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 188($sp) + j end_assign + not_is_Bool_or_Int: + # internal_15 = internal_21 + lw $t0, 164($sp) + sw $t0, 188($sp) + end_assign: + + # Jumping to endif_8789948668769 + j endif_8789948668769 + + endif_8789948668769: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_14 + lw $t0, 204($sp) + sw $t0, 4($sp) # Storing internal_14 + + # Argument internal_15 + lw $t0, 200($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 172($sp) # internal_22 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 152($sp) # internal_24 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 268($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 264($sp) + sw $t0, 0($sp) # Storing position + + # Calling function function_west_at_CellularAutomaton + jal function_west_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 160($sp) # internal_25 = result of function_west_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_26[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 144($sp) # internal_26 = "X" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_25 + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing internal_25 + + # Argument internal_26 + lw $t0, 156($sp) + sw $t0, 0($sp) # Storing internal_26 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 152($sp) # internal_27 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 140($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 152($sp) + j end_assign + not_is_Bool_or_Int: + # internal_24 = internal_27 + lw $t0, 140($sp) + sw $t0, 152($sp) + end_assign: + + # If internal_24 then goto then_8789948668814 + lw $t0, 152($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948668814 + + # Jumping to else_8789948668814 + j else_8789948668814 + + then_8789948668814: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_28 = address of allocated object Int + + lw $t0, 136($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 156($sp) + j end_assign + not_is_Bool_or_Int: + # internal_23 = internal_28 + lw $t0, 136($sp) + sw $t0, 156($sp) + end_assign: + + # Jumping to endif_8789948668814 + j endif_8789948668814 + + else_8789948668814: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 132($sp) # internal_29 = address of allocated object Int + + lw $t0, 132($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 156($sp) + j end_assign + not_is_Bool_or_Int: + # internal_23 = internal_29 + lw $t0, 132($sp) + sw $t0, 156($sp) + end_assign: + + # Jumping to endif_8789948668814 + j endif_8789948668814 + + endif_8789948668814: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_22 + lw $t0, 172($sp) + sw $t0, 4($sp) # Storing internal_22 + + # Argument internal_23 + lw $t0, 168($sp) + sw $t0, 0($sp) # Storing internal_23 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 140($sp) # internal_30 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_32 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 268($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 264($sp) + sw $t0, 0($sp) # Storing position + + # Calling function function_northeast_at_CellularAutomaton + jal function_northeast_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 128($sp) # internal_33 = result of function_northeast_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_34[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 112($sp) # internal_34 = "X" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_33 + lw $t0, 128($sp) + sw $t0, 4($sp) # Storing internal_33 + + # Argument internal_34 + lw $t0, 124($sp) + sw $t0, 0($sp) # Storing internal_34 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 120($sp) # internal_35 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 108($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 120($sp) + j end_assign + not_is_Bool_or_Int: + # internal_32 = internal_35 + lw $t0, 108($sp) + sw $t0, 120($sp) + end_assign: + + # If internal_32 then goto then_8789948668859 + lw $t0, 120($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948668859 + + # Jumping to else_8789948668859 + j else_8789948668859 + + then_8789948668859: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_36 = address of allocated object Int + + lw $t0, 104($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 124($sp) + j end_assign + not_is_Bool_or_Int: + # internal_31 = internal_36 + lw $t0, 104($sp) + sw $t0, 124($sp) + end_assign: + + # Jumping to endif_8789948668859 + j endif_8789948668859 + + else_8789948668859: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_37 = address of allocated object Int + + lw $t0, 100($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 124($sp) + j end_assign + not_is_Bool_or_Int: + # internal_31 = internal_37 + lw $t0, 100($sp) + sw $t0, 124($sp) + end_assign: + + # Jumping to endif_8789948668859 + j endif_8789948668859 + + endif_8789948668859: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_30 + lw $t0, 140($sp) + sw $t0, 4($sp) # Storing internal_30 + + # Argument internal_31 + lw $t0, 136($sp) + sw $t0, 0($sp) # Storing internal_31 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 108($sp) # internal_38 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_40 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 268($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 264($sp) + sw $t0, 0($sp) # Storing position + + # Calling function function_northwest_at_CellularAutomaton + jal function_northwest_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 96($sp) # internal_41 = result of function_northwest_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_42[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 80($sp) # internal_42 = "X" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_41 + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing internal_41 + + # Argument internal_42 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_42 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 88($sp) # internal_43 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 76($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 88($sp) + j end_assign + not_is_Bool_or_Int: + # internal_40 = internal_43 + lw $t0, 76($sp) + sw $t0, 88($sp) + end_assign: + + # If internal_40 then goto then_8789948668904 + lw $t0, 88($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948668904 + + # Jumping to else_8789948668904 + j else_8789948668904 + + then_8789948668904: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_44 = address of allocated object Int + + lw $t0, 72($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 92($sp) + j end_assign + not_is_Bool_or_Int: + # internal_39 = internal_44 + lw $t0, 72($sp) + sw $t0, 92($sp) + end_assign: + + # Jumping to endif_8789948668904 + j endif_8789948668904 + + else_8789948668904: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_45 = address of allocated object Int + + lw $t0, 68($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 92($sp) + j end_assign + not_is_Bool_or_Int: + # internal_39 = internal_45 + lw $t0, 68($sp) + sw $t0, 92($sp) + end_assign: + + # Jumping to endif_8789948668904 + j endif_8789948668904 + + endif_8789948668904: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_38 + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing internal_38 + + # Argument internal_39 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_39 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 76($sp) # internal_46 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_48 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 268($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 264($sp) + sw $t0, 0($sp) # Storing position + + # Calling function function_southeast_at_CellularAutomaton + jal function_southeast_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 64($sp) # internal_49 = result of function_southeast_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_50[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 48($sp) # internal_50 = "X" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_49 + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing internal_49 + + # Argument internal_50 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_50 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 56($sp) # internal_51 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 44($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 56($sp) + j end_assign + not_is_Bool_or_Int: + # internal_48 = internal_51 + lw $t0, 44($sp) + sw $t0, 56($sp) + end_assign: + + # If internal_48 then goto then_8789948669209 + lw $t0, 56($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948669209 + + # Jumping to else_8789948669209 + j else_8789948669209 + + then_8789948669209: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_52 = address of allocated object Int + + lw $t0, 40($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # internal_47 = internal_52 + lw $t0, 40($sp) + sw $t0, 60($sp) + end_assign: + + # Jumping to endif_8789948669209 + j endif_8789948669209 + + else_8789948669209: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_53 = address of allocated object Int + + lw $t0, 36($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # internal_47 = internal_53 + lw $t0, 36($sp) + sw $t0, 60($sp) + end_assign: + + # Jumping to endif_8789948669209 + j endif_8789948669209 + + endif_8789948669209: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_46 + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing internal_46 + + # Argument internal_47 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_47 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_54 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_56 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 268($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 264($sp) + sw $t0, 0($sp) # Storing position + + # Calling function function_southwest_at_CellularAutomaton + jal function_southwest_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_57 = result of function_southwest_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_58[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 16($sp) # internal_58 = "X" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_57 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_57 + + # Argument internal_58 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_58 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_59 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # internal_56 = internal_59 + lw $t0, 12($sp) + sw $t0, 24($sp) + end_assign: + + # If internal_56 then goto then_8789948669254 + lw $t0, 24($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948669254 + + # Jumping to else_8789948669254 + j else_8789948669254 + + then_8789948669254: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_60 = address of allocated object Int + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 28($sp) + j end_assign + not_is_Bool_or_Int: + # internal_55 = internal_60 + lw $t0, 8($sp) + sw $t0, 28($sp) + end_assign: + + # Jumping to endif_8789948669254 + j endif_8789948669254 + + else_8789948669254: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_61 = address of allocated object Int + + lw $t0, 4($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 28($sp) + j end_assign + not_is_Bool_or_Int: + # internal_55 = internal_61 + lw $t0, 4($sp) + sw $t0, 28($sp) + end_assign: + + # Jumping to endif_8789948669254 + j endif_8789948669254 + + endif_8789948669254: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_54 + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing internal_54 + + # Argument internal_55 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_55 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_62 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 252 + + jr $ra + + function_cell_at_next_evolution_at_CellularAutomaton: + # Function parameters + # $ra = 84($sp) + # self = 80($sp) + # position = 76($sp) + + # Reserving space for local variables + addi $sp, $sp, -76 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 92($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing position + + # Calling function function_neighbors_at_CellularAutomaton + jal function_neighbors_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 76($sp) # internal_2 = result of function_neighbors_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_4 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 56($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 68($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_4 + lw $t0, 56($sp) + sw $t0, 68($sp) + end_assign: + + # If internal_1 then goto then_8789948669374 + lw $t0, 68($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948669374 + + # Jumping to else_8789948669374 + j else_8789948669374 + + then_8789948669374: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_5[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 52($sp) # internal_5 = "X" + + lw $t0, 52($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 72($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_5 + lw $t0, 52($sp) + sw $t0, 72($sp) + end_assign: + + # Jumping to endif_8789948669374 + j endif_8789948669374 + + else_8789948669374: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 92($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing position + + # Calling function function_neighbors_at_CellularAutomaton + jal function_neighbors_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_8 = result of function_neighbors_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_9 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_8 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument internal_9 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_10 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 32($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 44($sp) + j end_assign + not_is_Bool_or_Int: + # internal_7 = internal_10 + lw $t0, 32($sp) + sw $t0, 44($sp) + end_assign: + + # If internal_7 then goto then_8789948669368 + lw $t0, 44($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948669368 + + # Jumping to else_8789948669368 + j else_8789948669368 + + then_8789948669368: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_12 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 92($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing position + + # Calling function function_cell_at_CellularAutomaton + jal function_cell_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_13 = result of function_cell_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_14[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 16($sp) # internal_14 = "X" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_13 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_13 + + # Argument internal_14 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_14 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_15 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # internal_12 = internal_15 + lw $t0, 12($sp) + sw $t0, 24($sp) + end_assign: + + # If internal_12 then goto then_8789948669356 + lw $t0, 24($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948669356 + + # Jumping to else_8789948669356 + j else_8789948669356 + + then_8789948669356: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_16[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_16 = "X" + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 28($sp) + j end_assign + not_is_Bool_or_Int: + # internal_11 = internal_16 + lw $t0, 8($sp) + sw $t0, 28($sp) + end_assign: + + # Jumping to endif_8789948669356 + j endif_8789948669356 + + else_8789948669356: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 45 + sb $t0, 8($v0) # internal_17[0] = '-' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_17 = "-" + + lw $t0, 4($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 28($sp) + j end_assign + not_is_Bool_or_Int: + # internal_11 = internal_17 + lw $t0, 4($sp) + sw $t0, 28($sp) + end_assign: + + # Jumping to endif_8789948669356 + j endif_8789948669356 + + endif_8789948669356: + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 48($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_11 + lw $t0, 28($sp) + sw $t0, 48($sp) + end_assign: + + # Jumping to endif_8789948669368 + j endif_8789948669368 + + else_8789948669368: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 45 + sb $t0, 8($v0) # internal_18[0] = '-' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_18 = "-" + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 48($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_18 + lw $t0, 0($sp) + sw $t0, 48($sp) + end_assign: + + # Jumping to endif_8789948669368 + j endif_8789948669368 + + endif_8789948669368: + + lw $t0, 48($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 72($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_6 + lw $t0, 48($sp) + sw $t0, 72($sp) + end_assign: + + # Jumping to endif_8789948669374 + j endif_8789948669374 + + endif_8789948669374: + + # Loading return value in $v1 + lw $v1, 72($sp) + + # Freeing space for local variables + addi $sp, $sp, 76 + + jr $ra + + function_evolve_at_CellularAutomaton: + # Function parameters + # $ra = 48($sp) + # self = 44($sp) + + # Reserving space for local variables + addi $sp, $sp, -44 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_1 = address of allocated object Int + + lw $t0, 36($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # position = internal_1 + lw $t0, 36($sp) + sw $t0, 40($sp) + end_assign: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_num_cells_at_CellularAutomaton + jal function_num_cells_at_CellularAutomaton + lw $ra, 4($sp) + sw $v1, 36($sp) # internal_3 = result of function_num_cells_at_CellularAutomaton + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 32($sp) + j end_assign + not_is_Bool_or_Int: + # num = internal_3 + lw $t0, 28($sp) + sw $t0, 32($sp) + end_assign: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 0 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 24($sp) # temp = "" + + while_start_8789948669724: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing position + + # Argument num + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_6 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 20($sp) + j end_assign + not_is_Bool_or_Int: + # internal_5 = internal_6 + lw $t0, 16($sp) + sw $t0, 20($sp) + end_assign: + + # If internal_5 then goto while_body_8789948669724 + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8789948669724 + + # Jumping to while_end_8789948669724 + j while_end_8789948669724 + + while_body_8789948669724: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing position + + # Calling function function_cell_at_next_evolution_at_CellularAutomaton + jal function_cell_at_next_evolution_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_7 = result of function_cell_at_next_evolution_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument temp + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing temp + + # Argument internal_7 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_8 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # temp = internal_8 + lw $t0, 8($sp) + sw $t0, 24($sp) + end_assign: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_9 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_9 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_10 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # position = internal_10 + lw $t0, 0($sp) + sw $t0, 40($sp) + end_assign: + + # Jumping to while_start_8789948669724 + j while_start_8789948669724 + + while_end_8789948669724: + + # Set attribute population_map of self + lw $t0, 44($sp) # $t0 = self + lw $t1, 24($sp) # $t1 = temp + sw $t1, 20($t0) # self.population_map = temp + + # Loading return value in $v1 + lw $v1, 44($sp) + + # Freeing space for local variables + addi $sp, $sp, 44 + + jr $ra + + function_option_at_CellularAutomaton: + # Function parameters + # $ra = 628($sp) + # self = 624($sp) + + # Reserving space for local variables + addi $sp, $sp, -624 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 24 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_1[0] = '\n' + + addi $t0, $zero, 80 + sb $t0, 9($v0) # internal_1[1] = 'P' + + addi $t0, $zero, 108 + sb $t0, 10($v0) # internal_1[2] = 'l' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_1[3] = 'e' + + addi $t0, $zero, 97 + sb $t0, 12($v0) # internal_1[4] = 'a' + + addi $t0, $zero, 115 + sb $t0, 13($v0) # internal_1[5] = 's' + + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_1[6] = 'e' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_1[7] = ' ' + + addi $t0, $zero, 99 + sb $t0, 16($v0) # internal_1[8] = 'c' + + addi $t0, $zero, 104 + sb $t0, 17($v0) # internal_1[9] = 'h' + + addi $t0, $zero, 111 + sb $t0, 18($v0) # internal_1[10] = 'o' + + addi $t0, $zero, 115 + sb $t0, 19($v0) # internal_1[11] = 's' + + addi $t0, $zero, 101 + sb $t0, 20($v0) # internal_1[12] = 'e' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_1[13] = ' ' + + addi $t0, $zero, 97 + sb $t0, 22($v0) # internal_1[14] = 'a' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_1[15] = ' ' + + addi $t0, $zero, 110 + sb $t0, 24($v0) # internal_1[16] = 'n' + + addi $t0, $zero, 117 + sb $t0, 25($v0) # internal_1[17] = 'u' + + addi $t0, $zero, 109 + sb $t0, 26($v0) # internal_1[18] = 'm' + + addi $t0, $zero, 98 + sb $t0, 27($v0) # internal_1[19] = 'b' + + addi $t0, $zero, 101 + sb $t0, 28($v0) # internal_1[20] = 'e' + + addi $t0, $zero, 114 + sb $t0, 29($v0) # internal_1[21] = 'r' + + addi $t0, $zero, 58 + sb $t0, 30($v0) # internal_1[22] = ':' + + addi $t0, $zero, 10 + sb $t0, 31($v0) # internal_1[23] = '\n' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 616($sp) # internal_1 = "\nPlease chose a number:\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_1 + lw $t0, 628($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 624($sp) # internal_2 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_3[0] = '\t' + + addi $t0, $zero, 49 + sb $t0, 9($v0) # internal_3[1] = '1' + + addi $t0, $zero, 58 + sb $t0, 10($v0) # internal_3[2] = ':' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_3[3] = ' ' + + addi $t0, $zero, 65 + sb $t0, 12($v0) # internal_3[4] = 'A' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_3[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_3[6] = 'c' + + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_3[7] = 'r' + + addi $t0, $zero, 111 + sb $t0, 16($v0) # internal_3[8] = 'o' + + addi $t0, $zero, 115 + sb $t0, 17($v0) # internal_3[9] = 's' + + addi $t0, $zero, 115 + sb $t0, 18($v0) # internal_3[10] = 's' + + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_3[11] = '\n' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 608($sp) # internal_3 = "\t1: A cross\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_3 + lw $t0, 620($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 616($sp) # internal_4 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 56 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 47 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_5[0] = '\t' + + addi $t0, $zero, 50 + sb $t0, 9($v0) # internal_5[1] = '2' + + addi $t0, $zero, 58 + sb $t0, 10($v0) # internal_5[2] = ':' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_5[3] = ' ' + + addi $t0, $zero, 65 + sb $t0, 12($v0) # internal_5[4] = 'A' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_5[5] = ' ' + + addi $t0, $zero, 115 + sb $t0, 14($v0) # internal_5[6] = 's' + + addi $t0, $zero, 108 + sb $t0, 15($v0) # internal_5[7] = 'l' + + addi $t0, $zero, 97 + sb $t0, 16($v0) # internal_5[8] = 'a' + + addi $t0, $zero, 115 + sb $t0, 17($v0) # internal_5[9] = 's' + + addi $t0, $zero, 104 + sb $t0, 18($v0) # internal_5[10] = 'h' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_5[11] = ' ' + + addi $t0, $zero, 102 + sb $t0, 20($v0) # internal_5[12] = 'f' + + addi $t0, $zero, 114 + sb $t0, 21($v0) # internal_5[13] = 'r' + + addi $t0, $zero, 111 + sb $t0, 22($v0) # internal_5[14] = 'o' + + addi $t0, $zero, 109 + sb $t0, 23($v0) # internal_5[15] = 'm' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_5[16] = ' ' + + addi $t0, $zero, 116 + sb $t0, 25($v0) # internal_5[17] = 't' + + addi $t0, $zero, 104 + sb $t0, 26($v0) # internal_5[18] = 'h' + + addi $t0, $zero, 101 + sb $t0, 27($v0) # internal_5[19] = 'e' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_5[20] = ' ' + + addi $t0, $zero, 117 + sb $t0, 29($v0) # internal_5[21] = 'u' + + addi $t0, $zero, 112 + sb $t0, 30($v0) # internal_5[22] = 'p' + + addi $t0, $zero, 112 + sb $t0, 31($v0) # internal_5[23] = 'p' + + addi $t0, $zero, 101 + sb $t0, 32($v0) # internal_5[24] = 'e' + + addi $t0, $zero, 114 + sb $t0, 33($v0) # internal_5[25] = 'r' + + addi $t0, $zero, 32 + sb $t0, 34($v0) # internal_5[26] = ' ' + + addi $t0, $zero, 108 + sb $t0, 35($v0) # internal_5[27] = 'l' + + addi $t0, $zero, 101 + sb $t0, 36($v0) # internal_5[28] = 'e' + + addi $t0, $zero, 102 + sb $t0, 37($v0) # internal_5[29] = 'f' + + addi $t0, $zero, 116 + sb $t0, 38($v0) # internal_5[30] = 't' + + addi $t0, $zero, 32 + sb $t0, 39($v0) # internal_5[31] = ' ' + + addi $t0, $zero, 116 + sb $t0, 40($v0) # internal_5[32] = 't' + + addi $t0, $zero, 111 + sb $t0, 41($v0) # internal_5[33] = 'o' + + addi $t0, $zero, 32 + sb $t0, 42($v0) # internal_5[34] = ' ' + + addi $t0, $zero, 108 + sb $t0, 43($v0) # internal_5[35] = 'l' + + addi $t0, $zero, 111 + sb $t0, 44($v0) # internal_5[36] = 'o' + + addi $t0, $zero, 119 + sb $t0, 45($v0) # internal_5[37] = 'w' + + addi $t0, $zero, 101 + sb $t0, 46($v0) # internal_5[38] = 'e' + + addi $t0, $zero, 114 + sb $t0, 47($v0) # internal_5[39] = 'r' + + addi $t0, $zero, 32 + sb $t0, 48($v0) # internal_5[40] = ' ' + + addi $t0, $zero, 114 + sb $t0, 49($v0) # internal_5[41] = 'r' + + addi $t0, $zero, 105 + sb $t0, 50($v0) # internal_5[42] = 'i' + + addi $t0, $zero, 103 + sb $t0, 51($v0) # internal_5[43] = 'g' + + addi $t0, $zero, 104 + sb $t0, 52($v0) # internal_5[44] = 'h' + + addi $t0, $zero, 116 + sb $t0, 53($v0) # internal_5[45] = 't' + + addi $t0, $zero, 10 + sb $t0, 54($v0) # internal_5[46] = '\n' + + sb $zero, 55($v0) # Null-terminator at the end of the string + + sw $v0, 600($sp) # internal_5 = "\t2: A slash from the upper left to lower right\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_5 + lw $t0, 612($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 608($sp) # internal_6 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 56 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 47 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_7[0] = '\t' + + addi $t0, $zero, 51 + sb $t0, 9($v0) # internal_7[1] = '3' + + addi $t0, $zero, 58 + sb $t0, 10($v0) # internal_7[2] = ':' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_7[3] = ' ' + + addi $t0, $zero, 65 + sb $t0, 12($v0) # internal_7[4] = 'A' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_7[5] = ' ' + + addi $t0, $zero, 115 + sb $t0, 14($v0) # internal_7[6] = 's' + + addi $t0, $zero, 108 + sb $t0, 15($v0) # internal_7[7] = 'l' + + addi $t0, $zero, 97 + sb $t0, 16($v0) # internal_7[8] = 'a' + + addi $t0, $zero, 115 + sb $t0, 17($v0) # internal_7[9] = 's' + + addi $t0, $zero, 104 + sb $t0, 18($v0) # internal_7[10] = 'h' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_7[11] = ' ' + + addi $t0, $zero, 102 + sb $t0, 20($v0) # internal_7[12] = 'f' + + addi $t0, $zero, 114 + sb $t0, 21($v0) # internal_7[13] = 'r' + + addi $t0, $zero, 111 + sb $t0, 22($v0) # internal_7[14] = 'o' + + addi $t0, $zero, 109 + sb $t0, 23($v0) # internal_7[15] = 'm' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_7[16] = ' ' + + addi $t0, $zero, 116 + sb $t0, 25($v0) # internal_7[17] = 't' + + addi $t0, $zero, 104 + sb $t0, 26($v0) # internal_7[18] = 'h' + + addi $t0, $zero, 101 + sb $t0, 27($v0) # internal_7[19] = 'e' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_7[20] = ' ' + + addi $t0, $zero, 117 + sb $t0, 29($v0) # internal_7[21] = 'u' + + addi $t0, $zero, 112 + sb $t0, 30($v0) # internal_7[22] = 'p' + + addi $t0, $zero, 112 + sb $t0, 31($v0) # internal_7[23] = 'p' + + addi $t0, $zero, 101 + sb $t0, 32($v0) # internal_7[24] = 'e' + + addi $t0, $zero, 114 + sb $t0, 33($v0) # internal_7[25] = 'r' + + addi $t0, $zero, 32 + sb $t0, 34($v0) # internal_7[26] = ' ' + + addi $t0, $zero, 114 + sb $t0, 35($v0) # internal_7[27] = 'r' + + addi $t0, $zero, 105 + sb $t0, 36($v0) # internal_7[28] = 'i' + + addi $t0, $zero, 103 + sb $t0, 37($v0) # internal_7[29] = 'g' + + addi $t0, $zero, 104 + sb $t0, 38($v0) # internal_7[30] = 'h' + + addi $t0, $zero, 116 + sb $t0, 39($v0) # internal_7[31] = 't' + + addi $t0, $zero, 32 + sb $t0, 40($v0) # internal_7[32] = ' ' + + addi $t0, $zero, 116 + sb $t0, 41($v0) # internal_7[33] = 't' + + addi $t0, $zero, 111 + sb $t0, 42($v0) # internal_7[34] = 'o' + + addi $t0, $zero, 32 + sb $t0, 43($v0) # internal_7[35] = ' ' + + addi $t0, $zero, 108 + sb $t0, 44($v0) # internal_7[36] = 'l' + + addi $t0, $zero, 111 + sb $t0, 45($v0) # internal_7[37] = 'o' + + addi $t0, $zero, 119 + sb $t0, 46($v0) # internal_7[38] = 'w' + + addi $t0, $zero, 101 + sb $t0, 47($v0) # internal_7[39] = 'e' + + addi $t0, $zero, 114 + sb $t0, 48($v0) # internal_7[40] = 'r' + + addi $t0, $zero, 32 + sb $t0, 49($v0) # internal_7[41] = ' ' + + addi $t0, $zero, 108 + sb $t0, 50($v0) # internal_7[42] = 'l' + + addi $t0, $zero, 101 + sb $t0, 51($v0) # internal_7[43] = 'e' + + addi $t0, $zero, 102 + sb $t0, 52($v0) # internal_7[44] = 'f' + + addi $t0, $zero, 116 + sb $t0, 53($v0) # internal_7[45] = 't' + + addi $t0, $zero, 10 + sb $t0, 54($v0) # internal_7[46] = '\n' + + sb $zero, 55($v0) # Null-terminator at the end of the string + + sw $v0, 592($sp) # internal_7 = "\t3: A slash from the upper right to lower left\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_7 + lw $t0, 604($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 600($sp) # internal_8 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 18 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_9[0] = '\t' + + addi $t0, $zero, 52 + sb $t0, 9($v0) # internal_9[1] = '4' + + addi $t0, $zero, 58 + sb $t0, 10($v0) # internal_9[2] = ':' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_9[3] = ' ' + + addi $t0, $zero, 65 + sb $t0, 12($v0) # internal_9[4] = 'A' + + addi $t0, $zero, 110 + sb $t0, 13($v0) # internal_9[5] = 'n' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_9[6] = ' ' + + addi $t0, $zero, 88 + sb $t0, 15($v0) # internal_9[7] = 'X' + + addi $t0, $zero, 10 + sb $t0, 16($v0) # internal_9[8] = '\n' + + sb $zero, 17($v0) # Null-terminator at the end of the string + + sw $v0, 584($sp) # internal_9 = "\t4: An X\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_9 + lw $t0, 596($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 592($sp) # internal_10 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 34 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 25 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_11[0] = '\t' + + addi $t0, $zero, 53 + sb $t0, 9($v0) # internal_11[1] = '5' + + addi $t0, $zero, 58 + sb $t0, 10($v0) # internal_11[2] = ':' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_11[3] = ' ' + + addi $t0, $zero, 65 + sb $t0, 12($v0) # internal_11[4] = 'A' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_11[5] = ' ' + + addi $t0, $zero, 103 + sb $t0, 14($v0) # internal_11[6] = 'g' + + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_11[7] = 'r' + + addi $t0, $zero, 101 + sb $t0, 16($v0) # internal_11[8] = 'e' + + addi $t0, $zero, 97 + sb $t0, 17($v0) # internal_11[9] = 'a' + + addi $t0, $zero, 116 + sb $t0, 18($v0) # internal_11[10] = 't' + + addi $t0, $zero, 101 + sb $t0, 19($v0) # internal_11[11] = 'e' + + addi $t0, $zero, 114 + sb $t0, 20($v0) # internal_11[12] = 'r' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_11[13] = ' ' + + addi $t0, $zero, 116 + sb $t0, 22($v0) # internal_11[14] = 't' + + addi $t0, $zero, 104 + sb $t0, 23($v0) # internal_11[15] = 'h' + + addi $t0, $zero, 97 + sb $t0, 24($v0) # internal_11[16] = 'a' + + addi $t0, $zero, 110 + sb $t0, 25($v0) # internal_11[17] = 'n' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_11[18] = ' ' + + addi $t0, $zero, 115 + sb $t0, 27($v0) # internal_11[19] = 's' + + addi $t0, $zero, 105 + sb $t0, 28($v0) # internal_11[20] = 'i' + + addi $t0, $zero, 103 + sb $t0, 29($v0) # internal_11[21] = 'g' + + addi $t0, $zero, 110 + sb $t0, 30($v0) # internal_11[22] = 'n' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_11[23] = ' ' + + addi $t0, $zero, 10 + sb $t0, 32($v0) # internal_11[24] = '\n' + + sb $zero, 33($v0) # Null-terminator at the end of the string + + sw $v0, 576($sp) # internal_11 = "\t5: A greater than sign \n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_11 + lw $t0, 588($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 584($sp) # internal_12 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 30 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 21 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_13[0] = '\t' + + addi $t0, $zero, 54 + sb $t0, 9($v0) # internal_13[1] = '6' + + addi $t0, $zero, 58 + sb $t0, 10($v0) # internal_13[2] = ':' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_13[3] = ' ' + + addi $t0, $zero, 65 + sb $t0, 12($v0) # internal_13[4] = 'A' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_13[5] = ' ' + + addi $t0, $zero, 108 + sb $t0, 14($v0) # internal_13[6] = 'l' + + addi $t0, $zero, 101 + sb $t0, 15($v0) # internal_13[7] = 'e' + + addi $t0, $zero, 115 + sb $t0, 16($v0) # internal_13[8] = 's' + + addi $t0, $zero, 115 + sb $t0, 17($v0) # internal_13[9] = 's' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_13[10] = ' ' + + addi $t0, $zero, 116 + sb $t0, 19($v0) # internal_13[11] = 't' + + addi $t0, $zero, 104 + sb $t0, 20($v0) # internal_13[12] = 'h' + + addi $t0, $zero, 97 + sb $t0, 21($v0) # internal_13[13] = 'a' + + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_13[14] = 'n' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_13[15] = ' ' + + addi $t0, $zero, 115 + sb $t0, 24($v0) # internal_13[16] = 's' + + addi $t0, $zero, 105 + sb $t0, 25($v0) # internal_13[17] = 'i' + + addi $t0, $zero, 103 + sb $t0, 26($v0) # internal_13[18] = 'g' + + addi $t0, $zero, 110 + sb $t0, 27($v0) # internal_13[19] = 'n' + + addi $t0, $zero, 10 + sb $t0, 28($v0) # internal_13[20] = '\n' + + sb $zero, 29($v0) # Null-terminator at the end of the string + + sw $v0, 568($sp) # internal_13 = "\t6: A less than sign\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_13 + lw $t0, 580($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 576($sp) # internal_14 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 36 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 27 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_15[0] = '\t' + + addi $t0, $zero, 55 + sb $t0, 9($v0) # internal_15[1] = '7' + + addi $t0, $zero, 58 + sb $t0, 10($v0) # internal_15[2] = ':' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_15[3] = ' ' + + addi $t0, $zero, 84 + sb $t0, 12($v0) # internal_15[4] = 'T' + + addi $t0, $zero, 119 + sb $t0, 13($v0) # internal_15[5] = 'w' + + addi $t0, $zero, 111 + sb $t0, 14($v0) # internal_15[6] = 'o' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_15[7] = ' ' + + addi $t0, $zero, 103 + sb $t0, 16($v0) # internal_15[8] = 'g' + + addi $t0, $zero, 114 + sb $t0, 17($v0) # internal_15[9] = 'r' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_15[10] = 'e' + + addi $t0, $zero, 97 + sb $t0, 19($v0) # internal_15[11] = 'a' + + addi $t0, $zero, 116 + sb $t0, 20($v0) # internal_15[12] = 't' + + addi $t0, $zero, 101 + sb $t0, 21($v0) # internal_15[13] = 'e' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_15[14] = 'r' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_15[15] = ' ' + + addi $t0, $zero, 116 + sb $t0, 24($v0) # internal_15[16] = 't' + + addi $t0, $zero, 104 + sb $t0, 25($v0) # internal_15[17] = 'h' + + addi $t0, $zero, 97 + sb $t0, 26($v0) # internal_15[18] = 'a' + + addi $t0, $zero, 110 + sb $t0, 27($v0) # internal_15[19] = 'n' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_15[20] = ' ' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_15[21] = 's' + + addi $t0, $zero, 105 + sb $t0, 30($v0) # internal_15[22] = 'i' + + addi $t0, $zero, 103 + sb $t0, 31($v0) # internal_15[23] = 'g' + + addi $t0, $zero, 110 + sb $t0, 32($v0) # internal_15[24] = 'n' + + addi $t0, $zero, 115 + sb $t0, 33($v0) # internal_15[25] = 's' + + addi $t0, $zero, 10 + sb $t0, 34($v0) # internal_15[26] = '\n' + + sb $zero, 35($v0) # Null-terminator at the end of the string + + sw $v0, 560($sp) # internal_15 = "\t7: Two greater than signs\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_15 + lw $t0, 572($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 568($sp) # internal_16 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 24 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_17[0] = '\t' + + addi $t0, $zero, 56 + sb $t0, 9($v0) # internal_17[1] = '8' + + addi $t0, $zero, 58 + sb $t0, 10($v0) # internal_17[2] = ':' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_17[3] = ' ' + + addi $t0, $zero, 84 + sb $t0, 12($v0) # internal_17[4] = 'T' + + addi $t0, $zero, 119 + sb $t0, 13($v0) # internal_17[5] = 'w' + + addi $t0, $zero, 111 + sb $t0, 14($v0) # internal_17[6] = 'o' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_17[7] = ' ' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_17[8] = 'l' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_17[9] = 'e' + + addi $t0, $zero, 115 + sb $t0, 18($v0) # internal_17[10] = 's' + + addi $t0, $zero, 115 + sb $t0, 19($v0) # internal_17[11] = 's' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_17[12] = ' ' + + addi $t0, $zero, 116 + sb $t0, 21($v0) # internal_17[13] = 't' + + addi $t0, $zero, 104 + sb $t0, 22($v0) # internal_17[14] = 'h' + + addi $t0, $zero, 97 + sb $t0, 23($v0) # internal_17[15] = 'a' + + addi $t0, $zero, 110 + sb $t0, 24($v0) # internal_17[16] = 'n' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_17[17] = ' ' + + addi $t0, $zero, 115 + sb $t0, 26($v0) # internal_17[18] = 's' + + addi $t0, $zero, 105 + sb $t0, 27($v0) # internal_17[19] = 'i' + + addi $t0, $zero, 103 + sb $t0, 28($v0) # internal_17[20] = 'g' + + addi $t0, $zero, 110 + sb $t0, 29($v0) # internal_17[21] = 'n' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_17[22] = 's' + + addi $t0, $zero, 10 + sb $t0, 31($v0) # internal_17[23] = '\n' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 552($sp) # internal_17 = "\t8: Two less than signs\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_17 + lw $t0, 564($sp) + sw $t0, 0($sp) # Storing internal_17 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 560($sp) # internal_18 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 19 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_19[0] = '\t' + + addi $t0, $zero, 57 + sb $t0, 9($v0) # internal_19[1] = '9' + + addi $t0, $zero, 58 + sb $t0, 10($v0) # internal_19[2] = ':' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_19[3] = ' ' + + addi $t0, $zero, 65 + sb $t0, 12($v0) # internal_19[4] = 'A' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_19[5] = ' ' + + addi $t0, $zero, 39 + sb $t0, 14($v0) # internal_19[6] = ''' + + addi $t0, $zero, 86 + sb $t0, 15($v0) # internal_19[7] = 'V' + + addi $t0, $zero, 39 + sb $t0, 16($v0) # internal_19[8] = ''' + + addi $t0, $zero, 10 + sb $t0, 17($v0) # internal_19[9] = '\n' + + sb $zero, 18($v0) # Null-terminator at the end of the string + + sw $v0, 544($sp) # internal_19 = "\t9: A 'V'\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_19 + lw $t0, 556($sp) + sw $t0, 0($sp) # Storing internal_19 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 552($sp) # internal_20 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 20 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_21[0] = '\t' + + addi $t0, $zero, 49 + sb $t0, 9($v0) # internal_21[1] = '1' + + addi $t0, $zero, 48 + sb $t0, 10($v0) # internal_21[2] = '0' + + addi $t0, $zero, 58 + sb $t0, 11($v0) # internal_21[3] = ':' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_21[4] = ' ' + + addi $t0, $zero, 65 + sb $t0, 13($v0) # internal_21[5] = 'A' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_21[6] = 'n' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_21[7] = ' ' + + addi $t0, $zero, 105 + sb $t0, 16($v0) # internal_21[8] = 'i' + + addi $t0, $zero, 110 + sb $t0, 17($v0) # internal_21[9] = 'n' + + addi $t0, $zero, 118 + sb $t0, 18($v0) # internal_21[10] = 'v' + + addi $t0, $zero, 101 + sb $t0, 19($v0) # internal_21[11] = 'e' + + addi $t0, $zero, 114 + sb $t0, 20($v0) # internal_21[12] = 'r' + + addi $t0, $zero, 115 + sb $t0, 21($v0) # internal_21[13] = 's' + + addi $t0, $zero, 101 + sb $t0, 22($v0) # internal_21[14] = 'e' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_21[15] = ' ' + + addi $t0, $zero, 39 + sb $t0, 24($v0) # internal_21[16] = ''' + + addi $t0, $zero, 86 + sb $t0, 25($v0) # internal_21[17] = 'V' + + addi $t0, $zero, 39 + sb $t0, 26($v0) # internal_21[18] = ''' + + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_21[19] = '\n' + + sb $zero, 28($v0) # Null-terminator at the end of the string + + sw $v0, 536($sp) # internal_21 = "\t10: An inverse 'V'\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_21 + lw $t0, 548($sp) + sw $t0, 0($sp) # Storing internal_21 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 544($sp) # internal_22 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 40 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 31 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_23[0] = '\t' + + addi $t0, $zero, 49 + sb $t0, 9($v0) # internal_23[1] = '1' + + addi $t0, $zero, 49 + sb $t0, 10($v0) # internal_23[2] = '1' + + addi $t0, $zero, 58 + sb $t0, 11($v0) # internal_23[3] = ':' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_23[4] = ' ' + + addi $t0, $zero, 78 + sb $t0, 13($v0) # internal_23[5] = 'N' + + addi $t0, $zero, 117 + sb $t0, 14($v0) # internal_23[6] = 'u' + + addi $t0, $zero, 109 + sb $t0, 15($v0) # internal_23[7] = 'm' + + addi $t0, $zero, 98 + sb $t0, 16($v0) # internal_23[8] = 'b' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_23[9] = 'e' + + addi $t0, $zero, 114 + sb $t0, 18($v0) # internal_23[10] = 'r' + + addi $t0, $zero, 115 + sb $t0, 19($v0) # internal_23[11] = 's' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_23[12] = ' ' + + addi $t0, $zero, 57 + sb $t0, 21($v0) # internal_23[13] = '9' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_23[14] = ' ' + + addi $t0, $zero, 97 + sb $t0, 23($v0) # internal_23[15] = 'a' + + addi $t0, $zero, 110 + sb $t0, 24($v0) # internal_23[16] = 'n' + + addi $t0, $zero, 100 + sb $t0, 25($v0) # internal_23[17] = 'd' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_23[18] = ' ' + + addi $t0, $zero, 49 + sb $t0, 27($v0) # internal_23[19] = '1' + + addi $t0, $zero, 48 + sb $t0, 28($v0) # internal_23[20] = '0' + + addi $t0, $zero, 32 + sb $t0, 29($v0) # internal_23[21] = ' ' + + addi $t0, $zero, 99 + sb $t0, 30($v0) # internal_23[22] = 'c' + + addi $t0, $zero, 111 + sb $t0, 31($v0) # internal_23[23] = 'o' + + addi $t0, $zero, 109 + sb $t0, 32($v0) # internal_23[24] = 'm' + + addi $t0, $zero, 98 + sb $t0, 33($v0) # internal_23[25] = 'b' + + addi $t0, $zero, 105 + sb $t0, 34($v0) # internal_23[26] = 'i' + + addi $t0, $zero, 110 + sb $t0, 35($v0) # internal_23[27] = 'n' + + addi $t0, $zero, 101 + sb $t0, 36($v0) # internal_23[28] = 'e' + + addi $t0, $zero, 100 + sb $t0, 37($v0) # internal_23[29] = 'd' + + addi $t0, $zero, 10 + sb $t0, 38($v0) # internal_23[30] = '\n' + + sb $zero, 39($v0) # Null-terminator at the end of the string + + sw $v0, 528($sp) # internal_23 = "\t11: Numbers 9 and 10 combined\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_23 + lw $t0, 540($sp) + sw $t0, 0($sp) # Storing internal_23 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 536($sp) # internal_24 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 26 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 17 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_25[0] = '\t' + + addi $t0, $zero, 49 + sb $t0, 9($v0) # internal_25[1] = '1' + + addi $t0, $zero, 50 + sb $t0, 10($v0) # internal_25[2] = '2' + + addi $t0, $zero, 58 + sb $t0, 11($v0) # internal_25[3] = ':' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_25[4] = ' ' + + addi $t0, $zero, 65 + sb $t0, 13($v0) # internal_25[5] = 'A' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_25[6] = ' ' + + addi $t0, $zero, 102 + sb $t0, 15($v0) # internal_25[7] = 'f' + + addi $t0, $zero, 117 + sb $t0, 16($v0) # internal_25[8] = 'u' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_25[9] = 'l' + + addi $t0, $zero, 108 + sb $t0, 18($v0) # internal_25[10] = 'l' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_25[11] = ' ' + + addi $t0, $zero, 103 + sb $t0, 20($v0) # internal_25[12] = 'g' + + addi $t0, $zero, 114 + sb $t0, 21($v0) # internal_25[13] = 'r' + + addi $t0, $zero, 105 + sb $t0, 22($v0) # internal_25[14] = 'i' + + addi $t0, $zero, 100 + sb $t0, 23($v0) # internal_25[15] = 'd' + + addi $t0, $zero, 10 + sb $t0, 24($v0) # internal_25[16] = '\n' + + sb $zero, 25($v0) # Null-terminator at the end of the string + + sw $v0, 520($sp) # internal_25 = "\t12: A full grid\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_25 + lw $t0, 532($sp) + sw $t0, 0($sp) # Storing internal_25 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 528($sp) # internal_26 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 11 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_27[0] = '\t' + + addi $t0, $zero, 49 + sb $t0, 9($v0) # internal_27[1] = '1' + + addi $t0, $zero, 51 + sb $t0, 10($v0) # internal_27[2] = '3' + + addi $t0, $zero, 58 + sb $t0, 11($v0) # internal_27[3] = ':' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_27[4] = ' ' + + addi $t0, $zero, 65 + sb $t0, 13($v0) # internal_27[5] = 'A' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_27[6] = ' ' + + addi $t0, $zero, 39 + sb $t0, 15($v0) # internal_27[7] = ''' + + addi $t0, $zero, 84 + sb $t0, 16($v0) # internal_27[8] = 'T' + + addi $t0, $zero, 39 + sb $t0, 17($v0) # internal_27[9] = ''' + + addi $t0, $zero, 10 + sb $t0, 18($v0) # internal_27[10] = '\n' + + sb $zero, 19($v0) # Null-terminator at the end of the string + + sw $v0, 512($sp) # internal_27 = "\t13: A 'T'\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_27 + lw $t0, 524($sp) + sw $t0, 0($sp) # Storing internal_27 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 520($sp) # internal_28 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 25 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 16 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_29[0] = '\t' + + addi $t0, $zero, 49 + sb $t0, 9($v0) # internal_29[1] = '1' + + addi $t0, $zero, 52 + sb $t0, 10($v0) # internal_29[2] = '4' + + addi $t0, $zero, 58 + sb $t0, 11($v0) # internal_29[3] = ':' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_29[4] = ' ' + + addi $t0, $zero, 65 + sb $t0, 13($v0) # internal_29[5] = 'A' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_29[6] = ' ' + + addi $t0, $zero, 112 + sb $t0, 15($v0) # internal_29[7] = 'p' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_29[8] = 'l' + + addi $t0, $zero, 117 + sb $t0, 17($v0) # internal_29[9] = 'u' + + addi $t0, $zero, 115 + sb $t0, 18($v0) # internal_29[10] = 's' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_29[11] = ' ' + + addi $t0, $zero, 39 + sb $t0, 20($v0) # internal_29[12] = ''' + + addi $t0, $zero, 43 + sb $t0, 21($v0) # internal_29[13] = '+' + + addi $t0, $zero, 39 + sb $t0, 22($v0) # internal_29[14] = ''' + + addi $t0, $zero, 10 + sb $t0, 23($v0) # internal_29[15] = '\n' + + sb $zero, 24($v0) # Null-terminator at the end of the string + + sw $v0, 504($sp) # internal_29 = "\t14: A plus '+'\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_29 + lw $t0, 516($sp) + sw $t0, 0($sp) # Storing internal_29 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 512($sp) # internal_30 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 11 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_31[0] = '\t' + + addi $t0, $zero, 49 + sb $t0, 9($v0) # internal_31[1] = '1' + + addi $t0, $zero, 53 + sb $t0, 10($v0) # internal_31[2] = '5' + + addi $t0, $zero, 58 + sb $t0, 11($v0) # internal_31[3] = ':' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_31[4] = ' ' + + addi $t0, $zero, 65 + sb $t0, 13($v0) # internal_31[5] = 'A' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_31[6] = ' ' + + addi $t0, $zero, 39 + sb $t0, 15($v0) # internal_31[7] = ''' + + addi $t0, $zero, 87 + sb $t0, 16($v0) # internal_31[8] = 'W' + + addi $t0, $zero, 39 + sb $t0, 17($v0) # internal_31[9] = ''' + + addi $t0, $zero, 10 + sb $t0, 18($v0) # internal_31[10] = '\n' + + sb $zero, 19($v0) # Null-terminator at the end of the string + + sw $v0, 496($sp) # internal_31 = "\t15: A 'W'\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_31 + lw $t0, 508($sp) + sw $t0, 0($sp) # Storing internal_31 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 504($sp) # internal_32 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_33[0] = '\t' + + addi $t0, $zero, 49 + sb $t0, 9($v0) # internal_33[1] = '1' + + addi $t0, $zero, 54 + sb $t0, 10($v0) # internal_33[2] = '6' + + addi $t0, $zero, 58 + sb $t0, 11($v0) # internal_33[3] = ':' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_33[4] = ' ' + + addi $t0, $zero, 65 + sb $t0, 13($v0) # internal_33[5] = 'A' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_33[6] = 'n' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_33[7] = ' ' + + addi $t0, $zero, 39 + sb $t0, 16($v0) # internal_33[8] = ''' + + addi $t0, $zero, 77 + sb $t0, 17($v0) # internal_33[9] = 'M' + + addi $t0, $zero, 39 + sb $t0, 18($v0) # internal_33[10] = ''' + + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_33[11] = '\n' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 488($sp) # internal_33 = "\t16: An 'M'\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_33 + lw $t0, 500($sp) + sw $t0, 0($sp) # Storing internal_33 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 496($sp) # internal_34 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_35[0] = '\t' + + addi $t0, $zero, 49 + sb $t0, 9($v0) # internal_35[1] = '1' + + addi $t0, $zero, 55 + sb $t0, 10($v0) # internal_35[2] = '7' + + addi $t0, $zero, 58 + sb $t0, 11($v0) # internal_35[3] = ':' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_35[4] = ' ' + + addi $t0, $zero, 65 + sb $t0, 13($v0) # internal_35[5] = 'A' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_35[6] = 'n' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_35[7] = ' ' + + addi $t0, $zero, 39 + sb $t0, 16($v0) # internal_35[8] = ''' + + addi $t0, $zero, 69 + sb $t0, 17($v0) # internal_35[9] = 'E' + + addi $t0, $zero, 39 + sb $t0, 18($v0) # internal_35[10] = ''' + + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_35[11] = '\n' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 480($sp) # internal_35 = "\t17: An 'E'\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_35 + lw $t0, 492($sp) + sw $t0, 0($sp) # Storing internal_35 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 488($sp) # internal_36 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 11 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_37[0] = '\t' + + addi $t0, $zero, 49 + sb $t0, 9($v0) # internal_37[1] = '1' + + addi $t0, $zero, 56 + sb $t0, 10($v0) # internal_37[2] = '8' + + addi $t0, $zero, 58 + sb $t0, 11($v0) # internal_37[3] = ':' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_37[4] = ' ' + + addi $t0, $zero, 65 + sb $t0, 13($v0) # internal_37[5] = 'A' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_37[6] = ' ' + + addi $t0, $zero, 39 + sb $t0, 15($v0) # internal_37[7] = ''' + + addi $t0, $zero, 51 + sb $t0, 16($v0) # internal_37[8] = '3' + + addi $t0, $zero, 39 + sb $t0, 17($v0) # internal_37[9] = ''' + + addi $t0, $zero, 10 + sb $t0, 18($v0) # internal_37[10] = '\n' + + sb $zero, 19($v0) # Null-terminator at the end of the string + + sw $v0, 472($sp) # internal_37 = "\t18: A '3'\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_37 + lw $t0, 484($sp) + sw $t0, 0($sp) # Storing internal_37 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 480($sp) # internal_38 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_39[0] = '\t' + + addi $t0, $zero, 49 + sb $t0, 9($v0) # internal_39[1] = '1' + + addi $t0, $zero, 57 + sb $t0, 10($v0) # internal_39[2] = '9' + + addi $t0, $zero, 58 + sb $t0, 11($v0) # internal_39[3] = ':' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_39[4] = ' ' + + addi $t0, $zero, 65 + sb $t0, 13($v0) # internal_39[5] = 'A' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_39[6] = 'n' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_39[7] = ' ' + + addi $t0, $zero, 39 + sb $t0, 16($v0) # internal_39[8] = ''' + + addi $t0, $zero, 79 + sb $t0, 17($v0) # internal_39[9] = 'O' + + addi $t0, $zero, 39 + sb $t0, 18($v0) # internal_39[10] = ''' + + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_39[11] = '\n' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 464($sp) # internal_39 = "\t19: An 'O'\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_39 + lw $t0, 476($sp) + sw $t0, 0($sp) # Storing internal_39 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 472($sp) # internal_40 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_41[0] = '\t' + + addi $t0, $zero, 50 + sb $t0, 9($v0) # internal_41[1] = '2' + + addi $t0, $zero, 48 + sb $t0, 10($v0) # internal_41[2] = '0' + + addi $t0, $zero, 58 + sb $t0, 11($v0) # internal_41[3] = ':' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_41[4] = ' ' + + addi $t0, $zero, 65 + sb $t0, 13($v0) # internal_41[5] = 'A' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_41[6] = 'n' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_41[7] = ' ' + + addi $t0, $zero, 39 + sb $t0, 16($v0) # internal_41[8] = ''' + + addi $t0, $zero, 56 + sb $t0, 17($v0) # internal_41[9] = '8' + + addi $t0, $zero, 39 + sb $t0, 18($v0) # internal_41[10] = ''' + + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_41[11] = '\n' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 456($sp) # internal_41 = "\t20: An '8'\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_41 + lw $t0, 468($sp) + sw $t0, 0($sp) # Storing internal_41 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 464($sp) # internal_42 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_43[0] = '\t' + + addi $t0, $zero, 50 + sb $t0, 9($v0) # internal_43[1] = '2' + + addi $t0, $zero, 49 + sb $t0, 10($v0) # internal_43[2] = '1' + + addi $t0, $zero, 58 + sb $t0, 11($v0) # internal_43[3] = ':' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_43[4] = ' ' + + addi $t0, $zero, 65 + sb $t0, 13($v0) # internal_43[5] = 'A' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_43[6] = 'n' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_43[7] = ' ' + + addi $t0, $zero, 39 + sb $t0, 16($v0) # internal_43[8] = ''' + + addi $t0, $zero, 83 + sb $t0, 17($v0) # internal_43[9] = 'S' + + addi $t0, $zero, 39 + sb $t0, 18($v0) # internal_43[10] = ''' + + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_43[11] = '\n' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 448($sp) # internal_43 = "\t21: An 'S'\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_43 + lw $t0, 460($sp) + sw $t0, 0($sp) # Storing internal_43 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 456($sp) # internal_44 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 24 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 15 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 89 + sb $t0, 8($v0) # internal_45[0] = 'Y' + + addi $t0, $zero, 111 + sb $t0, 9($v0) # internal_45[1] = 'o' + + addi $t0, $zero, 117 + sb $t0, 10($v0) # internal_45[2] = 'u' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_45[3] = 'r' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_45[4] = ' ' + + addi $t0, $zero, 99 + sb $t0, 13($v0) # internal_45[5] = 'c' + + addi $t0, $zero, 104 + sb $t0, 14($v0) # internal_45[6] = 'h' + + addi $t0, $zero, 111 + sb $t0, 15($v0) # internal_45[7] = 'o' + + addi $t0, $zero, 105 + sb $t0, 16($v0) # internal_45[8] = 'i' + + addi $t0, $zero, 99 + sb $t0, 17($v0) # internal_45[9] = 'c' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_45[10] = 'e' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_45[11] = ' ' + + addi $t0, $zero, 61 + sb $t0, 20($v0) # internal_45[12] = '=' + + addi $t0, $zero, 62 + sb $t0, 21($v0) # internal_45[13] = '>' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_45[14] = ' ' + + sb $zero, 23($v0) # Null-terminator at the end of the string + + sw $v0, 440($sp) # internal_45 = "Your choice => " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_45 + lw $t0, 452($sp) + sw $t0, 0($sp) # Storing internal_45 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 448($sp) # internal_46 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 632($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_in_int_at_IO + jal function_in_int_at_IO + lw $ra, 4($sp) + sw $v1, 440($sp) # internal_47 = result of function_in_int_at_IO + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 432($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 620($sp) + j end_assign + not_is_Bool_or_Int: + # num = internal_47 + lw $t0, 432($sp) + sw $t0, 620($sp) + end_assign: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_48[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 428($sp) # internal_48 = "\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_48 + lw $t0, 440($sp) + sw $t0, 0($sp) # Storing internal_48 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 436($sp) # internal_49 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 416($sp) # internal_51 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 412($sp) # internal_52 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 632($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_52 + lw $t0, 424($sp) + sw $t0, 0($sp) # Storing internal_52 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 420($sp) # internal_53 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 408($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 416($sp) + j end_assign + not_is_Bool_or_Int: + # internal_51 = internal_53 + lw $t0, 408($sp) + sw $t0, 416($sp) + end_assign: + + # If internal_51 then goto then_8789948671922 + lw $t0, 416($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948671922 + + # Jumping to else_8789948671922 + j else_8789948671922 + + then_8789948671922: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 20 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_54[0] = ' ' + + addi $t0, $zero, 88 + sb $t0, 9($v0) # internal_54[1] = 'X' + + addi $t0, $zero, 88 + sb $t0, 10($v0) # internal_54[2] = 'X' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_54[3] = ' ' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_54[4] = ' ' + + addi $t0, $zero, 88 + sb $t0, 13($v0) # internal_54[5] = 'X' + + addi $t0, $zero, 88 + sb $t0, 14($v0) # internal_54[6] = 'X' + + addi $t0, $zero, 88 + sb $t0, 15($v0) # internal_54[7] = 'X' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_54[8] = 'X' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_54[9] = ' ' + + addi $t0, $zero, 88 + sb $t0, 18($v0) # internal_54[10] = 'X' + + addi $t0, $zero, 88 + sb $t0, 19($v0) # internal_54[11] = 'X' + + addi $t0, $zero, 88 + sb $t0, 20($v0) # internal_54[12] = 'X' + + addi $t0, $zero, 88 + sb $t0, 21($v0) # internal_54[13] = 'X' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_54[14] = ' ' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_54[15] = ' ' + + addi $t0, $zero, 88 + sb $t0, 24($v0) # internal_54[16] = 'X' + + addi $t0, $zero, 88 + sb $t0, 25($v0) # internal_54[17] = 'X' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_54[18] = ' ' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_54[19] = ' ' + + sb $zero, 28($v0) # Null-terminator at the end of the string + + sw $v0, 404($sp) # internal_54 = " XX XXXX XXXX XX " + + lw $t0, 404($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 420($sp) + j end_assign + not_is_Bool_or_Int: + # internal_50 = internal_54 + lw $t0, 404($sp) + sw $t0, 420($sp) + end_assign: + + # Jumping to endif_8789948671922 + j endif_8789948671922 + + else_8789948671922: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 396($sp) # internal_56 = address of allocated object Int + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 392($sp) # internal_57 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 632($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_57 + lw $t0, 404($sp) + sw $t0, 0($sp) # Storing internal_57 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 400($sp) # internal_58 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 388($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 396($sp) + j end_assign + not_is_Bool_or_Int: + # internal_56 = internal_58 + lw $t0, 388($sp) + sw $t0, 396($sp) + end_assign: + + # If internal_56 then goto then_8789948671916 + lw $t0, 396($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948671916 + + # Jumping to else_8789948671916 + j else_8789948671916 + + then_8789948671916: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 34 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 25 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_59[0] = ' ' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_59[1] = ' ' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_59[2] = ' ' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_59[3] = ' ' + + addi $t0, $zero, 88 + sb $t0, 12($v0) # internal_59[4] = 'X' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_59[5] = ' ' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_59[6] = ' ' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_59[7] = ' ' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_59[8] = 'X' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_59[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_59[10] = ' ' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_59[11] = ' ' + + addi $t0, $zero, 88 + sb $t0, 20($v0) # internal_59[12] = 'X' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_59[13] = ' ' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_59[14] = ' ' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_59[15] = ' ' + + addi $t0, $zero, 88 + sb $t0, 24($v0) # internal_59[16] = 'X' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_59[17] = ' ' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_59[18] = ' ' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_59[19] = ' ' + + addi $t0, $zero, 88 + sb $t0, 28($v0) # internal_59[20] = 'X' + + addi $t0, $zero, 32 + sb $t0, 29($v0) # internal_59[21] = ' ' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_59[22] = ' ' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_59[23] = ' ' + + addi $t0, $zero, 32 + sb $t0, 32($v0) # internal_59[24] = ' ' + + sb $zero, 33($v0) # Null-terminator at the end of the string + + sw $v0, 384($sp) # internal_59 = " X X X X X " + + lw $t0, 384($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 400($sp) + j end_assign + not_is_Bool_or_Int: + # internal_55 = internal_59 + lw $t0, 384($sp) + sw $t0, 400($sp) + end_assign: + + # Jumping to endif_8789948671916 + j endif_8789948671916 + + else_8789948671916: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 376($sp) # internal_61 = address of allocated object Int + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 372($sp) # internal_62 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 632($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_62 + lw $t0, 384($sp) + sw $t0, 0($sp) # Storing internal_62 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 380($sp) # internal_63 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 368($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 376($sp) + j end_assign + not_is_Bool_or_Int: + # internal_61 = internal_63 + lw $t0, 368($sp) + sw $t0, 376($sp) + end_assign: + + # If internal_61 then goto then_8789948671910 + lw $t0, 376($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948671910 + + # Jumping to else_8789948671910 + j else_8789948671910 + + then_8789948671910: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 34 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 25 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_64[0] = 'X' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_64[1] = ' ' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_64[2] = ' ' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_64[3] = ' ' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_64[4] = ' ' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_64[5] = ' ' + + addi $t0, $zero, 88 + sb $t0, 14($v0) # internal_64[6] = 'X' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_64[7] = ' ' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_64[8] = ' ' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_64[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_64[10] = ' ' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_64[11] = ' ' + + addi $t0, $zero, 88 + sb $t0, 20($v0) # internal_64[12] = 'X' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_64[13] = ' ' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_64[14] = ' ' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_64[15] = ' ' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_64[16] = ' ' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_64[17] = ' ' + + addi $t0, $zero, 88 + sb $t0, 26($v0) # internal_64[18] = 'X' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_64[19] = ' ' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_64[20] = ' ' + + addi $t0, $zero, 32 + sb $t0, 29($v0) # internal_64[21] = ' ' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_64[22] = ' ' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_64[23] = ' ' + + addi $t0, $zero, 88 + sb $t0, 32($v0) # internal_64[24] = 'X' + + sb $zero, 33($v0) # Null-terminator at the end of the string + + sw $v0, 364($sp) # internal_64 = "X X X X X" + + lw $t0, 364($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 380($sp) + j end_assign + not_is_Bool_or_Int: + # internal_60 = internal_64 + lw $t0, 364($sp) + sw $t0, 380($sp) + end_assign: + + # Jumping to endif_8789948671910 + j endif_8789948671910 + + else_8789948671910: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 356($sp) # internal_66 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 352($sp) # internal_67 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 632($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_67 + lw $t0, 364($sp) + sw $t0, 0($sp) # Storing internal_67 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 360($sp) # internal_68 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 348($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 356($sp) + j end_assign + not_is_Bool_or_Int: + # internal_66 = internal_68 + lw $t0, 348($sp) + sw $t0, 356($sp) + end_assign: + + # If internal_66 then goto then_8789948671904 + lw $t0, 356($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948671904 + + # Jumping to else_8789948671904 + j else_8789948671904 + + then_8789948671904: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 34 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 25 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_69[0] = 'X' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_69[1] = ' ' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_69[2] = ' ' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_69[3] = ' ' + + addi $t0, $zero, 88 + sb $t0, 12($v0) # internal_69[4] = 'X' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_69[5] = ' ' + + addi $t0, $zero, 88 + sb $t0, 14($v0) # internal_69[6] = 'X' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_69[7] = ' ' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_69[8] = 'X' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_69[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_69[10] = ' ' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_69[11] = ' ' + + addi $t0, $zero, 88 + sb $t0, 20($v0) # internal_69[12] = 'X' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_69[13] = ' ' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_69[14] = ' ' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_69[15] = ' ' + + addi $t0, $zero, 88 + sb $t0, 24($v0) # internal_69[16] = 'X' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_69[17] = ' ' + + addi $t0, $zero, 88 + sb $t0, 26($v0) # internal_69[18] = 'X' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_69[19] = ' ' + + addi $t0, $zero, 88 + sb $t0, 28($v0) # internal_69[20] = 'X' + + addi $t0, $zero, 32 + sb $t0, 29($v0) # internal_69[21] = ' ' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_69[22] = ' ' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_69[23] = ' ' + + addi $t0, $zero, 88 + sb $t0, 32($v0) # internal_69[24] = 'X' + + sb $zero, 33($v0) # Null-terminator at the end of the string + + sw $v0, 344($sp) # internal_69 = "X X X X X X X X X" + + lw $t0, 344($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 360($sp) + j end_assign + not_is_Bool_or_Int: + # internal_65 = internal_69 + lw $t0, 344($sp) + sw $t0, 360($sp) + end_assign: + + # Jumping to endif_8789948671904 + j endif_8789948671904 + + else_8789948671904: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 336($sp) # internal_71 = address of allocated object Int + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 332($sp) # internal_72 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 632($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_72 + lw $t0, 344($sp) + sw $t0, 0($sp) # Storing internal_72 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 340($sp) # internal_73 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 328($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 336($sp) + j end_assign + not_is_Bool_or_Int: + # internal_71 = internal_73 + lw $t0, 328($sp) + sw $t0, 336($sp) + end_assign: + + # If internal_71 then goto then_8789948671898 + lw $t0, 336($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948671898 + + # Jumping to else_8789948671898 + j else_8789948671898 + + then_8789948671898: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 34 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 25 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_74[0] = 'X' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_74[1] = ' ' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_74[2] = ' ' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_74[3] = ' ' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_74[4] = ' ' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_74[5] = ' ' + + addi $t0, $zero, 88 + sb $t0, 14($v0) # internal_74[6] = 'X' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_74[7] = ' ' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_74[8] = ' ' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_74[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_74[10] = ' ' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_74[11] = ' ' + + addi $t0, $zero, 88 + sb $t0, 20($v0) # internal_74[12] = 'X' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_74[13] = ' ' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_74[14] = ' ' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_74[15] = ' ' + + addi $t0, $zero, 88 + sb $t0, 24($v0) # internal_74[16] = 'X' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_74[17] = ' ' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_74[18] = ' ' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_74[19] = ' ' + + addi $t0, $zero, 88 + sb $t0, 28($v0) # internal_74[20] = 'X' + + addi $t0, $zero, 32 + sb $t0, 29($v0) # internal_74[21] = ' ' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_74[22] = ' ' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_74[23] = ' ' + + addi $t0, $zero, 32 + sb $t0, 32($v0) # internal_74[24] = ' ' + + sb $zero, 33($v0) # Null-terminator at the end of the string + + sw $v0, 324($sp) # internal_74 = "X X X X X " + + lw $t0, 324($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 340($sp) + j end_assign + not_is_Bool_or_Int: + # internal_70 = internal_74 + lw $t0, 324($sp) + sw $t0, 340($sp) + end_assign: + + # Jumping to endif_8789948671898 + j endif_8789948671898 + + else_8789948671898: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 316($sp) # internal_76 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 312($sp) # internal_77 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 632($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_77 + lw $t0, 324($sp) + sw $t0, 0($sp) # Storing internal_77 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 320($sp) # internal_78 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 308($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 316($sp) + j end_assign + not_is_Bool_or_Int: + # internal_76 = internal_78 + lw $t0, 308($sp) + sw $t0, 316($sp) + end_assign: + + # If internal_76 then goto then_8789948671892 + lw $t0, 316($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948671892 + + # Jumping to else_8789948671892 + j else_8789948671892 + + then_8789948671892: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 34 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 25 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_79[0] = ' ' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_79[1] = ' ' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_79[2] = ' ' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_79[3] = ' ' + + addi $t0, $zero, 88 + sb $t0, 12($v0) # internal_79[4] = 'X' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_79[5] = ' ' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_79[6] = ' ' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_79[7] = ' ' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_79[8] = 'X' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_79[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_79[10] = ' ' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_79[11] = ' ' + + addi $t0, $zero, 88 + sb $t0, 20($v0) # internal_79[12] = 'X' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_79[13] = ' ' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_79[14] = ' ' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_79[15] = ' ' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_79[16] = ' ' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_79[17] = ' ' + + addi $t0, $zero, 88 + sb $t0, 26($v0) # internal_79[18] = 'X' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_79[19] = ' ' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_79[20] = ' ' + + addi $t0, $zero, 32 + sb $t0, 29($v0) # internal_79[21] = ' ' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_79[22] = ' ' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_79[23] = ' ' + + addi $t0, $zero, 88 + sb $t0, 32($v0) # internal_79[24] = 'X' + + sb $zero, 33($v0) # Null-terminator at the end of the string + + sw $v0, 304($sp) # internal_79 = " X X X X X" + + lw $t0, 304($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 320($sp) + j end_assign + not_is_Bool_or_Int: + # internal_75 = internal_79 + lw $t0, 304($sp) + sw $t0, 320($sp) + end_assign: + + # Jumping to endif_8789948671892 + j endif_8789948671892 + + else_8789948671892: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 296($sp) # internal_81 = address of allocated object Int + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 292($sp) # internal_82 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 632($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_82 + lw $t0, 304($sp) + sw $t0, 0($sp) # Storing internal_82 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 300($sp) # internal_83 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 288($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 296($sp) + j end_assign + not_is_Bool_or_Int: + # internal_81 = internal_83 + lw $t0, 288($sp) + sw $t0, 296($sp) + end_assign: + + # If internal_81 then goto then_8789948671886 + lw $t0, 296($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948671886 + + # Jumping to else_8789948671886 + j else_8789948671886 + + then_8789948671886: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 20 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_84[0] = 'X' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_84[1] = ' ' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_84[2] = ' ' + + addi $t0, $zero, 88 + sb $t0, 11($v0) # internal_84[3] = 'X' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_84[4] = ' ' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_84[5] = ' ' + + addi $t0, $zero, 88 + sb $t0, 14($v0) # internal_84[6] = 'X' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_84[7] = ' ' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_84[8] = ' ' + + addi $t0, $zero, 88 + sb $t0, 17($v0) # internal_84[9] = 'X' + + addi $t0, $zero, 88 + sb $t0, 18($v0) # internal_84[10] = 'X' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_84[11] = ' ' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_84[12] = ' ' + + addi $t0, $zero, 88 + sb $t0, 21($v0) # internal_84[13] = 'X' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_84[14] = ' ' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_84[15] = ' ' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_84[16] = ' ' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_84[17] = ' ' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_84[18] = ' ' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_84[19] = ' ' + + sb $zero, 28($v0) # Null-terminator at the end of the string + + sw $v0, 284($sp) # internal_84 = "X X X XX X " + + lw $t0, 284($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 300($sp) + j end_assign + not_is_Bool_or_Int: + # internal_80 = internal_84 + lw $t0, 284($sp) + sw $t0, 300($sp) + end_assign: + + # Jumping to endif_8789948671886 + j endif_8789948671886 + + else_8789948671886: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 276($sp) # internal_86 = address of allocated object Int + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 272($sp) # internal_87 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 632($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_87 + lw $t0, 284($sp) + sw $t0, 0($sp) # Storing internal_87 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 280($sp) # internal_88 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 268($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 276($sp) + j end_assign + not_is_Bool_or_Int: + # internal_86 = internal_88 + lw $t0, 268($sp) + sw $t0, 276($sp) + end_assign: + + # If internal_86 then goto then_8789948671880 + lw $t0, 276($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948671880 + + # Jumping to else_8789948671880 + j else_8789948671880 + + then_8789948671880: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 20 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_89[0] = ' ' + + addi $t0, $zero, 88 + sb $t0, 9($v0) # internal_89[1] = 'X' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_89[2] = ' ' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_89[3] = ' ' + + addi $t0, $zero, 88 + sb $t0, 12($v0) # internal_89[4] = 'X' + + addi $t0, $zero, 88 + sb $t0, 13($v0) # internal_89[5] = 'X' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_89[6] = ' ' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_89[7] = ' ' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_89[8] = 'X' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_89[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_89[10] = ' ' + + addi $t0, $zero, 88 + sb $t0, 19($v0) # internal_89[11] = 'X' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_89[12] = ' ' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_89[13] = ' ' + + addi $t0, $zero, 88 + sb $t0, 22($v0) # internal_89[14] = 'X' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_89[15] = ' ' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_89[16] = ' ' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_89[17] = ' ' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_89[18] = ' ' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_89[19] = ' ' + + sb $zero, 28($v0) # Null-terminator at the end of the string + + sw $v0, 264($sp) # internal_89 = " X XX X X X " + + lw $t0, 264($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 280($sp) + j end_assign + not_is_Bool_or_Int: + # internal_85 = internal_89 + lw $t0, 264($sp) + sw $t0, 280($sp) + end_assign: + + # Jumping to endif_8789948671880 + j endif_8789948671880 + + else_8789948671880: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 256($sp) # internal_91 = address of allocated object Int + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 252($sp) # internal_92 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 632($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_92 + lw $t0, 264($sp) + sw $t0, 0($sp) # Storing internal_92 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 260($sp) # internal_93 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 248($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 256($sp) + j end_assign + not_is_Bool_or_Int: + # internal_91 = internal_93 + lw $t0, 248($sp) + sw $t0, 256($sp) + end_assign: + + # If internal_91 then goto then_8789948671874 + lw $t0, 256($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948671874 + + # Jumping to else_8789948671874 + j else_8789948671874 + + then_8789948671874: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 24 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 15 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_94[0] = 'X' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_94[1] = ' ' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_94[2] = ' ' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_94[3] = ' ' + + addi $t0, $zero, 88 + sb $t0, 12($v0) # internal_94[4] = 'X' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_94[5] = ' ' + + addi $t0, $zero, 88 + sb $t0, 14($v0) # internal_94[6] = 'X' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_94[7] = ' ' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_94[8] = 'X' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_94[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_94[10] = ' ' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_94[11] = ' ' + + addi $t0, $zero, 88 + sb $t0, 20($v0) # internal_94[12] = 'X' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_94[13] = ' ' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_94[14] = ' ' + + sb $zero, 23($v0) # Null-terminator at the end of the string + + sw $v0, 244($sp) # internal_94 = "X X X X X " + + lw $t0, 244($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 260($sp) + j end_assign + not_is_Bool_or_Int: + # internal_90 = internal_94 + lw $t0, 244($sp) + sw $t0, 260($sp) + end_assign: + + # Jumping to endif_8789948671874 + j endif_8789948671874 + + else_8789948671874: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 236($sp) # internal_96 = address of allocated object Int + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 232($sp) # internal_97 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 632($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_97 + lw $t0, 244($sp) + sw $t0, 0($sp) # Storing internal_97 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 240($sp) # internal_98 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 228($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 236($sp) + j end_assign + not_is_Bool_or_Int: + # internal_96 = internal_98 + lw $t0, 228($sp) + sw $t0, 236($sp) + end_assign: + + # If internal_96 then goto then_8789948671868 + lw $t0, 236($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948671868 + + # Jumping to else_8789948671868 + j else_8789948671868 + + then_8789948671868: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 24 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 15 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_99[0] = ' ' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_99[1] = ' ' + + addi $t0, $zero, 88 + sb $t0, 10($v0) # internal_99[2] = 'X' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_99[3] = ' ' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_99[4] = ' ' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_99[5] = ' ' + + addi $t0, $zero, 88 + sb $t0, 14($v0) # internal_99[6] = 'X' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_99[7] = ' ' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_99[8] = 'X' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_99[9] = ' ' + + addi $t0, $zero, 88 + sb $t0, 18($v0) # internal_99[10] = 'X' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_99[11] = ' ' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_99[12] = ' ' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_99[13] = ' ' + + addi $t0, $zero, 88 + sb $t0, 22($v0) # internal_99[14] = 'X' + + sb $zero, 23($v0) # Null-terminator at the end of the string + + sw $v0, 224($sp) # internal_99 = " X X X X X" + + lw $t0, 224($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 240($sp) + j end_assign + not_is_Bool_or_Int: + # internal_95 = internal_99 + lw $t0, 224($sp) + sw $t0, 240($sp) + end_assign: + + # Jumping to endif_8789948671868 + j endif_8789948671868 + + else_8789948671868: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 216($sp) # internal_101 = address of allocated object Int + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 212($sp) # internal_102 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 632($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_102 + lw $t0, 224($sp) + sw $t0, 0($sp) # Storing internal_102 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 220($sp) # internal_103 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 208($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 216($sp) + j end_assign + not_is_Bool_or_Int: + # internal_101 = internal_103 + lw $t0, 208($sp) + sw $t0, 216($sp) + end_assign: + + # If internal_101 then goto then_8789948671862 + lw $t0, 216($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948671862 + + # Jumping to else_8789948671862 + j else_8789948671862 + + then_8789948671862: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 24 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 15 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_104[0] = 'X' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_104[1] = ' ' + + addi $t0, $zero, 88 + sb $t0, 10($v0) # internal_104[2] = 'X' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_104[3] = ' ' + + addi $t0, $zero, 88 + sb $t0, 12($v0) # internal_104[4] = 'X' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_104[5] = ' ' + + addi $t0, $zero, 88 + sb $t0, 14($v0) # internal_104[6] = 'X' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_104[7] = ' ' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_104[8] = 'X' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_104[9] = ' ' + + addi $t0, $zero, 88 + sb $t0, 18($v0) # internal_104[10] = 'X' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_104[11] = ' ' + + addi $t0, $zero, 88 + sb $t0, 20($v0) # internal_104[12] = 'X' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_104[13] = ' ' + + addi $t0, $zero, 88 + sb $t0, 22($v0) # internal_104[14] = 'X' + + sb $zero, 23($v0) # Null-terminator at the end of the string + + sw $v0, 204($sp) # internal_104 = "X X X X X X X X" + + lw $t0, 204($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 220($sp) + j end_assign + not_is_Bool_or_Int: + # internal_100 = internal_104 + lw $t0, 204($sp) + sw $t0, 220($sp) + end_assign: + + # Jumping to endif_8789948671862 + j endif_8789948671862 + + else_8789948671862: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 196($sp) # internal_106 = address of allocated object Int + + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 192($sp) # internal_107 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 632($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_107 + lw $t0, 204($sp) + sw $t0, 0($sp) # Storing internal_107 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 200($sp) # internal_108 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 188($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 196($sp) + j end_assign + not_is_Bool_or_Int: + # internal_106 = internal_108 + lw $t0, 188($sp) + sw $t0, 196($sp) + end_assign: + + # If internal_106 then goto then_8789948671856 + lw $t0, 196($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948671856 + + # Jumping to else_8789948671856 + j else_8789948671856 + + then_8789948671856: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 34 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 25 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_109[0] = 'X' + + addi $t0, $zero, 88 + sb $t0, 9($v0) # internal_109[1] = 'X' + + addi $t0, $zero, 88 + sb $t0, 10($v0) # internal_109[2] = 'X' + + addi $t0, $zero, 88 + sb $t0, 11($v0) # internal_109[3] = 'X' + + addi $t0, $zero, 88 + sb $t0, 12($v0) # internal_109[4] = 'X' + + addi $t0, $zero, 88 + sb $t0, 13($v0) # internal_109[5] = 'X' + + addi $t0, $zero, 88 + sb $t0, 14($v0) # internal_109[6] = 'X' + + addi $t0, $zero, 88 + sb $t0, 15($v0) # internal_109[7] = 'X' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_109[8] = 'X' + + addi $t0, $zero, 88 + sb $t0, 17($v0) # internal_109[9] = 'X' + + addi $t0, $zero, 88 + sb $t0, 18($v0) # internal_109[10] = 'X' + + addi $t0, $zero, 88 + sb $t0, 19($v0) # internal_109[11] = 'X' + + addi $t0, $zero, 88 + sb $t0, 20($v0) # internal_109[12] = 'X' + + addi $t0, $zero, 88 + sb $t0, 21($v0) # internal_109[13] = 'X' + + addi $t0, $zero, 88 + sb $t0, 22($v0) # internal_109[14] = 'X' + + addi $t0, $zero, 88 + sb $t0, 23($v0) # internal_109[15] = 'X' + + addi $t0, $zero, 88 + sb $t0, 24($v0) # internal_109[16] = 'X' + + addi $t0, $zero, 88 + sb $t0, 25($v0) # internal_109[17] = 'X' + + addi $t0, $zero, 88 + sb $t0, 26($v0) # internal_109[18] = 'X' + + addi $t0, $zero, 88 + sb $t0, 27($v0) # internal_109[19] = 'X' + + addi $t0, $zero, 88 + sb $t0, 28($v0) # internal_109[20] = 'X' + + addi $t0, $zero, 88 + sb $t0, 29($v0) # internal_109[21] = 'X' + + addi $t0, $zero, 88 + sb $t0, 30($v0) # internal_109[22] = 'X' + + addi $t0, $zero, 88 + sb $t0, 31($v0) # internal_109[23] = 'X' + + addi $t0, $zero, 88 + sb $t0, 32($v0) # internal_109[24] = 'X' + + sb $zero, 33($v0) # Null-terminator at the end of the string + + sw $v0, 184($sp) # internal_109 = "XXXXXXXXXXXXXXXXXXXXXXXXX" + + lw $t0, 184($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 200($sp) + j end_assign + not_is_Bool_or_Int: + # internal_105 = internal_109 + lw $t0, 184($sp) + sw $t0, 200($sp) + end_assign: + + # Jumping to endif_8789948671856 + j endif_8789948671856 + + else_8789948671856: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 176($sp) # internal_111 = address of allocated object Int + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 172($sp) # internal_112 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 632($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_112 + lw $t0, 184($sp) + sw $t0, 0($sp) # Storing internal_112 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 180($sp) # internal_113 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 168($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 176($sp) + j end_assign + not_is_Bool_or_Int: + # internal_111 = internal_113 + lw $t0, 168($sp) + sw $t0, 176($sp) + end_assign: + + # If internal_111 then goto then_8789948671850 + lw $t0, 176($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948671850 + + # Jumping to else_8789948671850 + j else_8789948671850 + + then_8789948671850: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 34 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 25 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_114[0] = 'X' + + addi $t0, $zero, 88 + sb $t0, 9($v0) # internal_114[1] = 'X' + + addi $t0, $zero, 88 + sb $t0, 10($v0) # internal_114[2] = 'X' + + addi $t0, $zero, 88 + sb $t0, 11($v0) # internal_114[3] = 'X' + + addi $t0, $zero, 88 + sb $t0, 12($v0) # internal_114[4] = 'X' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_114[5] = ' ' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_114[6] = ' ' + + addi $t0, $zero, 88 + sb $t0, 15($v0) # internal_114[7] = 'X' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_114[8] = ' ' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_114[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_114[10] = ' ' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_114[11] = ' ' + + addi $t0, $zero, 88 + sb $t0, 20($v0) # internal_114[12] = 'X' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_114[13] = ' ' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_114[14] = ' ' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_114[15] = ' ' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_114[16] = ' ' + + addi $t0, $zero, 88 + sb $t0, 25($v0) # internal_114[17] = 'X' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_114[18] = ' ' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_114[19] = ' ' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_114[20] = ' ' + + addi $t0, $zero, 32 + sb $t0, 29($v0) # internal_114[21] = ' ' + + addi $t0, $zero, 88 + sb $t0, 30($v0) # internal_114[22] = 'X' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_114[23] = ' ' + + addi $t0, $zero, 32 + sb $t0, 32($v0) # internal_114[24] = ' ' + + sb $zero, 33($v0) # Null-terminator at the end of the string + + sw $v0, 164($sp) # internal_114 = "XXXXX X X X X " + + lw $t0, 164($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 180($sp) + j end_assign + not_is_Bool_or_Int: + # internal_110 = internal_114 + lw $t0, 164($sp) + sw $t0, 180($sp) + end_assign: + + # Jumping to endif_8789948671850 + j endif_8789948671850 + + else_8789948671850: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 156($sp) # internal_116 = address of allocated object Int + + # Allocating Int 14 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 14 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 152($sp) # internal_117 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 632($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_117 + lw $t0, 164($sp) + sw $t0, 0($sp) # Storing internal_117 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 160($sp) # internal_118 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 148($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 156($sp) + j end_assign + not_is_Bool_or_Int: + # internal_116 = internal_118 + lw $t0, 148($sp) + sw $t0, 156($sp) + end_assign: + + # If internal_116 then goto then_8789948671844 + lw $t0, 156($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948671844 + + # Jumping to else_8789948671844 + j else_8789948671844 + + then_8789948671844: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 34 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 25 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_119[0] = ' ' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_119[1] = ' ' + + addi $t0, $zero, 88 + sb $t0, 10($v0) # internal_119[2] = 'X' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_119[3] = ' ' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_119[4] = ' ' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_119[5] = ' ' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_119[6] = ' ' + + addi $t0, $zero, 88 + sb $t0, 15($v0) # internal_119[7] = 'X' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_119[8] = ' ' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_119[9] = ' ' + + addi $t0, $zero, 88 + sb $t0, 18($v0) # internal_119[10] = 'X' + + addi $t0, $zero, 88 + sb $t0, 19($v0) # internal_119[11] = 'X' + + addi $t0, $zero, 88 + sb $t0, 20($v0) # internal_119[12] = 'X' + + addi $t0, $zero, 88 + sb $t0, 21($v0) # internal_119[13] = 'X' + + addi $t0, $zero, 88 + sb $t0, 22($v0) # internal_119[14] = 'X' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_119[15] = ' ' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_119[16] = ' ' + + addi $t0, $zero, 88 + sb $t0, 25($v0) # internal_119[17] = 'X' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_119[18] = ' ' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_119[19] = ' ' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_119[20] = ' ' + + addi $t0, $zero, 32 + sb $t0, 29($v0) # internal_119[21] = ' ' + + addi $t0, $zero, 88 + sb $t0, 30($v0) # internal_119[22] = 'X' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_119[23] = ' ' + + addi $t0, $zero, 32 + sb $t0, 32($v0) # internal_119[24] = ' ' + + sb $zero, 33($v0) # Null-terminator at the end of the string + + sw $v0, 144($sp) # internal_119 = " X X XXXXX X X " + + lw $t0, 144($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 160($sp) + j end_assign + not_is_Bool_or_Int: + # internal_115 = internal_119 + lw $t0, 144($sp) + sw $t0, 160($sp) + end_assign: + + # Jumping to endif_8789948671844 + j endif_8789948671844 + + else_8789948671844: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_121 = address of allocated object Int + + # Allocating Int 15 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 15 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 132($sp) # internal_122 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 632($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_122 + lw $t0, 144($sp) + sw $t0, 0($sp) # Storing internal_122 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 140($sp) # internal_123 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 128($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 136($sp) + j end_assign + not_is_Bool_or_Int: + # internal_121 = internal_123 + lw $t0, 128($sp) + sw $t0, 136($sp) + end_assign: + + # If internal_121 then goto then_8789948671838 + lw $t0, 136($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948671838 + + # Jumping to else_8789948671838 + j else_8789948671838 + + then_8789948671838: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 30 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 21 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_124[0] = 'X' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_124[1] = ' ' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_124[2] = ' ' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_124[3] = ' ' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_124[4] = ' ' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_124[5] = ' ' + + addi $t0, $zero, 88 + sb $t0, 14($v0) # internal_124[6] = 'X' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_124[7] = ' ' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_124[8] = 'X' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_124[9] = ' ' + + addi $t0, $zero, 88 + sb $t0, 18($v0) # internal_124[10] = 'X' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_124[11] = ' ' + + addi $t0, $zero, 88 + sb $t0, 20($v0) # internal_124[12] = 'X' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_124[13] = ' ' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_124[14] = ' ' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_124[15] = ' ' + + addi $t0, $zero, 88 + sb $t0, 24($v0) # internal_124[16] = 'X' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_124[17] = ' ' + + addi $t0, $zero, 88 + sb $t0, 26($v0) # internal_124[18] = 'X' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_124[19] = ' ' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_124[20] = ' ' + + sb $zero, 29($v0) # Null-terminator at the end of the string + + sw $v0, 124($sp) # internal_124 = "X X X X X X X " + + lw $t0, 124($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 140($sp) + j end_assign + not_is_Bool_or_Int: + # internal_120 = internal_124 + lw $t0, 124($sp) + sw $t0, 140($sp) + end_assign: + + # Jumping to endif_8789948671838 + j endif_8789948671838 + + else_8789948671838: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 116($sp) # internal_126 = address of allocated object Int + + # Allocating Int 16 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 16 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_127 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 632($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_127 + lw $t0, 124($sp) + sw $t0, 0($sp) # Storing internal_127 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 120($sp) # internal_128 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 108($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 116($sp) + j end_assign + not_is_Bool_or_Int: + # internal_126 = internal_128 + lw $t0, 108($sp) + sw $t0, 116($sp) + end_assign: + + # If internal_126 then goto then_8789948671832 + lw $t0, 116($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948671832 + + # Jumping to else_8789948671832 + j else_8789948671832 + + then_8789948671832: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 30 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 21 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_129[0] = ' ' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_129[1] = ' ' + + addi $t0, $zero, 88 + sb $t0, 10($v0) # internal_129[2] = 'X' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_129[3] = ' ' + + addi $t0, $zero, 88 + sb $t0, 12($v0) # internal_129[4] = 'X' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_129[5] = ' ' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_129[6] = ' ' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_129[7] = ' ' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_129[8] = 'X' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_129[9] = ' ' + + addi $t0, $zero, 88 + sb $t0, 18($v0) # internal_129[10] = 'X' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_129[11] = ' ' + + addi $t0, $zero, 88 + sb $t0, 20($v0) # internal_129[12] = 'X' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_129[13] = ' ' + + addi $t0, $zero, 88 + sb $t0, 22($v0) # internal_129[14] = 'X' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_129[15] = ' ' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_129[16] = ' ' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_129[17] = ' ' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_129[18] = ' ' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_129[19] = ' ' + + addi $t0, $zero, 88 + sb $t0, 28($v0) # internal_129[20] = 'X' + + sb $zero, 29($v0) # Null-terminator at the end of the string + + sw $v0, 104($sp) # internal_129 = " X X X X X X X" + + lw $t0, 104($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 120($sp) + j end_assign + not_is_Bool_or_Int: + # internal_125 = internal_129 + lw $t0, 104($sp) + sw $t0, 120($sp) + end_assign: + + # Jumping to endif_8789948671832 + j endif_8789948671832 + + else_8789948671832: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_131 = address of allocated object Int + + # Allocating Int 17 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 17 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 92($sp) # internal_132 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 632($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_132 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_132 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_133 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 88($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 96($sp) + j end_assign + not_is_Bool_or_Int: + # internal_131 = internal_133 + lw $t0, 88($sp) + sw $t0, 96($sp) + end_assign: + + # If internal_131 then goto then_8789948671826 + lw $t0, 96($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948671826 + + # Jumping to else_8789948671826 + j else_8789948671826 + + then_8789948671826: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 37 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 28 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_134[0] = 'X' + + addi $t0, $zero, 88 + sb $t0, 9($v0) # internal_134[1] = 'X' + + addi $t0, $zero, 88 + sb $t0, 10($v0) # internal_134[2] = 'X' + + addi $t0, $zero, 88 + sb $t0, 11($v0) # internal_134[3] = 'X' + + addi $t0, $zero, 88 + sb $t0, 12($v0) # internal_134[4] = 'X' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_134[5] = ' ' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_134[6] = ' ' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_134[7] = ' ' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_134[8] = 'X' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_134[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_134[10] = ' ' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_134[11] = ' ' + + addi $t0, $zero, 88 + sb $t0, 20($v0) # internal_134[12] = 'X' + + addi $t0, $zero, 88 + sb $t0, 21($v0) # internal_134[13] = 'X' + + addi $t0, $zero, 88 + sb $t0, 22($v0) # internal_134[14] = 'X' + + addi $t0, $zero, 88 + sb $t0, 23($v0) # internal_134[15] = 'X' + + addi $t0, $zero, 88 + sb $t0, 24($v0) # internal_134[16] = 'X' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_134[17] = ' ' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_134[18] = ' ' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_134[19] = ' ' + + addi $t0, $zero, 88 + sb $t0, 28($v0) # internal_134[20] = 'X' + + addi $t0, $zero, 32 + sb $t0, 29($v0) # internal_134[21] = ' ' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_134[22] = ' ' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_134[23] = ' ' + + addi $t0, $zero, 88 + sb $t0, 32($v0) # internal_134[24] = 'X' + + addi $t0, $zero, 88 + sb $t0, 33($v0) # internal_134[25] = 'X' + + addi $t0, $zero, 88 + sb $t0, 34($v0) # internal_134[26] = 'X' + + addi $t0, $zero, 88 + sb $t0, 35($v0) # internal_134[27] = 'X' + + sb $zero, 36($v0) # Null-terminator at the end of the string + + sw $v0, 84($sp) # internal_134 = "XXXXX X XXXXX X XXXX" + + lw $t0, 84($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 100($sp) + j end_assign + not_is_Bool_or_Int: + # internal_130 = internal_134 + lw $t0, 84($sp) + sw $t0, 100($sp) + end_assign: + + # Jumping to endif_8789948671826 + j endif_8789948671826 + + else_8789948671826: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_136 = address of allocated object Int + + # Allocating Int 18 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 18 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_137 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 632($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_137 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_137 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_138 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 68($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 76($sp) + j end_assign + not_is_Bool_or_Int: + # internal_136 = internal_138 + lw $t0, 68($sp) + sw $t0, 76($sp) + end_assign: + + # If internal_136 then goto then_8789948671820 + lw $t0, 76($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948671820 + + # Jumping to else_8789948671820 + j else_8789948671820 + + then_8789948671820: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 37 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 28 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_139[0] = 'X' + + addi $t0, $zero, 88 + sb $t0, 9($v0) # internal_139[1] = 'X' + + addi $t0, $zero, 88 + sb $t0, 10($v0) # internal_139[2] = 'X' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_139[3] = ' ' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_139[4] = ' ' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_139[5] = ' ' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_139[6] = ' ' + + addi $t0, $zero, 88 + sb $t0, 15($v0) # internal_139[7] = 'X' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_139[8] = ' ' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_139[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_139[10] = ' ' + + addi $t0, $zero, 88 + sb $t0, 19($v0) # internal_139[11] = 'X' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_139[12] = ' ' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_139[13] = ' ' + + addi $t0, $zero, 88 + sb $t0, 22($v0) # internal_139[14] = 'X' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_139[15] = ' ' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_139[16] = ' ' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_139[17] = ' ' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_139[18] = ' ' + + addi $t0, $zero, 88 + sb $t0, 27($v0) # internal_139[19] = 'X' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_139[20] = ' ' + + addi $t0, $zero, 32 + sb $t0, 29($v0) # internal_139[21] = ' ' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_139[22] = ' ' + + addi $t0, $zero, 88 + sb $t0, 31($v0) # internal_139[23] = 'X' + + addi $t0, $zero, 88 + sb $t0, 32($v0) # internal_139[24] = 'X' + + addi $t0, $zero, 88 + sb $t0, 33($v0) # internal_139[25] = 'X' + + addi $t0, $zero, 88 + sb $t0, 34($v0) # internal_139[26] = 'X' + + addi $t0, $zero, 32 + sb $t0, 35($v0) # internal_139[27] = ' ' + + sb $zero, 36($v0) # Null-terminator at the end of the string + + sw $v0, 64($sp) # internal_139 = "XXX X X X X XXXX " + + lw $t0, 64($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 80($sp) + j end_assign + not_is_Bool_or_Int: + # internal_135 = internal_139 + lw $t0, 64($sp) + sw $t0, 80($sp) + end_assign: + + # Jumping to endif_8789948671820 + j endif_8789948671820 + + else_8789948671820: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_141 = address of allocated object Int + + # Allocating Int 19 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 19 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_142 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 632($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_142 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_142 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 60($sp) # internal_143 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 48($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 56($sp) + j end_assign + not_is_Bool_or_Int: + # internal_141 = internal_143 + lw $t0, 48($sp) + sw $t0, 56($sp) + end_assign: + + # If internal_141 then goto then_8789948671814 + lw $t0, 56($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948671814 + + # Jumping to else_8789948671814 + j else_8789948671814 + + then_8789948671814: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 25 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 16 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_144[0] = ' ' + + addi $t0, $zero, 88 + sb $t0, 9($v0) # internal_144[1] = 'X' + + addi $t0, $zero, 88 + sb $t0, 10($v0) # internal_144[2] = 'X' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_144[3] = ' ' + + addi $t0, $zero, 88 + sb $t0, 12($v0) # internal_144[4] = 'X' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_144[5] = ' ' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_144[6] = ' ' + + addi $t0, $zero, 88 + sb $t0, 15($v0) # internal_144[7] = 'X' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_144[8] = 'X' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_144[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_144[10] = ' ' + + addi $t0, $zero, 88 + sb $t0, 19($v0) # internal_144[11] = 'X' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_144[12] = ' ' + + addi $t0, $zero, 88 + sb $t0, 21($v0) # internal_144[13] = 'X' + + addi $t0, $zero, 88 + sb $t0, 22($v0) # internal_144[14] = 'X' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_144[15] = ' ' + + sb $zero, 24($v0) # Null-terminator at the end of the string + + sw $v0, 44($sp) # internal_144 = " XX X XX X XX " + + lw $t0, 44($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # internal_140 = internal_144 + lw $t0, 44($sp) + sw $t0, 60($sp) + end_assign: + + # Jumping to endif_8789948671814 + j endif_8789948671814 + + else_8789948671814: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_146 = address of allocated object Int + + # Allocating Int 20 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 20 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_147 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 632($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_147 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_147 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_148 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 36($sp) + j end_assign + not_is_Bool_or_Int: + # internal_146 = internal_148 + lw $t0, 28($sp) + sw $t0, 36($sp) + end_assign: + + # If internal_146 then goto then_8789948671808 + lw $t0, 36($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948671808 + + # Jumping to else_8789948671808 + j else_8789948671808 + + then_8789948671808: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 37 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 28 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_149[0] = ' ' + + addi $t0, $zero, 88 + sb $t0, 9($v0) # internal_149[1] = 'X' + + addi $t0, $zero, 88 + sb $t0, 10($v0) # internal_149[2] = 'X' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_149[3] = ' ' + + addi $t0, $zero, 88 + sb $t0, 12($v0) # internal_149[4] = 'X' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_149[5] = ' ' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_149[6] = ' ' + + addi $t0, $zero, 88 + sb $t0, 15($v0) # internal_149[7] = 'X' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_149[8] = 'X' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_149[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_149[10] = ' ' + + addi $t0, $zero, 88 + sb $t0, 19($v0) # internal_149[11] = 'X' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_149[12] = ' ' + + addi $t0, $zero, 88 + sb $t0, 21($v0) # internal_149[13] = 'X' + + addi $t0, $zero, 88 + sb $t0, 22($v0) # internal_149[14] = 'X' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_149[15] = ' ' + + addi $t0, $zero, 88 + sb $t0, 24($v0) # internal_149[16] = 'X' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_149[17] = ' ' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_149[18] = ' ' + + addi $t0, $zero, 88 + sb $t0, 27($v0) # internal_149[19] = 'X' + + addi $t0, $zero, 88 + sb $t0, 28($v0) # internal_149[20] = 'X' + + addi $t0, $zero, 32 + sb $t0, 29($v0) # internal_149[21] = ' ' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_149[22] = ' ' + + addi $t0, $zero, 88 + sb $t0, 31($v0) # internal_149[23] = 'X' + + addi $t0, $zero, 32 + sb $t0, 32($v0) # internal_149[24] = ' ' + + addi $t0, $zero, 88 + sb $t0, 33($v0) # internal_149[25] = 'X' + + addi $t0, $zero, 88 + sb $t0, 34($v0) # internal_149[26] = 'X' + + addi $t0, $zero, 32 + sb $t0, 35($v0) # internal_149[27] = ' ' + + sb $zero, 36($v0) # Null-terminator at the end of the string + + sw $v0, 24($sp) # internal_149 = " XX X XX X XX X XX X XX " + + lw $t0, 24($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # internal_145 = internal_149 + lw $t0, 24($sp) + sw $t0, 40($sp) + end_assign: + + # Jumping to endif_8789948671808 + j endif_8789948671808 + + else_8789948671808: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_151 = address of allocated object Int + + # Allocating Int 21 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 21 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_152 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 632($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_152 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_152 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_153 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 16($sp) + j end_assign + not_is_Bool_or_Int: + # internal_151 = internal_153 + lw $t0, 8($sp) + sw $t0, 16($sp) + end_assign: + + # If internal_151 then goto then_8789948671802 + lw $t0, 16($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948671802 + + # Jumping to else_8789948671802 + j else_8789948671802 + + then_8789948671802: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 37 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 28 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_154[0] = ' ' + + addi $t0, $zero, 88 + sb $t0, 9($v0) # internal_154[1] = 'X' + + addi $t0, $zero, 88 + sb $t0, 10($v0) # internal_154[2] = 'X' + + addi $t0, $zero, 88 + sb $t0, 11($v0) # internal_154[3] = 'X' + + addi $t0, $zero, 88 + sb $t0, 12($v0) # internal_154[4] = 'X' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_154[5] = ' ' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_154[6] = ' ' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_154[7] = ' ' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_154[8] = 'X' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_154[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_154[10] = ' ' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_154[11] = ' ' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_154[12] = ' ' + + addi $t0, $zero, 88 + sb $t0, 21($v0) # internal_154[13] = 'X' + + addi $t0, $zero, 88 + sb $t0, 22($v0) # internal_154[14] = 'X' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_154[15] = ' ' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_154[16] = ' ' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_154[17] = ' ' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_154[18] = ' ' + + addi $t0, $zero, 88 + sb $t0, 27($v0) # internal_154[19] = 'X' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_154[20] = ' ' + + addi $t0, $zero, 32 + sb $t0, 29($v0) # internal_154[21] = ' ' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_154[22] = ' ' + + addi $t0, $zero, 88 + sb $t0, 31($v0) # internal_154[23] = 'X' + + addi $t0, $zero, 88 + sb $t0, 32($v0) # internal_154[24] = 'X' + + addi $t0, $zero, 88 + sb $t0, 33($v0) # internal_154[25] = 'X' + + addi $t0, $zero, 88 + sb $t0, 34($v0) # internal_154[26] = 'X' + + addi $t0, $zero, 32 + sb $t0, 35($v0) # internal_154[27] = ' ' + + sb $zero, 36($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_154 = " XXXX X XX X XXXX " + + lw $t0, 4($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 20($sp) + j end_assign + not_is_Bool_or_Int: + # internal_150 = internal_154 + lw $t0, 4($sp) + sw $t0, 20($sp) + end_assign: + + # Jumping to endif_8789948671802 + j endif_8789948671802 + + else_8789948671802: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 34 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 25 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_155[0] = ' ' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_155[1] = ' ' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_155[2] = ' ' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_155[3] = ' ' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_155[4] = ' ' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_155[5] = ' ' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_155[6] = ' ' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_155[7] = ' ' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_155[8] = ' ' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_155[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_155[10] = ' ' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_155[11] = ' ' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_155[12] = ' ' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_155[13] = ' ' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_155[14] = ' ' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_155[15] = ' ' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_155[16] = ' ' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_155[17] = ' ' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_155[18] = ' ' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_155[19] = ' ' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_155[20] = ' ' + + addi $t0, $zero, 32 + sb $t0, 29($v0) # internal_155[21] = ' ' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_155[22] = ' ' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_155[23] = ' ' + + addi $t0, $zero, 32 + sb $t0, 32($v0) # internal_155[24] = ' ' + + sb $zero, 33($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_155 = " " + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 20($sp) + j end_assign + not_is_Bool_or_Int: + # internal_150 = internal_155 + lw $t0, 0($sp) + sw $t0, 20($sp) + end_assign: + + # Jumping to endif_8789948671802 + j endif_8789948671802 + + endif_8789948671802: + + lw $t0, 20($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # internal_145 = internal_150 + lw $t0, 20($sp) + sw $t0, 40($sp) + end_assign: + + # Jumping to endif_8789948671808 + j endif_8789948671808 + + endif_8789948671808: + + lw $t0, 40($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 60($sp) + j end_assign + not_is_Bool_or_Int: + # internal_140 = internal_145 + lw $t0, 40($sp) + sw $t0, 60($sp) + end_assign: + + # Jumping to endif_8789948671814 + j endif_8789948671814 + + endif_8789948671814: + + lw $t0, 60($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 80($sp) + j end_assign + not_is_Bool_or_Int: + # internal_135 = internal_140 + lw $t0, 60($sp) + sw $t0, 80($sp) + end_assign: + + # Jumping to endif_8789948671820 + j endif_8789948671820 + + endif_8789948671820: + + lw $t0, 80($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 100($sp) + j end_assign + not_is_Bool_or_Int: + # internal_130 = internal_135 + lw $t0, 80($sp) + sw $t0, 100($sp) + end_assign: + + # Jumping to endif_8789948671826 + j endif_8789948671826 + + endif_8789948671826: + + lw $t0, 100($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 120($sp) + j end_assign + not_is_Bool_or_Int: + # internal_125 = internal_130 + lw $t0, 100($sp) + sw $t0, 120($sp) + end_assign: + + # Jumping to endif_8789948671832 + j endif_8789948671832 + + endif_8789948671832: + + lw $t0, 120($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 140($sp) + j end_assign + not_is_Bool_or_Int: + # internal_120 = internal_125 + lw $t0, 120($sp) + sw $t0, 140($sp) + end_assign: + + # Jumping to endif_8789948671838 + j endif_8789948671838 + + endif_8789948671838: + + lw $t0, 140($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 160($sp) + j end_assign + not_is_Bool_or_Int: + # internal_115 = internal_120 + lw $t0, 140($sp) + sw $t0, 160($sp) + end_assign: + + # Jumping to endif_8789948671844 + j endif_8789948671844 + + endif_8789948671844: + + lw $t0, 160($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 180($sp) + j end_assign + not_is_Bool_or_Int: + # internal_110 = internal_115 + lw $t0, 160($sp) + sw $t0, 180($sp) + end_assign: + + # Jumping to endif_8789948671850 + j endif_8789948671850 + + endif_8789948671850: + + lw $t0, 180($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 200($sp) + j end_assign + not_is_Bool_or_Int: + # internal_105 = internal_110 + lw $t0, 180($sp) + sw $t0, 200($sp) + end_assign: + + # Jumping to endif_8789948671856 + j endif_8789948671856 + + endif_8789948671856: + + lw $t0, 200($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 220($sp) + j end_assign + not_is_Bool_or_Int: + # internal_100 = internal_105 + lw $t0, 200($sp) + sw $t0, 220($sp) + end_assign: + + # Jumping to endif_8789948671862 + j endif_8789948671862 + + endif_8789948671862: + + lw $t0, 220($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 240($sp) + j end_assign + not_is_Bool_or_Int: + # internal_95 = internal_100 + lw $t0, 220($sp) + sw $t0, 240($sp) + end_assign: + + # Jumping to endif_8789948671868 + j endif_8789948671868 + + endif_8789948671868: + + lw $t0, 240($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 260($sp) + j end_assign + not_is_Bool_or_Int: + # internal_90 = internal_95 + lw $t0, 240($sp) + sw $t0, 260($sp) + end_assign: + + # Jumping to endif_8789948671874 + j endif_8789948671874 + + endif_8789948671874: + + lw $t0, 260($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 280($sp) + j end_assign + not_is_Bool_or_Int: + # internal_85 = internal_90 + lw $t0, 260($sp) + sw $t0, 280($sp) + end_assign: + + # Jumping to endif_8789948671880 + j endif_8789948671880 + + endif_8789948671880: + + lw $t0, 280($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 300($sp) + j end_assign + not_is_Bool_or_Int: + # internal_80 = internal_85 + lw $t0, 280($sp) + sw $t0, 300($sp) + end_assign: + + # Jumping to endif_8789948671886 + j endif_8789948671886 + + endif_8789948671886: + + lw $t0, 300($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 320($sp) + j end_assign + not_is_Bool_or_Int: + # internal_75 = internal_80 + lw $t0, 300($sp) + sw $t0, 320($sp) + end_assign: + + # Jumping to endif_8789948671892 + j endif_8789948671892 + + endif_8789948671892: + + lw $t0, 320($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 340($sp) + j end_assign + not_is_Bool_or_Int: + # internal_70 = internal_75 + lw $t0, 320($sp) + sw $t0, 340($sp) + end_assign: + + # Jumping to endif_8789948671898 + j endif_8789948671898 + + endif_8789948671898: + + lw $t0, 340($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 360($sp) + j end_assign + not_is_Bool_or_Int: + # internal_65 = internal_70 + lw $t0, 340($sp) + sw $t0, 360($sp) + end_assign: + + # Jumping to endif_8789948671904 + j endif_8789948671904 + + endif_8789948671904: + + lw $t0, 360($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 380($sp) + j end_assign + not_is_Bool_or_Int: + # internal_60 = internal_65 + lw $t0, 360($sp) + sw $t0, 380($sp) + end_assign: + + # Jumping to endif_8789948671910 + j endif_8789948671910 + + endif_8789948671910: + + lw $t0, 380($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 400($sp) + j end_assign + not_is_Bool_or_Int: + # internal_55 = internal_60 + lw $t0, 380($sp) + sw $t0, 400($sp) + end_assign: + + # Jumping to endif_8789948671916 + j endif_8789948671916 + + endif_8789948671916: + + lw $t0, 400($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 420($sp) + j end_assign + not_is_Bool_or_Int: + # internal_50 = internal_55 + lw $t0, 400($sp) + sw $t0, 420($sp) + end_assign: + + # Jumping to endif_8789948671922 + j endif_8789948671922 + + endif_8789948671922: + + # Loading return value in $v1 + lw $v1, 420($sp) + + # Freeing space for local variables + addi $sp, $sp, 624 + + jr $ra + + function_prompt_at_CellularAutomaton: + # Function parameters + # $ra = 60($sp) + # self = 56($sp) + + # Reserving space for local variables + addi $sp, $sp, -56 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 0 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 52($sp) # ans = "" + + # Allocating String + li $v0, 9 + addi $a0, $zero, 63 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 54 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 87 + sb $t0, 8($v0) # internal_1[0] = 'W' + + addi $t0, $zero, 111 + sb $t0, 9($v0) # internal_1[1] = 'o' + + addi $t0, $zero, 117 + sb $t0, 10($v0) # internal_1[2] = 'u' + + addi $t0, $zero, 108 + sb $t0, 11($v0) # internal_1[3] = 'l' + + addi $t0, $zero, 100 + sb $t0, 12($v0) # internal_1[4] = 'd' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_1[5] = ' ' + + addi $t0, $zero, 121 + sb $t0, 14($v0) # internal_1[6] = 'y' + + addi $t0, $zero, 111 + sb $t0, 15($v0) # internal_1[7] = 'o' + + addi $t0, $zero, 117 + sb $t0, 16($v0) # internal_1[8] = 'u' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_1[9] = ' ' + + addi $t0, $zero, 108 + sb $t0, 18($v0) # internal_1[10] = 'l' + + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_1[11] = 'i' + + addi $t0, $zero, 107 + sb $t0, 20($v0) # internal_1[12] = 'k' + + addi $t0, $zero, 101 + sb $t0, 21($v0) # internal_1[13] = 'e' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_1[14] = ' ' + + addi $t0, $zero, 116 + sb $t0, 23($v0) # internal_1[15] = 't' + + addi $t0, $zero, 111 + sb $t0, 24($v0) # internal_1[16] = 'o' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_1[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_1[18] = 'c' + + addi $t0, $zero, 111 + sb $t0, 27($v0) # internal_1[19] = 'o' + + addi $t0, $zero, 110 + sb $t0, 28($v0) # internal_1[20] = 'n' + + addi $t0, $zero, 116 + sb $t0, 29($v0) # internal_1[21] = 't' + + addi $t0, $zero, 105 + sb $t0, 30($v0) # internal_1[22] = 'i' + + addi $t0, $zero, 110 + sb $t0, 31($v0) # internal_1[23] = 'n' + + addi $t0, $zero, 117 + sb $t0, 32($v0) # internal_1[24] = 'u' + + addi $t0, $zero, 101 + sb $t0, 33($v0) # internal_1[25] = 'e' + + addi $t0, $zero, 32 + sb $t0, 34($v0) # internal_1[26] = ' ' + + addi $t0, $zero, 119 + sb $t0, 35($v0) # internal_1[27] = 'w' + + addi $t0, $zero, 105 + sb $t0, 36($v0) # internal_1[28] = 'i' + + addi $t0, $zero, 116 + sb $t0, 37($v0) # internal_1[29] = 't' + + addi $t0, $zero, 104 + sb $t0, 38($v0) # internal_1[30] = 'h' + + addi $t0, $zero, 32 + sb $t0, 39($v0) # internal_1[31] = ' ' + + addi $t0, $zero, 116 + sb $t0, 40($v0) # internal_1[32] = 't' + + addi $t0, $zero, 104 + sb $t0, 41($v0) # internal_1[33] = 'h' + + addi $t0, $zero, 101 + sb $t0, 42($v0) # internal_1[34] = 'e' + + addi $t0, $zero, 32 + sb $t0, 43($v0) # internal_1[35] = ' ' + + addi $t0, $zero, 110 + sb $t0, 44($v0) # internal_1[36] = 'n' + + addi $t0, $zero, 101 + sb $t0, 45($v0) # internal_1[37] = 'e' + + addi $t0, $zero, 120 + sb $t0, 46($v0) # internal_1[38] = 'x' + + addi $t0, $zero, 116 + sb $t0, 47($v0) # internal_1[39] = 't' + + addi $t0, $zero, 32 + sb $t0, 48($v0) # internal_1[40] = ' ' + + addi $t0, $zero, 103 + sb $t0, 49($v0) # internal_1[41] = 'g' + + addi $t0, $zero, 101 + sb $t0, 50($v0) # internal_1[42] = 'e' + + addi $t0, $zero, 110 + sb $t0, 51($v0) # internal_1[43] = 'n' + + addi $t0, $zero, 101 + sb $t0, 52($v0) # internal_1[44] = 'e' + + addi $t0, $zero, 114 + sb $t0, 53($v0) # internal_1[45] = 'r' + + addi $t0, $zero, 97 + sb $t0, 54($v0) # internal_1[46] = 'a' + + addi $t0, $zero, 116 + sb $t0, 55($v0) # internal_1[47] = 't' + + addi $t0, $zero, 105 + sb $t0, 56($v0) # internal_1[48] = 'i' + + addi $t0, $zero, 111 + sb $t0, 57($v0) # internal_1[49] = 'o' + + addi $t0, $zero, 110 + sb $t0, 58($v0) # internal_1[50] = 'n' + + addi $t0, $zero, 63 + sb $t0, 59($v0) # internal_1[51] = '?' + + addi $t0, $zero, 32 + sb $t0, 60($v0) # internal_1[52] = ' ' + + addi $t0, $zero, 10 + sb $t0, 61($v0) # internal_1[53] = '\n' + + sb $zero, 62($v0) # Null-terminator at the end of the string + + sw $v0, 48($sp) # internal_1 = "Would you like to continue with the next generation? \n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_1 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 56($sp) # internal_2 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 58 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 49 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 80 + sb $t0, 8($v0) # internal_3[0] = 'P' + + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_3[1] = 'l' + + addi $t0, $zero, 101 + sb $t0, 10($v0) # internal_3[2] = 'e' + + addi $t0, $zero, 97 + sb $t0, 11($v0) # internal_3[3] = 'a' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_3[4] = 's' + + addi $t0, $zero, 101 + sb $t0, 13($v0) # internal_3[5] = 'e' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_3[6] = ' ' + + addi $t0, $zero, 117 + sb $t0, 15($v0) # internal_3[7] = 'u' + + addi $t0, $zero, 115 + sb $t0, 16($v0) # internal_3[8] = 's' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_3[9] = 'e' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_3[10] = ' ' + + addi $t0, $zero, 108 + sb $t0, 19($v0) # internal_3[11] = 'l' + + addi $t0, $zero, 111 + sb $t0, 20($v0) # internal_3[12] = 'o' + + addi $t0, $zero, 119 + sb $t0, 21($v0) # internal_3[13] = 'w' + + addi $t0, $zero, 101 + sb $t0, 22($v0) # internal_3[14] = 'e' + + addi $t0, $zero, 114 + sb $t0, 23($v0) # internal_3[15] = 'r' + + addi $t0, $zero, 99 + sb $t0, 24($v0) # internal_3[16] = 'c' + + addi $t0, $zero, 97 + sb $t0, 25($v0) # internal_3[17] = 'a' + + addi $t0, $zero, 115 + sb $t0, 26($v0) # internal_3[18] = 's' + + addi $t0, $zero, 101 + sb $t0, 27($v0) # internal_3[19] = 'e' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_3[20] = ' ' + + addi $t0, $zero, 121 + sb $t0, 29($v0) # internal_3[21] = 'y' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_3[22] = ' ' + + addi $t0, $zero, 111 + sb $t0, 31($v0) # internal_3[23] = 'o' + + addi $t0, $zero, 114 + sb $t0, 32($v0) # internal_3[24] = 'r' + + addi $t0, $zero, 32 + sb $t0, 33($v0) # internal_3[25] = ' ' + + addi $t0, $zero, 110 + sb $t0, 34($v0) # internal_3[26] = 'n' + + addi $t0, $zero, 32 + sb $t0, 35($v0) # internal_3[27] = ' ' + + addi $t0, $zero, 102 + sb $t0, 36($v0) # internal_3[28] = 'f' + + addi $t0, $zero, 111 + sb $t0, 37($v0) # internal_3[29] = 'o' + + addi $t0, $zero, 114 + sb $t0, 38($v0) # internal_3[30] = 'r' + + addi $t0, $zero, 32 + sb $t0, 39($v0) # internal_3[31] = ' ' + + addi $t0, $zero, 121 + sb $t0, 40($v0) # internal_3[32] = 'y' + + addi $t0, $zero, 111 + sb $t0, 41($v0) # internal_3[33] = 'o' + + addi $t0, $zero, 117 + sb $t0, 42($v0) # internal_3[34] = 'u' + + addi $t0, $zero, 114 + sb $t0, 43($v0) # internal_3[35] = 'r' + + addi $t0, $zero, 32 + sb $t0, 44($v0) # internal_3[36] = ' ' + + addi $t0, $zero, 97 + sb $t0, 45($v0) # internal_3[37] = 'a' + + addi $t0, $zero, 110 + sb $t0, 46($v0) # internal_3[38] = 'n' + + addi $t0, $zero, 115 + sb $t0, 47($v0) # internal_3[39] = 's' + + addi $t0, $zero, 119 + sb $t0, 48($v0) # internal_3[40] = 'w' + + addi $t0, $zero, 101 + sb $t0, 49($v0) # internal_3[41] = 'e' + + addi $t0, $zero, 114 + sb $t0, 50($v0) # internal_3[42] = 'r' + + addi $t0, $zero, 32 + sb $t0, 51($v0) # internal_3[43] = ' ' + + addi $t0, $zero, 91 + sb $t0, 52($v0) # internal_3[44] = '[' + + addi $t0, $zero, 121 + sb $t0, 53($v0) # internal_3[45] = 'y' + + addi $t0, $zero, 93 + sb $t0, 54($v0) # internal_3[46] = ']' + + addi $t0, $zero, 58 + sb $t0, 55($v0) # internal_3[47] = ':' + + addi $t0, $zero, 32 + sb $t0, 56($v0) # internal_3[48] = ' ' + + sb $zero, 57($v0) # Null-terminator at the end of the string + + sw $v0, 40($sp) # internal_3 = "Please use lowercase y or n for your answer [y]: " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_3 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_4 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_in_string_at_IO + jal function_in_string_at_IO + lw $ra, 4($sp) + sw $v1, 40($sp) # internal_5 = result of function_in_string_at_IO + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 32($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # ans = internal_5 + lw $t0, 32($sp) + sw $t0, 52($sp) + end_assign: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_6[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 28($sp) # internal_6 = "\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_6 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_7 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_9 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 110 + sb $t0, 8($v0) # internal_10[0] = 'n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_10 = "n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument ans + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing ans + + # Argument internal_10 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_11 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 16($sp) + j end_assign + not_is_Bool_or_Int: + # internal_9 = internal_11 + lw $t0, 8($sp) + sw $t0, 16($sp) + end_assign: + + # If internal_9 then goto then_8789948672275 + lw $t0, 16($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948672275 + + # Jumping to else_8789948672275 + j else_8789948672275 + + then_8789948672275: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_12 = address of allocated object Int + + lw $t0, 4($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 20($sp) + j end_assign + not_is_Bool_or_Int: + # internal_8 = internal_12 + lw $t0, 4($sp) + sw $t0, 20($sp) + end_assign: + + # Jumping to endif_8789948672275 + j endif_8789948672275 + + else_8789948672275: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_13 = address of allocated object Int + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 20($sp) + j end_assign + not_is_Bool_or_Int: + # internal_8 = internal_13 + lw $t0, 0($sp) + sw $t0, 20($sp) + end_assign: + + # Jumping to endif_8789948672275 + j endif_8789948672275 + + endif_8789948672275: + + # Loading return value in $v1 + lw $v1, 20($sp) + + # Freeing space for local variables + addi $sp, $sp, 56 + + jr $ra + + function_prompt2_at_CellularAutomaton: + # Function parameters + # $ra = 60($sp) + # self = 56($sp) + + # Reserving space for local variables + addi $sp, $sp, -56 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 0 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 52($sp) # ans = "" + + # Allocating String + li $v0, 9 + addi $a0, $zero, 11 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 2 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_1[0] = '\n' + + addi $t0, $zero, 10 + sb $t0, 9($v0) # internal_1[1] = '\n' + + sb $zero, 10($v0) # Null-terminator at the end of the string + + sw $v0, 48($sp) # internal_1 = "\n\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_1 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 56($sp) # internal_2 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 57 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 48 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 87 + sb $t0, 8($v0) # internal_3[0] = 'W' + + addi $t0, $zero, 111 + sb $t0, 9($v0) # internal_3[1] = 'o' + + addi $t0, $zero, 117 + sb $t0, 10($v0) # internal_3[2] = 'u' + + addi $t0, $zero, 108 + sb $t0, 11($v0) # internal_3[3] = 'l' + + addi $t0, $zero, 100 + sb $t0, 12($v0) # internal_3[4] = 'd' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_3[5] = ' ' + + addi $t0, $zero, 121 + sb $t0, 14($v0) # internal_3[6] = 'y' + + addi $t0, $zero, 111 + sb $t0, 15($v0) # internal_3[7] = 'o' + + addi $t0, $zero, 117 + sb $t0, 16($v0) # internal_3[8] = 'u' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_3[9] = ' ' + + addi $t0, $zero, 108 + sb $t0, 18($v0) # internal_3[10] = 'l' + + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_3[11] = 'i' + + addi $t0, $zero, 107 + sb $t0, 20($v0) # internal_3[12] = 'k' + + addi $t0, $zero, 101 + sb $t0, 21($v0) # internal_3[13] = 'e' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_3[14] = ' ' + + addi $t0, $zero, 116 + sb $t0, 23($v0) # internal_3[15] = 't' + + addi $t0, $zero, 111 + sb $t0, 24($v0) # internal_3[16] = 'o' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_3[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_3[18] = 'c' + + addi $t0, $zero, 104 + sb $t0, 27($v0) # internal_3[19] = 'h' + + addi $t0, $zero, 111 + sb $t0, 28($v0) # internal_3[20] = 'o' + + addi $t0, $zero, 111 + sb $t0, 29($v0) # internal_3[21] = 'o' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_3[22] = 's' + + addi $t0, $zero, 101 + sb $t0, 31($v0) # internal_3[23] = 'e' + + addi $t0, $zero, 32 + sb $t0, 32($v0) # internal_3[24] = ' ' + + addi $t0, $zero, 97 + sb $t0, 33($v0) # internal_3[25] = 'a' + + addi $t0, $zero, 32 + sb $t0, 34($v0) # internal_3[26] = ' ' + + addi $t0, $zero, 98 + sb $t0, 35($v0) # internal_3[27] = 'b' + + addi $t0, $zero, 97 + sb $t0, 36($v0) # internal_3[28] = 'a' + + addi $t0, $zero, 99 + sb $t0, 37($v0) # internal_3[29] = 'c' + + addi $t0, $zero, 107 + sb $t0, 38($v0) # internal_3[30] = 'k' + + addi $t0, $zero, 103 + sb $t0, 39($v0) # internal_3[31] = 'g' + + addi $t0, $zero, 114 + sb $t0, 40($v0) # internal_3[32] = 'r' + + addi $t0, $zero, 111 + sb $t0, 41($v0) # internal_3[33] = 'o' + + addi $t0, $zero, 117 + sb $t0, 42($v0) # internal_3[34] = 'u' + + addi $t0, $zero, 110 + sb $t0, 43($v0) # internal_3[35] = 'n' + + addi $t0, $zero, 100 + sb $t0, 44($v0) # internal_3[36] = 'd' + + addi $t0, $zero, 32 + sb $t0, 45($v0) # internal_3[37] = ' ' + + addi $t0, $zero, 112 + sb $t0, 46($v0) # internal_3[38] = 'p' + + addi $t0, $zero, 97 + sb $t0, 47($v0) # internal_3[39] = 'a' + + addi $t0, $zero, 116 + sb $t0, 48($v0) # internal_3[40] = 't' + + addi $t0, $zero, 116 + sb $t0, 49($v0) # internal_3[41] = 't' + + addi $t0, $zero, 101 + sb $t0, 50($v0) # internal_3[42] = 'e' + + addi $t0, $zero, 114 + sb $t0, 51($v0) # internal_3[43] = 'r' + + addi $t0, $zero, 110 + sb $t0, 52($v0) # internal_3[44] = 'n' + + addi $t0, $zero, 63 + sb $t0, 53($v0) # internal_3[45] = '?' + + addi $t0, $zero, 32 + sb $t0, 54($v0) # internal_3[46] = ' ' + + addi $t0, $zero, 10 + sb $t0, 55($v0) # internal_3[47] = '\n' + + sb $zero, 56($v0) # Null-terminator at the end of the string + + sw $v0, 40($sp) # internal_3 = "Would you like to choose a background pattern? \n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_3 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_4 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 58 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 49 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 80 + sb $t0, 8($v0) # internal_5[0] = 'P' + + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_5[1] = 'l' + + addi $t0, $zero, 101 + sb $t0, 10($v0) # internal_5[2] = 'e' + + addi $t0, $zero, 97 + sb $t0, 11($v0) # internal_5[3] = 'a' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_5[4] = 's' + + addi $t0, $zero, 101 + sb $t0, 13($v0) # internal_5[5] = 'e' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_5[6] = ' ' + + addi $t0, $zero, 117 + sb $t0, 15($v0) # internal_5[7] = 'u' + + addi $t0, $zero, 115 + sb $t0, 16($v0) # internal_5[8] = 's' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_5[9] = 'e' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_5[10] = ' ' + + addi $t0, $zero, 108 + sb $t0, 19($v0) # internal_5[11] = 'l' + + addi $t0, $zero, 111 + sb $t0, 20($v0) # internal_5[12] = 'o' + + addi $t0, $zero, 119 + sb $t0, 21($v0) # internal_5[13] = 'w' + + addi $t0, $zero, 101 + sb $t0, 22($v0) # internal_5[14] = 'e' + + addi $t0, $zero, 114 + sb $t0, 23($v0) # internal_5[15] = 'r' + + addi $t0, $zero, 99 + sb $t0, 24($v0) # internal_5[16] = 'c' + + addi $t0, $zero, 97 + sb $t0, 25($v0) # internal_5[17] = 'a' + + addi $t0, $zero, 115 + sb $t0, 26($v0) # internal_5[18] = 's' + + addi $t0, $zero, 101 + sb $t0, 27($v0) # internal_5[19] = 'e' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_5[20] = ' ' + + addi $t0, $zero, 121 + sb $t0, 29($v0) # internal_5[21] = 'y' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_5[22] = ' ' + + addi $t0, $zero, 111 + sb $t0, 31($v0) # internal_5[23] = 'o' + + addi $t0, $zero, 114 + sb $t0, 32($v0) # internal_5[24] = 'r' + + addi $t0, $zero, 32 + sb $t0, 33($v0) # internal_5[25] = ' ' + + addi $t0, $zero, 110 + sb $t0, 34($v0) # internal_5[26] = 'n' + + addi $t0, $zero, 32 + sb $t0, 35($v0) # internal_5[27] = ' ' + + addi $t0, $zero, 102 + sb $t0, 36($v0) # internal_5[28] = 'f' + + addi $t0, $zero, 111 + sb $t0, 37($v0) # internal_5[29] = 'o' + + addi $t0, $zero, 114 + sb $t0, 38($v0) # internal_5[30] = 'r' + + addi $t0, $zero, 32 + sb $t0, 39($v0) # internal_5[31] = ' ' + + addi $t0, $zero, 121 + sb $t0, 40($v0) # internal_5[32] = 'y' + + addi $t0, $zero, 111 + sb $t0, 41($v0) # internal_5[33] = 'o' + + addi $t0, $zero, 117 + sb $t0, 42($v0) # internal_5[34] = 'u' + + addi $t0, $zero, 114 + sb $t0, 43($v0) # internal_5[35] = 'r' + + addi $t0, $zero, 32 + sb $t0, 44($v0) # internal_5[36] = ' ' + + addi $t0, $zero, 97 + sb $t0, 45($v0) # internal_5[37] = 'a' + + addi $t0, $zero, 110 + sb $t0, 46($v0) # internal_5[38] = 'n' + + addi $t0, $zero, 115 + sb $t0, 47($v0) # internal_5[39] = 's' + + addi $t0, $zero, 119 + sb $t0, 48($v0) # internal_5[40] = 'w' + + addi $t0, $zero, 101 + sb $t0, 49($v0) # internal_5[41] = 'e' + + addi $t0, $zero, 114 + sb $t0, 50($v0) # internal_5[42] = 'r' + + addi $t0, $zero, 32 + sb $t0, 51($v0) # internal_5[43] = ' ' + + addi $t0, $zero, 91 + sb $t0, 52($v0) # internal_5[44] = '[' + + addi $t0, $zero, 110 + sb $t0, 53($v0) # internal_5[45] = 'n' + + addi $t0, $zero, 93 + sb $t0, 54($v0) # internal_5[46] = ']' + + addi $t0, $zero, 58 + sb $t0, 55($v0) # internal_5[47] = ':' + + addi $t0, $zero, 32 + sb $t0, 56($v0) # internal_5[48] = ' ' + + sb $zero, 57($v0) # Null-terminator at the end of the string + + sw $v0, 32($sp) # internal_5 = "Please use lowercase y or n for your answer [n]: " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_5 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_6 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_in_string_at_IO + jal function_in_string_at_IO + lw $ra, 4($sp) + sw $v1, 32($sp) # internal_7 = result of function_in_string_at_IO + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 24($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 52($sp) + j end_assign + not_is_Bool_or_Int: + # ans = internal_7 + lw $t0, 24($sp) + sw $t0, 52($sp) + end_assign: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_9 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 121 + sb $t0, 8($v0) # internal_10[0] = 'y' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_10 = "y" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument ans + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing ans + + # Argument internal_10 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_11 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 16($sp) + j end_assign + not_is_Bool_or_Int: + # internal_9 = internal_11 + lw $t0, 8($sp) + sw $t0, 16($sp) + end_assign: + + # If internal_9 then goto then_8789948672371 + lw $t0, 16($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948672371 + + # Jumping to else_8789948672371 + j else_8789948672371 + + then_8789948672371: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_12 = address of allocated object Int + + lw $t0, 4($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 20($sp) + j end_assign + not_is_Bool_or_Int: + # internal_8 = internal_12 + lw $t0, 4($sp) + sw $t0, 20($sp) + end_assign: + + # Jumping to endif_8789948672371 + j endif_8789948672371 + + else_8789948672371: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_13 = address of allocated object Int + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 20($sp) + j end_assign + not_is_Bool_or_Int: + # internal_8 = internal_13 + lw $t0, 0($sp) + sw $t0, 20($sp) + end_assign: + + # Jumping to endif_8789948672371 + j endif_8789948672371 + + endif_8789948672371: + + # Loading return value in $v1 + lw $v1, 20($sp) + + # Freeing space for local variables + addi $sp, $sp, 56 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_0 = address of allocated object Int + + # Set attribute rows of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 12($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.rows = internal_0 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_1 = address of allocated object Int + + # Set attribute columns of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_1 + sw $t1, 12($t0) # self.columns = internal_1 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Set attribute board_size of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_2 + sw $t1, 16($t0) # self.board_size = internal_2 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 0 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_3 = "" + + # Set attribute population_map of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_3 + sw $t1, 20($t0) # self.population_map = internal_3 + + # Set attribute cells of self + lw $t0, 16($sp) # $t0 = self + sw $zero, 24($t0) # Set the attribute cells of self + + # Loading return value in $v1 + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 96($sp) + # self = 92($sp) + + # Reserving space for local variables + addi $sp, $sp, -92 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 0 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 84($sp) # choice = "" + + # Allocating String + li $v0, 9 + addi $a0, $zero, 38 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 29 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 87 + sb $t0, 8($v0) # internal_2[0] = 'W' + + addi $t0, $zero, 101 + sb $t0, 9($v0) # internal_2[1] = 'e' + + addi $t0, $zero, 108 + sb $t0, 10($v0) # internal_2[2] = 'l' + + addi $t0, $zero, 99 + sb $t0, 11($v0) # internal_2[3] = 'c' + + addi $t0, $zero, 111 + sb $t0, 12($v0) # internal_2[4] = 'o' + + addi $t0, $zero, 109 + sb $t0, 13($v0) # internal_2[5] = 'm' + + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_2[6] = 'e' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_2[7] = ' ' + + addi $t0, $zero, 116 + sb $t0, 16($v0) # internal_2[8] = 't' + + addi $t0, $zero, 111 + sb $t0, 17($v0) # internal_2[9] = 'o' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_2[10] = ' ' + + addi $t0, $zero, 116 + sb $t0, 19($v0) # internal_2[11] = 't' + + addi $t0, $zero, 104 + sb $t0, 20($v0) # internal_2[12] = 'h' + + addi $t0, $zero, 101 + sb $t0, 21($v0) # internal_2[13] = 'e' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_2[14] = ' ' + + addi $t0, $zero, 71 + sb $t0, 23($v0) # internal_2[15] = 'G' + + addi $t0, $zero, 97 + sb $t0, 24($v0) # internal_2[16] = 'a' + + addi $t0, $zero, 109 + sb $t0, 25($v0) # internal_2[17] = 'm' + + addi $t0, $zero, 101 + sb $t0, 26($v0) # internal_2[18] = 'e' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_2[19] = ' ' + + addi $t0, $zero, 111 + sb $t0, 28($v0) # internal_2[20] = 'o' + + addi $t0, $zero, 102 + sb $t0, 29($v0) # internal_2[21] = 'f' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_2[22] = ' ' + + addi $t0, $zero, 76 + sb $t0, 31($v0) # internal_2[23] = 'L' + + addi $t0, $zero, 105 + sb $t0, 32($v0) # internal_2[24] = 'i' + + addi $t0, $zero, 102 + sb $t0, 33($v0) # internal_2[25] = 'f' + + addi $t0, $zero, 101 + sb $t0, 34($v0) # internal_2[26] = 'e' + + addi $t0, $zero, 46 + sb $t0, 35($v0) # internal_2[27] = '.' + + addi $t0, $zero, 10 + sb $t0, 36($v0) # internal_2[28] = '\n' + + sb $zero, 37($v0) # Null-terminator at the end of the string + + sw $v0, 80($sp) # internal_2 = "Welcome to the Game of Life.\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_2 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 88($sp) # internal_3 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 56 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 47 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 84 + sb $t0, 8($v0) # internal_4[0] = 'T' + + addi $t0, $zero, 104 + sb $t0, 9($v0) # internal_4[1] = 'h' + + addi $t0, $zero, 101 + sb $t0, 10($v0) # internal_4[2] = 'e' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_4[3] = 'r' + + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_4[4] = 'e' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_4[5] = ' ' + + addi $t0, $zero, 97 + sb $t0, 14($v0) # internal_4[6] = 'a' + + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_4[7] = 'r' + + addi $t0, $zero, 101 + sb $t0, 16($v0) # internal_4[8] = 'e' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_4[9] = ' ' + + addi $t0, $zero, 109 + sb $t0, 18($v0) # internal_4[10] = 'm' + + addi $t0, $zero, 97 + sb $t0, 19($v0) # internal_4[11] = 'a' + + addi $t0, $zero, 110 + sb $t0, 20($v0) # internal_4[12] = 'n' + + addi $t0, $zero, 121 + sb $t0, 21($v0) # internal_4[13] = 'y' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_4[14] = ' ' + + addi $t0, $zero, 105 + sb $t0, 23($v0) # internal_4[15] = 'i' + + addi $t0, $zero, 110 + sb $t0, 24($v0) # internal_4[16] = 'n' + + addi $t0, $zero, 105 + sb $t0, 25($v0) # internal_4[17] = 'i' + + addi $t0, $zero, 116 + sb $t0, 26($v0) # internal_4[18] = 't' + + addi $t0, $zero, 105 + sb $t0, 27($v0) # internal_4[19] = 'i' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_4[20] = 'a' + + addi $t0, $zero, 108 + sb $t0, 29($v0) # internal_4[21] = 'l' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_4[22] = ' ' + + addi $t0, $zero, 115 + sb $t0, 31($v0) # internal_4[23] = 's' + + addi $t0, $zero, 116 + sb $t0, 32($v0) # internal_4[24] = 't' + + addi $t0, $zero, 97 + sb $t0, 33($v0) # internal_4[25] = 'a' + + addi $t0, $zero, 116 + sb $t0, 34($v0) # internal_4[26] = 't' + + addi $t0, $zero, 101 + sb $t0, 35($v0) # internal_4[27] = 'e' + + addi $t0, $zero, 115 + sb $t0, 36($v0) # internal_4[28] = 's' + + addi $t0, $zero, 32 + sb $t0, 37($v0) # internal_4[29] = ' ' + + addi $t0, $zero, 116 + sb $t0, 38($v0) # internal_4[30] = 't' + + addi $t0, $zero, 111 + sb $t0, 39($v0) # internal_4[31] = 'o' + + addi $t0, $zero, 32 + sb $t0, 40($v0) # internal_4[32] = ' ' + + addi $t0, $zero, 99 + sb $t0, 41($v0) # internal_4[33] = 'c' + + addi $t0, $zero, 104 + sb $t0, 42($v0) # internal_4[34] = 'h' + + addi $t0, $zero, 111 + sb $t0, 43($v0) # internal_4[35] = 'o' + + addi $t0, $zero, 111 + sb $t0, 44($v0) # internal_4[36] = 'o' + + addi $t0, $zero, 115 + sb $t0, 45($v0) # internal_4[37] = 's' + + addi $t0, $zero, 101 + sb $t0, 46($v0) # internal_4[38] = 'e' + + addi $t0, $zero, 32 + sb $t0, 47($v0) # internal_4[39] = ' ' + + addi $t0, $zero, 102 + sb $t0, 48($v0) # internal_4[40] = 'f' + + addi $t0, $zero, 114 + sb $t0, 49($v0) # internal_4[41] = 'r' + + addi $t0, $zero, 111 + sb $t0, 50($v0) # internal_4[42] = 'o' + + addi $t0, $zero, 109 + sb $t0, 51($v0) # internal_4[43] = 'm' + + addi $t0, $zero, 46 + sb $t0, 52($v0) # internal_4[44] = '.' + + addi $t0, $zero, 32 + sb $t0, 53($v0) # internal_4[45] = ' ' + + addi $t0, $zero, 10 + sb $t0, 54($v0) # internal_4[46] = '\n' + + sb $zero, 55($v0) # Null-terminator at the end of the string + + sw $v0, 72($sp) # internal_4 = "There are many initial states to choose from. \n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_4 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_5 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + while_start_8789948673058: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_prompt2_at_CellularAutomaton + jal function_prompt2_at_CellularAutomaton + lw $ra, 4($sp) + sw $v1, 68($sp) # internal_7 = result of function_prompt2_at_CellularAutomaton + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 60($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 64($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_7 + lw $t0, 60($sp) + sw $t0, 64($sp) + end_assign: + + # If internal_6 then goto while_body_8789948673058 + lw $t0, 64($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8789948673058 + + # Jumping to while_end_8789948673058 + j while_end_8789948673058 + + while_body_8789948673058: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_8 = address of allocated object Int + + lw $t0, 56($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 88($sp) + j end_assign + not_is_Bool_or_Int: + # continue = internal_8 + lw $t0, 56($sp) + sw $t0, 88($sp) + end_assign: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_option_at_CellularAutomaton + jal function_option_at_CellularAutomaton + lw $ra, 4($sp) + sw $v1, 60($sp) # internal_9 = result of function_option_at_CellularAutomaton + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 52($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 84($sp) + j end_assign + not_is_Bool_or_Int: + # choice = internal_9 + lw $t0, 52($sp) + sw $t0, 84($sp) + end_assign: + + # Allocating CellularAutomaton + li $v0, 9 + lw $a0, type_CellularAutomaton + syscall + la $t0, type_CellularAutomaton # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 48($sp) # internal_10 = address of allocated object CellularAutomaton + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_10 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function___init___at_CellularAutomaton + jal function___init___at_CellularAutomaton + lw $ra, 4($sp) + sw $v1, 56($sp) # internal_10 = result of function___init___at_CellularAutomaton + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument choice + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing choice + + # Calling function function_init_at_CellularAutomaton + jal function_init_at_CellularAutomaton + lw $ra, 8($sp) + sw $v1, 56($sp) # internal_11 = result of function_init_at_CellularAutomaton + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute cells of self + lw $t0, 92($sp) # $t0 = self + lw $t1, 44($sp) # $t1 = internal_11 + sw $t1, 24($t0) # self.cells = internal_11 + + # Get attribute cells of self + lw $t0, 92($sp) # Get the address of self + lw $t1, 24($t0) # Get the attribute 'cells' from the instance + sw $t1, 40($sp) # internal_12 = cells + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_12 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_print_at_CellularAutomaton + jal function_print_at_CellularAutomaton + lw $ra, 4($sp) + sw $v1, 44($sp) # internal_13 = result of function_print_at_CellularAutomaton + addi $sp, $sp, 8 # Freeing space for arguments + + while_start_8789948673046: + + lw $t0, 88($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 32($sp) + j end_assign + not_is_Bool_or_Int: + # internal_14 = continue + lw $t0, 88($sp) + sw $t0, 32($sp) + end_assign: + + # If internal_14 then goto while_body_8789948673046 + lw $t0, 32($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8789948673046 + + # Jumping to while_end_8789948673046 + j while_end_8789948673046 + + while_body_8789948673046: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_16 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_prompt_at_CellularAutomaton + jal function_prompt_at_CellularAutomaton + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_17 = result of function_prompt_at_CellularAutomaton + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 20($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # internal_16 = internal_17 + lw $t0, 20($sp) + sw $t0, 24($sp) + end_assign: + + # If internal_16 then goto then_8789948673040 + lw $t0, 24($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8789948673040 + + # Jumping to else_8789948673040 + j else_8789948673040 + + then_8789948673040: + + # Get attribute cells of self + lw $t0, 92($sp) # Get the address of self + lw $t1, 24($t0) # Get the attribute 'cells' from the instance + sw $t1, 16($sp) # internal_18 = cells + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_18 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_18 + + # Calling function function_evolve_at_CellularAutomaton + jal function_evolve_at_CellularAutomaton + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_19 = result of function_evolve_at_CellularAutomaton + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute cells of self + lw $t0, 92($sp) # Get the address of self + lw $t1, 24($t0) # Get the attribute 'cells' from the instance + sw $t1, 8($sp) # internal_20 = cells + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_20 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function function_print_at_CellularAutomaton + jal function_print_at_CellularAutomaton + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_21 = result of function_print_at_CellularAutomaton + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 4($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 28($sp) + j end_assign + not_is_Bool_or_Int: + # internal_15 = internal_21 + lw $t0, 4($sp) + sw $t0, 28($sp) + end_assign: + + # Jumping to endif_8789948673040 + j endif_8789948673040 + + else_8789948673040: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_22 = address of allocated object Int + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 88($sp) + j end_assign + not_is_Bool_or_Int: + # continue = internal_22 + lw $t0, 0($sp) + sw $t0, 88($sp) + end_assign: + + lw $t0, 88($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 28($sp) + j end_assign + not_is_Bool_or_Int: + # internal_15 = continue + lw $t0, 88($sp) + sw $t0, 28($sp) + end_assign: + + # Jumping to endif_8789948673040 + j endif_8789948673040 + + endif_8789948673040: + + # Jumping to while_start_8789948673046 + j while_start_8789948673046 + + while_end_8789948673046: + + # Jumping to while_start_8789948673058 + j while_start_8789948673058 + + while_end_8789948673058: + + # Loading return value in $v1 + lw $v1, 92($sp) + + # Freeing space for local variables + addi $sp, $sp, 92 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_main_at_Main + jal function_main_at_Main + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/list.mips b/tests/codegen/list.mips new file mode 100644 index 000000000..a1f47d431 --- /dev/null +++ b/tests/codegen/list.mips @@ -0,0 +1,1846 @@ +.data + type_Object: .word 8 + type_Object_inherits_from: .word 0 + type_Object_attributes: .word 0 + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO: .word 8 + type_IO_inherits_from: .word type_Object + type_IO_attributes: .word 0 + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_Int: .word 8 + type_Int_inherits_from: .word type_Object + type_Int_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_String: .word 8 + type_String_inherits_from: .word type_Object + type_String_attributes: .word 0 + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Bool: .word 8 + type_Bool_inherits_from: .word type_Object + type_Bool_attributes: .word 0 + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_List: .word 8 + type_List_inherits_from: .word type_Object + type_List_attributes: .word 0 + type_List_name_size: .word 4 + type_List_name: .asciiz "List" + + type_Cons: .word 16 + type_Cons_inherits_from: .word type_List + type_Cons_attributes: .word 2 + type_Cons_name_size: .word 4 + type_Cons_name: .asciiz "Cons" + + type_Main: .word 12 + type_Main_inherits_from: .word type_IO + type_Main_attributes: .word 1 + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 40($sp) + # a = 36($sp) + # b = 32($sp) + + # Reserving space for local variables + addi $sp, $sp, -32 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_0 = address of allocated object Int + + # internal_1 = typeof a that is the first word of the object + lw $t0, 36($sp) + lw $t1, 0($t0) + sw $t1, 24($sp) + + # internal_2 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_3 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_4 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_7 = address of allocated object Int + + # internal_5 = EqualAddress(internal_1, internal_2) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_1, internal_3) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_7 = EqualAddress(internal_1, internal_4) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_6 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_7 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 36($sp) + lw $t0, 8($t0) + lw $t1, 32($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 36($sp) + lw $t1, 32($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 28($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 28($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 36($sp) # Save in $t0 the left operand address + lw $t1, 32($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 28($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 28($sp) + + # Freeing space for local variables + addi $sp, $sp, 32 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 12($t1) # $t1 = length of the name of self + lw $t3, 16($t1) # $t1 = name of self + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + move $t4, $v0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + addi $t0, $t0, 8 # Pointer to the first character of the string in self + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t1, while_copy_name_end + lb $t6, 0($t0) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t0, $t0, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $t4, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the string x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lw $t1, buffer_input($t0) # Loading the byte + beq $t1, $zero, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lw $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 5 + syscall + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + sw $t1, 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 0($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 0($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + lw $t2, 8($sp) # $t2 = start of the substring + lw $t3, 4($sp) # $t3 = length of the substring + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bge $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_List: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_isNil_at_List: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_head_at_List: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_abort_at_Object + jal function_abort_at_Object + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function_abort_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_1 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_tail_at_List: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_abort_at_Object + jal function_abort_at_Object + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_0 = result of function_abort_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_cons_at_List: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Cons + li $v0, 9 + lw $a0, type_Cons + syscall + la $t0, type_Cons # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object Cons + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Cons + jal function___init___at_Cons + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_Cons + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 8($sp) # Storing internal_0 + + # Argument i + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing i + + # Argument self + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_init_at_Cons + jal function_init_at_Cons + lw $ra, 12($sp) + sw $v1, 16($sp) # internal_1 = result of function_init_at_Cons + addi $sp, $sp, 16 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function___init___at_Cons: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Set attribute car of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.car = internal_0 + + # Set attribute cdr of self + lw $t0, 4($sp) # $t0 = self + sw $zero, 12($t0) # Set the attribute cdr of self + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_isNil_at_Cons: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_head_at_Cons: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute car of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'car' from the instance + sw $t1, 0($sp) # internal_0 = car + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_tail_at_Cons: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute cdr of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'cdr' from the instance + sw $t1, 0($sp) # internal_0 = cdr + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_init_at_Cons: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # i = 4($sp) + # rest = 0($sp) + + # Set attribute car of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = i + sw $t1, 8($t0) # self.car = i + + # Set attribute cdr of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = rest + sw $t1, 12($t0) # self.cdr = rest + + # Loading return value in $v1 + lw $v1, 8($sp) + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Set attribute mylist of self + lw $t0, 0($sp) # $t0 = self + sw $zero, 8($t0) # Set the attribute mylist of self + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_print_list_at_Main: + # Function parameters + # $ra = 52($sp) + # self = 48($sp) + # l = 44($sp) + + # Reserving space for local variables + addi $sp, $sp, -44 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument l + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing l + + # Calling function function_isNil_at_List + jal function_isNil_at_List + lw $ra, 4($sp) + sw $v1, 40($sp) # internal_2 = result of function_isNil_at_List + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 32($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 36($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_2 + lw $t0, 32($sp) + sw $t0, 36($sp) + end_assign: + + # If internal_1 then goto then_8770592017927 + lw $t0, 36($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8770592017927 + + # Jumping to else_8770592017927 + j else_8770592017927 + + then_8770592017927: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_3[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 28($sp) # internal_3 = "\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_3 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_4 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 24($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_4 + lw $t0, 24($sp) + sw $t0, 40($sp) + end_assign: + + # Jumping to endif_8770592017927 + j endif_8770592017927 + + else_8770592017927: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument l + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing l + + # Calling function function_head_at_List + jal function_head_at_List + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_5 = result of function_head_at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_5 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_out_int_at_IO + jal function_out_int_at_IO + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_6 = result of function_out_int_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_7[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_7 = " " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_7 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_8 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument l + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing l + + # Calling function function_tail_at_List + jal function_tail_at_List + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_9 = result of function_tail_at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_9 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_print_list_at_Main + jal function_print_list_at_Main + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_10 = result of function_print_list_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 40($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_10 + lw $t0, 0($sp) + sw $t0, 40($sp) + end_assign: + + # Jumping to endif_8770592017927 + j endif_8770592017927 + + endif_8770592017927: + + # Loading return value in $v1 + lw $v1, 40($sp) + + # Freeing space for local variables + addi $sp, $sp, 44 + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 84($sp) + # self = 80($sp) + + # Reserving space for local variables + addi $sp, $sp, -80 + + # Allocating List + li $v0, 9 + lw $a0, type_List + syscall + la $t0, type_List # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 76($sp) # internal_0 = address of allocated object List + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_List + jal function___init___at_List + lw $ra, 4($sp) + sw $v1, 84($sp) # internal_0 = result of function___init___at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_cons_at_List + jal function_cons_at_List + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_2 = result of function_cons_at_List + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_cons_at_List + jal function_cons_at_List + lw $ra, 8($sp) + sw $v1, 72($sp) # internal_4 = result of function_cons_at_List + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_5 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument internal_5 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_cons_at_List + jal function_cons_at_List + lw $ra, 8($sp) + sw $v1, 64($sp) # internal_6 = result of function_cons_at_List + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_6 + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing internal_6 + + # Argument internal_7 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_cons_at_List + jal function_cons_at_List + lw $ra, 8($sp) + sw $v1, 56($sp) # internal_8 = result of function_cons_at_List + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_9 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_8 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument internal_9 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_cons_at_List + jal function_cons_at_List + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_10 = result of function_cons_at_List + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute mylist of self + lw $t0, 80($sp) # $t0 = self + lw $t1, 36($sp) # $t1 = internal_10 + sw $t1, 8($t0) # self.mylist = internal_10 + + while_start_8770592018038: + + # Get attribute mylist of self + lw $t0, 80($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'mylist' from the instance + sw $t1, 28($sp) # internal_12 = mylist + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_12 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_isNil_at_List + jal function_isNil_at_List + lw $ra, 4($sp) + sw $v1, 32($sp) # internal_13 = result of function_isNil_at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_14 = address of allocated object Int + + # Xor operation + lw $t0, 24($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 20($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 16($sp) # $t0 = internal_15 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 32($sp) + j end_assign + not_is_Bool_or_Int: + # internal_11 = internal_15 + lw $t0, 16($sp) + sw $t0, 32($sp) + end_assign: + + # If internal_11 then goto while_body_8770592018038 + lw $t0, 32($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8770592018038 + + # Jumping to while_end_8770592018038 + j while_end_8770592018038 + + while_body_8770592018038: + + # Get attribute mylist of self + lw $t0, 80($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'mylist' from the instance + sw $t1, 12($sp) # internal_16 = mylist + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 92($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_16 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_print_list_at_Main + jal function_print_list_at_Main + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_17 = result of function_print_list_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute mylist of self + lw $t0, 80($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'mylist' from the instance + sw $t1, 4($sp) # internal_18 = mylist + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_18 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_18 + + # Calling function function_tail_at_List + jal function_tail_at_List + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_19 = result of function_tail_at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute mylist of self + lw $t0, 80($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_19 + sw $t1, 8($t0) # self.mylist = internal_19 + + # Jumping to while_start_8770592018038 + j while_start_8770592018038 + + while_end_8770592018038: + + # Loading return value in $v1 + addi $v1, $zero, 0 + + # Freeing space for local variables + addi $sp, $sp, 80 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_main_at_Main + jal function_main_at_Main + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/palindrome.mips b/tests/codegen/palindrome.mips new file mode 100644 index 000000000..498bcae35 --- /dev/null +++ b/tests/codegen/palindrome.mips @@ -0,0 +1,2075 @@ +.data + type_Object: .word 8 + type_Object_inherits_from: .word 0 + type_Object_attributes: .word 0 + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO: .word 8 + type_IO_inherits_from: .word type_Object + type_IO_attributes: .word 0 + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_Int: .word 8 + type_Int_inherits_from: .word type_Object + type_Int_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_String: .word 8 + type_String_inherits_from: .word type_Object + type_String_attributes: .word 0 + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Bool: .word 8 + type_Bool_inherits_from: .word type_Object + type_Bool_attributes: .word 0 + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_Main: .word 12 + type_Main_inherits_from: .word type_IO + type_Main_attributes: .word 1 + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 40($sp) + # a = 36($sp) + # b = 32($sp) + + # Reserving space for local variables + addi $sp, $sp, -32 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_0 = address of allocated object Int + + # internal_1 = typeof a that is the first word of the object + lw $t0, 36($sp) + lw $t1, 0($t0) + sw $t1, 24($sp) + + # internal_2 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_3 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_4 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_7 = address of allocated object Int + + # internal_5 = EqualAddress(internal_1, internal_2) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_1, internal_3) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_7 = EqualAddress(internal_1, internal_4) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_6 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_7 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 36($sp) + lw $t0, 8($t0) + lw $t1, 32($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 36($sp) + lw $t1, 32($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 28($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 28($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 36($sp) # Save in $t0 the left operand address + lw $t1, 32($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 28($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 28($sp) + + # Freeing space for local variables + addi $sp, $sp, 32 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 12($t1) # $t1 = length of the name of self + lw $t3, 16($t1) # $t1 = name of self + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + move $t4, $v0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + addi $t0, $t0, 8 # Pointer to the first character of the string in self + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t1, while_copy_name_end + lb $t6, 0($t0) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t0, $t0, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $t4, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the string x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lw $t1, buffer_input($t0) # Loading the byte + beq $t1, $zero, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lw $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 5 + syscall + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + sw $t1, 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 0($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 0($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + lw $t2, 8($sp) # $t2 = start of the substring + lw $t3, 4($sp) # $t3 = length of the substring + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bge $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Set attribute i of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + sw $t1, 8($t0) # self.i = internal_0 + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_pal_at_Main: + # Function parameters + # $ra = 128($sp) + # self = 124($sp) + # s = 120($sp) + + # Reserving space for local variables + addi $sp, $sp, -120 + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 116($sp) # internal_2 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 120($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 112($sp) # internal_4 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 100($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 112($sp) + j end_assign + not_is_Bool_or_Int: + # internal_1 = internal_4 + lw $t0, 100($sp) + sw $t0, 112($sp) + end_assign: + + # If internal_1 then goto then_8737511996832 + lw $t0, 112($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737511996832 + + # Jumping to else_8737511996832 + j else_8737511996832 + + then_8737511996832: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_5 = address of allocated object Int + + lw $t0, 96($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 116($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_5 + lw $t0, 96($sp) + sw $t0, 116($sp) + end_assign: + + # Jumping to endif_8737511996832 + j endif_8737511996832 + + else_8737511996832: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 92($sp) # internal_8 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_9 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_8 + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument internal_9 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 88($sp) # internal_10 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 76($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 88($sp) + j end_assign + not_is_Bool_or_Int: + # internal_7 = internal_10 + lw $t0, 76($sp) + sw $t0, 88($sp) + end_assign: + + # If internal_7 then goto then_8737511996814 + lw $t0, 88($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737511996814 + + # Jumping to else_8737511996814 + j else_8737511996814 + + then_8737511996814: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_11 = address of allocated object Int + + lw $t0, 72($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 92($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_11 + lw $t0, 72($sp) + sw $t0, 92($sp) + end_assign: + + # Jumping to endif_8737511996814 + j endif_8737511996814 + + else_8737511996814: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_13 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_14 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_15 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 136($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_14 + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing internal_14 + + # Argument internal_15 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 68($sp) # internal_16 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 56($sp) # internal_17 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_18 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_17 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing internal_17 + + # Argument internal_18 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_18 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_19 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_20 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 136($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_19 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_19 + + # Argument internal_20 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 48($sp) # internal_21 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_16 + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing internal_16 + + # Argument internal_21 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_21 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_22 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 28($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 64($sp) + j end_assign + not_is_Bool_or_Int: + # internal_13 = internal_22 + lw $t0, 28($sp) + sw $t0, 64($sp) + end_assign: + + # If internal_13 then goto then_8737511996817 + lw $t0, 64($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737511996817 + + # Jumping to else_8737511996817 + j else_8737511996817 + + then_8737511996817: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_23 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_24 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_25 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_24 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_24 + + # Argument internal_25 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_25 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_26 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 136($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_23 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_23 + + # Argument internal_26 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_26 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 24($sp) # internal_27 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 136($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_27 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_27 + + # Calling function function_pal_at_Main + jal function_pal_at_Main + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_28 = result of function_pal_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 4($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 68($sp) + j end_assign + not_is_Bool_or_Int: + # internal_12 = internal_28 + lw $t0, 4($sp) + sw $t0, 68($sp) + end_assign: + + # Jumping to endif_8737511996817 + j endif_8737511996817 + + else_8737511996817: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_29 = address of allocated object Int + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 68($sp) + j end_assign + not_is_Bool_or_Int: + # internal_12 = internal_29 + lw $t0, 0($sp) + sw $t0, 68($sp) + end_assign: + + # Jumping to endif_8737511996817 + j endif_8737511996817 + + endif_8737511996817: + + lw $t0, 68($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 92($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_12 + lw $t0, 68($sp) + sw $t0, 92($sp) + end_assign: + + # Jumping to endif_8737511996814 + j endif_8737511996814 + + endif_8737511996814: + + lw $t0, 92($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 116($sp) + j end_assign + not_is_Bool_or_Int: + # internal_0 = internal_6 + lw $t0, 92($sp) + sw $t0, 116($sp) + end_assign: + + # Jumping to endif_8737511996832 + j endif_8737511996832 + + endif_8737511996832: + + # Loading return value in $v1 + lw $v1, 116($sp) + + # Freeing space for local variables + addi $sp, $sp, 120 + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 60($sp) + # self = 56($sp) + + # Reserving space for local variables + addi $sp, $sp, -56 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 52($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 44($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 40($sp) # $t0 = internal_3 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Addition operation + lw $t0, 40($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 48($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 40($sp) # $t0 = internal_3 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Set attribute i of self + lw $t0, 56($sp) # $t0 = self + lw $t1, 40($sp) # $t1 = internal_3 + sw $t1, 8($t0) # self.i = internal_3 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 24 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 15 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 101 + sb $t0, 8($v0) # internal_4[0] = 'e' + + addi $t0, $zero, 110 + sb $t0, 9($v0) # internal_4[1] = 'n' + + addi $t0, $zero, 116 + sb $t0, 10($v0) # internal_4[2] = 't' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_4[3] = 'e' + + addi $t0, $zero, 114 + sb $t0, 12($v0) # internal_4[4] = 'r' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_4[5] = ' ' + + addi $t0, $zero, 97 + sb $t0, 14($v0) # internal_4[6] = 'a' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_4[7] = ' ' + + addi $t0, $zero, 115 + sb $t0, 16($v0) # internal_4[8] = 's' + + addi $t0, $zero, 116 + sb $t0, 17($v0) # internal_4[9] = 't' + + addi $t0, $zero, 114 + sb $t0, 18($v0) # internal_4[10] = 'r' + + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_4[11] = 'i' + + addi $t0, $zero, 110 + sb $t0, 20($v0) # internal_4[12] = 'n' + + addi $t0, $zero, 103 + sb $t0, 21($v0) # internal_4[13] = 'g' + + addi $t0, $zero, 10 + sb $t0, 22($v0) # internal_4[14] = '\n' + + sb $zero, 23($v0) # Null-terminator at the end of the string + + sw $v0, 36($sp) # internal_4 = "enter a string\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_4 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_5 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_in_string_at_IO + jal function_in_string_at_IO + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_8 = result of function_in_string_at_IO + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_8 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_pal_at_Main + jal function_pal_at_Main + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_9 = result of function_pal_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 16($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # internal_7 = internal_9 + lw $t0, 16($sp) + sw $t0, 24($sp) + end_assign: + + # If internal_7 then goto then_8737511996898 + lw $t0, 24($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737511996898 + + # Jumping to else_8737511996898 + j else_8737511996898 + + then_8737511996898: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 31 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 22 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 116 + sb $t0, 8($v0) # internal_10[0] = 't' + + addi $t0, $zero, 104 + sb $t0, 9($v0) # internal_10[1] = 'h' + + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_10[2] = 'a' + + addi $t0, $zero, 116 + sb $t0, 11($v0) # internal_10[3] = 't' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_10[4] = ' ' + + addi $t0, $zero, 119 + sb $t0, 13($v0) # internal_10[5] = 'w' + + addi $t0, $zero, 97 + sb $t0, 14($v0) # internal_10[6] = 'a' + + addi $t0, $zero, 115 + sb $t0, 15($v0) # internal_10[7] = 's' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_10[8] = ' ' + + addi $t0, $zero, 97 + sb $t0, 17($v0) # internal_10[9] = 'a' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_10[10] = ' ' + + addi $t0, $zero, 112 + sb $t0, 19($v0) # internal_10[11] = 'p' + + addi $t0, $zero, 97 + sb $t0, 20($v0) # internal_10[12] = 'a' + + addi $t0, $zero, 108 + sb $t0, 21($v0) # internal_10[13] = 'l' + + addi $t0, $zero, 105 + sb $t0, 22($v0) # internal_10[14] = 'i' + + addi $t0, $zero, 110 + sb $t0, 23($v0) # internal_10[15] = 'n' + + addi $t0, $zero, 100 + sb $t0, 24($v0) # internal_10[16] = 'd' + + addi $t0, $zero, 114 + sb $t0, 25($v0) # internal_10[17] = 'r' + + addi $t0, $zero, 111 + sb $t0, 26($v0) # internal_10[18] = 'o' + + addi $t0, $zero, 109 + sb $t0, 27($v0) # internal_10[19] = 'm' + + addi $t0, $zero, 101 + sb $t0, 28($v0) # internal_10[20] = 'e' + + addi $t0, $zero, 10 + sb $t0, 29($v0) # internal_10[21] = '\n' + + sb $zero, 30($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_10 = "that was a palindrome\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_10 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_11 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 8($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 28($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_11 + lw $t0, 8($sp) + sw $t0, 28($sp) + end_assign: + + # Jumping to endif_8737511996898 + j endif_8737511996898 + + else_8737511996898: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 35 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 26 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 116 + sb $t0, 8($v0) # internal_12[0] = 't' + + addi $t0, $zero, 104 + sb $t0, 9($v0) # internal_12[1] = 'h' + + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_12[2] = 'a' + + addi $t0, $zero, 116 + sb $t0, 11($v0) # internal_12[3] = 't' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_12[4] = ' ' + + addi $t0, $zero, 119 + sb $t0, 13($v0) # internal_12[5] = 'w' + + addi $t0, $zero, 97 + sb $t0, 14($v0) # internal_12[6] = 'a' + + addi $t0, $zero, 115 + sb $t0, 15($v0) # internal_12[7] = 's' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_12[8] = ' ' + + addi $t0, $zero, 110 + sb $t0, 17($v0) # internal_12[9] = 'n' + + addi $t0, $zero, 111 + sb $t0, 18($v0) # internal_12[10] = 'o' + + addi $t0, $zero, 116 + sb $t0, 19($v0) # internal_12[11] = 't' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_12[12] = ' ' + + addi $t0, $zero, 97 + sb $t0, 21($v0) # internal_12[13] = 'a' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_12[14] = ' ' + + addi $t0, $zero, 112 + sb $t0, 23($v0) # internal_12[15] = 'p' + + addi $t0, $zero, 97 + sb $t0, 24($v0) # internal_12[16] = 'a' + + addi $t0, $zero, 108 + sb $t0, 25($v0) # internal_12[17] = 'l' + + addi $t0, $zero, 105 + sb $t0, 26($v0) # internal_12[18] = 'i' + + addi $t0, $zero, 110 + sb $t0, 27($v0) # internal_12[19] = 'n' + + addi $t0, $zero, 100 + sb $t0, 28($v0) # internal_12[20] = 'd' + + addi $t0, $zero, 114 + sb $t0, 29($v0) # internal_12[21] = 'r' + + addi $t0, $zero, 111 + sb $t0, 30($v0) # internal_12[22] = 'o' + + addi $t0, $zero, 109 + sb $t0, 31($v0) # internal_12[23] = 'm' + + addi $t0, $zero, 101 + sb $t0, 32($v0) # internal_12[24] = 'e' + + addi $t0, $zero, 10 + sb $t0, 33($v0) # internal_12[25] = '\n' + + sb $zero, 34($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_12 = "that was not a palindrome\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_12 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_13 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 28($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_13 + lw $t0, 0($sp) + sw $t0, 28($sp) + end_assign: + + # Jumping to endif_8737511996898 + j endif_8737511996898 + + endif_8737511996898: + + # Loading return value in $v1 + lw $v1, 28($sp) + + # Freeing space for local variables + addi $sp, $sp, 56 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_main_at_Main + jal function_main_at_Main + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/primes.mips b/tests/codegen/primes.mips new file mode 100644 index 000000000..f2573c9a3 --- /dev/null +++ b/tests/codegen/primes.mips @@ -0,0 +1,2139 @@ +.data + type_Object: .word 8 + type_Object_inherits_from: .word 0 + type_Object_attributes: .word 0 + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO: .word 8 + type_IO_inherits_from: .word type_Object + type_IO_attributes: .word 0 + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_Int: .word 8 + type_Int_inherits_from: .word type_Object + type_Int_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_String: .word 8 + type_String_inherits_from: .word type_Object + type_String_attributes: .word 0 + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Bool: .word 8 + type_Bool_inherits_from: .word type_Object + type_Bool_attributes: .word 0 + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_Main: .word 28 + type_Main_inherits_from: .word type_IO + type_Main_attributes: .word 5 + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 40($sp) + # a = 36($sp) + # b = 32($sp) + + # Reserving space for local variables + addi $sp, $sp, -32 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_0 = address of allocated object Int + + # internal_1 = typeof a that is the first word of the object + lw $t0, 36($sp) + lw $t1, 0($t0) + sw $t1, 24($sp) + + # internal_2 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_3 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_4 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_7 = address of allocated object Int + + # internal_5 = EqualAddress(internal_1, internal_2) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_1, internal_3) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_7 = EqualAddress(internal_1, internal_4) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_6 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_7 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 36($sp) + lw $t0, 8($t0) + lw $t1, 32($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 36($sp) + lw $t1, 32($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 28($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 28($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 36($sp) # Save in $t0 the left operand address + lw $t1, 32($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 28($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 28($sp) + + # Freeing space for local variables + addi $sp, $sp, 32 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 12($t1) # $t1 = length of the name of self + lw $t3, 16($t1) # $t1 = name of self + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + move $t4, $v0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + addi $t0, $t0, 8 # Pointer to the first character of the string in self + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t1, while_copy_name_end + lb $t6, 0($t0) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t0, $t0, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $t4, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the string x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lw $t1, buffer_input($t0) # Loading the byte + beq $t1, $zero, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lw $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 5 + syscall + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + sw $t1, 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 0($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 0($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + lw $t2, 8($sp) # $t2 = start of the substring + lw $t3, 4($sp) # $t3 = length of the substring + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bge $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 236($sp) + # self = 232($sp) + + # Reserving space for local variables + addi $sp, $sp, -232 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 31 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 22 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 50 + sb $t0, 8($v0) # internal_0[0] = '2' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_0[1] = ' ' + + addi $t0, $zero, 105 + sb $t0, 10($v0) # internal_0[2] = 'i' + + addi $t0, $zero, 115 + sb $t0, 11($v0) # internal_0[3] = 's' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_0[4] = ' ' + + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_0[5] = 't' + + addi $t0, $zero, 114 + sb $t0, 14($v0) # internal_0[6] = 'r' + + addi $t0, $zero, 105 + sb $t0, 15($v0) # internal_0[7] = 'i' + + addi $t0, $zero, 118 + sb $t0, 16($v0) # internal_0[8] = 'v' + + addi $t0, $zero, 105 + sb $t0, 17($v0) # internal_0[9] = 'i' + + addi $t0, $zero, 97 + sb $t0, 18($v0) # internal_0[10] = 'a' + + addi $t0, $zero, 108 + sb $t0, 19($v0) # internal_0[11] = 'l' + + addi $t0, $zero, 108 + sb $t0, 20($v0) # internal_0[12] = 'l' + + addi $t0, $zero, 121 + sb $t0, 21($v0) # internal_0[13] = 'y' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_0[14] = ' ' + + addi $t0, $zero, 112 + sb $t0, 23($v0) # internal_0[15] = 'p' + + addi $t0, $zero, 114 + sb $t0, 24($v0) # internal_0[16] = 'r' + + addi $t0, $zero, 105 + sb $t0, 25($v0) # internal_0[17] = 'i' + + addi $t0, $zero, 109 + sb $t0, 26($v0) # internal_0[18] = 'm' + + addi $t0, $zero, 101 + sb $t0, 27($v0) # internal_0[19] = 'e' + + addi $t0, $zero, 46 + sb $t0, 28($v0) # internal_0[20] = '.' + + addi $t0, $zero, 10 + sb $t0, 29($v0) # internal_0[21] = '\n' + + sb $zero, 30($v0) # Null-terminator at the end of the string + + sw $v0, 228($sp) # internal_0 = "2 is trivially prime.\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 244($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 240($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 236($sp) # internal_1 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 220($sp) # internal_2 = address of allocated object Int + + # Set attribute out of self + lw $t0, 232($sp) # $t0 = self + lw $t1, 220($sp) # $t1 = internal_2 + sw $t1, 8($t0) # self.out = internal_2 + + # Get attribute out of self + lw $t0, 232($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'out' from the instance + sw $t1, 216($sp) # internal_3 = out + + # Set attribute testee of self + lw $t0, 232($sp) # $t0 = self + lw $t1, 216($sp) # $t1 = internal_3 + sw $t1, 12($t0) # self.testee = internal_3 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 212($sp) # internal_4 = address of allocated object Int + + # Set attribute divisor of self + lw $t0, 232($sp) # $t0 = self + lw $t1, 212($sp) # $t1 = internal_4 + sw $t1, 16($t0) # self.divisor = internal_4 + + # Allocating Int 500 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 500 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 208($sp) # internal_5 = address of allocated object Int + + # Set attribute stop of self + lw $t0, 232($sp) # $t0 = self + lw $t1, 208($sp) # $t1 = internal_5 + sw $t1, 20($t0) # self.stop = internal_5 + + while_start_8728017462209: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 200($sp) # internal_7 = address of allocated object Int + + lw $t0, 200($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 204($sp) + j end_assign + not_is_Bool_or_Int: + # internal_6 = internal_7 + lw $t0, 200($sp) + sw $t0, 204($sp) + end_assign: + + # If internal_6 then goto while_body_8728017462209 + lw $t0, 204($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8728017462209 + + # Jumping to while_end_8728017462209 + j while_end_8728017462209 + + while_body_8728017462209: + + # Get attribute testee of self + lw $t0, 232($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'testee' from the instance + sw $t1, 196($sp) # internal_8 = testee + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 192($sp) # internal_9 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_8 + lw $t0, 208($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument internal_9 + lw $t0, 204($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 200($sp) # internal_10 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute testee of self + lw $t0, 232($sp) # $t0 = self + lw $t1, 188($sp) # $t1 = internal_10 + sw $t1, 12($t0) # self.testee = internal_10 + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 184($sp) # internal_11 = address of allocated object Int + + # Set attribute divisor of self + lw $t0, 232($sp) # $t0 = self + lw $t1, 184($sp) # $t1 = internal_11 + sw $t1, 16($t0) # self.divisor = internal_11 + + while_start_8728017462077: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 172($sp) # internal_14 = address of allocated object Int + + # Get attribute testee of self + lw $t0, 232($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'testee' from the instance + sw $t1, 168($sp) # internal_15 = testee + + # Get attribute divisor of self + lw $t0, 232($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'divisor' from the instance + sw $t1, 164($sp) # internal_16 = divisor + + # Get attribute divisor of self + lw $t0, 232($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'divisor' from the instance + sw $t1, 160($sp) # internal_17 = divisor + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_16 + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing internal_16 + + # Argument internal_17 + lw $t0, 172($sp) + sw $t0, 0($sp) # Storing internal_17 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 168($sp) # internal_18 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_15 + lw $t0, 180($sp) + sw $t0, 4($sp) # Storing internal_15 + + # Argument internal_18 + lw $t0, 168($sp) + sw $t0, 0($sp) # Storing internal_18 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 164($sp) # internal_19 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 152($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 172($sp) + j end_assign + not_is_Bool_or_Int: + # internal_14 = internal_19 + lw $t0, 152($sp) + sw $t0, 172($sp) + end_assign: + + # If internal_14 then goto then_8728017462053 + lw $t0, 172($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8728017462053 + + # Jumping to else_8728017462053 + j else_8728017462053 + + then_8728017462053: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 148($sp) # internal_20 = address of allocated object Int + + lw $t0, 148($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 176($sp) + j end_assign + not_is_Bool_or_Int: + # internal_13 = internal_20 + lw $t0, 148($sp) + sw $t0, 176($sp) + end_assign: + + # Jumping to endif_8728017462053 + j endif_8728017462053 + + else_8728017462053: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 140($sp) # internal_22 = address of allocated object Int + + # Get attribute testee of self + lw $t0, 232($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'testee' from the instance + sw $t1, 136($sp) # internal_23 = testee + + # Get attribute divisor of self + lw $t0, 232($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'divisor' from the instance + sw $t1, 132($sp) # internal_24 = divisor + + # Get attribute testee of self + lw $t0, 232($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'testee' from the instance + sw $t1, 128($sp) # internal_25 = testee + + # Get attribute divisor of self + lw $t0, 232($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'divisor' from the instance + sw $t1, 124($sp) # internal_26 = divisor + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_25 + lw $t0, 140($sp) + sw $t0, 4($sp) # Storing internal_25 + + # Argument internal_26 + lw $t0, 136($sp) + sw $t0, 0($sp) # Storing internal_26 + + # Calling function function_div + jal function_div + lw $ra, 8($sp) + sw $v1, 132($sp) # internal_27 = result of function_div + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_24 + lw $t0, 144($sp) + sw $t0, 4($sp) # Storing internal_24 + + # Argument internal_27 + lw $t0, 132($sp) + sw $t0, 0($sp) # Storing internal_27 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 128($sp) # internal_28 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_23 + lw $t0, 148($sp) + sw $t0, 4($sp) # Storing internal_23 + + # Argument internal_28 + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing internal_28 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 124($sp) # internal_29 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_30 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_29 + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing internal_29 + + # Argument internal_30 + lw $t0, 120($sp) + sw $t0, 0($sp) # Storing internal_30 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 116($sp) # internal_31 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 104($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 140($sp) + j end_assign + not_is_Bool_or_Int: + # internal_22 = internal_31 + lw $t0, 104($sp) + sw $t0, 140($sp) + end_assign: + + # If internal_22 then goto then_8728017462047 + lw $t0, 140($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8728017462047 + + # Jumping to else_8728017462047 + j else_8728017462047 + + then_8728017462047: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_32 = address of allocated object Int + + lw $t0, 100($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 144($sp) + j end_assign + not_is_Bool_or_Int: + # internal_21 = internal_32 + lw $t0, 100($sp) + sw $t0, 144($sp) + end_assign: + + # Jumping to endif_8728017462047 + j endif_8728017462047 + + else_8728017462047: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_33 = address of allocated object Int + + lw $t0, 96($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 144($sp) + j end_assign + not_is_Bool_or_Int: + # internal_21 = internal_33 + lw $t0, 96($sp) + sw $t0, 144($sp) + end_assign: + + # Jumping to endif_8728017462047 + j endif_8728017462047 + + endif_8728017462047: + + lw $t0, 144($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 176($sp) + j end_assign + not_is_Bool_or_Int: + # internal_13 = internal_21 + lw $t0, 144($sp) + sw $t0, 176($sp) + end_assign: + + # Jumping to endif_8728017462053 + j endif_8728017462053 + + endif_8728017462053: + + lw $t0, 176($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 180($sp) + j end_assign + not_is_Bool_or_Int: + # internal_12 = internal_13 + lw $t0, 176($sp) + sw $t0, 180($sp) + end_assign: + + # If internal_12 then goto while_body_8728017462077 + lw $t0, 180($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8728017462077 + + # Jumping to while_end_8728017462077 + j while_end_8728017462077 + + while_body_8728017462077: + + # Get attribute divisor of self + lw $t0, 232($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'divisor' from the instance + sw $t1, 92($sp) # internal_34 = divisor + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_35 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_34 + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing internal_34 + + # Argument internal_35 + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing internal_35 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 96($sp) # internal_36 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute divisor of self + lw $t0, 232($sp) # $t0 = self + lw $t1, 84($sp) # $t1 = internal_36 + sw $t1, 16($t0) # self.divisor = internal_36 + + # Jumping to while_start_8728017462077 + j while_start_8728017462077 + + while_end_8728017462077: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_38 = address of allocated object Int + + # Get attribute testee of self + lw $t0, 232($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'testee' from the instance + sw $t1, 72($sp) # internal_39 = testee + + # Get attribute divisor of self + lw $t0, 232($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'divisor' from the instance + sw $t1, 68($sp) # internal_40 = divisor + + # Get attribute divisor of self + lw $t0, 232($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'divisor' from the instance + sw $t1, 64($sp) # internal_41 = divisor + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_40 + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing internal_40 + + # Argument internal_41 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_41 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 72($sp) # internal_42 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_39 + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing internal_39 + + # Argument internal_42 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_42 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_43 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 56($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 76($sp) + j end_assign + not_is_Bool_or_Int: + # internal_38 = internal_43 + lw $t0, 56($sp) + sw $t0, 76($sp) + end_assign: + + # If internal_38 then goto then_8728017462143 + lw $t0, 76($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8728017462143 + + # Jumping to else_8728017462143 + j else_8728017462143 + + then_8728017462143: + + # Get attribute testee of self + lw $t0, 232($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'testee' from the instance + sw $t1, 52($sp) # internal_44 = testee + + # Set attribute out of self + lw $t0, 232($sp) # $t0 = self + lw $t1, 52($sp) # $t1 = internal_44 + sw $t1, 8($t0) # self.out = internal_44 + + # Get attribute out of self + lw $t0, 232($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'out' from the instance + sw $t1, 48($sp) # internal_45 = out + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 244($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_45 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_45 + + # Calling function function_out_int_at_IO + jal function_out_int_at_IO + lw $ra, 8($sp) + sw $v1, 56($sp) # internal_46 = result of function_out_int_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 11 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_47[0] = ' ' + + addi $t0, $zero, 105 + sb $t0, 9($v0) # internal_47[1] = 'i' + + addi $t0, $zero, 115 + sb $t0, 10($v0) # internal_47[2] = 's' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_47[3] = ' ' + + addi $t0, $zero, 112 + sb $t0, 12($v0) # internal_47[4] = 'p' + + addi $t0, $zero, 114 + sb $t0, 13($v0) # internal_47[5] = 'r' + + addi $t0, $zero, 105 + sb $t0, 14($v0) # internal_47[6] = 'i' + + addi $t0, $zero, 109 + sb $t0, 15($v0) # internal_47[7] = 'm' + + addi $t0, $zero, 101 + sb $t0, 16($v0) # internal_47[8] = 'e' + + addi $t0, $zero, 46 + sb $t0, 17($v0) # internal_47[9] = '.' + + addi $t0, $zero, 10 + sb $t0, 18($v0) # internal_47[10] = '\n' + + sb $zero, 19($v0) # Null-terminator at the end of the string + + sw $v0, 40($sp) # internal_47 = " is prime.\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 244($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_47 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_47 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_48 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 36($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 80($sp) + j end_assign + not_is_Bool_or_Int: + # internal_37 = internal_48 + lw $t0, 36($sp) + sw $t0, 80($sp) + end_assign: + + # Jumping to endif_8728017462143 + j endif_8728017462143 + + else_8728017462143: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_49 = address of allocated object Int + + lw $t0, 32($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 80($sp) + j end_assign + not_is_Bool_or_Int: + # internal_37 = internal_49 + lw $t0, 32($sp) + sw $t0, 80($sp) + end_assign: + + # Jumping to endif_8728017462143 + j endif_8728017462143 + + endif_8728017462143: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_51 = address of allocated object Int + + # Get attribute stop of self + lw $t0, 232($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'stop' from the instance + sw $t1, 20($sp) # internal_52 = stop + + # Get attribute testee of self + lw $t0, 232($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'testee' from the instance + sw $t1, 16($sp) # internal_53 = testee + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_52 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_52 + + # Argument internal_53 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_53 + + # Calling function function_less_than_or_equal + jal function_less_than_or_equal + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_54 = result of function_less_than_or_equal + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 24($sp) + j end_assign + not_is_Bool_or_Int: + # internal_51 = internal_54 + lw $t0, 12($sp) + sw $t0, 24($sp) + end_assign: + + # If internal_51 then goto then_8728017462191 + lw $t0, 24($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8728017462191 + + # Jumping to else_8728017462191 + j else_8728017462191 + + then_8728017462191: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 13 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 4 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 104 + sb $t0, 8($v0) # internal_55[0] = 'h' + + addi $t0, $zero, 97 + sb $t0, 9($v0) # internal_55[1] = 'a' + + addi $t0, $zero, 108 + sb $t0, 10($v0) # internal_55[2] = 'l' + + addi $t0, $zero, 116 + sb $t0, 11($v0) # internal_55[3] = 't' + + sb $zero, 12($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_55 = "halt" + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_55 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_55 + + # Calling function function_abort_at_Object + jal function_abort_at_Object + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_56 = result of function_abort_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + lw $t0, 4($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 28($sp) + j end_assign + not_is_Bool_or_Int: + # internal_50 = internal_56 + lw $t0, 4($sp) + sw $t0, 28($sp) + end_assign: + + # Jumping to endif_8728017462191 + j endif_8728017462191 + + else_8728017462191: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 17 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 8 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 99 + sb $t0, 8($v0) # internal_57[0] = 'c' + + addi $t0, $zero, 111 + sb $t0, 9($v0) # internal_57[1] = 'o' + + addi $t0, $zero, 110 + sb $t0, 10($v0) # internal_57[2] = 'n' + + addi $t0, $zero, 116 + sb $t0, 11($v0) # internal_57[3] = 't' + + addi $t0, $zero, 105 + sb $t0, 12($v0) # internal_57[4] = 'i' + + addi $t0, $zero, 110 + sb $t0, 13($v0) # internal_57[5] = 'n' + + addi $t0, $zero, 117 + sb $t0, 14($v0) # internal_57[6] = 'u' + + addi $t0, $zero, 101 + sb $t0, 15($v0) # internal_57[7] = 'e' + + sb $zero, 16($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_57 = "continue" + + lw $t0, 0($sp) + lw $t1, 0($t0) + la $t2, type_Main + la $t3, type_Bool + beq $t1, $t2, is_Bool_or_Int + beq $t1, $t3, is_Bool_or_Int + j not_is_Bool_or_Int + is_Bool_or_Int: + lw $t4, 8($t0) + lw $t5, 28($sp) + j end_assign + not_is_Bool_or_Int: + # internal_50 = internal_57 + lw $t0, 0($sp) + sw $t0, 28($sp) + end_assign: + + # Jumping to endif_8728017462191 + j endif_8728017462191 + + endif_8728017462191: + + # Jumping to while_start_8728017462209 + j while_start_8728017462209 + + while_end_8728017462209: + + # Set attribute m of self + lw $t0, 232($sp) # $t0 = self + addi $t1, $zero, 0 # $t1 0 + sw $t1, 24($t0) # Set the attribute m of self + + # Loading return value in $v1 + lw $v1, 232($sp) + + # Freeing space for local variables + addi $sp, $sp, 232 + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_main_at_Main + jal function_main_at_Main + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file From 5846e9d6a75805ca7b88675c8809dbee755df709 Mon Sep 17 00:00:00 2001 From: LauTB <45464137+LauTB@users.noreply.github.com> Date: Fri, 25 Feb 2022 23:19:29 -0500 Subject: [PATCH 141/143] updated readme and upload report --- doc/Informe.md | 41 ----------------------------------------- doc/Readme.md | 32 +++++++------------------------- doc/report.pdf | Bin 0 -> 104642 bytes 3 files changed, 7 insertions(+), 66 deletions(-) delete mode 100644 doc/Informe.md create mode 100644 doc/report.pdf diff --git a/doc/Informe.md b/doc/Informe.md deleted file mode 100644 index 69f3dc7cf..000000000 --- a/doc/Informe.md +++ /dev/null @@ -1,41 +0,0 @@ -# Informe sobre el Proyecto de Compilación - -## Estudiantes - - - Alejandro Klever Clemente (C-411) - - Laura Tamayo Blanco (C-411) - - Miguel Angel Gonzalez Calles (C-411) - -### 1. Proceso de parsing y lexing - -Para este proceso usamos la biblioteca de python `PyJapt` la cual ha sido desarrollada por este equipo y publicada bajo licencia MIT en GitHub y Pypi. - -La documentacion de PyJapt es rica en ejemplos y casos de uso. Puede ser consultada [aqui](https://github.com/alejandroklever/PyJapt). - -La gramatica del lenguaje es una gramatica `LALR(1)`, por lo que tenemos unas tablas action y goto bastante pequeñas en comparación con las de una parser `LR(1)`, y por lo tanto mucho mas rápido de construir y menos costoso espacialmente. - -Actualmente tanto los test de análisis sintáctico y lexicográficos han sido pasados sin problemas. - -### 2. Proceso de análisis semantico - -Para esta parte usamos el patrón visitor aprendido durante el curso de 3er año. Por lo cual recibimos el ast obtenido producto del proceso de parsing y pasará por diferentes clases que irán construyendo: - -- el contexto: Donde de guardara la información de las clases del programa en COOL. -- el scope: Donde se almacena la información de las atributos, variables y parámetros de cada clase y método. - -#### 2.1 Pipeline - -Para el proceso de análisis semantico usamos las siguientes clases que usan el patrón visitor para acceder a cada nodo del ast y obtener nueva información en distintos recorridos: - -- TypeCollector: Encargada de recolectar los tipos de todas las clases del programa de COOL. -- TypeBuilder: Encargado de recolectar la información de los atributos y metodos de cada clase -- OverriddenMethodChecker: Encargado comprobar que la sobreescritura de metodos es concistente. -- TypeChecker: Encargado del cumplimiento de todas las reglas entre los tipos. - -Los tests de semántica están vencidos parcialmente, pues el formato de los mensajes de error aún no es correcto. Estamos trabajando en ello con un primer recorrido que se encargara de asignar a cada nodo del ast la fila y la columna significativa de este de la produccion que generó este nodo. - -Por ejemplo, en el caso de los nodos de la instrucción `let declaration-list in expr` la fila y columna significativa será la del keyword `let`. - -### 3. Conclusiones - -Esperamos proximamente solventar el formato de los errores semanticos siguiendo esta idea. Asi que en resumen, hemos logrado superar la parte de lexing y parsing y estamos cerca de superar los tests de semántica diff --git a/doc/Readme.md b/doc/Readme.md index a7ed0e32d..41c5e7772 100644 --- a/doc/Readme.md +++ b/doc/Readme.md @@ -2,32 +2,14 @@ ## Readme -Modifique el contenido de este documento para documentar de forma clara y concisa los siguientes aspectos: -- Cómo ejecutar (y compilar si es necesario) su compilador. -- Requisitos adicionales, dependencias, configuración, etc. -- Opciones adicionales que tenga su compilador. +El compilador ha sido realizado en el lenguaje de programación Python y posee las siguientes dependencias: -## Sobre los Equipos de Desarrollo +- pytest +- pytest-ordering +- pyjapt +- typer -Para desarrollar el compilador del lenguaje COOL se trabajará en equipos de 2 o 3 integrantes. El proyecto de Compilación será recogido y evaluado únicamente a través de Github. Es imprescindible tener una cuenta de Github para cada participante, y que su proyecto esté correctamente hosteado en esta plataforma. +Detalles sobre las versiones necesarias por cada biblioteca en el requirements.txt del proyecto. -**⚠️ NOTA**: Debe completar el archivo `team.yml` con los datos correctos de cada miembro de su equipo. - -## Sobre los Materiales a Entregar - -Para la evaluación del proyecto Ud. debe entregar un informe en formato PDF (`report.pdf`) en esta carpeta, que resuma de manera organizada y comprensible la arquitectura e implementación de su compilador. -El documento no tiene límite de extensión. -En él explicará en más detalle su solución a los problemas que, durante la implementación de cada una de las fases del proceso de compilación, hayan requerido de Ud. especial atención. - -## Estructura del reporte - -Usted es libre de estructurar su reporte escrito como más conveniente le parezca. A continuación le sugerimos algunas secciones que no deberían faltar, aunque puede mezclar, renombrar y organizarlas de la manera que mejor le parezca: - -- **Uso del compilador**: detalles sobre las opciones de líneas de comando, si tiene opciones adicionales (e.j., `--ast` genera un AST en JSON, etc.). Básicamente lo mismo que pondrá en este Readme. -- **Arquitectura del compilador**: una explicación general de la arquitectura, en cuántos módulos se divide el proyecto, cuantas fases tiene, qué tipo de gramática se utiliza, y en general, como se organiza el proyecto. Una buena imagen siempre ayuda. -- **Problemas técnicos**: detalles sobre cualquier problema teórico o técnico interesante que haya necesitado resolver de forma particular. - -## Sobre la Fecha de Entrega - -Se realizarán recogidas parciales del proyecto a lo largo del curso. En el Canal de Telegram se anunciará la fecha y requisitos de cada entrega. +Para ejecutar el compilador es necesario ir al directorio src y una vez ahí ejecutar el comando \python coolc.py $ < $fichero de cool$ > $ para ejecutar el compilador. \ No newline at end of file diff --git a/doc/report.pdf b/doc/report.pdf new file mode 100644 index 0000000000000000000000000000000000000000..3dfd3e99facdf3b94d7192a925eeca7297337c58 GIT binary patch literal 104642 zcmeFZbzGI*@;FMPNC}8YZbC|G2YYV>q>*mv4gu+Iq)Vj*DFF#ZNzP?=X4b5kS!-r{Q%PKs6U@bnce8J(Z3GVt;sMzi zKfn_Z0CB5=xbNDj*@3vlK{^niUj@W1Y3Zy7x^oB5%+?eIh4>dV9=DvCt+}%W2#kcn zL1%yP0BCDxGe-c++Q`{V+|0zz)C>+Z`_`!lcPM8;uON<`Sv! z<;gpx;+5HyOJ$yRib#ty=+r5*W0e?>m{un~Gn?)AwLCH^pqeDey<3QD0E`0Unq7jUf&)uZPErlVQOm&-|i|d6h_NOTpDUMRsMFaDIqY2#m2EQ| zwY!pPnX?aC4a+gT%JqBkG?Q^rW;nUR^+S=(nj!mhlR8i^_q}KQyPnpmo1xG8>L{iN z%T*Pbln_%l?C$bvir8$6b~lKUJmHkjgTWMYDRG}XEg)f6dRlagI?t1mC7nZ_YU*>3 zdSFZj)xKahlcNV39wGRilfjan%Vl>od!`H+DUI~jNJ%x>SGR)i4vbl`e*9cazT%r+ zPq}IXW;Qe5>cQ-&#Ny+-Klk6}S;~f>`;M!Bu{Yf??b0K!=NVn=K&A@lC`z;T4*EmV(AW>oe(~JgC3MtHRH3-UcQUowE4F33e{KkZ;uM=;#=aD6BN9n;!2vQJ1i|%);FB1 zaGOIU#&*!*kDF2ziNCV7u#dNlk2vm#6zv@dARBRmgez6iDYvPs$X`68g`Yx?2X%00 z^Fcwh{m(E@sh!?q%tkbTN`F$z$|z7P8a|3&7e`cmTBo@_4fBB>__c`BQBPE{sqhqL zW~C08(&tg?3H5KOTQlEq!dWmfzdF(#E0-W@&M^?LJAsOb30&pD?> z^v?tWG$g)3ufEdsWPonH?+o5Bd*Dj6kIyNRDeAVvij~h9CGXZxHffxD)~MF zgTz~s$_{>DjwJwc9eM{@F2Qsqe6Ks2(&WL^wRj(&B}_5RrMb75fUc64e0Dje6<^6c zqo;8FHuIy<(NpxwXu6juhx^NI{&Kx2hkWj+@wnAI?9D*jN=D{pc-&%kw$5g@&Q2hd zZ&tzMRxxw3b8$2=a{|H7JLJtwEsaF&+(9}#KnE`$FBb#>2O(i#E+n5G9x#d{fDVG3 zIea{B5nEe3U@#pJ6on0fowdAYtscsk|Dp!<_TQ;FL&W12wR1Ezb3B`hM~_>ITbf%8 z_y7ihfvHr?Oq@YFP#z=~42A^3k#H^^9wdkt%E!fv-~++=kX*bFBmk%CV(biX$Sr4S zYsD=hAaKSnw}^?erJXIeD)&7VY19v^jS&!T*xj}^a&a``ayGIt@~{&&b8>b8*abx5 z#ARdTY+`4_KMx1KGM*TVGT-zW;kf_!%Ms$;$=iL;MX9d{I^Z zGUYiYFATy3MnM0Lc`@4kkC;#h9FX0A!2Ew;^L$Py510$V^LIAE|0ADZBo7x1@^?%K zYIpxujsHk37!2lu@ge`lC*;o=0PjNRf3_&+)FKgFNZ!AT7G+?5&nO9)ArR^iAqjhYz&M;67~mNO0`?RN9@wnhN{)6Ws%C)6 z0BoJOB#2wh%-tDuQ7Hg5{zJj9^9U3H=liGUksNI;yZNfCzWc>XcW;zji+P8@<(b>& zf{(OPjT{rpeHTesqLm*~DUJ*uZ@A;4Ofv51>gSKH$`LD3s#$RKdZfv=;fkw}ZtcUW zgSma9QdR$S-0CqwfpzB>C#<7p!YU$FUawr~>QXlB3sSzQSQQs=KlC{m=Zf@6%cH?p zomiOmC(K*8y_KbDWR&uboQex0iIf@NRp!ux+A4KRyQ7-!>+;5Jxf6~Uk;?T2mu!<> zm@e({#*X$&eajF+wit~YwrtwT{N0Yl7Au*wRUSN{!BhIpeI@m3`lH*gL?jhWCWp9# z)l3IWe6qXbR4YS9pQe@bwt=WueyC9`TAL1#Xg?`Gg^#j@1Tdl1G^oeW`8!)aD(AiC z-eJ7vk>@ef4--DY;J;Brd#jtjx%pB3jEwRZxSUyb$qc%ga+k*Y*w?p<)Low&Qyk8< zO6(((6RI0Q6CI}Yy6q(_q?uJ?FN=i8%mg0|6!l7JeQMDxBYtOOl~~7CQ(v5Kd+<>? zkj5Dg6Y27_Deut>w(0fVZA!Bp`#k6-(_P0w-Y0A#u<0g@FJxpn97lq7cN8>lWwctB z81y^UE#v&8Sg@{s{t;6$Mw|WzKINrhdfh*&RfHS&cq_{<(!@YW zAuA`f3OOUPdm!%B-re)P^s(@Dhu4T;QHCErnL#O{)yDxU;8&_oEl+LR6-y&h6mwg@ z{lGmf$tZ2Ss+Qa$c&BkxFxETcDHoe>bVdgCyN)S)4QRZNph8`_+JF;h;FcUtpLIxO z<>Xt#=aN>?dQr|7#Z^SbZiRZ^`d(DhC-*MfTd!b_7Cv^S%`4|!pF+<@ocKR@o8Dk{ zSohc{hko|~cS3KZ;cCG26N`=(-9X-0g7_?@l|Y`Qj(|k-s?1VV*NVuRu1^We9p6Xy z0t*V3x%p|0vx(9W3S)PYrpnFqG^Zw_+~WFeU(Hs`lF-EL&{8?ER`jF^n$%uOE?`P{ zdgH6?Wsc5-P($NU3&z6eW7oEOZ(6QCJ9+09UbLwEzKAd+C)2b|>5hD1-T0Tg(d=oS zeS`Irl;|mZ&`XqpgYBOqeSC!7t}^#Kj_58}VbMK_@90w7;Tr*CyZ4Z*?L_3`D#JC) zBD!A`23_yMe;@LGA5hmNvWVe)cnp>yGRB_`*>*7V+!dEo~hJfqK~TjV(mG*82u4?jymz1u$>kn&U?g z@oF9W6ljm7i^8AcsKYi}8hq=`=IC#;w1=ywW{R<-w1lv!(o$;Js(us^zE*->r31b6 zvf?$tJBJG7#Mf5cL!{=K1=^?|TZagV?9e_m!BKE@NQ7Ic*D1z~V+KbN{LwwlLE#|0 zU0~1!x7%`(UWaBEo&V0~iu8rn+cu2fa>hCap5nBA_tYl^5@yrR>VTP9YW zs!S&jy5%0+@@D&rK5;ZwV`hx0)%Au&qx_MbTa4DSJx2Z7b9c!7!dvkJF@4-`@uuXTOpA;MTXU8OhoA5euezm~E`|2WWd!?hxRcKj zaI`en7GIqcMCRLEZk89#ezC)%3IlCXZ;2fy7%4FyfK3QAoSBwbC}wmihD(KpS3bV3rjKUAXh|u! z$4*d3MCut}41OTYD53a`#Mb_4CPsNf%|k=Hsw|1=^cHi<(|3$R&PJiUouB_B~GjOC&u| z{h#lwJ~VRT?u3QW2cgZV<20;yqm3TT*t-#D9~;H{#zC(@{a)Xu*JpREy}|XxxdOcr z+F~(0MrG9vftamHJFl4=EwNvU>g^kUq)>5<9?lSIB^*(=xWUT37hl#1!NDJbD_I1l z=Vvjxu8F(}eq%K0WcIAe11IFp@aB`f`g^(xg~WZ^J28dmpULlw>lt6C4UN1T%3k0M zP75#z@42}o+{GhAxNx$)y1qNCg+_k)BVF@j*2sqC6Qe}mXr@-#@n_h*rx6+sUyOO? zEk(qWFEcTWwQ1ie8zvC649TKceclmUqLggtG}xt_uLa+U?> zD(j^aj?#p!UY&Nx{ypMx+RCE``pY;qJUemD-#g(+YF`-Z0Pj6=x zUWbKuYu_t*7NDv64Tsnd=XM#H&j)nVSGCuz*h{$GjM}8TmTvq^u*YF>zeB!W4MDFX zsgFGE`1w6(n_?>nH_?F6Ng1!Fy3)AM?pin!q-95wgn^c+@lp0B+x77M$%NK>YcCCd znEIJbITmQ5@4!Wmda^}UTpoer>HA)qwu}@eu#yUv+K;N?JPr0O(&)xE?yl|CksZPl zIH-NuVC{(6^1?h_&+gqf-Z&vY@tI3&-74m{dDQ!Ru0-DQG-(gkt6>{OYc85_pz zCS*@s(eBGQ;+`Ikh$EOTf8-f+x5MH6YLh6_q`!YUUTrznebx+Nq7k%=qHMJaNZxc;YHbI$ePo0J>X zPgEyHZ<~rk1fLa%nKKPM5qT}5YT#H(MkN(|%kqS0uEMGd|20jN}Ma7L{8gvi(R2b9- z95~Ub4WUD9V zX5A>as4IE$!Pq(|edHB(s@*87S0(sJe(uKJOY?lGnnaYg&9jX&XPou;9$(s-p*G+7&gnTT1Sd$F#AIhN%YUGgU+db=DMD z8$}a35+6w0r79(~_1SpnKF#%w@6nvGd_Udp`#iUzV>h>DA)*R2P{Vk2negC;sUj`ye8w8<4D+F z%CW1OxGT-`{YuhHkR2R^AA~<>W`>^ zyP5GqeD0T6Ss!G7z&Lf8Bi}NpOs78P_!<;XS~(d0rPf$=BJdJ&FVyub=+(W?y|sPT zj#tDeL3iw`@#7yUKsHr>h#D+AKDbjk!6P7zTz^F7q1dG8@pB$eE2h=qGx9O~nSDFi z>SjZOd9xCu=ZxKuSLBm$)%Q2G8nK)P2+Rn=`4U}p5_xY7nqrq8>|dk8)vYvRoSi;O z>vK@PLM^kXn?f!p#T|#Emd~Vo}a?mpHLscT#DyHS)uq!-Ge+2(TCp`92 zzzgB8{7-KQ4IQPB+*D2wrp^jW9GHz|jd?k6iGd<54ZV)4`Q~l)fXB;|xDCc#R>pA> zBis2s%&`Y!!U*Y{bU_XtmJP6U+Hh}?#aNZ6P&&C1noo$BlG@&JWEy|dJ{|OK&B(@{EK)F@u2XX3dawk z@m;I#L9?MQ4VaZ=a(31~r246K7FbE2gc6=)<@Vfq;$yl})g)uMdRNZO=$J!yN%>2} zP0G8zu3XAI$@we}7_5211XO-G;kA;CmfuJj3S=<+{T|1~Wh!S&_dROr9~UBt(Z756 zr0LQ=oUr|{65lYuFXI_*R+d_TaW)xR%9TigH%*s36gs-AG_-0EhNM&x{ggLTJQJt6 zklL1If@Fj29Ygogg2`MG|V@0-|%2C3+~QXZ2AxXtgy zmOJl9w0SN~r2FsTERB(6uk&=NC^MeJ)oX;w3FX=PJ-tiaD6aj`;H}Mv#rLe7;MxT>0gK~Jg~I(bnwoPZ^g7PpvS62j~lZG zGjs7TNgB0f^)a=*sNsn^oJ$1$V07``o;;v@Fo^WVz7DZ~obp{rb4Idu&e|10j=MD{W@$`?nZ}@ed{|9$DkiTB6TtxkKn*)P#@%@KO zj=x^4{0B@PI2Ruh_V-(kzuv6;9Tg7T;qf8X{o^|l=tW`w&em zf2^@3^+6oA{e`iTIWGG{wn?P}Q5p>QS&&&aSzdHJ)qdafl-`;OiP>n^;|?hE8%+-K zn&~?kFl`CTy^Xa`pGFULo=PytcbAj(f0Ac{#w>BL`!T6p)BDu_^1!8X>Y$w~`|+)Y z1MhElAj~nrVTLK7ga(zo=5C05`PGA@gm>iEKdRhuI;yX}ee8+DFrz5W*GbCU?UdH3 zEB@&Sf0?~Y82f0tW@&M)a?*Byx*{SQCi!A9*xv{pqQ>wxyKEZ&QBJJZ+Hgvn3b{ii zv4hZ{^R|#>QQG-!@YPqmV~J3zvUR{?`y;^KzFzTsY@XqD#Ub_80oyPUq#-y+D7?UzQ zHC%CO($14Fdo9&kzIZi;2IM@%Sf!-43<^>v^}$knzLlZk5sOaY977gS;`Z(90@Z-g zNUVAmi>w=LQhw&)Brf#|e%d6ug&i@EJ?=f}8QPvhvuD#c+38+pGrQI8R!Fs|Lp7y>UhE}e<-IYp zEUTlmvh=!N9}zji{Pz1|BY%$f4X9oSTIg5M%tWR9CQd`yK+wlzlcq}AH{%BnZIqrJ zM35ZBvY@{+eZwh{WT7QMnhDXc7ND5me2iY&kpjIO<2Q}TgjKrghF3-g)3)c+eYwFr z<{#KnJNx5a2e{{op3ZJGrl5W1hX7-*0$y5CFWXGjWzP4z;;g#`dkG6Sm=@PYOuOgF zhPq9++i59`*JpAu9WrL4{qaMWdE}z-LsKn~Jx{5*v7(js3}?1Nw!qih%4k7 zug&n-s!@YByvIdvAt4+z&A4a!MEbEW)1#$>pHh4~mwObD2~YIBAS-bSzB3 zLlHa2cyzL_mC*N-c7l0kbn(8H<=!>%)1u)R2@wfQB$1!r{G-)2lG3&7tUTqk5kwrC ziv~3dc{?P2ED|E>i3~5Bae|Eai8Cv$>|gago%|%ESv0BFc|+blm!AaEa(xbMIg?cE zV+CXLlHU957H#6aMll__*!spT#PXc{;}`~MCz>QtmgX>XUNBBFOw|-5i!Q%WL!l&6 zo6#;N=GvJd_feH5knCjK!D~d>ZA9$Qgyhic^I}j)Y32fVnoxiz)a3>AuHSakb@Zc* zhSaByTFj6@6|T%HDb8NFuI<8jUz6pOEfzx}{q5RrK{g&VtY~i4j(rXHFEU~q6j#8; zXB25E!^jW%d^7m%RpRy!OT!sA2k7I3CB!Zxmlj#cDQG@)nCoaX1u57S;xm;RKM$3$DtldLPoD>qGFGq9pez&R=RuEO)D*xu! zWPBjmid4~z2|3A^;X$iSFlXD!d`L`OXCQ)ZBkCvd(texX^y3N0Zu`WOZY;2vnSK9N zTZxu5hTp3kuuHqdQs?*OI5I{)TuU&E4r3Zxa2A2vOdGvv%v+-!w$3{Q4|^<~%m_)M z6v*No_V7S*MosrrA6Qslqkeur^|}mA^B93*?)4bc!R^Fn3_ENRhUP7V$&Ty%LO*Nk zp3_ci;vHQZ4w~MsgM96^1=2fEB$A5<_9wvyg;G_Yi{N!>SFH1ZDMC<%?b3{TUwhrazc0@;J;*7 zQC$Ac3;mZ&oMi!lU%Re+kn64fQ-o=LNU}^T7WWqyrhqKMD)P_x}ME z2Ib-612)xP)6!>l;kTar&+$Ew*am6`e&s_i$t)^(%X$krQU=5eRL=mC1^xm3e@bdl3GTmUrKN3vIvi2ZS(z+Q0qf}G zEM{Tk2m(XlK#i=?#ZMZRrp^{lAV7@(4Z!1;umuWaEp5#~u(OmmP|5?~p+*Nl&Wm~e zoVL$!PO|kAOh9 zAivuS?48esK-DS%H9$c52Z$Fa0^tQ10gOKId?pAmutq?o6$~{G37zsn5rr|jw5EuduRPXQtQ^LUzpyflA zWq=T1!0iL9A%PYFf&Giki!A@!^97;7fH6@@{@3=eE6w}cw(3BDI}X$j0$>7A7Jv!( zzdiE;bn}4_fcr$CZg4;dfInV_Ft98502~M(;3PpvKq&xP0LpoRZOjAoz<_=L5{lvl2Ji`t4oDB6 z2pAWocqmR`02eS|?E!ZS^uST@fU*EBFQ7#K+Ht(U9hDA1DGK-hZ~wm_fj{f}J95?m z3M&zqI3_adN7!ya(kHfQ8^Wa|~dVQ$z3q?hSEf-g!|j4FQ-zp!W<83KVn#QUDScsO1DqJm6aa z7Xdg)#4m{RQP1&z%>dy8)`b^P6+r3FXE>kptmOk%4N#5?J@7NYAB z7kN7Gfx&qIMFe7oGfAPI&SC!aUBp54LeAm}Bp9Wj=X70^3km||Y5*qzxEkPa0HhHB zb%g>v{#l>j0lp6JnT-D40`3*Sg#qyf48(WNHDCe&!*S*c;b+f$XQ9x!hdT53P%uhV z=k58Be1Ja%h&-F*{23Lz{Dy%6L;?QmtUZUh_!fE=+FTs%?_~b-o{O}d&vLQl1xkcb z1?=a3{!E$9JU;@sBme_UqpTzX@UwuL08s!Ceek0E?=K;p$5LksimKd&qb^N=ND3wV zbBObC&+&iF0fd9U!oKqv&cuBV4F&@Po&`An8UU3=`Yp6`mM@CsB5UW`$BRT&<)1~e zXX}Lu2vAk=s1<|*Y@i}s6p_%ga0hl_O?l7y5irz_IEOi3>+=!LpU;CN*!h^}vz%d_ z!z0gUxzNLln&pq~{VuT8LFq0K*8HtS!hq_1)Uf~vzfb`VD)0j20chJfESLufhJh#? z4D7n|e&`tl6ezj|b~h3X;)9}s+;iyjXB7516zuHXd3z4==NOUD6kT!7WMg@R|H_I0T*)4Cm;{NqCrvK;N1Qqfxr(1jS7rmKs7gtL*!ZL2?s(~ zKERE@fiDjH0zm24xwk?Mes){{z6=2@ILhb&@g|_Pa8#UkJ~8lh1Hk^B$@{#80|$WL zl0waM&c!+J7dheuGz4Wo&)4bf_qj#^YXY28&ejyw`wQp17xis{Up?oma)$RWSl+Yu zFkaN^!vG8*Kt5ZmGpMt7=Mp-H`_*1JJn~+=ggw8u0P4Vz2*~d*mIAjUz~Kn?`y=3_ zem??7YcNoaj{5UIUvE4q$5x{nBYE|NEJDnIvuQHzi}pm0yC0fJKuwKK%nJ$a37|{A zR?6Yl#!sYU?{eK~!)LEsRyPmt-;Y{Pl9$LWXlHuxzzRRMG#Cjk0hjGywq9#3A00t2 zD4^~sC|HwHQ(G})vFdv`FQt|Y!oB;3Gw2j?#Q~SNZ&`vF-PseY_9ht3G_4Tbni>sm z>kFs#RaZyjzjbT+A-)aG0Xm8B^*3z7{x?8YSJ3$wl*7lzs`>psaHi^iIr+-%_c@5L zvAv_C<>0G>-z$PnbZd+tG%`O0a!^WQ7_+dIUvlAPiuw7U23!`{9I2^m2U?oCdU{Fz z@W`GD!bMT%$7mXF;;@CU&0lh~M^D1|$$BH>QaSn$JxVCaHQ`B&wSz>_51)Iwt}UTq z)LtrRVg`lHy}xQ6#@30xMM9Io%t)kEiYf9Fl5qOo@9LJD6Pk68^=Z}d@g7}dW3&(v zro5cB&6*#v8&4~>Ax;GjdVKbLQrbi+1-fw9GF^zU)!p&LUE%AX5lV{_<1O|?$eB9Yz z&=#@Qqkn!%59MhcT8o0nrLAkiK!#rC(T`iF;oJ<_56u=qENItn-MU4DphGhyLaR>F zd~`TTzY%F_6dmIn1pG60DqQ)ke z&jRFA(b_>yJXp&Ho7~3HqXs9Ar-X(GKd#mH2PNp5rw1pyil=7HayImzH%^mJJ=!=( zC1u65H#GigjQOU-VGG^8N)vtRbp7s)OF#LEK0oa37Vfb| z_kNgjJn-@~du?YQzwc)q$l34odyd61q#A^_-Vj*S(cSi7XQ%D^sldiV+QZY79iiG2 z1Kb}Ep|Oq?6+cxKj}x0t?-G@x>(rduY(uI)Dsby$7#^2ii9Y51gz@9;JL8Jaxu^MY z4jA=o0j#YPN9phYnw&;kkgD06xbQZExt&DaxhRP;95LbUipUwE=j3RlRJT@7m-H*% zx2`N4+IuH;3Ej&`TsYi}jwL4585F8`oc4$c&DkF99b-xTV-o)B*Bj&3&1mFBY#%Cs z{eo{8ukJZwZKQF$Q_O2%P9$+pTrK`7bDC!Qm3-iXyi!` zm)jmqG_(>J#+)YVd$XU&a^HFSlYZ(t_k&Xs7C(s}2AV_tA0bI!8qVJ-=Vu2Eses>XfS9xp5ZZE#0z>YL*e+mf^d=5KrGXbpDJD83!Ii zj!{iV`hmfq>6f*ct)1MT)tlT|-|2qtqT~8c2s2AvDXU=K4B*HQ)V5=n2-i)jXvb<$ zwXw|U1AA~G%lW1=>l9w(cV5zTsUnf5Tx-`Hi_Wei(_-@36R>#gLo=3|G2poQ&5)w_ zcJ-$Kn2`TC;^#Nv@_IiY_9W=R{FZ_o)1|#$UOrxsPwl%r#nY*nqWia(MvG~`uQYU49CmWYfXiM4U=!tqt5Z;4e1V6JO zejtWB=A<6u!f}a=D5{uXZu7>`qw86Aav`nBuL@Md2{yFy&EC$L+#lW|lM^hx;Va^( zW;yNA`Yntj<)i&2vW+sw+iLfT0mdH*l4uq^Qfx66`H*dN1Rf(OdW5_4T|zZ^Pa zE@vh{Y|G4z_3Y$jW3&XK)SYBDH66TCkTr!hF>?fz6XmbAlHSsXm}ta^hB>ylfE~Ra z*CZu-&5l`zZucUx1SP#cGP#0%G`d$Y9iB#fBrJ2@3HV4Z0fwThVv?9#;rpQ1Js5+7 zJ#|3vB-=hMZBQyjF4%;YaxY70$}xW9K-Z?W*QxEw-iXRLHtbVXFujd7TCQKDFxI{|W#UBCayjMFCO$2ZUG})6X6Ev3ADTPy%;Ht!B%(^&EOE~2SREBIKNdsRF%#0Qr~oL{`G zN`B=u?|lI~@i+gQz2d8?8R9ahj3V^h&NF>!59kVMJ&lxhDbzRer-Jh$%W-9DNDHt^ zFFVHOIMpY!-tz-ReN1vwZdXaY)8dcIN@1}3)^>%MfxcFrMwS1^isVudxi*|-A3ni*eYu@3-XHB#pQPa76U9FAN$_b=|ryi)3>O3^2GrY}9^mVwArs`E) zPF|#4@eS;h8zGN)bGGCv`05?h2ub&LwSB}Y4$LmOU9y`DC}YGE3Dd#OwfTe%(`9r0 zo~7Wnl|E0ll&cbXKWRtNPu~8%Dkojr=Cu*T6Ui#-?gf+H!-g5V&)zgu$6BB7tnBV~ zF;O`wG+ip$GDngp-AK=j-ti4a1Pl$o$cNBZ9j=oVWFN&3>s(5`T*y>Q3!)&v!qGYr ztJ1;9M_{pHh(6x*=_ZiD$>0rQ_ntB=I_RtW(juGi(YP6oZ%mO+7<}65J4k6Bhci`A z^WHSj@s$kwk;}Hc)XRAbQwev0`|)miTDW8P5rog1ahNi_!Aa^A?UQn3>F)0nHyJGG zM=f8;kAJ1T{=z+OCpjVNjUjGtyp=l0O(La?qA2*vBaZJ_5;_7j^(s4sYxm@&y)Z+j zPRi?D3E{p@JL6+Jd!g7?NA1g38GaJAy2y#Px&{hpNI%*6u>bbQ?(OvBHlGJah1_=B zvWz@Ba;l^CkvnAv)95{26eY(oV+plcPJL?a6bkyg4i=smV{vLP3eAbK->hK8&DkY+|&n(bXwM%Jp#E$6ASIHR*FuPyPU59krwi;X6dD zighu$=faB3QQD@Vt2!p7xXJfaqJ%_`^D)2o^t7Yj&ALF073cn4YhMptmb@<$O0nJ# z{XRYIS=?*I+jzUHWY+&~Qp`ludYc=Ivb)h{_~wWv6Io!-M+XcxZY;SbjlYa<&B6*$pS`e-}`apwbKDA&x89sKD&)C zJ=(+_4NeM5Q+iaosbG3z&pNtYD%|YyM)h{+yTVIvjPKi=9CprLQ$~{{QPq2A!{VoR z#a2U6*_jl*>8a!O&AqG6W~|$__k!4tE^*)OuU2g6nLnc7>K^GldH>=H$q=a0puy%q zN&J|yK9i`QZdf==J=yTFGo5t<{zNlw;46s*n3dfXECKQYiKENt6_)< zo1)B-cL{rh77`kX7vq1@Lzw@i{nx#vb`KsZ=Q3*L4Y#zr0^_MplIr+bv%FMhyIVn1#ejYts7^%I9 zFjo2YF6f7bH|XhUU`^0-(RC```u$xN_WnX>65;*p1K2o3p1Qi3(qvRuxRCFf=-RE8 z?Op8`;GcHz!>oKj@_A->L1X)mYljTn{a*Rx#w(^L#6=UNYL@f-_&V9a@6GSIeTDd= zEFaaqd4Xketh<>3Z<(~^gSD+MiyS|?z3h5LI%o#OO#Civ=kB5ToM!RBEj)gt;|5{1 z10~kxBUpM;dWlp4F!Lsn~6HfkO{I=uOwX1;^8G>1f(*%i2$>@N%{LoKgbq z)Q6Iw5f7x}yyD+IIFlKB2vrlYd2R*jDpjuL6nJ#E~V?Q?F0zvjpzOf?{KC9=P^ffwgso-yz>Th|9S zQbZR9J~FR=dpoT=%WfSf!(?%BWtWCM2seJtPb6^3WalzW?v40#bi2I$6xm%aJtrxz zuX$pmYkk?Ai>;!!*>LcK42@rwnp>784Nw^z79Ma)PnOrPv*vZ&lR|dq;^!0d4o|sY zd)7iS66GB)Otn9(Ma!L|UMu%9ShrEsc!3Z4Jx5 zWz31sqC55&%oCnb667O?pQU6HA1YZ9QSq}XI9tePr=TZDUh6)e?RxU)Z5=bpF-N6{ zZb-gTHF@~@tG1SBK5uGe-rGs|H%S)Jzsf6~ejMW+9^CR()~>DQIN$WSF8T8!NRyFH zF3mmmhOqVYXj5aY5>Ml+o$x(qCF`nwr36dGYcd0~gd>g!b86tfG3dU$@W4Km`*bT< z0(bV?u315Inc3HmtIZto9xn{k98`GRlSO(T84avrauJ|!HA_A?5h6M;6LEd*!}u+5 z2~of5y?j$id9>v{23?U0J!bmKd#)o5Lt{eXHw~xO1}OydlP_ymGeEfXa+i!hYQ})# zQj-gxVJ|RsNSYBaCYq3A54~WmA(8&PeN8t~mAwLs6L0$tb4Tn)p5T#DoI7|rnf>M%JU^vzE-8*O zw0%DCn8&I*+GjAiY{)kn!GOtWIOI&$!sP9ocN)2Tf_7bhOy|iCXWx|t&ky8gMN{2L zizB==b0uHmYJ}p4d}aC~^b|Rdb=Go&^zCjOJ=GQfZ#&St&BAWBh*(sqe^h)%bh0Xa zuRWH3H2Fxx`kQJpOJ)0G|M^VE3YCJ~b_e0+MFXr}My*@-QwMMubJXc91>HO)4-=z_ zRaT#??emwMg8{#HS;ja+9 zVYu{quSes>lrRiP3Rm&dH07_mGUgUBY%n&405OTBUXdwDip9vy;>jZnGTjzus%@+z&2 z>*x2Y-?DYNczrEnKyC+Gbo9#AP0Pu{3MSMzI*!NlMiGpPa~v@bPb>`0IQ4zjBByG_ zB~HX;5F*%l!^tt-O2+=p>Wxw^+`BZb&!@KehD+@DIkcIu-_PS5t1g;{6Xm}gtidLK zIM~2FC7oLX!ZsHX<9AreX0Z~LUmdp&KDP1=jWAGqr?|C$tHC-48j2yrOP{6;Zt8rn zXSSMr@3qygTp153PD;=h$sI+!xzxygGFFIVdT=Bqcuk)~C6!py1N<@gP9A&n7faU+2HzDu5zR|?M296EeF%H2B`eU{{FIU|%GpEFOIeWh6WbM;cT&DY z61-Z6W^Tr^fxUI%Kj@@aGUkrLrU&Hn6c6M&mm4F#Ot6(Tx8XFtXP-Oj!#mt6RNbF1 zta2`-5{P5OYJNNTHu!AqF-lS=N&7y(^>Efc3^QOlnH!%w|wJk2$W;<3iT0-q`& zV?er8!+t)6);2;w!bnIfHEfP1nNNA~R=$EF`hx$4VzW*>M|(Au8uRP7Kk2Qa)k`(@ z{He?>`MgI)YOiL?Ml5{{SxGv!wEo7LJ#=@^KBG7SX9)WvL_e`o1i!beK*D9d^Q5!S zA=mvuv0}H(yXyD6y4+7YZ+_kIk!Du-NQjkV?1gnCRo2hq(iJ$VS&}(rEx_SuhY~<@M`r)8oa4k=F6ys+(TrCRO}h1v1Hsa z9_?{V^D2q%@W_RhT1ehqU{a2?TqCJa@|&L4=e!Zo&=hz-g;zq%i^3C4M&<>lL#*5U zm8A`$1kaZ3gKeb`h?g4&S|xAZ59tIC#$T&yro8ev?52^v$G3*#H?&c@Q$~|)3w#DW zVNOp=(mFzeBwAR>EPRAdBs!+_vj;9AsOfYBN_WDpK1ng`UzH0qtkh1dYv|m~buhIW z-)(*qg8X7uRS4B_;kV>gO<RyJh#^)cE+TDh29dc zNM{V=MyGz@D;fmf6P8;=2Ww=UVki17q=gf=_?%KV?QZSn7E&wtmTmOBY2?a}yoaiaC zPirm%QPG-U37g`ZVyR}|bYAYe=?5RrIvCZ4Yut!dk#<)4vSqZx)1VE00m*;9;vL&a zjlN>-rzDm#W(<4GZ>yi@^YvuoYx!piucu86Kjo=m$)V0|vzTZF&jfkZcMg_pKi_}# zU9KMF+-q&?EWz5&Sr@p6vkLr6W}o9hx>IEbj~Z8{nAsGn z1hxIRL{!0vzjMlZQ;GC$CphgW1M|4Nwn!?t<^_h`%49a-~s%R?zQ z-k~g_b*d|9^)tw=784O!$XwB~>8mLZ+)5kgZlkt6@2|F`nWhNt_`Szm?PTQ1S~mVQ zVRTUyws1U2roB}`RXI+|4RWpiX0K>ppQO89IkpiqbKcP3s|o1`Rw%-p&^Uw@)-i zvDWooZEsghjW8~#u=CwIiFu%0b(x@>{6VopN5yr$WZFSky`NQvhwRq%D68sk1VyBZ zrjnl8vZNSk{ejDaYS{18dq1ysMI9y?5qY<(*b%>azad7xGIW(Rb3UBx@Ikf@)(t-s zn?~w{n(AosG3{*gY{HSu&0a$9Hu5KPnBz>V1|S<%wNA%77_u$4Y^xtPge4+WuaOE& zUGC&GD=jke6?W6wjkA)f3b9QLSpGQcFXOc`7@=izuo`|_TAC3&|DkgwRiT@-NzQvJnnpiNe`r*5;bbd z>fl^WzJ(tyv#_LT$oG4-LaSTAE%Sbl{IB*(6N=D~$|ndKG%^J!YBRQZbgW_0+@eQd z3f7uZWyA?>Z#>E`8TVL4w*`%gDOHj`l2_SRx=Yv3(v@Clt%;Docn!Orjw@9rZbXKq!i}DK0(wolyX+I{BPCiz%@0%)wYQO&o(*AVi3H5iq;oXX1re#ZisAaLBYoApbL`GTS zG=Pl=1NU-j73S+l!R9pb6hCr0YyGHIWY(=;n+8jj5ep{3PNK~Acwd9-n_55K|M0U4 zazK8yUgXGIr7(?z^s7t1bGnUnudY{wW@>4Nqzvyj`&F!3{7dK@513~ky8>So6D0~r ztQ36rN`1QedAn0;o>=_-PpW&;gv*~PW%5CsU89GcGf6D^0k4P9I(!0C7&Y&^Pvz&x z2T=6tpyBH`kKQG{HJkRWQ{I^3naK0)w_%Dd{c~FB_X!V6S|EXh;+)r<)OrN(-fU=K zsr)WD+#%@ij;>w-*a_3T{ug|Ax}MPXh>G1YEWf$J{XnYO6zqAUJ#T=czVI{6ia)13 z31hLKEH}hkoR~JY@a_E;mB=45-wVNEM^5M;f680qo(6tmeHuZaAMKJ#RMEJ+pQWHU zT}R`A*F_%T_96))D5-AudZV>?{Dj4+xlVZ!G4mq8^-gW~j}5f9lYQ);d@C<6uvpaZ zF5m6&-Xb9tJ#jwigd3={0j(94V9s>hPk@T}uNyUZX#Z=V*c;x=TnB9VRQ(U0hLj z>H9jB&%_ks2zEkd%R+cq@4nio_~7;wXo1ciqCJhYrj=Qk(F0@!vAK*6-BihmULHyr zcO@RzRzNn%F8~$`WN!Kc^!q7+&xTY*O#0Bd!)NZ2rr~4QX~~@ZoIoA-hmTLOH-Nz8 zZQWvCOFLD30v}$2L;^_#)A>jvaV(M`)vu8wf!5;__xUfr#E#i|aA1eWG_iSmtEARp zuWXCcobAr&ez?0f&aD0qo9G+obERXx1e`^4$FOHv@R7V* z$UUj&8mYn{OUF}tiH5tE4n*iAG0UatCr2p!n4v}rs1$4!6duAbK!<*)&`ZHrVrFWZ zF44$oolm%SSE~(Nw_;ZsG_VN`%xH=su~-12*dm0vwK8@hT`+*)Qo`d%UB87|etT70 zlQT}^_2!6&@0Y;n4oXjzF@eFHMC3s@kL zzNC_z0xXUW3Rp8I2LfCkjUO&F@j!zmHKVNF13jiDUy?BD4h=Ug(DTobDi}YQmAf53 z2QWtK;@dL4gH01(YVsR$0rrW0uJF1I5jRW?kD4&|<^9PBX&+dUT4#<7r>0cWcJFqQ zdlC7VpMY`}C=#aJHbu~nS9`+9F^fa(dv^^9BMU(BGa%oTL+xpKsj4Xcgys@YH41i+ z{uDk%nvtpoqnwtx9-T&&gS8a4TmR6YxY>1;FHkL*`-qoc~CJA8o%`6L9@VK__R_#)MUZlLp0klL3P+BF(#fJ zaQ~YDp49U`je{4-C_(WLCAH`N~v>JQmd#%s6nn#EUU!(r;2L6WF26S zgQKF{UrKFNUQ^Yb*zIE>uOW=Z?+i@-vr$Ui)`=T zrB2p4bpZq*jH+&oYOxe7AC`@Sdfe&KTit2KJdD9C>LP=MTF7DcQp~im?E6FogzCl- z8rjY5)Bu$s!Tr|w@7~&@ariMxfmS7%TO603Yv)av(u@=?c?1HwJLtJVzY=lYzF5UCfFu3QO?8E zXV4DbYrqBDmBB(z@;l~IAvhB$&b)+$J{bXQoR6uf7ja(sR|^|u!)rr?2uZ7F|mX~VgMFi z(Ire85^#={N>osPC&+SGxnWc67^}JcpQt03&d;7Qjp$)l{cbMnI+t)L*(%wC7)E8v;hFGzzB=FSVOc8Dquh8Rmv@!y2YZrvkh!jk6__fDiuAb z68B^X_8idhjRmo4tB1)9pn4O-;sUD-i8#v%rQK1f6bhP*0~3g}4qx)TOXqU9T~?um z69)BYS^E^;_HgpV;Fci!QWrsZ3W71+NckjZvgjFnyptDJzMgX_kTpIlo&$cU^qkz? zfaoI$xTxsP@RSB=1tIQSf#7oy$>aB0I$`2eN~tvI0W+HpJ4LYLHdjh zuXG_jlX?Hl9T0B&YoSkXx7ZlQmv>;K*QRqFPHjw$j5xjY5Y=bzMJS0O zq~7{KclB0G|ce}R)yM|kW9uZaMh^TXmH+{HtNu8U-&L@ zz=OoWwjSQz85J=5KebIzm0)6SQasNMoZIF4lSMlOz7=Q$Vh=tm9T_lNphEtJ(zyye zWLI)KY{_EVe}7n(F)`f3JI}E}kno8(_3ZoANm-naZ9n89aK0{lH0DT-w&mduq))`u3(I?J1HeFOn#!@Z2|AmBF?*jyeMy8O_RkVTD<_fuI1DE&ea<>FT)UP0i2 z)=e4KbJa)M+(cSa>uHu2E;*?f^j#5YNlY)UGqnO9*ImoPdv9%<8k%<7YJejD(I~{) zuD~T%9W$@>KZQK0i1ZSW75Q@=Bt0DIqOsGRSgf6%BRdERP2GN-k2to>h57LCZUf2F zQ1Xz3%qD{J!4It{k3`_UzT1Kk8${jGL;76b0Gs4L#_?vcxq_NPr2sw{>sQ`=oLj?t0+rZbNF*}S@} zIxD+i-l-fS4lKHIA>%Yeh-y@&EI&nI*$zZ(5tN!G+ef%g6oX(-{sGo}eA}ZZRTm4g z;e776V)vGSXE<^?ks1)iUmj_Po|;eKn5a-Mt}@q%&k0jzT)|A%n40 zW}4QcZ`#X)4eplk-ru%fknf;VFVb=UwHvhumFEc2ui>y!kK zNRBxYT~&nhtFpVSB>o_3%&G9=^av%2cCgiGT0(>+QTp0$kM?x6T4|E&trByI0snhp zo7<_(x5Xv2TIDD^Z$T>d4~J)j`ep92)CuCF-(u)v6>+ElS}`(EM*YtlFf88R^ANOv z{ae|YwSpptlj2eHzR(2sapeGTX~CHJ0pd5?Se z+rUOe;|tgCXm<%~dA`dXQ*6&?`UHr=Ij@`p5fU??7h&u(;rY#7c-YWIM|5FdELx2n zzD6X_^>f)jvS$~_iw0OR@E770l!%NBI7^M;Zs7S-W(+X)rcs*Q3-%tuPP*S!kbK6z6~q6xx1di;r& zozari46FJ67)UK|&YB+%V!7pWbd~^@#&5=A8wXqwj{A`Z*J1&td7z5QuDBdkEGPff zV5OQhZ?^^Kld8Z*A~H-3!H`i}jt%Y3l zfc;ebW2;CK2k6a%eJwsVJ5y1o#rlJe*TnKbcGgg59xe3o^&XQh>4rxZdJF*s;j3lW z^|kcBY_J}^@K%$!g+i{{DCUfU&BOsz_xFww3|zmjx3ufBsZr}$xpZ! z`NsPpCdMNeh==4uL6_Ma@$M>pG5`4ii(dnR2~;|K&R?D66DEGiCqp-cy-`c{ZhQet zXBZ^7HpbC`G*F$U2#-p^R$?JeUu&u-kl^ufrAZt@U+HB?OKk%W0VKYy!ha16m&=s90`jKNG-}}sS-sEoW zRyO%&W+>{59!3gB9_=<3JD?|2K=O=ME!}sVUFsc#5n?w%8@v4g2Fx_nDhI;PbB@B; zVhG5$V`a*ccQh1||E#y+Y%^UgIw#|-zPA1#sYyKm*4 zq{fB?*q#=K$NdIi1XxT34XT_>XVA9fWaMtbAIFN?G}NXe{wl5=JVJrQrONlG;fFL_ z0G>**+>`xlt=!bK(oPqa7hN6jTnvWv%4TfUTq#FpA4M6)RcdUbYro_6bER|9%NEDw ztIj|0DGVC+i{dSQTmFLO%R0RVY=7^I{Zn1*dl%c;Y5|s>o4#P$-|iaV+~lOaiBYSX z^a(*Pe={fr5Af0DD5T-Eo#)L4D8afssV=Xb8ib}*ipFpKu}oVpR?rP7@OOl`KT}as z6!(B3vJ^A_F|7E@AzJGr|C!;mg9R6|vGmoSwI|BaR;^0^S`aGQ$cB+66d6it4r2Rc zAnXsp9svPRK>bu>?xbnW?eNQWfmDk2LfPgM-4ddGLjVNF=Y%;9t{`m1CY3iN8eAtb zIHWoyUV(T1iv@bkJn)Wk3E-)3>-r|F|2vr2Oda-Tig^0R#H$LXa-ctGk>_~4*-G|JsPKE zAgMI0PZ6!s*qG2i%DJqobZ405h#+!d|55sl!|`vL#yz;WBz|Q8Z`tGfch3th*ne93iJFK~Q9RSyRZpA0`%$`aX8Lb;%nrZ9npXoVLe?CAi zN2;U^&vU%=iVL1G<3e(4-KXj!Vshk&=VkL6rZ}#h+N?LF#Uv$#v%d3ucm{uxWG@FZ z9sklrF|DfSmq86G=WJ^2(ZLtq01e-d%9q!7pWqU`YV8kqcLPFe57 z>TZNt_op{@@GZFU#Qi`*di$no{xX8|&h6x|K@DRk!)A+WR0oj%8)ki*xw@9!4P|@0 z3$GuR=0;~MO}+(@B-)#=NfrkO-}YBp=xU(Fh>6gX{$_bmG4kf=ASai$3(F8ZZH;5#)Me~1FA>y#E9PY;)0%q)&a zpj5NToro{>>ZxWD{FNe}?hw)8wiAA0B{}((_o2AJpIZH&G;vV9&{`abV8akC8$n($ zueTtyqW{O?6{ zO>F2O>&1QeRFOOrhj$!aHqM%Xbo8{V?7J((bs9?uL>atxq@%8a6ITT3Eq7~fEHV6i zCZ^#!D1#t2!Buk@Ei-N(LgKR)r930pF8_CthS=LjHh(%LNBQv;BD`pCVi~y-L}tVj zO)isIC6VsIT8gX3STnz(rOw1^<30jz&7<4;AoLZN?QuJSo*xB$>SN zHb~B&au=>`_5Ck;lUl-b8+#WAx+x&zuF=Ya59A7u`6ijS`#Kw8C2&nf?Rouo31 z;i7&R{zMR?N-eQ|%_#H-fmQRF38PS4Vsx0zrPIT@NGgS^sX;CIoHL5*__ChDDx8!8 zuF+z2o}bdI=Hy(O;F}3VI1gz8UvAfpsMCixr~9cxBcvDUP$pKLJ~e?Bqy$U%hUnC~ zkaz6i?-C*>F9jsC{Bt1LwNkROMZqqy^cz0>fx73MudD4cT*RHnN?Wx+F3-3@+wO>{ z6&8D`<11L^PM5`Kw05L=txMkuKw7qHJTI+);@2*NCfY_wrGguA^cR^5pNp%KB(DQ7 z*}oOkNZTfKeux4YE+| zf4!P=W0gR{#~q&#uH1!ERP@Imf5J@0jlsHWKK~eYhkn zWtrmc=&?XMgF)b~b{3yQ^34q(nDu)v3CWMk(_-?~>IZ6nseGe?)6;=J){&Xnn4q%8 zC9A`|@aAZcRqCo4}op^z1uT;TEv4XVj^T!M7ufu zOqm9UW-@oufrZwkdK$&=`O1EC3g9vwwq%^0-;i={yWUg_D$;pau9gA^c>nzga>t2i z0Lc`Z<)@UpcCkJGt4}E;kb&q>y${RV!n+`D1-SHMCm0jA$0jY6zxm$WZ$ogfiK&8O&%$1CT8b)J$Y_)k@&?*4jr|7!1yQJW=TX}^U$QKt}Zw2_j#Cytl? zF2>~$Azi3(ro%2cgVv;yBgp^$*xq&%D5PMS3vpSWdFe9vTJohIO}E2Y2Y)V5!**;x z`gB#9AZ~bMHLqK$H`@`zZ50?v^;|-zov4+sVCGKksrNnXQL=Qx?hD zA^avX1OyiGIVI9cC{k1Lf!zc-&ZbXWnG~kRB{VnZ=745uy@5pHsdlsf;3c?)DU=c4 ztywI|N*0o?!?wg?nM2XjcM$sAQb$&Dqi)`}>xkflV9qsBd=A!6)@uDs7`A>kgC-)< zRc;rD%>5_&at?YMVEG7;D;ixf7%_6hmdAVTSR;bI$XQw6eZ9JlF6`918kl(9yW+%! z$BvmH9PmoDqbS+v#in&n^22?j`1GMz`Gigr{xAMwn|?#YVeIk`V194-|8~Os->#b9 zbk6@UN&W}XA#CDk+Wb5!>td0KybO@`62}sCN3&{woGybN3e%*1Vjs(BCpZ}q8 z(6TZU&@%mo-x(SI6YgdGMNrTSI2!#&Tf@fjd!>+pow$j)soC$4{TI6NpU3=Xj+XI1 zlM+q_R^~NLIfh8e@7BdQ*CHdJB3hdTV-{-_}$+dV6{Y zdPjOEdS`kUdN+D^dJoF~TF0*#&*V2~_5YwXSpOTX!Oi{O*{0t${=yCZd-NYd%r7zE zzlZ-<28xmOmkIL!nSp8oRZhG@W0P)il7tm^ZE=DYFBt>?hG7g~a1wX@GoR-a%0jU< zAH|{wG_Ql-eZq5dm-(Z2@v&UV`k?Kp*Kz%^J~O*eYFQ_xAvh&)FAou!l@TBXLQp_e zKsqo5y1T!B^n3K>maKpcTnhZKGn_gL$WH512p__SM^ZOZicO^J78*av04{@Z<7i_Aay4mI(g%fG}t< z0JjDOfv$Z+fs1qaW%i=+L-3V#o_<$4IaMvHtv%ph$sno+5LR^S{KN* zL8$S~Ma3{QfAU0-LKl<8g?O!k7MFOoolk%~;A68yfa#qfB^ezV0tV;;_1mPiV)sp% zeYOMnIy(He_DSy_nLs>;sP(`CIRtJ7;`!2d;{etX07y-M9v!)m8}TKEv9a+ZT?GPT z0M`g0#P}KeHU`u9g65Oxg}j7g*!NH*_~Uo+a*{)SKpv+dNcfERllS91ktumkrCB~+ z`IG&IU(?94h`T#91+IUxcLHSR2nhuQl7r{<%@xCm@ac;08%QNknd`UH=JWF5B>!{0 z_GF96@YO{!>GvaB4Cbv!57GOGU)Qs@e^T%EzW?o;{HaIy<16`-b@W5`{9`S#J+%Ez z545lo`2!Dl3ef!WnsHB}hrYT%RVtW+26W$}%ro1ArjBY1>0;9^5p{d31dn-;XSU^)0Ek^18R zn3cl@_q;;;J)B#T^?rkPNPs3ku`@9;Ko0=G$pOg2kZtn~dB+F2XD&r6aP2FB-8%;O zuRmK5KVdD`U$w#o)7op`Ax!#R4)0YOwOAc+-_f!rf;%7Ez zc(3sj*a4Vbz?WYapyUbvmNIDyKNi0i@*9|!)$j!z1;}pw2QcTH^Anu6EE)M8+^Zb= z3-}&@9rx#-7m(bkMEEQpmiIckYzg1467{riZwbUI{%sj^%J0y$`sW|FTocc?-|y+i z|Hs)JjZRipuH}8DoM-E_=T5Ii4q+76_#Y!5a1#P-eHEldS9vm#tI-Y)q7bii$NY%_ zJ|&Alz;8`CwVKq-#DuPsDkr4k%aCXEbY*`{v{U z=%;f23MuFnj4ZKswr)5}l6agFd?u#}i49kKV3BhS8c*~eBbgQLd~9HYy3Sk&yNdOd z=ktAOR6{6(tuJR8^#u2xXR;qmN~7s^A*)@{#f)3!rkBQ=!ERk6l2(Sx$z`h905 z7vXp64lpacxuD+LL*Wlf<2U&VC-jH98;5Z1m+b@3G-?F#YmMi`dPFOafK&jQcIx)8 z79!hr($s*Xd3dN9erof8Ch@yoNVrx6xqK!P$Ee{z6SQ{}FAm|OfzXS$qIFM5`k=@cQ5JNfI-*?@wixzvH>q9R$&DZI_xs6(jOaM z7t&N<@oBF$(nlrK-;zrGl-L~Y*tfya!P!|gy(2hdI{EAqulc2;!QI16^S#~**5MXi zXp{(^%AvG<0$8)~$9;3K)c$!r&0uP%gA)(>n^ph`nC<*fXJaERd`OM%q$oDf-1vy( zr3GDnJ=e;*{cj=-qT(4A7!odNqGT{Xlh_ixT~=<;43;*aQ&-MW7Y9C1lpUm1G#pJs zvZ!cncPwpqn``%DB-yjRSA}s_3$+v83vY_>B9Pwg)O_SFijv;6fw%$i~P?PJH^FYZ>m?iX_RQ%CRZ4IM*E1n z)sCGsX}o(^HP#@QbvORpE%MGmkz=Mr{jD1?vIB$=K|MEx7HO_1Lyqz*bRR;%EAz(GOrqe*NgR~mNH;tt)JPO<)|A(N zv(~1}6ROvRW+oa~ZE2*)b*A*hr<5ZbozsS6_j7*PK+xe`Ra>kHW(?r7{5!`N5Kj{p zp7Niln{;?QrkW%FNfjL#V%kWWg)M_O)DU(0-yj?F287m}(0HI7m_4Z&G4#UUk0XGh zmki>(?AFHhrr~G?Z>8lax(@srq|XDT4HtFjfh@;va+3UsHY~y}C!+lp8nn zH|RA-72g-^oO;2oDRp?swtg#eKudKY zC1jnfwg=MNWmt{5^XgwrGn2iNQyuIbxpmi2=`AUDR%Fh$dfYTOhr7hxOT9|MLx~iu zH~&@9+AwfT3YGFL(R%Df4U<1d(Z+qB#bbK+*J^nE-Qm)`+4u=9d-p%hdv3q=y~dB3 z#z76ElNQU)Jr!evE8BxNiJnx?Fc@LZ;8O?p;$6%*by5N{&a=!Do4(E?XveQY3b5Hu z{-GofV=9O#oa;Jm;MloU|42iqy9U(IL?jmrIfMlANuX+GK@=i%Pch0mC8RY6eK*Bm z3cIL=`1kDX220- zDsz_Vi=LW(L<9Sthl$=0OQ5gsYo&=dCZDNq;_BC6j&7xjsf(I<_x*5ty2>9BnD%14 zk5bYzYEkxQ@i@;5jkF4l=pg#klJr=!BMi#{rGqh}ga%*;>*|m5ER$a(C-kC=B}_Qf zMx0LXO>=ehyfzBi{V|9%94$r$o_;-i-W3dsc2^GRtnvWm1DDGtJgotu-Pd#xpYP>m zILo_r{X#A1zGOndEg_4~De&+Xb=mw%CFIB zrdx)wlYzBTr>dmYplM~cA$_$;^LFJjR}8-cVjkNjk7*l{6+D)l5j3Q8=O68gXjpS2 zB3w{30Mf4Hs3x!P3M?4(_+V$K@jV>Q$b0oF`a?F*gZ(5Bn2$+{#m5;G_u*-q#Yk5i z)W7L+71%glrEq#qy3tSBQ|>{1_ow@H=e77eC-?q(#n^-%IaLwOw7m8yRn4B zxYSVN^sMDDNR-QzX$-i1IYbT)XV?e`b%%;Vg4IuYJ=#HKxQE3jM49Fhr3XMcJLEQ zsHS|VEw?*jcQ*KHVwCgL;=hEA-JQiRo@y}tZ+UW;X-u9|VbH^H5drUEsYOE!eT=Q*ZLuKw+`V%v(}aJC#5TdYgtmx(uz zbWB@+M-#(^cu8vWG#l zNE&B?{?~X-pTrw`hQ&!ce&|Qh=9X0up|(>ijh-8LK-h?kU3ej$g;Bg9Zucr~7o*H# zREKHwu6ROGhUQ&VMtG8@A+`5C*l$}F6byVRh-5!=NN1B@D7IRgRCc37t#LMHAQowk$*x=s4PQ@p}GhH*V>Jxp5DB%G!X zDq0<)`@4h+t&G*lzsv!aMj2e?q9vRSwyJT@ZKp*o_$oAAM(y3>IQJ<@vUd~DjxHJ> zH4B4jDvmAX_*L#vv5p;_D7)agQ=dmVWm;vg9GL^Fl6RbeDJQ#6E&Q4<%`mhE#=KW{ z0X!9RjV$4bKwNCJlU>5z|u2?&#a|j$)MKM@>&id zwTb|4g$;n^%w;f*giwgFW(yYs$wMOW2>_C?4$judjD;qF7Et>u@+0#VFQa|Rf_FRK(xq<8ox|6b4$6&Hxszp2mST3ED zD5%QNg)}0#m3wa7Dv~+ygYg&uY=7a$n+?kE=Vb$N?FIH@`Kk}us50jvtUF~9ks<>+ zZ&`+^Rewxfae`?zr6+=MY1Hel&_GA+&6WK*0#4QAYP<#2E*v@kyFs)qu4Y6z?TJ0W z2;OrRTvlC~flqc?SBdTy;#(|w&5x|EZtZFxa;fTW{fr1SvD3y(FHk3+sH0?5n`PDh zpIy-Ya_6=4{ItM(1KSU)E^FA*It8{VGK689Lnij}GGPZN+y?)DfoqUfe%j!8J9T8o zK@*VoYhUrua67d!!ID(jb~J&5<&3o&8NO&|ibCOuhFsK<#IehEHzfizoPkHiY$Jye zEpy3OvW9!GS@oNuGRB?!j&FhC%{@(0nUZU}scid5>*ZwDBMNJDkMiixiq`zi#x%ad ztDL_YyaaA71Kdl1%exSl-8|)ZB_u=MQU2@^D=RgPgMjmPaI^8NYw}AWE>r_p5gaW& zKI-1?U5W;<6^PlfOxIFCKJo6Ntwc4gOpgQ?eVz2s`Z$LMWlwL+^$AEHa?F##GyL>g z#rhrtU2N3{YlZw5-b!&(91&lj`WMn9s=frTq6C_K>S2em_-*eNR`=YlLZ zuBv(GVb>vioU=D~OFrquYIR^#J`KyLd{F6+$4^bT>Uzghop;V z4D7TNlj4>if00(-H{$MC&VFH0^DyTMoa?%~)s=hbl9j=gBaeLhgu<(XCnkm`o*mv7tol$M~)%pAqUNU0Z5ceZdT zA|l;VG@YOA(5fruZ1ZopGQPc(X_z73XPW9{jN`&B_I{$+GUDVy?xct{Sm`KP6x0AG zcYLq#&1vIOcSlv{I0wM{>P^+(A%$`u7Ax$xAkC@;^f`jX2;6D%Vvh!4Vd!a^CG9? z9l>~;Nz6f)9jq~W9WfG}Q$-Xf$hQwUV)6>^d$~u%vP5zF=+k=Zlq}I9U9t=yr1rbR zSUd^bjQ+E_S)L`YEFT3lSR<=ffF+O*ZnqQ@)ST?{o{CrQc;>oarJq*_E_T~zl_mK= zo{|;_@6af*3eXPiI@uSe`}1-Bh9b|^25WR(X7_PvbprGVIDp~b+@*%ZMl8m$hM(Wu zXJafuF1I2oI0pvnng0ptbjHC`y#Y~0FDYN&AI}Ma55K+>70>9YG8;ino)HF0nFZ6J z5>jpqFf3bOn{ZxgwPo7KWXWZyKB)y0kPPqm`)l+C7Fh%SLt2}R-)2#3-4u9cpuI-6 zXXI(NL@XXNdQr}{FLzHWPl#h5GP|jwtvR-DrtJ}yq%%@C zA?|n%cpkh8IRRnMQS}LG_3v}!;YhA=^70&@co9N8K19!lY%Px^Z!cAejurW7hme8| zph>>l^HwWb&zh|%ev{gT-mNO)q2e@T2XDF01O=^~{+-xaR%CDNT8iS8Ao<0IS4?pP z-4{#OsHp~Qxl_Wu3V_Yc3tvJ|u~NTP%AOj7^D1 z{28SC6BC6n38;qHMDi<1SSqEVtp{6$H^$EUJwN*SP_jaIL){APE_8GRr^T?VU3WsN zce2lui6_xbw?@W5&Mr~ehZvtKm?^_RUK1aPRB{|Cx5#=*tU)sE>J+jJJ^0kN+hZil z#8B1C6?ERa{u*bIBk_f5WVVhQ>6X2Om5>a0?mvqdZy`YUMq z&NhS4QX_h)<88cb5z;w+pjDII6m47qYzym3B$?JVlrO5p$=;EOSKb9OoQ*GDB)fLS zu__xmJ#JjWn;ca9?}@M zLtn)BE2Eq1#UY1iPb{#13qHY&kBR9YCpC-B=#trdkZd^2uO?jSdkBg)Y54{OjGd2M zI1SSK>}Jcz%a1a+S8uk6oU?Qdz@Rs;sMrFVpA^Pa%O9FqPX>E7Jq2CRLGFx;^bV>F zSzcxW*)<^cTuF-$F;SSyK(_f%lryc90)9rS$a!JpcDQSp`vP@_c*mSw4LPu6_YQM0 z^Ar)U08;$n7%y}ChUD|NCHOG`tuozbeK=a&*r#}6O1zC;fqkdqdd@$kNBnIZw~<6n zE<*=QYZr8W7cl|UBJ2H{^aP=A`{(d(;kQAov_RrvZO`3G1n{X7DI16H%2{644*x7zW zEpeJYVef-aNNUq=*o#qwg0J{-d4^20oBgRt%!?cz8r|}2j9jhZ+MXhp^q6xb#MqJ~a)9 z*o5(6{44tc=>$7@gLfySIuGZFp$9iA$C71oRwUo*+#~FC9-(ZUEDmdQ6QqBrWzgXn z=tTp&*<%UDWRmwdr9z^KN{>aZH!Fisgvfky5+yl<)En_=3d_M)77^4_8%;CmWZdRQ zq($F_BlZJadboD}F{;6_x%}Pe@q6kG_R+s!$06_blT79FCvww9fNtkdr=wP;29<}9 zF-nQAC|7U1GrKalu0QQ3hw#R`w2;9xRjmyrJzMl_Qe+!nfSN~%7sA3K%2s|9L-gYy zg&bUiivKPb6QD&Vd2PB8TX&EtqA?;_A93Q*2E{rU@Ad4!3QfxIsKbB8jbowR14_9# z*4J8jI&)F(fzUn_Ab$V-Q|~U3h3+^A6tqVB^g~Q7Uqh)NGamgNN65L%kN~ik4}>-d zzg)`yqoYM@IWP}X;@qi9c)@*`M!YbBSvCTzY@p@PRKEMbu^gm!*%hoJ%y{w&?LrIx zUIY1(j=btTui~ml5x(39x>LJ+IX+F=AS^+MebG0mwu7ERy1V~bxg*z=2YJ?sSPBwM z(QSR9b%WKSO!D2Yt!itrPl9tj&-KR?ow7+PU}}cZS~9+}ALvEBzHWv~(N+Epv2EO` z{SZK>hD`2K%Xq&)Z6>RwM4$9NB7k{Q!^Xgb?NW-@wolymR~>3YP`CI@{!LAim3lEf znXoVS{Z;dxEWRvaN2wOI;65#|Et2fRCR>Ezb3i@!Nqi5@4q zBZ$ysBQh_Y(6gmPpyVt}@fswDMK>+$T36lgC))T8Q)Gr=tc5o)95$qq zRR-WoSMlfdU)*?jPbg33x4Ux2D43&(?pk{51{xu_N8*5V5s}q?WhN(HSMJnkL5;lq zEIC;}9{kTU2B)iWMf>CF<&wyshJo%y@J_Y7Aq_3b>1`ZsU&85BmAL20m7pFw_GN_Z zAPP9=f`Yl5=GlzKjjo`lBCbkJWh}1wLYKlgOjkR-AqpMhN@IAr2CkE%Q`P309Zf7? zq`&BKULJq>!uMQdsq!nDmZ7@*UD*SJaT635mZwK*%HD;uGR#S!q5^}h%|*-)z^C#{K>0s@Ly>RC$-!C`~D3@YTyMzB(P~ z<#NvSL8qJ2OK&IGGmbrcrK>sj06FTGW_CdMUYK-HP4n9wWr#$5f-4@%oJ0+t9hTgl zIBVhs&H1%5v=#R>PCTzNA}Kw|=VoREU5<@0pcb{J_XKeZy#$HOB;jl|c=^|+D*e_- z-wZ$TcQHA53PBn`US2WQXYMX{_;HK24xJ|0P;_8!l?o z&Ou}VKvfdo-{R4p|Cm?nI}d;#=iPZlUjsOw4T~c=FEq%< z%JJfugxsfZtgtRiB^Bqn5c02bZ-!hcz?AV&3PwwUHYLe{OzpJZUg;8l<6Nc^r zy2ifhu3n04^}J?4Fz1kDzOTI?n~z*PA2hCAX2~QZ8a%^-$Z^$4YROfEP%VZ8*q_LcOT) z`6v@xo9^VS@T!hBBwz3`(oHuE=CErE-mH!?l*QK}hKY7xKNYQ1eQa@OsfPB8b3zA~ zL%uIsjW5xD_(&~ss(R9*M%ayy{~q8J2x%%N(ByQ+>9xZKs4Q0{4MnO_TUb|G6b`W*c#|UG(%rRj1(~aSv{g!^(YLaQ| z;746ILpWcYgXwp}D~|UDta8Ia`E^UIo2xTkO@t&(8`Z04j8z=mN9I7_BER^f3znA> zA`hq=UCSV#m!>T#nfM|6QO~C5m+*553fy;xu7p_%17Q%xZ#70&iWYzS;x2#xop7cP zyhnuCb0akMWsS9D^g;V*YDgaxQeU;U_|tF-A`w!SbM&KS*7)6C3cKwdM-nc*f!L}G-N2<2!eqS zzB+_#Nc+0BWg#$YD7kc!W=izI&3V{e-Irv@=U#{slc%!g9^z>);zvY~QrOtoKkTft zPV05=UALg-v*)euHXB+@OQX zCAa}-&41?KeUO9ykQpS{O|{r~B$|V{>9mASO;Qs2uqYQ{sY2Jzs+DQja`Nb|4eLP` zLCyqwMA?GRw5hg)l>FN?9T>$XpG@&xr8}Eb-Cay=3<^MMX)T#y%5OC1qXpxJQyKY) z+8>T0r;1uZsNUT@i9Q6Lhp(8#Urf^v!c#*Y+UA>8BWBG|6$|ycd5iaeS49|@cG#kj zfmWEb_!t_~^5tk2y<@?k)2~j8?gJzuSd=m!+(^=lRAg#vL$C*FEU#)^rF|Esgxy*^ z#E00Cxbg0u#kJ4$c9O%_#Z&clCG`*%P(=~wpnfE4-mh2=)IK4V=9ep^x0~RkKlMu|mR;X( zm}bb*QBFObg(91NS&aU5+9o-~uU;cAuc}O7!`fP7Mt*_VO=sIa|0w5+5GM_9KbR)I zqozltQ@j5Dr@AYHjk|_$@k8*H^~i&<U_`nX++(*3w`HlcLjlE{T_*Lmb}y z=`L0VGwkGp-CZ@MS?i-q!3k-QJBgZqp8+d=V|ip#S`(OqZt|CL2b5UaX!u;$iX1~s z51@HU}ryMuy^%kL{WMRPjj|!ss+{w<}})7*NeBq413_5(^1rT!+-7wZ-1@gR!4>`@7?lD&`G=o-@+ zLX$Xx+1jdVjB#Qa-Q9~8J%F}5rEUCLpbbAZdfM2izQkpvBwZ2>eW`W!K zA8czR#6l76<1jJ!w#6sdSimrU;Vt;2jDCaGr$JdFq--7oi9;;%WKSmLF?ge~jBV+8 z*}0J#5zP7!T}sHza{9|m?+GI5egck0Vx1K>Rbq@4iM*q$1acyi8ut#!r+a;~4mF;t zGhBy6!MEHH^ii`7?Dj#t=7F)A%1&%Y&-@xuq)7)7t(119PaBJraIdt@A2YZKA`N0< z#Vm$H%px+ET~CE-JRa~WhzNe-T}UpXYme0icsYc5|SX1fKr1`)Hx5@ z5r(wR)!(*x-K(;eu!S&dPh#oC%xBE&Q-qdmeny*u7q_ixJxhJe@m(o*_5!z zkSWq6W$Aat1}W5G#bcmf<0)~&Tz!M4HEwTd7_D!Fj(gKW{{2nVdhma<&f~Xv4lm6^ zM*2SgDTUO=>{ykQm*VJ+H{P*|s`&PL4Wn7=nIEm-Zo{Q-;^+01@TDQk@KG!V8@!K9 zPhOoJTbiYeolsEirKvCV-!BB~9yha&yd+6P0b5mu;#BRj*FCIfOs+7>n}5l(jnnW= zOIMds2Afn~X17p)DU8bJ3?vy(=;>sO5wI@MrZbVY@3&04hyO3e?kPO7KvCCq)JZy4 z$F`kRI<{>m9ox2T+qP}nw$rh#ow?^(^UQVT-p^T=K)&YT7Mw=+Uy16 zu>tUMO+bwAts$4-LC5A|SzQ%>2Gv=iU&xAr>fXlhSR#O1<_`19`mDElK&=hzxWGj^ zergt7EGfj3g?qYH0ujcinyAIt%og@M7_zNBa?}4A$>1;E&Ui$i6L_ia zd7R$mu2bM0w^yXk(uI9r_EZwic{+4d>J)GZgH`XhxoMo>{mGAE) zt3ZOZ8~pna=a&KNP(saInQ?ACDkkw=+qFn7jn)PVH2g(>4fovCKw@rKWJDdGRg3f* z#2~644oq2Jw7`AZmjBbVLTa?jPtx2WWt*_lQxs%XWiG4ui80$7 zmXSMzp@Oipv$0+P?7P-+{yCUuBWhQB=p)!RqDX)2SkMQCg)f%LVM=vW3npV##p=-R zU+Gpn;Z1KxdYHYwd@LSNtLf&DMw}6KB^;pyGX^fkUr_?bAwW9v+=Cts5 zgM}nh9kep3cw}A7l;^}T=H||;p6k!@QBJ8#h61njZg8MB7Hj7snWSHP1^r0Z;R^pMGQ7$PFbe@UoKd{-m0w+uCNR#n) z0(ui%?L(r&#k9Aoc4CtV461VR%f;kM9Ngv45v{{rRXgoFylztI<1?<(cyo&gC4_}Y z0Uw)8sAW((dSB2fFBnSZt+M&IMzZRN8$IjJx_dumcH9ezLfhC0pBYpxtcKsfbK3*; z#x7JHN{z)yN-|uPIT?~lN}+2iMCgu5_Q0{cah3j|?Z?dc94eRXFm9;|9sLEMm zxyohi8h`oOB}AOC)_Ojpz+8*LLdyLCDjImGr*?NI^*{+k4mv%045nMWImELNK)CKm z?L-p9Zst?}a6-uXB^lNae;f)br4K^hQIaWItA90r6~OxU=SFRRK#qUnJRCSvpT`)z zKH`uPbX;;KrKXv2TresH-l2;rS#qaYIbB(|%O6>O?V*>%f^FmJMihv^{xwawObt;v z{-rbHF7qThaYV~AyU2u-n}cRWo`w@o%o5tzxDmGQl^jat_222)-f!<&1Rn><01fg{ z0qD^qZs#VU{+jbS;Kz0(m4;<(v$+MikU-jsm}A!BmrLiS!`U--VP;8C!`^TKd^F3tPTI7*8a|mt@m6n2lkCmUT(#yz zEqpORklbGkb`}PWpMye;8mRByKy4SLAOATm`9071KX>b5!jcM7;@@svKtX`vTbBPH z;QIHR+_zi*$J8O~(0_O9-+Pt+<<`F+>;H(>|FMnnFSE|{t-}AY7x_=K zF7Pj%{>R}PsQ;6un|$MR^MAwXHimYl)&~D3)c?Oe{U03t-=`nH$BF*mx8q+M9W2b> zul1it-*Y6a%xwR4^zS_VH!Bbz0tbL-u!DsEcwG-tdk<|5 zq-ZiEF85^hXfIRelG_L zjvxZrB^{i;y11Bxa0tBX<-|7l?FzJo5J1!e1Owsj;(GzqEdu@*NUPU7awvEloZc>= z=L-hC?;LT97oL7+YZnCAH~0DtMWzI21=Plyy+>9HI_C^L==0~&D{>F$v-xizKJMPH zgg2@;X9CFkXajsmFndQ(eouT^2p_J2A22gYi+ck2h@3$93zq*hBvaBm$z3Rcgj7fcP$0ItUu{4yHcJqRcQZkDe1_7~jy zdfzV;uoXUDNFSONV35I&;@3_ri?3o&?=M^g;vW8;EH6JG-)--&m%29N6dah-y*v2# zXsRO>H@%$7+{usSk*}YWlzlNkI@*8ufU09kfOutjMPcy0zIMN^*xh(XbUY#7VZL|?x0U#=*> zREoZ=Mar^hX}t%2e}cVx@A0aHgiq^)xSzTaUK-}WwxfaGd*_nw@HCdgHu<}>eOfEx z0Cyz&gDmW3&2{(@dVmmmzY^FeK_XccL-6@ve-%t-d+l%g+57VLy3w;8JR#d>li*+T z)Ve47W?W?>K63%SV1Rd@;soApW4kS{J4-${gP~Bs>fb843FH`nX8J+@`n!9-JSCC$ zs9b9oIq4qYor7QB@%;&TL+SaL_ylrKfw;U1M@Z`{58!w1 zFT<^;>v#A&oqj(~F3!v58wiOjz)kbVa62eCQ7`_+swuiC`$8#e!$Y3B?^3$6rz-e9 z{zIQ)h;vI1Ce~~|qtzW(Fa6y`hEeIMMRQJBl@zp{>+aN*wqCiAfdojp<)6-1h+ zZ)1+&JntO_H+K!C&0_#7f>18{G*1z(tHh->Lew%!`?w}WcGIXtq?AX$FlES?(|4gV zCSk#zQ`hmQm(kG;>+l)eIXSF`hR(Bo1`##Ij)Hm(gD^IZYZQC;dTv?TNNy3ort`#n zV2ADSg?i|ACvChxY8ExBnc6GrkYpH`j++Wyn4?hHZ^HFO(ynK|pmmd2a|_=$_*lx! zkAiWeBFk@o;gOy~f8_Zb%XBH~X;G^|!@Q-^(h=g7spsQ3KFQG$+-I2=3GKKGMH6D* z(e)`=zTa?<#%5HoVxT~9Eb)Vl$LmbE6<{01re=+&7u{P*M91nBHMrS{Am|dtoxZ)q zDuuZ;Byw|+ygY&zw8)JoRM269cYzt!xY8*aZ$iqzt`LG!TfGKJXgNlSj#-RbFvgv= z9MR-5fk}|(m%pev&}Gkc7{l6#i#bM1D?CN(?y+uDI1wAQpN-FFZPdIt9dB+IUjRAn zKFztzP70BkSfT9sO4AT}66dkdFzf6;y4G9Wcjh2A18Dh0k-@9E_%S5B8d-~>Ri;@F zgp_^~>6f&XoH=CucAyr)1v!$j`1xB5%-}-GpQdyU2qL2#0rM(KZyJ0+F}D%pvJl0z z?AqCbXq_8hPA2xUfk{10ENQg4jq47%TvMeL_Tw07;g@T1`=8Ghup$ows$*m4*b9QiId1ihk? zo|yoPI2hyE8?lLru^iJ(T8?TOs5g?hQ6$B_w8sZ5Rw}KXpFO4*C_nyA(aNt_R!sF+ z)j!3+DXqez4xZb#8X>GTLOnOypKG91X0QKA%)p}MA7s<9s9gFKL0X$GF?Ry5^tecG z3Smmwg0@f>Web+{BqMEu);Y_0#2c|!sN{8JCJ)j376IBxj81qcZtftA&x-1YSI9vzZFN*Oj%W z8c5=^OA&UYkL&oeua_kvv<03_SFNCKCA1!nND*%8eQJgMB2VU?dI>B@azh@`;ZW80 z3|xQ9c|)%W503rBtt=WO2)r(cddwAK1+x;DBMP-S(u7e7&9i|j^iq=L-H1`sdEcuT zL7Rgb`z9zs{srRESoEf4Kk`<_PoOi0NDh!-Lvd2*Tk*8)~@G!%}Bww%~AC1uVreOKaN2vA=LMG~#v1V-0o8{N?g2(8z zFUX4*0bRx(9F+pz5Z0`h8-=%74V>A zK1#WjSVN&r75>|RHif;pz?uWqjs=U)fhg0c2zAfCjmfcRu92#cIH44noVCAkx6nF? zO~?2=-ZG=RhS1cq!y^u@tPn3dQ?4g_6BPh2Et@Yt6zJ|hKXxkucRI>z?gF)RaExe z<#sgzYHVq=<9xj=>UZ`y>M8>#Q8YwAU%XOxQfKx4~6 zOwE%$!(hi~9Yw}<>>d1RVLb?1Wz7g z#wOad@EM*R_8gn!qaAj;L1?{pxpjN`*BP@r=Ecu|F+hVc2{!|0C?U#OCL2K~DIr9@ zy}b0*JyOh3s;!3u(a+>Cs;hDiO`bjSURXETkM2}!kqm$GaQpla)8q&Zh3Kl{Ly9ob zxvf8CZ63!wj#5KJ^L=QU!&c8DODvlAL7GPnuFGOHFVYeU<&Se`4qFpEM-p1Pfv1g7 z4>Jv^t0+@qPYSp^Bi9#ef;QQ+8M@N=uruffN>i^p(2NH?o(X56Y$X<;rx+#$crp=Y>W&7FFO9zYD` z@x&|7ep-bk&+PNlI?P&(TeF31c#=*6j0@&-Q`3K}a^6^66b8q*Z8ES=wdgc+w%$VR zu(}!w$lQ3{#m=edcS;^8hmZ&PA61!pzN9UQZefla)0Vu*WBn62 zT9up!nuQs??P=)7;&=1lgS3)^di6yXMf}>932KNDU2Rmck*_!yV^fLYG`9WBn*9y| z-c4${-Jj~U6f0KicH`QUP$`1PG5egAJmKOqlC}4Tu-vUKYk6jQ`;lSD zTvoU}w>Tnq#5(=i^TXU&O@yJ5igp-%hFOo*BWTMRYhn-v0rmxIl0OOrYiKcw1JBH4 zvv*~fcHrGEKllk*v*LStD-ZZGTa94L?%M)_e}%yOQsXE+3@i+I)~2O)_s<~4fK_ME zTbvtP3(7AquNJHhGPzdm^a>4u`eXXqeExk+98^UlVTaiQag0(F%BTV*OK&V~9FCMZ z-D{5>z}sezP^M(}nHJ0+aA)A<=p z6>+YM-R?Tw$1am$RoUY>FMagW17Bk+_AS)+X_^0B{t>(+2rGxg&LI1Rcv(vUp)(;( z_`AUnTf1QcfDc>fzo>}2M0pY%Fz8Z@vgfD>miQ?r2!&Trf zloV+mOR=nEuGcK*j;5Oy!ik{JnXFpIzsn_J(s;8O z1?hSYTh=_YzKy1S^U}p91KXxmbwc9YrqNY=5yL;3_O?O52;0WHKr{gQDN!N(biQ?> ztjL6JQ1Hz5*celmHD^-2L3F)jdcIR(JaArqmGz=YJ+@>&p*nY&8|j^Oi3;v;aiN5^W^C>Vswhx$BOk&;?ynmA*HBRL9v z;x13%0A>O_gz<8Kk;l4LaTxbwvFx$m2anChFuE@WtaInlSIlR88$5p_bh)g<`~6r70tdq$eX=99LNVP zp$5(x?i!TM^zyX9bp@5g$pw`;#J-sR5p32B&4`FP7^}M4B2l(oU_i1*@0H+JFZL%A zkAd8&s1$VopSQ`&QoH_`po!niJA)O@3IO!psg$_-`DL=zS6YBObf2kCSCMBefFw8g z*hC%iM`5x0R$GJO77kt?BkhLdP`yC*Vr=M8KT63m7L(uW^?FDnJZn=RHo71awUAI19|i^up!K&%2s*Q zd?W!?9F(;HebZX$cxa-jRTV?$L*1su-VBB+z)ZP(p7cU3b;0+Ie7Y{&U-fSaH=w|V zsap-&;inBs^#&wa3p+yNmNBKEmLemrbst4@?_UGyoJ>BKTle*{FK2=?i+_~e zv=AG8Ehwkp+4PcgVHX(qMwRY*w~TKy_5Sdg;5GF(-Lj1~VB@eou~V$ANO=v;u%BwTw_c85v&c?wU2m1^#gZ4;j9|>bG5#gnYuYMyBdf$_GQy8<5#68>yuP?tA7kqpdX932{Nl`s3QYn< z{^_S32sQPC7=lAYUDT?9o>G{xmTgNVu4+f9dfii@k?)?tI{aH4DkK?|>tFUykS#TW zM}J(QWx0a-cjOd6Xn`+2g)rjrX7K?{z z>q5U4lnmJhRbxc7A%wv{!n(S$Wy2mey7avlli=+y`??vec;bHFkG;8G_Z*wy-B7Zc zU%lLOP;)zJgI_MVvi6CwFhCklMY|@|aH1IHU`-fwaO$NBokfbVu?k#^RlG8ID_x~J z&+@rJztz|Lu8k@3BMO$XZf}J zt9?;NCjOxYCW$pI-xXa@G!tQM1G8z{WZh{{BpIhj5l0nv`CN-rA%Q_y;tc*}4zg%X zZq68lNJHE2U2asiW4cfp*TP|;3?~__PO9;SQ8fJT6?*h{0=uCq?)p?MYuoD#vog@y z%agf~`onXN4F^ekU#;zgA@DZ*DT9PKA#k+o0xX`~2;=a0IS#K9{s>;2#D+##xQ6I^ zB*tGWL`TkE^>;2^8yb@H#q0*3zhcP&MBmK8zy${qDJ#vsTXbBA+~rD(7^8hz(&!wr zETNGSVegfk=TA;x!V{Px@M-$!mu6gXgNH?1G8w5!8Z^M;)x=#2t4Z~)5_2OH_?%+o zi@oi-Um_aFk1mnLy7%ie>h63*u3JljScVjqTHGQn^Zp4S9w8o@TO;0w;uHq(j#CRT zlBZLqs*_8+RRH0!@}!A{0$BcYe~`? zYD1wP_dYI7uSWbaD`6d?ifja{uU7d&^x+0CQwDUSdJ>+TAtds-HX4ZgUQYTGLR(}E zMIYc~=?o;m8rAwgfa6mFXaR7}7;8Pwq`@j?-}EB!P)9C(1My&7@y{)Fip?x_KP!7d zcbVcaY&g;kp36c`m*{7niB5u*6De*mz;pt}|Kbp&Aj1E_ZJ7MAjW%?#vg}ZFb5LzM z71{kM#Vr0(_?&La^i~6n%>P9>5NS^Kpo!^B(!0RLgIcmwvR{yCKHj93ZL`hQfvva- zM;$?_VXy7QC-PQ*kCdT4`nEFii(q>5<0W=pFMqV6^FqmCL4NqmcOLgzN9N%nx-`>8|o~0a1pY2h4DdSVEv+w@igJ7g8wv<73O`2Gw+hi((#^zdUZ(j!=EiZ1+)i$#N{v+HuAmq?T zh8ggEJ$tZxld;no5jO5D3HJN%?&xhKLLtsE8mfToKC{Q|mgW-k96UW+pw5S!YdeNF z4`G{U^w+b0q|~SWSg}|2ooc$dV*#nC6a4m>u#)ALAc9MymRC0mwr1XAAxG+Qpx0r9 zsr8tIy2RzfTMDQ1J2k7SabQCT2Y2Z2(#5m*d+57BJtwY==EE_`AP0h4(>9R(fNU-| zdQhA5mOIpsVAIl~WIuJIy-j;!zd~^t-F*HB;UM`^J$0w?vY*YiQU&W2nj064)d!TT551E%f-g-04*kvi&Ue2E z+S|XwF3j{zI{mYwi4Hn2lb=pSX{_SM*YMaEW5sc?xVFDfADx%9f9mEVLRaFSboEY8 zAl(Q*p4g0(eqsh$rqf4O@N5=J$Qapn9MK8+ql9{BHbYz%>{h?`t}9ptPV%A6USv|0 zVN&X4rQRbGTx5jty9D&!$#ru}Qx*UlAmJtG7(>xSA8jkD*xJGbb<+N7(Mj zWs^`tnsKCWQ7C5piMNxGxLw*0jL}i~eFhDB8gfkU{kk*!Co5tYozuh%WdNY+%0EH6 z@xAtT`s`HErPJ}lE+m!gmp?jct*mVbAZ(mKs^Q=k?2vB$K5JSpqG}&g6$(xRM#-(K zXQ#S2F+=iK_`2>i+RYElJzPD8jzATdX7;N3`+38phbhJElaUH zy}&kA`~XFcSuG`dt|$pv**4NI&CcZ$fm~>EZ1RT0A@NvsvfmUk29!2&<6o=N>DbWu z3**Ss7Jq5Oq9kVD^T2Z0mI~!1m7o~S24;>rOuPuJb(;_sg&147BzFb;mbohZx*ykY z?j$CS#LvHPd{q+QaTvPVoT0ikeu(mmMk9)Dk8B1WUy{z3Z$Wx!QuF({#(u9tQ@Z>8 zeYRjAtE}Kg!-pj-QINSh!3IX~Ti2onD;AQFJzSI#n>=lJItn%2`!5i3 z4GVf!h3%&Mylq%{oWLL@x}~d8Ox8nkuPm*-BJTE)qKV$}UNNu!SWJfsuOoCt&-i*; zx!-q%p|zNA0fq{*s+!XMgi&_SNqE-vD)2Y79IN#GlKHR|kC6Mz)y$QUlSoM0xzb%5 z%Y1*0iS1R*?Xf8 z*_07F?Icql2wWPqb9HxetrZCo@Y}ZSN74#Pfs|abH=Yoyv%Hi2O=ZYpU*Xgmvu*j^ z{g@woFmUg&cWHFMvbj&nL#ANl{{B^p#i;ocW8Cl3%&DvSHU>yImjw)p$wREpyuO{U2+m-elq2i+qfk zd>*&IS(hz_!ufoeL~MQCwLc&^s?>7Sw|=G$$m&H5#CL2MD>s-Riq2Dei-9E2l=@#An^K#%_*7%#HAfW6!oI2H}Jf0p}pC7O8g|Cm4bpp}QjWHc;@p z?nSpeGNOAvSGK~)Z`4!ro_VCsEDm0^Z@ALMvO&Y|lEF3^a}f|oTn9QzOa4CQ-#v<4 z+eg=u4!{0GaIG%O#rugK$AyN=`wxfLexlyR9Qm()(4p ztJN&}$@uFTyp(jGekfLCEVzq}f~_@@Chd$3abs{!uZkF-c}0|ZmRk6QEAe#GTBsJi zwGg{_j}k}FHg&u&MW#--+-zR6Z$`Qq+oK^(OVza|C;MJnKCSi z1&LgE0~1F(35$knMN=@|SkgA=cDTK$b(lUG_J{DOel;yQIlS%Euj4IXnFhB0m0T2* zv6L1A&Hvzvv3g^oJyRO3P04bsOYJQY5Rz$yt0MKGX+=iOUBDr}#WTfx9Q!<^l%AQ4 zD~9e-%ii-U*Q-~thicdiyStOOc0(Ua=an@OqD7~Z_s7roh+Bmm*@>I;R{`-ZhatsJ z-ZvjRDfcN^ID=_QJLYr_q|@|@4Wc~g^nOm}Cl8s_6AG|=VS@9fd9OSiffh=h42q7V zvD(ctZV96dy1`FOYX{I(pX49$`Ghhw+J)E%k=~sMcs)FsIOQZ$q!BDGDu6&{$m?}R z`|l7YZ?g3R#kt2QKcGz3IIZeYjPm&qY2Zb9(MvlEyh4|}dzo<6A(wP9Qd%F9dGk=# z6(uQiqKZV?)&ruMcUZQwV*B7`+Pq(Ab*W{g$@HE%LM}rWA)%Jtfi;0Zah;-FG6^u0 zg>K!krRcu(Bxny75;gfHN<|rplx1r`L$)Ei)&FXG=Y8HR>DRq7wwRu4PQTD~0*d{U+GUhe*hi z99o|BR85y}{t<`FK!*{`uTOu>48oGubSUQtwd1M4%I4bjryE6W zgy#px3x6K7AuL}z0~}ybFim{=*jjy*CIykUEGj+91`~iEj+DLm4#5c(rGkwQuxZ?b z8vDZ=e7;Pro#EG>XzbL{X)7B|Ot>^zP{sOVF(if{T(%Z(=auED2{SuVck^h2mT(bjBPWlvdybo)<6>L60)EfLN zsth#xq>;N~nn7tm=BmsJEzRw3-}^L8BCDo@SDaCYfa~nZ`+^-!ov@nJwS>5bYfcK| zKms?)1ZJ?~mZW0HzC+ZJ3^|~0SK^ODnidG;{ALyu`T#~=$of|-g)En^fLqC4*;FOT z09*LL{?A>n*lyRSQ=hr7St|)dYl%6GeX3lh)+m;I4a&t~wb}4do`9}%QTx5kN|=VY zXIEQ^C^Sk5t)yBB%mKrM(C?2s7wlg@lg*ZbDz!yxfGb(&!ru-Lyf2D!E`bAZdU-+E zYJ~gv(zZLx<|20LF#2JG4ShQBw5pI*T z{r4{jA>g(LI>t!OT=~Qe{)mN^`TVkt&0vJY@R#g&Ra7LIRcN2^4-3m&|0(NO8UBru z{r?qV1w`eg#HGGvos`)Btq9A+@L#fyk@dgJy8kG`{+q1(&mt_%KOEjao3O0k+139G zuhX}-wERP7Y-jk#!O-rX$yY;r`|sxK|3m8jBlY^f<=lUxbd3LY{{NzMOlDB3n;=K18Ypy6cIV@C!)r#oP6RUzBzQCYG`u>&+e}xgm%6mT|J*J~x&hxb%&en0Atz1y*w zFlp%n!v6y#Dv3l)`x6W#z=t=~`v+l691uwj)&g7(4bTj44*|KJlTbiC8Pe%a$Pn&b zwFpo$4FHIkfMDv00|);KjE~>4*T#nx{Q}aqFUtfv2p9&TNfvVL4v(az0B6?3Sd5R) z+1VMm23Z`)*CA&22((3DHp(X$0R`*?ycYBw6Fmpi$?rW?(kBH+_b;T-M=vbGqlq&; z5=ajSeF+U%RG(2x-vz!X(4&oyZyPG_G6u*Oa>WCg5B&9$6%an~O!xT5@tK; zE$Al>ykU3%d%he9Ir;f=h+p@ZuC*G5RdI-oonOx^`JT=P1z#+J#(ASV)aUBC0$U%> z<->AKaNotbH|(F|Q)&~i;If4~K zshDl)89H(MAVq;km!4^C5yhE%&_-%la=6fkJsU^{P*FaN0jefR=S^ zZ9qTOBp`eZX~23O@ZvOpgnXM;=w`kEi{8cW+vuO=V_)G1Uz;&uR4|Y0lMm}(-Yvb- zvMI;gK-8vMv#P)*L^X^)U(O{z528&P37lkAioYJq@_SVYM*4Adzq*9U#ebXv*UtOr zS>k-v9Ku`OOBm9VW9J3)@_BbE1HG>-z9+*|(X1D*s6aqTjBe9HD*yiCl*h0NuX!V3 z_=lH64+V2a(oc?P6a?1BuRy)P$L$t_K|t{#npr^sa^l4E;Q|qRH_u;*gv`TNYp^vh0w0AP0~cb`plFTCl- zc#a;h0J@jaZ}ZP6P9l>x3MqVxD7>q0OkS(RGw;oK@Geg5P?D&;NT3rv7Tsl>)^Bm2uvxwuY?5$;T%P<;m z8Q*!l1GgvV#2lTH5hH2j;@F9>>A!3OB3Ilo3AlW`{d{q>329K-sp_NPGU0}R^lub2Od zK5OB5G#DxRnYB3P0~eSRqZ}&GzWCCgNBBdcj3wY^RJzu^h5tDGx4_NLgmE_RYcU|t zAzty2=w=I-2BsNdwZ;mQvW0;|NhCfMotsVTuc?Ro<&;WE)xcCLN6}_cD=E$q*Q1Lf zMRVX~XE*jky}y}v?rn72uqGQo!Aho6S4J(X$GGuzMa{CqU98$>x#yZK{1;RB{OyOv zG>H9j4@f#%#R{QJK_fUm$t&kiJk;^tchBCh$-dC|orr z%>9Pxa&fSLSH6XA586k@kMv-(BJPgPznAHdZ9*m#Z=(E|cTd22Gz8dbjCTzHXD`}= z?=b+LW_Siz;s&iwWU-KXe69(xRXN?SCeH4n6E5Htx3Hyv6$c&=FJW;%KQa2_Y41zrqZt zcTLv*fq!48v~>IrYu&>=;!leD?m(T?!jDo{nsK{KE-@y6vsS9FVmp;XFy`& z)i&9<)12D)WjI-tLcFS@u_nO##q_HyII98DB<0T+aNCtCtZ~M9Qi7_yWhA`({I3R5 zkH;ZV#AEh*SjRxjwiXZFnd6!GB-?|z<)qk6y&=Q(?Yt^0H9?i{78K{|sc0wd*~eq> zoP8PHcvI|s4@OWPmt`dKg#*)0`=tqht`=i005N-(jN<@WaeSQDT%FM3v z-RR;}7V82nJimJfVch0<k z@FA8|Lqd8oi*&LNk&Dms%E4?1_R@{xqT>KuA}9?bAQEM?y3;5vgR1gWC}|B!Fy^>K zeEGgvL5@B@IGNh~o}n94Apfz-cU^UwmXh8q4iVt5*PXXHW~B++t^xQp2%HStaLr9L z*wf=E_Tpbe+Tq_3jk#rf4;sMwAF{HunX%?bY#iz}ES?PY!!oHLfpAm%uuM|R6<_`8 z>bnf}Znf^&Gz=bOIuq}iIH7e#g>nMe<-EjExU9(c!t5ddfBHa}p22nE zXlClTdo7-|E3H|zcIXS5VS<_$CrJK$3gn>!-&v|(DH~N9>Zwm@n8Dk*rrTeo*>Y~j^7=-%qcSK^&m$nP6zXh%XaE?~1fn4z_C^~H$DMJnmDpzW}_ ze#Ms@>C~3r8YV zy3e{DmS2=&t_&TF9NbQQL@V7x_==zQwAtlD80w0)zme8)smY5yc6(xkI(8|Xr%N*p$l*rs9|cC(cndQ0|W!>soK zPVEQs1T+zzZwbcy4*}#%+c$fE1)jnA6pnFIYa>9QkQ#6*vhUnU^Y$mL185~ba!0EsBH{UL)VG0 zn?ldThGY>xTY%ukD6}qm zoM96ILA+&{-BW1{9ab9>tIDbbb({4(Mb~3W!*xjvPZpAg`GwlEW_JX62U9Qqm*Jh( zudF_?5`qV-g|b4potY_0jdgZ%vIU>bYk%p?A{Pe=f~)?5SXg@lt6SILRX(imEFAPe zajwPv*5t-WzFa+h=X~}+CuNK9m>Skw^0YHJi$7-Y=t7o#lFHZ)_gwNBi2`1_P`xpo zHc1h4+Od6jvz-U~w9R>7@fLNy2Gc%v8W2DQqv_l(jqoGLC=P5_`8xR-Q$2NoI6yPh zZs3p#L+isjB%I0-y@Oea(wNkVI-7J|643AcEN`uDo@m5FngMi-Zn(G9nvT<*84#*r=F!YY`Lo$XFv4{b%5Desmh1q1v3fvRY7#gvcxwA=xW%jzxSyIRYB8+ z_0F?x7n^KvAe3Gm;)&r1Yan2FPl8g=$Sw;!+S6HJ?j|lwMi(+Lw$b@UP%^aCYN988 z@f0#KpeJ2{saWI37?bYZHSf2cf=BdjjDexN!UIT7Q5BFXVu+Air_0qqQoW<#tn=t_ zXDQU{Vo)=Zv4N93l3K2XonlL%u#ZEAnlDgko~z`6-82)HVYhgpy2zf~#pW4KNE}@~ z4V34tnSl_e;?{|AqUIk!@;Kg7?*=K)3AH#@ahY;6k47(;d6wvoUdsZ*ymegO^iuA( ztCbnFmN;pjG^QR_{v5jq!9t-s4IibvdOghk$vyfr)e>vm;4!sHdPQAjkG}PITdsvI z&su$4IEOX9nSUu#d78os|MmJ4zm@~f}Nc>upsNh)5lu$E z^y^e@?!Azjm;Xj&u2LykVynBKoIC*LFPpXc60Rt1UbSfgSL_?#iQGMbXexBct5R8W zlo|i_k1HWQ_dW%IskO|8b$Qb{23qIc{O~GZlawSv@~wtn_-g`RVJjq$?&agn8$hdr zBVI6~vp&r?+D*76gUN_hlNKmJ_%W$ZF*+w$nzHBVD&D}C(`^-Vo_iQAZJlgF;O#Qq=_>L#V ztjd4tvS*UMm04EVnNEW5tKEVI)>=IbJAc4J@`?a0ee||*L=|ivz2>S%1sc6e_;!Jh zNXXQX^J+{>HtM$MgvsrxFLVwsLxG!2*pv_n90-2w7a4)K{0)s(&@&X3*YGRjNLB~iEUu$v9kSjAZtK6lQ4A@n^s~dbR##J*e4`1THp%$$-a<8I1LvSn zvfgm&aiuj2-DJMl^Y^WV^vsrs3n_zZ=b7ajNVpl_Ugq8}X?M$oo=5^x1>}6_?7RN4 zQ_T9MF>(o{uiUG18Mn36MQ%%x(=shYr^gQ6I`-1A1a(-dtIfOc%;gf>abg;H7tT@f z309~47z;mzSvgi-W-;~^pGUu3ulh63`6^8h2209Wtm}3tZ?7?8SDy8d85Zr zbGkI3P=(B4_CFt;cveRb27T%)SV6}_vU*y>rEudd*XcC++GT9hoahVYpKZH|F+w?- zuWoOA)l4pnam2a{wpvdVU5;iC%C~-ZHz$*OZ&g|G79*Vlr60*v1CQKIv@{)gQdwOS zXbRE63Nlx?0IL|xn_v50{KhtP0wjx%jNB(d4bnD=s(cQhOX!LbJX&q{$g<-d_F9>i zhboCM+3S{rV1{T(X49@Se65SIu@hVY6>zhZnwRGSjFD$@j$HL|7rq-`@L7WhKJa7eq2_2si_nld7-ro+3y zi$hT3iA!Fs?H7OyP1Ct2_R7|?uvJh;=TMG=4LJr5i`B5p{vX;;6nt%5&*LL@?>{hj zBu^eVE%e3pQ?^|)eIDe~4`DO9fy(?$QMAv}<+(<{D+!jfo4HI~;(!qk+-aiQDhYSl zrehYzs)6z#vSy*iTc|}WODfL}91N^gJqGbR6k*RvhRX*dxeh$KEv~rpO>NVQaZ?Fk z&#m%+mqQQZqHL?>2WKkV(YdpV51IqCgggU&3O=r`ItA(mshVsg-dDnC%^ugKcO2~~2i&qA`lt3-4VB{ex42vH46OIqZ zqc4)qK#NM55iFrdlU!Pkr_=&!_xUjUfqBoF9Y-g8ECY(iCI)f*ujgW7@|X8*w6Rie zBpQf9&clY8K;f{m6|Z`%~uYiiavF^iitmX5YheHZ&=MyleOkhuWCQ?QHX=PdHl zg63~yDbhs=-{Dmwv?AEuY3&E?j2p$sP6nmz5y{RC!W+Zr*4pmCKp}%ZzU&6O&4`+$ zo9*+*OJcYt49@Pz(O(vu2Q->c-RZ9NJZ4};sxLyfa-DTY5ME3z2>jSgyvTX!f$7i0(#|c+B#!mC9B8IE)ikg|E zDN}qoM9g`C$Kg7m9>e6JoEM;5XBVx2oY&9kszI3&rF@rAX9|NTSJn zH!m;`FQjtf0?}JMctA!*^5(Vw~{WG{uG(#;d9^lwVV z)^{iN2M&rnP((Ci&JURjPYWR)zRz?lV^|WlV^NhBb5*AraT|;@RvEy_qFwt{u9=J| z1Q4%(?Tso56)sUZ2pHdbVWZaOcHVxu3?Mf*j{RatKjNjL=@q(&ucqgS;g}LjgO_oV z(vNfdF?NG&&<7O?PbbI4>se*a%+V3GDh*;v$_PCQ8Lq^o=32&{YIPMj>GNaO49-Z< zB}IG5<3j0<jaa7yNh^{gTjVwF;C2*7}9^Q>ojst0KuLo?kchS#iMK z>0h;56Ab&W<3O{~4ob4y?NTl{li^F&-= z#DdlEX9i+Zd}}JPBe|AEYSKP=Ce%HxV%D7uvX{O-f+sR_!9PzR%y%T}KA`TH0xApa z@(vQK)%z<`rQ=7@QcZsm7heA@5GiT!+p~Lvk6rNlQB#vbV);?GrT-yvLrYiaRim+R zCg*b^6j%XL{-}Tqo?Ri-qMC-Nh7vD(6;=(4G>ygvN?H>llC)j&V;x{lCvq2;&T&bE z8*VRxfkgRW6txY*;F08Mh{GJduEh9eIn_=x8Vvj$!HF+WAL^i*Q~%3Y2OXgzv&fmd z2N3i7d5>KB5f=5i$V<`~dW8d6vtp}k&Vtw3?@DzS4f95A3E7UY(nOnii`l}sZp{L! zwVQX3g1Cwxr~I~uh8}Bxqd;A~`HK}p&jpz@Fa$apokzCY3Vf59C*T3Bn>|w;?Rm55 zqL{)lyqxb;g7xJQ<^JYJ2RF;Gdu9>S8(rSAYqZ6)FWuL9Vf7#U5cKyADq#r7$fy(7ii) zGap*69hSH@Q84f8!1xV5ik95!-#^Ya#6)U1Wnsuz)dw2Y`-c);e^A(&uVW`5Cq4`) z-fgy=+$G4>9MvOxfjKsxNl_()1~fJJ>)Fy_MIKw9-1`|NzNfpgl}EImd*n@CDQKEXvDpky z1W$QKuT@32c26mv5<49#;Y4S~M(c1?z34J~y>oxN5rFki*G7)&V<>6OUn~_~b_x|n z8(MAO86_upQAVxQJU!EB%whl&P9(P`r5?hG+bxOYu*`IoF)_f7(wQ4IGoVnPXNAR0 zd?H4YWRg5%ePX(a?U|u2~VHs%lfZ&Ml~!3#s%vw zdU%JQ9%k_5TzJ+1p*xj>nCsS+0Apk3MzQSo67DZDXJklu%U@{ZVo$9%3o;2x9^%KrnH|A(6KZ4E4-{=-4~{{r)J zqJrX*;{U+B;{PG=hK8B`Ke;^p|I5_+f93N3+tkYXUq!9|J@m%O%)!{0&dJsGze-kF z{{yuDH}cN>UtaJ($vY#{e+{u=U}a`t`=3&57}(f2=>I>_dsH*1eD-ETStRln!5eW~ zXJ;oDi0Og!*7ko~JZ)f*H)sJu5H4LVRmhrMaUy37~Q+Nkp`y+O8+r7GdeVS z_1PI)9$Oe0d)wZ-or(rP8khhmdy0Jiu2{;L_B@ zA6tj~sr^@8_Q#*}*7{ZNYjs*9@M?=+=NF7gDz1E8S0t@tjj1A#`j3|1g26AVJ9__b zd^&J8;FYwrbk>#?Kprr_nT2r!k5uGUAFt{`cSE-}&&cwRYgHGxc?VC+e#y02^9b05UG* zzSG`ra!mCfF6a_Iv0?!e7l0dIlFyyuUx~Hn-B-Ei+wDBCuU0zH&ewcUpt7H-w}0n^ zq=~P(Q@^u`Kdy@0=ylfTv@zpjEvw5+VYmE}JxzrIVNEh((HzpQS#>gcDh@2Rbx zyFhcltji!jmZr!4B`LHmznWCnR!=?P1Ne@azfJQC5(5i=%qon|tqksK_1{yqzH3Pu z>p=jMud=9rJyZamrlh5RrCxi~Nmp*^LKi=Uf2x6c=w^IFQNYvJ(tn!usjqMVh{VK* z;N41I1q}2}!QB{oYYQmmzHc$X=o$U4vUXzub|xPI)7Ci#ew_<(u5Jw!$@~ai-Ol{myE~?PzQk5m zz7kf}zwrZ~cJvuP{jWOd8{J}#4h>(S)1J7#4o7d1I9fZd7qR`Gj#EE-x=*LQ#qmA-qPO4a{{jenV1Uvt)e1WsN( ze)r$Mr;VCEkw3Rzz7s#-pFMA0e3x!buXp(@^L{&ESxeZ#MQoKmm5 zZ9K8jOMTybQ`x_Oce(Ckc^P_BzvT{HV|~AR`8=X#&|><0jV2#b{fnc|@#a5$m^eGv zzXwM>Yqfs-Z@V47LjzqMU;j-8BKF^diTiit*Mmx03uiad_2-kt*H`=}^!JAu*#Cwf z`E8km3wcMca%Ar&)I;Bk?c>}0$Nj;3+R4JBR%H}7mCR@j<)Y)N&w7+=Kj|KDDVoQ= zLNlM`U{|N~&vc!Bw#0<%3mBxU2L_8rx3otR04TySOxGBIB`a!q_X`Wf}FH^`Cn zoI7CH4?5SR;LT3=r>=B1gLDuLx7?T8vuRu|aXIXNip{ zI)q~7jO>#-$0VCEiRO`OJW8D{<5R3+$~m7{#n7@$GJ3`HorKar+hZSuEy*%GLCWnGplQ z)(0W_A2Z0~1|wgl#dHnqT6kkKtYobWTACb*up^LNp5A=fW^J6H*>{wQFn8_n5_Q^= z?z5m>d3Flx`@ftG6O7pwJn4^(EFvr6a|Cx5kj8wKcheKdLii)`g13`|&KyR!{o$k0 zg)$Pd(|7wf3WDe@@>bh?BlxpbT$fm`zUy&6K*%XQvKwf-i~CP%Bnkbz>Of3ATc zws0K>(7aoxidjMPSp6mCeo3Zmy3=Sh+4H!Vd=Az@fv>L#6O{uOSd9}ZF-f1eCyj|tL=yA(@66@PGH|=wYg~&Vgrfck3~)N$@nz4 zD15l1Dqh*UZ{M{S7j7k?Jz%G+37u(MsCML9(jfq8>C+ti7obUi=;&7=%F`ydMJ{K) zt6DtYOp!P|*N~cvmrFB67`gdwq;sJ}t{TSi8AfNMcd-VF@nwhr$lGd^7wp?~JN5ny z#DZ6OaV1uSu((4BkuFe2g2O=wo>8``nY@3j31H8rc~#LVPo= zeF6SDQy=YGwPK#FFNn93fCTNsLv*}OsiM%S#CtugP-o|cxsgeuo+rGwHQSXpFrp^- z&Du+xRGaa>RScl%9qlEtgkKh~&Kr8jn_3L|WgcK_tIkOfxt8nikTufIfM1p+>z_Rg z#!$r6#Gn15AsvaXU&$>T-alR6NjMFuWH!_+N09={@ENWaS$^hF!1EaYVl?8UBzMG) z>If%c$2{LPHCFg6*w$pP`YWbcOd!2Q!{$QDHCS&9Wi9`Nj%oJFDV+0D5Ez{fZH<>a zi1|40ZL`~9J32GUdLgHlL!9i9q#qM78^CNbv|pu5n}+e~{g`w~`}mwM$np^|okfFu2v#e_89V+jA()+{zME%vHa?Pa`o zL*-%VcC(hATr|CdYm(srm_q5?wSf|=onFx-yLdNf+nh9V%teBADqIDhPx8Go08#nA z;>pr4yYlue7cyZjX=JQcb+#eRkQ}#~NiU=f)}GYc%fdNR;-L`j%8wfHyDmGoLO*J} z{CAs^s`WrMq;&%XQYW7-{RGRLMKmF=w#m(OnTyI^KaO0h`)%5&!lm;L!o6$Dq~De; z+;E045m*B~#@M;@SW|}^v3@3|@Y>m4v<~{$MBrm+^sh= zik?VkVhnM2A((v~A!w(sPIj#f39z#O;hxix?(zLBjNi}6Yhxe-X4!uh^B}xvl zVvNLyjkN{kl_Fl3df)Q&*HHD1zqb7vC5iZVIR)zw5pW?xWiiZzJFT(&KNv-M5pOc7 zK?Pt~ME|n>(xzrT?{`vg1o^8?M>>372kQ%^#JgMKxXBx)jWrhIv=HD$(j)IiWD=IM z=6;h~vHP1qO1uY62HbN^e zOa$L0<6^fgacI_RiE)Ql(MBW&J@fMh-@D$|ys7D{>|0*ePADJ zJt(Nz_d)m^Nv+I}jkYX%Xmrw=O#j;UIKr)gjxXa0&M?4fl{{XP}xCT4&1i zsOT`#SMfpNhrkBS>Ka3nzlJC{?UlxKtls3xy0`@_#Cr}3Rf|ksPUA42|5fqt86^Tx8rz*IYk4;zCkqKOB{TZg{9mVz1Sy@sQt>GK%}xC&YoEi=VsdDnUOsOXTTY zwRSv>Vgkg2Nwxyj0jF<9CA~ON6n(X<5926*l$dSIGx|v2mX{m1QMfg`BouHLU{iI0 zx#UxX@3$S|&0SC?2z|JrJN9UWF%#beeR`9r^;Q(C^mtYqpb@o?dr~b_z!&u}EVE^{ zUZsC?>Xuo2t?2@Tjm=wVUp=siNuo3Ir|9Yf;L-fF)z1f$ zv(<9Ps|y^Km%6yA+VRtiCbk^tTtq`pp<#>r$3H&8^9NsIERsSZ77EDCAw}2C1bW(- zSDOD8{wB~1XL&=PK?&wES)fbUu;GI&dUAeF()(1I6%X1)Zy+T}u4H0zEhq(3K(CB!=pq@XDHN1$lMGvVfVrCk-j#tg>>xCB@NsTZRA8adxxg@_ z{;2bee7Hvu4GAI<>j}!?W8Xs)R#Ks|p^H+KI+ln%`-@u^&e$Y(&ff+@1X;LPyXt+aZ*Q1nl;*46UH zfbw9{X!!mVV>-lAn42@k_~REczJUGb+L|^Ic+$^3j`Q2-c zqZAzLz6V}7AXA>F&)8D^eC5$F3WI$tt-0)(WUNauOFo&R)1TqSL$sh1Q0J*4hZ3Dl zDo;!qezAItI+rLptzS&rB2u5j(N;kdj`)uXOee*3yy!ie-j5nxaJo&%YkRx2x)Oji zy+sWI#xpa>hAd78gWRYHMVl$OqV!2f5cH}naEj4(H;nRvVn-6_hZQ~jK2i;KLa}_i z!G-v@05fPTDx6yY`1PB1Dpf$;_rc8Xi;gzWS03=<-Z=i`m?q8wKoV4sW|XU7BE@yR zrR=9D_i5z5aD%gBH@L!E%=(H|3$km5C{;ziyt^xJLl<8hnI5c9{WO5W`BVo90$R9u zbo@1ofDc6Xb3kMTCmw6&z{JM*9XqFFn2H+F9cS#9pgWMwPKuxbb8-)?`V^r^qp>U$ zBTnR!%%hMOB6a{_RI3iGOp{hUF)v*c1cwx>(SWYe)^!y~@PFyE^bt$3KmsTyw0Lye zmGHZcN`+D;lqD_&jX@t_>}+N%OD)K0M(5RIcH}eHCRI@L=gibVmzcesNgONE3kl-} zKhOnk=l}ZKaGXuOCoooq7_!?AEqDZwV=>p|-WFNKEA1W<+CjS_X+V+?@TJyj$t7c} z@wMtFXQK^gW_)YPZ+TfHK(BG1bjWof?Ain_=d7l)azHrBa)R20K4$Y8YM9*}0 zG-NI}#PnDC_2DREc|+oH8z>40lY9lPx%hgdr9$s2b8iahR_czghvN}zK{AU13?Vl3 zs$$6N^C?-N??eynoPmg*=no-?2GP0W=J zeV#^j#3S&4;5jD(eWR*q`5Cj*0evP2F+q^z=*c;&O6p#oRWZW@C)BH~SZK3n{)wCE zz^$^f-V-8XQhyX@_1SmeA_dDm7*-qjQ;5|8V;|4lkhss1&Y#RzQEA#mE_?U!QI%TQ zRLGMC1tJ!+@14e$s6nchBYTW2EG84qrHfCzDbsbryg&%(5YMZh~9B$jiAa##V?W>xjDN*@W z=V_sPnKU)7;x4&g*5Hf^s1Pt??e3jR)-A8Zftcz-+4@wk57k#t1Oq!UJb=E8L25fi zr0|N^xq~DXZ04&@0Gj`FrZn~B+1Qbfml-QSt@%6*oFWwin$8?93p6=m*%Ln*8fhk z5vSLE>#uO!c}ytcAw3+-UD&q{Vkfe0k~BgfNPo&BX^_A+_^2V_m7+%yBozUv_-`54 zKf_q)vj=&zcigsq=ozWt9_VJ#Oi)pJBaP(+rjZ4}c0+dH#RFN>6<$@lC`+&9$%rjo zvW|6OBg1Nk!H0isc#YVyq$vtE*NwH_if_jzX~RZ&>K~v*_&GH7)fGpPSj#*uQPac zHCmuPlc>5iX{LL)CnUAr4xK3-^F;M23XIeCVh8v!5gX&Ywz8B2lNBM9s6 zAe0IA-rr6Jd$#Yibk9-^Qso3aO6Y@e%e-b9czc9#^eT-9%Lv9wjlrpwnL)60*64!J zF+4;)yA@50LpzB?we;pqNC$j}_dmx^yRycrodG;=USAmT&>4ON@e5}}mF zqA_y-siS4tj{o}^9A3ykDx?0pJhZN6wHvw=Vom8JUR|*IYeLXgVu@`)C+=~glQbd> ze(Zv8cDnAAyxejx@X;9=5QYMEjOn&mtCpn?J1tpdhC~wss#l`A%2JpcyBIjCEPKMS z+yT$#IOGnmv-hzwC3Rsw$pGk zDe1622MhE0;ZuXJx5?82lQkgRx*PYTf3bjQuy{-<)lx8lf6m!`Sq|iNylzQ}|!)bZ_UyM$~gXhaN%S~C>H>eIImhBtMw1Q=l!ae8-{n52% zx=QQCucmjH(HSrrN2jEpVqnQ7%hlZphd<^g^DgVmLRYEd4~P&;-4N%6nvPOA$BcJM4~g_4}%pI(+#yRFQRiYUgxTyl|oKqO1z3L2z7p8(qtgxrvunBDuUwV6o}nhtlQ&%Zrh?jKAn8`vkPMb8Tm7Q zpnW*QwW$pbj6XL%2P#?Q2lHE&=!*;HC`bn@@+8-ywkukjeXg|uKzT(LmB>VB^;O{u zi^{IWrs&2NyUJ%mqN04qqtUkNq3{R~?ByGk&HFPzAIa5kk>(~N@JT3oZwTW2=)Avu zwvafz!gzGm;xQS+p-wS@MBsDMMZYL5!25o=Of|pcNk-o)#$$%JTDH+JOeI*lzbf9u z?=~xR#4cl%o>YwVXCIt{U#k@ASA2+MVmUbR zkb(hk;<6|Tp$o}X1pu@oT7g_&p&n2N`a}T{_=wIFYop9*{4y~^94%jhKT#dXlt{YK zA0d=1@pASg`EaavdL$+f1g(kuY@vc+B!+}#_G*TWs)$A~1V;FJNZjJp22- zpl*T^C@IbD=?svt>kHo{z0jf0Ly?}nBqs-n*hjvB#X-{a8j7HOAQk;3@g(o#MIY{y zCF%SOVxi-Q#>Nt!Tsf{MSB_~0%|`x|F}g3UVYT;keW1}|A?V(R)^L&(b{IHT29l7# z>~W|yMff{e8gWS10JWkVfyP4N^#0hiX z1@Z%W$kGO{IJ$aE48XPa)w7{k5$dW5@o~boQ*z2z!0_g80dr&vpBi^tB-c1Qtx3VM z+p93eq{|U7?557@>Ckx5oa&%}F@TVt4$A*Ch*-dX9xnaH&0M*fYFO2-&97Kir()0> zVa)uNNHI@cvq@@$yu<=eM~fD?W(Ds_d@<&z?kf}4(rZ@|1vRYu1WdgT@%U*JV*<@f z%$ka>5KvwAA&G69+3-m9qZ4CeT{PoD!kMuwZqnGwTEvKbzvfSlmjY*Ja!eMp9s5mI zk5GC^LVJfd6V92Kxfkj zx(*lOx(Mu34g__=hZqS&dB6;-~OazH5J0?AalOf%iMeo;AW%*So9z3!8Fen z&Gz9KsvHdx`ol;uB`r}L0i!zM-louC+YVkl;6G6CVug%cUBG8n*e%n3iM(i_G~vQ{ z)nK}kkhuM!h=B@D{>!X)&nDhK8)E}FNVU5SqZ|bKuxhj!vf?9xX(a8QN!rdddlImn zvV4K#g_r5I|AxR=(A}SzM+}p=y$NE29V>NLp@SnYq%<+LHRg+NVQ|fUZT@-TH-|gL z#om%C?9~y{B+NQ``5X^7MrK8NoWJdg1^e+I{!44%7r0B2fs#_{r>25gT0^kAhUs`5 z11hoHSAV?2#l`CAPAQqA+A5Yhdbc_h@Lfnav8u+|^-+k^B!W*p>E`4ucfRvJ-mU2p z;cjQI95VJP2*4_gFa_g%wdQ4EhG5gbi;sJ0VM7z3w!7rG&iPg%){nB9U^*WQ`-H>` zDt!eTxf*v0ImqKB@v&?4I?ur6iOzx-5H;enixd+FpXbFy#yauCX4a+`z%I$p`oX2~ z%$Pi-G3gii#A8Ta9D`9Bl7|#J=L8F%e7ayhq3lN<(BU1OB$h~)h)lXaL#lb%k{96t zLo;JDQ;vw2!*?w*$UWkxtT%ot`$@&lW>Tb<^ksq`JmsRo_!%tMqrTTMRTNc%1k2$& z3wYd|T8mA9#RtEj3h=+~-BfGGVq{xvvi2I5-FV#{I~5Dfvqv0ZLXtfq$Lx`<+L~;g zVkbGZ-Mc9a#_7Ns?csq!L?=x`Y}IZ=JvNpD{7?J-0({7EaK}^K)k>A}%g-PJrSVBY zcDhL^mXw)mU&4wxfeQIZLf7Ux=aX|**7F$MzU3VrO7v{P?0|Cpi^yg>)kee; z%0stj^A#(OKY&6#p-)^3Pp%z6#0F-A(Tfu1of}#ojY8Sm1AqT~AU9ri@@wElTvDY{ zwnXwkeza+8m4W7Q-lQmojg9>nTV`-{OTMcIbG?uU4JEJ9?fJ!jFnJhDRorG=lDQ9G zl0MIzie;UxE1qJmGca}ulPli93iV6~84U1#HF#F0ft_H2pN-R~cU~O>g5e?g;t)#Odw82{ ziu*me%JAT7<2V~#(({WV@?CroCM2xHNvolJ-(j7v!dcCaI$=Z`h1Te_i9?}Z6B;9m zdpHJpTc#YjkJvU$I;O3~KVBVdx0|xN&$ORh)T1!dYdSV(*U@cSE>e%a(RzT5{L8juF7mcX|V>A|?+P_-AC|NLVIbEd!ZwyVu zA1Tp6G*CBUFLh?bwXkDEc^m$a$ewfu$|TJDQO5{)+?h&nGS|Wg zzAgJNQlfga-6uCx{?X6mFsJicWe~mI+y^jsb3r$IvO8`&K+gqfPaI&gKSveXx9Wxt7gLBA|%wby5bDvP*&{=7+Lrn-m^?P_k|QVxl_6x&Ihdl=SHN- zA*DSoJqWwTBjLgoexq?_HO=J}O_4_t$G+G(@tOQnqMXlm=6i)X`&2h@7qPa>jZ2 zBYD0oJ&?0xPJjJ$(;ZGw=ai(C7zc%`a2e2or#ehi@@UtBkNWZ4$%> z-}b0k0d*1kH{aYIJ54M~MHA1+cZMc#-dS%eu?!SuB^fC(!Hek?Emb&ZklUa2q>AOf z1XIt4y0Thu{6oBX9Ms(nagi3>`vum^_M71aOt6h@!J}RbCw3#0j>gov^`ktFK!Dkh z3WXnr@G5svt~r56Q9H7r&ZQ#*HWoB1RXo43kos4zdNR;F}CC_?^&l*XfSJ zAhG7~44OCDDy>wXB^gHicQmO=i7opan5pBH6UIIn&zZdFrImFS(P?w#oS%V?P_WN?st(+Z?K}RUlZRa%dbhuq2rPJ^L$UQA7?gF0ep!- zrZ(=S*{bAoR~4feH@Bz$xF2PzHNg3f6P9z=u{0#ZFFWQUB*?F58jbp7X-#60H-W=| zUbVn1cG05sy%M4hdLI{^37DLXg8l*c%kh+2v9UJTxw42QJd}X!hDJ{xixc#7WJIAkAxt<^nFe%iii9_QzABbnhCK+#LJRIWt1^qzP=;uu!hivPX;5ezA<{` z3S+PBhEUlZtLO^}vZtNPo6`tCGi1 z1LXen69uM-N%eNRyB%nYm?dL?jo4~x?h$G}FzN?$uMTl55BQ>Ah@QWRZT%7Snf!pf z?XM;&zc7^5@q(R`%->uiKMxu&QpXL|W-=XCt`SCLBaqh2XbC<XK!eGZ769qy4AptB-ftCO$I%3MSp# zl}Lerj|Eg>K6l$8hruaH)+{@UqsiZCR(3mntijD*5P>Z$wSra0w)%uKsKV$7Zdsn3 zsVs@B$62x-ayM=uaDBZ8^V)bo^M7*O)6Fkl5pa7BDV?K<8NA8Xr6B_iK6E@k<&<7J z-=oI$fvCO(8`lkJ?bc(Vy$$fY-W5=G;^nOB!t6N(g=bAH>o7DR6U1?wnf0#p<}3f-*j4ZyRHnm*BaQgvl`M|en} z__5d29`()g?IFW>3Gv35kjlyx`H7b`_xM;M!%Khp7{@-DRT0`m`)b3qyN7pVSv$4u zh?BxYx?xL<5@dd^ol2OsjsPl!-vYt5zsOgf?fC6couq3zAlP_CMKQ0fIO z<%N2{`QW=yZn5h z<~=4Z7SdClQ)m$yA{@0#;IonRic*Jw!6_lBrOBRlkqi04Yumrmb9C-(YLK@wy~*VU z!9o}#(;by~lrcB1Z?&H6v z*{seCmL?_x%Z<(&FZRB9pA46CDHYU!@eUGGBq!xo$9e@fS*8f5uf$;l>4zIAZ7<(}IS8f*&C5r=Y;Mm(-2-Gbe?j0`c#WcU;?G5X&p0f3i~o zgp>zv8Pedly$?s7y^rnR8*n-JcN@sHxE;d%a!3Resvqr#la*rEaoA-FZAR+5I#?sx zaumUe!tPf_icHKsb-Rlv@$S!m)zT!IgLY+tj{oRZ^1`7_ghE+&u#K3uiY%hGd&9+gBVPu+-cM3= z(e4P$>fsF$DP%sEO!hE9VPs7hP-bNHvWz%) zOgqI6YKNNcxy|3n{}vVaH=_yH)NHBwaBY-|BZ0! zFd#{wf*c?3W`)vm2FRS#v?CebKNH6jzd1H}m_zsF#I+UnF2IC2(YntrQLd#jM zj|gWrbJEZ{voZ5A;u}$dC~;=fd7QYFVWoKh!i@Zsm>O4muq-Bl_x6L>5AEcHE|*K9 zzO?-paZ!qNH#fYf19_Heac&0gtTI(9`|3>`mXB!M_(Dr^ssC(y$WftS=h>@D26kFA9|l<}a(%&x2BFiNXp&w(8I@z!_iX5$9ko{>qE z3-u@aC!l-6WjEqd5#Qo-vp-QAxXwt-yi+o5aAinHqXhQHIlSgaJX}6Ki1M9FMZFCC zI5<=-;^C{ynAbYS2MY5&^v0Va7x39wiD)dPsVYg4Yg%q5R4wo+`;Wl(-qgyjV)Ykk z5E>|h<>RVeHW28{-rGL->YO3U46_%(6wnH7VgPR}{_xvbZ(CH3{apuo2c9IKJ*1QQ ztsO(CqhbnR-R($3YZ`q|973uR^21YO-cGVmkI_W(r&eDkS?LH)6=vgM9GhE7dfge{Chn zrhP3}S}WdBeo6xU`&Pds#{&L=Z0ox@^iTNNU}l5n-_G;y6tv@+L*+-d%gs(*^MHzS z(?Q*lF#ryOzk_wT)G=8gB?OEFYq-#4-t0w28DE=8*rw@~iw;t@J{V)pb$8OFDcClI z`<@{c%>D2Ikd9hD+Vog~6Q_n{ItAouC?Cb&g34%^JXUqkSO~KvlfRZDOV2ha)$Te=aKtySxuv6i6mzc(`bqFjr@%{ z29qUZ*hw1=GGwdFS{oQqFOUG+!5vEh1Qd|_q8j}!E_B?tObogpRIF$~oBrrxM+J7N zj{nrWeh5?hrr{~a@km&$@SLco8&sw4PL&5v@aiiB#Bbsp>EH>6B?&8-2nOx_6ReOl zwj62hR1hzOak>({aQSQc1F7mp9$_@RL!Hg9RF*d0DRFko?9H5zHyaD9wF_Fm0q~^J zKF#D5MwG42yha404@yh}+jh-J@sN6Ei8l|DaNAb?&?jItzzJm5D9BE9cp?iG`4t<4 zd>>khO3F`vv^f+U)$^|k6%6*}SfFKr73at2Jn}akN}h18*8+7(9A$giW6qimGiLAT zzIt}Ll{J)H#}@9>cjf~UBLdD>jmPpqeb17N#e6t(vBaF{5a6L;#5GtLY71~mnQ9)TKl2^aQA*(Gh~xBX5r5D4 z7aMu~C3N#RS8c^tLVs%dr8@R`4VX9*MLg%d$2vsG0_+rjI(YIBPO+~$ zM&a~d+HWmpVhn%OoRHY!I{5Ad`EuI@s*gtT0nh$y6QFpcnxS*o(*KnB)QA_Q9<@A% zte^iz2fNb)o}M0V8w{l=?A|LGGCFp6-iCq1US8{&_OcU1A~Ffuo}xhU2#(1#Fl!=X zFAIc7yU~5rcToOyQ@Cp*%^o5FHU{ttf|4?nm)mzG9PUn(zGvSb)$AP6EEt7A&;o3Lhamnmx6DHp<5;-je&Ly!Kf zw)?TtAVolw?{+}ZZ>^Wk&t_^K9h?8g#abT4jlLIH$h4ncMn+?yoy5VUHbW$4Qlk@IO~F1gAb*ync0Z7oZ0}j*KUm< zLzKkdFXSJ(8-ZJpW{P=Qvcofd$RF{*dx4*g;ji85IcCKMa{PL$lzKfM#fPat;EAD$ z@N~Q~n<(WIkZ7gv37-3Yx`tm`GH%_Mcl)_c(l|7C(NA;p+lLfBwCsg7h=)9dC_osB zbI7T7ey(s2VU7Kkfp1_hYd~*b>@t|UqGAk71jP2QJ$!kZ0_$1%UN+_coEjKY_<`32foW>6WU2*^)slhp~=lDPX-st9Q zc%}QP%5)tFKvFy{H0bG*egU%+@2AAl8*% zxZ9ZoI~`lEL;$7hmmj1aEfD!p2r_E1oZJ+{d6teF*p&pjUhEQ?@s}Y(JY?2W|8ugs zKd>^pSqx+(TC;UfjAFgEs!=44u~F4-+clH2<+L=3xVs@2&id6tCzH=tIMLHgGI2EU zn*jJ8SO>Xd%~im5m`5Z909XkqQH5a4-IKo=Sn*l!bzS<+LTcDQfT*V}<C{OI zD}uru)t1!JpEHDZ(;CjX%4+l_hW7jIaNSsa6+pBIcH7n&ALM~YUiWcShsea!q8f(F zTy;P&lFA$@&@>}hx>}Gqn6+DPZj4McWYDB@`i^fMOKq}cm_B*Ln)~w*+NYsb{ zR}}acBRItauSsM?UK%*`My!eD7iI^C$V<-cyMWo#S;_LQMc(*_ttw>50JIp=E9M>j z=%<+2P*WC%=8N)g-SqEjgrX?HV^+%1G*)YKU~8F}6(`$QS?6_aY)WL01T9jS-lC_g zOCIqY$8k@)m?3{~;YKsXFgHz&_+G3O#u2_q&Z_==oJ)Lpb%-cJ!%nfY+16mgM$s?j zGpla2m*pp94UCS=_2@{aXoGE5y{!TWghG-5o#T}-3;azT*^WJl;tlxlr~I*qQ`Wcb zc2?}?af#h{y&Hcu<_PJurYbEU$e=|FMj-N@9|H!B(u4iq7p}3%uuW@Slxk*eJUTVX zgDXAF(=LssHwBH^R`RXS1k*6#d7^hcJ;nE>Pa%VQkJ!4|M)^|jQ=w%QzIIKuSW+;N z$X$`!*Re8FC2_h8uFR0VQaB_v*Pt4V@u#EoG{$KSKv@H2PRaj8+B*lw^7sqdvF#Jv z$;7s8^Tf%CZTrM_a$?)IZQHiB=li?&?%rE__uZ{}|C#EpnVz1mu9}*j=hM&AdwB_~ z6kV4@`F1g>A9?fSp-0g239G)=tS-So0;g!=5FNjCU{`OXBnilx6dy(EDd%rM=EQoE=l7Dki0Q z_~)7VOUr91^Lbb=A!*y<+-yckq&Eh(iSewFYLwj1$uh!j!+A&(n{JV0IKOpLs~oteF9UEoCeud$$YLETD$#Z3X1qHJieb3ynI1HkN;6$K*<#+zGkg zuRpZ9a^KBqW1=S`gy5aO7N~JLtupabT$)ox+jo!R>%UpooBSw8a_male9Uv6(Y2d& z4&#nXy3?3_tSj9j%oT1R+m=&Mm^N*+ptYd$CnyM<^vH}2m}7?Nz`I0gj-YiADy%N z#+3f32loK`?esLi)UPR1P!v%yxYlw-ozzctrIQ7{&9~|90Xp)uF;`aA;6bC4BJsJM zu2RZ*J2)q+vdq2P)YOX+C3H2P6c%>cK(_Vxj46htZoEZh8vA9H{I@tDLsYS7>arAn zXh2#jtz4PjS)U9!fF%NsX1x4dJfm>t^2knP$wqK4V2Z<9%%NU}2xprb7^pxa>JBl? z`EoCDeoffK<*R8gX;T{P@iwd8+Wc9I?t+T@>dL9E#%^gpgt`Kvse>QZED1 z@L%L>foeI`N(QE0qNXv;*IFwDinu{GYtHFR*7q=*hxgirTDS=HLTnnyin9J3cis1> z7WuKsJ@XN2*-LDx`Hb@r{bYv4+)SXX4BASipxSflD-2 zBGvBhoZ@G4_!#uFbqAy&ObiC7m+Bc#me5 z{HkUBQTAhq)VcB~#8i3wS^mW354bm%*^D9|YLevy+Du?48gCACTxZe^yJqNC`d9{!zSIu4y z#YrYk_fC;3R9qA(088IRFRUUiA?DZmIR-~D;!daI!o2u zNoN&|d7lvn$Gpg5f)B`irY!bwR!C3CkC zYmVMoDWJQ}rw08$GJB23h!1GkI#_srHX zui%izZ#0`P6>^#3KYS!tN!u zMILQ)(gVrG@F!7sQyIuS~4HqKjh!&e0V=QU3f|YX~}E zmAxM-6-{FYE>`?`_M0o~3LBmBn28z2qYLD8iq2zd=(YTJAih81*FcK++3%DOilv=k zYQzyC_Ea94DW<*BvKQIjHDZsr!fbSv%sk*~g(Ia=hyhR}snQF$3m{zxr!Ck)o%H6y z(!>XY)zHmCH~kwY3U+x_cdT;g^L%iNUD%#gMGXJhi_KAzZ$gvma)wg36$GHa61k~O zD=%c!^Lzq4ZDz_E6wY%Mjh&}BV%zT#=XPaHCoEryHwV+|CGt)a^&v2Eb>jX?vDbD1 zve?z^c)jw#8BlQ9QTLR4RHeN=vj#ZJRu6;FRA_5>Y{lK3_T{_3P8Bu-&J1&`MdivD z`u+tYzIbA>D=0i=y#X~9%G~|L-ld(xxLC5U5+uAvax$OKd5ij{lWDI*B{5o_n=a;C z{COpuAA-YNApTKIT6L$}W*>zy9QVTyE}u|LA0p%Okpz1&@zRbRiX;l)4B7+r=!0){ z@LVZT#93UbL1dm>%!IC%g_5Sphg7BM9?)gJOQ?qsgzCENeYyI+89(E!H_jxAY%b_X z=AGKPO|L%gcqV6o;U5ToYem}Rvg}TCrn(FU?sbKcIAlibH08x!y{<(3nD!ZLqkpg4 z%8t%()x}M~Iu{G~NOdeV*^}#C@1~8BNzr5WzwS0n^=k?nvXVx>XEubOo~X^`;iCt6 z5q71x#oZKvK(7pA`vHgd7!Fa3k(r>?f4Z}R+o-*oSmZHeXXKsDtLJT_8?uui^@M#m zU%=)voaX}!X>U>$d;fR@X;GaK&hkqb381*YI145?(JKgNL7Qoe-x3i6@b**DGkp^m_L#_kp8CQ zYk{;^h09ZfL>bnrE_|z!xQ!d^IHvIPZCk;@+^FGVP^10jMM$*_&O_E=o>OU?0C!Ir zGg6b|P^F3iea0ii634)|<>>dbH6JT2i6YgvNg(@-t&fnuVv$;Z&mK|ULIb`J`Ec}i zEkwAa8JyZod-3hvC#^9yT!7!i*w2aakr#Rl*ZI`3dFfJt9hlz6%quU z1|f7?$;8Szgj|-KS3PS^o@G|*J!4hI@fj$ZpFYs`23@NZPnj1iU=4)crdHgE5)8QL zp=|_vy^oRywg#T$!cOI-{Iyc0PT`gpB@j&l8)+5dt6nA=hXjcu^MD3+IwydytfM7r#Gb>0qg{N`YyiN|bdRM_r$aeY3S!43tKRwaHj~as!v4$jdooXvz zln~#{K2JoUoa|>Y#uQT-9$07Oh7n<(h=((ue_3;0yPz)S7QjJC?T97keHWpZ$UJ0w zu8GyvOl5_A8JIWA5gX*zoUx0|win<(jXvvEJih56!>wOqf69g3?E-}Gd-?!w z#V2jyQ#uEY?~`eUdu6tsJ#Rto&D6D>P{j7;q9%PUWl=Up=)@w6$)^&M!Ukm7;uj`x zrfTxoe9h=&EuT1KrU>W=P}UCvl6w?WsH43~8OqWCgBnzBaqVx)A9M;QC$!+=`dT>H zwGOzlyeXi1w8(J>+#Z>n%!xGT)s{`pqz8A-E5*AqKavGUSswF1n~3J&CQBA(S=8f>Od8_$t4aclNrd zhYR(QyQMk&+OPPWu=2(F;Ou?Z&UhjXblu|E91|4GfKt*Q&vDH2c=72WJn2?Ta@B(9 znGTUCyzSOR)s3wQLrdf@3X&UknKPRSC%)Ycu-zF9;*oAl&Ca*F~kzVwNdc` ztY6(&t!%wk=aGm;hmA)&Sg!R}d|4c+PTzkVn%XE(tnVRLFDocq_s2mM@;7od@kL@E z>e{lD@cwGXcX46s`D{_y7LM1+)OgIf&7i3*g%=a07Q48SqcE~H zD>_sFuaxV3;Yb?Q*Xa*&HlQ%l{fI8+&aGNwO9u3L> ztb|##_*ayMXcRrA8K|r^;0p)#%CcewZ@mE33k!S0shQ=RRPSUSbgV-n@vczO0iF~v zwYe~C+N4lvZuJkNo~)n*8f!9qw2J*EE2oa)Te%}MSsy+Y_T?^q^P9fm{ZXOYX>hBl z4s(2wKpvm~Py#3e zQ~;^~O@INwz{uIj1Yig-bTBZoG;y*rF?ITnWd{p0b0>fiz{u9h*5>cyKlvJCfU)i0 z7dbjw089WT_Ra=Y08@ae1;EtS*#Te%Fb9~s+nJl#{3~x`39tfK|Lxn@0&Hze0CoU7 z0|yhEf9>F3OaJ!v{~o`wvvPI>*aI8@jsPdXzdLy>tc?F<<^ebZTmb)j9p@h<&wp|B zu>GgA^&gHNMwWkcKmWGIM99Ya-z$39SvcAMpX)eokSYo5b8H}U1ya|*r>sb)ozGjI z(7+%>f+$=P)pMSxV5g!2zx~j_flp<*0?-OEfq~HpEths&)?OSq_#dMnCs1+ zcr~D zni1(Ck^pfb3o7o$To^F69PNL5BlEIDz?I2nF*LI4Baa9s>a}(I1 zB<-#KNX*qkVtCv51pj7P#*4lQhWzSu2Otscifw0yxqvG3&6Iw6}M3IXYSW3;g zeYyw#Rm)K@#{_B{`sv5q7qO#m6ztarBq$DmWB`M(7yGRH^cVEq>0Wzbr-uWB>YI5L zz<0~%euDiJXZvXj06ds~CBt(qb}x5d149iUf{<%u3i}ljZ)S_T=&@4Hyx;la_G@Zi zM@!e9#Gnh>Pw+!KEe=g8XZZXvzg7`vj<4)iK<8z}6q$B(V!bl^Y$LQ{mF|QJ&YkNn zb?ejTd3d~Ngbf;n7CdGmO2%uJbjkeHBVlM8Y(1D}!{&-dwgkK8^Hlm!gwtwGRf~87 zl&BwDXFQvaf)3OE%t)YFQ&X8ALRTS~aOI(S=!RpNDzovEFMwQ^+J$_^=W)A1Y7Eck z`^&mlz?bc$L8QD|uYo>2GnrT*q0o-hIyRZ9QQ#gNB~V!LK&X_OIXJ0lf+XDteO%A# z@m*%LXM900)-@ucN@)eJGc><)OBO1QGp%oHQ5mAW(rdpuK!nBG!oJE2e%0#t#iJY+ zW12|(pRjcgH|jMq)S zvZ$grR>E;u{pwt!6S-ezbe4`jsC3Gp^`_?meojwH@#hS-ruZ+$GOl)Gz>k%1u6%oZKt@|*1?yG~ogEXZ6JRz&kl+9mC$#*EQ2^FJ7 zgz<((b?!!&){(fnUa+H-!81RU3>}{HsfWy@8}stzjr-P(nFfXZ5mPASZK!Z?NfX#? zwir)7J=WOXCHMZ)N)Y8r+(J|sO4ESnFn7&v-gSSB=4#INB}1!gOKj^#KeA|_&-1)^?R@jk zW7?sIJ{C#@Gq0DUNE9YU%3xSx5lK6Vc+n*e9Zj~|&8jchx?$vMQ(yt{y~FMp$i3%0g35pDeMdIXyr2_|fbJ`X>hKp=L$H>7>Pnx& zwurqUE5jDbmT=PL3};&sZoH0OpRLmYA;$a{3e2WTt-Sd;ju4%Ptyik~ZelbeW>={^ zR8VkhA9sUVjOVEmI_H7}ppN?UMWY8#`zjcVDIF{Wcf(nx~0CkxgK`uELyb{`r) zn#)fXtGw#j1Kbi;J=Tzd2x1=W`jTr}J~W;i_beU*)r~K2|5Diu-D(XVesx}AuFtB6 zGCs5TqxrZ)q?`rKF5o6pHT47-yw>|7@76~r`RrB+MuI)}Uuh=ZM8-Eo*ph8tr8end zm(Y~VQ!hpdEso+WepB0jc*yf~W4PR>vr~H%NVs;@#`gBi3SVfzpa8xMvPxClpo%(E@@8Eb1zXAy%yekX@OU9pUOJ851X^2G*{=*Z8nOl2=+X8UW6>X4ot{ciJ?1(3 z%XEb>+ix0{Z4In^ShM>INoI~+B<$njVeW2cVbmdo$1U-{i@p{j9#0#~dl)zHtm7pZ zK~@Y;3F@%i^!B>ta=WdbQ93WY=v0@C(;DZQYYyvsNO$E<y>qUy{uGf8kKyBkx$7T|*UhK0lBaVhnU-|-Kb?xUA52%dZV2m2 zQa@w3jAe3IzVkiJ+&4F)bfFI+6KVXHIHFp$wD(A`4^4*?! zF(UIgEHU~2(HN+RnqF1|crNEQI`}MUjbz<}KMN9Fe=x1|@z?uam}n|~(SbN{XUzuT zc>4SmZ0+bOXX1EF-3NpZjYd!>Djq6Og(qyhi#bYJIaEPKgq5(TT(z0fVN@fiVivff z1!mN_Y-S|C+bzQ(wkDfWSOsIQNcyM3EVD!6#{n2oh9q4K1o4r>(wZSvpDp0|Tojf> zG2Z#f5vAny?hLv-C*Bzf8^TUyL!@9iPB-sGD_FApKizxVV8zP37lhE38o5XT9*X*< z?#trO<{7H8EU7ggekV}PB{M~$B^v%*hpIvlwlglE%WCbX7srimjbmD=8ZF7poj*i- z%GBdFb0=I`mjtHH-brSUxcnTd@YA~{hE9yufO?aPmInPSF8Rhs{ycFUYRiB=ze;vh zfvO_#YVV)YMs+o2QNdLWFYFDnb?O%Dnk%o2nfq=A2RO4wmv5tK8(@XL5)C^`VdX#U zyQSv{5UP$IP91JybzMm_vdE~P32hja2D^E+8>(`{3&uXm_9efV z9|@(hB*4)y^zWnBetg{xyPuk;mphe=sA9#1`u30ALAMu*)6f8k`90EURh&9q7*;;&fHldd1FFM6yZrh1M@?;CUHT)+)$^~rC_o$$5<)?} zoYzRl%m?Y2*nK;9Y~p7MFQG$-*uDFEfIF40Bmk;#7tw3}Qw7NLNKdC*^{rEB2?mpmdi(wU z7<%$6mPu?^)7ZzuB3jFsYGlhRf}E>0YGE4NiZOZ8xVaehwIEMTKIMw^0Wa9G;gPn` zd({CJhi&&UQlD#oAB~&CN2l0{=^&nm>oh&&PQp*VOg!W4fn%7zruNF1Qy#F$4*G1E zTrYU9YLkGCUqPZHi6MQ1cij^xMR;b5&Bg$R*bt}-m@>7wdBnyTAn7`V5b$%n+f3Nb#ERlLI;e9c+75VlA-r!Rtg~1TuLz@`lgwt2yCRFI8 zc!V-E_8$S_Yz}_uS;PKa&F7aAA_6HUW#aVAyt2;(G)GrfhXj-=OB=e^9yeZl#z8^u zmy2f$pBNi%MX7U%qa?XzZ&NJSHurhYis_e%XH=4X1`^$OdDM?X%> zFnW+To(A1f%_z5e$+}x!C;@&@8%t!{#pAiVak?*Gr4^jx+A%UC#|E$VSm?E@@=F%V zWRF?p!+X~orDn>u((n4{CmyJr#yeL@sxFVPiHNvHc}^MQTLXPTISEazH0CP zQ{TfC8upB%_8aEd)(TU5zm2>*gObQA)rCrWaSmi7!yV9H;;{6ZOQQDKS>l_*MpsE+ ze`p58KG26?2p?$Wyz5gaHCJ8pKgWt#5^Ey(f*rO`CI3iaAKGbdlWfUh%(ARguC;Q0=R z47jV*m0&!wH-B+@_WjKK`lIbEg}Z+B_c~cq3(+fQV+ZeQ8U?YkKp+~3>U1?*D3c*( zUY4e0j<%|W#fzhNVo1a<28@-Z~+9Ea?$ zO`(PD{Bkt~r2JHpMuQ9fuM)-|cZ9Y3$?@2F5PNG)vs!$Z+HzQ}q?8Pkmo7vku-IyQ zC3{?9#v3XJ5WDUe59!}3X)Unmq&eVO4_A+M!Nb*i2IuY6+HMl8Bqb-m>}Z4N?(QjYbGdytu61>C z;)K+|B8tL`b+c<;NzkRD^$s;RXujAa!uE=N?g?3>M8wTaj$QQtOK^L~UsX=c=AO7& z@-}!NmGfA*ThFWG25vx9|fmcut#5uM82Q=~WC4dreE`a2Dkrna4o6(krE~s>AJ< z6veUo?{og7&A-1v#;U0AnL1qU1Q;QX4R7-_WGw}^8&7j>>Q!-?hH5tTtV&R}!WmV2 z&Kj7%*t#BM)WrInSLoi~Pi#%lb2(+FrZOI%t)6;AUN}g1TcnAWl5&l4+WM}h$Pmn+ zY-Jf|_L1f~kCbyBJG1YRDoyHpK(f+QV>i4U43nlxC)FjHwWwg22#yjd=Q7uiaFm)! z(9`B`_NgaE6TlyqSqlz+YeY&L0fV^e5tbs<(92jgWs4S!%A^f{w>Tz{&wWtyEzqby zlAQyT2`1}*9F+tue$FJ9z%I&H?<{J-?OS!80j4|n+D*KDS`}CZ{@{hQ5-3*WOc8|$ z#r@QCD+iabXx-4~%8)XS_t>4BY+EONv>v2nE?+LTJUDoZnCmBR#h(mI39u-u$Rh`V z7g)8%op9VjrwdGzAf!9Lk(o@K@L4fCxH>ZkA`qH4_3lbHS$Nh`x$YFW$?sEG_>u^N zT9phx9g0c(Qa8TpcG{{aI|psCDbzp-BV%aC>)CnlsdORxbTckRshhGe*6b6T z-JL@&vM|V}^-OZN27Zjl+)n13w1%5QFBFqB)GWkH64(iI+=z+@f{89D`Mdi~on)OP z_P3Zpl|v*JRNIXQNm4esbB%lb_5zwAemSgb{RMt0t`wyPR*9u@DM;_jUBwR2U%zic zx(5tBYl|2KI-cuCcS>JE|B1b9EUUm}#=XAo{UQommLw2X|4H2SS}m6$E>r|G9?61QJ?7hHcKxwwuD&cDVQn`V8W~pk9iLS zp}~fwj|)nd@@V>NSi?&5FDIWwCUFH84r5Wye7tL|pfqFql)7+FU?Sopxz;C=Pkc|P zDvxwl2>r@!w;9el{8LwrB0b8=GSQ}1^m;qbinQdzVR$nCSla^&u`!%btu z3VT`XDNOj3ex@XCnyxki0(Q=xGP3=Zst1v!hh}2$_Y3lU6~9|rt@1xDqsVIOG0OV7 z_#d%AY+U7Vc9QOOV;@*95Yw;+?d3#>W=UdC{cQWUk6k`n&E4FQ>bq&ls4Gosr9@Jd zf29NYL1ZWEH!Fc4&88+RCwS}3f!8w1QftR#W~J6DKAc@I1a0F#@>SN=?rj~Bc#Wer zlq6H|A`pHh)eV!MQarp)`3!cb*jhP5W%t)|B82`NsxLFim}w=eTHFzN8_xOT^vDM;AqIywpr2i9)XtBCorim1WFh}d77rxUg=hP!aZC9Hw2n=|e54*Y22M3tG ztJto?HO_aOn!m@F*g6>=hghZkf{!Nt(zwL#=ky{089^$s4^ z+##>wtP}_F^Y7*yVez6aKOXQ_G9@;bUl&}SG$G)ht>}GsU^@?K#;6#5;uRr3c%3m0#zZ>L7e_N84`8@cBllh z)cw8pGIDu7DNUWktJ5VLR(ivd7Ky+bkeLy{FN4Zs{+6rakUnLs=vF4{B0=f$Wz9t+ z8RM@xoB-9C0Z=Y|c7Fira)t6+pW5j8!HR*qY)JzPi+V5$>B;nN=*moM?vMef+RDDT zr3&i_WnEI)X9kBos1o0ITn@LwjRl!(`}>V&s&9yrU!rcakiQ_}=hKTMCJxw@L7eg(h`DSlKo-%jj%L^Lb=->zIdn#l8aDgR}SJx3ZGu+SW2EkAX~f z(nMXI)pNp)5N~MLE_E00t+$uc*(%~tPlZoe;SRwWFMcwm$WUnFB5&<(`c>lsabRCB z=4M2+!fFzTbmtsQ5k=hXsT`hMSv~Jh24EaZ*{Q5Qs1EAnvY-S!qHn$?r10onmSAf{oO^W8KQA&KX)Xb?D)+2a z<+KNP*6Fg@?S&506%#=!GVhI`By8dxmy?(kLuW9f!5eBbrkMHjqkiAB^5;MLPt_Vq)ej7 z6bS)1aoI2gNp+c6kDcdVE(1}0XQpXGEuz_cT1yNbCN-+8 zdoX292R)81QD>g-1H$DK_Jg@&>=`1~fbEi*4Afh+$i>H5f%08>g2pi$Zrz>-;=2tOt)at@u{v|9 z{3|BSyO2}}nUF_`8V8&sG;iFo&<7`C!r|LGxyhV|q3+`^fG|Zv-Z_puPWi%y>nx53 zlrn?H$b`9bPs`Y^@A){VI^3+6pj&^6wam_y!KT)XwT(Y2-cfHoYkiJ6*b0aYjs@Lp z&d#TDgQk8iE9JOVDp8n=F?4s3;l!oQHiWy#v*J*1Ssx=?WOx>iEF0u(+Q<6@Ce9IG zYruLGQ!Kq!K!n-8PcDBtoz9X(^o){3hGht!``w1IXgvb3`JWp>HA_3gRAQs~@Ie-> zIv0#K@{MV(Q&pP#FOEc06z{ju$A*Z7ig46**2kPiJtizFRk+IMrUv$S-7az1GuR{; z*r&4>YQix|OHVIRFc(llBF6ACCVW?N8}t}oWGrGqV||hY-PN+%N`sp#V@rk};sknP z$gaYM;wOFvhX_^Ji0}NcP_xJ|TGn7^~gXO1jy@q4u2qeRR;e2Z)iLFf8w|Q zH`=bGDlRUh{+G5ZYyO`qGEAI=bewDqgp7=gY=rFWthz7&K}RDK8>fHZI}AYBz)r&C zAHq$@#_|7Ik)dP!i}976Osv%iS^jRP@$Xyx3oHwp8#pMNI1y6*i#q?(aeG(Tnq=dsXGTR1>X-OJORY)L`6tNNk|AHCB=?12R}DA7oa5N+I7AyP*1Le*I#O#Q4KlKi|o97oI~aZ+Xs)77>l(3o`9fW7wpkP z_>)5bC(rrFqKoJq2@kGu>nqR}Ln28J z(C;7*H^EDwZYofxo~oJd(%b!d&`4Z^k#3L>D9=Rp6;PNK$Ce&K1&%xVK~x*aN1zR7 zNUUGxz)qWgZn}H4e1Ttpda&EZK+(XFkdcs(Aj3ibTmh9J4j{j@`^Qz|Jjg5DG`~j+|LMl*ga7F( z4vGy`AG-Cq`%coUrvNn8kBWWro#X%AbOR0!?7{#A^ApzDulM#__j3xq@q4_h-4`(x zaVNYd>jMlJq}%sfOLL2A0s+|d_LKc%8Xa^|1?>?Z=k`nXRbNn4GzhWhJ2w_;he$#M zh>#Kr1tM&d4&=K%8XxQFneU549n>b~FSc&nY-i7#ZrNbM@a>xa$ z@`c?L5)c7$ct-y4O@7b$JA{z*U3KS+{`P$(u{b|?D4%%_==r8Va0zaG`HE^$uA(@z zfoVW?tq1znFQIy*dk?W-s#x*_I6i+1QnvMFbCi1rPeZ>yIsCASlVghXc3& zkY@FLjq;t&fQ3U?6ecw2)=zDx1@`|A--Q1$@Op(VxFvZn59Prw{Jp6Tjv%=5iO&`r zMhSGW3;Z?9k!WU0$9 zBKh{AKuKXLmTSEyKJj|@X|2#}omKxM$*+D7tb^YI5f#wSLcucUpvXK{CZj zsHx?-5e`vH7U-f)r(n)=+y@6cYtH-E^XP*tt3~u%-MrGUF7DJ?&PNbde=Q>i%if+) z5SGCt%;}`b?X5(!u zr?5GTwMdYm)nzUfb9#OIU|iN<-u*gJ1njX|DHHRGDEtzFiosu491G>o^hPelKdI@u z4Og{?l-;h4#$P9;eiy5@?kGQ4#Vcm##6p=Vird#>w?e5EfH$*%NjX;&n zaWt1Eh-CR?rIC7k$J=MH4v?ns2{;*>Dae8(i>5KTL0j#Cu{~_c1KH%OUd=qYtmzsP z7l9#qw#h&mRxA>?7u|5@ZK(!8cQ$Bj^rVJhjv~U|S=8YzS(1P#LPpWteKp`p2In8` z5C33O#D2*Ic3hRHV@&;gaqg%76bL%B)@WoABaPZtJ(ORu)~b^p%C;E0bcEO+6MTO$ z57_I8qkYz(f!cO_jVJvcIRl=J{F`6O}eyh7C(F> zSU*3MIQOEhZfEG9Me|_N)0I=<_zmT=D(R4<<`uP<1g+>o69Rfx1r`4SxEaPwRhZ~x zXFl-GHD;8+{mvY&t~tMAlr@_2{Bsn<_M6d(Pg zs4&Ov)o&Pz#NUute@77~XeE}#-h;$WK3A$h$Q#xTP!iq(gHxiUjpI4|z8iZ_Ffq9rp9 zXNjGz$Jmn_8a|KXYBDEi5ESfTMMa93&EK>-zFuyF3iHsGzkm^!RihpM1?xBgYy9kX zr%wunSZn~tu_nRAGvn%((T*@AcuGt0ELp=+bCgSSe^LL4!CJWeeROUa2TmC~BRZ~1 z^!RMzo|Id?;|;b!@D4Oyu%99I`oIQRsivYL!X!6!Lsbe%Q*wm`|H+B3iF=)USe<+| zt*1h^s|rYNGHYA2l`*D;jtVaw41@?>Rx_jma)dPNL#EY`7hNjELMYY3DabTcBM9EQ z$)02(WJ)z!inwd_Mt!L)7_}d6+S-=W;5=zbmAJAEE=8Ttw>wnQVTj_az3t|Tp-@lH zze@RZFg>mnTQbc)Tqb((kVu>Q9UOk{kUPSjt58+qbp@gsi4m=WkS~}7&HQ_2-+V47 zOID{<_^$3=_HJvz8j}9W<#ZC>+-?i2gk#G0Y_P+)z}D+Gf|<+uD0C2OQI|N}BpfI@=$NA>Dxd~BhlLNzEyBu3$QX4m*Sk$c3{S@0|P8QrBXt6|1u+X}$}Plo~?LMpIRIw%wx7@~RKqi4JXwcj5cdq1MX zqxI{kU~Pf&M0;*jQK1cr9iO@lai7JZJrKG>}VO=P+ZKmh_kr_MlOa(4|Z;^SI4eyJ&A_}n)p~$AZy8*?x6(2ipGu>YmFsHjTLsci6SY8f}TJq6KLS`3w25{L@d#@N# zPTw78mN-+I1~!M0<+be6$Br&nu-k;#^~SOv&z)rl@zkRrs#D)ET3}~Wqvb+zE*xJ|P*%I(?mX(eX)gjRk7~i;WvZ#ZUu{m_FK;vM+M*f1oYARof}v zPeL_&p~ujbQfHP=A#;pZ(<^X<;K3CSdEqP0L=g!N$Eg#kY~_s<_fEMbV`!-j^i@zwj6U9pHIE`$ETS5%3(^X37_brx|RHonSHX z%8J&Jqg&6fUn*3k{C89Xqo}N}W06B3$NJtpsc=#+9yg{8F{jDULpCxL7ilED5Gs`5 zuQ?}sN5eo+)1wg!7Vn|mjMb?lfD6DcS7QQ}1$oWdQpPO`4bi60j-h?-Ujl;Bv&Vn` z7Dx;UkyZYnCKrT!OiBbCpAwrj+a_6nhA=6>JTT{4K%wy?M6b56t*!VMCP%MPtMY>cqHzK0hz5 z%8J^Ci%6{4E7#uQJxF8&tueT*`?m<>u>C{z?&Kbs`kTj>v?T9#-HS!HvbglmYWqP{ zk1r<*>~Qw@#jo9lAHG)bOuxaF=>42bA#6eGT~D5^t$zfvx>L>130y@CK0O(~5!o9Q zT(W6AYuxPOplOlLL;ZB(D0aQz0=5Z9kD+pZvb0kb)blV#%X9f=@(A|lIAskVM+i%9 z4*`|(5&SX6t$hE{Ft|%jK^MRC#%5I>+&Y#Uaza(?U7YFJ=xT)ai%XaJ{q}(D>>(A@ z5{@K6J{|os{XOFqhp(Icc+-b5zp_??gP$+49+rvXFz?ZHNlhg*qprn0S_fFK9p4|G z2Mjh@jkl_bdgL&PxCN?$=`2j4k)|0!4TPZ2D1=4v+4Yk`TM`$o9H2>_awqSabUB@x zl41;EhywFie9Nd#R{ez9s&$(!;tGLY5;sWPiIo+g%um6Ed5+96Qw{QLUS?8LEP)`e zr>Tvd&uF^TMDc3PNQQ!ac~_f;7A+ae34b}ktM}&iaF?98%a*Ehpgpdn%SUbHAh7LS zbFpl7hRJF+ax*#>?P~*}C(zYf>=e}*p&10Vw*hHt`0p^u~0ht|Bc2Di5# zzzE;z(WJK*Rn%8eN!~Tvu_;>9(4CaJRr4Zo!)P4tv1*ii{ff%cI~* zB0JT9BoY0dF`tP zid>{qo4uJ^3dzpe3o1Z(RxbOXI9Ro(4P0>8XLFikSTn5bK!of?(O* zDpF0uC4M;>_9T`?t!fh;9)lit`N)x2Te$bv#@4LVnVRw1d#>$4XtwS}_0Js#`dy2e z|0z!IiJ>{KOs~Wcsgs7QwW30;|D2s??xt>pa}E>XQZd13&G$&vEFPTA1^#3f4o5{u zl3ZEhGEsiRdOR4uk9X1p|M9AE8t#ZO1fyPQui-Lxx3rLBi81zcqb}1|(7=otD*B>7*W77Pb%~Ru1^TKKwq{y-I{-ho1$uYVO7*=7fE{_aD$crkd&#sgiQ zO$xx_C*gVtII^QhCF-Q;)`6cxxvKp&Xq7e*YNRpv8=wruYr9V4bANdd*kGGA-L&~k zliwCbOP^y|04XqB>N9Ucb`|Le9Kef*#3*U_WYb3FYz|wt&W9JjK}=HI);5vJMiOFc zmk?@--r!{)SU>Lsy|}!Lvc5%@W6h%g)-suEq8WV@H$WlNm|5!j)d8pWbNfRR5a~e# z_diPe3a}`*=q;qCq7>4c+=@O7;K)PE%Q97jr5fMZX5JXBE>5}eFrIF5m z;C+3M;yK^>zU$}Wx^S=A&))aC*V-}e^{h>6lgO=(q5E!2{8Vw>WtP0>&PK>2ujoTb zP-uEff)PBrp<4_>Wpt33`!Y%<1npfQVfaw;$0FjfNt(TBwu{QZx`c)HNhpeRg|dCx!XpG~78*2}oBRUoYg_DtALpd>!;+tl#TkZJ>g61)EoBP!FbOTUX^L2p7(Vy#0JZdoXaI z8sbL>^?gCj&xjtOH1@u%Ek+$fC9!C3ikZXl7`NXR@*L$9V_&D-O#f5?RA*P<9D4(H zdTS!hQQ#(9G1;`Ls!Q2e`#a+wY}Gwsj=K64(X0`%sFTYL=nYMo_LWhX`^wHLx%NY* zLTZf7&q0~=jowYWG62wBf=S$RDSli8~f zAO0X?P1kCmiPG2NwVy$TBA0Q-^L)(Y?cfU=wy$x5U*$=Dxb+sDZ0{OA7h`V9JT-j8 z-t$-wKj3?Z?wF=O3xje_7}}RkV$tSAVM5vzq37+}9QsX=MLcD1u7qh(+dVf~+BLVJ7^xGjf%Ip6)BP8lQ4nG^#a?P(olkPlD zZq9vd@MwL~0xhX36PaSa)c9OCvhgviZVYV#U53hx4;*1LEjseSK;-6mq70mUL9O5ow^*zlvHPR5H@Eu*d$Yf?K|ZA?;WO22FzA6 zn;V(3*0Ci}(xh*eJ(@q6!+c$6WFtJ}<`cb^>y*1>v2REB!wk}|mm6c(6&FD9ta!1A3f%PaPF?95{k!aW;&SE2 z))yCUv{gUA{|-X^6572k#oh1I*;W=6ugw3rg|~Eig3NAnk5B6923GR975A$ecNTA# z%viaHClfErrvt~Qv$r#2gc!UI#JAeGITO7%9bVQ_hKN65RogJ6XY=bZKXJsMG>JVU z{v;gFO&AwEJ5ZN$FdIhGhNbzjHF{lE<(3HCB{FZ zYQ4$LGA=GhQfey;sHKUizL`@jO?W$9p$_LgOAJq49Rqb-9Ju4LS#MHgY=5P_$u?E+ z3qgNWg(GIBE&O;MxV8&=k6>SK+>!`>eGsrpWU-L=+r2Sx;&8`)tIykQ4ugv|1?p#n z-p5k|j)_)$t}Q`dVs7D;mWEl-npT`HKK80gM&5hcewqsF-CKUDnMz{b>tm+EUu>=U z@$yA;Jzq#FB^K+!B1H1F z+ubSn0p=GtTkcfS1pfnZ-jnsfd+$*>h`jpn8hSg(TV$twIowvxRGXZ6r9?PEX-1`#=vTF;yXG8XKvo z*~UB0dp>)Jd8fzWmB6O(3(_xjWyVw^mXU?^3mplsfr(^S@dE4eOD6vsCUDFQ(NSTGBNHF|*cS-CrS0+e_LD_39IM zU-T{}+M2gD?6{rQ=5r%<eUoVPe+5}{5maH3-p`n!g?f&B3`0{ z=fBu~%_t|s7NaXE+G7F_bhep4c3?8x2AQ6fWx0{?b&I2ZWa4knU?YlB2Zr@Cx9AiO zVRVvY-5i9A-*vgk;~DufiT45VC>^PLp@g)nZD|sImuf>H-NYEVUP)0_TEEaFg%+D2 zqha4(;^}vH&M~|jEwzdn1VHX?MGr^H&rK0eWsS5aM+s6O#ADU@dMBwTE&(K(K}O7s z2E3IjMZFtUE2|3?PNyU<-l#b1DL;N7%=uk%G}mvQxaXwloQdQ|UgP{g@y7G7nb4yi zYnLgV!m8&{#3?O;_S#-CB^^7`Cgq=e(rg^%%yF7X>U78Ww$ucuZf&+4BpFmRYh?Aa zkI+8NWGK&>$`(r(nV`;yDCRh3B}jqN9Ry^SMpse*R#1)HcswlI~={4!v&O1 zpT$tv3U0F@g6SdNAR3Tt5>EiTNw%E2a?skt(h7AHlOD7ge(a~mYua;O&L$w|0y#UR zj`>g&Gz4E*NQ}6vTMA_`n7n=Z1DySOZnJvS$47oGF7ONl7KMpZ(at{RZE;PE{-J`L zyVGzVrP)GdS4S-_O0x3Zv{l&bS}gVxh~j|H%LhJ#bYugmgZ7VXyD;yPQf?|p7vgBu zCy6k$lMLv1F|CwZOpN{@=-o}@W4K{6=|4l-zOlz7kn&-sQ-(~$^I5oc`LxLMdaEIz z@2*@;-b`Ry+IK$lxK>KP6LJ0iQG1Nr+vVE&fivf-b=@be=Xl)q%=pQ!O(gLJe$G&} z9+iMVy@4I?NkvNj_;wrR*N?`enNV7m0MZJQgcw zk{U^Vh&s)6J6zBODa-_>MZc+87MCMuu#XH{CO%|KPAp2(Fs7j|Ac%vA;GjNv@aPC< zLi;4incEXPkQ^+r#FfS8+Cdh>R-=DI7x_c>WO&DLm1Kxv$3FJjK_EJgL%&e!_e6h1 zbX-zw!;(FRFY~R)9Z|2e={U!+?AN-=%-^kZeO?`br<1=v+E_&8 z`tdXKdOzJb%~wwgmQ+)=C|@U~iVxSfFHa^VTQ=^zO|S}bT3IJtZ4uKCJ>;EdV`$HE zh7`e@vG>I&%hZ)hZ-vKcyy^VmrXBO1dT;$;1Ny#n88+PYhRoQ#Mk6bXgPeOuaMN*_ zF%vtgH@t;=$+Xi|rDwcmkAy*P`!xHwkKuw}B0!-(&07+ZAo z%f+X7nkI^6+V3Pb3g=G;r;sD!YW0$4kMeuFR=eJmn>2_ra^#4%qKP(^_dQH7dE0Jj zVFxz(BAcWzW`idy&Y7YLp^gG!C&8*CnX+ zo%eB1BlGLNi03nH=ISL0Efdx54)oo(UBMQnxv1+MTjD4@uN#bU%%*1&^G0Sl4KH~R z%JU+7bLRr76-@!_-$abSehHlTZxJIhQsVdYG!PLZ8gl0)J8WpEwad-haYDzyJs@2=+5L zZk0Fd#R4*h%uZ=`vJ6Mho|;~j{XEF7m)m9CFgRt_pF z>n=y}s^l>`s{vhxEP7xaROn^q^6AC!p6_sh&G^~ES=HuQmEfJ@;D&ZL9sS4rBocVR z&mNg04cbUcRabF$?Ger08^gxk&x|rd?rkF>(w&|f;YzT_&LB6^ zBE3eA2)qmQFbSn>#tpdfY!X?5!$7p>X221f&Osp(?ac5j5*~i5$fBS51@q&EQ^nx= zSshDKvSzF&MYp1vc@U`$hKXrC2p%JmHE+lOup?Rsei&~6i6|@-un*;^&~n(Oksf@( z@b7y1bp9SEY85*5lXKAB6&dn5kWtgfJCn3Dd@_`m-*1UPh;WgaUVbKB8D8W!{y%m#_mJrmKG@<XYQLu!RVL9H6_o))du+AR=PmDE z2kxO(J)wQ{fms6^kCgZZ{hKD_bbsyMrx|`lNEh7$4S=FYyGCXqZ+D@_2S%7P7oVt6 z>S}EaS_oXjkPiJjCQ#UMg9&Q^7nVgAiboglQ<>)%noAevZ#IIZFLr-i5N}-^8h107 z3>Tumwwpx%LRB8jV283)o5A?3mgIn<0e5lf)TodIS$g88dAQJVdXVJopz2F>0be5I zjV*Ob|Kte&HFAn4Vk@TGIW$~Y0Bq!-i}|~pq!S^BUNa%Fr{Bc!+?S`R3QcBoKGP^L zvT`EVIq)Ts5+~)*t2#Q?QHoDU3p`#{!M_2($4(GcM1IzPge1!z`Mu@2yetynIZbxD ztQs~F{37U09g^$?G?0LJ|8{Hws_2JlSxltSbLl=L^z+*UOvf`iJdSm>93o4oqi4vp zNa)+Qh;E9uiU5iV&uF4$duM5w8I>gsIdPwf*yuqXMoIq43x)2Cx#f}P|r8-9k z3;|As<>)8_Z|&cPf*RLv%ceG+L5UcO_l^zHR;nWE&YqufVbo7L@XZMvJ9mT}A5&iV zl;ESQpr(Fbr)0m++gik*V_vA1JSgGeD5?>@)MRnU`=qU5Fl>Xy4mGFUcRX-OI-E_! zvzlnzHrP+IWUIWsZC7xl&H7kb{&D9~*(VM&*>TSdfuP-;lROUtXfH$BzMC^8b949k z>9TYXXOwLgegKwuff0#Jzle3~HgCda0?bFaOS_g)T!|l#+%ZL09#dY4VjwqlO0PgI zOK_)BDU7oA9nS~qmhAIweR<2moWqGQ_adE@@RYzr$@HizQ>>=6L#6muHZo*s8Bb+|Ngw!Uf@z*tXl7pag*)cAV?cP z>_opPjLv1#MU%Px#gfD8JtENYDTk9qgLWg@X6{Jhfq$3w0=SXQ+{W`ossF4gjR&`d zU@I5WUce#uGl6`{@CL4@8BR1lqvyLHV%gWu*Otx?)6VXYW?|b#q#PenS8~h=lvaFf z+k0cld-5REf5bVmbBLWh{L}|F=5jFG7;-1N;=!U`06f2`wd_HK^X$vc?>7>MJk|-o zQ>f*+vwSz>_5>F;^*f$ulL5u~yRGaz1YfAi$=1|QmP1%P9!*kY^fFtNAJ9V@CD`}R z5>?Y+Ofiro1RaD1CiU-m(GdS^@XDolkX5~Lz>^W zv0HQ-*S{*TA1{`r5DSx6*3UAl$x@NCj|?Vat%$F11spS>-z?9c0hn1wBd&l4d5lOj zvV1e=C;w6C1COGK_=;QqmYhYT#9;h>uE2z!3t<^|(TenTuoP6`IHC5%Z5tL52797{ zdKKuH|K}lteFxsc-dk=>H1o6eX0lQ{4l8j;%s;A^+^352K7A*R5*NuG9|fCXFo^gV z(XM_wrh{7=2^>tgvOa2Wgy+M~Lq9a5SXSRrKPm%O(|;`^Oyxme5PwllT3;p1r1=mi;~7njQA1Ol?R#9%Nf@_$tl5j?Y2JEXhMB|ZjuoD z<)a*D)tCti6|j5zi6vMG;@B@{DWJLy|AK+Ya{r^H{v7Sc$!=mlqYC8x<2a3F5sn(S zom6%!pXc>6c?Pa0D9>0k7+r1r9P1>$P`2qI>Y!n@gZbAiaDSvlx-wM#v=H1NMoNTuE;Qi!t zys&JPXz*?@r?~F8n9v%C@#qD6nC_Cs!~!{t3h(IIE`KgLc_b1+W7R~nI7wK38*Yh; z->UA>B9Lj4jnhzmr%Vj?euE1mQ+ctZ^u|YrH~e&duB{CH%%30Z);G>E$4yC&n&!k; z|1hpi?Fret%_4IjlM_cfGu;d`b+vZQ?k?|yN{ z;H#%tcH5>{_nhu-c4hK9ETFM`rk{_^bcrlb!ewH5r%M)6;*yV*uMHTVkl+Xgs#{{o zMaXNRzw~>D4$IIc%WR{ka~{y8m?O_UxZls>_FkN)plpW_zPu$9T!!oZ*(>V<_J)yE ztP}zNQ^SR}3GDgG`%-C9b7YD{pQY@ClVV zqfOEfb`e-jGBJM}E9D42icYN$6 z#47ezDGnu`c2<0vtqCOyF`@Y4QhCu$elXOeNpgm%q!9ZLcV79#^EJHtkrtc%XyRC$U20}tcb)9375|NQ5716cgGIA4EU4AE)&8 z^=<|E4vYoq^2U#m`RMVX)xIFz`O09d2BUgj^);J$@`XuApr<&?o5l1r~1fW*;YjB z>m=8+Xxzl#5y{ej(AZBn&4!8gjwYR&gLh*G2FjiJPScd5r=?P$EA=8&sgp|`o5PyN z=?X~?F}JedquzN!KHK1i;fs%38(!*WdQ z10jTJWrnW$vcgjyg}dkP@&`-3$u1se-8M07qBJQeQJ-IGB8`zFSHEc@^eMDsbLIV$ z3eERKngBP9g$Z71>JuSXnAe^1fYY2#Zk#)gQ!;}*p9x}a$oxp@@%3PR9a_l8+0!ib zNwQ#rxud-FYut?1f|CJ3iDBi7#eBmCa7$;|E9T;nAsNc%2zRpx}QOvTr~Hrjn(eN4y39o=)5+mbP*1{e~iIewkJK?;!Ur%Y@}2Ed3vzc z?JXXo$KLlW%bNm9(n}5;y3Ld}VKI)T{A=z*)Q0zrXJcM{bOy_ymtQ9Nc_@KNvDE;VPWi+HTUueMoWWE?q%K zLLCt~6JI%iKHo7fo9>C#&XQ?8`DF9vi&eD9_>)OWJ(+}p7X16j9nHP&+(a~1sjtmx zoa}=Y`6j+#8K%p5h5I`vN_x~EO(?{Ow|`=Z3w%~Dj5f;IwnnlrfhJHOF&vR;C+m^i z#fTA;I+u@h*W-=K$0N1$v^7ehRD0jWv7jym0%$}1v`QyTPyxBy>CjFj_x)e_i6G;BWbGtBg%1_mS_hIq0@E#%OE=j+tk1UDRS12L7`Ef@$hc4B2fA)#k`qDGx z<<^?RP4Bzi+Xj^Vz7+1SP>jO>Maa^Xqyts{5BIZOd@-y2vylQn28^kzKP z6vY_sIBdJ^thPp;a=DZ1g=}XFv$t9Om9(DU;;w1XJ`MReXPttDGOnHL9}OdA7XWZg?5~~E-#ERBjn@P{8+Z$ z0J4`w?UkP^%58QNwIB%I4E@vg{eqgvqI(svC z(`_mtb+#>!Rk>KA^qn|a8#k;Q$#PU3>VKGqvvCs>)>dYSSq02O2|$rcOXQ-BD=Ngb zOFT|?+Vr%5n9ICAt+Jnva#z!0wbl_NgKPRvRyyu0bOrXUYZNaa68*@}k(YVOPaFKG z+zQ_<(KSswp+01BjzV+$Ts&w^8C^VLmm3Z3{3PXtzRKi61$pvEyp$Q+7RPsZa!wXF3@R_Skz z`zq`dbe3yBjO@>K(+X^mdVhF2(=`zLzgQf zeSFDVa$279Ge6Ck{5RW83kkTKc*P6PiBq!Hw=tWFJ0E---OL`;zY61w37_9vCmy1H zh$a^zn!+m56eY})ioWqmv-y)~5DvlI?NH7S(X25;MUL9f?sIvbGE|FN()I*kG1A#{07! za_Mf0L5hcYMfTHB+tOQvs0KdpWxaChZ(mqkif9xX$2RyD1Qhyvuxyj`hDh(<4{;VY zWviy7vGtFXFbhw0bXk>NTjf`%AUt>y_HfPe<+O>5Uu?fdHEO2Z?Mg~{Lk09Qqw1k) z)yd85FWPGFNn6vM*T%Ub7>txXRaM?%It8Xz!z^)z-?HXziEzl$X*Qfi^U!)ZgrTy6 zVr%onpKJHuUJ~?ty6vi&AwG^P#Jlt+BBy6cudqssaZ_jO5$wk)G6qs&O2)IAVJ{af z^IL+?NSKX;Ir0f-^5Q@F?2eWgveC;Fe;QQ_*ZOj}>LFw}Yis)aL5;SK)S~V_DQiNB z@jASxJ3SYZsuo-<6m2j;mpE%KtRTI>=PZINLdPlD}UHYiUm#`1(4Cdo^mG@Tfn? zlFq{CWa!6u{rJ@GwxA4JP?P4TWlc|8(93QwRGPk(7S+ZMQl>7Ql5~YB9d7j>7=0!m zl1W}9;Bi`%mnt&Ll4pG))D#F9^vKjMsH^5lF%~b(j>GYZQ||DLx3nmDX$obuAY-6Q z8ZDpzeb$=qNqFUCzTFTPVb|lm0N0*!HB+N)boEx5oK)D17ftHQd+0iFA8&^Jg$0hX zcz+VNr_hVBz|eS!wjNFMO|*A4HDz_a+_d{)#@go$&+nyRzcZyQ(0DTVnYr z*g{F~#fj|vT2A6a&FQhPQr0oKY{Gsr0xxbxbE$MD>1Wxz?$$AQR!Fvndp!2IYO)}i zt(K^H!-8G~Ktt@+I(4Rm!EPWTCjBZ(WKo zzXew)LE+juyQNogbLfI?P_61W_s)dLw{$l74V>s1If9xGKX&abb(+*I2Q*9G>eZGi zjbhCdd%9q&^s&4+&@BJ1C&NpW-X@GQb!@FsZkq+?%1DhcXQ&llveg{+RIw zFAA8W+3x;#BQGV!BZ@#n$XxEAo(~_rh=WJ=tJ^ujX9-}cCp2q)59z~=z%k0o<}_3f z1L#rtkHEXfEccC1W+Vz*Gzi`nWgIB;=XaEVEzO}8(Q9OTcA_`*$E)nAOC-I8 zG$U9zzY2u%w->GVm8Y%g_Z^W>ms>rQ#MqIZ*1#V1ZaX|Db>y{-VI-I?EY+(cz#>R> zk2#op?#RBzLt&}+sL!oRy;RY;0q2xMy}d~Duz9quduT)yxoBYieL)Q>Kg(2kOCiOE zYWyeE7N10RrWg}lrp*ismksm5JP#wm>Ot@OJyJJjV_&m2rp}n-f0(mrFmG9SMP2NY zy1ZZG(*mNNiK@jE^{k#CF(bx2z#FpQDp_VJ-MSF){HjX zWib7c#h)Xt!~J%Cd9Bf#i&G!44}e->+cDys7LU+aSKiw%B^)Y1mKYI{Y|h=_O#Cs8 zBb=64+75#8I^#v?mU?gEP)!BDN!XtGLERMSdA3tuVzS-5N|kPb&;y)BZ@H-k_ z=twn)IR(_NH@v5^Zf8s1z5fZ3{S6Rf!IWLKn27pqpKNs5@-bUeE!79Urv`XZ{kZ0A*MB@dYR{BFgB;uBZ)h}6J2aJ!E)hoGdkK=~S`rNna86NJ1-pQZ%>d;^O z?Nwo0zy4h;}ulT>0l1vx)dU`6E}7?zf3?6;F8po5xb&IT<3~5gz!>zC%A))y%PX(`RctI zB3V7$$=T)dop!+0F{1I$!X-D_a5EPxX8`0fC;o3>{=N17Copo-it0-82pdYMOI)4B zUPE(vtoy%2b3F+>;#Gejz~00fQ&14|iUq(`2LAsEjfAY4lDrZEjgs8Ip@#QTz2Cq< z5J$R-|CX9dv;0a8H~9YyMnzg&R$dkXM(y7a!;3i5y@uuT?Dr=Y2*TojTZ!lT*)iyn zsQ();*Df^p-A25Bxxud3d zPh$S^En(ryY3Py<(Er^=*CPq8f%(IGc`lFSe;NsNc>}@EvGkWce*yFFFP!+Fy!ZNi z_&b=Zsr5JSZ^#nKMBD%Dw=^ zY>RjvzWG=Ac{ zLc_}f;Qkwp148plbbohtRlEdur7eK@s*C`~{rBh2=B6%idpp+4M?hCr1~C64Lp%q% zQsP&TKRf)j+HWX-9l$?P{?jC)YtZ$s5!`_O=Jua@2!43}*61G@LQ9@2j(>&o&!>o% z{{@NncjA8a*1ufg%GPQC=wB*BuUz8SW`8mJe{A*F862@jAxsFpzUDwL>HBH2zZO6V zW5n8RZ;8ou<)eTr=S4XFUra%-%=Fi1O7@6bMKqnwRa{*j!tE~IS;fKJPVCBFfa_xb zdP(Zfj_x_xo4J~rI{}!L;0hY%IsgYV3&bA|5GN0i6AVHu*!M1YArY01Cqd{_}&l zRRw~GoU#D?BLgAqb@>CZ`zZs#E=};e3=Fz-*=sUx;GZ%c7{ZT!ug4AILAb#0G9d7B zt^QpG=0)Vkxh{k9Al&oUdLSSWir6q-mmyMNT$h0$mmcx!vp^u2525LAG7u01MqDU! zT?V}zj=w&Os0X~934WDbwg>sM57_0#=2|`2<@owt#tppOb6l6f{=|of8oOQ(5hC_S zdr%Pg8V5i`4}aPc3cj3He(x6whF#P5lIF{;=Cyh}f9eM1`8VA2a9?{C!5-*Ou3)^E zOTce^APjstAzYI|{^SqF^QR2T%X^&{#E#;+eG#UF@m%K$1muBSw;Kou`Ez{0_%2tH zYxuyI`}}J%DDV#~AkcODB4`2s(Fa0yIc@&l9tbh1{3*L!#je%kyIf{}mm$6}{ece* zy*?IzAa3qI?ZFNGlPex>zU$)`!~^5IHdYbC1N?{YB8JT6_mbc6@m$WEf5>=X*ZY6~ z!GFvz5Fi8*2Ksw@5Jax6>sTO&VRW4rDB_Z-KV`7X9rYqIz<;k|06^?QoiBHpSL+r677WOP$-p3` IB8~a~0MFHqn*aa+ literal 0 HcmV?d00001 From 228f1ea67bf09cc8f05b8998278c199738974e57 Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Sat, 26 Feb 2022 13:43:58 -0500 Subject: [PATCH 142/143] Need to redefine instances --- src/arith.asm | 20616 +++++++++------- src/arith.cil | 2875 ++- src/arith.cl | 123 +- src/arith_input.txt | 1 + src/arith_output.txt | 19 + src/complex.asm | 2944 +++ src/complex.cil | 674 + src/complex.cl | 52 + src/cool/code_generation/ast_cil.py | 33 +- src/cool/code_generation/ast_mips.py | 4 + src/cool/code_generation/formatters.py | 38 +- .../code_generation/translator_cil_to_mips.py | 303 +- .../code_generation/translator_cool_to_cil.py | 541 +- src/cool/semantics/position_assigner.py | 7 +- src/fib.asm | 1640 ++ src/fib.cil | 460 + src/fib.cl | 25 + src/logs.txt | 272 +- src/main.asm | 634 +- src/main.cil | 141 +- src/main.cl | 41 +- src/primes.asm | 2205 ++ src/primes.cil | 623 + src/primes.cl | 86 + src/print-cool.asm | 1612 ++ src/print-cool.cil | 435 + src/print-cool.cl | 9 + src/sort-list.asm | 3736 +++ src/sort-list.cil | 940 + src/sort-list.cl | 149 + tests/codegen/arith.mips | 20616 +++++++++------- tests/codegen/atoi.mips | 2706 +- tests/codegen/cells.mips | 1626 +- tests/codegen/complex.mips | 2944 +++ tests/codegen/fib.mips | 840 +- tests/codegen/graph.mips | 4938 ++-- tests/codegen/hairyscary.mips | 16982 ++++++++++--- tests/codegen/hello_world.mips | 492 +- tests/codegen/io.mips | 630 +- tests/codegen/life.mips | 7209 +++--- tests/codegen/list.mips | 1150 +- tests/codegen/new_complex.mips | 3502 +++ tests/codegen/palindrome.mips | 892 +- tests/codegen/primes.mips | 1980 +- tests/codegen/print-cool.mips | 1612 ++ tests/codegen/sort-list.mips | 3745 +++ 46 files changed, 80540 insertions(+), 32562 deletions(-) create mode 100644 src/arith_input.txt create mode 100644 src/arith_output.txt create mode 100644 src/complex.asm create mode 100644 src/complex.cil create mode 100755 src/complex.cl create mode 100644 src/fib.asm create mode 100644 src/fib.cil create mode 100644 src/fib.cl create mode 100644 src/primes.asm create mode 100644 src/primes.cil create mode 100644 src/primes.cl create mode 100644 src/print-cool.asm create mode 100644 src/print-cool.cil create mode 100644 src/print-cool.cl create mode 100644 src/sort-list.asm create mode 100644 src/sort-list.cil create mode 100644 src/sort-list.cl create mode 100644 tests/codegen/complex.mips create mode 100644 tests/codegen/new_complex.mips create mode 100644 tests/codegen/print-cool.mips create mode 100644 tests/codegen/sort-list.mips diff --git a/src/arith.asm b/src/arith.asm index bdb8721dd..cd4e82cda 100644 --- a/src/arith.asm +++ b/src/arith.asm @@ -4,72 +4,84 @@ type_Object_attributes: .word 0 type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" + type_Object_abort_message: .asciiz "Abort called from class Object\n" type_IO: .word 8 type_IO_inherits_from: .word type_Object type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" + type_IO_abort_message: .asciiz "Abort called from class IO\n" type_Int: .word 8 type_Int_inherits_from: .word type_Object type_Int_attributes: .word 0 type_Int_name_size: .word 3 type_Int_name: .asciiz "Int" + type_Int_abort_message: .asciiz "Abort called from class Int\n" type_String: .word 8 type_String_inherits_from: .word type_Object type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" + type_String_abort_message: .asciiz "Abort called from class String\n" type_Bool: .word 8 type_Bool_inherits_from: .word type_Object type_Bool_attributes: .word 0 type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" + type_Bool_abort_message: .asciiz "Abort called from class Bool\n" type_A: .word 12 type_A_inherits_from: .word type_Object type_A_attributes: .word 1 type_A_name_size: .word 1 type_A_name: .asciiz "A" + type_A_abort_message: .asciiz "Abort called from class A\n" type_B: .word 12 type_B_inherits_from: .word type_A type_B_attributes: .word 1 type_B_name_size: .word 1 type_B_name: .asciiz "B" + type_B_abort_message: .asciiz "Abort called from class B\n" type_C: .word 12 type_C_inherits_from: .word type_B type_C_attributes: .word 1 type_C_name_size: .word 1 type_C_name: .asciiz "C" + type_C_abort_message: .asciiz "Abort called from class C\n" type_D: .word 12 type_D_inherits_from: .word type_B type_D_attributes: .word 1 type_D_name_size: .word 1 type_D_name: .asciiz "D" + type_D_abort_message: .asciiz "Abort called from class D\n" type_E: .word 12 type_E_inherits_from: .word type_D type_E_attributes: .word 1 type_E_name_size: .word 1 type_E_name: .asciiz "E" + type_E_abort_message: .asciiz "Abort called from class E\n" type_A2I: .word 8 type_A2I_inherits_from: .word type_Object type_A2I_attributes: .word 0 type_A2I_name_size: .word 3 type_A2I_name: .asciiz "A2I" + type_A2I_abort_message: .asciiz "Abort called from class A2I\n" type_Main: .word 24 type_Main_inherits_from: .word type_IO type_Main_attributes: .word 4 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" + type_Main_abort_message: .asciiz "Abort called from class Main\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -352,12 +364,12 @@ function_equal: # Function parameters - # $ra = 40($sp) - # a = 36($sp) - # b = 32($sp) + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) # Reserving space for local variables - addi $sp, $sp, -32 + addi $sp, $sp, -40 # Allocating Bool 0 li $v0, 9 @@ -369,22 +381,57 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_0 = address of allocated object Int + sw $v0, 36($sp) # internal_0 = address of allocated object Int - # internal_1 = typeof a that is the first word of the object - lw $t0, 36($sp) - lw $t1, 0($t0) - sw $t1, 24($sp) + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) - # internal_2 = direction of Int + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int la $t0, type_Int sw $t0, 20($sp) - # internal_3 = direction of Bool + # internal_5 = direction of Bool la $t0, type_Bool sw $t0, 16($sp) - # internal_4 = direction of String + # internal_6 = direction of String la $t0, type_String sw $t0, 12($sp) @@ -398,7 +445,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_5 = address of allocated object Int + sw $v0, 8($sp) # internal_7 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -410,7 +457,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_6 = address of allocated object Int + sw $v0, 4($sp) # internal_8 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -422,42 +469,42 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_7 = address of allocated object Int + sw $v0, 0($sp) # internal_9 = address of allocated object Int - # internal_5 = EqualAddress(internal_1, internal_2) + # internal_7 = EqualAddress(internal_3, internal_4) lw $t0, 24($sp) lw $t1, 20($sp) seq $t2, $t0, $t1 lw $t0, 8($sp) sw $t2, 8($t0) - # internal_6 = EqualAddress(internal_1, internal_3) + # internal_8 = EqualAddress(internal_3, internal_5) lw $t0, 24($sp) lw $t1, 16($sp) seq $t2, $t0, $t1 lw $t0, 4($sp) sw $t2, 8($t0) - # internal_7 = EqualAddress(internal_1, internal_4) + # internal_9 = EqualAddress(internal_3, internal_6) lw $t0, 24($sp) lw $t1, 12($sp) seq $t2, $t0, $t1 lw $t0, 0($sp) sw $t2, 8($t0) - # If internal_5 then goto a_is_type_int_or_bool + # If internal_7 then goto a_is_type_int_or_bool lw $t0, 8($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison beq $t0, $t1, a_is_type_int_or_bool - # If internal_6 then goto a_is_type_int_or_bool + # If internal_8 then goto a_is_type_int_or_bool lw $t0, 4($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison beq $t0, $t1, a_is_type_int_or_bool - # If internal_7 then goto a_is_type_string + # If internal_9 then goto a_is_type_string lw $t0, 0($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison @@ -469,12 +516,12 @@ a_is_type_int_or_bool: # internal_0 = EqualInt(a, b) - lw $t0, 36($sp) + lw $t0, 44($sp) lw $t0, 8($t0) - lw $t1, 32($sp) + lw $t1, 40($sp) lw $t1, 8($t1) seq $t2, $t0, $t1 - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t2, 8($t0) # Jumping to end_of_equal @@ -483,14 +530,14 @@ a_is_type_string: # internal_0 = EqualStr(a, b) - lw $t0, 36($sp) - lw $t1, 32($sp) + lw $t0, 44($sp) + lw $t1, 40($sp) addi $t0, $t0, 8 addi $t1, $t1, 8 # By default we assume the strings are equals addi $t4, $zero, 1 - lw $t5, 28($sp) + lw $t5, 36($sp) sw $t4, 8($t5) while_compare_strings_start: @@ -499,7 +546,7 @@ beq $t2, $t3, while_compare_strings_update # The strings are no equals - lw $t5, 28($sp) + lw $t5, 36($sp) sw $zero, 8($t5) j while_compare_strings_end @@ -507,6 +554,7 @@ addi $t0, $t0, 1 addi $t1, $t1, 1 beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end j while_compare_strings_start while_compare_strings_end: @@ -516,11 +564,11 @@ a_is_type_object: # Equal operation - lw $t0, 36($sp) # Save in $t0 the left operand address - lw $t1, 32($sp) # Save in $t1 the right operand address + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address seq $t2, $t0, $t1 # $t2 = $t0 == $t1 - lw $t0, 28($sp) # $t0 = internal_0 + lw $t0, 36($sp) # $t0 = internal_0 sw $t2, 8($t0) # Setting value in the third word of the Bool object # Jumping to end_of_equal @@ -529,136 +577,160 @@ end_of_equal: # Loading return value in $v1 - lw $v1, 28($sp) + lw $v1, 36($sp) # Freeing space for local variables - addi $sp, $sp, 32 + addi $sp, $sp, 40 jr $ra - function___init___at_Object: + function_assign: # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) - jr $ra + # Reserving space for local variables + addi $sp, $sp, -28 - function_abort_at_Object: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 - # Exit program - li $v0, 10 + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 syscall - # Loading return value in $v1 - lw $v1, 0($sp) + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int - jr $ra + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) - function_type_name_at_Object: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) - # Reserving space for local variables - addi $sp, $sp, -4 + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object - # internal_0 = name of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($t0) # $t1 = type of self - lw $t2, 12($t1) # $t1 = length of the name of self - lw $t3, 16($t1) # $t1 = name of self + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) - addi $t2, $t2, 9 # Setting space for the type, the size and the null byte - li $v0, 9 - move $a0, $t2 - syscall - addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) - la $t4, type_String - sw $t4, 0($v0) # Setting type in the first word of the object + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) - sw $a0, 4($v0) # Setting length in the second word of the object + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - move $t4, $v0 # $t4 = direction of the new string - addi $t4, $t4, 8 # Pointer to the first character of the string - addi $t0, $t0, 8 # Pointer to the first character of the string in self - xor $t5, $t5, $t5 # Initializing counter - while_copy_name_start: - beq $t5, $t1, while_copy_name_end - lb $t6, 0($t0) # Loading the character - sb $t6, 0($t4) - addi $t4, $t4, 1 # Incrementing the pointer to the new string - addi $t0, $t0, 1 # Incrementing the pointer to the string in self - addi $t5, $t5, 1 # Incrementing counter - j while_copy_name_start - while_copy_name_end: + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int - sb $zero, 0($t4) # Setting the null byte + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - sw $t4, 0($sp) # Storing the new string in internal_0 + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int - # Loading return value in $v1 - lw $v1, 0($sp) + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) - # Freeing space for local variables - addi $sp, $sp, 4 + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) - jr $ra + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool - function_copy_at_Object: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool - # Reserving space for local variables - addi $sp, $sp, -4 + # Jumping to source_is_type_object + j source_is_type_object - # internal_0 = copy of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($t0) # $t1 = type of self - lw $t2, 4($t0) # $t2 = length of self in bytes + source_is_type_int_or_bool: - # Allocating space for the new object + # dest = source where source is an integer li $v0, 9 - move $a0, $t2 + addi $a0, $zero, 12 syscall - move $t3, $v0 # $t3 = direction of the new object - sw $t1, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) - # Initializing the variable of the loop - addi $t0, $t0, 8 # Pointer to the first character of the object - addi $t3, $t3, 8 # Pointer to the first character of the object - addi $t2, $2, -8 # Decrementing in 8 the length of the object - xor $t4, $t4, $t4 # Initializing counter + # Jumping to source_end_of_equal + j source_end_of_equal - # Loop copying the object - while_copy_start: - beq $t4, $t2, while_copy_end - lb $t5, 0($t0) # Loading the byte - sb $t5, 0($t3) # Storing the byte - addi $t0, $t0, 1 # Incrementing the pointer to the object - addi $t3, $t3, 1 # Incrementing the pointer to the new object - addi $t4, $t4, 1 # Incrementing counter - j while_copy_start - while_copy_end: - sw $v0, 0($sp) # Storing the new object in internal_0 + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 32($sp) # Freeing space for local variables - addi $sp, $sp, 4 + addi $sp, $sp, 28 jr $ra - function___init___at_IO: + function___init___at_Object: # Function parameters # $ra = 4($sp) # self = 0($sp) @@ -668,267 +740,229 @@ jr $ra - function_out_string_at_IO: + function_abort_at_Object: # Function parameters - # $ra = 8($sp) - # self = 4($sp) - # x = 0($sp) + # $ra = 20($sp) + # self = 16($sp) - lw $t0, 0($sp) # $t0 = x - addi $t0, $t0, 8 # Pointer to the first character of the string + # Reserving space for local variables + addi $sp, $sp, -16 - # Printing the string x - li $v0, 4 - move $a0, $t0 + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - # Loading return value in $v1 - lw $v1, 4($sp) + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - jr $ra + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - function_out_int_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - # x = 0($sp) + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' - # Printing the string x - li $v0, 1 - lw $a0, 0($sp) - lw $a0, 8($a0) - syscall + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' - # Loading return value in $v1 - lw $v1, 4($sp) + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' - jr $ra + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' - function_in_string_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' - # Reserving space for local variables - addi $sp, $sp, -4 + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' - li $v0, 8 - la $a0, buffer_input - li $a1, 1024 - syscall + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' - xor $t0, $t0, $t0 # Initializing counter - while_read_start: - lw $t1, buffer_input($t0) # Loading the byte - beq $t1, $zero, while_read_end - addi $t0, $t0, 1 # Incrementing counter - j while_read_start - while_read_end: + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' - addi $t0, $t0, 9 # Adding space for the type, the size and the null byte - li $v0, 9 - move $a0, $t0 - syscall - la $t2, type_String - sw $t2, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' - addi $t3, $v0, 8 # Pointer to the first character of the string - xor $t4, $t4, $t4 # Initializing counter + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' - while_copy_from_buffer_start: - beq $t4, $t0, while_copy_from_buffer_end - lw $t5, buffer_input($t4) # Loading the byte - sb $t5, 0($t3) # Storing the byte - addi $t3, $t3, 1 # Imcremeenting pointer - addi $t4, $t4, 1 # Incrementing counter - j while_copy_from_buffer_start - while_copy_from_buffer_end: + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' - sb $zero, 0($t3) # Storing the null byte + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' - sw $v0, 0($sp) # Storing the new object in internal_0 + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' - # Loading return value in $v1 - lw $v1, 0($sp) + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' - # Freeing space for local variables - addi $sp, $sp, 4 + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' - jr $ra + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' - function_in_int_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' - # Reserving space for local variables - addi $sp, $sp, -4 + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' - li $v0, 5 - syscall - sw $v0, 0($sp) # Storing the new object in internal_0 + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' - # Loading return value in $v1 - lw $v1, 0($sp) + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' - # Freeing space for local variables - addi $sp, $sp, 4 + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' - jr $ra + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' - function___init___at_String: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' - # Loading return value in $v1 - lw $v1, 0($sp) + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' - jr $ra + sb $zero, 32($v0) # Null-terminator at the end of the string - function_length_at_String: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) + sw $v0, 12($sp) # internal_0 = "Abort called from class " - # Reserving space for local variables - addi $sp, $sp, -4 + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - # internal_0 = length of self - lw $t0, 4($sp) - lw $t1, 4($t0) - addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator - sw $t1, 0($sp) + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - # Loading return value in $v1 - lw $v1, 0($sp) + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - # Freeing space for local variables - addi $sp, $sp, 4 + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_2[0] = '\n' - jr $ra + sb $zero, 9($v0) # Null-terminator at the end of the string - function_concat_at_String: - # Function parameters - # $ra = 12($sp) - # self = 8($sp) - # s = 4($sp) + sw $v0, 4($sp) # internal_2 = "\n" - # Reserving space for local variables - addi $sp, $sp, -4 + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - # internal_0 = self + s - lw $t0, 8($sp) - lw $t1, 4($sp) - lw $t2, 4($t0) # $t2 = length of str1 - lw $t3, 4($t1) # $t3 = length of str2 - add $t4, $t2, $t3 # $t4 = length of str1 + str2 - addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self - li $v0, 9 - move $a0, $t4 - syscall - addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 - add $t5, $zero, $v0 # $t5 = address of the new string object - addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + # Calling function function_type_name_at_Object + jal function_type_name_at_Object + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + addi $sp, $sp, 8 # Freeing space for arguments - la $t8, type_String - sw $t8, 0($v0) # Setting type in the first word of th object + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - sw $a0, 4($v0) # Setting length of the string in the second word of the object + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_0 - # Copying str1 to the new string - xor $t6, $t6, $t6 # $t6 = 0 Initializing counter - while_copy_str1_start: - beq $t6, $t2, while_copy_str1_end - lb $t7, 0($t0) - sb $t7, 0($t5) - add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_str1_start - while_copy_str1_end: + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 - # Copying str2 to the new string - while_copy_str2_start: - beq $t6, $t4, while_copy_str2_end - lb $t7, 0($t1) - sb $t7, 0($t5) - add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_str2_start - while_copy_str2_end: + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments - sb $zero, 0($t5) # Setting the null-terminator + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - sw $v0, 0($sp) # internal_0 = self + s + # Argument internal_3 + lw $t0, 12($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) # $t0 = internal_3 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string internal_3 + li $v0, 4 + move $a0, $t0 + syscall + + # Exit program + li $v0, 10 + syscall # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 16($sp) # Freeing space for local variables - addi $sp, $sp, 4 + addi $sp, $sp, 16 jr $ra - function_substr_at_String: + function_type_name_at_Object: # Function parameters - # $ra = 16($sp) - # self = 12($sp) - # i = 8($sp) - # l = 4($sp) + # $ra = 8($sp) + # self = 4($sp) # Reserving space for local variables addi $sp, $sp, -4 - # internal_0 = self[i:i + l] - lw $t0, 12($sp) # $t0 = address of the string - lw $t1, 4($t0) # $t1 = length of the string - lw $t2, 8($sp) # $t2 = start of the substring - lw $t3, 4($sp) # $t3 = length of the substring - add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring - - bge $t4, $t1, substring_out_of_bounds + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 12($t1) # $t1 = length of the name of self + la $t3, 16($t1) # $t1 = name of self - addi $t3, $t3, 9 + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 - move $a0, $t3 + move $a0, $t2 syscall - addi $t3, $t3, -9 - - la $t5, type_String - sw $t5, 0($v0) # Setting type in the first word of the object + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting length in the second word of the object - addi $t0, $t0, 8 # pointing to the first byte of the string - add $t0, $t0, $t2 # pointing to the first byte of the substring - move $t5, $v0 # $t5 = address of the new string - add $t5, $t5, 8 # pointing to the first byte of the string - xor $t6, $t6, $t6 # $t6 = 0 Initializing counter - while_copy_substr_start: - beq $t6, $t3, while_copy_substr_end - lb $t7, 0($t0) - sb $t7, 0($t5) - addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_substr_start - while_copy_substr_end: - - sb $zero, 0($t5) # Setting the null-terminator - - sw $v0, 0($sp) # internal_0 = self[i:i + l] - j substring_not_out_of_bounds + addi $t4, $v0, 0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t3, $t3, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: - substring_out_of_bounds: - li $v0, 17 - addi $a0, $zero, 1 - syscall + sb $zero, 0($t4) # Setting the null byte - substring_not_out_of_bounds: + sw $v0, 0($sp) # Storing the new string in internal_0 # Loading return value in $v1 lw $v1, 0($sp) @@ -938,7 +972,7 @@ jr $ra - function___init___at_A: + function_copy_at_Object: # Function parameters # $ra = 8($sp) # self = 4($sp) @@ -946,551 +980,2401 @@ # Reserving space for local variables addi $sp, $sp, -4 - # Allocating Int 0 + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object li $v0, 9 - addi $a0, $zero, 12 + move $a0, $t2 syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Set attribute var of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_0 - sw $t1, 8($t0) # self.var = internal_0 + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 # Loading return value in $v1 - lw $v1, 4($sp) + lw $v1, 0($sp) # Freeing space for local variables addi $sp, $sp, 4 jr $ra - function_value_at_A: + function___init___at_IO: # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Get attribute var of self - lw $t0, 4($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'var' from the instance - sw $t1, 0($sp) # internal_0 = var + # $ra = 4($sp) + # self = 0($sp) # Loading return value in $v1 lw $v1, 0($sp) - # Freeing space for local variables - addi $sp, $sp, 4 - jr $ra - function_set_var_at_A: + function_out_string_at_IO: # Function parameters # $ra = 8($sp) # self = 4($sp) - # num = 0($sp) + # x = 0($sp) - # Set attribute var of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = num - sw $t1, 8($t0) # self.var = num + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string x + li $v0, 4 + move $a0, $t0 + syscall # Loading return value in $v1 lw $v1, 4($sp) jr $ra - function_method1_at_A: + function_out_int_at_IO: # Function parameters # $ra = 8($sp) # self = 4($sp) - # num = 0($sp) + # x = 0($sp) + + # Printing the string x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall # Loading return value in $v1 lw $v1, 4($sp) jr $ra - function_method2_at_A: + function_in_string_at_IO: # Function parameters - # $ra = 28($sp) - # self = 24($sp) - # num1 = 20($sp) - # num2 = 16($sp) + # $ra = 8($sp) + # self = 4($sp) # Reserving space for local variables - addi $sp, $sp, -16 - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument num1 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing num1 - - # Argument num2 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing num2 + addi $sp, $sp, -4 - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_1 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 12($sp) - j end_assign - not_is_Bool_or_Int: - # x = internal_1 - lw $t0, 8($sp) - sw $t0, 12($sp) - end_assign: + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lb $t1, buffer_input($t0) # Loading the byte + beq $t1, $zero, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' - # Allocating B + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 - lw $a0, type_B + move $a0, $t0 syscall - la $t0, type_B # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_2 = address of allocated object B - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_2 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function___init___at_B - jal function___init___at_B - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_2 = result of function___init___at_B - addi $sp, $sp, 8 # Freeing space for arguments + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_2 + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lb $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: - # Argument x - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing x + sb $zero, 0($t3) # Storing the null byte - # Calling function function_set_var_at_A - jal function_set_var_at_A - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_set_var_at_A - addi $sp, $sp, 12 # Freeing space for arguments + sw $v0, 0($sp) # Storing the new object in internal_0 # Loading return value in $v1 lw $v1, 0($sp) # Freeing space for local variables - addi $sp, $sp, 16 + addi $sp, $sp, 4 jr $ra - function_method3_at_A: + function_in_int_at_IO: # Function parameters - # $ra = 32($sp) - # self = 28($sp) - # num = 24($sp) + # $ra = 8($sp) + # self = 4($sp) # Reserving space for local variables - addi $sp, $sp, -24 - - # Xor operation - lw $t0, 24($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 12($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 - - lw $t0, 8($sp) # $t0 = internal_3 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Addition operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 16($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - add $t2, $t0, $t1 # $t2 = $t0 + $t1 - - lw $t0, 8($sp) # $t0 = internal_3 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 20($sp) - j end_assign - not_is_Bool_or_Int: - # x = internal_3 - lw $t0, 8($sp) - sw $t0, 20($sp) - end_assign: + addi $sp, $sp, -4 - # Allocating C + # Allocating Int 0 li $v0, 9 - lw $a0, type_C + addi $a0, $zero, 12 syscall - la $t0, type_C # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_4 = address of allocated object C - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - # Argument internal_4 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_4 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int - # Calling function function___init___at_C - jal function___init___at_C - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_4 = result of function___init___at_C - addi $sp, $sp, 8 # Freeing space for arguments + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + # Loading return value in $v1 + lw $v1, 0($sp) - # Argument internal_4 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_4 + # Freeing space for local variables + addi $sp, $sp, 4 - # Argument x - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing x + jr $ra - # Calling function function_set_var_at_A - jal function_set_var_at_A - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_5 = result of function_set_var_at_A - addi $sp, $sp, 12 # Freeing space for arguments + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) # Loading return value in $v1 lw $v1, 0($sp) - # Freeing space for local variables - addi $sp, $sp, 24 - jr $ra - function_method4_at_A: + function_length_at_String: # Function parameters - # $ra = 56($sp) - # self = 52($sp) - # num1 = 48($sp) - # num2 = 44($sp) + # $ra = 8($sp) + # self = 4($sp) # Reserving space for local variables - addi $sp, $sp, -44 - + addi $sp, $sp, -4 - # Allocating Bool 0 + # Allocating Int 0 li $v0, 9 addi $a0, $zero, 12 syscall - la $t0, type_Bool # $t0 = address of the type + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_1 = address of allocated object Int + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + lw $t0, 0($sp) + sw $t1, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 8($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 8($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 + lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) + lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bgt $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_A: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8781702292580 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8781702292580 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8781702292580 + j object_set_attribute_8781702292580 + int_set_attribute_8781702292580: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8781702292580 + bool_set_attribute_8781702292580: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8781702292580 + object_set_attribute_8781702292580: + sw $t1, 8($t0) # self.var = internal_0 + end_set_attribute_8781702292580: + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_value_at_A: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute var of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'var' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702292604 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702292604 + j object_get_attribute_8781702292604 + int_get_attribute_8781702292604: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.var + j end_get_attribute_8781702292604 + bool_get_attribute_8781702292604: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.var + j end_get_attribute_8781702292604 + object_get_attribute_8781702292604: + sw $t1, 0($sp) # internal_0 = var + end_get_attribute_8781702292604: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_set_var_at_A: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # num = 0($sp) + + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = num + beq $t1, $zero, object_set_attribute_8781702292655 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8781702292655 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8781702292655 + j object_set_attribute_8781702292655 + int_set_attribute_8781702292655: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = num + j end_set_attribute_8781702292655 + bool_set_attribute_8781702292655: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = num + j end_set_attribute_8781702292655 + object_set_attribute_8781702292655: + sw $t1, 8($t0) # self.var = num + end_set_attribute_8781702292655: + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_method1_at_A: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # num = 0($sp) + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_method2_at_A: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + # num1 = 20($sp) + # num2 = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # x = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num1 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing num1 + + # Argument num2 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing num2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_1 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 24($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating B + li $v0, 9 + lw $a0, type_B + syscall + la $t0, type_B # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_2 = address of allocated object B + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_2 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function___init___at_B + jal function___init___at_B + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_2 = result of function___init___at_B + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument x + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_method3_at_A: + # Function parameters + # $ra = 32($sp) + # self = 28($sp) + # num = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # x = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_1 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_2 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_3 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_3 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 32($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating C + li $v0, 9 + lw $a0, type_C + syscall + la $t0, type_C # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_4 = address of allocated object C + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_4 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function___init___at_C + jal function___init___at_C + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_4 = result of function___init___at_C + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument x + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_5 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_method4_at_A: + # Function parameters + # $ra = 56($sp) + # self = 52($sp) + # num1 = 48($sp) + # num2 = 44($sp) + + # Reserving space for local variables + addi $sp, $sp, -44 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num2 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing num2 + + # Argument num1 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing num1 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_2 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_2 + lw $t0, 32($sp) + sw $t0, 36($sp) + + # If internal_1 then goto then_8781702322008 + lw $t0, 36($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8781702322008 + + # Jumping to else_8781702322008 + j else_8781702322008 + + then_8781702322008: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # x = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num1 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing num1 + + # Argument num2 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing num2 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_4 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_4 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 40($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating D + li $v0, 9 + lw $a0, type_D + syscall + la $t0, type_D # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 20($sp) # internal_5 = address of allocated object D + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_5 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function___init___at_D + jal function___init___at_D + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_5 = result of function___init___at_D + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_5 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_5 + + # Argument x + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_6 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_0 = internal_6 + lw $t0, 16($sp) + sw $t0, 40($sp) + + # Jumping to endif_8781702322008 + j endif_8781702322008 + + else_8781702322008: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # x = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num2 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing num2 + + # Argument num1 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing num1 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_8 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_8 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 40($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating D + li $v0, 9 + lw $a0, type_D + syscall + la $t0, type_D # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_9 = address of allocated object D + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_9 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function___init___at_D + jal function___init___at_D + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_9 = result of function___init___at_D + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_9 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_9 + + # Argument x + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_10 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_0 = internal_10 + lw $t0, 0($sp) + sw $t0, 40($sp) + + # Jumping to endif_8781702322008 + j endif_8781702322008 + + endif_8781702322008: + + # Loading return value in $v1 + lw $v1, 40($sp) + + # Freeing space for local variables + addi $sp, $sp, 44 + + jr $ra + + function_method5_at_A: + # Function parameters + # $ra = 48($sp) + # self = 44($sp) + # num = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_1 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 48($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument y + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing y + + # Argument internal_3 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 40($sp) # y = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + while_start_8781702322092: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument y + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing y + + # Argument num + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_less_than_or_equal + jal function_less_than_or_equal + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_4 = result of function_less_than_or_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_4 then goto while_body_8781702322092 + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8781702322092 + + # Jumping to while_end_8781702322092 + j while_end_8781702322092 + + while_body_8781702322092: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing x + + # Argument y + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing y + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_5 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_5 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 48($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_6 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument y + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing y + + # Argument internal_6 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_7 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument y + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing y + + # Argument internal_7 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 40($sp) # y = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to while_start_8781702322092 + j while_start_8781702322092 + + while_end_8781702322092: + + # Allocating E + li $v0, 9 + lw $a0, type_E + syscall + la $t0, type_E # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_8 = address of allocated object E + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_8 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function___init___at_E + jal function___init___at_E + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_8 = result of function___init___at_E + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_8 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument x + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_9 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function___init___at_B: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8781702264089 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8781702264089 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8781702264089 + j object_set_attribute_8781702264089 + int_set_attribute_8781702264089: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8781702264089 + bool_set_attribute_8781702264089: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8781702264089 + object_set_attribute_8781702264089: + sw $t1, 8($t0) # self.var = internal_0 + end_set_attribute_8781702264089: + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_method5_at_B: + # Function parameters + # $ra = 24($sp) + # self = 20($sp) + # num = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # x = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing num + + # Argument num + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_1 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 24($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating E + li $v0, 9 + lw $a0, type_E + syscall + la $t0, type_E # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_2 = address of allocated object E + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_2 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function___init___at_E + jal function___init___at_E + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_2 = result of function___init___at_E + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument x + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function___init___at_C: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8781702264272 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8781702264272 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8781702264272 + j object_set_attribute_8781702264272 + int_set_attribute_8781702264272: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8781702264272 + bool_set_attribute_8781702264272: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8781702264272 + object_set_attribute_8781702264272: + sw $t1, 8($t0) # self.var = internal_0 + end_set_attribute_8781702264272: + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_method6_at_C: + # Function parameters + # $ra = 32($sp) + # self = 28($sp) + # num = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # x = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_1 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_2 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_3 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_3 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 32($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating A + li $v0, 9 + lw $a0, type_A + syscall + la $t0, type_A # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_4 = address of allocated object A + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_4 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function___init___at_A + jal function___init___at_A + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_4 = result of function___init___at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument x + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_5 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_method5_at_C: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + # num = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # x = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing num + + # Argument num + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_1 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument num + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_2 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_2 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 28($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating E + li $v0, 9 + lw $a0, type_E + syscall + la $t0, type_E # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_3 = address of allocated object E + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_3 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function___init___at_E + jal function___init___at_E + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_3 = result of function___init___at_E + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument x + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_4 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 20 + + jr $ra + + function___init___at_D: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8781702265441 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8781702265441 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8781702265441 + j object_set_attribute_8781702265441 + int_set_attribute_8781702265441: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8781702265441 + bool_set_attribute_8781702265441: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8781702265441 + object_set_attribute_8781702265441: + sw $t1, 8($t0) # self.var = internal_0 + end_set_attribute_8781702265441: + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_method7_at_D: + # Function parameters + # $ra = 116($sp) + # self = 112($sp) + # num = 108($sp) + + # Reserving space for local variables + addi $sp, $sp, -108 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing x + + # Argument num + lw $t0, 120($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 116($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_2 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 92($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_3 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_4 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_2 = internal_4 + lw $t0, 88($sp) + sw $t0, 96($sp) + + # If internal_2 then goto then_8781702323502 + lw $t0, 96($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8781702323502 + + # Jumping to else_8781702323502 + j else_8781702323502 + + then_8781702323502: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_5 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_6 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_6 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 88($sp) # internal_7 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_7 + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing internal_7 + + # Argument internal_5 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 88($sp) # internal_7 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_7 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_method7_at_D + jal function_method7_at_D + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_8 = result of function_method7_at_D + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_8 + lw $t0, 72($sp) + sw $t0, 100($sp) + + # Jumping to endif_8781702323502 + j endif_8781702323502 + + else_8781702323502: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_10 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_11 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_11 + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing internal_11 + + # Argument x + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_12 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_10 = internal_12 + lw $t0, 56($sp) + sw $t0, 64($sp) + + # If internal_10 then goto then_8781702323481 + lw $t0, 64($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8781702323481 + + # Jumping to else_8781702323481 + j else_8781702323481 + + then_8781702323481: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_13 = address of allocated object Int + + # internal_9 = internal_13 + lw $t0, 52($sp) + sw $t0, 68($sp) + + # Jumping to endif_8781702323481 + j endif_8781702323481 + + else_8781702323481: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_15 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_16 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument num2 - lw $t0, 56($sp) - sw $t0, 4($sp) # Storing num2 + # Argument internal_16 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_16 - # Argument num1 - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing num1 + # Argument x + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing x - # Calling function function_less_than - jal function_less_than + # Calling function function_equal + jal function_equal lw $ra, 8($sp) - sw $v1, 44($sp) # internal_2 = result of function_less_than + sw $v1, 48($sp) # internal_17 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 32($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 36($sp) - j end_assign - not_is_Bool_or_Int: - # internal_1 = internal_2 - lw $t0, 32($sp) - sw $t0, 36($sp) - end_assign: + # internal_15 = internal_17 + lw $t0, 36($sp) + sw $t0, 44($sp) - # If internal_1 then goto then_8792981814074 - lw $t0, 36($sp) # Loading the address of the condition + # If internal_15 then goto then_8781702323484 + lw $t0, 44($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981814074 + beq $t0, $t1, then_8781702323484 - # Jumping to else_8792981814074 - j else_8792981814074 + # Jumping to else_8781702323484 + j else_8781702323484 - then_8792981814074: + then_8781702323484: - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Argument num1 - lw $t0, 60($sp) - sw $t0, 4($sp) # Storing num1 + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_18 = address of allocated object Int - # Argument num2 - lw $t0, 56($sp) - sw $t0, 0($sp) # Storing num2 + # internal_14 = internal_18 + lw $t0, 32($sp) + sw $t0, 48($sp) - # Calling function function_sub - jal function_sub - lw $ra, 8($sp) - sw $v1, 36($sp) # internal_4 = result of function_sub - addi $sp, $sp, 12 # Freeing space for arguments + # Jumping to endif_8781702323484 + j endif_8781702323484 - lw $t0, 24($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 28($sp) - j end_assign - not_is_Bool_or_Int: - # x = internal_4 - lw $t0, 24($sp) - sw $t0, 28($sp) - end_assign: + else_8781702323484: - # Allocating D + # Allocating Bool 0 li $v0, 9 - lw $a0, type_D + addi $a0, $zero, 12 syscall - la $t0, type_D # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 20($sp) # internal_5 = address of allocated object D - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_20 = address of allocated object Int - # Argument internal_5 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_5 + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Calling function function___init___at_D - jal function___init___at_D - lw $ra, 4($sp) - sw $v1, 28($sp) # internal_5 = result of function___init___at_D - addi $sp, $sp, 8 # Freeing space for arguments + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_21 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_5 + # Argument internal_21 lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_5 + sw $t0, 4($sp) # Storing internal_21 # Argument x - lw $t0, 40($sp) + lw $t0, 116($sp) sw $t0, 0($sp) # Storing x - # Calling function function_set_var_at_A - jal function_set_var_at_A + # Calling function function_equal + jal function_equal lw $ra, 8($sp) - sw $v1, 28($sp) # internal_6 = result of function_set_var_at_A + sw $v1, 28($sp) # internal_22 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments + # internal_20 = internal_22 lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: - # internal_0 = internal_6 - lw $t0, 16($sp) - sw $t0, 40($sp) - end_assign: - - # Jumping to endif_8792981814074 - j endif_8792981814074 + sw $t0, 24($sp) - else_8792981814074: + # If internal_20 then goto then_8781702323490 + lw $t0, 24($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8781702323490 - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + # Jumping to else_8781702323490 + j else_8781702323490 - # Argument num2 - lw $t0, 56($sp) - sw $t0, 4($sp) # Storing num2 + then_8781702323490: - # Argument num1 - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing num1 + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Calling function function_sub - jal function_sub - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_8 = result of function_sub - addi $sp, $sp, 12 # Freeing space for arguments + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_23 = address of allocated object Int - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 28($sp) - j end_assign - not_is_Bool_or_Int: - # x = internal_8 - lw $t0, 8($sp) + # internal_19 = internal_23 + lw $t0, 12($sp) sw $t0, 28($sp) - end_assign: - # Allocating D + # Jumping to endif_8781702323490 + j endif_8781702323490 + + else_8781702323490: + + # Allocating Int 3 li $v0, 9 - lw $a0, type_D + addi $a0, $zero, 12 syscall - la $t0, type_D # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_9 = address of allocated object D + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_24 = address of allocated object Int # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Argument internal_9 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_9 + # Argument x + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing x - # Calling function function___init___at_D - jal function___init___at_D - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_9 = result of function___init___at_D - addi $sp, $sp, 8 # Freeing space for arguments + # Argument internal_24 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_24 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_25 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_9 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_9 + # Argument self + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing self - # Argument x - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing x + # Argument internal_25 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_25 - # Calling function function_set_var_at_A - jal function_set_var_at_A + # Calling function function_method7_at_D + jal function_method7_at_D lw $ra, 8($sp) - sw $v1, 12($sp) # internal_10 = result of function_set_var_at_A + sw $v1, 12($sp) # internal_26 = result of function_method7_at_D addi $sp, $sp, 12 # Freeing space for arguments + # internal_19 = internal_26 lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: - # internal_0 = internal_10 - lw $t0, 0($sp) - sw $t0, 40($sp) - end_assign: + sw $t0, 28($sp) + + # Jumping to endif_8781702323490 + j endif_8781702323490 + + endif_8781702323490: + + # internal_14 = internal_19 + lw $t0, 28($sp) + sw $t0, 48($sp) + + # Jumping to endif_8781702323484 + j endif_8781702323484 + + endif_8781702323484: + + # internal_9 = internal_14 + lw $t0, 48($sp) + sw $t0, 68($sp) + + # Jumping to endif_8781702323481 + j endif_8781702323481 + + endif_8781702323481: + + # internal_1 = internal_9 + lw $t0, 68($sp) + sw $t0, 100($sp) - # Jumping to endif_8792981814074 - j endif_8792981814074 + # Jumping to endif_8781702323502 + j endif_8781702323502 - endif_8792981814074: + endif_8781702323502: # Loading return value in $v1 - lw $v1, 40($sp) + lw $v1, 100($sp) # Freeing space for local variables - addi $sp, $sp, 44 + addi $sp, $sp, 108 jr $ra - function_method5_at_A: + function___init___at_E: # Function parameters - # $ra = 52($sp) - # self = 48($sp) - # num = 44($sp) + # $ra = 8($sp) + # self = 4($sp) # Reserving space for local variables - addi $sp, $sp, -44 + addi $sp, $sp, -4 - # Allocating Int 1 + # Allocating Int 0 li $v0, 9 addi $a0, $zero, 12 syscall @@ -1498,140 +3382,77 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_1 = address of allocated object Int - - lw $t0, 36($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: - # x = internal_1 - lw $t0, 36($sp) - sw $t0, 40($sp) - end_assign: + sw $v0, 0($sp) # internal_0 = address of allocated object Int - # Allocating Int 1 + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8781702267046 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8781702267046 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8781702267046 + j object_set_attribute_8781702267046 + int_set_attribute_8781702267046: li $v0, 9 addi $a0, $zero, 12 syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8781702267046 + bool_set_attribute_8781702267046: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8781702267046 + object_set_attribute_8781702267046: + sw $t1, 8($t0) # self.var = internal_0 + end_set_attribute_8781702267046: - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_3 = address of allocated object Int - - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 32($sp) - j end_assign - not_is_Bool_or_Int: - # y = internal_3 - lw $t0, 28($sp) - sw $t0, 32($sp) - end_assign: - - while_start_8792981814158: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument y - lw $t0, 44($sp) - sw $t0, 4($sp) # Storing y - - # Argument num - lw $t0, 56($sp) - sw $t0, 0($sp) # Storing num - - # Calling function function_less_than_or_equal - jal function_less_than_or_equal - lw $ra, 8($sp) - sw $v1, 32($sp) # internal_5 = result of function_less_than_or_equal - addi $sp, $sp, 12 # Freeing space for arguments - - lw $t0, 20($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: - # internal_4 = internal_5 - lw $t0, 20($sp) - sw $t0, 24($sp) - end_assign: - - # If internal_4 then goto while_body_8792981814158 - lw $t0, 24($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8792981814158 - - # Jumping to while_end_8792981814158 - j while_end_8792981814158 + # Loading return value in $v1 + lw $v1, 4($sp) - while_body_8792981814158: + # Freeing space for local variables + addi $sp, $sp, 4 - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + jr $ra - # Argument x - lw $t0, 52($sp) - sw $t0, 4($sp) # Storing x + function_method6_at_E: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + # num = 20($sp) - # Argument y - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing y + # Reserving space for local variables + addi $sp, $sp, -20 - # Calling function function_mult - jal function_mult - lw $ra, 8($sp) - sw $v1, 28($sp) # internal_6 = result of function_mult - addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: - # x = internal_6 - lw $t0, 16($sp) - sw $t0, 40($sp) - end_assign: + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # x = address of allocated object Int - # Allocating Int 1 + # Allocating Int 8 li $v0, 9 addi $a0, $zero, 12 syscall @@ -1639,232 +3460,176 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 8 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_7 = address of allocated object Int + sw $v0, 12($sp) # internal_1 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument y - lw $t0, 44($sp) - sw $t0, 4($sp) # Storing y + # Argument num + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing num - # Argument internal_7 + # Argument internal_1 lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_7 + sw $t0, 0($sp) # Storing internal_1 - # Calling function function_add - jal function_add + # Calling function function_div + jal function_div lw $ra, 8($sp) - sw $v1, 20($sp) # internal_8 = result of function_add + sw $v1, 20($sp) # internal_2 = result of function_div addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 32($sp) - j end_assign - not_is_Bool_or_Int: - # y = internal_8 - lw $t0, 8($sp) - sw $t0, 32($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Jumping to while_start_8792981814158 - j while_start_8792981814158 + # Argument x + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing x - while_end_8792981814158: + # Argument internal_2 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_2 - # Allocating E + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 28($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating A li $v0, 9 - lw $a0, type_E + lw $a0, type_A syscall - la $t0, type_E # $t0 = address of the type + la $t0, type_A # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_9 = address of allocated object E + sw $v0, 4($sp) # internal_3 = address of allocated object A # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_9 + # Argument internal_3 lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_9 + sw $t0, 0($sp) # Storing internal_3 - # Calling function function___init___at_E - jal function___init___at_E + # Calling function function___init___at_A + jal function___init___at_A lw $ra, 4($sp) - sw $v1, 12($sp) # internal_9 = result of function___init___at_E + sw $v1, 12($sp) # internal_3 = result of function___init___at_A addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_9 + # Argument internal_3 lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_9 + sw $t0, 4($sp) # Storing internal_3 # Argument x - lw $t0, 52($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing x # Calling function function_set_var_at_A jal function_set_var_at_A lw $ra, 8($sp) - sw $v1, 12($sp) # internal_10 = result of function_set_var_at_A + sw $v1, 12($sp) # internal_4 = result of function_set_var_at_A addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 lw $v1, 0($sp) # Freeing space for local variables - addi $sp, $sp, 44 + addi $sp, $sp, 20 jr $ra - function___init___at_B: + function___init___at_A2I: # Function parameters - # $ra = 8($sp) - # self = 4($sp) + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_c2i_at_A2I: + # Function parameters + # $ra = 216($sp) + # self = 212($sp) + # char = 208($sp) # Reserving space for local variables - addi $sp, $sp, -4 + addi $sp, $sp, -208 - # Allocating Int 0 + # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_Bool # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Set attribute var of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_0 - sw $t1, 8($t0) # self.var = internal_0 - - # Loading return value in $v1 - lw $v1, 4($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_method5_at_B: - # Function parameters - # $ra = 24($sp) - # self = 20($sp) - # num = 16($sp) - - # Reserving space for local variables - addi $sp, $sp, -16 - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument num - lw $t0, 28($sp) - sw $t0, 4($sp) # Storing num - - # Argument num - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing num - - # Calling function function_mult - jal function_mult - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_1 = result of function_mult - addi $sp, $sp, 12 # Freeing space for arguments - - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 12($sp) - j end_assign - not_is_Bool_or_Int: - # x = internal_1 - lw $t0, 8($sp) - sw $t0, 12($sp) - end_assign: + sw $v0, 200($sp) # internal_1 = address of allocated object Int - # Allocating E + # Allocating String li $v0, 9 - lw $a0, type_E + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_E # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_2 = address of allocated object E - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - # Argument internal_2 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_2 + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 48 + sb $t0, 8($v0) # internal_2[0] = '0' + + sb $zero, 9($v0) # Null-terminator at the end of the string - # Calling function function___init___at_E - jal function___init___at_E - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_2 = result of function___init___at_E - addi $sp, $sp, 8 # Freeing space for arguments + sw $v0, 196($sp) # internal_2 = "0" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_2 + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char - # Argument x - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing x + # Argument internal_2 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_2 - # Calling function function_set_var_at_A - jal function_set_var_at_A + # Calling function function_equal + jal function_equal lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_set_var_at_A + sw $v1, 204($sp) # internal_3 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 16 + # internal_1 = internal_3 + lw $t0, 192($sp) + sw $t0, 200($sp) - jr $ra + # If internal_1 then goto then_8781702324152 + lw $t0, 200($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8781702324152 - function___init___at_C: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) + # Jumping to else_8781702324152 + j else_8781702324152 - # Reserving space for local variables - addi $sp, $sp, -4 + then_8781702324152: # Allocating Int 0 li $v0, 9 @@ -1876,236 +3641,249 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int + sw $v0, 188($sp) # internal_4 = address of allocated object Int - # Set attribute var of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_0 - sw $t1, 8($t0) # self.var = internal_0 + # internal_0 = internal_4 + lw $t0, 188($sp) + sw $t0, 204($sp) - # Loading return value in $v1 - lw $v1, 4($sp) + # Jumping to endif_8781702324152 + j endif_8781702324152 - # Freeing space for local variables - addi $sp, $sp, 4 + else_8781702324152: - jr $ra + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - function_method6_at_C: - # Function parameters - # $ra = 32($sp) - # self = 28($sp) - # num = 24($sp) + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 180($sp) # internal_6 = address of allocated object Int - # Reserving space for local variables - addi $sp, $sp, -24 + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - # Xor operation - lw $t0, 24($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 12($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - lw $t0, 8($sp) # $t0 = internal_3 - sw $t2, 8($t0) # Setting value in the third word of the Int object + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - # Addition operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 16($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - add $t2, $t0, $t1 # $t2 = $t0 + $t1 + addi $t0, $zero, 49 + sb $t0, 8($v0) # internal_7[0] = '1' - lw $t0, 8($sp) # $t0 = internal_3 - sw $t2, 8($t0) # Setting value in the third word of the Int object + sb $zero, 9($v0) # Null-terminator at the end of the string - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 20($sp) - j end_assign - not_is_Bool_or_Int: - # x = internal_3 - lw $t0, 8($sp) - sw $t0, 20($sp) - end_assign: + sw $v0, 176($sp) # internal_7 = "1" - # Allocating A + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_7 + lw $t0, 188($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 184($sp) # internal_8 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_6 = internal_8 + lw $t0, 172($sp) + sw $t0, 180($sp) + + # If internal_6 then goto then_8781702324146 + lw $t0, 180($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8781702324146 + + # Jumping to else_8781702324146 + j else_8781702324146 + + then_8781702324146: + + # Allocating Int 1 li $v0, 9 - lw $a0, type_A + addi $a0, $zero, 12 syscall - la $t0, type_A # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_4 = address of allocated object A - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 168($sp) # internal_9 = address of allocated object Int - # Argument internal_4 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_4 + # internal_5 = internal_9 + lw $t0, 168($sp) + sw $t0, 184($sp) - # Calling function function___init___at_A - jal function___init___at_A - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_4 = result of function___init___at_A - addi $sp, $sp, 8 # Freeing space for arguments + # Jumping to endif_8781702324146 + j endif_8781702324146 - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + else_8781702324146: - # Argument internal_4 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_4 + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Argument x - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing x + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_11 = address of allocated object Int - # Calling function function_set_var_at_A - jal function_set_var_at_A - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_5 = result of function_set_var_at_A - addi $sp, $sp, 12 # Freeing space for arguments + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - # Loading return value in $v1 - lw $v1, 0($sp) + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - # Freeing space for local variables - addi $sp, $sp, 24 + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - jr $ra + addi $t0, $zero, 50 + sb $t0, 8($v0) # internal_12[0] = '2' - function_method5_at_C: - # Function parameters - # $ra = 28($sp) - # self = 24($sp) - # num = 20($sp) + sb $zero, 9($v0) # Null-terminator at the end of the string - # Reserving space for local variables - addi $sp, $sp, -20 + sw $v0, 156($sp) # internal_12 = "2" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument num - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing num + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char - # Argument num - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing num + # Argument internal_12 + lw $t0, 168($sp) + sw $t0, 0($sp) # Storing internal_12 - # Calling function function_mult - jal function_mult + # Calling function function_equal + jal function_equal lw $ra, 8($sp) - sw $v1, 24($sp) # internal_1 = result of function_mult + sw $v1, 164($sp) # internal_13 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + # internal_11 = internal_13 + lw $t0, 152($sp) + sw $t0, 160($sp) - # Argument internal_1 - lw $t0, 24($sp) - sw $t0, 4($sp) # Storing internal_1 + # If internal_11 then goto then_8781702324140 + lw $t0, 160($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8781702324140 - # Argument num - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing num + # Jumping to else_8781702324140 + j else_8781702324140 - # Calling function function_mult - jal function_mult - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_2 = result of function_mult - addi $sp, $sp, 12 # Freeing space for arguments + then_8781702324140: + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 148($sp) # internal_14 = address of allocated object Int + + # internal_10 = internal_14 + lw $t0, 148($sp) + sw $t0, 164($sp) - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 16($sp) - j end_assign - not_is_Bool_or_Int: - # x = internal_2 - lw $t0, 8($sp) - sw $t0, 16($sp) - end_assign: + # Jumping to endif_8781702324140 + j endif_8781702324140 - # Allocating E + else_8781702324140: + + # Allocating Bool 0 li $v0, 9 - lw $a0, type_E + addi $a0, $zero, 12 syscall - la $t0, type_E # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_3 = address of allocated object E - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 140($sp) # internal_16 = address of allocated object Int - # Argument internal_3 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_3 + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - # Calling function function___init___at_E - jal function___init___at_E - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_3 = result of function___init___at_E - addi $sp, $sp, 8 # Freeing space for arguments + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 51 + sb $t0, 8($v0) # internal_17[0] = '3' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 136($sp) # internal_17 = "3" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_3 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_3 + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char - # Argument x - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing x + # Argument internal_17 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_17 - # Calling function function_set_var_at_A - jal function_set_var_at_A + # Calling function function_equal + jal function_equal lw $ra, 8($sp) - sw $v1, 12($sp) # internal_4 = result of function_set_var_at_A + sw $v1, 144($sp) # internal_18 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 20 + # internal_16 = internal_18 + lw $t0, 132($sp) + sw $t0, 140($sp) - jr $ra + # If internal_16 then goto then_8781702324134 + lw $t0, 140($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8781702324134 - function___init___at_D: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) + # Jumping to else_8781702324134 + j else_8781702324134 - # Reserving space for local variables - addi $sp, $sp, -4 + then_8781702324134: - # Allocating Int 0 + # Allocating Int 3 li $v0, 9 addi $a0, $zero, 12 syscall @@ -2113,49 +3891,18 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Set attribute var of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_0 - sw $t1, 8($t0) # self.var = internal_0 - - # Loading return value in $v1 - lw $v1, 4($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_method7_at_D: - # Function parameters - # $ra = 116($sp) - # self = 112($sp) - # num = 108($sp) + sw $v0, 128($sp) # internal_19 = address of allocated object Int - # Reserving space for local variables - addi $sp, $sp, -108 + # internal_15 = internal_19 + lw $t0, 128($sp) + sw $t0, 144($sp) - lw $t0, 108($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 104($sp) - j end_assign - not_is_Bool_or_Int: - # x = num - lw $t0, 108($sp) - sw $t0, 104($sp) - end_assign: + # Jumping to endif_8781702324134 + j endif_8781702324134 + else_8781702324134: # Allocating Bool 0 li $v0, 9 @@ -2167,126 +3914,163 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 96($sp) # internal_2 = address of allocated object Int + sw $v0, 120($sp) # internal_21 = address of allocated object Int - # Allocating Int 0 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 92($sp) # internal_3 = address of allocated object Int + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 52 + sb $t0, 8($v0) # internal_22[0] = '4' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 116($sp) # internal_22 = "4" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument x - lw $t0, 116($sp) - sw $t0, 4($sp) # Storing x + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char - # Argument internal_3 - lw $t0, 104($sp) - sw $t0, 0($sp) # Storing internal_3 + # Argument internal_22 + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing internal_22 - # Calling function function_less_than - jal function_less_than + # Calling function function_equal + jal function_equal lw $ra, 8($sp) - sw $v1, 100($sp) # internal_4 = result of function_less_than + sw $v1, 124($sp) # internal_23 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 88($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 96($sp) - j end_assign - not_is_Bool_or_Int: - # internal_2 = internal_4 - lw $t0, 88($sp) - sw $t0, 96($sp) - end_assign: + # internal_21 = internal_23 + lw $t0, 112($sp) + sw $t0, 120($sp) - # If internal_2 then goto then_8792981815568 - lw $t0, 96($sp) # Loading the address of the condition + # If internal_21 then goto then_8781702324128 + lw $t0, 120($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981815568 + beq $t0, $t1, then_8781702324128 - # Jumping to else_8792981815568 - j else_8792981815568 + # Jumping to else_8781702324128 + j else_8781702324128 - then_8792981815568: + then_8781702324128: - # Xor operation - lw $t0, 104($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 80($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall - lw $t0, 76($sp) # $t0 = internal_7 - sw $t2, 8($t0) # Setting value in the third word of the Int object + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_24 = address of allocated object Int - # Addition operation - lw $t0, 76($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 84($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - add $t2, $t0, $t1 # $t2 = $t0 + $t1 + # internal_20 = internal_24 + lw $t0, 108($sp) + sw $t0, 124($sp) - lw $t0, 76($sp) # $t0 = internal_7 - sw $t2, 8($t0) # Setting value in the third word of the Int object + # Jumping to endif_8781702324128 + j endif_8781702324128 + + else_8781702324128: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_26 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 53 + sb $t0, 8($v0) # internal_27[0] = '5' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 96($sp) # internal_27 = "5" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 124($sp) - sw $t0, 4($sp) # Storing self + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char - # Argument internal_7 - lw $t0, 88($sp) - sw $t0, 0($sp) # Storing internal_7 + # Argument internal_27 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_27 - # Calling function function_method7_at_D - jal function_method7_at_D + # Calling function function_equal + jal function_equal lw $ra, 8($sp) - sw $v1, 84($sp) # internal_8 = result of function_method7_at_D + sw $v1, 104($sp) # internal_28 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 72($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 100($sp) - j end_assign - not_is_Bool_or_Int: - # internal_1 = internal_8 - lw $t0, 72($sp) + # internal_26 = internal_28 + lw $t0, 92($sp) sw $t0, 100($sp) - end_assign: - # Jumping to endif_8792981815568 - j endif_8792981815568 + # If internal_26 then goto then_8781702324122 + lw $t0, 100($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8781702324122 + + # Jumping to else_8781702324122 + j else_8781702324122 + + then_8781702324122: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_29 = address of allocated object Int + + # internal_25 = internal_29 + lw $t0, 88($sp) + sw $t0, 104($sp) - else_8792981815568: + # Jumping to endif_8781702324122 + j endif_8781702324122 + else_8781702324122: # Allocating Bool 0 li $v0, 9 @@ -2298,100 +4082,79 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 64($sp) # internal_10 = address of allocated object Int + sw $v0, 80($sp) # internal_31 = address of allocated object Int - # Allocating Int 0 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_11 = address of allocated object Int + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 54 + sb $t0, 8($v0) # internal_32[0] = '6' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 76($sp) # internal_32 = "6" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_11 - lw $t0, 72($sp) - sw $t0, 4($sp) # Storing internal_11 + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char - # Argument x - lw $t0, 116($sp) - sw $t0, 0($sp) # Storing x + # Argument internal_32 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_32 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 68($sp) # internal_12 = result of function_equal + sw $v1, 84($sp) # internal_33 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 56($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 64($sp) - j end_assign - not_is_Bool_or_Int: - # internal_10 = internal_12 - lw $t0, 56($sp) - sw $t0, 64($sp) - end_assign: + # internal_31 = internal_33 + lw $t0, 72($sp) + sw $t0, 80($sp) - # If internal_10 then goto then_8792981815559 - lw $t0, 64($sp) # Loading the address of the condition + # If internal_31 then goto then_8781702324116 + lw $t0, 80($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981815559 + beq $t0, $t1, then_8781702324116 - # Jumping to else_8792981815559 - j else_8792981815559 + # Jumping to else_8781702324116 + j else_8781702324116 - then_8792981815559: + then_8781702324116: - # Allocating Bool 1 + # Allocating Int 6 li $v0, 9 addi $a0, $zero, 12 syscall - la $t0, type_Bool # $t0 = address of the type + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 6 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 52($sp) # internal_13 = address of allocated object Int - - lw $t0, 52($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 68($sp) - j end_assign - not_is_Bool_or_Int: - # internal_9 = internal_13 - lw $t0, 52($sp) - sw $t0, 68($sp) - end_assign: + sw $v0, 68($sp) # internal_34 = address of allocated object Int - # Jumping to endif_8792981815559 - j endif_8792981815559 + # internal_30 = internal_34 + lw $t0, 68($sp) + sw $t0, 84($sp) - else_8792981815559: + # Jumping to endif_8781702324116 + j endif_8781702324116 + else_8781702324116: # Allocating Bool 0 li $v0, 9 @@ -2403,100 +4166,79 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_15 = address of allocated object Int + sw $v0, 60($sp) # internal_36 = address of allocated object Int - # Allocating Int 1 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_16 = address of allocated object Int + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 55 + sb $t0, 8($v0) # internal_37[0] = '7' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 56($sp) # internal_37 = "7" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_16 - lw $t0, 52($sp) - sw $t0, 4($sp) # Storing internal_16 + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char - # Argument x - lw $t0, 116($sp) - sw $t0, 0($sp) # Storing x + # Argument internal_37 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_37 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 48($sp) # internal_17 = result of function_equal + sw $v1, 64($sp) # internal_38 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 36($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: - # internal_15 = internal_17 - lw $t0, 36($sp) - sw $t0, 44($sp) - end_assign: + # internal_36 = internal_38 + lw $t0, 52($sp) + sw $t0, 60($sp) - # If internal_15 then goto then_8792981815290 - lw $t0, 44($sp) # Loading the address of the condition + # If internal_36 then goto then_8781702324110 + lw $t0, 60($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981815290 + beq $t0, $t1, then_8781702324110 - # Jumping to else_8792981815290 - j else_8792981815290 + # Jumping to else_8781702324110 + j else_8781702324110 - then_8792981815290: + then_8781702324110: - # Allocating Bool 0 + # Allocating Int 7 li $v0, 9 addi $a0, $zero, 12 syscall - la $t0, type_Bool # $t0 = address of the type + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 7 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_18 = address of allocated object Int - - lw $t0, 32($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 48($sp) - j end_assign - not_is_Bool_or_Int: - # internal_14 = internal_18 - lw $t0, 32($sp) - sw $t0, 48($sp) - end_assign: + sw $v0, 48($sp) # internal_39 = address of allocated object Int - # Jumping to endif_8792981815290 - j endif_8792981815290 + # internal_35 = internal_39 + lw $t0, 48($sp) + sw $t0, 64($sp) - else_8792981815290: + # Jumping to endif_8781702324110 + j endif_8781702324110 + else_8781702324110: # Allocating Bool 0 li $v0, 9 @@ -2508,253 +4250,144 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_20 = address of allocated object Int + sw $v0, 40($sp) # internal_41 = address of allocated object Int - # Allocating Int 2 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 2 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_21 = address of allocated object Int + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 56 + sb $t0, 8($v0) # internal_42[0] = '8' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 36($sp) # internal_42 = "8" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_21 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_21 + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char - # Argument x - lw $t0, 116($sp) - sw $t0, 0($sp) # Storing x + # Argument internal_42 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_42 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 28($sp) # internal_22 = result of function_equal + sw $v1, 44($sp) # internal_43 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: - # internal_20 = internal_22 - lw $t0, 16($sp) - sw $t0, 24($sp) - end_assign: + # internal_41 = internal_43 + lw $t0, 32($sp) + sw $t0, 40($sp) - # If internal_20 then goto then_8792981815556 - lw $t0, 24($sp) # Loading the address of the condition + # If internal_41 then goto then_8781702324104 + lw $t0, 40($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981815556 + beq $t0, $t1, then_8781702324104 - # Jumping to else_8792981815556 - j else_8792981815556 + # Jumping to else_8781702324104 + j else_8781702324104 - then_8792981815556: + then_8781702324104: - # Allocating Bool 0 + # Allocating Int 8 li $v0, 9 addi $a0, $zero, 12 syscall - la $t0, type_Bool # $t0 = address of the type + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 8 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_23 = address of allocated object Int + sw $v0, 28($sp) # internal_44 = address of allocated object Int - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 28($sp) - j end_assign - not_is_Bool_or_Int: - # internal_19 = internal_23 - lw $t0, 12($sp) - sw $t0, 28($sp) - end_assign: + # internal_40 = internal_44 + lw $t0, 28($sp) + sw $t0, 44($sp) - # Jumping to endif_8792981815556 - j endif_8792981815556 + # Jumping to endif_8781702324104 + j endif_8781702324104 - else_8792981815556: + else_8781702324104: - # Allocating Int 3 + # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_Bool # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 3 + addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_24 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument x - lw $t0, 116($sp) - sw $t0, 4($sp) # Storing x - - # Argument internal_24 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_24 - - # Calling function function_sub - jal function_sub - lw $ra, 8($sp) - sw $v1, 16($sp) # internal_25 = result of function_sub - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 124($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_25 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_25 - - # Calling function function_method7_at_D - jal function_method7_at_D - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_26 = result of function_method7_at_D - addi $sp, $sp, 12 # Freeing space for arguments - - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 28($sp) - j end_assign - not_is_Bool_or_Int: - # internal_19 = internal_26 - lw $t0, 0($sp) - sw $t0, 28($sp) - end_assign: - - # Jumping to endif_8792981815556 - j endif_8792981815556 - - endif_8792981815556: - - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 48($sp) - j end_assign - not_is_Bool_or_Int: - # internal_14 = internal_19 - lw $t0, 28($sp) - sw $t0, 48($sp) - end_assign: + sw $v0, 20($sp) # internal_46 = address of allocated object Int - # Jumping to endif_8792981815290 - j endif_8792981815290 + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - endif_8792981815290: + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - lw $t0, 48($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 68($sp) - j end_assign - not_is_Bool_or_Int: - # internal_9 = internal_14 - lw $t0, 48($sp) - sw $t0, 68($sp) - end_assign: + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - # Jumping to endif_8792981815559 - j endif_8792981815559 + addi $t0, $zero, 57 + sb $t0, 8($v0) # internal_47[0] = '9' - endif_8792981815559: + sb $zero, 9($v0) # Null-terminator at the end of the string - lw $t0, 68($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 100($sp) - j end_assign - not_is_Bool_or_Int: - # internal_1 = internal_9 - lw $t0, 68($sp) - sw $t0, 100($sp) - end_assign: + sw $v0, 16($sp) # internal_47 = "9" - # Jumping to endif_8792981815568 - j endif_8792981815568 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - endif_8792981815568: + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char - # Loading return value in $v1 - lw $v1, 100($sp) + # Argument internal_47 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_47 - # Freeing space for local variables - addi $sp, $sp, 108 + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_48 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments - jr $ra + # internal_46 = internal_48 + lw $t0, 12($sp) + sw $t0, 20($sp) - function___init___at_E: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) + # If internal_46 then goto then_8781702324083 + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8781702324083 - # Reserving space for local variables - addi $sp, $sp, -4 + # Jumping to else_8781702324083 + j else_8781702324083 - # Allocating Int 0 + then_8781702324083: + + # Allocating Int 9 li $v0, 9 addi $a0, $zero, 12 syscall @@ -2762,33 +4395,34 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 9 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int + sw $v0, 8($sp) # internal_49 = address of allocated object Int - # Set attribute var of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_0 - sw $t1, 8($t0) # self.var = internal_0 + # internal_45 = internal_49 + lw $t0, 8($sp) + sw $t0, 24($sp) - # Loading return value in $v1 - lw $v1, 4($sp) + # Jumping to endif_8781702324083 + j endif_8781702324083 - # Freeing space for local variables - addi $sp, $sp, 4 + else_8781702324083: - jr $ra + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - function_method6_at_E: - # Function parameters - # $ra = 28($sp) - # self = 24($sp) - # num = 20($sp) + # Argument self + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing self - # Reserving space for local variables - addi $sp, $sp, -20 + # Calling function function_abort_at_Object + jal function_abort_at_Object + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_50 = result of function_abort_at_Object + addi $sp, $sp, 8 # Freeing space for arguments - # Allocating Int 8 + # Allocating Int 0 li $v0, 9 addi $a0, $zero, 12 syscall @@ -2796,114 +4430,117 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 8 + addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_1 = address of allocated object Int + sw $v0, 0($sp) # internal_51 = address of allocated object Int - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + # internal_45 = internal_51 + lw $t0, 0($sp) + sw $t0, 24($sp) - # Argument num - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing num + # Jumping to endif_8781702324083 + j endif_8781702324083 - # Argument internal_1 + endif_8781702324083: + + # internal_40 = internal_45 lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_1 + sw $t0, 44($sp) - # Calling function function_div - jal function_div - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_2 = result of function_div - addi $sp, $sp, 12 # Freeing space for arguments + # Jumping to endif_8781702324104 + j endif_8781702324104 - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 16($sp) - j end_assign - not_is_Bool_or_Int: - # x = internal_2 - lw $t0, 8($sp) - sw $t0, 16($sp) - end_assign: + endif_8781702324104: - # Allocating A - li $v0, 9 - lw $a0, type_A - syscall - la $t0, type_A # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_3 = address of allocated object A + # internal_35 = internal_40 + lw $t0, 44($sp) + sw $t0, 64($sp) - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + # Jumping to endif_8781702324110 + j endif_8781702324110 - # Argument internal_3 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_3 + endif_8781702324110: - # Calling function function___init___at_A - jal function___init___at_A - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_3 = result of function___init___at_A - addi $sp, $sp, 8 # Freeing space for arguments + # internal_30 = internal_35 + lw $t0, 64($sp) + sw $t0, 84($sp) - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + # Jumping to endif_8781702324116 + j endif_8781702324116 - # Argument internal_3 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_3 + endif_8781702324116: - # Argument x - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing x + # internal_25 = internal_30 + lw $t0, 84($sp) + sw $t0, 104($sp) - # Calling function function_set_var_at_A - jal function_set_var_at_A - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_4 = result of function_set_var_at_A - addi $sp, $sp, 12 # Freeing space for arguments + # Jumping to endif_8781702324122 + j endif_8781702324122 - # Loading return value in $v1 - lw $v1, 0($sp) + endif_8781702324122: - # Freeing space for local variables - addi $sp, $sp, 20 + # internal_20 = internal_25 + lw $t0, 104($sp) + sw $t0, 124($sp) - jr $ra + # Jumping to endif_8781702324128 + j endif_8781702324128 - function___init___at_A2I: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) + endif_8781702324128: + + # internal_15 = internal_20 + lw $t0, 124($sp) + sw $t0, 144($sp) + + # Jumping to endif_8781702324134 + j endif_8781702324134 + + endif_8781702324134: + + # internal_10 = internal_15 + lw $t0, 144($sp) + sw $t0, 164($sp) + + # Jumping to endif_8781702324140 + j endif_8781702324140 + + endif_8781702324140: + + # internal_5 = internal_10 + lw $t0, 164($sp) + sw $t0, 184($sp) + + # Jumping to endif_8781702324146 + j endif_8781702324146 + + endif_8781702324146: + + # internal_0 = internal_5 + lw $t0, 184($sp) + sw $t0, 204($sp) + + # Jumping to endif_8781702324152 + j endif_8781702324152 + + endif_8781702324152: # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 204($sp) + + # Freeing space for local variables + addi $sp, $sp, 208 jr $ra - function_c2i_at_A2I: + function_i2c_at_A2I: # Function parameters # $ra = 216($sp) # self = 212($sp) - # char = 208($sp) + # i = 208($sp) # Reserving space for local variables addi $sp, $sp, -208 - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -2916,31 +4553,25 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 200($sp) # internal_1 = address of allocated object Int - # Allocating String + # Allocating Int 0 li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 48 - sb $t0, 8($v0) # internal_2[0] = '0' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 196($sp) # internal_2 = "0" + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 196($sp) # internal_2 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument char + # Argument i lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char + sw $t0, 4($sp) # Storing i # Argument internal_2 lw $t0, 208($sp) @@ -2952,68 +4583,47 @@ sw $v1, 204($sp) # internal_3 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 192($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 200($sp) - j end_assign - not_is_Bool_or_Int: # internal_1 = internal_3 lw $t0, 192($sp) sw $t0, 200($sp) - end_assign: - # If internal_1 then goto then_8792981816474 + # If internal_1 then goto then_8781702324730 lw $t0, 200($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981816474 + beq $t0, $t1, then_8781702324730 - # Jumping to else_8792981816474 - j else_8792981816474 + # Jumping to else_8781702324730 + j else_8781702324730 - then_8792981816474: + then_8781702324730: - # Allocating Int 0 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 188($sp) # internal_4 = address of allocated object Int - lw $t0, 188($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 204($sp) - j end_assign - not_is_Bool_or_Int: + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 48 + sb $t0, 8($v0) # internal_4[0] = '0' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 188($sp) # internal_4 = "0" + # internal_0 = internal_4 lw $t0, 188($sp) sw $t0, 204($sp) - end_assign: - # Jumping to endif_8792981816474 - j endif_8792981816474 - - else_8792981816474: + # Jumping to endif_8781702324730 + j endif_8781702324730 + else_8781702324730: # Allocating Bool 0 li $v0, 9 @@ -3027,31 +4637,25 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 180($sp) # internal_6 = address of allocated object Int - # Allocating String + # Allocating Int 1 li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object - + sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 49 - sb $t0, 8($v0) # internal_7[0] = '1' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 176($sp) # internal_7 = "1" + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 176($sp) # internal_7 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument char + # Argument i lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char + sw $t0, 4($sp) # Storing i # Argument internal_7 lw $t0, 188($sp) @@ -3063,68 +4667,47 @@ sw $v1, 184($sp) # internal_8 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 172($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 180($sp) - j end_assign - not_is_Bool_or_Int: # internal_6 = internal_8 lw $t0, 172($sp) sw $t0, 180($sp) - end_assign: - # If internal_6 then goto then_8792981816468 + # If internal_6 then goto then_8781702324724 lw $t0, 180($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981816468 + beq $t0, $t1, then_8781702324724 - # Jumping to else_8792981816468 - j else_8792981816468 + # Jumping to else_8781702324724 + j else_8781702324724 - then_8792981816468: + then_8781702324724: - # Allocating Int 1 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 168($sp) # internal_9 = address of allocated object Int - lw $t0, 168($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 184($sp) - j end_assign - not_is_Bool_or_Int: + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 49 + sb $t0, 8($v0) # internal_9[0] = '1' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 168($sp) # internal_9 = "1" + # internal_5 = internal_9 lw $t0, 168($sp) sw $t0, 184($sp) - end_assign: - - # Jumping to endif_8792981816468 - j endif_8792981816468 - else_8792981816468: + # Jumping to endif_8781702324724 + j endif_8781702324724 + else_8781702324724: # Allocating Bool 0 li $v0, 9 @@ -3138,31 +4721,25 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 160($sp) # internal_11 = address of allocated object Int - # Allocating String + # Allocating Int 2 li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 50 - sb $t0, 8($v0) # internal_12[0] = '2' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 156($sp) # internal_12 = "2" + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 156($sp) # internal_12 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument char + # Argument i lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char + sw $t0, 4($sp) # Storing i # Argument internal_12 lw $t0, 168($sp) @@ -3174,68 +4751,47 @@ sw $v1, 164($sp) # internal_13 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 152($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 160($sp) - j end_assign - not_is_Bool_or_Int: # internal_11 = internal_13 lw $t0, 152($sp) sw $t0, 160($sp) - end_assign: - # If internal_11 then goto then_8792981816462 + # If internal_11 then goto then_8781702324718 lw $t0, 160($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981816462 + beq $t0, $t1, then_8781702324718 - # Jumping to else_8792981816462 - j else_8792981816462 + # Jumping to else_8781702324718 + j else_8781702324718 - then_8792981816462: + then_8781702324718: - # Allocating Int 2 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 2 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 148($sp) # internal_14 = address of allocated object Int - lw $t0, 148($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 164($sp) - j end_assign - not_is_Bool_or_Int: + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 50 + sb $t0, 8($v0) # internal_14[0] = '2' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 148($sp) # internal_14 = "2" + # internal_10 = internal_14 lw $t0, 148($sp) sw $t0, 164($sp) - end_assign: - # Jumping to endif_8792981816462 - j endif_8792981816462 - - else_8792981816462: + # Jumping to endif_8781702324718 + j endif_8781702324718 + else_8781702324718: # Allocating Bool 0 li $v0, 9 @@ -3249,31 +4805,25 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 140($sp) # internal_16 = address of allocated object Int - # Allocating String + # Allocating Int 3 li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 51 - sb $t0, 8($v0) # internal_17[0] = '3' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 136($sp) # internal_17 = "3" + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_17 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument char + # Argument i lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char + sw $t0, 4($sp) # Storing i # Argument internal_17 lw $t0, 148($sp) @@ -3285,68 +4835,47 @@ sw $v1, 144($sp) # internal_18 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 132($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 140($sp) - j end_assign - not_is_Bool_or_Int: # internal_16 = internal_18 lw $t0, 132($sp) sw $t0, 140($sp) - end_assign: - # If internal_16 then goto then_8792981816456 + # If internal_16 then goto then_8781702324712 lw $t0, 140($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981816456 + beq $t0, $t1, then_8781702324712 - # Jumping to else_8792981816456 - j else_8792981816456 + # Jumping to else_8781702324712 + j else_8781702324712 - then_8792981816456: + then_8781702324712: - # Allocating Int 3 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 3 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 128($sp) # internal_19 = address of allocated object Int - lw $t0, 128($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 144($sp) - j end_assign - not_is_Bool_or_Int: + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 51 + sb $t0, 8($v0) # internal_19[0] = '3' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 128($sp) # internal_19 = "3" + # internal_15 = internal_19 lw $t0, 128($sp) sw $t0, 144($sp) - end_assign: - - # Jumping to endif_8792981816456 - j endif_8792981816456 - else_8792981816456: + # Jumping to endif_8781702324712 + j endif_8781702324712 + else_8781702324712: # Allocating Bool 0 li $v0, 9 @@ -3360,31 +4889,25 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 120($sp) # internal_21 = address of allocated object Int - # Allocating String + # Allocating Int 4 li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 52 - sb $t0, 8($v0) # internal_22[0] = '4' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 116($sp) # internal_22 = "4" + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 116($sp) # internal_22 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument char + # Argument i lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char + sw $t0, 4($sp) # Storing i # Argument internal_22 lw $t0, 128($sp) @@ -3396,68 +4919,47 @@ sw $v1, 124($sp) # internal_23 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 112($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 120($sp) - j end_assign - not_is_Bool_or_Int: # internal_21 = internal_23 lw $t0, 112($sp) sw $t0, 120($sp) - end_assign: - # If internal_21 then goto then_8792981816450 + # If internal_21 then goto then_8781702324706 lw $t0, 120($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981816450 + beq $t0, $t1, then_8781702324706 - # Jumping to else_8792981816450 - j else_8792981816450 + # Jumping to else_8781702324706 + j else_8781702324706 - then_8792981816450: + then_8781702324706: - # Allocating Int 4 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 4 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 108($sp) # internal_24 = address of allocated object Int - lw $t0, 108($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 124($sp) - j end_assign - not_is_Bool_or_Int: + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 52 + sb $t0, 8($v0) # internal_24[0] = '4' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 108($sp) # internal_24 = "4" + # internal_20 = internal_24 lw $t0, 108($sp) sw $t0, 124($sp) - end_assign: - # Jumping to endif_8792981816450 - j endif_8792981816450 - - else_8792981816450: + # Jumping to endif_8781702324706 + j endif_8781702324706 + else_8781702324706: # Allocating Bool 0 li $v0, 9 @@ -3471,31 +4973,25 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 100($sp) # internal_26 = address of allocated object Int - # Allocating String + # Allocating Int 5 li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 53 - sb $t0, 8($v0) # internal_27[0] = '5' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 96($sp) # internal_27 = "5" + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_27 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument char + # Argument i lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char + sw $t0, 4($sp) # Storing i # Argument internal_27 lw $t0, 108($sp) @@ -3507,68 +5003,47 @@ sw $v1, 104($sp) # internal_28 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 92($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 100($sp) - j end_assign - not_is_Bool_or_Int: # internal_26 = internal_28 lw $t0, 92($sp) sw $t0, 100($sp) - end_assign: - # If internal_26 then goto then_8792981816444 + # If internal_26 then goto then_8781702324700 lw $t0, 100($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981816444 + beq $t0, $t1, then_8781702324700 - # Jumping to else_8792981816444 - j else_8792981816444 + # Jumping to else_8781702324700 + j else_8781702324700 - then_8792981816444: + then_8781702324700: - # Allocating Int 5 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 5 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 88($sp) # internal_29 = address of allocated object Int - lw $t0, 88($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 104($sp) - j end_assign - not_is_Bool_or_Int: + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 53 + sb $t0, 8($v0) # internal_29[0] = '5' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 88($sp) # internal_29 = "5" + # internal_25 = internal_29 lw $t0, 88($sp) sw $t0, 104($sp) - end_assign: - - # Jumping to endif_8792981816444 - j endif_8792981816444 - else_8792981816444: + # Jumping to endif_8781702324700 + j endif_8781702324700 + else_8781702324700: # Allocating Bool 0 li $v0, 9 @@ -3582,31 +5057,25 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 80($sp) # internal_31 = address of allocated object Int - # Allocating String + # Allocating Int 6 li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 54 - sb $t0, 8($v0) # internal_32[0] = '6' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 76($sp) # internal_32 = "6" + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_32 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument char + # Argument i lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char + sw $t0, 4($sp) # Storing i # Argument internal_32 lw $t0, 88($sp) @@ -3618,68 +5087,47 @@ sw $v1, 84($sp) # internal_33 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 72($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 80($sp) - j end_assign - not_is_Bool_or_Int: # internal_31 = internal_33 lw $t0, 72($sp) sw $t0, 80($sp) - end_assign: - # If internal_31 then goto then_8792981816438 + # If internal_31 then goto then_8781702324694 lw $t0, 80($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981816438 + beq $t0, $t1, then_8781702324694 - # Jumping to else_8792981816438 - j else_8792981816438 + # Jumping to else_8781702324694 + j else_8781702324694 - then_8792981816438: + then_8781702324694: - # Allocating Int 6 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 6 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 68($sp) # internal_34 = address of allocated object Int + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 54 + sb $t0, 8($v0) # internal_34[0] = '6' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 68($sp) # internal_34 = "6" - lw $t0, 68($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 84($sp) - j end_assign - not_is_Bool_or_Int: # internal_30 = internal_34 lw $t0, 68($sp) sw $t0, 84($sp) - end_assign: - # Jumping to endif_8792981816438 - j endif_8792981816438 - - else_8792981816438: + # Jumping to endif_8781702324694 + j endif_8781702324694 + else_8781702324694: # Allocating Bool 0 li $v0, 9 @@ -3693,31 +5141,25 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 60($sp) # internal_36 = address of allocated object Int - # Allocating String + # Allocating Int 7 li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 55 - sb $t0, 8($v0) # internal_37[0] = '7' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 56($sp) # internal_37 = "7" + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_37 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument char + # Argument i lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char + sw $t0, 4($sp) # Storing i # Argument internal_37 lw $t0, 68($sp) @@ -3729,68 +5171,47 @@ sw $v1, 64($sp) # internal_38 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 52($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: # internal_36 = internal_38 lw $t0, 52($sp) sw $t0, 60($sp) - end_assign: - # If internal_36 then goto then_8792981816432 + # If internal_36 then goto then_8781702324688 lw $t0, 60($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981816432 + beq $t0, $t1, then_8781702324688 - # Jumping to else_8792981816432 - j else_8792981816432 + # Jumping to else_8781702324688 + j else_8781702324688 - then_8792981816432: + then_8781702324688: - # Allocating Int 7 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 7 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_39 = address of allocated object Int - lw $t0, 48($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 64($sp) - j end_assign - not_is_Bool_or_Int: + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 55 + sb $t0, 8($v0) # internal_39[0] = '7' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 48($sp) # internal_39 = "7" + # internal_35 = internal_39 lw $t0, 48($sp) sw $t0, 64($sp) - end_assign: - - # Jumping to endif_8792981816432 - j endif_8792981816432 - else_8792981816432: + # Jumping to endif_8781702324688 + j endif_8781702324688 + else_8781702324688: # Allocating Bool 0 li $v0, 9 @@ -3804,31 +5225,25 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 40($sp) # internal_41 = address of allocated object Int - # Allocating String + # Allocating Int 8 li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 56 - sb $t0, 8($v0) # internal_42[0] = '8' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 36($sp) # internal_42 = "8" + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_42 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument char + # Argument i lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char + sw $t0, 4($sp) # Storing i # Argument internal_42 lw $t0, 48($sp) @@ -3840,68 +5255,47 @@ sw $v1, 44($sp) # internal_43 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 32($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: # internal_41 = internal_43 lw $t0, 32($sp) sw $t0, 40($sp) - end_assign: - # If internal_41 then goto then_8792981816426 + # If internal_41 then goto then_8781702324682 lw $t0, 40($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981816426 + beq $t0, $t1, then_8781702324682 - # Jumping to else_8792981816426 - j else_8792981816426 + # Jumping to else_8781702324682 + j else_8781702324682 - then_8792981816426: + then_8781702324682: - # Allocating Int 8 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 8 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_44 = address of allocated object Int - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 56 + sb $t0, 8($v0) # internal_44[0] = '8' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 28($sp) # internal_44 = "8" + # internal_40 = internal_44 lw $t0, 28($sp) sw $t0, 44($sp) - end_assign: - # Jumping to endif_8792981816426 - j endif_8792981816426 - - else_8792981816426: + # Jumping to endif_8781702324682 + j endif_8781702324682 + else_8781702324682: # Allocating Bool 0 li $v0, 9 @@ -3915,31 +5309,25 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 20($sp) # internal_46 = address of allocated object Int - # Allocating String + # Allocating Int 9 li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 57 - sb $t0, 8($v0) # internal_47[0] = '9' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 16($sp) # internal_47 = "9" + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_47 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument char + # Argument i lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char + sw $t0, 4($sp) # Storing i # Argument internal_47 lw $t0, 28($sp) @@ -3951,67 +5339,47 @@ sw $v1, 24($sp) # internal_48 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 20($sp) - j end_assign - not_is_Bool_or_Int: # internal_46 = internal_48 lw $t0, 12($sp) sw $t0, 20($sp) - end_assign: - # If internal_46 then goto then_8792981816405 + # If internal_46 then goto then_8781702324661 lw $t0, 20($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981816405 + beq $t0, $t1, then_8781702324661 - # Jumping to else_8792981816405 - j else_8792981816405 + # Jumping to else_8781702324661 + j else_8781702324661 - then_8792981816405: + then_8781702324661: - # Allocating Int 9 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 9 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_49 = address of allocated object Int - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 57 + sb $t0, 8($v0) # internal_49[0] = '9' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_49 = "9" + # internal_45 = internal_49 lw $t0, 8($sp) sw $t0, 24($sp) - end_assign: - # Jumping to endif_8792981816405 - j endif_8792981816405 + # Jumping to endif_8781702324661 + j endif_8781702324661 - else_8792981816405: + else_8781702324661: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments @@ -4027,237 +5395,110 @@ sw $v1, 12($sp) # internal_50 = result of function_abort_at_Object addi $sp, $sp, 8 # Freeing space for arguments - # Allocating Int 0 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_51 = address of allocated object Int - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_51 = "" + # internal_45 = internal_51 lw $t0, 0($sp) sw $t0, 24($sp) - end_assign: - # Jumping to endif_8792981816405 - j endif_8792981816405 + # Jumping to endif_8781702324661 + j endif_8781702324661 - endif_8792981816405: + endif_8781702324661: - lw $t0, 24($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: # internal_40 = internal_45 lw $t0, 24($sp) sw $t0, 44($sp) - end_assign: - # Jumping to endif_8792981816426 - j endif_8792981816426 + # Jumping to endif_8781702324682 + j endif_8781702324682 - endif_8792981816426: + endif_8781702324682: - lw $t0, 44($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 64($sp) - j end_assign - not_is_Bool_or_Int: # internal_35 = internal_40 lw $t0, 44($sp) sw $t0, 64($sp) - end_assign: - # Jumping to endif_8792981816432 - j endif_8792981816432 + # Jumping to endif_8781702324688 + j endif_8781702324688 - endif_8792981816432: + endif_8781702324688: - lw $t0, 64($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 84($sp) - j end_assign - not_is_Bool_or_Int: # internal_30 = internal_35 lw $t0, 64($sp) sw $t0, 84($sp) - end_assign: - # Jumping to endif_8792981816438 - j endif_8792981816438 + # Jumping to endif_8781702324694 + j endif_8781702324694 - endif_8792981816438: + endif_8781702324694: - lw $t0, 84($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 104($sp) - j end_assign - not_is_Bool_or_Int: # internal_25 = internal_30 lw $t0, 84($sp) sw $t0, 104($sp) - end_assign: - # Jumping to endif_8792981816444 - j endif_8792981816444 + # Jumping to endif_8781702324700 + j endif_8781702324700 - endif_8792981816444: + endif_8781702324700: - lw $t0, 104($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 124($sp) - j end_assign - not_is_Bool_or_Int: # internal_20 = internal_25 lw $t0, 104($sp) sw $t0, 124($sp) - end_assign: - # Jumping to endif_8792981816450 - j endif_8792981816450 + # Jumping to endif_8781702324706 + j endif_8781702324706 - endif_8792981816450: + endif_8781702324706: - lw $t0, 124($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 144($sp) - j end_assign - not_is_Bool_or_Int: # internal_15 = internal_20 lw $t0, 124($sp) sw $t0, 144($sp) - end_assign: - # Jumping to endif_8792981816456 - j endif_8792981816456 + # Jumping to endif_8781702324712 + j endif_8781702324712 - endif_8792981816456: + endif_8781702324712: - lw $t0, 144($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 164($sp) - j end_assign - not_is_Bool_or_Int: # internal_10 = internal_15 lw $t0, 144($sp) sw $t0, 164($sp) - end_assign: - # Jumping to endif_8792981816462 - j endif_8792981816462 + # Jumping to endif_8781702324718 + j endif_8781702324718 - endif_8792981816462: + endif_8781702324718: - lw $t0, 164($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 184($sp) - j end_assign - not_is_Bool_or_Int: # internal_5 = internal_10 lw $t0, 164($sp) sw $t0, 184($sp) - end_assign: - # Jumping to endif_8792981816468 - j endif_8792981816468 + # Jumping to endif_8781702324724 + j endif_8781702324724 - endif_8792981816468: + endif_8781702324724: - lw $t0, 184($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 204($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_5 lw $t0, 184($sp) sw $t0, 204($sp) - end_assign: - # Jumping to endif_8792981816474 - j endif_8792981816474 + # Jumping to endif_8781702324730 + j endif_8781702324730 - endif_8792981816474: + endif_8781702324730: # Loading return value in $v1 lw $v1, 204($sp) @@ -4265,17 +5506,108 @@ # Freeing space for local variables addi $sp, $sp, 208 - jr $ra + jr $ra + + function_a2i_at_A2I: + # Function parameters + # $ra = 152($sp) + # self = 148($sp) + # s = 144($sp) + + # Reserving space for local variables + addi $sp, $sp, -144 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 140($sp) # internal_2 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 144($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 140($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 136($sp) # internal_4 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_4 + lw $t0, 124($sp) + sw $t0, 136($sp) + + # If internal_1 then goto then_8781702325176 + lw $t0, 136($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8781702325176 + + # Jumping to else_8781702325176 + j else_8781702325176 + + then_8781702325176: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_5 = address of allocated object Int - function_i2c_at_A2I: - # Function parameters - # $ra = 216($sp) - # self = 212($sp) - # i = 208($sp) + # internal_0 = internal_5 + lw $t0, 120($sp) + sw $t0, 140($sp) - # Reserving space for local variables - addi $sp, $sp, -208 + # Jumping to endif_8781702325176 + j endif_8781702325176 + else_8781702325176: # Allocating Bool 0 li $v0, 9 @@ -4287,7 +5619,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 200($sp) # internal_1 = address of allocated object Int + sw $v0, 112($sp) # internal_7 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -4299,53 +5631,41 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 196($sp) # internal_2 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + sw $v0, 108($sp) # internal_8 = address of allocated object Int - # Argument i - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing i + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Argument internal_2 - lw $t0, 208($sp) - sw $t0, 0($sp) # Storing internal_2 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_9 = address of allocated object Int - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 204($sp) # internal_3 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address - lw $t0, 192($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 200($sp) - j end_assign - not_is_Bool_or_Int: - # internal_1 = internal_3 - lw $t0, 192($sp) - sw $t0, 200($sp) - end_assign: + # Argument s + lw $t0, 160($sp) + sw $t0, 8($sp) # Storing s - # If internal_1 then goto then_8792981817308 - lw $t0, 200($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981817308 + # Argument internal_8 + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing internal_8 - # Jumping to else_8792981817308 - j else_8792981817308 + # Argument internal_9 + lw $t0, 120($sp) + sw $t0, 0($sp) # Storing internal_9 - then_8792981817308: + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 116($sp) # internal_10 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments # Allocating String li $v0, 9 @@ -4355,50 +5675,74 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 48 - sb $t0, 8($v0) # internal_4[0] = '0' + addi $t0, $zero, 45 + sb $t0, 8($v0) # internal_11[0] = '-' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 188($sp) # internal_4 = "0" + sw $v0, 96($sp) # internal_11 = "-" - lw $t0, 188($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 204($sp) - j end_assign - not_is_Bool_or_Int: - # internal_0 = internal_4 - lw $t0, 188($sp) - sw $t0, 204($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_11 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 104($sp) # internal_12 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_7 = internal_12 + lw $t0, 92($sp) + sw $t0, 112($sp) - # Jumping to endif_8792981817308 - j endif_8792981817308 + # If internal_7 then goto then_8781702325191 + lw $t0, 112($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8781702325191 - else_8792981817308: + # Jumping to else_8781702325191 + j else_8781702325191 + then_8781702325191: - # Allocating Bool 0 + # Allocating Int 1 li $v0, 9 addi $a0, $zero, 12 syscall - la $t0, type_Bool # $t0 = address of the type + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 180($sp) # internal_6 = address of allocated object Int + sw $v0, 88($sp) # internal_13 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 92($sp) # internal_14 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 1 li $v0, 9 @@ -4410,94 +5754,146 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 176($sp) # internal_7 = address of allocated object Int + sw $v0, 80($sp) # internal_15 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument i - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing i + # Argument internal_14 + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing internal_14 - # Argument internal_7 - lw $t0, 188($sp) - sw $t0, 0($sp) # Storing internal_7 + # Argument internal_15 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_15 - # Calling function function_equal - jal function_equal + # Calling function function_sub + jal function_sub lw $ra, 8($sp) - sw $v1, 184($sp) # internal_8 = result of function_equal + sw $v1, 88($sp) # internal_16 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 172($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 180($sp) - j end_assign - not_is_Bool_or_Int: - # internal_6 = internal_8 - lw $t0, 172($sp) - sw $t0, 180($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address - # If internal_6 then goto then_8792981817302 - lw $t0, 180($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981817302 + # Argument s + lw $t0, 160($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_13 + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing internal_13 - # Jumping to else_8792981817302 - j else_8792981817302 + # Argument internal_16 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_16 - then_8792981817302: + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 88($sp) # internal_17 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments - # Allocating String + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_17 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_17 + + # Calling function function_a2i_aux_at_A2I + jal function_a2i_aux_at_A2I + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_18 = result of function_a2i_aux_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object - + sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_19 = address of allocated object Int - addi $t0, $zero, 49 - sb $t0, 8($v0) # internal_9[0] = '1' + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall - sb $zero, 9($v0) # Null-terminator at the end of the string + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_20 = address of allocated object Int - sw $v0, 168($sp) # internal_9 = "1" + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - lw $t0, 168($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 184($sp) - j end_assign - not_is_Bool_or_Int: - # internal_5 = internal_9 - lw $t0, 168($sp) - sw $t0, 184($sp) - end_assign: + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_21 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_18 + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing internal_18 + + # Argument internal_20 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_21 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_21 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_21 + + # Argument internal_19 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_19 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_21 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to endif_8792981817302 - j endif_8792981817302 + # internal_6 = internal_21 + lw $t0, 56($sp) + sw $t0, 116($sp) - else_8792981817302: + # Jumping to endif_8781702325191 + j endif_8781702325191 + else_8781702325191: # Allocating Bool 0 li $v0, 9 @@ -4509,9 +5905,9 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 160($sp) # internal_11 = address of allocated object Int + sw $v0, 48($sp) # internal_23 = address of allocated object Int - # Allocating Int 2 + # Allocating Int 0 li $v0, 9 addi $a0, $zero, 12 syscall @@ -4519,55 +5915,43 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 2 + addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 156($sp) # internal_12 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + sw $v0, 44($sp) # internal_24 = address of allocated object Int - # Argument i - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing i + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Argument internal_12 - lw $t0, 168($sp) - sw $t0, 0($sp) # Storing internal_12 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_25 = address of allocated object Int - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 164($sp) # internal_13 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address - lw $t0, 152($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 160($sp) - j end_assign - not_is_Bool_or_Int: - # internal_11 = internal_13 - lw $t0, 152($sp) - sw $t0, 160($sp) - end_assign: + # Argument s + lw $t0, 160($sp) + sw $t0, 8($sp) # Storing s - # If internal_11 then goto then_8792981817296 - lw $t0, 160($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981817296 + # Argument internal_24 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing internal_24 - # Jumping to else_8792981817296 - j else_8792981817296 + # Argument internal_25 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_25 - then_8792981817296: + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 52($sp) # internal_26 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments # Allocating String li $v0, 9 @@ -4577,52 +5961,76 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 50 - sb $t0, 8($v0) # internal_14[0] = '2' + addi $t0, $zero, 43 + sb $t0, 8($v0) # internal_27[0] = '+' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 148($sp) # internal_14 = "2" + sw $v0, 32($sp) # internal_27 = "+" - lw $t0, 148($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 164($sp) - j end_assign - not_is_Bool_or_Int: - # internal_10 = internal_14 - lw $t0, 148($sp) - sw $t0, 164($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_26 + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing internal_26 - # Jumping to endif_8792981817296 - j endif_8792981817296 + # Argument internal_27 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_27 - else_8792981817296: + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_28 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + # internal_23 = internal_28 + lw $t0, 28($sp) + sw $t0, 48($sp) - # Allocating Bool 0 + # If internal_23 then goto then_8781702325185 + lw $t0, 48($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8781702325185 + + # Jumping to else_8781702325185 + j else_8781702325185 + + then_8781702325185: + + # Allocating Int 1 li $v0, 9 addi $a0, $zero, 12 syscall - la $t0, type_Bool # $t0 = address of the type + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 140($sp) # internal_16 = address of allocated object Int + sw $v0, 24($sp) # internal_29 = address of allocated object Int - # Allocating Int 3 + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_30 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 li $v0, 9 addi $a0, $zero, 12 syscall @@ -4630,221 +6038,202 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 3 + addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 136($sp) # internal_17 = address of allocated object Int + sw $v0, 16($sp) # internal_31 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument i - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing i + # Argument internal_30 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_30 - # Argument internal_17 - lw $t0, 148($sp) - sw $t0, 0($sp) # Storing internal_17 + # Argument internal_31 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_31 - # Calling function function_equal - jal function_equal + # Calling function function_sub + jal function_sub lw $ra, 8($sp) - sw $v1, 144($sp) # internal_18 = result of function_equal + sw $v1, 24($sp) # internal_32 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 132($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 140($sp) - j end_assign - not_is_Bool_or_Int: - # internal_16 = internal_18 - lw $t0, 132($sp) - sw $t0, 140($sp) - end_assign: - - # If internal_16 then goto then_8792981817290 - lw $t0, 140($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981817290 - - # Jumping to else_8792981817290 - j else_8792981817290 - - then_8792981817290: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address - addi $t0, $zero, 51 - sb $t0, 8($v0) # internal_19[0] = '3' + # Argument s + lw $t0, 160($sp) + sw $t0, 8($sp) # Storing s - sb $zero, 9($v0) # Null-terminator at the end of the string + # Argument internal_29 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_29 - sw $v0, 128($sp) # internal_19 = "3" + # Argument internal_32 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_32 - lw $t0, 128($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 144($sp) - j end_assign - not_is_Bool_or_Int: - # internal_15 = internal_19 - lw $t0, 128($sp) - sw $t0, 144($sp) - end_assign: + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 24($sp) # internal_33 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments - # Jumping to endif_8792981817290 - j endif_8792981817290 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - else_8792981817290: + # Argument self + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing self + # Argument internal_33 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_33 - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + # Calling function function_a2i_aux_at_A2I + jal function_a2i_aux_at_A2I + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_34 = result of function_a2i_aux_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 120($sp) # internal_21 = address of allocated object Int + # internal_22 = internal_34 + lw $t0, 4($sp) + sw $t0, 52($sp) - # Allocating Int 4 - li $v0, 9 - addi $a0, $zero, 12 - syscall + # Jumping to endif_8781702325185 + j endif_8781702325185 - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 4 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 116($sp) # internal_22 = address of allocated object Int + else_8781702325185: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument i - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing i + # Argument self + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing self - # Argument internal_22 - lw $t0, 128($sp) - sw $t0, 0($sp) # Storing internal_22 + # Argument s + lw $t0, 156($sp) + sw $t0, 0($sp) # Storing s - # Calling function function_equal - jal function_equal + # Calling function function_a2i_aux_at_A2I + jal function_a2i_aux_at_A2I lw $ra, 8($sp) - sw $v1, 124($sp) # internal_23 = result of function_equal + sw $v1, 12($sp) # internal_35 = result of function_a2i_aux_at_A2I addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 112($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 120($sp) - j end_assign - not_is_Bool_or_Int: - # internal_21 = internal_23 - lw $t0, 112($sp) - sw $t0, 120($sp) - end_assign: - - # If internal_21 then goto then_8792981817284 - lw $t0, 120($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981817284 + # internal_22 = internal_35 + lw $t0, 0($sp) + sw $t0, 52($sp) - # Jumping to else_8792981817284 - j else_8792981817284 + # Jumping to endif_8781702325185 + j endif_8781702325185 - then_8792981817284: + endif_8781702325185: - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall + # internal_6 = internal_22 + lw $t0, 52($sp) + sw $t0, 116($sp) - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object + # Jumping to endif_8781702325191 + j endif_8781702325191 - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + endif_8781702325191: - addi $t0, $zero, 52 - sb $t0, 8($v0) # internal_24[0] = '4' + # internal_0 = internal_6 + lw $t0, 116($sp) + sw $t0, 140($sp) - sb $zero, 9($v0) # Null-terminator at the end of the string + # Jumping to endif_8781702325176 + j endif_8781702325176 - sw $v0, 108($sp) # internal_24 = "4" + endif_8781702325176: - lw $t0, 108($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 124($sp) - j end_assign - not_is_Bool_or_Int: - # internal_20 = internal_24 - lw $t0, 108($sp) - sw $t0, 124($sp) - end_assign: + # Loading return value in $v1 + lw $v1, 140($sp) - # Jumping to endif_8792981817284 - j endif_8792981817284 + # Freeing space for local variables + addi $sp, $sp, 144 + + jr $ra - else_8792981817284: + function_a2i_aux_at_A2I: + # Function parameters + # $ra = 68($sp) + # self = 64($sp) + # s = 60($sp) + # Reserving space for local variables + addi $sp, $sp, -60 - # Allocating Bool 0 + # Allocating Int 0 li $v0, 9 addi $a0, $zero, 12 syscall - la $t0, type_Bool # $t0 = address of the type + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 100($sp) # internal_26 = address of allocated object Int + sw $v0, 52($sp) # internal_1 = address of allocated object Int - # Allocating Int 5 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument int + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing int + + # Argument internal_1 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 68($sp) # int = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 52($sp) # internal_3 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument j + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing j + + # Argument internal_3 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 60($sp) # j = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 0 li $v0, 9 addi $a0, $zero, 12 syscall @@ -4852,110 +6241,90 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 5 + addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 96($sp) # internal_27 = address of allocated object Int + sw $v0, 36($sp) # internal_5 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 220($sp) + lw $t0, 52($sp) sw $t0, 4($sp) # Storing i - # Argument internal_27 - lw $t0, 108($sp) - sw $t0, 0($sp) # Storing internal_27 + # Argument internal_5 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_5 - # Calling function function_equal - jal function_equal + # Calling function function_assign + jal function_assign lw $ra, 8($sp) - sw $v1, 104($sp) # internal_28 = result of function_equal + sw $v1, 52($sp) # i = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 92($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 100($sp) - j end_assign - not_is_Bool_or_Int: - # internal_26 = internal_28 - lw $t0, 92($sp) - sw $t0, 100($sp) - end_assign: - - # If internal_26 then goto then_8792981817278 - lw $t0, 100($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981817278 - - # Jumping to else_8792981817278 - j else_8792981817278 - - then_8792981817278: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + while_start_8781702325589: - addi $t0, $zero, 53 - sb $t0, 8($v0) # internal_29[0] = '5' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - sb $zero, 9($v0) # Null-terminator at the end of the string + # Argument i + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing i - sw $v0, 88($sp) # internal_29 = "5" + # Argument j + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing j - lw $t0, 88($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 104($sp) - j end_assign - not_is_Bool_or_Int: - # internal_25 = internal_29 - lw $t0, 88($sp) - sw $t0, 104($sp) - end_assign: + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_6 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to endif_8792981817278 - j endif_8792981817278 + # If internal_6 then goto while_body_8781702325589 + lw $t0, 32($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8781702325589 - else_8792981817278: + # Jumping to while_end_8781702325589 + j while_end_8781702325589 + while_body_8781702325589: - # Allocating Bool 0 + # Allocating Int 10 li $v0, 9 addi $a0, $zero, 12 syscall - la $t0, type_Bool # $t0 = address of the type + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 10 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # internal_31 = address of allocated object Int + sw $v0, 28($sp) # internal_7 = address of allocated object Int - # Allocating Int 6 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument int + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing int + + # Argument internal_7 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_8 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 li $v0, 9 addi $a0, $zero, 12 syscall @@ -4963,110 +6332,87 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 6 + addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 76($sp) # internal_32 = address of allocated object Int + sw $v0, 20($sp) # internal_9 = address of allocated object Int # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 76($sp) + sw $t0, 8($sp) # Storing s # Argument i - lw $t0, 220($sp) + lw $t0, 56($sp) sw $t0, 4($sp) # Storing i - # Argument internal_32 - lw $t0, 88($sp) - sw $t0, 0($sp) # Storing internal_32 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 84($sp) # internal_33 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments + # Argument internal_9 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_9 - lw $t0, 72($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 80($sp) - j end_assign - not_is_Bool_or_Int: - # internal_31 = internal_33 - lw $t0, 72($sp) - sw $t0, 80($sp) - end_assign: + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 32($sp) # internal_10 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments - # If internal_31 then goto then_8792981817272 - lw $t0, 80($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981817272 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Jumping to else_8792981817272 - j else_8792981817272 + # Argument self + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing self - then_8792981817272: + # Argument internal_10 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_10 - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall + # Calling function function_c2i_at_A2I + jal function_c2i_at_A2I + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_11 = result of function_c2i_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + # Argument internal_8 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_8 - addi $t0, $zero, 54 - sb $t0, 8($v0) # internal_34[0] = '6' + # Argument internal_11 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_11 - sb $zero, 9($v0) # Null-terminator at the end of the string + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_12 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - sw $v0, 68($sp) # internal_34 = "6" + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument int lw $t0, 68($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 84($sp) - j end_assign - not_is_Bool_or_Int: - # internal_30 = internal_34 - lw $t0, 68($sp) - sw $t0, 84($sp) - end_assign: - - # Jumping to endif_8792981817272 - j endif_8792981817272 - - else_8792981817272: - + sw $t0, 4($sp) # Storing int - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + # Argument internal_12 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_12 - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_36 = address of allocated object Int + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 68($sp) # int = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # Allocating Int 7 + # Allocating Int 1 li $v0, 9 addi $a0, $zero, 12 syscall @@ -5074,96 +6420,67 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 7 + addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 56($sp) # internal_37 = address of allocated object Int + sw $v0, 4($sp) # internal_13 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 220($sp) + lw $t0, 52($sp) sw $t0, 4($sp) # Storing i - # Argument internal_37 - lw $t0, 68($sp) - sw $t0, 0($sp) # Storing internal_37 + # Argument internal_13 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_13 - # Calling function function_equal - jal function_equal + # Calling function function_add + jal function_add lw $ra, 8($sp) - sw $v1, 64($sp) # internal_38 = result of function_equal + sw $v1, 12($sp) # internal_14 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 52($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: - # internal_36 = internal_38 - lw $t0, 52($sp) - sw $t0, 60($sp) - end_assign: - - # If internal_36 then goto then_8792981817266 - lw $t0, 60($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981817266 - - # Jumping to else_8792981817266 - j else_8792981817266 - - then_8792981817266: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall + # Argument i + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing i - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object + # Argument internal_14 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_14 - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 52($sp) # i = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 55 - sb $t0, 8($v0) # internal_39[0] = '7' + # Jumping to while_start_8781702325589 + j while_start_8781702325589 - sb $zero, 9($v0) # Null-terminator at the end of the string + while_end_8781702325589: - sw $v0, 48($sp) # internal_39 = "7" + # Loading return value in $v1 + lw $v1, 56($sp) - lw $t0, 48($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 64($sp) - j end_assign - not_is_Bool_or_Int: - # internal_35 = internal_39 - lw $t0, 48($sp) - sw $t0, 64($sp) - end_assign: + # Freeing space for local variables + addi $sp, $sp, 60 - # Jumping to endif_8792981817266 - j endif_8792981817266 + jr $ra - else_8792981817266: + function_i2a_at_A2I: + # Function parameters + # $ra = 80($sp) + # self = 76($sp) + # i = 72($sp) + # Reserving space for local variables + addi $sp, $sp, -72 # Allocating Bool 0 li $v0, 9 @@ -5175,9 +6492,9 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_41 = address of allocated object Int + sw $v0, 64($sp) # internal_1 = address of allocated object Int - # Allocating Int 8 + # Allocating Int 0 li $v0, 9 addi $a0, $zero, 12 syscall @@ -5185,55 +6502,42 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 8 + addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_42 = address of allocated object Int + sw $v0, 60($sp) # internal_2 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 220($sp) + lw $t0, 84($sp) sw $t0, 4($sp) # Storing i - # Argument internal_42 - lw $t0, 48($sp) - sw $t0, 0($sp) # Storing internal_42 + # Argument internal_2 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_2 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 44($sp) # internal_43 = result of function_equal + sw $v1, 68($sp) # internal_3 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 32($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: - # internal_41 = internal_43 - lw $t0, 32($sp) - sw $t0, 40($sp) - end_assign: + # internal_1 = internal_3 + lw $t0, 56($sp) + sw $t0, 64($sp) - # If internal_41 then goto then_8792981817260 - lw $t0, 40($sp) # Loading the address of the condition + # If internal_1 then goto then_8781702325718 + lw $t0, 64($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981817260 + beq $t0, $t1, then_8781702325718 - # Jumping to else_8792981817260 - j else_8792981817260 + # Jumping to else_8781702325718 + j else_8781702325718 - then_8792981817260: + then_8781702325718: # Allocating String li $v0, 9 @@ -5243,38 +6547,24 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 56 - sb $t0, 8($v0) # internal_44[0] = '8' + addi $t0, $zero, 48 + sb $t0, 8($v0) # internal_4[0] = '0' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 28($sp) # internal_44 = "8" - - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: - # internal_40 = internal_44 - lw $t0, 28($sp) - sw $t0, 44($sp) - end_assign: + sw $v0, 52($sp) # internal_4 = "0" - # Jumping to endif_8792981817260 - j endif_8792981817260 + # internal_0 = internal_4 + lw $t0, 52($sp) + sw $t0, 68($sp) - else_8792981817260: + # Jumping to endif_8781702325718 + j endif_8781702325718 + else_8781702325718: # Allocating Bool 0 li $v0, 9 @@ -5286,9 +6576,9 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_46 = address of allocated object Int + sw $v0, 44($sp) # internal_6 = address of allocated object Int - # Allocating Int 9 + # Allocating Int 0 li $v0, 9 addi $a0, $zero, 12 syscall @@ -5296,55 +6586,69 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 9 + addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_47 = address of allocated object Int + sw $v0, 40($sp) # internal_7 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument i - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing i + # Argument internal_7 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_7 - # Argument internal_47 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_47 + # Argument i + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing i - # Calling function function_equal - jal function_equal + # Calling function function_less_than + jal function_less_than lw $ra, 8($sp) - sw $v1, 24($sp) # internal_48 = result of function_equal + sw $v1, 48($sp) # internal_8 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 20($sp) - j end_assign - not_is_Bool_or_Int: - # internal_46 = internal_48 - lw $t0, 12($sp) - sw $t0, 20($sp) - end_assign: + # internal_6 = internal_8 + lw $t0, 36($sp) + sw $t0, 44($sp) - # If internal_46 then goto then_8792981817239 - lw $t0, 20($sp) # Loading the address of the condition + # If internal_6 then goto then_8781702325724 + lw $t0, 44($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981817239 + beq $t0, $t1, then_8781702325724 + + # Jumping to else_8781702325724 + j else_8781702325724 + + then_8781702325724: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing self + + # Argument i + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing i + + # Calling function function_i2a_aux_at_A2I + jal function_i2a_aux_at_A2I + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_9 = result of function_i2a_aux_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_5 = internal_9 + lw $t0, 32($sp) + sw $t0, 48($sp) - # Jumping to else_8792981817239 - j else_8792981817239 + # Jumping to endif_8781702325724 + j endif_8781702325724 - then_8792981817239: + else_8781702325724: # Allocating String li $v0, 9 @@ -5354,304 +6658,188 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 57 - sb $t0, 8($v0) # internal_49[0] = '9' + addi $t0, $zero, 45 + sb $t0, 8($v0) # internal_10[0] = '-' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 8($sp) # internal_49 = "9" + sw $v0, 28($sp) # internal_10 = "-" - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: - # internal_45 = internal_49 - lw $t0, 8($sp) - sw $t0, 24($sp) - end_assign: + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Jumping to endif_8792981817239 - j endif_8792981817239 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_11 = address of allocated object Int - else_8792981817239: + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_12 = address of allocated object Int - # Argument self - lw $t0, 220($sp) - sw $t0, 0($sp) # Storing self + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Calling function function_abort_at_Object - jal function_abort_at_Object - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_50 = result of function_abort_at_Object - addi $sp, $sp, 8 # Freeing space for arguments + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_13 = address of allocated object Int - # Allocating String + # Allocating Int 0 li $v0, 9 - addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object - + sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - sb $zero, 8($v0) # Null-terminator at the end of the string - - sw $v0, 0($sp) # internal_51 = "" - - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: - # internal_45 = internal_51 - lw $t0, 0($sp) - sw $t0, 24($sp) - end_assign: - - # Jumping to endif_8792981817239 - j endif_8792981817239 - - endif_8792981817239: + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_14 = address of allocated object Int - lw $t0, 24($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: - # internal_40 = internal_45 - lw $t0, 24($sp) - sw $t0, 44($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Jumping to endif_8792981817260 - j endif_8792981817260 + # Argument internal_11 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_11 - endif_8792981817260: + # Argument internal_13 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_13 - lw $t0, 44($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 64($sp) - j end_assign - not_is_Bool_or_Int: - # internal_35 = internal_40 - lw $t0, 44($sp) - sw $t0, 64($sp) - end_assign: + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_14 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to endif_8792981817266 - j endif_8792981817266 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - endif_8792981817266: + # Argument internal_14 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_14 - lw $t0, 64($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 84($sp) - j end_assign - not_is_Bool_or_Int: - # internal_30 = internal_35 - lw $t0, 64($sp) - sw $t0, 84($sp) - end_assign: + # Argument internal_12 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_12 - # Jumping to endif_8792981817272 - j endif_8792981817272 + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_14 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - endif_8792981817272: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument i lw $t0, 84($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 104($sp) - j end_assign - not_is_Bool_or_Int: - # internal_25 = internal_30 - lw $t0, 84($sp) - sw $t0, 104($sp) - end_assign: - - # Jumping to endif_8792981817278 - j endif_8792981817278 + sw $t0, 4($sp) # Storing i - endif_8792981817278: + # Argument internal_14 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_14 - lw $t0, 104($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 124($sp) - j end_assign - not_is_Bool_or_Int: - # internal_20 = internal_25 - lw $t0, 104($sp) - sw $t0, 124($sp) - end_assign: + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_15 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to endif_8792981817284 - j endif_8792981817284 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - endif_8792981817284: + # Argument self + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing self - lw $t0, 124($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 144($sp) - j end_assign - not_is_Bool_or_Int: - # internal_15 = internal_20 - lw $t0, 124($sp) - sw $t0, 144($sp) - end_assign: + # Argument internal_15 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_15 - # Jumping to endif_8792981817290 - j endif_8792981817290 + # Calling function function_i2a_aux_at_A2I + jal function_i2a_aux_at_A2I + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_16 = result of function_i2a_aux_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments - endif_8792981817290: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - lw $t0, 144($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 164($sp) - j end_assign - not_is_Bool_or_Int: - # internal_10 = internal_15 - lw $t0, 144($sp) - sw $t0, 164($sp) - end_assign: + # Argument internal_10 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_10 - # Jumping to endif_8792981817296 - j endif_8792981817296 + # Argument internal_16 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_16 - endif_8792981817296: + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_17 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 164($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 184($sp) - j end_assign - not_is_Bool_or_Int: - # internal_5 = internal_10 - lw $t0, 164($sp) - sw $t0, 184($sp) - end_assign: + # internal_5 = internal_17 + lw $t0, 0($sp) + sw $t0, 48($sp) - # Jumping to endif_8792981817302 - j endif_8792981817302 + # Jumping to endif_8781702325724 + j endif_8781702325724 - endif_8792981817302: + endif_8781702325724: - lw $t0, 184($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 204($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_5 - lw $t0, 184($sp) - sw $t0, 204($sp) - end_assign: + lw $t0, 48($sp) + sw $t0, 68($sp) - # Jumping to endif_8792981817308 - j endif_8792981817308 + # Jumping to endif_8781702325718 + j endif_8781702325718 - endif_8792981817308: + endif_8781702325718: # Loading return value in $v1 - lw $v1, 204($sp) + lw $v1, 68($sp) # Freeing space for local variables - addi $sp, $sp, 208 + addi $sp, $sp, 72 jr $ra - function_a2i_at_A2I: + function_i2a_aux_at_A2I: # Function parameters - # $ra = 152($sp) - # self = 148($sp) - # s = 144($sp) + # $ra = 64($sp) + # self = 60($sp) + # i = 56($sp) # Reserving space for local variables - addi $sp, $sp, -144 - + addi $sp, $sp, -56 # Allocating Bool 0 li $v0, 9 @@ -5663,21 +6851,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 136($sp) # internal_1 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument s - lw $t0, 152($sp) - sw $t0, 0($sp) # Storing s - - # Calling function function_length_at_String - jal function_length_at_String - lw $ra, 4($sp) - sw $v1, 140($sp) # internal_2 = result of function_length_at_String - addi $sp, $sp, 8 # Freeing space for arguments + sw $v0, 48($sp) # internal_1 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -5689,114 +6863,66 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 128($sp) # internal_3 = address of allocated object Int + sw $v0, 44($sp) # internal_2 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_2 - lw $t0, 144($sp) - sw $t0, 4($sp) # Storing internal_2 + # Argument i + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing i - # Argument internal_3 - lw $t0, 140($sp) - sw $t0, 0($sp) # Storing internal_3 + # Argument internal_2 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_2 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 136($sp) # internal_4 = result of function_equal + sw $v1, 52($sp) # internal_3 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 124($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 136($sp) - j end_assign - not_is_Bool_or_Int: - # internal_1 = internal_4 - lw $t0, 124($sp) - sw $t0, 136($sp) - end_assign: + # internal_1 = internal_3 + lw $t0, 40($sp) + sw $t0, 48($sp) - # If internal_1 then goto then_8792981817498 - lw $t0, 136($sp) # Loading the address of the condition + # If internal_1 then goto then_8781702326348 + lw $t0, 48($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981817498 + beq $t0, $t1, then_8781702326348 - # Jumping to else_8792981817498 - j else_8792981817498 + # Jumping to else_8781702326348 + j else_8781702326348 - then_8792981817498: + then_8781702326348: - # Allocating Int 0 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 120($sp) # internal_5 = address of allocated object Int - - lw $t0, 120($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 140($sp) - j end_assign - not_is_Bool_or_Int: - # internal_0 = internal_5 - lw $t0, 120($sp) - sw $t0, 140($sp) - end_assign: - # Jumping to endif_8792981817498 - j endif_8792981817498 - - else_8792981817498: + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + sb $zero, 8($v0) # Null-terminator at the end of the string - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + sw $v0, 36($sp) # internal_4 = "" - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 112($sp) # internal_7 = address of allocated object Int + # internal_0 = internal_4 + lw $t0, 36($sp) + sw $t0, 52($sp) - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + # Jumping to endif_8781702326348 + j endif_8781702326348 - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 108($sp) # internal_8 = address of allocated object Int + else_8781702326348: - # Allocating Int 1 + # Allocating Int 10 li $v0, 9 addi $a0, $zero, 12 syscall @@ -5804,97 +6930,65 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 104($sp) # internal_9 = address of allocated object Int + sw $v0, 28($sp) # internal_6 = address of allocated object Int # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address - - # Argument s - lw $t0, 160($sp) - sw $t0, 8($sp) # Storing s - - # Argument internal_8 - lw $t0, 124($sp) - sw $t0, 4($sp) # Storing internal_8 - - # Argument internal_9 - lw $t0, 120($sp) - sw $t0, 0($sp) # Storing internal_9 - - # Calling function function_substr_at_String - jal function_substr_at_String - lw $ra, 12($sp) - sw $v1, 116($sp) # internal_10 = result of function_substr_at_String - addi $sp, $sp, 16 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 45 - sb $t0, 8($v0) # internal_11[0] = '-' + # Argument i + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing i - sb $zero, 9($v0) # Null-terminator at the end of the string + # Argument internal_6 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_6 - sw $v0, 96($sp) # internal_11 = "-" + # Calling function function_div + jal function_div + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_7 = result of function_div + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_10 - lw $t0, 112($sp) - sw $t0, 4($sp) # Storing internal_10 + # Argument next + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing next - # Argument internal_11 - lw $t0, 108($sp) - sw $t0, 0($sp) # Storing internal_11 + # Argument internal_7 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_7 - # Calling function function_equal - jal function_equal + # Calling function function_assign + jal function_assign lw $ra, 8($sp) - sw $v1, 104($sp) # internal_12 = result of function_equal + sw $v1, 44($sp) # next = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 92($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 112($sp) - j end_assign - not_is_Bool_or_Int: - # internal_7 = internal_12 - lw $t0, 92($sp) - sw $t0, 112($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # If internal_7 then goto then_8792981817513 - lw $t0, 112($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981817513 + # Argument self + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing self - # Jumping to else_8792981817513 - j else_8792981817513 + # Argument next + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing next - then_8792981817513: + # Calling function function_i2a_aux_at_A2I + jal function_i2a_aux_at_A2I + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_8 = result of function_i2a_aux_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments - # Allocating Int 1 + # Allocating Int 10 li $v0, 9 addi $a0, $zero, 12 syscall @@ -5902,1621 +6996,1299 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 88($sp) # internal_13 = address of allocated object Int + sw $v0, 16($sp) # internal_9 = address of allocated object Int # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument s - lw $t0, 152($sp) - sw $t0, 0($sp) # Storing s + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Calling function function_length_at_String - jal function_length_at_String - lw $ra, 4($sp) - sw $v1, 92($sp) # internal_14 = result of function_length_at_String - addi $sp, $sp, 8 # Freeing space for arguments + # Argument next + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing next - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall + # Argument internal_9 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_9 - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # internal_15 = address of allocated object Int + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_10 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_14 - lw $t0, 96($sp) - sw $t0, 4($sp) # Storing internal_14 + # Argument i + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing i - # Argument internal_15 - lw $t0, 92($sp) - sw $t0, 0($sp) # Storing internal_15 + # Argument internal_10 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_10 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 88($sp) # internal_16 = result of function_sub + sw $v1, 20($sp) # internal_11 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address - - # Argument s - lw $t0, 160($sp) - sw $t0, 8($sp) # Storing s + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Argument internal_13 - lw $t0, 104($sp) - sw $t0, 4($sp) # Storing internal_13 + # Argument self + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing self - # Argument internal_16 - lw $t0, 92($sp) - sw $t0, 0($sp) # Storing internal_16 + # Argument internal_11 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_11 - # Calling function function_substr_at_String - jal function_substr_at_String - lw $ra, 12($sp) - sw $v1, 88($sp) # internal_17 = result of function_substr_at_String - addi $sp, $sp, 16 # Freeing space for arguments + # Calling function function_i2c_at_A2I + jal function_i2c_at_A2I + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_12 = result of function_i2c_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 160($sp) - sw $t0, 4($sp) # Storing self + # Argument internal_8 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_8 - # Argument internal_17 - lw $t0, 84($sp) - sw $t0, 0($sp) # Storing internal_17 + # Argument internal_12 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_12 - # Calling function function_a2i_aux_at_A2I - jal function_a2i_aux_at_A2I + # Calling function function_concat_at_String + jal function_concat_at_String lw $ra, 8($sp) - sw $v1, 80($sp) # internal_18 = result of function_a2i_aux_at_A2I + sw $v1, 12($sp) # internal_13 = result of function_concat_at_String addi $sp, $sp, 12 # Freeing space for arguments - # Xor operation - lw $t0, 68($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 60($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + # internal_0 = internal_13 + lw $t0, 0($sp) + sw $t0, 52($sp) - lw $t0, 56($sp) # $t0 = internal_21 - sw $t2, 8($t0) # Setting value in the third word of the Int object + # Jumping to endif_8781702326348 + j endif_8781702326348 - # Addition operation - lw $t0, 56($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 64($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - add $t2, $t0, $t1 # $t2 = $t0 + $t1 + endif_8781702326348: - lw $t0, 56($sp) # $t0 = internal_21 - sw $t2, 8($t0) # Setting value in the third word of the Int object + # Loading return value in $v1 + lw $v1, 52($sp) - lw $t0, 56($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 116($sp) - j end_assign - not_is_Bool_or_Int: - # internal_6 = internal_21 - lw $t0, 56($sp) - sw $t0, 116($sp) - end_assign: + # Freeing space for local variables + addi $sp, $sp, 56 - # Jumping to endif_8792981817513 - j endif_8792981817513 + jr $ra - else_8792981817513: + function___init___at_Main: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + # Reserving space for local variables + addi $sp, $sp, -16 - # Allocating Bool 0 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Bool # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_23 = address of allocated object Int - # Allocating Int 0 + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_0 = "" + + # Set attribute char of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 12($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8781702246202 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8781702246202 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8781702246202 + j object_set_attribute_8781702246202 + int_set_attribute_8781702246202: li $v0, 9 addi $a0, $zero, 12 syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.char = internal_0 + j end_set_attribute_8781702246202 + bool_set_attribute_8781702246202: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.char = internal_0 + j end_set_attribute_8781702246202 + object_set_attribute_8781702246202: + sw $t1, 8($t0) # self.char = internal_0 + end_set_attribute_8781702246202: - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_24 = address of allocated object Int + # Allocating NUll to internal_1 + sw $zero, 8($sp) # internal_1 = 0 - # Allocating Int 1 + # Set attribute avar of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8781702246223 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8781702246223 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8781702246223 + j object_set_attribute_8781702246223 + int_set_attribute_8781702246223: li $v0, 9 addi $a0, $zero, 12 syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_1 + j end_set_attribute_8781702246223 + bool_set_attribute_8781702246223: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_1 + j end_set_attribute_8781702246223 + object_set_attribute_8781702246223: + sw $t1, 12($t0) # self.avar = internal_1 + end_set_attribute_8781702246223: + + # Allocating NUll to internal_2 + sw $zero, 4($sp) # internal_2 = 0 - la $t0, type_Int # $t0 = address of the type + # Set attribute a_var of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_2 + beq $t1, $zero, object_set_attribute_8781702246244 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8781702246244 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8781702246244 + j object_set_attribute_8781702246244 + int_set_attribute_8781702246244: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.a_var = internal_2 + j end_set_attribute_8781702246244 + bool_set_attribute_8781702246244: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.a_var = internal_2 + j end_set_attribute_8781702246244 + object_set_attribute_8781702246244: + sw $t1, 16($t0) # self.a_var = internal_2 + end_set_attribute_8781702246244: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_25 = address of allocated object Int + sw $v0, 0($sp) # internal_3 = address of allocated object Int - # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address + # Set attribute flag of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_3 + beq $t1, $zero, object_set_attribute_8781702246265 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8781702246265 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8781702246265 + j object_set_attribute_8781702246265 + int_set_attribute_8781702246265: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.flag = internal_3 + j end_set_attribute_8781702246265 + bool_set_attribute_8781702246265: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.flag = internal_3 + j end_set_attribute_8781702246265 + object_set_attribute_8781702246265: + sw $t1, 20($t0) # self.flag = internal_3 + end_set_attribute_8781702246265: - # Argument s - lw $t0, 160($sp) - sw $t0, 8($sp) # Storing s + # Loading return value in $v1 + lw $v1, 16($sp) - # Argument internal_24 - lw $t0, 60($sp) - sw $t0, 4($sp) # Storing internal_24 + # Freeing space for local variables + addi $sp, $sp, 16 - # Argument internal_25 - lw $t0, 56($sp) - sw $t0, 0($sp) # Storing internal_25 + jr $ra - # Calling function function_substr_at_String - jal function_substr_at_String - lw $ra, 12($sp) - sw $v1, 52($sp) # internal_26 = result of function_substr_at_String - addi $sp, $sp, 16 # Freeing space for arguments + function_menu_at_Main: + # Function parameters + # $ra = 216($sp) + # self = 212($sp) + + # Reserving space for local variables + addi $sp, $sp, -212 # Allocating String li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 30 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 30 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 43 - sb $t0, 8($v0) # internal_27[0] = '+' + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_0[0] = '\n' + + addi $t0, $zero, 9 + sb $t0, 9($v0) # internal_0[1] = '\t' + + addi $t0, $zero, 84 + sb $t0, 10($v0) # internal_0[2] = 'T' + + addi $t0, $zero, 111 + sb $t0, 11($v0) # internal_0[3] = 'o' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_0[4] = ' ' + + addi $t0, $zero, 97 + sb $t0, 13($v0) # internal_0[5] = 'a' - sb $zero, 9($v0) # Null-terminator at the end of the string + addi $t0, $zero, 100 + sb $t0, 14($v0) # internal_0[6] = 'd' - sw $v0, 32($sp) # internal_27 = "+" + addi $t0, $zero, 100 + sb $t0, 15($v0) # internal_0[7] = 'd' - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_0[8] = ' ' - # Argument internal_26 - lw $t0, 48($sp) - sw $t0, 4($sp) # Storing internal_26 + addi $t0, $zero, 97 + sb $t0, 17($v0) # internal_0[9] = 'a' - # Argument internal_27 - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_27 + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_0[10] = ' ' - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 40($sp) # internal_28 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments + addi $t0, $zero, 110 + sb $t0, 19($v0) # internal_0[11] = 'n' - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 48($sp) - j end_assign - not_is_Bool_or_Int: - # internal_23 = internal_28 - lw $t0, 28($sp) - sw $t0, 48($sp) - end_assign: + addi $t0, $zero, 117 + sb $t0, 20($v0) # internal_0[12] = 'u' - # If internal_23 then goto then_8792981817507 - lw $t0, 48($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981817507 + addi $t0, $zero, 109 + sb $t0, 21($v0) # internal_0[13] = 'm' - # Jumping to else_8792981817507 - j else_8792981817507 + addi $t0, $zero, 98 + sb $t0, 22($v0) # internal_0[14] = 'b' - then_8792981817507: + addi $t0, $zero, 101 + sb $t0, 23($v0) # internal_0[15] = 'e' - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall + addi $t0, $zero, 114 + sb $t0, 24($v0) # internal_0[16] = 'r' - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_29 = address of allocated object Int + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + addi $t0, $zero, 116 + sb $t0, 26($v0) # internal_0[18] = 't' - # Argument s - lw $t0, 152($sp) - sw $t0, 0($sp) # Storing s + addi $t0, $zero, 111 + sb $t0, 27($v0) # internal_0[19] = 'o' - # Calling function function_length_at_String - jal function_length_at_String - lw $ra, 4($sp) - sw $v1, 28($sp) # internal_30 = result of function_length_at_String - addi $sp, $sp, 8 # Freeing space for arguments + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_0[20] = ' ' - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall + sb $zero, 29($v0) # Null-terminator at the end of the string - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_31 = address of allocated object Int + sw $v0, 208($sp) # internal_0 = "\n\tTo add a number to " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_30 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_30 + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self - # Argument internal_31 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_31 + # Argument internal_0 + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing internal_0 - # Calling function function_sub - jal function_sub + # Calling function function_out_string_at_IO + jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 24($sp) # internal_32 = result of function_sub + sw $v1, 216($sp) # internal_1 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address - - # Argument s - lw $t0, 160($sp) - sw $t0, 8($sp) # Storing s - - # Argument internal_29 - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing internal_29 - - # Argument internal_32 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_32 - - # Calling function function_substr_at_String - jal function_substr_at_String - lw $ra, 12($sp) - sw $v1, 24($sp) # internal_33 = result of function_substr_at_String - addi $sp, $sp, 16 # Freeing space for arguments + # Get attribute avar of self + lw $t0, 212($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702246355 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702246355 + j object_get_attribute_8781702246355 + int_get_attribute_8781702246355: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 200($sp) # internal_2 = self.avar + j end_get_attribute_8781702246355 + bool_get_attribute_8781702246355: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 200($sp) # internal_2 = self.avar + j end_get_attribute_8781702246355 + object_get_attribute_8781702246355: + sw $t1, 200($sp) # internal_2 = avar + end_get_attribute_8781702246355: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 160($sp) + lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument internal_33 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_33 + # Argument internal_2 + lw $t0, 212($sp) + sw $t0, 0($sp) # Storing internal_2 - # Calling function function_a2i_aux_at_A2I - jal function_a2i_aux_at_A2I + # Calling function function_print_at_Main + jal function_print_at_Main lw $ra, 8($sp) - sw $v1, 16($sp) # internal_34 = result of function_a2i_aux_at_A2I + sw $v1, 208($sp) # internal_3 = result of function_print_at_Main addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 4($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: - # internal_22 = internal_34 - lw $t0, 4($sp) - sw $t0, 52($sp) - end_assign: + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - # Jumping to endif_8792981817507 - j endif_8792981817507 + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - else_8792981817507: + addi $t0, $zero, 21 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t0, $zero, 46 + sb $t0, 8($v0) # internal_4[0] = '.' - # Argument self - lw $t0, 160($sp) - sw $t0, 4($sp) # Storing self + addi $t0, $zero, 46 + sb $t0, 9($v0) # internal_4[1] = '.' - # Argument s - lw $t0, 156($sp) - sw $t0, 0($sp) # Storing s + addi $t0, $zero, 46 + sb $t0, 10($v0) # internal_4[2] = '.' - # Calling function function_a2i_aux_at_A2I - jal function_a2i_aux_at_A2I - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_35 = result of function_a2i_aux_at_A2I - addi $sp, $sp, 12 # Freeing space for arguments + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_4[3] = 'e' - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: - # internal_22 = internal_35 - lw $t0, 0($sp) - sw $t0, 52($sp) - end_assign: + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_4[4] = 'n' - # Jumping to endif_8792981817507 - j endif_8792981817507 + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_4[5] = 't' - endif_8792981817507: + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_4[6] = 'e' - lw $t0, 52($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 116($sp) - j end_assign - not_is_Bool_or_Int: - # internal_6 = internal_22 - lw $t0, 52($sp) - sw $t0, 116($sp) - end_assign: + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_4[7] = 'r' - # Jumping to endif_8792981817513 - j endif_8792981817513 + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_4[8] = ' ' - endif_8792981817513: + addi $t0, $zero, 97 + sb $t0, 17($v0) # internal_4[9] = 'a' - lw $t0, 116($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 140($sp) - j end_assign - not_is_Bool_or_Int: - # internal_0 = internal_6 - lw $t0, 116($sp) - sw $t0, 140($sp) - end_assign: + addi $t0, $zero, 58 + sb $t0, 18($v0) # internal_4[10] = ':' - # Jumping to endif_8792981817498 - j endif_8792981817498 + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_4[11] = '\n' - endif_8792981817498: + sb $zero, 20($v0) # Null-terminator at the end of the string - # Loading return value in $v1 - lw $v1, 140($sp) + sw $v0, 192($sp) # internal_4 = "...enter a:\n" - # Freeing space for local variables - addi $sp, $sp, 144 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - jr $ra + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self - function_a2i_aux_at_A2I: - # Function parameters - # $ra = 72($sp) - # self = 68($sp) - # s = 64($sp) + # Argument internal_4 + lw $t0, 204($sp) + sw $t0, 0($sp) # Storing internal_4 - # Reserving space for local variables - addi $sp, $sp, -64 + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 200($sp) # internal_5 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments - # Allocating Int 0 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 56($sp) # internal_1 = address of allocated object Int + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 20 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_6[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_6[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_6[2] = 'o' - lw $t0, 56($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: - # int = internal_1 - lw $t0, 56($sp) - sw $t0, 60($sp) - end_assign: + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_6[3] = ' ' - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_6[4] = 'n' - # Argument s - lw $t0, 72($sp) - sw $t0, 0($sp) # Storing s + addi $t0, $zero, 101 + sb $t0, 13($v0) # internal_6[5] = 'e' - # Calling function function_length_at_String - jal function_length_at_String - lw $ra, 4($sp) - sw $v1, 56($sp) # internal_3 = result of function_length_at_String - addi $sp, $sp, 8 # Freeing space for arguments + addi $t0, $zero, 103 + sb $t0, 14($v0) # internal_6[6] = 'g' - lw $t0, 48($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: - # j = internal_3 - lw $t0, 48($sp) - sw $t0, 52($sp) - end_assign: + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_6[7] = 'a' - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + addi $t0, $zero, 116 + sb $t0, 16($v0) # internal_6[8] = 't' - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_5 = address of allocated object Int + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_6[9] = 'e' - lw $t0, 40($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: - # i = internal_5 - lw $t0, 40($sp) - sw $t0, 44($sp) - end_assign: + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_6[10] = ' ' + + sb $zero, 19($v0) # Null-terminator at the end of the string - while_start_8792981818167: + sw $v0, 184($sp) # internal_6 = "\tTo negate " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument i - lw $t0, 56($sp) - sw $t0, 4($sp) # Storing i + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self - # Argument j - lw $t0, 64($sp) - sw $t0, 0($sp) # Storing j + # Argument internal_6 + lw $t0, 196($sp) + sw $t0, 0($sp) # Storing internal_6 - # Calling function function_less_than - jal function_less_than + # Calling function function_out_string_at_IO + jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 44($sp) # internal_7 = result of function_less_than + sw $v1, 192($sp) # internal_7 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 32($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 36($sp) - j end_assign - not_is_Bool_or_Int: - # internal_6 = internal_7 - lw $t0, 32($sp) - sw $t0, 36($sp) - end_assign: - - # If internal_6 then goto while_body_8792981818167 - lw $t0, 36($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8792981818167 - - # Jumping to while_end_8792981818167 - j while_end_8792981818167 - - while_body_8792981818167: - - # Allocating Int 10 + # Get attribute avar of self + lw $t0, 212($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702246979 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702246979 + j object_get_attribute_8781702246979 + int_get_attribute_8781702246979: li $v0, 9 addi $a0, $zero, 12 syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 10 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_8 = address of allocated object Int + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 176($sp) # internal_8 = self.avar + j end_get_attribute_8781702246979 + bool_get_attribute_8781702246979: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 176($sp) # internal_8 = self.avar + j end_get_attribute_8781702246979 + object_get_attribute_8781702246979: + sw $t1, 176($sp) # internal_8 = avar + end_get_attribute_8781702246979: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument int - lw $t0, 72($sp) - sw $t0, 4($sp) # Storing int + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self # Argument internal_8 - lw $t0, 40($sp) + lw $t0, 188($sp) sw $t0, 0($sp) # Storing internal_8 - # Calling function function_mult - jal function_mult + # Calling function function_print_at_Main + jal function_print_at_Main lw $ra, 8($sp) - sw $v1, 36($sp) # internal_9 = result of function_mult + sw $v1, 184($sp) # internal_9 = result of function_print_at_Main addi $sp, $sp, 12 # Freeing space for arguments - # Allocating Int 1 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_10 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address - # Argument s - lw $t0, 80($sp) - sw $t0, 8($sp) # Storing s + addi $t0, $zero, 21 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - # Argument i - lw $t0, 60($sp) - sw $t0, 4($sp) # Storing i + addi $t0, $zero, 46 + sb $t0, 8($v0) # internal_10[0] = '.' - # Argument internal_10 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_10 + addi $t0, $zero, 46 + sb $t0, 9($v0) # internal_10[1] = '.' - # Calling function function_substr_at_String - jal function_substr_at_String - lw $ra, 12($sp) - sw $v1, 32($sp) # internal_11 = result of function_substr_at_String - addi $sp, $sp, 16 # Freeing space for arguments + addi $t0, $zero, 46 + sb $t0, 10($v0) # internal_10[2] = '.' - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_10[3] = 'e' - # Argument self - lw $t0, 80($sp) - sw $t0, 4($sp) # Storing self + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_10[4] = 'n' - # Argument internal_11 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_11 + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_10[5] = 't' - # Calling function function_c2i_at_A2I - jal function_c2i_at_A2I - lw $ra, 8($sp) - sw $v1, 24($sp) # internal_12 = result of function_c2i_at_A2I - addi $sp, $sp, 12 # Freeing space for arguments + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_10[6] = 'e' - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_10[7] = 'r' - # Argument internal_9 - lw $t0, 36($sp) - sw $t0, 4($sp) # Storing internal_9 + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_10[8] = ' ' - # Argument internal_12 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_12 + addi $t0, $zero, 98 + sb $t0, 17($v0) # internal_10[9] = 'b' - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_13 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments + addi $t0, $zero, 58 + sb $t0, 18($v0) # internal_10[10] = ':' - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: - # int = internal_13 - lw $t0, 8($sp) - sw $t0, 60($sp) - end_assign: + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_10[11] = '\n' - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall + sb $zero, 20($v0) # Null-terminator at the end of the string - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_14 = address of allocated object Int + sw $v0, 168($sp) # internal_10 = "...enter b:\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument i - lw $t0, 56($sp) - sw $t0, 4($sp) # Storing i + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self - # Argument internal_14 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_14 + # Argument internal_10 + lw $t0, 180($sp) + sw $t0, 0($sp) # Storing internal_10 - # Calling function function_add - jal function_add + # Calling function function_out_string_at_IO + jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 12($sp) # internal_15 = result of function_add + sw $v1, 176($sp) # internal_11 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: - # i = internal_15 - lw $t0, 0($sp) - sw $t0, 44($sp) - end_assign: + # Allocating String + li $v0, 9 + addi $a0, $zero, 41 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - # Jumping to while_start_8792981818167 - j while_start_8792981818167 + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - while_end_8792981818167: + addi $t0, $zero, 41 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - # Loading return value in $v1 - lw $v1, 60($sp) + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_12[0] = '\t' - # Freeing space for local variables - addi $sp, $sp, 64 + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_12[1] = 'T' - jr $ra + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_12[2] = 'o' - function_i2a_at_A2I: - # Function parameters - # $ra = 80($sp) - # self = 76($sp) - # i = 72($sp) + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_12[3] = ' ' - # Reserving space for local variables - addi $sp, $sp, -72 + addi $t0, $zero, 102 + sb $t0, 12($v0) # internal_12[4] = 'f' + addi $t0, $zero, 105 + sb $t0, 13($v0) # internal_12[5] = 'i' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_12[6] = 'n' + + addi $t0, $zero, 100 + sb $t0, 15($v0) # internal_12[7] = 'd' - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_12[8] = ' ' - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 64($sp) # internal_1 = address of allocated object Int + addi $t0, $zero, 116 + sb $t0, 17($v0) # internal_12[9] = 't' - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + addi $t0, $zero, 104 + sb $t0, 18($v0) # internal_12[10] = 'h' - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_2 = address of allocated object Int + addi $t0, $zero, 101 + sb $t0, 19($v0) # internal_12[11] = 'e' - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_12[12] = ' ' - # Argument i - lw $t0, 84($sp) - sw $t0, 4($sp) # Storing i + addi $t0, $zero, 100 + sb $t0, 21($v0) # internal_12[13] = 'd' - # Argument internal_2 - lw $t0, 72($sp) - sw $t0, 0($sp) # Storing internal_2 + addi $t0, $zero, 105 + sb $t0, 22($v0) # internal_12[14] = 'i' - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 68($sp) # internal_3 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments + addi $t0, $zero, 102 + sb $t0, 23($v0) # internal_12[15] = 'f' - lw $t0, 56($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 64($sp) - j end_assign - not_is_Bool_or_Int: - # internal_1 = internal_3 - lw $t0, 56($sp) - sw $t0, 64($sp) - end_assign: + addi $t0, $zero, 102 + sb $t0, 24($v0) # internal_12[16] = 'f' - # If internal_1 then goto then_8792981818296 - lw $t0, 64($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981818296 + addi $t0, $zero, 101 + sb $t0, 25($v0) # internal_12[17] = 'e' - # Jumping to else_8792981818296 - j else_8792981818296 + addi $t0, $zero, 114 + sb $t0, 26($v0) # internal_12[18] = 'r' - then_8792981818296: + addi $t0, $zero, 101 + sb $t0, 27($v0) # internal_12[19] = 'e' - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall + addi $t0, $zero, 110 + sb $t0, 28($v0) # internal_12[20] = 'n' - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object + addi $t0, $zero, 99 + sb $t0, 29($v0) # internal_12[21] = 'c' - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + addi $t0, $zero, 101 + sb $t0, 30($v0) # internal_12[22] = 'e' - addi $t0, $zero, 48 - sb $t0, 8($v0) # internal_4[0] = '0' + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_12[23] = ' ' - sb $zero, 9($v0) # Null-terminator at the end of the string + addi $t0, $zero, 98 + sb $t0, 32($v0) # internal_12[24] = 'b' - sw $v0, 52($sp) # internal_4 = "0" + addi $t0, $zero, 101 + sb $t0, 33($v0) # internal_12[25] = 'e' - lw $t0, 52($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 68($sp) - j end_assign - not_is_Bool_or_Int: - # internal_0 = internal_4 - lw $t0, 52($sp) - sw $t0, 68($sp) - end_assign: + addi $t0, $zero, 116 + sb $t0, 34($v0) # internal_12[26] = 't' - # Jumping to endif_8792981818296 - j endif_8792981818296 + addi $t0, $zero, 119 + sb $t0, 35($v0) # internal_12[27] = 'w' - else_8792981818296: + addi $t0, $zero, 101 + sb $t0, 36($v0) # internal_12[28] = 'e' + addi $t0, $zero, 101 + sb $t0, 37($v0) # internal_12[29] = 'e' - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + addi $t0, $zero, 110 + sb $t0, 38($v0) # internal_12[30] = 'n' - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_6 = address of allocated object Int + addi $t0, $zero, 32 + sb $t0, 39($v0) # internal_12[31] = ' ' - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + sb $zero, 40($v0) # Null-terminator at the end of the string - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_7 = address of allocated object Int + sw $v0, 160($sp) # internal_12 = "\tTo find the difference between " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_7 - lw $t0, 52($sp) - sw $t0, 4($sp) # Storing internal_7 + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self - # Argument i - lw $t0, 84($sp) - sw $t0, 0($sp) # Storing i + # Argument internal_12 + lw $t0, 172($sp) + sw $t0, 0($sp) # Storing internal_12 - # Calling function function_less_than - jal function_less_than + # Calling function function_out_string_at_IO + jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 48($sp) # internal_8 = result of function_less_than + sw $v1, 168($sp) # internal_13 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 36($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: - # internal_6 = internal_8 - lw $t0, 36($sp) - sw $t0, 44($sp) - end_assign: - - # If internal_6 then goto then_8792981818302 - lw $t0, 44($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981818302 - - # Jumping to else_8792981818302 - j else_8792981818302 - - then_8792981818302: + # Get attribute avar of self + lw $t0, 212($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702247087 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702247087 + j object_get_attribute_8781702247087 + int_get_attribute_8781702247087: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 152($sp) # internal_14 = self.avar + j end_get_attribute_8781702247087 + bool_get_attribute_8781702247087: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 152($sp) # internal_14 = self.avar + j end_get_attribute_8781702247087 + object_get_attribute_8781702247087: + sw $t1, 152($sp) # internal_14 = avar + end_get_attribute_8781702247087: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 88($sp) + lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument i - lw $t0, 84($sp) - sw $t0, 0($sp) # Storing i + # Argument internal_14 + lw $t0, 164($sp) + sw $t0, 0($sp) # Storing internal_14 - # Calling function function_i2a_aux_at_A2I - jal function_i2a_aux_at_A2I + # Calling function function_print_at_Main + jal function_print_at_Main lw $ra, 8($sp) - sw $v1, 44($sp) # internal_9 = result of function_i2a_aux_at_A2I + sw $v1, 160($sp) # internal_15 = result of function_print_at_Main addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 32($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 48($sp) - j end_assign - not_is_Bool_or_Int: - # internal_5 = internal_9 - lw $t0, 32($sp) - sw $t0, 48($sp) - end_assign: - - # Jumping to endif_8792981818302 - j endif_8792981818302 - - else_8792981818302: - # Allocating String li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 39 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 39 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 45 - sb $t0, 8($v0) # internal_10[0] = '-' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 28($sp) # internal_10 = "-" - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_11 = address of allocated object Int - - # Xor operation - lw $t0, 24($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 16($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + addi $t0, $zero, 97 + sb $t0, 8($v0) # internal_16[0] = 'a' - lw $t0, 12($sp) # $t0 = internal_14 - sw $t2, 8($t0) # Setting value in the third word of the Int object + addi $t0, $zero, 110 + sb $t0, 9($v0) # internal_16[1] = 'n' - # Addition operation - lw $t0, 12($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 20($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - add $t2, $t0, $t1 # $t2 = $t0 + $t1 + addi $t0, $zero, 100 + sb $t0, 10($v0) # internal_16[2] = 'd' - lw $t0, 12($sp) # $t0 = internal_14 - sw $t2, 8($t0) # Setting value in the third word of the Int object + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_16[3] = ' ' - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t0, $zero, 97 + sb $t0, 12($v0) # internal_16[4] = 'a' - # Argument i - lw $t0, 84($sp) - sw $t0, 4($sp) # Storing i + addi $t0, $zero, 110 + sb $t0, 13($v0) # internal_16[5] = 'n' - # Argument internal_14 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_14 + addi $t0, $zero, 111 + sb $t0, 14($v0) # internal_16[6] = 'o' - # Calling function function_mult - jal function_mult - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_15 = result of function_mult - addi $sp, $sp, 12 # Freeing space for arguments + addi $t0, $zero, 116 + sb $t0, 15($v0) # internal_16[7] = 't' - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t0, $zero, 104 + sb $t0, 16($v0) # internal_16[8] = 'h' - # Argument self - lw $t0, 88($sp) - sw $t0, 4($sp) # Storing self + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_16[9] = 'e' - # Argument internal_15 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_15 + addi $t0, $zero, 114 + sb $t0, 18($v0) # internal_16[10] = 'r' - # Calling function function_i2a_aux_at_A2I - jal function_i2a_aux_at_A2I - lw $ra, 8($sp) - sw $v1, 16($sp) # internal_16 = result of function_i2a_aux_at_A2I - addi $sp, $sp, 12 # Freeing space for arguments + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_16[11] = ' ' - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t0, $zero, 110 + sb $t0, 20($v0) # internal_16[12] = 'n' - # Argument internal_10 - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing internal_10 + addi $t0, $zero, 117 + sb $t0, 21($v0) # internal_16[13] = 'u' - # Argument internal_16 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_16 + addi $t0, $zero, 109 + sb $t0, 22($v0) # internal_16[14] = 'm' - # Calling function function_concat_at_String - jal function_concat_at_String - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_17 = result of function_concat_at_String - addi $sp, $sp, 12 # Freeing space for arguments + addi $t0, $zero, 98 + sb $t0, 23($v0) # internal_16[15] = 'b' - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 48($sp) - j end_assign - not_is_Bool_or_Int: - # internal_5 = internal_17 - lw $t0, 0($sp) - sw $t0, 48($sp) - end_assign: + addi $t0, $zero, 101 + sb $t0, 24($v0) # internal_16[16] = 'e' - # Jumping to endif_8792981818302 - j endif_8792981818302 + addi $t0, $zero, 114 + sb $t0, 25($v0) # internal_16[17] = 'r' - endif_8792981818302: + addi $t0, $zero, 46 + sb $t0, 26($v0) # internal_16[18] = '.' - lw $t0, 48($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 68($sp) - j end_assign - not_is_Bool_or_Int: - # internal_0 = internal_5 - lw $t0, 48($sp) - sw $t0, 68($sp) - end_assign: + addi $t0, $zero, 46 + sb $t0, 27($v0) # internal_16[19] = '.' - # Jumping to endif_8792981818296 - j endif_8792981818296 + addi $t0, $zero, 46 + sb $t0, 28($v0) # internal_16[20] = '.' - endif_8792981818296: + addi $t0, $zero, 101 + sb $t0, 29($v0) # internal_16[21] = 'e' - # Loading return value in $v1 - lw $v1, 68($sp) + addi $t0, $zero, 110 + sb $t0, 30($v0) # internal_16[22] = 'n' - # Freeing space for local variables - addi $sp, $sp, 72 + addi $t0, $zero, 116 + sb $t0, 31($v0) # internal_16[23] = 't' - jr $ra + addi $t0, $zero, 101 + sb $t0, 32($v0) # internal_16[24] = 'e' - function_i2a_aux_at_A2I: - # Function parameters - # $ra = 64($sp) - # self = 60($sp) - # i = 56($sp) + addi $t0, $zero, 114 + sb $t0, 33($v0) # internal_16[25] = 'r' - # Reserving space for local variables - addi $sp, $sp, -56 + addi $t0, $zero, 32 + sb $t0, 34($v0) # internal_16[26] = ' ' + addi $t0, $zero, 99 + sb $t0, 35($v0) # internal_16[27] = 'c' - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + addi $t0, $zero, 58 + sb $t0, 36($v0) # internal_16[28] = ':' - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_1 = address of allocated object Int + addi $t0, $zero, 10 + sb $t0, 37($v0) # internal_16[29] = '\n' - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + sb $zero, 38($v0) # Null-terminator at the end of the string - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_2 = address of allocated object Int + sw $v0, 144($sp) # internal_16 = "and another number...enter c:\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument i - lw $t0, 68($sp) - sw $t0, 4($sp) # Storing i + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self - # Argument internal_2 - lw $t0, 56($sp) - sw $t0, 0($sp) # Storing internal_2 + # Argument internal_16 + lw $t0, 156($sp) + sw $t0, 0($sp) # Storing internal_16 - # Calling function function_equal - jal function_equal + # Calling function function_out_string_at_IO + jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 52($sp) # internal_3 = result of function_equal + sw $v1, 152($sp) # internal_17 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 40($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 48($sp) - j end_assign - not_is_Bool_or_Int: - # internal_1 = internal_3 - lw $t0, 40($sp) - sw $t0, 48($sp) - end_assign: - - # If internal_1 then goto then_8792981818670 - lw $t0, 48($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981818670 - - # Jumping to else_8792981818670 - j else_8792981818670 - - then_8792981818670: - # Allocating String li $v0, 9 - addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 35 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 35 sw $t0, 4($v0) # Setting length of the string in the second word of the object - sb $zero, 8($v0) # Null-terminator at the end of the string + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_18[0] = '\t' - sw $v0, 36($sp) # internal_4 = "" + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_18[1] = 'T' - lw $t0, 36($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: - # internal_0 = internal_4 - lw $t0, 36($sp) - sw $t0, 52($sp) - end_assign: + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_18[2] = 'o' - # Jumping to endif_8792981818670 - j endif_8792981818670 + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_18[3] = ' ' - else_8792981818670: + addi $t0, $zero, 102 + sb $t0, 12($v0) # internal_18[4] = 'f' - # Allocating Int 10 - li $v0, 9 - addi $a0, $zero, 12 - syscall + addi $t0, $zero, 105 + sb $t0, 13($v0) # internal_18[5] = 'i' - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 10 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_6 = address of allocated object Int + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_18[6] = 'n' - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t0, $zero, 100 + sb $t0, 15($v0) # internal_18[7] = 'd' - # Argument i - lw $t0, 68($sp) - sw $t0, 4($sp) # Storing i + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_18[8] = ' ' - # Argument internal_6 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_6 + addi $t0, $zero, 116 + sb $t0, 17($v0) # internal_18[9] = 't' - # Calling function function_div - jal function_div - lw $ra, 8($sp) - sw $v1, 36($sp) # internal_7 = result of function_div - addi $sp, $sp, 12 # Freeing space for arguments + addi $t0, $zero, 104 + sb $t0, 18($v0) # internal_18[10] = 'h' - lw $t0, 24($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 32($sp) - j end_assign - not_is_Bool_or_Int: - # next = internal_7 - lw $t0, 24($sp) - sw $t0, 32($sp) - end_assign: + addi $t0, $zero, 101 + sb $t0, 19($v0) # internal_18[11] = 'e' - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_18[12] = ' ' - # Argument self - lw $t0, 72($sp) - sw $t0, 4($sp) # Storing self + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_18[13] = 'f' - # Argument next - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing next + addi $t0, $zero, 97 + sb $t0, 22($v0) # internal_18[14] = 'a' - # Calling function function_i2a_aux_at_A2I - jal function_i2a_aux_at_A2I - lw $ra, 8($sp) - sw $v1, 32($sp) # internal_8 = result of function_i2a_aux_at_A2I - addi $sp, $sp, 12 # Freeing space for arguments + addi $t0, $zero, 99 + sb $t0, 23($v0) # internal_18[15] = 'c' - # Allocating Int 10 - li $v0, 9 - addi $a0, $zero, 12 - syscall + addi $t0, $zero, 116 + sb $t0, 24($v0) # internal_18[16] = 't' - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 10 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_9 = address of allocated object Int + addi $t0, $zero, 111 + sb $t0, 25($v0) # internal_18[17] = 'o' - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t0, $zero, 114 + sb $t0, 26($v0) # internal_18[18] = 'r' - # Argument next - lw $t0, 44($sp) - sw $t0, 4($sp) # Storing next + addi $t0, $zero, 105 + sb $t0, 27($v0) # internal_18[19] = 'i' - # Argument internal_9 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_9 + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_18[20] = 'a' - # Calling function function_mult - jal function_mult - lw $ra, 8($sp) - sw $v1, 24($sp) # internal_10 = result of function_mult - addi $sp, $sp, 12 # Freeing space for arguments + addi $t0, $zero, 108 + sb $t0, 29($v0) # internal_18[21] = 'l' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_18[22] = ' ' - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t0, $zero, 111 + sb $t0, 31($v0) # internal_18[23] = 'o' - # Argument i - lw $t0, 68($sp) - sw $t0, 4($sp) # Storing i + addi $t0, $zero, 102 + sb $t0, 32($v0) # internal_18[24] = 'f' - # Argument internal_10 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_10 + addi $t0, $zero, 32 + sb $t0, 33($v0) # internal_18[25] = ' ' - # Calling function function_sub - jal function_sub - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_11 = result of function_sub - addi $sp, $sp, 12 # Freeing space for arguments + sb $zero, 34($v0) # Null-terminator at the end of the string + + sw $v0, 136($sp) # internal_18 = "\tTo find the factorial of " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 72($sp) + lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument internal_11 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_11 + # Argument internal_18 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_18 - # Calling function function_i2c_at_A2I - jal function_i2c_at_A2I + # Calling function function_out_string_at_IO + jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 16($sp) # internal_12 = result of function_i2c_at_A2I + sw $v1, 144($sp) # internal_19 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments + # Get attribute avar of self + lw $t0, 212($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702247711 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702247711 + j object_get_attribute_8781702247711 + int_get_attribute_8781702247711: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 128($sp) # internal_20 = self.avar + j end_get_attribute_8781702247711 + bool_get_attribute_8781702247711: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 128($sp) # internal_20 = self.avar + j end_get_attribute_8781702247711 + object_get_attribute_8781702247711: + sw $t1, 128($sp) # internal_20 = avar + end_get_attribute_8781702247711: + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_8 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_8 + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self - # Argument internal_12 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_12 + # Argument internal_20 + lw $t0, 140($sp) + sw $t0, 0($sp) # Storing internal_20 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function function_print_at_Main + jal function_print_at_Main lw $ra, 8($sp) - sw $v1, 12($sp) # internal_13 = result of function_concat_at_String + sw $v1, 136($sp) # internal_21 = result of function_print_at_Main addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: - # internal_0 = internal_13 - lw $t0, 0($sp) - sw $t0, 52($sp) - end_assign: - - # Jumping to endif_8792981818670 - j endif_8792981818670 - - endif_8792981818670: - - # Loading return value in $v1 - lw $v1, 52($sp) - - # Freeing space for local variables - addi $sp, $sp, 56 - - jr $ra - - function___init___at_Main: - # Function parameters - # $ra = 12($sp) - # self = 8($sp) - - # Reserving space for local variables - addi $sp, $sp, -8 - # Allocating String li $v0, 9 - addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 21 sw $t0, 4($v0) # Setting length of the string in the second word of the object - sb $zero, 8($v0) # Null-terminator at the end of the string + addi $t0, $zero, 46 + sb $t0, 8($v0) # internal_22[0] = '.' - sw $v0, 4($sp) # internal_0 = "" + addi $t0, $zero, 46 + sb $t0, 9($v0) # internal_22[1] = '.' - # Set attribute char of self - lw $t0, 8($sp) # $t0 = self - lw $t1, 4($sp) # $t1 = internal_0 - sw $t1, 8($t0) # self.char = internal_0 + addi $t0, $zero, 46 + sb $t0, 10($v0) # internal_22[2] = '.' - # Set attribute avar of self - lw $t0, 8($sp) # $t0 = self - sw $zero, 12($t0) # Set the attribute avar of self + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_22[3] = 'e' - # Set attribute a_var of self - lw $t0, 8($sp) # $t0 = self - sw $zero, 16($t0) # Set the attribute a_var of self + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_22[4] = 'n' - # Allocating Bool 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_22[5] = 't' - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_1 = address of allocated object Int + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_22[6] = 'e' - # Set attribute flag of self - lw $t0, 8($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_1 - sw $t1, 20($t0) # self.flag = internal_1 + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_22[7] = 'r' - # Loading return value in $v1 - lw $v1, 8($sp) + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_22[8] = ' ' - # Freeing space for local variables - addi $sp, $sp, 8 + addi $t0, $zero, 100 + sb $t0, 17($v0) # internal_22[9] = 'd' - jr $ra + addi $t0, $zero, 58 + sb $t0, 18($v0) # internal_22[10] = ':' - function_menu_at_Main: - # Function parameters - # $ra = 216($sp) - # self = 212($sp) + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_22[11] = '\n' - # Reserving space for local variables - addi $sp, $sp, -212 + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 120($sp) # internal_22 = "...enter d:\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_22 + lw $t0, 132($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 128($sp) # internal_23 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments # Allocating String li $v0, 9 - addi $a0, $zero, 30 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 21 + addi $t0, $zero, 20 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_0[0] = '\n' - addi $t0, $zero, 9 - sb $t0, 9($v0) # internal_0[1] = '\t' + sb $t0, 8($v0) # internal_24[0] = '\t' addi $t0, $zero, 84 - sb $t0, 10($v0) # internal_0[2] = 'T' + sb $t0, 9($v0) # internal_24[1] = 'T' addi $t0, $zero, 111 - sb $t0, 11($v0) # internal_0[3] = 'o' - - addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_0[4] = ' ' - - addi $t0, $zero, 97 - sb $t0, 13($v0) # internal_0[5] = 'a' - - addi $t0, $zero, 100 - sb $t0, 14($v0) # internal_0[6] = 'd' - - addi $t0, $zero, 100 - sb $t0, 15($v0) # internal_0[7] = 'd' + sb $t0, 10($v0) # internal_24[2] = 'o' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_0[8] = ' ' - - addi $t0, $zero, 97 - sb $t0, 17($v0) # internal_0[9] = 'a' + sb $t0, 11($v0) # internal_24[3] = ' ' - addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_0[10] = ' ' + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_24[4] = 's' - addi $t0, $zero, 110 - sb $t0, 19($v0) # internal_0[11] = 'n' + addi $t0, $zero, 113 + sb $t0, 13($v0) # internal_24[5] = 'q' addi $t0, $zero, 117 - sb $t0, 20($v0) # internal_0[12] = 'u' - - addi $t0, $zero, 109 - sb $t0, 21($v0) # internal_0[13] = 'm' - - addi $t0, $zero, 98 - sb $t0, 22($v0) # internal_0[14] = 'b' + sb $t0, 14($v0) # internal_24[6] = 'u' - addi $t0, $zero, 101 - sb $t0, 23($v0) # internal_0[15] = 'e' + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_24[7] = 'a' addi $t0, $zero, 114 - sb $t0, 24($v0) # internal_0[16] = 'r' - - addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_0[17] = ' ' - - addi $t0, $zero, 116 - sb $t0, 26($v0) # internal_0[18] = 't' + sb $t0, 16($v0) # internal_24[8] = 'r' - addi $t0, $zero, 111 - sb $t0, 27($v0) # internal_0[19] = 'o' + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_24[9] = 'e' addi $t0, $zero, 32 - sb $t0, 28($v0) # internal_0[20] = ' ' + sb $t0, 18($v0) # internal_24[10] = ' ' - sb $zero, 29($v0) # Null-terminator at the end of the string + sb $zero, 19($v0) # Null-terminator at the end of the string - sw $v0, 208($sp) # internal_0 = "\n\tTo add a number to " + sw $v0, 112($sp) # internal_24 = "\tTo square " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -7526,20 +8298,51 @@ lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument internal_0 - lw $t0, 220($sp) - sw $t0, 0($sp) # Storing internal_0 + # Argument internal_24 + lw $t0, 124($sp) + sw $t0, 0($sp) # Storing internal_24 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 216($sp) # internal_1 = result of function_out_string_at_IO + sw $v1, 120($sp) # internal_25 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Get attribute avar of self lw $t0, 212($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 200($sp) # internal_2 = avar + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702247819 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702247819 + j object_get_attribute_8781702247819 + int_get_attribute_8781702247819: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 104($sp) # internal_26 = self.avar + j end_get_attribute_8781702247819 + bool_get_attribute_8781702247819: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 104($sp) # internal_26 = self.avar + j end_get_attribute_8781702247819 + object_get_attribute_8781702247819: + sw $t1, 104($sp) # internal_26 = avar + end_get_attribute_8781702247819: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -7549,14 +8352,14 @@ lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument internal_2 - lw $t0, 212($sp) - sw $t0, 0($sp) # Storing internal_2 + # Argument internal_26 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_26 # Calling function function_print_at_Main jal function_print_at_Main lw $ra, 8($sp) - sw $v1, 208($sp) # internal_3 = result of function_print_at_Main + sw $v1, 112($sp) # internal_27 = result of function_print_at_Main addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -7567,48 +8370,48 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 12 + addi $t0, $zero, 21 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 46 - sb $t0, 8($v0) # internal_4[0] = '.' + sb $t0, 8($v0) # internal_28[0] = '.' addi $t0, $zero, 46 - sb $t0, 9($v0) # internal_4[1] = '.' + sb $t0, 9($v0) # internal_28[1] = '.' addi $t0, $zero, 46 - sb $t0, 10($v0) # internal_4[2] = '.' + sb $t0, 10($v0) # internal_28[2] = '.' addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_4[3] = 'e' + sb $t0, 11($v0) # internal_28[3] = 'e' addi $t0, $zero, 110 - sb $t0, 12($v0) # internal_4[4] = 'n' + sb $t0, 12($v0) # internal_28[4] = 'n' addi $t0, $zero, 116 - sb $t0, 13($v0) # internal_4[5] = 't' + sb $t0, 13($v0) # internal_28[5] = 't' addi $t0, $zero, 101 - sb $t0, 14($v0) # internal_4[6] = 'e' + sb $t0, 14($v0) # internal_28[6] = 'e' addi $t0, $zero, 114 - sb $t0, 15($v0) # internal_4[7] = 'r' + sb $t0, 15($v0) # internal_28[7] = 'r' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_4[8] = ' ' + sb $t0, 16($v0) # internal_28[8] = ' ' - addi $t0, $zero, 97 - sb $t0, 17($v0) # internal_4[9] = 'a' + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_28[9] = 'e' addi $t0, $zero, 58 - sb $t0, 18($v0) # internal_4[10] = ':' + sb $t0, 18($v0) # internal_28[10] = ':' addi $t0, $zero, 10 - sb $t0, 19($v0) # internal_4[11] = '\n' + sb $t0, 19($v0) # internal_28[11] = '\n' sb $zero, 20($v0) # Null-terminator at the end of the string - sw $v0, 192($sp) # internal_4 = "...enter a:\n" + sw $v0, 96($sp) # internal_28 = "...enter e:\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -7618,63 +8421,57 @@ lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument internal_4 - lw $t0, 204($sp) - sw $t0, 0($sp) # Storing internal_4 + # Argument internal_28 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_28 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 200($sp) # internal_5 = result of function_out_string_at_IO + sw $v1, 104($sp) # internal_29 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Allocating String li $v0, 9 - addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 18 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 11 + addi $t0, $zero, 18 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_6[0] = '\t' + sb $t0, 8($v0) # internal_30[0] = '\t' addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_6[1] = 'T' + sb $t0, 9($v0) # internal_30[1] = 'T' addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_6[2] = 'o' + sb $t0, 10($v0) # internal_30[2] = 'o' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_6[3] = ' ' - - addi $t0, $zero, 110 - sb $t0, 12($v0) # internal_6[4] = 'n' - - addi $t0, $zero, 101 - sb $t0, 13($v0) # internal_6[5] = 'e' + sb $t0, 11($v0) # internal_30[3] = ' ' - addi $t0, $zero, 103 - sb $t0, 14($v0) # internal_6[6] = 'g' + addi $t0, $zero, 99 + sb $t0, 12($v0) # internal_30[4] = 'c' - addi $t0, $zero, 97 - sb $t0, 15($v0) # internal_6[7] = 'a' + addi $t0, $zero, 117 + sb $t0, 13($v0) # internal_30[5] = 'u' - addi $t0, $zero, 116 - sb $t0, 16($v0) # internal_6[8] = 't' + addi $t0, $zero, 98 + sb $t0, 14($v0) # internal_30[6] = 'b' addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_6[9] = 'e' + sb $t0, 15($v0) # internal_30[7] = 'e' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_6[10] = ' ' + sb $t0, 16($v0) # internal_30[8] = ' ' - sb $zero, 19($v0) # Null-terminator at the end of the string + sb $zero, 17($v0) # Null-terminator at the end of the string - sw $v0, 184($sp) # internal_6 = "\tTo negate " + sw $v0, 88($sp) # internal_30 = "\tTo cube " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -7684,20 +8481,51 @@ lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument internal_6 - lw $t0, 196($sp) - sw $t0, 0($sp) # Storing internal_6 + # Argument internal_30 + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing internal_30 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 192($sp) # internal_7 = result of function_out_string_at_IO + sw $v1, 96($sp) # internal_31 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Get attribute avar of self lw $t0, 212($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 176($sp) # internal_8 = avar + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702247927 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702247927 + j object_get_attribute_8781702247927 + int_get_attribute_8781702247927: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 80($sp) # internal_32 = self.avar + j end_get_attribute_8781702247927 + bool_get_attribute_8781702247927: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 80($sp) # internal_32 = self.avar + j end_get_attribute_8781702247927 + object_get_attribute_8781702247927: + sw $t1, 80($sp) # internal_32 = avar + end_get_attribute_8781702247927: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -7707,14 +8535,14 @@ lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument internal_8 - lw $t0, 188($sp) - sw $t0, 0($sp) # Storing internal_8 + # Argument internal_32 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_32 # Calling function function_print_at_Main jal function_print_at_Main lw $ra, 8($sp) - sw $v1, 184($sp) # internal_9 = result of function_print_at_Main + sw $v1, 88($sp) # internal_33 = result of function_print_at_Main addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -7725,48 +8553,48 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 12 + addi $t0, $zero, 21 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 46 - sb $t0, 8($v0) # internal_10[0] = '.' + sb $t0, 8($v0) # internal_34[0] = '.' addi $t0, $zero, 46 - sb $t0, 9($v0) # internal_10[1] = '.' + sb $t0, 9($v0) # internal_34[1] = '.' addi $t0, $zero, 46 - sb $t0, 10($v0) # internal_10[2] = '.' + sb $t0, 10($v0) # internal_34[2] = '.' addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_10[3] = 'e' + sb $t0, 11($v0) # internal_34[3] = 'e' addi $t0, $zero, 110 - sb $t0, 12($v0) # internal_10[4] = 'n' + sb $t0, 12($v0) # internal_34[4] = 'n' addi $t0, $zero, 116 - sb $t0, 13($v0) # internal_10[5] = 't' + sb $t0, 13($v0) # internal_34[5] = 't' addi $t0, $zero, 101 - sb $t0, 14($v0) # internal_10[6] = 'e' + sb $t0, 14($v0) # internal_34[6] = 'e' addi $t0, $zero, 114 - sb $t0, 15($v0) # internal_10[7] = 'r' + sb $t0, 15($v0) # internal_34[7] = 'r' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_10[8] = ' ' + sb $t0, 16($v0) # internal_34[8] = ' ' - addi $t0, $zero, 98 - sb $t0, 17($v0) # internal_10[9] = 'b' + addi $t0, $zero, 102 + sb $t0, 17($v0) # internal_34[9] = 'f' addi $t0, $zero, 58 - sb $t0, 18($v0) # internal_10[10] = ':' + sb $t0, 18($v0) # internal_34[10] = ':' addi $t0, $zero, 10 - sb $t0, 19($v0) # internal_10[11] = '\n' + sb $t0, 19($v0) # internal_34[11] = '\n' sb $zero, 20($v0) # Null-terminator at the end of the string - sw $v0, 168($sp) # internal_10 = "...enter b:\n" + sw $v0, 72($sp) # internal_34 = "...enter f:\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -7776,126 +8604,78 @@ lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument internal_10 - lw $t0, 180($sp) - sw $t0, 0($sp) # Storing internal_10 + # Argument internal_34 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_34 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 176($sp) # internal_11 = result of function_out_string_at_IO + sw $v1, 80($sp) # internal_35 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Allocating String li $v0, 9 - addi $a0, $zero, 41 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 25 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 32 + addi $t0, $zero, 25 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_12[0] = '\t' + sb $t0, 8($v0) # internal_36[0] = '\t' addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_12[1] = 'T' + sb $t0, 9($v0) # internal_36[1] = 'T' addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_12[2] = 'o' + sb $t0, 10($v0) # internal_36[2] = 'o' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_12[3] = ' ' + sb $t0, 11($v0) # internal_36[3] = ' ' addi $t0, $zero, 102 - sb $t0, 12($v0) # internal_12[4] = 'f' + sb $t0, 12($v0) # internal_36[4] = 'f' addi $t0, $zero, 105 - sb $t0, 13($v0) # internal_12[5] = 'i' + sb $t0, 13($v0) # internal_36[5] = 'i' addi $t0, $zero, 110 - sb $t0, 14($v0) # internal_12[6] = 'n' + sb $t0, 14($v0) # internal_36[6] = 'n' addi $t0, $zero, 100 - sb $t0, 15($v0) # internal_12[7] = 'd' + sb $t0, 15($v0) # internal_36[7] = 'd' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_12[8] = ' ' + sb $t0, 16($v0) # internal_36[8] = ' ' - addi $t0, $zero, 116 - sb $t0, 17($v0) # internal_12[9] = 't' + addi $t0, $zero, 111 + sb $t0, 17($v0) # internal_36[9] = 'o' - addi $t0, $zero, 104 - sb $t0, 18($v0) # internal_12[10] = 'h' + addi $t0, $zero, 117 + sb $t0, 18($v0) # internal_36[10] = 'u' - addi $t0, $zero, 101 - sb $t0, 19($v0) # internal_12[11] = 'e' + addi $t0, $zero, 116 + sb $t0, 19($v0) # internal_36[11] = 't' addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_12[12] = ' ' - - addi $t0, $zero, 100 - sb $t0, 21($v0) # internal_12[13] = 'd' + sb $t0, 20($v0) # internal_36[12] = ' ' addi $t0, $zero, 105 - sb $t0, 22($v0) # internal_12[14] = 'i' - - addi $t0, $zero, 102 - sb $t0, 23($v0) # internal_12[15] = 'f' + sb $t0, 21($v0) # internal_36[13] = 'i' addi $t0, $zero, 102 - sb $t0, 24($v0) # internal_12[16] = 'f' - - addi $t0, $zero, 101 - sb $t0, 25($v0) # internal_12[17] = 'e' - - addi $t0, $zero, 114 - sb $t0, 26($v0) # internal_12[18] = 'r' - - addi $t0, $zero, 101 - sb $t0, 27($v0) # internal_12[19] = 'e' - - addi $t0, $zero, 110 - sb $t0, 28($v0) # internal_12[20] = 'n' - - addi $t0, $zero, 99 - sb $t0, 29($v0) # internal_12[21] = 'c' - - addi $t0, $zero, 101 - sb $t0, 30($v0) # internal_12[22] = 'e' - - addi $t0, $zero, 32 - sb $t0, 31($v0) # internal_12[23] = ' ' - - addi $t0, $zero, 98 - sb $t0, 32($v0) # internal_12[24] = 'b' - - addi $t0, $zero, 101 - sb $t0, 33($v0) # internal_12[25] = 'e' - - addi $t0, $zero, 116 - sb $t0, 34($v0) # internal_12[26] = 't' - - addi $t0, $zero, 119 - sb $t0, 35($v0) # internal_12[27] = 'w' - - addi $t0, $zero, 101 - sb $t0, 36($v0) # internal_12[28] = 'e' - - addi $t0, $zero, 101 - sb $t0, 37($v0) # internal_12[29] = 'e' - - addi $t0, $zero, 110 - sb $t0, 38($v0) # internal_12[30] = 'n' + sb $t0, 22($v0) # internal_36[14] = 'f' addi $t0, $zero, 32 - sb $t0, 39($v0) # internal_12[31] = ' ' + sb $t0, 23($v0) # internal_36[15] = ' ' - sb $zero, 40($v0) # Null-terminator at the end of the string + sb $zero, 24($v0) # Null-terminator at the end of the string - sw $v0, 160($sp) # internal_12 = "\tTo find the difference between " + sw $v0, 64($sp) # internal_36 = "\tTo find out if " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -7905,20 +8685,51 @@ lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument internal_12 - lw $t0, 172($sp) - sw $t0, 0($sp) # Storing internal_12 + # Argument internal_36 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_36 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 168($sp) # internal_13 = result of function_out_string_at_IO + sw $v1, 72($sp) # internal_37 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Get attribute avar of self lw $t0, 212($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 152($sp) # internal_14 = avar + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702248039 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702248039 + j object_get_attribute_8781702248039 + int_get_attribute_8781702248039: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 56($sp) # internal_38 = self.avar + j end_get_attribute_8781702248039 + bool_get_attribute_8781702248039: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 56($sp) # internal_38 = self.avar + j end_get_attribute_8781702248039 + object_get_attribute_8781702248039: + sw $t1, 56($sp) # internal_38 = avar + end_get_attribute_8781702248039: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -7928,14 +8739,14 @@ lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument internal_14 - lw $t0, 164($sp) - sw $t0, 0($sp) # Storing internal_14 + # Argument internal_38 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_38 # Calling function function_print_at_Main jal function_print_at_Main lw $ra, 8($sp) - sw $v1, 160($sp) # internal_15 = result of function_print_at_Main + sw $v1, 64($sp) # internal_39 = result of function_print_at_Main addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -7946,102 +8757,102 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 30 + addi $t0, $zero, 39 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 97 - sb $t0, 8($v0) # internal_16[0] = 'a' - - addi $t0, $zero, 110 - sb $t0, 9($v0) # internal_16[1] = 'n' - - addi $t0, $zero, 100 - sb $t0, 10($v0) # internal_16[2] = 'd' + addi $t0, $zero, 105 + sb $t0, 8($v0) # internal_40[0] = 'i' + + addi $t0, $zero, 115 + sb $t0, 9($v0) # internal_40[1] = 's' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_16[3] = ' ' + sb $t0, 10($v0) # internal_40[2] = ' ' addi $t0, $zero, 97 - sb $t0, 12($v0) # internal_16[4] = 'a' + sb $t0, 11($v0) # internal_40[3] = 'a' - addi $t0, $zero, 110 - sb $t0, 13($v0) # internal_16[5] = 'n' + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_40[4] = ' ' - addi $t0, $zero, 111 - sb $t0, 14($v0) # internal_16[6] = 'o' + addi $t0, $zero, 109 + sb $t0, 13($v0) # internal_40[5] = 'm' - addi $t0, $zero, 116 - sb $t0, 15($v0) # internal_16[7] = 't' + addi $t0, $zero, 117 + sb $t0, 14($v0) # internal_40[6] = 'u' - addi $t0, $zero, 104 - sb $t0, 16($v0) # internal_16[8] = 'h' + addi $t0, $zero, 108 + sb $t0, 15($v0) # internal_40[7] = 'l' - addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_16[9] = 'e' + addi $t0, $zero, 116 + sb $t0, 16($v0) # internal_40[8] = 't' - addi $t0, $zero, 114 - sb $t0, 18($v0) # internal_16[10] = 'r' + addi $t0, $zero, 105 + sb $t0, 17($v0) # internal_40[9] = 'i' - addi $t0, $zero, 32 - sb $t0, 19($v0) # internal_16[11] = ' ' + addi $t0, $zero, 112 + sb $t0, 18($v0) # internal_40[10] = 'p' - addi $t0, $zero, 110 - sb $t0, 20($v0) # internal_16[12] = 'n' + addi $t0, $zero, 108 + sb $t0, 19($v0) # internal_40[11] = 'l' - addi $t0, $zero, 117 - sb $t0, 21($v0) # internal_16[13] = 'u' + addi $t0, $zero, 101 + sb $t0, 20($v0) # internal_40[12] = 'e' - addi $t0, $zero, 109 - sb $t0, 22($v0) # internal_16[14] = 'm' + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_40[13] = ' ' - addi $t0, $zero, 98 - sb $t0, 23($v0) # internal_16[15] = 'b' + addi $t0, $zero, 111 + sb $t0, 22($v0) # internal_40[14] = 'o' - addi $t0, $zero, 101 - sb $t0, 24($v0) # internal_16[16] = 'e' + addi $t0, $zero, 102 + sb $t0, 23($v0) # internal_40[15] = 'f' - addi $t0, $zero, 114 - sb $t0, 25($v0) # internal_16[17] = 'r' + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_40[16] = ' ' + + addi $t0, $zero, 51 + sb $t0, 25($v0) # internal_40[17] = '3' addi $t0, $zero, 46 - sb $t0, 26($v0) # internal_16[18] = '.' + sb $t0, 26($v0) # internal_40[18] = '.' addi $t0, $zero, 46 - sb $t0, 27($v0) # internal_16[19] = '.' + sb $t0, 27($v0) # internal_40[19] = '.' addi $t0, $zero, 46 - sb $t0, 28($v0) # internal_16[20] = '.' + sb $t0, 28($v0) # internal_40[20] = '.' addi $t0, $zero, 101 - sb $t0, 29($v0) # internal_16[21] = 'e' + sb $t0, 29($v0) # internal_40[21] = 'e' addi $t0, $zero, 110 - sb $t0, 30($v0) # internal_16[22] = 'n' + sb $t0, 30($v0) # internal_40[22] = 'n' addi $t0, $zero, 116 - sb $t0, 31($v0) # internal_16[23] = 't' + sb $t0, 31($v0) # internal_40[23] = 't' addi $t0, $zero, 101 - sb $t0, 32($v0) # internal_16[24] = 'e' + sb $t0, 32($v0) # internal_40[24] = 'e' addi $t0, $zero, 114 - sb $t0, 33($v0) # internal_16[25] = 'r' + sb $t0, 33($v0) # internal_40[25] = 'r' addi $t0, $zero, 32 - sb $t0, 34($v0) # internal_16[26] = ' ' + sb $t0, 34($v0) # internal_40[26] = ' ' - addi $t0, $zero, 99 - sb $t0, 35($v0) # internal_16[27] = 'c' + addi $t0, $zero, 103 + sb $t0, 35($v0) # internal_40[27] = 'g' addi $t0, $zero, 58 - sb $t0, 36($v0) # internal_16[28] = ':' + sb $t0, 36($v0) # internal_40[28] = ':' addi $t0, $zero, 10 - sb $t0, 37($v0) # internal_16[29] = '\n' + sb $t0, 37($v0) # internal_40[29] = '\n' sb $zero, 38($v0) # Null-terminator at the end of the string - sw $v0, 144($sp) # internal_16 = "and another number...enter c:\n" + sw $v0, 48($sp) # internal_40 = "is a multiple of 3...enter g:\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -8051,131 +8862,198 @@ lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument internal_16 - lw $t0, 156($sp) - sw $t0, 0($sp) # Storing internal_16 + # Argument internal_40 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_40 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 152($sp) # internal_17 = result of function_out_string_at_IO + sw $v1, 56($sp) # internal_41 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Allocating String li $v0, 9 - addi $a0, $zero, 35 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 26 + addi $t0, $zero, 20 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_18[0] = '\t' + sb $t0, 8($v0) # internal_42[0] = '\t' addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_18[1] = 'T' + sb $t0, 9($v0) # internal_42[1] = 'T' addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_18[2] = 'o' + sb $t0, 10($v0) # internal_42[2] = 'o' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_18[3] = ' ' + sb $t0, 11($v0) # internal_42[3] = ' ' - addi $t0, $zero, 102 - sb $t0, 12($v0) # internal_18[4] = 'f' + addi $t0, $zero, 100 + sb $t0, 12($v0) # internal_42[4] = 'd' addi $t0, $zero, 105 - sb $t0, 13($v0) # internal_18[5] = 'i' + sb $t0, 13($v0) # internal_42[5] = 'i' - addi $t0, $zero, 110 - sb $t0, 14($v0) # internal_18[6] = 'n' + addi $t0, $zero, 118 + sb $t0, 14($v0) # internal_42[6] = 'v' + + addi $t0, $zero, 105 + sb $t0, 15($v0) # internal_42[7] = 'i' addi $t0, $zero, 100 - sb $t0, 15($v0) # internal_18[7] = 'd' + sb $t0, 16($v0) # internal_42[8] = 'd' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_42[9] = 'e' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_18[8] = ' ' + sb $t0, 18($v0) # internal_42[10] = ' ' - addi $t0, $zero, 116 - sb $t0, 17($v0) # internal_18[9] = 't' + sb $zero, 19($v0) # Null-terminator at the end of the string - addi $t0, $zero, 104 - sb $t0, 18($v0) # internal_18[10] = 'h' + sw $v0, 40($sp) # internal_42 = "\tTo divide " - addi $t0, $zero, 101 - sb $t0, 19($v0) # internal_18[11] = 'e' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_18[12] = ' ' + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self - addi $t0, $zero, 102 - sb $t0, 21($v0) # internal_18[13] = 'f' + # Argument internal_42 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_42 - addi $t0, $zero, 97 - sb $t0, 22($v0) # internal_18[14] = 'a' + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_43 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 99 - sb $t0, 23($v0) # internal_18[15] = 'c' + # Get attribute avar of self + lw $t0, 212($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702248147 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702248147 + j object_get_attribute_8781702248147 + int_get_attribute_8781702248147: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_44 = self.avar + j end_get_attribute_8781702248147 + bool_get_attribute_8781702248147: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_44 = self.avar + j end_get_attribute_8781702248147 + object_get_attribute_8781702248147: + sw $t1, 32($sp) # internal_44 = avar + end_get_attribute_8781702248147: - addi $t0, $zero, 116 - sb $t0, 24($v0) # internal_18[16] = 't' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 111 - sb $t0, 25($v0) # internal_18[17] = 'o' + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self - addi $t0, $zero, 114 - sb $t0, 26($v0) # internal_18[18] = 'r' + # Argument internal_44 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_44 - addi $t0, $zero, 105 - sb $t0, 27($v0) # internal_18[19] = 'i' + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_45 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 97 - sb $t0, 28($v0) # internal_18[20] = 'a' + # Allocating String + li $v0, 9 + addi $a0, $zero, 25 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - addi $t0, $zero, 108 - sb $t0, 29($v0) # internal_18[21] = 'l' + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 32 - sb $t0, 30($v0) # internal_18[22] = ' ' + addi $t0, $zero, 25 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 111 - sb $t0, 31($v0) # internal_18[23] = 'o' + addi $t0, $zero, 98 + sb $t0, 8($v0) # internal_46[0] = 'b' - addi $t0, $zero, 102 - sb $t0, 32($v0) # internal_18[24] = 'f' + addi $t0, $zero, 121 + sb $t0, 9($v0) # internal_46[1] = 'y' addi $t0, $zero, 32 - sb $t0, 33($v0) # internal_18[25] = ' ' + sb $t0, 10($v0) # internal_46[2] = ' ' - sb $zero, 34($v0) # Null-terminator at the end of the string + addi $t0, $zero, 56 + sb $t0, 11($v0) # internal_46[3] = '8' - sw $v0, 136($sp) # internal_18 = "\tTo find the factorial of " + addi $t0, $zero, 46 + sb $t0, 12($v0) # internal_46[4] = '.' - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t0, $zero, 46 + sb $t0, 13($v0) # internal_46[5] = '.' - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self + addi $t0, $zero, 46 + sb $t0, 14($v0) # internal_46[6] = '.' + + addi $t0, $zero, 101 + sb $t0, 15($v0) # internal_46[7] = 'e' + + addi $t0, $zero, 110 + sb $t0, 16($v0) # internal_46[8] = 'n' + + addi $t0, $zero, 116 + sb $t0, 17($v0) # internal_46[9] = 't' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_46[10] = 'e' + + addi $t0, $zero, 114 + sb $t0, 19($v0) # internal_46[11] = 'r' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_46[12] = ' ' + + addi $t0, $zero, 104 + sb $t0, 21($v0) # internal_46[13] = 'h' + + addi $t0, $zero, 58 + sb $t0, 22($v0) # internal_46[14] = ':' - # Argument internal_18 - lw $t0, 148($sp) - sw $t0, 0($sp) # Storing internal_18 + addi $t0, $zero, 10 + sb $t0, 23($v0) # internal_46[15] = '\n' - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 144($sp) # internal_19 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments + sb $zero, 24($v0) # Null-terminator at the end of the string - # Get attribute avar of self - lw $t0, 212($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 128($sp) # internal_20 = avar + sw $v0, 24($sp) # internal_46 = "by 8...enter h:\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -8185,66 +9063,126 @@ lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument internal_20 - lw $t0, 140($sp) - sw $t0, 0($sp) # Storing internal_20 + # Argument internal_46 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_46 - # Calling function function_print_at_Main - jal function_print_at_Main + # Calling function function_out_string_at_IO + jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 136($sp) # internal_21 = result of function_print_at_Main + sw $v1, 32($sp) # internal_47 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Allocating String li $v0, 9 - addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 41 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 12 + addi $t0, $zero, 41 sw $t0, 4($v0) # Setting length of the string in the second word of the object + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_48[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_48[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_48[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_48[3] = ' ' + + addi $t0, $zero, 103 + sb $t0, 12($v0) # internal_48[4] = 'g' + + addi $t0, $zero, 101 + sb $t0, 13($v0) # internal_48[5] = 'e' + + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_48[6] = 't' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_48[7] = ' ' + + addi $t0, $zero, 97 + sb $t0, 16($v0) # internal_48[8] = 'a' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_48[9] = ' ' + + addi $t0, $zero, 110 + sb $t0, 18($v0) # internal_48[10] = 'n' + + addi $t0, $zero, 101 + sb $t0, 19($v0) # internal_48[11] = 'e' + + addi $t0, $zero, 119 + sb $t0, 20($v0) # internal_48[12] = 'w' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_48[13] = ' ' + + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_48[14] = 'n' + + addi $t0, $zero, 117 + sb $t0, 23($v0) # internal_48[15] = 'u' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_48[16] = 'm' + + addi $t0, $zero, 98 + sb $t0, 25($v0) # internal_48[17] = 'b' + + addi $t0, $zero, 101 + sb $t0, 26($v0) # internal_48[18] = 'e' + + addi $t0, $zero, 114 + sb $t0, 27($v0) # internal_48[19] = 'r' + addi $t0, $zero, 46 - sb $t0, 8($v0) # internal_22[0] = '.' + sb $t0, 28($v0) # internal_48[20] = '.' addi $t0, $zero, 46 - sb $t0, 9($v0) # internal_22[1] = '.' + sb $t0, 29($v0) # internal_48[21] = '.' addi $t0, $zero, 46 - sb $t0, 10($v0) # internal_22[2] = '.' + sb $t0, 30($v0) # internal_48[22] = '.' addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_22[3] = 'e' + sb $t0, 31($v0) # internal_48[23] = 'e' addi $t0, $zero, 110 - sb $t0, 12($v0) # internal_22[4] = 'n' + sb $t0, 32($v0) # internal_48[24] = 'n' addi $t0, $zero, 116 - sb $t0, 13($v0) # internal_22[5] = 't' + sb $t0, 33($v0) # internal_48[25] = 't' addi $t0, $zero, 101 - sb $t0, 14($v0) # internal_22[6] = 'e' + sb $t0, 34($v0) # internal_48[26] = 'e' addi $t0, $zero, 114 - sb $t0, 15($v0) # internal_22[7] = 'r' + sb $t0, 35($v0) # internal_48[27] = 'r' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_22[8] = ' ' + sb $t0, 36($v0) # internal_48[28] = ' ' - addi $t0, $zero, 100 - sb $t0, 17($v0) # internal_22[9] = 'd' + addi $t0, $zero, 106 + sb $t0, 37($v0) # internal_48[29] = 'j' addi $t0, $zero, 58 - sb $t0, 18($v0) # internal_22[10] = ':' + sb $t0, 38($v0) # internal_48[30] = ':' addi $t0, $zero, 10 - sb $t0, 19($v0) # internal_22[11] = '\n' + sb $t0, 39($v0) # internal_48[31] = '\n' - sb $zero, 20($v0) # Null-terminator at the end of the string + sb $zero, 40($v0) # Null-terminator at the end of the string - sw $v0, 120($sp) # internal_22 = "...enter d:\n" + sw $v0, 16($sp) # internal_48 = "\tTo get a new number...enter j:\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -8254,63 +9192,93 @@ lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument internal_22 - lw $t0, 132($sp) - sw $t0, 0($sp) # Storing internal_22 + # Argument internal_48 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_48 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 128($sp) # internal_23 = result of function_out_string_at_IO + sw $v1, 24($sp) # internal_49 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Allocating String li $v0, 9 - addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 30 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 11 + addi $t0, $zero, 30 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_24[0] = '\t' + sb $t0, 8($v0) # internal_50[0] = '\t' addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_24[1] = 'T' + sb $t0, 9($v0) # internal_50[1] = 'T' addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_24[2] = 'o' + sb $t0, 10($v0) # internal_50[2] = 'o' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_24[3] = ' ' - - addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_24[4] = 's' + sb $t0, 11($v0) # internal_50[3] = ' ' addi $t0, $zero, 113 - sb $t0, 13($v0) # internal_24[5] = 'q' + sb $t0, 12($v0) # internal_50[4] = 'q' addi $t0, $zero, 117 - sb $t0, 14($v0) # internal_24[6] = 'u' + sb $t0, 13($v0) # internal_50[5] = 'u' - addi $t0, $zero, 97 - sb $t0, 15($v0) # internal_24[7] = 'a' + addi $t0, $zero, 105 + sb $t0, 14($v0) # internal_50[6] = 'i' - addi $t0, $zero, 114 - sb $t0, 16($v0) # internal_24[8] = 'r' + addi $t0, $zero, 116 + sb $t0, 15($v0) # internal_50[7] = 't' + + addi $t0, $zero, 46 + sb $t0, 16($v0) # internal_50[8] = '.' + + addi $t0, $zero, 46 + sb $t0, 17($v0) # internal_50[9] = '.' + + addi $t0, $zero, 46 + sb $t0, 18($v0) # internal_50[10] = '.' addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_24[9] = 'e' + sb $t0, 19($v0) # internal_50[11] = 'e' + + addi $t0, $zero, 110 + sb $t0, 20($v0) # internal_50[12] = 'n' + + addi $t0, $zero, 116 + sb $t0, 21($v0) # internal_50[13] = 't' + + addi $t0, $zero, 101 + sb $t0, 22($v0) # internal_50[14] = 'e' + + addi $t0, $zero, 114 + sb $t0, 23($v0) # internal_50[15] = 'r' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_24[10] = ' ' + sb $t0, 24($v0) # internal_50[16] = ' ' - sb $zero, 19($v0) # Null-terminator at the end of the string + addi $t0, $zero, 113 + sb $t0, 25($v0) # internal_50[17] = 'q' - sw $v0, 112($sp) # internal_24 = "\tTo square " + addi $t0, $zero, 58 + sb $t0, 26($v0) # internal_50[18] = ':' + + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_50[19] = '\n' + + addi $t0, $zero, 10 + sb $t0, 28($v0) # internal_50[20] = '\n' + + sb $zero, 29($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_50 = "\tTo quit...enter q:\n\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -8320,1226 +9288,1749 @@ lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument internal_24 - lw $t0, 124($sp) - sw $t0, 0($sp) # Storing internal_24 + # Argument internal_50 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_50 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 120($sp) # internal_25 = result of function_out_string_at_IO + sw $v1, 16($sp) # internal_51 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - # Get attribute avar of self - lw $t0, 212($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 104($sp) # internal_26 = avar + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_in_string_at_IO + jal function_in_string_at_IO + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_52 = result of function_in_string_at_IO + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 212 + + jr $ra + + function_prompt_at_Main: + # Function parameters + # $ra = 24($sp) + # self = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_0[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 16($sp) # internal_0 = "\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing self - # Argument internal_26 - lw $t0, 116($sp) - sw $t0, 0($sp) # Storing internal_26 + # Argument internal_0 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_0 - # Calling function function_print_at_Main - jal function_print_at_Main + # Calling function function_out_string_at_IO + jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 112($sp) # internal_27 = result of function_print_at_Main + sw $v1, 24($sp) # internal_1 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Allocating String li $v0, 9 - addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 35 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 12 + addi $t0, $zero, 35 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 46 - sb $t0, 8($v0) # internal_28[0] = '.' + addi $t0, $zero, 80 + sb $t0, 8($v0) # internal_2[0] = 'P' - addi $t0, $zero, 46 - sb $t0, 9($v0) # internal_28[1] = '.' + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_2[1] = 'l' - addi $t0, $zero, 46 - sb $t0, 10($v0) # internal_28[2] = '.' + addi $t0, $zero, 101 + sb $t0, 10($v0) # internal_2[2] = 'e' + + addi $t0, $zero, 97 + sb $t0, 11($v0) # internal_2[3] = 'a' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_2[4] = 's' addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_28[3] = 'e' + sb $t0, 13($v0) # internal_2[5] = 'e' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_2[6] = ' ' + + addi $t0, $zero, 101 + sb $t0, 15($v0) # internal_2[7] = 'e' addi $t0, $zero, 110 - sb $t0, 12($v0) # internal_28[4] = 'n' + sb $t0, 16($v0) # internal_2[8] = 'n' addi $t0, $zero, 116 - sb $t0, 13($v0) # internal_28[5] = 't' + sb $t0, 17($v0) # internal_2[9] = 't' addi $t0, $zero, 101 - sb $t0, 14($v0) # internal_28[6] = 'e' + sb $t0, 18($v0) # internal_2[10] = 'e' addi $t0, $zero, 114 - sb $t0, 15($v0) # internal_28[7] = 'r' + sb $t0, 19($v0) # internal_2[11] = 'r' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_28[8] = ' ' + sb $t0, 20($v0) # internal_2[12] = ' ' + + addi $t0, $zero, 97 + sb $t0, 21($v0) # internal_2[13] = 'a' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_2[14] = ' ' + + addi $t0, $zero, 110 + sb $t0, 23($v0) # internal_2[15] = 'n' + + addi $t0, $zero, 117 + sb $t0, 24($v0) # internal_2[16] = 'u' + + addi $t0, $zero, 109 + sb $t0, 25($v0) # internal_2[17] = 'm' + + addi $t0, $zero, 98 + sb $t0, 26($v0) # internal_2[18] = 'b' addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_28[9] = 'e' + sb $t0, 27($v0) # internal_2[19] = 'e' - addi $t0, $zero, 58 - sb $t0, 18($v0) # internal_28[10] = ':' + addi $t0, $zero, 114 + sb $t0, 28($v0) # internal_2[20] = 'r' - addi $t0, $zero, 10 - sb $t0, 19($v0) # internal_28[11] = '\n' + addi $t0, $zero, 46 + sb $t0, 29($v0) # internal_2[21] = '.' - sb $zero, 20($v0) # Null-terminator at the end of the string + addi $t0, $zero, 46 + sb $t0, 30($v0) # internal_2[22] = '.' - sw $v0, 96($sp) # internal_28 = "...enter e:\n" + addi $t0, $zero, 46 + sb $t0, 31($v0) # internal_2[23] = '.' + + addi $t0, $zero, 32 + sb $t0, 32($v0) # internal_2[24] = ' ' + + addi $t0, $zero, 32 + sb $t0, 33($v0) # internal_2[25] = ' ' + + sb $zero, 34($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_2 = "Please enter a number... " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing self - # Argument internal_28 - lw $t0, 108($sp) - sw $t0, 0($sp) # Storing internal_28 + # Argument internal_2 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_2 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 104($sp) # internal_29 = result of function_out_string_at_IO + sw $v1, 16($sp) # internal_3 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - # Allocating String - li $v0, 9 - addi $a0, $zero, 18 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 9 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_30[0] = '\t' + # Argument self + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing self - addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_30[1] = 'T' + # Calling function function_in_string_at_IO + jal function_in_string_at_IO + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_4 = result of function_in_string_at_IO + addi $sp, $sp, 8 # Freeing space for arguments - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_30[2] = 'o' + # Loading return value in $v1 + lw $v1, 0($sp) - addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_30[3] = ' ' + # Freeing space for local variables + addi $sp, $sp, 20 - addi $t0, $zero, 99 - sb $t0, 12($v0) # internal_30[4] = 'c' + jr $ra - addi $t0, $zero, 117 - sb $t0, 13($v0) # internal_30[5] = 'u' + function_get_int_at_Main: + # Function parameters + # $ra = 24($sp) + # self = 20($sp) - addi $t0, $zero, 98 - sb $t0, 14($v0) # internal_30[6] = 'b' + # Reserving space for local variables + addi $sp, $sp, -20 - addi $t0, $zero, 101 - sb $t0, 15($v0) # internal_30[7] = 'e' + # Allocating A2I + li $v0, 9 + lw $a0, type_A2I + syscall + la $t0, type_A2I # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_1 = address of allocated object A2I - addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_30[8] = ' ' + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - sb $zero, 17($v0) # Null-terminator at the end of the string + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 - sw $v0, 88($sp) # internal_30 = "\tTo cube " + # Calling function function___init___at_A2I + jal function___init___at_A2I + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_1 = result of function___init___at_A2I + addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self + # Argument z + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing z - # Argument internal_30 - lw $t0, 100($sp) - sw $t0, 0($sp) # Storing internal_30 + # Argument internal_1 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_1 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function function_assign + jal function_assign lw $ra, 8($sp) - sw $v1, 96($sp) # internal_31 = result of function_out_string_at_IO + sw $v1, 28($sp) # z = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # Get attribute avar of self - lw $t0, 212($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 80($sp) # internal_32 = avar + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_prompt_at_Main + jal function_prompt_at_Main + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_3 = result of function_prompt_at_Main + addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self + # Argument s + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing s - # Argument internal_32 - lw $t0, 92($sp) - sw $t0, 0($sp) # Storing internal_32 + # Argument internal_3 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_3 - # Calling function function_print_at_Main - jal function_print_at_Main + # Calling function function_assign + jal function_assign lw $ra, 8($sp) - sw $v1, 88($sp) # internal_33 = result of function_print_at_Main + sw $v1, 20($sp) # s = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # Allocating String - li $v0, 9 - addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 12 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 46 - sb $t0, 8($v0) # internal_34[0] = '.' - - addi $t0, $zero, 46 - sb $t0, 9($v0) # internal_34[1] = '.' - - addi $t0, $zero, 46 - sb $t0, 10($v0) # internal_34[2] = '.' - - addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_34[3] = 'e' - - addi $t0, $zero, 110 - sb $t0, 12($v0) # internal_34[4] = 'n' - - addi $t0, $zero, 116 - sb $t0, 13($v0) # internal_34[5] = 't' - - addi $t0, $zero, 101 - sb $t0, 14($v0) # internal_34[6] = 'e' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 114 - sb $t0, 15($v0) # internal_34[7] = 'r' + # Argument z + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing z - addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_34[8] = ' ' + # Argument s + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing s - addi $t0, $zero, 102 - sb $t0, 17($v0) # internal_34[9] = 'f' + # Calling function function_a2i_at_A2I + jal function_a2i_at_A2I + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_4 = result of function_a2i_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 58 - sb $t0, 18($v0) # internal_34[10] = ':' + # Loading return value in $v1 + lw $v1, 0($sp) - addi $t0, $zero, 10 - sb $t0, 19($v0) # internal_34[11] = '\n' + # Freeing space for local variables + addi $sp, $sp, 20 - sb $zero, 20($v0) # Null-terminator at the end of the string + jr $ra - sw $v0, 72($sp) # internal_34 = "...enter f:\n" + function_is_even_at_Main: + # Function parameters + # $ra = 96($sp) + # self = 92($sp) + # num = 88($sp) + + # Reserving space for local variables + addi $sp, $sp, -88 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self + # Argument x + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing x - # Argument internal_34 - lw $t0, 84($sp) - sw $t0, 0($sp) # Storing internal_34 + # Argument num + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing num - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function function_assign + jal function_assign lw $ra, 8($sp) - sw $v1, 80($sp) # internal_35 = result of function_out_string_at_IO + sw $v1, 96($sp) # x = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # Allocating String + # Allocating Bool 0 li $v0, 9 - addi $a0, $zero, 25 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Bool # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_2 = address of allocated object Int - addi $t0, $zero, 16 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_36[0] = '\t' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_3 = address of allocated object Int - addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_36[1] = 'T' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_36[2] = 'o' + # Argument x + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing x - addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_36[3] = ' ' + # Argument internal_3 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_3 - addi $t0, $zero, 102 - sb $t0, 12($v0) # internal_36[4] = 'f' + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_4 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 105 - sb $t0, 13($v0) # internal_36[5] = 'i' + # internal_2 = internal_4 + lw $t0, 68($sp) + sw $t0, 76($sp) - addi $t0, $zero, 110 - sb $t0, 14($v0) # internal_36[6] = 'n' + # If internal_2 then goto then_8781702295071 + lw $t0, 76($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8781702295071 - addi $t0, $zero, 100 - sb $t0, 15($v0) # internal_36[7] = 'd' + # Jumping to else_8781702295071 + j else_8781702295071 - addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_36[8] = ' ' + then_8781702295071: - addi $t0, $zero, 111 - sb $t0, 17($v0) # internal_36[9] = 'o' + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 117 - sb $t0, 18($v0) # internal_36[10] = 'u' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_5 = address of allocated object Int - addi $t0, $zero, 116 - sb $t0, 19($v0) # internal_36[11] = 't' + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_36[12] = ' ' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_6 = address of allocated object Int - addi $t0, $zero, 105 - sb $t0, 21($v0) # internal_36[13] = 'i' + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 102 - sb $t0, 22($v0) # internal_36[14] = 'f' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_7 = address of allocated object Int - addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_36[15] = ' ' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - sb $zero, 24($v0) # Null-terminator at the end of the string + # Argument x + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing x - sw $v0, 64($sp) # internal_36 = "\tTo find out if " + # Argument internal_6 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_7 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self + # Argument internal_7 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_7 - # Argument internal_36 + # Argument internal_5 lw $t0, 76($sp) - sw $t0, 0($sp) # Storing internal_36 + sw $t0, 0($sp) # Storing internal_5 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function function_add + jal function_add lw $ra, 8($sp) - sw $v1, 72($sp) # internal_37 = result of function_out_string_at_IO + sw $v1, 68($sp) # internal_7 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Get attribute avar of self - lw $t0, 212($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 56($sp) # internal_38 = avar - # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 104($sp) sw $t0, 4($sp) # Storing self - # Argument internal_38 + # Argument internal_7 lw $t0, 68($sp) - sw $t0, 0($sp) # Storing internal_38 + sw $t0, 0($sp) # Storing internal_7 - # Calling function function_print_at_Main - jal function_print_at_Main + # Calling function function_is_even_at_Main + jal function_is_even_at_Main lw $ra, 8($sp) - sw $v1, 64($sp) # internal_39 = result of function_print_at_Main + sw $v1, 64($sp) # internal_8 = result of function_is_even_at_Main addi $sp, $sp, 12 # Freeing space for arguments - # Allocating String - li $v0, 9 - addi $a0, $zero, 39 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 30 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 105 - sb $t0, 8($v0) # internal_40[0] = 'i' - - addi $t0, $zero, 115 - sb $t0, 9($v0) # internal_40[1] = 's' - - addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_40[2] = ' ' - - addi $t0, $zero, 97 - sb $t0, 11($v0) # internal_40[3] = 'a' - - addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_40[4] = ' ' - - addi $t0, $zero, 109 - sb $t0, 13($v0) # internal_40[5] = 'm' - - addi $t0, $zero, 117 - sb $t0, 14($v0) # internal_40[6] = 'u' - - addi $t0, $zero, 108 - sb $t0, 15($v0) # internal_40[7] = 'l' - - addi $t0, $zero, 116 - sb $t0, 16($v0) # internal_40[8] = 't' - - addi $t0, $zero, 105 - sb $t0, 17($v0) # internal_40[9] = 'i' - - addi $t0, $zero, 112 - sb $t0, 18($v0) # internal_40[10] = 'p' - - addi $t0, $zero, 108 - sb $t0, 19($v0) # internal_40[11] = 'l' - - addi $t0, $zero, 101 - sb $t0, 20($v0) # internal_40[12] = 'e' - - addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_40[13] = ' ' - - addi $t0, $zero, 111 - sb $t0, 22($v0) # internal_40[14] = 'o' + # internal_1 = internal_8 + lw $t0, 52($sp) + sw $t0, 80($sp) - addi $t0, $zero, 102 - sb $t0, 23($v0) # internal_40[15] = 'f' + # Jumping to endif_8781702295071 + j endif_8781702295071 - addi $t0, $zero, 32 - sb $t0, 24($v0) # internal_40[16] = ' ' + else_8781702295071: - addi $t0, $zero, 51 - sb $t0, 25($v0) # internal_40[17] = '3' + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 46 - sb $t0, 26($v0) # internal_40[18] = '.' + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_10 = address of allocated object Int - addi $t0, $zero, 46 - sb $t0, 27($v0) # internal_40[19] = '.' + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 46 - sb $t0, 28($v0) # internal_40[20] = '.' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_11 = address of allocated object Int - addi $t0, $zero, 101 - sb $t0, 29($v0) # internal_40[21] = 'e' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 110 - sb $t0, 30($v0) # internal_40[22] = 'n' + # Argument internal_11 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_11 - addi $t0, $zero, 116 - sb $t0, 31($v0) # internal_40[23] = 't' + # Argument x + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing x - addi $t0, $zero, 101 - sb $t0, 32($v0) # internal_40[24] = 'e' + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_12 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 114 - sb $t0, 33($v0) # internal_40[25] = 'r' + # internal_10 = internal_12 + lw $t0, 36($sp) + sw $t0, 44($sp) - addi $t0, $zero, 32 - sb $t0, 34($v0) # internal_40[26] = ' ' + # If internal_10 then goto then_8781702295074 + lw $t0, 44($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8781702295074 - addi $t0, $zero, 103 - sb $t0, 35($v0) # internal_40[27] = 'g' + # Jumping to else_8781702295074 + j else_8781702295074 - addi $t0, $zero, 58 - sb $t0, 36($v0) # internal_40[28] = ':' + then_8781702295074: - addi $t0, $zero, 10 - sb $t0, 37($v0) # internal_40[29] = '\n' + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - sb $zero, 38($v0) # Null-terminator at the end of the string + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_13 = address of allocated object Int - sw $v0, 48($sp) # internal_40 = "is a multiple of 3...enter g:\n" + # internal_9 = internal_13 + lw $t0, 32($sp) + sw $t0, 48($sp) - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + # Jumping to endif_8781702295074 + j endif_8781702295074 - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self + else_8781702295074: - # Argument internal_40 - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing internal_40 + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 56($sp) # internal_41 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_15 = address of allocated object Int - # Allocating String + # Allocating Int 1 li $v0, 9 - addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_16 = address of allocated object Int - addi $t0, $zero, 11 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_42[0] = '\t' + # Argument internal_16 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_16 - addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_42[1] = 'T' + # Argument x + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing x - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_42[2] = 'o' + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_17 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_42[3] = ' ' + # internal_15 = internal_17 + lw $t0, 16($sp) + sw $t0, 24($sp) - addi $t0, $zero, 100 - sb $t0, 12($v0) # internal_42[4] = 'd' + # If internal_15 then goto then_8781702295080 + lw $t0, 24($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8781702295080 - addi $t0, $zero, 105 - sb $t0, 13($v0) # internal_42[5] = 'i' + # Jumping to else_8781702295080 + j else_8781702295080 - addi $t0, $zero, 118 - sb $t0, 14($v0) # internal_42[6] = 'v' + then_8781702295080: - addi $t0, $zero, 105 - sb $t0, 15($v0) # internal_42[7] = 'i' + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 100 - sb $t0, 16($v0) # internal_42[8] = 'd' + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_18 = address of allocated object Int - addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_42[9] = 'e' + # internal_14 = internal_18 + lw $t0, 12($sp) + sw $t0, 28($sp) - addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_42[10] = ' ' + # Jumping to endif_8781702295080 + j endif_8781702295080 - sb $zero, 19($v0) # Null-terminator at the end of the string + else_8781702295080: - sw $v0, 40($sp) # internal_42 = "\tTo divide " + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_19 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self + # Argument x + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing x - # Argument internal_42 - lw $t0, 52($sp) - sw $t0, 0($sp) # Storing internal_42 + # Argument internal_19 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_19 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function function_sub + jal function_sub lw $ra, 8($sp) - sw $v1, 48($sp) # internal_43 = result of function_out_string_at_IO + sw $v1, 16($sp) # internal_20 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments - # Get attribute avar of self - lw $t0, 212($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 32($sp) # internal_44 = avar - # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 104($sp) sw $t0, 4($sp) # Storing self - # Argument internal_44 - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_44 + # Argument internal_20 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_20 - # Calling function function_print_at_Main - jal function_print_at_Main + # Calling function function_is_even_at_Main + jal function_is_even_at_Main lw $ra, 8($sp) - sw $v1, 40($sp) # internal_45 = result of function_print_at_Main + sw $v1, 12($sp) # internal_21 = result of function_is_even_at_Main addi $sp, $sp, 12 # Freeing space for arguments - # Allocating String - li $v0, 9 - addi $a0, $zero, 25 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall + # internal_14 = internal_21 + lw $t0, 0($sp) + sw $t0, 28($sp) - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object + # Jumping to endif_8781702295080 + j endif_8781702295080 - addi $t0, $zero, 16 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + endif_8781702295080: - addi $t0, $zero, 98 - sb $t0, 8($v0) # internal_46[0] = 'b' + # internal_9 = internal_14 + lw $t0, 28($sp) + sw $t0, 48($sp) + + # Jumping to endif_8781702295074 + j endif_8781702295074 + + endif_8781702295074: + + # internal_1 = internal_9 + lw $t0, 48($sp) + sw $t0, 80($sp) + + # Jumping to endif_8781702295071 + j endif_8781702295071 + + endif_8781702295071: + + # Loading return value in $v1 + lw $v1, 80($sp) + + # Freeing space for local variables + addi $sp, $sp, 88 + + jr $ra + + function_class_type_at_Main: + # Function parameters + # $ra = 300($sp) + # self = 296($sp) + # var = 292($sp) - addi $t0, $zero, 121 - sb $t0, 9($v0) # internal_46[1] = 'y' + # Reserving space for local variables + addi $sp, $sp, -292 - addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_46[2] = ' ' + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 56 - sb $t0, 11($v0) # internal_46[3] = '8' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 288($sp) # internal_0 = address of allocated object Int - addi $t0, $zero, 46 - sb $t0, 12($v0) # internal_46[4] = '.' + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 46 - sb $t0, 13($v0) # internal_46[5] = '.' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 284($sp) # internal_1 = address of allocated object Int - addi $t0, $zero, 46 - sb $t0, 14($v0) # internal_46[6] = '.' + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 101 - sb $t0, 15($v0) # internal_46[7] = 'e' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 280($sp) # internal_2 = address of allocated object Int - addi $t0, $zero, 110 - sb $t0, 16($v0) # internal_46[8] = 'n' + # Allocating NUll to internal_3 + sw $zero, 276($sp) # internal_3 = 0 - addi $t0, $zero, 116 - sb $t0, 17($v0) # internal_46[9] = 't' + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 101 - sb $t0, 18($v0) # internal_46[10] = 'e' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 272($sp) # internal_4 = address of allocated object Int - addi $t0, $zero, 114 - sb $t0, 19($v0) # internal_46[11] = 'r' + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_46[12] = ' ' + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 260($sp) # internal_7 = address of allocated object Int - addi $t0, $zero, 104 - sb $t0, 21($v0) # internal_46[13] = 'h' + # internal_5 = typeof var that is the first word of the object + lw $t0, 292($sp) + lw $t0, 0($t0) + sw $t0, 268($sp) - addi $t0, $zero, 58 - sb $t0, 22($v0) # internal_46[14] = ':' + # internal_6 = internal_5 + lw $t0, 268($sp) + sw $t0, 264($sp) - addi $t0, $zero, 10 - sb $t0, 23($v0) # internal_46[15] = '\n' + while_start_8781702295173: - sb $zero, 24($v0) # Null-terminator at the end of the string + # internal_7 = EqualAddress(internal_6, internal_3) + lw $t0, 264($sp) + lw $t1, 276($sp) + seq $t2, $t0, $t1 + lw $t0, 260($sp) + sw $t2, 8($t0) - sw $v0, 24($sp) # internal_46 = "by 8...enter h:\n" + # If internal_7 then goto while_end_8781702295173 + lw $t0, 260($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8781702295173 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self + # Argument internal_4 + lw $t0, 284($sp) + sw $t0, 4($sp) # Storing internal_4 - # Argument internal_46 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_46 + # Argument internal_1 + lw $t0, 296($sp) + sw $t0, 0($sp) # Storing internal_1 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function function_add + jal function_add lw $ra, 8($sp) - sw $v1, 32($sp) # internal_47 = result of function_out_string_at_IO + sw $v1, 284($sp) # internal_4 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Allocating String - li $v0, 9 - addi $a0, $zero, 41 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 32 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_48[0] = '\t' + # internal_6 = ancestor of internal_6 + lw $t0, 264($sp) + lw $t0, 4($t0) + sw $t0, 264($sp) - addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_48[1] = 'T' + # Jumping to while_start_8781702295173 + j while_start_8781702295173 - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_48[2] = 'o' + while_end_8781702295173: - addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_48[3] = ' ' + # internal_6 = internal_5 + lw $t0, 268($sp) + sw $t0, 264($sp) - addi $t0, $zero, 103 - sb $t0, 12($v0) # internal_48[4] = 'g' + # initialize Array [internal_4] + lw $t0, 272($sp) # $t0 = internal_4 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 256($sp) # internal_8 = new Array[internal_4] - addi $t0, $zero, 101 - sb $t0, 13($v0) # internal_48[5] = 'e' + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 116 - sb $t0, 14($v0) # internal_48[6] = 't' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 252($sp) # internal_9 = address of allocated object Int - addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_48[7] = ' ' + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 97 - sb $t0, 16($v0) # internal_48[8] = 'a' + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 248($sp) # internal_10 = address of allocated object Int - addi $t0, $zero, 32 - sb $t0, 17($v0) # internal_48[9] = ' ' + foreach_start_8781702295173: - addi $t0, $zero, 110 - sb $t0, 18($v0) # internal_48[10] = 'n' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 101 - sb $t0, 19($v0) # internal_48[11] = 'e' + # Argument internal_9 + lw $t0, 264($sp) + sw $t0, 4($sp) # Storing internal_9 - addi $t0, $zero, 119 - sb $t0, 20($v0) # internal_48[12] = 'w' + # Argument internal_4 + lw $t0, 284($sp) + sw $t0, 0($sp) # Storing internal_4 - addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_48[13] = ' ' + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 260($sp) # internal_10 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 110 - sb $t0, 22($v0) # internal_48[14] = 'n' + # If internal_10 then goto foreach_body_8781702295173 + lw $t0, 248($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8781702295173 - addi $t0, $zero, 117 - sb $t0, 23($v0) # internal_48[15] = 'u' + # Jumping to foreach_end_8781702295173 + j foreach_end_8781702295173 - addi $t0, $zero, 109 - sb $t0, 24($v0) # internal_48[16] = 'm' + foreach_body_8781702295173: - addi $t0, $zero, 98 - sb $t0, 25($v0) # internal_48[17] = 'b' + # array internal_8[4 * internal_9] = internal_6 + lw $t0, 252($sp) # $t0 = internal_9 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 256($sp) # $t1 = internal_8 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 264($sp) + sw $t0, 0($t1) - addi $t0, $zero, 101 - sb $t0, 26($v0) # internal_48[18] = 'e' + # internal_6 = ancestor of internal_6 + lw $t0, 264($sp) + lw $t0, 4($t0) + sw $t0, 264($sp) - addi $t0, $zero, 114 - sb $t0, 27($v0) # internal_48[19] = 'r' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 46 - sb $t0, 28($v0) # internal_48[20] = '.' + # Argument internal_9 + lw $t0, 264($sp) + sw $t0, 4($sp) # Storing internal_9 - addi $t0, $zero, 46 - sb $t0, 29($v0) # internal_48[21] = '.' + # Argument internal_1 + lw $t0, 296($sp) + sw $t0, 0($sp) # Storing internal_1 - addi $t0, $zero, 46 - sb $t0, 30($v0) # internal_48[22] = '.' + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 264($sp) # internal_9 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 101 - sb $t0, 31($v0) # internal_48[23] = 'e' + # Jumping to foreach_start_8781702295173 + j foreach_start_8781702295173 - addi $t0, $zero, 110 - sb $t0, 32($v0) # internal_48[24] = 'n' + foreach_end_8781702295173: - addi $t0, $zero, 116 - sb $t0, 33($v0) # internal_48[25] = 't' + # initialize Array [internal_2] + lw $t0, 280($sp) # $t0 = internal_2 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 244($sp) # internal_11 = new Array[internal_2] + + # initialize Array [internal_2] + lw $t0, 280($sp) # $t0 = internal_2 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 240($sp) # internal_12 = new Array[internal_2] - addi $t0, $zero, 101 - sb $t0, 34($v0) # internal_48[26] = 'e' + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 114 - sb $t0, 35($v0) # internal_48[27] = 'r' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 232($sp) # internal_14 = address of allocated object Int - addi $t0, $zero, 32 - sb $t0, 36($v0) # internal_48[28] = ' ' + # internal_13 = direction of A + la $t0, type_A + sw $t0, 236($sp) + + # array internal_11[4 * internal_14] = internal_13 + lw $t0, 232($sp) # $t0 = internal_14 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 244($sp) # $t1 = internal_11 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 236($sp) + sw $t0, 0($t1) + + # array internal_12[4 * internal_14] = internal_4 + lw $t0, 232($sp) # $t0 = internal_14 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 240($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 272($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - addi $t0, $zero, 106 - sb $t0, 37($v0) # internal_48[29] = 'j' + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 58 - sb $t0, 38($v0) # internal_48[30] = ':' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 224($sp) # internal_16 = address of allocated object Int - addi $t0, $zero, 10 - sb $t0, 39($v0) # internal_48[31] = '\n' + # internal_15 = direction of B + la $t0, type_B + sw $t0, 228($sp) + + # array internal_11[4 * internal_16] = internal_15 + lw $t0, 224($sp) # $t0 = internal_16 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 244($sp) # $t1 = internal_11 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 228($sp) + sw $t0, 0($t1) + + # array internal_12[4 * internal_16] = internal_4 + lw $t0, 224($sp) # $t0 = internal_16 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 240($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 272($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - sb $zero, 40($v0) # Null-terminator at the end of the string + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall - sw $v0, 16($sp) # internal_48 = "\tTo get a new number...enter j:\n" + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 216($sp) # internal_18 = address of allocated object Int - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + # internal_17 = direction of C + la $t0, type_C + sw $t0, 220($sp) + + # array internal_11[4 * internal_18] = internal_17 + lw $t0, 216($sp) # $t0 = internal_18 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 244($sp) # $t1 = internal_11 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 220($sp) + sw $t0, 0($t1) + + # array internal_12[4 * internal_18] = internal_4 + lw $t0, 216($sp) # $t0 = internal_18 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 240($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 272($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Argument internal_48 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_48 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 208($sp) # internal_20 = address of allocated object Int - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 24($sp) # internal_49 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments + # internal_19 = direction of D + la $t0, type_D + sw $t0, 212($sp) + + # array internal_11[4 * internal_20] = internal_19 + lw $t0, 208($sp) # $t0 = internal_20 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 244($sp) # $t1 = internal_11 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 212($sp) + sw $t0, 0($t1) + + # array internal_12[4 * internal_20] = internal_4 + lw $t0, 208($sp) # $t0 = internal_20 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 240($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 272($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # Allocating String + # Allocating Int 4 li $v0, 9 - addi $a0, $zero, 30 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 200($sp) # internal_22 = address of allocated object Int - addi $t0, $zero, 21 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + # internal_21 = direction of E + la $t0, type_E + sw $t0, 204($sp) - addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_50[0] = '\t' + # array internal_11[4 * internal_22] = internal_21 + lw $t0, 200($sp) # $t0 = internal_22 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 244($sp) # $t1 = internal_11 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 204($sp) + sw $t0, 0($t1) + + # array internal_12[4 * internal_22] = internal_4 + lw $t0, 200($sp) # $t0 = internal_22 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 240($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 272($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_50[1] = 'T' + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_50[2] = 'o' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 192($sp) # internal_24 = address of allocated object Int - addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_50[3] = ' ' + # internal_23 = direction of Object + la $t0, type_Object + sw $t0, 196($sp) + + # array internal_11[4 * internal_24] = internal_23 + lw $t0, 192($sp) # $t0 = internal_24 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 244($sp) # $t1 = internal_11 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 196($sp) + sw $t0, 0($t1) + + # array internal_12[4 * internal_24] = internal_4 + lw $t0, 192($sp) # $t0 = internal_24 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 240($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 272($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - addi $t0, $zero, 113 - sb $t0, 12($v0) # internal_50[4] = 'q' + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 117 - sb $t0, 13($v0) # internal_50[5] = 'u' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 188($sp) # internal_25 = address of allocated object Int - addi $t0, $zero, 105 - sb $t0, 14($v0) # internal_50[6] = 'i' + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 116 - sb $t0, 15($v0) # internal_50[7] = 't' + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 184($sp) # internal_26 = address of allocated object Int - addi $t0, $zero, 46 - sb $t0, 16($v0) # internal_50[8] = '.' + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 46 - sb $t0, 17($v0) # internal_50[9] = '.' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 176($sp) # internal_28 = address of allocated object Int - addi $t0, $zero, 46 - sb $t0, 18($v0) # internal_50[10] = '.' + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 101 - sb $t0, 19($v0) # internal_50[11] = 'e' + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 172($sp) # internal_29 = address of allocated object Int - addi $t0, $zero, 110 - sb $t0, 20($v0) # internal_50[12] = 'n' + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 116 - sb $t0, 21($v0) # internal_50[13] = 't' + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 164($sp) # internal_31 = address of allocated object Int - addi $t0, $zero, 101 - sb $t0, 22($v0) # internal_50[14] = 'e' + foreach_type_start_8781702295173: - addi $t0, $zero, 114 - sb $t0, 23($v0) # internal_50[15] = 'r' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 32 - sb $t0, 24($v0) # internal_50[16] = ' ' + # Argument internal_25 + lw $t0, 200($sp) + sw $t0, 4($sp) # Storing internal_25 - addi $t0, $zero, 113 - sb $t0, 25($v0) # internal_50[17] = 'q' + # Argument internal_2 + lw $t0, 292($sp) + sw $t0, 0($sp) # Storing internal_2 - addi $t0, $zero, 58 - sb $t0, 26($v0) # internal_50[18] = ':' + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 196($sp) # internal_26 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 10 - sb $t0, 27($v0) # internal_50[19] = '\n' + # If internal_26 then goto foreach_type_body_8781702295173 + lw $t0, 184($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8781702295173 - addi $t0, $zero, 10 - sb $t0, 28($v0) # internal_50[20] = '\n' + # Jumping to foreach_type_end_8781702295173 + j foreach_type_end_8781702295173 - sb $zero, 29($v0) # Null-terminator at the end of the string + foreach_type_body_8781702295173: - sw $v0, 8($sp) # internal_50 = "\tTo quit...enter q:\n\n" + # internal_27 = array internal_11[4 * internal_25] + lw $t0, 188($sp) # $t0 = internal_25 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 244($sp) # $t1 = internal_11 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 180($sp) # internal_27 = array internal_11[4 * internal_25] # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self + # Argument internal_28 + lw $t0, 188($sp) + sw $t0, 4($sp) # Storing internal_28 - # Argument internal_50 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_50 + # Argument internal_0 + lw $t0, 300($sp) + sw $t0, 0($sp) # Storing internal_0 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function function_assign + jal function_assign lw $ra, 8($sp) - sw $v1, 16($sp) # internal_51 = result of function_out_string_at_IO + sw $v1, 188($sp) # internal_28 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments + foreach_ancestor_start_8781702295173: + # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 220($sp) - sw $t0, 0($sp) # Storing self + # Argument internal_28 + lw $t0, 188($sp) + sw $t0, 4($sp) # Storing internal_28 - # Calling function function_in_string_at_IO - jal function_in_string_at_IO - lw $ra, 4($sp) - sw $v1, 8($sp) # internal_52 = result of function_in_string_at_IO - addi $sp, $sp, 8 # Freeing space for arguments + # Argument internal_4 + lw $t0, 284($sp) + sw $t0, 0($sp) # Storing internal_4 - # Loading return value in $v1 - lw $v1, 0($sp) + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 184($sp) # internal_29 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - # Freeing space for local variables - addi $sp, $sp, 212 + # If internal_29 then goto foreach_ancestor_body_8781702295173 + lw $t0, 172($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8781702295173 - jr $ra + # Jumping to foreach_ancestor_end_8781702295173 + j foreach_ancestor_end_8781702295173 - function_prompt_at_Main: - # Function parameters - # $ra = 24($sp) - # self = 20($sp) + foreach_ancestor_body_8781702295173: - # Reserving space for local variables - addi $sp, $sp, -20 + # internal_30 = array internal_8[4 * internal_28] + lw $t0, 176($sp) # $t0 = internal_28 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 256($sp) # $t1 = internal_8 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 168($sp) # internal_30 = array internal_8[4 * internal_28] - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall + # internal_31 = EqualAddress(internal_27, internal_30) + lw $t0, 180($sp) + lw $t1, 168($sp) + seq $t2, $t0, $t1 + lw $t0, 164($sp) + sw $t2, 8($t0) - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object + # If internal_31 then goto foreach_ancestor_end_8781702295173 + lw $t0, 164($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8781702295173 - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_0[0] = '\n' + # Argument internal_28 + lw $t0, 188($sp) + sw $t0, 4($sp) # Storing internal_28 - sb $zero, 9($v0) # Null-terminator at the end of the string + # Argument internal_1 + lw $t0, 296($sp) + sw $t0, 0($sp) # Storing internal_1 - sw $v0, 16($sp) # internal_0 = "\n" + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 188($sp) # internal_28 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_ancestor_start_8781702295173 + j foreach_ancestor_start_8781702295173 + + foreach_ancestor_end_8781702295173: + + # array internal_12[4 * internal_25] = internal_28 + lw $t0, 188($sp) # $t0 = internal_25 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 240($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 176($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing self + # Argument internal_25 + lw $t0, 200($sp) + sw $t0, 4($sp) # Storing internal_25 - # Argument internal_0 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_0 + # Argument internal_1 + lw $t0, 296($sp) + sw $t0, 0($sp) # Storing internal_1 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function function_add + jal function_add lw $ra, 8($sp) - sw $v1, 24($sp) # internal_1 = result of function_out_string_at_IO + sw $v1, 200($sp) # internal_25 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments + # Jumping to foreach_type_start_8781702295173 + j foreach_type_start_8781702295173 + + foreach_type_end_8781702295173: + # Allocating String li $v0, 9 - addi $a0, $zero, 35 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 26 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 80 - sb $t0, 8($v0) # internal_2[0] = 'P' + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_37[0] = '\n' - addi $t0, $zero, 108 - sb $t0, 9($v0) # internal_2[1] = 'l' + sb $zero, 9($v0) # Null-terminator at the end of the string - addi $t0, $zero, 101 - sb $t0, 10($v0) # internal_2[2] = 'e' + sw $v0, 140($sp) # internal_37 = "\n" - addi $t0, $zero, 97 - sb $t0, 11($v0) # internal_2[3] = 'a' + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_2[4] = 's' + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 101 - sb $t0, 13($v0) # internal_2[5] = 'e' + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_2[6] = ' ' - - addi $t0, $zero, 101 - sb $t0, 15($v0) # internal_2[7] = 'e' - - addi $t0, $zero, 110 - sb $t0, 16($v0) # internal_2[8] = 'n' - - addi $t0, $zero, 116 - sb $t0, 17($v0) # internal_2[9] = 't' - - addi $t0, $zero, 101 - sb $t0, 18($v0) # internal_2[10] = 'e' + sb $t0, 8($v0) # internal_38[0] = ' ' - addi $t0, $zero, 114 - sb $t0, 19($v0) # internal_2[11] = 'r' + sb $zero, 9($v0) # Null-terminator at the end of the string - addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_2[12] = ' ' + sw $v0, 136($sp) # internal_38 = " " - addi $t0, $zero, 97 - sb $t0, 21($v0) # internal_2[13] = 'a' + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 32 - sb $t0, 22($v0) # internal_2[14] = ' ' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_32 = address of allocated object Int - addi $t0, $zero, 110 - sb $t0, 23($v0) # internal_2[15] = 'n' + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 117 - sb $t0, 24($v0) # internal_2[16] = 'u' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 156($sp) # internal_33 = address of allocated object Int - addi $t0, $zero, 109 - sb $t0, 25($v0) # internal_2[17] = 'm' + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 98 - sb $t0, 26($v0) # internal_2[18] = 'b' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 152($sp) # internal_34 = address of allocated object Int - addi $t0, $zero, 101 - sb $t0, 27($v0) # internal_2[19] = 'e' + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 114 - sb $t0, 28($v0) # internal_2[20] = 'r' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 148($sp) # internal_35 = address of allocated object Int - addi $t0, $zero, 46 - sb $t0, 29($v0) # internal_2[21] = '.' + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 46 - sb $t0, 30($v0) # internal_2[22] = '.' + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_36 = address of allocated object Int - addi $t0, $zero, 46 - sb $t0, 31($v0) # internal_2[23] = '.' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 32 - sb $t0, 32($v0) # internal_2[24] = ' ' + # Argument internal_35 + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing internal_35 - addi $t0, $zero, 32 - sb $t0, 33($v0) # internal_2[25] = ' ' + # Argument internal_4 + lw $t0, 284($sp) + sw $t0, 0($sp) # Storing internal_4 - sb $zero, 34($v0) # Null-terminator at the end of the string + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 160($sp) # internal_35 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - sw $v0, 8($sp) # internal_2 = "Please enter a number... " + foreach_min_start_8781702295173: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing self + # Argument internal_32 + lw $t0, 172($sp) + sw $t0, 4($sp) # Storing internal_32 # Argument internal_2 - lw $t0, 20($sp) + lw $t0, 292($sp) sw $t0, 0($sp) # Storing internal_2 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function function_less_than + jal function_less_than lw $ra, 8($sp) - sw $v1, 16($sp) # internal_3 = result of function_out_string_at_IO + sw $v1, 156($sp) # internal_36 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument self - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_in_string_at_IO - jal function_in_string_at_IO - lw $ra, 4($sp) - sw $v1, 8($sp) # internal_4 = result of function_in_string_at_IO - addi $sp, $sp, 8 # Freeing space for arguments + # If internal_36 then goto foreach_min_body_8781702295173 + lw $t0, 144($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8781702295173 - # Loading return value in $v1 - lw $v1, 0($sp) + # Jumping to foreach_min_end_8781702295173 + j foreach_min_end_8781702295173 - # Freeing space for local variables - addi $sp, $sp, 20 + foreach_min_body_8781702295173: - jr $ra + # internal_34 = array internal_12[4 * internal_32] + lw $t0, 160($sp) # $t0 = internal_32 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 240($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 152($sp) # internal_34 = array internal_12[4 * internal_32] + sw $t0, 8($t2) - function_get_int_at_Main: - # Function parameters - # $ra = 24($sp) - # self = 20($sp) + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Reserving space for local variables - addi $sp, $sp, -20 + # Argument internal_34 + lw $t0, 164($sp) + sw $t0, 4($sp) # Storing internal_34 - # Allocating A2I - li $v0, 9 - lw $a0, type_A2I - syscall - la $t0, type_A2I # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 12($sp) # internal_1 = address of allocated object A2I + # Argument internal_35 + lw $t0, 160($sp) + sw $t0, 0($sp) # Storing internal_35 - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 156($sp) # internal_36 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - # Argument internal_1 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_1 + # If internal_36 then goto update_min_8781702295173 + lw $t0, 144($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8781702295173 - # Calling function function___init___at_A2I - jal function___init___at_A2I - lw $ra, 4($sp) - sw $v1, 20($sp) # internal_1 = result of function___init___at_A2I - addi $sp, $sp, 8 # Freeing space for arguments + # Jumping to update_min_end_8781702295173 + j update_min_end_8781702295173 - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 16($sp) - j end_assign - not_is_Bool_or_Int: - # z = internal_1 - lw $t0, 12($sp) - sw $t0, 16($sp) - end_assign: + update_min_8781702295173: # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing self + # Argument internal_35 + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing internal_35 - # Calling function function_prompt_at_Main - jal function_prompt_at_Main - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_3 = result of function_prompt_at_Main - addi $sp, $sp, 8 # Freeing space for arguments + # Argument internal_34 + lw $t0, 164($sp) + sw $t0, 0($sp) # Storing internal_34 - lw $t0, 4($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 8($sp) - j end_assign - not_is_Bool_or_Int: - # s = internal_3 - lw $t0, 4($sp) - sw $t0, 8($sp) - end_assign: + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 160($sp) # internal_35 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument z - lw $t0, 28($sp) - sw $t0, 4($sp) # Storing z + # Argument internal_33 + lw $t0, 168($sp) + sw $t0, 4($sp) # Storing internal_33 - # Argument s - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing s + # Argument internal_32 + lw $t0, 172($sp) + sw $t0, 0($sp) # Storing internal_32 - # Calling function function_a2i_at_A2I - jal function_a2i_at_A2I + # Calling function function_assign + jal function_assign lw $ra, 8($sp) - sw $v1, 12($sp) # internal_4 = result of function_a2i_at_A2I + sw $v1, 168($sp) # internal_33 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # Loading return value in $v1 - lw $v1, 0($sp) + update_min_end_8781702295173: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Freeing space for local variables - addi $sp, $sp, 20 + # Argument internal_32 + lw $t0, 172($sp) + sw $t0, 4($sp) # Storing internal_32 - jr $ra + # Argument internal_1 + lw $t0, 296($sp) + sw $t0, 0($sp) # Storing internal_1 - function_is_even_at_Main: - # Function parameters - # $ra = 96($sp) - # self = 92($sp) - # num = 88($sp) + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 172($sp) # internal_32 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - # Reserving space for local variables - addi $sp, $sp, -88 + # Jumping to foreach_min_start_8781702295173 + j foreach_min_start_8781702295173 - lw $t0, 88($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 84($sp) - j end_assign - not_is_Bool_or_Int: - # x = num - lw $t0, 88($sp) - sw $t0, 84($sp) - end_assign: + foreach_min_end_8781702295173: + # initialize Array [internal_2] + lw $t0, 280($sp) # $t0 = internal_2 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 132($sp) # internal_39 = new Array[internal_2] - # Allocating Bool 0 + # Allocating Int 0 li $v0, 9 addi $a0, $zero, 12 syscall - la $t0, type_Bool # $t0 = address of the type + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 76($sp) # internal_2 = address of allocated object Int + sw $v0, 128($sp) # internal_40 = address of allocated object Int + + # array internal_39[4 * internal_40] = internal_0 + lw $t0, 128($sp) # $t0 = internal_40 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 132($sp) # $t1 = internal_39 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 288($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # Allocating Int 0 + # Allocating Int 1 li $v0, 9 addi $a0, $zero, 12 syscall @@ -9547,116 +11038,165 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 72($sp) # internal_3 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument x - lw $t0, 96($sp) - sw $t0, 4($sp) # Storing x + sw $v0, 124($sp) # internal_41 = address of allocated object Int + + # array internal_39[4 * internal_41] = internal_0 + lw $t0, 124($sp) # $t0 = internal_41 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 132($sp) # $t1 = internal_39 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 288($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # Argument internal_3 - lw $t0, 84($sp) - sw $t0, 0($sp) # Storing internal_3 + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Calling function function_less_than - jal function_less_than - lw $ra, 8($sp) - sw $v1, 80($sp) # internal_4 = result of function_less_than - addi $sp, $sp, 12 # Freeing space for arguments + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_42 = address of allocated object Int + + # array internal_39[4 * internal_42] = internal_0 + lw $t0, 120($sp) # $t0 = internal_42 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 132($sp) # $t1 = internal_39 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 288($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - lw $t0, 68($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 76($sp) - j end_assign - not_is_Bool_or_Int: - # internal_2 = internal_4 - lw $t0, 68($sp) - sw $t0, 76($sp) - end_assign: + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # If internal_2 then goto then_8792981820167 - lw $t0, 76($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981820167 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 116($sp) # internal_43 = address of allocated object Int + + # array internal_39[4 * internal_43] = internal_0 + lw $t0, 116($sp) # $t0 = internal_43 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 132($sp) # $t1 = internal_39 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 288($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # Jumping to else_8792981820167 - j else_8792981820167 + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall - then_8792981820167: + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_44 = address of allocated object Int + + # array internal_39[4 * internal_44] = internal_0 + lw $t0, 112($sp) # $t0 = internal_44 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 132($sp) # $t1 = internal_39 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 288($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # Xor operation - lw $t0, 84($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 60($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall - lw $t0, 56($sp) # $t0 = internal_7 - sw $t2, 8($t0) # Setting value in the third word of the Int object + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_45 = address of allocated object Int + + # array internal_39[4 * internal_45] = internal_0 + lw $t0, 108($sp) # $t0 = internal_45 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 132($sp) # $t1 = internal_39 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 288($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # Addition operation - lw $t0, 56($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 64($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - add $t2, $t0, $t1 # $t2 = $t0 + $t1 + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - lw $t0, 56($sp) # $t0 = internal_7 - sw $t2, 8($t0) # Setting value in the third word of the Int object + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_46 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 104($sp) - sw $t0, 4($sp) # Storing self + # Argument internal_35 + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing internal_35 - # Argument internal_7 - lw $t0, 68($sp) - sw $t0, 0($sp) # Storing internal_7 + # Argument internal_4 + lw $t0, 284($sp) + sw $t0, 0($sp) # Storing internal_4 - # Calling function function_is_even_at_Main - jal function_is_even_at_Main + # Calling function function_equal + jal function_equal lw $ra, 8($sp) - sw $v1, 64($sp) # internal_8 = result of function_is_even_at_Main + sw $v1, 116($sp) # internal_46 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 52($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 80($sp) - j end_assign - not_is_Bool_or_Int: - # internal_1 = internal_8 - lw $t0, 52($sp) - sw $t0, 80($sp) - end_assign: - - # Jumping to endif_8792981820167 - j endif_8792981820167 - - else_8792981820167: - + # If internal_46 then goto error_branch_8781702295173 + lw $t0, 104($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8781702295173 + + # array internal_39[4 * internal_33] = internal_1 + lw $t0, 156($sp) # $t0 = internal_33 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 132($sp) # $t1 = internal_39 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 284($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) # Allocating Bool 0 li $v0, 9 @@ -9668,7 +11208,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_10 = address of allocated object Int + sw $v0, 100($sp) # internal_47 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -9680,1533 +11220,1728 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_11 = address of allocated object Int + sw $v0, 96($sp) # internal_48 = address of allocated object Int + + # internal_47 = array internal_39[4 * internal_48] + lw $t0, 96($sp) # $t0 = internal_48 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 132($sp) # $t1 = internal_39 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 100($sp) # internal_47 = array internal_39[4 * internal_48] + sw $t0, 8($t2) + + # If internal_47 then goto branch_A_8781702295173 + lw $t0, 100($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_A_8781702295173 - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Argument internal_11 - lw $t0, 52($sp) - sw $t0, 4($sp) # Storing internal_11 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 92($sp) # internal_49 = address of allocated object Int + + # internal_47 = array internal_39[4 * internal_49] + lw $t0, 92($sp) # $t0 = internal_49 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 132($sp) # $t1 = internal_39 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 100($sp) # internal_47 = array internal_39[4 * internal_49] + sw $t0, 8($t2) + + # If internal_47 then goto branch_B_8781702295173 + lw $t0, 100($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_B_8781702295173 - # Argument x - lw $t0, 96($sp) - sw $t0, 0($sp) # Storing x + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 48($sp) # internal_12 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_50 = address of allocated object Int + + # internal_47 = array internal_39[4 * internal_50] + lw $t0, 88($sp) # $t0 = internal_50 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 132($sp) # $t1 = internal_39 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 100($sp) # internal_47 = array internal_39[4 * internal_50] + sw $t0, 8($t2) + + # If internal_47 then goto branch_C_8781702295173 + lw $t0, 100($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_C_8781702295173 - lw $t0, 36($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: - # internal_10 = internal_12 - lw $t0, 36($sp) - sw $t0, 44($sp) - end_assign: + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # If internal_10 then goto then_8792981820170 - lw $t0, 44($sp) # Loading the address of the condition + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_51 = address of allocated object Int + + # internal_47 = array internal_39[4 * internal_51] + lw $t0, 84($sp) # $t0 = internal_51 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 132($sp) # $t1 = internal_39 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 100($sp) # internal_47 = array internal_39[4 * internal_51] + sw $t0, 8($t2) + + # If internal_47 then goto branch_D_8781702295173 + lw $t0, 100($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981820170 + beq $t0, $t1, branch_D_8781702295173 - # Jumping to else_8792981820170 - j else_8792981820170 + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall - then_8792981820170: + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_52 = address of allocated object Int + + # internal_47 = array internal_39[4 * internal_52] + lw $t0, 80($sp) # $t0 = internal_52 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 132($sp) # $t1 = internal_39 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 100($sp) # internal_47 = array internal_39[4 * internal_52] + sw $t0, 8($t2) + + # If internal_47 then goto branch_E_8781702295173 + lw $t0, 100($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_E_8781702295173 - # Allocating Bool 1 + # Allocating Int 5 li $v0, 9 addi $a0, $zero, 12 syscall - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_13 = address of allocated object Int + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_53 = address of allocated object Int + + # internal_47 = array internal_39[4 * internal_53] + lw $t0, 76($sp) # $t0 = internal_53 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 132($sp) # $t1 = internal_39 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 100($sp) # internal_47 = array internal_39[4 * internal_53] + sw $t0, 8($t2) + + # If internal_47 then goto branch_Object_8781702295173 + lw $t0, 100($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Object_8781702295173 + + branch_A_8781702295173: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument a + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing a + + # Argument var + lw $t0, 304($sp) + sw $t0, 0($sp) # Storing var + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 80($sp) # a = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 29 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_56[0] = 'C' + + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_56[1] = 'l' + + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_56[2] = 'a' - lw $t0, 32($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 48($sp) - j end_assign - not_is_Bool_or_Int: - # internal_9 = internal_13 - lw $t0, 32($sp) - sw $t0, 48($sp) - end_assign: + addi $t0, $zero, 115 + sb $t0, 11($v0) # internal_56[3] = 's' - # Jumping to endif_8792981820170 - j endif_8792981820170 + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_56[4] = 's' - else_8792981820170: + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_56[5] = ' ' + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_56[6] = 't' - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + addi $t0, $zero, 121 + sb $t0, 15($v0) # internal_56[7] = 'y' - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_15 = address of allocated object Int + addi $t0, $zero, 112 + sb $t0, 16($v0) # internal_56[8] = 'p' - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_56[9] = 'e' - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_16 = address of allocated object Int + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_56[10] = ' ' - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_56[11] = 'i' - # Argument internal_16 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_16 + addi $t0, $zero, 115 + sb $t0, 20($v0) # internal_56[12] = 's' - # Argument x - lw $t0, 96($sp) - sw $t0, 0($sp) # Storing x + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_56[13] = ' ' - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 28($sp) # internal_17 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_56[14] = 'n' - lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: - # internal_15 = internal_17 - lw $t0, 16($sp) - sw $t0, 24($sp) - end_assign: + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_56[15] = 'o' - # If internal_15 then goto then_8792981820176 - lw $t0, 24($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981820176 + addi $t0, $zero, 119 + sb $t0, 24($v0) # internal_56[16] = 'w' - # Jumping to else_8792981820176 - j else_8792981820176 + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_56[17] = ' ' - then_8792981820176: + addi $t0, $zero, 65 + sb $t0, 26($v0) # internal_56[18] = 'A' - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_56[19] = '\n' - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_18 = address of allocated object Int + sb $zero, 28($v0) # Null-terminator at the end of the string - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 28($sp) - j end_assign - not_is_Bool_or_Int: - # internal_14 = internal_18 - lw $t0, 12($sp) - sw $t0, 28($sp) - end_assign: + sw $v0, 64($sp) # internal_56 = "Class type is now A\n" - # Jumping to endif_8792981820176 - j endif_8792981820176 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - else_8792981820176: + # Argument self + lw $t0, 308($sp) + sw $t0, 4($sp) # Storing self - # Allocating Int 2 - li $v0, 9 - addi $a0, $zero, 12 - syscall + # Argument internal_56 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_56 - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 2 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_19 = address of allocated object Int + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 72($sp) # internal_57 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument x - lw $t0, 96($sp) - sw $t0, 4($sp) # Storing x + # Argument internal_54 + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing internal_54 - # Argument internal_19 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_19 + # Argument internal_57 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_57 - # Calling function function_sub - jal function_sub + # Calling function function_assign + jal function_assign lw $ra, 8($sp) - sw $v1, 16($sp) # internal_20 = result of function_sub + sw $v1, 84($sp) # internal_54 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments + # internal_54 = internal_57 + lw $t0, 60($sp) + sw $t0, 72($sp) + + # Jumping to branch_end_8781702295173 + j branch_end_8781702295173 + + branch_B_8781702295173: + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 104($sp) - sw $t0, 4($sp) # Storing self + # Argument b + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing b - # Argument internal_20 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_20 + # Argument var + lw $t0, 304($sp) + sw $t0, 0($sp) # Storing var - # Calling function function_is_even_at_Main - jal function_is_even_at_Main + # Calling function function_assign + jal function_assign lw $ra, 8($sp) - sw $v1, 12($sp) # internal_21 = result of function_is_even_at_Main + sw $v1, 68($sp) # b = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 28($sp) - j end_assign - not_is_Bool_or_Int: - # internal_14 = internal_21 - lw $t0, 0($sp) - sw $t0, 28($sp) - end_assign: + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - # Jumping to endif_8792981820176 - j endif_8792981820176 + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - endif_8792981820176: + addi $t0, $zero, 29 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 48($sp) - j end_assign - not_is_Bool_or_Int: - # internal_9 = internal_14 - lw $t0, 28($sp) - sw $t0, 48($sp) - end_assign: + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_59[0] = 'C' - # Jumping to endif_8792981820170 - j endif_8792981820170 + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_59[1] = 'l' - endif_8792981820170: + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_59[2] = 'a' - lw $t0, 48($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 80($sp) - j end_assign - not_is_Bool_or_Int: - # internal_1 = internal_9 - lw $t0, 48($sp) - sw $t0, 80($sp) - end_assign: + addi $t0, $zero, 115 + sb $t0, 11($v0) # internal_59[3] = 's' - # Jumping to endif_8792981820167 - j endif_8792981820167 + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_59[4] = 's' - endif_8792981820167: + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_59[5] = ' ' - # Loading return value in $v1 - lw $v1, 80($sp) + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_59[6] = 't' - # Freeing space for local variables - addi $sp, $sp, 88 + addi $t0, $zero, 121 + sb $t0, 15($v0) # internal_59[7] = 'y' - jr $ra + addi $t0, $zero, 112 + sb $t0, 16($v0) # internal_59[8] = 'p' - function_class_type_at_Main: - # Function parameters - # $ra = 212($sp) - # self = 208($sp) - # var = 204($sp) + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_59[9] = 'e' - # Reserving space for local variables - addi $sp, $sp, -204 + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_59[10] = ' ' + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_59[11] = 'i' + addi $t0, $zero, 115 + sb $t0, 20($v0) # internal_59[12] = 's' + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_59[13] = ' ' + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_59[14] = 'n' + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_59[15] = 'o' + addi $t0, $zero, 119 + sb $t0, 24($v0) # internal_59[16] = 'w' - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_59[17] = ' ' - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 180($sp) # internal_5 = address of allocated object Int + addi $t0, $zero, 66 + sb $t0, 26($v0) # internal_59[18] = 'B' - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_59[19] = '\n' - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 188($sp) # internal_3 = address of allocated object Int + sb $zero, 28($v0) # Null-terminator at the end of the string + sw $v0, 52($sp) # internal_59 = "Class type is now B\n" + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument self + lw $t0, 308($sp) + sw $t0, 4($sp) # Storing self - # internal_1 = typeof var that is the first word of the object - lw $t0, 204($sp) - lw $t1, 0($t0) - sw $t1, 196($sp) + # Argument internal_59 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_59 - lw $t0, 196($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 192($sp) - j end_assign - not_is_Bool_or_Int: - # internal_2 = internal_1 - lw $t0, 196($sp) - sw $t0, 192($sp) - end_assign: + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 60($sp) # internal_60 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 180($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 200($sp) - j end_assign - not_is_Bool_or_Int: - # internal_0 = internal_5 - lw $t0, 180($sp) - sw $t0, 200($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - while_start_8792981820269: + # Argument internal_54 + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing internal_54 - # Equal operation - lw $t0, 192($sp) # Save in $t0 the left operand address - # If internal_3 then goto while_end_8792981820269 - lw $t0, 188($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_end_8792981820269 + # Argument internal_60 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_60 - # Addition operation - lw $t0, 200($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # internal_2 = ancestor of internal_2 that is the first word of the object - lw $t0, 192($sp) - lw $t1, 4($t0) - sw $t1, 192($sp) + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_54 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_54 = internal_60 + lw $t0, 48($sp) + sw $t0, 72($sp) + + # Jumping to branch_end_8781702295173 + j branch_end_8781702295173 + + branch_C_8781702295173: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument c + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing c + + # Argument var + lw $t0, 304($sp) + sw $t0, 0($sp) # Storing var + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 56($sp) # c = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - # Jumping to while_start_8792981820269 - j while_start_8792981820269 + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - while_end_8792981820269: + addi $t0, $zero, 29 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_62[0] = 'C' + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_62[1] = 'l' + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_62[2] = 'a' - lw $t0, 196($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 192($sp) - j end_assign - not_is_Bool_or_Int: - # internal_2 = internal_1 - lw $t0, 196($sp) - sw $t0, 192($sp) - end_assign: + addi $t0, $zero, 115 + sb $t0, 11($v0) # internal_62[3] = 's' + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_62[4] = 's' - foreach_start_8792981820269: + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_62[5] = ' ' - # Less than operation - lw $t0, 172($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 200($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_62[6] = 't' - lw $t0, 168($sp) # $t0 = internal_8 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + addi $t0, $zero, 121 + sb $t0, 15($v0) # internal_62[7] = 'y' - # If internal_8 then goto foreach_body_8792981820269 - lw $t0, 168($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_body_8792981820269 + addi $t0, $zero, 112 + sb $t0, 16($v0) # internal_62[8] = 'p' - # Jumping to foreach_end_8792981820269 - j foreach_end_8792981820269 + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_62[9] = 'e' - foreach_body_8792981820269: + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_62[10] = ' ' + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_62[11] = 'i' - # internal_2 = ancestor of internal_2 that is the first word of the object - lw $t0, 192($sp) - lw $t1, 4($t0) - sw $t1, 192($sp) + addi $t0, $zero, 115 + sb $t0, 20($v0) # internal_62[12] = 's' - # Addition operation - lw $t0, 172($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_start_8792981820269 - j foreach_start_8792981820269 + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_62[13] = ' ' - foreach_end_8792981820269: + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_62[14] = 'n' + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_62[15] = 'o' + addi $t0, $zero, 119 + sb $t0, 24($v0) # internal_62[16] = 'w' + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_62[17] = ' ' + addi $t0, $zero, 67 + sb $t0, 26($v0) # internal_62[18] = 'C' + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_62[19] = '\n' - # internal_11 = direction of A - la $t0, type_A - sw $t0, 156($sp) + sb $zero, 28($v0) # Null-terminator at the end of the string + sw $v0, 40($sp) # internal_62 = "Class type is now C\n" + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # internal_12 = direction of B - la $t0, type_B - sw $t0, 152($sp) + # Argument self + lw $t0, 308($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_62 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_62 + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_63 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # internal_13 = direction of C - la $t0, type_C - sw $t0, 148($sp) + # Argument internal_54 + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing internal_54 + # Argument internal_63 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_63 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_54 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # internal_14 = direction of D - la $t0, type_D - sw $t0, 144($sp) + # internal_54 = internal_63 + lw $t0, 36($sp) + sw $t0, 72($sp) + # Jumping to branch_end_8781702295173 + j branch_end_8781702295173 + branch_D_8781702295173: - # internal_15 = direction of E - la $t0, type_E - sw $t0, 140($sp) + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument d + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing d + # Argument var + lw $t0, 304($sp) + sw $t0, 0($sp) # Storing var - # internal_16 = direction of Object - la $t0, type_Object - sw $t0, 136($sp) + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 44($sp) # d = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + addi $t0, $zero, 29 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_65[0] = 'C' + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_65[1] = 'l' - foreach_type_start_8792981820269: + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_65[2] = 'a' - # Less than operation - lw $t0, 132($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # If internal_18 then goto foreach_type_body_8792981820269 - lw $t0, 128($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_type_body_8792981820269 + addi $t0, $zero, 115 + sb $t0, 11($v0) # internal_65[3] = 's' - # Jumping to foreach_type_end_8792981820269 - j foreach_type_end_8792981820269 + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_65[4] = 's' - foreach_type_body_8792981820269: + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_65[5] = ' ' + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_65[6] = 't' + addi $t0, $zero, 121 + sb $t0, 15($v0) # internal_65[7] = 'y' + addi $t0, $zero, 112 + sb $t0, 16($v0) # internal_65[8] = 'p' + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_65[9] = 'e' - foreach_ancestor_start_8792981820269: + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_65[10] = ' ' - # Less than operation - lw $t0, 120($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 200($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_65[11] = 'i' - lw $t0, 116($sp) # $t0 = internal_21 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + addi $t0, $zero, 115 + sb $t0, 20($v0) # internal_65[12] = 's' - # If internal_21 then goto foreach_ancestor_body_8792981820269 - lw $t0, 116($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_body_8792981820269 + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_65[13] = ' ' - # Jumping to foreach_ancestor_end_8792981820269 - j foreach_ancestor_end_8792981820269 + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_65[14] = 'n' - foreach_ancestor_body_8792981820269: + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_65[15] = 'o' + addi $t0, $zero, 119 + sb $t0, 24($v0) # internal_65[16] = 'w' - # Equal operation - lw $t0, 124($sp) # Save in $t0 the left operand address - lw $t1, 112($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_65[17] = ' ' - lw $t0, 108($sp) # $t0 = internal_23 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + addi $t0, $zero, 68 + sb $t0, 26($v0) # internal_65[18] = 'D' - # If internal_23 then goto foreach_ancestor_end_8792981820269 - lw $t0, 108($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_end_8792981820269 + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_65[19] = '\n' - # Addition operation - lw $t0, 120($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_ancestor_start_8792981820269 - j foreach_ancestor_start_8792981820269 + sb $zero, 28($v0) # Null-terminator at the end of the string - foreach_ancestor_end_8792981820269: + sw $v0, 28($sp) # internal_65 = "Class type is now D\n" + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument self + lw $t0, 308($sp) + sw $t0, 4($sp) # Storing self + # Argument internal_65 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_65 + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_66 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments - # Addition operation - lw $t0, 132($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_type_start_8792981820269 - j foreach_type_start_8792981820269 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - foreach_type_end_8792981820269: + # Argument internal_54 + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing internal_54 + # Argument internal_66 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_66 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_54 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + # internal_54 = internal_66 + lw $t0, 24($sp) + sw $t0, 72($sp) + # Jumping to branch_end_8781702295173 + j branch_end_8781702295173 + branch_E_8781702295173: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - lw $t0, 200($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 92($sp) - j end_assign - not_is_Bool_or_Int: - # internal_27 = internal_0 - lw $t0, 200($sp) - sw $t0, 92($sp) - end_assign: + # Argument e + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing e - foreach_min_start_8792981820269: + # Argument var + lw $t0, 304($sp) + sw $t0, 0($sp) # Storing var - # Less than operation - lw $t0, 104($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # If internal_28 then goto foreach_min_body_8792981820269 - lw $t0, 88($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_min_body_8792981820269 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 32($sp) # e = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_min_end_8792981820269 - j foreach_min_end_8792981820269 + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - foreach_min_body_8792981820269: + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + addi $t0, $zero, 29 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - # Less than operation - lw $t0, 96($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 92($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_68[0] = 'C' - lw $t0, 88($sp) # $t0 = internal_28 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_68[1] = 'l' - # If internal_28 then goto update_min_8792981820269 - lw $t0, 88($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, update_min_8792981820269 + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_68[2] = 'a' - # Jumping to foreach_min_end_8792981820269 - j foreach_min_end_8792981820269 + addi $t0, $zero, 115 + sb $t0, 11($v0) # internal_68[3] = 's' - update_min_8792981820269: + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_68[4] = 's' - lw $t0, 96($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 92($sp) - j end_assign - not_is_Bool_or_Int: - # internal_27 = internal_26 - lw $t0, 96($sp) - sw $t0, 92($sp) - end_assign: + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_68[5] = ' ' - lw $t0, 104($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 100($sp) - j end_assign - not_is_Bool_or_Int: - # internal_25 = internal_24 - lw $t0, 104($sp) - sw $t0, 100($sp) - end_assign: + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_68[6] = 't' - update_min_end_8792981820269: + addi $t0, $zero, 121 + sb $t0, 15($v0) # internal_68[7] = 'y' - # Addition operation - lw $t0, 104($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_min_start_8792981820269 - j foreach_min_start_8792981820269 + addi $t0, $zero, 112 + sb $t0, 16($v0) # internal_68[8] = 'p' - foreach_min_end_8792981820269: + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_68[9] = 'e' + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_68[10] = ' ' + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_68[11] = 'i' + addi $t0, $zero, 115 + sb $t0, 20($v0) # internal_68[12] = 's' + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_68[13] = ' ' + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_68[14] = 'n' + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_68[15] = 'o' + addi $t0, $zero, 119 + sb $t0, 24($v0) # internal_68[16] = 'w' + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_68[17] = ' ' + addi $t0, $zero, 69 + sb $t0, 26($v0) # internal_68[18] = 'E' + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_68[19] = '\n' - # Equal operation - lw $t0, 100($sp) # Save in $t0 the left operand address - lw $t1, 200($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + sb $zero, 28($v0) # Null-terminator at the end of the string - lw $t0, 80($sp) # $t0 = internal_30 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + sw $v0, 16($sp) # internal_68 = "Class type is now E\n" - # If internal_30 then goto error_branch_8792981820269 - lw $t0, 80($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, error_branch_8792981820269 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument self + lw $t0, 308($sp) + sw $t0, 4($sp) # Storing self + # Argument internal_68 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_68 - # If internal_31 then goto branch_A_8792981820269 - lw $t0, 76($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_A_8792981820269 + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_69 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # If internal_31 then goto branch_B_8792981820269 - lw $t0, 76($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_B_8792981820269 + # Argument internal_54 + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing internal_54 + # Argument internal_69 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_69 - # If internal_31 then goto branch_C_8792981820269 - lw $t0, 76($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_C_8792981820269 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_54 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + # internal_54 = internal_69 + lw $t0, 12($sp) + sw $t0, 72($sp) - # If internal_31 then goto branch_D_8792981820269 - lw $t0, 76($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_D_8792981820269 + # Jumping to branch_end_8781702295173 + j branch_end_8781702295173 + branch_Object_8781702295173: - # If internal_31 then goto branch_E_8792981820269 - lw $t0, 76($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_E_8792981820269 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument o + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing o - # If internal_31 then goto branch_Object_8792981820269 - lw $t0, 76($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Object_8792981820269 + # Argument var + lw $t0, 304($sp) + sw $t0, 0($sp) # Storing var - branch_A_8792981820269: + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 20($sp) # o = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating String li $v0, 9 - addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 20 + addi $t0, $zero, 16 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 67 - sb $t0, 8($v0) # internal_34[0] = 'C' - - addi $t0, $zero, 108 - sb $t0, 9($v0) # internal_34[1] = 'l' - - addi $t0, $zero, 97 - sb $t0, 10($v0) # internal_34[2] = 'a' - - addi $t0, $zero, 115 - sb $t0, 11($v0) # internal_34[3] = 's' - - addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_34[4] = 's' + addi $t0, $zero, 79 + sb $t0, 8($v0) # internal_71[0] = 'O' - addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_34[5] = ' ' + addi $t0, $zero, 111 + sb $t0, 9($v0) # internal_71[1] = 'o' - addi $t0, $zero, 116 - sb $t0, 14($v0) # internal_34[6] = 't' + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_71[2] = 'o' - addi $t0, $zero, 121 - sb $t0, 15($v0) # internal_34[7] = 'y' + addi $t0, $zero, 111 + sb $t0, 11($v0) # internal_71[3] = 'o' addi $t0, $zero, 112 - sb $t0, 16($v0) # internal_34[8] = 'p' - - addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_34[9] = 'e' - - addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_34[10] = ' ' - - addi $t0, $zero, 105 - sb $t0, 19($v0) # internal_34[11] = 'i' + sb $t0, 12($v0) # internal_71[4] = 'p' addi $t0, $zero, 115 - sb $t0, 20($v0) # internal_34[12] = 's' - - addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_34[13] = ' ' - - addi $t0, $zero, 110 - sb $t0, 22($v0) # internal_34[14] = 'n' - - addi $t0, $zero, 111 - sb $t0, 23($v0) # internal_34[15] = 'o' - - addi $t0, $zero, 119 - sb $t0, 24($v0) # internal_34[16] = 'w' - - addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_34[17] = ' ' - - addi $t0, $zero, 65 - sb $t0, 26($v0) # internal_34[18] = 'A' + sb $t0, 13($v0) # internal_71[5] = 's' addi $t0, $zero, 10 - sb $t0, 27($v0) # internal_34[19] = '\n' + sb $t0, 14($v0) # internal_71[6] = '\n' - sb $zero, 28($v0) # Null-terminator at the end of the string + sb $zero, 15($v0) # Null-terminator at the end of the string - sw $v0, 64($sp) # internal_34 = "Class type is now A\n" + sw $v0, 4($sp) # internal_71 = "Oooops\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 220($sp) + lw $t0, 308($sp) sw $t0, 4($sp) # Storing self - # Argument internal_34 - lw $t0, 76($sp) - sw $t0, 0($sp) # Storing internal_34 + # Argument internal_71 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_71 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 72($sp) # internal_35 = result of function_out_string_at_IO + sw $v1, 12($sp) # internal_72 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 60($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 72($sp) - j end_assign - not_is_Bool_or_Int: - # internal_32 = internal_35 - lw $t0, 60($sp) - sw $t0, 72($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Jumping to branch_end_8792981820269 - j branch_end_8792981820269 + # Argument internal_54 + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing internal_54 - branch_B_8792981820269: + # Argument internal_72 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_72 - # Allocating String - li $v0, 9 - addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_54 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object + # internal_54 = internal_72 + lw $t0, 0($sp) + sw $t0, 72($sp) - addi $t0, $zero, 20 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + # Jumping to branch_end_8781702295173 + j branch_end_8781702295173 - addi $t0, $zero, 67 - sb $t0, 8($v0) # internal_37[0] = 'C' + error_branch_8781702295173: - addi $t0, $zero, 108 - sb $t0, 9($v0) # internal_37[1] = 'l' + branch_end_8781702295173: - addi $t0, $zero, 97 - sb $t0, 10($v0) # internal_37[2] = 'a' + # Loading return value in $v1 + lw $v1, 72($sp) - addi $t0, $zero, 115 - sb $t0, 11($v0) # internal_37[3] = 's' + # Freeing space for local variables + addi $sp, $sp, 292 - addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_37[4] = 's' + jr $ra - addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_37[5] = ' ' + function_print_at_Main: + # Function parameters + # $ra = 36($sp) + # self = 32($sp) + # var = 28($sp) - addi $t0, $zero, 116 - sb $t0, 14($v0) # internal_37[6] = 't' + # Reserving space for local variables + addi $sp, $sp, -28 - addi $t0, $zero, 121 - sb $t0, 15($v0) # internal_37[7] = 'y' + # Allocating A2I + li $v0, 9 + lw $a0, type_A2I + syscall + la $t0, type_A2I # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 20($sp) # internal_1 = address of allocated object A2I - addi $t0, $zero, 112 - sb $t0, 16($v0) # internal_37[8] = 'p' + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_37[9] = 'e' + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 - addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_37[10] = ' ' + # Calling function function___init___at_A2I + jal function___init___at_A2I + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_1 = result of function___init___at_A2I + addi $sp, $sp, 8 # Freeing space for arguments - addi $t0, $zero, 105 - sb $t0, 19($v0) # internal_37[11] = 'i' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 115 - sb $t0, 20($v0) # internal_37[12] = 's' + # Argument z + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing z - addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_37[13] = ' ' + # Argument internal_1 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_1 - addi $t0, $zero, 110 - sb $t0, 22($v0) # internal_37[14] = 'n' + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 36($sp) # z = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 111 - sb $t0, 23($v0) # internal_37[15] = 'o' + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - addi $t0, $zero, 119 - sb $t0, 24($v0) # internal_37[16] = 'w' + # Argument var + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing var - addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_37[17] = ' ' + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_2 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments - addi $t0, $zero, 66 - sb $t0, 26($v0) # internal_37[18] = 'B' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 10 - sb $t0, 27($v0) # internal_37[19] = '\n' + # Argument z + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing z - sb $zero, 28($v0) # Null-terminator at the end of the string + # Argument internal_2 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_2 - sw $v0, 52($sp) # internal_37 = "Class type is now B\n" + # Calling function function_i2a_at_A2I + jal function_i2a_at_A2I + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_3 = result of function_i2a_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 220($sp) + lw $t0, 44($sp) sw $t0, 4($sp) # Storing self - # Argument internal_37 - lw $t0, 64($sp) - sw $t0, 0($sp) # Storing internal_37 + # Argument internal_3 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_3 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 60($sp) # internal_38 = result of function_out_string_at_IO + sw $v1, 20($sp) # internal_4 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 48($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 72($sp) - j end_assign - not_is_Bool_or_Int: - # internal_32 = internal_38 - lw $t0, 48($sp) - sw $t0, 72($sp) - end_assign: - - # Jumping to branch_end_8792981820269 - j branch_end_8792981820269 - - branch_C_8792981820269: - # Allocating String li $v0, 9 - addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 20 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 67 - sb $t0, 8($v0) # internal_40[0] = 'C' - - addi $t0, $zero, 108 - sb $t0, 9($v0) # internal_40[1] = 'l' - - addi $t0, $zero, 97 - sb $t0, 10($v0) # internal_40[2] = 'a' - - addi $t0, $zero, 115 - sb $t0, 11($v0) # internal_40[3] = 's' - - addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_40[4] = 's' - addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_40[5] = ' ' - - addi $t0, $zero, 116 - sb $t0, 14($v0) # internal_40[6] = 't' - - addi $t0, $zero, 121 - sb $t0, 15($v0) # internal_40[7] = 'y' - - addi $t0, $zero, 112 - sb $t0, 16($v0) # internal_40[8] = 'p' - - addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_40[9] = 'e' + sb $t0, 8($v0) # internal_5[0] = ' ' - addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_40[10] = ' ' + sb $zero, 9($v0) # Null-terminator at the end of the string - addi $t0, $zero, 105 - sb $t0, 19($v0) # internal_40[11] = 'i' + sw $v0, 4($sp) # internal_5 = " " - addi $t0, $zero, 115 - sb $t0, 20($v0) # internal_40[12] = 's' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_40[13] = ' ' + # Argument self + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing self - addi $t0, $zero, 110 - sb $t0, 22($v0) # internal_40[14] = 'n' + # Argument internal_5 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_5 - addi $t0, $zero, 111 - sb $t0, 23($v0) # internal_40[15] = 'o' + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_6 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 119 - sb $t0, 24($v0) # internal_40[16] = 'w' + # Loading return value in $v1 + lw $v1, 0($sp) - addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_40[17] = ' ' + # Freeing space for local variables + addi $sp, $sp, 28 - addi $t0, $zero, 67 - sb $t0, 26($v0) # internal_40[18] = 'C' + jr $ra - addi $t0, $zero, 10 - sb $t0, 27($v0) # internal_40[19] = '\n' + function_main_at_Main: + # Function parameters + # $ra = 820($sp) + # self = 816($sp) - sb $zero, 28($v0) # Null-terminator at the end of the string + # Reserving space for local variables + addi $sp, $sp, -816 - sw $v0, 40($sp) # internal_40 = "Class type is now C\n" + # Allocating A + li $v0, 9 + lw $a0, type_A + syscall + la $t0, type_A # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 812($sp) # internal_0 = address of allocated object A # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - # Argument self - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing self + # Argument internal_0 + lw $t0, 820($sp) + sw $t0, 0($sp) # Storing internal_0 - # Argument internal_40 - lw $t0, 52($sp) - sw $t0, 0($sp) # Storing internal_40 + # Calling function function___init___at_A + jal function___init___at_A + lw $ra, 4($sp) + sw $v1, 820($sp) # internal_0 = result of function___init___at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 816($sp) # $t0 = self + lw $t1, 812($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8781702253951 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8781702253951 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8781702253951 + j object_set_attribute_8781702253951 + int_set_attribute_8781702253951: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_0 + j end_set_attribute_8781702253951 + bool_set_attribute_8781702253951: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_0 + j end_set_attribute_8781702253951 + object_set_attribute_8781702253951: + sw $t1, 12($t0) # self.avar = internal_0 + end_set_attribute_8781702253951: - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 48($sp) # internal_41 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments + while_start_8781702298224: - lw $t0, 36($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 72($sp) - j end_assign - not_is_Bool_or_Int: - # internal_32 = internal_41 - lw $t0, 36($sp) - sw $t0, 72($sp) - end_assign: + # Get attribute flag of self + lw $t0, 816($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'flag' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702254011 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702254011 + j object_get_attribute_8781702254011 + int_get_attribute_8781702254011: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 808($sp) # internal_1 = self.flag + j end_get_attribute_8781702254011 + bool_get_attribute_8781702254011: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 808($sp) # internal_1 = self.flag + j end_get_attribute_8781702254011 + object_get_attribute_8781702254011: + sw $t1, 808($sp) # internal_1 = flag + end_get_attribute_8781702254011: + + # If internal_1 then goto while_body_8781702298224 + lw $t0, 808($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8781702298224 - # Jumping to branch_end_8792981820269 - j branch_end_8792981820269 + # Jumping to while_end_8781702298224 + j while_end_8781702298224 - branch_D_8792981820269: + while_body_8781702298224: # Allocating String li $v0, 9 - addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 20 + addi $t0, $zero, 16 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 67 - sb $t0, 8($v0) # internal_43[0] = 'C' + addi $t0, $zero, 110 + sb $t0, 8($v0) # internal_2[0] = 'n' - addi $t0, $zero, 108 - sb $t0, 9($v0) # internal_43[1] = 'l' + addi $t0, $zero, 117 + sb $t0, 9($v0) # internal_2[1] = 'u' - addi $t0, $zero, 97 - sb $t0, 10($v0) # internal_43[2] = 'a' + addi $t0, $zero, 109 + sb $t0, 10($v0) # internal_2[2] = 'm' - addi $t0, $zero, 115 - sb $t0, 11($v0) # internal_43[3] = 's' + addi $t0, $zero, 98 + sb $t0, 11($v0) # internal_2[3] = 'b' - addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_43[4] = 's' + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_2[4] = 'e' + + addi $t0, $zero, 114 + sb $t0, 13($v0) # internal_2[5] = 'r' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_43[5] = ' ' + sb $t0, 14($v0) # internal_2[6] = ' ' - addi $t0, $zero, 116 - sb $t0, 14($v0) # internal_43[6] = 't' + sb $zero, 15($v0) # Null-terminator at the end of the string - addi $t0, $zero, 121 - sb $t0, 15($v0) # internal_43[7] = 'y' + sw $v0, 804($sp) # internal_2 = "number " - addi $t0, $zero, 112 - sb $t0, 16($v0) # internal_43[8] = 'p' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_43[9] = 'e' + # Argument self + lw $t0, 828($sp) + sw $t0, 4($sp) # Storing self - addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_43[10] = ' ' + # Argument internal_2 + lw $t0, 816($sp) + sw $t0, 0($sp) # Storing internal_2 - addi $t0, $zero, 105 - sb $t0, 19($v0) # internal_43[11] = 'i' + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 812($sp) # internal_3 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 115 - sb $t0, 20($v0) # internal_43[12] = 's' + # Get attribute avar of self + lw $t0, 816($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702254370 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702254370 + j object_get_attribute_8781702254370 + int_get_attribute_8781702254370: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 796($sp) # internal_4 = self.avar + j end_get_attribute_8781702254370 + bool_get_attribute_8781702254370: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 796($sp) # internal_4 = self.avar + j end_get_attribute_8781702254370 + object_get_attribute_8781702254370: + sw $t1, 796($sp) # internal_4 = avar + end_get_attribute_8781702254370: - addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_43[13] = ' ' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 110 - sb $t0, 22($v0) # internal_43[14] = 'n' + # Argument self + lw $t0, 828($sp) + sw $t0, 4($sp) # Storing self - addi $t0, $zero, 111 - sb $t0, 23($v0) # internal_43[15] = 'o' + # Argument internal_4 + lw $t0, 808($sp) + sw $t0, 0($sp) # Storing internal_4 - addi $t0, $zero, 119 - sb $t0, 24($v0) # internal_43[16] = 'w' + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 804($sp) # internal_5 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_43[17] = ' ' + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 68 - sb $t0, 26($v0) # internal_43[18] = 'D' + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 784($sp) # internal_7 = address of allocated object Int - addi $t0, $zero, 10 - sb $t0, 27($v0) # internal_43[19] = '\n' + # Get attribute avar of self + lw $t0, 816($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702254454 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702254454 + j object_get_attribute_8781702254454 + int_get_attribute_8781702254454: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 780($sp) # internal_8 = self.avar + j end_get_attribute_8781702254454 + bool_get_attribute_8781702254454: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 780($sp) # internal_8 = self.avar + j end_get_attribute_8781702254454 + object_get_attribute_8781702254454: + sw $t1, 780($sp) # internal_8 = avar + end_get_attribute_8781702254454: - sb $zero, 28($v0) # Null-terminator at the end of the string + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_8 + lw $t0, 788($sp) + sw $t0, 0($sp) # Storing internal_8 - sw $v0, 28($sp) # internal_43 = "Class type is now D\n" + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 784($sp) # internal_9 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 220($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_43 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_43 + # Argument internal_9 + lw $t0, 788($sp) + sw $t0, 0($sp) # Storing internal_9 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function function_is_even_at_Main + jal function_is_even_at_Main lw $ra, 8($sp) - sw $v1, 36($sp) # internal_44 = result of function_out_string_at_IO + sw $v1, 784($sp) # internal_10 = result of function_is_even_at_Main addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 24($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 72($sp) - j end_assign - not_is_Bool_or_Int: - # internal_32 = internal_44 - lw $t0, 24($sp) - sw $t0, 72($sp) - end_assign: + # internal_7 = internal_10 + lw $t0, 772($sp) + sw $t0, 784($sp) + + # If internal_7 then goto then_8781702295290 + lw $t0, 784($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8781702295290 - # Jumping to branch_end_8792981820269 - j branch_end_8792981820269 + # Jumping to else_8781702295290 + j else_8781702295290 - branch_E_8792981820269: + then_8781702295290: # Allocating String li $v0, 9 - addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 18 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 20 + addi $t0, $zero, 18 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 67 - sb $t0, 8($v0) # internal_46[0] = 'C' - - addi $t0, $zero, 108 - sb $t0, 9($v0) # internal_46[1] = 'l' - - addi $t0, $zero, 97 - sb $t0, 10($v0) # internal_46[2] = 'a' - - addi $t0, $zero, 115 - sb $t0, 11($v0) # internal_46[3] = 's' + addi $t0, $zero, 105 + sb $t0, 8($v0) # internal_11[0] = 'i' addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_46[4] = 's' + sb $t0, 9($v0) # internal_11[1] = 's' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_46[5] = ' ' - - addi $t0, $zero, 116 - sb $t0, 14($v0) # internal_46[6] = 't' - - addi $t0, $zero, 121 - sb $t0, 15($v0) # internal_46[7] = 'y' - - addi $t0, $zero, 112 - sb $t0, 16($v0) # internal_46[8] = 'p' + sb $t0, 10($v0) # internal_11[2] = ' ' addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_46[9] = 'e' - - addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_46[10] = ' ' + sb $t0, 11($v0) # internal_11[3] = 'e' - addi $t0, $zero, 105 - sb $t0, 19($v0) # internal_46[11] = 'i' - - addi $t0, $zero, 115 - sb $t0, 20($v0) # internal_46[12] = 's' + addi $t0, $zero, 118 + sb $t0, 12($v0) # internal_11[4] = 'v' - addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_46[13] = ' ' + addi $t0, $zero, 101 + sb $t0, 13($v0) # internal_11[5] = 'e' addi $t0, $zero, 110 - sb $t0, 22($v0) # internal_46[14] = 'n' - - addi $t0, $zero, 111 - sb $t0, 23($v0) # internal_46[15] = 'o' + sb $t0, 14($v0) # internal_11[6] = 'n' - addi $t0, $zero, 119 - sb $t0, 24($v0) # internal_46[16] = 'w' - - addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_46[17] = ' ' - - addi $t0, $zero, 69 - sb $t0, 26($v0) # internal_46[18] = 'E' + addi $t0, $zero, 33 + sb $t0, 15($v0) # internal_11[7] = '!' addi $t0, $zero, 10 - sb $t0, 27($v0) # internal_46[19] = '\n' + sb $t0, 16($v0) # internal_11[8] = '\n' - sb $zero, 28($v0) # Null-terminator at the end of the string + sb $zero, 17($v0) # Null-terminator at the end of the string - sw $v0, 16($sp) # internal_46 = "Class type is now E\n" + sw $v0, 768($sp) # internal_11 = "is even!\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 220($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_46 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_46 + # Argument internal_11 + lw $t0, 780($sp) + sw $t0, 0($sp) # Storing internal_11 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 24($sp) # internal_47 = result of function_out_string_at_IO + sw $v1, 776($sp) # internal_12 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 72($sp) - j end_assign - not_is_Bool_or_Int: - # internal_32 = internal_47 - lw $t0, 12($sp) - sw $t0, 72($sp) - end_assign: + # internal_6 = internal_12 + lw $t0, 764($sp) + sw $t0, 788($sp) - # Jumping to branch_end_8792981820269 - j branch_end_8792981820269 + # Jumping to endif_8781702295290 + j endif_8781702295290 - branch_Object_8792981820269: + else_8781702295290: # Allocating String li $v0, 9 - addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 17 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 7 + addi $t0, $zero, 17 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 79 - sb $t0, 8($v0) # internal_49[0] = 'O' + addi $t0, $zero, 105 + sb $t0, 8($v0) # internal_13[0] = 'i' - addi $t0, $zero, 111 - sb $t0, 9($v0) # internal_49[1] = 'o' + addi $t0, $zero, 115 + sb $t0, 9($v0) # internal_13[1] = 's' - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_49[2] = 'o' + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_13[2] = ' ' addi $t0, $zero, 111 - sb $t0, 11($v0) # internal_49[3] = 'o' + sb $t0, 11($v0) # internal_13[3] = 'o' - addi $t0, $zero, 112 - sb $t0, 12($v0) # internal_49[4] = 'p' + addi $t0, $zero, 100 + sb $t0, 12($v0) # internal_13[4] = 'd' - addi $t0, $zero, 115 - sb $t0, 13($v0) # internal_49[5] = 's' + addi $t0, $zero, 100 + sb $t0, 13($v0) # internal_13[5] = 'd' + + addi $t0, $zero, 33 + sb $t0, 14($v0) # internal_13[6] = '!' addi $t0, $zero, 10 - sb $t0, 14($v0) # internal_49[6] = '\n' + sb $t0, 15($v0) # internal_13[7] = '\n' - sb $zero, 15($v0) # Null-terminator at the end of the string + sb $zero, 16($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_49 = "Oooops\n" + sw $v0, 760($sp) # internal_13 = "is odd!\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 220($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_49 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_49 + # Argument internal_13 + lw $t0, 772($sp) + sw $t0, 0($sp) # Storing internal_13 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 12($sp) # internal_50 = result of function_out_string_at_IO + sw $v1, 768($sp) # internal_14 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 72($sp) - j end_assign - not_is_Bool_or_Int: - # internal_32 = internal_50 - lw $t0, 0($sp) - sw $t0, 72($sp) - end_assign: - - # Jumping to branch_end_8792981820269 - j branch_end_8792981820269 - - error_branch_8792981820269: - - - branch_end_8792981820269: - - # Loading return value in $v1 - lw $v1, 72($sp) - - # Freeing space for local variables - addi $sp, $sp, 204 - - jr $ra + # internal_6 = internal_14 + lw $t0, 756($sp) + sw $t0, 788($sp) - function_print_at_Main: - # Function parameters - # $ra = 36($sp) - # self = 32($sp) - # var = 28($sp) + # Jumping to endif_8781702295290 + j endif_8781702295290 - # Reserving space for local variables - addi $sp, $sp, -28 + endif_8781702295290: - # Allocating A2I + # Get attribute avar of self + lw $t0, 816($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702254629 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702254629 + j object_get_attribute_8781702254629 + int_get_attribute_8781702254629: li $v0, 9 - lw $a0, type_A2I - syscall - la $t0, type_A2I # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 20($sp) # internal_1 = address of allocated object A2I - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_1 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function___init___at_A2I - jal function___init___at_A2I - lw $ra, 4($sp) - sw $v1, 28($sp) # internal_1 = result of function___init___at_A2I - addi $sp, $sp, 8 # Freeing space for arguments - - lw $t0, 20($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: - # z = internal_1 - lw $t0, 20($sp) - sw $t0, 24($sp) - end_assign: - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument var - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing var - - # Calling function function_value_at_A - jal function_value_at_A - lw $ra, 4($sp) - sw $v1, 24($sp) # internal_2 = result of function_value_at_A - addi $sp, $sp, 8 # Freeing space for arguments + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 752($sp) # internal_15 = self.avar + j end_get_attribute_8781702254629 + bool_get_attribute_8781702254629: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 752($sp) # internal_15 = self.avar + j end_get_attribute_8781702254629 + object_get_attribute_8781702254629: + sw $t1, 752($sp) # internal_15 = avar + end_get_attribute_8781702254629: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument z - lw $t0, 36($sp) - sw $t0, 4($sp) # Storing z + # Argument self + lw $t0, 828($sp) + sw $t0, 4($sp) # Storing self - # Argument internal_2 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_2 + # Argument internal_15 + lw $t0, 764($sp) + sw $t0, 0($sp) # Storing internal_15 - # Calling function function_i2a_at_A2I - jal function_i2a_at_A2I + # Calling function function_class_type_at_Main + jal function_class_type_at_Main lw $ra, 8($sp) - sw $v1, 24($sp) # internal_3 = result of function_i2a_at_A2I + sw $v1, 760($sp) # internal_16 = result of function_class_type_at_Main addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 44($sp) - sw $t0, 4($sp) # Storing self + lw $t0, 824($sp) + sw $t0, 0($sp) # Storing self - # Argument internal_3 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_3 + # Calling function function_menu_at_Main + jal function_menu_at_Main + lw $ra, 4($sp) + sw $v1, 752($sp) # internal_17 = result of function_menu_at_Main + addi $sp, $sp, 8 # Freeing space for arguments - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_4 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments + # Set attribute char of self + lw $t0, 816($sp) # $t0 = self + lw $t1, 744($sp) # $t1 = internal_17 + beq $t1, $zero, object_set_attribute_8781702254650 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8781702254650 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8781702254650 + j object_set_attribute_8781702254650 + int_set_attribute_8781702254650: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.char = internal_17 + j end_set_attribute_8781702254650 + bool_set_attribute_8781702254650: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.char = internal_17 + j end_set_attribute_8781702254650 + object_set_attribute_8781702254650: + sw $t1, 8($t0) # self.char = internal_17 + end_set_attribute_8781702254650: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 736($sp) # internal_19 = address of allocated object Int + + # Get attribute char of self + lw $t0, 816($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702254725 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702254725 + j object_get_attribute_8781702254725 + int_get_attribute_8781702254725: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 732($sp) # internal_20 = self.char + j end_get_attribute_8781702254725 + bool_get_attribute_8781702254725: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 732($sp) # internal_20 = self.char + j end_get_attribute_8781702254725 + object_get_attribute_8781702254725: + sw $t1, 732($sp) # internal_20 = char + end_get_attribute_8781702254725: # Allocating String li $v0, 9 @@ -11216,49 +12951,48 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_5[0] = ' ' + addi $t0, $zero, 97 + sb $t0, 8($v0) # internal_21[0] = 'a' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_5 = " " + sw $v0, 728($sp) # internal_21 = "a" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 44($sp) - sw $t0, 4($sp) # Storing self + # Argument internal_20 + lw $t0, 744($sp) + sw $t0, 4($sp) # Storing internal_20 - # Argument internal_5 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_5 + # Argument internal_21 + lw $t0, 740($sp) + sw $t0, 0($sp) # Storing internal_21 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function function_equal + jal function_equal lw $ra, 8($sp) - sw $v1, 12($sp) # internal_6 = result of function_out_string_at_IO + sw $v1, 736($sp) # internal_22 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 28 + # internal_19 = internal_22 + lw $t0, 724($sp) + sw $t0, 736($sp) - jr $ra + # If internal_19 then goto then_8781702298209 + lw $t0, 736($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8781702298209 - function_main_at_Main: - # Function parameters - # $ra = 772($sp) - # self = 768($sp) + # Jumping to else_8781702298209 + j else_8781702298209 - # Reserving space for local variables - addi $sp, $sp, -768 + then_8781702298209: # Allocating A li $v0, 9 @@ -11267,420 +13001,791 @@ la $t0, type_A # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 764($sp) # internal_0 = address of allocated object A + sw $v0, 720($sp) # internal_23 = address of allocated object A # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_0 - lw $t0, 772($sp) - sw $t0, 0($sp) # Storing internal_0 + # Argument internal_23 + lw $t0, 728($sp) + sw $t0, 0($sp) # Storing internal_23 # Calling function function___init___at_A jal function___init___at_A lw $ra, 4($sp) - sw $v1, 772($sp) # internal_0 = result of function___init___at_A + sw $v1, 728($sp) # internal_23 = result of function___init___at_A addi $sp, $sp, 8 # Freeing space for arguments - # Set attribute avar of self - lw $t0, 768($sp) # $t0 = self - lw $t1, 764($sp) # $t1 = internal_0 - sw $t1, 12($t0) # self.avar = internal_0 + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - while_start_8792981790296: + # Argument self + lw $t0, 824($sp) + sw $t0, 0($sp) # Storing self - # Get attribute flag of self - lw $t0, 768($sp) # Get the address of self - lw $t1, 20($t0) # Get the attribute 'flag' from the instance - sw $t1, 756($sp) # internal_2 = flag + # Calling function function_get_int_at_Main + jal function_get_int_at_Main + lw $ra, 4($sp) + sw $v1, 724($sp) # internal_24 = result of function_get_int_at_Main + addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 756($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 760($sp) - j end_assign - not_is_Bool_or_Int: - # internal_1 = internal_2 - lw $t0, 756($sp) - sw $t0, 760($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # If internal_1 then goto while_body_8792981790296 - lw $t0, 760($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8792981790296 + # Argument internal_23 + lw $t0, 732($sp) + sw $t0, 4($sp) # Storing internal_23 + + # Argument internal_24 + lw $t0, 728($sp) + sw $t0, 0($sp) # Storing internal_24 - # Jumping to while_end_8792981790296 - j while_end_8792981790296 + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 724($sp) # internal_25 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments - while_body_8792981790296: + # Set attribute a_var of self + lw $t0, 816($sp) # $t0 = self + lw $t1, 712($sp) # $t1 = internal_25 + beq $t1, $zero, object_set_attribute_8781702254806 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8781702254806 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8781702254806 + j object_set_attribute_8781702254806 + int_set_attribute_8781702254806: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.a_var = internal_25 + j end_set_attribute_8781702254806 + bool_set_attribute_8781702254806: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.a_var = internal_25 + j end_set_attribute_8781702254806 + object_set_attribute_8781702254806: + sw $t1, 16($t0) # self.a_var = internal_25 + end_set_attribute_8781702254806: - # Allocating String + # Allocating B li $v0, 9 - addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + lw $a0, type_B syscall + la $t0, type_B # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 708($sp) # internal_26 = address of allocated object B - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - addi $t0, $zero, 7 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + # Argument internal_26 + lw $t0, 716($sp) + sw $t0, 0($sp) # Storing internal_26 - addi $t0, $zero, 110 - sb $t0, 8($v0) # internal_3[0] = 'n' + # Calling function function___init___at_B + jal function___init___at_B + lw $ra, 4($sp) + sw $v1, 716($sp) # internal_26 = result of function___init___at_B + addi $sp, $sp, 8 # Freeing space for arguments - addi $t0, $zero, 117 - sb $t0, 9($v0) # internal_3[1] = 'u' + # Get attribute avar of self + lw $t0, 816($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702255204 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702255204 + j object_get_attribute_8781702255204 + int_get_attribute_8781702255204: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 704($sp) # internal_27 = self.avar + j end_get_attribute_8781702255204 + bool_get_attribute_8781702255204: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 704($sp) # internal_27 = self.avar + j end_get_attribute_8781702255204 + object_get_attribute_8781702255204: + sw $t1, 704($sp) # internal_27 = avar + end_get_attribute_8781702255204: - addi $t0, $zero, 109 - sb $t0, 10($v0) # internal_3[2] = 'm' + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - addi $t0, $zero, 98 - sb $t0, 11($v0) # internal_3[3] = 'b' + # Argument internal_27 + lw $t0, 712($sp) + sw $t0, 0($sp) # Storing internal_27 - addi $t0, $zero, 101 - sb $t0, 12($v0) # internal_3[4] = 'e' + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 708($sp) # internal_28 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments - addi $t0, $zero, 114 - sb $t0, 13($v0) # internal_3[5] = 'r' + # Get attribute a_var of self + lw $t0, 816($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'a_var' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702255234 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702255234 + j object_get_attribute_8781702255234 + int_get_attribute_8781702255234: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 696($sp) # internal_29 = self.a_var + j end_get_attribute_8781702255234 + bool_get_attribute_8781702255234: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 696($sp) # internal_29 = self.a_var + j end_get_attribute_8781702255234 + object_get_attribute_8781702255234: + sw $t1, 696($sp) # internal_29 = a_var + end_get_attribute_8781702255234: - addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_3[6] = ' ' + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - sb $zero, 15($v0) # Null-terminator at the end of the string + # Argument internal_29 + lw $t0, 704($sp) + sw $t0, 0($sp) # Storing internal_29 - sw $v0, 752($sp) # internal_3 = "number " + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 700($sp) # internal_30 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address - # Argument self - lw $t0, 780($sp) - sw $t0, 4($sp) # Storing self + # Argument internal_26 + lw $t0, 724($sp) + sw $t0, 8($sp) # Storing internal_26 - # Argument internal_3 - lw $t0, 764($sp) - sw $t0, 0($sp) # Storing internal_3 + # Argument internal_28 + lw $t0, 716($sp) + sw $t0, 4($sp) # Storing internal_28 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 760($sp) # internal_4 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments + # Argument internal_30 + lw $t0, 708($sp) + sw $t0, 0($sp) # Storing internal_30 - # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 744($sp) # internal_5 = avar + # Calling function function_method2_at_A + jal function_method2_at_A + lw $ra, 12($sp) + sw $v1, 704($sp) # internal_31 = result of function_method2_at_A + addi $sp, $sp, 16 # Freeing space for arguments - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + # Set attribute avar of self + lw $t0, 816($sp) # $t0 = self + lw $t1, 688($sp) # $t1 = internal_31 + beq $t1, $zero, object_set_attribute_8781702255144 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8781702255144 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8781702255144 + j object_set_attribute_8781702255144 + int_set_attribute_8781702255144: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_31 + j end_set_attribute_8781702255144 + bool_set_attribute_8781702255144: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_31 + j end_set_attribute_8781702255144 + object_set_attribute_8781702255144: + sw $t1, 12($t0) # self.avar = internal_31 + end_set_attribute_8781702255144: + + # internal_18 = internal_31 + lw $t0, 688($sp) + sw $t0, 740($sp) - # Argument self - lw $t0, 780($sp) - sw $t0, 4($sp) # Storing self + # Jumping to endif_8781702298209 + j endif_8781702298209 - # Argument internal_5 - lw $t0, 756($sp) - sw $t0, 0($sp) # Storing internal_5 + else_8781702298209: - # Calling function function_print_at_Main - jal function_print_at_Main - lw $ra, 8($sp) - sw $v1, 752($sp) # internal_6 = result of function_print_at_Main - addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 680($sp) # internal_33 = address of allocated object Int - # Allocating Bool 0 + # Get attribute char of self + lw $t0, 816($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702255318 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702255318 + j object_get_attribute_8781702255318 + int_get_attribute_8781702255318: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 676($sp) # internal_34 = self.char + j end_get_attribute_8781702255318 + bool_get_attribute_8781702255318: li $v0, 9 addi $a0, $zero, 12 syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 676($sp) # internal_34 = self.char + j end_get_attribute_8781702255318 + object_get_attribute_8781702255318: + sw $t1, 676($sp) # internal_34 = char + end_get_attribute_8781702255318: - la $t0, type_Bool # $t0 = address of the type + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 732($sp) # internal_8 = address of allocated object Int - # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 728($sp) # internal_9 = avar + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + addi $t0, $zero, 98 + sb $t0, 8($v0) # internal_35[0] = 'b' - # Argument internal_9 - lw $t0, 736($sp) - sw $t0, 0($sp) # Storing internal_9 + sb $zero, 9($v0) # Null-terminator at the end of the string - # Calling function function_value_at_A - jal function_value_at_A - lw $ra, 4($sp) - sw $v1, 732($sp) # internal_10 = result of function_value_at_A - addi $sp, $sp, 8 # Freeing space for arguments + sw $v0, 672($sp) # internal_35 = "b" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 780($sp) - sw $t0, 4($sp) # Storing self + # Argument internal_34 + lw $t0, 688($sp) + sw $t0, 4($sp) # Storing internal_34 - # Argument internal_10 - lw $t0, 736($sp) - sw $t0, 0($sp) # Storing internal_10 + # Argument internal_35 + lw $t0, 684($sp) + sw $t0, 0($sp) # Storing internal_35 - # Calling function function_is_even_at_Main - jal function_is_even_at_Main + # Calling function function_equal + jal function_equal lw $ra, 8($sp) - sw $v1, 732($sp) # internal_11 = result of function_is_even_at_Main - addi $sp, $sp, 12 # Freeing space for arguments - - lw $t0, 720($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 732($sp) - j end_assign - not_is_Bool_or_Int: - # internal_8 = internal_11 - lw $t0, 720($sp) - sw $t0, 732($sp) - end_assign: - - # If internal_8 then goto then_8792981820386 - lw $t0, 732($sp) # Loading the address of the condition + sw $v1, 680($sp) # internal_36 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_33 = internal_36 + lw $t0, 668($sp) + sw $t0, 680($sp) + + # If internal_33 then goto then_8781702298203 + lw $t0, 680($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981820386 + beq $t0, $t1, then_8781702298203 - # Jumping to else_8792981820386 - j else_8792981820386 + # Jumping to else_8781702298203 + j else_8781702298203 - then_8792981820386: + then_8781702298203: - # Allocating String + # Get attribute avar of self + lw $t0, 816($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702255915 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702255915 + j object_get_attribute_8781702255915 + int_get_attribute_8781702255915: li $v0, 9 - addi $a0, $zero, 18 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 664($sp) # internal_37 = self.avar + j end_get_attribute_8781702255915 + bool_get_attribute_8781702255915: + li $v0, 9 + addi $a0, $zero, 12 syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 664($sp) # internal_37 = self.avar + j end_get_attribute_8781702255915 + object_get_attribute_8781702255915: + sw $t1, 664($sp) # internal_37 = avar + end_get_attribute_8781702255915: - la $t0, type_String + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 660($sp) # internal_38 = address of allocated object Int - addi $t0, $zero, 9 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 105 - sb $t0, 8($v0) # internal_12[0] = 'i' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 656($sp) # internal_39 = address of allocated object Int - addi $t0, $zero, 115 - sb $t0, 9($v0) # internal_12[1] = 's' + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_12[2] = ' ' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 652($sp) # internal_40 = address of allocated object Int - addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_12[3] = 'e' + # Allocating NUll to internal_41 + sw $zero, 648($sp) # internal_41 = 0 - addi $t0, $zero, 118 - sb $t0, 12($v0) # internal_12[4] = 'v' + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 101 - sb $t0, 13($v0) # internal_12[5] = 'e' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 644($sp) # internal_42 = address of allocated object Int - addi $t0, $zero, 110 - sb $t0, 14($v0) # internal_12[6] = 'n' + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 33 - sb $t0, 15($v0) # internal_12[7] = '!' + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 632($sp) # internal_45 = address of allocated object Int - addi $t0, $zero, 10 - sb $t0, 16($v0) # internal_12[8] = '\n' + # internal_43 = typeof internal_37 that is the first word of the object + lw $t0, 664($sp) + lw $t0, 0($t0) + sw $t0, 640($sp) - sb $zero, 17($v0) # Null-terminator at the end of the string + # internal_44 = internal_43 + lw $t0, 640($sp) + sw $t0, 636($sp) - sw $v0, 716($sp) # internal_12 = "is even!\n" + while_start_8781702296263: + + # internal_45 = EqualAddress(internal_44, internal_41) + lw $t0, 636($sp) + lw $t1, 648($sp) + seq $t2, $t0, $t1 + lw $t0, 632($sp) + sw $t2, 8($t0) + + # If internal_45 then goto while_end_8781702296263 + lw $t0, 632($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8781702296263 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 780($sp) - sw $t0, 4($sp) # Storing self + # Argument internal_42 + lw $t0, 656($sp) + sw $t0, 4($sp) # Storing internal_42 - # Argument internal_12 - lw $t0, 728($sp) - sw $t0, 0($sp) # Storing internal_12 + # Argument internal_39 + lw $t0, 668($sp) + sw $t0, 0($sp) # Storing internal_39 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function function_add + jal function_add lw $ra, 8($sp) - sw $v1, 724($sp) # internal_13 = result of function_out_string_at_IO + sw $v1, 656($sp) # internal_42 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 712($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 736($sp) - j end_assign - not_is_Bool_or_Int: - # internal_7 = internal_13 - lw $t0, 712($sp) - sw $t0, 736($sp) - end_assign: + # internal_44 = ancestor of internal_44 + lw $t0, 636($sp) + lw $t0, 4($t0) + sw $t0, 636($sp) - # Jumping to endif_8792981820386 - j endif_8792981820386 + # Jumping to while_start_8781702296263 + j while_start_8781702296263 - else_8792981820386: + while_end_8781702296263: - # Allocating String + # internal_44 = internal_43 + lw $t0, 640($sp) + sw $t0, 636($sp) + + # initialize Array [internal_42] + lw $t0, 644($sp) # $t0 = internal_42 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 li $v0, 9 - addi $a0, $zero, 17 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + move $a0, $t0 syscall + sw $v0, 628($sp) # internal_46 = new Array[internal_42] - la $t0, type_String + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 624($sp) # internal_47 = address of allocated object Int - addi $t0, $zero, 8 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 105 - sb $t0, 8($v0) # internal_14[0] = 'i' + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 620($sp) # internal_48 = address of allocated object Int - addi $t0, $zero, 115 - sb $t0, 9($v0) # internal_14[1] = 's' + foreach_start_8781702296263: - addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_14[2] = ' ' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 111 - sb $t0, 11($v0) # internal_14[3] = 'o' + # Argument internal_47 + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing internal_47 - addi $t0, $zero, 100 - sb $t0, 12($v0) # internal_14[4] = 'd' + # Argument internal_42 + lw $t0, 656($sp) + sw $t0, 0($sp) # Storing internal_42 - addi $t0, $zero, 100 - sb $t0, 13($v0) # internal_14[5] = 'd' + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 632($sp) # internal_48 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 33 - sb $t0, 14($v0) # internal_14[6] = '!' + # If internal_48 then goto foreach_body_8781702296263 + lw $t0, 620($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8781702296263 - addi $t0, $zero, 10 - sb $t0, 15($v0) # internal_14[7] = '\n' + # Jumping to foreach_end_8781702296263 + j foreach_end_8781702296263 - sb $zero, 16($v0) # Null-terminator at the end of the string + foreach_body_8781702296263: - sw $v0, 708($sp) # internal_14 = "is odd!\n" + # array internal_46[4 * internal_47] = internal_44 + lw $t0, 624($sp) # $t0 = internal_47 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 628($sp) # $t1 = internal_46 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 636($sp) + sw $t0, 0($t1) + + # internal_44 = ancestor of internal_44 + lw $t0, 636($sp) + lw $t0, 4($t0) + sw $t0, 636($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 780($sp) - sw $t0, 4($sp) # Storing self + # Argument internal_47 + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing internal_47 - # Argument internal_14 - lw $t0, 720($sp) - sw $t0, 0($sp) # Storing internal_14 + # Argument internal_39 + lw $t0, 668($sp) + sw $t0, 0($sp) # Storing internal_39 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function function_add + jal function_add lw $ra, 8($sp) - sw $v1, 716($sp) # internal_15 = result of function_out_string_at_IO + sw $v1, 636($sp) # internal_47 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 704($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 736($sp) - j end_assign - not_is_Bool_or_Int: - # internal_7 = internal_15 - lw $t0, 704($sp) - sw $t0, 736($sp) - end_assign: + # Jumping to foreach_start_8781702296263 + j foreach_start_8781702296263 - # Jumping to endif_8792981820386 - j endif_8792981820386 + foreach_end_8781702296263: - endif_8792981820386: + # initialize Array [internal_40] + lw $t0, 652($sp) # $t0 = internal_40 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 616($sp) # internal_49 = new Array[internal_40] + + # initialize Array [internal_40] + lw $t0, 652($sp) # $t0 = internal_40 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 612($sp) # internal_50 = new Array[internal_40] - # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 700($sp) # internal_16 = avar + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 604($sp) # internal_52 = address of allocated object Int - # Argument self - lw $t0, 780($sp) - sw $t0, 4($sp) # Storing self + # internal_51 = direction of C + la $t0, type_C + sw $t0, 608($sp) - # Argument internal_16 - lw $t0, 712($sp) - sw $t0, 0($sp) # Storing internal_16 + # array internal_49[4 * internal_52] = internal_51 + lw $t0, 604($sp) # $t0 = internal_52 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 616($sp) # $t1 = internal_49 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 608($sp) + sw $t0, 0($t1) + + # array internal_50[4 * internal_52] = internal_42 + lw $t0, 604($sp) # $t0 = internal_52 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 612($sp) # $t1 = internal_50 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 644($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # Calling function function_class_type_at_Main - jal function_class_type_at_Main - lw $ra, 8($sp) - sw $v1, 708($sp) # internal_17 = result of function_class_type_at_Main - addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 596($sp) # internal_54 = address of allocated object Int + + # internal_53 = direction of A + la $t0, type_A + sw $t0, 600($sp) + + # array internal_49[4 * internal_54] = internal_53 + lw $t0, 596($sp) # $t0 = internal_54 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 616($sp) # $t1 = internal_49 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 600($sp) + sw $t0, 0($t1) + + # array internal_50[4 * internal_54] = internal_42 + lw $t0, 596($sp) # $t0 = internal_54 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 612($sp) # $t1 = internal_50 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 644($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Argument self - lw $t0, 776($sp) - sw $t0, 0($sp) # Storing self + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 588($sp) # internal_56 = address of allocated object Int - # Calling function function_menu_at_Main - jal function_menu_at_Main - lw $ra, 4($sp) - sw $v1, 700($sp) # internal_18 = result of function_menu_at_Main - addi $sp, $sp, 8 # Freeing space for arguments + # internal_55 = direction of Object + la $t0, type_Object + sw $t0, 592($sp) + + # array internal_49[4 * internal_56] = internal_55 + lw $t0, 588($sp) # $t0 = internal_56 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 616($sp) # $t1 = internal_49 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 592($sp) + sw $t0, 0($t1) + + # array internal_50[4 * internal_56] = internal_42 + lw $t0, 588($sp) # $t0 = internal_56 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 612($sp) # $t1 = internal_50 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 644($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # Set attribute char of self - lw $t0, 768($sp) # $t0 = self - lw $t1, 692($sp) # $t1 = internal_18 - sw $t1, 8($t0) # self.char = internal_18 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 584($sp) # internal_57 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -11692,264 +13797,216 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 684($sp) # internal_20 = address of allocated object Int - - # Get attribute char of self - lw $t0, 768($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'char' from the instance - sw $t1, 680($sp) # internal_21 = char + sw $v0, 580($sp) # internal_58 = address of allocated object Int - # Allocating String + # Allocating Int 0 li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 572($sp) # internal_60 = address of allocated object Int - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 97 - sb $t0, 8($v0) # internal_22[0] = 'a' + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 568($sp) # internal_61 = address of allocated object Int - sb $zero, 9($v0) # Null-terminator at the end of the string + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 560($sp) # internal_63 = address of allocated object Int - sw $v0, 676($sp) # internal_22 = "a" + foreach_type_start_8781702296263: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_21 - lw $t0, 692($sp) - sw $t0, 4($sp) # Storing internal_21 + # Argument internal_57 + lw $t0, 596($sp) + sw $t0, 4($sp) # Storing internal_57 - # Argument internal_22 - lw $t0, 688($sp) - sw $t0, 0($sp) # Storing internal_22 + # Argument internal_40 + lw $t0, 664($sp) + sw $t0, 0($sp) # Storing internal_40 - # Calling function function_equal - jal function_equal + # Calling function function_less_than + jal function_less_than lw $ra, 8($sp) - sw $v1, 684($sp) # internal_23 = result of function_equal + sw $v1, 592($sp) # internal_58 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 672($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 684($sp) - j end_assign - not_is_Bool_or_Int: - # internal_20 = internal_23 - lw $t0, 672($sp) - sw $t0, 684($sp) - end_assign: - - # If internal_20 then goto then_8792981790281 - lw $t0, 684($sp) # Loading the address of the condition + # If internal_58 then goto foreach_type_body_8781702296263 + lw $t0, 580($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981790281 + beq $t0, $t1, foreach_type_body_8781702296263 - # Jumping to else_8792981790281 - j else_8792981790281 + # Jumping to foreach_type_end_8781702296263 + j foreach_type_end_8781702296263 - then_8792981790281: + foreach_type_body_8781702296263: - # Allocating A - li $v0, 9 - lw $a0, type_A - syscall - la $t0, type_A # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 668($sp) # internal_24 = address of allocated object A + # internal_59 = array internal_49[4 * internal_57] + lw $t0, 584($sp) # $t0 = internal_57 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 616($sp) # $t1 = internal_49 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 576($sp) # internal_59 = array internal_49[4 * internal_57] # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_24 - lw $t0, 676($sp) - sw $t0, 0($sp) # Storing internal_24 + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Calling function function___init___at_A - jal function___init___at_A - lw $ra, 4($sp) - sw $v1, 676($sp) # internal_24 = result of function___init___at_A - addi $sp, $sp, 8 # Freeing space for arguments + # Argument internal_60 + lw $t0, 584($sp) + sw $t0, 4($sp) # Storing internal_60 - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + # Argument internal_38 + lw $t0, 672($sp) + sw $t0, 0($sp) # Storing internal_38 - # Argument self - lw $t0, 776($sp) - sw $t0, 0($sp) # Storing self + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 584($sp) # internal_60 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # Calling function function_get_int_at_Main - jal function_get_int_at_Main - lw $ra, 4($sp) - sw $v1, 672($sp) # internal_25 = result of function_get_int_at_Main - addi $sp, $sp, 8 # Freeing space for arguments + foreach_ancestor_start_8781702296263: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_24 - lw $t0, 680($sp) - sw $t0, 4($sp) # Storing internal_24 + # Argument internal_60 + lw $t0, 584($sp) + sw $t0, 4($sp) # Storing internal_60 - # Argument internal_25 - lw $t0, 676($sp) - sw $t0, 0($sp) # Storing internal_25 + # Argument internal_42 + lw $t0, 656($sp) + sw $t0, 0($sp) # Storing internal_42 - # Calling function function_set_var_at_A - jal function_set_var_at_A + # Calling function function_less_than + jal function_less_than lw $ra, 8($sp) - sw $v1, 672($sp) # internal_26 = result of function_set_var_at_A + sw $v1, 580($sp) # internal_61 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # Set attribute a_var of self - lw $t0, 768($sp) # $t0 = self - lw $t1, 660($sp) # $t1 = internal_26 - sw $t1, 16($t0) # self.a_var = internal_26 - - # Allocating B - li $v0, 9 - lw $a0, type_B - syscall - la $t0, type_B # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 656($sp) # internal_27 = address of allocated object B - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_27 - lw $t0, 664($sp) - sw $t0, 0($sp) # Storing internal_27 - - # Calling function function___init___at_B - jal function___init___at_B - lw $ra, 4($sp) - sw $v1, 664($sp) # internal_27 = result of function___init___at_B - addi $sp, $sp, 8 # Freeing space for arguments + # If internal_61 then goto foreach_ancestor_body_8781702296263 + lw $t0, 568($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8781702296263 + + # Jumping to foreach_ancestor_end_8781702296263 + j foreach_ancestor_end_8781702296263 + + foreach_ancestor_body_8781702296263: + + # internal_62 = array internal_46[4 * internal_60] + lw $t0, 572($sp) # $t0 = internal_60 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 628($sp) # $t1 = internal_46 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 564($sp) # internal_62 = array internal_46[4 * internal_60] + + # internal_63 = EqualAddress(internal_59, internal_62) + lw $t0, 576($sp) + lw $t1, 564($sp) + seq $t2, $t0, $t1 + lw $t0, 560($sp) + sw $t2, 8($t0) - # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 652($sp) # internal_28 = avar + # If internal_63 then goto foreach_ancestor_end_8781702296263 + lw $t0, 560($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8781702296263 # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Argument internal_28 - lw $t0, 660($sp) - sw $t0, 0($sp) # Storing internal_28 + # Argument internal_60 + lw $t0, 584($sp) + sw $t0, 4($sp) # Storing internal_60 - # Calling function function_value_at_A - jal function_value_at_A - lw $ra, 4($sp) - sw $v1, 656($sp) # internal_29 = result of function_value_at_A - addi $sp, $sp, 8 # Freeing space for arguments + # Argument internal_39 + lw $t0, 668($sp) + sw $t0, 0($sp) # Storing internal_39 - # Get attribute a_var of self - lw $t0, 768($sp) # Get the address of self - lw $t1, 16($t0) # Get the attribute 'a_var' from the instance - sw $t1, 644($sp) # internal_30 = a_var + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 584($sp) # internal_60 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + # Jumping to foreach_ancestor_start_8781702296263 + j foreach_ancestor_start_8781702296263 - # Argument internal_30 - lw $t0, 652($sp) - sw $t0, 0($sp) # Storing internal_30 + foreach_ancestor_end_8781702296263: - # Calling function function_value_at_A - jal function_value_at_A - lw $ra, 4($sp) - sw $v1, 648($sp) # internal_31 = result of function_value_at_A - addi $sp, $sp, 8 # Freeing space for arguments + # array internal_50[4 * internal_57] = internal_60 + lw $t0, 584($sp) # $t0 = internal_57 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 612($sp) # $t1 = internal_50 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 572($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address - - # Argument internal_27 - lw $t0, 672($sp) - sw $t0, 8($sp) # Storing internal_27 - - # Argument internal_29 - lw $t0, 664($sp) - sw $t0, 4($sp) # Storing internal_29 - - # Argument internal_31 - lw $t0, 656($sp) - sw $t0, 0($sp) # Storing internal_31 - - # Calling function function_method2_at_A - jal function_method2_at_A - lw $ra, 12($sp) - sw $v1, 652($sp) # internal_32 = result of function_method2_at_A - addi $sp, $sp, 16 # Freeing space for arguments - - # Set attribute avar of self - lw $t0, 768($sp) # $t0 = self - lw $t1, 636($sp) # $t1 = internal_32 - sw $t1, 12($t0) # self.avar = internal_32 - - lw $t0, 636($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 688($sp) - j end_assign - not_is_Bool_or_Int: - # internal_19 = internal_32 - lw $t0, 636($sp) - sw $t0, 688($sp) - end_assign: - - # Jumping to endif_8792981790281 - j endif_8792981790281 + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - else_8792981790281: + # Argument internal_57 + lw $t0, 596($sp) + sw $t0, 4($sp) # Storing internal_57 + # Argument internal_39 + lw $t0, 668($sp) + sw $t0, 0($sp) # Storing internal_39 - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 596($sp) # internal_57 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 628($sp) # internal_34 = address of allocated object Int + # Jumping to foreach_type_start_8781702296263 + j foreach_type_start_8781702296263 - # Get attribute char of self - lw $t0, 768($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'char' from the instance - sw $t1, 624($sp) # internal_35 = char + foreach_type_end_8781702296263: # Allocating String li $v0, 9 @@ -11959,72 +14016,69 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 98 - sb $t0, 8($v0) # internal_36[0] = 'b' + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_69[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 620($sp) # internal_36 = "b" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + sw $v0, 536($sp) # internal_69 = "\n" - # Argument internal_35 - lw $t0, 636($sp) - sw $t0, 4($sp) # Storing internal_35 + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - # Argument internal_36 - lw $t0, 632($sp) - sw $t0, 0($sp) # Storing internal_36 + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 628($sp) # internal_37 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - lw $t0, 616($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 628($sp) - j end_assign - not_is_Bool_or_Int: - # internal_34 = internal_37 - lw $t0, 616($sp) - sw $t0, 628($sp) - end_assign: - - # If internal_34 then goto then_8792981790275 - lw $t0, 628($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981790275 + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - # Jumping to else_8792981790275 - j else_8792981790275 + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_70[0] = ' ' - then_8792981790275: + sb $zero, 9($v0) # Null-terminator at the end of the string - # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 612($sp) # internal_38 = avar + sw $v0, 532($sp) # internal_70 = " " + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 556($sp) # internal_64 = address of allocated object Int + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 552($sp) # internal_65 = address of allocated object Int + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 548($sp) # internal_66 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -12036,7 +14090,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 588($sp) # internal_44 = address of allocated object Int + sw $v0, 544($sp) # internal_67 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -12048,384 +14102,411 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 596($sp) # internal_42 = address of allocated object Int - - - - - # internal_40 = typeof internal_38 that is the first word of the object - lw $t0, 612($sp) - lw $t1, 0($t0) - sw $t1, 604($sp) - - lw $t0, 604($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 600($sp) - j end_assign - not_is_Bool_or_Int: - # internal_41 = internal_40 - lw $t0, 604($sp) - sw $t0, 600($sp) - end_assign: - - lw $t0, 588($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 608($sp) - j end_assign - not_is_Bool_or_Int: - # internal_39 = internal_44 - lw $t0, 588($sp) - sw $t0, 608($sp) - end_assign: - - while_start_8792981788591: - - # Equal operation - lw $t0, 600($sp) # Save in $t0 the left operand address - # If internal_42 then goto while_end_8792981788591 - lw $t0, 596($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_end_8792981788591 - - # Addition operation - lw $t0, 608($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # internal_41 = ancestor of internal_41 that is the first word of the object - lw $t0, 600($sp) - lw $t1, 4($t0) - sw $t1, 600($sp) + sw $v0, 540($sp) # internal_68 = address of allocated object Int - # Jumping to while_start_8792981788591 - j while_start_8792981788591 - - while_end_8792981788591: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_67 + lw $t0, 556($sp) + sw $t0, 4($sp) # Storing internal_67 + # Argument internal_42 + lw $t0, 656($sp) + sw $t0, 0($sp) # Storing internal_42 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 556($sp) # internal_67 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 604($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 600($sp) - j end_assign - not_is_Bool_or_Int: - # internal_41 = internal_40 - lw $t0, 604($sp) - sw $t0, 600($sp) - end_assign: + foreach_min_start_8781702296263: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - foreach_start_8792981788591: + # Argument internal_64 + lw $t0, 568($sp) + sw $t0, 4($sp) # Storing internal_64 - # Less than operation - lw $t0, 580($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 608($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + # Argument internal_40 + lw $t0, 664($sp) + sw $t0, 0($sp) # Storing internal_40 - lw $t0, 576($sp) # $t0 = internal_47 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 552($sp) # internal_68 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - # If internal_47 then goto foreach_body_8792981788591 - lw $t0, 576($sp) # Loading the address of the condition + # If internal_68 then goto foreach_min_body_8781702296263 + lw $t0, 540($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_body_8792981788591 - - # Jumping to foreach_end_8792981788591 - j foreach_end_8792981788591 + beq $t0, $t1, foreach_min_body_8781702296263 - foreach_body_8792981788591: - - - # internal_41 = ancestor of internal_41 that is the first word of the object - lw $t0, 600($sp) - lw $t1, 4($t0) - sw $t1, 600($sp) - - # Addition operation - lw $t0, 580($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_start_8792981788591 - j foreach_start_8792981788591 - - foreach_end_8792981788591: - - - - - - - # internal_50 = direction of C - la $t0, type_C - sw $t0, 564($sp) - - - - # internal_51 = direction of A - la $t0, type_A - sw $t0, 560($sp) - - - - # internal_52 = direction of Object - la $t0, type_Object - sw $t0, 556($sp) + # Jumping to foreach_min_end_8781702296263 + j foreach_min_end_8781702296263 + foreach_min_body_8781702296263: + # internal_66 = array internal_50[4 * internal_64] + lw $t0, 556($sp) # $t0 = internal_64 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 612($sp) # $t1 = internal_50 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 548($sp) # internal_66 = array internal_50[4 * internal_64] + sw $t0, 8($t2) + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_66 + lw $t0, 560($sp) + sw $t0, 4($sp) # Storing internal_66 + # Argument internal_67 + lw $t0, 556($sp) + sw $t0, 0($sp) # Storing internal_67 - foreach_type_start_8792981788591: + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 552($sp) # internal_68 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - # Less than operation - lw $t0, 552($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # If internal_54 then goto foreach_type_body_8792981788591 - lw $t0, 548($sp) # Loading the address of the condition + # If internal_68 then goto update_min_8781702296263 + lw $t0, 540($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_type_body_8792981788591 - - # Jumping to foreach_type_end_8792981788591 - j foreach_type_end_8792981788591 - - foreach_type_body_8792981788591: + beq $t0, $t1, update_min_8781702296263 + # Jumping to update_min_end_8781702296263 + j update_min_end_8781702296263 + update_min_8781702296263: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_67 + lw $t0, 556($sp) + sw $t0, 4($sp) # Storing internal_67 - foreach_ancestor_start_8792981788591: + # Argument internal_66 + lw $t0, 560($sp) + sw $t0, 0($sp) # Storing internal_66 - # Less than operation - lw $t0, 540($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 608($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 556($sp) # internal_67 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 536($sp) # $t0 = internal_57 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # If internal_57 then goto foreach_ancestor_body_8792981788591 - lw $t0, 536($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_body_8792981788591 + # Argument internal_65 + lw $t0, 564($sp) + sw $t0, 4($sp) # Storing internal_65 - # Jumping to foreach_ancestor_end_8792981788591 - j foreach_ancestor_end_8792981788591 + # Argument internal_64 + lw $t0, 568($sp) + sw $t0, 0($sp) # Storing internal_64 - foreach_ancestor_body_8792981788591: + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 564($sp) # internal_65 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + update_min_end_8781702296263: - # Equal operation - lw $t0, 544($sp) # Save in $t0 the left operand address - lw $t1, 532($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - lw $t0, 528($sp) # $t0 = internal_59 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Argument internal_64 + lw $t0, 568($sp) + sw $t0, 4($sp) # Storing internal_64 - # If internal_59 then goto foreach_ancestor_end_8792981788591 - lw $t0, 528($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_end_8792981788591 + # Argument internal_39 + lw $t0, 668($sp) + sw $t0, 0($sp) # Storing internal_39 - # Addition operation - lw $t0, 540($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_ancestor_start_8792981788591 - j foreach_ancestor_start_8792981788591 + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 568($sp) # internal_64 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - foreach_ancestor_end_8792981788591: + # Jumping to foreach_min_start_8781702296263 + j foreach_min_start_8781702296263 + foreach_min_end_8781702296263: + # initialize Array [internal_40] + lw $t0, 652($sp) # $t0 = internal_40 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 528($sp) # internal_71 = new Array[internal_40] + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 524($sp) # internal_72 = address of allocated object Int + + # array internal_71[4 * internal_72] = internal_38 + lw $t0, 524($sp) # $t0 = internal_72 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 528($sp) # $t1 = internal_71 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 660($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # Addition operation - lw $t0, 552($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_type_start_8792981788591 - j foreach_type_start_8792981788591 + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - foreach_type_end_8792981788591: + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 520($sp) # internal_73 = address of allocated object Int + + # array internal_71[4 * internal_73] = internal_38 + lw $t0, 520($sp) # $t0 = internal_73 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 528($sp) # $t1 = internal_71 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 660($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 516($sp) # internal_74 = address of allocated object Int + + # array internal_71[4 * internal_74] = internal_38 + lw $t0, 516($sp) # $t0 = internal_74 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 528($sp) # $t1 = internal_71 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 660($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 512($sp) # internal_75 = address of allocated object Int + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_67 + lw $t0, 556($sp) + sw $t0, 4($sp) # Storing internal_67 - lw $t0, 608($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 512($sp) - j end_assign - not_is_Bool_or_Int: - # internal_63 = internal_39 - lw $t0, 608($sp) - sw $t0, 512($sp) - end_assign: + # Argument internal_42 + lw $t0, 656($sp) + sw $t0, 0($sp) # Storing internal_42 - foreach_min_start_8792981788591: + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 524($sp) # internal_75 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments - # Less than operation - lw $t0, 524($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # If internal_64 then goto foreach_min_body_8792981788591 - lw $t0, 508($sp) # Loading the address of the condition + # If internal_75 then goto error_branch_8781702296263 + lw $t0, 512($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_min_body_8792981788591 - - # Jumping to foreach_min_end_8792981788591 - j foreach_min_end_8792981788591 - - foreach_min_body_8792981788591: + beq $t0, $t1, error_branch_8781702296263 + + # array internal_71[4 * internal_65] = internal_39 + lw $t0, 552($sp) # $t0 = internal_65 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 528($sp) # $t1 = internal_71 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 656($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Less than operation - lw $t0, 516($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 512($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 508($sp) # internal_76 = address of allocated object Int - lw $t0, 508($sp) # $t0 = internal_64 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # If internal_64 then goto update_min_8792981788591 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 504($sp) # internal_77 = address of allocated object Int + + # internal_76 = array internal_71[4 * internal_77] + lw $t0, 504($sp) # $t0 = internal_77 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 528($sp) # $t1 = internal_71 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 508($sp) # internal_76 = array internal_71[4 * internal_77] + sw $t0, 8($t2) + + # If internal_76 then goto branch_C_8781702296263 lw $t0, 508($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, update_min_8792981788591 - - # Jumping to foreach_min_end_8792981788591 - j foreach_min_end_8792981788591 - - update_min_8792981788591: - - lw $t0, 516($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 512($sp) - j end_assign - not_is_Bool_or_Int: - # internal_63 = internal_62 - lw $t0, 516($sp) - sw $t0, 512($sp) - end_assign: - - lw $t0, 524($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 520($sp) - j end_assign - not_is_Bool_or_Int: - # internal_61 = internal_60 - lw $t0, 524($sp) - sw $t0, 520($sp) - end_assign: - - update_min_end_8792981788591: - - # Addition operation - lw $t0, 524($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_min_start_8792981788591 - j foreach_min_start_8792981788591 - - foreach_min_end_8792981788591: - - + beq $t0, $t1, branch_C_8781702296263 + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - - - - - # Equal operation - lw $t0, 520($sp) # Save in $t0 the left operand address - lw $t1, 608($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 - - lw $t0, 500($sp) # $t0 = internal_66 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # If internal_66 then goto error_branch_8792981788591 - lw $t0, 500($sp) # Loading the address of the condition + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 500($sp) # internal_78 = address of allocated object Int + + # internal_76 = array internal_71[4 * internal_78] + lw $t0, 500($sp) # $t0 = internal_78 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 528($sp) # $t1 = internal_71 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 508($sp) # internal_76 = array internal_71[4 * internal_78] + sw $t0, 8($t2) + + # If internal_76 then goto branch_A_8781702296263 + lw $t0, 508($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, error_branch_8792981788591 - + beq $t0, $t1, branch_A_8781702296263 + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # If internal_67 then goto branch_C_8792981788591 - lw $t0, 496($sp) # Loading the address of the condition + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 496($sp) # internal_79 = address of allocated object Int + + # internal_76 = array internal_71[4 * internal_79] + lw $t0, 496($sp) # $t0 = internal_79 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 528($sp) # $t1 = internal_71 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 508($sp) # internal_76 = array internal_71[4 * internal_79] + sw $t0, 8($t2) + + # If internal_76 then goto branch_Object_8781702296263 + lw $t0, 508($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_C_8792981788591 + beq $t0, $t1, branch_Object_8781702296263 + branch_C_8781702296263: - # If internal_67 then goto branch_A_8792981788591 - lw $t0, 496($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_A_8792981788591 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument c + lw $t0, 500($sp) + sw $t0, 4($sp) # Storing c - # If internal_67 then goto branch_Object_8792981788591 - lw $t0, 496($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Object_8792981788591 + # Argument internal_37 + lw $t0, 676($sp) + sw $t0, 0($sp) # Storing internal_37 - branch_C_8792981788591: + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 500($sp) # c = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments @@ -12438,7 +14519,7 @@ # Calling function function_value_at_A jal function_value_at_A lw $ra, 4($sp) - sw $v1, 492($sp) # internal_70 = result of function_value_at_A + sw $v1, 492($sp) # internal_82 = result of function_value_at_A addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments @@ -12449,42 +14530,97 @@ lw $t0, 500($sp) sw $t0, 4($sp) # Storing c - # Argument internal_70 + # Argument internal_82 lw $t0, 496($sp) - sw $t0, 0($sp) # Storing internal_70 + sw $t0, 0($sp) # Storing internal_82 # Calling function function_method6_at_C jal function_method6_at_C lw $ra, 8($sp) - sw $v1, 492($sp) # internal_71 = result of function_method6_at_C + sw $v1, 492($sp) # internal_83 = result of function_method6_at_C addi $sp, $sp, 12 # Freeing space for arguments # Set attribute avar of self - lw $t0, 768($sp) # $t0 = self - lw $t1, 480($sp) # $t1 = internal_71 - sw $t1, 12($t0) # self.avar = internal_71 + lw $t0, 816($sp) # $t0 = self + lw $t1, 480($sp) # $t1 = internal_83 + beq $t1, $zero, object_set_attribute_8781702258321 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8781702258321 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8781702258321 + j object_set_attribute_8781702258321 + int_set_attribute_8781702258321: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_83 + j end_set_attribute_8781702258321 + bool_set_attribute_8781702258321: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_83 + j end_set_attribute_8781702258321 + object_set_attribute_8781702258321: + sw $t1, 12($t0) # self.avar = internal_83 + end_set_attribute_8781702258321: - lw $t0, 480($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 492($sp) - j end_assign - not_is_Bool_or_Int: - # internal_68 = internal_71 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_80 + lw $t0, 504($sp) + sw $t0, 4($sp) # Storing internal_80 + + # Argument internal_83 + lw $t0, 492($sp) + sw $t0, 0($sp) # Storing internal_83 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 504($sp) # internal_80 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_80 = internal_83 lw $t0, 480($sp) sw $t0, 492($sp) - end_assign: - # Jumping to branch_end_8792981788591 - j branch_end_8792981788591 + # Jumping to branch_end_8781702296263 + j branch_end_8781702296263 + + branch_A_8781702296263: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument a + lw $t0, 488($sp) + sw $t0, 4($sp) # Storing a + + # Argument internal_37 + lw $t0, 676($sp) + sw $t0, 0($sp) # Storing internal_37 - branch_A_8792981788591: + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 488($sp) # a = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments @@ -12497,7 +14633,7 @@ # Calling function function_value_at_A jal function_value_at_A lw $ra, 4($sp) - sw $v1, 480($sp) # internal_73 = result of function_value_at_A + sw $v1, 480($sp) # internal_85 = result of function_value_at_A addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments @@ -12508,42 +14644,97 @@ lw $t0, 488($sp) sw $t0, 4($sp) # Storing a - # Argument internal_73 + # Argument internal_85 lw $t0, 484($sp) - sw $t0, 0($sp) # Storing internal_73 + sw $t0, 0($sp) # Storing internal_85 # Calling function function_method3_at_A jal function_method3_at_A lw $ra, 8($sp) - sw $v1, 480($sp) # internal_74 = result of function_method3_at_A + sw $v1, 480($sp) # internal_86 = result of function_method3_at_A addi $sp, $sp, 12 # Freeing space for arguments # Set attribute avar of self - lw $t0, 768($sp) # $t0 = self - lw $t1, 468($sp) # $t1 = internal_74 - sw $t1, 12($t0) # self.avar = internal_74 + lw $t0, 816($sp) # $t0 = self + lw $t1, 468($sp) # $t1 = internal_86 + beq $t1, $zero, object_set_attribute_8781702258698 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8781702258698 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8781702258698 + j object_set_attribute_8781702258698 + int_set_attribute_8781702258698: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_86 + j end_set_attribute_8781702258698 + bool_set_attribute_8781702258698: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_86 + j end_set_attribute_8781702258698 + object_set_attribute_8781702258698: + sw $t1, 12($t0) # self.avar = internal_86 + end_set_attribute_8781702258698: - lw $t0, 468($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 492($sp) - j end_assign - not_is_Bool_or_Int: - # internal_68 = internal_74 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_80 + lw $t0, 504($sp) + sw $t0, 4($sp) # Storing internal_80 + + # Argument internal_86 + lw $t0, 480($sp) + sw $t0, 0($sp) # Storing internal_86 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 504($sp) # internal_80 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_80 = internal_86 lw $t0, 468($sp) sw $t0, 492($sp) - end_assign: - # Jumping to branch_end_8792981788591 - j branch_end_8792981788591 + # Jumping to branch_end_8781702296263 + j branch_end_8781702296263 + + branch_Object_8781702296263: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument o + lw $t0, 476($sp) + sw $t0, 4($sp) # Storing o + + # Argument internal_37 + lw $t0, 676($sp) + sw $t0, 0($sp) # Storing internal_37 - branch_Object_8792981788591: + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 476($sp) # o = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating String li $v0, 9 @@ -12553,50 +14744,50 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 7 + addi $t0, $zero, 16 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 79 - sb $t0, 8($v0) # internal_76[0] = 'O' + sb $t0, 8($v0) # internal_88[0] = 'O' addi $t0, $zero, 111 - sb $t0, 9($v0) # internal_76[1] = 'o' + sb $t0, 9($v0) # internal_88[1] = 'o' addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_76[2] = 'o' + sb $t0, 10($v0) # internal_88[2] = 'o' addi $t0, $zero, 111 - sb $t0, 11($v0) # internal_76[3] = 'o' + sb $t0, 11($v0) # internal_88[3] = 'o' addi $t0, $zero, 112 - sb $t0, 12($v0) # internal_76[4] = 'p' + sb $t0, 12($v0) # internal_88[4] = 'p' addi $t0, $zero, 115 - sb $t0, 13($v0) # internal_76[5] = 's' + sb $t0, 13($v0) # internal_88[5] = 's' addi $t0, $zero, 10 - sb $t0, 14($v0) # internal_76[6] = '\n' + sb $t0, 14($v0) # internal_88[6] = '\n' sb $zero, 15($v0) # Null-terminator at the end of the string - sw $v0, 460($sp) # internal_76 = "Oooops\n" + sw $v0, 460($sp) # internal_88 = "Oooops\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 780($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_76 + # Argument internal_88 lw $t0, 472($sp) - sw $t0, 0($sp) # Storing internal_76 + sw $t0, 0($sp) # Storing internal_88 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 468($sp) # internal_77 = result of function_out_string_at_IO + sw $v1, 468($sp) # internal_89 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -12604,13 +14795,13 @@ sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 776($sp) + lw $t0, 824($sp) sw $t0, 0($sp) # Storing self # Calling function function_abort_at_Object jal function_abort_at_Object lw $ra, 4($sp) - sw $v1, 460($sp) # internal_78 = result of function_abort_at_Object + sw $v1, 460($sp) # internal_90 = result of function_abort_at_Object addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 0 @@ -12623,55 +14814,45 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 448($sp) # internal_79 = address of allocated object Int + sw $v0, 448($sp) # internal_91 = address of allocated object Int - lw $t0, 448($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 492($sp) - j end_assign - not_is_Bool_or_Int: - # internal_68 = internal_79 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_80 + lw $t0, 504($sp) + sw $t0, 4($sp) # Storing internal_80 + + # Argument internal_91 + lw $t0, 460($sp) + sw $t0, 0($sp) # Storing internal_91 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 504($sp) # internal_80 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_80 = internal_91 lw $t0, 448($sp) sw $t0, 492($sp) - end_assign: - # Jumping to branch_end_8792981788591 - j branch_end_8792981788591 + # Jumping to branch_end_8781702296263 + j branch_end_8781702296263 - error_branch_8792981788591: + error_branch_8781702296263: + branch_end_8781702296263: - branch_end_8792981788591: - - lw $t0, 492($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 632($sp) - j end_assign - not_is_Bool_or_Int: - # internal_33 = internal_68 + # internal_32 = internal_80 lw $t0, 492($sp) - sw $t0, 632($sp) - end_assign: - - # Jumping to endif_8792981790275 - j endif_8792981790275 + sw $t0, 684($sp) - else_8792981790275: + # Jumping to endif_8781702298203 + j endif_8781702298203 + else_8781702298203: # Allocating Bool 0 li $v0, 9 @@ -12683,12 +14864,43 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 440($sp) # internal_81 = address of allocated object Int + sw $v0, 440($sp) # internal_93 = address of allocated object Int # Get attribute char of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'char' from the instance - sw $t1, 436($sp) # internal_82 = char + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702259493 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702259493 + j object_get_attribute_8781702259493 + int_get_attribute_8781702259493: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 436($sp) # internal_94 = self.char + j end_get_attribute_8781702259493 + bool_get_attribute_8781702259493: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 436($sp) # internal_94 = self.char + j end_get_attribute_8781702259493 + object_get_attribute_8781702259493: + sw $t1, 436($sp) # internal_94 = char + end_get_attribute_8781702259493: # Allocating String li $v0, 9 @@ -12698,61 +14910,48 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 99 - sb $t0, 8($v0) # internal_83[0] = 'c' + sb $t0, 8($v0) # internal_95[0] = 'c' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 432($sp) # internal_83 = "c" + sw $v0, 432($sp) # internal_95 = "c" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_82 + # Argument internal_94 lw $t0, 448($sp) - sw $t0, 4($sp) # Storing internal_82 + sw $t0, 4($sp) # Storing internal_94 - # Argument internal_83 + # Argument internal_95 lw $t0, 444($sp) - sw $t0, 0($sp) # Storing internal_83 + sw $t0, 0($sp) # Storing internal_95 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 440($sp) # internal_84 = result of function_equal + sw $v1, 440($sp) # internal_96 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 428($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 440($sp) - j end_assign - not_is_Bool_or_Int: - # internal_81 = internal_84 + # internal_93 = internal_96 lw $t0, 428($sp) sw $t0, 440($sp) - end_assign: - # If internal_81 then goto then_8792981790269 + # If internal_93 then goto then_8781702298197 lw $t0, 440($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981790269 + beq $t0, $t1, then_8781702298197 - # Jumping to else_8792981790269 - j else_8792981790269 + # Jumping to else_8781702298197 + j else_8781702298197 - then_8792981790269: + then_8781702298197: # Allocating A li $v0, 9 @@ -12761,20 +14960,20 @@ la $t0, type_A # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 424($sp) # internal_85 = address of allocated object A + sw $v0, 424($sp) # internal_97 = address of allocated object A # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_85 + # Argument internal_97 lw $t0, 432($sp) - sw $t0, 0($sp) # Storing internal_85 + sw $t0, 0($sp) # Storing internal_97 # Calling function function___init___at_A jal function___init___at_A lw $ra, 4($sp) - sw $v1, 432($sp) # internal_85 = result of function___init___at_A + sw $v1, 432($sp) # internal_97 = result of function___init___at_A addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments @@ -12782,37 +14981,69 @@ sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 776($sp) + lw $t0, 824($sp) sw $t0, 0($sp) # Storing self # Calling function function_get_int_at_Main jal function_get_int_at_Main lw $ra, 4($sp) - sw $v1, 428($sp) # internal_86 = result of function_get_int_at_Main + sw $v1, 428($sp) # internal_98 = result of function_get_int_at_Main addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_85 + # Argument internal_97 lw $t0, 436($sp) - sw $t0, 4($sp) # Storing internal_85 + sw $t0, 4($sp) # Storing internal_97 - # Argument internal_86 + # Argument internal_98 lw $t0, 432($sp) - sw $t0, 0($sp) # Storing internal_86 + sw $t0, 0($sp) # Storing internal_98 # Calling function function_set_var_at_A jal function_set_var_at_A lw $ra, 8($sp) - sw $v1, 428($sp) # internal_87 = result of function_set_var_at_A + sw $v1, 428($sp) # internal_99 = result of function_set_var_at_A addi $sp, $sp, 12 # Freeing space for arguments # Set attribute a_var of self - lw $t0, 768($sp) # $t0 = self - lw $t1, 416($sp) # $t1 = internal_87 - sw $t1, 16($t0) # self.a_var = internal_87 + lw $t0, 816($sp) # $t0 = self + lw $t1, 416($sp) # $t1 = internal_99 + beq $t1, $zero, object_set_attribute_8781702259574 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8781702259574 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8781702259574 + j object_set_attribute_8781702259574 + int_set_attribute_8781702259574: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.a_var = internal_99 + j end_set_attribute_8781702259574 + bool_set_attribute_8781702259574: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.a_var = internal_99 + j end_set_attribute_8781702259574 + object_set_attribute_8781702259574: + sw $t1, 16($t0) # self.a_var = internal_99 + end_set_attribute_8781702259574: # Allocating D li $v0, 9 @@ -12821,109 +15052,189 @@ la $t0, type_D # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 412($sp) # internal_88 = address of allocated object D + sw $v0, 412($sp) # internal_100 = address of allocated object D # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_88 + # Argument internal_100 lw $t0, 420($sp) - sw $t0, 0($sp) # Storing internal_88 + sw $t0, 0($sp) # Storing internal_100 # Calling function function___init___at_D jal function___init___at_D lw $ra, 4($sp) - sw $v1, 420($sp) # internal_88 = result of function___init___at_D + sw $v1, 420($sp) # internal_100 = result of function___init___at_D addi $sp, $sp, 8 # Freeing space for arguments # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 408($sp) # internal_89 = avar + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702259716 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702259716 + j object_get_attribute_8781702259716 + int_get_attribute_8781702259716: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 408($sp) # internal_101 = self.avar + j end_get_attribute_8781702259716 + bool_get_attribute_8781702259716: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 408($sp) # internal_101 = self.avar + j end_get_attribute_8781702259716 + object_get_attribute_8781702259716: + sw $t1, 408($sp) # internal_101 = avar + end_get_attribute_8781702259716: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_89 + # Argument internal_101 lw $t0, 416($sp) - sw $t0, 0($sp) # Storing internal_89 + sw $t0, 0($sp) # Storing internal_101 # Calling function function_value_at_A jal function_value_at_A lw $ra, 4($sp) - sw $v1, 412($sp) # internal_90 = result of function_value_at_A + sw $v1, 412($sp) # internal_102 = result of function_value_at_A addi $sp, $sp, 8 # Freeing space for arguments # Get attribute a_var of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 16($t0) # Get the attribute 'a_var' from the instance - sw $t1, 400($sp) # internal_91 = a_var + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702259746 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702259746 + j object_get_attribute_8781702259746 + int_get_attribute_8781702259746: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 400($sp) # internal_103 = self.a_var + j end_get_attribute_8781702259746 + bool_get_attribute_8781702259746: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 400($sp) # internal_103 = self.a_var + j end_get_attribute_8781702259746 + object_get_attribute_8781702259746: + sw $t1, 400($sp) # internal_103 = a_var + end_get_attribute_8781702259746: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_91 + # Argument internal_103 lw $t0, 408($sp) - sw $t0, 0($sp) # Storing internal_91 + sw $t0, 0($sp) # Storing internal_103 # Calling function function_value_at_A jal function_value_at_A lw $ra, 4($sp) - sw $v1, 404($sp) # internal_92 = result of function_value_at_A + sw $v1, 404($sp) # internal_104 = result of function_value_at_A addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address - # Argument internal_88 + # Argument internal_100 lw $t0, 428($sp) - sw $t0, 8($sp) # Storing internal_88 + sw $t0, 8($sp) # Storing internal_100 - # Argument internal_90 + # Argument internal_102 lw $t0, 420($sp) - sw $t0, 4($sp) # Storing internal_90 + sw $t0, 4($sp) # Storing internal_102 - # Argument internal_92 + # Argument internal_104 lw $t0, 412($sp) - sw $t0, 0($sp) # Storing internal_92 + sw $t0, 0($sp) # Storing internal_104 # Calling function function_method4_at_A jal function_method4_at_A lw $ra, 12($sp) - sw $v1, 408($sp) # internal_93 = result of function_method4_at_A + sw $v1, 408($sp) # internal_105 = result of function_method4_at_A addi $sp, $sp, 16 # Freeing space for arguments # Set attribute avar of self - lw $t0, 768($sp) # $t0 = self - lw $t1, 392($sp) # $t1 = internal_93 - sw $t1, 12($t0) # self.avar = internal_93 - - lw $t0, 392($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 444($sp) - j end_assign - not_is_Bool_or_Int: - # internal_80 = internal_93 + lw $t0, 816($sp) # $t0 = self + lw $t1, 392($sp) # $t1 = internal_105 + beq $t1, $zero, object_set_attribute_8781702259649 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8781702259649 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8781702259649 + j object_set_attribute_8781702259649 + int_set_attribute_8781702259649: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_105 + j end_set_attribute_8781702259649 + bool_set_attribute_8781702259649: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_105 + j end_set_attribute_8781702259649 + object_set_attribute_8781702259649: + sw $t1, 12($t0) # self.avar = internal_105 + end_set_attribute_8781702259649: + + # internal_92 = internal_105 lw $t0, 392($sp) sw $t0, 444($sp) - end_assign: - # Jumping to endif_8792981790269 - j endif_8792981790269 - - else_8792981790269: + # Jumping to endif_8781702298197 + j endif_8781702298197 + else_8781702298197: # Allocating Bool 0 li $v0, 9 @@ -12935,12 +15246,43 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 384($sp) # internal_95 = address of allocated object Int + sw $v0, 384($sp) # internal_107 = address of allocated object Int # Get attribute char of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'char' from the instance - sw $t1, 380($sp) # internal_96 = char + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702259830 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702259830 + j object_get_attribute_8781702259830 + int_get_attribute_8781702259830: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 380($sp) # internal_108 = self.char + j end_get_attribute_8781702259830 + bool_get_attribute_8781702259830: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 380($sp) # internal_108 = self.char + j end_get_attribute_8781702259830 + object_get_attribute_8781702259830: + sw $t1, 380($sp) # internal_108 = char + end_get_attribute_8781702259830: # Allocating String li $v0, 9 @@ -12950,61 +15292,48 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 100 - sb $t0, 8($v0) # internal_97[0] = 'd' + sb $t0, 8($v0) # internal_109[0] = 'd' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 376($sp) # internal_97 = "d" + sw $v0, 376($sp) # internal_109 = "d" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_96 + # Argument internal_108 lw $t0, 392($sp) - sw $t0, 4($sp) # Storing internal_96 + sw $t0, 4($sp) # Storing internal_108 - # Argument internal_97 + # Argument internal_109 lw $t0, 388($sp) - sw $t0, 0($sp) # Storing internal_97 + sw $t0, 0($sp) # Storing internal_109 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 384($sp) # internal_98 = result of function_equal + sw $v1, 384($sp) # internal_110 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 372($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 384($sp) - j end_assign - not_is_Bool_or_Int: - # internal_95 = internal_98 + # internal_107 = internal_110 lw $t0, 372($sp) sw $t0, 384($sp) - end_assign: - # If internal_95 then goto then_8792981790263 + # If internal_107 then goto then_8781702298191 lw $t0, 384($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981790263 + beq $t0, $t1, then_8781702298191 - # Jumping to else_8792981790263 - j else_8792981790263 + # Jumping to else_8781702298191 + j else_8781702298191 - then_8792981790263: + then_8781702298191: # Allocating C li $v0, 9 @@ -13013,86 +15342,135 @@ la $t0, type_C # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 368($sp) # internal_99 = address of allocated object C + sw $v0, 368($sp) # internal_111 = address of allocated object C # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_99 + # Argument internal_111 lw $t0, 376($sp) - sw $t0, 0($sp) # Storing internal_99 + sw $t0, 0($sp) # Storing internal_111 # Calling function function___init___at_C jal function___init___at_C lw $ra, 4($sp) - sw $v1, 376($sp) # internal_99 = result of function___init___at_C + sw $v1, 376($sp) # internal_111 = result of function___init___at_C addi $sp, $sp, 8 # Freeing space for arguments # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 364($sp) # internal_100 = avar + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702259959 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702259959 + j object_get_attribute_8781702259959 + int_get_attribute_8781702259959: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 364($sp) # internal_112 = self.avar + j end_get_attribute_8781702259959 + bool_get_attribute_8781702259959: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 364($sp) # internal_112 = self.avar + j end_get_attribute_8781702259959 + object_get_attribute_8781702259959: + sw $t1, 364($sp) # internal_112 = avar + end_get_attribute_8781702259959: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_100 + # Argument internal_112 lw $t0, 372($sp) - sw $t0, 0($sp) # Storing internal_100 + sw $t0, 0($sp) # Storing internal_112 # Calling function function_value_at_A jal function_value_at_A lw $ra, 4($sp) - sw $v1, 368($sp) # internal_101 = result of function_value_at_A + sw $v1, 368($sp) # internal_113 = result of function_value_at_A addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_99 + # Argument internal_111 lw $t0, 380($sp) - sw $t0, 4($sp) # Storing internal_99 + sw $t0, 4($sp) # Storing internal_111 - # Argument internal_101 + # Argument internal_113 lw $t0, 372($sp) - sw $t0, 0($sp) # Storing internal_101 + sw $t0, 0($sp) # Storing internal_113 # Calling function function_method5_at_C jal function_method5_at_C lw $ra, 8($sp) - sw $v1, 368($sp) # internal_102 = result of function_method5_at_C + sw $v1, 368($sp) # internal_114 = result of function_method5_at_C addi $sp, $sp, 12 # Freeing space for arguments # Set attribute avar of self - lw $t0, 768($sp) # $t0 = self - lw $t1, 356($sp) # $t1 = internal_102 - sw $t1, 12($t0) # self.avar = internal_102 - - lw $t0, 356($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 388($sp) - j end_assign - not_is_Bool_or_Int: - # internal_94 = internal_102 + lw $t0, 816($sp) # $t0 = self + lw $t1, 356($sp) # $t1 = internal_114 + beq $t1, $zero, object_set_attribute_8781702259896 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8781702259896 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8781702259896 + j object_set_attribute_8781702259896 + int_set_attribute_8781702259896: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_114 + j end_set_attribute_8781702259896 + bool_set_attribute_8781702259896: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_114 + j end_set_attribute_8781702259896 + object_set_attribute_8781702259896: + sw $t1, 12($t0) # self.avar = internal_114 + end_set_attribute_8781702259896: + + # internal_106 = internal_114 lw $t0, 356($sp) sw $t0, 388($sp) - end_assign: - # Jumping to endif_8792981790263 - j endif_8792981790263 - - else_8792981790263: + # Jumping to endif_8781702298191 + j endif_8781702298191 + else_8781702298191: # Allocating Bool 0 li $v0, 9 @@ -13104,12 +15482,43 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 348($sp) # internal_104 = address of allocated object Int + sw $v0, 348($sp) # internal_116 = address of allocated object Int # Get attribute char of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'char' from the instance - sw $t1, 344($sp) # internal_105 = char + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702260312 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702260312 + j object_get_attribute_8781702260312 + int_get_attribute_8781702260312: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 344($sp) # internal_117 = self.char + j end_get_attribute_8781702260312 + bool_get_attribute_8781702260312: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 344($sp) # internal_117 = self.char + j end_get_attribute_8781702260312 + object_get_attribute_8781702260312: + sw $t1, 344($sp) # internal_117 = char + end_get_attribute_8781702260312: # Allocating String li $v0, 9 @@ -13119,61 +15528,48 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 101 - sb $t0, 8($v0) # internal_106[0] = 'e' + sb $t0, 8($v0) # internal_118[0] = 'e' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 340($sp) # internal_106 = "e" + sw $v0, 340($sp) # internal_118 = "e" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_105 + # Argument internal_117 lw $t0, 356($sp) - sw $t0, 4($sp) # Storing internal_105 + sw $t0, 4($sp) # Storing internal_117 - # Argument internal_106 + # Argument internal_118 lw $t0, 352($sp) - sw $t0, 0($sp) # Storing internal_106 + sw $t0, 0($sp) # Storing internal_118 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 348($sp) # internal_107 = result of function_equal + sw $v1, 348($sp) # internal_119 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 336($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 348($sp) - j end_assign - not_is_Bool_or_Int: - # internal_104 = internal_107 + # internal_116 = internal_119 lw $t0, 336($sp) sw $t0, 348($sp) - end_assign: - # If internal_104 then goto then_8792981790257 + # If internal_116 then goto then_8781702298185 lw $t0, 348($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981790257 + beq $t0, $t1, then_8781702298185 - # Jumping to else_8792981790257 - j else_8792981790257 + # Jumping to else_8781702298185 + j else_8781702298185 - then_8792981790257: + then_8781702298185: # Allocating C li $v0, 9 @@ -13182,86 +15578,135 @@ la $t0, type_C # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 332($sp) # internal_108 = address of allocated object C + sw $v0, 332($sp) # internal_120 = address of allocated object C # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_108 + # Argument internal_120 lw $t0, 340($sp) - sw $t0, 0($sp) # Storing internal_108 + sw $t0, 0($sp) # Storing internal_120 # Calling function function___init___at_C jal function___init___at_C lw $ra, 4($sp) - sw $v1, 340($sp) # internal_108 = result of function___init___at_C + sw $v1, 340($sp) # internal_120 = result of function___init___at_C addi $sp, $sp, 8 # Freeing space for arguments # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 328($sp) # internal_109 = avar + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702260441 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702260441 + j object_get_attribute_8781702260441 + int_get_attribute_8781702260441: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 328($sp) # internal_121 = self.avar + j end_get_attribute_8781702260441 + bool_get_attribute_8781702260441: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 328($sp) # internal_121 = self.avar + j end_get_attribute_8781702260441 + object_get_attribute_8781702260441: + sw $t1, 328($sp) # internal_121 = avar + end_get_attribute_8781702260441: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_109 + # Argument internal_121 lw $t0, 336($sp) - sw $t0, 0($sp) # Storing internal_109 + sw $t0, 0($sp) # Storing internal_121 # Calling function function_value_at_A jal function_value_at_A lw $ra, 4($sp) - sw $v1, 332($sp) # internal_110 = result of function_value_at_A + sw $v1, 332($sp) # internal_122 = result of function_value_at_A addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_108 + # Argument internal_120 lw $t0, 344($sp) - sw $t0, 4($sp) # Storing internal_108 + sw $t0, 4($sp) # Storing internal_120 - # Argument internal_110 + # Argument internal_122 lw $t0, 336($sp) - sw $t0, 0($sp) # Storing internal_110 + sw $t0, 0($sp) # Storing internal_122 # Calling function function_method5_at_C jal function_method5_at_C lw $ra, 8($sp) - sw $v1, 332($sp) # internal_111 = result of function_method5_at_C + sw $v1, 332($sp) # internal_123 = result of function_method5_at_C addi $sp, $sp, 12 # Freeing space for arguments # Set attribute avar of self - lw $t0, 768($sp) # $t0 = self - lw $t1, 320($sp) # $t1 = internal_111 - sw $t1, 12($t0) # self.avar = internal_111 - - lw $t0, 320($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 352($sp) - j end_assign - not_is_Bool_or_Int: - # internal_103 = internal_111 + lw $t0, 816($sp) # $t0 = self + lw $t1, 320($sp) # $t1 = internal_123 + beq $t1, $zero, object_set_attribute_8781702260378 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8781702260378 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8781702260378 + j object_set_attribute_8781702260378 + int_set_attribute_8781702260378: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_123 + j end_set_attribute_8781702260378 + bool_set_attribute_8781702260378: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_123 + j end_set_attribute_8781702260378 + object_set_attribute_8781702260378: + sw $t1, 12($t0) # self.avar = internal_123 + end_set_attribute_8781702260378: + + # internal_115 = internal_123 lw $t0, 320($sp) sw $t0, 352($sp) - end_assign: - - # Jumping to endif_8792981790257 - j endif_8792981790257 - else_8792981790257: + # Jumping to endif_8781702298185 + j endif_8781702298185 + else_8781702298185: # Allocating Bool 0 li $v0, 9 @@ -13273,12 +15718,43 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 312($sp) # internal_113 = address of allocated object Int + sw $v0, 312($sp) # internal_125 = address of allocated object Int # Get attribute char of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'char' from the instance - sw $t1, 308($sp) # internal_114 = char + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702260794 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702260794 + j object_get_attribute_8781702260794 + int_get_attribute_8781702260794: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 308($sp) # internal_126 = self.char + j end_get_attribute_8781702260794 + bool_get_attribute_8781702260794: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 308($sp) # internal_126 = self.char + j end_get_attribute_8781702260794 + object_get_attribute_8781702260794: + sw $t1, 308($sp) # internal_126 = char + end_get_attribute_8781702260794: # Allocating String li $v0, 9 @@ -13288,61 +15764,48 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 102 - sb $t0, 8($v0) # internal_115[0] = 'f' + sb $t0, 8($v0) # internal_127[0] = 'f' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 304($sp) # internal_115 = "f" + sw $v0, 304($sp) # internal_127 = "f" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_114 + # Argument internal_126 lw $t0, 320($sp) - sw $t0, 4($sp) # Storing internal_114 + sw $t0, 4($sp) # Storing internal_126 - # Argument internal_115 + # Argument internal_127 lw $t0, 316($sp) - sw $t0, 0($sp) # Storing internal_115 + sw $t0, 0($sp) # Storing internal_127 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 312($sp) # internal_116 = result of function_equal + sw $v1, 312($sp) # internal_128 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 300($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 312($sp) - j end_assign - not_is_Bool_or_Int: - # internal_113 = internal_116 + # internal_125 = internal_128 lw $t0, 300($sp) sw $t0, 312($sp) - end_assign: - # If internal_113 then goto then_8792981790251 + # If internal_125 then goto then_8781702298179 lw $t0, 312($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981790251 + beq $t0, $t1, then_8781702298179 - # Jumping to else_8792981790251 - j else_8792981790251 + # Jumping to else_8781702298179 + j else_8781702298179 - then_8792981790251: + then_8781702298179: # Allocating C li $v0, 9 @@ -13351,86 +15814,135 @@ la $t0, type_C # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 296($sp) # internal_117 = address of allocated object C + sw $v0, 296($sp) # internal_129 = address of allocated object C # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_117 + # Argument internal_129 lw $t0, 304($sp) - sw $t0, 0($sp) # Storing internal_117 + sw $t0, 0($sp) # Storing internal_129 # Calling function function___init___at_C jal function___init___at_C lw $ra, 4($sp) - sw $v1, 304($sp) # internal_117 = result of function___init___at_C + sw $v1, 304($sp) # internal_129 = result of function___init___at_C addi $sp, $sp, 8 # Freeing space for arguments # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 292($sp) # internal_118 = avar + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702260923 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702260923 + j object_get_attribute_8781702260923 + int_get_attribute_8781702260923: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 292($sp) # internal_130 = self.avar + j end_get_attribute_8781702260923 + bool_get_attribute_8781702260923: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 292($sp) # internal_130 = self.avar + j end_get_attribute_8781702260923 + object_get_attribute_8781702260923: + sw $t1, 292($sp) # internal_130 = avar + end_get_attribute_8781702260923: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_118 + # Argument internal_130 lw $t0, 300($sp) - sw $t0, 0($sp) # Storing internal_118 + sw $t0, 0($sp) # Storing internal_130 # Calling function function_value_at_A jal function_value_at_A lw $ra, 4($sp) - sw $v1, 296($sp) # internal_119 = result of function_value_at_A + sw $v1, 296($sp) # internal_131 = result of function_value_at_A addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_117 + # Argument internal_129 lw $t0, 308($sp) - sw $t0, 4($sp) # Storing internal_117 + sw $t0, 4($sp) # Storing internal_129 - # Argument internal_119 + # Argument internal_131 lw $t0, 300($sp) - sw $t0, 0($sp) # Storing internal_119 + sw $t0, 0($sp) # Storing internal_131 # Calling function function_method5_at_C jal function_method5_at_C lw $ra, 8($sp) - sw $v1, 296($sp) # internal_120 = result of function_method5_at_C + sw $v1, 296($sp) # internal_132 = result of function_method5_at_C addi $sp, $sp, 12 # Freeing space for arguments # Set attribute avar of self - lw $t0, 768($sp) # $t0 = self - lw $t1, 284($sp) # $t1 = internal_120 - sw $t1, 12($t0) # self.avar = internal_120 - - lw $t0, 284($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 316($sp) - j end_assign - not_is_Bool_or_Int: - # internal_112 = internal_120 + lw $t0, 816($sp) # $t0 = self + lw $t1, 284($sp) # $t1 = internal_132 + beq $t1, $zero, object_set_attribute_8781702260860 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8781702260860 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8781702260860 + j object_set_attribute_8781702260860 + int_set_attribute_8781702260860: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_132 + j end_set_attribute_8781702260860 + bool_set_attribute_8781702260860: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_132 + j end_set_attribute_8781702260860 + object_set_attribute_8781702260860: + sw $t1, 12($t0) # self.avar = internal_132 + end_set_attribute_8781702260860: + + # internal_124 = internal_132 lw $t0, 284($sp) sw $t0, 316($sp) - end_assign: - - # Jumping to endif_8792981790251 - j endif_8792981790251 - else_8792981790251: + # Jumping to endif_8781702298179 + j endif_8781702298179 + else_8781702298179: # Allocating Bool 0 li $v0, 9 @@ -13442,12 +15954,43 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 276($sp) # internal_122 = address of allocated object Int + sw $v0, 276($sp) # internal_134 = address of allocated object Int # Get attribute char of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'char' from the instance - sw $t1, 272($sp) # internal_123 = char + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702261532 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702261532 + j object_get_attribute_8781702261532 + int_get_attribute_8781702261532: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 272($sp) # internal_135 = self.char + j end_get_attribute_8781702261532 + bool_get_attribute_8781702261532: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 272($sp) # internal_135 = self.char + j end_get_attribute_8781702261532 + object_get_attribute_8781702261532: + sw $t1, 272($sp) # internal_135 = char + end_get_attribute_8781702261532: # Allocating String li $v0, 9 @@ -13457,62 +16000,48 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 103 - sb $t0, 8($v0) # internal_124[0] = 'g' + sb $t0, 8($v0) # internal_136[0] = 'g' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 268($sp) # internal_124 = "g" + sw $v0, 268($sp) # internal_136 = "g" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_123 + # Argument internal_135 lw $t0, 284($sp) - sw $t0, 4($sp) # Storing internal_123 + sw $t0, 4($sp) # Storing internal_135 - # Argument internal_124 + # Argument internal_136 lw $t0, 280($sp) - sw $t0, 0($sp) # Storing internal_124 + sw $t0, 0($sp) # Storing internal_136 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 276($sp) # internal_125 = result of function_equal + sw $v1, 276($sp) # internal_137 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 264($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 276($sp) - j end_assign - not_is_Bool_or_Int: - # internal_122 = internal_125 + # internal_134 = internal_137 lw $t0, 264($sp) sw $t0, 276($sp) - end_assign: - # If internal_122 then goto then_8792981790245 + # If internal_134 then goto then_8781702298173 lw $t0, 276($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981790245 - - # Jumping to else_8792981790245 - j else_8792981790245 + beq $t0, $t1, then_8781702298173 - then_8792981790245: + # Jumping to else_8781702298173 + j else_8781702298173 + then_8781702298173: # Allocating Bool 0 li $v0, 9 @@ -13524,7 +16053,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 256($sp) # internal_127 = address of allocated object Int + sw $v0, 256($sp) # internal_139 = address of allocated object Int # Allocating D li $v0, 9 @@ -13533,86 +16062,104 @@ la $t0, type_D # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 252($sp) # internal_128 = address of allocated object D + sw $v0, 252($sp) # internal_140 = address of allocated object D # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_128 + # Argument internal_140 lw $t0, 260($sp) - sw $t0, 0($sp) # Storing internal_128 + sw $t0, 0($sp) # Storing internal_140 # Calling function function___init___at_D jal function___init___at_D lw $ra, 4($sp) - sw $v1, 260($sp) # internal_128 = result of function___init___at_D + sw $v1, 260($sp) # internal_140 = result of function___init___at_D addi $sp, $sp, 8 # Freeing space for arguments # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 248($sp) # internal_129 = avar + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702261685 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702261685 + j object_get_attribute_8781702261685 + int_get_attribute_8781702261685: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 248($sp) # internal_141 = self.avar + j end_get_attribute_8781702261685 + bool_get_attribute_8781702261685: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 248($sp) # internal_141 = self.avar + j end_get_attribute_8781702261685 + object_get_attribute_8781702261685: + sw $t1, 248($sp) # internal_141 = avar + end_get_attribute_8781702261685: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_129 + # Argument internal_141 lw $t0, 256($sp) - sw $t0, 0($sp) # Storing internal_129 + sw $t0, 0($sp) # Storing internal_141 # Calling function function_value_at_A jal function_value_at_A lw $ra, 4($sp) - sw $v1, 252($sp) # internal_130 = result of function_value_at_A + sw $v1, 252($sp) # internal_142 = result of function_value_at_A addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_128 + # Argument internal_140 lw $t0, 264($sp) - sw $t0, 4($sp) # Storing internal_128 + sw $t0, 4($sp) # Storing internal_140 - # Argument internal_130 + # Argument internal_142 lw $t0, 256($sp) - sw $t0, 0($sp) # Storing internal_130 + sw $t0, 0($sp) # Storing internal_142 # Calling function function_method7_at_D jal function_method7_at_D lw $ra, 8($sp) - sw $v1, 252($sp) # internal_131 = result of function_method7_at_D + sw $v1, 252($sp) # internal_143 = result of function_method7_at_D addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 240($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 256($sp) - j end_assign - not_is_Bool_or_Int: - # internal_127 = internal_131 + # internal_139 = internal_143 lw $t0, 240($sp) sw $t0, 256($sp) - end_assign: - # If internal_127 then goto then_8792981789148 + # If internal_139 then goto then_8781702296820 lw $t0, 256($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981789148 + beq $t0, $t1, then_8781702296820 - # Jumping to else_8792981789148 - j else_8792981789148 + # Jumping to else_8781702296820 + j else_8781702296820 - then_8792981789148: + then_8781702296820: # Allocating String li $v0, 9 @@ -13622,73 +16169,104 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 7 + addi $t0, $zero, 16 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 110 - sb $t0, 8($v0) # internal_132[0] = 'n' + sb $t0, 8($v0) # internal_144[0] = 'n' addi $t0, $zero, 117 - sb $t0, 9($v0) # internal_132[1] = 'u' + sb $t0, 9($v0) # internal_144[1] = 'u' addi $t0, $zero, 109 - sb $t0, 10($v0) # internal_132[2] = 'm' + sb $t0, 10($v0) # internal_144[2] = 'm' addi $t0, $zero, 98 - sb $t0, 11($v0) # internal_132[3] = 'b' + sb $t0, 11($v0) # internal_144[3] = 'b' addi $t0, $zero, 101 - sb $t0, 12($v0) # internal_132[4] = 'e' + sb $t0, 12($v0) # internal_144[4] = 'e' addi $t0, $zero, 114 - sb $t0, 13($v0) # internal_132[5] = 'r' + sb $t0, 13($v0) # internal_144[5] = 'r' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_132[6] = ' ' + sb $t0, 14($v0) # internal_144[6] = ' ' sb $zero, 15($v0) # Null-terminator at the end of the string - sw $v0, 236($sp) # internal_132 = "number " + sw $v0, 236($sp) # internal_144 = "number " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 780($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_132 + # Argument internal_144 lw $t0, 248($sp) - sw $t0, 0($sp) # Storing internal_132 + sw $t0, 0($sp) # Storing internal_144 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 244($sp) # internal_133 = result of function_out_string_at_IO + sw $v1, 244($sp) # internal_145 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 228($sp) # internal_134 = avar + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702229553 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702229553 + j object_get_attribute_8781702229553 + int_get_attribute_8781702229553: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 228($sp) # internal_146 = self.avar + j end_get_attribute_8781702229553 + bool_get_attribute_8781702229553: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 228($sp) # internal_146 = self.avar + j end_get_attribute_8781702229553 + object_get_attribute_8781702229553: + sw $t1, 228($sp) # internal_146 = avar + end_get_attribute_8781702229553: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 780($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_134 + # Argument internal_146 lw $t0, 240($sp) - sw $t0, 0($sp) # Storing internal_134 + sw $t0, 0($sp) # Storing internal_146 # Calling function function_print_at_Main jal function_print_at_Main lw $ra, 8($sp) - sw $v1, 236($sp) # internal_135 = result of function_print_at_Main + sw $v1, 236($sp) # internal_147 = result of function_print_at_Main addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -13699,109 +16277,96 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 19 + addi $t0, $zero, 28 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 105 - sb $t0, 8($v0) # internal_136[0] = 'i' + sb $t0, 8($v0) # internal_148[0] = 'i' addi $t0, $zero, 115 - sb $t0, 9($v0) # internal_136[1] = 's' + sb $t0, 9($v0) # internal_148[1] = 's' addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_136[2] = ' ' + sb $t0, 10($v0) # internal_148[2] = ' ' addi $t0, $zero, 100 - sb $t0, 11($v0) # internal_136[3] = 'd' + sb $t0, 11($v0) # internal_148[3] = 'd' addi $t0, $zero, 105 - sb $t0, 12($v0) # internal_136[4] = 'i' + sb $t0, 12($v0) # internal_148[4] = 'i' addi $t0, $zero, 118 - sb $t0, 13($v0) # internal_136[5] = 'v' + sb $t0, 13($v0) # internal_148[5] = 'v' addi $t0, $zero, 105 - sb $t0, 14($v0) # internal_136[6] = 'i' + sb $t0, 14($v0) # internal_148[6] = 'i' addi $t0, $zero, 115 - sb $t0, 15($v0) # internal_136[7] = 's' + sb $t0, 15($v0) # internal_148[7] = 's' addi $t0, $zero, 105 - sb $t0, 16($v0) # internal_136[8] = 'i' + sb $t0, 16($v0) # internal_148[8] = 'i' addi $t0, $zero, 98 - sb $t0, 17($v0) # internal_136[9] = 'b' + sb $t0, 17($v0) # internal_148[9] = 'b' addi $t0, $zero, 108 - sb $t0, 18($v0) # internal_136[10] = 'l' + sb $t0, 18($v0) # internal_148[10] = 'l' addi $t0, $zero, 101 - sb $t0, 19($v0) # internal_136[11] = 'e' + sb $t0, 19($v0) # internal_148[11] = 'e' addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_136[12] = ' ' + sb $t0, 20($v0) # internal_148[12] = ' ' addi $t0, $zero, 98 - sb $t0, 21($v0) # internal_136[13] = 'b' + sb $t0, 21($v0) # internal_148[13] = 'b' addi $t0, $zero, 121 - sb $t0, 22($v0) # internal_136[14] = 'y' + sb $t0, 22($v0) # internal_148[14] = 'y' addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_136[15] = ' ' + sb $t0, 23($v0) # internal_148[15] = ' ' addi $t0, $zero, 51 - sb $t0, 24($v0) # internal_136[16] = '3' + sb $t0, 24($v0) # internal_148[16] = '3' addi $t0, $zero, 46 - sb $t0, 25($v0) # internal_136[17] = '.' + sb $t0, 25($v0) # internal_148[17] = '.' addi $t0, $zero, 10 - sb $t0, 26($v0) # internal_136[18] = '\n' + sb $t0, 26($v0) # internal_148[18] = '\n' sb $zero, 27($v0) # Null-terminator at the end of the string - sw $v0, 220($sp) # internal_136 = "is divisible by 3.\n" + sw $v0, 220($sp) # internal_148 = "is divisible by 3.\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 780($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_136 + # Argument internal_148 lw $t0, 232($sp) - sw $t0, 0($sp) # Storing internal_136 + sw $t0, 0($sp) # Storing internal_148 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 228($sp) # internal_137 = result of function_out_string_at_IO + sw $v1, 228($sp) # internal_149 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 216($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 260($sp) - j end_assign - not_is_Bool_or_Int: - # internal_126 = internal_137 + # internal_138 = internal_149 lw $t0, 216($sp) sw $t0, 260($sp) - end_assign: - # Jumping to endif_8792981789148 - j endif_8792981789148 + # Jumping to endif_8781702296820 + j endif_8781702296820 - else_8792981789148: + else_8781702296820: # Allocating String li $v0, 9 @@ -13811,73 +16376,104 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 7 + addi $t0, $zero, 16 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 110 - sb $t0, 8($v0) # internal_138[0] = 'n' + sb $t0, 8($v0) # internal_150[0] = 'n' addi $t0, $zero, 117 - sb $t0, 9($v0) # internal_138[1] = 'u' + sb $t0, 9($v0) # internal_150[1] = 'u' addi $t0, $zero, 109 - sb $t0, 10($v0) # internal_138[2] = 'm' + sb $t0, 10($v0) # internal_150[2] = 'm' addi $t0, $zero, 98 - sb $t0, 11($v0) # internal_138[3] = 'b' + sb $t0, 11($v0) # internal_150[3] = 'b' addi $t0, $zero, 101 - sb $t0, 12($v0) # internal_138[4] = 'e' + sb $t0, 12($v0) # internal_150[4] = 'e' addi $t0, $zero, 114 - sb $t0, 13($v0) # internal_138[5] = 'r' + sb $t0, 13($v0) # internal_150[5] = 'r' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_138[6] = ' ' + sb $t0, 14($v0) # internal_150[6] = ' ' sb $zero, 15($v0) # Null-terminator at the end of the string - sw $v0, 212($sp) # internal_138 = "number " + sw $v0, 212($sp) # internal_150 = "number " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 780($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_138 + # Argument internal_150 lw $t0, 224($sp) - sw $t0, 0($sp) # Storing internal_138 + sw $t0, 0($sp) # Storing internal_150 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 220($sp) # internal_139 = result of function_out_string_at_IO + sw $v1, 220($sp) # internal_151 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 204($sp) # internal_140 = avar + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702229682 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702229682 + j object_get_attribute_8781702229682 + int_get_attribute_8781702229682: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 204($sp) # internal_152 = self.avar + j end_get_attribute_8781702229682 + bool_get_attribute_8781702229682: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 204($sp) # internal_152 = self.avar + j end_get_attribute_8781702229682 + object_get_attribute_8781702229682: + sw $t1, 204($sp) # internal_152 = avar + end_get_attribute_8781702229682: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 780($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_140 + # Argument internal_152 lw $t0, 216($sp) - sw $t0, 0($sp) # Storing internal_140 + sw $t0, 0($sp) # Storing internal_152 # Calling function function_print_at_Main jal function_print_at_Main lw $ra, 8($sp) - sw $v1, 212($sp) # internal_141 = result of function_print_at_Main + sw $v1, 212($sp) # internal_153 = result of function_print_at_Main addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -13888,144 +16484,117 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 23 + addi $t0, $zero, 32 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 105 - sb $t0, 8($v0) # internal_142[0] = 'i' + sb $t0, 8($v0) # internal_154[0] = 'i' addi $t0, $zero, 115 - sb $t0, 9($v0) # internal_142[1] = 's' + sb $t0, 9($v0) # internal_154[1] = 's' addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_142[2] = ' ' + sb $t0, 10($v0) # internal_154[2] = ' ' addi $t0, $zero, 110 - sb $t0, 11($v0) # internal_142[3] = 'n' + sb $t0, 11($v0) # internal_154[3] = 'n' addi $t0, $zero, 111 - sb $t0, 12($v0) # internal_142[4] = 'o' + sb $t0, 12($v0) # internal_154[4] = 'o' addi $t0, $zero, 116 - sb $t0, 13($v0) # internal_142[5] = 't' + sb $t0, 13($v0) # internal_154[5] = 't' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_142[6] = ' ' + sb $t0, 14($v0) # internal_154[6] = ' ' addi $t0, $zero, 100 - sb $t0, 15($v0) # internal_142[7] = 'd' + sb $t0, 15($v0) # internal_154[7] = 'd' addi $t0, $zero, 105 - sb $t0, 16($v0) # internal_142[8] = 'i' + sb $t0, 16($v0) # internal_154[8] = 'i' addi $t0, $zero, 118 - sb $t0, 17($v0) # internal_142[9] = 'v' + sb $t0, 17($v0) # internal_154[9] = 'v' addi $t0, $zero, 105 - sb $t0, 18($v0) # internal_142[10] = 'i' + sb $t0, 18($v0) # internal_154[10] = 'i' addi $t0, $zero, 115 - sb $t0, 19($v0) # internal_142[11] = 's' + sb $t0, 19($v0) # internal_154[11] = 's' addi $t0, $zero, 105 - sb $t0, 20($v0) # internal_142[12] = 'i' + sb $t0, 20($v0) # internal_154[12] = 'i' addi $t0, $zero, 98 - sb $t0, 21($v0) # internal_142[13] = 'b' + sb $t0, 21($v0) # internal_154[13] = 'b' addi $t0, $zero, 108 - sb $t0, 22($v0) # internal_142[14] = 'l' + sb $t0, 22($v0) # internal_154[14] = 'l' addi $t0, $zero, 101 - sb $t0, 23($v0) # internal_142[15] = 'e' + sb $t0, 23($v0) # internal_154[15] = 'e' addi $t0, $zero, 32 - sb $t0, 24($v0) # internal_142[16] = ' ' + sb $t0, 24($v0) # internal_154[16] = ' ' addi $t0, $zero, 98 - sb $t0, 25($v0) # internal_142[17] = 'b' + sb $t0, 25($v0) # internal_154[17] = 'b' addi $t0, $zero, 121 - sb $t0, 26($v0) # internal_142[18] = 'y' + sb $t0, 26($v0) # internal_154[18] = 'y' addi $t0, $zero, 32 - sb $t0, 27($v0) # internal_142[19] = ' ' + sb $t0, 27($v0) # internal_154[19] = ' ' addi $t0, $zero, 51 - sb $t0, 28($v0) # internal_142[20] = '3' + sb $t0, 28($v0) # internal_154[20] = '3' addi $t0, $zero, 46 - sb $t0, 29($v0) # internal_142[21] = '.' + sb $t0, 29($v0) # internal_154[21] = '.' addi $t0, $zero, 10 - sb $t0, 30($v0) # internal_142[22] = '\n' + sb $t0, 30($v0) # internal_154[22] = '\n' sb $zero, 31($v0) # Null-terminator at the end of the string - sw $v0, 196($sp) # internal_142 = "is not divisible by 3.\n" + sw $v0, 196($sp) # internal_154 = "is not divisible by 3.\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 780($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_142 + # Argument internal_154 lw $t0, 208($sp) - sw $t0, 0($sp) # Storing internal_142 + sw $t0, 0($sp) # Storing internal_154 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 204($sp) # internal_143 = result of function_out_string_at_IO + sw $v1, 204($sp) # internal_155 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 192($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 260($sp) - j end_assign - not_is_Bool_or_Int: - # internal_126 = internal_143 + # internal_138 = internal_155 lw $t0, 192($sp) sw $t0, 260($sp) - end_assign: - # Jumping to endif_8792981789148 - j endif_8792981789148 + # Jumping to endif_8781702296820 + j endif_8781702296820 - endif_8792981789148: + endif_8781702296820: - lw $t0, 260($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 280($sp) - j end_assign - not_is_Bool_or_Int: - # internal_121 = internal_126 + # internal_133 = internal_138 lw $t0, 260($sp) sw $t0, 280($sp) - end_assign: - # Jumping to endif_8792981790245 - j endif_8792981790245 - - else_8792981790245: + # Jumping to endif_8781702298173 + j endif_8781702298173 + else_8781702298173: # Allocating Bool 0 li $v0, 9 @@ -14037,12 +16606,43 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 184($sp) # internal_145 = address of allocated object Int + sw $v0, 184($sp) # internal_157 = address of allocated object Int # Get attribute char of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'char' from the instance - sw $t1, 180($sp) # internal_146 = char + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702230062 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702230062 + j object_get_attribute_8781702230062 + int_get_attribute_8781702230062: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 180($sp) # internal_158 = self.char + j end_get_attribute_8781702230062 + bool_get_attribute_8781702230062: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 180($sp) # internal_158 = self.char + j end_get_attribute_8781702230062 + object_get_attribute_8781702230062: + sw $t1, 180($sp) # internal_158 = char + end_get_attribute_8781702230062: # Allocating String li $v0, 9 @@ -14052,61 +16652,51 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 104 - sb $t0, 8($v0) # internal_147[0] = 'h' + sb $t0, 8($v0) # internal_159[0] = 'h' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 176($sp) # internal_147 = "h" + sw $v0, 176($sp) # internal_159 = "h" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_146 + # Argument internal_158 lw $t0, 192($sp) - sw $t0, 4($sp) # Storing internal_146 + sw $t0, 4($sp) # Storing internal_158 - # Argument internal_147 + # Argument internal_159 lw $t0, 188($sp) - sw $t0, 0($sp) # Storing internal_147 + sw $t0, 0($sp) # Storing internal_159 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 184($sp) # internal_148 = result of function_equal + sw $v1, 184($sp) # internal_160 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 172($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 184($sp) - j end_assign - not_is_Bool_or_Int: - # internal_145 = internal_148 + # internal_157 = internal_160 lw $t0, 172($sp) sw $t0, 184($sp) - end_assign: - # If internal_145 then goto then_8792981790239 + # If internal_157 then goto then_8781702298167 lw $t0, 184($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981790239 + beq $t0, $t1, then_8781702298167 - # Jumping to else_8792981790239 - j else_8792981790239 + # Jumping to else_8781702298167 + j else_8781702298167 - then_8792981790239: + then_8781702298167: + + # Allocating NUll to x + sw $zero, 168($sp) # x = 0 # Allocating E li $v0, 9 @@ -14115,93 +16705,156 @@ la $t0, type_E # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 164($sp) # internal_150 = address of allocated object E + sw $v0, 164($sp) # internal_162 = address of allocated object E # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_150 + # Argument internal_162 lw $t0, 172($sp) - sw $t0, 0($sp) # Storing internal_150 + sw $t0, 0($sp) # Storing internal_162 # Calling function function___init___at_E jal function___init___at_E lw $ra, 4($sp) - sw $v1, 172($sp) # internal_150 = result of function___init___at_E + sw $v1, 172($sp) # internal_162 = result of function___init___at_E addi $sp, $sp, 8 # Freeing space for arguments # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 160($sp) # internal_151 = avar + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702230236 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702230236 + j object_get_attribute_8781702230236 + int_get_attribute_8781702230236: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 160($sp) # internal_163 = self.avar + j end_get_attribute_8781702230236 + bool_get_attribute_8781702230236: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 160($sp) # internal_163 = self.avar + j end_get_attribute_8781702230236 + object_get_attribute_8781702230236: + sw $t1, 160($sp) # internal_163 = avar + end_get_attribute_8781702230236: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_151 + # Argument internal_163 lw $t0, 168($sp) - sw $t0, 0($sp) # Storing internal_151 + sw $t0, 0($sp) # Storing internal_163 # Calling function function_value_at_A jal function_value_at_A lw $ra, 4($sp) - sw $v1, 164($sp) # internal_152 = result of function_value_at_A + sw $v1, 164($sp) # internal_164 = result of function_value_at_A addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_150 + # Argument internal_162 lw $t0, 176($sp) - sw $t0, 4($sp) # Storing internal_150 + sw $t0, 4($sp) # Storing internal_162 - # Argument internal_152 + # Argument internal_164 lw $t0, 168($sp) - sw $t0, 0($sp) # Storing internal_152 + sw $t0, 0($sp) # Storing internal_164 # Calling function function_method6_at_E jal function_method6_at_E lw $ra, 8($sp) - sw $v1, 164($sp) # internal_153 = result of function_method6_at_E + sw $v1, 164($sp) # internal_165 = result of function_method6_at_E addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 152($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 168($sp) - j end_assign - not_is_Bool_or_Int: - # x = internal_153 - lw $t0, 152($sp) - sw $t0, 168($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 180($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_165 + lw $t0, 164($sp) + sw $t0, 0($sp) # Storing internal_165 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 180($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 144($sp) # internal_155 = avar + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702230330 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702230330 + j object_get_attribute_8781702230330 + int_get_attribute_8781702230330: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 144($sp) # internal_167 = self.avar + j end_get_attribute_8781702230330 + bool_get_attribute_8781702230330: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 144($sp) # internal_167 = self.avar + j end_get_attribute_8781702230330 + object_get_attribute_8781702230330: + sw $t1, 144($sp) # internal_167 = avar + end_get_attribute_8781702230330: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_155 + # Argument internal_167 lw $t0, 152($sp) - sw $t0, 0($sp) # Storing internal_155 + sw $t0, 0($sp) # Storing internal_167 # Calling function function_value_at_A jal function_value_at_A lw $ra, 4($sp) - sw $v1, 148($sp) # internal_156 = result of function_value_at_A + sw $v1, 148($sp) # internal_168 = result of function_value_at_A addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments @@ -14215,7 +16868,7 @@ # Calling function function_value_at_A jal function_value_at_A lw $ra, 4($sp) - sw $v1, 144($sp) # internal_157 = result of function_value_at_A + sw $v1, 144($sp) # internal_169 = result of function_value_at_A addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 8 @@ -14228,60 +16881,61 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 8 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 132($sp) # internal_158 = address of allocated object Int + sw $v0, 132($sp) # internal_170 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_157 + # Argument internal_169 lw $t0, 148($sp) - sw $t0, 4($sp) # Storing internal_157 + sw $t0, 4($sp) # Storing internal_169 - # Argument internal_158 + # Argument internal_170 lw $t0, 144($sp) - sw $t0, 0($sp) # Storing internal_158 + sw $t0, 0($sp) # Storing internal_170 # Calling function function_mult jal function_mult lw $ra, 8($sp) - sw $v1, 140($sp) # internal_159 = result of function_mult + sw $v1, 140($sp) # internal_171 = result of function_mult addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_156 + # Argument internal_168 lw $t0, 152($sp) - sw $t0, 4($sp) # Storing internal_156 + sw $t0, 4($sp) # Storing internal_168 - # Argument internal_159 + # Argument internal_171 lw $t0, 140($sp) - sw $t0, 0($sp) # Storing internal_159 + sw $t0, 0($sp) # Storing internal_171 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 136($sp) # internal_160 = result of function_sub + sw $v1, 136($sp) # internal_172 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 124($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 148($sp) - j end_assign - not_is_Bool_or_Int: - # r = internal_160 - lw $t0, 124($sp) - sw $t0, 148($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument r + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing r + + # Argument internal_172 + lw $t0, 136($sp) + sw $t0, 0($sp) # Storing internal_172 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 160($sp) # r = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating String li $v0, 9 @@ -14291,73 +16945,104 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 7 + addi $t0, $zero, 16 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 110 - sb $t0, 8($v0) # internal_161[0] = 'n' + sb $t0, 8($v0) # internal_173[0] = 'n' addi $t0, $zero, 117 - sb $t0, 9($v0) # internal_161[1] = 'u' + sb $t0, 9($v0) # internal_173[1] = 'u' addi $t0, $zero, 109 - sb $t0, 10($v0) # internal_161[2] = 'm' + sb $t0, 10($v0) # internal_173[2] = 'm' addi $t0, $zero, 98 - sb $t0, 11($v0) # internal_161[3] = 'b' + sb $t0, 11($v0) # internal_173[3] = 'b' addi $t0, $zero, 101 - sb $t0, 12($v0) # internal_161[4] = 'e' + sb $t0, 12($v0) # internal_173[4] = 'e' addi $t0, $zero, 114 - sb $t0, 13($v0) # internal_161[5] = 'r' + sb $t0, 13($v0) # internal_173[5] = 'r' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_161[6] = ' ' + sb $t0, 14($v0) # internal_173[6] = ' ' sb $zero, 15($v0) # Null-terminator at the end of the string - sw $v0, 120($sp) # internal_161 = "number " + sw $v0, 120($sp) # internal_173 = "number " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 780($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_161 + # Argument internal_173 lw $t0, 132($sp) - sw $t0, 0($sp) # Storing internal_161 + sw $t0, 0($sp) # Storing internal_173 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 128($sp) # internal_162 = result of function_out_string_at_IO + sw $v1, 128($sp) # internal_174 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 112($sp) # internal_163 = avar + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702230501 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702230501 + j object_get_attribute_8781702230501 + int_get_attribute_8781702230501: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 112($sp) # internal_175 = self.avar + j end_get_attribute_8781702230501 + bool_get_attribute_8781702230501: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 112($sp) # internal_175 = self.avar + j end_get_attribute_8781702230501 + object_get_attribute_8781702230501: + sw $t1, 112($sp) # internal_175 = avar + end_get_attribute_8781702230501: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 780($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_163 + # Argument internal_175 lw $t0, 124($sp) - sw $t0, 0($sp) # Storing internal_163 + sw $t0, 0($sp) # Storing internal_175 # Calling function function_print_at_Main jal function_print_at_Main lw $ra, 8($sp) - sw $v1, 120($sp) # internal_164 = result of function_print_at_Main + sw $v1, 120($sp) # internal_176 = result of function_print_at_Main addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -14368,65 +17053,65 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 12 + addi $t0, $zero, 21 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 105 - sb $t0, 8($v0) # internal_165[0] = 'i' + sb $t0, 8($v0) # internal_177[0] = 'i' addi $t0, $zero, 115 - sb $t0, 9($v0) # internal_165[1] = 's' + sb $t0, 9($v0) # internal_177[1] = 's' addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_165[2] = ' ' + sb $t0, 10($v0) # internal_177[2] = ' ' addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_165[3] = 'e' + sb $t0, 11($v0) # internal_177[3] = 'e' addi $t0, $zero, 113 - sb $t0, 12($v0) # internal_165[4] = 'q' + sb $t0, 12($v0) # internal_177[4] = 'q' addi $t0, $zero, 117 - sb $t0, 13($v0) # internal_165[5] = 'u' + sb $t0, 13($v0) # internal_177[5] = 'u' addi $t0, $zero, 97 - sb $t0, 14($v0) # internal_165[6] = 'a' + sb $t0, 14($v0) # internal_177[6] = 'a' addi $t0, $zero, 108 - sb $t0, 15($v0) # internal_165[7] = 'l' + sb $t0, 15($v0) # internal_177[7] = 'l' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_165[8] = ' ' + sb $t0, 16($v0) # internal_177[8] = ' ' addi $t0, $zero, 116 - sb $t0, 17($v0) # internal_165[9] = 't' + sb $t0, 17($v0) # internal_177[9] = 't' addi $t0, $zero, 111 - sb $t0, 18($v0) # internal_165[10] = 'o' + sb $t0, 18($v0) # internal_177[10] = 'o' addi $t0, $zero, 32 - sb $t0, 19($v0) # internal_165[11] = ' ' + sb $t0, 19($v0) # internal_177[11] = ' ' sb $zero, 20($v0) # Null-terminator at the end of the string - sw $v0, 104($sp) # internal_165 = "is equal to " + sw $v0, 104($sp) # internal_177 = "is equal to " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 780($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_165 + # Argument internal_177 lw $t0, 116($sp) - sw $t0, 0($sp) # Storing internal_165 + sw $t0, 0($sp) # Storing internal_177 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 112($sp) # internal_166 = result of function_out_string_at_IO + sw $v1, 112($sp) # internal_178 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -14434,7 +17119,7 @@ sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 780($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self # Argument x @@ -14444,7 +17129,7 @@ # Calling function function_print_at_Main jal function_print_at_Main lw $ra, 8($sp) - sw $v1, 108($sp) # internal_167 = result of function_print_at_Main + sw $v1, 108($sp) # internal_179 = result of function_print_at_Main addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -14455,113 +17140,113 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 28 + addi $t0, $zero, 37 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 116 - sb $t0, 8($v0) # internal_168[0] = 't' + sb $t0, 8($v0) # internal_180[0] = 't' addi $t0, $zero, 105 - sb $t0, 9($v0) # internal_168[1] = 'i' + sb $t0, 9($v0) # internal_180[1] = 'i' addi $t0, $zero, 109 - sb $t0, 10($v0) # internal_168[2] = 'm' + sb $t0, 10($v0) # internal_180[2] = 'm' addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_168[3] = 'e' + sb $t0, 11($v0) # internal_180[3] = 'e' addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_168[4] = 's' + sb $t0, 12($v0) # internal_180[4] = 's' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_168[5] = ' ' + sb $t0, 13($v0) # internal_180[5] = ' ' addi $t0, $zero, 56 - sb $t0, 14($v0) # internal_168[6] = '8' + sb $t0, 14($v0) # internal_180[6] = '8' addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_168[7] = ' ' + sb $t0, 15($v0) # internal_180[7] = ' ' addi $t0, $zero, 119 - sb $t0, 16($v0) # internal_168[8] = 'w' + sb $t0, 16($v0) # internal_180[8] = 'w' addi $t0, $zero, 105 - sb $t0, 17($v0) # internal_168[9] = 'i' + sb $t0, 17($v0) # internal_180[9] = 'i' addi $t0, $zero, 116 - sb $t0, 18($v0) # internal_168[10] = 't' + sb $t0, 18($v0) # internal_180[10] = 't' addi $t0, $zero, 104 - sb $t0, 19($v0) # internal_168[11] = 'h' + sb $t0, 19($v0) # internal_180[11] = 'h' addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_168[12] = ' ' + sb $t0, 20($v0) # internal_180[12] = ' ' addi $t0, $zero, 97 - sb $t0, 21($v0) # internal_168[13] = 'a' + sb $t0, 21($v0) # internal_180[13] = 'a' addi $t0, $zero, 32 - sb $t0, 22($v0) # internal_168[14] = ' ' + sb $t0, 22($v0) # internal_180[14] = ' ' addi $t0, $zero, 114 - sb $t0, 23($v0) # internal_168[15] = 'r' + sb $t0, 23($v0) # internal_180[15] = 'r' addi $t0, $zero, 101 - sb $t0, 24($v0) # internal_168[16] = 'e' + sb $t0, 24($v0) # internal_180[16] = 'e' addi $t0, $zero, 109 - sb $t0, 25($v0) # internal_168[17] = 'm' + sb $t0, 25($v0) # internal_180[17] = 'm' addi $t0, $zero, 97 - sb $t0, 26($v0) # internal_168[18] = 'a' + sb $t0, 26($v0) # internal_180[18] = 'a' addi $t0, $zero, 105 - sb $t0, 27($v0) # internal_168[19] = 'i' + sb $t0, 27($v0) # internal_180[19] = 'i' addi $t0, $zero, 110 - sb $t0, 28($v0) # internal_168[20] = 'n' + sb $t0, 28($v0) # internal_180[20] = 'n' addi $t0, $zero, 100 - sb $t0, 29($v0) # internal_168[21] = 'd' + sb $t0, 29($v0) # internal_180[21] = 'd' addi $t0, $zero, 101 - sb $t0, 30($v0) # internal_168[22] = 'e' + sb $t0, 30($v0) # internal_180[22] = 'e' addi $t0, $zero, 114 - sb $t0, 31($v0) # internal_168[23] = 'r' + sb $t0, 31($v0) # internal_180[23] = 'r' addi $t0, $zero, 32 - sb $t0, 32($v0) # internal_168[24] = ' ' + sb $t0, 32($v0) # internal_180[24] = ' ' addi $t0, $zero, 111 - sb $t0, 33($v0) # internal_168[25] = 'o' + sb $t0, 33($v0) # internal_180[25] = 'o' addi $t0, $zero, 102 - sb $t0, 34($v0) # internal_168[26] = 'f' + sb $t0, 34($v0) # internal_180[26] = 'f' addi $t0, $zero, 32 - sb $t0, 35($v0) # internal_168[27] = ' ' + sb $t0, 35($v0) # internal_180[27] = ' ' sb $zero, 36($v0) # Null-terminator at the end of the string - sw $v0, 92($sp) # internal_168 = "times 8 with a remainder of " + sw $v0, 92($sp) # internal_180 = "times 8 with a remainder of " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 780($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_168 + # Argument internal_180 lw $t0, 104($sp) - sw $t0, 0($sp) # Storing internal_168 + sw $t0, 0($sp) # Storing internal_180 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 100($sp) # internal_169 = result of function_out_string_at_IO + sw $v1, 100($sp) # internal_181 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Allocating A2I @@ -14571,38 +17256,39 @@ la $t0, type_A2I # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 80($sp) # internal_171 = address of allocated object A2I + sw $v0, 80($sp) # internal_183 = address of allocated object A2I # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_171 + # Argument internal_183 lw $t0, 88($sp) - sw $t0, 0($sp) # Storing internal_171 + sw $t0, 0($sp) # Storing internal_183 # Calling function function___init___at_A2I jal function___init___at_A2I lw $ra, 4($sp) - sw $v1, 88($sp) # internal_171 = result of function___init___at_A2I + sw $v1, 88($sp) # internal_183 = result of function___init___at_A2I addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 80($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 476($sp) - j end_assign - not_is_Bool_or_Int: - # a = internal_171 - lw $t0, 80($sp) - sw $t0, 476($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument a + lw $t0, 488($sp) + sw $t0, 4($sp) # Storing a + + # Argument internal_183 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_183 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 488($sp) # a = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -14619,7 +17305,7 @@ # Calling function function_i2a_at_A2I jal function_i2a_at_A2I lw $ra, 8($sp) - sw $v1, 88($sp) # internal_172 = result of function_i2a_at_A2I + sw $v1, 88($sp) # internal_184 = result of function_i2a_at_A2I addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -14627,17 +17313,17 @@ sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 780($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_172 + # Argument internal_184 lw $t0, 88($sp) - sw $t0, 0($sp) # Storing internal_172 + sw $t0, 0($sp) # Storing internal_184 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 84($sp) # internal_173 = result of function_out_string_at_IO + sw $v1, 84($sp) # internal_185 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -14648,61 +17334,79 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_174[0] = '\n' + sb $t0, 8($v0) # internal_186[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 68($sp) # internal_174 = "\n" + sw $v0, 68($sp) # internal_186 = "\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 780($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_174 + # Argument internal_186 lw $t0, 80($sp) - sw $t0, 0($sp) # Storing internal_174 + sw $t0, 0($sp) # Storing internal_186 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 76($sp) # internal_175 = result of function_out_string_at_IO + sw $v1, 76($sp) # internal_187 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Set attribute avar of self - lw $t0, 768($sp) # $t0 = self + lw $t0, 816($sp) # $t0 = self lw $t1, 168($sp) # $t1 = x + beq $t1, $zero, object_set_attribute_8781702230420 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8781702230420 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8781702230420 + j object_set_attribute_8781702230420 + int_set_attribute_8781702230420: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = x + j end_set_attribute_8781702230420 + bool_set_attribute_8781702230420: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = x + j end_set_attribute_8781702230420 + object_set_attribute_8781702230420: sw $t1, 12($t0) # self.avar = x + end_set_attribute_8781702230420: - lw $t0, 168($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 188($sp) - j end_assign - not_is_Bool_or_Int: - # internal_144 = x + # internal_156 = x lw $t0, 168($sp) sw $t0, 188($sp) - end_assign: - # Jumping to endif_8792981790239 - j endif_8792981790239 - - else_8792981790239: + # Jumping to endif_8781702298167 + j endif_8781702298167 + else_8781702298167: # Allocating Bool 0 li $v0, 9 @@ -14714,12 +17418,43 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 56($sp) # internal_177 = address of allocated object Int + sw $v0, 56($sp) # internal_189 = address of allocated object Int # Get attribute char of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'char' from the instance - sw $t1, 52($sp) # internal_178 = char + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702231559 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702231559 + j object_get_attribute_8781702231559 + int_get_attribute_8781702231559: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 52($sp) # internal_190 = self.char + j end_get_attribute_8781702231559 + bool_get_attribute_8781702231559: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 52($sp) # internal_190 = self.char + j end_get_attribute_8781702231559 + object_get_attribute_8781702231559: + sw $t1, 52($sp) # internal_190 = char + end_get_attribute_8781702231559: # Allocating String li $v0, 9 @@ -14729,61 +17464,48 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 106 - sb $t0, 8($v0) # internal_179[0] = 'j' + sb $t0, 8($v0) # internal_191[0] = 'j' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 48($sp) # internal_179 = "j" + sw $v0, 48($sp) # internal_191 = "j" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_178 + # Argument internal_190 lw $t0, 64($sp) - sw $t0, 4($sp) # Storing internal_178 + sw $t0, 4($sp) # Storing internal_190 - # Argument internal_179 + # Argument internal_191 lw $t0, 60($sp) - sw $t0, 0($sp) # Storing internal_179 + sw $t0, 0($sp) # Storing internal_191 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 56($sp) # internal_180 = result of function_equal + sw $v1, 56($sp) # internal_192 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 44($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 56($sp) - j end_assign - not_is_Bool_or_Int: - # internal_177 = internal_180 + # internal_189 = internal_192 lw $t0, 44($sp) sw $t0, 56($sp) - end_assign: - # If internal_177 then goto then_8792981790233 + # If internal_189 then goto then_8781702298161 lw $t0, 56($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981790233 + beq $t0, $t1, then_8781702298161 - # Jumping to else_8792981790233 - j else_8792981790233 + # Jumping to else_8781702298161 + j else_8781702298161 - then_8792981790233: + then_8781702298161: # Allocating A li $v0, 9 @@ -14792,49 +17514,67 @@ la $t0, type_A # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 40($sp) # internal_181 = address of allocated object A + sw $v0, 40($sp) # internal_193 = address of allocated object A # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_181 + # Argument internal_193 lw $t0, 48($sp) - sw $t0, 0($sp) # Storing internal_181 + sw $t0, 0($sp) # Storing internal_193 # Calling function function___init___at_A jal function___init___at_A lw $ra, 4($sp) - sw $v1, 48($sp) # internal_181 = result of function___init___at_A + sw $v1, 48($sp) # internal_193 = result of function___init___at_A addi $sp, $sp, 8 # Freeing space for arguments # Set attribute avar of self - lw $t0, 768($sp) # $t0 = self - lw $t1, 40($sp) # $t1 = internal_181 - sw $t1, 12($t0) # self.avar = internal_181 - - lw $t0, 40($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: - # internal_176 = internal_181 + lw $t0, 816($sp) # $t0 = self + lw $t1, 40($sp) # $t1 = internal_193 + beq $t1, $zero, object_set_attribute_8781702231625 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8781702231625 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8781702231625 + j object_set_attribute_8781702231625 + int_set_attribute_8781702231625: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_193 + j end_set_attribute_8781702231625 + bool_set_attribute_8781702231625: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_193 + j end_set_attribute_8781702231625 + object_set_attribute_8781702231625: + sw $t1, 12($t0) # self.avar = internal_193 + end_set_attribute_8781702231625: + + # internal_188 = internal_193 lw $t0, 40($sp) sw $t0, 60($sp) - end_assign: - - # Jumping to endif_8792981790233 - j endif_8792981790233 - else_8792981790233: + # Jumping to endif_8781702298161 + j endif_8781702298161 + else_8781702298161: # Allocating Bool 0 li $v0, 9 @@ -14846,12 +17586,43 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_183 = address of allocated object Int + sw $v0, 32($sp) # internal_195 = address of allocated object Int # Get attribute char of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'char' from the instance - sw $t1, 28($sp) # internal_184 = char + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702231727 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702231727 + j object_get_attribute_8781702231727 + int_get_attribute_8781702231727: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_196 = self.char + j end_get_attribute_8781702231727 + bool_get_attribute_8781702231727: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_196 = self.char + j end_get_attribute_8781702231727 + object_get_attribute_8781702231727: + sw $t1, 28($sp) # internal_196 = char + end_get_attribute_8781702231727: # Allocating String li $v0, 9 @@ -14861,61 +17632,48 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 113 - sb $t0, 8($v0) # internal_185[0] = 'q' + sb $t0, 8($v0) # internal_197[0] = 'q' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 24($sp) # internal_185 = "q" + sw $v0, 24($sp) # internal_197 = "q" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_184 + # Argument internal_196 lw $t0, 40($sp) - sw $t0, 4($sp) # Storing internal_184 + sw $t0, 4($sp) # Storing internal_196 - # Argument internal_185 + # Argument internal_197 lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_185 + sw $t0, 0($sp) # Storing internal_197 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 32($sp) # internal_186 = result of function_equal + sw $v1, 32($sp) # internal_198 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 20($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 32($sp) - j end_assign - not_is_Bool_or_Int: - # internal_183 = internal_186 + # internal_195 = internal_198 lw $t0, 20($sp) sw $t0, 32($sp) - end_assign: - # If internal_183 then goto then_8792981789693 + # If internal_195 then goto then_8781702298137 lw $t0, 32($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8792981789693 + beq $t0, $t1, then_8781702298137 - # Jumping to else_8792981789693 - j else_8792981789693 + # Jumping to else_8781702298137 + j else_8781702298137 - then_8792981789693: + then_8781702298137: # Allocating Bool 0 li $v0, 9 @@ -14927,34 +17685,53 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_187 = address of allocated object Int + sw $v0, 16($sp) # internal_199 = address of allocated object Int # Set attribute flag of self - lw $t0, 768($sp) # $t0 = self - lw $t1, 16($sp) # $t1 = internal_187 - sw $t1, 20($t0) # self.flag = internal_187 - - lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 36($sp) - j end_assign - not_is_Bool_or_Int: - # internal_182 = internal_187 + lw $t0, 816($sp) # $t0 = self + lw $t1, 16($sp) # $t1 = internal_199 + beq $t1, $zero, object_set_attribute_8781702231793 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8781702231793 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8781702231793 + j object_set_attribute_8781702231793 + int_set_attribute_8781702231793: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.flag = internal_199 + j end_set_attribute_8781702231793 + bool_set_attribute_8781702231793: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.flag = internal_199 + j end_set_attribute_8781702231793 + object_set_attribute_8781702231793: + sw $t1, 20($t0) # self.flag = internal_199 + end_set_attribute_8781702231793: + + # internal_194 = internal_199 lw $t0, 16($sp) sw $t0, 36($sp) - end_assign: - # Jumping to endif_8792981789693 - j endif_8792981789693 + # Jumping to endif_8781702298137 + j endif_8781702298137 - else_8792981789693: + else_8781702298137: # Allocating A li $v0, 9 @@ -14963,294 +17740,227 @@ la $t0, type_A # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 12($sp) # internal_188 = address of allocated object A + sw $v0, 12($sp) # internal_200 = address of allocated object A # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_188 + # Argument internal_200 lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_188 + sw $t0, 0($sp) # Storing internal_200 # Calling function function___init___at_A jal function___init___at_A lw $ra, 4($sp) - sw $v1, 20($sp) # internal_188 = result of function___init___at_A + sw $v1, 20($sp) # internal_200 = result of function___init___at_A addi $sp, $sp, 8 # Freeing space for arguments # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 8($sp) # internal_189 = avar + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8781702232414 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8781702232414 + j object_get_attribute_8781702232414 + int_get_attribute_8781702232414: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_201 = self.avar + j end_get_attribute_8781702232414 + bool_get_attribute_8781702232414: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_201 = self.avar + j end_get_attribute_8781702232414 + object_get_attribute_8781702232414: + sw $t1, 8($sp) # internal_201 = avar + end_get_attribute_8781702232414: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_189 + # Argument internal_201 lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_189 + sw $t0, 0($sp) # Storing internal_201 # Calling function function_value_at_A jal function_value_at_A lw $ra, 4($sp) - sw $v1, 12($sp) # internal_190 = result of function_value_at_A + sw $v1, 12($sp) # internal_202 = result of function_value_at_A addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_188 + # Argument internal_200 lw $t0, 24($sp) - sw $t0, 4($sp) # Storing internal_188 + sw $t0, 4($sp) # Storing internal_200 - # Argument internal_190 + # Argument internal_202 lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_190 + sw $t0, 0($sp) # Storing internal_202 # Calling function function_method1_at_A jal function_method1_at_A lw $ra, 8($sp) - sw $v1, 12($sp) # internal_191 = result of function_method1_at_A + sw $v1, 12($sp) # internal_203 = result of function_method1_at_A addi $sp, $sp, 12 # Freeing space for arguments # Set attribute avar of self - lw $t0, 768($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_191 - sw $t1, 12($t0) # self.avar = internal_191 - - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 36($sp) - j end_assign - not_is_Bool_or_Int: - # internal_182 = internal_191 + lw $t0, 816($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_203 + beq $t1, $zero, object_set_attribute_8781702232351 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8781702232351 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8781702232351 + j object_set_attribute_8781702232351 + int_set_attribute_8781702232351: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_203 + j end_set_attribute_8781702232351 + bool_set_attribute_8781702232351: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_203 + j end_set_attribute_8781702232351 + object_set_attribute_8781702232351: + sw $t1, 12($t0) # self.avar = internal_203 + end_set_attribute_8781702232351: + + # internal_194 = internal_203 lw $t0, 0($sp) sw $t0, 36($sp) - end_assign: - # Jumping to endif_8792981789693 - j endif_8792981789693 + # Jumping to endif_8781702298137 + j endif_8781702298137 - endif_8792981789693: + endif_8781702298137: - lw $t0, 36($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: - # internal_176 = internal_182 + # internal_188 = internal_194 lw $t0, 36($sp) sw $t0, 60($sp) - end_assign: - # Jumping to endif_8792981790233 - j endif_8792981790233 + # Jumping to endif_8781702298161 + j endif_8781702298161 - endif_8792981790233: + endif_8781702298161: - lw $t0, 60($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 188($sp) - j end_assign - not_is_Bool_or_Int: - # internal_144 = internal_176 + # internal_156 = internal_188 lw $t0, 60($sp) sw $t0, 188($sp) - end_assign: - # Jumping to endif_8792981790239 - j endif_8792981790239 + # Jumping to endif_8781702298167 + j endif_8781702298167 - endif_8792981790239: + endif_8781702298167: - lw $t0, 188($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 280($sp) - j end_assign - not_is_Bool_or_Int: - # internal_121 = internal_144 + # internal_133 = internal_156 lw $t0, 188($sp) sw $t0, 280($sp) - end_assign: - # Jumping to endif_8792981790245 - j endif_8792981790245 + # Jumping to endif_8781702298173 + j endif_8781702298173 - endif_8792981790245: + endif_8781702298173: - lw $t0, 280($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 316($sp) - j end_assign - not_is_Bool_or_Int: - # internal_112 = internal_121 + # internal_124 = internal_133 lw $t0, 280($sp) sw $t0, 316($sp) - end_assign: - # Jumping to endif_8792981790251 - j endif_8792981790251 + # Jumping to endif_8781702298179 + j endif_8781702298179 - endif_8792981790251: + endif_8781702298179: - lw $t0, 316($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 352($sp) - j end_assign - not_is_Bool_or_Int: - # internal_103 = internal_112 + # internal_115 = internal_124 lw $t0, 316($sp) sw $t0, 352($sp) - end_assign: - # Jumping to endif_8792981790257 - j endif_8792981790257 + # Jumping to endif_8781702298185 + j endif_8781702298185 - endif_8792981790257: + endif_8781702298185: - lw $t0, 352($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 388($sp) - j end_assign - not_is_Bool_or_Int: - # internal_94 = internal_103 + # internal_106 = internal_115 lw $t0, 352($sp) sw $t0, 388($sp) - end_assign: - # Jumping to endif_8792981790263 - j endif_8792981790263 + # Jumping to endif_8781702298191 + j endif_8781702298191 - endif_8792981790263: + endif_8781702298191: - lw $t0, 388($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 444($sp) - j end_assign - not_is_Bool_or_Int: - # internal_80 = internal_94 + # internal_92 = internal_106 lw $t0, 388($sp) sw $t0, 444($sp) - end_assign: - # Jumping to endif_8792981790269 - j endif_8792981790269 + # Jumping to endif_8781702298197 + j endif_8781702298197 - endif_8792981790269: + endif_8781702298197: + # internal_32 = internal_92 lw $t0, 444($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 632($sp) - j end_assign - not_is_Bool_or_Int: - # internal_33 = internal_80 - lw $t0, 444($sp) - sw $t0, 632($sp) - end_assign: + sw $t0, 684($sp) - # Jumping to endif_8792981790275 - j endif_8792981790275 + # Jumping to endif_8781702298203 + j endif_8781702298203 - endif_8792981790275: + endif_8781702298203: - lw $t0, 632($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 688($sp) - j end_assign - not_is_Bool_or_Int: - # internal_19 = internal_33 - lw $t0, 632($sp) - sw $t0, 688($sp) - end_assign: + # internal_18 = internal_32 + lw $t0, 684($sp) + sw $t0, 740($sp) - # Jumping to endif_8792981790281 - j endif_8792981790281 + # Jumping to endif_8781702298209 + j endif_8781702298209 - endif_8792981790281: + endif_8781702298209: - # Jumping to while_start_8792981790296 - j while_start_8792981790296 + # Jumping to while_start_8781702298224 + j while_start_8781702298224 - while_end_8792981790296: + while_end_8781702298224: # Loading return value in $v1 addi $v1, $zero, 0 # Freeing space for local variables - addi $sp, $sp, 768 + addi $sp, $sp, 816 jr $ra diff --git a/src/arith.cil b/src/arith.cil index c6827d87e..d6e8b6c78 100644 --- a/src/arith.cil +++ b/src/arith.cil @@ -260,29 +260,36 @@ function function_equal{ PARAM b LOCAL internal_0 # Equal result - LOCAL internal_1 # Type of a - LOCAL internal_2 # Type Int - LOCAL internal_3 # Type Bool - LOCAL internal_4 # Type String - LOCAL internal_5 # Type of a equals int - LOCAL internal_6 # Type of a equals bool - LOCAL internal_7 # Type of a equals string + LOCAL internal_1 # Null Pointer + LOCAL internal_2 # One of params is null + LOCAL internal_3 # Type of a + LOCAL internal_4 # Type Int + LOCAL internal_5 # Type Bool + LOCAL internal_6 # Type String + LOCAL internal_7 # Type of a equals int + LOCAL internal_8 # Type of a equals bool + LOCAL internal_9 # Type of a equals string internal_0 = ALLOCBOOL 0 - internal_1 = TYPEOF a - internal_2 = TYPEADDR Int - internal_3 = TYPEADDR Bool - internal_4 = TYPEADDR String - internal_5 = ALLOCBOOL 0 - internal_6 = ALLOCBOOL 0 + internal_1 = ALLOCNULL + internal_2 = ALLOCBOOL 0 + internal_2 = EQUALADDR a internal_1 + internal_2 = EQUALADDR b internal_1 + IF internal_2 GOTO a_is_type_object + internal_3 = TYPEOF a + internal_4 = TYPEADDR Int + internal_5 = TYPEADDR Bool + internal_6 = TYPEADDR String internal_7 = ALLOCBOOL 0 - internal_5 = EQUALADDR internal_1 internal_2 - internal_6 = EQUALADDR internal_1 internal_3 - internal_7 = EQUALADDR internal_1 internal_4 - - IF internal_5 GOTO a_is_type_int_or_bool - IF internal_6 GOTO a_is_type_int_or_bool - IF internal_7 GOTO a_is_type_string + internal_8 = ALLOCBOOL 0 + internal_9 = ALLOCBOOL 0 + internal_7 = EQUALADDR internal_3 internal_4 + internal_8 = EQUALADDR internal_3 internal_5 + internal_9 = EQUALADDR internal_3 internal_6 + + IF internal_7 GOTO a_is_type_int_or_bool + IF internal_8 GOTO a_is_type_int_or_bool + IF internal_9 GOTO a_is_type_string GOTO a_is_type_object a_is_type_int_or_bool: @@ -301,6 +308,47 @@ function function_equal{ RETURN internal_0 } +function function_assign{ + PARAM dest + PARAM source + + LOCAL internal_0 # Null Pointer + LOCAL internal_1 # One of params is null + LOCAL internal_2 # Type of source + LOCAL internal_3 # Type Int + LOCAL internal_4 # Type Bool + LOCAL internal_5 # Type of source equals int + LOCAL internal_6 # Type of source equals bool + + internal_0 = ALLOCNULL + internal_1 = ALLOCBOOL 0 + internal_1 = EQUALADDR source internal_0 + internal_1 = EQUALADDR dest internal_0 + IF internal_1 GOTO source_is_type_object + internal_2 = TYPEOF source + internal_3 = TYPEADDR Int + internal_4 = TYPEADDR Bool + internal_5 = ALLOCBOOL 0 + internal_6 = ALLOCBOOL 0 + internal_5 = EQUALADDR internal_2 internal_3 + internal_6 = EQUALADDR internal_2 internal_4 + + IF internal_5 GOTO source_is_type_int_or_bool + IF internal_6 GOTO source_is_type_int_or_bool + GOTO source_is_type_object + + source_is_type_int_or_bool: + dest = INT source + GOTO source_end_of_equal + + source_is_type_object: + dest = source + GOTO source_end_of_equal + + source_end_of_equal: + + RETURN dest +} function function___init___at_Object{ PARAM self @@ -309,6 +357,22 @@ function function___init___at_Object{ function function_abort_at_Object{ PARAM self + LOCAL internal_0 + LOCAL internal_1 + LOCAL internal_2 + LOCAL internal_3 + + internal_0 = ALLOCSTR "Abort called from class " + internal_2 = ALLOCSTR "\n" + ARG self + internal_1 = VCALL String function_type_name_at_Object + ARG internal_0 + ARG internal_1 + internal_3 = VCALL String function_concat_at_String + ARG internal_3 + ARG internal_2 + internal_3 = VCALL String function_concat_at_String + PRINTSTR internal_3 HALT RETURN self @@ -366,6 +430,7 @@ function function_in_int_at_IO{ LOCAL internal_0 + internal_0 = ALLOCINT 0 READINT internal_0 RETURN internal_0 @@ -380,6 +445,7 @@ function function_length_at_String{ LOCAL internal_0 + internal_0 = ALLOCINT 0 internal_0 = LENGTH self RETURN internal_0 @@ -411,6 +477,7 @@ function function___init___at_A{ LOCAL internal_0 # Integer 0 internal_0 = ALLOCINT 0 + SETATTR self var internal_0 RETURN self @@ -428,6 +495,7 @@ function function_set_var_at_A{ PARAM self PARAM num + SETATTR self var num RETURN self @@ -448,12 +516,16 @@ function function_method2_at_A{ LOCAL internal_2 # Store an instance of the class B LOCAL internal_3 - x = 0 + # Let x: Int + x = ALLOCINT 0 ARG num1 ARG num2 internal_1 = CALL function_add - x = internal_1 + + ARG x + ARG internal_1 + x = CALL function_assign internal_2 = ALLOCATE B # Allocate the object B ARG internal_2 # Pass the instance to the constructor internal_2 = VCALL B function___init___at_B # Call the constructor @@ -474,10 +546,21 @@ function function_method3_at_A{ LOCAL internal_4 # Store an instance of the class C LOCAL internal_5 - x = 0 - internal_3 = XOR num internal_2 # Getting the complement a1 of num - internal_3 = internal_3 + internal_1 # Adding 1 to the complement a1 we get the complement a2 of num - x = internal_3 + # Let x: Int + x = ALLOCINT 0 + internal_1 = ALLOCINT 1 + internal_2 = ALLOCINT 4294967295 + internal_3 = ALLOCINT 0 + ARG num + ARG internal_2 + internal_3 = CALL function_xor + ARG internal_3 + ARG internal_1 + internal_3 = CALL function_add + + ARG x + ARG internal_3 + x = CALL function_assign internal_4 = ALLOCATE C # Allocate the object C ARG internal_4 # Pass the instance to the constructor internal_4 = VCALL C function___init___at_C # Call the constructor @@ -511,16 +594,20 @@ function function_method4_at_A{ ARG num1 internal_2 = CALL function_less_than internal_1 = internal_2 - IF internal_1 GOTO then_8792981814074 - GOTO else_8792981814074 + IF internal_1 GOTO then_8781702322008 + GOTO else_8781702322008 - then_8792981814074: - x = 0 + then_8781702322008: + # Let x: Int + x = ALLOCINT 0 ARG num1 ARG num2 internal_4 = CALL function_sub - x = internal_4 + + ARG x + ARG internal_4 + x = CALL function_assign internal_5 = ALLOCATE D # Allocate the object D ARG internal_5 # Pass the instance to the constructor internal_5 = VCALL D function___init___at_D # Call the constructor @@ -528,15 +615,19 @@ function function_method4_at_A{ ARG x internal_6 = VCALL D function_set_var_at_A internal_0 = internal_6 - GOTO endif_8792981814074 + GOTO endif_8781702322008 - else_8792981814074: - x = 0 + else_8781702322008: + # Let x: Int + x = ALLOCINT 0 ARG num2 ARG num1 internal_8 = CALL function_sub - x = internal_8 + + ARG x + ARG internal_8 + x = CALL function_assign internal_9 = ALLOCATE D # Allocate the object D ARG internal_9 # Pass the instance to the constructor internal_9 = VCALL D function___init___at_D # Call the constructor @@ -544,9 +635,9 @@ function function_method4_at_A{ ARG x internal_10 = VCALL D function_set_var_at_A internal_0 = internal_10 - GOTO endif_8792981814074 + GOTO endif_8781702322008 - endif_8792981814074: + endif_8781702322008: RETURN internal_0 } @@ -558,50 +649,64 @@ function function_method5_at_A{ LOCAL internal_1 # Integer 1 LOCAL y LOCAL internal_3 # Integer 1 - LOCAL internal_4 - LOCAL internal_5 # Store the result of the operation function_less_than_or_equal - LOCAL internal_6 # Store the result of the operation function_mult - LOCAL internal_7 # Integer 1 - LOCAL internal_8 # Store the result of the operation function_add - LOCAL internal_9 # Store an instance of the class E - LOCAL internal_10 + LOCAL internal_4 # Store the result of the operation function_less_than_or_equal + LOCAL internal_5 # Store the result of the operation function_mult + LOCAL internal_6 # Integer 1 + LOCAL internal_7 # Store the result of the operation function_add + LOCAL internal_8 # Store an instance of the class E + LOCAL internal_9 + # Let x: Int + internal_1 = ALLOCINT 1 - x = internal_1 + ARG x + ARG internal_1 + x = CALL function_assign + # Let y: Int + internal_3 = ALLOCINT 1 - y = internal_3 - while_start_8792981814158: + ARG y + ARG internal_3 + y = CALL function_assign + + # While loop + while_start_8781702322092: ARG y ARG num - internal_5 = CALL function_less_than_or_equal - internal_4 = internal_5 - IF internal_4 GOTO while_body_8792981814158 - GOTO while_end_8792981814158 + internal_4 = CALL function_less_than_or_equal + IF internal_4 GOTO while_body_8781702322092 + GOTO while_end_8781702322092 - while_body_8792981814158: + while_body_8781702322092: ARG x ARG y - internal_6 = CALL function_mult - x = internal_6 - internal_7 = ALLOCINT 1 + internal_5 = CALL function_mult + + ARG x + ARG internal_5 + x = CALL function_assign + internal_6 = ALLOCINT 1 + + ARG y + ARG internal_6 + internal_7 = CALL function_add ARG y ARG internal_7 - internal_8 = CALL function_add - y = internal_8 - GOTO while_start_8792981814158 + y = CALL function_assign + GOTO while_start_8781702322092 - while_end_8792981814158: - internal_9 = ALLOCATE E # Allocate the object E - ARG internal_9 # Pass the instance to the constructor - internal_9 = VCALL E function___init___at_E # Call the constructor - ARG internal_9 + while_end_8781702322092: + internal_8 = ALLOCATE E # Allocate the object E + ARG internal_8 # Pass the instance to the constructor + internal_8 = VCALL E function___init___at_E # Call the constructor + ARG internal_8 ARG x - internal_10 = VCALL E function_set_var_at_A + internal_9 = VCALL E function_set_var_at_A - RETURN internal_10 + RETURN internal_9 } function function___init___at_B{ PARAM self @@ -609,6 +714,7 @@ function function___init___at_B{ LOCAL internal_0 # Integer 0 internal_0 = ALLOCINT 0 + SETATTR self var internal_0 RETURN self @@ -622,12 +728,16 @@ function function_method5_at_B{ LOCAL internal_2 # Store an instance of the class E LOCAL internal_3 - x = 0 + # Let x: Int + x = ALLOCINT 0 ARG num ARG num internal_1 = CALL function_mult - x = internal_1 + + ARG x + ARG internal_1 + x = CALL function_assign internal_2 = ALLOCATE E # Allocate the object E ARG internal_2 # Pass the instance to the constructor internal_2 = VCALL E function___init___at_E # Call the constructor @@ -643,6 +753,7 @@ function function___init___at_C{ LOCAL internal_0 # Integer 0 internal_0 = ALLOCINT 0 + SETATTR self var internal_0 RETURN self @@ -658,10 +769,21 @@ function function_method6_at_C{ LOCAL internal_4 # Store an instance of the class A LOCAL internal_5 - x = 0 - internal_3 = XOR num internal_2 # Getting the complement a1 of num - internal_3 = internal_3 + internal_1 # Adding 1 to the complement a1 we get the complement a2 of num - x = internal_3 + # Let x: Int + x = ALLOCINT 0 + internal_1 = ALLOCINT 1 + internal_2 = ALLOCINT 4294967295 + internal_3 = ALLOCINT 0 + ARG num + ARG internal_2 + internal_3 = CALL function_xor + ARG internal_3 + ARG internal_1 + internal_3 = CALL function_add + + ARG x + ARG internal_3 + x = CALL function_assign internal_4 = ALLOCATE A # Allocate the object A ARG internal_4 # Pass the instance to the constructor internal_4 = VCALL A function___init___at_A # Call the constructor @@ -681,7 +803,8 @@ function function_method5_at_C{ LOCAL internal_3 # Store an instance of the class E LOCAL internal_4 - x = 0 + # Let x: Int + x = ALLOCINT 0 ARG num ARG num @@ -690,7 +813,10 @@ function function_method5_at_C{ ARG internal_1 ARG num internal_2 = CALL function_mult - x = internal_2 + + ARG x + ARG internal_2 + x = CALL function_assign internal_3 = ALLOCATE E # Allocate the object E ARG internal_3 # Pass the instance to the constructor internal_3 = VCALL E function___init___at_E # Call the constructor @@ -706,6 +832,7 @@ function function___init___at_D{ LOCAL internal_0 # Integer 0 internal_0 = ALLOCINT 0 + SETATTR self var internal_0 RETURN self @@ -742,7 +869,11 @@ function function_method7_at_D{ LOCAL internal_25 # Store the result of the operation function_sub LOCAL internal_26 - x = num + # Let x: Int + + ARG x + ARG num + x = CALL function_assign # Conditional internal_2 = ALLOCBOOL 0 internal_3 = ALLOCINT 0 @@ -751,19 +882,26 @@ function function_method7_at_D{ ARG internal_3 internal_4 = CALL function_less_than internal_2 = internal_4 - IF internal_2 GOTO then_8792981815568 - GOTO else_8792981815568 + IF internal_2 GOTO then_8781702323502 + GOTO else_8781702323502 - then_8792981815568: - internal_7 = XOR x internal_6 # Getting the complement a1 of x - internal_7 = internal_7 + internal_5 # Adding 1 to the complement a1 we get the complement a2 of x + then_8781702323502: + internal_5 = ALLOCINT 1 + internal_6 = ALLOCINT 4294967295 + internal_7 = ALLOCINT 0 + ARG x + ARG internal_6 + internal_7 = CALL function_xor + ARG internal_7 + ARG internal_5 + internal_7 = CALL function_add ARG self ARG internal_7 internal_8 = VCALL D function_method7_at_D internal_1 = internal_8 - GOTO endif_8792981815568 + GOTO endif_8781702323502 - else_8792981815568: + else_8781702323502: # Conditional internal_10 = ALLOCBOOL 0 internal_11 = ALLOCINT 0 @@ -772,15 +910,15 @@ function function_method7_at_D{ ARG x internal_12 = CALL function_equal internal_10 = internal_12 - IF internal_10 GOTO then_8792981815559 - GOTO else_8792981815559 + IF internal_10 GOTO then_8781702323481 + GOTO else_8781702323481 - then_8792981815559: + then_8781702323481: internal_13 = ALLOCBOOL 1 internal_9 = internal_13 - GOTO endif_8792981815559 + GOTO endif_8781702323481 - else_8792981815559: + else_8781702323481: # Conditional internal_15 = ALLOCBOOL 0 internal_16 = ALLOCINT 1 @@ -789,15 +927,15 @@ function function_method7_at_D{ ARG x internal_17 = CALL function_equal internal_15 = internal_17 - IF internal_15 GOTO then_8792981815290 - GOTO else_8792981815290 + IF internal_15 GOTO then_8781702323484 + GOTO else_8781702323484 - then_8792981815290: + then_8781702323484: internal_18 = ALLOCBOOL 0 internal_14 = internal_18 - GOTO endif_8792981815290 + GOTO endif_8781702323484 - else_8792981815290: + else_8781702323484: # Conditional internal_20 = ALLOCBOOL 0 internal_21 = ALLOCINT 2 @@ -806,15 +944,15 @@ function function_method7_at_D{ ARG x internal_22 = CALL function_equal internal_20 = internal_22 - IF internal_20 GOTO then_8792981815556 - GOTO else_8792981815556 + IF internal_20 GOTO then_8781702323490 + GOTO else_8781702323490 - then_8792981815556: + then_8781702323490: internal_23 = ALLOCBOOL 0 internal_19 = internal_23 - GOTO endif_8792981815556 + GOTO endif_8781702323490 - else_8792981815556: + else_8781702323490: internal_24 = ALLOCINT 3 ARG x @@ -824,21 +962,21 @@ function function_method7_at_D{ ARG internal_25 internal_26 = VCALL D function_method7_at_D internal_19 = internal_26 - GOTO endif_8792981815556 + GOTO endif_8781702323490 - endif_8792981815556: + endif_8781702323490: internal_14 = internal_19 - GOTO endif_8792981815290 + GOTO endif_8781702323484 - endif_8792981815290: + endif_8781702323484: internal_9 = internal_14 - GOTO endif_8792981815559 + GOTO endif_8781702323481 - endif_8792981815559: + endif_8781702323481: internal_1 = internal_9 - GOTO endif_8792981815568 + GOTO endif_8781702323502 - endif_8792981815568: + endif_8781702323502: RETURN internal_1 } @@ -848,6 +986,7 @@ function function___init___at_E{ LOCAL internal_0 # Integer 0 internal_0 = ALLOCINT 0 + SETATTR self var internal_0 RETURN self @@ -862,13 +1001,17 @@ function function_method6_at_E{ LOCAL internal_3 # Store an instance of the class A LOCAL internal_4 - x = 0 + # Let x: Int + x = ALLOCINT 0 internal_1 = ALLOCINT 8 ARG num ARG internal_1 internal_2 = CALL function_div - x = internal_2 + + ARG x + ARG internal_2 + x = CALL function_assign internal_3 = ALLOCATE A # Allocate the object A ARG internal_3 # Pass the instance to the constructor internal_3 = VCALL A function___init___at_A # Call the constructor @@ -948,15 +1091,15 @@ function function_c2i_at_A2I{ ARG internal_2 internal_3 = CALL function_equal internal_1 = internal_3 - IF internal_1 GOTO then_8792981816474 - GOTO else_8792981816474 + IF internal_1 GOTO then_8781702324152 + GOTO else_8781702324152 - then_8792981816474: + then_8781702324152: internal_4 = ALLOCINT 0 internal_0 = internal_4 - GOTO endif_8792981816474 + GOTO endif_8781702324152 - else_8792981816474: + else_8781702324152: # Conditional internal_6 = ALLOCBOOL 0 internal_7 = ALLOCSTR "1" @@ -965,15 +1108,15 @@ function function_c2i_at_A2I{ ARG internal_7 internal_8 = CALL function_equal internal_6 = internal_8 - IF internal_6 GOTO then_8792981816468 - GOTO else_8792981816468 + IF internal_6 GOTO then_8781702324146 + GOTO else_8781702324146 - then_8792981816468: + then_8781702324146: internal_9 = ALLOCINT 1 internal_5 = internal_9 - GOTO endif_8792981816468 + GOTO endif_8781702324146 - else_8792981816468: + else_8781702324146: # Conditional internal_11 = ALLOCBOOL 0 internal_12 = ALLOCSTR "2" @@ -982,15 +1125,15 @@ function function_c2i_at_A2I{ ARG internal_12 internal_13 = CALL function_equal internal_11 = internal_13 - IF internal_11 GOTO then_8792981816462 - GOTO else_8792981816462 + IF internal_11 GOTO then_8781702324140 + GOTO else_8781702324140 - then_8792981816462: + then_8781702324140: internal_14 = ALLOCINT 2 internal_10 = internal_14 - GOTO endif_8792981816462 + GOTO endif_8781702324140 - else_8792981816462: + else_8781702324140: # Conditional internal_16 = ALLOCBOOL 0 internal_17 = ALLOCSTR "3" @@ -999,15 +1142,15 @@ function function_c2i_at_A2I{ ARG internal_17 internal_18 = CALL function_equal internal_16 = internal_18 - IF internal_16 GOTO then_8792981816456 - GOTO else_8792981816456 + IF internal_16 GOTO then_8781702324134 + GOTO else_8781702324134 - then_8792981816456: + then_8781702324134: internal_19 = ALLOCINT 3 internal_15 = internal_19 - GOTO endif_8792981816456 + GOTO endif_8781702324134 - else_8792981816456: + else_8781702324134: # Conditional internal_21 = ALLOCBOOL 0 internal_22 = ALLOCSTR "4" @@ -1016,15 +1159,15 @@ function function_c2i_at_A2I{ ARG internal_22 internal_23 = CALL function_equal internal_21 = internal_23 - IF internal_21 GOTO then_8792981816450 - GOTO else_8792981816450 + IF internal_21 GOTO then_8781702324128 + GOTO else_8781702324128 - then_8792981816450: + then_8781702324128: internal_24 = ALLOCINT 4 internal_20 = internal_24 - GOTO endif_8792981816450 + GOTO endif_8781702324128 - else_8792981816450: + else_8781702324128: # Conditional internal_26 = ALLOCBOOL 0 internal_27 = ALLOCSTR "5" @@ -1033,15 +1176,15 @@ function function_c2i_at_A2I{ ARG internal_27 internal_28 = CALL function_equal internal_26 = internal_28 - IF internal_26 GOTO then_8792981816444 - GOTO else_8792981816444 + IF internal_26 GOTO then_8781702324122 + GOTO else_8781702324122 - then_8792981816444: + then_8781702324122: internal_29 = ALLOCINT 5 internal_25 = internal_29 - GOTO endif_8792981816444 + GOTO endif_8781702324122 - else_8792981816444: + else_8781702324122: # Conditional internal_31 = ALLOCBOOL 0 internal_32 = ALLOCSTR "6" @@ -1050,15 +1193,15 @@ function function_c2i_at_A2I{ ARG internal_32 internal_33 = CALL function_equal internal_31 = internal_33 - IF internal_31 GOTO then_8792981816438 - GOTO else_8792981816438 + IF internal_31 GOTO then_8781702324116 + GOTO else_8781702324116 - then_8792981816438: + then_8781702324116: internal_34 = ALLOCINT 6 internal_30 = internal_34 - GOTO endif_8792981816438 + GOTO endif_8781702324116 - else_8792981816438: + else_8781702324116: # Conditional internal_36 = ALLOCBOOL 0 internal_37 = ALLOCSTR "7" @@ -1067,15 +1210,15 @@ function function_c2i_at_A2I{ ARG internal_37 internal_38 = CALL function_equal internal_36 = internal_38 - IF internal_36 GOTO then_8792981816432 - GOTO else_8792981816432 + IF internal_36 GOTO then_8781702324110 + GOTO else_8781702324110 - then_8792981816432: + then_8781702324110: internal_39 = ALLOCINT 7 internal_35 = internal_39 - GOTO endif_8792981816432 + GOTO endif_8781702324110 - else_8792981816432: + else_8781702324110: # Conditional internal_41 = ALLOCBOOL 0 internal_42 = ALLOCSTR "8" @@ -1084,15 +1227,15 @@ function function_c2i_at_A2I{ ARG internal_42 internal_43 = CALL function_equal internal_41 = internal_43 - IF internal_41 GOTO then_8792981816426 - GOTO else_8792981816426 + IF internal_41 GOTO then_8781702324104 + GOTO else_8781702324104 - then_8792981816426: + then_8781702324104: internal_44 = ALLOCINT 8 internal_40 = internal_44 - GOTO endif_8792981816426 + GOTO endif_8781702324104 - else_8792981816426: + else_8781702324104: # Conditional internal_46 = ALLOCBOOL 0 internal_47 = ALLOCSTR "9" @@ -1101,58 +1244,58 @@ function function_c2i_at_A2I{ ARG internal_47 internal_48 = CALL function_equal internal_46 = internal_48 - IF internal_46 GOTO then_8792981816405 - GOTO else_8792981816405 + IF internal_46 GOTO then_8781702324083 + GOTO else_8781702324083 - then_8792981816405: + then_8781702324083: internal_49 = ALLOCINT 9 internal_45 = internal_49 - GOTO endif_8792981816405 + GOTO endif_8781702324083 - else_8792981816405: + else_8781702324083: ARG self internal_50 = VCALL A2I function_abort_at_Object internal_51 = ALLOCINT 0 internal_45 = internal_51 - GOTO endif_8792981816405 + GOTO endif_8781702324083 - endif_8792981816405: + endif_8781702324083: internal_40 = internal_45 - GOTO endif_8792981816426 + GOTO endif_8781702324104 - endif_8792981816426: + endif_8781702324104: internal_35 = internal_40 - GOTO endif_8792981816432 + GOTO endif_8781702324110 - endif_8792981816432: + endif_8781702324110: internal_30 = internal_35 - GOTO endif_8792981816438 + GOTO endif_8781702324116 - endif_8792981816438: + endif_8781702324116: internal_25 = internal_30 - GOTO endif_8792981816444 + GOTO endif_8781702324122 - endif_8792981816444: + endif_8781702324122: internal_20 = internal_25 - GOTO endif_8792981816450 + GOTO endif_8781702324128 - endif_8792981816450: + endif_8781702324128: internal_15 = internal_20 - GOTO endif_8792981816456 + GOTO endif_8781702324134 - endif_8792981816456: + endif_8781702324134: internal_10 = internal_15 - GOTO endif_8792981816462 + GOTO endif_8781702324140 - endif_8792981816462: + endif_8781702324140: internal_5 = internal_10 - GOTO endif_8792981816468 + GOTO endif_8781702324146 - endif_8792981816468: + endif_8781702324146: internal_0 = internal_5 - GOTO endif_8792981816474 + GOTO endif_8781702324152 - endif_8792981816474: + endif_8781702324152: RETURN internal_0 } @@ -1221,15 +1364,15 @@ function function_i2c_at_A2I{ ARG internal_2 internal_3 = CALL function_equal internal_1 = internal_3 - IF internal_1 GOTO then_8792981817308 - GOTO else_8792981817308 + IF internal_1 GOTO then_8781702324730 + GOTO else_8781702324730 - then_8792981817308: + then_8781702324730: internal_4 = ALLOCSTR "0" internal_0 = internal_4 - GOTO endif_8792981817308 + GOTO endif_8781702324730 - else_8792981817308: + else_8781702324730: # Conditional internal_6 = ALLOCBOOL 0 internal_7 = ALLOCINT 1 @@ -1238,15 +1381,15 @@ function function_i2c_at_A2I{ ARG internal_7 internal_8 = CALL function_equal internal_6 = internal_8 - IF internal_6 GOTO then_8792981817302 - GOTO else_8792981817302 + IF internal_6 GOTO then_8781702324724 + GOTO else_8781702324724 - then_8792981817302: + then_8781702324724: internal_9 = ALLOCSTR "1" internal_5 = internal_9 - GOTO endif_8792981817302 + GOTO endif_8781702324724 - else_8792981817302: + else_8781702324724: # Conditional internal_11 = ALLOCBOOL 0 internal_12 = ALLOCINT 2 @@ -1255,15 +1398,15 @@ function function_i2c_at_A2I{ ARG internal_12 internal_13 = CALL function_equal internal_11 = internal_13 - IF internal_11 GOTO then_8792981817296 - GOTO else_8792981817296 + IF internal_11 GOTO then_8781702324718 + GOTO else_8781702324718 - then_8792981817296: + then_8781702324718: internal_14 = ALLOCSTR "2" internal_10 = internal_14 - GOTO endif_8792981817296 + GOTO endif_8781702324718 - else_8792981817296: + else_8781702324718: # Conditional internal_16 = ALLOCBOOL 0 internal_17 = ALLOCINT 3 @@ -1272,15 +1415,15 @@ function function_i2c_at_A2I{ ARG internal_17 internal_18 = CALL function_equal internal_16 = internal_18 - IF internal_16 GOTO then_8792981817290 - GOTO else_8792981817290 + IF internal_16 GOTO then_8781702324712 + GOTO else_8781702324712 - then_8792981817290: + then_8781702324712: internal_19 = ALLOCSTR "3" internal_15 = internal_19 - GOTO endif_8792981817290 + GOTO endif_8781702324712 - else_8792981817290: + else_8781702324712: # Conditional internal_21 = ALLOCBOOL 0 internal_22 = ALLOCINT 4 @@ -1289,15 +1432,15 @@ function function_i2c_at_A2I{ ARG internal_22 internal_23 = CALL function_equal internal_21 = internal_23 - IF internal_21 GOTO then_8792981817284 - GOTO else_8792981817284 + IF internal_21 GOTO then_8781702324706 + GOTO else_8781702324706 - then_8792981817284: + then_8781702324706: internal_24 = ALLOCSTR "4" internal_20 = internal_24 - GOTO endif_8792981817284 + GOTO endif_8781702324706 - else_8792981817284: + else_8781702324706: # Conditional internal_26 = ALLOCBOOL 0 internal_27 = ALLOCINT 5 @@ -1306,15 +1449,15 @@ function function_i2c_at_A2I{ ARG internal_27 internal_28 = CALL function_equal internal_26 = internal_28 - IF internal_26 GOTO then_8792981817278 - GOTO else_8792981817278 + IF internal_26 GOTO then_8781702324700 + GOTO else_8781702324700 - then_8792981817278: + then_8781702324700: internal_29 = ALLOCSTR "5" internal_25 = internal_29 - GOTO endif_8792981817278 + GOTO endif_8781702324700 - else_8792981817278: + else_8781702324700: # Conditional internal_31 = ALLOCBOOL 0 internal_32 = ALLOCINT 6 @@ -1323,15 +1466,15 @@ function function_i2c_at_A2I{ ARG internal_32 internal_33 = CALL function_equal internal_31 = internal_33 - IF internal_31 GOTO then_8792981817272 - GOTO else_8792981817272 + IF internal_31 GOTO then_8781702324694 + GOTO else_8781702324694 - then_8792981817272: + then_8781702324694: internal_34 = ALLOCSTR "6" internal_30 = internal_34 - GOTO endif_8792981817272 + GOTO endif_8781702324694 - else_8792981817272: + else_8781702324694: # Conditional internal_36 = ALLOCBOOL 0 internal_37 = ALLOCINT 7 @@ -1340,15 +1483,15 @@ function function_i2c_at_A2I{ ARG internal_37 internal_38 = CALL function_equal internal_36 = internal_38 - IF internal_36 GOTO then_8792981817266 - GOTO else_8792981817266 + IF internal_36 GOTO then_8781702324688 + GOTO else_8781702324688 - then_8792981817266: + then_8781702324688: internal_39 = ALLOCSTR "7" internal_35 = internal_39 - GOTO endif_8792981817266 + GOTO endif_8781702324688 - else_8792981817266: + else_8781702324688: # Conditional internal_41 = ALLOCBOOL 0 internal_42 = ALLOCINT 8 @@ -1357,15 +1500,15 @@ function function_i2c_at_A2I{ ARG internal_42 internal_43 = CALL function_equal internal_41 = internal_43 - IF internal_41 GOTO then_8792981817260 - GOTO else_8792981817260 + IF internal_41 GOTO then_8781702324682 + GOTO else_8781702324682 - then_8792981817260: + then_8781702324682: internal_44 = ALLOCSTR "8" internal_40 = internal_44 - GOTO endif_8792981817260 + GOTO endif_8781702324682 - else_8792981817260: + else_8781702324682: # Conditional internal_46 = ALLOCBOOL 0 internal_47 = ALLOCINT 9 @@ -1374,58 +1517,58 @@ function function_i2c_at_A2I{ ARG internal_47 internal_48 = CALL function_equal internal_46 = internal_48 - IF internal_46 GOTO then_8792981817239 - GOTO else_8792981817239 + IF internal_46 GOTO then_8781702324661 + GOTO else_8781702324661 - then_8792981817239: + then_8781702324661: internal_49 = ALLOCSTR "9" internal_45 = internal_49 - GOTO endif_8792981817239 + GOTO endif_8781702324661 - else_8792981817239: + else_8781702324661: ARG self internal_50 = VCALL A2I function_abort_at_Object internal_51 = ALLOCSTR "" internal_45 = internal_51 - GOTO endif_8792981817239 + GOTO endif_8781702324661 - endif_8792981817239: + endif_8781702324661: internal_40 = internal_45 - GOTO endif_8792981817260 + GOTO endif_8781702324682 - endif_8792981817260: + endif_8781702324682: internal_35 = internal_40 - GOTO endif_8792981817266 + GOTO endif_8781702324688 - endif_8792981817266: + endif_8781702324688: internal_30 = internal_35 - GOTO endif_8792981817272 + GOTO endif_8781702324694 - endif_8792981817272: + endif_8781702324694: internal_25 = internal_30 - GOTO endif_8792981817278 + GOTO endif_8781702324700 - endif_8792981817278: + endif_8781702324700: internal_20 = internal_25 - GOTO endif_8792981817284 + GOTO endif_8781702324706 - endif_8792981817284: + endif_8781702324706: internal_15 = internal_20 - GOTO endif_8792981817290 + GOTO endif_8781702324712 - endif_8792981817290: + endif_8781702324712: internal_10 = internal_15 - GOTO endif_8792981817296 + GOTO endif_8781702324718 - endif_8792981817296: + endif_8781702324718: internal_5 = internal_10 - GOTO endif_8792981817302 + GOTO endif_8781702324724 - endif_8792981817302: + endif_8781702324724: internal_0 = internal_5 - GOTO endif_8792981817308 + GOTO endif_8781702324730 - endif_8792981817308: + endif_8781702324730: RETURN internal_0 } @@ -1480,15 +1623,15 @@ function function_a2i_at_A2I{ ARG internal_3 internal_4 = CALL function_equal internal_1 = internal_4 - IF internal_1 GOTO then_8792981817498 - GOTO else_8792981817498 + IF internal_1 GOTO then_8781702325176 + GOTO else_8781702325176 - then_8792981817498: + then_8781702325176: internal_5 = ALLOCINT 0 internal_0 = internal_5 - GOTO endif_8792981817498 + GOTO endif_8781702325176 - else_8792981817498: + else_8781702325176: # Conditional internal_7 = ALLOCBOOL 0 internal_8 = ALLOCINT 0 @@ -1503,10 +1646,10 @@ function function_a2i_at_A2I{ ARG internal_11 internal_12 = CALL function_equal internal_7 = internal_12 - IF internal_7 GOTO then_8792981817513 - GOTO else_8792981817513 + IF internal_7 GOTO then_8781702325191 + GOTO else_8781702325191 - then_8792981817513: + then_8781702325191: internal_13 = ALLOCINT 1 ARG s internal_14 = VCALL String function_length_at_String @@ -1522,12 +1665,19 @@ function function_a2i_at_A2I{ ARG self ARG internal_17 internal_18 = VCALL A2I function_a2i_aux_at_A2I - internal_21 = XOR internal_18 internal_20 # Getting the complement a1 of internal_18 - internal_21 = internal_21 + internal_19 # Adding 1 to the complement a1 we get the complement a2 of internal_18 + internal_19 = ALLOCINT 1 + internal_20 = ALLOCINT 4294967295 + internal_21 = ALLOCINT 0 + ARG internal_18 + ARG internal_20 + internal_21 = CALL function_xor + ARG internal_21 + ARG internal_19 + internal_21 = CALL function_add internal_6 = internal_21 - GOTO endif_8792981817513 + GOTO endif_8781702325191 - else_8792981817513: + else_8781702325191: # Conditional internal_23 = ALLOCBOOL 0 internal_24 = ALLOCINT 0 @@ -1542,10 +1692,10 @@ function function_a2i_at_A2I{ ARG internal_27 internal_28 = CALL function_equal internal_23 = internal_28 - IF internal_23 GOTO then_8792981817507 - GOTO else_8792981817507 + IF internal_23 GOTO then_8781702325185 + GOTO else_8781702325185 - then_8792981817507: + then_8781702325185: internal_29 = ALLOCINT 1 ARG s internal_30 = VCALL String function_length_at_String @@ -1562,24 +1712,24 @@ function function_a2i_at_A2I{ ARG internal_33 internal_34 = VCALL A2I function_a2i_aux_at_A2I internal_22 = internal_34 - GOTO endif_8792981817507 + GOTO endif_8781702325185 - else_8792981817507: + else_8781702325185: ARG self ARG s internal_35 = VCALL A2I function_a2i_aux_at_A2I internal_22 = internal_35 - GOTO endif_8792981817507 + GOTO endif_8781702325185 - endif_8792981817507: + endif_8781702325185: internal_6 = internal_22 - GOTO endif_8792981817513 + GOTO endif_8781702325191 - endif_8792981817513: + endif_8781702325191: internal_0 = internal_6 - GOTO endif_8792981817498 + GOTO endif_8781702325176 - endif_8792981817498: + endif_8781702325176: RETURN internal_0 } @@ -1593,61 +1743,79 @@ function function_a2i_aux_at_A2I{ LOCAL internal_3 LOCAL i LOCAL internal_5 # Integer 0 - LOCAL internal_6 - LOCAL internal_7 # Store the result of the operation function_less_than - LOCAL internal_8 # Integer 10 - LOCAL internal_9 # Store the result of the operation function_mult - LOCAL internal_10 # Integer 1 + LOCAL internal_6 # Store the result of the operation function_less_than + LOCAL internal_7 # Integer 10 + LOCAL internal_8 # Store the result of the operation function_mult + LOCAL internal_9 # Integer 1 + LOCAL internal_10 LOCAL internal_11 - LOCAL internal_12 - LOCAL internal_13 # Store the result of the operation function_add - LOCAL internal_14 # Integer 1 - LOCAL internal_15 # Store the result of the operation function_add + LOCAL internal_12 # Store the result of the operation function_add + LOCAL internal_13 # Integer 1 + LOCAL internal_14 # Store the result of the operation function_add + # Let int: Int + internal_1 = ALLOCINT 0 - int = internal_1 + ARG int + ARG internal_1 + int = CALL function_assign + # Let j: Int + ARG s internal_3 = VCALL String function_length_at_String - j = internal_3 + ARG j + ARG internal_3 + j = CALL function_assign + # Let i: Int + internal_5 = ALLOCINT 0 - i = internal_5 - while_start_8792981818167: + ARG i + ARG internal_5 + i = CALL function_assign + + # While loop + while_start_8781702325589: ARG i ARG j - internal_7 = CALL function_less_than - internal_6 = internal_7 - IF internal_6 GOTO while_body_8792981818167 - GOTO while_end_8792981818167 + internal_6 = CALL function_less_than + IF internal_6 GOTO while_body_8781702325589 + GOTO while_end_8781702325589 - while_body_8792981818167: - internal_8 = ALLOCINT 10 + while_body_8781702325589: + internal_7 = ALLOCINT 10 ARG int - ARG internal_8 - internal_9 = CALL function_mult - internal_10 = ALLOCINT 1 + ARG internal_7 + internal_8 = CALL function_mult + internal_9 = ALLOCINT 1 ARG s ARG i - ARG internal_10 - internal_11 = VCALL String function_substr_at_String + ARG internal_9 + internal_10 = VCALL String function_substr_at_String ARG self + ARG internal_10 + internal_11 = VCALL A2I function_c2i_at_A2I + + ARG internal_8 ARG internal_11 - internal_12 = VCALL A2I function_c2i_at_A2I + internal_12 = CALL function_add - ARG internal_9 + ARG int ARG internal_12 - internal_13 = CALL function_add - int = internal_13 - internal_14 = ALLOCINT 1 + int = CALL function_assign + internal_13 = ALLOCINT 1 + + ARG i + ARG internal_13 + internal_14 = CALL function_add ARG i ARG internal_14 - internal_15 = CALL function_add - i = internal_15 - GOTO while_start_8792981818167 + i = CALL function_assign + GOTO while_start_8781702325589 - while_end_8792981818167: + while_end_8781702325589: RETURN int } @@ -1682,15 +1850,15 @@ function function_i2a_at_A2I{ ARG internal_2 internal_3 = CALL function_equal internal_1 = internal_3 - IF internal_1 GOTO then_8792981818296 - GOTO else_8792981818296 + IF internal_1 GOTO then_8781702325718 + GOTO else_8781702325718 - then_8792981818296: + then_8781702325718: internal_4 = ALLOCSTR "0" internal_0 = internal_4 - GOTO endif_8792981818296 + GOTO endif_8781702325718 - else_8792981818296: + else_8781702325718: # Conditional internal_6 = ALLOCBOOL 0 internal_7 = ALLOCINT 0 @@ -1699,21 +1867,28 @@ function function_i2a_at_A2I{ ARG i internal_8 = CALL function_less_than internal_6 = internal_8 - IF internal_6 GOTO then_8792981818302 - GOTO else_8792981818302 + IF internal_6 GOTO then_8781702325724 + GOTO else_8781702325724 - then_8792981818302: + then_8781702325724: ARG self ARG i internal_9 = VCALL A2I function_i2a_aux_at_A2I internal_5 = internal_9 - GOTO endif_8792981818302 + GOTO endif_8781702325724 - else_8792981818302: + else_8781702325724: internal_10 = ALLOCSTR "-" internal_11 = ALLOCINT 1 - internal_14 = XOR internal_11 internal_13 # Getting the complement a1 of internal_11 - internal_14 = internal_14 + internal_12 # Adding 1 to the complement a1 we get the complement a2 of internal_11 + internal_12 = ALLOCINT 1 + internal_13 = ALLOCINT 4294967295 + internal_14 = ALLOCINT 0 + ARG internal_11 + ARG internal_13 + internal_14 = CALL function_xor + ARG internal_14 + ARG internal_12 + internal_14 = CALL function_add ARG i ARG internal_14 @@ -1725,13 +1900,13 @@ function function_i2a_at_A2I{ ARG internal_16 internal_17 = VCALL String function_concat_at_String internal_5 = internal_17 - GOTO endif_8792981818302 + GOTO endif_8781702325724 - endif_8792981818302: + endif_8781702325724: internal_0 = internal_5 - GOTO endif_8792981818296 + GOTO endif_8781702325718 - endif_8792981818296: + endif_8781702325718: RETURN internal_0 } @@ -1762,21 +1937,25 @@ function function_i2a_aux_at_A2I{ ARG internal_2 internal_3 = CALL function_equal internal_1 = internal_3 - IF internal_1 GOTO then_8792981818670 - GOTO else_8792981818670 + IF internal_1 GOTO then_8781702326348 + GOTO else_8781702326348 - then_8792981818670: + then_8781702326348: internal_4 = ALLOCSTR "" internal_0 = internal_4 - GOTO endif_8792981818670 + GOTO endif_8781702326348 + + else_8781702326348: + # Let next: Int - else_8792981818670: internal_6 = ALLOCINT 10 ARG i ARG internal_6 internal_7 = CALL function_div - next = internal_7 + ARG next + ARG internal_7 + next = CALL function_assign ARG self ARG next internal_8 = VCALL A2I function_i2a_aux_at_A2I @@ -1796,9 +1975,9 @@ function function_i2a_aux_at_A2I{ ARG internal_12 internal_13 = VCALL String function_concat_at_String internal_0 = internal_13 - GOTO endif_8792981818670 + GOTO endif_8781702326348 - endif_8792981818670: + endif_8781702326348: RETURN internal_0 } @@ -1806,14 +1985,22 @@ function function___init___at_Main{ PARAM self LOCAL internal_0 # String "" - LOCAL internal_1 # Boolean true + LOCAL internal_1 # Null + LOCAL internal_2 # Null + LOCAL internal_3 # Boolean true internal_0 = ALLOCSTR "" + SETATTR self char internal_0 - SETATTR self avar NULL - SETATTR self a_var NULL - internal_1 = ALLOCBOOL 1 - SETATTR self flag internal_1 + internal_1 = ALLOCNULL + + SETATTR self avar internal_1 + internal_2 = ALLOCNULL + + SETATTR self a_var internal_2 + internal_3 = ALLOCBOOL 1 + + SETATTR self flag internal_3 RETURN self } @@ -2014,13 +2201,21 @@ function function_get_int_at_Main{ LOCAL internal_3 LOCAL internal_4 + # Let z: A2I + internal_1 = ALLOCATE A2I # Allocate the object A2I ARG internal_1 # Pass the instance to the constructor internal_1 = VCALL A2I function___init___at_A2I # Call the constructor - z = internal_1 + ARG z + ARG internal_1 + z = CALL function_assign + # Let s: String + ARG self internal_3 = VCALL Main function_prompt_at_Main - s = internal_3 + ARG s + ARG internal_3 + s = CALL function_assign ARG z ARG s internal_4 = VCALL A2I function_a2i_at_A2I @@ -2054,7 +2249,11 @@ function function_is_even_at_Main{ LOCAL internal_20 # Store the result of the operation function_sub LOCAL internal_21 - x = num + # Let x: Int + + ARG x + ARG num + x = CALL function_assign # Conditional internal_2 = ALLOCBOOL 0 internal_3 = ALLOCINT 0 @@ -2063,19 +2262,26 @@ function function_is_even_at_Main{ ARG internal_3 internal_4 = CALL function_less_than internal_2 = internal_4 - IF internal_2 GOTO then_8792981820167 - GOTO else_8792981820167 + IF internal_2 GOTO then_8781702295071 + GOTO else_8781702295071 - then_8792981820167: - internal_7 = XOR x internal_6 # Getting the complement a1 of x - internal_7 = internal_7 + internal_5 # Adding 1 to the complement a1 we get the complement a2 of x + then_8781702295071: + internal_5 = ALLOCINT 1 + internal_6 = ALLOCINT 4294967295 + internal_7 = ALLOCINT 0 + ARG x + ARG internal_6 + internal_7 = CALL function_xor + ARG internal_7 + ARG internal_5 + internal_7 = CALL function_add ARG self ARG internal_7 internal_8 = VCALL Main function_is_even_at_Main internal_1 = internal_8 - GOTO endif_8792981820167 + GOTO endif_8781702295071 - else_8792981820167: + else_8781702295071: # Conditional internal_10 = ALLOCBOOL 0 internal_11 = ALLOCINT 0 @@ -2084,15 +2290,15 @@ function function_is_even_at_Main{ ARG x internal_12 = CALL function_equal internal_10 = internal_12 - IF internal_10 GOTO then_8792981820170 - GOTO else_8792981820170 + IF internal_10 GOTO then_8781702295074 + GOTO else_8781702295074 - then_8792981820170: + then_8781702295074: internal_13 = ALLOCBOOL 1 internal_9 = internal_13 - GOTO endif_8792981820170 + GOTO endif_8781702295074 - else_8792981820170: + else_8781702295074: # Conditional internal_15 = ALLOCBOOL 0 internal_16 = ALLOCINT 1 @@ -2101,15 +2307,15 @@ function function_is_even_at_Main{ ARG x internal_17 = CALL function_equal internal_15 = internal_17 - IF internal_15 GOTO then_8792981820176 - GOTO else_8792981820176 + IF internal_15 GOTO then_8781702295080 + GOTO else_8781702295080 - then_8792981820176: + then_8781702295080: internal_18 = ALLOCBOOL 0 internal_14 = internal_18 - GOTO endif_8792981820176 + GOTO endif_8781702295080 - else_8792981820176: + else_8781702295080: internal_19 = ALLOCINT 2 ARG x @@ -2119,17 +2325,17 @@ function function_is_even_at_Main{ ARG internal_20 internal_21 = VCALL Main function_is_even_at_Main internal_14 = internal_21 - GOTO endif_8792981820176 + GOTO endif_8781702295080 - endif_8792981820176: + endif_8781702295080: internal_9 = internal_14 - GOTO endif_8792981820170 + GOTO endif_8781702295074 - endif_8792981820170: + endif_8781702295074: internal_1 = internal_9 - GOTO endif_8792981820167 + GOTO endif_8781702295071 - endif_8792981820167: + endif_8781702295071: RETURN internal_1 } @@ -2137,156 +2343,200 @@ function function_class_type_at_Main{ PARAM self PARAM var - LOCAL internal_0 # Count of ancestors of the switch expression - LOCAL internal_1 # Switch expression type - LOCAL internal_2 # Ancestor type - LOCAL internal_3 # Step 1 comparison result - LOCAL internal_4 # Step 1 Array of ancestors - LOCAL internal_5 # Integer 0 - LOCAL internal_6 # Null pointer - LOCAL internal_7 # Step 2 iteration index - LOCAL internal_8 # Step 2 comparison result - LOCAL internal_9 # Array to store the branch types - LOCAL internal_10 # Array to store the nearest ancestor index of the expression type of the i-th branch type - LOCAL internal_11 # Address of the type A - LOCAL internal_12 # Address of the type B - LOCAL internal_13 # Address of the type C - LOCAL internal_14 # Address of the type D - LOCAL internal_15 # Address of the type E - LOCAL internal_16 # Address of the type Object - LOCAL internal_17 # Step 3 - Iteration index of the branch types array - LOCAL internal_18 # Step 3 - Comparison for the index of the branch types array - LOCAL internal_19 # Step 3 - Type of the i-th branch - LOCAL internal_20 # Step 3 - Index of the ancestor - LOCAL internal_21 # Step 3 - Comparison for the index of the ancestor - LOCAL internal_22 # Step 3 - Type of the j-th ancestor - LOCAL internal_23 # Step 3 - Comparison for the branch type nad the ancestor type - LOCAL internal_24 # Step 4 - Iteration index - LOCAL internal_25 # Step 4 - Index of the minimum counter in the counter array - LOCAL internal_26 # Step 4 - Temporary variable - LOCAL internal_27 # Step 4 - Current minimum of the counter array - LOCAL internal_28 # Step 4 - Comparison for the minimum of the counter array - LOCAL internal_29 # Step 5 - Bool array - LOCAL internal_30 # Step 5 - Exists an error - LOCAL internal_31 # Step 5 - Comparison for the correct branch result - LOCAL internal_32 # Result of the switch expression address + LOCAL internal_0 # Constant Integer 0 + LOCAL internal_1 # Constant Integer 1 + LOCAL internal_2 # Constant Integer 6 + LOCAL internal_3 # Null pointer + LOCAL internal_4 # Count of ancestors of the switch expression + LOCAL internal_5 # Switch expression type + LOCAL internal_6 # Ancestor type + LOCAL internal_7 # Step 1 comparison result + LOCAL internal_8 # Step 1 Array of ancestors + LOCAL internal_9 # Step 2 iteration index + LOCAL internal_10 # Step 2 comparison result + LOCAL internal_11 # Array to store the branch types + LOCAL internal_12 # Array to store the nearest ancestor index of the expression type of the i-th branch type + LOCAL internal_13 # Address of the type A + LOCAL internal_14 # Index of the type A + LOCAL internal_15 # Address of the type B + LOCAL internal_16 # Index of the type B + LOCAL internal_17 # Address of the type C + LOCAL internal_18 # Index of the type C + LOCAL internal_19 # Address of the type D + LOCAL internal_20 # Index of the type D + LOCAL internal_21 # Address of the type E + LOCAL internal_22 # Index of the type E + LOCAL internal_23 # Address of the type Object + LOCAL internal_24 # Index of the type Object + LOCAL internal_25 # Step 3 - Iteration index of the branch types array + LOCAL internal_26 # Step 3 - Comparison for the index of the branch types array + LOCAL internal_27 # Step 3 - Type of the i-th branch + LOCAL internal_28 # Step 3 - Index of the ancestor + LOCAL internal_29 # Step 3 - Comparison for the index of the ancestor + LOCAL internal_30 # Step 3 - Type of the j-th ancestor + LOCAL internal_31 # Step 3 - Comparison for the branch type nad the ancestor type + LOCAL internal_32 # Step 4 - Iteration index + LOCAL internal_33 # Step 4 - Index of the minimum counter in the counter array + LOCAL internal_34 # Step 4 - Temporary variable + LOCAL internal_35 # Step 4 - Current minimum of the counter array + LOCAL internal_36 # Step 4 - Comparison for the minimum of the counter array + LOCAL internal_37 # endl + LOCAL internal_38 # space + LOCAL internal_39 # Step 5 - Bool array + LOCAL internal_40 # Step 5 - Branch 0 + LOCAL internal_41 # Step 5 - Branch 1 + LOCAL internal_42 # Step 5 - Branch 2 + LOCAL internal_43 # Step 5 - Branch 3 + LOCAL internal_44 # Step 5 - Branch 4 + LOCAL internal_45 # Step 5 - Branch 5 + LOCAL internal_46 # Step 5 - Exists an error + LOCAL internal_47 # Step 5 - Comparison for the correct branch result + LOCAL internal_48 # Index 0 + LOCAL internal_49 # Index 1 + LOCAL internal_50 # Index 2 + LOCAL internal_51 # Index 3 + LOCAL internal_52 # Index 4 + LOCAL internal_53 # Index 5 + LOCAL internal_54 # Result of the switch expression address LOCAL a # Specialiced variable for the branch A - LOCAL internal_34 # String "Class type is now A\n" - LOCAL internal_35 + LOCAL internal_56 # String "Class type is now A\n" + LOCAL internal_57 LOCAL b # Specialiced variable for the branch B - LOCAL internal_37 # String "Class type is now B\n" - LOCAL internal_38 + LOCAL internal_59 # String "Class type is now B\n" + LOCAL internal_60 LOCAL c # Specialiced variable for the branch C - LOCAL internal_40 # String "Class type is now C\n" - LOCAL internal_41 + LOCAL internal_62 # String "Class type is now C\n" + LOCAL internal_63 LOCAL d # Specialiced variable for the branch D - LOCAL internal_43 # String "Class type is now D\n" - LOCAL internal_44 + LOCAL internal_65 # String "Class type is now D\n" + LOCAL internal_66 LOCAL e # Specialiced variable for the branch E - LOCAL internal_46 # String "Class type is now E\n" - LOCAL internal_47 + LOCAL internal_68 # String "Class type is now E\n" + LOCAL internal_69 LOCAL o # Specialiced variable for the branch Object - LOCAL internal_49 # String "Oooops\n" - LOCAL internal_50 + LOCAL internal_71 # String "Oooops\n" + LOCAL internal_72 + internal_0 = ALLOCINT 0 + internal_1 = ALLOCINT 1 + internal_2 = ALLOCINT 6 + internal_3 = ALLOCNULL + internal_4 = ALLOCINT 0 + internal_7 = ALLOCBOOL 0 + # Switch Case Algorithm Steps: # 1 - Count how many ancestors has the dynamic type of the expression # 2 - Create an array of the same size where to store the ancestors # 3 - For each branch type, store the ancestor index that match with it, if no one match, store `count of ancestors` # 4 - Find the minimum of the ancestors indexes # 5 - With the minimum index, get the correct branch type - internal_5 = ALLOCINT 0 - internal_3 = ALLOCBOOL 0 # Initialize the comparison result # ######################################################################## # # Step 1 - Count how many ancestors has the dynamic type of the expression # # ######################################################################## # - internal_1 = TYPEOF var # Get the switch expression type - internal_2 = internal_1 # The first ancestor will be the type itself - internal_0 = internal_5 # Initialize the counter - while_start_8792981820269: - internal_3 = internal_2 == 0 - IF internal_3 GOTO while_end_8792981820269 - internal_0 = internal_0 + 1 # Increment the counter - internal_2 = ANCESTOR internal_2 - GOTO while_start_8792981820269 - while_end_8792981820269: + internal_5 = TYPEOF var # Get the switch expression type + internal_6 = internal_5 # The first ancestor will be the type itself + while_start_8781702295173: + internal_7 = EQUALADDR internal_6 internal_3 + IF internal_7 GOTO while_end_8781702295173 + # Increment the count of ancestors + ARG internal_4 + ARG internal_1 + internal_4 = CALL function_add + internal_6 = ANCESTOR internal_6 + GOTO while_start_8781702295173 + while_end_8781702295173: # ###################################################################### # # Step 2 - Create an array of the same size where to store the ancestors # # ###################################################################### # - internal_2 = internal_1 # The first ancestor will be the type itself - internal_4 = ARRAY internal_0 # Create an array of ancestors - internal_7 = 0 # Initialize the index with the value 0 - foreach_start_8792981820269: - internal_8 = internal_7 < internal_0 # Check if the index is less than the counter - IF internal_8 GOTO foreach_body_8792981820269 - GOTO foreach_end_8792981820269 - foreach_body_8792981820269: - SETINDEX internal_4 internal_7 internal_2 # Set the index of the array with the ancestor type - internal_2 = ANCESTOR internal_2 # Get the next ancestor - internal_7 = internal_7 + 1 # Increment index - GOTO foreach_start_8792981820269 - foreach_end_8792981820269: - - # #################################################################################################### # - # Step 3 - For each branch type, store the ancestor index that match with it (Simulating a double for) # - # #################################################################################################### # - internal_9 = ARRAY 6 - internal_10 = ARRAY 6 - internal_11 = TYPEADDR A - SETINDEX internal_9 0 internal_11 - SETINDEX internal_10 0 internal_0 - internal_12 = TYPEADDR B - SETINDEX internal_9 1 internal_12 - SETINDEX internal_10 1 internal_0 - internal_13 = TYPEADDR C - SETINDEX internal_9 2 internal_13 - SETINDEX internal_10 2 internal_0 - internal_14 = TYPEADDR D - SETINDEX internal_9 3 internal_14 - SETINDEX internal_10 3 internal_0 - internal_15 = TYPEADDR E - SETINDEX internal_9 4 internal_15 - SETINDEX internal_10 4 internal_0 - internal_16 = TYPEADDR Object - SETINDEX internal_9 5 internal_16 - SETINDEX internal_10 5 internal_0 - - # ############# # - # Outer Foreach # - # ############# # - internal_17 = 0 # Initialize the index i of the case to 0 - foreach_type_start_8792981820269: - internal_18 = internal_17 < 6 # Check if the type index is less than the count of branches - IF internal_18 GOTO foreach_type_body_8792981820269 - GOTO foreach_type_end_8792981820269 - foreach_type_body_8792981820269: - internal_19 = GETINDEX internal_9 internal_17 # Get the type of the i-th branch - - # ############# # - # Inner Foreach # - # ############# # - internal_20 = 0 # Initialize the index j of the case to 0 - foreach_ancestor_start_8792981820269: - internal_21 = internal_20 < internal_0 # Check if the case index is less than the count of ancestors - IF internal_21 GOTO foreach_ancestor_body_8792981820269 - GOTO foreach_ancestor_end_8792981820269 - foreach_ancestor_body_8792981820269: - internal_22 = GETINDEX internal_4 internal_20 # Get the j-th ancestor type - internal_23 = internal_19 == internal_22 # Compare if the type of the i-th branch is equal to the j-th ancestor - IF internal_23 GOTO foreach_ancestor_end_8792981820269 # If the types are equal, we have a match, then we can exit - internal_20 = internal_20 + 1 # Increment the ancestor index - GOTO foreach_ancestor_start_8792981820269 - foreach_ancestor_end_8792981820269: - SETINDEX internal_10 internal_17 internal_20 # Set the counter of the i-th branch equals to j + internal_6 = internal_5 # The first ancestor will be the type itself + internal_8 = ARRAY internal_4 # Create an array of ancestors + internal_9 = ALLOCINT 0 + internal_10 = ALLOCBOOL 0 + foreach_start_8781702295173: + ARG internal_9 + ARG internal_4 + internal_10 = CALL function_less_than + IF internal_10 GOTO foreach_body_8781702295173 + GOTO foreach_end_8781702295173 + foreach_body_8781702295173: + SETINDEX internal_8 internal_9 internal_6 # Set the index of the array with the ancestor type + internal_6 = ANCESTOR internal_6 # Get the next ancestor + ARG internal_9 + ARG internal_1 + internal_9 = CALL function_add + GOTO foreach_start_8781702295173 + foreach_end_8781702295173: + + internal_11 = ARRAY internal_2 + internal_12 = ARRAY internal_2 + internal_14 = ALLOCINT 0 + internal_13 = TYPEADDR A + SETINDEX internal_11 internal_14 internal_13 + SETVALUEINDEX internal_12 internal_14 internal_4 + internal_16 = ALLOCINT 1 + internal_15 = TYPEADDR B + SETINDEX internal_11 internal_16 internal_15 + SETVALUEINDEX internal_12 internal_16 internal_4 + internal_18 = ALLOCINT 2 + internal_17 = TYPEADDR C + SETINDEX internal_11 internal_18 internal_17 + SETVALUEINDEX internal_12 internal_18 internal_4 + internal_20 = ALLOCINT 3 + internal_19 = TYPEADDR D + SETINDEX internal_11 internal_20 internal_19 + SETVALUEINDEX internal_12 internal_20 internal_4 + internal_22 = ALLOCINT 4 + internal_21 = TYPEADDR E + SETINDEX internal_11 internal_22 internal_21 + SETVALUEINDEX internal_12 internal_22 internal_4 + internal_24 = ALLOCINT 5 + internal_23 = TYPEADDR Object + SETINDEX internal_11 internal_24 internal_23 + SETVALUEINDEX internal_12 internal_24 internal_4 + + internal_25 = ALLOCINT 0 + internal_26 = ALLOCBOOL 0 + internal_28 = ALLOCINT 0 + internal_29 = ALLOCBOOL 0 + internal_31 = ALLOCBOOL 0 + foreach_type_start_8781702295173: + ARG internal_25 + ARG internal_2 + internal_26 = CALL function_less_than + IF internal_26 GOTO foreach_type_body_8781702295173 + GOTO foreach_type_end_8781702295173 + foreach_type_body_8781702295173: + internal_27 = GETINDEX internal_11 internal_25 # Get the type of the i-th branch + ARG internal_28 + ARG internal_0 + internal_28 = CALL function_assign + foreach_ancestor_start_8781702295173: + ARG internal_28 + ARG internal_4 + internal_29 = CALL function_less_than + IF internal_29 GOTO foreach_ancestor_body_8781702295173 + GOTO foreach_ancestor_end_8781702295173 + foreach_ancestor_body_8781702295173: + internal_30 = GETINDEX internal_8 internal_28 # Get the j-th ancestor type + internal_31 = EQUALADDR internal_27 internal_30 # Compare if the type of the i-th branch is equal to the j-th ancestor + IF internal_31 GOTO foreach_ancestor_end_8781702295173 # If the types are equal, we have a match, then we can exit + ARG internal_28 + ARG internal_1 + internal_28 = CALL function_add + GOTO foreach_ancestor_start_8781702295173 + foreach_ancestor_end_8781702295173: + SETVALUEINDEX internal_12 internal_25 internal_28 # Set the counter of the i-th branch equals to j # #################### # # End of Inner Foreach # # #################### # - internal_17 = internal_17 + 1 # Increment type index - GOTO foreach_type_start_8792981820269 - foreach_type_end_8792981820269: + ARG internal_25 + ARG internal_1 + internal_25 = CALL function_add + GOTO foreach_type_start_8781702295173 + foreach_type_end_8781702295173: # ################# # # End Outer Foreach # # ################# # @@ -2294,112 +2544,181 @@ function function_class_type_at_Main{ # ######################################## # # Step 4 - Find the minimum ancestor index # # ######################################## # - internal_24 = 0 # Initialize the index of the counter array to 0 - internal_25 = 0 # Initialize the index of the lower counter to 0 - internal_27 = internal_0 # Initialize the current minimum to `count of ancestors` - foreach_min_start_8792981820269: - internal_28 = internal_24 < 6 # Check if the index of the lower counter is less than the count of branches - IF internal_28 GOTO foreach_min_body_8792981820269 - GOTO foreach_min_end_8792981820269 - foreach_min_body_8792981820269: - internal_26 = GETINDEX internal_10 internal_24 # Get the nearest ancestor index of the i-th branch type - internal_28 = internal_26 < internal_27 # Compare if the nearest ancestor index is less than the current minimum - IF internal_28 GOTO update_min_8792981820269 - GOTO foreach_min_end_8792981820269 - update_min_8792981820269: - internal_27 = internal_26 # Update the current minimum - internal_25 = internal_24 # Update the index of the lower counter - update_min_end_8792981820269: - internal_24 = internal_24 + 1 # Increment the index of the counter array - GOTO foreach_min_start_8792981820269 - foreach_min_end_8792981820269: + internal_37 = ALLOCSTR "\n" + internal_38 = ALLOCSTR " " + internal_32 = ALLOCINT 0 + internal_33 = ALLOCINT 0 + internal_34 = ALLOCINT 0 + internal_35 = ALLOCINT 0 + internal_36 = ALLOCBOOL 0 + ARG internal_35 + ARG internal_4 + internal_35 = CALL function_assign + foreach_min_start_8781702295173: + ARG internal_32 + ARG internal_2 + internal_36 = CALL function_less_than + IF internal_36 GOTO foreach_min_body_8781702295173 + GOTO foreach_min_end_8781702295173 + foreach_min_body_8781702295173: + internal_34 = GETVALUEINDEX internal_12 internal_32 # Get the nearest ancestor index of the i-th branch type + ARG internal_34 + ARG internal_35 + internal_36 = CALL function_less_than + IF internal_36 GOTO update_min_8781702295173 + GOTO update_min_end_8781702295173 + update_min_8781702295173: + ARG internal_35 + ARG internal_34 + internal_35 = CALL function_assign + ARG internal_33 + ARG internal_32 + internal_33 = CALL function_assign + update_min_end_8781702295173: + ARG internal_32 + ARG internal_1 + internal_32 = CALL function_add + GOTO foreach_min_start_8781702295173 + foreach_min_end_8781702295173: # ################################################################# # # Step 5 - Using the minimun ancestor index find the correct branch # # ################################################################# # - internal_29 = ARRAY 6 # Create the bool array - SETINDEX internal_29 0 0 # Initialize the bool array - SETINDEX internal_29 1 0 # Initialize the bool array - SETINDEX internal_29 2 0 # Initialize the bool array - SETINDEX internal_29 3 0 # Initialize the bool array - SETINDEX internal_29 4 0 # Initialize the bool array - SETINDEX internal_29 5 0 # Initialize the bool array - - internal_30 = internal_25 == internal_0 # Check if the minimum index is equal to the count of ancestors - IF internal_30 GOTO error_branch_8792981820269 - SETINDEX internal_29 internal_25 1 # Set the bool array in the correct index to 1 - - internal_31 = GETINDEX internal_29 0 # Get the bool value of the branch A - IF internal_31 GOTO branch_A_8792981820269 # If the bool value is 1, then we have a match - - internal_31 = GETINDEX internal_29 1 # Get the bool value of the branch B - IF internal_31 GOTO branch_B_8792981820269 # If the bool value is 1, then we have a match - - internal_31 = GETINDEX internal_29 2 # Get the bool value of the branch C - IF internal_31 GOTO branch_C_8792981820269 # If the bool value is 1, then we have a match - - internal_31 = GETINDEX internal_29 3 # Get the bool value of the branch D - IF internal_31 GOTO branch_D_8792981820269 # If the bool value is 1, then we have a match + internal_39 = ARRAY internal_2 # Create the bool array + internal_40 = ALLOCINT 0 + SETVALUEINDEX internal_39 internal_40 internal_0 # Initialize the bool array + internal_41 = ALLOCINT 1 + SETVALUEINDEX internal_39 internal_41 internal_0 # Initialize the bool array + internal_42 = ALLOCINT 2 + SETVALUEINDEX internal_39 internal_42 internal_0 # Initialize the bool array + internal_43 = ALLOCINT 3 + SETVALUEINDEX internal_39 internal_43 internal_0 # Initialize the bool array + internal_44 = ALLOCINT 4 + SETVALUEINDEX internal_39 internal_44 internal_0 # Initialize the bool array + internal_45 = ALLOCINT 5 + SETVALUEINDEX internal_39 internal_45 internal_0 # Initialize the bool array - internal_31 = GETINDEX internal_29 4 # Get the bool value of the branch E - IF internal_31 GOTO branch_E_8792981820269 # If the bool value is 1, then we have a match - - internal_31 = GETINDEX internal_29 5 # Get the bool value of the branch Object - IF internal_31 GOTO branch_Object_8792981820269 # If the bool value is 1, then we have a match + internal_46 = ALLOCBOOL 0 + ARG internal_35 + ARG internal_4 + internal_46 = CALL function_equal + IF internal_46 GOTO error_branch_8781702295173 + SETVALUEINDEX internal_39 internal_33 internal_1 # Set the bool array in the correct index to 1 + internal_47 = ALLOCBOOL 0 - branch_A_8792981820269: - internal_34 = ALLOCSTR "Class type is now A\n" - ARG self - ARG internal_34 - internal_35 = VCALL Main function_out_string_at_IO - internal_32 = internal_35 # Assign the result - GOTO branch_end_8792981820269 + internal_48 = ALLOCINT 0 + internal_47 = GETVALUEINDEX internal_39 internal_48 # Get the bool value of the branch A + IF internal_47 GOTO branch_A_8781702295173 # If the bool value is 1, then we have a match - branch_B_8792981820269: - internal_37 = ALLOCSTR "Class type is now B\n" - ARG self - ARG internal_37 - internal_38 = VCALL Main function_out_string_at_IO - internal_32 = internal_38 # Assign the result - GOTO branch_end_8792981820269 + internal_49 = ALLOCINT 1 + internal_47 = GETVALUEINDEX internal_39 internal_49 # Get the bool value of the branch B + IF internal_47 GOTO branch_B_8781702295173 # If the bool value is 1, then we have a match - branch_C_8792981820269: - internal_40 = ALLOCSTR "Class type is now C\n" - ARG self - ARG internal_40 - internal_41 = VCALL Main function_out_string_at_IO - internal_32 = internal_41 # Assign the result - GOTO branch_end_8792981820269 + internal_50 = ALLOCINT 2 + internal_47 = GETVALUEINDEX internal_39 internal_50 # Get the bool value of the branch C + IF internal_47 GOTO branch_C_8781702295173 # If the bool value is 1, then we have a match - branch_D_8792981820269: - internal_43 = ALLOCSTR "Class type is now D\n" - ARG self - ARG internal_43 - internal_44 = VCALL Main function_out_string_at_IO - internal_32 = internal_44 # Assign the result - GOTO branch_end_8792981820269 + internal_51 = ALLOCINT 3 + internal_47 = GETVALUEINDEX internal_39 internal_51 # Get the bool value of the branch D + IF internal_47 GOTO branch_D_8781702295173 # If the bool value is 1, then we have a match - branch_E_8792981820269: - internal_46 = ALLOCSTR "Class type is now E\n" - ARG self - ARG internal_46 - internal_47 = VCALL Main function_out_string_at_IO - internal_32 = internal_47 # Assign the result - GOTO branch_end_8792981820269 + internal_52 = ALLOCINT 4 + internal_47 = GETVALUEINDEX internal_39 internal_52 # Get the bool value of the branch E + IF internal_47 GOTO branch_E_8781702295173 # If the bool value is 1, then we have a match - branch_Object_8792981820269: - internal_49 = ALLOCSTR "Oooops\n" - ARG self - ARG internal_49 - internal_50 = VCALL Main function_out_string_at_IO - internal_32 = internal_50 # Assign the result - GOTO branch_end_8792981820269 + internal_53 = ALLOCINT 5 + internal_47 = GETVALUEINDEX internal_39 internal_53 # Get the bool value of the branch Object + IF internal_47 GOTO branch_Object_8781702295173 # If the bool value is 1, then we have a match - error_branch_8792981820269: + branch_A_8781702295173: + ARG a + ARG var + a = CALL function_assign + internal_56 = ALLOCSTR "Class type is now A\n" + ARG self + ARG internal_56 + internal_57 = VCALL Main function_out_string_at_IO + ARG internal_54 + ARG internal_57 + internal_54 = CALL function_assign + internal_54 = internal_57 # Assign the result + GOTO branch_end_8781702295173 + + branch_B_8781702295173: + ARG b + ARG var + b = CALL function_assign + internal_59 = ALLOCSTR "Class type is now B\n" + ARG self + ARG internal_59 + internal_60 = VCALL Main function_out_string_at_IO + ARG internal_54 + ARG internal_60 + internal_54 = CALL function_assign + internal_54 = internal_60 # Assign the result + GOTO branch_end_8781702295173 + + branch_C_8781702295173: + ARG c + ARG var + c = CALL function_assign + internal_62 = ALLOCSTR "Class type is now C\n" + ARG self + ARG internal_62 + internal_63 = VCALL Main function_out_string_at_IO + ARG internal_54 + ARG internal_63 + internal_54 = CALL function_assign + internal_54 = internal_63 # Assign the result + GOTO branch_end_8781702295173 + + branch_D_8781702295173: + ARG d + ARG var + d = CALL function_assign + internal_65 = ALLOCSTR "Class type is now D\n" + ARG self + ARG internal_65 + internal_66 = VCALL Main function_out_string_at_IO + ARG internal_54 + ARG internal_66 + internal_54 = CALL function_assign + internal_54 = internal_66 # Assign the result + GOTO branch_end_8781702295173 + + branch_E_8781702295173: + ARG e + ARG var + e = CALL function_assign + internal_68 = ALLOCSTR "Class type is now E\n" + ARG self + ARG internal_68 + internal_69 = VCALL Main function_out_string_at_IO + ARG internal_54 + ARG internal_69 + internal_54 = CALL function_assign + internal_54 = internal_69 # Assign the result + GOTO branch_end_8781702295173 + + branch_Object_8781702295173: + ARG o + ARG var + o = CALL function_assign + internal_71 = ALLOCSTR "Oooops\n" + ARG self + ARG internal_71 + internal_72 = VCALL Main function_out_string_at_IO + ARG internal_54 + ARG internal_72 + internal_54 = CALL function_assign + internal_54 = internal_72 # Assign the result + GOTO branch_end_8781702295173 + + error_branch_8781702295173: # Insert an error call - branch_end_8792981820269: + branch_end_8781702295173: - RETURN internal_32 + RETURN internal_54 } function function_print_at_Main{ PARAM self @@ -2413,10 +2732,14 @@ function function_print_at_Main{ LOCAL internal_5 # String " " LOCAL internal_6 + # Let z: A2I + internal_1 = ALLOCATE A2I # Allocate the object A2I ARG internal_1 # Pass the instance to the constructor internal_1 = VCALL A2I function___init___at_A2I # Call the constructor - z = internal_1 + ARG z + ARG internal_1 + z = CALL function_assign ARG var internal_2 = VCALL A function_value_at_A ARG z @@ -2437,8 +2760,8 @@ function function_main_at_Main{ LOCAL internal_0 # Store an instance of the class A LOCAL internal_1 - LOCAL internal_2 - LOCAL internal_3 # String "number " + LOCAL internal_2 # String "number " + LOCAL internal_3 LOCAL internal_4 LOCAL internal_5 LOCAL internal_6 @@ -2446,23 +2769,23 @@ function function_main_at_Main{ LOCAL internal_8 LOCAL internal_9 LOCAL internal_10 - LOCAL internal_11 - LOCAL internal_12 # String "is even!\n" - LOCAL internal_13 - LOCAL internal_14 # String "is odd!\n" + LOCAL internal_11 # String "is even!\n" + LOCAL internal_12 + LOCAL internal_13 # String "is odd!\n" + LOCAL internal_14 LOCAL internal_15 LOCAL internal_16 LOCAL internal_17 LOCAL internal_18 LOCAL internal_19 LOCAL internal_20 - LOCAL internal_21 - LOCAL internal_22 # String "a" - LOCAL internal_23 # Store the result of the operation function_equal - LOCAL internal_24 # Store an instance of the class A + LOCAL internal_21 # String "a" + LOCAL internal_22 # Store the result of the operation function_equal + LOCAL internal_23 # Store an instance of the class A + LOCAL internal_24 LOCAL internal_25 - LOCAL internal_26 - LOCAL internal_27 # Store an instance of the class B + LOCAL internal_26 # Store an instance of the class B + LOCAL internal_27 LOCAL internal_28 LOCAL internal_29 LOCAL internal_30 @@ -2470,362 +2793,398 @@ function function_main_at_Main{ LOCAL internal_32 LOCAL internal_33 LOCAL internal_34 - LOCAL internal_35 - LOCAL internal_36 # String "b" - LOCAL internal_37 # Store the result of the operation function_equal - LOCAL internal_38 - LOCAL internal_39 # Count of ancestors of the switch expression - LOCAL internal_40 # Switch expression type - LOCAL internal_41 # Ancestor type - LOCAL internal_42 # Step 1 comparison result - LOCAL internal_43 # Step 1 Array of ancestors - LOCAL internal_44 # Integer 0 - LOCAL internal_45 # Null pointer - LOCAL internal_46 # Step 2 iteration index - LOCAL internal_47 # Step 2 comparison result - LOCAL internal_48 # Array to store the branch types - LOCAL internal_49 # Array to store the nearest ancestor index of the expression type of the i-th branch type - LOCAL internal_50 # Address of the type C - LOCAL internal_51 # Address of the type A - LOCAL internal_52 # Address of the type Object - LOCAL internal_53 # Step 3 - Iteration index of the branch types array - LOCAL internal_54 # Step 3 - Comparison for the index of the branch types array - LOCAL internal_55 # Step 3 - Type of the i-th branch - LOCAL internal_56 # Step 3 - Index of the ancestor - LOCAL internal_57 # Step 3 - Comparison for the index of the ancestor - LOCAL internal_58 # Step 3 - Type of the j-th ancestor - LOCAL internal_59 # Step 3 - Comparison for the branch type nad the ancestor type - LOCAL internal_60 # Step 4 - Iteration index - LOCAL internal_61 # Step 4 - Index of the minimum counter in the counter array - LOCAL internal_62 # Step 4 - Temporary variable - LOCAL internal_63 # Step 4 - Current minimum of the counter array - LOCAL internal_64 # Step 4 - Comparison for the minimum of the counter array - LOCAL internal_65 # Step 5 - Bool array - LOCAL internal_66 # Step 5 - Exists an error - LOCAL internal_67 # Step 5 - Comparison for the correct branch result - LOCAL internal_68 # Result of the switch expression address + LOCAL internal_35 # String "b" + LOCAL internal_36 # Store the result of the operation function_equal + LOCAL internal_37 + LOCAL internal_38 # Constant Integer 0 + LOCAL internal_39 # Constant Integer 1 + LOCAL internal_40 # Constant Integer 3 + LOCAL internal_41 # Null pointer + LOCAL internal_42 # Count of ancestors of the switch expression + LOCAL internal_43 # Switch expression type + LOCAL internal_44 # Ancestor type + LOCAL internal_45 # Step 1 comparison result + LOCAL internal_46 # Step 1 Array of ancestors + LOCAL internal_47 # Step 2 iteration index + LOCAL internal_48 # Step 2 comparison result + LOCAL internal_49 # Array to store the branch types + LOCAL internal_50 # Array to store the nearest ancestor index of the expression type of the i-th branch type + LOCAL internal_51 # Address of the type C + LOCAL internal_52 # Index of the type C + LOCAL internal_53 # Address of the type A + LOCAL internal_54 # Index of the type A + LOCAL internal_55 # Address of the type Object + LOCAL internal_56 # Index of the type Object + LOCAL internal_57 # Step 3 - Iteration index of the branch types array + LOCAL internal_58 # Step 3 - Comparison for the index of the branch types array + LOCAL internal_59 # Step 3 - Type of the i-th branch + LOCAL internal_60 # Step 3 - Index of the ancestor + LOCAL internal_61 # Step 3 - Comparison for the index of the ancestor + LOCAL internal_62 # Step 3 - Type of the j-th ancestor + LOCAL internal_63 # Step 3 - Comparison for the branch type nad the ancestor type + LOCAL internal_64 # Step 4 - Iteration index + LOCAL internal_65 # Step 4 - Index of the minimum counter in the counter array + LOCAL internal_66 # Step 4 - Temporary variable + LOCAL internal_67 # Step 4 - Current minimum of the counter array + LOCAL internal_68 # Step 4 - Comparison for the minimum of the counter array + LOCAL internal_69 # endl + LOCAL internal_70 # space + LOCAL internal_71 # Step 5 - Bool array + LOCAL internal_72 # Step 5 - Branch 0 + LOCAL internal_73 # Step 5 - Branch 1 + LOCAL internal_74 # Step 5 - Branch 2 + LOCAL internal_75 # Step 5 - Exists an error + LOCAL internal_76 # Step 5 - Comparison for the correct branch result + LOCAL internal_77 # Index 0 + LOCAL internal_78 # Index 1 + LOCAL internal_79 # Index 2 + LOCAL internal_80 # Result of the switch expression address LOCAL c # Specialiced variable for the branch C - LOCAL internal_70 - LOCAL internal_71 - LOCAL a # Specialiced variable for the branch A - LOCAL internal_73 - LOCAL internal_74 - LOCAL o # Specialiced variable for the branch Object - LOCAL internal_76 # String "Oooops\n" - LOCAL internal_77 - LOCAL internal_78 - LOCAL internal_79 # Integer 0 - LOCAL internal_80 - LOCAL internal_81 LOCAL internal_82 - LOCAL internal_83 # String "c" - LOCAL internal_84 # Store the result of the operation function_equal - LOCAL internal_85 # Store an instance of the class A + LOCAL internal_83 + LOCAL a # Specialiced variable for the branch A + LOCAL internal_85 LOCAL internal_86 - LOCAL internal_87 - LOCAL internal_88 # Store an instance of the class D + LOCAL o # Specialiced variable for the branch Object + LOCAL internal_88 # String "Oooops\n" LOCAL internal_89 LOCAL internal_90 - LOCAL internal_91 + LOCAL internal_91 # Integer 0 LOCAL internal_92 LOCAL internal_93 LOCAL internal_94 - LOCAL internal_95 - LOCAL internal_96 - LOCAL internal_97 # String "d" - LOCAL internal_98 # Store the result of the operation function_equal - LOCAL internal_99 # Store an instance of the class C - LOCAL internal_100 + LOCAL internal_95 # String "c" + LOCAL internal_96 # Store the result of the operation function_equal + LOCAL internal_97 # Store an instance of the class A + LOCAL internal_98 + LOCAL internal_99 + LOCAL internal_100 # Store an instance of the class D LOCAL internal_101 LOCAL internal_102 LOCAL internal_103 LOCAL internal_104 LOCAL internal_105 - LOCAL internal_106 # String "e" - LOCAL internal_107 # Store the result of the operation function_equal - LOCAL internal_108 # Store an instance of the class C - LOCAL internal_109 - LOCAL internal_110 - LOCAL internal_111 + LOCAL internal_106 + LOCAL internal_107 + LOCAL internal_108 + LOCAL internal_109 # String "d" + LOCAL internal_110 # Store the result of the operation function_equal + LOCAL internal_111 # Store an instance of the class C LOCAL internal_112 LOCAL internal_113 LOCAL internal_114 - LOCAL internal_115 # String "f" - LOCAL internal_116 # Store the result of the operation function_equal - LOCAL internal_117 # Store an instance of the class C - LOCAL internal_118 - LOCAL internal_119 - LOCAL internal_120 + LOCAL internal_115 + LOCAL internal_116 + LOCAL internal_117 + LOCAL internal_118 # String "e" + LOCAL internal_119 # Store the result of the operation function_equal + LOCAL internal_120 # Store an instance of the class C LOCAL internal_121 LOCAL internal_122 LOCAL internal_123 - LOCAL internal_124 # String "g" - LOCAL internal_125 # Store the result of the operation function_equal + LOCAL internal_124 + LOCAL internal_125 LOCAL internal_126 - LOCAL internal_127 - LOCAL internal_128 # Store an instance of the class D - LOCAL internal_129 + LOCAL internal_127 # String "f" + LOCAL internal_128 # Store the result of the operation function_equal + LOCAL internal_129 # Store an instance of the class C LOCAL internal_130 LOCAL internal_131 - LOCAL internal_132 # String "number " + LOCAL internal_132 LOCAL internal_133 LOCAL internal_134 LOCAL internal_135 - LOCAL internal_136 # String "is divisible by 3.\n" - LOCAL internal_137 - LOCAL internal_138 # String "number " + LOCAL internal_136 # String "g" + LOCAL internal_137 # Store the result of the operation function_equal + LOCAL internal_138 LOCAL internal_139 - LOCAL internal_140 + LOCAL internal_140 # Store an instance of the class D LOCAL internal_141 - LOCAL internal_142 # String "is not divisible by 3.\n" + LOCAL internal_142 LOCAL internal_143 - LOCAL internal_144 + LOCAL internal_144 # String "number " LOCAL internal_145 LOCAL internal_146 - LOCAL internal_147 # String "h" - LOCAL internal_148 # Store the result of the operation function_equal - LOCAL x - LOCAL internal_150 # Store an instance of the class E + LOCAL internal_147 + LOCAL internal_148 # String "is divisible by 3.\n" + LOCAL internal_149 + LOCAL internal_150 # String "number " LOCAL internal_151 LOCAL internal_152 LOCAL internal_153 - LOCAL r + LOCAL internal_154 # String "is not divisible by 3.\n" LOCAL internal_155 LOCAL internal_156 LOCAL internal_157 - LOCAL internal_158 # Integer 8 - LOCAL internal_159 # Store the result of the operation function_mult - LOCAL internal_160 # Store the result of the operation function_sub - LOCAL internal_161 # String "number " - LOCAL internal_162 + LOCAL internal_158 + LOCAL internal_159 # String "h" + LOCAL internal_160 # Store the result of the operation function_equal + LOCAL x + LOCAL internal_162 # Store an instance of the class E LOCAL internal_163 LOCAL internal_164 - LOCAL internal_165 # String "is equal to " - LOCAL internal_166 + LOCAL internal_165 + LOCAL r LOCAL internal_167 - LOCAL internal_168 # String "times 8 with a remainder of " + LOCAL internal_168 LOCAL internal_169 - LOCAL a - LOCAL internal_171 # Store an instance of the class A2I - LOCAL internal_172 - LOCAL internal_173 - LOCAL internal_174 # String "\n" + LOCAL internal_170 # Integer 8 + LOCAL internal_171 # Store the result of the operation function_mult + LOCAL internal_172 # Store the result of the operation function_sub + LOCAL internal_173 # String "number " + LOCAL internal_174 LOCAL internal_175 LOCAL internal_176 - LOCAL internal_177 + LOCAL internal_177 # String "is equal to " LOCAL internal_178 - LOCAL internal_179 # String "j" - LOCAL internal_180 # Store the result of the operation function_equal - LOCAL internal_181 # Store an instance of the class A - LOCAL internal_182 - LOCAL internal_183 + LOCAL internal_179 + LOCAL internal_180 # String "times 8 with a remainder of " + LOCAL internal_181 + LOCAL a + LOCAL internal_183 # Store an instance of the class A2I LOCAL internal_184 - LOCAL internal_185 # String "q" - LOCAL internal_186 # Store the result of the operation function_equal - LOCAL internal_187 # Boolean false - LOCAL internal_188 # Store an instance of the class A + LOCAL internal_185 + LOCAL internal_186 # String "\n" + LOCAL internal_187 + LOCAL internal_188 LOCAL internal_189 LOCAL internal_190 - LOCAL internal_191 + LOCAL internal_191 # String "j" + LOCAL internal_192 # Store the result of the operation function_equal + LOCAL internal_193 # Store an instance of the class A + LOCAL internal_194 + LOCAL internal_195 + LOCAL internal_196 + LOCAL internal_197 # String "q" + LOCAL internal_198 # Store the result of the operation function_equal + LOCAL internal_199 # Boolean false + LOCAL internal_200 # Store an instance of the class A + LOCAL internal_201 + LOCAL internal_202 + LOCAL internal_203 internal_0 = ALLOCATE A # Allocate the object A ARG internal_0 # Pass the instance to the constructor internal_0 = VCALL A function___init___at_A # Call the constructor + SETATTR self avar internal_0 - while_start_8792981790296: - internal_2 = GETATTR self flag - internal_1 = internal_2 - IF internal_1 GOTO while_body_8792981790296 - GOTO while_end_8792981790296 - while_body_8792981790296: - internal_3 = ALLOCSTR "number " + # While loop + while_start_8781702298224: + internal_1 = GETATTR self flag + IF internal_1 GOTO while_body_8781702298224 + GOTO while_end_8781702298224 + + while_body_8781702298224: + internal_2 = ALLOCSTR "number " ARG self - ARG internal_3 - internal_4 = VCALL Main function_out_string_at_IO - internal_5 = GETATTR self avar + ARG internal_2 + internal_3 = VCALL Main function_out_string_at_IO + internal_4 = GETATTR self avar ARG self - ARG internal_5 - internal_6 = VCALL Main function_print_at_Main + ARG internal_4 + internal_5 = VCALL Main function_print_at_Main # Conditional - internal_8 = ALLOCBOOL 0 - internal_9 = GETATTR self avar - ARG internal_9 - internal_10 = VCALL A function_value_at_A + internal_7 = ALLOCBOOL 0 + internal_8 = GETATTR self avar + ARG internal_8 + internal_9 = VCALL A function_value_at_A ARG self - ARG internal_10 - internal_11 = VCALL Main function_is_even_at_Main - internal_8 = internal_11 - IF internal_8 GOTO then_8792981820386 - GOTO else_8792981820386 + ARG internal_9 + internal_10 = VCALL Main function_is_even_at_Main + internal_7 = internal_10 + IF internal_7 GOTO then_8781702295290 + GOTO else_8781702295290 - then_8792981820386: - internal_12 = ALLOCSTR "is even!\n" + then_8781702295290: + internal_11 = ALLOCSTR "is even!\n" ARG self - ARG internal_12 - internal_13 = VCALL Main function_out_string_at_IO - internal_7 = internal_13 - GOTO endif_8792981820386 + ARG internal_11 + internal_12 = VCALL Main function_out_string_at_IO + internal_6 = internal_12 + GOTO endif_8781702295290 - else_8792981820386: - internal_14 = ALLOCSTR "is odd!\n" + else_8781702295290: + internal_13 = ALLOCSTR "is odd!\n" ARG self - ARG internal_14 - internal_15 = VCALL Main function_out_string_at_IO - internal_7 = internal_15 - GOTO endif_8792981820386 + ARG internal_13 + internal_14 = VCALL Main function_out_string_at_IO + internal_6 = internal_14 + GOTO endif_8781702295290 - endif_8792981820386: - internal_16 = GETATTR self avar + endif_8781702295290: + internal_15 = GETATTR self avar ARG self - ARG internal_16 - internal_17 = VCALL Main function_class_type_at_Main + ARG internal_15 + internal_16 = VCALL Main function_class_type_at_Main ARG self - internal_18 = VCALL Main function_menu_at_Main - SETATTR self char internal_18 + internal_17 = VCALL Main function_menu_at_Main + + SETATTR self char internal_17 # Conditional - internal_20 = ALLOCBOOL 0 - internal_21 = GETATTR self char - internal_22 = ALLOCSTR "a" + internal_19 = ALLOCBOOL 0 + internal_20 = GETATTR self char + internal_21 = ALLOCSTR "a" + ARG internal_20 ARG internal_21 - ARG internal_22 - internal_23 = CALL function_equal - internal_20 = internal_23 - IF internal_20 GOTO then_8792981790281 - GOTO else_8792981790281 + internal_22 = CALL function_equal + internal_19 = internal_22 + IF internal_19 GOTO then_8781702298209 + GOTO else_8781702298209 - then_8792981790281: - internal_24 = ALLOCATE A # Allocate the object A - ARG internal_24 # Pass the instance to the constructor - internal_24 = VCALL A function___init___at_A # Call the constructor + then_8781702298209: + internal_23 = ALLOCATE A # Allocate the object A + ARG internal_23 # Pass the instance to the constructor + internal_23 = VCALL A function___init___at_A # Call the constructor ARG self - internal_25 = VCALL Main function_get_int_at_Main + internal_24 = VCALL Main function_get_int_at_Main + ARG internal_23 ARG internal_24 - ARG internal_25 - internal_26 = VCALL A function_set_var_at_A - SETATTR self a_var internal_26 - internal_27 = ALLOCATE B # Allocate the object B - ARG internal_27 # Pass the instance to the constructor - internal_27 = VCALL B function___init___at_B # Call the constructor - internal_28 = GETATTR self avar - ARG internal_28 - internal_29 = VCALL A function_value_at_A - internal_30 = GETATTR self a_var - ARG internal_30 - internal_31 = VCALL A function_value_at_A + internal_25 = VCALL A function_set_var_at_A + + SETATTR self a_var internal_25 + internal_26 = ALLOCATE B # Allocate the object B + ARG internal_26 # Pass the instance to the constructor + internal_26 = VCALL B function___init___at_B # Call the constructor + internal_27 = GETATTR self avar ARG internal_27 + internal_28 = VCALL A function_value_at_A + internal_29 = GETATTR self a_var ARG internal_29 - ARG internal_31 - internal_32 = VCALL B function_method2_at_A - SETATTR self avar internal_32 - internal_19 = internal_32 - GOTO endif_8792981790281 + internal_30 = VCALL A function_value_at_A + ARG internal_26 + ARG internal_28 + ARG internal_30 + internal_31 = VCALL B function_method2_at_A + + SETATTR self avar internal_31 + internal_18 = internal_31 + GOTO endif_8781702298209 - else_8792981790281: + else_8781702298209: # Conditional - internal_34 = ALLOCBOOL 0 - internal_35 = GETATTR self char - internal_36 = ALLOCSTR "b" + internal_33 = ALLOCBOOL 0 + internal_34 = GETATTR self char + internal_35 = ALLOCSTR "b" + ARG internal_34 ARG internal_35 - ARG internal_36 - internal_37 = CALL function_equal - internal_34 = internal_37 - IF internal_34 GOTO then_8792981790275 - GOTO else_8792981790275 + internal_36 = CALL function_equal + internal_33 = internal_36 + IF internal_33 GOTO then_8781702298203 + GOTO else_8781702298203 + + then_8781702298203: + internal_37 = GETATTR self avar + internal_38 = ALLOCINT 0 + internal_39 = ALLOCINT 1 + internal_40 = ALLOCINT 3 + internal_41 = ALLOCNULL + internal_42 = ALLOCINT 0 + internal_45 = ALLOCBOOL 0 - then_8792981790275: - internal_38 = GETATTR self avar # Switch Case Algorithm Steps: # 1 - Count how many ancestors has the dynamic type of the expression # 2 - Create an array of the same size where to store the ancestors # 3 - For each branch type, store the ancestor index that match with it, if no one match, store `count of ancestors` # 4 - Find the minimum of the ancestors indexes # 5 - With the minimum index, get the correct branch type - internal_44 = ALLOCINT 0 - internal_42 = ALLOCBOOL 0 # Initialize the comparison result # ######################################################################## # # Step 1 - Count how many ancestors has the dynamic type of the expression # # ######################################################################## # - internal_40 = TYPEOF internal_38 # Get the switch expression type - internal_41 = internal_40 # The first ancestor will be the type itself - internal_39 = internal_44 # Initialize the counter - while_start_8792981788591: - internal_42 = internal_41 == 0 - IF internal_42 GOTO while_end_8792981788591 - internal_39 = internal_39 + 1 # Increment the counter - internal_41 = ANCESTOR internal_41 - GOTO while_start_8792981788591 - while_end_8792981788591: + internal_43 = TYPEOF internal_37 # Get the switch expression type + internal_44 = internal_43 # The first ancestor will be the type itself + while_start_8781702296263: + internal_45 = EQUALADDR internal_44 internal_41 + IF internal_45 GOTO while_end_8781702296263 + # Increment the count of ancestors + ARG internal_42 + ARG internal_39 + internal_42 = CALL function_add + internal_44 = ANCESTOR internal_44 + GOTO while_start_8781702296263 + while_end_8781702296263: # ###################################################################### # # Step 2 - Create an array of the same size where to store the ancestors # # ###################################################################### # - internal_41 = internal_40 # The first ancestor will be the type itself - internal_43 = ARRAY internal_39 # Create an array of ancestors - internal_46 = 0 # Initialize the index with the value 0 - foreach_start_8792981788591: - internal_47 = internal_46 < internal_39 # Check if the index is less than the counter - IF internal_47 GOTO foreach_body_8792981788591 - GOTO foreach_end_8792981788591 - foreach_body_8792981788591: - SETINDEX internal_43 internal_46 internal_41 # Set the index of the array with the ancestor type - internal_41 = ANCESTOR internal_41 # Get the next ancestor - internal_46 = internal_46 + 1 # Increment index - GOTO foreach_start_8792981788591 - foreach_end_8792981788591: - - # #################################################################################################### # - # Step 3 - For each branch type, store the ancestor index that match with it (Simulating a double for) # - # #################################################################################################### # - internal_48 = ARRAY 3 - internal_49 = ARRAY 3 - internal_50 = TYPEADDR C - SETINDEX internal_48 0 internal_50 - SETINDEX internal_49 0 internal_39 - internal_51 = TYPEADDR A - SETINDEX internal_48 1 internal_51 - SETINDEX internal_49 1 internal_39 - internal_52 = TYPEADDR Object - SETINDEX internal_48 2 internal_52 - SETINDEX internal_49 2 internal_39 - - # ############# # - # Outer Foreach # - # ############# # - internal_53 = 0 # Initialize the index i of the case to 0 - foreach_type_start_8792981788591: - internal_54 = internal_53 < 3 # Check if the type index is less than the count of branches - IF internal_54 GOTO foreach_type_body_8792981788591 - GOTO foreach_type_end_8792981788591 - foreach_type_body_8792981788591: - internal_55 = GETINDEX internal_48 internal_53 # Get the type of the i-th branch - - # ############# # - # Inner Foreach # - # ############# # - internal_56 = 0 # Initialize the index j of the case to 0 - foreach_ancestor_start_8792981788591: - internal_57 = internal_56 < internal_39 # Check if the case index is less than the count of ancestors - IF internal_57 GOTO foreach_ancestor_body_8792981788591 - GOTO foreach_ancestor_end_8792981788591 - foreach_ancestor_body_8792981788591: - internal_58 = GETINDEX internal_43 internal_56 # Get the j-th ancestor type - internal_59 = internal_55 == internal_58 # Compare if the type of the i-th branch is equal to the j-th ancestor - IF internal_59 GOTO foreach_ancestor_end_8792981788591 # If the types are equal, we have a match, then we can exit - internal_56 = internal_56 + 1 # Increment the ancestor index - GOTO foreach_ancestor_start_8792981788591 - foreach_ancestor_end_8792981788591: - SETINDEX internal_49 internal_53 internal_56 # Set the counter of the i-th branch equals to j + internal_44 = internal_43 # The first ancestor will be the type itself + internal_46 = ARRAY internal_42 # Create an array of ancestors + internal_47 = ALLOCINT 0 + internal_48 = ALLOCBOOL 0 + foreach_start_8781702296263: + ARG internal_47 + ARG internal_42 + internal_48 = CALL function_less_than + IF internal_48 GOTO foreach_body_8781702296263 + GOTO foreach_end_8781702296263 + foreach_body_8781702296263: + SETINDEX internal_46 internal_47 internal_44 # Set the index of the array with the ancestor type + internal_44 = ANCESTOR internal_44 # Get the next ancestor + ARG internal_47 + ARG internal_39 + internal_47 = CALL function_add + GOTO foreach_start_8781702296263 + foreach_end_8781702296263: + + internal_49 = ARRAY internal_40 + internal_50 = ARRAY internal_40 + internal_52 = ALLOCINT 0 + internal_51 = TYPEADDR C + SETINDEX internal_49 internal_52 internal_51 + SETVALUEINDEX internal_50 internal_52 internal_42 + internal_54 = ALLOCINT 1 + internal_53 = TYPEADDR A + SETINDEX internal_49 internal_54 internal_53 + SETVALUEINDEX internal_50 internal_54 internal_42 + internal_56 = ALLOCINT 2 + internal_55 = TYPEADDR Object + SETINDEX internal_49 internal_56 internal_55 + SETVALUEINDEX internal_50 internal_56 internal_42 + + internal_57 = ALLOCINT 0 + internal_58 = ALLOCBOOL 0 + internal_60 = ALLOCINT 0 + internal_61 = ALLOCBOOL 0 + internal_63 = ALLOCBOOL 0 + foreach_type_start_8781702296263: + ARG internal_57 + ARG internal_40 + internal_58 = CALL function_less_than + IF internal_58 GOTO foreach_type_body_8781702296263 + GOTO foreach_type_end_8781702296263 + foreach_type_body_8781702296263: + internal_59 = GETINDEX internal_49 internal_57 # Get the type of the i-th branch + ARG internal_60 + ARG internal_38 + internal_60 = CALL function_assign + foreach_ancestor_start_8781702296263: + ARG internal_60 + ARG internal_42 + internal_61 = CALL function_less_than + IF internal_61 GOTO foreach_ancestor_body_8781702296263 + GOTO foreach_ancestor_end_8781702296263 + foreach_ancestor_body_8781702296263: + internal_62 = GETINDEX internal_46 internal_60 # Get the j-th ancestor type + internal_63 = EQUALADDR internal_59 internal_62 # Compare if the type of the i-th branch is equal to the j-th ancestor + IF internal_63 GOTO foreach_ancestor_end_8781702296263 # If the types are equal, we have a match, then we can exit + ARG internal_60 + ARG internal_39 + internal_60 = CALL function_add + GOTO foreach_ancestor_start_8781702296263 + foreach_ancestor_end_8781702296263: + SETVALUEINDEX internal_50 internal_57 internal_60 # Set the counter of the i-th branch equals to j # #################### # # End of Inner Foreach # # #################### # - internal_53 = internal_53 + 1 # Increment type index - GOTO foreach_type_start_8792981788591 - foreach_type_end_8792981788591: + ARG internal_57 + ARG internal_39 + internal_57 = CALL function_add + GOTO foreach_type_start_8781702296263 + foreach_type_end_8781702296263: # ################# # # End Outer Foreach # # ################# # @@ -2833,441 +3192,509 @@ function function_main_at_Main{ # ######################################## # # Step 4 - Find the minimum ancestor index # # ######################################## # - internal_60 = 0 # Initialize the index of the counter array to 0 - internal_61 = 0 # Initialize the index of the lower counter to 0 - internal_63 = internal_39 # Initialize the current minimum to `count of ancestors` - foreach_min_start_8792981788591: - internal_64 = internal_60 < 3 # Check if the index of the lower counter is less than the count of branches - IF internal_64 GOTO foreach_min_body_8792981788591 - GOTO foreach_min_end_8792981788591 - foreach_min_body_8792981788591: - internal_62 = GETINDEX internal_49 internal_60 # Get the nearest ancestor index of the i-th branch type - internal_64 = internal_62 < internal_63 # Compare if the nearest ancestor index is less than the current minimum - IF internal_64 GOTO update_min_8792981788591 - GOTO foreach_min_end_8792981788591 - update_min_8792981788591: - internal_63 = internal_62 # Update the current minimum - internal_61 = internal_60 # Update the index of the lower counter - update_min_end_8792981788591: - internal_60 = internal_60 + 1 # Increment the index of the counter array - GOTO foreach_min_start_8792981788591 - foreach_min_end_8792981788591: + internal_69 = ALLOCSTR "\n" + internal_70 = ALLOCSTR " " + internal_64 = ALLOCINT 0 + internal_65 = ALLOCINT 0 + internal_66 = ALLOCINT 0 + internal_67 = ALLOCINT 0 + internal_68 = ALLOCBOOL 0 + ARG internal_67 + ARG internal_42 + internal_67 = CALL function_assign + foreach_min_start_8781702296263: + ARG internal_64 + ARG internal_40 + internal_68 = CALL function_less_than + IF internal_68 GOTO foreach_min_body_8781702296263 + GOTO foreach_min_end_8781702296263 + foreach_min_body_8781702296263: + internal_66 = GETVALUEINDEX internal_50 internal_64 # Get the nearest ancestor index of the i-th branch type + ARG internal_66 + ARG internal_67 + internal_68 = CALL function_less_than + IF internal_68 GOTO update_min_8781702296263 + GOTO update_min_end_8781702296263 + update_min_8781702296263: + ARG internal_67 + ARG internal_66 + internal_67 = CALL function_assign + ARG internal_65 + ARG internal_64 + internal_65 = CALL function_assign + update_min_end_8781702296263: + ARG internal_64 + ARG internal_39 + internal_64 = CALL function_add + GOTO foreach_min_start_8781702296263 + foreach_min_end_8781702296263: # ################################################################# # # Step 5 - Using the minimun ancestor index find the correct branch # # ################################################################# # - internal_65 = ARRAY 3 # Create the bool array - SETINDEX internal_65 0 0 # Initialize the bool array - SETINDEX internal_65 1 0 # Initialize the bool array - SETINDEX internal_65 2 0 # Initialize the bool array - - internal_66 = internal_61 == internal_39 # Check if the minimum index is equal to the count of ancestors - IF internal_66 GOTO error_branch_8792981788591 - SETINDEX internal_65 internal_61 1 # Set the bool array in the correct index to 1 + internal_71 = ARRAY internal_40 # Create the bool array + internal_72 = ALLOCINT 0 + SETVALUEINDEX internal_71 internal_72 internal_38 # Initialize the bool array + internal_73 = ALLOCINT 1 + SETVALUEINDEX internal_71 internal_73 internal_38 # Initialize the bool array + internal_74 = ALLOCINT 2 + SETVALUEINDEX internal_71 internal_74 internal_38 # Initialize the bool array + + internal_75 = ALLOCBOOL 0 + ARG internal_67 + ARG internal_42 + internal_75 = CALL function_equal + IF internal_75 GOTO error_branch_8781702296263 + SETVALUEINDEX internal_71 internal_65 internal_39 # Set the bool array in the correct index to 1 + internal_76 = ALLOCBOOL 0 - internal_67 = GETINDEX internal_65 0 # Get the bool value of the branch C - IF internal_67 GOTO branch_C_8792981788591 # If the bool value is 1, then we have a match + internal_77 = ALLOCINT 0 + internal_76 = GETVALUEINDEX internal_71 internal_77 # Get the bool value of the branch C + IF internal_76 GOTO branch_C_8781702296263 # If the bool value is 1, then we have a match - internal_67 = GETINDEX internal_65 1 # Get the bool value of the branch A - IF internal_67 GOTO branch_A_8792981788591 # If the bool value is 1, then we have a match + internal_78 = ALLOCINT 1 + internal_76 = GETVALUEINDEX internal_71 internal_78 # Get the bool value of the branch A + IF internal_76 GOTO branch_A_8781702296263 # If the bool value is 1, then we have a match - internal_67 = GETINDEX internal_65 2 # Get the bool value of the branch Object - IF internal_67 GOTO branch_Object_8792981788591 # If the bool value is 1, then we have a match + internal_79 = ALLOCINT 2 + internal_76 = GETVALUEINDEX internal_71 internal_79 # Get the bool value of the branch Object + IF internal_76 GOTO branch_Object_8781702296263 # If the bool value is 1, then we have a match - branch_C_8792981788591: + branch_C_8781702296263: ARG c - internal_70 = VCALL C function_value_at_A + ARG internal_37 + c = CALL function_assign + ARG c + internal_82 = VCALL C function_value_at_A ARG c - ARG internal_70 - internal_71 = VCALL C function_method6_at_C - SETATTR self avar internal_71 - internal_68 = internal_71 # Assign the result - GOTO branch_end_8792981788591 + ARG internal_82 + internal_83 = VCALL C function_method6_at_C - branch_A_8792981788591: + SETATTR self avar internal_83 + ARG internal_80 + ARG internal_83 + internal_80 = CALL function_assign + internal_80 = internal_83 # Assign the result + GOTO branch_end_8781702296263 + + branch_A_8781702296263: + ARG a + ARG internal_37 + a = CALL function_assign ARG a - internal_73 = VCALL A function_value_at_A + internal_85 = VCALL A function_value_at_A ARG a - ARG internal_73 - internal_74 = VCALL A function_method3_at_A - SETATTR self avar internal_74 - internal_68 = internal_74 # Assign the result - GOTO branch_end_8792981788591 + ARG internal_85 + internal_86 = VCALL A function_method3_at_A + + SETATTR self avar internal_86 + ARG internal_80 + ARG internal_86 + internal_80 = CALL function_assign + internal_80 = internal_86 # Assign the result + GOTO branch_end_8781702296263 - branch_Object_8792981788591: - internal_76 = ALLOCSTR "Oooops\n" + branch_Object_8781702296263: + ARG o + ARG internal_37 + o = CALL function_assign + internal_88 = ALLOCSTR "Oooops\n" ARG self - ARG internal_76 - internal_77 = VCALL Main function_out_string_at_IO + ARG internal_88 + internal_89 = VCALL Main function_out_string_at_IO ARG self - internal_78 = VCALL Main function_abort_at_Object - internal_79 = ALLOCINT 0 - internal_68 = internal_79 # Assign the result - GOTO branch_end_8792981788591 + internal_90 = VCALL Main function_abort_at_Object + internal_91 = ALLOCINT 0 + ARG internal_80 + ARG internal_91 + internal_80 = CALL function_assign + internal_80 = internal_91 # Assign the result + GOTO branch_end_8781702296263 - error_branch_8792981788591: + error_branch_8781702296263: # Insert an error call - branch_end_8792981788591: - internal_33 = internal_68 - GOTO endif_8792981790275 - - else_8792981790275: - # Conditional - internal_81 = ALLOCBOOL 0 - internal_82 = GETATTR self char - internal_83 = ALLOCSTR "c" + branch_end_8781702296263: + internal_32 = internal_80 + GOTO endif_8781702298203 - ARG internal_82 - ARG internal_83 - internal_84 = CALL function_equal - internal_81 = internal_84 - IF internal_81 GOTO then_8792981790269 - GOTO else_8792981790269 - - then_8792981790269: - internal_85 = ALLOCATE A # Allocate the object A - ARG internal_85 # Pass the instance to the constructor - internal_85 = VCALL A function___init___at_A # Call the constructor - ARG self - internal_86 = VCALL Main function_get_int_at_Main - ARG internal_85 - ARG internal_86 - internal_87 = VCALL A function_set_var_at_A - SETATTR self a_var internal_87 - internal_88 = ALLOCATE D # Allocate the object D - ARG internal_88 # Pass the instance to the constructor - internal_88 = VCALL D function___init___at_D # Call the constructor - internal_89 = GETATTR self avar - ARG internal_89 - internal_90 = VCALL A function_value_at_A - internal_91 = GETATTR self a_var - ARG internal_91 - internal_92 = VCALL A function_value_at_A - ARG internal_88 - ARG internal_90 - ARG internal_92 - internal_93 = VCALL D function_method4_at_A - SETATTR self avar internal_93 - internal_80 = internal_93 - GOTO endif_8792981790269 - - else_8792981790269: + else_8781702298203: # Conditional - internal_95 = ALLOCBOOL 0 - internal_96 = GETATTR self char - internal_97 = ALLOCSTR "d" - - ARG internal_96 + internal_93 = ALLOCBOOL 0 + internal_94 = GETATTR self char + internal_95 = ALLOCSTR "c" + + ARG internal_94 + ARG internal_95 + internal_96 = CALL function_equal + internal_93 = internal_96 + IF internal_93 GOTO then_8781702298197 + GOTO else_8781702298197 + + then_8781702298197: + internal_97 = ALLOCATE A # Allocate the object A + ARG internal_97 # Pass the instance to the constructor + internal_97 = VCALL A function___init___at_A # Call the constructor + ARG self + internal_98 = VCALL Main function_get_int_at_Main ARG internal_97 - internal_98 = CALL function_equal - internal_95 = internal_98 - IF internal_95 GOTO then_8792981790263 - GOTO else_8792981790263 - - then_8792981790263: - internal_99 = ALLOCATE C # Allocate the object C - ARG internal_99 # Pass the instance to the constructor - internal_99 = VCALL C function___init___at_C # Call the constructor - internal_100 = GETATTR self avar - ARG internal_100 - internal_101 = VCALL A function_value_at_A - ARG internal_99 + ARG internal_98 + internal_99 = VCALL A function_set_var_at_A + + SETATTR self a_var internal_99 + internal_100 = ALLOCATE D # Allocate the object D + ARG internal_100 # Pass the instance to the constructor + internal_100 = VCALL D function___init___at_D # Call the constructor + internal_101 = GETATTR self avar ARG internal_101 - internal_102 = VCALL C function_method5_at_C - SETATTR self avar internal_102 - internal_94 = internal_102 - GOTO endif_8792981790263 + internal_102 = VCALL A function_value_at_A + internal_103 = GETATTR self a_var + ARG internal_103 + internal_104 = VCALL A function_value_at_A + ARG internal_100 + ARG internal_102 + ARG internal_104 + internal_105 = VCALL D function_method4_at_A + + SETATTR self avar internal_105 + internal_92 = internal_105 + GOTO endif_8781702298197 - else_8792981790263: + else_8781702298197: # Conditional - internal_104 = ALLOCBOOL 0 - internal_105 = GETATTR self char - internal_106 = ALLOCSTR "e" - - ARG internal_105 - ARG internal_106 - internal_107 = CALL function_equal - internal_104 = internal_107 - IF internal_104 GOTO then_8792981790257 - GOTO else_8792981790257 - - then_8792981790257: - internal_108 = ALLOCATE C # Allocate the object C - ARG internal_108 # Pass the instance to the constructor - internal_108 = VCALL C function___init___at_C # Call the constructor - internal_109 = GETATTR self avar - ARG internal_109 - internal_110 = VCALL A function_value_at_A - ARG internal_108 - ARG internal_110 - internal_111 = VCALL C function_method5_at_C - SETATTR self avar internal_111 - internal_103 = internal_111 - GOTO endif_8792981790257 + internal_107 = ALLOCBOOL 0 + internal_108 = GETATTR self char + internal_109 = ALLOCSTR "d" - else_8792981790257: + ARG internal_108 + ARG internal_109 + internal_110 = CALL function_equal + internal_107 = internal_110 + IF internal_107 GOTO then_8781702298191 + GOTO else_8781702298191 + + then_8781702298191: + internal_111 = ALLOCATE C # Allocate the object C + ARG internal_111 # Pass the instance to the constructor + internal_111 = VCALL C function___init___at_C # Call the constructor + internal_112 = GETATTR self avar + ARG internal_112 + internal_113 = VCALL A function_value_at_A + ARG internal_111 + ARG internal_113 + internal_114 = VCALL C function_method5_at_C + + SETATTR self avar internal_114 + internal_106 = internal_114 + GOTO endif_8781702298191 + + else_8781702298191: # Conditional - internal_113 = ALLOCBOOL 0 - internal_114 = GETATTR self char - internal_115 = ALLOCSTR "f" - - ARG internal_114 - ARG internal_115 - internal_116 = CALL function_equal - internal_113 = internal_116 - IF internal_113 GOTO then_8792981790251 - GOTO else_8792981790251 - - then_8792981790251: - internal_117 = ALLOCATE C # Allocate the object C - ARG internal_117 # Pass the instance to the constructor - internal_117 = VCALL C function___init___at_C # Call the constructor - internal_118 = GETATTR self avar - ARG internal_118 - internal_119 = VCALL A function_value_at_A + internal_116 = ALLOCBOOL 0 + internal_117 = GETATTR self char + internal_118 = ALLOCSTR "e" + ARG internal_117 - ARG internal_119 - internal_120 = VCALL C function_method5_at_C - SETATTR self avar internal_120 - internal_112 = internal_120 - GOTO endif_8792981790251 + ARG internal_118 + internal_119 = CALL function_equal + internal_116 = internal_119 + IF internal_116 GOTO then_8781702298185 + GOTO else_8781702298185 + + then_8781702298185: + internal_120 = ALLOCATE C # Allocate the object C + ARG internal_120 # Pass the instance to the constructor + internal_120 = VCALL C function___init___at_C # Call the constructor + internal_121 = GETATTR self avar + ARG internal_121 + internal_122 = VCALL A function_value_at_A + ARG internal_120 + ARG internal_122 + internal_123 = VCALL C function_method5_at_C + + SETATTR self avar internal_123 + internal_115 = internal_123 + GOTO endif_8781702298185 + + else_8781702298185: + # Conditional + internal_125 = ALLOCBOOL 0 + internal_126 = GETATTR self char + internal_127 = ALLOCSTR "f" + + ARG internal_126 + ARG internal_127 + internal_128 = CALL function_equal + internal_125 = internal_128 + IF internal_125 GOTO then_8781702298179 + GOTO else_8781702298179 + + then_8781702298179: + internal_129 = ALLOCATE C # Allocate the object C + ARG internal_129 # Pass the instance to the constructor + internal_129 = VCALL C function___init___at_C # Call the constructor + internal_130 = GETATTR self avar + ARG internal_130 + internal_131 = VCALL A function_value_at_A + ARG internal_129 + ARG internal_131 + internal_132 = VCALL C function_method5_at_C - else_8792981790251: + SETATTR self avar internal_132 + internal_124 = internal_132 + GOTO endif_8781702298179 + + else_8781702298179: # Conditional - internal_122 = ALLOCBOOL 0 - internal_123 = GETATTR self char - internal_124 = ALLOCSTR "g" - - ARG internal_123 - ARG internal_124 - internal_125 = CALL function_equal - internal_122 = internal_125 - IF internal_122 GOTO then_8792981790245 - GOTO else_8792981790245 - - then_8792981790245: + internal_134 = ALLOCBOOL 0 + internal_135 = GETATTR self char + internal_136 = ALLOCSTR "g" + + ARG internal_135 + ARG internal_136 + internal_137 = CALL function_equal + internal_134 = internal_137 + IF internal_134 GOTO then_8781702298173 + GOTO else_8781702298173 + + then_8781702298173: # Conditional - internal_127 = ALLOCBOOL 0 - internal_128 = ALLOCATE D # Allocate the object D - ARG internal_128 # Pass the instance to the constructor - internal_128 = VCALL D function___init___at_D # Call the constructor - internal_129 = GETATTR self avar - ARG internal_129 - internal_130 = VCALL A function_value_at_A - ARG internal_128 - ARG internal_130 - internal_131 = VCALL D function_method7_at_D - internal_127 = internal_131 - IF internal_127 GOTO then_8792981789148 - GOTO else_8792981789148 + internal_139 = ALLOCBOOL 0 + internal_140 = ALLOCATE D # Allocate the object D + ARG internal_140 # Pass the instance to the constructor + internal_140 = VCALL D function___init___at_D # Call the constructor + internal_141 = GETATTR self avar + ARG internal_141 + internal_142 = VCALL A function_value_at_A + ARG internal_140 + ARG internal_142 + internal_143 = VCALL D function_method7_at_D + internal_139 = internal_143 + IF internal_139 GOTO then_8781702296820 + GOTO else_8781702296820 - then_8792981789148: - internal_132 = ALLOCSTR "number " + then_8781702296820: + internal_144 = ALLOCSTR "number " ARG self - ARG internal_132 - internal_133 = VCALL Main function_out_string_at_IO - internal_134 = GETATTR self avar + ARG internal_144 + internal_145 = VCALL Main function_out_string_at_IO + internal_146 = GETATTR self avar ARG self - ARG internal_134 - internal_135 = VCALL Main function_print_at_Main - internal_136 = ALLOCSTR "is divisible by 3.\n" + ARG internal_146 + internal_147 = VCALL Main function_print_at_Main + internal_148 = ALLOCSTR "is divisible by 3.\n" ARG self - ARG internal_136 - internal_137 = VCALL Main function_out_string_at_IO - internal_126 = internal_137 - GOTO endif_8792981789148 + ARG internal_148 + internal_149 = VCALL Main function_out_string_at_IO + internal_138 = internal_149 + GOTO endif_8781702296820 - else_8792981789148: - internal_138 = ALLOCSTR "number " + else_8781702296820: + internal_150 = ALLOCSTR "number " ARG self - ARG internal_138 - internal_139 = VCALL Main function_out_string_at_IO - internal_140 = GETATTR self avar + ARG internal_150 + internal_151 = VCALL Main function_out_string_at_IO + internal_152 = GETATTR self avar ARG self - ARG internal_140 - internal_141 = VCALL Main function_print_at_Main - internal_142 = ALLOCSTR "is not divisible by 3.\n" + ARG internal_152 + internal_153 = VCALL Main function_print_at_Main + internal_154 = ALLOCSTR "is not divisible by 3.\n" ARG self - ARG internal_142 - internal_143 = VCALL Main function_out_string_at_IO - internal_126 = internal_143 - GOTO endif_8792981789148 + ARG internal_154 + internal_155 = VCALL Main function_out_string_at_IO + internal_138 = internal_155 + GOTO endif_8781702296820 - endif_8792981789148: - internal_121 = internal_126 - GOTO endif_8792981790245 + endif_8781702296820: + internal_133 = internal_138 + GOTO endif_8781702298173 - else_8792981790245: + else_8781702298173: # Conditional - internal_145 = ALLOCBOOL 0 - internal_146 = GETATTR self char - internal_147 = ALLOCSTR "h" + internal_157 = ALLOCBOOL 0 + internal_158 = GETATTR self char + internal_159 = ALLOCSTR "h" + + ARG internal_158 + ARG internal_159 + internal_160 = CALL function_equal + internal_157 = internal_160 + IF internal_157 GOTO then_8781702298167 + GOTO else_8781702298167 + + then_8781702298167: + # Let x: A + x = ALLOCNULL + internal_162 = ALLOCATE E # Allocate the object E + ARG internal_162 # Pass the instance to the constructor + internal_162 = VCALL E function___init___at_E # Call the constructor + internal_163 = GETATTR self avar + ARG internal_163 + internal_164 = VCALL A function_value_at_A + ARG internal_162 + ARG internal_164 + internal_165 = VCALL E function_method6_at_E - ARG internal_146 - ARG internal_147 - internal_148 = CALL function_equal - internal_145 = internal_148 - IF internal_145 GOTO then_8792981790239 - GOTO else_8792981790239 - - then_8792981790239: - x = NULL - internal_150 = ALLOCATE E # Allocate the object E - ARG internal_150 # Pass the instance to the constructor - internal_150 = VCALL E function___init___at_E # Call the constructor - internal_151 = GETATTR self avar - ARG internal_151 - internal_152 = VCALL A function_value_at_A - ARG internal_150 - ARG internal_152 - internal_153 = VCALL E function_method6_at_E - x = internal_153 - internal_155 = GETATTR self avar - ARG internal_155 - internal_156 = VCALL A function_value_at_A ARG x - internal_157 = VCALL A function_value_at_A - internal_158 = ALLOCINT 8 + ARG internal_165 + x = CALL function_assign + # Let r: Int - ARG internal_157 - ARG internal_158 - internal_159 = CALL function_mult + internal_167 = GETATTR self avar + ARG internal_167 + internal_168 = VCALL A function_value_at_A + ARG x + internal_169 = VCALL A function_value_at_A + internal_170 = ALLOCINT 8 - ARG internal_156 - ARG internal_159 - internal_160 = CALL function_sub - r = internal_160 - internal_161 = ALLOCSTR "number " + ARG internal_169 + ARG internal_170 + internal_171 = CALL function_mult + + ARG internal_168 + ARG internal_171 + internal_172 = CALL function_sub + ARG r + ARG internal_172 + r = CALL function_assign + internal_173 = ALLOCSTR "number " ARG self - ARG internal_161 - internal_162 = VCALL Main function_out_string_at_IO - internal_163 = GETATTR self avar + ARG internal_173 + internal_174 = VCALL Main function_out_string_at_IO + internal_175 = GETATTR self avar ARG self - ARG internal_163 - internal_164 = VCALL Main function_print_at_Main - internal_165 = ALLOCSTR "is equal to " + ARG internal_175 + internal_176 = VCALL Main function_print_at_Main + internal_177 = ALLOCSTR "is equal to " ARG self - ARG internal_165 - internal_166 = VCALL Main function_out_string_at_IO + ARG internal_177 + internal_178 = VCALL Main function_out_string_at_IO ARG self ARG x - internal_167 = VCALL Main function_print_at_Main - internal_168 = ALLOCSTR "times 8 with a remainder of " + internal_179 = VCALL Main function_print_at_Main + internal_180 = ALLOCSTR "times 8 with a remainder of " ARG self - ARG internal_168 - internal_169 = VCALL Main function_out_string_at_IO - internal_171 = ALLOCATE A2I # Allocate the object A2I - ARG internal_171 # Pass the instance to the constructor - internal_171 = VCALL A2I function___init___at_A2I # Call the constructor - a = internal_171 + ARG internal_180 + internal_181 = VCALL Main function_out_string_at_IO + # Let a: A2I + + internal_183 = ALLOCATE A2I # Allocate the object A2I + ARG internal_183 # Pass the instance to the constructor + internal_183 = VCALL A2I function___init___at_A2I # Call the constructor + ARG a + ARG internal_183 + a = CALL function_assign ARG a ARG r - internal_172 = VCALL A2I function_i2a_at_A2I + internal_184 = VCALL A2I function_i2a_at_A2I ARG self - ARG internal_172 - internal_173 = VCALL Main function_out_string_at_IO - internal_174 = ALLOCSTR "\n" + ARG internal_184 + internal_185 = VCALL Main function_out_string_at_IO + internal_186 = ALLOCSTR "\n" ARG self - ARG internal_174 - internal_175 = VCALL Main function_out_string_at_IO + ARG internal_186 + internal_187 = VCALL Main function_out_string_at_IO + SETATTR self avar x - internal_144 = x - GOTO endif_8792981790239 + internal_156 = x + GOTO endif_8781702298167 - else_8792981790239: - # Conditional - internal_177 = ALLOCBOOL 0 - internal_178 = GETATTR self char - internal_179 = ALLOCSTR "j" - - ARG internal_178 - ARG internal_179 - internal_180 = CALL function_equal - internal_177 = internal_180 - IF internal_177 GOTO then_8792981790233 - GOTO else_8792981790233 - - then_8792981790233: - internal_181 = ALLOCATE A # Allocate the object A - ARG internal_181 # Pass the instance to the constructor - internal_181 = VCALL A function___init___at_A # Call the constructor - SETATTR self avar internal_181 - internal_176 = internal_181 - GOTO endif_8792981790233 - - else_8792981790233: + else_8781702298167: # Conditional - internal_183 = ALLOCBOOL 0 - internal_184 = GETATTR self char - internal_185 = ALLOCSTR "q" + internal_189 = ALLOCBOOL 0 + internal_190 = GETATTR self char + internal_191 = ALLOCSTR "j" - ARG internal_184 - ARG internal_185 - internal_186 = CALL function_equal - internal_183 = internal_186 - IF internal_183 GOTO then_8792981789693 - GOTO else_8792981789693 - - then_8792981789693: - internal_187 = ALLOCBOOL 0 - SETATTR self flag internal_187 - internal_182 = internal_187 - GOTO endif_8792981789693 - - else_8792981789693: - internal_188 = ALLOCATE A # Allocate the object A - ARG internal_188 # Pass the instance to the constructor - internal_188 = VCALL A function___init___at_A # Call the constructor - internal_189 = GETATTR self avar - ARG internal_189 - internal_190 = VCALL A function_value_at_A - ARG internal_188 ARG internal_190 - internal_191 = VCALL A function_method1_at_A - SETATTR self avar internal_191 - internal_182 = internal_191 - GOTO endif_8792981789693 - - endif_8792981789693: - internal_176 = internal_182 - GOTO endif_8792981790233 - - endif_8792981790233: - internal_144 = internal_176 - GOTO endif_8792981790239 - - endif_8792981790239: - internal_121 = internal_144 - GOTO endif_8792981790245 - - endif_8792981790245: - internal_112 = internal_121 - GOTO endif_8792981790251 - - endif_8792981790251: - internal_103 = internal_112 - GOTO endif_8792981790257 - - endif_8792981790257: - internal_94 = internal_103 - GOTO endif_8792981790263 - - endif_8792981790263: - internal_80 = internal_94 - GOTO endif_8792981790269 - - endif_8792981790269: - internal_33 = internal_80 - GOTO endif_8792981790275 - - endif_8792981790275: - internal_19 = internal_33 - GOTO endif_8792981790281 - - endif_8792981790281: - GOTO while_start_8792981790296 - - while_end_8792981790296: + ARG internal_191 + internal_192 = CALL function_equal + internal_189 = internal_192 + IF internal_189 GOTO then_8781702298161 + GOTO else_8781702298161 + + then_8781702298161: + internal_193 = ALLOCATE A # Allocate the object A + ARG internal_193 # Pass the instance to the constructor + internal_193 = VCALL A function___init___at_A # Call the constructor + + SETATTR self avar internal_193 + internal_188 = internal_193 + GOTO endif_8781702298161 + + else_8781702298161: + # Conditional + internal_195 = ALLOCBOOL 0 + internal_196 = GETATTR self char + internal_197 = ALLOCSTR "q" + + ARG internal_196 + ARG internal_197 + internal_198 = CALL function_equal + internal_195 = internal_198 + IF internal_195 GOTO then_8781702298137 + GOTO else_8781702298137 + + then_8781702298137: + internal_199 = ALLOCBOOL 0 + + SETATTR self flag internal_199 + internal_194 = internal_199 + GOTO endif_8781702298137 + + else_8781702298137: + internal_200 = ALLOCATE A # Allocate the object A + ARG internal_200 # Pass the instance to the constructor + internal_200 = VCALL A function___init___at_A # Call the constructor + internal_201 = GETATTR self avar + ARG internal_201 + internal_202 = VCALL A function_value_at_A + ARG internal_200 + ARG internal_202 + internal_203 = VCALL A function_method1_at_A + + SETATTR self avar internal_203 + internal_194 = internal_203 + GOTO endif_8781702298137 + + endif_8781702298137: + internal_188 = internal_194 + GOTO endif_8781702298161 + + endif_8781702298161: + internal_156 = internal_188 + GOTO endif_8781702298167 + + endif_8781702298167: + internal_133 = internal_156 + GOTO endif_8781702298173 + + endif_8781702298173: + internal_124 = internal_133 + GOTO endif_8781702298179 + + endif_8781702298179: + internal_115 = internal_124 + GOTO endif_8781702298185 + + endif_8781702298185: + internal_106 = internal_115 + GOTO endif_8781702298191 + + endif_8781702298191: + internal_92 = internal_106 + GOTO endif_8781702298197 + + endif_8781702298197: + internal_32 = internal_92 + GOTO endif_8781702298203 + + endif_8781702298203: + internal_18 = internal_32 + GOTO endif_8781702298209 + + endif_8781702298209: + GOTO while_start_8781702298224 + + while_end_8781702298224: RETURN 0 } diff --git a/src/arith.cl b/src/arith.cl index 462068516..7a4ebb067 100755 --- a/src/arith.cl +++ b/src/arith.cl @@ -32,11 +32,12 @@ class A { }; method3(num : Int) : A { -- negate - (let x : Int in - { + ( + let x : Int in + { x <- ~num; - (new C).set_var(x); - } + (new C).set_var(x); + } ) }; @@ -92,10 +93,11 @@ class B inherits A { -- B is a number squared class C inherits B { method6(num : Int) : A { -- negate - (let x : Int in + ( + let x : Int in { x <- ~num; - (new A).set_var(x); + (new A).set_var(x); } ) }; @@ -142,15 +144,15 @@ class E inherits D { (* 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). + 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" + if the string is not "0" through "9" *) class A2I { @@ -173,20 +175,20 @@ class A2I { (* 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 - }; + 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 @@ -199,7 +201,7 @@ class A2I { if s.length() = 0 then 0 else - if s.substr(0, 1) = "-" then + if s.substr(0, 1) = "-" then ~a2i_aux(s.substr(1, s.length() - 1)) else if s.substr(0, 1) = "+" then @@ -211,27 +213,32 @@ class A2I { 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; - } - ) - }; +(* + 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 @@ -291,8 +298,8 @@ class Main inherits IO { 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"); + out_string("\tTo get a new number...enter j:\n"); + out_string("\tTo quit...enter q:\n\n"); in_string(); } }; @@ -306,13 +313,9 @@ class Main inherits IO { }; get_int() : Int { - { - (let z : A2I <- new A2I in - (let s : String <- prompt() in - z.a2i(s) - ) - ); - } + let z : A2I <- new A2I in + let s : String <- prompt() in + z.a2i(s) }; is_even(num : Int) : Bool { @@ -379,8 +382,8 @@ class Main inherits IO { else if char = "b" then -- negate case avar of - c : C => avar <- c.method6(c.value()); - a : A => avar <- a.method3(a.value()); + c : C => avar <- c.method6(c.value()); + a : A => avar <- a.method3(a.value()); o : Object => { out_string("Oooops\n"); @@ -416,9 +419,9 @@ class Main inherits IO { } else -- avar <- (new A).set_var(0) { - out_string("number "); - print(avar); - out_string("is not divisible by 3.\n"); + out_string("number "); + print(avar); + out_string("is not divisible by 3.\n"); } fi else diff --git a/src/arith_input.txt b/src/arith_input.txt new file mode 100644 index 000000000..40ee26477 --- /dev/null +++ b/src/arith_input.txt @@ -0,0 +1 @@ +Hello diff --git a/src/arith_output.txt b/src/arith_output.txt new file mode 100644 index 000000000..a1e8afa57 --- /dev/null +++ b/src/arith_output.txt @@ -0,0 +1,19 @@ +SPIM Version 8.0 of January 8, 2010 +Copyright 1990-2010, James R. Larus. +All Rights Reserved. +See the file README for a full copyright notice. +Loaded: /usr/lib/spim/exceptions.s +number 0 is even! +Class type is now A + + To add a number to 0 ...enter a: + To negate 0 ...enter b: + To find the difference between 0 and another number...enter c: + To find the factorial of 0 ...enter d: + To square 0 ...enter e: + To cube 0 ...enter f: + To find out if 0 is a multiple of 3...enter g: + To divide 0 by 8...enter h: + To get a new number...enter j: + To quit...enter q: + diff --git a/src/complex.asm b/src/complex.asm new file mode 100644 index 000000000..c55c2d284 --- /dev/null +++ b/src/complex.asm @@ -0,0 +1,2944 @@ +.data + type_Object: .word 8 + type_Object_inherits_from: .word 0 + type_Object_attributes: .word 0 + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + type_Object_abort_message: .asciiz "Abort called from class Object\n" + + type_IO: .word 8 + type_IO_inherits_from: .word type_Object + type_IO_attributes: .word 0 + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + type_IO_abort_message: .asciiz "Abort called from class IO\n" + + type_Int: .word 8 + type_Int_inherits_from: .word type_Object + type_Int_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + type_Int_abort_message: .asciiz "Abort called from class Int\n" + + type_String: .word 8 + type_String_inherits_from: .word type_Object + type_String_attributes: .word 0 + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + type_String_abort_message: .asciiz "Abort called from class String\n" + + type_Bool: .word 8 + type_Bool_inherits_from: .word type_Object + type_Bool_attributes: .word 0 + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + type_Bool_abort_message: .asciiz "Abort called from class Bool\n" + + type_Main: .word 8 + type_Main_inherits_from: .word type_IO + type_Main_attributes: .word 0 + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + type_Main_abort_message: .asciiz "Abort called from class Main\n" + + type_Complex: .word 16 + type_Complex_inherits_from: .word type_IO + type_Complex_attributes: .word 2 + type_Complex_name_size: .word 7 + type_Complex_name: .asciiz "Complex" + type_Complex_abort_message: .asciiz "Abort called from class Complex\n" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_0 = address of allocated object Int + + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_5 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_6 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_7 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_8 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_9 = address of allocated object Int + + # internal_7 = EqualAddress(internal_3, internal_4) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_8 = EqualAddress(internal_3, internal_5) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_9 = EqualAddress(internal_3, internal_6) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_7 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_8 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_9 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 44($sp) + lw $t0, 8($t0) + lw $t1, 40($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 36($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 44($sp) + lw $t1, 40($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 36($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 36($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 36($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_2[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_2 = "\n" + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_type_name_at_Object + jal function_type_name_at_Object + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 12($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) # $t0 = internal_3 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string internal_3 + li $v0, 4 + move $a0, $t0 + syscall + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 12($t1) # $t1 = length of the name of self + la $t3, 16($t1) # $t1 = name of self + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t4, $v0, 0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t3, $t3, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $v0, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the string x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lb $t1, buffer_input($t0) # Loading the byte + beq $t1, $zero, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lb $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + lw $t0, 0($sp) + sw $t1, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 8($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 8($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 + lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) + lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bgt $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 64($sp) + # self = 60($sp) + + # Reserving space for local variables + addi $sp, $sp, -60 + + # Allocating Complex + li $v0, 9 + lw $a0, type_Complex + syscall + la $t0, type_Complex # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 52($sp) # internal_1 = address of allocated object Complex + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_Complex + jal function___init___at_Complex + lw $ra, 4($sp) + sw $v1, 60($sp) # internal_1 = result of function___init___at_Complex + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_2 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_1 + lw $t0, 68($sp) + sw $t0, 8($sp) # Storing internal_1 + + # Argument internal_2 + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_init_at_Complex + jal function_init_at_Complex + lw $ra, 12($sp) + sw $v1, 56($sp) # internal_4 = result of function_init_at_Complex + addi $sp, $sp, 16 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument c + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing c + + # Argument internal_4 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 68($sp) # c = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_6 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument c + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing c + + # Calling function function_reflect_X_at_Complex + jal function_reflect_X_at_Complex + lw $ra, 4($sp) + sw $v1, 36($sp) # internal_7 = result of function_reflect_X_at_Complex + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_7 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_reflect_Y_at_Complex + jal function_reflect_Y_at_Complex + lw $ra, 4($sp) + sw $v1, 32($sp) # internal_8 = result of function_reflect_Y_at_Complex + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument c + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing c + + # Calling function function_reflect_0_at_Complex + jal function_reflect_0_at_Complex + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_9 = result of function_reflect_0_at_Complex + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_8 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument internal_9 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_10 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_6 = internal_10 + lw $t0, 16($sp) + sw $t0, 32($sp) + + # If internal_6 then goto then_8741814694660 + lw $t0, 32($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8741814694660 + + # Jumping to else_8741814694660 + j else_8741814694660 + + then_8741814694660: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 12 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 61 + sb $t0, 8($v0) # internal_11[0] = '=' + + addi $t0, $zero, 41 + sb $t0, 9($v0) # internal_11[1] = ')' + + addi $t0, $zero, 10 + sb $t0, 10($v0) # internal_11[2] = '\n' + + sb $zero, 11($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_11 = "=)\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_11 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_12 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_5 = internal_12 + lw $t0, 8($sp) + sw $t0, 36($sp) + + # Jumping to endif_8741814694660 + j endif_8741814694660 + + else_8741814694660: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 12 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 61 + sb $t0, 8($v0) # internal_13[0] = '=' + + addi $t0, $zero, 40 + sb $t0, 9($v0) # internal_13[1] = '(' + + addi $t0, $zero, 10 + sb $t0, 10($v0) # internal_13[2] = '\n' + + sb $zero, 11($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_13 = "=(\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_13 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_14 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_5 = internal_14 + lw $t0, 0($sp) + sw $t0, 36($sp) + + # Jumping to endif_8741814694660 + j endif_8741814694660 + + endif_8741814694660: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 60 + + jr $ra + + function___init___at_Complex: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_0 = address of allocated object Int + + # Set attribute x of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8741814676447 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8741814676447 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8741814676447 + j object_set_attribute_8741814676447 + int_set_attribute_8741814676447: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.x = internal_0 + j end_set_attribute_8741814676447 + bool_set_attribute_8741814676447: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.x = internal_0 + j end_set_attribute_8741814676447 + object_set_attribute_8741814676447: + sw $t1, 8($t0) # self.x = internal_0 + end_set_attribute_8741814676447: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_1 = address of allocated object Int + + # Set attribute y of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8741814676468 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8741814676468 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8741814676468 + j object_set_attribute_8741814676468 + int_set_attribute_8741814676468: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.y = internal_1 + j end_set_attribute_8741814676468 + bool_set_attribute_8741814676468: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.y = internal_1 + j end_set_attribute_8741814676468 + object_set_attribute_8741814676468: + sw $t1, 12($t0) # self.y = internal_1 + end_set_attribute_8741814676468: + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_init_at_Complex: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + # a = 20($sp) + # b = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Get attribute x of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8741814677815 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8741814677815 + j object_get_attribute_8741814677815 + int_get_attribute_8741814677815: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.x + j end_get_attribute_8741814677815 + bool_get_attribute_8741814677815: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.x + j end_get_attribute_8741814677815 + object_get_attribute_8741814677815: + sw $t1, 12($sp) # internal_0 = x + end_get_attribute_8741814677815: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument a + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing a + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_1 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute y of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8741814677854 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8741814677854 + j object_get_attribute_8741814677854 + int_get_attribute_8741814677854: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_2 = self.y + j end_get_attribute_8741814677854 + bool_get_attribute_8741814677854: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_2 = self.y + j end_get_attribute_8741814677854 + object_get_attribute_8741814677854: + sw $t1, 4($sp) # internal_2 = y + end_get_attribute_8741814677854: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument b + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing b + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_print_at_Complex: + # Function parameters + # $ra = 64($sp) + # self = 60($sp) + + # Reserving space for local variables + addi $sp, $sp, -60 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_1 = address of allocated object Int + + # Get attribute y of self + lw $t0, 60($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8741814677932 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8741814677932 + j object_get_attribute_8741814677932 + int_get_attribute_8741814677932: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 48($sp) # internal_2 = self.y + j end_get_attribute_8741814677932 + bool_get_attribute_8741814677932: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 48($sp) # internal_2 = self.y + j end_get_attribute_8741814677932 + object_get_attribute_8741814677932: + sw $t1, 48($sp) # internal_2 = y + end_get_attribute_8741814677932: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_4 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_4 + lw $t0, 40($sp) + sw $t0, 52($sp) + + # If internal_1 then goto then_8741814694807 + lw $t0, 52($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8741814694807 + + # Jumping to else_8741814694807 + j else_8741814694807 + + then_8741814694807: + + # Get attribute x of self + lw $t0, 60($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8741814678013 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8741814678013 + j object_get_attribute_8741814678013 + int_get_attribute_8741814678013: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 36($sp) # internal_5 = self.x + j end_get_attribute_8741814678013 + bool_get_attribute_8741814678013: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 36($sp) # internal_5 = self.x + j end_get_attribute_8741814678013 + object_get_attribute_8741814678013: + sw $t1, 36($sp) # internal_5 = x + end_get_attribute_8741814678013: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_5 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_out_int_at_IO + jal function_out_int_at_IO + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_6 = result of function_out_int_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_0 = internal_6 + lw $t0, 32($sp) + sw $t0, 56($sp) + + # Jumping to endif_8741814694807 + j endif_8741814694807 + + else_8741814694807: + + # Get attribute x of self + lw $t0, 60($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8741814676574 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8741814676574 + j object_get_attribute_8741814676574 + int_get_attribute_8741814676574: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_7 = self.x + j end_get_attribute_8741814676574 + bool_get_attribute_8741814676574: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_7 = self.x + j end_get_attribute_8741814676574 + object_get_attribute_8741814676574: + sw $t1, 28($sp) # internal_7 = x + end_get_attribute_8741814676574: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_7 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_out_int_at_IO + jal function_out_int_at_IO + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_8 = result of function_out_int_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 43 + sb $t0, 8($v0) # internal_9[0] = '+' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_9 = "+" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_8 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument internal_9 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_10 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute y of self + lw $t0, 60($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8741814676622 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8741814676622 + j object_get_attribute_8741814676622 + int_get_attribute_8741814676622: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_11 = self.y + j end_get_attribute_8741814676622 + bool_get_attribute_8741814676622: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_11 = self.y + j end_get_attribute_8741814676622 + object_get_attribute_8741814676622: + sw $t1, 12($sp) # internal_11 = y + end_get_attribute_8741814676622: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_11 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_out_int_at_IO + jal function_out_int_at_IO + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_12 = result of function_out_int_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 73 + sb $t0, 8($v0) # internal_13[0] = 'I' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_13 = "I" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_12 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_12 + + # Argument internal_13 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_14 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_0 = internal_14 + lw $t0, 0($sp) + sw $t0, 56($sp) + + # Jumping to endif_8741814694807 + j endif_8741814694807 + + endif_8741814694807: + + # Loading return value in $v1 + lw $v1, 56($sp) + + # Freeing space for local variables + addi $sp, $sp, 60 + + jr $ra + + function_reflect_0_at_Complex: + # Function parameters + # $ra = 52($sp) + # self = 48($sp) + + # Reserving space for local variables + addi $sp, $sp, -48 + + # Get attribute x of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8741814676721 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8741814676721 + j object_get_attribute_8741814676721 + int_get_attribute_8741814676721: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 44($sp) # internal_0 = self.x + j end_get_attribute_8741814676721 + bool_get_attribute_8741814676721: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 44($sp) # internal_0 = self.x + j end_get_attribute_8741814676721 + object_get_attribute_8741814676721: + sw $t1, 44($sp) # internal_0 = x + end_get_attribute_8741814676721: + + # Get attribute x of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8741814678541 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8741814678541 + j object_get_attribute_8741814678541 + int_get_attribute_8741814678541: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_1 = self.x + j end_get_attribute_8741814678541 + bool_get_attribute_8741814678541: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_1 = self.x + j end_get_attribute_8741814678541 + object_get_attribute_8741814678541: + sw $t1, 40($sp) # internal_1 = x + end_get_attribute_8741814678541: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_2 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_3 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_4 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_3 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_4 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument internal_2 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_4 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_4 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_5 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute y of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8741814678640 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8741814678640 + j object_get_attribute_8741814678640 + int_get_attribute_8741814678640: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_6 = self.y + j end_get_attribute_8741814678640 + bool_get_attribute_8741814678640: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_6 = self.y + j end_get_attribute_8741814678640 + object_get_attribute_8741814678640: + sw $t1, 20($sp) # internal_6 = y + end_get_attribute_8741814678640: + + # Get attribute y of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8741814678664 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8741814678664 + j object_get_attribute_8741814678664 + int_get_attribute_8741814678664: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_7 = self.y + j end_get_attribute_8741814678664 + bool_get_attribute_8741814678664: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_7 = self.y + j end_get_attribute_8741814678664 + object_get_attribute_8741814678664: + sw $t1, 16($sp) # internal_7 = y + end_get_attribute_8741814678664: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_8 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_9 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_10 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_7 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_7 + + # Argument internal_9 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_10 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_8 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_10 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_6 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_6 + + # Argument internal_10 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_11 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 48($sp) + + # Freeing space for local variables + addi $sp, $sp, 48 + + jr $ra + + function_reflect_X_at_Complex: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Get attribute y of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8741814678781 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8741814678781 + j object_get_attribute_8741814678781 + int_get_attribute_8741814678781: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_0 = self.y + j end_get_attribute_8741814678781 + bool_get_attribute_8741814678781: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_0 = self.y + j end_get_attribute_8741814678781 + object_get_attribute_8741814678781: + sw $t1, 20($sp) # internal_0 = y + end_get_attribute_8741814678781: + + # Get attribute y of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8741814679321 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8741814679321 + j object_get_attribute_8741814679321 + int_get_attribute_8741814679321: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_1 = self.y + j end_get_attribute_8741814679321 + bool_get_attribute_8741814679321: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_1 = self.y + j end_get_attribute_8741814679321 + object_get_attribute_8741814679321: + sw $t1, 16($sp) # internal_1 = y + end_get_attribute_8741814679321: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_2 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_3 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_4 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_4 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_5 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_reflect_Y_at_Complex: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Get attribute x of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8741814679438 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8741814679438 + j object_get_attribute_8741814679438 + int_get_attribute_8741814679438: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_0 = self.x + j end_get_attribute_8741814679438 + bool_get_attribute_8741814679438: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_0 = self.x + j end_get_attribute_8741814679438 + object_get_attribute_8741814679438: + sw $t1, 20($sp) # internal_0 = x + end_get_attribute_8741814679438: + + # Get attribute x of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8741814679462 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8741814679462 + j object_get_attribute_8741814679462 + int_get_attribute_8741814679462: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_1 = self.x + j end_get_attribute_8741814679462 + bool_get_attribute_8741814679462: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_1 = self.x + j end_get_attribute_8741814679462 + object_get_attribute_8741814679462: + sw $t1, 16($sp) # internal_1 = x + end_get_attribute_8741814679462: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_2 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_3 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_4 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_4 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_5 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_main_at_Main + jal function_main_at_Main + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/src/complex.cil b/src/complex.cil new file mode 100644 index 000000000..87ca4da03 --- /dev/null +++ b/src/complex.cil @@ -0,0 +1,674 @@ +.TYPES +type Object { + inherits from null + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method __init__: function___init___at_Object +} +type IO { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method out_string: function_out_string_at_IO + method out_int: function_out_int_at_IO + method in_string: function_in_string_at_IO + method in_int: function_in_int_at_IO + method __init__: function___init___at_IO +} +type Int { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method __init__: function___init___at_Int +} +type String { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method length: function_length_at_String + method concat: function_concat_at_String + method substr: function_substr_at_String + method __init__: function___init___at_String +} +type Bool { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method __init__: function___init___at_Bool +} +type Main { + inherits from IO + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method out_string: function_out_string_at_IO + method out_int: function_out_int_at_IO + method in_string: function_in_string_at_IO + method in_int: function_in_int_at_IO + method main: function_main_at_Main + method __init__: function___init___at_Main +} +type Complex { + inherits from IO + + attribute x + attribute y + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method out_string: function_out_string_at_IO + method out_int: function_out_int_at_IO + method in_string: function_in_string_at_IO + method in_int: function_in_int_at_IO + method init: function_init_at_Complex + method print: function_print_at_Complex + method reflect_0: function_reflect_0_at_Complex + method reflect_X: function_reflect_X_at_Complex + method reflect_Y: function_reflect_Y_at_Complex + method __init__: function___init___at_Complex +} + +.DATA + + +.CODE +function function_add{ + PARAM a + PARAM b + + LOCAL internal_0 # Adding result + + internal_0 = ALLOCINT 0 + internal_0 = a + b + + RETURN internal_0 +} +function function_sub{ + PARAM a + PARAM b + + LOCAL internal_0 # Substracting result + + internal_0 = ALLOCINT 0 + internal_0 = a - b + + RETURN internal_0 +} +function function_mult{ + PARAM a + PARAM b + + LOCAL internal_0 # Multiting result + + internal_0 = ALLOCINT 0 + internal_0 = a * b + + RETURN internal_0 +} +function function_div{ + PARAM a + PARAM b + + LOCAL internal_0 # Dividing result + + internal_0 = ALLOCINT 0 + internal_0 = a / b + + RETURN internal_0 +} +function function_xor{ + PARAM a + PARAM b + + LOCAL internal_0 # Xor result + + internal_0 = ALLOCINT 0 + internal_0 = XOR a b + + RETURN internal_0 +} +function function_less_than{ + PARAM a + PARAM b + + LOCAL internal_0 # Less than result + + internal_0 = ALLOCBOOL 0 + internal_0 = a < b + + RETURN internal_0 +} +function function_less_than_or_equal{ + PARAM a + PARAM b + + LOCAL internal_0 # Less than or equal result + + internal_0 = ALLOCBOOL 0 + internal_0 = a <= b + + RETURN internal_0 +} +function function_equal{ + PARAM a + PARAM b + + LOCAL internal_0 # Equal result + LOCAL internal_1 # Null Pointer + LOCAL internal_2 # One of params is null + LOCAL internal_3 # Type of a + LOCAL internal_4 # Type Int + LOCAL internal_5 # Type Bool + LOCAL internal_6 # Type String + LOCAL internal_7 # Type of a equals int + LOCAL internal_8 # Type of a equals bool + LOCAL internal_9 # Type of a equals string + + internal_0 = ALLOCBOOL 0 + internal_1 = ALLOCNULL + internal_2 = ALLOCBOOL 0 + internal_2 = EQUALADDR a internal_1 + internal_2 = EQUALADDR b internal_1 + IF internal_2 GOTO a_is_type_object + internal_3 = TYPEOF a + internal_4 = TYPEADDR Int + internal_5 = TYPEADDR Bool + internal_6 = TYPEADDR String + internal_7 = ALLOCBOOL 0 + internal_8 = ALLOCBOOL 0 + internal_9 = ALLOCBOOL 0 + internal_7 = EQUALADDR internal_3 internal_4 + internal_8 = EQUALADDR internal_3 internal_5 + internal_9 = EQUALADDR internal_3 internal_6 + + IF internal_7 GOTO a_is_type_int_or_bool + IF internal_8 GOTO a_is_type_int_or_bool + IF internal_9 GOTO a_is_type_string + GOTO a_is_type_object + + a_is_type_int_or_bool: + internal_0 = EQUALINT a b + GOTO end_of_equal + + a_is_type_string: + internal_0 = EQUALSTR a b + GOTO end_of_equal + + a_is_type_object: + internal_0 = a == b + GOTO end_of_equal + + end_of_equal: + + RETURN internal_0 +} +function function_assign{ + PARAM dest + PARAM source + + LOCAL internal_0 # Null Pointer + LOCAL internal_1 # One of params is null + LOCAL internal_2 # Type of source + LOCAL internal_3 # Type Int + LOCAL internal_4 # Type Bool + LOCAL internal_5 # Type of source equals int + LOCAL internal_6 # Type of source equals bool + + internal_0 = ALLOCNULL + internal_1 = ALLOCBOOL 0 + internal_1 = EQUALADDR source internal_0 + internal_1 = EQUALADDR dest internal_0 + IF internal_1 GOTO source_is_type_object + internal_2 = TYPEOF source + internal_3 = TYPEADDR Int + internal_4 = TYPEADDR Bool + internal_5 = ALLOCBOOL 0 + internal_6 = ALLOCBOOL 0 + internal_5 = EQUALADDR internal_2 internal_3 + internal_6 = EQUALADDR internal_2 internal_4 + + IF internal_5 GOTO source_is_type_int_or_bool + IF internal_6 GOTO source_is_type_int_or_bool + GOTO source_is_type_object + + source_is_type_int_or_bool: + dest = INT source + GOTO source_end_of_equal + + source_is_type_object: + dest = source + GOTO source_end_of_equal + + source_end_of_equal: + + RETURN dest +} +function function___init___at_Object{ + PARAM self + + RETURN self +} +function function_abort_at_Object{ + PARAM self + + LOCAL internal_0 + LOCAL internal_1 + LOCAL internal_2 + LOCAL internal_3 + + internal_0 = ALLOCSTR "Abort called from class " + internal_2 = ALLOCSTR "\n" + ARG self + internal_1 = VCALL String function_type_name_at_Object + ARG internal_0 + ARG internal_1 + internal_3 = VCALL String function_concat_at_String + ARG internal_3 + ARG internal_2 + internal_3 = VCALL String function_concat_at_String + PRINTSTR internal_3 + HALT + + RETURN self +} +function function_type_name_at_Object{ + PARAM self + + LOCAL internal_0 # type_name + + internal_0 = TYPENAME self + + RETURN internal_0 +} +function function_copy_at_Object{ + PARAM self + + LOCAL internal_0 + + internal_0 = COPY self + + RETURN internal_0 +} +function function___init___at_IO{ + PARAM self + + RETURN self +} +function function_out_string_at_IO{ + PARAM self + PARAM x + + PRINTSTR x + + RETURN self +} +function function_out_int_at_IO{ + PARAM self + PARAM x + + PRINTINT x + + RETURN self +} +function function_in_string_at_IO{ + PARAM self + + LOCAL internal_0 + + READSTR internal_0 + + RETURN internal_0 +} +function function_in_int_at_IO{ + PARAM self + + LOCAL internal_0 + + internal_0 = ALLOCINT 0 + READINT internal_0 + + RETURN internal_0 +} +function function___init___at_String{ + PARAM self + + RETURN self +} +function function_length_at_String{ + PARAM self + + LOCAL internal_0 + + internal_0 = ALLOCINT 0 + internal_0 = LENGTH self + + RETURN internal_0 +} +function function_concat_at_String{ + PARAM self + PARAM s + + LOCAL internal_0 + + internal_0 = CONCAT self s + + RETURN internal_0 +} +function function_substr_at_String{ + PARAM self + PARAM i + PARAM l + + LOCAL internal_0 + + internal_0 = SUBSTRING self i l + + RETURN internal_0 +} +function function___init___at_Main{ + PARAM self + + RETURN self +} +function function_main_at_Main{ + PARAM self + + LOCAL c + LOCAL internal_1 # Store an instance of the class Complex + LOCAL internal_2 # Integer 1 + LOCAL internal_3 # Integer 1 + LOCAL internal_4 + LOCAL internal_5 + LOCAL internal_6 + LOCAL internal_7 + LOCAL internal_8 + LOCAL internal_9 + LOCAL internal_10 # Store the result of the operation function_equal + LOCAL internal_11 # String "=)\n" + LOCAL internal_12 + LOCAL internal_13 # String "=(\n" + LOCAL internal_14 + + # Let c: Complex + + internal_1 = ALLOCATE Complex # Allocate the object Complex + ARG internal_1 # Pass the instance to the constructor + internal_1 = VCALL Complex function___init___at_Complex # Call the constructor + internal_2 = ALLOCINT 1 + internal_3 = ALLOCINT 1 + ARG internal_1 + ARG internal_2 + ARG internal_3 + internal_4 = VCALL Complex function_init_at_Complex + ARG c + ARG internal_4 + c = CALL function_assign + # Conditional + internal_6 = ALLOCBOOL 0 + ARG c + internal_7 = VCALL Complex function_reflect_X_at_Complex + ARG internal_7 + internal_8 = VCALL Complex function_reflect_Y_at_Complex + ARG c + internal_9 = VCALL Complex function_reflect_0_at_Complex + + ARG internal_8 + ARG internal_9 + internal_10 = CALL function_equal + internal_6 = internal_10 + IF internal_6 GOTO then_8741814694660 + GOTO else_8741814694660 + + then_8741814694660: + internal_11 = ALLOCSTR "=)\n" + ARG self + ARG internal_11 + internal_12 = VCALL Main function_out_string_at_IO + internal_5 = internal_12 + GOTO endif_8741814694660 + + else_8741814694660: + internal_13 = ALLOCSTR "=(\n" + ARG self + ARG internal_13 + internal_14 = VCALL Main function_out_string_at_IO + internal_5 = internal_14 + GOTO endif_8741814694660 + + endif_8741814694660: + + RETURN internal_5 +} +function function___init___at_Complex{ + PARAM self + + LOCAL internal_0 # Integer 0 + LOCAL internal_1 # Integer 0 + + internal_0 = ALLOCINT 0 + + SETATTR self x internal_0 + internal_1 = ALLOCINT 0 + + SETATTR self y internal_1 + + RETURN self +} +function function_init_at_Complex{ + PARAM self + PARAM a + PARAM b + + LOCAL internal_0 + LOCAL internal_1 # Store the result of the operation function_equal + LOCAL internal_2 + LOCAL internal_3 # Store the result of the operation function_equal + + internal_0 = GETATTR self x + + ARG internal_0 + ARG a + internal_1 = CALL function_equal + internal_2 = GETATTR self y + + ARG internal_2 + ARG b + internal_3 = CALL function_equal + + RETURN self +} +function function_print_at_Complex{ + PARAM self + + LOCAL internal_0 + LOCAL internal_1 + LOCAL internal_2 + LOCAL internal_3 # Integer 0 + LOCAL internal_4 # Store the result of the operation function_equal + LOCAL internal_5 + LOCAL internal_6 + LOCAL internal_7 + LOCAL internal_8 + LOCAL internal_9 # String "+" + LOCAL internal_10 + LOCAL internal_11 + LOCAL internal_12 + LOCAL internal_13 # String "I" + LOCAL internal_14 + + # Conditional + internal_1 = ALLOCBOOL 0 + internal_2 = GETATTR self y + internal_3 = ALLOCINT 0 + + ARG internal_2 + ARG internal_3 + internal_4 = CALL function_equal + internal_1 = internal_4 + IF internal_1 GOTO then_8741814694807 + GOTO else_8741814694807 + + then_8741814694807: + internal_5 = GETATTR self x + ARG self + ARG internal_5 + internal_6 = VCALL Complex function_out_int_at_IO + internal_0 = internal_6 + GOTO endif_8741814694807 + + else_8741814694807: + internal_7 = GETATTR self x + ARG self + ARG internal_7 + internal_8 = VCALL Complex function_out_int_at_IO + internal_9 = ALLOCSTR "+" + ARG internal_8 + ARG internal_9 + internal_10 = VCALL Complex function_out_string_at_IO + internal_11 = GETATTR self y + ARG internal_10 + ARG internal_11 + internal_12 = VCALL Complex function_out_int_at_IO + internal_13 = ALLOCSTR "I" + ARG internal_12 + ARG internal_13 + internal_14 = VCALL Complex function_out_string_at_IO + internal_0 = internal_14 + GOTO endif_8741814694807 + + endif_8741814694807: + + RETURN internal_0 +} +function function_reflect_0_at_Complex{ + PARAM self + + LOCAL internal_0 + LOCAL internal_1 + LOCAL internal_2 # Integer 1 + LOCAL internal_3 # Integer 4294967295 + LOCAL internal_4 # Store the complement a2 of internal_1 + LOCAL internal_5 # Store the result of the operation function_equal + LOCAL internal_6 + LOCAL internal_7 + LOCAL internal_8 # Integer 1 + LOCAL internal_9 # Integer 4294967295 + LOCAL internal_10 # Store the complement a2 of internal_7 + LOCAL internal_11 # Store the result of the operation function_equal + + internal_0 = GETATTR self x + internal_1 = GETATTR self x + internal_2 = ALLOCINT 1 + internal_3 = ALLOCINT 4294967295 + internal_4 = ALLOCINT 0 + ARG internal_1 + ARG internal_3 + internal_4 = CALL function_xor + ARG internal_4 + ARG internal_2 + internal_4 = CALL function_add + + ARG internal_0 + ARG internal_4 + internal_5 = CALL function_equal + internal_6 = GETATTR self y + internal_7 = GETATTR self y + internal_8 = ALLOCINT 1 + internal_9 = ALLOCINT 4294967295 + internal_10 = ALLOCINT 0 + ARG internal_7 + ARG internal_9 + internal_10 = CALL function_xor + ARG internal_10 + ARG internal_8 + internal_10 = CALL function_add + + ARG internal_6 + ARG internal_10 + internal_11 = CALL function_equal + + RETURN self +} +function function_reflect_X_at_Complex{ + PARAM self + + LOCAL internal_0 + LOCAL internal_1 + LOCAL internal_2 # Integer 1 + LOCAL internal_3 # Integer 4294967295 + LOCAL internal_4 # Store the complement a2 of internal_1 + LOCAL internal_5 # Store the result of the operation function_equal + + internal_0 = GETATTR self y + internal_1 = GETATTR self y + internal_2 = ALLOCINT 1 + internal_3 = ALLOCINT 4294967295 + internal_4 = ALLOCINT 0 + ARG internal_1 + ARG internal_3 + internal_4 = CALL function_xor + ARG internal_4 + ARG internal_2 + internal_4 = CALL function_add + + ARG internal_0 + ARG internal_4 + internal_5 = CALL function_equal + + RETURN self +} +function function_reflect_Y_at_Complex{ + PARAM self + + LOCAL internal_0 + LOCAL internal_1 + LOCAL internal_2 # Integer 1 + LOCAL internal_3 # Integer 4294967295 + LOCAL internal_4 # Store the complement a2 of internal_1 + LOCAL internal_5 # Store the result of the operation function_equal + + internal_0 = GETATTR self x + internal_1 = GETATTR self x + internal_2 = ALLOCINT 1 + internal_3 = ALLOCINT 4294967295 + internal_4 = ALLOCINT 0 + ARG internal_1 + ARG internal_3 + internal_4 = CALL function_xor + ARG internal_4 + ARG internal_2 + internal_4 = CALL function_add + + ARG internal_0 + ARG internal_4 + internal_5 = CALL function_equal + + RETURN self +} +function main{ + + + LOCAL internal_0 + LOCAL internal_1 + + internal_0 = ALLOCATE Main + ARG internal_0 + internal_0 = VCALL Main function___init___at_Main + + ARG internal_0 + internal_1 = VCALL Main function_main_at_Main + + HALT +} \ No newline at end of file diff --git a/src/complex.cl b/src/complex.cl new file mode 100755 index 000000000..9edb6151d --- /dev/null +++ b/src/complex.cl @@ -0,0 +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; + } + }; +}; diff --git a/src/cool/code_generation/ast_cil.py b/src/cool/code_generation/ast_cil.py index 663b575b5..e8b4a2751 100644 --- a/src/cool/code_generation/ast_cil.py +++ b/src/cool/code_generation/ast_cil.py @@ -71,6 +71,12 @@ def __init__(self, dest: str, source: str): self.source: str = source +class AssignIntNode(InstructionNode): + def __init__(self, dest: str, source: str): + self.dest: str = dest + self.source: str = source + + class ArithmeticNode(InstructionNode): def __init__(self, dest: str, left: str, right: str): self.dest: str = dest @@ -111,7 +117,7 @@ class XorNode(ArithmeticNode): pass -class GetAttribNode(InstructionNode): +class GetAttributeNode(InstructionNode): def __init__(self, dest: str, instance: str, attr: str, attr_index: int) -> None: self.dest: str = dest self.instance: str = instance @@ -140,6 +146,21 @@ def __init__(self, instance: str, index: int, source: str) -> None: self.source: str = source +class GetValueInIndexNode(InstructionNode): + def __init__(self, dest: str, instance: str, index: str) -> None: + self.dest: str = dest + self.instance: str = instance + self.index: str = index + + +class SetValueInIndexNode(InstructionNode): + def __init__(self, instance: str, index: int, source: str) -> None: + self.instance: str = instance + self.index: int = index + self.source: str = source + + + class AllocateNode(InstructionNode): def __init__(self, itype: str, dest: str): self.type: str = itype @@ -158,6 +179,11 @@ def __init__(self, dest: str, value: str): self.value: str = value +class AllocateNullPtrNode(InstructionNode): + def __init__(self, dest: str): + self.dest: str = dest + + class ArrayNode(InstructionNode): def __init__(self, dest: str, size: int) -> None: self.dest: str = dest @@ -345,3 +371,8 @@ def __init__(self, dest, source): class HaltNode(InstructionNode): def __init__(self): pass + + +class AssertTypeNode(InstructionNode): + def __init__(self, address: str): + self.address: str = address \ No newline at end of file diff --git a/src/cool/code_generation/ast_mips.py b/src/cool/code_generation/ast_mips.py index ad6b686bc..9c0aa79df 100644 --- a/src/cool/code_generation/ast_mips.py +++ b/src/cool/code_generation/ast_mips.py @@ -199,6 +199,10 @@ class BeqNode(ThreeAddressIntructionNode): code = "beq" +class BgtNode(ThreeAddressIntructionNode): + code = "bgt" + + class BgeNode(ThreeAddressIntructionNode): code = "bge" diff --git a/src/cool/code_generation/formatters.py b/src/cool/code_generation/formatters.py index cae38531e..2a81b85fa 100644 --- a/src/cool/code_generation/formatters.py +++ b/src/cool/code_generation/formatters.py @@ -72,6 +72,14 @@ def visit(self, node: cil.AssignNode): else f"{node.dest} = {node.source} # {node.comment}" ) + @visitor.when(cil.AssignIntNode) + def visit(self, node: cil.AssignIntNode): + return ( + f"{node.dest} = INT {node.source}" + if node.comment == "" + else f"{node.dest} = INT {node.source} # {node.comment}" + ) + @visitor.when(cil.PlusNode) def visit(self, node: cil.PlusNode): return ( @@ -208,8 +216,8 @@ def visit(self, node: cil.DynamicCallNode): else f"{node.dest} = VCALL {node.type} {node.method} # {node.comment}" ) - @visitor.when(cil.GetAttribNode) - def visit(self, node: cil.GetAttribNode): + @visitor.when(cil.GetAttributeNode) + def visit(self, node: cil.GetAttributeNode): return ( f"{node.dest} = GETATTR {node.instance} {node.attr}" if node.comment == "" @@ -287,6 +295,22 @@ def visit(self, node: cil.SetIndexNode): if node.comment == "" else f"SETINDEX {node.instance} {node.index} {node.source} # {node.comment}" ) + + @visitor.when(cil.GetValueInIndexNode) + def visit(self, node: cil.GetIndexNode): + return ( + f"{node.dest} = GETVALUEINDEX {node.instance} {node.index}" + if node.comment == "" + else f"{node.dest} = GETVALUEINDEX {node.instance} {node.index} # {node.comment}" + ) + + @visitor.when(cil.SetValueInIndexNode) + def visit(self, node: cil.SetIndexNode): + return ( + f"SETVALUEINDEX {node.instance} {node.index} {node.source}" + if node.comment == "" + else f"SETVALUEINDEX {node.instance} {node.index} {node.source} # {node.comment}" + ) @visitor.when(cil.HaltNode) def visit(self, node: cil.HaltNode): @@ -376,6 +400,16 @@ def visit(self, node: cil.AllocateIntNode): def visit(self, node: cil.AllocateBoolNode): return (f"{node.dest} = ALLOCBOOL {node.value}") if node.comment == "" else f"{node.dest} = ALLOCBOOL {node.value} # {node.comment}" + @visitor.when(cil.AllocateNullPtrNode) + def visit(self, node: cil.AllocateNullPtrNode): + return (f"{node.dest} = ALLOCNULL") if node.comment == "" else f"{node.dest} = ALLOCNULL # {node.comment}" + + + @visitor.when(cil.AssertTypeNode) + def visit(self, node: cil.AssertTypeNode): + return f"ASSERT {node.address}" + + @visitor.when(cil.CommentNode) def visit(self, node: cil.CommentNode): return f"# {node.comment}" diff --git a/src/cool/code_generation/translator_cil_to_mips.py b/src/cool/code_generation/translator_cil_to_mips.py index 3916a85e3..1ad574aef 100644 --- a/src/cool/code_generation/translator_cil_to_mips.py +++ b/src/cool/code_generation/translator_cil_to_mips.py @@ -23,7 +23,7 @@ def register_word(self, name: str, value: str) -> mips.WordDataNode: self.dotdata.append(data) return data - def register_ascii(self, name: str, value: str) -> mips.AsciizDataNode: + def register_asciiz(self, name: str, value: str) -> mips.AsciizDataNode: data = mips.AsciizDataNode(name, value) self.dotdata.append(data) return data @@ -77,7 +77,7 @@ def visit(self, node: cil.ProgramNode): self.visit(type_node) self.register_space("buffer_input", 1024) - self.register_ascii("debug_log", "\"debug_log\\n\"") + self.register_asciiz("debug_log", "\"debug_log\\n\"") for function_node in node.dotcode: self.visit(function_node) @@ -92,8 +92,8 @@ def visit(self, node: cil.TypeNode): self.register_word(self.to_data_type("inherits_from", node.name),f"type_{node.parent}" if node.parent != "null" else "0") self.register_word(self.to_data_type("attributes", node.name), str(len(node.attributes))) self.register_word(self.to_data_type("name_size", node.name), str(len(node.name))) - self.register_ascii(self.to_data_type("name", node.name), f'"{node.name}"') - + self.register_asciiz(self.to_data_type("name", node.name), f'"{node.name}"') + self.register_empty_data() @visitor.when(cil.FunctionNode) @@ -123,7 +123,7 @@ def visit(self, node: cil.FunctionNode): for instruction in node.instructions: # TODO: Remove the try/except block when the visitor is fixed try: - if isinstance(instruction, cil.EmptyInstruction): + if isinstance(instruction, (cil.EmptyInstruction, cil.CommentNode)): continue self.visit(instruction) self.register_empty_instruction() @@ -141,29 +141,23 @@ def visit(self, node: cil.FunctionNode): @visitor.when(cil.AssignNode) def visit(self, node: cil.AssignNode): - self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.source)}($sp)")) - self.register_instruction(mips.LoadWordNode("$t1", "0($t0)")) - self.register_instruction(mips.LoadAddressNode("$t2", "type_Main")) - self.register_instruction(mips.LoadAddressNode("$t3", "type_Bool")) - self.register_instruction(mips.BeqNode("$t1", "$t2", "is_Bool_or_Int")) - self.register_instruction(mips.BeqNode("$t1", "$t3", "is_Bool_or_Int")) - self.register_instruction(mips.JumpNode("not_is_Bool_or_Int")) - self.register_instruction(mips.LabelNode("is_Bool_or_Int")) - self.register_instruction(mips.LoadWordNode("$t4", "8($t0)")) - self.register_instruction(mips.LoadWordNode("$t5", f"{self.offset_of(node.dest)}($sp)")) - - self.register_instruction(mips.JumpNode("end_assign")) - - self.register_instruction(mips.LabelNode("not_is_Bool_or_Int")) self.register_comment(f"{node.dest} = {node.source}") - if node.source.isdigit(): - self.register_instruction(mips.AddiNode("$t0", "$zero", node.source)) - elif node.source == "NULL": - self.register_instruction(mips.AddiNode("$t0", "$zero", "0")) - else: - self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.source)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.source)}($sp)")) self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)")) - self.register_instruction(mips.LabelNode("end_assign")) + + @visitor.when(cil.AssignIntNode) + def visit(self, node: cil.AssignIntNode): + self.register_comment(f"{node.dest} = {node.source} where {node.source} is an integer") + self.register_instantiation(12) + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.source)}($sp)").set_comment(f"Pointer to {node.source}")) + self.register_instruction(mips.LoadWordNode("$t1", "0($t0)").set_comment(f"$t1 = type of {node.source}")) + self.register_instruction(mips.LoadWordNode("$t2", "8($t0)").set_comment(f"$t2 = value of {node.source}")) + + self.register_instruction(mips.StoreWordNode("$t1", "0($v0)").set_comment(f"Save type of {node.dest}")) + self.register_instruction(mips.StoreWordNode("$a0", "4($v0)").set_comment(f"Save size of {node.dest}")) + self.register_instruction(mips.StoreWordNode("$t2", "8($v0)").set_comment(f"Save value of {node.dest}")) + + self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)")) @visitor.when(cil.ArgNode) def visit(self, node: cil.ArgNode): @@ -203,28 +197,9 @@ def visit(self, node: cil.AllocateNode): self.register_instruction(mips.StoreWordNode("$a0", "4($v0)").set_comment("Setting size in the second word of th object")) self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = address of allocated object {node.type}")) - @visitor.when(cil.AllocateIntNode) - def visit(self, node: cil.AllocateIntNode): - self.register_comment(f"Allocating {node.value}") - - self.register_instruction(mips.LoadInmediateNode("$v0", "9")) - self.register_instruction(mips.AddiNode("$a0", "$zero", "12")) - self.register_instruction(mips.SystemCallNode()) - - self.register_instruction(mips.LoadAddressNode("$t0", "type_Int").set_comment("$t0 = address of the type")) - self.register_instruction(mips.StoreWordNode("$t0", "0($v0)").set_comment("Setting type in the first word of th object")) - - self.register_instruction(mips.StoreWordNode("$a0", "4($v0)").set_comment("Setting size in the second word of th object")) - - self.register_instruction(mips.AddiNode("$t0", "$zero", node.value)) - self.register_instruction(mips.StoreWordNode("$t0", "8($v0)").set_comment("Setting value in the third word of th object")) - - self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = address of allocated object Int")) - @visitor.when(cil.AllocateIntNode) def visit(self, node: cil.AllocateIntNode): self.register_comment(f"Allocating Int {node.value}") - self.register_instruction(mips.LoadInmediateNode("$v0", "9")) self.register_instruction(mips.AddiNode("$a0", "$zero", "12")) self.register_instruction(mips.SystemCallNode()) @@ -267,7 +242,7 @@ def visit(self, node: cil.AllocateStrNode): self.register_instruction(mips.StoreWordNode("$t0", f"0($v0)").set_comment("Setting type in the first word of the object")) self.register_empty_instruction() - self.register_instruction(mips.AddiNode("$t0", "$zero", f"{node.length}")) + self.register_instruction(mips.AddiNode("$t0", "$zero", f"{9 + node.length}")) self.register_instruction(mips.StoreWordNode("$t0", f"4($v0)").set_comment("Setting length of the string in the second word of the object")) self.register_empty_instruction() @@ -284,13 +259,19 @@ def visit(self, node: cil.AllocateStrNode): self.register_empty_instruction() self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = {node.value}")) + @visitor.when(cil.AllocateNullPtrNode) + def visit(self, node: cil.AllocateNullPtrNode): + self.register_comment(f"Allocating NUll to {node.dest}") + self.register_instruction(mips.StoreWordNode("$zero", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = 0")) + @visitor.when(cil.LengthNode) def visit(self, node: cil.LengthNode): self.register_comment(f"{node.dest} = length of {node.str_address}") self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.str_address)}($sp)")) self.register_instruction(mips.LoadWordNode("$t1", "4($t0)")) self.register_instruction(mips.AddiNode("$t1", "$t1", "-9").set_comment("Subtracting 9 for the type, length, and null-terminator")) - self.register_instruction(mips.StoreWordNode("$t1", f"{self.offset_of(node.dest)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.dest)}($sp)")) + self.register_instruction(mips.StoreWordNode("$t1", "8($t0)")) @visitor.when(cil.ConcatNode) def visit(self, node: cil.ConcatNode): @@ -299,6 +280,9 @@ def visit(self, node: cil.ConcatNode): self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.str2)}($sp)")) self.register_instruction(mips.LoadWordNode("$t2", "4($t0)").set_comment("$t2 = length of str1")) self.register_instruction(mips.LoadWordNode("$t3", "4($t1)").set_comment("$t3 = length of str2")) + self.register_instruction(mips.AddiNode("$t2", "$t2", "-9")) + self.register_instruction(mips.AddiNode("$t3", "$t3", "-9")) + self.register_instruction(mips.AddNode("$t4", "$t2", "$t3").set_comment("$t4 = length of str1 + str2")) self.register_instruction(mips.AddiNode("$t4", "$t4", "9").set_comment("Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte)")) self.register_empty_instruction() @@ -322,7 +306,7 @@ def visit(self, node: cil.ConcatNode): self.register_instruction(mips.XorNode("$t6", "$t6", "$t6").set_comment("$t6 = 0 Initializing counter")) self.register_instruction(mips.LabelNode("while_copy_str1_start")) self.register_instruction(mips.BeqNode("$t6", "$t2", "while_copy_str1_end")) - self.register_instruction(mips.LoadByteNode("$t7", f"0($t0)")) + self.register_instruction(mips.LoadByteNode("$t7", f"8($t0)")) self.register_instruction(mips.StoreByteNode("$t7", f"0($t5)")) self.register_instruction(mips.AddNode("$t0", "$t0", "1").set_comment("$t0 = $t0 + 1 Incrementing the address of str1")) self.register_instruction(mips.AddNode("$t5", "$t5", "1").set_comment("$t5 = $t5 + 1 Incrementing the address of the new string")) @@ -334,7 +318,7 @@ def visit(self, node: cil.ConcatNode): self.register_comment(f"Copying str2 to the new string") self.register_instruction(mips.LabelNode("while_copy_str2_start")) self.register_instruction(mips.BeqNode("$t6", "$t4", "while_copy_str2_end")) - self.register_instruction(mips.LoadByteNode("$t7", f"0($t1)")) + self.register_instruction(mips.LoadByteNode("$t7", f"8($t1)")) self.register_instruction(mips.StoreByteNode("$t7", f"0($t5)")) self.register_instruction(mips.AddNode("$t1", "$t1", "1").set_comment("$t0 = $t0 + 1 Incrementing the address of str1")) self.register_instruction(mips.AddNode("$t5", "$t5", "1").set_comment("$t5 = $t5 + 1 Incrementing the address of the new string")) @@ -353,12 +337,15 @@ def visit(self, node: cil.SubstringNode): self.register_comment(f"{node.dest} = {node.str_address}[{node.start}:{node.start} + {node.length}]") self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.str_address)}($sp)").set_comment("$t0 = address of the string")) self.register_instruction(mips.LoadWordNode("$t1", f"4($t0)").set_comment("$t1 = length of the string")) + self.register_instruction(mips.AddiNode("$t1", "$t1", "-9").set_comment("$t1 = length of the string + 9")) self.register_instruction(mips.LoadWordNode("$t2", f"{self.offset_of(node.start)}($sp)").set_comment("$t2 = start of the substring")) + self.register_instruction(mips.LoadWordNode("$t2", "8($t2)")) self.register_instruction(mips.LoadWordNode("$t3", f"{self.offset_of(node.length)}($sp)").set_comment("$t3 = length of the substring")) + self.register_instruction(mips.LoadWordNode("$t3", "8($t3)")) self.register_instruction(mips.AddNode("$t4", "$t2", "$t3").set_comment("$t4 = start of the substring + length of the substring")) self.register_empty_instruction() - self.register_instruction(mips.BgeNode("$t4", "$t1", "substring_out_of_bounds")) + self.register_instruction(mips.BgtNode("$t4", "$t1", "substring_out_of_bounds")) self.register_empty_instruction() self.register_instruction(mips.AddiNode("$t3", "$t3", "9")) @@ -406,39 +393,185 @@ def visit(self, node: cil.SubstringNode): self.register_empty_instruction() self.register_instruction(mips.LabelNode("substring_not_out_of_bounds")) - @visitor.when(cil.GetAttribNode) - def visit(self, node: cil.GetAttribNode): + @visitor.when(cil.GetAttributeNode) + def visit(self, node: cil.GetAttributeNode): + node_id = hash(node) self.register_comment(f"Get attribute {node.attr} of {node.instance}") self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.instance)}($sp)").set_comment(f"Get the address of {node.instance}")) self.register_instruction(mips.LoadWordNode("$t1", f"{4 * (node.attr_index + 2)}($t0)").set_comment(f"Get the attribute '{node.attr}' from the instance")) + + self.register_instruction(mips.LoadWordNode("$t2", "0($t1)")) + self.register_instruction(mips.LoadAddressNode("$t3", "type_Int")) + self.register_instruction(mips.LoadAddressNode("$t4", "type_Bool")) + self.register_instruction(mips.AddiNode("$t5", "$zero", "1")) + self.register_instruction(mips.SeqNode("$t6", "$t2", "$t3")) + self.register_instruction(mips.BeqNode("$t6", "$t5", f"int_get_attribute_{node_id}")) + self.register_instruction(mips.SeqNode("$t6", "$t2", "$t4")) + self.register_instruction(mips.BeqNode("$t6", "$t5", f"bool_get_attribute_{node_id}")) + self.register_instruction(mips.JumpNode(f"object_get_attribute_{node_id}")) + + self.register_instruction(mips.LabelNode(f"int_get_attribute_{node_id}")) + + self.register_instruction(mips.LoadInmediateNode("$v0", "9")) + self.register_instruction(mips.AddiNode("$a0", "$zero", "12")) + self.register_instruction(mips.SystemCallNode()) + + self.register_instruction(mips.StoreWordNode("$t3", "0($v0)")) + self.register_instruction(mips.StoreWordNode("$a0", "4($v0)")) + self.register_instruction(mips.LoadWordNode("$t5", "8($t1)")) + self.register_instruction(mips.StoreWordNode("$t5", "8($v0)")) + self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = {node.instance}.{node.attr}")) + self.register_instruction(mips.JumpNode(f"end_get_attribute_{node_id}")) + + self.register_instruction(mips.LabelNode(f"bool_get_attribute_{node_id}")) + + self.register_instruction(mips.LoadInmediateNode("$v0", "9")) + self.register_instruction(mips.AddiNode("$a0", "$zero", "12")) + self.register_instruction(mips.SystemCallNode()) + + self.register_instruction(mips.StoreWordNode("$t4", "0($v0)")) + self.register_instruction(mips.StoreWordNode("$a0", "4($v0)")) + self.register_instruction(mips.LoadWordNode("$t5", "8($t1)")) + self.register_instruction(mips.StoreWordNode("$t5", "8($v0)")) + self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = {node.instance}.{node.attr}")) + self.register_instruction(mips.JumpNode(f"end_get_attribute_{node_id}")) + + self.register_instruction(mips.LabelNode(f"object_get_attribute_{node_id}")) self.register_instruction(mips.StoreWordNode("$t1",f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = {node.attr}")) + self.register_instruction(mips.LabelNode(f"end_get_attribute_{node_id}")) @visitor.when(cil.SetAttributeNode) def visit(self, node: cil.SetAttributeNode): + node_id = hash(node) self.register_comment(f"Set attribute {node.attr} of {node.instance}") self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.instance)}($sp)").set_comment(f"$t0 = {node.instance}")) - if node.source.isdigit(): - self.register_instruction(mips.AddiNode("$t1", "$zero", node.source).set_comment(f"$t1 {node.source}")) - self.register_instruction(mips.StoreWordNode("$t1", f"{4 * (node.attr_index + 2)}($t0)").set_comment(f"Set the attribute {node.attr} of {node.instance}")) - elif node.source == "NULL": - self.register_instruction(mips.StoreWordNode("$zero", f"{4 * (node.attr_index + 2)}($t0)").set_comment(f"Set the attribute {node.attr} of {node.instance}")) - else: - self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.source)}($sp)").set_comment(f"$t1 = {node.source}")) - self.register_instruction(mips.StoreWordNode("$t1", f"{4 * (node.attr_index + 2)}($t0)").set_comment(f"{node.instance}.{node.attr} = {node.source}")) + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.source)}($sp)").set_comment(f"$t1 = {node.source}")) + + self.register_instruction(mips.BeqNode("$t1", "$zero", f"object_set_attribute_{node_id}")) + + self.register_instruction(mips.LoadWordNode("$t2", "0($t1)")) + self.register_instruction(mips.LoadAddressNode("$t3", "type_Int")) + self.register_instruction(mips.LoadAddressNode("$t4", "type_Bool")) + self.register_instruction(mips.AddiNode("$t5", "$zero", "1")) + self.register_instruction(mips.SeqNode("$t6", "$t2", "$t3")) + self.register_instruction(mips.BeqNode("$t6", "$t5", f"int_set_attribute_{node_id}")) + self.register_instruction(mips.SeqNode("$t6", "$t2", "$t4")) + self.register_instruction(mips.BeqNode("$t6", "$t5", f"bool_set_attribute_{node_id}")) + self.register_instruction(mips.JumpNode(f"object_set_attribute_{node_id}")) + + self.register_instruction(mips.LabelNode(f"int_set_attribute_{node_id}")) + + self.register_instruction(mips.LoadInmediateNode("$v0", "9")) + self.register_instruction(mips.AddiNode("$a0", "$zero", "12")) + self.register_instruction(mips.SystemCallNode()) + + self.register_instruction(mips.StoreWordNode("$t3", "0($v0)")) + self.register_instruction(mips.StoreWordNode("$a0", "4($v0)")) + self.register_instruction(mips.LoadWordNode("$t5", "8($t1)")) + self.register_instruction(mips.StoreWordNode("$t5", "8($v0)")) + self.register_instruction(mips.StoreWordNode("$v0", f"{4 * (node.attr_index + 2)}($t0)").set_comment(f"{node.instance}.{node.attr} = {node.source}")) + self.register_instruction(mips.JumpNode(f"end_set_attribute_{node_id}")) + + self.register_instruction(mips.LabelNode(f"bool_set_attribute_{node_id}")) + + self.register_instruction(mips.LoadInmediateNode("$v0", "9")) + self.register_instruction(mips.AddiNode("$a0", "$zero", "12")) + self.register_instruction(mips.SystemCallNode()) + + self.register_instruction(mips.StoreWordNode("$t4", "0($v0)")) + self.register_instruction(mips.StoreWordNode("$a0", "4($v0)")) + self.register_instruction(mips.LoadWordNode("$t5", "8($t1)")) + self.register_instruction(mips.StoreWordNode("$t5", "8($v0)")) + self.register_instruction(mips.StoreWordNode("$v0", f"{4 * (node.attr_index + 2)}($t0)").set_comment(f"{node.instance}.{node.attr} = {node.source}")) + self.register_instruction(mips.JumpNode(f"end_set_attribute_{node_id}")) + + self.register_instruction(mips.LabelNode(f"object_set_attribute_{node_id}")) + self.register_instruction(mips.StoreWordNode("$t1", f"{4 * (node.attr_index + 2)}($t0)").set_comment(f"{node.instance}.{node.attr} = {node.source}")) + self.register_instruction(mips.LabelNode(f"end_set_attribute_{node_id}")) + + @visitor.when(cil.ArrayNode) + def visit(self, node: cil.ArrayNode): + self.register_comment(f"initialize Array [{node.size}]") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.size)}($sp)").set_comment(f"$t0 = {node.size}")) + self.register_instruction(mips.LoadWordNode("$t0", "8($t0)").set_comment("$t0 = value of the size")) + self.register_instruction(mips.AddiNode("$t1", "$zero", "4").set_comment("$t1 = 4")) + self.register_instruction(mips.MultNode("$t0", "$t1").set_comment("$t0 = $t0 * 4")) + self.register_instruction(mips.MoveFromLowNode("$t0")) + self.register_instantiation("$t0") + self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = new Array[{node.size}]")) + + @visitor.when(cil.GetIndexNode) + def visit(self, node: cil.GetIndexNode): + self.register_comment(f"{node.dest} = array {node.instance}[4 * {node.index}]") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.index)}($sp)").set_comment(f"$t0 = {node.index}")) + self.register_instruction(mips.LoadWordNode("$t0", "8($t0)").set_comment("$t0 = value of the index")) + self.register_instruction(mips.AddiNode("$t1", "$zero", "4").set_comment("$t1 = 4")) + self.register_instruction(mips.MultNode("$t0", "$t1").set_comment("$t0 = $t0 * 4")) + self.register_instruction(mips.MoveFromLowNode("$t0")) + + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.instance)}($sp)").set_comment(f"$t1 = {node.instance}")) + self.register_instruction(mips.AddNode("$t1", "$t1", "$t0").set_comment("Move the pointer to the index")) + self.register_instruction(mips.LoadWordNode("$t0", "0($t1)").set_comment("$t1 = value in the position")) + self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = array {node.instance}[4 * {node.index}]")) + + @visitor.when(cil.SetIndexNode) + def visit(self, node: cil.SetIndexNode): + self.register_comment(f"array {node.instance}[4 * {node.index}] = {node.source}") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.index)}($sp)").set_comment(f"$t0 = {node.index}")) + self.register_instruction(mips.LoadWordNode("$t0", "8($t0)").set_comment("$t0 = value of the index")) + self.register_instruction(mips.AddiNode("$t1", "$zero", "4").set_comment("$t1 = 4")) + self.register_instruction(mips.MultNode("$t0", "$t1").set_comment("$t0 = $t0 * 4")) + self.register_instruction(mips.MoveFromLowNode("$t0")) + + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.instance)}($sp)").set_comment(f"$t1 = {node.instance}")) + self.register_instruction(mips.AddNode("$t1", "$t1", "$t0").set_comment("Move the pointer to the index")) + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.source)}($sp)")) + self.register_instruction(mips.StoreWordNode("$t0", "0($t1)")) + + @visitor.when(cil.GetValueInIndexNode) + def visit(self, node: cil.GetValueInIndexNode): + self.register_comment(f"{node.dest} = array {node.instance}[4 * {node.index}]") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.index)}($sp)").set_comment(f"$t0 = {node.index}")) + self.register_instruction(mips.LoadWordNode("$t0", "8($t0)").set_comment("$t0 = value of the index")) + self.register_instruction(mips.AddiNode("$t1", "$zero", "4").set_comment("$t1 = 4")) + self.register_instruction(mips.MultNode("$t0", "$t1").set_comment("$t0 = $t0 * 4")) + self.register_instruction(mips.MoveFromLowNode("$t0")) + + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.instance)}($sp)").set_comment(f"$t1 = {node.instance}")) + self.register_instruction(mips.AddNode("$t1", "$t1", "$t0").set_comment("Move the pointer to the index")) + self.register_instruction(mips.LoadWordNode("$t0", "0($t1)").set_comment("$t1 = value in the position")) + self.register_instruction(mips.LoadWordNode("$t2", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = array {node.instance}[4 * {node.index}]")) + self.register_instruction(mips.StoreWordNode("$t0", "8($t2)")) + + + @visitor.when(cil.SetValueInIndexNode) + def visit(self, node: cil.SetValueInIndexNode): + self.register_comment(f"array {node.instance}[4 * {node.index}] = {node.source}") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.index)}($sp)").set_comment(f"$t0 = {node.index}")) + self.register_instruction(mips.LoadWordNode("$t0", "8($t0)").set_comment("$t0 = value of the index")) + self.register_instruction(mips.AddiNode("$t1", "$zero", "4").set_comment("$t1 = 4")) + self.register_instruction(mips.MultNode("$t0", "$t1").set_comment("$t0 = $t0 * 4")) + self.register_instruction(mips.MoveFromLowNode("$t0")) + + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.instance)}($sp)").set_comment(f"$t1 = {node.instance}")) + self.register_instruction(mips.AddNode("$t1", "$t1", "$t0").set_comment("Move the pointer to the index")) + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.source)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t0", "8($t0)")) + self.register_instruction(mips.StoreWordNode("$t0", "0($t1)")) @visitor.when(cil.TypeOfNode) def visit(self, node: cil.TypeOfNode): self.register_comment(f"{node.dest} = typeof {node.source} that is the first word of the object") self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.source)}($sp)")) - self.register_instruction(mips.LoadWordNode("$t1", "0($t0)")) - self.register_instruction(mips.StoreWordNode("$t1", f"{self.offset_of(node.dest)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t0", "0($t0)")) + self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)")) @visitor.when(cil.AncestorNode) def visit(self, node: cil.AncestorNode): - self.register_comment(f"{node.dest} = ancestor of {node.source} that is the first word of the object") + self.register_comment(f"{node.dest} = ancestor of {node.source}") self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.source)}($sp)")) - self.register_instruction(mips.LoadWordNode("$t1", "4($t0)")) - self.register_instruction(mips.StoreWordNode("$t1", f"{self.offset_of(node.dest)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t0", "4($t0)")) + self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)")) @visitor.when(cil.TypeAddressNode) def visit(self, node: cil.TypeAddressNode): @@ -484,6 +617,7 @@ def visit(self, node: cil.EqualStrNode): self.register_instruction(mips.LabelNode("while_compare_strings_start")) self.register_instruction(mips.LoadByteNode("$t2", "0($t0)")) self.register_instruction(mips.LoadByteNode("$t3", "0($t1)")) + self.register_instruction(mips.BeqNode("$t2", "$t3", "while_compare_strings_update")) self.register_empty_instruction() @@ -497,6 +631,7 @@ def visit(self, node: cil.EqualStrNode): self.register_instruction(mips.AddiNode("$t0", "$t0", "1")) self.register_instruction(mips.AddiNode("$t1", "$t1", "1")) self.register_instruction(mips.BeqNode("$t2", "$zero", "while_compare_strings_end")) + self.register_instruction(mips.BeqNode("$t3", "$zero", "while_compare_strings_end")) self.register_instruction(mips.JumpNode("while_compare_strings_start")) self.register_instruction(mips.LabelNode("while_compare_strings_end")) @@ -506,7 +641,7 @@ def visit(self, node: cil.TypeNameNode): self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.source)}($sp)").set_comment(f"$t0 = {node.source}")) self.register_instruction(mips.LoadWordNode("$t1", "0($t0)").set_comment(f"$t1 = type of {node.source}")) self.register_instruction(mips.LoadWordNode("$t2", "12($t1)").set_comment(f"$t1 = length of the name of {node.source}")) - self.register_instruction(mips.LoadWordNode("$t3", "16($t1)").set_comment(f"$t1 = name of {node.source}")) + self.register_instruction(mips.LoadAddressNode("$t3", "16($t1)").set_comment(f"$t1 = name of {node.source}")) self.register_empty_instruction() self.register_instruction(mips.AddiNode("$t2", "$t2", "9").set_comment(f"Setting space for the type, the size and the null byte")) @@ -516,21 +651,18 @@ def visit(self, node: cil.TypeNameNode): self.register_instruction(mips.LoadAddressNode("$t4", "type_String")) self.register_instruction(mips.StoreWordNode("$t4", f"0($v0)").set_comment("Setting type in the first word of the object")) - self.register_empty_instruction() - self.register_instruction(mips.StoreWordNode("$a0", f"4($v0)").set_comment("Setting length in the second word of the object")) self.register_empty_instruction() - self.register_instruction(mips.MoveNode("$t4", "$v0").set_comment("$t4 = direction of the new string")) + self.register_instruction(mips.AddiNode("$t4", "$v0", 0).set_comment("$t4 = direction of the new string")) self.register_instruction(mips.AddiNode("$t4", "$t4", "8").set_comment("Pointer to the first character of the string")) - self.register_instruction(mips.AddiNode("$t0", "$t0", "8").set_comment(f"Pointer to the first character of the string in {node.source}")) self.register_instruction(mips.XorNode("$t5", "$t5", "$t5").set_comment("Initializing counter")) self.register_instruction(mips.LabelNode("while_copy_name_start")) - self.register_instruction(mips.BeqNode("$t5", "$t1", "while_copy_name_end")) - self.register_instruction(mips.LoadByteNode("$t6", "0($t0)").set_comment("Loading the character")) + self.register_instruction(mips.BeqNode("$t5", "$t2", "while_copy_name_end")) + self.register_instruction(mips.LoadByteNode("$t6", "0($t3)").set_comment("Loading the character")) self.register_instruction(mips.StoreByteNode("$t6", "0($t4)")) self.register_instruction(mips.AddiNode("$t4", "$t4", "1").set_comment("Incrementing the pointer to the new string")) - self.register_instruction(mips.AddiNode("$t0", "$t0", "1").set_comment(f"Incrementing the pointer to the string in {node.source}")) + self.register_instruction(mips.AddiNode("$t3", "$t3", "1").set_comment(f"Incrementing the pointer to the string in {node.source}")) self.register_instruction(mips.AddiNode("$t5", "$t5", "1").set_comment("Incrementing counter")) self.register_instruction(mips.JumpNode("while_copy_name_start")) self.register_instruction(mips.LabelNode("while_copy_name_end")) @@ -539,7 +671,7 @@ def visit(self, node: cil.TypeNameNode): self.register_instruction(mips.StoreByteNode("$zero", "0($t4)").set_comment("Setting the null byte")) self.register_empty_instruction() - self.register_instruction(mips.StoreWordNode("$t4", f"{self.offset_of(node.dest)}($sp)").set_comment(f"Storing the new string in {node.dest}")) + self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"Storing the new string in {node.dest}")) @visitor.when(cil.CopyNode) def visit(self, node: cil.CopyNode): @@ -601,27 +733,33 @@ def visit(self, node: cil.ReadStringNode): self.register_instruction(mips.LoadAddressNode("$a0", "buffer_input")) self.register_instruction(mips.LoadInmediateNode("$a1", "1024")) self.register_instruction(mips.SystemCallNode()) + self.register_empty_instruction() self.register_instruction(mips.XorNode("$t0", "$t0", "$t0").set_comment("Initializing counter")) self.register_instruction(mips.LabelNode("while_read_start")) - self.register_instruction(mips.LoadWordNode("$t1", "buffer_input($t0)").set_comment("Loading the byte")) + self.register_instruction(mips.LoadByteNode("$t1", "buffer_input($t0)").set_comment("Loading the byte")) self.register_instruction(mips.BeqNode("$t1", "$zero", "while_read_end")) self.register_instruction(mips.AddiNode("$t0", "$t0", "1").set_comment("Incrementing counter")) self.register_instruction(mips.JumpNode("while_read_start")) self.register_instruction(mips.LabelNode("while_read_end")) + + self.register_instruction(mips.AddiNode("$t0", "$t0", "-1").set_comment("Decrementing counter to eliminate the '\\n'")) + self.register_empty_instruction() self.register_instruction(mips.AddiNode("$t0", "$t0", "9").set_comment("Adding space for the type, the size and the null byte")) self.register_instantiation("$t0") + self.register_instruction(mips.AddiNode("$t0", "$t0", "-9").set_comment("Adding space for the type, the size and the null byte")) self.register_instruction(mips.LoadAddressNode("$t2", "type_String")) self.register_instruction(mips.StoreWordNode("$t2", "0($v0)").set_comment("Setting type in the first word of the object")) self.register_instruction(mips.StoreWordNode("$a0", "4($v0)").set_comment("Setting length in the second word of the object")) + self.register_empty_instruction() self.register_instruction(mips.AddiNode("$t3", "$v0", "8").set_comment("Pointer to the first character of the string")) self.register_instruction(mips.XorNode("$t4", "$t4", "$t4").set_comment("Initializing counter")) self.register_empty_instruction() self.register_instruction(mips.LabelNode("while_copy_from_buffer_start")) self.register_instruction(mips.BeqNode("$t4", "$t0", "while_copy_from_buffer_end")) - self.register_instruction(mips.LoadWordNode("$t5", "buffer_input($t4)").set_comment("Loading the byte")) + self.register_instruction(mips.LoadByteNode("$t5", "buffer_input($t4)").set_comment("Loading the byte")) self.register_instruction(mips.StoreByteNode("$t5", "0($t3)").set_comment("Storing the byte")) self.register_instruction(mips.AddiNode("$t3", "$t3", "1").set_comment("Imcremeenting pointer")) self.register_instruction(mips.AddiNode("$t4", "$t4", "1").set_comment("Incrementing counter")) @@ -636,8 +774,8 @@ def visit(self, node: cil.ReadStringNode): def visit(self, node: cil.ReadIntNode): self.register_instruction(mips.LoadInmediateNode("$v0", "5")) self.register_instruction(mips.SystemCallNode()) - - self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"Storing the new object in {node.dest}")) + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.dest)}($sp)")) + self.register_instruction(mips.StoreWordNode("$v0", "8($t0)")) @visitor.when(cil.LabelNode) def visit(self, node: cil.LabelNode): @@ -743,3 +881,12 @@ def postprocess_binary_int_operation(self, node: cil.ArithmeticNode, t: str): self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"$t0 = {node.dest}")) self.register_instruction(mips.StoreWordNode("$t2", "8($t0)").set_comment(f"Setting value in the third word of the {t} object")) + @visitor.when(cil.AssertTypeNode) + def visit(self, node: cil.AssertTypeNode): + self.register_comment("Assert type") + self.register_empty_instruction() + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.address)}($sp)").set_comment("Save in $t0 the value address")) + self.register_instruction(mips.AddiNode("$t0", "$t0", "16")) + self.register_instruction(mips.LoadInmediateNode("$v0", "4")) + self.register_instruction(mips.MoveNode("$a0", "$t0")) + self.register_instruction(mips.SystemCallNode()) \ No newline at end of file diff --git a/src/cool/code_generation/translator_cool_to_cil.py b/src/cool/code_generation/translator_cool_to_cil.py index b25a61c84..1f3d99602 100644 --- a/src/cool/code_generation/translator_cool_to_cil.py +++ b/src/cool/code_generation/translator_cool_to_cil.py @@ -1,3 +1,4 @@ +from atexit import register from typing import Any, Dict, List, Optional, Tuple import cool.code_generation.ast_cil as cil @@ -740,6 +741,8 @@ def visit(self, node: cool.ProgramNode, scope: Scope): self.current_function.params.append(cil.ParamNode("a")) self.current_function.params.append(cil.ParamNode("b")) result = self.define_internal_local("Equal result") + constant_null = self.define_internal_local("Null Pointer") + is_null = self.define_internal_local("One of params is null") type_of_a = self.define_internal_local("Type of a") type_int = self.define_internal_local("Type Int") type_bool = self.define_internal_local("Type Bool") @@ -747,7 +750,15 @@ def visit(self, node: cool.ProgramNode, scope: Scope): type_a_equals_int = self.define_internal_local("Type of a equals int") type_a_equals_bool = self.define_internal_local("Type of a equals bool") type_a_equals_string = self.define_internal_local("Type of a equals string") + self.register_instruction(cil.AllocateBoolNode(result, "0")) + self.register_instruction(cil.AllocateNullPtrNode(constant_null)) + self.register_instruction(cil.AllocateBoolNode(is_null, "0")) + + self.register_instruction(cil.EqualAddressNode(is_null, "a", constant_null)) + self.register_instruction(cil.EqualAddressNode(is_null, "b", constant_null)) + self.register_instruction(cil.GotoIfNode(is_null, "a_is_type_object")) + self.register_instruction(cil.TypeOfNode(type_of_a, "a")) self.register_instruction(cil.TypeAddressNode(type_int, "Int")) self.register_instruction(cil.TypeAddressNode(type_bool, "Bool")) @@ -755,6 +766,7 @@ def visit(self, node: cool.ProgramNode, scope: Scope): self.register_instruction(cil.AllocateBoolNode(type_a_equals_int, "0")) self.register_instruction(cil.AllocateBoolNode(type_a_equals_bool, "0")) self.register_instruction(cil.AllocateBoolNode(type_a_equals_string, "0")) + self.register_instruction(cil.EqualAddressNode(type_a_equals_int, type_of_a, type_int)) self.register_instruction(cil.EqualAddressNode(type_a_equals_bool, type_of_a, type_bool)) self.register_instruction(cil.EqualAddressNode(type_a_equals_string, type_of_a, type_string)) @@ -784,12 +796,76 @@ def visit(self, node: cool.ProgramNode, scope: Scope): self.register_instruction(cil.ReturnNode(result)) + self.current_function = self.register_function("function_assign") + self.current_function.params.append(cil.ParamNode("dest")) + self.current_function.params.append(cil.ParamNode("source")) + constant_null = self.define_internal_local("Null Pointer") + is_null = self.define_internal_local("One of params is null") + type_of_source = self.define_internal_local("Type of source") + type_int = self.define_internal_local("Type Int") + type_bool = self.define_internal_local("Type Bool") + type_source_equals_int = self.define_internal_local("Type of source equals int") + type_source_equals_bool = self.define_internal_local("Type of source equals bool") + + self.register_instruction(cil.AllocateNullPtrNode(constant_null)) + self.register_instruction(cil.AllocateBoolNode(is_null, "0")) + self.register_instruction(cil.EqualAddressNode(is_null, "source", constant_null)) + self.register_instruction(cil.EqualAddressNode(is_null, "dest", constant_null)) + self.register_instruction(cil.GotoIfNode(is_null, "source_is_type_object")) + + self.register_instruction(cil.TypeOfNode(type_of_source, "source")) + self.register_instruction(cil.TypeAddressNode(type_int, "Int")) + self.register_instruction(cil.TypeAddressNode(type_bool, "Bool")) + self.register_instruction(cil.AllocateBoolNode(type_source_equals_int, "0")) + self.register_instruction(cil.AllocateBoolNode(type_source_equals_bool, "0")) + self.register_instruction(cil.EqualAddressNode(type_source_equals_int, type_of_source, type_int)) + self.register_instruction(cil.EqualAddressNode(type_source_equals_bool, type_of_source, type_bool)) + self.register_empty_instruction() + self.register_instruction(cil.GotoIfNode(type_source_equals_int, "source_is_type_int_or_bool")) + self.register_instruction(cil.GotoIfNode(type_source_equals_bool, "source_is_type_int_or_bool")) + self.register_instruction(cil.GotoNode("source_is_type_object")) + + self.register_empty_instruction() + self.register_instruction(cil.LabelNode("source_is_type_int_or_bool")) + + self.register_instruction(cil.AssignIntNode("dest", "source")) + self.register_instruction(cil.GotoNode("source_end_of_equal")) + + self.register_empty_instruction() + self.register_instruction(cil.LabelNode("source_is_type_object")) + self.register_instruction(cil.AssignNode("dest", "source")) + self.register_instruction(cil.GotoNode("source_end_of_equal")) + + self.register_empty_instruction() + self.register_instruction(cil.LabelNode("source_end_of_equal")) + + self.register_instruction(cil.ReturnNode("dest")) + + self.current_function = self.register_function(self.to_function_name("__init__", "Object")) self.current_function.params.append(cil.ParamNode("self")) self.register_instruction(cil.ReturnNode("self")) self.current_function = self.register_function(self.to_function_name("abort", "Object")) self.current_function.params.append(cil.ParamNode("self")) + msg1 = self.define_internal_local() + msg2 = self.define_internal_local() + endl = self.define_internal_local() + msg = self.define_internal_local() + self.register_instruction(cil.AllocateStrNode(msg1, "\"Abort called from class \"")) + self.register_instruction(cil.AllocateStrNode(endl, "\"\\n\"")) + self.register_instruction(cil.ArgNode("self", 0, 1)) + self.register_instruction(cil.DynamicCallNode("String", self.to_function_name("type_name", "Object"), msg2, 1)) + + self.register_instruction(cil.ArgNode(msg1, 0, 2)) + self.register_instruction(cil.ArgNode(msg2, 1, 2)) + self.register_instruction(cil.DynamicCallNode("String", self.to_function_name("concat", "String"), msg, 2)) + + self.register_instruction(cil.ArgNode(msg, 0, 2)) + self.register_instruction(cil.ArgNode(endl, 1, 2)) + self.register_instruction(cil.DynamicCallNode("String", self.to_function_name("concat", "String"), msg, 2)) + + self.register_instruction(cil.PrintStringNode(msg)) self.register_instruction(cil.HaltNode()) self.register_instruction(cil.ReturnNode("self")) @@ -823,15 +899,16 @@ def visit(self, node: cool.ProgramNode, scope: Scope): self.current_function = self.register_function(self.to_function_name("in_string", "IO")) self.current_function.params.append(cil.ParamNode("self")) - local_int = self.define_internal_local() - self.register_instruction(cil.ReadStringNode(local_int)) - self.register_instruction(cil.ReturnNode(local_int)) + local_str = self.define_internal_local() + self.register_instruction(cil.ReadStringNode(local_str)) + self.register_instruction(cil.ReturnNode(local_str)) self.current_function = self.register_function(self.to_function_name("in_int", "IO")) self.current_function.params.append(cil.ParamNode("self")) - local_int = self.define_internal_local() - self.register_instruction(cil.ReadIntNode(local_int)) - self.register_instruction(cil.ReturnNode(local_int)) + local_str = self.define_internal_local() + self.register_instruction(cil.AllocateIntNode(local_str, "0")) + self.register_instruction(cil.ReadIntNode(local_str)) + self.register_instruction(cil.ReturnNode(local_str)) self.current_function = self.register_function(self.to_function_name("__init__", "String")) self.current_function.params.append(cil.ParamNode("self")) @@ -840,6 +917,7 @@ def visit(self, node: cool.ProgramNode, scope: Scope): self.current_function = self.register_function(self.to_function_name("length", "String")) self.current_function.params.append(cil.ParamNode("self")) len_local = self.define_internal_local() + self.register_instruction(cil.AllocateIntNode(len_local, "0")) self.register_instruction(cil.LengthNode(len_local, "self")) self.register_instruction(cil.ReturnNode(len_local)) @@ -855,9 +933,19 @@ def visit(self, node: cool.ProgramNode, scope: Scope): self.current_function.params.append(cil.ParamNode("i")) self.current_function.params.append(cil.ParamNode("l")) substr = self.define_internal_local() - self.register_instruction(cil.SubstringNode(substr, "self", "i", "l")) + self.register_instruction(cil.SubstringNode(substr, "self", "i", "l")) self.register_instruction(cil.ReturnNode(substr)) + self.current_function = self.register_function(self.to_function_name("__init__", "Int")) + self.current_function.params.append(cil.ParamNode("self")) + self.register_instruction(cil.AllocateIntNode("self", "0")) + self.register_instruction(cil.ReturnNode("self")) + + self.current_function = self.register_function(self.to_function_name("__init__", "Bool")) + self.current_function.params.append(cil.ParamNode("self")) + self.register_instruction(cil.AllocateBoolNode("self", "0")) + self.register_instruction(cil.ReturnNode("self")) + for i, declaration in enumerate(node.declarations): self.visit(declaration, scope.children[i]) @@ -940,22 +1028,29 @@ def visit(self, node: cool.MethodDeclarationNode, scope: Scope): @visitor.when(cool.LetNode) def visit(self, node: cool.LetNode, scope: Scope): scope = node.scope + x = " ".join([f"{name}: {type_name}" for name, type_name, _ in node.declarations]) + self.register_comment(f"Let {x}") + i = 0 for name, type_name, expr in node.declarations: self.register_local(name) if expr: + self.register_empty_instruction() source, _ = self.visit(expr, scope.children[i]) - if source: - self.register_instruction(cil.AssignNode(name, source)) + self.register_instruction(cil.ArgNode(name, 0, 2)) + self.register_instruction(cil.ArgNode(source, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_assign", name, 2)) i += 1 else: - if type_name in ("Int", "Bool"): - self.register_instruction(cil.AssignNode(name, "0")) + if type_name == "Int": + self.register_instruction(cil.AllocateIntNode(name, "0")) + elif type_name == "Bool": + self.register_instruction(cil.AllocateBoolNode(name, "0")) elif type_name == "String": self.register_instruction(cil.AllocateStrNode(name, "\"\"")) else: - self.register_instruction(cil.AssignNode(name, "NULL")) + self.register_instruction(cil.AllocateNullPtrNode(name)) source, t = self.visit(node.expr, scope.children[i]) return source, t @@ -967,6 +1062,7 @@ def visit(self, node: cool.AssignNode, scope: Scope): variables = scope.find_all_variables(node.id) source, _ = self.visit(node.expr, scope) + self.register_empty_instruction() is_attribute = ( self.current_type.contains_attribute(node.id) and len(variables) == 1 ) @@ -976,7 +1072,10 @@ def visit(self, node: cool.AssignNode, scope: Scope): self.register_instruction(cil.SetAttributeNode("self", variable.name, source, attr_names.index(variable.name))) return source, variable.type else: - self.register_instruction(cil.AssignNode(variable.name, source)) + self.register_instruction(cil.ArgNode(variable.name, 0, 2)) + self.register_instruction(cil.ArgNode(source, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_assign", variable.name, 2)) + # self.register_instruction(cil.AssignNode(variable.name, source)) return variable.name, variable.type @visitor.when(cool.BlockNode) @@ -1026,14 +1125,14 @@ def visit(self, node: cool.WhileNode, scope: Scope): scope = node.scope # result_addres = self.define_internal_local() node_id = hash(node) - conditional_address = self.define_internal_local() + self.register_empty_instruction() + self.register_comment(f"While loop") # self.register_instruction(cil.AssignNode(result_addres, 0)) self.register_instruction(cil.LabelNode(f"while_start_{node_id}")) conditional_source, _ = self.visit(node.condition, scope) - self.register_instruction(cil.AssignNode(conditional_address, conditional_source)) - self.register_instruction(cil.GotoIfNode(conditional_address, f"while_body_{node_id}")) + self.register_instruction(cil.GotoIfNode(conditional_source, f"while_body_{node_id}")) self.register_instruction(cil.GotoNode(f"while_end_{node_id}")) self.register_instruction(cil.EmptyInstruction()) @@ -1051,13 +1150,24 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): scope = node.scope node_id = hash(node) swicth_expression, _ = self.visit(node.expr, scope) - count_of_ancestors = self.define_internal_local("Count of ancestors of the switch expression") - switch_expr_type = self.define_internal_local("Switch expression type") - ancestor_type = self.define_internal_local("Ancestor type") - step1_comparison = self.define_internal_local("Step 1 comparison result") - array_of_ancestors = self.define_internal_local("Step 1 Array of ancestors") - constant_zero_int = self.define_internal_local("Integer 0 ") + + constant_zero_int = self.define_internal_local("Constant Integer 0 ") + constant_one_int = self.define_internal_local("Constant Integer 1") + constant_len_types_int = self.define_internal_local(f"Constant Integer {len(node.cases)}") constant_null_ptr = self.define_internal_local("Null pointer") + count_of_ancestors_int = self.define_internal_local("Count of ancestors of the switch expression") + switch_expr_type_address = self.define_internal_local("Switch expression type") + ancestor_type_address = self.define_internal_local("Ancestor type") + step1_comparison_result_bool = self.define_internal_local("Step 1 comparison result") + ancestors_array = self.define_internal_local("Step 1 Array of ancestors") + + self.register_instruction(cil.AllocateIntNode(constant_zero_int, "0")) + self.register_instruction(cil.AllocateIntNode(constant_one_int, "1")) + self.register_instruction(cil.AllocateIntNode(constant_len_types_int, str(len(node.cases)))) + self.register_instruction(cil.AllocateNullPtrNode(constant_null_ptr)) + self.register_instruction(cil.AllocateIntNode(count_of_ancestors_int, "0")) + self.register_instruction(cil.AllocateBoolNode(step1_comparison_result_bool, "0")) + self.register_empty_instruction() self.register_comment("Switch Case Algorithm Steps:") self.register_comment(" 1 - Count how many ancestors has the dynamic type of the expression") @@ -1070,121 +1180,190 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): # While loop to get the count of ancestors # ############################################ - self.register_instruction(cil.AllocateIntNode(constant_zero_int, 0)) - self.register_instruction(cil.AllocateBoolNode(step1_comparison, "0").set_comment("Initialize the comparison result")) - self.register_empty_instruction() self.register_comment("######################################################################## #") self.register_comment("Step 1 - Count how many ancestors has the dynamic type of the expression #") self.register_comment("######################################################################## #") - self.register_instruction(cil.TypeOfNode(switch_expr_type, swicth_expression).set_comment("Get the switch expression type")) - self.register_instruction(cil.AssignNode(ancestor_type, switch_expr_type).set_comment("The first ancestor will be the type itself")) - self.register_instruction(cil.AssignNode(count_of_ancestors, constant_zero_int).set_comment("Initialize the counter")) + self.register_instruction(cil.TypeOfNode(switch_expr_type_address, swicth_expression).set_comment("Get the switch expression type")) + self.register_instruction(cil.AssignNode(ancestor_type_address, switch_expr_type_address).set_comment("The first ancestor will be the type itself")) + + # self.register_instruction(cil.ArgNode(count_of_ancestors_int, 0, 2)) + # self.register_instruction(cil.ArgNode(constant_zero_int, 1, 2)) + # self.register_instruction(cil.StaticCallNode("function_assign", count_of_ancestors_int, 2)) + # self.register_instruction(cil.PrintIntNode(count_of_ancestors_int)) + self.register_instruction(cil.LabelNode(f"while_start_{node_id}")) - self.register_instruction(cil.EqualNode(step1_comparison, ancestor_type, "0")) - self.register_instruction(cil.GotoIfNode(step1_comparison, f"while_end_{node_id}")) - self.register_instruction(cil.PlusNode(count_of_ancestors, count_of_ancestors, "1").set_comment("Increment the counter")) - self.register_instruction(cil.AncestorNode(ancestor_type, ancestor_type)) + self.register_instruction(cil.EqualAddressNode(step1_comparison_result_bool, ancestor_type_address, constant_null_ptr)) + self.register_instruction(cil.GotoIfNode(step1_comparison_result_bool, f"while_end_{node_id}")) + + self.register_comment("Increment the count of ancestors") + self.register_instruction(cil.ArgNode(count_of_ancestors_int, 0, 2)) + self.register_instruction(cil.ArgNode(constant_one_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_add", count_of_ancestors_int, 2)) + # self.register_instruction(cil.PrintIntNode(count_of_ancestors_int)) + + # self.register_instruction(cil.AssertTypeNode(ancestor_type_address)) + + self.register_instruction(cil.AncestorNode(ancestor_type_address, ancestor_type_address)) self.register_instruction(cil.GotoNode(f"while_start_{node_id}")) self.register_instruction(cil.LabelNode(f"while_end_{node_id}")) - ################################################# - # End While loop to get the count of ancestors # - ################################################# + # ################################################# + # # End While loop to get the count of ancestors # + # ################################################# - ####################################################################### - # Foreach to create the array of ancestors and fill it with the types # - ####################################################################### + # ####################################################################### + # # Foreach to create the array of ancestors and fill it with the types # + # ####################################################################### self.register_empty_instruction() - self.register_comment("###################################################################### #") self.register_comment("Step 2 - Create an array of the same size where to store the ancestors #") self.register_comment("###################################################################### #") - self.register_instruction(cil.AssignNode(ancestor_type, switch_expr_type).set_comment("The first ancestor will be the type itself")) - self.register_instruction(cil.ArrayNode(array_of_ancestors, count_of_ancestors).set_comment("Create an array of ancestors")) - step2_iter_index = self.define_internal_local("Step 2 iteration index") - step2_comparison = self.define_internal_local("Step 2 comparison result") - self.register_instruction(cil.AssignNode(step2_iter_index, "0").set_comment("Initialize the index with the value 0")) + self.register_instruction(cil.AssignNode(ancestor_type_address, switch_expr_type_address).set_comment("The first ancestor will be the type itself")) + self.register_instruction(cil.ArrayNode(ancestors_array, count_of_ancestors_int).set_comment("Create an array of ancestors")) + + step2_iter_index_int = self.define_internal_local("Step 2 iteration index") + step2_comparison_result_bool = self.define_internal_local("Step 2 comparison result") + + self.register_instruction(cil.AllocateIntNode(step2_iter_index_int, "0")) + self.register_instruction(cil.AllocateBoolNode(step2_comparison_result_bool, "0")) + + # self.register_instruction(cil.AssignNode(step2_iter_index_int, constant_zero_int).set_comment("Initialize the index with the value 0")) + self.register_instruction(cil.LabelNode(f"foreach_start_{node_id}")) - self.register_instruction(cil.LessThanNode(step2_comparison, step2_iter_index, count_of_ancestors).set_comment("Check if the index is less than the counter")) - self.register_instruction(cil.GotoIfNode(step2_comparison, f"foreach_body_{node_id}")) + + self.register_instruction(cil.ArgNode(step2_iter_index_int, 0, 2)) + self.register_instruction(cil.ArgNode(count_of_ancestors_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_less_than", step2_comparison_result_bool, 2)) + # self.register_instruction(cil.PrintIntNode(step2_iter_index_int)) + # self.register_instruction(cil.PrintIntNode(step2_comparison_result_bool)) + + self.register_instruction(cil.GotoIfNode(step2_comparison_result_bool, f"foreach_body_{node_id}")) self.register_instruction(cil.GotoNode(f"foreach_end_{node_id}")) self.register_instruction(cil.LabelNode(f"foreach_body_{node_id}")) - self.register_instruction(cil.SetIndexNode(array_of_ancestors, step2_iter_index, ancestor_type).set_comment("Set the index of the array with the ancestor type")) - self.register_instruction(cil.AncestorNode(ancestor_type, ancestor_type).set_comment("Get the next ancestor")) - self.register_instruction(cil.PlusNode(step2_iter_index, step2_iter_index, "1").set_comment("Increment index")) + self.register_instruction(cil.SetIndexNode(ancestors_array, step2_iter_index_int, ancestor_type_address).set_comment("Set the index of the array with the ancestor type")) + # self.register_instruction(cil.GetIndexNode(ancestor_type_address, ancestors_array, step2_iter_index_int)) + # self.register_instruction(cil.AssertTypeNode(ancestor_type_address)) + self.register_instruction(cil.AncestorNode(ancestor_type_address, ancestor_type_address).set_comment("Get the next ancestor")) + + + self.register_instruction(cil.ArgNode(step2_iter_index_int, 0, 2)) + self.register_instruction(cil.ArgNode(constant_one_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_add", step2_iter_index_int, 2)) + self.register_instruction(cil.GotoNode(f"foreach_start_{node_id}")) self.register_instruction(cil.LabelNode(f"foreach_end_{node_id}")) self.register_empty_instruction() - ########################################################################### - # End Foreach to create the array of ancestors and fill it with the types # - ########################################################################### + # ########################################################################### + # # End Foreach to create the array of ancestors and fill it with the types # + # ########################################################################### - self.register_comment("#################################################################################################### #") - self.register_comment("Step 3 - For each branch type, store the ancestor index that match with it (Simulating a double for) #") - self.register_comment("#################################################################################################### #") + # self.register_comment("#################################################################################################### #") + # self.register_comment("Step 3 - For each branch type, store the ancestor index that match with it (Simulating a double for) #") + # self.register_comment("#################################################################################################### #") types = [self.context.get_type(type_name) for _, type_name, _ in node.cases] type_branch_array = self.define_internal_local("Array to store the branch types") nearest_ancestor_array = self.define_internal_local("Array to store the nearest ancestor index of the expression type of the i-th branch type ") - self.register_instruction(cil.ArrayNode(type_branch_array, f"{len(types)}")) - self.register_instruction(cil.ArrayNode(nearest_ancestor_array, f"{len(types)}")) - for i, t in enumerate(types): + self.register_instruction(cil.ArrayNode(type_branch_array, constant_len_types_int)) + self.register_instruction(cil.ArrayNode(nearest_ancestor_array, constant_len_types_int)) + for i_int, t in enumerate(types): x = self.define_internal_local(f"Address of the type {t.name}") + i = self.define_internal_local(f"Index of the type {t.name}") + self.register_instruction(cil.AllocateIntNode(i, i_int)) self.register_instruction(cil.TypeAddressNode(x, t.name)) - self.register_instruction(cil.SetIndexNode(type_branch_array, f"{i}", x)) - self.register_instruction(cil.SetIndexNode(nearest_ancestor_array, f"{i}", count_of_ancestors)) + self.register_instruction(cil.SetIndexNode(type_branch_array, i, x)) + # self.register_instruction(cil.GetIndexNode(x, ancestors_array, i)) + # self.register_instruction(cil.AssertTypeNode(x)) + self.register_instruction(cil.SetValueInIndexNode(nearest_ancestor_array, i, count_of_ancestors_int)) + # self.register_instruction(cil.GetValueInIndexNode(count_of_ancestors_int, nearest_ancestor_array, i)) + # self.register_instruction(cil.PrintIntNode(count_of_ancestors_int)) + self.register_empty_instruction() - i = self.define_internal_local("Step 3 - Iteration index of the branch types array") - comp_i = self.define_internal_local("Step 3 - Comparison for the index of the branch types array") + i_int = self.define_internal_local("Step 3 - Iteration index of the branch types array") + comp_i_bool = self.define_internal_local("Step 3 - Comparison for the index of the branch types array") type_i = self.define_internal_local("Step 3 - Type of the i-th branch") - j = self.define_internal_local("Step 3 - Index of the ancestor") - comp_j = self.define_internal_local("Step 3 - Comparison for the index of the ancestor") + j_int = self.define_internal_local("Step 3 - Index of the ancestor") + comp_j_bool = self.define_internal_local("Step 3 - Comparison for the index of the ancestor") type_j = self.define_internal_local("Step 3 - Type of the j-th ancestor") - types_comparison = self.define_internal_local("Step 3 - Comparison for the branch type nad the ancestor type") - - self.register_comment("############# #") - self.register_comment("Outer Foreach #") - self.register_comment("############# #") - self.register_instruction(cil.AssignNode(i, "0").set_comment("Initialize the index i of the case to 0")) - self.register_instruction(cil.LabelNode(f"foreach_type_start_{node_id}")) - self.register_instruction(cil.LessThanNode(comp_i, i, f"{len(types)}").set_comment("Check if the type index is less than the count of branches")) - self.register_instruction(cil.GotoIfNode(comp_i, f"foreach_type_body_{node_id}")) + types_comparison_bool = self.define_internal_local("Step 3 - Comparison for the branch type nad the ancestor type") + + self.register_instruction(cil.AllocateIntNode(i_int, "0")) + self.register_instruction(cil.AllocateBoolNode(comp_i_bool, "0")) + self.register_instruction(cil.AllocateIntNode(j_int, "0")) + self.register_instruction(cil.AllocateBoolNode(comp_j_bool, "0")) + self.register_instruction(cil.AllocateBoolNode(types_comparison_bool, "0")) + + # self.register_comment("############# #") + # self.register_comment("Outer Foreach #") + # self.register_comment("############# #") + # self.register_instruction(cil.AssignNode(i_int, constant_zero_int).set_comment("Initialize the index i of the case to 0")) + self.register_instruction(cil.LabelNode(f"foreach_type_start_{node_id}")) + + self.register_instruction(cil.ArgNode(i_int, 0, 2)) + self.register_instruction(cil.ArgNode(constant_len_types_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_less_than", comp_i_bool, 2)) + # self.register_instruction(cil.PrintIntNode(i_int)) + # self.register_instruction(cil.PrintIntNode(comp_i_bool)) + + self.register_instruction(cil.GotoIfNode(comp_i_bool, f"foreach_type_body_{node_id}")) self.register_instruction(cil.GotoNode(f"foreach_type_end_{node_id}")) self.register_instruction(cil.LabelNode(f"foreach_type_body_{node_id}")) - self.register_instruction(cil.GetIndexNode(type_i, type_branch_array, i).set_comment("Get the type of the i-th branch")) + self.register_instruction(cil.GetIndexNode(type_i, type_branch_array, i_int).set_comment("Get the type of the i-th branch")) + # self.register_instruction(cil.AssertTypeNode(type_i)) - ################# - # Inner Foreach # - ################# - self.register_empty_instruction() - self.register_comment("############# #") - self.register_comment("Inner Foreach #") - self.register_comment("############# #") - self.register_instruction(cil.AssignNode(j, "0").set_comment("Initialize the index j of the case to 0")) + # ################# + # # Inner Foreach # + # ################# + # self.register_empty_instruction() + # self.register_comment("############# #") + # self.register_comment("Inner Foreach #") + # self.register_comment("############# #") + + self.register_instruction(cil.ArgNode(j_int, 0, 2)) + self.register_instruction(cil.ArgNode(constant_zero_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_assign", j_int, 2)) + # self.register_instruction(cil.PrintIntNode(j_int)) + self.register_instruction(cil.LabelNode(f"foreach_ancestor_start_{node_id}")) - self.register_instruction(cil.LessThanNode(comp_j, j, count_of_ancestors).set_comment("Check if the case index is less than the count of ancestors")) - self.register_instruction(cil.GotoIfNode(comp_j, f"foreach_ancestor_body_{node_id}")) + + self.register_instruction(cil.ArgNode(j_int, 0, 2)) + self.register_instruction(cil.ArgNode(count_of_ancestors_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_less_than", comp_j_bool, 2)) + # self.register_instruction(cil.PrintIntNode(j_int)) + # self.register_instruction(cil.PrintIntNode(comp_j_bool)) + # self.register_instruction(cil.LessThanNode(comp_j_bool, j_int, count_of_ancestors_int).set_comment("Check if the case index is less than the count of ancestors")) + self.register_instruction(cil.GotoIfNode(comp_j_bool, f"foreach_ancestor_body_{node_id}")) self.register_instruction(cil.GotoNode(f"foreach_ancestor_end_{node_id}")) self.register_instruction(cil.LabelNode(f"foreach_ancestor_body_{node_id}")) - self.register_instruction(cil.GetIndexNode(type_j, array_of_ancestors, j).set_comment("Get the j-th ancestor type")) - self.register_instruction(cil.EqualNode(types_comparison, type_i, type_j).set_comment("Compare if the type of the i-th branch is equal to the j-th ancestor")) - self.register_instruction(cil.GotoIfNode(types_comparison, f"foreach_ancestor_end_{node_id}").set_comment("If the types are equal, we have a match, then we can exit")) - self.register_instruction(cil.PlusNode(j, j, "1").set_comment("Increment the ancestor index")) + self.register_instruction(cil.GetIndexNode(type_j, ancestors_array, j_int).set_comment("Get the j-th ancestor type")) + # self.register_instruction(cil.AssertTypeNode(type_j)) + + self.register_instruction(cil.EqualAddressNode(types_comparison_bool, type_i, type_j).set_comment("Compare if the type of the i-th branch is equal to the j-th ancestor")) + # self.register_instruction(cil.PrintIntNode(types_comparison_bool)) + self.register_instruction(cil.GotoIfNode(types_comparison_bool, f"foreach_ancestor_end_{node_id}").set_comment("If the types are equal, we have a match, then we can exit")) + + self.register_instruction(cil.ArgNode(j_int, 0, 2)) + self.register_instruction(cil.ArgNode(constant_one_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_add", j_int, 2)) self.register_instruction(cil.GotoNode(f"foreach_ancestor_start_{node_id}")) self.register_instruction(cil.LabelNode(f"foreach_ancestor_end_{node_id}")) - self.register_instruction(cil.SetIndexNode(nearest_ancestor_array, i, j).set_comment("Set the counter of the i-th branch equals to j")) + self.register_instruction(cil.SetValueInIndexNode(nearest_ancestor_array, i_int, j_int).set_comment("Set the counter of the i-th branch equals to j")) + # self.register_instruction(cil.GetValueInIndexNode(j_int, nearest_ancestor_array, i_int)) + # self.register_instruction(cil.PrintIntNode(j_int)) self.register_comment("#################### #") self.register_comment("End of Inner Foreach #") self.register_comment("#################### #") self.register_empty_instruction() - ####################### - # End Inner Foreach 1 # - ####################### + # ####################### + # # End Inner Foreach 1 # + # ####################### - self.register_instruction(cil.PlusNode(i, i, "1").set_comment("Increment type index")) + self.register_instruction(cil.ArgNode(i_int, 0, 2)) + self.register_instruction(cil.ArgNode(constant_one_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_add", i_int, 2)) self.register_instruction(cil.GotoNode(f"foreach_type_start_{node_id}")) self.register_instruction(cil.LabelNode(f"foreach_type_end_{node_id}")) self.register_comment("################# #") @@ -1195,58 +1374,135 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): self.register_comment("######################################## #") self.register_comment("Step 4 - Find the minimum ancestor index #") self.register_comment("######################################## #") - step4_index = self.define_internal_local("Step 4 - Iteration index") - step4_current_min_index = self.define_internal_local("Step 4 - Index of the minimum counter in the counter array") - step4_temp = self.define_internal_local("Step 4 - Temporary variable") - step4_current_min = self.define_internal_local("Step 4 - Current minimum of the counter array") - step4_comparison = self.define_internal_local("Step 4 - Comparison for the minimum of the counter array") - self.register_instruction(cil.AssignNode(step4_index, "0").set_comment("Initialize the index of the counter array to 0")) - self.register_instruction(cil.AssignNode(step4_current_min_index, "0").set_comment("Initialize the index of the lower counter to 0")) - self.register_instruction(cil.AssignNode(step4_current_min, count_of_ancestors).set_comment("Initialize the current minimum to `count of ancestors`")) + step4_index_int = self.define_internal_local("Step 4 - Iteration index") + step4_current_min_index_int = self.define_internal_local("Step 4 - Index of the minimum counter in the counter array") + step4_temp_int = self.define_internal_local("Step 4 - Temporary variable") + step4_current_min_int = self.define_internal_local("Step 4 - Current minimum of the counter array") + step4_comparison_bool = self.define_internal_local("Step 4 - Comparison for the minimum of the counter array") + + endl =self.define_internal_local("endl") + space =self.define_internal_local("space") + self.register_instruction(cil.AllocateStrNode(endl, '"\\n"')) + self.register_instruction(cil.AllocateStrNode(space, '" "')) + + self.register_instruction(cil.AllocateIntNode(step4_index_int, "0")) + self.register_instruction(cil.AllocateIntNode(step4_current_min_index_int, "0")) + self.register_instruction(cil.AllocateIntNode(step4_temp_int, "0")) + self.register_instruction(cil.AllocateIntNode(step4_current_min_int, "0")) + self.register_instruction(cil.AllocateBoolNode(step4_comparison_bool, "0")) + + self.register_instruction(cil.ArgNode(step4_current_min_int, 0, 2)) + self.register_instruction(cil.ArgNode(count_of_ancestors_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_assign", step4_current_min_int, 2)) + # self.register_instruction(cil.PrintIntNode(step4_current_min_int)) + self.register_instruction(cil.LabelNode(f"foreach_min_start_{node_id}")) - self.register_instruction(cil.LessThanNode(step4_comparison, step4_index, f"{len(types)}").set_comment("Check if the index of the lower counter is less than the count of branches")) - self.register_instruction(cil.GotoIfNode(step4_comparison, f"foreach_min_body_{node_id}")) + + self.register_instruction(cil.ArgNode(step4_index_int, 0, 2)) + self.register_instruction(cil.ArgNode(constant_len_types_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_less_than", step4_comparison_bool, 2)) + # self.register_instruction(cil.PrintIntNode(step4_index_int)) + # self.register_instruction(cil.PrintStringNode(space)) + # self.register_instruction(cil.PrintIntNode(step4_comparison_bool)) + # self.register_instruction(cil.PrintStringNode(space)) + + self.register_instruction(cil.GotoIfNode(step4_comparison_bool, f"foreach_min_body_{node_id}")) self.register_instruction(cil.GotoNode(f"foreach_min_end_{node_id}")) self.register_instruction(cil.LabelNode(f"foreach_min_body_{node_id}")) - self.register_instruction(cil.GetIndexNode(step4_temp, nearest_ancestor_array, step4_index).set_comment("Get the nearest ancestor index of the i-th branch type")) - self.register_instruction(cil.LessThanNode(step4_comparison, step4_temp, step4_current_min).set_comment("Compare if the nearest ancestor index is less than the current minimum")) - self.register_instruction(cil.GotoIfNode(step4_comparison, f"update_min_{node_id}")) - self.register_instruction(cil.GotoNode(f"foreach_min_end_{node_id}")) + self.register_instruction(cil.GetValueInIndexNode(step4_temp_int, nearest_ancestor_array, step4_index_int).set_comment("Get the nearest ancestor index of the i-th branch type")) + # self.register_instruction(cil.PrintIntNode(step4_temp_int)) + # self.register_instruction(cil.PrintStringNode(space)) + # self.register_instruction(cil.PrintIntNode(step4_current_min_int)) + # self.register_instruction(cil.PrintStringNode(space)) + + self.register_instruction(cil.ArgNode(step4_temp_int, 0, 2)) + self.register_instruction(cil.ArgNode(step4_current_min_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_less_than", step4_comparison_bool, 2)) + # self.register_instruction(cil.PrintIntNode(step4_comparison_bool)) + # self.register_instruction(cil.PrintStringNode(space)) + + self.register_instruction(cil.GotoIfNode(step4_comparison_bool, f"update_min_{node_id}")) + self.register_instruction(cil.GotoNode(f"update_min_end_{node_id}")) self.register_instruction(cil.LabelNode(f"update_min_{node_id}")) - self.register_instruction(cil.AssignNode(step4_current_min, step4_temp).set_comment("Update the current minimum")) - self.register_instruction(cil.AssignNode(step4_current_min_index, step4_index).set_comment("Update the index of the lower counter")) + + self.register_instruction(cil.ArgNode(step4_current_min_int, 0, 2)) + self.register_instruction(cil.ArgNode(step4_temp_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_assign", step4_current_min_int, 2)) + # self.register_instruction(cil.PrintIntNode(step4_current_min_int)) + # self.register_instruction(cil.PrintStringNode(space)) + + self.register_instruction(cil.ArgNode(step4_current_min_index_int, 0, 2)) + self.register_instruction(cil.ArgNode(step4_index_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_assign", step4_current_min_index_int, 2)) + # self.register_instruction(cil.PrintIntNode(step4_current_min_index_int)) + # self.register_instruction(cil.PrintStringNode(space)) + self.register_instruction(cil.LabelNode(f"update_min_end_{node_id}")) - self.register_instruction(cil.PlusNode(step4_index, step4_index, "1").set_comment("Increment the index of the counter array")) + + self.register_instruction(cil.ArgNode(step4_index_int, 0, 2)) + self.register_instruction(cil.ArgNode(constant_one_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_add", step4_index_int, 2)) + + # self.register_instruction(cil.PrintStringNode(endl)) self.register_instruction(cil.GotoNode(f"foreach_min_start_{node_id}")) self.register_instruction(cil.LabelNode(f"foreach_min_end_{node_id}")) + # self.register_instruction(cil.PrintStringNode(endl)) + # self.register_instruction(cil.PrintIntNode(step4_current_min_int)) + # self.register_instruction(cil.PrintStringNode(space)) + # self.register_instruction(cil.PrintIntNode(step4_current_min_index_int)) + # self.register_instruction(cil.PrintStringNode(space)) + self.register_empty_instruction() self.register_comment("################################################################# #") self.register_comment("Step 5 - Using the minimun ancestor index find the correct branch #") self.register_comment("################################################################# #") bool_array = self.define_internal_local("Step 5 - Bool array") - self.register_instruction(cil.ArrayNode(bool_array, f"{len(types)}").set_comment("Create the bool array")) + self.register_instruction(cil.ArrayNode(bool_array, constant_len_types_int).set_comment("Create the bool array")) for i, _ in enumerate(types): - self.register_instruction(cil.SetIndexNode(bool_array, f"{i}", "0").set_comment("Initialize the bool array")) - - self.register_empty_instruction() - exists_error = self.define_internal_local("Step 5 - Exists an error") - self.register_instruction(cil.EqualNode(exists_error, step4_current_min_index, count_of_ancestors).set_comment("Check if the minimum index is equal to the count of ancestors")) - self.register_instruction(cil.GotoIfNode(exists_error, f"error_branch_{node_id}")) - self.register_instruction(cil.SetIndexNode(bool_array, step4_current_min_index, "1").set_comment("Set the bool array in the correct index to 1")) + x = self.define_internal_local(f"Step 5 - Branch {i}") + self.register_instruction(cil.AllocateIntNode(x, f"{i}")) + self.register_instruction(cil.SetValueInIndexNode(bool_array, x, constant_zero_int).set_comment("Initialize the bool array")) + # self.register_instruction(cil.GetValueInIndexNode(constant_zero_int, bool_array, x)) + # self.register_instruction(cil.PrintIntNode(constant_zero_int)) + self.register_empty_instruction() + exists_error_bool = self.define_internal_local("Step 5 - Exists an error") + self.register_instruction(cil.AllocateBoolNode(exists_error_bool, "0")) + + self.register_instruction(cil.ArgNode(step4_current_min_int, 0, 2)) + self.register_instruction(cil.ArgNode(count_of_ancestors_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_equal", exists_error_bool, 2)) + # self.register_instruction(cil.PrintIntNode(exists_error_bool)) + + self.register_instruction(cil.GotoIfNode(exists_error_bool, f"error_branch_{node_id}")) + self.register_instruction(cil.SetValueInIndexNode(bool_array, step4_current_min_index_int, constant_one_int).set_comment("Set the bool array in the correct index to 1")) + # self.register_instruction(cil.PrintStringNode(endl)) + # self.register_instruction(cil.PrintIntNode(step4_current_min_index_int)) + # self.register_instruction(cil.PrintStringNode(space)) + step5_comparison = self.define_internal_local("Step 5 - Comparison for the correct branch result") + self.register_instruction(cil.AllocateBoolNode(step5_comparison, "0")) self.register_empty_instruction() - for i, t in enumerate(types): - self.register_instruction(cil.GetIndexNode(step5_comparison, bool_array, f"{i}").set_comment(f"Get the bool value of the branch {t.name}")) + for i_int, t in enumerate(types): + x = self.define_internal_local(f"Index {i_int}") + self.register_instruction(cil.AllocateIntNode(x, f"{i_int}")) + self.register_instruction(cil.GetValueInIndexNode(step5_comparison, bool_array, x).set_comment(f"Get the bool value of the branch {t.name}")) self.register_instruction(cil.GotoIfNode(step5_comparison, f"branch_{t.name}_{node_id}").set_comment("If the bool value is 1, then we have a match")) self.register_empty_instruction() resutl_address = self.define_internal_local("Result of the switch expression address") - for i, (var_name, type_name, expr) in enumerate(node.cases): + for i_int, (var_name, type_name, expr) in enumerate(node.cases): self.register_instruction(cil.LabelNode(f"branch_{type_name}_{node_id}")) - self.register_local(var_name, f"Specialiced variable for the branch {type_name}") - expr_source, _ = self.visit(expr, scope.children[i]) + var = self.register_local(var_name, f"Specialiced variable for the branch {type_name}") + self.register_instruction(cil.ArgNode(var, 0, 2)) + self.register_instruction(cil.ArgNode(swicth_expression, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_assign", var, 2)) + + expr_source, _ = self.visit(expr, scope.children[i_int]) + self.register_instruction(cil.ArgNode(resutl_address, 0, 2)) + self.register_instruction(cil.ArgNode(expr_source, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_assign", resutl_address, 2)) self.register_instruction(cil.AssignNode(resutl_address, expr_source).set_comment("Assign the result")) self.register_instruction(cil.GotoNode(f"branch_end_{node_id}")) self.register_empty_instruction() @@ -1260,6 +1516,8 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): def visit(self, node: cool.MethodCallNode, scope: Scope): scope = node.scope obj_source, obj_type = self.visit(node.obj, scope) + if obj_type.name == "SELF_TYPE": + obj_type = self.current_type args_sources = [] for arg in node.args: @@ -1272,6 +1530,7 @@ def visit(self, node: cool.MethodCallNode, scope: Scope): call_dest = self.define_internal_local() method, owner = obj_type.get_method(node.id, get_owner=True) + self.register_instruction( cil.DynamicCallNode( obj_type.name, self.to_function_name(node.id, owner.name), call_dest, len(args_sources) + 1 @@ -1303,7 +1562,9 @@ def visit(self, node: cool.BooleanNode, scope: Scope): @visitor.when(ecool.NullNode) def visit(self, node: ecool.NullNode, scope: Scope): scope = node.scope - return node.lex, ecool.NullType + local_null_var = self.define_internal_local(f"Null") + self.register_instruction(cil.AllocateNullPtrNode(local_null_var)) + return local_null_var, ecool.NullType @visitor.when(cool.VariableNode) def visit(self, node: cool.VariableNode, scope: Scope): @@ -1318,7 +1579,7 @@ def visit(self, node: cool.VariableNode, scope: Scope): if is_attribute: dest = self.define_internal_local() attr_names = [a.name for a, _ in self.current_type.all_attributes()] - self.register_instruction(cil.GetAttribNode(dest, "self", variable.name, attr_names.index(variable.name))) + self.register_instruction(cil.GetAttributeNode(dest, "self", variable.name, attr_names.index(variable.name))) return dest, variable.type return variable.name, variable.type @@ -1338,7 +1599,12 @@ def visit(self, node: cool.NegationNode, scope: Scope): local_int = self.define_internal_local("Integer 1") result = self.define_internal_local(f"Store the negation of {source}") self.register_instruction(cil.AllocateIntNode(local_int, "1")) - self.register_instruction(cil.XorNode(result, source, local_int).set_comment(f"not {source}")) + self.register_instruction(cil.AllocateBoolNode(result, "0")) + self.register_instruction(cil.ArgNode(source, 0, 2)) + self.register_instruction(cil.ArgNode(local_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_xor", result, 2)) + # self.register_instruction(cil.AllocateIntNode(result, "0")) + # self.register_instruction(cil.XorNode(result, source, local_int).set_comment(f"not {source}")) return result, self.context.get_type("Bool") @visitor.when(cool.ComplementNode) @@ -1348,16 +1614,33 @@ def visit(self, node: cool.ComplementNode, scope: Scope): local_int_0 = self.define_internal_local("Integer 1") local_int_1 = self.define_internal_local(f"Integer {2**32 - 1}") result = self.define_internal_local(f"Store the complement a2 of {source}") - self.register_instruction(cil.XorNode(result, source,local_int_1 ).set_comment(f"Getting the complement a1 of {source}")) - self.register_instruction(cil.PlusNode(result, result, local_int_0).set_comment(f"Adding 1 to the complement a1 we get the complement a2 of {source}")) + self.register_instruction(cil.AllocateIntNode(local_int_0, "1")) + self.register_instruction(cil.AllocateIntNode(local_int_1, str(2**32 - 1))) + self.register_instruction(cil.AllocateIntNode(result, "0")) + self.register_instruction(cil.ArgNode(source, 0, 2)) + self.register_instruction(cil.ArgNode(local_int_1, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_xor", result, 2)) + # self.register_instruction(cil.PrintIntNode(result)) + # self.register_instruction(cil.AllocateIntNode(result, "0")) + # self.register_instruction(cil.XorNode(result, source, local_int_1).set_comment(f"Getting the complement a1 of {source}")) + self.register_instruction(cil.ArgNode(result, 0, 2)) + self.register_instruction(cil.ArgNode(local_int_0, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_add", result, 2)) + # self.register_instruction(cil.PrintIntNode(result)) + # self.register_instruction(cil.PlusNode(result, result, local_int_0).set_comment(f"Adding 1 to the complement a1 we get the complement a2 of {source}")) return result, self.context.get_type("Int") @visitor.when(cool.IsVoidNode) def visit(self, node: cool.IsVoidNode, scope: Scope): scope = node.scope source, _ = self.visit(node.expr, scope) + null_ptr = self.define_internal_local("Null pointer") result = self.define_internal_local(f"Store if {source} is NULL") - self.register_instruction(cil.EqualNode(result, source, "0")) + self.register_instruction(cil.AllocateBoolNode(result, "0")) + self.register_instruction(cil.AllocateNullPtrNode(null_ptr)) + self.register_instruction(cil.ArgNode(source, 0, 2)) + self.register_instruction(cil.ArgNode(source, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_equal", result, 2)) return result, self.context.get_type("Bool") @visitor.when(cool.PlusNode) diff --git a/src/cool/semantics/position_assigner.py b/src/cool/semantics/position_assigner.py index 916138bc0..a4fe8d71f 100644 --- a/src/cool/semantics/position_assigner.py +++ b/src/cool/semantics/position_assigner.py @@ -39,8 +39,8 @@ class type [inherits type] { feature-list } """ token = self.tokens[self.position] assert ( - token.lex == "class" - ), f'Expected "class" instead of "{token.lex}" in {node.id}' + token.lex.lower() == "class" + ), f'{token.line, token.column} Expected "class" instead of "{token.lex}" in {node.id}' token = self.tokens[self.position + 1] node.set_main_position(token.line, token.column) @@ -182,6 +182,8 @@ def visit(self, node: ast.BlockNode): * { block } """ + self._skip_open_parentheses() + token = self.tokens[self.position] assert token.lex == "{", f'{token.line, token.column} Expected "{{" instead of "{token.lex}" in block' @@ -206,6 +208,7 @@ def visit(self, node: ast.BlockNode): ), f'Expected "}}" instead of "{token.lex}" at the end of a block' self.inc_position() # ends after `}` + self._skip_closed_parentheses() @visitor.when(ast.ConditionalNode) def visit(self, node: ast.ConditionalNode): diff --git a/src/fib.asm b/src/fib.asm new file mode 100644 index 000000000..f3f6b3f6d --- /dev/null +++ b/src/fib.asm @@ -0,0 +1,1640 @@ +.data + type_Object: .word 8 + type_Object_inherits_from: .word 0 + type_Object_attributes: .word 0 + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO: .word 8 + type_IO_inherits_from: .word type_Object + type_IO_attributes: .word 0 + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_Int: .word 8 + type_Int_inherits_from: .word type_Object + type_Int_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_String: .word 8 + type_String_inherits_from: .word type_Object + type_String_attributes: .word 0 + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Bool: .word 8 + type_Bool_inherits_from: .word type_Object + type_Bool_attributes: .word 0 + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_Main: .word 8 + type_Main_inherits_from: .word type_IO + type_Main_attributes: .word 0 + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 40($sp) + # a = 36($sp) + # b = 32($sp) + + # Reserving space for local variables + addi $sp, $sp, -32 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_0 = address of allocated object Int + + # internal_1 = typeof a that is the first word of the object + lw $t0, 36($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_2 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_3 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_4 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_7 = address of allocated object Int + + # internal_5 = EqualAddress(internal_1, internal_2) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_1, internal_3) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_7 = EqualAddress(internal_1, internal_4) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_6 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_7 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 36($sp) + lw $t0, 8($t0) + lw $t1, 32($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 36($sp) + lw $t1, 32($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 28($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 28($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 36($sp) # Save in $t0 the left operand address + lw $t1, 32($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 28($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 28($sp) + + # Freeing space for local variables + addi $sp, $sp, 32 + + jr $ra + + function_assign: + # Function parameters + # $ra = 28($sp) + # dest = 24($sp) + # source = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # internal_0 = typeof source that is the first word of the object + lw $t0, 20($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_1 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_2 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_3 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_4 = address of allocated object Int + + # internal_3 = EqualAddress(internal_1, internal_1) + lw $t0, 12($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_4 = EqualAddress(internal_1, internal_2) + lw $t0, 12($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_3 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_4 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 20($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 24($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 20($sp) + sw $t0, 24($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 20 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 12($t1) # $t1 = length of the name of self + lw $t3, 16($t1) # $t1 = name of self + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + move $t4, $v0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + addi $t0, $t0, 8 # Pointer to the first character of the string in self + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t1, while_copy_name_end + lb $t6, 0($t0) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t0, $t0, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $t4, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the string x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lw $t1, buffer_input($t0) # Loading the byte + beq $t1, $zero, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lw $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + sw $t1, 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 0($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 0($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + lw $t2, 8($sp) # $t2 = start of the substring + lw $t3, 4($sp) # $t3 = length of the substring + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bge $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 32($sp) + # self = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 47 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 38 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 69 + sb $t0, 8($v0) # internal_0[0] = 'E' + + addi $t0, $zero, 110 + sb $t0, 9($v0) # internal_0[1] = 'n' + + addi $t0, $zero, 116 + sb $t0, 10($v0) # internal_0[2] = 't' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_0[3] = 'e' + + addi $t0, $zero, 114 + sb $t0, 12($v0) # internal_0[4] = 'r' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_0[6] = 'n' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_0[7] = ' ' + + addi $t0, $zero, 116 + sb $t0, 16($v0) # internal_0[8] = 't' + + addi $t0, $zero, 111 + sb $t0, 17($v0) # internal_0[9] = 'o' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_0[10] = ' ' + + addi $t0, $zero, 102 + sb $t0, 19($v0) # internal_0[11] = 'f' + + addi $t0, $zero, 105 + sb $t0, 20($v0) # internal_0[12] = 'i' + + addi $t0, $zero, 110 + sb $t0, 21($v0) # internal_0[13] = 'n' + + addi $t0, $zero, 100 + sb $t0, 22($v0) # internal_0[14] = 'd' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_0[15] = ' ' + + addi $t0, $zero, 110 + sb $t0, 24($v0) # internal_0[16] = 'n' + + addi $t0, $zero, 116 + sb $t0, 25($v0) # internal_0[17] = 't' + + addi $t0, $zero, 104 + sb $t0, 26($v0) # internal_0[18] = 'h' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_0[19] = ' ' + + addi $t0, $zero, 102 + sb $t0, 28($v0) # internal_0[20] = 'f' + + addi $t0, $zero, 105 + sb $t0, 29($v0) # internal_0[21] = 'i' + + addi $t0, $zero, 98 + sb $t0, 30($v0) # internal_0[22] = 'b' + + addi $t0, $zero, 111 + sb $t0, 31($v0) # internal_0[23] = 'o' + + addi $t0, $zero, 110 + sb $t0, 32($v0) # internal_0[24] = 'n' + + addi $t0, $zero, 97 + sb $t0, 33($v0) # internal_0[25] = 'a' + + addi $t0, $zero, 99 + sb $t0, 34($v0) # internal_0[26] = 'c' + + addi $t0, $zero, 99 + sb $t0, 35($v0) # internal_0[27] = 'c' + + addi $t0, $zero, 105 + sb $t0, 36($v0) # internal_0[28] = 'i' + + addi $t0, $zero, 32 + sb $t0, 37($v0) # internal_0[29] = ' ' + + addi $t0, $zero, 110 + sb $t0, 38($v0) # internal_0[30] = 'n' + + addi $t0, $zero, 117 + sb $t0, 39($v0) # internal_0[31] = 'u' + + addi $t0, $zero, 109 + sb $t0, 40($v0) # internal_0[32] = 'm' + + addi $t0, $zero, 98 + sb $t0, 41($v0) # internal_0[33] = 'b' + + addi $t0, $zero, 101 + sb $t0, 42($v0) # internal_0[34] = 'e' + + addi $t0, $zero, 114 + sb $t0, 43($v0) # internal_0[35] = 'r' + + addi $t0, $zero, 33 + sb $t0, 44($v0) # internal_0[36] = '!' + + addi $t0, $zero, 10 + sb $t0, 45($v0) # internal_0[37] = '\n' + + sb $zero, 46($v0) # Null-terminator at the end of the string + + sw $v0, 24($sp) # internal_0 = "Enter n to find nth fibonacci number!\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_1 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_in_int_at_IO + jal function_in_int_at_IO + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_2 = result of function_in_int_at_IO + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_2 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_fib_at_Main + jal function_fib_at_Main + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_3 = result of function_fib_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_3 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_out_int_at_IO + jal function_out_int_at_IO + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_4 = result of function_out_int_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 1 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_5[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_5 = "\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_5 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_6 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function_fib_at_Main: + # Function parameters + # $ra = 60($sp) + # self = 56($sp) + # i = 52($sp) + + # Reserving space for local variables + addi $sp, $sp, -52 + + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument a + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing a + + # Argument internal_1 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 60($sp) # a = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument b + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing b + + # Argument internal_3 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 52($sp) # b = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_5 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument c + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing c + + # Argument internal_5 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 44($sp) # c = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + + while_start_8738608219667: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_6 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_6 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_7 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_8 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_7 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_7 + + # Argument internal_8 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_9 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_9 then goto while_body_8738608219667 + lw $t0, 12($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8738608219667 + + # Jumping to while_end_8738608219667 + j while_end_8738608219667 + + while_body_8738608219667: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument a + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing a + + # Argument b + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing b + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_10 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument c + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing c + + # Argument internal_10 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 44($sp) # c = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_11 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_11 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_12 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_12 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 64($sp) # i = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument b + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing b + + # Argument a + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing a + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 52($sp) # b = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument a + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing a + + # Argument c + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing c + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 60($sp) # a = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to while_start_8738608219667 + j while_start_8738608219667 + + while_end_8738608219667: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 52 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_main_at_Main + jal function_main_at_Main + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/src/fib.cil b/src/fib.cil new file mode 100644 index 000000000..1a90a80e5 --- /dev/null +++ b/src/fib.cil @@ -0,0 +1,460 @@ +.TYPES +type Object { + inherits from null + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method __init__: function___init___at_Object +} +type IO { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method out_string: function_out_string_at_IO + method out_int: function_out_int_at_IO + method in_string: function_in_string_at_IO + method in_int: function_in_int_at_IO + method __init__: function___init___at_IO +} +type Int { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method __init__: function___init___at_Int +} +type String { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method length: function_length_at_String + method concat: function_concat_at_String + method substr: function_substr_at_String + method __init__: function___init___at_String +} +type Bool { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method __init__: function___init___at_Bool +} +type Main { + inherits from IO + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method out_string: function_out_string_at_IO + method out_int: function_out_int_at_IO + method in_string: function_in_string_at_IO + method in_int: function_in_int_at_IO + method main: function_main_at_Main + method fib: function_fib_at_Main + method __init__: function___init___at_Main +} + +.DATA + + +.CODE +function function_add{ + PARAM a + PARAM b + + LOCAL internal_0 # Adding result + + internal_0 = ALLOCINT 0 + internal_0 = a + b + + RETURN internal_0 +} +function function_sub{ + PARAM a + PARAM b + + LOCAL internal_0 # Substracting result + + internal_0 = ALLOCINT 0 + internal_0 = a - b + + RETURN internal_0 +} +function function_mult{ + PARAM a + PARAM b + + LOCAL internal_0 # Multiting result + + internal_0 = ALLOCINT 0 + internal_0 = a * b + + RETURN internal_0 +} +function function_div{ + PARAM a + PARAM b + + LOCAL internal_0 # Dividing result + + internal_0 = ALLOCINT 0 + internal_0 = a / b + + RETURN internal_0 +} +function function_xor{ + PARAM a + PARAM b + + LOCAL internal_0 # Xor result + + internal_0 = ALLOCINT 0 + internal_0 = XOR a b + + RETURN internal_0 +} +function function_less_than{ + PARAM a + PARAM b + + LOCAL internal_0 # Less than result + + internal_0 = ALLOCBOOL 0 + internal_0 = a < b + + RETURN internal_0 +} +function function_less_than_or_equal{ + PARAM a + PARAM b + + LOCAL internal_0 # Less than or equal result + + internal_0 = ALLOCBOOL 0 + internal_0 = a <= b + + RETURN internal_0 +} +function function_equal{ + PARAM a + PARAM b + + LOCAL internal_0 # Equal result + LOCAL internal_1 # Type of a + LOCAL internal_2 # Type Int + LOCAL internal_3 # Type Bool + LOCAL internal_4 # Type String + LOCAL internal_5 # Type of a equals int + LOCAL internal_6 # Type of a equals bool + LOCAL internal_7 # Type of a equals string + + internal_0 = ALLOCBOOL 0 + internal_1 = TYPEOF a + internal_2 = TYPEADDR Int + internal_3 = TYPEADDR Bool + internal_4 = TYPEADDR String + internal_5 = ALLOCBOOL 0 + internal_6 = ALLOCBOOL 0 + internal_7 = ALLOCBOOL 0 + internal_5 = EQUALADDR internal_1 internal_2 + internal_6 = EQUALADDR internal_1 internal_3 + internal_7 = EQUALADDR internal_1 internal_4 + + IF internal_5 GOTO a_is_type_int_or_bool + IF internal_6 GOTO a_is_type_int_or_bool + IF internal_7 GOTO a_is_type_string + GOTO a_is_type_object + + a_is_type_int_or_bool: + internal_0 = EQUALINT a b + GOTO end_of_equal + + a_is_type_string: + internal_0 = EQUALSTR a b + GOTO end_of_equal + + a_is_type_object: + internal_0 = a == b + GOTO end_of_equal + + end_of_equal: + + RETURN internal_0 +} +function function_assign{ + PARAM dest + PARAM source + + LOCAL internal_0 # Type of source + LOCAL internal_1 # Type Int + LOCAL internal_2 # Type Bool + LOCAL internal_3 # Type of source equals int + LOCAL internal_4 # Type of source equals bool + + internal_0 = TYPEOF source + internal_1 = TYPEADDR Int + internal_2 = TYPEADDR Bool + internal_3 = ALLOCBOOL 0 + internal_4 = ALLOCBOOL 0 + internal_3 = EQUALADDR internal_1 internal_1 + internal_4 = EQUALADDR internal_1 internal_2 + + IF internal_3 GOTO source_is_type_int_or_bool + IF internal_4 GOTO source_is_type_int_or_bool + GOTO source_is_type_object + + source_is_type_int_or_bool: + dest = INT source + GOTO source_end_of_equal + + source_is_type_object: + dest = source + GOTO source_end_of_equal + + source_end_of_equal: + + RETURN dest +} +function function___init___at_Object{ + PARAM self + + RETURN self +} +function function_abort_at_Object{ + PARAM self + + HALT + + RETURN self +} +function function_type_name_at_Object{ + PARAM self + + LOCAL internal_0 # type_name + + internal_0 = TYPENAME self + + RETURN internal_0 +} +function function_copy_at_Object{ + PARAM self + + LOCAL internal_0 + + internal_0 = COPY self + + RETURN internal_0 +} +function function___init___at_IO{ + PARAM self + + RETURN self +} +function function_out_string_at_IO{ + PARAM self + PARAM x + + PRINTSTR x + + RETURN self +} +function function_out_int_at_IO{ + PARAM self + PARAM x + + PRINTINT x + + RETURN self +} +function function_in_string_at_IO{ + PARAM self + + LOCAL internal_0 + + READSTR internal_0 + + RETURN internal_0 +} +function function_in_int_at_IO{ + PARAM self + + LOCAL internal_0 + + internal_0 = ALLOCINT 0 + READINT internal_0 + + RETURN internal_0 +} +function function___init___at_String{ + PARAM self + + RETURN self +} +function function_length_at_String{ + PARAM self + + LOCAL internal_0 + + internal_0 = LENGTH self + + RETURN internal_0 +} +function function_concat_at_String{ + PARAM self + PARAM s + + LOCAL internal_0 + + internal_0 = CONCAT self s + + RETURN internal_0 +} +function function_substr_at_String{ + PARAM self + PARAM i + PARAM l + + LOCAL internal_0 + + internal_0 = SUBSTRING self i l + + RETURN internal_0 +} +function function___init___at_Main{ + PARAM self + + RETURN self +} +function function_main_at_Main{ + PARAM self + + LOCAL internal_0 # String "Enter n to find nth fibonacci number!\n" + LOCAL internal_1 + LOCAL internal_2 + LOCAL internal_3 + LOCAL internal_4 + LOCAL internal_5 # String "\n" + LOCAL internal_6 + + internal_0 = ALLOCSTR "Enter n to find nth fibonacci number!\n" + ARG self + ARG internal_0 + internal_1 = VCALL Main function_out_string_at_IO + ARG self + internal_2 = VCALL Main function_in_int_at_IO + ARG self + ARG internal_2 + internal_3 = VCALL Main function_fib_at_Main + ARG self + ARG internal_3 + internal_4 = VCALL Main function_out_int_at_IO + internal_5 = ALLOCSTR "\n" + ARG self + ARG internal_5 + internal_6 = VCALL Main function_out_string_at_IO + + RETURN internal_6 +} +function function_fib_at_Main{ + PARAM self + PARAM i + + LOCAL a + LOCAL internal_1 # Integer 1 + LOCAL b + LOCAL internal_3 # Integer 0 + LOCAL c + LOCAL internal_5 # Integer 0 + LOCAL internal_6 # Integer 0 + LOCAL internal_7 # Store the result of the operation function_equal + LOCAL internal_8 # Integer 1 + LOCAL internal_9 # Store the negation of internal_7 + LOCAL internal_10 # Store the result of the operation function_add + LOCAL internal_11 # Integer 1 + LOCAL internal_12 # Store the result of the operation function_sub + + # Let a: Int b: Int c: Int + + internal_1 = ALLOCINT 1 + ARG a + ARG internal_1 + a = CALL function_assign + + internal_3 = ALLOCINT 0 + ARG b + ARG internal_3 + b = CALL function_assign + + internal_5 = ALLOCINT 0 + ARG c + ARG internal_5 + c = CALL function_assign + + # While loop + while_start_8738608219667: + internal_6 = ALLOCINT 0 + + ARG i + ARG internal_6 + internal_7 = CALL function_equal + internal_8 = ALLOCINT 1 + ARG internal_7 + ARG internal_8 + internal_9 = CALL function_xor + IF internal_9 GOTO while_body_8738608219667 + GOTO while_end_8738608219667 + + while_body_8738608219667: + + ARG a + ARG b + internal_10 = CALL function_add + + ARG c + ARG internal_10 + c = CALL function_assign + internal_11 = ALLOCINT 1 + + ARG i + ARG internal_11 + internal_12 = CALL function_sub + + ARG i + ARG internal_12 + i = CALL function_assign + + ARG b + ARG a + b = CALL function_assign + + ARG a + ARG c + a = CALL function_assign + GOTO while_start_8738608219667 + + while_end_8738608219667: + + RETURN c +} +function main{ + + + LOCAL internal_0 + LOCAL internal_1 + + internal_0 = ALLOCATE Main + ARG internal_0 + internal_0 = VCALL Main function___init___at_Main + + ARG internal_0 + internal_1 = VCALL Main function_main_at_Main + + HALT +} \ No newline at end of file diff --git a/src/fib.cl b/src/fib.cl new file mode 100644 index 000000000..cc763e460 --- /dev/null +++ b/src/fib.cl @@ -0,0 +1,25 @@ +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/src/logs.txt b/src/logs.txt index fc0e9b168..82959fe14 100644 --- a/src/logs.txt +++ b/src/logs.txt @@ -1,253 +1,21 @@ -r -{ - self: Main - children (6): [ - { - children (0): [ +SPIM Version 8.0 of January 8, 2010 +Copyright 1990-2010, James R. Larus. +All Rights Reserved. +See the file README for a full copyright notice. +Loaded: /usr/lib/spim/exceptions.s + Exception 7 [Bad data address] occurred and ignored + Exception 7 [Bad data address] occurred and ignored +number 0 is even! +Class type is now A + + To add a number to 0 ...enter a: + To negate 0 ...enter b: + To find the difference between 0 and another number...enter c: + To find the factorial of 0 ...enter d: + To square 0 ...enter e: + To cube 0 ...enter f: + To find out if 0 is a multiple of 3...enter g: + To divide 0 by 8...enter h: + To get a new number...enter j: + To quit...enter q: - ] - }, - { - children (0): [ - - ] - }, - { - children (0): [ - - ] - }, - { - children (0): [ - - ] - }, - { - children (2): [ - { - children (0): [ - - ] - }, - { - children (0): [ - - ] - }, - - ] - }, - { - children (2): [ - { - children (3): [ - { - c: C - children (1): [ - { - children (0): [ - - ] - }, - - ] - }, - { - a: A - children (1): [ - { - children (0): [ - - ] - }, - - ] - }, - { - o: Object - children (0): [ - - ] - }, - - ] - }, - { - children (2): [ - { - children (2): [ - { - children (0): [ - - ] - }, - { - children (0): [ - - ] - }, - - ] - }, - { - children (2): [ - { - children (1): [ - { - children (0): [ - - ] - }, - - ] - }, - { - children (2): [ - { - children (1): [ - { - children (0): [ - - ] - }, - - ] - }, - { - children (2): [ - { - children (1): [ - { - children (0): [ - - ] - }, - - ] - }, - { - children (2): [ - { - children (2): [ - { - children (0): [ - - ] - }, - { - children (0): [ - - ] - }, - - ] - }, - { - children (2): [ - { - x: A - children (1): [ - { - r: Int - children (4): [ - { - children (0): [ - - ] - }, - { - children (0): [ - - ] - }, - { - a: A2I - children (2): [ - { - children (0): [ - - ] - }, - { - children (0): [ - - ] - }, - - ] - }, - { - children (0): [ - - ] - }, - - ] - }, - - ] - }, - { - children (2): [ - { - children (1): [ - { - children (0): [ - - ] - }, - - ] - }, - { - children (2): [ - { - children (1): [ - { - children (0): [ - - ] - }, - - ] - }, - { - children (1): [ - { - children (0): [ - - ] - }, - - ] - }, - - ] - }, - - ] - }, - - ] - }, - - ] - }, - - ] - }, - - ] - }, - - ] - }, - - ] - }, - - ] - }, - - ] -} diff --git a/src/main.asm b/src/main.asm index 604cc7cb2..8e87a975b 100644 --- a/src/main.asm +++ b/src/main.asm @@ -4,36 +4,42 @@ type_Object_attributes: .word 0 type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" + type_Object_abort_message: .asciiz "Abort called from class Object\n" type_IO: .word 8 type_IO_inherits_from: .word type_Object type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" + type_IO_abort_message: .asciiz "Abort called from class IO\n" type_Int: .word 8 type_Int_inherits_from: .word type_Object type_Int_attributes: .word 0 type_Int_name_size: .word 3 type_Int_name: .asciiz "Int" + type_Int_abort_message: .asciiz "Abort called from class Int\n" type_String: .word 8 type_String_inherits_from: .word type_Object type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" + type_String_abort_message: .asciiz "Abort called from class String\n" type_Bool: .word 8 type_Bool_inherits_from: .word type_Object type_Bool_attributes: .word 0 type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" + type_Bool_abort_message: .asciiz "Abort called from class Bool\n" - type_Main: .word 8 + type_Main: .word 12 type_Main_inherits_from: .word type_IO - type_Main_attributes: .word 0 + type_Main_attributes: .word 1 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" + type_Main_abort_message: .asciiz "Abort called from class Main\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -316,12 +322,12 @@ function_equal: # Function parameters - # $ra = 40($sp) - # a = 36($sp) - # b = 32($sp) + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) # Reserving space for local variables - addi $sp, $sp, -32 + addi $sp, $sp, -40 # Allocating Bool 0 li $v0, 9 @@ -333,22 +339,57 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_0 = address of allocated object Int + sw $v0, 36($sp) # internal_0 = address of allocated object Int - # internal_1 = typeof a that is the first word of the object - lw $t0, 36($sp) - lw $t1, 0($t0) - sw $t1, 24($sp) + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # internal_2 = direction of Int + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int la $t0, type_Int sw $t0, 20($sp) - # internal_3 = direction of Bool + # internal_5 = direction of Bool la $t0, type_Bool sw $t0, 16($sp) - # internal_4 = direction of String + # internal_6 = direction of String la $t0, type_String sw $t0, 12($sp) @@ -362,7 +403,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_5 = address of allocated object Int + sw $v0, 8($sp) # internal_7 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -374,7 +415,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_6 = address of allocated object Int + sw $v0, 4($sp) # internal_8 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -386,42 +427,42 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_7 = address of allocated object Int + sw $v0, 0($sp) # internal_9 = address of allocated object Int - # internal_5 = EqualAddress(internal_1, internal_2) + # internal_7 = EqualAddress(internal_3, internal_4) lw $t0, 24($sp) lw $t1, 20($sp) seq $t2, $t0, $t1 lw $t0, 8($sp) sw $t2, 8($t0) - # internal_6 = EqualAddress(internal_1, internal_3) + # internal_8 = EqualAddress(internal_3, internal_5) lw $t0, 24($sp) lw $t1, 16($sp) seq $t2, $t0, $t1 lw $t0, 4($sp) sw $t2, 8($t0) - # internal_7 = EqualAddress(internal_1, internal_4) + # internal_9 = EqualAddress(internal_3, internal_6) lw $t0, 24($sp) lw $t1, 12($sp) seq $t2, $t0, $t1 lw $t0, 0($sp) sw $t2, 8($t0) - # If internal_5 then goto a_is_type_int_or_bool + # If internal_7 then goto a_is_type_int_or_bool lw $t0, 8($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison beq $t0, $t1, a_is_type_int_or_bool - # If internal_6 then goto a_is_type_int_or_bool + # If internal_8 then goto a_is_type_int_or_bool lw $t0, 4($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison beq $t0, $t1, a_is_type_int_or_bool - # If internal_7 then goto a_is_type_string + # If internal_9 then goto a_is_type_string lw $t0, 0($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison @@ -433,12 +474,12 @@ a_is_type_int_or_bool: # internal_0 = EqualInt(a, b) - lw $t0, 36($sp) + lw $t0, 44($sp) lw $t0, 8($t0) - lw $t1, 32($sp) + lw $t1, 40($sp) lw $t1, 8($t1) seq $t2, $t0, $t1 - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t2, 8($t0) # Jumping to end_of_equal @@ -447,14 +488,14 @@ a_is_type_string: # internal_0 = EqualStr(a, b) - lw $t0, 36($sp) - lw $t1, 32($sp) + lw $t0, 44($sp) + lw $t1, 40($sp) addi $t0, $t0, 8 addi $t1, $t1, 8 # By default we assume the strings are equals addi $t4, $zero, 1 - lw $t5, 28($sp) + lw $t5, 36($sp) sw $t4, 8($t5) while_compare_strings_start: @@ -463,7 +504,7 @@ beq $t2, $t3, while_compare_strings_update # The strings are no equals - lw $t5, 28($sp) + lw $t5, 36($sp) sw $zero, 8($t5) j while_compare_strings_end @@ -471,6 +512,7 @@ addi $t0, $t0, 1 addi $t1, $t1, 1 beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end j while_compare_strings_start while_compare_strings_end: @@ -480,11 +522,11 @@ a_is_type_object: # Equal operation - lw $t0, 36($sp) # Save in $t0 the left operand address - lw $t1, 32($sp) # Save in $t1 the right operand address + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address seq $t2, $t0, $t1 # $t2 = $t0 == $t1 - lw $t0, 28($sp) # $t0 = internal_0 + lw $t0, 36($sp) # $t0 = internal_0 sw $t2, 8($t0) # Setting value in the third word of the Bool object # Jumping to end_of_equal @@ -493,10 +535,156 @@ end_of_equal: # Loading return value in $v1 - lw $v1, 28($sp) + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) # Freeing space for local variables - addi $sp, $sp, 32 + addi $sp, $sp, 28 jr $ra @@ -512,15 +700,184 @@ function_abort_at_Object: # Function parameters - # $ra = 4($sp) - # self = 0($sp) + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_2[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_2 = "\n" + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_type_name_at_Object + jal function_type_name_at_Object + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 12($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) # $t0 = internal_3 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string internal_3 + li $v0, 4 + move $a0, $t0 + syscall # Exit program li $v0, 10 syscall # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 jr $ra @@ -536,7 +893,7 @@ lw $t0, 4($sp) # $t0 = self lw $t1, 0($t0) # $t1 = type of self lw $t2, 12($t1) # $t1 = length of the name of self - lw $t3, 16($t1) # $t1 = name of self + la $t3, 16($t1) # $t1 = name of self addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 @@ -546,26 +903,24 @@ la $t4, type_String sw $t4, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - move $t4, $v0 # $t4 = direction of the new string + addi $t4, $v0, 0 # $t4 = direction of the new string addi $t4, $t4, 8 # Pointer to the first character of the string - addi $t0, $t0, 8 # Pointer to the first character of the string in self xor $t5, $t5, $t5 # Initializing counter while_copy_name_start: - beq $t5, $t1, while_copy_name_end - lb $t6, 0($t0) # Loading the character + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character sb $t6, 0($t4) addi $t4, $t4, 1 # Incrementing the pointer to the new string - addi $t0, $t0, 1 # Incrementing the pointer to the string in self + addi $t3, $t3, 1 # Incrementing the pointer to the string in self addi $t5, $t5, 1 # Incrementing counter j while_copy_name_start while_copy_name_end: sb $zero, 0($t4) # Setting the null byte - sw $t4, 0($sp) # Storing the new string in internal_0 + sw $v0, 0($sp) # Storing the new string in internal_0 # Loading return value in $v1 lw $v1, 0($sp) @@ -683,16 +1038,18 @@ xor $t0, $t0, $t0 # Initializing counter while_read_start: - lw $t1, buffer_input($t0) # Loading the byte + lb $t1, buffer_input($t0) # Loading the byte beq $t1, $zero, while_read_end addi $t0, $t0, 1 # Incrementing counter j while_read_start while_read_end: + addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 move $a0, $t0 syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte la $t2, type_String sw $t2, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting length in the second word of the object @@ -702,7 +1059,7 @@ while_copy_from_buffer_start: beq $t4, $t0, while_copy_from_buffer_end - lw $t5, buffer_input($t4) # Loading the byte + lb $t5, buffer_input($t4) # Loading the byte sb $t5, 0($t3) # Storing the byte addi $t3, $t3, 1 # Imcremeenting pointer addi $t4, $t4, 1 # Incrementing counter @@ -729,9 +1086,22 @@ # Reserving space for local variables addi $sp, $sp, -4 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + li $v0, 5 syscall - sw $v0, 0($sp) # Storing the new object in internal_0 + lw $t0, 0($sp) + sw $v0, 8($t0) # Loading return value in $v1 lw $v1, 0($sp) @@ -759,11 +1129,24 @@ # Reserving space for local variables addi $sp, $sp, -4 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + # internal_0 = length of self lw $t0, 4($sp) lw $t1, 4($t0) addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator - sw $t1, 0($sp) + lw $t0, 0($sp) + sw $t1, 8($t0) # Loading return value in $v1 lw $v1, 0($sp) @@ -787,6 +1170,8 @@ lw $t1, 4($sp) lw $t2, 4($t0) # $t2 = length of str1 lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 add $t4, $t2, $t3 # $t4 = length of str1 + str2 addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) @@ -806,7 +1191,7 @@ xor $t6, $t6, $t6 # $t6 = 0 Initializing counter while_copy_str1_start: beq $t6, $t2, while_copy_str1_end - lb $t7, 0($t0) + lb $t7, 8($t0) sb $t7, 0($t5) add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string @@ -817,7 +1202,7 @@ # Copying str2 to the new string while_copy_str2_start: beq $t6, $t4, while_copy_str2_end - lb $t7, 0($t1) + lb $t7, 8($t1) sb $t7, 0($t5) add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string @@ -850,11 +1235,14 @@ # internal_0 = self[i:i + l] lw $t0, 12($sp) # $t0 = address of the string lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring - bge $t4, $t1, substring_out_of_bounds + bgt $t4, $t1, substring_out_of_bounds addi $t3, $t3, 9 li $v0, 9 @@ -904,117 +1292,105 @@ function___init___at_Main: # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_main_at_Main: - # Function parameters - # $ra = 28($sp) - # self = 24($sp) + # $ra = 8($sp) + # self = 4($sp) # Reserving space for local variables - addi $sp, $sp, -24 + addi $sp, $sp, -4 - # Allocating Int 2 + # Allocating NUll to internal_0 + sw $zero, 0($sp) # internal_0 = 0 + + # Set attribute m_main of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8729902282334 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8729902282334 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8729902282334 + j object_set_attribute_8729902282334 + int_set_attribute_8729902282334: li $v0, 9 addi $a0, $zero, 12 syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 2 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_0 = address of allocated object Int - - # Allocating Int 2 + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.m_main = internal_0 + j end_set_attribute_8729902282334 + bool_set_attribute_8729902282334: li $v0, 9 addi $a0, $zero, 12 syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.m_main = internal_0 + j end_set_attribute_8729902282334 + object_set_attribute_8729902282334: + sw $t1, 8($t0) # self.m_main = internal_0 + end_set_attribute_8729902282334: - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 2 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_1 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_0 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_0 + # Loading return value in $v1 + lw $v1, 4($sp) - # Argument internal_1 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_1 + # Freeing space for local variables + addi $sp, $sp, 4 - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 24($sp) # internal_2 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments + jr $ra - # Allocating Int 2 - li $v0, 9 - addi $a0, $zero, 12 - syscall + function_main_at_Main: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 2 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_3 = address of allocated object Int + # Reserving space for local variables + addi $sp, $sp, -8 # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_2 - lw $t0, 24($sp) - sw $t0, 4($sp) # Storing internal_2 + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - # Argument internal_3 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_3 + # Argument self + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing self - # Calling function function_mult - jal function_mult - lw $ra, 8($sp) - sw $v1, 16($sp) # internal_4 = result of function_mult - addi $sp, $sp, 12 # Freeing space for arguments + # Calling function function_in_string_at_IO + jal function_in_string_at_IO + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function_in_string_at_IO + addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 36($sp) + lw $t0, 20($sp) sw $t0, 4($sp) # Storing self - # Argument internal_4 + # Argument internal_0 lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_4 + sw $t0, 0($sp) # Storing internal_0 - # Calling function function_out_int_at_IO - jal function_out_int_at_IO + # Calling function function_out_string_at_IO + jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 12($sp) # internal_5 = result of function_out_int_at_IO + sw $v1, 12($sp) # internal_1 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 lw $v1, 0($sp) # Freeing space for local variables - addi $sp, $sp, 24 + addi $sp, $sp, 8 jr $ra diff --git a/src/main.cil b/src/main.cil index e379ab08d..d157b8620 100644 --- a/src/main.cil +++ b/src/main.cil @@ -49,6 +49,8 @@ type Bool { type Main { inherits from IO + attribute m_main + method abort: function_abort_at_Object method type_name: function_type_name_at_Object method copy: function_copy_at_Object @@ -146,29 +148,36 @@ function function_equal{ PARAM b LOCAL internal_0 # Equal result - LOCAL internal_1 # Type of a - LOCAL internal_2 # Type Int - LOCAL internal_3 # Type Bool - LOCAL internal_4 # Type String - LOCAL internal_5 # Type of a equals int - LOCAL internal_6 # Type of a equals bool - LOCAL internal_7 # Type of a equals string + LOCAL internal_1 # Null Pointer + LOCAL internal_2 # One of params is null + LOCAL internal_3 # Type of a + LOCAL internal_4 # Type Int + LOCAL internal_5 # Type Bool + LOCAL internal_6 # Type String + LOCAL internal_7 # Type of a equals int + LOCAL internal_8 # Type of a equals bool + LOCAL internal_9 # Type of a equals string internal_0 = ALLOCBOOL 0 - internal_1 = TYPEOF a - internal_2 = TYPEADDR Int - internal_3 = TYPEADDR Bool - internal_4 = TYPEADDR String - internal_5 = ALLOCBOOL 0 - internal_6 = ALLOCBOOL 0 + internal_1 = ALLOCNULL + internal_2 = ALLOCBOOL 0 + internal_2 = EQUALADDR a internal_1 + internal_2 = EQUALADDR b internal_1 + IF internal_2 GOTO a_is_type_object + internal_3 = TYPEOF a + internal_4 = TYPEADDR Int + internal_5 = TYPEADDR Bool + internal_6 = TYPEADDR String internal_7 = ALLOCBOOL 0 - internal_5 = EQUALADDR internal_1 internal_2 - internal_6 = EQUALADDR internal_1 internal_3 - internal_7 = EQUALADDR internal_1 internal_4 - - IF internal_5 GOTO a_is_type_int_or_bool - IF internal_6 GOTO a_is_type_int_or_bool - IF internal_7 GOTO a_is_type_string + internal_8 = ALLOCBOOL 0 + internal_9 = ALLOCBOOL 0 + internal_7 = EQUALADDR internal_3 internal_4 + internal_8 = EQUALADDR internal_3 internal_5 + internal_9 = EQUALADDR internal_3 internal_6 + + IF internal_7 GOTO a_is_type_int_or_bool + IF internal_8 GOTO a_is_type_int_or_bool + IF internal_9 GOTO a_is_type_string GOTO a_is_type_object a_is_type_int_or_bool: @@ -187,6 +196,47 @@ function function_equal{ RETURN internal_0 } +function function_assign{ + PARAM dest + PARAM source + + LOCAL internal_0 # Null Pointer + LOCAL internal_1 # One of params is null + LOCAL internal_2 # Type of source + LOCAL internal_3 # Type Int + LOCAL internal_4 # Type Bool + LOCAL internal_5 # Type of source equals int + LOCAL internal_6 # Type of source equals bool + + internal_0 = ALLOCNULL + internal_1 = ALLOCBOOL 0 + internal_1 = EQUALADDR source internal_0 + internal_1 = EQUALADDR dest internal_0 + IF internal_1 GOTO source_is_type_object + internal_2 = TYPEOF source + internal_3 = TYPEADDR Int + internal_4 = TYPEADDR Bool + internal_5 = ALLOCBOOL 0 + internal_6 = ALLOCBOOL 0 + internal_5 = EQUALADDR internal_2 internal_3 + internal_6 = EQUALADDR internal_2 internal_4 + + IF internal_5 GOTO source_is_type_int_or_bool + IF internal_6 GOTO source_is_type_int_or_bool + GOTO source_is_type_object + + source_is_type_int_or_bool: + dest = INT source + GOTO source_end_of_equal + + source_is_type_object: + dest = source + GOTO source_end_of_equal + + source_end_of_equal: + + RETURN dest +} function function___init___at_Object{ PARAM self @@ -195,6 +245,22 @@ function function___init___at_Object{ function function_abort_at_Object{ PARAM self + LOCAL internal_0 + LOCAL internal_1 + LOCAL internal_2 + LOCAL internal_3 + + internal_0 = ALLOCSTR "Abort called from class " + internal_2 = ALLOCSTR "\n" + ARG self + internal_1 = VCALL String function_type_name_at_Object + ARG internal_0 + ARG internal_1 + internal_3 = VCALL String function_concat_at_String + ARG internal_3 + ARG internal_2 + internal_3 = VCALL String function_concat_at_String + PRINTSTR internal_3 HALT RETURN self @@ -252,6 +318,7 @@ function function_in_int_at_IO{ LOCAL internal_0 + internal_0 = ALLOCINT 0 READINT internal_0 RETURN internal_0 @@ -266,6 +333,7 @@ function function_length_at_String{ LOCAL internal_0 + internal_0 = ALLOCINT 0 internal_0 = LENGTH self RETURN internal_0 @@ -293,35 +361,28 @@ function function_substr_at_String{ } function function___init___at_Main{ PARAM self + + LOCAL internal_0 # Null + + internal_0 = ALLOCNULL + + SETATTR self m_main internal_0 RETURN self } function function_main_at_Main{ PARAM self - LOCAL internal_0 # Integer 2 - LOCAL internal_1 # Integer 2 - LOCAL internal_2 # Store the result of the operation function_add - LOCAL internal_3 # Integer 2 - LOCAL internal_4 # Store the result of the operation function_mult - LOCAL internal_5 + LOCAL internal_0 + LOCAL internal_1 - internal_0 = ALLOCINT 2 - internal_1 = ALLOCINT 2 - - ARG internal_0 - ARG internal_1 - internal_2 = CALL function_add - internal_3 = ALLOCINT 2 - - ARG internal_2 - ARG internal_3 - internal_4 = CALL function_mult ARG self - ARG internal_4 - internal_5 = VCALL Main function_out_int_at_IO + internal_0 = VCALL Main function_in_string_at_IO + ARG self + ARG internal_0 + internal_1 = VCALL Main function_out_string_at_IO - RETURN internal_5 + RETURN internal_1 } function main{ diff --git a/src/main.cl b/src/main.cl index 6c0fae74f..36b9737b7 100644 --- a/src/main.cl +++ b/src/main.cl @@ -53,36 +53,17 @@ class Point3D inherits Point { *) class Main inherits IO { + m_main: Main; + main() : Object { - -- out_string("Hello, World!\n") - out_int((2 + 2) * 2) + -- case 1 of + -- x: Int => { + -- out_int(x); + -- out_string(" is Int\n"); + -- }; + -- y: Bool => out_string("is Bool\n"); + -- z: Object => out_string("is Object\n"); + -- esac + out_string(in_string()) }; - --- plus(a: Int, b: Int) : Int { --- a + b --- }; - --- minus(a: Int, b: Int) : Int { --- a - b --- }; - --- mult(a: Int, b: Int) : Int { --- a * b --- }; - --- div(a: Int, b: Int) : Int { --- a / b --- }; - --- equals(a: Bool, b: Bool) : Bool { --- a = b --- }; - --- less(a: Int, b: Int) : Bool { --- a < b --- }; - --- less_equals(a: Int, b: Int) : Bool { --- a <= b --- }; }; diff --git a/src/primes.asm b/src/primes.asm new file mode 100644 index 000000000..05333d529 --- /dev/null +++ b/src/primes.asm @@ -0,0 +1,2205 @@ +.data + type_Object: .word 8 + type_Object_inherits_from: .word 0 + type_Object_attributes: .word 0 + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + type_Object_abort_message: .asciiz "Abort called from class Object\n" + + type_IO: .word 8 + type_IO_inherits_from: .word type_Object + type_IO_attributes: .word 0 + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + type_IO_abort_message: .asciiz "Abort called from class IO\n" + + type_Int: .word 8 + type_Int_inherits_from: .word type_Object + type_Int_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + type_Int_abort_message: .asciiz "Abort called from class Int\n" + + type_String: .word 8 + type_String_inherits_from: .word type_Object + type_String_attributes: .word 0 + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + type_String_abort_message: .asciiz "Abort called from class String\n" + + type_Bool: .word 8 + type_Bool_inherits_from: .word type_Object + type_Bool_attributes: .word 0 + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + type_Bool_abort_message: .asciiz "Abort called from class Bool\n" + + type_Main: .word 28 + type_Main_inherits_from: .word type_IO + type_Main_attributes: .word 5 + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + type_Main_abort_message: .asciiz "Abort called from class Main\n" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 40($sp) + # a = 36($sp) + # b = 32($sp) + + # Reserving space for local variables + addi $sp, $sp, -32 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_0 = address of allocated object Int + + # internal_1 = typeof a that is the first word of the object + lw $t0, 36($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_2 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_3 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_4 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_7 = address of allocated object Int + + # internal_5 = EqualAddress(internal_1, internal_2) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_1, internal_3) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_7 = EqualAddress(internal_1, internal_4) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_6 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_7 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 36($sp) + lw $t0, 8($t0) + lw $t1, 32($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 36($sp) + lw $t1, 32($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 28($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 28($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 36($sp) # Save in $t0 the left operand address + lw $t1, 32($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 28($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 28($sp) + + # Freeing space for local variables + addi $sp, $sp, 32 + + jr $ra + + function_assign: + # Function parameters + # $ra = 28($sp) + # dest = 24($sp) + # source = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # internal_0 = typeof source that is the first word of the object + lw $t0, 20($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_1 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_2 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_3 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_4 = address of allocated object Int + + # internal_3 = EqualAddress(internal_1, internal_1) + lw $t0, 12($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_4 = EqualAddress(internal_1, internal_2) + lw $t0, 12($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_3 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_4 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 20($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 24($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 20($sp) + sw $t0, 24($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 20 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 18 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 18 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 105 + sb $t0, 14($v0) # internal_0[6] = 'i' + + addi $t0, $zero, 110 + sb $t0, 15($v0) # internal_0[7] = 'n' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_0[8] = ' ' + + sb $zero, 17($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_0 = "Abort in " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_2[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_2 = "\n" + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_type_name_at_Object + jal function_type_name_at_Object + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 12($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) # $t0 = internal_3 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string internal_3 + li $v0, 4 + move $a0, $t0 + syscall + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 12($t1) # $t1 = length of the name of self + la $t3, 16($t1) # $t1 = name of self + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t4, $v0, 0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t3, $t3, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $v0, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the string x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lw $t1, buffer_input($t0) # Loading the byte + beq $t1, $zero, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lw $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + sw $t1, 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 8($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 8($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + lw $t2, 8($sp) # $t2 = start of the substring + lw $t3, 4($sp) # $t3 = length of the substring + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bge $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 228($sp) + # self = 224($sp) + + # Reserving space for local variables + addi $sp, $sp, -224 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 31 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 31 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 50 + sb $t0, 8($v0) # internal_0[0] = '2' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_0[1] = ' ' + + addi $t0, $zero, 105 + sb $t0, 10($v0) # internal_0[2] = 'i' + + addi $t0, $zero, 115 + sb $t0, 11($v0) # internal_0[3] = 's' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_0[4] = ' ' + + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_0[5] = 't' + + addi $t0, $zero, 114 + sb $t0, 14($v0) # internal_0[6] = 'r' + + addi $t0, $zero, 105 + sb $t0, 15($v0) # internal_0[7] = 'i' + + addi $t0, $zero, 118 + sb $t0, 16($v0) # internal_0[8] = 'v' + + addi $t0, $zero, 105 + sb $t0, 17($v0) # internal_0[9] = 'i' + + addi $t0, $zero, 97 + sb $t0, 18($v0) # internal_0[10] = 'a' + + addi $t0, $zero, 108 + sb $t0, 19($v0) # internal_0[11] = 'l' + + addi $t0, $zero, 108 + sb $t0, 20($v0) # internal_0[12] = 'l' + + addi $t0, $zero, 121 + sb $t0, 21($v0) # internal_0[13] = 'y' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_0[14] = ' ' + + addi $t0, $zero, 112 + sb $t0, 23($v0) # internal_0[15] = 'p' + + addi $t0, $zero, 114 + sb $t0, 24($v0) # internal_0[16] = 'r' + + addi $t0, $zero, 105 + sb $t0, 25($v0) # internal_0[17] = 'i' + + addi $t0, $zero, 109 + sb $t0, 26($v0) # internal_0[18] = 'm' + + addi $t0, $zero, 101 + sb $t0, 27($v0) # internal_0[19] = 'e' + + addi $t0, $zero, 46 + sb $t0, 28($v0) # internal_0[20] = '.' + + addi $t0, $zero, 10 + sb $t0, 29($v0) # internal_0[21] = '\n' + + sb $zero, 30($v0) # Null-terminator at the end of the string + + sw $v0, 220($sp) # internal_0 = "2 is trivially prime.\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 236($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 232($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 228($sp) # internal_1 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 212($sp) # internal_2 = address of allocated object Int + + # Set attribute out of self + lw $t0, 224($sp) # $t0 = self + lw $t1, 212($sp) # $t1 = internal_2 + sw $t1, 8($t0) # self.out = internal_2 + + # Get attribute out of self + lw $t0, 224($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'out' from the instance + sw $t1, 208($sp) # internal_3 = out + + # Set attribute testee of self + lw $t0, 224($sp) # $t0 = self + lw $t1, 208($sp) # $t1 = internal_3 + sw $t1, 12($t0) # self.testee = internal_3 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 204($sp) # internal_4 = address of allocated object Int + + # Set attribute divisor of self + lw $t0, 224($sp) # $t0 = self + lw $t1, 204($sp) # $t1 = internal_4 + sw $t1, 16($t0) # self.divisor = internal_4 + + # Allocating Int 500 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 500 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 200($sp) # internal_5 = address of allocated object Int + + # Set attribute stop of self + lw $t0, 224($sp) # $t0 = self + lw $t1, 200($sp) # $t1 = internal_5 + sw $t1, 20($t0) # self.stop = internal_5 + + + while_start_8783432246748: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 196($sp) # internal_6 = address of allocated object Int + + # If internal_6 then goto while_body_8783432246748 + lw $t0, 196($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8783432246748 + + # Jumping to while_end_8783432246748 + j while_end_8783432246748 + + while_body_8783432246748: + + # Get attribute testee of self + lw $t0, 224($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'testee' from the instance + sw $t1, 192($sp) # internal_7 = testee + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 188($sp) # internal_8 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_7 + lw $t0, 204($sp) + sw $t0, 4($sp) # Storing internal_7 + + # Argument internal_8 + lw $t0, 200($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 196($sp) # internal_9 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute testee of self + lw $t0, 224($sp) # $t0 = self + lw $t1, 184($sp) # $t1 = internal_9 + sw $t1, 12($t0) # self.testee = internal_9 + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 180($sp) # internal_10 = address of allocated object Int + + # Set attribute divisor of self + lw $t0, 224($sp) # $t0 = self + lw $t1, 180($sp) # $t1 = internal_10 + sw $t1, 16($t0) # self.divisor = internal_10 + + + while_start_8783432246616: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 172($sp) # internal_12 = address of allocated object Int + + # Get attribute testee of self + lw $t0, 224($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'testee' from the instance + sw $t1, 168($sp) # internal_13 = testee + + # Get attribute divisor of self + lw $t0, 224($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'divisor' from the instance + sw $t1, 164($sp) # internal_14 = divisor + + # Get attribute divisor of self + lw $t0, 224($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'divisor' from the instance + sw $t1, 160($sp) # internal_15 = divisor + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_14 + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing internal_14 + + # Argument internal_15 + lw $t0, 172($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 168($sp) # internal_16 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_13 + lw $t0, 180($sp) + sw $t0, 4($sp) # Storing internal_13 + + # Argument internal_16 + lw $t0, 168($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 164($sp) # internal_17 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_12 = internal_17 + lw $t0, 152($sp) + sw $t0, 172($sp) + + # If internal_12 then goto then_8783432246592 + lw $t0, 172($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8783432246592 + + # Jumping to else_8783432246592 + j else_8783432246592 + + then_8783432246592: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 148($sp) # internal_18 = address of allocated object Int + + # internal_11 = internal_18 + lw $t0, 148($sp) + sw $t0, 176($sp) + + # Jumping to endif_8783432246592 + j endif_8783432246592 + + else_8783432246592: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 140($sp) # internal_20 = address of allocated object Int + + # Get attribute testee of self + lw $t0, 224($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'testee' from the instance + sw $t1, 136($sp) # internal_21 = testee + + # Get attribute divisor of self + lw $t0, 224($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'divisor' from the instance + sw $t1, 132($sp) # internal_22 = divisor + + # Get attribute testee of self + lw $t0, 224($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'testee' from the instance + sw $t1, 128($sp) # internal_23 = testee + + # Get attribute divisor of self + lw $t0, 224($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'divisor' from the instance + sw $t1, 124($sp) # internal_24 = divisor + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_23 + lw $t0, 140($sp) + sw $t0, 4($sp) # Storing internal_23 + + # Argument internal_24 + lw $t0, 136($sp) + sw $t0, 0($sp) # Storing internal_24 + + # Calling function function_div + jal function_div + lw $ra, 8($sp) + sw $v1, 132($sp) # internal_25 = result of function_div + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_22 + lw $t0, 144($sp) + sw $t0, 4($sp) # Storing internal_22 + + # Argument internal_25 + lw $t0, 132($sp) + sw $t0, 0($sp) # Storing internal_25 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 128($sp) # internal_26 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_21 + lw $t0, 148($sp) + sw $t0, 4($sp) # Storing internal_21 + + # Argument internal_26 + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing internal_26 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 124($sp) # internal_27 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_28 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_27 + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing internal_27 + + # Argument internal_28 + lw $t0, 120($sp) + sw $t0, 0($sp) # Storing internal_28 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 116($sp) # internal_29 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_20 = internal_29 + lw $t0, 104($sp) + sw $t0, 140($sp) + + # If internal_20 then goto then_8783432246586 + lw $t0, 140($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8783432246586 + + # Jumping to else_8783432246586 + j else_8783432246586 + + then_8783432246586: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_30 = address of allocated object Int + + # internal_19 = internal_30 + lw $t0, 100($sp) + sw $t0, 144($sp) + + # Jumping to endif_8783432246586 + j endif_8783432246586 + + else_8783432246586: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_31 = address of allocated object Int + + # internal_19 = internal_31 + lw $t0, 96($sp) + sw $t0, 144($sp) + + # Jumping to endif_8783432246586 + j endif_8783432246586 + + endif_8783432246586: + + # internal_11 = internal_19 + lw $t0, 144($sp) + sw $t0, 176($sp) + + # Jumping to endif_8783432246592 + j endif_8783432246592 + + endif_8783432246592: + + # If internal_11 then goto while_body_8783432246616 + lw $t0, 176($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8783432246616 + + # Jumping to while_end_8783432246616 + j while_end_8783432246616 + + while_body_8783432246616: + + # Get attribute divisor of self + lw $t0, 224($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'divisor' from the instance + sw $t1, 92($sp) # internal_32 = divisor + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_33 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_32 + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing internal_32 + + # Argument internal_33 + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing internal_33 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 96($sp) # internal_34 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute divisor of self + lw $t0, 224($sp) # $t0 = self + lw $t1, 84($sp) # $t1 = internal_34 + sw $t1, 16($t0) # self.divisor = internal_34 + + # Jumping to while_start_8783432246616 + j while_start_8783432246616 + + while_end_8783432246616: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_36 = address of allocated object Int + + # Get attribute testee of self + lw $t0, 224($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'testee' from the instance + sw $t1, 72($sp) # internal_37 = testee + + # Get attribute divisor of self + lw $t0, 224($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'divisor' from the instance + sw $t1, 68($sp) # internal_38 = divisor + + # Get attribute divisor of self + lw $t0, 224($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'divisor' from the instance + sw $t1, 64($sp) # internal_39 = divisor + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_38 + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing internal_38 + + # Argument internal_39 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_39 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 72($sp) # internal_40 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_37 + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing internal_37 + + # Argument internal_40 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_40 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_41 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_36 = internal_41 + lw $t0, 56($sp) + sw $t0, 76($sp) + + # If internal_36 then goto then_8783432246682 + lw $t0, 76($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8783432246682 + + # Jumping to else_8783432246682 + j else_8783432246682 + + then_8783432246682: + + # Get attribute testee of self + lw $t0, 224($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'testee' from the instance + sw $t1, 52($sp) # internal_42 = testee + + # Set attribute out of self + lw $t0, 224($sp) # $t0 = self + lw $t1, 52($sp) # $t1 = internal_42 + sw $t1, 8($t0) # self.out = internal_42 + + # Get attribute out of self + lw $t0, 224($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'out' from the instance + sw $t1, 48($sp) # internal_43 = out + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 236($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_43 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_43 + + # Calling function function_out_int_at_IO + jal function_out_int_at_IO + lw $ra, 8($sp) + sw $v1, 56($sp) # internal_44 = result of function_out_int_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 20 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_45[0] = ' ' + + addi $t0, $zero, 105 + sb $t0, 9($v0) # internal_45[1] = 'i' + + addi $t0, $zero, 115 + sb $t0, 10($v0) # internal_45[2] = 's' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_45[3] = ' ' + + addi $t0, $zero, 112 + sb $t0, 12($v0) # internal_45[4] = 'p' + + addi $t0, $zero, 114 + sb $t0, 13($v0) # internal_45[5] = 'r' + + addi $t0, $zero, 105 + sb $t0, 14($v0) # internal_45[6] = 'i' + + addi $t0, $zero, 109 + sb $t0, 15($v0) # internal_45[7] = 'm' + + addi $t0, $zero, 101 + sb $t0, 16($v0) # internal_45[8] = 'e' + + addi $t0, $zero, 46 + sb $t0, 17($v0) # internal_45[9] = '.' + + addi $t0, $zero, 10 + sb $t0, 18($v0) # internal_45[10] = '\n' + + sb $zero, 19($v0) # Null-terminator at the end of the string + + sw $v0, 40($sp) # internal_45 = " is prime.\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 236($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_45 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_45 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_46 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_35 = internal_46 + lw $t0, 36($sp) + sw $t0, 80($sp) + + # Jumping to endif_8783432246682 + j endif_8783432246682 + + else_8783432246682: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_47 = address of allocated object Int + + # internal_35 = internal_47 + lw $t0, 32($sp) + sw $t0, 80($sp) + + # Jumping to endif_8783432246682 + j endif_8783432246682 + + endif_8783432246682: + + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_49 = address of allocated object Int + + # Get attribute stop of self + lw $t0, 224($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'stop' from the instance + sw $t1, 20($sp) # internal_50 = stop + + # Get attribute testee of self + lw $t0, 224($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'testee' from the instance + sw $t1, 16($sp) # internal_51 = testee + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_50 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_50 + + # Argument internal_51 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_51 + + # Calling function function_less_than_or_equal + jal function_less_than_or_equal + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_52 = result of function_less_than_or_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_49 = internal_52 + lw $t0, 12($sp) + sw $t0, 24($sp) + + # If internal_49 then goto then_8783432246730 + lw $t0, 24($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8783432246730 + + # Jumping to else_8783432246730 + j else_8783432246730 + + then_8783432246730: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 13 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 13 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 104 + sb $t0, 8($v0) # internal_53[0] = 'h' + + addi $t0, $zero, 97 + sb $t0, 9($v0) # internal_53[1] = 'a' + + addi $t0, $zero, 108 + sb $t0, 10($v0) # internal_53[2] = 'l' + + addi $t0, $zero, 116 + sb $t0, 11($v0) # internal_53[3] = 't' + + sb $zero, 12($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_53 = "halt" + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_53 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_53 + + # Calling function function_abort_at_Object + jal function_abort_at_Object + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_54 = result of function_abort_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # internal_48 = internal_54 + lw $t0, 4($sp) + sw $t0, 28($sp) + + # Jumping to endif_8783432246730 + j endif_8783432246730 + + else_8783432246730: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 17 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 17 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 99 + sb $t0, 8($v0) # internal_55[0] = 'c' + + addi $t0, $zero, 111 + sb $t0, 9($v0) # internal_55[1] = 'o' + + addi $t0, $zero, 110 + sb $t0, 10($v0) # internal_55[2] = 'n' + + addi $t0, $zero, 116 + sb $t0, 11($v0) # internal_55[3] = 't' + + addi $t0, $zero, 105 + sb $t0, 12($v0) # internal_55[4] = 'i' + + addi $t0, $zero, 110 + sb $t0, 13($v0) # internal_55[5] = 'n' + + addi $t0, $zero, 117 + sb $t0, 14($v0) # internal_55[6] = 'u' + + addi $t0, $zero, 101 + sb $t0, 15($v0) # internal_55[7] = 'e' + + sb $zero, 16($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_55 = "continue" + + # internal_48 = internal_55 + lw $t0, 0($sp) + sw $t0, 28($sp) + + # Jumping to endif_8783432246730 + j endif_8783432246730 + + endif_8783432246730: + + # Jumping to while_start_8783432246748 + j while_start_8783432246748 + + while_end_8783432246748: + + # Set attribute m of self + lw $t0, 224($sp) # $t0 = self + addi $t1, $zero, 0 # $t1 0 + sw $t1, 24($t0) # Set the attribute m of self + + # Loading return value in $v1 + lw $v1, 224($sp) + + # Freeing space for local variables + addi $sp, $sp, 224 + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_main_at_Main + jal function_main_at_Main + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/src/primes.cil b/src/primes.cil new file mode 100644 index 000000000..0629f333e --- /dev/null +++ b/src/primes.cil @@ -0,0 +1,623 @@ +.TYPES +type Object { + inherits from null + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method __init__: function___init___at_Object +} +type IO { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method out_string: function_out_string_at_IO + method out_int: function_out_int_at_IO + method in_string: function_in_string_at_IO + method in_int: function_in_int_at_IO + method __init__: function___init___at_IO +} +type Int { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method __init__: function___init___at_Int +} +type String { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method length: function_length_at_String + method concat: function_concat_at_String + method substr: function_substr_at_String + method __init__: function___init___at_String +} +type Bool { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method __init__: function___init___at_Bool +} +type Main { + inherits from IO + + attribute out + attribute testee + attribute divisor + attribute stop + attribute m + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method out_string: function_out_string_at_IO + method out_int: function_out_int_at_IO + method in_string: function_in_string_at_IO + method in_int: function_in_int_at_IO + method main: function_main_at_Main + method __init__: function___init___at_Main +} + +.DATA + + +.CODE +function function_add{ + PARAM a + PARAM b + + LOCAL internal_0 # Adding result + + internal_0 = ALLOCINT 0 + internal_0 = a + b + + RETURN internal_0 +} +function function_sub{ + PARAM a + PARAM b + + LOCAL internal_0 # Substracting result + + internal_0 = ALLOCINT 0 + internal_0 = a - b + + RETURN internal_0 +} +function function_mult{ + PARAM a + PARAM b + + LOCAL internal_0 # Multiting result + + internal_0 = ALLOCINT 0 + internal_0 = a * b + + RETURN internal_0 +} +function function_div{ + PARAM a + PARAM b + + LOCAL internal_0 # Dividing result + + internal_0 = ALLOCINT 0 + internal_0 = a / b + + RETURN internal_0 +} +function function_xor{ + PARAM a + PARAM b + + LOCAL internal_0 # Xor result + + internal_0 = ALLOCINT 0 + internal_0 = XOR a b + + RETURN internal_0 +} +function function_less_than{ + PARAM a + PARAM b + + LOCAL internal_0 # Less than result + + internal_0 = ALLOCBOOL 0 + internal_0 = a < b + + RETURN internal_0 +} +function function_less_than_or_equal{ + PARAM a + PARAM b + + LOCAL internal_0 # Less than or equal result + + internal_0 = ALLOCBOOL 0 + internal_0 = a <= b + + RETURN internal_0 +} +function function_equal{ + PARAM a + PARAM b + + LOCAL internal_0 # Equal result + LOCAL internal_1 # Type of a + LOCAL internal_2 # Type Int + LOCAL internal_3 # Type Bool + LOCAL internal_4 # Type String + LOCAL internal_5 # Type of a equals int + LOCAL internal_6 # Type of a equals bool + LOCAL internal_7 # Type of a equals string + + internal_0 = ALLOCBOOL 0 + internal_1 = TYPEOF a + internal_2 = TYPEADDR Int + internal_3 = TYPEADDR Bool + internal_4 = TYPEADDR String + internal_5 = ALLOCBOOL 0 + internal_6 = ALLOCBOOL 0 + internal_7 = ALLOCBOOL 0 + internal_5 = EQUALADDR internal_1 internal_2 + internal_6 = EQUALADDR internal_1 internal_3 + internal_7 = EQUALADDR internal_1 internal_4 + + IF internal_5 GOTO a_is_type_int_or_bool + IF internal_6 GOTO a_is_type_int_or_bool + IF internal_7 GOTO a_is_type_string + GOTO a_is_type_object + + a_is_type_int_or_bool: + internal_0 = EQUALINT a b + GOTO end_of_equal + + a_is_type_string: + internal_0 = EQUALSTR a b + GOTO end_of_equal + + a_is_type_object: + internal_0 = a == b + GOTO end_of_equal + + end_of_equal: + + RETURN internal_0 +} +function function_assign{ + PARAM dest + PARAM source + + LOCAL internal_0 # Type of source + LOCAL internal_1 # Type Int + LOCAL internal_2 # Type Bool + LOCAL internal_3 # Type of source equals int + LOCAL internal_4 # Type of source equals bool + + internal_0 = TYPEOF source + internal_1 = TYPEADDR Int + internal_2 = TYPEADDR Bool + internal_3 = ALLOCBOOL 0 + internal_4 = ALLOCBOOL 0 + internal_3 = EQUALADDR internal_1 internal_1 + internal_4 = EQUALADDR internal_1 internal_2 + + IF internal_3 GOTO source_is_type_int_or_bool + IF internal_4 GOTO source_is_type_int_or_bool + GOTO source_is_type_object + + source_is_type_int_or_bool: + dest = INT source + GOTO source_end_of_equal + + source_is_type_object: + dest = source + GOTO source_end_of_equal + + source_end_of_equal: + + RETURN dest +} +function function___init___at_Object{ + PARAM self + + RETURN self +} +function function_abort_at_Object{ + PARAM self + + LOCAL internal_0 # Message + LOCAL internal_1 # Message + LOCAL internal_2 # Endl + LOCAL internal_3 # Message + + internal_0 = ALLOCSTR "Abort in " + internal_2 = ALLOCSTR "\n" + ARG self + internal_1 = VCALL String function_type_name_at_Object + ARG internal_0 + ARG internal_1 + internal_3 = VCALL String function_concat_at_String + ARG internal_3 + ARG internal_2 + internal_3 = VCALL String function_concat_at_String + PRINTSTR internal_3 + HALT + + RETURN self +} +function function_type_name_at_Object{ + PARAM self + + LOCAL internal_0 # type_name + + internal_0 = TYPENAME self + + RETURN internal_0 +} +function function_copy_at_Object{ + PARAM self + + LOCAL internal_0 + + internal_0 = COPY self + + RETURN internal_0 +} +function function___init___at_IO{ + PARAM self + + RETURN self +} +function function_out_string_at_IO{ + PARAM self + PARAM x + + PRINTSTR x + + RETURN self +} +function function_out_int_at_IO{ + PARAM self + PARAM x + + PRINTINT x + + RETURN self +} +function function_in_string_at_IO{ + PARAM self + + LOCAL internal_0 + + READSTR internal_0 + + RETURN internal_0 +} +function function_in_int_at_IO{ + PARAM self + + LOCAL internal_0 + + internal_0 = ALLOCINT 0 + READINT internal_0 + + RETURN internal_0 +} +function function___init___at_String{ + PARAM self + + RETURN self +} +function function_length_at_String{ + PARAM self + + LOCAL internal_0 + + internal_0 = LENGTH self + + RETURN internal_0 +} +function function_concat_at_String{ + PARAM self + PARAM s + + LOCAL internal_0 + + internal_0 = CONCAT self s + + RETURN internal_0 +} +function function_substr_at_String{ + PARAM self + PARAM i + PARAM l + + LOCAL internal_0 + + internal_0 = SUBSTRING self i l + + RETURN internal_0 +} +function function___init___at_Main{ + PARAM self + + LOCAL internal_0 # String "2 is trivially prime.\n" + LOCAL internal_1 + LOCAL internal_2 # Integer 2 + LOCAL internal_3 + LOCAL internal_4 # Integer 0 + LOCAL internal_5 # Integer 500 + LOCAL internal_6 # Boolean true + LOCAL internal_7 + LOCAL internal_8 # Integer 1 + LOCAL internal_9 # Store the result of the operation function_add + LOCAL internal_10 # Integer 2 + LOCAL internal_11 + LOCAL internal_12 + LOCAL internal_13 + LOCAL internal_14 + LOCAL internal_15 + LOCAL internal_16 # Store the result of the operation function_mult + LOCAL internal_17 # Store the result of the operation function_less_than + LOCAL internal_18 # Boolean false + LOCAL internal_19 + LOCAL internal_20 + LOCAL internal_21 + LOCAL internal_22 + LOCAL internal_23 + LOCAL internal_24 + LOCAL internal_25 # Store the result of the operation function_div + LOCAL internal_26 # Store the result of the operation function_mult + LOCAL internal_27 # Store the result of the operation function_sub + LOCAL internal_28 # Integer 0 + LOCAL internal_29 # Store the result of the operation function_equal + LOCAL internal_30 # Boolean false + LOCAL internal_31 # Boolean true + LOCAL internal_32 + LOCAL internal_33 # Integer 1 + LOCAL internal_34 # Store the result of the operation function_add + LOCAL internal_35 + LOCAL internal_36 + LOCAL internal_37 + LOCAL internal_38 + LOCAL internal_39 + LOCAL internal_40 # Store the result of the operation function_mult + LOCAL internal_41 # Store the result of the operation function_less_than + LOCAL internal_42 + LOCAL internal_43 + LOCAL internal_44 + LOCAL internal_45 # String " is prime.\n" + LOCAL internal_46 + LOCAL internal_47 # Integer 0 + LOCAL internal_48 + LOCAL internal_49 + LOCAL internal_50 + LOCAL internal_51 + LOCAL internal_52 # Store the result of the operation function_less_than_or_equal + LOCAL internal_53 # String "halt" + LOCAL internal_54 + LOCAL internal_55 # String "continue" + + internal_0 = ALLOCSTR "2 is trivially prime.\n" + ARG self + ARG internal_0 + internal_1 = VCALL Main function_out_string_at_IO + internal_2 = ALLOCINT 2 + + SETATTR self out internal_2 + internal_3 = GETATTR self out + + SETATTR self testee internal_3 + internal_4 = ALLOCINT 0 + + SETATTR self divisor internal_4 + internal_5 = ALLOCINT 500 + + SETATTR self stop internal_5 + + # While loop + while_start_8783432246748: + internal_6 = ALLOCBOOL 1 + IF internal_6 GOTO while_body_8783432246748 + GOTO while_end_8783432246748 + + while_body_8783432246748: + internal_7 = GETATTR self testee + internal_8 = ALLOCINT 1 + + ARG internal_7 + ARG internal_8 + internal_9 = CALL function_add + + SETATTR self testee internal_9 + internal_10 = ALLOCINT 2 + + SETATTR self divisor internal_10 + + # While loop + while_start_8783432246616: + # Conditional + internal_12 = ALLOCBOOL 0 + internal_13 = GETATTR self testee + internal_14 = GETATTR self divisor + internal_15 = GETATTR self divisor + + ARG internal_14 + ARG internal_15 + internal_16 = CALL function_mult + + ARG internal_13 + ARG internal_16 + internal_17 = CALL function_less_than + internal_12 = internal_17 + IF internal_12 GOTO then_8783432246592 + GOTO else_8783432246592 + + then_8783432246592: + internal_18 = ALLOCBOOL 0 + internal_11 = internal_18 + GOTO endif_8783432246592 + + else_8783432246592: + # Conditional + internal_20 = ALLOCBOOL 0 + internal_21 = GETATTR self testee + internal_22 = GETATTR self divisor + internal_23 = GETATTR self testee + internal_24 = GETATTR self divisor + + ARG internal_23 + ARG internal_24 + internal_25 = CALL function_div + + ARG internal_22 + ARG internal_25 + internal_26 = CALL function_mult + + ARG internal_21 + ARG internal_26 + internal_27 = CALL function_sub + internal_28 = ALLOCINT 0 + + ARG internal_27 + ARG internal_28 + internal_29 = CALL function_equal + internal_20 = internal_29 + IF internal_20 GOTO then_8783432246586 + GOTO else_8783432246586 + + then_8783432246586: + internal_30 = ALLOCBOOL 0 + internal_19 = internal_30 + GOTO endif_8783432246586 + + else_8783432246586: + internal_31 = ALLOCBOOL 1 + internal_19 = internal_31 + GOTO endif_8783432246586 + + endif_8783432246586: + internal_11 = internal_19 + GOTO endif_8783432246592 + + endif_8783432246592: + IF internal_11 GOTO while_body_8783432246616 + GOTO while_end_8783432246616 + + while_body_8783432246616: + internal_32 = GETATTR self divisor + internal_33 = ALLOCINT 1 + + ARG internal_32 + ARG internal_33 + internal_34 = CALL function_add + + SETATTR self divisor internal_34 + GOTO while_start_8783432246616 + + while_end_8783432246616: + # Conditional + internal_36 = ALLOCBOOL 0 + internal_37 = GETATTR self testee + internal_38 = GETATTR self divisor + internal_39 = GETATTR self divisor + + ARG internal_38 + ARG internal_39 + internal_40 = CALL function_mult + + ARG internal_37 + ARG internal_40 + internal_41 = CALL function_less_than + internal_36 = internal_41 + IF internal_36 GOTO then_8783432246682 + GOTO else_8783432246682 + + then_8783432246682: + internal_42 = GETATTR self testee + + SETATTR self out internal_42 + internal_43 = GETATTR self out + ARG self + ARG internal_43 + internal_44 = VCALL Main function_out_int_at_IO + internal_45 = ALLOCSTR " is prime.\n" + ARG self + ARG internal_45 + internal_46 = VCALL Main function_out_string_at_IO + internal_35 = internal_46 + GOTO endif_8783432246682 + + else_8783432246682: + internal_47 = ALLOCINT 0 + internal_35 = internal_47 + GOTO endif_8783432246682 + + endif_8783432246682: + # Conditional + internal_49 = ALLOCBOOL 0 + internal_50 = GETATTR self stop + internal_51 = GETATTR self testee + + ARG internal_50 + ARG internal_51 + internal_52 = CALL function_less_than_or_equal + internal_49 = internal_52 + IF internal_49 GOTO then_8783432246730 + GOTO else_8783432246730 + + then_8783432246730: + internal_53 = ALLOCSTR "halt" + ARG internal_53 + internal_54 = VCALL String function_abort_at_Object + internal_48 = internal_54 + GOTO endif_8783432246730 + + else_8783432246730: + internal_55 = ALLOCSTR "continue" + internal_48 = internal_55 + GOTO endif_8783432246730 + + endif_8783432246730: + GOTO while_start_8783432246748 + + while_end_8783432246748: + + SETATTR self m 0 + + RETURN self +} +function function_main_at_Main{ + PARAM self + + LOCAL internal_0 # Integer 0 + + internal_0 = ALLOCINT 0 + + RETURN internal_0 +} +function main{ + + + LOCAL internal_0 + LOCAL internal_1 + + internal_0 = ALLOCATE Main + ARG internal_0 + internal_0 = VCALL Main function___init___at_Main + + ARG internal_0 + internal_1 = VCALL Main function_main_at_Main + + HALT +} \ No newline at end of file diff --git a/src/primes.cl b/src/primes.cl new file mode 100644 index 000000000..416b69cdf --- /dev/null +++ b/src/primes.cl @@ -0,0 +1,86 @@ + +(* + * methodless-primes.cl + * + * Designed by Jesse H. Willett, jhw@cory, 11103234, with + * Istvan Siposs, isiposs@cory, 12342921. + * + * This program generates primes in order without using any methods. + * Actually, it does use three methods: those of IO to print out each + * prime, and abort() to halt the program. These methods are incidental, + * however, to the information-processing functionality of the program. We + * could regard the attribute 'out's sequential values as our output, and + * the string "halt" as our terminate signal. + * + * Naturally, using Cool this way is a real waste, basically reducing it + * to assembly without the benefit of compilation. + * + * There could even be a subroutine-like construction, in that different + * code could be in the assign fields of attributes of other classes, + * and it could be executed by calling 'new Sub', but no parameters + * could be passed to the subroutine, and it could only return itself. + * but returning itself would be useless since we couldn't call methods + * and the only operators we have are for Int and Bool, which do nothing + * interesting when we initialize them! + *) + +class Main inherits IO { + + main() : Int { -- main() is an atrophied method so we can parse. + 0 + }; + + out : Int <- -- out is our 'output'. Its values are the primes. + { + out_string("2 is trivially prime.\n"); + 2; + }; + + testee : Int <- out; -- testee is a number to be tested for primeness. + + divisor : Int; -- divisor is a number which may factor testee. + + stop : Int <- 500; -- stop is an arbitrary value limiting testee. + + m : Object <- -- m supplants the main method. + while true + loop + { + + testee <- testee + 1; + divisor <- 2; + + while + if testee < divisor * divisor then + false -- can stop if divisor > sqrt(testee). + else + if testee - divisor*(testee / divisor) = 0 then + false -- can stop if divisor divides testee. + else + true + fi + fi + loop + divisor <- divisor + 1 + pool; + + if testee < divisor * divisor -- which reason did we stop for? + then -- testee has no factors less than sqrt(testee). + { + out <- testee; -- we could think of out itself as the output. + out_int(out); + out_string(" is prime.\n"); + } + else -- the loop halted on testee/divisor = 0, testee isn't prime. + 0 -- testee isn't prime, do nothing. + fi; + + if stop <= testee then + "halt".abort() -- we could think of "halt" as SIGTERM. + else + "continue" + fi; + } + pool; +}; (* end of Main *) + diff --git a/src/print-cool.asm b/src/print-cool.asm new file mode 100644 index 000000000..742fdbd1f --- /dev/null +++ b/src/print-cool.asm @@ -0,0 +1,1612 @@ +.data + type_Object: .word 8 + type_Object_inherits_from: .word 0 + type_Object_attributes: .word 0 + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + type_Object_abort_message: .asciiz "Abort called from class Object\n" + + type_IO: .word 8 + type_IO_inherits_from: .word type_Object + type_IO_attributes: .word 0 + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + type_IO_abort_message: .asciiz "Abort called from class IO\n" + + type_Int: .word 8 + type_Int_inherits_from: .word type_Object + type_Int_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + type_Int_abort_message: .asciiz "Abort called from class Int\n" + + type_String: .word 8 + type_String_inherits_from: .word type_Object + type_String_attributes: .word 0 + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + type_String_abort_message: .asciiz "Abort called from class String\n" + + type_Bool: .word 8 + type_Bool_inherits_from: .word type_Object + type_Bool_attributes: .word 0 + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + type_Bool_abort_message: .asciiz "Abort called from class Bool\n" + + type_Main: .word 8 + type_Main_inherits_from: .word type_IO + type_Main_attributes: .word 0 + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + type_Main_abort_message: .asciiz "Abort called from class Main\n" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_0 = address of allocated object Int + + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_5 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_6 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_7 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_8 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_9 = address of allocated object Int + + # internal_7 = EqualAddress(internal_3, internal_4) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_8 = EqualAddress(internal_3, internal_5) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_9 = EqualAddress(internal_3, internal_6) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_7 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_8 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_9 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 44($sp) + lw $t0, 8($t0) + lw $t1, 40($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 36($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 44($sp) + lw $t1, 40($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 36($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 36($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 36($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_2[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_2 = "\n" + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_type_name_at_Object + jal function_type_name_at_Object + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 12($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) # $t0 = internal_3 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string internal_3 + li $v0, 4 + move $a0, $t0 + syscall + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 12($t1) # $t1 = length of the name of self + la $t3, 16($t1) # $t1 = name of self + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t4, $v0, 0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t3, $t3, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $v0, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the string x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lb $t1, buffer_input($t0) # Loading the byte + beq $t1, $zero, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lb $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + lw $t0, 0($sp) + sw $t1, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 8($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 8($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 + lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) + lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bgt $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 64($sp) + # self = 60($sp) + + # Reserving space for local variables + addi $sp, $sp, -60 + + # Allocating Object + li $v0, 9 + lw $a0, type_Object + syscall + la $t0, type_Object # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 56($sp) # internal_0 = address of allocated object Object + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Object + jal function___init___at_Object + lw $ra, 4($sp) + sw $v1, 64($sp) # internal_0 = result of function___init___at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_type_name_at_Object + jal function_type_name_at_Object + lw $ra, 4($sp) + sw $v1, 60($sp) # internal_1 = result of function_type_name_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_2 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_1 + lw $t0, 68($sp) + sw $t0, 8($sp) # Storing internal_1 + + # Argument internal_2 + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 56($sp) # internal_4 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_4 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_5 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_7 = address of allocated object Int + + # Allocating NUll to internal_6 + sw $zero, 32($sp) # internal_6 = 0 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing self + + # Argument self + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_7 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_7 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_type_name_at_Object + jal function_type_name_at_Object + lw $ra, 4($sp) + sw $v1, 32($sp) # internal_8 = result of function_type_name_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_9 = address of allocated object Int + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_10 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_8 + lw $t0, 40($sp) + sw $t0, 8($sp) # Storing internal_8 + + # Argument internal_9 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_9 + + # Argument internal_10 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 28($sp) # internal_11 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_5 + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing internal_5 + + # Argument internal_11 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_12 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_13[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_13 = "\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_13 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_14 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 60 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_main_at_Main + jal function_main_at_Main + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/src/print-cool.cil b/src/print-cool.cil new file mode 100644 index 000000000..3daa1d054 --- /dev/null +++ b/src/print-cool.cil @@ -0,0 +1,435 @@ +.TYPES +type Object { + inherits from null + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method __init__: function___init___at_Object +} +type IO { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method out_string: function_out_string_at_IO + method out_int: function_out_int_at_IO + method in_string: function_in_string_at_IO + method in_int: function_in_int_at_IO + method __init__: function___init___at_IO +} +type Int { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method __init__: function___init___at_Int +} +type String { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method length: function_length_at_String + method concat: function_concat_at_String + method substr: function_substr_at_String + method __init__: function___init___at_String +} +type Bool { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method __init__: function___init___at_Bool +} +type Main { + inherits from IO + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method out_string: function_out_string_at_IO + method out_int: function_out_int_at_IO + method in_string: function_in_string_at_IO + method in_int: function_in_int_at_IO + method main: function_main_at_Main + method __init__: function___init___at_Main +} + +.DATA + + +.CODE +function function_add{ + PARAM a + PARAM b + + LOCAL internal_0 # Adding result + + internal_0 = ALLOCINT 0 + internal_0 = a + b + + RETURN internal_0 +} +function function_sub{ + PARAM a + PARAM b + + LOCAL internal_0 # Substracting result + + internal_0 = ALLOCINT 0 + internal_0 = a - b + + RETURN internal_0 +} +function function_mult{ + PARAM a + PARAM b + + LOCAL internal_0 # Multiting result + + internal_0 = ALLOCINT 0 + internal_0 = a * b + + RETURN internal_0 +} +function function_div{ + PARAM a + PARAM b + + LOCAL internal_0 # Dividing result + + internal_0 = ALLOCINT 0 + internal_0 = a / b + + RETURN internal_0 +} +function function_xor{ + PARAM a + PARAM b + + LOCAL internal_0 # Xor result + + internal_0 = ALLOCINT 0 + internal_0 = XOR a b + + RETURN internal_0 +} +function function_less_than{ + PARAM a + PARAM b + + LOCAL internal_0 # Less than result + + internal_0 = ALLOCBOOL 0 + internal_0 = a < b + + RETURN internal_0 +} +function function_less_than_or_equal{ + PARAM a + PARAM b + + LOCAL internal_0 # Less than or equal result + + internal_0 = ALLOCBOOL 0 + internal_0 = a <= b + + RETURN internal_0 +} +function function_equal{ + PARAM a + PARAM b + + LOCAL internal_0 # Equal result + LOCAL internal_1 # Null Pointer + LOCAL internal_2 # One of params is null + LOCAL internal_3 # Type of a + LOCAL internal_4 # Type Int + LOCAL internal_5 # Type Bool + LOCAL internal_6 # Type String + LOCAL internal_7 # Type of a equals int + LOCAL internal_8 # Type of a equals bool + LOCAL internal_9 # Type of a equals string + + internal_0 = ALLOCBOOL 0 + internal_1 = ALLOCNULL + internal_2 = ALLOCBOOL 0 + internal_2 = EQUALADDR a internal_1 + internal_2 = EQUALADDR b internal_1 + IF internal_2 GOTO a_is_type_object + internal_3 = TYPEOF a + internal_4 = TYPEADDR Int + internal_5 = TYPEADDR Bool + internal_6 = TYPEADDR String + internal_7 = ALLOCBOOL 0 + internal_8 = ALLOCBOOL 0 + internal_9 = ALLOCBOOL 0 + internal_7 = EQUALADDR internal_3 internal_4 + internal_8 = EQUALADDR internal_3 internal_5 + internal_9 = EQUALADDR internal_3 internal_6 + + IF internal_7 GOTO a_is_type_int_or_bool + IF internal_8 GOTO a_is_type_int_or_bool + IF internal_9 GOTO a_is_type_string + GOTO a_is_type_object + + a_is_type_int_or_bool: + internal_0 = EQUALINT a b + GOTO end_of_equal + + a_is_type_string: + internal_0 = EQUALSTR a b + GOTO end_of_equal + + a_is_type_object: + internal_0 = a == b + GOTO end_of_equal + + end_of_equal: + + RETURN internal_0 +} +function function_assign{ + PARAM dest + PARAM source + + LOCAL internal_0 # Null Pointer + LOCAL internal_1 # One of params is null + LOCAL internal_2 # Type of source + LOCAL internal_3 # Type Int + LOCAL internal_4 # Type Bool + LOCAL internal_5 # Type of source equals int + LOCAL internal_6 # Type of source equals bool + + internal_0 = ALLOCNULL + internal_1 = ALLOCBOOL 0 + internal_1 = EQUALADDR source internal_0 + internal_1 = EQUALADDR dest internal_0 + IF internal_1 GOTO source_is_type_object + internal_2 = TYPEOF source + internal_3 = TYPEADDR Int + internal_4 = TYPEADDR Bool + internal_5 = ALLOCBOOL 0 + internal_6 = ALLOCBOOL 0 + internal_5 = EQUALADDR internal_2 internal_3 + internal_6 = EQUALADDR internal_2 internal_4 + + IF internal_5 GOTO source_is_type_int_or_bool + IF internal_6 GOTO source_is_type_int_or_bool + GOTO source_is_type_object + + source_is_type_int_or_bool: + dest = INT source + GOTO source_end_of_equal + + source_is_type_object: + dest = source + GOTO source_end_of_equal + + source_end_of_equal: + + RETURN dest +} +function function___init___at_Object{ + PARAM self + + RETURN self +} +function function_abort_at_Object{ + PARAM self + + LOCAL internal_0 + LOCAL internal_1 + LOCAL internal_2 + LOCAL internal_3 + + internal_0 = ALLOCSTR "Abort called from class " + internal_2 = ALLOCSTR "\n" + ARG self + internal_1 = VCALL String function_type_name_at_Object + ARG internal_0 + ARG internal_1 + internal_3 = VCALL String function_concat_at_String + ARG internal_3 + ARG internal_2 + internal_3 = VCALL String function_concat_at_String + PRINTSTR internal_3 + HALT + + RETURN self +} +function function_type_name_at_Object{ + PARAM self + + LOCAL internal_0 # type_name + + internal_0 = TYPENAME self + + RETURN internal_0 +} +function function_copy_at_Object{ + PARAM self + + LOCAL internal_0 + + internal_0 = COPY self + + RETURN internal_0 +} +function function___init___at_IO{ + PARAM self + + RETURN self +} +function function_out_string_at_IO{ + PARAM self + PARAM x + + PRINTSTR x + + RETURN self +} +function function_out_int_at_IO{ + PARAM self + PARAM x + + PRINTINT x + + RETURN self +} +function function_in_string_at_IO{ + PARAM self + + LOCAL internal_0 + + READSTR internal_0 + + RETURN internal_0 +} +function function_in_int_at_IO{ + PARAM self + + LOCAL internal_0 + + internal_0 = ALLOCINT 0 + READINT internal_0 + + RETURN internal_0 +} +function function___init___at_String{ + PARAM self + + RETURN self +} +function function_length_at_String{ + PARAM self + + LOCAL internal_0 + + internal_0 = ALLOCINT 0 + internal_0 = LENGTH self + + RETURN internal_0 +} +function function_concat_at_String{ + PARAM self + PARAM s + + LOCAL internal_0 + + internal_0 = CONCAT self s + + RETURN internal_0 +} +function function_substr_at_String{ + PARAM self + PARAM i + PARAM l + + LOCAL internal_0 + + internal_0 = SUBSTRING self i l + + RETURN internal_0 +} +function function___init___at_Main{ + PARAM self + + RETURN self +} +function function_main_at_Main{ + PARAM self + + LOCAL internal_0 # Store an instance of the class Object + LOCAL internal_1 + LOCAL internal_2 # Integer 4 + LOCAL internal_3 # Integer 1 + LOCAL internal_4 + LOCAL internal_5 + LOCAL internal_6 # Null pointer + LOCAL internal_7 # Store if self is NULL + LOCAL internal_8 + LOCAL internal_9 # Integer 1 + LOCAL internal_10 # Integer 3 + LOCAL internal_11 + LOCAL internal_12 + LOCAL internal_13 # String "\n" + LOCAL internal_14 + + internal_0 = ALLOCATE Object # Allocate the object Object + ARG internal_0 # Pass the instance to the constructor + internal_0 = VCALL Object function___init___at_Object # Call the constructor + ARG internal_0 + internal_1 = VCALL Object function_type_name_at_Object + internal_2 = ALLOCINT 4 + internal_3 = ALLOCINT 1 + ARG internal_1 + ARG internal_2 + ARG internal_3 + internal_4 = VCALL String function_substr_at_String + ARG self + ARG internal_4 + internal_5 = VCALL Main function_out_string_at_IO + internal_7 = ALLOCBOOL 0 + internal_6 = ALLOCNULL + ARG self + ARG self + internal_7 = CALL function_equal + ARG internal_7 + internal_8 = VCALL Bool function_type_name_at_Object + internal_9 = ALLOCINT 1 + internal_10 = ALLOCINT 3 + ARG internal_8 + ARG internal_9 + ARG internal_10 + internal_11 = VCALL String function_substr_at_String + ARG internal_5 + ARG internal_11 + internal_12 = VCALL Main function_out_string_at_IO + internal_13 = ALLOCSTR "\n" + ARG self + ARG internal_13 + internal_14 = VCALL Main function_out_string_at_IO + + RETURN internal_14 +} +function main{ + + + LOCAL internal_0 + LOCAL internal_1 + + internal_0 = ALLOCATE Main + ARG internal_0 + internal_0 = VCALL Main function___init___at_Main + + ARG internal_0 + internal_1 = VCALL Main function_main_at_Main + + HALT +} \ No newline at end of file diff --git a/src/print-cool.cl b/src/print-cool.cl new file mode 100644 index 000000000..76194e966 --- /dev/null +++ b/src/print-cool.cl @@ -0,0 +1,9 @@ +class Main inherits IO { + main() : IO { + { + out_string((new Object).type_name().substr(4,1)). + out_string((isvoid self).type_name().substr(1,3)); -- demonstrates the dispatch rules. + out_string("\n"); + } + }; +}; diff --git a/src/sort-list.asm b/src/sort-list.asm new file mode 100644 index 000000000..927fa3208 --- /dev/null +++ b/src/sort-list.asm @@ -0,0 +1,3736 @@ +.data + type_Object: .word 8 + type_Object_inherits_from: .word 0 + type_Object_attributes: .word 0 + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO: .word 8 + type_IO_inherits_from: .word type_Object + type_IO_attributes: .word 0 + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_Int: .word 8 + type_Int_inherits_from: .word type_Object + type_Int_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_String: .word 8 + type_String_inherits_from: .word type_Object + type_String_attributes: .word 0 + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Bool: .word 8 + type_Bool_inherits_from: .word type_Object + type_Bool_attributes: .word 0 + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_List: .word 8 + type_List_inherits_from: .word type_IO + type_List_attributes: .word 0 + type_List_name_size: .word 4 + type_List_name: .asciiz "List" + + type_Cons: .word 16 + type_Cons_inherits_from: .word type_List + type_Cons_attributes: .word 2 + type_Cons_name_size: .word 4 + type_Cons_name: .asciiz "Cons" + + type_Nil: .word 8 + type_Nil_inherits_from: .word type_List + type_Nil_attributes: .word 0 + type_Nil_name_size: .word 3 + type_Nil_name: .asciiz "Nil" + + type_Main: .word 12 + type_Main_inherits_from: .word type_IO + type_Main_attributes: .word 1 + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_0 = address of allocated object Int + + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_5 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_6 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_7 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_8 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_9 = address of allocated object Int + + # internal_7 = EqualAddress(internal_3, internal_4) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_8 = EqualAddress(internal_3, internal_5) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_9 = EqualAddress(internal_3, internal_6) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_7 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_8 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_9 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 44($sp) + lw $t0, 8($t0) + lw $t1, 40($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 36($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 44($sp) + lw $t1, 40($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 36($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 36($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 36($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_2[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_2 = "\n" + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_type_name_at_Object + jal function_type_name_at_Object + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 12($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) # $t0 = internal_3 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string internal_3 + li $v0, 4 + move $a0, $t0 + syscall + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 12($t1) # $t1 = length of the name of self + la $t3, 16($t1) # $t1 = name of self + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t4, $v0, 0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t3, $t3, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $v0, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the string x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lb $t1, buffer_input($t0) # Loading the byte + beq $t1, $zero, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lb $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + lw $t0, 0($sp) + sw $t1, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 8($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 8($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 + lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) + lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bgt $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # self = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # self = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_List: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_isNil_at_List: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_abort_at_Object + jal function_abort_at_Object + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function_abort_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_1 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_cons_at_List: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + # hd = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + # Allocating Cons + li $v0, 9 + lw $a0, type_Cons + syscall + la $t0, type_Cons # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_1 = address of allocated object Cons + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_Cons + jal function___init___at_Cons + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_1 = result of function___init___at_Cons + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument new_cell + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing new_cell + + # Argument internal_1 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 20($sp) # new_cell = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument new_cell + lw $t0, 24($sp) + sw $t0, 8($sp) # Storing new_cell + + # Argument hd + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing hd + + # Argument self + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_init_at_Cons + jal function_init_at_Cons + lw $ra, 12($sp) + sw $v1, 16($sp) # internal_2 = result of function_init_at_Cons + addi $sp, $sp, 16 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + function_car_at_List: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_abort_at_Object + jal function_abort_at_Object + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function_abort_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int + li $v0, 9 + lw $a0, type_Int + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 0($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 8($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_Int + jal function___init___at_Int + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function___init___at_Int + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_cdr_at_List: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_abort_at_Object + jal function_abort_at_Object + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function_abort_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating List + li $v0, 9 + lw $a0, type_List + syscall + la $t0, type_List # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 0($sp) # internal_1 = address of allocated object List + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 8($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_List + jal function___init___at_List + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function___init___at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_rev_at_List: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_cdr_at_List + jal function_cdr_at_List + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_0 = result of function_cdr_at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sort_at_List: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_cdr_at_List + jal function_cdr_at_List + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_0 = result of function_cdr_at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_insert_at_List: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # i = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_cdr_at_List + jal function_cdr_at_List + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_0 = result of function_cdr_at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_rcons_at_List: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # i = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_cdr_at_List + jal function_cdr_at_List + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_0 = result of function_cdr_at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_print_list_at_List: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_abort_at_Object + jal function_abort_at_Object + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_0 = result of function_abort_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Cons: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_0 = address of allocated object Int + + # Set attribute xcar of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8750086222246 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8750086222246 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8750086222246 + j object_set_attribute_8750086222246 + int_set_attribute_8750086222246: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.xcar = internal_0 + j end_set_attribute_8750086222246 + bool_set_attribute_8750086222246: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.xcar = internal_0 + j end_set_attribute_8750086222246 + object_set_attribute_8750086222246: + sw $t1, 8($t0) # self.xcar = internal_0 + end_set_attribute_8750086222246: + + # Allocating NUll to internal_1 + sw $zero, 0($sp) # internal_1 = 0 + + # Set attribute xcdr of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8750086222267 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8750086222267 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8750086222267 + j object_set_attribute_8750086222267 + int_set_attribute_8750086222267: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.xcdr = internal_1 + j end_set_attribute_8750086222267 + bool_set_attribute_8750086222267: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.xcdr = internal_1 + j end_set_attribute_8750086222267 + object_set_attribute_8750086222267: + sw $t1, 12($t0) # self.xcdr = internal_1 + end_set_attribute_8750086222267: + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_isNil_at_Cons: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_init_at_Cons: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # hd = 4($sp) + # tl = 0($sp) + + # Set attribute xcar of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = hd + beq $t1, $zero, object_set_attribute_8750086190608 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8750086190608 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8750086190608 + j object_set_attribute_8750086190608 + int_set_attribute_8750086190608: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.xcar = hd + j end_set_attribute_8750086190608 + bool_set_attribute_8750086190608: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.xcar = hd + j end_set_attribute_8750086190608 + object_set_attribute_8750086190608: + sw $t1, 8($t0) # self.xcar = hd + end_set_attribute_8750086190608: + + # Set attribute xcdr of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = tl + beq $t1, $zero, object_set_attribute_8750086190617 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8750086190617 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8750086190617 + j object_set_attribute_8750086190617 + int_set_attribute_8750086190617: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.xcdr = tl + j end_set_attribute_8750086190617 + bool_set_attribute_8750086190617: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.xcdr = tl + j end_set_attribute_8750086190617 + object_set_attribute_8750086190617: + sw $t1, 12($t0) # self.xcdr = tl + end_set_attribute_8750086190617: + + # Loading return value in $v1 + lw $v1, 8($sp) + + jr $ra + + function_car_at_Cons: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute xcar of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8750086190629 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8750086190629 + j object_get_attribute_8750086190629 + int_get_attribute_8750086190629: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.xcar + j end_get_attribute_8750086190629 + bool_get_attribute_8750086190629: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.xcar + j end_get_attribute_8750086190629 + object_get_attribute_8750086190629: + sw $t1, 0($sp) # internal_0 = xcar + end_get_attribute_8750086190629: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_cdr_at_Cons: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute xcdr of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'xcdr' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8750086211368 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8750086211368 + j object_get_attribute_8750086211368 + int_get_attribute_8750086211368: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.xcdr + j end_get_attribute_8750086211368 + bool_get_attribute_8750086211368: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.xcdr + j end_get_attribute_8750086211368 + object_get_attribute_8750086211368: + sw $t1, 0($sp) # internal_0 = xcdr + end_get_attribute_8750086211368: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_rev_at_Cons: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Get attribute xcdr of self + lw $t0, 16($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'xcdr' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8750086210618 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8750086210618 + j object_get_attribute_8750086210618 + int_get_attribute_8750086210618: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.xcdr + j end_get_attribute_8750086210618 + bool_get_attribute_8750086210618: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.xcdr + j end_get_attribute_8750086210618 + object_get_attribute_8750086210618: + sw $t1, 12($sp) # internal_0 = xcdr + end_get_attribute_8750086210618: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_rev_at_List + jal function_rev_at_List + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_rev_at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute xcar of self + lw $t0, 16($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8750086210621 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8750086210621 + j object_get_attribute_8750086210621 + int_get_attribute_8750086210621: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_2 = self.xcar + j end_get_attribute_8750086210621 + bool_get_attribute_8750086210621: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_2 = self.xcar + j end_get_attribute_8750086210621 + object_get_attribute_8750086210621: + sw $t1, 4($sp) # internal_2 = xcar + end_get_attribute_8750086210621: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_rcons_at_List + jal function_rcons_at_List + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_rcons_at_List + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_sort_at_Cons: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Get attribute xcdr of self + lw $t0, 16($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'xcdr' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8750086210564 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8750086210564 + j object_get_attribute_8750086210564 + int_get_attribute_8750086210564: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.xcdr + j end_get_attribute_8750086210564 + bool_get_attribute_8750086210564: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.xcdr + j end_get_attribute_8750086210564 + object_get_attribute_8750086210564: + sw $t1, 12($sp) # internal_0 = xcdr + end_get_attribute_8750086210564: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_sort_at_List + jal function_sort_at_List + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_sort_at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute xcar of self + lw $t0, 16($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8750086208618 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8750086208618 + j object_get_attribute_8750086208618 + int_get_attribute_8750086208618: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_2 = self.xcar + j end_get_attribute_8750086208618 + bool_get_attribute_8750086208618: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_2 = self.xcar + j end_get_attribute_8750086208618 + object_get_attribute_8750086208618: + sw $t1, 4($sp) # internal_2 = xcar + end_get_attribute_8750086208618: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_insert_at_List + jal function_insert_at_List + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_insert_at_List + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_insert_at_Cons: + # Function parameters + # $ra = 52($sp) + # self = 48($sp) + # i = 44($sp) + + # Reserving space for local variables + addi $sp, $sp, -44 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_1 = address of allocated object Int + + # Get attribute xcar of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8750086208690 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8750086208690 + j object_get_attribute_8750086208690 + int_get_attribute_8750086208690: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_2 = self.xcar + j end_get_attribute_8750086208690 + bool_get_attribute_8750086208690: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_2 = self.xcar + j end_get_attribute_8750086208690 + object_get_attribute_8750086208690: + sw $t1, 32($sp) # internal_2 = xcar + end_get_attribute_8750086208690: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_2 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_3 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_3 + lw $t0, 28($sp) + sw $t0, 36($sp) + + # If internal_1 then goto then_8750086234655 + lw $t0, 36($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8750086234655 + + # Jumping to else_8750086234655 + j else_8750086234655 + + then_8750086234655: + + # Allocating Cons + li $v0, 9 + lw $a0, type_Cons + syscall + la $t0, type_Cons # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 24($sp) # internal_4 = address of allocated object Cons + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_4 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function___init___at_Cons + jal function___init___at_Cons + lw $ra, 4($sp) + sw $v1, 32($sp) # internal_4 = result of function___init___at_Cons + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_4 + lw $t0, 40($sp) + sw $t0, 8($sp) # Storing internal_4 + + # Argument i + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing i + + # Argument self + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_init_at_Cons + jal function_init_at_Cons + lw $ra, 12($sp) + sw $v1, 36($sp) # internal_5 = result of function_init_at_Cons + addi $sp, $sp, 16 # Freeing space for arguments + + # internal_0 = internal_5 + lw $t0, 20($sp) + sw $t0, 40($sp) + + # Jumping to endif_8750086234655 + j endif_8750086234655 + + else_8750086234655: + + # Allocating Cons + li $v0, 9 + lw $a0, type_Cons + syscall + la $t0, type_Cons # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 16($sp) # internal_6 = address of allocated object Cons + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_6 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function___init___at_Cons + jal function___init___at_Cons + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_6 = result of function___init___at_Cons + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute xcar of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8750086210058 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8750086210058 + j object_get_attribute_8750086210058 + int_get_attribute_8750086210058: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_7 = self.xcar + j end_get_attribute_8750086210058 + bool_get_attribute_8750086210058: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_7 = self.xcar + j end_get_attribute_8750086210058 + object_get_attribute_8750086210058: + sw $t1, 12($sp) # internal_7 = xcar + end_get_attribute_8750086210058: + + # Get attribute xcdr of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'xcdr' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8750086207735 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8750086207735 + j object_get_attribute_8750086207735 + int_get_attribute_8750086207735: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_8 = self.xcdr + j end_get_attribute_8750086207735 + bool_get_attribute_8750086207735: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_8 = self.xcdr + j end_get_attribute_8750086207735 + object_get_attribute_8750086207735: + sw $t1, 8($sp) # internal_8 = xcdr + end_get_attribute_8750086207735: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_8 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument i + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing i + + # Calling function function_insert_at_List + jal function_insert_at_List + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_9 = result of function_insert_at_List + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_6 + lw $t0, 32($sp) + sw $t0, 8($sp) # Storing internal_6 + + # Argument internal_7 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_7 + + # Argument internal_9 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_init_at_Cons + jal function_init_at_Cons + lw $ra, 12($sp) + sw $v1, 16($sp) # internal_10 = result of function_init_at_Cons + addi $sp, $sp, 16 # Freeing space for arguments + + # internal_0 = internal_10 + lw $t0, 0($sp) + sw $t0, 40($sp) + + # Jumping to endif_8750086234655 + j endif_8750086234655 + + endif_8750086234655: + + # Loading return value in $v1 + lw $v1, 40($sp) + + # Freeing space for local variables + addi $sp, $sp, 44 + + jr $ra + + function_rcons_at_Cons: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + # i = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # Allocating Cons + li $v0, 9 + lw $a0, type_Cons + syscall + la $t0, type_Cons # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 16($sp) # internal_0 = address of allocated object Cons + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Cons + jal function___init___at_Cons + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_0 = result of function___init___at_Cons + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute xcar of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8750086190746 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8750086190746 + j object_get_attribute_8750086190746 + int_get_attribute_8750086190746: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_1 = self.xcar + j end_get_attribute_8750086190746 + bool_get_attribute_8750086190746: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_1 = self.xcar + j end_get_attribute_8750086190746 + object_get_attribute_8750086190746: + sw $t1, 12($sp) # internal_1 = xcar + end_get_attribute_8750086190746: + + # Get attribute xcdr of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'xcdr' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8750086190770 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8750086190770 + j object_get_attribute_8750086190770 + int_get_attribute_8750086190770: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_2 = self.xcdr + j end_get_attribute_8750086190770 + bool_get_attribute_8750086190770: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_2 = self.xcdr + j end_get_attribute_8750086190770 + object_get_attribute_8750086190770: + sw $t1, 8($sp) # internal_2 = xcdr + end_get_attribute_8750086190770: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument i + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing i + + # Calling function function_rcons_at_List + jal function_rcons_at_List + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_3 = result of function_rcons_at_List + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 8($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_init_at_Cons + jal function_init_at_Cons + lw $ra, 12($sp) + sw $v1, 16($sp) # internal_4 = result of function_init_at_Cons + addi $sp, $sp, 16 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 20 + + jr $ra + + function_print_list_at_Cons: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Get attribute xcar of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8750086190861 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8750086190861 + j object_get_attribute_8750086190861 + int_get_attribute_8750086190861: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_0 = self.xcar + j end_get_attribute_8750086190861 + bool_get_attribute_8750086190861: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_0 = self.xcar + j end_get_attribute_8750086190861 + object_get_attribute_8750086190861: + sw $t1, 20($sp) # internal_0 = xcar + end_get_attribute_8750086190861: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_out_int_at_IO + jal function_out_int_at_IO + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_1 = result of function_out_int_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_2[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_2 = "\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_3 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute xcdr of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'xcdr' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8750086190930 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8750086190930 + j object_get_attribute_8750086190930 + int_get_attribute_8750086190930: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_4 = self.xcdr + j end_get_attribute_8750086190930 + bool_get_attribute_8750086190930: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_4 = self.xcdr + j end_get_attribute_8750086190930 + object_get_attribute_8750086190930: + sw $t1, 4($sp) # internal_4 = xcdr + end_get_attribute_8750086190930: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_4 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_print_list_at_List + jal function_print_list_at_List + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_5 = result of function_print_list_at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function___init___at_Nil: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_isNil_at_Nil: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_rev_at_Nil: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_sort_at_Nil: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_insert_at_Nil: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # i = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing self + + # Argument i + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing i + + # Calling function function_rcons_at_Nil + jal function_rcons_at_Nil + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_0 = result of function_rcons_at_Nil + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_rcons_at_Nil: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Cons + li $v0, 9 + lw $a0, type_Cons + syscall + la $t0, type_Cons # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object Cons + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Cons + jal function___init___at_Cons + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_Cons + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 8($sp) # Storing internal_0 + + # Argument i + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing i + + # Argument self + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_init_at_Cons + jal function_init_at_Cons + lw $ra, 12($sp) + sw $v1, 16($sp) # internal_1 = result of function_init_at_Cons + addi $sp, $sp, 16 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_print_list_at_Nil: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating NUll to internal_0 + sw $zero, 0($sp) # internal_0 = 0 + + # Set attribute l of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8750086191734 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8750086191734 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8750086191734 + j object_set_attribute_8750086191734 + int_set_attribute_8750086191734: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.l = internal_0 + j end_set_attribute_8750086191734 + bool_set_attribute_8750086191734: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.l = internal_0 + j end_set_attribute_8750086191734 + object_set_attribute_8750086191734: + sw $t1, 8($t0) # self.l = internal_0 + end_set_attribute_8750086191734: + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_iota_at_Main: + # Function parameters + # $ra = 48($sp) + # self = 44($sp) + # i = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating Nil + li $v0, 9 + lw $a0, type_Nil + syscall + la $t0, type_Nil # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 36($sp) # internal_0 = address of allocated object Nil + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Nil + jal function___init___at_Nil + lw $ra, 4($sp) + sw $v1, 44($sp) # internal_0 = result of function___init___at_Nil + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute l of self + lw $t0, 44($sp) # $t0 = self + lw $t1, 36($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8750086191779 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8750086191779 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8750086191779 + j object_set_attribute_8750086191779 + int_set_attribute_8750086191779: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.l = internal_0 + j end_set_attribute_8750086191779 + bool_set_attribute_8750086191779: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.l = internal_0 + j end_set_attribute_8750086191779 + object_set_attribute_8750086191779: + sw $t1, 8($t0) # self.l = internal_0 + end_set_attribute_8750086191779: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument j + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing j + + # Argument internal_2 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 44($sp) # j = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + while_start_8750086235432: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument j + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing j + + # Argument i + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing i + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_3 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_3 then goto while_body_8750086235432 + lw $t0, 24($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8750086235432 + + # Jumping to while_end_8750086235432 + j while_end_8750086235432 + + while_body_8750086235432: + + # Allocating Cons + li $v0, 9 + lw $a0, type_Cons + syscall + la $t0, type_Cons # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 20($sp) # internal_4 = address of allocated object Cons + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_4 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function___init___at_Cons + jal function___init___at_Cons + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_4 = result of function___init___at_Cons + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute l of self + lw $t0, 44($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'l' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8750086190222 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8750086190222 + j object_get_attribute_8750086190222 + int_get_attribute_8750086190222: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_5 = self.l + j end_get_attribute_8750086190222 + bool_get_attribute_8750086190222: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_5 = self.l + j end_get_attribute_8750086190222 + object_get_attribute_8750086190222: + sw $t1, 16($sp) # internal_5 = l + end_get_attribute_8750086190222: + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_4 + lw $t0, 36($sp) + sw $t0, 8($sp) # Storing internal_4 + + # Argument j + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing j + + # Argument internal_5 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_init_at_Cons + jal function_init_at_Cons + lw $ra, 12($sp) + sw $v1, 28($sp) # internal_6 = result of function_init_at_Cons + addi $sp, $sp, 16 # Freeing space for arguments + + # Set attribute l of self + lw $t0, 44($sp) # $t0 = self + lw $t1, 12($sp) # $t1 = internal_6 + beq $t1, $zero, object_set_attribute_8750086190171 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8750086190171 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8750086190171 + j object_set_attribute_8750086190171 + int_set_attribute_8750086190171: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.l = internal_6 + j end_set_attribute_8750086190171 + bool_set_attribute_8750086190171: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.l = internal_6 + j end_set_attribute_8750086190171 + object_set_attribute_8750086190171: + sw $t1, 8($t0) # self.l = internal_6 + end_set_attribute_8750086190171: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument j + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing j + + # Argument internal_7 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_8 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument j + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing j + + # Argument internal_8 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 44($sp) # j = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to while_start_8750086235432 + j while_start_8750086235432 + + while_end_8750086235432: + + # Get attribute l of self + lw $t0, 44($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'l' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8750086191854 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8750086191854 + j object_get_attribute_8750086191854 + int_get_attribute_8750086191854: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_9 = self.l + j end_get_attribute_8750086191854 + bool_get_attribute_8750086191854: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_9 = self.l + j end_get_attribute_8750086191854 + object_get_attribute_8750086191854: + sw $t1, 0($sp) # internal_9 = l + end_get_attribute_8750086191854: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 32($sp) + # self = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 35 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 35 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 72 + sb $t0, 8($v0) # internal_0[0] = 'H' + + addi $t0, $zero, 111 + sb $t0, 9($v0) # internal_0[1] = 'o' + + addi $t0, $zero, 119 + sb $t0, 10($v0) # internal_0[2] = 'w' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_0[3] = ' ' + + addi $t0, $zero, 109 + sb $t0, 12($v0) # internal_0[4] = 'm' + + addi $t0, $zero, 97 + sb $t0, 13($v0) # internal_0[5] = 'a' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_0[6] = 'n' + + addi $t0, $zero, 121 + sb $t0, 15($v0) # internal_0[7] = 'y' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_0[8] = ' ' + + addi $t0, $zero, 110 + sb $t0, 17($v0) # internal_0[9] = 'n' + + addi $t0, $zero, 117 + sb $t0, 18($v0) # internal_0[10] = 'u' + + addi $t0, $zero, 109 + sb $t0, 19($v0) # internal_0[11] = 'm' + + addi $t0, $zero, 98 + sb $t0, 20($v0) # internal_0[12] = 'b' + + addi $t0, $zero, 101 + sb $t0, 21($v0) # internal_0[13] = 'e' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 115 + sb $t0, 23($v0) # internal_0[15] = 's' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_0[16] = ' ' + + addi $t0, $zero, 116 + sb $t0, 25($v0) # internal_0[17] = 't' + + addi $t0, $zero, 111 + sb $t0, 26($v0) # internal_0[18] = 'o' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_0[19] = ' ' + + addi $t0, $zero, 115 + sb $t0, 28($v0) # internal_0[20] = 's' + + addi $t0, $zero, 111 + sb $t0, 29($v0) # internal_0[21] = 'o' + + addi $t0, $zero, 114 + sb $t0, 30($v0) # internal_0[22] = 'r' + + addi $t0, $zero, 116 + sb $t0, 31($v0) # internal_0[23] = 't' + + addi $t0, $zero, 63 + sb $t0, 32($v0) # internal_0[24] = '?' + + addi $t0, $zero, 32 + sb $t0, 33($v0) # internal_0[25] = ' ' + + sb $zero, 34($v0) # Null-terminator at the end of the string + + sw $v0, 24($sp) # internal_0 = "How many numbers to sort? " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_1 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_in_int_at_IO + jal function_in_int_at_IO + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_2 = result of function_in_int_at_IO + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_2 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_iota_at_Main + jal function_iota_at_Main + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_3 = result of function_iota_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_rev_at_List + jal function_rev_at_List + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_4 = result of function_rev_at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_sort_at_List + jal function_sort_at_List + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_5 = result of function_sort_at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_5 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_print_list_at_List + jal function_print_list_at_List + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_6 = result of function_print_list_at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_main_at_Main + jal function_main_at_Main + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/src/sort-list.cil b/src/sort-list.cil new file mode 100644 index 000000000..7ea699b0f --- /dev/null +++ b/src/sort-list.cil @@ -0,0 +1,940 @@ +.TYPES +type Object { + inherits from null + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method __init__: function___init___at_Object +} +type IO { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method out_string: function_out_string_at_IO + method out_int: function_out_int_at_IO + method in_string: function_in_string_at_IO + method in_int: function_in_int_at_IO + method __init__: function___init___at_IO +} +type Int { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method __init__: function___init___at_Int +} +type String { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method length: function_length_at_String + method concat: function_concat_at_String + method substr: function_substr_at_String + method __init__: function___init___at_String +} +type Bool { + inherits from Object + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method __init__: function___init___at_Bool +} +type List { + inherits from IO + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method out_string: function_out_string_at_IO + method out_int: function_out_int_at_IO + method in_string: function_in_string_at_IO + method in_int: function_in_int_at_IO + method isNil: function_isNil_at_List + method cons: function_cons_at_List + method car: function_car_at_List + method cdr: function_cdr_at_List + method rev: function_rev_at_List + method sort: function_sort_at_List + method insert: function_insert_at_List + method rcons: function_rcons_at_List + method print_list: function_print_list_at_List + method __init__: function___init___at_List +} +type Cons { + inherits from List + + attribute xcar + attribute xcdr + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method out_string: function_out_string_at_IO + method out_int: function_out_int_at_IO + method in_string: function_in_string_at_IO + method in_int: function_in_int_at_IO + method isNil: function_isNil_at_Cons + method cons: function_cons_at_List + method car: function_car_at_Cons + method cdr: function_cdr_at_Cons + method rev: function_rev_at_Cons + method sort: function_sort_at_Cons + method insert: function_insert_at_Cons + method rcons: function_rcons_at_Cons + method print_list: function_print_list_at_Cons + method __init__: function___init___at_Cons + method init: function_init_at_Cons +} +type Nil { + inherits from List + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method out_string: function_out_string_at_IO + method out_int: function_out_int_at_IO + method in_string: function_in_string_at_IO + method in_int: function_in_int_at_IO + method isNil: function_isNil_at_Nil + method cons: function_cons_at_List + method car: function_car_at_List + method cdr: function_cdr_at_List + method rev: function_rev_at_Nil + method sort: function_sort_at_Nil + method insert: function_insert_at_Nil + method rcons: function_rcons_at_Nil + method print_list: function_print_list_at_Nil + method __init__: function___init___at_Nil +} +type Main { + inherits from IO + + attribute l + + method abort: function_abort_at_Object + method type_name: function_type_name_at_Object + method copy: function_copy_at_Object + method out_string: function_out_string_at_IO + method out_int: function_out_int_at_IO + method in_string: function_in_string_at_IO + method in_int: function_in_int_at_IO + method iota: function_iota_at_Main + method main: function_main_at_Main + method __init__: function___init___at_Main +} + +.DATA + + +.CODE +function function_add{ + PARAM a + PARAM b + + LOCAL internal_0 # Adding result + + internal_0 = ALLOCINT 0 + internal_0 = a + b + + RETURN internal_0 +} +function function_sub{ + PARAM a + PARAM b + + LOCAL internal_0 # Substracting result + + internal_0 = ALLOCINT 0 + internal_0 = a - b + + RETURN internal_0 +} +function function_mult{ + PARAM a + PARAM b + + LOCAL internal_0 # Multiting result + + internal_0 = ALLOCINT 0 + internal_0 = a * b + + RETURN internal_0 +} +function function_div{ + PARAM a + PARAM b + + LOCAL internal_0 # Dividing result + + internal_0 = ALLOCINT 0 + internal_0 = a / b + + RETURN internal_0 +} +function function_xor{ + PARAM a + PARAM b + + LOCAL internal_0 # Xor result + + internal_0 = ALLOCINT 0 + internal_0 = XOR a b + + RETURN internal_0 +} +function function_less_than{ + PARAM a + PARAM b + + LOCAL internal_0 # Less than result + + internal_0 = ALLOCBOOL 0 + internal_0 = a < b + + RETURN internal_0 +} +function function_less_than_or_equal{ + PARAM a + PARAM b + + LOCAL internal_0 # Less than or equal result + + internal_0 = ALLOCBOOL 0 + internal_0 = a <= b + + RETURN internal_0 +} +function function_equal{ + PARAM a + PARAM b + + LOCAL internal_0 # Equal result + LOCAL internal_1 # Null Pointer + LOCAL internal_2 # One of params is null + LOCAL internal_3 # Type of a + LOCAL internal_4 # Type Int + LOCAL internal_5 # Type Bool + LOCAL internal_6 # Type String + LOCAL internal_7 # Type of a equals int + LOCAL internal_8 # Type of a equals bool + LOCAL internal_9 # Type of a equals string + + internal_0 = ALLOCBOOL 0 + internal_1 = ALLOCNULL + internal_2 = ALLOCBOOL 0 + internal_2 = EQUALADDR a internal_1 + internal_2 = EQUALADDR b internal_1 + IF internal_2 GOTO a_is_type_object + internal_3 = TYPEOF a + internal_4 = TYPEADDR Int + internal_5 = TYPEADDR Bool + internal_6 = TYPEADDR String + internal_7 = ALLOCBOOL 0 + internal_8 = ALLOCBOOL 0 + internal_9 = ALLOCBOOL 0 + internal_7 = EQUALADDR internal_3 internal_4 + internal_8 = EQUALADDR internal_3 internal_5 + internal_9 = EQUALADDR internal_3 internal_6 + + IF internal_7 GOTO a_is_type_int_or_bool + IF internal_8 GOTO a_is_type_int_or_bool + IF internal_9 GOTO a_is_type_string + GOTO a_is_type_object + + a_is_type_int_or_bool: + internal_0 = EQUALINT a b + GOTO end_of_equal + + a_is_type_string: + internal_0 = EQUALSTR a b + GOTO end_of_equal + + a_is_type_object: + internal_0 = a == b + GOTO end_of_equal + + end_of_equal: + + RETURN internal_0 +} +function function_assign{ + PARAM dest + PARAM source + + LOCAL internal_0 # Null Pointer + LOCAL internal_1 # One of params is null + LOCAL internal_2 # Type of source + LOCAL internal_3 # Type Int + LOCAL internal_4 # Type Bool + LOCAL internal_5 # Type of source equals int + LOCAL internal_6 # Type of source equals bool + + internal_0 = ALLOCNULL + internal_1 = ALLOCBOOL 0 + internal_1 = EQUALADDR source internal_0 + internal_1 = EQUALADDR dest internal_0 + IF internal_1 GOTO source_is_type_object + internal_2 = TYPEOF source + internal_3 = TYPEADDR Int + internal_4 = TYPEADDR Bool + internal_5 = ALLOCBOOL 0 + internal_6 = ALLOCBOOL 0 + internal_5 = EQUALADDR internal_2 internal_3 + internal_6 = EQUALADDR internal_2 internal_4 + + IF internal_5 GOTO source_is_type_int_or_bool + IF internal_6 GOTO source_is_type_int_or_bool + GOTO source_is_type_object + + source_is_type_int_or_bool: + dest = INT source + GOTO source_end_of_equal + + source_is_type_object: + dest = source + GOTO source_end_of_equal + + source_end_of_equal: + + RETURN dest +} +function function___init___at_Object{ + PARAM self + + RETURN self +} +function function_abort_at_Object{ + PARAM self + + LOCAL internal_0 + LOCAL internal_1 + LOCAL internal_2 + LOCAL internal_3 + + internal_0 = ALLOCSTR "Abort called from class " + internal_2 = ALLOCSTR "\n" + ARG self + internal_1 = VCALL String function_type_name_at_Object + ARG internal_0 + ARG internal_1 + internal_3 = VCALL String function_concat_at_String + ARG internal_3 + ARG internal_2 + internal_3 = VCALL String function_concat_at_String + PRINTSTR internal_3 + HALT + + RETURN self +} +function function_type_name_at_Object{ + PARAM self + + LOCAL internal_0 # type_name + + internal_0 = TYPENAME self + + RETURN internal_0 +} +function function_copy_at_Object{ + PARAM self + + LOCAL internal_0 + + internal_0 = COPY self + + RETURN internal_0 +} +function function___init___at_IO{ + PARAM self + + RETURN self +} +function function_out_string_at_IO{ + PARAM self + PARAM x + + PRINTSTR x + + RETURN self +} +function function_out_int_at_IO{ + PARAM self + PARAM x + + PRINTINT x + + RETURN self +} +function function_in_string_at_IO{ + PARAM self + + LOCAL internal_0 + + READSTR internal_0 + + RETURN internal_0 +} +function function_in_int_at_IO{ + PARAM self + + LOCAL internal_0 + + internal_0 = ALLOCINT 0 + READINT internal_0 + + RETURN internal_0 +} +function function___init___at_String{ + PARAM self + + RETURN self +} +function function_length_at_String{ + PARAM self + + LOCAL internal_0 + + internal_0 = ALLOCINT 0 + internal_0 = LENGTH self + + RETURN internal_0 +} +function function_concat_at_String{ + PARAM self + PARAM s + + LOCAL internal_0 + + internal_0 = CONCAT self s + + RETURN internal_0 +} +function function_substr_at_String{ + PARAM self + PARAM i + PARAM l + + LOCAL internal_0 + + internal_0 = SUBSTRING self i l + + RETURN internal_0 +} +function function___init___at_Int{ + PARAM self + + self = ALLOCINT 0 + + RETURN self +} +function function___init___at_Bool{ + PARAM self + + self = ALLOCBOOL 0 + + RETURN self +} +function function___init___at_List{ + PARAM self + + RETURN self +} +function function_isNil_at_List{ + PARAM self + + LOCAL internal_0 + LOCAL internal_1 # Boolean true + + ARG self + internal_0 = VCALL List function_abort_at_Object + internal_1 = ALLOCBOOL 1 + + RETURN internal_1 +} +function function_cons_at_List{ + PARAM self + PARAM hd + + LOCAL new_cell + LOCAL internal_1 # Store an instance of the class Cons + LOCAL internal_2 + + # Let new_cell: Cons + + internal_1 = ALLOCATE Cons # Allocate the object Cons + ARG internal_1 # Pass the instance to the constructor + internal_1 = VCALL Cons function___init___at_Cons # Call the constructor + ARG new_cell + ARG internal_1 + new_cell = CALL function_assign + ARG new_cell + ARG hd + ARG self + internal_2 = VCALL Cons function_init_at_Cons + + RETURN internal_2 +} +function function_car_at_List{ + PARAM self + + LOCAL internal_0 + LOCAL internal_1 # Store an instance of the class Int + + ARG self + internal_0 = VCALL List function_abort_at_Object + internal_1 = ALLOCATE Int # Allocate the object Int + ARG internal_1 # Pass the instance to the constructor + internal_1 = VCALL Int function___init___at_Int # Call the constructor + + RETURN internal_1 +} +function function_cdr_at_List{ + PARAM self + + LOCAL internal_0 + LOCAL internal_1 # Store an instance of the class List + + ARG self + internal_0 = VCALL List function_abort_at_Object + internal_1 = ALLOCATE List # Allocate the object List + ARG internal_1 # Pass the instance to the constructor + internal_1 = VCALL List function___init___at_List # Call the constructor + + RETURN internal_1 +} +function function_rev_at_List{ + PARAM self + + LOCAL internal_0 + + ARG self + internal_0 = VCALL List function_cdr_at_List + + RETURN internal_0 +} +function function_sort_at_List{ + PARAM self + + LOCAL internal_0 + + ARG self + internal_0 = VCALL List function_cdr_at_List + + RETURN internal_0 +} +function function_insert_at_List{ + PARAM self + PARAM i + + LOCAL internal_0 + + ARG self + internal_0 = VCALL List function_cdr_at_List + + RETURN internal_0 +} +function function_rcons_at_List{ + PARAM self + PARAM i + + LOCAL internal_0 + + ARG self + internal_0 = VCALL List function_cdr_at_List + + RETURN internal_0 +} +function function_print_list_at_List{ + PARAM self + + LOCAL internal_0 + + ARG self + internal_0 = VCALL List function_abort_at_Object + + RETURN internal_0 +} +function function___init___at_Cons{ + PARAM self + + LOCAL internal_0 # Integer 0 + LOCAL internal_1 # Null + + internal_0 = ALLOCINT 0 + + SETATTR self xcar internal_0 + internal_1 = ALLOCNULL + + SETATTR self xcdr internal_1 + + RETURN self +} +function function_isNil_at_Cons{ + PARAM self + + LOCAL internal_0 # Boolean false + + internal_0 = ALLOCBOOL 0 + + RETURN internal_0 +} +function function_init_at_Cons{ + PARAM self + PARAM hd + PARAM tl + + + SETATTR self xcar hd + + SETATTR self xcdr tl + + RETURN self +} +function function_car_at_Cons{ + PARAM self + + LOCAL internal_0 + + internal_0 = GETATTR self xcar + + RETURN internal_0 +} +function function_cdr_at_Cons{ + PARAM self + + LOCAL internal_0 + + internal_0 = GETATTR self xcdr + + RETURN internal_0 +} +function function_rev_at_Cons{ + PARAM self + + LOCAL internal_0 + LOCAL internal_1 + LOCAL internal_2 + LOCAL internal_3 + + internal_0 = GETATTR self xcdr + ARG internal_0 + internal_1 = VCALL List function_rev_at_List + internal_2 = GETATTR self xcar + ARG internal_1 + ARG internal_2 + internal_3 = VCALL List function_rcons_at_List + + RETURN internal_3 +} +function function_sort_at_Cons{ + PARAM self + + LOCAL internal_0 + LOCAL internal_1 + LOCAL internal_2 + LOCAL internal_3 + + internal_0 = GETATTR self xcdr + ARG internal_0 + internal_1 = VCALL List function_sort_at_List + internal_2 = GETATTR self xcar + ARG internal_1 + ARG internal_2 + internal_3 = VCALL List function_insert_at_List + + RETURN internal_3 +} +function function_insert_at_Cons{ + PARAM self + PARAM i + + LOCAL internal_0 + LOCAL internal_1 + LOCAL internal_2 + LOCAL internal_3 # Store the result of the operation function_less_than + LOCAL internal_4 # Store an instance of the class Cons + LOCAL internal_5 + LOCAL internal_6 # Store an instance of the class Cons + LOCAL internal_7 + LOCAL internal_8 + LOCAL internal_9 + LOCAL internal_10 + + # Conditional + internal_1 = ALLOCBOOL 0 + internal_2 = GETATTR self xcar + + ARG i + ARG internal_2 + internal_3 = CALL function_less_than + internal_1 = internal_3 + IF internal_1 GOTO then_8750086234655 + GOTO else_8750086234655 + + then_8750086234655: + internal_4 = ALLOCATE Cons # Allocate the object Cons + ARG internal_4 # Pass the instance to the constructor + internal_4 = VCALL Cons function___init___at_Cons # Call the constructor + ARG internal_4 + ARG i + ARG self + internal_5 = VCALL Cons function_init_at_Cons + internal_0 = internal_5 + GOTO endif_8750086234655 + + else_8750086234655: + internal_6 = ALLOCATE Cons # Allocate the object Cons + ARG internal_6 # Pass the instance to the constructor + internal_6 = VCALL Cons function___init___at_Cons # Call the constructor + internal_7 = GETATTR self xcar + internal_8 = GETATTR self xcdr + ARG internal_8 + ARG i + internal_9 = VCALL List function_insert_at_List + ARG internal_6 + ARG internal_7 + ARG internal_9 + internal_10 = VCALL Cons function_init_at_Cons + internal_0 = internal_10 + GOTO endif_8750086234655 + + endif_8750086234655: + + RETURN internal_0 +} +function function_rcons_at_Cons{ + PARAM self + PARAM i + + LOCAL internal_0 # Store an instance of the class Cons + LOCAL internal_1 + LOCAL internal_2 + LOCAL internal_3 + LOCAL internal_4 + + internal_0 = ALLOCATE Cons # Allocate the object Cons + ARG internal_0 # Pass the instance to the constructor + internal_0 = VCALL Cons function___init___at_Cons # Call the constructor + internal_1 = GETATTR self xcar + internal_2 = GETATTR self xcdr + ARG internal_2 + ARG i + internal_3 = VCALL List function_rcons_at_List + ARG internal_0 + ARG internal_1 + ARG internal_3 + internal_4 = VCALL Cons function_init_at_Cons + + RETURN internal_4 +} +function function_print_list_at_Cons{ + PARAM self + + LOCAL internal_0 + LOCAL internal_1 + LOCAL internal_2 # String "\n" + LOCAL internal_3 + LOCAL internal_4 + LOCAL internal_5 + + internal_0 = GETATTR self xcar + ARG self + ARG internal_0 + internal_1 = VCALL Cons function_out_int_at_IO + internal_2 = ALLOCSTR "\n" + ARG self + ARG internal_2 + internal_3 = VCALL Cons function_out_string_at_IO + internal_4 = GETATTR self xcdr + ARG internal_4 + internal_5 = VCALL List function_print_list_at_List + + RETURN internal_5 +} +function function___init___at_Nil{ + PARAM self + + RETURN self +} +function function_isNil_at_Nil{ + PARAM self + + LOCAL internal_0 # Boolean true + + internal_0 = ALLOCBOOL 1 + + RETURN internal_0 +} +function function_rev_at_Nil{ + PARAM self + + RETURN self +} +function function_sort_at_Nil{ + PARAM self + + RETURN self +} +function function_insert_at_Nil{ + PARAM self + PARAM i + + LOCAL internal_0 + + ARG self + ARG i + internal_0 = VCALL Nil function_rcons_at_Nil + + RETURN internal_0 +} +function function_rcons_at_Nil{ + PARAM self + PARAM i + + LOCAL internal_0 # Store an instance of the class Cons + LOCAL internal_1 + + internal_0 = ALLOCATE Cons # Allocate the object Cons + ARG internal_0 # Pass the instance to the constructor + internal_0 = VCALL Cons function___init___at_Cons # Call the constructor + ARG internal_0 + ARG i + ARG self + internal_1 = VCALL Cons function_init_at_Cons + + RETURN internal_1 +} +function function_print_list_at_Nil{ + PARAM self + + LOCAL internal_0 # Boolean true + + internal_0 = ALLOCBOOL 1 + + RETURN internal_0 +} +function function___init___at_Main{ + PARAM self + + LOCAL internal_0 # Null + + internal_0 = ALLOCNULL + + SETATTR self l internal_0 + + RETURN self +} +function function_iota_at_Main{ + PARAM self + PARAM i + + LOCAL internal_0 # Store an instance of the class Nil + LOCAL j + LOCAL internal_2 # Integer 0 + LOCAL internal_3 # Store the result of the operation function_less_than + LOCAL internal_4 # Store an instance of the class Cons + LOCAL internal_5 + LOCAL internal_6 + LOCAL internal_7 # Integer 1 + LOCAL internal_8 # Store the result of the operation function_add + LOCAL internal_9 + + internal_0 = ALLOCATE Nil # Allocate the object Nil + ARG internal_0 # Pass the instance to the constructor + internal_0 = VCALL Nil function___init___at_Nil # Call the constructor + + SETATTR self l internal_0 + # Let j: Int + + internal_2 = ALLOCINT 0 + ARG j + ARG internal_2 + j = CALL function_assign + + # While loop + while_start_8750086235432: + + ARG j + ARG i + internal_3 = CALL function_less_than + IF internal_3 GOTO while_body_8750086235432 + GOTO while_end_8750086235432 + + while_body_8750086235432: + internal_4 = ALLOCATE Cons # Allocate the object Cons + ARG internal_4 # Pass the instance to the constructor + internal_4 = VCALL Cons function___init___at_Cons # Call the constructor + internal_5 = GETATTR self l + ARG internal_4 + ARG j + ARG internal_5 + internal_6 = VCALL Cons function_init_at_Cons + + SETATTR self l internal_6 + internal_7 = ALLOCINT 1 + + ARG j + ARG internal_7 + internal_8 = CALL function_add + + ARG j + ARG internal_8 + j = CALL function_assign + GOTO while_start_8750086235432 + + while_end_8750086235432: + internal_9 = GETATTR self l + + RETURN internal_9 +} +function function_main_at_Main{ + PARAM self + + LOCAL internal_0 # String "How many numbers to sort? " + LOCAL internal_1 + LOCAL internal_2 + LOCAL internal_3 + LOCAL internal_4 + LOCAL internal_5 + LOCAL internal_6 + + internal_0 = ALLOCSTR "How many numbers to sort? " + ARG self + ARG internal_0 + internal_1 = VCALL Main function_out_string_at_IO + ARG self + internal_2 = VCALL Main function_in_int_at_IO + ARG self + ARG internal_2 + internal_3 = VCALL Main function_iota_at_Main + ARG internal_3 + internal_4 = VCALL List function_rev_at_List + ARG internal_4 + internal_5 = VCALL List function_sort_at_List + ARG internal_5 + internal_6 = VCALL List function_print_list_at_List + + RETURN internal_6 +} +function main{ + + + LOCAL internal_0 + LOCAL internal_1 + + internal_0 = ALLOCATE Main + ARG internal_0 + internal_0 = VCALL Main function___init___at_Main + + ARG internal_0 + internal_1 = VCALL Main function_main_at_Main + + HALT +} \ No newline at end of file diff --git a/src/sort-list.cl b/src/sort-list.cl new file mode 100644 index 000000000..333e853d8 --- /dev/null +++ b/src/sort-list.cl @@ -0,0 +1,149 @@ +(* + This file presents a fairly large example of Cool programming. The +class List defines the names of standard list operations ala Scheme: +car, cdr, cons, isNil, rev, sort, rcons (add an element to the end of +the list), and print_list. In the List class most of these functions +are just stubs that abort if ever called. The classes Nil and Cons +inherit from List and define the same operations, but now as +appropriate to the empty list (for the Nil class) and for cons cells (for +the Cons class). + +The Main class puts all of this code through the following silly +test exercise: + + 1. prompt for a number N + 2. generate a list of numbers 0..N-1 + 3. reverse the list + 4. sort the list + 5. print the sorted list + +Because the sort used is a quadratic space insertion sort, sorting +moderately large lists can be quite slow. +*) + +Class List inherits IO { + (* Since abort() returns Object, we need something of + type Bool at the end of the block to satisfy the typechecker. + This code is unreachable, since abort() halts the program. *) + isNil() : Bool { { abort(); true; } }; + + cons(hd : Int) : 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 Int here to satisfy the typechecker. + This code is, of course, unreachable. + *) + car() : Int { { abort(); new Int; } }; + + cdr() : List { { abort(); new List; } }; + + rev() : List { cdr() }; + + sort() : List { cdr() }; + + insert(i : Int) : List { cdr() }; + + rcons(i : Int) : List { cdr() }; + + print_list() : Object { abort() }; +}; + +Class Cons inherits List { + xcar : Int; -- We keep the car in cdr in attributes. + xcdr : List; + + isNil() : Bool { false }; + + init(hd : Int, tl : List) : Cons { + { + xcar <- hd; + xcdr <- tl; + self; + } + }; + + car() : Int { xcar }; + + cdr() : List { xcdr }; + + rev() : List { + (xcdr.rev()).rcons(xcar) + }; + + sort() : List { (xcdr.sort()).insert(xcar) }; + + insert(i : Int) : List { + if i < xcar then + (new Cons).init(i,self) + else + (new Cons).init(xcar,xcdr.insert(i)) + fi + }; + + + rcons(i : Int) : List { (new Cons).init(xcar, xcdr.rcons(i)) }; + + print_list() : Object { + { + out_int(xcar); + out_string("\n"); + xcdr.print_list(); + } + }; +}; + +Class Nil inherits List { + isNil() : Bool { true }; + + rev() : List { self }; + + sort() : List { self }; + + insert(i : Int) : List { rcons(i) }; + + rcons(i : Int) : List { (new Cons).init(i,self) }; + + print_list() : Object { true }; + +}; + + +Class Main inherits IO { + + l : List; + + (* iota maps its integer argument n into the list 0..n-1 *) + iota(i : Int) : List { + { + l <- new Nil; + ( + let j : Int <- 0 in + while j < i + loop + { + l <- (new Cons).init(j,l); + j <- j + 1; + } + pool + ); + l; + } + }; + + main() : Object { + { + out_string("How many numbers to sort? "); + iota(in_int()).rev().sort().print_list(); + } + }; +}; + + + + + diff --git a/tests/codegen/arith.mips b/tests/codegen/arith.mips index f54b67128..d84c596a2 100644 --- a/tests/codegen/arith.mips +++ b/tests/codegen/arith.mips @@ -4,72 +4,84 @@ type_Object_attributes: .word 0 type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" + type_Object_abort_message: .asciiz "Abort called from class Object\n" type_IO: .word 8 type_IO_inherits_from: .word type_Object type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" + type_IO_abort_message: .asciiz "Abort called from class IO\n" type_Int: .word 8 type_Int_inherits_from: .word type_Object type_Int_attributes: .word 0 type_Int_name_size: .word 3 type_Int_name: .asciiz "Int" + type_Int_abort_message: .asciiz "Abort called from class Int\n" type_String: .word 8 type_String_inherits_from: .word type_Object type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" + type_String_abort_message: .asciiz "Abort called from class String\n" type_Bool: .word 8 type_Bool_inherits_from: .word type_Object type_Bool_attributes: .word 0 type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" + type_Bool_abort_message: .asciiz "Abort called from class Bool\n" type_A: .word 12 type_A_inherits_from: .word type_Object type_A_attributes: .word 1 type_A_name_size: .word 1 type_A_name: .asciiz "A" + type_A_abort_message: .asciiz "Abort called from class A\n" type_B: .word 12 type_B_inherits_from: .word type_A type_B_attributes: .word 1 type_B_name_size: .word 1 type_B_name: .asciiz "B" + type_B_abort_message: .asciiz "Abort called from class B\n" type_C: .word 12 type_C_inherits_from: .word type_B type_C_attributes: .word 1 type_C_name_size: .word 1 type_C_name: .asciiz "C" + type_C_abort_message: .asciiz "Abort called from class C\n" type_D: .word 12 type_D_inherits_from: .word type_B type_D_attributes: .word 1 type_D_name_size: .word 1 type_D_name: .asciiz "D" + type_D_abort_message: .asciiz "Abort called from class D\n" type_E: .word 12 type_E_inherits_from: .word type_D type_E_attributes: .word 1 type_E_name_size: .word 1 type_E_name: .asciiz "E" + type_E_abort_message: .asciiz "Abort called from class E\n" type_A2I: .word 8 type_A2I_inherits_from: .word type_Object type_A2I_attributes: .word 0 type_A2I_name_size: .word 3 type_A2I_name: .asciiz "A2I" + type_A2I_abort_message: .asciiz "Abort called from class A2I\n" type_Main: .word 24 type_Main_inherits_from: .word type_IO type_Main_attributes: .word 4 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" + type_Main_abort_message: .asciiz "Abort called from class Main\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -352,12 +364,12 @@ function_equal: # Function parameters - # $ra = 40($sp) - # a = 36($sp) - # b = 32($sp) + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) # Reserving space for local variables - addi $sp, $sp, -32 + addi $sp, $sp, -40 # Allocating Bool 0 li $v0, 9 @@ -369,22 +381,57 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_0 = address of allocated object Int + sw $v0, 36($sp) # internal_0 = address of allocated object Int - # internal_1 = typeof a that is the first word of the object - lw $t0, 36($sp) - lw $t1, 0($t0) - sw $t1, 24($sp) + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) - # internal_2 = direction of Int + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int la $t0, type_Int sw $t0, 20($sp) - # internal_3 = direction of Bool + # internal_5 = direction of Bool la $t0, type_Bool sw $t0, 16($sp) - # internal_4 = direction of String + # internal_6 = direction of String la $t0, type_String sw $t0, 12($sp) @@ -398,7 +445,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_5 = address of allocated object Int + sw $v0, 8($sp) # internal_7 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -410,7 +457,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_6 = address of allocated object Int + sw $v0, 4($sp) # internal_8 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -422,42 +469,42 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_7 = address of allocated object Int + sw $v0, 0($sp) # internal_9 = address of allocated object Int - # internal_5 = EqualAddress(internal_1, internal_2) + # internal_7 = EqualAddress(internal_3, internal_4) lw $t0, 24($sp) lw $t1, 20($sp) seq $t2, $t0, $t1 lw $t0, 8($sp) sw $t2, 8($t0) - # internal_6 = EqualAddress(internal_1, internal_3) + # internal_8 = EqualAddress(internal_3, internal_5) lw $t0, 24($sp) lw $t1, 16($sp) seq $t2, $t0, $t1 lw $t0, 4($sp) sw $t2, 8($t0) - # internal_7 = EqualAddress(internal_1, internal_4) + # internal_9 = EqualAddress(internal_3, internal_6) lw $t0, 24($sp) lw $t1, 12($sp) seq $t2, $t0, $t1 lw $t0, 0($sp) sw $t2, 8($t0) - # If internal_5 then goto a_is_type_int_or_bool + # If internal_7 then goto a_is_type_int_or_bool lw $t0, 8($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison beq $t0, $t1, a_is_type_int_or_bool - # If internal_6 then goto a_is_type_int_or_bool + # If internal_8 then goto a_is_type_int_or_bool lw $t0, 4($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison beq $t0, $t1, a_is_type_int_or_bool - # If internal_7 then goto a_is_type_string + # If internal_9 then goto a_is_type_string lw $t0, 0($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison @@ -469,12 +516,12 @@ a_is_type_int_or_bool: # internal_0 = EqualInt(a, b) - lw $t0, 36($sp) + lw $t0, 44($sp) lw $t0, 8($t0) - lw $t1, 32($sp) + lw $t1, 40($sp) lw $t1, 8($t1) seq $t2, $t0, $t1 - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t2, 8($t0) # Jumping to end_of_equal @@ -483,14 +530,14 @@ a_is_type_string: # internal_0 = EqualStr(a, b) - lw $t0, 36($sp) - lw $t1, 32($sp) + lw $t0, 44($sp) + lw $t1, 40($sp) addi $t0, $t0, 8 addi $t1, $t1, 8 # By default we assume the strings are equals addi $t4, $zero, 1 - lw $t5, 28($sp) + lw $t5, 36($sp) sw $t4, 8($t5) while_compare_strings_start: @@ -499,7 +546,7 @@ beq $t2, $t3, while_compare_strings_update # The strings are no equals - lw $t5, 28($sp) + lw $t5, 36($sp) sw $zero, 8($t5) j while_compare_strings_end @@ -507,6 +554,7 @@ addi $t0, $t0, 1 addi $t1, $t1, 1 beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end j while_compare_strings_start while_compare_strings_end: @@ -516,11 +564,11 @@ a_is_type_object: # Equal operation - lw $t0, 36($sp) # Save in $t0 the left operand address - lw $t1, 32($sp) # Save in $t1 the right operand address + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address seq $t2, $t0, $t1 # $t2 = $t0 == $t1 - lw $t0, 28($sp) # $t0 = internal_0 + lw $t0, 36($sp) # $t0 = internal_0 sw $t2, 8($t0) # Setting value in the third word of the Bool object # Jumping to end_of_equal @@ -529,136 +577,160 @@ end_of_equal: # Loading return value in $v1 - lw $v1, 28($sp) + lw $v1, 36($sp) # Freeing space for local variables - addi $sp, $sp, 32 + addi $sp, $sp, 40 jr $ra - function___init___at_Object: + function_assign: # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) - jr $ra + # Reserving space for local variables + addi $sp, $sp, -28 - function_abort_at_Object: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 - # Exit program - li $v0, 10 + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 syscall - # Loading return value in $v1 - lw $v1, 0($sp) + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int - jr $ra + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) - function_type_name_at_Object: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) - # Reserving space for local variables - addi $sp, $sp, -4 + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object - # internal_0 = name of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($t0) # $t1 = type of self - lw $t2, 12($t1) # $t1 = length of the name of self - lw $t3, 16($t1) # $t1 = name of self + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) - addi $t2, $t2, 9 # Setting space for the type, the size and the null byte - li $v0, 9 - move $a0, $t2 - syscall - addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) - la $t4, type_String - sw $t4, 0($v0) # Setting type in the first word of the object + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) - sw $a0, 4($v0) # Setting length in the second word of the object + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - move $t4, $v0 # $t4 = direction of the new string - addi $t4, $t4, 8 # Pointer to the first character of the string - addi $t0, $t0, 8 # Pointer to the first character of the string in self - xor $t5, $t5, $t5 # Initializing counter - while_copy_name_start: - beq $t5, $t1, while_copy_name_end - lb $t6, 0($t0) # Loading the character - sb $t6, 0($t4) - addi $t4, $t4, 1 # Incrementing the pointer to the new string - addi $t0, $t0, 1 # Incrementing the pointer to the string in self - addi $t5, $t5, 1 # Incrementing counter - j while_copy_name_start - while_copy_name_end: + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int - sb $zero, 0($t4) # Setting the null byte + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - sw $t4, 0($sp) # Storing the new string in internal_0 + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int - # Loading return value in $v1 - lw $v1, 0($sp) + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) - # Freeing space for local variables - addi $sp, $sp, 4 + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) - jr $ra + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool - function_copy_at_Object: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool - # Reserving space for local variables - addi $sp, $sp, -4 + # Jumping to source_is_type_object + j source_is_type_object - # internal_0 = copy of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($t0) # $t1 = type of self - lw $t2, 4($t0) # $t2 = length of self in bytes + source_is_type_int_or_bool: - # Allocating space for the new object + # dest = source where source is an integer li $v0, 9 - move $a0, $t2 + addi $a0, $zero, 12 syscall - move $t3, $v0 # $t3 = direction of the new object - sw $t1, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) - # Initializing the variable of the loop - addi $t0, $t0, 8 # Pointer to the first character of the object - addi $t3, $t3, 8 # Pointer to the first character of the object - addi $t2, $2, -8 # Decrementing in 8 the length of the object - xor $t4, $t4, $t4 # Initializing counter + # Jumping to source_end_of_equal + j source_end_of_equal - # Loop copying the object - while_copy_start: - beq $t4, $t2, while_copy_end - lb $t5, 0($t0) # Loading the byte - sb $t5, 0($t3) # Storing the byte - addi $t0, $t0, 1 # Incrementing the pointer to the object - addi $t3, $t3, 1 # Incrementing the pointer to the new object - addi $t4, $t4, 1 # Incrementing counter - j while_copy_start - while_copy_end: - sw $v0, 0($sp) # Storing the new object in internal_0 + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 32($sp) # Freeing space for local variables - addi $sp, $sp, 4 + addi $sp, $sp, 28 jr $ra - function___init___at_IO: + function___init___at_Object: # Function parameters # $ra = 4($sp) # self = 0($sp) @@ -668,267 +740,229 @@ jr $ra - function_out_string_at_IO: + function_abort_at_Object: # Function parameters - # $ra = 8($sp) - # self = 4($sp) - # x = 0($sp) + # $ra = 20($sp) + # self = 16($sp) - lw $t0, 0($sp) # $t0 = x - addi $t0, $t0, 8 # Pointer to the first character of the string + # Reserving space for local variables + addi $sp, $sp, -16 - # Printing the string x - li $v0, 4 - move $a0, $t0 + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - # Loading return value in $v1 - lw $v1, 4($sp) + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - jr $ra + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - function_out_int_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - # x = 0($sp) + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' - # Printing the string x - li $v0, 1 - lw $a0, 0($sp) - lw $a0, 8($a0) - syscall + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' - # Loading return value in $v1 - lw $v1, 4($sp) + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' - jr $ra + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' - function_in_string_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' - # Reserving space for local variables - addi $sp, $sp, -4 + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' - li $v0, 8 - la $a0, buffer_input - li $a1, 1024 - syscall + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' - xor $t0, $t0, $t0 # Initializing counter - while_read_start: - lw $t1, buffer_input($t0) # Loading the byte - beq $t1, $zero, while_read_end - addi $t0, $t0, 1 # Incrementing counter - j while_read_start - while_read_end: + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' - addi $t0, $t0, 9 # Adding space for the type, the size and the null byte - li $v0, 9 - move $a0, $t0 - syscall - la $t2, type_String - sw $t2, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' - addi $t3, $v0, 8 # Pointer to the first character of the string - xor $t4, $t4, $t4 # Initializing counter + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' - while_copy_from_buffer_start: - beq $t4, $t0, while_copy_from_buffer_end - lw $t5, buffer_input($t4) # Loading the byte - sb $t5, 0($t3) # Storing the byte - addi $t3, $t3, 1 # Imcremeenting pointer - addi $t4, $t4, 1 # Incrementing counter - j while_copy_from_buffer_start - while_copy_from_buffer_end: + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' - sb $zero, 0($t3) # Storing the null byte + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' - sw $v0, 0($sp) # Storing the new object in internal_0 + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' - # Loading return value in $v1 - lw $v1, 0($sp) + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' - # Freeing space for local variables - addi $sp, $sp, 4 + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' - jr $ra + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' - function_in_int_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' - # Reserving space for local variables - addi $sp, $sp, -4 + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' - li $v0, 5 - syscall - sw $v0, 0($sp) # Storing the new object in internal_0 + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' - # Loading return value in $v1 - lw $v1, 0($sp) + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' - # Freeing space for local variables - addi $sp, $sp, 4 + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' - jr $ra + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' - function___init___at_String: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' - # Loading return value in $v1 - lw $v1, 0($sp) + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' - jr $ra + sb $zero, 32($v0) # Null-terminator at the end of the string - function_length_at_String: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) + sw $v0, 12($sp) # internal_0 = "Abort called from class " - # Reserving space for local variables - addi $sp, $sp, -4 + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - # internal_0 = length of self - lw $t0, 4($sp) - lw $t1, 4($t0) - addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator - sw $t1, 0($sp) + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - # Loading return value in $v1 - lw $v1, 0($sp) + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - # Freeing space for local variables - addi $sp, $sp, 4 + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_2[0] = '\n' - jr $ra + sb $zero, 9($v0) # Null-terminator at the end of the string - function_concat_at_String: - # Function parameters - # $ra = 12($sp) - # self = 8($sp) - # s = 4($sp) + sw $v0, 4($sp) # internal_2 = "\n" - # Reserving space for local variables - addi $sp, $sp, -4 + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - # internal_0 = self + s - lw $t0, 8($sp) - lw $t1, 4($sp) - lw $t2, 4($t0) # $t2 = length of str1 - lw $t3, 4($t1) # $t3 = length of str2 - add $t4, $t2, $t3 # $t4 = length of str1 + str2 - addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self - li $v0, 9 - move $a0, $t4 - syscall - addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 - add $t5, $zero, $v0 # $t5 = address of the new string object - addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + # Calling function function_type_name_at_Object + jal function_type_name_at_Object + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + addi $sp, $sp, 8 # Freeing space for arguments - la $t8, type_String - sw $t8, 0($v0) # Setting type in the first word of th object + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - sw $a0, 4($v0) # Setting length of the string in the second word of the object + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_0 - # Copying str1 to the new string - xor $t6, $t6, $t6 # $t6 = 0 Initializing counter - while_copy_str1_start: - beq $t6, $t2, while_copy_str1_end - lb $t7, 0($t0) - sb $t7, 0($t5) - add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_str1_start - while_copy_str1_end: + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 - # Copying str2 to the new string - while_copy_str2_start: - beq $t6, $t4, while_copy_str2_end - lb $t7, 0($t1) - sb $t7, 0($t5) - add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_str2_start - while_copy_str2_end: + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments - sb $zero, 0($t5) # Setting the null-terminator + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - sw $v0, 0($sp) # internal_0 = self + s + # Argument internal_3 + lw $t0, 12($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) # $t0 = internal_3 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string internal_3 + li $v0, 4 + move $a0, $t0 + syscall + + # Exit program + li $v0, 10 + syscall # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 16($sp) # Freeing space for local variables - addi $sp, $sp, 4 + addi $sp, $sp, 16 jr $ra - function_substr_at_String: + function_type_name_at_Object: # Function parameters - # $ra = 16($sp) - # self = 12($sp) - # i = 8($sp) - # l = 4($sp) + # $ra = 8($sp) + # self = 4($sp) # Reserving space for local variables addi $sp, $sp, -4 - # internal_0 = self[i:i + l] - lw $t0, 12($sp) # $t0 = address of the string - lw $t1, 4($t0) # $t1 = length of the string - lw $t2, 8($sp) # $t2 = start of the substring - lw $t3, 4($sp) # $t3 = length of the substring - add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring - - bge $t4, $t1, substring_out_of_bounds + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 12($t1) # $t1 = length of the name of self + la $t3, 16($t1) # $t1 = name of self - addi $t3, $t3, 9 + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 - move $a0, $t3 + move $a0, $t2 syscall - addi $t3, $t3, -9 - - la $t5, type_String - sw $t5, 0($v0) # Setting type in the first word of the object + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting length in the second word of the object - addi $t0, $t0, 8 # pointing to the first byte of the string - add $t0, $t0, $t2 # pointing to the first byte of the substring - move $t5, $v0 # $t5 = address of the new string - add $t5, $t5, 8 # pointing to the first byte of the string - xor $t6, $t6, $t6 # $t6 = 0 Initializing counter - while_copy_substr_start: - beq $t6, $t3, while_copy_substr_end - lb $t7, 0($t0) - sb $t7, 0($t5) - addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_substr_start - while_copy_substr_end: - - sb $zero, 0($t5) # Setting the null-terminator - - sw $v0, 0($sp) # internal_0 = self[i:i + l] - j substring_not_out_of_bounds + addi $t4, $v0, 0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t3, $t3, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: - substring_out_of_bounds: - li $v0, 17 - addi $a0, $zero, 1 - syscall + sb $zero, 0($t4) # Setting the null byte - substring_not_out_of_bounds: + sw $v0, 0($sp) # Storing the new string in internal_0 # Loading return value in $v1 lw $v1, 0($sp) @@ -938,7 +972,7 @@ jr $ra - function___init___at_A: + function_copy_at_Object: # Function parameters # $ra = 8($sp) # self = 4($sp) @@ -946,551 +980,2401 @@ # Reserving space for local variables addi $sp, $sp, -4 - # Allocating Int 0 + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object li $v0, 9 - addi $a0, $zero, 12 + move $a0, $t2 syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Set attribute var of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_0 - sw $t1, 8($t0) # self.var = internal_0 + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 # Loading return value in $v1 - lw $v1, 4($sp) + lw $v1, 0($sp) # Freeing space for local variables addi $sp, $sp, 4 jr $ra - function_value_at_A: + function___init___at_IO: # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Get attribute var of self - lw $t0, 4($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'var' from the instance - sw $t1, 0($sp) # internal_0 = var + # $ra = 4($sp) + # self = 0($sp) # Loading return value in $v1 lw $v1, 0($sp) - # Freeing space for local variables - addi $sp, $sp, 4 - jr $ra - function_set_var_at_A: + function_out_string_at_IO: # Function parameters # $ra = 8($sp) # self = 4($sp) - # num = 0($sp) + # x = 0($sp) - # Set attribute var of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = num - sw $t1, 8($t0) # self.var = num + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string x + li $v0, 4 + move $a0, $t0 + syscall # Loading return value in $v1 lw $v1, 4($sp) jr $ra - function_method1_at_A: + function_out_int_at_IO: # Function parameters # $ra = 8($sp) # self = 4($sp) - # num = 0($sp) + # x = 0($sp) + + # Printing the string x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall # Loading return value in $v1 lw $v1, 4($sp) jr $ra - function_method2_at_A: + function_in_string_at_IO: # Function parameters - # $ra = 28($sp) - # self = 24($sp) - # num1 = 20($sp) - # num2 = 16($sp) + # $ra = 8($sp) + # self = 4($sp) # Reserving space for local variables - addi $sp, $sp, -16 - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument num1 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing num1 - - # Argument num2 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing num2 + addi $sp, $sp, -4 - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_1 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 12($sp) - j end_assign - not_is_Bool_or_Int: - # x = internal_1 - lw $t0, 8($sp) - sw $t0, 12($sp) - end_assign: + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lb $t1, buffer_input($t0) # Loading the byte + beq $t1, $zero, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' - # Allocating B + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 - lw $a0, type_B + move $a0, $t0 syscall - la $t0, type_B # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_2 = address of allocated object B - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_2 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function___init___at_B - jal function___init___at_B - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_2 = result of function___init___at_B - addi $sp, $sp, 8 # Freeing space for arguments + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_2 + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lb $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: - # Argument x - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing x + sb $zero, 0($t3) # Storing the null byte - # Calling function function_set_var_at_A - jal function_set_var_at_A - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_set_var_at_A - addi $sp, $sp, 12 # Freeing space for arguments + sw $v0, 0($sp) # Storing the new object in internal_0 # Loading return value in $v1 lw $v1, 0($sp) # Freeing space for local variables - addi $sp, $sp, 16 + addi $sp, $sp, 4 jr $ra - function_method3_at_A: + function_in_int_at_IO: # Function parameters - # $ra = 32($sp) - # self = 28($sp) - # num = 24($sp) + # $ra = 8($sp) + # self = 4($sp) # Reserving space for local variables - addi $sp, $sp, -24 - - # Xor operation - lw $t0, 24($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 12($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 - - lw $t0, 8($sp) # $t0 = internal_3 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Addition operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 16($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - add $t2, $t0, $t1 # $t2 = $t0 + $t1 - - lw $t0, 8($sp) # $t0 = internal_3 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 20($sp) - j end_assign - not_is_Bool_or_Int: - # x = internal_3 - lw $t0, 8($sp) - sw $t0, 20($sp) - end_assign: + addi $sp, $sp, -4 - # Allocating C + # Allocating Int 0 li $v0, 9 - lw $a0, type_C + addi $a0, $zero, 12 syscall - la $t0, type_C # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_4 = address of allocated object C - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - # Argument internal_4 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_4 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int - # Calling function function___init___at_C - jal function___init___at_C - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_4 = result of function___init___at_C - addi $sp, $sp, 8 # Freeing space for arguments + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + # Loading return value in $v1 + lw $v1, 0($sp) - # Argument internal_4 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_4 + # Freeing space for local variables + addi $sp, $sp, 4 - # Argument x - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing x + jr $ra - # Calling function function_set_var_at_A - jal function_set_var_at_A - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_5 = result of function_set_var_at_A - addi $sp, $sp, 12 # Freeing space for arguments + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) # Loading return value in $v1 lw $v1, 0($sp) - # Freeing space for local variables - addi $sp, $sp, 24 - jr $ra - function_method4_at_A: + function_length_at_String: # Function parameters - # $ra = 56($sp) - # self = 52($sp) - # num1 = 48($sp) - # num2 = 44($sp) + # $ra = 8($sp) + # self = 4($sp) # Reserving space for local variables - addi $sp, $sp, -44 - + addi $sp, $sp, -4 - # Allocating Bool 0 + # Allocating Int 0 li $v0, 9 addi $a0, $zero, 12 syscall - la $t0, type_Bool # $t0 = address of the type + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_1 = address of allocated object Int + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + lw $t0, 0($sp) + sw $t1, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 8($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 8($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 + lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) + lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bgt $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_A: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8794497400971 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794497400971 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794497400971 + j object_set_attribute_8794497400971 + int_set_attribute_8794497400971: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8794497400971 + bool_set_attribute_8794497400971: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8794497400971 + object_set_attribute_8794497400971: + sw $t1, 8($t0) # self.var = internal_0 + end_set_attribute_8794497400971: + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_value_at_A: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute var of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'var' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497400995 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497400995 + j object_get_attribute_8794497400995 + int_get_attribute_8794497400995: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.var + j end_get_attribute_8794497400995 + bool_get_attribute_8794497400995: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.var + j end_get_attribute_8794497400995 + object_get_attribute_8794497400995: + sw $t1, 0($sp) # internal_0 = var + end_get_attribute_8794497400995: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_set_var_at_A: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # num = 0($sp) + + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = num + beq $t1, $zero, object_set_attribute_8794497401046 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794497401046 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794497401046 + j object_set_attribute_8794497401046 + int_set_attribute_8794497401046: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = num + j end_set_attribute_8794497401046 + bool_set_attribute_8794497401046: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = num + j end_set_attribute_8794497401046 + object_set_attribute_8794497401046: + sw $t1, 8($t0) # self.var = num + end_set_attribute_8794497401046: + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_method1_at_A: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # num = 0($sp) + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_method2_at_A: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + # num1 = 20($sp) + # num2 = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # x = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num1 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing num1 + + # Argument num2 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing num2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_1 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 24($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating B + li $v0, 9 + lw $a0, type_B + syscall + la $t0, type_B # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_2 = address of allocated object B + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_2 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function___init___at_B + jal function___init___at_B + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_2 = result of function___init___at_B + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument x + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_method3_at_A: + # Function parameters + # $ra = 32($sp) + # self = 28($sp) + # num = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # x = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_1 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_2 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_3 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_3 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 32($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating C + li $v0, 9 + lw $a0, type_C + syscall + la $t0, type_C # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_4 = address of allocated object C + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_4 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function___init___at_C + jal function___init___at_C + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_4 = result of function___init___at_C + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument x + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_5 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_method4_at_A: + # Function parameters + # $ra = 56($sp) + # self = 52($sp) + # num1 = 48($sp) + # num2 = 44($sp) + + # Reserving space for local variables + addi $sp, $sp, -44 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num2 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing num2 + + # Argument num1 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing num1 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_2 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_2 + lw $t0, 32($sp) + sw $t0, 36($sp) + + # If internal_1 then goto then_8794497430649 + lw $t0, 36($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8794497430649 + + # Jumping to else_8794497430649 + j else_8794497430649 + + then_8794497430649: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # x = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num1 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing num1 + + # Argument num2 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing num2 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_4 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_4 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 40($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating D + li $v0, 9 + lw $a0, type_D + syscall + la $t0, type_D # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 20($sp) # internal_5 = address of allocated object D + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_5 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function___init___at_D + jal function___init___at_D + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_5 = result of function___init___at_D + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_5 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_5 + + # Argument x + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_6 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_0 = internal_6 + lw $t0, 16($sp) + sw $t0, 40($sp) + + # Jumping to endif_8794497430649 + j endif_8794497430649 + + else_8794497430649: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # x = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num2 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing num2 + + # Argument num1 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing num1 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_8 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_8 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 40($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating D + li $v0, 9 + lw $a0, type_D + syscall + la $t0, type_D # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_9 = address of allocated object D + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_9 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function___init___at_D + jal function___init___at_D + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_9 = result of function___init___at_D + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_9 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_9 + + # Argument x + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_10 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_0 = internal_10 + lw $t0, 0($sp) + sw $t0, 40($sp) + + # Jumping to endif_8794497430649 + j endif_8794497430649 + + endif_8794497430649: + + # Loading return value in $v1 + lw $v1, 40($sp) + + # Freeing space for local variables + addi $sp, $sp, 44 + + jr $ra + + function_method5_at_A: + # Function parameters + # $ra = 48($sp) + # self = 44($sp) + # num = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_1 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 48($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument y + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing y + + # Argument internal_3 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 40($sp) # y = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + while_start_8794497430733: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument y + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing y + + # Argument num + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_less_than_or_equal + jal function_less_than_or_equal + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_4 = result of function_less_than_or_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_4 then goto while_body_8794497430733 + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8794497430733 + + # Jumping to while_end_8794497430733 + j while_end_8794497430733 + + while_body_8794497430733: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing x + + # Argument y + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing y + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_5 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_5 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 48($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_6 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument y + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing y + + # Argument internal_6 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_7 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument y + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing y + + # Argument internal_7 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 40($sp) # y = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to while_start_8794497430733 + j while_start_8794497430733 + + while_end_8794497430733: + + # Allocating E + li $v0, 9 + lw $a0, type_E + syscall + la $t0, type_E # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_8 = address of allocated object E + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_8 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function___init___at_E + jal function___init___at_E + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_8 = result of function___init___at_E + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_8 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument x + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_9 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function___init___at_B: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8794497371456 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794497371456 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794497371456 + j object_set_attribute_8794497371456 + int_set_attribute_8794497371456: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8794497371456 + bool_set_attribute_8794497371456: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8794497371456 + object_set_attribute_8794497371456: + sw $t1, 8($t0) # self.var = internal_0 + end_set_attribute_8794497371456: + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_method5_at_B: + # Function parameters + # $ra = 24($sp) + # self = 20($sp) + # num = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # x = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing num + + # Argument num + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_1 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 24($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating E + li $v0, 9 + lw $a0, type_E + syscall + la $t0, type_E # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_2 = address of allocated object E + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_2 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function___init___at_E + jal function___init___at_E + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_2 = result of function___init___at_E + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument x + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function___init___at_C: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8794497371639 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794497371639 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794497371639 + j object_set_attribute_8794497371639 + int_set_attribute_8794497371639: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8794497371639 + bool_set_attribute_8794497371639: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8794497371639 + object_set_attribute_8794497371639: + sw $t1, 8($t0) # self.var = internal_0 + end_set_attribute_8794497371639: + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_method6_at_C: + # Function parameters + # $ra = 32($sp) + # self = 28($sp) + # num = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # x = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_1 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_2 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_3 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_3 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 32($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating A + li $v0, 9 + lw $a0, type_A + syscall + la $t0, type_A # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_4 = address of allocated object A + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_4 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function___init___at_A + jal function___init___at_A + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_4 = result of function___init___at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument x + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_5 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_method5_at_C: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + # num = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # x = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing num + + # Argument num + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_1 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument num + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_2 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_2 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 28($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating E + li $v0, 9 + lw $a0, type_E + syscall + la $t0, type_E # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_3 = address of allocated object E + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_3 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function___init___at_E + jal function___init___at_E + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_3 = result of function___init___at_E + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument x + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_4 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 20 + + jr $ra + + function___init___at_D: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8794497373064 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794497373064 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794497373064 + j object_set_attribute_8794497373064 + int_set_attribute_8794497373064: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8794497373064 + bool_set_attribute_8794497373064: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8794497373064 + object_set_attribute_8794497373064: + sw $t1, 8($t0) # self.var = internal_0 + end_set_attribute_8794497373064: + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_method7_at_D: + # Function parameters + # $ra = 116($sp) + # self = 112($sp) + # num = 108($sp) + + # Reserving space for local variables + addi $sp, $sp, -108 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing x + + # Argument num + lw $t0, 120($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 116($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_2 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 92($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_3 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_4 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_2 = internal_4 + lw $t0, 88($sp) + sw $t0, 96($sp) + + # If internal_2 then goto then_8794497431887 + lw $t0, 96($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8794497431887 + + # Jumping to else_8794497431887 + j else_8794497431887 + + then_8794497431887: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_5 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_6 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_6 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 88($sp) # internal_7 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_7 + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing internal_7 + + # Argument internal_5 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 88($sp) # internal_7 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_7 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_method7_at_D + jal function_method7_at_D + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_8 = result of function_method7_at_D + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_8 + lw $t0, 72($sp) + sw $t0, 100($sp) + + # Jumping to endif_8794497431887 + j endif_8794497431887 + + else_8794497431887: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_10 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_11 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_11 + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing internal_11 + + # Argument x + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_12 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_10 = internal_12 + lw $t0, 56($sp) + sw $t0, 64($sp) + + # If internal_10 then goto then_8794497431866 + lw $t0, 64($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8794497431866 + + # Jumping to else_8794497431866 + j else_8794497431866 + + then_8794497431866: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_13 = address of allocated object Int + + # internal_9 = internal_13 + lw $t0, 52($sp) + sw $t0, 68($sp) + + # Jumping to endif_8794497431866 + j endif_8794497431866 + + else_8794497431866: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_15 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_16 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument num2 - lw $t0, 56($sp) - sw $t0, 4($sp) # Storing num2 + # Argument internal_16 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_16 - # Argument num1 - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing num1 + # Argument x + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing x - # Calling function function_less_than - jal function_less_than + # Calling function function_equal + jal function_equal lw $ra, 8($sp) - sw $v1, 44($sp) # internal_2 = result of function_less_than + sw $v1, 48($sp) # internal_17 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 32($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 36($sp) - j end_assign - not_is_Bool_or_Int: - # internal_1 = internal_2 - lw $t0, 32($sp) - sw $t0, 36($sp) - end_assign: + # internal_15 = internal_17 + lw $t0, 36($sp) + sw $t0, 44($sp) - # If internal_1 then goto then_8743762782775 - lw $t0, 36($sp) # Loading the address of the condition + # If internal_15 then goto then_8794497431869 + lw $t0, 44($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762782775 + beq $t0, $t1, then_8794497431869 - # Jumping to else_8743762782775 - j else_8743762782775 + # Jumping to else_8794497431869 + j else_8794497431869 - then_8743762782775: + then_8794497431869: - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Argument num1 - lw $t0, 60($sp) - sw $t0, 4($sp) # Storing num1 + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_18 = address of allocated object Int - # Argument num2 - lw $t0, 56($sp) - sw $t0, 0($sp) # Storing num2 + # internal_14 = internal_18 + lw $t0, 32($sp) + sw $t0, 48($sp) - # Calling function function_sub - jal function_sub - lw $ra, 8($sp) - sw $v1, 36($sp) # internal_4 = result of function_sub - addi $sp, $sp, 12 # Freeing space for arguments + # Jumping to endif_8794497431869 + j endif_8794497431869 - lw $t0, 24($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 28($sp) - j end_assign - not_is_Bool_or_Int: - # x = internal_4 - lw $t0, 24($sp) - sw $t0, 28($sp) - end_assign: + else_8794497431869: - # Allocating D + # Allocating Bool 0 li $v0, 9 - lw $a0, type_D + addi $a0, $zero, 12 syscall - la $t0, type_D # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 20($sp) # internal_5 = address of allocated object D - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_20 = address of allocated object Int - # Argument internal_5 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_5 + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Calling function function___init___at_D - jal function___init___at_D - lw $ra, 4($sp) - sw $v1, 28($sp) # internal_5 = result of function___init___at_D - addi $sp, $sp, 8 # Freeing space for arguments + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_21 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_5 + # Argument internal_21 lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_5 + sw $t0, 4($sp) # Storing internal_21 # Argument x - lw $t0, 40($sp) + lw $t0, 116($sp) sw $t0, 0($sp) # Storing x - # Calling function function_set_var_at_A - jal function_set_var_at_A + # Calling function function_equal + jal function_equal lw $ra, 8($sp) - sw $v1, 28($sp) # internal_6 = result of function_set_var_at_A + sw $v1, 28($sp) # internal_22 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments + # internal_20 = internal_22 lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: - # internal_0 = internal_6 - lw $t0, 16($sp) - sw $t0, 40($sp) - end_assign: - - # Jumping to endif_8743762782775 - j endif_8743762782775 + sw $t0, 24($sp) - else_8743762782775: + # If internal_20 then goto then_8794497431875 + lw $t0, 24($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8794497431875 - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + # Jumping to else_8794497431875 + j else_8794497431875 - # Argument num2 - lw $t0, 56($sp) - sw $t0, 4($sp) # Storing num2 + then_8794497431875: - # Argument num1 - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing num1 + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Calling function function_sub - jal function_sub - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_8 = result of function_sub - addi $sp, $sp, 12 # Freeing space for arguments + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_23 = address of allocated object Int - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 28($sp) - j end_assign - not_is_Bool_or_Int: - # x = internal_8 - lw $t0, 8($sp) + # internal_19 = internal_23 + lw $t0, 12($sp) sw $t0, 28($sp) - end_assign: - # Allocating D + # Jumping to endif_8794497431875 + j endif_8794497431875 + + else_8794497431875: + + # Allocating Int 3 li $v0, 9 - lw $a0, type_D + addi $a0, $zero, 12 syscall - la $t0, type_D # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_9 = address of allocated object D + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_24 = address of allocated object Int # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Argument internal_9 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_9 + # Argument x + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing x - # Calling function function___init___at_D - jal function___init___at_D - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_9 = result of function___init___at_D - addi $sp, $sp, 8 # Freeing space for arguments + # Argument internal_24 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_24 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_25 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_9 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_9 + # Argument self + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing self - # Argument x - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing x + # Argument internal_25 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_25 - # Calling function function_set_var_at_A - jal function_set_var_at_A + # Calling function function_method7_at_D + jal function_method7_at_D lw $ra, 8($sp) - sw $v1, 12($sp) # internal_10 = result of function_set_var_at_A + sw $v1, 12($sp) # internal_26 = result of function_method7_at_D addi $sp, $sp, 12 # Freeing space for arguments + # internal_19 = internal_26 lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: - # internal_0 = internal_10 - lw $t0, 0($sp) - sw $t0, 40($sp) - end_assign: + sw $t0, 28($sp) + + # Jumping to endif_8794497431875 + j endif_8794497431875 + + endif_8794497431875: + + # internal_14 = internal_19 + lw $t0, 28($sp) + sw $t0, 48($sp) + + # Jumping to endif_8794497431869 + j endif_8794497431869 + + endif_8794497431869: + + # internal_9 = internal_14 + lw $t0, 48($sp) + sw $t0, 68($sp) + + # Jumping to endif_8794497431866 + j endif_8794497431866 + + endif_8794497431866: + + # internal_1 = internal_9 + lw $t0, 68($sp) + sw $t0, 100($sp) - # Jumping to endif_8743762782775 - j endif_8743762782775 + # Jumping to endif_8794497431887 + j endif_8794497431887 - endif_8743762782775: + endif_8794497431887: # Loading return value in $v1 - lw $v1, 40($sp) + lw $v1, 100($sp) # Freeing space for local variables - addi $sp, $sp, 44 + addi $sp, $sp, 108 jr $ra - function_method5_at_A: + function___init___at_E: # Function parameters - # $ra = 52($sp) - # self = 48($sp) - # num = 44($sp) + # $ra = 8($sp) + # self = 4($sp) # Reserving space for local variables - addi $sp, $sp, -44 + addi $sp, $sp, -4 - # Allocating Int 1 + # Allocating Int 0 li $v0, 9 addi $a0, $zero, 12 syscall @@ -1498,140 +3382,77 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_1 = address of allocated object Int - - lw $t0, 36($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: - # x = internal_1 - lw $t0, 36($sp) - sw $t0, 40($sp) - end_assign: + sw $v0, 0($sp) # internal_0 = address of allocated object Int - # Allocating Int 1 + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8794497374925 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794497374925 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794497374925 + j object_set_attribute_8794497374925 + int_set_attribute_8794497374925: li $v0, 9 addi $a0, $zero, 12 syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8794497374925 + bool_set_attribute_8794497374925: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8794497374925 + object_set_attribute_8794497374925: + sw $t1, 8($t0) # self.var = internal_0 + end_set_attribute_8794497374925: - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_3 = address of allocated object Int - - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 32($sp) - j end_assign - not_is_Bool_or_Int: - # y = internal_3 - lw $t0, 28($sp) - sw $t0, 32($sp) - end_assign: - - while_start_8743762782859: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument y - lw $t0, 44($sp) - sw $t0, 4($sp) # Storing y - - # Argument num - lw $t0, 56($sp) - sw $t0, 0($sp) # Storing num - - # Calling function function_less_than_or_equal - jal function_less_than_or_equal - lw $ra, 8($sp) - sw $v1, 32($sp) # internal_5 = result of function_less_than_or_equal - addi $sp, $sp, 12 # Freeing space for arguments - - lw $t0, 20($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: - # internal_4 = internal_5 - lw $t0, 20($sp) - sw $t0, 24($sp) - end_assign: - - # If internal_4 then goto while_body_8743762782859 - lw $t0, 24($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8743762782859 - - # Jumping to while_end_8743762782859 - j while_end_8743762782859 + # Loading return value in $v1 + lw $v1, 4($sp) - while_body_8743762782859: + # Freeing space for local variables + addi $sp, $sp, 4 - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + jr $ra - # Argument x - lw $t0, 52($sp) - sw $t0, 4($sp) # Storing x + function_method6_at_E: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + # num = 20($sp) - # Argument y - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing y + # Reserving space for local variables + addi $sp, $sp, -20 - # Calling function function_mult - jal function_mult - lw $ra, 8($sp) - sw $v1, 28($sp) # internal_6 = result of function_mult - addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: - # x = internal_6 - lw $t0, 16($sp) - sw $t0, 40($sp) - end_assign: + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # x = address of allocated object Int - # Allocating Int 1 + # Allocating Int 8 li $v0, 9 addi $a0, $zero, 12 syscall @@ -1639,232 +3460,176 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 8 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_7 = address of allocated object Int + sw $v0, 12($sp) # internal_1 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument y - lw $t0, 44($sp) - sw $t0, 4($sp) # Storing y + # Argument num + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing num - # Argument internal_7 + # Argument internal_1 lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_7 + sw $t0, 0($sp) # Storing internal_1 - # Calling function function_add - jal function_add + # Calling function function_div + jal function_div lw $ra, 8($sp) - sw $v1, 20($sp) # internal_8 = result of function_add + sw $v1, 20($sp) # internal_2 = result of function_div addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 32($sp) - j end_assign - not_is_Bool_or_Int: - # y = internal_8 - lw $t0, 8($sp) - sw $t0, 32($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Jumping to while_start_8743762782859 - j while_start_8743762782859 + # Argument x + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing x - while_end_8743762782859: + # Argument internal_2 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_2 - # Allocating E + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 28($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating A li $v0, 9 - lw $a0, type_E + lw $a0, type_A syscall - la $t0, type_E # $t0 = address of the type + la $t0, type_A # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_9 = address of allocated object E + sw $v0, 4($sp) # internal_3 = address of allocated object A # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_9 + # Argument internal_3 lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_9 + sw $t0, 0($sp) # Storing internal_3 - # Calling function function___init___at_E - jal function___init___at_E + # Calling function function___init___at_A + jal function___init___at_A lw $ra, 4($sp) - sw $v1, 12($sp) # internal_9 = result of function___init___at_E + sw $v1, 12($sp) # internal_3 = result of function___init___at_A addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_9 + # Argument internal_3 lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_9 + sw $t0, 4($sp) # Storing internal_3 # Argument x - lw $t0, 52($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing x # Calling function function_set_var_at_A jal function_set_var_at_A lw $ra, 8($sp) - sw $v1, 12($sp) # internal_10 = result of function_set_var_at_A + sw $v1, 12($sp) # internal_4 = result of function_set_var_at_A addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 lw $v1, 0($sp) # Freeing space for local variables - addi $sp, $sp, 44 + addi $sp, $sp, 20 jr $ra - function___init___at_B: + function___init___at_A2I: # Function parameters - # $ra = 8($sp) - # self = 4($sp) + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_c2i_at_A2I: + # Function parameters + # $ra = 216($sp) + # self = 212($sp) + # char = 208($sp) # Reserving space for local variables - addi $sp, $sp, -4 + addi $sp, $sp, -208 - # Allocating Int 0 + # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_Bool # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Set attribute var of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_0 - sw $t1, 8($t0) # self.var = internal_0 - - # Loading return value in $v1 - lw $v1, 4($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_method5_at_B: - # Function parameters - # $ra = 24($sp) - # self = 20($sp) - # num = 16($sp) - - # Reserving space for local variables - addi $sp, $sp, -16 - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument num - lw $t0, 28($sp) - sw $t0, 4($sp) # Storing num - - # Argument num - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing num - - # Calling function function_mult - jal function_mult - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_1 = result of function_mult - addi $sp, $sp, 12 # Freeing space for arguments - - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 12($sp) - j end_assign - not_is_Bool_or_Int: - # x = internal_1 - lw $t0, 8($sp) - sw $t0, 12($sp) - end_assign: + sw $v0, 200($sp) # internal_1 = address of allocated object Int - # Allocating E + # Allocating String li $v0, 9 - lw $a0, type_E + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_E # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_2 = address of allocated object E - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - # Argument internal_2 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_2 + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 48 + sb $t0, 8($v0) # internal_2[0] = '0' + + sb $zero, 9($v0) # Null-terminator at the end of the string - # Calling function function___init___at_E - jal function___init___at_E - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_2 = result of function___init___at_E - addi $sp, $sp, 8 # Freeing space for arguments + sw $v0, 196($sp) # internal_2 = "0" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_2 + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char - # Argument x - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing x + # Argument internal_2 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_2 - # Calling function function_set_var_at_A - jal function_set_var_at_A + # Calling function function_equal + jal function_equal lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_set_var_at_A + sw $v1, 204($sp) # internal_3 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 16 + # internal_1 = internal_3 + lw $t0, 192($sp) + sw $t0, 200($sp) - jr $ra + # If internal_1 then goto then_8794497432537 + lw $t0, 200($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8794497432537 - function___init___at_C: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) + # Jumping to else_8794497432537 + j else_8794497432537 - # Reserving space for local variables - addi $sp, $sp, -4 + then_8794497432537: # Allocating Int 0 li $v0, 9 @@ -1876,236 +3641,249 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int + sw $v0, 188($sp) # internal_4 = address of allocated object Int - # Set attribute var of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_0 - sw $t1, 8($t0) # self.var = internal_0 + # internal_0 = internal_4 + lw $t0, 188($sp) + sw $t0, 204($sp) - # Loading return value in $v1 - lw $v1, 4($sp) + # Jumping to endif_8794497432537 + j endif_8794497432537 - # Freeing space for local variables - addi $sp, $sp, 4 + else_8794497432537: - jr $ra + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - function_method6_at_C: - # Function parameters - # $ra = 32($sp) - # self = 28($sp) - # num = 24($sp) + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 180($sp) # internal_6 = address of allocated object Int - # Reserving space for local variables - addi $sp, $sp, -24 + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - # Xor operation - lw $t0, 24($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 12($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - lw $t0, 8($sp) # $t0 = internal_3 - sw $t2, 8($t0) # Setting value in the third word of the Int object + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - # Addition operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 16($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - add $t2, $t0, $t1 # $t2 = $t0 + $t1 + addi $t0, $zero, 49 + sb $t0, 8($v0) # internal_7[0] = '1' - lw $t0, 8($sp) # $t0 = internal_3 - sw $t2, 8($t0) # Setting value in the third word of the Int object + sb $zero, 9($v0) # Null-terminator at the end of the string - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 20($sp) - j end_assign - not_is_Bool_or_Int: - # x = internal_3 - lw $t0, 8($sp) - sw $t0, 20($sp) - end_assign: + sw $v0, 176($sp) # internal_7 = "1" - # Allocating A + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_7 + lw $t0, 188($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 184($sp) # internal_8 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_6 = internal_8 + lw $t0, 172($sp) + sw $t0, 180($sp) + + # If internal_6 then goto then_8794497432531 + lw $t0, 180($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8794497432531 + + # Jumping to else_8794497432531 + j else_8794497432531 + + then_8794497432531: + + # Allocating Int 1 li $v0, 9 - lw $a0, type_A + addi $a0, $zero, 12 syscall - la $t0, type_A # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_4 = address of allocated object A - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 168($sp) # internal_9 = address of allocated object Int - # Argument internal_4 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_4 + # internal_5 = internal_9 + lw $t0, 168($sp) + sw $t0, 184($sp) - # Calling function function___init___at_A - jal function___init___at_A - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_4 = result of function___init___at_A - addi $sp, $sp, 8 # Freeing space for arguments + # Jumping to endif_8794497432531 + j endif_8794497432531 - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + else_8794497432531: - # Argument internal_4 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_4 + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Argument x - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing x + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_11 = address of allocated object Int - # Calling function function_set_var_at_A - jal function_set_var_at_A - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_5 = result of function_set_var_at_A - addi $sp, $sp, 12 # Freeing space for arguments + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - # Loading return value in $v1 - lw $v1, 0($sp) + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - # Freeing space for local variables - addi $sp, $sp, 24 + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - jr $ra + addi $t0, $zero, 50 + sb $t0, 8($v0) # internal_12[0] = '2' - function_method5_at_C: - # Function parameters - # $ra = 28($sp) - # self = 24($sp) - # num = 20($sp) + sb $zero, 9($v0) # Null-terminator at the end of the string - # Reserving space for local variables - addi $sp, $sp, -20 + sw $v0, 156($sp) # internal_12 = "2" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument num - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing num + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char - # Argument num - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing num + # Argument internal_12 + lw $t0, 168($sp) + sw $t0, 0($sp) # Storing internal_12 - # Calling function function_mult - jal function_mult + # Calling function function_equal + jal function_equal lw $ra, 8($sp) - sw $v1, 24($sp) # internal_1 = result of function_mult + sw $v1, 164($sp) # internal_13 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + # internal_11 = internal_13 + lw $t0, 152($sp) + sw $t0, 160($sp) - # Argument internal_1 - lw $t0, 24($sp) - sw $t0, 4($sp) # Storing internal_1 + # If internal_11 then goto then_8794497432525 + lw $t0, 160($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8794497432525 - # Argument num - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing num + # Jumping to else_8794497432525 + j else_8794497432525 - # Calling function function_mult - jal function_mult - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_2 = result of function_mult - addi $sp, $sp, 12 # Freeing space for arguments + then_8794497432525: + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 148($sp) # internal_14 = address of allocated object Int + + # internal_10 = internal_14 + lw $t0, 148($sp) + sw $t0, 164($sp) - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 16($sp) - j end_assign - not_is_Bool_or_Int: - # x = internal_2 - lw $t0, 8($sp) - sw $t0, 16($sp) - end_assign: + # Jumping to endif_8794497432525 + j endif_8794497432525 - # Allocating E + else_8794497432525: + + # Allocating Bool 0 li $v0, 9 - lw $a0, type_E + addi $a0, $zero, 12 syscall - la $t0, type_E # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_3 = address of allocated object E - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 140($sp) # internal_16 = address of allocated object Int - # Argument internal_3 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_3 + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - # Calling function function___init___at_E - jal function___init___at_E - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_3 = result of function___init___at_E - addi $sp, $sp, 8 # Freeing space for arguments + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 51 + sb $t0, 8($v0) # internal_17[0] = '3' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 136($sp) # internal_17 = "3" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_3 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_3 + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char - # Argument x - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing x + # Argument internal_17 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_17 - # Calling function function_set_var_at_A - jal function_set_var_at_A + # Calling function function_equal + jal function_equal lw $ra, 8($sp) - sw $v1, 12($sp) # internal_4 = result of function_set_var_at_A + sw $v1, 144($sp) # internal_18 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 20 + # internal_16 = internal_18 + lw $t0, 132($sp) + sw $t0, 140($sp) - jr $ra + # If internal_16 then goto then_8794497432519 + lw $t0, 140($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8794497432519 - function___init___at_D: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) + # Jumping to else_8794497432519 + j else_8794497432519 - # Reserving space for local variables - addi $sp, $sp, -4 + then_8794497432519: - # Allocating Int 0 + # Allocating Int 3 li $v0, 9 addi $a0, $zero, 12 syscall @@ -2113,49 +3891,18 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Set attribute var of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_0 - sw $t1, 8($t0) # self.var = internal_0 - - # Loading return value in $v1 - lw $v1, 4($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_method7_at_D: - # Function parameters - # $ra = 116($sp) - # self = 112($sp) - # num = 108($sp) + sw $v0, 128($sp) # internal_19 = address of allocated object Int - # Reserving space for local variables - addi $sp, $sp, -108 + # internal_15 = internal_19 + lw $t0, 128($sp) + sw $t0, 144($sp) - lw $t0, 108($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 104($sp) - j end_assign - not_is_Bool_or_Int: - # x = num - lw $t0, 108($sp) - sw $t0, 104($sp) - end_assign: + # Jumping to endif_8794497432519 + j endif_8794497432519 + else_8794497432519: # Allocating Bool 0 li $v0, 9 @@ -2167,126 +3914,163 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 96($sp) # internal_2 = address of allocated object Int + sw $v0, 120($sp) # internal_21 = address of allocated object Int - # Allocating Int 0 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 92($sp) # internal_3 = address of allocated object Int + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 52 + sb $t0, 8($v0) # internal_22[0] = '4' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 116($sp) # internal_22 = "4" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument x - lw $t0, 116($sp) - sw $t0, 4($sp) # Storing x + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char - # Argument internal_3 - lw $t0, 104($sp) - sw $t0, 0($sp) # Storing internal_3 + # Argument internal_22 + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing internal_22 - # Calling function function_less_than - jal function_less_than + # Calling function function_equal + jal function_equal lw $ra, 8($sp) - sw $v1, 100($sp) # internal_4 = result of function_less_than + sw $v1, 124($sp) # internal_23 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 88($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 96($sp) - j end_assign - not_is_Bool_or_Int: - # internal_2 = internal_4 - lw $t0, 88($sp) - sw $t0, 96($sp) - end_assign: + # internal_21 = internal_23 + lw $t0, 112($sp) + sw $t0, 120($sp) - # If internal_2 then goto then_8743762784269 - lw $t0, 96($sp) # Loading the address of the condition + # If internal_21 then goto then_8794497432513 + lw $t0, 120($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762784269 + beq $t0, $t1, then_8794497432513 - # Jumping to else_8743762784269 - j else_8743762784269 + # Jumping to else_8794497432513 + j else_8794497432513 - then_8743762784269: + then_8794497432513: - # Xor operation - lw $t0, 104($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 80($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall - lw $t0, 76($sp) # $t0 = internal_7 - sw $t2, 8($t0) # Setting value in the third word of the Int object + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_24 = address of allocated object Int - # Addition operation - lw $t0, 76($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 84($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - add $t2, $t0, $t1 # $t2 = $t0 + $t1 + # internal_20 = internal_24 + lw $t0, 108($sp) + sw $t0, 124($sp) - lw $t0, 76($sp) # $t0 = internal_7 - sw $t2, 8($t0) # Setting value in the third word of the Int object + # Jumping to endif_8794497432513 + j endif_8794497432513 + + else_8794497432513: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_26 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 53 + sb $t0, 8($v0) # internal_27[0] = '5' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 96($sp) # internal_27 = "5" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 124($sp) - sw $t0, 4($sp) # Storing self + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char - # Argument internal_7 - lw $t0, 88($sp) - sw $t0, 0($sp) # Storing internal_7 + # Argument internal_27 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_27 - # Calling function function_method7_at_D - jal function_method7_at_D + # Calling function function_equal + jal function_equal lw $ra, 8($sp) - sw $v1, 84($sp) # internal_8 = result of function_method7_at_D + sw $v1, 104($sp) # internal_28 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 72($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 100($sp) - j end_assign - not_is_Bool_or_Int: - # internal_1 = internal_8 - lw $t0, 72($sp) + # internal_26 = internal_28 + lw $t0, 92($sp) sw $t0, 100($sp) - end_assign: - # Jumping to endif_8743762784269 - j endif_8743762784269 + # If internal_26 then goto then_8794497432507 + lw $t0, 100($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8794497432507 + + # Jumping to else_8794497432507 + j else_8794497432507 + + then_8794497432507: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_29 = address of allocated object Int + + # internal_25 = internal_29 + lw $t0, 88($sp) + sw $t0, 104($sp) - else_8743762784269: + # Jumping to endif_8794497432507 + j endif_8794497432507 + else_8794497432507: # Allocating Bool 0 li $v0, 9 @@ -2298,100 +4082,79 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 64($sp) # internal_10 = address of allocated object Int + sw $v0, 80($sp) # internal_31 = address of allocated object Int - # Allocating Int 0 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_11 = address of allocated object Int + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 54 + sb $t0, 8($v0) # internal_32[0] = '6' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 76($sp) # internal_32 = "6" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_11 - lw $t0, 72($sp) - sw $t0, 4($sp) # Storing internal_11 + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char - # Argument x - lw $t0, 116($sp) - sw $t0, 0($sp) # Storing x + # Argument internal_32 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_32 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 68($sp) # internal_12 = result of function_equal + sw $v1, 84($sp) # internal_33 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 56($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 64($sp) - j end_assign - not_is_Bool_or_Int: - # internal_10 = internal_12 - lw $t0, 56($sp) - sw $t0, 64($sp) - end_assign: + # internal_31 = internal_33 + lw $t0, 72($sp) + sw $t0, 80($sp) - # If internal_10 then goto then_8743762784260 - lw $t0, 64($sp) # Loading the address of the condition + # If internal_31 then goto then_8794497432501 + lw $t0, 80($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762784260 + beq $t0, $t1, then_8794497432501 - # Jumping to else_8743762784260 - j else_8743762784260 + # Jumping to else_8794497432501 + j else_8794497432501 - then_8743762784260: + then_8794497432501: - # Allocating Bool 1 + # Allocating Int 6 li $v0, 9 addi $a0, $zero, 12 syscall - la $t0, type_Bool # $t0 = address of the type + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 6 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 52($sp) # internal_13 = address of allocated object Int - - lw $t0, 52($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 68($sp) - j end_assign - not_is_Bool_or_Int: - # internal_9 = internal_13 - lw $t0, 52($sp) - sw $t0, 68($sp) - end_assign: + sw $v0, 68($sp) # internal_34 = address of allocated object Int - # Jumping to endif_8743762784260 - j endif_8743762784260 + # internal_30 = internal_34 + lw $t0, 68($sp) + sw $t0, 84($sp) - else_8743762784260: + # Jumping to endif_8794497432501 + j endif_8794497432501 + else_8794497432501: # Allocating Bool 0 li $v0, 9 @@ -2403,100 +4166,79 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_15 = address of allocated object Int + sw $v0, 60($sp) # internal_36 = address of allocated object Int - # Allocating Int 1 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_16 = address of allocated object Int + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 55 + sb $t0, 8($v0) # internal_37[0] = '7' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 56($sp) # internal_37 = "7" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_16 - lw $t0, 52($sp) - sw $t0, 4($sp) # Storing internal_16 + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char - # Argument x - lw $t0, 116($sp) - sw $t0, 0($sp) # Storing x + # Argument internal_37 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_37 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 48($sp) # internal_17 = result of function_equal + sw $v1, 64($sp) # internal_38 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 36($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: - # internal_15 = internal_17 - lw $t0, 36($sp) - sw $t0, 44($sp) - end_assign: + # internal_36 = internal_38 + lw $t0, 52($sp) + sw $t0, 60($sp) - # If internal_15 then goto then_8743762783991 - lw $t0, 44($sp) # Loading the address of the condition + # If internal_36 then goto then_8794497432495 + lw $t0, 60($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762783991 + beq $t0, $t1, then_8794497432495 - # Jumping to else_8743762783991 - j else_8743762783991 + # Jumping to else_8794497432495 + j else_8794497432495 - then_8743762783991: + then_8794497432495: - # Allocating Bool 0 + # Allocating Int 7 li $v0, 9 addi $a0, $zero, 12 syscall - la $t0, type_Bool # $t0 = address of the type + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 7 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_18 = address of allocated object Int - - lw $t0, 32($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 48($sp) - j end_assign - not_is_Bool_or_Int: - # internal_14 = internal_18 - lw $t0, 32($sp) - sw $t0, 48($sp) - end_assign: + sw $v0, 48($sp) # internal_39 = address of allocated object Int - # Jumping to endif_8743762783991 - j endif_8743762783991 + # internal_35 = internal_39 + lw $t0, 48($sp) + sw $t0, 64($sp) - else_8743762783991: + # Jumping to endif_8794497432495 + j endif_8794497432495 + else_8794497432495: # Allocating Bool 0 li $v0, 9 @@ -2508,253 +4250,144 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_20 = address of allocated object Int + sw $v0, 40($sp) # internal_41 = address of allocated object Int - # Allocating Int 2 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 2 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_21 = address of allocated object Int + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 56 + sb $t0, 8($v0) # internal_42[0] = '8' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 36($sp) # internal_42 = "8" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_21 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_21 + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char - # Argument x - lw $t0, 116($sp) - sw $t0, 0($sp) # Storing x + # Argument internal_42 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_42 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 28($sp) # internal_22 = result of function_equal + sw $v1, 44($sp) # internal_43 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: - # internal_20 = internal_22 - lw $t0, 16($sp) - sw $t0, 24($sp) - end_assign: + # internal_41 = internal_43 + lw $t0, 32($sp) + sw $t0, 40($sp) - # If internal_20 then goto then_8743762783997 - lw $t0, 24($sp) # Loading the address of the condition + # If internal_41 then goto then_8794497432489 + lw $t0, 40($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762783997 + beq $t0, $t1, then_8794497432489 - # Jumping to else_8743762783997 - j else_8743762783997 + # Jumping to else_8794497432489 + j else_8794497432489 - then_8743762783997: + then_8794497432489: - # Allocating Bool 0 + # Allocating Int 8 li $v0, 9 addi $a0, $zero, 12 syscall - la $t0, type_Bool # $t0 = address of the type + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 8 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_23 = address of allocated object Int + sw $v0, 28($sp) # internal_44 = address of allocated object Int - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 28($sp) - j end_assign - not_is_Bool_or_Int: - # internal_19 = internal_23 - lw $t0, 12($sp) - sw $t0, 28($sp) - end_assign: + # internal_40 = internal_44 + lw $t0, 28($sp) + sw $t0, 44($sp) - # Jumping to endif_8743762783997 - j endif_8743762783997 + # Jumping to endif_8794497432489 + j endif_8794497432489 - else_8743762783997: + else_8794497432489: - # Allocating Int 3 + # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_Bool # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 3 + addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_24 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument x - lw $t0, 116($sp) - sw $t0, 4($sp) # Storing x - - # Argument internal_24 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_24 - - # Calling function function_sub - jal function_sub - lw $ra, 8($sp) - sw $v1, 16($sp) # internal_25 = result of function_sub - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 124($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_25 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_25 - - # Calling function function_method7_at_D - jal function_method7_at_D - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_26 = result of function_method7_at_D - addi $sp, $sp, 12 # Freeing space for arguments - - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 28($sp) - j end_assign - not_is_Bool_or_Int: - # internal_19 = internal_26 - lw $t0, 0($sp) - sw $t0, 28($sp) - end_assign: - - # Jumping to endif_8743762783997 - j endif_8743762783997 - - endif_8743762783997: - - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 48($sp) - j end_assign - not_is_Bool_or_Int: - # internal_14 = internal_19 - lw $t0, 28($sp) - sw $t0, 48($sp) - end_assign: + sw $v0, 20($sp) # internal_46 = address of allocated object Int - # Jumping to endif_8743762783991 - j endif_8743762783991 + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - endif_8743762783991: + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - lw $t0, 48($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 68($sp) - j end_assign - not_is_Bool_or_Int: - # internal_9 = internal_14 - lw $t0, 48($sp) - sw $t0, 68($sp) - end_assign: + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - # Jumping to endif_8743762784260 - j endif_8743762784260 + addi $t0, $zero, 57 + sb $t0, 8($v0) # internal_47[0] = '9' - endif_8743762784260: + sb $zero, 9($v0) # Null-terminator at the end of the string - lw $t0, 68($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 100($sp) - j end_assign - not_is_Bool_or_Int: - # internal_1 = internal_9 - lw $t0, 68($sp) - sw $t0, 100($sp) - end_assign: + sw $v0, 16($sp) # internal_47 = "9" - # Jumping to endif_8743762784269 - j endif_8743762784269 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - endif_8743762784269: + # Argument char + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing char - # Loading return value in $v1 - lw $v1, 100($sp) + # Argument internal_47 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_47 - # Freeing space for local variables - addi $sp, $sp, 108 + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_48 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments - jr $ra + # internal_46 = internal_48 + lw $t0, 12($sp) + sw $t0, 20($sp) - function___init___at_E: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) + # If internal_46 then goto then_8794497432468 + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8794497432468 - # Reserving space for local variables - addi $sp, $sp, -4 + # Jumping to else_8794497432468 + j else_8794497432468 - # Allocating Int 0 + then_8794497432468: + + # Allocating Int 9 li $v0, 9 addi $a0, $zero, 12 syscall @@ -2762,33 +4395,34 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 9 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int + sw $v0, 8($sp) # internal_49 = address of allocated object Int - # Set attribute var of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_0 - sw $t1, 8($t0) # self.var = internal_0 + # internal_45 = internal_49 + lw $t0, 8($sp) + sw $t0, 24($sp) - # Loading return value in $v1 - lw $v1, 4($sp) + # Jumping to endif_8794497432468 + j endif_8794497432468 - # Freeing space for local variables - addi $sp, $sp, 4 + else_8794497432468: - jr $ra + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - function_method6_at_E: - # Function parameters - # $ra = 28($sp) - # self = 24($sp) - # num = 20($sp) + # Argument self + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing self - # Reserving space for local variables - addi $sp, $sp, -20 + # Calling function function_abort_at_Object + jal function_abort_at_Object + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_50 = result of function_abort_at_Object + addi $sp, $sp, 8 # Freeing space for arguments - # Allocating Int 8 + # Allocating Int 0 li $v0, 9 addi $a0, $zero, 12 syscall @@ -2796,114 +4430,117 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 8 + addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_1 = address of allocated object Int + sw $v0, 0($sp) # internal_51 = address of allocated object Int - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + # internal_45 = internal_51 + lw $t0, 0($sp) + sw $t0, 24($sp) - # Argument num - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing num + # Jumping to endif_8794497432468 + j endif_8794497432468 - # Argument internal_1 + endif_8794497432468: + + # internal_40 = internal_45 lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_1 + sw $t0, 44($sp) - # Calling function function_div - jal function_div - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_2 = result of function_div - addi $sp, $sp, 12 # Freeing space for arguments + # Jumping to endif_8794497432489 + j endif_8794497432489 - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 16($sp) - j end_assign - not_is_Bool_or_Int: - # x = internal_2 - lw $t0, 8($sp) - sw $t0, 16($sp) - end_assign: + endif_8794497432489: - # Allocating A - li $v0, 9 - lw $a0, type_A - syscall - la $t0, type_A # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_3 = address of allocated object A + # internal_35 = internal_40 + lw $t0, 44($sp) + sw $t0, 64($sp) - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + # Jumping to endif_8794497432495 + j endif_8794497432495 - # Argument internal_3 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_3 + endif_8794497432495: - # Calling function function___init___at_A - jal function___init___at_A - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_3 = result of function___init___at_A - addi $sp, $sp, 8 # Freeing space for arguments + # internal_30 = internal_35 + lw $t0, 64($sp) + sw $t0, 84($sp) - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + # Jumping to endif_8794497432501 + j endif_8794497432501 - # Argument internal_3 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_3 + endif_8794497432501: - # Argument x - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing x + # internal_25 = internal_30 + lw $t0, 84($sp) + sw $t0, 104($sp) - # Calling function function_set_var_at_A - jal function_set_var_at_A - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_4 = result of function_set_var_at_A - addi $sp, $sp, 12 # Freeing space for arguments + # Jumping to endif_8794497432507 + j endif_8794497432507 - # Loading return value in $v1 - lw $v1, 0($sp) + endif_8794497432507: - # Freeing space for local variables - addi $sp, $sp, 20 + # internal_20 = internal_25 + lw $t0, 104($sp) + sw $t0, 124($sp) - jr $ra + # Jumping to endif_8794497432513 + j endif_8794497432513 - function___init___at_A2I: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) + endif_8794497432513: + + # internal_15 = internal_20 + lw $t0, 124($sp) + sw $t0, 144($sp) + + # Jumping to endif_8794497432519 + j endif_8794497432519 + + endif_8794497432519: + + # internal_10 = internal_15 + lw $t0, 144($sp) + sw $t0, 164($sp) + + # Jumping to endif_8794497432525 + j endif_8794497432525 + + endif_8794497432525: + + # internal_5 = internal_10 + lw $t0, 164($sp) + sw $t0, 184($sp) + + # Jumping to endif_8794497432531 + j endif_8794497432531 + + endif_8794497432531: + + # internal_0 = internal_5 + lw $t0, 184($sp) + sw $t0, 204($sp) + + # Jumping to endif_8794497432537 + j endif_8794497432537 + + endif_8794497432537: # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 204($sp) + + # Freeing space for local variables + addi $sp, $sp, 208 jr $ra - function_c2i_at_A2I: + function_i2c_at_A2I: # Function parameters # $ra = 216($sp) # self = 212($sp) - # char = 208($sp) + # i = 208($sp) # Reserving space for local variables addi $sp, $sp, -208 - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -2916,31 +4553,25 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 200($sp) # internal_1 = address of allocated object Int - # Allocating String + # Allocating Int 0 li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 48 - sb $t0, 8($v0) # internal_2[0] = '0' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 196($sp) # internal_2 = "0" + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 196($sp) # internal_2 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument char + # Argument i lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char + sw $t0, 4($sp) # Storing i # Argument internal_2 lw $t0, 208($sp) @@ -2952,68 +4583,47 @@ sw $v1, 204($sp) # internal_3 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 192($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 200($sp) - j end_assign - not_is_Bool_or_Int: # internal_1 = internal_3 lw $t0, 192($sp) sw $t0, 200($sp) - end_assign: - # If internal_1 then goto then_8743762785175 + # If internal_1 then goto then_8794497433375 lw $t0, 200($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762785175 + beq $t0, $t1, then_8794497433375 - # Jumping to else_8743762785175 - j else_8743762785175 + # Jumping to else_8794497433375 + j else_8794497433375 - then_8743762785175: + then_8794497433375: - # Allocating Int 0 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 188($sp) # internal_4 = address of allocated object Int - lw $t0, 188($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 204($sp) - j end_assign - not_is_Bool_or_Int: + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 48 + sb $t0, 8($v0) # internal_4[0] = '0' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 188($sp) # internal_4 = "0" + # internal_0 = internal_4 lw $t0, 188($sp) sw $t0, 204($sp) - end_assign: - # Jumping to endif_8743762785175 - j endif_8743762785175 - - else_8743762785175: + # Jumping to endif_8794497433375 + j endif_8794497433375 + else_8794497433375: # Allocating Bool 0 li $v0, 9 @@ -3027,31 +4637,25 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 180($sp) # internal_6 = address of allocated object Int - # Allocating String + # Allocating Int 1 li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object - + sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 49 - sb $t0, 8($v0) # internal_7[0] = '1' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 176($sp) # internal_7 = "1" + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 176($sp) # internal_7 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument char + # Argument i lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char + sw $t0, 4($sp) # Storing i # Argument internal_7 lw $t0, 188($sp) @@ -3063,68 +4667,47 @@ sw $v1, 184($sp) # internal_8 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 172($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 180($sp) - j end_assign - not_is_Bool_or_Int: # internal_6 = internal_8 lw $t0, 172($sp) sw $t0, 180($sp) - end_assign: - # If internal_6 then goto then_8743762785169 + # If internal_6 then goto then_8794497433369 lw $t0, 180($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762785169 + beq $t0, $t1, then_8794497433369 - # Jumping to else_8743762785169 - j else_8743762785169 + # Jumping to else_8794497433369 + j else_8794497433369 - then_8743762785169: + then_8794497433369: - # Allocating Int 1 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 168($sp) # internal_9 = address of allocated object Int - lw $t0, 168($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 184($sp) - j end_assign - not_is_Bool_or_Int: + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 49 + sb $t0, 8($v0) # internal_9[0] = '1' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 168($sp) # internal_9 = "1" + # internal_5 = internal_9 lw $t0, 168($sp) sw $t0, 184($sp) - end_assign: - - # Jumping to endif_8743762785169 - j endif_8743762785169 - else_8743762785169: + # Jumping to endif_8794497433369 + j endif_8794497433369 + else_8794497433369: # Allocating Bool 0 li $v0, 9 @@ -3138,31 +4721,25 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 160($sp) # internal_11 = address of allocated object Int - # Allocating String + # Allocating Int 2 li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 50 - sb $t0, 8($v0) # internal_12[0] = '2' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 156($sp) # internal_12 = "2" + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 156($sp) # internal_12 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument char + # Argument i lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char + sw $t0, 4($sp) # Storing i # Argument internal_12 lw $t0, 168($sp) @@ -3174,68 +4751,47 @@ sw $v1, 164($sp) # internal_13 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 152($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 160($sp) - j end_assign - not_is_Bool_or_Int: # internal_11 = internal_13 lw $t0, 152($sp) sw $t0, 160($sp) - end_assign: - # If internal_11 then goto then_8743762785163 + # If internal_11 then goto then_8794497433363 lw $t0, 160($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762785163 + beq $t0, $t1, then_8794497433363 - # Jumping to else_8743762785163 - j else_8743762785163 + # Jumping to else_8794497433363 + j else_8794497433363 - then_8743762785163: + then_8794497433363: - # Allocating Int 2 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 2 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 148($sp) # internal_14 = address of allocated object Int - lw $t0, 148($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 164($sp) - j end_assign - not_is_Bool_or_Int: + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 50 + sb $t0, 8($v0) # internal_14[0] = '2' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 148($sp) # internal_14 = "2" + # internal_10 = internal_14 lw $t0, 148($sp) sw $t0, 164($sp) - end_assign: - # Jumping to endif_8743762785163 - j endif_8743762785163 - - else_8743762785163: + # Jumping to endif_8794497433363 + j endif_8794497433363 + else_8794497433363: # Allocating Bool 0 li $v0, 9 @@ -3249,31 +4805,25 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 140($sp) # internal_16 = address of allocated object Int - # Allocating String + # Allocating Int 3 li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 51 - sb $t0, 8($v0) # internal_17[0] = '3' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 136($sp) # internal_17 = "3" + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_17 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument char + # Argument i lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char + sw $t0, 4($sp) # Storing i # Argument internal_17 lw $t0, 148($sp) @@ -3285,68 +4835,47 @@ sw $v1, 144($sp) # internal_18 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 132($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 140($sp) - j end_assign - not_is_Bool_or_Int: # internal_16 = internal_18 lw $t0, 132($sp) sw $t0, 140($sp) - end_assign: - # If internal_16 then goto then_8743762785157 + # If internal_16 then goto then_8794497433357 lw $t0, 140($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762785157 + beq $t0, $t1, then_8794497433357 - # Jumping to else_8743762785157 - j else_8743762785157 + # Jumping to else_8794497433357 + j else_8794497433357 - then_8743762785157: + then_8794497433357: - # Allocating Int 3 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 3 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 128($sp) # internal_19 = address of allocated object Int - lw $t0, 128($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 144($sp) - j end_assign - not_is_Bool_or_Int: + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 51 + sb $t0, 8($v0) # internal_19[0] = '3' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 128($sp) # internal_19 = "3" + # internal_15 = internal_19 lw $t0, 128($sp) sw $t0, 144($sp) - end_assign: - - # Jumping to endif_8743762785157 - j endif_8743762785157 - else_8743762785157: + # Jumping to endif_8794497433357 + j endif_8794497433357 + else_8794497433357: # Allocating Bool 0 li $v0, 9 @@ -3360,31 +4889,25 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 120($sp) # internal_21 = address of allocated object Int - # Allocating String + # Allocating Int 4 li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 52 - sb $t0, 8($v0) # internal_22[0] = '4' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 116($sp) # internal_22 = "4" + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 116($sp) # internal_22 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument char + # Argument i lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char + sw $t0, 4($sp) # Storing i # Argument internal_22 lw $t0, 128($sp) @@ -3396,68 +4919,47 @@ sw $v1, 124($sp) # internal_23 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 112($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 120($sp) - j end_assign - not_is_Bool_or_Int: # internal_21 = internal_23 lw $t0, 112($sp) sw $t0, 120($sp) - end_assign: - # If internal_21 then goto then_8743762785151 + # If internal_21 then goto then_8794497433351 lw $t0, 120($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762785151 + beq $t0, $t1, then_8794497433351 - # Jumping to else_8743762785151 - j else_8743762785151 + # Jumping to else_8794497433351 + j else_8794497433351 - then_8743762785151: + then_8794497433351: - # Allocating Int 4 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 4 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 108($sp) # internal_24 = address of allocated object Int - lw $t0, 108($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 124($sp) - j end_assign - not_is_Bool_or_Int: + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 52 + sb $t0, 8($v0) # internal_24[0] = '4' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 108($sp) # internal_24 = "4" + # internal_20 = internal_24 lw $t0, 108($sp) sw $t0, 124($sp) - end_assign: - # Jumping to endif_8743762785151 - j endif_8743762785151 - - else_8743762785151: + # Jumping to endif_8794497433351 + j endif_8794497433351 + else_8794497433351: # Allocating Bool 0 li $v0, 9 @@ -3471,31 +4973,25 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 100($sp) # internal_26 = address of allocated object Int - # Allocating String + # Allocating Int 5 li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 53 - sb $t0, 8($v0) # internal_27[0] = '5' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 96($sp) # internal_27 = "5" + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_27 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument char + # Argument i lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char + sw $t0, 4($sp) # Storing i # Argument internal_27 lw $t0, 108($sp) @@ -3507,68 +5003,47 @@ sw $v1, 104($sp) # internal_28 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 92($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 100($sp) - j end_assign - not_is_Bool_or_Int: # internal_26 = internal_28 lw $t0, 92($sp) sw $t0, 100($sp) - end_assign: - # If internal_26 then goto then_8743762785145 + # If internal_26 then goto then_8794497433085 lw $t0, 100($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762785145 + beq $t0, $t1, then_8794497433085 - # Jumping to else_8743762785145 - j else_8743762785145 + # Jumping to else_8794497433085 + j else_8794497433085 - then_8743762785145: + then_8794497433085: - # Allocating Int 5 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 5 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 88($sp) # internal_29 = address of allocated object Int - lw $t0, 88($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 104($sp) - j end_assign - not_is_Bool_or_Int: + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 53 + sb $t0, 8($v0) # internal_29[0] = '5' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 88($sp) # internal_29 = "5" + # internal_25 = internal_29 lw $t0, 88($sp) sw $t0, 104($sp) - end_assign: - - # Jumping to endif_8743762785145 - j endif_8743762785145 - else_8743762785145: + # Jumping to endif_8794497433085 + j endif_8794497433085 + else_8794497433085: # Allocating Bool 0 li $v0, 9 @@ -3582,31 +5057,25 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 80($sp) # internal_31 = address of allocated object Int - # Allocating String + # Allocating Int 6 li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 54 - sb $t0, 8($v0) # internal_32[0] = '6' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 76($sp) # internal_32 = "6" + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_32 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument char + # Argument i lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char + sw $t0, 4($sp) # Storing i # Argument internal_32 lw $t0, 88($sp) @@ -3618,68 +5087,47 @@ sw $v1, 84($sp) # internal_33 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 72($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 80($sp) - j end_assign - not_is_Bool_or_Int: # internal_31 = internal_33 lw $t0, 72($sp) sw $t0, 80($sp) - end_assign: - # If internal_31 then goto then_8743762785139 + # If internal_31 then goto then_8794497433079 lw $t0, 80($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762785139 + beq $t0, $t1, then_8794497433079 - # Jumping to else_8743762785139 - j else_8743762785139 + # Jumping to else_8794497433079 + j else_8794497433079 - then_8743762785139: + then_8794497433079: - # Allocating Int 6 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 6 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 68($sp) # internal_34 = address of allocated object Int + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 54 + sb $t0, 8($v0) # internal_34[0] = '6' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 68($sp) # internal_34 = "6" - lw $t0, 68($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 84($sp) - j end_assign - not_is_Bool_or_Int: # internal_30 = internal_34 lw $t0, 68($sp) sw $t0, 84($sp) - end_assign: - # Jumping to endif_8743762785139 - j endif_8743762785139 - - else_8743762785139: + # Jumping to endif_8794497433079 + j endif_8794497433079 + else_8794497433079: # Allocating Bool 0 li $v0, 9 @@ -3693,31 +5141,25 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 60($sp) # internal_36 = address of allocated object Int - # Allocating String + # Allocating Int 7 li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 55 - sb $t0, 8($v0) # internal_37[0] = '7' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 56($sp) # internal_37 = "7" + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_37 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument char + # Argument i lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char + sw $t0, 4($sp) # Storing i # Argument internal_37 lw $t0, 68($sp) @@ -3729,68 +5171,47 @@ sw $v1, 64($sp) # internal_38 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 52($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: # internal_36 = internal_38 lw $t0, 52($sp) sw $t0, 60($sp) - end_assign: - # If internal_36 then goto then_8743762785133 + # If internal_36 then goto then_8794497433073 lw $t0, 60($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762785133 + beq $t0, $t1, then_8794497433073 - # Jumping to else_8743762785133 - j else_8743762785133 + # Jumping to else_8794497433073 + j else_8794497433073 - then_8743762785133: + then_8794497433073: - # Allocating Int 7 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 7 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_39 = address of allocated object Int - lw $t0, 48($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 64($sp) - j end_assign - not_is_Bool_or_Int: + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 55 + sb $t0, 8($v0) # internal_39[0] = '7' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 48($sp) # internal_39 = "7" + # internal_35 = internal_39 lw $t0, 48($sp) sw $t0, 64($sp) - end_assign: - - # Jumping to endif_8743762785133 - j endif_8743762785133 - else_8743762785133: + # Jumping to endif_8794497433073 + j endif_8794497433073 + else_8794497433073: # Allocating Bool 0 li $v0, 9 @@ -3804,31 +5225,25 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 40($sp) # internal_41 = address of allocated object Int - # Allocating String + # Allocating Int 8 li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 56 - sb $t0, 8($v0) # internal_42[0] = '8' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 36($sp) # internal_42 = "8" + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_42 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument char + # Argument i lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char + sw $t0, 4($sp) # Storing i # Argument internal_42 lw $t0, 48($sp) @@ -3840,68 +5255,47 @@ sw $v1, 44($sp) # internal_43 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 32($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: # internal_41 = internal_43 lw $t0, 32($sp) sw $t0, 40($sp) - end_assign: - # If internal_41 then goto then_8743762785127 + # If internal_41 then goto then_8794497433067 lw $t0, 40($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762785127 + beq $t0, $t1, then_8794497433067 - # Jumping to else_8743762785127 - j else_8743762785127 + # Jumping to else_8794497433067 + j else_8794497433067 - then_8743762785127: + then_8794497433067: - # Allocating Int 8 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 8 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_44 = address of allocated object Int - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 56 + sb $t0, 8($v0) # internal_44[0] = '8' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 28($sp) # internal_44 = "8" + # internal_40 = internal_44 lw $t0, 28($sp) sw $t0, 44($sp) - end_assign: - # Jumping to endif_8743762785127 - j endif_8743762785127 - - else_8743762785127: + # Jumping to endif_8794497433067 + j endif_8794497433067 + else_8794497433067: # Allocating Bool 0 li $v0, 9 @@ -3915,31 +5309,25 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 20($sp) # internal_46 = address of allocated object Int - # Allocating String + # Allocating Int 9 li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 57 - sb $t0, 8($v0) # internal_47[0] = '9' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 16($sp) # internal_47 = "9" + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_47 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument char + # Argument i lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char + sw $t0, 4($sp) # Storing i # Argument internal_47 lw $t0, 28($sp) @@ -3951,67 +5339,47 @@ sw $v1, 24($sp) # internal_48 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 20($sp) - j end_assign - not_is_Bool_or_Int: # internal_46 = internal_48 lw $t0, 12($sp) sw $t0, 20($sp) - end_assign: - # If internal_46 then goto then_8743762785106 + # If internal_46 then goto then_8794497433046 lw $t0, 20($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762785106 + beq $t0, $t1, then_8794497433046 - # Jumping to else_8743762785106 - j else_8743762785106 + # Jumping to else_8794497433046 + j else_8794497433046 - then_8743762785106: + then_8794497433046: - # Allocating Int 9 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 9 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_49 = address of allocated object Int - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 57 + sb $t0, 8($v0) # internal_49[0] = '9' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_49 = "9" + # internal_45 = internal_49 lw $t0, 8($sp) sw $t0, 24($sp) - end_assign: - # Jumping to endif_8743762785106 - j endif_8743762785106 + # Jumping to endif_8794497433046 + j endif_8794497433046 - else_8743762785106: + else_8794497433046: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments @@ -4027,237 +5395,110 @@ sw $v1, 12($sp) # internal_50 = result of function_abort_at_Object addi $sp, $sp, 8 # Freeing space for arguments - # Allocating Int 0 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_51 = address of allocated object Int - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_51 = "" + # internal_45 = internal_51 lw $t0, 0($sp) sw $t0, 24($sp) - end_assign: - # Jumping to endif_8743762785106 - j endif_8743762785106 + # Jumping to endif_8794497433046 + j endif_8794497433046 - endif_8743762785106: + endif_8794497433046: - lw $t0, 24($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: # internal_40 = internal_45 lw $t0, 24($sp) sw $t0, 44($sp) - end_assign: - # Jumping to endif_8743762785127 - j endif_8743762785127 + # Jumping to endif_8794497433067 + j endif_8794497433067 - endif_8743762785127: + endif_8794497433067: - lw $t0, 44($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 64($sp) - j end_assign - not_is_Bool_or_Int: # internal_35 = internal_40 lw $t0, 44($sp) sw $t0, 64($sp) - end_assign: - # Jumping to endif_8743762785133 - j endif_8743762785133 + # Jumping to endif_8794497433073 + j endif_8794497433073 - endif_8743762785133: + endif_8794497433073: - lw $t0, 64($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 84($sp) - j end_assign - not_is_Bool_or_Int: # internal_30 = internal_35 lw $t0, 64($sp) sw $t0, 84($sp) - end_assign: - # Jumping to endif_8743762785139 - j endif_8743762785139 + # Jumping to endif_8794497433079 + j endif_8794497433079 - endif_8743762785139: + endif_8794497433079: - lw $t0, 84($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 104($sp) - j end_assign - not_is_Bool_or_Int: # internal_25 = internal_30 lw $t0, 84($sp) sw $t0, 104($sp) - end_assign: - # Jumping to endif_8743762785145 - j endif_8743762785145 + # Jumping to endif_8794497433085 + j endif_8794497433085 - endif_8743762785145: + endif_8794497433085: - lw $t0, 104($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 124($sp) - j end_assign - not_is_Bool_or_Int: # internal_20 = internal_25 lw $t0, 104($sp) sw $t0, 124($sp) - end_assign: - # Jumping to endif_8743762785151 - j endif_8743762785151 + # Jumping to endif_8794497433351 + j endif_8794497433351 - endif_8743762785151: + endif_8794497433351: - lw $t0, 124($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 144($sp) - j end_assign - not_is_Bool_or_Int: # internal_15 = internal_20 lw $t0, 124($sp) sw $t0, 144($sp) - end_assign: - # Jumping to endif_8743762785157 - j endif_8743762785157 + # Jumping to endif_8794497433357 + j endif_8794497433357 - endif_8743762785157: + endif_8794497433357: - lw $t0, 144($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 164($sp) - j end_assign - not_is_Bool_or_Int: # internal_10 = internal_15 lw $t0, 144($sp) sw $t0, 164($sp) - end_assign: - # Jumping to endif_8743762785163 - j endif_8743762785163 + # Jumping to endif_8794497433363 + j endif_8794497433363 - endif_8743762785163: + endif_8794497433363: - lw $t0, 164($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 184($sp) - j end_assign - not_is_Bool_or_Int: # internal_5 = internal_10 lw $t0, 164($sp) sw $t0, 184($sp) - end_assign: - # Jumping to endif_8743762785169 - j endif_8743762785169 + # Jumping to endif_8794497433369 + j endif_8794497433369 - endif_8743762785169: + endif_8794497433369: - lw $t0, 184($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 204($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_5 lw $t0, 184($sp) sw $t0, 204($sp) - end_assign: - # Jumping to endif_8743762785175 - j endif_8743762785175 + # Jumping to endif_8794497433375 + j endif_8794497433375 - endif_8743762785175: + endif_8794497433375: # Loading return value in $v1 lw $v1, 204($sp) @@ -4265,17 +5506,108 @@ # Freeing space for local variables addi $sp, $sp, 208 - jr $ra + jr $ra + + function_a2i_at_A2I: + # Function parameters + # $ra = 152($sp) + # self = 148($sp) + # s = 144($sp) + + # Reserving space for local variables + addi $sp, $sp, -144 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 140($sp) # internal_2 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 144($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 140($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 136($sp) # internal_4 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_4 + lw $t0, 124($sp) + sw $t0, 136($sp) + + # If internal_1 then goto then_8794497433561 + lw $t0, 136($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8794497433561 + + # Jumping to else_8794497433561 + j else_8794497433561 + + then_8794497433561: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_5 = address of allocated object Int - function_i2c_at_A2I: - # Function parameters - # $ra = 216($sp) - # self = 212($sp) - # i = 208($sp) + # internal_0 = internal_5 + lw $t0, 120($sp) + sw $t0, 140($sp) - # Reserving space for local variables - addi $sp, $sp, -208 + # Jumping to endif_8794497433561 + j endif_8794497433561 + else_8794497433561: # Allocating Bool 0 li $v0, 9 @@ -4287,7 +5619,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 200($sp) # internal_1 = address of allocated object Int + sw $v0, 112($sp) # internal_7 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -4299,53 +5631,41 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 196($sp) # internal_2 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + sw $v0, 108($sp) # internal_8 = address of allocated object Int - # Argument i - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing i + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Argument internal_2 - lw $t0, 208($sp) - sw $t0, 0($sp) # Storing internal_2 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_9 = address of allocated object Int - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 204($sp) # internal_3 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address - lw $t0, 192($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 200($sp) - j end_assign - not_is_Bool_or_Int: - # internal_1 = internal_3 - lw $t0, 192($sp) - sw $t0, 200($sp) - end_assign: + # Argument s + lw $t0, 160($sp) + sw $t0, 8($sp) # Storing s - # If internal_1 then goto then_8743762786009 - lw $t0, 200($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762786009 + # Argument internal_8 + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing internal_8 - # Jumping to else_8743762786009 - j else_8743762786009 + # Argument internal_9 + lw $t0, 120($sp) + sw $t0, 0($sp) # Storing internal_9 - then_8743762786009: + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 116($sp) # internal_10 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments # Allocating String li $v0, 9 @@ -4355,50 +5675,74 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 48 - sb $t0, 8($v0) # internal_4[0] = '0' + addi $t0, $zero, 45 + sb $t0, 8($v0) # internal_11[0] = '-' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 188($sp) # internal_4 = "0" + sw $v0, 96($sp) # internal_11 = "-" - lw $t0, 188($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 204($sp) - j end_assign - not_is_Bool_or_Int: - # internal_0 = internal_4 - lw $t0, 188($sp) - sw $t0, 204($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_11 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 104($sp) # internal_12 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_7 = internal_12 + lw $t0, 92($sp) + sw $t0, 112($sp) - # Jumping to endif_8743762786009 - j endif_8743762786009 + # If internal_7 then goto then_8794497433576 + lw $t0, 112($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8794497433576 - else_8743762786009: + # Jumping to else_8794497433576 + j else_8794497433576 + then_8794497433576: - # Allocating Bool 0 + # Allocating Int 1 li $v0, 9 addi $a0, $zero, 12 syscall - la $t0, type_Bool # $t0 = address of the type + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 180($sp) # internal_6 = address of allocated object Int + sw $v0, 88($sp) # internal_13 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 92($sp) # internal_14 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 1 li $v0, 9 @@ -4410,94 +5754,146 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 176($sp) # internal_7 = address of allocated object Int + sw $v0, 80($sp) # internal_15 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument i - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing i + # Argument internal_14 + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing internal_14 - # Argument internal_7 - lw $t0, 188($sp) - sw $t0, 0($sp) # Storing internal_7 + # Argument internal_15 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_15 - # Calling function function_equal - jal function_equal + # Calling function function_sub + jal function_sub lw $ra, 8($sp) - sw $v1, 184($sp) # internal_8 = result of function_equal + sw $v1, 88($sp) # internal_16 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 172($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 180($sp) - j end_assign - not_is_Bool_or_Int: - # internal_6 = internal_8 - lw $t0, 172($sp) - sw $t0, 180($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address - # If internal_6 then goto then_8743762786003 - lw $t0, 180($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762786003 + # Argument s + lw $t0, 160($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_13 + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing internal_13 - # Jumping to else_8743762786003 - j else_8743762786003 + # Argument internal_16 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_16 - then_8743762786003: + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 88($sp) # internal_17 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments - # Allocating String + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_17 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_17 + + # Calling function function_a2i_aux_at_A2I + jal function_a2i_aux_at_A2I + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_18 = result of function_a2i_aux_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object - + sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_19 = address of allocated object Int - addi $t0, $zero, 49 - sb $t0, 8($v0) # internal_9[0] = '1' + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall - sb $zero, 9($v0) # Null-terminator at the end of the string + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_20 = address of allocated object Int - sw $v0, 168($sp) # internal_9 = "1" + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - lw $t0, 168($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 184($sp) - j end_assign - not_is_Bool_or_Int: - # internal_5 = internal_9 - lw $t0, 168($sp) - sw $t0, 184($sp) - end_assign: + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_21 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_18 + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing internal_18 + + # Argument internal_20 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_21 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_21 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_21 + + # Argument internal_19 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_19 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_21 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to endif_8743762786003 - j endif_8743762786003 + # internal_6 = internal_21 + lw $t0, 56($sp) + sw $t0, 116($sp) - else_8743762786003: + # Jumping to endif_8794497433576 + j endif_8794497433576 + else_8794497433576: # Allocating Bool 0 li $v0, 9 @@ -4509,9 +5905,9 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 160($sp) # internal_11 = address of allocated object Int + sw $v0, 48($sp) # internal_23 = address of allocated object Int - # Allocating Int 2 + # Allocating Int 0 li $v0, 9 addi $a0, $zero, 12 syscall @@ -4519,55 +5915,43 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 2 + addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 156($sp) # internal_12 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + sw $v0, 44($sp) # internal_24 = address of allocated object Int - # Argument i - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing i + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Argument internal_12 - lw $t0, 168($sp) - sw $t0, 0($sp) # Storing internal_12 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_25 = address of allocated object Int - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 164($sp) # internal_13 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address - lw $t0, 152($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 160($sp) - j end_assign - not_is_Bool_or_Int: - # internal_11 = internal_13 - lw $t0, 152($sp) - sw $t0, 160($sp) - end_assign: + # Argument s + lw $t0, 160($sp) + sw $t0, 8($sp) # Storing s - # If internal_11 then goto then_8743762785997 - lw $t0, 160($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762785997 + # Argument internal_24 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing internal_24 - # Jumping to else_8743762785997 - j else_8743762785997 + # Argument internal_25 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_25 - then_8743762785997: + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 52($sp) # internal_26 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments # Allocating String li $v0, 9 @@ -4577,52 +5961,76 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 50 - sb $t0, 8($v0) # internal_14[0] = '2' + addi $t0, $zero, 43 + sb $t0, 8($v0) # internal_27[0] = '+' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 148($sp) # internal_14 = "2" + sw $v0, 32($sp) # internal_27 = "+" - lw $t0, 148($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 164($sp) - j end_assign - not_is_Bool_or_Int: - # internal_10 = internal_14 - lw $t0, 148($sp) - sw $t0, 164($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_26 + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing internal_26 - # Jumping to endif_8743762785997 - j endif_8743762785997 + # Argument internal_27 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_27 - else_8743762785997: + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_28 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + # internal_23 = internal_28 + lw $t0, 28($sp) + sw $t0, 48($sp) - # Allocating Bool 0 + # If internal_23 then goto then_8794497433570 + lw $t0, 48($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8794497433570 + + # Jumping to else_8794497433570 + j else_8794497433570 + + then_8794497433570: + + # Allocating Int 1 li $v0, 9 addi $a0, $zero, 12 syscall - la $t0, type_Bool # $t0 = address of the type + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 140($sp) # internal_16 = address of allocated object Int + sw $v0, 24($sp) # internal_29 = address of allocated object Int - # Allocating Int 3 + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_30 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 li $v0, 9 addi $a0, $zero, 12 syscall @@ -4630,221 +6038,202 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 3 + addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 136($sp) # internal_17 = address of allocated object Int + sw $v0, 16($sp) # internal_31 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument i - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing i + # Argument internal_30 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_30 - # Argument internal_17 - lw $t0, 148($sp) - sw $t0, 0($sp) # Storing internal_17 + # Argument internal_31 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_31 - # Calling function function_equal - jal function_equal + # Calling function function_sub + jal function_sub lw $ra, 8($sp) - sw $v1, 144($sp) # internal_18 = result of function_equal + sw $v1, 24($sp) # internal_32 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 132($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 140($sp) - j end_assign - not_is_Bool_or_Int: - # internal_16 = internal_18 - lw $t0, 132($sp) - sw $t0, 140($sp) - end_assign: - - # If internal_16 then goto then_8743762785991 - lw $t0, 140($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762785991 - - # Jumping to else_8743762785991 - j else_8743762785991 - - then_8743762785991: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address - addi $t0, $zero, 51 - sb $t0, 8($v0) # internal_19[0] = '3' + # Argument s + lw $t0, 160($sp) + sw $t0, 8($sp) # Storing s - sb $zero, 9($v0) # Null-terminator at the end of the string + # Argument internal_29 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_29 - sw $v0, 128($sp) # internal_19 = "3" + # Argument internal_32 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_32 - lw $t0, 128($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 144($sp) - j end_assign - not_is_Bool_or_Int: - # internal_15 = internal_19 - lw $t0, 128($sp) - sw $t0, 144($sp) - end_assign: + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 24($sp) # internal_33 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments - # Jumping to endif_8743762785991 - j endif_8743762785991 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - else_8743762785991: + # Argument self + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing self + # Argument internal_33 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_33 - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + # Calling function function_a2i_aux_at_A2I + jal function_a2i_aux_at_A2I + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_34 = result of function_a2i_aux_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 120($sp) # internal_21 = address of allocated object Int + # internal_22 = internal_34 + lw $t0, 4($sp) + sw $t0, 52($sp) - # Allocating Int 4 - li $v0, 9 - addi $a0, $zero, 12 - syscall + # Jumping to endif_8794497433570 + j endif_8794497433570 - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 4 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 116($sp) # internal_22 = address of allocated object Int + else_8794497433570: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument i - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing i + # Argument self + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing self - # Argument internal_22 - lw $t0, 128($sp) - sw $t0, 0($sp) # Storing internal_22 + # Argument s + lw $t0, 156($sp) + sw $t0, 0($sp) # Storing s - # Calling function function_equal - jal function_equal + # Calling function function_a2i_aux_at_A2I + jal function_a2i_aux_at_A2I lw $ra, 8($sp) - sw $v1, 124($sp) # internal_23 = result of function_equal + sw $v1, 12($sp) # internal_35 = result of function_a2i_aux_at_A2I addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 112($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 120($sp) - j end_assign - not_is_Bool_or_Int: - # internal_21 = internal_23 - lw $t0, 112($sp) - sw $t0, 120($sp) - end_assign: - - # If internal_21 then goto then_8743762785985 - lw $t0, 120($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762785985 + # internal_22 = internal_35 + lw $t0, 0($sp) + sw $t0, 52($sp) - # Jumping to else_8743762785985 - j else_8743762785985 + # Jumping to endif_8794497433570 + j endif_8794497433570 - then_8743762785985: + endif_8794497433570: - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall + # internal_6 = internal_22 + lw $t0, 52($sp) + sw $t0, 116($sp) - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object + # Jumping to endif_8794497433576 + j endif_8794497433576 - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + endif_8794497433576: - addi $t0, $zero, 52 - sb $t0, 8($v0) # internal_24[0] = '4' + # internal_0 = internal_6 + lw $t0, 116($sp) + sw $t0, 140($sp) - sb $zero, 9($v0) # Null-terminator at the end of the string + # Jumping to endif_8794497433561 + j endif_8794497433561 - sw $v0, 108($sp) # internal_24 = "4" + endif_8794497433561: - lw $t0, 108($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 124($sp) - j end_assign - not_is_Bool_or_Int: - # internal_20 = internal_24 - lw $t0, 108($sp) - sw $t0, 124($sp) - end_assign: + # Loading return value in $v1 + lw $v1, 140($sp) - # Jumping to endif_8743762785985 - j endif_8743762785985 + # Freeing space for local variables + addi $sp, $sp, 144 + + jr $ra - else_8743762785985: + function_a2i_aux_at_A2I: + # Function parameters + # $ra = 68($sp) + # self = 64($sp) + # s = 60($sp) + # Reserving space for local variables + addi $sp, $sp, -60 - # Allocating Bool 0 + # Allocating Int 0 li $v0, 9 addi $a0, $zero, 12 syscall - la $t0, type_Bool # $t0 = address of the type + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 100($sp) # internal_26 = address of allocated object Int + sw $v0, 52($sp) # internal_1 = address of allocated object Int - # Allocating Int 5 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument int + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing int + + # Argument internal_1 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 68($sp) # int = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing s + + # Calling function function_length_at_String + jal function_length_at_String + lw $ra, 4($sp) + sw $v1, 52($sp) # internal_3 = result of function_length_at_String + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument j + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing j + + # Argument internal_3 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 60($sp) # j = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 0 li $v0, 9 addi $a0, $zero, 12 syscall @@ -4852,110 +6241,90 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 5 + addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 96($sp) # internal_27 = address of allocated object Int + sw $v0, 36($sp) # internal_5 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 220($sp) + lw $t0, 52($sp) sw $t0, 4($sp) # Storing i - # Argument internal_27 - lw $t0, 108($sp) - sw $t0, 0($sp) # Storing internal_27 + # Argument internal_5 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_5 - # Calling function function_equal - jal function_equal + # Calling function function_assign + jal function_assign lw $ra, 8($sp) - sw $v1, 104($sp) # internal_28 = result of function_equal + sw $v1, 52($sp) # i = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 92($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 100($sp) - j end_assign - not_is_Bool_or_Int: - # internal_26 = internal_28 - lw $t0, 92($sp) - sw $t0, 100($sp) - end_assign: - - # If internal_26 then goto then_8743762785979 - lw $t0, 100($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762785979 - - # Jumping to else_8743762785979 - j else_8743762785979 - - then_8743762785979: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + while_start_8794497433974: - addi $t0, $zero, 53 - sb $t0, 8($v0) # internal_29[0] = '5' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - sb $zero, 9($v0) # Null-terminator at the end of the string + # Argument i + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing i - sw $v0, 88($sp) # internal_29 = "5" + # Argument j + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing j - lw $t0, 88($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 104($sp) - j end_assign - not_is_Bool_or_Int: - # internal_25 = internal_29 - lw $t0, 88($sp) - sw $t0, 104($sp) - end_assign: + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_6 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to endif_8743762785979 - j endif_8743762785979 + # If internal_6 then goto while_body_8794497433974 + lw $t0, 32($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8794497433974 - else_8743762785979: + # Jumping to while_end_8794497433974 + j while_end_8794497433974 + while_body_8794497433974: - # Allocating Bool 0 + # Allocating Int 10 li $v0, 9 addi $a0, $zero, 12 syscall - la $t0, type_Bool # $t0 = address of the type + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 10 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # internal_31 = address of allocated object Int + sw $v0, 28($sp) # internal_7 = address of allocated object Int - # Allocating Int 6 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument int + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing int + + # Argument internal_7 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_8 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 li $v0, 9 addi $a0, $zero, 12 syscall @@ -4963,110 +6332,87 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 6 + addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 76($sp) # internal_32 = address of allocated object Int + sw $v0, 20($sp) # internal_9 = address of allocated object Int # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 76($sp) + sw $t0, 8($sp) # Storing s # Argument i - lw $t0, 220($sp) + lw $t0, 56($sp) sw $t0, 4($sp) # Storing i - # Argument internal_32 - lw $t0, 88($sp) - sw $t0, 0($sp) # Storing internal_32 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 84($sp) # internal_33 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments + # Argument internal_9 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_9 - lw $t0, 72($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 80($sp) - j end_assign - not_is_Bool_or_Int: - # internal_31 = internal_33 - lw $t0, 72($sp) - sw $t0, 80($sp) - end_assign: + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 32($sp) # internal_10 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments - # If internal_31 then goto then_8743762785973 - lw $t0, 80($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762785973 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Jumping to else_8743762785973 - j else_8743762785973 + # Argument self + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing self - then_8743762785973: + # Argument internal_10 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_10 - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall + # Calling function function_c2i_at_A2I + jal function_c2i_at_A2I + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_11 = result of function_c2i_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + # Argument internal_8 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_8 - addi $t0, $zero, 54 - sb $t0, 8($v0) # internal_34[0] = '6' + # Argument internal_11 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_11 - sb $zero, 9($v0) # Null-terminator at the end of the string + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_12 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - sw $v0, 68($sp) # internal_34 = "6" + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument int lw $t0, 68($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 84($sp) - j end_assign - not_is_Bool_or_Int: - # internal_30 = internal_34 - lw $t0, 68($sp) - sw $t0, 84($sp) - end_assign: - - # Jumping to endif_8743762785973 - j endif_8743762785973 - - else_8743762785973: - + sw $t0, 4($sp) # Storing int - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + # Argument internal_12 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_12 - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_36 = address of allocated object Int + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 68($sp) # int = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # Allocating Int 7 + # Allocating Int 1 li $v0, 9 addi $a0, $zero, 12 syscall @@ -5074,96 +6420,67 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 7 + addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 56($sp) # internal_37 = address of allocated object Int + sw $v0, 4($sp) # internal_13 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 220($sp) + lw $t0, 52($sp) sw $t0, 4($sp) # Storing i - # Argument internal_37 - lw $t0, 68($sp) - sw $t0, 0($sp) # Storing internal_37 + # Argument internal_13 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_13 - # Calling function function_equal - jal function_equal + # Calling function function_add + jal function_add lw $ra, 8($sp) - sw $v1, 64($sp) # internal_38 = result of function_equal + sw $v1, 12($sp) # internal_14 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 52($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: - # internal_36 = internal_38 - lw $t0, 52($sp) - sw $t0, 60($sp) - end_assign: - - # If internal_36 then goto then_8743762785967 - lw $t0, 60($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762785967 - - # Jumping to else_8743762785967 - j else_8743762785967 - - then_8743762785967: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall + # Argument i + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing i - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object + # Argument internal_14 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_14 - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 52($sp) # i = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 55 - sb $t0, 8($v0) # internal_39[0] = '7' + # Jumping to while_start_8794497433974 + j while_start_8794497433974 - sb $zero, 9($v0) # Null-terminator at the end of the string + while_end_8794497433974: - sw $v0, 48($sp) # internal_39 = "7" + # Loading return value in $v1 + lw $v1, 56($sp) - lw $t0, 48($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 64($sp) - j end_assign - not_is_Bool_or_Int: - # internal_35 = internal_39 - lw $t0, 48($sp) - sw $t0, 64($sp) - end_assign: + # Freeing space for local variables + addi $sp, $sp, 60 - # Jumping to endif_8743762785967 - j endif_8743762785967 + jr $ra - else_8743762785967: + function_i2a_at_A2I: + # Function parameters + # $ra = 80($sp) + # self = 76($sp) + # i = 72($sp) + # Reserving space for local variables + addi $sp, $sp, -72 # Allocating Bool 0 li $v0, 9 @@ -5175,9 +6492,9 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_41 = address of allocated object Int + sw $v0, 64($sp) # internal_1 = address of allocated object Int - # Allocating Int 8 + # Allocating Int 0 li $v0, 9 addi $a0, $zero, 12 syscall @@ -5185,55 +6502,42 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 8 + addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_42 = address of allocated object Int + sw $v0, 60($sp) # internal_2 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 220($sp) + lw $t0, 84($sp) sw $t0, 4($sp) # Storing i - # Argument internal_42 - lw $t0, 48($sp) - sw $t0, 0($sp) # Storing internal_42 + # Argument internal_2 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_2 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 44($sp) # internal_43 = result of function_equal + sw $v1, 68($sp) # internal_3 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 32($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: - # internal_41 = internal_43 - lw $t0, 32($sp) - sw $t0, 40($sp) - end_assign: + # internal_1 = internal_3 + lw $t0, 56($sp) + sw $t0, 64($sp) - # If internal_41 then goto then_8743762785961 - lw $t0, 40($sp) # Loading the address of the condition + # If internal_1 then goto then_8794497434103 + lw $t0, 64($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762785961 + beq $t0, $t1, then_8794497434103 - # Jumping to else_8743762785961 - j else_8743762785961 + # Jumping to else_8794497434103 + j else_8794497434103 - then_8743762785961: + then_8794497434103: # Allocating String li $v0, 9 @@ -5243,38 +6547,24 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 56 - sb $t0, 8($v0) # internal_44[0] = '8' + addi $t0, $zero, 48 + sb $t0, 8($v0) # internal_4[0] = '0' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 28($sp) # internal_44 = "8" - - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: - # internal_40 = internal_44 - lw $t0, 28($sp) - sw $t0, 44($sp) - end_assign: + sw $v0, 52($sp) # internal_4 = "0" - # Jumping to endif_8743762785961 - j endif_8743762785961 + # internal_0 = internal_4 + lw $t0, 52($sp) + sw $t0, 68($sp) - else_8743762785961: + # Jumping to endif_8794497434103 + j endif_8794497434103 + else_8794497434103: # Allocating Bool 0 li $v0, 9 @@ -5286,9 +6576,9 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_46 = address of allocated object Int + sw $v0, 44($sp) # internal_6 = address of allocated object Int - # Allocating Int 9 + # Allocating Int 0 li $v0, 9 addi $a0, $zero, 12 syscall @@ -5296,55 +6586,69 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 9 + addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_47 = address of allocated object Int + sw $v0, 40($sp) # internal_7 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument i - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing i + # Argument internal_7 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_7 - # Argument internal_47 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_47 + # Argument i + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing i - # Calling function function_equal - jal function_equal + # Calling function function_less_than + jal function_less_than lw $ra, 8($sp) - sw $v1, 24($sp) # internal_48 = result of function_equal + sw $v1, 48($sp) # internal_8 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 20($sp) - j end_assign - not_is_Bool_or_Int: - # internal_46 = internal_48 - lw $t0, 12($sp) - sw $t0, 20($sp) - end_assign: + # internal_6 = internal_8 + lw $t0, 36($sp) + sw $t0, 44($sp) - # If internal_46 then goto then_8743762785940 - lw $t0, 20($sp) # Loading the address of the condition + # If internal_6 then goto then_8794497434109 + lw $t0, 44($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762785940 + beq $t0, $t1, then_8794497434109 + + # Jumping to else_8794497434109 + j else_8794497434109 + + then_8794497434109: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing self + + # Argument i + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing i + + # Calling function function_i2a_aux_at_A2I + jal function_i2a_aux_at_A2I + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_9 = result of function_i2a_aux_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_5 = internal_9 + lw $t0, 32($sp) + sw $t0, 48($sp) - # Jumping to else_8743762785940 - j else_8743762785940 + # Jumping to endif_8794497434109 + j endif_8794497434109 - then_8743762785940: + else_8794497434109: # Allocating String li $v0, 9 @@ -5354,304 +6658,188 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 57 - sb $t0, 8($v0) # internal_49[0] = '9' + addi $t0, $zero, 45 + sb $t0, 8($v0) # internal_10[0] = '-' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 8($sp) # internal_49 = "9" + sw $v0, 28($sp) # internal_10 = "-" - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: - # internal_45 = internal_49 - lw $t0, 8($sp) - sw $t0, 24($sp) - end_assign: + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Jumping to endif_8743762785940 - j endif_8743762785940 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_11 = address of allocated object Int - else_8743762785940: + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_12 = address of allocated object Int - # Argument self - lw $t0, 220($sp) - sw $t0, 0($sp) # Storing self + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Calling function function_abort_at_Object - jal function_abort_at_Object - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_50 = result of function_abort_at_Object - addi $sp, $sp, 8 # Freeing space for arguments + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_13 = address of allocated object Int - # Allocating String + # Allocating Int 0 li $v0, 9 - addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object - + sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - sb $zero, 8($v0) # Null-terminator at the end of the string - - sw $v0, 0($sp) # internal_51 = "" - - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: - # internal_45 = internal_51 - lw $t0, 0($sp) - sw $t0, 24($sp) - end_assign: - - # Jumping to endif_8743762785940 - j endif_8743762785940 - - endif_8743762785940: + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_14 = address of allocated object Int - lw $t0, 24($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: - # internal_40 = internal_45 - lw $t0, 24($sp) - sw $t0, 44($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Jumping to endif_8743762785961 - j endif_8743762785961 + # Argument internal_11 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_11 - endif_8743762785961: + # Argument internal_13 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_13 - lw $t0, 44($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 64($sp) - j end_assign - not_is_Bool_or_Int: - # internal_35 = internal_40 - lw $t0, 44($sp) - sw $t0, 64($sp) - end_assign: + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_14 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to endif_8743762785967 - j endif_8743762785967 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - endif_8743762785967: + # Argument internal_14 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_14 - lw $t0, 64($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 84($sp) - j end_assign - not_is_Bool_or_Int: - # internal_30 = internal_35 - lw $t0, 64($sp) - sw $t0, 84($sp) - end_assign: + # Argument internal_12 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_12 - # Jumping to endif_8743762785973 - j endif_8743762785973 + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_14 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - endif_8743762785973: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument i lw $t0, 84($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 104($sp) - j end_assign - not_is_Bool_or_Int: - # internal_25 = internal_30 - lw $t0, 84($sp) - sw $t0, 104($sp) - end_assign: - - # Jumping to endif_8743762785979 - j endif_8743762785979 + sw $t0, 4($sp) # Storing i - endif_8743762785979: + # Argument internal_14 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_14 - lw $t0, 104($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 124($sp) - j end_assign - not_is_Bool_or_Int: - # internal_20 = internal_25 - lw $t0, 104($sp) - sw $t0, 124($sp) - end_assign: + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_15 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to endif_8743762785985 - j endif_8743762785985 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - endif_8743762785985: + # Argument self + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing self - lw $t0, 124($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 144($sp) - j end_assign - not_is_Bool_or_Int: - # internal_15 = internal_20 - lw $t0, 124($sp) - sw $t0, 144($sp) - end_assign: + # Argument internal_15 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_15 - # Jumping to endif_8743762785991 - j endif_8743762785991 + # Calling function function_i2a_aux_at_A2I + jal function_i2a_aux_at_A2I + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_16 = result of function_i2a_aux_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments - endif_8743762785991: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - lw $t0, 144($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 164($sp) - j end_assign - not_is_Bool_or_Int: - # internal_10 = internal_15 - lw $t0, 144($sp) - sw $t0, 164($sp) - end_assign: + # Argument internal_10 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_10 - # Jumping to endif_8743762785997 - j endif_8743762785997 + # Argument internal_16 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_16 - endif_8743762785997: + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_17 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 164($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 184($sp) - j end_assign - not_is_Bool_or_Int: - # internal_5 = internal_10 - lw $t0, 164($sp) - sw $t0, 184($sp) - end_assign: + # internal_5 = internal_17 + lw $t0, 0($sp) + sw $t0, 48($sp) - # Jumping to endif_8743762786003 - j endif_8743762786003 + # Jumping to endif_8794497434109 + j endif_8794497434109 - endif_8743762786003: + endif_8794497434109: - lw $t0, 184($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 204($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_5 - lw $t0, 184($sp) - sw $t0, 204($sp) - end_assign: + lw $t0, 48($sp) + sw $t0, 68($sp) - # Jumping to endif_8743762786009 - j endif_8743762786009 + # Jumping to endif_8794497434103 + j endif_8794497434103 - endif_8743762786009: + endif_8794497434103: # Loading return value in $v1 - lw $v1, 204($sp) + lw $v1, 68($sp) # Freeing space for local variables - addi $sp, $sp, 208 + addi $sp, $sp, 72 jr $ra - function_a2i_at_A2I: + function_i2a_aux_at_A2I: # Function parameters - # $ra = 152($sp) - # self = 148($sp) - # s = 144($sp) + # $ra = 64($sp) + # self = 60($sp) + # i = 56($sp) # Reserving space for local variables - addi $sp, $sp, -144 - + addi $sp, $sp, -56 # Allocating Bool 0 li $v0, 9 @@ -5663,21 +6851,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 136($sp) # internal_1 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument s - lw $t0, 152($sp) - sw $t0, 0($sp) # Storing s - - # Calling function function_length_at_String - jal function_length_at_String - lw $ra, 4($sp) - sw $v1, 140($sp) # internal_2 = result of function_length_at_String - addi $sp, $sp, 8 # Freeing space for arguments + sw $v0, 48($sp) # internal_1 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -5689,114 +6863,66 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 128($sp) # internal_3 = address of allocated object Int + sw $v0, 44($sp) # internal_2 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_2 - lw $t0, 144($sp) - sw $t0, 4($sp) # Storing internal_2 + # Argument i + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing i - # Argument internal_3 - lw $t0, 140($sp) - sw $t0, 0($sp) # Storing internal_3 + # Argument internal_2 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_2 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 136($sp) # internal_4 = result of function_equal + sw $v1, 52($sp) # internal_3 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 124($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 136($sp) - j end_assign - not_is_Bool_or_Int: - # internal_1 = internal_4 - lw $t0, 124($sp) - sw $t0, 136($sp) - end_assign: + # internal_1 = internal_3 + lw $t0, 40($sp) + sw $t0, 48($sp) - # If internal_1 then goto then_8743762786199 - lw $t0, 136($sp) # Loading the address of the condition + # If internal_1 then goto then_8794497434733 + lw $t0, 48($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762786199 + beq $t0, $t1, then_8794497434733 - # Jumping to else_8743762786199 - j else_8743762786199 + # Jumping to else_8794497434733 + j else_8794497434733 - then_8743762786199: + then_8794497434733: - # Allocating Int 0 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 120($sp) # internal_5 = address of allocated object Int - - lw $t0, 120($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 140($sp) - j end_assign - not_is_Bool_or_Int: - # internal_0 = internal_5 - lw $t0, 120($sp) - sw $t0, 140($sp) - end_assign: - # Jumping to endif_8743762786199 - j endif_8743762786199 - - else_8743762786199: + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + sb $zero, 8($v0) # Null-terminator at the end of the string - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + sw $v0, 36($sp) # internal_4 = "" - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 112($sp) # internal_7 = address of allocated object Int + # internal_0 = internal_4 + lw $t0, 36($sp) + sw $t0, 52($sp) - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + # Jumping to endif_8794497434733 + j endif_8794497434733 - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 108($sp) # internal_8 = address of allocated object Int + else_8794497434733: - # Allocating Int 1 + # Allocating Int 10 li $v0, 9 addi $a0, $zero, 12 syscall @@ -5804,97 +6930,65 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 104($sp) # internal_9 = address of allocated object Int + sw $v0, 28($sp) # internal_6 = address of allocated object Int # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address - - # Argument s - lw $t0, 160($sp) - sw $t0, 8($sp) # Storing s - - # Argument internal_8 - lw $t0, 124($sp) - sw $t0, 4($sp) # Storing internal_8 - - # Argument internal_9 - lw $t0, 120($sp) - sw $t0, 0($sp) # Storing internal_9 - - # Calling function function_substr_at_String - jal function_substr_at_String - lw $ra, 12($sp) - sw $v1, 116($sp) # internal_10 = result of function_substr_at_String - addi $sp, $sp, 16 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 45 - sb $t0, 8($v0) # internal_11[0] = '-' + # Argument i + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing i - sb $zero, 9($v0) # Null-terminator at the end of the string + # Argument internal_6 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_6 - sw $v0, 96($sp) # internal_11 = "-" + # Calling function function_div + jal function_div + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_7 = result of function_div + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_10 - lw $t0, 112($sp) - sw $t0, 4($sp) # Storing internal_10 + # Argument next + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing next - # Argument internal_11 - lw $t0, 108($sp) - sw $t0, 0($sp) # Storing internal_11 + # Argument internal_7 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_7 - # Calling function function_equal - jal function_equal + # Calling function function_assign + jal function_assign lw $ra, 8($sp) - sw $v1, 104($sp) # internal_12 = result of function_equal + sw $v1, 44($sp) # next = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 92($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 112($sp) - j end_assign - not_is_Bool_or_Int: - # internal_7 = internal_12 - lw $t0, 92($sp) - sw $t0, 112($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # If internal_7 then goto then_8743762786214 - lw $t0, 112($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762786214 + # Argument self + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing self - # Jumping to else_8743762786214 - j else_8743762786214 + # Argument next + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing next - then_8743762786214: + # Calling function function_i2a_aux_at_A2I + jal function_i2a_aux_at_A2I + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_8 = result of function_i2a_aux_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments - # Allocating Int 1 + # Allocating Int 10 li $v0, 9 addi $a0, $zero, 12 syscall @@ -5902,1621 +6996,1299 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 88($sp) # internal_13 = address of allocated object Int + sw $v0, 16($sp) # internal_9 = address of allocated object Int # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument s - lw $t0, 152($sp) - sw $t0, 0($sp) # Storing s + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Calling function function_length_at_String - jal function_length_at_String - lw $ra, 4($sp) - sw $v1, 92($sp) # internal_14 = result of function_length_at_String - addi $sp, $sp, 8 # Freeing space for arguments + # Argument next + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing next - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall + # Argument internal_9 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_9 - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # internal_15 = address of allocated object Int + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_10 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_14 - lw $t0, 96($sp) - sw $t0, 4($sp) # Storing internal_14 + # Argument i + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing i - # Argument internal_15 - lw $t0, 92($sp) - sw $t0, 0($sp) # Storing internal_15 + # Argument internal_10 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_10 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 88($sp) # internal_16 = result of function_sub + sw $v1, 20($sp) # internal_11 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address - - # Argument s - lw $t0, 160($sp) - sw $t0, 8($sp) # Storing s + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Argument internal_13 - lw $t0, 104($sp) - sw $t0, 4($sp) # Storing internal_13 + # Argument self + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing self - # Argument internal_16 - lw $t0, 92($sp) - sw $t0, 0($sp) # Storing internal_16 + # Argument internal_11 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_11 - # Calling function function_substr_at_String - jal function_substr_at_String - lw $ra, 12($sp) - sw $v1, 88($sp) # internal_17 = result of function_substr_at_String - addi $sp, $sp, 16 # Freeing space for arguments + # Calling function function_i2c_at_A2I + jal function_i2c_at_A2I + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_12 = result of function_i2c_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 160($sp) - sw $t0, 4($sp) # Storing self + # Argument internal_8 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_8 - # Argument internal_17 - lw $t0, 84($sp) - sw $t0, 0($sp) # Storing internal_17 + # Argument internal_12 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_12 - # Calling function function_a2i_aux_at_A2I - jal function_a2i_aux_at_A2I + # Calling function function_concat_at_String + jal function_concat_at_String lw $ra, 8($sp) - sw $v1, 80($sp) # internal_18 = result of function_a2i_aux_at_A2I + sw $v1, 12($sp) # internal_13 = result of function_concat_at_String addi $sp, $sp, 12 # Freeing space for arguments - # Xor operation - lw $t0, 68($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 60($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + # internal_0 = internal_13 + lw $t0, 0($sp) + sw $t0, 52($sp) - lw $t0, 56($sp) # $t0 = internal_21 - sw $t2, 8($t0) # Setting value in the third word of the Int object + # Jumping to endif_8794497434733 + j endif_8794497434733 - # Addition operation - lw $t0, 56($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 64($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - add $t2, $t0, $t1 # $t2 = $t0 + $t1 + endif_8794497434733: - lw $t0, 56($sp) # $t0 = internal_21 - sw $t2, 8($t0) # Setting value in the third word of the Int object + # Loading return value in $v1 + lw $v1, 52($sp) - lw $t0, 56($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 116($sp) - j end_assign - not_is_Bool_or_Int: - # internal_6 = internal_21 - lw $t0, 56($sp) - sw $t0, 116($sp) - end_assign: + # Freeing space for local variables + addi $sp, $sp, 56 - # Jumping to endif_8743762786214 - j endif_8743762786214 + jr $ra - else_8743762786214: + function___init___at_Main: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + # Reserving space for local variables + addi $sp, $sp, -16 - # Allocating Bool 0 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Bool # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_23 = address of allocated object Int - # Allocating Int 0 + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_0 = "" + + # Set attribute char of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 12($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8794497354337 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794497354337 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794497354337 + j object_set_attribute_8794497354337 + int_set_attribute_8794497354337: li $v0, 9 addi $a0, $zero, 12 syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.char = internal_0 + j end_set_attribute_8794497354337 + bool_set_attribute_8794497354337: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.char = internal_0 + j end_set_attribute_8794497354337 + object_set_attribute_8794497354337: + sw $t1, 8($t0) # self.char = internal_0 + end_set_attribute_8794497354337: - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_24 = address of allocated object Int + # Allocating NUll to internal_1 + sw $zero, 8($sp) # internal_1 = 0 - # Allocating Int 1 + # Set attribute avar of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8794497354358 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794497354358 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794497354358 + j object_set_attribute_8794497354358 + int_set_attribute_8794497354358: li $v0, 9 addi $a0, $zero, 12 syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_1 + j end_set_attribute_8794497354358 + bool_set_attribute_8794497354358: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_1 + j end_set_attribute_8794497354358 + object_set_attribute_8794497354358: + sw $t1, 12($t0) # self.avar = internal_1 + end_set_attribute_8794497354358: + + # Allocating NUll to internal_2 + sw $zero, 4($sp) # internal_2 = 0 - la $t0, type_Int # $t0 = address of the type + # Set attribute a_var of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_2 + beq $t1, $zero, object_set_attribute_8794497354379 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794497354379 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794497354379 + j object_set_attribute_8794497354379 + int_set_attribute_8794497354379: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.a_var = internal_2 + j end_set_attribute_8794497354379 + bool_set_attribute_8794497354379: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.a_var = internal_2 + j end_set_attribute_8794497354379 + object_set_attribute_8794497354379: + sw $t1, 16($t0) # self.a_var = internal_2 + end_set_attribute_8794497354379: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_25 = address of allocated object Int + sw $v0, 0($sp) # internal_3 = address of allocated object Int - # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address + # Set attribute flag of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_3 + beq $t1, $zero, object_set_attribute_8794497354400 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794497354400 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794497354400 + j object_set_attribute_8794497354400 + int_set_attribute_8794497354400: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.flag = internal_3 + j end_set_attribute_8794497354400 + bool_set_attribute_8794497354400: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.flag = internal_3 + j end_set_attribute_8794497354400 + object_set_attribute_8794497354400: + sw $t1, 20($t0) # self.flag = internal_3 + end_set_attribute_8794497354400: - # Argument s - lw $t0, 160($sp) - sw $t0, 8($sp) # Storing s + # Loading return value in $v1 + lw $v1, 16($sp) - # Argument internal_24 - lw $t0, 60($sp) - sw $t0, 4($sp) # Storing internal_24 + # Freeing space for local variables + addi $sp, $sp, 16 - # Argument internal_25 - lw $t0, 56($sp) - sw $t0, 0($sp) # Storing internal_25 + jr $ra - # Calling function function_substr_at_String - jal function_substr_at_String - lw $ra, 12($sp) - sw $v1, 52($sp) # internal_26 = result of function_substr_at_String - addi $sp, $sp, 16 # Freeing space for arguments + function_menu_at_Main: + # Function parameters + # $ra = 216($sp) + # self = 212($sp) + + # Reserving space for local variables + addi $sp, $sp, -212 # Allocating String li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 30 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 30 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 43 - sb $t0, 8($v0) # internal_27[0] = '+' + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_0[0] = '\n' + + addi $t0, $zero, 9 + sb $t0, 9($v0) # internal_0[1] = '\t' + + addi $t0, $zero, 84 + sb $t0, 10($v0) # internal_0[2] = 'T' + + addi $t0, $zero, 111 + sb $t0, 11($v0) # internal_0[3] = 'o' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_0[4] = ' ' + + addi $t0, $zero, 97 + sb $t0, 13($v0) # internal_0[5] = 'a' - sb $zero, 9($v0) # Null-terminator at the end of the string + addi $t0, $zero, 100 + sb $t0, 14($v0) # internal_0[6] = 'd' - sw $v0, 32($sp) # internal_27 = "+" + addi $t0, $zero, 100 + sb $t0, 15($v0) # internal_0[7] = 'd' - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_0[8] = ' ' - # Argument internal_26 - lw $t0, 48($sp) - sw $t0, 4($sp) # Storing internal_26 + addi $t0, $zero, 97 + sb $t0, 17($v0) # internal_0[9] = 'a' - # Argument internal_27 - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_27 + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_0[10] = ' ' - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 40($sp) # internal_28 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments + addi $t0, $zero, 110 + sb $t0, 19($v0) # internal_0[11] = 'n' - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 48($sp) - j end_assign - not_is_Bool_or_Int: - # internal_23 = internal_28 - lw $t0, 28($sp) - sw $t0, 48($sp) - end_assign: + addi $t0, $zero, 117 + sb $t0, 20($v0) # internal_0[12] = 'u' - # If internal_23 then goto then_8743762786208 - lw $t0, 48($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762786208 + addi $t0, $zero, 109 + sb $t0, 21($v0) # internal_0[13] = 'm' - # Jumping to else_8743762786208 - j else_8743762786208 + addi $t0, $zero, 98 + sb $t0, 22($v0) # internal_0[14] = 'b' - then_8743762786208: + addi $t0, $zero, 101 + sb $t0, 23($v0) # internal_0[15] = 'e' - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall + addi $t0, $zero, 114 + sb $t0, 24($v0) # internal_0[16] = 'r' - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_29 = address of allocated object Int + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + addi $t0, $zero, 116 + sb $t0, 26($v0) # internal_0[18] = 't' - # Argument s - lw $t0, 152($sp) - sw $t0, 0($sp) # Storing s + addi $t0, $zero, 111 + sb $t0, 27($v0) # internal_0[19] = 'o' - # Calling function function_length_at_String - jal function_length_at_String - lw $ra, 4($sp) - sw $v1, 28($sp) # internal_30 = result of function_length_at_String - addi $sp, $sp, 8 # Freeing space for arguments + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_0[20] = ' ' - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall + sb $zero, 29($v0) # Null-terminator at the end of the string - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_31 = address of allocated object Int + sw $v0, 208($sp) # internal_0 = "\n\tTo add a number to " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_30 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_30 + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self - # Argument internal_31 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_31 + # Argument internal_0 + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing internal_0 - # Calling function function_sub - jal function_sub + # Calling function function_out_string_at_IO + jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 24($sp) # internal_32 = result of function_sub + sw $v1, 216($sp) # internal_1 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address - - # Argument s - lw $t0, 160($sp) - sw $t0, 8($sp) # Storing s - - # Argument internal_29 - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing internal_29 - - # Argument internal_32 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_32 - - # Calling function function_substr_at_String - jal function_substr_at_String - lw $ra, 12($sp) - sw $v1, 24($sp) # internal_33 = result of function_substr_at_String - addi $sp, $sp, 16 # Freeing space for arguments + # Get attribute avar of self + lw $t0, 212($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497354490 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497354490 + j object_get_attribute_8794497354490 + int_get_attribute_8794497354490: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 200($sp) # internal_2 = self.avar + j end_get_attribute_8794497354490 + bool_get_attribute_8794497354490: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 200($sp) # internal_2 = self.avar + j end_get_attribute_8794497354490 + object_get_attribute_8794497354490: + sw $t1, 200($sp) # internal_2 = avar + end_get_attribute_8794497354490: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 160($sp) + lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument internal_33 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_33 + # Argument internal_2 + lw $t0, 212($sp) + sw $t0, 0($sp) # Storing internal_2 - # Calling function function_a2i_aux_at_A2I - jal function_a2i_aux_at_A2I + # Calling function function_print_at_Main + jal function_print_at_Main lw $ra, 8($sp) - sw $v1, 16($sp) # internal_34 = result of function_a2i_aux_at_A2I + sw $v1, 208($sp) # internal_3 = result of function_print_at_Main addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 4($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: - # internal_22 = internal_34 - lw $t0, 4($sp) - sw $t0, 52($sp) - end_assign: + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - # Jumping to endif_8743762786208 - j endif_8743762786208 + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - else_8743762786208: + addi $t0, $zero, 21 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t0, $zero, 46 + sb $t0, 8($v0) # internal_4[0] = '.' - # Argument self - lw $t0, 160($sp) - sw $t0, 4($sp) # Storing self + addi $t0, $zero, 46 + sb $t0, 9($v0) # internal_4[1] = '.' - # Argument s - lw $t0, 156($sp) - sw $t0, 0($sp) # Storing s + addi $t0, $zero, 46 + sb $t0, 10($v0) # internal_4[2] = '.' - # Calling function function_a2i_aux_at_A2I - jal function_a2i_aux_at_A2I - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_35 = result of function_a2i_aux_at_A2I - addi $sp, $sp, 12 # Freeing space for arguments + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_4[3] = 'e' - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: - # internal_22 = internal_35 - lw $t0, 0($sp) - sw $t0, 52($sp) - end_assign: + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_4[4] = 'n' - # Jumping to endif_8743762786208 - j endif_8743762786208 + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_4[5] = 't' - endif_8743762786208: + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_4[6] = 'e' - lw $t0, 52($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 116($sp) - j end_assign - not_is_Bool_or_Int: - # internal_6 = internal_22 - lw $t0, 52($sp) - sw $t0, 116($sp) - end_assign: + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_4[7] = 'r' - # Jumping to endif_8743762786214 - j endif_8743762786214 + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_4[8] = ' ' - endif_8743762786214: + addi $t0, $zero, 97 + sb $t0, 17($v0) # internal_4[9] = 'a' - lw $t0, 116($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 140($sp) - j end_assign - not_is_Bool_or_Int: - # internal_0 = internal_6 - lw $t0, 116($sp) - sw $t0, 140($sp) - end_assign: + addi $t0, $zero, 58 + sb $t0, 18($v0) # internal_4[10] = ':' - # Jumping to endif_8743762786199 - j endif_8743762786199 + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_4[11] = '\n' - endif_8743762786199: + sb $zero, 20($v0) # Null-terminator at the end of the string - # Loading return value in $v1 - lw $v1, 140($sp) + sw $v0, 192($sp) # internal_4 = "...enter a:\n" - # Freeing space for local variables - addi $sp, $sp, 144 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - jr $ra + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self - function_a2i_aux_at_A2I: - # Function parameters - # $ra = 72($sp) - # self = 68($sp) - # s = 64($sp) + # Argument internal_4 + lw $t0, 204($sp) + sw $t0, 0($sp) # Storing internal_4 - # Reserving space for local variables - addi $sp, $sp, -64 + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 200($sp) # internal_5 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments - # Allocating Int 0 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 56($sp) # internal_1 = address of allocated object Int + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 20 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_6[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_6[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_6[2] = 'o' - lw $t0, 56($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: - # int = internal_1 - lw $t0, 56($sp) - sw $t0, 60($sp) - end_assign: + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_6[3] = ' ' - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_6[4] = 'n' - # Argument s - lw $t0, 72($sp) - sw $t0, 0($sp) # Storing s + addi $t0, $zero, 101 + sb $t0, 13($v0) # internal_6[5] = 'e' - # Calling function function_length_at_String - jal function_length_at_String - lw $ra, 4($sp) - sw $v1, 56($sp) # internal_3 = result of function_length_at_String - addi $sp, $sp, 8 # Freeing space for arguments + addi $t0, $zero, 103 + sb $t0, 14($v0) # internal_6[6] = 'g' - lw $t0, 48($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: - # j = internal_3 - lw $t0, 48($sp) - sw $t0, 52($sp) - end_assign: + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_6[7] = 'a' - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + addi $t0, $zero, 116 + sb $t0, 16($v0) # internal_6[8] = 't' - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_5 = address of allocated object Int + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_6[9] = 'e' - lw $t0, 40($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: - # i = internal_5 - lw $t0, 40($sp) - sw $t0, 44($sp) - end_assign: + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_6[10] = ' ' + + sb $zero, 19($v0) # Null-terminator at the end of the string - while_start_8743762786868: + sw $v0, 184($sp) # internal_6 = "\tTo negate " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument i - lw $t0, 56($sp) - sw $t0, 4($sp) # Storing i + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self - # Argument j - lw $t0, 64($sp) - sw $t0, 0($sp) # Storing j + # Argument internal_6 + lw $t0, 196($sp) + sw $t0, 0($sp) # Storing internal_6 - # Calling function function_less_than - jal function_less_than + # Calling function function_out_string_at_IO + jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 44($sp) # internal_7 = result of function_less_than + sw $v1, 192($sp) # internal_7 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 32($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 36($sp) - j end_assign - not_is_Bool_or_Int: - # internal_6 = internal_7 - lw $t0, 32($sp) - sw $t0, 36($sp) - end_assign: - - # If internal_6 then goto while_body_8743762786868 - lw $t0, 36($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8743762786868 - - # Jumping to while_end_8743762786868 - j while_end_8743762786868 - - while_body_8743762786868: - - # Allocating Int 10 + # Get attribute avar of self + lw $t0, 212($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497355370 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497355370 + j object_get_attribute_8794497355370 + int_get_attribute_8794497355370: li $v0, 9 addi $a0, $zero, 12 syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 10 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_8 = address of allocated object Int + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 176($sp) # internal_8 = self.avar + j end_get_attribute_8794497355370 + bool_get_attribute_8794497355370: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 176($sp) # internal_8 = self.avar + j end_get_attribute_8794497355370 + object_get_attribute_8794497355370: + sw $t1, 176($sp) # internal_8 = avar + end_get_attribute_8794497355370: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument int - lw $t0, 72($sp) - sw $t0, 4($sp) # Storing int + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self # Argument internal_8 - lw $t0, 40($sp) + lw $t0, 188($sp) sw $t0, 0($sp) # Storing internal_8 - # Calling function function_mult - jal function_mult + # Calling function function_print_at_Main + jal function_print_at_Main lw $ra, 8($sp) - sw $v1, 36($sp) # internal_9 = result of function_mult + sw $v1, 184($sp) # internal_9 = result of function_print_at_Main addi $sp, $sp, 12 # Freeing space for arguments - # Allocating Int 1 + # Allocating String li $v0, 9 - addi $a0, $zero, 12 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Int # $t0 = address of the type + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_10 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address - # Argument s - lw $t0, 80($sp) - sw $t0, 8($sp) # Storing s + addi $t0, $zero, 21 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - # Argument i - lw $t0, 60($sp) - sw $t0, 4($sp) # Storing i + addi $t0, $zero, 46 + sb $t0, 8($v0) # internal_10[0] = '.' - # Argument internal_10 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_10 + addi $t0, $zero, 46 + sb $t0, 9($v0) # internal_10[1] = '.' - # Calling function function_substr_at_String - jal function_substr_at_String - lw $ra, 12($sp) - sw $v1, 32($sp) # internal_11 = result of function_substr_at_String - addi $sp, $sp, 16 # Freeing space for arguments + addi $t0, $zero, 46 + sb $t0, 10($v0) # internal_10[2] = '.' - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_10[3] = 'e' - # Argument self - lw $t0, 80($sp) - sw $t0, 4($sp) # Storing self + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_10[4] = 'n' - # Argument internal_11 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_11 + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_10[5] = 't' - # Calling function function_c2i_at_A2I - jal function_c2i_at_A2I - lw $ra, 8($sp) - sw $v1, 24($sp) # internal_12 = result of function_c2i_at_A2I - addi $sp, $sp, 12 # Freeing space for arguments + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_10[6] = 'e' - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_10[7] = 'r' - # Argument internal_9 - lw $t0, 36($sp) - sw $t0, 4($sp) # Storing internal_9 + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_10[8] = ' ' - # Argument internal_12 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_12 + addi $t0, $zero, 98 + sb $t0, 17($v0) # internal_10[9] = 'b' - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_13 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments + addi $t0, $zero, 58 + sb $t0, 18($v0) # internal_10[10] = ':' - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: - # int = internal_13 - lw $t0, 8($sp) - sw $t0, 60($sp) - end_assign: + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_10[11] = '\n' - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall + sb $zero, 20($v0) # Null-terminator at the end of the string - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_14 = address of allocated object Int + sw $v0, 168($sp) # internal_10 = "...enter b:\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument i - lw $t0, 56($sp) - sw $t0, 4($sp) # Storing i + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self - # Argument internal_14 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_14 + # Argument internal_10 + lw $t0, 180($sp) + sw $t0, 0($sp) # Storing internal_10 - # Calling function function_add - jal function_add + # Calling function function_out_string_at_IO + jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 12($sp) # internal_15 = result of function_add + sw $v1, 176($sp) # internal_11 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: - # i = internal_15 - lw $t0, 0($sp) - sw $t0, 44($sp) - end_assign: + # Allocating String + li $v0, 9 + addi $a0, $zero, 41 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - # Jumping to while_start_8743762786868 - j while_start_8743762786868 + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - while_end_8743762786868: + addi $t0, $zero, 41 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - # Loading return value in $v1 - lw $v1, 60($sp) + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_12[0] = '\t' - # Freeing space for local variables - addi $sp, $sp, 64 + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_12[1] = 'T' - jr $ra + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_12[2] = 'o' - function_i2a_at_A2I: - # Function parameters - # $ra = 80($sp) - # self = 76($sp) - # i = 72($sp) + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_12[3] = ' ' - # Reserving space for local variables - addi $sp, $sp, -72 + addi $t0, $zero, 102 + sb $t0, 12($v0) # internal_12[4] = 'f' + addi $t0, $zero, 105 + sb $t0, 13($v0) # internal_12[5] = 'i' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_12[6] = 'n' + + addi $t0, $zero, 100 + sb $t0, 15($v0) # internal_12[7] = 'd' - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_12[8] = ' ' - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 64($sp) # internal_1 = address of allocated object Int + addi $t0, $zero, 116 + sb $t0, 17($v0) # internal_12[9] = 't' - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + addi $t0, $zero, 104 + sb $t0, 18($v0) # internal_12[10] = 'h' - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_2 = address of allocated object Int + addi $t0, $zero, 101 + sb $t0, 19($v0) # internal_12[11] = 'e' - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_12[12] = ' ' - # Argument i - lw $t0, 84($sp) - sw $t0, 4($sp) # Storing i + addi $t0, $zero, 100 + sb $t0, 21($v0) # internal_12[13] = 'd' - # Argument internal_2 - lw $t0, 72($sp) - sw $t0, 0($sp) # Storing internal_2 + addi $t0, $zero, 105 + sb $t0, 22($v0) # internal_12[14] = 'i' - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 68($sp) # internal_3 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments + addi $t0, $zero, 102 + sb $t0, 23($v0) # internal_12[15] = 'f' - lw $t0, 56($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 64($sp) - j end_assign - not_is_Bool_or_Int: - # internal_1 = internal_3 - lw $t0, 56($sp) - sw $t0, 64($sp) - end_assign: + addi $t0, $zero, 102 + sb $t0, 24($v0) # internal_12[16] = 'f' - # If internal_1 then goto then_8743762786997 - lw $t0, 64($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762786997 + addi $t0, $zero, 101 + sb $t0, 25($v0) # internal_12[17] = 'e' - # Jumping to else_8743762786997 - j else_8743762786997 + addi $t0, $zero, 114 + sb $t0, 26($v0) # internal_12[18] = 'r' - then_8743762786997: + addi $t0, $zero, 101 + sb $t0, 27($v0) # internal_12[19] = 'e' - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall + addi $t0, $zero, 110 + sb $t0, 28($v0) # internal_12[20] = 'n' - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object + addi $t0, $zero, 99 + sb $t0, 29($v0) # internal_12[21] = 'c' - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + addi $t0, $zero, 101 + sb $t0, 30($v0) # internal_12[22] = 'e' - addi $t0, $zero, 48 - sb $t0, 8($v0) # internal_4[0] = '0' + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_12[23] = ' ' - sb $zero, 9($v0) # Null-terminator at the end of the string + addi $t0, $zero, 98 + sb $t0, 32($v0) # internal_12[24] = 'b' - sw $v0, 52($sp) # internal_4 = "0" + addi $t0, $zero, 101 + sb $t0, 33($v0) # internal_12[25] = 'e' - lw $t0, 52($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 68($sp) - j end_assign - not_is_Bool_or_Int: - # internal_0 = internal_4 - lw $t0, 52($sp) - sw $t0, 68($sp) - end_assign: + addi $t0, $zero, 116 + sb $t0, 34($v0) # internal_12[26] = 't' - # Jumping to endif_8743762786997 - j endif_8743762786997 + addi $t0, $zero, 119 + sb $t0, 35($v0) # internal_12[27] = 'w' - else_8743762786997: + addi $t0, $zero, 101 + sb $t0, 36($v0) # internal_12[28] = 'e' + addi $t0, $zero, 101 + sb $t0, 37($v0) # internal_12[29] = 'e' - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + addi $t0, $zero, 110 + sb $t0, 38($v0) # internal_12[30] = 'n' - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_6 = address of allocated object Int + addi $t0, $zero, 32 + sb $t0, 39($v0) # internal_12[31] = ' ' - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + sb $zero, 40($v0) # Null-terminator at the end of the string - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_7 = address of allocated object Int + sw $v0, 160($sp) # internal_12 = "\tTo find the difference between " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_7 - lw $t0, 52($sp) - sw $t0, 4($sp) # Storing internal_7 + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self - # Argument i - lw $t0, 84($sp) - sw $t0, 0($sp) # Storing i + # Argument internal_12 + lw $t0, 172($sp) + sw $t0, 0($sp) # Storing internal_12 - # Calling function function_less_than - jal function_less_than + # Calling function function_out_string_at_IO + jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 48($sp) # internal_8 = result of function_less_than + sw $v1, 168($sp) # internal_13 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 36($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: - # internal_6 = internal_8 - lw $t0, 36($sp) - sw $t0, 44($sp) - end_assign: - - # If internal_6 then goto then_8743762787003 - lw $t0, 44($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762787003 - - # Jumping to else_8743762787003 - j else_8743762787003 - - then_8743762787003: + # Get attribute avar of self + lw $t0, 212($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497355478 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497355478 + j object_get_attribute_8794497355478 + int_get_attribute_8794497355478: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 152($sp) # internal_14 = self.avar + j end_get_attribute_8794497355478 + bool_get_attribute_8794497355478: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 152($sp) # internal_14 = self.avar + j end_get_attribute_8794497355478 + object_get_attribute_8794497355478: + sw $t1, 152($sp) # internal_14 = avar + end_get_attribute_8794497355478: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 88($sp) + lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument i - lw $t0, 84($sp) - sw $t0, 0($sp) # Storing i + # Argument internal_14 + lw $t0, 164($sp) + sw $t0, 0($sp) # Storing internal_14 - # Calling function function_i2a_aux_at_A2I - jal function_i2a_aux_at_A2I + # Calling function function_print_at_Main + jal function_print_at_Main lw $ra, 8($sp) - sw $v1, 44($sp) # internal_9 = result of function_i2a_aux_at_A2I + sw $v1, 160($sp) # internal_15 = result of function_print_at_Main addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 32($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 48($sp) - j end_assign - not_is_Bool_or_Int: - # internal_5 = internal_9 - lw $t0, 32($sp) - sw $t0, 48($sp) - end_assign: - - # Jumping to endif_8743762787003 - j endif_8743762787003 - - else_8743762787003: - # Allocating String li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 39 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 39 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 45 - sb $t0, 8($v0) # internal_10[0] = '-' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 28($sp) # internal_10 = "-" - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_11 = address of allocated object Int - - # Xor operation - lw $t0, 24($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 16($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + addi $t0, $zero, 97 + sb $t0, 8($v0) # internal_16[0] = 'a' - lw $t0, 12($sp) # $t0 = internal_14 - sw $t2, 8($t0) # Setting value in the third word of the Int object + addi $t0, $zero, 110 + sb $t0, 9($v0) # internal_16[1] = 'n' - # Addition operation - lw $t0, 12($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 20($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - add $t2, $t0, $t1 # $t2 = $t0 + $t1 + addi $t0, $zero, 100 + sb $t0, 10($v0) # internal_16[2] = 'd' - lw $t0, 12($sp) # $t0 = internal_14 - sw $t2, 8($t0) # Setting value in the third word of the Int object + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_16[3] = ' ' - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t0, $zero, 97 + sb $t0, 12($v0) # internal_16[4] = 'a' - # Argument i - lw $t0, 84($sp) - sw $t0, 4($sp) # Storing i + addi $t0, $zero, 110 + sb $t0, 13($v0) # internal_16[5] = 'n' - # Argument internal_14 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_14 + addi $t0, $zero, 111 + sb $t0, 14($v0) # internal_16[6] = 'o' - # Calling function function_mult - jal function_mult - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_15 = result of function_mult - addi $sp, $sp, 12 # Freeing space for arguments + addi $t0, $zero, 116 + sb $t0, 15($v0) # internal_16[7] = 't' - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t0, $zero, 104 + sb $t0, 16($v0) # internal_16[8] = 'h' - # Argument self - lw $t0, 88($sp) - sw $t0, 4($sp) # Storing self + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_16[9] = 'e' - # Argument internal_15 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_15 + addi $t0, $zero, 114 + sb $t0, 18($v0) # internal_16[10] = 'r' - # Calling function function_i2a_aux_at_A2I - jal function_i2a_aux_at_A2I - lw $ra, 8($sp) - sw $v1, 16($sp) # internal_16 = result of function_i2a_aux_at_A2I - addi $sp, $sp, 12 # Freeing space for arguments + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_16[11] = ' ' - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t0, $zero, 110 + sb $t0, 20($v0) # internal_16[12] = 'n' - # Argument internal_10 - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing internal_10 + addi $t0, $zero, 117 + sb $t0, 21($v0) # internal_16[13] = 'u' - # Argument internal_16 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_16 + addi $t0, $zero, 109 + sb $t0, 22($v0) # internal_16[14] = 'm' - # Calling function function_concat_at_String - jal function_concat_at_String - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_17 = result of function_concat_at_String - addi $sp, $sp, 12 # Freeing space for arguments + addi $t0, $zero, 98 + sb $t0, 23($v0) # internal_16[15] = 'b' - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 48($sp) - j end_assign - not_is_Bool_or_Int: - # internal_5 = internal_17 - lw $t0, 0($sp) - sw $t0, 48($sp) - end_assign: + addi $t0, $zero, 101 + sb $t0, 24($v0) # internal_16[16] = 'e' - # Jumping to endif_8743762787003 - j endif_8743762787003 + addi $t0, $zero, 114 + sb $t0, 25($v0) # internal_16[17] = 'r' - endif_8743762787003: + addi $t0, $zero, 46 + sb $t0, 26($v0) # internal_16[18] = '.' - lw $t0, 48($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 68($sp) - j end_assign - not_is_Bool_or_Int: - # internal_0 = internal_5 - lw $t0, 48($sp) - sw $t0, 68($sp) - end_assign: + addi $t0, $zero, 46 + sb $t0, 27($v0) # internal_16[19] = '.' - # Jumping to endif_8743762786997 - j endif_8743762786997 + addi $t0, $zero, 46 + sb $t0, 28($v0) # internal_16[20] = '.' - endif_8743762786997: + addi $t0, $zero, 101 + sb $t0, 29($v0) # internal_16[21] = 'e' - # Loading return value in $v1 - lw $v1, 68($sp) + addi $t0, $zero, 110 + sb $t0, 30($v0) # internal_16[22] = 'n' - # Freeing space for local variables - addi $sp, $sp, 72 + addi $t0, $zero, 116 + sb $t0, 31($v0) # internal_16[23] = 't' - jr $ra + addi $t0, $zero, 101 + sb $t0, 32($v0) # internal_16[24] = 'e' - function_i2a_aux_at_A2I: - # Function parameters - # $ra = 64($sp) - # self = 60($sp) - # i = 56($sp) + addi $t0, $zero, 114 + sb $t0, 33($v0) # internal_16[25] = 'r' - # Reserving space for local variables - addi $sp, $sp, -56 + addi $t0, $zero, 32 + sb $t0, 34($v0) # internal_16[26] = ' ' + addi $t0, $zero, 99 + sb $t0, 35($v0) # internal_16[27] = 'c' - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + addi $t0, $zero, 58 + sb $t0, 36($v0) # internal_16[28] = ':' - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_1 = address of allocated object Int + addi $t0, $zero, 10 + sb $t0, 37($v0) # internal_16[29] = '\n' - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + sb $zero, 38($v0) # Null-terminator at the end of the string - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_2 = address of allocated object Int + sw $v0, 144($sp) # internal_16 = "and another number...enter c:\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument i - lw $t0, 68($sp) - sw $t0, 4($sp) # Storing i + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self - # Argument internal_2 - lw $t0, 56($sp) - sw $t0, 0($sp) # Storing internal_2 + # Argument internal_16 + lw $t0, 156($sp) + sw $t0, 0($sp) # Storing internal_16 - # Calling function function_equal - jal function_equal + # Calling function function_out_string_at_IO + jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 52($sp) # internal_3 = result of function_equal + sw $v1, 152($sp) # internal_17 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 40($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 48($sp) - j end_assign - not_is_Bool_or_Int: - # internal_1 = internal_3 - lw $t0, 40($sp) - sw $t0, 48($sp) - end_assign: - - # If internal_1 then goto then_8743762787371 - lw $t0, 48($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762787371 - - # Jumping to else_8743762787371 - j else_8743762787371 - - then_8743762787371: - # Allocating String li $v0, 9 - addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 35 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 35 sw $t0, 4($v0) # Setting length of the string in the second word of the object - sb $zero, 8($v0) # Null-terminator at the end of the string + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_18[0] = '\t' - sw $v0, 36($sp) # internal_4 = "" + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_18[1] = 'T' - lw $t0, 36($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: - # internal_0 = internal_4 - lw $t0, 36($sp) - sw $t0, 52($sp) - end_assign: + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_18[2] = 'o' - # Jumping to endif_8743762787371 - j endif_8743762787371 + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_18[3] = ' ' - else_8743762787371: + addi $t0, $zero, 102 + sb $t0, 12($v0) # internal_18[4] = 'f' - # Allocating Int 10 - li $v0, 9 - addi $a0, $zero, 12 - syscall + addi $t0, $zero, 105 + sb $t0, 13($v0) # internal_18[5] = 'i' - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 10 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_6 = address of allocated object Int + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_18[6] = 'n' - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t0, $zero, 100 + sb $t0, 15($v0) # internal_18[7] = 'd' - # Argument i - lw $t0, 68($sp) - sw $t0, 4($sp) # Storing i + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_18[8] = ' ' - # Argument internal_6 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_6 + addi $t0, $zero, 116 + sb $t0, 17($v0) # internal_18[9] = 't' - # Calling function function_div - jal function_div - lw $ra, 8($sp) - sw $v1, 36($sp) # internal_7 = result of function_div - addi $sp, $sp, 12 # Freeing space for arguments + addi $t0, $zero, 104 + sb $t0, 18($v0) # internal_18[10] = 'h' - lw $t0, 24($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 32($sp) - j end_assign - not_is_Bool_or_Int: - # next = internal_7 - lw $t0, 24($sp) - sw $t0, 32($sp) - end_assign: + addi $t0, $zero, 101 + sb $t0, 19($v0) # internal_18[11] = 'e' - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_18[12] = ' ' - # Argument self - lw $t0, 72($sp) - sw $t0, 4($sp) # Storing self + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_18[13] = 'f' - # Argument next - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing next + addi $t0, $zero, 97 + sb $t0, 22($v0) # internal_18[14] = 'a' - # Calling function function_i2a_aux_at_A2I - jal function_i2a_aux_at_A2I - lw $ra, 8($sp) - sw $v1, 32($sp) # internal_8 = result of function_i2a_aux_at_A2I - addi $sp, $sp, 12 # Freeing space for arguments + addi $t0, $zero, 99 + sb $t0, 23($v0) # internal_18[15] = 'c' - # Allocating Int 10 - li $v0, 9 - addi $a0, $zero, 12 - syscall + addi $t0, $zero, 116 + sb $t0, 24($v0) # internal_18[16] = 't' - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 10 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_9 = address of allocated object Int + addi $t0, $zero, 111 + sb $t0, 25($v0) # internal_18[17] = 'o' - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t0, $zero, 114 + sb $t0, 26($v0) # internal_18[18] = 'r' - # Argument next - lw $t0, 44($sp) - sw $t0, 4($sp) # Storing next + addi $t0, $zero, 105 + sb $t0, 27($v0) # internal_18[19] = 'i' - # Argument internal_9 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_9 + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_18[20] = 'a' - # Calling function function_mult - jal function_mult - lw $ra, 8($sp) - sw $v1, 24($sp) # internal_10 = result of function_mult - addi $sp, $sp, 12 # Freeing space for arguments + addi $t0, $zero, 108 + sb $t0, 29($v0) # internal_18[21] = 'l' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_18[22] = ' ' - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t0, $zero, 111 + sb $t0, 31($v0) # internal_18[23] = 'o' - # Argument i - lw $t0, 68($sp) - sw $t0, 4($sp) # Storing i + addi $t0, $zero, 102 + sb $t0, 32($v0) # internal_18[24] = 'f' - # Argument internal_10 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_10 + addi $t0, $zero, 32 + sb $t0, 33($v0) # internal_18[25] = ' ' - # Calling function function_sub - jal function_sub - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_11 = result of function_sub - addi $sp, $sp, 12 # Freeing space for arguments + sb $zero, 34($v0) # Null-terminator at the end of the string + + sw $v0, 136($sp) # internal_18 = "\tTo find the factorial of " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 72($sp) + lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument internal_11 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_11 + # Argument internal_18 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_18 - # Calling function function_i2c_at_A2I - jal function_i2c_at_A2I + # Calling function function_out_string_at_IO + jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 16($sp) # internal_12 = result of function_i2c_at_A2I + sw $v1, 144($sp) # internal_19 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments + # Get attribute avar of self + lw $t0, 212($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497355846 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497355846 + j object_get_attribute_8794497355846 + int_get_attribute_8794497355846: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 128($sp) # internal_20 = self.avar + j end_get_attribute_8794497355846 + bool_get_attribute_8794497355846: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 128($sp) # internal_20 = self.avar + j end_get_attribute_8794497355846 + object_get_attribute_8794497355846: + sw $t1, 128($sp) # internal_20 = avar + end_get_attribute_8794497355846: + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_8 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_8 + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self - # Argument internal_12 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_12 + # Argument internal_20 + lw $t0, 140($sp) + sw $t0, 0($sp) # Storing internal_20 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function function_print_at_Main + jal function_print_at_Main lw $ra, 8($sp) - sw $v1, 12($sp) # internal_13 = result of function_concat_at_String + sw $v1, 136($sp) # internal_21 = result of function_print_at_Main addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: - # internal_0 = internal_13 - lw $t0, 0($sp) - sw $t0, 52($sp) - end_assign: - - # Jumping to endif_8743762787371 - j endif_8743762787371 - - endif_8743762787371: - - # Loading return value in $v1 - lw $v1, 52($sp) - - # Freeing space for local variables - addi $sp, $sp, 56 - - jr $ra - - function___init___at_Main: - # Function parameters - # $ra = 12($sp) - # self = 8($sp) - - # Reserving space for local variables - addi $sp, $sp, -8 - # Allocating String li $v0, 9 - addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 21 sw $t0, 4($v0) # Setting length of the string in the second word of the object - sb $zero, 8($v0) # Null-terminator at the end of the string + addi $t0, $zero, 46 + sb $t0, 8($v0) # internal_22[0] = '.' - sw $v0, 4($sp) # internal_0 = "" + addi $t0, $zero, 46 + sb $t0, 9($v0) # internal_22[1] = '.' - # Set attribute char of self - lw $t0, 8($sp) # $t0 = self - lw $t1, 4($sp) # $t1 = internal_0 - sw $t1, 8($t0) # self.char = internal_0 + addi $t0, $zero, 46 + sb $t0, 10($v0) # internal_22[2] = '.' - # Set attribute avar of self - lw $t0, 8($sp) # $t0 = self - sw $zero, 12($t0) # Set the attribute avar of self + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_22[3] = 'e' - # Set attribute a_var of self - lw $t0, 8($sp) # $t0 = self - sw $zero, 16($t0) # Set the attribute a_var of self + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_22[4] = 'n' - # Allocating Bool 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_22[5] = 't' - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_1 = address of allocated object Int + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_22[6] = 'e' - # Set attribute flag of self - lw $t0, 8($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_1 - sw $t1, 20($t0) # self.flag = internal_1 + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_22[7] = 'r' - # Loading return value in $v1 - lw $v1, 8($sp) + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_22[8] = ' ' - # Freeing space for local variables - addi $sp, $sp, 8 + addi $t0, $zero, 100 + sb $t0, 17($v0) # internal_22[9] = 'd' - jr $ra + addi $t0, $zero, 58 + sb $t0, 18($v0) # internal_22[10] = ':' - function_menu_at_Main: - # Function parameters - # $ra = 216($sp) - # self = 212($sp) + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_22[11] = '\n' - # Reserving space for local variables - addi $sp, $sp, -212 + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 120($sp) # internal_22 = "...enter d:\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_22 + lw $t0, 132($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 128($sp) # internal_23 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments # Allocating String li $v0, 9 - addi $a0, $zero, 30 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 21 + addi $t0, $zero, 20 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_0[0] = '\n' - addi $t0, $zero, 9 - sb $t0, 9($v0) # internal_0[1] = '\t' + sb $t0, 8($v0) # internal_24[0] = '\t' addi $t0, $zero, 84 - sb $t0, 10($v0) # internal_0[2] = 'T' + sb $t0, 9($v0) # internal_24[1] = 'T' addi $t0, $zero, 111 - sb $t0, 11($v0) # internal_0[3] = 'o' - - addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_0[4] = ' ' - - addi $t0, $zero, 97 - sb $t0, 13($v0) # internal_0[5] = 'a' - - addi $t0, $zero, 100 - sb $t0, 14($v0) # internal_0[6] = 'd' - - addi $t0, $zero, 100 - sb $t0, 15($v0) # internal_0[7] = 'd' + sb $t0, 10($v0) # internal_24[2] = 'o' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_0[8] = ' ' - - addi $t0, $zero, 97 - sb $t0, 17($v0) # internal_0[9] = 'a' + sb $t0, 11($v0) # internal_24[3] = ' ' - addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_0[10] = ' ' + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_24[4] = 's' - addi $t0, $zero, 110 - sb $t0, 19($v0) # internal_0[11] = 'n' + addi $t0, $zero, 113 + sb $t0, 13($v0) # internal_24[5] = 'q' addi $t0, $zero, 117 - sb $t0, 20($v0) # internal_0[12] = 'u' - - addi $t0, $zero, 109 - sb $t0, 21($v0) # internal_0[13] = 'm' - - addi $t0, $zero, 98 - sb $t0, 22($v0) # internal_0[14] = 'b' + sb $t0, 14($v0) # internal_24[6] = 'u' - addi $t0, $zero, 101 - sb $t0, 23($v0) # internal_0[15] = 'e' + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_24[7] = 'a' addi $t0, $zero, 114 - sb $t0, 24($v0) # internal_0[16] = 'r' - - addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_0[17] = ' ' - - addi $t0, $zero, 116 - sb $t0, 26($v0) # internal_0[18] = 't' + sb $t0, 16($v0) # internal_24[8] = 'r' - addi $t0, $zero, 111 - sb $t0, 27($v0) # internal_0[19] = 'o' + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_24[9] = 'e' addi $t0, $zero, 32 - sb $t0, 28($v0) # internal_0[20] = ' ' + sb $t0, 18($v0) # internal_24[10] = ' ' - sb $zero, 29($v0) # Null-terminator at the end of the string + sb $zero, 19($v0) # Null-terminator at the end of the string - sw $v0, 208($sp) # internal_0 = "\n\tTo add a number to " + sw $v0, 112($sp) # internal_24 = "\tTo square " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -7526,20 +8298,51 @@ lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument internal_0 - lw $t0, 220($sp) - sw $t0, 0($sp) # Storing internal_0 + # Argument internal_24 + lw $t0, 124($sp) + sw $t0, 0($sp) # Storing internal_24 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 216($sp) # internal_1 = result of function_out_string_at_IO + sw $v1, 120($sp) # internal_25 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Get attribute avar of self lw $t0, 212($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 200($sp) # internal_2 = avar + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497355954 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497355954 + j object_get_attribute_8794497355954 + int_get_attribute_8794497355954: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 104($sp) # internal_26 = self.avar + j end_get_attribute_8794497355954 + bool_get_attribute_8794497355954: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 104($sp) # internal_26 = self.avar + j end_get_attribute_8794497355954 + object_get_attribute_8794497355954: + sw $t1, 104($sp) # internal_26 = avar + end_get_attribute_8794497355954: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -7549,14 +8352,14 @@ lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument internal_2 - lw $t0, 212($sp) - sw $t0, 0($sp) # Storing internal_2 + # Argument internal_26 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_26 # Calling function function_print_at_Main jal function_print_at_Main lw $ra, 8($sp) - sw $v1, 208($sp) # internal_3 = result of function_print_at_Main + sw $v1, 112($sp) # internal_27 = result of function_print_at_Main addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -7567,48 +8370,48 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 12 + addi $t0, $zero, 21 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 46 - sb $t0, 8($v0) # internal_4[0] = '.' + sb $t0, 8($v0) # internal_28[0] = '.' addi $t0, $zero, 46 - sb $t0, 9($v0) # internal_4[1] = '.' + sb $t0, 9($v0) # internal_28[1] = '.' addi $t0, $zero, 46 - sb $t0, 10($v0) # internal_4[2] = '.' + sb $t0, 10($v0) # internal_28[2] = '.' addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_4[3] = 'e' + sb $t0, 11($v0) # internal_28[3] = 'e' addi $t0, $zero, 110 - sb $t0, 12($v0) # internal_4[4] = 'n' + sb $t0, 12($v0) # internal_28[4] = 'n' addi $t0, $zero, 116 - sb $t0, 13($v0) # internal_4[5] = 't' + sb $t0, 13($v0) # internal_28[5] = 't' addi $t0, $zero, 101 - sb $t0, 14($v0) # internal_4[6] = 'e' + sb $t0, 14($v0) # internal_28[6] = 'e' addi $t0, $zero, 114 - sb $t0, 15($v0) # internal_4[7] = 'r' + sb $t0, 15($v0) # internal_28[7] = 'r' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_4[8] = ' ' + sb $t0, 16($v0) # internal_28[8] = ' ' - addi $t0, $zero, 97 - sb $t0, 17($v0) # internal_4[9] = 'a' + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_28[9] = 'e' addi $t0, $zero, 58 - sb $t0, 18($v0) # internal_4[10] = ':' + sb $t0, 18($v0) # internal_28[10] = ':' addi $t0, $zero, 10 - sb $t0, 19($v0) # internal_4[11] = '\n' + sb $t0, 19($v0) # internal_28[11] = '\n' sb $zero, 20($v0) # Null-terminator at the end of the string - sw $v0, 192($sp) # internal_4 = "...enter a:\n" + sw $v0, 96($sp) # internal_28 = "...enter e:\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -7618,63 +8421,57 @@ lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument internal_4 - lw $t0, 204($sp) - sw $t0, 0($sp) # Storing internal_4 + # Argument internal_28 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_28 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 200($sp) # internal_5 = result of function_out_string_at_IO + sw $v1, 104($sp) # internal_29 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Allocating String li $v0, 9 - addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 18 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 11 + addi $t0, $zero, 18 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_6[0] = '\t' + sb $t0, 8($v0) # internal_30[0] = '\t' addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_6[1] = 'T' + sb $t0, 9($v0) # internal_30[1] = 'T' addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_6[2] = 'o' + sb $t0, 10($v0) # internal_30[2] = 'o' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_6[3] = ' ' - - addi $t0, $zero, 110 - sb $t0, 12($v0) # internal_6[4] = 'n' - - addi $t0, $zero, 101 - sb $t0, 13($v0) # internal_6[5] = 'e' + sb $t0, 11($v0) # internal_30[3] = ' ' - addi $t0, $zero, 103 - sb $t0, 14($v0) # internal_6[6] = 'g' + addi $t0, $zero, 99 + sb $t0, 12($v0) # internal_30[4] = 'c' - addi $t0, $zero, 97 - sb $t0, 15($v0) # internal_6[7] = 'a' + addi $t0, $zero, 117 + sb $t0, 13($v0) # internal_30[5] = 'u' - addi $t0, $zero, 116 - sb $t0, 16($v0) # internal_6[8] = 't' + addi $t0, $zero, 98 + sb $t0, 14($v0) # internal_30[6] = 'b' addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_6[9] = 'e' + sb $t0, 15($v0) # internal_30[7] = 'e' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_6[10] = ' ' + sb $t0, 16($v0) # internal_30[8] = ' ' - sb $zero, 19($v0) # Null-terminator at the end of the string + sb $zero, 17($v0) # Null-terminator at the end of the string - sw $v0, 184($sp) # internal_6 = "\tTo negate " + sw $v0, 88($sp) # internal_30 = "\tTo cube " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -7684,20 +8481,51 @@ lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument internal_6 - lw $t0, 196($sp) - sw $t0, 0($sp) # Storing internal_6 + # Argument internal_30 + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing internal_30 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 192($sp) # internal_7 = result of function_out_string_at_IO + sw $v1, 96($sp) # internal_31 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Get attribute avar of self lw $t0, 212($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 176($sp) # internal_8 = avar + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497356322 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497356322 + j object_get_attribute_8794497356322 + int_get_attribute_8794497356322: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 80($sp) # internal_32 = self.avar + j end_get_attribute_8794497356322 + bool_get_attribute_8794497356322: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 80($sp) # internal_32 = self.avar + j end_get_attribute_8794497356322 + object_get_attribute_8794497356322: + sw $t1, 80($sp) # internal_32 = avar + end_get_attribute_8794497356322: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -7707,14 +8535,14 @@ lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument internal_8 - lw $t0, 188($sp) - sw $t0, 0($sp) # Storing internal_8 + # Argument internal_32 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_32 # Calling function function_print_at_Main jal function_print_at_Main lw $ra, 8($sp) - sw $v1, 184($sp) # internal_9 = result of function_print_at_Main + sw $v1, 88($sp) # internal_33 = result of function_print_at_Main addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -7725,48 +8553,48 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 12 + addi $t0, $zero, 21 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 46 - sb $t0, 8($v0) # internal_10[0] = '.' + sb $t0, 8($v0) # internal_34[0] = '.' addi $t0, $zero, 46 - sb $t0, 9($v0) # internal_10[1] = '.' + sb $t0, 9($v0) # internal_34[1] = '.' addi $t0, $zero, 46 - sb $t0, 10($v0) # internal_10[2] = '.' + sb $t0, 10($v0) # internal_34[2] = '.' addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_10[3] = 'e' + sb $t0, 11($v0) # internal_34[3] = 'e' addi $t0, $zero, 110 - sb $t0, 12($v0) # internal_10[4] = 'n' + sb $t0, 12($v0) # internal_34[4] = 'n' addi $t0, $zero, 116 - sb $t0, 13($v0) # internal_10[5] = 't' + sb $t0, 13($v0) # internal_34[5] = 't' addi $t0, $zero, 101 - sb $t0, 14($v0) # internal_10[6] = 'e' + sb $t0, 14($v0) # internal_34[6] = 'e' addi $t0, $zero, 114 - sb $t0, 15($v0) # internal_10[7] = 'r' + sb $t0, 15($v0) # internal_34[7] = 'r' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_10[8] = ' ' + sb $t0, 16($v0) # internal_34[8] = ' ' - addi $t0, $zero, 98 - sb $t0, 17($v0) # internal_10[9] = 'b' + addi $t0, $zero, 102 + sb $t0, 17($v0) # internal_34[9] = 'f' addi $t0, $zero, 58 - sb $t0, 18($v0) # internal_10[10] = ':' + sb $t0, 18($v0) # internal_34[10] = ':' addi $t0, $zero, 10 - sb $t0, 19($v0) # internal_10[11] = '\n' + sb $t0, 19($v0) # internal_34[11] = '\n' sb $zero, 20($v0) # Null-terminator at the end of the string - sw $v0, 168($sp) # internal_10 = "...enter b:\n" + sw $v0, 72($sp) # internal_34 = "...enter f:\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -7776,126 +8604,78 @@ lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument internal_10 - lw $t0, 180($sp) - sw $t0, 0($sp) # Storing internal_10 + # Argument internal_34 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_34 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 176($sp) # internal_11 = result of function_out_string_at_IO + sw $v1, 80($sp) # internal_35 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Allocating String li $v0, 9 - addi $a0, $zero, 41 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 25 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 32 + addi $t0, $zero, 25 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_12[0] = '\t' + sb $t0, 8($v0) # internal_36[0] = '\t' addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_12[1] = 'T' + sb $t0, 9($v0) # internal_36[1] = 'T' addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_12[2] = 'o' + sb $t0, 10($v0) # internal_36[2] = 'o' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_12[3] = ' ' + sb $t0, 11($v0) # internal_36[3] = ' ' addi $t0, $zero, 102 - sb $t0, 12($v0) # internal_12[4] = 'f' + sb $t0, 12($v0) # internal_36[4] = 'f' addi $t0, $zero, 105 - sb $t0, 13($v0) # internal_12[5] = 'i' + sb $t0, 13($v0) # internal_36[5] = 'i' addi $t0, $zero, 110 - sb $t0, 14($v0) # internal_12[6] = 'n' + sb $t0, 14($v0) # internal_36[6] = 'n' addi $t0, $zero, 100 - sb $t0, 15($v0) # internal_12[7] = 'd' + sb $t0, 15($v0) # internal_36[7] = 'd' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_12[8] = ' ' + sb $t0, 16($v0) # internal_36[8] = ' ' - addi $t0, $zero, 116 - sb $t0, 17($v0) # internal_12[9] = 't' + addi $t0, $zero, 111 + sb $t0, 17($v0) # internal_36[9] = 'o' - addi $t0, $zero, 104 - sb $t0, 18($v0) # internal_12[10] = 'h' + addi $t0, $zero, 117 + sb $t0, 18($v0) # internal_36[10] = 'u' - addi $t0, $zero, 101 - sb $t0, 19($v0) # internal_12[11] = 'e' + addi $t0, $zero, 116 + sb $t0, 19($v0) # internal_36[11] = 't' addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_12[12] = ' ' - - addi $t0, $zero, 100 - sb $t0, 21($v0) # internal_12[13] = 'd' + sb $t0, 20($v0) # internal_36[12] = ' ' addi $t0, $zero, 105 - sb $t0, 22($v0) # internal_12[14] = 'i' - - addi $t0, $zero, 102 - sb $t0, 23($v0) # internal_12[15] = 'f' + sb $t0, 21($v0) # internal_36[13] = 'i' addi $t0, $zero, 102 - sb $t0, 24($v0) # internal_12[16] = 'f' - - addi $t0, $zero, 101 - sb $t0, 25($v0) # internal_12[17] = 'e' - - addi $t0, $zero, 114 - sb $t0, 26($v0) # internal_12[18] = 'r' - - addi $t0, $zero, 101 - sb $t0, 27($v0) # internal_12[19] = 'e' - - addi $t0, $zero, 110 - sb $t0, 28($v0) # internal_12[20] = 'n' - - addi $t0, $zero, 99 - sb $t0, 29($v0) # internal_12[21] = 'c' - - addi $t0, $zero, 101 - sb $t0, 30($v0) # internal_12[22] = 'e' - - addi $t0, $zero, 32 - sb $t0, 31($v0) # internal_12[23] = ' ' - - addi $t0, $zero, 98 - sb $t0, 32($v0) # internal_12[24] = 'b' - - addi $t0, $zero, 101 - sb $t0, 33($v0) # internal_12[25] = 'e' - - addi $t0, $zero, 116 - sb $t0, 34($v0) # internal_12[26] = 't' - - addi $t0, $zero, 119 - sb $t0, 35($v0) # internal_12[27] = 'w' - - addi $t0, $zero, 101 - sb $t0, 36($v0) # internal_12[28] = 'e' - - addi $t0, $zero, 101 - sb $t0, 37($v0) # internal_12[29] = 'e' - - addi $t0, $zero, 110 - sb $t0, 38($v0) # internal_12[30] = 'n' + sb $t0, 22($v0) # internal_36[14] = 'f' addi $t0, $zero, 32 - sb $t0, 39($v0) # internal_12[31] = ' ' + sb $t0, 23($v0) # internal_36[15] = ' ' - sb $zero, 40($v0) # Null-terminator at the end of the string + sb $zero, 24($v0) # Null-terminator at the end of the string - sw $v0, 160($sp) # internal_12 = "\tTo find the difference between " + sw $v0, 64($sp) # internal_36 = "\tTo find out if " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -7905,20 +8685,51 @@ lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument internal_12 - lw $t0, 172($sp) - sw $t0, 0($sp) # Storing internal_12 + # Argument internal_36 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_36 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 168($sp) # internal_13 = result of function_out_string_at_IO + sw $v1, 72($sp) # internal_37 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Get attribute avar of self lw $t0, 212($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 152($sp) # internal_14 = avar + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497356430 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497356430 + j object_get_attribute_8794497356430 + int_get_attribute_8794497356430: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 56($sp) # internal_38 = self.avar + j end_get_attribute_8794497356430 + bool_get_attribute_8794497356430: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 56($sp) # internal_38 = self.avar + j end_get_attribute_8794497356430 + object_get_attribute_8794497356430: + sw $t1, 56($sp) # internal_38 = avar + end_get_attribute_8794497356430: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -7928,14 +8739,14 @@ lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument internal_14 - lw $t0, 164($sp) - sw $t0, 0($sp) # Storing internal_14 + # Argument internal_38 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_38 # Calling function function_print_at_Main jal function_print_at_Main lw $ra, 8($sp) - sw $v1, 160($sp) # internal_15 = result of function_print_at_Main + sw $v1, 64($sp) # internal_39 = result of function_print_at_Main addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -7946,102 +8757,102 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 30 + addi $t0, $zero, 39 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 97 - sb $t0, 8($v0) # internal_16[0] = 'a' - - addi $t0, $zero, 110 - sb $t0, 9($v0) # internal_16[1] = 'n' - - addi $t0, $zero, 100 - sb $t0, 10($v0) # internal_16[2] = 'd' + addi $t0, $zero, 105 + sb $t0, 8($v0) # internal_40[0] = 'i' + + addi $t0, $zero, 115 + sb $t0, 9($v0) # internal_40[1] = 's' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_16[3] = ' ' + sb $t0, 10($v0) # internal_40[2] = ' ' addi $t0, $zero, 97 - sb $t0, 12($v0) # internal_16[4] = 'a' + sb $t0, 11($v0) # internal_40[3] = 'a' - addi $t0, $zero, 110 - sb $t0, 13($v0) # internal_16[5] = 'n' + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_40[4] = ' ' - addi $t0, $zero, 111 - sb $t0, 14($v0) # internal_16[6] = 'o' + addi $t0, $zero, 109 + sb $t0, 13($v0) # internal_40[5] = 'm' - addi $t0, $zero, 116 - sb $t0, 15($v0) # internal_16[7] = 't' + addi $t0, $zero, 117 + sb $t0, 14($v0) # internal_40[6] = 'u' - addi $t0, $zero, 104 - sb $t0, 16($v0) # internal_16[8] = 'h' + addi $t0, $zero, 108 + sb $t0, 15($v0) # internal_40[7] = 'l' - addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_16[9] = 'e' + addi $t0, $zero, 116 + sb $t0, 16($v0) # internal_40[8] = 't' - addi $t0, $zero, 114 - sb $t0, 18($v0) # internal_16[10] = 'r' + addi $t0, $zero, 105 + sb $t0, 17($v0) # internal_40[9] = 'i' - addi $t0, $zero, 32 - sb $t0, 19($v0) # internal_16[11] = ' ' + addi $t0, $zero, 112 + sb $t0, 18($v0) # internal_40[10] = 'p' - addi $t0, $zero, 110 - sb $t0, 20($v0) # internal_16[12] = 'n' + addi $t0, $zero, 108 + sb $t0, 19($v0) # internal_40[11] = 'l' - addi $t0, $zero, 117 - sb $t0, 21($v0) # internal_16[13] = 'u' + addi $t0, $zero, 101 + sb $t0, 20($v0) # internal_40[12] = 'e' - addi $t0, $zero, 109 - sb $t0, 22($v0) # internal_16[14] = 'm' + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_40[13] = ' ' - addi $t0, $zero, 98 - sb $t0, 23($v0) # internal_16[15] = 'b' + addi $t0, $zero, 111 + sb $t0, 22($v0) # internal_40[14] = 'o' - addi $t0, $zero, 101 - sb $t0, 24($v0) # internal_16[16] = 'e' + addi $t0, $zero, 102 + sb $t0, 23($v0) # internal_40[15] = 'f' - addi $t0, $zero, 114 - sb $t0, 25($v0) # internal_16[17] = 'r' + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_40[16] = ' ' + + addi $t0, $zero, 51 + sb $t0, 25($v0) # internal_40[17] = '3' addi $t0, $zero, 46 - sb $t0, 26($v0) # internal_16[18] = '.' + sb $t0, 26($v0) # internal_40[18] = '.' addi $t0, $zero, 46 - sb $t0, 27($v0) # internal_16[19] = '.' + sb $t0, 27($v0) # internal_40[19] = '.' addi $t0, $zero, 46 - sb $t0, 28($v0) # internal_16[20] = '.' + sb $t0, 28($v0) # internal_40[20] = '.' addi $t0, $zero, 101 - sb $t0, 29($v0) # internal_16[21] = 'e' + sb $t0, 29($v0) # internal_40[21] = 'e' addi $t0, $zero, 110 - sb $t0, 30($v0) # internal_16[22] = 'n' + sb $t0, 30($v0) # internal_40[22] = 'n' addi $t0, $zero, 116 - sb $t0, 31($v0) # internal_16[23] = 't' + sb $t0, 31($v0) # internal_40[23] = 't' addi $t0, $zero, 101 - sb $t0, 32($v0) # internal_16[24] = 'e' + sb $t0, 32($v0) # internal_40[24] = 'e' addi $t0, $zero, 114 - sb $t0, 33($v0) # internal_16[25] = 'r' + sb $t0, 33($v0) # internal_40[25] = 'r' addi $t0, $zero, 32 - sb $t0, 34($v0) # internal_16[26] = ' ' + sb $t0, 34($v0) # internal_40[26] = ' ' - addi $t0, $zero, 99 - sb $t0, 35($v0) # internal_16[27] = 'c' + addi $t0, $zero, 103 + sb $t0, 35($v0) # internal_40[27] = 'g' addi $t0, $zero, 58 - sb $t0, 36($v0) # internal_16[28] = ':' + sb $t0, 36($v0) # internal_40[28] = ':' addi $t0, $zero, 10 - sb $t0, 37($v0) # internal_16[29] = '\n' + sb $t0, 37($v0) # internal_40[29] = '\n' sb $zero, 38($v0) # Null-terminator at the end of the string - sw $v0, 144($sp) # internal_16 = "and another number...enter c:\n" + sw $v0, 48($sp) # internal_40 = "is a multiple of 3...enter g:\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -8051,131 +8862,198 @@ lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument internal_16 - lw $t0, 156($sp) - sw $t0, 0($sp) # Storing internal_16 + # Argument internal_40 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_40 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 152($sp) # internal_17 = result of function_out_string_at_IO + sw $v1, 56($sp) # internal_41 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Allocating String li $v0, 9 - addi $a0, $zero, 35 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 26 + addi $t0, $zero, 20 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_18[0] = '\t' + sb $t0, 8($v0) # internal_42[0] = '\t' addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_18[1] = 'T' + sb $t0, 9($v0) # internal_42[1] = 'T' addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_18[2] = 'o' + sb $t0, 10($v0) # internal_42[2] = 'o' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_18[3] = ' ' + sb $t0, 11($v0) # internal_42[3] = ' ' - addi $t0, $zero, 102 - sb $t0, 12($v0) # internal_18[4] = 'f' + addi $t0, $zero, 100 + sb $t0, 12($v0) # internal_42[4] = 'd' addi $t0, $zero, 105 - sb $t0, 13($v0) # internal_18[5] = 'i' + sb $t0, 13($v0) # internal_42[5] = 'i' - addi $t0, $zero, 110 - sb $t0, 14($v0) # internal_18[6] = 'n' + addi $t0, $zero, 118 + sb $t0, 14($v0) # internal_42[6] = 'v' + + addi $t0, $zero, 105 + sb $t0, 15($v0) # internal_42[7] = 'i' addi $t0, $zero, 100 - sb $t0, 15($v0) # internal_18[7] = 'd' + sb $t0, 16($v0) # internal_42[8] = 'd' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_42[9] = 'e' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_18[8] = ' ' + sb $t0, 18($v0) # internal_42[10] = ' ' - addi $t0, $zero, 116 - sb $t0, 17($v0) # internal_18[9] = 't' + sb $zero, 19($v0) # Null-terminator at the end of the string - addi $t0, $zero, 104 - sb $t0, 18($v0) # internal_18[10] = 'h' + sw $v0, 40($sp) # internal_42 = "\tTo divide " - addi $t0, $zero, 101 - sb $t0, 19($v0) # internal_18[11] = 'e' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_18[12] = ' ' + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self - addi $t0, $zero, 102 - sb $t0, 21($v0) # internal_18[13] = 'f' + # Argument internal_42 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_42 - addi $t0, $zero, 97 - sb $t0, 22($v0) # internal_18[14] = 'a' + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_43 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 99 - sb $t0, 23($v0) # internal_18[15] = 'c' + # Get attribute avar of self + lw $t0, 212($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497356538 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497356538 + j object_get_attribute_8794497356538 + int_get_attribute_8794497356538: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_44 = self.avar + j end_get_attribute_8794497356538 + bool_get_attribute_8794497356538: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_44 = self.avar + j end_get_attribute_8794497356538 + object_get_attribute_8794497356538: + sw $t1, 32($sp) # internal_44 = avar + end_get_attribute_8794497356538: - addi $t0, $zero, 116 - sb $t0, 24($v0) # internal_18[16] = 't' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 111 - sb $t0, 25($v0) # internal_18[17] = 'o' + # Argument self + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing self - addi $t0, $zero, 114 - sb $t0, 26($v0) # internal_18[18] = 'r' + # Argument internal_44 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_44 - addi $t0, $zero, 105 - sb $t0, 27($v0) # internal_18[19] = 'i' + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_45 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 97 - sb $t0, 28($v0) # internal_18[20] = 'a' + # Allocating String + li $v0, 9 + addi $a0, $zero, 25 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - addi $t0, $zero, 108 - sb $t0, 29($v0) # internal_18[21] = 'l' + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 32 - sb $t0, 30($v0) # internal_18[22] = ' ' + addi $t0, $zero, 25 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 111 - sb $t0, 31($v0) # internal_18[23] = 'o' + addi $t0, $zero, 98 + sb $t0, 8($v0) # internal_46[0] = 'b' - addi $t0, $zero, 102 - sb $t0, 32($v0) # internal_18[24] = 'f' + addi $t0, $zero, 121 + sb $t0, 9($v0) # internal_46[1] = 'y' addi $t0, $zero, 32 - sb $t0, 33($v0) # internal_18[25] = ' ' + sb $t0, 10($v0) # internal_46[2] = ' ' - sb $zero, 34($v0) # Null-terminator at the end of the string + addi $t0, $zero, 56 + sb $t0, 11($v0) # internal_46[3] = '8' - sw $v0, 136($sp) # internal_18 = "\tTo find the factorial of " + addi $t0, $zero, 46 + sb $t0, 12($v0) # internal_46[4] = '.' - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t0, $zero, 46 + sb $t0, 13($v0) # internal_46[5] = '.' - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self + addi $t0, $zero, 46 + sb $t0, 14($v0) # internal_46[6] = '.' + + addi $t0, $zero, 101 + sb $t0, 15($v0) # internal_46[7] = 'e' + + addi $t0, $zero, 110 + sb $t0, 16($v0) # internal_46[8] = 'n' + + addi $t0, $zero, 116 + sb $t0, 17($v0) # internal_46[9] = 't' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_46[10] = 'e' + + addi $t0, $zero, 114 + sb $t0, 19($v0) # internal_46[11] = 'r' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_46[12] = ' ' + + addi $t0, $zero, 104 + sb $t0, 21($v0) # internal_46[13] = 'h' + + addi $t0, $zero, 58 + sb $t0, 22($v0) # internal_46[14] = ':' - # Argument internal_18 - lw $t0, 148($sp) - sw $t0, 0($sp) # Storing internal_18 + addi $t0, $zero, 10 + sb $t0, 23($v0) # internal_46[15] = '\n' - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 144($sp) # internal_19 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments + sb $zero, 24($v0) # Null-terminator at the end of the string - # Get attribute avar of self - lw $t0, 212($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 128($sp) # internal_20 = avar + sw $v0, 24($sp) # internal_46 = "by 8...enter h:\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -8185,66 +9063,126 @@ lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument internal_20 - lw $t0, 140($sp) - sw $t0, 0($sp) # Storing internal_20 + # Argument internal_46 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_46 - # Calling function function_print_at_Main - jal function_print_at_Main + # Calling function function_out_string_at_IO + jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 136($sp) # internal_21 = result of function_print_at_Main + sw $v1, 32($sp) # internal_47 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Allocating String li $v0, 9 - addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 41 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 12 + addi $t0, $zero, 41 sw $t0, 4($v0) # Setting length of the string in the second word of the object + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_48[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_48[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_48[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_48[3] = ' ' + + addi $t0, $zero, 103 + sb $t0, 12($v0) # internal_48[4] = 'g' + + addi $t0, $zero, 101 + sb $t0, 13($v0) # internal_48[5] = 'e' + + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_48[6] = 't' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_48[7] = ' ' + + addi $t0, $zero, 97 + sb $t0, 16($v0) # internal_48[8] = 'a' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_48[9] = ' ' + + addi $t0, $zero, 110 + sb $t0, 18($v0) # internal_48[10] = 'n' + + addi $t0, $zero, 101 + sb $t0, 19($v0) # internal_48[11] = 'e' + + addi $t0, $zero, 119 + sb $t0, 20($v0) # internal_48[12] = 'w' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_48[13] = ' ' + + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_48[14] = 'n' + + addi $t0, $zero, 117 + sb $t0, 23($v0) # internal_48[15] = 'u' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_48[16] = 'm' + + addi $t0, $zero, 98 + sb $t0, 25($v0) # internal_48[17] = 'b' + + addi $t0, $zero, 101 + sb $t0, 26($v0) # internal_48[18] = 'e' + + addi $t0, $zero, 114 + sb $t0, 27($v0) # internal_48[19] = 'r' + addi $t0, $zero, 46 - sb $t0, 8($v0) # internal_22[0] = '.' + sb $t0, 28($v0) # internal_48[20] = '.' addi $t0, $zero, 46 - sb $t0, 9($v0) # internal_22[1] = '.' + sb $t0, 29($v0) # internal_48[21] = '.' addi $t0, $zero, 46 - sb $t0, 10($v0) # internal_22[2] = '.' + sb $t0, 30($v0) # internal_48[22] = '.' addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_22[3] = 'e' + sb $t0, 31($v0) # internal_48[23] = 'e' addi $t0, $zero, 110 - sb $t0, 12($v0) # internal_22[4] = 'n' + sb $t0, 32($v0) # internal_48[24] = 'n' addi $t0, $zero, 116 - sb $t0, 13($v0) # internal_22[5] = 't' + sb $t0, 33($v0) # internal_48[25] = 't' addi $t0, $zero, 101 - sb $t0, 14($v0) # internal_22[6] = 'e' + sb $t0, 34($v0) # internal_48[26] = 'e' addi $t0, $zero, 114 - sb $t0, 15($v0) # internal_22[7] = 'r' + sb $t0, 35($v0) # internal_48[27] = 'r' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_22[8] = ' ' + sb $t0, 36($v0) # internal_48[28] = ' ' - addi $t0, $zero, 100 - sb $t0, 17($v0) # internal_22[9] = 'd' + addi $t0, $zero, 106 + sb $t0, 37($v0) # internal_48[29] = 'j' addi $t0, $zero, 58 - sb $t0, 18($v0) # internal_22[10] = ':' + sb $t0, 38($v0) # internal_48[30] = ':' addi $t0, $zero, 10 - sb $t0, 19($v0) # internal_22[11] = '\n' + sb $t0, 39($v0) # internal_48[31] = '\n' - sb $zero, 20($v0) # Null-terminator at the end of the string + sb $zero, 40($v0) # Null-terminator at the end of the string - sw $v0, 120($sp) # internal_22 = "...enter d:\n" + sw $v0, 16($sp) # internal_48 = "\tTo get a new number...enter j:\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -8254,63 +9192,93 @@ lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument internal_22 - lw $t0, 132($sp) - sw $t0, 0($sp) # Storing internal_22 + # Argument internal_48 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_48 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 128($sp) # internal_23 = result of function_out_string_at_IO + sw $v1, 24($sp) # internal_49 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Allocating String li $v0, 9 - addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 30 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 11 + addi $t0, $zero, 30 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_24[0] = '\t' + sb $t0, 8($v0) # internal_50[0] = '\t' addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_24[1] = 'T' + sb $t0, 9($v0) # internal_50[1] = 'T' addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_24[2] = 'o' + sb $t0, 10($v0) # internal_50[2] = 'o' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_24[3] = ' ' - - addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_24[4] = 's' + sb $t0, 11($v0) # internal_50[3] = ' ' addi $t0, $zero, 113 - sb $t0, 13($v0) # internal_24[5] = 'q' + sb $t0, 12($v0) # internal_50[4] = 'q' addi $t0, $zero, 117 - sb $t0, 14($v0) # internal_24[6] = 'u' + sb $t0, 13($v0) # internal_50[5] = 'u' - addi $t0, $zero, 97 - sb $t0, 15($v0) # internal_24[7] = 'a' + addi $t0, $zero, 105 + sb $t0, 14($v0) # internal_50[6] = 'i' - addi $t0, $zero, 114 - sb $t0, 16($v0) # internal_24[8] = 'r' + addi $t0, $zero, 116 + sb $t0, 15($v0) # internal_50[7] = 't' + + addi $t0, $zero, 46 + sb $t0, 16($v0) # internal_50[8] = '.' + + addi $t0, $zero, 46 + sb $t0, 17($v0) # internal_50[9] = '.' + + addi $t0, $zero, 46 + sb $t0, 18($v0) # internal_50[10] = '.' addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_24[9] = 'e' + sb $t0, 19($v0) # internal_50[11] = 'e' + + addi $t0, $zero, 110 + sb $t0, 20($v0) # internal_50[12] = 'n' + + addi $t0, $zero, 116 + sb $t0, 21($v0) # internal_50[13] = 't' + + addi $t0, $zero, 101 + sb $t0, 22($v0) # internal_50[14] = 'e' + + addi $t0, $zero, 114 + sb $t0, 23($v0) # internal_50[15] = 'r' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_24[10] = ' ' + sb $t0, 24($v0) # internal_50[16] = ' ' - sb $zero, 19($v0) # Null-terminator at the end of the string + addi $t0, $zero, 113 + sb $t0, 25($v0) # internal_50[17] = 'q' - sw $v0, 112($sp) # internal_24 = "\tTo square " + addi $t0, $zero, 58 + sb $t0, 26($v0) # internal_50[18] = ':' + + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_50[19] = '\n' + + addi $t0, $zero, 10 + sb $t0, 28($v0) # internal_50[20] = '\n' + + sb $zero, 29($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_50 = "\tTo quit...enter q:\n\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -8320,1226 +9288,1749 @@ lw $t0, 224($sp) sw $t0, 4($sp) # Storing self - # Argument internal_24 - lw $t0, 124($sp) - sw $t0, 0($sp) # Storing internal_24 + # Argument internal_50 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_50 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 120($sp) # internal_25 = result of function_out_string_at_IO + sw $v1, 16($sp) # internal_51 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - # Get attribute avar of self - lw $t0, 212($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 104($sp) # internal_26 = avar + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_in_string_at_IO + jal function_in_string_at_IO + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_52 = result of function_in_string_at_IO + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 212 + + jr $ra + + function_prompt_at_Main: + # Function parameters + # $ra = 24($sp) + # self = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_0[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 16($sp) # internal_0 = "\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing self - # Argument internal_26 - lw $t0, 116($sp) - sw $t0, 0($sp) # Storing internal_26 + # Argument internal_0 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_0 - # Calling function function_print_at_Main - jal function_print_at_Main + # Calling function function_out_string_at_IO + jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 112($sp) # internal_27 = result of function_print_at_Main + sw $v1, 24($sp) # internal_1 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Allocating String li $v0, 9 - addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 35 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 12 + addi $t0, $zero, 35 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 46 - sb $t0, 8($v0) # internal_28[0] = '.' + addi $t0, $zero, 80 + sb $t0, 8($v0) # internal_2[0] = 'P' - addi $t0, $zero, 46 - sb $t0, 9($v0) # internal_28[1] = '.' + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_2[1] = 'l' - addi $t0, $zero, 46 - sb $t0, 10($v0) # internal_28[2] = '.' + addi $t0, $zero, 101 + sb $t0, 10($v0) # internal_2[2] = 'e' + + addi $t0, $zero, 97 + sb $t0, 11($v0) # internal_2[3] = 'a' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_2[4] = 's' addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_28[3] = 'e' + sb $t0, 13($v0) # internal_2[5] = 'e' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_2[6] = ' ' + + addi $t0, $zero, 101 + sb $t0, 15($v0) # internal_2[7] = 'e' addi $t0, $zero, 110 - sb $t0, 12($v0) # internal_28[4] = 'n' + sb $t0, 16($v0) # internal_2[8] = 'n' addi $t0, $zero, 116 - sb $t0, 13($v0) # internal_28[5] = 't' + sb $t0, 17($v0) # internal_2[9] = 't' addi $t0, $zero, 101 - sb $t0, 14($v0) # internal_28[6] = 'e' + sb $t0, 18($v0) # internal_2[10] = 'e' addi $t0, $zero, 114 - sb $t0, 15($v0) # internal_28[7] = 'r' + sb $t0, 19($v0) # internal_2[11] = 'r' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_28[8] = ' ' + sb $t0, 20($v0) # internal_2[12] = ' ' + + addi $t0, $zero, 97 + sb $t0, 21($v0) # internal_2[13] = 'a' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_2[14] = ' ' + + addi $t0, $zero, 110 + sb $t0, 23($v0) # internal_2[15] = 'n' + + addi $t0, $zero, 117 + sb $t0, 24($v0) # internal_2[16] = 'u' + + addi $t0, $zero, 109 + sb $t0, 25($v0) # internal_2[17] = 'm' + + addi $t0, $zero, 98 + sb $t0, 26($v0) # internal_2[18] = 'b' addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_28[9] = 'e' + sb $t0, 27($v0) # internal_2[19] = 'e' - addi $t0, $zero, 58 - sb $t0, 18($v0) # internal_28[10] = ':' + addi $t0, $zero, 114 + sb $t0, 28($v0) # internal_2[20] = 'r' - addi $t0, $zero, 10 - sb $t0, 19($v0) # internal_28[11] = '\n' + addi $t0, $zero, 46 + sb $t0, 29($v0) # internal_2[21] = '.' - sb $zero, 20($v0) # Null-terminator at the end of the string + addi $t0, $zero, 46 + sb $t0, 30($v0) # internal_2[22] = '.' - sw $v0, 96($sp) # internal_28 = "...enter e:\n" + addi $t0, $zero, 46 + sb $t0, 31($v0) # internal_2[23] = '.' + + addi $t0, $zero, 32 + sb $t0, 32($v0) # internal_2[24] = ' ' + + addi $t0, $zero, 32 + sb $t0, 33($v0) # internal_2[25] = ' ' + + sb $zero, 34($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_2 = "Please enter a number... " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing self - # Argument internal_28 - lw $t0, 108($sp) - sw $t0, 0($sp) # Storing internal_28 + # Argument internal_2 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_2 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 104($sp) # internal_29 = result of function_out_string_at_IO + sw $v1, 16($sp) # internal_3 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - # Allocating String - li $v0, 9 - addi $a0, $zero, 18 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 9 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_30[0] = '\t' + # Argument self + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing self - addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_30[1] = 'T' + # Calling function function_in_string_at_IO + jal function_in_string_at_IO + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_4 = result of function_in_string_at_IO + addi $sp, $sp, 8 # Freeing space for arguments - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_30[2] = 'o' + # Loading return value in $v1 + lw $v1, 0($sp) - addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_30[3] = ' ' + # Freeing space for local variables + addi $sp, $sp, 20 - addi $t0, $zero, 99 - sb $t0, 12($v0) # internal_30[4] = 'c' + jr $ra - addi $t0, $zero, 117 - sb $t0, 13($v0) # internal_30[5] = 'u' + function_get_int_at_Main: + # Function parameters + # $ra = 24($sp) + # self = 20($sp) - addi $t0, $zero, 98 - sb $t0, 14($v0) # internal_30[6] = 'b' + # Reserving space for local variables + addi $sp, $sp, -20 - addi $t0, $zero, 101 - sb $t0, 15($v0) # internal_30[7] = 'e' + # Allocating A2I + li $v0, 9 + lw $a0, type_A2I + syscall + la $t0, type_A2I # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_1 = address of allocated object A2I - addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_30[8] = ' ' + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - sb $zero, 17($v0) # Null-terminator at the end of the string + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 - sw $v0, 88($sp) # internal_30 = "\tTo cube " + # Calling function function___init___at_A2I + jal function___init___at_A2I + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_1 = result of function___init___at_A2I + addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self + # Argument z + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing z - # Argument internal_30 - lw $t0, 100($sp) - sw $t0, 0($sp) # Storing internal_30 + # Argument internal_1 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_1 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function function_assign + jal function_assign lw $ra, 8($sp) - sw $v1, 96($sp) # internal_31 = result of function_out_string_at_IO + sw $v1, 28($sp) # z = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # Get attribute avar of self - lw $t0, 212($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 80($sp) # internal_32 = avar + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_prompt_at_Main + jal function_prompt_at_Main + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_3 = result of function_prompt_at_Main + addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self + # Argument s + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing s - # Argument internal_32 - lw $t0, 92($sp) - sw $t0, 0($sp) # Storing internal_32 + # Argument internal_3 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_3 - # Calling function function_print_at_Main - jal function_print_at_Main + # Calling function function_assign + jal function_assign lw $ra, 8($sp) - sw $v1, 88($sp) # internal_33 = result of function_print_at_Main + sw $v1, 20($sp) # s = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # Allocating String - li $v0, 9 - addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 12 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 46 - sb $t0, 8($v0) # internal_34[0] = '.' - - addi $t0, $zero, 46 - sb $t0, 9($v0) # internal_34[1] = '.' - - addi $t0, $zero, 46 - sb $t0, 10($v0) # internal_34[2] = '.' - - addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_34[3] = 'e' - - addi $t0, $zero, 110 - sb $t0, 12($v0) # internal_34[4] = 'n' - - addi $t0, $zero, 116 - sb $t0, 13($v0) # internal_34[5] = 't' - - addi $t0, $zero, 101 - sb $t0, 14($v0) # internal_34[6] = 'e' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 114 - sb $t0, 15($v0) # internal_34[7] = 'r' + # Argument z + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing z - addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_34[8] = ' ' + # Argument s + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing s - addi $t0, $zero, 102 - sb $t0, 17($v0) # internal_34[9] = 'f' + # Calling function function_a2i_at_A2I + jal function_a2i_at_A2I + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_4 = result of function_a2i_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 58 - sb $t0, 18($v0) # internal_34[10] = ':' + # Loading return value in $v1 + lw $v1, 0($sp) - addi $t0, $zero, 10 - sb $t0, 19($v0) # internal_34[11] = '\n' + # Freeing space for local variables + addi $sp, $sp, 20 - sb $zero, 20($v0) # Null-terminator at the end of the string + jr $ra - sw $v0, 72($sp) # internal_34 = "...enter f:\n" + function_is_even_at_Main: + # Function parameters + # $ra = 96($sp) + # self = 92($sp) + # num = 88($sp) + + # Reserving space for local variables + addi $sp, $sp, -88 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self + # Argument x + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing x - # Argument internal_34 - lw $t0, 84($sp) - sw $t0, 0($sp) # Storing internal_34 + # Argument num + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing num - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function function_assign + jal function_assign lw $ra, 8($sp) - sw $v1, 80($sp) # internal_35 = result of function_out_string_at_IO + sw $v1, 96($sp) # x = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # Allocating String + # Allocating Bool 0 li $v0, 9 - addi $a0, $zero, 25 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Bool # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_2 = address of allocated object Int - addi $t0, $zero, 16 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_36[0] = '\t' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_3 = address of allocated object Int - addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_36[1] = 'T' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_36[2] = 'o' + # Argument x + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing x - addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_36[3] = ' ' + # Argument internal_3 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_3 - addi $t0, $zero, 102 - sb $t0, 12($v0) # internal_36[4] = 'f' + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_4 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 105 - sb $t0, 13($v0) # internal_36[5] = 'i' + # internal_2 = internal_4 + lw $t0, 68($sp) + sw $t0, 76($sp) - addi $t0, $zero, 110 - sb $t0, 14($v0) # internal_36[6] = 'n' + # If internal_2 then goto then_8794497403462 + lw $t0, 76($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8794497403462 - addi $t0, $zero, 100 - sb $t0, 15($v0) # internal_36[7] = 'd' + # Jumping to else_8794497403462 + j else_8794497403462 - addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_36[8] = ' ' + then_8794497403462: - addi $t0, $zero, 111 - sb $t0, 17($v0) # internal_36[9] = 'o' + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 117 - sb $t0, 18($v0) # internal_36[10] = 'u' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_5 = address of allocated object Int - addi $t0, $zero, 116 - sb $t0, 19($v0) # internal_36[11] = 't' + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_36[12] = ' ' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_6 = address of allocated object Int - addi $t0, $zero, 105 - sb $t0, 21($v0) # internal_36[13] = 'i' + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 102 - sb $t0, 22($v0) # internal_36[14] = 'f' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_7 = address of allocated object Int - addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_36[15] = ' ' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - sb $zero, 24($v0) # Null-terminator at the end of the string + # Argument x + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing x - sw $v0, 64($sp) # internal_36 = "\tTo find out if " + # Argument internal_6 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_7 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self + # Argument internal_7 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_7 - # Argument internal_36 + # Argument internal_5 lw $t0, 76($sp) - sw $t0, 0($sp) # Storing internal_36 + sw $t0, 0($sp) # Storing internal_5 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function function_add + jal function_add lw $ra, 8($sp) - sw $v1, 72($sp) # internal_37 = result of function_out_string_at_IO + sw $v1, 68($sp) # internal_7 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Get attribute avar of self - lw $t0, 212($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 56($sp) # internal_38 = avar - # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 104($sp) sw $t0, 4($sp) # Storing self - # Argument internal_38 + # Argument internal_7 lw $t0, 68($sp) - sw $t0, 0($sp) # Storing internal_38 + sw $t0, 0($sp) # Storing internal_7 - # Calling function function_print_at_Main - jal function_print_at_Main + # Calling function function_is_even_at_Main + jal function_is_even_at_Main lw $ra, 8($sp) - sw $v1, 64($sp) # internal_39 = result of function_print_at_Main + sw $v1, 64($sp) # internal_8 = result of function_is_even_at_Main addi $sp, $sp, 12 # Freeing space for arguments - # Allocating String - li $v0, 9 - addi $a0, $zero, 39 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 30 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 105 - sb $t0, 8($v0) # internal_40[0] = 'i' - - addi $t0, $zero, 115 - sb $t0, 9($v0) # internal_40[1] = 's' - - addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_40[2] = ' ' - - addi $t0, $zero, 97 - sb $t0, 11($v0) # internal_40[3] = 'a' - - addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_40[4] = ' ' - - addi $t0, $zero, 109 - sb $t0, 13($v0) # internal_40[5] = 'm' - - addi $t0, $zero, 117 - sb $t0, 14($v0) # internal_40[6] = 'u' - - addi $t0, $zero, 108 - sb $t0, 15($v0) # internal_40[7] = 'l' - - addi $t0, $zero, 116 - sb $t0, 16($v0) # internal_40[8] = 't' - - addi $t0, $zero, 105 - sb $t0, 17($v0) # internal_40[9] = 'i' - - addi $t0, $zero, 112 - sb $t0, 18($v0) # internal_40[10] = 'p' - - addi $t0, $zero, 108 - sb $t0, 19($v0) # internal_40[11] = 'l' - - addi $t0, $zero, 101 - sb $t0, 20($v0) # internal_40[12] = 'e' - - addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_40[13] = ' ' - - addi $t0, $zero, 111 - sb $t0, 22($v0) # internal_40[14] = 'o' + # internal_1 = internal_8 + lw $t0, 52($sp) + sw $t0, 80($sp) - addi $t0, $zero, 102 - sb $t0, 23($v0) # internal_40[15] = 'f' + # Jumping to endif_8794497403462 + j endif_8794497403462 - addi $t0, $zero, 32 - sb $t0, 24($v0) # internal_40[16] = ' ' + else_8794497403462: - addi $t0, $zero, 51 - sb $t0, 25($v0) # internal_40[17] = '3' + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 46 - sb $t0, 26($v0) # internal_40[18] = '.' + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_10 = address of allocated object Int - addi $t0, $zero, 46 - sb $t0, 27($v0) # internal_40[19] = '.' + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 46 - sb $t0, 28($v0) # internal_40[20] = '.' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_11 = address of allocated object Int - addi $t0, $zero, 101 - sb $t0, 29($v0) # internal_40[21] = 'e' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 110 - sb $t0, 30($v0) # internal_40[22] = 'n' + # Argument internal_11 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_11 - addi $t0, $zero, 116 - sb $t0, 31($v0) # internal_40[23] = 't' + # Argument x + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing x - addi $t0, $zero, 101 - sb $t0, 32($v0) # internal_40[24] = 'e' + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_12 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 114 - sb $t0, 33($v0) # internal_40[25] = 'r' + # internal_10 = internal_12 + lw $t0, 36($sp) + sw $t0, 44($sp) - addi $t0, $zero, 32 - sb $t0, 34($v0) # internal_40[26] = ' ' + # If internal_10 then goto then_8794497403465 + lw $t0, 44($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8794497403465 - addi $t0, $zero, 103 - sb $t0, 35($v0) # internal_40[27] = 'g' + # Jumping to else_8794497403465 + j else_8794497403465 - addi $t0, $zero, 58 - sb $t0, 36($v0) # internal_40[28] = ':' + then_8794497403465: - addi $t0, $zero, 10 - sb $t0, 37($v0) # internal_40[29] = '\n' + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - sb $zero, 38($v0) # Null-terminator at the end of the string + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_13 = address of allocated object Int - sw $v0, 48($sp) # internal_40 = "is a multiple of 3...enter g:\n" + # internal_9 = internal_13 + lw $t0, 32($sp) + sw $t0, 48($sp) - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + # Jumping to endif_8794497403465 + j endif_8794497403465 - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self + else_8794497403465: - # Argument internal_40 - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing internal_40 + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 56($sp) # internal_41 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_15 = address of allocated object Int - # Allocating String + # Allocating Int 1 li $v0, 9 - addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_16 = address of allocated object Int - addi $t0, $zero, 11 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_42[0] = '\t' + # Argument internal_16 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_16 - addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_42[1] = 'T' + # Argument x + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing x - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_42[2] = 'o' + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_17 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_42[3] = ' ' + # internal_15 = internal_17 + lw $t0, 16($sp) + sw $t0, 24($sp) - addi $t0, $zero, 100 - sb $t0, 12($v0) # internal_42[4] = 'd' + # If internal_15 then goto then_8794497403471 + lw $t0, 24($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8794497403471 - addi $t0, $zero, 105 - sb $t0, 13($v0) # internal_42[5] = 'i' + # Jumping to else_8794497403471 + j else_8794497403471 - addi $t0, $zero, 118 - sb $t0, 14($v0) # internal_42[6] = 'v' + then_8794497403471: - addi $t0, $zero, 105 - sb $t0, 15($v0) # internal_42[7] = 'i' + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 100 - sb $t0, 16($v0) # internal_42[8] = 'd' + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_18 = address of allocated object Int - addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_42[9] = 'e' + # internal_14 = internal_18 + lw $t0, 12($sp) + sw $t0, 28($sp) - addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_42[10] = ' ' + # Jumping to endif_8794497403471 + j endif_8794497403471 - sb $zero, 19($v0) # Null-terminator at the end of the string + else_8794497403471: - sw $v0, 40($sp) # internal_42 = "\tTo divide " + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_19 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self + # Argument x + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing x - # Argument internal_42 - lw $t0, 52($sp) - sw $t0, 0($sp) # Storing internal_42 + # Argument internal_19 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_19 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function function_sub + jal function_sub lw $ra, 8($sp) - sw $v1, 48($sp) # internal_43 = result of function_out_string_at_IO + sw $v1, 16($sp) # internal_20 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments - # Get attribute avar of self - lw $t0, 212($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 32($sp) # internal_44 = avar - # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 104($sp) sw $t0, 4($sp) # Storing self - # Argument internal_44 - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_44 + # Argument internal_20 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_20 - # Calling function function_print_at_Main - jal function_print_at_Main + # Calling function function_is_even_at_Main + jal function_is_even_at_Main lw $ra, 8($sp) - sw $v1, 40($sp) # internal_45 = result of function_print_at_Main + sw $v1, 12($sp) # internal_21 = result of function_is_even_at_Main addi $sp, $sp, 12 # Freeing space for arguments - # Allocating String - li $v0, 9 - addi $a0, $zero, 25 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall + # internal_14 = internal_21 + lw $t0, 0($sp) + sw $t0, 28($sp) - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object + # Jumping to endif_8794497403471 + j endif_8794497403471 - addi $t0, $zero, 16 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + endif_8794497403471: - addi $t0, $zero, 98 - sb $t0, 8($v0) # internal_46[0] = 'b' + # internal_9 = internal_14 + lw $t0, 28($sp) + sw $t0, 48($sp) + + # Jumping to endif_8794497403465 + j endif_8794497403465 + + endif_8794497403465: + + # internal_1 = internal_9 + lw $t0, 48($sp) + sw $t0, 80($sp) + + # Jumping to endif_8794497403462 + j endif_8794497403462 + + endif_8794497403462: + + # Loading return value in $v1 + lw $v1, 80($sp) + + # Freeing space for local variables + addi $sp, $sp, 88 + + jr $ra + + function_class_type_at_Main: + # Function parameters + # $ra = 300($sp) + # self = 296($sp) + # var = 292($sp) - addi $t0, $zero, 121 - sb $t0, 9($v0) # internal_46[1] = 'y' + # Reserving space for local variables + addi $sp, $sp, -292 - addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_46[2] = ' ' + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 56 - sb $t0, 11($v0) # internal_46[3] = '8' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 288($sp) # internal_0 = address of allocated object Int - addi $t0, $zero, 46 - sb $t0, 12($v0) # internal_46[4] = '.' + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 46 - sb $t0, 13($v0) # internal_46[5] = '.' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 284($sp) # internal_1 = address of allocated object Int - addi $t0, $zero, 46 - sb $t0, 14($v0) # internal_46[6] = '.' + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 101 - sb $t0, 15($v0) # internal_46[7] = 'e' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 280($sp) # internal_2 = address of allocated object Int - addi $t0, $zero, 110 - sb $t0, 16($v0) # internal_46[8] = 'n' + # Allocating NUll to internal_3 + sw $zero, 276($sp) # internal_3 = 0 - addi $t0, $zero, 116 - sb $t0, 17($v0) # internal_46[9] = 't' + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 101 - sb $t0, 18($v0) # internal_46[10] = 'e' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 272($sp) # internal_4 = address of allocated object Int - addi $t0, $zero, 114 - sb $t0, 19($v0) # internal_46[11] = 'r' + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_46[12] = ' ' + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 260($sp) # internal_7 = address of allocated object Int - addi $t0, $zero, 104 - sb $t0, 21($v0) # internal_46[13] = 'h' + # internal_5 = typeof var that is the first word of the object + lw $t0, 292($sp) + lw $t0, 0($t0) + sw $t0, 268($sp) - addi $t0, $zero, 58 - sb $t0, 22($v0) # internal_46[14] = ':' + # internal_6 = internal_5 + lw $t0, 268($sp) + sw $t0, 264($sp) - addi $t0, $zero, 10 - sb $t0, 23($v0) # internal_46[15] = '\n' + while_start_8794497403564: - sb $zero, 24($v0) # Null-terminator at the end of the string + # internal_7 = EqualAddress(internal_6, internal_3) + lw $t0, 264($sp) + lw $t1, 276($sp) + seq $t2, $t0, $t1 + lw $t0, 260($sp) + sw $t2, 8($t0) - sw $v0, 24($sp) # internal_46 = "by 8...enter h:\n" + # If internal_7 then goto while_end_8794497403564 + lw $t0, 260($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8794497403564 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self + # Argument internal_4 + lw $t0, 284($sp) + sw $t0, 4($sp) # Storing internal_4 - # Argument internal_46 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_46 + # Argument internal_1 + lw $t0, 296($sp) + sw $t0, 0($sp) # Storing internal_1 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function function_add + jal function_add lw $ra, 8($sp) - sw $v1, 32($sp) # internal_47 = result of function_out_string_at_IO + sw $v1, 284($sp) # internal_4 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Allocating String - li $v0, 9 - addi $a0, $zero, 41 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 32 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_48[0] = '\t' + # internal_6 = ancestor of internal_6 + lw $t0, 264($sp) + lw $t0, 4($t0) + sw $t0, 264($sp) - addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_48[1] = 'T' + # Jumping to while_start_8794497403564 + j while_start_8794497403564 - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_48[2] = 'o' + while_end_8794497403564: - addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_48[3] = ' ' + # internal_6 = internal_5 + lw $t0, 268($sp) + sw $t0, 264($sp) - addi $t0, $zero, 103 - sb $t0, 12($v0) # internal_48[4] = 'g' + # initialize Array [internal_4] + lw $t0, 272($sp) # $t0 = internal_4 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 256($sp) # internal_8 = new Array[internal_4] - addi $t0, $zero, 101 - sb $t0, 13($v0) # internal_48[5] = 'e' + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 116 - sb $t0, 14($v0) # internal_48[6] = 't' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 252($sp) # internal_9 = address of allocated object Int - addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_48[7] = ' ' + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 97 - sb $t0, 16($v0) # internal_48[8] = 'a' + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 248($sp) # internal_10 = address of allocated object Int - addi $t0, $zero, 32 - sb $t0, 17($v0) # internal_48[9] = ' ' + foreach_start_8794497403564: - addi $t0, $zero, 110 - sb $t0, 18($v0) # internal_48[10] = 'n' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 101 - sb $t0, 19($v0) # internal_48[11] = 'e' + # Argument internal_9 + lw $t0, 264($sp) + sw $t0, 4($sp) # Storing internal_9 - addi $t0, $zero, 119 - sb $t0, 20($v0) # internal_48[12] = 'w' + # Argument internal_4 + lw $t0, 284($sp) + sw $t0, 0($sp) # Storing internal_4 - addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_48[13] = ' ' + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 260($sp) # internal_10 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 110 - sb $t0, 22($v0) # internal_48[14] = 'n' + # If internal_10 then goto foreach_body_8794497403564 + lw $t0, 248($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8794497403564 - addi $t0, $zero, 117 - sb $t0, 23($v0) # internal_48[15] = 'u' + # Jumping to foreach_end_8794497403564 + j foreach_end_8794497403564 - addi $t0, $zero, 109 - sb $t0, 24($v0) # internal_48[16] = 'm' + foreach_body_8794497403564: - addi $t0, $zero, 98 - sb $t0, 25($v0) # internal_48[17] = 'b' + # array internal_8[4 * internal_9] = internal_6 + lw $t0, 252($sp) # $t0 = internal_9 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 256($sp) # $t1 = internal_8 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 264($sp) + sw $t0, 0($t1) - addi $t0, $zero, 101 - sb $t0, 26($v0) # internal_48[18] = 'e' + # internal_6 = ancestor of internal_6 + lw $t0, 264($sp) + lw $t0, 4($t0) + sw $t0, 264($sp) - addi $t0, $zero, 114 - sb $t0, 27($v0) # internal_48[19] = 'r' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 46 - sb $t0, 28($v0) # internal_48[20] = '.' + # Argument internal_9 + lw $t0, 264($sp) + sw $t0, 4($sp) # Storing internal_9 - addi $t0, $zero, 46 - sb $t0, 29($v0) # internal_48[21] = '.' + # Argument internal_1 + lw $t0, 296($sp) + sw $t0, 0($sp) # Storing internal_1 - addi $t0, $zero, 46 - sb $t0, 30($v0) # internal_48[22] = '.' + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 264($sp) # internal_9 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 101 - sb $t0, 31($v0) # internal_48[23] = 'e' + # Jumping to foreach_start_8794497403564 + j foreach_start_8794497403564 - addi $t0, $zero, 110 - sb $t0, 32($v0) # internal_48[24] = 'n' + foreach_end_8794497403564: - addi $t0, $zero, 116 - sb $t0, 33($v0) # internal_48[25] = 't' + # initialize Array [internal_2] + lw $t0, 280($sp) # $t0 = internal_2 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 244($sp) # internal_11 = new Array[internal_2] + + # initialize Array [internal_2] + lw $t0, 280($sp) # $t0 = internal_2 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 240($sp) # internal_12 = new Array[internal_2] - addi $t0, $zero, 101 - sb $t0, 34($v0) # internal_48[26] = 'e' + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 114 - sb $t0, 35($v0) # internal_48[27] = 'r' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 232($sp) # internal_14 = address of allocated object Int - addi $t0, $zero, 32 - sb $t0, 36($v0) # internal_48[28] = ' ' + # internal_13 = direction of A + la $t0, type_A + sw $t0, 236($sp) + + # array internal_11[4 * internal_14] = internal_13 + lw $t0, 232($sp) # $t0 = internal_14 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 244($sp) # $t1 = internal_11 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 236($sp) + sw $t0, 0($t1) + + # array internal_12[4 * internal_14] = internal_4 + lw $t0, 232($sp) # $t0 = internal_14 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 240($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 272($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - addi $t0, $zero, 106 - sb $t0, 37($v0) # internal_48[29] = 'j' + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 58 - sb $t0, 38($v0) # internal_48[30] = ':' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 224($sp) # internal_16 = address of allocated object Int - addi $t0, $zero, 10 - sb $t0, 39($v0) # internal_48[31] = '\n' + # internal_15 = direction of B + la $t0, type_B + sw $t0, 228($sp) + + # array internal_11[4 * internal_16] = internal_15 + lw $t0, 224($sp) # $t0 = internal_16 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 244($sp) # $t1 = internal_11 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 228($sp) + sw $t0, 0($t1) + + # array internal_12[4 * internal_16] = internal_4 + lw $t0, 224($sp) # $t0 = internal_16 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 240($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 272($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - sb $zero, 40($v0) # Null-terminator at the end of the string + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall - sw $v0, 16($sp) # internal_48 = "\tTo get a new number...enter j:\n" + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 216($sp) # internal_18 = address of allocated object Int - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + # internal_17 = direction of C + la $t0, type_C + sw $t0, 220($sp) + + # array internal_11[4 * internal_18] = internal_17 + lw $t0, 216($sp) # $t0 = internal_18 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 244($sp) # $t1 = internal_11 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 220($sp) + sw $t0, 0($t1) + + # array internal_12[4 * internal_18] = internal_4 + lw $t0, 216($sp) # $t0 = internal_18 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 240($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 272($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Argument internal_48 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_48 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 208($sp) # internal_20 = address of allocated object Int - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 24($sp) # internal_49 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments + # internal_19 = direction of D + la $t0, type_D + sw $t0, 212($sp) + + # array internal_11[4 * internal_20] = internal_19 + lw $t0, 208($sp) # $t0 = internal_20 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 244($sp) # $t1 = internal_11 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 212($sp) + sw $t0, 0($t1) + + # array internal_12[4 * internal_20] = internal_4 + lw $t0, 208($sp) # $t0 = internal_20 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 240($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 272($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # Allocating String + # Allocating Int 4 li $v0, 9 - addi $a0, $zero, 30 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 200($sp) # internal_22 = address of allocated object Int - addi $t0, $zero, 21 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + # internal_21 = direction of E + la $t0, type_E + sw $t0, 204($sp) - addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_50[0] = '\t' + # array internal_11[4 * internal_22] = internal_21 + lw $t0, 200($sp) # $t0 = internal_22 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 244($sp) # $t1 = internal_11 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 204($sp) + sw $t0, 0($t1) + + # array internal_12[4 * internal_22] = internal_4 + lw $t0, 200($sp) # $t0 = internal_22 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 240($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 272($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_50[1] = 'T' + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_50[2] = 'o' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 192($sp) # internal_24 = address of allocated object Int - addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_50[3] = ' ' + # internal_23 = direction of Object + la $t0, type_Object + sw $t0, 196($sp) + + # array internal_11[4 * internal_24] = internal_23 + lw $t0, 192($sp) # $t0 = internal_24 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 244($sp) # $t1 = internal_11 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 196($sp) + sw $t0, 0($t1) + + # array internal_12[4 * internal_24] = internal_4 + lw $t0, 192($sp) # $t0 = internal_24 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 240($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 272($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - addi $t0, $zero, 113 - sb $t0, 12($v0) # internal_50[4] = 'q' + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 117 - sb $t0, 13($v0) # internal_50[5] = 'u' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 188($sp) # internal_25 = address of allocated object Int - addi $t0, $zero, 105 - sb $t0, 14($v0) # internal_50[6] = 'i' + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 116 - sb $t0, 15($v0) # internal_50[7] = 't' + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 184($sp) # internal_26 = address of allocated object Int - addi $t0, $zero, 46 - sb $t0, 16($v0) # internal_50[8] = '.' + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 46 - sb $t0, 17($v0) # internal_50[9] = '.' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 176($sp) # internal_28 = address of allocated object Int - addi $t0, $zero, 46 - sb $t0, 18($v0) # internal_50[10] = '.' + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 101 - sb $t0, 19($v0) # internal_50[11] = 'e' + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 172($sp) # internal_29 = address of allocated object Int - addi $t0, $zero, 110 - sb $t0, 20($v0) # internal_50[12] = 'n' + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 116 - sb $t0, 21($v0) # internal_50[13] = 't' + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 164($sp) # internal_31 = address of allocated object Int - addi $t0, $zero, 101 - sb $t0, 22($v0) # internal_50[14] = 'e' + foreach_type_start_8794497403564: - addi $t0, $zero, 114 - sb $t0, 23($v0) # internal_50[15] = 'r' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 32 - sb $t0, 24($v0) # internal_50[16] = ' ' + # Argument internal_25 + lw $t0, 200($sp) + sw $t0, 4($sp) # Storing internal_25 - addi $t0, $zero, 113 - sb $t0, 25($v0) # internal_50[17] = 'q' + # Argument internal_2 + lw $t0, 292($sp) + sw $t0, 0($sp) # Storing internal_2 - addi $t0, $zero, 58 - sb $t0, 26($v0) # internal_50[18] = ':' + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 196($sp) # internal_26 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 10 - sb $t0, 27($v0) # internal_50[19] = '\n' + # If internal_26 then goto foreach_type_body_8794497403564 + lw $t0, 184($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8794497403564 - addi $t0, $zero, 10 - sb $t0, 28($v0) # internal_50[20] = '\n' + # Jumping to foreach_type_end_8794497403564 + j foreach_type_end_8794497403564 - sb $zero, 29($v0) # Null-terminator at the end of the string + foreach_type_body_8794497403564: - sw $v0, 8($sp) # internal_50 = "\tTo quit...enter q:\n\n" + # internal_27 = array internal_11[4 * internal_25] + lw $t0, 188($sp) # $t0 = internal_25 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 244($sp) # $t1 = internal_11 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 180($sp) # internal_27 = array internal_11[4 * internal_25] # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self + # Argument internal_28 + lw $t0, 188($sp) + sw $t0, 4($sp) # Storing internal_28 - # Argument internal_50 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_50 + # Argument internal_0 + lw $t0, 300($sp) + sw $t0, 0($sp) # Storing internal_0 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function function_assign + jal function_assign lw $ra, 8($sp) - sw $v1, 16($sp) # internal_51 = result of function_out_string_at_IO + sw $v1, 188($sp) # internal_28 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments + foreach_ancestor_start_8794497403564: + # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 220($sp) - sw $t0, 0($sp) # Storing self + # Argument internal_28 + lw $t0, 188($sp) + sw $t0, 4($sp) # Storing internal_28 - # Calling function function_in_string_at_IO - jal function_in_string_at_IO - lw $ra, 4($sp) - sw $v1, 8($sp) # internal_52 = result of function_in_string_at_IO - addi $sp, $sp, 8 # Freeing space for arguments + # Argument internal_4 + lw $t0, 284($sp) + sw $t0, 0($sp) # Storing internal_4 - # Loading return value in $v1 - lw $v1, 0($sp) + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 184($sp) # internal_29 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - # Freeing space for local variables - addi $sp, $sp, 212 + # If internal_29 then goto foreach_ancestor_body_8794497403564 + lw $t0, 172($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8794497403564 - jr $ra + # Jumping to foreach_ancestor_end_8794497403564 + j foreach_ancestor_end_8794497403564 - function_prompt_at_Main: - # Function parameters - # $ra = 24($sp) - # self = 20($sp) + foreach_ancestor_body_8794497403564: - # Reserving space for local variables - addi $sp, $sp, -20 + # internal_30 = array internal_8[4 * internal_28] + lw $t0, 176($sp) # $t0 = internal_28 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 256($sp) # $t1 = internal_8 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 168($sp) # internal_30 = array internal_8[4 * internal_28] - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall + # internal_31 = EqualAddress(internal_27, internal_30) + lw $t0, 180($sp) + lw $t1, 168($sp) + seq $t2, $t0, $t1 + lw $t0, 164($sp) + sw $t2, 8($t0) - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object + # If internal_31 then goto foreach_ancestor_end_8794497403564 + lw $t0, 164($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8794497403564 - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_0[0] = '\n' + # Argument internal_28 + lw $t0, 188($sp) + sw $t0, 4($sp) # Storing internal_28 - sb $zero, 9($v0) # Null-terminator at the end of the string + # Argument internal_1 + lw $t0, 296($sp) + sw $t0, 0($sp) # Storing internal_1 - sw $v0, 16($sp) # internal_0 = "\n" + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 188($sp) # internal_28 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_ancestor_start_8794497403564 + j foreach_ancestor_start_8794497403564 + + foreach_ancestor_end_8794497403564: + + # array internal_12[4 * internal_25] = internal_28 + lw $t0, 188($sp) # $t0 = internal_25 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 240($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 176($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing self + # Argument internal_25 + lw $t0, 200($sp) + sw $t0, 4($sp) # Storing internal_25 - # Argument internal_0 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_0 + # Argument internal_1 + lw $t0, 296($sp) + sw $t0, 0($sp) # Storing internal_1 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function function_add + jal function_add lw $ra, 8($sp) - sw $v1, 24($sp) # internal_1 = result of function_out_string_at_IO + sw $v1, 200($sp) # internal_25 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments + # Jumping to foreach_type_start_8794497403564 + j foreach_type_start_8794497403564 + + foreach_type_end_8794497403564: + # Allocating String li $v0, 9 - addi $a0, $zero, 35 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 26 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 80 - sb $t0, 8($v0) # internal_2[0] = 'P' + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_37[0] = '\n' - addi $t0, $zero, 108 - sb $t0, 9($v0) # internal_2[1] = 'l' + sb $zero, 9($v0) # Null-terminator at the end of the string - addi $t0, $zero, 101 - sb $t0, 10($v0) # internal_2[2] = 'e' + sw $v0, 140($sp) # internal_37 = "\n" - addi $t0, $zero, 97 - sb $t0, 11($v0) # internal_2[3] = 'a' + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_2[4] = 's' + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 101 - sb $t0, 13($v0) # internal_2[5] = 'e' + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_2[6] = ' ' - - addi $t0, $zero, 101 - sb $t0, 15($v0) # internal_2[7] = 'e' - - addi $t0, $zero, 110 - sb $t0, 16($v0) # internal_2[8] = 'n' - - addi $t0, $zero, 116 - sb $t0, 17($v0) # internal_2[9] = 't' - - addi $t0, $zero, 101 - sb $t0, 18($v0) # internal_2[10] = 'e' + sb $t0, 8($v0) # internal_38[0] = ' ' - addi $t0, $zero, 114 - sb $t0, 19($v0) # internal_2[11] = 'r' + sb $zero, 9($v0) # Null-terminator at the end of the string - addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_2[12] = ' ' + sw $v0, 136($sp) # internal_38 = " " - addi $t0, $zero, 97 - sb $t0, 21($v0) # internal_2[13] = 'a' + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 32 - sb $t0, 22($v0) # internal_2[14] = ' ' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_32 = address of allocated object Int - addi $t0, $zero, 110 - sb $t0, 23($v0) # internal_2[15] = 'n' + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 117 - sb $t0, 24($v0) # internal_2[16] = 'u' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 156($sp) # internal_33 = address of allocated object Int - addi $t0, $zero, 109 - sb $t0, 25($v0) # internal_2[17] = 'm' + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 98 - sb $t0, 26($v0) # internal_2[18] = 'b' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 152($sp) # internal_34 = address of allocated object Int - addi $t0, $zero, 101 - sb $t0, 27($v0) # internal_2[19] = 'e' + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 114 - sb $t0, 28($v0) # internal_2[20] = 'r' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 148($sp) # internal_35 = address of allocated object Int - addi $t0, $zero, 46 - sb $t0, 29($v0) # internal_2[21] = '.' + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 46 - sb $t0, 30($v0) # internal_2[22] = '.' + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_36 = address of allocated object Int - addi $t0, $zero, 46 - sb $t0, 31($v0) # internal_2[23] = '.' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 32 - sb $t0, 32($v0) # internal_2[24] = ' ' + # Argument internal_35 + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing internal_35 - addi $t0, $zero, 32 - sb $t0, 33($v0) # internal_2[25] = ' ' + # Argument internal_4 + lw $t0, 284($sp) + sw $t0, 0($sp) # Storing internal_4 - sb $zero, 34($v0) # Null-terminator at the end of the string + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 160($sp) # internal_35 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - sw $v0, 8($sp) # internal_2 = "Please enter a number... " + foreach_min_start_8794497403564: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing self + # Argument internal_32 + lw $t0, 172($sp) + sw $t0, 4($sp) # Storing internal_32 # Argument internal_2 - lw $t0, 20($sp) + lw $t0, 292($sp) sw $t0, 0($sp) # Storing internal_2 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function function_less_than + jal function_less_than lw $ra, 8($sp) - sw $v1, 16($sp) # internal_3 = result of function_out_string_at_IO + sw $v1, 156($sp) # internal_36 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument self - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_in_string_at_IO - jal function_in_string_at_IO - lw $ra, 4($sp) - sw $v1, 8($sp) # internal_4 = result of function_in_string_at_IO - addi $sp, $sp, 8 # Freeing space for arguments + # If internal_36 then goto foreach_min_body_8794497403564 + lw $t0, 144($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8794497403564 - # Loading return value in $v1 - lw $v1, 0($sp) + # Jumping to foreach_min_end_8794497403564 + j foreach_min_end_8794497403564 - # Freeing space for local variables - addi $sp, $sp, 20 + foreach_min_body_8794497403564: - jr $ra + # internal_34 = array internal_12[4 * internal_32] + lw $t0, 160($sp) # $t0 = internal_32 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 240($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 152($sp) # internal_34 = array internal_12[4 * internal_32] + sw $t0, 8($t2) - function_get_int_at_Main: - # Function parameters - # $ra = 24($sp) - # self = 20($sp) + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Reserving space for local variables - addi $sp, $sp, -20 + # Argument internal_34 + lw $t0, 164($sp) + sw $t0, 4($sp) # Storing internal_34 - # Allocating A2I - li $v0, 9 - lw $a0, type_A2I - syscall - la $t0, type_A2I # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 12($sp) # internal_1 = address of allocated object A2I + # Argument internal_35 + lw $t0, 160($sp) + sw $t0, 0($sp) # Storing internal_35 - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 156($sp) # internal_36 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - # Argument internal_1 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_1 + # If internal_36 then goto update_min_8794497403564 + lw $t0, 144($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8794497403564 - # Calling function function___init___at_A2I - jal function___init___at_A2I - lw $ra, 4($sp) - sw $v1, 20($sp) # internal_1 = result of function___init___at_A2I - addi $sp, $sp, 8 # Freeing space for arguments + # Jumping to update_min_end_8794497403564 + j update_min_end_8794497403564 - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 16($sp) - j end_assign - not_is_Bool_or_Int: - # z = internal_1 - lw $t0, 12($sp) - sw $t0, 16($sp) - end_assign: + update_min_8794497403564: # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing self + # Argument internal_35 + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing internal_35 - # Calling function function_prompt_at_Main - jal function_prompt_at_Main - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_3 = result of function_prompt_at_Main - addi $sp, $sp, 8 # Freeing space for arguments + # Argument internal_34 + lw $t0, 164($sp) + sw $t0, 0($sp) # Storing internal_34 - lw $t0, 4($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 8($sp) - j end_assign - not_is_Bool_or_Int: - # s = internal_3 - lw $t0, 4($sp) - sw $t0, 8($sp) - end_assign: + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 160($sp) # internal_35 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument z - lw $t0, 28($sp) - sw $t0, 4($sp) # Storing z + # Argument internal_33 + lw $t0, 168($sp) + sw $t0, 4($sp) # Storing internal_33 - # Argument s - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing s + # Argument internal_32 + lw $t0, 172($sp) + sw $t0, 0($sp) # Storing internal_32 - # Calling function function_a2i_at_A2I - jal function_a2i_at_A2I + # Calling function function_assign + jal function_assign lw $ra, 8($sp) - sw $v1, 12($sp) # internal_4 = result of function_a2i_at_A2I + sw $v1, 168($sp) # internal_33 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # Loading return value in $v1 - lw $v1, 0($sp) + update_min_end_8794497403564: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Freeing space for local variables - addi $sp, $sp, 20 + # Argument internal_32 + lw $t0, 172($sp) + sw $t0, 4($sp) # Storing internal_32 - jr $ra + # Argument internal_1 + lw $t0, 296($sp) + sw $t0, 0($sp) # Storing internal_1 - function_is_even_at_Main: - # Function parameters - # $ra = 96($sp) - # self = 92($sp) - # num = 88($sp) + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 172($sp) # internal_32 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - # Reserving space for local variables - addi $sp, $sp, -88 + # Jumping to foreach_min_start_8794497403564 + j foreach_min_start_8794497403564 - lw $t0, 88($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 84($sp) - j end_assign - not_is_Bool_or_Int: - # x = num - lw $t0, 88($sp) - sw $t0, 84($sp) - end_assign: + foreach_min_end_8794497403564: + # initialize Array [internal_2] + lw $t0, 280($sp) # $t0 = internal_2 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 132($sp) # internal_39 = new Array[internal_2] - # Allocating Bool 0 + # Allocating Int 0 li $v0, 9 addi $a0, $zero, 12 syscall - la $t0, type_Bool # $t0 = address of the type + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 76($sp) # internal_2 = address of allocated object Int + sw $v0, 128($sp) # internal_40 = address of allocated object Int + + # array internal_39[4 * internal_40] = internal_0 + lw $t0, 128($sp) # $t0 = internal_40 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 132($sp) # $t1 = internal_39 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 288($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # Allocating Int 0 + # Allocating Int 1 li $v0, 9 addi $a0, $zero, 12 syscall @@ -9547,116 +11038,165 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 72($sp) # internal_3 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument x - lw $t0, 96($sp) - sw $t0, 4($sp) # Storing x + sw $v0, 124($sp) # internal_41 = address of allocated object Int + + # array internal_39[4 * internal_41] = internal_0 + lw $t0, 124($sp) # $t0 = internal_41 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 132($sp) # $t1 = internal_39 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 288($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # Argument internal_3 - lw $t0, 84($sp) - sw $t0, 0($sp) # Storing internal_3 + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Calling function function_less_than - jal function_less_than - lw $ra, 8($sp) - sw $v1, 80($sp) # internal_4 = result of function_less_than - addi $sp, $sp, 12 # Freeing space for arguments + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_42 = address of allocated object Int + + # array internal_39[4 * internal_42] = internal_0 + lw $t0, 120($sp) # $t0 = internal_42 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 132($sp) # $t1 = internal_39 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 288($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - lw $t0, 68($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 76($sp) - j end_assign - not_is_Bool_or_Int: - # internal_2 = internal_4 - lw $t0, 68($sp) - sw $t0, 76($sp) - end_assign: + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # If internal_2 then goto then_8743762788868 - lw $t0, 76($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762788868 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 116($sp) # internal_43 = address of allocated object Int + + # array internal_39[4 * internal_43] = internal_0 + lw $t0, 116($sp) # $t0 = internal_43 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 132($sp) # $t1 = internal_39 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 288($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # Jumping to else_8743762788868 - j else_8743762788868 + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall - then_8743762788868: + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_44 = address of allocated object Int + + # array internal_39[4 * internal_44] = internal_0 + lw $t0, 112($sp) # $t0 = internal_44 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 132($sp) # $t1 = internal_39 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 288($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # Xor operation - lw $t0, 84($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 60($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall - lw $t0, 56($sp) # $t0 = internal_7 - sw $t2, 8($t0) # Setting value in the third word of the Int object + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_45 = address of allocated object Int + + # array internal_39[4 * internal_45] = internal_0 + lw $t0, 108($sp) # $t0 = internal_45 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 132($sp) # $t1 = internal_39 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 288($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # Addition operation - lw $t0, 56($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 64($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - add $t2, $t0, $t1 # $t2 = $t0 + $t1 + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - lw $t0, 56($sp) # $t0 = internal_7 - sw $t2, 8($t0) # Setting value in the third word of the Int object + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_46 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 104($sp) - sw $t0, 4($sp) # Storing self + # Argument internal_35 + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing internal_35 - # Argument internal_7 - lw $t0, 68($sp) - sw $t0, 0($sp) # Storing internal_7 + # Argument internal_4 + lw $t0, 284($sp) + sw $t0, 0($sp) # Storing internal_4 - # Calling function function_is_even_at_Main - jal function_is_even_at_Main + # Calling function function_equal + jal function_equal lw $ra, 8($sp) - sw $v1, 64($sp) # internal_8 = result of function_is_even_at_Main + sw $v1, 116($sp) # internal_46 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 52($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 80($sp) - j end_assign - not_is_Bool_or_Int: - # internal_1 = internal_8 - lw $t0, 52($sp) - sw $t0, 80($sp) - end_assign: - - # Jumping to endif_8743762788868 - j endif_8743762788868 - - else_8743762788868: - + # If internal_46 then goto error_branch_8794497403564 + lw $t0, 104($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8794497403564 + + # array internal_39[4 * internal_33] = internal_1 + lw $t0, 156($sp) # $t0 = internal_33 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 132($sp) # $t1 = internal_39 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 284($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) # Allocating Bool 0 li $v0, 9 @@ -9668,7 +11208,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_10 = address of allocated object Int + sw $v0, 100($sp) # internal_47 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -9680,1533 +11220,1728 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_11 = address of allocated object Int + sw $v0, 96($sp) # internal_48 = address of allocated object Int + + # internal_47 = array internal_39[4 * internal_48] + lw $t0, 96($sp) # $t0 = internal_48 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 132($sp) # $t1 = internal_39 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 100($sp) # internal_47 = array internal_39[4 * internal_48] + sw $t0, 8($t2) + + # If internal_47 then goto branch_A_8794497403564 + lw $t0, 100($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_A_8794497403564 - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Argument internal_11 - lw $t0, 52($sp) - sw $t0, 4($sp) # Storing internal_11 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 92($sp) # internal_49 = address of allocated object Int + + # internal_47 = array internal_39[4 * internal_49] + lw $t0, 92($sp) # $t0 = internal_49 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 132($sp) # $t1 = internal_39 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 100($sp) # internal_47 = array internal_39[4 * internal_49] + sw $t0, 8($t2) + + # If internal_47 then goto branch_B_8794497403564 + lw $t0, 100($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_B_8794497403564 - # Argument x - lw $t0, 96($sp) - sw $t0, 0($sp) # Storing x + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 48($sp) # internal_12 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_50 = address of allocated object Int + + # internal_47 = array internal_39[4 * internal_50] + lw $t0, 88($sp) # $t0 = internal_50 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 132($sp) # $t1 = internal_39 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 100($sp) # internal_47 = array internal_39[4 * internal_50] + sw $t0, 8($t2) + + # If internal_47 then goto branch_C_8794497403564 + lw $t0, 100($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_C_8794497403564 - lw $t0, 36($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: - # internal_10 = internal_12 - lw $t0, 36($sp) - sw $t0, 44($sp) - end_assign: + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # If internal_10 then goto then_8743762788871 - lw $t0, 44($sp) # Loading the address of the condition + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_51 = address of allocated object Int + + # internal_47 = array internal_39[4 * internal_51] + lw $t0, 84($sp) # $t0 = internal_51 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 132($sp) # $t1 = internal_39 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 100($sp) # internal_47 = array internal_39[4 * internal_51] + sw $t0, 8($t2) + + # If internal_47 then goto branch_D_8794497403564 + lw $t0, 100($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762788871 + beq $t0, $t1, branch_D_8794497403564 - # Jumping to else_8743762788871 - j else_8743762788871 + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall - then_8743762788871: + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_52 = address of allocated object Int + + # internal_47 = array internal_39[4 * internal_52] + lw $t0, 80($sp) # $t0 = internal_52 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 132($sp) # $t1 = internal_39 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 100($sp) # internal_47 = array internal_39[4 * internal_52] + sw $t0, 8($t2) + + # If internal_47 then goto branch_E_8794497403564 + lw $t0, 100($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_E_8794497403564 - # Allocating Bool 1 + # Allocating Int 5 li $v0, 9 addi $a0, $zero, 12 syscall - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_13 = address of allocated object Int + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_53 = address of allocated object Int + + # internal_47 = array internal_39[4 * internal_53] + lw $t0, 76($sp) # $t0 = internal_53 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 132($sp) # $t1 = internal_39 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 100($sp) # internal_47 = array internal_39[4 * internal_53] + sw $t0, 8($t2) + + # If internal_47 then goto branch_Object_8794497403564 + lw $t0, 100($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Object_8794497403564 + + branch_A_8794497403564: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument a + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing a + + # Argument var + lw $t0, 304($sp) + sw $t0, 0($sp) # Storing var + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 80($sp) # a = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 29 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_56[0] = 'C' + + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_56[1] = 'l' + + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_56[2] = 'a' - lw $t0, 32($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 48($sp) - j end_assign - not_is_Bool_or_Int: - # internal_9 = internal_13 - lw $t0, 32($sp) - sw $t0, 48($sp) - end_assign: + addi $t0, $zero, 115 + sb $t0, 11($v0) # internal_56[3] = 's' - # Jumping to endif_8743762788871 - j endif_8743762788871 + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_56[4] = 's' - else_8743762788871: + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_56[5] = ' ' + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_56[6] = 't' - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + addi $t0, $zero, 121 + sb $t0, 15($v0) # internal_56[7] = 'y' - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_15 = address of allocated object Int + addi $t0, $zero, 112 + sb $t0, 16($v0) # internal_56[8] = 'p' - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_56[9] = 'e' - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_16 = address of allocated object Int + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_56[10] = ' ' - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_56[11] = 'i' - # Argument internal_16 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_16 + addi $t0, $zero, 115 + sb $t0, 20($v0) # internal_56[12] = 's' - # Argument x - lw $t0, 96($sp) - sw $t0, 0($sp) # Storing x + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_56[13] = ' ' - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 28($sp) # internal_17 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_56[14] = 'n' - lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: - # internal_15 = internal_17 - lw $t0, 16($sp) - sw $t0, 24($sp) - end_assign: + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_56[15] = 'o' - # If internal_15 then goto then_8743762788877 - lw $t0, 24($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762788877 + addi $t0, $zero, 119 + sb $t0, 24($v0) # internal_56[16] = 'w' - # Jumping to else_8743762788877 - j else_8743762788877 + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_56[17] = ' ' - then_8743762788877: + addi $t0, $zero, 65 + sb $t0, 26($v0) # internal_56[18] = 'A' - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_56[19] = '\n' - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_18 = address of allocated object Int + sb $zero, 28($v0) # Null-terminator at the end of the string - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 28($sp) - j end_assign - not_is_Bool_or_Int: - # internal_14 = internal_18 - lw $t0, 12($sp) - sw $t0, 28($sp) - end_assign: + sw $v0, 64($sp) # internal_56 = "Class type is now A\n" - # Jumping to endif_8743762788877 - j endif_8743762788877 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - else_8743762788877: + # Argument self + lw $t0, 308($sp) + sw $t0, 4($sp) # Storing self - # Allocating Int 2 - li $v0, 9 - addi $a0, $zero, 12 - syscall + # Argument internal_56 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_56 - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 2 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_19 = address of allocated object Int + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 72($sp) # internal_57 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument x - lw $t0, 96($sp) - sw $t0, 4($sp) # Storing x + # Argument internal_54 + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing internal_54 - # Argument internal_19 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_19 + # Argument internal_57 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_57 - # Calling function function_sub - jal function_sub + # Calling function function_assign + jal function_assign lw $ra, 8($sp) - sw $v1, 16($sp) # internal_20 = result of function_sub + sw $v1, 84($sp) # internal_54 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments + # internal_54 = internal_57 + lw $t0, 60($sp) + sw $t0, 72($sp) + + # Jumping to branch_end_8794497403564 + j branch_end_8794497403564 + + branch_B_8794497403564: + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 104($sp) - sw $t0, 4($sp) # Storing self + # Argument b + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing b - # Argument internal_20 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_20 + # Argument var + lw $t0, 304($sp) + sw $t0, 0($sp) # Storing var - # Calling function function_is_even_at_Main - jal function_is_even_at_Main + # Calling function function_assign + jal function_assign lw $ra, 8($sp) - sw $v1, 12($sp) # internal_21 = result of function_is_even_at_Main + sw $v1, 68($sp) # b = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 28($sp) - j end_assign - not_is_Bool_or_Int: - # internal_14 = internal_21 - lw $t0, 0($sp) - sw $t0, 28($sp) - end_assign: + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - # Jumping to endif_8743762788877 - j endif_8743762788877 + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - endif_8743762788877: + addi $t0, $zero, 29 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 48($sp) - j end_assign - not_is_Bool_or_Int: - # internal_9 = internal_14 - lw $t0, 28($sp) - sw $t0, 48($sp) - end_assign: + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_59[0] = 'C' - # Jumping to endif_8743762788871 - j endif_8743762788871 + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_59[1] = 'l' - endif_8743762788871: + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_59[2] = 'a' - lw $t0, 48($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 80($sp) - j end_assign - not_is_Bool_or_Int: - # internal_1 = internal_9 - lw $t0, 48($sp) - sw $t0, 80($sp) - end_assign: + addi $t0, $zero, 115 + sb $t0, 11($v0) # internal_59[3] = 's' - # Jumping to endif_8743762788868 - j endif_8743762788868 + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_59[4] = 's' - endif_8743762788868: + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_59[5] = ' ' - # Loading return value in $v1 - lw $v1, 80($sp) + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_59[6] = 't' - # Freeing space for local variables - addi $sp, $sp, 88 + addi $t0, $zero, 121 + sb $t0, 15($v0) # internal_59[7] = 'y' - jr $ra + addi $t0, $zero, 112 + sb $t0, 16($v0) # internal_59[8] = 'p' - function_class_type_at_Main: - # Function parameters - # $ra = 212($sp) - # self = 208($sp) - # var = 204($sp) + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_59[9] = 'e' - # Reserving space for local variables - addi $sp, $sp, -204 + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_59[10] = ' ' + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_59[11] = 'i' + addi $t0, $zero, 115 + sb $t0, 20($v0) # internal_59[12] = 's' + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_59[13] = ' ' + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_59[14] = 'n' + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_59[15] = 'o' + addi $t0, $zero, 119 + sb $t0, 24($v0) # internal_59[16] = 'w' - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_59[17] = ' ' - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 180($sp) # internal_5 = address of allocated object Int + addi $t0, $zero, 66 + sb $t0, 26($v0) # internal_59[18] = 'B' - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_59[19] = '\n' - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 188($sp) # internal_3 = address of allocated object Int + sb $zero, 28($v0) # Null-terminator at the end of the string + sw $v0, 52($sp) # internal_59 = "Class type is now B\n" + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument self + lw $t0, 308($sp) + sw $t0, 4($sp) # Storing self - # internal_1 = typeof var that is the first word of the object - lw $t0, 204($sp) - lw $t1, 0($t0) - sw $t1, 196($sp) + # Argument internal_59 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_59 - lw $t0, 196($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 192($sp) - j end_assign - not_is_Bool_or_Int: - # internal_2 = internal_1 - lw $t0, 196($sp) - sw $t0, 192($sp) - end_assign: + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 60($sp) # internal_60 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 180($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 200($sp) - j end_assign - not_is_Bool_or_Int: - # internal_0 = internal_5 - lw $t0, 180($sp) - sw $t0, 200($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - while_start_8743762788970: + # Argument internal_54 + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing internal_54 - # Equal operation - lw $t0, 192($sp) # Save in $t0 the left operand address - # If internal_3 then goto while_end_8743762788970 - lw $t0, 188($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_end_8743762788970 + # Argument internal_60 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_60 - # Addition operation - lw $t0, 200($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # internal_2 = ancestor of internal_2 that is the first word of the object - lw $t0, 192($sp) - lw $t1, 4($t0) - sw $t1, 192($sp) + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_54 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_54 = internal_60 + lw $t0, 48($sp) + sw $t0, 72($sp) + + # Jumping to branch_end_8794497403564 + j branch_end_8794497403564 + + branch_C_8794497403564: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument c + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing c + + # Argument var + lw $t0, 304($sp) + sw $t0, 0($sp) # Storing var + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 56($sp) # c = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - # Jumping to while_start_8743762788970 - j while_start_8743762788970 + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - while_end_8743762788970: + addi $t0, $zero, 29 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_62[0] = 'C' + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_62[1] = 'l' + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_62[2] = 'a' - lw $t0, 196($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 192($sp) - j end_assign - not_is_Bool_or_Int: - # internal_2 = internal_1 - lw $t0, 196($sp) - sw $t0, 192($sp) - end_assign: + addi $t0, $zero, 115 + sb $t0, 11($v0) # internal_62[3] = 's' + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_62[4] = 's' - foreach_start_8743762788970: + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_62[5] = ' ' - # Less than operation - lw $t0, 172($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 200($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_62[6] = 't' - lw $t0, 168($sp) # $t0 = internal_8 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + addi $t0, $zero, 121 + sb $t0, 15($v0) # internal_62[7] = 'y' - # If internal_8 then goto foreach_body_8743762788970 - lw $t0, 168($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_body_8743762788970 + addi $t0, $zero, 112 + sb $t0, 16($v0) # internal_62[8] = 'p' - # Jumping to foreach_end_8743762788970 - j foreach_end_8743762788970 + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_62[9] = 'e' - foreach_body_8743762788970: + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_62[10] = ' ' + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_62[11] = 'i' - # internal_2 = ancestor of internal_2 that is the first word of the object - lw $t0, 192($sp) - lw $t1, 4($t0) - sw $t1, 192($sp) + addi $t0, $zero, 115 + sb $t0, 20($v0) # internal_62[12] = 's' - # Addition operation - lw $t0, 172($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_start_8743762788970 - j foreach_start_8743762788970 + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_62[13] = ' ' - foreach_end_8743762788970: + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_62[14] = 'n' + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_62[15] = 'o' + addi $t0, $zero, 119 + sb $t0, 24($v0) # internal_62[16] = 'w' + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_62[17] = ' ' + addi $t0, $zero, 67 + sb $t0, 26($v0) # internal_62[18] = 'C' + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_62[19] = '\n' - # internal_11 = direction of A - la $t0, type_A - sw $t0, 156($sp) + sb $zero, 28($v0) # Null-terminator at the end of the string + sw $v0, 40($sp) # internal_62 = "Class type is now C\n" + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # internal_12 = direction of B - la $t0, type_B - sw $t0, 152($sp) + # Argument self + lw $t0, 308($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_62 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_62 + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_63 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # internal_13 = direction of C - la $t0, type_C - sw $t0, 148($sp) + # Argument internal_54 + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing internal_54 + # Argument internal_63 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_63 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_54 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # internal_14 = direction of D - la $t0, type_D - sw $t0, 144($sp) + # internal_54 = internal_63 + lw $t0, 36($sp) + sw $t0, 72($sp) + # Jumping to branch_end_8794497403564 + j branch_end_8794497403564 + branch_D_8794497403564: - # internal_15 = direction of E - la $t0, type_E - sw $t0, 140($sp) + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument d + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing d + # Argument var + lw $t0, 304($sp) + sw $t0, 0($sp) # Storing var - # internal_16 = direction of Object - la $t0, type_Object - sw $t0, 136($sp) + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 44($sp) # d = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + addi $t0, $zero, 29 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_65[0] = 'C' + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_65[1] = 'l' - foreach_type_start_8743762788970: + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_65[2] = 'a' - # Less than operation - lw $t0, 132($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # If internal_18 then goto foreach_type_body_8743762788970 - lw $t0, 128($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_type_body_8743762788970 + addi $t0, $zero, 115 + sb $t0, 11($v0) # internal_65[3] = 's' - # Jumping to foreach_type_end_8743762788970 - j foreach_type_end_8743762788970 + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_65[4] = 's' - foreach_type_body_8743762788970: + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_65[5] = ' ' + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_65[6] = 't' + addi $t0, $zero, 121 + sb $t0, 15($v0) # internal_65[7] = 'y' + addi $t0, $zero, 112 + sb $t0, 16($v0) # internal_65[8] = 'p' + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_65[9] = 'e' - foreach_ancestor_start_8743762788970: + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_65[10] = ' ' - # Less than operation - lw $t0, 120($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 200($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_65[11] = 'i' - lw $t0, 116($sp) # $t0 = internal_21 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + addi $t0, $zero, 115 + sb $t0, 20($v0) # internal_65[12] = 's' - # If internal_21 then goto foreach_ancestor_body_8743762788970 - lw $t0, 116($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_body_8743762788970 + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_65[13] = ' ' - # Jumping to foreach_ancestor_end_8743762788970 - j foreach_ancestor_end_8743762788970 + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_65[14] = 'n' - foreach_ancestor_body_8743762788970: + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_65[15] = 'o' + addi $t0, $zero, 119 + sb $t0, 24($v0) # internal_65[16] = 'w' - # Equal operation - lw $t0, 124($sp) # Save in $t0 the left operand address - lw $t1, 112($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_65[17] = ' ' - lw $t0, 108($sp) # $t0 = internal_23 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + addi $t0, $zero, 68 + sb $t0, 26($v0) # internal_65[18] = 'D' - # If internal_23 then goto foreach_ancestor_end_8743762788970 - lw $t0, 108($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_end_8743762788970 + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_65[19] = '\n' - # Addition operation - lw $t0, 120($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_ancestor_start_8743762788970 - j foreach_ancestor_start_8743762788970 + sb $zero, 28($v0) # Null-terminator at the end of the string - foreach_ancestor_end_8743762788970: + sw $v0, 28($sp) # internal_65 = "Class type is now D\n" + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument self + lw $t0, 308($sp) + sw $t0, 4($sp) # Storing self + # Argument internal_65 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_65 + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_66 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments - # Addition operation - lw $t0, 132($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_type_start_8743762788970 - j foreach_type_start_8743762788970 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - foreach_type_end_8743762788970: + # Argument internal_54 + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing internal_54 + # Argument internal_66 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_66 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_54 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + # internal_54 = internal_66 + lw $t0, 24($sp) + sw $t0, 72($sp) + # Jumping to branch_end_8794497403564 + j branch_end_8794497403564 + branch_E_8794497403564: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - lw $t0, 200($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 92($sp) - j end_assign - not_is_Bool_or_Int: - # internal_27 = internal_0 - lw $t0, 200($sp) - sw $t0, 92($sp) - end_assign: + # Argument e + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing e - foreach_min_start_8743762788970: + # Argument var + lw $t0, 304($sp) + sw $t0, 0($sp) # Storing var - # Less than operation - lw $t0, 104($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # If internal_28 then goto foreach_min_body_8743762788970 - lw $t0, 88($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_min_body_8743762788970 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 32($sp) # e = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_min_end_8743762788970 - j foreach_min_end_8743762788970 + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - foreach_min_body_8743762788970: + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + addi $t0, $zero, 29 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - # Less than operation - lw $t0, 96($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 92($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_68[0] = 'C' - lw $t0, 88($sp) # $t0 = internal_28 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_68[1] = 'l' - # If internal_28 then goto update_min_8743762788970 - lw $t0, 88($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, update_min_8743762788970 + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_68[2] = 'a' - # Jumping to foreach_min_end_8743762788970 - j foreach_min_end_8743762788970 + addi $t0, $zero, 115 + sb $t0, 11($v0) # internal_68[3] = 's' - update_min_8743762788970: + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_68[4] = 's' - lw $t0, 96($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 92($sp) - j end_assign - not_is_Bool_or_Int: - # internal_27 = internal_26 - lw $t0, 96($sp) - sw $t0, 92($sp) - end_assign: + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_68[5] = ' ' - lw $t0, 104($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 100($sp) - j end_assign - not_is_Bool_or_Int: - # internal_25 = internal_24 - lw $t0, 104($sp) - sw $t0, 100($sp) - end_assign: + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_68[6] = 't' - update_min_end_8743762788970: + addi $t0, $zero, 121 + sb $t0, 15($v0) # internal_68[7] = 'y' - # Addition operation - lw $t0, 104($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_min_start_8743762788970 - j foreach_min_start_8743762788970 + addi $t0, $zero, 112 + sb $t0, 16($v0) # internal_68[8] = 'p' - foreach_min_end_8743762788970: + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_68[9] = 'e' + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_68[10] = ' ' + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_68[11] = 'i' + addi $t0, $zero, 115 + sb $t0, 20($v0) # internal_68[12] = 's' + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_68[13] = ' ' + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_68[14] = 'n' + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_68[15] = 'o' + addi $t0, $zero, 119 + sb $t0, 24($v0) # internal_68[16] = 'w' + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_68[17] = ' ' + addi $t0, $zero, 69 + sb $t0, 26($v0) # internal_68[18] = 'E' + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_68[19] = '\n' - # Equal operation - lw $t0, 100($sp) # Save in $t0 the left operand address - lw $t1, 200($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + sb $zero, 28($v0) # Null-terminator at the end of the string - lw $t0, 80($sp) # $t0 = internal_30 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + sw $v0, 16($sp) # internal_68 = "Class type is now E\n" - # If internal_30 then goto error_branch_8743762788970 - lw $t0, 80($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, error_branch_8743762788970 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument self + lw $t0, 308($sp) + sw $t0, 4($sp) # Storing self + # Argument internal_68 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_68 - # If internal_31 then goto branch_A_8743762788970 - lw $t0, 76($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_A_8743762788970 + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_69 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # If internal_31 then goto branch_B_8743762788970 - lw $t0, 76($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_B_8743762788970 + # Argument internal_54 + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing internal_54 + # Argument internal_69 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_69 - # If internal_31 then goto branch_C_8743762788970 - lw $t0, 76($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_C_8743762788970 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_54 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + # internal_54 = internal_69 + lw $t0, 12($sp) + sw $t0, 72($sp) - # If internal_31 then goto branch_D_8743762788970 - lw $t0, 76($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_D_8743762788970 + # Jumping to branch_end_8794497403564 + j branch_end_8794497403564 + branch_Object_8794497403564: - # If internal_31 then goto branch_E_8743762788970 - lw $t0, 76($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_E_8743762788970 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument o + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing o - # If internal_31 then goto branch_Object_8743762788970 - lw $t0, 76($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Object_8743762788970 + # Argument var + lw $t0, 304($sp) + sw $t0, 0($sp) # Storing var - branch_A_8743762788970: + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 20($sp) # o = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating String li $v0, 9 - addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 20 + addi $t0, $zero, 16 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 67 - sb $t0, 8($v0) # internal_34[0] = 'C' - - addi $t0, $zero, 108 - sb $t0, 9($v0) # internal_34[1] = 'l' - - addi $t0, $zero, 97 - sb $t0, 10($v0) # internal_34[2] = 'a' - - addi $t0, $zero, 115 - sb $t0, 11($v0) # internal_34[3] = 's' - - addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_34[4] = 's' + addi $t0, $zero, 79 + sb $t0, 8($v0) # internal_71[0] = 'O' - addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_34[5] = ' ' + addi $t0, $zero, 111 + sb $t0, 9($v0) # internal_71[1] = 'o' - addi $t0, $zero, 116 - sb $t0, 14($v0) # internal_34[6] = 't' + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_71[2] = 'o' - addi $t0, $zero, 121 - sb $t0, 15($v0) # internal_34[7] = 'y' + addi $t0, $zero, 111 + sb $t0, 11($v0) # internal_71[3] = 'o' addi $t0, $zero, 112 - sb $t0, 16($v0) # internal_34[8] = 'p' - - addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_34[9] = 'e' - - addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_34[10] = ' ' - - addi $t0, $zero, 105 - sb $t0, 19($v0) # internal_34[11] = 'i' + sb $t0, 12($v0) # internal_71[4] = 'p' addi $t0, $zero, 115 - sb $t0, 20($v0) # internal_34[12] = 's' - - addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_34[13] = ' ' - - addi $t0, $zero, 110 - sb $t0, 22($v0) # internal_34[14] = 'n' - - addi $t0, $zero, 111 - sb $t0, 23($v0) # internal_34[15] = 'o' - - addi $t0, $zero, 119 - sb $t0, 24($v0) # internal_34[16] = 'w' - - addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_34[17] = ' ' - - addi $t0, $zero, 65 - sb $t0, 26($v0) # internal_34[18] = 'A' + sb $t0, 13($v0) # internal_71[5] = 's' addi $t0, $zero, 10 - sb $t0, 27($v0) # internal_34[19] = '\n' + sb $t0, 14($v0) # internal_71[6] = '\n' - sb $zero, 28($v0) # Null-terminator at the end of the string + sb $zero, 15($v0) # Null-terminator at the end of the string - sw $v0, 64($sp) # internal_34 = "Class type is now A\n" + sw $v0, 4($sp) # internal_71 = "Oooops\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 220($sp) + lw $t0, 308($sp) sw $t0, 4($sp) # Storing self - # Argument internal_34 - lw $t0, 76($sp) - sw $t0, 0($sp) # Storing internal_34 + # Argument internal_71 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_71 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 72($sp) # internal_35 = result of function_out_string_at_IO + sw $v1, 12($sp) # internal_72 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 60($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 72($sp) - j end_assign - not_is_Bool_or_Int: - # internal_32 = internal_35 - lw $t0, 60($sp) - sw $t0, 72($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Jumping to branch_end_8743762788970 - j branch_end_8743762788970 + # Argument internal_54 + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing internal_54 - branch_B_8743762788970: + # Argument internal_72 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_72 - # Allocating String - li $v0, 9 - addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_54 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object + # internal_54 = internal_72 + lw $t0, 0($sp) + sw $t0, 72($sp) - addi $t0, $zero, 20 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + # Jumping to branch_end_8794497403564 + j branch_end_8794497403564 - addi $t0, $zero, 67 - sb $t0, 8($v0) # internal_37[0] = 'C' + error_branch_8794497403564: - addi $t0, $zero, 108 - sb $t0, 9($v0) # internal_37[1] = 'l' + branch_end_8794497403564: - addi $t0, $zero, 97 - sb $t0, 10($v0) # internal_37[2] = 'a' + # Loading return value in $v1 + lw $v1, 72($sp) - addi $t0, $zero, 115 - sb $t0, 11($v0) # internal_37[3] = 's' + # Freeing space for local variables + addi $sp, $sp, 292 - addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_37[4] = 's' + jr $ra - addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_37[5] = ' ' + function_print_at_Main: + # Function parameters + # $ra = 36($sp) + # self = 32($sp) + # var = 28($sp) - addi $t0, $zero, 116 - sb $t0, 14($v0) # internal_37[6] = 't' + # Reserving space for local variables + addi $sp, $sp, -28 - addi $t0, $zero, 121 - sb $t0, 15($v0) # internal_37[7] = 'y' + # Allocating A2I + li $v0, 9 + lw $a0, type_A2I + syscall + la $t0, type_A2I # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 20($sp) # internal_1 = address of allocated object A2I - addi $t0, $zero, 112 - sb $t0, 16($v0) # internal_37[8] = 'p' + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_37[9] = 'e' + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 - addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_37[10] = ' ' + # Calling function function___init___at_A2I + jal function___init___at_A2I + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_1 = result of function___init___at_A2I + addi $sp, $sp, 8 # Freeing space for arguments - addi $t0, $zero, 105 - sb $t0, 19($v0) # internal_37[11] = 'i' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 115 - sb $t0, 20($v0) # internal_37[12] = 's' + # Argument z + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing z - addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_37[13] = ' ' + # Argument internal_1 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_1 - addi $t0, $zero, 110 - sb $t0, 22($v0) # internal_37[14] = 'n' + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 36($sp) # z = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 111 - sb $t0, 23($v0) # internal_37[15] = 'o' + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - addi $t0, $zero, 119 - sb $t0, 24($v0) # internal_37[16] = 'w' + # Argument var + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing var - addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_37[17] = ' ' + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_2 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments - addi $t0, $zero, 66 - sb $t0, 26($v0) # internal_37[18] = 'B' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 10 - sb $t0, 27($v0) # internal_37[19] = '\n' + # Argument z + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing z - sb $zero, 28($v0) # Null-terminator at the end of the string + # Argument internal_2 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_2 - sw $v0, 52($sp) # internal_37 = "Class type is now B\n" + # Calling function function_i2a_at_A2I + jal function_i2a_at_A2I + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_3 = result of function_i2a_at_A2I + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 220($sp) + lw $t0, 44($sp) sw $t0, 4($sp) # Storing self - # Argument internal_37 - lw $t0, 64($sp) - sw $t0, 0($sp) # Storing internal_37 + # Argument internal_3 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_3 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 60($sp) # internal_38 = result of function_out_string_at_IO + sw $v1, 20($sp) # internal_4 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 48($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 72($sp) - j end_assign - not_is_Bool_or_Int: - # internal_32 = internal_38 - lw $t0, 48($sp) - sw $t0, 72($sp) - end_assign: - - # Jumping to branch_end_8743762788970 - j branch_end_8743762788970 - - branch_C_8743762788970: - # Allocating String li $v0, 9 - addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 20 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 67 - sb $t0, 8($v0) # internal_40[0] = 'C' - - addi $t0, $zero, 108 - sb $t0, 9($v0) # internal_40[1] = 'l' - - addi $t0, $zero, 97 - sb $t0, 10($v0) # internal_40[2] = 'a' - - addi $t0, $zero, 115 - sb $t0, 11($v0) # internal_40[3] = 's' - - addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_40[4] = 's' - addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_40[5] = ' ' - - addi $t0, $zero, 116 - sb $t0, 14($v0) # internal_40[6] = 't' - - addi $t0, $zero, 121 - sb $t0, 15($v0) # internal_40[7] = 'y' - - addi $t0, $zero, 112 - sb $t0, 16($v0) # internal_40[8] = 'p' - - addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_40[9] = 'e' + sb $t0, 8($v0) # internal_5[0] = ' ' - addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_40[10] = ' ' + sb $zero, 9($v0) # Null-terminator at the end of the string - addi $t0, $zero, 105 - sb $t0, 19($v0) # internal_40[11] = 'i' + sw $v0, 4($sp) # internal_5 = " " - addi $t0, $zero, 115 - sb $t0, 20($v0) # internal_40[12] = 's' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_40[13] = ' ' + # Argument self + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing self - addi $t0, $zero, 110 - sb $t0, 22($v0) # internal_40[14] = 'n' + # Argument internal_5 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_5 - addi $t0, $zero, 111 - sb $t0, 23($v0) # internal_40[15] = 'o' + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_6 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 119 - sb $t0, 24($v0) # internal_40[16] = 'w' + # Loading return value in $v1 + lw $v1, 0($sp) - addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_40[17] = ' ' + # Freeing space for local variables + addi $sp, $sp, 28 - addi $t0, $zero, 67 - sb $t0, 26($v0) # internal_40[18] = 'C' + jr $ra - addi $t0, $zero, 10 - sb $t0, 27($v0) # internal_40[19] = '\n' + function_main_at_Main: + # Function parameters + # $ra = 820($sp) + # self = 816($sp) - sb $zero, 28($v0) # Null-terminator at the end of the string + # Reserving space for local variables + addi $sp, $sp, -816 - sw $v0, 40($sp) # internal_40 = "Class type is now C\n" + # Allocating A + li $v0, 9 + lw $a0, type_A + syscall + la $t0, type_A # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 812($sp) # internal_0 = address of allocated object A # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - # Argument self - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing self + # Argument internal_0 + lw $t0, 820($sp) + sw $t0, 0($sp) # Storing internal_0 - # Argument internal_40 - lw $t0, 52($sp) - sw $t0, 0($sp) # Storing internal_40 + # Calling function function___init___at_A + jal function___init___at_A + lw $ra, 4($sp) + sw $v1, 820($sp) # internal_0 = result of function___init___at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 816($sp) # $t0 = self + lw $t1, 812($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8794497362086 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794497362086 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794497362086 + j object_set_attribute_8794497362086 + int_set_attribute_8794497362086: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_0 + j end_set_attribute_8794497362086 + bool_set_attribute_8794497362086: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_0 + j end_set_attribute_8794497362086 + object_set_attribute_8794497362086: + sw $t1, 12($t0) # self.avar = internal_0 + end_set_attribute_8794497362086: - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 48($sp) # internal_41 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments + while_start_8794497406615: - lw $t0, 36($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 72($sp) - j end_assign - not_is_Bool_or_Int: - # internal_32 = internal_41 - lw $t0, 36($sp) - sw $t0, 72($sp) - end_assign: + # Get attribute flag of self + lw $t0, 816($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'flag' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497362146 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497362146 + j object_get_attribute_8794497362146 + int_get_attribute_8794497362146: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 808($sp) # internal_1 = self.flag + j end_get_attribute_8794497362146 + bool_get_attribute_8794497362146: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 808($sp) # internal_1 = self.flag + j end_get_attribute_8794497362146 + object_get_attribute_8794497362146: + sw $t1, 808($sp) # internal_1 = flag + end_get_attribute_8794497362146: + + # If internal_1 then goto while_body_8794497406615 + lw $t0, 808($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8794497406615 - # Jumping to branch_end_8743762788970 - j branch_end_8743762788970 + # Jumping to while_end_8794497406615 + j while_end_8794497406615 - branch_D_8743762788970: + while_body_8794497406615: # Allocating String li $v0, 9 - addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 20 + addi $t0, $zero, 16 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 67 - sb $t0, 8($v0) # internal_43[0] = 'C' + addi $t0, $zero, 110 + sb $t0, 8($v0) # internal_2[0] = 'n' - addi $t0, $zero, 108 - sb $t0, 9($v0) # internal_43[1] = 'l' + addi $t0, $zero, 117 + sb $t0, 9($v0) # internal_2[1] = 'u' - addi $t0, $zero, 97 - sb $t0, 10($v0) # internal_43[2] = 'a' + addi $t0, $zero, 109 + sb $t0, 10($v0) # internal_2[2] = 'm' - addi $t0, $zero, 115 - sb $t0, 11($v0) # internal_43[3] = 's' + addi $t0, $zero, 98 + sb $t0, 11($v0) # internal_2[3] = 'b' - addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_43[4] = 's' + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_2[4] = 'e' + + addi $t0, $zero, 114 + sb $t0, 13($v0) # internal_2[5] = 'r' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_43[5] = ' ' + sb $t0, 14($v0) # internal_2[6] = ' ' - addi $t0, $zero, 116 - sb $t0, 14($v0) # internal_43[6] = 't' + sb $zero, 15($v0) # Null-terminator at the end of the string - addi $t0, $zero, 121 - sb $t0, 15($v0) # internal_43[7] = 'y' + sw $v0, 804($sp) # internal_2 = "number " - addi $t0, $zero, 112 - sb $t0, 16($v0) # internal_43[8] = 'p' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_43[9] = 'e' + # Argument self + lw $t0, 828($sp) + sw $t0, 4($sp) # Storing self - addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_43[10] = ' ' + # Argument internal_2 + lw $t0, 816($sp) + sw $t0, 0($sp) # Storing internal_2 - addi $t0, $zero, 105 - sb $t0, 19($v0) # internal_43[11] = 'i' + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 812($sp) # internal_3 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 115 - sb $t0, 20($v0) # internal_43[12] = 's' + # Get attribute avar of self + lw $t0, 816($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497362505 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497362505 + j object_get_attribute_8794497362505 + int_get_attribute_8794497362505: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 796($sp) # internal_4 = self.avar + j end_get_attribute_8794497362505 + bool_get_attribute_8794497362505: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 796($sp) # internal_4 = self.avar + j end_get_attribute_8794497362505 + object_get_attribute_8794497362505: + sw $t1, 796($sp) # internal_4 = avar + end_get_attribute_8794497362505: - addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_43[13] = ' ' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 110 - sb $t0, 22($v0) # internal_43[14] = 'n' + # Argument self + lw $t0, 828($sp) + sw $t0, 4($sp) # Storing self - addi $t0, $zero, 111 - sb $t0, 23($v0) # internal_43[15] = 'o' + # Argument internal_4 + lw $t0, 808($sp) + sw $t0, 0($sp) # Storing internal_4 - addi $t0, $zero, 119 - sb $t0, 24($v0) # internal_43[16] = 'w' + # Calling function function_print_at_Main + jal function_print_at_Main + lw $ra, 8($sp) + sw $v1, 804($sp) # internal_5 = result of function_print_at_Main + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_43[17] = ' ' + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 68 - sb $t0, 26($v0) # internal_43[18] = 'D' + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 784($sp) # internal_7 = address of allocated object Int - addi $t0, $zero, 10 - sb $t0, 27($v0) # internal_43[19] = '\n' + # Get attribute avar of self + lw $t0, 816($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497362589 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497362589 + j object_get_attribute_8794497362589 + int_get_attribute_8794497362589: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 780($sp) # internal_8 = self.avar + j end_get_attribute_8794497362589 + bool_get_attribute_8794497362589: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 780($sp) # internal_8 = self.avar + j end_get_attribute_8794497362589 + object_get_attribute_8794497362589: + sw $t1, 780($sp) # internal_8 = avar + end_get_attribute_8794497362589: - sb $zero, 28($v0) # Null-terminator at the end of the string + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_8 + lw $t0, 788($sp) + sw $t0, 0($sp) # Storing internal_8 - sw $v0, 28($sp) # internal_43 = "Class type is now D\n" + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 784($sp) # internal_9 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 220($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_43 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_43 + # Argument internal_9 + lw $t0, 788($sp) + sw $t0, 0($sp) # Storing internal_9 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function function_is_even_at_Main + jal function_is_even_at_Main lw $ra, 8($sp) - sw $v1, 36($sp) # internal_44 = result of function_out_string_at_IO + sw $v1, 784($sp) # internal_10 = result of function_is_even_at_Main addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 24($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 72($sp) - j end_assign - not_is_Bool_or_Int: - # internal_32 = internal_44 - lw $t0, 24($sp) - sw $t0, 72($sp) - end_assign: + # internal_7 = internal_10 + lw $t0, 772($sp) + sw $t0, 784($sp) + + # If internal_7 then goto then_8794497404453 + lw $t0, 784($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8794497404453 - # Jumping to branch_end_8743762788970 - j branch_end_8743762788970 + # Jumping to else_8794497404453 + j else_8794497404453 - branch_E_8743762788970: + then_8794497404453: # Allocating String li $v0, 9 - addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 18 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 20 + addi $t0, $zero, 18 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 67 - sb $t0, 8($v0) # internal_46[0] = 'C' - - addi $t0, $zero, 108 - sb $t0, 9($v0) # internal_46[1] = 'l' - - addi $t0, $zero, 97 - sb $t0, 10($v0) # internal_46[2] = 'a' - - addi $t0, $zero, 115 - sb $t0, 11($v0) # internal_46[3] = 's' + addi $t0, $zero, 105 + sb $t0, 8($v0) # internal_11[0] = 'i' addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_46[4] = 's' + sb $t0, 9($v0) # internal_11[1] = 's' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_46[5] = ' ' - - addi $t0, $zero, 116 - sb $t0, 14($v0) # internal_46[6] = 't' - - addi $t0, $zero, 121 - sb $t0, 15($v0) # internal_46[7] = 'y' - - addi $t0, $zero, 112 - sb $t0, 16($v0) # internal_46[8] = 'p' + sb $t0, 10($v0) # internal_11[2] = ' ' addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_46[9] = 'e' - - addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_46[10] = ' ' + sb $t0, 11($v0) # internal_11[3] = 'e' - addi $t0, $zero, 105 - sb $t0, 19($v0) # internal_46[11] = 'i' - - addi $t0, $zero, 115 - sb $t0, 20($v0) # internal_46[12] = 's' + addi $t0, $zero, 118 + sb $t0, 12($v0) # internal_11[4] = 'v' - addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_46[13] = ' ' + addi $t0, $zero, 101 + sb $t0, 13($v0) # internal_11[5] = 'e' addi $t0, $zero, 110 - sb $t0, 22($v0) # internal_46[14] = 'n' - - addi $t0, $zero, 111 - sb $t0, 23($v0) # internal_46[15] = 'o' + sb $t0, 14($v0) # internal_11[6] = 'n' - addi $t0, $zero, 119 - sb $t0, 24($v0) # internal_46[16] = 'w' - - addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_46[17] = ' ' - - addi $t0, $zero, 69 - sb $t0, 26($v0) # internal_46[18] = 'E' + addi $t0, $zero, 33 + sb $t0, 15($v0) # internal_11[7] = '!' addi $t0, $zero, 10 - sb $t0, 27($v0) # internal_46[19] = '\n' + sb $t0, 16($v0) # internal_11[8] = '\n' - sb $zero, 28($v0) # Null-terminator at the end of the string + sb $zero, 17($v0) # Null-terminator at the end of the string - sw $v0, 16($sp) # internal_46 = "Class type is now E\n" + sw $v0, 768($sp) # internal_11 = "is even!\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 220($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_46 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_46 + # Argument internal_11 + lw $t0, 780($sp) + sw $t0, 0($sp) # Storing internal_11 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 24($sp) # internal_47 = result of function_out_string_at_IO + sw $v1, 776($sp) # internal_12 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 72($sp) - j end_assign - not_is_Bool_or_Int: - # internal_32 = internal_47 - lw $t0, 12($sp) - sw $t0, 72($sp) - end_assign: + # internal_6 = internal_12 + lw $t0, 764($sp) + sw $t0, 788($sp) - # Jumping to branch_end_8743762788970 - j branch_end_8743762788970 + # Jumping to endif_8794497404453 + j endif_8794497404453 - branch_Object_8743762788970: + else_8794497404453: # Allocating String li $v0, 9 - addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 17 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 7 + addi $t0, $zero, 17 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 79 - sb $t0, 8($v0) # internal_49[0] = 'O' + addi $t0, $zero, 105 + sb $t0, 8($v0) # internal_13[0] = 'i' - addi $t0, $zero, 111 - sb $t0, 9($v0) # internal_49[1] = 'o' + addi $t0, $zero, 115 + sb $t0, 9($v0) # internal_13[1] = 's' - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_49[2] = 'o' + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_13[2] = ' ' addi $t0, $zero, 111 - sb $t0, 11($v0) # internal_49[3] = 'o' + sb $t0, 11($v0) # internal_13[3] = 'o' - addi $t0, $zero, 112 - sb $t0, 12($v0) # internal_49[4] = 'p' + addi $t0, $zero, 100 + sb $t0, 12($v0) # internal_13[4] = 'd' - addi $t0, $zero, 115 - sb $t0, 13($v0) # internal_49[5] = 's' + addi $t0, $zero, 100 + sb $t0, 13($v0) # internal_13[5] = 'd' + + addi $t0, $zero, 33 + sb $t0, 14($v0) # internal_13[6] = '!' addi $t0, $zero, 10 - sb $t0, 14($v0) # internal_49[6] = '\n' + sb $t0, 15($v0) # internal_13[7] = '\n' - sb $zero, 15($v0) # Null-terminator at the end of the string + sb $zero, 16($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_49 = "Oooops\n" + sw $v0, 760($sp) # internal_13 = "is odd!\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 220($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_49 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_49 + # Argument internal_13 + lw $t0, 772($sp) + sw $t0, 0($sp) # Storing internal_13 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 12($sp) # internal_50 = result of function_out_string_at_IO + sw $v1, 768($sp) # internal_14 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 72($sp) - j end_assign - not_is_Bool_or_Int: - # internal_32 = internal_50 - lw $t0, 0($sp) - sw $t0, 72($sp) - end_assign: - - # Jumping to branch_end_8743762788970 - j branch_end_8743762788970 - - error_branch_8743762788970: - - - branch_end_8743762788970: - - # Loading return value in $v1 - lw $v1, 72($sp) - - # Freeing space for local variables - addi $sp, $sp, 204 - - jr $ra + # internal_6 = internal_14 + lw $t0, 756($sp) + sw $t0, 788($sp) - function_print_at_Main: - # Function parameters - # $ra = 36($sp) - # self = 32($sp) - # var = 28($sp) + # Jumping to endif_8794497404453 + j endif_8794497404453 - # Reserving space for local variables - addi $sp, $sp, -28 + endif_8794497404453: - # Allocating A2I + # Get attribute avar of self + lw $t0, 816($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497362764 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497362764 + j object_get_attribute_8794497362764 + int_get_attribute_8794497362764: li $v0, 9 - lw $a0, type_A2I - syscall - la $t0, type_A2I # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 20($sp) # internal_1 = address of allocated object A2I - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_1 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function___init___at_A2I - jal function___init___at_A2I - lw $ra, 4($sp) - sw $v1, 28($sp) # internal_1 = result of function___init___at_A2I - addi $sp, $sp, 8 # Freeing space for arguments - - lw $t0, 20($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: - # z = internal_1 - lw $t0, 20($sp) - sw $t0, 24($sp) - end_assign: - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument var - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing var - - # Calling function function_value_at_A - jal function_value_at_A - lw $ra, 4($sp) - sw $v1, 24($sp) # internal_2 = result of function_value_at_A - addi $sp, $sp, 8 # Freeing space for arguments + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 752($sp) # internal_15 = self.avar + j end_get_attribute_8794497362764 + bool_get_attribute_8794497362764: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 752($sp) # internal_15 = self.avar + j end_get_attribute_8794497362764 + object_get_attribute_8794497362764: + sw $t1, 752($sp) # internal_15 = avar + end_get_attribute_8794497362764: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument z - lw $t0, 36($sp) - sw $t0, 4($sp) # Storing z + # Argument self + lw $t0, 828($sp) + sw $t0, 4($sp) # Storing self - # Argument internal_2 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_2 + # Argument internal_15 + lw $t0, 764($sp) + sw $t0, 0($sp) # Storing internal_15 - # Calling function function_i2a_at_A2I - jal function_i2a_at_A2I + # Calling function function_class_type_at_Main + jal function_class_type_at_Main lw $ra, 8($sp) - sw $v1, 24($sp) # internal_3 = result of function_i2a_at_A2I + sw $v1, 760($sp) # internal_16 = result of function_class_type_at_Main addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 44($sp) - sw $t0, 4($sp) # Storing self + lw $t0, 824($sp) + sw $t0, 0($sp) # Storing self - # Argument internal_3 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_3 + # Calling function function_menu_at_Main + jal function_menu_at_Main + lw $ra, 4($sp) + sw $v1, 752($sp) # internal_17 = result of function_menu_at_Main + addi $sp, $sp, 8 # Freeing space for arguments - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_4 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments + # Set attribute char of self + lw $t0, 816($sp) # $t0 = self + lw $t1, 744($sp) # $t1 = internal_17 + beq $t1, $zero, object_set_attribute_8794497362785 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794497362785 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794497362785 + j object_set_attribute_8794497362785 + int_set_attribute_8794497362785: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.char = internal_17 + j end_set_attribute_8794497362785 + bool_set_attribute_8794497362785: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.char = internal_17 + j end_set_attribute_8794497362785 + object_set_attribute_8794497362785: + sw $t1, 8($t0) # self.char = internal_17 + end_set_attribute_8794497362785: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 736($sp) # internal_19 = address of allocated object Int + + # Get attribute char of self + lw $t0, 816($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497362860 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497362860 + j object_get_attribute_8794497362860 + int_get_attribute_8794497362860: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 732($sp) # internal_20 = self.char + j end_get_attribute_8794497362860 + bool_get_attribute_8794497362860: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 732($sp) # internal_20 = self.char + j end_get_attribute_8794497362860 + object_get_attribute_8794497362860: + sw $t1, 732($sp) # internal_20 = char + end_get_attribute_8794497362860: # Allocating String li $v0, 9 @@ -11216,49 +12951,48 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_5[0] = ' ' + addi $t0, $zero, 97 + sb $t0, 8($v0) # internal_21[0] = 'a' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_5 = " " + sw $v0, 728($sp) # internal_21 = "a" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 44($sp) - sw $t0, 4($sp) # Storing self + # Argument internal_20 + lw $t0, 744($sp) + sw $t0, 4($sp) # Storing internal_20 - # Argument internal_5 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_5 + # Argument internal_21 + lw $t0, 740($sp) + sw $t0, 0($sp) # Storing internal_21 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function function_equal + jal function_equal lw $ra, 8($sp) - sw $v1, 12($sp) # internal_6 = result of function_out_string_at_IO + sw $v1, 736($sp) # internal_22 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 28 + # internal_19 = internal_22 + lw $t0, 724($sp) + sw $t0, 736($sp) - jr $ra + # If internal_19 then goto then_8794497406600 + lw $t0, 736($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8794497406600 - function_main_at_Main: - # Function parameters - # $ra = 772($sp) - # self = 768($sp) + # Jumping to else_8794497406600 + j else_8794497406600 - # Reserving space for local variables - addi $sp, $sp, -768 + then_8794497406600: # Allocating A li $v0, 9 @@ -11267,420 +13001,791 @@ la $t0, type_A # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 764($sp) # internal_0 = address of allocated object A + sw $v0, 720($sp) # internal_23 = address of allocated object A # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_0 - lw $t0, 772($sp) - sw $t0, 0($sp) # Storing internal_0 + # Argument internal_23 + lw $t0, 728($sp) + sw $t0, 0($sp) # Storing internal_23 # Calling function function___init___at_A jal function___init___at_A lw $ra, 4($sp) - sw $v1, 772($sp) # internal_0 = result of function___init___at_A + sw $v1, 728($sp) # internal_23 = result of function___init___at_A addi $sp, $sp, 8 # Freeing space for arguments - # Set attribute avar of self - lw $t0, 768($sp) # $t0 = self - lw $t1, 764($sp) # $t1 = internal_0 - sw $t1, 12($t0) # self.avar = internal_0 + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - while_start_8743762758997: + # Argument self + lw $t0, 824($sp) + sw $t0, 0($sp) # Storing self - # Get attribute flag of self - lw $t0, 768($sp) # Get the address of self - lw $t1, 20($t0) # Get the attribute 'flag' from the instance - sw $t1, 756($sp) # internal_2 = flag + # Calling function function_get_int_at_Main + jal function_get_int_at_Main + lw $ra, 4($sp) + sw $v1, 724($sp) # internal_24 = result of function_get_int_at_Main + addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 756($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 760($sp) - j end_assign - not_is_Bool_or_Int: - # internal_1 = internal_2 - lw $t0, 756($sp) - sw $t0, 760($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # If internal_1 then goto while_body_8743762758997 - lw $t0, 760($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8743762758997 + # Argument internal_23 + lw $t0, 732($sp) + sw $t0, 4($sp) # Storing internal_23 + + # Argument internal_24 + lw $t0, 728($sp) + sw $t0, 0($sp) # Storing internal_24 - # Jumping to while_end_8743762758997 - j while_end_8743762758997 + # Calling function function_set_var_at_A + jal function_set_var_at_A + lw $ra, 8($sp) + sw $v1, 724($sp) # internal_25 = result of function_set_var_at_A + addi $sp, $sp, 12 # Freeing space for arguments - while_body_8743762758997: + # Set attribute a_var of self + lw $t0, 816($sp) # $t0 = self + lw $t1, 712($sp) # $t1 = internal_25 + beq $t1, $zero, object_set_attribute_8794497362938 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794497362938 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794497362938 + j object_set_attribute_8794497362938 + int_set_attribute_8794497362938: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.a_var = internal_25 + j end_set_attribute_8794497362938 + bool_set_attribute_8794497362938: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.a_var = internal_25 + j end_set_attribute_8794497362938 + object_set_attribute_8794497362938: + sw $t1, 16($t0) # self.a_var = internal_25 + end_set_attribute_8794497362938: - # Allocating String + # Allocating B li $v0, 9 - addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + lw $a0, type_B syscall + la $t0, type_B # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 708($sp) # internal_26 = address of allocated object B - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - addi $t0, $zero, 7 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + # Argument internal_26 + lw $t0, 716($sp) + sw $t0, 0($sp) # Storing internal_26 - addi $t0, $zero, 110 - sb $t0, 8($v0) # internal_3[0] = 'n' + # Calling function function___init___at_B + jal function___init___at_B + lw $ra, 4($sp) + sw $v1, 716($sp) # internal_26 = result of function___init___at_B + addi $sp, $sp, 8 # Freeing space for arguments - addi $t0, $zero, 117 - sb $t0, 9($v0) # internal_3[1] = 'u' + # Get attribute avar of self + lw $t0, 816($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497363339 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497363339 + j object_get_attribute_8794497363339 + int_get_attribute_8794497363339: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 704($sp) # internal_27 = self.avar + j end_get_attribute_8794497363339 + bool_get_attribute_8794497363339: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 704($sp) # internal_27 = self.avar + j end_get_attribute_8794497363339 + object_get_attribute_8794497363339: + sw $t1, 704($sp) # internal_27 = avar + end_get_attribute_8794497363339: - addi $t0, $zero, 109 - sb $t0, 10($v0) # internal_3[2] = 'm' + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - addi $t0, $zero, 98 - sb $t0, 11($v0) # internal_3[3] = 'b' + # Argument internal_27 + lw $t0, 712($sp) + sw $t0, 0($sp) # Storing internal_27 - addi $t0, $zero, 101 - sb $t0, 12($v0) # internal_3[4] = 'e' + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 708($sp) # internal_28 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments - addi $t0, $zero, 114 - sb $t0, 13($v0) # internal_3[5] = 'r' + # Get attribute a_var of self + lw $t0, 816($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'a_var' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497363369 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497363369 + j object_get_attribute_8794497363369 + int_get_attribute_8794497363369: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 696($sp) # internal_29 = self.a_var + j end_get_attribute_8794497363369 + bool_get_attribute_8794497363369: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 696($sp) # internal_29 = self.a_var + j end_get_attribute_8794497363369 + object_get_attribute_8794497363369: + sw $t1, 696($sp) # internal_29 = a_var + end_get_attribute_8794497363369: - addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_3[6] = ' ' + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - sb $zero, 15($v0) # Null-terminator at the end of the string + # Argument internal_29 + lw $t0, 704($sp) + sw $t0, 0($sp) # Storing internal_29 - sw $v0, 752($sp) # internal_3 = "number " + # Calling function function_value_at_A + jal function_value_at_A + lw $ra, 4($sp) + sw $v1, 700($sp) # internal_30 = result of function_value_at_A + addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address - # Argument self - lw $t0, 780($sp) - sw $t0, 4($sp) # Storing self + # Argument internal_26 + lw $t0, 724($sp) + sw $t0, 8($sp) # Storing internal_26 - # Argument internal_3 - lw $t0, 764($sp) - sw $t0, 0($sp) # Storing internal_3 + # Argument internal_28 + lw $t0, 716($sp) + sw $t0, 4($sp) # Storing internal_28 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 760($sp) # internal_4 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments + # Argument internal_30 + lw $t0, 708($sp) + sw $t0, 0($sp) # Storing internal_30 - # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 744($sp) # internal_5 = avar + # Calling function function_method2_at_A + jal function_method2_at_A + lw $ra, 12($sp) + sw $v1, 704($sp) # internal_31 = result of function_method2_at_A + addi $sp, $sp, 16 # Freeing space for arguments - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + # Set attribute avar of self + lw $t0, 816($sp) # $t0 = self + lw $t1, 688($sp) # $t1 = internal_31 + beq $t1, $zero, object_set_attribute_8794497363276 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794497363276 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794497363276 + j object_set_attribute_8794497363276 + int_set_attribute_8794497363276: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_31 + j end_set_attribute_8794497363276 + bool_set_attribute_8794497363276: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_31 + j end_set_attribute_8794497363276 + object_set_attribute_8794497363276: + sw $t1, 12($t0) # self.avar = internal_31 + end_set_attribute_8794497363276: + + # internal_18 = internal_31 + lw $t0, 688($sp) + sw $t0, 740($sp) - # Argument self - lw $t0, 780($sp) - sw $t0, 4($sp) # Storing self + # Jumping to endif_8794497406600 + j endif_8794497406600 - # Argument internal_5 - lw $t0, 756($sp) - sw $t0, 0($sp) # Storing internal_5 + else_8794497406600: - # Calling function function_print_at_Main - jal function_print_at_Main - lw $ra, 8($sp) - sw $v1, 752($sp) # internal_6 = result of function_print_at_Main - addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 680($sp) # internal_33 = address of allocated object Int - # Allocating Bool 0 + # Get attribute char of self + lw $t0, 816($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497363453 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497363453 + j object_get_attribute_8794497363453 + int_get_attribute_8794497363453: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 676($sp) # internal_34 = self.char + j end_get_attribute_8794497363453 + bool_get_attribute_8794497363453: li $v0, 9 addi $a0, $zero, 12 syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 676($sp) # internal_34 = self.char + j end_get_attribute_8794497363453 + object_get_attribute_8794497363453: + sw $t1, 676($sp) # internal_34 = char + end_get_attribute_8794497363453: - la $t0, type_Bool # $t0 = address of the type + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 732($sp) # internal_8 = address of allocated object Int - # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 728($sp) # internal_9 = avar + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + addi $t0, $zero, 98 + sb $t0, 8($v0) # internal_35[0] = 'b' - # Argument internal_9 - lw $t0, 736($sp) - sw $t0, 0($sp) # Storing internal_9 + sb $zero, 9($v0) # Null-terminator at the end of the string - # Calling function function_value_at_A - jal function_value_at_A - lw $ra, 4($sp) - sw $v1, 732($sp) # internal_10 = result of function_value_at_A - addi $sp, $sp, 8 # Freeing space for arguments + sw $v0, 672($sp) # internal_35 = "b" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 780($sp) - sw $t0, 4($sp) # Storing self + # Argument internal_34 + lw $t0, 688($sp) + sw $t0, 4($sp) # Storing internal_34 - # Argument internal_10 - lw $t0, 736($sp) - sw $t0, 0($sp) # Storing internal_10 + # Argument internal_35 + lw $t0, 684($sp) + sw $t0, 0($sp) # Storing internal_35 - # Calling function function_is_even_at_Main - jal function_is_even_at_Main + # Calling function function_equal + jal function_equal lw $ra, 8($sp) - sw $v1, 732($sp) # internal_11 = result of function_is_even_at_Main - addi $sp, $sp, 12 # Freeing space for arguments - - lw $t0, 720($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 732($sp) - j end_assign - not_is_Bool_or_Int: - # internal_8 = internal_11 - lw $t0, 720($sp) - sw $t0, 732($sp) - end_assign: - - # If internal_8 then goto then_8743762789087 - lw $t0, 732($sp) # Loading the address of the condition + sw $v1, 680($sp) # internal_36 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_33 = internal_36 + lw $t0, 668($sp) + sw $t0, 680($sp) + + # If internal_33 then goto then_8794497406594 + lw $t0, 680($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762789087 + beq $t0, $t1, then_8794497406594 - # Jumping to else_8743762789087 - j else_8743762789087 + # Jumping to else_8794497406594 + j else_8794497406594 - then_8743762789087: + then_8794497406594: - # Allocating String + # Get attribute avar of self + lw $t0, 816($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497364050 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497364050 + j object_get_attribute_8794497364050 + int_get_attribute_8794497364050: li $v0, 9 - addi $a0, $zero, 18 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 664($sp) # internal_37 = self.avar + j end_get_attribute_8794497364050 + bool_get_attribute_8794497364050: + li $v0, 9 + addi $a0, $zero, 12 syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 664($sp) # internal_37 = self.avar + j end_get_attribute_8794497364050 + object_get_attribute_8794497364050: + sw $t1, 664($sp) # internal_37 = avar + end_get_attribute_8794497364050: - la $t0, type_String + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 660($sp) # internal_38 = address of allocated object Int - addi $t0, $zero, 9 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 105 - sb $t0, 8($v0) # internal_12[0] = 'i' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 656($sp) # internal_39 = address of allocated object Int - addi $t0, $zero, 115 - sb $t0, 9($v0) # internal_12[1] = 's' + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_12[2] = ' ' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 652($sp) # internal_40 = address of allocated object Int - addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_12[3] = 'e' + # Allocating NUll to internal_41 + sw $zero, 648($sp) # internal_41 = 0 - addi $t0, $zero, 118 - sb $t0, 12($v0) # internal_12[4] = 'v' + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 101 - sb $t0, 13($v0) # internal_12[5] = 'e' + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 644($sp) # internal_42 = address of allocated object Int - addi $t0, $zero, 110 - sb $t0, 14($v0) # internal_12[6] = 'n' + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 33 - sb $t0, 15($v0) # internal_12[7] = '!' + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 632($sp) # internal_45 = address of allocated object Int - addi $t0, $zero, 10 - sb $t0, 16($v0) # internal_12[8] = '\n' + # internal_43 = typeof internal_37 that is the first word of the object + lw $t0, 664($sp) + lw $t0, 0($t0) + sw $t0, 640($sp) - sb $zero, 17($v0) # Null-terminator at the end of the string + # internal_44 = internal_43 + lw $t0, 640($sp) + sw $t0, 636($sp) - sw $v0, 716($sp) # internal_12 = "is even!\n" + while_start_8794497404654: + + # internal_45 = EqualAddress(internal_44, internal_41) + lw $t0, 636($sp) + lw $t1, 648($sp) + seq $t2, $t0, $t1 + lw $t0, 632($sp) + sw $t2, 8($t0) + + # If internal_45 then goto while_end_8794497404654 + lw $t0, 632($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8794497404654 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 780($sp) - sw $t0, 4($sp) # Storing self + # Argument internal_42 + lw $t0, 656($sp) + sw $t0, 4($sp) # Storing internal_42 - # Argument internal_12 - lw $t0, 728($sp) - sw $t0, 0($sp) # Storing internal_12 + # Argument internal_39 + lw $t0, 668($sp) + sw $t0, 0($sp) # Storing internal_39 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function function_add + jal function_add lw $ra, 8($sp) - sw $v1, 724($sp) # internal_13 = result of function_out_string_at_IO + sw $v1, 656($sp) # internal_42 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 712($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 736($sp) - j end_assign - not_is_Bool_or_Int: - # internal_7 = internal_13 - lw $t0, 712($sp) - sw $t0, 736($sp) - end_assign: + # internal_44 = ancestor of internal_44 + lw $t0, 636($sp) + lw $t0, 4($t0) + sw $t0, 636($sp) - # Jumping to endif_8743762789087 - j endif_8743762789087 + # Jumping to while_start_8794497404654 + j while_start_8794497404654 - else_8743762789087: + while_end_8794497404654: - # Allocating String + # internal_44 = internal_43 + lw $t0, 640($sp) + sw $t0, 636($sp) + + # initialize Array [internal_42] + lw $t0, 644($sp) # $t0 = internal_42 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 li $v0, 9 - addi $a0, $zero, 17 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + move $a0, $t0 syscall + sw $v0, 628($sp) # internal_46 = new Array[internal_42] - la $t0, type_String + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 624($sp) # internal_47 = address of allocated object Int - addi $t0, $zero, 8 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 105 - sb $t0, 8($v0) # internal_14[0] = 'i' + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 620($sp) # internal_48 = address of allocated object Int - addi $t0, $zero, 115 - sb $t0, 9($v0) # internal_14[1] = 's' + foreach_start_8794497404654: - addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_14[2] = ' ' + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - addi $t0, $zero, 111 - sb $t0, 11($v0) # internal_14[3] = 'o' + # Argument internal_47 + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing internal_47 - addi $t0, $zero, 100 - sb $t0, 12($v0) # internal_14[4] = 'd' + # Argument internal_42 + lw $t0, 656($sp) + sw $t0, 0($sp) # Storing internal_42 - addi $t0, $zero, 100 - sb $t0, 13($v0) # internal_14[5] = 'd' + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 632($sp) # internal_48 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - addi $t0, $zero, 33 - sb $t0, 14($v0) # internal_14[6] = '!' + # If internal_48 then goto foreach_body_8794497404654 + lw $t0, 620($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8794497404654 - addi $t0, $zero, 10 - sb $t0, 15($v0) # internal_14[7] = '\n' + # Jumping to foreach_end_8794497404654 + j foreach_end_8794497404654 - sb $zero, 16($v0) # Null-terminator at the end of the string + foreach_body_8794497404654: - sw $v0, 708($sp) # internal_14 = "is odd!\n" + # array internal_46[4 * internal_47] = internal_44 + lw $t0, 624($sp) # $t0 = internal_47 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 628($sp) # $t1 = internal_46 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 636($sp) + sw $t0, 0($t1) + + # internal_44 = ancestor of internal_44 + lw $t0, 636($sp) + lw $t0, 4($t0) + sw $t0, 636($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 780($sp) - sw $t0, 4($sp) # Storing self + # Argument internal_47 + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing internal_47 - # Argument internal_14 - lw $t0, 720($sp) - sw $t0, 0($sp) # Storing internal_14 + # Argument internal_39 + lw $t0, 668($sp) + sw $t0, 0($sp) # Storing internal_39 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function function_add + jal function_add lw $ra, 8($sp) - sw $v1, 716($sp) # internal_15 = result of function_out_string_at_IO + sw $v1, 636($sp) # internal_47 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 704($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 736($sp) - j end_assign - not_is_Bool_or_Int: - # internal_7 = internal_15 - lw $t0, 704($sp) - sw $t0, 736($sp) - end_assign: + # Jumping to foreach_start_8794497404654 + j foreach_start_8794497404654 - # Jumping to endif_8743762789087 - j endif_8743762789087 + foreach_end_8794497404654: - endif_8743762789087: + # initialize Array [internal_40] + lw $t0, 652($sp) # $t0 = internal_40 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 616($sp) # internal_49 = new Array[internal_40] + + # initialize Array [internal_40] + lw $t0, 652($sp) # $t0 = internal_40 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 612($sp) # internal_50 = new Array[internal_40] - # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 700($sp) # internal_16 = avar + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 604($sp) # internal_52 = address of allocated object Int - # Argument self - lw $t0, 780($sp) - sw $t0, 4($sp) # Storing self + # internal_51 = direction of C + la $t0, type_C + sw $t0, 608($sp) - # Argument internal_16 - lw $t0, 712($sp) - sw $t0, 0($sp) # Storing internal_16 + # array internal_49[4 * internal_52] = internal_51 + lw $t0, 604($sp) # $t0 = internal_52 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 616($sp) # $t1 = internal_49 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 608($sp) + sw $t0, 0($t1) + + # array internal_50[4 * internal_52] = internal_42 + lw $t0, 604($sp) # $t0 = internal_52 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 612($sp) # $t1 = internal_50 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 644($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # Calling function function_class_type_at_Main - jal function_class_type_at_Main - lw $ra, 8($sp) - sw $v1, 708($sp) # internal_17 = result of function_class_type_at_Main - addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 596($sp) # internal_54 = address of allocated object Int + + # internal_53 = direction of A + la $t0, type_A + sw $t0, 600($sp) + + # array internal_49[4 * internal_54] = internal_53 + lw $t0, 596($sp) # $t0 = internal_54 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 616($sp) # $t1 = internal_49 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 600($sp) + sw $t0, 0($t1) + + # array internal_50[4 * internal_54] = internal_42 + lw $t0, 596($sp) # $t0 = internal_54 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 612($sp) # $t1 = internal_50 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 644($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Argument self - lw $t0, 776($sp) - sw $t0, 0($sp) # Storing self + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 588($sp) # internal_56 = address of allocated object Int - # Calling function function_menu_at_Main - jal function_menu_at_Main - lw $ra, 4($sp) - sw $v1, 700($sp) # internal_18 = result of function_menu_at_Main - addi $sp, $sp, 8 # Freeing space for arguments + # internal_55 = direction of Object + la $t0, type_Object + sw $t0, 592($sp) + + # array internal_49[4 * internal_56] = internal_55 + lw $t0, 588($sp) # $t0 = internal_56 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 616($sp) # $t1 = internal_49 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 592($sp) + sw $t0, 0($t1) + + # array internal_50[4 * internal_56] = internal_42 + lw $t0, 588($sp) # $t0 = internal_56 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 612($sp) # $t1 = internal_50 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 644($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # Set attribute char of self - lw $t0, 768($sp) # $t0 = self - lw $t1, 692($sp) # $t1 = internal_18 - sw $t1, 8($t0) # self.char = internal_18 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 584($sp) # internal_57 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -11692,264 +13797,216 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 684($sp) # internal_20 = address of allocated object Int - - # Get attribute char of self - lw $t0, 768($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'char' from the instance - sw $t1, 680($sp) # internal_21 = char + sw $v0, 580($sp) # internal_58 = address of allocated object Int - # Allocating String + # Allocating Int 0 li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + addi $a0, $zero, 12 syscall - la $t0, type_String + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 572($sp) # internal_60 = address of allocated object Int - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - addi $t0, $zero, 97 - sb $t0, 8($v0) # internal_22[0] = 'a' + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 568($sp) # internal_61 = address of allocated object Int - sb $zero, 9($v0) # Null-terminator at the end of the string + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 560($sp) # internal_63 = address of allocated object Int - sw $v0, 676($sp) # internal_22 = "a" + foreach_type_start_8794497404654: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_21 - lw $t0, 692($sp) - sw $t0, 4($sp) # Storing internal_21 + # Argument internal_57 + lw $t0, 596($sp) + sw $t0, 4($sp) # Storing internal_57 - # Argument internal_22 - lw $t0, 688($sp) - sw $t0, 0($sp) # Storing internal_22 + # Argument internal_40 + lw $t0, 664($sp) + sw $t0, 0($sp) # Storing internal_40 - # Calling function function_equal - jal function_equal + # Calling function function_less_than + jal function_less_than lw $ra, 8($sp) - sw $v1, 684($sp) # internal_23 = result of function_equal + sw $v1, 592($sp) # internal_58 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 672($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 684($sp) - j end_assign - not_is_Bool_or_Int: - # internal_20 = internal_23 - lw $t0, 672($sp) - sw $t0, 684($sp) - end_assign: - - # If internal_20 then goto then_8743762758982 - lw $t0, 684($sp) # Loading the address of the condition + # If internal_58 then goto foreach_type_body_8794497404654 + lw $t0, 580($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762758982 + beq $t0, $t1, foreach_type_body_8794497404654 - # Jumping to else_8743762758982 - j else_8743762758982 + # Jumping to foreach_type_end_8794497404654 + j foreach_type_end_8794497404654 - then_8743762758982: + foreach_type_body_8794497404654: - # Allocating A - li $v0, 9 - lw $a0, type_A - syscall - la $t0, type_A # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 668($sp) # internal_24 = address of allocated object A + # internal_59 = array internal_49[4 * internal_57] + lw $t0, 584($sp) # $t0 = internal_57 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 616($sp) # $t1 = internal_49 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 576($sp) # internal_59 = array internal_49[4 * internal_57] # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_24 - lw $t0, 676($sp) - sw $t0, 0($sp) # Storing internal_24 + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Calling function function___init___at_A - jal function___init___at_A - lw $ra, 4($sp) - sw $v1, 676($sp) # internal_24 = result of function___init___at_A - addi $sp, $sp, 8 # Freeing space for arguments + # Argument internal_60 + lw $t0, 584($sp) + sw $t0, 4($sp) # Storing internal_60 - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + # Argument internal_38 + lw $t0, 672($sp) + sw $t0, 0($sp) # Storing internal_38 - # Argument self - lw $t0, 776($sp) - sw $t0, 0($sp) # Storing self + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 584($sp) # internal_60 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # Calling function function_get_int_at_Main - jal function_get_int_at_Main - lw $ra, 4($sp) - sw $v1, 672($sp) # internal_25 = result of function_get_int_at_Main - addi $sp, $sp, 8 # Freeing space for arguments + foreach_ancestor_start_8794497404654: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_24 - lw $t0, 680($sp) - sw $t0, 4($sp) # Storing internal_24 + # Argument internal_60 + lw $t0, 584($sp) + sw $t0, 4($sp) # Storing internal_60 - # Argument internal_25 - lw $t0, 676($sp) - sw $t0, 0($sp) # Storing internal_25 + # Argument internal_42 + lw $t0, 656($sp) + sw $t0, 0($sp) # Storing internal_42 - # Calling function function_set_var_at_A - jal function_set_var_at_A + # Calling function function_less_than + jal function_less_than lw $ra, 8($sp) - sw $v1, 672($sp) # internal_26 = result of function_set_var_at_A + sw $v1, 580($sp) # internal_61 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # Set attribute a_var of self - lw $t0, 768($sp) # $t0 = self - lw $t1, 660($sp) # $t1 = internal_26 - sw $t1, 16($t0) # self.a_var = internal_26 - - # Allocating B - li $v0, 9 - lw $a0, type_B - syscall - la $t0, type_B # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 656($sp) # internal_27 = address of allocated object B - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_27 - lw $t0, 664($sp) - sw $t0, 0($sp) # Storing internal_27 - - # Calling function function___init___at_B - jal function___init___at_B - lw $ra, 4($sp) - sw $v1, 664($sp) # internal_27 = result of function___init___at_B - addi $sp, $sp, 8 # Freeing space for arguments + # If internal_61 then goto foreach_ancestor_body_8794497404654 + lw $t0, 568($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8794497404654 + + # Jumping to foreach_ancestor_end_8794497404654 + j foreach_ancestor_end_8794497404654 + + foreach_ancestor_body_8794497404654: + + # internal_62 = array internal_46[4 * internal_60] + lw $t0, 572($sp) # $t0 = internal_60 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 628($sp) # $t1 = internal_46 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 564($sp) # internal_62 = array internal_46[4 * internal_60] + + # internal_63 = EqualAddress(internal_59, internal_62) + lw $t0, 576($sp) + lw $t1, 564($sp) + seq $t2, $t0, $t1 + lw $t0, 560($sp) + sw $t2, 8($t0) - # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 652($sp) # internal_28 = avar + # If internal_63 then goto foreach_ancestor_end_8794497404654 + lw $t0, 560($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8794497404654 # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Argument internal_28 - lw $t0, 660($sp) - sw $t0, 0($sp) # Storing internal_28 + # Argument internal_60 + lw $t0, 584($sp) + sw $t0, 4($sp) # Storing internal_60 - # Calling function function_value_at_A - jal function_value_at_A - lw $ra, 4($sp) - sw $v1, 656($sp) # internal_29 = result of function_value_at_A - addi $sp, $sp, 8 # Freeing space for arguments + # Argument internal_39 + lw $t0, 668($sp) + sw $t0, 0($sp) # Storing internal_39 - # Get attribute a_var of self - lw $t0, 768($sp) # Get the address of self - lw $t1, 16($t0) # Get the attribute 'a_var' from the instance - sw $t1, 644($sp) # internal_30 = a_var + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 584($sp) # internal_60 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + # Jumping to foreach_ancestor_start_8794497404654 + j foreach_ancestor_start_8794497404654 - # Argument internal_30 - lw $t0, 652($sp) - sw $t0, 0($sp) # Storing internal_30 + foreach_ancestor_end_8794497404654: - # Calling function function_value_at_A - jal function_value_at_A - lw $ra, 4($sp) - sw $v1, 648($sp) # internal_31 = result of function_value_at_A - addi $sp, $sp, 8 # Freeing space for arguments + # array internal_50[4 * internal_57] = internal_60 + lw $t0, 584($sp) # $t0 = internal_57 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 612($sp) # $t1 = internal_50 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 572($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address - - # Argument internal_27 - lw $t0, 672($sp) - sw $t0, 8($sp) # Storing internal_27 - - # Argument internal_29 - lw $t0, 664($sp) - sw $t0, 4($sp) # Storing internal_29 - - # Argument internal_31 - lw $t0, 656($sp) - sw $t0, 0($sp) # Storing internal_31 - - # Calling function function_method2_at_A - jal function_method2_at_A - lw $ra, 12($sp) - sw $v1, 652($sp) # internal_32 = result of function_method2_at_A - addi $sp, $sp, 16 # Freeing space for arguments - - # Set attribute avar of self - lw $t0, 768($sp) # $t0 = self - lw $t1, 636($sp) # $t1 = internal_32 - sw $t1, 12($t0) # self.avar = internal_32 - - lw $t0, 636($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 688($sp) - j end_assign - not_is_Bool_or_Int: - # internal_19 = internal_32 - lw $t0, 636($sp) - sw $t0, 688($sp) - end_assign: - - # Jumping to endif_8743762758982 - j endif_8743762758982 + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - else_8743762758982: + # Argument internal_57 + lw $t0, 596($sp) + sw $t0, 4($sp) # Storing internal_57 + # Argument internal_39 + lw $t0, 668($sp) + sw $t0, 0($sp) # Storing internal_39 - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 596($sp) # internal_57 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 628($sp) # internal_34 = address of allocated object Int + # Jumping to foreach_type_start_8794497404654 + j foreach_type_start_8794497404654 - # Get attribute char of self - lw $t0, 768($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'char' from the instance - sw $t1, 624($sp) # internal_35 = char + foreach_type_end_8794497404654: # Allocating String li $v0, 9 @@ -11959,72 +14016,69 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object - addi $t0, $zero, 98 - sb $t0, 8($v0) # internal_36[0] = 'b' + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_69[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 620($sp) # internal_36 = "b" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + sw $v0, 536($sp) # internal_69 = "\n" - # Argument internal_35 - lw $t0, 636($sp) - sw $t0, 4($sp) # Storing internal_35 + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - # Argument internal_36 - lw $t0, 632($sp) - sw $t0, 0($sp) # Storing internal_36 + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 628($sp) # internal_37 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - lw $t0, 616($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 628($sp) - j end_assign - not_is_Bool_or_Int: - # internal_34 = internal_37 - lw $t0, 616($sp) - sw $t0, 628($sp) - end_assign: - - # If internal_34 then goto then_8743762758976 - lw $t0, 628($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762758976 + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - # Jumping to else_8743762758976 - j else_8743762758976 + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_70[0] = ' ' - then_8743762758976: + sb $zero, 9($v0) # Null-terminator at the end of the string - # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 612($sp) # internal_38 = avar + sw $v0, 532($sp) # internal_70 = " " + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 556($sp) # internal_64 = address of allocated object Int + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 552($sp) # internal_65 = address of allocated object Int + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 548($sp) # internal_66 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -12036,7 +14090,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 588($sp) # internal_44 = address of allocated object Int + sw $v0, 544($sp) # internal_67 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -12048,384 +14102,411 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 596($sp) # internal_42 = address of allocated object Int - - - - - # internal_40 = typeof internal_38 that is the first word of the object - lw $t0, 612($sp) - lw $t1, 0($t0) - sw $t1, 604($sp) - - lw $t0, 604($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 600($sp) - j end_assign - not_is_Bool_or_Int: - # internal_41 = internal_40 - lw $t0, 604($sp) - sw $t0, 600($sp) - end_assign: - - lw $t0, 588($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 608($sp) - j end_assign - not_is_Bool_or_Int: - # internal_39 = internal_44 - lw $t0, 588($sp) - sw $t0, 608($sp) - end_assign: - - while_start_8743762757292: - - # Equal operation - lw $t0, 600($sp) # Save in $t0 the left operand address - # If internal_42 then goto while_end_8743762757292 - lw $t0, 596($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_end_8743762757292 - - # Addition operation - lw $t0, 608($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # internal_41 = ancestor of internal_41 that is the first word of the object - lw $t0, 600($sp) - lw $t1, 4($t0) - sw $t1, 600($sp) + sw $v0, 540($sp) # internal_68 = address of allocated object Int - # Jumping to while_start_8743762757292 - j while_start_8743762757292 - - while_end_8743762757292: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_67 + lw $t0, 556($sp) + sw $t0, 4($sp) # Storing internal_67 + # Argument internal_42 + lw $t0, 656($sp) + sw $t0, 0($sp) # Storing internal_42 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 556($sp) # internal_67 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 604($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 600($sp) - j end_assign - not_is_Bool_or_Int: - # internal_41 = internal_40 - lw $t0, 604($sp) - sw $t0, 600($sp) - end_assign: + foreach_min_start_8794497404654: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - foreach_start_8743762757292: + # Argument internal_64 + lw $t0, 568($sp) + sw $t0, 4($sp) # Storing internal_64 - # Less than operation - lw $t0, 580($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 608($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + # Argument internal_40 + lw $t0, 664($sp) + sw $t0, 0($sp) # Storing internal_40 - lw $t0, 576($sp) # $t0 = internal_47 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 552($sp) # internal_68 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - # If internal_47 then goto foreach_body_8743762757292 - lw $t0, 576($sp) # Loading the address of the condition + # If internal_68 then goto foreach_min_body_8794497404654 + lw $t0, 540($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_body_8743762757292 - - # Jumping to foreach_end_8743762757292 - j foreach_end_8743762757292 + beq $t0, $t1, foreach_min_body_8794497404654 - foreach_body_8743762757292: - - - # internal_41 = ancestor of internal_41 that is the first word of the object - lw $t0, 600($sp) - lw $t1, 4($t0) - sw $t1, 600($sp) - - # Addition operation - lw $t0, 580($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_start_8743762757292 - j foreach_start_8743762757292 - - foreach_end_8743762757292: - - - - - - - # internal_50 = direction of C - la $t0, type_C - sw $t0, 564($sp) - - - - # internal_51 = direction of A - la $t0, type_A - sw $t0, 560($sp) - - - - # internal_52 = direction of Object - la $t0, type_Object - sw $t0, 556($sp) + # Jumping to foreach_min_end_8794497404654 + j foreach_min_end_8794497404654 + foreach_min_body_8794497404654: + # internal_66 = array internal_50[4 * internal_64] + lw $t0, 556($sp) # $t0 = internal_64 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 612($sp) # $t1 = internal_50 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 548($sp) # internal_66 = array internal_50[4 * internal_64] + sw $t0, 8($t2) + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_66 + lw $t0, 560($sp) + sw $t0, 4($sp) # Storing internal_66 + # Argument internal_67 + lw $t0, 556($sp) + sw $t0, 0($sp) # Storing internal_67 - foreach_type_start_8743762757292: + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 552($sp) # internal_68 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - # Less than operation - lw $t0, 552($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # If internal_54 then goto foreach_type_body_8743762757292 - lw $t0, 548($sp) # Loading the address of the condition + # If internal_68 then goto update_min_8794497404654 + lw $t0, 540($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_type_body_8743762757292 - - # Jumping to foreach_type_end_8743762757292 - j foreach_type_end_8743762757292 - - foreach_type_body_8743762757292: + beq $t0, $t1, update_min_8794497404654 + # Jumping to update_min_end_8794497404654 + j update_min_end_8794497404654 + update_min_8794497404654: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_67 + lw $t0, 556($sp) + sw $t0, 4($sp) # Storing internal_67 - foreach_ancestor_start_8743762757292: + # Argument internal_66 + lw $t0, 560($sp) + sw $t0, 0($sp) # Storing internal_66 - # Less than operation - lw $t0, 540($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 608($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 556($sp) # internal_67 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 536($sp) # $t0 = internal_57 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # If internal_57 then goto foreach_ancestor_body_8743762757292 - lw $t0, 536($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_body_8743762757292 + # Argument internal_65 + lw $t0, 564($sp) + sw $t0, 4($sp) # Storing internal_65 - # Jumping to foreach_ancestor_end_8743762757292 - j foreach_ancestor_end_8743762757292 + # Argument internal_64 + lw $t0, 568($sp) + sw $t0, 0($sp) # Storing internal_64 - foreach_ancestor_body_8743762757292: + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 564($sp) # internal_65 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + update_min_end_8794497404654: - # Equal operation - lw $t0, 544($sp) # Save in $t0 the left operand address - lw $t1, 532($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - lw $t0, 528($sp) # $t0 = internal_59 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Argument internal_64 + lw $t0, 568($sp) + sw $t0, 4($sp) # Storing internal_64 - # If internal_59 then goto foreach_ancestor_end_8743762757292 - lw $t0, 528($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_end_8743762757292 + # Argument internal_39 + lw $t0, 668($sp) + sw $t0, 0($sp) # Storing internal_39 - # Addition operation - lw $t0, 540($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_ancestor_start_8743762757292 - j foreach_ancestor_start_8743762757292 + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 568($sp) # internal_64 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - foreach_ancestor_end_8743762757292: + # Jumping to foreach_min_start_8794497404654 + j foreach_min_start_8794497404654 + foreach_min_end_8794497404654: + # initialize Array [internal_40] + lw $t0, 652($sp) # $t0 = internal_40 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 528($sp) # internal_71 = new Array[internal_40] + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 524($sp) # internal_72 = address of allocated object Int + + # array internal_71[4 * internal_72] = internal_38 + lw $t0, 524($sp) # $t0 = internal_72 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 528($sp) # $t1 = internal_71 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 660($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # Addition operation - lw $t0, 552($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_type_start_8743762757292 - j foreach_type_start_8743762757292 + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - foreach_type_end_8743762757292: + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 520($sp) # internal_73 = address of allocated object Int + + # array internal_71[4 * internal_73] = internal_38 + lw $t0, 520($sp) # $t0 = internal_73 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 528($sp) # $t1 = internal_71 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 660($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 516($sp) # internal_74 = address of allocated object Int + + # array internal_71[4 * internal_74] = internal_38 + lw $t0, 516($sp) # $t0 = internal_74 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 528($sp) # $t1 = internal_71 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 660($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 512($sp) # internal_75 = address of allocated object Int + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_67 + lw $t0, 556($sp) + sw $t0, 4($sp) # Storing internal_67 - lw $t0, 608($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 512($sp) - j end_assign - not_is_Bool_or_Int: - # internal_63 = internal_39 - lw $t0, 608($sp) - sw $t0, 512($sp) - end_assign: + # Argument internal_42 + lw $t0, 656($sp) + sw $t0, 0($sp) # Storing internal_42 - foreach_min_start_8743762757292: + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 524($sp) # internal_75 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments - # Less than operation - lw $t0, 524($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # If internal_64 then goto foreach_min_body_8743762757292 - lw $t0, 508($sp) # Loading the address of the condition + # If internal_75 then goto error_branch_8794497404654 + lw $t0, 512($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_min_body_8743762757292 - - # Jumping to foreach_min_end_8743762757292 - j foreach_min_end_8743762757292 - - foreach_min_body_8743762757292: + beq $t0, $t1, error_branch_8794497404654 + + # array internal_71[4 * internal_65] = internal_39 + lw $t0, 552($sp) # $t0 = internal_65 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 528($sp) # $t1 = internal_71 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 656($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Less than operation - lw $t0, 516($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 512($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 508($sp) # internal_76 = address of allocated object Int - lw $t0, 508($sp) # $t0 = internal_64 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # If internal_64 then goto update_min_8743762757292 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 504($sp) # internal_77 = address of allocated object Int + + # internal_76 = array internal_71[4 * internal_77] + lw $t0, 504($sp) # $t0 = internal_77 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 528($sp) # $t1 = internal_71 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 508($sp) # internal_76 = array internal_71[4 * internal_77] + sw $t0, 8($t2) + + # If internal_76 then goto branch_C_8794497404654 lw $t0, 508($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, update_min_8743762757292 - - # Jumping to foreach_min_end_8743762757292 - j foreach_min_end_8743762757292 - - update_min_8743762757292: - - lw $t0, 516($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 512($sp) - j end_assign - not_is_Bool_or_Int: - # internal_63 = internal_62 - lw $t0, 516($sp) - sw $t0, 512($sp) - end_assign: - - lw $t0, 524($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 520($sp) - j end_assign - not_is_Bool_or_Int: - # internal_61 = internal_60 - lw $t0, 524($sp) - sw $t0, 520($sp) - end_assign: - - update_min_end_8743762757292: - - # Addition operation - lw $t0, 524($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_min_start_8743762757292 - j foreach_min_start_8743762757292 - - foreach_min_end_8743762757292: - - + beq $t0, $t1, branch_C_8794497404654 + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - - - - - # Equal operation - lw $t0, 520($sp) # Save in $t0 the left operand address - lw $t1, 608($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 - - lw $t0, 500($sp) # $t0 = internal_66 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # If internal_66 then goto error_branch_8743762757292 - lw $t0, 500($sp) # Loading the address of the condition + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 500($sp) # internal_78 = address of allocated object Int + + # internal_76 = array internal_71[4 * internal_78] + lw $t0, 500($sp) # $t0 = internal_78 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 528($sp) # $t1 = internal_71 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 508($sp) # internal_76 = array internal_71[4 * internal_78] + sw $t0, 8($t2) + + # If internal_76 then goto branch_A_8794497404654 + lw $t0, 508($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, error_branch_8743762757292 - + beq $t0, $t1, branch_A_8794497404654 + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # If internal_67 then goto branch_C_8743762757292 - lw $t0, 496($sp) # Loading the address of the condition + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 496($sp) # internal_79 = address of allocated object Int + + # internal_76 = array internal_71[4 * internal_79] + lw $t0, 496($sp) # $t0 = internal_79 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 528($sp) # $t1 = internal_71 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 508($sp) # internal_76 = array internal_71[4 * internal_79] + sw $t0, 8($t2) + + # If internal_76 then goto branch_Object_8794497404654 + lw $t0, 508($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_C_8743762757292 + beq $t0, $t1, branch_Object_8794497404654 + branch_C_8794497404654: - # If internal_67 then goto branch_A_8743762757292 - lw $t0, 496($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_A_8743762757292 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument c + lw $t0, 500($sp) + sw $t0, 4($sp) # Storing c - # If internal_67 then goto branch_Object_8743762757292 - lw $t0, 496($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Object_8743762757292 + # Argument internal_37 + lw $t0, 676($sp) + sw $t0, 0($sp) # Storing internal_37 - branch_C_8743762757292: + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 500($sp) # c = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments @@ -12438,7 +14519,7 @@ # Calling function function_value_at_A jal function_value_at_A lw $ra, 4($sp) - sw $v1, 492($sp) # internal_70 = result of function_value_at_A + sw $v1, 492($sp) # internal_82 = result of function_value_at_A addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments @@ -12449,42 +14530,97 @@ lw $t0, 500($sp) sw $t0, 4($sp) # Storing c - # Argument internal_70 + # Argument internal_82 lw $t0, 496($sp) - sw $t0, 0($sp) # Storing internal_70 + sw $t0, 0($sp) # Storing internal_82 # Calling function function_method6_at_C jal function_method6_at_C lw $ra, 8($sp) - sw $v1, 492($sp) # internal_71 = result of function_method6_at_C + sw $v1, 492($sp) # internal_83 = result of function_method6_at_C addi $sp, $sp, 12 # Freeing space for arguments # Set attribute avar of self - lw $t0, 768($sp) # $t0 = self - lw $t1, 480($sp) # $t1 = internal_71 - sw $t1, 12($t0) # self.avar = internal_71 + lw $t0, 816($sp) # $t0 = self + lw $t1, 480($sp) # $t1 = internal_83 + beq $t1, $zero, object_set_attribute_8794497366456 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794497366456 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794497366456 + j object_set_attribute_8794497366456 + int_set_attribute_8794497366456: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_83 + j end_set_attribute_8794497366456 + bool_set_attribute_8794497366456: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_83 + j end_set_attribute_8794497366456 + object_set_attribute_8794497366456: + sw $t1, 12($t0) # self.avar = internal_83 + end_set_attribute_8794497366456: - lw $t0, 480($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 492($sp) - j end_assign - not_is_Bool_or_Int: - # internal_68 = internal_71 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_80 + lw $t0, 504($sp) + sw $t0, 4($sp) # Storing internal_80 + + # Argument internal_83 + lw $t0, 492($sp) + sw $t0, 0($sp) # Storing internal_83 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 504($sp) # internal_80 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_80 = internal_83 lw $t0, 480($sp) sw $t0, 492($sp) - end_assign: - # Jumping to branch_end_8743762757292 - j branch_end_8743762757292 + # Jumping to branch_end_8794497404654 + j branch_end_8794497404654 + + branch_A_8794497404654: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument a + lw $t0, 488($sp) + sw $t0, 4($sp) # Storing a + + # Argument internal_37 + lw $t0, 676($sp) + sw $t0, 0($sp) # Storing internal_37 - branch_A_8743762757292: + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 488($sp) # a = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments @@ -12497,7 +14633,7 @@ # Calling function function_value_at_A jal function_value_at_A lw $ra, 4($sp) - sw $v1, 480($sp) # internal_73 = result of function_value_at_A + sw $v1, 480($sp) # internal_85 = result of function_value_at_A addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments @@ -12508,42 +14644,97 @@ lw $t0, 488($sp) sw $t0, 4($sp) # Storing a - # Argument internal_73 + # Argument internal_85 lw $t0, 484($sp) - sw $t0, 0($sp) # Storing internal_73 + sw $t0, 0($sp) # Storing internal_85 # Calling function function_method3_at_A jal function_method3_at_A lw $ra, 8($sp) - sw $v1, 480($sp) # internal_74 = result of function_method3_at_A + sw $v1, 480($sp) # internal_86 = result of function_method3_at_A addi $sp, $sp, 12 # Freeing space for arguments # Set attribute avar of self - lw $t0, 768($sp) # $t0 = self - lw $t1, 468($sp) # $t1 = internal_74 - sw $t1, 12($t0) # self.avar = internal_74 + lw $t0, 816($sp) # $t0 = self + lw $t1, 468($sp) # $t1 = internal_86 + beq $t1, $zero, object_set_attribute_8794497375534 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794497375534 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794497375534 + j object_set_attribute_8794497375534 + int_set_attribute_8794497375534: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_86 + j end_set_attribute_8794497375534 + bool_set_attribute_8794497375534: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_86 + j end_set_attribute_8794497375534 + object_set_attribute_8794497375534: + sw $t1, 12($t0) # self.avar = internal_86 + end_set_attribute_8794497375534: - lw $t0, 468($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 492($sp) - j end_assign - not_is_Bool_or_Int: - # internal_68 = internal_74 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_80 + lw $t0, 504($sp) + sw $t0, 4($sp) # Storing internal_80 + + # Argument internal_86 + lw $t0, 480($sp) + sw $t0, 0($sp) # Storing internal_86 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 504($sp) # internal_80 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_80 = internal_86 lw $t0, 468($sp) sw $t0, 492($sp) - end_assign: - # Jumping to branch_end_8743762757292 - j branch_end_8743762757292 + # Jumping to branch_end_8794497404654 + j branch_end_8794497404654 + + branch_Object_8794497404654: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument o + lw $t0, 476($sp) + sw $t0, 4($sp) # Storing o + + # Argument internal_37 + lw $t0, 676($sp) + sw $t0, 0($sp) # Storing internal_37 - branch_Object_8743762757292: + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 476($sp) # o = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating String li $v0, 9 @@ -12553,50 +14744,50 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 7 + addi $t0, $zero, 16 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 79 - sb $t0, 8($v0) # internal_76[0] = 'O' + sb $t0, 8($v0) # internal_88[0] = 'O' addi $t0, $zero, 111 - sb $t0, 9($v0) # internal_76[1] = 'o' + sb $t0, 9($v0) # internal_88[1] = 'o' addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_76[2] = 'o' + sb $t0, 10($v0) # internal_88[2] = 'o' addi $t0, $zero, 111 - sb $t0, 11($v0) # internal_76[3] = 'o' + sb $t0, 11($v0) # internal_88[3] = 'o' addi $t0, $zero, 112 - sb $t0, 12($v0) # internal_76[4] = 'p' + sb $t0, 12($v0) # internal_88[4] = 'p' addi $t0, $zero, 115 - sb $t0, 13($v0) # internal_76[5] = 's' + sb $t0, 13($v0) # internal_88[5] = 's' addi $t0, $zero, 10 - sb $t0, 14($v0) # internal_76[6] = '\n' + sb $t0, 14($v0) # internal_88[6] = '\n' sb $zero, 15($v0) # Null-terminator at the end of the string - sw $v0, 460($sp) # internal_76 = "Oooops\n" + sw $v0, 460($sp) # internal_88 = "Oooops\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 780($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_76 + # Argument internal_88 lw $t0, 472($sp) - sw $t0, 0($sp) # Storing internal_76 + sw $t0, 0($sp) # Storing internal_88 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 468($sp) # internal_77 = result of function_out_string_at_IO + sw $v1, 468($sp) # internal_89 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -12604,13 +14795,13 @@ sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 776($sp) + lw $t0, 824($sp) sw $t0, 0($sp) # Storing self # Calling function function_abort_at_Object jal function_abort_at_Object lw $ra, 4($sp) - sw $v1, 460($sp) # internal_78 = result of function_abort_at_Object + sw $v1, 460($sp) # internal_90 = result of function_abort_at_Object addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 0 @@ -12623,55 +14814,45 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 448($sp) # internal_79 = address of allocated object Int + sw $v0, 448($sp) # internal_91 = address of allocated object Int - lw $t0, 448($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 492($sp) - j end_assign - not_is_Bool_or_Int: - # internal_68 = internal_79 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_80 + lw $t0, 504($sp) + sw $t0, 4($sp) # Storing internal_80 + + # Argument internal_91 + lw $t0, 460($sp) + sw $t0, 0($sp) # Storing internal_91 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 504($sp) # internal_80 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_80 = internal_91 lw $t0, 448($sp) sw $t0, 492($sp) - end_assign: - # Jumping to branch_end_8743762757292 - j branch_end_8743762757292 + # Jumping to branch_end_8794497404654 + j branch_end_8794497404654 - error_branch_8743762757292: + error_branch_8794497404654: + branch_end_8794497404654: - branch_end_8743762757292: - - lw $t0, 492($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 632($sp) - j end_assign - not_is_Bool_or_Int: - # internal_33 = internal_68 + # internal_32 = internal_80 lw $t0, 492($sp) - sw $t0, 632($sp) - end_assign: - - # Jumping to endif_8743762758976 - j endif_8743762758976 + sw $t0, 684($sp) - else_8743762758976: + # Jumping to endif_8794497406594 + j endif_8794497406594 + else_8794497406594: # Allocating Bool 0 li $v0, 9 @@ -12683,12 +14864,43 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 440($sp) # internal_81 = address of allocated object Int + sw $v0, 440($sp) # internal_93 = address of allocated object Int # Get attribute char of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'char' from the instance - sw $t1, 436($sp) # internal_82 = char + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497367372 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497367372 + j object_get_attribute_8794497367372 + int_get_attribute_8794497367372: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 436($sp) # internal_94 = self.char + j end_get_attribute_8794497367372 + bool_get_attribute_8794497367372: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 436($sp) # internal_94 = self.char + j end_get_attribute_8794497367372 + object_get_attribute_8794497367372: + sw $t1, 436($sp) # internal_94 = char + end_get_attribute_8794497367372: # Allocating String li $v0, 9 @@ -12698,61 +14910,48 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 99 - sb $t0, 8($v0) # internal_83[0] = 'c' + sb $t0, 8($v0) # internal_95[0] = 'c' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 432($sp) # internal_83 = "c" + sw $v0, 432($sp) # internal_95 = "c" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_82 + # Argument internal_94 lw $t0, 448($sp) - sw $t0, 4($sp) # Storing internal_82 + sw $t0, 4($sp) # Storing internal_94 - # Argument internal_83 + # Argument internal_95 lw $t0, 444($sp) - sw $t0, 0($sp) # Storing internal_83 + sw $t0, 0($sp) # Storing internal_95 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 440($sp) # internal_84 = result of function_equal + sw $v1, 440($sp) # internal_96 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 428($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 440($sp) - j end_assign - not_is_Bool_or_Int: - # internal_81 = internal_84 + # internal_93 = internal_96 lw $t0, 428($sp) sw $t0, 440($sp) - end_assign: - # If internal_81 then goto then_8743762758970 + # If internal_93 then goto then_8794497406588 lw $t0, 440($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762758970 + beq $t0, $t1, then_8794497406588 - # Jumping to else_8743762758970 - j else_8743762758970 + # Jumping to else_8794497406588 + j else_8794497406588 - then_8743762758970: + then_8794497406588: # Allocating A li $v0, 9 @@ -12761,20 +14960,20 @@ la $t0, type_A # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 424($sp) # internal_85 = address of allocated object A + sw $v0, 424($sp) # internal_97 = address of allocated object A # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_85 + # Argument internal_97 lw $t0, 432($sp) - sw $t0, 0($sp) # Storing internal_85 + sw $t0, 0($sp) # Storing internal_97 # Calling function function___init___at_A jal function___init___at_A lw $ra, 4($sp) - sw $v1, 432($sp) # internal_85 = result of function___init___at_A + sw $v1, 432($sp) # internal_97 = result of function___init___at_A addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments @@ -12782,37 +14981,69 @@ sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 776($sp) + lw $t0, 824($sp) sw $t0, 0($sp) # Storing self # Calling function function_get_int_at_Main jal function_get_int_at_Main lw $ra, 4($sp) - sw $v1, 428($sp) # internal_86 = result of function_get_int_at_Main + sw $v1, 428($sp) # internal_98 = result of function_get_int_at_Main addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_85 + # Argument internal_97 lw $t0, 436($sp) - sw $t0, 4($sp) # Storing internal_85 + sw $t0, 4($sp) # Storing internal_97 - # Argument internal_86 + # Argument internal_98 lw $t0, 432($sp) - sw $t0, 0($sp) # Storing internal_86 + sw $t0, 0($sp) # Storing internal_98 # Calling function function_set_var_at_A jal function_set_var_at_A lw $ra, 8($sp) - sw $v1, 428($sp) # internal_87 = result of function_set_var_at_A + sw $v1, 428($sp) # internal_99 = result of function_set_var_at_A addi $sp, $sp, 12 # Freeing space for arguments # Set attribute a_var of self - lw $t0, 768($sp) # $t0 = self - lw $t1, 416($sp) # $t1 = internal_87 - sw $t1, 16($t0) # self.a_var = internal_87 + lw $t0, 816($sp) # $t0 = self + lw $t1, 416($sp) # $t1 = internal_99 + beq $t1, $zero, object_set_attribute_8794497367453 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794497367453 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794497367453 + j object_set_attribute_8794497367453 + int_set_attribute_8794497367453: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.a_var = internal_99 + j end_set_attribute_8794497367453 + bool_set_attribute_8794497367453: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.a_var = internal_99 + j end_set_attribute_8794497367453 + object_set_attribute_8794497367453: + sw $t1, 16($t0) # self.a_var = internal_99 + end_set_attribute_8794497367453: # Allocating D li $v0, 9 @@ -12821,109 +15052,189 @@ la $t0, type_D # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 412($sp) # internal_88 = address of allocated object D + sw $v0, 412($sp) # internal_100 = address of allocated object D # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_88 + # Argument internal_100 lw $t0, 420($sp) - sw $t0, 0($sp) # Storing internal_88 + sw $t0, 0($sp) # Storing internal_100 # Calling function function___init___at_D jal function___init___at_D lw $ra, 4($sp) - sw $v1, 420($sp) # internal_88 = result of function___init___at_D + sw $v1, 420($sp) # internal_100 = result of function___init___at_D addi $sp, $sp, 8 # Freeing space for arguments # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 408($sp) # internal_89 = avar + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497367851 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497367851 + j object_get_attribute_8794497367851 + int_get_attribute_8794497367851: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 408($sp) # internal_101 = self.avar + j end_get_attribute_8794497367851 + bool_get_attribute_8794497367851: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 408($sp) # internal_101 = self.avar + j end_get_attribute_8794497367851 + object_get_attribute_8794497367851: + sw $t1, 408($sp) # internal_101 = avar + end_get_attribute_8794497367851: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_89 + # Argument internal_101 lw $t0, 416($sp) - sw $t0, 0($sp) # Storing internal_89 + sw $t0, 0($sp) # Storing internal_101 # Calling function function_value_at_A jal function_value_at_A lw $ra, 4($sp) - sw $v1, 412($sp) # internal_90 = result of function_value_at_A + sw $v1, 412($sp) # internal_102 = result of function_value_at_A addi $sp, $sp, 8 # Freeing space for arguments # Get attribute a_var of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 16($t0) # Get the attribute 'a_var' from the instance - sw $t1, 400($sp) # internal_91 = a_var + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497367881 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497367881 + j object_get_attribute_8794497367881 + int_get_attribute_8794497367881: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 400($sp) # internal_103 = self.a_var + j end_get_attribute_8794497367881 + bool_get_attribute_8794497367881: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 400($sp) # internal_103 = self.a_var + j end_get_attribute_8794497367881 + object_get_attribute_8794497367881: + sw $t1, 400($sp) # internal_103 = a_var + end_get_attribute_8794497367881: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_91 + # Argument internal_103 lw $t0, 408($sp) - sw $t0, 0($sp) # Storing internal_91 + sw $t0, 0($sp) # Storing internal_103 # Calling function function_value_at_A jal function_value_at_A lw $ra, 4($sp) - sw $v1, 404($sp) # internal_92 = result of function_value_at_A + sw $v1, 404($sp) # internal_104 = result of function_value_at_A addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address - # Argument internal_88 + # Argument internal_100 lw $t0, 428($sp) - sw $t0, 8($sp) # Storing internal_88 + sw $t0, 8($sp) # Storing internal_100 - # Argument internal_90 + # Argument internal_102 lw $t0, 420($sp) - sw $t0, 4($sp) # Storing internal_90 + sw $t0, 4($sp) # Storing internal_102 - # Argument internal_92 + # Argument internal_104 lw $t0, 412($sp) - sw $t0, 0($sp) # Storing internal_92 + sw $t0, 0($sp) # Storing internal_104 # Calling function function_method4_at_A jal function_method4_at_A lw $ra, 12($sp) - sw $v1, 408($sp) # internal_93 = result of function_method4_at_A + sw $v1, 408($sp) # internal_105 = result of function_method4_at_A addi $sp, $sp, 16 # Freeing space for arguments # Set attribute avar of self - lw $t0, 768($sp) # $t0 = self - lw $t1, 392($sp) # $t1 = internal_93 - sw $t1, 12($t0) # self.avar = internal_93 - - lw $t0, 392($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 444($sp) - j end_assign - not_is_Bool_or_Int: - # internal_80 = internal_93 + lw $t0, 816($sp) # $t0 = self + lw $t1, 392($sp) # $t1 = internal_105 + beq $t1, $zero, object_set_attribute_8794497367528 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794497367528 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794497367528 + j object_set_attribute_8794497367528 + int_set_attribute_8794497367528: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_105 + j end_set_attribute_8794497367528 + bool_set_attribute_8794497367528: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_105 + j end_set_attribute_8794497367528 + object_set_attribute_8794497367528: + sw $t1, 12($t0) # self.avar = internal_105 + end_set_attribute_8794497367528: + + # internal_92 = internal_105 lw $t0, 392($sp) sw $t0, 444($sp) - end_assign: - # Jumping to endif_8743762758970 - j endif_8743762758970 - - else_8743762758970: + # Jumping to endif_8794497406588 + j endif_8794497406588 + else_8794497406588: # Allocating Bool 0 li $v0, 9 @@ -12935,12 +15246,43 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 384($sp) # internal_95 = address of allocated object Int + sw $v0, 384($sp) # internal_107 = address of allocated object Int # Get attribute char of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'char' from the instance - sw $t1, 380($sp) # internal_96 = char + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497367965 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497367965 + j object_get_attribute_8794497367965 + int_get_attribute_8794497367965: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 380($sp) # internal_108 = self.char + j end_get_attribute_8794497367965 + bool_get_attribute_8794497367965: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 380($sp) # internal_108 = self.char + j end_get_attribute_8794497367965 + object_get_attribute_8794497367965: + sw $t1, 380($sp) # internal_108 = char + end_get_attribute_8794497367965: # Allocating String li $v0, 9 @@ -12950,61 +15292,48 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 100 - sb $t0, 8($v0) # internal_97[0] = 'd' + sb $t0, 8($v0) # internal_109[0] = 'd' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 376($sp) # internal_97 = "d" + sw $v0, 376($sp) # internal_109 = "d" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_96 + # Argument internal_108 lw $t0, 392($sp) - sw $t0, 4($sp) # Storing internal_96 + sw $t0, 4($sp) # Storing internal_108 - # Argument internal_97 + # Argument internal_109 lw $t0, 388($sp) - sw $t0, 0($sp) # Storing internal_97 + sw $t0, 0($sp) # Storing internal_109 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 384($sp) # internal_98 = result of function_equal + sw $v1, 384($sp) # internal_110 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 372($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 384($sp) - j end_assign - not_is_Bool_or_Int: - # internal_95 = internal_98 + # internal_107 = internal_110 lw $t0, 372($sp) sw $t0, 384($sp) - end_assign: - # If internal_95 then goto then_8743762758964 + # If internal_107 then goto then_8794497406582 lw $t0, 384($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762758964 + beq $t0, $t1, then_8794497406582 - # Jumping to else_8743762758964 - j else_8743762758964 + # Jumping to else_8794497406582 + j else_8794497406582 - then_8743762758964: + then_8794497406582: # Allocating C li $v0, 9 @@ -13013,86 +15342,135 @@ la $t0, type_C # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 368($sp) # internal_99 = address of allocated object C + sw $v0, 368($sp) # internal_111 = address of allocated object C # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_99 + # Argument internal_111 lw $t0, 376($sp) - sw $t0, 0($sp) # Storing internal_99 + sw $t0, 0($sp) # Storing internal_111 # Calling function function___init___at_C jal function___init___at_C lw $ra, 4($sp) - sw $v1, 376($sp) # internal_99 = result of function___init___at_C + sw $v1, 376($sp) # internal_111 = result of function___init___at_C addi $sp, $sp, 8 # Freeing space for arguments # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 364($sp) # internal_100 = avar + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497368610 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497368610 + j object_get_attribute_8794497368610 + int_get_attribute_8794497368610: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 364($sp) # internal_112 = self.avar + j end_get_attribute_8794497368610 + bool_get_attribute_8794497368610: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 364($sp) # internal_112 = self.avar + j end_get_attribute_8794497368610 + object_get_attribute_8794497368610: + sw $t1, 364($sp) # internal_112 = avar + end_get_attribute_8794497368610: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_100 + # Argument internal_112 lw $t0, 372($sp) - sw $t0, 0($sp) # Storing internal_100 + sw $t0, 0($sp) # Storing internal_112 # Calling function function_value_at_A jal function_value_at_A lw $ra, 4($sp) - sw $v1, 368($sp) # internal_101 = result of function_value_at_A + sw $v1, 368($sp) # internal_113 = result of function_value_at_A addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_99 + # Argument internal_111 lw $t0, 380($sp) - sw $t0, 4($sp) # Storing internal_99 + sw $t0, 4($sp) # Storing internal_111 - # Argument internal_101 + # Argument internal_113 lw $t0, 372($sp) - sw $t0, 0($sp) # Storing internal_101 + sw $t0, 0($sp) # Storing internal_113 # Calling function function_method5_at_C jal function_method5_at_C lw $ra, 8($sp) - sw $v1, 368($sp) # internal_102 = result of function_method5_at_C + sw $v1, 368($sp) # internal_114 = result of function_method5_at_C addi $sp, $sp, 12 # Freeing space for arguments # Set attribute avar of self - lw $t0, 768($sp) # $t0 = self - lw $t1, 356($sp) # $t1 = internal_102 - sw $t1, 12($t0) # self.avar = internal_102 - - lw $t0, 356($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 388($sp) - j end_assign - not_is_Bool_or_Int: - # internal_94 = internal_102 + lw $t0, 816($sp) # $t0 = self + lw $t1, 356($sp) # $t1 = internal_114 + beq $t1, $zero, object_set_attribute_8794497368031 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794497368031 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794497368031 + j object_set_attribute_8794497368031 + int_set_attribute_8794497368031: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_114 + j end_set_attribute_8794497368031 + bool_set_attribute_8794497368031: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_114 + j end_set_attribute_8794497368031 + object_set_attribute_8794497368031: + sw $t1, 12($t0) # self.avar = internal_114 + end_set_attribute_8794497368031: + + # internal_106 = internal_114 lw $t0, 356($sp) sw $t0, 388($sp) - end_assign: - # Jumping to endif_8743762758964 - j endif_8743762758964 - - else_8743762758964: + # Jumping to endif_8794497406582 + j endif_8794497406582 + else_8794497406582: # Allocating Bool 0 li $v0, 9 @@ -13104,12 +15482,43 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 348($sp) # internal_104 = address of allocated object Int + sw $v0, 348($sp) # internal_116 = address of allocated object Int # Get attribute char of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'char' from the instance - sw $t1, 344($sp) # internal_105 = char + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497368703 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497368703 + j object_get_attribute_8794497368703 + int_get_attribute_8794497368703: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 344($sp) # internal_117 = self.char + j end_get_attribute_8794497368703 + bool_get_attribute_8794497368703: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 344($sp) # internal_117 = self.char + j end_get_attribute_8794497368703 + object_get_attribute_8794497368703: + sw $t1, 344($sp) # internal_117 = char + end_get_attribute_8794497368703: # Allocating String li $v0, 9 @@ -13119,61 +15528,48 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 101 - sb $t0, 8($v0) # internal_106[0] = 'e' + sb $t0, 8($v0) # internal_118[0] = 'e' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 340($sp) # internal_106 = "e" + sw $v0, 340($sp) # internal_118 = "e" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_105 + # Argument internal_117 lw $t0, 356($sp) - sw $t0, 4($sp) # Storing internal_105 + sw $t0, 4($sp) # Storing internal_117 - # Argument internal_106 + # Argument internal_118 lw $t0, 352($sp) - sw $t0, 0($sp) # Storing internal_106 + sw $t0, 0($sp) # Storing internal_118 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 348($sp) # internal_107 = result of function_equal + sw $v1, 348($sp) # internal_119 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 336($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 348($sp) - j end_assign - not_is_Bool_or_Int: - # internal_104 = internal_107 + # internal_116 = internal_119 lw $t0, 336($sp) sw $t0, 348($sp) - end_assign: - # If internal_104 then goto then_8743762758958 + # If internal_116 then goto then_8794497406576 lw $t0, 348($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762758958 + beq $t0, $t1, then_8794497406576 - # Jumping to else_8743762758958 - j else_8743762758958 + # Jumping to else_8794497406576 + j else_8794497406576 - then_8743762758958: + then_8794497406576: # Allocating C li $v0, 9 @@ -13182,86 +15578,135 @@ la $t0, type_C # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 332($sp) # internal_108 = address of allocated object C + sw $v0, 332($sp) # internal_120 = address of allocated object C # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_108 + # Argument internal_120 lw $t0, 340($sp) - sw $t0, 0($sp) # Storing internal_108 + sw $t0, 0($sp) # Storing internal_120 # Calling function function___init___at_C jal function___init___at_C lw $ra, 4($sp) - sw $v1, 340($sp) # internal_108 = result of function___init___at_C + sw $v1, 340($sp) # internal_120 = result of function___init___at_C addi $sp, $sp, 8 # Freeing space for arguments # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 328($sp) # internal_109 = avar + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497368324 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497368324 + j object_get_attribute_8794497368324 + int_get_attribute_8794497368324: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 328($sp) # internal_121 = self.avar + j end_get_attribute_8794497368324 + bool_get_attribute_8794497368324: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 328($sp) # internal_121 = self.avar + j end_get_attribute_8794497368324 + object_get_attribute_8794497368324: + sw $t1, 328($sp) # internal_121 = avar + end_get_attribute_8794497368324: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_109 + # Argument internal_121 lw $t0, 336($sp) - sw $t0, 0($sp) # Storing internal_109 + sw $t0, 0($sp) # Storing internal_121 # Calling function function_value_at_A jal function_value_at_A lw $ra, 4($sp) - sw $v1, 332($sp) # internal_110 = result of function_value_at_A + sw $v1, 332($sp) # internal_122 = result of function_value_at_A addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_108 + # Argument internal_120 lw $t0, 344($sp) - sw $t0, 4($sp) # Storing internal_108 + sw $t0, 4($sp) # Storing internal_120 - # Argument internal_110 + # Argument internal_122 lw $t0, 336($sp) - sw $t0, 0($sp) # Storing internal_110 + sw $t0, 0($sp) # Storing internal_122 # Calling function function_method5_at_C jal function_method5_at_C lw $ra, 8($sp) - sw $v1, 332($sp) # internal_111 = result of function_method5_at_C + sw $v1, 332($sp) # internal_123 = result of function_method5_at_C addi $sp, $sp, 12 # Freeing space for arguments # Set attribute avar of self - lw $t0, 768($sp) # $t0 = self - lw $t1, 320($sp) # $t1 = internal_111 - sw $t1, 12($t0) # self.avar = internal_111 - - lw $t0, 320($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 352($sp) - j end_assign - not_is_Bool_or_Int: - # internal_103 = internal_111 + lw $t0, 816($sp) # $t0 = self + lw $t1, 320($sp) # $t1 = internal_123 + beq $t1, $zero, object_set_attribute_8794497368769 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794497368769 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794497368769 + j object_set_attribute_8794497368769 + int_set_attribute_8794497368769: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_123 + j end_set_attribute_8794497368769 + bool_set_attribute_8794497368769: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_123 + j end_set_attribute_8794497368769 + object_set_attribute_8794497368769: + sw $t1, 12($t0) # self.avar = internal_123 + end_set_attribute_8794497368769: + + # internal_115 = internal_123 lw $t0, 320($sp) sw $t0, 352($sp) - end_assign: - - # Jumping to endif_8743762758958 - j endif_8743762758958 - else_8743762758958: + # Jumping to endif_8794497406576 + j endif_8794497406576 + else_8794497406576: # Allocating Bool 0 li $v0, 9 @@ -13273,12 +15718,43 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 312($sp) # internal_113 = address of allocated object Int + sw $v0, 312($sp) # internal_125 = address of allocated object Int # Get attribute char of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'char' from the instance - sw $t1, 308($sp) # internal_114 = char + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497368417 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497368417 + j object_get_attribute_8794497368417 + int_get_attribute_8794497368417: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 308($sp) # internal_126 = self.char + j end_get_attribute_8794497368417 + bool_get_attribute_8794497368417: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 308($sp) # internal_126 = self.char + j end_get_attribute_8794497368417 + object_get_attribute_8794497368417: + sw $t1, 308($sp) # internal_126 = char + end_get_attribute_8794497368417: # Allocating String li $v0, 9 @@ -13288,61 +15764,48 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 102 - sb $t0, 8($v0) # internal_115[0] = 'f' + sb $t0, 8($v0) # internal_127[0] = 'f' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 304($sp) # internal_115 = "f" + sw $v0, 304($sp) # internal_127 = "f" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_114 + # Argument internal_126 lw $t0, 320($sp) - sw $t0, 4($sp) # Storing internal_114 + sw $t0, 4($sp) # Storing internal_126 - # Argument internal_115 + # Argument internal_127 lw $t0, 316($sp) - sw $t0, 0($sp) # Storing internal_115 + sw $t0, 0($sp) # Storing internal_127 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 312($sp) # internal_116 = result of function_equal + sw $v1, 312($sp) # internal_128 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 300($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 312($sp) - j end_assign - not_is_Bool_or_Int: - # internal_113 = internal_116 + # internal_125 = internal_128 lw $t0, 300($sp) sw $t0, 312($sp) - end_assign: - # If internal_113 then goto then_8743762758952 + # If internal_125 then goto then_8794497406570 lw $t0, 312($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762758952 + beq $t0, $t1, then_8794497406570 - # Jumping to else_8743762758952 - j else_8743762758952 + # Jumping to else_8794497406570 + j else_8794497406570 - then_8743762758952: + then_8794497406570: # Allocating C li $v0, 9 @@ -13351,86 +15814,135 @@ la $t0, type_C # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 296($sp) # internal_117 = address of allocated object C + sw $v0, 296($sp) # internal_129 = address of allocated object C # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_117 + # Argument internal_129 lw $t0, 304($sp) - sw $t0, 0($sp) # Storing internal_117 + sw $t0, 0($sp) # Storing internal_129 # Calling function function___init___at_C jal function___init___at_C lw $ra, 4($sp) - sw $v1, 304($sp) # internal_117 = result of function___init___at_C + sw $v1, 304($sp) # internal_129 = result of function___init___at_C addi $sp, $sp, 8 # Freeing space for arguments # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 292($sp) # internal_118 = avar + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497368546 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497368546 + j object_get_attribute_8794497368546 + int_get_attribute_8794497368546: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 292($sp) # internal_130 = self.avar + j end_get_attribute_8794497368546 + bool_get_attribute_8794497368546: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 292($sp) # internal_130 = self.avar + j end_get_attribute_8794497368546 + object_get_attribute_8794497368546: + sw $t1, 292($sp) # internal_130 = avar + end_get_attribute_8794497368546: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_118 + # Argument internal_130 lw $t0, 300($sp) - sw $t0, 0($sp) # Storing internal_118 + sw $t0, 0($sp) # Storing internal_130 # Calling function function_value_at_A jal function_value_at_A lw $ra, 4($sp) - sw $v1, 296($sp) # internal_119 = result of function_value_at_A + sw $v1, 296($sp) # internal_131 = result of function_value_at_A addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_117 + # Argument internal_129 lw $t0, 308($sp) - sw $t0, 4($sp) # Storing internal_117 + sw $t0, 4($sp) # Storing internal_129 - # Argument internal_119 + # Argument internal_131 lw $t0, 300($sp) - sw $t0, 0($sp) # Storing internal_119 + sw $t0, 0($sp) # Storing internal_131 # Calling function function_method5_at_C jal function_method5_at_C lw $ra, 8($sp) - sw $v1, 296($sp) # internal_120 = result of function_method5_at_C + sw $v1, 296($sp) # internal_132 = result of function_method5_at_C addi $sp, $sp, 12 # Freeing space for arguments # Set attribute avar of self - lw $t0, 768($sp) # $t0 = self - lw $t1, 284($sp) # $t1 = internal_120 - sw $t1, 12($t0) # self.avar = internal_120 - - lw $t0, 284($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 316($sp) - j end_assign - not_is_Bool_or_Int: - # internal_112 = internal_120 + lw $t0, 816($sp) # $t0 = self + lw $t1, 284($sp) # $t1 = internal_132 + beq $t1, $zero, object_set_attribute_8794497368483 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794497368483 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794497368483 + j object_set_attribute_8794497368483 + int_set_attribute_8794497368483: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_132 + j end_set_attribute_8794497368483 + bool_set_attribute_8794497368483: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_132 + j end_set_attribute_8794497368483 + object_set_attribute_8794497368483: + sw $t1, 12($t0) # self.avar = internal_132 + end_set_attribute_8794497368483: + + # internal_124 = internal_132 lw $t0, 284($sp) sw $t0, 316($sp) - end_assign: - - # Jumping to endif_8743762758952 - j endif_8743762758952 - else_8743762758952: + # Jumping to endif_8794497406570 + j endif_8794497406570 + else_8794497406570: # Allocating Bool 0 li $v0, 9 @@ -13442,12 +15954,43 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 276($sp) # internal_122 = address of allocated object Int + sw $v0, 276($sp) # internal_134 = address of allocated object Int # Get attribute char of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'char' from the instance - sw $t1, 272($sp) # internal_123 = char + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497369667 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497369667 + j object_get_attribute_8794497369667 + int_get_attribute_8794497369667: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 272($sp) # internal_135 = self.char + j end_get_attribute_8794497369667 + bool_get_attribute_8794497369667: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 272($sp) # internal_135 = self.char + j end_get_attribute_8794497369667 + object_get_attribute_8794497369667: + sw $t1, 272($sp) # internal_135 = char + end_get_attribute_8794497369667: # Allocating String li $v0, 9 @@ -13457,62 +16000,48 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 103 - sb $t0, 8($v0) # internal_124[0] = 'g' + sb $t0, 8($v0) # internal_136[0] = 'g' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 268($sp) # internal_124 = "g" + sw $v0, 268($sp) # internal_136 = "g" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_123 + # Argument internal_135 lw $t0, 284($sp) - sw $t0, 4($sp) # Storing internal_123 + sw $t0, 4($sp) # Storing internal_135 - # Argument internal_124 + # Argument internal_136 lw $t0, 280($sp) - sw $t0, 0($sp) # Storing internal_124 + sw $t0, 0($sp) # Storing internal_136 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 276($sp) # internal_125 = result of function_equal + sw $v1, 276($sp) # internal_137 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 264($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 276($sp) - j end_assign - not_is_Bool_or_Int: - # internal_122 = internal_125 + # internal_134 = internal_137 lw $t0, 264($sp) sw $t0, 276($sp) - end_assign: - # If internal_122 then goto then_8743762758946 + # If internal_134 then goto then_8794497406564 lw $t0, 276($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762758946 - - # Jumping to else_8743762758946 - j else_8743762758946 + beq $t0, $t1, then_8794497406564 - then_8743762758946: + # Jumping to else_8794497406564 + j else_8794497406564 + then_8794497406564: # Allocating Bool 0 li $v0, 9 @@ -13524,7 +16053,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 256($sp) # internal_127 = address of allocated object Int + sw $v0, 256($sp) # internal_139 = address of allocated object Int # Allocating D li $v0, 9 @@ -13533,86 +16062,104 @@ la $t0, type_D # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 252($sp) # internal_128 = address of allocated object D + sw $v0, 252($sp) # internal_140 = address of allocated object D # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_128 + # Argument internal_140 lw $t0, 260($sp) - sw $t0, 0($sp) # Storing internal_128 + sw $t0, 0($sp) # Storing internal_140 # Calling function function___init___at_D jal function___init___at_D lw $ra, 4($sp) - sw $v1, 260($sp) # internal_128 = result of function___init___at_D + sw $v1, 260($sp) # internal_140 = result of function___init___at_D addi $sp, $sp, 8 # Freeing space for arguments # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 248($sp) # internal_129 = avar + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497369820 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497369820 + j object_get_attribute_8794497369820 + int_get_attribute_8794497369820: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 248($sp) # internal_141 = self.avar + j end_get_attribute_8794497369820 + bool_get_attribute_8794497369820: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 248($sp) # internal_141 = self.avar + j end_get_attribute_8794497369820 + object_get_attribute_8794497369820: + sw $t1, 248($sp) # internal_141 = avar + end_get_attribute_8794497369820: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_129 + # Argument internal_141 lw $t0, 256($sp) - sw $t0, 0($sp) # Storing internal_129 + sw $t0, 0($sp) # Storing internal_141 # Calling function function_value_at_A jal function_value_at_A lw $ra, 4($sp) - sw $v1, 252($sp) # internal_130 = result of function_value_at_A + sw $v1, 252($sp) # internal_142 = result of function_value_at_A addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_128 + # Argument internal_140 lw $t0, 264($sp) - sw $t0, 4($sp) # Storing internal_128 + sw $t0, 4($sp) # Storing internal_140 - # Argument internal_130 + # Argument internal_142 lw $t0, 256($sp) - sw $t0, 0($sp) # Storing internal_130 + sw $t0, 0($sp) # Storing internal_142 # Calling function function_method7_at_D jal function_method7_at_D lw $ra, 8($sp) - sw $v1, 252($sp) # internal_131 = result of function_method7_at_D + sw $v1, 252($sp) # internal_143 = result of function_method7_at_D addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 240($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 256($sp) - j end_assign - not_is_Bool_or_Int: - # internal_127 = internal_131 + # internal_139 = internal_143 lw $t0, 240($sp) sw $t0, 256($sp) - end_assign: - # If internal_127 then goto then_8743762757849 + # If internal_139 then goto then_8794497405727 lw $t0, 256($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762757849 + beq $t0, $t1, then_8794497405727 - # Jumping to else_8743762757849 - j else_8743762757849 + # Jumping to else_8794497405727 + j else_8794497405727 - then_8743762757849: + then_8794497405727: # Allocating String li $v0, 9 @@ -13622,73 +16169,104 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 7 + addi $t0, $zero, 16 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 110 - sb $t0, 8($v0) # internal_132[0] = 'n' + sb $t0, 8($v0) # internal_144[0] = 'n' addi $t0, $zero, 117 - sb $t0, 9($v0) # internal_132[1] = 'u' + sb $t0, 9($v0) # internal_144[1] = 'u' addi $t0, $zero, 109 - sb $t0, 10($v0) # internal_132[2] = 'm' + sb $t0, 10($v0) # internal_144[2] = 'm' addi $t0, $zero, 98 - sb $t0, 11($v0) # internal_132[3] = 'b' + sb $t0, 11($v0) # internal_144[3] = 'b' addi $t0, $zero, 101 - sb $t0, 12($v0) # internal_132[4] = 'e' + sb $t0, 12($v0) # internal_144[4] = 'e' addi $t0, $zero, 114 - sb $t0, 13($v0) # internal_132[5] = 'r' + sb $t0, 13($v0) # internal_144[5] = 'r' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_132[6] = ' ' + sb $t0, 14($v0) # internal_144[6] = ' ' sb $zero, 15($v0) # Null-terminator at the end of the string - sw $v0, 236($sp) # internal_132 = "number " + sw $v0, 236($sp) # internal_144 = "number " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 780($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_132 + # Argument internal_144 lw $t0, 248($sp) - sw $t0, 0($sp) # Storing internal_132 + sw $t0, 0($sp) # Storing internal_144 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 244($sp) # internal_133 = result of function_out_string_at_IO + sw $v1, 244($sp) # internal_145 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 228($sp) # internal_134 = avar + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497337688 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497337688 + j object_get_attribute_8794497337688 + int_get_attribute_8794497337688: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 228($sp) # internal_146 = self.avar + j end_get_attribute_8794497337688 + bool_get_attribute_8794497337688: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 228($sp) # internal_146 = self.avar + j end_get_attribute_8794497337688 + object_get_attribute_8794497337688: + sw $t1, 228($sp) # internal_146 = avar + end_get_attribute_8794497337688: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 780($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_134 + # Argument internal_146 lw $t0, 240($sp) - sw $t0, 0($sp) # Storing internal_134 + sw $t0, 0($sp) # Storing internal_146 # Calling function function_print_at_Main jal function_print_at_Main lw $ra, 8($sp) - sw $v1, 236($sp) # internal_135 = result of function_print_at_Main + sw $v1, 236($sp) # internal_147 = result of function_print_at_Main addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -13699,109 +16277,96 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 19 + addi $t0, $zero, 28 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 105 - sb $t0, 8($v0) # internal_136[0] = 'i' + sb $t0, 8($v0) # internal_148[0] = 'i' addi $t0, $zero, 115 - sb $t0, 9($v0) # internal_136[1] = 's' + sb $t0, 9($v0) # internal_148[1] = 's' addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_136[2] = ' ' + sb $t0, 10($v0) # internal_148[2] = ' ' addi $t0, $zero, 100 - sb $t0, 11($v0) # internal_136[3] = 'd' + sb $t0, 11($v0) # internal_148[3] = 'd' addi $t0, $zero, 105 - sb $t0, 12($v0) # internal_136[4] = 'i' + sb $t0, 12($v0) # internal_148[4] = 'i' addi $t0, $zero, 118 - sb $t0, 13($v0) # internal_136[5] = 'v' + sb $t0, 13($v0) # internal_148[5] = 'v' addi $t0, $zero, 105 - sb $t0, 14($v0) # internal_136[6] = 'i' + sb $t0, 14($v0) # internal_148[6] = 'i' addi $t0, $zero, 115 - sb $t0, 15($v0) # internal_136[7] = 's' + sb $t0, 15($v0) # internal_148[7] = 's' addi $t0, $zero, 105 - sb $t0, 16($v0) # internal_136[8] = 'i' + sb $t0, 16($v0) # internal_148[8] = 'i' addi $t0, $zero, 98 - sb $t0, 17($v0) # internal_136[9] = 'b' + sb $t0, 17($v0) # internal_148[9] = 'b' addi $t0, $zero, 108 - sb $t0, 18($v0) # internal_136[10] = 'l' + sb $t0, 18($v0) # internal_148[10] = 'l' addi $t0, $zero, 101 - sb $t0, 19($v0) # internal_136[11] = 'e' + sb $t0, 19($v0) # internal_148[11] = 'e' addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_136[12] = ' ' + sb $t0, 20($v0) # internal_148[12] = ' ' addi $t0, $zero, 98 - sb $t0, 21($v0) # internal_136[13] = 'b' + sb $t0, 21($v0) # internal_148[13] = 'b' addi $t0, $zero, 121 - sb $t0, 22($v0) # internal_136[14] = 'y' + sb $t0, 22($v0) # internal_148[14] = 'y' addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_136[15] = ' ' + sb $t0, 23($v0) # internal_148[15] = ' ' addi $t0, $zero, 51 - sb $t0, 24($v0) # internal_136[16] = '3' + sb $t0, 24($v0) # internal_148[16] = '3' addi $t0, $zero, 46 - sb $t0, 25($v0) # internal_136[17] = '.' + sb $t0, 25($v0) # internal_148[17] = '.' addi $t0, $zero, 10 - sb $t0, 26($v0) # internal_136[18] = '\n' + sb $t0, 26($v0) # internal_148[18] = '\n' sb $zero, 27($v0) # Null-terminator at the end of the string - sw $v0, 220($sp) # internal_136 = "is divisible by 3.\n" + sw $v0, 220($sp) # internal_148 = "is divisible by 3.\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 780($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_136 + # Argument internal_148 lw $t0, 232($sp) - sw $t0, 0($sp) # Storing internal_136 + sw $t0, 0($sp) # Storing internal_148 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 228($sp) # internal_137 = result of function_out_string_at_IO + sw $v1, 228($sp) # internal_149 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 216($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 260($sp) - j end_assign - not_is_Bool_or_Int: - # internal_126 = internal_137 + # internal_138 = internal_149 lw $t0, 216($sp) sw $t0, 260($sp) - end_assign: - # Jumping to endif_8743762757849 - j endif_8743762757849 + # Jumping to endif_8794497405727 + j endif_8794497405727 - else_8743762757849: + else_8794497405727: # Allocating String li $v0, 9 @@ -13811,73 +16376,104 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 7 + addi $t0, $zero, 16 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 110 - sb $t0, 8($v0) # internal_138[0] = 'n' + sb $t0, 8($v0) # internal_150[0] = 'n' addi $t0, $zero, 117 - sb $t0, 9($v0) # internal_138[1] = 'u' + sb $t0, 9($v0) # internal_150[1] = 'u' addi $t0, $zero, 109 - sb $t0, 10($v0) # internal_138[2] = 'm' + sb $t0, 10($v0) # internal_150[2] = 'm' addi $t0, $zero, 98 - sb $t0, 11($v0) # internal_138[3] = 'b' + sb $t0, 11($v0) # internal_150[3] = 'b' addi $t0, $zero, 101 - sb $t0, 12($v0) # internal_138[4] = 'e' + sb $t0, 12($v0) # internal_150[4] = 'e' addi $t0, $zero, 114 - sb $t0, 13($v0) # internal_138[5] = 'r' + sb $t0, 13($v0) # internal_150[5] = 'r' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_138[6] = ' ' + sb $t0, 14($v0) # internal_150[6] = ' ' sb $zero, 15($v0) # Null-terminator at the end of the string - sw $v0, 212($sp) # internal_138 = "number " + sw $v0, 212($sp) # internal_150 = "number " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 780($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_138 + # Argument internal_150 lw $t0, 224($sp) - sw $t0, 0($sp) # Storing internal_138 + sw $t0, 0($sp) # Storing internal_150 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 220($sp) # internal_139 = result of function_out_string_at_IO + sw $v1, 220($sp) # internal_151 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 204($sp) # internal_140 = avar + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497337817 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497337817 + j object_get_attribute_8794497337817 + int_get_attribute_8794497337817: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 204($sp) # internal_152 = self.avar + j end_get_attribute_8794497337817 + bool_get_attribute_8794497337817: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 204($sp) # internal_152 = self.avar + j end_get_attribute_8794497337817 + object_get_attribute_8794497337817: + sw $t1, 204($sp) # internal_152 = avar + end_get_attribute_8794497337817: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 780($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_140 + # Argument internal_152 lw $t0, 216($sp) - sw $t0, 0($sp) # Storing internal_140 + sw $t0, 0($sp) # Storing internal_152 # Calling function function_print_at_Main jal function_print_at_Main lw $ra, 8($sp) - sw $v1, 212($sp) # internal_141 = result of function_print_at_Main + sw $v1, 212($sp) # internal_153 = result of function_print_at_Main addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -13888,144 +16484,117 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 23 + addi $t0, $zero, 32 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 105 - sb $t0, 8($v0) # internal_142[0] = 'i' + sb $t0, 8($v0) # internal_154[0] = 'i' addi $t0, $zero, 115 - sb $t0, 9($v0) # internal_142[1] = 's' + sb $t0, 9($v0) # internal_154[1] = 's' addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_142[2] = ' ' + sb $t0, 10($v0) # internal_154[2] = ' ' addi $t0, $zero, 110 - sb $t0, 11($v0) # internal_142[3] = 'n' + sb $t0, 11($v0) # internal_154[3] = 'n' addi $t0, $zero, 111 - sb $t0, 12($v0) # internal_142[4] = 'o' + sb $t0, 12($v0) # internal_154[4] = 'o' addi $t0, $zero, 116 - sb $t0, 13($v0) # internal_142[5] = 't' + sb $t0, 13($v0) # internal_154[5] = 't' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_142[6] = ' ' + sb $t0, 14($v0) # internal_154[6] = ' ' addi $t0, $zero, 100 - sb $t0, 15($v0) # internal_142[7] = 'd' + sb $t0, 15($v0) # internal_154[7] = 'd' addi $t0, $zero, 105 - sb $t0, 16($v0) # internal_142[8] = 'i' + sb $t0, 16($v0) # internal_154[8] = 'i' addi $t0, $zero, 118 - sb $t0, 17($v0) # internal_142[9] = 'v' + sb $t0, 17($v0) # internal_154[9] = 'v' addi $t0, $zero, 105 - sb $t0, 18($v0) # internal_142[10] = 'i' + sb $t0, 18($v0) # internal_154[10] = 'i' addi $t0, $zero, 115 - sb $t0, 19($v0) # internal_142[11] = 's' + sb $t0, 19($v0) # internal_154[11] = 's' addi $t0, $zero, 105 - sb $t0, 20($v0) # internal_142[12] = 'i' + sb $t0, 20($v0) # internal_154[12] = 'i' addi $t0, $zero, 98 - sb $t0, 21($v0) # internal_142[13] = 'b' + sb $t0, 21($v0) # internal_154[13] = 'b' addi $t0, $zero, 108 - sb $t0, 22($v0) # internal_142[14] = 'l' + sb $t0, 22($v0) # internal_154[14] = 'l' addi $t0, $zero, 101 - sb $t0, 23($v0) # internal_142[15] = 'e' + sb $t0, 23($v0) # internal_154[15] = 'e' addi $t0, $zero, 32 - sb $t0, 24($v0) # internal_142[16] = ' ' + sb $t0, 24($v0) # internal_154[16] = ' ' addi $t0, $zero, 98 - sb $t0, 25($v0) # internal_142[17] = 'b' + sb $t0, 25($v0) # internal_154[17] = 'b' addi $t0, $zero, 121 - sb $t0, 26($v0) # internal_142[18] = 'y' + sb $t0, 26($v0) # internal_154[18] = 'y' addi $t0, $zero, 32 - sb $t0, 27($v0) # internal_142[19] = ' ' + sb $t0, 27($v0) # internal_154[19] = ' ' addi $t0, $zero, 51 - sb $t0, 28($v0) # internal_142[20] = '3' + sb $t0, 28($v0) # internal_154[20] = '3' addi $t0, $zero, 46 - sb $t0, 29($v0) # internal_142[21] = '.' + sb $t0, 29($v0) # internal_154[21] = '.' addi $t0, $zero, 10 - sb $t0, 30($v0) # internal_142[22] = '\n' + sb $t0, 30($v0) # internal_154[22] = '\n' sb $zero, 31($v0) # Null-terminator at the end of the string - sw $v0, 196($sp) # internal_142 = "is not divisible by 3.\n" + sw $v0, 196($sp) # internal_154 = "is not divisible by 3.\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 780($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_142 + # Argument internal_154 lw $t0, 208($sp) - sw $t0, 0($sp) # Storing internal_142 + sw $t0, 0($sp) # Storing internal_154 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 204($sp) # internal_143 = result of function_out_string_at_IO + sw $v1, 204($sp) # internal_155 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 192($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 260($sp) - j end_assign - not_is_Bool_or_Int: - # internal_126 = internal_143 + # internal_138 = internal_155 lw $t0, 192($sp) sw $t0, 260($sp) - end_assign: - # Jumping to endif_8743762757849 - j endif_8743762757849 + # Jumping to endif_8794497405727 + j endif_8794497405727 - endif_8743762757849: + endif_8794497405727: - lw $t0, 260($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 280($sp) - j end_assign - not_is_Bool_or_Int: - # internal_121 = internal_126 + # internal_133 = internal_138 lw $t0, 260($sp) sw $t0, 280($sp) - end_assign: - # Jumping to endif_8743762758946 - j endif_8743762758946 - - else_8743762758946: + # Jumping to endif_8794497406564 + j endif_8794497406564 + else_8794497406564: # Allocating Bool 0 li $v0, 9 @@ -14037,12 +16606,43 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 184($sp) # internal_145 = address of allocated object Int + sw $v0, 184($sp) # internal_157 = address of allocated object Int # Get attribute char of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'char' from the instance - sw $t1, 180($sp) # internal_146 = char + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497337941 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497337941 + j object_get_attribute_8794497337941 + int_get_attribute_8794497337941: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 180($sp) # internal_158 = self.char + j end_get_attribute_8794497337941 + bool_get_attribute_8794497337941: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 180($sp) # internal_158 = self.char + j end_get_attribute_8794497337941 + object_get_attribute_8794497337941: + sw $t1, 180($sp) # internal_158 = char + end_get_attribute_8794497337941: # Allocating String li $v0, 9 @@ -14052,61 +16652,51 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 104 - sb $t0, 8($v0) # internal_147[0] = 'h' + sb $t0, 8($v0) # internal_159[0] = 'h' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 176($sp) # internal_147 = "h" + sw $v0, 176($sp) # internal_159 = "h" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_146 + # Argument internal_158 lw $t0, 192($sp) - sw $t0, 4($sp) # Storing internal_146 + sw $t0, 4($sp) # Storing internal_158 - # Argument internal_147 + # Argument internal_159 lw $t0, 188($sp) - sw $t0, 0($sp) # Storing internal_147 + sw $t0, 0($sp) # Storing internal_159 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 184($sp) # internal_148 = result of function_equal + sw $v1, 184($sp) # internal_160 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 172($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 184($sp) - j end_assign - not_is_Bool_or_Int: - # internal_145 = internal_148 + # internal_157 = internal_160 lw $t0, 172($sp) sw $t0, 184($sp) - end_assign: - # If internal_145 then goto then_8743762758940 + # If internal_157 then goto then_8794497406558 lw $t0, 184($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762758940 + beq $t0, $t1, then_8794497406558 - # Jumping to else_8743762758940 - j else_8743762758940 + # Jumping to else_8794497406558 + j else_8794497406558 - then_8743762758940: + then_8794497406558: + + # Allocating NUll to x + sw $zero, 168($sp) # x = 0 # Allocating E li $v0, 9 @@ -14115,93 +16705,156 @@ la $t0, type_E # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 164($sp) # internal_150 = address of allocated object E + sw $v0, 164($sp) # internal_162 = address of allocated object E # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_150 + # Argument internal_162 lw $t0, 172($sp) - sw $t0, 0($sp) # Storing internal_150 + sw $t0, 0($sp) # Storing internal_162 # Calling function function___init___at_E jal function___init___at_E lw $ra, 4($sp) - sw $v1, 172($sp) # internal_150 = result of function___init___at_E + sw $v1, 172($sp) # internal_162 = result of function___init___at_E addi $sp, $sp, 8 # Freeing space for arguments # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 160($sp) # internal_151 = avar + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497338119 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497338119 + j object_get_attribute_8794497338119 + int_get_attribute_8794497338119: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 160($sp) # internal_163 = self.avar + j end_get_attribute_8794497338119 + bool_get_attribute_8794497338119: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 160($sp) # internal_163 = self.avar + j end_get_attribute_8794497338119 + object_get_attribute_8794497338119: + sw $t1, 160($sp) # internal_163 = avar + end_get_attribute_8794497338119: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_151 + # Argument internal_163 lw $t0, 168($sp) - sw $t0, 0($sp) # Storing internal_151 + sw $t0, 0($sp) # Storing internal_163 # Calling function function_value_at_A jal function_value_at_A lw $ra, 4($sp) - sw $v1, 164($sp) # internal_152 = result of function_value_at_A + sw $v1, 164($sp) # internal_164 = result of function_value_at_A addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_150 + # Argument internal_162 lw $t0, 176($sp) - sw $t0, 4($sp) # Storing internal_150 + sw $t0, 4($sp) # Storing internal_162 - # Argument internal_152 + # Argument internal_164 lw $t0, 168($sp) - sw $t0, 0($sp) # Storing internal_152 + sw $t0, 0($sp) # Storing internal_164 # Calling function function_method6_at_E jal function_method6_at_E lw $ra, 8($sp) - sw $v1, 164($sp) # internal_153 = result of function_method6_at_E + sw $v1, 164($sp) # internal_165 = result of function_method6_at_E addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 152($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 168($sp) - j end_assign - not_is_Bool_or_Int: - # x = internal_153 - lw $t0, 152($sp) - sw $t0, 168($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 180($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_165 + lw $t0, 164($sp) + sw $t0, 0($sp) # Storing internal_165 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 180($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 144($sp) # internal_155 = avar + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497338209 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497338209 + j object_get_attribute_8794497338209 + int_get_attribute_8794497338209: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 144($sp) # internal_167 = self.avar + j end_get_attribute_8794497338209 + bool_get_attribute_8794497338209: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 144($sp) # internal_167 = self.avar + j end_get_attribute_8794497338209 + object_get_attribute_8794497338209: + sw $t1, 144($sp) # internal_167 = avar + end_get_attribute_8794497338209: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_155 + # Argument internal_167 lw $t0, 152($sp) - sw $t0, 0($sp) # Storing internal_155 + sw $t0, 0($sp) # Storing internal_167 # Calling function function_value_at_A jal function_value_at_A lw $ra, 4($sp) - sw $v1, 148($sp) # internal_156 = result of function_value_at_A + sw $v1, 148($sp) # internal_168 = result of function_value_at_A addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments @@ -14215,7 +16868,7 @@ # Calling function function_value_at_A jal function_value_at_A lw $ra, 4($sp) - sw $v1, 144($sp) # internal_157 = result of function_value_at_A + sw $v1, 144($sp) # internal_169 = result of function_value_at_A addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 8 @@ -14228,60 +16881,61 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 8 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 132($sp) # internal_158 = address of allocated object Int + sw $v0, 132($sp) # internal_170 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_157 + # Argument internal_169 lw $t0, 148($sp) - sw $t0, 4($sp) # Storing internal_157 + sw $t0, 4($sp) # Storing internal_169 - # Argument internal_158 + # Argument internal_170 lw $t0, 144($sp) - sw $t0, 0($sp) # Storing internal_158 + sw $t0, 0($sp) # Storing internal_170 # Calling function function_mult jal function_mult lw $ra, 8($sp) - sw $v1, 140($sp) # internal_159 = result of function_mult + sw $v1, 140($sp) # internal_171 = result of function_mult addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_156 + # Argument internal_168 lw $t0, 152($sp) - sw $t0, 4($sp) # Storing internal_156 + sw $t0, 4($sp) # Storing internal_168 - # Argument internal_159 + # Argument internal_171 lw $t0, 140($sp) - sw $t0, 0($sp) # Storing internal_159 + sw $t0, 0($sp) # Storing internal_171 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 136($sp) # internal_160 = result of function_sub + sw $v1, 136($sp) # internal_172 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 124($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 148($sp) - j end_assign - not_is_Bool_or_Int: - # r = internal_160 - lw $t0, 124($sp) - sw $t0, 148($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument r + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing r + + # Argument internal_172 + lw $t0, 136($sp) + sw $t0, 0($sp) # Storing internal_172 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 160($sp) # r = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating String li $v0, 9 @@ -14291,73 +16945,104 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 7 + addi $t0, $zero, 16 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 110 - sb $t0, 8($v0) # internal_161[0] = 'n' + sb $t0, 8($v0) # internal_173[0] = 'n' addi $t0, $zero, 117 - sb $t0, 9($v0) # internal_161[1] = 'u' + sb $t0, 9($v0) # internal_173[1] = 'u' addi $t0, $zero, 109 - sb $t0, 10($v0) # internal_161[2] = 'm' + sb $t0, 10($v0) # internal_173[2] = 'm' addi $t0, $zero, 98 - sb $t0, 11($v0) # internal_161[3] = 'b' + sb $t0, 11($v0) # internal_173[3] = 'b' addi $t0, $zero, 101 - sb $t0, 12($v0) # internal_161[4] = 'e' + sb $t0, 12($v0) # internal_173[4] = 'e' addi $t0, $zero, 114 - sb $t0, 13($v0) # internal_161[5] = 'r' + sb $t0, 13($v0) # internal_173[5] = 'r' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_161[6] = ' ' + sb $t0, 14($v0) # internal_173[6] = ' ' sb $zero, 15($v0) # Null-terminator at the end of the string - sw $v0, 120($sp) # internal_161 = "number " + sw $v0, 120($sp) # internal_173 = "number " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 780($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_161 + # Argument internal_173 lw $t0, 132($sp) - sw $t0, 0($sp) # Storing internal_161 + sw $t0, 0($sp) # Storing internal_173 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 128($sp) # internal_162 = result of function_out_string_at_IO + sw $v1, 128($sp) # internal_174 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 112($sp) # internal_163 = avar + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497338640 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497338640 + j object_get_attribute_8794497338640 + int_get_attribute_8794497338640: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 112($sp) # internal_175 = self.avar + j end_get_attribute_8794497338640 + bool_get_attribute_8794497338640: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 112($sp) # internal_175 = self.avar + j end_get_attribute_8794497338640 + object_get_attribute_8794497338640: + sw $t1, 112($sp) # internal_175 = avar + end_get_attribute_8794497338640: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 780($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_163 + # Argument internal_175 lw $t0, 124($sp) - sw $t0, 0($sp) # Storing internal_163 + sw $t0, 0($sp) # Storing internal_175 # Calling function function_print_at_Main jal function_print_at_Main lw $ra, 8($sp) - sw $v1, 120($sp) # internal_164 = result of function_print_at_Main + sw $v1, 120($sp) # internal_176 = result of function_print_at_Main addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -14368,65 +17053,65 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 12 + addi $t0, $zero, 21 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 105 - sb $t0, 8($v0) # internal_165[0] = 'i' + sb $t0, 8($v0) # internal_177[0] = 'i' addi $t0, $zero, 115 - sb $t0, 9($v0) # internal_165[1] = 's' + sb $t0, 9($v0) # internal_177[1] = 's' addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_165[2] = ' ' + sb $t0, 10($v0) # internal_177[2] = ' ' addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_165[3] = 'e' + sb $t0, 11($v0) # internal_177[3] = 'e' addi $t0, $zero, 113 - sb $t0, 12($v0) # internal_165[4] = 'q' + sb $t0, 12($v0) # internal_177[4] = 'q' addi $t0, $zero, 117 - sb $t0, 13($v0) # internal_165[5] = 'u' + sb $t0, 13($v0) # internal_177[5] = 'u' addi $t0, $zero, 97 - sb $t0, 14($v0) # internal_165[6] = 'a' + sb $t0, 14($v0) # internal_177[6] = 'a' addi $t0, $zero, 108 - sb $t0, 15($v0) # internal_165[7] = 'l' + sb $t0, 15($v0) # internal_177[7] = 'l' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_165[8] = ' ' + sb $t0, 16($v0) # internal_177[8] = ' ' addi $t0, $zero, 116 - sb $t0, 17($v0) # internal_165[9] = 't' + sb $t0, 17($v0) # internal_177[9] = 't' addi $t0, $zero, 111 - sb $t0, 18($v0) # internal_165[10] = 'o' + sb $t0, 18($v0) # internal_177[10] = 'o' addi $t0, $zero, 32 - sb $t0, 19($v0) # internal_165[11] = ' ' + sb $t0, 19($v0) # internal_177[11] = ' ' sb $zero, 20($v0) # Null-terminator at the end of the string - sw $v0, 104($sp) # internal_165 = "is equal to " + sw $v0, 104($sp) # internal_177 = "is equal to " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 780($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_165 + # Argument internal_177 lw $t0, 116($sp) - sw $t0, 0($sp) # Storing internal_165 + sw $t0, 0($sp) # Storing internal_177 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 112($sp) # internal_166 = result of function_out_string_at_IO + sw $v1, 112($sp) # internal_178 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -14434,7 +17119,7 @@ sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 780($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self # Argument x @@ -14444,7 +17129,7 @@ # Calling function function_print_at_Main jal function_print_at_Main lw $ra, 8($sp) - sw $v1, 108($sp) # internal_167 = result of function_print_at_Main + sw $v1, 108($sp) # internal_179 = result of function_print_at_Main addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -14455,113 +17140,113 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 28 + addi $t0, $zero, 37 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 116 - sb $t0, 8($v0) # internal_168[0] = 't' + sb $t0, 8($v0) # internal_180[0] = 't' addi $t0, $zero, 105 - sb $t0, 9($v0) # internal_168[1] = 'i' + sb $t0, 9($v0) # internal_180[1] = 'i' addi $t0, $zero, 109 - sb $t0, 10($v0) # internal_168[2] = 'm' + sb $t0, 10($v0) # internal_180[2] = 'm' addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_168[3] = 'e' + sb $t0, 11($v0) # internal_180[3] = 'e' addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_168[4] = 's' + sb $t0, 12($v0) # internal_180[4] = 's' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_168[5] = ' ' + sb $t0, 13($v0) # internal_180[5] = ' ' addi $t0, $zero, 56 - sb $t0, 14($v0) # internal_168[6] = '8' + sb $t0, 14($v0) # internal_180[6] = '8' addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_168[7] = ' ' + sb $t0, 15($v0) # internal_180[7] = ' ' addi $t0, $zero, 119 - sb $t0, 16($v0) # internal_168[8] = 'w' + sb $t0, 16($v0) # internal_180[8] = 'w' addi $t0, $zero, 105 - sb $t0, 17($v0) # internal_168[9] = 'i' + sb $t0, 17($v0) # internal_180[9] = 'i' addi $t0, $zero, 116 - sb $t0, 18($v0) # internal_168[10] = 't' + sb $t0, 18($v0) # internal_180[10] = 't' addi $t0, $zero, 104 - sb $t0, 19($v0) # internal_168[11] = 'h' + sb $t0, 19($v0) # internal_180[11] = 'h' addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_168[12] = ' ' + sb $t0, 20($v0) # internal_180[12] = ' ' addi $t0, $zero, 97 - sb $t0, 21($v0) # internal_168[13] = 'a' + sb $t0, 21($v0) # internal_180[13] = 'a' addi $t0, $zero, 32 - sb $t0, 22($v0) # internal_168[14] = ' ' + sb $t0, 22($v0) # internal_180[14] = ' ' addi $t0, $zero, 114 - sb $t0, 23($v0) # internal_168[15] = 'r' + sb $t0, 23($v0) # internal_180[15] = 'r' addi $t0, $zero, 101 - sb $t0, 24($v0) # internal_168[16] = 'e' + sb $t0, 24($v0) # internal_180[16] = 'e' addi $t0, $zero, 109 - sb $t0, 25($v0) # internal_168[17] = 'm' + sb $t0, 25($v0) # internal_180[17] = 'm' addi $t0, $zero, 97 - sb $t0, 26($v0) # internal_168[18] = 'a' + sb $t0, 26($v0) # internal_180[18] = 'a' addi $t0, $zero, 105 - sb $t0, 27($v0) # internal_168[19] = 'i' + sb $t0, 27($v0) # internal_180[19] = 'i' addi $t0, $zero, 110 - sb $t0, 28($v0) # internal_168[20] = 'n' + sb $t0, 28($v0) # internal_180[20] = 'n' addi $t0, $zero, 100 - sb $t0, 29($v0) # internal_168[21] = 'd' + sb $t0, 29($v0) # internal_180[21] = 'd' addi $t0, $zero, 101 - sb $t0, 30($v0) # internal_168[22] = 'e' + sb $t0, 30($v0) # internal_180[22] = 'e' addi $t0, $zero, 114 - sb $t0, 31($v0) # internal_168[23] = 'r' + sb $t0, 31($v0) # internal_180[23] = 'r' addi $t0, $zero, 32 - sb $t0, 32($v0) # internal_168[24] = ' ' + sb $t0, 32($v0) # internal_180[24] = ' ' addi $t0, $zero, 111 - sb $t0, 33($v0) # internal_168[25] = 'o' + sb $t0, 33($v0) # internal_180[25] = 'o' addi $t0, $zero, 102 - sb $t0, 34($v0) # internal_168[26] = 'f' + sb $t0, 34($v0) # internal_180[26] = 'f' addi $t0, $zero, 32 - sb $t0, 35($v0) # internal_168[27] = ' ' + sb $t0, 35($v0) # internal_180[27] = ' ' sb $zero, 36($v0) # Null-terminator at the end of the string - sw $v0, 92($sp) # internal_168 = "times 8 with a remainder of " + sw $v0, 92($sp) # internal_180 = "times 8 with a remainder of " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 780($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_168 + # Argument internal_180 lw $t0, 104($sp) - sw $t0, 0($sp) # Storing internal_168 + sw $t0, 0($sp) # Storing internal_180 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 100($sp) # internal_169 = result of function_out_string_at_IO + sw $v1, 100($sp) # internal_181 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Allocating A2I @@ -14571,38 +17256,39 @@ la $t0, type_A2I # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 80($sp) # internal_171 = address of allocated object A2I + sw $v0, 80($sp) # internal_183 = address of allocated object A2I # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_171 + # Argument internal_183 lw $t0, 88($sp) - sw $t0, 0($sp) # Storing internal_171 + sw $t0, 0($sp) # Storing internal_183 # Calling function function___init___at_A2I jal function___init___at_A2I lw $ra, 4($sp) - sw $v1, 88($sp) # internal_171 = result of function___init___at_A2I + sw $v1, 88($sp) # internal_183 = result of function___init___at_A2I addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 80($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 476($sp) - j end_assign - not_is_Bool_or_Int: - # a = internal_171 - lw $t0, 80($sp) - sw $t0, 476($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument a + lw $t0, 488($sp) + sw $t0, 4($sp) # Storing a + + # Argument internal_183 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_183 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 488($sp) # a = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -14619,7 +17305,7 @@ # Calling function function_i2a_at_A2I jal function_i2a_at_A2I lw $ra, 8($sp) - sw $v1, 88($sp) # internal_172 = result of function_i2a_at_A2I + sw $v1, 88($sp) # internal_184 = result of function_i2a_at_A2I addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -14627,17 +17313,17 @@ sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 780($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_172 + # Argument internal_184 lw $t0, 88($sp) - sw $t0, 0($sp) # Storing internal_172 + sw $t0, 0($sp) # Storing internal_184 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 84($sp) # internal_173 = result of function_out_string_at_IO + sw $v1, 84($sp) # internal_185 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -14648,61 +17334,79 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_174[0] = '\n' + sb $t0, 8($v0) # internal_186[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 68($sp) # internal_174 = "\n" + sw $v0, 68($sp) # internal_186 = "\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 780($sp) + lw $t0, 828($sp) sw $t0, 4($sp) # Storing self - # Argument internal_174 + # Argument internal_186 lw $t0, 80($sp) - sw $t0, 0($sp) # Storing internal_174 + sw $t0, 0($sp) # Storing internal_186 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 76($sp) # internal_175 = result of function_out_string_at_IO + sw $v1, 76($sp) # internal_187 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Set attribute avar of self - lw $t0, 768($sp) # $t0 = self + lw $t0, 816($sp) # $t0 = self lw $t1, 168($sp) # $t1 = x + beq $t1, $zero, object_set_attribute_8794497338299 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794497338299 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794497338299 + j object_set_attribute_8794497338299 + int_set_attribute_8794497338299: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = x + j end_set_attribute_8794497338299 + bool_set_attribute_8794497338299: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = x + j end_set_attribute_8794497338299 + object_set_attribute_8794497338299: sw $t1, 12($t0) # self.avar = x + end_set_attribute_8794497338299: - lw $t0, 168($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 188($sp) - j end_assign - not_is_Bool_or_Int: - # internal_144 = x + # internal_156 = x lw $t0, 168($sp) sw $t0, 188($sp) - end_assign: - # Jumping to endif_8743762758940 - j endif_8743762758940 - - else_8743762758940: + # Jumping to endif_8794497406558 + j endif_8794497406558 + else_8794497406558: # Allocating Bool 0 li $v0, 9 @@ -14714,12 +17418,43 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 56($sp) # internal_177 = address of allocated object Int + sw $v0, 56($sp) # internal_189 = address of allocated object Int # Get attribute char of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'char' from the instance - sw $t1, 52($sp) # internal_178 = char + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497339182 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497339182 + j object_get_attribute_8794497339182 + int_get_attribute_8794497339182: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 52($sp) # internal_190 = self.char + j end_get_attribute_8794497339182 + bool_get_attribute_8794497339182: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 52($sp) # internal_190 = self.char + j end_get_attribute_8794497339182 + object_get_attribute_8794497339182: + sw $t1, 52($sp) # internal_190 = char + end_get_attribute_8794497339182: # Allocating String li $v0, 9 @@ -14729,61 +17464,48 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 106 - sb $t0, 8($v0) # internal_179[0] = 'j' + sb $t0, 8($v0) # internal_191[0] = 'j' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 48($sp) # internal_179 = "j" + sw $v0, 48($sp) # internal_191 = "j" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_178 + # Argument internal_190 lw $t0, 64($sp) - sw $t0, 4($sp) # Storing internal_178 + sw $t0, 4($sp) # Storing internal_190 - # Argument internal_179 + # Argument internal_191 lw $t0, 60($sp) - sw $t0, 0($sp) # Storing internal_179 + sw $t0, 0($sp) # Storing internal_191 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 56($sp) # internal_180 = result of function_equal + sw $v1, 56($sp) # internal_192 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 44($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 56($sp) - j end_assign - not_is_Bool_or_Int: - # internal_177 = internal_180 + # internal_189 = internal_192 lw $t0, 44($sp) sw $t0, 56($sp) - end_assign: - # If internal_177 then goto then_8743762758934 + # If internal_189 then goto then_8794497406552 lw $t0, 56($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762758934 + beq $t0, $t1, then_8794497406552 - # Jumping to else_8743762758934 - j else_8743762758934 + # Jumping to else_8794497406552 + j else_8794497406552 - then_8743762758934: + then_8794497406552: # Allocating A li $v0, 9 @@ -14792,49 +17514,67 @@ la $t0, type_A # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 40($sp) # internal_181 = address of allocated object A + sw $v0, 40($sp) # internal_193 = address of allocated object A # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_181 + # Argument internal_193 lw $t0, 48($sp) - sw $t0, 0($sp) # Storing internal_181 + sw $t0, 0($sp) # Storing internal_193 # Calling function function___init___at_A jal function___init___at_A lw $ra, 4($sp) - sw $v1, 48($sp) # internal_181 = result of function___init___at_A + sw $v1, 48($sp) # internal_193 = result of function___init___at_A addi $sp, $sp, 8 # Freeing space for arguments # Set attribute avar of self - lw $t0, 768($sp) # $t0 = self - lw $t1, 40($sp) # $t1 = internal_181 - sw $t1, 12($t0) # self.avar = internal_181 - - lw $t0, 40($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: - # internal_176 = internal_181 + lw $t0, 816($sp) # $t0 = self + lw $t1, 40($sp) # $t1 = internal_193 + beq $t1, $zero, object_set_attribute_8794497339248 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794497339248 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794497339248 + j object_set_attribute_8794497339248 + int_set_attribute_8794497339248: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_193 + j end_set_attribute_8794497339248 + bool_set_attribute_8794497339248: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_193 + j end_set_attribute_8794497339248 + object_set_attribute_8794497339248: + sw $t1, 12($t0) # self.avar = internal_193 + end_set_attribute_8794497339248: + + # internal_188 = internal_193 lw $t0, 40($sp) sw $t0, 60($sp) - end_assign: - - # Jumping to endif_8743762758934 - j endif_8743762758934 - else_8743762758934: + # Jumping to endif_8794497406552 + j endif_8794497406552 + else_8794497406552: # Allocating Bool 0 li $v0, 9 @@ -14846,12 +17586,43 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_183 = address of allocated object Int + sw $v0, 32($sp) # internal_195 = address of allocated object Int # Get attribute char of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'char' from the instance - sw $t1, 28($sp) # internal_184 = char + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497339350 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497339350 + j object_get_attribute_8794497339350 + int_get_attribute_8794497339350: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_196 = self.char + j end_get_attribute_8794497339350 + bool_get_attribute_8794497339350: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_196 = self.char + j end_get_attribute_8794497339350 + object_get_attribute_8794497339350: + sw $t1, 28($sp) # internal_196 = char + end_get_attribute_8794497339350: # Allocating String li $v0, 9 @@ -14861,61 +17632,48 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 113 - sb $t0, 8($v0) # internal_185[0] = 'q' + sb $t0, 8($v0) # internal_197[0] = 'q' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 24($sp) # internal_185 = "q" + sw $v0, 24($sp) # internal_197 = "q" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_184 + # Argument internal_196 lw $t0, 40($sp) - sw $t0, 4($sp) # Storing internal_184 + sw $t0, 4($sp) # Storing internal_196 - # Argument internal_185 + # Argument internal_197 lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_185 + sw $t0, 0($sp) # Storing internal_197 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 32($sp) # internal_186 = result of function_equal + sw $v1, 32($sp) # internal_198 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 20($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 32($sp) - j end_assign - not_is_Bool_or_Int: - # internal_183 = internal_186 + # internal_195 = internal_198 lw $t0, 20($sp) sw $t0, 32($sp) - end_assign: - # If internal_183 then goto then_8743762758394 + # If internal_195 then goto then_8794497406528 lw $t0, 32($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8743762758394 + beq $t0, $t1, then_8794497406528 - # Jumping to else_8743762758394 - j else_8743762758394 + # Jumping to else_8794497406528 + j else_8794497406528 - then_8743762758394: + then_8794497406528: # Allocating Bool 0 li $v0, 9 @@ -14927,34 +17685,53 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_187 = address of allocated object Int + sw $v0, 16($sp) # internal_199 = address of allocated object Int # Set attribute flag of self - lw $t0, 768($sp) # $t0 = self - lw $t1, 16($sp) # $t1 = internal_187 - sw $t1, 20($t0) # self.flag = internal_187 - - lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 36($sp) - j end_assign - not_is_Bool_or_Int: - # internal_182 = internal_187 + lw $t0, 816($sp) # $t0 = self + lw $t1, 16($sp) # $t1 = internal_199 + beq $t1, $zero, object_set_attribute_8794497339932 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794497339932 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794497339932 + j object_set_attribute_8794497339932 + int_set_attribute_8794497339932: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.flag = internal_199 + j end_set_attribute_8794497339932 + bool_set_attribute_8794497339932: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.flag = internal_199 + j end_set_attribute_8794497339932 + object_set_attribute_8794497339932: + sw $t1, 20($t0) # self.flag = internal_199 + end_set_attribute_8794497339932: + + # internal_194 = internal_199 lw $t0, 16($sp) sw $t0, 36($sp) - end_assign: - # Jumping to endif_8743762758394 - j endif_8743762758394 + # Jumping to endif_8794497406528 + j endif_8794497406528 - else_8743762758394: + else_8794497406528: # Allocating A li $v0, 9 @@ -14963,294 +17740,227 @@ la $t0, type_A # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 12($sp) # internal_188 = address of allocated object A + sw $v0, 12($sp) # internal_200 = address of allocated object A # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_188 + # Argument internal_200 lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_188 + sw $t0, 0($sp) # Storing internal_200 # Calling function function___init___at_A jal function___init___at_A lw $ra, 4($sp) - sw $v1, 20($sp) # internal_188 = result of function___init___at_A + sw $v1, 20($sp) # internal_200 = result of function___init___at_A addi $sp, $sp, 8 # Freeing space for arguments # Get attribute avar of self - lw $t0, 768($sp) # Get the address of self + lw $t0, 816($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'avar' from the instance - sw $t1, 8($sp) # internal_189 = avar + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794497340037 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794497340037 + j object_get_attribute_8794497340037 + int_get_attribute_8794497340037: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_201 = self.avar + j end_get_attribute_8794497340037 + bool_get_attribute_8794497340037: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_201 = self.avar + j end_get_attribute_8794497340037 + object_get_attribute_8794497340037: + sw $t1, 8($sp) # internal_201 = avar + end_get_attribute_8794497340037: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_189 + # Argument internal_201 lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_189 + sw $t0, 0($sp) # Storing internal_201 # Calling function function_value_at_A jal function_value_at_A lw $ra, 4($sp) - sw $v1, 12($sp) # internal_190 = result of function_value_at_A + sw $v1, 12($sp) # internal_202 = result of function_value_at_A addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_188 + # Argument internal_200 lw $t0, 24($sp) - sw $t0, 4($sp) # Storing internal_188 + sw $t0, 4($sp) # Storing internal_200 - # Argument internal_190 + # Argument internal_202 lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_190 + sw $t0, 0($sp) # Storing internal_202 # Calling function function_method1_at_A jal function_method1_at_A lw $ra, 8($sp) - sw $v1, 12($sp) # internal_191 = result of function_method1_at_A + sw $v1, 12($sp) # internal_203 = result of function_method1_at_A addi $sp, $sp, 12 # Freeing space for arguments # Set attribute avar of self - lw $t0, 768($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_191 - sw $t1, 12($t0) # self.avar = internal_191 - - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 36($sp) - j end_assign - not_is_Bool_or_Int: - # internal_182 = internal_191 + lw $t0, 816($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_203 + beq $t1, $zero, object_set_attribute_8794497339974 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794497339974 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794497339974 + j object_set_attribute_8794497339974 + int_set_attribute_8794497339974: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_203 + j end_set_attribute_8794497339974 + bool_set_attribute_8794497339974: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_203 + j end_set_attribute_8794497339974 + object_set_attribute_8794497339974: + sw $t1, 12($t0) # self.avar = internal_203 + end_set_attribute_8794497339974: + + # internal_194 = internal_203 lw $t0, 0($sp) sw $t0, 36($sp) - end_assign: - # Jumping to endif_8743762758394 - j endif_8743762758394 + # Jumping to endif_8794497406528 + j endif_8794497406528 - endif_8743762758394: + endif_8794497406528: - lw $t0, 36($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: - # internal_176 = internal_182 + # internal_188 = internal_194 lw $t0, 36($sp) sw $t0, 60($sp) - end_assign: - # Jumping to endif_8743762758934 - j endif_8743762758934 + # Jumping to endif_8794497406552 + j endif_8794497406552 - endif_8743762758934: + endif_8794497406552: - lw $t0, 60($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 188($sp) - j end_assign - not_is_Bool_or_Int: - # internal_144 = internal_176 + # internal_156 = internal_188 lw $t0, 60($sp) sw $t0, 188($sp) - end_assign: - # Jumping to endif_8743762758940 - j endif_8743762758940 + # Jumping to endif_8794497406558 + j endif_8794497406558 - endif_8743762758940: + endif_8794497406558: - lw $t0, 188($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 280($sp) - j end_assign - not_is_Bool_or_Int: - # internal_121 = internal_144 + # internal_133 = internal_156 lw $t0, 188($sp) sw $t0, 280($sp) - end_assign: - # Jumping to endif_8743762758946 - j endif_8743762758946 + # Jumping to endif_8794497406564 + j endif_8794497406564 - endif_8743762758946: + endif_8794497406564: - lw $t0, 280($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 316($sp) - j end_assign - not_is_Bool_or_Int: - # internal_112 = internal_121 + # internal_124 = internal_133 lw $t0, 280($sp) sw $t0, 316($sp) - end_assign: - # Jumping to endif_8743762758952 - j endif_8743762758952 + # Jumping to endif_8794497406570 + j endif_8794497406570 - endif_8743762758952: + endif_8794497406570: - lw $t0, 316($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 352($sp) - j end_assign - not_is_Bool_or_Int: - # internal_103 = internal_112 + # internal_115 = internal_124 lw $t0, 316($sp) sw $t0, 352($sp) - end_assign: - # Jumping to endif_8743762758958 - j endif_8743762758958 + # Jumping to endif_8794497406576 + j endif_8794497406576 - endif_8743762758958: + endif_8794497406576: - lw $t0, 352($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 388($sp) - j end_assign - not_is_Bool_or_Int: - # internal_94 = internal_103 + # internal_106 = internal_115 lw $t0, 352($sp) sw $t0, 388($sp) - end_assign: - # Jumping to endif_8743762758964 - j endif_8743762758964 + # Jumping to endif_8794497406582 + j endif_8794497406582 - endif_8743762758964: + endif_8794497406582: - lw $t0, 388($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 444($sp) - j end_assign - not_is_Bool_or_Int: - # internal_80 = internal_94 + # internal_92 = internal_106 lw $t0, 388($sp) sw $t0, 444($sp) - end_assign: - # Jumping to endif_8743762758970 - j endif_8743762758970 + # Jumping to endif_8794497406588 + j endif_8794497406588 - endif_8743762758970: + endif_8794497406588: + # internal_32 = internal_92 lw $t0, 444($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 632($sp) - j end_assign - not_is_Bool_or_Int: - # internal_33 = internal_80 - lw $t0, 444($sp) - sw $t0, 632($sp) - end_assign: + sw $t0, 684($sp) - # Jumping to endif_8743762758976 - j endif_8743762758976 + # Jumping to endif_8794497406594 + j endif_8794497406594 - endif_8743762758976: + endif_8794497406594: - lw $t0, 632($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 688($sp) - j end_assign - not_is_Bool_or_Int: - # internal_19 = internal_33 - lw $t0, 632($sp) - sw $t0, 688($sp) - end_assign: + # internal_18 = internal_32 + lw $t0, 684($sp) + sw $t0, 740($sp) - # Jumping to endif_8743762758982 - j endif_8743762758982 + # Jumping to endif_8794497406600 + j endif_8794497406600 - endif_8743762758982: + endif_8794497406600: - # Jumping to while_start_8743762758997 - j while_start_8743762758997 + # Jumping to while_start_8794497406615 + j while_start_8794497406615 - while_end_8743762758997: + while_end_8794497406615: # Loading return value in $v1 addi $v1, $zero, 0 # Freeing space for local variables - addi $sp, $sp, 768 + addi $sp, $sp, 816 jr $ra diff --git a/tests/codegen/atoi.mips b/tests/codegen/atoi.mips index dcebf84f1..b1f88f98b 100644 --- a/tests/codegen/atoi.mips +++ b/tests/codegen/atoi.mips @@ -4,42 +4,49 @@ type_Object_attributes: .word 0 type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" + type_Object_abort_message: .asciiz "Abort called from class Object\n" type_IO: .word 8 type_IO_inherits_from: .word type_Object type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" + type_IO_abort_message: .asciiz "Abort called from class IO\n" type_Int: .word 8 type_Int_inherits_from: .word type_Object type_Int_attributes: .word 0 type_Int_name_size: .word 3 type_Int_name: .asciiz "Int" + type_Int_abort_message: .asciiz "Abort called from class Int\n" type_String: .word 8 type_String_inherits_from: .word type_Object type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" + type_String_abort_message: .asciiz "Abort called from class String\n" type_Bool: .word 8 type_Bool_inherits_from: .word type_Object type_Bool_attributes: .word 0 type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" + type_Bool_abort_message: .asciiz "Abort called from class Bool\n" type_A2I: .word 8 type_A2I_inherits_from: .word type_Object type_A2I_attributes: .word 0 type_A2I_name_size: .word 3 type_A2I_name: .asciiz "A2I" + type_A2I_abort_message: .asciiz "Abort called from class A2I\n" type_Main: .word 8 type_Main_inherits_from: .word type_IO type_Main_attributes: .word 0 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" + type_Main_abort_message: .asciiz "Abort called from class Main\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -322,12 +329,12 @@ function_equal: # Function parameters - # $ra = 40($sp) - # a = 36($sp) - # b = 32($sp) + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) # Reserving space for local variables - addi $sp, $sp, -32 + addi $sp, $sp, -40 # Allocating Bool 0 li $v0, 9 @@ -339,22 +346,57 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_0 = address of allocated object Int + sw $v0, 36($sp) # internal_0 = address of allocated object Int - # internal_1 = typeof a that is the first word of the object - lw $t0, 36($sp) - lw $t1, 0($t0) - sw $t1, 24($sp) + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int - # internal_2 = direction of Int + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int la $t0, type_Int sw $t0, 20($sp) - # internal_3 = direction of Bool + # internal_5 = direction of Bool la $t0, type_Bool sw $t0, 16($sp) - # internal_4 = direction of String + # internal_6 = direction of String la $t0, type_String sw $t0, 12($sp) @@ -368,7 +410,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_5 = address of allocated object Int + sw $v0, 8($sp) # internal_7 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -380,7 +422,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_6 = address of allocated object Int + sw $v0, 4($sp) # internal_8 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -392,42 +434,42 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_7 = address of allocated object Int + sw $v0, 0($sp) # internal_9 = address of allocated object Int - # internal_5 = EqualAddress(internal_1, internal_2) + # internal_7 = EqualAddress(internal_3, internal_4) lw $t0, 24($sp) lw $t1, 20($sp) seq $t2, $t0, $t1 lw $t0, 8($sp) sw $t2, 8($t0) - # internal_6 = EqualAddress(internal_1, internal_3) + # internal_8 = EqualAddress(internal_3, internal_5) lw $t0, 24($sp) lw $t1, 16($sp) seq $t2, $t0, $t1 lw $t0, 4($sp) sw $t2, 8($t0) - # internal_7 = EqualAddress(internal_1, internal_4) + # internal_9 = EqualAddress(internal_3, internal_6) lw $t0, 24($sp) lw $t1, 12($sp) seq $t2, $t0, $t1 lw $t0, 0($sp) sw $t2, 8($t0) - # If internal_5 then goto a_is_type_int_or_bool + # If internal_7 then goto a_is_type_int_or_bool lw $t0, 8($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison beq $t0, $t1, a_is_type_int_or_bool - # If internal_6 then goto a_is_type_int_or_bool + # If internal_8 then goto a_is_type_int_or_bool lw $t0, 4($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison beq $t0, $t1, a_is_type_int_or_bool - # If internal_7 then goto a_is_type_string + # If internal_9 then goto a_is_type_string lw $t0, 0($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison @@ -439,12 +481,12 @@ a_is_type_int_or_bool: # internal_0 = EqualInt(a, b) - lw $t0, 36($sp) + lw $t0, 44($sp) lw $t0, 8($t0) - lw $t1, 32($sp) + lw $t1, 40($sp) lw $t1, 8($t1) seq $t2, $t0, $t1 - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t2, 8($t0) # Jumping to end_of_equal @@ -453,14 +495,14 @@ a_is_type_string: # internal_0 = EqualStr(a, b) - lw $t0, 36($sp) - lw $t1, 32($sp) + lw $t0, 44($sp) + lw $t1, 40($sp) addi $t0, $t0, 8 addi $t1, $t1, 8 # By default we assume the strings are equals addi $t4, $zero, 1 - lw $t5, 28($sp) + lw $t5, 36($sp) sw $t4, 8($t5) while_compare_strings_start: @@ -469,7 +511,7 @@ beq $t2, $t3, while_compare_strings_update # The strings are no equals - lw $t5, 28($sp) + lw $t5, 36($sp) sw $zero, 8($t5) j while_compare_strings_end @@ -477,6 +519,7 @@ addi $t0, $t0, 1 addi $t1, $t1, 1 beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end j while_compare_strings_start while_compare_strings_end: @@ -486,11 +529,11 @@ a_is_type_object: # Equal operation - lw $t0, 36($sp) # Save in $t0 the left operand address - lw $t1, 32($sp) # Save in $t1 the right operand address + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address seq $t2, $t0, $t1 # $t2 = $t0 == $t1 - lw $t0, 28($sp) # $t0 = internal_0 + lw $t0, 36($sp) # $t0 = internal_0 sw $t2, 8($t0) # Setting value in the third word of the Bool object # Jumping to end_of_equal @@ -499,10 +542,156 @@ end_of_equal: # Loading return value in $v1 - lw $v1, 28($sp) + lw $v1, 36($sp) # Freeing space for local variables - addi $sp, $sp, 32 + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 jr $ra @@ -518,15 +707,184 @@ function_abort_at_Object: # Function parameters - # $ra = 4($sp) - # self = 0($sp) + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_2[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_2 = "\n" + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_type_name_at_Object + jal function_type_name_at_Object + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 12($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) # $t0 = internal_3 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string internal_3 + li $v0, 4 + move $a0, $t0 + syscall # Exit program li $v0, 10 syscall # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 jr $ra @@ -542,7 +900,7 @@ lw $t0, 4($sp) # $t0 = self lw $t1, 0($t0) # $t1 = type of self lw $t2, 12($t1) # $t1 = length of the name of self - lw $t3, 16($t1) # $t1 = name of self + la $t3, 16($t1) # $t1 = name of self addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 @@ -552,26 +910,24 @@ la $t4, type_String sw $t4, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - move $t4, $v0 # $t4 = direction of the new string + addi $t4, $v0, 0 # $t4 = direction of the new string addi $t4, $t4, 8 # Pointer to the first character of the string - addi $t0, $t0, 8 # Pointer to the first character of the string in self xor $t5, $t5, $t5 # Initializing counter while_copy_name_start: - beq $t5, $t1, while_copy_name_end - lb $t6, 0($t0) # Loading the character + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character sb $t6, 0($t4) addi $t4, $t4, 1 # Incrementing the pointer to the new string - addi $t0, $t0, 1 # Incrementing the pointer to the string in self + addi $t3, $t3, 1 # Incrementing the pointer to the string in self addi $t5, $t5, 1 # Incrementing counter j while_copy_name_start while_copy_name_end: sb $zero, 0($t4) # Setting the null byte - sw $t4, 0($sp) # Storing the new string in internal_0 + sw $v0, 0($sp) # Storing the new string in internal_0 # Loading return value in $v1 lw $v1, 0($sp) @@ -689,16 +1045,18 @@ xor $t0, $t0, $t0 # Initializing counter while_read_start: - lw $t1, buffer_input($t0) # Loading the byte + lb $t1, buffer_input($t0) # Loading the byte beq $t1, $zero, while_read_end addi $t0, $t0, 1 # Incrementing counter j while_read_start while_read_end: + addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 move $a0, $t0 syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte la $t2, type_String sw $t2, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting length in the second word of the object @@ -708,7 +1066,7 @@ while_copy_from_buffer_start: beq $t4, $t0, while_copy_from_buffer_end - lw $t5, buffer_input($t4) # Loading the byte + lb $t5, buffer_input($t4) # Loading the byte sb $t5, 0($t3) # Storing the byte addi $t3, $t3, 1 # Imcremeenting pointer addi $t4, $t4, 1 # Incrementing counter @@ -735,9 +1093,22 @@ # Reserving space for local variables addi $sp, $sp, -4 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + li $v0, 5 syscall - sw $v0, 0($sp) # Storing the new object in internal_0 + lw $t0, 0($sp) + sw $v0, 8($t0) # Loading return value in $v1 lw $v1, 0($sp) @@ -765,11 +1136,24 @@ # Reserving space for local variables addi $sp, $sp, -4 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + # internal_0 = length of self lw $t0, 4($sp) lw $t1, 4($t0) addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator - sw $t1, 0($sp) + lw $t0, 0($sp) + sw $t1, 8($t0) # Loading return value in $v1 lw $v1, 0($sp) @@ -793,6 +1177,8 @@ lw $t1, 4($sp) lw $t2, 4($t0) # $t2 = length of str1 lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 add $t4, $t2, $t3 # $t4 = length of str1 + str2 addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) @@ -812,7 +1198,7 @@ xor $t6, $t6, $t6 # $t6 = 0 Initializing counter while_copy_str1_start: beq $t6, $t2, while_copy_str1_end - lb $t7, 0($t0) + lb $t7, 8($t0) sb $t7, 0($t5) add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string @@ -823,7 +1209,7 @@ # Copying str2 to the new string while_copy_str2_start: beq $t6, $t4, while_copy_str2_end - lb $t7, 0($t1) + lb $t7, 8($t1) sb $t7, 0($t5) add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string @@ -856,11 +1242,14 @@ # internal_0 = self[i:i + l] lw $t0, 12($sp) # $t0 = address of the string lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring - bge $t4, $t1, substring_out_of_bounds + bgt $t4, $t1, substring_out_of_bounds addi $t3, $t3, 9 li $v0, 9 @@ -927,7 +1316,6 @@ # Reserving space for local variables addi $sp, $sp, -208 - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -948,7 +1336,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 48 @@ -976,33 +1364,20 @@ sw $v1, 204($sp) # internal_3 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 192($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 200($sp) - j end_assign - not_is_Bool_or_Int: # internal_1 = internal_3 lw $t0, 192($sp) sw $t0, 200($sp) - end_assign: - # If internal_1 then goto then_8790281930397 + # If internal_1 then goto then_8751054232010 lw $t0, 200($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8790281930397 + beq $t0, $t1, then_8751054232010 - # Jumping to else_8790281930397 - j else_8790281930397 + # Jumping to else_8751054232010 + j else_8751054232010 - then_8790281930397: + then_8751054232010: # Allocating Int 0 li $v0, 9 @@ -1016,28 +1391,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 188($sp) # internal_4 = address of allocated object Int - lw $t0, 188($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 204($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_4 lw $t0, 188($sp) sw $t0, 204($sp) - end_assign: - # Jumping to endif_8790281930397 - j endif_8790281930397 - - else_8790281930397: + # Jumping to endif_8751054232010 + j endif_8751054232010 + else_8751054232010: # Allocating Bool 0 li $v0, 9 @@ -1059,7 +1420,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 49 @@ -1087,33 +1448,20 @@ sw $v1, 184($sp) # internal_8 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 172($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 180($sp) - j end_assign - not_is_Bool_or_Int: # internal_6 = internal_8 lw $t0, 172($sp) sw $t0, 180($sp) - end_assign: - # If internal_6 then goto then_8790281930391 + # If internal_6 then goto then_8751054232004 lw $t0, 180($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8790281930391 + beq $t0, $t1, then_8751054232004 - # Jumping to else_8790281930391 - j else_8790281930391 + # Jumping to else_8751054232004 + j else_8751054232004 - then_8790281930391: + then_8751054232004: # Allocating Int 1 li $v0, 9 @@ -1127,28 +1475,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 168($sp) # internal_9 = address of allocated object Int - lw $t0, 168($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 184($sp) - j end_assign - not_is_Bool_or_Int: # internal_5 = internal_9 lw $t0, 168($sp) sw $t0, 184($sp) - end_assign: - # Jumping to endif_8790281930391 - j endif_8790281930391 - - else_8790281930391: + # Jumping to endif_8751054232004 + j endif_8751054232004 + else_8751054232004: # Allocating Bool 0 li $v0, 9 @@ -1170,7 +1504,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 50 @@ -1198,33 +1532,20 @@ sw $v1, 164($sp) # internal_13 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 152($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 160($sp) - j end_assign - not_is_Bool_or_Int: # internal_11 = internal_13 lw $t0, 152($sp) sw $t0, 160($sp) - end_assign: - # If internal_11 then goto then_8790281930385 + # If internal_11 then goto then_8751054231998 lw $t0, 160($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8790281930385 + beq $t0, $t1, then_8751054231998 - # Jumping to else_8790281930385 - j else_8790281930385 + # Jumping to else_8751054231998 + j else_8751054231998 - then_8790281930385: + then_8751054231998: # Allocating Int 2 li $v0, 9 @@ -1238,28 +1559,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 148($sp) # internal_14 = address of allocated object Int - lw $t0, 148($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 164($sp) - j end_assign - not_is_Bool_or_Int: # internal_10 = internal_14 lw $t0, 148($sp) sw $t0, 164($sp) - end_assign: - - # Jumping to endif_8790281930385 - j endif_8790281930385 - else_8790281930385: + # Jumping to endif_8751054231998 + j endif_8751054231998 + else_8751054231998: # Allocating Bool 0 li $v0, 9 @@ -1281,7 +1588,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 51 @@ -1309,33 +1616,20 @@ sw $v1, 144($sp) # internal_18 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 132($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 140($sp) - j end_assign - not_is_Bool_or_Int: # internal_16 = internal_18 lw $t0, 132($sp) sw $t0, 140($sp) - end_assign: - # If internal_16 then goto then_8790281930379 + # If internal_16 then goto then_8751054231992 lw $t0, 140($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8790281930379 + beq $t0, $t1, then_8751054231992 - # Jumping to else_8790281930379 - j else_8790281930379 + # Jumping to else_8751054231992 + j else_8751054231992 - then_8790281930379: + then_8751054231992: # Allocating Int 3 li $v0, 9 @@ -1349,28 +1643,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 128($sp) # internal_19 = address of allocated object Int - lw $t0, 128($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 144($sp) - j end_assign - not_is_Bool_or_Int: # internal_15 = internal_19 lw $t0, 128($sp) sw $t0, 144($sp) - end_assign: - # Jumping to endif_8790281930379 - j endif_8790281930379 - - else_8790281930379: + # Jumping to endif_8751054231992 + j endif_8751054231992 + else_8751054231992: # Allocating Bool 0 li $v0, 9 @@ -1392,7 +1672,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 52 @@ -1420,33 +1700,20 @@ sw $v1, 124($sp) # internal_23 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 112($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 120($sp) - j end_assign - not_is_Bool_or_Int: # internal_21 = internal_23 lw $t0, 112($sp) sw $t0, 120($sp) - end_assign: - # If internal_21 then goto then_8790281930373 + # If internal_21 then goto then_8751054231986 lw $t0, 120($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8790281930373 + beq $t0, $t1, then_8751054231986 - # Jumping to else_8790281930373 - j else_8790281930373 + # Jumping to else_8751054231986 + j else_8751054231986 - then_8790281930373: + then_8751054231986: # Allocating Int 4 li $v0, 9 @@ -1460,28 +1727,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 108($sp) # internal_24 = address of allocated object Int - lw $t0, 108($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 124($sp) - j end_assign - not_is_Bool_or_Int: # internal_20 = internal_24 lw $t0, 108($sp) sw $t0, 124($sp) - end_assign: - # Jumping to endif_8790281930373 - j endif_8790281930373 - - else_8790281930373: + # Jumping to endif_8751054231986 + j endif_8751054231986 + else_8751054231986: # Allocating Bool 0 li $v0, 9 @@ -1503,7 +1756,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 53 @@ -1531,33 +1784,20 @@ sw $v1, 104($sp) # internal_28 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 92($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 100($sp) - j end_assign - not_is_Bool_or_Int: # internal_26 = internal_28 lw $t0, 92($sp) sw $t0, 100($sp) - end_assign: - # If internal_26 then goto then_8790281930367 + # If internal_26 then goto then_8751054231980 lw $t0, 100($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8790281930367 + beq $t0, $t1, then_8751054231980 - # Jumping to else_8790281930367 - j else_8790281930367 + # Jumping to else_8751054231980 + j else_8751054231980 - then_8790281930367: + then_8751054231980: # Allocating Int 5 li $v0, 9 @@ -1571,28 +1811,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 88($sp) # internal_29 = address of allocated object Int - lw $t0, 88($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 104($sp) - j end_assign - not_is_Bool_or_Int: # internal_25 = internal_29 lw $t0, 88($sp) sw $t0, 104($sp) - end_assign: - - # Jumping to endif_8790281930367 - j endif_8790281930367 - else_8790281930367: + # Jumping to endif_8751054231980 + j endif_8751054231980 + else_8751054231980: # Allocating Bool 0 li $v0, 9 @@ -1614,7 +1840,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 54 @@ -1642,33 +1868,20 @@ sw $v1, 84($sp) # internal_33 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 72($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 80($sp) - j end_assign - not_is_Bool_or_Int: # internal_31 = internal_33 lw $t0, 72($sp) sw $t0, 80($sp) - end_assign: - # If internal_31 then goto then_8790281930361 + # If internal_31 then goto then_8751054231974 lw $t0, 80($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8790281930361 + beq $t0, $t1, then_8751054231974 - # Jumping to else_8790281930361 - j else_8790281930361 + # Jumping to else_8751054231974 + j else_8751054231974 - then_8790281930361: + then_8751054231974: # Allocating Int 6 li $v0, 9 @@ -1682,28 +1895,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 68($sp) # internal_34 = address of allocated object Int - lw $t0, 68($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 84($sp) - j end_assign - not_is_Bool_or_Int: # internal_30 = internal_34 lw $t0, 68($sp) sw $t0, 84($sp) - end_assign: - # Jumping to endif_8790281930361 - j endif_8790281930361 - - else_8790281930361: + # Jumping to endif_8751054231974 + j endif_8751054231974 + else_8751054231974: # Allocating Bool 0 li $v0, 9 @@ -1725,7 +1924,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 55 @@ -1753,33 +1952,20 @@ sw $v1, 64($sp) # internal_38 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 52($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: # internal_36 = internal_38 lw $t0, 52($sp) sw $t0, 60($sp) - end_assign: - # If internal_36 then goto then_8790281930355 + # If internal_36 then goto then_8751054231968 lw $t0, 60($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8790281930355 + beq $t0, $t1, then_8751054231968 - # Jumping to else_8790281930355 - j else_8790281930355 + # Jumping to else_8751054231968 + j else_8751054231968 - then_8790281930355: + then_8751054231968: # Allocating Int 7 li $v0, 9 @@ -1793,28 +1979,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 48($sp) # internal_39 = address of allocated object Int - lw $t0, 48($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 64($sp) - j end_assign - not_is_Bool_or_Int: # internal_35 = internal_39 lw $t0, 48($sp) sw $t0, 64($sp) - end_assign: - # Jumping to endif_8790281930355 - j endif_8790281930355 - - else_8790281930355: + # Jumping to endif_8751054231968 + j endif_8751054231968 + else_8751054231968: # Allocating Bool 0 li $v0, 9 @@ -1836,7 +2008,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 56 @@ -1864,33 +2036,20 @@ sw $v1, 44($sp) # internal_43 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 32($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: # internal_41 = internal_43 lw $t0, 32($sp) sw $t0, 40($sp) - end_assign: - # If internal_41 then goto then_8790281930349 + # If internal_41 then goto then_8751054231962 lw $t0, 40($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8790281930349 + beq $t0, $t1, then_8751054231962 - # Jumping to else_8790281930349 - j else_8790281930349 + # Jumping to else_8751054231962 + j else_8751054231962 - then_8790281930349: + then_8751054231962: # Allocating Int 8 li $v0, 9 @@ -1904,28 +2063,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 28($sp) # internal_44 = address of allocated object Int - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: # internal_40 = internal_44 lw $t0, 28($sp) sw $t0, 44($sp) - end_assign: - - # Jumping to endif_8790281930349 - j endif_8790281930349 - else_8790281930349: + # Jumping to endif_8751054231962 + j endif_8751054231962 + else_8751054231962: # Allocating Bool 0 li $v0, 9 @@ -1947,7 +2092,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 57 @@ -1975,33 +2120,20 @@ sw $v1, 24($sp) # internal_48 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 20($sp) - j end_assign - not_is_Bool_or_Int: # internal_46 = internal_48 lw $t0, 12($sp) sw $t0, 20($sp) - end_assign: - # If internal_46 then goto then_8790281930328 + # If internal_46 then goto then_8751054231941 lw $t0, 20($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8790281930328 + beq $t0, $t1, then_8751054231941 - # Jumping to else_8790281930328 - j else_8790281930328 + # Jumping to else_8751054231941 + j else_8751054231941 - then_8790281930328: + then_8751054231941: # Allocating Int 9 li $v0, 9 @@ -2015,27 +2147,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 8($sp) # internal_49 = address of allocated object Int - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: # internal_45 = internal_49 lw $t0, 8($sp) sw $t0, 24($sp) - end_assign: - # Jumping to endif_8790281930328 - j endif_8790281930328 + # Jumping to endif_8751054231941 + j endif_8751054231941 - else_8790281930328: + else_8751054231941: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments @@ -2063,225 +2182,95 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 0($sp) # internal_51 = address of allocated object Int - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: # internal_45 = internal_51 lw $t0, 0($sp) sw $t0, 24($sp) - end_assign: - # Jumping to endif_8790281930328 - j endif_8790281930328 + # Jumping to endif_8751054231941 + j endif_8751054231941 - endif_8790281930328: + endif_8751054231941: - lw $t0, 24($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: # internal_40 = internal_45 lw $t0, 24($sp) sw $t0, 44($sp) - end_assign: - # Jumping to endif_8790281930349 - j endif_8790281930349 + # Jumping to endif_8751054231962 + j endif_8751054231962 - endif_8790281930349: + endif_8751054231962: - lw $t0, 44($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 64($sp) - j end_assign - not_is_Bool_or_Int: # internal_35 = internal_40 lw $t0, 44($sp) sw $t0, 64($sp) - end_assign: - # Jumping to endif_8790281930355 - j endif_8790281930355 + # Jumping to endif_8751054231968 + j endif_8751054231968 - endif_8790281930355: + endif_8751054231968: - lw $t0, 64($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 84($sp) - j end_assign - not_is_Bool_or_Int: # internal_30 = internal_35 lw $t0, 64($sp) sw $t0, 84($sp) - end_assign: - # Jumping to endif_8790281930361 - j endif_8790281930361 + # Jumping to endif_8751054231974 + j endif_8751054231974 - endif_8790281930361: + endif_8751054231974: - lw $t0, 84($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 104($sp) - j end_assign - not_is_Bool_or_Int: # internal_25 = internal_30 lw $t0, 84($sp) sw $t0, 104($sp) - end_assign: - # Jumping to endif_8790281930367 - j endif_8790281930367 + # Jumping to endif_8751054231980 + j endif_8751054231980 - endif_8790281930367: + endif_8751054231980: - lw $t0, 104($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 124($sp) - j end_assign - not_is_Bool_or_Int: # internal_20 = internal_25 lw $t0, 104($sp) sw $t0, 124($sp) - end_assign: - # Jumping to endif_8790281930373 - j endif_8790281930373 + # Jumping to endif_8751054231986 + j endif_8751054231986 - endif_8790281930373: + endif_8751054231986: - lw $t0, 124($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 144($sp) - j end_assign - not_is_Bool_or_Int: # internal_15 = internal_20 lw $t0, 124($sp) sw $t0, 144($sp) - end_assign: - # Jumping to endif_8790281930379 - j endif_8790281930379 + # Jumping to endif_8751054231992 + j endif_8751054231992 - endif_8790281930379: + endif_8751054231992: - lw $t0, 144($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 164($sp) - j end_assign - not_is_Bool_or_Int: # internal_10 = internal_15 lw $t0, 144($sp) sw $t0, 164($sp) - end_assign: - # Jumping to endif_8790281930385 - j endif_8790281930385 + # Jumping to endif_8751054231998 + j endif_8751054231998 - endif_8790281930385: + endif_8751054231998: - lw $t0, 164($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 184($sp) - j end_assign - not_is_Bool_or_Int: # internal_5 = internal_10 lw $t0, 164($sp) sw $t0, 184($sp) - end_assign: - # Jumping to endif_8790281930391 - j endif_8790281930391 + # Jumping to endif_8751054232004 + j endif_8751054232004 - endif_8790281930391: + endif_8751054232004: - lw $t0, 184($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 204($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_5 lw $t0, 184($sp) sw $t0, 204($sp) - end_assign: - # Jumping to endif_8790281930397 - j endif_8790281930397 + # Jumping to endif_8751054232010 + j endif_8751054232010 - endif_8790281930397: + endif_8751054232010: # Loading return value in $v1 lw $v1, 204($sp) @@ -2300,7 +2289,6 @@ # Reserving space for local variables addi $sp, $sp, -208 - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -2343,33 +2331,20 @@ sw $v1, 204($sp) # internal_3 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 192($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 200($sp) - j end_assign - not_is_Bool_or_Int: # internal_1 = internal_3 lw $t0, 192($sp) sw $t0, 200($sp) - end_assign: - # If internal_1 then goto then_8790281930975 + # If internal_1 then goto then_8751054233360 lw $t0, 200($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8790281930975 + beq $t0, $t1, then_8751054233360 - # Jumping to else_8790281930975 - j else_8790281930975 + # Jumping to else_8751054233360 + j else_8751054233360 - then_8790281930975: + then_8751054233360: # Allocating String li $v0, 9 @@ -2379,7 +2354,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 48 @@ -2389,28 +2364,14 @@ sw $v0, 188($sp) # internal_4 = "0" - lw $t0, 188($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 204($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_4 lw $t0, 188($sp) sw $t0, 204($sp) - end_assign: - # Jumping to endif_8790281930975 - j endif_8790281930975 - - else_8790281930975: + # Jumping to endif_8751054233360 + j endif_8751054233360 + else_8751054233360: # Allocating Bool 0 li $v0, 9 @@ -2454,33 +2415,20 @@ sw $v1, 184($sp) # internal_8 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 172($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 180($sp) - j end_assign - not_is_Bool_or_Int: # internal_6 = internal_8 lw $t0, 172($sp) sw $t0, 180($sp) - end_assign: - # If internal_6 then goto then_8790281930969 + # If internal_6 then goto then_8751054233354 lw $t0, 180($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8790281930969 + beq $t0, $t1, then_8751054233354 - # Jumping to else_8790281930969 - j else_8790281930969 + # Jumping to else_8751054233354 + j else_8751054233354 - then_8790281930969: + then_8751054233354: # Allocating String li $v0, 9 @@ -2490,7 +2438,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 49 @@ -2500,28 +2448,14 @@ sw $v0, 168($sp) # internal_9 = "1" - lw $t0, 168($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 184($sp) - j end_assign - not_is_Bool_or_Int: # internal_5 = internal_9 lw $t0, 168($sp) sw $t0, 184($sp) - end_assign: - # Jumping to endif_8790281930969 - j endif_8790281930969 - - else_8790281930969: + # Jumping to endif_8751054233354 + j endif_8751054233354 + else_8751054233354: # Allocating Bool 0 li $v0, 9 @@ -2565,33 +2499,20 @@ sw $v1, 164($sp) # internal_13 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 152($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 160($sp) - j end_assign - not_is_Bool_or_Int: # internal_11 = internal_13 lw $t0, 152($sp) sw $t0, 160($sp) - end_assign: - # If internal_11 then goto then_8790281930963 + # If internal_11 then goto then_8751054233348 lw $t0, 160($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8790281930963 + beq $t0, $t1, then_8751054233348 - # Jumping to else_8790281930963 - j else_8790281930963 + # Jumping to else_8751054233348 + j else_8751054233348 - then_8790281930963: + then_8751054233348: # Allocating String li $v0, 9 @@ -2601,7 +2522,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 50 @@ -2611,28 +2532,14 @@ sw $v0, 148($sp) # internal_14 = "2" - lw $t0, 148($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 164($sp) - j end_assign - not_is_Bool_or_Int: # internal_10 = internal_14 lw $t0, 148($sp) sw $t0, 164($sp) - end_assign: - - # Jumping to endif_8790281930963 - j endif_8790281930963 - else_8790281930963: + # Jumping to endif_8751054233348 + j endif_8751054233348 + else_8751054233348: # Allocating Bool 0 li $v0, 9 @@ -2676,33 +2583,20 @@ sw $v1, 144($sp) # internal_18 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 132($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 140($sp) - j end_assign - not_is_Bool_or_Int: # internal_16 = internal_18 lw $t0, 132($sp) sw $t0, 140($sp) - end_assign: - # If internal_16 then goto then_8790281930957 + # If internal_16 then goto then_8751054233082 lw $t0, 140($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8790281930957 + beq $t0, $t1, then_8751054233082 - # Jumping to else_8790281930957 - j else_8790281930957 + # Jumping to else_8751054233082 + j else_8751054233082 - then_8790281930957: + then_8751054233082: # Allocating String li $v0, 9 @@ -2712,7 +2606,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 51 @@ -2722,28 +2616,14 @@ sw $v0, 128($sp) # internal_19 = "3" - lw $t0, 128($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 144($sp) - j end_assign - not_is_Bool_or_Int: # internal_15 = internal_19 lw $t0, 128($sp) sw $t0, 144($sp) - end_assign: - # Jumping to endif_8790281930957 - j endif_8790281930957 - - else_8790281930957: + # Jumping to endif_8751054233082 + j endif_8751054233082 + else_8751054233082: # Allocating Bool 0 li $v0, 9 @@ -2787,33 +2667,20 @@ sw $v1, 124($sp) # internal_23 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 112($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 120($sp) - j end_assign - not_is_Bool_or_Int: # internal_21 = internal_23 lw $t0, 112($sp) sw $t0, 120($sp) - end_assign: - # If internal_21 then goto then_8790281930951 + # If internal_21 then goto then_8751054233076 lw $t0, 120($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8790281930951 + beq $t0, $t1, then_8751054233076 - # Jumping to else_8790281930951 - j else_8790281930951 + # Jumping to else_8751054233076 + j else_8751054233076 - then_8790281930951: + then_8751054233076: # Allocating String li $v0, 9 @@ -2823,7 +2690,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 52 @@ -2833,28 +2700,14 @@ sw $v0, 108($sp) # internal_24 = "4" - lw $t0, 108($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 124($sp) - j end_assign - not_is_Bool_or_Int: # internal_20 = internal_24 lw $t0, 108($sp) sw $t0, 124($sp) - end_assign: - # Jumping to endif_8790281930951 - j endif_8790281930951 - - else_8790281930951: + # Jumping to endif_8751054233076 + j endif_8751054233076 + else_8751054233076: # Allocating Bool 0 li $v0, 9 @@ -2898,33 +2751,20 @@ sw $v1, 104($sp) # internal_28 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 92($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 100($sp) - j end_assign - not_is_Bool_or_Int: # internal_26 = internal_28 lw $t0, 92($sp) sw $t0, 100($sp) - end_assign: - # If internal_26 then goto then_8790281930945 + # If internal_26 then goto then_8751054233070 lw $t0, 100($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8790281930945 + beq $t0, $t1, then_8751054233070 - # Jumping to else_8790281930945 - j else_8790281930945 + # Jumping to else_8751054233070 + j else_8751054233070 - then_8790281930945: + then_8751054233070: # Allocating String li $v0, 9 @@ -2934,7 +2774,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 53 @@ -2944,28 +2784,14 @@ sw $v0, 88($sp) # internal_29 = "5" - lw $t0, 88($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 104($sp) - j end_assign - not_is_Bool_or_Int: # internal_25 = internal_29 lw $t0, 88($sp) sw $t0, 104($sp) - end_assign: - - # Jumping to endif_8790281930945 - j endif_8790281930945 - else_8790281930945: + # Jumping to endif_8751054233070 + j endif_8751054233070 + else_8751054233070: # Allocating Bool 0 li $v0, 9 @@ -3009,33 +2835,20 @@ sw $v1, 84($sp) # internal_33 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 72($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 80($sp) - j end_assign - not_is_Bool_or_Int: # internal_31 = internal_33 lw $t0, 72($sp) sw $t0, 80($sp) - end_assign: - # If internal_31 then goto then_8790281930939 + # If internal_31 then goto then_8751054233064 lw $t0, 80($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8790281930939 + beq $t0, $t1, then_8751054233064 - # Jumping to else_8790281930939 - j else_8790281930939 + # Jumping to else_8751054233064 + j else_8751054233064 - then_8790281930939: + then_8751054233064: # Allocating String li $v0, 9 @@ -3045,7 +2858,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 54 @@ -3055,28 +2868,14 @@ sw $v0, 68($sp) # internal_34 = "6" - lw $t0, 68($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 84($sp) - j end_assign - not_is_Bool_or_Int: # internal_30 = internal_34 lw $t0, 68($sp) sw $t0, 84($sp) - end_assign: - # Jumping to endif_8790281930939 - j endif_8790281930939 - - else_8790281930939: + # Jumping to endif_8751054233064 + j endif_8751054233064 + else_8751054233064: # Allocating Bool 0 li $v0, 9 @@ -3120,33 +2919,20 @@ sw $v1, 64($sp) # internal_38 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 52($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: # internal_36 = internal_38 lw $t0, 52($sp) sw $t0, 60($sp) - end_assign: - # If internal_36 then goto then_8790281930933 + # If internal_36 then goto then_8751054233058 lw $t0, 60($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8790281930933 + beq $t0, $t1, then_8751054233058 - # Jumping to else_8790281930933 - j else_8790281930933 + # Jumping to else_8751054233058 + j else_8751054233058 - then_8790281930933: + then_8751054233058: # Allocating String li $v0, 9 @@ -3156,7 +2942,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 55 @@ -3166,28 +2952,14 @@ sw $v0, 48($sp) # internal_39 = "7" - lw $t0, 48($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 64($sp) - j end_assign - not_is_Bool_or_Int: # internal_35 = internal_39 lw $t0, 48($sp) sw $t0, 64($sp) - end_assign: - # Jumping to endif_8790281930933 - j endif_8790281930933 - - else_8790281930933: + # Jumping to endif_8751054233058 + j endif_8751054233058 + else_8751054233058: # Allocating Bool 0 li $v0, 9 @@ -3231,33 +3003,20 @@ sw $v1, 44($sp) # internal_43 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 32($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: # internal_41 = internal_43 lw $t0, 32($sp) sw $t0, 40($sp) - end_assign: - # If internal_41 then goto then_8790281930927 + # If internal_41 then goto then_8751054233052 lw $t0, 40($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8790281930927 + beq $t0, $t1, then_8751054233052 - # Jumping to else_8790281930927 - j else_8790281930927 + # Jumping to else_8751054233052 + j else_8751054233052 - then_8790281930927: + then_8751054233052: # Allocating String li $v0, 9 @@ -3267,7 +3026,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 56 @@ -3277,28 +3036,14 @@ sw $v0, 28($sp) # internal_44 = "8" - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: # internal_40 = internal_44 lw $t0, 28($sp) sw $t0, 44($sp) - end_assign: - - # Jumping to endif_8790281930927 - j endif_8790281930927 - else_8790281930927: + # Jumping to endif_8751054233052 + j endif_8751054233052 + else_8751054233052: # Allocating Bool 0 li $v0, 9 @@ -3342,33 +3087,20 @@ sw $v1, 24($sp) # internal_48 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 20($sp) - j end_assign - not_is_Bool_or_Int: # internal_46 = internal_48 lw $t0, 12($sp) sw $t0, 20($sp) - end_assign: - # If internal_46 then goto then_8790281930906 + # If internal_46 then goto then_8751054233031 lw $t0, 20($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8790281930906 + beq $t0, $t1, then_8751054233031 - # Jumping to else_8790281930906 - j else_8790281930906 + # Jumping to else_8751054233031 + j else_8751054233031 - then_8790281930906: + then_8751054233031: # Allocating String li $v0, 9 @@ -3378,7 +3110,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 57 @@ -3388,27 +3120,14 @@ sw $v0, 8($sp) # internal_49 = "9" - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: # internal_45 = internal_49 lw $t0, 8($sp) sw $t0, 24($sp) - end_assign: - # Jumping to endif_8790281930906 - j endif_8790281930906 + # Jumping to endif_8751054233031 + j endif_8751054233031 - else_8790281930906: + else_8751054233031: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments @@ -3432,232 +3151,102 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 9 sw $t0, 4($v0) # Setting length of the string in the second word of the object sb $zero, 8($v0) # Null-terminator at the end of the string sw $v0, 0($sp) # internal_51 = "" - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: # internal_45 = internal_51 lw $t0, 0($sp) sw $t0, 24($sp) - end_assign: - # Jumping to endif_8790281930906 - j endif_8790281930906 + # Jumping to endif_8751054233031 + j endif_8751054233031 - endif_8790281930906: + endif_8751054233031: - lw $t0, 24($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: # internal_40 = internal_45 lw $t0, 24($sp) sw $t0, 44($sp) - end_assign: - # Jumping to endif_8790281930927 - j endif_8790281930927 + # Jumping to endif_8751054233052 + j endif_8751054233052 - endif_8790281930927: + endif_8751054233052: - lw $t0, 44($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 64($sp) - j end_assign - not_is_Bool_or_Int: # internal_35 = internal_40 lw $t0, 44($sp) sw $t0, 64($sp) - end_assign: - # Jumping to endif_8790281930933 - j endif_8790281930933 + # Jumping to endif_8751054233058 + j endif_8751054233058 - endif_8790281930933: + endif_8751054233058: - lw $t0, 64($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 84($sp) - j end_assign - not_is_Bool_or_Int: # internal_30 = internal_35 lw $t0, 64($sp) sw $t0, 84($sp) - end_assign: - # Jumping to endif_8790281930939 - j endif_8790281930939 + # Jumping to endif_8751054233064 + j endif_8751054233064 - endif_8790281930939: + endif_8751054233064: - lw $t0, 84($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 104($sp) - j end_assign - not_is_Bool_or_Int: # internal_25 = internal_30 lw $t0, 84($sp) sw $t0, 104($sp) - end_assign: - # Jumping to endif_8790281930945 - j endif_8790281930945 + # Jumping to endif_8751054233070 + j endif_8751054233070 - endif_8790281930945: + endif_8751054233070: - lw $t0, 104($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 124($sp) - j end_assign - not_is_Bool_or_Int: # internal_20 = internal_25 lw $t0, 104($sp) sw $t0, 124($sp) - end_assign: - # Jumping to endif_8790281930951 - j endif_8790281930951 + # Jumping to endif_8751054233076 + j endif_8751054233076 - endif_8790281930951: + endif_8751054233076: - lw $t0, 124($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 144($sp) - j end_assign - not_is_Bool_or_Int: # internal_15 = internal_20 lw $t0, 124($sp) sw $t0, 144($sp) - end_assign: - # Jumping to endif_8790281930957 - j endif_8790281930957 + # Jumping to endif_8751054233082 + j endif_8751054233082 - endif_8790281930957: + endif_8751054233082: - lw $t0, 144($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 164($sp) - j end_assign - not_is_Bool_or_Int: # internal_10 = internal_15 lw $t0, 144($sp) sw $t0, 164($sp) - end_assign: - # Jumping to endif_8790281930963 - j endif_8790281930963 + # Jumping to endif_8751054233348 + j endif_8751054233348 - endif_8790281930963: + endif_8751054233348: - lw $t0, 164($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 184($sp) - j end_assign - not_is_Bool_or_Int: # internal_5 = internal_10 lw $t0, 164($sp) sw $t0, 184($sp) - end_assign: - # Jumping to endif_8790281930969 - j endif_8790281930969 + # Jumping to endif_8751054233354 + j endif_8751054233354 - endif_8790281930969: + endif_8751054233354: - lw $t0, 184($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 204($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_5 lw $t0, 184($sp) sw $t0, 204($sp) - end_assign: - # Jumping to endif_8790281930975 - j endif_8790281930975 + # Jumping to endif_8751054233360 + j endif_8751054233360 - endif_8790281930975: + endif_8751054233360: # Loading return value in $v1 lw $v1, 204($sp) @@ -3676,7 +3265,6 @@ # Reserving space for local variables addi $sp, $sp, -144 - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -3733,33 +3321,20 @@ sw $v1, 136($sp) # internal_4 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 124($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 136($sp) - j end_assign - not_is_Bool_or_Int: # internal_1 = internal_4 lw $t0, 124($sp) sw $t0, 136($sp) - end_assign: - # If internal_1 then goto then_8790281931421 + # If internal_1 then goto then_8751054233546 lw $t0, 136($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8790281931421 + beq $t0, $t1, then_8751054233546 - # Jumping to else_8790281931421 - j else_8790281931421 + # Jumping to else_8751054233546 + j else_8751054233546 - then_8790281931421: + then_8751054233546: # Allocating Int 0 li $v0, 9 @@ -3773,28 +3348,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 120($sp) # internal_5 = address of allocated object Int - lw $t0, 120($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 140($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_5 lw $t0, 120($sp) sw $t0, 140($sp) - end_assign: - # Jumping to endif_8790281931421 - j endif_8790281931421 - - else_8790281931421: + # Jumping to endif_8751054233546 + j endif_8751054233546 + else_8751054233546: # Allocating Bool 0 li $v0, 9 @@ -3862,7 +3423,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 45 @@ -3890,33 +3451,20 @@ sw $v1, 104($sp) # internal_12 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 92($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 112($sp) - j end_assign - not_is_Bool_or_Int: # internal_7 = internal_12 lw $t0, 92($sp) sw $t0, 112($sp) - end_assign: - # If internal_7 then goto then_8790281931436 + # If internal_7 then goto then_8751054233561 lw $t0, 112($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8790281931436 + beq $t0, $t1, then_8751054233561 - # Jumping to else_8790281931436 - j else_8790281931436 + # Jumping to else_8751054233561 + j else_8751054233561 - then_8790281931436: + then_8751054233561: # Allocating Int 1 li $v0, 9 @@ -4014,48 +3562,86 @@ sw $v1, 80($sp) # internal_18 = result of function_a2i_aux_at_A2I addi $sp, $sp, 12 # Freeing space for arguments - # Xor operation - lw $t0, 68($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 60($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - lw $t0, 56($sp) # $t0 = internal_21 - sw $t2, 8($t0) # Setting value in the third word of the Int object + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_19 = address of allocated object Int - # Addition operation - lw $t0, 56($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 64($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - add $t2, $t0, $t1 # $t2 = $t0 + $t1 + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall - lw $t0, 56($sp) # $t0 = internal_21 - sw $t2, 8($t0) # Setting value in the third word of the Int object + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_20 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_21 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_18 + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing internal_18 + + # Argument internal_20 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_21 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_21 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_21 + + # Argument internal_19 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_19 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_21 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 56($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 116($sp) - j end_assign - not_is_Bool_or_Int: # internal_6 = internal_21 lw $t0, 56($sp) sw $t0, 116($sp) - end_assign: - # Jumping to endif_8790281931436 - j endif_8790281931436 - - else_8790281931436: + # Jumping to endif_8751054233561 + j endif_8751054233561 + else_8751054233561: # Allocating Bool 0 li $v0, 9 @@ -4123,7 +3709,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 43 @@ -4151,33 +3737,20 @@ sw $v1, 40($sp) # internal_28 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 48($sp) - j end_assign - not_is_Bool_or_Int: # internal_23 = internal_28 lw $t0, 28($sp) sw $t0, 48($sp) - end_assign: - # If internal_23 then goto then_8790281931430 + # If internal_23 then goto then_8751054233555 lw $t0, 48($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8790281931430 + beq $t0, $t1, then_8751054233555 - # Jumping to else_8790281931430 - j else_8790281931430 + # Jumping to else_8751054233555 + j else_8751054233555 - then_8790281931430: + then_8751054233555: # Allocating Int 1 li $v0, 9 @@ -4275,27 +3848,14 @@ sw $v1, 16($sp) # internal_34 = result of function_a2i_aux_at_A2I addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 4($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: # internal_22 = internal_34 lw $t0, 4($sp) sw $t0, 52($sp) - end_assign: - # Jumping to endif_8790281931430 - j endif_8790281931430 + # Jumping to endif_8751054233555 + j endif_8751054233555 - else_8790281931430: + else_8751054233555: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -4315,71 +3875,32 @@ sw $v1, 12($sp) # internal_35 = result of function_a2i_aux_at_A2I addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: # internal_22 = internal_35 lw $t0, 0($sp) sw $t0, 52($sp) - end_assign: - # Jumping to endif_8790281931430 - j endif_8790281931430 + # Jumping to endif_8751054233555 + j endif_8751054233555 - endif_8790281931430: + endif_8751054233555: - lw $t0, 52($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 116($sp) - j end_assign - not_is_Bool_or_Int: # internal_6 = internal_22 lw $t0, 52($sp) sw $t0, 116($sp) - end_assign: - # Jumping to endif_8790281931436 - j endif_8790281931436 + # Jumping to endif_8751054233561 + j endif_8751054233561 - endif_8790281931436: + endif_8751054233561: - lw $t0, 116($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 140($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_6 lw $t0, 116($sp) sw $t0, 140($sp) - end_assign: - # Jumping to endif_8790281931421 - j endif_8790281931421 + # Jumping to endif_8751054233546 + j endif_8751054233546 - endif_8790281931421: + endif_8751054233546: # Loading return value in $v1 lw $v1, 140($sp) @@ -4391,12 +3912,12 @@ function_a2i_aux_at_A2I: # Function parameters - # $ra = 72($sp) - # self = 68($sp) - # s = 64($sp) + # $ra = 68($sp) + # self = 64($sp) + # s = 60($sp) # Reserving space for local variables - addi $sp, $sp, -64 + addi $sp, $sp, -60 # Allocating Int 0 li $v0, 9 @@ -4408,55 +3929,57 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 56($sp) # internal_1 = address of allocated object Int + sw $v0, 52($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument int + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing int - lw $t0, 56($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: - # int = internal_1 - lw $t0, 56($sp) - sw $t0, 60($sp) - end_assign: + # Argument internal_1 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 68($sp) # int = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument s - lw $t0, 72($sp) + lw $t0, 68($sp) sw $t0, 0($sp) # Storing s # Calling function function_length_at_String jal function_length_at_String lw $ra, 4($sp) - sw $v1, 56($sp) # internal_3 = result of function_length_at_String + sw $v1, 52($sp) # internal_3 = result of function_length_at_String addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 48($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: - # j = internal_3 - lw $t0, 48($sp) - sw $t0, 52($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument j + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing j + + # Argument internal_3 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 60($sp) # j = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 0 li $v0, 9 @@ -4468,72 +3991,56 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_5 = address of allocated object Int + sw $v0, 36($sp) # internal_5 = address of allocated object Int - lw $t0, 40($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: - # i = internal_5 - lw $t0, 40($sp) - sw $t0, 44($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing i - while_start_8790281931834: + # Argument internal_5 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 52($sp) # i = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + while_start_8751054233959: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 56($sp) + lw $t0, 52($sp) sw $t0, 4($sp) # Storing i # Argument j - lw $t0, 64($sp) + lw $t0, 60($sp) sw $t0, 0($sp) # Storing j # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 44($sp) # internal_7 = result of function_less_than + sw $v1, 44($sp) # internal_6 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 32($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 36($sp) - j end_assign - not_is_Bool_or_Int: - # internal_6 = internal_7 - lw $t0, 32($sp) - sw $t0, 36($sp) - end_assign: - - # If internal_6 then goto while_body_8790281931834 - lw $t0, 36($sp) # Loading the address of the condition + # If internal_6 then goto while_body_8751054233959 + lw $t0, 32($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8790281931834 + beq $t0, $t1, while_body_8751054233959 - # Jumping to while_end_8790281931834 - j while_end_8790281931834 + # Jumping to while_end_8751054233959 + j while_end_8751054233959 - while_body_8790281931834: + while_body_8751054233959: # Allocating Int 10 li $v0, 9 @@ -4545,24 +4052,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 10 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_8 = address of allocated object Int + sw $v0, 28($sp) # internal_7 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument int - lw $t0, 72($sp) + lw $t0, 68($sp) sw $t0, 4($sp) # Storing int - # Argument internal_8 + # Argument internal_7 lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_8 + sw $t0, 0($sp) # Storing internal_7 # Calling function function_mult jal function_mult lw $ra, 8($sp) - sw $v1, 36($sp) # internal_9 = result of function_mult + sw $v1, 36($sp) # internal_8 = result of function_mult addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -4575,28 +4082,28 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_10 = address of allocated object Int + sw $v0, 20($sp) # internal_9 = address of allocated object Int # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument s - lw $t0, 80($sp) + lw $t0, 76($sp) sw $t0, 8($sp) # Storing s # Argument i - lw $t0, 60($sp) + lw $t0, 56($sp) sw $t0, 4($sp) # Storing i - # Argument internal_10 + # Argument internal_9 lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_10 + sw $t0, 0($sp) # Storing internal_9 # Calling function function_substr_at_String jal function_substr_at_String lw $ra, 12($sp) - sw $v1, 32($sp) # internal_11 = result of function_substr_at_String + sw $v1, 32($sp) # internal_10 = result of function_substr_at_String addi $sp, $sp, 16 # Freeing space for arguments # Passing function arguments @@ -4604,53 +4111,54 @@ sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 80($sp) + lw $t0, 76($sp) sw $t0, 4($sp) # Storing self - # Argument internal_11 + # Argument internal_10 lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_11 + sw $t0, 0($sp) # Storing internal_10 # Calling function function_c2i_at_A2I jal function_c2i_at_A2I lw $ra, 8($sp) - sw $v1, 24($sp) # internal_12 = result of function_c2i_at_A2I + sw $v1, 24($sp) # internal_11 = result of function_c2i_at_A2I addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_9 + # Argument internal_8 lw $t0, 36($sp) - sw $t0, 4($sp) # Storing internal_9 + sw $t0, 4($sp) # Storing internal_8 - # Argument internal_12 + # Argument internal_11 lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_12 + sw $t0, 0($sp) # Storing internal_11 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 20($sp) # internal_13 = result of function_add + sw $v1, 20($sp) # internal_12 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: - # int = internal_13 - lw $t0, 8($sp) - sw $t0, 60($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument int + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing int + + # Argument internal_12 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 68($sp) # int = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 li $v0, 9 @@ -4662,53 +4170,54 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_14 = address of allocated object Int + sw $v0, 4($sp) # internal_13 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 56($sp) + lw $t0, 52($sp) sw $t0, 4($sp) # Storing i - # Argument internal_14 + # Argument internal_13 lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_14 + sw $t0, 0($sp) # Storing internal_13 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 12($sp) # internal_15 = result of function_add + sw $v1, 12($sp) # internal_14 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: - # i = internal_15 - lw $t0, 0($sp) - sw $t0, 44($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_14 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_14 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 52($sp) # i = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to while_start_8790281931834 - j while_start_8790281931834 + # Jumping to while_start_8751054233959 + j while_start_8751054233959 - while_end_8790281931834: + while_end_8751054233959: # Loading return value in $v1 - lw $v1, 60($sp) + lw $v1, 56($sp) # Freeing space for local variables - addi $sp, $sp, 64 + addi $sp, $sp, 60 jr $ra @@ -4721,7 +4230,6 @@ # Reserving space for local variables addi $sp, $sp, -72 - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -4764,33 +4272,20 @@ sw $v1, 68($sp) # internal_3 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 56($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 64($sp) - j end_assign - not_is_Bool_or_Int: # internal_1 = internal_3 lw $t0, 56($sp) sw $t0, 64($sp) - end_assign: - # If internal_1 then goto then_8790281931963 + # If internal_1 then goto then_8751054234088 lw $t0, 64($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8790281931963 + beq $t0, $t1, then_8751054234088 - # Jumping to else_8790281931963 - j else_8790281931963 + # Jumping to else_8751054234088 + j else_8751054234088 - then_8790281931963: + then_8751054234088: # Allocating String li $v0, 9 @@ -4800,7 +4295,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 48 @@ -4810,28 +4305,14 @@ sw $v0, 52($sp) # internal_4 = "0" - lw $t0, 52($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 68($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_4 lw $t0, 52($sp) sw $t0, 68($sp) - end_assign: - - # Jumping to endif_8790281931963 - j endif_8790281931963 - else_8790281931963: + # Jumping to endif_8751054234088 + j endif_8751054234088 + else_8751054234088: # Allocating Bool 0 li $v0, 9 @@ -4875,33 +4356,20 @@ sw $v1, 48($sp) # internal_8 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 36($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: # internal_6 = internal_8 lw $t0, 36($sp) sw $t0, 44($sp) - end_assign: - # If internal_6 then goto then_8790281931969 + # If internal_6 then goto then_8751054234094 lw $t0, 44($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8790281931969 + beq $t0, $t1, then_8751054234094 - # Jumping to else_8790281931969 - j else_8790281931969 + # Jumping to else_8751054234094 + j else_8751054234094 - then_8790281931969: + then_8751054234094: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -4921,27 +4389,14 @@ sw $v1, 44($sp) # internal_9 = result of function_i2a_aux_at_A2I addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 32($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 48($sp) - j end_assign - not_is_Bool_or_Int: # internal_5 = internal_9 lw $t0, 32($sp) sw $t0, 48($sp) - end_assign: - # Jumping to endif_8790281931969 - j endif_8790281931969 + # Jumping to endif_8751054234094 + j endif_8751054234094 - else_8790281931969: + else_8751054234094: # Allocating String li $v0, 9 @@ -4951,7 +4406,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 45 @@ -4973,25 +4428,77 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 24($sp) # internal_11 = address of allocated object Int - # Xor operation - lw $t0, 24($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 16($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - lw $t0, 12($sp) # $t0 = internal_14 - sw $t2, 8($t0) # Setting value in the third word of the Int object + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_12 = address of allocated object Int - # Addition operation - lw $t0, 12($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 20($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - add $t2, $t0, $t1 # $t2 = $t0 + $t1 + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall - lw $t0, 12($sp) # $t0 = internal_14 - sw $t2, 8($t0) # Setting value in the third word of the Int object + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_13 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_14 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_11 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_11 + + # Argument internal_13 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_14 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_14 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_14 + + # Argument internal_12 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_14 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -5047,49 +4554,23 @@ sw $v1, 12($sp) # internal_17 = result of function_concat_at_String addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 48($sp) - j end_assign - not_is_Bool_or_Int: # internal_5 = internal_17 lw $t0, 0($sp) sw $t0, 48($sp) - end_assign: - # Jumping to endif_8790281931969 - j endif_8790281931969 + # Jumping to endif_8751054234094 + j endif_8751054234094 - endif_8790281931969: + endif_8751054234094: - lw $t0, 48($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 68($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_5 lw $t0, 48($sp) sw $t0, 68($sp) - end_assign: - # Jumping to endif_8790281931963 - j endif_8790281931963 + # Jumping to endif_8751054234088 + j endif_8751054234088 - endif_8790281931963: + endif_8751054234088: # Loading return value in $v1 lw $v1, 68($sp) @@ -5108,7 +4589,6 @@ # Reserving space for local variables addi $sp, $sp, -56 - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -5151,33 +4631,20 @@ sw $v1, 52($sp) # internal_3 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 40($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 48($sp) - j end_assign - not_is_Bool_or_Int: # internal_1 = internal_3 lw $t0, 40($sp) sw $t0, 48($sp) - end_assign: - # If internal_1 then goto then_8790281932849 + # If internal_1 then goto then_8751054234974 lw $t0, 48($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8790281932849 + beq $t0, $t1, then_8751054234974 - # Jumping to else_8790281932849 - j else_8790281932849 + # Jumping to else_8751054234974 + j else_8751054234974 - then_8790281932849: + then_8751054234974: # Allocating String li $v0, 9 @@ -5187,34 +4654,21 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 9 sw $t0, 4($v0) # Setting length of the string in the second word of the object sb $zero, 8($v0) # Null-terminator at the end of the string sw $v0, 36($sp) # internal_4 = "" - lw $t0, 36($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_4 lw $t0, 36($sp) sw $t0, 52($sp) - end_assign: - # Jumping to endif_8790281932849 - j endif_8790281932849 + # Jumping to endif_8751054234974 + j endif_8751054234974 - else_8790281932849: + else_8751054234974: # Allocating Int 10 li $v0, 9 @@ -5246,22 +4700,23 @@ sw $v1, 36($sp) # internal_7 = result of function_div addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 24($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 32($sp) - j end_assign - not_is_Bool_or_Int: - # next = internal_7 - lw $t0, 24($sp) - sw $t0, 32($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument next + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing next + + # Argument internal_7 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 44($sp) # next = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -5365,27 +4820,14 @@ sw $v1, 12($sp) # internal_13 = result of function_concat_at_String addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_13 lw $t0, 0($sp) sw $t0, 52($sp) - end_assign: - # Jumping to endif_8790281932849 - j endif_8790281932849 + # Jumping to endif_8751054234974 + j endif_8751054234974 - endif_8790281932849: + endif_8751054234974: # Loading return value in $v1 lw $v1, 52($sp) @@ -5444,7 +4886,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 6 + addi $t0, $zero, 15 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 54 @@ -5487,22 +4929,23 @@ sw $v1, 52($sp) # internal_3 = result of function_a2i_at_A2I addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 40($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: - # a = internal_3 - lw $t0, 40($sp) - sw $t0, 52($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument a + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing a + + # Argument internal_3 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 64($sp) # a = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating A2I li $v0, 9 @@ -5557,22 +5000,23 @@ sw $v1, 36($sp) # internal_7 = result of function_i2a_at_A2I addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 24($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 36($sp) - j end_assign - not_is_Bool_or_Int: - # b = internal_7 - lw $t0, 24($sp) - sw $t0, 36($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument b + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing b + + # Argument internal_7 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 48($sp) # b = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -5600,7 +5044,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 4 + addi $t0, $zero, 13 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -5663,7 +5107,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 diff --git a/tests/codegen/cells.mips b/tests/codegen/cells.mips index 5c0e83b20..c2d1d4546 100644 --- a/tests/codegen/cells.mips +++ b/tests/codegen/cells.mips @@ -4,42 +4,49 @@ type_Object_attributes: .word 0 type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" + type_Object_abort_message: .asciiz "Abort called from class Object\n" type_IO: .word 8 type_IO_inherits_from: .word type_Object type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" + type_IO_abort_message: .asciiz "Abort called from class IO\n" type_Int: .word 8 type_Int_inherits_from: .word type_Object type_Int_attributes: .word 0 type_Int_name_size: .word 3 type_Int_name: .asciiz "Int" + type_Int_abort_message: .asciiz "Abort called from class Int\n" type_String: .word 8 type_String_inherits_from: .word type_Object type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" + type_String_abort_message: .asciiz "Abort called from class String\n" type_Bool: .word 8 type_Bool_inherits_from: .word type_Object type_Bool_attributes: .word 0 type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" + type_Bool_abort_message: .asciiz "Abort called from class Bool\n" type_CellularAutomaton: .word 12 type_CellularAutomaton_inherits_from: .word type_IO type_CellularAutomaton_attributes: .word 1 type_CellularAutomaton_name_size: .word 17 type_CellularAutomaton_name: .asciiz "CellularAutomaton" + type_CellularAutomaton_abort_message: .asciiz "Abort called from class CellularAutomaton\n" type_Main: .word 12 type_Main_inherits_from: .word type_Object type_Main_attributes: .word 1 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" + type_Main_abort_message: .asciiz "Abort called from class Main\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -322,12 +329,12 @@ function_equal: # Function parameters - # $ra = 40($sp) - # a = 36($sp) - # b = 32($sp) + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) # Reserving space for local variables - addi $sp, $sp, -32 + addi $sp, $sp, -40 # Allocating Bool 0 li $v0, 9 @@ -339,22 +346,57 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_0 = address of allocated object Int + sw $v0, 36($sp) # internal_0 = address of allocated object Int - # internal_1 = typeof a that is the first word of the object - lw $t0, 36($sp) - lw $t1, 0($t0) - sw $t1, 24($sp) + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object - # internal_2 = direction of Int + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int la $t0, type_Int sw $t0, 20($sp) - # internal_3 = direction of Bool + # internal_5 = direction of Bool la $t0, type_Bool sw $t0, 16($sp) - # internal_4 = direction of String + # internal_6 = direction of String la $t0, type_String sw $t0, 12($sp) @@ -368,7 +410,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_5 = address of allocated object Int + sw $v0, 8($sp) # internal_7 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -380,7 +422,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_6 = address of allocated object Int + sw $v0, 4($sp) # internal_8 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -392,42 +434,42 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_7 = address of allocated object Int + sw $v0, 0($sp) # internal_9 = address of allocated object Int - # internal_5 = EqualAddress(internal_1, internal_2) + # internal_7 = EqualAddress(internal_3, internal_4) lw $t0, 24($sp) lw $t1, 20($sp) seq $t2, $t0, $t1 lw $t0, 8($sp) sw $t2, 8($t0) - # internal_6 = EqualAddress(internal_1, internal_3) + # internal_8 = EqualAddress(internal_3, internal_5) lw $t0, 24($sp) lw $t1, 16($sp) seq $t2, $t0, $t1 lw $t0, 4($sp) sw $t2, 8($t0) - # internal_7 = EqualAddress(internal_1, internal_4) + # internal_9 = EqualAddress(internal_3, internal_6) lw $t0, 24($sp) lw $t1, 12($sp) seq $t2, $t0, $t1 lw $t0, 0($sp) sw $t2, 8($t0) - # If internal_5 then goto a_is_type_int_or_bool + # If internal_7 then goto a_is_type_int_or_bool lw $t0, 8($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison beq $t0, $t1, a_is_type_int_or_bool - # If internal_6 then goto a_is_type_int_or_bool + # If internal_8 then goto a_is_type_int_or_bool lw $t0, 4($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison beq $t0, $t1, a_is_type_int_or_bool - # If internal_7 then goto a_is_type_string + # If internal_9 then goto a_is_type_string lw $t0, 0($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison @@ -439,12 +481,12 @@ a_is_type_int_or_bool: # internal_0 = EqualInt(a, b) - lw $t0, 36($sp) + lw $t0, 44($sp) lw $t0, 8($t0) - lw $t1, 32($sp) + lw $t1, 40($sp) lw $t1, 8($t1) seq $t2, $t0, $t1 - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t2, 8($t0) # Jumping to end_of_equal @@ -453,14 +495,14 @@ a_is_type_string: # internal_0 = EqualStr(a, b) - lw $t0, 36($sp) - lw $t1, 32($sp) + lw $t0, 44($sp) + lw $t1, 40($sp) addi $t0, $t0, 8 addi $t1, $t1, 8 # By default we assume the strings are equals addi $t4, $zero, 1 - lw $t5, 28($sp) + lw $t5, 36($sp) sw $t4, 8($t5) while_compare_strings_start: @@ -469,7 +511,7 @@ beq $t2, $t3, while_compare_strings_update # The strings are no equals - lw $t5, 28($sp) + lw $t5, 36($sp) sw $zero, 8($t5) j while_compare_strings_end @@ -477,6 +519,7 @@ addi $t0, $t0, 1 addi $t1, $t1, 1 beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end j while_compare_strings_start while_compare_strings_end: @@ -486,11 +529,11 @@ a_is_type_object: # Equal operation - lw $t0, 36($sp) # Save in $t0 the left operand address - lw $t1, 32($sp) # Save in $t1 the right operand address + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address seq $t2, $t0, $t1 # $t2 = $t0 == $t1 - lw $t0, 28($sp) # $t0 = internal_0 + lw $t0, 36($sp) # $t0 = internal_0 sw $t2, 8($t0) # Setting value in the third word of the Bool object # Jumping to end_of_equal @@ -499,10 +542,156 @@ end_of_equal: # Loading return value in $v1 - lw $v1, 28($sp) + lw $v1, 36($sp) # Freeing space for local variables - addi $sp, $sp, 32 + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 jr $ra @@ -518,15 +707,184 @@ function_abort_at_Object: # Function parameters - # $ra = 4($sp) - # self = 0($sp) + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_2[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_2 = "\n" + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_type_name_at_Object + jal function_type_name_at_Object + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 12($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) # $t0 = internal_3 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string internal_3 + li $v0, 4 + move $a0, $t0 + syscall # Exit program li $v0, 10 syscall # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 jr $ra @@ -542,7 +900,7 @@ lw $t0, 4($sp) # $t0 = self lw $t1, 0($t0) # $t1 = type of self lw $t2, 12($t1) # $t1 = length of the name of self - lw $t3, 16($t1) # $t1 = name of self + la $t3, 16($t1) # $t1 = name of self addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 @@ -552,26 +910,24 @@ la $t4, type_String sw $t4, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - move $t4, $v0 # $t4 = direction of the new string + addi $t4, $v0, 0 # $t4 = direction of the new string addi $t4, $t4, 8 # Pointer to the first character of the string - addi $t0, $t0, 8 # Pointer to the first character of the string in self xor $t5, $t5, $t5 # Initializing counter while_copy_name_start: - beq $t5, $t1, while_copy_name_end - lb $t6, 0($t0) # Loading the character + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character sb $t6, 0($t4) addi $t4, $t4, 1 # Incrementing the pointer to the new string - addi $t0, $t0, 1 # Incrementing the pointer to the string in self + addi $t3, $t3, 1 # Incrementing the pointer to the string in self addi $t5, $t5, 1 # Incrementing counter j while_copy_name_start while_copy_name_end: sb $zero, 0($t4) # Setting the null byte - sw $t4, 0($sp) # Storing the new string in internal_0 + sw $v0, 0($sp) # Storing the new string in internal_0 # Loading return value in $v1 lw $v1, 0($sp) @@ -689,16 +1045,18 @@ xor $t0, $t0, $t0 # Initializing counter while_read_start: - lw $t1, buffer_input($t0) # Loading the byte + lb $t1, buffer_input($t0) # Loading the byte beq $t1, $zero, while_read_end addi $t0, $t0, 1 # Incrementing counter j while_read_start while_read_end: + addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 move $a0, $t0 syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte la $t2, type_String sw $t2, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting length in the second word of the object @@ -708,7 +1066,7 @@ while_copy_from_buffer_start: beq $t4, $t0, while_copy_from_buffer_end - lw $t5, buffer_input($t4) # Loading the byte + lb $t5, buffer_input($t4) # Loading the byte sb $t5, 0($t3) # Storing the byte addi $t3, $t3, 1 # Imcremeenting pointer addi $t4, $t4, 1 # Incrementing counter @@ -735,9 +1093,22 @@ # Reserving space for local variables addi $sp, $sp, -4 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + li $v0, 5 syscall - sw $v0, 0($sp) # Storing the new object in internal_0 + lw $t0, 0($sp) + sw $v0, 8($t0) # Loading return value in $v1 lw $v1, 0($sp) @@ -765,11 +1136,24 @@ # Reserving space for local variables addi $sp, $sp, -4 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + # internal_0 = length of self lw $t0, 4($sp) lw $t1, 4($t0) addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator - sw $t1, 0($sp) + lw $t0, 0($sp) + sw $t1, 8($t0) # Loading return value in $v1 lw $v1, 0($sp) @@ -793,6 +1177,8 @@ lw $t1, 4($sp) lw $t2, 4($t0) # $t2 = length of str1 lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 add $t4, $t2, $t3 # $t4 = length of str1 + str2 addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) @@ -812,7 +1198,7 @@ xor $t6, $t6, $t6 # $t6 = 0 Initializing counter while_copy_str1_start: beq $t6, $t2, while_copy_str1_end - lb $t7, 0($t0) + lb $t7, 8($t0) sb $t7, 0($t5) add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string @@ -823,7 +1209,7 @@ # Copying str2 to the new string while_copy_str2_start: beq $t6, $t4, while_copy_str2_end - lb $t7, 0($t1) + lb $t7, 8($t1) sb $t7, 0($t5) add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string @@ -856,11 +1242,14 @@ # internal_0 = self[i:i + l] lw $t0, 12($sp) # $t0 = address of the string lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring - bge $t4, $t1, substring_out_of_bounds + bgt $t4, $t1, substring_out_of_bounds addi $t3, $t3, 9 li $v0, 9 @@ -924,7 +1313,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 9 sw $t0, 4($v0) # Setting length of the string in the second word of the object sb $zero, 8($v0) # Null-terminator at the end of the string @@ -934,7 +1323,39 @@ # Set attribute population_map of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8758890018919 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8758890018919 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8758890018919 + j object_set_attribute_8758890018919 + int_set_attribute_8758890018919: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.population_map = internal_0 + j end_set_attribute_8758890018919 + bool_set_attribute_8758890018919: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.population_map = internal_0 + j end_set_attribute_8758890018919 + object_set_attribute_8758890018919: sw $t1, 8($t0) # self.population_map = internal_0 + end_set_attribute_8758890018919: # Loading return value in $v1 lw $v1, 4($sp) @@ -953,7 +1374,39 @@ # Set attribute population_map of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($sp) # $t1 = map + beq $t1, $zero, object_set_attribute_8758890018964 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8758890018964 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8758890018964 + j object_set_attribute_8758890018964 + int_set_attribute_8758890018964: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.population_map = map + j end_set_attribute_8758890018964 + bool_set_attribute_8758890018964: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.population_map = map + j end_set_attribute_8758890018964 + object_set_attribute_8758890018964: sw $t1, 8($t0) # self.population_map = map + end_set_attribute_8758890018964: # Loading return value in $v1 lw $v1, 4($sp) @@ -971,7 +1424,38 @@ # Get attribute population_map of self lw $t0, 16($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'population_map' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8758890019018 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8758890019018 + j object_get_attribute_8758890019018 + int_get_attribute_8758890019018: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.population_map + j end_get_attribute_8758890019018 + bool_get_attribute_8758890019018: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.population_map + j end_get_attribute_8758890019018 + object_get_attribute_8758890019018: sw $t1, 12($sp) # internal_0 = population_map + end_get_attribute_8758890019018: # Allocating String li $v0, 9 @@ -981,7 +1465,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 @@ -1046,7 +1530,38 @@ # Get attribute population_map of self lw $t0, 8($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'population_map' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8758890020618 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8758890020618 + j object_get_attribute_8758890020618 + int_get_attribute_8758890020618: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_0 = self.population_map + j end_get_attribute_8758890020618 + bool_get_attribute_8758890020618: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_0 = self.population_map + j end_get_attribute_8758890020618 + object_get_attribute_8758890020618: sw $t1, 4($sp) # internal_0 = population_map + end_get_attribute_8758890020618: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments @@ -1082,7 +1597,38 @@ # Get attribute population_map of self lw $t0, 16($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'population_map' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8758890020672 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8758890020672 + j object_get_attribute_8758890020672 + int_get_attribute_8758890020672: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_0 = self.population_map + j end_get_attribute_8758890020672 + bool_get_attribute_8758890020672: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_0 = self.population_map + j end_get_attribute_8758890020672 + object_get_attribute_8758890020672: sw $t1, 8($sp) # internal_0 = population_map + end_get_attribute_8758890020672: # Allocating Int 1 li $v0, 9 @@ -1135,7 +1681,6 @@ # Reserving space for local variables addi $sp, $sp, -44 - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -1178,33 +1723,20 @@ sw $v1, 40($sp) # internal_3 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 36($sp) - j end_assign - not_is_Bool_or_Int: # internal_1 = internal_3 lw $t0, 28($sp) sw $t0, 36($sp) - end_assign: - # If internal_1 then goto then_8762753578975 + # If internal_1 then goto then_8758890036240 lw $t0, 36($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8762753578975 + beq $t0, $t1, then_8758890036240 - # Jumping to else_8762753578975 - j else_8762753578975 + # Jumping to else_8758890036240 + j else_8758890036240 - then_8762753578975: + then_8758890036240: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments @@ -1268,27 +1800,14 @@ sw $v1, 24($sp) # internal_7 = result of function_cell_at_CellularAutomaton addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_7 lw $t0, 12($sp) sw $t0, 40($sp) - end_assign: - # Jumping to endif_8762753578975 - j endif_8762753578975 + # Jumping to endif_8758890036240 + j endif_8758890036240 - else_8762753578975: + else_8758890036240: # Allocating Int 1 li $v0, 9 @@ -1338,27 +1857,14 @@ sw $v1, 12($sp) # internal_10 = result of function_cell_at_CellularAutomaton addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_10 lw $t0, 0($sp) sw $t0, 40($sp) - end_assign: - # Jumping to endif_8762753578975 - j endif_8762753578975 + # Jumping to endif_8758890036240 + j endif_8758890036240 - endif_8762753578975: + endif_8758890036240: # Loading return value in $v1 lw $v1, 40($sp) @@ -1377,7 +1883,6 @@ # Reserving space for local variables addi $sp, $sp, -44 - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -1452,33 +1957,20 @@ sw $v1, 32($sp) # internal_5 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 20($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 36($sp) - j end_assign - not_is_Bool_or_Int: # internal_1 = internal_5 lw $t0, 20($sp) sw $t0, 36($sp) - end_assign: - # If internal_1 then goto then_8762753555237 + # If internal_1 then goto then_8758890036306 lw $t0, 36($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8762753555237 + beq $t0, $t1, then_8758890036306 - # Jumping to else_8762753555237 - j else_8762753555237 + # Jumping to else_8758890036306 + j else_8758890036306 - then_8762753555237: + then_8758890036306: # Allocating Int 0 li $v0, 9 @@ -1510,27 +2002,14 @@ sw $v1, 24($sp) # internal_7 = result of function_cell_at_CellularAutomaton addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_7 lw $t0, 12($sp) sw $t0, 40($sp) - end_assign: - # Jumping to endif_8762753555237 - j endif_8762753555237 + # Jumping to endif_8758890036306 + j endif_8758890036306 - else_8762753555237: + else_8758890036306: # Allocating Int 1 li $v0, 9 @@ -1580,27 +2059,14 @@ sw $v1, 12($sp) # internal_10 = result of function_cell_at_CellularAutomaton addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_10 lw $t0, 0($sp) sw $t0, 40($sp) - end_assign: - # Jumping to endif_8762753555237 - j endif_8762753555237 + # Jumping to endif_8758890036306 + j endif_8758890036306 - endif_8762753555237: + endif_8758890036306: # Loading return value in $v1 lw $v1, 40($sp) @@ -1619,7 +2085,6 @@ # Reserving space for local variables addi $sp, $sp, -116 - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -1632,7 +2097,6 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 108($sp) # internal_1 = address of allocated object Int - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -1671,7 +2135,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 @@ -1699,33 +2163,20 @@ sw $v1, 100($sp) # internal_6 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 88($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 100($sp) - j end_assign - not_is_Bool_or_Int: # internal_3 = internal_6 lw $t0, 88($sp) sw $t0, 100($sp) - end_assign: - # If internal_3 then goto then_8762753555273 + # If internal_3 then goto then_8758890036342 lw $t0, 100($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8762753555273 + beq $t0, $t1, then_8758890036342 - # Jumping to else_8762753555273 - j else_8762753555273 + # Jumping to else_8758890036342 + j else_8758890036342 - then_8762753555273: + then_8758890036342: # Allocating Int 1 li $v0, 9 @@ -1739,27 +2190,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 84($sp) # internal_7 = address of allocated object Int - lw $t0, 84($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 104($sp) - j end_assign - not_is_Bool_or_Int: # internal_2 = internal_7 lw $t0, 84($sp) sw $t0, 104($sp) - end_assign: - # Jumping to endif_8762753555273 - j endif_8762753555273 + # Jumping to endif_8758890036342 + j endif_8758890036342 - else_8762753555273: + else_8758890036342: # Allocating Int 0 li $v0, 9 @@ -1773,28 +2211,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 80($sp) # internal_8 = address of allocated object Int - lw $t0, 80($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 104($sp) - j end_assign - not_is_Bool_or_Int: # internal_2 = internal_8 lw $t0, 80($sp) sw $t0, 104($sp) - end_assign: - # Jumping to endif_8762753555273 - j endif_8762753555273 - - endif_8762753555273: + # Jumping to endif_8758890036342 + j endif_8758890036342 + endif_8758890036342: # Allocating Bool 0 li $v0, 9 @@ -1834,7 +2258,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 @@ -1862,33 +2286,20 @@ sw $v1, 72($sp) # internal_13 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 60($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 72($sp) - j end_assign - not_is_Bool_or_Int: # internal_10 = internal_13 lw $t0, 60($sp) sw $t0, 72($sp) - end_assign: - # If internal_10 then goto then_8762753555312 + # If internal_10 then goto then_8758890036381 lw $t0, 72($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8762753555312 + beq $t0, $t1, then_8758890036381 - # Jumping to else_8762753555312 - j else_8762753555312 + # Jumping to else_8758890036381 + j else_8758890036381 - then_8762753555312: + then_8758890036381: # Allocating Int 1 li $v0, 9 @@ -1902,27 +2313,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 56($sp) # internal_14 = address of allocated object Int - lw $t0, 56($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 76($sp) - j end_assign - not_is_Bool_or_Int: # internal_9 = internal_14 lw $t0, 56($sp) sw $t0, 76($sp) - end_assign: - # Jumping to endif_8762753555312 - j endif_8762753555312 + # Jumping to endif_8758890036381 + j endif_8758890036381 - else_8762753555312: + else_8758890036381: # Allocating Int 0 li $v0, 9 @@ -1936,27 +2334,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 52($sp) # internal_15 = address of allocated object Int - lw $t0, 52($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 76($sp) - j end_assign - not_is_Bool_or_Int: # internal_9 = internal_15 lw $t0, 52($sp) sw $t0, 76($sp) - end_assign: - # Jumping to endif_8762753555312 - j endif_8762753555312 + # Jumping to endif_8758890036381 + j endif_8758890036381 - endif_8762753555312: + endif_8758890036381: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -1976,7 +2361,6 @@ sw $v1, 60($sp) # internal_16 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -2015,7 +2399,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 @@ -2043,33 +2427,20 @@ sw $v1, 40($sp) # internal_21 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: # internal_18 = internal_21 lw $t0, 28($sp) sw $t0, 40($sp) - end_assign: - # If internal_18 then goto then_8762753555357 + # If internal_18 then goto then_8758890036426 lw $t0, 40($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8762753555357 + beq $t0, $t1, then_8758890036426 - # Jumping to else_8762753555357 - j else_8762753555357 + # Jumping to else_8758890036426 + j else_8758890036426 - then_8762753555357: + then_8758890036426: # Allocating Int 1 li $v0, 9 @@ -2083,27 +2454,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 24($sp) # internal_22 = address of allocated object Int - lw $t0, 24($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: # internal_17 = internal_22 lw $t0, 24($sp) sw $t0, 44($sp) - end_assign: - # Jumping to endif_8762753555357 - j endif_8762753555357 + # Jumping to endif_8758890036426 + j endif_8758890036426 - else_8762753555357: + else_8758890036426: # Allocating Int 0 li $v0, 9 @@ -2117,27 +2475,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 20($sp) # internal_23 = address of allocated object Int - lw $t0, 20($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: # internal_17 = internal_23 lw $t0, 20($sp) sw $t0, 44($sp) - end_assign: - # Jumping to endif_8762753555357 - j endif_8762753555357 + # Jumping to endif_8758890036426 + j endif_8758890036426 - endif_8762753555357: + endif_8758890036426: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -2187,33 +2532,20 @@ sw $v1, 20($sp) # internal_26 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 108($sp) - j end_assign - not_is_Bool_or_Int: # internal_1 = internal_26 lw $t0, 8($sp) sw $t0, 108($sp) - end_assign: - # If internal_1 then goto then_8762753555393 + # If internal_1 then goto then_8758890036462 lw $t0, 108($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8762753555393 + beq $t0, $t1, then_8758890036462 - # Jumping to else_8762753555393 - j else_8762753555393 + # Jumping to else_8758890036462 + j else_8758890036462 - then_8762753555393: + then_8758890036462: # Allocating String li $v0, 9 @@ -2223,7 +2555,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 @@ -2233,27 +2565,14 @@ sw $v0, 4($sp) # internal_27 = "X" - lw $t0, 4($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 112($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_27 lw $t0, 4($sp) sw $t0, 112($sp) - end_assign: - # Jumping to endif_8762753555393 - j endif_8762753555393 + # Jumping to endif_8758890036462 + j endif_8758890036462 - else_8762753555393: + else_8758890036462: # Allocating String li $v0, 9 @@ -2263,7 +2582,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 46 @@ -2273,27 +2592,14 @@ sw $v0, 0($sp) # internal_28 = "." - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 112($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_28 lw $t0, 0($sp) sw $t0, 112($sp) - end_assign: - # Jumping to endif_8762753555393 - j endif_8762753555393 + # Jumping to endif_8758890036462 + j endif_8758890036462 - endif_8762753555393: + endif_8758890036462: # Loading return value in $v1 lw $v1, 112($sp) @@ -2305,42 +2611,55 @@ function_evolve_at_CellularAutomaton: # Function parameters - # $ra = 44($sp) - # self = 40($sp) + # $ra = 40($sp) + # self = 36($sp) # Reserving space for local variables - addi $sp, $sp, -40 + addi $sp, $sp, -36 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # position = address of allocated object Int # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 48($sp) + lw $t0, 44($sp) sw $t0, 0($sp) # Storing self # Calling function function_num_cells_at_CellularAutomaton jal function_num_cells_at_CellularAutomaton lw $ra, 4($sp) - sw $v1, 36($sp) # internal_2 = result of function_num_cells_at_CellularAutomaton + sw $v1, 32($sp) # internal_2 = result of function_num_cells_at_CellularAutomaton addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 32($sp) - j end_assign - not_is_Bool_or_Int: - # num = internal_2 - lw $t0, 28($sp) - sw $t0, 32($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_2 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 40($sp) # num = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating String li $v0, 9 @@ -2350,77 +2669,60 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 9 sw $t0, 4($v0) # Setting length of the string in the second word of the object sb $zero, 8($v0) # Null-terminator at the end of the string - sw $v0, 24($sp) # temp = "" + sw $v0, 20($sp) # temp = "" - while_start_8762753555481: + while_start_8758890036806: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 48($sp) + lw $t0, 44($sp) sw $t0, 4($sp) # Storing position # Argument num - lw $t0, 44($sp) + lw $t0, 40($sp) sw $t0, 0($sp) # Storing num # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 28($sp) # internal_5 = result of function_less_than + sw $v1, 28($sp) # internal_4 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 20($sp) - j end_assign - not_is_Bool_or_Int: - # internal_4 = internal_5 - lw $t0, 16($sp) - sw $t0, 20($sp) - end_assign: - - # If internal_4 then goto while_body_8762753555481 - lw $t0, 20($sp) # Loading the address of the condition + # If internal_4 then goto while_body_8758890036806 + lw $t0, 16($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8762753555481 + beq $t0, $t1, while_body_8758890036806 - # Jumping to while_end_8762753555481 - j while_end_8762753555481 + # Jumping to while_end_8758890036806 + j while_end_8758890036806 - while_body_8762753555481: + while_body_8758890036806: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 52($sp) + lw $t0, 48($sp) sw $t0, 4($sp) # Storing self # Argument position - lw $t0, 48($sp) + lw $t0, 44($sp) sw $t0, 0($sp) # Storing position # Calling function function_cell_at_next_evolution_at_CellularAutomaton jal function_cell_at_next_evolution_at_CellularAutomaton lw $ra, 8($sp) - sw $v1, 24($sp) # internal_6 = result of function_cell_at_next_evolution_at_CellularAutomaton + sw $v1, 24($sp) # internal_5 = result of function_cell_at_next_evolution_at_CellularAutomaton addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -2428,35 +2730,36 @@ sw $ra, 8($sp) # Storing return address # Argument temp - lw $t0, 36($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing temp - # Argument internal_6 + # Argument internal_5 lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_6 + sw $t0, 0($sp) # Storing internal_5 # Calling function function_concat_at_String jal function_concat_at_String lw $ra, 8($sp) - sw $v1, 20($sp) # internal_7 = result of function_concat_at_String + sw $v1, 20($sp) # internal_6 = result of function_concat_at_String addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: - # temp = internal_7 - lw $t0, 8($sp) - sw $t0, 24($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument temp + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing temp + + # Argument internal_6 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 32($sp) # temp = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 li $v0, 9 @@ -2468,82 +2771,157 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_8 = address of allocated object Int + sw $v0, 4($sp) # internal_7 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 48($sp) + lw $t0, 44($sp) sw $t0, 4($sp) # Storing position - # Argument internal_8 + # Argument internal_7 lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_8 + sw $t0, 0($sp) # Storing internal_7 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 12($sp) # internal_9 = result of function_add + sw $v1, 12($sp) # internal_8 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 36($sp) - j end_assign - not_is_Bool_or_Int: - # position = internal_9 - lw $t0, 0($sp) - sw $t0, 36($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_8 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 44($sp) # position = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to while_start_8762753555481 - j while_start_8762753555481 + # Jumping to while_start_8758890036806 + j while_start_8758890036806 - while_end_8762753555481: + while_end_8758890036806: # Set attribute population_map of self - lw $t0, 40($sp) # $t0 = self - lw $t1, 24($sp) # $t1 = temp + lw $t0, 36($sp) # $t0 = self + lw $t1, 20($sp) # $t1 = temp + beq $t1, $zero, object_set_attribute_8758890024650 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8758890024650 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8758890024650 + j object_set_attribute_8758890024650 + int_set_attribute_8758890024650: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.population_map = temp + j end_set_attribute_8758890024650 + bool_set_attribute_8758890024650: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.population_map = temp + j end_set_attribute_8758890024650 + object_set_attribute_8758890024650: sw $t1, 8($t0) # self.population_map = temp + end_set_attribute_8758890024650: # Loading return value in $v1 - lw $v1, 40($sp) + lw $v1, 36($sp) # Freeing space for local variables - addi $sp, $sp, 40 + addi $sp, $sp, 36 jr $ra function___init___at_Main: # Function parameters - # $ra = 4($sp) - # self = 0($sp) + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating NUll to internal_0 + sw $zero, 0($sp) # internal_0 = 0 # Set attribute cells of self - lw $t0, 0($sp) # $t0 = self - sw $zero, 8($t0) # Set the attribute cells of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8758890024557 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8758890024557 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8758890024557 + j object_set_attribute_8758890024557 + int_set_attribute_8758890024557: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.cells = internal_0 + j end_set_attribute_8758890024557 + bool_set_attribute_8758890024557: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.cells = internal_0 + j end_set_attribute_8758890024557 + object_set_attribute_8758890024557: + sw $t1, 8($t0) # self.cells = internal_0 + end_set_attribute_8758890024557: # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 jr $ra function_main_at_Main: # Function parameters - # $ra = 68($sp) - # self = 64($sp) + # $ra = 64($sp) + # self = 60($sp) # Reserving space for local variables - addi $sp, $sp, -64 + addi $sp, $sp, -60 # Allocating CellularAutomaton li $v0, 9 @@ -2552,20 +2930,20 @@ la $t0, type_CellularAutomaton # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 60($sp) # internal_0 = address of allocated object CellularAutomaton + sw $v0, 56($sp) # internal_0 = address of allocated object CellularAutomaton # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 68($sp) + lw $t0, 64($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_CellularAutomaton jal function___init___at_CellularAutomaton lw $ra, 4($sp) - sw $v1, 68($sp) # internal_0 = result of function___init___at_CellularAutomaton + sw $v1, 64($sp) # internal_0 = result of function___init___at_CellularAutomaton addi $sp, $sp, 8 # Freeing space for arguments # Allocating String @@ -2576,7 +2954,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 19 + addi $t0, $zero, 28 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -2638,48 +3016,111 @@ sb $zero, 27($v0) # Null-terminator at the end of the string - sw $v0, 56($sp) # internal_1 = " X " + sw $v0, 52($sp) # internal_1 = " X " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_0 - lw $t0, 72($sp) + lw $t0, 68($sp) sw $t0, 4($sp) # Storing internal_0 # Argument internal_1 - lw $t0, 68($sp) + lw $t0, 64($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function_init_at_CellularAutomaton jal function_init_at_CellularAutomaton lw $ra, 8($sp) - sw $v1, 64($sp) # internal_2 = result of function_init_at_CellularAutomaton + sw $v1, 60($sp) # internal_2 = result of function_init_at_CellularAutomaton addi $sp, $sp, 12 # Freeing space for arguments # Set attribute cells of self - lw $t0, 64($sp) # $t0 = self - lw $t1, 52($sp) # $t1 = internal_2 + lw $t0, 60($sp) # $t0 = self + lw $t1, 48($sp) # $t1 = internal_2 + beq $t1, $zero, object_set_attribute_8758890025075 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8758890025075 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8758890025075 + j object_set_attribute_8758890025075 + int_set_attribute_8758890025075: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.cells = internal_2 + j end_set_attribute_8758890025075 + bool_set_attribute_8758890025075: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.cells = internal_2 + j end_set_attribute_8758890025075 + object_set_attribute_8758890025075: sw $t1, 8($t0) # self.cells = internal_2 + end_set_attribute_8758890025075: # Get attribute cells of self - lw $t0, 64($sp) # Get the address of self + lw $t0, 60($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'cells' from the instance - sw $t1, 48($sp) # internal_3 = cells + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8758890025156 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8758890025156 + j object_get_attribute_8758890025156 + int_get_attribute_8758890025156: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 44($sp) # internal_3 = self.cells + j end_get_attribute_8758890025156 + bool_get_attribute_8758890025156: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 44($sp) # internal_3 = self.cells + j end_get_attribute_8758890025156 + object_get_attribute_8758890025156: + sw $t1, 44($sp) # internal_3 = cells + end_get_attribute_8758890025156: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_3 - lw $t0, 56($sp) + lw $t0, 52($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function_print_at_CellularAutomaton jal function_print_at_CellularAutomaton lw $ra, 4($sp) - sw $v1, 52($sp) # internal_4 = result of function_print_at_CellularAutomaton + sw $v1, 48($sp) # internal_4 = result of function_print_at_CellularAutomaton addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 20 @@ -2692,26 +3133,27 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 20 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_6 = address of allocated object Int + sw $v0, 32($sp) # internal_6 = address of allocated object Int - lw $t0, 36($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: - # countdown = internal_6 - lw $t0, 36($sp) - sw $t0, 40($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument countdown + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing countdown + + # Argument internal_6 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_6 - while_start_8762753555634: + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 48($sp) # countdown = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + while_start_8758890036959: # Allocating Int 0 li $v0, 9 @@ -2723,90 +3165,135 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_8 = address of allocated object Int + sw $v0, 28($sp) # internal_7 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_8 + # Argument internal_7 lw $t0, 40($sp) - sw $t0, 4($sp) # Storing internal_8 + sw $t0, 4($sp) # Storing internal_7 # Argument countdown - lw $t0, 52($sp) + lw $t0, 48($sp) sw $t0, 0($sp) # Storing countdown # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 36($sp) # internal_9 = result of function_less_than + sw $v1, 36($sp) # internal_8 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 24($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 32($sp) - j end_assign - not_is_Bool_or_Int: - # internal_7 = internal_9 - lw $t0, 24($sp) - sw $t0, 32($sp) - end_assign: - - # If internal_7 then goto while_body_8762753555634 - lw $t0, 32($sp) # Loading the address of the condition + # If internal_8 then goto while_body_8758890036959 + lw $t0, 24($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8762753555634 + beq $t0, $t1, while_body_8758890036959 - # Jumping to while_end_8762753555634 - j while_end_8762753555634 + # Jumping to while_end_8758890036959 + j while_end_8758890036959 - while_body_8762753555634: + while_body_8758890036959: # Get attribute cells of self - lw $t0, 64($sp) # Get the address of self + lw $t0, 60($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'cells' from the instance - sw $t1, 20($sp) # internal_10 = cells + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8758890026373 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8758890026373 + j object_get_attribute_8758890026373 + int_get_attribute_8758890026373: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_9 = self.cells + j end_get_attribute_8758890026373 + bool_get_attribute_8758890026373: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_9 = self.cells + j end_get_attribute_8758890026373 + object_get_attribute_8758890026373: + sw $t1, 20($sp) # internal_9 = cells + end_get_attribute_8758890026373: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_10 + # Argument internal_9 lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_10 + sw $t0, 0($sp) # Storing internal_9 # Calling function function_evolve_at_CellularAutomaton jal function_evolve_at_CellularAutomaton lw $ra, 4($sp) - sw $v1, 24($sp) # internal_11 = result of function_evolve_at_CellularAutomaton + sw $v1, 24($sp) # internal_10 = result of function_evolve_at_CellularAutomaton addi $sp, $sp, 8 # Freeing space for arguments # Get attribute cells of self - lw $t0, 64($sp) # Get the address of self + lw $t0, 60($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'cells' from the instance - sw $t1, 12($sp) # internal_12 = cells + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8758890026403 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8758890026403 + j object_get_attribute_8758890026403 + int_get_attribute_8758890026403: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_11 = self.cells + j end_get_attribute_8758890026403 + bool_get_attribute_8758890026403: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_11 = self.cells + j end_get_attribute_8758890026403 + object_get_attribute_8758890026403: + sw $t1, 12($sp) # internal_11 = cells + end_get_attribute_8758890026403: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_12 + # Argument internal_11 lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_12 + sw $t0, 0($sp) # Storing internal_11 # Calling function function_print_at_CellularAutomaton jal function_print_at_CellularAutomaton lw $ra, 4($sp) - sw $v1, 16($sp) # internal_13 = result of function_print_at_CellularAutomaton + sw $v1, 16($sp) # internal_12 = result of function_print_at_CellularAutomaton addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 1 @@ -2819,53 +3306,54 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_14 = address of allocated object Int + sw $v0, 4($sp) # internal_13 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument countdown - lw $t0, 52($sp) + lw $t0, 48($sp) sw $t0, 4($sp) # Storing countdown - # Argument internal_14 + # Argument internal_13 lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_14 + sw $t0, 0($sp) # Storing internal_13 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 12($sp) # internal_15 = result of function_sub + sw $v1, 12($sp) # internal_14 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: - # countdown = internal_15 - lw $t0, 0($sp) - sw $t0, 40($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument countdown + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing countdown + + # Argument internal_14 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_14 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 48($sp) # countdown = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to while_start_8762753555634 - j while_start_8762753555634 + # Jumping to while_start_8758890036959 + j while_start_8758890036959 - while_end_8762753555634: + while_end_8758890036959: # Loading return value in $v1 - lw $v1, 64($sp) + lw $v1, 60($sp) # Freeing space for local variables - addi $sp, $sp, 64 + addi $sp, $sp, 60 jr $ra diff --git a/tests/codegen/complex.mips b/tests/codegen/complex.mips new file mode 100644 index 000000000..73308518c --- /dev/null +++ b/tests/codegen/complex.mips @@ -0,0 +1,2944 @@ +.data + type_Object: .word 8 + type_Object_inherits_from: .word 0 + type_Object_attributes: .word 0 + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + type_Object_abort_message: .asciiz "Abort called from class Object\n" + + type_IO: .word 8 + type_IO_inherits_from: .word type_Object + type_IO_attributes: .word 0 + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + type_IO_abort_message: .asciiz "Abort called from class IO\n" + + type_Int: .word 8 + type_Int_inherits_from: .word type_Object + type_Int_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + type_Int_abort_message: .asciiz "Abort called from class Int\n" + + type_String: .word 8 + type_String_inherits_from: .word type_Object + type_String_attributes: .word 0 + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + type_String_abort_message: .asciiz "Abort called from class String\n" + + type_Bool: .word 8 + type_Bool_inherits_from: .word type_Object + type_Bool_attributes: .word 0 + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + type_Bool_abort_message: .asciiz "Abort called from class Bool\n" + + type_Main: .word 8 + type_Main_inherits_from: .word type_IO + type_Main_attributes: .word 0 + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + type_Main_abort_message: .asciiz "Abort called from class Main\n" + + type_Complex: .word 16 + type_Complex_inherits_from: .word type_IO + type_Complex_attributes: .word 2 + type_Complex_name_size: .word 7 + type_Complex_name: .asciiz "Complex" + type_Complex_abort_message: .asciiz "Abort called from class Complex\n" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_0 = address of allocated object Int + + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_5 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_6 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_7 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_8 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_9 = address of allocated object Int + + # internal_7 = EqualAddress(internal_3, internal_4) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_8 = EqualAddress(internal_3, internal_5) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_9 = EqualAddress(internal_3, internal_6) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_7 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_8 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_9 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 44($sp) + lw $t0, 8($t0) + lw $t1, 40($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 36($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 44($sp) + lw $t1, 40($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 36($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 36($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 36($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_2[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_2 = "\n" + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_type_name_at_Object + jal function_type_name_at_Object + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 12($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) # $t0 = internal_3 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string internal_3 + li $v0, 4 + move $a0, $t0 + syscall + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 12($t1) # $t1 = length of the name of self + la $t3, 16($t1) # $t1 = name of self + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t4, $v0, 0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t3, $t3, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $v0, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the string x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lb $t1, buffer_input($t0) # Loading the byte + beq $t1, $zero, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lb $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + lw $t0, 0($sp) + sw $t1, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 8($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 8($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 + lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) + lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bgt $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 64($sp) + # self = 60($sp) + + # Reserving space for local variables + addi $sp, $sp, -60 + + # Allocating Complex + li $v0, 9 + lw $a0, type_Complex + syscall + la $t0, type_Complex # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 52($sp) # internal_1 = address of allocated object Complex + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_Complex + jal function___init___at_Complex + lw $ra, 4($sp) + sw $v1, 60($sp) # internal_1 = result of function___init___at_Complex + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_2 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_1 + lw $t0, 68($sp) + sw $t0, 8($sp) # Storing internal_1 + + # Argument internal_2 + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_init_at_Complex + jal function_init_at_Complex + lw $ra, 12($sp) + sw $v1, 56($sp) # internal_4 = result of function_init_at_Complex + addi $sp, $sp, 16 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument c + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing c + + # Argument internal_4 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 68($sp) # c = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_6 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument c + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing c + + # Calling function function_reflect_X_at_Complex + jal function_reflect_X_at_Complex + lw $ra, 4($sp) + sw $v1, 36($sp) # internal_7 = result of function_reflect_X_at_Complex + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_7 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_reflect_Y_at_Complex + jal function_reflect_Y_at_Complex + lw $ra, 4($sp) + sw $v1, 32($sp) # internal_8 = result of function_reflect_Y_at_Complex + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument c + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing c + + # Calling function function_reflect_0_at_Complex + jal function_reflect_0_at_Complex + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_9 = result of function_reflect_0_at_Complex + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_8 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument internal_9 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_10 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_6 = internal_10 + lw $t0, 16($sp) + sw $t0, 32($sp) + + # If internal_6 then goto then_8730036302602 + lw $t0, 32($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8730036302602 + + # Jumping to else_8730036302602 + j else_8730036302602 + + then_8730036302602: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 12 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 61 + sb $t0, 8($v0) # internal_11[0] = '=' + + addi $t0, $zero, 41 + sb $t0, 9($v0) # internal_11[1] = ')' + + addi $t0, $zero, 10 + sb $t0, 10($v0) # internal_11[2] = '\n' + + sb $zero, 11($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_11 = "=)\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_11 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_12 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_5 = internal_12 + lw $t0, 8($sp) + sw $t0, 36($sp) + + # Jumping to endif_8730036302602 + j endif_8730036302602 + + else_8730036302602: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 12 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 61 + sb $t0, 8($v0) # internal_13[0] = '=' + + addi $t0, $zero, 40 + sb $t0, 9($v0) # internal_13[1] = '(' + + addi $t0, $zero, 10 + sb $t0, 10($v0) # internal_13[2] = '\n' + + sb $zero, 11($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_13 = "=(\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_13 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_14 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_5 = internal_14 + lw $t0, 0($sp) + sw $t0, 36($sp) + + # Jumping to endif_8730036302602 + j endif_8730036302602 + + endif_8730036302602: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 60 + + jr $ra + + function___init___at_Complex: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_0 = address of allocated object Int + + # Set attribute x of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8730036284642 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8730036284642 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8730036284642 + j object_set_attribute_8730036284642 + int_set_attribute_8730036284642: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.x = internal_0 + j end_set_attribute_8730036284642 + bool_set_attribute_8730036284642: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.x = internal_0 + j end_set_attribute_8730036284642 + object_set_attribute_8730036284642: + sw $t1, 8($t0) # self.x = internal_0 + end_set_attribute_8730036284642: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_1 = address of allocated object Int + + # Set attribute y of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8730036284663 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8730036284663 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8730036284663 + j object_set_attribute_8730036284663 + int_set_attribute_8730036284663: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.y = internal_1 + j end_set_attribute_8730036284663 + bool_set_attribute_8730036284663: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.y = internal_1 + j end_set_attribute_8730036284663 + object_set_attribute_8730036284663: + sw $t1, 12($t0) # self.y = internal_1 + end_set_attribute_8730036284663: + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_init_at_Complex: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + # a = 20($sp) + # b = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Get attribute x of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8730036284986 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8730036284986 + j object_get_attribute_8730036284986 + int_get_attribute_8730036284986: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.x + j end_get_attribute_8730036284986 + bool_get_attribute_8730036284986: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.x + j end_get_attribute_8730036284986 + object_get_attribute_8730036284986: + sw $t1, 12($sp) # internal_0 = x + end_get_attribute_8730036284986: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument a + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing a + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_1 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute y of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8730036285025 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8730036285025 + j object_get_attribute_8730036285025 + int_get_attribute_8730036285025: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_2 = self.y + j end_get_attribute_8730036285025 + bool_get_attribute_8730036285025: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_2 = self.y + j end_get_attribute_8730036285025 + object_get_attribute_8730036285025: + sw $t1, 4($sp) # internal_2 = y + end_get_attribute_8730036285025: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument b + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing b + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_print_at_Complex: + # Function parameters + # $ra = 64($sp) + # self = 60($sp) + + # Reserving space for local variables + addi $sp, $sp, -60 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_1 = address of allocated object Int + + # Get attribute y of self + lw $t0, 60($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8730036285103 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8730036285103 + j object_get_attribute_8730036285103 + int_get_attribute_8730036285103: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 48($sp) # internal_2 = self.y + j end_get_attribute_8730036285103 + bool_get_attribute_8730036285103: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 48($sp) # internal_2 = self.y + j end_get_attribute_8730036285103 + object_get_attribute_8730036285103: + sw $t1, 48($sp) # internal_2 = y + end_get_attribute_8730036285103: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_4 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_4 + lw $t0, 40($sp) + sw $t0, 52($sp) + + # If internal_1 then goto then_8730036302746 + lw $t0, 52($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8730036302746 + + # Jumping to else_8730036302746 + j else_8730036302746 + + then_8730036302746: + + # Get attribute x of self + lw $t0, 60($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8730036285956 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8730036285956 + j object_get_attribute_8730036285956 + int_get_attribute_8730036285956: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 36($sp) # internal_5 = self.x + j end_get_attribute_8730036285956 + bool_get_attribute_8730036285956: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 36($sp) # internal_5 = self.x + j end_get_attribute_8730036285956 + object_get_attribute_8730036285956: + sw $t1, 36($sp) # internal_5 = x + end_get_attribute_8730036285956: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_5 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_out_int_at_IO + jal function_out_int_at_IO + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_6 = result of function_out_int_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_0 = internal_6 + lw $t0, 32($sp) + sw $t0, 56($sp) + + # Jumping to endif_8730036302746 + j endif_8730036302746 + + else_8730036302746: + + # Get attribute x of self + lw $t0, 60($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8730036286049 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8730036286049 + j object_get_attribute_8730036286049 + int_get_attribute_8730036286049: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_7 = self.x + j end_get_attribute_8730036286049 + bool_get_attribute_8730036286049: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_7 = self.x + j end_get_attribute_8730036286049 + object_get_attribute_8730036286049: + sw $t1, 28($sp) # internal_7 = x + end_get_attribute_8730036286049: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_7 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_out_int_at_IO + jal function_out_int_at_IO + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_8 = result of function_out_int_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 43 + sb $t0, 8($v0) # internal_9[0] = '+' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_9 = "+" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_8 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument internal_9 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_10 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute y of self + lw $t0, 60($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8730036286097 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8730036286097 + j object_get_attribute_8730036286097 + int_get_attribute_8730036286097: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_11 = self.y + j end_get_attribute_8730036286097 + bool_get_attribute_8730036286097: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_11 = self.y + j end_get_attribute_8730036286097 + object_get_attribute_8730036286097: + sw $t1, 12($sp) # internal_11 = y + end_get_attribute_8730036286097: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_11 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_out_int_at_IO + jal function_out_int_at_IO + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_12 = result of function_out_int_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 73 + sb $t0, 8($v0) # internal_13[0] = 'I' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_13 = "I" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_12 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_12 + + # Argument internal_13 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_14 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_0 = internal_14 + lw $t0, 0($sp) + sw $t0, 56($sp) + + # Jumping to endif_8730036302746 + j endif_8730036302746 + + endif_8730036302746: + + # Loading return value in $v1 + lw $v1, 56($sp) + + # Freeing space for local variables + addi $sp, $sp, 60 + + jr $ra + + function_reflect_0_at_Complex: + # Function parameters + # $ra = 52($sp) + # self = 48($sp) + + # Reserving space for local variables + addi $sp, $sp, -48 + + # Get attribute x of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8730036286196 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8730036286196 + j object_get_attribute_8730036286196 + int_get_attribute_8730036286196: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 44($sp) # internal_0 = self.x + j end_get_attribute_8730036286196 + bool_get_attribute_8730036286196: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 44($sp) # internal_0 = self.x + j end_get_attribute_8730036286196 + object_get_attribute_8730036286196: + sw $t1, 44($sp) # internal_0 = x + end_get_attribute_8730036286196: + + # Get attribute x of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8730036286736 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8730036286736 + j object_get_attribute_8730036286736 + int_get_attribute_8730036286736: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_1 = self.x + j end_get_attribute_8730036286736 + bool_get_attribute_8730036286736: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_1 = self.x + j end_get_attribute_8730036286736 + object_get_attribute_8730036286736: + sw $t1, 40($sp) # internal_1 = x + end_get_attribute_8730036286736: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_2 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_3 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_4 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_3 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_4 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument internal_2 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_4 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_4 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_5 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute y of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8730036286835 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8730036286835 + j object_get_attribute_8730036286835 + int_get_attribute_8730036286835: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_6 = self.y + j end_get_attribute_8730036286835 + bool_get_attribute_8730036286835: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_6 = self.y + j end_get_attribute_8730036286835 + object_get_attribute_8730036286835: + sw $t1, 20($sp) # internal_6 = y + end_get_attribute_8730036286835: + + # Get attribute y of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8730036286859 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8730036286859 + j object_get_attribute_8730036286859 + int_get_attribute_8730036286859: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_7 = self.y + j end_get_attribute_8730036286859 + bool_get_attribute_8730036286859: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_7 = self.y + j end_get_attribute_8730036286859 + object_get_attribute_8730036286859: + sw $t1, 16($sp) # internal_7 = y + end_get_attribute_8730036286859: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_8 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_9 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_10 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_7 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_7 + + # Argument internal_9 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_10 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_8 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_10 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_6 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_6 + + # Argument internal_10 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_11 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 48($sp) + + # Freeing space for local variables + addi $sp, $sp, 48 + + jr $ra + + function_reflect_X_at_Complex: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Get attribute y of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8730036287492 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8730036287492 + j object_get_attribute_8730036287492 + int_get_attribute_8730036287492: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_0 = self.y + j end_get_attribute_8730036287492 + bool_get_attribute_8730036287492: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_0 = self.y + j end_get_attribute_8730036287492 + object_get_attribute_8730036287492: + sw $t1, 20($sp) # internal_0 = y + end_get_attribute_8730036287492: + + # Get attribute y of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8730036287516 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8730036287516 + j object_get_attribute_8730036287516 + int_get_attribute_8730036287516: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_1 = self.y + j end_get_attribute_8730036287516 + bool_get_attribute_8730036287516: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_1 = self.y + j end_get_attribute_8730036287516 + object_get_attribute_8730036287516: + sw $t1, 16($sp) # internal_1 = y + end_get_attribute_8730036287516: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_2 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_3 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_4 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_4 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_5 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_reflect_Y_at_Complex: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Get attribute x of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8730036287633 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8730036287633 + j object_get_attribute_8730036287633 + int_get_attribute_8730036287633: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_0 = self.x + j end_get_attribute_8730036287633 + bool_get_attribute_8730036287633: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_0 = self.x + j end_get_attribute_8730036287633 + object_get_attribute_8730036287633: + sw $t1, 20($sp) # internal_0 = x + end_get_attribute_8730036287633: + + # Get attribute x of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8730036287657 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8730036287657 + j object_get_attribute_8730036287657 + int_get_attribute_8730036287657: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_1 = self.x + j end_get_attribute_8730036287657 + bool_get_attribute_8730036287657: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_1 = self.x + j end_get_attribute_8730036287657 + object_get_attribute_8730036287657: + sw $t1, 16($sp) # internal_1 = x + end_get_attribute_8730036287657: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_2 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_3 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_4 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_4 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_5 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_main_at_Main + jal function_main_at_Main + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/fib.mips b/tests/codegen/fib.mips index b3a18db93..0ab3ea35b 100644 --- a/tests/codegen/fib.mips +++ b/tests/codegen/fib.mips @@ -4,36 +4,42 @@ type_Object_attributes: .word 0 type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" + type_Object_abort_message: .asciiz "Abort called from class Object\n" type_IO: .word 8 type_IO_inherits_from: .word type_Object type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" + type_IO_abort_message: .asciiz "Abort called from class IO\n" type_Int: .word 8 type_Int_inherits_from: .word type_Object type_Int_attributes: .word 0 type_Int_name_size: .word 3 type_Int_name: .asciiz "Int" + type_Int_abort_message: .asciiz "Abort called from class Int\n" type_String: .word 8 type_String_inherits_from: .word type_Object type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" + type_String_abort_message: .asciiz "Abort called from class String\n" type_Bool: .word 8 type_Bool_inherits_from: .word type_Object type_Bool_attributes: .word 0 type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" + type_Bool_abort_message: .asciiz "Abort called from class Bool\n" type_Main: .word 8 type_Main_inherits_from: .word type_IO type_Main_attributes: .word 0 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" + type_Main_abort_message: .asciiz "Abort called from class Main\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -316,12 +322,12 @@ function_equal: # Function parameters - # $ra = 40($sp) - # a = 36($sp) - # b = 32($sp) + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) # Reserving space for local variables - addi $sp, $sp, -32 + addi $sp, $sp, -40 # Allocating Bool 0 li $v0, 9 @@ -333,22 +339,57 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_0 = address of allocated object Int + sw $v0, 36($sp) # internal_0 = address of allocated object Int - # internal_1 = typeof a that is the first word of the object - lw $t0, 36($sp) - lw $t1, 0($t0) - sw $t1, 24($sp) + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) - # internal_2 = direction of Int + # internal_4 = direction of Int la $t0, type_Int sw $t0, 20($sp) - # internal_3 = direction of Bool + # internal_5 = direction of Bool la $t0, type_Bool sw $t0, 16($sp) - # internal_4 = direction of String + # internal_6 = direction of String la $t0, type_String sw $t0, 12($sp) @@ -362,7 +403,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_5 = address of allocated object Int + sw $v0, 8($sp) # internal_7 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -374,7 +415,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_6 = address of allocated object Int + sw $v0, 4($sp) # internal_8 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -386,42 +427,42 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_7 = address of allocated object Int + sw $v0, 0($sp) # internal_9 = address of allocated object Int - # internal_5 = EqualAddress(internal_1, internal_2) + # internal_7 = EqualAddress(internal_3, internal_4) lw $t0, 24($sp) lw $t1, 20($sp) seq $t2, $t0, $t1 lw $t0, 8($sp) sw $t2, 8($t0) - # internal_6 = EqualAddress(internal_1, internal_3) + # internal_8 = EqualAddress(internal_3, internal_5) lw $t0, 24($sp) lw $t1, 16($sp) seq $t2, $t0, $t1 lw $t0, 4($sp) sw $t2, 8($t0) - # internal_7 = EqualAddress(internal_1, internal_4) + # internal_9 = EqualAddress(internal_3, internal_6) lw $t0, 24($sp) lw $t1, 12($sp) seq $t2, $t0, $t1 lw $t0, 0($sp) sw $t2, 8($t0) - # If internal_5 then goto a_is_type_int_or_bool + # If internal_7 then goto a_is_type_int_or_bool lw $t0, 8($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison beq $t0, $t1, a_is_type_int_or_bool - # If internal_6 then goto a_is_type_int_or_bool + # If internal_8 then goto a_is_type_int_or_bool lw $t0, 4($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison beq $t0, $t1, a_is_type_int_or_bool - # If internal_7 then goto a_is_type_string + # If internal_9 then goto a_is_type_string lw $t0, 0($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison @@ -433,12 +474,12 @@ a_is_type_int_or_bool: # internal_0 = EqualInt(a, b) - lw $t0, 36($sp) + lw $t0, 44($sp) lw $t0, 8($t0) - lw $t1, 32($sp) + lw $t1, 40($sp) lw $t1, 8($t1) seq $t2, $t0, $t1 - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t2, 8($t0) # Jumping to end_of_equal @@ -447,14 +488,14 @@ a_is_type_string: # internal_0 = EqualStr(a, b) - lw $t0, 36($sp) - lw $t1, 32($sp) + lw $t0, 44($sp) + lw $t1, 40($sp) addi $t0, $t0, 8 addi $t1, $t1, 8 # By default we assume the strings are equals addi $t4, $zero, 1 - lw $t5, 28($sp) + lw $t5, 36($sp) sw $t4, 8($t5) while_compare_strings_start: @@ -463,7 +504,7 @@ beq $t2, $t3, while_compare_strings_update # The strings are no equals - lw $t5, 28($sp) + lw $t5, 36($sp) sw $zero, 8($t5) j while_compare_strings_end @@ -471,6 +512,7 @@ addi $t0, $t0, 1 addi $t1, $t1, 1 beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end j while_compare_strings_start while_compare_strings_end: @@ -480,11 +522,11 @@ a_is_type_object: # Equal operation - lw $t0, 36($sp) # Save in $t0 the left operand address - lw $t1, 32($sp) # Save in $t1 the right operand address + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address seq $t2, $t0, $t1 # $t2 = $t0 == $t1 - lw $t0, 28($sp) # $t0 = internal_0 + lw $t0, 36($sp) # $t0 = internal_0 sw $t2, 8($t0) # Setting value in the third word of the Bool object # Jumping to end_of_equal @@ -493,10 +535,156 @@ end_of_equal: # Loading return value in $v1 - lw $v1, 28($sp) + lw $v1, 36($sp) # Freeing space for local variables - addi $sp, $sp, 32 + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 jr $ra @@ -512,15 +700,184 @@ function_abort_at_Object: # Function parameters - # $ra = 4($sp) - # self = 0($sp) + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_2[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_2 = "\n" + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_type_name_at_Object + jal function_type_name_at_Object + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 12($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) # $t0 = internal_3 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string internal_3 + li $v0, 4 + move $a0, $t0 + syscall # Exit program li $v0, 10 syscall # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 jr $ra @@ -536,7 +893,7 @@ lw $t0, 4($sp) # $t0 = self lw $t1, 0($t0) # $t1 = type of self lw $t2, 12($t1) # $t1 = length of the name of self - lw $t3, 16($t1) # $t1 = name of self + la $t3, 16($t1) # $t1 = name of self addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 @@ -546,26 +903,24 @@ la $t4, type_String sw $t4, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - move $t4, $v0 # $t4 = direction of the new string + addi $t4, $v0, 0 # $t4 = direction of the new string addi $t4, $t4, 8 # Pointer to the first character of the string - addi $t0, $t0, 8 # Pointer to the first character of the string in self xor $t5, $t5, $t5 # Initializing counter while_copy_name_start: - beq $t5, $t1, while_copy_name_end - lb $t6, 0($t0) # Loading the character + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character sb $t6, 0($t4) addi $t4, $t4, 1 # Incrementing the pointer to the new string - addi $t0, $t0, 1 # Incrementing the pointer to the string in self + addi $t3, $t3, 1 # Incrementing the pointer to the string in self addi $t5, $t5, 1 # Incrementing counter j while_copy_name_start while_copy_name_end: sb $zero, 0($t4) # Setting the null byte - sw $t4, 0($sp) # Storing the new string in internal_0 + sw $v0, 0($sp) # Storing the new string in internal_0 # Loading return value in $v1 lw $v1, 0($sp) @@ -683,16 +1038,18 @@ xor $t0, $t0, $t0 # Initializing counter while_read_start: - lw $t1, buffer_input($t0) # Loading the byte + lb $t1, buffer_input($t0) # Loading the byte beq $t1, $zero, while_read_end addi $t0, $t0, 1 # Incrementing counter j while_read_start while_read_end: + addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 move $a0, $t0 syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte la $t2, type_String sw $t2, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting length in the second word of the object @@ -702,7 +1059,7 @@ while_copy_from_buffer_start: beq $t4, $t0, while_copy_from_buffer_end - lw $t5, buffer_input($t4) # Loading the byte + lb $t5, buffer_input($t4) # Loading the byte sb $t5, 0($t3) # Storing the byte addi $t3, $t3, 1 # Imcremeenting pointer addi $t4, $t4, 1 # Incrementing counter @@ -729,9 +1086,22 @@ # Reserving space for local variables addi $sp, $sp, -4 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + li $v0, 5 syscall - sw $v0, 0($sp) # Storing the new object in internal_0 + lw $t0, 0($sp) + sw $v0, 8($t0) # Loading return value in $v1 lw $v1, 0($sp) @@ -759,11 +1129,24 @@ # Reserving space for local variables addi $sp, $sp, -4 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + # internal_0 = length of self lw $t0, 4($sp) lw $t1, 4($t0) addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator - sw $t1, 0($sp) + lw $t0, 0($sp) + sw $t1, 8($t0) # Loading return value in $v1 lw $v1, 0($sp) @@ -787,6 +1170,8 @@ lw $t1, 4($sp) lw $t2, 4($t0) # $t2 = length of str1 lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 add $t4, $t2, $t3 # $t4 = length of str1 + str2 addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) @@ -806,7 +1191,7 @@ xor $t6, $t6, $t6 # $t6 = 0 Initializing counter while_copy_str1_start: beq $t6, $t2, while_copy_str1_end - lb $t7, 0($t0) + lb $t7, 8($t0) sb $t7, 0($t5) add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string @@ -817,7 +1202,7 @@ # Copying str2 to the new string while_copy_str2_start: beq $t6, $t4, while_copy_str2_end - lb $t7, 0($t1) + lb $t7, 8($t1) sb $t7, 0($t5) add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string @@ -850,11 +1235,14 @@ # internal_0 = self[i:i + l] lw $t0, 12($sp) # $t0 = address of the string lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring - bge $t4, $t1, substring_out_of_bounds + bgt $t4, $t1, substring_out_of_bounds addi $t3, $t3, 9 li $v0, 9 @@ -928,7 +1316,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 38 + addi $t0, $zero, 47 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 69 @@ -1125,7 +1513,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 @@ -1163,12 +1551,12 @@ function_fib_at_Main: # Function parameters - # $ra = 64($sp) - # self = 60($sp) - # i = 56($sp) + # $ra = 60($sp) + # self = 56($sp) + # i = 52($sp) # Reserving space for local variables - addi $sp, $sp, -56 + addi $sp, $sp, -52 # Allocating Int 1 li $v0, 9 @@ -1180,24 +1568,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_1 = address of allocated object Int + sw $v0, 44($sp) # internal_1 = address of allocated object Int - lw $t0, 48($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: - # a = internal_1 - lw $t0, 48($sp) - sw $t0, 52($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument a + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing a + + # Argument internal_1 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 60($sp) # a = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 0 li $v0, 9 @@ -1209,24 +1598,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_3 = address of allocated object Int + sw $v0, 36($sp) # internal_3 = address of allocated object Int - lw $t0, 40($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: - # b = internal_3 - lw $t0, 40($sp) - sw $t0, 44($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument b + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing b + + # Argument internal_3 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 52($sp) # b = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 0 li $v0, 9 @@ -1238,26 +1628,27 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_5 = address of allocated object Int + sw $v0, 28($sp) # internal_5 = address of allocated object Int - lw $t0, 32($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 36($sp) - j end_assign - not_is_Bool_or_Int: - # c = internal_5 - lw $t0, 32($sp) - sw $t0, 36($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument c + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing c + + # Argument internal_5 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_5 - while_start_8736343769098: + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 44($sp) # c = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + while_start_8738767818289: # Allocating Int 0 li $v0, 9 @@ -1269,24 +1660,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_7 = address of allocated object Int + sw $v0, 24($sp) # internal_6 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 68($sp) + lw $t0, 64($sp) sw $t0, 4($sp) # Storing i - # Argument internal_7 + # Argument internal_6 lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_7 + sw $t0, 0($sp) # Storing internal_6 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 32($sp) # internal_8 = result of function_equal + sw $v1, 32($sp) # internal_7 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -1299,80 +1690,84 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_9 = address of allocated object Int + sw $v0, 16($sp) # internal_8 = address of allocated object Int - # Xor operation - lw $t0, 20($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 16($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - lw $t0, 12($sp) # $t0 = internal_10 - sw $t2, 8($t0) # Setting value in the third word of the Int object + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_9 = address of allocated object Int - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 28($sp) - j end_assign - not_is_Bool_or_Int: - # internal_6 = internal_10 - lw $t0, 12($sp) - sw $t0, 28($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # If internal_6 then goto while_body_8736343769098 - lw $t0, 28($sp) # Loading the address of the condition + # Argument internal_7 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_7 + + # Argument internal_8 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_9 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_9 then goto while_body_8738767818289 + lw $t0, 12($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8736343769098 + beq $t0, $t1, while_body_8738767818289 - # Jumping to while_end_8736343769098 - j while_end_8736343769098 + # Jumping to while_end_8738767818289 + j while_end_8738767818289 - while_body_8736343769098: + while_body_8738767818289: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument a - lw $t0, 64($sp) + lw $t0, 60($sp) sw $t0, 4($sp) # Storing a # Argument b - lw $t0, 56($sp) + lw $t0, 52($sp) sw $t0, 0($sp) # Storing b # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 20($sp) # internal_11 = result of function_add + sw $v1, 20($sp) # internal_10 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 36($sp) - j end_assign - not_is_Bool_or_Int: - # c = internal_11 - lw $t0, 8($sp) - sw $t0, 36($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument c + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing c + + # Argument internal_10 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 44($sp) # c = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 li $v0, 9 @@ -1384,87 +1779,90 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_12 = address of allocated object Int + sw $v0, 4($sp) # internal_11 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 68($sp) + lw $t0, 64($sp) sw $t0, 4($sp) # Storing i - # Argument internal_12 + # Argument internal_11 lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_12 + sw $t0, 0($sp) # Storing internal_11 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 12($sp) # internal_13 = result of function_sub + sw $v1, 12($sp) # internal_12 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 56($sp) - j end_assign - not_is_Bool_or_Int: - # i = internal_13 - lw $t0, 0($sp) - sw $t0, 56($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument i + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_12 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 64($sp) # i = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument b lw $t0, 52($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: - # b = a - lw $t0, 52($sp) - sw $t0, 44($sp) - end_assign: + sw $t0, 4($sp) # Storing b - lw $t0, 36($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: - # a = c - lw $t0, 36($sp) - sw $t0, 52($sp) - end_assign: + # Argument a + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing a - # Jumping to while_start_8736343769098 - j while_start_8736343769098 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 52($sp) # b = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - while_end_8736343769098: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument a + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing a + + # Argument c + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing c + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 60($sp) # a = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to while_start_8738767818289 + j while_start_8738767818289 + + while_end_8738767818289: # Loading return value in $v1 - lw $v1, 36($sp) + lw $v1, 32($sp) # Freeing space for local variables - addi $sp, $sp, 56 + addi $sp, $sp, 52 jr $ra diff --git a/tests/codegen/graph.mips b/tests/codegen/graph.mips index 480851612..5c9a68a6b 100644 --- a/tests/codegen/graph.mips +++ b/tests/codegen/graph.mips @@ -4,90 +4,105 @@ type_Object_attributes: .word 0 type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" + type_Object_abort_message: .asciiz "Abort called from class Object\n" type_IO: .word 8 type_IO_inherits_from: .word type_Object type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" + type_IO_abort_message: .asciiz "Abort called from class IO\n" type_Int: .word 8 type_Int_inherits_from: .word type_Object type_Int_attributes: .word 0 type_Int_name_size: .word 3 type_Int_name: .asciiz "Int" + type_Int_abort_message: .asciiz "Abort called from class Int\n" type_String: .word 8 type_String_inherits_from: .word type_Object type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" + type_String_abort_message: .asciiz "Abort called from class String\n" type_Bool: .word 8 type_Bool_inherits_from: .word type_Object type_Bool_attributes: .word 0 type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" + type_Bool_abort_message: .asciiz "Abort called from class Bool\n" type_Graph: .word 16 type_Graph_inherits_from: .word type_Object type_Graph_attributes: .word 2 type_Graph_name_size: .word 5 type_Graph_name: .asciiz "Graph" + type_Graph_abort_message: .asciiz "Abort called from class Graph\n" type_Vertice: .word 16 type_Vertice_inherits_from: .word type_IO type_Vertice_attributes: .word 2 type_Vertice_name_size: .word 7 type_Vertice_name: .asciiz "Vertice" + type_Vertice_abort_message: .asciiz "Abort called from class Vertice\n" type_Edge: .word 20 type_Edge_inherits_from: .word type_IO type_Edge_attributes: .word 3 type_Edge_name_size: .word 4 type_Edge_name: .asciiz "Edge" + type_Edge_abort_message: .asciiz "Abort called from class Edge\n" type_EList: .word 12 type_EList_inherits_from: .word type_IO type_EList_attributes: .word 1 type_EList_name_size: .word 5 type_EList_name: .asciiz "EList" + type_EList_abort_message: .asciiz "Abort called from class EList\n" type_ECons: .word 16 type_ECons_inherits_from: .word type_EList type_ECons_attributes: .word 2 type_ECons_name_size: .word 5 type_ECons_name: .asciiz "ECons" + type_ECons_abort_message: .asciiz "Abort called from class ECons\n" type_VList: .word 12 type_VList_inherits_from: .word type_IO type_VList_attributes: .word 1 type_VList_name_size: .word 5 type_VList_name: .asciiz "VList" + type_VList_abort_message: .asciiz "Abort called from class VList\n" type_VCons: .word 16 type_VCons_inherits_from: .word type_VList type_VCons_attributes: .word 2 type_VCons_name_size: .word 5 type_VCons_name: .asciiz "VCons" + type_VCons_abort_message: .asciiz "Abort called from class VCons\n" type_Parse: .word 16 type_Parse_inherits_from: .word type_IO type_Parse_attributes: .word 2 type_Parse_name_size: .word 5 type_Parse_name: .asciiz "Parse" + type_Parse_abort_message: .asciiz "Abort called from class Parse\n" type_Main: .word 20 type_Main_inherits_from: .word type_Parse type_Main_attributes: .word 3 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" + type_Main_abort_message: .asciiz "Abort called from class Main\n" type_BoolOp: .word 8 type_BoolOp_inherits_from: .word type_Object type_BoolOp_attributes: .word 0 type_BoolOp_name_size: .word 6 type_BoolOp_name: .asciiz "BoolOp" + type_BoolOp_abort_message: .asciiz "Abort called from class BoolOp\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -370,12 +385,12 @@ function_equal: # Function parameters - # $ra = 40($sp) - # a = 36($sp) - # b = 32($sp) + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) # Reserving space for local variables - addi $sp, $sp, -32 + addi $sp, $sp, -40 # Allocating Bool 0 li $v0, 9 @@ -387,22 +402,57 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_0 = address of allocated object Int + sw $v0, 36($sp) # internal_0 = address of allocated object Int - # internal_1 = typeof a that is the first word of the object - lw $t0, 36($sp) - lw $t1, 0($t0) - sw $t1, 24($sp) + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) - # internal_2 = direction of Int + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int la $t0, type_Int sw $t0, 20($sp) - # internal_3 = direction of Bool + # internal_5 = direction of Bool la $t0, type_Bool sw $t0, 16($sp) - # internal_4 = direction of String + # internal_6 = direction of String la $t0, type_String sw $t0, 12($sp) @@ -416,7 +466,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_5 = address of allocated object Int + sw $v0, 8($sp) # internal_7 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -428,7 +478,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_6 = address of allocated object Int + sw $v0, 4($sp) # internal_8 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -440,42 +490,42 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_7 = address of allocated object Int + sw $v0, 0($sp) # internal_9 = address of allocated object Int - # internal_5 = EqualAddress(internal_1, internal_2) + # internal_7 = EqualAddress(internal_3, internal_4) lw $t0, 24($sp) lw $t1, 20($sp) seq $t2, $t0, $t1 lw $t0, 8($sp) sw $t2, 8($t0) - # internal_6 = EqualAddress(internal_1, internal_3) + # internal_8 = EqualAddress(internal_3, internal_5) lw $t0, 24($sp) lw $t1, 16($sp) seq $t2, $t0, $t1 lw $t0, 4($sp) sw $t2, 8($t0) - # internal_7 = EqualAddress(internal_1, internal_4) + # internal_9 = EqualAddress(internal_3, internal_6) lw $t0, 24($sp) lw $t1, 12($sp) seq $t2, $t0, $t1 lw $t0, 0($sp) sw $t2, 8($t0) - # If internal_5 then goto a_is_type_int_or_bool + # If internal_7 then goto a_is_type_int_or_bool lw $t0, 8($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison beq $t0, $t1, a_is_type_int_or_bool - # If internal_6 then goto a_is_type_int_or_bool + # If internal_8 then goto a_is_type_int_or_bool lw $t0, 4($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison beq $t0, $t1, a_is_type_int_or_bool - # If internal_7 then goto a_is_type_string + # If internal_9 then goto a_is_type_string lw $t0, 0($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison @@ -487,12 +537,12 @@ a_is_type_int_or_bool: # internal_0 = EqualInt(a, b) - lw $t0, 36($sp) + lw $t0, 44($sp) lw $t0, 8($t0) - lw $t1, 32($sp) + lw $t1, 40($sp) lw $t1, 8($t1) seq $t2, $t0, $t1 - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t2, 8($t0) # Jumping to end_of_equal @@ -501,14 +551,14 @@ a_is_type_string: # internal_0 = EqualStr(a, b) - lw $t0, 36($sp) - lw $t1, 32($sp) + lw $t0, 44($sp) + lw $t1, 40($sp) addi $t0, $t0, 8 addi $t1, $t1, 8 # By default we assume the strings are equals addi $t4, $zero, 1 - lw $t5, 28($sp) + lw $t5, 36($sp) sw $t4, 8($t5) while_compare_strings_start: @@ -517,7 +567,7 @@ beq $t2, $t3, while_compare_strings_update # The strings are no equals - lw $t5, 28($sp) + lw $t5, 36($sp) sw $zero, 8($t5) j while_compare_strings_end @@ -525,6 +575,7 @@ addi $t0, $t0, 1 addi $t1, $t1, 1 beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end j while_compare_strings_start while_compare_strings_end: @@ -534,11 +585,11 @@ a_is_type_object: # Equal operation - lw $t0, 36($sp) # Save in $t0 the left operand address - lw $t1, 32($sp) # Save in $t1 the right operand address + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address seq $t2, $t0, $t1 # $t2 = $t0 == $t1 - lw $t0, 28($sp) # $t0 = internal_0 + lw $t0, 36($sp) # $t0 = internal_0 sw $t2, 8($t0) # Setting value in the third word of the Bool object # Jumping to end_of_equal @@ -547,10 +598,156 @@ end_of_equal: # Loading return value in $v1 - lw $v1, 28($sp) + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) # Freeing space for local variables - addi $sp, $sp, 32 + addi $sp, $sp, 28 jr $ra @@ -566,15 +763,184 @@ function_abort_at_Object: # Function parameters - # $ra = 4($sp) - # self = 0($sp) + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_2[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_2 = "\n" + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_type_name_at_Object + jal function_type_name_at_Object + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 12($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) # $t0 = internal_3 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string internal_3 + li $v0, 4 + move $a0, $t0 + syscall # Exit program li $v0, 10 syscall # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 jr $ra @@ -590,7 +956,7 @@ lw $t0, 4($sp) # $t0 = self lw $t1, 0($t0) # $t1 = type of self lw $t2, 12($t1) # $t1 = length of the name of self - lw $t3, 16($t1) # $t1 = name of self + la $t3, 16($t1) # $t1 = name of self addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 @@ -600,26 +966,24 @@ la $t4, type_String sw $t4, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - move $t4, $v0 # $t4 = direction of the new string + addi $t4, $v0, 0 # $t4 = direction of the new string addi $t4, $t4, 8 # Pointer to the first character of the string - addi $t0, $t0, 8 # Pointer to the first character of the string in self xor $t5, $t5, $t5 # Initializing counter while_copy_name_start: - beq $t5, $t1, while_copy_name_end - lb $t6, 0($t0) # Loading the character + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character sb $t6, 0($t4) addi $t4, $t4, 1 # Incrementing the pointer to the new string - addi $t0, $t0, 1 # Incrementing the pointer to the string in self + addi $t3, $t3, 1 # Incrementing the pointer to the string in self addi $t5, $t5, 1 # Incrementing counter j while_copy_name_start while_copy_name_end: sb $zero, 0($t4) # Setting the null byte - sw $t4, 0($sp) # Storing the new string in internal_0 + sw $v0, 0($sp) # Storing the new string in internal_0 # Loading return value in $v1 lw $v1, 0($sp) @@ -737,16 +1101,18 @@ xor $t0, $t0, $t0 # Initializing counter while_read_start: - lw $t1, buffer_input($t0) # Loading the byte + lb $t1, buffer_input($t0) # Loading the byte beq $t1, $zero, while_read_end addi $t0, $t0, 1 # Incrementing counter j while_read_start while_read_end: + addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 move $a0, $t0 syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte la $t2, type_String sw $t2, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting length in the second word of the object @@ -756,7 +1122,7 @@ while_copy_from_buffer_start: beq $t4, $t0, while_copy_from_buffer_end - lw $t5, buffer_input($t4) # Loading the byte + lb $t5, buffer_input($t4) # Loading the byte sb $t5, 0($t3) # Storing the byte addi $t3, $t3, 1 # Imcremeenting pointer addi $t4, $t4, 1 # Incrementing counter @@ -783,9 +1149,22 @@ # Reserving space for local variables addi $sp, $sp, -4 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + li $v0, 5 syscall - sw $v0, 0($sp) # Storing the new object in internal_0 + lw $t0, 0($sp) + sw $v0, 8($t0) # Loading return value in $v1 lw $v1, 0($sp) @@ -813,11 +1192,24 @@ # Reserving space for local variables addi $sp, $sp, -4 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + # internal_0 = length of self lw $t0, 4($sp) lw $t1, 4($t0) addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator - sw $t1, 0($sp) + lw $t0, 0($sp) + sw $t1, 8($t0) # Loading return value in $v1 lw $v1, 0($sp) @@ -841,6 +1233,8 @@ lw $t1, 4($sp) lw $t2, 4($t0) # $t2 = length of str1 lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 add $t4, $t2, $t3 # $t4 = length of str1 + str2 addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) @@ -860,7 +1254,7 @@ xor $t6, $t6, $t6 # $t6 = 0 Initializing counter while_copy_str1_start: beq $t6, $t2, while_copy_str1_end - lb $t7, 0($t0) + lb $t7, 8($t0) sb $t7, 0($t5) add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string @@ -871,7 +1265,7 @@ # Copying str2 to the new string while_copy_str2_start: beq $t6, $t4, while_copy_str2_end - lb $t7, 0($t1) + lb $t7, 8($t1) sb $t7, 0($t5) add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string @@ -904,11 +1298,14 @@ # internal_0 = self[i:i + l] lw $t0, 12($sp) # $t0 = address of the string lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring - bge $t4, $t1, substring_out_of_bounds + bgt $t4, $t1, substring_out_of_bounds addi $t3, $t3, 9 li $v0, 9 @@ -990,7 +1387,39 @@ # Set attribute vertices of self lw $t0, 8($sp) # $t0 = self lw $t1, 4($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8756104435866 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104435866 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104435866 + j object_set_attribute_8756104435866 + int_set_attribute_8756104435866: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.vertices = internal_0 + j end_set_attribute_8756104435866 + bool_set_attribute_8756104435866: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.vertices = internal_0 + j end_set_attribute_8756104435866 + object_set_attribute_8756104435866: sw $t1, 8($t0) # self.vertices = internal_0 + end_set_attribute_8756104435866: # Allocating EList li $v0, 9 @@ -1018,7 +1447,39 @@ # Set attribute edges of self lw $t0, 8($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8756104435899 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104435899 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104435899 + j object_set_attribute_8756104435899 + int_set_attribute_8756104435899: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.edges = internal_1 + j end_set_attribute_8756104435899 + bool_set_attribute_8756104435899: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.edges = internal_1 + j end_set_attribute_8756104435899 + object_set_attribute_8756104435899: sw $t1, 12($t0) # self.edges = internal_1 + end_set_attribute_8756104435899: # Loading return value in $v1 lw $v1, 8($sp) @@ -1054,7 +1515,38 @@ # Get attribute edges of self lw $t0, 24($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'edges' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8756104437029 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8756104437029 + j object_get_attribute_8756104437029 + int_get_attribute_8756104437029: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_1 = self.edges + j end_get_attribute_8756104437029 + bool_get_attribute_8756104437029: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_1 = self.edges + j end_get_attribute_8756104437029 + object_get_attribute_8756104437029: sw $t1, 12($sp) # internal_1 = edges + end_get_attribute_8756104437029: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -1077,12 +1569,75 @@ # Set attribute edges of self lw $t0, 24($sp) # $t0 = self lw $t1, 8($sp) # $t1 = internal_2 + beq $t1, $zero, object_set_attribute_8756104435956 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104435956 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104435956 + j object_set_attribute_8756104435956 + int_set_attribute_8756104435956: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.edges = internal_2 + j end_set_attribute_8756104435956 + bool_set_attribute_8756104435956: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.edges = internal_2 + j end_set_attribute_8756104435956 + object_set_attribute_8756104435956: sw $t1, 12($t0) # self.edges = internal_2 + end_set_attribute_8756104435956: # Get attribute vertices of self lw $t0, 24($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'vertices' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8756104437071 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8756104437071 + j object_get_attribute_8756104437071 + int_get_attribute_8756104437071: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_3 = self.vertices + j end_get_attribute_8756104437071 + bool_get_attribute_8756104437071: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_3 = self.vertices + j end_get_attribute_8756104437071 + object_get_attribute_8756104437071: sw $t1, 4($sp) # internal_3 = vertices + end_get_attribute_8756104437071: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -1105,7 +1660,39 @@ # Set attribute vertices of self lw $t0, 24($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_4 + beq $t1, $zero, object_set_attribute_8756104437050 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104437050 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104437050 + j object_set_attribute_8756104437050 + int_set_attribute_8756104437050: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.vertices = internal_4 + j end_set_attribute_8756104437050 + bool_set_attribute_8756104437050: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.vertices = internal_4 + j end_set_attribute_8756104437050 + object_set_attribute_8756104437050: sw $t1, 8($t0) # self.vertices = internal_4 + end_set_attribute_8756104437050: # Loading return value in $v1 lw $v1, 0($sp) @@ -1126,7 +1713,38 @@ # Get attribute edges of self lw $t0, 8($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'edges' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8756104437107 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8756104437107 + j object_get_attribute_8756104437107 + int_get_attribute_8756104437107: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_0 = self.edges + j end_get_attribute_8756104437107 + bool_get_attribute_8756104437107: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_0 = self.edges + j end_get_attribute_8756104437107 + object_get_attribute_8756104437107: sw $t1, 4($sp) # internal_0 = edges + end_get_attribute_8756104437107: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments @@ -1161,7 +1779,38 @@ # Get attribute vertices of self lw $t0, 8($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'vertices' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8756104437155 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8756104437155 + j object_get_attribute_8756104437155 + int_get_attribute_8756104437155: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_0 = self.vertices + j end_get_attribute_8756104437155 + bool_get_attribute_8756104437155: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_0 = self.vertices + j end_get_attribute_8756104437155 + object_get_attribute_8756104437155: sw $t1, 4($sp) # internal_0 = vertices + end_get_attribute_8756104437155: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments @@ -1208,7 +1857,39 @@ # Set attribute num of self lw $t0, 8($sp) # $t0 = self lw $t1, 4($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8756104437212 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104437212 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104437212 + j object_set_attribute_8756104437212 + int_set_attribute_8756104437212: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.num = internal_0 + j end_set_attribute_8756104437212 + bool_set_attribute_8756104437212: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.num = internal_0 + j end_set_attribute_8756104437212 + object_set_attribute_8756104437212: sw $t1, 8($t0) # self.num = internal_0 + end_set_attribute_8756104437212: # Allocating EList li $v0, 9 @@ -1236,7 +1917,39 @@ # Set attribute out of self lw $t0, 8($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8756104437233 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104437233 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104437233 + j object_set_attribute_8756104437233 + int_set_attribute_8756104437233: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.out = internal_1 + j end_set_attribute_8756104437233 + bool_set_attribute_8756104437233: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.out = internal_1 + j end_set_attribute_8756104437233 + object_set_attribute_8756104437233: sw $t1, 12($t0) # self.out = internal_1 + end_set_attribute_8756104437233: # Loading return value in $v1 lw $v1, 8($sp) @@ -1257,7 +1970,38 @@ # Get attribute out of self lw $t0, 4($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'out' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8756104437529 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8756104437529 + j object_get_attribute_8756104437529 + int_get_attribute_8756104437529: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.out + j end_get_attribute_8756104437529 + bool_get_attribute_8756104437529: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.out + j end_get_attribute_8756104437529 + object_get_attribute_8756104437529: sw $t1, 0($sp) # internal_0 = out + end_get_attribute_8756104437529: # Loading return value in $v1 lw $v1, 0($sp) @@ -1278,7 +2022,38 @@ # Get attribute num of self lw $t0, 4($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'num' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8756104437559 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8756104437559 + j object_get_attribute_8756104437559 + int_get_attribute_8756104437559: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.num + j end_get_attribute_8756104437559 + bool_get_attribute_8756104437559: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.num + j end_get_attribute_8756104437559 + object_get_attribute_8756104437559: sw $t1, 0($sp) # internal_0 = num + end_get_attribute_8756104437559: # Loading return value in $v1 lw $v1, 0($sp) @@ -1297,7 +2072,39 @@ # Set attribute num of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($sp) # $t1 = n + beq $t1, $zero, object_set_attribute_8756104437610 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104437610 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104437610 + j object_set_attribute_8756104437610 + int_set_attribute_8756104437610: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.num = n + j end_set_attribute_8756104437610 + bool_set_attribute_8756104437610: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.num = n + j end_set_attribute_8756104437610 + object_set_attribute_8756104437610: sw $t1, 8($t0) # self.num = n + end_set_attribute_8756104437610: # Loading return value in $v1 lw $v1, 4($sp) @@ -1316,7 +2123,38 @@ # Get attribute out of self lw $t0, 12($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'out' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8756104437667 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8756104437667 + j object_get_attribute_8756104437667 + int_get_attribute_8756104437667: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_0 = self.out + j end_get_attribute_8756104437667 + bool_get_attribute_8756104437667: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_0 = self.out + j end_get_attribute_8756104437667 + object_get_attribute_8756104437667: sw $t1, 4($sp) # internal_0 = out + end_get_attribute_8756104437667: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -1339,7 +2177,39 @@ # Set attribute out of self lw $t0, 12($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8756104437643 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104437643 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104437643 + j object_set_attribute_8756104437643 + int_set_attribute_8756104437643: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.out = internal_1 + j end_set_attribute_8756104437643 + bool_set_attribute_8756104437643: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.out = internal_1 + j end_set_attribute_8756104437643 + object_set_attribute_8756104437643: sw $t1, 12($t0) # self.out = internal_1 + end_set_attribute_8756104437643: # Loading return value in $v1 lw $v1, 12($sp) @@ -1360,7 +2230,38 @@ # Get attribute num of self lw $t0, 16($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'num' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8756104437721 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8756104437721 + j object_get_attribute_8756104437721 + int_get_attribute_8756104437721: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.num + j end_get_attribute_8756104437721 + bool_get_attribute_8756104437721: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.num + j end_get_attribute_8756104437721 + object_get_attribute_8756104437721: sw $t1, 12($sp) # internal_0 = num + end_get_attribute_8756104437721: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -1383,7 +2284,38 @@ # Get attribute out of self lw $t0, 16($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'out' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8756104437754 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8756104437754 + j object_get_attribute_8756104437754 + int_get_attribute_8756104437754: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_2 = self.out + j end_get_attribute_8756104437754 + bool_get_attribute_8756104437754: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_2 = self.out + j end_get_attribute_8756104437754 + object_get_attribute_8756104437754: sw $t1, 4($sp) # internal_2 = out + end_get_attribute_8756104437754: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments @@ -1430,7 +2362,39 @@ # Set attribute from of self lw $t0, 12($sp) # $t0 = self lw $t1, 8($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8756104438056 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104438056 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104438056 + j object_set_attribute_8756104438056 + int_set_attribute_8756104438056: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.from = internal_0 + j end_set_attribute_8756104438056 + bool_set_attribute_8756104438056: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.from = internal_0 + j end_set_attribute_8756104438056 + object_set_attribute_8756104438056: sw $t1, 8($t0) # self.from = internal_0 + end_set_attribute_8756104438056: # Allocating Int 0 li $v0, 9 @@ -1447,7 +2411,39 @@ # Set attribute to of self lw $t0, 12($sp) # $t0 = self lw $t1, 4($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8756104438077 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104438077 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104438077 + j object_set_attribute_8756104438077 + int_set_attribute_8756104438077: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.to = internal_1 + j end_set_attribute_8756104438077 + bool_set_attribute_8756104438077: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.to = internal_1 + j end_set_attribute_8756104438077 + object_set_attribute_8756104438077: sw $t1, 12($t0) # self.to = internal_1 + end_set_attribute_8756104438077: # Allocating Int 0 li $v0, 9 @@ -1464,7 +2460,39 @@ # Set attribute weight of self lw $t0, 12($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_2 + beq $t1, $zero, object_set_attribute_8756104438098 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104438098 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104438098 + j object_set_attribute_8756104438098 + int_set_attribute_8756104438098: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.weight = internal_2 + j end_set_attribute_8756104438098 + bool_set_attribute_8756104438098: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.weight = internal_2 + j end_set_attribute_8756104438098 + object_set_attribute_8756104438098: sw $t1, 16($t0) # self.weight = internal_2 + end_set_attribute_8756104438098: # Loading return value in $v1 lw $v1, 12($sp) @@ -1485,17 +2513,113 @@ # Set attribute from of self lw $t0, 12($sp) # $t0 = self lw $t1, 8($sp) # $t1 = f + beq $t1, $zero, object_set_attribute_8756104438155 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104438155 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104438155 + j object_set_attribute_8756104438155 + int_set_attribute_8756104438155: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.from = f + j end_set_attribute_8756104438155 + bool_set_attribute_8756104438155: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.from = f + j end_set_attribute_8756104438155 + object_set_attribute_8756104438155: sw $t1, 8($t0) # self.from = f + end_set_attribute_8756104438155: # Set attribute to of self lw $t0, 12($sp) # $t0 = self lw $t1, 4($sp) # $t1 = t + beq $t1, $zero, object_set_attribute_8756104438164 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104438164 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104438164 + j object_set_attribute_8756104438164 + int_set_attribute_8756104438164: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.to = t + j end_set_attribute_8756104438164 + bool_set_attribute_8756104438164: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.to = t + j end_set_attribute_8756104438164 + object_set_attribute_8756104438164: sw $t1, 12($t0) # self.to = t + end_set_attribute_8756104438164: # Set attribute weight of self lw $t0, 12($sp) # $t0 = self lw $t1, 0($sp) # $t1 = w + beq $t1, $zero, object_set_attribute_8756104438173 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104438173 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104438173 + j object_set_attribute_8756104438173 + int_set_attribute_8756104438173: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.weight = w + j end_set_attribute_8756104438173 + bool_set_attribute_8756104438173: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.weight = w + j end_set_attribute_8756104438173 + object_set_attribute_8756104438173: sw $t1, 16($t0) # self.weight = w + end_set_attribute_8756104438173: # Loading return value in $v1 lw $v1, 12($sp) @@ -1518,7 +2642,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 2 + addi $t0, $zero, 11 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -1552,7 +2676,38 @@ # Get attribute from of self lw $t0, 48($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'from' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8756104438251 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8756104438251 + j object_get_attribute_8756104438251 + int_get_attribute_8756104438251: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 36($sp) # internal_2 = self.from + j end_get_attribute_8756104438251 + bool_get_attribute_8756104438251: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 36($sp) # internal_2 = self.from + j end_get_attribute_8756104438251 + object_get_attribute_8756104438251: sw $t1, 36($sp) # internal_2 = from + end_get_attribute_8756104438251: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -1580,7 +2735,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 44 @@ -1611,7 +2766,38 @@ # Get attribute to of self lw $t0, 48($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'to' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8756104439351 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8756104439351 + j object_get_attribute_8756104439351 + int_get_attribute_8756104439351: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_6 = self.to + j end_get_attribute_8756104439351 + bool_get_attribute_8756104439351: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_6 = self.to + j end_get_attribute_8756104439351 + object_get_attribute_8756104439351: sw $t1, 20($sp) # internal_6 = to + end_get_attribute_8756104439351: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -1639,7 +2825,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 41 @@ -1670,7 +2856,38 @@ # Get attribute weight of self lw $t0, 48($sp) # Get the address of self lw $t1, 16($t0) # Get the attribute 'weight' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8756104439423 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8756104439423 + j object_get_attribute_8756104439423 + int_get_attribute_8756104439423: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_10 = self.weight + j end_get_attribute_8756104439423 + bool_get_attribute_8756104439423: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_10 = self.weight + j end_get_attribute_8756104439423 + object_get_attribute_8756104439423: sw $t1, 4($sp) # internal_10 = weight + end_get_attribute_8756104439423: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -1700,15 +2917,57 @@ function___init___at_EList: # Function parameters - # $ra = 4($sp) - # self = 0($sp) + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating NUll to internal_0 + sw $zero, 0($sp) # internal_0 = 0 # Set attribute car of self - lw $t0, 0($sp) # $t0 = self - sw $zero, 8($t0) # Set the attribute car of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8756104439468 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104439468 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104439468 + j object_set_attribute_8756104439468 + int_set_attribute_8756104439468: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.car = internal_0 + j end_set_attribute_8756104439468 + bool_set_attribute_8756104439468: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.car = internal_0 + j end_set_attribute_8756104439468 + object_set_attribute_8756104439468: + sw $t1, 8($t0) # self.car = internal_0 + end_set_attribute_8756104439468: # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 jr $ra @@ -1765,7 +3024,38 @@ # Get attribute car of self lw $t0, 8($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'car' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8756104439815 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8756104439815 + j object_get_attribute_8756104439815 + int_get_attribute_8756104439815: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_1 = self.car + j end_get_attribute_8756104439815 + bool_get_attribute_8756104439815: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_1 = self.car + j end_get_attribute_8756104439815 + object_get_attribute_8756104439815: sw $t1, 0($sp) # internal_1 = car + end_get_attribute_8756104439815: # Loading return value in $v1 lw $v1, 0($sp) @@ -1876,7 +3166,6 @@ # Reserving space for local variables addi $sp, $sp, -28 - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -1903,55 +3192,29 @@ sw $v1, 24($sp) # internal_2 = result of function_isNil_at_EList addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 20($sp) - j end_assign - not_is_Bool_or_Int: # internal_1 = internal_2 lw $t0, 16($sp) sw $t0, 20($sp) - end_assign: - # If internal_1 then goto then_8763448684201 + # If internal_1 then goto then_8756104470233 lw $t0, 20($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8763448684201 + beq $t0, $t1, then_8756104470233 - # Jumping to else_8763448684201 - j else_8763448684201 + # Jumping to else_8756104470233 + j else_8756104470233 - then_8763448684201: + then_8756104470233: - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = l lw $t0, 28($sp) sw $t0, 24($sp) - end_assign: - # Jumping to endif_8763448684201 - j endif_8763448684201 + # Jumping to endif_8756104470233 + j endif_8756104470233 - else_8763448684201: + else_8756104470233: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments @@ -2017,27 +3280,14 @@ sw $v1, 12($sp) # internal_6 = result of function_cons_at_EList addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_6 lw $t0, 0($sp) sw $t0, 24($sp) - end_assign: - # Jumping to endif_8763448684201 - j endif_8763448684201 + # Jumping to endif_8756104470233 + j endif_8756104470233 - endif_8763448684201: + endif_8756104470233: # Loading return value in $v1 lw $v1, 24($sp) @@ -2063,7 +3313,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 @@ -2101,19 +3351,97 @@ function___init___at_ECons: # Function parameters - # $ra = 4($sp) - # self = 0($sp) + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating NUll to internal_0 + sw $zero, 4($sp) # internal_0 = 0 # Set attribute car of self - lw $t0, 0($sp) # $t0 = self - sw $zero, 8($t0) # Set the attribute car of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8756104440754 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104440754 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104440754 + j object_set_attribute_8756104440754 + int_set_attribute_8756104440754: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.car = internal_0 + j end_set_attribute_8756104440754 + bool_set_attribute_8756104440754: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.car = internal_0 + j end_set_attribute_8756104440754 + object_set_attribute_8756104440754: + sw $t1, 8($t0) # self.car = internal_0 + end_set_attribute_8756104440754: + + # Allocating NUll to internal_1 + sw $zero, 0($sp) # internal_1 = 0 # Set attribute cdr of self - lw $t0, 0($sp) # $t0 = self - sw $zero, 12($t0) # Set the attribute cdr of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8756104440775 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104440775 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104440775 + j object_set_attribute_8756104440775 + int_set_attribute_8756104440775: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.cdr = internal_1 + j end_set_attribute_8756104440775 + bool_set_attribute_8756104440775: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.cdr = internal_1 + j end_set_attribute_8756104440775 + object_set_attribute_8756104440775: + sw $t1, 12($t0) # self.cdr = internal_1 + end_set_attribute_8756104440775: # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 jr $ra @@ -2156,11 +3484,42 @@ # Get attribute car of self lw $t0, 4($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'car' from the instance - sw $t1, 0($sp) # internal_0 = car - - # Loading return value in $v1 - lw $v1, 0($sp) - + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8756104440829 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8756104440829 + j object_get_attribute_8756104440829 + int_get_attribute_8756104440829: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.car + j end_get_attribute_8756104440829 + bool_get_attribute_8756104440829: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.car + j end_get_attribute_8756104440829 + object_get_attribute_8756104440829: + sw $t1, 0($sp) # internal_0 = car + end_get_attribute_8756104440829: + + # Loading return value in $v1 + lw $v1, 0($sp) + # Freeing space for local variables addi $sp, $sp, 4 @@ -2177,7 +3536,38 @@ # Get attribute cdr of self lw $t0, 4($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'cdr' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8756104441119 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8756104441119 + j object_get_attribute_8756104441119 + int_get_attribute_8756104441119: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.cdr + j end_get_attribute_8756104441119 + bool_get_attribute_8756104441119: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.cdr + j end_get_attribute_8756104441119 + object_get_attribute_8756104441119: sw $t1, 0($sp) # internal_0 = cdr + end_get_attribute_8756104441119: # Loading return value in $v1 lw $v1, 0($sp) @@ -2197,12 +3587,76 @@ # Set attribute car of self lw $t0, 8($sp) # $t0 = self lw $t1, 4($sp) # $t1 = e + beq $t1, $zero, object_set_attribute_8756104441176 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104441176 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104441176 + j object_set_attribute_8756104441176 + int_set_attribute_8756104441176: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.car = e + j end_set_attribute_8756104441176 + bool_set_attribute_8756104441176: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.car = e + j end_set_attribute_8756104441176 + object_set_attribute_8756104441176: sw $t1, 8($t0) # self.car = e + end_set_attribute_8756104441176: # Set attribute cdr of self lw $t0, 8($sp) # $t0 = self lw $t1, 0($sp) # $t1 = rest + beq $t1, $zero, object_set_attribute_8756104441185 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104441185 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104441185 + j object_set_attribute_8756104441185 + int_set_attribute_8756104441185: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.cdr = rest + j end_set_attribute_8756104441185 + bool_set_attribute_8756104441185: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.cdr = rest + j end_set_attribute_8756104441185 + object_set_attribute_8756104441185: sw $t1, 12($t0) # self.cdr = rest + end_set_attribute_8756104441185: # Loading return value in $v1 lw $v1, 8($sp) @@ -2220,7 +3674,38 @@ # Get attribute car of self lw $t0, 16($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'car' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8756104441224 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8756104441224 + j object_get_attribute_8756104441224 + int_get_attribute_8756104441224: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.car + j end_get_attribute_8756104441224 + bool_get_attribute_8756104441224: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.car + j end_get_attribute_8756104441224 + object_get_attribute_8756104441224: sw $t1, 12($sp) # internal_0 = car + end_get_attribute_8756104441224: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments @@ -2239,7 +3724,38 @@ # Get attribute cdr of self lw $t0, 16($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'cdr' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8756104441254 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8756104441254 + j object_get_attribute_8756104441254 + int_get_attribute_8756104441254: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_2 = self.cdr + j end_get_attribute_8756104441254 + bool_get_attribute_8756104441254: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_2 = self.cdr + j end_get_attribute_8756104441254 + object_get_attribute_8756104441254: sw $t1, 4($sp) # internal_2 = cdr + end_get_attribute_8756104441254: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments @@ -2265,15 +3781,57 @@ function___init___at_VList: # Function parameters - # $ra = 4($sp) - # self = 0($sp) + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating NUll to internal_0 + sw $zero, 0($sp) # internal_0 = 0 # Set attribute car of self - lw $t0, 0($sp) # $t0 = self - sw $zero, 8($t0) # Set the attribute car of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8756104441296 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104441296 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104441296 + j object_set_attribute_8756104441296 + int_set_attribute_8756104441296: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.car = internal_0 + j end_set_attribute_8756104441296 + bool_set_attribute_8756104441296: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.car = internal_0 + j end_set_attribute_8756104441296 + object_set_attribute_8756104441296: + sw $t1, 8($t0) # self.car = internal_0 + end_set_attribute_8756104441296: # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 jr $ra @@ -2330,7 +3888,38 @@ # Get attribute car of self lw $t0, 8($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'car' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8756104441899 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8756104441899 + j object_get_attribute_8756104441899 + int_get_attribute_8756104441899: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_1 = self.car + j end_get_attribute_8756104441899 + bool_get_attribute_8756104441899: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_1 = self.car + j end_get_attribute_8756104441899 + object_get_attribute_8756104441899: sw $t1, 0($sp) # internal_1 = car + end_get_attribute_8756104441899: # Loading return value in $v1 lw $v1, 0($sp) @@ -2448,7 +4037,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 @@ -2486,19 +4075,97 @@ function___init___at_VCons: # Function parameters - # $ra = 4($sp) - # self = 0($sp) + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating NUll to internal_0 + sw $zero, 4($sp) # internal_0 = 0 # Set attribute car of self - lw $t0, 0($sp) # $t0 = self - sw $zero, 8($t0) # Set the attribute car of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8756104442103 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104442103 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104442103 + j object_set_attribute_8756104442103 + int_set_attribute_8756104442103: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.car = internal_0 + j end_set_attribute_8756104442103 + bool_set_attribute_8756104442103: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.car = internal_0 + j end_set_attribute_8756104442103 + object_set_attribute_8756104442103: + sw $t1, 8($t0) # self.car = internal_0 + end_set_attribute_8756104442103: + + # Allocating NUll to internal_1 + sw $zero, 0($sp) # internal_1 = 0 # Set attribute cdr of self - lw $t0, 0($sp) # $t0 = self - sw $zero, 12($t0) # Set the attribute cdr of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8756104442643 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104442643 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104442643 + j object_set_attribute_8756104442643 + int_set_attribute_8756104442643: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.cdr = internal_1 + j end_set_attribute_8756104442643 + bool_set_attribute_8756104442643: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.cdr = internal_1 + j end_set_attribute_8756104442643 + object_set_attribute_8756104442643: + sw $t1, 12($t0) # self.cdr = internal_1 + end_set_attribute_8756104442643: # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 jr $ra @@ -2541,7 +4208,38 @@ # Get attribute car of self lw $t0, 4($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'car' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8756104442694 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8756104442694 + j object_get_attribute_8756104442694 + int_get_attribute_8756104442694: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.car + j end_get_attribute_8756104442694 + bool_get_attribute_8756104442694: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.car + j end_get_attribute_8756104442694 + object_get_attribute_8756104442694: sw $t1, 0($sp) # internal_0 = car + end_get_attribute_8756104442694: # Loading return value in $v1 lw $v1, 0($sp) @@ -2562,7 +4260,38 @@ # Get attribute cdr of self lw $t0, 4($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'cdr' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8756104442724 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8756104442724 + j object_get_attribute_8756104442724 + int_get_attribute_8756104442724: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.cdr + j end_get_attribute_8756104442724 + bool_get_attribute_8756104442724: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.cdr + j end_get_attribute_8756104442724 + object_get_attribute_8756104442724: sw $t1, 0($sp) # internal_0 = cdr + end_get_attribute_8756104442724: # Loading return value in $v1 lw $v1, 0($sp) @@ -2582,12 +4311,76 @@ # Set attribute car of self lw $t0, 8($sp) # $t0 = self lw $t1, 4($sp) # $t1 = v + beq $t1, $zero, object_set_attribute_8756104442781 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104442781 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104442781 + j object_set_attribute_8756104442781 + int_set_attribute_8756104442781: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.car = v + j end_set_attribute_8756104442781 + bool_set_attribute_8756104442781: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.car = v + j end_set_attribute_8756104442781 + object_set_attribute_8756104442781: sw $t1, 8($t0) # self.car = v + end_set_attribute_8756104442781: # Set attribute cdr of self lw $t0, 8($sp) # $t0 = self lw $t1, 0($sp) # $t1 = rest + beq $t1, $zero, object_set_attribute_8756104442790 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104442790 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104442790 + j object_set_attribute_8756104442790 + int_set_attribute_8756104442790: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.cdr = rest + j end_set_attribute_8756104442790 + bool_set_attribute_8756104442790: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.cdr = rest + j end_set_attribute_8756104442790 + object_set_attribute_8756104442790: sw $t1, 12($t0) # self.cdr = rest + end_set_attribute_8756104442790: # Loading return value in $v1 lw $v1, 8($sp) @@ -2605,7 +4398,38 @@ # Get attribute car of self lw $t0, 16($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'car' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8756104442829 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8756104442829 + j object_get_attribute_8756104442829 + int_get_attribute_8756104442829: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.car + j end_get_attribute_8756104442829 + bool_get_attribute_8756104442829: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.car + j end_get_attribute_8756104442829 + object_get_attribute_8756104442829: sw $t1, 12($sp) # internal_0 = car + end_get_attribute_8756104442829: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments @@ -2624,7 +4448,38 @@ # Get attribute cdr of self lw $t0, 16($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'cdr' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8756104442859 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8756104442859 + j object_get_attribute_8756104442859 + int_get_attribute_8756104442859: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_2 = self.cdr + j end_get_attribute_8756104442859 + bool_get_attribute_8756104442859: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_2 = self.cdr + j end_get_attribute_8756104442859 + object_get_attribute_8756104442859: sw $t1, 4($sp) # internal_2 = cdr + end_get_attribute_8756104442859: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments @@ -2682,7 +4537,39 @@ # Set attribute boolop of self lw $t0, 8($sp) # $t0 = self lw $t1, 4($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8756104443417 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104443417 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104443417 + j object_set_attribute_8756104443417 + int_set_attribute_8756104443417: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.boolop = internal_0 + j end_set_attribute_8756104443417 + bool_set_attribute_8756104443417: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.boolop = internal_0 + j end_set_attribute_8756104443417 + object_set_attribute_8756104443417: sw $t1, 8($t0) # self.boolop = internal_0 + end_set_attribute_8756104443417: # Allocating String li $v0, 9 @@ -2692,7 +4579,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 9 sw $t0, 4($v0) # Setting length of the string in the second word of the object sb $zero, 8($v0) # Null-terminator at the end of the string @@ -2702,7 +4589,39 @@ # Set attribute rest of self lw $t0, 8($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8756104443450 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104443450 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104443450 + j object_set_attribute_8756104443450 + int_set_attribute_8756104443450: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.rest = internal_1 + j end_set_attribute_8756104443450 + bool_set_attribute_8756104443450: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.rest = internal_1 + j end_set_attribute_8756104443450 + object_set_attribute_8756104443450: sw $t1, 12($t0) # self.rest = internal_1 + end_set_attribute_8756104443450: # Loading return value in $v1 lw $v1, 8($sp) @@ -2714,11 +4633,11 @@ function_read_input_at_Parse: # Function parameters - # $ra = 76($sp) - # self = 72($sp) + # $ra = 72($sp) + # self = 68($sp) # Reserving space for local variables - addi $sp, $sp, -72 + addi $sp, $sp, -68 # Allocating Graph li $v0, 9 @@ -2727,76 +4646,109 @@ la $t0, type_Graph # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 64($sp) # internal_1 = address of allocated object Graph + sw $v0, 60($sp) # internal_1 = address of allocated object Graph # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_1 - lw $t0, 72($sp) + lw $t0, 68($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function___init___at_Graph jal function___init___at_Graph lw $ra, 4($sp) - sw $v1, 72($sp) # internal_1 = result of function___init___at_Graph + sw $v1, 68($sp) # internal_1 = result of function___init___at_Graph addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 64($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 68($sp) - j end_assign - not_is_Bool_or_Int: - # g = internal_1 - lw $t0, 64($sp) - sw $t0, 68($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument g + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing g + + # Argument internal_1 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 76($sp) # g = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 80($sp) + lw $t0, 76($sp) sw $t0, 0($sp) # Storing self # Calling function function_in_string_at_IO jal function_in_string_at_IO lw $ra, 4($sp) - sw $v1, 64($sp) # internal_3 = result of function_in_string_at_IO + sw $v1, 60($sp) # internal_3 = result of function_in_string_at_IO addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 56($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: - # line = internal_3 - lw $t0, 56($sp) - sw $t0, 60($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument line + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing line - while_start_8763448686180: + # Argument internal_3 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 68($sp) # line = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + while_start_8756104471956: # Get attribute boolop of self - lw $t0, 72($sp) # Get the address of self + lw $t0, 68($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'boolop' from the instance - sw $t1, 48($sp) # internal_5 = boolop + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8756104443664 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8756104443664 + j object_get_attribute_8756104443664 + int_get_attribute_8756104443664: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 48($sp) # internal_4 = self.boolop + j end_get_attribute_8756104443664 + bool_get_attribute_8756104443664: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 48($sp) # internal_4 = self.boolop + j end_get_attribute_8756104443664 + object_get_attribute_8756104443664: + sw $t1, 48($sp) # internal_4 = boolop + end_get_attribute_8756104443664: # Allocating String li $v0, 9 @@ -2806,32 +4758,32 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_6[0] = '\n' + sb $t0, 8($v0) # internal_5[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 44($sp) # internal_6 = "\n" + sw $v0, 44($sp) # internal_5 = "\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument line - lw $t0, 72($sp) + lw $t0, 68($sp) sw $t0, 4($sp) # Storing line - # Argument internal_6 + # Argument internal_5 lw $t0, 56($sp) - sw $t0, 0($sp) # Storing internal_6 + sw $t0, 0($sp) # Storing internal_5 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 52($sp) # internal_7 = result of function_equal + sw $v1, 52($sp) # internal_6 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -2844,17 +4796,37 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_8 = address of allocated object Int + sw $v0, 36($sp) # internal_7 = address of allocated object Int - # Xor operation - lw $t0, 40($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 36($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - lw $t0, 32($sp) # $t0 = internal_9 - sw $t2, 8($t0) # Setting value in the third word of the Int object + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_8 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_6 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_6 + + # Argument internal_7 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_8 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments # Allocating String li $v0, 9 @@ -2864,29 +4836,29 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 9 sw $t0, 4($v0) # Setting length of the string in the second word of the object sb $zero, 8($v0) # Null-terminator at the end of the string - sw $v0, 28($sp) # internal_10 = "" + sw $v0, 28($sp) # internal_9 = "" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument line - lw $t0, 72($sp) + lw $t0, 68($sp) sw $t0, 4($sp) # Storing line - # Argument internal_10 + # Argument internal_9 lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_10 + sw $t0, 0($sp) # Storing internal_9 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 36($sp) # internal_11 = result of function_equal + sw $v1, 36($sp) # internal_10 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -2899,84 +4871,87 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_12 = address of allocated object Int + sw $v0, 20($sp) # internal_11 = address of allocated object Int - # Xor operation - lw $t0, 24($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 20($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - lw $t0, 16($sp) # $t0 = internal_13 - sw $t2, 8($t0) # Setting value in the third word of the Int object + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_12 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_11 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_12 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address - # Argument internal_5 + # Argument internal_4 lw $t0, 64($sp) - sw $t0, 8($sp) # Storing internal_5 + sw $t0, 8($sp) # Storing internal_4 - # Argument internal_9 + # Argument internal_8 lw $t0, 48($sp) - sw $t0, 4($sp) # Storing internal_9 + sw $t0, 4($sp) # Storing internal_8 - # Argument internal_13 + # Argument internal_12 lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_13 + sw $t0, 0($sp) # Storing internal_12 # Calling function function_and_at_BoolOp jal function_and_at_BoolOp lw $ra, 12($sp) - sw $v1, 28($sp) # internal_14 = result of function_and_at_BoolOp + sw $v1, 28($sp) # internal_13 = result of function_and_at_BoolOp addi $sp, $sp, 16 # Freeing space for arguments - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: - # internal_4 = internal_14 - lw $t0, 12($sp) - sw $t0, 52($sp) - end_assign: - - # If internal_4 then goto while_body_8763448686180 - lw $t0, 52($sp) # Loading the address of the condition + # If internal_13 then goto while_body_8756104471956 + lw $t0, 12($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8763448686180 + beq $t0, $t1, while_body_8756104471956 - # Jumping to while_end_8763448686180 - j while_end_8763448686180 + # Jumping to while_end_8756104471956 + j while_end_8756104471956 - while_body_8763448686180: + while_body_8756104471956: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 84($sp) + lw $t0, 80($sp) sw $t0, 4($sp) # Storing self # Argument line - lw $t0, 72($sp) + lw $t0, 68($sp) sw $t0, 0($sp) # Storing line # Calling function function_parse_line_at_Parse jal function_parse_line_at_Parse lw $ra, 8($sp) - sw $v1, 20($sp) # internal_15 = result of function_parse_line_at_Parse + sw $v1, 20($sp) # internal_14 = result of function_parse_line_at_Parse addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -2984,17 +4959,17 @@ sw $ra, 8($sp) # Storing return address # Argument g - lw $t0, 80($sp) + lw $t0, 76($sp) sw $t0, 4($sp) # Storing g - # Argument internal_15 + # Argument internal_14 lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_15 + sw $t0, 0($sp) # Storing internal_14 # Calling function function_add_vertice_at_Graph jal function_add_vertice_at_Graph lw $ra, 8($sp) - sw $v1, 16($sp) # internal_16 = result of function_add_vertice_at_Graph + sw $v1, 16($sp) # internal_15 = result of function_add_vertice_at_Graph addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -3002,53 +4977,54 @@ sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 80($sp) + lw $t0, 76($sp) sw $t0, 0($sp) # Storing self # Calling function function_in_string_at_IO jal function_in_string_at_IO lw $ra, 4($sp) - sw $v1, 8($sp) # internal_17 = result of function_in_string_at_IO + sw $v1, 8($sp) # internal_16 = result of function_in_string_at_IO addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: - # line = internal_17 - lw $t0, 0($sp) - sw $t0, 60($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Jumping to while_start_8763448686180 - j while_start_8763448686180 + # Argument line + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing line - while_end_8763448686180: + # Argument internal_16 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 68($sp) # line = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to while_start_8756104471956 + j while_start_8756104471956 + + while_end_8756104471956: # Loading return value in $v1 - lw $v1, 68($sp) + lw $v1, 64($sp) # Freeing space for local variables - addi $sp, $sp, 72 + addi $sp, $sp, 68 jr $ra function_parse_line_at_Parse: # Function parameters - # $ra = 92($sp) - # self = 88($sp) - # s = 84($sp) + # $ra = 88($sp) + # self = 84($sp) + # s = 80($sp) # Reserving space for local variables - addi $sp, $sp, -84 + addi $sp, $sp, -80 # Allocating Vertice li $v0, 9 @@ -3057,20 +5033,20 @@ la $t0, type_Vertice # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 76($sp) # internal_1 = address of allocated object Vertice + sw $v0, 72($sp) # internal_1 = address of allocated object Vertice # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_1 - lw $t0, 84($sp) + lw $t0, 80($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function___init___at_Vertice jal function___init___at_Vertice lw $ra, 4($sp) - sw $v1, 84($sp) # internal_1 = result of function___init___at_Vertice + sw $v1, 80($sp) # internal_1 = result of function___init___at_Vertice addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments @@ -3078,17 +5054,17 @@ sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 100($sp) + lw $t0, 96($sp) sw $t0, 4($sp) # Storing self # Argument s - lw $t0, 96($sp) + lw $t0, 92($sp) sw $t0, 0($sp) # Storing s # Calling function function_a2i_at_Parse jal function_a2i_at_Parse lw $ra, 8($sp) - sw $v1, 84($sp) # internal_2 = result of function_a2i_at_Parse + sw $v1, 80($sp) # internal_2 = result of function_a2i_at_Parse addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -3096,55 +5072,87 @@ sw $ra, 8($sp) # Storing return address # Argument internal_1 - lw $t0, 88($sp) + lw $t0, 84($sp) sw $t0, 4($sp) # Storing internal_1 # Argument internal_2 - lw $t0, 84($sp) + lw $t0, 80($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_init_at_Vertice jal function_init_at_Vertice lw $ra, 8($sp) - sw $v1, 80($sp) # internal_3 = result of function_init_at_Vertice + sw $v1, 76($sp) # internal_3 = result of function_init_at_Vertice addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 68($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 80($sp) - j end_assign - not_is_Bool_or_Int: - # v = internal_3 - lw $t0, 68($sp) - sw $t0, 80($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument v + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing v + + # Argument internal_3 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 88($sp) # v = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - while_start_8763448687114: + while_start_8756104472890: # Get attribute rest of self - lw $t0, 88($sp) # Get the address of self + lw $t0, 84($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'rest' from the instance - sw $t1, 60($sp) # internal_5 = rest + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8756104445175 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8756104445175 + j object_get_attribute_8756104445175 + int_get_attribute_8756104445175: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 60($sp) # internal_4 = self.rest + j end_get_attribute_8756104445175 + bool_get_attribute_8756104445175: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 60($sp) # internal_4 = self.rest + j end_get_attribute_8756104445175 + object_get_attribute_8756104445175: + sw $t1, 60($sp) # internal_4 = rest + end_get_attribute_8756104445175: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_5 + # Argument internal_4 lw $t0, 68($sp) - sw $t0, 0($sp) # Storing internal_5 + sw $t0, 0($sp) # Storing internal_4 # Calling function function_length_at_String jal function_length_at_String lw $ra, 4($sp) - sw $v1, 64($sp) # internal_6 = result of function_length_at_String + sw $v1, 64($sp) # internal_5 = result of function_length_at_String addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 0 @@ -3157,24 +5165,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 52($sp) # internal_7 = address of allocated object Int + sw $v0, 52($sp) # internal_6 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_6 + # Argument internal_5 lw $t0, 68($sp) - sw $t0, 4($sp) # Storing internal_6 + sw $t0, 4($sp) # Storing internal_5 - # Argument internal_7 + # Argument internal_6 lw $t0, 64($sp) - sw $t0, 0($sp) # Storing internal_7 + sw $t0, 0($sp) # Storing internal_6 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 60($sp) # internal_8 = result of function_equal + sw $v1, 60($sp) # internal_7 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -3187,125 +5195,192 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_9 = address of allocated object Int + sw $v0, 44($sp) # internal_8 = address of allocated object Int - # Xor operation - lw $t0, 48($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 44($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - lw $t0, 40($sp) # $t0 = internal_10 - sw $t2, 8($t0) # Setting value in the third word of the Int object + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_9 = address of allocated object Int - lw $t0, 40($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 64($sp) - j end_assign - not_is_Bool_or_Int: - # internal_4 = internal_10 - lw $t0, 40($sp) - sw $t0, 64($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_7 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing internal_7 + + # Argument internal_8 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_9 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments - # If internal_4 then goto while_body_8763448687114 - lw $t0, 64($sp) # Loading the address of the condition + # If internal_9 then goto while_body_8756104472890 + lw $t0, 40($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8763448687114 + beq $t0, $t1, while_body_8756104472890 - # Jumping to while_end_8763448687114 - j while_end_8763448687114 + # Jumping to while_end_8756104472890 + j while_end_8756104472890 - while_body_8763448687114: + while_body_8756104472890: # Get attribute rest of self - lw $t0, 88($sp) # Get the address of self + lw $t0, 84($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'rest' from the instance - sw $t1, 32($sp) # internal_12 = rest + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8756104445591 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8756104445591 + j object_get_attribute_8756104445591 + int_get_attribute_8756104445591: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_11 = self.rest + j end_get_attribute_8756104445591 + bool_get_attribute_8756104445591: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_11 = self.rest + j end_get_attribute_8756104445591 + object_get_attribute_8756104445591: + sw $t1, 32($sp) # internal_11 = rest + end_get_attribute_8756104445591: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_11 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_a2i_at_Parse + jal function_a2i_at_Parse + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_12 = result of function_a2i_at_Parse + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 100($sp) - sw $t0, 4($sp) # Storing self + # Argument succ + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing succ # Argument internal_12 - lw $t0, 44($sp) + lw $t0, 40($sp) sw $t0, 0($sp) # Storing internal_12 - # Calling function function_a2i_at_Parse - jal function_a2i_at_Parse + # Calling function function_assign + jal function_assign lw $ra, 8($sp) - sw $v1, 40($sp) # internal_13 = result of function_a2i_at_Parse + sw $v1, 48($sp) # succ = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 36($sp) - j end_assign - not_is_Bool_or_Int: - # succ = internal_13 - lw $t0, 28($sp) - sw $t0, 36($sp) - end_assign: - # Get attribute rest of self - lw $t0, 88($sp) # Get the address of self + lw $t0, 84($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'rest' from the instance - sw $t1, 20($sp) # internal_15 = rest + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8756104445672 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8756104445672 + j object_get_attribute_8756104445672 + int_get_attribute_8756104445672: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_14 = self.rest + j end_get_attribute_8756104445672 + bool_get_attribute_8756104445672: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_14 = self.rest + j end_get_attribute_8756104445672 + object_get_attribute_8756104445672: + sw $t1, 20($sp) # internal_14 = rest + end_get_attribute_8756104445672: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 100($sp) + lw $t0, 96($sp) sw $t0, 4($sp) # Storing self - # Argument internal_15 + # Argument internal_14 lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_15 + sw $t0, 0($sp) # Storing internal_14 # Calling function function_a2i_at_Parse jal function_a2i_at_Parse lw $ra, 8($sp) - sw $v1, 28($sp) # internal_16 = result of function_a2i_at_Parse + sw $v1, 28($sp) # internal_15 = result of function_a2i_at_Parse addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: - # weight = internal_16 - lw $t0, 16($sp) - sw $t0, 24($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument weight + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing weight + + # Argument internal_15 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 36($sp) # weight = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating Edge li $v0, 9 @@ -3314,20 +5389,20 @@ la $t0, type_Edge # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 12($sp) # internal_17 = address of allocated object Edge + sw $v0, 12($sp) # internal_16 = address of allocated object Edge # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_17 + # Argument internal_16 lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_17 + sw $t0, 0($sp) # Storing internal_16 # Calling function function___init___at_Edge jal function___init___at_Edge lw $ra, 4($sp) - sw $v1, 20($sp) # internal_17 = result of function___init___at_Edge + sw $v1, 20($sp) # internal_16 = result of function___init___at_Edge addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments @@ -3335,26 +5410,26 @@ sw $ra, 4($sp) # Storing return address # Argument v - lw $t0, 88($sp) + lw $t0, 84($sp) sw $t0, 0($sp) # Storing v # Calling function function_number_at_Vertice jal function_number_at_Vertice lw $ra, 4($sp) - sw $v1, 16($sp) # internal_18 = result of function_number_at_Vertice + sw $v1, 16($sp) # internal_17 = result of function_number_at_Vertice addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -20 # Reserving space for arguments sw $ra, 16($sp) # Storing return address - # Argument internal_17 + # Argument internal_16 lw $t0, 32($sp) - sw $t0, 12($sp) # Storing internal_17 + sw $t0, 12($sp) # Storing internal_16 - # Argument internal_18 + # Argument internal_17 lw $t0, 28($sp) - sw $t0, 8($sp) # Storing internal_18 + sw $t0, 8($sp) # Storing internal_17 # Argument succ lw $t0, 56($sp) @@ -3367,7 +5442,7 @@ # Calling function function_init_at_Edge jal function_init_at_Edge lw $ra, 16($sp) - sw $v1, 24($sp) # internal_19 = result of function_init_at_Edge + sw $v1, 24($sp) # internal_18 = result of function_init_at_Edge addi $sp, $sp, 20 # Freeing space for arguments # Passing function arguments @@ -3375,29 +5450,29 @@ sw $ra, 8($sp) # Storing return address # Argument v - lw $t0, 92($sp) + lw $t0, 88($sp) sw $t0, 4($sp) # Storing v - # Argument internal_19 + # Argument internal_18 lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_19 + sw $t0, 0($sp) # Storing internal_18 # Calling function function_add_out_at_Vertice jal function_add_out_at_Vertice lw $ra, 8($sp) - sw $v1, 12($sp) # internal_20 = result of function_add_out_at_Vertice + sw $v1, 12($sp) # internal_19 = result of function_add_out_at_Vertice addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to while_start_8763448687114 - j while_start_8763448687114 + # Jumping to while_start_8756104472890 + j while_start_8756104472890 - while_end_8763448687114: + while_end_8756104472890: # Loading return value in $v1 - lw $v1, 80($sp) + lw $v1, 76($sp) # Freeing space for local variables - addi $sp, $sp, 84 + addi $sp, $sp, 80 jr $ra @@ -3410,7 +5485,6 @@ # Reserving space for local variables addi $sp, $sp, -208 - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -3431,7 +5505,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 48 @@ -3459,33 +5533,20 @@ sw $v1, 204($sp) # internal_3 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 192($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 200($sp) - j end_assign - not_is_Bool_or_Int: # internal_1 = internal_3 lw $t0, 192($sp) sw $t0, 200($sp) - end_assign: - # If internal_1 then goto then_8763448687707 + # If internal_1 then goto then_8756104473483 lw $t0, 200($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8763448687707 + beq $t0, $t1, then_8756104473483 - # Jumping to else_8763448687707 - j else_8763448687707 + # Jumping to else_8756104473483 + j else_8756104473483 - then_8763448687707: + then_8756104473483: # Allocating Int 0 li $v0, 9 @@ -3499,28 +5560,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 188($sp) # internal_4 = address of allocated object Int - lw $t0, 188($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 204($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_4 lw $t0, 188($sp) sw $t0, 204($sp) - end_assign: - - # Jumping to endif_8763448687707 - j endif_8763448687707 - else_8763448687707: + # Jumping to endif_8756104473483 + j endif_8756104473483 + else_8756104473483: # Allocating Bool 0 li $v0, 9 @@ -3542,7 +5589,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 49 @@ -3570,33 +5617,20 @@ sw $v1, 184($sp) # internal_8 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 172($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 180($sp) - j end_assign - not_is_Bool_or_Int: # internal_6 = internal_8 lw $t0, 172($sp) sw $t0, 180($sp) - end_assign: - # If internal_6 then goto then_8763448687701 + # If internal_6 then goto then_8756104473477 lw $t0, 180($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8763448687701 + beq $t0, $t1, then_8756104473477 - # Jumping to else_8763448687701 - j else_8763448687701 + # Jumping to else_8756104473477 + j else_8756104473477 - then_8763448687701: + then_8756104473477: # Allocating Int 1 li $v0, 9 @@ -3610,28 +5644,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 168($sp) # internal_9 = address of allocated object Int - lw $t0, 168($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 184($sp) - j end_assign - not_is_Bool_or_Int: # internal_5 = internal_9 lw $t0, 168($sp) sw $t0, 184($sp) - end_assign: - # Jumping to endif_8763448687701 - j endif_8763448687701 - - else_8763448687701: + # Jumping to endif_8756104473477 + j endif_8756104473477 + else_8756104473477: # Allocating Bool 0 li $v0, 9 @@ -3653,7 +5673,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 50 @@ -3681,33 +5701,20 @@ sw $v1, 164($sp) # internal_13 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 152($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 160($sp) - j end_assign - not_is_Bool_or_Int: # internal_11 = internal_13 lw $t0, 152($sp) sw $t0, 160($sp) - end_assign: - # If internal_11 then goto then_8763448687695 + # If internal_11 then goto then_8756104473471 lw $t0, 160($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8763448687695 + beq $t0, $t1, then_8756104473471 - # Jumping to else_8763448687695 - j else_8763448687695 + # Jumping to else_8756104473471 + j else_8756104473471 - then_8763448687695: + then_8756104473471: # Allocating Int 2 li $v0, 9 @@ -3721,28 +5728,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 148($sp) # internal_14 = address of allocated object Int - lw $t0, 148($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 164($sp) - j end_assign - not_is_Bool_or_Int: # internal_10 = internal_14 lw $t0, 148($sp) sw $t0, 164($sp) - end_assign: - - # Jumping to endif_8763448687695 - j endif_8763448687695 - else_8763448687695: + # Jumping to endif_8756104473471 + j endif_8756104473471 + else_8756104473471: # Allocating Bool 0 li $v0, 9 @@ -3764,7 +5757,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 51 @@ -3792,33 +5785,20 @@ sw $v1, 144($sp) # internal_18 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 132($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 140($sp) - j end_assign - not_is_Bool_or_Int: # internal_16 = internal_18 lw $t0, 132($sp) sw $t0, 140($sp) - end_assign: - # If internal_16 then goto then_8763448687689 + # If internal_16 then goto then_8756104473465 lw $t0, 140($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8763448687689 + beq $t0, $t1, then_8756104473465 - # Jumping to else_8763448687689 - j else_8763448687689 + # Jumping to else_8756104473465 + j else_8756104473465 - then_8763448687689: + then_8756104473465: # Allocating Int 3 li $v0, 9 @@ -3832,28 +5812,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 128($sp) # internal_19 = address of allocated object Int - lw $t0, 128($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 144($sp) - j end_assign - not_is_Bool_or_Int: # internal_15 = internal_19 lw $t0, 128($sp) sw $t0, 144($sp) - end_assign: - # Jumping to endif_8763448687689 - j endif_8763448687689 - - else_8763448687689: + # Jumping to endif_8756104473465 + j endif_8756104473465 + else_8756104473465: # Allocating Bool 0 li $v0, 9 @@ -3875,7 +5841,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 52 @@ -3903,33 +5869,20 @@ sw $v1, 124($sp) # internal_23 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 112($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 120($sp) - j end_assign - not_is_Bool_or_Int: # internal_21 = internal_23 lw $t0, 112($sp) sw $t0, 120($sp) - end_assign: - # If internal_21 then goto then_8763448687683 + # If internal_21 then goto then_8756104473459 lw $t0, 120($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8763448687683 + beq $t0, $t1, then_8756104473459 - # Jumping to else_8763448687683 - j else_8763448687683 + # Jumping to else_8756104473459 + j else_8756104473459 - then_8763448687683: + then_8756104473459: # Allocating Int 4 li $v0, 9 @@ -3943,28 +5896,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 108($sp) # internal_24 = address of allocated object Int - lw $t0, 108($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 124($sp) - j end_assign - not_is_Bool_or_Int: # internal_20 = internal_24 lw $t0, 108($sp) sw $t0, 124($sp) - end_assign: - - # Jumping to endif_8763448687683 - j endif_8763448687683 - else_8763448687683: + # Jumping to endif_8756104473459 + j endif_8756104473459 + else_8756104473459: # Allocating Bool 0 li $v0, 9 @@ -3986,7 +5925,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 53 @@ -4014,33 +5953,20 @@ sw $v1, 104($sp) # internal_28 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 92($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 100($sp) - j end_assign - not_is_Bool_or_Int: # internal_26 = internal_28 lw $t0, 92($sp) sw $t0, 100($sp) - end_assign: - # If internal_26 then goto then_8763448687677 + # If internal_26 then goto then_8756104473453 lw $t0, 100($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8763448687677 + beq $t0, $t1, then_8756104473453 - # Jumping to else_8763448687677 - j else_8763448687677 + # Jumping to else_8756104473453 + j else_8756104473453 - then_8763448687677: + then_8756104473453: # Allocating Int 5 li $v0, 9 @@ -4054,28 +5980,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 88($sp) # internal_29 = address of allocated object Int - lw $t0, 88($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 104($sp) - j end_assign - not_is_Bool_or_Int: # internal_25 = internal_29 lw $t0, 88($sp) sw $t0, 104($sp) - end_assign: - # Jumping to endif_8763448687677 - j endif_8763448687677 - - else_8763448687677: + # Jumping to endif_8756104473453 + j endif_8756104473453 + else_8756104473453: # Allocating Bool 0 li $v0, 9 @@ -4097,7 +6009,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 54 @@ -4125,33 +6037,20 @@ sw $v1, 84($sp) # internal_33 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 72($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 80($sp) - j end_assign - not_is_Bool_or_Int: # internal_31 = internal_33 lw $t0, 72($sp) sw $t0, 80($sp) - end_assign: - # If internal_31 then goto then_8763448687671 + # If internal_31 then goto then_8756104473447 lw $t0, 80($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8763448687671 + beq $t0, $t1, then_8756104473447 - # Jumping to else_8763448687671 - j else_8763448687671 + # Jumping to else_8756104473447 + j else_8756104473447 - then_8763448687671: + then_8756104473447: # Allocating Int 6 li $v0, 9 @@ -4165,28 +6064,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 68($sp) # internal_34 = address of allocated object Int - lw $t0, 68($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 84($sp) - j end_assign - not_is_Bool_or_Int: # internal_30 = internal_34 lw $t0, 68($sp) sw $t0, 84($sp) - end_assign: - - # Jumping to endif_8763448687671 - j endif_8763448687671 - else_8763448687671: + # Jumping to endif_8756104473447 + j endif_8756104473447 + else_8756104473447: # Allocating Bool 0 li $v0, 9 @@ -4208,7 +6093,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 55 @@ -4236,33 +6121,20 @@ sw $v1, 64($sp) # internal_38 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 52($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: # internal_36 = internal_38 lw $t0, 52($sp) sw $t0, 60($sp) - end_assign: - # If internal_36 then goto then_8763448687665 + # If internal_36 then goto then_8756104473441 lw $t0, 60($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8763448687665 + beq $t0, $t1, then_8756104473441 - # Jumping to else_8763448687665 - j else_8763448687665 + # Jumping to else_8756104473441 + j else_8756104473441 - then_8763448687665: + then_8756104473441: # Allocating Int 7 li $v0, 9 @@ -4276,28 +6148,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 48($sp) # internal_39 = address of allocated object Int - lw $t0, 48($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 64($sp) - j end_assign - not_is_Bool_or_Int: # internal_35 = internal_39 lw $t0, 48($sp) sw $t0, 64($sp) - end_assign: - # Jumping to endif_8763448687665 - j endif_8763448687665 - - else_8763448687665: + # Jumping to endif_8756104473441 + j endif_8756104473441 + else_8756104473441: # Allocating Bool 0 li $v0, 9 @@ -4319,7 +6177,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 56 @@ -4347,33 +6205,20 @@ sw $v1, 44($sp) # internal_43 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 32($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: # internal_41 = internal_43 lw $t0, 32($sp) sw $t0, 40($sp) - end_assign: - # If internal_41 then goto then_8763448687659 + # If internal_41 then goto then_8756104473435 lw $t0, 40($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8763448687659 + beq $t0, $t1, then_8756104473435 - # Jumping to else_8763448687659 - j else_8763448687659 + # Jumping to else_8756104473435 + j else_8756104473435 - then_8763448687659: + then_8756104473435: # Allocating Int 8 li $v0, 9 @@ -4387,28 +6232,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 28($sp) # internal_44 = address of allocated object Int - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: # internal_40 = internal_44 lw $t0, 28($sp) sw $t0, 44($sp) - end_assign: - - # Jumping to endif_8763448687659 - j endif_8763448687659 - else_8763448687659: + # Jumping to endif_8756104473435 + j endif_8756104473435 + else_8756104473435: # Allocating Bool 0 li $v0, 9 @@ -4430,7 +6261,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 57 @@ -4458,33 +6289,20 @@ sw $v1, 24($sp) # internal_48 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 20($sp) - j end_assign - not_is_Bool_or_Int: # internal_46 = internal_48 lw $t0, 12($sp) sw $t0, 20($sp) - end_assign: - # If internal_46 then goto then_8763448687638 + # If internal_46 then goto then_8756104473414 lw $t0, 20($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8763448687638 + beq $t0, $t1, then_8756104473414 - # Jumping to else_8763448687638 - j else_8763448687638 + # Jumping to else_8756104473414 + j else_8756104473414 - then_8763448687638: + then_8756104473414: # Allocating Int 9 li $v0, 9 @@ -4498,27 +6316,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 8($sp) # internal_49 = address of allocated object Int - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: # internal_45 = internal_49 lw $t0, 8($sp) sw $t0, 24($sp) - end_assign: - # Jumping to endif_8763448687638 - j endif_8763448687638 + # Jumping to endif_8756104473414 + j endif_8756104473414 - else_8763448687638: + else_8756104473414: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments @@ -4546,225 +6351,95 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 0($sp) # internal_51 = address of allocated object Int - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: # internal_45 = internal_51 lw $t0, 0($sp) sw $t0, 24($sp) - end_assign: - # Jumping to endif_8763448687638 - j endif_8763448687638 + # Jumping to endif_8756104473414 + j endif_8756104473414 - endif_8763448687638: + endif_8756104473414: - lw $t0, 24($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: # internal_40 = internal_45 lw $t0, 24($sp) sw $t0, 44($sp) - end_assign: - # Jumping to endif_8763448687659 - j endif_8763448687659 + # Jumping to endif_8756104473435 + j endif_8756104473435 - endif_8763448687659: + endif_8756104473435: - lw $t0, 44($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 64($sp) - j end_assign - not_is_Bool_or_Int: # internal_35 = internal_40 lw $t0, 44($sp) sw $t0, 64($sp) - end_assign: - # Jumping to endif_8763448687665 - j endif_8763448687665 + # Jumping to endif_8756104473441 + j endif_8756104473441 - endif_8763448687665: + endif_8756104473441: - lw $t0, 64($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 84($sp) - j end_assign - not_is_Bool_or_Int: # internal_30 = internal_35 lw $t0, 64($sp) sw $t0, 84($sp) - end_assign: - # Jumping to endif_8763448687671 - j endif_8763448687671 + # Jumping to endif_8756104473447 + j endif_8756104473447 - endif_8763448687671: + endif_8756104473447: - lw $t0, 84($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 104($sp) - j end_assign - not_is_Bool_or_Int: # internal_25 = internal_30 lw $t0, 84($sp) sw $t0, 104($sp) - end_assign: - # Jumping to endif_8763448687677 - j endif_8763448687677 + # Jumping to endif_8756104473453 + j endif_8756104473453 - endif_8763448687677: + endif_8756104473453: - lw $t0, 104($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 124($sp) - j end_assign - not_is_Bool_or_Int: # internal_20 = internal_25 lw $t0, 104($sp) sw $t0, 124($sp) - end_assign: - # Jumping to endif_8763448687683 - j endif_8763448687683 + # Jumping to endif_8756104473459 + j endif_8756104473459 - endif_8763448687683: + endif_8756104473459: - lw $t0, 124($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 144($sp) - j end_assign - not_is_Bool_or_Int: # internal_15 = internal_20 lw $t0, 124($sp) sw $t0, 144($sp) - end_assign: - # Jumping to endif_8763448687689 - j endif_8763448687689 + # Jumping to endif_8756104473465 + j endif_8756104473465 - endif_8763448687689: + endif_8756104473465: - lw $t0, 144($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 164($sp) - j end_assign - not_is_Bool_or_Int: # internal_10 = internal_15 lw $t0, 144($sp) sw $t0, 164($sp) - end_assign: - # Jumping to endif_8763448687695 - j endif_8763448687695 + # Jumping to endif_8756104473471 + j endif_8756104473471 - endif_8763448687695: + endif_8756104473471: - lw $t0, 164($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 184($sp) - j end_assign - not_is_Bool_or_Int: # internal_5 = internal_10 lw $t0, 164($sp) sw $t0, 184($sp) - end_assign: - # Jumping to endif_8763448687701 - j endif_8763448687701 + # Jumping to endif_8756104473477 + j endif_8756104473477 - endif_8763448687701: + endif_8756104473477: - lw $t0, 184($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 204($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_5 lw $t0, 184($sp) sw $t0, 204($sp) - end_assign: - # Jumping to endif_8763448687707 - j endif_8763448687707 + # Jumping to endif_8756104473483 + j endif_8756104473483 - endif_8763448687707: + endif_8756104473483: # Loading return value in $v1 lw $v1, 204($sp) @@ -4783,7 +6458,6 @@ # Reserving space for local variables addi $sp, $sp, -144 - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -4840,33 +6514,20 @@ sw $v1, 136($sp) # internal_4 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 124($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 136($sp) - j end_assign - not_is_Bool_or_Int: # internal_1 = internal_4 lw $t0, 124($sp) sw $t0, 136($sp) - end_assign: - # If internal_1 then goto then_8763448688159 + # If internal_1 then goto then_8756104473935 lw $t0, 136($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8763448688159 + beq $t0, $t1, then_8756104473935 - # Jumping to else_8763448688159 - j else_8763448688159 + # Jumping to else_8756104473935 + j else_8756104473935 - then_8763448688159: + then_8756104473935: # Allocating Int 0 li $v0, 9 @@ -4880,28 +6541,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 120($sp) # internal_5 = address of allocated object Int - lw $t0, 120($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 140($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_5 lw $t0, 120($sp) sw $t0, 140($sp) - end_assign: - - # Jumping to endif_8763448688159 - j endif_8763448688159 - else_8763448688159: + # Jumping to endif_8756104473935 + j endif_8756104473935 + else_8756104473935: # Allocating Bool 0 li $v0, 9 @@ -4969,7 +6616,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 45 @@ -4997,33 +6644,20 @@ sw $v1, 104($sp) # internal_12 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 92($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 112($sp) - j end_assign - not_is_Bool_or_Int: # internal_7 = internal_12 lw $t0, 92($sp) sw $t0, 112($sp) - end_assign: - # If internal_7 then goto then_8763448688174 + # If internal_7 then goto then_8756104473950 lw $t0, 112($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8763448688174 + beq $t0, $t1, then_8756104473950 - # Jumping to else_8763448688174 - j else_8763448688174 + # Jumping to else_8756104473950 + j else_8756104473950 - then_8763448688174: + then_8756104473950: # Allocating Int 1 li $v0, 9 @@ -5121,48 +6755,86 @@ sw $v1, 80($sp) # internal_18 = result of function_a2i_aux_at_Parse addi $sp, $sp, 12 # Freeing space for arguments - # Xor operation - lw $t0, 68($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 60($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - lw $t0, 56($sp) # $t0 = internal_21 - sw $t2, 8($t0) # Setting value in the third word of the Int object + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_19 = address of allocated object Int - # Addition operation - lw $t0, 56($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 64($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - add $t2, $t0, $t1 # $t2 = $t0 + $t1 + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall - lw $t0, 56($sp) # $t0 = internal_21 - sw $t2, 8($t0) # Setting value in the third word of the Int object + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_20 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_21 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_18 + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing internal_18 + + # Argument internal_20 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_21 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_21 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_21 + + # Argument internal_19 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_19 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_21 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 56($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 116($sp) - j end_assign - not_is_Bool_or_Int: # internal_6 = internal_21 lw $t0, 56($sp) sw $t0, 116($sp) - end_assign: - - # Jumping to endif_8763448688174 - j endif_8763448688174 - else_8763448688174: + # Jumping to endif_8756104473950 + j endif_8756104473950 + else_8756104473950: # Allocating Bool 0 li $v0, 9 @@ -5230,7 +6902,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -5258,33 +6930,20 @@ sw $v1, 40($sp) # internal_28 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 48($sp) - j end_assign - not_is_Bool_or_Int: # internal_23 = internal_28 lw $t0, 28($sp) sw $t0, 48($sp) - end_assign: - # If internal_23 then goto then_8763448688168 + # If internal_23 then goto then_8756104473944 lw $t0, 48($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8763448688168 + beq $t0, $t1, then_8756104473944 - # Jumping to else_8763448688168 - j else_8763448688168 + # Jumping to else_8756104473944 + j else_8756104473944 - then_8763448688168: + then_8756104473944: # Allocating Int 1 li $v0, 9 @@ -5382,27 +7041,14 @@ sw $v1, 16($sp) # internal_34 = result of function_a2i_at_Parse addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 4($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: # internal_22 = internal_34 lw $t0, 4($sp) sw $t0, 52($sp) - end_assign: - # Jumping to endif_8763448688168 - j endif_8763448688168 + # Jumping to endif_8756104473944 + j endif_8756104473944 - else_8763448688168: + else_8756104473944: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -5422,71 +7068,32 @@ sw $v1, 12($sp) # internal_35 = result of function_a2i_aux_at_Parse addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: # internal_22 = internal_35 lw $t0, 0($sp) sw $t0, 52($sp) - end_assign: - # Jumping to endif_8763448688168 - j endif_8763448688168 + # Jumping to endif_8756104473944 + j endif_8756104473944 - endif_8763448688168: + endif_8756104473944: - lw $t0, 52($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 116($sp) - j end_assign - not_is_Bool_or_Int: # internal_6 = internal_22 lw $t0, 52($sp) sw $t0, 116($sp) - end_assign: - # Jumping to endif_8763448688174 - j endif_8763448688174 + # Jumping to endif_8756104473950 + j endif_8756104473950 - endif_8763448688174: + endif_8756104473950: - lw $t0, 116($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 140($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_6 lw $t0, 116($sp) sw $t0, 140($sp) - end_assign: - # Jumping to endif_8763448688159 - j endif_8763448688159 + # Jumping to endif_8756104473935 + j endif_8756104473935 - endif_8763448688159: + endif_8756104473935: # Loading return value in $v1 lw $v1, 140($sp) @@ -5498,12 +7105,12 @@ function_a2i_aux_at_Parse: # Function parameters - # $ra = 192($sp) - # self = 188($sp) - # s = 184($sp) + # $ra = 188($sp) + # self = 184($sp) + # s = 180($sp) # Reserving space for local variables - addi $sp, $sp, -184 + addi $sp, $sp, -180 # Allocating Int 0 li $v0, 9 @@ -5515,55 +7122,57 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 176($sp) # internal_1 = address of allocated object Int + sw $v0, 172($sp) # internal_1 = address of allocated object Int - lw $t0, 176($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 180($sp) - j end_assign - not_is_Bool_or_Int: - # int = internal_1 - lw $t0, 176($sp) - sw $t0, 180($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument int + lw $t0, 188($sp) + sw $t0, 4($sp) # Storing int + + # Argument internal_1 + lw $t0, 184($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 188($sp) # int = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument s - lw $t0, 192($sp) + lw $t0, 188($sp) sw $t0, 0($sp) # Storing s # Calling function function_length_at_String jal function_length_at_String lw $ra, 4($sp) - sw $v1, 176($sp) # internal_3 = result of function_length_at_String + sw $v1, 172($sp) # internal_3 = result of function_length_at_String addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 168($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 172($sp) - j end_assign - not_is_Bool_or_Int: - # j = internal_3 - lw $t0, 168($sp) - sw $t0, 172($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument j + lw $t0, 180($sp) + sw $t0, 4($sp) # Storing j + + # Argument internal_3 + lw $t0, 176($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 180($sp) # j = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 0 li $v0, 9 @@ -5575,72 +7184,56 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 160($sp) # internal_5 = address of allocated object Int + sw $v0, 156($sp) # internal_5 = address of allocated object Int - lw $t0, 160($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 164($sp) - j end_assign - not_is_Bool_or_Int: - # i = internal_5 - lw $t0, 160($sp) - sw $t0, 164($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 172($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_5 + lw $t0, 168($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 172($sp) # i = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - while_start_8763448689122: + while_start_8756104475158: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 176($sp) + lw $t0, 172($sp) sw $t0, 4($sp) # Storing i # Argument j - lw $t0, 184($sp) + lw $t0, 180($sp) sw $t0, 0($sp) # Storing j # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 164($sp) # internal_7 = result of function_less_than - addi $sp, $sp, 12 # Freeing space for arguments - - lw $t0, 152($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 156($sp) - j end_assign - not_is_Bool_or_Int: - # internal_6 = internal_7 - lw $t0, 152($sp) - sw $t0, 156($sp) - end_assign: + sw $v1, 164($sp) # internal_6 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - # If internal_6 then goto while_body_8763448689122 - lw $t0, 156($sp) # Loading the address of the condition + # If internal_6 then goto while_body_8756104475158 + lw $t0, 152($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8763448689122 + beq $t0, $t1, while_body_8756104475158 - # Jumping to while_end_8763448689122 - j while_end_8763448689122 + # Jumping to while_end_8756104475158 + j while_end_8756104475158 - while_body_8763448689122: + while_body_8756104475158: # Allocating Int 1 li $v0, 9 @@ -5652,47 +7245,47 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 144($sp) # internal_9 = address of allocated object Int + sw $v0, 144($sp) # internal_8 = address of allocated object Int # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument s - lw $t0, 200($sp) + lw $t0, 196($sp) sw $t0, 8($sp) # Storing s # Argument i - lw $t0, 180($sp) + lw $t0, 176($sp) sw $t0, 4($sp) # Storing i - # Argument internal_9 + # Argument internal_8 lw $t0, 160($sp) - sw $t0, 0($sp) # Storing internal_9 + sw $t0, 0($sp) # Storing internal_8 # Calling function function_substr_at_String jal function_substr_at_String lw $ra, 12($sp) - sw $v1, 156($sp) # internal_10 = result of function_substr_at_String + sw $v1, 156($sp) # internal_9 = result of function_substr_at_String addi $sp, $sp, 16 # Freeing space for arguments - lw $t0, 140($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 148($sp) - j end_assign - not_is_Bool_or_Int: - # c = internal_10 - lw $t0, 140($sp) - sw $t0, 148($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument c + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing c + # Argument internal_9 + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 160($sp) # c = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bool 0 li $v0, 9 @@ -5704,7 +7297,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 132($sp) # internal_12 = address of allocated object Int + sw $v0, 132($sp) # internal_11 = address of allocated object Int # Allocating String li $v0, 9 @@ -5714,15 +7307,15 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_13[0] = ' ' + sb $t0, 8($v0) # internal_12[0] = ' ' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 128($sp) # internal_13 = " " + sw $v0, 128($sp) # internal_12 = " " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -5732,43 +7325,30 @@ lw $t0, 160($sp) sw $t0, 4($sp) # Storing c - # Argument internal_13 + # Argument internal_12 lw $t0, 140($sp) - sw $t0, 0($sp) # Storing internal_13 + sw $t0, 0($sp) # Storing internal_12 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 136($sp) # internal_14 = result of function_equal + sw $v1, 136($sp) # internal_13 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 124($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 132($sp) - j end_assign - not_is_Bool_or_Int: - # internal_12 = internal_14 + # internal_11 = internal_13 lw $t0, 124($sp) sw $t0, 132($sp) - end_assign: - # If internal_12 then goto then_8763448689101 + # If internal_11 then goto then_8756104474877 lw $t0, 132($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8763448689101 + beq $t0, $t1, then_8756104474877 - # Jumping to else_8763448689101 - j else_8763448689101 + # Jumping to else_8756104474877 + j else_8756104474877 - then_8763448689101: + then_8756104474877: # Allocating Int 1 li $v0, 9 @@ -5780,24 +7360,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 120($sp) # internal_15 = address of allocated object Int + sw $v0, 120($sp) # internal_14 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 176($sp) + lw $t0, 172($sp) sw $t0, 4($sp) # Storing i - # Argument internal_15 + # Argument internal_14 lw $t0, 132($sp) - sw $t0, 0($sp) # Storing internal_15 + sw $t0, 0($sp) # Storing internal_14 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 128($sp) # internal_16 = result of function_add + sw $v1, 128($sp) # internal_15 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -5805,31 +7385,31 @@ sw $ra, 4($sp) # Storing return address # Argument s - lw $t0, 192($sp) + lw $t0, 188($sp) sw $t0, 0($sp) # Storing s # Calling function function_length_at_String jal function_length_at_String lw $ra, 4($sp) - sw $v1, 120($sp) # internal_17 = result of function_length_at_String + sw $v1, 120($sp) # internal_16 = result of function_length_at_String addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_17 + # Argument internal_16 lw $t0, 124($sp) - sw $t0, 4($sp) # Storing internal_17 + sw $t0, 4($sp) # Storing internal_16 # Argument i - lw $t0, 176($sp) + lw $t0, 172($sp) sw $t0, 0($sp) # Storing i # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 120($sp) # internal_18 = result of function_sub + sw $v1, 120($sp) # internal_17 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -5842,24 +7422,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 104($sp) # internal_19 = address of allocated object Int + sw $v0, 104($sp) # internal_18 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_18 + # Argument internal_17 lw $t0, 120($sp) - sw $t0, 4($sp) # Storing internal_18 + sw $t0, 4($sp) # Storing internal_17 - # Argument internal_19 + # Argument internal_18 lw $t0, 116($sp) - sw $t0, 0($sp) # Storing internal_19 + sw $t0, 0($sp) # Storing internal_18 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 112($sp) # internal_20 = result of function_sub + sw $v1, 112($sp) # internal_19 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -5867,67 +7447,86 @@ sw $ra, 12($sp) # Storing return address # Argument s - lw $t0, 200($sp) + lw $t0, 196($sp) sw $t0, 8($sp) # Storing s - # Argument internal_16 + # Argument internal_15 lw $t0, 132($sp) - sw $t0, 4($sp) # Storing internal_16 + sw $t0, 4($sp) # Storing internal_15 - # Argument internal_20 + # Argument internal_19 lw $t0, 116($sp) - sw $t0, 0($sp) # Storing internal_20 + sw $t0, 0($sp) # Storing internal_19 # Calling function function_substr_at_String jal function_substr_at_String lw $ra, 12($sp) - sw $v1, 112($sp) # internal_21 = result of function_substr_at_String + sw $v1, 112($sp) # internal_20 = result of function_substr_at_String addi $sp, $sp, 16 # Freeing space for arguments # Set attribute rest of self - lw $t0, 188($sp) # $t0 = self - lw $t1, 96($sp) # $t1 = internal_21 - sw $t1, 12($t0) # self.rest = internal_21 + lw $t0, 184($sp) # $t0 = self + lw $t1, 96($sp) # $t1 = internal_20 + beq $t1, $zero, object_set_attribute_8756104419500 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104419500 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104419500 + j object_set_attribute_8756104419500 + int_set_attribute_8756104419500: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.rest = internal_20 + j end_set_attribute_8756104419500 + bool_set_attribute_8756104419500: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.rest = internal_20 + j end_set_attribute_8756104419500 + object_set_attribute_8756104419500: + sw $t1, 12($t0) # self.rest = internal_20 + end_set_attribute_8756104419500: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i lw $t0, 172($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 164($sp) - j end_assign - not_is_Bool_or_Int: - # i = j - lw $t0, 172($sp) - sw $t0, 164($sp) - end_assign: + sw $t0, 4($sp) # Storing i - lw $t0, 164($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 136($sp) - j end_assign - not_is_Bool_or_Int: - # internal_11 = i - lw $t0, 164($sp) - sw $t0, 136($sp) - end_assign: + # Argument j + lw $t0, 180($sp) + sw $t0, 0($sp) # Storing j - # Jumping to endif_8763448689101 - j endif_8763448689101 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 172($sp) # i = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_10 = i + lw $t0, 160($sp) + sw $t0, 136($sp) - else_8763448689101: + # Jumping to endif_8756104474877 + j endif_8756104474877 + else_8756104474877: # Allocating Bool 0 li $v0, 9 @@ -5939,7 +7538,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 88($sp) # internal_23 = address of allocated object Int + sw $v0, 88($sp) # internal_22 = address of allocated object Int # Allocating String li $v0, 9 @@ -5949,15 +7548,15 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 44 - sb $t0, 8($v0) # internal_24[0] = ',' + sb $t0, 8($v0) # internal_23[0] = ',' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 84($sp) # internal_24 = "," + sw $v0, 84($sp) # internal_23 = "," # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -5967,43 +7566,30 @@ lw $t0, 160($sp) sw $t0, 4($sp) # Storing c - # Argument internal_24 + # Argument internal_23 lw $t0, 96($sp) - sw $t0, 0($sp) # Storing internal_24 + sw $t0, 0($sp) # Storing internal_23 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 92($sp) # internal_25 = result of function_equal + sw $v1, 92($sp) # internal_24 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 80($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 88($sp) - j end_assign - not_is_Bool_or_Int: - # internal_23 = internal_25 + # internal_22 = internal_24 lw $t0, 80($sp) sw $t0, 88($sp) - end_assign: - # If internal_23 then goto then_8763448689089 + # If internal_22 then goto then_8756104474865 lw $t0, 88($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8763448689089 + beq $t0, $t1, then_8756104474865 - # Jumping to else_8763448689089 - j else_8763448689089 + # Jumping to else_8756104474865 + j else_8756104474865 - then_8763448689089: + then_8756104474865: # Allocating Int 1 li $v0, 9 @@ -6015,24 +7601,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 76($sp) # internal_26 = address of allocated object Int + sw $v0, 76($sp) # internal_25 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 176($sp) + lw $t0, 172($sp) sw $t0, 4($sp) # Storing i - # Argument internal_26 + # Argument internal_25 lw $t0, 88($sp) - sw $t0, 0($sp) # Storing internal_26 + sw $t0, 0($sp) # Storing internal_25 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 84($sp) # internal_27 = result of function_add + sw $v1, 84($sp) # internal_26 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -6040,31 +7626,31 @@ sw $ra, 4($sp) # Storing return address # Argument s - lw $t0, 192($sp) + lw $t0, 188($sp) sw $t0, 0($sp) # Storing s # Calling function function_length_at_String jal function_length_at_String lw $ra, 4($sp) - sw $v1, 76($sp) # internal_28 = result of function_length_at_String + sw $v1, 76($sp) # internal_27 = result of function_length_at_String addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_28 + # Argument internal_27 lw $t0, 80($sp) - sw $t0, 4($sp) # Storing internal_28 + sw $t0, 4($sp) # Storing internal_27 # Argument i - lw $t0, 176($sp) + lw $t0, 172($sp) sw $t0, 0($sp) # Storing i # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 76($sp) # internal_29 = result of function_sub + sw $v1, 76($sp) # internal_28 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -6077,24 +7663,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_30 = address of allocated object Int + sw $v0, 60($sp) # internal_29 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_29 + # Argument internal_28 lw $t0, 76($sp) - sw $t0, 4($sp) # Storing internal_29 + sw $t0, 4($sp) # Storing internal_28 - # Argument internal_30 + # Argument internal_29 lw $t0, 72($sp) - sw $t0, 0($sp) # Storing internal_30 + sw $t0, 0($sp) # Storing internal_29 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 68($sp) # internal_31 = result of function_sub + sw $v1, 68($sp) # internal_30 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -6102,66 +7688,86 @@ sw $ra, 12($sp) # Storing return address # Argument s - lw $t0, 200($sp) + lw $t0, 196($sp) sw $t0, 8($sp) # Storing s - # Argument internal_27 + # Argument internal_26 lw $t0, 88($sp) - sw $t0, 4($sp) # Storing internal_27 + sw $t0, 4($sp) # Storing internal_26 - # Argument internal_31 + # Argument internal_30 lw $t0, 72($sp) - sw $t0, 0($sp) # Storing internal_31 + sw $t0, 0($sp) # Storing internal_30 # Calling function function_substr_at_String jal function_substr_at_String lw $ra, 12($sp) - sw $v1, 68($sp) # internal_32 = result of function_substr_at_String + sw $v1, 68($sp) # internal_31 = result of function_substr_at_String addi $sp, $sp, 16 # Freeing space for arguments # Set attribute rest of self - lw $t0, 188($sp) # $t0 = self - lw $t1, 52($sp) # $t1 = internal_32 - sw $t1, 12($t0) # self.rest = internal_32 + lw $t0, 184($sp) # $t0 = self + lw $t1, 52($sp) # $t1 = internal_31 + beq $t1, $zero, object_set_attribute_8756104419810 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104419810 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104419810 + j object_set_attribute_8756104419810 + int_set_attribute_8756104419810: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.rest = internal_31 + j end_set_attribute_8756104419810 + bool_set_attribute_8756104419810: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.rest = internal_31 + j end_set_attribute_8756104419810 + object_set_attribute_8756104419810: + sw $t1, 12($t0) # self.rest = internal_31 + end_set_attribute_8756104419810: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i lw $t0, 172($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 164($sp) - j end_assign - not_is_Bool_or_Int: - # i = j - lw $t0, 172($sp) - sw $t0, 164($sp) - end_assign: + sw $t0, 4($sp) # Storing i - lw $t0, 164($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 92($sp) - j end_assign - not_is_Bool_or_Int: - # internal_22 = i - lw $t0, 164($sp) + # Argument j + lw $t0, 180($sp) + sw $t0, 0($sp) # Storing j + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 172($sp) # i = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_21 = i + lw $t0, 160($sp) sw $t0, 92($sp) - end_assign: - # Jumping to endif_8763448689089 - j endif_8763448689089 + # Jumping to endif_8756104474865 + j endif_8756104474865 - else_8763448689089: + else_8756104474865: # Allocating Int 10 li $v0, 9 @@ -6173,24 +7779,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 10 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_33 = address of allocated object Int + sw $v0, 48($sp) # internal_32 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument int - lw $t0, 192($sp) + lw $t0, 188($sp) sw $t0, 4($sp) # Storing int - # Argument internal_33 + # Argument internal_32 lw $t0, 60($sp) - sw $t0, 0($sp) # Storing internal_33 + sw $t0, 0($sp) # Storing internal_32 # Calling function function_mult jal function_mult lw $ra, 8($sp) - sw $v1, 56($sp) # internal_34 = result of function_mult + sw $v1, 56($sp) # internal_33 = result of function_mult addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -6203,28 +7809,28 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_35 = address of allocated object Int + sw $v0, 40($sp) # internal_34 = address of allocated object Int # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument s - lw $t0, 200($sp) + lw $t0, 196($sp) sw $t0, 8($sp) # Storing s # Argument i - lw $t0, 180($sp) + lw $t0, 176($sp) sw $t0, 4($sp) # Storing i - # Argument internal_35 + # Argument internal_34 lw $t0, 56($sp) - sw $t0, 0($sp) # Storing internal_35 + sw $t0, 0($sp) # Storing internal_34 # Calling function function_substr_at_String jal function_substr_at_String lw $ra, 12($sp) - sw $v1, 52($sp) # internal_36 = result of function_substr_at_String + sw $v1, 52($sp) # internal_35 = result of function_substr_at_String addi $sp, $sp, 16 # Freeing space for arguments # Passing function arguments @@ -6232,53 +7838,54 @@ sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 200($sp) + lw $t0, 196($sp) sw $t0, 4($sp) # Storing self - # Argument internal_36 + # Argument internal_35 lw $t0, 48($sp) - sw $t0, 0($sp) # Storing internal_36 + sw $t0, 0($sp) # Storing internal_35 # Calling function function_c2i_at_Parse jal function_c2i_at_Parse lw $ra, 8($sp) - sw $v1, 44($sp) # internal_37 = result of function_c2i_at_Parse + sw $v1, 44($sp) # internal_36 = result of function_c2i_at_Parse addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_34 + # Argument internal_33 lw $t0, 56($sp) - sw $t0, 4($sp) # Storing internal_34 + sw $t0, 4($sp) # Storing internal_33 - # Argument internal_37 + # Argument internal_36 lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_37 + sw $t0, 0($sp) # Storing internal_36 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 40($sp) # internal_38 = result of function_add + sw $v1, 40($sp) # internal_37 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 180($sp) - j end_assign - not_is_Bool_or_Int: - # int = internal_38 - lw $t0, 28($sp) - sw $t0, 180($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument int + lw $t0, 188($sp) + sw $t0, 4($sp) # Storing int + + # Argument internal_37 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_37 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 188($sp) # int = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 li $v0, 9 @@ -6290,43 +7897,43 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_39 = address of allocated object Int + sw $v0, 24($sp) # internal_38 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 176($sp) + lw $t0, 172($sp) sw $t0, 4($sp) # Storing i - # Argument internal_39 + # Argument internal_38 lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_39 + sw $t0, 0($sp) # Storing internal_38 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 32($sp) # internal_40 = result of function_add + sw $v1, 32($sp) # internal_39 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 20($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 164($sp) - j end_assign - not_is_Bool_or_Int: - # i = internal_40 - lw $t0, 20($sp) - sw $t0, 164($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 172($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_39 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_39 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 172($sp) # i = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bool 0 li $v0, 9 @@ -6338,53 +7945,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_42 = address of allocated object Int + sw $v0, 12($sp) # internal_41 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 176($sp) + lw $t0, 172($sp) sw $t0, 4($sp) # Storing i # Argument j - lw $t0, 184($sp) + lw $t0, 180($sp) sw $t0, 0($sp) # Storing j # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 20($sp) # internal_43 = result of function_equal + sw $v1, 20($sp) # internal_42 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 12($sp) - j end_assign - not_is_Bool_or_Int: - # internal_42 = internal_43 + # internal_41 = internal_42 lw $t0, 8($sp) sw $t0, 12($sp) - end_assign: - # If internal_42 then goto then_8763448689083 + # If internal_41 then goto then_8756104474859 lw $t0, 12($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8763448689083 + beq $t0, $t1, then_8756104474859 - # Jumping to else_8763448689083 - j else_8763448689083 + # Jumping to else_8756104474859 + j else_8756104474859 - then_8763448689083: + then_8756104474859: # Allocating String li $v0, 9 @@ -6394,39 +7988,58 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 9 sw $t0, 4($v0) # Setting length of the string in the second word of the object sb $zero, 8($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_44 = "" + sw $v0, 4($sp) # internal_43 = "" # Set attribute rest of self - lw $t0, 188($sp) # $t0 = self - lw $t1, 4($sp) # $t1 = internal_44 - sw $t1, 12($t0) # self.rest = internal_44 - - lw $t0, 4($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 16($sp) - j end_assign - not_is_Bool_or_Int: - # internal_41 = internal_44 + lw $t0, 184($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_43 + beq $t1, $zero, object_set_attribute_8756104421093 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104421093 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104421093 + j object_set_attribute_8756104421093 + int_set_attribute_8756104421093: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.rest = internal_43 + j end_set_attribute_8756104421093 + bool_set_attribute_8756104421093: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.rest = internal_43 + j end_set_attribute_8756104421093 + object_set_attribute_8756104421093: + sw $t1, 12($t0) # self.rest = internal_43 + end_set_attribute_8756104421093: + + # internal_40 = internal_43 lw $t0, 4($sp) sw $t0, 16($sp) - end_assign: - # Jumping to endif_8763448689083 - j endif_8763448689083 + # Jumping to endif_8756104474859 + j endif_8756104474859 - else_8763448689083: + else_8756104474859: # Allocating String li $v0, 9 @@ -6436,89 +8049,50 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 9 sw $t0, 4($v0) # Setting length of the string in the second word of the object sb $zero, 8($v0) # Null-terminator at the end of the string - sw $v0, 0($sp) # internal_45 = "" + sw $v0, 0($sp) # internal_44 = "" - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 16($sp) - j end_assign - not_is_Bool_or_Int: - # internal_41 = internal_45 + # internal_40 = internal_44 lw $t0, 0($sp) sw $t0, 16($sp) - end_assign: - # Jumping to endif_8763448689083 - j endif_8763448689083 + # Jumping to endif_8756104474859 + j endif_8756104474859 - endif_8763448689083: + endif_8756104474859: - lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 92($sp) - j end_assign - not_is_Bool_or_Int: - # internal_22 = internal_41 + # internal_21 = internal_40 lw $t0, 16($sp) sw $t0, 92($sp) - end_assign: - # Jumping to endif_8763448689089 - j endif_8763448689089 + # Jumping to endif_8756104474865 + j endif_8756104474865 - endif_8763448689089: + endif_8756104474865: - lw $t0, 92($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 136($sp) - j end_assign - not_is_Bool_or_Int: - # internal_11 = internal_22 + # internal_10 = internal_21 lw $t0, 92($sp) sw $t0, 136($sp) - end_assign: - # Jumping to endif_8763448689101 - j endif_8763448689101 + # Jumping to endif_8756104474877 + j endif_8756104474877 - endif_8763448689101: + endif_8756104474877: - # Jumping to while_start_8763448689122 - j while_start_8763448689122 + # Jumping to while_start_8756104475158 + j while_start_8756104475158 - while_end_8763448689122: + while_end_8756104475158: # Loading return value in $v1 - lw $v1, 180($sp) + lw $v1, 176($sp) # Freeing space for local variables - addi $sp, $sp, 184 + addi $sp, $sp, 180 jr $ra @@ -6556,7 +8130,39 @@ # Set attribute boolop of self lw $t0, 12($sp) # $t0 = self lw $t1, 8($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8756104418178 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104418178 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104418178 + j object_set_attribute_8756104418178 + int_set_attribute_8756104418178: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.boolop = internal_0 + j end_set_attribute_8756104418178 + bool_set_attribute_8756104418178: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.boolop = internal_0 + j end_set_attribute_8756104418178 + object_set_attribute_8756104418178: sw $t1, 8($t0) # self.boolop = internal_0 + end_set_attribute_8756104418178: # Allocating String li $v0, 9 @@ -6566,7 +8172,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 9 sw $t0, 4($v0) # Setting length of the string in the second word of the object sb $zero, 8($v0) # Null-terminator at the end of the string @@ -6576,7 +8182,39 @@ # Set attribute rest of self lw $t0, 12($sp) # $t0 = self lw $t1, 4($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8756104420666 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104420666 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104420666 + j object_set_attribute_8756104420666 + int_set_attribute_8756104420666: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.rest = internal_1 + j end_set_attribute_8756104420666 + bool_set_attribute_8756104420666: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.rest = internal_1 + j end_set_attribute_8756104420666 + object_set_attribute_8756104420666: sw $t1, 12($t0) # self.rest = internal_1 + end_set_attribute_8756104420666: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments @@ -6595,7 +8233,39 @@ # Set attribute g of self lw $t0, 12($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_2 + beq $t1, $zero, object_set_attribute_8756104420684 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8756104420684 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8756104420684 + j object_set_attribute_8756104420684 + int_set_attribute_8756104420684: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.g = internal_2 + j end_set_attribute_8756104420684 + bool_set_attribute_8756104420684: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.g = internal_2 + j end_set_attribute_8756104420684 + object_set_attribute_8756104420684: sw $t1, 16($t0) # self.g = internal_2 + end_set_attribute_8756104420684: # Loading return value in $v1 lw $v1, 12($sp) @@ -6616,7 +8286,38 @@ # Get attribute g of self lw $t0, 16($sp) # Get the address of self lw $t1, 16($t0) # Get the attribute 'g' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8756104420741 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8756104420741 + j object_get_attribute_8756104420741 + int_get_attribute_8756104420741: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.g + j end_get_attribute_8756104420741 + bool_get_attribute_8756104420741: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.g + j end_get_attribute_8756104420741 + object_get_attribute_8756104420741: sw $t1, 12($sp) # internal_0 = g + end_get_attribute_8756104420741: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments @@ -6635,7 +8336,38 @@ # Get attribute g of self lw $t0, 16($sp) # Get the address of self lw $t1, 16($t0) # Get the attribute 'g' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8756104420771 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8756104420771 + j object_get_attribute_8756104420771 + int_get_attribute_8756104420771: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_2 = self.g + j end_get_attribute_8756104420771 + bool_get_attribute_8756104420771: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_2 = self.g + j end_get_attribute_8756104420771 + object_get_attribute_8756104420771: sw $t1, 4($sp) # internal_2 = g + end_get_attribute_8756104420771: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments @@ -6679,7 +8411,6 @@ # Reserving space for local variables addi $sp, $sp, -12 - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -6692,55 +8423,29 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 4($sp) # internal_1 = address of allocated object Int - lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 4($sp) - j end_assign - not_is_Bool_or_Int: # internal_1 = b1 lw $t0, 16($sp) sw $t0, 4($sp) - end_assign: - # If internal_1 then goto then_8763448689478 + # If internal_1 then goto then_8756104475254 lw $t0, 4($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8763448689478 + beq $t0, $t1, then_8756104475254 - # Jumping to else_8763448689478 - j else_8763448689478 + # Jumping to else_8756104475254 + j else_8756104475254 - then_8763448689478: + then_8756104475254: - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 8($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = b2 lw $t0, 12($sp) sw $t0, 8($sp) - end_assign: - # Jumping to endif_8763448689478 - j endif_8763448689478 + # Jumping to endif_8756104475254 + j endif_8756104475254 - else_8763448689478: + else_8756104475254: # Allocating Bool 0 li $v0, 9 @@ -6754,27 +8459,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 0($sp) # internal_2 = address of allocated object Int - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 8($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_2 lw $t0, 0($sp) sw $t0, 8($sp) - end_assign: - # Jumping to endif_8763448689478 - j endif_8763448689478 + # Jumping to endif_8756104475254 + j endif_8756104475254 - endif_8763448689478: + endif_8756104475254: # Loading return value in $v1 lw $v1, 8($sp) @@ -6794,7 +8486,6 @@ # Reserving space for local variables addi $sp, $sp, -12 - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -6807,33 +8498,20 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 4($sp) # internal_1 = address of allocated object Int - lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 4($sp) - j end_assign - not_is_Bool_or_Int: # internal_1 = b1 lw $t0, 16($sp) sw $t0, 4($sp) - end_assign: - # If internal_1 then goto then_8763448689505 + # If internal_1 then goto then_8756104475281 lw $t0, 4($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8763448689505 + beq $t0, $t1, then_8756104475281 - # Jumping to else_8763448689505 - j else_8763448689505 + # Jumping to else_8756104475281 + j else_8756104475281 - then_8763448689505: + then_8756104475281: # Allocating Bool 1 li $v0, 9 @@ -6847,49 +8525,23 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 0($sp) # internal_2 = address of allocated object Int - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 8($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_2 lw $t0, 0($sp) sw $t0, 8($sp) - end_assign: - # Jumping to endif_8763448689505 - j endif_8763448689505 + # Jumping to endif_8756104475281 + j endif_8756104475281 - else_8763448689505: + else_8756104475281: - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 8($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = b2 lw $t0, 12($sp) sw $t0, 8($sp) - end_assign: - # Jumping to endif_8763448689505 - j endif_8763448689505 + # Jumping to endif_8756104475281 + j endif_8756104475281 - endif_8763448689505: + endif_8756104475281: # Loading return value in $v1 lw $v1, 8($sp) diff --git a/tests/codegen/hairyscary.mips b/tests/codegen/hairyscary.mips index b27a35d58..c46228a96 100644 --- a/tests/codegen/hairyscary.mips +++ b/tests/codegen/hairyscary.mips @@ -4,60 +4,70 @@ type_Object_attributes: .word 0 type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" + type_Object_abort_message: .asciiz "Abort called from class Object\n" type_IO: .word 8 type_IO_inherits_from: .word type_Object type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" + type_IO_abort_message: .asciiz "Abort called from class IO\n" type_Int: .word 8 type_Int_inherits_from: .word type_Object type_Int_attributes: .word 0 type_Int_name_size: .word 3 type_Int_name: .asciiz "Int" + type_Int_abort_message: .asciiz "Abort called from class Int\n" type_String: .word 8 type_String_inherits_from: .word type_Object type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" + type_String_abort_message: .asciiz "Abort called from class String\n" type_Bool: .word 8 type_Bool_inherits_from: .word type_Object type_Bool_attributes: .word 0 type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" + type_Bool_abort_message: .asciiz "Abort called from class Bool\n" type_Foo: .word 28 type_Foo_inherits_from: .word type_Bazz type_Foo_attributes: .word 5 type_Foo_name_size: .word 3 type_Foo_name: .asciiz "Foo" + type_Foo_abort_message: .asciiz "Abort called from class Foo\n" type_Bar: .word 44 type_Bar_inherits_from: .word type_Razz type_Bar_attributes: .word 9 type_Bar_name_size: .word 3 type_Bar_name: .asciiz "Bar" + type_Bar_abort_message: .asciiz "Abort called from class Bar\n" type_Razz: .word 36 type_Razz_inherits_from: .word type_Foo type_Razz_attributes: .word 7 type_Razz_name_size: .word 4 type_Razz_name: .asciiz "Razz" + type_Razz_abort_message: .asciiz "Abort called from class Razz\n" type_Bazz: .word 20 type_Bazz_inherits_from: .word type_IO type_Bazz_attributes: .word 3 type_Bazz_name_size: .word 4 type_Bazz_name: .asciiz "Bazz" + type_Bazz_abort_message: .asciiz "Abort called from class Bazz\n" type_Main: .word 24 type_Main_inherits_from: .word type_Object type_Main_attributes: .word 4 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" + type_Main_abort_message: .asciiz "Abort called from class Main\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -340,12 +350,12 @@ function_equal: # Function parameters - # $ra = 40($sp) - # a = 36($sp) - # b = 32($sp) + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) # Reserving space for local variables - addi $sp, $sp, -32 + addi $sp, $sp, -40 # Allocating Bool 0 li $v0, 9 @@ -357,22 +367,57 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_0 = address of allocated object Int + sw $v0, 36($sp) # internal_0 = address of allocated object Int - # internal_1 = typeof a that is the first word of the object - lw $t0, 36($sp) - lw $t1, 0($t0) - sw $t1, 24($sp) + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) - # internal_2 = direction of Int + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int la $t0, type_Int sw $t0, 20($sp) - # internal_3 = direction of Bool + # internal_5 = direction of Bool la $t0, type_Bool sw $t0, 16($sp) - # internal_4 = direction of String + # internal_6 = direction of String la $t0, type_String sw $t0, 12($sp) @@ -386,7 +431,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_5 = address of allocated object Int + sw $v0, 8($sp) # internal_7 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -398,7 +443,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_6 = address of allocated object Int + sw $v0, 4($sp) # internal_8 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -410,42 +455,42 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_7 = address of allocated object Int + sw $v0, 0($sp) # internal_9 = address of allocated object Int - # internal_5 = EqualAddress(internal_1, internal_2) + # internal_7 = EqualAddress(internal_3, internal_4) lw $t0, 24($sp) lw $t1, 20($sp) seq $t2, $t0, $t1 lw $t0, 8($sp) sw $t2, 8($t0) - # internal_6 = EqualAddress(internal_1, internal_3) + # internal_8 = EqualAddress(internal_3, internal_5) lw $t0, 24($sp) lw $t1, 16($sp) seq $t2, $t0, $t1 lw $t0, 4($sp) sw $t2, 8($t0) - # internal_7 = EqualAddress(internal_1, internal_4) + # internal_9 = EqualAddress(internal_3, internal_6) lw $t0, 24($sp) lw $t1, 12($sp) seq $t2, $t0, $t1 lw $t0, 0($sp) sw $t2, 8($t0) - # If internal_5 then goto a_is_type_int_or_bool + # If internal_7 then goto a_is_type_int_or_bool lw $t0, 8($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison beq $t0, $t1, a_is_type_int_or_bool - # If internal_6 then goto a_is_type_int_or_bool + # If internal_8 then goto a_is_type_int_or_bool lw $t0, 4($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison beq $t0, $t1, a_is_type_int_or_bool - # If internal_7 then goto a_is_type_string + # If internal_9 then goto a_is_type_string lw $t0, 0($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison @@ -457,12 +502,12 @@ a_is_type_int_or_bool: # internal_0 = EqualInt(a, b) - lw $t0, 36($sp) + lw $t0, 44($sp) lw $t0, 8($t0) - lw $t1, 32($sp) + lw $t1, 40($sp) lw $t1, 8($t1) seq $t2, $t0, $t1 - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t2, 8($t0) # Jumping to end_of_equal @@ -471,14 +516,14 @@ a_is_type_string: # internal_0 = EqualStr(a, b) - lw $t0, 36($sp) - lw $t1, 32($sp) + lw $t0, 44($sp) + lw $t1, 40($sp) addi $t0, $t0, 8 addi $t1, $t1, 8 # By default we assume the strings are equals addi $t4, $zero, 1 - lw $t5, 28($sp) + lw $t5, 36($sp) sw $t4, 8($t5) while_compare_strings_start: @@ -487,7 +532,7 @@ beq $t2, $t3, while_compare_strings_update # The strings are no equals - lw $t5, 28($sp) + lw $t5, 36($sp) sw $zero, 8($t5) j while_compare_strings_end @@ -495,6 +540,7 @@ addi $t0, $t0, 1 addi $t1, $t1, 1 beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end j while_compare_strings_start while_compare_strings_end: @@ -504,11 +550,11 @@ a_is_type_object: # Equal operation - lw $t0, 36($sp) # Save in $t0 the left operand address - lw $t1, 32($sp) # Save in $t1 the right operand address + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address seq $t2, $t0, $t1 # $t2 = $t0 == $t1 - lw $t0, 28($sp) # $t0 = internal_0 + lw $t0, 36($sp) # $t0 = internal_0 sw $t2, 8($t0) # Setting value in the third word of the Bool object # Jumping to end_of_equal @@ -517,10 +563,156 @@ end_of_equal: # Loading return value in $v1 - lw $v1, 28($sp) + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) # Freeing space for local variables - addi $sp, $sp, 32 + addi $sp, $sp, 28 jr $ra @@ -536,15 +728,184 @@ function_abort_at_Object: # Function parameters - # $ra = 4($sp) - # self = 0($sp) + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_2[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_2 = "\n" + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_type_name_at_Object + jal function_type_name_at_Object + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 12($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) # $t0 = internal_3 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string internal_3 + li $v0, 4 + move $a0, $t0 + syscall # Exit program li $v0, 10 syscall # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 jr $ra @@ -560,7 +921,7 @@ lw $t0, 4($sp) # $t0 = self lw $t1, 0($t0) # $t1 = type of self lw $t2, 12($t1) # $t1 = length of the name of self - lw $t3, 16($t1) # $t1 = name of self + la $t3, 16($t1) # $t1 = name of self addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 @@ -570,26 +931,24 @@ la $t4, type_String sw $t4, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - move $t4, $v0 # $t4 = direction of the new string + addi $t4, $v0, 0 # $t4 = direction of the new string addi $t4, $t4, 8 # Pointer to the first character of the string - addi $t0, $t0, 8 # Pointer to the first character of the string in self xor $t5, $t5, $t5 # Initializing counter while_copy_name_start: - beq $t5, $t1, while_copy_name_end - lb $t6, 0($t0) # Loading the character + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character sb $t6, 0($t4) addi $t4, $t4, 1 # Incrementing the pointer to the new string - addi $t0, $t0, 1 # Incrementing the pointer to the string in self + addi $t3, $t3, 1 # Incrementing the pointer to the string in self addi $t5, $t5, 1 # Incrementing counter j while_copy_name_start while_copy_name_end: sb $zero, 0($t4) # Setting the null byte - sw $t4, 0($sp) # Storing the new string in internal_0 + sw $v0, 0($sp) # Storing the new string in internal_0 # Loading return value in $v1 lw $v1, 0($sp) @@ -707,16 +1066,18 @@ xor $t0, $t0, $t0 # Initializing counter while_read_start: - lw $t1, buffer_input($t0) # Loading the byte + lb $t1, buffer_input($t0) # Loading the byte beq $t1, $zero, while_read_end addi $t0, $t0, 1 # Incrementing counter j while_read_start while_read_end: + addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 move $a0, $t0 syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte la $t2, type_String sw $t2, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting length in the second word of the object @@ -726,7 +1087,7 @@ while_copy_from_buffer_start: beq $t4, $t0, while_copy_from_buffer_end - lw $t5, buffer_input($t4) # Loading the byte + lb $t5, buffer_input($t4) # Loading the byte sb $t5, 0($t3) # Storing the byte addi $t3, $t3, 1 # Imcremeenting pointer addi $t4, $t4, 1 # Incrementing counter @@ -753,12 +1114,25 @@ # Reserving space for local variables addi $sp, $sp, -4 - li $v0, 5 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 syscall - sw $v0, 0($sp) # Storing the new object in internal_0 - # Loading return value in $v1 - lw $v1, 0($sp) + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) # Freeing space for local variables addi $sp, $sp, 4 @@ -783,11 +1157,24 @@ # Reserving space for local variables addi $sp, $sp, -4 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + # internal_0 = length of self lw $t0, 4($sp) lw $t1, 4($t0) addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator - sw $t1, 0($sp) + lw $t0, 0($sp) + sw $t1, 8($t0) # Loading return value in $v1 lw $v1, 0($sp) @@ -811,6 +1198,8 @@ lw $t1, 4($sp) lw $t2, 4($t0) # $t2 = length of str1 lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 add $t4, $t2, $t3 # $t4 = length of str1 + str2 addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) @@ -830,7 +1219,7 @@ xor $t6, $t6, $t6 # $t6 = 0 Initializing counter while_copy_str1_start: beq $t6, $t2, while_copy_str1_end - lb $t7, 0($t0) + lb $t7, 8($t0) sb $t7, 0($t5) add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string @@ -841,7 +1230,7 @@ # Copying str2 to the new string while_copy_str2_start: beq $t6, $t4, while_copy_str2_end - lb $t7, 0($t1) + lb $t7, 8($t1) sb $t7, 0($t5) add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string @@ -874,11 +1263,14 @@ # internal_0 = self[i:i + l] lw $t0, 12($sp) # $t0 = address of the string lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring - bge $t4, $t1, substring_out_of_bounds + bgt $t4, $t1, substring_out_of_bounds addi $t3, $t3, 9 li $v0, 9 @@ -928,11 +1320,11 @@ function___init___at_Foo: # Function parameters - # $ra = 340($sp) - # self = 336($sp) + # $ra = 456($sp) + # self = 452($sp) # Reserving space for local variables - addi $sp, $sp, -336 + addi $sp, $sp, -452 # Allocating Int 1 li $v0, 9 @@ -944,18 +1336,83 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 332($sp) # internal_0 = address of allocated object Int + sw $v0, 448($sp) # internal_0 = address of allocated object Int # Set attribute h of self - lw $t0, 336($sp) # $t0 = self - lw $t1, 332($sp) # $t1 = internal_0 + lw $t0, 452($sp) # $t0 = self + lw $t1, 448($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8744937288307 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937288307 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937288307 + j object_set_attribute_8744937288307 + int_set_attribute_8744937288307: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.h = internal_0 + j end_set_attribute_8744937288307 + bool_set_attribute_8744937288307: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.h = internal_0 + j end_set_attribute_8744937288307 + object_set_attribute_8744937288307: sw $t1, 8($t0) # self.h = internal_0 + end_set_attribute_8744937288307: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 444($sp) # internal_1 = address of allocated object Int + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 440($sp) # internal_2 = address of allocated object Int + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 436($sp) # internal_3 = address of allocated object Int + # Allocating NUll to internal_4 + sw $zero, 432($sp) # internal_4 = 0 # Allocating Int 0 li $v0, 9 @@ -967,7 +1424,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 308($sp) # internal_6 = address of allocated object Int + sw $v0, 428($sp) # internal_5 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -979,588 +1436,837 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 316($sp) # internal_4 = address of allocated object Int + sw $v0, 416($sp) # internal_8 = address of allocated object Int + # internal_6 = typeof self that is the first word of the object + lw $t0, 452($sp) + lw $t0, 0($t0) + sw $t0, 424($sp) + # internal_7 = internal_6 + lw $t0, 424($sp) + sw $t0, 420($sp) + while_start_8744937301489: - # internal_2 = typeof self that is the first word of the object - lw $t0, 336($sp) - lw $t1, 0($t0) - sw $t1, 324($sp) - - lw $t0, 324($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 320($sp) - j end_assign - not_is_Bool_or_Int: - # internal_3 = internal_2 - lw $t0, 324($sp) - sw $t0, 320($sp) - end_assign: - - lw $t0, 308($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 328($sp) - j end_assign - not_is_Bool_or_Int: - # internal_1 = internal_6 - lw $t0, 308($sp) - sw $t0, 328($sp) - end_assign: - - while_start_8779768528306: + # internal_8 = EqualAddress(internal_7, internal_4) + lw $t0, 420($sp) + lw $t1, 432($sp) + seq $t2, $t0, $t1 + lw $t0, 416($sp) + sw $t2, 8($t0) - # Equal operation - lw $t0, 320($sp) # Save in $t0 the left operand address - # If internal_4 then goto while_end_8779768528306 - lw $t0, 316($sp) # Loading the address of the condition + # If internal_8 then goto while_end_8744937301489 + lw $t0, 416($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_end_8779768528306 + beq $t0, $t1, while_end_8744937301489 - # Addition operation - lw $t0, 328($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # internal_3 = ancestor of internal_3 that is the first word of the object - lw $t0, 320($sp) - lw $t1, 4($t0) - sw $t1, 320($sp) + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Jumping to while_start_8779768528306 - j while_start_8779768528306 + # Argument internal_5 + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing internal_5 - while_end_8779768528306: + # Argument internal_2 + lw $t0, 452($sp) + sw $t0, 0($sp) # Storing internal_2 + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 440($sp) # internal_5 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + # internal_7 = ancestor of internal_7 + lw $t0, 420($sp) + lw $t0, 4($t0) + sw $t0, 420($sp) + # Jumping to while_start_8744937301489 + j while_start_8744937301489 - lw $t0, 324($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 320($sp) - j end_assign - not_is_Bool_or_Int: - # internal_3 = internal_2 - lw $t0, 324($sp) - sw $t0, 320($sp) - end_assign: + while_end_8744937301489: + # internal_7 = internal_6 + lw $t0, 424($sp) + sw $t0, 420($sp) - foreach_start_8779768528306: + # initialize Array [internal_5] + lw $t0, 428($sp) # $t0 = internal_5 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 412($sp) # internal_9 = new Array[internal_5] - # Less than operation - lw $t0, 300($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 328($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - lw $t0, 296($sp) # $t0 = internal_9 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 408($sp) # internal_10 = address of allocated object Int - # If internal_9 then goto foreach_body_8779768528306 - lw $t0, 296($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_body_8779768528306 + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 404($sp) # internal_11 = address of allocated object Int - # Jumping to foreach_end_8779768528306 - j foreach_end_8779768528306 + foreach_start_8744937301489: - foreach_body_8779768528306: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_10 + lw $t0, 420($sp) + sw $t0, 4($sp) # Storing internal_10 - # internal_3 = ancestor of internal_3 that is the first word of the object - lw $t0, 320($sp) - lw $t1, 4($t0) - sw $t1, 320($sp) + # Argument internal_5 + lw $t0, 440($sp) + sw $t0, 0($sp) # Storing internal_5 - # Addition operation - lw $t0, 300($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_start_8779768528306 - j foreach_start_8779768528306 + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 416($sp) # internal_11 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_11 then goto foreach_body_8744937301489 + lw $t0, 404($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8744937301489 + + # Jumping to foreach_end_8744937301489 + j foreach_end_8744937301489 + + foreach_body_8744937301489: + + # array internal_9[4 * internal_10] = internal_7 + lw $t0, 408($sp) # $t0 = internal_10 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 412($sp) # $t1 = internal_9 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 420($sp) + sw $t0, 0($t1) + + # internal_7 = ancestor of internal_7 + lw $t0, 420($sp) + lw $t0, 4($t0) + sw $t0, 420($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 420($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_2 + lw $t0, 452($sp) + sw $t0, 0($sp) # Storing internal_2 - foreach_end_8779768528306: + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 420($sp) # internal_10 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + # Jumping to foreach_start_8744937301489 + j foreach_start_8744937301489 + foreach_end_8744937301489: + # initialize Array [internal_3] + lw $t0, 436($sp) # $t0 = internal_3 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 400($sp) # internal_12 = new Array[internal_3] + + # initialize Array [internal_3] + lw $t0, 436($sp) # $t0 = internal_3 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 396($sp) # internal_13 = new Array[internal_3] + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 388($sp) # internal_15 = address of allocated object Int - # internal_12 = direction of Bazz + # internal_14 = direction of Bazz la $t0, type_Bazz - sw $t0, 284($sp) + sw $t0, 392($sp) + + # array internal_12[4 * internal_15] = internal_14 + lw $t0, 388($sp) # $t0 = internal_15 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 400($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 392($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_15] = internal_5 + lw $t0, 388($sp) # $t0 = internal_15 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 396($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 428($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 380($sp) # internal_17 = address of allocated object Int - # internal_13 = direction of Razz + # internal_16 = direction of Razz la $t0, type_Razz - sw $t0, 280($sp) + sw $t0, 384($sp) + + # array internal_12[4 * internal_17] = internal_16 + lw $t0, 380($sp) # $t0 = internal_17 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 400($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 384($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_17] = internal_5 + lw $t0, 380($sp) # $t0 = internal_17 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 396($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 428($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 372($sp) # internal_19 = address of allocated object Int - # internal_14 = direction of Foo + # internal_18 = direction of Foo la $t0, type_Foo - sw $t0, 276($sp) + sw $t0, 376($sp) + + # array internal_12[4 * internal_19] = internal_18 + lw $t0, 372($sp) # $t0 = internal_19 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 400($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 376($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_19] = internal_5 + lw $t0, 372($sp) # $t0 = internal_19 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 396($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 428($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 364($sp) # internal_21 = address of allocated object Int - # internal_15 = direction of Bar + # internal_20 = direction of Bar la $t0, type_Bar - sw $t0, 272($sp) - + sw $t0, 368($sp) + + # array internal_12[4 * internal_21] = internal_20 + lw $t0, 364($sp) # $t0 = internal_21 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 400($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 368($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_21] = internal_5 + lw $t0, 364($sp) # $t0 = internal_21 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 396($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 428($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 360($sp) # internal_22 = address of allocated object Int + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 356($sp) # internal_23 = address of allocated object Int - foreach_type_start_8779768528306: + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Less than operation - lw $t0, 268($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # If internal_17 then goto foreach_type_body_8779768528306 - lw $t0, 264($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_type_body_8779768528306 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 348($sp) # internal_25 = address of allocated object Int - # Jumping to foreach_type_end_8779768528306 - j foreach_type_end_8779768528306 + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - foreach_type_body_8779768528306: + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 344($sp) # internal_26 = address of allocated object Int + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 336($sp) # internal_28 = address of allocated object Int + foreach_type_start_8744937301489: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - foreach_ancestor_start_8779768528306: + # Argument internal_22 + lw $t0, 372($sp) + sw $t0, 4($sp) # Storing internal_22 - # Less than operation - lw $t0, 256($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 328($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + # Argument internal_3 + lw $t0, 448($sp) + sw $t0, 0($sp) # Storing internal_3 - lw $t0, 252($sp) # $t0 = internal_20 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 368($sp) # internal_23 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - # If internal_20 then goto foreach_ancestor_body_8779768528306 - lw $t0, 252($sp) # Loading the address of the condition + # If internal_23 then goto foreach_type_body_8744937301489 + lw $t0, 356($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_body_8779768528306 - - # Jumping to foreach_ancestor_end_8779768528306 - j foreach_ancestor_end_8779768528306 + beq $t0, $t1, foreach_type_body_8744937301489 - foreach_ancestor_body_8779768528306: + # Jumping to foreach_type_end_8744937301489 + j foreach_type_end_8744937301489 + foreach_type_body_8744937301489: - # Equal operation - lw $t0, 260($sp) # Save in $t0 the left operand address - lw $t1, 248($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 - - lw $t0, 244($sp) # $t0 = internal_22 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # If internal_22 then goto foreach_ancestor_end_8779768528306 - lw $t0, 244($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_end_8779768528306 - - # Addition operation - lw $t0, 256($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_ancestor_start_8779768528306 - j foreach_ancestor_start_8779768528306 - - foreach_ancestor_end_8779768528306: + # internal_24 = array internal_12[4 * internal_22] + lw $t0, 360($sp) # $t0 = internal_22 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 400($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 352($sp) # internal_24 = array internal_12[4 * internal_22] + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_25 + lw $t0, 360($sp) + sw $t0, 4($sp) # Storing internal_25 + # Argument internal_1 + lw $t0, 456($sp) + sw $t0, 0($sp) # Storing internal_1 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 360($sp) # internal_25 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # Addition operation - lw $t0, 268($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_type_start_8779768528306 - j foreach_type_start_8779768528306 + foreach_ancestor_start_8744937301489: - foreach_type_end_8779768528306: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_25 + lw $t0, 360($sp) + sw $t0, 4($sp) # Storing internal_25 + # Argument internal_5 + lw $t0, 440($sp) + sw $t0, 0($sp) # Storing internal_5 + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 356($sp) # internal_26 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + # If internal_26 then goto foreach_ancestor_body_8744937301489 + lw $t0, 344($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8744937301489 + # Jumping to foreach_ancestor_end_8744937301489 + j foreach_ancestor_end_8744937301489 + foreach_ancestor_body_8744937301489: - lw $t0, 328($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 228($sp) - j end_assign - not_is_Bool_or_Int: - # internal_26 = internal_1 - lw $t0, 328($sp) - sw $t0, 228($sp) - end_assign: + # internal_27 = array internal_9[4 * internal_25] + lw $t0, 348($sp) # $t0 = internal_25 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 412($sp) # $t1 = internal_9 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 340($sp) # internal_27 = array internal_9[4 * internal_25] - foreach_min_start_8779768528306: + # internal_28 = EqualAddress(internal_24, internal_27) + lw $t0, 352($sp) + lw $t1, 340($sp) + seq $t2, $t0, $t1 + lw $t0, 336($sp) + sw $t2, 8($t0) - # Less than operation - lw $t0, 240($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # If internal_27 then goto foreach_min_body_8779768528306 - lw $t0, 224($sp) # Loading the address of the condition + # If internal_28 then goto foreach_ancestor_end_8744937301489 + lw $t0, 336($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_min_body_8779768528306 - - # Jumping to foreach_min_end_8779768528306 - j foreach_min_end_8779768528306 + beq $t0, $t1, foreach_ancestor_end_8744937301489 - foreach_min_body_8779768528306: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_25 + lw $t0, 360($sp) + sw $t0, 4($sp) # Storing internal_25 - # Less than operation - lw $t0, 232($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 228($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + # Argument internal_2 + lw $t0, 452($sp) + sw $t0, 0($sp) # Storing internal_2 - lw $t0, 224($sp) # $t0 = internal_27 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 360($sp) # internal_25 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - # If internal_27 then goto update_min_8779768528306 - lw $t0, 224($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, update_min_8779768528306 + # Jumping to foreach_ancestor_start_8744937301489 + j foreach_ancestor_start_8744937301489 - # Jumping to foreach_min_end_8779768528306 - j foreach_min_end_8779768528306 + foreach_ancestor_end_8744937301489: - update_min_8779768528306: + # array internal_13[4 * internal_22] = internal_25 + lw $t0, 360($sp) # $t0 = internal_22 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 396($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 348($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - lw $t0, 232($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 228($sp) - j end_assign - not_is_Bool_or_Int: - # internal_26 = internal_25 - lw $t0, 232($sp) - sw $t0, 228($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - lw $t0, 240($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 236($sp) - j end_assign - not_is_Bool_or_Int: - # internal_24 = internal_23 - lw $t0, 240($sp) - sw $t0, 236($sp) - end_assign: + # Argument internal_22 + lw $t0, 372($sp) + sw $t0, 4($sp) # Storing internal_22 - update_min_end_8779768528306: + # Argument internal_2 + lw $t0, 452($sp) + sw $t0, 0($sp) # Storing internal_2 - # Addition operation - lw $t0, 240($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_min_start_8779768528306 - j foreach_min_start_8779768528306 + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 372($sp) # internal_22 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - foreach_min_end_8779768528306: + # Jumping to foreach_type_start_8744937301489 + j foreach_type_start_8744937301489 + foreach_type_end_8744937301489: + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_34[0] = '\n' + sb $zero, 9($v0) # Null-terminator at the end of the string + sw $v0, 312($sp) # internal_34 = "\n" + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - # Equal operation - lw $t0, 236($sp) # Save in $t0 the left operand address - lw $t1, 328($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - lw $t0, 216($sp) # $t0 = internal_29 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - # If internal_29 then goto error_branch_8779768528306 - lw $t0, 216($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, error_branch_8779768528306 + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_35[0] = ' ' + sb $zero, 9($v0) # Null-terminator at the end of the string + sw $v0, 308($sp) # internal_35 = " " - # If internal_30 then goto branch_Bazz_8779768528306 - lw $t0, 212($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Bazz_8779768528306 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 332($sp) # internal_29 = address of allocated object Int - # If internal_30 then goto branch_Razz_8779768528306 - lw $t0, 212($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Razz_8779768528306 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 328($sp) # internal_30 = address of allocated object Int - # If internal_30 then goto branch_Foo_8779768528306 - lw $t0, 212($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Foo_8779768528306 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 324($sp) # internal_31 = address of allocated object Int - # If internal_30 then goto branch_Bar_8779768528306 - lw $t0, 212($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Bar_8779768528306 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - branch_Bazz_8779768528306: + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 320($sp) # internal_32 = address of allocated object Int - # Allocating Foo + # Allocating Bool 0 li $v0, 9 - lw $a0, type_Foo + addi $a0, $zero, 12 syscall - la $t0, type_Foo # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 200($sp) # internal_33 = address of allocated object Foo - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - # Argument internal_33 - lw $t0, 208($sp) - sw $t0, 0($sp) # Storing internal_33 + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 316($sp) # internal_33 = address of allocated object Int - # Calling function function___init___at_Foo - jal function___init___at_Foo - lw $ra, 4($sp) - sw $v1, 208($sp) # internal_33 = result of function___init___at_Foo - addi $sp, $sp, 8 # Freeing space for arguments + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - lw $t0, 200($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 208($sp) - j end_assign - not_is_Bool_or_Int: - # internal_31 = internal_33 - lw $t0, 200($sp) - sw $t0, 208($sp) - end_assign: + # Argument internal_32 + lw $t0, 332($sp) + sw $t0, 4($sp) # Storing internal_32 - # Jumping to branch_end_8779768528306 - j branch_end_8779768528306 + # Argument internal_5 + lw $t0, 440($sp) + sw $t0, 0($sp) # Storing internal_5 - branch_Razz_8779768528306: + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 332($sp) # internal_32 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # Allocating Bar - li $v0, 9 - lw $a0, type_Bar - syscall - la $t0, type_Bar # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 192($sp) # internal_35 = address of allocated object Bar + foreach_min_start_8744937301489: # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Argument internal_35 - lw $t0, 200($sp) - sw $t0, 0($sp) # Storing internal_35 + # Argument internal_29 + lw $t0, 344($sp) + sw $t0, 4($sp) # Storing internal_29 - # Calling function function___init___at_Bar - jal function___init___at_Bar - lw $ra, 4($sp) - sw $v1, 200($sp) # internal_35 = result of function___init___at_Bar - addi $sp, $sp, 8 # Freeing space for arguments + # Argument internal_3 + lw $t0, 448($sp) + sw $t0, 0($sp) # Storing internal_3 - lw $t0, 192($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 208($sp) - j end_assign - not_is_Bool_or_Int: - # internal_31 = internal_35 - lw $t0, 192($sp) - sw $t0, 208($sp) - end_assign: + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 328($sp) # internal_33 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to branch_end_8779768528306 - j branch_end_8779768528306 + # If internal_33 then goto foreach_min_body_8744937301489 + lw $t0, 316($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8744937301489 - branch_Foo_8779768528306: + # Jumping to foreach_min_end_8744937301489 + j foreach_min_end_8744937301489 - # Allocating Razz - li $v0, 9 - lw $a0, type_Razz - syscall - la $t0, type_Razz # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 184($sp) # internal_37 = address of allocated object Razz + foreach_min_body_8744937301489: - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + # internal_31 = array internal_13[4 * internal_29] + lw $t0, 332($sp) # $t0 = internal_29 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 396($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 324($sp) # internal_31 = array internal_13[4 * internal_29] + sw $t0, 8($t2) - # Argument internal_37 - lw $t0, 192($sp) - sw $t0, 0($sp) # Storing internal_37 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Calling function function___init___at_Razz - jal function___init___at_Razz - lw $ra, 4($sp) - sw $v1, 192($sp) # internal_37 = result of function___init___at_Razz - addi $sp, $sp, 8 # Freeing space for arguments + # Argument internal_31 + lw $t0, 336($sp) + sw $t0, 4($sp) # Storing internal_31 - lw $t0, 184($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 208($sp) - j end_assign - not_is_Bool_or_Int: - # internal_31 = internal_37 - lw $t0, 184($sp) - sw $t0, 208($sp) - end_assign: + # Argument internal_32 + lw $t0, 332($sp) + sw $t0, 0($sp) # Storing internal_32 - # Jumping to branch_end_8779768528306 - j branch_end_8779768528306 + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 328($sp) # internal_33 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - branch_Bar_8779768528306: + # If internal_33 then goto update_min_8744937301489 + lw $t0, 316($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8744937301489 - lw $t0, 204($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 208($sp) - j end_assign - not_is_Bool_or_Int: - # internal_31 = n - lw $t0, 204($sp) - sw $t0, 208($sp) - end_assign: + # Jumping to update_min_end_8744937301489 + j update_min_end_8744937301489 - # Jumping to branch_end_8779768528306 - j branch_end_8779768528306 + update_min_8744937301489: - error_branch_8779768528306: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_32 + lw $t0, 332($sp) + sw $t0, 4($sp) # Storing internal_32 - branch_end_8779768528306: + # Argument internal_31 + lw $t0, 336($sp) + sw $t0, 0($sp) # Storing internal_31 - # Set attribute g of self - lw $t0, 336($sp) # $t0 = self - lw $t1, 208($sp) # $t1 = internal_31 - sw $t1, 12($t0) # self.g = internal_31 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 332($sp) # internal_32 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Argument self + # Argument internal_30 + lw $t0, 340($sp) + sw $t0, 4($sp) # Storing internal_30 + + # Argument internal_29 lw $t0, 344($sp) - sw $t0, 0($sp) # Storing self + sw $t0, 0($sp) # Storing internal_29 - # Calling function function_printh_at_Bazz - jal function_printh_at_Bazz - lw $ra, 4($sp) - sw $v1, 184($sp) # internal_39 = result of function_printh_at_Bazz - addi $sp, $sp, 8 # Freeing space for arguments + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 340($sp) # internal_30 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # Set attribute i of self - lw $t0, 336($sp) # $t0 = self - lw $t1, 176($sp) # $t1 = internal_39 - sw $t1, 16($t0) # self.i = internal_39 + update_min_end_8744937301489: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_29 + lw $t0, 344($sp) + sw $t0, 4($sp) # Storing internal_29 + # Argument internal_2 + lw $t0, 452($sp) + sw $t0, 0($sp) # Storing internal_2 + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 344($sp) # internal_29 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + # Jumping to foreach_min_start_8744937301489 + j foreach_min_start_8744937301489 + foreach_min_end_8744937301489: + # initialize Array [internal_3] + lw $t0, 436($sp) # $t0 = internal_3 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 304($sp) # internal_36 = new Array[internal_3] # Allocating Int 0 li $v0, 9 @@ -1572,686 +2278,899 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 152($sp) # internal_45 = address of allocated object Int + sw $v0, 300($sp) # internal_37 = address of allocated object Int + + # array internal_36[4 * internal_37] = internal_1 + lw $t0, 300($sp) # $t0 = internal_37 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 304($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 444($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # Allocating Bool 0 + # Allocating Int 1 li $v0, 9 addi $a0, $zero, 12 syscall - la $t0, type_Bool # $t0 = address of the type + la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 160($sp) # internal_43 = address of allocated object Int - - - + sw $v0, 296($sp) # internal_38 = address of allocated object Int + + # array internal_36[4 * internal_38] = internal_1 + lw $t0, 296($sp) # $t0 = internal_38 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 304($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 444($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # internal_41 = typeof self that is the first word of the object - lw $t0, 336($sp) - lw $t1, 0($t0) - sw $t1, 168($sp) + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall - lw $t0, 168($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 164($sp) - j end_assign - not_is_Bool_or_Int: - # internal_42 = internal_41 - lw $t0, 168($sp) - sw $t0, 164($sp) - end_assign: + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 292($sp) # internal_39 = address of allocated object Int + + # array internal_36[4 * internal_39] = internal_1 + lw $t0, 292($sp) # $t0 = internal_39 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 304($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 444($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - lw $t0, 152($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 172($sp) - j end_assign - not_is_Bool_or_Int: - # internal_40 = internal_45 - lw $t0, 152($sp) - sw $t0, 172($sp) - end_assign: + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall - while_start_8779768552376: + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 288($sp) # internal_40 = address of allocated object Int + + # array internal_36[4 * internal_40] = internal_1 + lw $t0, 288($sp) # $t0 = internal_40 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 304($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 444($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # Equal operation - lw $t0, 164($sp) # Save in $t0 the left operand address - # If internal_43 then goto while_end_8779768552376 - lw $t0, 160($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_end_8779768552376 + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Addition operation - lw $t0, 172($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # internal_42 = ancestor of internal_42 that is the first word of the object - lw $t0, 164($sp) - lw $t1, 4($t0) - sw $t1, 164($sp) + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 284($sp) # internal_41 = address of allocated object Int - # Jumping to while_start_8779768552376 - j while_start_8779768552376 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - while_end_8779768552376: + # Argument internal_32 + lw $t0, 332($sp) + sw $t0, 4($sp) # Storing internal_32 + # Argument internal_5 + lw $t0, 440($sp) + sw $t0, 0($sp) # Storing internal_5 + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 296($sp) # internal_41 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + # If internal_41 then goto error_branch_8744937301489 + lw $t0, 284($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8744937301489 + + # array internal_36[4 * internal_30] = internal_2 + lw $t0, 328($sp) # $t0 = internal_30 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 304($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 440($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - lw $t0, 168($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 164($sp) - j end_assign - not_is_Bool_or_Int: - # internal_42 = internal_41 - lw $t0, 168($sp) - sw $t0, 164($sp) - end_assign: + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 280($sp) # internal_42 = address of allocated object Int - foreach_start_8779768552376: + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Less than operation - lw $t0, 144($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 172($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 276($sp) # internal_43 = address of allocated object Int + + # internal_42 = array internal_36[4 * internal_43] + lw $t0, 276($sp) # $t0 = internal_43 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 304($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 280($sp) # internal_42 = array internal_36[4 * internal_43] + sw $t0, 8($t2) + + # If internal_42 then goto branch_Bazz_8744937301489 + lw $t0, 280($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bazz_8744937301489 - lw $t0, 140($sp) # $t0 = internal_48 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # If internal_48 then goto foreach_body_8779768552376 - lw $t0, 140($sp) # Loading the address of the condition + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 272($sp) # internal_44 = address of allocated object Int + + # internal_42 = array internal_36[4 * internal_44] + lw $t0, 272($sp) # $t0 = internal_44 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 304($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 280($sp) # internal_42 = array internal_36[4 * internal_44] + sw $t0, 8($t2) + + # If internal_42 then goto branch_Razz_8744937301489 + lw $t0, 280($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_body_8779768552376 + beq $t0, $t1, branch_Razz_8744937301489 - # Jumping to foreach_end_8779768552376 - j foreach_end_8779768552376 + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall - foreach_body_8779768552376: + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 268($sp) # internal_45 = address of allocated object Int + + # internal_42 = array internal_36[4 * internal_45] + lw $t0, 268($sp) # $t0 = internal_45 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 304($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 280($sp) # internal_42 = array internal_36[4 * internal_45] + sw $t0, 8($t2) + + # If internal_42 then goto branch_Foo_8744937301489 + lw $t0, 280($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Foo_8744937301489 + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # internal_42 = ancestor of internal_42 that is the first word of the object - lw $t0, 164($sp) - lw $t1, 4($t0) - sw $t1, 164($sp) + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 264($sp) # internal_46 = address of allocated object Int + + # internal_42 = array internal_36[4 * internal_46] + lw $t0, 264($sp) # $t0 = internal_46 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 304($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 280($sp) # internal_42 = array internal_36[4 * internal_46] + sw $t0, 8($t2) + + # If internal_42 then goto branch_Bar_8744937301489 + lw $t0, 280($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bar_8744937301489 - # Addition operation - lw $t0, 144($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_start_8779768552376 - j foreach_start_8779768552376 + branch_Bazz_8744937301489: - foreach_end_8779768552376: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument n + lw $t0, 268($sp) + sw $t0, 4($sp) # Storing n + # Argument self + lw $t0, 464($sp) + sw $t0, 0($sp) # Storing self + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 268($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Foo + li $v0, 9 + lw $a0, type_Foo + syscall + la $t0, type_Foo # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 252($sp) # internal_49 = address of allocated object Foo + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - # internal_51 = direction of Razz - la $t0, type_Razz - sw $t0, 128($sp) + # Argument internal_49 + lw $t0, 260($sp) + sw $t0, 0($sp) # Storing internal_49 + # Calling function function___init___at_Foo + jal function___init___at_Foo + lw $ra, 4($sp) + sw $v1, 260($sp) # internal_49 = result of function___init___at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # internal_52 = direction of Foo - la $t0, type_Foo - sw $t0, 124($sp) + # Argument internal_47 + lw $t0, 272($sp) + sw $t0, 4($sp) # Storing internal_47 + # Argument internal_49 + lw $t0, 264($sp) + sw $t0, 0($sp) # Storing internal_49 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 272($sp) # internal_47 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # internal_53 = direction of Bar - la $t0, type_Bar - sw $t0, 120($sp) + # internal_47 = internal_49 + lw $t0, 252($sp) + sw $t0, 260($sp) + # Jumping to branch_end_8744937301489 + j branch_end_8744937301489 + branch_Razz_8744937301489: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument n + lw $t0, 268($sp) + sw $t0, 4($sp) # Storing n + # Argument self + lw $t0, 464($sp) + sw $t0, 0($sp) # Storing self - foreach_type_start_8779768552376: + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 268($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # Less than operation - lw $t0, 116($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # If internal_55 then goto foreach_type_body_8779768552376 - lw $t0, 112($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_type_body_8779768552376 + # Allocating Bar + li $v0, 9 + lw $a0, type_Bar + syscall + la $t0, type_Bar # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 244($sp) # internal_51 = address of allocated object Bar - # Jumping to foreach_type_end_8779768552376 - j foreach_type_end_8779768552376 + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - foreach_type_body_8779768552376: + # Argument internal_51 + lw $t0, 252($sp) + sw $t0, 0($sp) # Storing internal_51 + # Calling function function___init___at_Bar + jal function___init___at_Bar + lw $ra, 4($sp) + sw $v1, 252($sp) # internal_51 = result of function___init___at_Bar + addi $sp, $sp, 8 # Freeing space for arguments + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_47 + lw $t0, 272($sp) + sw $t0, 4($sp) # Storing internal_47 + # Argument internal_51 + lw $t0, 256($sp) + sw $t0, 0($sp) # Storing internal_51 - foreach_ancestor_start_8779768552376: + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 272($sp) # internal_47 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # Less than operation - lw $t0, 104($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 172($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + # internal_47 = internal_51 + lw $t0, 244($sp) + sw $t0, 260($sp) - lw $t0, 100($sp) # $t0 = internal_58 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Jumping to branch_end_8744937301489 + j branch_end_8744937301489 - # If internal_58 then goto foreach_ancestor_body_8779768552376 - lw $t0, 100($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_body_8779768552376 + branch_Foo_8744937301489: - # Jumping to foreach_ancestor_end_8779768552376 - j foreach_ancestor_end_8779768552376 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - foreach_ancestor_body_8779768552376: + # Argument n + lw $t0, 268($sp) + sw $t0, 4($sp) # Storing n + # Argument self + lw $t0, 464($sp) + sw $t0, 0($sp) # Storing self - # Equal operation - lw $t0, 108($sp) # Save in $t0 the left operand address - lw $t1, 96($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 268($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 92($sp) # $t0 = internal_60 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Allocating Razz + li $v0, 9 + lw $a0, type_Razz + syscall + la $t0, type_Razz # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 236($sp) # internal_53 = address of allocated object Razz - # If internal_60 then goto foreach_ancestor_end_8779768552376 - lw $t0, 92($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_end_8779768552376 + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - # Addition operation - lw $t0, 104($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_ancestor_start_8779768552376 - j foreach_ancestor_start_8779768552376 + # Argument internal_53 + lw $t0, 244($sp) + sw $t0, 0($sp) # Storing internal_53 - foreach_ancestor_end_8779768552376: + # Calling function function___init___at_Razz + jal function___init___at_Razz + lw $ra, 4($sp) + sw $v1, 244($sp) # internal_53 = result of function___init___at_Razz + addi $sp, $sp, 8 # Freeing space for arguments + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_47 + lw $t0, 272($sp) + sw $t0, 4($sp) # Storing internal_47 + # Argument internal_53 + lw $t0, 248($sp) + sw $t0, 0($sp) # Storing internal_53 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 272($sp) # internal_47 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # Addition operation - lw $t0, 116($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_type_start_8779768552376 - j foreach_type_start_8779768552376 + # internal_47 = internal_53 + lw $t0, 236($sp) + sw $t0, 260($sp) - foreach_type_end_8779768552376: + # Jumping to branch_end_8744937301489 + j branch_end_8744937301489 + branch_Bar_8744937301489: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument n + lw $t0, 268($sp) + sw $t0, 4($sp) # Storing n + # Argument self + lw $t0, 464($sp) + sw $t0, 0($sp) # Storing self + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 268($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - lw $t0, 172($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 76($sp) - j end_assign - not_is_Bool_or_Int: - # internal_64 = internal_40 - lw $t0, 172($sp) - sw $t0, 76($sp) - end_assign: + # Argument internal_47 + lw $t0, 272($sp) + sw $t0, 4($sp) # Storing internal_47 - foreach_min_start_8779768552376: + # Argument n + lw $t0, 268($sp) + sw $t0, 0($sp) # Storing n - # Less than operation - lw $t0, 88($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # If internal_65 then goto foreach_min_body_8779768552376 - lw $t0, 72($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_min_body_8779768552376 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 272($sp) # internal_47 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_min_end_8779768552376 - j foreach_min_end_8779768552376 + # internal_47 = n + lw $t0, 256($sp) + sw $t0, 260($sp) - foreach_min_body_8779768552376: + # Jumping to branch_end_8744937301489 + j branch_end_8744937301489 + error_branch_8744937301489: - # Less than operation - lw $t0, 80($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 76($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + branch_end_8744937301489: - lw $t0, 72($sp) # $t0 = internal_65 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # If internal_65 then goto update_min_8779768552376 - lw $t0, 72($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, update_min_8779768552376 - - # Jumping to foreach_min_end_8779768552376 - j foreach_min_end_8779768552376 - - update_min_8779768552376: - - lw $t0, 80($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 76($sp) - j end_assign - not_is_Bool_or_Int: - # internal_64 = internal_63 - lw $t0, 80($sp) - sw $t0, 76($sp) - end_assign: - - lw $t0, 88($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 84($sp) - j end_assign - not_is_Bool_or_Int: - # internal_62 = internal_61 - lw $t0, 88($sp) - sw $t0, 84($sp) - end_assign: - - update_min_end_8779768552376: - - # Addition operation - lw $t0, 88($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_min_start_8779768552376 - j foreach_min_start_8779768552376 - - foreach_min_end_8779768552376: - - - - - - - - - # Equal operation - lw $t0, 84($sp) # Save in $t0 the left operand address - lw $t1, 172($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 - - lw $t0, 64($sp) # $t0 = internal_67 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # If internal_67 then goto error_branch_8779768552376 - lw $t0, 64($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, error_branch_8779768552376 - - - - # If internal_68 then goto branch_Razz_8779768552376 - lw $t0, 60($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Razz_8779768552376 - - - # If internal_68 then goto branch_Foo_8779768552376 - lw $t0, 60($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Foo_8779768552376 - - - # If internal_68 then goto branch_Bar_8779768552376 - lw $t0, 60($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Bar_8779768552376 - - branch_Razz_8779768552376: - - # Allocating Bar + # Set attribute g of self + lw $t0, 452($sp) # $t0 = self + lw $t1, 260($sp) # $t1 = internal_47 + beq $t1, $zero, object_set_attribute_8744937288328 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937288328 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937288328 + j object_set_attribute_8744937288328 + int_set_attribute_8744937288328: li $v0, 9 - lw $a0, type_Bar + addi $a0, $zero, 12 syscall - la $t0, type_Bar # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 48($sp) # internal_71 = address of allocated object Bar - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_71 - lw $t0, 56($sp) - sw $t0, 0($sp) # Storing internal_71 - - # Calling function function___init___at_Bar - jal function___init___at_Bar - lw $ra, 4($sp) - sw $v1, 56($sp) # internal_71 = result of function___init___at_Bar - addi $sp, $sp, 8 # Freeing space for arguments - - lw $t0, 48($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 56($sp) - j end_assign - not_is_Bool_or_Int: - # internal_69 = internal_71 - lw $t0, 48($sp) - sw $t0, 56($sp) - end_assign: - - # Jumping to branch_end_8779768552376 - j branch_end_8779768552376 - - branch_Foo_8779768552376: - - # Allocating Razz + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.g = internal_47 + j end_set_attribute_8744937288328 + bool_set_attribute_8744937288328: li $v0, 9 - lw $a0, type_Razz + addi $a0, $zero, 12 syscall - la $t0, type_Razz # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 40($sp) # internal_73 = address of allocated object Razz + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.g = internal_47 + j end_set_attribute_8744937288328 + object_set_attribute_8744937288328: + sw $t1, 12($t0) # self.g = internal_47 + end_set_attribute_8744937288328: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_73 - lw $t0, 48($sp) - sw $t0, 0($sp) # Storing internal_73 + # Argument self + lw $t0, 460($sp) + sw $t0, 0($sp) # Storing self - # Calling function function___init___at_Razz - jal function___init___at_Razz + # Calling function function_printh_at_Bazz + jal function_printh_at_Bazz lw $ra, 4($sp) - sw $v1, 48($sp) # internal_73 = result of function___init___at_Razz + sw $v1, 236($sp) # internal_55 = result of function_printh_at_Bazz addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 40($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 56($sp) - j end_assign - not_is_Bool_or_Int: - # internal_69 = internal_73 - lw $t0, 40($sp) - sw $t0, 56($sp) - end_assign: + # Set attribute i of self + lw $t0, 452($sp) # $t0 = self + lw $t1, 228($sp) # $t1 = internal_55 + beq $t1, $zero, object_set_attribute_8744937288325 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937288325 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937288325 + j object_set_attribute_8744937288325 + int_set_attribute_8744937288325: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.i = internal_55 + j end_set_attribute_8744937288325 + bool_set_attribute_8744937288325: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.i = internal_55 + j end_set_attribute_8744937288325 + object_set_attribute_8744937288325: + sw $t1, 16($t0) # self.i = internal_55 + end_set_attribute_8744937288325: - # Jumping to branch_end_8779768552376 - j branch_end_8779768552376 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - branch_Bar_8779768552376: + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 224($sp) # internal_56 = address of allocated object Int - lw $t0, 204($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 56($sp) - j end_assign - not_is_Bool_or_Int: - # internal_69 = n - lw $t0, 204($sp) - sw $t0, 56($sp) - end_assign: + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Jumping to branch_end_8779768552376 - j branch_end_8779768552376 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 220($sp) # internal_57 = address of allocated object Int - error_branch_8779768552376: + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 216($sp) # internal_58 = address of allocated object Int - branch_end_8779768552376: + # Allocating NUll to internal_59 + sw $zero, 212($sp) # internal_59 = 0 - # Set attribute a of self - lw $t0, 336($sp) # $t0 = self - lw $t1, 56($sp) # $t1 = internal_69 - sw $t1, 20($t0) # self.a = internal_69 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Get attribute a of self - lw $t0, 336($sp) # Get the address of self - lw $t1, 20($t0) # Get the attribute 'a' from the instance - sw $t1, 32($sp) # internal_75 = a + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 208($sp) # internal_60 = address of allocated object Int - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Argument internal_75 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_75 + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 196($sp) # internal_63 = address of allocated object Int - # Calling function function_doh_at_Foo - jal function_doh_at_Foo - lw $ra, 4($sp) - sw $v1, 36($sp) # internal_76 = result of function_doh_at_Foo - addi $sp, $sp, 8 # Freeing space for arguments + # internal_61 = typeof self that is the first word of the object + lw $t0, 452($sp) + lw $t0, 0($t0) + sw $t0, 204($sp) - # Get attribute g of self - lw $t0, 336($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'g' from the instance - sw $t1, 24($sp) # internal_77 = g + # internal_62 = internal_61 + lw $t0, 204($sp) + sw $t0, 200($sp) - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + while_start_8744937325815: - # Argument internal_77 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_77 + # internal_63 = EqualAddress(internal_62, internal_59) + lw $t0, 200($sp) + lw $t1, 212($sp) + seq $t2, $t0, $t1 + lw $t0, 196($sp) + sw $t2, 8($t0) - # Calling function function_doh_at_Foo - jal function_doh_at_Foo - lw $ra, 4($sp) - sw $v1, 28($sp) # internal_78 = result of function_doh_at_Foo - addi $sp, $sp, 8 # Freeing space for arguments + # If internal_63 then goto while_end_8744937325815 + lw $t0, 196($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8744937325815 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_76 - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing internal_76 + # Argument internal_60 + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing internal_60 - # Argument internal_78 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_78 + # Argument internal_57 + lw $t0, 232($sp) + sw $t0, 0($sp) # Storing internal_57 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 28($sp) # internal_79 = result of function_add + sw $v1, 220($sp) # internal_60 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + # internal_62 = ancestor of internal_62 + lw $t0, 200($sp) + lw $t0, 4($t0) + sw $t0, 200($sp) - # Argument self - lw $t0, 344($sp) - sw $t0, 0($sp) # Storing self + # Jumping to while_start_8744937325815 + j while_start_8744937325815 - # Calling function function_doh_at_Foo - jal function_doh_at_Foo - lw $ra, 4($sp) - sw $v1, 20($sp) # internal_80 = result of function_doh_at_Foo - addi $sp, $sp, 8 # Freeing space for arguments + while_end_8744937325815: + + # internal_62 = internal_61 + lw $t0, 204($sp) + sw $t0, 200($sp) + + # initialize Array [internal_60] + lw $t0, 208($sp) # $t0 = internal_60 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 192($sp) # internal_64 = new Array[internal_60] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 188($sp) # internal_65 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 184($sp) # internal_66 = address of allocated object Int + + foreach_start_8744937325815: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_79 - lw $t0, 28($sp) - sw $t0, 4($sp) # Storing internal_79 + # Argument internal_65 + lw $t0, 200($sp) + sw $t0, 4($sp) # Storing internal_65 - # Argument internal_80 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_80 + # Argument internal_60 + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing internal_60 - # Calling function function_add - jal function_add + # Calling function function_less_than + jal function_less_than lw $ra, 8($sp) - sw $v1, 20($sp) # internal_81 = result of function_add + sw $v1, 196($sp) # internal_66 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + # If internal_66 then goto foreach_body_8744937325815 + lw $t0, 184($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8744937325815 - # Argument self - lw $t0, 344($sp) - sw $t0, 0($sp) # Storing self + # Jumping to foreach_end_8744937325815 + j foreach_end_8744937325815 - # Calling function function_printh_at_Bazz - jal function_printh_at_Bazz - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_82 = result of function_printh_at_Bazz - addi $sp, $sp, 8 # Freeing space for arguments + foreach_body_8744937325815: + + # array internal_64[4 * internal_65] = internal_62 + lw $t0, 188($sp) # $t0 = internal_65 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 192($sp) # $t1 = internal_64 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 200($sp) + sw $t0, 0($t1) + + # internal_62 = ancestor of internal_62 + lw $t0, 200($sp) + lw $t0, 4($t0) + sw $t0, 200($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_81 - lw $t0, 20($sp) - sw $t0, 4($sp) # Storing internal_81 + # Argument internal_65 + lw $t0, 200($sp) + sw $t0, 4($sp) # Storing internal_65 - # Argument internal_82 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_82 + # Argument internal_57 + lw $t0, 232($sp) + sw $t0, 0($sp) # Storing internal_57 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 12($sp) # internal_83 = result of function_add + sw $v1, 200($sp) # internal_65 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Set attribute b of self - lw $t0, 336($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_83 - sw $t1, 24($t0) # self.b = internal_83 + # Jumping to foreach_start_8744937325815 + j foreach_start_8744937325815 - # Loading return value in $v1 - lw $v1, 336($sp) + foreach_end_8744937325815: - # Freeing space for local variables - addi $sp, $sp, 336 + # initialize Array [internal_58] + lw $t0, 216($sp) # $t0 = internal_58 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 180($sp) # internal_67 = new Array[internal_58] + + # initialize Array [internal_58] + lw $t0, 216($sp) # $t0 = internal_58 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 176($sp) # internal_68 = new Array[internal_58] - jr $ra + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - function_doh_at_Foo: - # Function parameters - # $ra = 24($sp) - # self = 20($sp) - - # Reserving space for local variables - addi $sp, $sp, -20 - - # Get attribute h of self - lw $t0, 20($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'h' from the instance - sw $t1, 12($sp) # internal_1 = h + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 168($sp) # internal_70 = address of allocated object Int - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 16($sp) - j end_assign - not_is_Bool_or_Int: - # i = internal_1 - lw $t0, 12($sp) - sw $t0, 16($sp) - end_assign: + # internal_69 = direction of Razz + la $t0, type_Razz + sw $t0, 172($sp) - # Get attribute h of self - lw $t0, 20($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'h' from the instance - sw $t1, 8($sp) # internal_2 = h + # array internal_67[4 * internal_70] = internal_69 + lw $t0, 168($sp) # $t0 = internal_70 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 180($sp) # $t1 = internal_67 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 172($sp) + sw $t0, 0($t1) + + # array internal_68[4 * internal_70] = internal_60 + lw $t0, 168($sp) # $t0 = internal_70 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 176($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 208($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # Allocating Int 2 + # Allocating Int 1 li $v0, 9 addi $a0, $zero, 12 syscall @@ -2259,50 +3178,38 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 2 + addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_3 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_2 - lw $t0, 20($sp) - sw $t0, 4($sp) # Storing internal_2 - - # Argument internal_3 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_3 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_4 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # Set attribute h of self - lw $t0, 20($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_4 - sw $t1, 8($t0) # self.h = internal_4 - - # Loading return value in $v1 - lw $v1, 16($sp) - - # Freeing space for local variables - addi $sp, $sp, 20 - - jr $ra + sw $v0, 160($sp) # internal_72 = address of allocated object Int - function___init___at_Bar: - # Function parameters - # $ra = 524($sp) - # self = 520($sp) + # internal_71 = direction of Foo + la $t0, type_Foo + sw $t0, 164($sp) - # Reserving space for local variables - addi $sp, $sp, -520 + # array internal_67[4 * internal_72] = internal_71 + lw $t0, 160($sp) # $t0 = internal_72 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 180($sp) # $t1 = internal_67 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 164($sp) + sw $t0, 0($t1) + + # array internal_68[4 * internal_72] = internal_60 + lw $t0, 160($sp) # $t0 = internal_72 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 176($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 208($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # Allocating Int 1 + # Allocating Int 2 li $v0, 9 addi $a0, $zero, 12 syscall @@ -2310,20 +3217,60 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 516($sp) # internal_0 = address of allocated object Int - - # Set attribute h of self - lw $t0, 520($sp) # $t0 = self - lw $t1, 516($sp) # $t1 = internal_0 - sw $t1, 8($t0) # self.h = internal_0 - + sw $v0, 152($sp) # internal_74 = address of allocated object Int + # internal_73 = direction of Bar + la $t0, type_Bar + sw $t0, 156($sp) + + # array internal_67[4 * internal_74] = internal_73 + lw $t0, 152($sp) # $t0 = internal_74 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 180($sp) # $t1 = internal_67 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 156($sp) + sw $t0, 0($t1) + + # array internal_68[4 * internal_74] = internal_60 + lw $t0, 152($sp) # $t0 = internal_74 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 176($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 208($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 148($sp) # internal_75 = address of allocated object Int + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_76 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -2335,7 +3282,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 492($sp) # internal_6 = address of allocated object Int + sw $v0, 136($sp) # internal_78 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -2347,443 +3294,692 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 500($sp) # internal_4 = address of allocated object Int + sw $v0, 132($sp) # internal_79 = address of allocated object Int + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 124($sp) # internal_81 = address of allocated object Int + foreach_type_start_8744937325815: - # internal_2 = typeof self that is the first word of the object - lw $t0, 520($sp) - lw $t1, 0($t0) - sw $t1, 508($sp) + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - lw $t0, 508($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 504($sp) - j end_assign - not_is_Bool_or_Int: - # internal_3 = internal_2 - lw $t0, 508($sp) - sw $t0, 504($sp) - end_assign: + # Argument internal_75 + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing internal_75 - lw $t0, 492($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 512($sp) - j end_assign - not_is_Bool_or_Int: - # internal_1 = internal_6 - lw $t0, 492($sp) - sw $t0, 512($sp) - end_assign: + # Argument internal_58 + lw $t0, 228($sp) + sw $t0, 0($sp) # Storing internal_58 - while_start_8779768528306: + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 156($sp) # internal_76 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - # Equal operation - lw $t0, 504($sp) # Save in $t0 the left operand address - # If internal_4 then goto while_end_8779768528306 - lw $t0, 500($sp) # Loading the address of the condition + # If internal_76 then goto foreach_type_body_8744937325815 + lw $t0, 144($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_end_8779768528306 + beq $t0, $t1, foreach_type_body_8744937325815 - # Addition operation - lw $t0, 512($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # internal_3 = ancestor of internal_3 that is the first word of the object - lw $t0, 504($sp) - lw $t1, 4($t0) - sw $t1, 504($sp) + # Jumping to foreach_type_end_8744937325815 + j foreach_type_end_8744937325815 - # Jumping to while_start_8779768528306 - j while_start_8779768528306 + foreach_type_body_8744937325815: - while_end_8779768528306: + # internal_77 = array internal_67[4 * internal_75] + lw $t0, 148($sp) # $t0 = internal_75 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 180($sp) # $t1 = internal_67 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 140($sp) # internal_77 = array internal_67[4 * internal_75] + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_78 + lw $t0, 148($sp) + sw $t0, 4($sp) # Storing internal_78 + # Argument internal_56 + lw $t0, 236($sp) + sw $t0, 0($sp) # Storing internal_56 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 148($sp) # internal_78 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 508($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 504($sp) - j end_assign - not_is_Bool_or_Int: - # internal_3 = internal_2 - lw $t0, 508($sp) - sw $t0, 504($sp) - end_assign: + foreach_ancestor_start_8744937325815: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - foreach_start_8779768528306: + # Argument internal_78 + lw $t0, 148($sp) + sw $t0, 4($sp) # Storing internal_78 - # Less than operation - lw $t0, 484($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 512($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + # Argument internal_60 + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing internal_60 - lw $t0, 480($sp) # $t0 = internal_9 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 144($sp) # internal_79 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - # If internal_9 then goto foreach_body_8779768528306 - lw $t0, 480($sp) # Loading the address of the condition + # If internal_79 then goto foreach_ancestor_body_8744937325815 + lw $t0, 132($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_body_8779768528306 + beq $t0, $t1, foreach_ancestor_body_8744937325815 + + # Jumping to foreach_ancestor_end_8744937325815 + j foreach_ancestor_end_8744937325815 + + foreach_ancestor_body_8744937325815: + + # internal_80 = array internal_64[4 * internal_78] + lw $t0, 136($sp) # $t0 = internal_78 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 192($sp) # $t1 = internal_64 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 128($sp) # internal_80 = array internal_64[4 * internal_78] + + # internal_81 = EqualAddress(internal_77, internal_80) + lw $t0, 140($sp) + lw $t1, 128($sp) + seq $t2, $t0, $t1 + lw $t0, 124($sp) + sw $t2, 8($t0) - # Jumping to foreach_end_8779768528306 - j foreach_end_8779768528306 + # If internal_81 then goto foreach_ancestor_end_8744937325815 + lw $t0, 124($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8744937325815 - foreach_body_8779768528306: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_78 + lw $t0, 148($sp) + sw $t0, 4($sp) # Storing internal_78 - # internal_3 = ancestor of internal_3 that is the first word of the object - lw $t0, 504($sp) - lw $t1, 4($t0) - sw $t1, 504($sp) + # Argument internal_57 + lw $t0, 232($sp) + sw $t0, 0($sp) # Storing internal_57 - # Addition operation - lw $t0, 484($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_start_8779768528306 - j foreach_start_8779768528306 + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 148($sp) # internal_78 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - foreach_end_8779768528306: + # Jumping to foreach_ancestor_start_8744937325815 + j foreach_ancestor_start_8744937325815 + foreach_ancestor_end_8744937325815: + # array internal_68[4 * internal_75] = internal_78 + lw $t0, 148($sp) # $t0 = internal_75 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 176($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 136($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_75 + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing internal_75 + # Argument internal_57 + lw $t0, 232($sp) + sw $t0, 0($sp) # Storing internal_57 - # internal_12 = direction of Bazz - la $t0, type_Bazz - sw $t0, 468($sp) + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 160($sp) # internal_75 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + # Jumping to foreach_type_start_8744937325815 + j foreach_type_start_8744937325815 + foreach_type_end_8744937325815: - # internal_13 = direction of Razz - la $t0, type_Razz - sw $t0, 464($sp) + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - # internal_14 = direction of Foo - la $t0, type_Foo - sw $t0, 460($sp) + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_87[0] = '\n' + sb $zero, 9($v0) # Null-terminator at the end of the string + sw $v0, 100($sp) # internal_87 = "\n" - # internal_15 = direction of Bar - la $t0, type_Bar - sw $t0, 456($sp) + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_88[0] = ' ' + sb $zero, 9($v0) # Null-terminator at the end of the string + sw $v0, 96($sp) # internal_88 = " " - foreach_type_start_8779768528306: + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Less than operation - lw $t0, 452($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # If internal_17 then goto foreach_type_body_8779768528306 - lw $t0, 448($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_type_body_8779768528306 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_82 = address of allocated object Int - # Jumping to foreach_type_end_8779768528306 - j foreach_type_end_8779768528306 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - foreach_type_body_8779768528306: + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 116($sp) # internal_83 = address of allocated object Int + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_84 = address of allocated object Int + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_85 = address of allocated object Int - foreach_ancestor_start_8779768528306: + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Less than operation - lw $t0, 440($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 512($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_86 = address of allocated object Int - lw $t0, 436($sp) # $t0 = internal_20 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # If internal_20 then goto foreach_ancestor_body_8779768528306 - lw $t0, 436($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_body_8779768528306 + # Argument internal_85 + lw $t0, 120($sp) + sw $t0, 4($sp) # Storing internal_85 - # Jumping to foreach_ancestor_end_8779768528306 - j foreach_ancestor_end_8779768528306 + # Argument internal_60 + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing internal_60 - foreach_ancestor_body_8779768528306: + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 120($sp) # internal_85 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + foreach_min_start_8744937325815: - # Equal operation - lw $t0, 444($sp) # Save in $t0 the left operand address - lw $t1, 432($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - lw $t0, 428($sp) # $t0 = internal_22 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Argument internal_82 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_82 - # If internal_22 then goto foreach_ancestor_end_8779768528306 - lw $t0, 428($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_end_8779768528306 + # Argument internal_58 + lw $t0, 228($sp) + sw $t0, 0($sp) # Storing internal_58 - # Addition operation - lw $t0, 440($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_ancestor_start_8779768528306 - j foreach_ancestor_start_8779768528306 + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 116($sp) # internal_86 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - foreach_ancestor_end_8779768528306: + # If internal_86 then goto foreach_min_body_8744937325815 + lw $t0, 104($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8744937325815 + # Jumping to foreach_min_end_8744937325815 + j foreach_min_end_8744937325815 + foreach_min_body_8744937325815: + # internal_84 = array internal_68[4 * internal_82] + lw $t0, 120($sp) # $t0 = internal_82 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 176($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 112($sp) # internal_84 = array internal_68[4 * internal_82] + sw $t0, 8($t2) + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Addition operation - lw $t0, 452($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_type_start_8779768528306 - j foreach_type_start_8779768528306 + # Argument internal_84 + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing internal_84 - foreach_type_end_8779768528306: + # Argument internal_85 + lw $t0, 120($sp) + sw $t0, 0($sp) # Storing internal_85 + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 116($sp) # internal_86 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + # If internal_86 then goto update_min_8744937325815 + lw $t0, 104($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8744937325815 + # Jumping to update_min_end_8744937325815 + j update_min_end_8744937325815 + update_min_8744937325815: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_85 + lw $t0, 120($sp) + sw $t0, 4($sp) # Storing internal_85 - lw $t0, 512($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 412($sp) - j end_assign - not_is_Bool_or_Int: - # internal_26 = internal_1 - lw $t0, 512($sp) - sw $t0, 412($sp) - end_assign: + # Argument internal_84 + lw $t0, 124($sp) + sw $t0, 0($sp) # Storing internal_84 - foreach_min_start_8779768528306: + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 120($sp) # internal_85 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # Less than operation - lw $t0, 424($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # If internal_27 then goto foreach_min_body_8779768528306 - lw $t0, 408($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_min_body_8779768528306 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Jumping to foreach_min_end_8779768528306 - j foreach_min_end_8779768528306 + # Argument internal_83 + lw $t0, 128($sp) + sw $t0, 4($sp) # Storing internal_83 - foreach_min_body_8779768528306: + # Argument internal_82 + lw $t0, 132($sp) + sw $t0, 0($sp) # Storing internal_82 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 128($sp) # internal_83 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # Less than operation - lw $t0, 416($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 412($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + update_min_end_8744937325815: - lw $t0, 408($sp) # $t0 = internal_27 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # If internal_27 then goto update_min_8779768528306 - lw $t0, 408($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, update_min_8779768528306 + # Argument internal_82 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_82 - # Jumping to foreach_min_end_8779768528306 - j foreach_min_end_8779768528306 + # Argument internal_57 + lw $t0, 232($sp) + sw $t0, 0($sp) # Storing internal_57 - update_min_8779768528306: + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 132($sp) # internal_82 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 416($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 412($sp) - j end_assign - not_is_Bool_or_Int: - # internal_26 = internal_25 - lw $t0, 416($sp) - sw $t0, 412($sp) - end_assign: + # Jumping to foreach_min_start_8744937325815 + j foreach_min_start_8744937325815 - lw $t0, 424($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 420($sp) - j end_assign - not_is_Bool_or_Int: - # internal_24 = internal_23 - lw $t0, 424($sp) - sw $t0, 420($sp) - end_assign: + foreach_min_end_8744937325815: - update_min_end_8779768528306: + # initialize Array [internal_58] + lw $t0, 216($sp) # $t0 = internal_58 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 92($sp) # internal_89 = new Array[internal_58] - # Addition operation - lw $t0, 424($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_min_start_8779768528306 - j foreach_min_start_8779768528306 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - foreach_min_end_8779768528306: + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_90 = address of allocated object Int + + # array internal_89[4 * internal_90] = internal_56 + lw $t0, 88($sp) # $t0 = internal_90 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 92($sp) # $t1 = internal_89 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 224($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_91 = address of allocated object Int + + # array internal_89[4 * internal_91] = internal_56 + lw $t0, 84($sp) # $t0 = internal_91 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 92($sp) # $t1 = internal_89 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 224($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_92 = address of allocated object Int + + # array internal_89[4 * internal_92] = internal_56 + lw $t0, 80($sp) # $t0 = internal_92 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 92($sp) # $t1 = internal_89 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 224($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_93 = address of allocated object Int + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_85 + lw $t0, 120($sp) + sw $t0, 4($sp) # Storing internal_85 - # Equal operation - lw $t0, 420($sp) # Save in $t0 the left operand address - lw $t1, 512($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + # Argument internal_60 + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing internal_60 - lw $t0, 400($sp) # $t0 = internal_29 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 88($sp) # internal_93 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments - # If internal_29 then goto error_branch_8779768528306 - lw $t0, 400($sp) # Loading the address of the condition + # If internal_93 then goto error_branch_8744937325815 + lw $t0, 76($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, error_branch_8779768528306 - + beq $t0, $t1, error_branch_8744937325815 + + # array internal_89[4 * internal_83] = internal_57 + lw $t0, 116($sp) # $t0 = internal_83 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 92($sp) # $t1 = internal_89 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 220($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # If internal_30 then goto branch_Bazz_8779768528306 - lw $t0, 396($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Bazz_8779768528306 + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_94 = address of allocated object Int + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # If internal_30 then goto branch_Razz_8779768528306 - lw $t0, 396($sp) # Loading the address of the condition + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_95 = address of allocated object Int + + # internal_94 = array internal_89[4 * internal_95] + lw $t0, 68($sp) # $t0 = internal_95 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 92($sp) # $t1 = internal_89 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 72($sp) # internal_94 = array internal_89[4 * internal_95] + sw $t0, 8($t2) + + # If internal_94 then goto branch_Razz_8744937325815 + lw $t0, 72($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Razz_8779768528306 + beq $t0, $t1, branch_Razz_8744937325815 + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # If internal_30 then goto branch_Foo_8779768528306 - lw $t0, 396($sp) # Loading the address of the condition + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_96 = address of allocated object Int + + # internal_94 = array internal_89[4 * internal_96] + lw $t0, 64($sp) # $t0 = internal_96 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 92($sp) # $t1 = internal_89 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 72($sp) # internal_94 = array internal_89[4 * internal_96] + sw $t0, 8($t2) + + # If internal_94 then goto branch_Foo_8744937325815 + lw $t0, 72($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Foo_8779768528306 + beq $t0, $t1, branch_Foo_8744937325815 + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # If internal_30 then goto branch_Bar_8779768528306 - lw $t0, 396($sp) # Loading the address of the condition + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_97 = address of allocated object Int + + # internal_94 = array internal_89[4 * internal_97] + lw $t0, 60($sp) # $t0 = internal_97 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 92($sp) # $t1 = internal_89 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 72($sp) # internal_94 = array internal_89[4 * internal_97] + sw $t0, 8($t2) + + # If internal_94 then goto branch_Bar_8744937325815 + lw $t0, 72($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Bar_8779768528306 + beq $t0, $t1, branch_Bar_8744937325815 - branch_Bazz_8779768528306: - - # Allocating Foo - li $v0, 9 - lw $a0, type_Foo - syscall - la $t0, type_Foo # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 384($sp) # internal_33 = address of allocated object Foo + branch_Razz_8744937325815: # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_33 - lw $t0, 392($sp) - sw $t0, 0($sp) # Storing internal_33 - - # Calling function function___init___at_Foo - jal function___init___at_Foo - lw $ra, 4($sp) - sw $v1, 392($sp) # internal_33 = result of function___init___at_Foo - addi $sp, $sp, 8 # Freeing space for arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - lw $t0, 384($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 392($sp) - j end_assign - not_is_Bool_or_Int: - # internal_31 = internal_33 - lw $t0, 384($sp) - sw $t0, 392($sp) - end_assign: + # Argument n + lw $t0, 268($sp) + sw $t0, 4($sp) # Storing n - # Jumping to branch_end_8779768528306 - j branch_end_8779768528306 + # Argument self + lw $t0, 464($sp) + sw $t0, 0($sp) # Storing self - branch_Razz_8779768528306: + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 268($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bar li $v0, 9 @@ -2792,43 +3988,66 @@ la $t0, type_Bar # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 376($sp) # internal_35 = address of allocated object Bar + sw $v0, 48($sp) # internal_100 = address of allocated object Bar # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_35 - lw $t0, 384($sp) - sw $t0, 0($sp) # Storing internal_35 + # Argument internal_100 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_100 # Calling function function___init___at_Bar jal function___init___at_Bar lw $ra, 4($sp) - sw $v1, 384($sp) # internal_35 = result of function___init___at_Bar + sw $v1, 56($sp) # internal_100 = result of function___init___at_Bar addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 376($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 392($sp) - j end_assign - not_is_Bool_or_Int: - # internal_31 = internal_35 - lw $t0, 376($sp) - sw $t0, 392($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_98 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_98 + + # Argument internal_100 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_100 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_98 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_98 = internal_100 + lw $t0, 48($sp) + sw $t0, 56($sp) + + # Jumping to branch_end_8744937325815 + j branch_end_8744937325815 + + branch_Foo_8744937325815: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Jumping to branch_end_8779768528306 - j branch_end_8779768528306 + # Argument n + lw $t0, 268($sp) + sw $t0, 4($sp) # Storing n - branch_Foo_8779768528306: + # Argument self + lw $t0, 464($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 268($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating Razz li $v0, 9 @@ -2837,98 +4056,5609 @@ la $t0, type_Razz # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 368($sp) # internal_37 = address of allocated object Razz + sw $v0, 40($sp) # internal_102 = address of allocated object Razz # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_37 - lw $t0, 376($sp) - sw $t0, 0($sp) # Storing internal_37 + # Argument internal_102 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_102 # Calling function function___init___at_Razz jal function___init___at_Razz lw $ra, 4($sp) - sw $v1, 376($sp) # internal_37 = result of function___init___at_Razz + sw $v1, 48($sp) # internal_102 = result of function___init___at_Razz addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 368($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 392($sp) - j end_assign - not_is_Bool_or_Int: - # internal_31 = internal_37 - lw $t0, 368($sp) - sw $t0, 392($sp) - end_assign: - - # Jumping to branch_end_8779768528306 - j branch_end_8779768528306 - - branch_Bar_8779768528306: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - lw $t0, 388($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 392($sp) - j end_assign - not_is_Bool_or_Int: - # internal_31 = n - lw $t0, 388($sp) - sw $t0, 392($sp) - end_assign: + # Argument internal_98 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_98 - # Jumping to branch_end_8779768528306 - j branch_end_8779768528306 + # Argument internal_102 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_102 - error_branch_8779768528306: + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_98 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + # internal_98 = internal_102 + lw $t0, 40($sp) + sw $t0, 56($sp) - branch_end_8779768528306: + # Jumping to branch_end_8744937325815 + j branch_end_8744937325815 - # Set attribute g of self - lw $t0, 520($sp) # $t0 = self - lw $t1, 392($sp) # $t1 = internal_31 - sw $t1, 12($t0) # self.g = internal_31 + branch_Bar_8744937325815: # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 268($sp) + sw $t0, 4($sp) # Storing n # Argument self - lw $t0, 528($sp) + lw $t0, 464($sp) sw $t0, 0($sp) # Storing self - # Calling function function_printh_at_Bazz - jal function_printh_at_Bazz - lw $ra, 4($sp) - sw $v1, 368($sp) # internal_39 = result of function_printh_at_Bazz - addi $sp, $sp, 8 # Freeing space for arguments + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 268($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # Set attribute i of self - lw $t0, 520($sp) # $t0 = self - lw $t1, 360($sp) # $t1 = internal_39 - sw $t1, 16($t0) # self.i = internal_39 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_98 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_98 + + # Argument n + lw $t0, 268($sp) + sw $t0, 0($sp) # Storing n + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_98 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_98 = n + lw $t0, 256($sp) + sw $t0, 56($sp) + + # Jumping to branch_end_8744937325815 + j branch_end_8744937325815 + + error_branch_8744937325815: + + branch_end_8744937325815: + + # Set attribute a of self + lw $t0, 452($sp) # $t0 = self + lw $t1, 56($sp) # $t1 = internal_98 + beq $t1, $zero, object_set_attribute_8744937293460 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937293460 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937293460 + j object_set_attribute_8744937293460 + int_set_attribute_8744937293460: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.a = internal_98 + j end_set_attribute_8744937293460 + bool_set_attribute_8744937293460: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.a = internal_98 + j end_set_attribute_8744937293460 + object_set_attribute_8744937293460: + sw $t1, 20($t0) # self.a = internal_98 + end_set_attribute_8744937293460: + + # Get attribute a of self + lw $t0, 452($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'a' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8744937293593 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8744937293593 + j object_get_attribute_8744937293593 + int_get_attribute_8744937293593: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_104 = self.a + j end_get_attribute_8744937293593 + bool_get_attribute_8744937293593: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_104 = self.a + j end_get_attribute_8744937293593 + object_get_attribute_8744937293593: + sw $t1, 32($sp) # internal_104 = a + end_get_attribute_8744937293593: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_104 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_104 + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 36($sp) # internal_105 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute g of self + lw $t0, 452($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'g' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8744937293623 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8744937293623 + j object_get_attribute_8744937293623 + int_get_attribute_8744937293623: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($sp) # internal_106 = self.g + j end_get_attribute_8744937293623 + bool_get_attribute_8744937293623: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($sp) # internal_106 = self.g + j end_get_attribute_8744937293623 + object_get_attribute_8744937293623: + sw $t1, 24($sp) # internal_106 = g + end_get_attribute_8744937293623: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_106 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_106 + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_107 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_105 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_105 + + # Argument internal_107 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_107 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_108 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 460($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_109 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_108 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_108 + + # Argument internal_109 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_109 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_110 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 460($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_printh_at_Bazz + jal function_printh_at_Bazz + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_111 = result of function_printh_at_Bazz + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_110 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_110 + + # Argument internal_111 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_111 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_112 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute b of self + lw $t0, 452($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_112 + beq $t1, $zero, object_set_attribute_8744937263321 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937263321 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937263321 + j object_set_attribute_8744937263321 + int_set_attribute_8744937263321: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($t0) # self.b = internal_112 + j end_set_attribute_8744937263321 + bool_set_attribute_8744937263321: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($t0) # self.b = internal_112 + j end_set_attribute_8744937263321 + object_set_attribute_8744937263321: + sw $t1, 24($t0) # self.b = internal_112 + end_set_attribute_8744937263321: + + # Loading return value in $v1 + lw $v1, 452($sp) + + # Freeing space for local variables + addi $sp, $sp, 452 + + jr $ra + + function_doh_at_Foo: + # Function parameters + # $ra = 24($sp) + # self = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # Get attribute h of self + lw $t0, 20($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'h' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8744937293752 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8744937293752 + j object_get_attribute_8744937293752 + int_get_attribute_8744937293752: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_1 = self.h + j end_get_attribute_8744937293752 + bool_get_attribute_8744937293752: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_1 = self.h + j end_get_attribute_8744937293752 + object_get_attribute_8744937293752: + sw $t1, 12($sp) # internal_1 = h + end_get_attribute_8744937293752: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_1 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 28($sp) # i = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute h of self + lw $t0, 20($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'h' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8744937293818 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8744937293818 + j object_get_attribute_8744937293818 + int_get_attribute_8744937293818: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_2 = self.h + j end_get_attribute_8744937293818 + bool_get_attribute_8744937293818: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_2 = self.h + j end_get_attribute_8744937293818 + object_get_attribute_8744937293818: + sw $t1, 8($sp) # internal_2 = h + end_get_attribute_8744937293818: + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_4 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute h of self + lw $t0, 20($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_4 + beq $t1, $zero, object_set_attribute_8744937293794 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937293794 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937293794 + j object_set_attribute_8744937293794 + int_set_attribute_8744937293794: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.h = internal_4 + j end_set_attribute_8744937293794 + bool_set_attribute_8744937293794: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.h = internal_4 + j end_set_attribute_8744937293794 + object_set_attribute_8744937293794: + sw $t1, 8($t0) # self.h = internal_4 + end_set_attribute_8744937293794: + + # Loading return value in $v1 + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 20 + + jr $ra + + function___init___at_Bar: + # Function parameters + # $ra = 680($sp) + # self = 676($sp) + + # Reserving space for local variables + addi $sp, $sp, -676 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 672($sp) # internal_0 = address of allocated object Int + + # Set attribute h of self + lw $t0, 676($sp) # $t0 = self + lw $t1, 672($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8744937263918 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937263918 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937263918 + j object_set_attribute_8744937263918 + int_set_attribute_8744937263918: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.h = internal_0 + j end_set_attribute_8744937263918 + bool_set_attribute_8744937263918: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.h = internal_0 + j end_set_attribute_8744937263918 + object_set_attribute_8744937263918: + sw $t1, 8($t0) # self.h = internal_0 + end_set_attribute_8744937263918: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 668($sp) # internal_1 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 664($sp) # internal_2 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 660($sp) # internal_3 = address of allocated object Int + + # Allocating NUll to internal_4 + sw $zero, 656($sp) # internal_4 = 0 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 652($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 640($sp) # internal_8 = address of allocated object Int + + # internal_6 = typeof self that is the first word of the object + lw $t0, 676($sp) + lw $t0, 0($t0) + sw $t0, 648($sp) + + # internal_7 = internal_6 + lw $t0, 648($sp) + sw $t0, 644($sp) + + while_start_8744937301489: + + # internal_8 = EqualAddress(internal_7, internal_4) + lw $t0, 644($sp) + lw $t1, 656($sp) + seq $t2, $t0, $t1 + lw $t0, 640($sp) + sw $t2, 8($t0) + + # If internal_8 then goto while_end_8744937301489 + lw $t0, 640($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8744937301489 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_5 + lw $t0, 664($sp) + sw $t0, 4($sp) # Storing internal_5 + + # Argument internal_2 + lw $t0, 676($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 664($sp) # internal_5 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_7 = ancestor of internal_7 + lw $t0, 644($sp) + lw $t0, 4($t0) + sw $t0, 644($sp) + + # Jumping to while_start_8744937301489 + j while_start_8744937301489 + + while_end_8744937301489: + + # internal_7 = internal_6 + lw $t0, 648($sp) + sw $t0, 644($sp) + + # initialize Array [internal_5] + lw $t0, 652($sp) # $t0 = internal_5 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 636($sp) # internal_9 = new Array[internal_5] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 632($sp) # internal_10 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 628($sp) # internal_11 = address of allocated object Int + + foreach_start_8744937301489: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 644($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_5 + lw $t0, 664($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 640($sp) # internal_11 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_11 then goto foreach_body_8744937301489 + lw $t0, 628($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8744937301489 + + # Jumping to foreach_end_8744937301489 + j foreach_end_8744937301489 + + foreach_body_8744937301489: + + # array internal_9[4 * internal_10] = internal_7 + lw $t0, 632($sp) # $t0 = internal_10 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 636($sp) # $t1 = internal_9 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 644($sp) + sw $t0, 0($t1) + + # internal_7 = ancestor of internal_7 + lw $t0, 644($sp) + lw $t0, 4($t0) + sw $t0, 644($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 644($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_2 + lw $t0, 676($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 644($sp) # internal_10 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_start_8744937301489 + j foreach_start_8744937301489 + + foreach_end_8744937301489: + + # initialize Array [internal_3] + lw $t0, 660($sp) # $t0 = internal_3 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 624($sp) # internal_12 = new Array[internal_3] + + # initialize Array [internal_3] + lw $t0, 660($sp) # $t0 = internal_3 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 620($sp) # internal_13 = new Array[internal_3] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 612($sp) # internal_15 = address of allocated object Int + + # internal_14 = direction of Bazz + la $t0, type_Bazz + sw $t0, 616($sp) + + # array internal_12[4 * internal_15] = internal_14 + lw $t0, 612($sp) # $t0 = internal_15 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 624($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 616($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_15] = internal_5 + lw $t0, 612($sp) # $t0 = internal_15 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 620($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 652($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 604($sp) # internal_17 = address of allocated object Int + + # internal_16 = direction of Razz + la $t0, type_Razz + sw $t0, 608($sp) + + # array internal_12[4 * internal_17] = internal_16 + lw $t0, 604($sp) # $t0 = internal_17 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 624($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 608($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_17] = internal_5 + lw $t0, 604($sp) # $t0 = internal_17 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 620($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 652($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 596($sp) # internal_19 = address of allocated object Int + + # internal_18 = direction of Foo + la $t0, type_Foo + sw $t0, 600($sp) + + # array internal_12[4 * internal_19] = internal_18 + lw $t0, 596($sp) # $t0 = internal_19 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 624($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 600($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_19] = internal_5 + lw $t0, 596($sp) # $t0 = internal_19 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 620($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 652($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 588($sp) # internal_21 = address of allocated object Int + + # internal_20 = direction of Bar + la $t0, type_Bar + sw $t0, 592($sp) + + # array internal_12[4 * internal_21] = internal_20 + lw $t0, 588($sp) # $t0 = internal_21 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 624($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 592($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_21] = internal_5 + lw $t0, 588($sp) # $t0 = internal_21 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 620($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 652($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 584($sp) # internal_22 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 580($sp) # internal_23 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 572($sp) # internal_25 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 568($sp) # internal_26 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 560($sp) # internal_28 = address of allocated object Int + + foreach_type_start_8744937301489: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_22 + lw $t0, 596($sp) + sw $t0, 4($sp) # Storing internal_22 + + # Argument internal_3 + lw $t0, 672($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 592($sp) # internal_23 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_23 then goto foreach_type_body_8744937301489 + lw $t0, 580($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8744937301489 + + # Jumping to foreach_type_end_8744937301489 + j foreach_type_end_8744937301489 + + foreach_type_body_8744937301489: + + # internal_24 = array internal_12[4 * internal_22] + lw $t0, 584($sp) # $t0 = internal_22 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 624($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 576($sp) # internal_24 = array internal_12[4 * internal_22] + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_25 + lw $t0, 584($sp) + sw $t0, 4($sp) # Storing internal_25 + + # Argument internal_1 + lw $t0, 680($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 584($sp) # internal_25 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_ancestor_start_8744937301489: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_25 + lw $t0, 584($sp) + sw $t0, 4($sp) # Storing internal_25 + + # Argument internal_5 + lw $t0, 664($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 580($sp) # internal_26 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_26 then goto foreach_ancestor_body_8744937301489 + lw $t0, 568($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8744937301489 + + # Jumping to foreach_ancestor_end_8744937301489 + j foreach_ancestor_end_8744937301489 + + foreach_ancestor_body_8744937301489: + + # internal_27 = array internal_9[4 * internal_25] + lw $t0, 572($sp) # $t0 = internal_25 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 636($sp) # $t1 = internal_9 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 564($sp) # internal_27 = array internal_9[4 * internal_25] + + # internal_28 = EqualAddress(internal_24, internal_27) + lw $t0, 576($sp) + lw $t1, 564($sp) + seq $t2, $t0, $t1 + lw $t0, 560($sp) + sw $t2, 8($t0) + + # If internal_28 then goto foreach_ancestor_end_8744937301489 + lw $t0, 560($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8744937301489 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_25 + lw $t0, 584($sp) + sw $t0, 4($sp) # Storing internal_25 + + # Argument internal_2 + lw $t0, 676($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 584($sp) # internal_25 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_ancestor_start_8744937301489 + j foreach_ancestor_start_8744937301489 + + foreach_ancestor_end_8744937301489: + + # array internal_13[4 * internal_22] = internal_25 + lw $t0, 584($sp) # $t0 = internal_22 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 620($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 572($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_22 + lw $t0, 596($sp) + sw $t0, 4($sp) # Storing internal_22 + + # Argument internal_2 + lw $t0, 676($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 596($sp) # internal_22 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_type_start_8744937301489 + j foreach_type_start_8744937301489 + + foreach_type_end_8744937301489: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_34[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 536($sp) # internal_34 = "\n" + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_35[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 532($sp) # internal_35 = " " + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 556($sp) # internal_29 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 552($sp) # internal_30 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 548($sp) # internal_31 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 544($sp) # internal_32 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 540($sp) # internal_33 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_32 + lw $t0, 556($sp) + sw $t0, 4($sp) # Storing internal_32 + + # Argument internal_5 + lw $t0, 664($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 556($sp) # internal_32 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_min_start_8744937301489: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_29 + lw $t0, 568($sp) + sw $t0, 4($sp) # Storing internal_29 + + # Argument internal_3 + lw $t0, 672($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 552($sp) # internal_33 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_33 then goto foreach_min_body_8744937301489 + lw $t0, 540($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8744937301489 + + # Jumping to foreach_min_end_8744937301489 + j foreach_min_end_8744937301489 + + foreach_min_body_8744937301489: + + # internal_31 = array internal_13[4 * internal_29] + lw $t0, 556($sp) # $t0 = internal_29 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 620($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 548($sp) # internal_31 = array internal_13[4 * internal_29] + sw $t0, 8($t2) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_31 + lw $t0, 560($sp) + sw $t0, 4($sp) # Storing internal_31 + + # Argument internal_32 + lw $t0, 556($sp) + sw $t0, 0($sp) # Storing internal_32 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 552($sp) # internal_33 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_33 then goto update_min_8744937301489 + lw $t0, 540($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8744937301489 + + # Jumping to update_min_end_8744937301489 + j update_min_end_8744937301489 + + update_min_8744937301489: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_32 + lw $t0, 556($sp) + sw $t0, 4($sp) # Storing internal_32 + + # Argument internal_31 + lw $t0, 560($sp) + sw $t0, 0($sp) # Storing internal_31 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 556($sp) # internal_32 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_30 + lw $t0, 564($sp) + sw $t0, 4($sp) # Storing internal_30 + + # Argument internal_29 + lw $t0, 568($sp) + sw $t0, 0($sp) # Storing internal_29 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 564($sp) # internal_30 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + update_min_end_8744937301489: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_29 + lw $t0, 568($sp) + sw $t0, 4($sp) # Storing internal_29 + + # Argument internal_2 + lw $t0, 676($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 568($sp) # internal_29 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_min_start_8744937301489 + j foreach_min_start_8744937301489 + + foreach_min_end_8744937301489: + + # initialize Array [internal_3] + lw $t0, 660($sp) # $t0 = internal_3 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 528($sp) # internal_36 = new Array[internal_3] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 524($sp) # internal_37 = address of allocated object Int + + # array internal_36[4 * internal_37] = internal_1 + lw $t0, 524($sp) # $t0 = internal_37 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 528($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 668($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 520($sp) # internal_38 = address of allocated object Int + + # array internal_36[4 * internal_38] = internal_1 + lw $t0, 520($sp) # $t0 = internal_38 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 528($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 668($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 516($sp) # internal_39 = address of allocated object Int + + # array internal_36[4 * internal_39] = internal_1 + lw $t0, 516($sp) # $t0 = internal_39 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 528($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 668($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 512($sp) # internal_40 = address of allocated object Int + + # array internal_36[4 * internal_40] = internal_1 + lw $t0, 512($sp) # $t0 = internal_40 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 528($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 668($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 508($sp) # internal_41 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_32 + lw $t0, 556($sp) + sw $t0, 4($sp) # Storing internal_32 + + # Argument internal_5 + lw $t0, 664($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 520($sp) # internal_41 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_41 then goto error_branch_8744937301489 + lw $t0, 508($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8744937301489 + + # array internal_36[4 * internal_30] = internal_2 + lw $t0, 552($sp) # $t0 = internal_30 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 528($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 664($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 504($sp) # internal_42 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 500($sp) # internal_43 = address of allocated object Int + + # internal_42 = array internal_36[4 * internal_43] + lw $t0, 500($sp) # $t0 = internal_43 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 528($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 504($sp) # internal_42 = array internal_36[4 * internal_43] + sw $t0, 8($t2) + + # If internal_42 then goto branch_Bazz_8744937301489 + lw $t0, 504($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bazz_8744937301489 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 496($sp) # internal_44 = address of allocated object Int + + # internal_42 = array internal_36[4 * internal_44] + lw $t0, 496($sp) # $t0 = internal_44 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 528($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 504($sp) # internal_42 = array internal_36[4 * internal_44] + sw $t0, 8($t2) + + # If internal_42 then goto branch_Razz_8744937301489 + lw $t0, 504($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Razz_8744937301489 + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 492($sp) # internal_45 = address of allocated object Int + + # internal_42 = array internal_36[4 * internal_45] + lw $t0, 492($sp) # $t0 = internal_45 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 528($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 504($sp) # internal_42 = array internal_36[4 * internal_45] + sw $t0, 8($t2) + + # If internal_42 then goto branch_Foo_8744937301489 + lw $t0, 504($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Foo_8744937301489 + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 488($sp) # internal_46 = address of allocated object Int + + # internal_42 = array internal_36[4 * internal_46] + lw $t0, 488($sp) # $t0 = internal_46 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 528($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 504($sp) # internal_42 = array internal_36[4 * internal_46] + sw $t0, 8($t2) + + # If internal_42 then goto branch_Bar_8744937301489 + lw $t0, 504($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bar_8744937301489 + + branch_Bazz_8744937301489: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 492($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 688($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 492($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Foo + li $v0, 9 + lw $a0, type_Foo + syscall + la $t0, type_Foo # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 476($sp) # internal_49 = address of allocated object Foo + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_49 + lw $t0, 484($sp) + sw $t0, 0($sp) # Storing internal_49 + + # Calling function function___init___at_Foo + jal function___init___at_Foo + lw $ra, 4($sp) + sw $v1, 484($sp) # internal_49 = result of function___init___at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_47 + lw $t0, 496($sp) + sw $t0, 4($sp) # Storing internal_47 + + # Argument internal_49 + lw $t0, 488($sp) + sw $t0, 0($sp) # Storing internal_49 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 496($sp) # internal_47 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_47 = internal_49 + lw $t0, 476($sp) + sw $t0, 484($sp) + + # Jumping to branch_end_8744937301489 + j branch_end_8744937301489 + + branch_Razz_8744937301489: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 492($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 688($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 492($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bar + li $v0, 9 + lw $a0, type_Bar + syscall + la $t0, type_Bar # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 468($sp) # internal_51 = address of allocated object Bar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_51 + lw $t0, 476($sp) + sw $t0, 0($sp) # Storing internal_51 + + # Calling function function___init___at_Bar + jal function___init___at_Bar + lw $ra, 4($sp) + sw $v1, 476($sp) # internal_51 = result of function___init___at_Bar + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_47 + lw $t0, 496($sp) + sw $t0, 4($sp) # Storing internal_47 + + # Argument internal_51 + lw $t0, 480($sp) + sw $t0, 0($sp) # Storing internal_51 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 496($sp) # internal_47 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_47 = internal_51 + lw $t0, 468($sp) + sw $t0, 484($sp) + + # Jumping to branch_end_8744937301489 + j branch_end_8744937301489 + + branch_Foo_8744937301489: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 492($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 688($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 492($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Razz + li $v0, 9 + lw $a0, type_Razz + syscall + la $t0, type_Razz # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 460($sp) # internal_53 = address of allocated object Razz + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_53 + lw $t0, 468($sp) + sw $t0, 0($sp) # Storing internal_53 + + # Calling function function___init___at_Razz + jal function___init___at_Razz + lw $ra, 4($sp) + sw $v1, 468($sp) # internal_53 = result of function___init___at_Razz + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_47 + lw $t0, 496($sp) + sw $t0, 4($sp) # Storing internal_47 + + # Argument internal_53 + lw $t0, 472($sp) + sw $t0, 0($sp) # Storing internal_53 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 496($sp) # internal_47 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_47 = internal_53 + lw $t0, 460($sp) + sw $t0, 484($sp) + + # Jumping to branch_end_8744937301489 + j branch_end_8744937301489 + + branch_Bar_8744937301489: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 492($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 688($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 492($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_47 + lw $t0, 496($sp) + sw $t0, 4($sp) # Storing internal_47 + + # Argument n + lw $t0, 492($sp) + sw $t0, 0($sp) # Storing n + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 496($sp) # internal_47 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_47 = n + lw $t0, 480($sp) + sw $t0, 484($sp) + + # Jumping to branch_end_8744937301489 + j branch_end_8744937301489 + + error_branch_8744937301489: + + branch_end_8744937301489: + + # Set attribute g of self + lw $t0, 676($sp) # $t0 = self + lw $t1, 484($sp) # $t1 = internal_47 + beq $t1, $zero, object_set_attribute_8744937263936 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937263936 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937263936 + j object_set_attribute_8744937263936 + int_set_attribute_8744937263936: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.g = internal_47 + j end_set_attribute_8744937263936 + bool_set_attribute_8744937263936: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.g = internal_47 + j end_set_attribute_8744937263936 + object_set_attribute_8744937263936: + sw $t1, 12($t0) # self.g = internal_47 + end_set_attribute_8744937263936: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 684($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_printh_at_Bazz + jal function_printh_at_Bazz + lw $ra, 4($sp) + sw $v1, 460($sp) # internal_55 = result of function_printh_at_Bazz + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute i of self + lw $t0, 676($sp) # $t0 = self + lw $t1, 452($sp) # $t1 = internal_55 + beq $t1, $zero, object_set_attribute_8744937263939 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937263939 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937263939 + j object_set_attribute_8744937263939 + int_set_attribute_8744937263939: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.i = internal_55 + j end_set_attribute_8744937263939 + bool_set_attribute_8744937263939: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.i = internal_55 + j end_set_attribute_8744937263939 + object_set_attribute_8744937263939: + sw $t1, 16($t0) # self.i = internal_55 + end_set_attribute_8744937263939: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 448($sp) # internal_56 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 444($sp) # internal_57 = address of allocated object Int + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 440($sp) # internal_58 = address of allocated object Int + + # Allocating NUll to internal_59 + sw $zero, 436($sp) # internal_59 = 0 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 432($sp) # internal_60 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 420($sp) # internal_63 = address of allocated object Int + + # internal_61 = typeof self that is the first word of the object + lw $t0, 676($sp) + lw $t0, 0($t0) + sw $t0, 428($sp) + + # internal_62 = internal_61 + lw $t0, 428($sp) + sw $t0, 424($sp) + + while_start_8744937325815: + + # internal_63 = EqualAddress(internal_62, internal_59) + lw $t0, 424($sp) + lw $t1, 436($sp) + seq $t2, $t0, $t1 + lw $t0, 420($sp) + sw $t2, 8($t0) + + # If internal_63 then goto while_end_8744937325815 + lw $t0, 420($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8744937325815 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_60 + lw $t0, 444($sp) + sw $t0, 4($sp) # Storing internal_60 + + # Argument internal_57 + lw $t0, 456($sp) + sw $t0, 0($sp) # Storing internal_57 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 444($sp) # internal_60 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_62 = ancestor of internal_62 + lw $t0, 424($sp) + lw $t0, 4($t0) + sw $t0, 424($sp) + + # Jumping to while_start_8744937325815 + j while_start_8744937325815 + + while_end_8744937325815: + + # internal_62 = internal_61 + lw $t0, 428($sp) + sw $t0, 424($sp) + + # initialize Array [internal_60] + lw $t0, 432($sp) # $t0 = internal_60 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 416($sp) # internal_64 = new Array[internal_60] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 412($sp) # internal_65 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 408($sp) # internal_66 = address of allocated object Int + + foreach_start_8744937325815: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_65 + lw $t0, 424($sp) + sw $t0, 4($sp) # Storing internal_65 + + # Argument internal_60 + lw $t0, 444($sp) + sw $t0, 0($sp) # Storing internal_60 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 420($sp) # internal_66 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_66 then goto foreach_body_8744937325815 + lw $t0, 408($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8744937325815 + + # Jumping to foreach_end_8744937325815 + j foreach_end_8744937325815 + + foreach_body_8744937325815: + + # array internal_64[4 * internal_65] = internal_62 + lw $t0, 412($sp) # $t0 = internal_65 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 416($sp) # $t1 = internal_64 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 424($sp) + sw $t0, 0($t1) + + # internal_62 = ancestor of internal_62 + lw $t0, 424($sp) + lw $t0, 4($t0) + sw $t0, 424($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_65 + lw $t0, 424($sp) + sw $t0, 4($sp) # Storing internal_65 + + # Argument internal_57 + lw $t0, 456($sp) + sw $t0, 0($sp) # Storing internal_57 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 424($sp) # internal_65 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_start_8744937325815 + j foreach_start_8744937325815 + + foreach_end_8744937325815: + + # initialize Array [internal_58] + lw $t0, 440($sp) # $t0 = internal_58 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 404($sp) # internal_67 = new Array[internal_58] + + # initialize Array [internal_58] + lw $t0, 440($sp) # $t0 = internal_58 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 400($sp) # internal_68 = new Array[internal_58] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 392($sp) # internal_70 = address of allocated object Int + + # internal_69 = direction of Razz + la $t0, type_Razz + sw $t0, 396($sp) + + # array internal_67[4 * internal_70] = internal_69 + lw $t0, 392($sp) # $t0 = internal_70 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 404($sp) # $t1 = internal_67 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 396($sp) + sw $t0, 0($t1) + + # array internal_68[4 * internal_70] = internal_60 + lw $t0, 392($sp) # $t0 = internal_70 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 400($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 432($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 384($sp) # internal_72 = address of allocated object Int + + # internal_71 = direction of Foo + la $t0, type_Foo + sw $t0, 388($sp) + + # array internal_67[4 * internal_72] = internal_71 + lw $t0, 384($sp) # $t0 = internal_72 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 404($sp) # $t1 = internal_67 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 388($sp) + sw $t0, 0($t1) + + # array internal_68[4 * internal_72] = internal_60 + lw $t0, 384($sp) # $t0 = internal_72 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 400($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 432($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 376($sp) # internal_74 = address of allocated object Int + + # internal_73 = direction of Bar + la $t0, type_Bar + sw $t0, 380($sp) + + # array internal_67[4 * internal_74] = internal_73 + lw $t0, 376($sp) # $t0 = internal_74 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 404($sp) # $t1 = internal_67 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 380($sp) + sw $t0, 0($t1) + + # array internal_68[4 * internal_74] = internal_60 + lw $t0, 376($sp) # $t0 = internal_74 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 400($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 432($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 372($sp) # internal_75 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 368($sp) # internal_76 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 360($sp) # internal_78 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 356($sp) # internal_79 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 348($sp) # internal_81 = address of allocated object Int + + foreach_type_start_8744937325815: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_75 + lw $t0, 384($sp) + sw $t0, 4($sp) # Storing internal_75 + + # Argument internal_58 + lw $t0, 452($sp) + sw $t0, 0($sp) # Storing internal_58 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 380($sp) # internal_76 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_76 then goto foreach_type_body_8744937325815 + lw $t0, 368($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8744937325815 + + # Jumping to foreach_type_end_8744937325815 + j foreach_type_end_8744937325815 + + foreach_type_body_8744937325815: + + # internal_77 = array internal_67[4 * internal_75] + lw $t0, 372($sp) # $t0 = internal_75 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 404($sp) # $t1 = internal_67 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 364($sp) # internal_77 = array internal_67[4 * internal_75] + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_78 + lw $t0, 372($sp) + sw $t0, 4($sp) # Storing internal_78 + + # Argument internal_56 + lw $t0, 460($sp) + sw $t0, 0($sp) # Storing internal_56 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 372($sp) # internal_78 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_ancestor_start_8744937325815: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_78 + lw $t0, 372($sp) + sw $t0, 4($sp) # Storing internal_78 + + # Argument internal_60 + lw $t0, 444($sp) + sw $t0, 0($sp) # Storing internal_60 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 368($sp) # internal_79 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_79 then goto foreach_ancestor_body_8744937325815 + lw $t0, 356($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8744937325815 + + # Jumping to foreach_ancestor_end_8744937325815 + j foreach_ancestor_end_8744937325815 + + foreach_ancestor_body_8744937325815: + + # internal_80 = array internal_64[4 * internal_78] + lw $t0, 360($sp) # $t0 = internal_78 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 416($sp) # $t1 = internal_64 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 352($sp) # internal_80 = array internal_64[4 * internal_78] + + # internal_81 = EqualAddress(internal_77, internal_80) + lw $t0, 364($sp) + lw $t1, 352($sp) + seq $t2, $t0, $t1 + lw $t0, 348($sp) + sw $t2, 8($t0) + + # If internal_81 then goto foreach_ancestor_end_8744937325815 + lw $t0, 348($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8744937325815 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_78 + lw $t0, 372($sp) + sw $t0, 4($sp) # Storing internal_78 + + # Argument internal_57 + lw $t0, 456($sp) + sw $t0, 0($sp) # Storing internal_57 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 372($sp) # internal_78 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_ancestor_start_8744937325815 + j foreach_ancestor_start_8744937325815 + + foreach_ancestor_end_8744937325815: + + # array internal_68[4 * internal_75] = internal_78 + lw $t0, 372($sp) # $t0 = internal_75 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 400($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 360($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_75 + lw $t0, 384($sp) + sw $t0, 4($sp) # Storing internal_75 + + # Argument internal_57 + lw $t0, 456($sp) + sw $t0, 0($sp) # Storing internal_57 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 384($sp) # internal_75 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_type_start_8744937325815 + j foreach_type_start_8744937325815 + + foreach_type_end_8744937325815: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_87[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 324($sp) # internal_87 = "\n" + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_88[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 320($sp) # internal_88 = " " + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 344($sp) # internal_82 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 340($sp) # internal_83 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 336($sp) # internal_84 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 332($sp) # internal_85 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 328($sp) # internal_86 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_85 + lw $t0, 344($sp) + sw $t0, 4($sp) # Storing internal_85 + + # Argument internal_60 + lw $t0, 444($sp) + sw $t0, 0($sp) # Storing internal_60 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 344($sp) # internal_85 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_min_start_8744937325815: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_82 + lw $t0, 356($sp) + sw $t0, 4($sp) # Storing internal_82 + + # Argument internal_58 + lw $t0, 452($sp) + sw $t0, 0($sp) # Storing internal_58 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 340($sp) # internal_86 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_86 then goto foreach_min_body_8744937325815 + lw $t0, 328($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8744937325815 + + # Jumping to foreach_min_end_8744937325815 + j foreach_min_end_8744937325815 + + foreach_min_body_8744937325815: + + # internal_84 = array internal_68[4 * internal_82] + lw $t0, 344($sp) # $t0 = internal_82 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 400($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 336($sp) # internal_84 = array internal_68[4 * internal_82] + sw $t0, 8($t2) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_84 + lw $t0, 348($sp) + sw $t0, 4($sp) # Storing internal_84 + + # Argument internal_85 + lw $t0, 344($sp) + sw $t0, 0($sp) # Storing internal_85 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 340($sp) # internal_86 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_86 then goto update_min_8744937325815 + lw $t0, 328($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8744937325815 + + # Jumping to update_min_end_8744937325815 + j update_min_end_8744937325815 + + update_min_8744937325815: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_85 + lw $t0, 344($sp) + sw $t0, 4($sp) # Storing internal_85 + + # Argument internal_84 + lw $t0, 348($sp) + sw $t0, 0($sp) # Storing internal_84 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 344($sp) # internal_85 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_83 + lw $t0, 352($sp) + sw $t0, 4($sp) # Storing internal_83 + + # Argument internal_82 + lw $t0, 356($sp) + sw $t0, 0($sp) # Storing internal_82 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 352($sp) # internal_83 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + update_min_end_8744937325815: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_82 + lw $t0, 356($sp) + sw $t0, 4($sp) # Storing internal_82 + + # Argument internal_57 + lw $t0, 456($sp) + sw $t0, 0($sp) # Storing internal_57 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 356($sp) # internal_82 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_min_start_8744937325815 + j foreach_min_start_8744937325815 + + foreach_min_end_8744937325815: + + # initialize Array [internal_58] + lw $t0, 440($sp) # $t0 = internal_58 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 316($sp) # internal_89 = new Array[internal_58] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 312($sp) # internal_90 = address of allocated object Int + + # array internal_89[4 * internal_90] = internal_56 + lw $t0, 312($sp) # $t0 = internal_90 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 316($sp) # $t1 = internal_89 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 448($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 308($sp) # internal_91 = address of allocated object Int + + # array internal_89[4 * internal_91] = internal_56 + lw $t0, 308($sp) # $t0 = internal_91 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 316($sp) # $t1 = internal_89 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 448($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 304($sp) # internal_92 = address of allocated object Int + + # array internal_89[4 * internal_92] = internal_56 + lw $t0, 304($sp) # $t0 = internal_92 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 316($sp) # $t1 = internal_89 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 448($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 300($sp) # internal_93 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_85 + lw $t0, 344($sp) + sw $t0, 4($sp) # Storing internal_85 + + # Argument internal_60 + lw $t0, 444($sp) + sw $t0, 0($sp) # Storing internal_60 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 312($sp) # internal_93 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_93 then goto error_branch_8744937325815 + lw $t0, 300($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8744937325815 + + # array internal_89[4 * internal_83] = internal_57 + lw $t0, 340($sp) # $t0 = internal_83 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 316($sp) # $t1 = internal_89 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 444($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 296($sp) # internal_94 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 292($sp) # internal_95 = address of allocated object Int + + # internal_94 = array internal_89[4 * internal_95] + lw $t0, 292($sp) # $t0 = internal_95 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 316($sp) # $t1 = internal_89 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 296($sp) # internal_94 = array internal_89[4 * internal_95] + sw $t0, 8($t2) + + # If internal_94 then goto branch_Razz_8744937325815 + lw $t0, 296($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Razz_8744937325815 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 288($sp) # internal_96 = address of allocated object Int + + # internal_94 = array internal_89[4 * internal_96] + lw $t0, 288($sp) # $t0 = internal_96 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 316($sp) # $t1 = internal_89 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 296($sp) # internal_94 = array internal_89[4 * internal_96] + sw $t0, 8($t2) + + # If internal_94 then goto branch_Foo_8744937325815 + lw $t0, 296($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Foo_8744937325815 + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 284($sp) # internal_97 = address of allocated object Int + + # internal_94 = array internal_89[4 * internal_97] + lw $t0, 284($sp) # $t0 = internal_97 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 316($sp) # $t1 = internal_89 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 296($sp) # internal_94 = array internal_89[4 * internal_97] + sw $t0, 8($t2) + + # If internal_94 then goto branch_Bar_8744937325815 + lw $t0, 296($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bar_8744937325815 + + branch_Razz_8744937325815: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 492($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 688($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 492($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bar + li $v0, 9 + lw $a0, type_Bar + syscall + la $t0, type_Bar # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 272($sp) # internal_100 = address of allocated object Bar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_100 + lw $t0, 280($sp) + sw $t0, 0($sp) # Storing internal_100 + + # Calling function function___init___at_Bar + jal function___init___at_Bar + lw $ra, 4($sp) + sw $v1, 280($sp) # internal_100 = result of function___init___at_Bar + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_98 + lw $t0, 292($sp) + sw $t0, 4($sp) # Storing internal_98 + + # Argument internal_100 + lw $t0, 284($sp) + sw $t0, 0($sp) # Storing internal_100 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 292($sp) # internal_98 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_98 = internal_100 + lw $t0, 272($sp) + sw $t0, 280($sp) + + # Jumping to branch_end_8744937325815 + j branch_end_8744937325815 + + branch_Foo_8744937325815: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 492($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 688($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 492($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Razz + li $v0, 9 + lw $a0, type_Razz + syscall + la $t0, type_Razz # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 264($sp) # internal_102 = address of allocated object Razz + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_102 + lw $t0, 272($sp) + sw $t0, 0($sp) # Storing internal_102 + + # Calling function function___init___at_Razz + jal function___init___at_Razz + lw $ra, 4($sp) + sw $v1, 272($sp) # internal_102 = result of function___init___at_Razz + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_98 + lw $t0, 292($sp) + sw $t0, 4($sp) # Storing internal_98 + + # Argument internal_102 + lw $t0, 276($sp) + sw $t0, 0($sp) # Storing internal_102 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 292($sp) # internal_98 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_98 = internal_102 + lw $t0, 264($sp) + sw $t0, 280($sp) + + # Jumping to branch_end_8744937325815 + j branch_end_8744937325815 + + branch_Bar_8744937325815: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 492($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 688($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 492($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_98 + lw $t0, 292($sp) + sw $t0, 4($sp) # Storing internal_98 + + # Argument n + lw $t0, 492($sp) + sw $t0, 0($sp) # Storing n + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 292($sp) # internal_98 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_98 = n + lw $t0, 480($sp) + sw $t0, 280($sp) + + # Jumping to branch_end_8744937325815 + j branch_end_8744937325815 + + error_branch_8744937325815: + + branch_end_8744937325815: + + # Set attribute a of self + lw $t0, 676($sp) # $t0 = self + lw $t1, 280($sp) # $t1 = internal_98 + beq $t1, $zero, object_set_attribute_8744937268044 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937268044 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937268044 + j object_set_attribute_8744937268044 + int_set_attribute_8744937268044: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.a = internal_98 + j end_set_attribute_8744937268044 + bool_set_attribute_8744937268044: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.a = internal_98 + j end_set_attribute_8744937268044 + object_set_attribute_8744937268044: + sw $t1, 20($t0) # self.a = internal_98 + end_set_attribute_8744937268044: + + # Get attribute a of self + lw $t0, 676($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'a' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8744937271248 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8744937271248 + j object_get_attribute_8744937271248 + int_get_attribute_8744937271248: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 256($sp) # internal_104 = self.a + j end_get_attribute_8744937271248 + bool_get_attribute_8744937271248: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 256($sp) # internal_104 = self.a + j end_get_attribute_8744937271248 + object_get_attribute_8744937271248: + sw $t1, 256($sp) # internal_104 = a + end_get_attribute_8744937271248: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_104 + lw $t0, 264($sp) + sw $t0, 0($sp) # Storing internal_104 + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 260($sp) # internal_105 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute g of self + lw $t0, 676($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'g' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8744937271278 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8744937271278 + j object_get_attribute_8744937271278 + int_get_attribute_8744937271278: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 248($sp) # internal_106 = self.g + j end_get_attribute_8744937271278 + bool_get_attribute_8744937271278: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 248($sp) # internal_106 = self.g + j end_get_attribute_8744937271278 + object_get_attribute_8744937271278: + sw $t1, 248($sp) # internal_106 = g + end_get_attribute_8744937271278: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_106 + lw $t0, 256($sp) + sw $t0, 0($sp) # Storing internal_106 + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 252($sp) # internal_107 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_105 + lw $t0, 264($sp) + sw $t0, 4($sp) # Storing internal_105 + + # Argument internal_107 + lw $t0, 256($sp) + sw $t0, 0($sp) # Storing internal_107 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 252($sp) # internal_108 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 684($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 244($sp) # internal_109 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_108 + lw $t0, 252($sp) + sw $t0, 4($sp) # Storing internal_108 + + # Argument internal_109 + lw $t0, 248($sp) + sw $t0, 0($sp) # Storing internal_109 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 244($sp) # internal_110 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 684($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_printh_at_Bazz + jal function_printh_at_Bazz + lw $ra, 4($sp) + sw $v1, 236($sp) # internal_111 = result of function_printh_at_Bazz + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_110 + lw $t0, 244($sp) + sw $t0, 4($sp) # Storing internal_110 + + # Argument internal_111 + lw $t0, 240($sp) + sw $t0, 0($sp) # Storing internal_111 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 236($sp) # internal_112 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute b of self + lw $t0, 676($sp) # $t0 = self + lw $t1, 224($sp) # $t1 = internal_112 + beq $t1, $zero, object_set_attribute_8744937271188 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937271188 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937271188 + j object_set_attribute_8744937271188 + int_set_attribute_8744937271188: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($t0) # self.b = internal_112 + j end_set_attribute_8744937271188 + bool_set_attribute_8744937271188: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($t0) # self.b = internal_112 + j end_set_attribute_8744937271188 + object_set_attribute_8744937271188: + sw $t1, 24($t0) # self.b = internal_112 + end_set_attribute_8744937271188: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 220($sp) # internal_113 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 216($sp) # internal_114 = address of allocated object Int + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 212($sp) # internal_115 = address of allocated object Int + + # Allocating NUll to internal_116 + sw $zero, 208($sp) # internal_116 = 0 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 204($sp) # internal_117 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 192($sp) # internal_120 = address of allocated object Int + + # internal_118 = typeof self that is the first word of the object + lw $t0, 676($sp) + lw $t0, 0($t0) + sw $t0, 200($sp) + + # internal_119 = internal_118 + lw $t0, 200($sp) + sw $t0, 196($sp) + + while_start_8744937301390: + + # internal_120 = EqualAddress(internal_119, internal_116) + lw $t0, 196($sp) + lw $t1, 208($sp) + seq $t2, $t0, $t1 + lw $t0, 192($sp) + sw $t2, 8($t0) + + # If internal_120 then goto while_end_8744937301390 + lw $t0, 192($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8744937301390 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_117 + lw $t0, 216($sp) + sw $t0, 4($sp) # Storing internal_117 + + # Argument internal_114 + lw $t0, 228($sp) + sw $t0, 0($sp) # Storing internal_114 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 216($sp) # internal_117 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_119 = ancestor of internal_119 + lw $t0, 196($sp) + lw $t0, 4($t0) + sw $t0, 196($sp) + + # Jumping to while_start_8744937301390 + j while_start_8744937301390 + + while_end_8744937301390: + + # internal_119 = internal_118 + lw $t0, 200($sp) + sw $t0, 196($sp) + + # initialize Array [internal_117] + lw $t0, 204($sp) # $t0 = internal_117 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 188($sp) # internal_121 = new Array[internal_117] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 184($sp) # internal_122 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 180($sp) # internal_123 = address of allocated object Int + + foreach_start_8744937301390: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_122 + lw $t0, 196($sp) + sw $t0, 4($sp) # Storing internal_122 + + # Argument internal_117 + lw $t0, 216($sp) + sw $t0, 0($sp) # Storing internal_117 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 192($sp) # internal_123 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_123 then goto foreach_body_8744937301390 + lw $t0, 180($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8744937301390 + + # Jumping to foreach_end_8744937301390 + j foreach_end_8744937301390 + + foreach_body_8744937301390: + + # array internal_121[4 * internal_122] = internal_119 + lw $t0, 184($sp) # $t0 = internal_122 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 188($sp) # $t1 = internal_121 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 196($sp) + sw $t0, 0($t1) + + # internal_119 = ancestor of internal_119 + lw $t0, 196($sp) + lw $t0, 4($t0) + sw $t0, 196($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_122 + lw $t0, 196($sp) + sw $t0, 4($sp) # Storing internal_122 + + # Argument internal_114 + lw $t0, 228($sp) + sw $t0, 0($sp) # Storing internal_114 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 196($sp) # internal_122 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_start_8744937301390 + j foreach_start_8744937301390 + + foreach_end_8744937301390: + + # initialize Array [internal_115] + lw $t0, 212($sp) # $t0 = internal_115 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 176($sp) # internal_124 = new Array[internal_115] + + # initialize Array [internal_115] + lw $t0, 212($sp) # $t0 = internal_115 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 172($sp) # internal_125 = new Array[internal_115] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 164($sp) # internal_127 = address of allocated object Int + + # internal_126 = direction of Razz + la $t0, type_Razz + sw $t0, 168($sp) + + # array internal_124[4 * internal_127] = internal_126 + lw $t0, 164($sp) # $t0 = internal_127 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 176($sp) # $t1 = internal_124 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 168($sp) + sw $t0, 0($t1) + + # array internal_125[4 * internal_127] = internal_117 + lw $t0, 164($sp) # $t0 = internal_127 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 172($sp) # $t1 = internal_125 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 204($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 156($sp) # internal_129 = address of allocated object Int + + # internal_128 = direction of Bar + la $t0, type_Bar + sw $t0, 160($sp) + + # array internal_124[4 * internal_129] = internal_128 + lw $t0, 156($sp) # $t0 = internal_129 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 176($sp) # $t1 = internal_124 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 160($sp) + sw $t0, 0($t1) + + # array internal_125[4 * internal_129] = internal_117 + lw $t0, 156($sp) # $t0 = internal_129 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 172($sp) # $t1 = internal_125 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 204($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 152($sp) # internal_130 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 148($sp) # internal_131 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 140($sp) # internal_133 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_134 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_136 = address of allocated object Int + + foreach_type_start_8744937301390: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_130 + lw $t0, 164($sp) + sw $t0, 4($sp) # Storing internal_130 + + # Argument internal_115 + lw $t0, 224($sp) + sw $t0, 0($sp) # Storing internal_115 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 160($sp) # internal_131 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_131 then goto foreach_type_body_8744937301390 + lw $t0, 148($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8744937301390 + + # Jumping to foreach_type_end_8744937301390 + j foreach_type_end_8744937301390 + + foreach_type_body_8744937301390: + + # internal_132 = array internal_124[4 * internal_130] + lw $t0, 152($sp) # $t0 = internal_130 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 176($sp) # $t1 = internal_124 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 144($sp) # internal_132 = array internal_124[4 * internal_130] + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_133 + lw $t0, 152($sp) + sw $t0, 4($sp) # Storing internal_133 + + # Argument internal_113 + lw $t0, 232($sp) + sw $t0, 0($sp) # Storing internal_113 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 152($sp) # internal_133 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_ancestor_start_8744937301390: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_133 + lw $t0, 152($sp) + sw $t0, 4($sp) # Storing internal_133 + + # Argument internal_117 + lw $t0, 216($sp) + sw $t0, 0($sp) # Storing internal_117 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 148($sp) # internal_134 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_134 then goto foreach_ancestor_body_8744937301390 + lw $t0, 136($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8744937301390 + + # Jumping to foreach_ancestor_end_8744937301390 + j foreach_ancestor_end_8744937301390 + + foreach_ancestor_body_8744937301390: + + # internal_135 = array internal_121[4 * internal_133] + lw $t0, 140($sp) # $t0 = internal_133 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 188($sp) # $t1 = internal_121 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 132($sp) # internal_135 = array internal_121[4 * internal_133] + + # internal_136 = EqualAddress(internal_132, internal_135) + lw $t0, 144($sp) + lw $t1, 132($sp) + seq $t2, $t0, $t1 + lw $t0, 128($sp) + sw $t2, 8($t0) + + # If internal_136 then goto foreach_ancestor_end_8744937301390 + lw $t0, 128($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8744937301390 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_133 + lw $t0, 152($sp) + sw $t0, 4($sp) # Storing internal_133 + + # Argument internal_114 + lw $t0, 228($sp) + sw $t0, 0($sp) # Storing internal_114 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 152($sp) # internal_133 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_ancestor_start_8744937301390 + j foreach_ancestor_start_8744937301390 + + foreach_ancestor_end_8744937301390: + + # array internal_125[4 * internal_130] = internal_133 + lw $t0, 152($sp) # $t0 = internal_130 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 172($sp) # $t1 = internal_125 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 140($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_130 + lw $t0, 164($sp) + sw $t0, 4($sp) # Storing internal_130 + + # Argument internal_114 + lw $t0, 228($sp) + sw $t0, 0($sp) # Storing internal_114 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 164($sp) # internal_130 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_type_start_8744937301390 + j foreach_type_start_8744937301390 + + foreach_type_end_8744937301390: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_142[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 104($sp) # internal_142 = "\n" + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_143[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 100($sp) # internal_143 = " " + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 124($sp) # internal_137 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_138 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 116($sp) # internal_139 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_140 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_141 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_140 + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing internal_140 + + # Argument internal_117 + lw $t0, 216($sp) + sw $t0, 0($sp) # Storing internal_117 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 124($sp) # internal_140 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_min_start_8744937301390: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_137 + lw $t0, 136($sp) + sw $t0, 4($sp) # Storing internal_137 + + # Argument internal_115 + lw $t0, 224($sp) + sw $t0, 0($sp) # Storing internal_115 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 120($sp) # internal_141 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_141 then goto foreach_min_body_8744937301390 + lw $t0, 108($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8744937301390 + + # Jumping to foreach_min_end_8744937301390 + j foreach_min_end_8744937301390 + + foreach_min_body_8744937301390: + + # internal_139 = array internal_125[4 * internal_137] + lw $t0, 124($sp) # $t0 = internal_137 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 172($sp) # $t1 = internal_125 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 116($sp) # internal_139 = array internal_125[4 * internal_137] + sw $t0, 8($t2) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_139 + lw $t0, 128($sp) + sw $t0, 4($sp) # Storing internal_139 + + # Argument internal_140 + lw $t0, 124($sp) + sw $t0, 0($sp) # Storing internal_140 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 120($sp) # internal_141 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_141 then goto update_min_8744937301390 + lw $t0, 108($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8744937301390 + + # Jumping to update_min_end_8744937301390 + j update_min_end_8744937301390 + + update_min_8744937301390: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_140 + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing internal_140 + + # Argument internal_139 + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing internal_139 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 124($sp) # internal_140 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_138 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_138 + + # Argument internal_137 + lw $t0, 136($sp) + sw $t0, 0($sp) # Storing internal_137 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 132($sp) # internal_138 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + update_min_end_8744937301390: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_137 + lw $t0, 136($sp) + sw $t0, 4($sp) # Storing internal_137 + + # Argument internal_114 + lw $t0, 228($sp) + sw $t0, 0($sp) # Storing internal_114 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 136($sp) # internal_137 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_min_start_8744937301390 + j foreach_min_start_8744937301390 + + foreach_min_end_8744937301390: + + # initialize Array [internal_115] + lw $t0, 212($sp) # $t0 = internal_115 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 96($sp) # internal_144 = new Array[internal_115] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 92($sp) # internal_145 = address of allocated object Int + + # array internal_144[4 * internal_145] = internal_113 + lw $t0, 92($sp) # $t0 = internal_145 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 96($sp) # $t1 = internal_144 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 220($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_146 = address of allocated object Int + + # array internal_144[4 * internal_146] = internal_113 + lw $t0, 88($sp) # $t0 = internal_146 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 96($sp) # $t1 = internal_144 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 220($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_147 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_140 + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing internal_140 + + # Argument internal_117 + lw $t0, 216($sp) + sw $t0, 0($sp) # Storing internal_117 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 96($sp) # internal_147 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_147 then goto error_branch_8744937301390 + lw $t0, 84($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8744937301390 + + # array internal_144[4 * internal_138] = internal_114 + lw $t0, 120($sp) # $t0 = internal_138 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 96($sp) # $t1 = internal_144 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 216($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_148 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_149 = address of allocated object Int + + # internal_148 = array internal_144[4 * internal_149] + lw $t0, 76($sp) # $t0 = internal_149 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 96($sp) # $t1 = internal_144 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 80($sp) # internal_148 = array internal_144[4 * internal_149] + sw $t0, 8($t2) + + # If internal_148 then goto branch_Razz_8744937301390 + lw $t0, 80($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Razz_8744937301390 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_150 = address of allocated object Int + + # internal_148 = array internal_144[4 * internal_150] + lw $t0, 72($sp) # $t0 = internal_150 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 96($sp) # $t1 = internal_144 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 80($sp) # internal_148 = array internal_144[4 * internal_150] + sw $t0, 8($t2) + + # If internal_148 then goto branch_Bar_8744937301390 + lw $t0, 80($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bar_8744937301390 + + branch_Razz_8744937301390: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 492($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 688($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 492($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bar + li $v0, 9 + lw $a0, type_Bar + syscall + la $t0, type_Bar # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 60($sp) # internal_153 = address of allocated object Bar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_153 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_153 + + # Calling function function___init___at_Bar + jal function___init___at_Bar + lw $ra, 4($sp) + sw $v1, 68($sp) # internal_153 = result of function___init___at_Bar + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_151 + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing internal_151 + + # Argument internal_153 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_153 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_151 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_151 = internal_153 + lw $t0, 60($sp) + sw $t0, 68($sp) + + # Jumping to branch_end_8744937301390 + j branch_end_8744937301390 + + branch_Bar_8744937301390: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 492($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 688($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 492($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_151 + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing internal_151 + + # Argument n + lw $t0, 492($sp) + sw $t0, 0($sp) # Storing n + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_151 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_151 = n + lw $t0, 480($sp) + sw $t0, 68($sp) + + # Jumping to branch_end_8744937301390 + j branch_end_8744937301390 + + error_branch_8744937301390: + + branch_end_8744937301390: + + # Set attribute e of self + lw $t0, 676($sp) # $t0 = self + lw $t1, 68($sp) # $t1 = internal_151 + beq $t1, $zero, object_set_attribute_8744937271893 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937271893 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937271893 + j object_set_attribute_8744937271893 + int_set_attribute_8744937271893: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($t0) # self.e = internal_151 + j end_set_attribute_8744937271893 + bool_set_attribute_8744937271893: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($t0) # self.e = internal_151 + j end_set_attribute_8744937271893 + object_set_attribute_8744937271893: + sw $t1, 28($t0) # self.e = internal_151 + end_set_attribute_8744937271893: + + # Get attribute a of self + lw $t0, 676($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'a' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8744937274935 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8744937274935 + j object_get_attribute_8744937274935 + int_get_attribute_8744937274935: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 52($sp) # internal_155 = self.a + j end_get_attribute_8744937274935 + bool_get_attribute_8744937274935: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 52($sp) # internal_155 = self.a + j end_get_attribute_8744937274935 + object_get_attribute_8744937274935: + sw $t1, 52($sp) # internal_155 = a + end_get_attribute_8744937274935: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_155 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_155 + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 56($sp) # internal_156 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute g of self + lw $t0, 676($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'g' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8744937274965 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8744937274965 + j object_get_attribute_8744937274965 + int_get_attribute_8744937274965: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 44($sp) # internal_157 = self.g + j end_get_attribute_8744937274965 + bool_get_attribute_8744937274965: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 44($sp) # internal_157 = self.g + j end_get_attribute_8744937274965 + object_get_attribute_8744937274965: + sw $t1, 44($sp) # internal_157 = g + end_get_attribute_8744937274965: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_157 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_157 + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 48($sp) # internal_158 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_156 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing internal_156 + + # Argument internal_158 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_158 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_159 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute e of self + lw $t0, 676($sp) # Get the address of self + lw $t1, 28($t0) # Get the attribute 'e' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8744937275010 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8744937275010 + j object_get_attribute_8744937275010 + int_get_attribute_8744937275010: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_160 = self.e + j end_get_attribute_8744937275010 + bool_get_attribute_8744937275010: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_160 = self.e + j end_get_attribute_8744937275010 + object_get_attribute_8744937275010: + sw $t1, 32($sp) # internal_160 = e + end_get_attribute_8744937275010: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_160 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_160 + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 36($sp) # internal_161 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_159 + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing internal_159 + + # Argument internal_161 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_161 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_162 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 684($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_163 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_162 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_162 + + # Argument internal_163 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_163 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_164 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 684($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_printh_at_Bazz + jal function_printh_at_Bazz + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_165 = result of function_printh_at_Bazz + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_164 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_164 + + # Argument internal_165 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_165 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_166 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute f of self + lw $t0, 676($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_166 + beq $t1, $zero, object_set_attribute_8744937274603 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937274603 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937274603 + j object_set_attribute_8744937274603 + int_set_attribute_8744937274603: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($t0) # self.f = internal_166 + j end_set_attribute_8744937274603 + bool_set_attribute_8744937274603: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($t0) # self.f = internal_166 + j end_set_attribute_8744937274603 + object_set_attribute_8744937274603: + sw $t1, 32($t0) # self.f = internal_166 + end_set_attribute_8744937274603: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 684($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_167 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute c of self + lw $t0, 676($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_167 + beq $t1, $zero, object_set_attribute_8744937275109 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937275109 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937275109 + j object_set_attribute_8744937275109 + int_set_attribute_8744937275109: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 36($t0) # self.c = internal_167 + j end_set_attribute_8744937275109 + bool_set_attribute_8744937275109: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 36($t0) # self.c = internal_167 + j end_set_attribute_8744937275109 + object_set_attribute_8744937275109: + sw $t1, 36($t0) # self.c = internal_167 + end_set_attribute_8744937275109: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 684($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_printh_at_Bazz + jal function_printh_at_Bazz + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_168 = result of function_printh_at_Bazz + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute d of self + lw $t0, 676($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_168 + beq $t1, $zero, object_set_attribute_8744937275106 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937275106 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937275106 + j object_set_attribute_8744937275106 + int_set_attribute_8744937275106: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($t0) # self.d = internal_168 + j end_set_attribute_8744937275106 + bool_set_attribute_8744937275106: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($t0) # self.d = internal_168 + j end_set_attribute_8744937275106 + object_set_attribute_8744937275106: + sw $t1, 40($t0) # self.d = internal_168 + end_set_attribute_8744937275106: + + # Loading return value in $v1 + lw $v1, 676($sp) + + # Freeing space for local variables + addi $sp, $sp, 676 + + jr $ra + + function___init___at_Razz: + # Function parameters + # $ra = 672($sp) + # self = 668($sp) + + # Reserving space for local variables + addi $sp, $sp, -668 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 664($sp) # internal_0 = address of allocated object Int + + # Set attribute h of self + lw $t0, 668($sp) # $t0 = self + lw $t1, 664($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8744937275700 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937275700 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937275700 + j object_set_attribute_8744937275700 + int_set_attribute_8744937275700: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.h = internal_0 + j end_set_attribute_8744937275700 + bool_set_attribute_8744937275700: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.h = internal_0 + j end_set_attribute_8744937275700 + object_set_attribute_8744937275700: + sw $t1, 8($t0) # self.h = internal_0 + end_set_attribute_8744937275700: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 660($sp) # internal_1 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 656($sp) # internal_2 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 652($sp) # internal_3 = address of allocated object Int + + # Allocating NUll to internal_4 + sw $zero, 648($sp) # internal_4 = 0 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 644($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 632($sp) # internal_8 = address of allocated object Int + + # internal_6 = typeof self that is the first word of the object + lw $t0, 668($sp) + lw $t0, 0($t0) + sw $t0, 640($sp) + + # internal_7 = internal_6 + lw $t0, 640($sp) + sw $t0, 636($sp) + + while_start_8744937301489: + + # internal_8 = EqualAddress(internal_7, internal_4) + lw $t0, 636($sp) + lw $t1, 648($sp) + seq $t2, $t0, $t1 + lw $t0, 632($sp) + sw $t2, 8($t0) + + # If internal_8 then goto while_end_8744937301489 + lw $t0, 632($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8744937301489 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_5 + lw $t0, 656($sp) + sw $t0, 4($sp) # Storing internal_5 + + # Argument internal_2 + lw $t0, 668($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 656($sp) # internal_5 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_7 = ancestor of internal_7 + lw $t0, 636($sp) + lw $t0, 4($t0) + sw $t0, 636($sp) + + # Jumping to while_start_8744937301489 + j while_start_8744937301489 + + while_end_8744937301489: + + # internal_7 = internal_6 + lw $t0, 640($sp) + sw $t0, 636($sp) + + # initialize Array [internal_5] + lw $t0, 644($sp) # $t0 = internal_5 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 628($sp) # internal_9 = new Array[internal_5] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 624($sp) # internal_10 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 620($sp) # internal_11 = address of allocated object Int + + foreach_start_8744937301489: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_5 + lw $t0, 656($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 632($sp) # internal_11 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_11 then goto foreach_body_8744937301489 + lw $t0, 620($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8744937301489 + # Jumping to foreach_end_8744937301489 + j foreach_end_8744937301489 + foreach_body_8744937301489: + # array internal_9[4 * internal_10] = internal_7 + lw $t0, 624($sp) # $t0 = internal_10 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 628($sp) # $t1 = internal_9 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 636($sp) + sw $t0, 0($t1) + # internal_7 = ancestor of internal_7 + lw $t0, 636($sp) + lw $t0, 4($t0) + sw $t0, 636($sp) + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_2 + lw $t0, 668($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 636($sp) # internal_10 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_start_8744937301489 + j foreach_start_8744937301489 + + foreach_end_8744937301489: + + # initialize Array [internal_3] + lw $t0, 652($sp) # $t0 = internal_3 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 616($sp) # internal_12 = new Array[internal_3] + + # initialize Array [internal_3] + lw $t0, 652($sp) # $t0 = internal_3 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 612($sp) # internal_13 = new Array[internal_3] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 604($sp) # internal_15 = address of allocated object Int + + # internal_14 = direction of Bazz + la $t0, type_Bazz + sw $t0, 608($sp) + + # array internal_12[4 * internal_15] = internal_14 + lw $t0, 604($sp) # $t0 = internal_15 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 616($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 608($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_15] = internal_5 + lw $t0, 604($sp) # $t0 = internal_15 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 612($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 644($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 596($sp) # internal_17 = address of allocated object Int + + # internal_16 = direction of Razz + la $t0, type_Razz + sw $t0, 600($sp) + + # array internal_12[4 * internal_17] = internal_16 + lw $t0, 596($sp) # $t0 = internal_17 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 616($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 600($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_17] = internal_5 + lw $t0, 596($sp) # $t0 = internal_17 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 612($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 644($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 588($sp) # internal_19 = address of allocated object Int + + # internal_18 = direction of Foo + la $t0, type_Foo + sw $t0, 592($sp) + + # array internal_12[4 * internal_19] = internal_18 + lw $t0, 588($sp) # $t0 = internal_19 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 616($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 592($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_19] = internal_5 + lw $t0, 588($sp) # $t0 = internal_19 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 612($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 644($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 580($sp) # internal_21 = address of allocated object Int + + # internal_20 = direction of Bar + la $t0, type_Bar + sw $t0, 584($sp) + + # array internal_12[4 * internal_21] = internal_20 + lw $t0, 580($sp) # $t0 = internal_21 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 616($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 584($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_21] = internal_5 + lw $t0, 580($sp) # $t0 = internal_21 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 612($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 644($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) # Allocating Int 0 li $v0, 9 @@ -2940,7 +9670,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 336($sp) # internal_45 = address of allocated object Int + sw $v0, 576($sp) # internal_22 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -2952,635 +9682,1130 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 344($sp) # internal_43 = address of allocated object Int + sw $v0, 572($sp) # internal_23 = address of allocated object Int + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 564($sp) # internal_25 = address of allocated object Int + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # internal_41 = typeof self that is the first word of the object - lw $t0, 520($sp) - lw $t1, 0($t0) - sw $t1, 352($sp) + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 560($sp) # internal_26 = address of allocated object Int - lw $t0, 352($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 348($sp) - j end_assign - not_is_Bool_or_Int: - # internal_42 = internal_41 - lw $t0, 352($sp) - sw $t0, 348($sp) - end_assign: + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - lw $t0, 336($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 356($sp) - j end_assign - not_is_Bool_or_Int: - # internal_40 = internal_45 - lw $t0, 336($sp) - sw $t0, 356($sp) - end_assign: + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 552($sp) # internal_28 = address of allocated object Int - while_start_8779768552376: + foreach_type_start_8744937301489: - # Equal operation - lw $t0, 348($sp) # Save in $t0 the left operand address - # If internal_43 then goto while_end_8779768552376 - lw $t0, 344($sp) # Loading the address of the condition + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_22 + lw $t0, 588($sp) + sw $t0, 4($sp) # Storing internal_22 + + # Argument internal_3 + lw $t0, 664($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 584($sp) # internal_23 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_23 then goto foreach_type_body_8744937301489 + lw $t0, 572($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_end_8779768552376 + beq $t0, $t1, foreach_type_body_8744937301489 - # Addition operation - lw $t0, 356($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # internal_42 = ancestor of internal_42 that is the first word of the object - lw $t0, 348($sp) - lw $t1, 4($t0) - sw $t1, 348($sp) + # Jumping to foreach_type_end_8744937301489 + j foreach_type_end_8744937301489 + + foreach_type_body_8744937301489: - # Jumping to while_start_8779768552376 - j while_start_8779768552376 + # internal_24 = array internal_12[4 * internal_22] + lw $t0, 576($sp) # $t0 = internal_22 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 616($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 568($sp) # internal_24 = array internal_12[4 * internal_22] + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - while_end_8779768552376: + # Argument internal_25 + lw $t0, 576($sp) + sw $t0, 4($sp) # Storing internal_25 + # Argument internal_1 + lw $t0, 672($sp) + sw $t0, 0($sp) # Storing internal_1 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 576($sp) # internal_25 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + foreach_ancestor_start_8744937301489: - lw $t0, 352($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 348($sp) - j end_assign - not_is_Bool_or_Int: - # internal_42 = internal_41 - lw $t0, 352($sp) - sw $t0, 348($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_25 + lw $t0, 576($sp) + sw $t0, 4($sp) # Storing internal_25 - foreach_start_8779768552376: + # Argument internal_5 + lw $t0, 656($sp) + sw $t0, 0($sp) # Storing internal_5 - # Less than operation - lw $t0, 328($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 356($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 572($sp) # internal_26 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 324($sp) # $t0 = internal_48 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # If internal_26 then goto foreach_ancestor_body_8744937301489 + lw $t0, 560($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8744937301489 + + # Jumping to foreach_ancestor_end_8744937301489 + j foreach_ancestor_end_8744937301489 + + foreach_ancestor_body_8744937301489: + + # internal_27 = array internal_9[4 * internal_25] + lw $t0, 564($sp) # $t0 = internal_25 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 628($sp) # $t1 = internal_9 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 556($sp) # internal_27 = array internal_9[4 * internal_25] + + # internal_28 = EqualAddress(internal_24, internal_27) + lw $t0, 568($sp) + lw $t1, 556($sp) + seq $t2, $t0, $t1 + lw $t0, 552($sp) + sw $t2, 8($t0) - # If internal_48 then goto foreach_body_8779768552376 - lw $t0, 324($sp) # Loading the address of the condition + # If internal_28 then goto foreach_ancestor_end_8744937301489 + lw $t0, 552($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_body_8779768552376 + beq $t0, $t1, foreach_ancestor_end_8744937301489 - # Jumping to foreach_end_8779768552376 - j foreach_end_8779768552376 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - foreach_body_8779768552376: + # Argument internal_25 + lw $t0, 576($sp) + sw $t0, 4($sp) # Storing internal_25 + # Argument internal_2 + lw $t0, 668($sp) + sw $t0, 0($sp) # Storing internal_2 - # internal_42 = ancestor of internal_42 that is the first word of the object - lw $t0, 348($sp) - lw $t1, 4($t0) - sw $t1, 348($sp) + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 576($sp) # internal_25 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - # Addition operation - lw $t0, 328($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_start_8779768552376 - j foreach_start_8779768552376 + # Jumping to foreach_ancestor_start_8744937301489 + j foreach_ancestor_start_8744937301489 - foreach_end_8779768552376: + foreach_ancestor_end_8744937301489: + # array internal_13[4 * internal_22] = internal_25 + lw $t0, 576($sp) # $t0 = internal_22 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 612($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 564($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_22 + lw $t0, 588($sp) + sw $t0, 4($sp) # Storing internal_22 + # Argument internal_2 + lw $t0, 668($sp) + sw $t0, 0($sp) # Storing internal_2 + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 588($sp) # internal_22 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - # internal_51 = direction of Razz - la $t0, type_Razz - sw $t0, 312($sp) + # Jumping to foreach_type_start_8744937301489 + j foreach_type_start_8744937301489 + foreach_type_end_8744937301489: + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - # internal_52 = direction of Foo - la $t0, type_Foo - sw $t0, 308($sp) + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_34[0] = '\n' - # internal_53 = direction of Bar - la $t0, type_Bar - sw $t0, 304($sp) + sb $zero, 9($v0) # Null-terminator at the end of the string + sw $v0, 528($sp) # internal_34 = "\n" + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_35[0] = ' ' - foreach_type_start_8779768552376: + sb $zero, 9($v0) # Null-terminator at the end of the string - # Less than operation - lw $t0, 300($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # If internal_55 then goto foreach_type_body_8779768552376 - lw $t0, 296($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_type_body_8779768552376 + sw $v0, 524($sp) # internal_35 = " " + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 548($sp) # internal_29 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 544($sp) # internal_30 = address of allocated object Int - # Jumping to foreach_type_end_8779768552376 - j foreach_type_end_8779768552376 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - foreach_type_body_8779768552376: + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 540($sp) # internal_31 = address of allocated object Int + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 536($sp) # internal_32 = address of allocated object Int + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 532($sp) # internal_33 = address of allocated object Int - foreach_ancestor_start_8779768552376: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Less than operation - lw $t0, 288($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 356($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + # Argument internal_32 + lw $t0, 548($sp) + sw $t0, 4($sp) # Storing internal_32 - lw $t0, 284($sp) # $t0 = internal_58 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Argument internal_5 + lw $t0, 656($sp) + sw $t0, 0($sp) # Storing internal_5 - # If internal_58 then goto foreach_ancestor_body_8779768552376 - lw $t0, 284($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_body_8779768552376 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 548($sp) # internal_32 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_ancestor_end_8779768552376 - j foreach_ancestor_end_8779768552376 + foreach_min_start_8744937301489: - foreach_ancestor_body_8779768552376: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_29 + lw $t0, 560($sp) + sw $t0, 4($sp) # Storing internal_29 - # Equal operation - lw $t0, 292($sp) # Save in $t0 the left operand address - lw $t1, 280($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + # Argument internal_3 + lw $t0, 664($sp) + sw $t0, 0($sp) # Storing internal_3 - lw $t0, 276($sp) # $t0 = internal_60 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 544($sp) # internal_33 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - # If internal_60 then goto foreach_ancestor_end_8779768552376 - lw $t0, 276($sp) # Loading the address of the condition + # If internal_33 then goto foreach_min_body_8744937301489 + lw $t0, 532($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_end_8779768552376 + beq $t0, $t1, foreach_min_body_8744937301489 - # Addition operation - lw $t0, 288($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_ancestor_start_8779768552376 - j foreach_ancestor_start_8779768552376 + # Jumping to foreach_min_end_8744937301489 + j foreach_min_end_8744937301489 - foreach_ancestor_end_8779768552376: + foreach_min_body_8744937301489: + # internal_31 = array internal_13[4 * internal_29] + lw $t0, 548($sp) # $t0 = internal_29 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 612($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 540($sp) # internal_31 = array internal_13[4 * internal_29] + sw $t0, 8($t2) + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_31 + lw $t0, 552($sp) + sw $t0, 4($sp) # Storing internal_31 + # Argument internal_32 + lw $t0, 548($sp) + sw $t0, 0($sp) # Storing internal_32 - # Addition operation - lw $t0, 300($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_type_start_8779768552376 - j foreach_type_start_8779768552376 + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 544($sp) # internal_33 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - foreach_type_end_8779768552376: + # If internal_33 then goto update_min_8744937301489 + lw $t0, 532($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8744937301489 + # Jumping to update_min_end_8744937301489 + j update_min_end_8744937301489 + update_min_8744937301489: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_32 + lw $t0, 548($sp) + sw $t0, 4($sp) # Storing internal_32 + # Argument internal_31 + lw $t0, 552($sp) + sw $t0, 0($sp) # Storing internal_31 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 548($sp) # internal_32 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 356($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 260($sp) - j end_assign - not_is_Bool_or_Int: - # internal_64 = internal_40 - lw $t0, 356($sp) - sw $t0, 260($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - foreach_min_start_8779768552376: + # Argument internal_30 + lw $t0, 556($sp) + sw $t0, 4($sp) # Storing internal_30 - # Less than operation - lw $t0, 272($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # If internal_65 then goto foreach_min_body_8779768552376 - lw $t0, 256($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_min_body_8779768552376 + # Argument internal_29 + lw $t0, 560($sp) + sw $t0, 0($sp) # Storing internal_29 - # Jumping to foreach_min_end_8779768552376 - j foreach_min_end_8779768552376 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 556($sp) # internal_30 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - foreach_min_body_8779768552376: + update_min_end_8744937301489: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Less than operation - lw $t0, 264($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 260($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + # Argument internal_29 + lw $t0, 560($sp) + sw $t0, 4($sp) # Storing internal_29 - lw $t0, 256($sp) # $t0 = internal_65 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Argument internal_2 + lw $t0, 668($sp) + sw $t0, 0($sp) # Storing internal_2 - # If internal_65 then goto update_min_8779768552376 - lw $t0, 256($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, update_min_8779768552376 + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 560($sp) # internal_29 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_min_end_8779768552376 - j foreach_min_end_8779768552376 + # Jumping to foreach_min_start_8744937301489 + j foreach_min_start_8744937301489 - update_min_8779768552376: + foreach_min_end_8744937301489: - lw $t0, 264($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 260($sp) - j end_assign - not_is_Bool_or_Int: - # internal_64 = internal_63 - lw $t0, 264($sp) - sw $t0, 260($sp) - end_assign: + # initialize Array [internal_3] + lw $t0, 652($sp) # $t0 = internal_3 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 520($sp) # internal_36 = new Array[internal_3] - lw $t0, 272($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 268($sp) - j end_assign - not_is_Bool_or_Int: - # internal_62 = internal_61 - lw $t0, 272($sp) - sw $t0, 268($sp) - end_assign: + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - update_min_end_8779768552376: + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 516($sp) # internal_37 = address of allocated object Int + + # array internal_36[4 * internal_37] = internal_1 + lw $t0, 516($sp) # $t0 = internal_37 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 520($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 660($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # Addition operation - lw $t0, 272($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_min_start_8779768552376 - j foreach_min_start_8779768552376 + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - foreach_min_end_8779768552376: + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 512($sp) # internal_38 = address of allocated object Int + + # array internal_36[4 * internal_38] = internal_1 + lw $t0, 512($sp) # $t0 = internal_38 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 520($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 660($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 508($sp) # internal_39 = address of allocated object Int + + # array internal_36[4 * internal_39] = internal_1 + lw $t0, 508($sp) # $t0 = internal_39 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 520($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 660($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 504($sp) # internal_40 = address of allocated object Int + + # array internal_36[4 * internal_40] = internal_1 + lw $t0, 504($sp) # $t0 = internal_40 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 520($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 660($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 500($sp) # internal_41 = address of allocated object Int + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_32 + lw $t0, 548($sp) + sw $t0, 4($sp) # Storing internal_32 - # Equal operation - lw $t0, 268($sp) # Save in $t0 the left operand address - lw $t1, 356($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + # Argument internal_5 + lw $t0, 656($sp) + sw $t0, 0($sp) # Storing internal_5 - lw $t0, 248($sp) # $t0 = internal_67 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 512($sp) # internal_41 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments - # If internal_67 then goto error_branch_8779768552376 - lw $t0, 248($sp) # Loading the address of the condition + # If internal_41 then goto error_branch_8744937301489 + lw $t0, 500($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, error_branch_8779768552376 + beq $t0, $t1, error_branch_8744937301489 + + # array internal_36[4 * internal_30] = internal_2 + lw $t0, 544($sp) # $t0 = internal_30 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 520($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 656($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 496($sp) # internal_42 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 492($sp) # internal_43 = address of allocated object Int + + # internal_42 = array internal_36[4 * internal_43] + lw $t0, 492($sp) # $t0 = internal_43 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 520($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 496($sp) # internal_42 = array internal_36[4 * internal_43] + sw $t0, 8($t2) + + # If internal_42 then goto branch_Bazz_8744937301489 + lw $t0, 496($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bazz_8744937301489 + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # If internal_68 then goto branch_Razz_8779768552376 - lw $t0, 244($sp) # Loading the address of the condition + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 488($sp) # internal_44 = address of allocated object Int + + # internal_42 = array internal_36[4 * internal_44] + lw $t0, 488($sp) # $t0 = internal_44 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 520($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 496($sp) # internal_42 = array internal_36[4 * internal_44] + sw $t0, 8($t2) + + # If internal_42 then goto branch_Razz_8744937301489 + lw $t0, 496($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Razz_8779768552376 + beq $t0, $t1, branch_Razz_8744937301489 + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # If internal_68 then goto branch_Foo_8779768552376 - lw $t0, 244($sp) # Loading the address of the condition + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 484($sp) # internal_45 = address of allocated object Int + + # internal_42 = array internal_36[4 * internal_45] + lw $t0, 484($sp) # $t0 = internal_45 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 520($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 496($sp) # internal_42 = array internal_36[4 * internal_45] + sw $t0, 8($t2) + + # If internal_42 then goto branch_Foo_8744937301489 + lw $t0, 496($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Foo_8779768552376 + beq $t0, $t1, branch_Foo_8744937301489 + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # If internal_68 then goto branch_Bar_8779768552376 - lw $t0, 244($sp) # Loading the address of the condition + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 480($sp) # internal_46 = address of allocated object Int + + # internal_42 = array internal_36[4 * internal_46] + lw $t0, 480($sp) # $t0 = internal_46 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 520($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 496($sp) # internal_42 = array internal_36[4 * internal_46] + sw $t0, 8($t2) + + # If internal_42 then goto branch_Bar_8744937301489 + lw $t0, 496($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Bar_8779768552376 + beq $t0, $t1, branch_Bar_8744937301489 - branch_Razz_8779768552376: + branch_Bazz_8744937301489: - # Allocating Bar + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 484($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 680($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 484($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Foo li $v0, 9 - lw $a0, type_Bar + lw $a0, type_Foo syscall - la $t0, type_Bar # $t0 = address of the type + la $t0, type_Foo # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 232($sp) # internal_71 = address of allocated object Bar + sw $v0, 468($sp) # internal_49 = address of allocated object Foo # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_71 - lw $t0, 240($sp) - sw $t0, 0($sp) # Storing internal_71 + # Argument internal_49 + lw $t0, 476($sp) + sw $t0, 0($sp) # Storing internal_49 - # Calling function function___init___at_Bar - jal function___init___at_Bar + # Calling function function___init___at_Foo + jal function___init___at_Foo lw $ra, 4($sp) - sw $v1, 240($sp) # internal_71 = result of function___init___at_Bar + sw $v1, 476($sp) # internal_49 = result of function___init___at_Foo addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 232($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 240($sp) - j end_assign - not_is_Bool_or_Int: - # internal_69 = internal_71 - lw $t0, 232($sp) - sw $t0, 240($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Jumping to branch_end_8779768552376 - j branch_end_8779768552376 + # Argument internal_47 + lw $t0, 488($sp) + sw $t0, 4($sp) # Storing internal_47 - branch_Foo_8779768552376: + # Argument internal_49 + lw $t0, 480($sp) + sw $t0, 0($sp) # Storing internal_49 - # Allocating Razz + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 488($sp) # internal_47 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_47 = internal_49 + lw $t0, 468($sp) + sw $t0, 476($sp) + + # Jumping to branch_end_8744937301489 + j branch_end_8744937301489 + + branch_Razz_8744937301489: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 484($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 680($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 484($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bar li $v0, 9 - lw $a0, type_Razz + lw $a0, type_Bar syscall - la $t0, type_Razz # $t0 = address of the type + la $t0, type_Bar # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 224($sp) # internal_73 = address of allocated object Razz + sw $v0, 460($sp) # internal_51 = address of allocated object Bar # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_73 - lw $t0, 232($sp) - sw $t0, 0($sp) # Storing internal_73 + # Argument internal_51 + lw $t0, 468($sp) + sw $t0, 0($sp) # Storing internal_51 - # Calling function function___init___at_Razz - jal function___init___at_Razz + # Calling function function___init___at_Bar + jal function___init___at_Bar lw $ra, 4($sp) - sw $v1, 232($sp) # internal_73 = result of function___init___at_Razz + sw $v1, 468($sp) # internal_51 = result of function___init___at_Bar addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 224($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 240($sp) - j end_assign - not_is_Bool_or_Int: - # internal_69 = internal_73 - lw $t0, 224($sp) - sw $t0, 240($sp) - end_assign: - - # Jumping to branch_end_8779768552376 - j branch_end_8779768552376 - - branch_Bar_8779768552376: - - lw $t0, 388($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 240($sp) - j end_assign - not_is_Bool_or_Int: - # internal_69 = n - lw $t0, 388($sp) - sw $t0, 240($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Jumping to branch_end_8779768552376 - j branch_end_8779768552376 + # Argument internal_47 + lw $t0, 488($sp) + sw $t0, 4($sp) # Storing internal_47 - error_branch_8779768552376: + # Argument internal_51 + lw $t0, 472($sp) + sw $t0, 0($sp) # Storing internal_51 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 488($sp) # internal_47 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - branch_end_8779768552376: + # internal_47 = internal_51 + lw $t0, 460($sp) + sw $t0, 476($sp) - # Set attribute a of self - lw $t0, 520($sp) # $t0 = self - lw $t1, 240($sp) # $t1 = internal_69 - sw $t1, 20($t0) # self.a = internal_69 + # Jumping to branch_end_8744937301489 + j branch_end_8744937301489 - # Get attribute a of self - lw $t0, 520($sp) # Get the address of self - lw $t1, 20($t0) # Get the attribute 'a' from the instance - sw $t1, 216($sp) # internal_75 = a + branch_Foo_8744937301489: # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Argument internal_75 - lw $t0, 224($sp) - sw $t0, 0($sp) # Storing internal_75 + # Argument n + lw $t0, 484($sp) + sw $t0, 4($sp) # Storing n - # Calling function function_doh_at_Foo - jal function_doh_at_Foo - lw $ra, 4($sp) - sw $v1, 220($sp) # internal_76 = result of function_doh_at_Foo - addi $sp, $sp, 8 # Freeing space for arguments + # Argument self + lw $t0, 680($sp) + sw $t0, 0($sp) # Storing self - # Get attribute g of self - lw $t0, 520($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'g' from the instance - sw $t1, 208($sp) # internal_77 = g + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 484($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Razz + li $v0, 9 + lw $a0, type_Razz + syscall + la $t0, type_Razz # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 452($sp) # internal_53 = address of allocated object Razz # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_77 - lw $t0, 216($sp) - sw $t0, 0($sp) # Storing internal_77 + # Argument internal_53 + lw $t0, 460($sp) + sw $t0, 0($sp) # Storing internal_53 - # Calling function function_doh_at_Foo - jal function_doh_at_Foo + # Calling function function___init___at_Razz + jal function___init___at_Razz lw $ra, 4($sp) - sw $v1, 212($sp) # internal_78 = result of function_doh_at_Foo + sw $v1, 460($sp) # internal_53 = result of function___init___at_Razz addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_76 - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing internal_76 + # Argument internal_47 + lw $t0, 488($sp) + sw $t0, 4($sp) # Storing internal_47 - # Argument internal_78 - lw $t0, 216($sp) - sw $t0, 0($sp) # Storing internal_78 + # Argument internal_53 + lw $t0, 464($sp) + sw $t0, 0($sp) # Storing internal_53 - # Calling function function_add - jal function_add + # Calling function function_assign + jal function_assign lw $ra, 8($sp) - sw $v1, 212($sp) # internal_79 = result of function_add + sw $v1, 488($sp) # internal_47 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments + # internal_47 = internal_53 + lw $t0, 452($sp) + sw $t0, 476($sp) + + # Jumping to branch_end_8744937301489 + j branch_end_8744937301489 + + branch_Bar_8744937301489: + # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 484($sp) + sw $t0, 4($sp) # Storing n # Argument self - lw $t0, 528($sp) + lw $t0, 680($sp) sw $t0, 0($sp) # Storing self - # Calling function function_doh_at_Foo - jal function_doh_at_Foo - lw $ra, 4($sp) - sw $v1, 204($sp) # internal_80 = result of function_doh_at_Foo - addi $sp, $sp, 8 # Freeing space for arguments + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 484($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_79 - lw $t0, 212($sp) - sw $t0, 4($sp) # Storing internal_79 + # Argument internal_47 + lw $t0, 488($sp) + sw $t0, 4($sp) # Storing internal_47 - # Argument internal_80 - lw $t0, 208($sp) - sw $t0, 0($sp) # Storing internal_80 + # Argument n + lw $t0, 484($sp) + sw $t0, 0($sp) # Storing n - # Calling function function_add - jal function_add + # Calling function function_assign + jal function_assign lw $ra, 8($sp) - sw $v1, 204($sp) # internal_81 = result of function_add + sw $v1, 488($sp) # internal_47 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments + # internal_47 = n + lw $t0, 472($sp) + sw $t0, 476($sp) + + # Jumping to branch_end_8744937301489 + j branch_end_8744937301489 + + error_branch_8744937301489: + + branch_end_8744937301489: + + # Set attribute g of self + lw $t0, 668($sp) # $t0 = self + lw $t1, 476($sp) # $t1 = internal_47 + beq $t1, $zero, object_set_attribute_8744937275721 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937275721 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937275721 + j object_set_attribute_8744937275721 + int_set_attribute_8744937275721: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.g = internal_47 + j end_set_attribute_8744937275721 + bool_set_attribute_8744937275721: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.g = internal_47 + j end_set_attribute_8744937275721 + object_set_attribute_8744937275721: + sw $t1, 12($t0) # self.g = internal_47 + end_set_attribute_8744937275721: + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 528($sp) + lw $t0, 676($sp) sw $t0, 0($sp) # Storing self # Calling function function_printh_at_Bazz jal function_printh_at_Bazz lw $ra, 4($sp) - sw $v1, 196($sp) # internal_82 = result of function_printh_at_Bazz + sw $v1, 452($sp) # internal_55 = result of function_printh_at_Bazz addi $sp, $sp, 8 # Freeing space for arguments - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_81 - lw $t0, 204($sp) - sw $t0, 4($sp) # Storing internal_81 - - # Argument internal_82 - lw $t0, 200($sp) - sw $t0, 0($sp) # Storing internal_82 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 196($sp) # internal_83 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments + # Set attribute i of self + lw $t0, 668($sp) # $t0 = self + lw $t1, 444($sp) # $t1 = internal_55 + beq $t1, $zero, object_set_attribute_8744937275694 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937275694 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937275694 + j object_set_attribute_8744937275694 + int_set_attribute_8744937275694: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.i = internal_55 + j end_set_attribute_8744937275694 + bool_set_attribute_8744937275694: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.i = internal_55 + j end_set_attribute_8744937275694 + object_set_attribute_8744937275694: + sw $t1, 16($t0) # self.i = internal_55 + end_set_attribute_8744937275694: - # Set attribute b of self - lw $t0, 520($sp) # $t0 = self - lw $t1, 184($sp) # $t1 = internal_83 - sw $t1, 24($t0) # self.b = internal_83 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 440($sp) # internal_56 = address of allocated object Int + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 436($sp) # internal_57 = address of allocated object Int + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 432($sp) # internal_58 = address of allocated object Int + # Allocating NUll to internal_59 + sw $zero, 428($sp) # internal_59 = 0 # Allocating Int 0 li $v0, 9 @@ -3592,7 +10817,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 160($sp) # internal_89 = address of allocated object Int + sw $v0, 424($sp) # internal_60 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -3604,661 +10829,822 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 168($sp) # internal_87 = address of allocated object Int + sw $v0, 412($sp) # internal_63 = address of allocated object Int + # internal_61 = typeof self that is the first word of the object + lw $t0, 668($sp) + lw $t0, 0($t0) + sw $t0, 420($sp) + # internal_62 = internal_61 + lw $t0, 420($sp) + sw $t0, 416($sp) + while_start_8744937325815: - # internal_85 = typeof self that is the first word of the object - lw $t0, 520($sp) - lw $t1, 0($t0) - sw $t1, 176($sp) + # internal_63 = EqualAddress(internal_62, internal_59) + lw $t0, 416($sp) + lw $t1, 428($sp) + seq $t2, $t0, $t1 + lw $t0, 412($sp) + sw $t2, 8($t0) - lw $t0, 176($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 172($sp) - j end_assign - not_is_Bool_or_Int: - # internal_86 = internal_85 - lw $t0, 176($sp) - sw $t0, 172($sp) - end_assign: + # If internal_63 then goto while_end_8744937325815 + lw $t0, 412($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8744937325815 - lw $t0, 160($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 180($sp) - j end_assign - not_is_Bool_or_Int: - # internal_84 = internal_89 - lw $t0, 160($sp) - sw $t0, 180($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - while_start_8779768528207: + # Argument internal_60 + lw $t0, 436($sp) + sw $t0, 4($sp) # Storing internal_60 - # Equal operation - lw $t0, 172($sp) # Save in $t0 the left operand address - # If internal_87 then goto while_end_8779768528207 - lw $t0, 168($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_end_8779768528207 + # Argument internal_57 + lw $t0, 448($sp) + sw $t0, 0($sp) # Storing internal_57 - # Addition operation - lw $t0, 180($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # internal_86 = ancestor of internal_86 that is the first word of the object - lw $t0, 172($sp) - lw $t1, 4($t0) - sw $t1, 172($sp) + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 436($sp) # internal_60 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_62 = ancestor of internal_62 + lw $t0, 416($sp) + lw $t0, 4($t0) + sw $t0, 416($sp) - # Jumping to while_start_8779768528207 - j while_start_8779768528207 + # Jumping to while_start_8744937325815 + j while_start_8744937325815 - while_end_8779768528207: + while_end_8744937325815: + # internal_62 = internal_61 + lw $t0, 420($sp) + sw $t0, 416($sp) + + # initialize Array [internal_60] + lw $t0, 424($sp) # $t0 = internal_60 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 408($sp) # internal_64 = new Array[internal_60] + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 404($sp) # internal_65 = address of allocated object Int - lw $t0, 176($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 172($sp) - j end_assign - not_is_Bool_or_Int: - # internal_86 = internal_85 - lw $t0, 176($sp) - sw $t0, 172($sp) - end_assign: + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 400($sp) # internal_66 = address of allocated object Int - foreach_start_8779768528207: + foreach_start_8744937325815: - # Less than operation - lw $t0, 152($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 180($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - lw $t0, 148($sp) # $t0 = internal_92 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Argument internal_65 + lw $t0, 416($sp) + sw $t0, 4($sp) # Storing internal_65 - # If internal_92 then goto foreach_body_8779768528207 - lw $t0, 148($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_body_8779768528207 + # Argument internal_60 + lw $t0, 436($sp) + sw $t0, 0($sp) # Storing internal_60 - # Jumping to foreach_end_8779768528207 - j foreach_end_8779768528207 + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 412($sp) # internal_66 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - foreach_body_8779768528207: + # If internal_66 then goto foreach_body_8744937325815 + lw $t0, 400($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8744937325815 + # Jumping to foreach_end_8744937325815 + j foreach_end_8744937325815 - # internal_86 = ancestor of internal_86 that is the first word of the object - lw $t0, 172($sp) - lw $t1, 4($t0) - sw $t1, 172($sp) + foreach_body_8744937325815: - # Addition operation - lw $t0, 152($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_start_8779768528207 - j foreach_start_8779768528207 + # array internal_64[4 * internal_65] = internal_62 + lw $t0, 404($sp) # $t0 = internal_65 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 408($sp) # $t1 = internal_64 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 416($sp) + sw $t0, 0($t1) - foreach_end_8779768528207: + # internal_62 = ancestor of internal_62 + lw $t0, 416($sp) + lw $t0, 4($t0) + sw $t0, 416($sp) + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_65 + lw $t0, 416($sp) + sw $t0, 4($sp) # Storing internal_65 + # Argument internal_57 + lw $t0, 448($sp) + sw $t0, 0($sp) # Storing internal_57 + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 416($sp) # internal_65 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + # Jumping to foreach_start_8744937325815 + j foreach_start_8744937325815 - # internal_95 = direction of Razz - la $t0, type_Razz - sw $t0, 136($sp) + foreach_end_8744937325815: + # initialize Array [internal_58] + lw $t0, 432($sp) # $t0 = internal_58 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 396($sp) # internal_67 = new Array[internal_58] + + # initialize Array [internal_58] + lw $t0, 432($sp) # $t0 = internal_58 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 392($sp) # internal_68 = new Array[internal_58] + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # internal_96 = direction of Bar - la $t0, type_Bar - sw $t0, 132($sp) + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 384($sp) # internal_70 = address of allocated object Int + # internal_69 = direction of Razz + la $t0, type_Razz + sw $t0, 388($sp) + + # array internal_67[4 * internal_70] = internal_69 + lw $t0, 384($sp) # $t0 = internal_70 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 396($sp) # $t1 = internal_67 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 388($sp) + sw $t0, 0($t1) + + # array internal_68[4 * internal_70] = internal_60 + lw $t0, 384($sp) # $t0 = internal_70 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 392($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 424($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 376($sp) # internal_72 = address of allocated object Int + # internal_71 = direction of Foo + la $t0, type_Foo + sw $t0, 380($sp) + + # array internal_67[4 * internal_72] = internal_71 + lw $t0, 376($sp) # $t0 = internal_72 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 396($sp) # $t1 = internal_67 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 380($sp) + sw $t0, 0($t1) + + # array internal_68[4 * internal_72] = internal_60 + lw $t0, 376($sp) # $t0 = internal_72 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 392($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 424($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall - foreach_type_start_8779768528207: + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 368($sp) # internal_74 = address of allocated object Int - # Less than operation - lw $t0, 128($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # If internal_98 then goto foreach_type_body_8779768528207 - lw $t0, 124($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_type_body_8779768528207 + # internal_73 = direction of Bar + la $t0, type_Bar + sw $t0, 372($sp) + + # array internal_67[4 * internal_74] = internal_73 + lw $t0, 368($sp) # $t0 = internal_74 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 396($sp) # $t1 = internal_67 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 372($sp) + sw $t0, 0($t1) + + # array internal_68[4 * internal_74] = internal_60 + lw $t0, 368($sp) # $t0 = internal_74 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 392($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 424($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # Jumping to foreach_type_end_8779768528207 - j foreach_type_end_8779768528207 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - foreach_type_body_8779768528207: + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 364($sp) # internal_75 = address of allocated object Int + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 360($sp) # internal_76 = address of allocated object Int + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 352($sp) # internal_78 = address of allocated object Int - foreach_ancestor_start_8779768528207: + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Less than operation - lw $t0, 116($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 180($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 348($sp) # internal_79 = address of allocated object Int - lw $t0, 112($sp) # $t0 = internal_101 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # If internal_101 then goto foreach_ancestor_body_8779768528207 - lw $t0, 112($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_body_8779768528207 + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 340($sp) # internal_81 = address of allocated object Int - # Jumping to foreach_ancestor_end_8779768528207 - j foreach_ancestor_end_8779768528207 + foreach_type_start_8744937325815: - foreach_ancestor_body_8779768528207: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_75 + lw $t0, 376($sp) + sw $t0, 4($sp) # Storing internal_75 - # Equal operation - lw $t0, 120($sp) # Save in $t0 the left operand address - lw $t1, 108($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + # Argument internal_58 + lw $t0, 444($sp) + sw $t0, 0($sp) # Storing internal_58 - lw $t0, 104($sp) # $t0 = internal_103 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 372($sp) # internal_76 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - # If internal_103 then goto foreach_ancestor_end_8779768528207 - lw $t0, 104($sp) # Loading the address of the condition + # If internal_76 then goto foreach_type_body_8744937325815 + lw $t0, 360($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_end_8779768528207 - - # Addition operation - lw $t0, 116($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_ancestor_start_8779768528207 - j foreach_ancestor_start_8779768528207 - - foreach_ancestor_end_8779768528207: + beq $t0, $t1, foreach_type_body_8744937325815 + # Jumping to foreach_type_end_8744937325815 + j foreach_type_end_8744937325815 + foreach_type_body_8744937325815: + # internal_77 = array internal_67[4 * internal_75] + lw $t0, 364($sp) # $t0 = internal_75 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 396($sp) # $t1 = internal_67 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 356($sp) # internal_77 = array internal_67[4 * internal_75] + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Addition operation - lw $t0, 128($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_type_start_8779768528207 - j foreach_type_start_8779768528207 - - foreach_type_end_8779768528207: - + # Argument internal_78 + lw $t0, 364($sp) + sw $t0, 4($sp) # Storing internal_78 + # Argument internal_56 + lw $t0, 452($sp) + sw $t0, 0($sp) # Storing internal_56 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 364($sp) # internal_78 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + foreach_ancestor_start_8744937325815: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_78 + lw $t0, 364($sp) + sw $t0, 4($sp) # Storing internal_78 - lw $t0, 180($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 88($sp) - j end_assign - not_is_Bool_or_Int: - # internal_107 = internal_84 - lw $t0, 180($sp) - sw $t0, 88($sp) - end_assign: + # Argument internal_60 + lw $t0, 436($sp) + sw $t0, 0($sp) # Storing internal_60 - foreach_min_start_8779768528207: + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 360($sp) # internal_79 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - # Less than operation - lw $t0, 100($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # If internal_108 then goto foreach_min_body_8779768528207 - lw $t0, 84($sp) # Loading the address of the condition + # If internal_79 then goto foreach_ancestor_body_8744937325815 + lw $t0, 348($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_min_body_8779768528207 - - # Jumping to foreach_min_end_8779768528207 - j foreach_min_end_8779768528207 + beq $t0, $t1, foreach_ancestor_body_8744937325815 - foreach_min_body_8779768528207: + # Jumping to foreach_ancestor_end_8744937325815 + j foreach_ancestor_end_8744937325815 + foreach_ancestor_body_8744937325815: - # Less than operation - lw $t0, 92($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 88($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + # internal_80 = array internal_64[4 * internal_78] + lw $t0, 352($sp) # $t0 = internal_78 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 408($sp) # $t1 = internal_64 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 344($sp) # internal_80 = array internal_64[4 * internal_78] - lw $t0, 84($sp) # $t0 = internal_108 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # internal_81 = EqualAddress(internal_77, internal_80) + lw $t0, 356($sp) + lw $t1, 344($sp) + seq $t2, $t0, $t1 + lw $t0, 340($sp) + sw $t2, 8($t0) - # If internal_108 then goto update_min_8779768528207 - lw $t0, 84($sp) # Loading the address of the condition + # If internal_81 then goto foreach_ancestor_end_8744937325815 + lw $t0, 340($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, update_min_8779768528207 - - # Jumping to foreach_min_end_8779768528207 - j foreach_min_end_8779768528207 - - update_min_8779768528207: - - lw $t0, 92($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 88($sp) - j end_assign - not_is_Bool_or_Int: - # internal_107 = internal_106 - lw $t0, 92($sp) - sw $t0, 88($sp) - end_assign: - - lw $t0, 100($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 96($sp) - j end_assign - not_is_Bool_or_Int: - # internal_105 = internal_104 - lw $t0, 100($sp) - sw $t0, 96($sp) - end_assign: - - update_min_end_8779768528207: - - # Addition operation - lw $t0, 100($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_min_start_8779768528207 - j foreach_min_start_8779768528207 - - foreach_min_end_8779768528207: - - + beq $t0, $t1, foreach_ancestor_end_8744937325815 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_78 + lw $t0, 364($sp) + sw $t0, 4($sp) # Storing internal_78 + # Argument internal_57 + lw $t0, 448($sp) + sw $t0, 0($sp) # Storing internal_57 + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 364($sp) # internal_78 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - # Equal operation - lw $t0, 96($sp) # Save in $t0 the left operand address - lw $t1, 180($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + # Jumping to foreach_ancestor_start_8744937325815 + j foreach_ancestor_start_8744937325815 - lw $t0, 76($sp) # $t0 = internal_110 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + foreach_ancestor_end_8744937325815: - # If internal_110 then goto error_branch_8779768528207 - lw $t0, 76($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, error_branch_8779768528207 + # array internal_68[4 * internal_75] = internal_78 + lw $t0, 364($sp) # $t0 = internal_75 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 392($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 352($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_75 + lw $t0, 376($sp) + sw $t0, 4($sp) # Storing internal_75 - # If internal_111 then goto branch_Razz_8779768528207 - lw $t0, 72($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Razz_8779768528207 + # Argument internal_57 + lw $t0, 448($sp) + sw $t0, 0($sp) # Storing internal_57 + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 376($sp) # internal_75 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - # If internal_111 then goto branch_Bar_8779768528207 - lw $t0, 72($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Bar_8779768528207 + # Jumping to foreach_type_start_8744937325815 + j foreach_type_start_8744937325815 - branch_Razz_8779768528207: + foreach_type_end_8744937325815: - # Allocating Bar + # Allocating String li $v0, 9 - lw $a0, type_Bar + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator syscall - la $t0, type_Bar # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 60($sp) # internal_114 = address of allocated object Bar - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - # Argument internal_114 - lw $t0, 68($sp) - sw $t0, 0($sp) # Storing internal_114 + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - # Calling function function___init___at_Bar - jal function___init___at_Bar - lw $ra, 4($sp) - sw $v1, 68($sp) # internal_114 = result of function___init___at_Bar - addi $sp, $sp, 8 # Freeing space for arguments + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_87[0] = '\n' - lw $t0, 60($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 68($sp) - j end_assign - not_is_Bool_or_Int: - # internal_112 = internal_114 - lw $t0, 60($sp) - sw $t0, 68($sp) - end_assign: + sb $zero, 9($v0) # Null-terminator at the end of the string - # Jumping to branch_end_8779768528207 - j branch_end_8779768528207 + sw $v0, 316($sp) # internal_87 = "\n" - branch_Bar_8779768528207: + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - lw $t0, 388($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 68($sp) - j end_assign - not_is_Bool_or_Int: - # internal_112 = n - lw $t0, 388($sp) - sw $t0, 68($sp) - end_assign: + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object - # Jumping to branch_end_8779768528207 - j branch_end_8779768528207 + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - error_branch_8779768528207: + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_88[0] = ' ' + sb $zero, 9($v0) # Null-terminator at the end of the string - branch_end_8779768528207: + sw $v0, 312($sp) # internal_88 = " " - # Set attribute e of self - lw $t0, 520($sp) # $t0 = self - lw $t1, 68($sp) # $t1 = internal_112 - sw $t1, 28($t0) # self.e = internal_112 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Get attribute a of self - lw $t0, 520($sp) # Get the address of self - lw $t1, 20($t0) # Get the attribute 'a' from the instance - sw $t1, 52($sp) # internal_116 = a + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 336($sp) # internal_82 = address of allocated object Int - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Argument internal_116 - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing internal_116 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 332($sp) # internal_83 = address of allocated object Int - # Calling function function_doh_at_Foo - jal function_doh_at_Foo - lw $ra, 4($sp) - sw $v1, 56($sp) # internal_117 = result of function_doh_at_Foo - addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Get attribute g of self - lw $t0, 520($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'g' from the instance - sw $t1, 44($sp) # internal_118 = g + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 328($sp) # internal_84 = address of allocated object Int - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Argument internal_118 - lw $t0, 52($sp) - sw $t0, 0($sp) # Storing internal_118 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 324($sp) # internal_85 = address of allocated object Int - # Calling function function_doh_at_Foo - jal function_doh_at_Foo - lw $ra, 4($sp) - sw $v1, 48($sp) # internal_119 = result of function_doh_at_Foo - addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 320($sp) # internal_86 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_117 - lw $t0, 60($sp) - sw $t0, 4($sp) # Storing internal_117 + # Argument internal_85 + lw $t0, 336($sp) + sw $t0, 4($sp) # Storing internal_85 - # Argument internal_119 - lw $t0, 52($sp) - sw $t0, 0($sp) # Storing internal_119 + # Argument internal_60 + lw $t0, 436($sp) + sw $t0, 0($sp) # Storing internal_60 - # Calling function function_add - jal function_add + # Calling function function_assign + jal function_assign lw $ra, 8($sp) - sw $v1, 48($sp) # internal_120 = result of function_add + sw $v1, 336($sp) # internal_85 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # Get attribute e of self - lw $t0, 520($sp) # Get the address of self - lw $t1, 28($t0) # Get the attribute 'e' from the instance - sw $t1, 32($sp) # internal_121 = e - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_121 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_121 - - # Calling function function_doh_at_Foo - jal function_doh_at_Foo - lw $ra, 4($sp) - sw $v1, 36($sp) # internal_122 = result of function_doh_at_Foo - addi $sp, $sp, 8 # Freeing space for arguments + foreach_min_start_8744937325815: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_120 - lw $t0, 48($sp) - sw $t0, 4($sp) # Storing internal_120 + # Argument internal_82 + lw $t0, 348($sp) + sw $t0, 4($sp) # Storing internal_82 - # Argument internal_122 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_122 + # Argument internal_58 + lw $t0, 444($sp) + sw $t0, 0($sp) # Storing internal_58 - # Calling function function_add - jal function_add + # Calling function function_less_than + jal function_less_than lw $ra, 8($sp) - sw $v1, 36($sp) # internal_123 = result of function_add + sw $v1, 332($sp) # internal_86 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + # If internal_86 then goto foreach_min_body_8744937325815 + lw $t0, 320($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8744937325815 - # Argument self - lw $t0, 528($sp) - sw $t0, 0($sp) # Storing self + # Jumping to foreach_min_end_8744937325815 + j foreach_min_end_8744937325815 - # Calling function function_doh_at_Foo - jal function_doh_at_Foo - lw $ra, 4($sp) - sw $v1, 28($sp) # internal_124 = result of function_doh_at_Foo - addi $sp, $sp, 8 # Freeing space for arguments + foreach_min_body_8744937325815: + + # internal_84 = array internal_68[4 * internal_82] + lw $t0, 336($sp) # $t0 = internal_82 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 392($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 328($sp) # internal_84 = array internal_68[4 * internal_82] + sw $t0, 8($t2) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_123 - lw $t0, 36($sp) - sw $t0, 4($sp) # Storing internal_123 + # Argument internal_84 + lw $t0, 340($sp) + sw $t0, 4($sp) # Storing internal_84 - # Argument internal_124 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_124 + # Argument internal_85 + lw $t0, 336($sp) + sw $t0, 0($sp) # Storing internal_85 - # Calling function function_add - jal function_add + # Calling function function_less_than + jal function_less_than lw $ra, 8($sp) - sw $v1, 28($sp) # internal_125 = result of function_add + sw $v1, 332($sp) # internal_86 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + # If internal_86 then goto update_min_8744937325815 + lw $t0, 320($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8744937325815 - # Argument self - lw $t0, 528($sp) - sw $t0, 0($sp) # Storing self + # Jumping to update_min_end_8744937325815 + j update_min_end_8744937325815 - # Calling function function_printh_at_Bazz - jal function_printh_at_Bazz - lw $ra, 4($sp) - sw $v1, 20($sp) # internal_126 = result of function_printh_at_Bazz - addi $sp, $sp, 8 # Freeing space for arguments + update_min_8744937325815: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_125 - lw $t0, 28($sp) - sw $t0, 4($sp) # Storing internal_125 + # Argument internal_85 + lw $t0, 336($sp) + sw $t0, 4($sp) # Storing internal_85 - # Argument internal_126 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_126 + # Argument internal_84 + lw $t0, 340($sp) + sw $t0, 0($sp) # Storing internal_84 - # Calling function function_add - jal function_add + # Calling function function_assign + jal function_assign lw $ra, 8($sp) - sw $v1, 20($sp) # internal_127 = result of function_add + sw $v1, 336($sp) # internal_85 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # Set attribute f of self - lw $t0, 520($sp) # $t0 = self - lw $t1, 8($sp) # $t1 = internal_127 - sw $t1, 32($t0) # self.f = internal_127 - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 528($sp) - sw $t0, 0($sp) # Storing self + # Argument internal_83 + lw $t0, 344($sp) + sw $t0, 4($sp) # Storing internal_83 - # Calling function function_doh_at_Foo - jal function_doh_at_Foo - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_128 = result of function_doh_at_Foo - addi $sp, $sp, 8 # Freeing space for arguments + # Argument internal_82 + lw $t0, 348($sp) + sw $t0, 0($sp) # Storing internal_82 - # Set attribute c of self - lw $t0, 520($sp) # $t0 = self - lw $t1, 4($sp) # $t1 = internal_128 - sw $t1, 36($t0) # self.c = internal_128 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 344($sp) # internal_83 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + update_min_end_8744937325815: # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Argument self - lw $t0, 528($sp) - sw $t0, 0($sp) # Storing self + # Argument internal_82 + lw $t0, 348($sp) + sw $t0, 4($sp) # Storing internal_82 - # Calling function function_printh_at_Bazz - jal function_printh_at_Bazz - lw $ra, 4($sp) - sw $v1, 8($sp) # internal_129 = result of function_printh_at_Bazz - addi $sp, $sp, 8 # Freeing space for arguments + # Argument internal_57 + lw $t0, 448($sp) + sw $t0, 0($sp) # Storing internal_57 - # Set attribute d of self - lw $t0, 520($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_129 - sw $t1, 40($t0) # self.d = internal_129 + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 348($sp) # internal_82 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - # Loading return value in $v1 - lw $v1, 520($sp) + # Jumping to foreach_min_start_8744937325815 + j foreach_min_start_8744937325815 - # Freeing space for local variables - addi $sp, $sp, 520 + foreach_min_end_8744937325815: - jr $ra + # initialize Array [internal_58] + lw $t0, 432($sp) # $t0 = internal_58 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 308($sp) # internal_89 = new Array[internal_58] - function___init___at_Razz: - # Function parameters - # $ra = 516($sp) - # self = 512($sp) + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Reserving space for local variables - addi $sp, $sp, -512 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 304($sp) # internal_90 = address of allocated object Int + + # array internal_89[4 * internal_90] = internal_56 + lw $t0, 304($sp) # $t0 = internal_90 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 308($sp) # $t1 = internal_89 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 440($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) # Allocating Int 1 li $v0, 9 @@ -4270,20 +11656,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 508($sp) # internal_0 = address of allocated object Int - - # Set attribute h of self - lw $t0, 512($sp) # $t0 = self - lw $t1, 508($sp) # $t1 = internal_0 - sw $t1, 8($t0) # self.h = internal_0 - - - - - - + sw $v0, 300($sp) # internal_91 = address of allocated object Int + + # array internal_89[4 * internal_91] = internal_56 + lw $t0, 300($sp) # $t0 = internal_91 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 308($sp) # $t1 = internal_89 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 440($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # Allocating Int 0 + # Allocating Int 2 li $v0, 9 addi $a0, $zero, 12 syscall @@ -4291,9 +11678,21 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 484($sp) # internal_6 = address of allocated object Int + sw $v0, 296($sp) # internal_92 = address of allocated object Int + + # array internal_89[4 * internal_92] = internal_56 + lw $t0, 296($sp) # $t0 = internal_92 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 308($sp) # $t1 = internal_89 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 440($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) # Allocating Bool 0 li $v0, 9 @@ -4305,588 +11704,934 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 492($sp) # internal_4 = address of allocated object Int - - + sw $v0, 292($sp) # internal_93 = address of allocated object Int + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # internal_2 = typeof self that is the first word of the object - lw $t0, 512($sp) - lw $t1, 0($t0) - sw $t1, 500($sp) - - lw $t0, 500($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 496($sp) - j end_assign - not_is_Bool_or_Int: - # internal_3 = internal_2 - lw $t0, 500($sp) - sw $t0, 496($sp) - end_assign: + # Argument internal_85 + lw $t0, 336($sp) + sw $t0, 4($sp) # Storing internal_85 - lw $t0, 484($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 504($sp) - j end_assign - not_is_Bool_or_Int: - # internal_1 = internal_6 - lw $t0, 484($sp) - sw $t0, 504($sp) - end_assign: + # Argument internal_60 + lw $t0, 436($sp) + sw $t0, 0($sp) # Storing internal_60 - while_start_8779768528306: + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 304($sp) # internal_93 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments - # Equal operation - lw $t0, 496($sp) # Save in $t0 the left operand address - # If internal_4 then goto while_end_8779768528306 - lw $t0, 492($sp) # Loading the address of the condition + # If internal_93 then goto error_branch_8744937325815 + lw $t0, 292($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_end_8779768528306 - - # Addition operation - lw $t0, 504($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # internal_3 = ancestor of internal_3 that is the first word of the object - lw $t0, 496($sp) - lw $t1, 4($t0) - sw $t1, 496($sp) - - # Jumping to while_start_8779768528306 - j while_start_8779768528306 - - while_end_8779768528306: - - - - - lw $t0, 500($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 496($sp) - j end_assign - not_is_Bool_or_Int: - # internal_3 = internal_2 - lw $t0, 500($sp) - sw $t0, 496($sp) - end_assign: - + beq $t0, $t1, error_branch_8744937325815 + + # array internal_89[4 * internal_83] = internal_57 + lw $t0, 332($sp) # $t0 = internal_83 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 308($sp) # $t1 = internal_89 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 436($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - foreach_start_8779768528306: + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Less than operation - lw $t0, 476($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 504($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 288($sp) # internal_94 = address of allocated object Int - lw $t0, 472($sp) # $t0 = internal_9 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # If internal_9 then goto foreach_body_8779768528306 - lw $t0, 472($sp) # Loading the address of the condition + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 284($sp) # internal_95 = address of allocated object Int + + # internal_94 = array internal_89[4 * internal_95] + lw $t0, 284($sp) # $t0 = internal_95 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 308($sp) # $t1 = internal_89 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 288($sp) # internal_94 = array internal_89[4 * internal_95] + sw $t0, 8($t2) + + # If internal_94 then goto branch_Razz_8744937325815 + lw $t0, 288($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_body_8779768528306 - - # Jumping to foreach_end_8779768528306 - j foreach_end_8779768528306 + beq $t0, $t1, branch_Razz_8744937325815 - foreach_body_8779768528306: + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 280($sp) # internal_96 = address of allocated object Int + + # internal_94 = array internal_89[4 * internal_96] + lw $t0, 280($sp) # $t0 = internal_96 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 308($sp) # $t1 = internal_89 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 288($sp) # internal_94 = array internal_89[4 * internal_96] + sw $t0, 8($t2) + + # If internal_94 then goto branch_Foo_8744937325815 + lw $t0, 288($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Foo_8744937325815 - # internal_3 = ancestor of internal_3 that is the first word of the object - lw $t0, 496($sp) - lw $t1, 4($t0) - sw $t1, 496($sp) + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Addition operation - lw $t0, 476($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_start_8779768528306 - j foreach_start_8779768528306 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 276($sp) # internal_97 = address of allocated object Int + + # internal_94 = array internal_89[4 * internal_97] + lw $t0, 276($sp) # $t0 = internal_97 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 308($sp) # $t1 = internal_89 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 288($sp) # internal_94 = array internal_89[4 * internal_97] + sw $t0, 8($t2) + + # If internal_94 then goto branch_Bar_8744937325815 + lw $t0, 288($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bar_8744937325815 - foreach_end_8779768528306: + branch_Razz_8744937325815: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument n + lw $t0, 484($sp) + sw $t0, 4($sp) # Storing n + # Argument self + lw $t0, 680($sp) + sw $t0, 0($sp) # Storing self + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 484($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Bar + li $v0, 9 + lw $a0, type_Bar + syscall + la $t0, type_Bar # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 264($sp) # internal_100 = address of allocated object Bar - # internal_12 = direction of Bazz - la $t0, type_Bazz - sw $t0, 460($sp) + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + # Argument internal_100 + lw $t0, 272($sp) + sw $t0, 0($sp) # Storing internal_100 + # Calling function function___init___at_Bar + jal function___init___at_Bar + lw $ra, 4($sp) + sw $v1, 272($sp) # internal_100 = result of function___init___at_Bar + addi $sp, $sp, 8 # Freeing space for arguments - # internal_13 = direction of Razz - la $t0, type_Razz - sw $t0, 456($sp) + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_98 + lw $t0, 284($sp) + sw $t0, 4($sp) # Storing internal_98 + # Argument internal_100 + lw $t0, 276($sp) + sw $t0, 0($sp) # Storing internal_100 - # internal_14 = direction of Foo - la $t0, type_Foo - sw $t0, 452($sp) + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 284($sp) # internal_98 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + # internal_98 = internal_100 + lw $t0, 264($sp) + sw $t0, 272($sp) + # Jumping to branch_end_8744937325815 + j branch_end_8744937325815 - # internal_15 = direction of Bar - la $t0, type_Bar - sw $t0, 448($sp) + branch_Foo_8744937325815: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument n + lw $t0, 484($sp) + sw $t0, 4($sp) # Storing n + # Argument self + lw $t0, 680($sp) + sw $t0, 0($sp) # Storing self + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 484($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Razz + li $v0, 9 + lw $a0, type_Razz + syscall + la $t0, type_Razz # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 256($sp) # internal_102 = address of allocated object Razz - foreach_type_start_8779768528306: + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - # Less than operation - lw $t0, 444($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # If internal_17 then goto foreach_type_body_8779768528306 - lw $t0, 440($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_type_body_8779768528306 + # Argument internal_102 + lw $t0, 264($sp) + sw $t0, 0($sp) # Storing internal_102 - # Jumping to foreach_type_end_8779768528306 - j foreach_type_end_8779768528306 + # Calling function function___init___at_Razz + jal function___init___at_Razz + lw $ra, 4($sp) + sw $v1, 264($sp) # internal_102 = result of function___init___at_Razz + addi $sp, $sp, 8 # Freeing space for arguments - foreach_type_body_8779768528306: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_98 + lw $t0, 284($sp) + sw $t0, 4($sp) # Storing internal_98 + # Argument internal_102 + lw $t0, 268($sp) + sw $t0, 0($sp) # Storing internal_102 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 284($sp) # internal_98 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + # internal_98 = internal_102 + lw $t0, 256($sp) + sw $t0, 272($sp) - foreach_ancestor_start_8779768528306: + # Jumping to branch_end_8744937325815 + j branch_end_8744937325815 - # Less than operation - lw $t0, 432($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 504($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + branch_Bar_8744937325815: - lw $t0, 428($sp) # $t0 = internal_20 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # If internal_20 then goto foreach_ancestor_body_8779768528306 - lw $t0, 428($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_body_8779768528306 + # Argument n + lw $t0, 484($sp) + sw $t0, 4($sp) # Storing n - # Jumping to foreach_ancestor_end_8779768528306 - j foreach_ancestor_end_8779768528306 + # Argument self + lw $t0, 680($sp) + sw $t0, 0($sp) # Storing self - foreach_ancestor_body_8779768528306: + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 484($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Equal operation - lw $t0, 436($sp) # Save in $t0 the left operand address - lw $t1, 424($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + # Argument internal_98 + lw $t0, 284($sp) + sw $t0, 4($sp) # Storing internal_98 - lw $t0, 420($sp) # $t0 = internal_22 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Argument n + lw $t0, 484($sp) + sw $t0, 0($sp) # Storing n - # If internal_22 then goto foreach_ancestor_end_8779768528306 - lw $t0, 420($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_end_8779768528306 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 284($sp) # internal_98 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # Addition operation - lw $t0, 432($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_ancestor_start_8779768528306 - j foreach_ancestor_start_8779768528306 + # internal_98 = n + lw $t0, 472($sp) + sw $t0, 272($sp) - foreach_ancestor_end_8779768528306: + # Jumping to branch_end_8744937325815 + j branch_end_8744937325815 + error_branch_8744937325815: + branch_end_8744937325815: + + # Set attribute a of self + lw $t0, 668($sp) # $t0 = self + lw $t1, 272($sp) # $t1 = internal_98 + beq $t1, $zero, object_set_attribute_8744937246805 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937246805 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937246805 + j object_set_attribute_8744937246805 + int_set_attribute_8744937246805: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.a = internal_98 + j end_set_attribute_8744937246805 + bool_set_attribute_8744937246805: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.a = internal_98 + j end_set_attribute_8744937246805 + object_set_attribute_8744937246805: + sw $t1, 20($t0) # self.a = internal_98 + end_set_attribute_8744937246805: + # Get attribute a of self + lw $t0, 668($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'a' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8744937250006 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8744937250006 + j object_get_attribute_8744937250006 + int_get_attribute_8744937250006: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 248($sp) # internal_104 = self.a + j end_get_attribute_8744937250006 + bool_get_attribute_8744937250006: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 248($sp) # internal_104 = self.a + j end_get_attribute_8744937250006 + object_get_attribute_8744937250006: + sw $t1, 248($sp) # internal_104 = a + end_get_attribute_8744937250006: + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - # Addition operation - lw $t0, 444($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_type_start_8779768528306 - j foreach_type_start_8779768528306 + # Argument internal_104 + lw $t0, 256($sp) + sw $t0, 0($sp) # Storing internal_104 - foreach_type_end_8779768528306: + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 252($sp) # internal_105 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + # Get attribute g of self + lw $t0, 668($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'g' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8744937250036 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8744937250036 + j object_get_attribute_8744937250036 + int_get_attribute_8744937250036: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 240($sp) # internal_106 = self.g + j end_get_attribute_8744937250036 + bool_get_attribute_8744937250036: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 240($sp) # internal_106 = self.g + j end_get_attribute_8744937250036 + object_get_attribute_8744937250036: + sw $t1, 240($sp) # internal_106 = g + end_get_attribute_8744937250036: + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + # Argument internal_106 + lw $t0, 248($sp) + sw $t0, 0($sp) # Storing internal_106 + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 244($sp) # internal_107 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_105 + lw $t0, 256($sp) + sw $t0, 4($sp) # Storing internal_105 - lw $t0, 504($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 404($sp) - j end_assign - not_is_Bool_or_Int: - # internal_26 = internal_1 - lw $t0, 504($sp) - sw $t0, 404($sp) - end_assign: + # Argument internal_107 + lw $t0, 248($sp) + sw $t0, 0($sp) # Storing internal_107 - foreach_min_start_8779768528306: + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 244($sp) # internal_108 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - # Less than operation - lw $t0, 416($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # If internal_27 then goto foreach_min_body_8779768528306 - lw $t0, 400($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_min_body_8779768528306 + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - # Jumping to foreach_min_end_8779768528306 - j foreach_min_end_8779768528306 + # Argument self + lw $t0, 676($sp) + sw $t0, 0($sp) # Storing self - foreach_min_body_8779768528306: + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 236($sp) # internal_109 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Less than operation - lw $t0, 408($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 404($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + # Argument internal_108 + lw $t0, 244($sp) + sw $t0, 4($sp) # Storing internal_108 - lw $t0, 400($sp) # $t0 = internal_27 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Argument internal_109 + lw $t0, 240($sp) + sw $t0, 0($sp) # Storing internal_109 - # If internal_27 then goto update_min_8779768528306 - lw $t0, 400($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, update_min_8779768528306 - - # Jumping to foreach_min_end_8779768528306 - j foreach_min_end_8779768528306 - - update_min_8779768528306: - - lw $t0, 408($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 404($sp) - j end_assign - not_is_Bool_or_Int: - # internal_26 = internal_25 - lw $t0, 408($sp) - sw $t0, 404($sp) - end_assign: + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 236($sp) # internal_110 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 416($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 412($sp) - j end_assign - not_is_Bool_or_Int: - # internal_24 = internal_23 - lw $t0, 416($sp) - sw $t0, 412($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address - update_min_end_8779768528306: + # Argument self + lw $t0, 676($sp) + sw $t0, 0($sp) # Storing self - # Addition operation - lw $t0, 416($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_min_start_8779768528306 - j foreach_min_start_8779768528306 + # Calling function function_printh_at_Bazz + jal function_printh_at_Bazz + lw $ra, 4($sp) + sw $v1, 228($sp) # internal_111 = result of function_printh_at_Bazz + addi $sp, $sp, 8 # Freeing space for arguments - foreach_min_end_8779768528306: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_110 + lw $t0, 236($sp) + sw $t0, 4($sp) # Storing internal_110 + # Argument internal_111 + lw $t0, 232($sp) + sw $t0, 0($sp) # Storing internal_111 + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 228($sp) # internal_112 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + # Set attribute b of self + lw $t0, 668($sp) # $t0 = self + lw $t1, 216($sp) # $t1 = internal_112 + beq $t1, $zero, object_set_attribute_8744937249946 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937249946 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937249946 + j object_set_attribute_8744937249946 + int_set_attribute_8744937249946: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($t0) # self.b = internal_112 + j end_set_attribute_8744937249946 + bool_set_attribute_8744937249946: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($t0) # self.b = internal_112 + j end_set_attribute_8744937249946 + object_set_attribute_8744937249946: + sw $t1, 24($t0) # self.b = internal_112 + end_set_attribute_8744937249946: + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 212($sp) # internal_113 = address of allocated object Int + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 208($sp) # internal_114 = address of allocated object Int - # Equal operation - lw $t0, 412($sp) # Save in $t0 the left operand address - lw $t1, 504($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall - lw $t0, 392($sp) # $t0 = internal_29 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 204($sp) # internal_115 = address of allocated object Int - # If internal_29 then goto error_branch_8779768528306 - lw $t0, 392($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, error_branch_8779768528306 + # Allocating NUll to internal_116 + sw $zero, 200($sp) # internal_116 = 0 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 196($sp) # internal_117 = address of allocated object Int - # If internal_30 then goto branch_Bazz_8779768528306 - lw $t0, 388($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Bazz_8779768528306 + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 184($sp) # internal_120 = address of allocated object Int - # If internal_30 then goto branch_Razz_8779768528306 - lw $t0, 388($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Razz_8779768528306 + # internal_118 = typeof self that is the first word of the object + lw $t0, 668($sp) + lw $t0, 0($t0) + sw $t0, 192($sp) + # internal_119 = internal_118 + lw $t0, 192($sp) + sw $t0, 188($sp) - # If internal_30 then goto branch_Foo_8779768528306 - lw $t0, 388($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Foo_8779768528306 + while_start_8744937301390: + # internal_120 = EqualAddress(internal_119, internal_116) + lw $t0, 188($sp) + lw $t1, 200($sp) + seq $t2, $t0, $t1 + lw $t0, 184($sp) + sw $t2, 8($t0) - # If internal_30 then goto branch_Bar_8779768528306 - lw $t0, 388($sp) # Loading the address of the condition + # If internal_120 then goto while_end_8744937301390 + lw $t0, 184($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Bar_8779768528306 + beq $t0, $t1, while_end_8744937301390 - branch_Bazz_8779768528306: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Allocating Foo - li $v0, 9 - lw $a0, type_Foo - syscall - la $t0, type_Foo # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 376($sp) # internal_33 = address of allocated object Foo + # Argument internal_117 + lw $t0, 208($sp) + sw $t0, 4($sp) # Storing internal_117 - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + # Argument internal_114 + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing internal_114 - # Argument internal_33 - lw $t0, 384($sp) - sw $t0, 0($sp) # Storing internal_33 + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 208($sp) # internal_117 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - # Calling function function___init___at_Foo - jal function___init___at_Foo - lw $ra, 4($sp) - sw $v1, 384($sp) # internal_33 = result of function___init___at_Foo - addi $sp, $sp, 8 # Freeing space for arguments + # internal_119 = ancestor of internal_119 + lw $t0, 188($sp) + lw $t0, 4($t0) + sw $t0, 188($sp) - lw $t0, 376($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 384($sp) - j end_assign - not_is_Bool_or_Int: - # internal_31 = internal_33 - lw $t0, 376($sp) - sw $t0, 384($sp) - end_assign: + # Jumping to while_start_8744937301390 + j while_start_8744937301390 - # Jumping to branch_end_8779768528306 - j branch_end_8779768528306 + while_end_8744937301390: - branch_Razz_8779768528306: + # internal_119 = internal_118 + lw $t0, 192($sp) + sw $t0, 188($sp) + + # initialize Array [internal_117] + lw $t0, 196($sp) # $t0 = internal_117 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 180($sp) # internal_121 = new Array[internal_117] - # Allocating Bar + # Allocating Int 0 li $v0, 9 - lw $a0, type_Bar + addi $a0, $zero, 12 syscall - la $t0, type_Bar # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 368($sp) # internal_35 = address of allocated object Bar - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 176($sp) # internal_122 = address of allocated object Int - # Argument internal_35 - lw $t0, 376($sp) - sw $t0, 0($sp) # Storing internal_35 + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Calling function function___init___at_Bar - jal function___init___at_Bar - lw $ra, 4($sp) - sw $v1, 376($sp) # internal_35 = result of function___init___at_Bar - addi $sp, $sp, 8 # Freeing space for arguments + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 172($sp) # internal_123 = address of allocated object Int - lw $t0, 368($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 384($sp) - j end_assign - not_is_Bool_or_Int: - # internal_31 = internal_35 - lw $t0, 368($sp) - sw $t0, 384($sp) - end_assign: + foreach_start_8744937301390: - # Jumping to branch_end_8779768528306 - j branch_end_8779768528306 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - branch_Foo_8779768528306: + # Argument internal_122 + lw $t0, 188($sp) + sw $t0, 4($sp) # Storing internal_122 - # Allocating Razz - li $v0, 9 - lw $a0, type_Razz - syscall - la $t0, type_Razz # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 360($sp) # internal_37 = address of allocated object Razz + # Argument internal_117 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_117 - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 184($sp) # internal_123 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - # Argument internal_37 - lw $t0, 368($sp) - sw $t0, 0($sp) # Storing internal_37 + # If internal_123 then goto foreach_body_8744937301390 + lw $t0, 172($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8744937301390 - # Calling function function___init___at_Razz - jal function___init___at_Razz - lw $ra, 4($sp) - sw $v1, 368($sp) # internal_37 = result of function___init___at_Razz - addi $sp, $sp, 8 # Freeing space for arguments + # Jumping to foreach_end_8744937301390 + j foreach_end_8744937301390 - lw $t0, 360($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 384($sp) - j end_assign - not_is_Bool_or_Int: - # internal_31 = internal_37 - lw $t0, 360($sp) - sw $t0, 384($sp) - end_assign: + foreach_body_8744937301390: - # Jumping to branch_end_8779768528306 - j branch_end_8779768528306 + # array internal_121[4 * internal_122] = internal_119 + lw $t0, 176($sp) # $t0 = internal_122 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 180($sp) # $t1 = internal_121 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 188($sp) + sw $t0, 0($t1) - branch_Bar_8779768528306: + # internal_119 = ancestor of internal_119 + lw $t0, 188($sp) + lw $t0, 4($t0) + sw $t0, 188($sp) - lw $t0, 380($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 384($sp) - j end_assign - not_is_Bool_or_Int: - # internal_31 = n - lw $t0, 380($sp) - sw $t0, 384($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Jumping to branch_end_8779768528306 - j branch_end_8779768528306 + # Argument internal_122 + lw $t0, 188($sp) + sw $t0, 4($sp) # Storing internal_122 - error_branch_8779768528306: + # Argument internal_114 + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing internal_114 + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 188($sp) # internal_122 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - branch_end_8779768528306: + # Jumping to foreach_start_8744937301390 + j foreach_start_8744937301390 - # Set attribute g of self - lw $t0, 512($sp) # $t0 = self - lw $t1, 384($sp) # $t1 = internal_31 - sw $t1, 12($t0) # self.g = internal_31 + foreach_end_8744937301390: - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + # initialize Array [internal_115] + lw $t0, 204($sp) # $t0 = internal_115 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 168($sp) # internal_124 = new Array[internal_115] + + # initialize Array [internal_115] + lw $t0, 204($sp) # $t0 = internal_115 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 164($sp) # internal_125 = new Array[internal_115] - # Argument self - lw $t0, 520($sp) - sw $t0, 0($sp) # Storing self + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Calling function function_printh_at_Bazz - jal function_printh_at_Bazz - lw $ra, 4($sp) - sw $v1, 360($sp) # internal_39 = result of function_printh_at_Bazz - addi $sp, $sp, 8 # Freeing space for arguments + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 156($sp) # internal_127 = address of allocated object Int - # Set attribute i of self - lw $t0, 512($sp) # $t0 = self - lw $t1, 352($sp) # $t1 = internal_39 - sw $t1, 16($t0) # self.i = internal_39 + # internal_126 = direction of Razz + la $t0, type_Razz + sw $t0, 160($sp) + + # array internal_124[4 * internal_127] = internal_126 + lw $t0, 156($sp) # $t0 = internal_127 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 168($sp) # $t1 = internal_124 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 160($sp) + sw $t0, 0($t1) + + # array internal_125[4 * internal_127] = internal_117 + lw $t0, 156($sp) # $t0 = internal_127 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 164($sp) # $t1 = internal_125 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 196($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 148($sp) # internal_129 = address of allocated object Int + # internal_128 = direction of Bar + la $t0, type_Bar + sw $t0, 152($sp) + # array internal_124[4 * internal_129] = internal_128 + lw $t0, 148($sp) # $t0 = internal_129 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 168($sp) # $t1 = internal_124 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 152($sp) + sw $t0, 0($t1) + + # array internal_125[4 * internal_129] = internal_117 + lw $t0, 148($sp) # $t0 = internal_129 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 164($sp) # $t1 = internal_125 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 196($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_130 = address of allocated object Int + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 140($sp) # internal_131 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -4898,7 +12643,19 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 328($sp) # internal_45 = address of allocated object Int + sw $v0, 132($sp) # internal_133 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_134 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -4910,384 +12667,626 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 336($sp) # internal_43 = address of allocated object Int + sw $v0, 120($sp) # internal_136 = address of allocated object Int + foreach_type_start_8744937301390: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_130 + lw $t0, 156($sp) + sw $t0, 4($sp) # Storing internal_130 - # internal_41 = typeof self that is the first word of the object - lw $t0, 512($sp) - lw $t1, 0($t0) - sw $t1, 344($sp) + # Argument internal_115 + lw $t0, 216($sp) + sw $t0, 0($sp) # Storing internal_115 - lw $t0, 344($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 340($sp) - j end_assign - not_is_Bool_or_Int: - # internal_42 = internal_41 - lw $t0, 344($sp) - sw $t0, 340($sp) - end_assign: - - lw $t0, 328($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 348($sp) - j end_assign - not_is_Bool_or_Int: - # internal_40 = internal_45 - lw $t0, 328($sp) - sw $t0, 348($sp) - end_assign: - - while_start_8779768552376: + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 152($sp) # internal_131 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - # Equal operation - lw $t0, 340($sp) # Save in $t0 the left operand address - # If internal_43 then goto while_end_8779768552376 - lw $t0, 336($sp) # Loading the address of the condition + # If internal_131 then goto foreach_type_body_8744937301390 + lw $t0, 140($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_end_8779768552376 + beq $t0, $t1, foreach_type_body_8744937301390 - # Addition operation - lw $t0, 348($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # internal_42 = ancestor of internal_42 that is the first word of the object - lw $t0, 340($sp) - lw $t1, 4($t0) - sw $t1, 340($sp) + # Jumping to foreach_type_end_8744937301390 + j foreach_type_end_8744937301390 - # Jumping to while_start_8779768552376 - j while_start_8779768552376 + foreach_type_body_8744937301390: - while_end_8779768552376: + # internal_132 = array internal_124[4 * internal_130] + lw $t0, 144($sp) # $t0 = internal_130 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 168($sp) # $t1 = internal_124 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 136($sp) # internal_132 = array internal_124[4 * internal_130] + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_133 + lw $t0, 144($sp) + sw $t0, 4($sp) # Storing internal_133 + # Argument internal_113 + lw $t0, 224($sp) + sw $t0, 0($sp) # Storing internal_113 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 144($sp) # internal_133 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 344($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 340($sp) - j end_assign - not_is_Bool_or_Int: - # internal_42 = internal_41 - lw $t0, 344($sp) - sw $t0, 340($sp) - end_assign: + foreach_ancestor_start_8744937301390: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - foreach_start_8779768552376: + # Argument internal_133 + lw $t0, 144($sp) + sw $t0, 4($sp) # Storing internal_133 - # Less than operation - lw $t0, 320($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 348($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + # Argument internal_117 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_117 - lw $t0, 316($sp) # $t0 = internal_48 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 140($sp) # internal_134 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - # If internal_48 then goto foreach_body_8779768552376 - lw $t0, 316($sp) # Loading the address of the condition + # If internal_134 then goto foreach_ancestor_body_8744937301390 + lw $t0, 128($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_body_8779768552376 + beq $t0, $t1, foreach_ancestor_body_8744937301390 + + # Jumping to foreach_ancestor_end_8744937301390 + j foreach_ancestor_end_8744937301390 + + foreach_ancestor_body_8744937301390: + + # internal_135 = array internal_121[4 * internal_133] + lw $t0, 132($sp) # $t0 = internal_133 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 180($sp) # $t1 = internal_121 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 124($sp) # internal_135 = array internal_121[4 * internal_133] + + # internal_136 = EqualAddress(internal_132, internal_135) + lw $t0, 136($sp) + lw $t1, 124($sp) + seq $t2, $t0, $t1 + lw $t0, 120($sp) + sw $t2, 8($t0) - # Jumping to foreach_end_8779768552376 - j foreach_end_8779768552376 + # If internal_136 then goto foreach_ancestor_end_8744937301390 + lw $t0, 120($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8744937301390 - foreach_body_8779768552376: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_133 + lw $t0, 144($sp) + sw $t0, 4($sp) # Storing internal_133 - # internal_42 = ancestor of internal_42 that is the first word of the object - lw $t0, 340($sp) - lw $t1, 4($t0) - sw $t1, 340($sp) + # Argument internal_114 + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing internal_114 - # Addition operation - lw $t0, 320($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_start_8779768552376 - j foreach_start_8779768552376 + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 144($sp) # internal_133 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - foreach_end_8779768552376: + # Jumping to foreach_ancestor_start_8744937301390 + j foreach_ancestor_start_8744937301390 + foreach_ancestor_end_8744937301390: + # array internal_125[4 * internal_130] = internal_133 + lw $t0, 144($sp) # $t0 = internal_130 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 164($sp) # $t1 = internal_125 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 132($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_130 + lw $t0, 156($sp) + sw $t0, 4($sp) # Storing internal_130 + # Argument internal_114 + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing internal_114 - # internal_51 = direction of Razz - la $t0, type_Razz - sw $t0, 304($sp) + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 156($sp) # internal_130 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + # Jumping to foreach_type_start_8744937301390 + j foreach_type_start_8744937301390 + foreach_type_end_8744937301390: - # internal_52 = direction of Foo - la $t0, type_Foo - sw $t0, 300($sp) + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - # internal_53 = direction of Bar - la $t0, type_Bar - sw $t0, 296($sp) + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_142[0] = '\n' + sb $zero, 9($v0) # Null-terminator at the end of the string + sw $v0, 96($sp) # internal_142 = "\n" + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object - foreach_type_start_8779768552376: + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_143[0] = ' ' - # Less than operation - lw $t0, 292($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # If internal_55 then goto foreach_type_body_8779768552376 - lw $t0, 288($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_type_body_8779768552376 + sb $zero, 9($v0) # Null-terminator at the end of the string - # Jumping to foreach_type_end_8779768552376 - j foreach_type_end_8779768552376 + sw $v0, 92($sp) # internal_143 = " " - foreach_type_body_8779768552376: + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 116($sp) # internal_137 = address of allocated object Int + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_138 = address of allocated object Int + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - foreach_ancestor_start_8779768552376: + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_139 = address of allocated object Int - # Less than operation - lw $t0, 280($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 348($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - lw $t0, 276($sp) # $t0 = internal_58 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_140 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_141 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_140 + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing internal_140 + + # Argument internal_117 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_117 - # If internal_58 then goto foreach_ancestor_body_8779768552376 - lw $t0, 276($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_body_8779768552376 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 116($sp) # internal_140 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_ancestor_end_8779768552376 - j foreach_ancestor_end_8779768552376 + foreach_min_start_8744937301390: - foreach_ancestor_body_8779768552376: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_137 + lw $t0, 128($sp) + sw $t0, 4($sp) # Storing internal_137 - # Equal operation - lw $t0, 284($sp) # Save in $t0 the left operand address - lw $t1, 272($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + # Argument internal_115 + lw $t0, 216($sp) + sw $t0, 0($sp) # Storing internal_115 - lw $t0, 268($sp) # $t0 = internal_60 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 112($sp) # internal_141 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - # If internal_60 then goto foreach_ancestor_end_8779768552376 - lw $t0, 268($sp) # Loading the address of the condition + # If internal_141 then goto foreach_min_body_8744937301390 + lw $t0, 100($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_end_8779768552376 - - # Addition operation - lw $t0, 280($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_ancestor_start_8779768552376 - j foreach_ancestor_start_8779768552376 - - foreach_ancestor_end_8779768552376: + beq $t0, $t1, foreach_min_body_8744937301390 + # Jumping to foreach_min_end_8744937301390 + j foreach_min_end_8744937301390 + foreach_min_body_8744937301390: + # internal_139 = array internal_125[4 * internal_137] + lw $t0, 116($sp) # $t0 = internal_137 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 164($sp) # $t1 = internal_125 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 108($sp) # internal_139 = array internal_125[4 * internal_137] + sw $t0, 8($t2) + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Addition operation - lw $t0, 292($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_type_start_8779768552376 - j foreach_type_start_8779768552376 - - foreach_type_end_8779768552376: + # Argument internal_139 + lw $t0, 120($sp) + sw $t0, 4($sp) # Storing internal_139 + # Argument internal_140 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_140 + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 112($sp) # internal_141 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + # If internal_141 then goto update_min_8744937301390 + lw $t0, 100($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8744937301390 + # Jumping to update_min_end_8744937301390 + j update_min_end_8744937301390 + update_min_8744937301390: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - lw $t0, 348($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 252($sp) - j end_assign - not_is_Bool_or_Int: - # internal_64 = internal_40 - lw $t0, 348($sp) - sw $t0, 252($sp) - end_assign: + # Argument internal_140 + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing internal_140 - foreach_min_start_8779768552376: + # Argument internal_139 + lw $t0, 120($sp) + sw $t0, 0($sp) # Storing internal_139 - # Less than operation - lw $t0, 264($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # If internal_65 then goto foreach_min_body_8779768552376 - lw $t0, 248($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_min_body_8779768552376 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 116($sp) # internal_140 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_min_end_8779768552376 - j foreach_min_end_8779768552376 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - foreach_min_body_8779768552376: + # Argument internal_138 + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing internal_138 + # Argument internal_137 + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing internal_137 - # Less than operation - lw $t0, 256($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 252($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 124($sp) # internal_138 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 248($sp) # $t0 = internal_65 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + update_min_end_8744937301390: - # If internal_65 then goto update_min_8779768552376 - lw $t0, 248($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, update_min_8779768552376 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Jumping to foreach_min_end_8779768552376 - j foreach_min_end_8779768552376 + # Argument internal_137 + lw $t0, 128($sp) + sw $t0, 4($sp) # Storing internal_137 - update_min_8779768552376: + # Argument internal_114 + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing internal_114 - lw $t0, 256($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 252($sp) - j end_assign - not_is_Bool_or_Int: - # internal_64 = internal_63 - lw $t0, 256($sp) - sw $t0, 252($sp) - end_assign: + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 128($sp) # internal_137 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 264($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 260($sp) - j end_assign - not_is_Bool_or_Int: - # internal_62 = internal_61 - lw $t0, 264($sp) - sw $t0, 260($sp) - end_assign: + # Jumping to foreach_min_start_8744937301390 + j foreach_min_start_8744937301390 - update_min_end_8779768552376: + foreach_min_end_8744937301390: - # Addition operation - lw $t0, 264($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_min_start_8779768552376 - j foreach_min_start_8779768552376 + # initialize Array [internal_115] + lw $t0, 204($sp) # $t0 = internal_115 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 88($sp) # internal_144 = new Array[internal_115] - foreach_min_end_8779768552376: + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_145 = address of allocated object Int + + # array internal_144[4 * internal_145] = internal_113 + lw $t0, 84($sp) # $t0 = internal_145 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 88($sp) # $t1 = internal_144 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 212($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_146 = address of allocated object Int + + # array internal_144[4 * internal_146] = internal_113 + lw $t0, 80($sp) # $t0 = internal_146 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 88($sp) # $t1 = internal_144 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 212($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_147 = address of allocated object Int + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_140 + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing internal_140 - # Equal operation - lw $t0, 260($sp) # Save in $t0 the left operand address - lw $t1, 348($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + # Argument internal_117 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_117 - lw $t0, 240($sp) # $t0 = internal_67 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 88($sp) # internal_147 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments - # If internal_67 then goto error_branch_8779768552376 - lw $t0, 240($sp) # Loading the address of the condition + # If internal_147 then goto error_branch_8744937301390 + lw $t0, 76($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, error_branch_8779768552376 + beq $t0, $t1, error_branch_8744937301390 + + # array internal_144[4 * internal_138] = internal_114 + lw $t0, 112($sp) # $t0 = internal_138 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 88($sp) # $t1 = internal_144 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 208($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_148 = address of allocated object Int + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # If internal_68 then goto branch_Razz_8779768552376 - lw $t0, 236($sp) # Loading the address of the condition + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_149 = address of allocated object Int + + # internal_148 = array internal_144[4 * internal_149] + lw $t0, 68($sp) # $t0 = internal_149 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 88($sp) # $t1 = internal_144 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 72($sp) # internal_148 = array internal_144[4 * internal_149] + sw $t0, 8($t2) + + # If internal_148 then goto branch_Razz_8744937301390 + lw $t0, 72($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Razz_8779768552376 + beq $t0, $t1, branch_Razz_8744937301390 + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # If internal_68 then goto branch_Foo_8779768552376 - lw $t0, 236($sp) # Loading the address of the condition + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_150 = address of allocated object Int + + # internal_148 = array internal_144[4 * internal_150] + lw $t0, 64($sp) # $t0 = internal_150 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 88($sp) # $t1 = internal_144 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 72($sp) # internal_148 = array internal_144[4 * internal_150] + sw $t0, 8($t2) + + # If internal_148 then goto branch_Bar_8744937301390 + lw $t0, 72($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Foo_8779768552376 + beq $t0, $t1, branch_Bar_8744937301390 + branch_Razz_8744937301390: - # If internal_68 then goto branch_Bar_8779768552376 - lw $t0, 236($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Bar_8779768552376 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 484($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 680($sp) + sw $t0, 0($sp) # Storing self - branch_Razz_8779768552376: + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 484($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bar li $v0, 9 @@ -5296,173 +13295,317 @@ la $t0, type_Bar # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 224($sp) # internal_71 = address of allocated object Bar + sw $v0, 52($sp) # internal_153 = address of allocated object Bar # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_71 - lw $t0, 232($sp) - sw $t0, 0($sp) # Storing internal_71 + # Argument internal_153 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_153 # Calling function function___init___at_Bar jal function___init___at_Bar lw $ra, 4($sp) - sw $v1, 232($sp) # internal_71 = result of function___init___at_Bar + sw $v1, 60($sp) # internal_153 = result of function___init___at_Bar addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 224($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 232($sp) - j end_assign - not_is_Bool_or_Int: - # internal_69 = internal_71 - lw $t0, 224($sp) - sw $t0, 232($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Jumping to branch_end_8779768552376 - j branch_end_8779768552376 + # Argument internal_151 + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing internal_151 - branch_Foo_8779768552376: + # Argument internal_153 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_153 - # Allocating Razz - li $v0, 9 - lw $a0, type_Razz - syscall - la $t0, type_Razz # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 216($sp) # internal_73 = address of allocated object Razz + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 72($sp) # internal_151 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_151 = internal_153 + lw $t0, 52($sp) + sw $t0, 60($sp) + + # Jumping to branch_end_8744937301390 + j branch_end_8744937301390 + + branch_Bar_8744937301390: # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Argument internal_73 - lw $t0, 224($sp) - sw $t0, 0($sp) # Storing internal_73 + # Argument n + lw $t0, 484($sp) + sw $t0, 4($sp) # Storing n - # Calling function function___init___at_Razz - jal function___init___at_Razz - lw $ra, 4($sp) - sw $v1, 224($sp) # internal_73 = result of function___init___at_Razz - addi $sp, $sp, 8 # Freeing space for arguments + # Argument self + lw $t0, 680($sp) + sw $t0, 0($sp) # Storing self - lw $t0, 216($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 232($sp) - j end_assign - not_is_Bool_or_Int: - # internal_69 = internal_73 - lw $t0, 216($sp) - sw $t0, 232($sp) - end_assign: + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 484($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to branch_end_8779768552376 - j branch_end_8779768552376 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - branch_Bar_8779768552376: + # Argument internal_151 + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing internal_151 - lw $t0, 380($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 232($sp) - j end_assign - not_is_Bool_or_Int: - # internal_69 = n - lw $t0, 380($sp) - sw $t0, 232($sp) - end_assign: + # Argument n + lw $t0, 484($sp) + sw $t0, 0($sp) # Storing n + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 72($sp) # internal_151 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to branch_end_8779768552376 - j branch_end_8779768552376 + # internal_151 = n + lw $t0, 472($sp) + sw $t0, 60($sp) - error_branch_8779768552376: + # Jumping to branch_end_8744937301390 + j branch_end_8744937301390 + error_branch_8744937301390: - branch_end_8779768552376: + branch_end_8744937301390: - # Set attribute a of self - lw $t0, 512($sp) # $t0 = self - lw $t1, 232($sp) # $t1 = internal_69 - sw $t1, 20($t0) # self.a = internal_69 + # Set attribute e of self + lw $t0, 668($sp) # $t0 = self + lw $t1, 60($sp) # $t1 = internal_151 + beq $t1, $zero, object_set_attribute_8744937250395 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937250395 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937250395 + j object_set_attribute_8744937250395 + int_set_attribute_8744937250395: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($t0) # self.e = internal_151 + j end_set_attribute_8744937250395 + bool_set_attribute_8744937250395: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($t0) # self.e = internal_151 + j end_set_attribute_8744937250395 + object_set_attribute_8744937250395: + sw $t1, 28($t0) # self.e = internal_151 + end_set_attribute_8744937250395: # Get attribute a of self - lw $t0, 512($sp) # Get the address of self + lw $t0, 668($sp) # Get the address of self lw $t1, 20($t0) # Get the attribute 'a' from the instance - sw $t1, 208($sp) # internal_75 = a + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8744937253437 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8744937253437 + j object_get_attribute_8744937253437 + int_get_attribute_8744937253437: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 44($sp) # internal_155 = self.a + j end_get_attribute_8744937253437 + bool_get_attribute_8744937253437: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 44($sp) # internal_155 = self.a + j end_get_attribute_8744937253437 + object_get_attribute_8744937253437: + sw $t1, 44($sp) # internal_155 = a + end_get_attribute_8744937253437: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_75 - lw $t0, 216($sp) - sw $t0, 0($sp) # Storing internal_75 + # Argument internal_155 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_155 + + # Calling function function_doh_at_Foo + jal function_doh_at_Foo + lw $ra, 4($sp) + sw $v1, 48($sp) # internal_156 = result of function_doh_at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute g of self + lw $t0, 668($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'g' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8744937253467 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8744937253467 + j object_get_attribute_8744937253467 + int_get_attribute_8744937253467: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 36($sp) # internal_157 = self.g + j end_get_attribute_8744937253467 + bool_get_attribute_8744937253467: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 36($sp) # internal_157 = self.g + j end_get_attribute_8744937253467 + object_get_attribute_8744937253467: + sw $t1, 36($sp) # internal_157 = g + end_get_attribute_8744937253467: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_157 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_157 # Calling function function_doh_at_Foo jal function_doh_at_Foo lw $ra, 4($sp) - sw $v1, 212($sp) # internal_76 = result of function_doh_at_Foo + sw $v1, 40($sp) # internal_158 = result of function_doh_at_Foo addi $sp, $sp, 8 # Freeing space for arguments - # Get attribute g of self - lw $t0, 512($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'g' from the instance - sw $t1, 200($sp) # internal_77 = g + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_156 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_156 + + # Argument internal_158 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_158 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_159 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute e of self + lw $t0, 668($sp) # Get the address of self + lw $t1, 28($t0) # Get the attribute 'e' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8744937253512 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8744937253512 + j object_get_attribute_8744937253512 + int_get_attribute_8744937253512: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($sp) # internal_160 = self.e + j end_get_attribute_8744937253512 + bool_get_attribute_8744937253512: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($sp) # internal_160 = self.e + j end_get_attribute_8744937253512 + object_get_attribute_8744937253512: + sw $t1, 24($sp) # internal_160 = e + end_get_attribute_8744937253512: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_77 - lw $t0, 208($sp) - sw $t0, 0($sp) # Storing internal_77 + # Argument internal_160 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_160 # Calling function function_doh_at_Foo jal function_doh_at_Foo lw $ra, 4($sp) - sw $v1, 204($sp) # internal_78 = result of function_doh_at_Foo + sw $v1, 28($sp) # internal_161 = result of function_doh_at_Foo addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_76 - lw $t0, 216($sp) - sw $t0, 4($sp) # Storing internal_76 + # Argument internal_159 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_159 - # Argument internal_78 - lw $t0, 208($sp) - sw $t0, 0($sp) # Storing internal_78 + # Argument internal_161 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_161 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 204($sp) # internal_79 = result of function_add + sw $v1, 28($sp) # internal_162 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -5470,31 +13613,31 @@ sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 520($sp) + lw $t0, 676($sp) sw $t0, 0($sp) # Storing self # Calling function function_doh_at_Foo jal function_doh_at_Foo lw $ra, 4($sp) - sw $v1, 196($sp) # internal_80 = result of function_doh_at_Foo + sw $v1, 20($sp) # internal_163 = result of function_doh_at_Foo addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_79 - lw $t0, 204($sp) - sw $t0, 4($sp) # Storing internal_79 + # Argument internal_162 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_162 - # Argument internal_80 - lw $t0, 200($sp) - sw $t0, 0($sp) # Storing internal_80 + # Argument internal_163 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_163 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 196($sp) # internal_81 = result of function_add + sw $v1, 20($sp) # internal_164 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -5502,45 +13645,87 @@ sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 520($sp) + lw $t0, 676($sp) sw $t0, 0($sp) # Storing self # Calling function function_printh_at_Bazz jal function_printh_at_Bazz lw $ra, 4($sp) - sw $v1, 188($sp) # internal_82 = result of function_printh_at_Bazz + sw $v1, 12($sp) # internal_165 = result of function_printh_at_Bazz addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_81 - lw $t0, 196($sp) - sw $t0, 4($sp) # Storing internal_81 + # Argument internal_164 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_164 - # Argument internal_82 - lw $t0, 192($sp) - sw $t0, 0($sp) # Storing internal_82 + # Argument internal_165 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_165 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 188($sp) # internal_83 = result of function_add + sw $v1, 12($sp) # internal_166 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Set attribute b of self - lw $t0, 512($sp) # $t0 = self - lw $t1, 176($sp) # $t1 = internal_83 - sw $t1, 24($t0) # self.b = internal_83 - + # Set attribute f of self + lw $t0, 668($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_166 + beq $t1, $zero, object_set_attribute_8744937253105 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937253105 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937253105 + j object_set_attribute_8744937253105 + int_set_attribute_8744937253105: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($t0) # self.f = internal_166 + j end_set_attribute_8744937253105 + bool_set_attribute_8744937253105: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($t0) # self.f = internal_166 + j end_set_attribute_8744937253105 + object_set_attribute_8744937253105: + sw $t1, 32($t0) # self.f = internal_166 + end_set_attribute_8744937253105: + # Loading return value in $v1 + lw $v1, 668($sp) + # Freeing space for local variables + addi $sp, $sp, 668 + jr $ra + function___init___at_Bazz: + # Function parameters + # $ra = 228($sp) + # self = 224($sp) + # Reserving space for local variables + addi $sp, $sp, -224 - # Allocating Int 0 + # Allocating Int 1 li $v0, 9 addi $a0, $zero, 12 syscall @@ -5548,637 +13733,331 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 152($sp) # internal_89 = address of allocated object Int + sw $v0, 220($sp) # internal_0 = address of allocated object Int - # Allocating Bool 0 + # Set attribute h of self + lw $t0, 224($sp) # $t0 = self + lw $t1, 220($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8744937253626 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937253626 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937253626 + j object_set_attribute_8744937253626 + int_set_attribute_8744937253626: li $v0, 9 addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 160($sp) # internal_87 = address of allocated object Int - - - - - # internal_85 = typeof self that is the first word of the object - lw $t0, 512($sp) - lw $t1, 0($t0) - sw $t1, 168($sp) - - lw $t0, 168($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 164($sp) - j end_assign - not_is_Bool_or_Int: - # internal_86 = internal_85 - lw $t0, 168($sp) - sw $t0, 164($sp) - end_assign: - - lw $t0, 152($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 172($sp) - j end_assign - not_is_Bool_or_Int: - # internal_84 = internal_89 - lw $t0, 152($sp) - sw $t0, 172($sp) - end_assign: - - while_start_8779768528207: - - # Equal operation - lw $t0, 164($sp) # Save in $t0 the left operand address - # If internal_87 then goto while_end_8779768528207 - lw $t0, 160($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_end_8779768528207 - - # Addition operation - lw $t0, 172($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # internal_86 = ancestor of internal_86 that is the first word of the object - lw $t0, 164($sp) - lw $t1, 4($t0) - sw $t1, 164($sp) - - # Jumping to while_start_8779768528207 - j while_start_8779768528207 - - while_end_8779768528207: - - - - - lw $t0, 168($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 164($sp) - j end_assign - not_is_Bool_or_Int: - # internal_86 = internal_85 - lw $t0, 168($sp) - sw $t0, 164($sp) - end_assign: - - - foreach_start_8779768528207: - - # Less than operation - lw $t0, 144($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 172($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 - - lw $t0, 140($sp) # $t0 = internal_92 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # If internal_92 then goto foreach_body_8779768528207 - lw $t0, 140($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_body_8779768528207 - - # Jumping to foreach_end_8779768528207 - j foreach_end_8779768528207 - - foreach_body_8779768528207: - - - # internal_86 = ancestor of internal_86 that is the first word of the object - lw $t0, 164($sp) - lw $t1, 4($t0) - sw $t1, 164($sp) - - # Addition operation - lw $t0, 144($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_start_8779768528207 - j foreach_start_8779768528207 - - foreach_end_8779768528207: - - - - - - - # internal_95 = direction of Razz - la $t0, type_Razz - sw $t0, 128($sp) - - - - # internal_96 = direction of Bar - la $t0, type_Bar - sw $t0, 124($sp) - - - - - - - foreach_type_start_8779768528207: - - # Less than operation - lw $t0, 120($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # If internal_98 then goto foreach_type_body_8779768528207 - lw $t0, 116($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_type_body_8779768528207 - - # Jumping to foreach_type_end_8779768528207 - j foreach_type_end_8779768528207 - - foreach_type_body_8779768528207: - - - - - - foreach_ancestor_start_8779768528207: - - # Less than operation - lw $t0, 108($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 172($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 - - lw $t0, 104($sp) # $t0 = internal_101 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # If internal_101 then goto foreach_ancestor_body_8779768528207 - lw $t0, 104($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_body_8779768528207 - - # Jumping to foreach_ancestor_end_8779768528207 - j foreach_ancestor_end_8779768528207 - - foreach_ancestor_body_8779768528207: - - - # Equal operation - lw $t0, 112($sp) # Save in $t0 the left operand address - lw $t1, 100($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 - - lw $t0, 96($sp) # $t0 = internal_103 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # If internal_103 then goto foreach_ancestor_end_8779768528207 - lw $t0, 96($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_end_8779768528207 - - # Addition operation - lw $t0, 108($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_ancestor_start_8779768528207 - j foreach_ancestor_start_8779768528207 - - foreach_ancestor_end_8779768528207: - - - - - - # Addition operation - lw $t0, 120($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_type_start_8779768528207 - j foreach_type_start_8779768528207 - - foreach_type_end_8779768528207: - - - - - - - - lw $t0, 172($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 80($sp) - j end_assign - not_is_Bool_or_Int: - # internal_107 = internal_84 - lw $t0, 172($sp) - sw $t0, 80($sp) - end_assign: - - foreach_min_start_8779768528207: - - # Less than operation - lw $t0, 92($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # If internal_108 then goto foreach_min_body_8779768528207 - lw $t0, 76($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_min_body_8779768528207 - - # Jumping to foreach_min_end_8779768528207 - j foreach_min_end_8779768528207 - - foreach_min_body_8779768528207: - - - # Less than operation - lw $t0, 84($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 80($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 - - lw $t0, 76($sp) # $t0 = internal_108 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # If internal_108 then goto update_min_8779768528207 - lw $t0, 76($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, update_min_8779768528207 - - # Jumping to foreach_min_end_8779768528207 - j foreach_min_end_8779768528207 - - update_min_8779768528207: - - lw $t0, 84($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 80($sp) - j end_assign - not_is_Bool_or_Int: - # internal_107 = internal_106 - lw $t0, 84($sp) - sw $t0, 80($sp) - end_assign: - - lw $t0, 92($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 88($sp) - j end_assign - not_is_Bool_or_Int: - # internal_105 = internal_104 - lw $t0, 92($sp) - sw $t0, 88($sp) - end_assign: - - update_min_end_8779768528207: - - # Addition operation - lw $t0, 92($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_min_start_8779768528207 - j foreach_min_start_8779768528207 - - foreach_min_end_8779768528207: - - - - - - - - # Equal operation - lw $t0, 88($sp) # Save in $t0 the left operand address - lw $t1, 172($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 - - lw $t0, 68($sp) # $t0 = internal_110 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # If internal_110 then goto error_branch_8779768528207 - lw $t0, 68($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, error_branch_8779768528207 - - - - # If internal_111 then goto branch_Razz_8779768528207 - lw $t0, 64($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Razz_8779768528207 - - - # If internal_111 then goto branch_Bar_8779768528207 - lw $t0, 64($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Bar_8779768528207 - - branch_Razz_8779768528207: - - # Allocating Bar - li $v0, 9 - lw $a0, type_Bar - syscall - la $t0, type_Bar # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 52($sp) # internal_114 = address of allocated object Bar - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_114 - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing internal_114 - - # Calling function function___init___at_Bar - jal function___init___at_Bar - lw $ra, 4($sp) - sw $v1, 60($sp) # internal_114 = result of function___init___at_Bar - addi $sp, $sp, 8 # Freeing space for arguments - - lw $t0, 52($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: - # internal_112 = internal_114 - lw $t0, 52($sp) - sw $t0, 60($sp) - end_assign: + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.h = internal_0 + j end_set_attribute_8744937253626 + bool_set_attribute_8744937253626: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.h = internal_0 + j end_set_attribute_8744937253626 + object_set_attribute_8744937253626: + sw $t1, 8($t0) # self.h = internal_0 + end_set_attribute_8744937253626: - # Jumping to branch_end_8779768528207 - j branch_end_8779768528207 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - branch_Bar_8779768528207: + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 216($sp) # internal_1 = address of allocated object Int - lw $t0, 380($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: - # internal_112 = n - lw $t0, 380($sp) - sw $t0, 60($sp) - end_assign: + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Jumping to branch_end_8779768528207 - j branch_end_8779768528207 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 212($sp) # internal_2 = address of allocated object Int - error_branch_8779768528207: + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 208($sp) # internal_3 = address of allocated object Int - branch_end_8779768528207: + # Allocating NUll to internal_4 + sw $zero, 204($sp) # internal_4 = 0 - # Set attribute e of self - lw $t0, 512($sp) # $t0 = self - lw $t1, 60($sp) # $t1 = internal_112 - sw $t1, 28($t0) # self.e = internal_112 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Get attribute a of self - lw $t0, 512($sp) # Get the address of self - lw $t1, 20($t0) # Get the attribute 'a' from the instance - sw $t1, 44($sp) # internal_116 = a + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 200($sp) # internal_5 = address of allocated object Int - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Argument internal_116 - lw $t0, 52($sp) - sw $t0, 0($sp) # Storing internal_116 + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 188($sp) # internal_8 = address of allocated object Int - # Calling function function_doh_at_Foo - jal function_doh_at_Foo - lw $ra, 4($sp) - sw $v1, 48($sp) # internal_117 = result of function_doh_at_Foo - addi $sp, $sp, 8 # Freeing space for arguments + # internal_6 = typeof self that is the first word of the object + lw $t0, 224($sp) + lw $t0, 0($t0) + sw $t0, 196($sp) - # Get attribute g of self - lw $t0, 512($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'g' from the instance - sw $t1, 36($sp) # internal_118 = g + # internal_7 = internal_6 + lw $t0, 196($sp) + sw $t0, 192($sp) - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + while_start_8744937301489: - # Argument internal_118 - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_118 + # internal_8 = EqualAddress(internal_7, internal_4) + lw $t0, 192($sp) + lw $t1, 204($sp) + seq $t2, $t0, $t1 + lw $t0, 188($sp) + sw $t2, 8($t0) - # Calling function function_doh_at_Foo - jal function_doh_at_Foo - lw $ra, 4($sp) - sw $v1, 40($sp) # internal_119 = result of function_doh_at_Foo - addi $sp, $sp, 8 # Freeing space for arguments + # If internal_8 then goto while_end_8744937301489 + lw $t0, 188($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8744937301489 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_117 - lw $t0, 52($sp) - sw $t0, 4($sp) # Storing internal_117 + # Argument internal_5 + lw $t0, 212($sp) + sw $t0, 4($sp) # Storing internal_5 - # Argument internal_119 - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_119 + # Argument internal_2 + lw $t0, 224($sp) + sw $t0, 0($sp) # Storing internal_2 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 40($sp) # internal_120 = result of function_add + sw $v1, 212($sp) # internal_5 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Get attribute e of self - lw $t0, 512($sp) # Get the address of self - lw $t1, 28($t0) # Get the attribute 'e' from the instance - sw $t1, 24($sp) # internal_121 = e - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_121 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_121 + # internal_7 = ancestor of internal_7 + lw $t0, 192($sp) + lw $t0, 4($t0) + sw $t0, 192($sp) - # Calling function function_doh_at_Foo - jal function_doh_at_Foo - lw $ra, 4($sp) - sw $v1, 28($sp) # internal_122 = result of function_doh_at_Foo - addi $sp, $sp, 8 # Freeing space for arguments + # Jumping to while_start_8744937301489 + j while_start_8744937301489 - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + while_end_8744937301489: - # Argument internal_120 - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing internal_120 + # internal_7 = internal_6 + lw $t0, 196($sp) + sw $t0, 192($sp) + + # initialize Array [internal_5] + lw $t0, 200($sp) # $t0 = internal_5 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 184($sp) # internal_9 = new Array[internal_5] - # Argument internal_122 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_122 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 28($sp) # internal_123 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 180($sp) # internal_10 = address of allocated object Int - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Argument self - lw $t0, 520($sp) - sw $t0, 0($sp) # Storing self + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 176($sp) # internal_11 = address of allocated object Int - # Calling function function_doh_at_Foo - jal function_doh_at_Foo - lw $ra, 4($sp) - sw $v1, 20($sp) # internal_124 = result of function_doh_at_Foo - addi $sp, $sp, 8 # Freeing space for arguments + foreach_start_8744937301489: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_123 - lw $t0, 28($sp) - sw $t0, 4($sp) # Storing internal_123 + # Argument internal_10 + lw $t0, 192($sp) + sw $t0, 4($sp) # Storing internal_10 - # Argument internal_124 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_124 + # Argument internal_5 + lw $t0, 212($sp) + sw $t0, 0($sp) # Storing internal_5 - # Calling function function_add - jal function_add + # Calling function function_less_than + jal function_less_than lw $ra, 8($sp) - sw $v1, 20($sp) # internal_125 = result of function_add + sw $v1, 188($sp) # internal_11 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + # If internal_11 then goto foreach_body_8744937301489 + lw $t0, 176($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8744937301489 - # Argument self - lw $t0, 520($sp) - sw $t0, 0($sp) # Storing self + # Jumping to foreach_end_8744937301489 + j foreach_end_8744937301489 - # Calling function function_printh_at_Bazz - jal function_printh_at_Bazz - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_126 = result of function_printh_at_Bazz - addi $sp, $sp, 8 # Freeing space for arguments + foreach_body_8744937301489: + + # array internal_9[4 * internal_10] = internal_7 + lw $t0, 180($sp) # $t0 = internal_10 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 184($sp) # $t1 = internal_9 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 192($sp) + sw $t0, 0($t1) + + # internal_7 = ancestor of internal_7 + lw $t0, 192($sp) + lw $t0, 4($t0) + sw $t0, 192($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_125 - lw $t0, 20($sp) - sw $t0, 4($sp) # Storing internal_125 + # Argument internal_10 + lw $t0, 192($sp) + sw $t0, 4($sp) # Storing internal_10 - # Argument internal_126 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_126 + # Argument internal_2 + lw $t0, 224($sp) + sw $t0, 0($sp) # Storing internal_2 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 12($sp) # internal_127 = result of function_add + sw $v1, 192($sp) # internal_10 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Set attribute f of self - lw $t0, 512($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_127 - sw $t1, 32($t0) # self.f = internal_127 + # Jumping to foreach_start_8744937301489 + j foreach_start_8744937301489 - # Loading return value in $v1 - lw $v1, 512($sp) + foreach_end_8744937301489: - # Freeing space for local variables - addi $sp, $sp, 512 + # initialize Array [internal_3] + lw $t0, 208($sp) # $t0 = internal_3 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 172($sp) # internal_12 = new Array[internal_3] + + # initialize Array [internal_3] + lw $t0, 208($sp) # $t0 = internal_3 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 168($sp) # internal_13 = new Array[internal_3] - jr $ra + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - function___init___at_Bazz: - # Function parameters - # $ra = 164($sp) - # self = 160($sp) + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_15 = address of allocated object Int - # Reserving space for local variables - addi $sp, $sp, -160 + # internal_14 = direction of Bazz + la $t0, type_Bazz + sw $t0, 164($sp) + + # array internal_12[4 * internal_15] = internal_14 + lw $t0, 160($sp) # $t0 = internal_15 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 172($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 164($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_15] = internal_5 + lw $t0, 160($sp) # $t0 = internal_15 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 168($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 200($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) # Allocating Int 1 li $v0, 9 @@ -6190,18 +14069,136 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 156($sp) # internal_0 = address of allocated object Int + sw $v0, 152($sp) # internal_17 = address of allocated object Int - # Set attribute h of self - lw $t0, 160($sp) # $t0 = self - lw $t1, 156($sp) # $t1 = internal_0 - sw $t1, 8($t0) # self.h = internal_0 + # internal_16 = direction of Razz + la $t0, type_Razz + sw $t0, 156($sp) + + # array internal_12[4 * internal_17] = internal_16 + lw $t0, 152($sp) # $t0 = internal_17 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 172($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 156($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_17] = internal_5 + lw $t0, 152($sp) # $t0 = internal_17 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 168($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 200($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_19 = address of allocated object Int + + # internal_18 = direction of Foo + la $t0, type_Foo + sw $t0, 148($sp) + + # array internal_12[4 * internal_19] = internal_18 + lw $t0, 144($sp) # $t0 = internal_19 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 172($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 148($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_19] = internal_5 + lw $t0, 144($sp) # $t0 = internal_19 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 168($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 200($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_21 = address of allocated object Int + # internal_20 = direction of Bar + la $t0, type_Bar + sw $t0, 140($sp) + + # array internal_12[4 * internal_21] = internal_20 + lw $t0, 136($sp) # $t0 = internal_21 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 172($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 140($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_21] = internal_5 + lw $t0, 136($sp) # $t0 = internal_21 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 168($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 200($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 132($sp) # internal_22 = address of allocated object Int + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_23 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -6213,7 +14210,19 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 132($sp) # internal_6 = address of allocated object Int + sw $v0, 120($sp) # internal_25 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 116($sp) # internal_26 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -6225,398 +14234,734 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 140($sp) # internal_4 = address of allocated object Int - + sw $v0, 108($sp) # internal_28 = address of allocated object Int + foreach_type_start_8744937301489: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # internal_2 = typeof self that is the first word of the object - lw $t0, 160($sp) - lw $t1, 0($t0) - sw $t1, 148($sp) - - lw $t0, 148($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 144($sp) - j end_assign - not_is_Bool_or_Int: - # internal_3 = internal_2 - lw $t0, 148($sp) - sw $t0, 144($sp) - end_assign: + # Argument internal_22 + lw $t0, 144($sp) + sw $t0, 4($sp) # Storing internal_22 - lw $t0, 132($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 152($sp) - j end_assign - not_is_Bool_or_Int: - # internal_1 = internal_6 - lw $t0, 132($sp) - sw $t0, 152($sp) - end_assign: + # Argument internal_3 + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing internal_3 - while_start_8779768528306: + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 140($sp) # internal_23 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - # Equal operation - lw $t0, 144($sp) # Save in $t0 the left operand address - # If internal_4 then goto while_end_8779768528306 - lw $t0, 140($sp) # Loading the address of the condition + # If internal_23 then goto foreach_type_body_8744937301489 + lw $t0, 128($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_end_8779768528306 + beq $t0, $t1, foreach_type_body_8744937301489 - # Addition operation - lw $t0, 152($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # internal_3 = ancestor of internal_3 that is the first word of the object - lw $t0, 144($sp) - lw $t1, 4($t0) - sw $t1, 144($sp) + # Jumping to foreach_type_end_8744937301489 + j foreach_type_end_8744937301489 - # Jumping to while_start_8779768528306 - j while_start_8779768528306 + foreach_type_body_8744937301489: - while_end_8779768528306: + # internal_24 = array internal_12[4 * internal_22] + lw $t0, 132($sp) # $t0 = internal_22 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 172($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 124($sp) # internal_24 = array internal_12[4 * internal_22] + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_25 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_25 + # Argument internal_1 + lw $t0, 228($sp) + sw $t0, 0($sp) # Storing internal_1 - lw $t0, 148($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 144($sp) - j end_assign - not_is_Bool_or_Int: - # internal_3 = internal_2 - lw $t0, 148($sp) - sw $t0, 144($sp) - end_assign: + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 132($sp) # internal_25 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + foreach_ancestor_start_8744937301489: - foreach_start_8779768528306: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Less than operation - lw $t0, 124($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 152($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + # Argument internal_25 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_25 - lw $t0, 120($sp) # $t0 = internal_9 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Argument internal_5 + lw $t0, 212($sp) + sw $t0, 0($sp) # Storing internal_5 - # If internal_9 then goto foreach_body_8779768528306 - lw $t0, 120($sp) # Loading the address of the condition + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 128($sp) # internal_26 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_26 then goto foreach_ancestor_body_8744937301489 + lw $t0, 116($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_body_8779768528306 + beq $t0, $t1, foreach_ancestor_body_8744937301489 + + # Jumping to foreach_ancestor_end_8744937301489 + j foreach_ancestor_end_8744937301489 + + foreach_ancestor_body_8744937301489: + + # internal_27 = array internal_9[4 * internal_25] + lw $t0, 120($sp) # $t0 = internal_25 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 184($sp) # $t1 = internal_9 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 112($sp) # internal_27 = array internal_9[4 * internal_25] + + # internal_28 = EqualAddress(internal_24, internal_27) + lw $t0, 124($sp) + lw $t1, 112($sp) + seq $t2, $t0, $t1 + lw $t0, 108($sp) + sw $t2, 8($t0) - # Jumping to foreach_end_8779768528306 - j foreach_end_8779768528306 + # If internal_28 then goto foreach_ancestor_end_8744937301489 + lw $t0, 108($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8744937301489 - foreach_body_8779768528306: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_25 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_25 - # internal_3 = ancestor of internal_3 that is the first word of the object - lw $t0, 144($sp) - lw $t1, 4($t0) - sw $t1, 144($sp) + # Argument internal_2 + lw $t0, 224($sp) + sw $t0, 0($sp) # Storing internal_2 - # Addition operation - lw $t0, 124($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_start_8779768528306 - j foreach_start_8779768528306 + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 132($sp) # internal_25 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - foreach_end_8779768528306: + # Jumping to foreach_ancestor_start_8744937301489 + j foreach_ancestor_start_8744937301489 + foreach_ancestor_end_8744937301489: + # array internal_13[4 * internal_22] = internal_25 + lw $t0, 132($sp) # $t0 = internal_22 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 168($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 120($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_22 + lw $t0, 144($sp) + sw $t0, 4($sp) # Storing internal_22 + # Argument internal_2 + lw $t0, 224($sp) + sw $t0, 0($sp) # Storing internal_2 - # internal_12 = direction of Bazz - la $t0, type_Bazz - sw $t0, 108($sp) + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 144($sp) # internal_22 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + # Jumping to foreach_type_start_8744937301489 + j foreach_type_start_8744937301489 + foreach_type_end_8744937301489: - # internal_13 = direction of Razz - la $t0, type_Razz - sw $t0, 104($sp) + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_34[0] = '\n' - # internal_14 = direction of Foo - la $t0, type_Foo - sw $t0, 100($sp) + sb $zero, 9($v0) # Null-terminator at the end of the string + sw $v0, 84($sp) # internal_34 = "\n" + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall - # internal_15 = direction of Bar - la $t0, type_Bar - sw $t0, 96($sp) + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_35[0] = ' ' + sb $zero, 9($v0) # Null-terminator at the end of the string + sw $v0, 80($sp) # internal_35 = " " + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - foreach_type_start_8779768528306: + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_29 = address of allocated object Int - # Less than operation - lw $t0, 92($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # If internal_17 then goto foreach_type_body_8779768528306 - lw $t0, 88($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_type_body_8779768528306 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_30 = address of allocated object Int - # Jumping to foreach_type_end_8779768528306 - j foreach_type_end_8779768528306 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - foreach_type_body_8779768528306: + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_31 = address of allocated object Int + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 92($sp) # internal_32 = address of allocated object Int + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_33 = address of allocated object Int - foreach_ancestor_start_8779768528306: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Less than operation - lw $t0, 80($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 152($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + # Argument internal_32 + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing internal_32 - lw $t0, 76($sp) # $t0 = internal_20 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Argument internal_5 + lw $t0, 212($sp) + sw $t0, 0($sp) # Storing internal_5 - # If internal_20 then goto foreach_ancestor_body_8779768528306 - lw $t0, 76($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_body_8779768528306 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 104($sp) # internal_32 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_ancestor_end_8779768528306 - j foreach_ancestor_end_8779768528306 + foreach_min_start_8744937301489: - foreach_ancestor_body_8779768528306: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_29 + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing internal_29 - # Equal operation - lw $t0, 84($sp) # Save in $t0 the left operand address - lw $t1, 72($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + # Argument internal_3 + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing internal_3 - lw $t0, 68($sp) # $t0 = internal_22 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_33 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - # If internal_22 then goto foreach_ancestor_end_8779768528306 - lw $t0, 68($sp) # Loading the address of the condition + # If internal_33 then goto foreach_min_body_8744937301489 + lw $t0, 88($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_end_8779768528306 + beq $t0, $t1, foreach_min_body_8744937301489 - # Addition operation - lw $t0, 80($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_ancestor_start_8779768528306 - j foreach_ancestor_start_8779768528306 + # Jumping to foreach_min_end_8744937301489 + j foreach_min_end_8744937301489 - foreach_ancestor_end_8779768528306: + foreach_min_body_8744937301489: + # internal_31 = array internal_13[4 * internal_29] + lw $t0, 104($sp) # $t0 = internal_29 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 168($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 96($sp) # internal_31 = array internal_13[4 * internal_29] + sw $t0, 8($t2) + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_31 + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing internal_31 + # Argument internal_32 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_32 - # Addition operation - lw $t0, 92($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_type_start_8779768528306 - j foreach_type_start_8779768528306 + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_33 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - foreach_type_end_8779768528306: + # If internal_33 then goto update_min_8744937301489 + lw $t0, 88($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8744937301489 + # Jumping to update_min_end_8744937301489 + j update_min_end_8744937301489 + update_min_8744937301489: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_32 + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing internal_32 + # Argument internal_31 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_31 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 104($sp) # internal_32 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 152($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: - # internal_26 = internal_1 - lw $t0, 152($sp) - sw $t0, 52($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - foreach_min_start_8779768528306: + # Argument internal_30 + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing internal_30 - # Less than operation - lw $t0, 64($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # If internal_27 then goto foreach_min_body_8779768528306 - lw $t0, 48($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_min_body_8779768528306 + # Argument internal_29 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_29 - # Jumping to foreach_min_end_8779768528306 - j foreach_min_end_8779768528306 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 112($sp) # internal_30 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - foreach_min_body_8779768528306: + update_min_end_8744937301489: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # Less than operation - lw $t0, 56($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 52($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + # Argument internal_29 + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing internal_29 - lw $t0, 48($sp) # $t0 = internal_27 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Argument internal_2 + lw $t0, 224($sp) + sw $t0, 0($sp) # Storing internal_2 - # If internal_27 then goto update_min_8779768528306 - lw $t0, 48($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, update_min_8779768528306 + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 116($sp) # internal_29 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_min_end_8779768528306 - j foreach_min_end_8779768528306 + # Jumping to foreach_min_start_8744937301489 + j foreach_min_start_8744937301489 - update_min_8779768528306: + foreach_min_end_8744937301489: - lw $t0, 56($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: - # internal_26 = internal_25 - lw $t0, 56($sp) - sw $t0, 52($sp) - end_assign: + # initialize Array [internal_3] + lw $t0, 208($sp) # $t0 = internal_3 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 76($sp) # internal_36 = new Array[internal_3] - lw $t0, 64($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: - # internal_24 = internal_23 - lw $t0, 64($sp) - sw $t0, 60($sp) - end_assign: + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - update_min_end_8779768528306: + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_37 = address of allocated object Int + + # array internal_36[4 * internal_37] = internal_1 + lw $t0, 72($sp) # $t0 = internal_37 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 76($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 216($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) - # Addition operation - lw $t0, 64($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - # Jumping to foreach_min_start_8779768528306 - j foreach_min_start_8779768528306 + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - foreach_min_end_8779768528306: + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_38 = address of allocated object Int + + # array internal_36[4 * internal_38] = internal_1 + lw $t0, 68($sp) # $t0 = internal_38 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 76($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 216($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_39 = address of allocated object Int + + # array internal_36[4 * internal_39] = internal_1 + lw $t0, 64($sp) # $t0 = internal_39 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 76($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 216($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_40 = address of allocated object Int + + # array internal_36[4 * internal_40] = internal_1 + lw $t0, 60($sp) # $t0 = internal_40 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 76($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 216($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_41 = address of allocated object Int + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + # Argument internal_32 + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing internal_32 - # Equal operation - lw $t0, 60($sp) # Save in $t0 the left operand address - lw $t1, 152($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + # Argument internal_5 + lw $t0, 212($sp) + sw $t0, 0($sp) # Storing internal_5 - lw $t0, 40($sp) # $t0 = internal_29 - sw $t2, 8($t0) # Setting value in the third word of the Bool object + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_41 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments - # If internal_29 then goto error_branch_8779768528306 - lw $t0, 40($sp) # Loading the address of the condition + # If internal_41 then goto error_branch_8744937301489 + lw $t0, 56($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, error_branch_8779768528306 + beq $t0, $t1, error_branch_8744937301489 + + # array internal_36[4 * internal_30] = internal_2 + lw $t0, 100($sp) # $t0 = internal_30 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 76($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 212($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_42 = address of allocated object Int + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # If internal_30 then goto branch_Bazz_8779768528306 - lw $t0, 36($sp) # Loading the address of the condition + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_43 = address of allocated object Int + + # internal_42 = array internal_36[4 * internal_43] + lw $t0, 48($sp) # $t0 = internal_43 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 76($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 52($sp) # internal_42 = array internal_36[4 * internal_43] + sw $t0, 8($t2) + + # If internal_42 then goto branch_Bazz_8744937301489 + lw $t0, 52($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Bazz_8779768528306 + beq $t0, $t1, branch_Bazz_8744937301489 + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # If internal_30 then goto branch_Razz_8779768528306 - lw $t0, 36($sp) # Loading the address of the condition + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_44 = address of allocated object Int + + # internal_42 = array internal_36[4 * internal_44] + lw $t0, 44($sp) # $t0 = internal_44 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 76($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 52($sp) # internal_42 = array internal_36[4 * internal_44] + sw $t0, 8($t2) + + # If internal_42 then goto branch_Razz_8744937301489 + lw $t0, 52($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Razz_8779768528306 + beq $t0, $t1, branch_Razz_8744937301489 + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # If internal_30 then goto branch_Foo_8779768528306 - lw $t0, 36($sp) # Loading the address of the condition + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_45 = address of allocated object Int + + # internal_42 = array internal_36[4 * internal_45] + lw $t0, 40($sp) # $t0 = internal_45 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 76($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 52($sp) # internal_42 = array internal_36[4 * internal_45] + sw $t0, 8($t2) + + # If internal_42 then goto branch_Foo_8744937301489 + lw $t0, 52($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Foo_8779768528306 + beq $t0, $t1, branch_Foo_8744937301489 + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # If internal_30 then goto branch_Bar_8779768528306 - lw $t0, 36($sp) # Loading the address of the condition + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_46 = address of allocated object Int + + # internal_42 = array internal_36[4 * internal_46] + lw $t0, 36($sp) # $t0 = internal_46 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 76($sp) # $t1 = internal_36 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 52($sp) # internal_42 = array internal_36[4 * internal_46] + sw $t0, 8($t2) + + # If internal_42 then goto branch_Bar_8744937301489 + lw $t0, 52($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Bar_8779768528306 + beq $t0, $t1, branch_Bar_8744937301489 + + branch_Bazz_8744937301489: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing n - branch_Bazz_8779768528306: + # Argument self + lw $t0, 236($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 40($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating Foo li $v0, 9 @@ -6625,43 +14970,66 @@ la $t0, type_Foo # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 24($sp) # internal_33 = address of allocated object Foo + sw $v0, 24($sp) # internal_49 = address of allocated object Foo # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_33 + # Argument internal_49 lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_33 + sw $t0, 0($sp) # Storing internal_49 # Calling function function___init___at_Foo jal function___init___at_Foo lw $ra, 4($sp) - sw $v1, 32($sp) # internal_33 = result of function___init___at_Foo + sw $v1, 32($sp) # internal_49 = result of function___init___at_Foo addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 24($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 32($sp) - j end_assign - not_is_Bool_or_Int: - # internal_31 = internal_33 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_47 + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing internal_47 + + # Argument internal_49 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_49 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_47 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_47 = internal_49 lw $t0, 24($sp) sw $t0, 32($sp) - end_assign: - # Jumping to branch_end_8779768528306 - j branch_end_8779768528306 + # Jumping to branch_end_8744937301489 + j branch_end_8744937301489 + + branch_Razz_8744937301489: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 236($sp) + sw $t0, 0($sp) # Storing self - branch_Razz_8779768528306: + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 40($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bar li $v0, 9 @@ -6670,43 +15038,66 @@ la $t0, type_Bar # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 16($sp) # internal_35 = address of allocated object Bar + sw $v0, 16($sp) # internal_51 = address of allocated object Bar # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_35 + # Argument internal_51 lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_35 + sw $t0, 0($sp) # Storing internal_51 # Calling function function___init___at_Bar jal function___init___at_Bar lw $ra, 4($sp) - sw $v1, 24($sp) # internal_35 = result of function___init___at_Bar + sw $v1, 24($sp) # internal_51 = result of function___init___at_Bar addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 32($sp) - j end_assign - not_is_Bool_or_Int: - # internal_31 = internal_35 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_47 + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing internal_47 + + # Argument internal_51 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_51 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_47 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_47 = internal_51 lw $t0, 16($sp) sw $t0, 32($sp) - end_assign: - # Jumping to branch_end_8779768528306 - j branch_end_8779768528306 + # Jumping to branch_end_8744937301489 + j branch_end_8744937301489 + + branch_Foo_8744937301489: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 236($sp) + sw $t0, 0($sp) # Storing self - branch_Foo_8779768528306: + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 40($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating Razz li $v0, 9 @@ -6715,98 +15106,189 @@ la $t0, type_Razz # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 8($sp) # internal_37 = address of allocated object Razz + sw $v0, 8($sp) # internal_53 = address of allocated object Razz # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_37 + # Argument internal_53 lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_37 + sw $t0, 0($sp) # Storing internal_53 # Calling function function___init___at_Razz jal function___init___at_Razz lw $ra, 4($sp) - sw $v1, 16($sp) # internal_37 = result of function___init___at_Razz + sw $v1, 16($sp) # internal_53 = result of function___init___at_Razz addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 32($sp) - j end_assign - not_is_Bool_or_Int: - # internal_31 = internal_37 + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_47 + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing internal_47 + + # Argument internal_53 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_53 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_47 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_47 = internal_53 lw $t0, 8($sp) sw $t0, 32($sp) - end_assign: - # Jumping to branch_end_8779768528306 - j branch_end_8779768528306 + # Jumping to branch_end_8744937301489 + j branch_end_8744937301489 - branch_Bar_8779768528306: + branch_Bar_8744937301489: - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 32($sp) - j end_assign - not_is_Bool_or_Int: - # internal_31 = n + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 236($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 40($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_47 + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing internal_47 + + # Argument n + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing n + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_47 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_47 = n lw $t0, 28($sp) sw $t0, 32($sp) - end_assign: - - # Jumping to branch_end_8779768528306 - j branch_end_8779768528306 - error_branch_8779768528306: + # Jumping to branch_end_8744937301489 + j branch_end_8744937301489 + error_branch_8744937301489: - branch_end_8779768528306: + branch_end_8744937301489: # Set attribute g of self - lw $t0, 160($sp) # $t0 = self - lw $t1, 32($sp) # $t1 = internal_31 - sw $t1, 12($t0) # self.g = internal_31 + lw $t0, 224($sp) # $t0 = self + lw $t1, 32($sp) # $t1 = internal_47 + beq $t1, $zero, object_set_attribute_8744937254169 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937254169 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937254169 + j object_set_attribute_8744937254169 + int_set_attribute_8744937254169: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.g = internal_47 + j end_set_attribute_8744937254169 + bool_set_attribute_8744937254169: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.g = internal_47 + j end_set_attribute_8744937254169 + object_set_attribute_8744937254169: + sw $t1, 12($t0) # self.g = internal_47 + end_set_attribute_8744937254169: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 168($sp) + lw $t0, 232($sp) sw $t0, 0($sp) # Storing self # Calling function function_printh_at_Bazz jal function_printh_at_Bazz lw $ra, 4($sp) - sw $v1, 8($sp) # internal_39 = result of function_printh_at_Bazz + sw $v1, 8($sp) # internal_55 = result of function_printh_at_Bazz addi $sp, $sp, 8 # Freeing space for arguments # Set attribute i of self - lw $t0, 160($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_39 - sw $t1, 16($t0) # self.i = internal_39 + lw $t0, 224($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_55 + beq $t1, $zero, object_set_attribute_8744937254148 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937254148 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937254148 + j object_set_attribute_8744937254148 + int_set_attribute_8744937254148: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.i = internal_55 + j end_set_attribute_8744937254148 + bool_set_attribute_8744937254148: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.i = internal_55 + j end_set_attribute_8744937254148 + object_set_attribute_8744937254148: + sw $t1, 16($t0) # self.i = internal_55 + end_set_attribute_8744937254148: # Loading return value in $v1 - lw $v1, 160($sp) + lw $v1, 224($sp) # Freeing space for local variables - addi $sp, $sp, 160 + addi $sp, $sp, 224 jr $ra @@ -6821,7 +15303,38 @@ # Get attribute h of self lw $t0, 12($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'h' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8744937257798 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8744937257798 + j object_get_attribute_8744937257798 + int_get_attribute_8744937257798: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_0 = self.h + j end_get_attribute_8744937257798 + bool_get_attribute_8744937257798: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_0 = self.h + j end_get_attribute_8744937257798 + object_get_attribute_8744937257798: sw $t1, 8($sp) # internal_0 = h + end_get_attribute_8744937257798: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -6872,29 +15385,92 @@ # Get attribute h of self lw $t0, 20($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'h' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8744937257864 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8744937257864 + j object_get_attribute_8744937257864 + int_get_attribute_8744937257864: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_1 = self.h + j end_get_attribute_8744937257864 + bool_get_attribute_8744937257864: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_1 = self.h + j end_get_attribute_8744937257864 + object_get_attribute_8744937257864: sw $t1, 12($sp) # internal_1 = h + end_get_attribute_8744937257864: - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 16($sp) - j end_assign - not_is_Bool_or_Int: - # i = internal_1 - lw $t0, 12($sp) - sw $t0, 16($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_1 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 28($sp) # i = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Get attribute h of self lw $t0, 20($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'h' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8744937257930 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8744937257930 + j object_get_attribute_8744937257930 + int_get_attribute_8744937257930: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_2 = self.h + j end_get_attribute_8744937257930 + bool_get_attribute_8744937257930: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_2 = self.h + j end_get_attribute_8744937257930 + object_get_attribute_8744937257930: sw $t1, 8($sp) # internal_2 = h + end_get_attribute_8744937257930: # Allocating Int 1 li $v0, 9 @@ -6929,7 +15505,39 @@ # Set attribute h of self lw $t0, 20($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_4 + beq $t1, $zero, object_set_attribute_8744937257906 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937257906 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937257906 + j object_set_attribute_8744937257906 + int_set_attribute_8744937257906: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.h = internal_4 + j end_set_attribute_8744937257906 + bool_set_attribute_8744937257906: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.h = internal_4 + j end_set_attribute_8744937257906 + object_set_attribute_8744937257906: sw $t1, 8($t0) # self.h = internal_4 + end_set_attribute_8744937257906: # Loading return value in $v1 lw $v1, 16($sp) @@ -6973,7 +15581,39 @@ # Set attribute a of self lw $t0, 16($sp) # $t0 = self lw $t1, 12($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8744937257978 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937257978 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937257978 + j object_set_attribute_8744937257978 + int_set_attribute_8744937257978: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.a = internal_0 + j end_set_attribute_8744937257978 + bool_set_attribute_8744937257978: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.a = internal_0 + j end_set_attribute_8744937257978 + object_set_attribute_8744937257978: sw $t1, 8($t0) # self.a = internal_0 + end_set_attribute_8744937257978: # Allocating Foo li $v0, 9 @@ -7001,7 +15641,39 @@ # Set attribute b of self lw $t0, 16($sp) # $t0 = self lw $t1, 8($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8744937258530 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937258530 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937258530 + j object_set_attribute_8744937258530 + int_set_attribute_8744937258530: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.b = internal_1 + j end_set_attribute_8744937258530 + bool_set_attribute_8744937258530: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.b = internal_1 + j end_set_attribute_8744937258530 + object_set_attribute_8744937258530: sw $t1, 12($t0) # self.b = internal_1 + end_set_attribute_8744937258530: # Allocating Razz li $v0, 9 @@ -7029,7 +15701,39 @@ # Set attribute c of self lw $t0, 16($sp) # $t0 = self lw $t1, 4($sp) # $t1 = internal_2 + beq $t1, $zero, object_set_attribute_8744937258560 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937258560 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937258560 + j object_set_attribute_8744937258560 + int_set_attribute_8744937258560: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.c = internal_2 + j end_set_attribute_8744937258560 + bool_set_attribute_8744937258560: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.c = internal_2 + j end_set_attribute_8744937258560 + object_set_attribute_8744937258560: sw $t1, 16($t0) # self.c = internal_2 + end_set_attribute_8744937258560: # Allocating Bar li $v0, 9 @@ -7057,7 +15761,39 @@ # Set attribute d of self lw $t0, 16($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_3 + beq $t1, $zero, object_set_attribute_8744937258593 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8744937258593 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8744937258593 + j object_set_attribute_8744937258593 + int_set_attribute_8744937258593: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.d = internal_3 + j end_set_attribute_8744937258593 + bool_set_attribute_8744937258593: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.d = internal_3 + j end_set_attribute_8744937258593 + object_set_attribute_8744937258593: sw $t1, 20($t0) # self.d = internal_3 + end_set_attribute_8744937258593: # Loading return value in $v1 lw $v1, 16($sp) @@ -7083,7 +15819,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 10 + addi $t0, $zero, 19 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 100 diff --git a/tests/codegen/hello_world.mips b/tests/codegen/hello_world.mips index 13b7ed03d..36ea4cb0d 100644 --- a/tests/codegen/hello_world.mips +++ b/tests/codegen/hello_world.mips @@ -4,36 +4,42 @@ type_Object_attributes: .word 0 type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" + type_Object_abort_message: .asciiz "Abort called from class Object\n" type_IO: .word 8 type_IO_inherits_from: .word type_Object type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" + type_IO_abort_message: .asciiz "Abort called from class IO\n" type_Int: .word 8 type_Int_inherits_from: .word type_Object type_Int_attributes: .word 0 type_Int_name_size: .word 3 type_Int_name: .asciiz "Int" + type_Int_abort_message: .asciiz "Abort called from class Int\n" type_String: .word 8 type_String_inherits_from: .word type_Object type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" + type_String_abort_message: .asciiz "Abort called from class String\n" type_Bool: .word 8 type_Bool_inherits_from: .word type_Object type_Bool_attributes: .word 0 type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" + type_Bool_abort_message: .asciiz "Abort called from class Bool\n" type_Main: .word 8 type_Main_inherits_from: .word type_IO type_Main_attributes: .word 0 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" + type_Main_abort_message: .asciiz "Abort called from class Main\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -316,12 +322,12 @@ function_equal: # Function parameters - # $ra = 40($sp) - # a = 36($sp) - # b = 32($sp) + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) # Reserving space for local variables - addi $sp, $sp, -32 + addi $sp, $sp, -40 # Allocating Bool 0 li $v0, 9 @@ -333,22 +339,57 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_0 = address of allocated object Int + sw $v0, 36($sp) # internal_0 = address of allocated object Int - # internal_1 = typeof a that is the first word of the object - lw $t0, 36($sp) - lw $t1, 0($t0) - sw $t1, 24($sp) + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) - # internal_2 = direction of Int + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int la $t0, type_Int sw $t0, 20($sp) - # internal_3 = direction of Bool + # internal_5 = direction of Bool la $t0, type_Bool sw $t0, 16($sp) - # internal_4 = direction of String + # internal_6 = direction of String la $t0, type_String sw $t0, 12($sp) @@ -362,7 +403,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_5 = address of allocated object Int + sw $v0, 8($sp) # internal_7 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -374,7 +415,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_6 = address of allocated object Int + sw $v0, 4($sp) # internal_8 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -386,42 +427,42 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_7 = address of allocated object Int + sw $v0, 0($sp) # internal_9 = address of allocated object Int - # internal_5 = EqualAddress(internal_1, internal_2) + # internal_7 = EqualAddress(internal_3, internal_4) lw $t0, 24($sp) lw $t1, 20($sp) seq $t2, $t0, $t1 lw $t0, 8($sp) sw $t2, 8($t0) - # internal_6 = EqualAddress(internal_1, internal_3) + # internal_8 = EqualAddress(internal_3, internal_5) lw $t0, 24($sp) lw $t1, 16($sp) seq $t2, $t0, $t1 lw $t0, 4($sp) sw $t2, 8($t0) - # internal_7 = EqualAddress(internal_1, internal_4) + # internal_9 = EqualAddress(internal_3, internal_6) lw $t0, 24($sp) lw $t1, 12($sp) seq $t2, $t0, $t1 lw $t0, 0($sp) sw $t2, 8($t0) - # If internal_5 then goto a_is_type_int_or_bool + # If internal_7 then goto a_is_type_int_or_bool lw $t0, 8($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison beq $t0, $t1, a_is_type_int_or_bool - # If internal_6 then goto a_is_type_int_or_bool + # If internal_8 then goto a_is_type_int_or_bool lw $t0, 4($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison beq $t0, $t1, a_is_type_int_or_bool - # If internal_7 then goto a_is_type_string + # If internal_9 then goto a_is_type_string lw $t0, 0($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison @@ -433,12 +474,12 @@ a_is_type_int_or_bool: # internal_0 = EqualInt(a, b) - lw $t0, 36($sp) + lw $t0, 44($sp) lw $t0, 8($t0) - lw $t1, 32($sp) + lw $t1, 40($sp) lw $t1, 8($t1) seq $t2, $t0, $t1 - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t2, 8($t0) # Jumping to end_of_equal @@ -447,14 +488,14 @@ a_is_type_string: # internal_0 = EqualStr(a, b) - lw $t0, 36($sp) - lw $t1, 32($sp) + lw $t0, 44($sp) + lw $t1, 40($sp) addi $t0, $t0, 8 addi $t1, $t1, 8 # By default we assume the strings are equals addi $t4, $zero, 1 - lw $t5, 28($sp) + lw $t5, 36($sp) sw $t4, 8($t5) while_compare_strings_start: @@ -463,7 +504,7 @@ beq $t2, $t3, while_compare_strings_update # The strings are no equals - lw $t5, 28($sp) + lw $t5, 36($sp) sw $zero, 8($t5) j while_compare_strings_end @@ -471,6 +512,7 @@ addi $t0, $t0, 1 addi $t1, $t1, 1 beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end j while_compare_strings_start while_compare_strings_end: @@ -480,11 +522,11 @@ a_is_type_object: # Equal operation - lw $t0, 36($sp) # Save in $t0 the left operand address - lw $t1, 32($sp) # Save in $t1 the right operand address + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address seq $t2, $t0, $t1 # $t2 = $t0 == $t1 - lw $t0, 28($sp) # $t0 = internal_0 + lw $t0, 36($sp) # $t0 = internal_0 sw $t2, 8($t0) # Setting value in the third word of the Bool object # Jumping to end_of_equal @@ -493,10 +535,156 @@ end_of_equal: # Loading return value in $v1 - lw $v1, 28($sp) + lw $v1, 36($sp) # Freeing space for local variables - addi $sp, $sp, 32 + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 jr $ra @@ -512,15 +700,184 @@ function_abort_at_Object: # Function parameters - # $ra = 4($sp) - # self = 0($sp) + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_2[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_2 = "\n" + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_type_name_at_Object + jal function_type_name_at_Object + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 12($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) # $t0 = internal_3 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string internal_3 + li $v0, 4 + move $a0, $t0 + syscall # Exit program li $v0, 10 syscall # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 jr $ra @@ -536,7 +893,7 @@ lw $t0, 4($sp) # $t0 = self lw $t1, 0($t0) # $t1 = type of self lw $t2, 12($t1) # $t1 = length of the name of self - lw $t3, 16($t1) # $t1 = name of self + la $t3, 16($t1) # $t1 = name of self addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 @@ -546,26 +903,24 @@ la $t4, type_String sw $t4, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - move $t4, $v0 # $t4 = direction of the new string + addi $t4, $v0, 0 # $t4 = direction of the new string addi $t4, $t4, 8 # Pointer to the first character of the string - addi $t0, $t0, 8 # Pointer to the first character of the string in self xor $t5, $t5, $t5 # Initializing counter while_copy_name_start: - beq $t5, $t1, while_copy_name_end - lb $t6, 0($t0) # Loading the character + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character sb $t6, 0($t4) addi $t4, $t4, 1 # Incrementing the pointer to the new string - addi $t0, $t0, 1 # Incrementing the pointer to the string in self + addi $t3, $t3, 1 # Incrementing the pointer to the string in self addi $t5, $t5, 1 # Incrementing counter j while_copy_name_start while_copy_name_end: sb $zero, 0($t4) # Setting the null byte - sw $t4, 0($sp) # Storing the new string in internal_0 + sw $v0, 0($sp) # Storing the new string in internal_0 # Loading return value in $v1 lw $v1, 0($sp) @@ -683,16 +1038,18 @@ xor $t0, $t0, $t0 # Initializing counter while_read_start: - lw $t1, buffer_input($t0) # Loading the byte + lb $t1, buffer_input($t0) # Loading the byte beq $t1, $zero, while_read_end addi $t0, $t0, 1 # Incrementing counter j while_read_start while_read_end: + addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 move $a0, $t0 syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte la $t2, type_String sw $t2, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting length in the second word of the object @@ -702,7 +1059,7 @@ while_copy_from_buffer_start: beq $t4, $t0, while_copy_from_buffer_end - lw $t5, buffer_input($t4) # Loading the byte + lb $t5, buffer_input($t4) # Loading the byte sb $t5, 0($t3) # Storing the byte addi $t3, $t3, 1 # Imcremeenting pointer addi $t4, $t4, 1 # Incrementing counter @@ -729,9 +1086,22 @@ # Reserving space for local variables addi $sp, $sp, -4 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + li $v0, 5 syscall - sw $v0, 0($sp) # Storing the new object in internal_0 + lw $t0, 0($sp) + sw $v0, 8($t0) # Loading return value in $v1 lw $v1, 0($sp) @@ -759,11 +1129,24 @@ # Reserving space for local variables addi $sp, $sp, -4 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + # internal_0 = length of self lw $t0, 4($sp) lw $t1, 4($t0) addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator - sw $t1, 0($sp) + lw $t0, 0($sp) + sw $t1, 8($t0) # Loading return value in $v1 lw $v1, 0($sp) @@ -787,6 +1170,8 @@ lw $t1, 4($sp) lw $t2, 4($t0) # $t2 = length of str1 lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 add $t4, $t2, $t3 # $t4 = length of str1 + str2 addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) @@ -806,7 +1191,7 @@ xor $t6, $t6, $t6 # $t6 = 0 Initializing counter while_copy_str1_start: beq $t6, $t2, while_copy_str1_end - lb $t7, 0($t0) + lb $t7, 8($t0) sb $t7, 0($t5) add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string @@ -817,7 +1202,7 @@ # Copying str2 to the new string while_copy_str2_start: beq $t6, $t4, while_copy_str2_end - lb $t7, 0($t1) + lb $t7, 8($t1) sb $t7, 0($t5) add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string @@ -850,11 +1235,14 @@ # internal_0 = self[i:i + l] lw $t0, 12($sp) # $t0 = address of the string lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring - bge $t4, $t1, substring_out_of_bounds + bgt $t4, $t1, substring_out_of_bounds addi $t3, $t3, 9 li $v0, 9 @@ -928,7 +1316,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 14 + addi $t0, $zero, 23 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 72 diff --git a/tests/codegen/io.mips b/tests/codegen/io.mips index 0bcd6c0cb..92427642c 100644 --- a/tests/codegen/io.mips +++ b/tests/codegen/io.mips @@ -4,60 +4,70 @@ type_Object_attributes: .word 0 type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" + type_Object_abort_message: .asciiz "Abort called from class Object\n" type_IO: .word 8 type_IO_inherits_from: .word type_Object type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" + type_IO_abort_message: .asciiz "Abort called from class IO\n" type_Int: .word 8 type_Int_inherits_from: .word type_Object type_Int_attributes: .word 0 type_Int_name_size: .word 3 type_Int_name: .asciiz "Int" + type_Int_abort_message: .asciiz "Abort called from class Int\n" type_String: .word 8 type_String_inherits_from: .word type_Object type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" + type_String_abort_message: .asciiz "Abort called from class String\n" type_Bool: .word 8 type_Bool_inherits_from: .word type_Object type_Bool_attributes: .word 0 type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" + type_Bool_abort_message: .asciiz "Abort called from class Bool\n" type_A: .word 12 type_A_inherits_from: .word type_Object type_A_attributes: .word 1 type_A_name_size: .word 1 type_A_name: .asciiz "A" + type_A_abort_message: .asciiz "Abort called from class A\n" type_B: .word 12 type_B_inherits_from: .word type_A type_B_attributes: .word 1 type_B_name_size: .word 1 type_B_name: .asciiz "B" + type_B_abort_message: .asciiz "Abort called from class B\n" type_C: .word 8 type_C_inherits_from: .word type_IO type_C_attributes: .word 0 type_C_name_size: .word 1 type_C_name: .asciiz "C" + type_C_abort_message: .asciiz "Abort called from class C\n" type_D: .word 8 type_D_inherits_from: .word type_C type_D_attributes: .word 0 type_D_name_size: .word 1 type_D_name: .asciiz "D" + type_D_abort_message: .asciiz "Abort called from class D\n" type_Main: .word 8 type_Main_inherits_from: .word type_IO type_Main_attributes: .word 0 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" + type_Main_abort_message: .asciiz "Abort called from class Main\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -340,12 +350,12 @@ function_equal: # Function parameters - # $ra = 40($sp) - # a = 36($sp) - # b = 32($sp) + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) # Reserving space for local variables - addi $sp, $sp, -32 + addi $sp, $sp, -40 # Allocating Bool 0 li $v0, 9 @@ -357,22 +367,57 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_0 = address of allocated object Int + sw $v0, 36($sp) # internal_0 = address of allocated object Int - # internal_1 = typeof a that is the first word of the object - lw $t0, 36($sp) - lw $t1, 0($t0) - sw $t1, 24($sp) + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) - # internal_2 = direction of Int + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int la $t0, type_Int sw $t0, 20($sp) - # internal_3 = direction of Bool + # internal_5 = direction of Bool la $t0, type_Bool sw $t0, 16($sp) - # internal_4 = direction of String + # internal_6 = direction of String la $t0, type_String sw $t0, 12($sp) @@ -386,7 +431,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_5 = address of allocated object Int + sw $v0, 8($sp) # internal_7 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -398,7 +443,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_6 = address of allocated object Int + sw $v0, 4($sp) # internal_8 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -410,42 +455,42 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_7 = address of allocated object Int + sw $v0, 0($sp) # internal_9 = address of allocated object Int - # internal_5 = EqualAddress(internal_1, internal_2) + # internal_7 = EqualAddress(internal_3, internal_4) lw $t0, 24($sp) lw $t1, 20($sp) seq $t2, $t0, $t1 lw $t0, 8($sp) sw $t2, 8($t0) - # internal_6 = EqualAddress(internal_1, internal_3) + # internal_8 = EqualAddress(internal_3, internal_5) lw $t0, 24($sp) lw $t1, 16($sp) seq $t2, $t0, $t1 lw $t0, 4($sp) sw $t2, 8($t0) - # internal_7 = EqualAddress(internal_1, internal_4) + # internal_9 = EqualAddress(internal_3, internal_6) lw $t0, 24($sp) lw $t1, 12($sp) seq $t2, $t0, $t1 lw $t0, 0($sp) sw $t2, 8($t0) - # If internal_5 then goto a_is_type_int_or_bool + # If internal_7 then goto a_is_type_int_or_bool lw $t0, 8($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison beq $t0, $t1, a_is_type_int_or_bool - # If internal_6 then goto a_is_type_int_or_bool + # If internal_8 then goto a_is_type_int_or_bool lw $t0, 4($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison beq $t0, $t1, a_is_type_int_or_bool - # If internal_7 then goto a_is_type_string + # If internal_9 then goto a_is_type_string lw $t0, 0($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison @@ -457,12 +502,12 @@ a_is_type_int_or_bool: # internal_0 = EqualInt(a, b) - lw $t0, 36($sp) + lw $t0, 44($sp) lw $t0, 8($t0) - lw $t1, 32($sp) + lw $t1, 40($sp) lw $t1, 8($t1) seq $t2, $t0, $t1 - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t2, 8($t0) # Jumping to end_of_equal @@ -471,14 +516,14 @@ a_is_type_string: # internal_0 = EqualStr(a, b) - lw $t0, 36($sp) - lw $t1, 32($sp) + lw $t0, 44($sp) + lw $t1, 40($sp) addi $t0, $t0, 8 addi $t1, $t1, 8 # By default we assume the strings are equals addi $t4, $zero, 1 - lw $t5, 28($sp) + lw $t5, 36($sp) sw $t4, 8($t5) while_compare_strings_start: @@ -487,7 +532,7 @@ beq $t2, $t3, while_compare_strings_update # The strings are no equals - lw $t5, 28($sp) + lw $t5, 36($sp) sw $zero, 8($t5) j while_compare_strings_end @@ -495,6 +540,7 @@ addi $t0, $t0, 1 addi $t1, $t1, 1 beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end j while_compare_strings_start while_compare_strings_end: @@ -504,11 +550,11 @@ a_is_type_object: # Equal operation - lw $t0, 36($sp) # Save in $t0 the left operand address - lw $t1, 32($sp) # Save in $t1 the right operand address + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address seq $t2, $t0, $t1 # $t2 = $t0 == $t1 - lw $t0, 28($sp) # $t0 = internal_0 + lw $t0, 36($sp) # $t0 = internal_0 sw $t2, 8($t0) # Setting value in the third word of the Bool object # Jumping to end_of_equal @@ -517,10 +563,156 @@ end_of_equal: # Loading return value in $v1 - lw $v1, 28($sp) + lw $v1, 36($sp) # Freeing space for local variables - addi $sp, $sp, 32 + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 jr $ra @@ -536,15 +728,184 @@ function_abort_at_Object: # Function parameters - # $ra = 4($sp) - # self = 0($sp) + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_2[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_2 = "\n" + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_type_name_at_Object + jal function_type_name_at_Object + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 12($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) # $t0 = internal_3 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string internal_3 + li $v0, 4 + move $a0, $t0 + syscall # Exit program li $v0, 10 syscall # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 jr $ra @@ -560,7 +921,7 @@ lw $t0, 4($sp) # $t0 = self lw $t1, 0($t0) # $t1 = type of self lw $t2, 12($t1) # $t1 = length of the name of self - lw $t3, 16($t1) # $t1 = name of self + la $t3, 16($t1) # $t1 = name of self addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 @@ -570,26 +931,24 @@ la $t4, type_String sw $t4, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - move $t4, $v0 # $t4 = direction of the new string + addi $t4, $v0, 0 # $t4 = direction of the new string addi $t4, $t4, 8 # Pointer to the first character of the string - addi $t0, $t0, 8 # Pointer to the first character of the string in self xor $t5, $t5, $t5 # Initializing counter while_copy_name_start: - beq $t5, $t1, while_copy_name_end - lb $t6, 0($t0) # Loading the character + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character sb $t6, 0($t4) addi $t4, $t4, 1 # Incrementing the pointer to the new string - addi $t0, $t0, 1 # Incrementing the pointer to the string in self + addi $t3, $t3, 1 # Incrementing the pointer to the string in self addi $t5, $t5, 1 # Incrementing counter j while_copy_name_start while_copy_name_end: sb $zero, 0($t4) # Setting the null byte - sw $t4, 0($sp) # Storing the new string in internal_0 + sw $v0, 0($sp) # Storing the new string in internal_0 # Loading return value in $v1 lw $v1, 0($sp) @@ -707,16 +1066,18 @@ xor $t0, $t0, $t0 # Initializing counter while_read_start: - lw $t1, buffer_input($t0) # Loading the byte + lb $t1, buffer_input($t0) # Loading the byte beq $t1, $zero, while_read_end addi $t0, $t0, 1 # Incrementing counter j while_read_start while_read_end: + addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 move $a0, $t0 syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte la $t2, type_String sw $t2, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting length in the second word of the object @@ -726,7 +1087,7 @@ while_copy_from_buffer_start: beq $t4, $t0, while_copy_from_buffer_end - lw $t5, buffer_input($t4) # Loading the byte + lb $t5, buffer_input($t4) # Loading the byte sb $t5, 0($t3) # Storing the byte addi $t3, $t3, 1 # Imcremeenting pointer addi $t4, $t4, 1 # Incrementing counter @@ -753,9 +1114,22 @@ # Reserving space for local variables addi $sp, $sp, -4 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + li $v0, 5 syscall - sw $v0, 0($sp) # Storing the new object in internal_0 + lw $t0, 0($sp) + sw $v0, 8($t0) # Loading return value in $v1 lw $v1, 0($sp) @@ -783,11 +1157,24 @@ # Reserving space for local variables addi $sp, $sp, -4 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + # internal_0 = length of self lw $t0, 4($sp) lw $t1, 4($t0) addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator - sw $t1, 0($sp) + lw $t0, 0($sp) + sw $t1, 8($t0) # Loading return value in $v1 lw $v1, 0($sp) @@ -811,6 +1198,8 @@ lw $t1, 4($sp) lw $t2, 4($t0) # $t2 = length of str1 lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 add $t4, $t2, $t3 # $t4 = length of str1 + str2 addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) @@ -830,7 +1219,7 @@ xor $t6, $t6, $t6 # $t6 = 0 Initializing counter while_copy_str1_start: beq $t6, $t2, while_copy_str1_end - lb $t7, 0($t0) + lb $t7, 8($t0) sb $t7, 0($t5) add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string @@ -841,7 +1230,7 @@ # Copying str2 to the new string while_copy_str2_start: beq $t6, $t4, while_copy_str2_end - lb $t7, 0($t1) + lb $t7, 8($t1) sb $t7, 0($t5) add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string @@ -874,11 +1263,14 @@ # internal_0 = self[i:i + l] lw $t0, 12($sp) # $t0 = address of the string lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring - bge $t4, $t1, substring_out_of_bounds + bgt $t4, $t1, substring_out_of_bounds addi $t3, $t3, 9 li $v0, 9 @@ -960,7 +1352,39 @@ # Set attribute io of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8735122690286 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8735122690286 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8735122690286 + j object_set_attribute_8735122690286 + int_set_attribute_8735122690286: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.io = internal_0 + j end_set_attribute_8735122690286 + bool_set_attribute_8735122690286: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.io = internal_0 + j end_set_attribute_8735122690286 + object_set_attribute_8735122690286: sw $t1, 8($t0) # self.io = internal_0 + end_set_attribute_8735122690286: # Loading return value in $v1 lw $v1, 4($sp) @@ -981,7 +1405,38 @@ # Get attribute io of self lw $t0, 12($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'io' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8735122690850 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8735122690850 + j object_get_attribute_8735122690850 + int_get_attribute_8735122690850: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_0 = self.io + j end_get_attribute_8735122690850 + bool_get_attribute_8735122690850: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_0 = self.io + j end_get_attribute_8735122690850 + object_get_attribute_8735122690850: sw $t1, 8($sp) # internal_0 = io + end_get_attribute_8735122690850: # Allocating String li $v0, 9 @@ -991,7 +1446,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 15 + addi $t0, $zero, 24 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 65 @@ -1103,7 +1558,39 @@ # Set attribute io of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8735122690925 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8735122690925 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8735122690925 + j object_set_attribute_8735122690925 + int_set_attribute_8735122690925: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.io = internal_0 + j end_set_attribute_8735122690925 + bool_set_attribute_8735122690925: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.io = internal_0 + j end_set_attribute_8735122690925 + object_set_attribute_8735122690925: sw $t1, 8($t0) # self.io = internal_0 + end_set_attribute_8735122690925: # Loading return value in $v1 lw $v1, 4($sp) @@ -1124,7 +1611,38 @@ # Get attribute io of self lw $t0, 12($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'io' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8735122690973 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8735122690973 + j object_get_attribute_8735122690973 + int_get_attribute_8735122690973: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_0 = self.io + j end_get_attribute_8735122690973 + bool_get_attribute_8735122690973: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_0 = self.io + j end_get_attribute_8735122690973 + object_get_attribute_8735122690973: sw $t1, 8($sp) # internal_0 = io + end_get_attribute_8735122690973: # Allocating String li $v0, 9 @@ -1134,7 +1652,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 15 + addi $t0, $zero, 24 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 66 @@ -1238,7 +1756,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 15 + addi $t0, $zero, 24 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 67 @@ -1342,7 +1860,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 15 + addi $t0, $zero, 24 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 68 @@ -1594,7 +2112,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 6 + addi $t0, $zero, 15 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 68 diff --git a/tests/codegen/life.mips b/tests/codegen/life.mips index 7ee334565..a63beffb4 100644 --- a/tests/codegen/life.mips +++ b/tests/codegen/life.mips @@ -4,48 +4,56 @@ type_Object_attributes: .word 0 type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" + type_Object_abort_message: .asciiz "Abort called from class Object\n" type_IO: .word 8 type_IO_inherits_from: .word type_Object type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" + type_IO_abort_message: .asciiz "Abort called from class IO\n" type_Int: .word 8 type_Int_inherits_from: .word type_Object type_Int_attributes: .word 0 type_Int_name_size: .word 3 type_Int_name: .asciiz "Int" + type_Int_abort_message: .asciiz "Abort called from class Int\n" type_String: .word 8 type_String_inherits_from: .word type_Object type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" + type_String_abort_message: .asciiz "Abort called from class String\n" type_Bool: .word 8 type_Bool_inherits_from: .word type_Object type_Bool_attributes: .word 0 type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" + type_Bool_abort_message: .asciiz "Abort called from class Bool\n" type_Board: .word 20 type_Board_inherits_from: .word type_IO type_Board_attributes: .word 3 type_Board_name_size: .word 5 type_Board_name: .asciiz "Board" + type_Board_abort_message: .asciiz "Abort called from class Board\n" type_CellularAutomaton: .word 24 type_CellularAutomaton_inherits_from: .word type_Board type_CellularAutomaton_attributes: .word 4 type_CellularAutomaton_name_size: .word 17 type_CellularAutomaton_name: .asciiz "CellularAutomaton" + type_CellularAutomaton_abort_message: .asciiz "Abort called from class CellularAutomaton\n" type_Main: .word 28 type_Main_inherits_from: .word type_CellularAutomaton type_Main_attributes: .word 5 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" + type_Main_abort_message: .asciiz "Abort called from class Main\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -328,12 +336,12 @@ function_equal: # Function parameters - # $ra = 40($sp) - # a = 36($sp) - # b = 32($sp) + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) # Reserving space for local variables - addi $sp, $sp, -32 + addi $sp, $sp, -40 # Allocating Bool 0 li $v0, 9 @@ -345,22 +353,57 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_0 = address of allocated object Int + sw $v0, 36($sp) # internal_0 = address of allocated object Int - # internal_1 = typeof a that is the first word of the object - lw $t0, 36($sp) - lw $t1, 0($t0) - sw $t1, 24($sp) + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int - # internal_2 = direction of Int + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int la $t0, type_Int sw $t0, 20($sp) - # internal_3 = direction of Bool + # internal_5 = direction of Bool la $t0, type_Bool sw $t0, 16($sp) - # internal_4 = direction of String + # internal_6 = direction of String la $t0, type_String sw $t0, 12($sp) @@ -374,7 +417,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_5 = address of allocated object Int + sw $v0, 8($sp) # internal_7 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -386,7 +429,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_6 = address of allocated object Int + sw $v0, 4($sp) # internal_8 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -398,42 +441,42 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_7 = address of allocated object Int + sw $v0, 0($sp) # internal_9 = address of allocated object Int - # internal_5 = EqualAddress(internal_1, internal_2) + # internal_7 = EqualAddress(internal_3, internal_4) lw $t0, 24($sp) lw $t1, 20($sp) seq $t2, $t0, $t1 lw $t0, 8($sp) sw $t2, 8($t0) - # internal_6 = EqualAddress(internal_1, internal_3) + # internal_8 = EqualAddress(internal_3, internal_5) lw $t0, 24($sp) lw $t1, 16($sp) seq $t2, $t0, $t1 lw $t0, 4($sp) sw $t2, 8($t0) - # internal_7 = EqualAddress(internal_1, internal_4) + # internal_9 = EqualAddress(internal_3, internal_6) lw $t0, 24($sp) lw $t1, 12($sp) seq $t2, $t0, $t1 lw $t0, 0($sp) sw $t2, 8($t0) - # If internal_5 then goto a_is_type_int_or_bool + # If internal_7 then goto a_is_type_int_or_bool lw $t0, 8($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison beq $t0, $t1, a_is_type_int_or_bool - # If internal_6 then goto a_is_type_int_or_bool + # If internal_8 then goto a_is_type_int_or_bool lw $t0, 4($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison beq $t0, $t1, a_is_type_int_or_bool - # If internal_7 then goto a_is_type_string + # If internal_9 then goto a_is_type_string lw $t0, 0($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison @@ -445,12 +488,12 @@ a_is_type_int_or_bool: # internal_0 = EqualInt(a, b) - lw $t0, 36($sp) + lw $t0, 44($sp) lw $t0, 8($t0) - lw $t1, 32($sp) + lw $t1, 40($sp) lw $t1, 8($t1) seq $t2, $t0, $t1 - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t2, 8($t0) # Jumping to end_of_equal @@ -459,14 +502,14 @@ a_is_type_string: # internal_0 = EqualStr(a, b) - lw $t0, 36($sp) - lw $t1, 32($sp) + lw $t0, 44($sp) + lw $t1, 40($sp) addi $t0, $t0, 8 addi $t1, $t1, 8 # By default we assume the strings are equals addi $t4, $zero, 1 - lw $t5, 28($sp) + lw $t5, 36($sp) sw $t4, 8($t5) while_compare_strings_start: @@ -475,7 +518,7 @@ beq $t2, $t3, while_compare_strings_update # The strings are no equals - lw $t5, 28($sp) + lw $t5, 36($sp) sw $zero, 8($t5) j while_compare_strings_end @@ -483,6 +526,7 @@ addi $t0, $t0, 1 addi $t1, $t1, 1 beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end j while_compare_strings_start while_compare_strings_end: @@ -492,11 +536,11 @@ a_is_type_object: # Equal operation - lw $t0, 36($sp) # Save in $t0 the left operand address - lw $t1, 32($sp) # Save in $t1 the right operand address + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address seq $t2, $t0, $t1 # $t2 = $t0 == $t1 - lw $t0, 28($sp) # $t0 = internal_0 + lw $t0, 36($sp) # $t0 = internal_0 sw $t2, 8($t0) # Setting value in the third word of the Bool object # Jumping to end_of_equal @@ -505,10 +549,156 @@ end_of_equal: # Loading return value in $v1 - lw $v1, 28($sp) + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) # Freeing space for local variables - addi $sp, $sp, 32 + addi $sp, $sp, 28 jr $ra @@ -522,17 +712,186 @@ jr $ra - function_abort_at_Object: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) + function_abort_at_Object: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_2[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_2 = "\n" + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_type_name_at_Object + jal function_type_name_at_Object + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 12($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) # $t0 = internal_3 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string internal_3 + li $v0, 4 + move $a0, $t0 + syscall # Exit program li $v0, 10 syscall # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 jr $ra @@ -548,7 +907,7 @@ lw $t0, 4($sp) # $t0 = self lw $t1, 0($t0) # $t1 = type of self lw $t2, 12($t1) # $t1 = length of the name of self - lw $t3, 16($t1) # $t1 = name of self + la $t3, 16($t1) # $t1 = name of self addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 @@ -558,26 +917,24 @@ la $t4, type_String sw $t4, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - move $t4, $v0 # $t4 = direction of the new string + addi $t4, $v0, 0 # $t4 = direction of the new string addi $t4, $t4, 8 # Pointer to the first character of the string - addi $t0, $t0, 8 # Pointer to the first character of the string in self xor $t5, $t5, $t5 # Initializing counter while_copy_name_start: - beq $t5, $t1, while_copy_name_end - lb $t6, 0($t0) # Loading the character + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character sb $t6, 0($t4) addi $t4, $t4, 1 # Incrementing the pointer to the new string - addi $t0, $t0, 1 # Incrementing the pointer to the string in self + addi $t3, $t3, 1 # Incrementing the pointer to the string in self addi $t5, $t5, 1 # Incrementing counter j while_copy_name_start while_copy_name_end: sb $zero, 0($t4) # Setting the null byte - sw $t4, 0($sp) # Storing the new string in internal_0 + sw $v0, 0($sp) # Storing the new string in internal_0 # Loading return value in $v1 lw $v1, 0($sp) @@ -695,16 +1052,18 @@ xor $t0, $t0, $t0 # Initializing counter while_read_start: - lw $t1, buffer_input($t0) # Loading the byte + lb $t1, buffer_input($t0) # Loading the byte beq $t1, $zero, while_read_end addi $t0, $t0, 1 # Incrementing counter j while_read_start while_read_end: + addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 move $a0, $t0 syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte la $t2, type_String sw $t2, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting length in the second word of the object @@ -714,7 +1073,7 @@ while_copy_from_buffer_start: beq $t4, $t0, while_copy_from_buffer_end - lw $t5, buffer_input($t4) # Loading the byte + lb $t5, buffer_input($t4) # Loading the byte sb $t5, 0($t3) # Storing the byte addi $t3, $t3, 1 # Imcremeenting pointer addi $t4, $t4, 1 # Incrementing counter @@ -741,9 +1100,22 @@ # Reserving space for local variables addi $sp, $sp, -4 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + li $v0, 5 syscall - sw $v0, 0($sp) # Storing the new object in internal_0 + lw $t0, 0($sp) + sw $v0, 8($t0) # Loading return value in $v1 lw $v1, 0($sp) @@ -771,11 +1143,24 @@ # Reserving space for local variables addi $sp, $sp, -4 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + # internal_0 = length of self lw $t0, 4($sp) lw $t1, 4($t0) addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator - sw $t1, 0($sp) + lw $t0, 0($sp) + sw $t1, 8($t0) # Loading return value in $v1 lw $v1, 0($sp) @@ -799,6 +1184,8 @@ lw $t1, 4($sp) lw $t2, 4($t0) # $t2 = length of str1 lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 add $t4, $t2, $t3 # $t4 = length of str1 + str2 addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) @@ -818,7 +1205,7 @@ xor $t6, $t6, $t6 # $t6 = 0 Initializing counter while_copy_str1_start: beq $t6, $t2, while_copy_str1_end - lb $t7, 0($t0) + lb $t7, 8($t0) sb $t7, 0($t5) add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string @@ -829,7 +1216,7 @@ # Copying str2 to the new string while_copy_str2_start: beq $t6, $t4, while_copy_str2_end - lb $t7, 0($t1) + lb $t7, 8($t1) sb $t7, 0($t5) add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string @@ -862,11 +1249,14 @@ # internal_0 = self[i:i + l] lw $t0, 12($sp) # $t0 = address of the string lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring - bge $t4, $t1, substring_out_of_bounds + bgt $t4, $t1, substring_out_of_bounds addi $t3, $t3, 9 li $v0, 9 @@ -937,7 +1327,39 @@ # Set attribute rows of self lw $t0, 12($sp) # $t0 = self lw $t1, 8($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8768338369229 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338369229 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338369229 + j object_set_attribute_8768338369229 + int_set_attribute_8768338369229: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_0 + j end_set_attribute_8768338369229 + bool_set_attribute_8768338369229: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_0 + j end_set_attribute_8768338369229 + object_set_attribute_8768338369229: sw $t1, 8($t0) # self.rows = internal_0 + end_set_attribute_8768338369229: # Allocating Int 0 li $v0, 9 @@ -954,7 +1376,39 @@ # Set attribute columns of self lw $t0, 12($sp) # $t0 = self lw $t1, 4($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8768338369250 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338369250 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338369250 + j object_set_attribute_8768338369250 + int_set_attribute_8768338369250: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_1 + j end_set_attribute_8768338369250 + bool_set_attribute_8768338369250: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_1 + j end_set_attribute_8768338369250 + object_set_attribute_8768338369250: sw $t1, 12($t0) # self.columns = internal_1 + end_set_attribute_8768338369250: # Allocating Int 0 li $v0, 9 @@ -971,7 +1425,39 @@ # Set attribute board_size of self lw $t0, 12($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_2 + beq $t1, $zero, object_set_attribute_8768338369271 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338369271 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338369271 + j object_set_attribute_8768338369271 + int_set_attribute_8768338369271: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = internal_2 + j end_set_attribute_8768338369271 + bool_set_attribute_8768338369271: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = internal_2 + j end_set_attribute_8768338369271 + object_set_attribute_8768338369271: sw $t1, 16($t0) # self.board_size = internal_2 + end_set_attribute_8768338369271: # Loading return value in $v1 lw $v1, 12($sp) @@ -1039,23 +1525,23 @@ sw $v1, 164($sp) # internal_1 = result of function_size_of_board_at_Board addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 152($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 156($sp) - j end_assign - not_is_Bool_or_Int: - # size = internal_1 - lw $t0, 152($sp) - sw $t0, 156($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument size + lw $t0, 168($sp) + sw $t0, 4($sp) # Storing size + + # Argument internal_1 + lw $t0, 164($sp) + sw $t0, 0($sp) # Storing internal_1 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 168($sp) # size = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bool 0 li $v0, 9 @@ -1099,33 +1585,20 @@ sw $v1, 148($sp) # internal_5 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 136($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 144($sp) - j end_assign - not_is_Bool_or_Int: # internal_3 = internal_5 lw $t0, 136($sp) sw $t0, 144($sp) - end_assign: - # If internal_3 then goto then_8789948665158 + # If internal_3 then goto then_8768338404482 lw $t0, 144($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948665158 + beq $t0, $t1, then_8768338404482 - # Jumping to else_8789948665158 - j else_8789948665158 + # Jumping to else_8768338404482 + j else_8768338404482 - then_8789948665158: + then_8768338404482: # Allocating Int 3 li $v0, 9 @@ -1142,7 +1615,39 @@ # Set attribute rows of self lw $t0, 164($sp) # $t0 = self lw $t1, 132($sp) # $t1 = internal_6 + beq $t1, $zero, object_set_attribute_8768338370320 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338370320 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338370320 + j object_set_attribute_8768338370320 + int_set_attribute_8768338370320: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_6 + j end_set_attribute_8768338370320 + bool_set_attribute_8768338370320: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_6 + j end_set_attribute_8768338370320 + object_set_attribute_8768338370320: sw $t1, 8($t0) # self.rows = internal_6 + end_set_attribute_8768338370320: # Allocating Int 5 li $v0, 9 @@ -1159,35 +1664,85 @@ # Set attribute columns of self lw $t0, 164($sp) # $t0 = self lw $t1, 128($sp) # $t1 = internal_7 + beq $t1, $zero, object_set_attribute_8768338370341 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338370341 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338370341 + j object_set_attribute_8768338370341 + int_set_attribute_8768338370341: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_7 + j end_set_attribute_8768338370341 + bool_set_attribute_8768338370341: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_7 + j end_set_attribute_8768338370341 + object_set_attribute_8768338370341: sw $t1, 12($t0) # self.columns = internal_7 + end_set_attribute_8768338370341: # Set attribute board_size of self lw $t0, 164($sp) # $t0 = self lw $t1, 156($sp) # $t1 = size + beq $t1, $zero, object_set_attribute_8768338370362 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338370362 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338370362 + j object_set_attribute_8768338370362 + int_set_attribute_8768338370362: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = size + j end_set_attribute_8768338370362 + bool_set_attribute_8768338370362: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = size + j end_set_attribute_8768338370362 + object_set_attribute_8768338370362: sw $t1, 16($t0) # self.board_size = size + end_set_attribute_8768338370362: - lw $t0, 156($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 148($sp) - j end_assign - not_is_Bool_or_Int: # internal_2 = size lw $t0, 156($sp) sw $t0, 148($sp) - end_assign: - - # Jumping to endif_8789948665158 - j endif_8789948665158 - else_8789948665158: + # Jumping to endif_8768338404482 + j endif_8768338404482 + else_8768338404482: # Allocating Bool 0 li $v0, 9 @@ -1231,33 +1786,20 @@ sw $v1, 124($sp) # internal_11 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 112($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 120($sp) - j end_assign - not_is_Bool_or_Int: # internal_9 = internal_11 lw $t0, 112($sp) sw $t0, 120($sp) - end_assign: - # If internal_9 then goto then_8789948665152 + # If internal_9 then goto then_8768338404476 lw $t0, 120($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948665152 + beq $t0, $t1, then_8768338404476 - # Jumping to else_8789948665152 - j else_8789948665152 + # Jumping to else_8768338404476 + j else_8768338404476 - then_8789948665152: + then_8768338404476: # Allocating Int 4 li $v0, 9 @@ -1274,7 +1816,39 @@ # Set attribute rows of self lw $t0, 164($sp) # $t0 = self lw $t1, 108($sp) # $t1 = internal_12 + beq $t1, $zero, object_set_attribute_8768338370494 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338370494 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338370494 + j object_set_attribute_8768338370494 + int_set_attribute_8768338370494: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_12 + j end_set_attribute_8768338370494 + bool_set_attribute_8768338370494: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_12 + j end_set_attribute_8768338370494 + object_set_attribute_8768338370494: sw $t1, 8($t0) # self.rows = internal_12 + end_set_attribute_8768338370494: # Allocating Int 4 li $v0, 9 @@ -1291,35 +1865,85 @@ # Set attribute columns of self lw $t0, 164($sp) # $t0 = self lw $t1, 104($sp) # $t1 = internal_13 + beq $t1, $zero, object_set_attribute_8768338370515 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338370515 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338370515 + j object_set_attribute_8768338370515 + int_set_attribute_8768338370515: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_13 + j end_set_attribute_8768338370515 + bool_set_attribute_8768338370515: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_13 + j end_set_attribute_8768338370515 + object_set_attribute_8768338370515: sw $t1, 12($t0) # self.columns = internal_13 + end_set_attribute_8768338370515: # Set attribute board_size of self lw $t0, 164($sp) # $t0 = self lw $t1, 156($sp) # $t1 = size + beq $t1, $zero, object_set_attribute_8768338370536 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338370536 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338370536 + j object_set_attribute_8768338370536 + int_set_attribute_8768338370536: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = size + j end_set_attribute_8768338370536 + bool_set_attribute_8768338370536: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = size + j end_set_attribute_8768338370536 + object_set_attribute_8768338370536: sw $t1, 16($t0) # self.board_size = size + end_set_attribute_8768338370536: - lw $t0, 156($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 124($sp) - j end_assign - not_is_Bool_or_Int: # internal_8 = size lw $t0, 156($sp) sw $t0, 124($sp) - end_assign: - # Jumping to endif_8789948665152 - j endif_8789948665152 - - else_8789948665152: + # Jumping to endif_8768338404476 + j endif_8768338404476 + else_8768338404476: # Allocating Bool 0 li $v0, 9 @@ -1363,33 +1987,20 @@ sw $v1, 100($sp) # internal_17 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 88($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 96($sp) - j end_assign - not_is_Bool_or_Int: # internal_15 = internal_17 lw $t0, 88($sp) sw $t0, 96($sp) - end_assign: - # If internal_15 then goto then_8789948665146 + # If internal_15 then goto then_8768338404470 lw $t0, 96($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948665146 + beq $t0, $t1, then_8768338404470 - # Jumping to else_8789948665146 - j else_8789948665146 + # Jumping to else_8768338404470 + j else_8768338404470 - then_8789948665146: + then_8768338404470: # Allocating Int 4 li $v0, 9 @@ -1406,7 +2017,39 @@ # Set attribute rows of self lw $t0, 164($sp) # $t0 = self lw $t1, 84($sp) # $t1 = internal_18 + beq $t1, $zero, object_set_attribute_8768338371184 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338371184 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338371184 + j object_set_attribute_8768338371184 + int_set_attribute_8768338371184: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_18 + j end_set_attribute_8768338371184 + bool_set_attribute_8768338371184: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_18 + j end_set_attribute_8768338371184 + object_set_attribute_8768338371184: sw $t1, 8($t0) # self.rows = internal_18 + end_set_attribute_8768338371184: # Allocating Int 5 li $v0, 9 @@ -1423,35 +2066,85 @@ # Set attribute columns of self lw $t0, 164($sp) # $t0 = self lw $t1, 80($sp) # $t1 = internal_19 + beq $t1, $zero, object_set_attribute_8768338371205 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338371205 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338371205 + j object_set_attribute_8768338371205 + int_set_attribute_8768338371205: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_19 + j end_set_attribute_8768338371205 + bool_set_attribute_8768338371205: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_19 + j end_set_attribute_8768338371205 + object_set_attribute_8768338371205: sw $t1, 12($t0) # self.columns = internal_19 + end_set_attribute_8768338371205: # Set attribute board_size of self lw $t0, 164($sp) # $t0 = self lw $t1, 156($sp) # $t1 = size + beq $t1, $zero, object_set_attribute_8768338371226 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338371226 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338371226 + j object_set_attribute_8768338371226 + int_set_attribute_8768338371226: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = size + j end_set_attribute_8768338371226 + bool_set_attribute_8768338371226: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = size + j end_set_attribute_8768338371226 + object_set_attribute_8768338371226: sw $t1, 16($t0) # self.board_size = size + end_set_attribute_8768338371226: - lw $t0, 156($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 100($sp) - j end_assign - not_is_Bool_or_Int: # internal_14 = size lw $t0, 156($sp) sw $t0, 100($sp) - end_assign: - - # Jumping to endif_8789948665146 - j endif_8789948665146 - else_8789948665146: + # Jumping to endif_8768338404470 + j endif_8768338404470 + else_8768338404470: # Allocating Bool 0 li $v0, 9 @@ -1495,33 +2188,20 @@ sw $v1, 76($sp) # internal_23 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 64($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 72($sp) - j end_assign - not_is_Bool_or_Int: # internal_21 = internal_23 lw $t0, 64($sp) sw $t0, 72($sp) - end_assign: - # If internal_21 then goto then_8789948665140 + # If internal_21 then goto then_8768338404464 lw $t0, 72($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948665140 + beq $t0, $t1, then_8768338404464 - # Jumping to else_8789948665140 - j else_8789948665140 + # Jumping to else_8768338404464 + j else_8768338404464 - then_8789948665140: + then_8768338404464: # Allocating Int 3 li $v0, 9 @@ -1538,7 +2218,39 @@ # Set attribute rows of self lw $t0, 164($sp) # $t0 = self lw $t1, 60($sp) # $t1 = internal_24 + beq $t1, $zero, object_set_attribute_8768338371618 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338371618 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338371618 + j object_set_attribute_8768338371618 + int_set_attribute_8768338371618: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_24 + j end_set_attribute_8768338371618 + bool_set_attribute_8768338371618: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_24 + j end_set_attribute_8768338371618 + object_set_attribute_8768338371618: sw $t1, 8($t0) # self.rows = internal_24 + end_set_attribute_8768338371618: # Allocating Int 7 li $v0, 9 @@ -1555,35 +2267,85 @@ # Set attribute columns of self lw $t0, 164($sp) # $t0 = self lw $t1, 56($sp) # $t1 = internal_25 + beq $t1, $zero, object_set_attribute_8768338371639 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338371639 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338371639 + j object_set_attribute_8768338371639 + int_set_attribute_8768338371639: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_25 + j end_set_attribute_8768338371639 + bool_set_attribute_8768338371639: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_25 + j end_set_attribute_8768338371639 + object_set_attribute_8768338371639: sw $t1, 12($t0) # self.columns = internal_25 + end_set_attribute_8768338371639: # Set attribute board_size of self lw $t0, 164($sp) # $t0 = self lw $t1, 156($sp) # $t1 = size + beq $t1, $zero, object_set_attribute_8768338371660 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338371660 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338371660 + j object_set_attribute_8768338371660 + int_set_attribute_8768338371660: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = size + j end_set_attribute_8768338371660 + bool_set_attribute_8768338371660: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = size + j end_set_attribute_8768338371660 + object_set_attribute_8768338371660: sw $t1, 16($t0) # self.board_size = size + end_set_attribute_8768338371660: - lw $t0, 156($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 76($sp) - j end_assign - not_is_Bool_or_Int: # internal_20 = size lw $t0, 156($sp) sw $t0, 76($sp) - end_assign: - # Jumping to endif_8789948665140 - j endif_8789948665140 - - else_8789948665140: + # Jumping to endif_8768338404464 + j endif_8768338404464 + else_8768338404464: # Allocating Bool 0 li $v0, 9 @@ -1627,33 +2389,20 @@ sw $v1, 52($sp) # internal_29 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 40($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 48($sp) - j end_assign - not_is_Bool_or_Int: # internal_27 = internal_29 lw $t0, 40($sp) sw $t0, 48($sp) - end_assign: - # If internal_27 then goto then_8789948665134 + # If internal_27 then goto then_8768338404458 lw $t0, 48($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948665134 + beq $t0, $t1, then_8768338404458 - # Jumping to else_8789948665134 - j else_8789948665134 + # Jumping to else_8768338404458 + j else_8768338404458 - then_8789948665134: + then_8768338404458: # Allocating Int 5 li $v0, 9 @@ -1670,7 +2419,39 @@ # Set attribute rows of self lw $t0, 164($sp) # $t0 = self lw $t1, 36($sp) # $t1 = internal_30 + beq $t1, $zero, object_set_attribute_8768338371792 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338371792 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338371792 + j object_set_attribute_8768338371792 + int_set_attribute_8768338371792: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_30 + j end_set_attribute_8768338371792 + bool_set_attribute_8768338371792: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_30 + j end_set_attribute_8768338371792 + object_set_attribute_8768338371792: sw $t1, 8($t0) # self.rows = internal_30 + end_set_attribute_8768338371792: # Allocating Int 5 li $v0, 9 @@ -1687,35 +2468,85 @@ # Set attribute columns of self lw $t0, 164($sp) # $t0 = self lw $t1, 32($sp) # $t1 = internal_31 + beq $t1, $zero, object_set_attribute_8768338371813 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338371813 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338371813 + j object_set_attribute_8768338371813 + int_set_attribute_8768338371813: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_31 + j end_set_attribute_8768338371813 + bool_set_attribute_8768338371813: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_31 + j end_set_attribute_8768338371813 + object_set_attribute_8768338371813: sw $t1, 12($t0) # self.columns = internal_31 + end_set_attribute_8768338371813: # Set attribute board_size of self lw $t0, 164($sp) # $t0 = self lw $t1, 156($sp) # $t1 = size + beq $t1, $zero, object_set_attribute_8768338371834 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338371834 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338371834 + j object_set_attribute_8768338371834 + int_set_attribute_8768338371834: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = size + j end_set_attribute_8768338371834 + bool_set_attribute_8768338371834: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = size + j end_set_attribute_8768338371834 + object_set_attribute_8768338371834: sw $t1, 16($t0) # self.board_size = size + end_set_attribute_8768338371834: - lw $t0, 156($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: # internal_26 = size lw $t0, 156($sp) sw $t0, 52($sp) - end_assign: - - # Jumping to endif_8789948665134 - j endif_8789948665134 - else_8789948665134: + # Jumping to endif_8768338404458 + j endif_8768338404458 + else_8768338404458: # Allocating Bool 0 li $v0, 9 @@ -1759,33 +2590,20 @@ sw $v1, 28($sp) # internal_35 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: # internal_33 = internal_35 lw $t0, 16($sp) sw $t0, 24($sp) - end_assign: - # If internal_33 then goto then_8789948665122 + # If internal_33 then goto then_8768338404446 lw $t0, 24($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948665122 + beq $t0, $t1, then_8768338404446 - # Jumping to else_8789948665122 - j else_8789948665122 + # Jumping to else_8768338404446 + j else_8768338404446 - then_8789948665122: + then_8768338404446: # Allocating Int 7 li $v0, 9 @@ -1802,7 +2620,39 @@ # Set attribute rows of self lw $t0, 164($sp) # $t0 = self lw $t1, 12($sp) # $t1 = internal_36 + beq $t1, $zero, object_set_attribute_8768338372226 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338372226 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338372226 + j object_set_attribute_8768338372226 + int_set_attribute_8768338372226: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_36 + j end_set_attribute_8768338372226 + bool_set_attribute_8768338372226: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_36 + j end_set_attribute_8768338372226 + object_set_attribute_8768338372226: sw $t1, 8($t0) # self.rows = internal_36 + end_set_attribute_8768338372226: # Allocating Int 4 li $v0, 9 @@ -1819,34 +2669,85 @@ # Set attribute columns of self lw $t0, 164($sp) # $t0 = self lw $t1, 8($sp) # $t1 = internal_37 + beq $t1, $zero, object_set_attribute_8768338372247 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338372247 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338372247 + j object_set_attribute_8768338372247 + int_set_attribute_8768338372247: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_37 + j end_set_attribute_8768338372247 + bool_set_attribute_8768338372247: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_37 + j end_set_attribute_8768338372247 + object_set_attribute_8768338372247: sw $t1, 12($t0) # self.columns = internal_37 + end_set_attribute_8768338372247: # Set attribute board_size of self lw $t0, 164($sp) # $t0 = self lw $t1, 156($sp) # $t1 = size + beq $t1, $zero, object_set_attribute_8768338372268 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338372268 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338372268 + j object_set_attribute_8768338372268 + int_set_attribute_8768338372268: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = size + j end_set_attribute_8768338372268 + bool_set_attribute_8768338372268: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = size + j end_set_attribute_8768338372268 + object_set_attribute_8768338372268: sw $t1, 16($t0) # self.board_size = size + end_set_attribute_8768338372268: - lw $t0, 156($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 28($sp) - j end_assign - not_is_Bool_or_Int: # internal_32 = size lw $t0, 156($sp) sw $t0, 28($sp) - end_assign: - # Jumping to endif_8789948665122 - j endif_8789948665122 + # Jumping to endif_8768338404446 + j endif_8768338404446 - else_8789948665122: + else_8768338404446: # Allocating Int 5 li $v0, 9 @@ -1863,7 +2764,39 @@ # Set attribute rows of self lw $t0, 164($sp) # $t0 = self lw $t1, 4($sp) # $t1 = internal_38 + beq $t1, $zero, object_set_attribute_8768338372298 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338372298 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338372298 + j object_set_attribute_8768338372298 + int_set_attribute_8768338372298: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_38 + j end_set_attribute_8768338372298 + bool_set_attribute_8768338372298: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_38 + j end_set_attribute_8768338372298 + object_set_attribute_8768338372298: sw $t1, 8($t0) # self.rows = internal_38 + end_set_attribute_8768338372298: # Allocating Int 5 li $v0, 9 @@ -1880,144 +2813,130 @@ # Set attribute columns of self lw $t0, 164($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_39 + beq $t1, $zero, object_set_attribute_8768338372319 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338372319 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338372319 + j object_set_attribute_8768338372319 + int_set_attribute_8768338372319: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_39 + j end_set_attribute_8768338372319 + bool_set_attribute_8768338372319: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_39 + j end_set_attribute_8768338372319 + object_set_attribute_8768338372319: sw $t1, 12($t0) # self.columns = internal_39 + end_set_attribute_8768338372319: # Set attribute board_size of self lw $t0, 164($sp) # $t0 = self lw $t1, 156($sp) # $t1 = size + beq $t1, $zero, object_set_attribute_8768338372340 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338372340 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338372340 + j object_set_attribute_8768338372340 + int_set_attribute_8768338372340: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = size + j end_set_attribute_8768338372340 + bool_set_attribute_8768338372340: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = size + j end_set_attribute_8768338372340 + object_set_attribute_8768338372340: sw $t1, 16($t0) # self.board_size = size + end_set_attribute_8768338372340: - lw $t0, 156($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 28($sp) - j end_assign - not_is_Bool_or_Int: # internal_32 = size lw $t0, 156($sp) sw $t0, 28($sp) - end_assign: - # Jumping to endif_8789948665122 - j endif_8789948665122 + # Jumping to endif_8768338404446 + j endif_8768338404446 - endif_8789948665122: + endif_8768338404446: - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: # internal_26 = internal_32 lw $t0, 28($sp) sw $t0, 52($sp) - end_assign: - # Jumping to endif_8789948665134 - j endif_8789948665134 + # Jumping to endif_8768338404458 + j endif_8768338404458 - endif_8789948665134: + endif_8768338404458: - lw $t0, 52($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 76($sp) - j end_assign - not_is_Bool_or_Int: # internal_20 = internal_26 lw $t0, 52($sp) sw $t0, 76($sp) - end_assign: - # Jumping to endif_8789948665140 - j endif_8789948665140 + # Jumping to endif_8768338404464 + j endif_8768338404464 - endif_8789948665140: + endif_8768338404464: - lw $t0, 76($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 100($sp) - j end_assign - not_is_Bool_or_Int: # internal_14 = internal_20 lw $t0, 76($sp) sw $t0, 100($sp) - end_assign: - # Jumping to endif_8789948665146 - j endif_8789948665146 + # Jumping to endif_8768338404470 + j endif_8768338404470 - endif_8789948665146: + endif_8768338404470: - lw $t0, 100($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 124($sp) - j end_assign - not_is_Bool_or_Int: # internal_8 = internal_14 lw $t0, 100($sp) sw $t0, 124($sp) - end_assign: - # Jumping to endif_8789948665152 - j endif_8789948665152 + # Jumping to endif_8768338404476 + j endif_8768338404476 - endif_8789948665152: + endif_8768338404476: - lw $t0, 124($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 148($sp) - j end_assign - not_is_Bool_or_Int: # internal_2 = internal_8 lw $t0, 124($sp) sw $t0, 148($sp) - end_assign: - # Jumping to endif_8789948665158 - j endif_8789948665158 + # Jumping to endif_8768338404482 + j endif_8768338404482 - endif_8789948665158: + endif_8768338404482: # Loading return value in $v1 lw $v1, 164($sp) @@ -2050,7 +2969,39 @@ # Set attribute rows of self lw $t0, 16($sp) # $t0 = self lw $t1, 12($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8768338372916 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338372916 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338372916 + j object_set_attribute_8768338372916 + int_set_attribute_8768338372916: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_0 + j end_set_attribute_8768338372916 + bool_set_attribute_8768338372916: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_0 + j end_set_attribute_8768338372916 + object_set_attribute_8768338372916: sw $t1, 8($t0) # self.rows = internal_0 + end_set_attribute_8768338372916: # Allocating Int 0 li $v0, 9 @@ -2067,7 +3018,39 @@ # Set attribute columns of self lw $t0, 16($sp) # $t0 = self lw $t1, 8($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8768338372937 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338372937 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338372937 + j object_set_attribute_8768338372937 + int_set_attribute_8768338372937: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_1 + j end_set_attribute_8768338372937 + bool_set_attribute_8768338372937: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_1 + j end_set_attribute_8768338372937 + object_set_attribute_8768338372937: sw $t1, 12($t0) # self.columns = internal_1 + end_set_attribute_8768338372937: # Allocating Int 0 li $v0, 9 @@ -2084,7 +3067,39 @@ # Set attribute board_size of self lw $t0, 16($sp) # $t0 = self lw $t1, 4($sp) # $t1 = internal_2 + beq $t1, $zero, object_set_attribute_8768338372958 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338372958 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338372958 + j object_set_attribute_8768338372958 + int_set_attribute_8768338372958: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = internal_2 + j end_set_attribute_8768338372958 + bool_set_attribute_8768338372958: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = internal_2 + j end_set_attribute_8768338372958 + object_set_attribute_8768338372958: sw $t1, 16($t0) # self.board_size = internal_2 + end_set_attribute_8768338372958: # Allocating String li $v0, 9 @@ -2094,7 +3109,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 9 sw $t0, 4($v0) # Setting length of the string in the second word of the object sb $zero, 8($v0) # Null-terminator at the end of the string @@ -2104,7 +3119,39 @@ # Set attribute population_map of self lw $t0, 16($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_3 + beq $t1, $zero, object_set_attribute_8768338372979 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338372979 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338372979 + j object_set_attribute_8768338372979 + int_set_attribute_8768338372979: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.population_map = internal_3 + j end_set_attribute_8768338372979 + bool_set_attribute_8768338372979: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.population_map = internal_3 + j end_set_attribute_8768338372979 + object_set_attribute_8768338372979: sw $t1, 20($t0) # self.population_map = internal_3 + end_set_attribute_8768338372979: # Loading return value in $v1 lw $v1, 16($sp) @@ -2126,7 +3173,39 @@ # Set attribute population_map of self lw $t0, 8($sp) # $t0 = self lw $t1, 4($sp) # $t1 = map + beq $t1, $zero, object_set_attribute_8768338373024 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338373024 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338373024 + j object_set_attribute_8768338373024 + int_set_attribute_8768338373024: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.population_map = map + j end_set_attribute_8768338373024 + bool_set_attribute_8768338373024: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.population_map = map + j end_set_attribute_8768338373024 + object_set_attribute_8768338373024: sw $t1, 20($t0) # self.population_map = map + end_set_attribute_8768338373024: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -2156,11 +3235,11 @@ function_print_at_CellularAutomaton: # Function parameters - # $ra = 76($sp) - # self = 72($sp) + # $ra = 72($sp) + # self = 68($sp) # Reserving space for local variables - addi $sp, $sp, -72 + addi $sp, $sp, -68 # Allocating Int 0 li $v0, 9 @@ -2172,46 +3251,79 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 64($sp) # internal_1 = address of allocated object Int + sw $v0, 60($sp) # internal_1 = address of allocated object Int - lw $t0, 64($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 68($sp) - j end_assign - not_is_Bool_or_Int: - # i = internal_1 - lw $t0, 64($sp) - sw $t0, 68($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_1 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 76($sp) # i = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Get attribute board_size of self - lw $t0, 72($sp) # Get the address of self + lw $t0, 68($sp) # Get the address of self lw $t1, 16($t0) # Get the attribute 'board_size' from the instance - sw $t1, 56($sp) # internal_3 = board_size + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338373919 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338373919 + j object_get_attribute_8768338373919 + int_get_attribute_8768338373919: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 52($sp) # internal_3 = self.board_size + j end_get_attribute_8768338373919 + bool_get_attribute_8768338373919: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 52($sp) # internal_3 = self.board_size + j end_get_attribute_8768338373919 + object_get_attribute_8768338373919: + sw $t1, 52($sp) # internal_3 = board_size + end_get_attribute_8768338373919: - lw $t0, 56($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: - # num = internal_3 - lw $t0, 56($sp) - sw $t0, 60($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_3 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 68($sp) # num = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating String li $v0, 9 @@ -2221,7 +3333,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 @@ -2229,104 +3341,149 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 52($sp) # internal_4 = "\n" + sw $v0, 48($sp) # internal_4 = "\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 84($sp) + lw $t0, 80($sp) sw $t0, 4($sp) # Storing self # Argument internal_4 - lw $t0, 64($sp) + lw $t0, 60($sp) sw $t0, 0($sp) # Storing internal_4 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 60($sp) # internal_5 = result of function_out_string_at_IO + sw $v1, 56($sp) # internal_5 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - while_start_8789948665326: + while_start_8768338405422: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 80($sp) + lw $t0, 76($sp) sw $t0, 4($sp) # Storing i # Argument num - lw $t0, 72($sp) + lw $t0, 68($sp) sw $t0, 0($sp) # Storing num # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 52($sp) # internal_7 = result of function_less_than + sw $v1, 52($sp) # internal_6 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 40($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: - # internal_6 = internal_7 - lw $t0, 40($sp) - sw $t0, 44($sp) - end_assign: - - # If internal_6 then goto while_body_8789948665326 - lw $t0, 44($sp) # Loading the address of the condition + # If internal_6 then goto while_body_8768338405422 + lw $t0, 40($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8789948665326 + beq $t0, $t1, while_body_8768338405422 - # Jumping to while_end_8789948665326 - j while_end_8789948665326 + # Jumping to while_end_8768338405422 + j while_end_8768338405422 - while_body_8789948665326: + while_body_8768338405422: # Get attribute population_map of self - lw $t0, 72($sp) # Get the address of self + lw $t0, 68($sp) # Get the address of self lw $t1, 20($t0) # Get the attribute 'population_map' from the instance - sw $t1, 36($sp) # internal_8 = population_map + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338374114 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338374114 + j object_get_attribute_8768338374114 + int_get_attribute_8768338374114: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 36($sp) # internal_7 = self.population_map + j end_get_attribute_8768338374114 + bool_get_attribute_8768338374114: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 36($sp) # internal_7 = self.population_map + j end_get_attribute_8768338374114 + object_get_attribute_8768338374114: + sw $t1, 36($sp) # internal_7 = population_map + end_get_attribute_8768338374114: # Get attribute columns of self - lw $t0, 72($sp) # Get the address of self + lw $t0, 68($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'columns' from the instance - sw $t1, 32($sp) # internal_9 = columns + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338374129 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338374129 + j object_get_attribute_8768338374129 + int_get_attribute_8768338374129: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_8 = self.columns + j end_get_attribute_8768338374129 + bool_get_attribute_8768338374129: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_8 = self.columns + j end_get_attribute_8768338374129 + object_get_attribute_8768338374129: + sw $t1, 32($sp) # internal_8 = columns + end_get_attribute_8768338374129: # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address - # Argument internal_8 + # Argument internal_7 lw $t0, 52($sp) - sw $t0, 8($sp) # Storing internal_8 + sw $t0, 8($sp) # Storing internal_7 # Argument i - lw $t0, 84($sp) + lw $t0, 80($sp) sw $t0, 4($sp) # Storing i - # Argument internal_9 + # Argument internal_8 lw $t0, 48($sp) - sw $t0, 0($sp) # Storing internal_9 + sw $t0, 0($sp) # Storing internal_8 # Calling function function_substr_at_String jal function_substr_at_String lw $ra, 12($sp) - sw $v1, 44($sp) # internal_10 = result of function_substr_at_String + sw $v1, 44($sp) # internal_9 = result of function_substr_at_String addi $sp, $sp, 16 # Freeing space for arguments # Passing function arguments @@ -2334,17 +3491,17 @@ sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 84($sp) + lw $t0, 80($sp) sw $t0, 4($sp) # Storing self - # Argument internal_10 + # Argument internal_9 lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_10 + sw $t0, 0($sp) # Storing internal_9 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 36($sp) # internal_11 = result of function_out_string_at_IO + sw $v1, 36($sp) # internal_10 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -2355,78 +3512,110 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_12[0] = '\n' + sb $t0, 8($v0) # internal_11[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 20($sp) # internal_12 = "\n" + sw $v0, 20($sp) # internal_11 = "\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 84($sp) + lw $t0, 80($sp) sw $t0, 4($sp) # Storing self - # Argument internal_12 + # Argument internal_11 lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_12 + sw $t0, 0($sp) # Storing internal_11 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 28($sp) # internal_13 = result of function_out_string_at_IO + sw $v1, 28($sp) # internal_12 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Get attribute columns of self - lw $t0, 72($sp) # Get the address of self + lw $t0, 68($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'columns' from the instance - sw $t1, 12($sp) # internal_14 = columns + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338374485 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338374485 + j object_get_attribute_8768338374485 + int_get_attribute_8768338374485: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_13 = self.columns + j end_get_attribute_8768338374485 + bool_get_attribute_8768338374485: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_13 = self.columns + j end_get_attribute_8768338374485 + object_get_attribute_8768338374485: + sw $t1, 12($sp) # internal_13 = columns + end_get_attribute_8768338374485: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 80($sp) + lw $t0, 76($sp) sw $t0, 4($sp) # Storing i - # Argument internal_14 + # Argument internal_13 lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_14 + sw $t0, 0($sp) # Storing internal_13 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 20($sp) # internal_15 = result of function_add + sw $v1, 20($sp) # internal_14 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 68($sp) - j end_assign - not_is_Bool_or_Int: - # i = internal_15 - lw $t0, 8($sp) - sw $t0, 68($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_14 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_14 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 76($sp) # i = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to while_start_8789948665326 - j while_start_8789948665326 + # Jumping to while_start_8768338405422 + j while_start_8768338405422 - while_end_8789948665326: + while_end_8768338405422: # Allocating String li $v0, 9 @@ -2436,39 +3625,39 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_16[0] = '\n' + sb $t0, 8($v0) # internal_15[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_16 = "\n" + sw $v0, 4($sp) # internal_15 = "\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 84($sp) + lw $t0, 80($sp) sw $t0, 4($sp) # Storing self - # Argument internal_16 + # Argument internal_15 lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_16 + sw $t0, 0($sp) # Storing internal_15 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 12($sp) # internal_17 = result of function_out_string_at_IO + sw $v1, 12($sp) # internal_16 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 72($sp) + lw $v1, 68($sp) # Freeing space for local variables - addi $sp, $sp, 72 + addi $sp, $sp, 68 jr $ra @@ -2483,7 +3672,38 @@ # Get attribute population_map of self lw $t0, 8($sp) # Get the address of self lw $t1, 20($t0) # Get the attribute 'population_map' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338373952 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338373952 + j object_get_attribute_8768338373952 + int_get_attribute_8768338373952: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_0 = self.population_map + j end_get_attribute_8768338373952 + bool_get_attribute_8768338373952: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_0 = self.population_map + j end_get_attribute_8768338373952 + object_get_attribute_8768338373952: sw $t1, 4($sp) # internal_0 = population_map + end_get_attribute_8768338373952: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments @@ -2516,7 +3736,6 @@ # Reserving space for local variables addi $sp, $sp, -40 - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -2532,7 +3751,38 @@ # Get attribute board_size of self lw $t0, 44($sp) # Get the address of self lw $t1, 16($t0) # Get the attribute 'board_size' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338374638 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338374638 + j object_get_attribute_8768338374638 + int_get_attribute_8768338374638: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_2 = self.board_size + j end_get_attribute_8768338374638 + bool_get_attribute_8768338374638: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_2 = self.board_size + j end_get_attribute_8768338374638 + object_get_attribute_8768338374638: sw $t1, 28($sp) # internal_2 = board_size + end_get_attribute_8768338374638: # Allocating Int 1 li $v0, 9 @@ -2582,33 +3832,20 @@ sw $v1, 28($sp) # internal_5 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 32($sp) - j end_assign - not_is_Bool_or_Int: # internal_1 = internal_5 lw $t0, 16($sp) sw $t0, 32($sp) - end_assign: - # If internal_1 then goto then_8789948666483 + # If internal_1 then goto then_8768338405551 lw $t0, 32($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948666483 + beq $t0, $t1, then_8768338405551 - # Jumping to else_8789948666483 - j else_8789948666483 + # Jumping to else_8768338405551 + j else_8768338405551 - then_8789948666483: + then_8768338405551: # Allocating String li $v0, 9 @@ -2618,7 +3855,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -2628,32 +3865,50 @@ sw $v0, 12($sp) # internal_6 = " " - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 36($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_6 lw $t0, 12($sp) sw $t0, 36($sp) - end_assign: - # Jumping to endif_8789948666483 - j endif_8789948666483 + # Jumping to endif_8768338405551 + j endif_8768338405551 - else_8789948666483: + else_8768338405551: # Get attribute population_map of self lw $t0, 44($sp) # Get the address of self lw $t1, 20($t0) # Get the attribute 'population_map' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338375536 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338375536 + j object_get_attribute_8768338375536 + int_get_attribute_8768338375536: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_7 = self.population_map + j end_get_attribute_8768338375536 + bool_get_attribute_8768338375536: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_7 = self.population_map + j end_get_attribute_8768338375536 + object_get_attribute_8768338375536: sw $t1, 8($sp) # internal_7 = population_map + end_get_attribute_8768338375536: # Allocating Int 1 li $v0, 9 @@ -2689,27 +3944,14 @@ sw $v1, 16($sp) # internal_9 = result of function_substr_at_String addi $sp, $sp, 16 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 36($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_9 lw $t0, 0($sp) sw $t0, 36($sp) - end_assign: - # Jumping to endif_8789948666483 - j endif_8789948666483 + # Jumping to endif_8768338405551 + j endif_8768338405551 - endif_8789948666483: + endif_8768338405551: # Loading return value in $v1 lw $v1, 36($sp) @@ -2728,7 +3970,6 @@ # Reserving space for local variables addi $sp, $sp, -40 - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -2744,7 +3985,38 @@ # Get attribute columns of self lw $t0, 44($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338375671 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338375671 + j object_get_attribute_8768338375671 + int_get_attribute_8768338375671: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_2 = self.columns + j end_get_attribute_8768338375671 + bool_get_attribute_8768338375671: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_2 = self.columns + j end_get_attribute_8768338375671 + object_get_attribute_8768338375671: sw $t1, 28($sp) # internal_2 = columns + end_get_attribute_8768338375671: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -2794,33 +4066,20 @@ sw $v1, 28($sp) # internal_5 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 32($sp) - j end_assign - not_is_Bool_or_Int: # internal_1 = internal_5 lw $t0, 16($sp) sw $t0, 32($sp) - end_assign: - # If internal_1 then goto then_8789948666549 + # If internal_1 then goto then_8768338405617 lw $t0, 32($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948666549 + beq $t0, $t1, then_8768338405617 - # Jumping to else_8789948666549 - j else_8789948666549 + # Jumping to else_8768338405617 + j else_8768338405617 - then_8789948666549: + then_8768338405617: # Allocating String li $v0, 9 @@ -2830,7 +4089,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -2840,32 +4099,50 @@ sw $v0, 12($sp) # internal_6 = " " - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 36($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_6 lw $t0, 12($sp) sw $t0, 36($sp) - end_assign: - # Jumping to endif_8789948666549 - j endif_8789948666549 + # Jumping to endif_8768338405617 + j endif_8768338405617 - else_8789948666549: + else_8768338405617: # Get attribute columns of self lw $t0, 44($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338376072 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338376072 + j object_get_attribute_8768338376072 + int_get_attribute_8768338376072: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_7 = self.columns + j end_get_attribute_8768338376072 + bool_get_attribute_8768338376072: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_7 = self.columns + j end_get_attribute_8768338376072 + object_get_attribute_8768338376072: sw $t1, 8($sp) # internal_7 = columns + end_get_attribute_8768338376072: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -2903,27 +4180,14 @@ sw $v1, 12($sp) # internal_9 = result of function_cell_at_CellularAutomaton addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 36($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_9 lw $t0, 0($sp) sw $t0, 36($sp) - end_assign: - # Jumping to endif_8789948666549 - j endif_8789948666549 + # Jumping to endif_8768338405617 + j endif_8768338405617 - endif_8789948666549: + endif_8768338405617: # Loading return value in $v1 lw $v1, 36($sp) @@ -2942,7 +4206,6 @@ # Reserving space for local variables addi $sp, $sp, -40 - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -2958,12 +4221,74 @@ # Get attribute board_size of self lw $t0, 44($sp) # Get the address of self lw $t1, 16($t0) # Get the attribute 'board_size' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338376189 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338376189 + j object_get_attribute_8768338376189 + int_get_attribute_8768338376189: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_2 = self.board_size + j end_get_attribute_8768338376189 + bool_get_attribute_8768338376189: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_2 = self.board_size + j end_get_attribute_8768338376189 + object_get_attribute_8768338376189: sw $t1, 28($sp) # internal_2 = board_size + end_get_attribute_8768338376189: # Get attribute columns of self lw $t0, 44($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338376473 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338376473 + j object_get_attribute_8768338376473 + int_get_attribute_8768338376473: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($sp) # internal_3 = self.columns + j end_get_attribute_8768338376473 + bool_get_attribute_8768338376473: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($sp) # internal_3 = self.columns + j end_get_attribute_8768338376473 + object_get_attribute_8768338376473: sw $t1, 24($sp) # internal_3 = columns + end_get_attribute_8768338376473: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -3001,33 +4326,20 @@ sw $v1, 28($sp) # internal_5 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 32($sp) - j end_assign - not_is_Bool_or_Int: # internal_1 = internal_5 lw $t0, 16($sp) sw $t0, 32($sp) - end_assign: - # If internal_1 then goto then_8789948666615 + # If internal_1 then goto then_8768338406455 lw $t0, 32($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948666615 + beq $t0, $t1, then_8768338406455 - # Jumping to else_8789948666615 - j else_8789948666615 + # Jumping to else_8768338406455 + j else_8768338406455 - then_8789948666615: + then_8768338406455: # Allocating String li $v0, 9 @@ -3037,7 +4349,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -3047,32 +4359,50 @@ sw $v0, 12($sp) # internal_6 = " " - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 36($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_6 lw $t0, 12($sp) sw $t0, 36($sp) - end_assign: - # Jumping to endif_8789948666615 - j endif_8789948666615 + # Jumping to endif_8768338406455 + j endif_8768338406455 - else_8789948666615: + else_8768338406455: # Get attribute columns of self lw $t0, 44($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338376602 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338376602 + j object_get_attribute_8768338376602 + int_get_attribute_8768338376602: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_7 = self.columns + j end_get_attribute_8768338376602 + bool_get_attribute_8768338376602: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_7 = self.columns + j end_get_attribute_8768338376602 + object_get_attribute_8768338376602: sw $t1, 8($sp) # internal_7 = columns + end_get_attribute_8768338376602: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -3110,27 +4440,14 @@ sw $v1, 12($sp) # internal_9 = result of function_cell_at_CellularAutomaton addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 36($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_9 lw $t0, 0($sp) sw $t0, 36($sp) - end_assign: - # Jumping to endif_8789948666615 - j endif_8789948666615 + # Jumping to endif_8768338406455 + j endif_8768338406455 - endif_8789948666615: + endif_8768338406455: # Loading return value in $v1 lw $v1, 36($sp) @@ -3149,7 +4466,6 @@ # Reserving space for local variables addi $sp, $sp, -60 - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -3195,7 +4511,38 @@ # Get attribute columns of self lw $t0, 64($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338377042 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338377042 + j object_get_attribute_8768338377042 + int_get_attribute_8768338377042: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_4 = self.columns + j end_get_attribute_8768338377042 + bool_get_attribute_8768338377042: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_4 = self.columns + j end_get_attribute_8768338377042 + object_get_attribute_8768338377042: sw $t1, 40($sp) # internal_4 = columns + end_get_attribute_8768338377042: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -3218,7 +4565,38 @@ # Get attribute columns of self lw $t0, 64($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338377069 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338377069 + j object_get_attribute_8768338377069 + int_get_attribute_8768338377069: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_6 = self.columns + j end_get_attribute_8768338377069 + bool_get_attribute_8768338377069: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_6 = self.columns + j end_get_attribute_8768338377069 + object_get_attribute_8768338377069: sw $t1, 32($sp) # internal_6 = columns + end_get_attribute_8768338377069: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -3286,33 +4664,20 @@ sw $v1, 28($sp) # internal_10 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: # internal_1 = internal_10 lw $t0, 16($sp) sw $t0, 52($sp) - end_assign: - # If internal_1 then goto then_8789948666977 + # If internal_1 then goto then_8768338406557 lw $t0, 52($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948666977 + beq $t0, $t1, then_8768338406557 - # Jumping to else_8789948666977 - j else_8789948666977 + # Jumping to else_8768338406557 + j else_8768338406557 - then_8789948666977: + then_8768338406557: # Allocating String li $v0, 9 @@ -3322,7 +4687,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -3332,27 +4697,14 @@ sw $v0, 12($sp) # internal_11 = " " - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 56($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_11 lw $t0, 12($sp) sw $t0, 56($sp) - end_assign: - # Jumping to endif_8789948666977 - j endif_8789948666977 + # Jumping to endif_8768338406557 + j endif_8768338406557 - else_8789948666977: + else_8768338406557: # Allocating Int 1 li $v0, 9 @@ -3402,27 +4754,14 @@ sw $v1, 12($sp) # internal_14 = result of function_cell_at_CellularAutomaton addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 56($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_14 lw $t0, 0($sp) sw $t0, 56($sp) - end_assign: - # Jumping to endif_8789948666977 - j endif_8789948666977 + # Jumping to endif_8768338406557 + j endif_8768338406557 - endif_8789948666977: + endif_8768338406557: # Loading return value in $v1 lw $v1, 56($sp) @@ -3441,7 +4780,6 @@ # Reserving space for local variables addi $sp, $sp, -64 - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -3484,33 +4822,20 @@ sw $v1, 60($sp) # internal_3 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 48($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 56($sp) - j end_assign - not_is_Bool_or_Int: # internal_1 = internal_3 lw $t0, 48($sp) sw $t0, 56($sp) - end_assign: - # If internal_1 then goto then_8789948667073 + # If internal_1 then goto then_8768338406653 lw $t0, 56($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948667073 + beq $t0, $t1, then_8768338406653 - # Jumping to else_8789948667073 - j else_8789948667073 + # Jumping to else_8768338406653 + j else_8768338406653 - then_8789948667073: + then_8768338406653: # Allocating String li $v0, 9 @@ -3520,7 +4845,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -3530,28 +4855,14 @@ sw $v0, 44($sp) # internal_4 = " " - lw $t0, 44($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_4 lw $t0, 44($sp) sw $t0, 60($sp) - end_assign: - # Jumping to endif_8789948667073 - j endif_8789948667073 - - else_8789948667073: + # Jumping to endif_8768338406653 + j endif_8768338406653 + else_8768338406653: # Allocating Bool 0 li $v0, 9 @@ -3568,7 +4879,38 @@ # Get attribute columns of self lw $t0, 68($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338378033 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338378033 + j object_get_attribute_8768338378033 + int_get_attribute_8768338378033: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_7 = self.columns + j end_get_attribute_8768338378033 + bool_get_attribute_8768338378033: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_7 = self.columns + j end_get_attribute_8768338378033 + object_get_attribute_8768338378033: sw $t1, 32($sp) # internal_7 = columns + end_get_attribute_8768338378033: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -3591,7 +4933,38 @@ # Get attribute columns of self lw $t0, 68($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338378060 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338378060 + j object_get_attribute_8768338378060 + int_get_attribute_8768338378060: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($sp) # internal_9 = self.columns + j end_get_attribute_8768338378060 + bool_get_attribute_8768338378060: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($sp) # internal_9 = self.columns + j end_get_attribute_8768338378060 + object_get_attribute_8768338378060: sw $t1, 24($sp) # internal_9 = columns + end_get_attribute_8768338378060: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -3629,33 +5002,20 @@ sw $v1, 28($sp) # internal_11 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 36($sp) - j end_assign - not_is_Bool_or_Int: # internal_6 = internal_11 lw $t0, 16($sp) sw $t0, 36($sp) - end_assign: - # If internal_6 then goto then_8789948667079 + # If internal_6 then goto then_8768338406663 lw $t0, 36($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948667079 + beq $t0, $t1, then_8768338406663 - # Jumping to else_8789948667079 - j else_8789948667079 + # Jumping to else_8768338406663 + j else_8768338406663 - then_8789948667079: + then_8768338406663: # Allocating String li $v0, 9 @@ -3665,7 +5025,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -3675,27 +5035,14 @@ sw $v0, 12($sp) # internal_12 = " " - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: # internal_5 = internal_12 lw $t0, 12($sp) sw $t0, 40($sp) - end_assign: - # Jumping to endif_8789948667079 - j endif_8789948667079 + # Jumping to endif_8768338406663 + j endif_8768338406663 - else_8789948667079: + else_8768338406663: # Allocating Int 1 li $v0, 9 @@ -3745,49 +5092,23 @@ sw $v1, 12($sp) # internal_15 = result of function_cell_at_CellularAutomaton addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: # internal_5 = internal_15 lw $t0, 0($sp) sw $t0, 40($sp) - end_assign: - # Jumping to endif_8789948667079 - j endif_8789948667079 + # Jumping to endif_8768338406663 + j endif_8768338406663 - endif_8789948667079: + endif_8768338406663: - lw $t0, 40($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_5 lw $t0, 40($sp) sw $t0, 60($sp) - end_assign: - # Jumping to endif_8789948667073 - j endif_8789948667073 + # Jumping to endif_8768338406653 + j endif_8768338406653 - endif_8789948667073: + endif_8768338406653: # Loading return value in $v1 lw $v1, 60($sp) @@ -3806,7 +5127,6 @@ # Reserving space for local variables addi $sp, $sp, -72 - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -3822,7 +5142,38 @@ # Get attribute columns of self lw $t0, 76($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338378843 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338378843 + j object_get_attribute_8768338378843 + int_get_attribute_8768338378843: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 60($sp) # internal_2 = self.columns + j end_get_attribute_8768338378843 + bool_get_attribute_8768338378843: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 60($sp) # internal_2 = self.columns + j end_get_attribute_8768338378843 + object_get_attribute_8768338378843: sw $t1, 60($sp) # internal_2 = columns + end_get_attribute_8768338378843: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -3872,33 +5223,20 @@ sw $v1, 60($sp) # internal_5 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 48($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 64($sp) - j end_assign - not_is_Bool_or_Int: # internal_1 = internal_5 lw $t0, 48($sp) sw $t0, 64($sp) - end_assign: - # If internal_1 then goto then_8789948667965 + # If internal_1 then goto then_8768338406777 lw $t0, 64($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948667965 + beq $t0, $t1, then_8768338406777 - # Jumping to else_8789948667965 - j else_8789948667965 + # Jumping to else_8768338406777 + j else_8768338406777 - then_8789948667965: + then_8768338406777: # Allocating String li $v0, 9 @@ -3908,7 +5246,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -3918,28 +5256,14 @@ sw $v0, 44($sp) # internal_6 = " " - lw $t0, 44($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 68($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_6 lw $t0, 44($sp) sw $t0, 68($sp) - end_assign: - - # Jumping to endif_8789948667965 - j endif_8789948667965 - else_8789948667965: + # Jumping to endif_8768338406777 + j endif_8768338406777 + else_8768338406777: # Allocating Bool 0 li $v0, 9 @@ -3956,7 +5280,38 @@ # Get attribute columns of self lw $t0, 76($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338379545 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338379545 + j object_get_attribute_8768338379545 + int_get_attribute_8768338379545: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_9 = self.columns + j end_get_attribute_8768338379545 + bool_get_attribute_8768338379545: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_9 = self.columns + j end_get_attribute_8768338379545 + object_get_attribute_8768338379545: sw $t1, 32($sp) # internal_9 = columns + end_get_attribute_8768338379545: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -3979,7 +5334,38 @@ # Get attribute columns of self lw $t0, 76($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338379572 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338379572 + j object_get_attribute_8768338379572 + int_get_attribute_8768338379572: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($sp) # internal_11 = self.columns + j end_get_attribute_8768338379572 + bool_get_attribute_8768338379572: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($sp) # internal_11 = self.columns + j end_get_attribute_8768338379572 + object_get_attribute_8768338379572: sw $t1, 24($sp) # internal_11 = columns + end_get_attribute_8768338379572: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -4017,33 +5403,20 @@ sw $v1, 28($sp) # internal_13 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 36($sp) - j end_assign - not_is_Bool_or_Int: # internal_8 = internal_13 lw $t0, 16($sp) sw $t0, 36($sp) - end_assign: - # If internal_8 then goto then_8789948667971 + # If internal_8 then goto then_8768338406783 lw $t0, 36($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948667971 + beq $t0, $t1, then_8768338406783 - # Jumping to else_8789948667971 - j else_8789948667971 + # Jumping to else_8768338406783 + j else_8768338406783 - then_8789948667971: + then_8768338406783: # Allocating String li $v0, 9 @@ -4053,7 +5426,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -4063,27 +5436,14 @@ sw $v0, 12($sp) # internal_14 = " " - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: # internal_7 = internal_14 lw $t0, 12($sp) sw $t0, 40($sp) - end_assign: - # Jumping to endif_8789948667971 - j endif_8789948667971 + # Jumping to endif_8768338406783 + j endif_8768338406783 - else_8789948667971: + else_8768338406783: # Allocating Int 1 li $v0, 9 @@ -4133,49 +5493,23 @@ sw $v1, 12($sp) # internal_17 = result of function_north_at_CellularAutomaton addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: # internal_7 = internal_17 lw $t0, 0($sp) sw $t0, 40($sp) - end_assign: - # Jumping to endif_8789948667971 - j endif_8789948667971 + # Jumping to endif_8768338406783 + j endif_8768338406783 - endif_8789948667971: + endif_8768338406783: - lw $t0, 40($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 68($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_7 lw $t0, 40($sp) sw $t0, 68($sp) - end_assign: - # Jumping to endif_8789948667965 - j endif_8789948667965 + # Jumping to endif_8768338406777 + j endif_8768338406777 - endif_8789948667965: + endif_8768338406777: # Loading return value in $v1 lw $v1, 68($sp) @@ -4194,7 +5528,6 @@ # Reserving space for local variables addi $sp, $sp, -88 - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -4210,7 +5543,38 @@ # Get attribute columns of self lw $t0, 92($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338380099 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338380099 + j object_get_attribute_8768338380099 + int_get_attribute_8768338380099: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 76($sp) # internal_2 = self.columns + j end_get_attribute_8768338380099 + bool_get_attribute_8768338380099: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 76($sp) # internal_2 = self.columns + j end_get_attribute_8768338380099 + object_get_attribute_8768338380099: sw $t1, 76($sp) # internal_2 = columns + end_get_attribute_8768338380099: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -4260,33 +5624,20 @@ sw $v1, 76($sp) # internal_5 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 64($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 80($sp) - j end_assign - not_is_Bool_or_Int: # internal_1 = internal_5 lw $t0, 64($sp) sw $t0, 80($sp) - end_assign: - # If internal_1 then goto then_8789948668109 + # If internal_1 then goto then_8768338407181 lw $t0, 80($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948668109 + beq $t0, $t1, then_8768338407181 - # Jumping to else_8789948668109 - j else_8789948668109 + # Jumping to else_8768338407181 + j else_8768338407181 - then_8789948668109: + then_8768338407181: # Allocating String li $v0, 9 @@ -4296,7 +5647,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -4306,28 +5657,14 @@ sw $v0, 60($sp) # internal_6 = " " - lw $t0, 60($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 84($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_6 lw $t0, 60($sp) sw $t0, 84($sp) - end_assign: - # Jumping to endif_8789948668109 - j endif_8789948668109 - - else_8789948668109: + # Jumping to endif_8768338407181 + j endif_8768338407181 + else_8768338407181: # Allocating Bool 0 li $v0, 9 @@ -4374,7 +5711,38 @@ # Get attribute columns of self lw $t0, 92($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338380584 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338380584 + j object_get_attribute_8768338380584 + int_get_attribute_8768338380584: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_11 = self.columns + j end_get_attribute_8768338380584 + bool_get_attribute_8768338380584: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_11 = self.columns + j end_get_attribute_8768338380584 + object_get_attribute_8768338380584: sw $t1, 40($sp) # internal_11 = columns + end_get_attribute_8768338380584: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -4397,7 +5765,38 @@ # Get attribute columns of self lw $t0, 92($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338380611 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338380611 + j object_get_attribute_8768338380611 + int_get_attribute_8768338380611: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_13 = self.columns + j end_get_attribute_8768338380611 + bool_get_attribute_8768338380611: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_13 = self.columns + j end_get_attribute_8768338380611 + object_get_attribute_8768338380611: sw $t1, 32($sp) # internal_13 = columns + end_get_attribute_8768338380611: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -4465,33 +5864,20 @@ sw $v1, 28($sp) # internal_17 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: # internal_8 = internal_17 lw $t0, 16($sp) sw $t0, 52($sp) - end_assign: - # If internal_8 then goto then_8789948668115 + # If internal_8 then goto then_8768338407187 lw $t0, 52($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948668115 + beq $t0, $t1, then_8768338407187 - # Jumping to else_8789948668115 - j else_8789948668115 + # Jumping to else_8768338407187 + j else_8768338407187 - then_8789948668115: + then_8768338407187: # Allocating String li $v0, 9 @@ -4501,7 +5887,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -4511,27 +5897,14 @@ sw $v0, 12($sp) # internal_18 = " " - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 56($sp) - j end_assign - not_is_Bool_or_Int: # internal_7 = internal_18 lw $t0, 12($sp) sw $t0, 56($sp) - end_assign: - # Jumping to endif_8789948668115 - j endif_8789948668115 + # Jumping to endif_8768338407187 + j endif_8768338407187 - else_8789948668115: + else_8768338407187: # Allocating Int 1 li $v0, 9 @@ -4581,49 +5954,23 @@ sw $v1, 12($sp) # internal_21 = result of function_north_at_CellularAutomaton addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 56($sp) - j end_assign - not_is_Bool_or_Int: # internal_7 = internal_21 lw $t0, 0($sp) sw $t0, 56($sp) - end_assign: - # Jumping to endif_8789948668115 - j endif_8789948668115 + # Jumping to endif_8768338407187 + j endif_8768338407187 - endif_8789948668115: + endif_8768338407187: - lw $t0, 56($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 84($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_7 lw $t0, 56($sp) sw $t0, 84($sp) - end_assign: - # Jumping to endif_8789948668109 - j endif_8789948668109 + # Jumping to endif_8768338407181 + j endif_8768338407181 - endif_8789948668109: + endif_8768338407181: # Loading return value in $v1 lw $v1, 84($sp) @@ -4642,7 +5989,6 @@ # Reserving space for local variables addi $sp, $sp, -88 - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -4658,12 +6004,74 @@ # Get attribute board_size of self lw $t0, 92($sp) # Get the address of self lw $t1, 16($t0) # Get the attribute 'board_size' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338381165 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338381165 + j object_get_attribute_8768338381165 + int_get_attribute_8768338381165: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 76($sp) # internal_2 = self.board_size + j end_get_attribute_8768338381165 + bool_get_attribute_8768338381165: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 76($sp) # internal_2 = self.board_size + j end_get_attribute_8768338381165 + object_get_attribute_8768338381165: sw $t1, 76($sp) # internal_2 = board_size + end_get_attribute_8768338381165: # Get attribute columns of self lw $t0, 92($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338381189 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338381189 + j object_get_attribute_8768338381189 + int_get_attribute_8768338381189: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 72($sp) # internal_3 = self.columns + j end_get_attribute_8768338381189 + bool_get_attribute_8768338381189: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 72($sp) # internal_3 = self.columns + j end_get_attribute_8768338381189 + object_get_attribute_8768338381189: sw $t1, 72($sp) # internal_3 = columns + end_get_attribute_8768338381189: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -4701,33 +6109,20 @@ sw $v1, 76($sp) # internal_5 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 64($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 80($sp) - j end_assign - not_is_Bool_or_Int: # internal_1 = internal_5 lw $t0, 64($sp) sw $t0, 80($sp) - end_assign: - # If internal_1 then goto then_8789948668513 + # If internal_1 then goto then_8768338407325 lw $t0, 80($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948668513 + beq $t0, $t1, then_8768338407325 - # Jumping to else_8789948668513 - j else_8789948668513 + # Jumping to else_8768338407325 + j else_8768338407325 - then_8789948668513: + then_8768338407325: # Allocating String li $v0, 9 @@ -4737,7 +6132,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -4747,28 +6142,14 @@ sw $v0, 60($sp) # internal_6 = " " - lw $t0, 60($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 84($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_6 lw $t0, 60($sp) sw $t0, 84($sp) - end_assign: - # Jumping to endif_8789948668513 - j endif_8789948668513 - - else_8789948668513: + # Jumping to endif_8768338407325 + j endif_8768338407325 + else_8768338407325: # Allocating Bool 0 li $v0, 9 @@ -4815,7 +6196,38 @@ # Get attribute columns of self lw $t0, 92($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338381406 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338381406 + j object_get_attribute_8768338381406 + int_get_attribute_8768338381406: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_11 = self.columns + j end_get_attribute_8768338381406 + bool_get_attribute_8768338381406: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_11 = self.columns + j end_get_attribute_8768338381406 + object_get_attribute_8768338381406: sw $t1, 40($sp) # internal_11 = columns + end_get_attribute_8768338381406: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -4838,7 +6250,38 @@ # Get attribute columns of self lw $t0, 92($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338381433 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338381433 + j object_get_attribute_8768338381433 + int_get_attribute_8768338381433: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_13 = self.columns + j end_get_attribute_8768338381433 + bool_get_attribute_8768338381433: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_13 = self.columns + j end_get_attribute_8768338381433 + object_get_attribute_8768338381433: sw $t1, 32($sp) # internal_13 = columns + end_get_attribute_8768338381433: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -4906,33 +6349,20 @@ sw $v1, 28($sp) # internal_17 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: # internal_8 = internal_17 lw $t0, 16($sp) sw $t0, 52($sp) - end_assign: - # If internal_8 then goto then_8789948668519 + # If internal_8 then goto then_8768338407331 lw $t0, 52($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948668519 + beq $t0, $t1, then_8768338407331 - # Jumping to else_8789948668519 - j else_8789948668519 + # Jumping to else_8768338407331 + j else_8768338407331 - then_8789948668519: + then_8768338407331: # Allocating String li $v0, 9 @@ -4942,7 +6372,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -4952,27 +6382,14 @@ sw $v0, 12($sp) # internal_18 = " " - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 56($sp) - j end_assign - not_is_Bool_or_Int: # internal_7 = internal_18 lw $t0, 12($sp) sw $t0, 56($sp) - end_assign: - # Jumping to endif_8789948668519 - j endif_8789948668519 + # Jumping to endif_8768338407331 + j endif_8768338407331 - else_8789948668519: + else_8768338407331: # Allocating Int 1 li $v0, 9 @@ -5022,49 +6439,23 @@ sw $v1, 12($sp) # internal_21 = result of function_south_at_CellularAutomaton addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 56($sp) - j end_assign - not_is_Bool_or_Int: # internal_7 = internal_21 lw $t0, 0($sp) sw $t0, 56($sp) - end_assign: - # Jumping to endif_8789948668519 - j endif_8789948668519 + # Jumping to endif_8768338407331 + j endif_8768338407331 - endif_8789948668519: + endif_8768338407331: - lw $t0, 56($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 84($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_7 lw $t0, 56($sp) sw $t0, 84($sp) - end_assign: - # Jumping to endif_8789948668513 - j endif_8789948668513 + # Jumping to endif_8768338407325 + j endif_8768338407325 - endif_8789948668513: + endif_8768338407325: # Loading return value in $v1 lw $v1, 84($sp) @@ -5083,7 +6474,6 @@ # Reserving space for local variables addi $sp, $sp, -72 - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -5099,12 +6489,74 @@ # Get attribute board_size of self lw $t0, 76($sp) # Get the address of self lw $t1, 16($t0) # Get the attribute 'board_size' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338349219 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338349219 + j object_get_attribute_8768338349219 + int_get_attribute_8768338349219: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 60($sp) # internal_2 = self.board_size + j end_get_attribute_8768338349219 + bool_get_attribute_8768338349219: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 60($sp) # internal_2 = self.board_size + j end_get_attribute_8768338349219 + object_get_attribute_8768338349219: sw $t1, 60($sp) # internal_2 = board_size + end_get_attribute_8768338349219: # Get attribute columns of self lw $t0, 76($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338349243 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338349243 + j object_get_attribute_8768338349243 + int_get_attribute_8768338349243: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 56($sp) # internal_3 = self.columns + j end_get_attribute_8768338349243 + bool_get_attribute_8768338349243: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 56($sp) # internal_3 = self.columns + j end_get_attribute_8768338349243 + object_get_attribute_8768338349243: sw $t1, 56($sp) # internal_3 = columns + end_get_attribute_8768338349243: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -5142,33 +6594,20 @@ sw $v1, 60($sp) # internal_5 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 48($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 64($sp) - j end_assign - not_is_Bool_or_Int: # internal_1 = internal_5 lw $t0, 48($sp) sw $t0, 64($sp) - end_assign: - # If internal_1 then goto then_8789948668633 + # If internal_1 then goto then_8768338407705 lw $t0, 64($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948668633 + beq $t0, $t1, then_8768338407705 - # Jumping to else_8789948668633 - j else_8789948668633 + # Jumping to else_8768338407705 + j else_8768338407705 - then_8789948668633: + then_8768338407705: # Allocating String li $v0, 9 @@ -5178,7 +6617,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -5188,28 +6627,14 @@ sw $v0, 44($sp) # internal_6 = " " - lw $t0, 44($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 68($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_6 lw $t0, 44($sp) sw $t0, 68($sp) - end_assign: - # Jumping to endif_8789948668633 - j endif_8789948668633 - - else_8789948668633: + # Jumping to endif_8768338407705 + j endif_8768338407705 + else_8768338407705: # Allocating Bool 0 li $v0, 9 @@ -5226,7 +6651,38 @@ # Get attribute columns of self lw $t0, 76($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338349677 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338349677 + j object_get_attribute_8768338349677 + int_get_attribute_8768338349677: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_9 = self.columns + j end_get_attribute_8768338349677 + bool_get_attribute_8768338349677: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_9 = self.columns + j end_get_attribute_8768338349677 + object_get_attribute_8768338349677: sw $t1, 32($sp) # internal_9 = columns + end_get_attribute_8768338349677: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -5249,7 +6705,38 @@ # Get attribute columns of self lw $t0, 76($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338349704 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338349704 + j object_get_attribute_8768338349704 + int_get_attribute_8768338349704: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($sp) # internal_11 = self.columns + j end_get_attribute_8768338349704 + bool_get_attribute_8768338349704: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($sp) # internal_11 = self.columns + j end_get_attribute_8768338349704 + object_get_attribute_8768338349704: sw $t1, 24($sp) # internal_11 = columns + end_get_attribute_8768338349704: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -5287,33 +6774,20 @@ sw $v1, 28($sp) # internal_13 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 36($sp) - j end_assign - not_is_Bool_or_Int: # internal_8 = internal_13 lw $t0, 16($sp) sw $t0, 36($sp) - end_assign: - # If internal_8 then goto then_8789948668639 + # If internal_8 then goto then_8768338407711 lw $t0, 36($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948668639 + beq $t0, $t1, then_8768338407711 - # Jumping to else_8789948668639 - j else_8789948668639 + # Jumping to else_8768338407711 + j else_8768338407711 - then_8789948668639: + then_8768338407711: # Allocating String li $v0, 9 @@ -5323,7 +6797,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -5333,27 +6807,14 @@ sw $v0, 12($sp) # internal_14 = " " - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: # internal_7 = internal_14 lw $t0, 12($sp) sw $t0, 40($sp) - end_assign: - # Jumping to endif_8789948668639 - j endif_8789948668639 + # Jumping to endif_8768338407711 + j endif_8768338407711 - else_8789948668639: + else_8768338407711: # Allocating Int 1 li $v0, 9 @@ -5403,49 +6864,23 @@ sw $v1, 12($sp) # internal_17 = result of function_south_at_CellularAutomaton addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: # internal_7 = internal_17 lw $t0, 0($sp) sw $t0, 40($sp) - end_assign: - # Jumping to endif_8789948668639 - j endif_8789948668639 + # Jumping to endif_8768338407711 + j endif_8768338407711 - endif_8789948668639: + endif_8768338407711: - lw $t0, 40($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 68($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_7 lw $t0, 40($sp) sw $t0, 68($sp) - end_assign: - # Jumping to endif_8789948668633 - j endif_8789948668633 + # Jumping to endif_8768338407705 + j endif_8768338407705 - endif_8789948668633: + endif_8768338407705: # Loading return value in $v1 lw $v1, 68($sp) @@ -5464,7 +6899,6 @@ # Reserving space for local variables addi $sp, $sp, -252 - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -5503,7 +6937,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 @@ -5531,33 +6965,20 @@ sw $v1, 244($sp) # internal_4 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 232($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 244($sp) - j end_assign - not_is_Bool_or_Int: # internal_1 = internal_4 lw $t0, 232($sp) sw $t0, 244($sp) - end_assign: - # If internal_1 then goto then_8789948668685 + # If internal_1 then goto then_8768338407753 lw $t0, 244($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948668685 + beq $t0, $t1, then_8768338407753 - # Jumping to else_8789948668685 - j else_8789948668685 + # Jumping to else_8768338407753 + j else_8768338407753 - then_8789948668685: + then_8768338407753: # Allocating Int 1 li $v0, 9 @@ -5571,27 +6992,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 228($sp) # internal_5 = address of allocated object Int - lw $t0, 228($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 248($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_5 lw $t0, 228($sp) sw $t0, 248($sp) - end_assign: - # Jumping to endif_8789948668685 - j endif_8789948668685 + # Jumping to endif_8768338407753 + j endif_8768338407753 - else_8789948668685: + else_8768338407753: # Allocating Int 0 li $v0, 9 @@ -5605,28 +7013,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 224($sp) # internal_6 = address of allocated object Int - lw $t0, 224($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 248($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_6 lw $t0, 224($sp) sw $t0, 248($sp) - end_assign: - # Jumping to endif_8789948668685 - j endif_8789948668685 - - endif_8789948668685: + # Jumping to endif_8768338407753 + j endif_8768338407753 + endif_8768338407753: # Allocating Bool 0 li $v0, 9 @@ -5666,7 +7060,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 @@ -5694,33 +7088,20 @@ sw $v1, 216($sp) # internal_11 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 204($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 216($sp) - j end_assign - not_is_Bool_or_Int: # internal_8 = internal_11 lw $t0, 204($sp) sw $t0, 216($sp) - end_assign: - # If internal_8 then goto then_8789948668724 + # If internal_8 then goto then_8768338407792 lw $t0, 216($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948668724 + beq $t0, $t1, then_8768338407792 - # Jumping to else_8789948668724 - j else_8789948668724 + # Jumping to else_8768338407792 + j else_8768338407792 - then_8789948668724: + then_8768338407792: # Allocating Int 1 li $v0, 9 @@ -5734,27 +7115,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 200($sp) # internal_12 = address of allocated object Int - lw $t0, 200($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 220($sp) - j end_assign - not_is_Bool_or_Int: # internal_7 = internal_12 lw $t0, 200($sp) sw $t0, 220($sp) - end_assign: - # Jumping to endif_8789948668724 - j endif_8789948668724 + # Jumping to endif_8768338407792 + j endif_8768338407792 - else_8789948668724: + else_8768338407792: # Allocating Int 0 li $v0, 9 @@ -5768,27 +7136,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 196($sp) # internal_13 = address of allocated object Int - lw $t0, 196($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 220($sp) - j end_assign - not_is_Bool_or_Int: # internal_7 = internal_13 lw $t0, 196($sp) sw $t0, 220($sp) - end_assign: - # Jumping to endif_8789948668724 - j endif_8789948668724 + # Jumping to endif_8768338407792 + j endif_8768338407792 - endif_8789948668724: + endif_8768338407792: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -5808,7 +7163,6 @@ sw $v1, 204($sp) # internal_14 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -5847,7 +7201,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 @@ -5875,33 +7229,20 @@ sw $v1, 184($sp) # internal_19 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 172($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 184($sp) - j end_assign - not_is_Bool_or_Int: # internal_16 = internal_19 lw $t0, 172($sp) sw $t0, 184($sp) - end_assign: - # If internal_16 then goto then_8789948668769 + # If internal_16 then goto then_8768338407837 lw $t0, 184($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948668769 + beq $t0, $t1, then_8768338407837 - # Jumping to else_8789948668769 - j else_8789948668769 + # Jumping to else_8768338407837 + j else_8768338407837 - then_8789948668769: + then_8768338407837: # Allocating Int 1 li $v0, 9 @@ -5915,27 +7256,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 168($sp) # internal_20 = address of allocated object Int - lw $t0, 168($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 188($sp) - j end_assign - not_is_Bool_or_Int: # internal_15 = internal_20 lw $t0, 168($sp) sw $t0, 188($sp) - end_assign: - # Jumping to endif_8789948668769 - j endif_8789948668769 + # Jumping to endif_8768338407837 + j endif_8768338407837 - else_8789948668769: + else_8768338407837: # Allocating Int 0 li $v0, 9 @@ -5949,27 +7277,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 164($sp) # internal_21 = address of allocated object Int - lw $t0, 164($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 188($sp) - j end_assign - not_is_Bool_or_Int: # internal_15 = internal_21 lw $t0, 164($sp) sw $t0, 188($sp) - end_assign: - # Jumping to endif_8789948668769 - j endif_8789948668769 + # Jumping to endif_8768338407837 + j endif_8768338407837 - endif_8789948668769: + endif_8768338407837: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -5989,7 +7304,6 @@ sw $v1, 172($sp) # internal_22 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -6028,7 +7342,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 @@ -6056,33 +7370,20 @@ sw $v1, 152($sp) # internal_27 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 140($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 152($sp) - j end_assign - not_is_Bool_or_Int: # internal_24 = internal_27 lw $t0, 140($sp) sw $t0, 152($sp) - end_assign: - # If internal_24 then goto then_8789948668814 + # If internal_24 then goto then_8768338407882 lw $t0, 152($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948668814 + beq $t0, $t1, then_8768338407882 - # Jumping to else_8789948668814 - j else_8789948668814 + # Jumping to else_8768338407882 + j else_8768338407882 - then_8789948668814: + then_8768338407882: # Allocating Int 1 li $v0, 9 @@ -6096,27 +7397,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 136($sp) # internal_28 = address of allocated object Int - lw $t0, 136($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 156($sp) - j end_assign - not_is_Bool_or_Int: # internal_23 = internal_28 lw $t0, 136($sp) sw $t0, 156($sp) - end_assign: - # Jumping to endif_8789948668814 - j endif_8789948668814 + # Jumping to endif_8768338407882 + j endif_8768338407882 - else_8789948668814: + else_8768338407882: # Allocating Int 0 li $v0, 9 @@ -6130,27 +7418,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 132($sp) # internal_29 = address of allocated object Int - lw $t0, 132($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 156($sp) - j end_assign - not_is_Bool_or_Int: # internal_23 = internal_29 lw $t0, 132($sp) sw $t0, 156($sp) - end_assign: - # Jumping to endif_8789948668814 - j endif_8789948668814 + # Jumping to endif_8768338407882 + j endif_8768338407882 - endif_8789948668814: + endif_8768338407882: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -6170,7 +7445,6 @@ sw $v1, 140($sp) # internal_30 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -6209,7 +7483,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 @@ -6237,33 +7511,20 @@ sw $v1, 120($sp) # internal_35 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 108($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 120($sp) - j end_assign - not_is_Bool_or_Int: # internal_32 = internal_35 lw $t0, 108($sp) sw $t0, 120($sp) - end_assign: - # If internal_32 then goto then_8789948668859 + # If internal_32 then goto then_8768338407927 lw $t0, 120($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948668859 + beq $t0, $t1, then_8768338407927 - # Jumping to else_8789948668859 - j else_8789948668859 + # Jumping to else_8768338407927 + j else_8768338407927 - then_8789948668859: + then_8768338407927: # Allocating Int 1 li $v0, 9 @@ -6277,27 +7538,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 104($sp) # internal_36 = address of allocated object Int - lw $t0, 104($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 124($sp) - j end_assign - not_is_Bool_or_Int: # internal_31 = internal_36 lw $t0, 104($sp) sw $t0, 124($sp) - end_assign: - # Jumping to endif_8789948668859 - j endif_8789948668859 + # Jumping to endif_8768338407927 + j endif_8768338407927 - else_8789948668859: + else_8768338407927: # Allocating Int 0 li $v0, 9 @@ -6311,27 +7559,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 100($sp) # internal_37 = address of allocated object Int - lw $t0, 100($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 124($sp) - j end_assign - not_is_Bool_or_Int: # internal_31 = internal_37 lw $t0, 100($sp) sw $t0, 124($sp) - end_assign: - # Jumping to endif_8789948668859 - j endif_8789948668859 + # Jumping to endif_8768338407927 + j endif_8768338407927 - endif_8789948668859: + endif_8768338407927: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -6351,7 +7586,6 @@ sw $v1, 108($sp) # internal_38 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -6390,7 +7624,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 @@ -6418,33 +7652,20 @@ sw $v1, 88($sp) # internal_43 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 76($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 88($sp) - j end_assign - not_is_Bool_or_Int: # internal_40 = internal_43 lw $t0, 76($sp) sw $t0, 88($sp) - end_assign: - # If internal_40 then goto then_8789948668904 + # If internal_40 then goto then_8768338408232 lw $t0, 88($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948668904 + beq $t0, $t1, then_8768338408232 - # Jumping to else_8789948668904 - j else_8789948668904 + # Jumping to else_8768338408232 + j else_8768338408232 - then_8789948668904: + then_8768338408232: # Allocating Int 1 li $v0, 9 @@ -6458,27 +7679,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 72($sp) # internal_44 = address of allocated object Int - lw $t0, 72($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 92($sp) - j end_assign - not_is_Bool_or_Int: # internal_39 = internal_44 lw $t0, 72($sp) sw $t0, 92($sp) - end_assign: - # Jumping to endif_8789948668904 - j endif_8789948668904 + # Jumping to endif_8768338408232 + j endif_8768338408232 - else_8789948668904: + else_8768338408232: # Allocating Int 0 li $v0, 9 @@ -6492,27 +7700,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 68($sp) # internal_45 = address of allocated object Int - lw $t0, 68($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 92($sp) - j end_assign - not_is_Bool_or_Int: # internal_39 = internal_45 lw $t0, 68($sp) sw $t0, 92($sp) - end_assign: - # Jumping to endif_8789948668904 - j endif_8789948668904 + # Jumping to endif_8768338408232 + j endif_8768338408232 - endif_8789948668904: + endif_8768338408232: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -6532,7 +7727,6 @@ sw $v1, 76($sp) # internal_46 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -6571,7 +7765,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 @@ -6599,33 +7793,20 @@ sw $v1, 56($sp) # internal_51 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 44($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 56($sp) - j end_assign - not_is_Bool_or_Int: # internal_48 = internal_51 lw $t0, 44($sp) sw $t0, 56($sp) - end_assign: - # If internal_48 then goto then_8789948669209 + # If internal_48 then goto then_8768338408277 lw $t0, 56($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948669209 + beq $t0, $t1, then_8768338408277 - # Jumping to else_8789948669209 - j else_8789948669209 + # Jumping to else_8768338408277 + j else_8768338408277 - then_8789948669209: + then_8768338408277: # Allocating Int 1 li $v0, 9 @@ -6639,27 +7820,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 40($sp) # internal_52 = address of allocated object Int - lw $t0, 40($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: # internal_47 = internal_52 lw $t0, 40($sp) sw $t0, 60($sp) - end_assign: - # Jumping to endif_8789948669209 - j endif_8789948669209 + # Jumping to endif_8768338408277 + j endif_8768338408277 - else_8789948669209: + else_8768338408277: # Allocating Int 0 li $v0, 9 @@ -6673,27 +7841,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 36($sp) # internal_53 = address of allocated object Int - lw $t0, 36($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: # internal_47 = internal_53 lw $t0, 36($sp) sw $t0, 60($sp) - end_assign: - # Jumping to endif_8789948669209 - j endif_8789948669209 + # Jumping to endif_8768338408277 + j endif_8768338408277 - endif_8789948669209: + endif_8768338408277: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -6713,7 +7868,6 @@ sw $v1, 44($sp) # internal_54 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -6752,7 +7906,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 @@ -6780,33 +7934,20 @@ sw $v1, 24($sp) # internal_59 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: # internal_56 = internal_59 lw $t0, 12($sp) sw $t0, 24($sp) - end_assign: - # If internal_56 then goto then_8789948669254 + # If internal_56 then goto then_8768338408322 lw $t0, 24($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948669254 + beq $t0, $t1, then_8768338408322 - # Jumping to else_8789948669254 - j else_8789948669254 + # Jumping to else_8768338408322 + j else_8768338408322 - then_8789948669254: + then_8768338408322: # Allocating Int 1 li $v0, 9 @@ -6820,27 +7961,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 8($sp) # internal_60 = address of allocated object Int - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 28($sp) - j end_assign - not_is_Bool_or_Int: # internal_55 = internal_60 lw $t0, 8($sp) sw $t0, 28($sp) - end_assign: - # Jumping to endif_8789948669254 - j endif_8789948669254 + # Jumping to endif_8768338408322 + j endif_8768338408322 - else_8789948669254: + else_8768338408322: # Allocating Int 0 li $v0, 9 @@ -6854,27 +7982,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 4($sp) # internal_61 = address of allocated object Int - lw $t0, 4($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 28($sp) - j end_assign - not_is_Bool_or_Int: # internal_55 = internal_61 lw $t0, 4($sp) sw $t0, 28($sp) - end_assign: - # Jumping to endif_8789948669254 - j endif_8789948669254 + # Jumping to endif_8768338408322 + j endif_8768338408322 - endif_8789948669254: + endif_8768338408322: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -6911,7 +8026,6 @@ # Reserving space for local variables addi $sp, $sp, -76 - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -6972,33 +8086,20 @@ sw $v1, 68($sp) # internal_4 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 56($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 68($sp) - j end_assign - not_is_Bool_or_Int: # internal_1 = internal_4 lw $t0, 56($sp) sw $t0, 68($sp) - end_assign: - # If internal_1 then goto then_8789948669374 + # If internal_1 then goto then_8768338408442 lw $t0, 68($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948669374 + beq $t0, $t1, then_8768338408442 - # Jumping to else_8789948669374 - j else_8789948669374 + # Jumping to else_8768338408442 + j else_8768338408442 - then_8789948669374: + then_8768338408442: # Allocating String li $v0, 9 @@ -7008,7 +8109,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 @@ -7018,28 +8119,14 @@ sw $v0, 52($sp) # internal_5 = "X" - lw $t0, 52($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 72($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_5 lw $t0, 52($sp) sw $t0, 72($sp) - end_assign: - - # Jumping to endif_8789948669374 - j endif_8789948669374 - else_8789948669374: + # Jumping to endif_8768338408442 + j endif_8768338408442 + else_8768338408442: # Allocating Bool 0 li $v0, 9 @@ -7101,34 +8188,20 @@ sw $v1, 44($sp) # internal_10 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 32($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 44($sp) - j end_assign - not_is_Bool_or_Int: # internal_7 = internal_10 lw $t0, 32($sp) sw $t0, 44($sp) - end_assign: - # If internal_7 then goto then_8789948669368 + # If internal_7 then goto then_8768338408436 lw $t0, 44($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948669368 - - # Jumping to else_8789948669368 - j else_8789948669368 + beq $t0, $t1, then_8768338408436 - then_8789948669368: + # Jumping to else_8768338408436 + j else_8768338408436 + then_8768338408436: # Allocating Bool 0 li $v0, 9 @@ -7168,7 +8241,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 @@ -7196,33 +8269,20 @@ sw $v1, 24($sp) # internal_15 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: # internal_12 = internal_15 lw $t0, 12($sp) sw $t0, 24($sp) - end_assign: - # If internal_12 then goto then_8789948669356 + # If internal_12 then goto then_8768338408424 lw $t0, 24($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948669356 + beq $t0, $t1, then_8768338408424 - # Jumping to else_8789948669356 - j else_8789948669356 + # Jumping to else_8768338408424 + j else_8768338408424 - then_8789948669356: + then_8768338408424: # Allocating String li $v0, 9 @@ -7232,7 +8292,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 @@ -7242,27 +8302,14 @@ sw $v0, 8($sp) # internal_16 = "X" - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 28($sp) - j end_assign - not_is_Bool_or_Int: # internal_11 = internal_16 lw $t0, 8($sp) sw $t0, 28($sp) - end_assign: - # Jumping to endif_8789948669356 - j endif_8789948669356 + # Jumping to endif_8768338408424 + j endif_8768338408424 - else_8789948669356: + else_8768338408424: # Allocating String li $v0, 9 @@ -7272,7 +8319,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 45 @@ -7282,49 +8329,23 @@ sw $v0, 4($sp) # internal_17 = "-" - lw $t0, 4($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 28($sp) - j end_assign - not_is_Bool_or_Int: # internal_11 = internal_17 lw $t0, 4($sp) sw $t0, 28($sp) - end_assign: - # Jumping to endif_8789948669356 - j endif_8789948669356 + # Jumping to endif_8768338408424 + j endif_8768338408424 - endif_8789948669356: + endif_8768338408424: - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 48($sp) - j end_assign - not_is_Bool_or_Int: # internal_6 = internal_11 lw $t0, 28($sp) sw $t0, 48($sp) - end_assign: - # Jumping to endif_8789948669368 - j endif_8789948669368 + # Jumping to endif_8768338408436 + j endif_8768338408436 - else_8789948669368: + else_8768338408436: # Allocating String li $v0, 9 @@ -7334,7 +8355,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 45 @@ -7344,49 +8365,23 @@ sw $v0, 0($sp) # internal_18 = "-" - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 48($sp) - j end_assign - not_is_Bool_or_Int: # internal_6 = internal_18 lw $t0, 0($sp) sw $t0, 48($sp) - end_assign: - # Jumping to endif_8789948669368 - j endif_8789948669368 + # Jumping to endif_8768338408436 + j endif_8768338408436 - endif_8789948669368: + endif_8768338408436: - lw $t0, 48($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 72($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_6 lw $t0, 48($sp) sw $t0, 72($sp) - end_assign: - # Jumping to endif_8789948669374 - j endif_8789948669374 + # Jumping to endif_8768338408442 + j endif_8768338408442 - endif_8789948669374: + endif_8768338408442: # Loading return value in $v1 lw $v1, 72($sp) @@ -7398,11 +8393,11 @@ function_evolve_at_CellularAutomaton: # Function parameters - # $ra = 48($sp) - # self = 44($sp) + # $ra = 44($sp) + # self = 40($sp) # Reserving space for local variables - addi $sp, $sp, -44 + addi $sp, $sp, -40 # Allocating Int 0 li $v0, 9 @@ -7414,55 +8409,57 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_1 = address of allocated object Int + sw $v0, 32($sp) # internal_1 = address of allocated object Int - lw $t0, 36($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: - # position = internal_1 - lw $t0, 36($sp) - sw $t0, 40($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_1 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 48($sp) # position = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 52($sp) + lw $t0, 48($sp) sw $t0, 0($sp) # Storing self # Calling function function_num_cells_at_CellularAutomaton jal function_num_cells_at_CellularAutomaton lw $ra, 4($sp) - sw $v1, 36($sp) # internal_3 = result of function_num_cells_at_CellularAutomaton + sw $v1, 32($sp) # internal_3 = result of function_num_cells_at_CellularAutomaton addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 32($sp) - j end_assign - not_is_Bool_or_Int: - # num = internal_3 - lw $t0, 28($sp) - sw $t0, 32($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_3 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 40($sp) # num = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating String li $v0, 9 @@ -7472,77 +8469,60 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 9 sw $t0, 4($v0) # Setting length of the string in the second word of the object sb $zero, 8($v0) # Null-terminator at the end of the string - sw $v0, 24($sp) # temp = "" + sw $v0, 20($sp) # temp = "" - while_start_8789948669724: + while_start_8768338408792: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 52($sp) + lw $t0, 48($sp) sw $t0, 4($sp) # Storing position # Argument num - lw $t0, 44($sp) + lw $t0, 40($sp) sw $t0, 0($sp) # Storing num # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 28($sp) # internal_6 = result of function_less_than - addi $sp, $sp, 12 # Freeing space for arguments - - lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 20($sp) - j end_assign - not_is_Bool_or_Int: - # internal_5 = internal_6 - lw $t0, 16($sp) - sw $t0, 20($sp) - end_assign: + sw $v1, 28($sp) # internal_5 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments - # If internal_5 then goto while_body_8789948669724 - lw $t0, 20($sp) # Loading the address of the condition + # If internal_5 then goto while_body_8768338408792 + lw $t0, 16($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8789948669724 + beq $t0, $t1, while_body_8768338408792 - # Jumping to while_end_8789948669724 - j while_end_8789948669724 + # Jumping to while_end_8768338408792 + j while_end_8768338408792 - while_body_8789948669724: + while_body_8768338408792: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 56($sp) + lw $t0, 52($sp) sw $t0, 4($sp) # Storing self # Argument position - lw $t0, 52($sp) + lw $t0, 48($sp) sw $t0, 0($sp) # Storing position # Calling function function_cell_at_next_evolution_at_CellularAutomaton jal function_cell_at_next_evolution_at_CellularAutomaton lw $ra, 8($sp) - sw $v1, 24($sp) # internal_7 = result of function_cell_at_next_evolution_at_CellularAutomaton + sw $v1, 24($sp) # internal_6 = result of function_cell_at_next_evolution_at_CellularAutomaton addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -7550,35 +8530,36 @@ sw $ra, 8($sp) # Storing return address # Argument temp - lw $t0, 36($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing temp - # Argument internal_7 + # Argument internal_6 lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_7 + sw $t0, 0($sp) # Storing internal_6 # Calling function function_concat_at_String jal function_concat_at_String lw $ra, 8($sp) - sw $v1, 20($sp) # internal_8 = result of function_concat_at_String + sw $v1, 20($sp) # internal_7 = result of function_concat_at_String addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: - # temp = internal_8 - lw $t0, 8($sp) - sw $t0, 24($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument temp + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing temp + + # Argument internal_7 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 32($sp) # temp = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 li $v0, 9 @@ -7590,58 +8571,91 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_9 = address of allocated object Int + sw $v0, 4($sp) # internal_8 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 52($sp) + lw $t0, 48($sp) sw $t0, 4($sp) # Storing position - # Argument internal_9 + # Argument internal_8 lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_9 + sw $t0, 0($sp) # Storing internal_8 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 12($sp) # internal_10 = result of function_add + sw $v1, 12($sp) # internal_9 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: - # position = internal_10 - lw $t0, 0($sp) - sw $t0, 40($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_9 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 48($sp) # position = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to while_start_8789948669724 - j while_start_8789948669724 + # Jumping to while_start_8768338408792 + j while_start_8768338408792 - while_end_8789948669724: + while_end_8768338408792: # Set attribute population_map of self - lw $t0, 44($sp) # $t0 = self - lw $t1, 24($sp) # $t1 = temp + lw $t0, 40($sp) # $t0 = self + lw $t1, 20($sp) # $t1 = temp + beq $t1, $zero, object_set_attribute_8768338355706 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338355706 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338355706 + j object_set_attribute_8768338355706 + int_set_attribute_8768338355706: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.population_map = temp + j end_set_attribute_8768338355706 + bool_set_attribute_8768338355706: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.population_map = temp + j end_set_attribute_8768338355706 + object_set_attribute_8768338355706: sw $t1, 20($t0) # self.population_map = temp + end_set_attribute_8768338355706: # Loading return value in $v1 - lw $v1, 44($sp) + lw $v1, 40($sp) # Freeing space for local variables - addi $sp, $sp, 44 + addi $sp, $sp, 40 jr $ra @@ -7653,6 +8667,18 @@ # Reserving space for local variables addi $sp, $sp, -624 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 620($sp) # num = address of allocated object Int + # Allocating String li $v0, 9 addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator @@ -7661,7 +8687,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 24 + addi $t0, $zero, 33 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 @@ -7766,7 +8792,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 12 + addi $t0, $zero, 21 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 @@ -7835,7 +8861,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 47 + addi $t0, $zero, 56 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 @@ -8009,7 +9035,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 47 + addi $t0, $zero, 56 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 @@ -8183,7 +9209,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 9 + addi $t0, $zero, 18 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 @@ -8243,7 +9269,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 25 + addi $t0, $zero, 34 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 @@ -8351,7 +9377,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 21 + addi $t0, $zero, 30 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 @@ -8447,7 +9473,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 27 + addi $t0, $zero, 36 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 @@ -8561,7 +9587,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 24 + addi $t0, $zero, 33 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 @@ -8666,7 +9692,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 10 + addi $t0, $zero, 19 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 @@ -8729,7 +9755,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 20 + addi $t0, $zero, 29 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 @@ -8822,7 +9848,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 31 + addi $t0, $zero, 40 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 @@ -8948,7 +9974,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 17 + addi $t0, $zero, 26 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 @@ -9032,7 +10058,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 11 + addi $t0, $zero, 20 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 @@ -9098,7 +10124,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 16 + addi $t0, $zero, 25 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 @@ -9179,7 +10205,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 11 + addi $t0, $zero, 20 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 @@ -9245,7 +10271,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 12 + addi $t0, $zero, 21 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 @@ -9314,7 +10340,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 12 + addi $t0, $zero, 21 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 @@ -9383,7 +10409,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 11 + addi $t0, $zero, 20 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 @@ -9449,7 +10475,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 12 + addi $t0, $zero, 21 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 @@ -9518,7 +10544,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 12 + addi $t0, $zero, 21 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 @@ -9587,7 +10613,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 12 + addi $t0, $zero, 21 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 @@ -9656,7 +10682,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 15 + addi $t0, $zero, 24 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 89 @@ -9740,22 +10766,23 @@ sw $v1, 440($sp) # internal_47 = result of function_in_int_at_IO addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 432($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 620($sp) - j end_assign - not_is_Bool_or_Int: - # num = internal_47 - lw $t0, 432($sp) - sw $t0, 620($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 632($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_47 + lw $t0, 444($sp) + sw $t0, 0($sp) # Storing internal_47 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 632($sp) # num = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating String li $v0, 9 @@ -9765,7 +10792,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 @@ -9793,7 +10820,6 @@ sw $v1, 436($sp) # internal_49 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -9836,33 +10862,20 @@ sw $v1, 420($sp) # internal_53 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 408($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 416($sp) - j end_assign - not_is_Bool_or_Int: # internal_51 = internal_53 lw $t0, 408($sp) sw $t0, 416($sp) - end_assign: - # If internal_51 then goto then_8789948671922 + # If internal_51 then goto then_8768338410734 lw $t0, 416($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948671922 + beq $t0, $t1, then_8768338410734 - # Jumping to else_8789948671922 - j else_8789948671922 + # Jumping to else_8768338410734 + j else_8768338410734 - then_8789948671922: + then_8768338410734: # Allocating String li $v0, 9 @@ -9872,7 +10885,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 20 + addi $t0, $zero, 29 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -9939,28 +10952,14 @@ sw $v0, 404($sp) # internal_54 = " XX XXXX XXXX XX " - lw $t0, 404($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 420($sp) - j end_assign - not_is_Bool_or_Int: # internal_50 = internal_54 lw $t0, 404($sp) sw $t0, 420($sp) - end_assign: - - # Jumping to endif_8789948671922 - j endif_8789948671922 - else_8789948671922: + # Jumping to endif_8768338410734 + j endif_8768338410734 + else_8768338410734: # Allocating Bool 0 li $v0, 9 @@ -10004,33 +11003,20 @@ sw $v1, 400($sp) # internal_58 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 388($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 396($sp) - j end_assign - not_is_Bool_or_Int: # internal_56 = internal_58 lw $t0, 388($sp) sw $t0, 396($sp) - end_assign: - # If internal_56 then goto then_8789948671916 + # If internal_56 then goto then_8768338410728 lw $t0, 396($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948671916 + beq $t0, $t1, then_8768338410728 - # Jumping to else_8789948671916 - j else_8789948671916 + # Jumping to else_8768338410728 + j else_8768338410728 - then_8789948671916: + then_8768338410728: # Allocating String li $v0, 9 @@ -10040,7 +11026,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 25 + addi $t0, $zero, 34 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -10122,28 +11108,14 @@ sw $v0, 384($sp) # internal_59 = " X X X X X " - lw $t0, 384($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 400($sp) - j end_assign - not_is_Bool_or_Int: # internal_55 = internal_59 lw $t0, 384($sp) sw $t0, 400($sp) - end_assign: - - # Jumping to endif_8789948671916 - j endif_8789948671916 - else_8789948671916: + # Jumping to endif_8768338410728 + j endif_8768338410728 + else_8768338410728: # Allocating Bool 0 li $v0, 9 @@ -10187,33 +11159,20 @@ sw $v1, 380($sp) # internal_63 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 368($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 376($sp) - j end_assign - not_is_Bool_or_Int: # internal_61 = internal_63 lw $t0, 368($sp) sw $t0, 376($sp) - end_assign: - # If internal_61 then goto then_8789948671910 + # If internal_61 then goto then_8768338410722 lw $t0, 376($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948671910 + beq $t0, $t1, then_8768338410722 - # Jumping to else_8789948671910 - j else_8789948671910 + # Jumping to else_8768338410722 + j else_8768338410722 - then_8789948671910: + then_8768338410722: # Allocating String li $v0, 9 @@ -10223,7 +11182,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 25 + addi $t0, $zero, 34 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 @@ -10305,28 +11264,14 @@ sw $v0, 364($sp) # internal_64 = "X X X X X" - lw $t0, 364($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 380($sp) - j end_assign - not_is_Bool_or_Int: # internal_60 = internal_64 lw $t0, 364($sp) sw $t0, 380($sp) - end_assign: - - # Jumping to endif_8789948671910 - j endif_8789948671910 - else_8789948671910: + # Jumping to endif_8768338410722 + j endif_8768338410722 + else_8768338410722: # Allocating Bool 0 li $v0, 9 @@ -10370,33 +11315,20 @@ sw $v1, 360($sp) # internal_68 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 348($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 356($sp) - j end_assign - not_is_Bool_or_Int: # internal_66 = internal_68 lw $t0, 348($sp) sw $t0, 356($sp) - end_assign: - # If internal_66 then goto then_8789948671904 + # If internal_66 then goto then_8768338410716 lw $t0, 356($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948671904 + beq $t0, $t1, then_8768338410716 - # Jumping to else_8789948671904 - j else_8789948671904 + # Jumping to else_8768338410716 + j else_8768338410716 - then_8789948671904: + then_8768338410716: # Allocating String li $v0, 9 @@ -10406,7 +11338,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 25 + addi $t0, $zero, 34 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 @@ -10488,28 +11420,14 @@ sw $v0, 344($sp) # internal_69 = "X X X X X X X X X" - lw $t0, 344($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 360($sp) - j end_assign - not_is_Bool_or_Int: # internal_65 = internal_69 lw $t0, 344($sp) sw $t0, 360($sp) - end_assign: - - # Jumping to endif_8789948671904 - j endif_8789948671904 - else_8789948671904: + # Jumping to endif_8768338410716 + j endif_8768338410716 + else_8768338410716: # Allocating Bool 0 li $v0, 9 @@ -10553,33 +11471,20 @@ sw $v1, 340($sp) # internal_73 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 328($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 336($sp) - j end_assign - not_is_Bool_or_Int: # internal_71 = internal_73 lw $t0, 328($sp) sw $t0, 336($sp) - end_assign: - # If internal_71 then goto then_8789948671898 + # If internal_71 then goto then_8768338410710 lw $t0, 336($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948671898 + beq $t0, $t1, then_8768338410710 - # Jumping to else_8789948671898 - j else_8789948671898 + # Jumping to else_8768338410710 + j else_8768338410710 - then_8789948671898: + then_8768338410710: # Allocating String li $v0, 9 @@ -10589,7 +11494,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 25 + addi $t0, $zero, 34 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 @@ -10671,28 +11576,14 @@ sw $v0, 324($sp) # internal_74 = "X X X X X " - lw $t0, 324($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 340($sp) - j end_assign - not_is_Bool_or_Int: # internal_70 = internal_74 lw $t0, 324($sp) sw $t0, 340($sp) - end_assign: - - # Jumping to endif_8789948671898 - j endif_8789948671898 - else_8789948671898: + # Jumping to endif_8768338410710 + j endif_8768338410710 + else_8768338410710: # Allocating Bool 0 li $v0, 9 @@ -10736,33 +11627,20 @@ sw $v1, 320($sp) # internal_78 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 308($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 316($sp) - j end_assign - not_is_Bool_or_Int: # internal_76 = internal_78 lw $t0, 308($sp) sw $t0, 316($sp) - end_assign: - # If internal_76 then goto then_8789948671892 + # If internal_76 then goto then_8768338410704 lw $t0, 316($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948671892 + beq $t0, $t1, then_8768338410704 - # Jumping to else_8789948671892 - j else_8789948671892 + # Jumping to else_8768338410704 + j else_8768338410704 - then_8789948671892: + then_8768338410704: # Allocating String li $v0, 9 @@ -10772,7 +11650,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 25 + addi $t0, $zero, 34 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -10854,28 +11732,14 @@ sw $v0, 304($sp) # internal_79 = " X X X X X" - lw $t0, 304($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 320($sp) - j end_assign - not_is_Bool_or_Int: # internal_75 = internal_79 lw $t0, 304($sp) sw $t0, 320($sp) - end_assign: - - # Jumping to endif_8789948671892 - j endif_8789948671892 - else_8789948671892: + # Jumping to endif_8768338410704 + j endif_8768338410704 + else_8768338410704: # Allocating Bool 0 li $v0, 9 @@ -10919,33 +11783,20 @@ sw $v1, 300($sp) # internal_83 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 288($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 296($sp) - j end_assign - not_is_Bool_or_Int: # internal_81 = internal_83 lw $t0, 288($sp) sw $t0, 296($sp) - end_assign: - # If internal_81 then goto then_8789948671886 + # If internal_81 then goto then_8768338410698 lw $t0, 296($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948671886 + beq $t0, $t1, then_8768338410698 - # Jumping to else_8789948671886 - j else_8789948671886 + # Jumping to else_8768338410698 + j else_8768338410698 - then_8789948671886: + then_8768338410698: # Allocating String li $v0, 9 @@ -10955,7 +11806,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 20 + addi $t0, $zero, 29 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 @@ -11022,28 +11873,14 @@ sw $v0, 284($sp) # internal_84 = "X X X XX X " - lw $t0, 284($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 300($sp) - j end_assign - not_is_Bool_or_Int: # internal_80 = internal_84 lw $t0, 284($sp) sw $t0, 300($sp) - end_assign: - # Jumping to endif_8789948671886 - j endif_8789948671886 - - else_8789948671886: + # Jumping to endif_8768338410698 + j endif_8768338410698 + else_8768338410698: # Allocating Bool 0 li $v0, 9 @@ -11087,33 +11924,20 @@ sw $v1, 280($sp) # internal_88 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 268($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 276($sp) - j end_assign - not_is_Bool_or_Int: # internal_86 = internal_88 lw $t0, 268($sp) sw $t0, 276($sp) - end_assign: - # If internal_86 then goto then_8789948671880 + # If internal_86 then goto then_8768338410692 lw $t0, 276($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948671880 + beq $t0, $t1, then_8768338410692 - # Jumping to else_8789948671880 - j else_8789948671880 + # Jumping to else_8768338410692 + j else_8768338410692 - then_8789948671880: + then_8768338410692: # Allocating String li $v0, 9 @@ -11123,7 +11947,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 20 + addi $t0, $zero, 29 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -11190,28 +12014,14 @@ sw $v0, 264($sp) # internal_89 = " X XX X X X " - lw $t0, 264($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 280($sp) - j end_assign - not_is_Bool_or_Int: # internal_85 = internal_89 lw $t0, 264($sp) sw $t0, 280($sp) - end_assign: - - # Jumping to endif_8789948671880 - j endif_8789948671880 - else_8789948671880: + # Jumping to endif_8768338410692 + j endif_8768338410692 + else_8768338410692: # Allocating Bool 0 li $v0, 9 @@ -11255,33 +12065,20 @@ sw $v1, 260($sp) # internal_93 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 248($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 256($sp) - j end_assign - not_is_Bool_or_Int: # internal_91 = internal_93 lw $t0, 248($sp) sw $t0, 256($sp) - end_assign: - # If internal_91 then goto then_8789948671874 + # If internal_91 then goto then_8768338410686 lw $t0, 256($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948671874 + beq $t0, $t1, then_8768338410686 - # Jumping to else_8789948671874 - j else_8789948671874 + # Jumping to else_8768338410686 + j else_8768338410686 - then_8789948671874: + then_8768338410686: # Allocating String li $v0, 9 @@ -11291,7 +12088,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 15 + addi $t0, $zero, 24 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 @@ -11343,28 +12140,14 @@ sw $v0, 244($sp) # internal_94 = "X X X X X " - lw $t0, 244($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 260($sp) - j end_assign - not_is_Bool_or_Int: # internal_90 = internal_94 lw $t0, 244($sp) sw $t0, 260($sp) - end_assign: - # Jumping to endif_8789948671874 - j endif_8789948671874 - - else_8789948671874: + # Jumping to endif_8768338410686 + j endif_8768338410686 + else_8768338410686: # Allocating Bool 0 li $v0, 9 @@ -11408,33 +12191,20 @@ sw $v1, 240($sp) # internal_98 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 228($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 236($sp) - j end_assign - not_is_Bool_or_Int: # internal_96 = internal_98 lw $t0, 228($sp) sw $t0, 236($sp) - end_assign: - # If internal_96 then goto then_8789948671868 + # If internal_96 then goto then_8768338410680 lw $t0, 236($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948671868 + beq $t0, $t1, then_8768338410680 - # Jumping to else_8789948671868 - j else_8789948671868 + # Jumping to else_8768338410680 + j else_8768338410680 - then_8789948671868: + then_8768338410680: # Allocating String li $v0, 9 @@ -11444,7 +12214,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 15 + addi $t0, $zero, 24 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -11496,28 +12266,14 @@ sw $v0, 224($sp) # internal_99 = " X X X X X" - lw $t0, 224($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 240($sp) - j end_assign - not_is_Bool_or_Int: # internal_95 = internal_99 lw $t0, 224($sp) sw $t0, 240($sp) - end_assign: - - # Jumping to endif_8789948671868 - j endif_8789948671868 - else_8789948671868: + # Jumping to endif_8768338410680 + j endif_8768338410680 + else_8768338410680: # Allocating Bool 0 li $v0, 9 @@ -11561,33 +12317,20 @@ sw $v1, 220($sp) # internal_103 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 208($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 216($sp) - j end_assign - not_is_Bool_or_Int: # internal_101 = internal_103 lw $t0, 208($sp) sw $t0, 216($sp) - end_assign: - # If internal_101 then goto then_8789948671862 + # If internal_101 then goto then_8768338410674 lw $t0, 216($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948671862 + beq $t0, $t1, then_8768338410674 - # Jumping to else_8789948671862 - j else_8789948671862 + # Jumping to else_8768338410674 + j else_8768338410674 - then_8789948671862: + then_8768338410674: # Allocating String li $v0, 9 @@ -11597,7 +12340,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 15 + addi $t0, $zero, 24 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 @@ -11649,28 +12392,14 @@ sw $v0, 204($sp) # internal_104 = "X X X X X X X X" - lw $t0, 204($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 220($sp) - j end_assign - not_is_Bool_or_Int: # internal_100 = internal_104 lw $t0, 204($sp) sw $t0, 220($sp) - end_assign: - # Jumping to endif_8789948671862 - j endif_8789948671862 - - else_8789948671862: + # Jumping to endif_8768338410674 + j endif_8768338410674 + else_8768338410674: # Allocating Bool 0 li $v0, 9 @@ -11714,33 +12443,20 @@ sw $v1, 200($sp) # internal_108 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 188($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 196($sp) - j end_assign - not_is_Bool_or_Int: # internal_106 = internal_108 lw $t0, 188($sp) sw $t0, 196($sp) - end_assign: - # If internal_106 then goto then_8789948671856 + # If internal_106 then goto then_8768338410668 lw $t0, 196($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948671856 + beq $t0, $t1, then_8768338410668 - # Jumping to else_8789948671856 - j else_8789948671856 + # Jumping to else_8768338410668 + j else_8768338410668 - then_8789948671856: + then_8768338410668: # Allocating String li $v0, 9 @@ -11750,7 +12466,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 25 + addi $t0, $zero, 34 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 @@ -11832,28 +12548,14 @@ sw $v0, 184($sp) # internal_109 = "XXXXXXXXXXXXXXXXXXXXXXXXX" - lw $t0, 184($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 200($sp) - j end_assign - not_is_Bool_or_Int: # internal_105 = internal_109 lw $t0, 184($sp) sw $t0, 200($sp) - end_assign: - # Jumping to endif_8789948671856 - j endif_8789948671856 - - else_8789948671856: + # Jumping to endif_8768338410668 + j endif_8768338410668 + else_8768338410668: # Allocating Bool 0 li $v0, 9 @@ -11897,33 +12599,20 @@ sw $v1, 180($sp) # internal_113 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 168($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 176($sp) - j end_assign - not_is_Bool_or_Int: # internal_111 = internal_113 lw $t0, 168($sp) sw $t0, 176($sp) - end_assign: - # If internal_111 then goto then_8789948671850 + # If internal_111 then goto then_8768338410662 lw $t0, 176($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948671850 + beq $t0, $t1, then_8768338410662 - # Jumping to else_8789948671850 - j else_8789948671850 + # Jumping to else_8768338410662 + j else_8768338410662 - then_8789948671850: + then_8768338410662: # Allocating String li $v0, 9 @@ -11933,7 +12622,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 25 + addi $t0, $zero, 34 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 @@ -12015,28 +12704,14 @@ sw $v0, 164($sp) # internal_114 = "XXXXX X X X X " - lw $t0, 164($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 180($sp) - j end_assign - not_is_Bool_or_Int: # internal_110 = internal_114 lw $t0, 164($sp) sw $t0, 180($sp) - end_assign: - # Jumping to endif_8789948671850 - j endif_8789948671850 - - else_8789948671850: + # Jumping to endif_8768338410662 + j endif_8768338410662 + else_8768338410662: # Allocating Bool 0 li $v0, 9 @@ -12080,33 +12755,20 @@ sw $v1, 160($sp) # internal_118 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 148($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 156($sp) - j end_assign - not_is_Bool_or_Int: # internal_116 = internal_118 lw $t0, 148($sp) sw $t0, 156($sp) - end_assign: - # If internal_116 then goto then_8789948671844 + # If internal_116 then goto then_8768338410656 lw $t0, 156($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948671844 + beq $t0, $t1, then_8768338410656 - # Jumping to else_8789948671844 - j else_8789948671844 + # Jumping to else_8768338410656 + j else_8768338410656 - then_8789948671844: + then_8768338410656: # Allocating String li $v0, 9 @@ -12116,7 +12778,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 25 + addi $t0, $zero, 34 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -12198,28 +12860,14 @@ sw $v0, 144($sp) # internal_119 = " X X XXXXX X X " - lw $t0, 144($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 160($sp) - j end_assign - not_is_Bool_or_Int: # internal_115 = internal_119 lw $t0, 144($sp) sw $t0, 160($sp) - end_assign: - # Jumping to endif_8789948671844 - j endif_8789948671844 - - else_8789948671844: + # Jumping to endif_8768338410656 + j endif_8768338410656 + else_8768338410656: # Allocating Bool 0 li $v0, 9 @@ -12263,33 +12911,20 @@ sw $v1, 140($sp) # internal_123 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 128($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 136($sp) - j end_assign - not_is_Bool_or_Int: # internal_121 = internal_123 lw $t0, 128($sp) sw $t0, 136($sp) - end_assign: - # If internal_121 then goto then_8789948671838 + # If internal_121 then goto then_8768338410650 lw $t0, 136($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948671838 + beq $t0, $t1, then_8768338410650 - # Jumping to else_8789948671838 - j else_8789948671838 + # Jumping to else_8768338410650 + j else_8768338410650 - then_8789948671838: + then_8768338410650: # Allocating String li $v0, 9 @@ -12299,7 +12934,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 21 + addi $t0, $zero, 30 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 @@ -12369,28 +13004,14 @@ sw $v0, 124($sp) # internal_124 = "X X X X X X X " - lw $t0, 124($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 140($sp) - j end_assign - not_is_Bool_or_Int: # internal_120 = internal_124 lw $t0, 124($sp) sw $t0, 140($sp) - end_assign: - # Jumping to endif_8789948671838 - j endif_8789948671838 - - else_8789948671838: + # Jumping to endif_8768338410650 + j endif_8768338410650 + else_8768338410650: # Allocating Bool 0 li $v0, 9 @@ -12434,33 +13055,20 @@ sw $v1, 120($sp) # internal_128 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 108($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 116($sp) - j end_assign - not_is_Bool_or_Int: # internal_126 = internal_128 lw $t0, 108($sp) sw $t0, 116($sp) - end_assign: - # If internal_126 then goto then_8789948671832 + # If internal_126 then goto then_8768338410644 lw $t0, 116($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948671832 + beq $t0, $t1, then_8768338410644 - # Jumping to else_8789948671832 - j else_8789948671832 + # Jumping to else_8768338410644 + j else_8768338410644 - then_8789948671832: + then_8768338410644: # Allocating String li $v0, 9 @@ -12470,7 +13078,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 21 + addi $t0, $zero, 30 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -12540,28 +13148,14 @@ sw $v0, 104($sp) # internal_129 = " X X X X X X X" - lw $t0, 104($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 120($sp) - j end_assign - not_is_Bool_or_Int: # internal_125 = internal_129 lw $t0, 104($sp) sw $t0, 120($sp) - end_assign: - # Jumping to endif_8789948671832 - j endif_8789948671832 - - else_8789948671832: + # Jumping to endif_8768338410644 + j endif_8768338410644 + else_8768338410644: # Allocating Bool 0 li $v0, 9 @@ -12605,33 +13199,20 @@ sw $v1, 100($sp) # internal_133 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 88($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 96($sp) - j end_assign - not_is_Bool_or_Int: # internal_131 = internal_133 lw $t0, 88($sp) sw $t0, 96($sp) - end_assign: - # If internal_131 then goto then_8789948671826 + # If internal_131 then goto then_8768338410638 lw $t0, 96($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948671826 + beq $t0, $t1, then_8768338410638 - # Jumping to else_8789948671826 - j else_8789948671826 + # Jumping to else_8768338410638 + j else_8768338410638 - then_8789948671826: + then_8768338410638: # Allocating String li $v0, 9 @@ -12641,7 +13222,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 28 + addi $t0, $zero, 37 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 @@ -12732,28 +13313,14 @@ sw $v0, 84($sp) # internal_134 = "XXXXX X XXXXX X XXXX" - lw $t0, 84($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 100($sp) - j end_assign - not_is_Bool_or_Int: # internal_130 = internal_134 lw $t0, 84($sp) sw $t0, 100($sp) - end_assign: - # Jumping to endif_8789948671826 - j endif_8789948671826 - - else_8789948671826: + # Jumping to endif_8768338410638 + j endif_8768338410638 + else_8768338410638: # Allocating Bool 0 li $v0, 9 @@ -12797,33 +13364,20 @@ sw $v1, 80($sp) # internal_138 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 68($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 76($sp) - j end_assign - not_is_Bool_or_Int: # internal_136 = internal_138 lw $t0, 68($sp) sw $t0, 76($sp) - end_assign: - # If internal_136 then goto then_8789948671820 + # If internal_136 then goto then_8768338410632 lw $t0, 76($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948671820 + beq $t0, $t1, then_8768338410632 - # Jumping to else_8789948671820 - j else_8789948671820 + # Jumping to else_8768338410632 + j else_8768338410632 - then_8789948671820: + then_8768338410632: # Allocating String li $v0, 9 @@ -12833,7 +13387,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 28 + addi $t0, $zero, 37 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 @@ -12924,28 +13478,14 @@ sw $v0, 64($sp) # internal_139 = "XXX X X X X XXXX " - lw $t0, 64($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 80($sp) - j end_assign - not_is_Bool_or_Int: # internal_135 = internal_139 lw $t0, 64($sp) sw $t0, 80($sp) - end_assign: - # Jumping to endif_8789948671820 - j endif_8789948671820 - - else_8789948671820: + # Jumping to endif_8768338410632 + j endif_8768338410632 + else_8768338410632: # Allocating Bool 0 li $v0, 9 @@ -12989,33 +13529,20 @@ sw $v1, 60($sp) # internal_143 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 48($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 56($sp) - j end_assign - not_is_Bool_or_Int: # internal_141 = internal_143 lw $t0, 48($sp) sw $t0, 56($sp) - end_assign: - # If internal_141 then goto then_8789948671814 + # If internal_141 then goto then_8768338410626 lw $t0, 56($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948671814 + beq $t0, $t1, then_8768338410626 - # Jumping to else_8789948671814 - j else_8789948671814 + # Jumping to else_8768338410626 + j else_8768338410626 - then_8789948671814: + then_8768338410626: # Allocating String li $v0, 9 @@ -13025,7 +13552,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 16 + addi $t0, $zero, 25 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -13080,28 +13607,14 @@ sw $v0, 44($sp) # internal_144 = " XX X XX X XX " - lw $t0, 44($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: # internal_140 = internal_144 lw $t0, 44($sp) sw $t0, 60($sp) - end_assign: - - # Jumping to endif_8789948671814 - j endif_8789948671814 - else_8789948671814: + # Jumping to endif_8768338410626 + j endif_8768338410626 + else_8768338410626: # Allocating Bool 0 li $v0, 9 @@ -13145,33 +13658,20 @@ sw $v1, 40($sp) # internal_148 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 36($sp) - j end_assign - not_is_Bool_or_Int: # internal_146 = internal_148 lw $t0, 28($sp) sw $t0, 36($sp) - end_assign: - # If internal_146 then goto then_8789948671808 + # If internal_146 then goto then_8768338410620 lw $t0, 36($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948671808 + beq $t0, $t1, then_8768338410620 - # Jumping to else_8789948671808 - j else_8789948671808 + # Jumping to else_8768338410620 + j else_8768338410620 - then_8789948671808: + then_8768338410620: # Allocating String li $v0, 9 @@ -13181,7 +13681,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 28 + addi $t0, $zero, 37 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -13272,28 +13772,14 @@ sw $v0, 24($sp) # internal_149 = " XX X XX X XX X XX X XX " - lw $t0, 24($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: # internal_145 = internal_149 lw $t0, 24($sp) sw $t0, 40($sp) - end_assign: - # Jumping to endif_8789948671808 - j endif_8789948671808 - - else_8789948671808: + # Jumping to endif_8768338410620 + j endif_8768338410620 + else_8768338410620: # Allocating Bool 0 li $v0, 9 @@ -13337,33 +13823,20 @@ sw $v1, 20($sp) # internal_153 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 16($sp) - j end_assign - not_is_Bool_or_Int: # internal_151 = internal_153 lw $t0, 8($sp) sw $t0, 16($sp) - end_assign: - # If internal_151 then goto then_8789948671802 + # If internal_151 then goto then_8768338410614 lw $t0, 16($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948671802 + beq $t0, $t1, then_8768338410614 - # Jumping to else_8789948671802 - j else_8789948671802 + # Jumping to else_8768338410614 + j else_8768338410614 - then_8789948671802: + then_8768338410614: # Allocating String li $v0, 9 @@ -13373,7 +13846,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 28 + addi $t0, $zero, 37 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -13464,27 +13937,14 @@ sw $v0, 4($sp) # internal_154 = " XXXX X XX X XXXX " - lw $t0, 4($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 20($sp) - j end_assign - not_is_Bool_or_Int: # internal_150 = internal_154 lw $t0, 4($sp) sw $t0, 20($sp) - end_assign: - # Jumping to endif_8789948671802 - j endif_8789948671802 + # Jumping to endif_8768338410614 + j endif_8768338410614 - else_8789948671802: + else_8768338410614: # Allocating String li $v0, 9 @@ -13494,7 +13954,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 25 + addi $t0, $zero, 34 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -13576,467 +14036,194 @@ sw $v0, 0($sp) # internal_155 = " " - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 20($sp) - j end_assign - not_is_Bool_or_Int: # internal_150 = internal_155 lw $t0, 0($sp) sw $t0, 20($sp) - end_assign: - # Jumping to endif_8789948671802 - j endif_8789948671802 + # Jumping to endif_8768338410614 + j endif_8768338410614 - endif_8789948671802: + endif_8768338410614: - lw $t0, 20($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: # internal_145 = internal_150 lw $t0, 20($sp) sw $t0, 40($sp) - end_assign: - # Jumping to endif_8789948671808 - j endif_8789948671808 + # Jumping to endif_8768338410620 + j endif_8768338410620 - endif_8789948671808: + endif_8768338410620: - lw $t0, 40($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 60($sp) - j end_assign - not_is_Bool_or_Int: # internal_140 = internal_145 lw $t0, 40($sp) sw $t0, 60($sp) - end_assign: - # Jumping to endif_8789948671814 - j endif_8789948671814 + # Jumping to endif_8768338410626 + j endif_8768338410626 - endif_8789948671814: + endif_8768338410626: - lw $t0, 60($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 80($sp) - j end_assign - not_is_Bool_or_Int: # internal_135 = internal_140 lw $t0, 60($sp) sw $t0, 80($sp) - end_assign: - # Jumping to endif_8789948671820 - j endif_8789948671820 + # Jumping to endif_8768338410632 + j endif_8768338410632 - endif_8789948671820: + endif_8768338410632: - lw $t0, 80($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 100($sp) - j end_assign - not_is_Bool_or_Int: # internal_130 = internal_135 lw $t0, 80($sp) sw $t0, 100($sp) - end_assign: - # Jumping to endif_8789948671826 - j endif_8789948671826 + # Jumping to endif_8768338410638 + j endif_8768338410638 - endif_8789948671826: + endif_8768338410638: - lw $t0, 100($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 120($sp) - j end_assign - not_is_Bool_or_Int: # internal_125 = internal_130 lw $t0, 100($sp) sw $t0, 120($sp) - end_assign: - # Jumping to endif_8789948671832 - j endif_8789948671832 + # Jumping to endif_8768338410644 + j endif_8768338410644 - endif_8789948671832: + endif_8768338410644: - lw $t0, 120($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 140($sp) - j end_assign - not_is_Bool_or_Int: # internal_120 = internal_125 lw $t0, 120($sp) sw $t0, 140($sp) - end_assign: - # Jumping to endif_8789948671838 - j endif_8789948671838 + # Jumping to endif_8768338410650 + j endif_8768338410650 - endif_8789948671838: + endif_8768338410650: - lw $t0, 140($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 160($sp) - j end_assign - not_is_Bool_or_Int: # internal_115 = internal_120 lw $t0, 140($sp) sw $t0, 160($sp) - end_assign: - # Jumping to endif_8789948671844 - j endif_8789948671844 + # Jumping to endif_8768338410656 + j endif_8768338410656 - endif_8789948671844: + endif_8768338410656: - lw $t0, 160($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 180($sp) - j end_assign - not_is_Bool_or_Int: # internal_110 = internal_115 lw $t0, 160($sp) sw $t0, 180($sp) - end_assign: - # Jumping to endif_8789948671850 - j endif_8789948671850 + # Jumping to endif_8768338410662 + j endif_8768338410662 - endif_8789948671850: + endif_8768338410662: - lw $t0, 180($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 200($sp) - j end_assign - not_is_Bool_or_Int: # internal_105 = internal_110 lw $t0, 180($sp) sw $t0, 200($sp) - end_assign: - # Jumping to endif_8789948671856 - j endif_8789948671856 + # Jumping to endif_8768338410668 + j endif_8768338410668 - endif_8789948671856: + endif_8768338410668: - lw $t0, 200($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 220($sp) - j end_assign - not_is_Bool_or_Int: # internal_100 = internal_105 lw $t0, 200($sp) sw $t0, 220($sp) - end_assign: - # Jumping to endif_8789948671862 - j endif_8789948671862 + # Jumping to endif_8768338410674 + j endif_8768338410674 - endif_8789948671862: + endif_8768338410674: - lw $t0, 220($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 240($sp) - j end_assign - not_is_Bool_or_Int: # internal_95 = internal_100 lw $t0, 220($sp) sw $t0, 240($sp) - end_assign: - # Jumping to endif_8789948671868 - j endif_8789948671868 + # Jumping to endif_8768338410680 + j endif_8768338410680 - endif_8789948671868: + endif_8768338410680: - lw $t0, 240($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 260($sp) - j end_assign - not_is_Bool_or_Int: # internal_90 = internal_95 lw $t0, 240($sp) sw $t0, 260($sp) - end_assign: - # Jumping to endif_8789948671874 - j endif_8789948671874 + # Jumping to endif_8768338410686 + j endif_8768338410686 - endif_8789948671874: + endif_8768338410686: - lw $t0, 260($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 280($sp) - j end_assign - not_is_Bool_or_Int: # internal_85 = internal_90 lw $t0, 260($sp) sw $t0, 280($sp) - end_assign: - # Jumping to endif_8789948671880 - j endif_8789948671880 + # Jumping to endif_8768338410692 + j endif_8768338410692 - endif_8789948671880: + endif_8768338410692: - lw $t0, 280($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 300($sp) - j end_assign - not_is_Bool_or_Int: # internal_80 = internal_85 lw $t0, 280($sp) sw $t0, 300($sp) - end_assign: - # Jumping to endif_8789948671886 - j endif_8789948671886 + # Jumping to endif_8768338410698 + j endif_8768338410698 - endif_8789948671886: + endif_8768338410698: - lw $t0, 300($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 320($sp) - j end_assign - not_is_Bool_or_Int: # internal_75 = internal_80 lw $t0, 300($sp) sw $t0, 320($sp) - end_assign: - # Jumping to endif_8789948671892 - j endif_8789948671892 + # Jumping to endif_8768338410704 + j endif_8768338410704 - endif_8789948671892: + endif_8768338410704: - lw $t0, 320($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 340($sp) - j end_assign - not_is_Bool_or_Int: # internal_70 = internal_75 lw $t0, 320($sp) sw $t0, 340($sp) - end_assign: - # Jumping to endif_8789948671898 - j endif_8789948671898 + # Jumping to endif_8768338410710 + j endif_8768338410710 - endif_8789948671898: + endif_8768338410710: - lw $t0, 340($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 360($sp) - j end_assign - not_is_Bool_or_Int: # internal_65 = internal_70 lw $t0, 340($sp) sw $t0, 360($sp) - end_assign: - # Jumping to endif_8789948671904 - j endif_8789948671904 + # Jumping to endif_8768338410716 + j endif_8768338410716 - endif_8789948671904: + endif_8768338410716: - lw $t0, 360($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 380($sp) - j end_assign - not_is_Bool_or_Int: # internal_60 = internal_65 lw $t0, 360($sp) sw $t0, 380($sp) - end_assign: - # Jumping to endif_8789948671910 - j endif_8789948671910 + # Jumping to endif_8768338410722 + j endif_8768338410722 - endif_8789948671910: + endif_8768338410722: - lw $t0, 380($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 400($sp) - j end_assign - not_is_Bool_or_Int: # internal_55 = internal_60 lw $t0, 380($sp) sw $t0, 400($sp) - end_assign: - # Jumping to endif_8789948671916 - j endif_8789948671916 + # Jumping to endif_8768338410728 + j endif_8768338410728 - endif_8789948671916: + endif_8768338410728: - lw $t0, 400($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 420($sp) - j end_assign - not_is_Bool_or_Int: # internal_50 = internal_55 lw $t0, 400($sp) sw $t0, 420($sp) - end_assign: - # Jumping to endif_8789948671922 - j endif_8789948671922 + # Jumping to endif_8768338410734 + j endif_8768338410734 - endif_8789948671922: + endif_8768338410734: # Loading return value in $v1 lw $v1, 420($sp) @@ -14062,7 +14249,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 9 sw $t0, 4($v0) # Setting length of the string in the second word of the object sb $zero, 8($v0) # Null-terminator at the end of the string @@ -14077,7 +14264,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 54 + addi $t0, $zero, 63 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 87 @@ -14272,7 +14459,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 49 + addi $t0, $zero, 58 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 80 @@ -14450,30 +14637,31 @@ # Argument self lw $t0, 64($sp) - sw $t0, 0($sp) # Storing self + sw $t0, 0($sp) # Storing self + + # Calling function function_in_string_at_IO + jal function_in_string_at_IO + lw $ra, 4($sp) + sw $v1, 40($sp) # internal_5 = result of function_in_string_at_IO + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument ans + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing ans - # Calling function function_in_string_at_IO - jal function_in_string_at_IO - lw $ra, 4($sp) - sw $v1, 40($sp) # internal_5 = result of function_in_string_at_IO - addi $sp, $sp, 8 # Freeing space for arguments + # Argument internal_5 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_5 - lw $t0, 32($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: - # ans = internal_5 - lw $t0, 32($sp) - sw $t0, 52($sp) - end_assign: + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 64($sp) # ans = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating String li $v0, 9 @@ -14483,7 +14671,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 @@ -14511,7 +14699,6 @@ sw $v1, 36($sp) # internal_7 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -14532,7 +14719,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 110 @@ -14560,33 +14747,20 @@ sw $v1, 20($sp) # internal_11 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 16($sp) - j end_assign - not_is_Bool_or_Int: # internal_9 = internal_11 lw $t0, 8($sp) sw $t0, 16($sp) - end_assign: - # If internal_9 then goto then_8789948672275 + # If internal_9 then goto then_8768338411087 lw $t0, 16($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948672275 + beq $t0, $t1, then_8768338411087 - # Jumping to else_8789948672275 - j else_8789948672275 + # Jumping to else_8768338411087 + j else_8768338411087 - then_8789948672275: + then_8768338411087: # Allocating Bool 0 li $v0, 9 @@ -14600,27 +14774,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 4($sp) # internal_12 = address of allocated object Int - lw $t0, 4($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 20($sp) - j end_assign - not_is_Bool_or_Int: # internal_8 = internal_12 lw $t0, 4($sp) sw $t0, 20($sp) - end_assign: - # Jumping to endif_8789948672275 - j endif_8789948672275 + # Jumping to endif_8768338411087 + j endif_8768338411087 - else_8789948672275: + else_8768338411087: # Allocating Bool 1 li $v0, 9 @@ -14634,27 +14795,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 0($sp) # internal_13 = address of allocated object Int - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 20($sp) - j end_assign - not_is_Bool_or_Int: # internal_8 = internal_13 lw $t0, 0($sp) sw $t0, 20($sp) - end_assign: - # Jumping to endif_8789948672275 - j endif_8789948672275 + # Jumping to endif_8768338411087 + j endif_8768338411087 - endif_8789948672275: + endif_8768338411087: # Loading return value in $v1 lw $v1, 20($sp) @@ -14680,7 +14828,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 9 sw $t0, 4($v0) # Setting length of the string in the second word of the object sb $zero, 8($v0) # Null-terminator at the end of the string @@ -14695,7 +14843,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 2 + addi $t0, $zero, 11 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 @@ -14734,7 +14882,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 48 + addi $t0, $zero, 57 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 87 @@ -14911,7 +15059,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 49 + addi $t0, $zero, 58 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 80 @@ -15097,23 +15245,23 @@ sw $v1, 32($sp) # internal_7 = result of function_in_string_at_IO addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 24($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 52($sp) - j end_assign - not_is_Bool_or_Int: - # ans = internal_7 - lw $t0, 24($sp) - sw $t0, 52($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument ans + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing ans + + # Argument internal_7 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_7 + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 64($sp) # ans = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bool 0 li $v0, 9 @@ -15135,7 +15283,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 121 @@ -15163,33 +15311,20 @@ sw $v1, 20($sp) # internal_11 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 16($sp) - j end_assign - not_is_Bool_or_Int: # internal_9 = internal_11 lw $t0, 8($sp) sw $t0, 16($sp) - end_assign: - # If internal_9 then goto then_8789948672371 + # If internal_9 then goto then_8768338411183 lw $t0, 16($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948672371 + beq $t0, $t1, then_8768338411183 - # Jumping to else_8789948672371 - j else_8789948672371 + # Jumping to else_8768338411183 + j else_8768338411183 - then_8789948672371: + then_8768338411183: # Allocating Bool 1 li $v0, 9 @@ -15203,27 +15338,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 4($sp) # internal_12 = address of allocated object Int - lw $t0, 4($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 20($sp) - j end_assign - not_is_Bool_or_Int: # internal_8 = internal_12 lw $t0, 4($sp) sw $t0, 20($sp) - end_assign: - # Jumping to endif_8789948672371 - j endif_8789948672371 + # Jumping to endif_8768338411183 + j endif_8768338411183 - else_8789948672371: + else_8768338411183: # Allocating Bool 0 li $v0, 9 @@ -15237,27 +15359,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 0($sp) # internal_13 = address of allocated object Int - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 20($sp) - j end_assign - not_is_Bool_or_Int: # internal_8 = internal_13 lw $t0, 0($sp) sw $t0, 20($sp) - end_assign: - # Jumping to endif_8789948672371 - j endif_8789948672371 + # Jumping to endif_8768338411183 + j endif_8768338411183 - endif_8789948672371: + endif_8768338411183: # Loading return value in $v1 lw $v1, 20($sp) @@ -15269,11 +15378,11 @@ function___init___at_Main: # Function parameters - # $ra = 20($sp) - # self = 16($sp) + # $ra = 24($sp) + # self = 20($sp) # Reserving space for local variables - addi $sp, $sp, -16 + addi $sp, $sp, -20 # Allocating Int 0 li $v0, 9 @@ -15285,12 +15394,44 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_0 = address of allocated object Int + sw $v0, 16($sp) # internal_0 = address of allocated object Int # Set attribute rows of self - lw $t0, 16($sp) # $t0 = self - lw $t1, 12($sp) # $t1 = internal_0 + lw $t0, 20($sp) # $t0 = self + lw $t1, 16($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8768338333172 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338333172 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338333172 + j object_set_attribute_8768338333172 + int_set_attribute_8768338333172: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_0 + j end_set_attribute_8768338333172 + bool_set_attribute_8768338333172: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_0 + j end_set_attribute_8768338333172 + object_set_attribute_8768338333172: sw $t1, 8($t0) # self.rows = internal_0 + end_set_attribute_8768338333172: # Allocating Int 0 li $v0, 9 @@ -15302,12 +15443,44 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_1 = address of allocated object Int + sw $v0, 12($sp) # internal_1 = address of allocated object Int # Set attribute columns of self - lw $t0, 16($sp) # $t0 = self - lw $t1, 8($sp) # $t1 = internal_1 + lw $t0, 20($sp) # $t0 = self + lw $t1, 12($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8768338333968 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338333968 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338333968 + j object_set_attribute_8768338333968 + int_set_attribute_8768338333968: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_1 + j end_set_attribute_8768338333968 + bool_set_attribute_8768338333968: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_1 + j end_set_attribute_8768338333968 + object_set_attribute_8768338333968: sw $t1, 12($t0) # self.columns = internal_1 + end_set_attribute_8768338333968: # Allocating Int 0 li $v0, 9 @@ -15319,12 +15492,44 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_2 = address of allocated object Int + sw $v0, 8($sp) # internal_2 = address of allocated object Int # Set attribute board_size of self - lw $t0, 16($sp) # $t0 = self - lw $t1, 4($sp) # $t1 = internal_2 + lw $t0, 20($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_2 + beq $t1, $zero, object_set_attribute_8768338333986 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338333986 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338333986 + j object_set_attribute_8768338333986 + int_set_attribute_8768338333986: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = internal_2 + j end_set_attribute_8768338333986 + bool_set_attribute_8768338333986: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = internal_2 + j end_set_attribute_8768338333986 + object_set_attribute_8768338333986: sw $t1, 16($t0) # self.board_size = internal_2 + end_set_attribute_8768338333986: # Allocating String li $v0, 9 @@ -15334,37 +15539,117 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 9 sw $t0, 4($v0) # Setting length of the string in the second word of the object sb $zero, 8($v0) # Null-terminator at the end of the string - sw $v0, 0($sp) # internal_3 = "" + sw $v0, 4($sp) # internal_3 = "" # Set attribute population_map of self - lw $t0, 16($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_3 + lw $t0, 20($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_3 + beq $t1, $zero, object_set_attribute_8768338334007 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338334007 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338334007 + j object_set_attribute_8768338334007 + int_set_attribute_8768338334007: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.population_map = internal_3 + j end_set_attribute_8768338334007 + bool_set_attribute_8768338334007: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.population_map = internal_3 + j end_set_attribute_8768338334007 + object_set_attribute_8768338334007: sw $t1, 20($t0) # self.population_map = internal_3 + end_set_attribute_8768338334007: + + # Allocating NUll to internal_4 + sw $zero, 0($sp) # internal_4 = 0 # Set attribute cells of self - lw $t0, 16($sp) # $t0 = self - sw $zero, 24($t0) # Set the attribute cells of self + lw $t0, 20($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_4 + beq $t1, $zero, object_set_attribute_8768338334028 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338334028 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338334028 + j object_set_attribute_8768338334028 + int_set_attribute_8768338334028: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($t0) # self.cells = internal_4 + j end_set_attribute_8768338334028 + bool_set_attribute_8768338334028: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($t0) # self.cells = internal_4 + j end_set_attribute_8768338334028 + object_set_attribute_8768338334028: + sw $t1, 24($t0) # self.cells = internal_4 + end_set_attribute_8768338334028: # Loading return value in $v1 - lw $v1, 16($sp) + lw $v1, 20($sp) # Freeing space for local variables - addi $sp, $sp, 16 + addi $sp, $sp, 20 jr $ra function_main_at_Main: # Function parameters - # $ra = 96($sp) - # self = 92($sp) + # $ra = 88($sp) + # self = 84($sp) # Reserving space for local variables - addi $sp, $sp, -92 + addi $sp, $sp, -84 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # continue = address of allocated object Int # Allocating String li $v0, 9 @@ -15374,12 +15659,12 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 0 + addi $t0, $zero, 9 sw $t0, 4($v0) # Setting length of the string in the second word of the object sb $zero, 8($v0) # Null-terminator at the end of the string - sw $v0, 84($sp) # choice = "" + sw $v0, 76($sp) # choice = "" # Allocating String li $v0, 9 @@ -15389,7 +15674,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 29 + addi $t0, $zero, 38 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 87 @@ -15481,24 +15766,24 @@ sb $zero, 37($v0) # Null-terminator at the end of the string - sw $v0, 80($sp) # internal_2 = "Welcome to the Game of Life.\n" + sw $v0, 72($sp) # internal_2 = "Welcome to the Game of Life.\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 104($sp) + lw $t0, 96($sp) sw $t0, 4($sp) # Storing self # Argument internal_2 - lw $t0, 92($sp) + lw $t0, 84($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 88($sp) # internal_3 = result of function_out_string_at_IO + sw $v1, 80($sp) # internal_3 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -15509,7 +15794,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 47 + addi $t0, $zero, 56 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 84 @@ -15655,69 +15940,52 @@ sb $zero, 55($v0) # Null-terminator at the end of the string - sw $v0, 72($sp) # internal_4 = "There are many initial states to choose from. \n" + sw $v0, 64($sp) # internal_4 = "There are many initial states to choose from. \n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 104($sp) + lw $t0, 96($sp) sw $t0, 4($sp) # Storing self # Argument internal_4 - lw $t0, 84($sp) + lw $t0, 76($sp) sw $t0, 0($sp) # Storing internal_4 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 80($sp) # internal_5 = result of function_out_string_at_IO + sw $v1, 72($sp) # internal_5 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - while_start_8789948673058: + while_start_8768338411614: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 100($sp) + lw $t0, 92($sp) sw $t0, 0($sp) # Storing self # Calling function function_prompt2_at_CellularAutomaton jal function_prompt2_at_CellularAutomaton lw $ra, 4($sp) - sw $v1, 68($sp) # internal_7 = result of function_prompt2_at_CellularAutomaton + sw $v1, 64($sp) # internal_6 = result of function_prompt2_at_CellularAutomaton addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 60($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 64($sp) - j end_assign - not_is_Bool_or_Int: - # internal_6 = internal_7 - lw $t0, 60($sp) - sw $t0, 64($sp) - end_assign: - - # If internal_6 then goto while_body_8789948673058 - lw $t0, 64($sp) # Loading the address of the condition + # If internal_6 then goto while_body_8768338411614 + lw $t0, 56($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8789948673058 + beq $t0, $t1, while_body_8768338411614 - # Jumping to while_end_8789948673058 - j while_end_8789948673058 + # Jumping to while_end_8768338411614 + j while_end_8768338411614 - while_body_8789948673058: + while_body_8768338411614: # Allocating Bool 1 li $v0, 9 @@ -15729,55 +15997,57 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 56($sp) # internal_8 = address of allocated object Int + sw $v0, 52($sp) # internal_7 = address of allocated object Int - lw $t0, 56($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 88($sp) - j end_assign - not_is_Bool_or_Int: - # continue = internal_8 - lw $t0, 56($sp) - sw $t0, 88($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument continue + lw $t0, 92($sp) + sw $t0, 4($sp) # Storing continue + + # Argument internal_7 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 92($sp) # continue = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 100($sp) + lw $t0, 92($sp) sw $t0, 0($sp) # Storing self # Calling function function_option_at_CellularAutomaton jal function_option_at_CellularAutomaton lw $ra, 4($sp) - sw $v1, 60($sp) # internal_9 = result of function_option_at_CellularAutomaton + sw $v1, 56($sp) # internal_8 = result of function_option_at_CellularAutomaton addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 52($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 84($sp) - j end_assign - not_is_Bool_or_Int: - # choice = internal_9 - lw $t0, 52($sp) - sw $t0, 84($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument choice + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing choice + + # Argument internal_8 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 88($sp) # choice = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments # Allocating CellularAutomaton li $v0, 9 @@ -15786,94 +16056,139 @@ la $t0, type_CellularAutomaton # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 48($sp) # internal_10 = address of allocated object CellularAutomaton + sw $v0, 44($sp) # internal_9 = address of allocated object CellularAutomaton # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_10 - lw $t0, 56($sp) - sw $t0, 0($sp) # Storing internal_10 + # Argument internal_9 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_9 # Calling function function___init___at_CellularAutomaton jal function___init___at_CellularAutomaton lw $ra, 4($sp) - sw $v1, 56($sp) # internal_10 = result of function___init___at_CellularAutomaton + sw $v1, 52($sp) # internal_9 = result of function___init___at_CellularAutomaton addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_10 - lw $t0, 60($sp) - sw $t0, 4($sp) # Storing internal_10 + # Argument internal_9 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_9 # Argument choice - lw $t0, 96($sp) + lw $t0, 88($sp) sw $t0, 0($sp) # Storing choice # Calling function function_init_at_CellularAutomaton jal function_init_at_CellularAutomaton lw $ra, 8($sp) - sw $v1, 56($sp) # internal_11 = result of function_init_at_CellularAutomaton + sw $v1, 52($sp) # internal_10 = result of function_init_at_CellularAutomaton addi $sp, $sp, 12 # Freeing space for arguments # Set attribute cells of self - lw $t0, 92($sp) # $t0 = self - lw $t1, 44($sp) # $t1 = internal_11 - sw $t1, 24($t0) # self.cells = internal_11 + lw $t0, 84($sp) # $t0 = self + lw $t1, 40($sp) # $t1 = internal_10 + beq $t1, $zero, object_set_attribute_8768338334883 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768338334883 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768338334883 + j object_set_attribute_8768338334883 + int_set_attribute_8768338334883: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($t0) # self.cells = internal_10 + j end_set_attribute_8768338334883 + bool_set_attribute_8768338334883: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($t0) # self.cells = internal_10 + j end_set_attribute_8768338334883 + object_set_attribute_8768338334883: + sw $t1, 24($t0) # self.cells = internal_10 + end_set_attribute_8768338334883: # Get attribute cells of self - lw $t0, 92($sp) # Get the address of self + lw $t0, 84($sp) # Get the address of self lw $t1, 24($t0) # Get the attribute 'cells' from the instance - sw $t1, 40($sp) # internal_12 = cells + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338334952 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338334952 + j object_get_attribute_8768338334952 + int_get_attribute_8768338334952: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 36($sp) # internal_11 = self.cells + j end_get_attribute_8768338334952 + bool_get_attribute_8768338334952: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 36($sp) # internal_11 = self.cells + j end_get_attribute_8768338334952 + object_get_attribute_8768338334952: + sw $t1, 36($sp) # internal_11 = cells + end_get_attribute_8768338334952: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_12 - lw $t0, 48($sp) - sw $t0, 0($sp) # Storing internal_12 + # Argument internal_11 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_11 # Calling function function_print_at_CellularAutomaton jal function_print_at_CellularAutomaton lw $ra, 4($sp) - sw $v1, 44($sp) # internal_13 = result of function_print_at_CellularAutomaton + sw $v1, 40($sp) # internal_12 = result of function_print_at_CellularAutomaton addi $sp, $sp, 8 # Freeing space for arguments - while_start_8789948673046: - - lw $t0, 88($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 32($sp) - j end_assign - not_is_Bool_or_Int: - # internal_14 = continue - lw $t0, 88($sp) - sw $t0, 32($sp) - end_assign: + while_start_8768338411602: - # If internal_14 then goto while_body_8789948673046 - lw $t0, 32($sp) # Loading the address of the condition + # If continue then goto while_body_8768338411602 + lw $t0, 80($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8789948673046 - - # Jumping to while_end_8789948673046 - j while_end_8789948673046 + beq $t0, $t1, while_body_8768338411602 - while_body_8789948673046: + # Jumping to while_end_8768338411602 + j while_end_8768338411602 + while_body_8768338411602: # Allocating Bool 0 li $v0, 9 @@ -15885,109 +16200,145 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_16 = address of allocated object Int + sw $v0, 24($sp) # internal_14 = address of allocated object Int # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 100($sp) + lw $t0, 92($sp) sw $t0, 0($sp) # Storing self # Calling function function_prompt_at_CellularAutomaton jal function_prompt_at_CellularAutomaton lw $ra, 4($sp) - sw $v1, 28($sp) # internal_17 = result of function_prompt_at_CellularAutomaton + sw $v1, 28($sp) # internal_15 = result of function_prompt_at_CellularAutomaton addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 20($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: - # internal_16 = internal_17 + # internal_14 = internal_15 lw $t0, 20($sp) sw $t0, 24($sp) - end_assign: - # If internal_16 then goto then_8789948673040 + # If internal_14 then goto then_8768338411596 lw $t0, 24($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8789948673040 + beq $t0, $t1, then_8768338411596 - # Jumping to else_8789948673040 - j else_8789948673040 + # Jumping to else_8768338411596 + j else_8768338411596 - then_8789948673040: + then_8768338411596: # Get attribute cells of self - lw $t0, 92($sp) # Get the address of self + lw $t0, 84($sp) # Get the address of self lw $t1, 24($t0) # Get the attribute 'cells' from the instance - sw $t1, 16($sp) # internal_18 = cells + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338335386 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338335386 + j object_get_attribute_8768338335386 + int_get_attribute_8768338335386: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_16 = self.cells + j end_get_attribute_8768338335386 + bool_get_attribute_8768338335386: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_16 = self.cells + j end_get_attribute_8768338335386 + object_get_attribute_8768338335386: + sw $t1, 16($sp) # internal_16 = cells + end_get_attribute_8768338335386: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_18 + # Argument internal_16 lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_18 + sw $t0, 0($sp) # Storing internal_16 # Calling function function_evolve_at_CellularAutomaton jal function_evolve_at_CellularAutomaton lw $ra, 4($sp) - sw $v1, 20($sp) # internal_19 = result of function_evolve_at_CellularAutomaton + sw $v1, 20($sp) # internal_17 = result of function_evolve_at_CellularAutomaton addi $sp, $sp, 8 # Freeing space for arguments # Get attribute cells of self - lw $t0, 92($sp) # Get the address of self + lw $t0, 84($sp) # Get the address of self lw $t1, 24($t0) # Get the attribute 'cells' from the instance - sw $t1, 8($sp) # internal_20 = cells + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8768338335416 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8768338335416 + j object_get_attribute_8768338335416 + int_get_attribute_8768338335416: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_18 = self.cells + j end_get_attribute_8768338335416 + bool_get_attribute_8768338335416: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_18 = self.cells + j end_get_attribute_8768338335416 + object_get_attribute_8768338335416: + sw $t1, 8($sp) # internal_18 = cells + end_get_attribute_8768338335416: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_20 + # Argument internal_18 lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_20 + sw $t0, 0($sp) # Storing internal_18 # Calling function function_print_at_CellularAutomaton jal function_print_at_CellularAutomaton lw $ra, 4($sp) - sw $v1, 12($sp) # internal_21 = result of function_print_at_CellularAutomaton + sw $v1, 12($sp) # internal_19 = result of function_print_at_CellularAutomaton addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 4($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 28($sp) - j end_assign - not_is_Bool_or_Int: - # internal_15 = internal_21 + # internal_13 = internal_19 lw $t0, 4($sp) sw $t0, 28($sp) - end_assign: - # Jumping to endif_8789948673040 - j endif_8789948673040 + # Jumping to endif_8768338411596 + j endif_8768338411596 - else_8789948673040: + else_8768338411596: # Allocating Bool 0 li $v0, 9 @@ -15999,62 +16350,50 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_22 = address of allocated object Int + sw $v0, 0($sp) # internal_20 = address of allocated object Int - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 88($sp) - j end_assign - not_is_Bool_or_Int: - # continue = internal_22 - lw $t0, 0($sp) - sw $t0, 88($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - lw $t0, 88($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 28($sp) - j end_assign - not_is_Bool_or_Int: - # internal_15 = continue - lw $t0, 88($sp) + # Argument continue + lw $t0, 92($sp) + sw $t0, 4($sp) # Storing continue + + # Argument internal_20 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 92($sp) # continue = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_13 = continue + lw $t0, 80($sp) sw $t0, 28($sp) - end_assign: - # Jumping to endif_8789948673040 - j endif_8789948673040 + # Jumping to endif_8768338411596 + j endif_8768338411596 - endif_8789948673040: + endif_8768338411596: - # Jumping to while_start_8789948673046 - j while_start_8789948673046 + # Jumping to while_start_8768338411602 + j while_start_8768338411602 - while_end_8789948673046: + while_end_8768338411602: - # Jumping to while_start_8789948673058 - j while_start_8789948673058 + # Jumping to while_start_8768338411614 + j while_start_8768338411614 - while_end_8789948673058: + while_end_8768338411614: # Loading return value in $v1 - lw $v1, 92($sp) + lw $v1, 84($sp) # Freeing space for local variables - addi $sp, $sp, 92 + addi $sp, $sp, 84 jr $ra diff --git a/tests/codegen/list.mips b/tests/codegen/list.mips index a1f47d431..b4897ba63 100644 --- a/tests/codegen/list.mips +++ b/tests/codegen/list.mips @@ -4,48 +4,56 @@ type_Object_attributes: .word 0 type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" + type_Object_abort_message: .asciiz "Abort called from class Object\n" type_IO: .word 8 type_IO_inherits_from: .word type_Object type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" + type_IO_abort_message: .asciiz "Abort called from class IO\n" type_Int: .word 8 type_Int_inherits_from: .word type_Object type_Int_attributes: .word 0 type_Int_name_size: .word 3 type_Int_name: .asciiz "Int" + type_Int_abort_message: .asciiz "Abort called from class Int\n" type_String: .word 8 type_String_inherits_from: .word type_Object type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" + type_String_abort_message: .asciiz "Abort called from class String\n" type_Bool: .word 8 type_Bool_inherits_from: .word type_Object type_Bool_attributes: .word 0 type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" + type_Bool_abort_message: .asciiz "Abort called from class Bool\n" type_List: .word 8 type_List_inherits_from: .word type_Object type_List_attributes: .word 0 type_List_name_size: .word 4 type_List_name: .asciiz "List" + type_List_abort_message: .asciiz "Abort called from class List\n" type_Cons: .word 16 type_Cons_inherits_from: .word type_List type_Cons_attributes: .word 2 type_Cons_name_size: .word 4 type_Cons_name: .asciiz "Cons" + type_Cons_abort_message: .asciiz "Abort called from class Cons\n" type_Main: .word 12 type_Main_inherits_from: .word type_IO type_Main_attributes: .word 1 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" + type_Main_abort_message: .asciiz "Abort called from class Main\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -328,12 +336,12 @@ function_equal: # Function parameters - # $ra = 40($sp) - # a = 36($sp) - # b = 32($sp) + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) # Reserving space for local variables - addi $sp, $sp, -32 + addi $sp, $sp, -40 # Allocating Bool 0 li $v0, 9 @@ -345,22 +353,57 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_0 = address of allocated object Int + sw $v0, 36($sp) # internal_0 = address of allocated object Int - # internal_1 = typeof a that is the first word of the object - lw $t0, 36($sp) - lw $t1, 0($t0) - sw $t1, 24($sp) + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) - # internal_2 = direction of Int + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int la $t0, type_Int sw $t0, 20($sp) - # internal_3 = direction of Bool + # internal_5 = direction of Bool la $t0, type_Bool sw $t0, 16($sp) - # internal_4 = direction of String + # internal_6 = direction of String la $t0, type_String sw $t0, 12($sp) @@ -374,7 +417,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_5 = address of allocated object Int + sw $v0, 8($sp) # internal_7 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -386,7 +429,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_6 = address of allocated object Int + sw $v0, 4($sp) # internal_8 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -398,42 +441,42 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_7 = address of allocated object Int + sw $v0, 0($sp) # internal_9 = address of allocated object Int - # internal_5 = EqualAddress(internal_1, internal_2) + # internal_7 = EqualAddress(internal_3, internal_4) lw $t0, 24($sp) lw $t1, 20($sp) seq $t2, $t0, $t1 lw $t0, 8($sp) sw $t2, 8($t0) - # internal_6 = EqualAddress(internal_1, internal_3) + # internal_8 = EqualAddress(internal_3, internal_5) lw $t0, 24($sp) lw $t1, 16($sp) seq $t2, $t0, $t1 lw $t0, 4($sp) sw $t2, 8($t0) - # internal_7 = EqualAddress(internal_1, internal_4) + # internal_9 = EqualAddress(internal_3, internal_6) lw $t0, 24($sp) lw $t1, 12($sp) seq $t2, $t0, $t1 lw $t0, 0($sp) sw $t2, 8($t0) - # If internal_5 then goto a_is_type_int_or_bool + # If internal_7 then goto a_is_type_int_or_bool lw $t0, 8($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison beq $t0, $t1, a_is_type_int_or_bool - # If internal_6 then goto a_is_type_int_or_bool + # If internal_8 then goto a_is_type_int_or_bool lw $t0, 4($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison beq $t0, $t1, a_is_type_int_or_bool - # If internal_7 then goto a_is_type_string + # If internal_9 then goto a_is_type_string lw $t0, 0($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison @@ -445,12 +488,12 @@ a_is_type_int_or_bool: # internal_0 = EqualInt(a, b) - lw $t0, 36($sp) + lw $t0, 44($sp) lw $t0, 8($t0) - lw $t1, 32($sp) + lw $t1, 40($sp) lw $t1, 8($t1) seq $t2, $t0, $t1 - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t2, 8($t0) # Jumping to end_of_equal @@ -459,14 +502,14 @@ a_is_type_string: # internal_0 = EqualStr(a, b) - lw $t0, 36($sp) - lw $t1, 32($sp) + lw $t0, 44($sp) + lw $t1, 40($sp) addi $t0, $t0, 8 addi $t1, $t1, 8 # By default we assume the strings are equals addi $t4, $zero, 1 - lw $t5, 28($sp) + lw $t5, 36($sp) sw $t4, 8($t5) while_compare_strings_start: @@ -475,7 +518,7 @@ beq $t2, $t3, while_compare_strings_update # The strings are no equals - lw $t5, 28($sp) + lw $t5, 36($sp) sw $zero, 8($t5) j while_compare_strings_end @@ -483,6 +526,7 @@ addi $t0, $t0, 1 addi $t1, $t1, 1 beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end j while_compare_strings_start while_compare_strings_end: @@ -492,11 +536,11 @@ a_is_type_object: # Equal operation - lw $t0, 36($sp) # Save in $t0 the left operand address - lw $t1, 32($sp) # Save in $t1 the right operand address + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address seq $t2, $t0, $t1 # $t2 = $t0 == $t1 - lw $t0, 28($sp) # $t0 = internal_0 + lw $t0, 36($sp) # $t0 = internal_0 sw $t2, 8($t0) # Setting value in the third word of the Bool object # Jumping to end_of_equal @@ -505,10 +549,156 @@ end_of_equal: # Loading return value in $v1 - lw $v1, 28($sp) + lw $v1, 36($sp) # Freeing space for local variables - addi $sp, $sp, 32 + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 jr $ra @@ -524,15 +714,184 @@ function_abort_at_Object: # Function parameters - # $ra = 4($sp) - # self = 0($sp) + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_2[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_2 = "\n" + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_type_name_at_Object + jal function_type_name_at_Object + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 12($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) # $t0 = internal_3 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string internal_3 + li $v0, 4 + move $a0, $t0 + syscall # Exit program li $v0, 10 syscall # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 jr $ra @@ -548,7 +907,7 @@ lw $t0, 4($sp) # $t0 = self lw $t1, 0($t0) # $t1 = type of self lw $t2, 12($t1) # $t1 = length of the name of self - lw $t3, 16($t1) # $t1 = name of self + la $t3, 16($t1) # $t1 = name of self addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 @@ -558,26 +917,24 @@ la $t4, type_String sw $t4, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - move $t4, $v0 # $t4 = direction of the new string + addi $t4, $v0, 0 # $t4 = direction of the new string addi $t4, $t4, 8 # Pointer to the first character of the string - addi $t0, $t0, 8 # Pointer to the first character of the string in self xor $t5, $t5, $t5 # Initializing counter while_copy_name_start: - beq $t5, $t1, while_copy_name_end - lb $t6, 0($t0) # Loading the character + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character sb $t6, 0($t4) addi $t4, $t4, 1 # Incrementing the pointer to the new string - addi $t0, $t0, 1 # Incrementing the pointer to the string in self + addi $t3, $t3, 1 # Incrementing the pointer to the string in self addi $t5, $t5, 1 # Incrementing counter j while_copy_name_start while_copy_name_end: sb $zero, 0($t4) # Setting the null byte - sw $t4, 0($sp) # Storing the new string in internal_0 + sw $v0, 0($sp) # Storing the new string in internal_0 # Loading return value in $v1 lw $v1, 0($sp) @@ -695,16 +1052,18 @@ xor $t0, $t0, $t0 # Initializing counter while_read_start: - lw $t1, buffer_input($t0) # Loading the byte + lb $t1, buffer_input($t0) # Loading the byte beq $t1, $zero, while_read_end addi $t0, $t0, 1 # Incrementing counter j while_read_start while_read_end: + addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 move $a0, $t0 syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte la $t2, type_String sw $t2, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting length in the second word of the object @@ -714,7 +1073,7 @@ while_copy_from_buffer_start: beq $t4, $t0, while_copy_from_buffer_end - lw $t5, buffer_input($t4) # Loading the byte + lb $t5, buffer_input($t4) # Loading the byte sb $t5, 0($t3) # Storing the byte addi $t3, $t3, 1 # Imcremeenting pointer addi $t4, $t4, 1 # Incrementing counter @@ -741,9 +1100,22 @@ # Reserving space for local variables addi $sp, $sp, -4 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + li $v0, 5 syscall - sw $v0, 0($sp) # Storing the new object in internal_0 + lw $t0, 0($sp) + sw $v0, 8($t0) # Loading return value in $v1 lw $v1, 0($sp) @@ -771,11 +1143,24 @@ # Reserving space for local variables addi $sp, $sp, -4 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + # internal_0 = length of self lw $t0, 4($sp) lw $t1, 4($t0) addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator - sw $t1, 0($sp) + lw $t0, 0($sp) + sw $t1, 8($t0) # Loading return value in $v1 lw $v1, 0($sp) @@ -799,6 +1184,8 @@ lw $t1, 4($sp) lw $t2, 4($t0) # $t2 = length of str1 lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 add $t4, $t2, $t3 # $t4 = length of str1 + str2 addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) @@ -818,7 +1205,7 @@ xor $t6, $t6, $t6 # $t6 = 0 Initializing counter while_copy_str1_start: beq $t6, $t2, while_copy_str1_end - lb $t7, 0($t0) + lb $t7, 8($t0) sb $t7, 0($t5) add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string @@ -829,7 +1216,7 @@ # Copying str2 to the new string while_copy_str2_start: beq $t6, $t4, while_copy_str2_end - lb $t7, 0($t1) + lb $t7, 8($t1) sb $t7, 0($t5) add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string @@ -862,11 +1249,14 @@ # internal_0 = self[i:i + l] lw $t0, 12($sp) # $t0 = address of the string lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring - bge $t4, $t1, substring_out_of_bounds + bgt $t4, $t1, substring_out_of_bounds addi $t3, $t3, 9 li $v0, 9 @@ -1088,11 +1478,11 @@ function___init___at_Cons: # Function parameters - # $ra = 8($sp) - # self = 4($sp) + # $ra = 12($sp) + # self = 8($sp) # Reserving space for local variables - addi $sp, $sp, -4 + addi $sp, $sp, -8 # Allocating Int 0 li $v0, 9 @@ -1104,22 +1494,90 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int + sw $v0, 4($sp) # internal_0 = address of allocated object Int # Set attribute car of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_0 + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8758768081695 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8758768081695 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8758768081695 + j object_set_attribute_8758768081695 + int_set_attribute_8758768081695: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.car = internal_0 + j end_set_attribute_8758768081695 + bool_set_attribute_8758768081695: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.car = internal_0 + j end_set_attribute_8758768081695 + object_set_attribute_8758768081695: sw $t1, 8($t0) # self.car = internal_0 + end_set_attribute_8758768081695: + + # Allocating NUll to internal_1 + sw $zero, 0($sp) # internal_1 = 0 # Set attribute cdr of self - lw $t0, 4($sp) # $t0 = self - sw $zero, 12($t0) # Set the attribute cdr of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8758768081716 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8758768081716 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8758768081716 + j object_set_attribute_8758768081716 + int_set_attribute_8758768081716: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.cdr = internal_1 + j end_set_attribute_8758768081716 + bool_set_attribute_8758768081716: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.cdr = internal_1 + j end_set_attribute_8758768081716 + object_set_attribute_8758768081716: + sw $t1, 12($t0) # self.cdr = internal_1 + end_set_attribute_8758768081716: # Loading return value in $v1 - lw $v1, 4($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 4 + addi $sp, $sp, 8 jr $ra @@ -1162,7 +1620,38 @@ # Get attribute car of self lw $t0, 4($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'car' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8758768081770 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8758768081770 + j object_get_attribute_8758768081770 + int_get_attribute_8758768081770: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.car + j end_get_attribute_8758768081770 + bool_get_attribute_8758768081770: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.car + j end_get_attribute_8758768081770 + object_get_attribute_8758768081770: sw $t1, 0($sp) # internal_0 = car + end_get_attribute_8758768081770: # Loading return value in $v1 lw $v1, 0($sp) @@ -1183,7 +1672,38 @@ # Get attribute cdr of self lw $t0, 4($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'cdr' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8758768081800 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8758768081800 + j object_get_attribute_8758768081800 + int_get_attribute_8758768081800: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.cdr + j end_get_attribute_8758768081800 + bool_get_attribute_8758768081800: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.cdr + j end_get_attribute_8758768081800 + object_get_attribute_8758768081800: sw $t1, 0($sp) # internal_0 = cdr + end_get_attribute_8758768081800: # Loading return value in $v1 lw $v1, 0($sp) @@ -1203,12 +1723,76 @@ # Set attribute car of self lw $t0, 8($sp) # $t0 = self lw $t1, 4($sp) # $t1 = i + beq $t1, $zero, object_set_attribute_8758768081857 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8758768081857 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8758768081857 + j object_set_attribute_8758768081857 + int_set_attribute_8758768081857: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.car = i + j end_set_attribute_8758768081857 + bool_set_attribute_8758768081857: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.car = i + j end_set_attribute_8758768081857 + object_set_attribute_8758768081857: sw $t1, 8($t0) # self.car = i + end_set_attribute_8758768081857: # Set attribute cdr of self lw $t0, 8($sp) # $t0 = self lw $t1, 0($sp) # $t1 = rest + beq $t1, $zero, object_set_attribute_8758768081866 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8758768081866 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8758768081866 + j object_set_attribute_8758768081866 + int_set_attribute_8758768081866: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.cdr = rest + j end_set_attribute_8758768081866 + bool_set_attribute_8758768081866: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.cdr = rest + j end_set_attribute_8758768081866 + object_set_attribute_8758768081866: sw $t1, 12($t0) # self.cdr = rest + end_set_attribute_8758768081866: # Loading return value in $v1 lw $v1, 8($sp) @@ -1217,15 +1801,57 @@ function___init___at_Main: # Function parameters - # $ra = 4($sp) - # self = 0($sp) + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating NUll to internal_0 + sw $zero, 0($sp) # internal_0 = 0 # Set attribute mylist of self - lw $t0, 0($sp) # $t0 = self - sw $zero, 8($t0) # Set the attribute mylist of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8758768081899 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8758768081899 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8758768081899 + j object_set_attribute_8758768081899 + int_set_attribute_8758768081899: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.mylist = internal_0 + j end_set_attribute_8758768081899 + bool_set_attribute_8758768081899: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.mylist = internal_0 + j end_set_attribute_8758768081899 + object_set_attribute_8758768081899: + sw $t1, 8($t0) # self.mylist = internal_0 + end_set_attribute_8758768081899: # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 jr $ra @@ -1238,7 +1864,6 @@ # Reserving space for local variables addi $sp, $sp, -44 - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -1265,33 +1890,20 @@ sw $v1, 40($sp) # internal_2 = result of function_isNil_at_List addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 32($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 36($sp) - j end_assign - not_is_Bool_or_Int: # internal_1 = internal_2 lw $t0, 32($sp) sw $t0, 36($sp) - end_assign: - # If internal_1 then goto then_8770592017927 + # If internal_1 then goto then_8758768100422 lw $t0, 36($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8770592017927 + beq $t0, $t1, then_8758768100422 - # Jumping to else_8770592017927 - j else_8770592017927 + # Jumping to else_8758768100422 + j else_8758768100422 - then_8770592017927: + then_8758768100422: # Allocating String li $v0, 9 @@ -1301,7 +1913,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 @@ -1329,27 +1941,14 @@ sw $v1, 36($sp) # internal_4 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 24($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_4 lw $t0, 24($sp) sw $t0, 40($sp) - end_assign: - # Jumping to endif_8770592017927 - j endif_8770592017927 + # Jumping to endif_8758768100422 + j endif_8758768100422 - else_8770592017927: + else_8758768100422: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments @@ -1391,7 +1990,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 10 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 @@ -1451,27 +2050,14 @@ sw $v1, 12($sp) # internal_10 = result of function_print_list_at_Main addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 40($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_10 lw $t0, 0($sp) sw $t0, 40($sp) - end_assign: - # Jumping to endif_8770592017927 - j endif_8770592017927 + # Jumping to endif_8758768100422 + j endif_8758768100422 - endif_8770592017927: + endif_8758768100422: # Loading return value in $v1 lw $v1, 40($sp) @@ -1483,11 +2069,11 @@ function_main_at_Main: # Function parameters - # $ra = 84($sp) - # self = 80($sp) + # $ra = 80($sp) + # self = 76($sp) # Reserving space for local variables - addi $sp, $sp, -80 + addi $sp, $sp, -76 # Allocating List li $v0, 9 @@ -1496,20 +2082,20 @@ la $t0, type_List # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 76($sp) # internal_0 = address of allocated object List + sw $v0, 72($sp) # internal_0 = address of allocated object List # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 84($sp) + lw $t0, 80($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_List jal function___init___at_List lw $ra, 4($sp) - sw $v1, 84($sp) # internal_0 = result of function___init___at_List + sw $v1, 80($sp) # internal_0 = result of function___init___at_List addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 1 @@ -1522,24 +2108,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 72($sp) # internal_1 = address of allocated object Int + sw $v0, 68($sp) # internal_1 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_0 - lw $t0, 88($sp) + lw $t0, 84($sp) sw $t0, 4($sp) # Storing internal_0 # Argument internal_1 - lw $t0, 84($sp) + lw $t0, 80($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function_cons_at_List jal function_cons_at_List lw $ra, 8($sp) - sw $v1, 80($sp) # internal_2 = result of function_cons_at_List + sw $v1, 76($sp) # internal_2 = result of function_cons_at_List addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 2 @@ -1552,24 +2138,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 64($sp) # internal_3 = address of allocated object Int + sw $v0, 60($sp) # internal_3 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_2 - lw $t0, 80($sp) + lw $t0, 76($sp) sw $t0, 4($sp) # Storing internal_2 # Argument internal_3 - lw $t0, 76($sp) + lw $t0, 72($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function_cons_at_List jal function_cons_at_List lw $ra, 8($sp) - sw $v1, 72($sp) # internal_4 = result of function_cons_at_List + sw $v1, 68($sp) # internal_4 = result of function_cons_at_List addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 3 @@ -1582,24 +2168,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 56($sp) # internal_5 = address of allocated object Int + sw $v0, 52($sp) # internal_5 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_4 - lw $t0, 72($sp) + lw $t0, 68($sp) sw $t0, 4($sp) # Storing internal_4 # Argument internal_5 - lw $t0, 68($sp) + lw $t0, 64($sp) sw $t0, 0($sp) # Storing internal_5 # Calling function function_cons_at_List jal function_cons_at_List lw $ra, 8($sp) - sw $v1, 64($sp) # internal_6 = result of function_cons_at_List + sw $v1, 60($sp) # internal_6 = result of function_cons_at_List addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 4 @@ -1612,24 +2198,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_7 = address of allocated object Int + sw $v0, 44($sp) # internal_7 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_6 - lw $t0, 64($sp) + lw $t0, 60($sp) sw $t0, 4($sp) # Storing internal_6 # Argument internal_7 - lw $t0, 60($sp) + lw $t0, 56($sp) sw $t0, 0($sp) # Storing internal_7 # Calling function function_cons_at_List jal function_cons_at_List lw $ra, 8($sp) - sw $v1, 56($sp) # internal_8 = result of function_cons_at_List + sw $v1, 52($sp) # internal_8 = result of function_cons_at_List addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 5 @@ -1642,50 +2228,113 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 5 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_9 = address of allocated object Int + sw $v0, 36($sp) # internal_9 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_8 - lw $t0, 56($sp) + lw $t0, 52($sp) sw $t0, 4($sp) # Storing internal_8 # Argument internal_9 - lw $t0, 52($sp) + lw $t0, 48($sp) sw $t0, 0($sp) # Storing internal_9 # Calling function function_cons_at_List jal function_cons_at_List lw $ra, 8($sp) - sw $v1, 48($sp) # internal_10 = result of function_cons_at_List + sw $v1, 44($sp) # internal_10 = result of function_cons_at_List addi $sp, $sp, 12 # Freeing space for arguments # Set attribute mylist of self - lw $t0, 80($sp) # $t0 = self - lw $t1, 36($sp) # $t1 = internal_10 + lw $t0, 76($sp) # $t0 = self + lw $t1, 32($sp) # $t1 = internal_10 + beq $t1, $zero, object_set_attribute_8758768083517 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8758768083517 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8758768083517 + j object_set_attribute_8758768083517 + int_set_attribute_8758768083517: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.mylist = internal_10 + j end_set_attribute_8758768083517 + bool_set_attribute_8758768083517: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.mylist = internal_10 + j end_set_attribute_8758768083517 + object_set_attribute_8758768083517: sw $t1, 8($t0) # self.mylist = internal_10 + end_set_attribute_8758768083517: - while_start_8770592018038: + while_start_8758768100533: # Get attribute mylist of self - lw $t0, 80($sp) # Get the address of self + lw $t0, 76($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'mylist' from the instance - sw $t1, 28($sp) # internal_12 = mylist + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8758768084041 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8758768084041 + j object_get_attribute_8758768084041 + int_get_attribute_8758768084041: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_11 = self.mylist + j end_get_attribute_8758768084041 + bool_get_attribute_8758768084041: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_11 = self.mylist + j end_get_attribute_8758768084041 + object_get_attribute_8758768084041: + sw $t1, 28($sp) # internal_11 = mylist + end_get_attribute_8758768084041: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_12 + # Argument internal_11 lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_12 + sw $t0, 0($sp) # Storing internal_11 # Calling function function_isNil_at_List jal function_isNil_at_List lw $ra, 4($sp) - sw $v1, 32($sp) # internal_13 = result of function_isNil_at_List + sw $v1, 32($sp) # internal_12 = result of function_isNil_at_List addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 1 @@ -1698,103 +2347,200 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_14 = address of allocated object Int + sw $v0, 20($sp) # internal_13 = address of allocated object Int - # Xor operation - lw $t0, 24($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 20($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall - lw $t0, 16($sp) # $t0 = internal_15 - sw $t2, 8($t0) # Setting value in the third word of the Int object + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_14 = address of allocated object Int - lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 32($sp) - j end_assign - not_is_Bool_or_Int: - # internal_11 = internal_15 - lw $t0, 16($sp) - sw $t0, 32($sp) - end_assign: + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address - # If internal_11 then goto while_body_8770592018038 - lw $t0, 32($sp) # Loading the address of the condition + # Argument internal_12 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_12 + + # Argument internal_13 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_14 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_14 then goto while_body_8758768100533 + lw $t0, 16($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8770592018038 + beq $t0, $t1, while_body_8758768100533 - # Jumping to while_end_8770592018038 - j while_end_8770592018038 + # Jumping to while_end_8758768100533 + j while_end_8758768100533 - while_body_8770592018038: + while_body_8758768100533: # Get attribute mylist of self - lw $t0, 80($sp) # Get the address of self + lw $t0, 76($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'mylist' from the instance - sw $t1, 12($sp) # internal_16 = mylist + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8758768084140 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8758768084140 + j object_get_attribute_8758768084140 + int_get_attribute_8758768084140: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_15 = self.mylist + j end_get_attribute_8758768084140 + bool_get_attribute_8758768084140: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_15 = self.mylist + j end_get_attribute_8758768084140 + object_get_attribute_8758768084140: + sw $t1, 12($sp) # internal_15 = mylist + end_get_attribute_8758768084140: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 92($sp) + lw $t0, 88($sp) sw $t0, 4($sp) # Storing self - # Argument internal_16 + # Argument internal_15 lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_16 + sw $t0, 0($sp) # Storing internal_15 # Calling function function_print_list_at_Main jal function_print_list_at_Main lw $ra, 8($sp) - sw $v1, 20($sp) # internal_17 = result of function_print_list_at_Main + sw $v1, 20($sp) # internal_16 = result of function_print_list_at_Main addi $sp, $sp, 12 # Freeing space for arguments # Get attribute mylist of self - lw $t0, 80($sp) # Get the address of self + lw $t0, 76($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'mylist' from the instance - sw $t1, 4($sp) # internal_18 = mylist + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8758768084185 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8758768084185 + j object_get_attribute_8758768084185 + int_get_attribute_8758768084185: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_17 = self.mylist + j end_get_attribute_8758768084185 + bool_get_attribute_8758768084185: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_17 = self.mylist + j end_get_attribute_8758768084185 + object_get_attribute_8758768084185: + sw $t1, 4($sp) # internal_17 = mylist + end_get_attribute_8758768084185: # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_18 + # Argument internal_17 lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_18 + sw $t0, 0($sp) # Storing internal_17 # Calling function function_tail_at_List jal function_tail_at_List lw $ra, 4($sp) - sw $v1, 8($sp) # internal_19 = result of function_tail_at_List + sw $v1, 8($sp) # internal_18 = result of function_tail_at_List addi $sp, $sp, 8 # Freeing space for arguments # Set attribute mylist of self - lw $t0, 80($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_19 - sw $t1, 8($t0) # self.mylist = internal_19 + lw $t0, 76($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_18 + beq $t1, $zero, object_set_attribute_8758768084161 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8758768084161 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8758768084161 + j object_set_attribute_8758768084161 + int_set_attribute_8758768084161: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.mylist = internal_18 + j end_set_attribute_8758768084161 + bool_set_attribute_8758768084161: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.mylist = internal_18 + j end_set_attribute_8758768084161 + object_set_attribute_8758768084161: + sw $t1, 8($t0) # self.mylist = internal_18 + end_set_attribute_8758768084161: - # Jumping to while_start_8770592018038 - j while_start_8770592018038 + # Jumping to while_start_8758768100533 + j while_start_8758768100533 - while_end_8770592018038: + while_end_8758768100533: # Loading return value in $v1 addi $v1, $zero, 0 # Freeing space for local variables - addi $sp, $sp, 80 + addi $sp, $sp, 76 jr $ra diff --git a/tests/codegen/new_complex.mips b/tests/codegen/new_complex.mips new file mode 100644 index 000000000..5c60b1112 --- /dev/null +++ b/tests/codegen/new_complex.mips @@ -0,0 +1,3502 @@ +.data + type_Object: .word 8 + type_Object_inherits_from: .word 0 + type_Object_attributes: .word 0 + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + type_Object_abort_message: .asciiz "Abort called from class Object\n" + + type_IO: .word 8 + type_IO_inherits_from: .word type_Object + type_IO_attributes: .word 0 + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + type_IO_abort_message: .asciiz "Abort called from class IO\n" + + type_Int: .word 8 + type_Int_inherits_from: .word type_Object + type_Int_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + type_Int_abort_message: .asciiz "Abort called from class Int\n" + + type_String: .word 8 + type_String_inherits_from: .word type_Object + type_String_attributes: .word 0 + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + type_String_abort_message: .asciiz "Abort called from class String\n" + + type_Bool: .word 8 + type_Bool_inherits_from: .word type_Object + type_Bool_attributes: .word 0 + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + type_Bool_abort_message: .asciiz "Abort called from class Bool\n" + + type_Main: .word 8 + type_Main_inherits_from: .word type_IO + type_Main_attributes: .word 0 + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + type_Main_abort_message: .asciiz "Abort called from class Main\n" + + type_Complex: .word 16 + type_Complex_inherits_from: .word type_IO + type_Complex_attributes: .word 2 + type_Complex_name_size: .word 7 + type_Complex_name: .asciiz "Complex" + type_Complex_abort_message: .asciiz "Abort called from class Complex\n" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_0 = address of allocated object Int + + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_5 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_6 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_7 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_8 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_9 = address of allocated object Int + + # internal_7 = EqualAddress(internal_3, internal_4) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_8 = EqualAddress(internal_3, internal_5) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_9 = EqualAddress(internal_3, internal_6) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_7 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_8 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_9 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 44($sp) + lw $t0, 8($t0) + lw $t1, 40($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 36($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 44($sp) + lw $t1, 40($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 36($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 36($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 36($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_2[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_2 = "\n" + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_type_name_at_Object + jal function_type_name_at_Object + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 12($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) # $t0 = internal_3 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string internal_3 + li $v0, 4 + move $a0, $t0 + syscall + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 12($t1) # $t1 = length of the name of self + la $t3, 16($t1) # $t1 = name of self + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t4, $v0, 0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t3, $t3, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $v0, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the string x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lb $t1, buffer_input($t0) # Loading the byte + beq $t1, $zero, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lb $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + lw $t0, 0($sp) + sw $t1, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 8($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 8($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 + lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) + lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bgt $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 100($sp) + # self = 96($sp) + + # Reserving space for local variables + addi $sp, $sp, -96 + + # Allocating Complex + li $v0, 9 + lw $a0, type_Complex + syscall + la $t0, type_Complex # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 88($sp) # internal_1 = address of allocated object Complex + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_Complex + jal function___init___at_Complex + lw $ra, 4($sp) + sw $v1, 96($sp) # internal_1 = result of function___init___at_Complex + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_2 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_1 + lw $t0, 104($sp) + sw $t0, 8($sp) # Storing internal_1 + + # Argument internal_2 + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_init_at_Complex + jal function_init_at_Complex + lw $ra, 12($sp) + sw $v1, 92($sp) # internal_4 = result of function_init_at_Complex + addi $sp, $sp, 16 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument c + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing c + + # Argument internal_4 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 104($sp) # c = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_6 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument c + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing c + + # Calling function function_reflect_X_at_Complex + jal function_reflect_X_at_Complex + lw $ra, 4($sp) + sw $v1, 72($sp) # internal_7 = result of function_reflect_X_at_Complex + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument c + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing c + + # Calling function function_reflect_0_at_Complex + jal function_reflect_0_at_Complex + lw $ra, 4($sp) + sw $v1, 68($sp) # internal_8 = result of function_reflect_0_at_Complex + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_7 + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing internal_7 + + # Argument internal_8 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_9 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_6 = internal_9 + lw $t0, 56($sp) + sw $t0, 68($sp) + + # If internal_6 then goto then_8784369540115 + lw $t0, 68($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8784369540115 + + # Jumping to else_8784369540115 + j else_8784369540115 + + then_8784369540115: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 12 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 61 + sb $t0, 8($v0) # internal_10[0] = '=' + + addi $t0, $zero, 41 + sb $t0, 9($v0) # internal_10[1] = ')' + + addi $t0, $zero, 10 + sb $t0, 10($v0) # internal_10[2] = '\n' + + sb $zero, 11($v0) # Null-terminator at the end of the string + + sw $v0, 52($sp) # internal_10 = "=)\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_10 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 60($sp) # internal_11 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_5 = internal_11 + lw $t0, 48($sp) + sw $t0, 72($sp) + + # Jumping to endif_8784369540115 + j endif_8784369540115 + + else_8784369540115: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 12 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 61 + sb $t0, 8($v0) # internal_12[0] = '=' + + addi $t0, $zero, 40 + sb $t0, 9($v0) # internal_12[1] = '(' + + addi $t0, $zero, 10 + sb $t0, 10($v0) # internal_12[2] = '\n' + + sb $zero, 11($v0) # Null-terminator at the end of the string + + sw $v0, 44($sp) # internal_12 = "=(\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_12 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_13 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_5 = internal_13 + lw $t0, 40($sp) + sw $t0, 72($sp) + + # Jumping to endif_8784369540115 + j endif_8784369540115 + + endif_8784369540115: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_15 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument c + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing c + + # Calling function function_reflect_X_at_Complex + jal function_reflect_X_at_Complex + lw $ra, 4($sp) + sw $v1, 36($sp) # internal_16 = result of function_reflect_X_at_Complex + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_16 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_reflect_Y_at_Complex + jal function_reflect_Y_at_Complex + lw $ra, 4($sp) + sw $v1, 32($sp) # internal_17 = result of function_reflect_Y_at_Complex + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument c + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing c + + # Calling function function_reflect_0_at_Complex + jal function_reflect_0_at_Complex + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_18 = result of function_reflect_0_at_Complex + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_17 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_17 + + # Argument internal_18 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_18 + + # Calling function function_equal_at_Complex + jal function_equal_at_Complex + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_19 = result of function_equal_at_Complex + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_15 = internal_19 + lw $t0, 16($sp) + sw $t0, 32($sp) + + # If internal_15 then goto then_8784369540163 + lw $t0, 32($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8784369540163 + + # Jumping to else_8784369540163 + j else_8784369540163 + + then_8784369540163: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 12 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 61 + sb $t0, 8($v0) # internal_20[0] = '=' + + addi $t0, $zero, 41 + sb $t0, 9($v0) # internal_20[1] = ')' + + addi $t0, $zero, 10 + sb $t0, 10($v0) # internal_20[2] = '\n' + + sb $zero, 11($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_20 = "=)\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_20 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_21 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_14 = internal_21 + lw $t0, 8($sp) + sw $t0, 36($sp) + + # Jumping to endif_8784369540163 + j endif_8784369540163 + + else_8784369540163: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 12 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 61 + sb $t0, 8($v0) # internal_22[0] = '=' + + addi $t0, $zero, 40 + sb $t0, 9($v0) # internal_22[1] = '(' + + addi $t0, $zero, 10 + sb $t0, 10($v0) # internal_22[2] = '\n' + + sb $zero, 11($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_22 = "=(\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_22 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_23 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_14 = internal_23 + lw $t0, 0($sp) + sw $t0, 36($sp) + + # Jumping to endif_8784369540163 + j endif_8784369540163 + + endif_8784369540163: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 96 + + jr $ra + + function___init___at_Complex: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_0 = address of allocated object Int + + # Set attribute x of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8784369523008 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8784369523008 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8784369523008 + j object_set_attribute_8784369523008 + int_set_attribute_8784369523008: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.x = internal_0 + j end_set_attribute_8784369523008 + bool_set_attribute_8784369523008: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.x = internal_0 + j end_set_attribute_8784369523008 + object_set_attribute_8784369523008: + sw $t1, 8($t0) # self.x = internal_0 + end_set_attribute_8784369523008: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_1 = address of allocated object Int + + # Set attribute y of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8784369523029 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8784369523029 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8784369523029 + j object_set_attribute_8784369523029 + int_set_attribute_8784369523029: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.y = internal_1 + j end_set_attribute_8784369523029 + bool_set_attribute_8784369523029: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.y = internal_1 + j end_set_attribute_8784369523029 + object_set_attribute_8784369523029: + sw $t1, 12($t0) # self.y = internal_1 + end_set_attribute_8784369523029: + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_init_at_Complex: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + # a = 20($sp) + # b = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Get attribute x of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8784369523092 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8784369523092 + j object_get_attribute_8784369523092 + int_get_attribute_8784369523092: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.x + j end_get_attribute_8784369523092 + bool_get_attribute_8784369523092: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.x + j end_get_attribute_8784369523092 + object_get_attribute_8784369523092: + sw $t1, 12($sp) # internal_0 = x + end_get_attribute_8784369523092: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument a + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing a + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_1 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute y of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8784369523131 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8784369523131 + j object_get_attribute_8784369523131 + int_get_attribute_8784369523131: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_2 = self.y + j end_get_attribute_8784369523131 + bool_get_attribute_8784369523131: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_2 = self.y + j end_get_attribute_8784369523131 + object_get_attribute_8784369523131: + sw $t1, 4($sp) # internal_2 = y + end_get_attribute_8784369523131: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument b + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing b + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_print_at_Complex: + # Function parameters + # $ra = 64($sp) + # self = 60($sp) + + # Reserving space for local variables + addi $sp, $sp, -60 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_1 = address of allocated object Int + + # Get attribute y of self + lw $t0, 60($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8784369523981 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8784369523981 + j object_get_attribute_8784369523981 + int_get_attribute_8784369523981: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 48($sp) # internal_2 = self.y + j end_get_attribute_8784369523981 + bool_get_attribute_8784369523981: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 48($sp) # internal_2 = self.y + j end_get_attribute_8784369523981 + object_get_attribute_8784369523981: + sw $t1, 48($sp) # internal_2 = y + end_get_attribute_8784369523981: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_4 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_4 + lw $t0, 40($sp) + sw $t0, 52($sp) + + # If internal_1 then goto then_8784369540313 + lw $t0, 52($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8784369540313 + + # Jumping to else_8784369540313 + j else_8784369540313 + + then_8784369540313: + + # Get attribute x of self + lw $t0, 60($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8784369524062 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8784369524062 + j object_get_attribute_8784369524062 + int_get_attribute_8784369524062: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 36($sp) # internal_5 = self.x + j end_get_attribute_8784369524062 + bool_get_attribute_8784369524062: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 36($sp) # internal_5 = self.x + j end_get_attribute_8784369524062 + object_get_attribute_8784369524062: + sw $t1, 36($sp) # internal_5 = x + end_get_attribute_8784369524062: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_5 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_out_int_at_IO + jal function_out_int_at_IO + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_6 = result of function_out_int_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_0 = internal_6 + lw $t0, 32($sp) + sw $t0, 56($sp) + + # Jumping to endif_8784369540313 + j endif_8784369540313 + + else_8784369540313: + + # Get attribute x of self + lw $t0, 60($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8784369524155 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8784369524155 + j object_get_attribute_8784369524155 + int_get_attribute_8784369524155: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_7 = self.x + j end_get_attribute_8784369524155 + bool_get_attribute_8784369524155: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_7 = self.x + j end_get_attribute_8784369524155 + object_get_attribute_8784369524155: + sw $t1, 28($sp) # internal_7 = x + end_get_attribute_8784369524155: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_7 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_out_int_at_IO + jal function_out_int_at_IO + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_8 = result of function_out_int_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 43 + sb $t0, 8($v0) # internal_9[0] = '+' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_9 = "+" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_8 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument internal_9 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_10 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute y of self + lw $t0, 60($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8784369524203 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8784369524203 + j object_get_attribute_8784369524203 + int_get_attribute_8784369524203: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_11 = self.y + j end_get_attribute_8784369524203 + bool_get_attribute_8784369524203: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_11 = self.y + j end_get_attribute_8784369524203 + object_get_attribute_8784369524203: + sw $t1, 12($sp) # internal_11 = y + end_get_attribute_8784369524203: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_11 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_out_int_at_IO + jal function_out_int_at_IO + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_12 = result of function_out_int_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 73 + sb $t0, 8($v0) # internal_13[0] = 'I' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_13 = "I" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_12 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_12 + + # Argument internal_13 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_14 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_0 = internal_14 + lw $t0, 0($sp) + sw $t0, 56($sp) + + # Jumping to endif_8784369540313 + j endif_8784369540313 + + endif_8784369540313: + + # Loading return value in $v1 + lw $v1, 56($sp) + + # Freeing space for local variables + addi $sp, $sp, 60 + + jr $ra + + function_reflect_0_at_Complex: + # Function parameters + # $ra = 52($sp) + # self = 48($sp) + + # Reserving space for local variables + addi $sp, $sp, -48 + + # Get attribute x of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8784369524818 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8784369524818 + j object_get_attribute_8784369524818 + int_get_attribute_8784369524818: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 44($sp) # internal_0 = self.x + j end_get_attribute_8784369524818 + bool_get_attribute_8784369524818: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 44($sp) # internal_0 = self.x + j end_get_attribute_8784369524818 + object_get_attribute_8784369524818: + sw $t1, 44($sp) # internal_0 = x + end_get_attribute_8784369524818: + + # Get attribute x of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8784369524842 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8784369524842 + j object_get_attribute_8784369524842 + int_get_attribute_8784369524842: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_1 = self.x + j end_get_attribute_8784369524842 + bool_get_attribute_8784369524842: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_1 = self.x + j end_get_attribute_8784369524842 + object_get_attribute_8784369524842: + sw $t1, 40($sp) # internal_1 = x + end_get_attribute_8784369524842: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_2 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_3 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_4 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_3 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_4 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument internal_2 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_4 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_4 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_5 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute y of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8784369524941 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8784369524941 + j object_get_attribute_8784369524941 + int_get_attribute_8784369524941: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_6 = self.y + j end_get_attribute_8784369524941 + bool_get_attribute_8784369524941: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_6 = self.y + j end_get_attribute_8784369524941 + object_get_attribute_8784369524941: + sw $t1, 20($sp) # internal_6 = y + end_get_attribute_8784369524941: + + # Get attribute y of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8784369524965 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8784369524965 + j object_get_attribute_8784369524965 + int_get_attribute_8784369524965: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_7 = self.y + j end_get_attribute_8784369524965 + bool_get_attribute_8784369524965: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_7 = self.y + j end_get_attribute_8784369524965 + object_get_attribute_8784369524965: + sw $t1, 16($sp) # internal_7 = y + end_get_attribute_8784369524965: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_8 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_9 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_10 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_7 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_7 + + # Argument internal_9 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_10 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_8 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_10 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_6 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_6 + + # Argument internal_10 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_11 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 48($sp) + + # Freeing space for local variables + addi $sp, $sp, 48 + + jr $ra + + function_reflect_X_at_Complex: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Get attribute y of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8784369525342 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8784369525342 + j object_get_attribute_8784369525342 + int_get_attribute_8784369525342: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_0 = self.y + j end_get_attribute_8784369525342 + bool_get_attribute_8784369525342: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_0 = self.y + j end_get_attribute_8784369525342 + object_get_attribute_8784369525342: + sw $t1, 20($sp) # internal_0 = y + end_get_attribute_8784369525342: + + # Get attribute y of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8784369525366 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8784369525366 + j object_get_attribute_8784369525366 + int_get_attribute_8784369525366: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_1 = self.y + j end_get_attribute_8784369525366 + bool_get_attribute_8784369525366: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_1 = self.y + j end_get_attribute_8784369525366 + object_get_attribute_8784369525366: + sw $t1, 16($sp) # internal_1 = y + end_get_attribute_8784369525366: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_2 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_3 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_4 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_4 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_5 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_reflect_Y_at_Complex: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Get attribute x of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8784369525483 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8784369525483 + j object_get_attribute_8784369525483 + int_get_attribute_8784369525483: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_0 = self.x + j end_get_attribute_8784369525483 + bool_get_attribute_8784369525483: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_0 = self.x + j end_get_attribute_8784369525483 + object_get_attribute_8784369525483: + sw $t1, 20($sp) # internal_0 = x + end_get_attribute_8784369525483: + + # Get attribute x of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8784369526023 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8784369526023 + j object_get_attribute_8784369526023 + int_get_attribute_8784369526023: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_1 = self.x + j end_get_attribute_8784369526023 + bool_get_attribute_8784369526023: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_1 = self.x + j end_get_attribute_8784369526023 + object_get_attribute_8784369526023: + sw $t1, 16($sp) # internal_1 = x + end_get_attribute_8784369526023: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_2 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_3 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_4 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_4 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_5 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_equal_at_Complex: + # Function parameters + # $ra = 60($sp) + # self = 56($sp) + # d = 52($sp) + + # Reserving space for local variables + addi $sp, $sp, -52 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_1 = address of allocated object Int + + # Get attribute x of self + lw $t0, 56($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8784369526167 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8784369526167 + j object_get_attribute_8784369526167 + int_get_attribute_8784369526167: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_2 = self.x + j end_get_attribute_8784369526167 + bool_get_attribute_8784369526167: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_2 = self.x + j end_get_attribute_8784369526167 + object_get_attribute_8784369526167: + sw $t1, 40($sp) # internal_2 = x + end_get_attribute_8784369526167: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument d + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing d + + # Calling function function_x_value_at_Complex + jal function_x_value_at_Complex + lw $ra, 4($sp) + sw $v1, 44($sp) # internal_3 = result of function_x_value_at_Complex + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_4 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_4 + lw $t0, 32($sp) + sw $t0, 44($sp) + + # If internal_1 then goto then_8784369541560 + lw $t0, 44($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8784369541560 + + # Jumping to else_8784369541560 + j else_8784369541560 + + then_8784369541560: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_6 = address of allocated object Int + + # Get attribute y of self + lw $t0, 56($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8784369526547 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8784369526547 + j object_get_attribute_8784369526547 + int_get_attribute_8784369526547: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_7 = self.y + j end_get_attribute_8784369526547 + bool_get_attribute_8784369526547: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_7 = self.y + j end_get_attribute_8784369526547 + object_get_attribute_8784369526547: + sw $t1, 20($sp) # internal_7 = y + end_get_attribute_8784369526547: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument d + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing d + + # Calling function function_y_value_at_Complex + jal function_y_value_at_Complex + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_8 = result of function_y_value_at_Complex + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_7 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_7 + + # Argument internal_8 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_9 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_6 = internal_9 + lw $t0, 12($sp) + sw $t0, 24($sp) + + # If internal_6 then goto then_8784369541548 + lw $t0, 24($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8784369541548 + + # Jumping to else_8784369541548 + j else_8784369541548 + + then_8784369541548: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_10 = address of allocated object Int + + # internal_5 = internal_10 + lw $t0, 8($sp) + sw $t0, 28($sp) + + # Jumping to endif_8784369541548 + j endif_8784369541548 + + else_8784369541548: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_11 = address of allocated object Int + + # internal_5 = internal_11 + lw $t0, 4($sp) + sw $t0, 28($sp) + + # Jumping to endif_8784369541548 + j endif_8784369541548 + + endif_8784369541548: + + # internal_0 = internal_5 + lw $t0, 28($sp) + sw $t0, 48($sp) + + # Jumping to endif_8784369541560 + j endif_8784369541560 + + else_8784369541560: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_12 = address of allocated object Int + + # internal_0 = internal_12 + lw $t0, 0($sp) + sw $t0, 48($sp) + + # Jumping to endif_8784369541560 + j endif_8784369541560 + + endif_8784369541560: + + # Loading return value in $v1 + lw $v1, 48($sp) + + # Freeing space for local variables + addi $sp, $sp, 52 + + jr $ra + + function_x_value_at_Complex: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute x of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8784369526733 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8784369526733 + j object_get_attribute_8784369526733 + int_get_attribute_8784369526733: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.x + j end_get_attribute_8784369526733 + bool_get_attribute_8784369526733: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.x + j end_get_attribute_8784369526733 + object_get_attribute_8784369526733: + sw $t1, 0($sp) # internal_0 = x + end_get_attribute_8784369526733: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_y_value_at_Complex: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute y of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8784369526763 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8784369526763 + j object_get_attribute_8784369526763 + int_get_attribute_8784369526763: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.y + j end_get_attribute_8784369526763 + bool_get_attribute_8784369526763: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.y + j end_get_attribute_8784369526763 + object_get_attribute_8784369526763: + sw $t1, 0($sp) # internal_0 = y + end_get_attribute_8784369526763: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_main_at_Main + jal function_main_at_Main + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/palindrome.mips b/tests/codegen/palindrome.mips index 498bcae35..02d914a4d 100644 --- a/tests/codegen/palindrome.mips +++ b/tests/codegen/palindrome.mips @@ -4,36 +4,42 @@ type_Object_attributes: .word 0 type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" + type_Object_abort_message: .asciiz "Abort called from class Object\n" type_IO: .word 8 type_IO_inherits_from: .word type_Object type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" + type_IO_abort_message: .asciiz "Abort called from class IO\n" type_Int: .word 8 type_Int_inherits_from: .word type_Object type_Int_attributes: .word 0 type_Int_name_size: .word 3 type_Int_name: .asciiz "Int" + type_Int_abort_message: .asciiz "Abort called from class Int\n" type_String: .word 8 type_String_inherits_from: .word type_Object type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" + type_String_abort_message: .asciiz "Abort called from class String\n" type_Bool: .word 8 type_Bool_inherits_from: .word type_Object type_Bool_attributes: .word 0 type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" + type_Bool_abort_message: .asciiz "Abort called from class Bool\n" type_Main: .word 12 type_Main_inherits_from: .word type_IO type_Main_attributes: .word 1 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" + type_Main_abort_message: .asciiz "Abort called from class Main\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -316,12 +322,12 @@ function_equal: # Function parameters - # $ra = 40($sp) - # a = 36($sp) - # b = 32($sp) + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) # Reserving space for local variables - addi $sp, $sp, -32 + addi $sp, $sp, -40 # Allocating Bool 0 li $v0, 9 @@ -333,22 +339,57 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_0 = address of allocated object Int + sw $v0, 36($sp) # internal_0 = address of allocated object Int - # internal_1 = typeof a that is the first word of the object - lw $t0, 36($sp) - lw $t1, 0($t0) - sw $t1, 24($sp) + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) - # internal_2 = direction of Int + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int la $t0, type_Int sw $t0, 20($sp) - # internal_3 = direction of Bool + # internal_5 = direction of Bool la $t0, type_Bool sw $t0, 16($sp) - # internal_4 = direction of String + # internal_6 = direction of String la $t0, type_String sw $t0, 12($sp) @@ -362,7 +403,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_5 = address of allocated object Int + sw $v0, 8($sp) # internal_7 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -374,7 +415,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_6 = address of allocated object Int + sw $v0, 4($sp) # internal_8 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -386,42 +427,42 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_7 = address of allocated object Int + sw $v0, 0($sp) # internal_9 = address of allocated object Int - # internal_5 = EqualAddress(internal_1, internal_2) + # internal_7 = EqualAddress(internal_3, internal_4) lw $t0, 24($sp) lw $t1, 20($sp) seq $t2, $t0, $t1 lw $t0, 8($sp) sw $t2, 8($t0) - # internal_6 = EqualAddress(internal_1, internal_3) + # internal_8 = EqualAddress(internal_3, internal_5) lw $t0, 24($sp) lw $t1, 16($sp) seq $t2, $t0, $t1 lw $t0, 4($sp) sw $t2, 8($t0) - # internal_7 = EqualAddress(internal_1, internal_4) + # internal_9 = EqualAddress(internal_3, internal_6) lw $t0, 24($sp) lw $t1, 12($sp) seq $t2, $t0, $t1 lw $t0, 0($sp) sw $t2, 8($t0) - # If internal_5 then goto a_is_type_int_or_bool + # If internal_7 then goto a_is_type_int_or_bool lw $t0, 8($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison beq $t0, $t1, a_is_type_int_or_bool - # If internal_6 then goto a_is_type_int_or_bool + # If internal_8 then goto a_is_type_int_or_bool lw $t0, 4($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison beq $t0, $t1, a_is_type_int_or_bool - # If internal_7 then goto a_is_type_string + # If internal_9 then goto a_is_type_string lw $t0, 0($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison @@ -433,12 +474,12 @@ a_is_type_int_or_bool: # internal_0 = EqualInt(a, b) - lw $t0, 36($sp) + lw $t0, 44($sp) lw $t0, 8($t0) - lw $t1, 32($sp) + lw $t1, 40($sp) lw $t1, 8($t1) seq $t2, $t0, $t1 - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t2, 8($t0) # Jumping to end_of_equal @@ -447,14 +488,14 @@ a_is_type_string: # internal_0 = EqualStr(a, b) - lw $t0, 36($sp) - lw $t1, 32($sp) + lw $t0, 44($sp) + lw $t1, 40($sp) addi $t0, $t0, 8 addi $t1, $t1, 8 # By default we assume the strings are equals addi $t4, $zero, 1 - lw $t5, 28($sp) + lw $t5, 36($sp) sw $t4, 8($t5) while_compare_strings_start: @@ -463,7 +504,7 @@ beq $t2, $t3, while_compare_strings_update # The strings are no equals - lw $t5, 28($sp) + lw $t5, 36($sp) sw $zero, 8($t5) j while_compare_strings_end @@ -471,6 +512,7 @@ addi $t0, $t0, 1 addi $t1, $t1, 1 beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end j while_compare_strings_start while_compare_strings_end: @@ -480,11 +522,11 @@ a_is_type_object: # Equal operation - lw $t0, 36($sp) # Save in $t0 the left operand address - lw $t1, 32($sp) # Save in $t1 the right operand address + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address seq $t2, $t0, $t1 # $t2 = $t0 == $t1 - lw $t0, 28($sp) # $t0 = internal_0 + lw $t0, 36($sp) # $t0 = internal_0 sw $t2, 8($t0) # Setting value in the third word of the Bool object # Jumping to end_of_equal @@ -493,10 +535,156 @@ end_of_equal: # Loading return value in $v1 - lw $v1, 28($sp) + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) # Freeing space for local variables - addi $sp, $sp, 32 + addi $sp, $sp, 28 jr $ra @@ -512,15 +700,184 @@ function_abort_at_Object: # Function parameters - # $ra = 4($sp) - # self = 0($sp) + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_2[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_2 = "\n" + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_type_name_at_Object + jal function_type_name_at_Object + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 12($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) # $t0 = internal_3 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string internal_3 + li $v0, 4 + move $a0, $t0 + syscall # Exit program li $v0, 10 syscall # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 jr $ra @@ -536,7 +893,7 @@ lw $t0, 4($sp) # $t0 = self lw $t1, 0($t0) # $t1 = type of self lw $t2, 12($t1) # $t1 = length of the name of self - lw $t3, 16($t1) # $t1 = name of self + la $t3, 16($t1) # $t1 = name of self addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 @@ -546,26 +903,24 @@ la $t4, type_String sw $t4, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - move $t4, $v0 # $t4 = direction of the new string + addi $t4, $v0, 0 # $t4 = direction of the new string addi $t4, $t4, 8 # Pointer to the first character of the string - addi $t0, $t0, 8 # Pointer to the first character of the string in self xor $t5, $t5, $t5 # Initializing counter while_copy_name_start: - beq $t5, $t1, while_copy_name_end - lb $t6, 0($t0) # Loading the character + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character sb $t6, 0($t4) addi $t4, $t4, 1 # Incrementing the pointer to the new string - addi $t0, $t0, 1 # Incrementing the pointer to the string in self + addi $t3, $t3, 1 # Incrementing the pointer to the string in self addi $t5, $t5, 1 # Incrementing counter j while_copy_name_start while_copy_name_end: sb $zero, 0($t4) # Setting the null byte - sw $t4, 0($sp) # Storing the new string in internal_0 + sw $v0, 0($sp) # Storing the new string in internal_0 # Loading return value in $v1 lw $v1, 0($sp) @@ -683,16 +1038,18 @@ xor $t0, $t0, $t0 # Initializing counter while_read_start: - lw $t1, buffer_input($t0) # Loading the byte + lb $t1, buffer_input($t0) # Loading the byte beq $t1, $zero, while_read_end addi $t0, $t0, 1 # Incrementing counter j while_read_start while_read_end: + addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 move $a0, $t0 syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte la $t2, type_String sw $t2, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting length in the second word of the object @@ -702,7 +1059,7 @@ while_copy_from_buffer_start: beq $t4, $t0, while_copy_from_buffer_end - lw $t5, buffer_input($t4) # Loading the byte + lb $t5, buffer_input($t4) # Loading the byte sb $t5, 0($t3) # Storing the byte addi $t3, $t3, 1 # Imcremeenting pointer addi $t4, $t4, 1 # Incrementing counter @@ -729,9 +1086,22 @@ # Reserving space for local variables addi $sp, $sp, -4 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + li $v0, 5 syscall - sw $v0, 0($sp) # Storing the new object in internal_0 + lw $t0, 0($sp) + sw $v0, 8($t0) # Loading return value in $v1 lw $v1, 0($sp) @@ -759,11 +1129,24 @@ # Reserving space for local variables addi $sp, $sp, -4 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + # internal_0 = length of self lw $t0, 4($sp) lw $t1, 4($t0) addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator - sw $t1, 0($sp) + lw $t0, 0($sp) + sw $t1, 8($t0) # Loading return value in $v1 lw $v1, 0($sp) @@ -787,6 +1170,8 @@ lw $t1, 4($sp) lw $t2, 4($t0) # $t2 = length of str1 lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 add $t4, $t2, $t3 # $t4 = length of str1 + str2 addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) @@ -806,7 +1191,7 @@ xor $t6, $t6, $t6 # $t6 = 0 Initializing counter while_copy_str1_start: beq $t6, $t2, while_copy_str1_end - lb $t7, 0($t0) + lb $t7, 8($t0) sb $t7, 0($t5) add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string @@ -817,7 +1202,7 @@ # Copying str2 to the new string while_copy_str2_start: beq $t6, $t4, while_copy_str2_end - lb $t7, 0($t1) + lb $t7, 8($t1) sb $t7, 0($t5) add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string @@ -850,11 +1235,14 @@ # internal_0 = self[i:i + l] lw $t0, 12($sp) # $t0 = address of the string lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring - bge $t4, $t1, substring_out_of_bounds + bgt $t4, $t1, substring_out_of_bounds addi $t3, $t3, 9 li $v0, 9 @@ -925,7 +1313,39 @@ # Set attribute i of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8763703739865 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8763703739865 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8763703739865 + j object_set_attribute_8763703739865 + int_set_attribute_8763703739865: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.i = internal_0 + j end_set_attribute_8763703739865 + bool_set_attribute_8763703739865: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.i = internal_0 + j end_set_attribute_8763703739865 + object_set_attribute_8763703739865: sw $t1, 8($t0) # self.i = internal_0 + end_set_attribute_8763703739865: # Loading return value in $v1 lw $v1, 4($sp) @@ -944,7 +1364,6 @@ # Reserving space for local variables addi $sp, $sp, -120 - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -1001,33 +1420,20 @@ sw $v1, 112($sp) # internal_4 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 100($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 112($sp) - j end_assign - not_is_Bool_or_Int: # internal_1 = internal_4 lw $t0, 100($sp) sw $t0, 112($sp) - end_assign: - # If internal_1 then goto then_8737511996832 + # If internal_1 then goto then_8763703753186 lw $t0, 112($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8737511996832 + beq $t0, $t1, then_8763703753186 - # Jumping to else_8737511996832 - j else_8737511996832 + # Jumping to else_8763703753186 + j else_8763703753186 - then_8737511996832: + then_8763703753186: # Allocating Bool 1 li $v0, 9 @@ -1041,28 +1447,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 96($sp) # internal_5 = address of allocated object Int - lw $t0, 96($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 116($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_5 lw $t0, 96($sp) sw $t0, 116($sp) - end_assign: - # Jumping to endif_8737511996832 - j endif_8737511996832 - - else_8737511996832: + # Jumping to endif_8763703753186 + j endif_8763703753186 + else_8763703753186: # Allocating Bool 0 li $v0, 9 @@ -1120,33 +1512,20 @@ sw $v1, 88($sp) # internal_10 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 76($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 88($sp) - j end_assign - not_is_Bool_or_Int: # internal_7 = internal_10 lw $t0, 76($sp) sw $t0, 88($sp) - end_assign: - # If internal_7 then goto then_8737511996814 + # If internal_7 then goto then_8763703753168 lw $t0, 88($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8737511996814 + beq $t0, $t1, then_8763703753168 - # Jumping to else_8737511996814 - j else_8737511996814 + # Jumping to else_8763703753168 + j else_8763703753168 - then_8737511996814: + then_8763703753168: # Allocating Bool 1 li $v0, 9 @@ -1160,28 +1539,14 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 72($sp) # internal_11 = address of allocated object Int - lw $t0, 72($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 92($sp) - j end_assign - not_is_Bool_or_Int: # internal_6 = internal_11 lw $t0, 72($sp) sw $t0, 92($sp) - end_assign: - # Jumping to endif_8737511996814 - j endif_8737511996814 - - else_8737511996814: + # Jumping to endif_8763703753168 + j endif_8763703753168 + else_8763703753168: # Allocating Bool 0 li $v0, 9 @@ -1337,33 +1702,20 @@ sw $v1, 40($sp) # internal_22 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 28($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 64($sp) - j end_assign - not_is_Bool_or_Int: # internal_13 = internal_22 lw $t0, 28($sp) sw $t0, 64($sp) - end_assign: - # If internal_13 then goto then_8737511996817 + # If internal_13 then goto then_8763703753171 lw $t0, 64($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8737511996817 + beq $t0, $t1, then_8763703753171 - # Jumping to else_8737511996817 - j else_8737511996817 + # Jumping to else_8763703753171 + j else_8763703753171 - then_8737511996817: + then_8763703753171: # Allocating Int 1 li $v0, 9 @@ -1461,27 +1813,14 @@ sw $v1, 16($sp) # internal_28 = result of function_pal_at_Main addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 4($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 68($sp) - j end_assign - not_is_Bool_or_Int: # internal_12 = internal_28 lw $t0, 4($sp) sw $t0, 68($sp) - end_assign: - # Jumping to endif_8737511996817 - j endif_8737511996817 + # Jumping to endif_8763703753171 + j endif_8763703753171 - else_8737511996817: + else_8763703753171: # Allocating Bool 0 li $v0, 9 @@ -1495,71 +1834,32 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 0($sp) # internal_29 = address of allocated object Int - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 68($sp) - j end_assign - not_is_Bool_or_Int: # internal_12 = internal_29 lw $t0, 0($sp) sw $t0, 68($sp) - end_assign: - # Jumping to endif_8737511996817 - j endif_8737511996817 + # Jumping to endif_8763703753171 + j endif_8763703753171 - endif_8737511996817: + endif_8763703753171: - lw $t0, 68($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 92($sp) - j end_assign - not_is_Bool_or_Int: # internal_6 = internal_12 lw $t0, 68($sp) sw $t0, 92($sp) - end_assign: - # Jumping to endif_8737511996814 - j endif_8737511996814 + # Jumping to endif_8763703753168 + j endif_8763703753168 - endif_8737511996814: + endif_8763703753168: - lw $t0, 92($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 116($sp) - j end_assign - not_is_Bool_or_Int: # internal_0 = internal_6 lw $t0, 92($sp) sw $t0, 116($sp) - end_assign: - # Jumping to endif_8737511996832 - j endif_8737511996832 + # Jumping to endif_8763703753186 + j endif_8763703753186 - endif_8737511996832: + endif_8763703753186: # Loading return value in $v1 lw $v1, 116($sp) @@ -1589,30 +1889,114 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 52($sp) # internal_0 = address of allocated object Int - # Xor operation - lw $t0, 52($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 44($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - lw $t0, 40($sp) # $t0 = internal_3 - sw $t2, 8($t0) # Setting value in the third word of the Int object + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_1 = address of allocated object Int - # Addition operation - lw $t0, 40($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 48($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - add $t2, $t0, $t1 # $t2 = $t0 + $t1 + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall - lw $t0, 40($sp) # $t0 = internal_3 - sw $t2, 8($t0) # Setting value in the third word of the Int object + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_2 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_2 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_3 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_1 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_3 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments # Set attribute i of self lw $t0, 56($sp) # $t0 = self lw $t1, 40($sp) # $t1 = internal_3 + beq $t1, $zero, object_set_attribute_8763703710714 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8763703710714 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8763703710714 + j object_set_attribute_8763703710714 + int_set_attribute_8763703710714: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.i = internal_3 + j end_set_attribute_8763703710714 + bool_set_attribute_8763703710714: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.i = internal_3 + j end_set_attribute_8763703710714 + object_set_attribute_8763703710714: sw $t1, 8($t0) # self.i = internal_3 + end_set_attribute_8763703710714: # Allocating String li $v0, 9 @@ -1622,7 +2006,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 15 + addi $t0, $zero, 24 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 101 @@ -1692,7 +2076,6 @@ sw $v1, 44($sp) # internal_5 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - # Allocating Bool 0 li $v0, 9 addi $a0, $zero, 12 @@ -1737,33 +2120,20 @@ sw $v1, 28($sp) # internal_9 = result of function_pal_at_Main addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 16($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: # internal_7 = internal_9 lw $t0, 16($sp) sw $t0, 24($sp) - end_assign: - # If internal_7 then goto then_8737511996898 + # If internal_7 then goto then_8763703729448 lw $t0, 24($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8737511996898 + beq $t0, $t1, then_8763703729448 - # Jumping to else_8737511996898 - j else_8737511996898 + # Jumping to else_8763703729448 + j else_8763703729448 - then_8737511996898: + then_8763703729448: # Allocating String li $v0, 9 @@ -1773,7 +2143,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 22 + addi $t0, $zero, 31 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 116 @@ -1864,27 +2234,14 @@ sw $v1, 20($sp) # internal_11 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 8($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 28($sp) - j end_assign - not_is_Bool_or_Int: # internal_6 = internal_11 lw $t0, 8($sp) sw $t0, 28($sp) - end_assign: - # Jumping to endif_8737511996898 - j endif_8737511996898 + # Jumping to endif_8763703729448 + j endif_8763703729448 - else_8737511996898: + else_8763703729448: # Allocating String li $v0, 9 @@ -1894,7 +2251,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 26 + addi $t0, $zero, 35 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 116 @@ -1997,27 +2354,14 @@ sw $v1, 12($sp) # internal_13 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 28($sp) - j end_assign - not_is_Bool_or_Int: # internal_6 = internal_13 lw $t0, 0($sp) sw $t0, 28($sp) - end_assign: - # Jumping to endif_8737511996898 - j endif_8737511996898 + # Jumping to endif_8763703729448 + j endif_8763703729448 - endif_8737511996898: + endif_8763703729448: # Loading return value in $v1 lw $v1, 28($sp) diff --git a/tests/codegen/primes.mips b/tests/codegen/primes.mips index f2573c9a3..a9636c2f3 100644 --- a/tests/codegen/primes.mips +++ b/tests/codegen/primes.mips @@ -4,36 +4,42 @@ type_Object_attributes: .word 0 type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" + type_Object_abort_message: .asciiz "Abort called from class Object\n" type_IO: .word 8 type_IO_inherits_from: .word type_Object type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" + type_IO_abort_message: .asciiz "Abort called from class IO\n" type_Int: .word 8 type_Int_inherits_from: .word type_Object type_Int_attributes: .word 0 type_Int_name_size: .word 3 type_Int_name: .asciiz "Int" + type_Int_abort_message: .asciiz "Abort called from class Int\n" type_String: .word 8 type_String_inherits_from: .word type_Object type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" + type_String_abort_message: .asciiz "Abort called from class String\n" type_Bool: .word 8 type_Bool_inherits_from: .word type_Object type_Bool_attributes: .word 0 type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" + type_Bool_abort_message: .asciiz "Abort called from class Bool\n" type_Main: .word 28 type_Main_inherits_from: .word type_IO type_Main_attributes: .word 5 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" + type_Main_abort_message: .asciiz "Abort called from class Main\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -316,12 +322,12 @@ function_equal: # Function parameters - # $ra = 40($sp) - # a = 36($sp) - # b = 32($sp) + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) # Reserving space for local variables - addi $sp, $sp, -32 + addi $sp, $sp, -40 # Allocating Bool 0 li $v0, 9 @@ -333,22 +339,57 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_0 = address of allocated object Int + sw $v0, 36($sp) # internal_0 = address of allocated object Int - # internal_1 = typeof a that is the first word of the object - lw $t0, 36($sp) - lw $t1, 0($t0) - sw $t1, 24($sp) + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int - # internal_2 = direction of Int + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int la $t0, type_Int sw $t0, 20($sp) - # internal_3 = direction of Bool + # internal_5 = direction of Bool la $t0, type_Bool sw $t0, 16($sp) - # internal_4 = direction of String + # internal_6 = direction of String la $t0, type_String sw $t0, 12($sp) @@ -362,7 +403,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_5 = address of allocated object Int + sw $v0, 8($sp) # internal_7 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -374,7 +415,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_6 = address of allocated object Int + sw $v0, 4($sp) # internal_8 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -386,42 +427,42 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_7 = address of allocated object Int + sw $v0, 0($sp) # internal_9 = address of allocated object Int - # internal_5 = EqualAddress(internal_1, internal_2) + # internal_7 = EqualAddress(internal_3, internal_4) lw $t0, 24($sp) lw $t1, 20($sp) seq $t2, $t0, $t1 lw $t0, 8($sp) sw $t2, 8($t0) - # internal_6 = EqualAddress(internal_1, internal_3) + # internal_8 = EqualAddress(internal_3, internal_5) lw $t0, 24($sp) lw $t1, 16($sp) seq $t2, $t0, $t1 lw $t0, 4($sp) sw $t2, 8($t0) - # internal_7 = EqualAddress(internal_1, internal_4) + # internal_9 = EqualAddress(internal_3, internal_6) lw $t0, 24($sp) lw $t1, 12($sp) seq $t2, $t0, $t1 lw $t0, 0($sp) sw $t2, 8($t0) - # If internal_5 then goto a_is_type_int_or_bool + # If internal_7 then goto a_is_type_int_or_bool lw $t0, 8($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison beq $t0, $t1, a_is_type_int_or_bool - # If internal_6 then goto a_is_type_int_or_bool + # If internal_8 then goto a_is_type_int_or_bool lw $t0, 4($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison beq $t0, $t1, a_is_type_int_or_bool - # If internal_7 then goto a_is_type_string + # If internal_9 then goto a_is_type_string lw $t0, 0($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison @@ -433,12 +474,12 @@ a_is_type_int_or_bool: # internal_0 = EqualInt(a, b) - lw $t0, 36($sp) + lw $t0, 44($sp) lw $t0, 8($t0) - lw $t1, 32($sp) + lw $t1, 40($sp) lw $t1, 8($t1) seq $t2, $t0, $t1 - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t2, 8($t0) # Jumping to end_of_equal @@ -447,14 +488,14 @@ a_is_type_string: # internal_0 = EqualStr(a, b) - lw $t0, 36($sp) - lw $t1, 32($sp) + lw $t0, 44($sp) + lw $t1, 40($sp) addi $t0, $t0, 8 addi $t1, $t1, 8 # By default we assume the strings are equals addi $t4, $zero, 1 - lw $t5, 28($sp) + lw $t5, 36($sp) sw $t4, 8($t5) while_compare_strings_start: @@ -463,7 +504,7 @@ beq $t2, $t3, while_compare_strings_update # The strings are no equals - lw $t5, 28($sp) + lw $t5, 36($sp) sw $zero, 8($t5) j while_compare_strings_end @@ -471,6 +512,7 @@ addi $t0, $t0, 1 addi $t1, $t1, 1 beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end j while_compare_strings_start while_compare_strings_end: @@ -480,11 +522,11 @@ a_is_type_object: # Equal operation - lw $t0, 36($sp) # Save in $t0 the left operand address - lw $t1, 32($sp) # Save in $t1 the right operand address + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address seq $t2, $t0, $t1 # $t2 = $t0 == $t1 - lw $t0, 28($sp) # $t0 = internal_0 + lw $t0, 36($sp) # $t0 = internal_0 sw $t2, 8($t0) # Setting value in the third word of the Bool object # Jumping to end_of_equal @@ -493,10 +535,156 @@ end_of_equal: # Loading return value in $v1 - lw $v1, 28($sp) + lw $v1, 36($sp) # Freeing space for local variables - addi $sp, $sp, 32 + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 jr $ra @@ -512,15 +700,184 @@ function_abort_at_Object: # Function parameters - # $ra = 4($sp) - # self = 0($sp) + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_2[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_2 = "\n" + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_type_name_at_Object + jal function_type_name_at_Object + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 12($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) # $t0 = internal_3 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string internal_3 + li $v0, 4 + move $a0, $t0 + syscall # Exit program li $v0, 10 syscall # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 jr $ra @@ -536,7 +893,7 @@ lw $t0, 4($sp) # $t0 = self lw $t1, 0($t0) # $t1 = type of self lw $t2, 12($t1) # $t1 = length of the name of self - lw $t3, 16($t1) # $t1 = name of self + la $t3, 16($t1) # $t1 = name of self addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 @@ -546,26 +903,24 @@ la $t4, type_String sw $t4, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - move $t4, $v0 # $t4 = direction of the new string + addi $t4, $v0, 0 # $t4 = direction of the new string addi $t4, $t4, 8 # Pointer to the first character of the string - addi $t0, $t0, 8 # Pointer to the first character of the string in self xor $t5, $t5, $t5 # Initializing counter while_copy_name_start: - beq $t5, $t1, while_copy_name_end - lb $t6, 0($t0) # Loading the character + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character sb $t6, 0($t4) addi $t4, $t4, 1 # Incrementing the pointer to the new string - addi $t0, $t0, 1 # Incrementing the pointer to the string in self + addi $t3, $t3, 1 # Incrementing the pointer to the string in self addi $t5, $t5, 1 # Incrementing counter j while_copy_name_start while_copy_name_end: sb $zero, 0($t4) # Setting the null byte - sw $t4, 0($sp) # Storing the new string in internal_0 + sw $v0, 0($sp) # Storing the new string in internal_0 # Loading return value in $v1 lw $v1, 0($sp) @@ -683,16 +1038,18 @@ xor $t0, $t0, $t0 # Initializing counter while_read_start: - lw $t1, buffer_input($t0) # Loading the byte + lb $t1, buffer_input($t0) # Loading the byte beq $t1, $zero, while_read_end addi $t0, $t0, 1 # Incrementing counter j while_read_start while_read_end: + addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 move $a0, $t0 syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte la $t2, type_String sw $t2, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting length in the second word of the object @@ -702,7 +1059,7 @@ while_copy_from_buffer_start: beq $t4, $t0, while_copy_from_buffer_end - lw $t5, buffer_input($t4) # Loading the byte + lb $t5, buffer_input($t4) # Loading the byte sb $t5, 0($t3) # Storing the byte addi $t3, $t3, 1 # Imcremeenting pointer addi $t4, $t4, 1 # Incrementing counter @@ -729,9 +1086,22 @@ # Reserving space for local variables addi $sp, $sp, -4 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + li $v0, 5 syscall - sw $v0, 0($sp) # Storing the new object in internal_0 + lw $t0, 0($sp) + sw $v0, 8($t0) # Loading return value in $v1 lw $v1, 0($sp) @@ -759,11 +1129,24 @@ # Reserving space for local variables addi $sp, $sp, -4 + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + # internal_0 = length of self lw $t0, 4($sp) lw $t1, 4($t0) addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator - sw $t1, 0($sp) + lw $t0, 0($sp) + sw $t1, 8($t0) # Loading return value in $v1 lw $v1, 0($sp) @@ -787,6 +1170,8 @@ lw $t1, 4($sp) lw $t2, 4($t0) # $t2 = length of str1 lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 add $t4, $t2, $t3 # $t4 = length of str1 + str2 addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) @@ -806,7 +1191,7 @@ xor $t6, $t6, $t6 # $t6 = 0 Initializing counter while_copy_str1_start: beq $t6, $t2, while_copy_str1_end - lb $t7, 0($t0) + lb $t7, 8($t0) sb $t7, 0($t5) add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string @@ -817,7 +1202,7 @@ # Copying str2 to the new string while_copy_str2_start: beq $t6, $t4, while_copy_str2_end - lb $t7, 0($t1) + lb $t7, 8($t1) sb $t7, 0($t5) add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string @@ -850,11 +1235,14 @@ # internal_0 = self[i:i + l] lw $t0, 12($sp) # $t0 = address of the string lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring - bge $t4, $t1, substring_out_of_bounds + bgt $t4, $t1, substring_out_of_bounds addi $t3, $t3, 9 li $v0, 9 @@ -904,11 +1292,11 @@ function___init___at_Main: # Function parameters - # $ra = 236($sp) - # self = 232($sp) + # $ra = 228($sp) + # self = 224($sp) # Reserving space for local variables - addi $sp, $sp, -232 + addi $sp, $sp, -224 # Allocating String li $v0, 9 @@ -918,7 +1306,7 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 22 + addi $t0, $zero, 31 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 50 @@ -989,24 +1377,24 @@ sb $zero, 30($v0) # Null-terminator at the end of the string - sw $v0, 228($sp) # internal_0 = "2 is trivially prime.\n" + sw $v0, 220($sp) # internal_0 = "2 is trivially prime.\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 244($sp) + lw $t0, 236($sp) sw $t0, 4($sp) # Storing self # Argument internal_0 - lw $t0, 240($sp) + lw $t0, 232($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 236($sp) # internal_1 = result of function_out_string_at_IO + sw $v1, 228($sp) # internal_1 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 2 @@ -1019,22 +1407,117 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 220($sp) # internal_2 = address of allocated object Int + sw $v0, 212($sp) # internal_2 = address of allocated object Int # Set attribute out of self - lw $t0, 232($sp) # $t0 = self - lw $t1, 220($sp) # $t1 = internal_2 + lw $t0, 224($sp) # $t0 = self + lw $t1, 212($sp) # $t1 = internal_2 + beq $t1, $zero, object_set_attribute_8739917756133 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8739917756133 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8739917756133 + j object_set_attribute_8739917756133 + int_set_attribute_8739917756133: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.out = internal_2 + j end_set_attribute_8739917756133 + bool_set_attribute_8739917756133: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.out = internal_2 + j end_set_attribute_8739917756133 + object_set_attribute_8739917756133: sw $t1, 8($t0) # self.out = internal_2 + end_set_attribute_8739917756133: # Get attribute out of self - lw $t0, 232($sp) # Get the address of self + lw $t0, 224($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'out' from the instance - sw $t1, 216($sp) # internal_3 = out + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8739917757486 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8739917757486 + j object_get_attribute_8739917757486 + int_get_attribute_8739917757486: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 208($sp) # internal_3 = self.out + j end_get_attribute_8739917757486 + bool_get_attribute_8739917757486: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 208($sp) # internal_3 = self.out + j end_get_attribute_8739917757486 + object_get_attribute_8739917757486: + sw $t1, 208($sp) # internal_3 = out + end_get_attribute_8739917757486: # Set attribute testee of self - lw $t0, 232($sp) # $t0 = self - lw $t1, 216($sp) # $t1 = internal_3 + lw $t0, 224($sp) # $t0 = self + lw $t1, 208($sp) # $t1 = internal_3 + beq $t1, $zero, object_set_attribute_8739917756142 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8739917756142 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8739917756142 + j object_set_attribute_8739917756142 + int_set_attribute_8739917756142: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.testee = internal_3 + j end_set_attribute_8739917756142 + bool_set_attribute_8739917756142: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.testee = internal_3 + j end_set_attribute_8739917756142 + object_set_attribute_8739917756142: sw $t1, 12($t0) # self.testee = internal_3 + end_set_attribute_8739917756142: # Allocating Int 0 li $v0, 9 @@ -1046,12 +1529,44 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 212($sp) # internal_4 = address of allocated object Int + sw $v0, 204($sp) # internal_4 = address of allocated object Int # Set attribute divisor of self - lw $t0, 232($sp) # $t0 = self - lw $t1, 212($sp) # $t1 = internal_4 + lw $t0, 224($sp) # $t0 = self + lw $t1, 204($sp) # $t1 = internal_4 + beq $t1, $zero, object_set_attribute_8739917757498 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8739917757498 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8739917757498 + j object_set_attribute_8739917757498 + int_set_attribute_8739917757498: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.divisor = internal_4 + j end_set_attribute_8739917757498 + bool_set_attribute_8739917757498: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.divisor = internal_4 + j end_set_attribute_8739917757498 + object_set_attribute_8739917757498: sw $t1, 16($t0) # self.divisor = internal_4 + end_set_attribute_8739917757498: # Allocating Int 500 li $v0, 9 @@ -1063,14 +1578,46 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 500 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 208($sp) # internal_5 = address of allocated object Int + sw $v0, 200($sp) # internal_5 = address of allocated object Int # Set attribute stop of self - lw $t0, 232($sp) # $t0 = self - lw $t1, 208($sp) # $t1 = internal_5 + lw $t0, 224($sp) # $t0 = self + lw $t1, 200($sp) # $t1 = internal_5 + beq $t1, $zero, object_set_attribute_8739917757516 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8739917757516 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8739917757516 + j object_set_attribute_8739917757516 + int_set_attribute_8739917757516: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.stop = internal_5 + j end_set_attribute_8739917757516 + bool_set_attribute_8739917757516: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.stop = internal_5 + j end_set_attribute_8739917757516 + object_set_attribute_8739917757516: sw $t1, 20($t0) # self.stop = internal_5 + end_set_attribute_8739917757516: - while_start_8728017462209: + while_start_8739917777412: # Allocating Bool 1 li $v0, 9 @@ -1082,40 +1629,54 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 200($sp) # internal_7 = address of allocated object Int - - lw $t0, 200($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 204($sp) - j end_assign - not_is_Bool_or_Int: - # internal_6 = internal_7 - lw $t0, 200($sp) - sw $t0, 204($sp) - end_assign: + sw $v0, 196($sp) # internal_6 = address of allocated object Int - # If internal_6 then goto while_body_8728017462209 - lw $t0, 204($sp) # Loading the address of the condition + # If internal_6 then goto while_body_8739917777412 + lw $t0, 196($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8728017462209 + beq $t0, $t1, while_body_8739917777412 - # Jumping to while_end_8728017462209 - j while_end_8728017462209 + # Jumping to while_end_8739917777412 + j while_end_8739917777412 - while_body_8728017462209: + while_body_8739917777412: # Get attribute testee of self - lw $t0, 232($sp) # Get the address of self + lw $t0, 224($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'testee' from the instance - sw $t1, 196($sp) # internal_8 = testee + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8739917757648 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8739917757648 + j object_get_attribute_8739917757648 + int_get_attribute_8739917757648: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 192($sp) # internal_7 = self.testee + j end_get_attribute_8739917757648 + bool_get_attribute_8739917757648: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 192($sp) # internal_7 = self.testee + j end_get_attribute_8739917757648 + object_get_attribute_8739917757648: + sw $t1, 192($sp) # internal_7 = testee + end_get_attribute_8739917757648: # Allocating Int 1 li $v0, 9 @@ -1127,30 +1688,62 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 192($sp) # internal_9 = address of allocated object Int + sw $v0, 188($sp) # internal_8 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_8 - lw $t0, 208($sp) - sw $t0, 4($sp) # Storing internal_8 - - # Argument internal_9 + # Argument internal_7 lw $t0, 204($sp) - sw $t0, 0($sp) # Storing internal_9 + sw $t0, 4($sp) # Storing internal_7 + + # Argument internal_8 + lw $t0, 200($sp) + sw $t0, 0($sp) # Storing internal_8 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 200($sp) # internal_10 = result of function_add + sw $v1, 196($sp) # internal_9 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Set attribute testee of self - lw $t0, 232($sp) # $t0 = self - lw $t1, 188($sp) # $t1 = internal_10 - sw $t1, 12($t0) # self.testee = internal_10 + lw $t0, 224($sp) # $t0 = self + lw $t1, 184($sp) # $t1 = internal_9 + beq $t1, $zero, object_set_attribute_8739917757624 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8739917757624 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8739917757624 + j object_set_attribute_8739917757624 + int_set_attribute_8739917757624: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.testee = internal_9 + j end_set_attribute_8739917757624 + bool_set_attribute_8739917757624: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.testee = internal_9 + j end_set_attribute_8739917757624 + object_set_attribute_8739917757624: + sw $t1, 12($t0) # self.testee = internal_9 + end_set_attribute_8739917757624: # Allocating Int 2 li $v0, 9 @@ -1162,15 +1755,46 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 184($sp) # internal_11 = address of allocated object Int + sw $v0, 180($sp) # internal_10 = address of allocated object Int # Set attribute divisor of self - lw $t0, 232($sp) # $t0 = self - lw $t1, 184($sp) # $t1 = internal_11 - sw $t1, 16($t0) # self.divisor = internal_11 - - while_start_8728017462077: - + lw $t0, 224($sp) # $t0 = self + lw $t1, 180($sp) # $t1 = internal_10 + beq $t1, $zero, object_set_attribute_8739917757684 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8739917757684 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8739917757684 + j object_set_attribute_8739917757684 + int_set_attribute_8739917757684: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.divisor = internal_10 + j end_set_attribute_8739917757684 + bool_set_attribute_8739917757684: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.divisor = internal_10 + j end_set_attribute_8739917757684 + object_set_attribute_8739917757684: + sw $t1, 16($t0) # self.divisor = internal_10 + end_set_attribute_8739917757684: + + while_start_8739917776764: # Allocating Bool 0 li $v0, 9 @@ -1182,86 +1806,166 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 172($sp) # internal_14 = address of allocated object Int + sw $v0, 172($sp) # internal_12 = address of allocated object Int # Get attribute testee of self - lw $t0, 232($sp) # Get the address of self + lw $t0, 224($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'testee' from the instance - sw $t1, 168($sp) # internal_15 = testee + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8739917759320 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8739917759320 + j object_get_attribute_8739917759320 + int_get_attribute_8739917759320: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 168($sp) # internal_13 = self.testee + j end_get_attribute_8739917759320 + bool_get_attribute_8739917759320: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 168($sp) # internal_13 = self.testee + j end_get_attribute_8739917759320 + object_get_attribute_8739917759320: + sw $t1, 168($sp) # internal_13 = testee + end_get_attribute_8739917759320: # Get attribute divisor of self - lw $t0, 232($sp) # Get the address of self + lw $t0, 224($sp) # Get the address of self lw $t1, 16($t0) # Get the attribute 'divisor' from the instance - sw $t1, 164($sp) # internal_16 = divisor + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8739917759344 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8739917759344 + j object_get_attribute_8739917759344 + int_get_attribute_8739917759344: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 164($sp) # internal_14 = self.divisor + j end_get_attribute_8739917759344 + bool_get_attribute_8739917759344: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 164($sp) # internal_14 = self.divisor + j end_get_attribute_8739917759344 + object_get_attribute_8739917759344: + sw $t1, 164($sp) # internal_14 = divisor + end_get_attribute_8739917759344: # Get attribute divisor of self - lw $t0, 232($sp) # Get the address of self + lw $t0, 224($sp) # Get the address of self lw $t1, 16($t0) # Get the attribute 'divisor' from the instance - sw $t1, 160($sp) # internal_17 = divisor + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8739917759356 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8739917759356 + j object_get_attribute_8739917759356 + int_get_attribute_8739917759356: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 160($sp) # internal_15 = self.divisor + j end_get_attribute_8739917759356 + bool_get_attribute_8739917759356: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 160($sp) # internal_15 = self.divisor + j end_get_attribute_8739917759356 + object_get_attribute_8739917759356: + sw $t1, 160($sp) # internal_15 = divisor + end_get_attribute_8739917759356: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_16 + # Argument internal_14 lw $t0, 176($sp) - sw $t0, 4($sp) # Storing internal_16 + sw $t0, 4($sp) # Storing internal_14 - # Argument internal_17 + # Argument internal_15 lw $t0, 172($sp) - sw $t0, 0($sp) # Storing internal_17 + sw $t0, 0($sp) # Storing internal_15 # Calling function function_mult jal function_mult lw $ra, 8($sp) - sw $v1, 168($sp) # internal_18 = result of function_mult + sw $v1, 168($sp) # internal_16 = result of function_mult addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_15 + # Argument internal_13 lw $t0, 180($sp) - sw $t0, 4($sp) # Storing internal_15 + sw $t0, 4($sp) # Storing internal_13 - # Argument internal_18 + # Argument internal_16 lw $t0, 168($sp) - sw $t0, 0($sp) # Storing internal_18 + sw $t0, 0($sp) # Storing internal_16 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 164($sp) # internal_19 = result of function_less_than + sw $v1, 164($sp) # internal_17 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 152($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 172($sp) - j end_assign - not_is_Bool_or_Int: - # internal_14 = internal_19 + # internal_12 = internal_17 lw $t0, 152($sp) sw $t0, 172($sp) - end_assign: - # If internal_14 then goto then_8728017462053 + # If internal_12 then goto then_8739917776740 lw $t0, 172($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8728017462053 + beq $t0, $t1, then_8739917776740 - # Jumping to else_8728017462053 - j else_8728017462053 + # Jumping to else_8739917776740 + j else_8739917776740 - then_8728017462053: + then_8739917776740: # Allocating Bool 0 li $v0, 9 @@ -1273,30 +1977,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 148($sp) # internal_20 = address of allocated object Int + sw $v0, 148($sp) # internal_18 = address of allocated object Int - lw $t0, 148($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 176($sp) - j end_assign - not_is_Bool_or_Int: - # internal_13 = internal_20 + # internal_11 = internal_18 lw $t0, 148($sp) sw $t0, 176($sp) - end_assign: - - # Jumping to endif_8728017462053 - j endif_8728017462053 - else_8728017462053: + # Jumping to endif_8739917776740 + j endif_8739917776740 + else_8739917776740: # Allocating Bool 0 li $v0, 9 @@ -1308,80 +1998,204 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 140($sp) # internal_22 = address of allocated object Int + sw $v0, 140($sp) # internal_20 = address of allocated object Int # Get attribute testee of self - lw $t0, 232($sp) # Get the address of self + lw $t0, 224($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'testee' from the instance - sw $t1, 136($sp) # internal_23 = testee + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8739917759778 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8739917759778 + j object_get_attribute_8739917759778 + int_get_attribute_8739917759778: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 136($sp) # internal_21 = self.testee + j end_get_attribute_8739917759778 + bool_get_attribute_8739917759778: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 136($sp) # internal_21 = self.testee + j end_get_attribute_8739917759778 + object_get_attribute_8739917759778: + sw $t1, 136($sp) # internal_21 = testee + end_get_attribute_8739917759778: # Get attribute divisor of self - lw $t0, 232($sp) # Get the address of self + lw $t0, 224($sp) # Get the address of self lw $t1, 16($t0) # Get the attribute 'divisor' from the instance - sw $t1, 132($sp) # internal_24 = divisor + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8739917759802 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8739917759802 + j object_get_attribute_8739917759802 + int_get_attribute_8739917759802: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 132($sp) # internal_22 = self.divisor + j end_get_attribute_8739917759802 + bool_get_attribute_8739917759802: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 132($sp) # internal_22 = self.divisor + j end_get_attribute_8739917759802 + object_get_attribute_8739917759802: + sw $t1, 132($sp) # internal_22 = divisor + end_get_attribute_8739917759802: # Get attribute testee of self - lw $t0, 232($sp) # Get the address of self + lw $t0, 224($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'testee' from the instance - sw $t1, 128($sp) # internal_25 = testee + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8739917759826 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8739917759826 + j object_get_attribute_8739917759826 + int_get_attribute_8739917759826: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 128($sp) # internal_23 = self.testee + j end_get_attribute_8739917759826 + bool_get_attribute_8739917759826: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 128($sp) # internal_23 = self.testee + j end_get_attribute_8739917759826 + object_get_attribute_8739917759826: + sw $t1, 128($sp) # internal_23 = testee + end_get_attribute_8739917759826: # Get attribute divisor of self - lw $t0, 232($sp) # Get the address of self + lw $t0, 224($sp) # Get the address of self lw $t1, 16($t0) # Get the attribute 'divisor' from the instance - sw $t1, 124($sp) # internal_26 = divisor + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8739917759838 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8739917759838 + j object_get_attribute_8739917759838 + int_get_attribute_8739917759838: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 124($sp) # internal_24 = self.divisor + j end_get_attribute_8739917759838 + bool_get_attribute_8739917759838: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 124($sp) # internal_24 = self.divisor + j end_get_attribute_8739917759838 + object_get_attribute_8739917759838: + sw $t1, 124($sp) # internal_24 = divisor + end_get_attribute_8739917759838: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_25 + # Argument internal_23 lw $t0, 140($sp) - sw $t0, 4($sp) # Storing internal_25 + sw $t0, 4($sp) # Storing internal_23 - # Argument internal_26 + # Argument internal_24 lw $t0, 136($sp) - sw $t0, 0($sp) # Storing internal_26 + sw $t0, 0($sp) # Storing internal_24 # Calling function function_div jal function_div lw $ra, 8($sp) - sw $v1, 132($sp) # internal_27 = result of function_div + sw $v1, 132($sp) # internal_25 = result of function_div addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_24 + # Argument internal_22 lw $t0, 144($sp) - sw $t0, 4($sp) # Storing internal_24 + sw $t0, 4($sp) # Storing internal_22 - # Argument internal_27 + # Argument internal_25 lw $t0, 132($sp) - sw $t0, 0($sp) # Storing internal_27 + sw $t0, 0($sp) # Storing internal_25 # Calling function function_mult jal function_mult lw $ra, 8($sp) - sw $v1, 128($sp) # internal_28 = result of function_mult + sw $v1, 128($sp) # internal_26 = result of function_mult addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_23 + # Argument internal_21 lw $t0, 148($sp) - sw $t0, 4($sp) # Storing internal_23 + sw $t0, 4($sp) # Storing internal_21 - # Argument internal_28 + # Argument internal_26 lw $t0, 128($sp) - sw $t0, 0($sp) # Storing internal_28 + sw $t0, 0($sp) # Storing internal_26 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 124($sp) # internal_29 = result of function_sub + sw $v1, 124($sp) # internal_27 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 0 @@ -1394,53 +2208,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 108($sp) # internal_30 = address of allocated object Int + sw $v0, 108($sp) # internal_28 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_29 + # Argument internal_27 lw $t0, 124($sp) - sw $t0, 4($sp) # Storing internal_29 + sw $t0, 4($sp) # Storing internal_27 - # Argument internal_30 + # Argument internal_28 lw $t0, 120($sp) - sw $t0, 0($sp) # Storing internal_30 + sw $t0, 0($sp) # Storing internal_28 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 116($sp) # internal_31 = result of function_equal + sw $v1, 116($sp) # internal_29 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 104($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 140($sp) - j end_assign - not_is_Bool_or_Int: - # internal_22 = internal_31 + # internal_20 = internal_29 lw $t0, 104($sp) sw $t0, 140($sp) - end_assign: - # If internal_22 then goto then_8728017462047 + # If internal_20 then goto then_8739917776734 lw $t0, 140($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8728017462047 + beq $t0, $t1, then_8739917776734 - # Jumping to else_8728017462047 - j else_8728017462047 + # Jumping to else_8739917776734 + j else_8739917776734 - then_8728017462047: + then_8739917776734: # Allocating Bool 0 li $v0, 9 @@ -1452,29 +2253,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 100($sp) # internal_32 = address of allocated object Int + sw $v0, 100($sp) # internal_30 = address of allocated object Int - lw $t0, 100($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 144($sp) - j end_assign - not_is_Bool_or_Int: - # internal_21 = internal_32 + # internal_19 = internal_30 lw $t0, 100($sp) sw $t0, 144($sp) - end_assign: - # Jumping to endif_8728017462047 - j endif_8728017462047 + # Jumping to endif_8739917776734 + j endif_8739917776734 - else_8728017462047: + else_8739917776734: # Allocating Bool 1 li $v0, 9 @@ -1486,84 +2274,72 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 96($sp) # internal_33 = address of allocated object Int + sw $v0, 96($sp) # internal_31 = address of allocated object Int - lw $t0, 96($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 144($sp) - j end_assign - not_is_Bool_or_Int: - # internal_21 = internal_33 + # internal_19 = internal_31 lw $t0, 96($sp) sw $t0, 144($sp) - end_assign: - # Jumping to endif_8728017462047 - j endif_8728017462047 + # Jumping to endif_8739917776734 + j endif_8739917776734 - endif_8728017462047: + endif_8739917776734: - lw $t0, 144($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 176($sp) - j end_assign - not_is_Bool_or_Int: - # internal_13 = internal_21 + # internal_11 = internal_19 lw $t0, 144($sp) sw $t0, 176($sp) - end_assign: - # Jumping to endif_8728017462053 - j endif_8728017462053 + # Jumping to endif_8739917776740 + j endif_8739917776740 - endif_8728017462053: + endif_8739917776740: - lw $t0, 176($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 180($sp) - j end_assign - not_is_Bool_or_Int: - # internal_12 = internal_13 - lw $t0, 176($sp) - sw $t0, 180($sp) - end_assign: - - # If internal_12 then goto while_body_8728017462077 - lw $t0, 180($sp) # Loading the address of the condition + # If internal_11 then goto while_body_8739917776764 + lw $t0, 176($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8728017462077 + beq $t0, $t1, while_body_8739917776764 - # Jumping to while_end_8728017462077 - j while_end_8728017462077 + # Jumping to while_end_8739917776764 + j while_end_8739917776764 - while_body_8728017462077: + while_body_8739917776764: # Get attribute divisor of self - lw $t0, 232($sp) # Get the address of self + lw $t0, 224($sp) # Get the address of self lw $t1, 16($t0) # Get the attribute 'divisor' from the instance - sw $t1, 92($sp) # internal_34 = divisor + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8739917761085 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8739917761085 + j object_get_attribute_8739917761085 + int_get_attribute_8739917761085: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 92($sp) # internal_32 = self.divisor + j end_get_attribute_8739917761085 + bool_get_attribute_8739917761085: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 92($sp) # internal_32 = self.divisor + j end_get_attribute_8739917761085 + object_get_attribute_8739917761085: + sw $t1, 92($sp) # internal_32 = divisor + end_get_attribute_8739917761085: # Allocating Int 1 li $v0, 9 @@ -1575,36 +2351,67 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 88($sp) # internal_35 = address of allocated object Int + sw $v0, 88($sp) # internal_33 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_34 + # Argument internal_32 lw $t0, 104($sp) - sw $t0, 4($sp) # Storing internal_34 + sw $t0, 4($sp) # Storing internal_32 - # Argument internal_35 + # Argument internal_33 lw $t0, 100($sp) - sw $t0, 0($sp) # Storing internal_35 + sw $t0, 0($sp) # Storing internal_33 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 96($sp) # internal_36 = result of function_add + sw $v1, 96($sp) # internal_34 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Set attribute divisor of self - lw $t0, 232($sp) # $t0 = self - lw $t1, 84($sp) # $t1 = internal_36 - sw $t1, 16($t0) # self.divisor = internal_36 - - # Jumping to while_start_8728017462077 - j while_start_8728017462077 + lw $t0, 224($sp) # $t0 = self + lw $t1, 84($sp) # $t1 = internal_34 + beq $t1, $zero, object_set_attribute_8739917761061 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8739917761061 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8739917761061 + j object_set_attribute_8739917761061 + int_set_attribute_8739917761061: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.divisor = internal_34 + j end_set_attribute_8739917761061 + bool_set_attribute_8739917761061: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.divisor = internal_34 + j end_set_attribute_8739917761061 + object_set_attribute_8739917761061: + sw $t1, 16($t0) # self.divisor = internal_34 + end_set_attribute_8739917761061: - while_end_8728017462077: + # Jumping to while_start_8739917776764 + j while_start_8739917776764 + while_end_8739917776764: # Allocating Bool 0 li $v0, 9 @@ -1616,118 +2423,292 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 76($sp) # internal_38 = address of allocated object Int + sw $v0, 76($sp) # internal_36 = address of allocated object Int # Get attribute testee of self - lw $t0, 232($sp) # Get the address of self + lw $t0, 224($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'testee' from the instance - sw $t1, 72($sp) # internal_39 = testee + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8739917761172 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8739917761172 + j object_get_attribute_8739917761172 + int_get_attribute_8739917761172: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 72($sp) # internal_37 = self.testee + j end_get_attribute_8739917761172 + bool_get_attribute_8739917761172: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 72($sp) # internal_37 = self.testee + j end_get_attribute_8739917761172 + object_get_attribute_8739917761172: + sw $t1, 72($sp) # internal_37 = testee + end_get_attribute_8739917761172: # Get attribute divisor of self - lw $t0, 232($sp) # Get the address of self + lw $t0, 224($sp) # Get the address of self lw $t1, 16($t0) # Get the attribute 'divisor' from the instance - sw $t1, 68($sp) # internal_40 = divisor + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8739917761196 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8739917761196 + j object_get_attribute_8739917761196 + int_get_attribute_8739917761196: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 68($sp) # internal_38 = self.divisor + j end_get_attribute_8739917761196 + bool_get_attribute_8739917761196: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 68($sp) # internal_38 = self.divisor + j end_get_attribute_8739917761196 + object_get_attribute_8739917761196: + sw $t1, 68($sp) # internal_38 = divisor + end_get_attribute_8739917761196: # Get attribute divisor of self - lw $t0, 232($sp) # Get the address of self + lw $t0, 224($sp) # Get the address of self lw $t1, 16($t0) # Get the attribute 'divisor' from the instance - sw $t1, 64($sp) # internal_41 = divisor + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8739917761208 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8739917761208 + j object_get_attribute_8739917761208 + int_get_attribute_8739917761208: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 64($sp) # internal_39 = self.divisor + j end_get_attribute_8739917761208 + bool_get_attribute_8739917761208: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 64($sp) # internal_39 = self.divisor + j end_get_attribute_8739917761208 + object_get_attribute_8739917761208: + sw $t1, 64($sp) # internal_39 = divisor + end_get_attribute_8739917761208: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_40 + # Argument internal_38 lw $t0, 80($sp) - sw $t0, 4($sp) # Storing internal_40 + sw $t0, 4($sp) # Storing internal_38 - # Argument internal_41 + # Argument internal_39 lw $t0, 76($sp) - sw $t0, 0($sp) # Storing internal_41 + sw $t0, 0($sp) # Storing internal_39 # Calling function function_mult jal function_mult lw $ra, 8($sp) - sw $v1, 72($sp) # internal_42 = result of function_mult + sw $v1, 72($sp) # internal_40 = result of function_mult addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_39 + # Argument internal_37 lw $t0, 84($sp) - sw $t0, 4($sp) # Storing internal_39 + sw $t0, 4($sp) # Storing internal_37 - # Argument internal_42 + # Argument internal_40 lw $t0, 72($sp) - sw $t0, 0($sp) # Storing internal_42 + sw $t0, 0($sp) # Storing internal_40 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 68($sp) # internal_43 = result of function_less_than + sw $v1, 68($sp) # internal_41 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 56($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 76($sp) - j end_assign - not_is_Bool_or_Int: - # internal_38 = internal_43 + # internal_36 = internal_41 lw $t0, 56($sp) sw $t0, 76($sp) - end_assign: - # If internal_38 then goto then_8728017462143 + # If internal_36 then goto then_8739917776830 lw $t0, 76($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8728017462143 + beq $t0, $t1, then_8739917776830 - # Jumping to else_8728017462143 - j else_8728017462143 + # Jumping to else_8739917776830 + j else_8739917776830 - then_8728017462143: + then_8739917776830: # Get attribute testee of self - lw $t0, 232($sp) # Get the address of self + lw $t0, 224($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'testee' from the instance - sw $t1, 52($sp) # internal_44 = testee + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8739917761564 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8739917761564 + j object_get_attribute_8739917761564 + int_get_attribute_8739917761564: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 52($sp) # internal_42 = self.testee + j end_get_attribute_8739917761564 + bool_get_attribute_8739917761564: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 52($sp) # internal_42 = self.testee + j end_get_attribute_8739917761564 + object_get_attribute_8739917761564: + sw $t1, 52($sp) # internal_42 = testee + end_get_attribute_8739917761564: # Set attribute out of self - lw $t0, 232($sp) # $t0 = self - lw $t1, 52($sp) # $t1 = internal_44 - sw $t1, 8($t0) # self.out = internal_44 + lw $t0, 224($sp) # $t0 = self + lw $t1, 52($sp) # $t1 = internal_42 + beq $t1, $zero, object_set_attribute_8739917761552 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8739917761552 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8739917761552 + j object_set_attribute_8739917761552 + int_set_attribute_8739917761552: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.out = internal_42 + j end_set_attribute_8739917761552 + bool_set_attribute_8739917761552: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.out = internal_42 + j end_set_attribute_8739917761552 + object_set_attribute_8739917761552: + sw $t1, 8($t0) # self.out = internal_42 + end_set_attribute_8739917761552: # Get attribute out of self - lw $t0, 232($sp) # Get the address of self + lw $t0, 224($sp) # Get the address of self lw $t1, 8($t0) # Get the attribute 'out' from the instance - sw $t1, 48($sp) # internal_45 = out + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8739917761588 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8739917761588 + j object_get_attribute_8739917761588 + int_get_attribute_8739917761588: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 48($sp) # internal_43 = self.out + j end_get_attribute_8739917761588 + bool_get_attribute_8739917761588: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 48($sp) # internal_43 = self.out + j end_get_attribute_8739917761588 + object_get_attribute_8739917761588: + sw $t1, 48($sp) # internal_43 = out + end_get_attribute_8739917761588: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 244($sp) + lw $t0, 236($sp) sw $t0, 4($sp) # Storing self - # Argument internal_45 + # Argument internal_43 lw $t0, 60($sp) - sw $t0, 0($sp) # Storing internal_45 + sw $t0, 0($sp) # Storing internal_43 # Calling function function_out_int_at_IO jal function_out_int_at_IO lw $ra, 8($sp) - sw $v1, 56($sp) # internal_46 = result of function_out_int_at_IO + sw $v1, 56($sp) # internal_44 = result of function_out_int_at_IO addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -1738,85 +2719,72 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 11 + addi $t0, $zero, 20 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_47[0] = ' ' + sb $t0, 8($v0) # internal_45[0] = ' ' addi $t0, $zero, 105 - sb $t0, 9($v0) # internal_47[1] = 'i' + sb $t0, 9($v0) # internal_45[1] = 'i' addi $t0, $zero, 115 - sb $t0, 10($v0) # internal_47[2] = 's' + sb $t0, 10($v0) # internal_45[2] = 's' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_47[3] = ' ' + sb $t0, 11($v0) # internal_45[3] = ' ' addi $t0, $zero, 112 - sb $t0, 12($v0) # internal_47[4] = 'p' + sb $t0, 12($v0) # internal_45[4] = 'p' addi $t0, $zero, 114 - sb $t0, 13($v0) # internal_47[5] = 'r' + sb $t0, 13($v0) # internal_45[5] = 'r' addi $t0, $zero, 105 - sb $t0, 14($v0) # internal_47[6] = 'i' + sb $t0, 14($v0) # internal_45[6] = 'i' addi $t0, $zero, 109 - sb $t0, 15($v0) # internal_47[7] = 'm' + sb $t0, 15($v0) # internal_45[7] = 'm' addi $t0, $zero, 101 - sb $t0, 16($v0) # internal_47[8] = 'e' + sb $t0, 16($v0) # internal_45[8] = 'e' addi $t0, $zero, 46 - sb $t0, 17($v0) # internal_47[9] = '.' + sb $t0, 17($v0) # internal_45[9] = '.' addi $t0, $zero, 10 - sb $t0, 18($v0) # internal_47[10] = '\n' + sb $t0, 18($v0) # internal_45[10] = '\n' sb $zero, 19($v0) # Null-terminator at the end of the string - sw $v0, 40($sp) # internal_47 = " is prime.\n" + sw $v0, 40($sp) # internal_45 = " is prime.\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 244($sp) + lw $t0, 236($sp) sw $t0, 4($sp) # Storing self - # Argument internal_47 + # Argument internal_45 lw $t0, 52($sp) - sw $t0, 0($sp) # Storing internal_47 + sw $t0, 0($sp) # Storing internal_45 # Calling function function_out_string_at_IO jal function_out_string_at_IO lw $ra, 8($sp) - sw $v1, 48($sp) # internal_48 = result of function_out_string_at_IO + sw $v1, 48($sp) # internal_46 = result of function_out_string_at_IO addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 36($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 80($sp) - j end_assign - not_is_Bool_or_Int: - # internal_37 = internal_48 + # internal_35 = internal_46 lw $t0, 36($sp) sw $t0, 80($sp) - end_assign: - # Jumping to endif_8728017462143 - j endif_8728017462143 + # Jumping to endif_8739917776830 + j endif_8739917776830 - else_8728017462143: + else_8739917776830: # Allocating Int 0 li $v0, 9 @@ -1828,30 +2796,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_49 = address of allocated object Int + sw $v0, 32($sp) # internal_47 = address of allocated object Int - lw $t0, 32($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 80($sp) - j end_assign - not_is_Bool_or_Int: - # internal_37 = internal_49 + # internal_35 = internal_47 lw $t0, 32($sp) sw $t0, 80($sp) - end_assign: - - # Jumping to endif_8728017462143 - j endif_8728017462143 - endif_8728017462143: + # Jumping to endif_8739917776830 + j endif_8739917776830 + endif_8739917776830: # Allocating Bool 0 li $v0, 9 @@ -1863,63 +2817,112 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_51 = address of allocated object Int + sw $v0, 24($sp) # internal_49 = address of allocated object Int # Get attribute stop of self - lw $t0, 232($sp) # Get the address of self + lw $t0, 224($sp) # Get the address of self lw $t1, 20($t0) # Get the attribute 'stop' from the instance - sw $t1, 20($sp) # internal_52 = stop + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8739917761720 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8739917761720 + j object_get_attribute_8739917761720 + int_get_attribute_8739917761720: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_50 = self.stop + j end_get_attribute_8739917761720 + bool_get_attribute_8739917761720: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_50 = self.stop + j end_get_attribute_8739917761720 + object_get_attribute_8739917761720: + sw $t1, 20($sp) # internal_50 = stop + end_get_attribute_8739917761720: # Get attribute testee of self - lw $t0, 232($sp) # Get the address of self + lw $t0, 224($sp) # Get the address of self lw $t1, 12($t0) # Get the attribute 'testee' from the instance - sw $t1, 16($sp) # internal_53 = testee + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8739917761732 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8739917761732 + j object_get_attribute_8739917761732 + int_get_attribute_8739917761732: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_51 = self.testee + j end_get_attribute_8739917761732 + bool_get_attribute_8739917761732: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_51 = self.testee + j end_get_attribute_8739917761732 + object_get_attribute_8739917761732: + sw $t1, 16($sp) # internal_51 = testee + end_get_attribute_8739917761732: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_52 + # Argument internal_50 lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_52 + sw $t0, 4($sp) # Storing internal_50 - # Argument internal_53 + # Argument internal_51 lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_53 + sw $t0, 0($sp) # Storing internal_51 # Calling function function_less_than_or_equal jal function_less_than_or_equal lw $ra, 8($sp) - sw $v1, 24($sp) # internal_54 = result of function_less_than_or_equal + sw $v1, 24($sp) # internal_52 = result of function_less_than_or_equal addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 12($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 24($sp) - j end_assign - not_is_Bool_or_Int: - # internal_51 = internal_54 + # internal_49 = internal_52 lw $t0, 12($sp) sw $t0, 24($sp) - end_assign: - # If internal_51 then goto then_8728017462191 + # If internal_49 then goto then_8739917776878 lw $t0, 24($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8728017462191 + beq $t0, $t1, then_8739917776878 - # Jumping to else_8728017462191 - j else_8728017462191 + # Jumping to else_8739917776878 + j else_8739917776878 - then_8728017462191: + then_8739917776878: # Allocating String li $v0, 9 @@ -1929,60 +2932,47 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 4 + addi $t0, $zero, 13 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 104 - sb $t0, 8($v0) # internal_55[0] = 'h' + sb $t0, 8($v0) # internal_53[0] = 'h' addi $t0, $zero, 97 - sb $t0, 9($v0) # internal_55[1] = 'a' + sb $t0, 9($v0) # internal_53[1] = 'a' addi $t0, $zero, 108 - sb $t0, 10($v0) # internal_55[2] = 'l' + sb $t0, 10($v0) # internal_53[2] = 'l' addi $t0, $zero, 116 - sb $t0, 11($v0) # internal_55[3] = 't' + sb $t0, 11($v0) # internal_53[3] = 't' sb $zero, 12($v0) # Null-terminator at the end of the string - sw $v0, 8($sp) # internal_55 = "halt" + sw $v0, 8($sp) # internal_53 = "halt" # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_55 + # Argument internal_53 lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_55 + sw $t0, 0($sp) # Storing internal_53 # Calling function function_abort_at_Object jal function_abort_at_Object lw $ra, 4($sp) - sw $v1, 12($sp) # internal_56 = result of function_abort_at_Object + sw $v1, 12($sp) # internal_54 = result of function_abort_at_Object addi $sp, $sp, 8 # Freeing space for arguments - lw $t0, 4($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 28($sp) - j end_assign - not_is_Bool_or_Int: - # internal_50 = internal_56 + # internal_48 = internal_54 lw $t0, 4($sp) sw $t0, 28($sp) - end_assign: - # Jumping to endif_8728017462191 - j endif_8728017462191 + # Jumping to endif_8739917776878 + j endif_8739917776878 - else_8728017462191: + else_8739917776878: # Allocating String li $v0, 9 @@ -1992,74 +2982,58 @@ la $t0, type_String sw $t0, 0($v0) # Setting type in the first word of the object - addi $t0, $zero, 8 + addi $t0, $zero, 17 sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 99 - sb $t0, 8($v0) # internal_57[0] = 'c' + sb $t0, 8($v0) # internal_55[0] = 'c' addi $t0, $zero, 111 - sb $t0, 9($v0) # internal_57[1] = 'o' + sb $t0, 9($v0) # internal_55[1] = 'o' addi $t0, $zero, 110 - sb $t0, 10($v0) # internal_57[2] = 'n' + sb $t0, 10($v0) # internal_55[2] = 'n' addi $t0, $zero, 116 - sb $t0, 11($v0) # internal_57[3] = 't' + sb $t0, 11($v0) # internal_55[3] = 't' addi $t0, $zero, 105 - sb $t0, 12($v0) # internal_57[4] = 'i' + sb $t0, 12($v0) # internal_55[4] = 'i' addi $t0, $zero, 110 - sb $t0, 13($v0) # internal_57[5] = 'n' + sb $t0, 13($v0) # internal_55[5] = 'n' addi $t0, $zero, 117 - sb $t0, 14($v0) # internal_57[6] = 'u' + sb $t0, 14($v0) # internal_55[6] = 'u' addi $t0, $zero, 101 - sb $t0, 15($v0) # internal_57[7] = 'e' + sb $t0, 15($v0) # internal_55[7] = 'e' sb $zero, 16($v0) # Null-terminator at the end of the string - sw $v0, 0($sp) # internal_57 = "continue" + sw $v0, 0($sp) # internal_55 = "continue" - lw $t0, 0($sp) - lw $t1, 0($t0) - la $t2, type_Main - la $t3, type_Bool - beq $t1, $t2, is_Bool_or_Int - beq $t1, $t3, is_Bool_or_Int - j not_is_Bool_or_Int - is_Bool_or_Int: - lw $t4, 8($t0) - lw $t5, 28($sp) - j end_assign - not_is_Bool_or_Int: - # internal_50 = internal_57 + # internal_48 = internal_55 lw $t0, 0($sp) sw $t0, 28($sp) - end_assign: - # Jumping to endif_8728017462191 - j endif_8728017462191 + # Jumping to endif_8739917776878 + j endif_8739917776878 - endif_8728017462191: + endif_8739917776878: - # Jumping to while_start_8728017462209 - j while_start_8728017462209 + # Jumping to while_start_8739917777412 + j while_start_8739917777412 - while_end_8728017462209: + while_end_8739917777412: # Set attribute m of self - lw $t0, 232($sp) # $t0 = self - addi $t1, $zero, 0 # $t1 0 - sw $t1, 24($t0) # Set the attribute m of self - + lw $t0, 224($sp) # $t0 = self # Loading return value in $v1 - lw $v1, 232($sp) + lw $v1, 224($sp) # Freeing space for local variables - addi $sp, $sp, 232 + addi $sp, $sp, 224 jr $ra diff --git a/tests/codegen/print-cool.mips b/tests/codegen/print-cool.mips new file mode 100644 index 000000000..742fdbd1f --- /dev/null +++ b/tests/codegen/print-cool.mips @@ -0,0 +1,1612 @@ +.data + type_Object: .word 8 + type_Object_inherits_from: .word 0 + type_Object_attributes: .word 0 + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + type_Object_abort_message: .asciiz "Abort called from class Object\n" + + type_IO: .word 8 + type_IO_inherits_from: .word type_Object + type_IO_attributes: .word 0 + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + type_IO_abort_message: .asciiz "Abort called from class IO\n" + + type_Int: .word 8 + type_Int_inherits_from: .word type_Object + type_Int_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + type_Int_abort_message: .asciiz "Abort called from class Int\n" + + type_String: .word 8 + type_String_inherits_from: .word type_Object + type_String_attributes: .word 0 + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + type_String_abort_message: .asciiz "Abort called from class String\n" + + type_Bool: .word 8 + type_Bool_inherits_from: .word type_Object + type_Bool_attributes: .word 0 + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + type_Bool_abort_message: .asciiz "Abort called from class Bool\n" + + type_Main: .word 8 + type_Main_inherits_from: .word type_IO + type_Main_attributes: .word 0 + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + type_Main_abort_message: .asciiz "Abort called from class Main\n" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_0 = address of allocated object Int + + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_5 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_6 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_7 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_8 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_9 = address of allocated object Int + + # internal_7 = EqualAddress(internal_3, internal_4) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_8 = EqualAddress(internal_3, internal_5) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_9 = EqualAddress(internal_3, internal_6) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_7 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_8 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_9 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 44($sp) + lw $t0, 8($t0) + lw $t1, 40($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 36($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 44($sp) + lw $t1, 40($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 36($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 36($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 36($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_2[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_2 = "\n" + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_type_name_at_Object + jal function_type_name_at_Object + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 12($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) # $t0 = internal_3 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string internal_3 + li $v0, 4 + move $a0, $t0 + syscall + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 12($t1) # $t1 = length of the name of self + la $t3, 16($t1) # $t1 = name of self + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t4, $v0, 0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t3, $t3, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $v0, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the string x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lb $t1, buffer_input($t0) # Loading the byte + beq $t1, $zero, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lb $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + lw $t0, 0($sp) + sw $t1, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 8($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 8($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 + lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) + lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bgt $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 64($sp) + # self = 60($sp) + + # Reserving space for local variables + addi $sp, $sp, -60 + + # Allocating Object + li $v0, 9 + lw $a0, type_Object + syscall + la $t0, type_Object # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 56($sp) # internal_0 = address of allocated object Object + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Object + jal function___init___at_Object + lw $ra, 4($sp) + sw $v1, 64($sp) # internal_0 = result of function___init___at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_type_name_at_Object + jal function_type_name_at_Object + lw $ra, 4($sp) + sw $v1, 60($sp) # internal_1 = result of function_type_name_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_2 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_1 + lw $t0, 68($sp) + sw $t0, 8($sp) # Storing internal_1 + + # Argument internal_2 + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 56($sp) # internal_4 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_4 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_5 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_7 = address of allocated object Int + + # Allocating NUll to internal_6 + sw $zero, 32($sp) # internal_6 = 0 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing self + + # Argument self + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_7 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_7 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_type_name_at_Object + jal function_type_name_at_Object + lw $ra, 4($sp) + sw $v1, 32($sp) # internal_8 = result of function_type_name_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_9 = address of allocated object Int + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_10 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_8 + lw $t0, 40($sp) + sw $t0, 8($sp) # Storing internal_8 + + # Argument internal_9 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_9 + + # Argument internal_10 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_substr_at_String + jal function_substr_at_String + lw $ra, 12($sp) + sw $v1, 28($sp) # internal_11 = result of function_substr_at_String + addi $sp, $sp, 16 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_5 + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing internal_5 + + # Argument internal_11 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_12 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_13[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_13 = "\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_13 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_14 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 60 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_main_at_Main + jal function_main_at_Main + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ 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 000000000..f930284e5 --- /dev/null +++ b/tests/codegen/sort-list.mips @@ -0,0 +1,3745 @@ +.data + type_Object: .word 8 + type_Object_inherits_from: .word 0 + type_Object_attributes: .word 0 + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + type_Object_abort_message: .asciiz "Abort called from class Object\n" + + type_IO: .word 8 + type_IO_inherits_from: .word type_Object + type_IO_attributes: .word 0 + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + type_IO_abort_message: .asciiz "Abort called from class IO\n" + + type_Int: .word 8 + type_Int_inherits_from: .word type_Object + type_Int_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + type_Int_abort_message: .asciiz "Abort called from class Int\n" + + type_String: .word 8 + type_String_inherits_from: .word type_Object + type_String_attributes: .word 0 + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + type_String_abort_message: .asciiz "Abort called from class String\n" + + type_Bool: .word 8 + type_Bool_inherits_from: .word type_Object + type_Bool_attributes: .word 0 + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + type_Bool_abort_message: .asciiz "Abort called from class Bool\n" + + type_List: .word 8 + type_List_inherits_from: .word type_IO + type_List_attributes: .word 0 + type_List_name_size: .word 4 + type_List_name: .asciiz "List" + type_List_abort_message: .asciiz "Abort called from class List\n" + + type_Cons: .word 16 + type_Cons_inherits_from: .word type_List + type_Cons_attributes: .word 2 + type_Cons_name_size: .word 4 + type_Cons_name: .asciiz "Cons" + type_Cons_abort_message: .asciiz "Abort called from class Cons\n" + + type_Nil: .word 8 + type_Nil_inherits_from: .word type_List + type_Nil_attributes: .word 0 + type_Nil_name_size: .word 3 + type_Nil_name: .asciiz "Nil" + type_Nil_abort_message: .asciiz "Abort called from class Nil\n" + + type_Main: .word 12 + type_Main_inherits_from: .word type_IO + type_Main_attributes: .word 1 + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + type_Main_abort_message: .asciiz "Abort called from class Main\n" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_0 = address of allocated object Int + + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_5 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_6 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_7 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_8 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_9 = address of allocated object Int + + # internal_7 = EqualAddress(internal_3, internal_4) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_8 = EqualAddress(internal_3, internal_5) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_9 = EqualAddress(internal_3, internal_6) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_7 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_8 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_9 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 44($sp) + lw $t0, 8($t0) + lw $t1, 40($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 36($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 44($sp) + lw $t1, 40($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 36($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 36($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 36($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_2[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_2 = "\n" + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_type_name_at_Object + jal function_type_name_at_Object + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 12($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_concat_at_String + jal function_concat_at_String + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 0($sp) # $t0 = internal_3 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string internal_3 + li $v0, 4 + move $a0, $t0 + syscall + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 12($t1) # $t1 = length of the name of self + la $t3, 16($t1) # $t1 = name of self + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t4, $v0, 0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t3, $t3, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $v0, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the string x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the string x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lb $t1, buffer_input($t0) # Loading the byte + beq $t1, $zero, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lb $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + lw $t0, 0($sp) + sw $t1, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 8($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 8($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 + lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) + lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bgt $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # self = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # self = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_List: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_isNil_at_List: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_abort_at_Object + jal function_abort_at_Object + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function_abort_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_1 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_cons_at_List: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + # hd = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + # Allocating Cons + li $v0, 9 + lw $a0, type_Cons + syscall + la $t0, type_Cons # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_1 = address of allocated object Cons + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_Cons + jal function___init___at_Cons + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_1 = result of function___init___at_Cons + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument new_cell + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing new_cell + + # Argument internal_1 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 20($sp) # new_cell = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument new_cell + lw $t0, 24($sp) + sw $t0, 8($sp) # Storing new_cell + + # Argument hd + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing hd + + # Argument self + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_init_at_Cons + jal function_init_at_Cons + lw $ra, 12($sp) + sw $v1, 16($sp) # internal_2 = result of function_init_at_Cons + addi $sp, $sp, 16 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + function_car_at_List: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_abort_at_Object + jal function_abort_at_Object + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function_abort_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int + li $v0, 9 + lw $a0, type_Int + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 0($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 8($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_Int + jal function___init___at_Int + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function___init___at_Int + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_cdr_at_List: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_abort_at_Object + jal function_abort_at_Object + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function_abort_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating List + li $v0, 9 + lw $a0, type_List + syscall + la $t0, type_List # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 0($sp) # internal_1 = address of allocated object List + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 8($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_List + jal function___init___at_List + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function___init___at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_rev_at_List: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_cdr_at_List + jal function_cdr_at_List + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_0 = result of function_cdr_at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sort_at_List: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_cdr_at_List + jal function_cdr_at_List + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_0 = result of function_cdr_at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_insert_at_List: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # i = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_cdr_at_List + jal function_cdr_at_List + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_0 = result of function_cdr_at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_rcons_at_List: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # i = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_cdr_at_List + jal function_cdr_at_List + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_0 = result of function_cdr_at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_print_list_at_List: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_abort_at_Object + jal function_abort_at_Object + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_0 = result of function_abort_at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Cons: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_0 = address of allocated object Int + + # Set attribute xcar of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8775953324198 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8775953324198 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8775953324198 + j object_set_attribute_8775953324198 + int_set_attribute_8775953324198: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.xcar = internal_0 + j end_set_attribute_8775953324198 + bool_set_attribute_8775953324198: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.xcar = internal_0 + j end_set_attribute_8775953324198 + object_set_attribute_8775953324198: + sw $t1, 8($t0) # self.xcar = internal_0 + end_set_attribute_8775953324198: + + # Allocating NUll to internal_1 + sw $zero, 0($sp) # internal_1 = 0 + + # Set attribute xcdr of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8775953324219 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8775953324219 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8775953324219 + j object_set_attribute_8775953324219 + int_set_attribute_8775953324219: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.xcdr = internal_1 + j end_set_attribute_8775953324219 + bool_set_attribute_8775953324219: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.xcdr = internal_1 + j end_set_attribute_8775953324219 + object_set_attribute_8775953324219: + sw $t1, 12($t0) # self.xcdr = internal_1 + end_set_attribute_8775953324219: + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_isNil_at_Cons: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_init_at_Cons: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # hd = 4($sp) + # tl = 0($sp) + + # Set attribute xcar of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = hd + beq $t1, $zero, object_set_attribute_8775953325584 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8775953325584 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8775953325584 + j object_set_attribute_8775953325584 + int_set_attribute_8775953325584: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.xcar = hd + j end_set_attribute_8775953325584 + bool_set_attribute_8775953325584: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.xcar = hd + j end_set_attribute_8775953325584 + object_set_attribute_8775953325584: + sw $t1, 8($t0) # self.xcar = hd + end_set_attribute_8775953325584: + + # Set attribute xcdr of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = tl + beq $t1, $zero, object_set_attribute_8775953325593 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8775953325593 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8775953325593 + j object_set_attribute_8775953325593 + int_set_attribute_8775953325593: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.xcdr = tl + j end_set_attribute_8775953325593 + bool_set_attribute_8775953325593: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.xcdr = tl + j end_set_attribute_8775953325593 + object_set_attribute_8775953325593: + sw $t1, 12($t0) # self.xcdr = tl + end_set_attribute_8775953325593: + + # Loading return value in $v1 + lw $v1, 8($sp) + + jr $ra + + function_car_at_Cons: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute xcar of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775953325605 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775953325605 + j object_get_attribute_8775953325605 + int_get_attribute_8775953325605: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.xcar + j end_get_attribute_8775953325605 + bool_get_attribute_8775953325605: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.xcar + j end_get_attribute_8775953325605 + object_get_attribute_8775953325605: + sw $t1, 0($sp) # internal_0 = xcar + end_get_attribute_8775953325605: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_cdr_at_Cons: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute xcdr of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'xcdr' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775953313320 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775953313320 + j object_get_attribute_8775953313320 + int_get_attribute_8775953313320: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.xcdr + j end_get_attribute_8775953313320 + bool_get_attribute_8775953313320: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.xcdr + j end_get_attribute_8775953313320 + object_get_attribute_8775953313320: + sw $t1, 0($sp) # internal_0 = xcdr + end_get_attribute_8775953313320: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_rev_at_Cons: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Get attribute xcdr of self + lw $t0, 16($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'xcdr' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775953311034 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775953311034 + j object_get_attribute_8775953311034 + int_get_attribute_8775953311034: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.xcdr + j end_get_attribute_8775953311034 + bool_get_attribute_8775953311034: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.xcdr + j end_get_attribute_8775953311034 + object_get_attribute_8775953311034: + sw $t1, 12($sp) # internal_0 = xcdr + end_get_attribute_8775953311034: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_rev_at_List + jal function_rev_at_List + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_rev_at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute xcar of self + lw $t0, 16($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775953311037 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775953311037 + j object_get_attribute_8775953311037 + int_get_attribute_8775953311037: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_2 = self.xcar + j end_get_attribute_8775953311037 + bool_get_attribute_8775953311037: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_2 = self.xcar + j end_get_attribute_8775953311037 + object_get_attribute_8775953311037: + sw $t1, 4($sp) # internal_2 = xcar + end_get_attribute_8775953311037: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_rcons_at_List + jal function_rcons_at_List + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_rcons_at_List + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_sort_at_Cons: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Get attribute xcdr of self + lw $t0, 16($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'xcdr' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775953310980 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775953310980 + j object_get_attribute_8775953310980 + int_get_attribute_8775953310980: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.xcdr + j end_get_attribute_8775953310980 + bool_get_attribute_8775953310980: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.xcdr + j end_get_attribute_8775953310980 + object_get_attribute_8775953310980: + sw $t1, 12($sp) # internal_0 = xcdr + end_get_attribute_8775953310980: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_sort_at_List + jal function_sort_at_List + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function_sort_at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute xcar of self + lw $t0, 16($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775953310570 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775953310570 + j object_get_attribute_8775953310570 + int_get_attribute_8775953310570: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_2 = self.xcar + j end_get_attribute_8775953310570 + bool_get_attribute_8775953310570: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_2 = self.xcar + j end_get_attribute_8775953310570 + object_get_attribute_8775953310570: + sw $t1, 4($sp) # internal_2 = xcar + end_get_attribute_8775953310570: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_insert_at_List + jal function_insert_at_List + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_insert_at_List + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_insert_at_Cons: + # Function parameters + # $ra = 52($sp) + # self = 48($sp) + # i = 44($sp) + + # Reserving space for local variables + addi $sp, $sp, -44 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_1 = address of allocated object Int + + # Get attribute xcar of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775953310642 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775953310642 + j object_get_attribute_8775953310642 + int_get_attribute_8775953310642: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_2 = self.xcar + j end_get_attribute_8775953310642 + bool_get_attribute_8775953310642: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_2 = self.xcar + j end_get_attribute_8775953310642 + object_get_attribute_8775953310642: + sw $t1, 32($sp) # internal_2 = xcar + end_get_attribute_8775953310642: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_2 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_3 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_3 + lw $t0, 28($sp) + sw $t0, 36($sp) + + # If internal_1 then goto then_8775953337375 + lw $t0, 36($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8775953337375 + + # Jumping to else_8775953337375 + j else_8775953337375 + + then_8775953337375: + + # Allocating Cons + li $v0, 9 + lw $a0, type_Cons + syscall + la $t0, type_Cons # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 24($sp) # internal_4 = address of allocated object Cons + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_4 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function___init___at_Cons + jal function___init___at_Cons + lw $ra, 4($sp) + sw $v1, 32($sp) # internal_4 = result of function___init___at_Cons + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_4 + lw $t0, 40($sp) + sw $t0, 8($sp) # Storing internal_4 + + # Argument i + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing i + + # Argument self + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_init_at_Cons + jal function_init_at_Cons + lw $ra, 12($sp) + sw $v1, 36($sp) # internal_5 = result of function_init_at_Cons + addi $sp, $sp, 16 # Freeing space for arguments + + # internal_0 = internal_5 + lw $t0, 20($sp) + sw $t0, 40($sp) + + # Jumping to endif_8775953337375 + j endif_8775953337375 + + else_8775953337375: + + # Allocating Cons + li $v0, 9 + lw $a0, type_Cons + syscall + la $t0, type_Cons # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 16($sp) # internal_6 = address of allocated object Cons + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_6 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function___init___at_Cons + jal function___init___at_Cons + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_6 = result of function___init___at_Cons + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute xcar of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775953312010 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775953312010 + j object_get_attribute_8775953312010 + int_get_attribute_8775953312010: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_7 = self.xcar + j end_get_attribute_8775953312010 + bool_get_attribute_8775953312010: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_7 = self.xcar + j end_get_attribute_8775953312010 + object_get_attribute_8775953312010: + sw $t1, 12($sp) # internal_7 = xcar + end_get_attribute_8775953312010: + + # Get attribute xcdr of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'xcdr' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775953309943 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775953309943 + j object_get_attribute_8775953309943 + int_get_attribute_8775953309943: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_8 = self.xcdr + j end_get_attribute_8775953309943 + bool_get_attribute_8775953309943: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_8 = self.xcdr + j end_get_attribute_8775953309943 + object_get_attribute_8775953309943: + sw $t1, 8($sp) # internal_8 = xcdr + end_get_attribute_8775953309943: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_8 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument i + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing i + + # Calling function function_insert_at_List + jal function_insert_at_List + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_9 = result of function_insert_at_List + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_6 + lw $t0, 32($sp) + sw $t0, 8($sp) # Storing internal_6 + + # Argument internal_7 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_7 + + # Argument internal_9 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_init_at_Cons + jal function_init_at_Cons + lw $ra, 12($sp) + sw $v1, 16($sp) # internal_10 = result of function_init_at_Cons + addi $sp, $sp, 16 # Freeing space for arguments + + # internal_0 = internal_10 + lw $t0, 0($sp) + sw $t0, 40($sp) + + # Jumping to endif_8775953337375 + j endif_8775953337375 + + endif_8775953337375: + + # Loading return value in $v1 + lw $v1, 40($sp) + + # Freeing space for local variables + addi $sp, $sp, 44 + + jr $ra + + function_rcons_at_Cons: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + # i = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # Allocating Cons + li $v0, 9 + lw $a0, type_Cons + syscall + la $t0, type_Cons # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 16($sp) # internal_0 = address of allocated object Cons + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Cons + jal function___init___at_Cons + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_0 = result of function___init___at_Cons + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute xcar of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775953325722 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775953325722 + j object_get_attribute_8775953325722 + int_get_attribute_8775953325722: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_1 = self.xcar + j end_get_attribute_8775953325722 + bool_get_attribute_8775953325722: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_1 = self.xcar + j end_get_attribute_8775953325722 + object_get_attribute_8775953325722: + sw $t1, 12($sp) # internal_1 = xcar + end_get_attribute_8775953325722: + + # Get attribute xcdr of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'xcdr' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775953325746 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775953325746 + j object_get_attribute_8775953325746 + int_get_attribute_8775953325746: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_2 = self.xcdr + j end_get_attribute_8775953325746 + bool_get_attribute_8775953325746: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_2 = self.xcdr + j end_get_attribute_8775953325746 + object_get_attribute_8775953325746: + sw $t1, 8($sp) # internal_2 = xcdr + end_get_attribute_8775953325746: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument i + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing i + + # Calling function function_rcons_at_List + jal function_rcons_at_List + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_3 = result of function_rcons_at_List + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 8($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_init_at_Cons + jal function_init_at_Cons + lw $ra, 12($sp) + sw $v1, 16($sp) # internal_4 = result of function_init_at_Cons + addi $sp, $sp, 16 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 20 + + jr $ra + + function_print_list_at_Cons: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Get attribute xcar of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775953293325 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775953293325 + j object_get_attribute_8775953293325 + int_get_attribute_8775953293325: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_0 = self.xcar + j end_get_attribute_8775953293325 + bool_get_attribute_8775953293325: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_0 = self.xcar + j end_get_attribute_8775953293325 + object_get_attribute_8775953293325: + sw $t1, 20($sp) # internal_0 = xcar + end_get_attribute_8775953293325: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_out_int_at_IO + jal function_out_int_at_IO + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_1 = result of function_out_int_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_2[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_2 = "\n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_3 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute xcdr of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'xcdr' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775953293394 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775953293394 + j object_get_attribute_8775953293394 + int_get_attribute_8775953293394: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_4 = self.xcdr + j end_get_attribute_8775953293394 + bool_get_attribute_8775953293394: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_4 = self.xcdr + j end_get_attribute_8775953293394 + object_get_attribute_8775953293394: + sw $t1, 4($sp) # internal_4 = xcdr + end_get_attribute_8775953293394: + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_4 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_print_list_at_List + jal function_print_list_at_List + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_5 = result of function_print_list_at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function___init___at_Nil: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_isNil_at_Nil: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_rev_at_Nil: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_sort_at_Nil: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_insert_at_Nil: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # i = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing self + + # Argument i + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing i + + # Calling function function_rcons_at_Nil + jal function_rcons_at_Nil + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_0 = result of function_rcons_at_Nil + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_rcons_at_Nil: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Cons + li $v0, 9 + lw $a0, type_Cons + syscall + la $t0, type_Cons # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object Cons + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Cons + jal function___init___at_Cons + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_Cons + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 8($sp) # Storing internal_0 + + # Argument i + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing i + + # Argument self + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_init_at_Cons + jal function_init_at_Cons + lw $ra, 12($sp) + sw $v1, 16($sp) # internal_1 = result of function_init_at_Cons + addi $sp, $sp, 16 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_print_list_at_Nil: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating NUll to internal_0 + sw $zero, 0($sp) # internal_0 = 0 + + # Set attribute l of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8775953294198 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8775953294198 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8775953294198 + j object_set_attribute_8775953294198 + int_set_attribute_8775953294198: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.l = internal_0 + j end_set_attribute_8775953294198 + bool_set_attribute_8775953294198: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.l = internal_0 + j end_set_attribute_8775953294198 + object_set_attribute_8775953294198: + sw $t1, 8($t0) # self.l = internal_0 + end_set_attribute_8775953294198: + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_iota_at_Main: + # Function parameters + # $ra = 48($sp) + # self = 44($sp) + # i = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating Nil + li $v0, 9 + lw $a0, type_Nil + syscall + la $t0, type_Nil # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 36($sp) # internal_0 = address of allocated object Nil + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Nil + jal function___init___at_Nil + lw $ra, 4($sp) + sw $v1, 44($sp) # internal_0 = result of function___init___at_Nil + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute l of self + lw $t0, 44($sp) # $t0 = self + lw $t1, 36($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8775953294243 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8775953294243 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8775953294243 + j object_set_attribute_8775953294243 + int_set_attribute_8775953294243: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.l = internal_0 + j end_set_attribute_8775953294243 + bool_set_attribute_8775953294243: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.l = internal_0 + j end_set_attribute_8775953294243 + object_set_attribute_8775953294243: + sw $t1, 8($t0) # self.l = internal_0 + end_set_attribute_8775953294243: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument j + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing j + + # Argument internal_2 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 44($sp) # j = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + while_start_8775953337896: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument j + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing j + + # Argument i + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing i + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_3 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_3 then goto while_body_8775953337896 + lw $t0, 24($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8775953337896 + + # Jumping to while_end_8775953337896 + j while_end_8775953337896 + + while_body_8775953337896: + + # Allocating Cons + li $v0, 9 + lw $a0, type_Cons + syscall + la $t0, type_Cons # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 20($sp) # internal_4 = address of allocated object Cons + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_4 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function___init___at_Cons + jal function___init___at_Cons + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_4 = result of function___init___at_Cons + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute l of self + lw $t0, 44($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'l' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775953325198 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775953325198 + j object_get_attribute_8775953325198 + int_get_attribute_8775953325198: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_5 = self.l + j end_get_attribute_8775953325198 + bool_get_attribute_8775953325198: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_5 = self.l + j end_get_attribute_8775953325198 + object_get_attribute_8775953325198: + sw $t1, 16($sp) # internal_5 = l + end_get_attribute_8775953325198: + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_4 + lw $t0, 36($sp) + sw $t0, 8($sp) # Storing internal_4 + + # Argument j + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing j + + # Argument internal_5 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_init_at_Cons + jal function_init_at_Cons + lw $ra, 12($sp) + sw $v1, 28($sp) # internal_6 = result of function_init_at_Cons + addi $sp, $sp, 16 # Freeing space for arguments + + # Set attribute l of self + lw $t0, 44($sp) # $t0 = self + lw $t1, 12($sp) # $t1 = internal_6 + beq $t1, $zero, object_set_attribute_8775953325147 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8775953325147 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8775953325147 + j object_set_attribute_8775953325147 + int_set_attribute_8775953325147: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.l = internal_6 + j end_set_attribute_8775953325147 + bool_set_attribute_8775953325147: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.l = internal_6 + j end_set_attribute_8775953325147 + object_set_attribute_8775953325147: + sw $t1, 8($t0) # self.l = internal_6 + end_set_attribute_8775953325147: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument j + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing j + + # Argument internal_7 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_8 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument j + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing j + + # Argument internal_8 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 44($sp) # j = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to while_start_8775953337896 + j while_start_8775953337896 + + while_end_8775953337896: + + # Get attribute l of self + lw $t0, 44($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'l' from the instance + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775953294318 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775953294318 + j object_get_attribute_8775953294318 + int_get_attribute_8775953294318: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_9 = self.l + j end_get_attribute_8775953294318 + bool_get_attribute_8775953294318: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_9 = self.l + j end_get_attribute_8775953294318 + object_get_attribute_8775953294318: + sw $t1, 0($sp) # internal_9 = l + end_get_attribute_8775953294318: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 32($sp) + # self = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 35 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 35 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 72 + sb $t0, 8($v0) # internal_0[0] = 'H' + + addi $t0, $zero, 111 + sb $t0, 9($v0) # internal_0[1] = 'o' + + addi $t0, $zero, 119 + sb $t0, 10($v0) # internal_0[2] = 'w' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_0[3] = ' ' + + addi $t0, $zero, 109 + sb $t0, 12($v0) # internal_0[4] = 'm' + + addi $t0, $zero, 97 + sb $t0, 13($v0) # internal_0[5] = 'a' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_0[6] = 'n' + + addi $t0, $zero, 121 + sb $t0, 15($v0) # internal_0[7] = 'y' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_0[8] = ' ' + + addi $t0, $zero, 110 + sb $t0, 17($v0) # internal_0[9] = 'n' + + addi $t0, $zero, 117 + sb $t0, 18($v0) # internal_0[10] = 'u' + + addi $t0, $zero, 109 + sb $t0, 19($v0) # internal_0[11] = 'm' + + addi $t0, $zero, 98 + sb $t0, 20($v0) # internal_0[12] = 'b' + + addi $t0, $zero, 101 + sb $t0, 21($v0) # internal_0[13] = 'e' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 115 + sb $t0, 23($v0) # internal_0[15] = 's' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_0[16] = ' ' + + addi $t0, $zero, 116 + sb $t0, 25($v0) # internal_0[17] = 't' + + addi $t0, $zero, 111 + sb $t0, 26($v0) # internal_0[18] = 'o' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_0[19] = ' ' + + addi $t0, $zero, 115 + sb $t0, 28($v0) # internal_0[20] = 's' + + addi $t0, $zero, 111 + sb $t0, 29($v0) # internal_0[21] = 'o' + + addi $t0, $zero, 114 + sb $t0, 30($v0) # internal_0[22] = 'r' + + addi $t0, $zero, 116 + sb $t0, 31($v0) # internal_0[23] = 't' + + addi $t0, $zero, 63 + sb $t0, 32($v0) # internal_0[24] = '?' + + addi $t0, $zero, 32 + sb $t0, 33($v0) # internal_0[25] = ' ' + + sb $zero, 34($v0) # Null-terminator at the end of the string + + sw $v0, 24($sp) # internal_0 = "How many numbers to sort? " + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_out_string_at_IO + jal function_out_string_at_IO + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_1 = result of function_out_string_at_IO + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_in_int_at_IO + jal function_in_int_at_IO + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_2 = result of function_in_int_at_IO + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_2 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_iota_at_Main + jal function_iota_at_Main + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_3 = result of function_iota_at_Main + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_rev_at_List + jal function_rev_at_List + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_4 = result of function_rev_at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_sort_at_List + jal function_sort_at_List + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_5 = result of function_sort_at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_5 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_print_list_at_List + jal function_print_list_at_List + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_6 = result of function_print_list_at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_main_at_Main + jal function_main_at_Main + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file From 04f803f1460d1b31fdcb92a129bfd91bc2eb5b8f Mon Sep 17 00:00:00 2001 From: Alejandro Klever Date: Sun, 27 Feb 2022 20:57:59 -0500 Subject: [PATCH 143/143] Tests passed. Refactoring process --- src/arith.asm | 18012 ---------------- src/arith.cil | 3715 ---- src/arith.cl | 476 - src/arith_input.txt | 1 - src/arith_output.txt | 19 - src/complex.asm | 2944 --- src/complex.cil | 674 - src/complex.cl | 52 - src/cool/code_generation/ast_cil.py | 16 +- src/cool/code_generation/formatters.py | 12 +- .../code_generation/translator_cil_to_mips.py | 225 +- .../code_generation/translator_cool_to_cil.py | 396 +- src/cool/semantics/type_inference.py | 4 +- src/cool/semantics/utils/scope.py | 2 +- src/fib.asm | 1640 -- src/fib.cil | 460 - src/fib.cl | 25 - src/io.asm | 1230 -- src/io.cil | 371 - src/io.cl | 103 - src/logs.txt | 21 - src/main.asm | 1442 -- src/main.cil | 401 - src/main.cl | 69 - src/primes.asm | 2205 -- src/primes.cil | 623 - src/primes.cl | 86 - src/print-cool.asm | 1612 -- src/print-cool.cil | 435 - src/print-cool.cl | 9 - src/sort-list.asm | 3736 ---- src/sort-list.cil | 940 - src/sort-list.cl | 149 - tests/codegen/arith.mips | 13258 +++++++----- tests/codegen/atoi.mips | 3006 ++- tests/codegen/book_list.mips | 5934 +++++ tests/codegen/cells.mips | 1949 +- tests/codegen/complex.mips | 1260 +- tests/codegen/fib.mips | 613 +- tests/codegen/graph.mips | 6012 ++++-- tests/codegen/hairyscary.mips | 8595 ++++---- tests/codegen/hello_world.mips | 337 +- tests/codegen/io.mips | 871 +- tests/codegen/life.mips | 10681 +++++---- tests/codegen/list.mips | 1438 +- tests/codegen/new_complex.mips | 1793 +- tests/codegen/palindrome.mips | 1220 +- tests/codegen/primes.mips | 1652 +- tests/codegen/print-cool.mips | 613 +- tests/codegen/sort-list.mips | 2369 +- 50 files changed, 40927 insertions(+), 62779 deletions(-) delete mode 100644 src/arith.asm delete mode 100644 src/arith.cil delete mode 100755 src/arith.cl delete mode 100644 src/arith_input.txt delete mode 100644 src/arith_output.txt delete mode 100644 src/complex.asm delete mode 100644 src/complex.cil delete mode 100755 src/complex.cl delete mode 100644 src/fib.asm delete mode 100644 src/fib.cil delete mode 100644 src/fib.cl delete mode 100644 src/io.asm delete mode 100644 src/io.cil delete mode 100755 src/io.cl delete mode 100644 src/logs.txt delete mode 100644 src/main.asm delete mode 100644 src/main.cil delete mode 100644 src/main.cl delete mode 100644 src/primes.asm delete mode 100644 src/primes.cil delete mode 100644 src/primes.cl delete mode 100644 src/print-cool.asm delete mode 100644 src/print-cool.cil delete mode 100644 src/print-cool.cl delete mode 100644 src/sort-list.asm delete mode 100644 src/sort-list.cil delete mode 100644 src/sort-list.cl create mode 100644 tests/codegen/book_list.mips diff --git a/src/arith.asm b/src/arith.asm deleted file mode 100644 index cd4e82cda..000000000 --- a/src/arith.asm +++ /dev/null @@ -1,18012 +0,0 @@ -.data - type_Object: .word 8 - type_Object_inherits_from: .word 0 - type_Object_attributes: .word 0 - type_Object_name_size: .word 6 - type_Object_name: .asciiz "Object" - type_Object_abort_message: .asciiz "Abort called from class Object\n" - - type_IO: .word 8 - type_IO_inherits_from: .word type_Object - type_IO_attributes: .word 0 - type_IO_name_size: .word 2 - type_IO_name: .asciiz "IO" - type_IO_abort_message: .asciiz "Abort called from class IO\n" - - type_Int: .word 8 - type_Int_inherits_from: .word type_Object - type_Int_attributes: .word 0 - type_Int_name_size: .word 3 - type_Int_name: .asciiz "Int" - type_Int_abort_message: .asciiz "Abort called from class Int\n" - - type_String: .word 8 - type_String_inherits_from: .word type_Object - type_String_attributes: .word 0 - type_String_name_size: .word 6 - type_String_name: .asciiz "String" - type_String_abort_message: .asciiz "Abort called from class String\n" - - type_Bool: .word 8 - type_Bool_inherits_from: .word type_Object - type_Bool_attributes: .word 0 - type_Bool_name_size: .word 4 - type_Bool_name: .asciiz "Bool" - type_Bool_abort_message: .asciiz "Abort called from class Bool\n" - - type_A: .word 12 - type_A_inherits_from: .word type_Object - type_A_attributes: .word 1 - type_A_name_size: .word 1 - type_A_name: .asciiz "A" - type_A_abort_message: .asciiz "Abort called from class A\n" - - type_B: .word 12 - type_B_inherits_from: .word type_A - type_B_attributes: .word 1 - type_B_name_size: .word 1 - type_B_name: .asciiz "B" - type_B_abort_message: .asciiz "Abort called from class B\n" - - type_C: .word 12 - type_C_inherits_from: .word type_B - type_C_attributes: .word 1 - type_C_name_size: .word 1 - type_C_name: .asciiz "C" - type_C_abort_message: .asciiz "Abort called from class C\n" - - type_D: .word 12 - type_D_inherits_from: .word type_B - type_D_attributes: .word 1 - type_D_name_size: .word 1 - type_D_name: .asciiz "D" - type_D_abort_message: .asciiz "Abort called from class D\n" - - type_E: .word 12 - type_E_inherits_from: .word type_D - type_E_attributes: .word 1 - type_E_name_size: .word 1 - type_E_name: .asciiz "E" - type_E_abort_message: .asciiz "Abort called from class E\n" - - type_A2I: .word 8 - type_A2I_inherits_from: .word type_Object - type_A2I_attributes: .word 0 - type_A2I_name_size: .word 3 - type_A2I_name: .asciiz "A2I" - type_A2I_abort_message: .asciiz "Abort called from class A2I\n" - - type_Main: .word 24 - type_Main_inherits_from: .word type_IO - type_Main_attributes: .word 4 - type_Main_name_size: .word 4 - type_Main_name: .asciiz "Main" - type_Main_abort_message: .asciiz "Abort called from class Main\n" - - buffer_input: .space 1024 - debug_log: .asciiz "debug_log\n" - -.text - function_add: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Addition operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - add $t2, $t0, $t1 # $t2 = $t0 + $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_sub: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Subtraction operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - sub $t2, $t0, $t1 # $t2 = $t0 - $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_mult: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Multiplication operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - mult $t0, $t1 # $t2 = $t0 * $t1 - mflo $t2 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_div: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Division operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - div $t0, $t1 # $t2 = $t0 / $t1 - mflo $t2 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_xor: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Xor operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_less_than: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Less than operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_less_than_or_equal: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Less than operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_equal: - # Function parameters - # $ra = 48($sp) - # a = 44($sp) - # b = 40($sp) - - # Reserving space for local variables - addi $sp, $sp, -40 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_0 = address of allocated object Int - - # Allocating NUll to internal_1 - sw $zero, 32($sp) # internal_1 = 0 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_2 = address of allocated object Int - - # internal_2 = EqualAddress(a, internal_1) - lw $t0, 44($sp) - lw $t1, 32($sp) - seq $t2, $t0, $t1 - lw $t0, 28($sp) - sw $t2, 8($t0) - - # internal_2 = EqualAddress(b, internal_1) - lw $t0, 40($sp) - lw $t1, 32($sp) - seq $t2, $t0, $t1 - lw $t0, 28($sp) - sw $t2, 8($t0) - - # If internal_2 then goto a_is_type_object - lw $t0, 28($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, a_is_type_object - - # internal_3 = typeof a that is the first word of the object - lw $t0, 44($sp) - lw $t0, 0($t0) - sw $t0, 24($sp) - - # internal_4 = direction of Int - la $t0, type_Int - sw $t0, 20($sp) - - # internal_5 = direction of Bool - la $t0, type_Bool - sw $t0, 16($sp) - - # internal_6 = direction of String - la $t0, type_String - sw $t0, 12($sp) - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_7 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_8 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_9 = address of allocated object Int - - # internal_7 = EqualAddress(internal_3, internal_4) - lw $t0, 24($sp) - lw $t1, 20($sp) - seq $t2, $t0, $t1 - lw $t0, 8($sp) - sw $t2, 8($t0) - - # internal_8 = EqualAddress(internal_3, internal_5) - lw $t0, 24($sp) - lw $t1, 16($sp) - seq $t2, $t0, $t1 - lw $t0, 4($sp) - sw $t2, 8($t0) - - # internal_9 = EqualAddress(internal_3, internal_6) - lw $t0, 24($sp) - lw $t1, 12($sp) - seq $t2, $t0, $t1 - lw $t0, 0($sp) - sw $t2, 8($t0) - - # If internal_7 then goto a_is_type_int_or_bool - lw $t0, 8($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, a_is_type_int_or_bool - - # If internal_8 then goto a_is_type_int_or_bool - lw $t0, 4($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, a_is_type_int_or_bool - - # If internal_9 then goto a_is_type_string - lw $t0, 0($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, a_is_type_string - - # Jumping to a_is_type_object - j a_is_type_object - - a_is_type_int_or_bool: - - # internal_0 = EqualInt(a, b) - lw $t0, 44($sp) - lw $t0, 8($t0) - lw $t1, 40($sp) - lw $t1, 8($t1) - seq $t2, $t0, $t1 - lw $t0, 36($sp) - sw $t2, 8($t0) - - # Jumping to end_of_equal - j end_of_equal - - a_is_type_string: - - # internal_0 = EqualStr(a, b) - lw $t0, 44($sp) - lw $t1, 40($sp) - addi $t0, $t0, 8 - addi $t1, $t1, 8 - - # By default we assume the strings are equals - addi $t4, $zero, 1 - lw $t5, 36($sp) - sw $t4, 8($t5) - - while_compare_strings_start: - lb $t2, 0($t0) - lb $t3, 0($t1) - beq $t2, $t3, while_compare_strings_update - - # The strings are no equals - lw $t5, 36($sp) - sw $zero, 8($t5) - j while_compare_strings_end - - while_compare_strings_update: - addi $t0, $t0, 1 - addi $t1, $t1, 1 - beq $t2, $zero, while_compare_strings_end - beq $t3, $zero, while_compare_strings_end - j while_compare_strings_start - while_compare_strings_end: - - # Jumping to end_of_equal - j end_of_equal - - a_is_type_object: - - # Equal operation - lw $t0, 44($sp) # Save in $t0 the left operand address - lw $t1, 40($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 - - lw $t0, 36($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # Jumping to end_of_equal - j end_of_equal - - end_of_equal: - - # Loading return value in $v1 - lw $v1, 36($sp) - - # Freeing space for local variables - addi $sp, $sp, 40 - - jr $ra - - function_assign: - # Function parameters - # $ra = 36($sp) - # dest = 32($sp) - # source = 28($sp) - - # Reserving space for local variables - addi $sp, $sp, -28 - - # Allocating NUll to internal_0 - sw $zero, 24($sp) # internal_0 = 0 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_1 = address of allocated object Int - - # internal_1 = EqualAddress(source, internal_0) - lw $t0, 28($sp) - lw $t1, 24($sp) - seq $t2, $t0, $t1 - lw $t0, 20($sp) - sw $t2, 8($t0) - - # internal_1 = EqualAddress(dest, internal_0) - lw $t0, 32($sp) - lw $t1, 24($sp) - seq $t2, $t0, $t1 - lw $t0, 20($sp) - sw $t2, 8($t0) - - # If internal_1 then goto source_is_type_object - lw $t0, 20($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, source_is_type_object - - # internal_2 = typeof source that is the first word of the object - lw $t0, 28($sp) - lw $t0, 0($t0) - sw $t0, 16($sp) - - # internal_3 = direction of Int - la $t0, type_Int - sw $t0, 12($sp) - - # internal_4 = direction of Bool - la $t0, type_Bool - sw $t0, 8($sp) - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_5 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_6 = address of allocated object Int - - # internal_5 = EqualAddress(internal_2, internal_3) - lw $t0, 16($sp) - lw $t1, 12($sp) - seq $t2, $t0, $t1 - lw $t0, 4($sp) - sw $t2, 8($t0) - - # internal_6 = EqualAddress(internal_2, internal_4) - lw $t0, 16($sp) - lw $t1, 8($sp) - seq $t2, $t0, $t1 - lw $t0, 0($sp) - sw $t2, 8($t0) - - # If internal_5 then goto source_is_type_int_or_bool - lw $t0, 4($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, source_is_type_int_or_bool - - # If internal_6 then goto source_is_type_int_or_bool - lw $t0, 0($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, source_is_type_int_or_bool - - # Jumping to source_is_type_object - j source_is_type_object - - source_is_type_int_or_bool: - - # dest = source where source is an integer - li $v0, 9 - addi $a0, $zero, 12 - syscall - lw $t0, 28($sp) # Pointer to source - lw $t1, 0($t0) # $t1 = type of source - lw $t2, 8($t0) # $t2 = value of source - sw $t1, 0($v0) # Save type of dest - sw $a0, 4($v0) # Save size of dest - sw $t2, 8($v0) # Save value of dest - sw $v0, 32($sp) - - # Jumping to source_end_of_equal - j source_end_of_equal - - source_is_type_object: - - # dest = source - lw $t0, 28($sp) - sw $t0, 32($sp) - - # Jumping to source_end_of_equal - j source_end_of_equal - - source_end_of_equal: - - # Loading return value in $v1 - lw $v1, 32($sp) - - # Freeing space for local variables - addi $sp, $sp, 28 - - jr $ra - - function___init___at_Object: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_abort_at_Object: - # Function parameters - # $ra = 20($sp) - # self = 16($sp) - - # Reserving space for local variables - addi $sp, $sp, -16 - - # Allocating String - li $v0, 9 - addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 33 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 65 - sb $t0, 8($v0) # internal_0[0] = 'A' - - addi $t0, $zero, 98 - sb $t0, 9($v0) # internal_0[1] = 'b' - - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_0[2] = 'o' - - addi $t0, $zero, 114 - sb $t0, 11($v0) # internal_0[3] = 'r' - - addi $t0, $zero, 116 - sb $t0, 12($v0) # internal_0[4] = 't' - - addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_0[5] = ' ' - - addi $t0, $zero, 99 - sb $t0, 14($v0) # internal_0[6] = 'c' - - addi $t0, $zero, 97 - sb $t0, 15($v0) # internal_0[7] = 'a' - - addi $t0, $zero, 108 - sb $t0, 16($v0) # internal_0[8] = 'l' - - addi $t0, $zero, 108 - sb $t0, 17($v0) # internal_0[9] = 'l' - - addi $t0, $zero, 101 - sb $t0, 18($v0) # internal_0[10] = 'e' - - addi $t0, $zero, 100 - sb $t0, 19($v0) # internal_0[11] = 'd' - - addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_0[12] = ' ' - - addi $t0, $zero, 102 - sb $t0, 21($v0) # internal_0[13] = 'f' - - addi $t0, $zero, 114 - sb $t0, 22($v0) # internal_0[14] = 'r' - - addi $t0, $zero, 111 - sb $t0, 23($v0) # internal_0[15] = 'o' - - addi $t0, $zero, 109 - sb $t0, 24($v0) # internal_0[16] = 'm' - - addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_0[17] = ' ' - - addi $t0, $zero, 99 - sb $t0, 26($v0) # internal_0[18] = 'c' - - addi $t0, $zero, 108 - sb $t0, 27($v0) # internal_0[19] = 'l' - - addi $t0, $zero, 97 - sb $t0, 28($v0) # internal_0[20] = 'a' - - addi $t0, $zero, 115 - sb $t0, 29($v0) # internal_0[21] = 's' - - addi $t0, $zero, 115 - sb $t0, 30($v0) # internal_0[22] = 's' - - addi $t0, $zero, 32 - sb $t0, 31($v0) # internal_0[23] = ' ' - - sb $zero, 32($v0) # Null-terminator at the end of the string - - sw $v0, 12($sp) # internal_0 = "Abort called from class " - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_2[0] = '\n' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 4($sp) # internal_2 = "\n" - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument self - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_type_name_at_Object - jal function_type_name_at_Object - lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_0 - lw $t0, 24($sp) - sw $t0, 4($sp) # Storing internal_0 - - # Argument internal_1 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function_concat_at_String - jal function_concat_at_String - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_3 - lw $t0, 12($sp) - sw $t0, 4($sp) # Storing internal_3 - - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_concat_at_String - jal function_concat_at_String - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String - addi $sp, $sp, 12 # Freeing space for arguments - - lw $t0, 0($sp) # $t0 = internal_3 - addi $t0, $t0, 8 # Pointer to the first character of the string - - # Printing the string internal_3 - li $v0, 4 - move $a0, $t0 - syscall - - # Exit program - li $v0, 10 - syscall - - # Loading return value in $v1 - lw $v1, 16($sp) - - # Freeing space for local variables - addi $sp, $sp, 16 - - jr $ra - - function_type_name_at_Object: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = name of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($t0) # $t1 = type of self - lw $t2, 12($t1) # $t1 = length of the name of self - la $t3, 16($t1) # $t1 = name of self - - addi $t2, $t2, 9 # Setting space for the type, the size and the null byte - li $v0, 9 - move $a0, $t2 - syscall - addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte - - la $t4, type_String - sw $t4, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - - addi $t4, $v0, 0 # $t4 = direction of the new string - addi $t4, $t4, 8 # Pointer to the first character of the string - xor $t5, $t5, $t5 # Initializing counter - while_copy_name_start: - beq $t5, $t2, while_copy_name_end - lb $t6, 0($t3) # Loading the character - sb $t6, 0($t4) - addi $t4, $t4, 1 # Incrementing the pointer to the new string - addi $t3, $t3, 1 # Incrementing the pointer to the string in self - addi $t5, $t5, 1 # Incrementing counter - j while_copy_name_start - while_copy_name_end: - - sb $zero, 0($t4) # Setting the null byte - - sw $v0, 0($sp) # Storing the new string in internal_0 - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_copy_at_Object: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = copy of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($t0) # $t1 = type of self - lw $t2, 4($t0) # $t2 = length of self in bytes - - # Allocating space for the new object - li $v0, 9 - move $a0, $t2 - syscall - move $t3, $v0 # $t3 = direction of the new object - sw $t1, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - - # Initializing the variable of the loop - addi $t0, $t0, 8 # Pointer to the first character of the object - addi $t3, $t3, 8 # Pointer to the first character of the object - addi $t2, $2, -8 # Decrementing in 8 the length of the object - xor $t4, $t4, $t4 # Initializing counter - - # Loop copying the object - while_copy_start: - beq $t4, $t2, while_copy_end - lb $t5, 0($t0) # Loading the byte - sb $t5, 0($t3) # Storing the byte - addi $t0, $t0, 1 # Incrementing the pointer to the object - addi $t3, $t3, 1 # Incrementing the pointer to the new object - addi $t4, $t4, 1 # Incrementing counter - j while_copy_start - while_copy_end: - sw $v0, 0($sp) # Storing the new object in internal_0 - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function___init___at_IO: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_out_string_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - # x = 0($sp) - - lw $t0, 0($sp) # $t0 = x - addi $t0, $t0, 8 # Pointer to the first character of the string - - # Printing the string x - li $v0, 4 - move $a0, $t0 - syscall - - # Loading return value in $v1 - lw $v1, 4($sp) - - jr $ra - - function_out_int_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - # x = 0($sp) - - # Printing the string x - li $v0, 1 - lw $a0, 0($sp) - lw $a0, 8($a0) - syscall - - # Loading return value in $v1 - lw $v1, 4($sp) - - jr $ra - - function_in_string_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - li $v0, 8 - la $a0, buffer_input - li $a1, 1024 - syscall - - xor $t0, $t0, $t0 # Initializing counter - while_read_start: - lb $t1, buffer_input($t0) # Loading the byte - beq $t1, $zero, while_read_end - addi $t0, $t0, 1 # Incrementing counter - j while_read_start - while_read_end: - addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' - - addi $t0, $t0, 9 # Adding space for the type, the size and the null byte - li $v0, 9 - move $a0, $t0 - syscall - addi $t0, $t0, -9 # Adding space for the type, the size and the null byte - la $t2, type_String - sw $t2, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - - addi $t3, $v0, 8 # Pointer to the first character of the string - xor $t4, $t4, $t4 # Initializing counter - - while_copy_from_buffer_start: - beq $t4, $t0, while_copy_from_buffer_end - lb $t5, buffer_input($t4) # Loading the byte - sb $t5, 0($t3) # Storing the byte - addi $t3, $t3, 1 # Imcremeenting pointer - addi $t4, $t4, 1 # Incrementing counter - j while_copy_from_buffer_start - while_copy_from_buffer_end: - - sb $zero, 0($t3) # Storing the null byte - - sw $v0, 0($sp) # Storing the new object in internal_0 - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_in_int_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - li $v0, 5 - syscall - lw $t0, 0($sp) - sw $v0, 8($t0) - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function___init___at_String: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_length_at_String: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # internal_0 = length of self - lw $t0, 4($sp) - lw $t1, 4($t0) - addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator - lw $t0, 0($sp) - sw $t1, 8($t0) - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_concat_at_String: - # Function parameters - # $ra = 12($sp) - # self = 8($sp) - # s = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = self + s - lw $t0, 8($sp) - lw $t1, 4($sp) - lw $t2, 4($t0) # $t2 = length of str1 - lw $t3, 4($t1) # $t3 = length of str2 - addi $t2, $t2, -9 - addi $t3, $t3, -9 - add $t4, $t2, $t3 # $t4 = length of str1 + str2 - addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) - - li $v0, 9 - move $a0, $t4 - syscall - addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 - add $t5, $zero, $v0 # $t5 = address of the new string object - addi $t5, $t5, 8 # $t5 = address of the first byte of the new string - - la $t8, type_String - sw $t8, 0($v0) # Setting type in the first word of th object - - sw $a0, 4($v0) # Setting length of the string in the second word of the object - - # Copying str1 to the new string - xor $t6, $t6, $t6 # $t6 = 0 Initializing counter - while_copy_str1_start: - beq $t6, $t2, while_copy_str1_end - lb $t7, 8($t0) - sb $t7, 0($t5) - add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_str1_start - while_copy_str1_end: - - # Copying str2 to the new string - while_copy_str2_start: - beq $t6, $t4, while_copy_str2_end - lb $t7, 8($t1) - sb $t7, 0($t5) - add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_str2_start - while_copy_str2_end: - - sb $zero, 0($t5) # Setting the null-terminator - - sw $v0, 0($sp) # internal_0 = self + s - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_substr_at_String: - # Function parameters - # $ra = 16($sp) - # self = 12($sp) - # i = 8($sp) - # l = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = self[i:i + l] - lw $t0, 12($sp) # $t0 = address of the string - lw $t1, 4($t0) # $t1 = length of the string - addi $t1, $t1, -9 # $t1 = length of the string + 9 - lw $t2, 8($sp) # $t2 = start of the substring - lw $t2, 8($t2) - lw $t3, 4($sp) # $t3 = length of the substring - lw $t3, 8($t3) - add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring - - bgt $t4, $t1, substring_out_of_bounds - - addi $t3, $t3, 9 - li $v0, 9 - move $a0, $t3 - syscall - addi $t3, $t3, -9 - - la $t5, type_String - sw $t5, 0($v0) # Setting type in the first word of the object - - sw $a0, 4($v0) # Setting length in the second word of the object - - addi $t0, $t0, 8 # pointing to the first byte of the string - add $t0, $t0, $t2 # pointing to the first byte of the substring - move $t5, $v0 # $t5 = address of the new string - add $t5, $t5, 8 # pointing to the first byte of the string - xor $t6, $t6, $t6 # $t6 = 0 Initializing counter - while_copy_substr_start: - beq $t6, $t3, while_copy_substr_end - lb $t7, 0($t0) - sb $t7, 0($t5) - addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_substr_start - while_copy_substr_end: - - sb $zero, 0($t5) # Setting the null-terminator - - sw $v0, 0($sp) # internal_0 = self[i:i + l] - j substring_not_out_of_bounds - - substring_out_of_bounds: - li $v0, 17 - addi $a0, $zero, 1 - syscall - - substring_not_out_of_bounds: - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function___init___at_A: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Set attribute var of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8781702292580 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8781702292580 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8781702292580 - j object_set_attribute_8781702292580 - int_set_attribute_8781702292580: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.var = internal_0 - j end_set_attribute_8781702292580 - bool_set_attribute_8781702292580: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.var = internal_0 - j end_set_attribute_8781702292580 - object_set_attribute_8781702292580: - sw $t1, 8($t0) # self.var = internal_0 - end_set_attribute_8781702292580: - - # Loading return value in $v1 - lw $v1, 4($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_value_at_A: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Get attribute var of self - lw $t0, 4($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'var' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702292604 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702292604 - j object_get_attribute_8781702292604 - int_get_attribute_8781702292604: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 0($sp) # internal_0 = self.var - j end_get_attribute_8781702292604 - bool_get_attribute_8781702292604: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 0($sp) # internal_0 = self.var - j end_get_attribute_8781702292604 - object_get_attribute_8781702292604: - sw $t1, 0($sp) # internal_0 = var - end_get_attribute_8781702292604: - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_set_var_at_A: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - # num = 0($sp) - - # Set attribute var of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = num - beq $t1, $zero, object_set_attribute_8781702292655 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8781702292655 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8781702292655 - j object_set_attribute_8781702292655 - int_set_attribute_8781702292655: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.var = num - j end_set_attribute_8781702292655 - bool_set_attribute_8781702292655: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.var = num - j end_set_attribute_8781702292655 - object_set_attribute_8781702292655: - sw $t1, 8($t0) # self.var = num - end_set_attribute_8781702292655: - - # Loading return value in $v1 - lw $v1, 4($sp) - - jr $ra - - function_method1_at_A: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - # num = 0($sp) - - # Loading return value in $v1 - lw $v1, 4($sp) - - jr $ra - - function_method2_at_A: - # Function parameters - # $ra = 28($sp) - # self = 24($sp) - # num1 = 20($sp) - # num2 = 16($sp) - - # Reserving space for local variables - addi $sp, $sp, -16 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # x = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument num1 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing num1 - - # Argument num2 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing num2 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_1 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument x - lw $t0, 24($sp) - sw $t0, 4($sp) # Storing x - - # Argument internal_1 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 24($sp) # x = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating B - li $v0, 9 - lw $a0, type_B - syscall - la $t0, type_B # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_2 = address of allocated object B - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_2 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function___init___at_B - jal function___init___at_B - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_2 = result of function___init___at_B - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_2 - - # Argument x - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing x - - # Calling function function_set_var_at_A - jal function_set_var_at_A - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_set_var_at_A - addi $sp, $sp, 12 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 16 - - jr $ra - - function_method3_at_A: - # Function parameters - # $ra = 32($sp) - # self = 28($sp) - # num = 24($sp) - - # Reserving space for local variables - addi $sp, $sp, -24 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # x = address of allocated object Int - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_1 = address of allocated object Int - - # Allocating Int 4294967295 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 4294967295 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_2 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_3 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument num - lw $t0, 36($sp) - sw $t0, 4($sp) # Storing num - - # Argument internal_2 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_xor - jal function_xor - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_3 = result of function_xor - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_3 - lw $t0, 20($sp) - sw $t0, 4($sp) # Storing internal_3 - - # Argument internal_1 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_3 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument x - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing x - - # Argument internal_3 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_3 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 32($sp) # x = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating C - li $v0, 9 - lw $a0, type_C - syscall - la $t0, type_C # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_4 = address of allocated object C - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_4 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_4 - - # Calling function function___init___at_C - jal function___init___at_C - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_4 = result of function___init___at_C - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_4 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_4 - - # Argument x - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing x - - # Calling function function_set_var_at_A - jal function_set_var_at_A - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_5 = result of function_set_var_at_A - addi $sp, $sp, 12 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 24 - - jr $ra - - function_method4_at_A: - # Function parameters - # $ra = 56($sp) - # self = 52($sp) - # num1 = 48($sp) - # num2 = 44($sp) - - # Reserving space for local variables - addi $sp, $sp, -44 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_1 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument num2 - lw $t0, 56($sp) - sw $t0, 4($sp) # Storing num2 - - # Argument num1 - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing num1 - - # Calling function function_less_than - jal function_less_than - lw $ra, 8($sp) - sw $v1, 44($sp) # internal_2 = result of function_less_than - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_1 = internal_2 - lw $t0, 32($sp) - sw $t0, 36($sp) - - # If internal_1 then goto then_8781702322008 - lw $t0, 36($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702322008 - - # Jumping to else_8781702322008 - j else_8781702322008 - - then_8781702322008: - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # x = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument num1 - lw $t0, 60($sp) - sw $t0, 4($sp) # Storing num1 - - # Argument num2 - lw $t0, 56($sp) - sw $t0, 0($sp) # Storing num2 - - # Calling function function_sub - jal function_sub - lw $ra, 8($sp) - sw $v1, 36($sp) # internal_4 = result of function_sub - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument x - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing x - - # Argument internal_4 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_4 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 40($sp) # x = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating D - li $v0, 9 - lw $a0, type_D - syscall - la $t0, type_D # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 20($sp) # internal_5 = address of allocated object D - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_5 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_5 - - # Calling function function___init___at_D - jal function___init___at_D - lw $ra, 4($sp) - sw $v1, 28($sp) # internal_5 = result of function___init___at_D - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_5 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_5 - - # Argument x - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing x - - # Calling function function_set_var_at_A - jal function_set_var_at_A - lw $ra, 8($sp) - sw $v1, 28($sp) # internal_6 = result of function_set_var_at_A - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_0 = internal_6 - lw $t0, 16($sp) - sw $t0, 40($sp) - - # Jumping to endif_8781702322008 - j endif_8781702322008 - - else_8781702322008: - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # x = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument num2 - lw $t0, 56($sp) - sw $t0, 4($sp) # Storing num2 - - # Argument num1 - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing num1 - - # Calling function function_sub - jal function_sub - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_8 = result of function_sub - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument x - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing x - - # Argument internal_8 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_8 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 40($sp) # x = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating D - li $v0, 9 - lw $a0, type_D - syscall - la $t0, type_D # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_9 = address of allocated object D - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_9 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_9 - - # Calling function function___init___at_D - jal function___init___at_D - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_9 = result of function___init___at_D - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_9 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_9 - - # Argument x - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing x - - # Calling function function_set_var_at_A - jal function_set_var_at_A - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_10 = result of function_set_var_at_A - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_0 = internal_10 - lw $t0, 0($sp) - sw $t0, 40($sp) - - # Jumping to endif_8781702322008 - j endif_8781702322008 - - endif_8781702322008: - - # Loading return value in $v1 - lw $v1, 40($sp) - - # Freeing space for local variables - addi $sp, $sp, 44 - - jr $ra - - function_method5_at_A: - # Function parameters - # $ra = 48($sp) - # self = 44($sp) - # num = 40($sp) - - # Reserving space for local variables - addi $sp, $sp, -40 - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_1 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument x - lw $t0, 48($sp) - sw $t0, 4($sp) # Storing x - - # Argument internal_1 - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 48($sp) # x = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_3 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument y - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing y - - # Argument internal_3 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_3 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 40($sp) # y = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - while_start_8781702322092: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument y - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing y - - # Argument num - lw $t0, 52($sp) - sw $t0, 0($sp) # Storing num - - # Calling function function_less_than_or_equal - jal function_less_than_or_equal - lw $ra, 8($sp) - sw $v1, 32($sp) # internal_4 = result of function_less_than_or_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # If internal_4 then goto while_body_8781702322092 - lw $t0, 20($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8781702322092 - - # Jumping to while_end_8781702322092 - j while_end_8781702322092 - - while_body_8781702322092: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument x - lw $t0, 48($sp) - sw $t0, 4($sp) # Storing x - - # Argument y - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing y - - # Calling function function_mult - jal function_mult - lw $ra, 8($sp) - sw $v1, 28($sp) # internal_5 = result of function_mult - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument x - lw $t0, 48($sp) - sw $t0, 4($sp) # Storing x - - # Argument internal_5 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_5 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 48($sp) # x = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_6 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument y - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing y - - # Argument internal_6 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_6 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_7 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument y - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing y - - # Argument internal_7 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_7 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 40($sp) # y = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Jumping to while_start_8781702322092 - j while_start_8781702322092 - - while_end_8781702322092: - - # Allocating E - li $v0, 9 - lw $a0, type_E - syscall - la $t0, type_E # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_8 = address of allocated object E - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_8 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_8 - - # Calling function function___init___at_E - jal function___init___at_E - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_8 = result of function___init___at_E - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_8 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_8 - - # Argument x - lw $t0, 48($sp) - sw $t0, 0($sp) # Storing x - - # Calling function function_set_var_at_A - jal function_set_var_at_A - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_9 = result of function_set_var_at_A - addi $sp, $sp, 12 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 40 - - jr $ra - - function___init___at_B: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Set attribute var of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8781702264089 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8781702264089 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8781702264089 - j object_set_attribute_8781702264089 - int_set_attribute_8781702264089: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.var = internal_0 - j end_set_attribute_8781702264089 - bool_set_attribute_8781702264089: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.var = internal_0 - j end_set_attribute_8781702264089 - object_set_attribute_8781702264089: - sw $t1, 8($t0) # self.var = internal_0 - end_set_attribute_8781702264089: - - # Loading return value in $v1 - lw $v1, 4($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_method5_at_B: - # Function parameters - # $ra = 24($sp) - # self = 20($sp) - # num = 16($sp) - - # Reserving space for local variables - addi $sp, $sp, -16 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # x = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument num - lw $t0, 28($sp) - sw $t0, 4($sp) # Storing num - - # Argument num - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing num - - # Calling function function_mult - jal function_mult - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_1 = result of function_mult - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument x - lw $t0, 24($sp) - sw $t0, 4($sp) # Storing x - - # Argument internal_1 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 24($sp) # x = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating E - li $v0, 9 - lw $a0, type_E - syscall - la $t0, type_E # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_2 = address of allocated object E - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_2 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function___init___at_E - jal function___init___at_E - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_2 = result of function___init___at_E - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_2 - - # Argument x - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing x - - # Calling function function_set_var_at_A - jal function_set_var_at_A - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_set_var_at_A - addi $sp, $sp, 12 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 16 - - jr $ra - - function___init___at_C: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Set attribute var of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8781702264272 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8781702264272 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8781702264272 - j object_set_attribute_8781702264272 - int_set_attribute_8781702264272: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.var = internal_0 - j end_set_attribute_8781702264272 - bool_set_attribute_8781702264272: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.var = internal_0 - j end_set_attribute_8781702264272 - object_set_attribute_8781702264272: - sw $t1, 8($t0) # self.var = internal_0 - end_set_attribute_8781702264272: - - # Loading return value in $v1 - lw $v1, 4($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_method6_at_C: - # Function parameters - # $ra = 32($sp) - # self = 28($sp) - # num = 24($sp) - - # Reserving space for local variables - addi $sp, $sp, -24 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # x = address of allocated object Int - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_1 = address of allocated object Int - - # Allocating Int 4294967295 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 4294967295 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_2 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_3 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument num - lw $t0, 36($sp) - sw $t0, 4($sp) # Storing num - - # Argument internal_2 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_xor - jal function_xor - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_3 = result of function_xor - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_3 - lw $t0, 20($sp) - sw $t0, 4($sp) # Storing internal_3 - - # Argument internal_1 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_3 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument x - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing x - - # Argument internal_3 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_3 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 32($sp) # x = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating A - li $v0, 9 - lw $a0, type_A - syscall - la $t0, type_A # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_4 = address of allocated object A - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_4 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_4 - - # Calling function function___init___at_A - jal function___init___at_A - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_4 = result of function___init___at_A - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_4 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_4 - - # Argument x - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing x - - # Calling function function_set_var_at_A - jal function_set_var_at_A - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_5 = result of function_set_var_at_A - addi $sp, $sp, 12 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 24 - - jr $ra - - function_method5_at_C: - # Function parameters - # $ra = 28($sp) - # self = 24($sp) - # num = 20($sp) - - # Reserving space for local variables - addi $sp, $sp, -20 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # x = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument num - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing num - - # Argument num - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing num - - # Calling function function_mult - jal function_mult - lw $ra, 8($sp) - sw $v1, 24($sp) # internal_1 = result of function_mult - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_1 - lw $t0, 24($sp) - sw $t0, 4($sp) # Storing internal_1 - - # Argument num - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing num - - # Calling function function_mult - jal function_mult - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_2 = result of function_mult - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument x - lw $t0, 28($sp) - sw $t0, 4($sp) # Storing x - - # Argument internal_2 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 28($sp) # x = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating E - li $v0, 9 - lw $a0, type_E - syscall - la $t0, type_E # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_3 = address of allocated object E - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_3 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_3 - - # Calling function function___init___at_E - jal function___init___at_E - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_3 = result of function___init___at_E - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_3 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_3 - - # Argument x - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing x - - # Calling function function_set_var_at_A - jal function_set_var_at_A - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_4 = result of function_set_var_at_A - addi $sp, $sp, 12 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 20 - - jr $ra - - function___init___at_D: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Set attribute var of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8781702265441 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8781702265441 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8781702265441 - j object_set_attribute_8781702265441 - int_set_attribute_8781702265441: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.var = internal_0 - j end_set_attribute_8781702265441 - bool_set_attribute_8781702265441: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.var = internal_0 - j end_set_attribute_8781702265441 - object_set_attribute_8781702265441: - sw $t1, 8($t0) # self.var = internal_0 - end_set_attribute_8781702265441: - - # Loading return value in $v1 - lw $v1, 4($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_method7_at_D: - # Function parameters - # $ra = 116($sp) - # self = 112($sp) - # num = 108($sp) - - # Reserving space for local variables - addi $sp, $sp, -108 - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument x - lw $t0, 116($sp) - sw $t0, 4($sp) # Storing x - - # Argument num - lw $t0, 120($sp) - sw $t0, 0($sp) # Storing num - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 116($sp) # x = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 96($sp) # internal_2 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 92($sp) # internal_3 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument x - lw $t0, 116($sp) - sw $t0, 4($sp) # Storing x - - # Argument internal_3 - lw $t0, 104($sp) - sw $t0, 0($sp) # Storing internal_3 - - # Calling function function_less_than - jal function_less_than - lw $ra, 8($sp) - sw $v1, 100($sp) # internal_4 = result of function_less_than - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_2 = internal_4 - lw $t0, 88($sp) - sw $t0, 96($sp) - - # If internal_2 then goto then_8781702323502 - lw $t0, 96($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702323502 - - # Jumping to else_8781702323502 - j else_8781702323502 - - then_8781702323502: - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 84($sp) # internal_5 = address of allocated object Int - - # Allocating Int 4294967295 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 4294967295 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # internal_6 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 76($sp) # internal_7 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument x - lw $t0, 116($sp) - sw $t0, 4($sp) # Storing x - - # Argument internal_6 - lw $t0, 92($sp) - sw $t0, 0($sp) # Storing internal_6 - - # Calling function function_xor - jal function_xor - lw $ra, 8($sp) - sw $v1, 88($sp) # internal_7 = result of function_xor - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_7 - lw $t0, 88($sp) - sw $t0, 4($sp) # Storing internal_7 - - # Argument internal_5 - lw $t0, 96($sp) - sw $t0, 0($sp) # Storing internal_5 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 88($sp) # internal_7 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 124($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_7 - lw $t0, 88($sp) - sw $t0, 0($sp) # Storing internal_7 - - # Calling function function_method7_at_D - jal function_method7_at_D - lw $ra, 8($sp) - sw $v1, 84($sp) # internal_8 = result of function_method7_at_D - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_1 = internal_8 - lw $t0, 72($sp) - sw $t0, 100($sp) - - # Jumping to endif_8781702323502 - j endif_8781702323502 - - else_8781702323502: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 64($sp) # internal_10 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_11 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_11 - lw $t0, 72($sp) - sw $t0, 4($sp) # Storing internal_11 - - # Argument x - lw $t0, 116($sp) - sw $t0, 0($sp) # Storing x - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 68($sp) # internal_12 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_10 = internal_12 - lw $t0, 56($sp) - sw $t0, 64($sp) - - # If internal_10 then goto then_8781702323481 - lw $t0, 64($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702323481 - - # Jumping to else_8781702323481 - j else_8781702323481 - - then_8781702323481: - - # Allocating Bool 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 52($sp) # internal_13 = address of allocated object Int - - # internal_9 = internal_13 - lw $t0, 52($sp) - sw $t0, 68($sp) - - # Jumping to endif_8781702323481 - j endif_8781702323481 - - else_8781702323481: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_15 = address of allocated object Int - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_16 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_16 - lw $t0, 52($sp) - sw $t0, 4($sp) # Storing internal_16 - - # Argument x - lw $t0, 116($sp) - sw $t0, 0($sp) # Storing x - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 48($sp) # internal_17 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_15 = internal_17 - lw $t0, 36($sp) - sw $t0, 44($sp) - - # If internal_15 then goto then_8781702323484 - lw $t0, 44($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702323484 - - # Jumping to else_8781702323484 - j else_8781702323484 - - then_8781702323484: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_18 = address of allocated object Int - - # internal_14 = internal_18 - lw $t0, 32($sp) - sw $t0, 48($sp) - - # Jumping to endif_8781702323484 - j endif_8781702323484 - - else_8781702323484: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_20 = address of allocated object Int - - # Allocating Int 2 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 2 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_21 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_21 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_21 - - # Argument x - lw $t0, 116($sp) - sw $t0, 0($sp) # Storing x - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 28($sp) # internal_22 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_20 = internal_22 - lw $t0, 16($sp) - sw $t0, 24($sp) - - # If internal_20 then goto then_8781702323490 - lw $t0, 24($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702323490 - - # Jumping to else_8781702323490 - j else_8781702323490 - - then_8781702323490: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_23 = address of allocated object Int - - # internal_19 = internal_23 - lw $t0, 12($sp) - sw $t0, 28($sp) - - # Jumping to endif_8781702323490 - j endif_8781702323490 - - else_8781702323490: - - # Allocating Int 3 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 3 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_24 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument x - lw $t0, 116($sp) - sw $t0, 4($sp) # Storing x - - # Argument internal_24 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_24 - - # Calling function function_sub - jal function_sub - lw $ra, 8($sp) - sw $v1, 16($sp) # internal_25 = result of function_sub - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 124($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_25 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_25 - - # Calling function function_method7_at_D - jal function_method7_at_D - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_26 = result of function_method7_at_D - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_19 = internal_26 - lw $t0, 0($sp) - sw $t0, 28($sp) - - # Jumping to endif_8781702323490 - j endif_8781702323490 - - endif_8781702323490: - - # internal_14 = internal_19 - lw $t0, 28($sp) - sw $t0, 48($sp) - - # Jumping to endif_8781702323484 - j endif_8781702323484 - - endif_8781702323484: - - # internal_9 = internal_14 - lw $t0, 48($sp) - sw $t0, 68($sp) - - # Jumping to endif_8781702323481 - j endif_8781702323481 - - endif_8781702323481: - - # internal_1 = internal_9 - lw $t0, 68($sp) - sw $t0, 100($sp) - - # Jumping to endif_8781702323502 - j endif_8781702323502 - - endif_8781702323502: - - # Loading return value in $v1 - lw $v1, 100($sp) - - # Freeing space for local variables - addi $sp, $sp, 108 - - jr $ra - - function___init___at_E: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Set attribute var of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8781702267046 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8781702267046 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8781702267046 - j object_set_attribute_8781702267046 - int_set_attribute_8781702267046: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.var = internal_0 - j end_set_attribute_8781702267046 - bool_set_attribute_8781702267046: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.var = internal_0 - j end_set_attribute_8781702267046 - object_set_attribute_8781702267046: - sw $t1, 8($t0) # self.var = internal_0 - end_set_attribute_8781702267046: - - # Loading return value in $v1 - lw $v1, 4($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_method6_at_E: - # Function parameters - # $ra = 28($sp) - # self = 24($sp) - # num = 20($sp) - - # Reserving space for local variables - addi $sp, $sp, -20 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # x = address of allocated object Int - - # Allocating Int 8 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 8 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_1 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument num - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing num - - # Argument internal_1 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function_div - jal function_div - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_2 = result of function_div - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument x - lw $t0, 28($sp) - sw $t0, 4($sp) # Storing x - - # Argument internal_2 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 28($sp) # x = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating A - li $v0, 9 - lw $a0, type_A - syscall - la $t0, type_A # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_3 = address of allocated object A - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_3 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_3 - - # Calling function function___init___at_A - jal function___init___at_A - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_3 = result of function___init___at_A - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_3 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_3 - - # Argument x - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing x - - # Calling function function_set_var_at_A - jal function_set_var_at_A - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_4 = result of function_set_var_at_A - addi $sp, $sp, 12 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 20 - - jr $ra - - function___init___at_A2I: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_c2i_at_A2I: - # Function parameters - # $ra = 216($sp) - # self = 212($sp) - # char = 208($sp) - - # Reserving space for local variables - addi $sp, $sp, -208 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 200($sp) # internal_1 = address of allocated object Int - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 48 - sb $t0, 8($v0) # internal_2[0] = '0' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 196($sp) # internal_2 = "0" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument char - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char - - # Argument internal_2 - lw $t0, 208($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 204($sp) # internal_3 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_1 = internal_3 - lw $t0, 192($sp) - sw $t0, 200($sp) - - # If internal_1 then goto then_8781702324152 - lw $t0, 200($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702324152 - - # Jumping to else_8781702324152 - j else_8781702324152 - - then_8781702324152: - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 188($sp) # internal_4 = address of allocated object Int - - # internal_0 = internal_4 - lw $t0, 188($sp) - sw $t0, 204($sp) - - # Jumping to endif_8781702324152 - j endif_8781702324152 - - else_8781702324152: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 180($sp) # internal_6 = address of allocated object Int - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 49 - sb $t0, 8($v0) # internal_7[0] = '1' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 176($sp) # internal_7 = "1" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument char - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char - - # Argument internal_7 - lw $t0, 188($sp) - sw $t0, 0($sp) # Storing internal_7 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 184($sp) # internal_8 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_6 = internal_8 - lw $t0, 172($sp) - sw $t0, 180($sp) - - # If internal_6 then goto then_8781702324146 - lw $t0, 180($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702324146 - - # Jumping to else_8781702324146 - j else_8781702324146 - - then_8781702324146: - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 168($sp) # internal_9 = address of allocated object Int - - # internal_5 = internal_9 - lw $t0, 168($sp) - sw $t0, 184($sp) - - # Jumping to endif_8781702324146 - j endif_8781702324146 - - else_8781702324146: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 160($sp) # internal_11 = address of allocated object Int - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 50 - sb $t0, 8($v0) # internal_12[0] = '2' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 156($sp) # internal_12 = "2" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument char - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char - - # Argument internal_12 - lw $t0, 168($sp) - sw $t0, 0($sp) # Storing internal_12 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 164($sp) # internal_13 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_11 = internal_13 - lw $t0, 152($sp) - sw $t0, 160($sp) - - # If internal_11 then goto then_8781702324140 - lw $t0, 160($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702324140 - - # Jumping to else_8781702324140 - j else_8781702324140 - - then_8781702324140: - - # Allocating Int 2 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 2 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 148($sp) # internal_14 = address of allocated object Int - - # internal_10 = internal_14 - lw $t0, 148($sp) - sw $t0, 164($sp) - - # Jumping to endif_8781702324140 - j endif_8781702324140 - - else_8781702324140: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 140($sp) # internal_16 = address of allocated object Int - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 51 - sb $t0, 8($v0) # internal_17[0] = '3' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 136($sp) # internal_17 = "3" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument char - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char - - # Argument internal_17 - lw $t0, 148($sp) - sw $t0, 0($sp) # Storing internal_17 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 144($sp) # internal_18 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_16 = internal_18 - lw $t0, 132($sp) - sw $t0, 140($sp) - - # If internal_16 then goto then_8781702324134 - lw $t0, 140($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702324134 - - # Jumping to else_8781702324134 - j else_8781702324134 - - then_8781702324134: - - # Allocating Int 3 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 3 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 128($sp) # internal_19 = address of allocated object Int - - # internal_15 = internal_19 - lw $t0, 128($sp) - sw $t0, 144($sp) - - # Jumping to endif_8781702324134 - j endif_8781702324134 - - else_8781702324134: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 120($sp) # internal_21 = address of allocated object Int - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 52 - sb $t0, 8($v0) # internal_22[0] = '4' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 116($sp) # internal_22 = "4" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument char - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char - - # Argument internal_22 - lw $t0, 128($sp) - sw $t0, 0($sp) # Storing internal_22 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 124($sp) # internal_23 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_21 = internal_23 - lw $t0, 112($sp) - sw $t0, 120($sp) - - # If internal_21 then goto then_8781702324128 - lw $t0, 120($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702324128 - - # Jumping to else_8781702324128 - j else_8781702324128 - - then_8781702324128: - - # Allocating Int 4 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 4 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 108($sp) # internal_24 = address of allocated object Int - - # internal_20 = internal_24 - lw $t0, 108($sp) - sw $t0, 124($sp) - - # Jumping to endif_8781702324128 - j endif_8781702324128 - - else_8781702324128: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 100($sp) # internal_26 = address of allocated object Int - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 53 - sb $t0, 8($v0) # internal_27[0] = '5' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 96($sp) # internal_27 = "5" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument char - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char - - # Argument internal_27 - lw $t0, 108($sp) - sw $t0, 0($sp) # Storing internal_27 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 104($sp) # internal_28 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_26 = internal_28 - lw $t0, 92($sp) - sw $t0, 100($sp) - - # If internal_26 then goto then_8781702324122 - lw $t0, 100($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702324122 - - # Jumping to else_8781702324122 - j else_8781702324122 - - then_8781702324122: - - # Allocating Int 5 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 5 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 88($sp) # internal_29 = address of allocated object Int - - # internal_25 = internal_29 - lw $t0, 88($sp) - sw $t0, 104($sp) - - # Jumping to endif_8781702324122 - j endif_8781702324122 - - else_8781702324122: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # internal_31 = address of allocated object Int - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 54 - sb $t0, 8($v0) # internal_32[0] = '6' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 76($sp) # internal_32 = "6" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument char - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char - - # Argument internal_32 - lw $t0, 88($sp) - sw $t0, 0($sp) # Storing internal_32 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 84($sp) # internal_33 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_31 = internal_33 - lw $t0, 72($sp) - sw $t0, 80($sp) - - # If internal_31 then goto then_8781702324116 - lw $t0, 80($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702324116 - - # Jumping to else_8781702324116 - j else_8781702324116 - - then_8781702324116: - - # Allocating Int 6 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 6 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 68($sp) # internal_34 = address of allocated object Int - - # internal_30 = internal_34 - lw $t0, 68($sp) - sw $t0, 84($sp) - - # Jumping to endif_8781702324116 - j endif_8781702324116 - - else_8781702324116: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_36 = address of allocated object Int - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 55 - sb $t0, 8($v0) # internal_37[0] = '7' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 56($sp) # internal_37 = "7" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument char - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char - - # Argument internal_37 - lw $t0, 68($sp) - sw $t0, 0($sp) # Storing internal_37 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 64($sp) # internal_38 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_36 = internal_38 - lw $t0, 52($sp) - sw $t0, 60($sp) - - # If internal_36 then goto then_8781702324110 - lw $t0, 60($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702324110 - - # Jumping to else_8781702324110 - j else_8781702324110 - - then_8781702324110: - - # Allocating Int 7 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 7 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_39 = address of allocated object Int - - # internal_35 = internal_39 - lw $t0, 48($sp) - sw $t0, 64($sp) - - # Jumping to endif_8781702324110 - j endif_8781702324110 - - else_8781702324110: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_41 = address of allocated object Int - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 56 - sb $t0, 8($v0) # internal_42[0] = '8' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 36($sp) # internal_42 = "8" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument char - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char - - # Argument internal_42 - lw $t0, 48($sp) - sw $t0, 0($sp) # Storing internal_42 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 44($sp) # internal_43 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_41 = internal_43 - lw $t0, 32($sp) - sw $t0, 40($sp) - - # If internal_41 then goto then_8781702324104 - lw $t0, 40($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702324104 - - # Jumping to else_8781702324104 - j else_8781702324104 - - then_8781702324104: - - # Allocating Int 8 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 8 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_44 = address of allocated object Int - - # internal_40 = internal_44 - lw $t0, 28($sp) - sw $t0, 44($sp) - - # Jumping to endif_8781702324104 - j endif_8781702324104 - - else_8781702324104: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_46 = address of allocated object Int - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 57 - sb $t0, 8($v0) # internal_47[0] = '9' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 16($sp) # internal_47 = "9" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument char - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing char - - # Argument internal_47 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_47 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 24($sp) # internal_48 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_46 = internal_48 - lw $t0, 12($sp) - sw $t0, 20($sp) - - # If internal_46 then goto then_8781702324083 - lw $t0, 20($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702324083 - - # Jumping to else_8781702324083 - j else_8781702324083 - - then_8781702324083: - - # Allocating Int 9 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 9 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_49 = address of allocated object Int - - # internal_45 = internal_49 - lw $t0, 8($sp) - sw $t0, 24($sp) - - # Jumping to endif_8781702324083 - j endif_8781702324083 - - else_8781702324083: - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument self - lw $t0, 220($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_abort_at_Object - jal function_abort_at_Object - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_50 = result of function_abort_at_Object - addi $sp, $sp, 8 # Freeing space for arguments - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_51 = address of allocated object Int - - # internal_45 = internal_51 - lw $t0, 0($sp) - sw $t0, 24($sp) - - # Jumping to endif_8781702324083 - j endif_8781702324083 - - endif_8781702324083: - - # internal_40 = internal_45 - lw $t0, 24($sp) - sw $t0, 44($sp) - - # Jumping to endif_8781702324104 - j endif_8781702324104 - - endif_8781702324104: - - # internal_35 = internal_40 - lw $t0, 44($sp) - sw $t0, 64($sp) - - # Jumping to endif_8781702324110 - j endif_8781702324110 - - endif_8781702324110: - - # internal_30 = internal_35 - lw $t0, 64($sp) - sw $t0, 84($sp) - - # Jumping to endif_8781702324116 - j endif_8781702324116 - - endif_8781702324116: - - # internal_25 = internal_30 - lw $t0, 84($sp) - sw $t0, 104($sp) - - # Jumping to endif_8781702324122 - j endif_8781702324122 - - endif_8781702324122: - - # internal_20 = internal_25 - lw $t0, 104($sp) - sw $t0, 124($sp) - - # Jumping to endif_8781702324128 - j endif_8781702324128 - - endif_8781702324128: - - # internal_15 = internal_20 - lw $t0, 124($sp) - sw $t0, 144($sp) - - # Jumping to endif_8781702324134 - j endif_8781702324134 - - endif_8781702324134: - - # internal_10 = internal_15 - lw $t0, 144($sp) - sw $t0, 164($sp) - - # Jumping to endif_8781702324140 - j endif_8781702324140 - - endif_8781702324140: - - # internal_5 = internal_10 - lw $t0, 164($sp) - sw $t0, 184($sp) - - # Jumping to endif_8781702324146 - j endif_8781702324146 - - endif_8781702324146: - - # internal_0 = internal_5 - lw $t0, 184($sp) - sw $t0, 204($sp) - - # Jumping to endif_8781702324152 - j endif_8781702324152 - - endif_8781702324152: - - # Loading return value in $v1 - lw $v1, 204($sp) - - # Freeing space for local variables - addi $sp, $sp, 208 - - jr $ra - - function_i2c_at_A2I: - # Function parameters - # $ra = 216($sp) - # self = 212($sp) - # i = 208($sp) - - # Reserving space for local variables - addi $sp, $sp, -208 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 200($sp) # internal_1 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 196($sp) # internal_2 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument i - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing i - - # Argument internal_2 - lw $t0, 208($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 204($sp) # internal_3 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_1 = internal_3 - lw $t0, 192($sp) - sw $t0, 200($sp) - - # If internal_1 then goto then_8781702324730 - lw $t0, 200($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702324730 - - # Jumping to else_8781702324730 - j else_8781702324730 - - then_8781702324730: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 48 - sb $t0, 8($v0) # internal_4[0] = '0' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 188($sp) # internal_4 = "0" - - # internal_0 = internal_4 - lw $t0, 188($sp) - sw $t0, 204($sp) - - # Jumping to endif_8781702324730 - j endif_8781702324730 - - else_8781702324730: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 180($sp) # internal_6 = address of allocated object Int - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 176($sp) # internal_7 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument i - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing i - - # Argument internal_7 - lw $t0, 188($sp) - sw $t0, 0($sp) # Storing internal_7 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 184($sp) # internal_8 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_6 = internal_8 - lw $t0, 172($sp) - sw $t0, 180($sp) - - # If internal_6 then goto then_8781702324724 - lw $t0, 180($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702324724 - - # Jumping to else_8781702324724 - j else_8781702324724 - - then_8781702324724: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 49 - sb $t0, 8($v0) # internal_9[0] = '1' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 168($sp) # internal_9 = "1" - - # internal_5 = internal_9 - lw $t0, 168($sp) - sw $t0, 184($sp) - - # Jumping to endif_8781702324724 - j endif_8781702324724 - - else_8781702324724: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 160($sp) # internal_11 = address of allocated object Int - - # Allocating Int 2 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 2 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 156($sp) # internal_12 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument i - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing i - - # Argument internal_12 - lw $t0, 168($sp) - sw $t0, 0($sp) # Storing internal_12 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 164($sp) # internal_13 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_11 = internal_13 - lw $t0, 152($sp) - sw $t0, 160($sp) - - # If internal_11 then goto then_8781702324718 - lw $t0, 160($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702324718 - - # Jumping to else_8781702324718 - j else_8781702324718 - - then_8781702324718: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 50 - sb $t0, 8($v0) # internal_14[0] = '2' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 148($sp) # internal_14 = "2" - - # internal_10 = internal_14 - lw $t0, 148($sp) - sw $t0, 164($sp) - - # Jumping to endif_8781702324718 - j endif_8781702324718 - - else_8781702324718: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 140($sp) # internal_16 = address of allocated object Int - - # Allocating Int 3 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 3 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 136($sp) # internal_17 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument i - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing i - - # Argument internal_17 - lw $t0, 148($sp) - sw $t0, 0($sp) # Storing internal_17 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 144($sp) # internal_18 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_16 = internal_18 - lw $t0, 132($sp) - sw $t0, 140($sp) - - # If internal_16 then goto then_8781702324712 - lw $t0, 140($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702324712 - - # Jumping to else_8781702324712 - j else_8781702324712 - - then_8781702324712: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 51 - sb $t0, 8($v0) # internal_19[0] = '3' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 128($sp) # internal_19 = "3" - - # internal_15 = internal_19 - lw $t0, 128($sp) - sw $t0, 144($sp) - - # Jumping to endif_8781702324712 - j endif_8781702324712 - - else_8781702324712: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 120($sp) # internal_21 = address of allocated object Int - - # Allocating Int 4 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 4 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 116($sp) # internal_22 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument i - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing i - - # Argument internal_22 - lw $t0, 128($sp) - sw $t0, 0($sp) # Storing internal_22 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 124($sp) # internal_23 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_21 = internal_23 - lw $t0, 112($sp) - sw $t0, 120($sp) - - # If internal_21 then goto then_8781702324706 - lw $t0, 120($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702324706 - - # Jumping to else_8781702324706 - j else_8781702324706 - - then_8781702324706: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 52 - sb $t0, 8($v0) # internal_24[0] = '4' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 108($sp) # internal_24 = "4" - - # internal_20 = internal_24 - lw $t0, 108($sp) - sw $t0, 124($sp) - - # Jumping to endif_8781702324706 - j endif_8781702324706 - - else_8781702324706: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 100($sp) # internal_26 = address of allocated object Int - - # Allocating Int 5 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 5 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 96($sp) # internal_27 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument i - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing i - - # Argument internal_27 - lw $t0, 108($sp) - sw $t0, 0($sp) # Storing internal_27 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 104($sp) # internal_28 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_26 = internal_28 - lw $t0, 92($sp) - sw $t0, 100($sp) - - # If internal_26 then goto then_8781702324700 - lw $t0, 100($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702324700 - - # Jumping to else_8781702324700 - j else_8781702324700 - - then_8781702324700: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 53 - sb $t0, 8($v0) # internal_29[0] = '5' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 88($sp) # internal_29 = "5" - - # internal_25 = internal_29 - lw $t0, 88($sp) - sw $t0, 104($sp) - - # Jumping to endif_8781702324700 - j endif_8781702324700 - - else_8781702324700: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # internal_31 = address of allocated object Int - - # Allocating Int 6 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 6 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 76($sp) # internal_32 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument i - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing i - - # Argument internal_32 - lw $t0, 88($sp) - sw $t0, 0($sp) # Storing internal_32 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 84($sp) # internal_33 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_31 = internal_33 - lw $t0, 72($sp) - sw $t0, 80($sp) - - # If internal_31 then goto then_8781702324694 - lw $t0, 80($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702324694 - - # Jumping to else_8781702324694 - j else_8781702324694 - - then_8781702324694: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 54 - sb $t0, 8($v0) # internal_34[0] = '6' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 68($sp) # internal_34 = "6" - - # internal_30 = internal_34 - lw $t0, 68($sp) - sw $t0, 84($sp) - - # Jumping to endif_8781702324694 - j endif_8781702324694 - - else_8781702324694: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_36 = address of allocated object Int - - # Allocating Int 7 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 7 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 56($sp) # internal_37 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument i - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing i - - # Argument internal_37 - lw $t0, 68($sp) - sw $t0, 0($sp) # Storing internal_37 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 64($sp) # internal_38 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_36 = internal_38 - lw $t0, 52($sp) - sw $t0, 60($sp) - - # If internal_36 then goto then_8781702324688 - lw $t0, 60($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702324688 - - # Jumping to else_8781702324688 - j else_8781702324688 - - then_8781702324688: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 55 - sb $t0, 8($v0) # internal_39[0] = '7' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 48($sp) # internal_39 = "7" - - # internal_35 = internal_39 - lw $t0, 48($sp) - sw $t0, 64($sp) - - # Jumping to endif_8781702324688 - j endif_8781702324688 - - else_8781702324688: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_41 = address of allocated object Int - - # Allocating Int 8 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 8 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_42 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument i - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing i - - # Argument internal_42 - lw $t0, 48($sp) - sw $t0, 0($sp) # Storing internal_42 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 44($sp) # internal_43 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_41 = internal_43 - lw $t0, 32($sp) - sw $t0, 40($sp) - - # If internal_41 then goto then_8781702324682 - lw $t0, 40($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702324682 - - # Jumping to else_8781702324682 - j else_8781702324682 - - then_8781702324682: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 56 - sb $t0, 8($v0) # internal_44[0] = '8' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 28($sp) # internal_44 = "8" - - # internal_40 = internal_44 - lw $t0, 28($sp) - sw $t0, 44($sp) - - # Jumping to endif_8781702324682 - j endif_8781702324682 - - else_8781702324682: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_46 = address of allocated object Int - - # Allocating Int 9 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 9 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_47 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument i - lw $t0, 220($sp) - sw $t0, 4($sp) # Storing i - - # Argument internal_47 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_47 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 24($sp) # internal_48 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_46 = internal_48 - lw $t0, 12($sp) - sw $t0, 20($sp) - - # If internal_46 then goto then_8781702324661 - lw $t0, 20($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702324661 - - # Jumping to else_8781702324661 - j else_8781702324661 - - then_8781702324661: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 57 - sb $t0, 8($v0) # internal_49[0] = '9' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 8($sp) # internal_49 = "9" - - # internal_45 = internal_49 - lw $t0, 8($sp) - sw $t0, 24($sp) - - # Jumping to endif_8781702324661 - j endif_8781702324661 - - else_8781702324661: - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument self - lw $t0, 220($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_abort_at_Object - jal function_abort_at_Object - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_50 = result of function_abort_at_Object - addi $sp, $sp, 8 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 9 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - sb $zero, 8($v0) # Null-terminator at the end of the string - - sw $v0, 0($sp) # internal_51 = "" - - # internal_45 = internal_51 - lw $t0, 0($sp) - sw $t0, 24($sp) - - # Jumping to endif_8781702324661 - j endif_8781702324661 - - endif_8781702324661: - - # internal_40 = internal_45 - lw $t0, 24($sp) - sw $t0, 44($sp) - - # Jumping to endif_8781702324682 - j endif_8781702324682 - - endif_8781702324682: - - # internal_35 = internal_40 - lw $t0, 44($sp) - sw $t0, 64($sp) - - # Jumping to endif_8781702324688 - j endif_8781702324688 - - endif_8781702324688: - - # internal_30 = internal_35 - lw $t0, 64($sp) - sw $t0, 84($sp) - - # Jumping to endif_8781702324694 - j endif_8781702324694 - - endif_8781702324694: - - # internal_25 = internal_30 - lw $t0, 84($sp) - sw $t0, 104($sp) - - # Jumping to endif_8781702324700 - j endif_8781702324700 - - endif_8781702324700: - - # internal_20 = internal_25 - lw $t0, 104($sp) - sw $t0, 124($sp) - - # Jumping to endif_8781702324706 - j endif_8781702324706 - - endif_8781702324706: - - # internal_15 = internal_20 - lw $t0, 124($sp) - sw $t0, 144($sp) - - # Jumping to endif_8781702324712 - j endif_8781702324712 - - endif_8781702324712: - - # internal_10 = internal_15 - lw $t0, 144($sp) - sw $t0, 164($sp) - - # Jumping to endif_8781702324718 - j endif_8781702324718 - - endif_8781702324718: - - # internal_5 = internal_10 - lw $t0, 164($sp) - sw $t0, 184($sp) - - # Jumping to endif_8781702324724 - j endif_8781702324724 - - endif_8781702324724: - - # internal_0 = internal_5 - lw $t0, 184($sp) - sw $t0, 204($sp) - - # Jumping to endif_8781702324730 - j endif_8781702324730 - - endif_8781702324730: - - # Loading return value in $v1 - lw $v1, 204($sp) - - # Freeing space for local variables - addi $sp, $sp, 208 - - jr $ra - - function_a2i_at_A2I: - # Function parameters - # $ra = 152($sp) - # self = 148($sp) - # s = 144($sp) - - # Reserving space for local variables - addi $sp, $sp, -144 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 136($sp) # internal_1 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument s - lw $t0, 152($sp) - sw $t0, 0($sp) # Storing s - - # Calling function function_length_at_String - jal function_length_at_String - lw $ra, 4($sp) - sw $v1, 140($sp) # internal_2 = result of function_length_at_String - addi $sp, $sp, 8 # Freeing space for arguments - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 128($sp) # internal_3 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_2 - lw $t0, 144($sp) - sw $t0, 4($sp) # Storing internal_2 - - # Argument internal_3 - lw $t0, 140($sp) - sw $t0, 0($sp) # Storing internal_3 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 136($sp) # internal_4 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_1 = internal_4 - lw $t0, 124($sp) - sw $t0, 136($sp) - - # If internal_1 then goto then_8781702325176 - lw $t0, 136($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702325176 - - # Jumping to else_8781702325176 - j else_8781702325176 - - then_8781702325176: - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 120($sp) # internal_5 = address of allocated object Int - - # internal_0 = internal_5 - lw $t0, 120($sp) - sw $t0, 140($sp) - - # Jumping to endif_8781702325176 - j endif_8781702325176 - - else_8781702325176: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 112($sp) # internal_7 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 108($sp) # internal_8 = address of allocated object Int - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 104($sp) # internal_9 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address - - # Argument s - lw $t0, 160($sp) - sw $t0, 8($sp) # Storing s - - # Argument internal_8 - lw $t0, 124($sp) - sw $t0, 4($sp) # Storing internal_8 - - # Argument internal_9 - lw $t0, 120($sp) - sw $t0, 0($sp) # Storing internal_9 - - # Calling function function_substr_at_String - jal function_substr_at_String - lw $ra, 12($sp) - sw $v1, 116($sp) # internal_10 = result of function_substr_at_String - addi $sp, $sp, 16 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 45 - sb $t0, 8($v0) # internal_11[0] = '-' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 96($sp) # internal_11 = "-" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_10 - lw $t0, 112($sp) - sw $t0, 4($sp) # Storing internal_10 - - # Argument internal_11 - lw $t0, 108($sp) - sw $t0, 0($sp) # Storing internal_11 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 104($sp) # internal_12 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_7 = internal_12 - lw $t0, 92($sp) - sw $t0, 112($sp) - - # If internal_7 then goto then_8781702325191 - lw $t0, 112($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702325191 - - # Jumping to else_8781702325191 - j else_8781702325191 - - then_8781702325191: - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 88($sp) # internal_13 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument s - lw $t0, 152($sp) - sw $t0, 0($sp) # Storing s - - # Calling function function_length_at_String - jal function_length_at_String - lw $ra, 4($sp) - sw $v1, 92($sp) # internal_14 = result of function_length_at_String - addi $sp, $sp, 8 # Freeing space for arguments - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # internal_15 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_14 - lw $t0, 96($sp) - sw $t0, 4($sp) # Storing internal_14 - - # Argument internal_15 - lw $t0, 92($sp) - sw $t0, 0($sp) # Storing internal_15 - - # Calling function function_sub - jal function_sub - lw $ra, 8($sp) - sw $v1, 88($sp) # internal_16 = result of function_sub - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address - - # Argument s - lw $t0, 160($sp) - sw $t0, 8($sp) # Storing s - - # Argument internal_13 - lw $t0, 104($sp) - sw $t0, 4($sp) # Storing internal_13 - - # Argument internal_16 - lw $t0, 92($sp) - sw $t0, 0($sp) # Storing internal_16 - - # Calling function function_substr_at_String - jal function_substr_at_String - lw $ra, 12($sp) - sw $v1, 88($sp) # internal_17 = result of function_substr_at_String - addi $sp, $sp, 16 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 160($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_17 - lw $t0, 84($sp) - sw $t0, 0($sp) # Storing internal_17 - - # Calling function function_a2i_aux_at_A2I - jal function_a2i_aux_at_A2I - lw $ra, 8($sp) - sw $v1, 80($sp) # internal_18 = result of function_a2i_aux_at_A2I - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 64($sp) # internal_19 = address of allocated object Int - - # Allocating Int 4294967295 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 4294967295 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_20 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 56($sp) # internal_21 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_18 - lw $t0, 80($sp) - sw $t0, 4($sp) # Storing internal_18 - - # Argument internal_20 - lw $t0, 72($sp) - sw $t0, 0($sp) # Storing internal_20 - - # Calling function function_xor - jal function_xor - lw $ra, 8($sp) - sw $v1, 68($sp) # internal_21 = result of function_xor - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_21 - lw $t0, 68($sp) - sw $t0, 4($sp) # Storing internal_21 - - # Argument internal_19 - lw $t0, 76($sp) - sw $t0, 0($sp) # Storing internal_19 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 68($sp) # internal_21 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_6 = internal_21 - lw $t0, 56($sp) - sw $t0, 116($sp) - - # Jumping to endif_8781702325191 - j endif_8781702325191 - - else_8781702325191: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_23 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_24 = address of allocated object Int - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_25 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address - - # Argument s - lw $t0, 160($sp) - sw $t0, 8($sp) # Storing s - - # Argument internal_24 - lw $t0, 60($sp) - sw $t0, 4($sp) # Storing internal_24 - - # Argument internal_25 - lw $t0, 56($sp) - sw $t0, 0($sp) # Storing internal_25 - - # Calling function function_substr_at_String - jal function_substr_at_String - lw $ra, 12($sp) - sw $v1, 52($sp) # internal_26 = result of function_substr_at_String - addi $sp, $sp, 16 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 43 - sb $t0, 8($v0) # internal_27[0] = '+' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 32($sp) # internal_27 = "+" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_26 - lw $t0, 48($sp) - sw $t0, 4($sp) # Storing internal_26 - - # Argument internal_27 - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_27 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 40($sp) # internal_28 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_23 = internal_28 - lw $t0, 28($sp) - sw $t0, 48($sp) - - # If internal_23 then goto then_8781702325185 - lw $t0, 48($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702325185 - - # Jumping to else_8781702325185 - j else_8781702325185 - - then_8781702325185: - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_29 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument s - lw $t0, 152($sp) - sw $t0, 0($sp) # Storing s - - # Calling function function_length_at_String - jal function_length_at_String - lw $ra, 4($sp) - sw $v1, 28($sp) # internal_30 = result of function_length_at_String - addi $sp, $sp, 8 # Freeing space for arguments - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_31 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_30 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_30 - - # Argument internal_31 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_31 - - # Calling function function_sub - jal function_sub - lw $ra, 8($sp) - sw $v1, 24($sp) # internal_32 = result of function_sub - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address - - # Argument s - lw $t0, 160($sp) - sw $t0, 8($sp) # Storing s - - # Argument internal_29 - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing internal_29 - - # Argument internal_32 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_32 - - # Calling function function_substr_at_String - jal function_substr_at_String - lw $ra, 12($sp) - sw $v1, 24($sp) # internal_33 = result of function_substr_at_String - addi $sp, $sp, 16 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 160($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_33 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_33 - - # Calling function function_a2i_aux_at_A2I - jal function_a2i_aux_at_A2I - lw $ra, 8($sp) - sw $v1, 16($sp) # internal_34 = result of function_a2i_aux_at_A2I - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_22 = internal_34 - lw $t0, 4($sp) - sw $t0, 52($sp) - - # Jumping to endif_8781702325185 - j endif_8781702325185 - - else_8781702325185: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 160($sp) - sw $t0, 4($sp) # Storing self - - # Argument s - lw $t0, 156($sp) - sw $t0, 0($sp) # Storing s - - # Calling function function_a2i_aux_at_A2I - jal function_a2i_aux_at_A2I - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_35 = result of function_a2i_aux_at_A2I - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_22 = internal_35 - lw $t0, 0($sp) - sw $t0, 52($sp) - - # Jumping to endif_8781702325185 - j endif_8781702325185 - - endif_8781702325185: - - # internal_6 = internal_22 - lw $t0, 52($sp) - sw $t0, 116($sp) - - # Jumping to endif_8781702325191 - j endif_8781702325191 - - endif_8781702325191: - - # internal_0 = internal_6 - lw $t0, 116($sp) - sw $t0, 140($sp) - - # Jumping to endif_8781702325176 - j endif_8781702325176 - - endif_8781702325176: - - # Loading return value in $v1 - lw $v1, 140($sp) - - # Freeing space for local variables - addi $sp, $sp, 144 - - jr $ra - - function_a2i_aux_at_A2I: - # Function parameters - # $ra = 68($sp) - # self = 64($sp) - # s = 60($sp) - - # Reserving space for local variables - addi $sp, $sp, -60 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 52($sp) # internal_1 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument int - lw $t0, 68($sp) - sw $t0, 4($sp) # Storing int - - # Argument internal_1 - lw $t0, 64($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 68($sp) # int = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument s - lw $t0, 68($sp) - sw $t0, 0($sp) # Storing s - - # Calling function function_length_at_String - jal function_length_at_String - lw $ra, 4($sp) - sw $v1, 52($sp) # internal_3 = result of function_length_at_String - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument j - lw $t0, 60($sp) - sw $t0, 4($sp) # Storing j - - # Argument internal_3 - lw $t0, 56($sp) - sw $t0, 0($sp) # Storing internal_3 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 60($sp) # j = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_5 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument i - lw $t0, 52($sp) - sw $t0, 4($sp) # Storing i - - # Argument internal_5 - lw $t0, 48($sp) - sw $t0, 0($sp) # Storing internal_5 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 52($sp) # i = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - while_start_8781702325589: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument i - lw $t0, 52($sp) - sw $t0, 4($sp) # Storing i - - # Argument j - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing j - - # Calling function function_less_than - jal function_less_than - lw $ra, 8($sp) - sw $v1, 44($sp) # internal_6 = result of function_less_than - addi $sp, $sp, 12 # Freeing space for arguments - - # If internal_6 then goto while_body_8781702325589 - lw $t0, 32($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8781702325589 - - # Jumping to while_end_8781702325589 - j while_end_8781702325589 - - while_body_8781702325589: - - # Allocating Int 10 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 10 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_7 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument int - lw $t0, 68($sp) - sw $t0, 4($sp) # Storing int - - # Argument internal_7 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_7 - - # Calling function function_mult - jal function_mult - lw $ra, 8($sp) - sw $v1, 36($sp) # internal_8 = result of function_mult - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_9 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address - - # Argument s - lw $t0, 76($sp) - sw $t0, 8($sp) # Storing s - - # Argument i - lw $t0, 56($sp) - sw $t0, 4($sp) # Storing i - - # Argument internal_9 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_9 - - # Calling function function_substr_at_String - jal function_substr_at_String - lw $ra, 12($sp) - sw $v1, 32($sp) # internal_10 = result of function_substr_at_String - addi $sp, $sp, 16 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 76($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_10 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_10 - - # Calling function function_c2i_at_A2I - jal function_c2i_at_A2I - lw $ra, 8($sp) - sw $v1, 24($sp) # internal_11 = result of function_c2i_at_A2I - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_8 - lw $t0, 36($sp) - sw $t0, 4($sp) # Storing internal_8 - - # Argument internal_11 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_11 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_12 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument int - lw $t0, 68($sp) - sw $t0, 4($sp) # Storing int - - # Argument internal_12 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_12 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 68($sp) # int = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_13 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument i - lw $t0, 52($sp) - sw $t0, 4($sp) # Storing i - - # Argument internal_13 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_13 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_14 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument i - lw $t0, 52($sp) - sw $t0, 4($sp) # Storing i - - # Argument internal_14 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_14 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 52($sp) # i = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Jumping to while_start_8781702325589 - j while_start_8781702325589 - - while_end_8781702325589: - - # Loading return value in $v1 - lw $v1, 56($sp) - - # Freeing space for local variables - addi $sp, $sp, 60 - - jr $ra - - function_i2a_at_A2I: - # Function parameters - # $ra = 80($sp) - # self = 76($sp) - # i = 72($sp) - - # Reserving space for local variables - addi $sp, $sp, -72 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 64($sp) # internal_1 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_2 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument i - lw $t0, 84($sp) - sw $t0, 4($sp) # Storing i - - # Argument internal_2 - lw $t0, 72($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 68($sp) # internal_3 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_1 = internal_3 - lw $t0, 56($sp) - sw $t0, 64($sp) - - # If internal_1 then goto then_8781702325718 - lw $t0, 64($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702325718 - - # Jumping to else_8781702325718 - j else_8781702325718 - - then_8781702325718: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 48 - sb $t0, 8($v0) # internal_4[0] = '0' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 52($sp) # internal_4 = "0" - - # internal_0 = internal_4 - lw $t0, 52($sp) - sw $t0, 68($sp) - - # Jumping to endif_8781702325718 - j endif_8781702325718 - - else_8781702325718: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_6 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_7 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_7 - lw $t0, 52($sp) - sw $t0, 4($sp) # Storing internal_7 - - # Argument i - lw $t0, 84($sp) - sw $t0, 0($sp) # Storing i - - # Calling function function_less_than - jal function_less_than - lw $ra, 8($sp) - sw $v1, 48($sp) # internal_8 = result of function_less_than - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_6 = internal_8 - lw $t0, 36($sp) - sw $t0, 44($sp) - - # If internal_6 then goto then_8781702325724 - lw $t0, 44($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702325724 - - # Jumping to else_8781702325724 - j else_8781702325724 - - then_8781702325724: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 88($sp) - sw $t0, 4($sp) # Storing self - - # Argument i - lw $t0, 84($sp) - sw $t0, 0($sp) # Storing i - - # Calling function function_i2a_aux_at_A2I - jal function_i2a_aux_at_A2I - lw $ra, 8($sp) - sw $v1, 44($sp) # internal_9 = result of function_i2a_aux_at_A2I - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_5 = internal_9 - lw $t0, 32($sp) - sw $t0, 48($sp) - - # Jumping to endif_8781702325724 - j endif_8781702325724 - - else_8781702325724: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 45 - sb $t0, 8($v0) # internal_10[0] = '-' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 28($sp) # internal_10 = "-" - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_11 = address of allocated object Int - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_12 = address of allocated object Int - - # Allocating Int 4294967295 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 4294967295 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_13 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_14 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_11 - lw $t0, 36($sp) - sw $t0, 4($sp) # Storing internal_11 - - # Argument internal_13 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_13 - - # Calling function function_xor - jal function_xor - lw $ra, 8($sp) - sw $v1, 24($sp) # internal_14 = result of function_xor - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_14 - lw $t0, 24($sp) - sw $t0, 4($sp) # Storing internal_14 - - # Argument internal_12 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_12 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 24($sp) # internal_14 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument i - lw $t0, 84($sp) - sw $t0, 4($sp) # Storing i - - # Argument internal_14 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_14 - - # Calling function function_mult - jal function_mult - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_15 = result of function_mult - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 88($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_15 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_15 - - # Calling function function_i2a_aux_at_A2I - jal function_i2a_aux_at_A2I - lw $ra, 8($sp) - sw $v1, 16($sp) # internal_16 = result of function_i2a_aux_at_A2I - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_10 - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing internal_10 - - # Argument internal_16 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_16 - - # Calling function function_concat_at_String - jal function_concat_at_String - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_17 = result of function_concat_at_String - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_5 = internal_17 - lw $t0, 0($sp) - sw $t0, 48($sp) - - # Jumping to endif_8781702325724 - j endif_8781702325724 - - endif_8781702325724: - - # internal_0 = internal_5 - lw $t0, 48($sp) - sw $t0, 68($sp) - - # Jumping to endif_8781702325718 - j endif_8781702325718 - - endif_8781702325718: - - # Loading return value in $v1 - lw $v1, 68($sp) - - # Freeing space for local variables - addi $sp, $sp, 72 - - jr $ra - - function_i2a_aux_at_A2I: - # Function parameters - # $ra = 64($sp) - # self = 60($sp) - # i = 56($sp) - - # Reserving space for local variables - addi $sp, $sp, -56 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_1 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_2 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument i - lw $t0, 68($sp) - sw $t0, 4($sp) # Storing i - - # Argument internal_2 - lw $t0, 56($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 52($sp) # internal_3 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_1 = internal_3 - lw $t0, 40($sp) - sw $t0, 48($sp) - - # If internal_1 then goto then_8781702326348 - lw $t0, 48($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702326348 - - # Jumping to else_8781702326348 - j else_8781702326348 - - then_8781702326348: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 9 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - sb $zero, 8($v0) # Null-terminator at the end of the string - - sw $v0, 36($sp) # internal_4 = "" - - # internal_0 = internal_4 - lw $t0, 36($sp) - sw $t0, 52($sp) - - # Jumping to endif_8781702326348 - j endif_8781702326348 - - else_8781702326348: - - # Allocating Int 10 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 10 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_6 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument i - lw $t0, 68($sp) - sw $t0, 4($sp) # Storing i - - # Argument internal_6 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_6 - - # Calling function function_div - jal function_div - lw $ra, 8($sp) - sw $v1, 36($sp) # internal_7 = result of function_div - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument next - lw $t0, 44($sp) - sw $t0, 4($sp) # Storing next - - # Argument internal_7 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_7 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 44($sp) # next = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 72($sp) - sw $t0, 4($sp) # Storing self - - # Argument next - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing next - - # Calling function function_i2a_aux_at_A2I - jal function_i2a_aux_at_A2I - lw $ra, 8($sp) - sw $v1, 32($sp) # internal_8 = result of function_i2a_aux_at_A2I - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating Int 10 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 10 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_9 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument next - lw $t0, 44($sp) - sw $t0, 4($sp) # Storing next - - # Argument internal_9 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_9 - - # Calling function function_mult - jal function_mult - lw $ra, 8($sp) - sw $v1, 24($sp) # internal_10 = result of function_mult - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument i - lw $t0, 68($sp) - sw $t0, 4($sp) # Storing i - - # Argument internal_10 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_10 - - # Calling function function_sub - jal function_sub - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_11 = result of function_sub - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 72($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_11 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_11 - - # Calling function function_i2c_at_A2I - jal function_i2c_at_A2I - lw $ra, 8($sp) - sw $v1, 16($sp) # internal_12 = result of function_i2c_at_A2I - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_8 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_8 - - # Argument internal_12 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_12 - - # Calling function function_concat_at_String - jal function_concat_at_String - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_13 = result of function_concat_at_String - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_0 = internal_13 - lw $t0, 0($sp) - sw $t0, 52($sp) - - # Jumping to endif_8781702326348 - j endif_8781702326348 - - endif_8781702326348: - - # Loading return value in $v1 - lw $v1, 52($sp) - - # Freeing space for local variables - addi $sp, $sp, 56 - - jr $ra - - function___init___at_Main: - # Function parameters - # $ra = 20($sp) - # self = 16($sp) - - # Reserving space for local variables - addi $sp, $sp, -16 - - # Allocating String - li $v0, 9 - addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 9 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - sb $zero, 8($v0) # Null-terminator at the end of the string - - sw $v0, 12($sp) # internal_0 = "" - - # Set attribute char of self - lw $t0, 16($sp) # $t0 = self - lw $t1, 12($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8781702246202 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8781702246202 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8781702246202 - j object_set_attribute_8781702246202 - int_set_attribute_8781702246202: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.char = internal_0 - j end_set_attribute_8781702246202 - bool_set_attribute_8781702246202: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.char = internal_0 - j end_set_attribute_8781702246202 - object_set_attribute_8781702246202: - sw $t1, 8($t0) # self.char = internal_0 - end_set_attribute_8781702246202: - - # Allocating NUll to internal_1 - sw $zero, 8($sp) # internal_1 = 0 - - # Set attribute avar of self - lw $t0, 16($sp) # $t0 = self - lw $t1, 8($sp) # $t1 = internal_1 - beq $t1, $zero, object_set_attribute_8781702246223 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8781702246223 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8781702246223 - j object_set_attribute_8781702246223 - int_set_attribute_8781702246223: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_1 - j end_set_attribute_8781702246223 - bool_set_attribute_8781702246223: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_1 - j end_set_attribute_8781702246223 - object_set_attribute_8781702246223: - sw $t1, 12($t0) # self.avar = internal_1 - end_set_attribute_8781702246223: - - # Allocating NUll to internal_2 - sw $zero, 4($sp) # internal_2 = 0 - - # Set attribute a_var of self - lw $t0, 16($sp) # $t0 = self - lw $t1, 4($sp) # $t1 = internal_2 - beq $t1, $zero, object_set_attribute_8781702246244 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8781702246244 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8781702246244 - j object_set_attribute_8781702246244 - int_set_attribute_8781702246244: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 16($t0) # self.a_var = internal_2 - j end_set_attribute_8781702246244 - bool_set_attribute_8781702246244: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 16($t0) # self.a_var = internal_2 - j end_set_attribute_8781702246244 - object_set_attribute_8781702246244: - sw $t1, 16($t0) # self.a_var = internal_2 - end_set_attribute_8781702246244: - - # Allocating Bool 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_3 = address of allocated object Int - - # Set attribute flag of self - lw $t0, 16($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_3 - beq $t1, $zero, object_set_attribute_8781702246265 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8781702246265 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8781702246265 - j object_set_attribute_8781702246265 - int_set_attribute_8781702246265: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 20($t0) # self.flag = internal_3 - j end_set_attribute_8781702246265 - bool_set_attribute_8781702246265: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 20($t0) # self.flag = internal_3 - j end_set_attribute_8781702246265 - object_set_attribute_8781702246265: - sw $t1, 20($t0) # self.flag = internal_3 - end_set_attribute_8781702246265: - - # Loading return value in $v1 - lw $v1, 16($sp) - - # Freeing space for local variables - addi $sp, $sp, 16 - - jr $ra - - function_menu_at_Main: - # Function parameters - # $ra = 216($sp) - # self = 212($sp) - - # Reserving space for local variables - addi $sp, $sp, -212 - - # Allocating String - li $v0, 9 - addi $a0, $zero, 30 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 30 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_0[0] = '\n' - - addi $t0, $zero, 9 - sb $t0, 9($v0) # internal_0[1] = '\t' - - addi $t0, $zero, 84 - sb $t0, 10($v0) # internal_0[2] = 'T' - - addi $t0, $zero, 111 - sb $t0, 11($v0) # internal_0[3] = 'o' - - addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_0[4] = ' ' - - addi $t0, $zero, 97 - sb $t0, 13($v0) # internal_0[5] = 'a' - - addi $t0, $zero, 100 - sb $t0, 14($v0) # internal_0[6] = 'd' - - addi $t0, $zero, 100 - sb $t0, 15($v0) # internal_0[7] = 'd' - - addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_0[8] = ' ' - - addi $t0, $zero, 97 - sb $t0, 17($v0) # internal_0[9] = 'a' - - addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_0[10] = ' ' - - addi $t0, $zero, 110 - sb $t0, 19($v0) # internal_0[11] = 'n' - - addi $t0, $zero, 117 - sb $t0, 20($v0) # internal_0[12] = 'u' - - addi $t0, $zero, 109 - sb $t0, 21($v0) # internal_0[13] = 'm' - - addi $t0, $zero, 98 - sb $t0, 22($v0) # internal_0[14] = 'b' - - addi $t0, $zero, 101 - sb $t0, 23($v0) # internal_0[15] = 'e' - - addi $t0, $zero, 114 - sb $t0, 24($v0) # internal_0[16] = 'r' - - addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_0[17] = ' ' - - addi $t0, $zero, 116 - sb $t0, 26($v0) # internal_0[18] = 't' - - addi $t0, $zero, 111 - sb $t0, 27($v0) # internal_0[19] = 'o' - - addi $t0, $zero, 32 - sb $t0, 28($v0) # internal_0[20] = ' ' - - sb $zero, 29($v0) # Null-terminator at the end of the string - - sw $v0, 208($sp) # internal_0 = "\n\tTo add a number to " - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_0 - lw $t0, 220($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 216($sp) # internal_1 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Get attribute avar of self - lw $t0, 212($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702246355 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702246355 - j object_get_attribute_8781702246355 - int_get_attribute_8781702246355: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 200($sp) # internal_2 = self.avar - j end_get_attribute_8781702246355 - bool_get_attribute_8781702246355: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 200($sp) # internal_2 = self.avar - j end_get_attribute_8781702246355 - object_get_attribute_8781702246355: - sw $t1, 200($sp) # internal_2 = avar - end_get_attribute_8781702246355: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_2 - lw $t0, 212($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_print_at_Main - jal function_print_at_Main - lw $ra, 8($sp) - sw $v1, 208($sp) # internal_3 = result of function_print_at_Main - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 21 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 46 - sb $t0, 8($v0) # internal_4[0] = '.' - - addi $t0, $zero, 46 - sb $t0, 9($v0) # internal_4[1] = '.' - - addi $t0, $zero, 46 - sb $t0, 10($v0) # internal_4[2] = '.' - - addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_4[3] = 'e' - - addi $t0, $zero, 110 - sb $t0, 12($v0) # internal_4[4] = 'n' - - addi $t0, $zero, 116 - sb $t0, 13($v0) # internal_4[5] = 't' - - addi $t0, $zero, 101 - sb $t0, 14($v0) # internal_4[6] = 'e' - - addi $t0, $zero, 114 - sb $t0, 15($v0) # internal_4[7] = 'r' - - addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_4[8] = ' ' - - addi $t0, $zero, 97 - sb $t0, 17($v0) # internal_4[9] = 'a' - - addi $t0, $zero, 58 - sb $t0, 18($v0) # internal_4[10] = ':' - - addi $t0, $zero, 10 - sb $t0, 19($v0) # internal_4[11] = '\n' - - sb $zero, 20($v0) # Null-terminator at the end of the string - - sw $v0, 192($sp) # internal_4 = "...enter a:\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_4 - lw $t0, 204($sp) - sw $t0, 0($sp) # Storing internal_4 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 200($sp) # internal_5 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 20 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_6[0] = '\t' - - addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_6[1] = 'T' - - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_6[2] = 'o' - - addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_6[3] = ' ' - - addi $t0, $zero, 110 - sb $t0, 12($v0) # internal_6[4] = 'n' - - addi $t0, $zero, 101 - sb $t0, 13($v0) # internal_6[5] = 'e' - - addi $t0, $zero, 103 - sb $t0, 14($v0) # internal_6[6] = 'g' - - addi $t0, $zero, 97 - sb $t0, 15($v0) # internal_6[7] = 'a' - - addi $t0, $zero, 116 - sb $t0, 16($v0) # internal_6[8] = 't' - - addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_6[9] = 'e' - - addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_6[10] = ' ' - - sb $zero, 19($v0) # Null-terminator at the end of the string - - sw $v0, 184($sp) # internal_6 = "\tTo negate " - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_6 - lw $t0, 196($sp) - sw $t0, 0($sp) # Storing internal_6 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 192($sp) # internal_7 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Get attribute avar of self - lw $t0, 212($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702246979 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702246979 - j object_get_attribute_8781702246979 - int_get_attribute_8781702246979: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 176($sp) # internal_8 = self.avar - j end_get_attribute_8781702246979 - bool_get_attribute_8781702246979: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 176($sp) # internal_8 = self.avar - j end_get_attribute_8781702246979 - object_get_attribute_8781702246979: - sw $t1, 176($sp) # internal_8 = avar - end_get_attribute_8781702246979: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_8 - lw $t0, 188($sp) - sw $t0, 0($sp) # Storing internal_8 - - # Calling function function_print_at_Main - jal function_print_at_Main - lw $ra, 8($sp) - sw $v1, 184($sp) # internal_9 = result of function_print_at_Main - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 21 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 46 - sb $t0, 8($v0) # internal_10[0] = '.' - - addi $t0, $zero, 46 - sb $t0, 9($v0) # internal_10[1] = '.' - - addi $t0, $zero, 46 - sb $t0, 10($v0) # internal_10[2] = '.' - - addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_10[3] = 'e' - - addi $t0, $zero, 110 - sb $t0, 12($v0) # internal_10[4] = 'n' - - addi $t0, $zero, 116 - sb $t0, 13($v0) # internal_10[5] = 't' - - addi $t0, $zero, 101 - sb $t0, 14($v0) # internal_10[6] = 'e' - - addi $t0, $zero, 114 - sb $t0, 15($v0) # internal_10[7] = 'r' - - addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_10[8] = ' ' - - addi $t0, $zero, 98 - sb $t0, 17($v0) # internal_10[9] = 'b' - - addi $t0, $zero, 58 - sb $t0, 18($v0) # internal_10[10] = ':' - - addi $t0, $zero, 10 - sb $t0, 19($v0) # internal_10[11] = '\n' - - sb $zero, 20($v0) # Null-terminator at the end of the string - - sw $v0, 168($sp) # internal_10 = "...enter b:\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_10 - lw $t0, 180($sp) - sw $t0, 0($sp) # Storing internal_10 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 176($sp) # internal_11 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 41 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 41 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_12[0] = '\t' - - addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_12[1] = 'T' - - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_12[2] = 'o' - - addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_12[3] = ' ' - - addi $t0, $zero, 102 - sb $t0, 12($v0) # internal_12[4] = 'f' - - addi $t0, $zero, 105 - sb $t0, 13($v0) # internal_12[5] = 'i' - - addi $t0, $zero, 110 - sb $t0, 14($v0) # internal_12[6] = 'n' - - addi $t0, $zero, 100 - sb $t0, 15($v0) # internal_12[7] = 'd' - - addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_12[8] = ' ' - - addi $t0, $zero, 116 - sb $t0, 17($v0) # internal_12[9] = 't' - - addi $t0, $zero, 104 - sb $t0, 18($v0) # internal_12[10] = 'h' - - addi $t0, $zero, 101 - sb $t0, 19($v0) # internal_12[11] = 'e' - - addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_12[12] = ' ' - - addi $t0, $zero, 100 - sb $t0, 21($v0) # internal_12[13] = 'd' - - addi $t0, $zero, 105 - sb $t0, 22($v0) # internal_12[14] = 'i' - - addi $t0, $zero, 102 - sb $t0, 23($v0) # internal_12[15] = 'f' - - addi $t0, $zero, 102 - sb $t0, 24($v0) # internal_12[16] = 'f' - - addi $t0, $zero, 101 - sb $t0, 25($v0) # internal_12[17] = 'e' - - addi $t0, $zero, 114 - sb $t0, 26($v0) # internal_12[18] = 'r' - - addi $t0, $zero, 101 - sb $t0, 27($v0) # internal_12[19] = 'e' - - addi $t0, $zero, 110 - sb $t0, 28($v0) # internal_12[20] = 'n' - - addi $t0, $zero, 99 - sb $t0, 29($v0) # internal_12[21] = 'c' - - addi $t0, $zero, 101 - sb $t0, 30($v0) # internal_12[22] = 'e' - - addi $t0, $zero, 32 - sb $t0, 31($v0) # internal_12[23] = ' ' - - addi $t0, $zero, 98 - sb $t0, 32($v0) # internal_12[24] = 'b' - - addi $t0, $zero, 101 - sb $t0, 33($v0) # internal_12[25] = 'e' - - addi $t0, $zero, 116 - sb $t0, 34($v0) # internal_12[26] = 't' - - addi $t0, $zero, 119 - sb $t0, 35($v0) # internal_12[27] = 'w' - - addi $t0, $zero, 101 - sb $t0, 36($v0) # internal_12[28] = 'e' - - addi $t0, $zero, 101 - sb $t0, 37($v0) # internal_12[29] = 'e' - - addi $t0, $zero, 110 - sb $t0, 38($v0) # internal_12[30] = 'n' - - addi $t0, $zero, 32 - sb $t0, 39($v0) # internal_12[31] = ' ' - - sb $zero, 40($v0) # Null-terminator at the end of the string - - sw $v0, 160($sp) # internal_12 = "\tTo find the difference between " - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_12 - lw $t0, 172($sp) - sw $t0, 0($sp) # Storing internal_12 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 168($sp) # internal_13 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Get attribute avar of self - lw $t0, 212($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702247087 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702247087 - j object_get_attribute_8781702247087 - int_get_attribute_8781702247087: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 152($sp) # internal_14 = self.avar - j end_get_attribute_8781702247087 - bool_get_attribute_8781702247087: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 152($sp) # internal_14 = self.avar - j end_get_attribute_8781702247087 - object_get_attribute_8781702247087: - sw $t1, 152($sp) # internal_14 = avar - end_get_attribute_8781702247087: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_14 - lw $t0, 164($sp) - sw $t0, 0($sp) # Storing internal_14 - - # Calling function function_print_at_Main - jal function_print_at_Main - lw $ra, 8($sp) - sw $v1, 160($sp) # internal_15 = result of function_print_at_Main - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 39 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 39 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 97 - sb $t0, 8($v0) # internal_16[0] = 'a' - - addi $t0, $zero, 110 - sb $t0, 9($v0) # internal_16[1] = 'n' - - addi $t0, $zero, 100 - sb $t0, 10($v0) # internal_16[2] = 'd' - - addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_16[3] = ' ' - - addi $t0, $zero, 97 - sb $t0, 12($v0) # internal_16[4] = 'a' - - addi $t0, $zero, 110 - sb $t0, 13($v0) # internal_16[5] = 'n' - - addi $t0, $zero, 111 - sb $t0, 14($v0) # internal_16[6] = 'o' - - addi $t0, $zero, 116 - sb $t0, 15($v0) # internal_16[7] = 't' - - addi $t0, $zero, 104 - sb $t0, 16($v0) # internal_16[8] = 'h' - - addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_16[9] = 'e' - - addi $t0, $zero, 114 - sb $t0, 18($v0) # internal_16[10] = 'r' - - addi $t0, $zero, 32 - sb $t0, 19($v0) # internal_16[11] = ' ' - - addi $t0, $zero, 110 - sb $t0, 20($v0) # internal_16[12] = 'n' - - addi $t0, $zero, 117 - sb $t0, 21($v0) # internal_16[13] = 'u' - - addi $t0, $zero, 109 - sb $t0, 22($v0) # internal_16[14] = 'm' - - addi $t0, $zero, 98 - sb $t0, 23($v0) # internal_16[15] = 'b' - - addi $t0, $zero, 101 - sb $t0, 24($v0) # internal_16[16] = 'e' - - addi $t0, $zero, 114 - sb $t0, 25($v0) # internal_16[17] = 'r' - - addi $t0, $zero, 46 - sb $t0, 26($v0) # internal_16[18] = '.' - - addi $t0, $zero, 46 - sb $t0, 27($v0) # internal_16[19] = '.' - - addi $t0, $zero, 46 - sb $t0, 28($v0) # internal_16[20] = '.' - - addi $t0, $zero, 101 - sb $t0, 29($v0) # internal_16[21] = 'e' - - addi $t0, $zero, 110 - sb $t0, 30($v0) # internal_16[22] = 'n' - - addi $t0, $zero, 116 - sb $t0, 31($v0) # internal_16[23] = 't' - - addi $t0, $zero, 101 - sb $t0, 32($v0) # internal_16[24] = 'e' - - addi $t0, $zero, 114 - sb $t0, 33($v0) # internal_16[25] = 'r' - - addi $t0, $zero, 32 - sb $t0, 34($v0) # internal_16[26] = ' ' - - addi $t0, $zero, 99 - sb $t0, 35($v0) # internal_16[27] = 'c' - - addi $t0, $zero, 58 - sb $t0, 36($v0) # internal_16[28] = ':' - - addi $t0, $zero, 10 - sb $t0, 37($v0) # internal_16[29] = '\n' - - sb $zero, 38($v0) # Null-terminator at the end of the string - - sw $v0, 144($sp) # internal_16 = "and another number...enter c:\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_16 - lw $t0, 156($sp) - sw $t0, 0($sp) # Storing internal_16 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 152($sp) # internal_17 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 35 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 35 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_18[0] = '\t' - - addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_18[1] = 'T' - - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_18[2] = 'o' - - addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_18[3] = ' ' - - addi $t0, $zero, 102 - sb $t0, 12($v0) # internal_18[4] = 'f' - - addi $t0, $zero, 105 - sb $t0, 13($v0) # internal_18[5] = 'i' - - addi $t0, $zero, 110 - sb $t0, 14($v0) # internal_18[6] = 'n' - - addi $t0, $zero, 100 - sb $t0, 15($v0) # internal_18[7] = 'd' - - addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_18[8] = ' ' - - addi $t0, $zero, 116 - sb $t0, 17($v0) # internal_18[9] = 't' - - addi $t0, $zero, 104 - sb $t0, 18($v0) # internal_18[10] = 'h' - - addi $t0, $zero, 101 - sb $t0, 19($v0) # internal_18[11] = 'e' - - addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_18[12] = ' ' - - addi $t0, $zero, 102 - sb $t0, 21($v0) # internal_18[13] = 'f' - - addi $t0, $zero, 97 - sb $t0, 22($v0) # internal_18[14] = 'a' - - addi $t0, $zero, 99 - sb $t0, 23($v0) # internal_18[15] = 'c' - - addi $t0, $zero, 116 - sb $t0, 24($v0) # internal_18[16] = 't' - - addi $t0, $zero, 111 - sb $t0, 25($v0) # internal_18[17] = 'o' - - addi $t0, $zero, 114 - sb $t0, 26($v0) # internal_18[18] = 'r' - - addi $t0, $zero, 105 - sb $t0, 27($v0) # internal_18[19] = 'i' - - addi $t0, $zero, 97 - sb $t0, 28($v0) # internal_18[20] = 'a' - - addi $t0, $zero, 108 - sb $t0, 29($v0) # internal_18[21] = 'l' - - addi $t0, $zero, 32 - sb $t0, 30($v0) # internal_18[22] = ' ' - - addi $t0, $zero, 111 - sb $t0, 31($v0) # internal_18[23] = 'o' - - addi $t0, $zero, 102 - sb $t0, 32($v0) # internal_18[24] = 'f' - - addi $t0, $zero, 32 - sb $t0, 33($v0) # internal_18[25] = ' ' - - sb $zero, 34($v0) # Null-terminator at the end of the string - - sw $v0, 136($sp) # internal_18 = "\tTo find the factorial of " - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_18 - lw $t0, 148($sp) - sw $t0, 0($sp) # Storing internal_18 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 144($sp) # internal_19 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Get attribute avar of self - lw $t0, 212($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702247711 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702247711 - j object_get_attribute_8781702247711 - int_get_attribute_8781702247711: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 128($sp) # internal_20 = self.avar - j end_get_attribute_8781702247711 - bool_get_attribute_8781702247711: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 128($sp) # internal_20 = self.avar - j end_get_attribute_8781702247711 - object_get_attribute_8781702247711: - sw $t1, 128($sp) # internal_20 = avar - end_get_attribute_8781702247711: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_20 - lw $t0, 140($sp) - sw $t0, 0($sp) # Storing internal_20 - - # Calling function function_print_at_Main - jal function_print_at_Main - lw $ra, 8($sp) - sw $v1, 136($sp) # internal_21 = result of function_print_at_Main - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 21 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 46 - sb $t0, 8($v0) # internal_22[0] = '.' - - addi $t0, $zero, 46 - sb $t0, 9($v0) # internal_22[1] = '.' - - addi $t0, $zero, 46 - sb $t0, 10($v0) # internal_22[2] = '.' - - addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_22[3] = 'e' - - addi $t0, $zero, 110 - sb $t0, 12($v0) # internal_22[4] = 'n' - - addi $t0, $zero, 116 - sb $t0, 13($v0) # internal_22[5] = 't' - - addi $t0, $zero, 101 - sb $t0, 14($v0) # internal_22[6] = 'e' - - addi $t0, $zero, 114 - sb $t0, 15($v0) # internal_22[7] = 'r' - - addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_22[8] = ' ' - - addi $t0, $zero, 100 - sb $t0, 17($v0) # internal_22[9] = 'd' - - addi $t0, $zero, 58 - sb $t0, 18($v0) # internal_22[10] = ':' - - addi $t0, $zero, 10 - sb $t0, 19($v0) # internal_22[11] = '\n' - - sb $zero, 20($v0) # Null-terminator at the end of the string - - sw $v0, 120($sp) # internal_22 = "...enter d:\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_22 - lw $t0, 132($sp) - sw $t0, 0($sp) # Storing internal_22 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 128($sp) # internal_23 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 20 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_24[0] = '\t' - - addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_24[1] = 'T' - - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_24[2] = 'o' - - addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_24[3] = ' ' - - addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_24[4] = 's' - - addi $t0, $zero, 113 - sb $t0, 13($v0) # internal_24[5] = 'q' - - addi $t0, $zero, 117 - sb $t0, 14($v0) # internal_24[6] = 'u' - - addi $t0, $zero, 97 - sb $t0, 15($v0) # internal_24[7] = 'a' - - addi $t0, $zero, 114 - sb $t0, 16($v0) # internal_24[8] = 'r' - - addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_24[9] = 'e' - - addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_24[10] = ' ' - - sb $zero, 19($v0) # Null-terminator at the end of the string - - sw $v0, 112($sp) # internal_24 = "\tTo square " - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_24 - lw $t0, 124($sp) - sw $t0, 0($sp) # Storing internal_24 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 120($sp) # internal_25 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Get attribute avar of self - lw $t0, 212($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702247819 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702247819 - j object_get_attribute_8781702247819 - int_get_attribute_8781702247819: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 104($sp) # internal_26 = self.avar - j end_get_attribute_8781702247819 - bool_get_attribute_8781702247819: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 104($sp) # internal_26 = self.avar - j end_get_attribute_8781702247819 - object_get_attribute_8781702247819: - sw $t1, 104($sp) # internal_26 = avar - end_get_attribute_8781702247819: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_26 - lw $t0, 116($sp) - sw $t0, 0($sp) # Storing internal_26 - - # Calling function function_print_at_Main - jal function_print_at_Main - lw $ra, 8($sp) - sw $v1, 112($sp) # internal_27 = result of function_print_at_Main - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 21 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 46 - sb $t0, 8($v0) # internal_28[0] = '.' - - addi $t0, $zero, 46 - sb $t0, 9($v0) # internal_28[1] = '.' - - addi $t0, $zero, 46 - sb $t0, 10($v0) # internal_28[2] = '.' - - addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_28[3] = 'e' - - addi $t0, $zero, 110 - sb $t0, 12($v0) # internal_28[4] = 'n' - - addi $t0, $zero, 116 - sb $t0, 13($v0) # internal_28[5] = 't' - - addi $t0, $zero, 101 - sb $t0, 14($v0) # internal_28[6] = 'e' - - addi $t0, $zero, 114 - sb $t0, 15($v0) # internal_28[7] = 'r' - - addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_28[8] = ' ' - - addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_28[9] = 'e' - - addi $t0, $zero, 58 - sb $t0, 18($v0) # internal_28[10] = ':' - - addi $t0, $zero, 10 - sb $t0, 19($v0) # internal_28[11] = '\n' - - sb $zero, 20($v0) # Null-terminator at the end of the string - - sw $v0, 96($sp) # internal_28 = "...enter e:\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_28 - lw $t0, 108($sp) - sw $t0, 0($sp) # Storing internal_28 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 104($sp) # internal_29 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 18 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 18 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_30[0] = '\t' - - addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_30[1] = 'T' - - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_30[2] = 'o' - - addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_30[3] = ' ' - - addi $t0, $zero, 99 - sb $t0, 12($v0) # internal_30[4] = 'c' - - addi $t0, $zero, 117 - sb $t0, 13($v0) # internal_30[5] = 'u' - - addi $t0, $zero, 98 - sb $t0, 14($v0) # internal_30[6] = 'b' - - addi $t0, $zero, 101 - sb $t0, 15($v0) # internal_30[7] = 'e' - - addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_30[8] = ' ' - - sb $zero, 17($v0) # Null-terminator at the end of the string - - sw $v0, 88($sp) # internal_30 = "\tTo cube " - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_30 - lw $t0, 100($sp) - sw $t0, 0($sp) # Storing internal_30 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 96($sp) # internal_31 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Get attribute avar of self - lw $t0, 212($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702247927 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702247927 - j object_get_attribute_8781702247927 - int_get_attribute_8781702247927: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 80($sp) # internal_32 = self.avar - j end_get_attribute_8781702247927 - bool_get_attribute_8781702247927: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 80($sp) # internal_32 = self.avar - j end_get_attribute_8781702247927 - object_get_attribute_8781702247927: - sw $t1, 80($sp) # internal_32 = avar - end_get_attribute_8781702247927: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_32 - lw $t0, 92($sp) - sw $t0, 0($sp) # Storing internal_32 - - # Calling function function_print_at_Main - jal function_print_at_Main - lw $ra, 8($sp) - sw $v1, 88($sp) # internal_33 = result of function_print_at_Main - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 21 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 46 - sb $t0, 8($v0) # internal_34[0] = '.' - - addi $t0, $zero, 46 - sb $t0, 9($v0) # internal_34[1] = '.' - - addi $t0, $zero, 46 - sb $t0, 10($v0) # internal_34[2] = '.' - - addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_34[3] = 'e' - - addi $t0, $zero, 110 - sb $t0, 12($v0) # internal_34[4] = 'n' - - addi $t0, $zero, 116 - sb $t0, 13($v0) # internal_34[5] = 't' - - addi $t0, $zero, 101 - sb $t0, 14($v0) # internal_34[6] = 'e' - - addi $t0, $zero, 114 - sb $t0, 15($v0) # internal_34[7] = 'r' - - addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_34[8] = ' ' - - addi $t0, $zero, 102 - sb $t0, 17($v0) # internal_34[9] = 'f' - - addi $t0, $zero, 58 - sb $t0, 18($v0) # internal_34[10] = ':' - - addi $t0, $zero, 10 - sb $t0, 19($v0) # internal_34[11] = '\n' - - sb $zero, 20($v0) # Null-terminator at the end of the string - - sw $v0, 72($sp) # internal_34 = "...enter f:\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_34 - lw $t0, 84($sp) - sw $t0, 0($sp) # Storing internal_34 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 80($sp) # internal_35 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 25 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 25 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_36[0] = '\t' - - addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_36[1] = 'T' - - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_36[2] = 'o' - - addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_36[3] = ' ' - - addi $t0, $zero, 102 - sb $t0, 12($v0) # internal_36[4] = 'f' - - addi $t0, $zero, 105 - sb $t0, 13($v0) # internal_36[5] = 'i' - - addi $t0, $zero, 110 - sb $t0, 14($v0) # internal_36[6] = 'n' - - addi $t0, $zero, 100 - sb $t0, 15($v0) # internal_36[7] = 'd' - - addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_36[8] = ' ' - - addi $t0, $zero, 111 - sb $t0, 17($v0) # internal_36[9] = 'o' - - addi $t0, $zero, 117 - sb $t0, 18($v0) # internal_36[10] = 'u' - - addi $t0, $zero, 116 - sb $t0, 19($v0) # internal_36[11] = 't' - - addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_36[12] = ' ' - - addi $t0, $zero, 105 - sb $t0, 21($v0) # internal_36[13] = 'i' - - addi $t0, $zero, 102 - sb $t0, 22($v0) # internal_36[14] = 'f' - - addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_36[15] = ' ' - - sb $zero, 24($v0) # Null-terminator at the end of the string - - sw $v0, 64($sp) # internal_36 = "\tTo find out if " - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_36 - lw $t0, 76($sp) - sw $t0, 0($sp) # Storing internal_36 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 72($sp) # internal_37 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Get attribute avar of self - lw $t0, 212($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702248039 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702248039 - j object_get_attribute_8781702248039 - int_get_attribute_8781702248039: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 56($sp) # internal_38 = self.avar - j end_get_attribute_8781702248039 - bool_get_attribute_8781702248039: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 56($sp) # internal_38 = self.avar - j end_get_attribute_8781702248039 - object_get_attribute_8781702248039: - sw $t1, 56($sp) # internal_38 = avar - end_get_attribute_8781702248039: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_38 - lw $t0, 68($sp) - sw $t0, 0($sp) # Storing internal_38 - - # Calling function function_print_at_Main - jal function_print_at_Main - lw $ra, 8($sp) - sw $v1, 64($sp) # internal_39 = result of function_print_at_Main - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 39 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 39 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 105 - sb $t0, 8($v0) # internal_40[0] = 'i' - - addi $t0, $zero, 115 - sb $t0, 9($v0) # internal_40[1] = 's' - - addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_40[2] = ' ' - - addi $t0, $zero, 97 - sb $t0, 11($v0) # internal_40[3] = 'a' - - addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_40[4] = ' ' - - addi $t0, $zero, 109 - sb $t0, 13($v0) # internal_40[5] = 'm' - - addi $t0, $zero, 117 - sb $t0, 14($v0) # internal_40[6] = 'u' - - addi $t0, $zero, 108 - sb $t0, 15($v0) # internal_40[7] = 'l' - - addi $t0, $zero, 116 - sb $t0, 16($v0) # internal_40[8] = 't' - - addi $t0, $zero, 105 - sb $t0, 17($v0) # internal_40[9] = 'i' - - addi $t0, $zero, 112 - sb $t0, 18($v0) # internal_40[10] = 'p' - - addi $t0, $zero, 108 - sb $t0, 19($v0) # internal_40[11] = 'l' - - addi $t0, $zero, 101 - sb $t0, 20($v0) # internal_40[12] = 'e' - - addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_40[13] = ' ' - - addi $t0, $zero, 111 - sb $t0, 22($v0) # internal_40[14] = 'o' - - addi $t0, $zero, 102 - sb $t0, 23($v0) # internal_40[15] = 'f' - - addi $t0, $zero, 32 - sb $t0, 24($v0) # internal_40[16] = ' ' - - addi $t0, $zero, 51 - sb $t0, 25($v0) # internal_40[17] = '3' - - addi $t0, $zero, 46 - sb $t0, 26($v0) # internal_40[18] = '.' - - addi $t0, $zero, 46 - sb $t0, 27($v0) # internal_40[19] = '.' - - addi $t0, $zero, 46 - sb $t0, 28($v0) # internal_40[20] = '.' - - addi $t0, $zero, 101 - sb $t0, 29($v0) # internal_40[21] = 'e' - - addi $t0, $zero, 110 - sb $t0, 30($v0) # internal_40[22] = 'n' - - addi $t0, $zero, 116 - sb $t0, 31($v0) # internal_40[23] = 't' - - addi $t0, $zero, 101 - sb $t0, 32($v0) # internal_40[24] = 'e' - - addi $t0, $zero, 114 - sb $t0, 33($v0) # internal_40[25] = 'r' - - addi $t0, $zero, 32 - sb $t0, 34($v0) # internal_40[26] = ' ' - - addi $t0, $zero, 103 - sb $t0, 35($v0) # internal_40[27] = 'g' - - addi $t0, $zero, 58 - sb $t0, 36($v0) # internal_40[28] = ':' - - addi $t0, $zero, 10 - sb $t0, 37($v0) # internal_40[29] = '\n' - - sb $zero, 38($v0) # Null-terminator at the end of the string - - sw $v0, 48($sp) # internal_40 = "is a multiple of 3...enter g:\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_40 - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing internal_40 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 56($sp) # internal_41 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 20 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_42[0] = '\t' - - addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_42[1] = 'T' - - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_42[2] = 'o' - - addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_42[3] = ' ' - - addi $t0, $zero, 100 - sb $t0, 12($v0) # internal_42[4] = 'd' - - addi $t0, $zero, 105 - sb $t0, 13($v0) # internal_42[5] = 'i' - - addi $t0, $zero, 118 - sb $t0, 14($v0) # internal_42[6] = 'v' - - addi $t0, $zero, 105 - sb $t0, 15($v0) # internal_42[7] = 'i' - - addi $t0, $zero, 100 - sb $t0, 16($v0) # internal_42[8] = 'd' - - addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_42[9] = 'e' - - addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_42[10] = ' ' - - sb $zero, 19($v0) # Null-terminator at the end of the string - - sw $v0, 40($sp) # internal_42 = "\tTo divide " - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_42 - lw $t0, 52($sp) - sw $t0, 0($sp) # Storing internal_42 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 48($sp) # internal_43 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Get attribute avar of self - lw $t0, 212($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702248147 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702248147 - j object_get_attribute_8781702248147 - int_get_attribute_8781702248147: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 32($sp) # internal_44 = self.avar - j end_get_attribute_8781702248147 - bool_get_attribute_8781702248147: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 32($sp) # internal_44 = self.avar - j end_get_attribute_8781702248147 - object_get_attribute_8781702248147: - sw $t1, 32($sp) # internal_44 = avar - end_get_attribute_8781702248147: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_44 - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_44 - - # Calling function function_print_at_Main - jal function_print_at_Main - lw $ra, 8($sp) - sw $v1, 40($sp) # internal_45 = result of function_print_at_Main - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 25 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 25 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 98 - sb $t0, 8($v0) # internal_46[0] = 'b' - - addi $t0, $zero, 121 - sb $t0, 9($v0) # internal_46[1] = 'y' - - addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_46[2] = ' ' - - addi $t0, $zero, 56 - sb $t0, 11($v0) # internal_46[3] = '8' - - addi $t0, $zero, 46 - sb $t0, 12($v0) # internal_46[4] = '.' - - addi $t0, $zero, 46 - sb $t0, 13($v0) # internal_46[5] = '.' - - addi $t0, $zero, 46 - sb $t0, 14($v0) # internal_46[6] = '.' - - addi $t0, $zero, 101 - sb $t0, 15($v0) # internal_46[7] = 'e' - - addi $t0, $zero, 110 - sb $t0, 16($v0) # internal_46[8] = 'n' - - addi $t0, $zero, 116 - sb $t0, 17($v0) # internal_46[9] = 't' - - addi $t0, $zero, 101 - sb $t0, 18($v0) # internal_46[10] = 'e' - - addi $t0, $zero, 114 - sb $t0, 19($v0) # internal_46[11] = 'r' - - addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_46[12] = ' ' - - addi $t0, $zero, 104 - sb $t0, 21($v0) # internal_46[13] = 'h' - - addi $t0, $zero, 58 - sb $t0, 22($v0) # internal_46[14] = ':' - - addi $t0, $zero, 10 - sb $t0, 23($v0) # internal_46[15] = '\n' - - sb $zero, 24($v0) # Null-terminator at the end of the string - - sw $v0, 24($sp) # internal_46 = "by 8...enter h:\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_46 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_46 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 32($sp) # internal_47 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 41 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 41 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_48[0] = '\t' - - addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_48[1] = 'T' - - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_48[2] = 'o' - - addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_48[3] = ' ' - - addi $t0, $zero, 103 - sb $t0, 12($v0) # internal_48[4] = 'g' - - addi $t0, $zero, 101 - sb $t0, 13($v0) # internal_48[5] = 'e' - - addi $t0, $zero, 116 - sb $t0, 14($v0) # internal_48[6] = 't' - - addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_48[7] = ' ' - - addi $t0, $zero, 97 - sb $t0, 16($v0) # internal_48[8] = 'a' - - addi $t0, $zero, 32 - sb $t0, 17($v0) # internal_48[9] = ' ' - - addi $t0, $zero, 110 - sb $t0, 18($v0) # internal_48[10] = 'n' - - addi $t0, $zero, 101 - sb $t0, 19($v0) # internal_48[11] = 'e' - - addi $t0, $zero, 119 - sb $t0, 20($v0) # internal_48[12] = 'w' - - addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_48[13] = ' ' - - addi $t0, $zero, 110 - sb $t0, 22($v0) # internal_48[14] = 'n' - - addi $t0, $zero, 117 - sb $t0, 23($v0) # internal_48[15] = 'u' - - addi $t0, $zero, 109 - sb $t0, 24($v0) # internal_48[16] = 'm' - - addi $t0, $zero, 98 - sb $t0, 25($v0) # internal_48[17] = 'b' - - addi $t0, $zero, 101 - sb $t0, 26($v0) # internal_48[18] = 'e' - - addi $t0, $zero, 114 - sb $t0, 27($v0) # internal_48[19] = 'r' - - addi $t0, $zero, 46 - sb $t0, 28($v0) # internal_48[20] = '.' - - addi $t0, $zero, 46 - sb $t0, 29($v0) # internal_48[21] = '.' - - addi $t0, $zero, 46 - sb $t0, 30($v0) # internal_48[22] = '.' - - addi $t0, $zero, 101 - sb $t0, 31($v0) # internal_48[23] = 'e' - - addi $t0, $zero, 110 - sb $t0, 32($v0) # internal_48[24] = 'n' - - addi $t0, $zero, 116 - sb $t0, 33($v0) # internal_48[25] = 't' - - addi $t0, $zero, 101 - sb $t0, 34($v0) # internal_48[26] = 'e' - - addi $t0, $zero, 114 - sb $t0, 35($v0) # internal_48[27] = 'r' - - addi $t0, $zero, 32 - sb $t0, 36($v0) # internal_48[28] = ' ' - - addi $t0, $zero, 106 - sb $t0, 37($v0) # internal_48[29] = 'j' - - addi $t0, $zero, 58 - sb $t0, 38($v0) # internal_48[30] = ':' - - addi $t0, $zero, 10 - sb $t0, 39($v0) # internal_48[31] = '\n' - - sb $zero, 40($v0) # Null-terminator at the end of the string - - sw $v0, 16($sp) # internal_48 = "\tTo get a new number...enter j:\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_48 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_48 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 24($sp) # internal_49 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 30 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 30 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_50[0] = '\t' - - addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_50[1] = 'T' - - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_50[2] = 'o' - - addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_50[3] = ' ' - - addi $t0, $zero, 113 - sb $t0, 12($v0) # internal_50[4] = 'q' - - addi $t0, $zero, 117 - sb $t0, 13($v0) # internal_50[5] = 'u' - - addi $t0, $zero, 105 - sb $t0, 14($v0) # internal_50[6] = 'i' - - addi $t0, $zero, 116 - sb $t0, 15($v0) # internal_50[7] = 't' - - addi $t0, $zero, 46 - sb $t0, 16($v0) # internal_50[8] = '.' - - addi $t0, $zero, 46 - sb $t0, 17($v0) # internal_50[9] = '.' - - addi $t0, $zero, 46 - sb $t0, 18($v0) # internal_50[10] = '.' - - addi $t0, $zero, 101 - sb $t0, 19($v0) # internal_50[11] = 'e' - - addi $t0, $zero, 110 - sb $t0, 20($v0) # internal_50[12] = 'n' - - addi $t0, $zero, 116 - sb $t0, 21($v0) # internal_50[13] = 't' - - addi $t0, $zero, 101 - sb $t0, 22($v0) # internal_50[14] = 'e' - - addi $t0, $zero, 114 - sb $t0, 23($v0) # internal_50[15] = 'r' - - addi $t0, $zero, 32 - sb $t0, 24($v0) # internal_50[16] = ' ' - - addi $t0, $zero, 113 - sb $t0, 25($v0) # internal_50[17] = 'q' - - addi $t0, $zero, 58 - sb $t0, 26($v0) # internal_50[18] = ':' - - addi $t0, $zero, 10 - sb $t0, 27($v0) # internal_50[19] = '\n' - - addi $t0, $zero, 10 - sb $t0, 28($v0) # internal_50[20] = '\n' - - sb $zero, 29($v0) # Null-terminator at the end of the string - - sw $v0, 8($sp) # internal_50 = "\tTo quit...enter q:\n\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_50 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_50 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 16($sp) # internal_51 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument self - lw $t0, 220($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_in_string_at_IO - jal function_in_string_at_IO - lw $ra, 4($sp) - sw $v1, 8($sp) # internal_52 = result of function_in_string_at_IO - addi $sp, $sp, 8 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 212 - - jr $ra - - function_prompt_at_Main: - # Function parameters - # $ra = 24($sp) - # self = 20($sp) - - # Reserving space for local variables - addi $sp, $sp, -20 - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_0[0] = '\n' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 16($sp) # internal_0 = "\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_0 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 24($sp) # internal_1 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 35 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 35 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 80 - sb $t0, 8($v0) # internal_2[0] = 'P' - - addi $t0, $zero, 108 - sb $t0, 9($v0) # internal_2[1] = 'l' - - addi $t0, $zero, 101 - sb $t0, 10($v0) # internal_2[2] = 'e' - - addi $t0, $zero, 97 - sb $t0, 11($v0) # internal_2[3] = 'a' - - addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_2[4] = 's' - - addi $t0, $zero, 101 - sb $t0, 13($v0) # internal_2[5] = 'e' - - addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_2[6] = ' ' - - addi $t0, $zero, 101 - sb $t0, 15($v0) # internal_2[7] = 'e' - - addi $t0, $zero, 110 - sb $t0, 16($v0) # internal_2[8] = 'n' - - addi $t0, $zero, 116 - sb $t0, 17($v0) # internal_2[9] = 't' - - addi $t0, $zero, 101 - sb $t0, 18($v0) # internal_2[10] = 'e' - - addi $t0, $zero, 114 - sb $t0, 19($v0) # internal_2[11] = 'r' - - addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_2[12] = ' ' - - addi $t0, $zero, 97 - sb $t0, 21($v0) # internal_2[13] = 'a' - - addi $t0, $zero, 32 - sb $t0, 22($v0) # internal_2[14] = ' ' - - addi $t0, $zero, 110 - sb $t0, 23($v0) # internal_2[15] = 'n' - - addi $t0, $zero, 117 - sb $t0, 24($v0) # internal_2[16] = 'u' - - addi $t0, $zero, 109 - sb $t0, 25($v0) # internal_2[17] = 'm' - - addi $t0, $zero, 98 - sb $t0, 26($v0) # internal_2[18] = 'b' - - addi $t0, $zero, 101 - sb $t0, 27($v0) # internal_2[19] = 'e' - - addi $t0, $zero, 114 - sb $t0, 28($v0) # internal_2[20] = 'r' - - addi $t0, $zero, 46 - sb $t0, 29($v0) # internal_2[21] = '.' - - addi $t0, $zero, 46 - sb $t0, 30($v0) # internal_2[22] = '.' - - addi $t0, $zero, 46 - sb $t0, 31($v0) # internal_2[23] = '.' - - addi $t0, $zero, 32 - sb $t0, 32($v0) # internal_2[24] = ' ' - - addi $t0, $zero, 32 - sb $t0, 33($v0) # internal_2[25] = ' ' - - sb $zero, 34($v0) # Null-terminator at the end of the string - - sw $v0, 8($sp) # internal_2 = "Please enter a number... " - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_2 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 16($sp) # internal_3 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument self - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_in_string_at_IO - jal function_in_string_at_IO - lw $ra, 4($sp) - sw $v1, 8($sp) # internal_4 = result of function_in_string_at_IO - addi $sp, $sp, 8 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 20 - - jr $ra - - function_get_int_at_Main: - # Function parameters - # $ra = 24($sp) - # self = 20($sp) - - # Reserving space for local variables - addi $sp, $sp, -20 - - # Allocating A2I - li $v0, 9 - lw $a0, type_A2I - syscall - la $t0, type_A2I # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 12($sp) # internal_1 = address of allocated object A2I - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_1 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function___init___at_A2I - jal function___init___at_A2I - lw $ra, 4($sp) - sw $v1, 20($sp) # internal_1 = result of function___init___at_A2I - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument z - lw $t0, 28($sp) - sw $t0, 4($sp) # Storing z - - # Argument internal_1 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 28($sp) # z = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument self - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_prompt_at_Main - jal function_prompt_at_Main - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_3 = result of function_prompt_at_Main - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument s - lw $t0, 20($sp) - sw $t0, 4($sp) # Storing s - - # Argument internal_3 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_3 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 20($sp) # s = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument z - lw $t0, 28($sp) - sw $t0, 4($sp) # Storing z - - # Argument s - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing s - - # Calling function function_a2i_at_A2I - jal function_a2i_at_A2I - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_4 = result of function_a2i_at_A2I - addi $sp, $sp, 12 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 20 - - jr $ra - - function_is_even_at_Main: - # Function parameters - # $ra = 96($sp) - # self = 92($sp) - # num = 88($sp) - - # Reserving space for local variables - addi $sp, $sp, -88 - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument x - lw $t0, 96($sp) - sw $t0, 4($sp) # Storing x - - # Argument num - lw $t0, 100($sp) - sw $t0, 0($sp) # Storing num - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 96($sp) # x = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 76($sp) # internal_2 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 72($sp) # internal_3 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument x - lw $t0, 96($sp) - sw $t0, 4($sp) # Storing x - - # Argument internal_3 - lw $t0, 84($sp) - sw $t0, 0($sp) # Storing internal_3 - - # Calling function function_less_than - jal function_less_than - lw $ra, 8($sp) - sw $v1, 80($sp) # internal_4 = result of function_less_than - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_2 = internal_4 - lw $t0, 68($sp) - sw $t0, 76($sp) - - # If internal_2 then goto then_8781702295071 - lw $t0, 76($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702295071 - - # Jumping to else_8781702295071 - j else_8781702295071 - - then_8781702295071: - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 64($sp) # internal_5 = address of allocated object Int - - # Allocating Int 4294967295 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 4294967295 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_6 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 56($sp) # internal_7 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument x - lw $t0, 96($sp) - sw $t0, 4($sp) # Storing x - - # Argument internal_6 - lw $t0, 72($sp) - sw $t0, 0($sp) # Storing internal_6 - - # Calling function function_xor - jal function_xor - lw $ra, 8($sp) - sw $v1, 68($sp) # internal_7 = result of function_xor - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_7 - lw $t0, 68($sp) - sw $t0, 4($sp) # Storing internal_7 - - # Argument internal_5 - lw $t0, 76($sp) - sw $t0, 0($sp) # Storing internal_5 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 68($sp) # internal_7 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 104($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_7 - lw $t0, 68($sp) - sw $t0, 0($sp) # Storing internal_7 - - # Calling function function_is_even_at_Main - jal function_is_even_at_Main - lw $ra, 8($sp) - sw $v1, 64($sp) # internal_8 = result of function_is_even_at_Main - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_1 = internal_8 - lw $t0, 52($sp) - sw $t0, 80($sp) - - # Jumping to endif_8781702295071 - j endif_8781702295071 - - else_8781702295071: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_10 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_11 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_11 - lw $t0, 52($sp) - sw $t0, 4($sp) # Storing internal_11 - - # Argument x - lw $t0, 96($sp) - sw $t0, 0($sp) # Storing x - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 48($sp) # internal_12 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_10 = internal_12 - lw $t0, 36($sp) - sw $t0, 44($sp) - - # If internal_10 then goto then_8781702295074 - lw $t0, 44($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702295074 - - # Jumping to else_8781702295074 - j else_8781702295074 - - then_8781702295074: - - # Allocating Bool 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_13 = address of allocated object Int - - # internal_9 = internal_13 - lw $t0, 32($sp) - sw $t0, 48($sp) - - # Jumping to endif_8781702295074 - j endif_8781702295074 - - else_8781702295074: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_15 = address of allocated object Int - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_16 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_16 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_16 - - # Argument x - lw $t0, 96($sp) - sw $t0, 0($sp) # Storing x - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 28($sp) # internal_17 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_15 = internal_17 - lw $t0, 16($sp) - sw $t0, 24($sp) - - # If internal_15 then goto then_8781702295080 - lw $t0, 24($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702295080 - - # Jumping to else_8781702295080 - j else_8781702295080 - - then_8781702295080: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_18 = address of allocated object Int - - # internal_14 = internal_18 - lw $t0, 12($sp) - sw $t0, 28($sp) - - # Jumping to endif_8781702295080 - j endif_8781702295080 - - else_8781702295080: - - # Allocating Int 2 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 2 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_19 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument x - lw $t0, 96($sp) - sw $t0, 4($sp) # Storing x - - # Argument internal_19 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_19 - - # Calling function function_sub - jal function_sub - lw $ra, 8($sp) - sw $v1, 16($sp) # internal_20 = result of function_sub - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 104($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_20 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_20 - - # Calling function function_is_even_at_Main - jal function_is_even_at_Main - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_21 = result of function_is_even_at_Main - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_14 = internal_21 - lw $t0, 0($sp) - sw $t0, 28($sp) - - # Jumping to endif_8781702295080 - j endif_8781702295080 - - endif_8781702295080: - - # internal_9 = internal_14 - lw $t0, 28($sp) - sw $t0, 48($sp) - - # Jumping to endif_8781702295074 - j endif_8781702295074 - - endif_8781702295074: - - # internal_1 = internal_9 - lw $t0, 48($sp) - sw $t0, 80($sp) - - # Jumping to endif_8781702295071 - j endif_8781702295071 - - endif_8781702295071: - - # Loading return value in $v1 - lw $v1, 80($sp) - - # Freeing space for local variables - addi $sp, $sp, 88 - - jr $ra - - function_class_type_at_Main: - # Function parameters - # $ra = 300($sp) - # self = 296($sp) - # var = 292($sp) - - # Reserving space for local variables - addi $sp, $sp, -292 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 288($sp) # internal_0 = address of allocated object Int - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 284($sp) # internal_1 = address of allocated object Int - - # Allocating Int 6 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 6 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 280($sp) # internal_2 = address of allocated object Int - - # Allocating NUll to internal_3 - sw $zero, 276($sp) # internal_3 = 0 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 272($sp) # internal_4 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 260($sp) # internal_7 = address of allocated object Int - - # internal_5 = typeof var that is the first word of the object - lw $t0, 292($sp) - lw $t0, 0($t0) - sw $t0, 268($sp) - - # internal_6 = internal_5 - lw $t0, 268($sp) - sw $t0, 264($sp) - - while_start_8781702295173: - - # internal_7 = EqualAddress(internal_6, internal_3) - lw $t0, 264($sp) - lw $t1, 276($sp) - seq $t2, $t0, $t1 - lw $t0, 260($sp) - sw $t2, 8($t0) - - # If internal_7 then goto while_end_8781702295173 - lw $t0, 260($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_end_8781702295173 - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_4 - lw $t0, 284($sp) - sw $t0, 4($sp) # Storing internal_4 - - # Argument internal_1 - lw $t0, 296($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 284($sp) # internal_4 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_6 = ancestor of internal_6 - lw $t0, 264($sp) - lw $t0, 4($t0) - sw $t0, 264($sp) - - # Jumping to while_start_8781702295173 - j while_start_8781702295173 - - while_end_8781702295173: - - # internal_6 = internal_5 - lw $t0, 268($sp) - sw $t0, 264($sp) - - # initialize Array [internal_4] - lw $t0, 272($sp) # $t0 = internal_4 - lw $t0, 8($t0) # $t0 = value of the size - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - li $v0, 9 - move $a0, $t0 - syscall - sw $v0, 256($sp) # internal_8 = new Array[internal_4] - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 252($sp) # internal_9 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 248($sp) # internal_10 = address of allocated object Int - - foreach_start_8781702295173: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_9 - lw $t0, 264($sp) - sw $t0, 4($sp) # Storing internal_9 - - # Argument internal_4 - lw $t0, 284($sp) - sw $t0, 0($sp) # Storing internal_4 - - # Calling function function_less_than - jal function_less_than - lw $ra, 8($sp) - sw $v1, 260($sp) # internal_10 = result of function_less_than - addi $sp, $sp, 12 # Freeing space for arguments - - # If internal_10 then goto foreach_body_8781702295173 - lw $t0, 248($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_body_8781702295173 - - # Jumping to foreach_end_8781702295173 - j foreach_end_8781702295173 - - foreach_body_8781702295173: - - # array internal_8[4 * internal_9] = internal_6 - lw $t0, 252($sp) # $t0 = internal_9 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 256($sp) # $t1 = internal_8 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 264($sp) - sw $t0, 0($t1) - - # internal_6 = ancestor of internal_6 - lw $t0, 264($sp) - lw $t0, 4($t0) - sw $t0, 264($sp) - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_9 - lw $t0, 264($sp) - sw $t0, 4($sp) # Storing internal_9 - - # Argument internal_1 - lw $t0, 296($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 264($sp) # internal_9 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # Jumping to foreach_start_8781702295173 - j foreach_start_8781702295173 - - foreach_end_8781702295173: - - # initialize Array [internal_2] - lw $t0, 280($sp) # $t0 = internal_2 - lw $t0, 8($t0) # $t0 = value of the size - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - li $v0, 9 - move $a0, $t0 - syscall - sw $v0, 244($sp) # internal_11 = new Array[internal_2] - - # initialize Array [internal_2] - lw $t0, 280($sp) # $t0 = internal_2 - lw $t0, 8($t0) # $t0 = value of the size - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - li $v0, 9 - move $a0, $t0 - syscall - sw $v0, 240($sp) # internal_12 = new Array[internal_2] - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 232($sp) # internal_14 = address of allocated object Int - - # internal_13 = direction of A - la $t0, type_A - sw $t0, 236($sp) - - # array internal_11[4 * internal_14] = internal_13 - lw $t0, 232($sp) # $t0 = internal_14 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 244($sp) # $t1 = internal_11 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 236($sp) - sw $t0, 0($t1) - - # array internal_12[4 * internal_14] = internal_4 - lw $t0, 232($sp) # $t0 = internal_14 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 240($sp) # $t1 = internal_12 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 272($sp) - lw $t0, 8($t0) - sw $t0, 0($t1) - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 224($sp) # internal_16 = address of allocated object Int - - # internal_15 = direction of B - la $t0, type_B - sw $t0, 228($sp) - - # array internal_11[4 * internal_16] = internal_15 - lw $t0, 224($sp) # $t0 = internal_16 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 244($sp) # $t1 = internal_11 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 228($sp) - sw $t0, 0($t1) - - # array internal_12[4 * internal_16] = internal_4 - lw $t0, 224($sp) # $t0 = internal_16 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 240($sp) # $t1 = internal_12 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 272($sp) - lw $t0, 8($t0) - sw $t0, 0($t1) - - # Allocating Int 2 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 2 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 216($sp) # internal_18 = address of allocated object Int - - # internal_17 = direction of C - la $t0, type_C - sw $t0, 220($sp) - - # array internal_11[4 * internal_18] = internal_17 - lw $t0, 216($sp) # $t0 = internal_18 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 244($sp) # $t1 = internal_11 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 220($sp) - sw $t0, 0($t1) - - # array internal_12[4 * internal_18] = internal_4 - lw $t0, 216($sp) # $t0 = internal_18 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 240($sp) # $t1 = internal_12 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 272($sp) - lw $t0, 8($t0) - sw $t0, 0($t1) - - # Allocating Int 3 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 3 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 208($sp) # internal_20 = address of allocated object Int - - # internal_19 = direction of D - la $t0, type_D - sw $t0, 212($sp) - - # array internal_11[4 * internal_20] = internal_19 - lw $t0, 208($sp) # $t0 = internal_20 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 244($sp) # $t1 = internal_11 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 212($sp) - sw $t0, 0($t1) - - # array internal_12[4 * internal_20] = internal_4 - lw $t0, 208($sp) # $t0 = internal_20 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 240($sp) # $t1 = internal_12 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 272($sp) - lw $t0, 8($t0) - sw $t0, 0($t1) - - # Allocating Int 4 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 4 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 200($sp) # internal_22 = address of allocated object Int - - # internal_21 = direction of E - la $t0, type_E - sw $t0, 204($sp) - - # array internal_11[4 * internal_22] = internal_21 - lw $t0, 200($sp) # $t0 = internal_22 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 244($sp) # $t1 = internal_11 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 204($sp) - sw $t0, 0($t1) - - # array internal_12[4 * internal_22] = internal_4 - lw $t0, 200($sp) # $t0 = internal_22 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 240($sp) # $t1 = internal_12 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 272($sp) - lw $t0, 8($t0) - sw $t0, 0($t1) - - # Allocating Int 5 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 5 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 192($sp) # internal_24 = address of allocated object Int - - # internal_23 = direction of Object - la $t0, type_Object - sw $t0, 196($sp) - - # array internal_11[4 * internal_24] = internal_23 - lw $t0, 192($sp) # $t0 = internal_24 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 244($sp) # $t1 = internal_11 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 196($sp) - sw $t0, 0($t1) - - # array internal_12[4 * internal_24] = internal_4 - lw $t0, 192($sp) # $t0 = internal_24 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 240($sp) # $t1 = internal_12 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 272($sp) - lw $t0, 8($t0) - sw $t0, 0($t1) - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 188($sp) # internal_25 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 184($sp) # internal_26 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 176($sp) # internal_28 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 172($sp) # internal_29 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 164($sp) # internal_31 = address of allocated object Int - - foreach_type_start_8781702295173: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_25 - lw $t0, 200($sp) - sw $t0, 4($sp) # Storing internal_25 - - # Argument internal_2 - lw $t0, 292($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_less_than - jal function_less_than - lw $ra, 8($sp) - sw $v1, 196($sp) # internal_26 = result of function_less_than - addi $sp, $sp, 12 # Freeing space for arguments - - # If internal_26 then goto foreach_type_body_8781702295173 - lw $t0, 184($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_type_body_8781702295173 - - # Jumping to foreach_type_end_8781702295173 - j foreach_type_end_8781702295173 - - foreach_type_body_8781702295173: - - # internal_27 = array internal_11[4 * internal_25] - lw $t0, 188($sp) # $t0 = internal_25 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 244($sp) # $t1 = internal_11 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 0($t1) # $t1 = value in the position - sw $t0, 180($sp) # internal_27 = array internal_11[4 * internal_25] - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_28 - lw $t0, 188($sp) - sw $t0, 4($sp) # Storing internal_28 - - # Argument internal_0 - lw $t0, 300($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 188($sp) # internal_28 = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - foreach_ancestor_start_8781702295173: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_28 - lw $t0, 188($sp) - sw $t0, 4($sp) # Storing internal_28 - - # Argument internal_4 - lw $t0, 284($sp) - sw $t0, 0($sp) # Storing internal_4 - - # Calling function function_less_than - jal function_less_than - lw $ra, 8($sp) - sw $v1, 184($sp) # internal_29 = result of function_less_than - addi $sp, $sp, 12 # Freeing space for arguments - - # If internal_29 then goto foreach_ancestor_body_8781702295173 - lw $t0, 172($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_body_8781702295173 - - # Jumping to foreach_ancestor_end_8781702295173 - j foreach_ancestor_end_8781702295173 - - foreach_ancestor_body_8781702295173: - - # internal_30 = array internal_8[4 * internal_28] - lw $t0, 176($sp) # $t0 = internal_28 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 256($sp) # $t1 = internal_8 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 0($t1) # $t1 = value in the position - sw $t0, 168($sp) # internal_30 = array internal_8[4 * internal_28] - - # internal_31 = EqualAddress(internal_27, internal_30) - lw $t0, 180($sp) - lw $t1, 168($sp) - seq $t2, $t0, $t1 - lw $t0, 164($sp) - sw $t2, 8($t0) - - # If internal_31 then goto foreach_ancestor_end_8781702295173 - lw $t0, 164($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_end_8781702295173 - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_28 - lw $t0, 188($sp) - sw $t0, 4($sp) # Storing internal_28 - - # Argument internal_1 - lw $t0, 296($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 188($sp) # internal_28 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # Jumping to foreach_ancestor_start_8781702295173 - j foreach_ancestor_start_8781702295173 - - foreach_ancestor_end_8781702295173: - - # array internal_12[4 * internal_25] = internal_28 - lw $t0, 188($sp) # $t0 = internal_25 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 240($sp) # $t1 = internal_12 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 176($sp) - lw $t0, 8($t0) - sw $t0, 0($t1) - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_25 - lw $t0, 200($sp) - sw $t0, 4($sp) # Storing internal_25 - - # Argument internal_1 - lw $t0, 296($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 200($sp) # internal_25 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # Jumping to foreach_type_start_8781702295173 - j foreach_type_start_8781702295173 - - foreach_type_end_8781702295173: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_37[0] = '\n' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 140($sp) # internal_37 = "\n" - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_38[0] = ' ' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 136($sp) # internal_38 = " " - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 160($sp) # internal_32 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 156($sp) # internal_33 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 152($sp) # internal_34 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 148($sp) # internal_35 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 144($sp) # internal_36 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_35 - lw $t0, 160($sp) - sw $t0, 4($sp) # Storing internal_35 - - # Argument internal_4 - lw $t0, 284($sp) - sw $t0, 0($sp) # Storing internal_4 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 160($sp) # internal_35 = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - foreach_min_start_8781702295173: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_32 - lw $t0, 172($sp) - sw $t0, 4($sp) # Storing internal_32 - - # Argument internal_2 - lw $t0, 292($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_less_than - jal function_less_than - lw $ra, 8($sp) - sw $v1, 156($sp) # internal_36 = result of function_less_than - addi $sp, $sp, 12 # Freeing space for arguments - - # If internal_36 then goto foreach_min_body_8781702295173 - lw $t0, 144($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_min_body_8781702295173 - - # Jumping to foreach_min_end_8781702295173 - j foreach_min_end_8781702295173 - - foreach_min_body_8781702295173: - - # internal_34 = array internal_12[4 * internal_32] - lw $t0, 160($sp) # $t0 = internal_32 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 240($sp) # $t1 = internal_12 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 152($sp) # internal_34 = array internal_12[4 * internal_32] - sw $t0, 8($t2) - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_34 - lw $t0, 164($sp) - sw $t0, 4($sp) # Storing internal_34 - - # Argument internal_35 - lw $t0, 160($sp) - sw $t0, 0($sp) # Storing internal_35 - - # Calling function function_less_than - jal function_less_than - lw $ra, 8($sp) - sw $v1, 156($sp) # internal_36 = result of function_less_than - addi $sp, $sp, 12 # Freeing space for arguments - - # If internal_36 then goto update_min_8781702295173 - lw $t0, 144($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, update_min_8781702295173 - - # Jumping to update_min_end_8781702295173 - j update_min_end_8781702295173 - - update_min_8781702295173: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_35 - lw $t0, 160($sp) - sw $t0, 4($sp) # Storing internal_35 - - # Argument internal_34 - lw $t0, 164($sp) - sw $t0, 0($sp) # Storing internal_34 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 160($sp) # internal_35 = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_33 - lw $t0, 168($sp) - sw $t0, 4($sp) # Storing internal_33 - - # Argument internal_32 - lw $t0, 172($sp) - sw $t0, 0($sp) # Storing internal_32 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 168($sp) # internal_33 = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - update_min_end_8781702295173: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_32 - lw $t0, 172($sp) - sw $t0, 4($sp) # Storing internal_32 - - # Argument internal_1 - lw $t0, 296($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 172($sp) # internal_32 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # Jumping to foreach_min_start_8781702295173 - j foreach_min_start_8781702295173 - - foreach_min_end_8781702295173: - - # initialize Array [internal_2] - lw $t0, 280($sp) # $t0 = internal_2 - lw $t0, 8($t0) # $t0 = value of the size - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - li $v0, 9 - move $a0, $t0 - syscall - sw $v0, 132($sp) # internal_39 = new Array[internal_2] - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 128($sp) # internal_40 = address of allocated object Int - - # array internal_39[4 * internal_40] = internal_0 - lw $t0, 128($sp) # $t0 = internal_40 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 132($sp) # $t1 = internal_39 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 288($sp) - lw $t0, 8($t0) - sw $t0, 0($t1) - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 124($sp) # internal_41 = address of allocated object Int - - # array internal_39[4 * internal_41] = internal_0 - lw $t0, 124($sp) # $t0 = internal_41 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 132($sp) # $t1 = internal_39 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 288($sp) - lw $t0, 8($t0) - sw $t0, 0($t1) - - # Allocating Int 2 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 2 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 120($sp) # internal_42 = address of allocated object Int - - # array internal_39[4 * internal_42] = internal_0 - lw $t0, 120($sp) # $t0 = internal_42 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 132($sp) # $t1 = internal_39 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 288($sp) - lw $t0, 8($t0) - sw $t0, 0($t1) - - # Allocating Int 3 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 3 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 116($sp) # internal_43 = address of allocated object Int - - # array internal_39[4 * internal_43] = internal_0 - lw $t0, 116($sp) # $t0 = internal_43 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 132($sp) # $t1 = internal_39 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 288($sp) - lw $t0, 8($t0) - sw $t0, 0($t1) - - # Allocating Int 4 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 4 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 112($sp) # internal_44 = address of allocated object Int - - # array internal_39[4 * internal_44] = internal_0 - lw $t0, 112($sp) # $t0 = internal_44 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 132($sp) # $t1 = internal_39 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 288($sp) - lw $t0, 8($t0) - sw $t0, 0($t1) - - # Allocating Int 5 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 5 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 108($sp) # internal_45 = address of allocated object Int - - # array internal_39[4 * internal_45] = internal_0 - lw $t0, 108($sp) # $t0 = internal_45 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 132($sp) # $t1 = internal_39 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 288($sp) - lw $t0, 8($t0) - sw $t0, 0($t1) - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 104($sp) # internal_46 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_35 - lw $t0, 160($sp) - sw $t0, 4($sp) # Storing internal_35 - - # Argument internal_4 - lw $t0, 284($sp) - sw $t0, 0($sp) # Storing internal_4 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 116($sp) # internal_46 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # If internal_46 then goto error_branch_8781702295173 - lw $t0, 104($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, error_branch_8781702295173 - - # array internal_39[4 * internal_33] = internal_1 - lw $t0, 156($sp) # $t0 = internal_33 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 132($sp) # $t1 = internal_39 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 284($sp) - lw $t0, 8($t0) - sw $t0, 0($t1) - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 100($sp) # internal_47 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 96($sp) # internal_48 = address of allocated object Int - - # internal_47 = array internal_39[4 * internal_48] - lw $t0, 96($sp) # $t0 = internal_48 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 132($sp) # $t1 = internal_39 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 100($sp) # internal_47 = array internal_39[4 * internal_48] - sw $t0, 8($t2) - - # If internal_47 then goto branch_A_8781702295173 - lw $t0, 100($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_A_8781702295173 - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 92($sp) # internal_49 = address of allocated object Int - - # internal_47 = array internal_39[4 * internal_49] - lw $t0, 92($sp) # $t0 = internal_49 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 132($sp) # $t1 = internal_39 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 100($sp) # internal_47 = array internal_39[4 * internal_49] - sw $t0, 8($t2) - - # If internal_47 then goto branch_B_8781702295173 - lw $t0, 100($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_B_8781702295173 - - # Allocating Int 2 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 2 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 88($sp) # internal_50 = address of allocated object Int - - # internal_47 = array internal_39[4 * internal_50] - lw $t0, 88($sp) # $t0 = internal_50 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 132($sp) # $t1 = internal_39 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 100($sp) # internal_47 = array internal_39[4 * internal_50] - sw $t0, 8($t2) - - # If internal_47 then goto branch_C_8781702295173 - lw $t0, 100($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_C_8781702295173 - - # Allocating Int 3 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 3 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 84($sp) # internal_51 = address of allocated object Int - - # internal_47 = array internal_39[4 * internal_51] - lw $t0, 84($sp) # $t0 = internal_51 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 132($sp) # $t1 = internal_39 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 100($sp) # internal_47 = array internal_39[4 * internal_51] - sw $t0, 8($t2) - - # If internal_47 then goto branch_D_8781702295173 - lw $t0, 100($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_D_8781702295173 - - # Allocating Int 4 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 4 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # internal_52 = address of allocated object Int - - # internal_47 = array internal_39[4 * internal_52] - lw $t0, 80($sp) # $t0 = internal_52 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 132($sp) # $t1 = internal_39 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 100($sp) # internal_47 = array internal_39[4 * internal_52] - sw $t0, 8($t2) - - # If internal_47 then goto branch_E_8781702295173 - lw $t0, 100($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_E_8781702295173 - - # Allocating Int 5 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 5 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 76($sp) # internal_53 = address of allocated object Int - - # internal_47 = array internal_39[4 * internal_53] - lw $t0, 76($sp) # $t0 = internal_53 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 132($sp) # $t1 = internal_39 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 100($sp) # internal_47 = array internal_39[4 * internal_53] - sw $t0, 8($t2) - - # If internal_47 then goto branch_Object_8781702295173 - lw $t0, 100($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Object_8781702295173 - - branch_A_8781702295173: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument a - lw $t0, 80($sp) - sw $t0, 4($sp) # Storing a - - # Argument var - lw $t0, 304($sp) - sw $t0, 0($sp) # Storing var - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 80($sp) # a = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 29 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 67 - sb $t0, 8($v0) # internal_56[0] = 'C' - - addi $t0, $zero, 108 - sb $t0, 9($v0) # internal_56[1] = 'l' - - addi $t0, $zero, 97 - sb $t0, 10($v0) # internal_56[2] = 'a' - - addi $t0, $zero, 115 - sb $t0, 11($v0) # internal_56[3] = 's' - - addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_56[4] = 's' - - addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_56[5] = ' ' - - addi $t0, $zero, 116 - sb $t0, 14($v0) # internal_56[6] = 't' - - addi $t0, $zero, 121 - sb $t0, 15($v0) # internal_56[7] = 'y' - - addi $t0, $zero, 112 - sb $t0, 16($v0) # internal_56[8] = 'p' - - addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_56[9] = 'e' - - addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_56[10] = ' ' - - addi $t0, $zero, 105 - sb $t0, 19($v0) # internal_56[11] = 'i' - - addi $t0, $zero, 115 - sb $t0, 20($v0) # internal_56[12] = 's' - - addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_56[13] = ' ' - - addi $t0, $zero, 110 - sb $t0, 22($v0) # internal_56[14] = 'n' - - addi $t0, $zero, 111 - sb $t0, 23($v0) # internal_56[15] = 'o' - - addi $t0, $zero, 119 - sb $t0, 24($v0) # internal_56[16] = 'w' - - addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_56[17] = ' ' - - addi $t0, $zero, 65 - sb $t0, 26($v0) # internal_56[18] = 'A' - - addi $t0, $zero, 10 - sb $t0, 27($v0) # internal_56[19] = '\n' - - sb $zero, 28($v0) # Null-terminator at the end of the string - - sw $v0, 64($sp) # internal_56 = "Class type is now A\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 308($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_56 - lw $t0, 76($sp) - sw $t0, 0($sp) # Storing internal_56 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 72($sp) # internal_57 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_54 - lw $t0, 84($sp) - sw $t0, 4($sp) # Storing internal_54 - - # Argument internal_57 - lw $t0, 72($sp) - sw $t0, 0($sp) # Storing internal_57 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 84($sp) # internal_54 = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_54 = internal_57 - lw $t0, 60($sp) - sw $t0, 72($sp) - - # Jumping to branch_end_8781702295173 - j branch_end_8781702295173 - - branch_B_8781702295173: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument b - lw $t0, 68($sp) - sw $t0, 4($sp) # Storing b - - # Argument var - lw $t0, 304($sp) - sw $t0, 0($sp) # Storing var - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 68($sp) # b = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 29 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 67 - sb $t0, 8($v0) # internal_59[0] = 'C' - - addi $t0, $zero, 108 - sb $t0, 9($v0) # internal_59[1] = 'l' - - addi $t0, $zero, 97 - sb $t0, 10($v0) # internal_59[2] = 'a' - - addi $t0, $zero, 115 - sb $t0, 11($v0) # internal_59[3] = 's' - - addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_59[4] = 's' - - addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_59[5] = ' ' - - addi $t0, $zero, 116 - sb $t0, 14($v0) # internal_59[6] = 't' - - addi $t0, $zero, 121 - sb $t0, 15($v0) # internal_59[7] = 'y' - - addi $t0, $zero, 112 - sb $t0, 16($v0) # internal_59[8] = 'p' - - addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_59[9] = 'e' - - addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_59[10] = ' ' - - addi $t0, $zero, 105 - sb $t0, 19($v0) # internal_59[11] = 'i' - - addi $t0, $zero, 115 - sb $t0, 20($v0) # internal_59[12] = 's' - - addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_59[13] = ' ' - - addi $t0, $zero, 110 - sb $t0, 22($v0) # internal_59[14] = 'n' - - addi $t0, $zero, 111 - sb $t0, 23($v0) # internal_59[15] = 'o' - - addi $t0, $zero, 119 - sb $t0, 24($v0) # internal_59[16] = 'w' - - addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_59[17] = ' ' - - addi $t0, $zero, 66 - sb $t0, 26($v0) # internal_59[18] = 'B' - - addi $t0, $zero, 10 - sb $t0, 27($v0) # internal_59[19] = '\n' - - sb $zero, 28($v0) # Null-terminator at the end of the string - - sw $v0, 52($sp) # internal_59 = "Class type is now B\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 308($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_59 - lw $t0, 64($sp) - sw $t0, 0($sp) # Storing internal_59 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 60($sp) # internal_60 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_54 - lw $t0, 84($sp) - sw $t0, 4($sp) # Storing internal_54 - - # Argument internal_60 - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing internal_60 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 84($sp) # internal_54 = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_54 = internal_60 - lw $t0, 48($sp) - sw $t0, 72($sp) - - # Jumping to branch_end_8781702295173 - j branch_end_8781702295173 - - branch_C_8781702295173: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument c - lw $t0, 56($sp) - sw $t0, 4($sp) # Storing c - - # Argument var - lw $t0, 304($sp) - sw $t0, 0($sp) # Storing var - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 56($sp) # c = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 29 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 67 - sb $t0, 8($v0) # internal_62[0] = 'C' - - addi $t0, $zero, 108 - sb $t0, 9($v0) # internal_62[1] = 'l' - - addi $t0, $zero, 97 - sb $t0, 10($v0) # internal_62[2] = 'a' - - addi $t0, $zero, 115 - sb $t0, 11($v0) # internal_62[3] = 's' - - addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_62[4] = 's' - - addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_62[5] = ' ' - - addi $t0, $zero, 116 - sb $t0, 14($v0) # internal_62[6] = 't' - - addi $t0, $zero, 121 - sb $t0, 15($v0) # internal_62[7] = 'y' - - addi $t0, $zero, 112 - sb $t0, 16($v0) # internal_62[8] = 'p' - - addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_62[9] = 'e' - - addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_62[10] = ' ' - - addi $t0, $zero, 105 - sb $t0, 19($v0) # internal_62[11] = 'i' - - addi $t0, $zero, 115 - sb $t0, 20($v0) # internal_62[12] = 's' - - addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_62[13] = ' ' - - addi $t0, $zero, 110 - sb $t0, 22($v0) # internal_62[14] = 'n' - - addi $t0, $zero, 111 - sb $t0, 23($v0) # internal_62[15] = 'o' - - addi $t0, $zero, 119 - sb $t0, 24($v0) # internal_62[16] = 'w' - - addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_62[17] = ' ' - - addi $t0, $zero, 67 - sb $t0, 26($v0) # internal_62[18] = 'C' - - addi $t0, $zero, 10 - sb $t0, 27($v0) # internal_62[19] = '\n' - - sb $zero, 28($v0) # Null-terminator at the end of the string - - sw $v0, 40($sp) # internal_62 = "Class type is now C\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 308($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_62 - lw $t0, 52($sp) - sw $t0, 0($sp) # Storing internal_62 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 48($sp) # internal_63 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_54 - lw $t0, 84($sp) - sw $t0, 4($sp) # Storing internal_54 - - # Argument internal_63 - lw $t0, 48($sp) - sw $t0, 0($sp) # Storing internal_63 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 84($sp) # internal_54 = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_54 = internal_63 - lw $t0, 36($sp) - sw $t0, 72($sp) - - # Jumping to branch_end_8781702295173 - j branch_end_8781702295173 - - branch_D_8781702295173: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument d - lw $t0, 44($sp) - sw $t0, 4($sp) # Storing d - - # Argument var - lw $t0, 304($sp) - sw $t0, 0($sp) # Storing var - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 44($sp) # d = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 29 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 67 - sb $t0, 8($v0) # internal_65[0] = 'C' - - addi $t0, $zero, 108 - sb $t0, 9($v0) # internal_65[1] = 'l' - - addi $t0, $zero, 97 - sb $t0, 10($v0) # internal_65[2] = 'a' - - addi $t0, $zero, 115 - sb $t0, 11($v0) # internal_65[3] = 's' - - addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_65[4] = 's' - - addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_65[5] = ' ' - - addi $t0, $zero, 116 - sb $t0, 14($v0) # internal_65[6] = 't' - - addi $t0, $zero, 121 - sb $t0, 15($v0) # internal_65[7] = 'y' - - addi $t0, $zero, 112 - sb $t0, 16($v0) # internal_65[8] = 'p' - - addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_65[9] = 'e' - - addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_65[10] = ' ' - - addi $t0, $zero, 105 - sb $t0, 19($v0) # internal_65[11] = 'i' - - addi $t0, $zero, 115 - sb $t0, 20($v0) # internal_65[12] = 's' - - addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_65[13] = ' ' - - addi $t0, $zero, 110 - sb $t0, 22($v0) # internal_65[14] = 'n' - - addi $t0, $zero, 111 - sb $t0, 23($v0) # internal_65[15] = 'o' - - addi $t0, $zero, 119 - sb $t0, 24($v0) # internal_65[16] = 'w' - - addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_65[17] = ' ' - - addi $t0, $zero, 68 - sb $t0, 26($v0) # internal_65[18] = 'D' - - addi $t0, $zero, 10 - sb $t0, 27($v0) # internal_65[19] = '\n' - - sb $zero, 28($v0) # Null-terminator at the end of the string - - sw $v0, 28($sp) # internal_65 = "Class type is now D\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 308($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_65 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_65 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 36($sp) # internal_66 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_54 - lw $t0, 84($sp) - sw $t0, 4($sp) # Storing internal_54 - - # Argument internal_66 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_66 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 84($sp) # internal_54 = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_54 = internal_66 - lw $t0, 24($sp) - sw $t0, 72($sp) - - # Jumping to branch_end_8781702295173 - j branch_end_8781702295173 - - branch_E_8781702295173: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument e - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing e - - # Argument var - lw $t0, 304($sp) - sw $t0, 0($sp) # Storing var - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 32($sp) # e = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 29 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 67 - sb $t0, 8($v0) # internal_68[0] = 'C' - - addi $t0, $zero, 108 - sb $t0, 9($v0) # internal_68[1] = 'l' - - addi $t0, $zero, 97 - sb $t0, 10($v0) # internal_68[2] = 'a' - - addi $t0, $zero, 115 - sb $t0, 11($v0) # internal_68[3] = 's' - - addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_68[4] = 's' - - addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_68[5] = ' ' - - addi $t0, $zero, 116 - sb $t0, 14($v0) # internal_68[6] = 't' - - addi $t0, $zero, 121 - sb $t0, 15($v0) # internal_68[7] = 'y' - - addi $t0, $zero, 112 - sb $t0, 16($v0) # internal_68[8] = 'p' - - addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_68[9] = 'e' - - addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_68[10] = ' ' - - addi $t0, $zero, 105 - sb $t0, 19($v0) # internal_68[11] = 'i' - - addi $t0, $zero, 115 - sb $t0, 20($v0) # internal_68[12] = 's' - - addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_68[13] = ' ' - - addi $t0, $zero, 110 - sb $t0, 22($v0) # internal_68[14] = 'n' - - addi $t0, $zero, 111 - sb $t0, 23($v0) # internal_68[15] = 'o' - - addi $t0, $zero, 119 - sb $t0, 24($v0) # internal_68[16] = 'w' - - addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_68[17] = ' ' - - addi $t0, $zero, 69 - sb $t0, 26($v0) # internal_68[18] = 'E' - - addi $t0, $zero, 10 - sb $t0, 27($v0) # internal_68[19] = '\n' - - sb $zero, 28($v0) # Null-terminator at the end of the string - - sw $v0, 16($sp) # internal_68 = "Class type is now E\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 308($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_68 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_68 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 24($sp) # internal_69 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_54 - lw $t0, 84($sp) - sw $t0, 4($sp) # Storing internal_54 - - # Argument internal_69 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_69 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 84($sp) # internal_54 = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_54 = internal_69 - lw $t0, 12($sp) - sw $t0, 72($sp) - - # Jumping to branch_end_8781702295173 - j branch_end_8781702295173 - - branch_Object_8781702295173: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument o - lw $t0, 20($sp) - sw $t0, 4($sp) # Storing o - - # Argument var - lw $t0, 304($sp) - sw $t0, 0($sp) # Storing var - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 20($sp) # o = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 16 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 79 - sb $t0, 8($v0) # internal_71[0] = 'O' - - addi $t0, $zero, 111 - sb $t0, 9($v0) # internal_71[1] = 'o' - - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_71[2] = 'o' - - addi $t0, $zero, 111 - sb $t0, 11($v0) # internal_71[3] = 'o' - - addi $t0, $zero, 112 - sb $t0, 12($v0) # internal_71[4] = 'p' - - addi $t0, $zero, 115 - sb $t0, 13($v0) # internal_71[5] = 's' - - addi $t0, $zero, 10 - sb $t0, 14($v0) # internal_71[6] = '\n' - - sb $zero, 15($v0) # Null-terminator at the end of the string - - sw $v0, 4($sp) # internal_71 = "Oooops\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 308($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_71 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_71 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_72 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_54 - lw $t0, 84($sp) - sw $t0, 4($sp) # Storing internal_54 - - # Argument internal_72 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_72 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 84($sp) # internal_54 = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_54 = internal_72 - lw $t0, 0($sp) - sw $t0, 72($sp) - - # Jumping to branch_end_8781702295173 - j branch_end_8781702295173 - - error_branch_8781702295173: - - branch_end_8781702295173: - - # Loading return value in $v1 - lw $v1, 72($sp) - - # Freeing space for local variables - addi $sp, $sp, 292 - - jr $ra - - function_print_at_Main: - # Function parameters - # $ra = 36($sp) - # self = 32($sp) - # var = 28($sp) - - # Reserving space for local variables - addi $sp, $sp, -28 - - # Allocating A2I - li $v0, 9 - lw $a0, type_A2I - syscall - la $t0, type_A2I # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 20($sp) # internal_1 = address of allocated object A2I - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_1 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function___init___at_A2I - jal function___init___at_A2I - lw $ra, 4($sp) - sw $v1, 28($sp) # internal_1 = result of function___init___at_A2I - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument z - lw $t0, 36($sp) - sw $t0, 4($sp) # Storing z - - # Argument internal_1 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 36($sp) # z = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument var - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing var - - # Calling function function_value_at_A - jal function_value_at_A - lw $ra, 4($sp) - sw $v1, 24($sp) # internal_2 = result of function_value_at_A - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument z - lw $t0, 36($sp) - sw $t0, 4($sp) # Storing z - - # Argument internal_2 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_i2a_at_A2I - jal function_i2a_at_A2I - lw $ra, 8($sp) - sw $v1, 24($sp) # internal_3 = result of function_i2a_at_A2I - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 44($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_3 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_3 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_4 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_5[0] = ' ' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 4($sp) # internal_5 = " " - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 44($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_5 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_5 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_6 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 28 - - jr $ra - - function_main_at_Main: - # Function parameters - # $ra = 820($sp) - # self = 816($sp) - - # Reserving space for local variables - addi $sp, $sp, -816 - - # Allocating A - li $v0, 9 - lw $a0, type_A - syscall - la $t0, type_A # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 812($sp) # internal_0 = address of allocated object A - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 820($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function___init___at_A - jal function___init___at_A - lw $ra, 4($sp) - sw $v1, 820($sp) # internal_0 = result of function___init___at_A - addi $sp, $sp, 8 # Freeing space for arguments - - # Set attribute avar of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 812($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8781702253951 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8781702253951 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8781702253951 - j object_set_attribute_8781702253951 - int_set_attribute_8781702253951: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_0 - j end_set_attribute_8781702253951 - bool_set_attribute_8781702253951: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_0 - j end_set_attribute_8781702253951 - object_set_attribute_8781702253951: - sw $t1, 12($t0) # self.avar = internal_0 - end_set_attribute_8781702253951: - - while_start_8781702298224: - - # Get attribute flag of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 20($t0) # Get the attribute 'flag' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702254011 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702254011 - j object_get_attribute_8781702254011 - int_get_attribute_8781702254011: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 808($sp) # internal_1 = self.flag - j end_get_attribute_8781702254011 - bool_get_attribute_8781702254011: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 808($sp) # internal_1 = self.flag - j end_get_attribute_8781702254011 - object_get_attribute_8781702254011: - sw $t1, 808($sp) # internal_1 = flag - end_get_attribute_8781702254011: - - # If internal_1 then goto while_body_8781702298224 - lw $t0, 808($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8781702298224 - - # Jumping to while_end_8781702298224 - j while_end_8781702298224 - - while_body_8781702298224: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 16 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 110 - sb $t0, 8($v0) # internal_2[0] = 'n' - - addi $t0, $zero, 117 - sb $t0, 9($v0) # internal_2[1] = 'u' - - addi $t0, $zero, 109 - sb $t0, 10($v0) # internal_2[2] = 'm' - - addi $t0, $zero, 98 - sb $t0, 11($v0) # internal_2[3] = 'b' - - addi $t0, $zero, 101 - sb $t0, 12($v0) # internal_2[4] = 'e' - - addi $t0, $zero, 114 - sb $t0, 13($v0) # internal_2[5] = 'r' - - addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_2[6] = ' ' - - sb $zero, 15($v0) # Null-terminator at the end of the string - - sw $v0, 804($sp) # internal_2 = "number " - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 828($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_2 - lw $t0, 816($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 812($sp) # internal_3 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702254370 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702254370 - j object_get_attribute_8781702254370 - int_get_attribute_8781702254370: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 796($sp) # internal_4 = self.avar - j end_get_attribute_8781702254370 - bool_get_attribute_8781702254370: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 796($sp) # internal_4 = self.avar - j end_get_attribute_8781702254370 - object_get_attribute_8781702254370: - sw $t1, 796($sp) # internal_4 = avar - end_get_attribute_8781702254370: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 828($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_4 - lw $t0, 808($sp) - sw $t0, 0($sp) # Storing internal_4 - - # Calling function function_print_at_Main - jal function_print_at_Main - lw $ra, 8($sp) - sw $v1, 804($sp) # internal_5 = result of function_print_at_Main - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 784($sp) # internal_7 = address of allocated object Int - - # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702254454 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702254454 - j object_get_attribute_8781702254454 - int_get_attribute_8781702254454: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 780($sp) # internal_8 = self.avar - j end_get_attribute_8781702254454 - bool_get_attribute_8781702254454: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 780($sp) # internal_8 = self.avar - j end_get_attribute_8781702254454 - object_get_attribute_8781702254454: - sw $t1, 780($sp) # internal_8 = avar - end_get_attribute_8781702254454: - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_8 - lw $t0, 788($sp) - sw $t0, 0($sp) # Storing internal_8 - - # Calling function function_value_at_A - jal function_value_at_A - lw $ra, 4($sp) - sw $v1, 784($sp) # internal_9 = result of function_value_at_A - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 828($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_9 - lw $t0, 788($sp) - sw $t0, 0($sp) # Storing internal_9 - - # Calling function function_is_even_at_Main - jal function_is_even_at_Main - lw $ra, 8($sp) - sw $v1, 784($sp) # internal_10 = result of function_is_even_at_Main - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_7 = internal_10 - lw $t0, 772($sp) - sw $t0, 784($sp) - - # If internal_7 then goto then_8781702295290 - lw $t0, 784($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702295290 - - # Jumping to else_8781702295290 - j else_8781702295290 - - then_8781702295290: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 18 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 18 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 105 - sb $t0, 8($v0) # internal_11[0] = 'i' - - addi $t0, $zero, 115 - sb $t0, 9($v0) # internal_11[1] = 's' - - addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_11[2] = ' ' - - addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_11[3] = 'e' - - addi $t0, $zero, 118 - sb $t0, 12($v0) # internal_11[4] = 'v' - - addi $t0, $zero, 101 - sb $t0, 13($v0) # internal_11[5] = 'e' - - addi $t0, $zero, 110 - sb $t0, 14($v0) # internal_11[6] = 'n' - - addi $t0, $zero, 33 - sb $t0, 15($v0) # internal_11[7] = '!' - - addi $t0, $zero, 10 - sb $t0, 16($v0) # internal_11[8] = '\n' - - sb $zero, 17($v0) # Null-terminator at the end of the string - - sw $v0, 768($sp) # internal_11 = "is even!\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 828($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_11 - lw $t0, 780($sp) - sw $t0, 0($sp) # Storing internal_11 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 776($sp) # internal_12 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_6 = internal_12 - lw $t0, 764($sp) - sw $t0, 788($sp) - - # Jumping to endif_8781702295290 - j endif_8781702295290 - - else_8781702295290: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 17 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 17 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 105 - sb $t0, 8($v0) # internal_13[0] = 'i' - - addi $t0, $zero, 115 - sb $t0, 9($v0) # internal_13[1] = 's' - - addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_13[2] = ' ' - - addi $t0, $zero, 111 - sb $t0, 11($v0) # internal_13[3] = 'o' - - addi $t0, $zero, 100 - sb $t0, 12($v0) # internal_13[4] = 'd' - - addi $t0, $zero, 100 - sb $t0, 13($v0) # internal_13[5] = 'd' - - addi $t0, $zero, 33 - sb $t0, 14($v0) # internal_13[6] = '!' - - addi $t0, $zero, 10 - sb $t0, 15($v0) # internal_13[7] = '\n' - - sb $zero, 16($v0) # Null-terminator at the end of the string - - sw $v0, 760($sp) # internal_13 = "is odd!\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 828($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_13 - lw $t0, 772($sp) - sw $t0, 0($sp) # Storing internal_13 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 768($sp) # internal_14 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_6 = internal_14 - lw $t0, 756($sp) - sw $t0, 788($sp) - - # Jumping to endif_8781702295290 - j endif_8781702295290 - - endif_8781702295290: - - # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702254629 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702254629 - j object_get_attribute_8781702254629 - int_get_attribute_8781702254629: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 752($sp) # internal_15 = self.avar - j end_get_attribute_8781702254629 - bool_get_attribute_8781702254629: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 752($sp) # internal_15 = self.avar - j end_get_attribute_8781702254629 - object_get_attribute_8781702254629: - sw $t1, 752($sp) # internal_15 = avar - end_get_attribute_8781702254629: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 828($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_15 - lw $t0, 764($sp) - sw $t0, 0($sp) # Storing internal_15 - - # Calling function function_class_type_at_Main - jal function_class_type_at_Main - lw $ra, 8($sp) - sw $v1, 760($sp) # internal_16 = result of function_class_type_at_Main - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument self - lw $t0, 824($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_menu_at_Main - jal function_menu_at_Main - lw $ra, 4($sp) - sw $v1, 752($sp) # internal_17 = result of function_menu_at_Main - addi $sp, $sp, 8 # Freeing space for arguments - - # Set attribute char of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 744($sp) # $t1 = internal_17 - beq $t1, $zero, object_set_attribute_8781702254650 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8781702254650 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8781702254650 - j object_set_attribute_8781702254650 - int_set_attribute_8781702254650: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.char = internal_17 - j end_set_attribute_8781702254650 - bool_set_attribute_8781702254650: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.char = internal_17 - j end_set_attribute_8781702254650 - object_set_attribute_8781702254650: - sw $t1, 8($t0) # self.char = internal_17 - end_set_attribute_8781702254650: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 736($sp) # internal_19 = address of allocated object Int - - # Get attribute char of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'char' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702254725 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702254725 - j object_get_attribute_8781702254725 - int_get_attribute_8781702254725: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 732($sp) # internal_20 = self.char - j end_get_attribute_8781702254725 - bool_get_attribute_8781702254725: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 732($sp) # internal_20 = self.char - j end_get_attribute_8781702254725 - object_get_attribute_8781702254725: - sw $t1, 732($sp) # internal_20 = char - end_get_attribute_8781702254725: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 97 - sb $t0, 8($v0) # internal_21[0] = 'a' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 728($sp) # internal_21 = "a" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_20 - lw $t0, 744($sp) - sw $t0, 4($sp) # Storing internal_20 - - # Argument internal_21 - lw $t0, 740($sp) - sw $t0, 0($sp) # Storing internal_21 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 736($sp) # internal_22 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_19 = internal_22 - lw $t0, 724($sp) - sw $t0, 736($sp) - - # If internal_19 then goto then_8781702298209 - lw $t0, 736($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702298209 - - # Jumping to else_8781702298209 - j else_8781702298209 - - then_8781702298209: - - # Allocating A - li $v0, 9 - lw $a0, type_A - syscall - la $t0, type_A # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 720($sp) # internal_23 = address of allocated object A - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_23 - lw $t0, 728($sp) - sw $t0, 0($sp) # Storing internal_23 - - # Calling function function___init___at_A - jal function___init___at_A - lw $ra, 4($sp) - sw $v1, 728($sp) # internal_23 = result of function___init___at_A - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument self - lw $t0, 824($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_get_int_at_Main - jal function_get_int_at_Main - lw $ra, 4($sp) - sw $v1, 724($sp) # internal_24 = result of function_get_int_at_Main - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_23 - lw $t0, 732($sp) - sw $t0, 4($sp) # Storing internal_23 - - # Argument internal_24 - lw $t0, 728($sp) - sw $t0, 0($sp) # Storing internal_24 - - # Calling function function_set_var_at_A - jal function_set_var_at_A - lw $ra, 8($sp) - sw $v1, 724($sp) # internal_25 = result of function_set_var_at_A - addi $sp, $sp, 12 # Freeing space for arguments - - # Set attribute a_var of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 712($sp) # $t1 = internal_25 - beq $t1, $zero, object_set_attribute_8781702254806 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8781702254806 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8781702254806 - j object_set_attribute_8781702254806 - int_set_attribute_8781702254806: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 16($t0) # self.a_var = internal_25 - j end_set_attribute_8781702254806 - bool_set_attribute_8781702254806: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 16($t0) # self.a_var = internal_25 - j end_set_attribute_8781702254806 - object_set_attribute_8781702254806: - sw $t1, 16($t0) # self.a_var = internal_25 - end_set_attribute_8781702254806: - - # Allocating B - li $v0, 9 - lw $a0, type_B - syscall - la $t0, type_B # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 708($sp) # internal_26 = address of allocated object B - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_26 - lw $t0, 716($sp) - sw $t0, 0($sp) # Storing internal_26 - - # Calling function function___init___at_B - jal function___init___at_B - lw $ra, 4($sp) - sw $v1, 716($sp) # internal_26 = result of function___init___at_B - addi $sp, $sp, 8 # Freeing space for arguments - - # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702255204 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702255204 - j object_get_attribute_8781702255204 - int_get_attribute_8781702255204: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 704($sp) # internal_27 = self.avar - j end_get_attribute_8781702255204 - bool_get_attribute_8781702255204: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 704($sp) # internal_27 = self.avar - j end_get_attribute_8781702255204 - object_get_attribute_8781702255204: - sw $t1, 704($sp) # internal_27 = avar - end_get_attribute_8781702255204: - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_27 - lw $t0, 712($sp) - sw $t0, 0($sp) # Storing internal_27 - - # Calling function function_value_at_A - jal function_value_at_A - lw $ra, 4($sp) - sw $v1, 708($sp) # internal_28 = result of function_value_at_A - addi $sp, $sp, 8 # Freeing space for arguments - - # Get attribute a_var of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 16($t0) # Get the attribute 'a_var' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702255234 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702255234 - j object_get_attribute_8781702255234 - int_get_attribute_8781702255234: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 696($sp) # internal_29 = self.a_var - j end_get_attribute_8781702255234 - bool_get_attribute_8781702255234: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 696($sp) # internal_29 = self.a_var - j end_get_attribute_8781702255234 - object_get_attribute_8781702255234: - sw $t1, 696($sp) # internal_29 = a_var - end_get_attribute_8781702255234: - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_29 - lw $t0, 704($sp) - sw $t0, 0($sp) # Storing internal_29 - - # Calling function function_value_at_A - jal function_value_at_A - lw $ra, 4($sp) - sw $v1, 700($sp) # internal_30 = result of function_value_at_A - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address - - # Argument internal_26 - lw $t0, 724($sp) - sw $t0, 8($sp) # Storing internal_26 - - # Argument internal_28 - lw $t0, 716($sp) - sw $t0, 4($sp) # Storing internal_28 - - # Argument internal_30 - lw $t0, 708($sp) - sw $t0, 0($sp) # Storing internal_30 - - # Calling function function_method2_at_A - jal function_method2_at_A - lw $ra, 12($sp) - sw $v1, 704($sp) # internal_31 = result of function_method2_at_A - addi $sp, $sp, 16 # Freeing space for arguments - - # Set attribute avar of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 688($sp) # $t1 = internal_31 - beq $t1, $zero, object_set_attribute_8781702255144 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8781702255144 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8781702255144 - j object_set_attribute_8781702255144 - int_set_attribute_8781702255144: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_31 - j end_set_attribute_8781702255144 - bool_set_attribute_8781702255144: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_31 - j end_set_attribute_8781702255144 - object_set_attribute_8781702255144: - sw $t1, 12($t0) # self.avar = internal_31 - end_set_attribute_8781702255144: - - # internal_18 = internal_31 - lw $t0, 688($sp) - sw $t0, 740($sp) - - # Jumping to endif_8781702298209 - j endif_8781702298209 - - else_8781702298209: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 680($sp) # internal_33 = address of allocated object Int - - # Get attribute char of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'char' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702255318 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702255318 - j object_get_attribute_8781702255318 - int_get_attribute_8781702255318: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 676($sp) # internal_34 = self.char - j end_get_attribute_8781702255318 - bool_get_attribute_8781702255318: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 676($sp) # internal_34 = self.char - j end_get_attribute_8781702255318 - object_get_attribute_8781702255318: - sw $t1, 676($sp) # internal_34 = char - end_get_attribute_8781702255318: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 98 - sb $t0, 8($v0) # internal_35[0] = 'b' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 672($sp) # internal_35 = "b" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_34 - lw $t0, 688($sp) - sw $t0, 4($sp) # Storing internal_34 - - # Argument internal_35 - lw $t0, 684($sp) - sw $t0, 0($sp) # Storing internal_35 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 680($sp) # internal_36 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_33 = internal_36 - lw $t0, 668($sp) - sw $t0, 680($sp) - - # If internal_33 then goto then_8781702298203 - lw $t0, 680($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702298203 - - # Jumping to else_8781702298203 - j else_8781702298203 - - then_8781702298203: - - # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702255915 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702255915 - j object_get_attribute_8781702255915 - int_get_attribute_8781702255915: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 664($sp) # internal_37 = self.avar - j end_get_attribute_8781702255915 - bool_get_attribute_8781702255915: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 664($sp) # internal_37 = self.avar - j end_get_attribute_8781702255915 - object_get_attribute_8781702255915: - sw $t1, 664($sp) # internal_37 = avar - end_get_attribute_8781702255915: - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 660($sp) # internal_38 = address of allocated object Int - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 656($sp) # internal_39 = address of allocated object Int - - # Allocating Int 3 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 3 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 652($sp) # internal_40 = address of allocated object Int - - # Allocating NUll to internal_41 - sw $zero, 648($sp) # internal_41 = 0 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 644($sp) # internal_42 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 632($sp) # internal_45 = address of allocated object Int - - # internal_43 = typeof internal_37 that is the first word of the object - lw $t0, 664($sp) - lw $t0, 0($t0) - sw $t0, 640($sp) - - # internal_44 = internal_43 - lw $t0, 640($sp) - sw $t0, 636($sp) - - while_start_8781702296263: - - # internal_45 = EqualAddress(internal_44, internal_41) - lw $t0, 636($sp) - lw $t1, 648($sp) - seq $t2, $t0, $t1 - lw $t0, 632($sp) - sw $t2, 8($t0) - - # If internal_45 then goto while_end_8781702296263 - lw $t0, 632($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_end_8781702296263 - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_42 - lw $t0, 656($sp) - sw $t0, 4($sp) # Storing internal_42 - - # Argument internal_39 - lw $t0, 668($sp) - sw $t0, 0($sp) # Storing internal_39 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 656($sp) # internal_42 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_44 = ancestor of internal_44 - lw $t0, 636($sp) - lw $t0, 4($t0) - sw $t0, 636($sp) - - # Jumping to while_start_8781702296263 - j while_start_8781702296263 - - while_end_8781702296263: - - # internal_44 = internal_43 - lw $t0, 640($sp) - sw $t0, 636($sp) - - # initialize Array [internal_42] - lw $t0, 644($sp) # $t0 = internal_42 - lw $t0, 8($t0) # $t0 = value of the size - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - li $v0, 9 - move $a0, $t0 - syscall - sw $v0, 628($sp) # internal_46 = new Array[internal_42] - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 624($sp) # internal_47 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 620($sp) # internal_48 = address of allocated object Int - - foreach_start_8781702296263: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_47 - lw $t0, 636($sp) - sw $t0, 4($sp) # Storing internal_47 - - # Argument internal_42 - lw $t0, 656($sp) - sw $t0, 0($sp) # Storing internal_42 - - # Calling function function_less_than - jal function_less_than - lw $ra, 8($sp) - sw $v1, 632($sp) # internal_48 = result of function_less_than - addi $sp, $sp, 12 # Freeing space for arguments - - # If internal_48 then goto foreach_body_8781702296263 - lw $t0, 620($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_body_8781702296263 - - # Jumping to foreach_end_8781702296263 - j foreach_end_8781702296263 - - foreach_body_8781702296263: - - # array internal_46[4 * internal_47] = internal_44 - lw $t0, 624($sp) # $t0 = internal_47 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 628($sp) # $t1 = internal_46 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 636($sp) - sw $t0, 0($t1) - - # internal_44 = ancestor of internal_44 - lw $t0, 636($sp) - lw $t0, 4($t0) - sw $t0, 636($sp) - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_47 - lw $t0, 636($sp) - sw $t0, 4($sp) # Storing internal_47 - - # Argument internal_39 - lw $t0, 668($sp) - sw $t0, 0($sp) # Storing internal_39 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 636($sp) # internal_47 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # Jumping to foreach_start_8781702296263 - j foreach_start_8781702296263 - - foreach_end_8781702296263: - - # initialize Array [internal_40] - lw $t0, 652($sp) # $t0 = internal_40 - lw $t0, 8($t0) # $t0 = value of the size - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - li $v0, 9 - move $a0, $t0 - syscall - sw $v0, 616($sp) # internal_49 = new Array[internal_40] - - # initialize Array [internal_40] - lw $t0, 652($sp) # $t0 = internal_40 - lw $t0, 8($t0) # $t0 = value of the size - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - li $v0, 9 - move $a0, $t0 - syscall - sw $v0, 612($sp) # internal_50 = new Array[internal_40] - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 604($sp) # internal_52 = address of allocated object Int - - # internal_51 = direction of C - la $t0, type_C - sw $t0, 608($sp) - - # array internal_49[4 * internal_52] = internal_51 - lw $t0, 604($sp) # $t0 = internal_52 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 616($sp) # $t1 = internal_49 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 608($sp) - sw $t0, 0($t1) - - # array internal_50[4 * internal_52] = internal_42 - lw $t0, 604($sp) # $t0 = internal_52 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 612($sp) # $t1 = internal_50 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 644($sp) - lw $t0, 8($t0) - sw $t0, 0($t1) - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 596($sp) # internal_54 = address of allocated object Int - - # internal_53 = direction of A - la $t0, type_A - sw $t0, 600($sp) - - # array internal_49[4 * internal_54] = internal_53 - lw $t0, 596($sp) # $t0 = internal_54 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 616($sp) # $t1 = internal_49 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 600($sp) - sw $t0, 0($t1) - - # array internal_50[4 * internal_54] = internal_42 - lw $t0, 596($sp) # $t0 = internal_54 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 612($sp) # $t1 = internal_50 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 644($sp) - lw $t0, 8($t0) - sw $t0, 0($t1) - - # Allocating Int 2 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 2 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 588($sp) # internal_56 = address of allocated object Int - - # internal_55 = direction of Object - la $t0, type_Object - sw $t0, 592($sp) - - # array internal_49[4 * internal_56] = internal_55 - lw $t0, 588($sp) # $t0 = internal_56 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 616($sp) # $t1 = internal_49 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 592($sp) - sw $t0, 0($t1) - - # array internal_50[4 * internal_56] = internal_42 - lw $t0, 588($sp) # $t0 = internal_56 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 612($sp) # $t1 = internal_50 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 644($sp) - lw $t0, 8($t0) - sw $t0, 0($t1) - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 584($sp) # internal_57 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 580($sp) # internal_58 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 572($sp) # internal_60 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 568($sp) # internal_61 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 560($sp) # internal_63 = address of allocated object Int - - foreach_type_start_8781702296263: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_57 - lw $t0, 596($sp) - sw $t0, 4($sp) # Storing internal_57 - - # Argument internal_40 - lw $t0, 664($sp) - sw $t0, 0($sp) # Storing internal_40 - - # Calling function function_less_than - jal function_less_than - lw $ra, 8($sp) - sw $v1, 592($sp) # internal_58 = result of function_less_than - addi $sp, $sp, 12 # Freeing space for arguments - - # If internal_58 then goto foreach_type_body_8781702296263 - lw $t0, 580($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_type_body_8781702296263 - - # Jumping to foreach_type_end_8781702296263 - j foreach_type_end_8781702296263 - - foreach_type_body_8781702296263: - - # internal_59 = array internal_49[4 * internal_57] - lw $t0, 584($sp) # $t0 = internal_57 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 616($sp) # $t1 = internal_49 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 0($t1) # $t1 = value in the position - sw $t0, 576($sp) # internal_59 = array internal_49[4 * internal_57] - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_60 - lw $t0, 584($sp) - sw $t0, 4($sp) # Storing internal_60 - - # Argument internal_38 - lw $t0, 672($sp) - sw $t0, 0($sp) # Storing internal_38 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 584($sp) # internal_60 = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - foreach_ancestor_start_8781702296263: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_60 - lw $t0, 584($sp) - sw $t0, 4($sp) # Storing internal_60 - - # Argument internal_42 - lw $t0, 656($sp) - sw $t0, 0($sp) # Storing internal_42 - - # Calling function function_less_than - jal function_less_than - lw $ra, 8($sp) - sw $v1, 580($sp) # internal_61 = result of function_less_than - addi $sp, $sp, 12 # Freeing space for arguments - - # If internal_61 then goto foreach_ancestor_body_8781702296263 - lw $t0, 568($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_body_8781702296263 - - # Jumping to foreach_ancestor_end_8781702296263 - j foreach_ancestor_end_8781702296263 - - foreach_ancestor_body_8781702296263: - - # internal_62 = array internal_46[4 * internal_60] - lw $t0, 572($sp) # $t0 = internal_60 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 628($sp) # $t1 = internal_46 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 0($t1) # $t1 = value in the position - sw $t0, 564($sp) # internal_62 = array internal_46[4 * internal_60] - - # internal_63 = EqualAddress(internal_59, internal_62) - lw $t0, 576($sp) - lw $t1, 564($sp) - seq $t2, $t0, $t1 - lw $t0, 560($sp) - sw $t2, 8($t0) - - # If internal_63 then goto foreach_ancestor_end_8781702296263 - lw $t0, 560($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_end_8781702296263 - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_60 - lw $t0, 584($sp) - sw $t0, 4($sp) # Storing internal_60 - - # Argument internal_39 - lw $t0, 668($sp) - sw $t0, 0($sp) # Storing internal_39 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 584($sp) # internal_60 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # Jumping to foreach_ancestor_start_8781702296263 - j foreach_ancestor_start_8781702296263 - - foreach_ancestor_end_8781702296263: - - # array internal_50[4 * internal_57] = internal_60 - lw $t0, 584($sp) # $t0 = internal_57 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 612($sp) # $t1 = internal_50 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 572($sp) - lw $t0, 8($t0) - sw $t0, 0($t1) - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_57 - lw $t0, 596($sp) - sw $t0, 4($sp) # Storing internal_57 - - # Argument internal_39 - lw $t0, 668($sp) - sw $t0, 0($sp) # Storing internal_39 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 596($sp) # internal_57 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # Jumping to foreach_type_start_8781702296263 - j foreach_type_start_8781702296263 - - foreach_type_end_8781702296263: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_69[0] = '\n' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 536($sp) # internal_69 = "\n" - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_70[0] = ' ' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 532($sp) # internal_70 = " " - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 556($sp) # internal_64 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 552($sp) # internal_65 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 548($sp) # internal_66 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 544($sp) # internal_67 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 540($sp) # internal_68 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_67 - lw $t0, 556($sp) - sw $t0, 4($sp) # Storing internal_67 - - # Argument internal_42 - lw $t0, 656($sp) - sw $t0, 0($sp) # Storing internal_42 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 556($sp) # internal_67 = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - foreach_min_start_8781702296263: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_64 - lw $t0, 568($sp) - sw $t0, 4($sp) # Storing internal_64 - - # Argument internal_40 - lw $t0, 664($sp) - sw $t0, 0($sp) # Storing internal_40 - - # Calling function function_less_than - jal function_less_than - lw $ra, 8($sp) - sw $v1, 552($sp) # internal_68 = result of function_less_than - addi $sp, $sp, 12 # Freeing space for arguments - - # If internal_68 then goto foreach_min_body_8781702296263 - lw $t0, 540($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_min_body_8781702296263 - - # Jumping to foreach_min_end_8781702296263 - j foreach_min_end_8781702296263 - - foreach_min_body_8781702296263: - - # internal_66 = array internal_50[4 * internal_64] - lw $t0, 556($sp) # $t0 = internal_64 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 612($sp) # $t1 = internal_50 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 548($sp) # internal_66 = array internal_50[4 * internal_64] - sw $t0, 8($t2) - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_66 - lw $t0, 560($sp) - sw $t0, 4($sp) # Storing internal_66 - - # Argument internal_67 - lw $t0, 556($sp) - sw $t0, 0($sp) # Storing internal_67 - - # Calling function function_less_than - jal function_less_than - lw $ra, 8($sp) - sw $v1, 552($sp) # internal_68 = result of function_less_than - addi $sp, $sp, 12 # Freeing space for arguments - - # If internal_68 then goto update_min_8781702296263 - lw $t0, 540($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, update_min_8781702296263 - - # Jumping to update_min_end_8781702296263 - j update_min_end_8781702296263 - - update_min_8781702296263: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_67 - lw $t0, 556($sp) - sw $t0, 4($sp) # Storing internal_67 - - # Argument internal_66 - lw $t0, 560($sp) - sw $t0, 0($sp) # Storing internal_66 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 556($sp) # internal_67 = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_65 - lw $t0, 564($sp) - sw $t0, 4($sp) # Storing internal_65 - - # Argument internal_64 - lw $t0, 568($sp) - sw $t0, 0($sp) # Storing internal_64 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 564($sp) # internal_65 = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - update_min_end_8781702296263: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_64 - lw $t0, 568($sp) - sw $t0, 4($sp) # Storing internal_64 - - # Argument internal_39 - lw $t0, 668($sp) - sw $t0, 0($sp) # Storing internal_39 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 568($sp) # internal_64 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # Jumping to foreach_min_start_8781702296263 - j foreach_min_start_8781702296263 - - foreach_min_end_8781702296263: - - # initialize Array [internal_40] - lw $t0, 652($sp) # $t0 = internal_40 - lw $t0, 8($t0) # $t0 = value of the size - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - li $v0, 9 - move $a0, $t0 - syscall - sw $v0, 528($sp) # internal_71 = new Array[internal_40] - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 524($sp) # internal_72 = address of allocated object Int - - # array internal_71[4 * internal_72] = internal_38 - lw $t0, 524($sp) # $t0 = internal_72 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 528($sp) # $t1 = internal_71 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 660($sp) - lw $t0, 8($t0) - sw $t0, 0($t1) - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 520($sp) # internal_73 = address of allocated object Int - - # array internal_71[4 * internal_73] = internal_38 - lw $t0, 520($sp) # $t0 = internal_73 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 528($sp) # $t1 = internal_71 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 660($sp) - lw $t0, 8($t0) - sw $t0, 0($t1) - - # Allocating Int 2 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 2 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 516($sp) # internal_74 = address of allocated object Int - - # array internal_71[4 * internal_74] = internal_38 - lw $t0, 516($sp) # $t0 = internal_74 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 528($sp) # $t1 = internal_71 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 660($sp) - lw $t0, 8($t0) - sw $t0, 0($t1) - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 512($sp) # internal_75 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_67 - lw $t0, 556($sp) - sw $t0, 4($sp) # Storing internal_67 - - # Argument internal_42 - lw $t0, 656($sp) - sw $t0, 0($sp) # Storing internal_42 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 524($sp) # internal_75 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # If internal_75 then goto error_branch_8781702296263 - lw $t0, 512($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, error_branch_8781702296263 - - # array internal_71[4 * internal_65] = internal_39 - lw $t0, 552($sp) # $t0 = internal_65 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 528($sp) # $t1 = internal_71 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 656($sp) - lw $t0, 8($t0) - sw $t0, 0($t1) - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 508($sp) # internal_76 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 504($sp) # internal_77 = address of allocated object Int - - # internal_76 = array internal_71[4 * internal_77] - lw $t0, 504($sp) # $t0 = internal_77 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 528($sp) # $t1 = internal_71 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 508($sp) # internal_76 = array internal_71[4 * internal_77] - sw $t0, 8($t2) - - # If internal_76 then goto branch_C_8781702296263 - lw $t0, 508($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_C_8781702296263 - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 500($sp) # internal_78 = address of allocated object Int - - # internal_76 = array internal_71[4 * internal_78] - lw $t0, 500($sp) # $t0 = internal_78 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 528($sp) # $t1 = internal_71 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 508($sp) # internal_76 = array internal_71[4 * internal_78] - sw $t0, 8($t2) - - # If internal_76 then goto branch_A_8781702296263 - lw $t0, 508($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_A_8781702296263 - - # Allocating Int 2 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 2 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 496($sp) # internal_79 = address of allocated object Int - - # internal_76 = array internal_71[4 * internal_79] - lw $t0, 496($sp) # $t0 = internal_79 - lw $t0, 8($t0) # $t0 = value of the index - addi $t1, $zero, 4 # $t1 = 4 - mult $t0, $t1 # $t0 = $t0 * 4 - mflo $t0 - lw $t1, 528($sp) # $t1 = internal_71 - add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 508($sp) # internal_76 = array internal_71[4 * internal_79] - sw $t0, 8($t2) - - # If internal_76 then goto branch_Object_8781702296263 - lw $t0, 508($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Object_8781702296263 - - branch_C_8781702296263: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument c - lw $t0, 500($sp) - sw $t0, 4($sp) # Storing c - - # Argument internal_37 - lw $t0, 676($sp) - sw $t0, 0($sp) # Storing internal_37 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 500($sp) # c = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument c - lw $t0, 496($sp) - sw $t0, 0($sp) # Storing c - - # Calling function function_value_at_A - jal function_value_at_A - lw $ra, 4($sp) - sw $v1, 492($sp) # internal_82 = result of function_value_at_A - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument c - lw $t0, 500($sp) - sw $t0, 4($sp) # Storing c - - # Argument internal_82 - lw $t0, 496($sp) - sw $t0, 0($sp) # Storing internal_82 - - # Calling function function_method6_at_C - jal function_method6_at_C - lw $ra, 8($sp) - sw $v1, 492($sp) # internal_83 = result of function_method6_at_C - addi $sp, $sp, 12 # Freeing space for arguments - - # Set attribute avar of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 480($sp) # $t1 = internal_83 - beq $t1, $zero, object_set_attribute_8781702258321 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8781702258321 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8781702258321 - j object_set_attribute_8781702258321 - int_set_attribute_8781702258321: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_83 - j end_set_attribute_8781702258321 - bool_set_attribute_8781702258321: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_83 - j end_set_attribute_8781702258321 - object_set_attribute_8781702258321: - sw $t1, 12($t0) # self.avar = internal_83 - end_set_attribute_8781702258321: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_80 - lw $t0, 504($sp) - sw $t0, 4($sp) # Storing internal_80 - - # Argument internal_83 - lw $t0, 492($sp) - sw $t0, 0($sp) # Storing internal_83 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 504($sp) # internal_80 = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_80 = internal_83 - lw $t0, 480($sp) - sw $t0, 492($sp) - - # Jumping to branch_end_8781702296263 - j branch_end_8781702296263 - - branch_A_8781702296263: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument a - lw $t0, 488($sp) - sw $t0, 4($sp) # Storing a - - # Argument internal_37 - lw $t0, 676($sp) - sw $t0, 0($sp) # Storing internal_37 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 488($sp) # a = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument a - lw $t0, 484($sp) - sw $t0, 0($sp) # Storing a - - # Calling function function_value_at_A - jal function_value_at_A - lw $ra, 4($sp) - sw $v1, 480($sp) # internal_85 = result of function_value_at_A - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument a - lw $t0, 488($sp) - sw $t0, 4($sp) # Storing a - - # Argument internal_85 - lw $t0, 484($sp) - sw $t0, 0($sp) # Storing internal_85 - - # Calling function function_method3_at_A - jal function_method3_at_A - lw $ra, 8($sp) - sw $v1, 480($sp) # internal_86 = result of function_method3_at_A - addi $sp, $sp, 12 # Freeing space for arguments - - # Set attribute avar of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 468($sp) # $t1 = internal_86 - beq $t1, $zero, object_set_attribute_8781702258698 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8781702258698 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8781702258698 - j object_set_attribute_8781702258698 - int_set_attribute_8781702258698: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_86 - j end_set_attribute_8781702258698 - bool_set_attribute_8781702258698: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_86 - j end_set_attribute_8781702258698 - object_set_attribute_8781702258698: - sw $t1, 12($t0) # self.avar = internal_86 - end_set_attribute_8781702258698: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_80 - lw $t0, 504($sp) - sw $t0, 4($sp) # Storing internal_80 - - # Argument internal_86 - lw $t0, 480($sp) - sw $t0, 0($sp) # Storing internal_86 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 504($sp) # internal_80 = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_80 = internal_86 - lw $t0, 468($sp) - sw $t0, 492($sp) - - # Jumping to branch_end_8781702296263 - j branch_end_8781702296263 - - branch_Object_8781702296263: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument o - lw $t0, 476($sp) - sw $t0, 4($sp) # Storing o - - # Argument internal_37 - lw $t0, 676($sp) - sw $t0, 0($sp) # Storing internal_37 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 476($sp) # o = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 16 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 79 - sb $t0, 8($v0) # internal_88[0] = 'O' - - addi $t0, $zero, 111 - sb $t0, 9($v0) # internal_88[1] = 'o' - - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_88[2] = 'o' - - addi $t0, $zero, 111 - sb $t0, 11($v0) # internal_88[3] = 'o' - - addi $t0, $zero, 112 - sb $t0, 12($v0) # internal_88[4] = 'p' - - addi $t0, $zero, 115 - sb $t0, 13($v0) # internal_88[5] = 's' - - addi $t0, $zero, 10 - sb $t0, 14($v0) # internal_88[6] = '\n' - - sb $zero, 15($v0) # Null-terminator at the end of the string - - sw $v0, 460($sp) # internal_88 = "Oooops\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 828($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_88 - lw $t0, 472($sp) - sw $t0, 0($sp) # Storing internal_88 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 468($sp) # internal_89 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument self - lw $t0, 824($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_abort_at_Object - jal function_abort_at_Object - lw $ra, 4($sp) - sw $v1, 460($sp) # internal_90 = result of function_abort_at_Object - addi $sp, $sp, 8 # Freeing space for arguments - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 448($sp) # internal_91 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_80 - lw $t0, 504($sp) - sw $t0, 4($sp) # Storing internal_80 - - # Argument internal_91 - lw $t0, 460($sp) - sw $t0, 0($sp) # Storing internal_91 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 504($sp) # internal_80 = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_80 = internal_91 - lw $t0, 448($sp) - sw $t0, 492($sp) - - # Jumping to branch_end_8781702296263 - j branch_end_8781702296263 - - error_branch_8781702296263: - - branch_end_8781702296263: - - # internal_32 = internal_80 - lw $t0, 492($sp) - sw $t0, 684($sp) - - # Jumping to endif_8781702298203 - j endif_8781702298203 - - else_8781702298203: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 440($sp) # internal_93 = address of allocated object Int - - # Get attribute char of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'char' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702259493 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702259493 - j object_get_attribute_8781702259493 - int_get_attribute_8781702259493: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 436($sp) # internal_94 = self.char - j end_get_attribute_8781702259493 - bool_get_attribute_8781702259493: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 436($sp) # internal_94 = self.char - j end_get_attribute_8781702259493 - object_get_attribute_8781702259493: - sw $t1, 436($sp) # internal_94 = char - end_get_attribute_8781702259493: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 99 - sb $t0, 8($v0) # internal_95[0] = 'c' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 432($sp) # internal_95 = "c" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_94 - lw $t0, 448($sp) - sw $t0, 4($sp) # Storing internal_94 - - # Argument internal_95 - lw $t0, 444($sp) - sw $t0, 0($sp) # Storing internal_95 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 440($sp) # internal_96 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_93 = internal_96 - lw $t0, 428($sp) - sw $t0, 440($sp) - - # If internal_93 then goto then_8781702298197 - lw $t0, 440($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702298197 - - # Jumping to else_8781702298197 - j else_8781702298197 - - then_8781702298197: - - # Allocating A - li $v0, 9 - lw $a0, type_A - syscall - la $t0, type_A # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 424($sp) # internal_97 = address of allocated object A - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_97 - lw $t0, 432($sp) - sw $t0, 0($sp) # Storing internal_97 - - # Calling function function___init___at_A - jal function___init___at_A - lw $ra, 4($sp) - sw $v1, 432($sp) # internal_97 = result of function___init___at_A - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument self - lw $t0, 824($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_get_int_at_Main - jal function_get_int_at_Main - lw $ra, 4($sp) - sw $v1, 428($sp) # internal_98 = result of function_get_int_at_Main - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_97 - lw $t0, 436($sp) - sw $t0, 4($sp) # Storing internal_97 - - # Argument internal_98 - lw $t0, 432($sp) - sw $t0, 0($sp) # Storing internal_98 - - # Calling function function_set_var_at_A - jal function_set_var_at_A - lw $ra, 8($sp) - sw $v1, 428($sp) # internal_99 = result of function_set_var_at_A - addi $sp, $sp, 12 # Freeing space for arguments - - # Set attribute a_var of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 416($sp) # $t1 = internal_99 - beq $t1, $zero, object_set_attribute_8781702259574 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8781702259574 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8781702259574 - j object_set_attribute_8781702259574 - int_set_attribute_8781702259574: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 16($t0) # self.a_var = internal_99 - j end_set_attribute_8781702259574 - bool_set_attribute_8781702259574: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 16($t0) # self.a_var = internal_99 - j end_set_attribute_8781702259574 - object_set_attribute_8781702259574: - sw $t1, 16($t0) # self.a_var = internal_99 - end_set_attribute_8781702259574: - - # Allocating D - li $v0, 9 - lw $a0, type_D - syscall - la $t0, type_D # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 412($sp) # internal_100 = address of allocated object D - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_100 - lw $t0, 420($sp) - sw $t0, 0($sp) # Storing internal_100 - - # Calling function function___init___at_D - jal function___init___at_D - lw $ra, 4($sp) - sw $v1, 420($sp) # internal_100 = result of function___init___at_D - addi $sp, $sp, 8 # Freeing space for arguments - - # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702259716 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702259716 - j object_get_attribute_8781702259716 - int_get_attribute_8781702259716: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 408($sp) # internal_101 = self.avar - j end_get_attribute_8781702259716 - bool_get_attribute_8781702259716: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 408($sp) # internal_101 = self.avar - j end_get_attribute_8781702259716 - object_get_attribute_8781702259716: - sw $t1, 408($sp) # internal_101 = avar - end_get_attribute_8781702259716: - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_101 - lw $t0, 416($sp) - sw $t0, 0($sp) # Storing internal_101 - - # Calling function function_value_at_A - jal function_value_at_A - lw $ra, 4($sp) - sw $v1, 412($sp) # internal_102 = result of function_value_at_A - addi $sp, $sp, 8 # Freeing space for arguments - - # Get attribute a_var of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 16($t0) # Get the attribute 'a_var' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702259746 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702259746 - j object_get_attribute_8781702259746 - int_get_attribute_8781702259746: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 400($sp) # internal_103 = self.a_var - j end_get_attribute_8781702259746 - bool_get_attribute_8781702259746: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 400($sp) # internal_103 = self.a_var - j end_get_attribute_8781702259746 - object_get_attribute_8781702259746: - sw $t1, 400($sp) # internal_103 = a_var - end_get_attribute_8781702259746: - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_103 - lw $t0, 408($sp) - sw $t0, 0($sp) # Storing internal_103 - - # Calling function function_value_at_A - jal function_value_at_A - lw $ra, 4($sp) - sw $v1, 404($sp) # internal_104 = result of function_value_at_A - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address - - # Argument internal_100 - lw $t0, 428($sp) - sw $t0, 8($sp) # Storing internal_100 - - # Argument internal_102 - lw $t0, 420($sp) - sw $t0, 4($sp) # Storing internal_102 - - # Argument internal_104 - lw $t0, 412($sp) - sw $t0, 0($sp) # Storing internal_104 - - # Calling function function_method4_at_A - jal function_method4_at_A - lw $ra, 12($sp) - sw $v1, 408($sp) # internal_105 = result of function_method4_at_A - addi $sp, $sp, 16 # Freeing space for arguments - - # Set attribute avar of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 392($sp) # $t1 = internal_105 - beq $t1, $zero, object_set_attribute_8781702259649 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8781702259649 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8781702259649 - j object_set_attribute_8781702259649 - int_set_attribute_8781702259649: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_105 - j end_set_attribute_8781702259649 - bool_set_attribute_8781702259649: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_105 - j end_set_attribute_8781702259649 - object_set_attribute_8781702259649: - sw $t1, 12($t0) # self.avar = internal_105 - end_set_attribute_8781702259649: - - # internal_92 = internal_105 - lw $t0, 392($sp) - sw $t0, 444($sp) - - # Jumping to endif_8781702298197 - j endif_8781702298197 - - else_8781702298197: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 384($sp) # internal_107 = address of allocated object Int - - # Get attribute char of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'char' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702259830 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702259830 - j object_get_attribute_8781702259830 - int_get_attribute_8781702259830: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 380($sp) # internal_108 = self.char - j end_get_attribute_8781702259830 - bool_get_attribute_8781702259830: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 380($sp) # internal_108 = self.char - j end_get_attribute_8781702259830 - object_get_attribute_8781702259830: - sw $t1, 380($sp) # internal_108 = char - end_get_attribute_8781702259830: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 100 - sb $t0, 8($v0) # internal_109[0] = 'd' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 376($sp) # internal_109 = "d" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_108 - lw $t0, 392($sp) - sw $t0, 4($sp) # Storing internal_108 - - # Argument internal_109 - lw $t0, 388($sp) - sw $t0, 0($sp) # Storing internal_109 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 384($sp) # internal_110 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_107 = internal_110 - lw $t0, 372($sp) - sw $t0, 384($sp) - - # If internal_107 then goto then_8781702298191 - lw $t0, 384($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702298191 - - # Jumping to else_8781702298191 - j else_8781702298191 - - then_8781702298191: - - # Allocating C - li $v0, 9 - lw $a0, type_C - syscall - la $t0, type_C # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 368($sp) # internal_111 = address of allocated object C - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_111 - lw $t0, 376($sp) - sw $t0, 0($sp) # Storing internal_111 - - # Calling function function___init___at_C - jal function___init___at_C - lw $ra, 4($sp) - sw $v1, 376($sp) # internal_111 = result of function___init___at_C - addi $sp, $sp, 8 # Freeing space for arguments - - # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702259959 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702259959 - j object_get_attribute_8781702259959 - int_get_attribute_8781702259959: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 364($sp) # internal_112 = self.avar - j end_get_attribute_8781702259959 - bool_get_attribute_8781702259959: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 364($sp) # internal_112 = self.avar - j end_get_attribute_8781702259959 - object_get_attribute_8781702259959: - sw $t1, 364($sp) # internal_112 = avar - end_get_attribute_8781702259959: - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_112 - lw $t0, 372($sp) - sw $t0, 0($sp) # Storing internal_112 - - # Calling function function_value_at_A - jal function_value_at_A - lw $ra, 4($sp) - sw $v1, 368($sp) # internal_113 = result of function_value_at_A - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_111 - lw $t0, 380($sp) - sw $t0, 4($sp) # Storing internal_111 - - # Argument internal_113 - lw $t0, 372($sp) - sw $t0, 0($sp) # Storing internal_113 - - # Calling function function_method5_at_C - jal function_method5_at_C - lw $ra, 8($sp) - sw $v1, 368($sp) # internal_114 = result of function_method5_at_C - addi $sp, $sp, 12 # Freeing space for arguments - - # Set attribute avar of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 356($sp) # $t1 = internal_114 - beq $t1, $zero, object_set_attribute_8781702259896 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8781702259896 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8781702259896 - j object_set_attribute_8781702259896 - int_set_attribute_8781702259896: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_114 - j end_set_attribute_8781702259896 - bool_set_attribute_8781702259896: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_114 - j end_set_attribute_8781702259896 - object_set_attribute_8781702259896: - sw $t1, 12($t0) # self.avar = internal_114 - end_set_attribute_8781702259896: - - # internal_106 = internal_114 - lw $t0, 356($sp) - sw $t0, 388($sp) - - # Jumping to endif_8781702298191 - j endif_8781702298191 - - else_8781702298191: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 348($sp) # internal_116 = address of allocated object Int - - # Get attribute char of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'char' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702260312 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702260312 - j object_get_attribute_8781702260312 - int_get_attribute_8781702260312: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 344($sp) # internal_117 = self.char - j end_get_attribute_8781702260312 - bool_get_attribute_8781702260312: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 344($sp) # internal_117 = self.char - j end_get_attribute_8781702260312 - object_get_attribute_8781702260312: - sw $t1, 344($sp) # internal_117 = char - end_get_attribute_8781702260312: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 101 - sb $t0, 8($v0) # internal_118[0] = 'e' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 340($sp) # internal_118 = "e" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_117 - lw $t0, 356($sp) - sw $t0, 4($sp) # Storing internal_117 - - # Argument internal_118 - lw $t0, 352($sp) - sw $t0, 0($sp) # Storing internal_118 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 348($sp) # internal_119 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_116 = internal_119 - lw $t0, 336($sp) - sw $t0, 348($sp) - - # If internal_116 then goto then_8781702298185 - lw $t0, 348($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702298185 - - # Jumping to else_8781702298185 - j else_8781702298185 - - then_8781702298185: - - # Allocating C - li $v0, 9 - lw $a0, type_C - syscall - la $t0, type_C # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 332($sp) # internal_120 = address of allocated object C - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_120 - lw $t0, 340($sp) - sw $t0, 0($sp) # Storing internal_120 - - # Calling function function___init___at_C - jal function___init___at_C - lw $ra, 4($sp) - sw $v1, 340($sp) # internal_120 = result of function___init___at_C - addi $sp, $sp, 8 # Freeing space for arguments - - # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702260441 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702260441 - j object_get_attribute_8781702260441 - int_get_attribute_8781702260441: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 328($sp) # internal_121 = self.avar - j end_get_attribute_8781702260441 - bool_get_attribute_8781702260441: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 328($sp) # internal_121 = self.avar - j end_get_attribute_8781702260441 - object_get_attribute_8781702260441: - sw $t1, 328($sp) # internal_121 = avar - end_get_attribute_8781702260441: - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_121 - lw $t0, 336($sp) - sw $t0, 0($sp) # Storing internal_121 - - # Calling function function_value_at_A - jal function_value_at_A - lw $ra, 4($sp) - sw $v1, 332($sp) # internal_122 = result of function_value_at_A - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_120 - lw $t0, 344($sp) - sw $t0, 4($sp) # Storing internal_120 - - # Argument internal_122 - lw $t0, 336($sp) - sw $t0, 0($sp) # Storing internal_122 - - # Calling function function_method5_at_C - jal function_method5_at_C - lw $ra, 8($sp) - sw $v1, 332($sp) # internal_123 = result of function_method5_at_C - addi $sp, $sp, 12 # Freeing space for arguments - - # Set attribute avar of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 320($sp) # $t1 = internal_123 - beq $t1, $zero, object_set_attribute_8781702260378 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8781702260378 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8781702260378 - j object_set_attribute_8781702260378 - int_set_attribute_8781702260378: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_123 - j end_set_attribute_8781702260378 - bool_set_attribute_8781702260378: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_123 - j end_set_attribute_8781702260378 - object_set_attribute_8781702260378: - sw $t1, 12($t0) # self.avar = internal_123 - end_set_attribute_8781702260378: - - # internal_115 = internal_123 - lw $t0, 320($sp) - sw $t0, 352($sp) - - # Jumping to endif_8781702298185 - j endif_8781702298185 - - else_8781702298185: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 312($sp) # internal_125 = address of allocated object Int - - # Get attribute char of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'char' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702260794 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702260794 - j object_get_attribute_8781702260794 - int_get_attribute_8781702260794: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 308($sp) # internal_126 = self.char - j end_get_attribute_8781702260794 - bool_get_attribute_8781702260794: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 308($sp) # internal_126 = self.char - j end_get_attribute_8781702260794 - object_get_attribute_8781702260794: - sw $t1, 308($sp) # internal_126 = char - end_get_attribute_8781702260794: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 102 - sb $t0, 8($v0) # internal_127[0] = 'f' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 304($sp) # internal_127 = "f" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_126 - lw $t0, 320($sp) - sw $t0, 4($sp) # Storing internal_126 - - # Argument internal_127 - lw $t0, 316($sp) - sw $t0, 0($sp) # Storing internal_127 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 312($sp) # internal_128 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_125 = internal_128 - lw $t0, 300($sp) - sw $t0, 312($sp) - - # If internal_125 then goto then_8781702298179 - lw $t0, 312($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702298179 - - # Jumping to else_8781702298179 - j else_8781702298179 - - then_8781702298179: - - # Allocating C - li $v0, 9 - lw $a0, type_C - syscall - la $t0, type_C # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 296($sp) # internal_129 = address of allocated object C - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_129 - lw $t0, 304($sp) - sw $t0, 0($sp) # Storing internal_129 - - # Calling function function___init___at_C - jal function___init___at_C - lw $ra, 4($sp) - sw $v1, 304($sp) # internal_129 = result of function___init___at_C - addi $sp, $sp, 8 # Freeing space for arguments - - # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702260923 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702260923 - j object_get_attribute_8781702260923 - int_get_attribute_8781702260923: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 292($sp) # internal_130 = self.avar - j end_get_attribute_8781702260923 - bool_get_attribute_8781702260923: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 292($sp) # internal_130 = self.avar - j end_get_attribute_8781702260923 - object_get_attribute_8781702260923: - sw $t1, 292($sp) # internal_130 = avar - end_get_attribute_8781702260923: - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_130 - lw $t0, 300($sp) - sw $t0, 0($sp) # Storing internal_130 - - # Calling function function_value_at_A - jal function_value_at_A - lw $ra, 4($sp) - sw $v1, 296($sp) # internal_131 = result of function_value_at_A - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_129 - lw $t0, 308($sp) - sw $t0, 4($sp) # Storing internal_129 - - # Argument internal_131 - lw $t0, 300($sp) - sw $t0, 0($sp) # Storing internal_131 - - # Calling function function_method5_at_C - jal function_method5_at_C - lw $ra, 8($sp) - sw $v1, 296($sp) # internal_132 = result of function_method5_at_C - addi $sp, $sp, 12 # Freeing space for arguments - - # Set attribute avar of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 284($sp) # $t1 = internal_132 - beq $t1, $zero, object_set_attribute_8781702260860 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8781702260860 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8781702260860 - j object_set_attribute_8781702260860 - int_set_attribute_8781702260860: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_132 - j end_set_attribute_8781702260860 - bool_set_attribute_8781702260860: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_132 - j end_set_attribute_8781702260860 - object_set_attribute_8781702260860: - sw $t1, 12($t0) # self.avar = internal_132 - end_set_attribute_8781702260860: - - # internal_124 = internal_132 - lw $t0, 284($sp) - sw $t0, 316($sp) - - # Jumping to endif_8781702298179 - j endif_8781702298179 - - else_8781702298179: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 276($sp) # internal_134 = address of allocated object Int - - # Get attribute char of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'char' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702261532 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702261532 - j object_get_attribute_8781702261532 - int_get_attribute_8781702261532: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 272($sp) # internal_135 = self.char - j end_get_attribute_8781702261532 - bool_get_attribute_8781702261532: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 272($sp) # internal_135 = self.char - j end_get_attribute_8781702261532 - object_get_attribute_8781702261532: - sw $t1, 272($sp) # internal_135 = char - end_get_attribute_8781702261532: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 103 - sb $t0, 8($v0) # internal_136[0] = 'g' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 268($sp) # internal_136 = "g" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_135 - lw $t0, 284($sp) - sw $t0, 4($sp) # Storing internal_135 - - # Argument internal_136 - lw $t0, 280($sp) - sw $t0, 0($sp) # Storing internal_136 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 276($sp) # internal_137 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_134 = internal_137 - lw $t0, 264($sp) - sw $t0, 276($sp) - - # If internal_134 then goto then_8781702298173 - lw $t0, 276($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702298173 - - # Jumping to else_8781702298173 - j else_8781702298173 - - then_8781702298173: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 256($sp) # internal_139 = address of allocated object Int - - # Allocating D - li $v0, 9 - lw $a0, type_D - syscall - la $t0, type_D # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 252($sp) # internal_140 = address of allocated object D - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_140 - lw $t0, 260($sp) - sw $t0, 0($sp) # Storing internal_140 - - # Calling function function___init___at_D - jal function___init___at_D - lw $ra, 4($sp) - sw $v1, 260($sp) # internal_140 = result of function___init___at_D - addi $sp, $sp, 8 # Freeing space for arguments - - # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702261685 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702261685 - j object_get_attribute_8781702261685 - int_get_attribute_8781702261685: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 248($sp) # internal_141 = self.avar - j end_get_attribute_8781702261685 - bool_get_attribute_8781702261685: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 248($sp) # internal_141 = self.avar - j end_get_attribute_8781702261685 - object_get_attribute_8781702261685: - sw $t1, 248($sp) # internal_141 = avar - end_get_attribute_8781702261685: - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_141 - lw $t0, 256($sp) - sw $t0, 0($sp) # Storing internal_141 - - # Calling function function_value_at_A - jal function_value_at_A - lw $ra, 4($sp) - sw $v1, 252($sp) # internal_142 = result of function_value_at_A - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_140 - lw $t0, 264($sp) - sw $t0, 4($sp) # Storing internal_140 - - # Argument internal_142 - lw $t0, 256($sp) - sw $t0, 0($sp) # Storing internal_142 - - # Calling function function_method7_at_D - jal function_method7_at_D - lw $ra, 8($sp) - sw $v1, 252($sp) # internal_143 = result of function_method7_at_D - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_139 = internal_143 - lw $t0, 240($sp) - sw $t0, 256($sp) - - # If internal_139 then goto then_8781702296820 - lw $t0, 256($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702296820 - - # Jumping to else_8781702296820 - j else_8781702296820 - - then_8781702296820: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 16 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 110 - sb $t0, 8($v0) # internal_144[0] = 'n' - - addi $t0, $zero, 117 - sb $t0, 9($v0) # internal_144[1] = 'u' - - addi $t0, $zero, 109 - sb $t0, 10($v0) # internal_144[2] = 'm' - - addi $t0, $zero, 98 - sb $t0, 11($v0) # internal_144[3] = 'b' - - addi $t0, $zero, 101 - sb $t0, 12($v0) # internal_144[4] = 'e' - - addi $t0, $zero, 114 - sb $t0, 13($v0) # internal_144[5] = 'r' - - addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_144[6] = ' ' - - sb $zero, 15($v0) # Null-terminator at the end of the string - - sw $v0, 236($sp) # internal_144 = "number " - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 828($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_144 - lw $t0, 248($sp) - sw $t0, 0($sp) # Storing internal_144 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 244($sp) # internal_145 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702229553 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702229553 - j object_get_attribute_8781702229553 - int_get_attribute_8781702229553: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 228($sp) # internal_146 = self.avar - j end_get_attribute_8781702229553 - bool_get_attribute_8781702229553: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 228($sp) # internal_146 = self.avar - j end_get_attribute_8781702229553 - object_get_attribute_8781702229553: - sw $t1, 228($sp) # internal_146 = avar - end_get_attribute_8781702229553: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 828($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_146 - lw $t0, 240($sp) - sw $t0, 0($sp) # Storing internal_146 - - # Calling function function_print_at_Main - jal function_print_at_Main - lw $ra, 8($sp) - sw $v1, 236($sp) # internal_147 = result of function_print_at_Main - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 28 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 28 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 105 - sb $t0, 8($v0) # internal_148[0] = 'i' - - addi $t0, $zero, 115 - sb $t0, 9($v0) # internal_148[1] = 's' - - addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_148[2] = ' ' - - addi $t0, $zero, 100 - sb $t0, 11($v0) # internal_148[3] = 'd' - - addi $t0, $zero, 105 - sb $t0, 12($v0) # internal_148[4] = 'i' - - addi $t0, $zero, 118 - sb $t0, 13($v0) # internal_148[5] = 'v' - - addi $t0, $zero, 105 - sb $t0, 14($v0) # internal_148[6] = 'i' - - addi $t0, $zero, 115 - sb $t0, 15($v0) # internal_148[7] = 's' - - addi $t0, $zero, 105 - sb $t0, 16($v0) # internal_148[8] = 'i' - - addi $t0, $zero, 98 - sb $t0, 17($v0) # internal_148[9] = 'b' - - addi $t0, $zero, 108 - sb $t0, 18($v0) # internal_148[10] = 'l' - - addi $t0, $zero, 101 - sb $t0, 19($v0) # internal_148[11] = 'e' - - addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_148[12] = ' ' - - addi $t0, $zero, 98 - sb $t0, 21($v0) # internal_148[13] = 'b' - - addi $t0, $zero, 121 - sb $t0, 22($v0) # internal_148[14] = 'y' - - addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_148[15] = ' ' - - addi $t0, $zero, 51 - sb $t0, 24($v0) # internal_148[16] = '3' - - addi $t0, $zero, 46 - sb $t0, 25($v0) # internal_148[17] = '.' - - addi $t0, $zero, 10 - sb $t0, 26($v0) # internal_148[18] = '\n' - - sb $zero, 27($v0) # Null-terminator at the end of the string - - sw $v0, 220($sp) # internal_148 = "is divisible by 3.\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 828($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_148 - lw $t0, 232($sp) - sw $t0, 0($sp) # Storing internal_148 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 228($sp) # internal_149 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_138 = internal_149 - lw $t0, 216($sp) - sw $t0, 260($sp) - - # Jumping to endif_8781702296820 - j endif_8781702296820 - - else_8781702296820: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 16 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 110 - sb $t0, 8($v0) # internal_150[0] = 'n' - - addi $t0, $zero, 117 - sb $t0, 9($v0) # internal_150[1] = 'u' - - addi $t0, $zero, 109 - sb $t0, 10($v0) # internal_150[2] = 'm' - - addi $t0, $zero, 98 - sb $t0, 11($v0) # internal_150[3] = 'b' - - addi $t0, $zero, 101 - sb $t0, 12($v0) # internal_150[4] = 'e' - - addi $t0, $zero, 114 - sb $t0, 13($v0) # internal_150[5] = 'r' - - addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_150[6] = ' ' - - sb $zero, 15($v0) # Null-terminator at the end of the string - - sw $v0, 212($sp) # internal_150 = "number " - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 828($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_150 - lw $t0, 224($sp) - sw $t0, 0($sp) # Storing internal_150 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 220($sp) # internal_151 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702229682 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702229682 - j object_get_attribute_8781702229682 - int_get_attribute_8781702229682: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 204($sp) # internal_152 = self.avar - j end_get_attribute_8781702229682 - bool_get_attribute_8781702229682: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 204($sp) # internal_152 = self.avar - j end_get_attribute_8781702229682 - object_get_attribute_8781702229682: - sw $t1, 204($sp) # internal_152 = avar - end_get_attribute_8781702229682: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 828($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_152 - lw $t0, 216($sp) - sw $t0, 0($sp) # Storing internal_152 - - # Calling function function_print_at_Main - jal function_print_at_Main - lw $ra, 8($sp) - sw $v1, 212($sp) # internal_153 = result of function_print_at_Main - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 32 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 32 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 105 - sb $t0, 8($v0) # internal_154[0] = 'i' - - addi $t0, $zero, 115 - sb $t0, 9($v0) # internal_154[1] = 's' - - addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_154[2] = ' ' - - addi $t0, $zero, 110 - sb $t0, 11($v0) # internal_154[3] = 'n' - - addi $t0, $zero, 111 - sb $t0, 12($v0) # internal_154[4] = 'o' - - addi $t0, $zero, 116 - sb $t0, 13($v0) # internal_154[5] = 't' - - addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_154[6] = ' ' - - addi $t0, $zero, 100 - sb $t0, 15($v0) # internal_154[7] = 'd' - - addi $t0, $zero, 105 - sb $t0, 16($v0) # internal_154[8] = 'i' - - addi $t0, $zero, 118 - sb $t0, 17($v0) # internal_154[9] = 'v' - - addi $t0, $zero, 105 - sb $t0, 18($v0) # internal_154[10] = 'i' - - addi $t0, $zero, 115 - sb $t0, 19($v0) # internal_154[11] = 's' - - addi $t0, $zero, 105 - sb $t0, 20($v0) # internal_154[12] = 'i' - - addi $t0, $zero, 98 - sb $t0, 21($v0) # internal_154[13] = 'b' - - addi $t0, $zero, 108 - sb $t0, 22($v0) # internal_154[14] = 'l' - - addi $t0, $zero, 101 - sb $t0, 23($v0) # internal_154[15] = 'e' - - addi $t0, $zero, 32 - sb $t0, 24($v0) # internal_154[16] = ' ' - - addi $t0, $zero, 98 - sb $t0, 25($v0) # internal_154[17] = 'b' - - addi $t0, $zero, 121 - sb $t0, 26($v0) # internal_154[18] = 'y' - - addi $t0, $zero, 32 - sb $t0, 27($v0) # internal_154[19] = ' ' - - addi $t0, $zero, 51 - sb $t0, 28($v0) # internal_154[20] = '3' - - addi $t0, $zero, 46 - sb $t0, 29($v0) # internal_154[21] = '.' - - addi $t0, $zero, 10 - sb $t0, 30($v0) # internal_154[22] = '\n' - - sb $zero, 31($v0) # Null-terminator at the end of the string - - sw $v0, 196($sp) # internal_154 = "is not divisible by 3.\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 828($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_154 - lw $t0, 208($sp) - sw $t0, 0($sp) # Storing internal_154 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 204($sp) # internal_155 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_138 = internal_155 - lw $t0, 192($sp) - sw $t0, 260($sp) - - # Jumping to endif_8781702296820 - j endif_8781702296820 - - endif_8781702296820: - - # internal_133 = internal_138 - lw $t0, 260($sp) - sw $t0, 280($sp) - - # Jumping to endif_8781702298173 - j endif_8781702298173 - - else_8781702298173: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 184($sp) # internal_157 = address of allocated object Int - - # Get attribute char of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'char' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702230062 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702230062 - j object_get_attribute_8781702230062 - int_get_attribute_8781702230062: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 180($sp) # internal_158 = self.char - j end_get_attribute_8781702230062 - bool_get_attribute_8781702230062: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 180($sp) # internal_158 = self.char - j end_get_attribute_8781702230062 - object_get_attribute_8781702230062: - sw $t1, 180($sp) # internal_158 = char - end_get_attribute_8781702230062: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 104 - sb $t0, 8($v0) # internal_159[0] = 'h' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 176($sp) # internal_159 = "h" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_158 - lw $t0, 192($sp) - sw $t0, 4($sp) # Storing internal_158 - - # Argument internal_159 - lw $t0, 188($sp) - sw $t0, 0($sp) # Storing internal_159 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 184($sp) # internal_160 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_157 = internal_160 - lw $t0, 172($sp) - sw $t0, 184($sp) - - # If internal_157 then goto then_8781702298167 - lw $t0, 184($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702298167 - - # Jumping to else_8781702298167 - j else_8781702298167 - - then_8781702298167: - - # Allocating NUll to x - sw $zero, 168($sp) # x = 0 - - # Allocating E - li $v0, 9 - lw $a0, type_E - syscall - la $t0, type_E # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 164($sp) # internal_162 = address of allocated object E - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_162 - lw $t0, 172($sp) - sw $t0, 0($sp) # Storing internal_162 - - # Calling function function___init___at_E - jal function___init___at_E - lw $ra, 4($sp) - sw $v1, 172($sp) # internal_162 = result of function___init___at_E - addi $sp, $sp, 8 # Freeing space for arguments - - # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702230236 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702230236 - j object_get_attribute_8781702230236 - int_get_attribute_8781702230236: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 160($sp) # internal_163 = self.avar - j end_get_attribute_8781702230236 - bool_get_attribute_8781702230236: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 160($sp) # internal_163 = self.avar - j end_get_attribute_8781702230236 - object_get_attribute_8781702230236: - sw $t1, 160($sp) # internal_163 = avar - end_get_attribute_8781702230236: - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_163 - lw $t0, 168($sp) - sw $t0, 0($sp) # Storing internal_163 - - # Calling function function_value_at_A - jal function_value_at_A - lw $ra, 4($sp) - sw $v1, 164($sp) # internal_164 = result of function_value_at_A - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_162 - lw $t0, 176($sp) - sw $t0, 4($sp) # Storing internal_162 - - # Argument internal_164 - lw $t0, 168($sp) - sw $t0, 0($sp) # Storing internal_164 - - # Calling function function_method6_at_E - jal function_method6_at_E - lw $ra, 8($sp) - sw $v1, 164($sp) # internal_165 = result of function_method6_at_E - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument x - lw $t0, 180($sp) - sw $t0, 4($sp) # Storing x - - # Argument internal_165 - lw $t0, 164($sp) - sw $t0, 0($sp) # Storing internal_165 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 180($sp) # x = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702230330 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702230330 - j object_get_attribute_8781702230330 - int_get_attribute_8781702230330: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 144($sp) # internal_167 = self.avar - j end_get_attribute_8781702230330 - bool_get_attribute_8781702230330: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 144($sp) # internal_167 = self.avar - j end_get_attribute_8781702230330 - object_get_attribute_8781702230330: - sw $t1, 144($sp) # internal_167 = avar - end_get_attribute_8781702230330: - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_167 - lw $t0, 152($sp) - sw $t0, 0($sp) # Storing internal_167 - - # Calling function function_value_at_A - jal function_value_at_A - lw $ra, 4($sp) - sw $v1, 148($sp) # internal_168 = result of function_value_at_A - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument x - lw $t0, 176($sp) - sw $t0, 0($sp) # Storing x - - # Calling function function_value_at_A - jal function_value_at_A - lw $ra, 4($sp) - sw $v1, 144($sp) # internal_169 = result of function_value_at_A - addi $sp, $sp, 8 # Freeing space for arguments - - # Allocating Int 8 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 8 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 132($sp) # internal_170 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_169 - lw $t0, 148($sp) - sw $t0, 4($sp) # Storing internal_169 - - # Argument internal_170 - lw $t0, 144($sp) - sw $t0, 0($sp) # Storing internal_170 - - # Calling function function_mult - jal function_mult - lw $ra, 8($sp) - sw $v1, 140($sp) # internal_171 = result of function_mult - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_168 - lw $t0, 152($sp) - sw $t0, 4($sp) # Storing internal_168 - - # Argument internal_171 - lw $t0, 140($sp) - sw $t0, 0($sp) # Storing internal_171 - - # Calling function function_sub - jal function_sub - lw $ra, 8($sp) - sw $v1, 136($sp) # internal_172 = result of function_sub - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument r - lw $t0, 160($sp) - sw $t0, 4($sp) # Storing r - - # Argument internal_172 - lw $t0, 136($sp) - sw $t0, 0($sp) # Storing internal_172 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 160($sp) # r = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 16 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 110 - sb $t0, 8($v0) # internal_173[0] = 'n' - - addi $t0, $zero, 117 - sb $t0, 9($v0) # internal_173[1] = 'u' - - addi $t0, $zero, 109 - sb $t0, 10($v0) # internal_173[2] = 'm' - - addi $t0, $zero, 98 - sb $t0, 11($v0) # internal_173[3] = 'b' - - addi $t0, $zero, 101 - sb $t0, 12($v0) # internal_173[4] = 'e' - - addi $t0, $zero, 114 - sb $t0, 13($v0) # internal_173[5] = 'r' - - addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_173[6] = ' ' - - sb $zero, 15($v0) # Null-terminator at the end of the string - - sw $v0, 120($sp) # internal_173 = "number " - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 828($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_173 - lw $t0, 132($sp) - sw $t0, 0($sp) # Storing internal_173 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 128($sp) # internal_174 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702230501 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702230501 - j object_get_attribute_8781702230501 - int_get_attribute_8781702230501: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 112($sp) # internal_175 = self.avar - j end_get_attribute_8781702230501 - bool_get_attribute_8781702230501: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 112($sp) # internal_175 = self.avar - j end_get_attribute_8781702230501 - object_get_attribute_8781702230501: - sw $t1, 112($sp) # internal_175 = avar - end_get_attribute_8781702230501: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 828($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_175 - lw $t0, 124($sp) - sw $t0, 0($sp) # Storing internal_175 - - # Calling function function_print_at_Main - jal function_print_at_Main - lw $ra, 8($sp) - sw $v1, 120($sp) # internal_176 = result of function_print_at_Main - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 21 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 105 - sb $t0, 8($v0) # internal_177[0] = 'i' - - addi $t0, $zero, 115 - sb $t0, 9($v0) # internal_177[1] = 's' - - addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_177[2] = ' ' - - addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_177[3] = 'e' - - addi $t0, $zero, 113 - sb $t0, 12($v0) # internal_177[4] = 'q' - - addi $t0, $zero, 117 - sb $t0, 13($v0) # internal_177[5] = 'u' - - addi $t0, $zero, 97 - sb $t0, 14($v0) # internal_177[6] = 'a' - - addi $t0, $zero, 108 - sb $t0, 15($v0) # internal_177[7] = 'l' - - addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_177[8] = ' ' - - addi $t0, $zero, 116 - sb $t0, 17($v0) # internal_177[9] = 't' - - addi $t0, $zero, 111 - sb $t0, 18($v0) # internal_177[10] = 'o' - - addi $t0, $zero, 32 - sb $t0, 19($v0) # internal_177[11] = ' ' - - sb $zero, 20($v0) # Null-terminator at the end of the string - - sw $v0, 104($sp) # internal_177 = "is equal to " - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 828($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_177 - lw $t0, 116($sp) - sw $t0, 0($sp) # Storing internal_177 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 112($sp) # internal_178 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 828($sp) - sw $t0, 4($sp) # Storing self - - # Argument x - lw $t0, 180($sp) - sw $t0, 0($sp) # Storing x - - # Calling function function_print_at_Main - jal function_print_at_Main - lw $ra, 8($sp) - sw $v1, 108($sp) # internal_179 = result of function_print_at_Main - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 37 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 37 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 116 - sb $t0, 8($v0) # internal_180[0] = 't' - - addi $t0, $zero, 105 - sb $t0, 9($v0) # internal_180[1] = 'i' - - addi $t0, $zero, 109 - sb $t0, 10($v0) # internal_180[2] = 'm' - - addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_180[3] = 'e' - - addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_180[4] = 's' - - addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_180[5] = ' ' - - addi $t0, $zero, 56 - sb $t0, 14($v0) # internal_180[6] = '8' - - addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_180[7] = ' ' - - addi $t0, $zero, 119 - sb $t0, 16($v0) # internal_180[8] = 'w' - - addi $t0, $zero, 105 - sb $t0, 17($v0) # internal_180[9] = 'i' - - addi $t0, $zero, 116 - sb $t0, 18($v0) # internal_180[10] = 't' - - addi $t0, $zero, 104 - sb $t0, 19($v0) # internal_180[11] = 'h' - - addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_180[12] = ' ' - - addi $t0, $zero, 97 - sb $t0, 21($v0) # internal_180[13] = 'a' - - addi $t0, $zero, 32 - sb $t0, 22($v0) # internal_180[14] = ' ' - - addi $t0, $zero, 114 - sb $t0, 23($v0) # internal_180[15] = 'r' - - addi $t0, $zero, 101 - sb $t0, 24($v0) # internal_180[16] = 'e' - - addi $t0, $zero, 109 - sb $t0, 25($v0) # internal_180[17] = 'm' - - addi $t0, $zero, 97 - sb $t0, 26($v0) # internal_180[18] = 'a' - - addi $t0, $zero, 105 - sb $t0, 27($v0) # internal_180[19] = 'i' - - addi $t0, $zero, 110 - sb $t0, 28($v0) # internal_180[20] = 'n' - - addi $t0, $zero, 100 - sb $t0, 29($v0) # internal_180[21] = 'd' - - addi $t0, $zero, 101 - sb $t0, 30($v0) # internal_180[22] = 'e' - - addi $t0, $zero, 114 - sb $t0, 31($v0) # internal_180[23] = 'r' - - addi $t0, $zero, 32 - sb $t0, 32($v0) # internal_180[24] = ' ' - - addi $t0, $zero, 111 - sb $t0, 33($v0) # internal_180[25] = 'o' - - addi $t0, $zero, 102 - sb $t0, 34($v0) # internal_180[26] = 'f' - - addi $t0, $zero, 32 - sb $t0, 35($v0) # internal_180[27] = ' ' - - sb $zero, 36($v0) # Null-terminator at the end of the string - - sw $v0, 92($sp) # internal_180 = "times 8 with a remainder of " - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 828($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_180 - lw $t0, 104($sp) - sw $t0, 0($sp) # Storing internal_180 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 100($sp) # internal_181 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating A2I - li $v0, 9 - lw $a0, type_A2I - syscall - la $t0, type_A2I # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 80($sp) # internal_183 = address of allocated object A2I - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_183 - lw $t0, 88($sp) - sw $t0, 0($sp) # Storing internal_183 - - # Calling function function___init___at_A2I - jal function___init___at_A2I - lw $ra, 4($sp) - sw $v1, 88($sp) # internal_183 = result of function___init___at_A2I - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument a - lw $t0, 488($sp) - sw $t0, 4($sp) # Storing a - - # Argument internal_183 - lw $t0, 92($sp) - sw $t0, 0($sp) # Storing internal_183 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 488($sp) # a = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument a - lw $t0, 488($sp) - sw $t0, 4($sp) # Storing a - - # Argument r - lw $t0, 160($sp) - sw $t0, 0($sp) # Storing r - - # Calling function function_i2a_at_A2I - jal function_i2a_at_A2I - lw $ra, 8($sp) - sw $v1, 88($sp) # internal_184 = result of function_i2a_at_A2I - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 828($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_184 - lw $t0, 88($sp) - sw $t0, 0($sp) # Storing internal_184 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 84($sp) # internal_185 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_186[0] = '\n' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 68($sp) # internal_186 = "\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 828($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_186 - lw $t0, 80($sp) - sw $t0, 0($sp) # Storing internal_186 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 76($sp) # internal_187 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Set attribute avar of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 168($sp) # $t1 = x - beq $t1, $zero, object_set_attribute_8781702230420 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8781702230420 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8781702230420 - j object_set_attribute_8781702230420 - int_set_attribute_8781702230420: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = x - j end_set_attribute_8781702230420 - bool_set_attribute_8781702230420: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = x - j end_set_attribute_8781702230420 - object_set_attribute_8781702230420: - sw $t1, 12($t0) # self.avar = x - end_set_attribute_8781702230420: - - # internal_156 = x - lw $t0, 168($sp) - sw $t0, 188($sp) - - # Jumping to endif_8781702298167 - j endif_8781702298167 - - else_8781702298167: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 56($sp) # internal_189 = address of allocated object Int - - # Get attribute char of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'char' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702231559 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702231559 - j object_get_attribute_8781702231559 - int_get_attribute_8781702231559: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 52($sp) # internal_190 = self.char - j end_get_attribute_8781702231559 - bool_get_attribute_8781702231559: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 52($sp) # internal_190 = self.char - j end_get_attribute_8781702231559 - object_get_attribute_8781702231559: - sw $t1, 52($sp) # internal_190 = char - end_get_attribute_8781702231559: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 106 - sb $t0, 8($v0) # internal_191[0] = 'j' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 48($sp) # internal_191 = "j" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_190 - lw $t0, 64($sp) - sw $t0, 4($sp) # Storing internal_190 - - # Argument internal_191 - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing internal_191 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 56($sp) # internal_192 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_189 = internal_192 - lw $t0, 44($sp) - sw $t0, 56($sp) - - # If internal_189 then goto then_8781702298161 - lw $t0, 56($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702298161 - - # Jumping to else_8781702298161 - j else_8781702298161 - - then_8781702298161: - - # Allocating A - li $v0, 9 - lw $a0, type_A - syscall - la $t0, type_A # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 40($sp) # internal_193 = address of allocated object A - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_193 - lw $t0, 48($sp) - sw $t0, 0($sp) # Storing internal_193 - - # Calling function function___init___at_A - jal function___init___at_A - lw $ra, 4($sp) - sw $v1, 48($sp) # internal_193 = result of function___init___at_A - addi $sp, $sp, 8 # Freeing space for arguments - - # Set attribute avar of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 40($sp) # $t1 = internal_193 - beq $t1, $zero, object_set_attribute_8781702231625 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8781702231625 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8781702231625 - j object_set_attribute_8781702231625 - int_set_attribute_8781702231625: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_193 - j end_set_attribute_8781702231625 - bool_set_attribute_8781702231625: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_193 - j end_set_attribute_8781702231625 - object_set_attribute_8781702231625: - sw $t1, 12($t0) # self.avar = internal_193 - end_set_attribute_8781702231625: - - # internal_188 = internal_193 - lw $t0, 40($sp) - sw $t0, 60($sp) - - # Jumping to endif_8781702298161 - j endif_8781702298161 - - else_8781702298161: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_195 = address of allocated object Int - - # Get attribute char of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'char' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702231727 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702231727 - j object_get_attribute_8781702231727 - int_get_attribute_8781702231727: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 28($sp) # internal_196 = self.char - j end_get_attribute_8781702231727 - bool_get_attribute_8781702231727: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 28($sp) # internal_196 = self.char - j end_get_attribute_8781702231727 - object_get_attribute_8781702231727: - sw $t1, 28($sp) # internal_196 = char - end_get_attribute_8781702231727: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 113 - sb $t0, 8($v0) # internal_197[0] = 'q' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 24($sp) # internal_197 = "q" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_196 - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing internal_196 - - # Argument internal_197 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_197 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 32($sp) # internal_198 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_195 = internal_198 - lw $t0, 20($sp) - sw $t0, 32($sp) - - # If internal_195 then goto then_8781702298137 - lw $t0, 32($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8781702298137 - - # Jumping to else_8781702298137 - j else_8781702298137 - - then_8781702298137: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_199 = address of allocated object Int - - # Set attribute flag of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 16($sp) # $t1 = internal_199 - beq $t1, $zero, object_set_attribute_8781702231793 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8781702231793 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8781702231793 - j object_set_attribute_8781702231793 - int_set_attribute_8781702231793: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 20($t0) # self.flag = internal_199 - j end_set_attribute_8781702231793 - bool_set_attribute_8781702231793: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 20($t0) # self.flag = internal_199 - j end_set_attribute_8781702231793 - object_set_attribute_8781702231793: - sw $t1, 20($t0) # self.flag = internal_199 - end_set_attribute_8781702231793: - - # internal_194 = internal_199 - lw $t0, 16($sp) - sw $t0, 36($sp) - - # Jumping to endif_8781702298137 - j endif_8781702298137 - - else_8781702298137: - - # Allocating A - li $v0, 9 - lw $a0, type_A - syscall - la $t0, type_A # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 12($sp) # internal_200 = address of allocated object A - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_200 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_200 - - # Calling function function___init___at_A - jal function___init___at_A - lw $ra, 4($sp) - sw $v1, 20($sp) # internal_200 = result of function___init___at_A - addi $sp, $sp, 8 # Freeing space for arguments - - # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8781702232414 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8781702232414 - j object_get_attribute_8781702232414 - int_get_attribute_8781702232414: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($sp) # internal_201 = self.avar - j end_get_attribute_8781702232414 - bool_get_attribute_8781702232414: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($sp) # internal_201 = self.avar - j end_get_attribute_8781702232414 - object_get_attribute_8781702232414: - sw $t1, 8($sp) # internal_201 = avar - end_get_attribute_8781702232414: - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_201 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_201 - - # Calling function function_value_at_A - jal function_value_at_A - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_202 = result of function_value_at_A - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_200 - lw $t0, 24($sp) - sw $t0, 4($sp) # Storing internal_200 - - # Argument internal_202 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_202 - - # Calling function function_method1_at_A - jal function_method1_at_A - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_203 = result of function_method1_at_A - addi $sp, $sp, 12 # Freeing space for arguments - - # Set attribute avar of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_203 - beq $t1, $zero, object_set_attribute_8781702232351 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8781702232351 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8781702232351 - j object_set_attribute_8781702232351 - int_set_attribute_8781702232351: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_203 - j end_set_attribute_8781702232351 - bool_set_attribute_8781702232351: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_203 - j end_set_attribute_8781702232351 - object_set_attribute_8781702232351: - sw $t1, 12($t0) # self.avar = internal_203 - end_set_attribute_8781702232351: - - # internal_194 = internal_203 - lw $t0, 0($sp) - sw $t0, 36($sp) - - # Jumping to endif_8781702298137 - j endif_8781702298137 - - endif_8781702298137: - - # internal_188 = internal_194 - lw $t0, 36($sp) - sw $t0, 60($sp) - - # Jumping to endif_8781702298161 - j endif_8781702298161 - - endif_8781702298161: - - # internal_156 = internal_188 - lw $t0, 60($sp) - sw $t0, 188($sp) - - # Jumping to endif_8781702298167 - j endif_8781702298167 - - endif_8781702298167: - - # internal_133 = internal_156 - lw $t0, 188($sp) - sw $t0, 280($sp) - - # Jumping to endif_8781702298173 - j endif_8781702298173 - - endif_8781702298173: - - # internal_124 = internal_133 - lw $t0, 280($sp) - sw $t0, 316($sp) - - # Jumping to endif_8781702298179 - j endif_8781702298179 - - endif_8781702298179: - - # internal_115 = internal_124 - lw $t0, 316($sp) - sw $t0, 352($sp) - - # Jumping to endif_8781702298185 - j endif_8781702298185 - - endif_8781702298185: - - # internal_106 = internal_115 - lw $t0, 352($sp) - sw $t0, 388($sp) - - # Jumping to endif_8781702298191 - j endif_8781702298191 - - endif_8781702298191: - - # internal_92 = internal_106 - lw $t0, 388($sp) - sw $t0, 444($sp) - - # Jumping to endif_8781702298197 - j endif_8781702298197 - - endif_8781702298197: - - # internal_32 = internal_92 - lw $t0, 444($sp) - sw $t0, 684($sp) - - # Jumping to endif_8781702298203 - j endif_8781702298203 - - endif_8781702298203: - - # internal_18 = internal_32 - lw $t0, 684($sp) - sw $t0, 740($sp) - - # Jumping to endif_8781702298209 - j endif_8781702298209 - - endif_8781702298209: - - # Jumping to while_start_8781702298224 - j while_start_8781702298224 - - while_end_8781702298224: - - # Loading return value in $v1 - addi $v1, $zero, 0 - - # Freeing space for local variables - addi $sp, $sp, 816 - - jr $ra - - main: - # Reserving space for local variables - addi $sp, $sp, -8 - - # Allocating Main - li $v0, 9 - lw $a0, type_Main - syscall - la $t0, type_Main # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object Main - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function___init___at_Main - jal function___init___at_Main - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_Main - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function_main_at_Main - jal function_main_at_Main - lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function_main_at_Main - addi $sp, $sp, 8 # Freeing space for arguments - - # Exit program - li $v0, 10 - syscall - - \ No newline at end of file diff --git a/src/arith.cil b/src/arith.cil deleted file mode 100644 index d6e8b6c78..000000000 --- a/src/arith.cil +++ /dev/null @@ -1,3715 +0,0 @@ -.TYPES -type Object { - inherits from null - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method __init__: function___init___at_Object -} -type IO { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method out_string: function_out_string_at_IO - method out_int: function_out_int_at_IO - method in_string: function_in_string_at_IO - method in_int: function_in_int_at_IO - method __init__: function___init___at_IO -} -type Int { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method __init__: function___init___at_Int -} -type String { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method length: function_length_at_String - method concat: function_concat_at_String - method substr: function_substr_at_String - method __init__: function___init___at_String -} -type Bool { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method __init__: function___init___at_Bool -} -type A { - inherits from Object - - attribute var - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method value: function_value_at_A - method set_var: function_set_var_at_A - method method1: function_method1_at_A - method method2: function_method2_at_A - method method3: function_method3_at_A - method method4: function_method4_at_A - method method5: function_method5_at_A - method __init__: function___init___at_A -} -type B { - inherits from A - - attribute var - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method value: function_value_at_A - method set_var: function_set_var_at_A - method method1: function_method1_at_A - method method2: function_method2_at_A - method method3: function_method3_at_A - method method4: function_method4_at_A - method method5: function_method5_at_B - method __init__: function___init___at_B -} -type C { - inherits from B - - attribute var - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method value: function_value_at_A - method set_var: function_set_var_at_A - method method1: function_method1_at_A - method method2: function_method2_at_A - method method3: function_method3_at_A - method method4: function_method4_at_A - method method5: function_method5_at_C - method __init__: function___init___at_C - method method6: function_method6_at_C -} -type D { - inherits from B - - attribute var - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method value: function_value_at_A - method set_var: function_set_var_at_A - method method1: function_method1_at_A - method method2: function_method2_at_A - method method3: function_method3_at_A - method method4: function_method4_at_A - method method5: function_method5_at_B - method __init__: function___init___at_D - method method7: function_method7_at_D -} -type E { - inherits from D - - attribute var - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method value: function_value_at_A - method set_var: function_set_var_at_A - method method1: function_method1_at_A - method method2: function_method2_at_A - method method3: function_method3_at_A - method method4: function_method4_at_A - method method5: function_method5_at_B - method __init__: function___init___at_E - method method7: function_method7_at_D - method method6: function_method6_at_E -} -type A2I { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method c2i: function_c2i_at_A2I - method i2c: function_i2c_at_A2I - method a2i: function_a2i_at_A2I - method a2i_aux: function_a2i_aux_at_A2I - method i2a: function_i2a_at_A2I - method i2a_aux: function_i2a_aux_at_A2I - method __init__: function___init___at_A2I -} -type Main { - inherits from IO - - attribute char - attribute avar - attribute a_var - attribute flag - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method out_string: function_out_string_at_IO - method out_int: function_out_int_at_IO - method in_string: function_in_string_at_IO - method in_int: function_in_int_at_IO - method menu: function_menu_at_Main - method prompt: function_prompt_at_Main - method get_int: function_get_int_at_Main - method is_even: function_is_even_at_Main - method class_type: function_class_type_at_Main - method print: function_print_at_Main - method main: function_main_at_Main - method __init__: function___init___at_Main -} - -.DATA - - -.CODE -function function_add{ - PARAM a - PARAM b - - LOCAL internal_0 # Adding result - - internal_0 = ALLOCINT 0 - internal_0 = a + b - - RETURN internal_0 -} -function function_sub{ - PARAM a - PARAM b - - LOCAL internal_0 # Substracting result - - internal_0 = ALLOCINT 0 - internal_0 = a - b - - RETURN internal_0 -} -function function_mult{ - PARAM a - PARAM b - - LOCAL internal_0 # Multiting result - - internal_0 = ALLOCINT 0 - internal_0 = a * b - - RETURN internal_0 -} -function function_div{ - PARAM a - PARAM b - - LOCAL internal_0 # Dividing result - - internal_0 = ALLOCINT 0 - internal_0 = a / b - - RETURN internal_0 -} -function function_xor{ - PARAM a - PARAM b - - LOCAL internal_0 # Xor result - - internal_0 = ALLOCINT 0 - internal_0 = XOR a b - - RETURN internal_0 -} -function function_less_than{ - PARAM a - PARAM b - - LOCAL internal_0 # Less than result - - internal_0 = ALLOCBOOL 0 - internal_0 = a < b - - RETURN internal_0 -} -function function_less_than_or_equal{ - PARAM a - PARAM b - - LOCAL internal_0 # Less than or equal result - - internal_0 = ALLOCBOOL 0 - internal_0 = a <= b - - RETURN internal_0 -} -function function_equal{ - PARAM a - PARAM b - - LOCAL internal_0 # Equal result - LOCAL internal_1 # Null Pointer - LOCAL internal_2 # One of params is null - LOCAL internal_3 # Type of a - LOCAL internal_4 # Type Int - LOCAL internal_5 # Type Bool - LOCAL internal_6 # Type String - LOCAL internal_7 # Type of a equals int - LOCAL internal_8 # Type of a equals bool - LOCAL internal_9 # Type of a equals string - - internal_0 = ALLOCBOOL 0 - internal_1 = ALLOCNULL - internal_2 = ALLOCBOOL 0 - internal_2 = EQUALADDR a internal_1 - internal_2 = EQUALADDR b internal_1 - IF internal_2 GOTO a_is_type_object - internal_3 = TYPEOF a - internal_4 = TYPEADDR Int - internal_5 = TYPEADDR Bool - internal_6 = TYPEADDR String - internal_7 = ALLOCBOOL 0 - internal_8 = ALLOCBOOL 0 - internal_9 = ALLOCBOOL 0 - internal_7 = EQUALADDR internal_3 internal_4 - internal_8 = EQUALADDR internal_3 internal_5 - internal_9 = EQUALADDR internal_3 internal_6 - - IF internal_7 GOTO a_is_type_int_or_bool - IF internal_8 GOTO a_is_type_int_or_bool - IF internal_9 GOTO a_is_type_string - GOTO a_is_type_object - - a_is_type_int_or_bool: - internal_0 = EQUALINT a b - GOTO end_of_equal - - a_is_type_string: - internal_0 = EQUALSTR a b - GOTO end_of_equal - - a_is_type_object: - internal_0 = a == b - GOTO end_of_equal - - end_of_equal: - - RETURN internal_0 -} -function function_assign{ - PARAM dest - PARAM source - - LOCAL internal_0 # Null Pointer - LOCAL internal_1 # One of params is null - LOCAL internal_2 # Type of source - LOCAL internal_3 # Type Int - LOCAL internal_4 # Type Bool - LOCAL internal_5 # Type of source equals int - LOCAL internal_6 # Type of source equals bool - - internal_0 = ALLOCNULL - internal_1 = ALLOCBOOL 0 - internal_1 = EQUALADDR source internal_0 - internal_1 = EQUALADDR dest internal_0 - IF internal_1 GOTO source_is_type_object - internal_2 = TYPEOF source - internal_3 = TYPEADDR Int - internal_4 = TYPEADDR Bool - internal_5 = ALLOCBOOL 0 - internal_6 = ALLOCBOOL 0 - internal_5 = EQUALADDR internal_2 internal_3 - internal_6 = EQUALADDR internal_2 internal_4 - - IF internal_5 GOTO source_is_type_int_or_bool - IF internal_6 GOTO source_is_type_int_or_bool - GOTO source_is_type_object - - source_is_type_int_or_bool: - dest = INT source - GOTO source_end_of_equal - - source_is_type_object: - dest = source - GOTO source_end_of_equal - - source_end_of_equal: - - RETURN dest -} -function function___init___at_Object{ - PARAM self - - RETURN self -} -function function_abort_at_Object{ - PARAM self - - LOCAL internal_0 - LOCAL internal_1 - LOCAL internal_2 - LOCAL internal_3 - - internal_0 = ALLOCSTR "Abort called from class " - internal_2 = ALLOCSTR "\n" - ARG self - internal_1 = VCALL String function_type_name_at_Object - ARG internal_0 - ARG internal_1 - internal_3 = VCALL String function_concat_at_String - ARG internal_3 - ARG internal_2 - internal_3 = VCALL String function_concat_at_String - PRINTSTR internal_3 - HALT - - RETURN self -} -function function_type_name_at_Object{ - PARAM self - - LOCAL internal_0 # type_name - - internal_0 = TYPENAME self - - RETURN internal_0 -} -function function_copy_at_Object{ - PARAM self - - LOCAL internal_0 - - internal_0 = COPY self - - RETURN internal_0 -} -function function___init___at_IO{ - PARAM self - - RETURN self -} -function function_out_string_at_IO{ - PARAM self - PARAM x - - PRINTSTR x - - RETURN self -} -function function_out_int_at_IO{ - PARAM self - PARAM x - - PRINTINT x - - RETURN self -} -function function_in_string_at_IO{ - PARAM self - - LOCAL internal_0 - - READSTR internal_0 - - RETURN internal_0 -} -function function_in_int_at_IO{ - PARAM self - - LOCAL internal_0 - - internal_0 = ALLOCINT 0 - READINT internal_0 - - RETURN internal_0 -} -function function___init___at_String{ - PARAM self - - RETURN self -} -function function_length_at_String{ - PARAM self - - LOCAL internal_0 - - internal_0 = ALLOCINT 0 - internal_0 = LENGTH self - - RETURN internal_0 -} -function function_concat_at_String{ - PARAM self - PARAM s - - LOCAL internal_0 - - internal_0 = CONCAT self s - - RETURN internal_0 -} -function function_substr_at_String{ - PARAM self - PARAM i - PARAM l - - LOCAL internal_0 - - internal_0 = SUBSTRING self i l - - RETURN internal_0 -} -function function___init___at_A{ - PARAM self - - LOCAL internal_0 # Integer 0 - - internal_0 = ALLOCINT 0 - - SETATTR self var internal_0 - - RETURN self -} -function function_value_at_A{ - PARAM self - - LOCAL internal_0 - - internal_0 = GETATTR self var - - RETURN internal_0 -} -function function_set_var_at_A{ - PARAM self - PARAM num - - - SETATTR self var num - - RETURN self -} -function function_method1_at_A{ - PARAM self - PARAM num - - RETURN self -} -function function_method2_at_A{ - PARAM self - PARAM num1 - PARAM num2 - - LOCAL x - LOCAL internal_1 # Store the result of the operation function_add - LOCAL internal_2 # Store an instance of the class B - LOCAL internal_3 - - # Let x: Int - x = ALLOCINT 0 - - ARG num1 - ARG num2 - internal_1 = CALL function_add - - ARG x - ARG internal_1 - x = CALL function_assign - internal_2 = ALLOCATE B # Allocate the object B - ARG internal_2 # Pass the instance to the constructor - internal_2 = VCALL B function___init___at_B # Call the constructor - ARG internal_2 - ARG x - internal_3 = VCALL B function_set_var_at_A - - RETURN internal_3 -} -function function_method3_at_A{ - PARAM self - PARAM num - - LOCAL x - LOCAL internal_1 # Integer 1 - LOCAL internal_2 # Integer 4294967295 - LOCAL internal_3 # Store the complement a2 of num - LOCAL internal_4 # Store an instance of the class C - LOCAL internal_5 - - # Let x: Int - x = ALLOCINT 0 - internal_1 = ALLOCINT 1 - internal_2 = ALLOCINT 4294967295 - internal_3 = ALLOCINT 0 - ARG num - ARG internal_2 - internal_3 = CALL function_xor - ARG internal_3 - ARG internal_1 - internal_3 = CALL function_add - - ARG x - ARG internal_3 - x = CALL function_assign - internal_4 = ALLOCATE C # Allocate the object C - ARG internal_4 # Pass the instance to the constructor - internal_4 = VCALL C function___init___at_C # Call the constructor - ARG internal_4 - ARG x - internal_5 = VCALL C function_set_var_at_A - - RETURN internal_5 -} -function function_method4_at_A{ - PARAM self - PARAM num1 - PARAM num2 - - LOCAL internal_0 - LOCAL internal_1 - LOCAL internal_2 # Store the result of the operation function_less_than - LOCAL x - LOCAL internal_4 # Store the result of the operation function_sub - LOCAL internal_5 # Store an instance of the class D - LOCAL internal_6 - LOCAL x - LOCAL internal_8 # Store the result of the operation function_sub - LOCAL internal_9 # Store an instance of the class D - LOCAL internal_10 - - # Conditional - internal_1 = ALLOCBOOL 0 - - ARG num2 - ARG num1 - internal_2 = CALL function_less_than - internal_1 = internal_2 - IF internal_1 GOTO then_8781702322008 - GOTO else_8781702322008 - - then_8781702322008: - # Let x: Int - x = ALLOCINT 0 - - ARG num1 - ARG num2 - internal_4 = CALL function_sub - - ARG x - ARG internal_4 - x = CALL function_assign - internal_5 = ALLOCATE D # Allocate the object D - ARG internal_5 # Pass the instance to the constructor - internal_5 = VCALL D function___init___at_D # Call the constructor - ARG internal_5 - ARG x - internal_6 = VCALL D function_set_var_at_A - internal_0 = internal_6 - GOTO endif_8781702322008 - - else_8781702322008: - # Let x: Int - x = ALLOCINT 0 - - ARG num2 - ARG num1 - internal_8 = CALL function_sub - - ARG x - ARG internal_8 - x = CALL function_assign - internal_9 = ALLOCATE D # Allocate the object D - ARG internal_9 # Pass the instance to the constructor - internal_9 = VCALL D function___init___at_D # Call the constructor - ARG internal_9 - ARG x - internal_10 = VCALL D function_set_var_at_A - internal_0 = internal_10 - GOTO endif_8781702322008 - - endif_8781702322008: - - RETURN internal_0 -} -function function_method5_at_A{ - PARAM self - PARAM num - - LOCAL x - LOCAL internal_1 # Integer 1 - LOCAL y - LOCAL internal_3 # Integer 1 - LOCAL internal_4 # Store the result of the operation function_less_than_or_equal - LOCAL internal_5 # Store the result of the operation function_mult - LOCAL internal_6 # Integer 1 - LOCAL internal_7 # Store the result of the operation function_add - LOCAL internal_8 # Store an instance of the class E - LOCAL internal_9 - - # Let x: Int - - internal_1 = ALLOCINT 1 - ARG x - ARG internal_1 - x = CALL function_assign - # Let y: Int - - internal_3 = ALLOCINT 1 - ARG y - ARG internal_3 - y = CALL function_assign - - # While loop - while_start_8781702322092: - - ARG y - ARG num - internal_4 = CALL function_less_than_or_equal - IF internal_4 GOTO while_body_8781702322092 - GOTO while_end_8781702322092 - - while_body_8781702322092: - - ARG x - ARG y - internal_5 = CALL function_mult - - ARG x - ARG internal_5 - x = CALL function_assign - internal_6 = ALLOCINT 1 - - ARG y - ARG internal_6 - internal_7 = CALL function_add - - ARG y - ARG internal_7 - y = CALL function_assign - GOTO while_start_8781702322092 - - while_end_8781702322092: - internal_8 = ALLOCATE E # Allocate the object E - ARG internal_8 # Pass the instance to the constructor - internal_8 = VCALL E function___init___at_E # Call the constructor - ARG internal_8 - ARG x - internal_9 = VCALL E function_set_var_at_A - - RETURN internal_9 -} -function function___init___at_B{ - PARAM self - - LOCAL internal_0 # Integer 0 - - internal_0 = ALLOCINT 0 - - SETATTR self var internal_0 - - RETURN self -} -function function_method5_at_B{ - PARAM self - PARAM num - - LOCAL x - LOCAL internal_1 # Store the result of the operation function_mult - LOCAL internal_2 # Store an instance of the class E - LOCAL internal_3 - - # Let x: Int - x = ALLOCINT 0 - - ARG num - ARG num - internal_1 = CALL function_mult - - ARG x - ARG internal_1 - x = CALL function_assign - internal_2 = ALLOCATE E # Allocate the object E - ARG internal_2 # Pass the instance to the constructor - internal_2 = VCALL E function___init___at_E # Call the constructor - ARG internal_2 - ARG x - internal_3 = VCALL E function_set_var_at_A - - RETURN internal_3 -} -function function___init___at_C{ - PARAM self - - LOCAL internal_0 # Integer 0 - - internal_0 = ALLOCINT 0 - - SETATTR self var internal_0 - - RETURN self -} -function function_method6_at_C{ - PARAM self - PARAM num - - LOCAL x - LOCAL internal_1 # Integer 1 - LOCAL internal_2 # Integer 4294967295 - LOCAL internal_3 # Store the complement a2 of num - LOCAL internal_4 # Store an instance of the class A - LOCAL internal_5 - - # Let x: Int - x = ALLOCINT 0 - internal_1 = ALLOCINT 1 - internal_2 = ALLOCINT 4294967295 - internal_3 = ALLOCINT 0 - ARG num - ARG internal_2 - internal_3 = CALL function_xor - ARG internal_3 - ARG internal_1 - internal_3 = CALL function_add - - ARG x - ARG internal_3 - x = CALL function_assign - internal_4 = ALLOCATE A # Allocate the object A - ARG internal_4 # Pass the instance to the constructor - internal_4 = VCALL A function___init___at_A # Call the constructor - ARG internal_4 - ARG x - internal_5 = VCALL A function_set_var_at_A - - RETURN internal_5 -} -function function_method5_at_C{ - PARAM self - PARAM num - - LOCAL x - LOCAL internal_1 # Store the result of the operation function_mult - LOCAL internal_2 # Store the result of the operation function_mult - LOCAL internal_3 # Store an instance of the class E - LOCAL internal_4 - - # Let x: Int - x = ALLOCINT 0 - - ARG num - ARG num - internal_1 = CALL function_mult - - ARG internal_1 - ARG num - internal_2 = CALL function_mult - - ARG x - ARG internal_2 - x = CALL function_assign - internal_3 = ALLOCATE E # Allocate the object E - ARG internal_3 # Pass the instance to the constructor - internal_3 = VCALL E function___init___at_E # Call the constructor - ARG internal_3 - ARG x - internal_4 = VCALL E function_set_var_at_A - - RETURN internal_4 -} -function function___init___at_D{ - PARAM self - - LOCAL internal_0 # Integer 0 - - internal_0 = ALLOCINT 0 - - SETATTR self var internal_0 - - RETURN self -} -function function_method7_at_D{ - PARAM self - PARAM num - - LOCAL x - LOCAL internal_1 - LOCAL internal_2 - LOCAL internal_3 # Integer 0 - LOCAL internal_4 # Store the result of the operation function_less_than - LOCAL internal_5 # Integer 1 - LOCAL internal_6 # Integer 4294967295 - LOCAL internal_7 # Store the complement a2 of x - LOCAL internal_8 - LOCAL internal_9 - LOCAL internal_10 - LOCAL internal_11 # Integer 0 - LOCAL internal_12 # Store the result of the operation function_equal - LOCAL internal_13 # Boolean true - LOCAL internal_14 - LOCAL internal_15 - LOCAL internal_16 # Integer 1 - LOCAL internal_17 # Store the result of the operation function_equal - LOCAL internal_18 # Boolean false - LOCAL internal_19 - LOCAL internal_20 - LOCAL internal_21 # Integer 2 - LOCAL internal_22 # Store the result of the operation function_equal - LOCAL internal_23 # Boolean false - LOCAL internal_24 # Integer 3 - LOCAL internal_25 # Store the result of the operation function_sub - LOCAL internal_26 - - # Let x: Int - - ARG x - ARG num - x = CALL function_assign - # Conditional - internal_2 = ALLOCBOOL 0 - internal_3 = ALLOCINT 0 - - ARG x - ARG internal_3 - internal_4 = CALL function_less_than - internal_2 = internal_4 - IF internal_2 GOTO then_8781702323502 - GOTO else_8781702323502 - - then_8781702323502: - internal_5 = ALLOCINT 1 - internal_6 = ALLOCINT 4294967295 - internal_7 = ALLOCINT 0 - ARG x - ARG internal_6 - internal_7 = CALL function_xor - ARG internal_7 - ARG internal_5 - internal_7 = CALL function_add - ARG self - ARG internal_7 - internal_8 = VCALL D function_method7_at_D - internal_1 = internal_8 - GOTO endif_8781702323502 - - else_8781702323502: - # Conditional - internal_10 = ALLOCBOOL 0 - internal_11 = ALLOCINT 0 - - ARG internal_11 - ARG x - internal_12 = CALL function_equal - internal_10 = internal_12 - IF internal_10 GOTO then_8781702323481 - GOTO else_8781702323481 - - then_8781702323481: - internal_13 = ALLOCBOOL 1 - internal_9 = internal_13 - GOTO endif_8781702323481 - - else_8781702323481: - # Conditional - internal_15 = ALLOCBOOL 0 - internal_16 = ALLOCINT 1 - - ARG internal_16 - ARG x - internal_17 = CALL function_equal - internal_15 = internal_17 - IF internal_15 GOTO then_8781702323484 - GOTO else_8781702323484 - - then_8781702323484: - internal_18 = ALLOCBOOL 0 - internal_14 = internal_18 - GOTO endif_8781702323484 - - else_8781702323484: - # Conditional - internal_20 = ALLOCBOOL 0 - internal_21 = ALLOCINT 2 - - ARG internal_21 - ARG x - internal_22 = CALL function_equal - internal_20 = internal_22 - IF internal_20 GOTO then_8781702323490 - GOTO else_8781702323490 - - then_8781702323490: - internal_23 = ALLOCBOOL 0 - internal_19 = internal_23 - GOTO endif_8781702323490 - - else_8781702323490: - internal_24 = ALLOCINT 3 - - ARG x - ARG internal_24 - internal_25 = CALL function_sub - ARG self - ARG internal_25 - internal_26 = VCALL D function_method7_at_D - internal_19 = internal_26 - GOTO endif_8781702323490 - - endif_8781702323490: - internal_14 = internal_19 - GOTO endif_8781702323484 - - endif_8781702323484: - internal_9 = internal_14 - GOTO endif_8781702323481 - - endif_8781702323481: - internal_1 = internal_9 - GOTO endif_8781702323502 - - endif_8781702323502: - - RETURN internal_1 -} -function function___init___at_E{ - PARAM self - - LOCAL internal_0 # Integer 0 - - internal_0 = ALLOCINT 0 - - SETATTR self var internal_0 - - RETURN self -} -function function_method6_at_E{ - PARAM self - PARAM num - - LOCAL x - LOCAL internal_1 # Integer 8 - LOCAL internal_2 # Store the result of the operation function_div - LOCAL internal_3 # Store an instance of the class A - LOCAL internal_4 - - # Let x: Int - x = ALLOCINT 0 - internal_1 = ALLOCINT 8 - - ARG num - ARG internal_1 - internal_2 = CALL function_div - - ARG x - ARG internal_2 - x = CALL function_assign - internal_3 = ALLOCATE A # Allocate the object A - ARG internal_3 # Pass the instance to the constructor - internal_3 = VCALL A function___init___at_A # Call the constructor - ARG internal_3 - ARG x - internal_4 = VCALL A function_set_var_at_A - - RETURN internal_4 -} -function function___init___at_A2I{ - PARAM self - - RETURN self -} -function function_c2i_at_A2I{ - PARAM self - PARAM char - - LOCAL internal_0 - LOCAL internal_1 - LOCAL internal_2 # String "0" - LOCAL internal_3 # Store the result of the operation function_equal - LOCAL internal_4 # Integer 0 - LOCAL internal_5 - LOCAL internal_6 - LOCAL internal_7 # String "1" - LOCAL internal_8 # Store the result of the operation function_equal - LOCAL internal_9 # Integer 1 - LOCAL internal_10 - LOCAL internal_11 - LOCAL internal_12 # String "2" - LOCAL internal_13 # Store the result of the operation function_equal - LOCAL internal_14 # Integer 2 - LOCAL internal_15 - LOCAL internal_16 - LOCAL internal_17 # String "3" - LOCAL internal_18 # Store the result of the operation function_equal - LOCAL internal_19 # Integer 3 - LOCAL internal_20 - LOCAL internal_21 - LOCAL internal_22 # String "4" - LOCAL internal_23 # Store the result of the operation function_equal - LOCAL internal_24 # Integer 4 - LOCAL internal_25 - LOCAL internal_26 - LOCAL internal_27 # String "5" - LOCAL internal_28 # Store the result of the operation function_equal - LOCAL internal_29 # Integer 5 - LOCAL internal_30 - LOCAL internal_31 - LOCAL internal_32 # String "6" - LOCAL internal_33 # Store the result of the operation function_equal - LOCAL internal_34 # Integer 6 - LOCAL internal_35 - LOCAL internal_36 - LOCAL internal_37 # String "7" - LOCAL internal_38 # Store the result of the operation function_equal - LOCAL internal_39 # Integer 7 - LOCAL internal_40 - LOCAL internal_41 - LOCAL internal_42 # String "8" - LOCAL internal_43 # Store the result of the operation function_equal - LOCAL internal_44 # Integer 8 - LOCAL internal_45 - LOCAL internal_46 - LOCAL internal_47 # String "9" - LOCAL internal_48 # Store the result of the operation function_equal - LOCAL internal_49 # Integer 9 - LOCAL internal_50 - LOCAL internal_51 # Integer 0 - - # Conditional - internal_1 = ALLOCBOOL 0 - internal_2 = ALLOCSTR "0" - - ARG char - ARG internal_2 - internal_3 = CALL function_equal - internal_1 = internal_3 - IF internal_1 GOTO then_8781702324152 - GOTO else_8781702324152 - - then_8781702324152: - internal_4 = ALLOCINT 0 - internal_0 = internal_4 - GOTO endif_8781702324152 - - else_8781702324152: - # Conditional - internal_6 = ALLOCBOOL 0 - internal_7 = ALLOCSTR "1" - - ARG char - ARG internal_7 - internal_8 = CALL function_equal - internal_6 = internal_8 - IF internal_6 GOTO then_8781702324146 - GOTO else_8781702324146 - - then_8781702324146: - internal_9 = ALLOCINT 1 - internal_5 = internal_9 - GOTO endif_8781702324146 - - else_8781702324146: - # Conditional - internal_11 = ALLOCBOOL 0 - internal_12 = ALLOCSTR "2" - - ARG char - ARG internal_12 - internal_13 = CALL function_equal - internal_11 = internal_13 - IF internal_11 GOTO then_8781702324140 - GOTO else_8781702324140 - - then_8781702324140: - internal_14 = ALLOCINT 2 - internal_10 = internal_14 - GOTO endif_8781702324140 - - else_8781702324140: - # Conditional - internal_16 = ALLOCBOOL 0 - internal_17 = ALLOCSTR "3" - - ARG char - ARG internal_17 - internal_18 = CALL function_equal - internal_16 = internal_18 - IF internal_16 GOTO then_8781702324134 - GOTO else_8781702324134 - - then_8781702324134: - internal_19 = ALLOCINT 3 - internal_15 = internal_19 - GOTO endif_8781702324134 - - else_8781702324134: - # Conditional - internal_21 = ALLOCBOOL 0 - internal_22 = ALLOCSTR "4" - - ARG char - ARG internal_22 - internal_23 = CALL function_equal - internal_21 = internal_23 - IF internal_21 GOTO then_8781702324128 - GOTO else_8781702324128 - - then_8781702324128: - internal_24 = ALLOCINT 4 - internal_20 = internal_24 - GOTO endif_8781702324128 - - else_8781702324128: - # Conditional - internal_26 = ALLOCBOOL 0 - internal_27 = ALLOCSTR "5" - - ARG char - ARG internal_27 - internal_28 = CALL function_equal - internal_26 = internal_28 - IF internal_26 GOTO then_8781702324122 - GOTO else_8781702324122 - - then_8781702324122: - internal_29 = ALLOCINT 5 - internal_25 = internal_29 - GOTO endif_8781702324122 - - else_8781702324122: - # Conditional - internal_31 = ALLOCBOOL 0 - internal_32 = ALLOCSTR "6" - - ARG char - ARG internal_32 - internal_33 = CALL function_equal - internal_31 = internal_33 - IF internal_31 GOTO then_8781702324116 - GOTO else_8781702324116 - - then_8781702324116: - internal_34 = ALLOCINT 6 - internal_30 = internal_34 - GOTO endif_8781702324116 - - else_8781702324116: - # Conditional - internal_36 = ALLOCBOOL 0 - internal_37 = ALLOCSTR "7" - - ARG char - ARG internal_37 - internal_38 = CALL function_equal - internal_36 = internal_38 - IF internal_36 GOTO then_8781702324110 - GOTO else_8781702324110 - - then_8781702324110: - internal_39 = ALLOCINT 7 - internal_35 = internal_39 - GOTO endif_8781702324110 - - else_8781702324110: - # Conditional - internal_41 = ALLOCBOOL 0 - internal_42 = ALLOCSTR "8" - - ARG char - ARG internal_42 - internal_43 = CALL function_equal - internal_41 = internal_43 - IF internal_41 GOTO then_8781702324104 - GOTO else_8781702324104 - - then_8781702324104: - internal_44 = ALLOCINT 8 - internal_40 = internal_44 - GOTO endif_8781702324104 - - else_8781702324104: - # Conditional - internal_46 = ALLOCBOOL 0 - internal_47 = ALLOCSTR "9" - - ARG char - ARG internal_47 - internal_48 = CALL function_equal - internal_46 = internal_48 - IF internal_46 GOTO then_8781702324083 - GOTO else_8781702324083 - - then_8781702324083: - internal_49 = ALLOCINT 9 - internal_45 = internal_49 - GOTO endif_8781702324083 - - else_8781702324083: - ARG self - internal_50 = VCALL A2I function_abort_at_Object - internal_51 = ALLOCINT 0 - internal_45 = internal_51 - GOTO endif_8781702324083 - - endif_8781702324083: - internal_40 = internal_45 - GOTO endif_8781702324104 - - endif_8781702324104: - internal_35 = internal_40 - GOTO endif_8781702324110 - - endif_8781702324110: - internal_30 = internal_35 - GOTO endif_8781702324116 - - endif_8781702324116: - internal_25 = internal_30 - GOTO endif_8781702324122 - - endif_8781702324122: - internal_20 = internal_25 - GOTO endif_8781702324128 - - endif_8781702324128: - internal_15 = internal_20 - GOTO endif_8781702324134 - - endif_8781702324134: - internal_10 = internal_15 - GOTO endif_8781702324140 - - endif_8781702324140: - internal_5 = internal_10 - GOTO endif_8781702324146 - - endif_8781702324146: - internal_0 = internal_5 - GOTO endif_8781702324152 - - endif_8781702324152: - - RETURN internal_0 -} -function function_i2c_at_A2I{ - PARAM self - PARAM i - - LOCAL internal_0 - LOCAL internal_1 - LOCAL internal_2 # Integer 0 - LOCAL internal_3 # Store the result of the operation function_equal - LOCAL internal_4 # String "0" - LOCAL internal_5 - LOCAL internal_6 - LOCAL internal_7 # Integer 1 - LOCAL internal_8 # Store the result of the operation function_equal - LOCAL internal_9 # String "1" - LOCAL internal_10 - LOCAL internal_11 - LOCAL internal_12 # Integer 2 - LOCAL internal_13 # Store the result of the operation function_equal - LOCAL internal_14 # String "2" - LOCAL internal_15 - LOCAL internal_16 - LOCAL internal_17 # Integer 3 - LOCAL internal_18 # Store the result of the operation function_equal - LOCAL internal_19 # String "3" - LOCAL internal_20 - LOCAL internal_21 - LOCAL internal_22 # Integer 4 - LOCAL internal_23 # Store the result of the operation function_equal - LOCAL internal_24 # String "4" - LOCAL internal_25 - LOCAL internal_26 - LOCAL internal_27 # Integer 5 - LOCAL internal_28 # Store the result of the operation function_equal - LOCAL internal_29 # String "5" - LOCAL internal_30 - LOCAL internal_31 - LOCAL internal_32 # Integer 6 - LOCAL internal_33 # Store the result of the operation function_equal - LOCAL internal_34 # String "6" - LOCAL internal_35 - LOCAL internal_36 - LOCAL internal_37 # Integer 7 - LOCAL internal_38 # Store the result of the operation function_equal - LOCAL internal_39 # String "7" - LOCAL internal_40 - LOCAL internal_41 - LOCAL internal_42 # Integer 8 - LOCAL internal_43 # Store the result of the operation function_equal - LOCAL internal_44 # String "8" - LOCAL internal_45 - LOCAL internal_46 - LOCAL internal_47 # Integer 9 - LOCAL internal_48 # Store the result of the operation function_equal - LOCAL internal_49 # String "9" - LOCAL internal_50 - LOCAL internal_51 # String "" - - # Conditional - internal_1 = ALLOCBOOL 0 - internal_2 = ALLOCINT 0 - - ARG i - ARG internal_2 - internal_3 = CALL function_equal - internal_1 = internal_3 - IF internal_1 GOTO then_8781702324730 - GOTO else_8781702324730 - - then_8781702324730: - internal_4 = ALLOCSTR "0" - internal_0 = internal_4 - GOTO endif_8781702324730 - - else_8781702324730: - # Conditional - internal_6 = ALLOCBOOL 0 - internal_7 = ALLOCINT 1 - - ARG i - ARG internal_7 - internal_8 = CALL function_equal - internal_6 = internal_8 - IF internal_6 GOTO then_8781702324724 - GOTO else_8781702324724 - - then_8781702324724: - internal_9 = ALLOCSTR "1" - internal_5 = internal_9 - GOTO endif_8781702324724 - - else_8781702324724: - # Conditional - internal_11 = ALLOCBOOL 0 - internal_12 = ALLOCINT 2 - - ARG i - ARG internal_12 - internal_13 = CALL function_equal - internal_11 = internal_13 - IF internal_11 GOTO then_8781702324718 - GOTO else_8781702324718 - - then_8781702324718: - internal_14 = ALLOCSTR "2" - internal_10 = internal_14 - GOTO endif_8781702324718 - - else_8781702324718: - # Conditional - internal_16 = ALLOCBOOL 0 - internal_17 = ALLOCINT 3 - - ARG i - ARG internal_17 - internal_18 = CALL function_equal - internal_16 = internal_18 - IF internal_16 GOTO then_8781702324712 - GOTO else_8781702324712 - - then_8781702324712: - internal_19 = ALLOCSTR "3" - internal_15 = internal_19 - GOTO endif_8781702324712 - - else_8781702324712: - # Conditional - internal_21 = ALLOCBOOL 0 - internal_22 = ALLOCINT 4 - - ARG i - ARG internal_22 - internal_23 = CALL function_equal - internal_21 = internal_23 - IF internal_21 GOTO then_8781702324706 - GOTO else_8781702324706 - - then_8781702324706: - internal_24 = ALLOCSTR "4" - internal_20 = internal_24 - GOTO endif_8781702324706 - - else_8781702324706: - # Conditional - internal_26 = ALLOCBOOL 0 - internal_27 = ALLOCINT 5 - - ARG i - ARG internal_27 - internal_28 = CALL function_equal - internal_26 = internal_28 - IF internal_26 GOTO then_8781702324700 - GOTO else_8781702324700 - - then_8781702324700: - internal_29 = ALLOCSTR "5" - internal_25 = internal_29 - GOTO endif_8781702324700 - - else_8781702324700: - # Conditional - internal_31 = ALLOCBOOL 0 - internal_32 = ALLOCINT 6 - - ARG i - ARG internal_32 - internal_33 = CALL function_equal - internal_31 = internal_33 - IF internal_31 GOTO then_8781702324694 - GOTO else_8781702324694 - - then_8781702324694: - internal_34 = ALLOCSTR "6" - internal_30 = internal_34 - GOTO endif_8781702324694 - - else_8781702324694: - # Conditional - internal_36 = ALLOCBOOL 0 - internal_37 = ALLOCINT 7 - - ARG i - ARG internal_37 - internal_38 = CALL function_equal - internal_36 = internal_38 - IF internal_36 GOTO then_8781702324688 - GOTO else_8781702324688 - - then_8781702324688: - internal_39 = ALLOCSTR "7" - internal_35 = internal_39 - GOTO endif_8781702324688 - - else_8781702324688: - # Conditional - internal_41 = ALLOCBOOL 0 - internal_42 = ALLOCINT 8 - - ARG i - ARG internal_42 - internal_43 = CALL function_equal - internal_41 = internal_43 - IF internal_41 GOTO then_8781702324682 - GOTO else_8781702324682 - - then_8781702324682: - internal_44 = ALLOCSTR "8" - internal_40 = internal_44 - GOTO endif_8781702324682 - - else_8781702324682: - # Conditional - internal_46 = ALLOCBOOL 0 - internal_47 = ALLOCINT 9 - - ARG i - ARG internal_47 - internal_48 = CALL function_equal - internal_46 = internal_48 - IF internal_46 GOTO then_8781702324661 - GOTO else_8781702324661 - - then_8781702324661: - internal_49 = ALLOCSTR "9" - internal_45 = internal_49 - GOTO endif_8781702324661 - - else_8781702324661: - ARG self - internal_50 = VCALL A2I function_abort_at_Object - internal_51 = ALLOCSTR "" - internal_45 = internal_51 - GOTO endif_8781702324661 - - endif_8781702324661: - internal_40 = internal_45 - GOTO endif_8781702324682 - - endif_8781702324682: - internal_35 = internal_40 - GOTO endif_8781702324688 - - endif_8781702324688: - internal_30 = internal_35 - GOTO endif_8781702324694 - - endif_8781702324694: - internal_25 = internal_30 - GOTO endif_8781702324700 - - endif_8781702324700: - internal_20 = internal_25 - GOTO endif_8781702324706 - - endif_8781702324706: - internal_15 = internal_20 - GOTO endif_8781702324712 - - endif_8781702324712: - internal_10 = internal_15 - GOTO endif_8781702324718 - - endif_8781702324718: - internal_5 = internal_10 - GOTO endif_8781702324724 - - endif_8781702324724: - internal_0 = internal_5 - GOTO endif_8781702324730 - - endif_8781702324730: - - RETURN internal_0 -} -function function_a2i_at_A2I{ - PARAM self - PARAM s - - LOCAL internal_0 - LOCAL internal_1 - LOCAL internal_2 - LOCAL internal_3 # Integer 0 - LOCAL internal_4 # Store the result of the operation function_equal - LOCAL internal_5 # Integer 0 - LOCAL internal_6 - LOCAL internal_7 - LOCAL internal_8 # Integer 0 - LOCAL internal_9 # Integer 1 - LOCAL internal_10 - LOCAL internal_11 # String "-" - LOCAL internal_12 # Store the result of the operation function_equal - LOCAL internal_13 # Integer 1 - LOCAL internal_14 - LOCAL internal_15 # Integer 1 - LOCAL internal_16 # Store the result of the operation function_sub - LOCAL internal_17 - LOCAL internal_18 - LOCAL internal_19 # Integer 1 - LOCAL internal_20 # Integer 4294967295 - LOCAL internal_21 # Store the complement a2 of internal_18 - LOCAL internal_22 - LOCAL internal_23 - LOCAL internal_24 # Integer 0 - LOCAL internal_25 # Integer 1 - LOCAL internal_26 - LOCAL internal_27 # String "+" - LOCAL internal_28 # Store the result of the operation function_equal - LOCAL internal_29 # Integer 1 - LOCAL internal_30 - LOCAL internal_31 # Integer 1 - LOCAL internal_32 # Store the result of the operation function_sub - LOCAL internal_33 - LOCAL internal_34 - LOCAL internal_35 - - # Conditional - internal_1 = ALLOCBOOL 0 - ARG s - internal_2 = VCALL String function_length_at_String - internal_3 = ALLOCINT 0 - - ARG internal_2 - ARG internal_3 - internal_4 = CALL function_equal - internal_1 = internal_4 - IF internal_1 GOTO then_8781702325176 - GOTO else_8781702325176 - - then_8781702325176: - internal_5 = ALLOCINT 0 - internal_0 = internal_5 - GOTO endif_8781702325176 - - else_8781702325176: - # Conditional - internal_7 = ALLOCBOOL 0 - internal_8 = ALLOCINT 0 - internal_9 = ALLOCINT 1 - ARG s - ARG internal_8 - ARG internal_9 - internal_10 = VCALL String function_substr_at_String - internal_11 = ALLOCSTR "-" - - ARG internal_10 - ARG internal_11 - internal_12 = CALL function_equal - internal_7 = internal_12 - IF internal_7 GOTO then_8781702325191 - GOTO else_8781702325191 - - then_8781702325191: - internal_13 = ALLOCINT 1 - ARG s - internal_14 = VCALL String function_length_at_String - internal_15 = ALLOCINT 1 - - ARG internal_14 - ARG internal_15 - internal_16 = CALL function_sub - ARG s - ARG internal_13 - ARG internal_16 - internal_17 = VCALL String function_substr_at_String - ARG self - ARG internal_17 - internal_18 = VCALL A2I function_a2i_aux_at_A2I - internal_19 = ALLOCINT 1 - internal_20 = ALLOCINT 4294967295 - internal_21 = ALLOCINT 0 - ARG internal_18 - ARG internal_20 - internal_21 = CALL function_xor - ARG internal_21 - ARG internal_19 - internal_21 = CALL function_add - internal_6 = internal_21 - GOTO endif_8781702325191 - - else_8781702325191: - # Conditional - internal_23 = ALLOCBOOL 0 - internal_24 = ALLOCINT 0 - internal_25 = ALLOCINT 1 - ARG s - ARG internal_24 - ARG internal_25 - internal_26 = VCALL String function_substr_at_String - internal_27 = ALLOCSTR "+" - - ARG internal_26 - ARG internal_27 - internal_28 = CALL function_equal - internal_23 = internal_28 - IF internal_23 GOTO then_8781702325185 - GOTO else_8781702325185 - - then_8781702325185: - internal_29 = ALLOCINT 1 - ARG s - internal_30 = VCALL String function_length_at_String - internal_31 = ALLOCINT 1 - - ARG internal_30 - ARG internal_31 - internal_32 = CALL function_sub - ARG s - ARG internal_29 - ARG internal_32 - internal_33 = VCALL String function_substr_at_String - ARG self - ARG internal_33 - internal_34 = VCALL A2I function_a2i_aux_at_A2I - internal_22 = internal_34 - GOTO endif_8781702325185 - - else_8781702325185: - ARG self - ARG s - internal_35 = VCALL A2I function_a2i_aux_at_A2I - internal_22 = internal_35 - GOTO endif_8781702325185 - - endif_8781702325185: - internal_6 = internal_22 - GOTO endif_8781702325191 - - endif_8781702325191: - internal_0 = internal_6 - GOTO endif_8781702325176 - - endif_8781702325176: - - RETURN internal_0 -} -function function_a2i_aux_at_A2I{ - PARAM self - PARAM s - - LOCAL int - LOCAL internal_1 # Integer 0 - LOCAL j - LOCAL internal_3 - LOCAL i - LOCAL internal_5 # Integer 0 - LOCAL internal_6 # Store the result of the operation function_less_than - LOCAL internal_7 # Integer 10 - LOCAL internal_8 # Store the result of the operation function_mult - LOCAL internal_9 # Integer 1 - LOCAL internal_10 - LOCAL internal_11 - LOCAL internal_12 # Store the result of the operation function_add - LOCAL internal_13 # Integer 1 - LOCAL internal_14 # Store the result of the operation function_add - - # Let int: Int - - internal_1 = ALLOCINT 0 - ARG int - ARG internal_1 - int = CALL function_assign - # Let j: Int - - ARG s - internal_3 = VCALL String function_length_at_String - ARG j - ARG internal_3 - j = CALL function_assign - # Let i: Int - - internal_5 = ALLOCINT 0 - ARG i - ARG internal_5 - i = CALL function_assign - - # While loop - while_start_8781702325589: - - ARG i - ARG j - internal_6 = CALL function_less_than - IF internal_6 GOTO while_body_8781702325589 - GOTO while_end_8781702325589 - - while_body_8781702325589: - internal_7 = ALLOCINT 10 - - ARG int - ARG internal_7 - internal_8 = CALL function_mult - internal_9 = ALLOCINT 1 - ARG s - ARG i - ARG internal_9 - internal_10 = VCALL String function_substr_at_String - ARG self - ARG internal_10 - internal_11 = VCALL A2I function_c2i_at_A2I - - ARG internal_8 - ARG internal_11 - internal_12 = CALL function_add - - ARG int - ARG internal_12 - int = CALL function_assign - internal_13 = ALLOCINT 1 - - ARG i - ARG internal_13 - internal_14 = CALL function_add - - ARG i - ARG internal_14 - i = CALL function_assign - GOTO while_start_8781702325589 - - while_end_8781702325589: - - RETURN int -} -function function_i2a_at_A2I{ - PARAM self - PARAM i - - LOCAL internal_0 - LOCAL internal_1 - LOCAL internal_2 # Integer 0 - LOCAL internal_3 # Store the result of the operation function_equal - LOCAL internal_4 # String "0" - LOCAL internal_5 - LOCAL internal_6 - LOCAL internal_7 # Integer 0 - LOCAL internal_8 # Store the result of the operation function_less_than - LOCAL internal_9 - LOCAL internal_10 # String "-" - LOCAL internal_11 # Integer 1 - LOCAL internal_12 # Integer 1 - LOCAL internal_13 # Integer 4294967295 - LOCAL internal_14 # Store the complement a2 of internal_11 - LOCAL internal_15 # Store the result of the operation function_mult - LOCAL internal_16 - LOCAL internal_17 - - # Conditional - internal_1 = ALLOCBOOL 0 - internal_2 = ALLOCINT 0 - - ARG i - ARG internal_2 - internal_3 = CALL function_equal - internal_1 = internal_3 - IF internal_1 GOTO then_8781702325718 - GOTO else_8781702325718 - - then_8781702325718: - internal_4 = ALLOCSTR "0" - internal_0 = internal_4 - GOTO endif_8781702325718 - - else_8781702325718: - # Conditional - internal_6 = ALLOCBOOL 0 - internal_7 = ALLOCINT 0 - - ARG internal_7 - ARG i - internal_8 = CALL function_less_than - internal_6 = internal_8 - IF internal_6 GOTO then_8781702325724 - GOTO else_8781702325724 - - then_8781702325724: - ARG self - ARG i - internal_9 = VCALL A2I function_i2a_aux_at_A2I - internal_5 = internal_9 - GOTO endif_8781702325724 - - else_8781702325724: - internal_10 = ALLOCSTR "-" - internal_11 = ALLOCINT 1 - internal_12 = ALLOCINT 1 - internal_13 = ALLOCINT 4294967295 - internal_14 = ALLOCINT 0 - ARG internal_11 - ARG internal_13 - internal_14 = CALL function_xor - ARG internal_14 - ARG internal_12 - internal_14 = CALL function_add - - ARG i - ARG internal_14 - internal_15 = CALL function_mult - ARG self - ARG internal_15 - internal_16 = VCALL A2I function_i2a_aux_at_A2I - ARG internal_10 - ARG internal_16 - internal_17 = VCALL String function_concat_at_String - internal_5 = internal_17 - GOTO endif_8781702325724 - - endif_8781702325724: - internal_0 = internal_5 - GOTO endif_8781702325718 - - endif_8781702325718: - - RETURN internal_0 -} -function function_i2a_aux_at_A2I{ - PARAM self - PARAM i - - LOCAL internal_0 - LOCAL internal_1 - LOCAL internal_2 # Integer 0 - LOCAL internal_3 # Store the result of the operation function_equal - LOCAL internal_4 # String "" - LOCAL next - LOCAL internal_6 # Integer 10 - LOCAL internal_7 # Store the result of the operation function_div - LOCAL internal_8 - LOCAL internal_9 # Integer 10 - LOCAL internal_10 # Store the result of the operation function_mult - LOCAL internal_11 # Store the result of the operation function_sub - LOCAL internal_12 - LOCAL internal_13 - - # Conditional - internal_1 = ALLOCBOOL 0 - internal_2 = ALLOCINT 0 - - ARG i - ARG internal_2 - internal_3 = CALL function_equal - internal_1 = internal_3 - IF internal_1 GOTO then_8781702326348 - GOTO else_8781702326348 - - then_8781702326348: - internal_4 = ALLOCSTR "" - internal_0 = internal_4 - GOTO endif_8781702326348 - - else_8781702326348: - # Let next: Int - - internal_6 = ALLOCINT 10 - - ARG i - ARG internal_6 - internal_7 = CALL function_div - ARG next - ARG internal_7 - next = CALL function_assign - ARG self - ARG next - internal_8 = VCALL A2I function_i2a_aux_at_A2I - internal_9 = ALLOCINT 10 - - ARG next - ARG internal_9 - internal_10 = CALL function_mult - - ARG i - ARG internal_10 - internal_11 = CALL function_sub - ARG self - ARG internal_11 - internal_12 = VCALL A2I function_i2c_at_A2I - ARG internal_8 - ARG internal_12 - internal_13 = VCALL String function_concat_at_String - internal_0 = internal_13 - GOTO endif_8781702326348 - - endif_8781702326348: - - RETURN internal_0 -} -function function___init___at_Main{ - PARAM self - - LOCAL internal_0 # String "" - LOCAL internal_1 # Null - LOCAL internal_2 # Null - LOCAL internal_3 # Boolean true - - internal_0 = ALLOCSTR "" - - SETATTR self char internal_0 - internal_1 = ALLOCNULL - - SETATTR self avar internal_1 - internal_2 = ALLOCNULL - - SETATTR self a_var internal_2 - internal_3 = ALLOCBOOL 1 - - SETATTR self flag internal_3 - - RETURN self -} -function function_menu_at_Main{ - PARAM self - - LOCAL internal_0 # String "\n\tTo add a number to " - LOCAL internal_1 - LOCAL internal_2 - LOCAL internal_3 - LOCAL internal_4 # String "...enter a:\n" - LOCAL internal_5 - LOCAL internal_6 # String "\tTo negate " - LOCAL internal_7 - LOCAL internal_8 - LOCAL internal_9 - LOCAL internal_10 # String "...enter b:\n" - LOCAL internal_11 - LOCAL internal_12 # String "\tTo find the difference between " - LOCAL internal_13 - LOCAL internal_14 - LOCAL internal_15 - LOCAL internal_16 # String "and another number...enter c:\n" - LOCAL internal_17 - LOCAL internal_18 # String "\tTo find the factorial of " - LOCAL internal_19 - LOCAL internal_20 - LOCAL internal_21 - LOCAL internal_22 # String "...enter d:\n" - LOCAL internal_23 - LOCAL internal_24 # String "\tTo square " - LOCAL internal_25 - LOCAL internal_26 - LOCAL internal_27 - LOCAL internal_28 # String "...enter e:\n" - LOCAL internal_29 - LOCAL internal_30 # String "\tTo cube " - LOCAL internal_31 - LOCAL internal_32 - LOCAL internal_33 - LOCAL internal_34 # String "...enter f:\n" - LOCAL internal_35 - LOCAL internal_36 # String "\tTo find out if " - LOCAL internal_37 - LOCAL internal_38 - LOCAL internal_39 - LOCAL internal_40 # String "is a multiple of 3...enter g:\n" - LOCAL internal_41 - LOCAL internal_42 # String "\tTo divide " - LOCAL internal_43 - LOCAL internal_44 - LOCAL internal_45 - LOCAL internal_46 # String "by 8...enter h:\n" - LOCAL internal_47 - LOCAL internal_48 # String "\tTo get a new number...enter j:\n" - LOCAL internal_49 - LOCAL internal_50 # String "\tTo quit...enter q:\n\n" - LOCAL internal_51 - LOCAL internal_52 - - internal_0 = ALLOCSTR "\n\tTo add a number to " - ARG self - ARG internal_0 - internal_1 = VCALL Main function_out_string_at_IO - internal_2 = GETATTR self avar - ARG self - ARG internal_2 - internal_3 = VCALL Main function_print_at_Main - internal_4 = ALLOCSTR "...enter a:\n" - ARG self - ARG internal_4 - internal_5 = VCALL Main function_out_string_at_IO - internal_6 = ALLOCSTR "\tTo negate " - ARG self - ARG internal_6 - internal_7 = VCALL Main function_out_string_at_IO - internal_8 = GETATTR self avar - ARG self - ARG internal_8 - internal_9 = VCALL Main function_print_at_Main - internal_10 = ALLOCSTR "...enter b:\n" - ARG self - ARG internal_10 - internal_11 = VCALL Main function_out_string_at_IO - internal_12 = ALLOCSTR "\tTo find the difference between " - ARG self - ARG internal_12 - internal_13 = VCALL Main function_out_string_at_IO - internal_14 = GETATTR self avar - ARG self - ARG internal_14 - internal_15 = VCALL Main function_print_at_Main - internal_16 = ALLOCSTR "and another number...enter c:\n" - ARG self - ARG internal_16 - internal_17 = VCALL Main function_out_string_at_IO - internal_18 = ALLOCSTR "\tTo find the factorial of " - ARG self - ARG internal_18 - internal_19 = VCALL Main function_out_string_at_IO - internal_20 = GETATTR self avar - ARG self - ARG internal_20 - internal_21 = VCALL Main function_print_at_Main - internal_22 = ALLOCSTR "...enter d:\n" - ARG self - ARG internal_22 - internal_23 = VCALL Main function_out_string_at_IO - internal_24 = ALLOCSTR "\tTo square " - ARG self - ARG internal_24 - internal_25 = VCALL Main function_out_string_at_IO - internal_26 = GETATTR self avar - ARG self - ARG internal_26 - internal_27 = VCALL Main function_print_at_Main - internal_28 = ALLOCSTR "...enter e:\n" - ARG self - ARG internal_28 - internal_29 = VCALL Main function_out_string_at_IO - internal_30 = ALLOCSTR "\tTo cube " - ARG self - ARG internal_30 - internal_31 = VCALL Main function_out_string_at_IO - internal_32 = GETATTR self avar - ARG self - ARG internal_32 - internal_33 = VCALL Main function_print_at_Main - internal_34 = ALLOCSTR "...enter f:\n" - ARG self - ARG internal_34 - internal_35 = VCALL Main function_out_string_at_IO - internal_36 = ALLOCSTR "\tTo find out if " - ARG self - ARG internal_36 - internal_37 = VCALL Main function_out_string_at_IO - internal_38 = GETATTR self avar - ARG self - ARG internal_38 - internal_39 = VCALL Main function_print_at_Main - internal_40 = ALLOCSTR "is a multiple of 3...enter g:\n" - ARG self - ARG internal_40 - internal_41 = VCALL Main function_out_string_at_IO - internal_42 = ALLOCSTR "\tTo divide " - ARG self - ARG internal_42 - internal_43 = VCALL Main function_out_string_at_IO - internal_44 = GETATTR self avar - ARG self - ARG internal_44 - internal_45 = VCALL Main function_print_at_Main - internal_46 = ALLOCSTR "by 8...enter h:\n" - ARG self - ARG internal_46 - internal_47 = VCALL Main function_out_string_at_IO - internal_48 = ALLOCSTR "\tTo get a new number...enter j:\n" - ARG self - ARG internal_48 - internal_49 = VCALL Main function_out_string_at_IO - internal_50 = ALLOCSTR "\tTo quit...enter q:\n\n" - ARG self - ARG internal_50 - internal_51 = VCALL Main function_out_string_at_IO - ARG self - internal_52 = VCALL Main function_in_string_at_IO - - RETURN internal_52 -} -function function_prompt_at_Main{ - PARAM self - - LOCAL internal_0 # String "\n" - LOCAL internal_1 - LOCAL internal_2 # String "Please enter a number... " - LOCAL internal_3 - LOCAL internal_4 - - internal_0 = ALLOCSTR "\n" - ARG self - ARG internal_0 - internal_1 = VCALL Main function_out_string_at_IO - internal_2 = ALLOCSTR "Please enter a number... " - ARG self - ARG internal_2 - internal_3 = VCALL Main function_out_string_at_IO - ARG self - internal_4 = VCALL Main function_in_string_at_IO - - RETURN internal_4 -} -function function_get_int_at_Main{ - PARAM self - - LOCAL z - LOCAL internal_1 # Store an instance of the class A2I - LOCAL s - LOCAL internal_3 - LOCAL internal_4 - - # Let z: A2I - - internal_1 = ALLOCATE A2I # Allocate the object A2I - ARG internal_1 # Pass the instance to the constructor - internal_1 = VCALL A2I function___init___at_A2I # Call the constructor - ARG z - ARG internal_1 - z = CALL function_assign - # Let s: String - - ARG self - internal_3 = VCALL Main function_prompt_at_Main - ARG s - ARG internal_3 - s = CALL function_assign - ARG z - ARG s - internal_4 = VCALL A2I function_a2i_at_A2I - - RETURN internal_4 -} -function function_is_even_at_Main{ - PARAM self - PARAM num - - LOCAL x - LOCAL internal_1 - LOCAL internal_2 - LOCAL internal_3 # Integer 0 - LOCAL internal_4 # Store the result of the operation function_less_than - LOCAL internal_5 # Integer 1 - LOCAL internal_6 # Integer 4294967295 - LOCAL internal_7 # Store the complement a2 of x - LOCAL internal_8 - LOCAL internal_9 - LOCAL internal_10 - LOCAL internal_11 # Integer 0 - LOCAL internal_12 # Store the result of the operation function_equal - LOCAL internal_13 # Boolean true - LOCAL internal_14 - LOCAL internal_15 - LOCAL internal_16 # Integer 1 - LOCAL internal_17 # Store the result of the operation function_equal - LOCAL internal_18 # Boolean false - LOCAL internal_19 # Integer 2 - LOCAL internal_20 # Store the result of the operation function_sub - LOCAL internal_21 - - # Let x: Int - - ARG x - ARG num - x = CALL function_assign - # Conditional - internal_2 = ALLOCBOOL 0 - internal_3 = ALLOCINT 0 - - ARG x - ARG internal_3 - internal_4 = CALL function_less_than - internal_2 = internal_4 - IF internal_2 GOTO then_8781702295071 - GOTO else_8781702295071 - - then_8781702295071: - internal_5 = ALLOCINT 1 - internal_6 = ALLOCINT 4294967295 - internal_7 = ALLOCINT 0 - ARG x - ARG internal_6 - internal_7 = CALL function_xor - ARG internal_7 - ARG internal_5 - internal_7 = CALL function_add - ARG self - ARG internal_7 - internal_8 = VCALL Main function_is_even_at_Main - internal_1 = internal_8 - GOTO endif_8781702295071 - - else_8781702295071: - # Conditional - internal_10 = ALLOCBOOL 0 - internal_11 = ALLOCINT 0 - - ARG internal_11 - ARG x - internal_12 = CALL function_equal - internal_10 = internal_12 - IF internal_10 GOTO then_8781702295074 - GOTO else_8781702295074 - - then_8781702295074: - internal_13 = ALLOCBOOL 1 - internal_9 = internal_13 - GOTO endif_8781702295074 - - else_8781702295074: - # Conditional - internal_15 = ALLOCBOOL 0 - internal_16 = ALLOCINT 1 - - ARG internal_16 - ARG x - internal_17 = CALL function_equal - internal_15 = internal_17 - IF internal_15 GOTO then_8781702295080 - GOTO else_8781702295080 - - then_8781702295080: - internal_18 = ALLOCBOOL 0 - internal_14 = internal_18 - GOTO endif_8781702295080 - - else_8781702295080: - internal_19 = ALLOCINT 2 - - ARG x - ARG internal_19 - internal_20 = CALL function_sub - ARG self - ARG internal_20 - internal_21 = VCALL Main function_is_even_at_Main - internal_14 = internal_21 - GOTO endif_8781702295080 - - endif_8781702295080: - internal_9 = internal_14 - GOTO endif_8781702295074 - - endif_8781702295074: - internal_1 = internal_9 - GOTO endif_8781702295071 - - endif_8781702295071: - - RETURN internal_1 -} -function function_class_type_at_Main{ - PARAM self - PARAM var - - LOCAL internal_0 # Constant Integer 0 - LOCAL internal_1 # Constant Integer 1 - LOCAL internal_2 # Constant Integer 6 - LOCAL internal_3 # Null pointer - LOCAL internal_4 # Count of ancestors of the switch expression - LOCAL internal_5 # Switch expression type - LOCAL internal_6 # Ancestor type - LOCAL internal_7 # Step 1 comparison result - LOCAL internal_8 # Step 1 Array of ancestors - LOCAL internal_9 # Step 2 iteration index - LOCAL internal_10 # Step 2 comparison result - LOCAL internal_11 # Array to store the branch types - LOCAL internal_12 # Array to store the nearest ancestor index of the expression type of the i-th branch type - LOCAL internal_13 # Address of the type A - LOCAL internal_14 # Index of the type A - LOCAL internal_15 # Address of the type B - LOCAL internal_16 # Index of the type B - LOCAL internal_17 # Address of the type C - LOCAL internal_18 # Index of the type C - LOCAL internal_19 # Address of the type D - LOCAL internal_20 # Index of the type D - LOCAL internal_21 # Address of the type E - LOCAL internal_22 # Index of the type E - LOCAL internal_23 # Address of the type Object - LOCAL internal_24 # Index of the type Object - LOCAL internal_25 # Step 3 - Iteration index of the branch types array - LOCAL internal_26 # Step 3 - Comparison for the index of the branch types array - LOCAL internal_27 # Step 3 - Type of the i-th branch - LOCAL internal_28 # Step 3 - Index of the ancestor - LOCAL internal_29 # Step 3 - Comparison for the index of the ancestor - LOCAL internal_30 # Step 3 - Type of the j-th ancestor - LOCAL internal_31 # Step 3 - Comparison for the branch type nad the ancestor type - LOCAL internal_32 # Step 4 - Iteration index - LOCAL internal_33 # Step 4 - Index of the minimum counter in the counter array - LOCAL internal_34 # Step 4 - Temporary variable - LOCAL internal_35 # Step 4 - Current minimum of the counter array - LOCAL internal_36 # Step 4 - Comparison for the minimum of the counter array - LOCAL internal_37 # endl - LOCAL internal_38 # space - LOCAL internal_39 # Step 5 - Bool array - LOCAL internal_40 # Step 5 - Branch 0 - LOCAL internal_41 # Step 5 - Branch 1 - LOCAL internal_42 # Step 5 - Branch 2 - LOCAL internal_43 # Step 5 - Branch 3 - LOCAL internal_44 # Step 5 - Branch 4 - LOCAL internal_45 # Step 5 - Branch 5 - LOCAL internal_46 # Step 5 - Exists an error - LOCAL internal_47 # Step 5 - Comparison for the correct branch result - LOCAL internal_48 # Index 0 - LOCAL internal_49 # Index 1 - LOCAL internal_50 # Index 2 - LOCAL internal_51 # Index 3 - LOCAL internal_52 # Index 4 - LOCAL internal_53 # Index 5 - LOCAL internal_54 # Result of the switch expression address - LOCAL a # Specialiced variable for the branch A - LOCAL internal_56 # String "Class type is now A\n" - LOCAL internal_57 - LOCAL b # Specialiced variable for the branch B - LOCAL internal_59 # String "Class type is now B\n" - LOCAL internal_60 - LOCAL c # Specialiced variable for the branch C - LOCAL internal_62 # String "Class type is now C\n" - LOCAL internal_63 - LOCAL d # Specialiced variable for the branch D - LOCAL internal_65 # String "Class type is now D\n" - LOCAL internal_66 - LOCAL e # Specialiced variable for the branch E - LOCAL internal_68 # String "Class type is now E\n" - LOCAL internal_69 - LOCAL o # Specialiced variable for the branch Object - LOCAL internal_71 # String "Oooops\n" - LOCAL internal_72 - - internal_0 = ALLOCINT 0 - internal_1 = ALLOCINT 1 - internal_2 = ALLOCINT 6 - internal_3 = ALLOCNULL - internal_4 = ALLOCINT 0 - internal_7 = ALLOCBOOL 0 - - # Switch Case Algorithm Steps: - # 1 - Count how many ancestors has the dynamic type of the expression - # 2 - Create an array of the same size where to store the ancestors - # 3 - For each branch type, store the ancestor index that match with it, if no one match, store `count of ancestors` - # 4 - Find the minimum of the ancestors indexes - # 5 - With the minimum index, get the correct branch type - - # ######################################################################## # - # Step 1 - Count how many ancestors has the dynamic type of the expression # - # ######################################################################## # - internal_5 = TYPEOF var # Get the switch expression type - internal_6 = internal_5 # The first ancestor will be the type itself - while_start_8781702295173: - internal_7 = EQUALADDR internal_6 internal_3 - IF internal_7 GOTO while_end_8781702295173 - # Increment the count of ancestors - ARG internal_4 - ARG internal_1 - internal_4 = CALL function_add - internal_6 = ANCESTOR internal_6 - GOTO while_start_8781702295173 - while_end_8781702295173: - - # ###################################################################### # - # Step 2 - Create an array of the same size where to store the ancestors # - # ###################################################################### # - internal_6 = internal_5 # The first ancestor will be the type itself - internal_8 = ARRAY internal_4 # Create an array of ancestors - internal_9 = ALLOCINT 0 - internal_10 = ALLOCBOOL 0 - foreach_start_8781702295173: - ARG internal_9 - ARG internal_4 - internal_10 = CALL function_less_than - IF internal_10 GOTO foreach_body_8781702295173 - GOTO foreach_end_8781702295173 - foreach_body_8781702295173: - SETINDEX internal_8 internal_9 internal_6 # Set the index of the array with the ancestor type - internal_6 = ANCESTOR internal_6 # Get the next ancestor - ARG internal_9 - ARG internal_1 - internal_9 = CALL function_add - GOTO foreach_start_8781702295173 - foreach_end_8781702295173: - - internal_11 = ARRAY internal_2 - internal_12 = ARRAY internal_2 - internal_14 = ALLOCINT 0 - internal_13 = TYPEADDR A - SETINDEX internal_11 internal_14 internal_13 - SETVALUEINDEX internal_12 internal_14 internal_4 - internal_16 = ALLOCINT 1 - internal_15 = TYPEADDR B - SETINDEX internal_11 internal_16 internal_15 - SETVALUEINDEX internal_12 internal_16 internal_4 - internal_18 = ALLOCINT 2 - internal_17 = TYPEADDR C - SETINDEX internal_11 internal_18 internal_17 - SETVALUEINDEX internal_12 internal_18 internal_4 - internal_20 = ALLOCINT 3 - internal_19 = TYPEADDR D - SETINDEX internal_11 internal_20 internal_19 - SETVALUEINDEX internal_12 internal_20 internal_4 - internal_22 = ALLOCINT 4 - internal_21 = TYPEADDR E - SETINDEX internal_11 internal_22 internal_21 - SETVALUEINDEX internal_12 internal_22 internal_4 - internal_24 = ALLOCINT 5 - internal_23 = TYPEADDR Object - SETINDEX internal_11 internal_24 internal_23 - SETVALUEINDEX internal_12 internal_24 internal_4 - - internal_25 = ALLOCINT 0 - internal_26 = ALLOCBOOL 0 - internal_28 = ALLOCINT 0 - internal_29 = ALLOCBOOL 0 - internal_31 = ALLOCBOOL 0 - foreach_type_start_8781702295173: - ARG internal_25 - ARG internal_2 - internal_26 = CALL function_less_than - IF internal_26 GOTO foreach_type_body_8781702295173 - GOTO foreach_type_end_8781702295173 - foreach_type_body_8781702295173: - internal_27 = GETINDEX internal_11 internal_25 # Get the type of the i-th branch - ARG internal_28 - ARG internal_0 - internal_28 = CALL function_assign - foreach_ancestor_start_8781702295173: - ARG internal_28 - ARG internal_4 - internal_29 = CALL function_less_than - IF internal_29 GOTO foreach_ancestor_body_8781702295173 - GOTO foreach_ancestor_end_8781702295173 - foreach_ancestor_body_8781702295173: - internal_30 = GETINDEX internal_8 internal_28 # Get the j-th ancestor type - internal_31 = EQUALADDR internal_27 internal_30 # Compare if the type of the i-th branch is equal to the j-th ancestor - IF internal_31 GOTO foreach_ancestor_end_8781702295173 # If the types are equal, we have a match, then we can exit - ARG internal_28 - ARG internal_1 - internal_28 = CALL function_add - GOTO foreach_ancestor_start_8781702295173 - foreach_ancestor_end_8781702295173: - SETVALUEINDEX internal_12 internal_25 internal_28 # Set the counter of the i-th branch equals to j - # #################### # - # End of Inner Foreach # - # #################### # - - ARG internal_25 - ARG internal_1 - internal_25 = CALL function_add - GOTO foreach_type_start_8781702295173 - foreach_type_end_8781702295173: - # ################# # - # End Outer Foreach # - # ################# # - - # ######################################## # - # Step 4 - Find the minimum ancestor index # - # ######################################## # - internal_37 = ALLOCSTR "\n" - internal_38 = ALLOCSTR " " - internal_32 = ALLOCINT 0 - internal_33 = ALLOCINT 0 - internal_34 = ALLOCINT 0 - internal_35 = ALLOCINT 0 - internal_36 = ALLOCBOOL 0 - ARG internal_35 - ARG internal_4 - internal_35 = CALL function_assign - foreach_min_start_8781702295173: - ARG internal_32 - ARG internal_2 - internal_36 = CALL function_less_than - IF internal_36 GOTO foreach_min_body_8781702295173 - GOTO foreach_min_end_8781702295173 - foreach_min_body_8781702295173: - internal_34 = GETVALUEINDEX internal_12 internal_32 # Get the nearest ancestor index of the i-th branch type - ARG internal_34 - ARG internal_35 - internal_36 = CALL function_less_than - IF internal_36 GOTO update_min_8781702295173 - GOTO update_min_end_8781702295173 - update_min_8781702295173: - ARG internal_35 - ARG internal_34 - internal_35 = CALL function_assign - ARG internal_33 - ARG internal_32 - internal_33 = CALL function_assign - update_min_end_8781702295173: - ARG internal_32 - ARG internal_1 - internal_32 = CALL function_add - GOTO foreach_min_start_8781702295173 - foreach_min_end_8781702295173: - - # ################################################################# # - # Step 5 - Using the minimun ancestor index find the correct branch # - # ################################################################# # - internal_39 = ARRAY internal_2 # Create the bool array - internal_40 = ALLOCINT 0 - SETVALUEINDEX internal_39 internal_40 internal_0 # Initialize the bool array - internal_41 = ALLOCINT 1 - SETVALUEINDEX internal_39 internal_41 internal_0 # Initialize the bool array - internal_42 = ALLOCINT 2 - SETVALUEINDEX internal_39 internal_42 internal_0 # Initialize the bool array - internal_43 = ALLOCINT 3 - SETVALUEINDEX internal_39 internal_43 internal_0 # Initialize the bool array - internal_44 = ALLOCINT 4 - SETVALUEINDEX internal_39 internal_44 internal_0 # Initialize the bool array - internal_45 = ALLOCINT 5 - SETVALUEINDEX internal_39 internal_45 internal_0 # Initialize the bool array - - internal_46 = ALLOCBOOL 0 - ARG internal_35 - ARG internal_4 - internal_46 = CALL function_equal - IF internal_46 GOTO error_branch_8781702295173 - SETVALUEINDEX internal_39 internal_33 internal_1 # Set the bool array in the correct index to 1 - internal_47 = ALLOCBOOL 0 - - internal_48 = ALLOCINT 0 - internal_47 = GETVALUEINDEX internal_39 internal_48 # Get the bool value of the branch A - IF internal_47 GOTO branch_A_8781702295173 # If the bool value is 1, then we have a match - - internal_49 = ALLOCINT 1 - internal_47 = GETVALUEINDEX internal_39 internal_49 # Get the bool value of the branch B - IF internal_47 GOTO branch_B_8781702295173 # If the bool value is 1, then we have a match - - internal_50 = ALLOCINT 2 - internal_47 = GETVALUEINDEX internal_39 internal_50 # Get the bool value of the branch C - IF internal_47 GOTO branch_C_8781702295173 # If the bool value is 1, then we have a match - - internal_51 = ALLOCINT 3 - internal_47 = GETVALUEINDEX internal_39 internal_51 # Get the bool value of the branch D - IF internal_47 GOTO branch_D_8781702295173 # If the bool value is 1, then we have a match - - internal_52 = ALLOCINT 4 - internal_47 = GETVALUEINDEX internal_39 internal_52 # Get the bool value of the branch E - IF internal_47 GOTO branch_E_8781702295173 # If the bool value is 1, then we have a match - - internal_53 = ALLOCINT 5 - internal_47 = GETVALUEINDEX internal_39 internal_53 # Get the bool value of the branch Object - IF internal_47 GOTO branch_Object_8781702295173 # If the bool value is 1, then we have a match - - branch_A_8781702295173: - ARG a - ARG var - a = CALL function_assign - internal_56 = ALLOCSTR "Class type is now A\n" - ARG self - ARG internal_56 - internal_57 = VCALL Main function_out_string_at_IO - ARG internal_54 - ARG internal_57 - internal_54 = CALL function_assign - internal_54 = internal_57 # Assign the result - GOTO branch_end_8781702295173 - - branch_B_8781702295173: - ARG b - ARG var - b = CALL function_assign - internal_59 = ALLOCSTR "Class type is now B\n" - ARG self - ARG internal_59 - internal_60 = VCALL Main function_out_string_at_IO - ARG internal_54 - ARG internal_60 - internal_54 = CALL function_assign - internal_54 = internal_60 # Assign the result - GOTO branch_end_8781702295173 - - branch_C_8781702295173: - ARG c - ARG var - c = CALL function_assign - internal_62 = ALLOCSTR "Class type is now C\n" - ARG self - ARG internal_62 - internal_63 = VCALL Main function_out_string_at_IO - ARG internal_54 - ARG internal_63 - internal_54 = CALL function_assign - internal_54 = internal_63 # Assign the result - GOTO branch_end_8781702295173 - - branch_D_8781702295173: - ARG d - ARG var - d = CALL function_assign - internal_65 = ALLOCSTR "Class type is now D\n" - ARG self - ARG internal_65 - internal_66 = VCALL Main function_out_string_at_IO - ARG internal_54 - ARG internal_66 - internal_54 = CALL function_assign - internal_54 = internal_66 # Assign the result - GOTO branch_end_8781702295173 - - branch_E_8781702295173: - ARG e - ARG var - e = CALL function_assign - internal_68 = ALLOCSTR "Class type is now E\n" - ARG self - ARG internal_68 - internal_69 = VCALL Main function_out_string_at_IO - ARG internal_54 - ARG internal_69 - internal_54 = CALL function_assign - internal_54 = internal_69 # Assign the result - GOTO branch_end_8781702295173 - - branch_Object_8781702295173: - ARG o - ARG var - o = CALL function_assign - internal_71 = ALLOCSTR "Oooops\n" - ARG self - ARG internal_71 - internal_72 = VCALL Main function_out_string_at_IO - ARG internal_54 - ARG internal_72 - internal_54 = CALL function_assign - internal_54 = internal_72 # Assign the result - GOTO branch_end_8781702295173 - - error_branch_8781702295173: - # Insert an error call - branch_end_8781702295173: - - RETURN internal_54 -} -function function_print_at_Main{ - PARAM self - PARAM var - - LOCAL z - LOCAL internal_1 # Store an instance of the class A2I - LOCAL internal_2 - LOCAL internal_3 - LOCAL internal_4 - LOCAL internal_5 # String " " - LOCAL internal_6 - - # Let z: A2I - - internal_1 = ALLOCATE A2I # Allocate the object A2I - ARG internal_1 # Pass the instance to the constructor - internal_1 = VCALL A2I function___init___at_A2I # Call the constructor - ARG z - ARG internal_1 - z = CALL function_assign - ARG var - internal_2 = VCALL A function_value_at_A - ARG z - ARG internal_2 - internal_3 = VCALL A2I function_i2a_at_A2I - ARG self - ARG internal_3 - internal_4 = VCALL Main function_out_string_at_IO - internal_5 = ALLOCSTR " " - ARG self - ARG internal_5 - internal_6 = VCALL Main function_out_string_at_IO - - RETURN internal_6 -} -function function_main_at_Main{ - PARAM self - - LOCAL internal_0 # Store an instance of the class A - LOCAL internal_1 - LOCAL internal_2 # String "number " - LOCAL internal_3 - LOCAL internal_4 - LOCAL internal_5 - LOCAL internal_6 - LOCAL internal_7 - LOCAL internal_8 - LOCAL internal_9 - LOCAL internal_10 - LOCAL internal_11 # String "is even!\n" - LOCAL internal_12 - LOCAL internal_13 # String "is odd!\n" - LOCAL internal_14 - LOCAL internal_15 - LOCAL internal_16 - LOCAL internal_17 - LOCAL internal_18 - LOCAL internal_19 - LOCAL internal_20 - LOCAL internal_21 # String "a" - LOCAL internal_22 # Store the result of the operation function_equal - LOCAL internal_23 # Store an instance of the class A - LOCAL internal_24 - LOCAL internal_25 - LOCAL internal_26 # Store an instance of the class B - LOCAL internal_27 - LOCAL internal_28 - LOCAL internal_29 - LOCAL internal_30 - LOCAL internal_31 - LOCAL internal_32 - LOCAL internal_33 - LOCAL internal_34 - LOCAL internal_35 # String "b" - LOCAL internal_36 # Store the result of the operation function_equal - LOCAL internal_37 - LOCAL internal_38 # Constant Integer 0 - LOCAL internal_39 # Constant Integer 1 - LOCAL internal_40 # Constant Integer 3 - LOCAL internal_41 # Null pointer - LOCAL internal_42 # Count of ancestors of the switch expression - LOCAL internal_43 # Switch expression type - LOCAL internal_44 # Ancestor type - LOCAL internal_45 # Step 1 comparison result - LOCAL internal_46 # Step 1 Array of ancestors - LOCAL internal_47 # Step 2 iteration index - LOCAL internal_48 # Step 2 comparison result - LOCAL internal_49 # Array to store the branch types - LOCAL internal_50 # Array to store the nearest ancestor index of the expression type of the i-th branch type - LOCAL internal_51 # Address of the type C - LOCAL internal_52 # Index of the type C - LOCAL internal_53 # Address of the type A - LOCAL internal_54 # Index of the type A - LOCAL internal_55 # Address of the type Object - LOCAL internal_56 # Index of the type Object - LOCAL internal_57 # Step 3 - Iteration index of the branch types array - LOCAL internal_58 # Step 3 - Comparison for the index of the branch types array - LOCAL internal_59 # Step 3 - Type of the i-th branch - LOCAL internal_60 # Step 3 - Index of the ancestor - LOCAL internal_61 # Step 3 - Comparison for the index of the ancestor - LOCAL internal_62 # Step 3 - Type of the j-th ancestor - LOCAL internal_63 # Step 3 - Comparison for the branch type nad the ancestor type - LOCAL internal_64 # Step 4 - Iteration index - LOCAL internal_65 # Step 4 - Index of the minimum counter in the counter array - LOCAL internal_66 # Step 4 - Temporary variable - LOCAL internal_67 # Step 4 - Current minimum of the counter array - LOCAL internal_68 # Step 4 - Comparison for the minimum of the counter array - LOCAL internal_69 # endl - LOCAL internal_70 # space - LOCAL internal_71 # Step 5 - Bool array - LOCAL internal_72 # Step 5 - Branch 0 - LOCAL internal_73 # Step 5 - Branch 1 - LOCAL internal_74 # Step 5 - Branch 2 - LOCAL internal_75 # Step 5 - Exists an error - LOCAL internal_76 # Step 5 - Comparison for the correct branch result - LOCAL internal_77 # Index 0 - LOCAL internal_78 # Index 1 - LOCAL internal_79 # Index 2 - LOCAL internal_80 # Result of the switch expression address - LOCAL c # Specialiced variable for the branch C - LOCAL internal_82 - LOCAL internal_83 - LOCAL a # Specialiced variable for the branch A - LOCAL internal_85 - LOCAL internal_86 - LOCAL o # Specialiced variable for the branch Object - LOCAL internal_88 # String "Oooops\n" - LOCAL internal_89 - LOCAL internal_90 - LOCAL internal_91 # Integer 0 - LOCAL internal_92 - LOCAL internal_93 - LOCAL internal_94 - LOCAL internal_95 # String "c" - LOCAL internal_96 # Store the result of the operation function_equal - LOCAL internal_97 # Store an instance of the class A - LOCAL internal_98 - LOCAL internal_99 - LOCAL internal_100 # Store an instance of the class D - LOCAL internal_101 - LOCAL internal_102 - LOCAL internal_103 - LOCAL internal_104 - LOCAL internal_105 - LOCAL internal_106 - LOCAL internal_107 - LOCAL internal_108 - LOCAL internal_109 # String "d" - LOCAL internal_110 # Store the result of the operation function_equal - LOCAL internal_111 # Store an instance of the class C - LOCAL internal_112 - LOCAL internal_113 - LOCAL internal_114 - LOCAL internal_115 - LOCAL internal_116 - LOCAL internal_117 - LOCAL internal_118 # String "e" - LOCAL internal_119 # Store the result of the operation function_equal - LOCAL internal_120 # Store an instance of the class C - LOCAL internal_121 - LOCAL internal_122 - LOCAL internal_123 - LOCAL internal_124 - LOCAL internal_125 - LOCAL internal_126 - LOCAL internal_127 # String "f" - LOCAL internal_128 # Store the result of the operation function_equal - LOCAL internal_129 # Store an instance of the class C - LOCAL internal_130 - LOCAL internal_131 - LOCAL internal_132 - LOCAL internal_133 - LOCAL internal_134 - LOCAL internal_135 - LOCAL internal_136 # String "g" - LOCAL internal_137 # Store the result of the operation function_equal - LOCAL internal_138 - LOCAL internal_139 - LOCAL internal_140 # Store an instance of the class D - LOCAL internal_141 - LOCAL internal_142 - LOCAL internal_143 - LOCAL internal_144 # String "number " - LOCAL internal_145 - LOCAL internal_146 - LOCAL internal_147 - LOCAL internal_148 # String "is divisible by 3.\n" - LOCAL internal_149 - LOCAL internal_150 # String "number " - LOCAL internal_151 - LOCAL internal_152 - LOCAL internal_153 - LOCAL internal_154 # String "is not divisible by 3.\n" - LOCAL internal_155 - LOCAL internal_156 - LOCAL internal_157 - LOCAL internal_158 - LOCAL internal_159 # String "h" - LOCAL internal_160 # Store the result of the operation function_equal - LOCAL x - LOCAL internal_162 # Store an instance of the class E - LOCAL internal_163 - LOCAL internal_164 - LOCAL internal_165 - LOCAL r - LOCAL internal_167 - LOCAL internal_168 - LOCAL internal_169 - LOCAL internal_170 # Integer 8 - LOCAL internal_171 # Store the result of the operation function_mult - LOCAL internal_172 # Store the result of the operation function_sub - LOCAL internal_173 # String "number " - LOCAL internal_174 - LOCAL internal_175 - LOCAL internal_176 - LOCAL internal_177 # String "is equal to " - LOCAL internal_178 - LOCAL internal_179 - LOCAL internal_180 # String "times 8 with a remainder of " - LOCAL internal_181 - LOCAL a - LOCAL internal_183 # Store an instance of the class A2I - LOCAL internal_184 - LOCAL internal_185 - LOCAL internal_186 # String "\n" - LOCAL internal_187 - LOCAL internal_188 - LOCAL internal_189 - LOCAL internal_190 - LOCAL internal_191 # String "j" - LOCAL internal_192 # Store the result of the operation function_equal - LOCAL internal_193 # Store an instance of the class A - LOCAL internal_194 - LOCAL internal_195 - LOCAL internal_196 - LOCAL internal_197 # String "q" - LOCAL internal_198 # Store the result of the operation function_equal - LOCAL internal_199 # Boolean false - LOCAL internal_200 # Store an instance of the class A - LOCAL internal_201 - LOCAL internal_202 - LOCAL internal_203 - - internal_0 = ALLOCATE A # Allocate the object A - ARG internal_0 # Pass the instance to the constructor - internal_0 = VCALL A function___init___at_A # Call the constructor - - SETATTR self avar internal_0 - - # While loop - while_start_8781702298224: - internal_1 = GETATTR self flag - IF internal_1 GOTO while_body_8781702298224 - GOTO while_end_8781702298224 - - while_body_8781702298224: - internal_2 = ALLOCSTR "number " - ARG self - ARG internal_2 - internal_3 = VCALL Main function_out_string_at_IO - internal_4 = GETATTR self avar - ARG self - ARG internal_4 - internal_5 = VCALL Main function_print_at_Main - # Conditional - internal_7 = ALLOCBOOL 0 - internal_8 = GETATTR self avar - ARG internal_8 - internal_9 = VCALL A function_value_at_A - ARG self - ARG internal_9 - internal_10 = VCALL Main function_is_even_at_Main - internal_7 = internal_10 - IF internal_7 GOTO then_8781702295290 - GOTO else_8781702295290 - - then_8781702295290: - internal_11 = ALLOCSTR "is even!\n" - ARG self - ARG internal_11 - internal_12 = VCALL Main function_out_string_at_IO - internal_6 = internal_12 - GOTO endif_8781702295290 - - else_8781702295290: - internal_13 = ALLOCSTR "is odd!\n" - ARG self - ARG internal_13 - internal_14 = VCALL Main function_out_string_at_IO - internal_6 = internal_14 - GOTO endif_8781702295290 - - endif_8781702295290: - internal_15 = GETATTR self avar - ARG self - ARG internal_15 - internal_16 = VCALL Main function_class_type_at_Main - ARG self - internal_17 = VCALL Main function_menu_at_Main - - SETATTR self char internal_17 - # Conditional - internal_19 = ALLOCBOOL 0 - internal_20 = GETATTR self char - internal_21 = ALLOCSTR "a" - - ARG internal_20 - ARG internal_21 - internal_22 = CALL function_equal - internal_19 = internal_22 - IF internal_19 GOTO then_8781702298209 - GOTO else_8781702298209 - - then_8781702298209: - internal_23 = ALLOCATE A # Allocate the object A - ARG internal_23 # Pass the instance to the constructor - internal_23 = VCALL A function___init___at_A # Call the constructor - ARG self - internal_24 = VCALL Main function_get_int_at_Main - ARG internal_23 - ARG internal_24 - internal_25 = VCALL A function_set_var_at_A - - SETATTR self a_var internal_25 - internal_26 = ALLOCATE B # Allocate the object B - ARG internal_26 # Pass the instance to the constructor - internal_26 = VCALL B function___init___at_B # Call the constructor - internal_27 = GETATTR self avar - ARG internal_27 - internal_28 = VCALL A function_value_at_A - internal_29 = GETATTR self a_var - ARG internal_29 - internal_30 = VCALL A function_value_at_A - ARG internal_26 - ARG internal_28 - ARG internal_30 - internal_31 = VCALL B function_method2_at_A - - SETATTR self avar internal_31 - internal_18 = internal_31 - GOTO endif_8781702298209 - - else_8781702298209: - # Conditional - internal_33 = ALLOCBOOL 0 - internal_34 = GETATTR self char - internal_35 = ALLOCSTR "b" - - ARG internal_34 - ARG internal_35 - internal_36 = CALL function_equal - internal_33 = internal_36 - IF internal_33 GOTO then_8781702298203 - GOTO else_8781702298203 - - then_8781702298203: - internal_37 = GETATTR self avar - internal_38 = ALLOCINT 0 - internal_39 = ALLOCINT 1 - internal_40 = ALLOCINT 3 - internal_41 = ALLOCNULL - internal_42 = ALLOCINT 0 - internal_45 = ALLOCBOOL 0 - - # Switch Case Algorithm Steps: - # 1 - Count how many ancestors has the dynamic type of the expression - # 2 - Create an array of the same size where to store the ancestors - # 3 - For each branch type, store the ancestor index that match with it, if no one match, store `count of ancestors` - # 4 - Find the minimum of the ancestors indexes - # 5 - With the minimum index, get the correct branch type - - # ######################################################################## # - # Step 1 - Count how many ancestors has the dynamic type of the expression # - # ######################################################################## # - internal_43 = TYPEOF internal_37 # Get the switch expression type - internal_44 = internal_43 # The first ancestor will be the type itself - while_start_8781702296263: - internal_45 = EQUALADDR internal_44 internal_41 - IF internal_45 GOTO while_end_8781702296263 - # Increment the count of ancestors - ARG internal_42 - ARG internal_39 - internal_42 = CALL function_add - internal_44 = ANCESTOR internal_44 - GOTO while_start_8781702296263 - while_end_8781702296263: - - # ###################################################################### # - # Step 2 - Create an array of the same size where to store the ancestors # - # ###################################################################### # - internal_44 = internal_43 # The first ancestor will be the type itself - internal_46 = ARRAY internal_42 # Create an array of ancestors - internal_47 = ALLOCINT 0 - internal_48 = ALLOCBOOL 0 - foreach_start_8781702296263: - ARG internal_47 - ARG internal_42 - internal_48 = CALL function_less_than - IF internal_48 GOTO foreach_body_8781702296263 - GOTO foreach_end_8781702296263 - foreach_body_8781702296263: - SETINDEX internal_46 internal_47 internal_44 # Set the index of the array with the ancestor type - internal_44 = ANCESTOR internal_44 # Get the next ancestor - ARG internal_47 - ARG internal_39 - internal_47 = CALL function_add - GOTO foreach_start_8781702296263 - foreach_end_8781702296263: - - internal_49 = ARRAY internal_40 - internal_50 = ARRAY internal_40 - internal_52 = ALLOCINT 0 - internal_51 = TYPEADDR C - SETINDEX internal_49 internal_52 internal_51 - SETVALUEINDEX internal_50 internal_52 internal_42 - internal_54 = ALLOCINT 1 - internal_53 = TYPEADDR A - SETINDEX internal_49 internal_54 internal_53 - SETVALUEINDEX internal_50 internal_54 internal_42 - internal_56 = ALLOCINT 2 - internal_55 = TYPEADDR Object - SETINDEX internal_49 internal_56 internal_55 - SETVALUEINDEX internal_50 internal_56 internal_42 - - internal_57 = ALLOCINT 0 - internal_58 = ALLOCBOOL 0 - internal_60 = ALLOCINT 0 - internal_61 = ALLOCBOOL 0 - internal_63 = ALLOCBOOL 0 - foreach_type_start_8781702296263: - ARG internal_57 - ARG internal_40 - internal_58 = CALL function_less_than - IF internal_58 GOTO foreach_type_body_8781702296263 - GOTO foreach_type_end_8781702296263 - foreach_type_body_8781702296263: - internal_59 = GETINDEX internal_49 internal_57 # Get the type of the i-th branch - ARG internal_60 - ARG internal_38 - internal_60 = CALL function_assign - foreach_ancestor_start_8781702296263: - ARG internal_60 - ARG internal_42 - internal_61 = CALL function_less_than - IF internal_61 GOTO foreach_ancestor_body_8781702296263 - GOTO foreach_ancestor_end_8781702296263 - foreach_ancestor_body_8781702296263: - internal_62 = GETINDEX internal_46 internal_60 # Get the j-th ancestor type - internal_63 = EQUALADDR internal_59 internal_62 # Compare if the type of the i-th branch is equal to the j-th ancestor - IF internal_63 GOTO foreach_ancestor_end_8781702296263 # If the types are equal, we have a match, then we can exit - ARG internal_60 - ARG internal_39 - internal_60 = CALL function_add - GOTO foreach_ancestor_start_8781702296263 - foreach_ancestor_end_8781702296263: - SETVALUEINDEX internal_50 internal_57 internal_60 # Set the counter of the i-th branch equals to j - # #################### # - # End of Inner Foreach # - # #################### # - - ARG internal_57 - ARG internal_39 - internal_57 = CALL function_add - GOTO foreach_type_start_8781702296263 - foreach_type_end_8781702296263: - # ################# # - # End Outer Foreach # - # ################# # - - # ######################################## # - # Step 4 - Find the minimum ancestor index # - # ######################################## # - internal_69 = ALLOCSTR "\n" - internal_70 = ALLOCSTR " " - internal_64 = ALLOCINT 0 - internal_65 = ALLOCINT 0 - internal_66 = ALLOCINT 0 - internal_67 = ALLOCINT 0 - internal_68 = ALLOCBOOL 0 - ARG internal_67 - ARG internal_42 - internal_67 = CALL function_assign - foreach_min_start_8781702296263: - ARG internal_64 - ARG internal_40 - internal_68 = CALL function_less_than - IF internal_68 GOTO foreach_min_body_8781702296263 - GOTO foreach_min_end_8781702296263 - foreach_min_body_8781702296263: - internal_66 = GETVALUEINDEX internal_50 internal_64 # Get the nearest ancestor index of the i-th branch type - ARG internal_66 - ARG internal_67 - internal_68 = CALL function_less_than - IF internal_68 GOTO update_min_8781702296263 - GOTO update_min_end_8781702296263 - update_min_8781702296263: - ARG internal_67 - ARG internal_66 - internal_67 = CALL function_assign - ARG internal_65 - ARG internal_64 - internal_65 = CALL function_assign - update_min_end_8781702296263: - ARG internal_64 - ARG internal_39 - internal_64 = CALL function_add - GOTO foreach_min_start_8781702296263 - foreach_min_end_8781702296263: - - # ################################################################# # - # Step 5 - Using the minimun ancestor index find the correct branch # - # ################################################################# # - internal_71 = ARRAY internal_40 # Create the bool array - internal_72 = ALLOCINT 0 - SETVALUEINDEX internal_71 internal_72 internal_38 # Initialize the bool array - internal_73 = ALLOCINT 1 - SETVALUEINDEX internal_71 internal_73 internal_38 # Initialize the bool array - internal_74 = ALLOCINT 2 - SETVALUEINDEX internal_71 internal_74 internal_38 # Initialize the bool array - - internal_75 = ALLOCBOOL 0 - ARG internal_67 - ARG internal_42 - internal_75 = CALL function_equal - IF internal_75 GOTO error_branch_8781702296263 - SETVALUEINDEX internal_71 internal_65 internal_39 # Set the bool array in the correct index to 1 - internal_76 = ALLOCBOOL 0 - - internal_77 = ALLOCINT 0 - internal_76 = GETVALUEINDEX internal_71 internal_77 # Get the bool value of the branch C - IF internal_76 GOTO branch_C_8781702296263 # If the bool value is 1, then we have a match - - internal_78 = ALLOCINT 1 - internal_76 = GETVALUEINDEX internal_71 internal_78 # Get the bool value of the branch A - IF internal_76 GOTO branch_A_8781702296263 # If the bool value is 1, then we have a match - - internal_79 = ALLOCINT 2 - internal_76 = GETVALUEINDEX internal_71 internal_79 # Get the bool value of the branch Object - IF internal_76 GOTO branch_Object_8781702296263 # If the bool value is 1, then we have a match - - branch_C_8781702296263: - ARG c - ARG internal_37 - c = CALL function_assign - ARG c - internal_82 = VCALL C function_value_at_A - ARG c - ARG internal_82 - internal_83 = VCALL C function_method6_at_C - - SETATTR self avar internal_83 - ARG internal_80 - ARG internal_83 - internal_80 = CALL function_assign - internal_80 = internal_83 # Assign the result - GOTO branch_end_8781702296263 - - branch_A_8781702296263: - ARG a - ARG internal_37 - a = CALL function_assign - ARG a - internal_85 = VCALL A function_value_at_A - ARG a - ARG internal_85 - internal_86 = VCALL A function_method3_at_A - - SETATTR self avar internal_86 - ARG internal_80 - ARG internal_86 - internal_80 = CALL function_assign - internal_80 = internal_86 # Assign the result - GOTO branch_end_8781702296263 - - branch_Object_8781702296263: - ARG o - ARG internal_37 - o = CALL function_assign - internal_88 = ALLOCSTR "Oooops\n" - ARG self - ARG internal_88 - internal_89 = VCALL Main function_out_string_at_IO - ARG self - internal_90 = VCALL Main function_abort_at_Object - internal_91 = ALLOCINT 0 - ARG internal_80 - ARG internal_91 - internal_80 = CALL function_assign - internal_80 = internal_91 # Assign the result - GOTO branch_end_8781702296263 - - error_branch_8781702296263: - # Insert an error call - branch_end_8781702296263: - internal_32 = internal_80 - GOTO endif_8781702298203 - - else_8781702298203: - # Conditional - internal_93 = ALLOCBOOL 0 - internal_94 = GETATTR self char - internal_95 = ALLOCSTR "c" - - ARG internal_94 - ARG internal_95 - internal_96 = CALL function_equal - internal_93 = internal_96 - IF internal_93 GOTO then_8781702298197 - GOTO else_8781702298197 - - then_8781702298197: - internal_97 = ALLOCATE A # Allocate the object A - ARG internal_97 # Pass the instance to the constructor - internal_97 = VCALL A function___init___at_A # Call the constructor - ARG self - internal_98 = VCALL Main function_get_int_at_Main - ARG internal_97 - ARG internal_98 - internal_99 = VCALL A function_set_var_at_A - - SETATTR self a_var internal_99 - internal_100 = ALLOCATE D # Allocate the object D - ARG internal_100 # Pass the instance to the constructor - internal_100 = VCALL D function___init___at_D # Call the constructor - internal_101 = GETATTR self avar - ARG internal_101 - internal_102 = VCALL A function_value_at_A - internal_103 = GETATTR self a_var - ARG internal_103 - internal_104 = VCALL A function_value_at_A - ARG internal_100 - ARG internal_102 - ARG internal_104 - internal_105 = VCALL D function_method4_at_A - - SETATTR self avar internal_105 - internal_92 = internal_105 - GOTO endif_8781702298197 - - else_8781702298197: - # Conditional - internal_107 = ALLOCBOOL 0 - internal_108 = GETATTR self char - internal_109 = ALLOCSTR "d" - - ARG internal_108 - ARG internal_109 - internal_110 = CALL function_equal - internal_107 = internal_110 - IF internal_107 GOTO then_8781702298191 - GOTO else_8781702298191 - - then_8781702298191: - internal_111 = ALLOCATE C # Allocate the object C - ARG internal_111 # Pass the instance to the constructor - internal_111 = VCALL C function___init___at_C # Call the constructor - internal_112 = GETATTR self avar - ARG internal_112 - internal_113 = VCALL A function_value_at_A - ARG internal_111 - ARG internal_113 - internal_114 = VCALL C function_method5_at_C - - SETATTR self avar internal_114 - internal_106 = internal_114 - GOTO endif_8781702298191 - - else_8781702298191: - # Conditional - internal_116 = ALLOCBOOL 0 - internal_117 = GETATTR self char - internal_118 = ALLOCSTR "e" - - ARG internal_117 - ARG internal_118 - internal_119 = CALL function_equal - internal_116 = internal_119 - IF internal_116 GOTO then_8781702298185 - GOTO else_8781702298185 - - then_8781702298185: - internal_120 = ALLOCATE C # Allocate the object C - ARG internal_120 # Pass the instance to the constructor - internal_120 = VCALL C function___init___at_C # Call the constructor - internal_121 = GETATTR self avar - ARG internal_121 - internal_122 = VCALL A function_value_at_A - ARG internal_120 - ARG internal_122 - internal_123 = VCALL C function_method5_at_C - - SETATTR self avar internal_123 - internal_115 = internal_123 - GOTO endif_8781702298185 - - else_8781702298185: - # Conditional - internal_125 = ALLOCBOOL 0 - internal_126 = GETATTR self char - internal_127 = ALLOCSTR "f" - - ARG internal_126 - ARG internal_127 - internal_128 = CALL function_equal - internal_125 = internal_128 - IF internal_125 GOTO then_8781702298179 - GOTO else_8781702298179 - - then_8781702298179: - internal_129 = ALLOCATE C # Allocate the object C - ARG internal_129 # Pass the instance to the constructor - internal_129 = VCALL C function___init___at_C # Call the constructor - internal_130 = GETATTR self avar - ARG internal_130 - internal_131 = VCALL A function_value_at_A - ARG internal_129 - ARG internal_131 - internal_132 = VCALL C function_method5_at_C - - SETATTR self avar internal_132 - internal_124 = internal_132 - GOTO endif_8781702298179 - - else_8781702298179: - # Conditional - internal_134 = ALLOCBOOL 0 - internal_135 = GETATTR self char - internal_136 = ALLOCSTR "g" - - ARG internal_135 - ARG internal_136 - internal_137 = CALL function_equal - internal_134 = internal_137 - IF internal_134 GOTO then_8781702298173 - GOTO else_8781702298173 - - then_8781702298173: - # Conditional - internal_139 = ALLOCBOOL 0 - internal_140 = ALLOCATE D # Allocate the object D - ARG internal_140 # Pass the instance to the constructor - internal_140 = VCALL D function___init___at_D # Call the constructor - internal_141 = GETATTR self avar - ARG internal_141 - internal_142 = VCALL A function_value_at_A - ARG internal_140 - ARG internal_142 - internal_143 = VCALL D function_method7_at_D - internal_139 = internal_143 - IF internal_139 GOTO then_8781702296820 - GOTO else_8781702296820 - - then_8781702296820: - internal_144 = ALLOCSTR "number " - ARG self - ARG internal_144 - internal_145 = VCALL Main function_out_string_at_IO - internal_146 = GETATTR self avar - ARG self - ARG internal_146 - internal_147 = VCALL Main function_print_at_Main - internal_148 = ALLOCSTR "is divisible by 3.\n" - ARG self - ARG internal_148 - internal_149 = VCALL Main function_out_string_at_IO - internal_138 = internal_149 - GOTO endif_8781702296820 - - else_8781702296820: - internal_150 = ALLOCSTR "number " - ARG self - ARG internal_150 - internal_151 = VCALL Main function_out_string_at_IO - internal_152 = GETATTR self avar - ARG self - ARG internal_152 - internal_153 = VCALL Main function_print_at_Main - internal_154 = ALLOCSTR "is not divisible by 3.\n" - ARG self - ARG internal_154 - internal_155 = VCALL Main function_out_string_at_IO - internal_138 = internal_155 - GOTO endif_8781702296820 - - endif_8781702296820: - internal_133 = internal_138 - GOTO endif_8781702298173 - - else_8781702298173: - # Conditional - internal_157 = ALLOCBOOL 0 - internal_158 = GETATTR self char - internal_159 = ALLOCSTR "h" - - ARG internal_158 - ARG internal_159 - internal_160 = CALL function_equal - internal_157 = internal_160 - IF internal_157 GOTO then_8781702298167 - GOTO else_8781702298167 - - then_8781702298167: - # Let x: A - x = ALLOCNULL - internal_162 = ALLOCATE E # Allocate the object E - ARG internal_162 # Pass the instance to the constructor - internal_162 = VCALL E function___init___at_E # Call the constructor - internal_163 = GETATTR self avar - ARG internal_163 - internal_164 = VCALL A function_value_at_A - ARG internal_162 - ARG internal_164 - internal_165 = VCALL E function_method6_at_E - - ARG x - ARG internal_165 - x = CALL function_assign - # Let r: Int - - internal_167 = GETATTR self avar - ARG internal_167 - internal_168 = VCALL A function_value_at_A - ARG x - internal_169 = VCALL A function_value_at_A - internal_170 = ALLOCINT 8 - - ARG internal_169 - ARG internal_170 - internal_171 = CALL function_mult - - ARG internal_168 - ARG internal_171 - internal_172 = CALL function_sub - ARG r - ARG internal_172 - r = CALL function_assign - internal_173 = ALLOCSTR "number " - ARG self - ARG internal_173 - internal_174 = VCALL Main function_out_string_at_IO - internal_175 = GETATTR self avar - ARG self - ARG internal_175 - internal_176 = VCALL Main function_print_at_Main - internal_177 = ALLOCSTR "is equal to " - ARG self - ARG internal_177 - internal_178 = VCALL Main function_out_string_at_IO - ARG self - ARG x - internal_179 = VCALL Main function_print_at_Main - internal_180 = ALLOCSTR "times 8 with a remainder of " - ARG self - ARG internal_180 - internal_181 = VCALL Main function_out_string_at_IO - # Let a: A2I - - internal_183 = ALLOCATE A2I # Allocate the object A2I - ARG internal_183 # Pass the instance to the constructor - internal_183 = VCALL A2I function___init___at_A2I # Call the constructor - ARG a - ARG internal_183 - a = CALL function_assign - ARG a - ARG r - internal_184 = VCALL A2I function_i2a_at_A2I - ARG self - ARG internal_184 - internal_185 = VCALL Main function_out_string_at_IO - internal_186 = ALLOCSTR "\n" - ARG self - ARG internal_186 - internal_187 = VCALL Main function_out_string_at_IO - - SETATTR self avar x - internal_156 = x - GOTO endif_8781702298167 - - else_8781702298167: - # Conditional - internal_189 = ALLOCBOOL 0 - internal_190 = GETATTR self char - internal_191 = ALLOCSTR "j" - - ARG internal_190 - ARG internal_191 - internal_192 = CALL function_equal - internal_189 = internal_192 - IF internal_189 GOTO then_8781702298161 - GOTO else_8781702298161 - - then_8781702298161: - internal_193 = ALLOCATE A # Allocate the object A - ARG internal_193 # Pass the instance to the constructor - internal_193 = VCALL A function___init___at_A # Call the constructor - - SETATTR self avar internal_193 - internal_188 = internal_193 - GOTO endif_8781702298161 - - else_8781702298161: - # Conditional - internal_195 = ALLOCBOOL 0 - internal_196 = GETATTR self char - internal_197 = ALLOCSTR "q" - - ARG internal_196 - ARG internal_197 - internal_198 = CALL function_equal - internal_195 = internal_198 - IF internal_195 GOTO then_8781702298137 - GOTO else_8781702298137 - - then_8781702298137: - internal_199 = ALLOCBOOL 0 - - SETATTR self flag internal_199 - internal_194 = internal_199 - GOTO endif_8781702298137 - - else_8781702298137: - internal_200 = ALLOCATE A # Allocate the object A - ARG internal_200 # Pass the instance to the constructor - internal_200 = VCALL A function___init___at_A # Call the constructor - internal_201 = GETATTR self avar - ARG internal_201 - internal_202 = VCALL A function_value_at_A - ARG internal_200 - ARG internal_202 - internal_203 = VCALL A function_method1_at_A - - SETATTR self avar internal_203 - internal_194 = internal_203 - GOTO endif_8781702298137 - - endif_8781702298137: - internal_188 = internal_194 - GOTO endif_8781702298161 - - endif_8781702298161: - internal_156 = internal_188 - GOTO endif_8781702298167 - - endif_8781702298167: - internal_133 = internal_156 - GOTO endif_8781702298173 - - endif_8781702298173: - internal_124 = internal_133 - GOTO endif_8781702298179 - - endif_8781702298179: - internal_115 = internal_124 - GOTO endif_8781702298185 - - endif_8781702298185: - internal_106 = internal_115 - GOTO endif_8781702298191 - - endif_8781702298191: - internal_92 = internal_106 - GOTO endif_8781702298197 - - endif_8781702298197: - internal_32 = internal_92 - GOTO endif_8781702298203 - - endif_8781702298203: - internal_18 = internal_32 - GOTO endif_8781702298209 - - endif_8781702298209: - GOTO while_start_8781702298224 - - while_end_8781702298224: - - RETURN 0 -} -function main{ - - - LOCAL internal_0 - LOCAL internal_1 - - internal_0 = ALLOCATE Main - ARG internal_0 - internal_0 = VCALL Main function___init___at_Main - - ARG internal_0 - internal_1 = VCALL Main function_main_at_Main - - HALT -} \ No newline at end of file diff --git a/src/arith.cl b/src/arith.cl deleted file mode 100755 index 7a4ebb067..000000000 --- a/src/arith.cl +++ /dev/null @@ -1,476 +0,0 @@ -(* - * 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/src/arith_input.txt b/src/arith_input.txt deleted file mode 100644 index 40ee26477..000000000 --- a/src/arith_input.txt +++ /dev/null @@ -1 +0,0 @@ -Hello diff --git a/src/arith_output.txt b/src/arith_output.txt deleted file mode 100644 index a1e8afa57..000000000 --- a/src/arith_output.txt +++ /dev/null @@ -1,19 +0,0 @@ -SPIM Version 8.0 of January 8, 2010 -Copyright 1990-2010, James R. Larus. -All Rights Reserved. -See the file README for a full copyright notice. -Loaded: /usr/lib/spim/exceptions.s -number 0 is even! -Class type is now A - - To add a number to 0 ...enter a: - To negate 0 ...enter b: - To find the difference between 0 and another number...enter c: - To find the factorial of 0 ...enter d: - To square 0 ...enter e: - To cube 0 ...enter f: - To find out if 0 is a multiple of 3...enter g: - To divide 0 by 8...enter h: - To get a new number...enter j: - To quit...enter q: - diff --git a/src/complex.asm b/src/complex.asm deleted file mode 100644 index c55c2d284..000000000 --- a/src/complex.asm +++ /dev/null @@ -1,2944 +0,0 @@ -.data - type_Object: .word 8 - type_Object_inherits_from: .word 0 - type_Object_attributes: .word 0 - type_Object_name_size: .word 6 - type_Object_name: .asciiz "Object" - type_Object_abort_message: .asciiz "Abort called from class Object\n" - - type_IO: .word 8 - type_IO_inherits_from: .word type_Object - type_IO_attributes: .word 0 - type_IO_name_size: .word 2 - type_IO_name: .asciiz "IO" - type_IO_abort_message: .asciiz "Abort called from class IO\n" - - type_Int: .word 8 - type_Int_inherits_from: .word type_Object - type_Int_attributes: .word 0 - type_Int_name_size: .word 3 - type_Int_name: .asciiz "Int" - type_Int_abort_message: .asciiz "Abort called from class Int\n" - - type_String: .word 8 - type_String_inherits_from: .word type_Object - type_String_attributes: .word 0 - type_String_name_size: .word 6 - type_String_name: .asciiz "String" - type_String_abort_message: .asciiz "Abort called from class String\n" - - type_Bool: .word 8 - type_Bool_inherits_from: .word type_Object - type_Bool_attributes: .word 0 - type_Bool_name_size: .word 4 - type_Bool_name: .asciiz "Bool" - type_Bool_abort_message: .asciiz "Abort called from class Bool\n" - - type_Main: .word 8 - type_Main_inherits_from: .word type_IO - type_Main_attributes: .word 0 - type_Main_name_size: .word 4 - type_Main_name: .asciiz "Main" - type_Main_abort_message: .asciiz "Abort called from class Main\n" - - type_Complex: .word 16 - type_Complex_inherits_from: .word type_IO - type_Complex_attributes: .word 2 - type_Complex_name_size: .word 7 - type_Complex_name: .asciiz "Complex" - type_Complex_abort_message: .asciiz "Abort called from class Complex\n" - - buffer_input: .space 1024 - debug_log: .asciiz "debug_log\n" - -.text - function_add: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Addition operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - add $t2, $t0, $t1 # $t2 = $t0 + $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_sub: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Subtraction operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - sub $t2, $t0, $t1 # $t2 = $t0 - $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_mult: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Multiplication operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - mult $t0, $t1 # $t2 = $t0 * $t1 - mflo $t2 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_div: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Division operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - div $t0, $t1 # $t2 = $t0 / $t1 - mflo $t2 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_xor: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Xor operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_less_than: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Less than operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_less_than_or_equal: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Less than operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_equal: - # Function parameters - # $ra = 48($sp) - # a = 44($sp) - # b = 40($sp) - - # Reserving space for local variables - addi $sp, $sp, -40 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_0 = address of allocated object Int - - # Allocating NUll to internal_1 - sw $zero, 32($sp) # internal_1 = 0 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_2 = address of allocated object Int - - # internal_2 = EqualAddress(a, internal_1) - lw $t0, 44($sp) - lw $t1, 32($sp) - seq $t2, $t0, $t1 - lw $t0, 28($sp) - sw $t2, 8($t0) - - # internal_2 = EqualAddress(b, internal_1) - lw $t0, 40($sp) - lw $t1, 32($sp) - seq $t2, $t0, $t1 - lw $t0, 28($sp) - sw $t2, 8($t0) - - # If internal_2 then goto a_is_type_object - lw $t0, 28($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, a_is_type_object - - # internal_3 = typeof a that is the first word of the object - lw $t0, 44($sp) - lw $t0, 0($t0) - sw $t0, 24($sp) - - # internal_4 = direction of Int - la $t0, type_Int - sw $t0, 20($sp) - - # internal_5 = direction of Bool - la $t0, type_Bool - sw $t0, 16($sp) - - # internal_6 = direction of String - la $t0, type_String - sw $t0, 12($sp) - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_7 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_8 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_9 = address of allocated object Int - - # internal_7 = EqualAddress(internal_3, internal_4) - lw $t0, 24($sp) - lw $t1, 20($sp) - seq $t2, $t0, $t1 - lw $t0, 8($sp) - sw $t2, 8($t0) - - # internal_8 = EqualAddress(internal_3, internal_5) - lw $t0, 24($sp) - lw $t1, 16($sp) - seq $t2, $t0, $t1 - lw $t0, 4($sp) - sw $t2, 8($t0) - - # internal_9 = EqualAddress(internal_3, internal_6) - lw $t0, 24($sp) - lw $t1, 12($sp) - seq $t2, $t0, $t1 - lw $t0, 0($sp) - sw $t2, 8($t0) - - # If internal_7 then goto a_is_type_int_or_bool - lw $t0, 8($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, a_is_type_int_or_bool - - # If internal_8 then goto a_is_type_int_or_bool - lw $t0, 4($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, a_is_type_int_or_bool - - # If internal_9 then goto a_is_type_string - lw $t0, 0($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, a_is_type_string - - # Jumping to a_is_type_object - j a_is_type_object - - a_is_type_int_or_bool: - - # internal_0 = EqualInt(a, b) - lw $t0, 44($sp) - lw $t0, 8($t0) - lw $t1, 40($sp) - lw $t1, 8($t1) - seq $t2, $t0, $t1 - lw $t0, 36($sp) - sw $t2, 8($t0) - - # Jumping to end_of_equal - j end_of_equal - - a_is_type_string: - - # internal_0 = EqualStr(a, b) - lw $t0, 44($sp) - lw $t1, 40($sp) - addi $t0, $t0, 8 - addi $t1, $t1, 8 - - # By default we assume the strings are equals - addi $t4, $zero, 1 - lw $t5, 36($sp) - sw $t4, 8($t5) - - while_compare_strings_start: - lb $t2, 0($t0) - lb $t3, 0($t1) - beq $t2, $t3, while_compare_strings_update - - # The strings are no equals - lw $t5, 36($sp) - sw $zero, 8($t5) - j while_compare_strings_end - - while_compare_strings_update: - addi $t0, $t0, 1 - addi $t1, $t1, 1 - beq $t2, $zero, while_compare_strings_end - beq $t3, $zero, while_compare_strings_end - j while_compare_strings_start - while_compare_strings_end: - - # Jumping to end_of_equal - j end_of_equal - - a_is_type_object: - - # Equal operation - lw $t0, 44($sp) # Save in $t0 the left operand address - lw $t1, 40($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 - - lw $t0, 36($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # Jumping to end_of_equal - j end_of_equal - - end_of_equal: - - # Loading return value in $v1 - lw $v1, 36($sp) - - # Freeing space for local variables - addi $sp, $sp, 40 - - jr $ra - - function_assign: - # Function parameters - # $ra = 36($sp) - # dest = 32($sp) - # source = 28($sp) - - # Reserving space for local variables - addi $sp, $sp, -28 - - # Allocating NUll to internal_0 - sw $zero, 24($sp) # internal_0 = 0 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_1 = address of allocated object Int - - # internal_1 = EqualAddress(source, internal_0) - lw $t0, 28($sp) - lw $t1, 24($sp) - seq $t2, $t0, $t1 - lw $t0, 20($sp) - sw $t2, 8($t0) - - # internal_1 = EqualAddress(dest, internal_0) - lw $t0, 32($sp) - lw $t1, 24($sp) - seq $t2, $t0, $t1 - lw $t0, 20($sp) - sw $t2, 8($t0) - - # If internal_1 then goto source_is_type_object - lw $t0, 20($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, source_is_type_object - - # internal_2 = typeof source that is the first word of the object - lw $t0, 28($sp) - lw $t0, 0($t0) - sw $t0, 16($sp) - - # internal_3 = direction of Int - la $t0, type_Int - sw $t0, 12($sp) - - # internal_4 = direction of Bool - la $t0, type_Bool - sw $t0, 8($sp) - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_5 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_6 = address of allocated object Int - - # internal_5 = EqualAddress(internal_2, internal_3) - lw $t0, 16($sp) - lw $t1, 12($sp) - seq $t2, $t0, $t1 - lw $t0, 4($sp) - sw $t2, 8($t0) - - # internal_6 = EqualAddress(internal_2, internal_4) - lw $t0, 16($sp) - lw $t1, 8($sp) - seq $t2, $t0, $t1 - lw $t0, 0($sp) - sw $t2, 8($t0) - - # If internal_5 then goto source_is_type_int_or_bool - lw $t0, 4($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, source_is_type_int_or_bool - - # If internal_6 then goto source_is_type_int_or_bool - lw $t0, 0($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, source_is_type_int_or_bool - - # Jumping to source_is_type_object - j source_is_type_object - - source_is_type_int_or_bool: - - # dest = source where source is an integer - li $v0, 9 - addi $a0, $zero, 12 - syscall - lw $t0, 28($sp) # Pointer to source - lw $t1, 0($t0) # $t1 = type of source - lw $t2, 8($t0) # $t2 = value of source - sw $t1, 0($v0) # Save type of dest - sw $a0, 4($v0) # Save size of dest - sw $t2, 8($v0) # Save value of dest - sw $v0, 32($sp) - - # Jumping to source_end_of_equal - j source_end_of_equal - - source_is_type_object: - - # dest = source - lw $t0, 28($sp) - sw $t0, 32($sp) - - # Jumping to source_end_of_equal - j source_end_of_equal - - source_end_of_equal: - - # Loading return value in $v1 - lw $v1, 32($sp) - - # Freeing space for local variables - addi $sp, $sp, 28 - - jr $ra - - function___init___at_Object: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_abort_at_Object: - # Function parameters - # $ra = 20($sp) - # self = 16($sp) - - # Reserving space for local variables - addi $sp, $sp, -16 - - # Allocating String - li $v0, 9 - addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 33 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 65 - sb $t0, 8($v0) # internal_0[0] = 'A' - - addi $t0, $zero, 98 - sb $t0, 9($v0) # internal_0[1] = 'b' - - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_0[2] = 'o' - - addi $t0, $zero, 114 - sb $t0, 11($v0) # internal_0[3] = 'r' - - addi $t0, $zero, 116 - sb $t0, 12($v0) # internal_0[4] = 't' - - addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_0[5] = ' ' - - addi $t0, $zero, 99 - sb $t0, 14($v0) # internal_0[6] = 'c' - - addi $t0, $zero, 97 - sb $t0, 15($v0) # internal_0[7] = 'a' - - addi $t0, $zero, 108 - sb $t0, 16($v0) # internal_0[8] = 'l' - - addi $t0, $zero, 108 - sb $t0, 17($v0) # internal_0[9] = 'l' - - addi $t0, $zero, 101 - sb $t0, 18($v0) # internal_0[10] = 'e' - - addi $t0, $zero, 100 - sb $t0, 19($v0) # internal_0[11] = 'd' - - addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_0[12] = ' ' - - addi $t0, $zero, 102 - sb $t0, 21($v0) # internal_0[13] = 'f' - - addi $t0, $zero, 114 - sb $t0, 22($v0) # internal_0[14] = 'r' - - addi $t0, $zero, 111 - sb $t0, 23($v0) # internal_0[15] = 'o' - - addi $t0, $zero, 109 - sb $t0, 24($v0) # internal_0[16] = 'm' - - addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_0[17] = ' ' - - addi $t0, $zero, 99 - sb $t0, 26($v0) # internal_0[18] = 'c' - - addi $t0, $zero, 108 - sb $t0, 27($v0) # internal_0[19] = 'l' - - addi $t0, $zero, 97 - sb $t0, 28($v0) # internal_0[20] = 'a' - - addi $t0, $zero, 115 - sb $t0, 29($v0) # internal_0[21] = 's' - - addi $t0, $zero, 115 - sb $t0, 30($v0) # internal_0[22] = 's' - - addi $t0, $zero, 32 - sb $t0, 31($v0) # internal_0[23] = ' ' - - sb $zero, 32($v0) # Null-terminator at the end of the string - - sw $v0, 12($sp) # internal_0 = "Abort called from class " - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_2[0] = '\n' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 4($sp) # internal_2 = "\n" - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument self - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_type_name_at_Object - jal function_type_name_at_Object - lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_0 - lw $t0, 24($sp) - sw $t0, 4($sp) # Storing internal_0 - - # Argument internal_1 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function_concat_at_String - jal function_concat_at_String - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_3 - lw $t0, 12($sp) - sw $t0, 4($sp) # Storing internal_3 - - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_concat_at_String - jal function_concat_at_String - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String - addi $sp, $sp, 12 # Freeing space for arguments - - lw $t0, 0($sp) # $t0 = internal_3 - addi $t0, $t0, 8 # Pointer to the first character of the string - - # Printing the string internal_3 - li $v0, 4 - move $a0, $t0 - syscall - - # Exit program - li $v0, 10 - syscall - - # Loading return value in $v1 - lw $v1, 16($sp) - - # Freeing space for local variables - addi $sp, $sp, 16 - - jr $ra - - function_type_name_at_Object: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = name of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($t0) # $t1 = type of self - lw $t2, 12($t1) # $t1 = length of the name of self - la $t3, 16($t1) # $t1 = name of self - - addi $t2, $t2, 9 # Setting space for the type, the size and the null byte - li $v0, 9 - move $a0, $t2 - syscall - addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte - - la $t4, type_String - sw $t4, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - - addi $t4, $v0, 0 # $t4 = direction of the new string - addi $t4, $t4, 8 # Pointer to the first character of the string - xor $t5, $t5, $t5 # Initializing counter - while_copy_name_start: - beq $t5, $t2, while_copy_name_end - lb $t6, 0($t3) # Loading the character - sb $t6, 0($t4) - addi $t4, $t4, 1 # Incrementing the pointer to the new string - addi $t3, $t3, 1 # Incrementing the pointer to the string in self - addi $t5, $t5, 1 # Incrementing counter - j while_copy_name_start - while_copy_name_end: - - sb $zero, 0($t4) # Setting the null byte - - sw $v0, 0($sp) # Storing the new string in internal_0 - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_copy_at_Object: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = copy of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($t0) # $t1 = type of self - lw $t2, 4($t0) # $t2 = length of self in bytes - - # Allocating space for the new object - li $v0, 9 - move $a0, $t2 - syscall - move $t3, $v0 # $t3 = direction of the new object - sw $t1, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - - # Initializing the variable of the loop - addi $t0, $t0, 8 # Pointer to the first character of the object - addi $t3, $t3, 8 # Pointer to the first character of the object - addi $t2, $2, -8 # Decrementing in 8 the length of the object - xor $t4, $t4, $t4 # Initializing counter - - # Loop copying the object - while_copy_start: - beq $t4, $t2, while_copy_end - lb $t5, 0($t0) # Loading the byte - sb $t5, 0($t3) # Storing the byte - addi $t0, $t0, 1 # Incrementing the pointer to the object - addi $t3, $t3, 1 # Incrementing the pointer to the new object - addi $t4, $t4, 1 # Incrementing counter - j while_copy_start - while_copy_end: - sw $v0, 0($sp) # Storing the new object in internal_0 - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function___init___at_IO: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_out_string_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - # x = 0($sp) - - lw $t0, 0($sp) # $t0 = x - addi $t0, $t0, 8 # Pointer to the first character of the string - - # Printing the string x - li $v0, 4 - move $a0, $t0 - syscall - - # Loading return value in $v1 - lw $v1, 4($sp) - - jr $ra - - function_out_int_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - # x = 0($sp) - - # Printing the string x - li $v0, 1 - lw $a0, 0($sp) - lw $a0, 8($a0) - syscall - - # Loading return value in $v1 - lw $v1, 4($sp) - - jr $ra - - function_in_string_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - li $v0, 8 - la $a0, buffer_input - li $a1, 1024 - syscall - - xor $t0, $t0, $t0 # Initializing counter - while_read_start: - lb $t1, buffer_input($t0) # Loading the byte - beq $t1, $zero, while_read_end - addi $t0, $t0, 1 # Incrementing counter - j while_read_start - while_read_end: - addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' - - addi $t0, $t0, 9 # Adding space for the type, the size and the null byte - li $v0, 9 - move $a0, $t0 - syscall - addi $t0, $t0, -9 # Adding space for the type, the size and the null byte - la $t2, type_String - sw $t2, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - - addi $t3, $v0, 8 # Pointer to the first character of the string - xor $t4, $t4, $t4 # Initializing counter - - while_copy_from_buffer_start: - beq $t4, $t0, while_copy_from_buffer_end - lb $t5, buffer_input($t4) # Loading the byte - sb $t5, 0($t3) # Storing the byte - addi $t3, $t3, 1 # Imcremeenting pointer - addi $t4, $t4, 1 # Incrementing counter - j while_copy_from_buffer_start - while_copy_from_buffer_end: - - sb $zero, 0($t3) # Storing the null byte - - sw $v0, 0($sp) # Storing the new object in internal_0 - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_in_int_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - li $v0, 5 - syscall - lw $t0, 0($sp) - sw $v0, 8($t0) - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function___init___at_String: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_length_at_String: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # internal_0 = length of self - lw $t0, 4($sp) - lw $t1, 4($t0) - addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator - lw $t0, 0($sp) - sw $t1, 8($t0) - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_concat_at_String: - # Function parameters - # $ra = 12($sp) - # self = 8($sp) - # s = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = self + s - lw $t0, 8($sp) - lw $t1, 4($sp) - lw $t2, 4($t0) # $t2 = length of str1 - lw $t3, 4($t1) # $t3 = length of str2 - addi $t2, $t2, -9 - addi $t3, $t3, -9 - add $t4, $t2, $t3 # $t4 = length of str1 + str2 - addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) - - li $v0, 9 - move $a0, $t4 - syscall - addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 - add $t5, $zero, $v0 # $t5 = address of the new string object - addi $t5, $t5, 8 # $t5 = address of the first byte of the new string - - la $t8, type_String - sw $t8, 0($v0) # Setting type in the first word of th object - - sw $a0, 4($v0) # Setting length of the string in the second word of the object - - # Copying str1 to the new string - xor $t6, $t6, $t6 # $t6 = 0 Initializing counter - while_copy_str1_start: - beq $t6, $t2, while_copy_str1_end - lb $t7, 8($t0) - sb $t7, 0($t5) - add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_str1_start - while_copy_str1_end: - - # Copying str2 to the new string - while_copy_str2_start: - beq $t6, $t4, while_copy_str2_end - lb $t7, 8($t1) - sb $t7, 0($t5) - add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_str2_start - while_copy_str2_end: - - sb $zero, 0($t5) # Setting the null-terminator - - sw $v0, 0($sp) # internal_0 = self + s - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_substr_at_String: - # Function parameters - # $ra = 16($sp) - # self = 12($sp) - # i = 8($sp) - # l = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = self[i:i + l] - lw $t0, 12($sp) # $t0 = address of the string - lw $t1, 4($t0) # $t1 = length of the string - addi $t1, $t1, -9 # $t1 = length of the string + 9 - lw $t2, 8($sp) # $t2 = start of the substring - lw $t2, 8($t2) - lw $t3, 4($sp) # $t3 = length of the substring - lw $t3, 8($t3) - add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring - - bgt $t4, $t1, substring_out_of_bounds - - addi $t3, $t3, 9 - li $v0, 9 - move $a0, $t3 - syscall - addi $t3, $t3, -9 - - la $t5, type_String - sw $t5, 0($v0) # Setting type in the first word of the object - - sw $a0, 4($v0) # Setting length in the second word of the object - - addi $t0, $t0, 8 # pointing to the first byte of the string - add $t0, $t0, $t2 # pointing to the first byte of the substring - move $t5, $v0 # $t5 = address of the new string - add $t5, $t5, 8 # pointing to the first byte of the string - xor $t6, $t6, $t6 # $t6 = 0 Initializing counter - while_copy_substr_start: - beq $t6, $t3, while_copy_substr_end - lb $t7, 0($t0) - sb $t7, 0($t5) - addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_substr_start - while_copy_substr_end: - - sb $zero, 0($t5) # Setting the null-terminator - - sw $v0, 0($sp) # internal_0 = self[i:i + l] - j substring_not_out_of_bounds - - substring_out_of_bounds: - li $v0, 17 - addi $a0, $zero, 1 - syscall - - substring_not_out_of_bounds: - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function___init___at_Main: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_main_at_Main: - # Function parameters - # $ra = 64($sp) - # self = 60($sp) - - # Reserving space for local variables - addi $sp, $sp, -60 - - # Allocating Complex - li $v0, 9 - lw $a0, type_Complex - syscall - la $t0, type_Complex # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 52($sp) # internal_1 = address of allocated object Complex - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_1 - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function___init___at_Complex - jal function___init___at_Complex - lw $ra, 4($sp) - sw $v1, 60($sp) # internal_1 = result of function___init___at_Complex - addi $sp, $sp, 8 # Freeing space for arguments - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_2 = address of allocated object Int - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_3 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address - - # Argument internal_1 - lw $t0, 68($sp) - sw $t0, 8($sp) # Storing internal_1 - - # Argument internal_2 - lw $t0, 64($sp) - sw $t0, 4($sp) # Storing internal_2 - - # Argument internal_3 - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing internal_3 - - # Calling function function_init_at_Complex - jal function_init_at_Complex - lw $ra, 12($sp) - sw $v1, 56($sp) # internal_4 = result of function_init_at_Complex - addi $sp, $sp, 16 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument c - lw $t0, 68($sp) - sw $t0, 4($sp) # Storing c - - # Argument internal_4 - lw $t0, 52($sp) - sw $t0, 0($sp) # Storing internal_4 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 68($sp) # c = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_6 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument c - lw $t0, 64($sp) - sw $t0, 0($sp) # Storing c - - # Calling function function_reflect_X_at_Complex - jal function_reflect_X_at_Complex - lw $ra, 4($sp) - sw $v1, 36($sp) # internal_7 = result of function_reflect_X_at_Complex - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_7 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_7 - - # Calling function function_reflect_Y_at_Complex - jal function_reflect_Y_at_Complex - lw $ra, 4($sp) - sw $v1, 32($sp) # internal_8 = result of function_reflect_Y_at_Complex - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument c - lw $t0, 64($sp) - sw $t0, 0($sp) # Storing c - - # Calling function function_reflect_0_at_Complex - jal function_reflect_0_at_Complex - lw $ra, 4($sp) - sw $v1, 28($sp) # internal_9 = result of function_reflect_0_at_Complex - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_8 - lw $t0, 36($sp) - sw $t0, 4($sp) # Storing internal_8 - - # Argument internal_9 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_9 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 28($sp) # internal_10 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_6 = internal_10 - lw $t0, 16($sp) - sw $t0, 32($sp) - - # If internal_6 then goto then_8741814694660 - lw $t0, 32($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8741814694660 - - # Jumping to else_8741814694660 - j else_8741814694660 - - then_8741814694660: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 12 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 12 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 61 - sb $t0, 8($v0) # internal_11[0] = '=' - - addi $t0, $zero, 41 - sb $t0, 9($v0) # internal_11[1] = ')' - - addi $t0, $zero, 10 - sb $t0, 10($v0) # internal_11[2] = '\n' - - sb $zero, 11($v0) # Null-terminator at the end of the string - - sw $v0, 12($sp) # internal_11 = "=)\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 72($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_11 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_11 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_12 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_5 = internal_12 - lw $t0, 8($sp) - sw $t0, 36($sp) - - # Jumping to endif_8741814694660 - j endif_8741814694660 - - else_8741814694660: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 12 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 12 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 61 - sb $t0, 8($v0) # internal_13[0] = '=' - - addi $t0, $zero, 40 - sb $t0, 9($v0) # internal_13[1] = '(' - - addi $t0, $zero, 10 - sb $t0, 10($v0) # internal_13[2] = '\n' - - sb $zero, 11($v0) # Null-terminator at the end of the string - - sw $v0, 4($sp) # internal_13 = "=(\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 72($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_13 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_13 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_14 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_5 = internal_14 - lw $t0, 0($sp) - sw $t0, 36($sp) - - # Jumping to endif_8741814694660 - j endif_8741814694660 - - endif_8741814694660: - - # Loading return value in $v1 - lw $v1, 36($sp) - - # Freeing space for local variables - addi $sp, $sp, 60 - - jr $ra - - function___init___at_Complex: - # Function parameters - # $ra = 12($sp) - # self = 8($sp) - - # Reserving space for local variables - addi $sp, $sp, -8 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_0 = address of allocated object Int - - # Set attribute x of self - lw $t0, 8($sp) # $t0 = self - lw $t1, 4($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8741814676447 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8741814676447 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8741814676447 - j object_set_attribute_8741814676447 - int_set_attribute_8741814676447: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.x = internal_0 - j end_set_attribute_8741814676447 - bool_set_attribute_8741814676447: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.x = internal_0 - j end_set_attribute_8741814676447 - object_set_attribute_8741814676447: - sw $t1, 8($t0) # self.x = internal_0 - end_set_attribute_8741814676447: - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_1 = address of allocated object Int - - # Set attribute y of self - lw $t0, 8($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_1 - beq $t1, $zero, object_set_attribute_8741814676468 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8741814676468 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8741814676468 - j object_set_attribute_8741814676468 - int_set_attribute_8741814676468: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.y = internal_1 - j end_set_attribute_8741814676468 - bool_set_attribute_8741814676468: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.y = internal_1 - j end_set_attribute_8741814676468 - object_set_attribute_8741814676468: - sw $t1, 12($t0) # self.y = internal_1 - end_set_attribute_8741814676468: - - # Loading return value in $v1 - lw $v1, 8($sp) - - # Freeing space for local variables - addi $sp, $sp, 8 - - jr $ra - - function_init_at_Complex: - # Function parameters - # $ra = 28($sp) - # self = 24($sp) - # a = 20($sp) - # b = 16($sp) - - # Reserving space for local variables - addi $sp, $sp, -16 - - # Get attribute x of self - lw $t0, 24($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'x' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8741814677815 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8741814677815 - j object_get_attribute_8741814677815 - int_get_attribute_8741814677815: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($sp) # internal_0 = self.x - j end_get_attribute_8741814677815 - bool_get_attribute_8741814677815: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($sp) # internal_0 = self.x - j end_get_attribute_8741814677815 - object_get_attribute_8741814677815: - sw $t1, 12($sp) # internal_0 = x - end_get_attribute_8741814677815: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_0 - lw $t0, 24($sp) - sw $t0, 4($sp) # Storing internal_0 - - # Argument a - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing a - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_1 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # Get attribute y of self - lw $t0, 24($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'y' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8741814677854 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8741814677854 - j object_get_attribute_8741814677854 - int_get_attribute_8741814677854: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 4($sp) # internal_2 = self.y - j end_get_attribute_8741814677854 - bool_get_attribute_8741814677854: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 4($sp) # internal_2 = self.y - j end_get_attribute_8741814677854 - object_get_attribute_8741814677854: - sw $t1, 4($sp) # internal_2 = y - end_get_attribute_8741814677854: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_2 - - # Argument b - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing b - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 24($sp) - - # Freeing space for local variables - addi $sp, $sp, 16 - - jr $ra - - function_print_at_Complex: - # Function parameters - # $ra = 64($sp) - # self = 60($sp) - - # Reserving space for local variables - addi $sp, $sp, -60 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 52($sp) # internal_1 = address of allocated object Int - - # Get attribute y of self - lw $t0, 60($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'y' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8741814677932 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8741814677932 - j object_get_attribute_8741814677932 - int_get_attribute_8741814677932: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 48($sp) # internal_2 = self.y - j end_get_attribute_8741814677932 - bool_get_attribute_8741814677932: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 48($sp) # internal_2 = self.y - j end_get_attribute_8741814677932 - object_get_attribute_8741814677932: - sw $t1, 48($sp) # internal_2 = y - end_get_attribute_8741814677932: - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_3 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_2 - lw $t0, 60($sp) - sw $t0, 4($sp) # Storing internal_2 - - # Argument internal_3 - lw $t0, 56($sp) - sw $t0, 0($sp) # Storing internal_3 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 52($sp) # internal_4 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_1 = internal_4 - lw $t0, 40($sp) - sw $t0, 52($sp) - - # If internal_1 then goto then_8741814694807 - lw $t0, 52($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8741814694807 - - # Jumping to else_8741814694807 - j else_8741814694807 - - then_8741814694807: - - # Get attribute x of self - lw $t0, 60($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'x' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8741814678013 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8741814678013 - j object_get_attribute_8741814678013 - int_get_attribute_8741814678013: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 36($sp) # internal_5 = self.x - j end_get_attribute_8741814678013 - bool_get_attribute_8741814678013: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 36($sp) # internal_5 = self.x - j end_get_attribute_8741814678013 - object_get_attribute_8741814678013: - sw $t1, 36($sp) # internal_5 = x - end_get_attribute_8741814678013: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 72($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_5 - lw $t0, 48($sp) - sw $t0, 0($sp) # Storing internal_5 - - # Calling function function_out_int_at_IO - jal function_out_int_at_IO - lw $ra, 8($sp) - sw $v1, 44($sp) # internal_6 = result of function_out_int_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_0 = internal_6 - lw $t0, 32($sp) - sw $t0, 56($sp) - - # Jumping to endif_8741814694807 - j endif_8741814694807 - - else_8741814694807: - - # Get attribute x of self - lw $t0, 60($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'x' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8741814676574 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8741814676574 - j object_get_attribute_8741814676574 - int_get_attribute_8741814676574: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 28($sp) # internal_7 = self.x - j end_get_attribute_8741814676574 - bool_get_attribute_8741814676574: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 28($sp) # internal_7 = self.x - j end_get_attribute_8741814676574 - object_get_attribute_8741814676574: - sw $t1, 28($sp) # internal_7 = x - end_get_attribute_8741814676574: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 72($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_7 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_7 - - # Calling function function_out_int_at_IO - jal function_out_int_at_IO - lw $ra, 8($sp) - sw $v1, 36($sp) # internal_8 = result of function_out_int_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 43 - sb $t0, 8($v0) # internal_9[0] = '+' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 20($sp) # internal_9 = "+" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_8 - lw $t0, 36($sp) - sw $t0, 4($sp) # Storing internal_8 - - # Argument internal_9 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_9 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 28($sp) # internal_10 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Get attribute y of self - lw $t0, 60($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'y' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8741814676622 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8741814676622 - j object_get_attribute_8741814676622 - int_get_attribute_8741814676622: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($sp) # internal_11 = self.y - j end_get_attribute_8741814676622 - bool_get_attribute_8741814676622: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($sp) # internal_11 = self.y - j end_get_attribute_8741814676622 - object_get_attribute_8741814676622: - sw $t1, 12($sp) # internal_11 = y - end_get_attribute_8741814676622: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_10 - lw $t0, 28($sp) - sw $t0, 4($sp) # Storing internal_10 - - # Argument internal_11 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_11 - - # Calling function function_out_int_at_IO - jal function_out_int_at_IO - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_12 = result of function_out_int_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 73 - sb $t0, 8($v0) # internal_13[0] = 'I' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 4($sp) # internal_13 = "I" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_12 - lw $t0, 20($sp) - sw $t0, 4($sp) # Storing internal_12 - - # Argument internal_13 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_13 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_14 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_0 = internal_14 - lw $t0, 0($sp) - sw $t0, 56($sp) - - # Jumping to endif_8741814694807 - j endif_8741814694807 - - endif_8741814694807: - - # Loading return value in $v1 - lw $v1, 56($sp) - - # Freeing space for local variables - addi $sp, $sp, 60 - - jr $ra - - function_reflect_0_at_Complex: - # Function parameters - # $ra = 52($sp) - # self = 48($sp) - - # Reserving space for local variables - addi $sp, $sp, -48 - - # Get attribute x of self - lw $t0, 48($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'x' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8741814676721 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8741814676721 - j object_get_attribute_8741814676721 - int_get_attribute_8741814676721: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 44($sp) # internal_0 = self.x - j end_get_attribute_8741814676721 - bool_get_attribute_8741814676721: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 44($sp) # internal_0 = self.x - j end_get_attribute_8741814676721 - object_get_attribute_8741814676721: - sw $t1, 44($sp) # internal_0 = x - end_get_attribute_8741814676721: - - # Get attribute x of self - lw $t0, 48($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'x' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8741814678541 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8741814678541 - j object_get_attribute_8741814678541 - int_get_attribute_8741814678541: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 40($sp) # internal_1 = self.x - j end_get_attribute_8741814678541 - bool_get_attribute_8741814678541: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 40($sp) # internal_1 = self.x - j end_get_attribute_8741814678541 - object_get_attribute_8741814678541: - sw $t1, 40($sp) # internal_1 = x - end_get_attribute_8741814678541: - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_2 = address of allocated object Int - - # Allocating Int 4294967295 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 4294967295 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_3 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_4 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_1 - lw $t0, 52($sp) - sw $t0, 4($sp) # Storing internal_1 - - # Argument internal_3 - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_3 - - # Calling function function_xor - jal function_xor - lw $ra, 8($sp) - sw $v1, 40($sp) # internal_4 = result of function_xor - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_4 - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing internal_4 - - # Argument internal_2 - lw $t0, 48($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 40($sp) # internal_4 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_0 - lw $t0, 56($sp) - sw $t0, 4($sp) # Storing internal_0 - - # Argument internal_4 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_4 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 36($sp) # internal_5 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # Get attribute y of self - lw $t0, 48($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'y' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8741814678640 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8741814678640 - j object_get_attribute_8741814678640 - int_get_attribute_8741814678640: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 20($sp) # internal_6 = self.y - j end_get_attribute_8741814678640 - bool_get_attribute_8741814678640: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 20($sp) # internal_6 = self.y - j end_get_attribute_8741814678640 - object_get_attribute_8741814678640: - sw $t1, 20($sp) # internal_6 = y - end_get_attribute_8741814678640: - - # Get attribute y of self - lw $t0, 48($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'y' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8741814678664 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8741814678664 - j object_get_attribute_8741814678664 - int_get_attribute_8741814678664: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 16($sp) # internal_7 = self.y - j end_get_attribute_8741814678664 - bool_get_attribute_8741814678664: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 16($sp) # internal_7 = self.y - j end_get_attribute_8741814678664 - object_get_attribute_8741814678664: - sw $t1, 16($sp) # internal_7 = y - end_get_attribute_8741814678664: - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_8 = address of allocated object Int - - # Allocating Int 4294967295 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 4294967295 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_9 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_10 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_7 - lw $t0, 28($sp) - sw $t0, 4($sp) # Storing internal_7 - - # Argument internal_9 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_9 - - # Calling function function_xor - jal function_xor - lw $ra, 8($sp) - sw $v1, 16($sp) # internal_10 = result of function_xor - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_10 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_10 - - # Argument internal_8 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_8 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 16($sp) # internal_10 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_6 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_6 - - # Argument internal_10 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_10 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_11 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 48($sp) - - # Freeing space for local variables - addi $sp, $sp, 48 - - jr $ra - - function_reflect_X_at_Complex: - # Function parameters - # $ra = 28($sp) - # self = 24($sp) - - # Reserving space for local variables - addi $sp, $sp, -24 - - # Get attribute y of self - lw $t0, 24($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'y' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8741814678781 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8741814678781 - j object_get_attribute_8741814678781 - int_get_attribute_8741814678781: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 20($sp) # internal_0 = self.y - j end_get_attribute_8741814678781 - bool_get_attribute_8741814678781: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 20($sp) # internal_0 = self.y - j end_get_attribute_8741814678781 - object_get_attribute_8741814678781: - sw $t1, 20($sp) # internal_0 = y - end_get_attribute_8741814678781: - - # Get attribute y of self - lw $t0, 24($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'y' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8741814679321 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8741814679321 - j object_get_attribute_8741814679321 - int_get_attribute_8741814679321: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 16($sp) # internal_1 = self.y - j end_get_attribute_8741814679321 - bool_get_attribute_8741814679321: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 16($sp) # internal_1 = self.y - j end_get_attribute_8741814679321 - object_get_attribute_8741814679321: - sw $t1, 16($sp) # internal_1 = y - end_get_attribute_8741814679321: - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_2 = address of allocated object Int - - # Allocating Int 4294967295 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 4294967295 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_3 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_4 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_1 - lw $t0, 28($sp) - sw $t0, 4($sp) # Storing internal_1 - - # Argument internal_3 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_3 - - # Calling function function_xor - jal function_xor - lw $ra, 8($sp) - sw $v1, 16($sp) # internal_4 = result of function_xor - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_4 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_4 - - # Argument internal_2 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 16($sp) # internal_4 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_0 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_0 - - # Argument internal_4 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_4 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_5 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 24($sp) - - # Freeing space for local variables - addi $sp, $sp, 24 - - jr $ra - - function_reflect_Y_at_Complex: - # Function parameters - # $ra = 28($sp) - # self = 24($sp) - - # Reserving space for local variables - addi $sp, $sp, -24 - - # Get attribute x of self - lw $t0, 24($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'x' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8741814679438 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8741814679438 - j object_get_attribute_8741814679438 - int_get_attribute_8741814679438: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 20($sp) # internal_0 = self.x - j end_get_attribute_8741814679438 - bool_get_attribute_8741814679438: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 20($sp) # internal_0 = self.x - j end_get_attribute_8741814679438 - object_get_attribute_8741814679438: - sw $t1, 20($sp) # internal_0 = x - end_get_attribute_8741814679438: - - # Get attribute x of self - lw $t0, 24($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'x' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8741814679462 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8741814679462 - j object_get_attribute_8741814679462 - int_get_attribute_8741814679462: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 16($sp) # internal_1 = self.x - j end_get_attribute_8741814679462 - bool_get_attribute_8741814679462: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 16($sp) # internal_1 = self.x - j end_get_attribute_8741814679462 - object_get_attribute_8741814679462: - sw $t1, 16($sp) # internal_1 = x - end_get_attribute_8741814679462: - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_2 = address of allocated object Int - - # Allocating Int 4294967295 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 4294967295 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_3 = address of allocated object Int - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_4 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_1 - lw $t0, 28($sp) - sw $t0, 4($sp) # Storing internal_1 - - # Argument internal_3 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_3 - - # Calling function function_xor - jal function_xor - lw $ra, 8($sp) - sw $v1, 16($sp) # internal_4 = result of function_xor - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_4 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_4 - - # Argument internal_2 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 16($sp) # internal_4 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_0 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_0 - - # Argument internal_4 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_4 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_5 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 24($sp) - - # Freeing space for local variables - addi $sp, $sp, 24 - - jr $ra - - main: - # Reserving space for local variables - addi $sp, $sp, -8 - - # Allocating Main - li $v0, 9 - lw $a0, type_Main - syscall - la $t0, type_Main # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object Main - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function___init___at_Main - jal function___init___at_Main - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_Main - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function_main_at_Main - jal function_main_at_Main - lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function_main_at_Main - addi $sp, $sp, 8 # Freeing space for arguments - - # Exit program - li $v0, 10 - syscall - - \ No newline at end of file diff --git a/src/complex.cil b/src/complex.cil deleted file mode 100644 index 87ca4da03..000000000 --- a/src/complex.cil +++ /dev/null @@ -1,674 +0,0 @@ -.TYPES -type Object { - inherits from null - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method __init__: function___init___at_Object -} -type IO { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method out_string: function_out_string_at_IO - method out_int: function_out_int_at_IO - method in_string: function_in_string_at_IO - method in_int: function_in_int_at_IO - method __init__: function___init___at_IO -} -type Int { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method __init__: function___init___at_Int -} -type String { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method length: function_length_at_String - method concat: function_concat_at_String - method substr: function_substr_at_String - method __init__: function___init___at_String -} -type Bool { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method __init__: function___init___at_Bool -} -type Main { - inherits from IO - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method out_string: function_out_string_at_IO - method out_int: function_out_int_at_IO - method in_string: function_in_string_at_IO - method in_int: function_in_int_at_IO - method main: function_main_at_Main - method __init__: function___init___at_Main -} -type Complex { - inherits from IO - - attribute x - attribute y - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method out_string: function_out_string_at_IO - method out_int: function_out_int_at_IO - method in_string: function_in_string_at_IO - method in_int: function_in_int_at_IO - method init: function_init_at_Complex - method print: function_print_at_Complex - method reflect_0: function_reflect_0_at_Complex - method reflect_X: function_reflect_X_at_Complex - method reflect_Y: function_reflect_Y_at_Complex - method __init__: function___init___at_Complex -} - -.DATA - - -.CODE -function function_add{ - PARAM a - PARAM b - - LOCAL internal_0 # Adding result - - internal_0 = ALLOCINT 0 - internal_0 = a + b - - RETURN internal_0 -} -function function_sub{ - PARAM a - PARAM b - - LOCAL internal_0 # Substracting result - - internal_0 = ALLOCINT 0 - internal_0 = a - b - - RETURN internal_0 -} -function function_mult{ - PARAM a - PARAM b - - LOCAL internal_0 # Multiting result - - internal_0 = ALLOCINT 0 - internal_0 = a * b - - RETURN internal_0 -} -function function_div{ - PARAM a - PARAM b - - LOCAL internal_0 # Dividing result - - internal_0 = ALLOCINT 0 - internal_0 = a / b - - RETURN internal_0 -} -function function_xor{ - PARAM a - PARAM b - - LOCAL internal_0 # Xor result - - internal_0 = ALLOCINT 0 - internal_0 = XOR a b - - RETURN internal_0 -} -function function_less_than{ - PARAM a - PARAM b - - LOCAL internal_0 # Less than result - - internal_0 = ALLOCBOOL 0 - internal_0 = a < b - - RETURN internal_0 -} -function function_less_than_or_equal{ - PARAM a - PARAM b - - LOCAL internal_0 # Less than or equal result - - internal_0 = ALLOCBOOL 0 - internal_0 = a <= b - - RETURN internal_0 -} -function function_equal{ - PARAM a - PARAM b - - LOCAL internal_0 # Equal result - LOCAL internal_1 # Null Pointer - LOCAL internal_2 # One of params is null - LOCAL internal_3 # Type of a - LOCAL internal_4 # Type Int - LOCAL internal_5 # Type Bool - LOCAL internal_6 # Type String - LOCAL internal_7 # Type of a equals int - LOCAL internal_8 # Type of a equals bool - LOCAL internal_9 # Type of a equals string - - internal_0 = ALLOCBOOL 0 - internal_1 = ALLOCNULL - internal_2 = ALLOCBOOL 0 - internal_2 = EQUALADDR a internal_1 - internal_2 = EQUALADDR b internal_1 - IF internal_2 GOTO a_is_type_object - internal_3 = TYPEOF a - internal_4 = TYPEADDR Int - internal_5 = TYPEADDR Bool - internal_6 = TYPEADDR String - internal_7 = ALLOCBOOL 0 - internal_8 = ALLOCBOOL 0 - internal_9 = ALLOCBOOL 0 - internal_7 = EQUALADDR internal_3 internal_4 - internal_8 = EQUALADDR internal_3 internal_5 - internal_9 = EQUALADDR internal_3 internal_6 - - IF internal_7 GOTO a_is_type_int_or_bool - IF internal_8 GOTO a_is_type_int_or_bool - IF internal_9 GOTO a_is_type_string - GOTO a_is_type_object - - a_is_type_int_or_bool: - internal_0 = EQUALINT a b - GOTO end_of_equal - - a_is_type_string: - internal_0 = EQUALSTR a b - GOTO end_of_equal - - a_is_type_object: - internal_0 = a == b - GOTO end_of_equal - - end_of_equal: - - RETURN internal_0 -} -function function_assign{ - PARAM dest - PARAM source - - LOCAL internal_0 # Null Pointer - LOCAL internal_1 # One of params is null - LOCAL internal_2 # Type of source - LOCAL internal_3 # Type Int - LOCAL internal_4 # Type Bool - LOCAL internal_5 # Type of source equals int - LOCAL internal_6 # Type of source equals bool - - internal_0 = ALLOCNULL - internal_1 = ALLOCBOOL 0 - internal_1 = EQUALADDR source internal_0 - internal_1 = EQUALADDR dest internal_0 - IF internal_1 GOTO source_is_type_object - internal_2 = TYPEOF source - internal_3 = TYPEADDR Int - internal_4 = TYPEADDR Bool - internal_5 = ALLOCBOOL 0 - internal_6 = ALLOCBOOL 0 - internal_5 = EQUALADDR internal_2 internal_3 - internal_6 = EQUALADDR internal_2 internal_4 - - IF internal_5 GOTO source_is_type_int_or_bool - IF internal_6 GOTO source_is_type_int_or_bool - GOTO source_is_type_object - - source_is_type_int_or_bool: - dest = INT source - GOTO source_end_of_equal - - source_is_type_object: - dest = source - GOTO source_end_of_equal - - source_end_of_equal: - - RETURN dest -} -function function___init___at_Object{ - PARAM self - - RETURN self -} -function function_abort_at_Object{ - PARAM self - - LOCAL internal_0 - LOCAL internal_1 - LOCAL internal_2 - LOCAL internal_3 - - internal_0 = ALLOCSTR "Abort called from class " - internal_2 = ALLOCSTR "\n" - ARG self - internal_1 = VCALL String function_type_name_at_Object - ARG internal_0 - ARG internal_1 - internal_3 = VCALL String function_concat_at_String - ARG internal_3 - ARG internal_2 - internal_3 = VCALL String function_concat_at_String - PRINTSTR internal_3 - HALT - - RETURN self -} -function function_type_name_at_Object{ - PARAM self - - LOCAL internal_0 # type_name - - internal_0 = TYPENAME self - - RETURN internal_0 -} -function function_copy_at_Object{ - PARAM self - - LOCAL internal_0 - - internal_0 = COPY self - - RETURN internal_0 -} -function function___init___at_IO{ - PARAM self - - RETURN self -} -function function_out_string_at_IO{ - PARAM self - PARAM x - - PRINTSTR x - - RETURN self -} -function function_out_int_at_IO{ - PARAM self - PARAM x - - PRINTINT x - - RETURN self -} -function function_in_string_at_IO{ - PARAM self - - LOCAL internal_0 - - READSTR internal_0 - - RETURN internal_0 -} -function function_in_int_at_IO{ - PARAM self - - LOCAL internal_0 - - internal_0 = ALLOCINT 0 - READINT internal_0 - - RETURN internal_0 -} -function function___init___at_String{ - PARAM self - - RETURN self -} -function function_length_at_String{ - PARAM self - - LOCAL internal_0 - - internal_0 = ALLOCINT 0 - internal_0 = LENGTH self - - RETURN internal_0 -} -function function_concat_at_String{ - PARAM self - PARAM s - - LOCAL internal_0 - - internal_0 = CONCAT self s - - RETURN internal_0 -} -function function_substr_at_String{ - PARAM self - PARAM i - PARAM l - - LOCAL internal_0 - - internal_0 = SUBSTRING self i l - - RETURN internal_0 -} -function function___init___at_Main{ - PARAM self - - RETURN self -} -function function_main_at_Main{ - PARAM self - - LOCAL c - LOCAL internal_1 # Store an instance of the class Complex - LOCAL internal_2 # Integer 1 - LOCAL internal_3 # Integer 1 - LOCAL internal_4 - LOCAL internal_5 - LOCAL internal_6 - LOCAL internal_7 - LOCAL internal_8 - LOCAL internal_9 - LOCAL internal_10 # Store the result of the operation function_equal - LOCAL internal_11 # String "=)\n" - LOCAL internal_12 - LOCAL internal_13 # String "=(\n" - LOCAL internal_14 - - # Let c: Complex - - internal_1 = ALLOCATE Complex # Allocate the object Complex - ARG internal_1 # Pass the instance to the constructor - internal_1 = VCALL Complex function___init___at_Complex # Call the constructor - internal_2 = ALLOCINT 1 - internal_3 = ALLOCINT 1 - ARG internal_1 - ARG internal_2 - ARG internal_3 - internal_4 = VCALL Complex function_init_at_Complex - ARG c - ARG internal_4 - c = CALL function_assign - # Conditional - internal_6 = ALLOCBOOL 0 - ARG c - internal_7 = VCALL Complex function_reflect_X_at_Complex - ARG internal_7 - internal_8 = VCALL Complex function_reflect_Y_at_Complex - ARG c - internal_9 = VCALL Complex function_reflect_0_at_Complex - - ARG internal_8 - ARG internal_9 - internal_10 = CALL function_equal - internal_6 = internal_10 - IF internal_6 GOTO then_8741814694660 - GOTO else_8741814694660 - - then_8741814694660: - internal_11 = ALLOCSTR "=)\n" - ARG self - ARG internal_11 - internal_12 = VCALL Main function_out_string_at_IO - internal_5 = internal_12 - GOTO endif_8741814694660 - - else_8741814694660: - internal_13 = ALLOCSTR "=(\n" - ARG self - ARG internal_13 - internal_14 = VCALL Main function_out_string_at_IO - internal_5 = internal_14 - GOTO endif_8741814694660 - - endif_8741814694660: - - RETURN internal_5 -} -function function___init___at_Complex{ - PARAM self - - LOCAL internal_0 # Integer 0 - LOCAL internal_1 # Integer 0 - - internal_0 = ALLOCINT 0 - - SETATTR self x internal_0 - internal_1 = ALLOCINT 0 - - SETATTR self y internal_1 - - RETURN self -} -function function_init_at_Complex{ - PARAM self - PARAM a - PARAM b - - LOCAL internal_0 - LOCAL internal_1 # Store the result of the operation function_equal - LOCAL internal_2 - LOCAL internal_3 # Store the result of the operation function_equal - - internal_0 = GETATTR self x - - ARG internal_0 - ARG a - internal_1 = CALL function_equal - internal_2 = GETATTR self y - - ARG internal_2 - ARG b - internal_3 = CALL function_equal - - RETURN self -} -function function_print_at_Complex{ - PARAM self - - LOCAL internal_0 - LOCAL internal_1 - LOCAL internal_2 - LOCAL internal_3 # Integer 0 - LOCAL internal_4 # Store the result of the operation function_equal - LOCAL internal_5 - LOCAL internal_6 - LOCAL internal_7 - LOCAL internal_8 - LOCAL internal_9 # String "+" - LOCAL internal_10 - LOCAL internal_11 - LOCAL internal_12 - LOCAL internal_13 # String "I" - LOCAL internal_14 - - # Conditional - internal_1 = ALLOCBOOL 0 - internal_2 = GETATTR self y - internal_3 = ALLOCINT 0 - - ARG internal_2 - ARG internal_3 - internal_4 = CALL function_equal - internal_1 = internal_4 - IF internal_1 GOTO then_8741814694807 - GOTO else_8741814694807 - - then_8741814694807: - internal_5 = GETATTR self x - ARG self - ARG internal_5 - internal_6 = VCALL Complex function_out_int_at_IO - internal_0 = internal_6 - GOTO endif_8741814694807 - - else_8741814694807: - internal_7 = GETATTR self x - ARG self - ARG internal_7 - internal_8 = VCALL Complex function_out_int_at_IO - internal_9 = ALLOCSTR "+" - ARG internal_8 - ARG internal_9 - internal_10 = VCALL Complex function_out_string_at_IO - internal_11 = GETATTR self y - ARG internal_10 - ARG internal_11 - internal_12 = VCALL Complex function_out_int_at_IO - internal_13 = ALLOCSTR "I" - ARG internal_12 - ARG internal_13 - internal_14 = VCALL Complex function_out_string_at_IO - internal_0 = internal_14 - GOTO endif_8741814694807 - - endif_8741814694807: - - RETURN internal_0 -} -function function_reflect_0_at_Complex{ - PARAM self - - LOCAL internal_0 - LOCAL internal_1 - LOCAL internal_2 # Integer 1 - LOCAL internal_3 # Integer 4294967295 - LOCAL internal_4 # Store the complement a2 of internal_1 - LOCAL internal_5 # Store the result of the operation function_equal - LOCAL internal_6 - LOCAL internal_7 - LOCAL internal_8 # Integer 1 - LOCAL internal_9 # Integer 4294967295 - LOCAL internal_10 # Store the complement a2 of internal_7 - LOCAL internal_11 # Store the result of the operation function_equal - - internal_0 = GETATTR self x - internal_1 = GETATTR self x - internal_2 = ALLOCINT 1 - internal_3 = ALLOCINT 4294967295 - internal_4 = ALLOCINT 0 - ARG internal_1 - ARG internal_3 - internal_4 = CALL function_xor - ARG internal_4 - ARG internal_2 - internal_4 = CALL function_add - - ARG internal_0 - ARG internal_4 - internal_5 = CALL function_equal - internal_6 = GETATTR self y - internal_7 = GETATTR self y - internal_8 = ALLOCINT 1 - internal_9 = ALLOCINT 4294967295 - internal_10 = ALLOCINT 0 - ARG internal_7 - ARG internal_9 - internal_10 = CALL function_xor - ARG internal_10 - ARG internal_8 - internal_10 = CALL function_add - - ARG internal_6 - ARG internal_10 - internal_11 = CALL function_equal - - RETURN self -} -function function_reflect_X_at_Complex{ - PARAM self - - LOCAL internal_0 - LOCAL internal_1 - LOCAL internal_2 # Integer 1 - LOCAL internal_3 # Integer 4294967295 - LOCAL internal_4 # Store the complement a2 of internal_1 - LOCAL internal_5 # Store the result of the operation function_equal - - internal_0 = GETATTR self y - internal_1 = GETATTR self y - internal_2 = ALLOCINT 1 - internal_3 = ALLOCINT 4294967295 - internal_4 = ALLOCINT 0 - ARG internal_1 - ARG internal_3 - internal_4 = CALL function_xor - ARG internal_4 - ARG internal_2 - internal_4 = CALL function_add - - ARG internal_0 - ARG internal_4 - internal_5 = CALL function_equal - - RETURN self -} -function function_reflect_Y_at_Complex{ - PARAM self - - LOCAL internal_0 - LOCAL internal_1 - LOCAL internal_2 # Integer 1 - LOCAL internal_3 # Integer 4294967295 - LOCAL internal_4 # Store the complement a2 of internal_1 - LOCAL internal_5 # Store the result of the operation function_equal - - internal_0 = GETATTR self x - internal_1 = GETATTR self x - internal_2 = ALLOCINT 1 - internal_3 = ALLOCINT 4294967295 - internal_4 = ALLOCINT 0 - ARG internal_1 - ARG internal_3 - internal_4 = CALL function_xor - ARG internal_4 - ARG internal_2 - internal_4 = CALL function_add - - ARG internal_0 - ARG internal_4 - internal_5 = CALL function_equal - - RETURN self -} -function main{ - - - LOCAL internal_0 - LOCAL internal_1 - - internal_0 = ALLOCATE Main - ARG internal_0 - internal_0 = VCALL Main function___init___at_Main - - ARG internal_0 - internal_1 = VCALL Main function_main_at_Main - - HALT -} \ No newline at end of file diff --git a/src/complex.cl b/src/complex.cl deleted file mode 100755 index 9edb6151d..000000000 --- a/src/complex.cl +++ /dev/null @@ -1,52 +0,0 @@ -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/src/cool/code_generation/ast_cil.py b/src/cool/code_generation/ast_cil.py index e8b4a2751..858c135d4 100644 --- a/src/cool/code_generation/ast_cil.py +++ b/src/cool/code_generation/ast_cil.py @@ -109,7 +109,6 @@ class LessThanNode(ArithmeticNode): class EqualNode(ArithmeticNode): - equality_type: str = "Object" pass @@ -117,6 +116,14 @@ class XorNode(ArithmeticNode): pass +class GetMethodNode(InstructionNode): + def __init__(self, dest: str, instance: str, method_index: str, method_name: str, type: str) -> None: + self.dest: str = dest + self.instance: str = instance + self.method_index: str = method_index + self.method_name: str = method_name + self.type: str = type + class GetAttributeNode(InstructionNode): def __init__(self, dest: str, instance: str, attr: str, attr_index: int) -> None: self.dest: str = dest @@ -125,6 +132,7 @@ def __init__(self, dest: str, instance: str, attr: str, attr_index: int) -> None self.attr_index: int = attr_index + class SetAttributeNode(InstructionNode): def __init__(self, instance: str, attr: str, source: str, attr_index: int) -> None: self.instance: str = instance @@ -256,9 +264,9 @@ def __init__(self, function: str, dest: str, total_args: int): class DynamicCallNode(InstructionNode): - def __init__(self, xtype: str, method: str, dest: str, total_args: int): + def __init__(self, xtype: str, method_address: str, dest: str, total_args: int): self.type = xtype - self.method = method + self.method_address = method_address self.dest = dest self.total_args = total_args @@ -373,6 +381,6 @@ def __init__(self): pass -class AssertTypeNode(InstructionNode): +class PrintTypeNameNode(InstructionNode): def __init__(self, address: str): self.address: str = address \ No newline at end of file diff --git a/src/cool/code_generation/formatters.py b/src/cool/code_generation/formatters.py index 2a81b85fa..e70c3be73 100644 --- a/src/cool/code_generation/formatters.py +++ b/src/cool/code_generation/formatters.py @@ -211,11 +211,15 @@ def visit(self, node: cil.StaticCallNode): @visitor.when(cil.DynamicCallNode) def visit(self, node: cil.DynamicCallNode): return ( - f"{node.dest} = VCALL {node.type} {node.method}" + f"{node.dest} = VCALL {node.type} {node.method_address}" if node.comment == "" - else f"{node.dest} = VCALL {node.type} {node.method} # {node.comment}" + else f"{node.dest} = VCALL {node.type} {node.method_address} # {node.comment}" ) + @visitor.when(cil.GetMethodNode) + def visit(self, node: cil.GetMethodNode): + return f"{node.dest} = GETMETHOD {node.instance} {node.method_index} # {node.method_name}" + @visitor.when(cil.GetAttributeNode) def visit(self, node: cil.GetAttributeNode): return ( @@ -405,8 +409,8 @@ def visit(self, node: cil.AllocateNullPtrNode): return (f"{node.dest} = ALLOCNULL") if node.comment == "" else f"{node.dest} = ALLOCNULL # {node.comment}" - @visitor.when(cil.AssertTypeNode) - def visit(self, node: cil.AssertTypeNode): + @visitor.when(cil.PrintTypeNameNode) + def visit(self, node: cil.PrintTypeNameNode): return f"ASSERT {node.address}" diff --git a/src/cool/code_generation/translator_cil_to_mips.py b/src/cool/code_generation/translator_cil_to_mips.py index 1ad574aef..44aa98ae4 100644 --- a/src/cool/code_generation/translator_cil_to_mips.py +++ b/src/cool/code_generation/translator_cil_to_mips.py @@ -76,8 +76,13 @@ def visit(self, node: cil.ProgramNode): for type_node in node.dottypes: self.visit(type_node) + for type_node in node.dottypes: + self.register_word(self.to_data_type("name_size", type_node.name), str(len(type_node.name))) + self.register_asciiz(self.to_data_type("name", type_node.name), f'"{type_node.name}"') + self.register_empty_data() + self.register_space("buffer_input", 1024) - self.register_asciiz("debug_log", "\"debug_log\\n\"") + self.register_asciiz("debug_log", '"debug_log\\n"') for function_node in node.dotcode: self.visit(function_node) @@ -86,14 +91,13 @@ def visit(self, node: cil.ProgramNode): @visitor.when(cil.TypeNode) def visit(self, node: cil.TypeNode): - size = 4 * (2 + len(node.attributes)) + size = 4 * (2 + len(node.attributes) + len(node.methods)) self.register_word(f"type_{node.name}", str(size)) - self.register_word(self.to_data_type("inherits_from", node.name),f"type_{node.parent}" if node.parent != "null" else "0") - self.register_word(self.to_data_type("attributes", node.name), str(len(node.attributes))) - self.register_word(self.to_data_type("name_size", node.name), str(len(node.name))) - self.register_asciiz(self.to_data_type("name", node.name), f'"{node.name}"') - + self.register_word(self.to_data_type("inherits_from", node.name), f"type_{node.parent}" if node.parent != "null" else "0") + self.register_word(self.to_data_type("name_address", node.name), f"type_{node.name}_name_size") + for method, function in node.methods: + self.register_word(self.to_data_type(method, node.name), function) self.register_empty_data() @visitor.when(cil.FunctionNode) @@ -172,10 +176,11 @@ def visit(self, node: cil.ArgNode): @visitor.when(cil.DynamicCallNode) def visit(self, node: cil.DynamicCallNode): - self.register_comment(f"Calling function {node.method}") - self.register_instruction(mips.JumpAndLinkNode(node.method)) + self.register_comment(f"Calling function {node.method_address}") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.method_address) + 4 * node.total_args + 4}($sp)")) + self.register_instruction(mips.JumpAndLinkRegisterNode("$t0")) self.register_instruction(mips.LoadWordNode("$ra", f"{4 * node.total_args}($sp)")) - self.register_instruction(mips.StoreWordNode("$v1", f"{self.offset_of(node.dest) + 4 * node.total_args + 4}($sp)").set_comment(f"{node.dest} = result of {node.method}")) + self.register_instruction(mips.StoreWordNode("$v1", f"{self.offset_of(node.dest) + 4 * node.total_args + 4}($sp)").set_comment(f"{node.dest} = result of {node.method_address}")) self.register_instruction(mips.AddiNode("$sp", "$sp", f"{4 * node.total_args + 4}").set_comment("Freeing space for arguments")) @visitor.when(cil.StaticCallNode) @@ -398,7 +403,7 @@ def visit(self, node: cil.GetAttributeNode): node_id = hash(node) self.register_comment(f"Get attribute {node.attr} of {node.instance}") self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.instance)}($sp)").set_comment(f"Get the address of {node.instance}")) - self.register_instruction(mips.LoadWordNode("$t1", f"{4 * (node.attr_index + 2)}($t0)").set_comment(f"Get the attribute '{node.attr}' from the instance")) + self.register_instruction(mips.LoadWordNode("$t1", f"{4 * (node.attr_index + 2)}($t0)").set_comment(f"Get the attribute '{node.attr}' from the {node.instance}")) self.register_instruction(mips.LoadWordNode("$t2", "0($t1)")) self.register_instruction(mips.LoadAddressNode("$t3", "type_Int")) @@ -437,7 +442,7 @@ def visit(self, node: cil.GetAttributeNode): self.register_instruction(mips.JumpNode(f"end_get_attribute_{node_id}")) self.register_instruction(mips.LabelNode(f"object_get_attribute_{node_id}")) - self.register_instruction(mips.StoreWordNode("$t1",f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = {node.attr}")) + self.register_instruction(mips.StoreWordNode("$t1",f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = {node.instance}.{node.attr}")) self.register_instruction(mips.LabelNode(f"end_get_attribute_{node_id}")) @visitor.when(cil.SetAttributeNode) @@ -489,6 +494,19 @@ def visit(self, node: cil.SetAttributeNode): self.register_instruction(mips.StoreWordNode("$t1", f"{4 * (node.attr_index + 2)}($t0)").set_comment(f"{node.instance}.{node.attr} = {node.source}")) self.register_instruction(mips.LabelNode(f"end_set_attribute_{node_id}")) + @visitor.when(cil.GetMethodNode) + def visit(self, node: cil.GetMethodNode): + self.register_comment(f"Get method {node.method_name} of {node.type}") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.instance)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t0", "0($t0)")) + self.register_instruction(mips.AddiNode("$t0", "$t0", "12")) + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.method_index)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t1", f"8($t1)")) + self.register_instruction(mips.SllNode("$t1", "$t1", "2")) + self.register_instruction(mips.AddNode("$t0", "$t0", "$t1")) + self.register_instruction(mips.LoadWordNode("$t0", "0($t0)")) + self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)")) + @visitor.when(cil.ArrayNode) def visit(self, node: cil.ArrayNode): self.register_comment(f"initialize Array [{node.size}]") @@ -543,7 +561,6 @@ def visit(self, node: cil.GetValueInIndexNode): self.register_instruction(mips.LoadWordNode("$t2", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = array {node.instance}[4 * {node.index}]")) self.register_instruction(mips.StoreWordNode("$t0", "8($t2)")) - @visitor.when(cil.SetValueInIndexNode) def visit(self, node: cil.SetValueInIndexNode): self.register_comment(f"array {node.instance}[4 * {node.index}] = {node.source}") @@ -579,69 +596,14 @@ def visit(self, node: cil.TypeAddressNode): self.register_instruction(mips.LoadAddressNode("$t0", f"type_{node.name}")) self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)")) - @visitor.when(cil.EqualAddressNode) - def visit(self, node: cil.EqualAddressNode): - self.register_comment(f"{node.dest} = EqualAddress({node.left}, {node.right})") - self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.left)}($sp)")) - self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.right)}($sp)")) - self.register_instruction(mips.SeqNode("$t2", "$t0", "$t1")) - self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.dest)}($sp)")) - self.register_instruction(mips.StoreWordNode("$t2", f"8($t0)")) - - @visitor.when(cil.EqualIntNode) - def visit(self, node: cil.EqualIntNode): - self.register_comment(f"{node.dest} = EqualInt({node.left}, {node.right})") - self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.left)}($sp)")) - self.register_instruction(mips.LoadWordNode("$t0", f"8($t0)")) - self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.right)}($sp)")) - self.register_instruction(mips.LoadWordNode("$t1", f"8($t1)")) - self.register_instruction(mips.SeqNode("$t2", "$t0", "$t1")) - self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.dest)}($sp)")) - self.register_instruction(mips.StoreWordNode("$t2", f"8($t0)")) - - @visitor.when(cil.EqualStrNode) - def visit(self, node: cil.EqualStrNode): - self.register_comment(f"{node.dest} = EqualStr({node.left}, {node.right})") - self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.left)}($sp)")) - self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.right)}($sp)")) - self.register_instruction(mips.AddiNode("$t0", "$t0", "8")) - self.register_instruction(mips.AddiNode("$t1", "$t1", "8")) - - self.register_empty_instruction() - self.register_comment(f"By default we assume the strings are equals") - self.register_instruction(mips.AddiNode("$t4", "$zero", "1")) - self.register_instruction(mips.LoadWordNode("$t5", f"{self.offset_of(node.dest)}($sp)")) - self.register_instruction(mips.StoreWordNode("$t4", f"8($t5)")) - - self.register_empty_instruction() - self.register_instruction(mips.LabelNode("while_compare_strings_start")) - self.register_instruction(mips.LoadByteNode("$t2", "0($t0)")) - self.register_instruction(mips.LoadByteNode("$t3", "0($t1)")) - - self.register_instruction(mips.BeqNode("$t2", "$t3", "while_compare_strings_update")) - - self.register_empty_instruction() - self.register_comment(f"The strings are no equals") - self.register_instruction(mips.LoadWordNode("$t5", f"{self.offset_of(node.dest)}($sp)")) - self.register_instruction(mips.StoreWordNode("$zero", f"8($t5)")) - self.register_instruction(mips.JumpNode("while_compare_strings_end")) - - self.register_empty_instruction() - self.register_instruction(mips.LabelNode("while_compare_strings_update")) - self.register_instruction(mips.AddiNode("$t0", "$t0", "1")) - self.register_instruction(mips.AddiNode("$t1", "$t1", "1")) - self.register_instruction(mips.BeqNode("$t2", "$zero", "while_compare_strings_end")) - self.register_instruction(mips.BeqNode("$t3", "$zero", "while_compare_strings_end")) - self.register_instruction(mips.JumpNode("while_compare_strings_start")) - self.register_instruction(mips.LabelNode("while_compare_strings_end")) - @visitor.when(cil.TypeNameNode) def visit(self, node: cil.TypeNameNode): self.register_comment(f"{node.dest} = name of {node.source}") self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.source)}($sp)").set_comment(f"$t0 = {node.source}")) self.register_instruction(mips.LoadWordNode("$t1", "0($t0)").set_comment(f"$t1 = type of {node.source}")) - self.register_instruction(mips.LoadWordNode("$t2", "12($t1)").set_comment(f"$t1 = length of the name of {node.source}")) - self.register_instruction(mips.LoadAddressNode("$t3", "16($t1)").set_comment(f"$t1 = name of {node.source}")) + self.register_instruction(mips.LoadWordNode("$t2", "8($t1)").set_comment(f"$t2 = direction of the type name")) + self.register_instruction(mips.LoadAddressNode("$t3", "4($t2)").set_comment(f"$t3 = address of the name")) + self.register_instruction(mips.LoadWordNode("$t2", "0($t2)").set_comment(f"$t2 = length of the name")) self.register_empty_instruction() self.register_instruction(mips.AddiNode("$t2", "$t2", "9").set_comment(f"Setting space for the type, the size and the null byte")) @@ -714,19 +676,31 @@ def visit(self, node: cil.PrintStringNode): self.register_instruction(mips.AddiNode("$t0", "$t0", "8").set_comment("Pointer to the first character of the string")) self.register_empty_instruction() - self.register_comment(f"Printing the string {node.str_addr}") + self.register_comment(f"Printing the String {node.str_addr}") self.register_instruction(mips.LoadInmediateNode("$v0", "4")) self.register_instruction(mips.MoveNode("$a0", "$t0")) self.register_instruction(mips.SystemCallNode()) @visitor.when(cil.PrintIntNode) def visit(self, node: cil.PrintIntNode): - self.register_comment(f"Printing the string {node.source}") + self.register_comment(f"Printing the Int {node.source}") self.register_instruction(mips.LoadInmediateNode("$v0", "1")) self.register_instruction(mips.LoadWordNode("$a0", f"{self.offset_of(node.source)}($sp)")) self.register_instruction(mips.LoadWordNode("$a0", "8($a0)")) self.register_instruction(mips.SystemCallNode()) + @visitor.when(cil.PrintTypeNameNode) + def visit(self, node: cil.PrintTypeNameNode): + self.register_comment("Printing the type name") + self.register_empty_instruction() + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.address)}($sp)")) + self.register_instruction(mips.AddiNode("$t0", "$t0", "12")) + self.register_instruction(mips.LoadWordNode("$t0", "0($t0)")) + self.register_instruction(mips.AddiNode("$t0", "$t0", "4")) + self.register_instruction(mips.LoadInmediateNode("$v0", "4")) + self.register_instruction(mips.MoveNode("$a0", "$t0")) + self.register_instruction(mips.SystemCallNode()) + @visitor.when(cil.ReadStringNode) def visit(self, node: cil.ReadStringNode): self.register_instruction(mips.LoadInmediateNode("$v0", "8")) @@ -734,17 +708,31 @@ def visit(self, node: cil.ReadStringNode): self.register_instruction(mips.LoadInmediateNode("$a1", "1024")) self.register_instruction(mips.SystemCallNode()) + self.register_empty_instruction() self.register_instruction(mips.XorNode("$t0", "$t0", "$t0").set_comment("Initializing counter")) self.register_instruction(mips.LabelNode("while_read_start")) self.register_instruction(mips.LoadByteNode("$t1", "buffer_input($t0)").set_comment("Loading the byte")) - self.register_instruction(mips.BeqNode("$t1", "$zero", "while_read_end")) + + # self.register_instruction(mips.LoadInmediateNode("$v0", "1")) + # self.register_instruction(mips.MoveNode("$a0", "$t1")) + # self.register_instruction(mips.SystemCallNode()) + + # self.register_instruction(mips.LoadInmediateNode("$v0", "1")) + # self.register_instruction(mips.LoadInmediateNode("$a0", "0")) + # self.register_instruction(mips.SystemCallNode()) + + self.register_instruction(mips.AddiNode("$t2", "$zero", "10")) + self.register_instruction(mips.BeqNode("$t1", "$t2", "while_read_end")) + self.register_instruction(mips.AddiNode("$t2", "$zero", "13")) + self.register_instruction(mips.BeqNode("$t1", "$t2", "while_read_end")) self.register_instruction(mips.AddiNode("$t0", "$t0", "1").set_comment("Incrementing counter")) self.register_instruction(mips.JumpNode("while_read_start")) self.register_instruction(mips.LabelNode("while_read_end")) - self.register_instruction(mips.AddiNode("$t0", "$t0", "-1").set_comment("Decrementing counter to eliminate the '\\n'")) - + # self.register_instruction(mips.LoadInmediateNode("$v0", "1")) + # self.register_instruction(mips.MoveNode("$a0", "$t0")) + # self.register_instruction(mips.SystemCallNode()) self.register_empty_instruction() self.register_instruction(mips.AddiNode("$t0", "$t0", "9").set_comment("Adding space for the type, the size and the null byte")) self.register_instantiation("$t0") @@ -823,7 +811,7 @@ def visit(self, node: cil.DivNode): self.register_instruction(mips.DivNode("$t0", "$t1").set_comment("$t2 = $t0 / $t1")) self.register_instruction(mips.MoveFromLowNode("$t2")) self.postprocess_binary_int_operation(node, "Int") - + @visitor.when(cil.XorNode) def visit(self, node: cil.XorNode): self.register_comment("Xor operation") @@ -831,14 +819,6 @@ def visit(self, node: cil.XorNode): self.register_instruction(mips.XorNode("$t2", "$t0", "$t1").set_comment("$t0 = $t0 ^ $t1")) self.postprocess_binary_int_operation(node, "Int") - @visitor.when(cil.EqualNode) - def visit(self, node: cil.EqualNode): - self.register_comment("Equal operation") - self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.left)}($sp)").set_comment("Save in $t0 the left operand address")) - self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.right)}($sp)").set_comment("Save in $t1 the right operand address")) - self.register_instruction(mips.SeqNode("$t2", "$t0", "$t1").set_comment("$t2 = $t0 == $t1")) - self.postprocess_binary_int_operation(node, "Bool") - @visitor.when(cil.LessThanNode) def visit(self, node: cil.LessThanNode): self.register_comment("Less than operation") @@ -852,7 +832,71 @@ def visit(self, node: cil.LessEqualNode): self.preprocess_binary_operation(node) self.register_instruction(mips.SleNode("$t2", "$t0", "$t1").set_comment("$t2 = $t0 <= $t1")) self.postprocess_binary_int_operation(node, "Bool") + + @visitor.when(cil.EqualNode) + def visit(self, node: cil.EqualNode): + self.register_comment("Equal operation") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.left)}($sp)").set_comment("Save in $t0 the left operand address")) + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.right)}($sp)").set_comment("Save in $t1 the right operand address")) + self.register_instruction(mips.SeqNode("$t2", "$t0", "$t1").set_comment("$t2 = $t0 == $t1")) + self.postprocess_binary_int_operation(node, "Bool") + + @visitor.when(cil.EqualAddressNode) + def visit(self, node: cil.EqualAddressNode): + self.register_comment(f"{node.dest} = EqualAddress({node.left}, {node.right})") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.left)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.right)}($sp)")) + self.register_instruction(mips.SeqNode("$t2", "$t0", "$t1")) + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.dest)}($sp)")) + self.register_instruction(mips.StoreWordNode("$t2", f"8($t0)")) + @visitor.when(cil.EqualIntNode) + def visit(self, node: cil.EqualIntNode): + self.register_comment(f"{node.dest} = EqualInt({node.left}, {node.right})") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.left)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t0", f"8($t0)")) + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.right)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t1", f"8($t1)")) + self.register_instruction(mips.SeqNode("$t2", "$t0", "$t1")) + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.dest)}($sp)")) + self.register_instruction(mips.StoreWordNode("$t2", f"8($t0)")) + + @visitor.when(cil.EqualStrNode) + def visit(self, node: cil.EqualStrNode): + self.register_comment(f"{node.dest} = EqualStr({node.left}, {node.right})") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.left)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.right)}($sp)")) + self.register_instruction(mips.AddiNode("$t0", "$t0", "8")) + self.register_instruction(mips.AddiNode("$t1", "$t1", "8")) + + self.register_empty_instruction() + self.register_comment(f"By default we assume the strings are equals") + self.register_instruction(mips.AddiNode("$t4", "$zero", "1")) + self.register_instruction(mips.LoadWordNode("$t5", f"{self.offset_of(node.dest)}($sp)")) + self.register_instruction(mips.StoreWordNode("$t4", f"8($t5)")) + + self.register_empty_instruction() + self.register_instruction(mips.LabelNode("while_compare_strings_start")) + self.register_instruction(mips.LoadByteNode("$t2", "0($t0)")) + self.register_instruction(mips.LoadByteNode("$t3", "0($t1)")) + + self.register_instruction(mips.BeqNode("$t2", "$t3", "while_compare_strings_update")) + + self.register_empty_instruction() + self.register_comment(f"The strings are no equals") + self.register_instruction(mips.LoadWordNode("$t5", f"{self.offset_of(node.dest)}($sp)")) + self.register_instruction(mips.StoreWordNode("$zero", f"8($t5)")) + self.register_instruction(mips.JumpNode("while_compare_strings_end")) + + self.register_empty_instruction() + self.register_instruction(mips.LabelNode("while_compare_strings_update")) + self.register_instruction(mips.AddiNode("$t0", "$t0", "1")) + self.register_instruction(mips.AddiNode("$t1", "$t1", "1")) + self.register_instruction(mips.BeqNode("$t2", "$zero", "while_compare_strings_end")) + self.register_instruction(mips.BeqNode("$t3", "$zero", "while_compare_strings_end")) + self.register_instruction(mips.JumpNode("while_compare_strings_start")) + self.register_instruction(mips.LabelNode("while_compare_strings_end")) + @visitor.when(cil.HaltNode) def visit(self, node: cil.HaltNode): self.register_comment("Exit program") @@ -869,6 +913,7 @@ def visit(self, node: cil.ReturnNode): self.register_comment("Loading return value in $v1") self.register_instruction(mips.LoadWordNode("$v1", f"{offset}($sp)")) + def preprocess_binary_operation(self, node: cil.ArithmeticNode): self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.left)}($sp)").set_comment("Save in $t0 the left operand address")) self.register_instruction(mips.LoadWordNode("$t0", "8($t0)").set_comment("Save in $t0 the left operand value")) @@ -880,13 +925,3 @@ def postprocess_binary_int_operation(self, node: cil.ArithmeticNode, t: str): self.register_empty_instruction() self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"$t0 = {node.dest}")) self.register_instruction(mips.StoreWordNode("$t2", "8($t0)").set_comment(f"Setting value in the third word of the {t} object")) - - @visitor.when(cil.AssertTypeNode) - def visit(self, node: cil.AssertTypeNode): - self.register_comment("Assert type") - self.register_empty_instruction() - self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.address)}($sp)").set_comment("Save in $t0 the value address")) - self.register_instruction(mips.AddiNode("$t0", "$t0", "16")) - self.register_instruction(mips.LoadInmediateNode("$v0", "4")) - self.register_instruction(mips.MoveNode("$a0", "$t0")) - self.register_instruction(mips.SystemCallNode()) \ No newline at end of file diff --git a/src/cool/code_generation/translator_cool_to_cil.py b/src/cool/code_generation/translator_cool_to_cil.py index 1f3d99602..cf53477b6 100644 --- a/src/cool/code_generation/translator_cool_to_cil.py +++ b/src/cool/code_generation/translator_cool_to_cil.py @@ -1,4 +1,5 @@ from atexit import register +from copy import deepcopy from typing import Any, Dict, List, Optional, Tuple import cool.code_generation.ast_cil as cil @@ -37,6 +38,12 @@ def visit(self, node): def visit(self, node: cool.ProgramNode): declarations: List[cool.ClassDeclarationNode] = [] + default_class_names = ["Object", "IO", "String", "Int", "Bool"] + for name in default_class_names: + t = self.context.get_type(name) + t.define_method("__init__", [], [], t) + t.methods_dict.move_to_end("__init__", last=False) + for declaration in node.declarations: self.class_declarations[declaration.id] = declaration @@ -78,6 +85,7 @@ def visit(self, node: cool.ClassDeclarationNode): ) self.current_type.define_method("__init__", [], [], self.current_type) + self.current_type.methods_dict.move_to_end("__init__", last=False) attrs = [ feature @@ -105,13 +113,9 @@ def visit(self, node: cool.AttrDeclarationNode): elif node.type == "String": expr = cool.StringNode('""') else: - expr = ( - ecool.NullNode() - ) # cool.WhileNode(cool.BooleanNode("false"), cool.IntegerNode("0")) - + expr = ecool.NullNode() return cool.AssignNode(node.id, expr) - - return cool.AssignNode(node.id, node.expr) + return cool.AssignNode(node.id, deepcopy(node.expr)) class ExtendedCoolTypeChecker: @@ -660,27 +664,31 @@ def register_comment(self, comment: str) -> cil.CommentNode: def register_empty_instruction(self): self.register_instruction(cil.EmptyInstruction()) + def add_function_main(self): + self.current_function = self.register_function("main") + local_main = self.define_internal_local() + local_result = self.define_internal_local() + method_index = self.define_internal_local() + method_address = self.define_internal_local() -class CoolToCilTranslator(BaseCoolToCilVisitor): - # Notes: - # 1 - All the expression nodes are going to return a tuple [str, Type] - - @visitor.on("node") - def visit(self, node, scope): - pass + self.register_instruction(cil.AllocateNode("Main", local_main)) + self.register_instruction(cil.ArgNode(local_main, 0, 1)) + self.register_instruction(cil.StaticCallNode(self.to_function_name("__init__", "Main"), local_main, 1)) + self.register_empty_instruction() - @visitor.when(cool.ProgramNode) - def visit(self, node: cool.ProgramNode, scope: Scope): - scope = node.scope - default_class_names = ["Object", "IO", "Int", "String", "Bool"] - for name in default_class_names: - t = self.context.get_type(name) - self.current_type = t - cil_type_node = self.register_type(t.name, t.parent.name if t.parent is not None else None) - for method, owner in t.all_methods(): - cil_type_node.methods.append((method.name, self.to_function_name(method.name, owner.name))) - cil_type_node.methods.append(("__init__", self.to_function_name("__init__", t.name))) + + all_methods = methods_declaration_order(self.context.get_type("Main")) + i = [m.name for m, _ in all_methods].index("main") + self.register_instruction(cil.AllocateIntNode(method_index, f"{i}")) + self.register_instruction(cil.GetMethodNode(method_address, local_main, method_index, "main", "Main")) + + self.register_instruction(cil.ArgNode(local_main, 0, 1)) + self.register_instruction(cil.DynamicCallNode("Main", method_address, local_result, 1)) + + self.register_empty_instruction() + self.register_instruction(cil.HaltNode()) + def add_function_add(self): self.current_function = self.register_function("function_add") self.current_function.params.append(cil.ParamNode("a")) self.current_function.params.append(cil.ParamNode("b")) @@ -689,6 +697,7 @@ def visit(self, node: cool.ProgramNode, scope: Scope): self.register_instruction(cil.PlusNode(result, "a", "b")) self.register_instruction(cil.ReturnNode(result)) + def add_function_sub(self): self.current_function = self.register_function("function_sub") self.current_function.params.append(cil.ParamNode("a")) self.current_function.params.append(cil.ParamNode("b")) @@ -696,7 +705,8 @@ def visit(self, node: cool.ProgramNode, scope: Scope): self.register_instruction(cil.AllocateIntNode(result, "0")) self.register_instruction(cil.MinusNode(result, "a", "b")) self.register_instruction(cil.ReturnNode(result)) - + + def add_function_mul(self): self.current_function = self.register_function("function_mult") self.current_function.params.append(cil.ParamNode("a")) self.current_function.params.append(cil.ParamNode("b")) @@ -704,7 +714,8 @@ def visit(self, node: cool.ProgramNode, scope: Scope): self.register_instruction(cil.AllocateIntNode(result, "0")) self.register_instruction(cil.StarNode(result, "a", "b")) self.register_instruction(cil.ReturnNode(result)) - + + def add_function_div(self): self.current_function = self.register_function("function_div") self.current_function.params.append(cil.ParamNode("a")) self.current_function.params.append(cil.ParamNode("b")) @@ -712,7 +723,8 @@ def visit(self, node: cool.ProgramNode, scope: Scope): self.register_instruction(cil.AllocateIntNode(result, "0")) self.register_instruction(cil.DivNode(result, "a", "b")) self.register_instruction(cil.ReturnNode(result)) - + + def add_function_xor(self): self.current_function = self.register_function("function_xor") self.current_function.params.append(cil.ParamNode("a")) self.current_function.params.append(cil.ParamNode("b")) @@ -720,7 +732,8 @@ def visit(self, node: cool.ProgramNode, scope: Scope): self.register_instruction(cil.AllocateIntNode(result, "0")) self.register_instruction(cil.XorNode(result, "a", "b")) self.register_instruction(cil.ReturnNode(result)) - + + def add_function_less_than(self): self.current_function = self.register_function("function_less_than") self.current_function.params.append(cil.ParamNode("a")) self.current_function.params.append(cil.ParamNode("b")) @@ -728,7 +741,8 @@ def visit(self, node: cool.ProgramNode, scope: Scope): self.register_instruction(cil.AllocateBoolNode(result, "0")) self.register_instruction(cil.LessThanNode(result, "a", "b")) self.register_instruction(cil.ReturnNode(result)) - + + def add_function_less_than_or_equal(self): self.current_function = self.register_function("function_less_than_or_equal") self.current_function.params.append(cil.ParamNode("a")) self.current_function.params.append(cil.ParamNode("b")) @@ -736,7 +750,8 @@ def visit(self, node: cool.ProgramNode, scope: Scope): self.register_instruction(cil.AllocateBoolNode(result, "0")) self.register_instruction(cil.LessEqualNode(result, "a", "b")) self.register_instruction(cil.ReturnNode(result)) - + + def add_function_equal(self): self.current_function = self.register_function("function_equal") self.current_function.params.append(cil.ParamNode("a")) self.current_function.params.append(cil.ParamNode("b")) @@ -796,6 +811,7 @@ def visit(self, node: cool.ProgramNode, scope: Scope): self.register_instruction(cil.ReturnNode(result)) + def add_function_assign(self): self.current_function = self.register_function("function_assign") self.current_function.params.append(cil.ParamNode("dest")) self.current_function.params.append(cil.ParamNode("source")) @@ -841,68 +857,91 @@ def visit(self, node: cool.ProgramNode, scope: Scope): self.register_instruction(cil.ReturnNode("dest")) - - self.current_function = self.register_function(self.to_function_name("__init__", "Object")) + def add_function_init(self, type_name: str): + self.current_function = self.register_function(self.to_function_name("__init__", type_name)) self.current_function.params.append(cil.ParamNode("self")) self.register_instruction(cil.ReturnNode("self")) + def add_function_abort(self): self.current_function = self.register_function(self.to_function_name("abort", "Object")) self.current_function.params.append(cil.ParamNode("self")) msg1 = self.define_internal_local() msg2 = self.define_internal_local() - endl = self.define_internal_local() msg = self.define_internal_local() + endl = self.define_internal_local() + method_index = self.define_internal_local() + method_address = self.define_internal_local() + self.register_instruction(cil.AllocateStrNode(msg1, "\"Abort called from class \"")) self.register_instruction(cil.AllocateStrNode(endl, "\"\\n\"")) + + all_methods = methods_declaration_order(self.context.get_type("String")) + i = [m.name for m, _ in all_methods].index("type_name") + self.register_instruction(cil.AllocateIntNode(method_index, f"{i}")) + self.register_instruction(cil.GetMethodNode(method_address, "self", method_index, "type_name", "String")) + self.register_instruction(cil.ArgNode("self", 0, 1)) - self.register_instruction(cil.DynamicCallNode("String", self.to_function_name("type_name", "Object"), msg2, 1)) + self.register_instruction(cil.DynamicCallNode("String", method_address, msg2, 1)) + + all_methods = methods_declaration_order(self.context.get_type("String")) + i = [m.name for m, _ in all_methods].index("concat") + self.register_instruction(cil.AllocateIntNode(method_index, f"{i}")) + self.register_instruction(cil.GetMethodNode(method_address, "self", method_index, "concat", "String")) + self.register_instruction(cil.ArgNode(msg1, 0, 2)) self.register_instruction(cil.ArgNode(msg2, 1, 2)) - self.register_instruction(cil.DynamicCallNode("String", self.to_function_name("concat", "String"), msg, 2)) + self.register_instruction(cil.DynamicCallNode("String", method_address, msg, 2)) + + all_methods = methods_declaration_order(self.context.get_type("String")) + i = [m.name for m, _ in all_methods].index("concat") + self.register_instruction(cil.AllocateIntNode(method_index, f"{i}")) + self.register_instruction(cil.GetMethodNode(method_address, "self", method_index, "concat", "String")) self.register_instruction(cil.ArgNode(msg, 0, 2)) self.register_instruction(cil.ArgNode(endl, 1, 2)) - self.register_instruction(cil.DynamicCallNode("String", self.to_function_name("concat", "String"), msg, 2)) + self.register_instruction(cil.DynamicCallNode("String", method_address, msg, 2)) self.register_instruction(cil.PrintStringNode(msg)) self.register_instruction(cil.HaltNode()) self.register_instruction(cil.ReturnNode("self")) - + + def add_function_type_name(self): self.current_function = self.register_function(self.to_function_name("type_name", "Object")) self.current_function.params.append(cil.ParamNode("self")) type_name = self.define_internal_local("type_name") self.register_instruction(cil.TypeNameNode(type_name, "self")) self.register_instruction(cil.ReturnNode(type_name)) + def add_function_copy(self): self.current_function = self.register_function(self.to_function_name("copy", "Object")) self.current_function.params.append(cil.ParamNode("self")) local_copy = self.define_internal_local() self.register_instruction(cil.CopyNode(local_copy, "self")) self.register_instruction(cil.ReturnNode(local_copy)) - self.current_function = self.register_function(self.to_function_name("__init__", "IO")) - self.current_function.params.append(cil.ParamNode("self")) - self.register_instruction(cil.ReturnNode("self")) - + def add_function_out_string(self): self.current_function = self.register_function(self.to_function_name("out_string", "IO")) self.current_function.params.append(cil.ParamNode("self")) self.current_function.params.append(cil.ParamNode("x")) self.register_instruction(cil.PrintStringNode("x")) self.register_instruction(cil.ReturnNode("self")) + def add_function_out_int(self): self.current_function = self.register_function(self.to_function_name("out_int", "IO")) self.current_function.params.append(cil.ParamNode("self")) self.current_function.params.append(cil.ParamNode("x")) self.register_instruction(cil.PrintIntNode("x")) self.register_instruction(cil.ReturnNode("self")) - + + def add_function_in_string(self): self.current_function = self.register_function(self.to_function_name("in_string", "IO")) self.current_function.params.append(cil.ParamNode("self")) local_str = self.define_internal_local() self.register_instruction(cil.ReadStringNode(local_str)) self.register_instruction(cil.ReturnNode(local_str)) - + + def add_function_in_int(self): self.current_function = self.register_function(self.to_function_name("in_int", "IO")) self.current_function.params.append(cil.ParamNode("self")) local_str = self.define_internal_local() @@ -910,10 +949,7 @@ def visit(self, node: cool.ProgramNode, scope: Scope): self.register_instruction(cil.ReadIntNode(local_str)) self.register_instruction(cil.ReturnNode(local_str)) - self.current_function = self.register_function(self.to_function_name("__init__", "String")) - self.current_function.params.append(cil.ParamNode("self")) - self.register_instruction(cil.ReturnNode("self")) - + def add_function_length(self): self.current_function = self.register_function(self.to_function_name("length", "String")) self.current_function.params.append(cil.ParamNode("self")) len_local = self.define_internal_local() @@ -921,6 +957,7 @@ def visit(self, node: cool.ProgramNode, scope: Scope): self.register_instruction(cil.LengthNode(len_local, "self")) self.register_instruction(cil.ReturnNode(len_local)) + def add_function_concat(self): self.current_function = self.register_function(self.to_function_name("concat", "String")) self.current_function.params.append(cil.ParamNode("self")) self.current_function.params.append(cil.ParamNode("s")) @@ -928,6 +965,7 @@ def visit(self, node: cool.ProgramNode, scope: Scope): self.register_instruction(cil.ConcatNode(new_str, "self", "s")) self.register_instruction(cil.ReturnNode(new_str)) + def add_function_substr(self): self.current_function = self.register_function(self.to_function_name("substr", "String")) self.current_function.params.append(cil.ParamNode("self")) self.current_function.params.append(cil.ParamNode("i")) @@ -935,31 +973,82 @@ def visit(self, node: cool.ProgramNode, scope: Scope): substr = self.define_internal_local() self.register_instruction(cil.SubstringNode(substr, "self", "i", "l")) self.register_instruction(cil.ReturnNode(substr)) - - self.current_function = self.register_function(self.to_function_name("__init__", "Int")) - self.current_function.params.append(cil.ParamNode("self")) - self.register_instruction(cil.AllocateIntNode("self", "0")) - self.register_instruction(cil.ReturnNode("self")) - self.current_function = self.register_function(self.to_function_name("__init__", "Bool")) - self.current_function.params.append(cil.ParamNode("self")) - self.register_instruction(cil.AllocateBoolNode("self", "0")) - self.register_instruction(cil.ReturnNode("self")) + def debug_print_type(self, source: str): + endl = self.define_internal_local() + dest = self.define_internal_local() + self.register_instruction(cil.AllocateStrNode(endl, '"\\n"')) + self.register_instruction(cil.ArgNode(source, 0, 1)) + self.register_instruction(cil.StaticCallNode("function_type_name_at_Object", dest, 1)) + self.register_instruction(cil.PrintStringNode(dest)) + self.register_instruction(cil.PrintStringNode(endl)) + + +def methods_declaration_order(t: Type) -> List[Tuple[Method, Type]]: + method_decl = [] + all_methods = t.all_methods() + visited = set() + for method, _ in all_methods: + if method.name in visited: + continue + + method_decl.append([(x, y) for x, y in all_methods[::-1] if x.name == method.name][0]) + visited.add(method.name) + return method_decl + +class CoolToCilTranslator(BaseCoolToCilVisitor): + # Notes: + # 1 - All the expression nodes are going to return a tuple [str, Type] + + @visitor.on("node") + def visit(self, node, scope): + pass + + @visitor.when(cool.ProgramNode) + def visit(self, node: cool.ProgramNode, scope: Scope): + scope = node.scope + default_class_names = ["Object", "IO", "String", "Int", "Bool"] + for name in default_class_names: + current_type = self.context.get_type(name) + self.current_type = current_type + cil_type_node = self.register_type(current_type.name, current_type.parent.name if current_type.parent is not None else None) + + for method, ancestor in methods_declaration_order(current_type): + cil_type_node.methods.append((method.name, self.to_function_name(method.name, ancestor.name))) + + self.add_function_add() + self.add_function_sub() + self.add_function_mul() + self.add_function_div() + self.add_function_xor() + self.add_function_less_than() + self.add_function_less_than_or_equal() + self.add_function_equal() + self.add_function_assign() + + self.add_function_init("Object") + self.add_function_abort() + self.add_function_type_name() + self.add_function_copy() + + self.add_function_init("IO") + self.add_function_out_string() + self.add_function_out_int() + self.add_function_in_string() + self.add_function_in_int() + + self.add_function_init("String") + self.add_function_length() + self.add_function_concat() + self.add_function_substr() + + self.add_function_init("Int") + self.add_function_init("Bool") for i, declaration in enumerate(node.declarations): self.visit(declaration, scope.children[i]) - self.current_function = self.register_function("main") - local_main = self.define_internal_local() - local_result = self.define_internal_local() - self.register_instruction(cil.AllocateNode("Main", local_main)) - self.register_instruction(cil.ArgNode(local_main, 0, 1)) - self.register_instruction(cil.DynamicCallNode("Main", self.to_function_name("__init__", "Main"), local_main, 1)) - self.register_empty_instruction() - self.register_instruction(cil.ArgNode(local_main, 0, 1)) - self.register_instruction(cil.DynamicCallNode("Main", self.to_function_name("main", "Main"), local_result, 1)) - self.register_empty_instruction() - self.register_instruction(cil.HaltNode()) + self.add_function_main() return cil.ProgramNode(self.dottypes, self.dotdata, self.dotcode) @@ -986,18 +1075,8 @@ def visit(self, node: cool.ClassDeclarationNode, scope: Scope): self.visit(attr, scope) type_node.attributes.append(attr.name) - visited = set() - for method, _ in self.current_type.all_methods(): - - if method.name in visited: - continue - - visited.add(method.name) - _, ancestor = self.current_type.get_method(method.name, get_owner=True) - - type_node.methods.append( - (method.name, self.to_function_name(method.name, ancestor.name)) - ) + for method, t in methods_declaration_order(self.current_type): + type_node.methods.append((method.name, self.to_function_name(method.name, t.name))) i = len([attr for attr in attrs if attr.expr is not None]) for i, method in enumerate(methods, start=i): @@ -1059,7 +1138,7 @@ def visit(self, node: cool.LetNode, scope: Scope): def visit(self, node: cool.AssignNode, scope: Scope): scope = node.scope variable = scope.find_variable(node.id) - variables = scope.find_all_variables(node.id) + variables = scope.find_all_variables_with_name(node.id) source, _ = self.visit(node.expr, scope) self.register_empty_instruction() @@ -1123,12 +1202,12 @@ def visit(self, node: cool.ConditionalNode, scope: Scope): @visitor.when(cool.WhileNode) def visit(self, node: cool.WhileNode, scope: Scope): scope = node.scope - # result_addres = self.define_internal_local() node_id = hash(node) + result_addres = self.define_internal_local() self.register_empty_instruction() self.register_comment(f"While loop") - # self.register_instruction(cil.AssignNode(result_addres, 0)) + self.register_instruction(cil.AllocateNullPtrNode(result_addres)) self.register_instruction(cil.LabelNode(f"while_start_{node_id}")) conditional_source, _ = self.visit(node.condition, scope) @@ -1143,14 +1222,14 @@ def visit(self, node: cool.WhileNode, scope: Scope): self.register_instruction(cil.EmptyInstruction()) self.register_instruction(cil.LabelNode(f"while_end_{node_id}")) - return "0", self.context.get_type("Object") + return result_addres, self.context.get_type("Object") @visitor.when(cool.SwitchCaseNode) def visit(self, node: cool.SwitchCaseNode, scope: Scope): scope = node.scope node_id = hash(node) swicth_expression, _ = self.visit(node.expr, scope) - + constant_zero_int = self.define_internal_local("Constant Integer 0 ") constant_one_int = self.define_internal_local("Constant Integer 1") constant_len_types_int = self.define_internal_local(f"Constant Integer {len(node.cases)}") @@ -1187,11 +1266,6 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): self.register_instruction(cil.TypeOfNode(switch_expr_type_address, swicth_expression).set_comment("Get the switch expression type")) self.register_instruction(cil.AssignNode(ancestor_type_address, switch_expr_type_address).set_comment("The first ancestor will be the type itself")) - # self.register_instruction(cil.ArgNode(count_of_ancestors_int, 0, 2)) - # self.register_instruction(cil.ArgNode(constant_zero_int, 1, 2)) - # self.register_instruction(cil.StaticCallNode("function_assign", count_of_ancestors_int, 2)) - # self.register_instruction(cil.PrintIntNode(count_of_ancestors_int)) - self.register_instruction(cil.LabelNode(f"while_start_{node_id}")) self.register_instruction(cil.EqualAddressNode(step1_comparison_result_bool, ancestor_type_address, constant_null_ptr)) self.register_instruction(cil.GotoIfNode(step1_comparison_result_bool, f"while_end_{node_id}")) @@ -1200,9 +1274,6 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): self.register_instruction(cil.ArgNode(count_of_ancestors_int, 0, 2)) self.register_instruction(cil.ArgNode(constant_one_int, 1, 2)) self.register_instruction(cil.StaticCallNode("function_add", count_of_ancestors_int, 2)) - # self.register_instruction(cil.PrintIntNode(count_of_ancestors_int)) - - # self.register_instruction(cil.AssertTypeNode(ancestor_type_address)) self.register_instruction(cil.AncestorNode(ancestor_type_address, ancestor_type_address)) self.register_instruction(cil.GotoNode(f"while_start_{node_id}")) @@ -1227,23 +1298,16 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): self.register_instruction(cil.AllocateIntNode(step2_iter_index_int, "0")) self.register_instruction(cil.AllocateBoolNode(step2_comparison_result_bool, "0")) - - # self.register_instruction(cil.AssignNode(step2_iter_index_int, constant_zero_int).set_comment("Initialize the index with the value 0")) - self.register_instruction(cil.LabelNode(f"foreach_start_{node_id}")) self.register_instruction(cil.ArgNode(step2_iter_index_int, 0, 2)) self.register_instruction(cil.ArgNode(count_of_ancestors_int, 1, 2)) self.register_instruction(cil.StaticCallNode("function_less_than", step2_comparison_result_bool, 2)) - # self.register_instruction(cil.PrintIntNode(step2_iter_index_int)) - # self.register_instruction(cil.PrintIntNode(step2_comparison_result_bool)) self.register_instruction(cil.GotoIfNode(step2_comparison_result_bool, f"foreach_body_{node_id}")) self.register_instruction(cil.GotoNode(f"foreach_end_{node_id}")) self.register_instruction(cil.LabelNode(f"foreach_body_{node_id}")) self.register_instruction(cil.SetIndexNode(ancestors_array, step2_iter_index_int, ancestor_type_address).set_comment("Set the index of the array with the ancestor type")) - # self.register_instruction(cil.GetIndexNode(ancestor_type_address, ancestors_array, step2_iter_index_int)) - # self.register_instruction(cil.AssertTypeNode(ancestor_type_address)) self.register_instruction(cil.AncestorNode(ancestor_type_address, ancestor_type_address).set_comment("Get the next ancestor")) @@ -1259,9 +1323,9 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): # ########################################################################### - # self.register_comment("#################################################################################################### #") - # self.register_comment("Step 3 - For each branch type, store the ancestor index that match with it (Simulating a double for) #") - # self.register_comment("#################################################################################################### #") + self.register_comment("#################################################################################################### #") + self.register_comment("Step 3 - For each branch type, store the ancestor index that match with it (Simulating a double for) #") + self.register_comment("#################################################################################################### #") types = [self.context.get_type(type_name) for _, type_name, _ in node.cases] type_branch_array = self.define_internal_local("Array to store the branch types") @@ -1274,11 +1338,7 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): self.register_instruction(cil.AllocateIntNode(i, i_int)) self.register_instruction(cil.TypeAddressNode(x, t.name)) self.register_instruction(cil.SetIndexNode(type_branch_array, i, x)) - # self.register_instruction(cil.GetIndexNode(x, ancestors_array, i)) - # self.register_instruction(cil.AssertTypeNode(x)) self.register_instruction(cil.SetValueInIndexNode(nearest_ancestor_array, i, count_of_ancestors_int)) - # self.register_instruction(cil.GetValueInIndexNode(count_of_ancestors_int, nearest_ancestor_array, i)) - # self.register_instruction(cil.PrintIntNode(count_of_ancestors_int)) self.register_empty_instruction() @@ -1296,53 +1356,44 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): self.register_instruction(cil.AllocateBoolNode(comp_j_bool, "0")) self.register_instruction(cil.AllocateBoolNode(types_comparison_bool, "0")) - # self.register_comment("############# #") - # self.register_comment("Outer Foreach #") - # self.register_comment("############# #") - # self.register_instruction(cil.AssignNode(i_int, constant_zero_int).set_comment("Initialize the index i of the case to 0")) + self.register_comment("############# #") + self.register_comment("Outer Foreach #") + self.register_comment("############# #") self.register_instruction(cil.LabelNode(f"foreach_type_start_{node_id}")) self.register_instruction(cil.ArgNode(i_int, 0, 2)) self.register_instruction(cil.ArgNode(constant_len_types_int, 1, 2)) self.register_instruction(cil.StaticCallNode("function_less_than", comp_i_bool, 2)) - # self.register_instruction(cil.PrintIntNode(i_int)) - # self.register_instruction(cil.PrintIntNode(comp_i_bool)) self.register_instruction(cil.GotoIfNode(comp_i_bool, f"foreach_type_body_{node_id}")) self.register_instruction(cil.GotoNode(f"foreach_type_end_{node_id}")) self.register_instruction(cil.LabelNode(f"foreach_type_body_{node_id}")) self.register_instruction(cil.GetIndexNode(type_i, type_branch_array, i_int).set_comment("Get the type of the i-th branch")) - # self.register_instruction(cil.AssertTypeNode(type_i)) - # ################# - # # Inner Foreach # - # ################# - # self.register_empty_instruction() - # self.register_comment("############# #") - # self.register_comment("Inner Foreach #") - # self.register_comment("############# #") + ################# + # Inner Foreach # + ################# + self.register_empty_instruction() + self.register_comment("############# #") + self.register_comment("Inner Foreach #") + self.register_comment("############# #") self.register_instruction(cil.ArgNode(j_int, 0, 2)) self.register_instruction(cil.ArgNode(constant_zero_int, 1, 2)) self.register_instruction(cil.StaticCallNode("function_assign", j_int, 2)) - # self.register_instruction(cil.PrintIntNode(j_int)) self.register_instruction(cil.LabelNode(f"foreach_ancestor_start_{node_id}")) self.register_instruction(cil.ArgNode(j_int, 0, 2)) self.register_instruction(cil.ArgNode(count_of_ancestors_int, 1, 2)) self.register_instruction(cil.StaticCallNode("function_less_than", comp_j_bool, 2)) - # self.register_instruction(cil.PrintIntNode(j_int)) - # self.register_instruction(cil.PrintIntNode(comp_j_bool)) - # self.register_instruction(cil.LessThanNode(comp_j_bool, j_int, count_of_ancestors_int).set_comment("Check if the case index is less than the count of ancestors")) + self.register_instruction(cil.GotoIfNode(comp_j_bool, f"foreach_ancestor_body_{node_id}")) self.register_instruction(cil.GotoNode(f"foreach_ancestor_end_{node_id}")) self.register_instruction(cil.LabelNode(f"foreach_ancestor_body_{node_id}")) self.register_instruction(cil.GetIndexNode(type_j, ancestors_array, j_int).set_comment("Get the j-th ancestor type")) - # self.register_instruction(cil.AssertTypeNode(type_j)) self.register_instruction(cil.EqualAddressNode(types_comparison_bool, type_i, type_j).set_comment("Compare if the type of the i-th branch is equal to the j-th ancestor")) - # self.register_instruction(cil.PrintIntNode(types_comparison_bool)) self.register_instruction(cil.GotoIfNode(types_comparison_bool, f"foreach_ancestor_end_{node_id}").set_comment("If the types are equal, we have a match, then we can exit")) self.register_instruction(cil.ArgNode(j_int, 0, 2)) @@ -1351,8 +1402,6 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): self.register_instruction(cil.GotoNode(f"foreach_ancestor_start_{node_id}")) self.register_instruction(cil.LabelNode(f"foreach_ancestor_end_{node_id}")) self.register_instruction(cil.SetValueInIndexNode(nearest_ancestor_array, i_int, j_int).set_comment("Set the counter of the i-th branch equals to j")) - # self.register_instruction(cil.GetValueInIndexNode(j_int, nearest_ancestor_array, i_int)) - # self.register_instruction(cil.PrintIntNode(j_int)) self.register_comment("#################### #") self.register_comment("End of Inner Foreach #") self.register_comment("#################### #") @@ -1379,11 +1428,6 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): step4_temp_int = self.define_internal_local("Step 4 - Temporary variable") step4_current_min_int = self.define_internal_local("Step 4 - Current minimum of the counter array") step4_comparison_bool = self.define_internal_local("Step 4 - Comparison for the minimum of the counter array") - - endl =self.define_internal_local("endl") - space =self.define_internal_local("space") - self.register_instruction(cil.AllocateStrNode(endl, '"\\n"')) - self.register_instruction(cil.AllocateStrNode(space, '" "')) self.register_instruction(cil.AllocateIntNode(step4_index_int, "0")) self.register_instruction(cil.AllocateIntNode(step4_current_min_index_int, "0")) @@ -1394,32 +1438,21 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): self.register_instruction(cil.ArgNode(step4_current_min_int, 0, 2)) self.register_instruction(cil.ArgNode(count_of_ancestors_int, 1, 2)) self.register_instruction(cil.StaticCallNode("function_assign", step4_current_min_int, 2)) - # self.register_instruction(cil.PrintIntNode(step4_current_min_int)) self.register_instruction(cil.LabelNode(f"foreach_min_start_{node_id}")) self.register_instruction(cil.ArgNode(step4_index_int, 0, 2)) self.register_instruction(cil.ArgNode(constant_len_types_int, 1, 2)) self.register_instruction(cil.StaticCallNode("function_less_than", step4_comparison_bool, 2)) - # self.register_instruction(cil.PrintIntNode(step4_index_int)) - # self.register_instruction(cil.PrintStringNode(space)) - # self.register_instruction(cil.PrintIntNode(step4_comparison_bool)) - # self.register_instruction(cil.PrintStringNode(space)) self.register_instruction(cil.GotoIfNode(step4_comparison_bool, f"foreach_min_body_{node_id}")) self.register_instruction(cil.GotoNode(f"foreach_min_end_{node_id}")) self.register_instruction(cil.LabelNode(f"foreach_min_body_{node_id}")) self.register_instruction(cil.GetValueInIndexNode(step4_temp_int, nearest_ancestor_array, step4_index_int).set_comment("Get the nearest ancestor index of the i-th branch type")) - # self.register_instruction(cil.PrintIntNode(step4_temp_int)) - # self.register_instruction(cil.PrintStringNode(space)) - # self.register_instruction(cil.PrintIntNode(step4_current_min_int)) - # self.register_instruction(cil.PrintStringNode(space)) self.register_instruction(cil.ArgNode(step4_temp_int, 0, 2)) self.register_instruction(cil.ArgNode(step4_current_min_int, 1, 2)) - self.register_instruction(cil.StaticCallNode("function_less_than", step4_comparison_bool, 2)) - # self.register_instruction(cil.PrintIntNode(step4_comparison_bool)) - # self.register_instruction(cil.PrintStringNode(space)) + self.register_instruction(cil.StaticCallNode("function_less_than", step4_comparison_bool, 2)) self.register_instruction(cil.GotoIfNode(step4_comparison_bool, f"update_min_{node_id}")) self.register_instruction(cil.GotoNode(f"update_min_end_{node_id}")) @@ -1428,31 +1461,18 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): self.register_instruction(cil.ArgNode(step4_current_min_int, 0, 2)) self.register_instruction(cil.ArgNode(step4_temp_int, 1, 2)) self.register_instruction(cil.StaticCallNode("function_assign", step4_current_min_int, 2)) - # self.register_instruction(cil.PrintIntNode(step4_current_min_int)) - # self.register_instruction(cil.PrintStringNode(space)) self.register_instruction(cil.ArgNode(step4_current_min_index_int, 0, 2)) self.register_instruction(cil.ArgNode(step4_index_int, 1, 2)) self.register_instruction(cil.StaticCallNode("function_assign", step4_current_min_index_int, 2)) - # self.register_instruction(cil.PrintIntNode(step4_current_min_index_int)) - # self.register_instruction(cil.PrintStringNode(space)) self.register_instruction(cil.LabelNode(f"update_min_end_{node_id}")) - self.register_instruction(cil.ArgNode(step4_index_int, 0, 2)) self.register_instruction(cil.ArgNode(constant_one_int, 1, 2)) self.register_instruction(cil.StaticCallNode("function_add", step4_index_int, 2)) - - # self.register_instruction(cil.PrintStringNode(endl)) self.register_instruction(cil.GotoNode(f"foreach_min_start_{node_id}")) self.register_instruction(cil.LabelNode(f"foreach_min_end_{node_id}")) - # self.register_instruction(cil.PrintStringNode(endl)) - # self.register_instruction(cil.PrintIntNode(step4_current_min_int)) - # self.register_instruction(cil.PrintStringNode(space)) - # self.register_instruction(cil.PrintIntNode(step4_current_min_index_int)) - # self.register_instruction(cil.PrintStringNode(space)) - self.register_empty_instruction() self.register_comment("################################################################# #") self.register_comment("Step 5 - Using the minimun ancestor index find the correct branch #") @@ -1463,8 +1483,6 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): x = self.define_internal_local(f"Step 5 - Branch {i}") self.register_instruction(cil.AllocateIntNode(x, f"{i}")) self.register_instruction(cil.SetValueInIndexNode(bool_array, x, constant_zero_int).set_comment("Initialize the bool array")) - # self.register_instruction(cil.GetValueInIndexNode(constant_zero_int, bool_array, x)) - # self.register_instruction(cil.PrintIntNode(constant_zero_int)) self.register_empty_instruction() exists_error_bool = self.define_internal_local("Step 5 - Exists an error") @@ -1473,13 +1491,10 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): self.register_instruction(cil.ArgNode(step4_current_min_int, 0, 2)) self.register_instruction(cil.ArgNode(count_of_ancestors_int, 1, 2)) self.register_instruction(cil.StaticCallNode("function_equal", exists_error_bool, 2)) - # self.register_instruction(cil.PrintIntNode(exists_error_bool)) self.register_instruction(cil.GotoIfNode(exists_error_bool, f"error_branch_{node_id}")) self.register_instruction(cil.SetValueInIndexNode(bool_array, step4_current_min_index_int, constant_one_int).set_comment("Set the bool array in the correct index to 1")) - # self.register_instruction(cil.PrintStringNode(endl)) - # self.register_instruction(cil.PrintIntNode(step4_current_min_index_int)) - # self.register_instruction(cil.PrintStringNode(space)) + step5_comparison = self.define_internal_local("Step 5 - Comparison for the correct branch result") self.register_instruction(cil.AllocateBoolNode(step5_comparison, "0")) @@ -1519,23 +1534,34 @@ def visit(self, node: cool.MethodCallNode, scope: Scope): if obj_type.name == "SELF_TYPE": obj_type = self.current_type + ancestor_call = False + if node.type is not None: + ancestor_call = True + obj_type = self.context.get_type(node.type) + args_sources = [] for arg in node.args: arg_source, _ = self.visit(arg, scope) args_sources.append(arg_source) + all_methods = methods_declaration_order(obj_type) + i = [m.name for m, _ in all_methods].index(node.id) + method = obj_type.get_method(node.id) + + call_dest = self.define_internal_local("Function call destination") + method_index = self.define_internal_local(f"Index of {method.name}") + method_address = self.define_internal_local(f"Address of {method.name}") + self.register_instruction(cil.AllocateIntNode(method_index, f"{i}")) + self.register_instruction(cil.GetMethodNode(method_address, obj_source, method_index, method.name, obj_type.name)) + self.register_instruction(cil.ArgNode(obj_source, 0, len(args_sources) + 1)) for index, arg_source in enumerate(args_sources, start=1): self.register_instruction(cil.ArgNode(arg_source, index, len(args_sources) + 1)) - call_dest = self.define_internal_local() - method, owner = obj_type.get_method(node.id, get_owner=True) - - self.register_instruction( - cil.DynamicCallNode( - obj_type.name, self.to_function_name(node.id, owner.name), call_dest, len(args_sources) + 1 - ) - ) + if ancestor_call: + self.register_instruction(cil.StaticCallNode(self.to_function_name(method.name, obj_type.name), call_dest, len(args_sources) + 1)) + else: + self.register_instruction(cil.DynamicCallNode(obj_type.name, method_address, call_dest, len(args_sources) + 1)) return call_dest, method.return_type @visitor.when(cool.IntegerNode) @@ -1570,11 +1596,9 @@ def visit(self, node: ecool.NullNode, scope: Scope): def visit(self, node: cool.VariableNode, scope: Scope): scope = node.scope variable = scope.find_variable(node.lex) - variables = scope.find_all_variables(node.lex) + variables = scope.find_all_variables_with_name(node.lex) - is_attribute = ( - self.current_type.contains_attribute(node.lex) and len(variables) == 1 - ) + is_attribute = (self.current_type.contains_attribute(node.lex) and len(variables) == 1) if is_attribute: dest = self.define_internal_local() @@ -1589,7 +1613,7 @@ def visit(self, node: cool.InstantiateNode, scope: Scope): local = self.define_internal_local(f"Store an instance of the class {node.lex}") self.register_instruction(cil.AllocateNode(node.lex, local).set_comment(f"Allocate the object {node.lex}")) self.register_instruction(cil.ArgNode(local, 0, 1).set_comment("Pass the instance to the constructor")) - self.register_instruction(cil.DynamicCallNode(node.lex, self.to_function_name("__init__", node.lex), local, 1).set_comment("Call the constructor")) + self.register_instruction(cil.StaticCallNode(self.to_function_name("__init__", node.lex), local, 1).set_comment("Call the constructor")) return local, self.context.get_type(node.lex) @visitor.when(cool.NegationNode) @@ -1600,11 +1624,11 @@ def visit(self, node: cool.NegationNode, scope: Scope): result = self.define_internal_local(f"Store the negation of {source}") self.register_instruction(cil.AllocateIntNode(local_int, "1")) self.register_instruction(cil.AllocateBoolNode(result, "0")) + self.register_instruction(cil.ArgNode(source, 0, 2)) self.register_instruction(cil.ArgNode(local_int, 1, 2)) self.register_instruction(cil.StaticCallNode("function_xor", result, 2)) - # self.register_instruction(cil.AllocateIntNode(result, "0")) - # self.register_instruction(cil.XorNode(result, source, local_int).set_comment(f"not {source}")) + return result, self.context.get_type("Bool") @visitor.when(cool.ComplementNode) @@ -1617,17 +1641,14 @@ def visit(self, node: cool.ComplementNode, scope: Scope): self.register_instruction(cil.AllocateIntNode(local_int_0, "1")) self.register_instruction(cil.AllocateIntNode(local_int_1, str(2**32 - 1))) self.register_instruction(cil.AllocateIntNode(result, "0")) + self.register_instruction(cil.ArgNode(source, 0, 2)) self.register_instruction(cil.ArgNode(local_int_1, 1, 2)) self.register_instruction(cil.StaticCallNode("function_xor", result, 2)) - # self.register_instruction(cil.PrintIntNode(result)) - # self.register_instruction(cil.AllocateIntNode(result, "0")) - # self.register_instruction(cil.XorNode(result, source, local_int_1).set_comment(f"Getting the complement a1 of {source}")) + self.register_instruction(cil.ArgNode(result, 0, 2)) self.register_instruction(cil.ArgNode(local_int_0, 1, 2)) self.register_instruction(cil.StaticCallNode("function_add", result, 2)) - # self.register_instruction(cil.PrintIntNode(result)) - # self.register_instruction(cil.PlusNode(result, result, local_int_0).set_comment(f"Adding 1 to the complement a1 we get the complement a2 of {source}")) return result, self.context.get_type("Int") @visitor.when(cool.IsVoidNode) @@ -1638,8 +1659,9 @@ def visit(self, node: cool.IsVoidNode, scope: Scope): result = self.define_internal_local(f"Store if {source} is NULL") self.register_instruction(cil.AllocateBoolNode(result, "0")) self.register_instruction(cil.AllocateNullPtrNode(null_ptr)) + self.register_instruction(cil.ArgNode(source, 0, 2)) - self.register_instruction(cil.ArgNode(source, 1, 2)) + self.register_instruction(cil.ArgNode(null_ptr, 1, 2)) self.register_instruction(cil.StaticCallNode("function_equal", result, 2)) return result, self.context.get_type("Bool") @@ -1678,9 +1700,7 @@ def visit(self, node: cool.EqualNode, scope: Scope): scope = node.scope return self.visit_arith_node(node, scope, "function_equal", "Bool") - def visit_arith_node( - self, node: cool.BinaryNode, scope: Scope, operation_function: str, return_type_name: str = "Int" - ) -> Tuple[str, Type]: + def visit_arith_node(self, node: cool.BinaryNode, scope: Scope, operation_function: str, return_type_name: str = "Int") -> Tuple[str, Type]: left, _ = self.visit(node.left, scope) right, _ = self.visit(node.right, scope) dest = self.define_internal_local(f"Store the result of the operation {operation_function}") diff --git a/src/cool/semantics/type_inference.py b/src/cool/semantics/type_inference.py index a32ffd203..eda62cd87 100644 --- a/src/cool/semantics/type_inference.py +++ b/src/cool/semantics/type_inference.py @@ -524,7 +524,7 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): not_defined_nodes.append(case_node) case_nodes.append(case_node) - if any(e.type.name == "AUTO_TYPE" for e in case_nodes): + if any(e is not None and e.type.name == "AUTO_TYPE" for e in case_nodes): if defined_nodes: t = Type.multi_join([x.type for x in defined_nodes]) for x in not_defined_nodes: @@ -532,7 +532,7 @@ def visit(self, node: cool.SwitchCaseNode, scope: Scope): case_of_node = CaseOfNode(self.context.get_type("AUTO_TYPE"), case_nodes) self.graph.add_node(case_of_node) return case_of_node - return AtomNode(Type.multi_join([e.type for e in case_nodes])) + return AtomNode(Type.multi_join([e.type for e in case_nodes if e is not None])) @visitor.when(cool.MethodCallNode) def visit(self, node: cool.MethodCallNode, scope: Scope): diff --git a/src/cool/semantics/utils/scope.py b/src/cool/semantics/utils/scope.py index e3d558d81..3e184ff0f 100644 --- a/src/cool/semantics/utils/scope.py +++ b/src/cool/semantics/utils/scope.py @@ -306,7 +306,7 @@ def find_variable(self, var_name: str) -> Optional[VariableInfo]: self.parent.find_variable(var_name) if self.parent is not None else None ) - def find_all_variables(self, var_name: str) -> List[VariableInfo]: + def find_all_variables_with_name(self, var_name: str) -> List[VariableInfo]: vars = [] scope = self while scope is not None: diff --git a/src/fib.asm b/src/fib.asm deleted file mode 100644 index f3f6b3f6d..000000000 --- a/src/fib.asm +++ /dev/null @@ -1,1640 +0,0 @@ -.data - type_Object: .word 8 - type_Object_inherits_from: .word 0 - type_Object_attributes: .word 0 - type_Object_name_size: .word 6 - type_Object_name: .asciiz "Object" - - type_IO: .word 8 - type_IO_inherits_from: .word type_Object - type_IO_attributes: .word 0 - type_IO_name_size: .word 2 - type_IO_name: .asciiz "IO" - - type_Int: .word 8 - type_Int_inherits_from: .word type_Object - type_Int_attributes: .word 0 - type_Int_name_size: .word 3 - type_Int_name: .asciiz "Int" - - type_String: .word 8 - type_String_inherits_from: .word type_Object - type_String_attributes: .word 0 - type_String_name_size: .word 6 - type_String_name: .asciiz "String" - - type_Bool: .word 8 - type_Bool_inherits_from: .word type_Object - type_Bool_attributes: .word 0 - type_Bool_name_size: .word 4 - type_Bool_name: .asciiz "Bool" - - type_Main: .word 8 - type_Main_inherits_from: .word type_IO - type_Main_attributes: .word 0 - type_Main_name_size: .word 4 - type_Main_name: .asciiz "Main" - - buffer_input: .space 1024 - debug_log: .asciiz "debug_log\n" - -.text - function_add: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Addition operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - add $t2, $t0, $t1 # $t2 = $t0 + $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_sub: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Subtraction operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - sub $t2, $t0, $t1 # $t2 = $t0 - $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_mult: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Multiplication operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - mult $t0, $t1 # $t2 = $t0 * $t1 - mflo $t2 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_div: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Division operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - div $t0, $t1 # $t2 = $t0 / $t1 - mflo $t2 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_xor: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Xor operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_less_than: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Less than operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_less_than_or_equal: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Less than operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_equal: - # Function parameters - # $ra = 40($sp) - # a = 36($sp) - # b = 32($sp) - - # Reserving space for local variables - addi $sp, $sp, -32 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_0 = address of allocated object Int - - # internal_1 = typeof a that is the first word of the object - lw $t0, 36($sp) - lw $t0, 0($t0) - sw $t0, 24($sp) - - # internal_2 = direction of Int - la $t0, type_Int - sw $t0, 20($sp) - - # internal_3 = direction of Bool - la $t0, type_Bool - sw $t0, 16($sp) - - # internal_4 = direction of String - la $t0, type_String - sw $t0, 12($sp) - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_5 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_6 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_7 = address of allocated object Int - - # internal_5 = EqualAddress(internal_1, internal_2) - lw $t0, 24($sp) - lw $t1, 20($sp) - seq $t2, $t0, $t1 - lw $t0, 8($sp) - sw $t2, 8($t0) - - # internal_6 = EqualAddress(internal_1, internal_3) - lw $t0, 24($sp) - lw $t1, 16($sp) - seq $t2, $t0, $t1 - lw $t0, 4($sp) - sw $t2, 8($t0) - - # internal_7 = EqualAddress(internal_1, internal_4) - lw $t0, 24($sp) - lw $t1, 12($sp) - seq $t2, $t0, $t1 - lw $t0, 0($sp) - sw $t2, 8($t0) - - # If internal_5 then goto a_is_type_int_or_bool - lw $t0, 8($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, a_is_type_int_or_bool - - # If internal_6 then goto a_is_type_int_or_bool - lw $t0, 4($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, a_is_type_int_or_bool - - # If internal_7 then goto a_is_type_string - lw $t0, 0($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, a_is_type_string - - # Jumping to a_is_type_object - j a_is_type_object - - a_is_type_int_or_bool: - - # internal_0 = EqualInt(a, b) - lw $t0, 36($sp) - lw $t0, 8($t0) - lw $t1, 32($sp) - lw $t1, 8($t1) - seq $t2, $t0, $t1 - lw $t0, 28($sp) - sw $t2, 8($t0) - - # Jumping to end_of_equal - j end_of_equal - - a_is_type_string: - - # internal_0 = EqualStr(a, b) - lw $t0, 36($sp) - lw $t1, 32($sp) - addi $t0, $t0, 8 - addi $t1, $t1, 8 - - # By default we assume the strings are equals - addi $t4, $zero, 1 - lw $t5, 28($sp) - sw $t4, 8($t5) - - while_compare_strings_start: - lb $t2, 0($t0) - lb $t3, 0($t1) - beq $t2, $t3, while_compare_strings_update - - # The strings are no equals - lw $t5, 28($sp) - sw $zero, 8($t5) - j while_compare_strings_end - - while_compare_strings_update: - addi $t0, $t0, 1 - addi $t1, $t1, 1 - beq $t2, $zero, while_compare_strings_end - j while_compare_strings_start - while_compare_strings_end: - - # Jumping to end_of_equal - j end_of_equal - - a_is_type_object: - - # Equal operation - lw $t0, 36($sp) # Save in $t0 the left operand address - lw $t1, 32($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 - - lw $t0, 28($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # Jumping to end_of_equal - j end_of_equal - - end_of_equal: - - # Loading return value in $v1 - lw $v1, 28($sp) - - # Freeing space for local variables - addi $sp, $sp, 32 - - jr $ra - - function_assign: - # Function parameters - # $ra = 28($sp) - # dest = 24($sp) - # source = 20($sp) - - # Reserving space for local variables - addi $sp, $sp, -20 - - # internal_0 = typeof source that is the first word of the object - lw $t0, 20($sp) - lw $t0, 0($t0) - sw $t0, 16($sp) - - # internal_1 = direction of Int - la $t0, type_Int - sw $t0, 12($sp) - - # internal_2 = direction of Bool - la $t0, type_Bool - sw $t0, 8($sp) - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_3 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_4 = address of allocated object Int - - # internal_3 = EqualAddress(internal_1, internal_1) - lw $t0, 12($sp) - lw $t1, 12($sp) - seq $t2, $t0, $t1 - lw $t0, 4($sp) - sw $t2, 8($t0) - - # internal_4 = EqualAddress(internal_1, internal_2) - lw $t0, 12($sp) - lw $t1, 8($sp) - seq $t2, $t0, $t1 - lw $t0, 0($sp) - sw $t2, 8($t0) - - # If internal_3 then goto source_is_type_int_or_bool - lw $t0, 4($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, source_is_type_int_or_bool - - # If internal_4 then goto source_is_type_int_or_bool - lw $t0, 0($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, source_is_type_int_or_bool - - # Jumping to source_is_type_object - j source_is_type_object - - source_is_type_int_or_bool: - - # dest = source where source is an integer - li $v0, 9 - addi $a0, $zero, 12 - syscall - lw $t0, 20($sp) # Pointer to source - lw $t1, 0($t0) # $t1 = type of source - lw $t2, 8($t0) # $t2 = value of source - sw $t1, 0($v0) # Save type of dest - sw $a0, 4($v0) # Save size of dest - sw $t2, 8($v0) # Save value of dest - sw $v0, 24($sp) - - # Jumping to source_end_of_equal - j source_end_of_equal - - source_is_type_object: - - # dest = source - lw $t0, 20($sp) - sw $t0, 24($sp) - - # Jumping to source_end_of_equal - j source_end_of_equal - - source_end_of_equal: - - # Loading return value in $v1 - lw $v1, 24($sp) - - # Freeing space for local variables - addi $sp, $sp, 20 - - jr $ra - - function___init___at_Object: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_abort_at_Object: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Exit program - li $v0, 10 - syscall - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_type_name_at_Object: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = name of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($t0) # $t1 = type of self - lw $t2, 12($t1) # $t1 = length of the name of self - lw $t3, 16($t1) # $t1 = name of self - - addi $t2, $t2, 9 # Setting space for the type, the size and the null byte - li $v0, 9 - move $a0, $t2 - syscall - addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte - - la $t4, type_String - sw $t4, 0($v0) # Setting type in the first word of the object - - sw $a0, 4($v0) # Setting length in the second word of the object - - move $t4, $v0 # $t4 = direction of the new string - addi $t4, $t4, 8 # Pointer to the first character of the string - addi $t0, $t0, 8 # Pointer to the first character of the string in self - xor $t5, $t5, $t5 # Initializing counter - while_copy_name_start: - beq $t5, $t1, while_copy_name_end - lb $t6, 0($t0) # Loading the character - sb $t6, 0($t4) - addi $t4, $t4, 1 # Incrementing the pointer to the new string - addi $t0, $t0, 1 # Incrementing the pointer to the string in self - addi $t5, $t5, 1 # Incrementing counter - j while_copy_name_start - while_copy_name_end: - - sb $zero, 0($t4) # Setting the null byte - - sw $t4, 0($sp) # Storing the new string in internal_0 - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_copy_at_Object: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = copy of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($t0) # $t1 = type of self - lw $t2, 4($t0) # $t2 = length of self in bytes - - # Allocating space for the new object - li $v0, 9 - move $a0, $t2 - syscall - move $t3, $v0 # $t3 = direction of the new object - sw $t1, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - - # Initializing the variable of the loop - addi $t0, $t0, 8 # Pointer to the first character of the object - addi $t3, $t3, 8 # Pointer to the first character of the object - addi $t2, $2, -8 # Decrementing in 8 the length of the object - xor $t4, $t4, $t4 # Initializing counter - - # Loop copying the object - while_copy_start: - beq $t4, $t2, while_copy_end - lb $t5, 0($t0) # Loading the byte - sb $t5, 0($t3) # Storing the byte - addi $t0, $t0, 1 # Incrementing the pointer to the object - addi $t3, $t3, 1 # Incrementing the pointer to the new object - addi $t4, $t4, 1 # Incrementing counter - j while_copy_start - while_copy_end: - sw $v0, 0($sp) # Storing the new object in internal_0 - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function___init___at_IO: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_out_string_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - # x = 0($sp) - - lw $t0, 0($sp) # $t0 = x - addi $t0, $t0, 8 # Pointer to the first character of the string - - # Printing the string x - li $v0, 4 - move $a0, $t0 - syscall - - # Loading return value in $v1 - lw $v1, 4($sp) - - jr $ra - - function_out_int_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - # x = 0($sp) - - # Printing the string x - li $v0, 1 - lw $a0, 0($sp) - lw $a0, 8($a0) - syscall - - # Loading return value in $v1 - lw $v1, 4($sp) - - jr $ra - - function_in_string_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - li $v0, 8 - la $a0, buffer_input - li $a1, 1024 - syscall - - xor $t0, $t0, $t0 # Initializing counter - while_read_start: - lw $t1, buffer_input($t0) # Loading the byte - beq $t1, $zero, while_read_end - addi $t0, $t0, 1 # Incrementing counter - j while_read_start - while_read_end: - - addi $t0, $t0, 9 # Adding space for the type, the size and the null byte - li $v0, 9 - move $a0, $t0 - syscall - la $t2, type_String - sw $t2, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - - addi $t3, $v0, 8 # Pointer to the first character of the string - xor $t4, $t4, $t4 # Initializing counter - - while_copy_from_buffer_start: - beq $t4, $t0, while_copy_from_buffer_end - lw $t5, buffer_input($t4) # Loading the byte - sb $t5, 0($t3) # Storing the byte - addi $t3, $t3, 1 # Imcremeenting pointer - addi $t4, $t4, 1 # Incrementing counter - j while_copy_from_buffer_start - while_copy_from_buffer_end: - - sb $zero, 0($t3) # Storing the null byte - - sw $v0, 0($sp) # Storing the new object in internal_0 - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_in_int_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - li $v0, 5 - syscall - lw $t0, 0($sp) - sw $v0, 8($t0) - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function___init___at_String: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_length_at_String: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = length of self - lw $t0, 4($sp) - lw $t1, 4($t0) - addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator - sw $t1, 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_concat_at_String: - # Function parameters - # $ra = 12($sp) - # self = 8($sp) - # s = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = self + s - lw $t0, 8($sp) - lw $t1, 4($sp) - lw $t2, 4($t0) # $t2 = length of str1 - lw $t3, 4($t1) # $t3 = length of str2 - add $t4, $t2, $t3 # $t4 = length of str1 + str2 - addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) - - li $v0, 9 - move $a0, $t4 - syscall - addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 - add $t5, $zero, $v0 # $t5 = address of the new string object - addi $t5, $t5, 8 # $t5 = address of the first byte of the new string - - la $t8, type_String - sw $t8, 0($v0) # Setting type in the first word of th object - - sw $a0, 4($v0) # Setting length of the string in the second word of the object - - # Copying str1 to the new string - xor $t6, $t6, $t6 # $t6 = 0 Initializing counter - while_copy_str1_start: - beq $t6, $t2, while_copy_str1_end - lb $t7, 0($t0) - sb $t7, 0($t5) - add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_str1_start - while_copy_str1_end: - - # Copying str2 to the new string - while_copy_str2_start: - beq $t6, $t4, while_copy_str2_end - lb $t7, 0($t1) - sb $t7, 0($t5) - add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_str2_start - while_copy_str2_end: - - sb $zero, 0($t5) # Setting the null-terminator - - sw $v0, 0($sp) # internal_0 = self + s - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_substr_at_String: - # Function parameters - # $ra = 16($sp) - # self = 12($sp) - # i = 8($sp) - # l = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = self[i:i + l] - lw $t0, 12($sp) # $t0 = address of the string - lw $t1, 4($t0) # $t1 = length of the string - lw $t2, 8($sp) # $t2 = start of the substring - lw $t3, 4($sp) # $t3 = length of the substring - add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring - - bge $t4, $t1, substring_out_of_bounds - - addi $t3, $t3, 9 - li $v0, 9 - move $a0, $t3 - syscall - addi $t3, $t3, -9 - - la $t5, type_String - sw $t5, 0($v0) # Setting type in the first word of the object - - sw $a0, 4($v0) # Setting length in the second word of the object - - addi $t0, $t0, 8 # pointing to the first byte of the string - add $t0, $t0, $t2 # pointing to the first byte of the substring - move $t5, $v0 # $t5 = address of the new string - add $t5, $t5, 8 # pointing to the first byte of the string - xor $t6, $t6, $t6 # $t6 = 0 Initializing counter - while_copy_substr_start: - beq $t6, $t3, while_copy_substr_end - lb $t7, 0($t0) - sb $t7, 0($t5) - addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_substr_start - while_copy_substr_end: - - sb $zero, 0($t5) # Setting the null-terminator - - sw $v0, 0($sp) # internal_0 = self[i:i + l] - j substring_not_out_of_bounds - - substring_out_of_bounds: - li $v0, 17 - addi $a0, $zero, 1 - syscall - - substring_not_out_of_bounds: - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function___init___at_Main: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_main_at_Main: - # Function parameters - # $ra = 32($sp) - # self = 28($sp) - - # Reserving space for local variables - addi $sp, $sp, -28 - - # Allocating String - li $v0, 9 - addi $a0, $zero, 47 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 38 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 69 - sb $t0, 8($v0) # internal_0[0] = 'E' - - addi $t0, $zero, 110 - sb $t0, 9($v0) # internal_0[1] = 'n' - - addi $t0, $zero, 116 - sb $t0, 10($v0) # internal_0[2] = 't' - - addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_0[3] = 'e' - - addi $t0, $zero, 114 - sb $t0, 12($v0) # internal_0[4] = 'r' - - addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_0[5] = ' ' - - addi $t0, $zero, 110 - sb $t0, 14($v0) # internal_0[6] = 'n' - - addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_0[7] = ' ' - - addi $t0, $zero, 116 - sb $t0, 16($v0) # internal_0[8] = 't' - - addi $t0, $zero, 111 - sb $t0, 17($v0) # internal_0[9] = 'o' - - addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_0[10] = ' ' - - addi $t0, $zero, 102 - sb $t0, 19($v0) # internal_0[11] = 'f' - - addi $t0, $zero, 105 - sb $t0, 20($v0) # internal_0[12] = 'i' - - addi $t0, $zero, 110 - sb $t0, 21($v0) # internal_0[13] = 'n' - - addi $t0, $zero, 100 - sb $t0, 22($v0) # internal_0[14] = 'd' - - addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_0[15] = ' ' - - addi $t0, $zero, 110 - sb $t0, 24($v0) # internal_0[16] = 'n' - - addi $t0, $zero, 116 - sb $t0, 25($v0) # internal_0[17] = 't' - - addi $t0, $zero, 104 - sb $t0, 26($v0) # internal_0[18] = 'h' - - addi $t0, $zero, 32 - sb $t0, 27($v0) # internal_0[19] = ' ' - - addi $t0, $zero, 102 - sb $t0, 28($v0) # internal_0[20] = 'f' - - addi $t0, $zero, 105 - sb $t0, 29($v0) # internal_0[21] = 'i' - - addi $t0, $zero, 98 - sb $t0, 30($v0) # internal_0[22] = 'b' - - addi $t0, $zero, 111 - sb $t0, 31($v0) # internal_0[23] = 'o' - - addi $t0, $zero, 110 - sb $t0, 32($v0) # internal_0[24] = 'n' - - addi $t0, $zero, 97 - sb $t0, 33($v0) # internal_0[25] = 'a' - - addi $t0, $zero, 99 - sb $t0, 34($v0) # internal_0[26] = 'c' - - addi $t0, $zero, 99 - sb $t0, 35($v0) # internal_0[27] = 'c' - - addi $t0, $zero, 105 - sb $t0, 36($v0) # internal_0[28] = 'i' - - addi $t0, $zero, 32 - sb $t0, 37($v0) # internal_0[29] = ' ' - - addi $t0, $zero, 110 - sb $t0, 38($v0) # internal_0[30] = 'n' - - addi $t0, $zero, 117 - sb $t0, 39($v0) # internal_0[31] = 'u' - - addi $t0, $zero, 109 - sb $t0, 40($v0) # internal_0[32] = 'm' - - addi $t0, $zero, 98 - sb $t0, 41($v0) # internal_0[33] = 'b' - - addi $t0, $zero, 101 - sb $t0, 42($v0) # internal_0[34] = 'e' - - addi $t0, $zero, 114 - sb $t0, 43($v0) # internal_0[35] = 'r' - - addi $t0, $zero, 33 - sb $t0, 44($v0) # internal_0[36] = '!' - - addi $t0, $zero, 10 - sb $t0, 45($v0) # internal_0[37] = '\n' - - sb $zero, 46($v0) # Null-terminator at the end of the string - - sw $v0, 24($sp) # internal_0 = "Enter n to find nth fibonacci number!\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_0 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 32($sp) # internal_1 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument self - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_in_int_at_IO - jal function_in_int_at_IO - lw $ra, 4($sp) - sw $v1, 24($sp) # internal_2 = result of function_in_int_at_IO - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_2 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_fib_at_Main - jal function_fib_at_Main - lw $ra, 8($sp) - sw $v1, 24($sp) # internal_3 = result of function_fib_at_Main - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_3 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_3 - - # Calling function function_out_int_at_IO - jal function_out_int_at_IO - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_4 = result of function_out_int_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 1 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_5[0] = '\n' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 4($sp) # internal_5 = "\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_5 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_5 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_6 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 28 - - jr $ra - - function_fib_at_Main: - # Function parameters - # $ra = 60($sp) - # self = 56($sp) - # i = 52($sp) - - # Reserving space for local variables - addi $sp, $sp, -52 - - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_1 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument a - lw $t0, 60($sp) - sw $t0, 4($sp) # Storing a - - # Argument internal_1 - lw $t0, 56($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 60($sp) # a = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_3 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument b - lw $t0, 52($sp) - sw $t0, 4($sp) # Storing b - - # Argument internal_3 - lw $t0, 48($sp) - sw $t0, 0($sp) # Storing internal_3 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 52($sp) # b = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_5 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument c - lw $t0, 44($sp) - sw $t0, 4($sp) # Storing c - - # Argument internal_5 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_5 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 44($sp) # c = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - - while_start_8738608219667: - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_6 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument i - lw $t0, 64($sp) - sw $t0, 4($sp) # Storing i - - # Argument internal_6 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_6 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 32($sp) # internal_7 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_8 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_7 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_7 - - # Argument internal_8 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_8 - - # Calling function function_xor - jal function_xor - lw $ra, 8($sp) - sw $v1, 24($sp) # internal_9 = result of function_xor - addi $sp, $sp, 12 # Freeing space for arguments - - # If internal_9 then goto while_body_8738608219667 - lw $t0, 12($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8738608219667 - - # Jumping to while_end_8738608219667 - j while_end_8738608219667 - - while_body_8738608219667: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument a - lw $t0, 60($sp) - sw $t0, 4($sp) # Storing a - - # Argument b - lw $t0, 52($sp) - sw $t0, 0($sp) # Storing b - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_10 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument c - lw $t0, 44($sp) - sw $t0, 4($sp) # Storing c - - # Argument internal_10 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_10 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 44($sp) # c = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_11 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument i - lw $t0, 64($sp) - sw $t0, 4($sp) # Storing i - - # Argument internal_11 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_11 - - # Calling function function_sub - jal function_sub - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_12 = result of function_sub - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument i - lw $t0, 64($sp) - sw $t0, 4($sp) # Storing i - - # Argument internal_12 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_12 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 64($sp) # i = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument b - lw $t0, 52($sp) - sw $t0, 4($sp) # Storing b - - # Argument a - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing a - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 52($sp) # b = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument a - lw $t0, 60($sp) - sw $t0, 4($sp) # Storing a - - # Argument c - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing c - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 60($sp) # a = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Jumping to while_start_8738608219667 - j while_start_8738608219667 - - while_end_8738608219667: - - # Loading return value in $v1 - lw $v1, 32($sp) - - # Freeing space for local variables - addi $sp, $sp, 52 - - jr $ra - - main: - # Reserving space for local variables - addi $sp, $sp, -8 - - # Allocating Main - li $v0, 9 - lw $a0, type_Main - syscall - la $t0, type_Main # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object Main - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function___init___at_Main - jal function___init___at_Main - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_Main - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function_main_at_Main - jal function_main_at_Main - lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function_main_at_Main - addi $sp, $sp, 8 # Freeing space for arguments - - # Exit program - li $v0, 10 - syscall - - \ No newline at end of file diff --git a/src/fib.cil b/src/fib.cil deleted file mode 100644 index 1a90a80e5..000000000 --- a/src/fib.cil +++ /dev/null @@ -1,460 +0,0 @@ -.TYPES -type Object { - inherits from null - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method __init__: function___init___at_Object -} -type IO { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method out_string: function_out_string_at_IO - method out_int: function_out_int_at_IO - method in_string: function_in_string_at_IO - method in_int: function_in_int_at_IO - method __init__: function___init___at_IO -} -type Int { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method __init__: function___init___at_Int -} -type String { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method length: function_length_at_String - method concat: function_concat_at_String - method substr: function_substr_at_String - method __init__: function___init___at_String -} -type Bool { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method __init__: function___init___at_Bool -} -type Main { - inherits from IO - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method out_string: function_out_string_at_IO - method out_int: function_out_int_at_IO - method in_string: function_in_string_at_IO - method in_int: function_in_int_at_IO - method main: function_main_at_Main - method fib: function_fib_at_Main - method __init__: function___init___at_Main -} - -.DATA - - -.CODE -function function_add{ - PARAM a - PARAM b - - LOCAL internal_0 # Adding result - - internal_0 = ALLOCINT 0 - internal_0 = a + b - - RETURN internal_0 -} -function function_sub{ - PARAM a - PARAM b - - LOCAL internal_0 # Substracting result - - internal_0 = ALLOCINT 0 - internal_0 = a - b - - RETURN internal_0 -} -function function_mult{ - PARAM a - PARAM b - - LOCAL internal_0 # Multiting result - - internal_0 = ALLOCINT 0 - internal_0 = a * b - - RETURN internal_0 -} -function function_div{ - PARAM a - PARAM b - - LOCAL internal_0 # Dividing result - - internal_0 = ALLOCINT 0 - internal_0 = a / b - - RETURN internal_0 -} -function function_xor{ - PARAM a - PARAM b - - LOCAL internal_0 # Xor result - - internal_0 = ALLOCINT 0 - internal_0 = XOR a b - - RETURN internal_0 -} -function function_less_than{ - PARAM a - PARAM b - - LOCAL internal_0 # Less than result - - internal_0 = ALLOCBOOL 0 - internal_0 = a < b - - RETURN internal_0 -} -function function_less_than_or_equal{ - PARAM a - PARAM b - - LOCAL internal_0 # Less than or equal result - - internal_0 = ALLOCBOOL 0 - internal_0 = a <= b - - RETURN internal_0 -} -function function_equal{ - PARAM a - PARAM b - - LOCAL internal_0 # Equal result - LOCAL internal_1 # Type of a - LOCAL internal_2 # Type Int - LOCAL internal_3 # Type Bool - LOCAL internal_4 # Type String - LOCAL internal_5 # Type of a equals int - LOCAL internal_6 # Type of a equals bool - LOCAL internal_7 # Type of a equals string - - internal_0 = ALLOCBOOL 0 - internal_1 = TYPEOF a - internal_2 = TYPEADDR Int - internal_3 = TYPEADDR Bool - internal_4 = TYPEADDR String - internal_5 = ALLOCBOOL 0 - internal_6 = ALLOCBOOL 0 - internal_7 = ALLOCBOOL 0 - internal_5 = EQUALADDR internal_1 internal_2 - internal_6 = EQUALADDR internal_1 internal_3 - internal_7 = EQUALADDR internal_1 internal_4 - - IF internal_5 GOTO a_is_type_int_or_bool - IF internal_6 GOTO a_is_type_int_or_bool - IF internal_7 GOTO a_is_type_string - GOTO a_is_type_object - - a_is_type_int_or_bool: - internal_0 = EQUALINT a b - GOTO end_of_equal - - a_is_type_string: - internal_0 = EQUALSTR a b - GOTO end_of_equal - - a_is_type_object: - internal_0 = a == b - GOTO end_of_equal - - end_of_equal: - - RETURN internal_0 -} -function function_assign{ - PARAM dest - PARAM source - - LOCAL internal_0 # Type of source - LOCAL internal_1 # Type Int - LOCAL internal_2 # Type Bool - LOCAL internal_3 # Type of source equals int - LOCAL internal_4 # Type of source equals bool - - internal_0 = TYPEOF source - internal_1 = TYPEADDR Int - internal_2 = TYPEADDR Bool - internal_3 = ALLOCBOOL 0 - internal_4 = ALLOCBOOL 0 - internal_3 = EQUALADDR internal_1 internal_1 - internal_4 = EQUALADDR internal_1 internal_2 - - IF internal_3 GOTO source_is_type_int_or_bool - IF internal_4 GOTO source_is_type_int_or_bool - GOTO source_is_type_object - - source_is_type_int_or_bool: - dest = INT source - GOTO source_end_of_equal - - source_is_type_object: - dest = source - GOTO source_end_of_equal - - source_end_of_equal: - - RETURN dest -} -function function___init___at_Object{ - PARAM self - - RETURN self -} -function function_abort_at_Object{ - PARAM self - - HALT - - RETURN self -} -function function_type_name_at_Object{ - PARAM self - - LOCAL internal_0 # type_name - - internal_0 = TYPENAME self - - RETURN internal_0 -} -function function_copy_at_Object{ - PARAM self - - LOCAL internal_0 - - internal_0 = COPY self - - RETURN internal_0 -} -function function___init___at_IO{ - PARAM self - - RETURN self -} -function function_out_string_at_IO{ - PARAM self - PARAM x - - PRINTSTR x - - RETURN self -} -function function_out_int_at_IO{ - PARAM self - PARAM x - - PRINTINT x - - RETURN self -} -function function_in_string_at_IO{ - PARAM self - - LOCAL internal_0 - - READSTR internal_0 - - RETURN internal_0 -} -function function_in_int_at_IO{ - PARAM self - - LOCAL internal_0 - - internal_0 = ALLOCINT 0 - READINT internal_0 - - RETURN internal_0 -} -function function___init___at_String{ - PARAM self - - RETURN self -} -function function_length_at_String{ - PARAM self - - LOCAL internal_0 - - internal_0 = LENGTH self - - RETURN internal_0 -} -function function_concat_at_String{ - PARAM self - PARAM s - - LOCAL internal_0 - - internal_0 = CONCAT self s - - RETURN internal_0 -} -function function_substr_at_String{ - PARAM self - PARAM i - PARAM l - - LOCAL internal_0 - - internal_0 = SUBSTRING self i l - - RETURN internal_0 -} -function function___init___at_Main{ - PARAM self - - RETURN self -} -function function_main_at_Main{ - PARAM self - - LOCAL internal_0 # String "Enter n to find nth fibonacci number!\n" - LOCAL internal_1 - LOCAL internal_2 - LOCAL internal_3 - LOCAL internal_4 - LOCAL internal_5 # String "\n" - LOCAL internal_6 - - internal_0 = ALLOCSTR "Enter n to find nth fibonacci number!\n" - ARG self - ARG internal_0 - internal_1 = VCALL Main function_out_string_at_IO - ARG self - internal_2 = VCALL Main function_in_int_at_IO - ARG self - ARG internal_2 - internal_3 = VCALL Main function_fib_at_Main - ARG self - ARG internal_3 - internal_4 = VCALL Main function_out_int_at_IO - internal_5 = ALLOCSTR "\n" - ARG self - ARG internal_5 - internal_6 = VCALL Main function_out_string_at_IO - - RETURN internal_6 -} -function function_fib_at_Main{ - PARAM self - PARAM i - - LOCAL a - LOCAL internal_1 # Integer 1 - LOCAL b - LOCAL internal_3 # Integer 0 - LOCAL c - LOCAL internal_5 # Integer 0 - LOCAL internal_6 # Integer 0 - LOCAL internal_7 # Store the result of the operation function_equal - LOCAL internal_8 # Integer 1 - LOCAL internal_9 # Store the negation of internal_7 - LOCAL internal_10 # Store the result of the operation function_add - LOCAL internal_11 # Integer 1 - LOCAL internal_12 # Store the result of the operation function_sub - - # Let a: Int b: Int c: Int - - internal_1 = ALLOCINT 1 - ARG a - ARG internal_1 - a = CALL function_assign - - internal_3 = ALLOCINT 0 - ARG b - ARG internal_3 - b = CALL function_assign - - internal_5 = ALLOCINT 0 - ARG c - ARG internal_5 - c = CALL function_assign - - # While loop - while_start_8738608219667: - internal_6 = ALLOCINT 0 - - ARG i - ARG internal_6 - internal_7 = CALL function_equal - internal_8 = ALLOCINT 1 - ARG internal_7 - ARG internal_8 - internal_9 = CALL function_xor - IF internal_9 GOTO while_body_8738608219667 - GOTO while_end_8738608219667 - - while_body_8738608219667: - - ARG a - ARG b - internal_10 = CALL function_add - - ARG c - ARG internal_10 - c = CALL function_assign - internal_11 = ALLOCINT 1 - - ARG i - ARG internal_11 - internal_12 = CALL function_sub - - ARG i - ARG internal_12 - i = CALL function_assign - - ARG b - ARG a - b = CALL function_assign - - ARG a - ARG c - a = CALL function_assign - GOTO while_start_8738608219667 - - while_end_8738608219667: - - RETURN c -} -function main{ - - - LOCAL internal_0 - LOCAL internal_1 - - internal_0 = ALLOCATE Main - ARG internal_0 - internal_0 = VCALL Main function___init___at_Main - - ARG internal_0 - internal_1 = VCALL Main function_main_at_Main - - HALT -} \ No newline at end of file diff --git a/src/fib.cl b/src/fib.cl deleted file mode 100644 index cc763e460..000000000 --- a/src/fib.cl +++ /dev/null @@ -1,25 +0,0 @@ -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/src/io.asm b/src/io.asm deleted file mode 100644 index a2e52645c..000000000 --- a/src/io.asm +++ /dev/null @@ -1,1230 +0,0 @@ -.data - type_Object: .word 8 - type_Object_inherits_from: .word 0 - type_Object_attributes: .word 0 - type_Object_name_size: .word 6 - type_Object_name: .asciiz "Object" - - type_IO: .word 8 - type_IO_inherits_from: .word type_Object - type_IO_attributes: .word 0 - type_IO_name_size: .word 2 - type_IO_name: .asciiz "IO" - - type_Int: .word 8 - type_Int_inherits_from: .word type_Object - type_Int_attributes: .word 0 - type_Int_name_size: .word 3 - type_Int_name: .asciiz "Int" - - type_String: .word 8 - type_String_inherits_from: .word type_Object - type_String_attributes: .word 0 - type_String_name_size: .word 6 - type_String_name: .asciiz "String" - - type_Bool: .word 8 - type_Bool_inherits_from: .word type_Object - type_Bool_attributes: .word 0 - type_Bool_name_size: .word 4 - type_Bool_name: .asciiz "Bool" - - type_A: .word 12 - type_A_inherits_from: .word type_Object - type_A_attributes: .word 1 - type_A_name_size: .word 1 - type_A_name: .asciiz "A" - - type_B: .word 12 - type_B_inherits_from: .word type_A - type_B_attributes: .word 1 - type_B_name_size: .word 1 - type_B_name: .asciiz "B" - - type_C: .word 8 - type_C_inherits_from: .word type_IO - type_C_attributes: .word 0 - type_C_name_size: .word 1 - type_C_name: .asciiz "C" - - type_D: .word 8 - type_D_inherits_from: .word type_C - type_D_attributes: .word 0 - type_D_name_size: .word 1 - type_D_name: .asciiz "D" - - type_Main: .word 8 - type_Main_inherits_from: .word type_IO - type_Main_attributes: .word 0 - type_Main_name_size: .word 4 - type_Main_name: .asciiz "Main" - - buffer_input: .space 1024 - -.text - function___init___at_Object: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_abort_at_Object: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Exit program - li $v0, 10 - syscall - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_type_name_at_Object: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = name of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($t0) # $t1 = type of self - lw $t2, 12($t1) # $t1 = length of the name of self - lw $t3, 16($t1) # $t1 = name of self - - addi $t2, $t2, 9 # Setting space for the type, the size and the null byte - li $v0, 9 - move $a0, $t2 - syscall - addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte - - la $t4, type_String - sw $t4, 0($v0) # Setting type in the first word of the object - - sw $a0, 4($v0) # Setting length in the second word of the object - - move $t4, $v0 # $t4 = direction of the new string - addi $t4, $t4, 8 # Pointer to the first character of the string - addi $t0, $t0, 8 # Pointer to the first character of the string in self - xor $t5, $t5, $t5 # Initializing counter - while_copy_name_start: - beq $t5, $t1, while_copy_name_end - lb $t6, 0($t0) # Loading the character - sb $t6, 0($t4) - addi $t4, $t4, 1 # Incrementing the pointer to the new string - addi $t0, $t0, 1 # Incrementing the pointer to the string in self - addi $t5, $t5, 1 # Incrementing counter - j while_copy_name_start - while_copy_name_end: - - sb $zero, 0($t4) # Setting the null byte - - sw $t4, 0($sp) # Storing the new string in internal_0 - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_copy_at_Object: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = copy of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($t0) # $t1 = type of self - lw $t2, 4($t0) # $t2 = length of self in bytes - - # Allocating space for the new object - li $v0, 9 - move $a0, $t2 - syscall - move $t3, $v0 # $t3 = direction of the new object - sw $t1, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - - # Initializing the variable of the loop - addi $t0, $t0, 8 # Pointer to the first character of the object - addi $t3, $t3, 8 # Pointer to the first character of the object - addi $t2, $2, -8 # Decrementing in 8 the length of the object - xor $t4, $t4, $t4 # Initializing counter - - # Loop copying the object - while_copy_start: - beq $t4, $t2, while_copy_end - lb $t5, 0($t0) # Loading the byte - sb $t5, 0($t3) # Storing the byte - addi $t0, $t0, 1 # Incrementing the pointer to the object - addi $t3, $t3, 1 # Incrementing the pointer to the new object - addi $t4, $t4, 1 # Incrementing counter - j while_copy_start - while_copy_end: - sw $v0, 0($sp) # Storing the new object in internal_0 - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function___init___at_IO: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_out_string_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - # x = 0($sp) - - lw $t0, 0($sp) # $t0 = x - addi $t0, $t0, 8 # Pointer to the first character of the string - - # Printing the string x - li $v0, 4 - move $a0, $t0 - syscall - - # Loading return value in $v1 - lw $v1, 4($sp) - - jr $ra - - function_out_int_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - # x = 0($sp) - - # Printing the string x - li $v0, 1 - lw $a0, 0($sp) - syscall - - # Loading return value in $v1 - lw $v1, 4($sp) - - jr $ra - - function_in_string_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - li $v0, 8 - la $a0, buffer_input - li $a1, 1024 - syscall - - xor $t0, $t0, $t0 # Initializing counter - while_read_start: - lw $t1, buffer_input($t0) # Loading the byte - beq $t1, $zero, while_read_end - addi $t0, $t0, 1 # Incrementing counter - j while_read_start - while_read_end: - - addi $t0, $t0, 9 # Adding space for the type, the size and the null byte - li $v0, 9 - move $a0, $t0 - syscall - la $t2, type_String - sw $t2, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - - addi $t3, $v0, 8 # Pointer to the first character of the string - xor $t4, $t4, $t4 # Initializing counter - - while_copy_from_buffer_start: - beq $t4, $t0, while_copy_from_buffer_end - lw $t5, buffer_input($t4) # Loading the byte - sb $t5, 0($t3) # Storing the byte - addi $t3, $t3, 1 # Imcremeenting pointer - addi $t4, $t4, 1 # Incrementing counter - j while_copy_from_buffer_start - while_copy_from_buffer_end: - - sb $zero, 0($t3) # Storing the null byte - - sw $v0, 0($sp) # Storing the new object in internal_0 - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_in_int_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - li $v0, 5 - syscall - sw $v0, 0($sp) # Storing the new object in internal_0 - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function___init___at_String: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_length_at_String: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = length of self - lw $t0, 4($sp) - lw $t1, 4($t0) - addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator - sw $t1, 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_concat_at_String: - # Function parameters - # $ra = 12($sp) - # self = 8($sp) - # s = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = self + s - lw $t0, 8($sp) - lw $t1, 4($sp) - lw $t2, 4($t0) # $t2 = length of str1 - lw $t3, 4($t1) # $t3 = length of str2 - add $t4, $t2, $t3 # $t4 = length of str1 + str2 - addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) - - li $v0, 9 - move $a0, $t4 - syscall - addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 - add $t5, $zero, $v0 # $t5 = address of the new string object - addi $t5, $t5, 8 # $t5 = address of the first byte of the new string - - la $t8, type_String - sw $t8, 0($v0) # Setting type in the first word of th object - - sw $a0, 4($v0) # Setting length of the string in the second word of the object - - # Copying str1 to the new string - xor $t6, $t6, $t6 # $t6 = 0 Initializing counter - while_copy_str1_start: - beq $t6, $t2, while_copy_str1_end - lb $t7, 0($t0) - sb $t7, 0($t5) - add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_str1_start - while_copy_str1_end: - - # Copying str2 to the new string - while_copy_str2_start: - beq $t6, $t4, while_copy_str2_end - lb $t7, 0($t1) - sb $t7, 0($t5) - add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_str2_start - while_copy_str2_end: - - sb $zero, 0($t5) # Setting the null-terminator - - sw $v0, 0($sp) # internal_0 = self + s - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_substr_at_String: - # Function parameters - # $ra = 16($sp) - # self = 12($sp) - # i = 8($sp) - # l = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = self[i:i + l] - lw $t0, 12($sp) # $t0 = address of the string - lw $t1, 4($t0) # $t1 = length of the string - lw $t2, 8($sp) # $t2 = start of the substring - lw $t3, 4($sp) # $t3 = length of the substring - add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring - - bge $t4, $t1, substring_out_of_bounds - - addi $t3, $t3, 9 - li $v0, 9 - move $a0, $t3 - syscall - addi $t3, $t3, -9 - - la $t5, type_String - sw $t5, 0($v0) # Setting type in the first word of the object - - sw $a0, 4($v0) # Setting length in the second word of the object - - addi $t0, $t0, 8 # pointing to the first byte of the string - add $t0, $t0, $t2 # pointing to the first byte of the substring - move $t5, $v0 # $t5 = address of the new string - add $t5, $t5, 8 # pointing to the first byte of the string - xor $t6, $t6, $t6 # $t6 = 0 Initializing counter - while_copy_substr_start: - beq $t6, $t3, while_copy_substr_end - lb $t7, 0($t0) - sb $t7, 0($t5) - addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_substr_start - while_copy_substr_end: - - sb $zero, 0($t5) # Setting the null-terminator - - sw $v0, 0($sp) # internal_0 = self[i:i + l] - j substring_not_out_of_bounds - - substring_out_of_bounds: - li $v0, 17 - addi $a0, $zero, 1 - syscall - - substring_not_out_of_bounds: - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function___init___at_A: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating IO - li $v0, 9 - lw $a0, type_IO - syscall - la $t0, type_IO # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 0($sp) # internal_0 = address of allocated object IO - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 8($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function___init___at_IO - jal function___init___at_IO - lw $ra, 4($sp) - sw $v1, 8($sp) # internal_0 = result of function___init___at_IO - addi $sp, $sp, 8 # Freeing space for arguments - - # Set attribute io of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_0 - sw $t1, 8($t0) # self.io = internal_0 - - # Loading return value in $v1 - lw $v1, 4($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_out_a_at_A: - # Function parameters - # $ra = 16($sp) - # self = 12($sp) - - # Reserving space for local variables - addi $sp, $sp, -12 - - # Get attribute io of self - lw $t0, 12($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'io' from the instance - sw $t1, 8($sp) # internal_0 = io - - # Allocating String - li $v0, 9 - addi $a0, $zero, 24 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 15 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 65 - sb $t0, 8($v0) # internal_1[0] = 'A' - - addi $t0, $zero, 58 - sb $t0, 9($v0) # internal_1[1] = ':' - - addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_1[2] = ' ' - - addi $t0, $zero, 72 - sb $t0, 11($v0) # internal_1[3] = 'H' - - addi $t0, $zero, 101 - sb $t0, 12($v0) # internal_1[4] = 'e' - - addi $t0, $zero, 108 - sb $t0, 13($v0) # internal_1[5] = 'l' - - addi $t0, $zero, 108 - sb $t0, 14($v0) # internal_1[6] = 'l' - - addi $t0, $zero, 111 - sb $t0, 15($v0) # internal_1[7] = 'o' - - addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_1[8] = ' ' - - addi $t0, $zero, 119 - sb $t0, 17($v0) # internal_1[9] = 'w' - - addi $t0, $zero, 111 - sb $t0, 18($v0) # internal_1[10] = 'o' - - addi $t0, $zero, 114 - sb $t0, 19($v0) # internal_1[11] = 'r' - - addi $t0, $zero, 108 - sb $t0, 20($v0) # internal_1[12] = 'l' - - addi $t0, $zero, 100 - sb $t0, 21($v0) # internal_1[13] = 'd' - - addi $t0, $zero, 10 - sb $t0, 22($v0) # internal_1[14] = '\n' - - sb $zero, 23($v0) # Null-terminator at the end of the string - - sw $v0, 4($sp) # internal_1 = "A: Hello world\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_0 - lw $t0, 20($sp) - sw $t0, 4($sp) # Storing internal_0 - - # Argument internal_1 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_2 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 12 - - jr $ra - - function___init___at_B: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating IO - li $v0, 9 - lw $a0, type_IO - syscall - la $t0, type_IO # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 0($sp) # internal_0 = address of allocated object IO - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 8($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function___init___at_IO - jal function___init___at_IO - lw $ra, 4($sp) - sw $v1, 8($sp) # internal_0 = result of function___init___at_IO - addi $sp, $sp, 8 # Freeing space for arguments - - # Set attribute io of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_0 - sw $t1, 8($t0) # self.io = internal_0 - - # Loading return value in $v1 - lw $v1, 4($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_out_b_at_B: - # Function parameters - # $ra = 16($sp) - # self = 12($sp) - - # Reserving space for local variables - addi $sp, $sp, -12 - - # Get attribute io of self - lw $t0, 12($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'io' from the instance - sw $t1, 8($sp) # internal_0 = io - - # Allocating String - li $v0, 9 - addi $a0, $zero, 24 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 15 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 66 - sb $t0, 8($v0) # internal_1[0] = 'B' - - addi $t0, $zero, 58 - sb $t0, 9($v0) # internal_1[1] = ':' - - addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_1[2] = ' ' - - addi $t0, $zero, 72 - sb $t0, 11($v0) # internal_1[3] = 'H' - - addi $t0, $zero, 101 - sb $t0, 12($v0) # internal_1[4] = 'e' - - addi $t0, $zero, 108 - sb $t0, 13($v0) # internal_1[5] = 'l' - - addi $t0, $zero, 108 - sb $t0, 14($v0) # internal_1[6] = 'l' - - addi $t0, $zero, 111 - sb $t0, 15($v0) # internal_1[7] = 'o' - - addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_1[8] = ' ' - - addi $t0, $zero, 119 - sb $t0, 17($v0) # internal_1[9] = 'w' - - addi $t0, $zero, 111 - sb $t0, 18($v0) # internal_1[10] = 'o' - - addi $t0, $zero, 114 - sb $t0, 19($v0) # internal_1[11] = 'r' - - addi $t0, $zero, 108 - sb $t0, 20($v0) # internal_1[12] = 'l' - - addi $t0, $zero, 100 - sb $t0, 21($v0) # internal_1[13] = 'd' - - addi $t0, $zero, 10 - sb $t0, 22($v0) # internal_1[14] = '\n' - - sb $zero, 23($v0) # Null-terminator at the end of the string - - sw $v0, 4($sp) # internal_1 = "B: Hello world\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_0 - lw $t0, 20($sp) - sw $t0, 4($sp) # Storing internal_0 - - # Argument internal_1 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_2 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 12 - - jr $ra - - function___init___at_C: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_out_c_at_C: - # Function parameters - # $ra = 12($sp) - # self = 8($sp) - - # Reserving space for local variables - addi $sp, $sp, -8 - - # Allocating String - li $v0, 9 - addi $a0, $zero, 24 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 15 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 67 - sb $t0, 8($v0) # internal_0[0] = 'C' - - addi $t0, $zero, 58 - sb $t0, 9($v0) # internal_0[1] = ':' - - addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_0[2] = ' ' - - addi $t0, $zero, 72 - sb $t0, 11($v0) # internal_0[3] = 'H' - - addi $t0, $zero, 101 - sb $t0, 12($v0) # internal_0[4] = 'e' - - addi $t0, $zero, 108 - sb $t0, 13($v0) # internal_0[5] = 'l' - - addi $t0, $zero, 108 - sb $t0, 14($v0) # internal_0[6] = 'l' - - addi $t0, $zero, 111 - sb $t0, 15($v0) # internal_0[7] = 'o' - - addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_0[8] = ' ' - - addi $t0, $zero, 119 - sb $t0, 17($v0) # internal_0[9] = 'w' - - addi $t0, $zero, 111 - sb $t0, 18($v0) # internal_0[10] = 'o' - - addi $t0, $zero, 114 - sb $t0, 19($v0) # internal_0[11] = 'r' - - addi $t0, $zero, 108 - sb $t0, 20($v0) # internal_0[12] = 'l' - - addi $t0, $zero, 100 - sb $t0, 21($v0) # internal_0[13] = 'd' - - addi $t0, $zero, 10 - sb $t0, 22($v0) # internal_0[14] = '\n' - - sb $zero, 23($v0) # Null-terminator at the end of the string - - sw $v0, 4($sp) # internal_0 = "C: Hello world\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 20($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_0 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_1 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 8 - - jr $ra - - function___init___at_D: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_out_d_at_D: - # Function parameters - # $ra = 12($sp) - # self = 8($sp) - - # Reserving space for local variables - addi $sp, $sp, -8 - - # Allocating String - li $v0, 9 - addi $a0, $zero, 24 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 15 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 68 - sb $t0, 8($v0) # internal_0[0] = 'D' - - addi $t0, $zero, 58 - sb $t0, 9($v0) # internal_0[1] = ':' - - addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_0[2] = ' ' - - addi $t0, $zero, 72 - sb $t0, 11($v0) # internal_0[3] = 'H' - - addi $t0, $zero, 101 - sb $t0, 12($v0) # internal_0[4] = 'e' - - addi $t0, $zero, 108 - sb $t0, 13($v0) # internal_0[5] = 'l' - - addi $t0, $zero, 108 - sb $t0, 14($v0) # internal_0[6] = 'l' - - addi $t0, $zero, 111 - sb $t0, 15($v0) # internal_0[7] = 'o' - - addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_0[8] = ' ' - - addi $t0, $zero, 119 - sb $t0, 17($v0) # internal_0[9] = 'w' - - addi $t0, $zero, 111 - sb $t0, 18($v0) # internal_0[10] = 'o' - - addi $t0, $zero, 114 - sb $t0, 19($v0) # internal_0[11] = 'r' - - addi $t0, $zero, 108 - sb $t0, 20($v0) # internal_0[12] = 'l' - - addi $t0, $zero, 100 - sb $t0, 21($v0) # internal_0[13] = 'd' - - addi $t0, $zero, 10 - sb $t0, 22($v0) # internal_0[14] = '\n' - - sb $zero, 23($v0) # Null-terminator at the end of the string - - sw $v0, 4($sp) # internal_0 = "D: Hello world\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 20($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_0 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_1 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 8 - - jr $ra - - function___init___at_Main: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_main_at_Main: - # Function parameters - # $ra = 44($sp) - # self = 40($sp) - - # Reserving space for local variables - addi $sp, $sp, -40 - - # Allocating A - li $v0, 9 - lw $a0, type_A - syscall - la $t0, type_A # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 36($sp) # internal_0 = address of allocated object A - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function___init___at_A - jal function___init___at_A - lw $ra, 4($sp) - sw $v1, 44($sp) # internal_0 = result of function___init___at_A - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function_out_a_at_A - jal function_out_a_at_A - lw $ra, 4($sp) - sw $v1, 40($sp) # internal_1 = result of function_out_a_at_A - addi $sp, $sp, 8 # Freeing space for arguments - - # Allocating B - li $v0, 9 - lw $a0, type_B - syscall - la $t0, type_B # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 28($sp) # internal_2 = address of allocated object B - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_2 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function___init___at_B - jal function___init___at_B - lw $ra, 4($sp) - sw $v1, 36($sp) # internal_2 = result of function___init___at_B - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_2 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_out_b_at_B - jal function_out_b_at_B - lw $ra, 4($sp) - sw $v1, 32($sp) # internal_3 = result of function_out_b_at_B - addi $sp, $sp, 8 # Freeing space for arguments - - # Allocating C - li $v0, 9 - lw $a0, type_C - syscall - la $t0, type_C # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 20($sp) # internal_4 = address of allocated object C - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_4 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_4 - - # Calling function function___init___at_C - jal function___init___at_C - lw $ra, 4($sp) - sw $v1, 28($sp) # internal_4 = result of function___init___at_C - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_4 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_4 - - # Calling function function_out_c_at_C - jal function_out_c_at_C - lw $ra, 4($sp) - sw $v1, 24($sp) # internal_5 = result of function_out_c_at_C - addi $sp, $sp, 8 # Freeing space for arguments - - # Allocating D - li $v0, 9 - lw $a0, type_D - syscall - la $t0, type_D # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 12($sp) # internal_6 = address of allocated object D - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_6 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_6 - - # Calling function function___init___at_D - jal function___init___at_D - lw $ra, 4($sp) - sw $v1, 20($sp) # internal_6 = result of function___init___at_D - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_6 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_6 - - # Calling function function_out_d_at_D - jal function_out_d_at_D - lw $ra, 4($sp) - sw $v1, 16($sp) # internal_7 = result of function_out_d_at_D - addi $sp, $sp, 8 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 15 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 6 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 68 - sb $t0, 8($v0) # internal_8[0] = 'D' - - addi $t0, $zero, 111 - sb $t0, 9($v0) # internal_8[1] = 'o' - - addi $t0, $zero, 110 - sb $t0, 10($v0) # internal_8[2] = 'n' - - addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_8[3] = 'e' - - addi $t0, $zero, 46 - sb $t0, 12($v0) # internal_8[4] = '.' - - addi $t0, $zero, 10 - sb $t0, 13($v0) # internal_8[5] = '\n' - - sb $zero, 14($v0) # Null-terminator at the end of the string - - sw $v0, 4($sp) # internal_8 = "Done.\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 52($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_8 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_8 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_9 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 40 - - jr $ra - - main: - # Reserving space for local variables - addi $sp, $sp, -8 - - # Allocating Main - li $v0, 9 - lw $a0, type_Main - syscall - la $t0, type_Main # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object Main - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function___init___at_Main - jal function___init___at_Main - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_Main - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function_main_at_Main - jal function_main_at_Main - lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function_main_at_Main - addi $sp, $sp, 8 # Freeing space for arguments - - # Exit program - li $v0, 10 - syscall - - \ No newline at end of file diff --git a/src/io.cil b/src/io.cil deleted file mode 100644 index a9898adc6..000000000 --- a/src/io.cil +++ /dev/null @@ -1,371 +0,0 @@ -.TYPES -type Object { - inherits from null - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method __init__: function___init___at_Object -} -type IO { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method out_string: function_out_string_at_IO - method out_int: function_out_int_at_IO - method in_string: function_in_string_at_IO - method in_int: function_in_int_at_IO - method __init__: function___init___at_IO -} -type Int { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method __init__: function___init___at_Int -} -type String { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method length: function_length_at_String - method concat: function_concat_at_String - method substr: function_substr_at_String - method __init__: function___init___at_String -} -type Bool { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method __init__: function___init___at_Bool -} -type A { - inherits from Object - - attribute io - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method out_a: function_out_a_at_A - method __init__: function___init___at_A -} -type B { - inherits from A - - attribute io - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method out_a: function_out_a_at_A - method __init__: function___init___at_B - method out_b: function_out_b_at_B -} -type C { - inherits from IO - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method out_string: function_out_string_at_IO - method out_int: function_out_int_at_IO - method in_string: function_in_string_at_IO - method in_int: function_in_int_at_IO - method out_c: function_out_c_at_C - method __init__: function___init___at_C -} -type D { - inherits from C - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method out_string: function_out_string_at_IO - method out_int: function_out_int_at_IO - method in_string: function_in_string_at_IO - method in_int: function_in_int_at_IO - method out_c: function_out_c_at_C - method __init__: function___init___at_D - method out_d: function_out_d_at_D -} -type Main { - inherits from IO - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method out_string: function_out_string_at_IO - method out_int: function_out_int_at_IO - method in_string: function_in_string_at_IO - method in_int: function_in_int_at_IO - method main: function_main_at_Main - method __init__: function___init___at_Main -} - -.DATA - - -.CODE -function function___init___at_Object{ - PARAM self - - RETURN self -} -function function_abort_at_Object{ - PARAM self - - HALT - - RETURN self -} -function function_type_name_at_Object{ - PARAM self - - LOCAL internal_0 # type_name - - internal_0 = TYPENAME self - - RETURN internal_0 -} -function function_copy_at_Object{ - PARAM self - - LOCAL internal_0 - - internal_0 = COPY self - - RETURN internal_0 -} -function function___init___at_IO{ - PARAM self - - RETURN self -} -function function_out_string_at_IO{ - PARAM self - PARAM x - - PRINTSTR x - - RETURN self -} -function function_out_int_at_IO{ - PARAM self - PARAM x - - PRINTINT x - - RETURN self -} -function function_in_string_at_IO{ - PARAM self - - LOCAL internal_0 - - READSTR internal_0 - - RETURN internal_0 -} -function function_in_int_at_IO{ - PARAM self - - LOCAL internal_0 - - READINT internal_0 - - RETURN internal_0 -} -function function___init___at_String{ - PARAM self - - RETURN self -} -function function_length_at_String{ - PARAM self - - LOCAL internal_0 - - internal_0 = LENGTH self - - RETURN internal_0 -} -function function_concat_at_String{ - PARAM self - PARAM s - - LOCAL internal_0 - - internal_0 = CONCAT self s - - RETURN internal_0 -} -function function_substr_at_String{ - PARAM self - PARAM i - PARAM l - - LOCAL internal_0 - - internal_0 = SUBSTRING self i l - - RETURN internal_0 -} -function function___init___at_A{ - PARAM self - - LOCAL internal_0 # Store an instance of the class IO - - internal_0 = ALLOCATE IO # Allocate the object IO - ARG internal_0 # Pass the instance to the constructor - internal_0 = VCALL IO function___init___at_IO # Call the constructor - SETATTR self io internal_0 - - RETURN self -} -function function_out_a_at_A{ - PARAM self - - LOCAL internal_0 - LOCAL internal_1 # String "A: Hello world\n" - LOCAL internal_2 - - internal_0 = GETATTR self io - internal_1 = ALLOCSTR "A: Hello world\n" - ARG internal_0 - ARG internal_1 - internal_2 = VCALL IO function_out_string_at_IO - - RETURN internal_2 -} -function function___init___at_B{ - PARAM self - - LOCAL internal_0 # Store an instance of the class IO - - internal_0 = ALLOCATE IO # Allocate the object IO - ARG internal_0 # Pass the instance to the constructor - internal_0 = VCALL IO function___init___at_IO # Call the constructor - SETATTR self io internal_0 - - RETURN self -} -function function_out_b_at_B{ - PARAM self - - LOCAL internal_0 - LOCAL internal_1 # String "B: Hello world\n" - LOCAL internal_2 - - internal_0 = GETATTR self io - internal_1 = ALLOCSTR "B: Hello world\n" - ARG internal_0 - ARG internal_1 - internal_2 = VCALL IO function_out_string_at_IO - - RETURN internal_2 -} -function function___init___at_C{ - PARAM self - - RETURN self -} -function function_out_c_at_C{ - PARAM self - - LOCAL internal_0 # String "C: Hello world\n" - LOCAL internal_1 - - internal_0 = ALLOCSTR "C: Hello world\n" - ARG self - ARG internal_0 - internal_1 = VCALL C function_out_string_at_IO - - RETURN internal_1 -} -function function___init___at_D{ - PARAM self - - RETURN self -} -function function_out_d_at_D{ - PARAM self - - LOCAL internal_0 # String "D: Hello world\n" - LOCAL internal_1 - - internal_0 = ALLOCSTR "D: Hello world\n" - ARG self - ARG internal_0 - internal_1 = VCALL D function_out_string_at_IO - - RETURN internal_1 -} -function function___init___at_Main{ - PARAM self - - RETURN self -} -function function_main_at_Main{ - PARAM self - - LOCAL internal_0 # Store an instance of the class A - LOCAL internal_1 - LOCAL internal_2 # Store an instance of the class B - LOCAL internal_3 - LOCAL internal_4 # Store an instance of the class C - LOCAL internal_5 - LOCAL internal_6 # Store an instance of the class D - LOCAL internal_7 - LOCAL internal_8 # String "Done.\n" - LOCAL internal_9 - - internal_0 = ALLOCATE A # Allocate the object A - ARG internal_0 # Pass the instance to the constructor - internal_0 = VCALL A function___init___at_A # Call the constructor - ARG internal_0 - internal_1 = VCALL A function_out_a_at_A - internal_2 = ALLOCATE B # Allocate the object B - ARG internal_2 # Pass the instance to the constructor - internal_2 = VCALL B function___init___at_B # Call the constructor - ARG internal_2 - internal_3 = VCALL B function_out_b_at_B - internal_4 = ALLOCATE C # Allocate the object C - ARG internal_4 # Pass the instance to the constructor - internal_4 = VCALL C function___init___at_C # Call the constructor - ARG internal_4 - internal_5 = VCALL C function_out_c_at_C - internal_6 = ALLOCATE D # Allocate the object D - ARG internal_6 # Pass the instance to the constructor - internal_6 = VCALL D function___init___at_D # Call the constructor - ARG internal_6 - internal_7 = VCALL D function_out_d_at_D - internal_8 = ALLOCSTR "Done.\n" - ARG self - ARG internal_8 - internal_9 = VCALL Main function_out_string_at_IO - - RETURN internal_9 -} -function main{ - - - LOCAL internal_0 - LOCAL internal_1 - - internal_0 = ALLOCATE Main - ARG internal_0 - internal_0 = VCALL Main function___init___at_Main - - ARG internal_0 - internal_1 = VCALL Main function_main_at_Main - - HALT -} \ No newline at end of file diff --git a/src/io.cl b/src/io.cl deleted file mode 100755 index 3e5ef4a94..000000000 --- a/src/io.cl +++ /dev/null @@ -1,103 +0,0 @@ -(* - * 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/src/logs.txt b/src/logs.txt deleted file mode 100644 index 82959fe14..000000000 --- a/src/logs.txt +++ /dev/null @@ -1,21 +0,0 @@ -SPIM Version 8.0 of January 8, 2010 -Copyright 1990-2010, James R. Larus. -All Rights Reserved. -See the file README for a full copyright notice. -Loaded: /usr/lib/spim/exceptions.s - Exception 7 [Bad data address] occurred and ignored - Exception 7 [Bad data address] occurred and ignored -number 0 is even! -Class type is now A - - To add a number to 0 ...enter a: - To negate 0 ...enter b: - To find the difference between 0 and another number...enter c: - To find the factorial of 0 ...enter d: - To square 0 ...enter e: - To cube 0 ...enter f: - To find out if 0 is a multiple of 3...enter g: - To divide 0 by 8...enter h: - To get a new number...enter j: - To quit...enter q: - diff --git a/src/main.asm b/src/main.asm deleted file mode 100644 index 8e87a975b..000000000 --- a/src/main.asm +++ /dev/null @@ -1,1442 +0,0 @@ -.data - type_Object: .word 8 - type_Object_inherits_from: .word 0 - type_Object_attributes: .word 0 - type_Object_name_size: .word 6 - type_Object_name: .asciiz "Object" - type_Object_abort_message: .asciiz "Abort called from class Object\n" - - type_IO: .word 8 - type_IO_inherits_from: .word type_Object - type_IO_attributes: .word 0 - type_IO_name_size: .word 2 - type_IO_name: .asciiz "IO" - type_IO_abort_message: .asciiz "Abort called from class IO\n" - - type_Int: .word 8 - type_Int_inherits_from: .word type_Object - type_Int_attributes: .word 0 - type_Int_name_size: .word 3 - type_Int_name: .asciiz "Int" - type_Int_abort_message: .asciiz "Abort called from class Int\n" - - type_String: .word 8 - type_String_inherits_from: .word type_Object - type_String_attributes: .word 0 - type_String_name_size: .word 6 - type_String_name: .asciiz "String" - type_String_abort_message: .asciiz "Abort called from class String\n" - - type_Bool: .word 8 - type_Bool_inherits_from: .word type_Object - type_Bool_attributes: .word 0 - type_Bool_name_size: .word 4 - type_Bool_name: .asciiz "Bool" - type_Bool_abort_message: .asciiz "Abort called from class Bool\n" - - type_Main: .word 12 - type_Main_inherits_from: .word type_IO - type_Main_attributes: .word 1 - type_Main_name_size: .word 4 - type_Main_name: .asciiz "Main" - type_Main_abort_message: .asciiz "Abort called from class Main\n" - - buffer_input: .space 1024 - debug_log: .asciiz "debug_log\n" - -.text - function_add: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Addition operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - add $t2, $t0, $t1 # $t2 = $t0 + $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_sub: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Subtraction operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - sub $t2, $t0, $t1 # $t2 = $t0 - $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_mult: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Multiplication operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - mult $t0, $t1 # $t2 = $t0 * $t1 - mflo $t2 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_div: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Division operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - div $t0, $t1 # $t2 = $t0 / $t1 - mflo $t2 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_xor: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Xor operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_less_than: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Less than operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_less_than_or_equal: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Less than operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_equal: - # Function parameters - # $ra = 48($sp) - # a = 44($sp) - # b = 40($sp) - - # Reserving space for local variables - addi $sp, $sp, -40 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_0 = address of allocated object Int - - # Allocating NUll to internal_1 - sw $zero, 32($sp) # internal_1 = 0 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_2 = address of allocated object Int - - # internal_2 = EqualAddress(a, internal_1) - lw $t0, 44($sp) - lw $t1, 32($sp) - seq $t2, $t0, $t1 - lw $t0, 28($sp) - sw $t2, 8($t0) - - # internal_2 = EqualAddress(b, internal_1) - lw $t0, 40($sp) - lw $t1, 32($sp) - seq $t2, $t0, $t1 - lw $t0, 28($sp) - sw $t2, 8($t0) - - # If internal_2 then goto a_is_type_object - lw $t0, 28($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, a_is_type_object - - # internal_3 = typeof a that is the first word of the object - lw $t0, 44($sp) - lw $t0, 0($t0) - sw $t0, 24($sp) - - # internal_4 = direction of Int - la $t0, type_Int - sw $t0, 20($sp) - - # internal_5 = direction of Bool - la $t0, type_Bool - sw $t0, 16($sp) - - # internal_6 = direction of String - la $t0, type_String - sw $t0, 12($sp) - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_7 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_8 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_9 = address of allocated object Int - - # internal_7 = EqualAddress(internal_3, internal_4) - lw $t0, 24($sp) - lw $t1, 20($sp) - seq $t2, $t0, $t1 - lw $t0, 8($sp) - sw $t2, 8($t0) - - # internal_8 = EqualAddress(internal_3, internal_5) - lw $t0, 24($sp) - lw $t1, 16($sp) - seq $t2, $t0, $t1 - lw $t0, 4($sp) - sw $t2, 8($t0) - - # internal_9 = EqualAddress(internal_3, internal_6) - lw $t0, 24($sp) - lw $t1, 12($sp) - seq $t2, $t0, $t1 - lw $t0, 0($sp) - sw $t2, 8($t0) - - # If internal_7 then goto a_is_type_int_or_bool - lw $t0, 8($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, a_is_type_int_or_bool - - # If internal_8 then goto a_is_type_int_or_bool - lw $t0, 4($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, a_is_type_int_or_bool - - # If internal_9 then goto a_is_type_string - lw $t0, 0($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, a_is_type_string - - # Jumping to a_is_type_object - j a_is_type_object - - a_is_type_int_or_bool: - - # internal_0 = EqualInt(a, b) - lw $t0, 44($sp) - lw $t0, 8($t0) - lw $t1, 40($sp) - lw $t1, 8($t1) - seq $t2, $t0, $t1 - lw $t0, 36($sp) - sw $t2, 8($t0) - - # Jumping to end_of_equal - j end_of_equal - - a_is_type_string: - - # internal_0 = EqualStr(a, b) - lw $t0, 44($sp) - lw $t1, 40($sp) - addi $t0, $t0, 8 - addi $t1, $t1, 8 - - # By default we assume the strings are equals - addi $t4, $zero, 1 - lw $t5, 36($sp) - sw $t4, 8($t5) - - while_compare_strings_start: - lb $t2, 0($t0) - lb $t3, 0($t1) - beq $t2, $t3, while_compare_strings_update - - # The strings are no equals - lw $t5, 36($sp) - sw $zero, 8($t5) - j while_compare_strings_end - - while_compare_strings_update: - addi $t0, $t0, 1 - addi $t1, $t1, 1 - beq $t2, $zero, while_compare_strings_end - beq $t3, $zero, while_compare_strings_end - j while_compare_strings_start - while_compare_strings_end: - - # Jumping to end_of_equal - j end_of_equal - - a_is_type_object: - - # Equal operation - lw $t0, 44($sp) # Save in $t0 the left operand address - lw $t1, 40($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 - - lw $t0, 36($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # Jumping to end_of_equal - j end_of_equal - - end_of_equal: - - # Loading return value in $v1 - lw $v1, 36($sp) - - # Freeing space for local variables - addi $sp, $sp, 40 - - jr $ra - - function_assign: - # Function parameters - # $ra = 36($sp) - # dest = 32($sp) - # source = 28($sp) - - # Reserving space for local variables - addi $sp, $sp, -28 - - # Allocating NUll to internal_0 - sw $zero, 24($sp) # internal_0 = 0 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_1 = address of allocated object Int - - # internal_1 = EqualAddress(source, internal_0) - lw $t0, 28($sp) - lw $t1, 24($sp) - seq $t2, $t0, $t1 - lw $t0, 20($sp) - sw $t2, 8($t0) - - # internal_1 = EqualAddress(dest, internal_0) - lw $t0, 32($sp) - lw $t1, 24($sp) - seq $t2, $t0, $t1 - lw $t0, 20($sp) - sw $t2, 8($t0) - - # If internal_1 then goto source_is_type_object - lw $t0, 20($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, source_is_type_object - - # internal_2 = typeof source that is the first word of the object - lw $t0, 28($sp) - lw $t0, 0($t0) - sw $t0, 16($sp) - - # internal_3 = direction of Int - la $t0, type_Int - sw $t0, 12($sp) - - # internal_4 = direction of Bool - la $t0, type_Bool - sw $t0, 8($sp) - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_5 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_6 = address of allocated object Int - - # internal_5 = EqualAddress(internal_2, internal_3) - lw $t0, 16($sp) - lw $t1, 12($sp) - seq $t2, $t0, $t1 - lw $t0, 4($sp) - sw $t2, 8($t0) - - # internal_6 = EqualAddress(internal_2, internal_4) - lw $t0, 16($sp) - lw $t1, 8($sp) - seq $t2, $t0, $t1 - lw $t0, 0($sp) - sw $t2, 8($t0) - - # If internal_5 then goto source_is_type_int_or_bool - lw $t0, 4($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, source_is_type_int_or_bool - - # If internal_6 then goto source_is_type_int_or_bool - lw $t0, 0($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, source_is_type_int_or_bool - - # Jumping to source_is_type_object - j source_is_type_object - - source_is_type_int_or_bool: - - # dest = source where source is an integer - li $v0, 9 - addi $a0, $zero, 12 - syscall - lw $t0, 28($sp) # Pointer to source - lw $t1, 0($t0) # $t1 = type of source - lw $t2, 8($t0) # $t2 = value of source - sw $t1, 0($v0) # Save type of dest - sw $a0, 4($v0) # Save size of dest - sw $t2, 8($v0) # Save value of dest - sw $v0, 32($sp) - - # Jumping to source_end_of_equal - j source_end_of_equal - - source_is_type_object: - - # dest = source - lw $t0, 28($sp) - sw $t0, 32($sp) - - # Jumping to source_end_of_equal - j source_end_of_equal - - source_end_of_equal: - - # Loading return value in $v1 - lw $v1, 32($sp) - - # Freeing space for local variables - addi $sp, $sp, 28 - - jr $ra - - function___init___at_Object: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_abort_at_Object: - # Function parameters - # $ra = 20($sp) - # self = 16($sp) - - # Reserving space for local variables - addi $sp, $sp, -16 - - # Allocating String - li $v0, 9 - addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 33 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 65 - sb $t0, 8($v0) # internal_0[0] = 'A' - - addi $t0, $zero, 98 - sb $t0, 9($v0) # internal_0[1] = 'b' - - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_0[2] = 'o' - - addi $t0, $zero, 114 - sb $t0, 11($v0) # internal_0[3] = 'r' - - addi $t0, $zero, 116 - sb $t0, 12($v0) # internal_0[4] = 't' - - addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_0[5] = ' ' - - addi $t0, $zero, 99 - sb $t0, 14($v0) # internal_0[6] = 'c' - - addi $t0, $zero, 97 - sb $t0, 15($v0) # internal_0[7] = 'a' - - addi $t0, $zero, 108 - sb $t0, 16($v0) # internal_0[8] = 'l' - - addi $t0, $zero, 108 - sb $t0, 17($v0) # internal_0[9] = 'l' - - addi $t0, $zero, 101 - sb $t0, 18($v0) # internal_0[10] = 'e' - - addi $t0, $zero, 100 - sb $t0, 19($v0) # internal_0[11] = 'd' - - addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_0[12] = ' ' - - addi $t0, $zero, 102 - sb $t0, 21($v0) # internal_0[13] = 'f' - - addi $t0, $zero, 114 - sb $t0, 22($v0) # internal_0[14] = 'r' - - addi $t0, $zero, 111 - sb $t0, 23($v0) # internal_0[15] = 'o' - - addi $t0, $zero, 109 - sb $t0, 24($v0) # internal_0[16] = 'm' - - addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_0[17] = ' ' - - addi $t0, $zero, 99 - sb $t0, 26($v0) # internal_0[18] = 'c' - - addi $t0, $zero, 108 - sb $t0, 27($v0) # internal_0[19] = 'l' - - addi $t0, $zero, 97 - sb $t0, 28($v0) # internal_0[20] = 'a' - - addi $t0, $zero, 115 - sb $t0, 29($v0) # internal_0[21] = 's' - - addi $t0, $zero, 115 - sb $t0, 30($v0) # internal_0[22] = 's' - - addi $t0, $zero, 32 - sb $t0, 31($v0) # internal_0[23] = ' ' - - sb $zero, 32($v0) # Null-terminator at the end of the string - - sw $v0, 12($sp) # internal_0 = "Abort called from class " - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_2[0] = '\n' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 4($sp) # internal_2 = "\n" - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument self - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_type_name_at_Object - jal function_type_name_at_Object - lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_0 - lw $t0, 24($sp) - sw $t0, 4($sp) # Storing internal_0 - - # Argument internal_1 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function_concat_at_String - jal function_concat_at_String - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_3 - lw $t0, 12($sp) - sw $t0, 4($sp) # Storing internal_3 - - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_concat_at_String - jal function_concat_at_String - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String - addi $sp, $sp, 12 # Freeing space for arguments - - lw $t0, 0($sp) # $t0 = internal_3 - addi $t0, $t0, 8 # Pointer to the first character of the string - - # Printing the string internal_3 - li $v0, 4 - move $a0, $t0 - syscall - - # Exit program - li $v0, 10 - syscall - - # Loading return value in $v1 - lw $v1, 16($sp) - - # Freeing space for local variables - addi $sp, $sp, 16 - - jr $ra - - function_type_name_at_Object: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = name of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($t0) # $t1 = type of self - lw $t2, 12($t1) # $t1 = length of the name of self - la $t3, 16($t1) # $t1 = name of self - - addi $t2, $t2, 9 # Setting space for the type, the size and the null byte - li $v0, 9 - move $a0, $t2 - syscall - addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte - - la $t4, type_String - sw $t4, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - - addi $t4, $v0, 0 # $t4 = direction of the new string - addi $t4, $t4, 8 # Pointer to the first character of the string - xor $t5, $t5, $t5 # Initializing counter - while_copy_name_start: - beq $t5, $t2, while_copy_name_end - lb $t6, 0($t3) # Loading the character - sb $t6, 0($t4) - addi $t4, $t4, 1 # Incrementing the pointer to the new string - addi $t3, $t3, 1 # Incrementing the pointer to the string in self - addi $t5, $t5, 1 # Incrementing counter - j while_copy_name_start - while_copy_name_end: - - sb $zero, 0($t4) # Setting the null byte - - sw $v0, 0($sp) # Storing the new string in internal_0 - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_copy_at_Object: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = copy of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($t0) # $t1 = type of self - lw $t2, 4($t0) # $t2 = length of self in bytes - - # Allocating space for the new object - li $v0, 9 - move $a0, $t2 - syscall - move $t3, $v0 # $t3 = direction of the new object - sw $t1, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - - # Initializing the variable of the loop - addi $t0, $t0, 8 # Pointer to the first character of the object - addi $t3, $t3, 8 # Pointer to the first character of the object - addi $t2, $2, -8 # Decrementing in 8 the length of the object - xor $t4, $t4, $t4 # Initializing counter - - # Loop copying the object - while_copy_start: - beq $t4, $t2, while_copy_end - lb $t5, 0($t0) # Loading the byte - sb $t5, 0($t3) # Storing the byte - addi $t0, $t0, 1 # Incrementing the pointer to the object - addi $t3, $t3, 1 # Incrementing the pointer to the new object - addi $t4, $t4, 1 # Incrementing counter - j while_copy_start - while_copy_end: - sw $v0, 0($sp) # Storing the new object in internal_0 - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function___init___at_IO: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_out_string_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - # x = 0($sp) - - lw $t0, 0($sp) # $t0 = x - addi $t0, $t0, 8 # Pointer to the first character of the string - - # Printing the string x - li $v0, 4 - move $a0, $t0 - syscall - - # Loading return value in $v1 - lw $v1, 4($sp) - - jr $ra - - function_out_int_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - # x = 0($sp) - - # Printing the string x - li $v0, 1 - lw $a0, 0($sp) - lw $a0, 8($a0) - syscall - - # Loading return value in $v1 - lw $v1, 4($sp) - - jr $ra - - function_in_string_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - li $v0, 8 - la $a0, buffer_input - li $a1, 1024 - syscall - - xor $t0, $t0, $t0 # Initializing counter - while_read_start: - lb $t1, buffer_input($t0) # Loading the byte - beq $t1, $zero, while_read_end - addi $t0, $t0, 1 # Incrementing counter - j while_read_start - while_read_end: - addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' - - addi $t0, $t0, 9 # Adding space for the type, the size and the null byte - li $v0, 9 - move $a0, $t0 - syscall - addi $t0, $t0, -9 # Adding space for the type, the size and the null byte - la $t2, type_String - sw $t2, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - - addi $t3, $v0, 8 # Pointer to the first character of the string - xor $t4, $t4, $t4 # Initializing counter - - while_copy_from_buffer_start: - beq $t4, $t0, while_copy_from_buffer_end - lb $t5, buffer_input($t4) # Loading the byte - sb $t5, 0($t3) # Storing the byte - addi $t3, $t3, 1 # Imcremeenting pointer - addi $t4, $t4, 1 # Incrementing counter - j while_copy_from_buffer_start - while_copy_from_buffer_end: - - sb $zero, 0($t3) # Storing the null byte - - sw $v0, 0($sp) # Storing the new object in internal_0 - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_in_int_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - li $v0, 5 - syscall - lw $t0, 0($sp) - sw $v0, 8($t0) - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function___init___at_String: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_length_at_String: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # internal_0 = length of self - lw $t0, 4($sp) - lw $t1, 4($t0) - addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator - lw $t0, 0($sp) - sw $t1, 8($t0) - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_concat_at_String: - # Function parameters - # $ra = 12($sp) - # self = 8($sp) - # s = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = self + s - lw $t0, 8($sp) - lw $t1, 4($sp) - lw $t2, 4($t0) # $t2 = length of str1 - lw $t3, 4($t1) # $t3 = length of str2 - addi $t2, $t2, -9 - addi $t3, $t3, -9 - add $t4, $t2, $t3 # $t4 = length of str1 + str2 - addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) - - li $v0, 9 - move $a0, $t4 - syscall - addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 - add $t5, $zero, $v0 # $t5 = address of the new string object - addi $t5, $t5, 8 # $t5 = address of the first byte of the new string - - la $t8, type_String - sw $t8, 0($v0) # Setting type in the first word of th object - - sw $a0, 4($v0) # Setting length of the string in the second word of the object - - # Copying str1 to the new string - xor $t6, $t6, $t6 # $t6 = 0 Initializing counter - while_copy_str1_start: - beq $t6, $t2, while_copy_str1_end - lb $t7, 8($t0) - sb $t7, 0($t5) - add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_str1_start - while_copy_str1_end: - - # Copying str2 to the new string - while_copy_str2_start: - beq $t6, $t4, while_copy_str2_end - lb $t7, 8($t1) - sb $t7, 0($t5) - add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_str2_start - while_copy_str2_end: - - sb $zero, 0($t5) # Setting the null-terminator - - sw $v0, 0($sp) # internal_0 = self + s - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_substr_at_String: - # Function parameters - # $ra = 16($sp) - # self = 12($sp) - # i = 8($sp) - # l = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = self[i:i + l] - lw $t0, 12($sp) # $t0 = address of the string - lw $t1, 4($t0) # $t1 = length of the string - addi $t1, $t1, -9 # $t1 = length of the string + 9 - lw $t2, 8($sp) # $t2 = start of the substring - lw $t2, 8($t2) - lw $t3, 4($sp) # $t3 = length of the substring - lw $t3, 8($t3) - add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring - - bgt $t4, $t1, substring_out_of_bounds - - addi $t3, $t3, 9 - li $v0, 9 - move $a0, $t3 - syscall - addi $t3, $t3, -9 - - la $t5, type_String - sw $t5, 0($v0) # Setting type in the first word of the object - - sw $a0, 4($v0) # Setting length in the second word of the object - - addi $t0, $t0, 8 # pointing to the first byte of the string - add $t0, $t0, $t2 # pointing to the first byte of the substring - move $t5, $v0 # $t5 = address of the new string - add $t5, $t5, 8 # pointing to the first byte of the string - xor $t6, $t6, $t6 # $t6 = 0 Initializing counter - while_copy_substr_start: - beq $t6, $t3, while_copy_substr_end - lb $t7, 0($t0) - sb $t7, 0($t5) - addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_substr_start - while_copy_substr_end: - - sb $zero, 0($t5) # Setting the null-terminator - - sw $v0, 0($sp) # internal_0 = self[i:i + l] - j substring_not_out_of_bounds - - substring_out_of_bounds: - li $v0, 17 - addi $a0, $zero, 1 - syscall - - substring_not_out_of_bounds: - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function___init___at_Main: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating NUll to internal_0 - sw $zero, 0($sp) # internal_0 = 0 - - # Set attribute m_main of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8729902282334 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8729902282334 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8729902282334 - j object_set_attribute_8729902282334 - int_set_attribute_8729902282334: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.m_main = internal_0 - j end_set_attribute_8729902282334 - bool_set_attribute_8729902282334: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.m_main = internal_0 - j end_set_attribute_8729902282334 - object_set_attribute_8729902282334: - sw $t1, 8($t0) # self.m_main = internal_0 - end_set_attribute_8729902282334: - - # Loading return value in $v1 - lw $v1, 4($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_main_at_Main: - # Function parameters - # $ra = 12($sp) - # self = 8($sp) - - # Reserving space for local variables - addi $sp, $sp, -8 - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument self - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_in_string_at_IO - jal function_in_string_at_IO - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function_in_string_at_IO - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 20($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_0 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_1 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 8 - - jr $ra - - main: - # Reserving space for local variables - addi $sp, $sp, -8 - - # Allocating Main - li $v0, 9 - lw $a0, type_Main - syscall - la $t0, type_Main # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object Main - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function___init___at_Main - jal function___init___at_Main - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_Main - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function_main_at_Main - jal function_main_at_Main - lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function_main_at_Main - addi $sp, $sp, 8 # Freeing space for arguments - - # Exit program - li $v0, 10 - syscall - - \ No newline at end of file diff --git a/src/main.cil b/src/main.cil deleted file mode 100644 index d157b8620..000000000 --- a/src/main.cil +++ /dev/null @@ -1,401 +0,0 @@ -.TYPES -type Object { - inherits from null - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method __init__: function___init___at_Object -} -type IO { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method out_string: function_out_string_at_IO - method out_int: function_out_int_at_IO - method in_string: function_in_string_at_IO - method in_int: function_in_int_at_IO - method __init__: function___init___at_IO -} -type Int { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method __init__: function___init___at_Int -} -type String { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method length: function_length_at_String - method concat: function_concat_at_String - method substr: function_substr_at_String - method __init__: function___init___at_String -} -type Bool { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method __init__: function___init___at_Bool -} -type Main { - inherits from IO - - attribute m_main - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method out_string: function_out_string_at_IO - method out_int: function_out_int_at_IO - method in_string: function_in_string_at_IO - method in_int: function_in_int_at_IO - method main: function_main_at_Main - method __init__: function___init___at_Main -} - -.DATA - - -.CODE -function function_add{ - PARAM a - PARAM b - - LOCAL internal_0 # Adding result - - internal_0 = ALLOCINT 0 - internal_0 = a + b - - RETURN internal_0 -} -function function_sub{ - PARAM a - PARAM b - - LOCAL internal_0 # Substracting result - - internal_0 = ALLOCINT 0 - internal_0 = a - b - - RETURN internal_0 -} -function function_mult{ - PARAM a - PARAM b - - LOCAL internal_0 # Multiting result - - internal_0 = ALLOCINT 0 - internal_0 = a * b - - RETURN internal_0 -} -function function_div{ - PARAM a - PARAM b - - LOCAL internal_0 # Dividing result - - internal_0 = ALLOCINT 0 - internal_0 = a / b - - RETURN internal_0 -} -function function_xor{ - PARAM a - PARAM b - - LOCAL internal_0 # Xor result - - internal_0 = ALLOCINT 0 - internal_0 = XOR a b - - RETURN internal_0 -} -function function_less_than{ - PARAM a - PARAM b - - LOCAL internal_0 # Less than result - - internal_0 = ALLOCBOOL 0 - internal_0 = a < b - - RETURN internal_0 -} -function function_less_than_or_equal{ - PARAM a - PARAM b - - LOCAL internal_0 # Less than or equal result - - internal_0 = ALLOCBOOL 0 - internal_0 = a <= b - - RETURN internal_0 -} -function function_equal{ - PARAM a - PARAM b - - LOCAL internal_0 # Equal result - LOCAL internal_1 # Null Pointer - LOCAL internal_2 # One of params is null - LOCAL internal_3 # Type of a - LOCAL internal_4 # Type Int - LOCAL internal_5 # Type Bool - LOCAL internal_6 # Type String - LOCAL internal_7 # Type of a equals int - LOCAL internal_8 # Type of a equals bool - LOCAL internal_9 # Type of a equals string - - internal_0 = ALLOCBOOL 0 - internal_1 = ALLOCNULL - internal_2 = ALLOCBOOL 0 - internal_2 = EQUALADDR a internal_1 - internal_2 = EQUALADDR b internal_1 - IF internal_2 GOTO a_is_type_object - internal_3 = TYPEOF a - internal_4 = TYPEADDR Int - internal_5 = TYPEADDR Bool - internal_6 = TYPEADDR String - internal_7 = ALLOCBOOL 0 - internal_8 = ALLOCBOOL 0 - internal_9 = ALLOCBOOL 0 - internal_7 = EQUALADDR internal_3 internal_4 - internal_8 = EQUALADDR internal_3 internal_5 - internal_9 = EQUALADDR internal_3 internal_6 - - IF internal_7 GOTO a_is_type_int_or_bool - IF internal_8 GOTO a_is_type_int_or_bool - IF internal_9 GOTO a_is_type_string - GOTO a_is_type_object - - a_is_type_int_or_bool: - internal_0 = EQUALINT a b - GOTO end_of_equal - - a_is_type_string: - internal_0 = EQUALSTR a b - GOTO end_of_equal - - a_is_type_object: - internal_0 = a == b - GOTO end_of_equal - - end_of_equal: - - RETURN internal_0 -} -function function_assign{ - PARAM dest - PARAM source - - LOCAL internal_0 # Null Pointer - LOCAL internal_1 # One of params is null - LOCAL internal_2 # Type of source - LOCAL internal_3 # Type Int - LOCAL internal_4 # Type Bool - LOCAL internal_5 # Type of source equals int - LOCAL internal_6 # Type of source equals bool - - internal_0 = ALLOCNULL - internal_1 = ALLOCBOOL 0 - internal_1 = EQUALADDR source internal_0 - internal_1 = EQUALADDR dest internal_0 - IF internal_1 GOTO source_is_type_object - internal_2 = TYPEOF source - internal_3 = TYPEADDR Int - internal_4 = TYPEADDR Bool - internal_5 = ALLOCBOOL 0 - internal_6 = ALLOCBOOL 0 - internal_5 = EQUALADDR internal_2 internal_3 - internal_6 = EQUALADDR internal_2 internal_4 - - IF internal_5 GOTO source_is_type_int_or_bool - IF internal_6 GOTO source_is_type_int_or_bool - GOTO source_is_type_object - - source_is_type_int_or_bool: - dest = INT source - GOTO source_end_of_equal - - source_is_type_object: - dest = source - GOTO source_end_of_equal - - source_end_of_equal: - - RETURN dest -} -function function___init___at_Object{ - PARAM self - - RETURN self -} -function function_abort_at_Object{ - PARAM self - - LOCAL internal_0 - LOCAL internal_1 - LOCAL internal_2 - LOCAL internal_3 - - internal_0 = ALLOCSTR "Abort called from class " - internal_2 = ALLOCSTR "\n" - ARG self - internal_1 = VCALL String function_type_name_at_Object - ARG internal_0 - ARG internal_1 - internal_3 = VCALL String function_concat_at_String - ARG internal_3 - ARG internal_2 - internal_3 = VCALL String function_concat_at_String - PRINTSTR internal_3 - HALT - - RETURN self -} -function function_type_name_at_Object{ - PARAM self - - LOCAL internal_0 # type_name - - internal_0 = TYPENAME self - - RETURN internal_0 -} -function function_copy_at_Object{ - PARAM self - - LOCAL internal_0 - - internal_0 = COPY self - - RETURN internal_0 -} -function function___init___at_IO{ - PARAM self - - RETURN self -} -function function_out_string_at_IO{ - PARAM self - PARAM x - - PRINTSTR x - - RETURN self -} -function function_out_int_at_IO{ - PARAM self - PARAM x - - PRINTINT x - - RETURN self -} -function function_in_string_at_IO{ - PARAM self - - LOCAL internal_0 - - READSTR internal_0 - - RETURN internal_0 -} -function function_in_int_at_IO{ - PARAM self - - LOCAL internal_0 - - internal_0 = ALLOCINT 0 - READINT internal_0 - - RETURN internal_0 -} -function function___init___at_String{ - PARAM self - - RETURN self -} -function function_length_at_String{ - PARAM self - - LOCAL internal_0 - - internal_0 = ALLOCINT 0 - internal_0 = LENGTH self - - RETURN internal_0 -} -function function_concat_at_String{ - PARAM self - PARAM s - - LOCAL internal_0 - - internal_0 = CONCAT self s - - RETURN internal_0 -} -function function_substr_at_String{ - PARAM self - PARAM i - PARAM l - - LOCAL internal_0 - - internal_0 = SUBSTRING self i l - - RETURN internal_0 -} -function function___init___at_Main{ - PARAM self - - LOCAL internal_0 # Null - - internal_0 = ALLOCNULL - - SETATTR self m_main internal_0 - - RETURN self -} -function function_main_at_Main{ - PARAM self - - LOCAL internal_0 - LOCAL internal_1 - - ARG self - internal_0 = VCALL Main function_in_string_at_IO - ARG self - ARG internal_0 - internal_1 = VCALL Main function_out_string_at_IO - - RETURN internal_1 -} -function main{ - - - LOCAL internal_0 - LOCAL internal_1 - - internal_0 = ALLOCATE Main - ARG internal_0 - internal_0 = VCALL Main function___init___at_Main - - ARG internal_0 - internal_1 = VCALL Main function_main_at_Main - - HALT -} \ No newline at end of file diff --git a/src/main.cl b/src/main.cl deleted file mode 100644 index 36b9737b7..000000000 --- a/src/main.cl +++ /dev/null @@ -1,69 +0,0 @@ -(* -class Main { - number: Int <- 0; - - main() : Object { - let x: Int <- number + 2, io: IO <- new IO, p: Point <- (new Point).init(1, 2) in { - io.out_string("("); - io.out_int(p.get_x()); - io.out_string(","); - io.out_int(p.get_y()); - io.out_string(")"); - io.out_string("\n"); - } - }; -}; - -class Point { - x: Int <- 0; - y: Int <- 0; - point: Point; - - init (x0: Int, y0: Int): Point{ - { - x <- x0; - y <- y0; - self; - } - }; - - get_x(): Int { - x - }; - - get_y(): Int { - y - }; -}; - -class Point3D inherits Point { - z: Int <- 0; - - init (x0: Int, y0: Int): Point{ - { - z <- 0; - self@Point.init(x0, y0); - } - }; - - get_z(): Int { - z - }; -}; -*) - -class Main inherits IO { - m_main: Main; - - main() : Object { - -- case 1 of - -- x: Int => { - -- out_int(x); - -- out_string(" is Int\n"); - -- }; - -- y: Bool => out_string("is Bool\n"); - -- z: Object => out_string("is Object\n"); - -- esac - out_string(in_string()) - }; -}; diff --git a/src/primes.asm b/src/primes.asm deleted file mode 100644 index 05333d529..000000000 --- a/src/primes.asm +++ /dev/null @@ -1,2205 +0,0 @@ -.data - type_Object: .word 8 - type_Object_inherits_from: .word 0 - type_Object_attributes: .word 0 - type_Object_name_size: .word 6 - type_Object_name: .asciiz "Object" - type_Object_abort_message: .asciiz "Abort called from class Object\n" - - type_IO: .word 8 - type_IO_inherits_from: .word type_Object - type_IO_attributes: .word 0 - type_IO_name_size: .word 2 - type_IO_name: .asciiz "IO" - type_IO_abort_message: .asciiz "Abort called from class IO\n" - - type_Int: .word 8 - type_Int_inherits_from: .word type_Object - type_Int_attributes: .word 0 - type_Int_name_size: .word 3 - type_Int_name: .asciiz "Int" - type_Int_abort_message: .asciiz "Abort called from class Int\n" - - type_String: .word 8 - type_String_inherits_from: .word type_Object - type_String_attributes: .word 0 - type_String_name_size: .word 6 - type_String_name: .asciiz "String" - type_String_abort_message: .asciiz "Abort called from class String\n" - - type_Bool: .word 8 - type_Bool_inherits_from: .word type_Object - type_Bool_attributes: .word 0 - type_Bool_name_size: .word 4 - type_Bool_name: .asciiz "Bool" - type_Bool_abort_message: .asciiz "Abort called from class Bool\n" - - type_Main: .word 28 - type_Main_inherits_from: .word type_IO - type_Main_attributes: .word 5 - type_Main_name_size: .word 4 - type_Main_name: .asciiz "Main" - type_Main_abort_message: .asciiz "Abort called from class Main\n" - - buffer_input: .space 1024 - debug_log: .asciiz "debug_log\n" - -.text - function_add: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Addition operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - add $t2, $t0, $t1 # $t2 = $t0 + $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_sub: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Subtraction operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - sub $t2, $t0, $t1 # $t2 = $t0 - $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_mult: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Multiplication operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - mult $t0, $t1 # $t2 = $t0 * $t1 - mflo $t2 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_div: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Division operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - div $t0, $t1 # $t2 = $t0 / $t1 - mflo $t2 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_xor: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Xor operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_less_than: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Less than operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_less_than_or_equal: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Less than operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_equal: - # Function parameters - # $ra = 40($sp) - # a = 36($sp) - # b = 32($sp) - - # Reserving space for local variables - addi $sp, $sp, -32 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_0 = address of allocated object Int - - # internal_1 = typeof a that is the first word of the object - lw $t0, 36($sp) - lw $t0, 0($t0) - sw $t0, 24($sp) - - # internal_2 = direction of Int - la $t0, type_Int - sw $t0, 20($sp) - - # internal_3 = direction of Bool - la $t0, type_Bool - sw $t0, 16($sp) - - # internal_4 = direction of String - la $t0, type_String - sw $t0, 12($sp) - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_5 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_6 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_7 = address of allocated object Int - - # internal_5 = EqualAddress(internal_1, internal_2) - lw $t0, 24($sp) - lw $t1, 20($sp) - seq $t2, $t0, $t1 - lw $t0, 8($sp) - sw $t2, 8($t0) - - # internal_6 = EqualAddress(internal_1, internal_3) - lw $t0, 24($sp) - lw $t1, 16($sp) - seq $t2, $t0, $t1 - lw $t0, 4($sp) - sw $t2, 8($t0) - - # internal_7 = EqualAddress(internal_1, internal_4) - lw $t0, 24($sp) - lw $t1, 12($sp) - seq $t2, $t0, $t1 - lw $t0, 0($sp) - sw $t2, 8($t0) - - # If internal_5 then goto a_is_type_int_or_bool - lw $t0, 8($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, a_is_type_int_or_bool - - # If internal_6 then goto a_is_type_int_or_bool - lw $t0, 4($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, a_is_type_int_or_bool - - # If internal_7 then goto a_is_type_string - lw $t0, 0($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, a_is_type_string - - # Jumping to a_is_type_object - j a_is_type_object - - a_is_type_int_or_bool: - - # internal_0 = EqualInt(a, b) - lw $t0, 36($sp) - lw $t0, 8($t0) - lw $t1, 32($sp) - lw $t1, 8($t1) - seq $t2, $t0, $t1 - lw $t0, 28($sp) - sw $t2, 8($t0) - - # Jumping to end_of_equal - j end_of_equal - - a_is_type_string: - - # internal_0 = EqualStr(a, b) - lw $t0, 36($sp) - lw $t1, 32($sp) - addi $t0, $t0, 8 - addi $t1, $t1, 8 - - # By default we assume the strings are equals - addi $t4, $zero, 1 - lw $t5, 28($sp) - sw $t4, 8($t5) - - while_compare_strings_start: - lb $t2, 0($t0) - lb $t3, 0($t1) - beq $t2, $t3, while_compare_strings_update - - # The strings are no equals - lw $t5, 28($sp) - sw $zero, 8($t5) - j while_compare_strings_end - - while_compare_strings_update: - addi $t0, $t0, 1 - addi $t1, $t1, 1 - beq $t2, $zero, while_compare_strings_end - j while_compare_strings_start - while_compare_strings_end: - - # Jumping to end_of_equal - j end_of_equal - - a_is_type_object: - - # Equal operation - lw $t0, 36($sp) # Save in $t0 the left operand address - lw $t1, 32($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 - - lw $t0, 28($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # Jumping to end_of_equal - j end_of_equal - - end_of_equal: - - # Loading return value in $v1 - lw $v1, 28($sp) - - # Freeing space for local variables - addi $sp, $sp, 32 - - jr $ra - - function_assign: - # Function parameters - # $ra = 28($sp) - # dest = 24($sp) - # source = 20($sp) - - # Reserving space for local variables - addi $sp, $sp, -20 - - # internal_0 = typeof source that is the first word of the object - lw $t0, 20($sp) - lw $t0, 0($t0) - sw $t0, 16($sp) - - # internal_1 = direction of Int - la $t0, type_Int - sw $t0, 12($sp) - - # internal_2 = direction of Bool - la $t0, type_Bool - sw $t0, 8($sp) - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_3 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_4 = address of allocated object Int - - # internal_3 = EqualAddress(internal_1, internal_1) - lw $t0, 12($sp) - lw $t1, 12($sp) - seq $t2, $t0, $t1 - lw $t0, 4($sp) - sw $t2, 8($t0) - - # internal_4 = EqualAddress(internal_1, internal_2) - lw $t0, 12($sp) - lw $t1, 8($sp) - seq $t2, $t0, $t1 - lw $t0, 0($sp) - sw $t2, 8($t0) - - # If internal_3 then goto source_is_type_int_or_bool - lw $t0, 4($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, source_is_type_int_or_bool - - # If internal_4 then goto source_is_type_int_or_bool - lw $t0, 0($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, source_is_type_int_or_bool - - # Jumping to source_is_type_object - j source_is_type_object - - source_is_type_int_or_bool: - - # dest = source where source is an integer - li $v0, 9 - addi $a0, $zero, 12 - syscall - lw $t0, 20($sp) # Pointer to source - lw $t1, 0($t0) # $t1 = type of source - lw $t2, 8($t0) # $t2 = value of source - sw $t1, 0($v0) # Save type of dest - sw $a0, 4($v0) # Save size of dest - sw $t2, 8($v0) # Save value of dest - sw $v0, 24($sp) - - # Jumping to source_end_of_equal - j source_end_of_equal - - source_is_type_object: - - # dest = source - lw $t0, 20($sp) - sw $t0, 24($sp) - - # Jumping to source_end_of_equal - j source_end_of_equal - - source_end_of_equal: - - # Loading return value in $v1 - lw $v1, 24($sp) - - # Freeing space for local variables - addi $sp, $sp, 20 - - jr $ra - - function___init___at_Object: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_abort_at_Object: - # Function parameters - # $ra = 20($sp) - # self = 16($sp) - - # Reserving space for local variables - addi $sp, $sp, -16 - - # Allocating String - li $v0, 9 - addi $a0, $zero, 18 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 18 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 65 - sb $t0, 8($v0) # internal_0[0] = 'A' - - addi $t0, $zero, 98 - sb $t0, 9($v0) # internal_0[1] = 'b' - - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_0[2] = 'o' - - addi $t0, $zero, 114 - sb $t0, 11($v0) # internal_0[3] = 'r' - - addi $t0, $zero, 116 - sb $t0, 12($v0) # internal_0[4] = 't' - - addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_0[5] = ' ' - - addi $t0, $zero, 105 - sb $t0, 14($v0) # internal_0[6] = 'i' - - addi $t0, $zero, 110 - sb $t0, 15($v0) # internal_0[7] = 'n' - - addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_0[8] = ' ' - - sb $zero, 17($v0) # Null-terminator at the end of the string - - sw $v0, 12($sp) # internal_0 = "Abort in " - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_2[0] = '\n' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 4($sp) # internal_2 = "\n" - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument self - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_type_name_at_Object - jal function_type_name_at_Object - lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_0 - lw $t0, 24($sp) - sw $t0, 4($sp) # Storing internal_0 - - # Argument internal_1 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function_concat_at_String - jal function_concat_at_String - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_3 - lw $t0, 12($sp) - sw $t0, 4($sp) # Storing internal_3 - - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_concat_at_String - jal function_concat_at_String - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String - addi $sp, $sp, 12 # Freeing space for arguments - - lw $t0, 0($sp) # $t0 = internal_3 - addi $t0, $t0, 8 # Pointer to the first character of the string - - # Printing the string internal_3 - li $v0, 4 - move $a0, $t0 - syscall - - # Exit program - li $v0, 10 - syscall - - # Loading return value in $v1 - lw $v1, 16($sp) - - # Freeing space for local variables - addi $sp, $sp, 16 - - jr $ra - - function_type_name_at_Object: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = name of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($t0) # $t1 = type of self - lw $t2, 12($t1) # $t1 = length of the name of self - la $t3, 16($t1) # $t1 = name of self - - addi $t2, $t2, 9 # Setting space for the type, the size and the null byte - li $v0, 9 - move $a0, $t2 - syscall - addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte - - la $t4, type_String - sw $t4, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - - addi $t4, $v0, 0 # $t4 = direction of the new string - addi $t4, $t4, 8 # Pointer to the first character of the string - xor $t5, $t5, $t5 # Initializing counter - while_copy_name_start: - beq $t5, $t2, while_copy_name_end - lb $t6, 0($t3) # Loading the character - sb $t6, 0($t4) - addi $t4, $t4, 1 # Incrementing the pointer to the new string - addi $t3, $t3, 1 # Incrementing the pointer to the string in self - addi $t5, $t5, 1 # Incrementing counter - j while_copy_name_start - while_copy_name_end: - - sb $zero, 0($t4) # Setting the null byte - - sw $v0, 0($sp) # Storing the new string in internal_0 - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_copy_at_Object: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = copy of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($t0) # $t1 = type of self - lw $t2, 4($t0) # $t2 = length of self in bytes - - # Allocating space for the new object - li $v0, 9 - move $a0, $t2 - syscall - move $t3, $v0 # $t3 = direction of the new object - sw $t1, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - - # Initializing the variable of the loop - addi $t0, $t0, 8 # Pointer to the first character of the object - addi $t3, $t3, 8 # Pointer to the first character of the object - addi $t2, $2, -8 # Decrementing in 8 the length of the object - xor $t4, $t4, $t4 # Initializing counter - - # Loop copying the object - while_copy_start: - beq $t4, $t2, while_copy_end - lb $t5, 0($t0) # Loading the byte - sb $t5, 0($t3) # Storing the byte - addi $t0, $t0, 1 # Incrementing the pointer to the object - addi $t3, $t3, 1 # Incrementing the pointer to the new object - addi $t4, $t4, 1 # Incrementing counter - j while_copy_start - while_copy_end: - sw $v0, 0($sp) # Storing the new object in internal_0 - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function___init___at_IO: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_out_string_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - # x = 0($sp) - - lw $t0, 0($sp) # $t0 = x - addi $t0, $t0, 8 # Pointer to the first character of the string - - # Printing the string x - li $v0, 4 - move $a0, $t0 - syscall - - # Loading return value in $v1 - lw $v1, 4($sp) - - jr $ra - - function_out_int_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - # x = 0($sp) - - # Printing the string x - li $v0, 1 - lw $a0, 0($sp) - lw $a0, 8($a0) - syscall - - # Loading return value in $v1 - lw $v1, 4($sp) - - jr $ra - - function_in_string_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - li $v0, 8 - la $a0, buffer_input - li $a1, 1024 - syscall - - xor $t0, $t0, $t0 # Initializing counter - while_read_start: - lw $t1, buffer_input($t0) # Loading the byte - beq $t1, $zero, while_read_end - addi $t0, $t0, 1 # Incrementing counter - j while_read_start - while_read_end: - - addi $t0, $t0, 9 # Adding space for the type, the size and the null byte - li $v0, 9 - move $a0, $t0 - syscall - la $t2, type_String - sw $t2, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - - addi $t3, $v0, 8 # Pointer to the first character of the string - xor $t4, $t4, $t4 # Initializing counter - - while_copy_from_buffer_start: - beq $t4, $t0, while_copy_from_buffer_end - lw $t5, buffer_input($t4) # Loading the byte - sb $t5, 0($t3) # Storing the byte - addi $t3, $t3, 1 # Imcremeenting pointer - addi $t4, $t4, 1 # Incrementing counter - j while_copy_from_buffer_start - while_copy_from_buffer_end: - - sb $zero, 0($t3) # Storing the null byte - - sw $v0, 0($sp) # Storing the new object in internal_0 - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_in_int_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - li $v0, 5 - syscall - lw $t0, 0($sp) - sw $v0, 8($t0) - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function___init___at_String: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_length_at_String: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = length of self - lw $t0, 4($sp) - lw $t1, 4($t0) - addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator - sw $t1, 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_concat_at_String: - # Function parameters - # $ra = 12($sp) - # self = 8($sp) - # s = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = self + s - lw $t0, 8($sp) - lw $t1, 4($sp) - lw $t2, 4($t0) # $t2 = length of str1 - lw $t3, 4($t1) # $t3 = length of str2 - addi $t2, $t2, -9 - addi $t3, $t3, -9 - add $t4, $t2, $t3 # $t4 = length of str1 + str2 - addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) - - li $v0, 9 - move $a0, $t4 - syscall - addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 - add $t5, $zero, $v0 # $t5 = address of the new string object - addi $t5, $t5, 8 # $t5 = address of the first byte of the new string - - la $t8, type_String - sw $t8, 0($v0) # Setting type in the first word of th object - - sw $a0, 4($v0) # Setting length of the string in the second word of the object - - # Copying str1 to the new string - xor $t6, $t6, $t6 # $t6 = 0 Initializing counter - while_copy_str1_start: - beq $t6, $t2, while_copy_str1_end - lb $t7, 8($t0) - sb $t7, 0($t5) - add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_str1_start - while_copy_str1_end: - - # Copying str2 to the new string - while_copy_str2_start: - beq $t6, $t4, while_copy_str2_end - lb $t7, 8($t1) - sb $t7, 0($t5) - add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_str2_start - while_copy_str2_end: - - sb $zero, 0($t5) # Setting the null-terminator - - sw $v0, 0($sp) # internal_0 = self + s - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_substr_at_String: - # Function parameters - # $ra = 16($sp) - # self = 12($sp) - # i = 8($sp) - # l = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = self[i:i + l] - lw $t0, 12($sp) # $t0 = address of the string - lw $t1, 4($t0) # $t1 = length of the string - lw $t2, 8($sp) # $t2 = start of the substring - lw $t3, 4($sp) # $t3 = length of the substring - add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring - - bge $t4, $t1, substring_out_of_bounds - - addi $t3, $t3, 9 - li $v0, 9 - move $a0, $t3 - syscall - addi $t3, $t3, -9 - - la $t5, type_String - sw $t5, 0($v0) # Setting type in the first word of the object - - sw $a0, 4($v0) # Setting length in the second word of the object - - addi $t0, $t0, 8 # pointing to the first byte of the string - add $t0, $t0, $t2 # pointing to the first byte of the substring - move $t5, $v0 # $t5 = address of the new string - add $t5, $t5, 8 # pointing to the first byte of the string - xor $t6, $t6, $t6 # $t6 = 0 Initializing counter - while_copy_substr_start: - beq $t6, $t3, while_copy_substr_end - lb $t7, 0($t0) - sb $t7, 0($t5) - addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_substr_start - while_copy_substr_end: - - sb $zero, 0($t5) # Setting the null-terminator - - sw $v0, 0($sp) # internal_0 = self[i:i + l] - j substring_not_out_of_bounds - - substring_out_of_bounds: - li $v0, 17 - addi $a0, $zero, 1 - syscall - - substring_not_out_of_bounds: - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function___init___at_Main: - # Function parameters - # $ra = 228($sp) - # self = 224($sp) - - # Reserving space for local variables - addi $sp, $sp, -224 - - # Allocating String - li $v0, 9 - addi $a0, $zero, 31 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 31 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 50 - sb $t0, 8($v0) # internal_0[0] = '2' - - addi $t0, $zero, 32 - sb $t0, 9($v0) # internal_0[1] = ' ' - - addi $t0, $zero, 105 - sb $t0, 10($v0) # internal_0[2] = 'i' - - addi $t0, $zero, 115 - sb $t0, 11($v0) # internal_0[3] = 's' - - addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_0[4] = ' ' - - addi $t0, $zero, 116 - sb $t0, 13($v0) # internal_0[5] = 't' - - addi $t0, $zero, 114 - sb $t0, 14($v0) # internal_0[6] = 'r' - - addi $t0, $zero, 105 - sb $t0, 15($v0) # internal_0[7] = 'i' - - addi $t0, $zero, 118 - sb $t0, 16($v0) # internal_0[8] = 'v' - - addi $t0, $zero, 105 - sb $t0, 17($v0) # internal_0[9] = 'i' - - addi $t0, $zero, 97 - sb $t0, 18($v0) # internal_0[10] = 'a' - - addi $t0, $zero, 108 - sb $t0, 19($v0) # internal_0[11] = 'l' - - addi $t0, $zero, 108 - sb $t0, 20($v0) # internal_0[12] = 'l' - - addi $t0, $zero, 121 - sb $t0, 21($v0) # internal_0[13] = 'y' - - addi $t0, $zero, 32 - sb $t0, 22($v0) # internal_0[14] = ' ' - - addi $t0, $zero, 112 - sb $t0, 23($v0) # internal_0[15] = 'p' - - addi $t0, $zero, 114 - sb $t0, 24($v0) # internal_0[16] = 'r' - - addi $t0, $zero, 105 - sb $t0, 25($v0) # internal_0[17] = 'i' - - addi $t0, $zero, 109 - sb $t0, 26($v0) # internal_0[18] = 'm' - - addi $t0, $zero, 101 - sb $t0, 27($v0) # internal_0[19] = 'e' - - addi $t0, $zero, 46 - sb $t0, 28($v0) # internal_0[20] = '.' - - addi $t0, $zero, 10 - sb $t0, 29($v0) # internal_0[21] = '\n' - - sb $zero, 30($v0) # Null-terminator at the end of the string - - sw $v0, 220($sp) # internal_0 = "2 is trivially prime.\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 236($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_0 - lw $t0, 232($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 228($sp) # internal_1 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating Int 2 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 2 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 212($sp) # internal_2 = address of allocated object Int - - # Set attribute out of self - lw $t0, 224($sp) # $t0 = self - lw $t1, 212($sp) # $t1 = internal_2 - sw $t1, 8($t0) # self.out = internal_2 - - # Get attribute out of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'out' from the instance - sw $t1, 208($sp) # internal_3 = out - - # Set attribute testee of self - lw $t0, 224($sp) # $t0 = self - lw $t1, 208($sp) # $t1 = internal_3 - sw $t1, 12($t0) # self.testee = internal_3 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 204($sp) # internal_4 = address of allocated object Int - - # Set attribute divisor of self - lw $t0, 224($sp) # $t0 = self - lw $t1, 204($sp) # $t1 = internal_4 - sw $t1, 16($t0) # self.divisor = internal_4 - - # Allocating Int 500 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 500 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 200($sp) # internal_5 = address of allocated object Int - - # Set attribute stop of self - lw $t0, 224($sp) # $t0 = self - lw $t1, 200($sp) # $t1 = internal_5 - sw $t1, 20($t0) # self.stop = internal_5 - - - while_start_8783432246748: - - # Allocating Bool 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 196($sp) # internal_6 = address of allocated object Int - - # If internal_6 then goto while_body_8783432246748 - lw $t0, 196($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8783432246748 - - # Jumping to while_end_8783432246748 - j while_end_8783432246748 - - while_body_8783432246748: - - # Get attribute testee of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'testee' from the instance - sw $t1, 192($sp) # internal_7 = testee - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 188($sp) # internal_8 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_7 - lw $t0, 204($sp) - sw $t0, 4($sp) # Storing internal_7 - - # Argument internal_8 - lw $t0, 200($sp) - sw $t0, 0($sp) # Storing internal_8 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 196($sp) # internal_9 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # Set attribute testee of self - lw $t0, 224($sp) # $t0 = self - lw $t1, 184($sp) # $t1 = internal_9 - sw $t1, 12($t0) # self.testee = internal_9 - - # Allocating Int 2 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 2 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 180($sp) # internal_10 = address of allocated object Int - - # Set attribute divisor of self - lw $t0, 224($sp) # $t0 = self - lw $t1, 180($sp) # $t1 = internal_10 - sw $t1, 16($t0) # self.divisor = internal_10 - - - while_start_8783432246616: - - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 172($sp) # internal_12 = address of allocated object Int - - # Get attribute testee of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'testee' from the instance - sw $t1, 168($sp) # internal_13 = testee - - # Get attribute divisor of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 16($t0) # Get the attribute 'divisor' from the instance - sw $t1, 164($sp) # internal_14 = divisor - - # Get attribute divisor of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 16($t0) # Get the attribute 'divisor' from the instance - sw $t1, 160($sp) # internal_15 = divisor - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_14 - lw $t0, 176($sp) - sw $t0, 4($sp) # Storing internal_14 - - # Argument internal_15 - lw $t0, 172($sp) - sw $t0, 0($sp) # Storing internal_15 - - # Calling function function_mult - jal function_mult - lw $ra, 8($sp) - sw $v1, 168($sp) # internal_16 = result of function_mult - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_13 - lw $t0, 180($sp) - sw $t0, 4($sp) # Storing internal_13 - - # Argument internal_16 - lw $t0, 168($sp) - sw $t0, 0($sp) # Storing internal_16 - - # Calling function function_less_than - jal function_less_than - lw $ra, 8($sp) - sw $v1, 164($sp) # internal_17 = result of function_less_than - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_12 = internal_17 - lw $t0, 152($sp) - sw $t0, 172($sp) - - # If internal_12 then goto then_8783432246592 - lw $t0, 172($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8783432246592 - - # Jumping to else_8783432246592 - j else_8783432246592 - - then_8783432246592: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 148($sp) # internal_18 = address of allocated object Int - - # internal_11 = internal_18 - lw $t0, 148($sp) - sw $t0, 176($sp) - - # Jumping to endif_8783432246592 - j endif_8783432246592 - - else_8783432246592: - - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 140($sp) # internal_20 = address of allocated object Int - - # Get attribute testee of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'testee' from the instance - sw $t1, 136($sp) # internal_21 = testee - - # Get attribute divisor of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 16($t0) # Get the attribute 'divisor' from the instance - sw $t1, 132($sp) # internal_22 = divisor - - # Get attribute testee of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'testee' from the instance - sw $t1, 128($sp) # internal_23 = testee - - # Get attribute divisor of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 16($t0) # Get the attribute 'divisor' from the instance - sw $t1, 124($sp) # internal_24 = divisor - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_23 - lw $t0, 140($sp) - sw $t0, 4($sp) # Storing internal_23 - - # Argument internal_24 - lw $t0, 136($sp) - sw $t0, 0($sp) # Storing internal_24 - - # Calling function function_div - jal function_div - lw $ra, 8($sp) - sw $v1, 132($sp) # internal_25 = result of function_div - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_22 - lw $t0, 144($sp) - sw $t0, 4($sp) # Storing internal_22 - - # Argument internal_25 - lw $t0, 132($sp) - sw $t0, 0($sp) # Storing internal_25 - - # Calling function function_mult - jal function_mult - lw $ra, 8($sp) - sw $v1, 128($sp) # internal_26 = result of function_mult - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_21 - lw $t0, 148($sp) - sw $t0, 4($sp) # Storing internal_21 - - # Argument internal_26 - lw $t0, 128($sp) - sw $t0, 0($sp) # Storing internal_26 - - # Calling function function_sub - jal function_sub - lw $ra, 8($sp) - sw $v1, 124($sp) # internal_27 = result of function_sub - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 108($sp) # internal_28 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_27 - lw $t0, 124($sp) - sw $t0, 4($sp) # Storing internal_27 - - # Argument internal_28 - lw $t0, 120($sp) - sw $t0, 0($sp) # Storing internal_28 - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 116($sp) # internal_29 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_20 = internal_29 - lw $t0, 104($sp) - sw $t0, 140($sp) - - # If internal_20 then goto then_8783432246586 - lw $t0, 140($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8783432246586 - - # Jumping to else_8783432246586 - j else_8783432246586 - - then_8783432246586: - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 100($sp) # internal_30 = address of allocated object Int - - # internal_19 = internal_30 - lw $t0, 100($sp) - sw $t0, 144($sp) - - # Jumping to endif_8783432246586 - j endif_8783432246586 - - else_8783432246586: - - # Allocating Bool 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 96($sp) # internal_31 = address of allocated object Int - - # internal_19 = internal_31 - lw $t0, 96($sp) - sw $t0, 144($sp) - - # Jumping to endif_8783432246586 - j endif_8783432246586 - - endif_8783432246586: - - # internal_11 = internal_19 - lw $t0, 144($sp) - sw $t0, 176($sp) - - # Jumping to endif_8783432246592 - j endif_8783432246592 - - endif_8783432246592: - - # If internal_11 then goto while_body_8783432246616 - lw $t0, 176($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8783432246616 - - # Jumping to while_end_8783432246616 - j while_end_8783432246616 - - while_body_8783432246616: - - # Get attribute divisor of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 16($t0) # Get the attribute 'divisor' from the instance - sw $t1, 92($sp) # internal_32 = divisor - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 88($sp) # internal_33 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_32 - lw $t0, 104($sp) - sw $t0, 4($sp) # Storing internal_32 - - # Argument internal_33 - lw $t0, 100($sp) - sw $t0, 0($sp) # Storing internal_33 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 96($sp) # internal_34 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # Set attribute divisor of self - lw $t0, 224($sp) # $t0 = self - lw $t1, 84($sp) # $t1 = internal_34 - sw $t1, 16($t0) # self.divisor = internal_34 - - # Jumping to while_start_8783432246616 - j while_start_8783432246616 - - while_end_8783432246616: - - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 76($sp) # internal_36 = address of allocated object Int - - # Get attribute testee of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'testee' from the instance - sw $t1, 72($sp) # internal_37 = testee - - # Get attribute divisor of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 16($t0) # Get the attribute 'divisor' from the instance - sw $t1, 68($sp) # internal_38 = divisor - - # Get attribute divisor of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 16($t0) # Get the attribute 'divisor' from the instance - sw $t1, 64($sp) # internal_39 = divisor - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_38 - lw $t0, 80($sp) - sw $t0, 4($sp) # Storing internal_38 - - # Argument internal_39 - lw $t0, 76($sp) - sw $t0, 0($sp) # Storing internal_39 - - # Calling function function_mult - jal function_mult - lw $ra, 8($sp) - sw $v1, 72($sp) # internal_40 = result of function_mult - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_37 - lw $t0, 84($sp) - sw $t0, 4($sp) # Storing internal_37 - - # Argument internal_40 - lw $t0, 72($sp) - sw $t0, 0($sp) # Storing internal_40 - - # Calling function function_less_than - jal function_less_than - lw $ra, 8($sp) - sw $v1, 68($sp) # internal_41 = result of function_less_than - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_36 = internal_41 - lw $t0, 56($sp) - sw $t0, 76($sp) - - # If internal_36 then goto then_8783432246682 - lw $t0, 76($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8783432246682 - - # Jumping to else_8783432246682 - j else_8783432246682 - - then_8783432246682: - - # Get attribute testee of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'testee' from the instance - sw $t1, 52($sp) # internal_42 = testee - - # Set attribute out of self - lw $t0, 224($sp) # $t0 = self - lw $t1, 52($sp) # $t1 = internal_42 - sw $t1, 8($t0) # self.out = internal_42 - - # Get attribute out of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'out' from the instance - sw $t1, 48($sp) # internal_43 = out - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 236($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_43 - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing internal_43 - - # Calling function function_out_int_at_IO - jal function_out_int_at_IO - lw $ra, 8($sp) - sw $v1, 56($sp) # internal_44 = result of function_out_int_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 20 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_45[0] = ' ' - - addi $t0, $zero, 105 - sb $t0, 9($v0) # internal_45[1] = 'i' - - addi $t0, $zero, 115 - sb $t0, 10($v0) # internal_45[2] = 's' - - addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_45[3] = ' ' - - addi $t0, $zero, 112 - sb $t0, 12($v0) # internal_45[4] = 'p' - - addi $t0, $zero, 114 - sb $t0, 13($v0) # internal_45[5] = 'r' - - addi $t0, $zero, 105 - sb $t0, 14($v0) # internal_45[6] = 'i' - - addi $t0, $zero, 109 - sb $t0, 15($v0) # internal_45[7] = 'm' - - addi $t0, $zero, 101 - sb $t0, 16($v0) # internal_45[8] = 'e' - - addi $t0, $zero, 46 - sb $t0, 17($v0) # internal_45[9] = '.' - - addi $t0, $zero, 10 - sb $t0, 18($v0) # internal_45[10] = '\n' - - sb $zero, 19($v0) # Null-terminator at the end of the string - - sw $v0, 40($sp) # internal_45 = " is prime.\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 236($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_45 - lw $t0, 52($sp) - sw $t0, 0($sp) # Storing internal_45 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 48($sp) # internal_46 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_35 = internal_46 - lw $t0, 36($sp) - sw $t0, 80($sp) - - # Jumping to endif_8783432246682 - j endif_8783432246682 - - else_8783432246682: - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_47 = address of allocated object Int - - # internal_35 = internal_47 - lw $t0, 32($sp) - sw $t0, 80($sp) - - # Jumping to endif_8783432246682 - j endif_8783432246682 - - endif_8783432246682: - - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_49 = address of allocated object Int - - # Get attribute stop of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 20($t0) # Get the attribute 'stop' from the instance - sw $t1, 20($sp) # internal_50 = stop - - # Get attribute testee of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'testee' from the instance - sw $t1, 16($sp) # internal_51 = testee - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_50 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_50 - - # Argument internal_51 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_51 - - # Calling function function_less_than_or_equal - jal function_less_than_or_equal - lw $ra, 8($sp) - sw $v1, 24($sp) # internal_52 = result of function_less_than_or_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_49 = internal_52 - lw $t0, 12($sp) - sw $t0, 24($sp) - - # If internal_49 then goto then_8783432246730 - lw $t0, 24($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8783432246730 - - # Jumping to else_8783432246730 - j else_8783432246730 - - then_8783432246730: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 13 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 13 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 104 - sb $t0, 8($v0) # internal_53[0] = 'h' - - addi $t0, $zero, 97 - sb $t0, 9($v0) # internal_53[1] = 'a' - - addi $t0, $zero, 108 - sb $t0, 10($v0) # internal_53[2] = 'l' - - addi $t0, $zero, 116 - sb $t0, 11($v0) # internal_53[3] = 't' - - sb $zero, 12($v0) # Null-terminator at the end of the string - - sw $v0, 8($sp) # internal_53 = "halt" - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_53 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_53 - - # Calling function function_abort_at_Object - jal function_abort_at_Object - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_54 = result of function_abort_at_Object - addi $sp, $sp, 8 # Freeing space for arguments - - # internal_48 = internal_54 - lw $t0, 4($sp) - sw $t0, 28($sp) - - # Jumping to endif_8783432246730 - j endif_8783432246730 - - else_8783432246730: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 17 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 17 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 99 - sb $t0, 8($v0) # internal_55[0] = 'c' - - addi $t0, $zero, 111 - sb $t0, 9($v0) # internal_55[1] = 'o' - - addi $t0, $zero, 110 - sb $t0, 10($v0) # internal_55[2] = 'n' - - addi $t0, $zero, 116 - sb $t0, 11($v0) # internal_55[3] = 't' - - addi $t0, $zero, 105 - sb $t0, 12($v0) # internal_55[4] = 'i' - - addi $t0, $zero, 110 - sb $t0, 13($v0) # internal_55[5] = 'n' - - addi $t0, $zero, 117 - sb $t0, 14($v0) # internal_55[6] = 'u' - - addi $t0, $zero, 101 - sb $t0, 15($v0) # internal_55[7] = 'e' - - sb $zero, 16($v0) # Null-terminator at the end of the string - - sw $v0, 0($sp) # internal_55 = "continue" - - # internal_48 = internal_55 - lw $t0, 0($sp) - sw $t0, 28($sp) - - # Jumping to endif_8783432246730 - j endif_8783432246730 - - endif_8783432246730: - - # Jumping to while_start_8783432246748 - j while_start_8783432246748 - - while_end_8783432246748: - - # Set attribute m of self - lw $t0, 224($sp) # $t0 = self - addi $t1, $zero, 0 # $t1 0 - sw $t1, 24($t0) # Set the attribute m of self - - # Loading return value in $v1 - lw $v1, 224($sp) - - # Freeing space for local variables - addi $sp, $sp, 224 - - jr $ra - - function_main_at_Main: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - main: - # Reserving space for local variables - addi $sp, $sp, -8 - - # Allocating Main - li $v0, 9 - lw $a0, type_Main - syscall - la $t0, type_Main # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object Main - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function___init___at_Main - jal function___init___at_Main - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_Main - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function_main_at_Main - jal function_main_at_Main - lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function_main_at_Main - addi $sp, $sp, 8 # Freeing space for arguments - - # Exit program - li $v0, 10 - syscall - - \ No newline at end of file diff --git a/src/primes.cil b/src/primes.cil deleted file mode 100644 index 0629f333e..000000000 --- a/src/primes.cil +++ /dev/null @@ -1,623 +0,0 @@ -.TYPES -type Object { - inherits from null - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method __init__: function___init___at_Object -} -type IO { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method out_string: function_out_string_at_IO - method out_int: function_out_int_at_IO - method in_string: function_in_string_at_IO - method in_int: function_in_int_at_IO - method __init__: function___init___at_IO -} -type Int { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method __init__: function___init___at_Int -} -type String { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method length: function_length_at_String - method concat: function_concat_at_String - method substr: function_substr_at_String - method __init__: function___init___at_String -} -type Bool { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method __init__: function___init___at_Bool -} -type Main { - inherits from IO - - attribute out - attribute testee - attribute divisor - attribute stop - attribute m - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method out_string: function_out_string_at_IO - method out_int: function_out_int_at_IO - method in_string: function_in_string_at_IO - method in_int: function_in_int_at_IO - method main: function_main_at_Main - method __init__: function___init___at_Main -} - -.DATA - - -.CODE -function function_add{ - PARAM a - PARAM b - - LOCAL internal_0 # Adding result - - internal_0 = ALLOCINT 0 - internal_0 = a + b - - RETURN internal_0 -} -function function_sub{ - PARAM a - PARAM b - - LOCAL internal_0 # Substracting result - - internal_0 = ALLOCINT 0 - internal_0 = a - b - - RETURN internal_0 -} -function function_mult{ - PARAM a - PARAM b - - LOCAL internal_0 # Multiting result - - internal_0 = ALLOCINT 0 - internal_0 = a * b - - RETURN internal_0 -} -function function_div{ - PARAM a - PARAM b - - LOCAL internal_0 # Dividing result - - internal_0 = ALLOCINT 0 - internal_0 = a / b - - RETURN internal_0 -} -function function_xor{ - PARAM a - PARAM b - - LOCAL internal_0 # Xor result - - internal_0 = ALLOCINT 0 - internal_0 = XOR a b - - RETURN internal_0 -} -function function_less_than{ - PARAM a - PARAM b - - LOCAL internal_0 # Less than result - - internal_0 = ALLOCBOOL 0 - internal_0 = a < b - - RETURN internal_0 -} -function function_less_than_or_equal{ - PARAM a - PARAM b - - LOCAL internal_0 # Less than or equal result - - internal_0 = ALLOCBOOL 0 - internal_0 = a <= b - - RETURN internal_0 -} -function function_equal{ - PARAM a - PARAM b - - LOCAL internal_0 # Equal result - LOCAL internal_1 # Type of a - LOCAL internal_2 # Type Int - LOCAL internal_3 # Type Bool - LOCAL internal_4 # Type String - LOCAL internal_5 # Type of a equals int - LOCAL internal_6 # Type of a equals bool - LOCAL internal_7 # Type of a equals string - - internal_0 = ALLOCBOOL 0 - internal_1 = TYPEOF a - internal_2 = TYPEADDR Int - internal_3 = TYPEADDR Bool - internal_4 = TYPEADDR String - internal_5 = ALLOCBOOL 0 - internal_6 = ALLOCBOOL 0 - internal_7 = ALLOCBOOL 0 - internal_5 = EQUALADDR internal_1 internal_2 - internal_6 = EQUALADDR internal_1 internal_3 - internal_7 = EQUALADDR internal_1 internal_4 - - IF internal_5 GOTO a_is_type_int_or_bool - IF internal_6 GOTO a_is_type_int_or_bool - IF internal_7 GOTO a_is_type_string - GOTO a_is_type_object - - a_is_type_int_or_bool: - internal_0 = EQUALINT a b - GOTO end_of_equal - - a_is_type_string: - internal_0 = EQUALSTR a b - GOTO end_of_equal - - a_is_type_object: - internal_0 = a == b - GOTO end_of_equal - - end_of_equal: - - RETURN internal_0 -} -function function_assign{ - PARAM dest - PARAM source - - LOCAL internal_0 # Type of source - LOCAL internal_1 # Type Int - LOCAL internal_2 # Type Bool - LOCAL internal_3 # Type of source equals int - LOCAL internal_4 # Type of source equals bool - - internal_0 = TYPEOF source - internal_1 = TYPEADDR Int - internal_2 = TYPEADDR Bool - internal_3 = ALLOCBOOL 0 - internal_4 = ALLOCBOOL 0 - internal_3 = EQUALADDR internal_1 internal_1 - internal_4 = EQUALADDR internal_1 internal_2 - - IF internal_3 GOTO source_is_type_int_or_bool - IF internal_4 GOTO source_is_type_int_or_bool - GOTO source_is_type_object - - source_is_type_int_or_bool: - dest = INT source - GOTO source_end_of_equal - - source_is_type_object: - dest = source - GOTO source_end_of_equal - - source_end_of_equal: - - RETURN dest -} -function function___init___at_Object{ - PARAM self - - RETURN self -} -function function_abort_at_Object{ - PARAM self - - LOCAL internal_0 # Message - LOCAL internal_1 # Message - LOCAL internal_2 # Endl - LOCAL internal_3 # Message - - internal_0 = ALLOCSTR "Abort in " - internal_2 = ALLOCSTR "\n" - ARG self - internal_1 = VCALL String function_type_name_at_Object - ARG internal_0 - ARG internal_1 - internal_3 = VCALL String function_concat_at_String - ARG internal_3 - ARG internal_2 - internal_3 = VCALL String function_concat_at_String - PRINTSTR internal_3 - HALT - - RETURN self -} -function function_type_name_at_Object{ - PARAM self - - LOCAL internal_0 # type_name - - internal_0 = TYPENAME self - - RETURN internal_0 -} -function function_copy_at_Object{ - PARAM self - - LOCAL internal_0 - - internal_0 = COPY self - - RETURN internal_0 -} -function function___init___at_IO{ - PARAM self - - RETURN self -} -function function_out_string_at_IO{ - PARAM self - PARAM x - - PRINTSTR x - - RETURN self -} -function function_out_int_at_IO{ - PARAM self - PARAM x - - PRINTINT x - - RETURN self -} -function function_in_string_at_IO{ - PARAM self - - LOCAL internal_0 - - READSTR internal_0 - - RETURN internal_0 -} -function function_in_int_at_IO{ - PARAM self - - LOCAL internal_0 - - internal_0 = ALLOCINT 0 - READINT internal_0 - - RETURN internal_0 -} -function function___init___at_String{ - PARAM self - - RETURN self -} -function function_length_at_String{ - PARAM self - - LOCAL internal_0 - - internal_0 = LENGTH self - - RETURN internal_0 -} -function function_concat_at_String{ - PARAM self - PARAM s - - LOCAL internal_0 - - internal_0 = CONCAT self s - - RETURN internal_0 -} -function function_substr_at_String{ - PARAM self - PARAM i - PARAM l - - LOCAL internal_0 - - internal_0 = SUBSTRING self i l - - RETURN internal_0 -} -function function___init___at_Main{ - PARAM self - - LOCAL internal_0 # String "2 is trivially prime.\n" - LOCAL internal_1 - LOCAL internal_2 # Integer 2 - LOCAL internal_3 - LOCAL internal_4 # Integer 0 - LOCAL internal_5 # Integer 500 - LOCAL internal_6 # Boolean true - LOCAL internal_7 - LOCAL internal_8 # Integer 1 - LOCAL internal_9 # Store the result of the operation function_add - LOCAL internal_10 # Integer 2 - LOCAL internal_11 - LOCAL internal_12 - LOCAL internal_13 - LOCAL internal_14 - LOCAL internal_15 - LOCAL internal_16 # Store the result of the operation function_mult - LOCAL internal_17 # Store the result of the operation function_less_than - LOCAL internal_18 # Boolean false - LOCAL internal_19 - LOCAL internal_20 - LOCAL internal_21 - LOCAL internal_22 - LOCAL internal_23 - LOCAL internal_24 - LOCAL internal_25 # Store the result of the operation function_div - LOCAL internal_26 # Store the result of the operation function_mult - LOCAL internal_27 # Store the result of the operation function_sub - LOCAL internal_28 # Integer 0 - LOCAL internal_29 # Store the result of the operation function_equal - LOCAL internal_30 # Boolean false - LOCAL internal_31 # Boolean true - LOCAL internal_32 - LOCAL internal_33 # Integer 1 - LOCAL internal_34 # Store the result of the operation function_add - LOCAL internal_35 - LOCAL internal_36 - LOCAL internal_37 - LOCAL internal_38 - LOCAL internal_39 - LOCAL internal_40 # Store the result of the operation function_mult - LOCAL internal_41 # Store the result of the operation function_less_than - LOCAL internal_42 - LOCAL internal_43 - LOCAL internal_44 - LOCAL internal_45 # String " is prime.\n" - LOCAL internal_46 - LOCAL internal_47 # Integer 0 - LOCAL internal_48 - LOCAL internal_49 - LOCAL internal_50 - LOCAL internal_51 - LOCAL internal_52 # Store the result of the operation function_less_than_or_equal - LOCAL internal_53 # String "halt" - LOCAL internal_54 - LOCAL internal_55 # String "continue" - - internal_0 = ALLOCSTR "2 is trivially prime.\n" - ARG self - ARG internal_0 - internal_1 = VCALL Main function_out_string_at_IO - internal_2 = ALLOCINT 2 - - SETATTR self out internal_2 - internal_3 = GETATTR self out - - SETATTR self testee internal_3 - internal_4 = ALLOCINT 0 - - SETATTR self divisor internal_4 - internal_5 = ALLOCINT 500 - - SETATTR self stop internal_5 - - # While loop - while_start_8783432246748: - internal_6 = ALLOCBOOL 1 - IF internal_6 GOTO while_body_8783432246748 - GOTO while_end_8783432246748 - - while_body_8783432246748: - internal_7 = GETATTR self testee - internal_8 = ALLOCINT 1 - - ARG internal_7 - ARG internal_8 - internal_9 = CALL function_add - - SETATTR self testee internal_9 - internal_10 = ALLOCINT 2 - - SETATTR self divisor internal_10 - - # While loop - while_start_8783432246616: - # Conditional - internal_12 = ALLOCBOOL 0 - internal_13 = GETATTR self testee - internal_14 = GETATTR self divisor - internal_15 = GETATTR self divisor - - ARG internal_14 - ARG internal_15 - internal_16 = CALL function_mult - - ARG internal_13 - ARG internal_16 - internal_17 = CALL function_less_than - internal_12 = internal_17 - IF internal_12 GOTO then_8783432246592 - GOTO else_8783432246592 - - then_8783432246592: - internal_18 = ALLOCBOOL 0 - internal_11 = internal_18 - GOTO endif_8783432246592 - - else_8783432246592: - # Conditional - internal_20 = ALLOCBOOL 0 - internal_21 = GETATTR self testee - internal_22 = GETATTR self divisor - internal_23 = GETATTR self testee - internal_24 = GETATTR self divisor - - ARG internal_23 - ARG internal_24 - internal_25 = CALL function_div - - ARG internal_22 - ARG internal_25 - internal_26 = CALL function_mult - - ARG internal_21 - ARG internal_26 - internal_27 = CALL function_sub - internal_28 = ALLOCINT 0 - - ARG internal_27 - ARG internal_28 - internal_29 = CALL function_equal - internal_20 = internal_29 - IF internal_20 GOTO then_8783432246586 - GOTO else_8783432246586 - - then_8783432246586: - internal_30 = ALLOCBOOL 0 - internal_19 = internal_30 - GOTO endif_8783432246586 - - else_8783432246586: - internal_31 = ALLOCBOOL 1 - internal_19 = internal_31 - GOTO endif_8783432246586 - - endif_8783432246586: - internal_11 = internal_19 - GOTO endif_8783432246592 - - endif_8783432246592: - IF internal_11 GOTO while_body_8783432246616 - GOTO while_end_8783432246616 - - while_body_8783432246616: - internal_32 = GETATTR self divisor - internal_33 = ALLOCINT 1 - - ARG internal_32 - ARG internal_33 - internal_34 = CALL function_add - - SETATTR self divisor internal_34 - GOTO while_start_8783432246616 - - while_end_8783432246616: - # Conditional - internal_36 = ALLOCBOOL 0 - internal_37 = GETATTR self testee - internal_38 = GETATTR self divisor - internal_39 = GETATTR self divisor - - ARG internal_38 - ARG internal_39 - internal_40 = CALL function_mult - - ARG internal_37 - ARG internal_40 - internal_41 = CALL function_less_than - internal_36 = internal_41 - IF internal_36 GOTO then_8783432246682 - GOTO else_8783432246682 - - then_8783432246682: - internal_42 = GETATTR self testee - - SETATTR self out internal_42 - internal_43 = GETATTR self out - ARG self - ARG internal_43 - internal_44 = VCALL Main function_out_int_at_IO - internal_45 = ALLOCSTR " is prime.\n" - ARG self - ARG internal_45 - internal_46 = VCALL Main function_out_string_at_IO - internal_35 = internal_46 - GOTO endif_8783432246682 - - else_8783432246682: - internal_47 = ALLOCINT 0 - internal_35 = internal_47 - GOTO endif_8783432246682 - - endif_8783432246682: - # Conditional - internal_49 = ALLOCBOOL 0 - internal_50 = GETATTR self stop - internal_51 = GETATTR self testee - - ARG internal_50 - ARG internal_51 - internal_52 = CALL function_less_than_or_equal - internal_49 = internal_52 - IF internal_49 GOTO then_8783432246730 - GOTO else_8783432246730 - - then_8783432246730: - internal_53 = ALLOCSTR "halt" - ARG internal_53 - internal_54 = VCALL String function_abort_at_Object - internal_48 = internal_54 - GOTO endif_8783432246730 - - else_8783432246730: - internal_55 = ALLOCSTR "continue" - internal_48 = internal_55 - GOTO endif_8783432246730 - - endif_8783432246730: - GOTO while_start_8783432246748 - - while_end_8783432246748: - - SETATTR self m 0 - - RETURN self -} -function function_main_at_Main{ - PARAM self - - LOCAL internal_0 # Integer 0 - - internal_0 = ALLOCINT 0 - - RETURN internal_0 -} -function main{ - - - LOCAL internal_0 - LOCAL internal_1 - - internal_0 = ALLOCATE Main - ARG internal_0 - internal_0 = VCALL Main function___init___at_Main - - ARG internal_0 - internal_1 = VCALL Main function_main_at_Main - - HALT -} \ No newline at end of file diff --git a/src/primes.cl b/src/primes.cl deleted file mode 100644 index 416b69cdf..000000000 --- a/src/primes.cl +++ /dev/null @@ -1,86 +0,0 @@ - -(* - * methodless-primes.cl - * - * Designed by Jesse H. Willett, jhw@cory, 11103234, with - * Istvan Siposs, isiposs@cory, 12342921. - * - * This program generates primes in order without using any methods. - * Actually, it does use three methods: those of IO to print out each - * prime, and abort() to halt the program. These methods are incidental, - * however, to the information-processing functionality of the program. We - * could regard the attribute 'out's sequential values as our output, and - * the string "halt" as our terminate signal. - * - * Naturally, using Cool this way is a real waste, basically reducing it - * to assembly without the benefit of compilation. - * - * There could even be a subroutine-like construction, in that different - * code could be in the assign fields of attributes of other classes, - * and it could be executed by calling 'new Sub', but no parameters - * could be passed to the subroutine, and it could only return itself. - * but returning itself would be useless since we couldn't call methods - * and the only operators we have are for Int and Bool, which do nothing - * interesting when we initialize them! - *) - -class Main inherits IO { - - main() : Int { -- main() is an atrophied method so we can parse. - 0 - }; - - out : Int <- -- out is our 'output'. Its values are the primes. - { - out_string("2 is trivially prime.\n"); - 2; - }; - - testee : Int <- out; -- testee is a number to be tested for primeness. - - divisor : Int; -- divisor is a number which may factor testee. - - stop : Int <- 500; -- stop is an arbitrary value limiting testee. - - m : Object <- -- m supplants the main method. - while true - loop - { - - testee <- testee + 1; - divisor <- 2; - - while - if testee < divisor * divisor then - false -- can stop if divisor > sqrt(testee). - else - if testee - divisor*(testee / divisor) = 0 then - false -- can stop if divisor divides testee. - else - true - fi - fi - loop - divisor <- divisor + 1 - pool; - - if testee < divisor * divisor -- which reason did we stop for? - then -- testee has no factors less than sqrt(testee). - { - out <- testee; -- we could think of out itself as the output. - out_int(out); - out_string(" is prime.\n"); - } - else -- the loop halted on testee/divisor = 0, testee isn't prime. - 0 -- testee isn't prime, do nothing. - fi; - - if stop <= testee then - "halt".abort() -- we could think of "halt" as SIGTERM. - else - "continue" - fi; - } - pool; -}; (* end of Main *) - diff --git a/src/print-cool.asm b/src/print-cool.asm deleted file mode 100644 index 742fdbd1f..000000000 --- a/src/print-cool.asm +++ /dev/null @@ -1,1612 +0,0 @@ -.data - type_Object: .word 8 - type_Object_inherits_from: .word 0 - type_Object_attributes: .word 0 - type_Object_name_size: .word 6 - type_Object_name: .asciiz "Object" - type_Object_abort_message: .asciiz "Abort called from class Object\n" - - type_IO: .word 8 - type_IO_inherits_from: .word type_Object - type_IO_attributes: .word 0 - type_IO_name_size: .word 2 - type_IO_name: .asciiz "IO" - type_IO_abort_message: .asciiz "Abort called from class IO\n" - - type_Int: .word 8 - type_Int_inherits_from: .word type_Object - type_Int_attributes: .word 0 - type_Int_name_size: .word 3 - type_Int_name: .asciiz "Int" - type_Int_abort_message: .asciiz "Abort called from class Int\n" - - type_String: .word 8 - type_String_inherits_from: .word type_Object - type_String_attributes: .word 0 - type_String_name_size: .word 6 - type_String_name: .asciiz "String" - type_String_abort_message: .asciiz "Abort called from class String\n" - - type_Bool: .word 8 - type_Bool_inherits_from: .word type_Object - type_Bool_attributes: .word 0 - type_Bool_name_size: .word 4 - type_Bool_name: .asciiz "Bool" - type_Bool_abort_message: .asciiz "Abort called from class Bool\n" - - type_Main: .word 8 - type_Main_inherits_from: .word type_IO - type_Main_attributes: .word 0 - type_Main_name_size: .word 4 - type_Main_name: .asciiz "Main" - type_Main_abort_message: .asciiz "Abort called from class Main\n" - - buffer_input: .space 1024 - debug_log: .asciiz "debug_log\n" - -.text - function_add: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Addition operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - add $t2, $t0, $t1 # $t2 = $t0 + $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_sub: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Subtraction operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - sub $t2, $t0, $t1 # $t2 = $t0 - $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_mult: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Multiplication operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - mult $t0, $t1 # $t2 = $t0 * $t1 - mflo $t2 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_div: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Division operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - div $t0, $t1 # $t2 = $t0 / $t1 - mflo $t2 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_xor: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Xor operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_less_than: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Less than operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_less_than_or_equal: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Less than operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_equal: - # Function parameters - # $ra = 48($sp) - # a = 44($sp) - # b = 40($sp) - - # Reserving space for local variables - addi $sp, $sp, -40 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_0 = address of allocated object Int - - # Allocating NUll to internal_1 - sw $zero, 32($sp) # internal_1 = 0 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_2 = address of allocated object Int - - # internal_2 = EqualAddress(a, internal_1) - lw $t0, 44($sp) - lw $t1, 32($sp) - seq $t2, $t0, $t1 - lw $t0, 28($sp) - sw $t2, 8($t0) - - # internal_2 = EqualAddress(b, internal_1) - lw $t0, 40($sp) - lw $t1, 32($sp) - seq $t2, $t0, $t1 - lw $t0, 28($sp) - sw $t2, 8($t0) - - # If internal_2 then goto a_is_type_object - lw $t0, 28($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, a_is_type_object - - # internal_3 = typeof a that is the first word of the object - lw $t0, 44($sp) - lw $t0, 0($t0) - sw $t0, 24($sp) - - # internal_4 = direction of Int - la $t0, type_Int - sw $t0, 20($sp) - - # internal_5 = direction of Bool - la $t0, type_Bool - sw $t0, 16($sp) - - # internal_6 = direction of String - la $t0, type_String - sw $t0, 12($sp) - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_7 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_8 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_9 = address of allocated object Int - - # internal_7 = EqualAddress(internal_3, internal_4) - lw $t0, 24($sp) - lw $t1, 20($sp) - seq $t2, $t0, $t1 - lw $t0, 8($sp) - sw $t2, 8($t0) - - # internal_8 = EqualAddress(internal_3, internal_5) - lw $t0, 24($sp) - lw $t1, 16($sp) - seq $t2, $t0, $t1 - lw $t0, 4($sp) - sw $t2, 8($t0) - - # internal_9 = EqualAddress(internal_3, internal_6) - lw $t0, 24($sp) - lw $t1, 12($sp) - seq $t2, $t0, $t1 - lw $t0, 0($sp) - sw $t2, 8($t0) - - # If internal_7 then goto a_is_type_int_or_bool - lw $t0, 8($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, a_is_type_int_or_bool - - # If internal_8 then goto a_is_type_int_or_bool - lw $t0, 4($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, a_is_type_int_or_bool - - # If internal_9 then goto a_is_type_string - lw $t0, 0($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, a_is_type_string - - # Jumping to a_is_type_object - j a_is_type_object - - a_is_type_int_or_bool: - - # internal_0 = EqualInt(a, b) - lw $t0, 44($sp) - lw $t0, 8($t0) - lw $t1, 40($sp) - lw $t1, 8($t1) - seq $t2, $t0, $t1 - lw $t0, 36($sp) - sw $t2, 8($t0) - - # Jumping to end_of_equal - j end_of_equal - - a_is_type_string: - - # internal_0 = EqualStr(a, b) - lw $t0, 44($sp) - lw $t1, 40($sp) - addi $t0, $t0, 8 - addi $t1, $t1, 8 - - # By default we assume the strings are equals - addi $t4, $zero, 1 - lw $t5, 36($sp) - sw $t4, 8($t5) - - while_compare_strings_start: - lb $t2, 0($t0) - lb $t3, 0($t1) - beq $t2, $t3, while_compare_strings_update - - # The strings are no equals - lw $t5, 36($sp) - sw $zero, 8($t5) - j while_compare_strings_end - - while_compare_strings_update: - addi $t0, $t0, 1 - addi $t1, $t1, 1 - beq $t2, $zero, while_compare_strings_end - beq $t3, $zero, while_compare_strings_end - j while_compare_strings_start - while_compare_strings_end: - - # Jumping to end_of_equal - j end_of_equal - - a_is_type_object: - - # Equal operation - lw $t0, 44($sp) # Save in $t0 the left operand address - lw $t1, 40($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 - - lw $t0, 36($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # Jumping to end_of_equal - j end_of_equal - - end_of_equal: - - # Loading return value in $v1 - lw $v1, 36($sp) - - # Freeing space for local variables - addi $sp, $sp, 40 - - jr $ra - - function_assign: - # Function parameters - # $ra = 36($sp) - # dest = 32($sp) - # source = 28($sp) - - # Reserving space for local variables - addi $sp, $sp, -28 - - # Allocating NUll to internal_0 - sw $zero, 24($sp) # internal_0 = 0 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_1 = address of allocated object Int - - # internal_1 = EqualAddress(source, internal_0) - lw $t0, 28($sp) - lw $t1, 24($sp) - seq $t2, $t0, $t1 - lw $t0, 20($sp) - sw $t2, 8($t0) - - # internal_1 = EqualAddress(dest, internal_0) - lw $t0, 32($sp) - lw $t1, 24($sp) - seq $t2, $t0, $t1 - lw $t0, 20($sp) - sw $t2, 8($t0) - - # If internal_1 then goto source_is_type_object - lw $t0, 20($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, source_is_type_object - - # internal_2 = typeof source that is the first word of the object - lw $t0, 28($sp) - lw $t0, 0($t0) - sw $t0, 16($sp) - - # internal_3 = direction of Int - la $t0, type_Int - sw $t0, 12($sp) - - # internal_4 = direction of Bool - la $t0, type_Bool - sw $t0, 8($sp) - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_5 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_6 = address of allocated object Int - - # internal_5 = EqualAddress(internal_2, internal_3) - lw $t0, 16($sp) - lw $t1, 12($sp) - seq $t2, $t0, $t1 - lw $t0, 4($sp) - sw $t2, 8($t0) - - # internal_6 = EqualAddress(internal_2, internal_4) - lw $t0, 16($sp) - lw $t1, 8($sp) - seq $t2, $t0, $t1 - lw $t0, 0($sp) - sw $t2, 8($t0) - - # If internal_5 then goto source_is_type_int_or_bool - lw $t0, 4($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, source_is_type_int_or_bool - - # If internal_6 then goto source_is_type_int_or_bool - lw $t0, 0($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, source_is_type_int_or_bool - - # Jumping to source_is_type_object - j source_is_type_object - - source_is_type_int_or_bool: - - # dest = source where source is an integer - li $v0, 9 - addi $a0, $zero, 12 - syscall - lw $t0, 28($sp) # Pointer to source - lw $t1, 0($t0) # $t1 = type of source - lw $t2, 8($t0) # $t2 = value of source - sw $t1, 0($v0) # Save type of dest - sw $a0, 4($v0) # Save size of dest - sw $t2, 8($v0) # Save value of dest - sw $v0, 32($sp) - - # Jumping to source_end_of_equal - j source_end_of_equal - - source_is_type_object: - - # dest = source - lw $t0, 28($sp) - sw $t0, 32($sp) - - # Jumping to source_end_of_equal - j source_end_of_equal - - source_end_of_equal: - - # Loading return value in $v1 - lw $v1, 32($sp) - - # Freeing space for local variables - addi $sp, $sp, 28 - - jr $ra - - function___init___at_Object: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_abort_at_Object: - # Function parameters - # $ra = 20($sp) - # self = 16($sp) - - # Reserving space for local variables - addi $sp, $sp, -16 - - # Allocating String - li $v0, 9 - addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 33 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 65 - sb $t0, 8($v0) # internal_0[0] = 'A' - - addi $t0, $zero, 98 - sb $t0, 9($v0) # internal_0[1] = 'b' - - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_0[2] = 'o' - - addi $t0, $zero, 114 - sb $t0, 11($v0) # internal_0[3] = 'r' - - addi $t0, $zero, 116 - sb $t0, 12($v0) # internal_0[4] = 't' - - addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_0[5] = ' ' - - addi $t0, $zero, 99 - sb $t0, 14($v0) # internal_0[6] = 'c' - - addi $t0, $zero, 97 - sb $t0, 15($v0) # internal_0[7] = 'a' - - addi $t0, $zero, 108 - sb $t0, 16($v0) # internal_0[8] = 'l' - - addi $t0, $zero, 108 - sb $t0, 17($v0) # internal_0[9] = 'l' - - addi $t0, $zero, 101 - sb $t0, 18($v0) # internal_0[10] = 'e' - - addi $t0, $zero, 100 - sb $t0, 19($v0) # internal_0[11] = 'd' - - addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_0[12] = ' ' - - addi $t0, $zero, 102 - sb $t0, 21($v0) # internal_0[13] = 'f' - - addi $t0, $zero, 114 - sb $t0, 22($v0) # internal_0[14] = 'r' - - addi $t0, $zero, 111 - sb $t0, 23($v0) # internal_0[15] = 'o' - - addi $t0, $zero, 109 - sb $t0, 24($v0) # internal_0[16] = 'm' - - addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_0[17] = ' ' - - addi $t0, $zero, 99 - sb $t0, 26($v0) # internal_0[18] = 'c' - - addi $t0, $zero, 108 - sb $t0, 27($v0) # internal_0[19] = 'l' - - addi $t0, $zero, 97 - sb $t0, 28($v0) # internal_0[20] = 'a' - - addi $t0, $zero, 115 - sb $t0, 29($v0) # internal_0[21] = 's' - - addi $t0, $zero, 115 - sb $t0, 30($v0) # internal_0[22] = 's' - - addi $t0, $zero, 32 - sb $t0, 31($v0) # internal_0[23] = ' ' - - sb $zero, 32($v0) # Null-terminator at the end of the string - - sw $v0, 12($sp) # internal_0 = "Abort called from class " - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_2[0] = '\n' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 4($sp) # internal_2 = "\n" - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument self - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_type_name_at_Object - jal function_type_name_at_Object - lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_0 - lw $t0, 24($sp) - sw $t0, 4($sp) # Storing internal_0 - - # Argument internal_1 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function_concat_at_String - jal function_concat_at_String - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_3 - lw $t0, 12($sp) - sw $t0, 4($sp) # Storing internal_3 - - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_concat_at_String - jal function_concat_at_String - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String - addi $sp, $sp, 12 # Freeing space for arguments - - lw $t0, 0($sp) # $t0 = internal_3 - addi $t0, $t0, 8 # Pointer to the first character of the string - - # Printing the string internal_3 - li $v0, 4 - move $a0, $t0 - syscall - - # Exit program - li $v0, 10 - syscall - - # Loading return value in $v1 - lw $v1, 16($sp) - - # Freeing space for local variables - addi $sp, $sp, 16 - - jr $ra - - function_type_name_at_Object: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = name of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($t0) # $t1 = type of self - lw $t2, 12($t1) # $t1 = length of the name of self - la $t3, 16($t1) # $t1 = name of self - - addi $t2, $t2, 9 # Setting space for the type, the size and the null byte - li $v0, 9 - move $a0, $t2 - syscall - addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte - - la $t4, type_String - sw $t4, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - - addi $t4, $v0, 0 # $t4 = direction of the new string - addi $t4, $t4, 8 # Pointer to the first character of the string - xor $t5, $t5, $t5 # Initializing counter - while_copy_name_start: - beq $t5, $t2, while_copy_name_end - lb $t6, 0($t3) # Loading the character - sb $t6, 0($t4) - addi $t4, $t4, 1 # Incrementing the pointer to the new string - addi $t3, $t3, 1 # Incrementing the pointer to the string in self - addi $t5, $t5, 1 # Incrementing counter - j while_copy_name_start - while_copy_name_end: - - sb $zero, 0($t4) # Setting the null byte - - sw $v0, 0($sp) # Storing the new string in internal_0 - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_copy_at_Object: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = copy of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($t0) # $t1 = type of self - lw $t2, 4($t0) # $t2 = length of self in bytes - - # Allocating space for the new object - li $v0, 9 - move $a0, $t2 - syscall - move $t3, $v0 # $t3 = direction of the new object - sw $t1, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - - # Initializing the variable of the loop - addi $t0, $t0, 8 # Pointer to the first character of the object - addi $t3, $t3, 8 # Pointer to the first character of the object - addi $t2, $2, -8 # Decrementing in 8 the length of the object - xor $t4, $t4, $t4 # Initializing counter - - # Loop copying the object - while_copy_start: - beq $t4, $t2, while_copy_end - lb $t5, 0($t0) # Loading the byte - sb $t5, 0($t3) # Storing the byte - addi $t0, $t0, 1 # Incrementing the pointer to the object - addi $t3, $t3, 1 # Incrementing the pointer to the new object - addi $t4, $t4, 1 # Incrementing counter - j while_copy_start - while_copy_end: - sw $v0, 0($sp) # Storing the new object in internal_0 - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function___init___at_IO: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_out_string_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - # x = 0($sp) - - lw $t0, 0($sp) # $t0 = x - addi $t0, $t0, 8 # Pointer to the first character of the string - - # Printing the string x - li $v0, 4 - move $a0, $t0 - syscall - - # Loading return value in $v1 - lw $v1, 4($sp) - - jr $ra - - function_out_int_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - # x = 0($sp) - - # Printing the string x - li $v0, 1 - lw $a0, 0($sp) - lw $a0, 8($a0) - syscall - - # Loading return value in $v1 - lw $v1, 4($sp) - - jr $ra - - function_in_string_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - li $v0, 8 - la $a0, buffer_input - li $a1, 1024 - syscall - - xor $t0, $t0, $t0 # Initializing counter - while_read_start: - lb $t1, buffer_input($t0) # Loading the byte - beq $t1, $zero, while_read_end - addi $t0, $t0, 1 # Incrementing counter - j while_read_start - while_read_end: - addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' - - addi $t0, $t0, 9 # Adding space for the type, the size and the null byte - li $v0, 9 - move $a0, $t0 - syscall - addi $t0, $t0, -9 # Adding space for the type, the size and the null byte - la $t2, type_String - sw $t2, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - - addi $t3, $v0, 8 # Pointer to the first character of the string - xor $t4, $t4, $t4 # Initializing counter - - while_copy_from_buffer_start: - beq $t4, $t0, while_copy_from_buffer_end - lb $t5, buffer_input($t4) # Loading the byte - sb $t5, 0($t3) # Storing the byte - addi $t3, $t3, 1 # Imcremeenting pointer - addi $t4, $t4, 1 # Incrementing counter - j while_copy_from_buffer_start - while_copy_from_buffer_end: - - sb $zero, 0($t3) # Storing the null byte - - sw $v0, 0($sp) # Storing the new object in internal_0 - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_in_int_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - li $v0, 5 - syscall - lw $t0, 0($sp) - sw $v0, 8($t0) - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function___init___at_String: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_length_at_String: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # internal_0 = length of self - lw $t0, 4($sp) - lw $t1, 4($t0) - addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator - lw $t0, 0($sp) - sw $t1, 8($t0) - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_concat_at_String: - # Function parameters - # $ra = 12($sp) - # self = 8($sp) - # s = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = self + s - lw $t0, 8($sp) - lw $t1, 4($sp) - lw $t2, 4($t0) # $t2 = length of str1 - lw $t3, 4($t1) # $t3 = length of str2 - addi $t2, $t2, -9 - addi $t3, $t3, -9 - add $t4, $t2, $t3 # $t4 = length of str1 + str2 - addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) - - li $v0, 9 - move $a0, $t4 - syscall - addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 - add $t5, $zero, $v0 # $t5 = address of the new string object - addi $t5, $t5, 8 # $t5 = address of the first byte of the new string - - la $t8, type_String - sw $t8, 0($v0) # Setting type in the first word of th object - - sw $a0, 4($v0) # Setting length of the string in the second word of the object - - # Copying str1 to the new string - xor $t6, $t6, $t6 # $t6 = 0 Initializing counter - while_copy_str1_start: - beq $t6, $t2, while_copy_str1_end - lb $t7, 8($t0) - sb $t7, 0($t5) - add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_str1_start - while_copy_str1_end: - - # Copying str2 to the new string - while_copy_str2_start: - beq $t6, $t4, while_copy_str2_end - lb $t7, 8($t1) - sb $t7, 0($t5) - add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_str2_start - while_copy_str2_end: - - sb $zero, 0($t5) # Setting the null-terminator - - sw $v0, 0($sp) # internal_0 = self + s - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_substr_at_String: - # Function parameters - # $ra = 16($sp) - # self = 12($sp) - # i = 8($sp) - # l = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = self[i:i + l] - lw $t0, 12($sp) # $t0 = address of the string - lw $t1, 4($t0) # $t1 = length of the string - addi $t1, $t1, -9 # $t1 = length of the string + 9 - lw $t2, 8($sp) # $t2 = start of the substring - lw $t2, 8($t2) - lw $t3, 4($sp) # $t3 = length of the substring - lw $t3, 8($t3) - add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring - - bgt $t4, $t1, substring_out_of_bounds - - addi $t3, $t3, 9 - li $v0, 9 - move $a0, $t3 - syscall - addi $t3, $t3, -9 - - la $t5, type_String - sw $t5, 0($v0) # Setting type in the first word of the object - - sw $a0, 4($v0) # Setting length in the second word of the object - - addi $t0, $t0, 8 # pointing to the first byte of the string - add $t0, $t0, $t2 # pointing to the first byte of the substring - move $t5, $v0 # $t5 = address of the new string - add $t5, $t5, 8 # pointing to the first byte of the string - xor $t6, $t6, $t6 # $t6 = 0 Initializing counter - while_copy_substr_start: - beq $t6, $t3, while_copy_substr_end - lb $t7, 0($t0) - sb $t7, 0($t5) - addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_substr_start - while_copy_substr_end: - - sb $zero, 0($t5) # Setting the null-terminator - - sw $v0, 0($sp) # internal_0 = self[i:i + l] - j substring_not_out_of_bounds - - substring_out_of_bounds: - li $v0, 17 - addi $a0, $zero, 1 - syscall - - substring_not_out_of_bounds: - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function___init___at_Main: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_main_at_Main: - # Function parameters - # $ra = 64($sp) - # self = 60($sp) - - # Reserving space for local variables - addi $sp, $sp, -60 - - # Allocating Object - li $v0, 9 - lw $a0, type_Object - syscall - la $t0, type_Object # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 56($sp) # internal_0 = address of allocated object Object - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 64($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function___init___at_Object - jal function___init___at_Object - lw $ra, 4($sp) - sw $v1, 64($sp) # internal_0 = result of function___init___at_Object - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 64($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function_type_name_at_Object - jal function_type_name_at_Object - lw $ra, 4($sp) - sw $v1, 60($sp) # internal_1 = result of function_type_name_at_Object - addi $sp, $sp, 8 # Freeing space for arguments - - # Allocating Int 4 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 4 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_2 = address of allocated object Int - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_3 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address - - # Argument internal_1 - lw $t0, 68($sp) - sw $t0, 8($sp) # Storing internal_1 - - # Argument internal_2 - lw $t0, 64($sp) - sw $t0, 4($sp) # Storing internal_2 - - # Argument internal_3 - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing internal_3 - - # Calling function function_substr_at_String - jal function_substr_at_String - lw $ra, 12($sp) - sw $v1, 56($sp) # internal_4 = result of function_substr_at_String - addi $sp, $sp, 16 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 72($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_4 - lw $t0, 52($sp) - sw $t0, 0($sp) # Storing internal_4 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 48($sp) # internal_5 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_7 = address of allocated object Int - - # Allocating NUll to internal_6 - sw $zero, 32($sp) # internal_6 = 0 - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 72($sp) - sw $t0, 4($sp) # Storing self - - # Argument self - lw $t0, 72($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_equal - jal function_equal - lw $ra, 8($sp) - sw $v1, 40($sp) # internal_7 = result of function_equal - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_7 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_7 - - # Calling function function_type_name_at_Object - jal function_type_name_at_Object - lw $ra, 4($sp) - sw $v1, 32($sp) # internal_8 = result of function_type_name_at_Object - addi $sp, $sp, 8 # Freeing space for arguments - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_9 = address of allocated object Int - - # Allocating Int 3 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 3 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_10 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address - - # Argument internal_8 - lw $t0, 40($sp) - sw $t0, 8($sp) # Storing internal_8 - - # Argument internal_9 - lw $t0, 36($sp) - sw $t0, 4($sp) # Storing internal_9 - - # Argument internal_10 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_10 - - # Calling function function_substr_at_String - jal function_substr_at_String - lw $ra, 12($sp) - sw $v1, 28($sp) # internal_11 = result of function_substr_at_String - addi $sp, $sp, 16 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_5 - lw $t0, 48($sp) - sw $t0, 4($sp) # Storing internal_5 - - # Argument internal_11 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_11 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_12 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_13[0] = '\n' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 4($sp) # internal_13 = "\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 72($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_13 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_13 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_14 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 60 - - jr $ra - - main: - # Reserving space for local variables - addi $sp, $sp, -8 - - # Allocating Main - li $v0, 9 - lw $a0, type_Main - syscall - la $t0, type_Main # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object Main - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function___init___at_Main - jal function___init___at_Main - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_Main - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function_main_at_Main - jal function_main_at_Main - lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function_main_at_Main - addi $sp, $sp, 8 # Freeing space for arguments - - # Exit program - li $v0, 10 - syscall - - \ No newline at end of file diff --git a/src/print-cool.cil b/src/print-cool.cil deleted file mode 100644 index 3daa1d054..000000000 --- a/src/print-cool.cil +++ /dev/null @@ -1,435 +0,0 @@ -.TYPES -type Object { - inherits from null - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method __init__: function___init___at_Object -} -type IO { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method out_string: function_out_string_at_IO - method out_int: function_out_int_at_IO - method in_string: function_in_string_at_IO - method in_int: function_in_int_at_IO - method __init__: function___init___at_IO -} -type Int { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method __init__: function___init___at_Int -} -type String { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method length: function_length_at_String - method concat: function_concat_at_String - method substr: function_substr_at_String - method __init__: function___init___at_String -} -type Bool { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method __init__: function___init___at_Bool -} -type Main { - inherits from IO - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method out_string: function_out_string_at_IO - method out_int: function_out_int_at_IO - method in_string: function_in_string_at_IO - method in_int: function_in_int_at_IO - method main: function_main_at_Main - method __init__: function___init___at_Main -} - -.DATA - - -.CODE -function function_add{ - PARAM a - PARAM b - - LOCAL internal_0 # Adding result - - internal_0 = ALLOCINT 0 - internal_0 = a + b - - RETURN internal_0 -} -function function_sub{ - PARAM a - PARAM b - - LOCAL internal_0 # Substracting result - - internal_0 = ALLOCINT 0 - internal_0 = a - b - - RETURN internal_0 -} -function function_mult{ - PARAM a - PARAM b - - LOCAL internal_0 # Multiting result - - internal_0 = ALLOCINT 0 - internal_0 = a * b - - RETURN internal_0 -} -function function_div{ - PARAM a - PARAM b - - LOCAL internal_0 # Dividing result - - internal_0 = ALLOCINT 0 - internal_0 = a / b - - RETURN internal_0 -} -function function_xor{ - PARAM a - PARAM b - - LOCAL internal_0 # Xor result - - internal_0 = ALLOCINT 0 - internal_0 = XOR a b - - RETURN internal_0 -} -function function_less_than{ - PARAM a - PARAM b - - LOCAL internal_0 # Less than result - - internal_0 = ALLOCBOOL 0 - internal_0 = a < b - - RETURN internal_0 -} -function function_less_than_or_equal{ - PARAM a - PARAM b - - LOCAL internal_0 # Less than or equal result - - internal_0 = ALLOCBOOL 0 - internal_0 = a <= b - - RETURN internal_0 -} -function function_equal{ - PARAM a - PARAM b - - LOCAL internal_0 # Equal result - LOCAL internal_1 # Null Pointer - LOCAL internal_2 # One of params is null - LOCAL internal_3 # Type of a - LOCAL internal_4 # Type Int - LOCAL internal_5 # Type Bool - LOCAL internal_6 # Type String - LOCAL internal_7 # Type of a equals int - LOCAL internal_8 # Type of a equals bool - LOCAL internal_9 # Type of a equals string - - internal_0 = ALLOCBOOL 0 - internal_1 = ALLOCNULL - internal_2 = ALLOCBOOL 0 - internal_2 = EQUALADDR a internal_1 - internal_2 = EQUALADDR b internal_1 - IF internal_2 GOTO a_is_type_object - internal_3 = TYPEOF a - internal_4 = TYPEADDR Int - internal_5 = TYPEADDR Bool - internal_6 = TYPEADDR String - internal_7 = ALLOCBOOL 0 - internal_8 = ALLOCBOOL 0 - internal_9 = ALLOCBOOL 0 - internal_7 = EQUALADDR internal_3 internal_4 - internal_8 = EQUALADDR internal_3 internal_5 - internal_9 = EQUALADDR internal_3 internal_6 - - IF internal_7 GOTO a_is_type_int_or_bool - IF internal_8 GOTO a_is_type_int_or_bool - IF internal_9 GOTO a_is_type_string - GOTO a_is_type_object - - a_is_type_int_or_bool: - internal_0 = EQUALINT a b - GOTO end_of_equal - - a_is_type_string: - internal_0 = EQUALSTR a b - GOTO end_of_equal - - a_is_type_object: - internal_0 = a == b - GOTO end_of_equal - - end_of_equal: - - RETURN internal_0 -} -function function_assign{ - PARAM dest - PARAM source - - LOCAL internal_0 # Null Pointer - LOCAL internal_1 # One of params is null - LOCAL internal_2 # Type of source - LOCAL internal_3 # Type Int - LOCAL internal_4 # Type Bool - LOCAL internal_5 # Type of source equals int - LOCAL internal_6 # Type of source equals bool - - internal_0 = ALLOCNULL - internal_1 = ALLOCBOOL 0 - internal_1 = EQUALADDR source internal_0 - internal_1 = EQUALADDR dest internal_0 - IF internal_1 GOTO source_is_type_object - internal_2 = TYPEOF source - internal_3 = TYPEADDR Int - internal_4 = TYPEADDR Bool - internal_5 = ALLOCBOOL 0 - internal_6 = ALLOCBOOL 0 - internal_5 = EQUALADDR internal_2 internal_3 - internal_6 = EQUALADDR internal_2 internal_4 - - IF internal_5 GOTO source_is_type_int_or_bool - IF internal_6 GOTO source_is_type_int_or_bool - GOTO source_is_type_object - - source_is_type_int_or_bool: - dest = INT source - GOTO source_end_of_equal - - source_is_type_object: - dest = source - GOTO source_end_of_equal - - source_end_of_equal: - - RETURN dest -} -function function___init___at_Object{ - PARAM self - - RETURN self -} -function function_abort_at_Object{ - PARAM self - - LOCAL internal_0 - LOCAL internal_1 - LOCAL internal_2 - LOCAL internal_3 - - internal_0 = ALLOCSTR "Abort called from class " - internal_2 = ALLOCSTR "\n" - ARG self - internal_1 = VCALL String function_type_name_at_Object - ARG internal_0 - ARG internal_1 - internal_3 = VCALL String function_concat_at_String - ARG internal_3 - ARG internal_2 - internal_3 = VCALL String function_concat_at_String - PRINTSTR internal_3 - HALT - - RETURN self -} -function function_type_name_at_Object{ - PARAM self - - LOCAL internal_0 # type_name - - internal_0 = TYPENAME self - - RETURN internal_0 -} -function function_copy_at_Object{ - PARAM self - - LOCAL internal_0 - - internal_0 = COPY self - - RETURN internal_0 -} -function function___init___at_IO{ - PARAM self - - RETURN self -} -function function_out_string_at_IO{ - PARAM self - PARAM x - - PRINTSTR x - - RETURN self -} -function function_out_int_at_IO{ - PARAM self - PARAM x - - PRINTINT x - - RETURN self -} -function function_in_string_at_IO{ - PARAM self - - LOCAL internal_0 - - READSTR internal_0 - - RETURN internal_0 -} -function function_in_int_at_IO{ - PARAM self - - LOCAL internal_0 - - internal_0 = ALLOCINT 0 - READINT internal_0 - - RETURN internal_0 -} -function function___init___at_String{ - PARAM self - - RETURN self -} -function function_length_at_String{ - PARAM self - - LOCAL internal_0 - - internal_0 = ALLOCINT 0 - internal_0 = LENGTH self - - RETURN internal_0 -} -function function_concat_at_String{ - PARAM self - PARAM s - - LOCAL internal_0 - - internal_0 = CONCAT self s - - RETURN internal_0 -} -function function_substr_at_String{ - PARAM self - PARAM i - PARAM l - - LOCAL internal_0 - - internal_0 = SUBSTRING self i l - - RETURN internal_0 -} -function function___init___at_Main{ - PARAM self - - RETURN self -} -function function_main_at_Main{ - PARAM self - - LOCAL internal_0 # Store an instance of the class Object - LOCAL internal_1 - LOCAL internal_2 # Integer 4 - LOCAL internal_3 # Integer 1 - LOCAL internal_4 - LOCAL internal_5 - LOCAL internal_6 # Null pointer - LOCAL internal_7 # Store if self is NULL - LOCAL internal_8 - LOCAL internal_9 # Integer 1 - LOCAL internal_10 # Integer 3 - LOCAL internal_11 - LOCAL internal_12 - LOCAL internal_13 # String "\n" - LOCAL internal_14 - - internal_0 = ALLOCATE Object # Allocate the object Object - ARG internal_0 # Pass the instance to the constructor - internal_0 = VCALL Object function___init___at_Object # Call the constructor - ARG internal_0 - internal_1 = VCALL Object function_type_name_at_Object - internal_2 = ALLOCINT 4 - internal_3 = ALLOCINT 1 - ARG internal_1 - ARG internal_2 - ARG internal_3 - internal_4 = VCALL String function_substr_at_String - ARG self - ARG internal_4 - internal_5 = VCALL Main function_out_string_at_IO - internal_7 = ALLOCBOOL 0 - internal_6 = ALLOCNULL - ARG self - ARG self - internal_7 = CALL function_equal - ARG internal_7 - internal_8 = VCALL Bool function_type_name_at_Object - internal_9 = ALLOCINT 1 - internal_10 = ALLOCINT 3 - ARG internal_8 - ARG internal_9 - ARG internal_10 - internal_11 = VCALL String function_substr_at_String - ARG internal_5 - ARG internal_11 - internal_12 = VCALL Main function_out_string_at_IO - internal_13 = ALLOCSTR "\n" - ARG self - ARG internal_13 - internal_14 = VCALL Main function_out_string_at_IO - - RETURN internal_14 -} -function main{ - - - LOCAL internal_0 - LOCAL internal_1 - - internal_0 = ALLOCATE Main - ARG internal_0 - internal_0 = VCALL Main function___init___at_Main - - ARG internal_0 - internal_1 = VCALL Main function_main_at_Main - - HALT -} \ No newline at end of file diff --git a/src/print-cool.cl b/src/print-cool.cl deleted file mode 100644 index 76194e966..000000000 --- a/src/print-cool.cl +++ /dev/null @@ -1,9 +0,0 @@ -class Main inherits IO { - main() : IO { - { - out_string((new Object).type_name().substr(4,1)). - out_string((isvoid self).type_name().substr(1,3)); -- demonstrates the dispatch rules. - out_string("\n"); - } - }; -}; diff --git a/src/sort-list.asm b/src/sort-list.asm deleted file mode 100644 index 927fa3208..000000000 --- a/src/sort-list.asm +++ /dev/null @@ -1,3736 +0,0 @@ -.data - type_Object: .word 8 - type_Object_inherits_from: .word 0 - type_Object_attributes: .word 0 - type_Object_name_size: .word 6 - type_Object_name: .asciiz "Object" - - type_IO: .word 8 - type_IO_inherits_from: .word type_Object - type_IO_attributes: .word 0 - type_IO_name_size: .word 2 - type_IO_name: .asciiz "IO" - - type_Int: .word 8 - type_Int_inherits_from: .word type_Object - type_Int_attributes: .word 0 - type_Int_name_size: .word 3 - type_Int_name: .asciiz "Int" - - type_String: .word 8 - type_String_inherits_from: .word type_Object - type_String_attributes: .word 0 - type_String_name_size: .word 6 - type_String_name: .asciiz "String" - - type_Bool: .word 8 - type_Bool_inherits_from: .word type_Object - type_Bool_attributes: .word 0 - type_Bool_name_size: .word 4 - type_Bool_name: .asciiz "Bool" - - type_List: .word 8 - type_List_inherits_from: .word type_IO - type_List_attributes: .word 0 - type_List_name_size: .word 4 - type_List_name: .asciiz "List" - - type_Cons: .word 16 - type_Cons_inherits_from: .word type_List - type_Cons_attributes: .word 2 - type_Cons_name_size: .word 4 - type_Cons_name: .asciiz "Cons" - - type_Nil: .word 8 - type_Nil_inherits_from: .word type_List - type_Nil_attributes: .word 0 - type_Nil_name_size: .word 3 - type_Nil_name: .asciiz "Nil" - - type_Main: .word 12 - type_Main_inherits_from: .word type_IO - type_Main_attributes: .word 1 - type_Main_name_size: .word 4 - type_Main_name: .asciiz "Main" - - buffer_input: .space 1024 - debug_log: .asciiz "debug_log\n" - -.text - function_add: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Addition operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - add $t2, $t0, $t1 # $t2 = $t0 + $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_sub: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Subtraction operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - sub $t2, $t0, $t1 # $t2 = $t0 - $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_mult: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Multiplication operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - mult $t0, $t1 # $t2 = $t0 * $t1 - mflo $t2 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_div: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Division operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - div $t0, $t1 # $t2 = $t0 / $t1 - mflo $t2 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_xor: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Xor operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Int object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_less_than: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Less than operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - slt $t2, $t0, $t1 # $t2 = $t0 < $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_less_than_or_equal: - # Function parameters - # $ra = 12($sp) - # a = 8($sp) - # b = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Less than operation - lw $t0, 8($sp) # Save in $t0 the left operand address - lw $t0, 8($t0) # Save in $t0 the left operand value - lw $t1, 4($sp) # Save in $t1 the right operand address - lw $t1, 8($t1) # Save in $t1 the rigth operand value - sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 - - lw $t0, 0($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_equal: - # Function parameters - # $ra = 48($sp) - # a = 44($sp) - # b = 40($sp) - - # Reserving space for local variables - addi $sp, $sp, -40 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_0 = address of allocated object Int - - # Allocating NUll to internal_1 - sw $zero, 32($sp) # internal_1 = 0 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_2 = address of allocated object Int - - # internal_2 = EqualAddress(a, internal_1) - lw $t0, 44($sp) - lw $t1, 32($sp) - seq $t2, $t0, $t1 - lw $t0, 28($sp) - sw $t2, 8($t0) - - # internal_2 = EqualAddress(b, internal_1) - lw $t0, 40($sp) - lw $t1, 32($sp) - seq $t2, $t0, $t1 - lw $t0, 28($sp) - sw $t2, 8($t0) - - # If internal_2 then goto a_is_type_object - lw $t0, 28($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, a_is_type_object - - # internal_3 = typeof a that is the first word of the object - lw $t0, 44($sp) - lw $t0, 0($t0) - sw $t0, 24($sp) - - # internal_4 = direction of Int - la $t0, type_Int - sw $t0, 20($sp) - - # internal_5 = direction of Bool - la $t0, type_Bool - sw $t0, 16($sp) - - # internal_6 = direction of String - la $t0, type_String - sw $t0, 12($sp) - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_7 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_8 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_9 = address of allocated object Int - - # internal_7 = EqualAddress(internal_3, internal_4) - lw $t0, 24($sp) - lw $t1, 20($sp) - seq $t2, $t0, $t1 - lw $t0, 8($sp) - sw $t2, 8($t0) - - # internal_8 = EqualAddress(internal_3, internal_5) - lw $t0, 24($sp) - lw $t1, 16($sp) - seq $t2, $t0, $t1 - lw $t0, 4($sp) - sw $t2, 8($t0) - - # internal_9 = EqualAddress(internal_3, internal_6) - lw $t0, 24($sp) - lw $t1, 12($sp) - seq $t2, $t0, $t1 - lw $t0, 0($sp) - sw $t2, 8($t0) - - # If internal_7 then goto a_is_type_int_or_bool - lw $t0, 8($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, a_is_type_int_or_bool - - # If internal_8 then goto a_is_type_int_or_bool - lw $t0, 4($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, a_is_type_int_or_bool - - # If internal_9 then goto a_is_type_string - lw $t0, 0($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, a_is_type_string - - # Jumping to a_is_type_object - j a_is_type_object - - a_is_type_int_or_bool: - - # internal_0 = EqualInt(a, b) - lw $t0, 44($sp) - lw $t0, 8($t0) - lw $t1, 40($sp) - lw $t1, 8($t1) - seq $t2, $t0, $t1 - lw $t0, 36($sp) - sw $t2, 8($t0) - - # Jumping to end_of_equal - j end_of_equal - - a_is_type_string: - - # internal_0 = EqualStr(a, b) - lw $t0, 44($sp) - lw $t1, 40($sp) - addi $t0, $t0, 8 - addi $t1, $t1, 8 - - # By default we assume the strings are equals - addi $t4, $zero, 1 - lw $t5, 36($sp) - sw $t4, 8($t5) - - while_compare_strings_start: - lb $t2, 0($t0) - lb $t3, 0($t1) - beq $t2, $t3, while_compare_strings_update - - # The strings are no equals - lw $t5, 36($sp) - sw $zero, 8($t5) - j while_compare_strings_end - - while_compare_strings_update: - addi $t0, $t0, 1 - addi $t1, $t1, 1 - beq $t2, $zero, while_compare_strings_end - beq $t3, $zero, while_compare_strings_end - j while_compare_strings_start - while_compare_strings_end: - - # Jumping to end_of_equal - j end_of_equal - - a_is_type_object: - - # Equal operation - lw $t0, 44($sp) # Save in $t0 the left operand address - lw $t1, 40($sp) # Save in $t1 the right operand address - seq $t2, $t0, $t1 # $t2 = $t0 == $t1 - - lw $t0, 36($sp) # $t0 = internal_0 - sw $t2, 8($t0) # Setting value in the third word of the Bool object - - # Jumping to end_of_equal - j end_of_equal - - end_of_equal: - - # Loading return value in $v1 - lw $v1, 36($sp) - - # Freeing space for local variables - addi $sp, $sp, 40 - - jr $ra - - function_assign: - # Function parameters - # $ra = 36($sp) - # dest = 32($sp) - # source = 28($sp) - - # Reserving space for local variables - addi $sp, $sp, -28 - - # Allocating NUll to internal_0 - sw $zero, 24($sp) # internal_0 = 0 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_1 = address of allocated object Int - - # internal_1 = EqualAddress(source, internal_0) - lw $t0, 28($sp) - lw $t1, 24($sp) - seq $t2, $t0, $t1 - lw $t0, 20($sp) - sw $t2, 8($t0) - - # internal_1 = EqualAddress(dest, internal_0) - lw $t0, 32($sp) - lw $t1, 24($sp) - seq $t2, $t0, $t1 - lw $t0, 20($sp) - sw $t2, 8($t0) - - # If internal_1 then goto source_is_type_object - lw $t0, 20($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, source_is_type_object - - # internal_2 = typeof source that is the first word of the object - lw $t0, 28($sp) - lw $t0, 0($t0) - sw $t0, 16($sp) - - # internal_3 = direction of Int - la $t0, type_Int - sw $t0, 12($sp) - - # internal_4 = direction of Bool - la $t0, type_Bool - sw $t0, 8($sp) - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_5 = address of allocated object Int - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_6 = address of allocated object Int - - # internal_5 = EqualAddress(internal_2, internal_3) - lw $t0, 16($sp) - lw $t1, 12($sp) - seq $t2, $t0, $t1 - lw $t0, 4($sp) - sw $t2, 8($t0) - - # internal_6 = EqualAddress(internal_2, internal_4) - lw $t0, 16($sp) - lw $t1, 8($sp) - seq $t2, $t0, $t1 - lw $t0, 0($sp) - sw $t2, 8($t0) - - # If internal_5 then goto source_is_type_int_or_bool - lw $t0, 4($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, source_is_type_int_or_bool - - # If internal_6 then goto source_is_type_int_or_bool - lw $t0, 0($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, source_is_type_int_or_bool - - # Jumping to source_is_type_object - j source_is_type_object - - source_is_type_int_or_bool: - - # dest = source where source is an integer - li $v0, 9 - addi $a0, $zero, 12 - syscall - lw $t0, 28($sp) # Pointer to source - lw $t1, 0($t0) # $t1 = type of source - lw $t2, 8($t0) # $t2 = value of source - sw $t1, 0($v0) # Save type of dest - sw $a0, 4($v0) # Save size of dest - sw $t2, 8($v0) # Save value of dest - sw $v0, 32($sp) - - # Jumping to source_end_of_equal - j source_end_of_equal - - source_is_type_object: - - # dest = source - lw $t0, 28($sp) - sw $t0, 32($sp) - - # Jumping to source_end_of_equal - j source_end_of_equal - - source_end_of_equal: - - # Loading return value in $v1 - lw $v1, 32($sp) - - # Freeing space for local variables - addi $sp, $sp, 28 - - jr $ra - - function___init___at_Object: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_abort_at_Object: - # Function parameters - # $ra = 20($sp) - # self = 16($sp) - - # Reserving space for local variables - addi $sp, $sp, -16 - - # Allocating String - li $v0, 9 - addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 33 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 65 - sb $t0, 8($v0) # internal_0[0] = 'A' - - addi $t0, $zero, 98 - sb $t0, 9($v0) # internal_0[1] = 'b' - - addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_0[2] = 'o' - - addi $t0, $zero, 114 - sb $t0, 11($v0) # internal_0[3] = 'r' - - addi $t0, $zero, 116 - sb $t0, 12($v0) # internal_0[4] = 't' - - addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_0[5] = ' ' - - addi $t0, $zero, 99 - sb $t0, 14($v0) # internal_0[6] = 'c' - - addi $t0, $zero, 97 - sb $t0, 15($v0) # internal_0[7] = 'a' - - addi $t0, $zero, 108 - sb $t0, 16($v0) # internal_0[8] = 'l' - - addi $t0, $zero, 108 - sb $t0, 17($v0) # internal_0[9] = 'l' - - addi $t0, $zero, 101 - sb $t0, 18($v0) # internal_0[10] = 'e' - - addi $t0, $zero, 100 - sb $t0, 19($v0) # internal_0[11] = 'd' - - addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_0[12] = ' ' - - addi $t0, $zero, 102 - sb $t0, 21($v0) # internal_0[13] = 'f' - - addi $t0, $zero, 114 - sb $t0, 22($v0) # internal_0[14] = 'r' - - addi $t0, $zero, 111 - sb $t0, 23($v0) # internal_0[15] = 'o' - - addi $t0, $zero, 109 - sb $t0, 24($v0) # internal_0[16] = 'm' - - addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_0[17] = ' ' - - addi $t0, $zero, 99 - sb $t0, 26($v0) # internal_0[18] = 'c' - - addi $t0, $zero, 108 - sb $t0, 27($v0) # internal_0[19] = 'l' - - addi $t0, $zero, 97 - sb $t0, 28($v0) # internal_0[20] = 'a' - - addi $t0, $zero, 115 - sb $t0, 29($v0) # internal_0[21] = 's' - - addi $t0, $zero, 115 - sb $t0, 30($v0) # internal_0[22] = 's' - - addi $t0, $zero, 32 - sb $t0, 31($v0) # internal_0[23] = ' ' - - sb $zero, 32($v0) # Null-terminator at the end of the string - - sw $v0, 12($sp) # internal_0 = "Abort called from class " - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_2[0] = '\n' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 4($sp) # internal_2 = "\n" - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument self - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_type_name_at_Object - jal function_type_name_at_Object - lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_0 - lw $t0, 24($sp) - sw $t0, 4($sp) # Storing internal_0 - - # Argument internal_1 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function_concat_at_String - jal function_concat_at_String - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_3 - lw $t0, 12($sp) - sw $t0, 4($sp) # Storing internal_3 - - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_concat_at_String - jal function_concat_at_String - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String - addi $sp, $sp, 12 # Freeing space for arguments - - lw $t0, 0($sp) # $t0 = internal_3 - addi $t0, $t0, 8 # Pointer to the first character of the string - - # Printing the string internal_3 - li $v0, 4 - move $a0, $t0 - syscall - - # Exit program - li $v0, 10 - syscall - - # Loading return value in $v1 - lw $v1, 16($sp) - - # Freeing space for local variables - addi $sp, $sp, 16 - - jr $ra - - function_type_name_at_Object: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = name of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($t0) # $t1 = type of self - lw $t2, 12($t1) # $t1 = length of the name of self - la $t3, 16($t1) # $t1 = name of self - - addi $t2, $t2, 9 # Setting space for the type, the size and the null byte - li $v0, 9 - move $a0, $t2 - syscall - addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte - - la $t4, type_String - sw $t4, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - - addi $t4, $v0, 0 # $t4 = direction of the new string - addi $t4, $t4, 8 # Pointer to the first character of the string - xor $t5, $t5, $t5 # Initializing counter - while_copy_name_start: - beq $t5, $t2, while_copy_name_end - lb $t6, 0($t3) # Loading the character - sb $t6, 0($t4) - addi $t4, $t4, 1 # Incrementing the pointer to the new string - addi $t3, $t3, 1 # Incrementing the pointer to the string in self - addi $t5, $t5, 1 # Incrementing counter - j while_copy_name_start - while_copy_name_end: - - sb $zero, 0($t4) # Setting the null byte - - sw $v0, 0($sp) # Storing the new string in internal_0 - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_copy_at_Object: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = copy of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($t0) # $t1 = type of self - lw $t2, 4($t0) # $t2 = length of self in bytes - - # Allocating space for the new object - li $v0, 9 - move $a0, $t2 - syscall - move $t3, $v0 # $t3 = direction of the new object - sw $t1, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - - # Initializing the variable of the loop - addi $t0, $t0, 8 # Pointer to the first character of the object - addi $t3, $t3, 8 # Pointer to the first character of the object - addi $t2, $2, -8 # Decrementing in 8 the length of the object - xor $t4, $t4, $t4 # Initializing counter - - # Loop copying the object - while_copy_start: - beq $t4, $t2, while_copy_end - lb $t5, 0($t0) # Loading the byte - sb $t5, 0($t3) # Storing the byte - addi $t0, $t0, 1 # Incrementing the pointer to the object - addi $t3, $t3, 1 # Incrementing the pointer to the new object - addi $t4, $t4, 1 # Incrementing counter - j while_copy_start - while_copy_end: - sw $v0, 0($sp) # Storing the new object in internal_0 - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function___init___at_IO: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_out_string_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - # x = 0($sp) - - lw $t0, 0($sp) # $t0 = x - addi $t0, $t0, 8 # Pointer to the first character of the string - - # Printing the string x - li $v0, 4 - move $a0, $t0 - syscall - - # Loading return value in $v1 - lw $v1, 4($sp) - - jr $ra - - function_out_int_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - # x = 0($sp) - - # Printing the string x - li $v0, 1 - lw $a0, 0($sp) - lw $a0, 8($a0) - syscall - - # Loading return value in $v1 - lw $v1, 4($sp) - - jr $ra - - function_in_string_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - li $v0, 8 - la $a0, buffer_input - li $a1, 1024 - syscall - - xor $t0, $t0, $t0 # Initializing counter - while_read_start: - lb $t1, buffer_input($t0) # Loading the byte - beq $t1, $zero, while_read_end - addi $t0, $t0, 1 # Incrementing counter - j while_read_start - while_read_end: - addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' - - addi $t0, $t0, 9 # Adding space for the type, the size and the null byte - li $v0, 9 - move $a0, $t0 - syscall - addi $t0, $t0, -9 # Adding space for the type, the size and the null byte - la $t2, type_String - sw $t2, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting length in the second word of the object - - addi $t3, $v0, 8 # Pointer to the first character of the string - xor $t4, $t4, $t4 # Initializing counter - - while_copy_from_buffer_start: - beq $t4, $t0, while_copy_from_buffer_end - lb $t5, buffer_input($t4) # Loading the byte - sb $t5, 0($t3) # Storing the byte - addi $t3, $t3, 1 # Imcremeenting pointer - addi $t4, $t4, 1 # Incrementing counter - j while_copy_from_buffer_start - while_copy_from_buffer_end: - - sb $zero, 0($t3) # Storing the null byte - - sw $v0, 0($sp) # Storing the new object in internal_0 - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_in_int_at_IO: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - li $v0, 5 - syscall - lw $t0, 0($sp) - sw $v0, 8($t0) - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function___init___at_String: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_length_at_String: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # internal_0 = length of self - lw $t0, 4($sp) - lw $t1, 4($t0) - addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator - lw $t0, 0($sp) - sw $t1, 8($t0) - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_concat_at_String: - # Function parameters - # $ra = 12($sp) - # self = 8($sp) - # s = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = self + s - lw $t0, 8($sp) - lw $t1, 4($sp) - lw $t2, 4($t0) # $t2 = length of str1 - lw $t3, 4($t1) # $t3 = length of str2 - addi $t2, $t2, -9 - addi $t3, $t3, -9 - add $t4, $t2, $t3 # $t4 = length of str1 + str2 - addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) - - li $v0, 9 - move $a0, $t4 - syscall - addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 - add $t5, $zero, $v0 # $t5 = address of the new string object - addi $t5, $t5, 8 # $t5 = address of the first byte of the new string - - la $t8, type_String - sw $t8, 0($v0) # Setting type in the first word of th object - - sw $a0, 4($v0) # Setting length of the string in the second word of the object - - # Copying str1 to the new string - xor $t6, $t6, $t6 # $t6 = 0 Initializing counter - while_copy_str1_start: - beq $t6, $t2, while_copy_str1_end - lb $t7, 8($t0) - sb $t7, 0($t5) - add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_str1_start - while_copy_str1_end: - - # Copying str2 to the new string - while_copy_str2_start: - beq $t6, $t4, while_copy_str2_end - lb $t7, 8($t1) - sb $t7, 0($t5) - add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_str2_start - while_copy_str2_end: - - sb $zero, 0($t5) # Setting the null-terminator - - sw $v0, 0($sp) # internal_0 = self + s - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_substr_at_String: - # Function parameters - # $ra = 16($sp) - # self = 12($sp) - # i = 8($sp) - # l = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # internal_0 = self[i:i + l] - lw $t0, 12($sp) # $t0 = address of the string - lw $t1, 4($t0) # $t1 = length of the string - addi $t1, $t1, -9 # $t1 = length of the string + 9 - lw $t2, 8($sp) # $t2 = start of the substring - lw $t2, 8($t2) - lw $t3, 4($sp) # $t3 = length of the substring - lw $t3, 8($t3) - add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring - - bgt $t4, $t1, substring_out_of_bounds - - addi $t3, $t3, 9 - li $v0, 9 - move $a0, $t3 - syscall - addi $t3, $t3, -9 - - la $t5, type_String - sw $t5, 0($v0) # Setting type in the first word of the object - - sw $a0, 4($v0) # Setting length in the second word of the object - - addi $t0, $t0, 8 # pointing to the first byte of the string - add $t0, $t0, $t2 # pointing to the first byte of the substring - move $t5, $v0 # $t5 = address of the new string - add $t5, $t5, 8 # pointing to the first byte of the string - xor $t6, $t6, $t6 # $t6 = 0 Initializing counter - while_copy_substr_start: - beq $t6, $t3, while_copy_substr_end - lb $t7, 0($t0) - sb $t7, 0($t5) - addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string - add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string - addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter - j while_copy_substr_start - while_copy_substr_end: - - sb $zero, 0($t5) # Setting the null-terminator - - sw $v0, 0($sp) # internal_0 = self[i:i + l] - j substring_not_out_of_bounds - - substring_out_of_bounds: - li $v0, 17 - addi $a0, $zero, 1 - syscall - - substring_not_out_of_bounds: - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function___init___at_Int: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # self = address of allocated object Int - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function___init___at_Bool: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # self = address of allocated object Int - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function___init___at_List: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_isNil_at_List: - # Function parameters - # $ra = 12($sp) - # self = 8($sp) - - # Reserving space for local variables - addi $sp, $sp, -8 - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument self - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_abort_at_Object - jal function_abort_at_Object - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function_abort_at_Object - addi $sp, $sp, 8 # Freeing space for arguments - - # Allocating Bool 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_1 = address of allocated object Int - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 8 - - jr $ra - - function_cons_at_List: - # Function parameters - # $ra = 20($sp) - # self = 16($sp) - # hd = 12($sp) - - # Reserving space for local variables - addi $sp, $sp, -12 - - # Allocating Cons - li $v0, 9 - lw $a0, type_Cons - syscall - la $t0, type_Cons # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_1 = address of allocated object Cons - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_1 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function___init___at_Cons - jal function___init___at_Cons - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_1 = result of function___init___at_Cons - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument new_cell - lw $t0, 20($sp) - sw $t0, 4($sp) # Storing new_cell - - # Argument internal_1 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 20($sp) # new_cell = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address - - # Argument new_cell - lw $t0, 24($sp) - sw $t0, 8($sp) # Storing new_cell - - # Argument hd - lw $t0, 28($sp) - sw $t0, 4($sp) # Storing hd - - # Argument self - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_init_at_Cons - jal function_init_at_Cons - lw $ra, 12($sp) - sw $v1, 16($sp) # internal_2 = result of function_init_at_Cons - addi $sp, $sp, 16 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 12 - - jr $ra - - function_car_at_List: - # Function parameters - # $ra = 12($sp) - # self = 8($sp) - - # Reserving space for local variables - addi $sp, $sp, -8 - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument self - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_abort_at_Object - jal function_abort_at_Object - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function_abort_at_Object - addi $sp, $sp, 8 # Freeing space for arguments - - # Allocating Int - li $v0, 9 - lw $a0, type_Int - syscall - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 0($sp) # internal_1 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_1 - lw $t0, 8($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function___init___at_Int - jal function___init___at_Int - lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function___init___at_Int - addi $sp, $sp, 8 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 8 - - jr $ra - - function_cdr_at_List: - # Function parameters - # $ra = 12($sp) - # self = 8($sp) - - # Reserving space for local variables - addi $sp, $sp, -8 - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument self - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_abort_at_Object - jal function_abort_at_Object - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function_abort_at_Object - addi $sp, $sp, 8 # Freeing space for arguments - - # Allocating List - li $v0, 9 - lw $a0, type_List - syscall - la $t0, type_List # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 0($sp) # internal_1 = address of allocated object List - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_1 - lw $t0, 8($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function___init___at_List - jal function___init___at_List - lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function___init___at_List - addi $sp, $sp, 8 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 8 - - jr $ra - - function_rev_at_List: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument self - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_cdr_at_List - jal function_cdr_at_List - lw $ra, 4($sp) - sw $v1, 8($sp) # internal_0 = result of function_cdr_at_List - addi $sp, $sp, 8 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_sort_at_List: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument self - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_cdr_at_List - jal function_cdr_at_List - lw $ra, 4($sp) - sw $v1, 8($sp) # internal_0 = result of function_cdr_at_List - addi $sp, $sp, 8 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_insert_at_List: - # Function parameters - # $ra = 12($sp) - # self = 8($sp) - # i = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument self - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_cdr_at_List - jal function_cdr_at_List - lw $ra, 4($sp) - sw $v1, 8($sp) # internal_0 = result of function_cdr_at_List - addi $sp, $sp, 8 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_rcons_at_List: - # Function parameters - # $ra = 12($sp) - # self = 8($sp) - # i = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument self - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_cdr_at_List - jal function_cdr_at_List - lw $ra, 4($sp) - sw $v1, 8($sp) # internal_0 = result of function_cdr_at_List - addi $sp, $sp, 8 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_print_list_at_List: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument self - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_abort_at_Object - jal function_abort_at_Object - lw $ra, 4($sp) - sw $v1, 8($sp) # internal_0 = result of function_abort_at_Object - addi $sp, $sp, 8 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function___init___at_Cons: - # Function parameters - # $ra = 12($sp) - # self = 8($sp) - - # Reserving space for local variables - addi $sp, $sp, -8 - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_0 = address of allocated object Int - - # Set attribute xcar of self - lw $t0, 8($sp) # $t0 = self - lw $t1, 4($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8750086222246 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8750086222246 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8750086222246 - j object_set_attribute_8750086222246 - int_set_attribute_8750086222246: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.xcar = internal_0 - j end_set_attribute_8750086222246 - bool_set_attribute_8750086222246: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.xcar = internal_0 - j end_set_attribute_8750086222246 - object_set_attribute_8750086222246: - sw $t1, 8($t0) # self.xcar = internal_0 - end_set_attribute_8750086222246: - - # Allocating NUll to internal_1 - sw $zero, 0($sp) # internal_1 = 0 - - # Set attribute xcdr of self - lw $t0, 8($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_1 - beq $t1, $zero, object_set_attribute_8750086222267 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8750086222267 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8750086222267 - j object_set_attribute_8750086222267 - int_set_attribute_8750086222267: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.xcdr = internal_1 - j end_set_attribute_8750086222267 - bool_set_attribute_8750086222267: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.xcdr = internal_1 - j end_set_attribute_8750086222267 - object_set_attribute_8750086222267: - sw $t1, 12($t0) # self.xcdr = internal_1 - end_set_attribute_8750086222267: - - # Loading return value in $v1 - lw $v1, 8($sp) - - # Freeing space for local variables - addi $sp, $sp, 8 - - jr $ra - - function_isNil_at_Cons: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_init_at_Cons: - # Function parameters - # $ra = 12($sp) - # self = 8($sp) - # hd = 4($sp) - # tl = 0($sp) - - # Set attribute xcar of self - lw $t0, 8($sp) # $t0 = self - lw $t1, 4($sp) # $t1 = hd - beq $t1, $zero, object_set_attribute_8750086190608 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8750086190608 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8750086190608 - j object_set_attribute_8750086190608 - int_set_attribute_8750086190608: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.xcar = hd - j end_set_attribute_8750086190608 - bool_set_attribute_8750086190608: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.xcar = hd - j end_set_attribute_8750086190608 - object_set_attribute_8750086190608: - sw $t1, 8($t0) # self.xcar = hd - end_set_attribute_8750086190608: - - # Set attribute xcdr of self - lw $t0, 8($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = tl - beq $t1, $zero, object_set_attribute_8750086190617 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8750086190617 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8750086190617 - j object_set_attribute_8750086190617 - int_set_attribute_8750086190617: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.xcdr = tl - j end_set_attribute_8750086190617 - bool_set_attribute_8750086190617: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($t0) # self.xcdr = tl - j end_set_attribute_8750086190617 - object_set_attribute_8750086190617: - sw $t1, 12($t0) # self.xcdr = tl - end_set_attribute_8750086190617: - - # Loading return value in $v1 - lw $v1, 8($sp) - - jr $ra - - function_car_at_Cons: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Get attribute xcar of self - lw $t0, 4($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'xcar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8750086190629 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8750086190629 - j object_get_attribute_8750086190629 - int_get_attribute_8750086190629: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 0($sp) # internal_0 = self.xcar - j end_get_attribute_8750086190629 - bool_get_attribute_8750086190629: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 0($sp) # internal_0 = self.xcar - j end_get_attribute_8750086190629 - object_get_attribute_8750086190629: - sw $t1, 0($sp) # internal_0 = xcar - end_get_attribute_8750086190629: - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_cdr_at_Cons: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Get attribute xcdr of self - lw $t0, 4($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'xcdr' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8750086211368 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8750086211368 - j object_get_attribute_8750086211368 - int_get_attribute_8750086211368: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 0($sp) # internal_0 = self.xcdr - j end_get_attribute_8750086211368 - bool_get_attribute_8750086211368: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 0($sp) # internal_0 = self.xcdr - j end_get_attribute_8750086211368 - object_get_attribute_8750086211368: - sw $t1, 0($sp) # internal_0 = xcdr - end_get_attribute_8750086211368: - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_rev_at_Cons: - # Function parameters - # $ra = 20($sp) - # self = 16($sp) - - # Reserving space for local variables - addi $sp, $sp, -16 - - # Get attribute xcdr of self - lw $t0, 16($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'xcdr' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8750086210618 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8750086210618 - j object_get_attribute_8750086210618 - int_get_attribute_8750086210618: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($sp) # internal_0 = self.xcdr - j end_get_attribute_8750086210618 - bool_get_attribute_8750086210618: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($sp) # internal_0 = self.xcdr - j end_get_attribute_8750086210618 - object_get_attribute_8750086210618: - sw $t1, 12($sp) # internal_0 = xcdr - end_get_attribute_8750086210618: - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function_rev_at_List - jal function_rev_at_List - lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_rev_at_List - addi $sp, $sp, 8 # Freeing space for arguments - - # Get attribute xcar of self - lw $t0, 16($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'xcar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8750086210621 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8750086210621 - j object_get_attribute_8750086210621 - int_get_attribute_8750086210621: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 4($sp) # internal_2 = self.xcar - j end_get_attribute_8750086210621 - bool_get_attribute_8750086210621: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 4($sp) # internal_2 = self.xcar - j end_get_attribute_8750086210621 - object_get_attribute_8750086210621: - sw $t1, 4($sp) # internal_2 = xcar - end_get_attribute_8750086210621: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_1 - lw $t0, 20($sp) - sw $t0, 4($sp) # Storing internal_1 - - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_rcons_at_List - jal function_rcons_at_List - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_rcons_at_List - addi $sp, $sp, 12 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 16 - - jr $ra - - function_sort_at_Cons: - # Function parameters - # $ra = 20($sp) - # self = 16($sp) - - # Reserving space for local variables - addi $sp, $sp, -16 - - # Get attribute xcdr of self - lw $t0, 16($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'xcdr' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8750086210564 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8750086210564 - j object_get_attribute_8750086210564 - int_get_attribute_8750086210564: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($sp) # internal_0 = self.xcdr - j end_get_attribute_8750086210564 - bool_get_attribute_8750086210564: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($sp) # internal_0 = self.xcdr - j end_get_attribute_8750086210564 - object_get_attribute_8750086210564: - sw $t1, 12($sp) # internal_0 = xcdr - end_get_attribute_8750086210564: - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function_sort_at_List - jal function_sort_at_List - lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_sort_at_List - addi $sp, $sp, 8 # Freeing space for arguments - - # Get attribute xcar of self - lw $t0, 16($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'xcar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8750086208618 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8750086208618 - j object_get_attribute_8750086208618 - int_get_attribute_8750086208618: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 4($sp) # internal_2 = self.xcar - j end_get_attribute_8750086208618 - bool_get_attribute_8750086208618: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 4($sp) # internal_2 = self.xcar - j end_get_attribute_8750086208618 - object_get_attribute_8750086208618: - sw $t1, 4($sp) # internal_2 = xcar - end_get_attribute_8750086208618: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_1 - lw $t0, 20($sp) - sw $t0, 4($sp) # Storing internal_1 - - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_insert_at_List - jal function_insert_at_List - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_insert_at_List - addi $sp, $sp, 12 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 16 - - jr $ra - - function_insert_at_Cons: - # Function parameters - # $ra = 52($sp) - # self = 48($sp) - # i = 44($sp) - - # Reserving space for local variables - addi $sp, $sp, -44 - - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_1 = address of allocated object Int - - # Get attribute xcar of self - lw $t0, 48($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'xcar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8750086208690 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8750086208690 - j object_get_attribute_8750086208690 - int_get_attribute_8750086208690: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 32($sp) # internal_2 = self.xcar - j end_get_attribute_8750086208690 - bool_get_attribute_8750086208690: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 32($sp) # internal_2 = self.xcar - j end_get_attribute_8750086208690 - object_get_attribute_8750086208690: - sw $t1, 32($sp) # internal_2 = xcar - end_get_attribute_8750086208690: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument i - lw $t0, 56($sp) - sw $t0, 4($sp) # Storing i - - # Argument internal_2 - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_less_than - jal function_less_than - lw $ra, 8($sp) - sw $v1, 40($sp) # internal_3 = result of function_less_than - addi $sp, $sp, 12 # Freeing space for arguments - - # internal_1 = internal_3 - lw $t0, 28($sp) - sw $t0, 36($sp) - - # If internal_1 then goto then_8750086234655 - lw $t0, 36($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8750086234655 - - # Jumping to else_8750086234655 - j else_8750086234655 - - then_8750086234655: - - # Allocating Cons - li $v0, 9 - lw $a0, type_Cons - syscall - la $t0, type_Cons # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 24($sp) # internal_4 = address of allocated object Cons - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_4 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_4 - - # Calling function function___init___at_Cons - jal function___init___at_Cons - lw $ra, 4($sp) - sw $v1, 32($sp) # internal_4 = result of function___init___at_Cons - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address - - # Argument internal_4 - lw $t0, 40($sp) - sw $t0, 8($sp) # Storing internal_4 - - # Argument i - lw $t0, 60($sp) - sw $t0, 4($sp) # Storing i - - # Argument self - lw $t0, 64($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_init_at_Cons - jal function_init_at_Cons - lw $ra, 12($sp) - sw $v1, 36($sp) # internal_5 = result of function_init_at_Cons - addi $sp, $sp, 16 # Freeing space for arguments - - # internal_0 = internal_5 - lw $t0, 20($sp) - sw $t0, 40($sp) - - # Jumping to endif_8750086234655 - j endif_8750086234655 - - else_8750086234655: - - # Allocating Cons - li $v0, 9 - lw $a0, type_Cons - syscall - la $t0, type_Cons # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 16($sp) # internal_6 = address of allocated object Cons - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_6 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_6 - - # Calling function function___init___at_Cons - jal function___init___at_Cons - lw $ra, 4($sp) - sw $v1, 24($sp) # internal_6 = result of function___init___at_Cons - addi $sp, $sp, 8 # Freeing space for arguments - - # Get attribute xcar of self - lw $t0, 48($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'xcar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8750086210058 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8750086210058 - j object_get_attribute_8750086210058 - int_get_attribute_8750086210058: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($sp) # internal_7 = self.xcar - j end_get_attribute_8750086210058 - bool_get_attribute_8750086210058: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($sp) # internal_7 = self.xcar - j end_get_attribute_8750086210058 - object_get_attribute_8750086210058: - sw $t1, 12($sp) # internal_7 = xcar - end_get_attribute_8750086210058: - - # Get attribute xcdr of self - lw $t0, 48($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'xcdr' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8750086207735 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8750086207735 - j object_get_attribute_8750086207735 - int_get_attribute_8750086207735: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($sp) # internal_8 = self.xcdr - j end_get_attribute_8750086207735 - bool_get_attribute_8750086207735: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($sp) # internal_8 = self.xcdr - j end_get_attribute_8750086207735 - object_get_attribute_8750086207735: - sw $t1, 8($sp) # internal_8 = xcdr - end_get_attribute_8750086207735: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_8 - lw $t0, 20($sp) - sw $t0, 4($sp) # Storing internal_8 - - # Argument i - lw $t0, 56($sp) - sw $t0, 0($sp) # Storing i - - # Calling function function_insert_at_List - jal function_insert_at_List - lw $ra, 8($sp) - sw $v1, 16($sp) # internal_9 = result of function_insert_at_List - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address - - # Argument internal_6 - lw $t0, 32($sp) - sw $t0, 8($sp) # Storing internal_6 - - # Argument internal_7 - lw $t0, 28($sp) - sw $t0, 4($sp) # Storing internal_7 - - # Argument internal_9 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_9 - - # Calling function function_init_at_Cons - jal function_init_at_Cons - lw $ra, 12($sp) - sw $v1, 16($sp) # internal_10 = result of function_init_at_Cons - addi $sp, $sp, 16 # Freeing space for arguments - - # internal_0 = internal_10 - lw $t0, 0($sp) - sw $t0, 40($sp) - - # Jumping to endif_8750086234655 - j endif_8750086234655 - - endif_8750086234655: - - # Loading return value in $v1 - lw $v1, 40($sp) - - # Freeing space for local variables - addi $sp, $sp, 44 - - jr $ra - - function_rcons_at_Cons: - # Function parameters - # $ra = 28($sp) - # self = 24($sp) - # i = 20($sp) - - # Reserving space for local variables - addi $sp, $sp, -20 - - # Allocating Cons - li $v0, 9 - lw $a0, type_Cons - syscall - la $t0, type_Cons # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 16($sp) # internal_0 = address of allocated object Cons - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function___init___at_Cons - jal function___init___at_Cons - lw $ra, 4($sp) - sw $v1, 24($sp) # internal_0 = result of function___init___at_Cons - addi $sp, $sp, 8 # Freeing space for arguments - - # Get attribute xcar of self - lw $t0, 24($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'xcar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8750086190746 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8750086190746 - j object_get_attribute_8750086190746 - int_get_attribute_8750086190746: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($sp) # internal_1 = self.xcar - j end_get_attribute_8750086190746 - bool_get_attribute_8750086190746: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 12($sp) # internal_1 = self.xcar - j end_get_attribute_8750086190746 - object_get_attribute_8750086190746: - sw $t1, 12($sp) # internal_1 = xcar - end_get_attribute_8750086190746: - - # Get attribute xcdr of self - lw $t0, 24($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'xcdr' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8750086190770 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8750086190770 - j object_get_attribute_8750086190770 - int_get_attribute_8750086190770: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($sp) # internal_2 = self.xcdr - j end_get_attribute_8750086190770 - bool_get_attribute_8750086190770: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($sp) # internal_2 = self.xcdr - j end_get_attribute_8750086190770 - object_get_attribute_8750086190770: - sw $t1, 8($sp) # internal_2 = xcdr - end_get_attribute_8750086190770: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_2 - lw $t0, 20($sp) - sw $t0, 4($sp) # Storing internal_2 - - # Argument i - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing i - - # Calling function function_rcons_at_List - jal function_rcons_at_List - lw $ra, 8($sp) - sw $v1, 16($sp) # internal_3 = result of function_rcons_at_List - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address - - # Argument internal_0 - lw $t0, 32($sp) - sw $t0, 8($sp) # Storing internal_0 - - # Argument internal_1 - lw $t0, 28($sp) - sw $t0, 4($sp) # Storing internal_1 - - # Argument internal_3 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_3 - - # Calling function function_init_at_Cons - jal function_init_at_Cons - lw $ra, 12($sp) - sw $v1, 16($sp) # internal_4 = result of function_init_at_Cons - addi $sp, $sp, 16 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 20 - - jr $ra - - function_print_list_at_Cons: - # Function parameters - # $ra = 28($sp) - # self = 24($sp) - - # Reserving space for local variables - addi $sp, $sp, -24 - - # Get attribute xcar of self - lw $t0, 24($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'xcar' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8750086190861 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8750086190861 - j object_get_attribute_8750086190861 - int_get_attribute_8750086190861: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 20($sp) # internal_0 = self.xcar - j end_get_attribute_8750086190861 - bool_get_attribute_8750086190861: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 20($sp) # internal_0 = self.xcar - j end_get_attribute_8750086190861 - object_get_attribute_8750086190861: - sw $t1, 20($sp) # internal_0 = xcar - end_get_attribute_8750086190861: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 36($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_0 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function_out_int_at_IO - jal function_out_int_at_IO - lw $ra, 8($sp) - sw $v1, 28($sp) # internal_1 = result of function_out_int_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_2[0] = '\n' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 12($sp) # internal_2 = "\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 36($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_2 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 20($sp) # internal_3 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Get attribute xcdr of self - lw $t0, 24($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'xcdr' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8750086190930 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8750086190930 - j object_get_attribute_8750086190930 - int_get_attribute_8750086190930: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 4($sp) # internal_4 = self.xcdr - j end_get_attribute_8750086190930 - bool_get_attribute_8750086190930: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 4($sp) # internal_4 = self.xcdr - j end_get_attribute_8750086190930 - object_get_attribute_8750086190930: - sw $t1, 4($sp) # internal_4 = xcdr - end_get_attribute_8750086190930: - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_4 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_4 - - # Calling function function_print_list_at_List - jal function_print_list_at_List - lw $ra, 4($sp) - sw $v1, 8($sp) # internal_5 = result of function_print_list_at_List - addi $sp, $sp, 8 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 24 - - jr $ra - - function___init___at_Nil: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_isNil_at_Nil: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Bool 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_rev_at_Nil: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_sort_at_Nil: - # Function parameters - # $ra = 4($sp) - # self = 0($sp) - - # Loading return value in $v1 - lw $v1, 0($sp) - - jr $ra - - function_insert_at_Nil: - # Function parameters - # $ra = 12($sp) - # self = 8($sp) - # i = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 20($sp) - sw $t0, 4($sp) # Storing self - - # Argument i - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing i - - # Calling function function_rcons_at_Nil - jal function_rcons_at_Nil - lw $ra, 8($sp) - sw $v1, 12($sp) # internal_0 = result of function_rcons_at_Nil - addi $sp, $sp, 12 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_rcons_at_Nil: - # Function parameters - # $ra = 16($sp) - # self = 12($sp) - # i = 8($sp) - - # Reserving space for local variables - addi $sp, $sp, -8 - - # Allocating Cons - li $v0, 9 - lw $a0, type_Cons - syscall - la $t0, type_Cons # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object Cons - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function___init___at_Cons - jal function___init___at_Cons - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_Cons - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address - - # Argument internal_0 - lw $t0, 20($sp) - sw $t0, 8($sp) # Storing internal_0 - - # Argument i - lw $t0, 24($sp) - sw $t0, 4($sp) # Storing i - - # Argument self - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_init_at_Cons - jal function_init_at_Cons - lw $ra, 12($sp) - sw $v1, 16($sp) # internal_1 = result of function_init_at_Cons - addi $sp, $sp, 16 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 8 - - jr $ra - - function_print_list_at_Nil: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating Bool 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_0 = address of allocated object Int - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function___init___at_Main: - # Function parameters - # $ra = 8($sp) - # self = 4($sp) - - # Reserving space for local variables - addi $sp, $sp, -4 - - # Allocating NUll to internal_0 - sw $zero, 0($sp) # internal_0 = 0 - - # Set attribute l of self - lw $t0, 4($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8750086191734 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8750086191734 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8750086191734 - j object_set_attribute_8750086191734 - int_set_attribute_8750086191734: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.l = internal_0 - j end_set_attribute_8750086191734 - bool_set_attribute_8750086191734: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.l = internal_0 - j end_set_attribute_8750086191734 - object_set_attribute_8750086191734: - sw $t1, 8($t0) # self.l = internal_0 - end_set_attribute_8750086191734: - - # Loading return value in $v1 - lw $v1, 4($sp) - - # Freeing space for local variables - addi $sp, $sp, 4 - - jr $ra - - function_iota_at_Main: - # Function parameters - # $ra = 48($sp) - # self = 44($sp) - # i = 40($sp) - - # Reserving space for local variables - addi $sp, $sp, -40 - - # Allocating Nil - li $v0, 9 - lw $a0, type_Nil - syscall - la $t0, type_Nil # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 36($sp) # internal_0 = address of allocated object Nil - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function___init___at_Nil - jal function___init___at_Nil - lw $ra, 4($sp) - sw $v1, 44($sp) # internal_0 = result of function___init___at_Nil - addi $sp, $sp, 8 # Freeing space for arguments - - # Set attribute l of self - lw $t0, 44($sp) # $t0 = self - lw $t1, 36($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8750086191779 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8750086191779 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8750086191779 - j object_set_attribute_8750086191779 - int_set_attribute_8750086191779: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.l = internal_0 - j end_set_attribute_8750086191779 - bool_set_attribute_8750086191779: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.l = internal_0 - j end_set_attribute_8750086191779 - object_set_attribute_8750086191779: - sw $t1, 8($t0) # self.l = internal_0 - end_set_attribute_8750086191779: - - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_2 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument j - lw $t0, 44($sp) - sw $t0, 4($sp) # Storing j - - # Argument internal_2 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 44($sp) # j = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - while_start_8750086235432: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument j - lw $t0, 44($sp) - sw $t0, 4($sp) # Storing j - - # Argument i - lw $t0, 52($sp) - sw $t0, 0($sp) # Storing i - - # Calling function function_less_than - jal function_less_than - lw $ra, 8($sp) - sw $v1, 36($sp) # internal_3 = result of function_less_than - addi $sp, $sp, 12 # Freeing space for arguments - - # If internal_3 then goto while_body_8750086235432 - lw $t0, 24($sp) # Loading the address of the condition - lw $t0, 8($t0) # Loading the value of the condition - addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8750086235432 - - # Jumping to while_end_8750086235432 - j while_end_8750086235432 - - while_body_8750086235432: - - # Allocating Cons - li $v0, 9 - lw $a0, type_Cons - syscall - la $t0, type_Cons # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 20($sp) # internal_4 = address of allocated object Cons - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_4 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_4 - - # Calling function function___init___at_Cons - jal function___init___at_Cons - lw $ra, 4($sp) - sw $v1, 28($sp) # internal_4 = result of function___init___at_Cons - addi $sp, $sp, 8 # Freeing space for arguments - - # Get attribute l of self - lw $t0, 44($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'l' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8750086190222 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8750086190222 - j object_get_attribute_8750086190222 - int_get_attribute_8750086190222: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 16($sp) # internal_5 = self.l - j end_get_attribute_8750086190222 - bool_get_attribute_8750086190222: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 16($sp) # internal_5 = self.l - j end_get_attribute_8750086190222 - object_get_attribute_8750086190222: - sw $t1, 16($sp) # internal_5 = l - end_get_attribute_8750086190222: - - # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address - - # Argument internal_4 - lw $t0, 36($sp) - sw $t0, 8($sp) # Storing internal_4 - - # Argument j - lw $t0, 48($sp) - sw $t0, 4($sp) # Storing j - - # Argument internal_5 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_5 - - # Calling function function_init_at_Cons - jal function_init_at_Cons - lw $ra, 12($sp) - sw $v1, 28($sp) # internal_6 = result of function_init_at_Cons - addi $sp, $sp, 16 # Freeing space for arguments - - # Set attribute l of self - lw $t0, 44($sp) # $t0 = self - lw $t1, 12($sp) # $t1 = internal_6 - beq $t1, $zero, object_set_attribute_8750086190171 - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8750086190171 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8750086190171 - j object_set_attribute_8750086190171 - int_set_attribute_8750086190171: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.l = internal_6 - j end_set_attribute_8750086190171 - bool_set_attribute_8750086190171: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 8($t0) # self.l = internal_6 - j end_set_attribute_8750086190171 - object_set_attribute_8750086190171: - sw $t1, 8($t0) # self.l = internal_6 - end_set_attribute_8750086190171: - - # Allocating Int 1 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_7 = address of allocated object Int - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument j - lw $t0, 44($sp) - sw $t0, 4($sp) # Storing j - - # Argument internal_7 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_7 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 16($sp) # internal_8 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument j - lw $t0, 44($sp) - sw $t0, 4($sp) # Storing j - - # Argument internal_8 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_8 - - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 44($sp) # j = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments - - # Jumping to while_start_8750086235432 - j while_start_8750086235432 - - while_end_8750086235432: - - # Get attribute l of self - lw $t0, 44($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'l' from the instance - lw $t2, 0($t1) - la $t3, type_Int - la $t4, type_Bool - addi $t5, $zero, 1 - seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8750086191854 - seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8750086191854 - j object_get_attribute_8750086191854 - int_get_attribute_8750086191854: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t3, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 0($sp) # internal_9 = self.l - j end_get_attribute_8750086191854 - bool_get_attribute_8750086191854: - li $v0, 9 - addi $a0, $zero, 12 - syscall - sw $t4, 0($v0) - sw $a0, 4($v0) - lw $t5, 8($t1) - sw $t5, 8($v0) - sw $v0, 0($sp) # internal_9 = self.l - j end_get_attribute_8750086191854 - object_get_attribute_8750086191854: - sw $t1, 0($sp) # internal_9 = l - end_get_attribute_8750086191854: - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 40 - - jr $ra - - function_main_at_Main: - # Function parameters - # $ra = 32($sp) - # self = 28($sp) - - # Reserving space for local variables - addi $sp, $sp, -28 - - # Allocating String - li $v0, 9 - addi $a0, $zero, 35 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 35 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 72 - sb $t0, 8($v0) # internal_0[0] = 'H' - - addi $t0, $zero, 111 - sb $t0, 9($v0) # internal_0[1] = 'o' - - addi $t0, $zero, 119 - sb $t0, 10($v0) # internal_0[2] = 'w' - - addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_0[3] = ' ' - - addi $t0, $zero, 109 - sb $t0, 12($v0) # internal_0[4] = 'm' - - addi $t0, $zero, 97 - sb $t0, 13($v0) # internal_0[5] = 'a' - - addi $t0, $zero, 110 - sb $t0, 14($v0) # internal_0[6] = 'n' - - addi $t0, $zero, 121 - sb $t0, 15($v0) # internal_0[7] = 'y' - - addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_0[8] = ' ' - - addi $t0, $zero, 110 - sb $t0, 17($v0) # internal_0[9] = 'n' - - addi $t0, $zero, 117 - sb $t0, 18($v0) # internal_0[10] = 'u' - - addi $t0, $zero, 109 - sb $t0, 19($v0) # internal_0[11] = 'm' - - addi $t0, $zero, 98 - sb $t0, 20($v0) # internal_0[12] = 'b' - - addi $t0, $zero, 101 - sb $t0, 21($v0) # internal_0[13] = 'e' - - addi $t0, $zero, 114 - sb $t0, 22($v0) # internal_0[14] = 'r' - - addi $t0, $zero, 115 - sb $t0, 23($v0) # internal_0[15] = 's' - - addi $t0, $zero, 32 - sb $t0, 24($v0) # internal_0[16] = ' ' - - addi $t0, $zero, 116 - sb $t0, 25($v0) # internal_0[17] = 't' - - addi $t0, $zero, 111 - sb $t0, 26($v0) # internal_0[18] = 'o' - - addi $t0, $zero, 32 - sb $t0, 27($v0) # internal_0[19] = ' ' - - addi $t0, $zero, 115 - sb $t0, 28($v0) # internal_0[20] = 's' - - addi $t0, $zero, 111 - sb $t0, 29($v0) # internal_0[21] = 'o' - - addi $t0, $zero, 114 - sb $t0, 30($v0) # internal_0[22] = 'r' - - addi $t0, $zero, 116 - sb $t0, 31($v0) # internal_0[23] = 't' - - addi $t0, $zero, 63 - sb $t0, 32($v0) # internal_0[24] = '?' - - addi $t0, $zero, 32 - sb $t0, 33($v0) # internal_0[25] = ' ' - - sb $zero, 34($v0) # Null-terminator at the end of the string - - sw $v0, 24($sp) # internal_0 = "How many numbers to sort? " - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_0 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO - lw $ra, 8($sp) - sw $v1, 32($sp) # internal_1 = result of function_out_string_at_IO - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument self - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing self - - # Calling function function_in_int_at_IO - jal function_in_int_at_IO - lw $ra, 4($sp) - sw $v1, 24($sp) # internal_2 = result of function_in_int_at_IO - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing self - - # Argument internal_2 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_2 - - # Calling function function_iota_at_Main - jal function_iota_at_Main - lw $ra, 8($sp) - sw $v1, 24($sp) # internal_3 = result of function_iota_at_Main - addi $sp, $sp, 12 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_3 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_3 - - # Calling function function_rev_at_List - jal function_rev_at_List - lw $ra, 4($sp) - sw $v1, 16($sp) # internal_4 = result of function_rev_at_List - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_4 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_4 - - # Calling function function_sort_at_List - jal function_sort_at_List - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_5 = result of function_sort_at_List - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_5 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_5 - - # Calling function function_print_list_at_List - jal function_print_list_at_List - lw $ra, 4($sp) - sw $v1, 8($sp) # internal_6 = result of function_print_list_at_List - addi $sp, $sp, 8 # Freeing space for arguments - - # Loading return value in $v1 - lw $v1, 0($sp) - - # Freeing space for local variables - addi $sp, $sp, 28 - - jr $ra - - main: - # Reserving space for local variables - addi $sp, $sp, -8 - - # Allocating Main - li $v0, 9 - lw $a0, type_Main - syscall - la $t0, type_Main # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of th object - sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object Main - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function___init___at_Main - jal function___init___at_Main - lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_Main - addi $sp, $sp, 8 # Freeing space for arguments - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address - - # Argument internal_0 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_0 - - # Calling function function_main_at_Main - jal function_main_at_Main - lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function_main_at_Main - addi $sp, $sp, 8 # Freeing space for arguments - - # Exit program - li $v0, 10 - syscall - - \ No newline at end of file diff --git a/src/sort-list.cil b/src/sort-list.cil deleted file mode 100644 index 7ea699b0f..000000000 --- a/src/sort-list.cil +++ /dev/null @@ -1,940 +0,0 @@ -.TYPES -type Object { - inherits from null - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method __init__: function___init___at_Object -} -type IO { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method out_string: function_out_string_at_IO - method out_int: function_out_int_at_IO - method in_string: function_in_string_at_IO - method in_int: function_in_int_at_IO - method __init__: function___init___at_IO -} -type Int { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method __init__: function___init___at_Int -} -type String { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method length: function_length_at_String - method concat: function_concat_at_String - method substr: function_substr_at_String - method __init__: function___init___at_String -} -type Bool { - inherits from Object - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method __init__: function___init___at_Bool -} -type List { - inherits from IO - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method out_string: function_out_string_at_IO - method out_int: function_out_int_at_IO - method in_string: function_in_string_at_IO - method in_int: function_in_int_at_IO - method isNil: function_isNil_at_List - method cons: function_cons_at_List - method car: function_car_at_List - method cdr: function_cdr_at_List - method rev: function_rev_at_List - method sort: function_sort_at_List - method insert: function_insert_at_List - method rcons: function_rcons_at_List - method print_list: function_print_list_at_List - method __init__: function___init___at_List -} -type Cons { - inherits from List - - attribute xcar - attribute xcdr - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method out_string: function_out_string_at_IO - method out_int: function_out_int_at_IO - method in_string: function_in_string_at_IO - method in_int: function_in_int_at_IO - method isNil: function_isNil_at_Cons - method cons: function_cons_at_List - method car: function_car_at_Cons - method cdr: function_cdr_at_Cons - method rev: function_rev_at_Cons - method sort: function_sort_at_Cons - method insert: function_insert_at_Cons - method rcons: function_rcons_at_Cons - method print_list: function_print_list_at_Cons - method __init__: function___init___at_Cons - method init: function_init_at_Cons -} -type Nil { - inherits from List - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method out_string: function_out_string_at_IO - method out_int: function_out_int_at_IO - method in_string: function_in_string_at_IO - method in_int: function_in_int_at_IO - method isNil: function_isNil_at_Nil - method cons: function_cons_at_List - method car: function_car_at_List - method cdr: function_cdr_at_List - method rev: function_rev_at_Nil - method sort: function_sort_at_Nil - method insert: function_insert_at_Nil - method rcons: function_rcons_at_Nil - method print_list: function_print_list_at_Nil - method __init__: function___init___at_Nil -} -type Main { - inherits from IO - - attribute l - - method abort: function_abort_at_Object - method type_name: function_type_name_at_Object - method copy: function_copy_at_Object - method out_string: function_out_string_at_IO - method out_int: function_out_int_at_IO - method in_string: function_in_string_at_IO - method in_int: function_in_int_at_IO - method iota: function_iota_at_Main - method main: function_main_at_Main - method __init__: function___init___at_Main -} - -.DATA - - -.CODE -function function_add{ - PARAM a - PARAM b - - LOCAL internal_0 # Adding result - - internal_0 = ALLOCINT 0 - internal_0 = a + b - - RETURN internal_0 -} -function function_sub{ - PARAM a - PARAM b - - LOCAL internal_0 # Substracting result - - internal_0 = ALLOCINT 0 - internal_0 = a - b - - RETURN internal_0 -} -function function_mult{ - PARAM a - PARAM b - - LOCAL internal_0 # Multiting result - - internal_0 = ALLOCINT 0 - internal_0 = a * b - - RETURN internal_0 -} -function function_div{ - PARAM a - PARAM b - - LOCAL internal_0 # Dividing result - - internal_0 = ALLOCINT 0 - internal_0 = a / b - - RETURN internal_0 -} -function function_xor{ - PARAM a - PARAM b - - LOCAL internal_0 # Xor result - - internal_0 = ALLOCINT 0 - internal_0 = XOR a b - - RETURN internal_0 -} -function function_less_than{ - PARAM a - PARAM b - - LOCAL internal_0 # Less than result - - internal_0 = ALLOCBOOL 0 - internal_0 = a < b - - RETURN internal_0 -} -function function_less_than_or_equal{ - PARAM a - PARAM b - - LOCAL internal_0 # Less than or equal result - - internal_0 = ALLOCBOOL 0 - internal_0 = a <= b - - RETURN internal_0 -} -function function_equal{ - PARAM a - PARAM b - - LOCAL internal_0 # Equal result - LOCAL internal_1 # Null Pointer - LOCAL internal_2 # One of params is null - LOCAL internal_3 # Type of a - LOCAL internal_4 # Type Int - LOCAL internal_5 # Type Bool - LOCAL internal_6 # Type String - LOCAL internal_7 # Type of a equals int - LOCAL internal_8 # Type of a equals bool - LOCAL internal_9 # Type of a equals string - - internal_0 = ALLOCBOOL 0 - internal_1 = ALLOCNULL - internal_2 = ALLOCBOOL 0 - internal_2 = EQUALADDR a internal_1 - internal_2 = EQUALADDR b internal_1 - IF internal_2 GOTO a_is_type_object - internal_3 = TYPEOF a - internal_4 = TYPEADDR Int - internal_5 = TYPEADDR Bool - internal_6 = TYPEADDR String - internal_7 = ALLOCBOOL 0 - internal_8 = ALLOCBOOL 0 - internal_9 = ALLOCBOOL 0 - internal_7 = EQUALADDR internal_3 internal_4 - internal_8 = EQUALADDR internal_3 internal_5 - internal_9 = EQUALADDR internal_3 internal_6 - - IF internal_7 GOTO a_is_type_int_or_bool - IF internal_8 GOTO a_is_type_int_or_bool - IF internal_9 GOTO a_is_type_string - GOTO a_is_type_object - - a_is_type_int_or_bool: - internal_0 = EQUALINT a b - GOTO end_of_equal - - a_is_type_string: - internal_0 = EQUALSTR a b - GOTO end_of_equal - - a_is_type_object: - internal_0 = a == b - GOTO end_of_equal - - end_of_equal: - - RETURN internal_0 -} -function function_assign{ - PARAM dest - PARAM source - - LOCAL internal_0 # Null Pointer - LOCAL internal_1 # One of params is null - LOCAL internal_2 # Type of source - LOCAL internal_3 # Type Int - LOCAL internal_4 # Type Bool - LOCAL internal_5 # Type of source equals int - LOCAL internal_6 # Type of source equals bool - - internal_0 = ALLOCNULL - internal_1 = ALLOCBOOL 0 - internal_1 = EQUALADDR source internal_0 - internal_1 = EQUALADDR dest internal_0 - IF internal_1 GOTO source_is_type_object - internal_2 = TYPEOF source - internal_3 = TYPEADDR Int - internal_4 = TYPEADDR Bool - internal_5 = ALLOCBOOL 0 - internal_6 = ALLOCBOOL 0 - internal_5 = EQUALADDR internal_2 internal_3 - internal_6 = EQUALADDR internal_2 internal_4 - - IF internal_5 GOTO source_is_type_int_or_bool - IF internal_6 GOTO source_is_type_int_or_bool - GOTO source_is_type_object - - source_is_type_int_or_bool: - dest = INT source - GOTO source_end_of_equal - - source_is_type_object: - dest = source - GOTO source_end_of_equal - - source_end_of_equal: - - RETURN dest -} -function function___init___at_Object{ - PARAM self - - RETURN self -} -function function_abort_at_Object{ - PARAM self - - LOCAL internal_0 - LOCAL internal_1 - LOCAL internal_2 - LOCAL internal_3 - - internal_0 = ALLOCSTR "Abort called from class " - internal_2 = ALLOCSTR "\n" - ARG self - internal_1 = VCALL String function_type_name_at_Object - ARG internal_0 - ARG internal_1 - internal_3 = VCALL String function_concat_at_String - ARG internal_3 - ARG internal_2 - internal_3 = VCALL String function_concat_at_String - PRINTSTR internal_3 - HALT - - RETURN self -} -function function_type_name_at_Object{ - PARAM self - - LOCAL internal_0 # type_name - - internal_0 = TYPENAME self - - RETURN internal_0 -} -function function_copy_at_Object{ - PARAM self - - LOCAL internal_0 - - internal_0 = COPY self - - RETURN internal_0 -} -function function___init___at_IO{ - PARAM self - - RETURN self -} -function function_out_string_at_IO{ - PARAM self - PARAM x - - PRINTSTR x - - RETURN self -} -function function_out_int_at_IO{ - PARAM self - PARAM x - - PRINTINT x - - RETURN self -} -function function_in_string_at_IO{ - PARAM self - - LOCAL internal_0 - - READSTR internal_0 - - RETURN internal_0 -} -function function_in_int_at_IO{ - PARAM self - - LOCAL internal_0 - - internal_0 = ALLOCINT 0 - READINT internal_0 - - RETURN internal_0 -} -function function___init___at_String{ - PARAM self - - RETURN self -} -function function_length_at_String{ - PARAM self - - LOCAL internal_0 - - internal_0 = ALLOCINT 0 - internal_0 = LENGTH self - - RETURN internal_0 -} -function function_concat_at_String{ - PARAM self - PARAM s - - LOCAL internal_0 - - internal_0 = CONCAT self s - - RETURN internal_0 -} -function function_substr_at_String{ - PARAM self - PARAM i - PARAM l - - LOCAL internal_0 - - internal_0 = SUBSTRING self i l - - RETURN internal_0 -} -function function___init___at_Int{ - PARAM self - - self = ALLOCINT 0 - - RETURN self -} -function function___init___at_Bool{ - PARAM self - - self = ALLOCBOOL 0 - - RETURN self -} -function function___init___at_List{ - PARAM self - - RETURN self -} -function function_isNil_at_List{ - PARAM self - - LOCAL internal_0 - LOCAL internal_1 # Boolean true - - ARG self - internal_0 = VCALL List function_abort_at_Object - internal_1 = ALLOCBOOL 1 - - RETURN internal_1 -} -function function_cons_at_List{ - PARAM self - PARAM hd - - LOCAL new_cell - LOCAL internal_1 # Store an instance of the class Cons - LOCAL internal_2 - - # Let new_cell: Cons - - internal_1 = ALLOCATE Cons # Allocate the object Cons - ARG internal_1 # Pass the instance to the constructor - internal_1 = VCALL Cons function___init___at_Cons # Call the constructor - ARG new_cell - ARG internal_1 - new_cell = CALL function_assign - ARG new_cell - ARG hd - ARG self - internal_2 = VCALL Cons function_init_at_Cons - - RETURN internal_2 -} -function function_car_at_List{ - PARAM self - - LOCAL internal_0 - LOCAL internal_1 # Store an instance of the class Int - - ARG self - internal_0 = VCALL List function_abort_at_Object - internal_1 = ALLOCATE Int # Allocate the object Int - ARG internal_1 # Pass the instance to the constructor - internal_1 = VCALL Int function___init___at_Int # Call the constructor - - RETURN internal_1 -} -function function_cdr_at_List{ - PARAM self - - LOCAL internal_0 - LOCAL internal_1 # Store an instance of the class List - - ARG self - internal_0 = VCALL List function_abort_at_Object - internal_1 = ALLOCATE List # Allocate the object List - ARG internal_1 # Pass the instance to the constructor - internal_1 = VCALL List function___init___at_List # Call the constructor - - RETURN internal_1 -} -function function_rev_at_List{ - PARAM self - - LOCAL internal_0 - - ARG self - internal_0 = VCALL List function_cdr_at_List - - RETURN internal_0 -} -function function_sort_at_List{ - PARAM self - - LOCAL internal_0 - - ARG self - internal_0 = VCALL List function_cdr_at_List - - RETURN internal_0 -} -function function_insert_at_List{ - PARAM self - PARAM i - - LOCAL internal_0 - - ARG self - internal_0 = VCALL List function_cdr_at_List - - RETURN internal_0 -} -function function_rcons_at_List{ - PARAM self - PARAM i - - LOCAL internal_0 - - ARG self - internal_0 = VCALL List function_cdr_at_List - - RETURN internal_0 -} -function function_print_list_at_List{ - PARAM self - - LOCAL internal_0 - - ARG self - internal_0 = VCALL List function_abort_at_Object - - RETURN internal_0 -} -function function___init___at_Cons{ - PARAM self - - LOCAL internal_0 # Integer 0 - LOCAL internal_1 # Null - - internal_0 = ALLOCINT 0 - - SETATTR self xcar internal_0 - internal_1 = ALLOCNULL - - SETATTR self xcdr internal_1 - - RETURN self -} -function function_isNil_at_Cons{ - PARAM self - - LOCAL internal_0 # Boolean false - - internal_0 = ALLOCBOOL 0 - - RETURN internal_0 -} -function function_init_at_Cons{ - PARAM self - PARAM hd - PARAM tl - - - SETATTR self xcar hd - - SETATTR self xcdr tl - - RETURN self -} -function function_car_at_Cons{ - PARAM self - - LOCAL internal_0 - - internal_0 = GETATTR self xcar - - RETURN internal_0 -} -function function_cdr_at_Cons{ - PARAM self - - LOCAL internal_0 - - internal_0 = GETATTR self xcdr - - RETURN internal_0 -} -function function_rev_at_Cons{ - PARAM self - - LOCAL internal_0 - LOCAL internal_1 - LOCAL internal_2 - LOCAL internal_3 - - internal_0 = GETATTR self xcdr - ARG internal_0 - internal_1 = VCALL List function_rev_at_List - internal_2 = GETATTR self xcar - ARG internal_1 - ARG internal_2 - internal_3 = VCALL List function_rcons_at_List - - RETURN internal_3 -} -function function_sort_at_Cons{ - PARAM self - - LOCAL internal_0 - LOCAL internal_1 - LOCAL internal_2 - LOCAL internal_3 - - internal_0 = GETATTR self xcdr - ARG internal_0 - internal_1 = VCALL List function_sort_at_List - internal_2 = GETATTR self xcar - ARG internal_1 - ARG internal_2 - internal_3 = VCALL List function_insert_at_List - - RETURN internal_3 -} -function function_insert_at_Cons{ - PARAM self - PARAM i - - LOCAL internal_0 - LOCAL internal_1 - LOCAL internal_2 - LOCAL internal_3 # Store the result of the operation function_less_than - LOCAL internal_4 # Store an instance of the class Cons - LOCAL internal_5 - LOCAL internal_6 # Store an instance of the class Cons - LOCAL internal_7 - LOCAL internal_8 - LOCAL internal_9 - LOCAL internal_10 - - # Conditional - internal_1 = ALLOCBOOL 0 - internal_2 = GETATTR self xcar - - ARG i - ARG internal_2 - internal_3 = CALL function_less_than - internal_1 = internal_3 - IF internal_1 GOTO then_8750086234655 - GOTO else_8750086234655 - - then_8750086234655: - internal_4 = ALLOCATE Cons # Allocate the object Cons - ARG internal_4 # Pass the instance to the constructor - internal_4 = VCALL Cons function___init___at_Cons # Call the constructor - ARG internal_4 - ARG i - ARG self - internal_5 = VCALL Cons function_init_at_Cons - internal_0 = internal_5 - GOTO endif_8750086234655 - - else_8750086234655: - internal_6 = ALLOCATE Cons # Allocate the object Cons - ARG internal_6 # Pass the instance to the constructor - internal_6 = VCALL Cons function___init___at_Cons # Call the constructor - internal_7 = GETATTR self xcar - internal_8 = GETATTR self xcdr - ARG internal_8 - ARG i - internal_9 = VCALL List function_insert_at_List - ARG internal_6 - ARG internal_7 - ARG internal_9 - internal_10 = VCALL Cons function_init_at_Cons - internal_0 = internal_10 - GOTO endif_8750086234655 - - endif_8750086234655: - - RETURN internal_0 -} -function function_rcons_at_Cons{ - PARAM self - PARAM i - - LOCAL internal_0 # Store an instance of the class Cons - LOCAL internal_1 - LOCAL internal_2 - LOCAL internal_3 - LOCAL internal_4 - - internal_0 = ALLOCATE Cons # Allocate the object Cons - ARG internal_0 # Pass the instance to the constructor - internal_0 = VCALL Cons function___init___at_Cons # Call the constructor - internal_1 = GETATTR self xcar - internal_2 = GETATTR self xcdr - ARG internal_2 - ARG i - internal_3 = VCALL List function_rcons_at_List - ARG internal_0 - ARG internal_1 - ARG internal_3 - internal_4 = VCALL Cons function_init_at_Cons - - RETURN internal_4 -} -function function_print_list_at_Cons{ - PARAM self - - LOCAL internal_0 - LOCAL internal_1 - LOCAL internal_2 # String "\n" - LOCAL internal_3 - LOCAL internal_4 - LOCAL internal_5 - - internal_0 = GETATTR self xcar - ARG self - ARG internal_0 - internal_1 = VCALL Cons function_out_int_at_IO - internal_2 = ALLOCSTR "\n" - ARG self - ARG internal_2 - internal_3 = VCALL Cons function_out_string_at_IO - internal_4 = GETATTR self xcdr - ARG internal_4 - internal_5 = VCALL List function_print_list_at_List - - RETURN internal_5 -} -function function___init___at_Nil{ - PARAM self - - RETURN self -} -function function_isNil_at_Nil{ - PARAM self - - LOCAL internal_0 # Boolean true - - internal_0 = ALLOCBOOL 1 - - RETURN internal_0 -} -function function_rev_at_Nil{ - PARAM self - - RETURN self -} -function function_sort_at_Nil{ - PARAM self - - RETURN self -} -function function_insert_at_Nil{ - PARAM self - PARAM i - - LOCAL internal_0 - - ARG self - ARG i - internal_0 = VCALL Nil function_rcons_at_Nil - - RETURN internal_0 -} -function function_rcons_at_Nil{ - PARAM self - PARAM i - - LOCAL internal_0 # Store an instance of the class Cons - LOCAL internal_1 - - internal_0 = ALLOCATE Cons # Allocate the object Cons - ARG internal_0 # Pass the instance to the constructor - internal_0 = VCALL Cons function___init___at_Cons # Call the constructor - ARG internal_0 - ARG i - ARG self - internal_1 = VCALL Cons function_init_at_Cons - - RETURN internal_1 -} -function function_print_list_at_Nil{ - PARAM self - - LOCAL internal_0 # Boolean true - - internal_0 = ALLOCBOOL 1 - - RETURN internal_0 -} -function function___init___at_Main{ - PARAM self - - LOCAL internal_0 # Null - - internal_0 = ALLOCNULL - - SETATTR self l internal_0 - - RETURN self -} -function function_iota_at_Main{ - PARAM self - PARAM i - - LOCAL internal_0 # Store an instance of the class Nil - LOCAL j - LOCAL internal_2 # Integer 0 - LOCAL internal_3 # Store the result of the operation function_less_than - LOCAL internal_4 # Store an instance of the class Cons - LOCAL internal_5 - LOCAL internal_6 - LOCAL internal_7 # Integer 1 - LOCAL internal_8 # Store the result of the operation function_add - LOCAL internal_9 - - internal_0 = ALLOCATE Nil # Allocate the object Nil - ARG internal_0 # Pass the instance to the constructor - internal_0 = VCALL Nil function___init___at_Nil # Call the constructor - - SETATTR self l internal_0 - # Let j: Int - - internal_2 = ALLOCINT 0 - ARG j - ARG internal_2 - j = CALL function_assign - - # While loop - while_start_8750086235432: - - ARG j - ARG i - internal_3 = CALL function_less_than - IF internal_3 GOTO while_body_8750086235432 - GOTO while_end_8750086235432 - - while_body_8750086235432: - internal_4 = ALLOCATE Cons # Allocate the object Cons - ARG internal_4 # Pass the instance to the constructor - internal_4 = VCALL Cons function___init___at_Cons # Call the constructor - internal_5 = GETATTR self l - ARG internal_4 - ARG j - ARG internal_5 - internal_6 = VCALL Cons function_init_at_Cons - - SETATTR self l internal_6 - internal_7 = ALLOCINT 1 - - ARG j - ARG internal_7 - internal_8 = CALL function_add - - ARG j - ARG internal_8 - j = CALL function_assign - GOTO while_start_8750086235432 - - while_end_8750086235432: - internal_9 = GETATTR self l - - RETURN internal_9 -} -function function_main_at_Main{ - PARAM self - - LOCAL internal_0 # String "How many numbers to sort? " - LOCAL internal_1 - LOCAL internal_2 - LOCAL internal_3 - LOCAL internal_4 - LOCAL internal_5 - LOCAL internal_6 - - internal_0 = ALLOCSTR "How many numbers to sort? " - ARG self - ARG internal_0 - internal_1 = VCALL Main function_out_string_at_IO - ARG self - internal_2 = VCALL Main function_in_int_at_IO - ARG self - ARG internal_2 - internal_3 = VCALL Main function_iota_at_Main - ARG internal_3 - internal_4 = VCALL List function_rev_at_List - ARG internal_4 - internal_5 = VCALL List function_sort_at_List - ARG internal_5 - internal_6 = VCALL List function_print_list_at_List - - RETURN internal_6 -} -function main{ - - - LOCAL internal_0 - LOCAL internal_1 - - internal_0 = ALLOCATE Main - ARG internal_0 - internal_0 = VCALL Main function___init___at_Main - - ARG internal_0 - internal_1 = VCALL Main function_main_at_Main - - HALT -} \ No newline at end of file diff --git a/src/sort-list.cl b/src/sort-list.cl deleted file mode 100644 index 333e853d8..000000000 --- a/src/sort-list.cl +++ /dev/null @@ -1,149 +0,0 @@ -(* - This file presents a fairly large example of Cool programming. The -class List defines the names of standard list operations ala Scheme: -car, cdr, cons, isNil, rev, sort, rcons (add an element to the end of -the list), and print_list. In the List class most of these functions -are just stubs that abort if ever called. The classes Nil and Cons -inherit from List and define the same operations, but now as -appropriate to the empty list (for the Nil class) and for cons cells (for -the Cons class). - -The Main class puts all of this code through the following silly -test exercise: - - 1. prompt for a number N - 2. generate a list of numbers 0..N-1 - 3. reverse the list - 4. sort the list - 5. print the sorted list - -Because the sort used is a quadratic space insertion sort, sorting -moderately large lists can be quite slow. -*) - -Class List inherits IO { - (* Since abort() returns Object, we need something of - type Bool at the end of the block to satisfy the typechecker. - This code is unreachable, since abort() halts the program. *) - isNil() : Bool { { abort(); true; } }; - - cons(hd : Int) : 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 Int here to satisfy the typechecker. - This code is, of course, unreachable. - *) - car() : Int { { abort(); new Int; } }; - - cdr() : List { { abort(); new List; } }; - - rev() : List { cdr() }; - - sort() : List { cdr() }; - - insert(i : Int) : List { cdr() }; - - rcons(i : Int) : List { cdr() }; - - print_list() : Object { abort() }; -}; - -Class Cons inherits List { - xcar : Int; -- We keep the car in cdr in attributes. - xcdr : List; - - isNil() : Bool { false }; - - init(hd : Int, tl : List) : Cons { - { - xcar <- hd; - xcdr <- tl; - self; - } - }; - - car() : Int { xcar }; - - cdr() : List { xcdr }; - - rev() : List { - (xcdr.rev()).rcons(xcar) - }; - - sort() : List { (xcdr.sort()).insert(xcar) }; - - insert(i : Int) : List { - if i < xcar then - (new Cons).init(i,self) - else - (new Cons).init(xcar,xcdr.insert(i)) - fi - }; - - - rcons(i : Int) : List { (new Cons).init(xcar, xcdr.rcons(i)) }; - - print_list() : Object { - { - out_int(xcar); - out_string("\n"); - xcdr.print_list(); - } - }; -}; - -Class Nil inherits List { - isNil() : Bool { true }; - - rev() : List { self }; - - sort() : List { self }; - - insert(i : Int) : List { rcons(i) }; - - rcons(i : Int) : List { (new Cons).init(i,self) }; - - print_list() : Object { true }; - -}; - - -Class Main inherits IO { - - l : List; - - (* iota maps its integer argument n into the list 0..n-1 *) - iota(i : Int) : List { - { - l <- new Nil; - ( - let j : Int <- 0 in - while j < i - loop - { - l <- (new Cons).init(j,l); - j <- j + 1; - } - pool - ); - l; - } - }; - - main() : Object { - { - out_string("How many numbers to sort? "); - iota(in_int()).rev().sort().print_list(); - } - }; -}; - - - - - diff --git a/tests/codegen/arith.mips b/tests/codegen/arith.mips index d84c596a2..bbb741182 100644 --- a/tests/codegen/arith.mips +++ b/tests/codegen/arith.mips @@ -1,87 +1,198 @@ .data - type_Object: .word 8 + type_Object: .word 24 type_Object_inherits_from: .word 0 - type_Object_attributes: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_A: .word 56 + type_A_inherits_from: .word type_Object + type_A_name_address: .word type_A_name_size + type_A___init__: .word function___init___at_A + type_A_abort: .word function_abort_at_Object + type_A_type_name: .word function_type_name_at_Object + type_A_copy: .word function_copy_at_Object + type_A_value: .word function_value_at_A + type_A_set_var: .word function_set_var_at_A + type_A_method1: .word function_method1_at_A + type_A_method2: .word function_method2_at_A + type_A_method3: .word function_method3_at_A + type_A_method4: .word function_method4_at_A + type_A_method5: .word function_method5_at_A + + type_B: .word 56 + type_B_inherits_from: .word type_A + type_B_name_address: .word type_B_name_size + type_B___init__: .word function___init___at_B + type_B_abort: .word function_abort_at_Object + type_B_type_name: .word function_type_name_at_Object + type_B_copy: .word function_copy_at_Object + type_B_value: .word function_value_at_A + type_B_set_var: .word function_set_var_at_A + type_B_method1: .word function_method1_at_A + type_B_method2: .word function_method2_at_A + type_B_method3: .word function_method3_at_A + type_B_method4: .word function_method4_at_A + type_B_method5: .word function_method5_at_B + + type_C: .word 60 + type_C_inherits_from: .word type_B + type_C_name_address: .word type_C_name_size + type_C___init__: .word function___init___at_C + type_C_abort: .word function_abort_at_Object + type_C_type_name: .word function_type_name_at_Object + type_C_copy: .word function_copy_at_Object + type_C_value: .word function_value_at_A + type_C_set_var: .word function_set_var_at_A + type_C_method1: .word function_method1_at_A + type_C_method2: .word function_method2_at_A + type_C_method3: .word function_method3_at_A + type_C_method4: .word function_method4_at_A + type_C_method5: .word function_method5_at_C + type_C_method6: .word function_method6_at_C + + type_D: .word 60 + type_D_inherits_from: .word type_B + type_D_name_address: .word type_D_name_size + type_D___init__: .word function___init___at_D + type_D_abort: .word function_abort_at_Object + type_D_type_name: .word function_type_name_at_Object + type_D_copy: .word function_copy_at_Object + type_D_value: .word function_value_at_A + type_D_set_var: .word function_set_var_at_A + type_D_method1: .word function_method1_at_A + type_D_method2: .word function_method2_at_A + type_D_method3: .word function_method3_at_A + type_D_method4: .word function_method4_at_A + type_D_method5: .word function_method5_at_B + type_D_method7: .word function_method7_at_D + + type_E: .word 64 + type_E_inherits_from: .word type_D + type_E_name_address: .word type_E_name_size + type_E___init__: .word function___init___at_E + type_E_abort: .word function_abort_at_Object + type_E_type_name: .word function_type_name_at_Object + type_E_copy: .word function_copy_at_Object + type_E_value: .word function_value_at_A + type_E_set_var: .word function_set_var_at_A + type_E_method1: .word function_method1_at_A + type_E_method2: .word function_method2_at_A + type_E_method3: .word function_method3_at_A + type_E_method4: .word function_method4_at_A + type_E_method5: .word function_method5_at_B + type_E_method7: .word function_method7_at_D + type_E_method6: .word function_method6_at_E + + type_A2I: .word 48 + type_A2I_inherits_from: .word type_Object + type_A2I_name_address: .word type_A2I_name_size + type_A2I___init__: .word function___init___at_A2I + type_A2I_abort: .word function_abort_at_Object + type_A2I_type_name: .word function_type_name_at_Object + type_A2I_copy: .word function_copy_at_Object + type_A2I_c2i: .word function_c2i_at_A2I + type_A2I_i2c: .word function_i2c_at_A2I + type_A2I_a2i: .word function_a2i_at_A2I + type_A2I_a2i_aux: .word function_a2i_aux_at_A2I + type_A2I_i2a: .word function_i2a_at_A2I + type_A2I_i2a_aux: .word function_i2a_aux_at_A2I + + type_Main: .word 84 + type_Main_inherits_from: .word type_IO + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_out_string: .word function_out_string_at_IO + type_Main_out_int: .word function_out_int_at_IO + type_Main_in_string: .word function_in_string_at_IO + type_Main_in_int: .word function_in_int_at_IO + type_Main_menu: .word function_menu_at_Main + type_Main_prompt: .word function_prompt_at_Main + type_Main_get_int: .word function_get_int_at_Main + type_Main_is_even: .word function_is_even_at_Main + type_Main_class_type: .word function_class_type_at_Main + type_Main_print: .word function_print_at_Main + type_Main_main: .word function_main_at_Main + type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" - type_Object_abort_message: .asciiz "Abort called from class Object\n" - type_IO: .word 8 - type_IO_inherits_from: .word type_Object - type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" - type_IO_abort_message: .asciiz "Abort called from class IO\n" - type_Int: .word 8 - type_Int_inherits_from: .word type_Object - type_Int_attributes: .word 0 - type_Int_name_size: .word 3 - type_Int_name: .asciiz "Int" - type_Int_abort_message: .asciiz "Abort called from class Int\n" - - type_String: .word 8 - type_String_inherits_from: .word type_Object - type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" - type_String_abort_message: .asciiz "Abort called from class String\n" - type_Bool: .word 8 - type_Bool_inherits_from: .word type_Object - type_Bool_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" - type_Bool_abort_message: .asciiz "Abort called from class Bool\n" - type_A: .word 12 - type_A_inherits_from: .word type_Object - type_A_attributes: .word 1 type_A_name_size: .word 1 type_A_name: .asciiz "A" - type_A_abort_message: .asciiz "Abort called from class A\n" - type_B: .word 12 - type_B_inherits_from: .word type_A - type_B_attributes: .word 1 type_B_name_size: .word 1 type_B_name: .asciiz "B" - type_B_abort_message: .asciiz "Abort called from class B\n" - type_C: .word 12 - type_C_inherits_from: .word type_B - type_C_attributes: .word 1 type_C_name_size: .word 1 type_C_name: .asciiz "C" - type_C_abort_message: .asciiz "Abort called from class C\n" - type_D: .word 12 - type_D_inherits_from: .word type_B - type_D_attributes: .word 1 type_D_name_size: .word 1 type_D_name: .asciiz "D" - type_D_abort_message: .asciiz "Abort called from class D\n" - type_E: .word 12 - type_E_inherits_from: .word type_D - type_E_attributes: .word 1 type_E_name_size: .word 1 type_E_name: .asciiz "E" - type_E_abort_message: .asciiz "Abort called from class E\n" - type_A2I: .word 8 - type_A2I_inherits_from: .word type_Object - type_A2I_attributes: .word 0 type_A2I_name_size: .word 3 type_A2I_name: .asciiz "A2I" - type_A2I_abort_message: .asciiz "Abort called from class A2I\n" - type_Main: .word 24 - type_Main_inherits_from: .word type_IO - type_Main_attributes: .word 4 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" - type_Main_abort_message: .asciiz "Abort called from class Main\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -742,11 +853,11 @@ function_abort_at_Object: # Function parameters - # $ra = 20($sp) - # self = 16($sp) + # $ra = 28($sp) + # self = 24($sp) # Reserving space for local variables - addi $sp, $sp, -16 + addi $sp, $sp, -24 # Allocating String li $v0, 9 @@ -833,7 +944,7 @@ sb $zero, 32($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_0 = "Abort called from class " + sw $v0, 20($sp) # internal_0 = "Abort called from class " # Allocating String li $v0, 9 @@ -847,66 +958,138 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_2[0] = '\n' + sb $t0, 8($v0) # internal_3[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_2 = "\n" + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 0($sp) # Storing self - # Calling function function_type_name_at_Object - jal function_type_name_at_Object + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + sw $v1, 24($sp) # internal_1 = result of internal_5 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_0 - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing internal_0 # Argument internal_1 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_1 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_3 - lw $t0, 12($sp) - sw $t0, 4($sp) # Storing internal_3 - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) # $t0 = internal_3 + lw $t0, 12($sp) # $t0 = internal_2 addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string internal_3 + # Printing the String internal_2 li $v0, 4 move $a0, $t0 syscall @@ -916,10 +1099,10 @@ syscall # Loading return value in $v1 - lw $v1, 16($sp) + lw $v1, 24($sp) # Freeing space for local variables - addi $sp, $sp, 16 + addi $sp, $sp, 24 jr $ra @@ -934,8 +1117,9 @@ # internal_0 = name of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($t0) # $t1 = type of self - lw $t2, 12($t1) # $t1 = length of the name of self - la $t3, 16($t1) # $t1 = name of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 @@ -1038,7 +1222,7 @@ lw $t0, 0($sp) # $t0 = x addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string x + # Printing the String x li $v0, 4 move $a0, $t0 syscall @@ -1054,7 +1238,7 @@ # self = 4($sp) # x = 0($sp) - # Printing the string x + # Printing the Int x li $v0, 1 lw $a0, 0($sp) lw $a0, 8($a0) @@ -1081,11 +1265,13 @@ xor $t0, $t0, $t0 # Initializing counter while_read_start: lb $t1, buffer_input($t0) # Loading the byte - beq $t1, $zero, while_read_end + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end addi $t0, $t0, 1 # Incrementing counter j while_read_start while_read_end: - addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 @@ -1332,6 +1518,26 @@ jr $ra + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + function___init___at_A: # Function parameters # $ra = 8($sp) @@ -1355,17 +1561,17 @@ # Set attribute var of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8794497400971 + beq $t1, $zero, object_set_attribute_8753943000938 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8794497400971 + beq $t6, $t5, int_set_attribute_8753943000938 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8794497400971 - j object_set_attribute_8794497400971 - int_set_attribute_8794497400971: + beq $t6, $t5, bool_set_attribute_8753943000938 + j object_set_attribute_8753943000938 + int_set_attribute_8753943000938: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1374,8 +1580,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.var = internal_0 - j end_set_attribute_8794497400971 - bool_set_attribute_8794497400971: + j end_set_attribute_8753943000938 + bool_set_attribute_8753943000938: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1384,10 +1590,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.var = internal_0 - j end_set_attribute_8794497400971 - object_set_attribute_8794497400971: + j end_set_attribute_8753943000938 + object_set_attribute_8753943000938: sw $t1, 8($t0) # self.var = internal_0 - end_set_attribute_8794497400971: + end_set_attribute_8753943000938: # Loading return value in $v1 lw $v1, 4($sp) @@ -1407,17 +1613,17 @@ # Get attribute var of self lw $t0, 4($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'var' from the instance + lw $t1, 8($t0) # Get the attribute 'var' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497400995 + beq $t6, $t5, int_get_attribute_8753943000962 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497400995 - j object_get_attribute_8794497400995 - int_get_attribute_8794497400995: + beq $t6, $t5, bool_get_attribute_8753943000962 + j object_get_attribute_8753943000962 + int_get_attribute_8753943000962: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1426,8 +1632,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 0($sp) # internal_0 = self.var - j end_get_attribute_8794497400995 - bool_get_attribute_8794497400995: + j end_get_attribute_8753943000962 + bool_get_attribute_8753943000962: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1436,10 +1642,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 0($sp) # internal_0 = self.var - j end_get_attribute_8794497400995 - object_get_attribute_8794497400995: - sw $t1, 0($sp) # internal_0 = var - end_get_attribute_8794497400995: + j end_get_attribute_8753943000962 + object_get_attribute_8753943000962: + sw $t1, 0($sp) # internal_0 = self.var + end_get_attribute_8753943000962: # Loading return value in $v1 lw $v1, 0($sp) @@ -1458,17 +1664,17 @@ # Set attribute var of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($sp) # $t1 = num - beq $t1, $zero, object_set_attribute_8794497401046 + beq $t1, $zero, object_set_attribute_8753943001013 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8794497401046 + beq $t6, $t5, int_set_attribute_8753943001013 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8794497401046 - j object_set_attribute_8794497401046 - int_set_attribute_8794497401046: + beq $t6, $t5, bool_set_attribute_8753943001013 + j object_set_attribute_8753943001013 + int_set_attribute_8753943001013: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1477,8 +1683,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.var = num - j end_set_attribute_8794497401046 - bool_set_attribute_8794497401046: + j end_set_attribute_8753943001013 + bool_set_attribute_8753943001013: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1487,10 +1693,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.var = num - j end_set_attribute_8794497401046 - object_set_attribute_8794497401046: + j end_set_attribute_8753943001013 + object_set_attribute_8753943001013: sw $t1, 8($t0) # self.var = num - end_set_attribute_8794497401046: + end_set_attribute_8753943001013: # Loading return value in $v1 lw $v1, 4($sp) @@ -1510,13 +1716,13 @@ function_method2_at_A: # Function parameters - # $ra = 28($sp) - # self = 24($sp) - # num1 = 20($sp) - # num2 = 16($sp) + # $ra = 36($sp) + # self = 32($sp) + # num1 = 28($sp) + # num2 = 24($sp) # Reserving space for local variables - addi $sp, $sp, -16 + addi $sp, $sp, -24 # Allocating Int 0 li $v0, 9 @@ -1528,24 +1734,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # x = address of allocated object Int + sw $v0, 20($sp) # x = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num1 - lw $t0, 32($sp) + lw $t0, 40($sp) sw $t0, 4($sp) # Storing num1 # Argument num2 - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t0, 0($sp) # Storing num2 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 20($sp) # internal_1 = result of function_add + sw $v1, 28($sp) # internal_1 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -1553,17 +1759,17 @@ sw $ra, 8($sp) # Storing return address # Argument x - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing x # Argument internal_1 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 24($sp) # x = result of function_assign + sw $v1, 32($sp) # x = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating B @@ -1573,56 +1779,80 @@ la $t0, type_B # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_2 = address of allocated object B + sw $v0, 12($sp) # internal_2 = address of allocated object B # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_2 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function___init___at_B jal function___init___at_B lw $ra, 4($sp) - sw $v1, 12($sp) # internal_2 = result of function___init___at_B + sw $v1, 20($sp) # internal_2 = result of function___init___at_B addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method set_var of B + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_2 - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 4($sp) # Storing internal_2 # Argument x - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 0($sp) # Storing x - # Calling function function_set_var_at_A - jal function_set_var_at_A + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_set_var_at_A + sw $v1, 20($sp) # internal_3 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 16 + addi $sp, $sp, 24 jr $ra function_method3_at_A: # Function parameters - # $ra = 32($sp) - # self = 28($sp) - # num = 24($sp) + # $ra = 40($sp) + # self = 36($sp) + # num = 32($sp) # Reserving space for local variables - addi $sp, $sp, -24 + addi $sp, $sp, -32 # Allocating Int 0 li $v0, 9 @@ -1634,7 +1864,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # x = address of allocated object Int + sw $v0, 28($sp) # x = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -1646,7 +1876,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_1 = address of allocated object Int + sw $v0, 24($sp) # internal_1 = address of allocated object Int # Allocating Int 4294967295 li $v0, 9 @@ -1658,7 +1888,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4294967295 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_2 = address of allocated object Int + sw $v0, 20($sp) # internal_2 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -1670,24 +1900,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_3 = address of allocated object Int + sw $v0, 16($sp) # internal_3 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 36($sp) + lw $t0, 44($sp) sw $t0, 4($sp) # Storing num # Argument internal_2 - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_xor jal function_xor lw $ra, 8($sp) - sw $v1, 20($sp) # internal_3 = result of function_xor + sw $v1, 28($sp) # internal_3 = result of function_xor addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -1695,17 +1925,17 @@ sw $ra, 8($sp) # Storing return address # Argument internal_3 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 4($sp) # Storing internal_3 # Argument internal_1 - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 20($sp) # internal_3 = result of function_add + sw $v1, 28($sp) # internal_3 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -1713,17 +1943,17 @@ sw $ra, 8($sp) # Storing return address # Argument x - lw $t0, 32($sp) + lw $t0, 40($sp) sw $t0, 4($sp) # Storing x # Argument internal_3 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 32($sp) # x = result of function_assign + sw $v1, 40($sp) # x = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating C @@ -1733,57 +1963,81 @@ la $t0, type_C # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_4 = address of allocated object C + sw $v0, 12($sp) # internal_4 = address of allocated object C # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_4 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_4 # Calling function function___init___at_C jal function___init___at_C lw $ra, 4($sp) - sw $v1, 12($sp) # internal_4 = result of function___init___at_C + sw $v1, 20($sp) # internal_4 = result of function___init___at_C addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Get method set_var of C + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_4 - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 4($sp) # Storing internal_4 # Argument x - lw $t0, 32($sp) + lw $t0, 40($sp) sw $t0, 0($sp) # Storing x - # Calling function function_set_var_at_A - jal function_set_var_at_A + # Calling function internal_7 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_5 = result of function_set_var_at_A + sw $v1, 20($sp) # internal_5 = result of internal_7 addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 24 + addi $sp, $sp, 32 jr $ra function_method4_at_A: # Function parameters - # $ra = 56($sp) - # self = 52($sp) - # num1 = 48($sp) - # num2 = 44($sp) + # $ra = 72($sp) + # self = 68($sp) + # num1 = 64($sp) + # num2 = 60($sp) # Reserving space for local variables - addi $sp, $sp, -44 + addi $sp, $sp, -60 # Allocating Bool 0 li $v0, 9 @@ -1795,40 +2049,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_1 = address of allocated object Int + sw $v0, 52($sp) # internal_1 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num2 - lw $t0, 56($sp) + lw $t0, 72($sp) sw $t0, 4($sp) # Storing num2 # Argument num1 - lw $t0, 60($sp) + lw $t0, 76($sp) sw $t0, 0($sp) # Storing num1 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 44($sp) # internal_2 = result of function_less_than + sw $v1, 60($sp) # internal_2 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments # internal_1 = internal_2 - lw $t0, 32($sp) - sw $t0, 36($sp) + lw $t0, 48($sp) + sw $t0, 52($sp) - # If internal_1 then goto then_8794497430649 - lw $t0, 36($sp) # Loading the address of the condition + # If internal_1 then goto then_8753943062748 + lw $t0, 52($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497430649 + beq $t0, $t1, then_8753943062748 - # Jumping to else_8794497430649 - j else_8794497430649 + # Jumping to else_8753943062748 + j else_8753943062748 - then_8794497430649: + then_8753943062748: # Allocating Int 0 li $v0, 9 @@ -1840,24 +2094,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # x = address of allocated object Int + sw $v0, 44($sp) # x = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num1 - lw $t0, 60($sp) + lw $t0, 76($sp) sw $t0, 4($sp) # Storing num1 # Argument num2 - lw $t0, 56($sp) + lw $t0, 72($sp) sw $t0, 0($sp) # Storing num2 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 36($sp) # internal_4 = result of function_sub + sw $v1, 52($sp) # internal_4 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -1865,17 +2119,17 @@ sw $ra, 8($sp) # Storing return address # Argument x - lw $t0, 40($sp) + lw $t0, 56($sp) sw $t0, 4($sp) # Storing x # Argument internal_4 - lw $t0, 36($sp) + lw $t0, 52($sp) sw $t0, 0($sp) # Storing internal_4 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 40($sp) # x = result of function_assign + sw $v1, 56($sp) # x = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating D @@ -1885,48 +2139,72 @@ la $t0, type_D # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 20($sp) # internal_5 = address of allocated object D + sw $v0, 36($sp) # internal_5 = address of allocated object D # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_5 - lw $t0, 28($sp) + lw $t0, 44($sp) sw $t0, 0($sp) # Storing internal_5 # Calling function function___init___at_D jal function___init___at_D lw $ra, 4($sp) - sw $v1, 28($sp) # internal_5 = result of function___init___at_D + sw $v1, 44($sp) # internal_5 = result of function___init___at_D addi $sp, $sp, 8 # Freeing space for arguments - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument internal_5 - lw $t0, 32($sp) + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_7 = address of allocated object Int + + # Get method set_var of D + lw $t0, 36($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 28($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 24($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_5 + lw $t0, 48($sp) sw $t0, 4($sp) # Storing internal_5 # Argument x - lw $t0, 40($sp) + lw $t0, 56($sp) sw $t0, 0($sp) # Storing x - # Calling function function_set_var_at_A - jal function_set_var_at_A + # Calling function internal_8 + lw $t0, 36($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 28($sp) # internal_6 = result of function_set_var_at_A + sw $v1, 44($sp) # internal_6 = result of internal_8 addi $sp, $sp, 12 # Freeing space for arguments # internal_0 = internal_6 - lw $t0, 16($sp) - sw $t0, 40($sp) + lw $t0, 32($sp) + sw $t0, 56($sp) - # Jumping to endif_8794497430649 - j endif_8794497430649 + # Jumping to endif_8753943062748 + j endif_8753943062748 - else_8794497430649: + else_8753943062748: # Allocating Int 0 li $v0, 9 @@ -1938,24 +2216,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # x = address of allocated object Int + sw $v0, 44($sp) # x = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num2 - lw $t0, 56($sp) + lw $t0, 72($sp) sw $t0, 4($sp) # Storing num2 # Argument num1 - lw $t0, 60($sp) + lw $t0, 76($sp) sw $t0, 0($sp) # Storing num1 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 20($sp) # internal_8 = result of function_sub + sw $v1, 28($sp) # internal_10 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -1963,17 +2241,17 @@ sw $ra, 8($sp) # Storing return address # Argument x - lw $t0, 40($sp) + lw $t0, 56($sp) sw $t0, 4($sp) # Storing x - # Argument internal_8 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_8 + # Argument internal_10 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_10 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 40($sp) # x = result of function_assign + sw $v1, 56($sp) # x = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating D @@ -1983,65 +2261,89 @@ la $t0, type_D # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_9 = address of allocated object D + sw $v0, 12($sp) # internal_11 = address of allocated object D # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_9 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_9 + # Argument internal_11 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_11 # Calling function function___init___at_D jal function___init___at_D lw $ra, 4($sp) - sw $v1, 12($sp) # internal_9 = result of function___init___at_D + sw $v1, 20($sp) # internal_11 = result of function___init___at_D addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_13 = address of allocated object Int + + # Get method set_var of D + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_9 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_9 + # Argument internal_11 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_11 # Argument x - lw $t0, 40($sp) + lw $t0, 56($sp) sw $t0, 0($sp) # Storing x - # Calling function function_set_var_at_A - jal function_set_var_at_A + # Calling function internal_14 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_10 = result of function_set_var_at_A + sw $v1, 20($sp) # internal_12 = result of internal_14 addi $sp, $sp, 12 # Freeing space for arguments - # internal_0 = internal_10 - lw $t0, 0($sp) - sw $t0, 40($sp) + # internal_0 = internal_12 + lw $t0, 8($sp) + sw $t0, 56($sp) - # Jumping to endif_8794497430649 - j endif_8794497430649 + # Jumping to endif_8753943062748 + j endif_8753943062748 - endif_8794497430649: + endif_8753943062748: # Loading return value in $v1 - lw $v1, 40($sp) + lw $v1, 56($sp) # Freeing space for local variables - addi $sp, $sp, 44 + addi $sp, $sp, 60 jr $ra function_method5_at_A: # Function parameters - # $ra = 48($sp) - # self = 44($sp) - # num = 40($sp) + # $ra = 60($sp) + # self = 56($sp) + # num = 52($sp) # Reserving space for local variables - addi $sp, $sp, -40 + addi $sp, $sp, -52 # Allocating Int 1 li $v0, 9 @@ -2053,24 +2355,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_1 = address of allocated object Int + sw $v0, 44($sp) # internal_1 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument x - lw $t0, 48($sp) + lw $t0, 60($sp) sw $t0, 4($sp) # Storing x # Argument internal_1 - lw $t0, 44($sp) + lw $t0, 56($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 48($sp) # x = result of function_assign + sw $v1, 60($sp) # x = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -2083,73 +2385,76 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_3 = address of allocated object Int + sw $v0, 36($sp) # internal_3 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument y - lw $t0, 40($sp) + lw $t0, 52($sp) sw $t0, 4($sp) # Storing y # Argument internal_3 - lw $t0, 36($sp) + lw $t0, 48($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 40($sp) # y = result of function_assign + sw $v1, 52($sp) # y = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - while_start_8794497430733: + # Allocating NUll to internal_4 + sw $zero, 32($sp) # internal_4 = 0 + + while_start_8753943063860: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument y - lw $t0, 40($sp) + lw $t0, 52($sp) sw $t0, 4($sp) # Storing y # Argument num - lw $t0, 52($sp) + lw $t0, 64($sp) sw $t0, 0($sp) # Storing num # Calling function function_less_than_or_equal jal function_less_than_or_equal lw $ra, 8($sp) - sw $v1, 32($sp) # internal_4 = result of function_less_than_or_equal + sw $v1, 40($sp) # internal_5 = result of function_less_than_or_equal addi $sp, $sp, 12 # Freeing space for arguments - # If internal_4 then goto while_body_8794497430733 - lw $t0, 20($sp) # Loading the address of the condition + # If internal_5 then goto while_body_8753943063860 + lw $t0, 28($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8794497430733 + beq $t0, $t1, while_body_8753943063860 - # Jumping to while_end_8794497430733 - j while_end_8794497430733 + # Jumping to while_end_8753943063860 + j while_end_8753943063860 - while_body_8794497430733: + while_body_8753943063860: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument x - lw $t0, 48($sp) + lw $t0, 60($sp) sw $t0, 4($sp) # Storing x # Argument y - lw $t0, 40($sp) + lw $t0, 52($sp) sw $t0, 0($sp) # Storing y # Calling function function_mult jal function_mult lw $ra, 8($sp) - sw $v1, 28($sp) # internal_5 = result of function_mult + sw $v1, 36($sp) # internal_6 = result of function_mult addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -2157,17 +2462,17 @@ sw $ra, 8($sp) # Storing return address # Argument x - lw $t0, 48($sp) + lw $t0, 60($sp) sw $t0, 4($sp) # Storing x - # Argument internal_5 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_5 + # Argument internal_6 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_6 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 48($sp) # x = result of function_assign + sw $v1, 60($sp) # x = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -2180,24 +2485,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_6 = address of allocated object Int + sw $v0, 20($sp) # internal_7 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument y - lw $t0, 40($sp) + lw $t0, 52($sp) sw $t0, 4($sp) # Storing y - # Argument internal_6 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_6 + # Argument internal_7 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_7 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 20($sp) # internal_7 = result of function_add + sw $v1, 28($sp) # internal_8 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -2205,23 +2510,23 @@ sw $ra, 8($sp) # Storing return address # Argument y - lw $t0, 40($sp) + lw $t0, 52($sp) sw $t0, 4($sp) # Storing y - # Argument internal_7 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_7 + # Argument internal_8 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_8 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 40($sp) # y = result of function_assign + sw $v1, 52($sp) # y = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to while_start_8794497430733 - j while_start_8794497430733 + # Jumping to while_start_8753943063860 + j while_start_8753943063860 - while_end_8794497430733: + while_end_8753943063860: # Allocating E li $v0, 9 @@ -2230,45 +2535,69 @@ la $t0, type_E # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_8 = address of allocated object E + sw $v0, 12($sp) # internal_9 = address of allocated object E # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_8 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_8 + # Argument internal_9 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_9 # Calling function function___init___at_E jal function___init___at_E lw $ra, 4($sp) - sw $v1, 12($sp) # internal_8 = result of function___init___at_E + sw $v1, 20($sp) # internal_9 = result of function___init___at_E addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_11 = address of allocated object Int + + # Get method set_var of E + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_8 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_8 + # Argument internal_9 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_9 # Argument x - lw $t0, 48($sp) + lw $t0, 60($sp) sw $t0, 0($sp) # Storing x - # Calling function function_set_var_at_A - jal function_set_var_at_A + # Calling function internal_12 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_9 = result of function_set_var_at_A + sw $v1, 20($sp) # internal_10 = result of internal_12 addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 40 + addi $sp, $sp, 52 jr $ra @@ -2295,17 +2624,17 @@ # Set attribute var of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8794497371456 + beq $t1, $zero, object_set_attribute_8753942972323 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8794497371456 + beq $t6, $t5, int_set_attribute_8753942972323 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8794497371456 - j object_set_attribute_8794497371456 - int_set_attribute_8794497371456: + beq $t6, $t5, bool_set_attribute_8753942972323 + j object_set_attribute_8753942972323 + int_set_attribute_8753942972323: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2314,8 +2643,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.var = internal_0 - j end_set_attribute_8794497371456 - bool_set_attribute_8794497371456: + j end_set_attribute_8753942972323 + bool_set_attribute_8753942972323: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2324,10 +2653,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.var = internal_0 - j end_set_attribute_8794497371456 - object_set_attribute_8794497371456: + j end_set_attribute_8753942972323 + object_set_attribute_8753942972323: sw $t1, 8($t0) # self.var = internal_0 - end_set_attribute_8794497371456: + end_set_attribute_8753942972323: # Loading return value in $v1 lw $v1, 4($sp) @@ -2339,12 +2668,12 @@ function_method5_at_B: # Function parameters - # $ra = 24($sp) - # self = 20($sp) - # num = 16($sp) + # $ra = 32($sp) + # self = 28($sp) + # num = 24($sp) # Reserving space for local variables - addi $sp, $sp, -16 + addi $sp, $sp, -24 # Allocating Int 0 li $v0, 9 @@ -2356,24 +2685,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # x = address of allocated object Int + sw $v0, 20($sp) # x = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t0, 4($sp) # Storing num # Argument num - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t0, 0($sp) # Storing num # Calling function function_mult jal function_mult lw $ra, 8($sp) - sw $v1, 20($sp) # internal_1 = result of function_mult + sw $v1, 28($sp) # internal_1 = result of function_mult addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -2381,17 +2710,17 @@ sw $ra, 8($sp) # Storing return address # Argument x - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing x # Argument internal_1 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 24($sp) # x = result of function_assign + sw $v1, 32($sp) # x = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating E @@ -2401,45 +2730,69 @@ la $t0, type_E # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_2 = address of allocated object E + sw $v0, 12($sp) # internal_2 = address of allocated object E # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_2 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function___init___at_E jal function___init___at_E lw $ra, 4($sp) - sw $v1, 12($sp) # internal_2 = result of function___init___at_E + sw $v1, 20($sp) # internal_2 = result of function___init___at_E addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method set_var of E + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_2 - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 4($sp) # Storing internal_2 # Argument x - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 0($sp) # Storing x - # Calling function function_set_var_at_A - jal function_set_var_at_A + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_set_var_at_A + sw $v1, 20($sp) # internal_3 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 16 + addi $sp, $sp, 24 jr $ra @@ -2466,17 +2819,17 @@ # Set attribute var of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8794497371639 + beq $t1, $zero, object_set_attribute_8753942973046 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8794497371639 + beq $t6, $t5, int_set_attribute_8753942973046 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8794497371639 - j object_set_attribute_8794497371639 - int_set_attribute_8794497371639: + beq $t6, $t5, bool_set_attribute_8753942973046 + j object_set_attribute_8753942973046 + int_set_attribute_8753942973046: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2485,8 +2838,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.var = internal_0 - j end_set_attribute_8794497371639 - bool_set_attribute_8794497371639: + j end_set_attribute_8753942973046 + bool_set_attribute_8753942973046: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2495,10 +2848,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.var = internal_0 - j end_set_attribute_8794497371639 - object_set_attribute_8794497371639: + j end_set_attribute_8753942973046 + object_set_attribute_8753942973046: sw $t1, 8($t0) # self.var = internal_0 - end_set_attribute_8794497371639: + end_set_attribute_8753942973046: # Loading return value in $v1 lw $v1, 4($sp) @@ -2510,12 +2863,12 @@ function_method6_at_C: # Function parameters - # $ra = 32($sp) - # self = 28($sp) - # num = 24($sp) + # $ra = 40($sp) + # self = 36($sp) + # num = 32($sp) # Reserving space for local variables - addi $sp, $sp, -24 + addi $sp, $sp, -32 # Allocating Int 0 li $v0, 9 @@ -2527,7 +2880,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # x = address of allocated object Int + sw $v0, 28($sp) # x = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -2539,7 +2892,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_1 = address of allocated object Int + sw $v0, 24($sp) # internal_1 = address of allocated object Int # Allocating Int 4294967295 li $v0, 9 @@ -2551,7 +2904,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4294967295 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_2 = address of allocated object Int + sw $v0, 20($sp) # internal_2 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -2563,24 +2916,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_3 = address of allocated object Int + sw $v0, 16($sp) # internal_3 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 36($sp) + lw $t0, 44($sp) sw $t0, 4($sp) # Storing num # Argument internal_2 - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_xor jal function_xor lw $ra, 8($sp) - sw $v1, 20($sp) # internal_3 = result of function_xor + sw $v1, 28($sp) # internal_3 = result of function_xor addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -2588,17 +2941,17 @@ sw $ra, 8($sp) # Storing return address # Argument internal_3 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 4($sp) # Storing internal_3 # Argument internal_1 - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 20($sp) # internal_3 = result of function_add + sw $v1, 28($sp) # internal_3 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -2606,17 +2959,17 @@ sw $ra, 8($sp) # Storing return address # Argument x - lw $t0, 32($sp) + lw $t0, 40($sp) sw $t0, 4($sp) # Storing x # Argument internal_3 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 32($sp) # x = result of function_assign + sw $v1, 40($sp) # x = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating A @@ -2626,56 +2979,80 @@ la $t0, type_A # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_4 = address of allocated object A + sw $v0, 12($sp) # internal_4 = address of allocated object A # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_4 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_4 # Calling function function___init___at_A jal function___init___at_A lw $ra, 4($sp) - sw $v1, 12($sp) # internal_4 = result of function___init___at_A + sw $v1, 20($sp) # internal_4 = result of function___init___at_A addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Get method set_var of A + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_4 - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 4($sp) # Storing internal_4 # Argument x - lw $t0, 32($sp) + lw $t0, 40($sp) sw $t0, 0($sp) # Storing x - # Calling function function_set_var_at_A - jal function_set_var_at_A + # Calling function internal_7 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_5 = result of function_set_var_at_A + sw $v1, 20($sp) # internal_5 = result of internal_7 addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 24 + addi $sp, $sp, 32 jr $ra function_method5_at_C: # Function parameters - # $ra = 28($sp) - # self = 24($sp) - # num = 20($sp) + # $ra = 36($sp) + # self = 32($sp) + # num = 28($sp) # Reserving space for local variables - addi $sp, $sp, -20 + addi $sp, $sp, -28 # Allocating Int 0 li $v0, 9 @@ -2687,24 +3064,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # x = address of allocated object Int + sw $v0, 24($sp) # x = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 32($sp) + lw $t0, 40($sp) sw $t0, 4($sp) # Storing num # Argument num - lw $t0, 32($sp) + lw $t0, 40($sp) sw $t0, 0($sp) # Storing num # Calling function function_mult jal function_mult lw $ra, 8($sp) - sw $v1, 24($sp) # internal_1 = result of function_mult + sw $v1, 32($sp) # internal_1 = result of function_mult addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -2712,17 +3089,17 @@ sw $ra, 8($sp) # Storing return address # Argument internal_1 - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing internal_1 # Argument num - lw $t0, 32($sp) + lw $t0, 40($sp) sw $t0, 0($sp) # Storing num # Calling function function_mult jal function_mult lw $ra, 8($sp) - sw $v1, 20($sp) # internal_2 = result of function_mult + sw $v1, 28($sp) # internal_2 = result of function_mult addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -2730,17 +3107,17 @@ sw $ra, 8($sp) # Storing return address # Argument x - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t0, 4($sp) # Storing x # Argument internal_2 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 28($sp) # x = result of function_assign + sw $v1, 36($sp) # x = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating E @@ -2750,45 +3127,69 @@ la $t0, type_E # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_3 = address of allocated object E + sw $v0, 12($sp) # internal_3 = address of allocated object E # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_3 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function___init___at_E jal function___init___at_E lw $ra, 4($sp) - sw $v1, 12($sp) # internal_3 = result of function___init___at_E + sw $v1, 20($sp) # internal_3 = result of function___init___at_E addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Get method set_var of E + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_3 - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 4($sp) # Storing internal_3 # Argument x - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t0, 0($sp) # Storing x - # Calling function function_set_var_at_A - jal function_set_var_at_A + # Calling function internal_6 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_4 = result of function_set_var_at_A + sw $v1, 20($sp) # internal_4 = result of internal_6 addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 20 + addi $sp, $sp, 28 jr $ra @@ -2815,17 +3216,17 @@ # Set attribute var of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8794497373064 + beq $t1, $zero, object_set_attribute_8753942974519 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8794497373064 + beq $t6, $t5, int_set_attribute_8753942974519 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8794497373064 - j object_set_attribute_8794497373064 - int_set_attribute_8794497373064: + beq $t6, $t5, bool_set_attribute_8753942974519 + j object_set_attribute_8753942974519 + int_set_attribute_8753942974519: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2834,8 +3235,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.var = internal_0 - j end_set_attribute_8794497373064 - bool_set_attribute_8794497373064: + j end_set_attribute_8753942974519 + bool_set_attribute_8753942974519: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2844,10 +3245,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.var = internal_0 - j end_set_attribute_8794497373064 - object_set_attribute_8794497373064: + j end_set_attribute_8753942974519 + object_set_attribute_8753942974519: sw $t1, 8($t0) # self.var = internal_0 - end_set_attribute_8794497373064: + end_set_attribute_8753942974519: # Loading return value in $v1 lw $v1, 4($sp) @@ -2859,29 +3260,29 @@ function_method7_at_D: # Function parameters - # $ra = 116($sp) - # self = 112($sp) - # num = 108($sp) + # $ra = 132($sp) + # self = 128($sp) + # num = 124($sp) # Reserving space for local variables - addi $sp, $sp, -108 + addi $sp, $sp, -124 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument x - lw $t0, 116($sp) + lw $t0, 132($sp) sw $t0, 4($sp) # Storing x # Argument num - lw $t0, 120($sp) + lw $t0, 136($sp) sw $t0, 0($sp) # Storing num # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 116($sp) # x = result of function_assign + sw $v1, 132($sp) # x = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bool 0 @@ -2894,7 +3295,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 96($sp) # internal_2 = address of allocated object Int + sw $v0, 112($sp) # internal_2 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -2906,40 +3307,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 92($sp) # internal_3 = address of allocated object Int + sw $v0, 108($sp) # internal_3 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument x - lw $t0, 116($sp) + lw $t0, 132($sp) sw $t0, 4($sp) # Storing x # Argument internal_3 - lw $t0, 104($sp) + lw $t0, 120($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 100($sp) # internal_4 = result of function_less_than + sw $v1, 116($sp) # internal_4 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments # internal_2 = internal_4 - lw $t0, 88($sp) - sw $t0, 96($sp) + lw $t0, 104($sp) + sw $t0, 112($sp) - # If internal_2 then goto then_8794497431887 - lw $t0, 96($sp) # Loading the address of the condition + # If internal_2 then goto then_8753943064498 + lw $t0, 112($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497431887 + beq $t0, $t1, then_8753943064498 - # Jumping to else_8794497431887 - j else_8794497431887 + # Jumping to else_8753943064498 + j else_8753943064498 - then_8794497431887: + then_8753943064498: # Allocating Int 1 li $v0, 9 @@ -2951,7 +3352,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 84($sp) # internal_5 = address of allocated object Int + sw $v0, 100($sp) # internal_5 = address of allocated object Int # Allocating Int 4294967295 li $v0, 9 @@ -2963,7 +3364,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4294967295 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # internal_6 = address of allocated object Int + sw $v0, 96($sp) # internal_6 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -2975,24 +3376,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 76($sp) # internal_7 = address of allocated object Int + sw $v0, 92($sp) # internal_7 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument x - lw $t0, 116($sp) + lw $t0, 132($sp) sw $t0, 4($sp) # Storing x # Argument internal_6 - lw $t0, 92($sp) + lw $t0, 108($sp) sw $t0, 0($sp) # Storing internal_6 # Calling function function_xor jal function_xor lw $ra, 8($sp) - sw $v1, 88($sp) # internal_7 = result of function_xor + sw $v1, 104($sp) # internal_7 = result of function_xor addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -3000,45 +3401,69 @@ sw $ra, 8($sp) # Storing return address # Argument internal_7 - lw $t0, 88($sp) + lw $t0, 104($sp) sw $t0, 4($sp) # Storing internal_7 # Argument internal_5 - lw $t0, 96($sp) + lw $t0, 112($sp) sw $t0, 0($sp) # Storing internal_5 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 88($sp) # internal_7 = result of function_add + sw $v1, 104($sp) # internal_7 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_9 = address of allocated object Int + + # Get method method7 of D + lw $t0, 128($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 84($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 80($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 124($sp) + lw $t0, 140($sp) sw $t0, 4($sp) # Storing self # Argument internal_7 - lw $t0, 88($sp) + lw $t0, 104($sp) sw $t0, 0($sp) # Storing internal_7 - # Calling function function_method7_at_D - jal function_method7_at_D + # Calling function internal_10 + lw $t0, 92($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 84($sp) # internal_8 = result of function_method7_at_D + sw $v1, 100($sp) # internal_8 = result of internal_10 addi $sp, $sp, 12 # Freeing space for arguments # internal_1 = internal_8 - lw $t0, 72($sp) - sw $t0, 100($sp) + lw $t0, 88($sp) + sw $t0, 116($sp) - # Jumping to endif_8794497431887 - j endif_8794497431887 + # Jumping to endif_8753943064498 + j endif_8753943064498 - else_8794497431887: + else_8753943064498: # Allocating Bool 0 li $v0, 9 @@ -3050,7 +3475,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 64($sp) # internal_10 = address of allocated object Int + sw $v0, 72($sp) # internal_12 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -3062,40 +3487,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_11 = address of allocated object Int + sw $v0, 68($sp) # internal_13 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_11 - lw $t0, 72($sp) - sw $t0, 4($sp) # Storing internal_11 + # Argument internal_13 + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing internal_13 # Argument x - lw $t0, 116($sp) + lw $t0, 132($sp) sw $t0, 0($sp) # Storing x # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 68($sp) # internal_12 = result of function_equal + sw $v1, 76($sp) # internal_14 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_10 = internal_12 - lw $t0, 56($sp) - sw $t0, 64($sp) + # internal_12 = internal_14 + lw $t0, 64($sp) + sw $t0, 72($sp) - # If internal_10 then goto then_8794497431866 - lw $t0, 64($sp) # Loading the address of the condition + # If internal_12 then goto then_8753943064477 + lw $t0, 72($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497431866 + beq $t0, $t1, then_8753943064477 - # Jumping to else_8794497431866 - j else_8794497431866 + # Jumping to else_8753943064477 + j else_8753943064477 - then_8794497431866: + then_8753943064477: # Allocating Bool 1 li $v0, 9 @@ -3107,16 +3532,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 52($sp) # internal_13 = address of allocated object Int + sw $v0, 60($sp) # internal_15 = address of allocated object Int - # internal_9 = internal_13 - lw $t0, 52($sp) - sw $t0, 68($sp) + # internal_11 = internal_15 + lw $t0, 60($sp) + sw $t0, 76($sp) - # Jumping to endif_8794497431866 - j endif_8794497431866 + # Jumping to endif_8753943064477 + j endif_8753943064477 - else_8794497431866: + else_8753943064477: # Allocating Bool 0 li $v0, 9 @@ -3128,7 +3553,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_15 = address of allocated object Int + sw $v0, 52($sp) # internal_17 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -3140,40 +3565,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_16 = address of allocated object Int + sw $v0, 48($sp) # internal_18 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_16 - lw $t0, 52($sp) - sw $t0, 4($sp) # Storing internal_16 + # Argument internal_18 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing internal_18 # Argument x - lw $t0, 116($sp) + lw $t0, 132($sp) sw $t0, 0($sp) # Storing x # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 48($sp) # internal_17 = result of function_equal + sw $v1, 56($sp) # internal_19 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_15 = internal_17 - lw $t0, 36($sp) - sw $t0, 44($sp) + # internal_17 = internal_19 + lw $t0, 44($sp) + sw $t0, 52($sp) - # If internal_15 then goto then_8794497431869 - lw $t0, 44($sp) # Loading the address of the condition + # If internal_17 then goto then_8753943064480 + lw $t0, 52($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497431869 + beq $t0, $t1, then_8753943064480 - # Jumping to else_8794497431869 - j else_8794497431869 + # Jumping to else_8753943064480 + j else_8753943064480 - then_8794497431869: + then_8753943064480: # Allocating Bool 0 li $v0, 9 @@ -3185,16 +3610,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_18 = address of allocated object Int + sw $v0, 40($sp) # internal_20 = address of allocated object Int - # internal_14 = internal_18 - lw $t0, 32($sp) - sw $t0, 48($sp) + # internal_16 = internal_20 + lw $t0, 40($sp) + sw $t0, 56($sp) - # Jumping to endif_8794497431869 - j endif_8794497431869 + # Jumping to endif_8753943064480 + j endif_8753943064480 - else_8794497431869: + else_8753943064480: # Allocating Bool 0 li $v0, 9 @@ -3206,7 +3631,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_20 = address of allocated object Int + sw $v0, 32($sp) # internal_22 = address of allocated object Int # Allocating Int 2 li $v0, 9 @@ -3218,40 +3643,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_21 = address of allocated object Int + sw $v0, 28($sp) # internal_23 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_21 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_21 + # Argument internal_23 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_23 # Argument x - lw $t0, 116($sp) + lw $t0, 132($sp) sw $t0, 0($sp) # Storing x # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 28($sp) # internal_22 = result of function_equal + sw $v1, 36($sp) # internal_24 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_20 = internal_22 - lw $t0, 16($sp) - sw $t0, 24($sp) + # internal_22 = internal_24 + lw $t0, 24($sp) + sw $t0, 32($sp) - # If internal_20 then goto then_8794497431875 - lw $t0, 24($sp) # Loading the address of the condition + # If internal_22 then goto then_8753943064486 + lw $t0, 32($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497431875 + beq $t0, $t1, then_8753943064486 - # Jumping to else_8794497431875 - j else_8794497431875 + # Jumping to else_8753943064486 + j else_8753943064486 - then_8794497431875: + then_8753943064486: # Allocating Bool 0 li $v0, 9 @@ -3263,16 +3688,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_23 = address of allocated object Int + sw $v0, 20($sp) # internal_25 = address of allocated object Int - # internal_19 = internal_23 - lw $t0, 12($sp) - sw $t0, 28($sp) + # internal_21 = internal_25 + lw $t0, 20($sp) + sw $t0, 36($sp) - # Jumping to endif_8794497431875 - j endif_8794497431875 + # Jumping to endif_8753943064486 + j endif_8753943064486 - else_8794497431875: + else_8753943064486: # Allocating Int 3 li $v0, 9 @@ -3284,85 +3709,109 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_24 = address of allocated object Int + sw $v0, 16($sp) # internal_26 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument x - lw $t0, 116($sp) + lw $t0, 132($sp) sw $t0, 4($sp) # Storing x - # Argument internal_24 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_24 + # Argument internal_26 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_26 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 16($sp) # internal_25 = result of function_sub + sw $v1, 24($sp) # internal_27 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_29 = address of allocated object Int + + # Get method method7 of D + lw $t0, 128($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 124($sp) + lw $t0, 140($sp) sw $t0, 4($sp) # Storing self - # Argument internal_25 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_25 + # Argument internal_27 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_27 - # Calling function function_method7_at_D - jal function_method7_at_D + # Calling function internal_30 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_26 = result of function_method7_at_D + sw $v1, 20($sp) # internal_28 = result of internal_30 addi $sp, $sp, 12 # Freeing space for arguments - # internal_19 = internal_26 - lw $t0, 0($sp) - sw $t0, 28($sp) + # internal_21 = internal_28 + lw $t0, 8($sp) + sw $t0, 36($sp) - # Jumping to endif_8794497431875 - j endif_8794497431875 + # Jumping to endif_8753943064486 + j endif_8753943064486 - endif_8794497431875: + endif_8753943064486: - # internal_14 = internal_19 - lw $t0, 28($sp) - sw $t0, 48($sp) + # internal_16 = internal_21 + lw $t0, 36($sp) + sw $t0, 56($sp) - # Jumping to endif_8794497431869 - j endif_8794497431869 + # Jumping to endif_8753943064480 + j endif_8753943064480 - endif_8794497431869: + endif_8753943064480: - # internal_9 = internal_14 - lw $t0, 48($sp) - sw $t0, 68($sp) + # internal_11 = internal_16 + lw $t0, 56($sp) + sw $t0, 76($sp) - # Jumping to endif_8794497431866 - j endif_8794497431866 + # Jumping to endif_8753943064477 + j endif_8753943064477 - endif_8794497431866: + endif_8753943064477: - # internal_1 = internal_9 - lw $t0, 68($sp) - sw $t0, 100($sp) + # internal_1 = internal_11 + lw $t0, 76($sp) + sw $t0, 116($sp) - # Jumping to endif_8794497431887 - j endif_8794497431887 + # Jumping to endif_8753943064498 + j endif_8753943064498 - endif_8794497431887: + endif_8753943064498: # Loading return value in $v1 - lw $v1, 100($sp) + lw $v1, 116($sp) # Freeing space for local variables - addi $sp, $sp, 108 + addi $sp, $sp, 124 jr $ra @@ -3389,17 +3838,17 @@ # Set attribute var of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8794497374925 + beq $t1, $zero, object_set_attribute_8753942976428 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8794497374925 + beq $t6, $t5, int_set_attribute_8753942976428 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8794497374925 - j object_set_attribute_8794497374925 - int_set_attribute_8794497374925: + beq $t6, $t5, bool_set_attribute_8753942976428 + j object_set_attribute_8753942976428 + int_set_attribute_8753942976428: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3408,8 +3857,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.var = internal_0 - j end_set_attribute_8794497374925 - bool_set_attribute_8794497374925: + j end_set_attribute_8753942976428 + bool_set_attribute_8753942976428: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3418,10 +3867,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.var = internal_0 - j end_set_attribute_8794497374925 - object_set_attribute_8794497374925: + j end_set_attribute_8753942976428 + object_set_attribute_8753942976428: sw $t1, 8($t0) # self.var = internal_0 - end_set_attribute_8794497374925: + end_set_attribute_8753942976428: # Loading return value in $v1 lw $v1, 4($sp) @@ -3433,12 +3882,12 @@ function_method6_at_E: # Function parameters - # $ra = 28($sp) - # self = 24($sp) - # num = 20($sp) + # $ra = 36($sp) + # self = 32($sp) + # num = 28($sp) # Reserving space for local variables - addi $sp, $sp, -20 + addi $sp, $sp, -28 # Allocating Int 0 li $v0, 9 @@ -3450,7 +3899,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # x = address of allocated object Int + sw $v0, 24($sp) # x = address of allocated object Int # Allocating Int 8 li $v0, 9 @@ -3462,24 +3911,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 8 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_1 = address of allocated object Int + sw $v0, 20($sp) # internal_1 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 32($sp) + lw $t0, 40($sp) sw $t0, 4($sp) # Storing num # Argument internal_1 - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function_div jal function_div lw $ra, 8($sp) - sw $v1, 20($sp) # internal_2 = result of function_div + sw $v1, 28($sp) # internal_2 = result of function_div addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -3487,17 +3936,17 @@ sw $ra, 8($sp) # Storing return address # Argument x - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t0, 4($sp) # Storing x # Argument internal_2 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 28($sp) # x = result of function_assign + sw $v1, 36($sp) # x = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating A @@ -3507,45 +3956,69 @@ la $t0, type_A # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_3 = address of allocated object A + sw $v0, 12($sp) # internal_3 = address of allocated object A # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_3 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function___init___at_A jal function___init___at_A lw $ra, 4($sp) - sw $v1, 12($sp) # internal_3 = result of function___init___at_A + sw $v1, 20($sp) # internal_3 = result of function___init___at_A addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Get method set_var of A + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_3 - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 4($sp) # Storing internal_3 # Argument x - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t0, 0($sp) # Storing x - # Calling function function_set_var_at_A - jal function_set_var_at_A + # Calling function internal_6 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_4 = result of function_set_var_at_A + sw $v1, 20($sp) # internal_4 = result of internal_6 addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 20 + addi $sp, $sp, 28 jr $ra @@ -3561,12 +4034,12 @@ function_c2i_at_A2I: # Function parameters - # $ra = 216($sp) - # self = 212($sp) - # char = 208($sp) + # $ra = 224($sp) + # self = 220($sp) + # char = 216($sp) # Reserving space for local variables - addi $sp, $sp, -208 + addi $sp, $sp, -216 # Allocating Bool 0 li $v0, 9 @@ -3578,7 +4051,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 200($sp) # internal_1 = address of allocated object Int + sw $v0, 208($sp) # internal_1 = address of allocated object Int # Allocating String li $v0, 9 @@ -3596,40 +4069,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 196($sp) # internal_2 = "0" + sw $v0, 204($sp) # internal_2 = "0" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_2 - lw $t0, 208($sp) + lw $t0, 216($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 204($sp) # internal_3 = result of function_equal + sw $v1, 212($sp) # internal_3 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_1 = internal_3 - lw $t0, 192($sp) - sw $t0, 200($sp) + lw $t0, 200($sp) + sw $t0, 208($sp) - # If internal_1 then goto then_8794497432537 - lw $t0, 200($sp) # Loading the address of the condition + # If internal_1 then goto then_8753943065664 + lw $t0, 208($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497432537 + beq $t0, $t1, then_8753943065664 - # Jumping to else_8794497432537 - j else_8794497432537 + # Jumping to else_8753943065664 + j else_8753943065664 - then_8794497432537: + then_8753943065664: # Allocating Int 0 li $v0, 9 @@ -3641,16 +4114,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 188($sp) # internal_4 = address of allocated object Int + sw $v0, 196($sp) # internal_4 = address of allocated object Int # internal_0 = internal_4 - lw $t0, 188($sp) - sw $t0, 204($sp) + lw $t0, 196($sp) + sw $t0, 212($sp) - # Jumping to endif_8794497432537 - j endif_8794497432537 + # Jumping to endif_8753943065664 + j endif_8753943065664 - else_8794497432537: + else_8753943065664: # Allocating Bool 0 li $v0, 9 @@ -3662,7 +4135,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 180($sp) # internal_6 = address of allocated object Int + sw $v0, 188($sp) # internal_6 = address of allocated object Int # Allocating String li $v0, 9 @@ -3680,40 +4153,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 176($sp) # internal_7 = "1" + sw $v0, 184($sp) # internal_7 = "1" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_7 - lw $t0, 188($sp) + lw $t0, 196($sp) sw $t0, 0($sp) # Storing internal_7 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 184($sp) # internal_8 = result of function_equal + sw $v1, 192($sp) # internal_8 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_6 = internal_8 - lw $t0, 172($sp) - sw $t0, 180($sp) + lw $t0, 180($sp) + sw $t0, 188($sp) - # If internal_6 then goto then_8794497432531 - lw $t0, 180($sp) # Loading the address of the condition + # If internal_6 then goto then_8753943065658 + lw $t0, 188($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497432531 + beq $t0, $t1, then_8753943065658 - # Jumping to else_8794497432531 - j else_8794497432531 + # Jumping to else_8753943065658 + j else_8753943065658 - then_8794497432531: + then_8753943065658: # Allocating Int 1 li $v0, 9 @@ -3725,16 +4198,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 168($sp) # internal_9 = address of allocated object Int + sw $v0, 176($sp) # internal_9 = address of allocated object Int # internal_5 = internal_9 - lw $t0, 168($sp) - sw $t0, 184($sp) + lw $t0, 176($sp) + sw $t0, 192($sp) - # Jumping to endif_8794497432531 - j endif_8794497432531 + # Jumping to endif_8753943065658 + j endif_8753943065658 - else_8794497432531: + else_8753943065658: # Allocating Bool 0 li $v0, 9 @@ -3746,7 +4219,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 160($sp) # internal_11 = address of allocated object Int + sw $v0, 168($sp) # internal_11 = address of allocated object Int # Allocating String li $v0, 9 @@ -3764,40 +4237,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 156($sp) # internal_12 = "2" + sw $v0, 164($sp) # internal_12 = "2" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_12 - lw $t0, 168($sp) + lw $t0, 176($sp) sw $t0, 0($sp) # Storing internal_12 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 164($sp) # internal_13 = result of function_equal + sw $v1, 172($sp) # internal_13 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_11 = internal_13 - lw $t0, 152($sp) - sw $t0, 160($sp) + lw $t0, 160($sp) + sw $t0, 168($sp) - # If internal_11 then goto then_8794497432525 - lw $t0, 160($sp) # Loading the address of the condition + # If internal_11 then goto then_8753943065652 + lw $t0, 168($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497432525 + beq $t0, $t1, then_8753943065652 - # Jumping to else_8794497432525 - j else_8794497432525 + # Jumping to else_8753943065652 + j else_8753943065652 - then_8794497432525: + then_8753943065652: # Allocating Int 2 li $v0, 9 @@ -3809,16 +4282,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 148($sp) # internal_14 = address of allocated object Int + sw $v0, 156($sp) # internal_14 = address of allocated object Int # internal_10 = internal_14 - lw $t0, 148($sp) - sw $t0, 164($sp) + lw $t0, 156($sp) + sw $t0, 172($sp) - # Jumping to endif_8794497432525 - j endif_8794497432525 + # Jumping to endif_8753943065652 + j endif_8753943065652 - else_8794497432525: + else_8753943065652: # Allocating Bool 0 li $v0, 9 @@ -3830,7 +4303,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 140($sp) # internal_16 = address of allocated object Int + sw $v0, 148($sp) # internal_16 = address of allocated object Int # Allocating String li $v0, 9 @@ -3848,40 +4321,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 136($sp) # internal_17 = "3" + sw $v0, 144($sp) # internal_17 = "3" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_17 - lw $t0, 148($sp) + lw $t0, 156($sp) sw $t0, 0($sp) # Storing internal_17 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 144($sp) # internal_18 = result of function_equal + sw $v1, 152($sp) # internal_18 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_16 = internal_18 - lw $t0, 132($sp) - sw $t0, 140($sp) + lw $t0, 140($sp) + sw $t0, 148($sp) - # If internal_16 then goto then_8794497432519 - lw $t0, 140($sp) # Loading the address of the condition + # If internal_16 then goto then_8753943065646 + lw $t0, 148($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497432519 + beq $t0, $t1, then_8753943065646 - # Jumping to else_8794497432519 - j else_8794497432519 + # Jumping to else_8753943065646 + j else_8753943065646 - then_8794497432519: + then_8753943065646: # Allocating Int 3 li $v0, 9 @@ -3893,16 +4366,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 128($sp) # internal_19 = address of allocated object Int + sw $v0, 136($sp) # internal_19 = address of allocated object Int # internal_15 = internal_19 - lw $t0, 128($sp) - sw $t0, 144($sp) + lw $t0, 136($sp) + sw $t0, 152($sp) - # Jumping to endif_8794497432519 - j endif_8794497432519 + # Jumping to endif_8753943065646 + j endif_8753943065646 - else_8794497432519: + else_8753943065646: # Allocating Bool 0 li $v0, 9 @@ -3914,7 +4387,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 120($sp) # internal_21 = address of allocated object Int + sw $v0, 128($sp) # internal_21 = address of allocated object Int # Allocating String li $v0, 9 @@ -3932,40 +4405,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 116($sp) # internal_22 = "4" + sw $v0, 124($sp) # internal_22 = "4" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_22 - lw $t0, 128($sp) + lw $t0, 136($sp) sw $t0, 0($sp) # Storing internal_22 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 124($sp) # internal_23 = result of function_equal + sw $v1, 132($sp) # internal_23 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_21 = internal_23 - lw $t0, 112($sp) - sw $t0, 120($sp) + lw $t0, 120($sp) + sw $t0, 128($sp) - # If internal_21 then goto then_8794497432513 - lw $t0, 120($sp) # Loading the address of the condition + # If internal_21 then goto then_8753943065640 + lw $t0, 128($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497432513 + beq $t0, $t1, then_8753943065640 - # Jumping to else_8794497432513 - j else_8794497432513 + # Jumping to else_8753943065640 + j else_8753943065640 - then_8794497432513: + then_8753943065640: # Allocating Int 4 li $v0, 9 @@ -3977,16 +4450,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 108($sp) # internal_24 = address of allocated object Int + sw $v0, 116($sp) # internal_24 = address of allocated object Int # internal_20 = internal_24 - lw $t0, 108($sp) - sw $t0, 124($sp) + lw $t0, 116($sp) + sw $t0, 132($sp) - # Jumping to endif_8794497432513 - j endif_8794497432513 + # Jumping to endif_8753943065640 + j endif_8753943065640 - else_8794497432513: + else_8753943065640: # Allocating Bool 0 li $v0, 9 @@ -3998,7 +4471,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 100($sp) # internal_26 = address of allocated object Int + sw $v0, 108($sp) # internal_26 = address of allocated object Int # Allocating String li $v0, 9 @@ -4016,40 +4489,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 96($sp) # internal_27 = "5" + sw $v0, 104($sp) # internal_27 = "5" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_27 - lw $t0, 108($sp) + lw $t0, 116($sp) sw $t0, 0($sp) # Storing internal_27 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 104($sp) # internal_28 = result of function_equal + sw $v1, 112($sp) # internal_28 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_26 = internal_28 - lw $t0, 92($sp) - sw $t0, 100($sp) + lw $t0, 100($sp) + sw $t0, 108($sp) - # If internal_26 then goto then_8794497432507 - lw $t0, 100($sp) # Loading the address of the condition + # If internal_26 then goto then_8753943065634 + lw $t0, 108($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497432507 + beq $t0, $t1, then_8753943065634 - # Jumping to else_8794497432507 - j else_8794497432507 + # Jumping to else_8753943065634 + j else_8753943065634 - then_8794497432507: + then_8753943065634: # Allocating Int 5 li $v0, 9 @@ -4061,16 +4534,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 5 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 88($sp) # internal_29 = address of allocated object Int + sw $v0, 96($sp) # internal_29 = address of allocated object Int # internal_25 = internal_29 - lw $t0, 88($sp) - sw $t0, 104($sp) + lw $t0, 96($sp) + sw $t0, 112($sp) - # Jumping to endif_8794497432507 - j endif_8794497432507 + # Jumping to endif_8753943065634 + j endif_8753943065634 - else_8794497432507: + else_8753943065634: # Allocating Bool 0 li $v0, 9 @@ -4082,7 +4555,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # internal_31 = address of allocated object Int + sw $v0, 88($sp) # internal_31 = address of allocated object Int # Allocating String li $v0, 9 @@ -4100,40 +4573,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 76($sp) # internal_32 = "6" + sw $v0, 84($sp) # internal_32 = "6" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_32 - lw $t0, 88($sp) + lw $t0, 96($sp) sw $t0, 0($sp) # Storing internal_32 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 84($sp) # internal_33 = result of function_equal + sw $v1, 92($sp) # internal_33 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_31 = internal_33 - lw $t0, 72($sp) - sw $t0, 80($sp) + lw $t0, 80($sp) + sw $t0, 88($sp) - # If internal_31 then goto then_8794497432501 - lw $t0, 80($sp) # Loading the address of the condition + # If internal_31 then goto then_8753943065628 + lw $t0, 88($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497432501 + beq $t0, $t1, then_8753943065628 - # Jumping to else_8794497432501 - j else_8794497432501 + # Jumping to else_8753943065628 + j else_8753943065628 - then_8794497432501: + then_8753943065628: # Allocating Int 6 li $v0, 9 @@ -4145,16 +4618,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 6 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 68($sp) # internal_34 = address of allocated object Int + sw $v0, 76($sp) # internal_34 = address of allocated object Int # internal_30 = internal_34 - lw $t0, 68($sp) - sw $t0, 84($sp) + lw $t0, 76($sp) + sw $t0, 92($sp) - # Jumping to endif_8794497432501 - j endif_8794497432501 + # Jumping to endif_8753943065628 + j endif_8753943065628 - else_8794497432501: + else_8753943065628: # Allocating Bool 0 li $v0, 9 @@ -4166,7 +4639,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_36 = address of allocated object Int + sw $v0, 68($sp) # internal_36 = address of allocated object Int # Allocating String li $v0, 9 @@ -4184,40 +4657,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 56($sp) # internal_37 = "7" + sw $v0, 64($sp) # internal_37 = "7" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_37 - lw $t0, 68($sp) + lw $t0, 76($sp) sw $t0, 0($sp) # Storing internal_37 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 64($sp) # internal_38 = result of function_equal + sw $v1, 72($sp) # internal_38 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_36 = internal_38 - lw $t0, 52($sp) - sw $t0, 60($sp) + lw $t0, 60($sp) + sw $t0, 68($sp) - # If internal_36 then goto then_8794497432495 - lw $t0, 60($sp) # Loading the address of the condition + # If internal_36 then goto then_8753943065622 + lw $t0, 68($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497432495 + beq $t0, $t1, then_8753943065622 - # Jumping to else_8794497432495 - j else_8794497432495 + # Jumping to else_8753943065622 + j else_8753943065622 - then_8794497432495: + then_8753943065622: # Allocating Int 7 li $v0, 9 @@ -4229,16 +4702,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 7 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_39 = address of allocated object Int + sw $v0, 56($sp) # internal_39 = address of allocated object Int # internal_35 = internal_39 - lw $t0, 48($sp) - sw $t0, 64($sp) + lw $t0, 56($sp) + sw $t0, 72($sp) - # Jumping to endif_8794497432495 - j endif_8794497432495 + # Jumping to endif_8753943065622 + j endif_8753943065622 - else_8794497432495: + else_8753943065622: # Allocating Bool 0 li $v0, 9 @@ -4250,7 +4723,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_41 = address of allocated object Int + sw $v0, 48($sp) # internal_41 = address of allocated object Int # Allocating String li $v0, 9 @@ -4268,40 +4741,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 36($sp) # internal_42 = "8" + sw $v0, 44($sp) # internal_42 = "8" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_42 - lw $t0, 48($sp) + lw $t0, 56($sp) sw $t0, 0($sp) # Storing internal_42 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 44($sp) # internal_43 = result of function_equal + sw $v1, 52($sp) # internal_43 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_41 = internal_43 - lw $t0, 32($sp) - sw $t0, 40($sp) + lw $t0, 40($sp) + sw $t0, 48($sp) - # If internal_41 then goto then_8794497432489 - lw $t0, 40($sp) # Loading the address of the condition + # If internal_41 then goto then_8753943065616 + lw $t0, 48($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497432489 + beq $t0, $t1, then_8753943065616 - # Jumping to else_8794497432489 - j else_8794497432489 + # Jumping to else_8753943065616 + j else_8753943065616 - then_8794497432489: + then_8753943065616: # Allocating Int 8 li $v0, 9 @@ -4313,16 +4786,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 8 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_44 = address of allocated object Int + sw $v0, 36($sp) # internal_44 = address of allocated object Int # internal_40 = internal_44 - lw $t0, 28($sp) - sw $t0, 44($sp) + lw $t0, 36($sp) + sw $t0, 52($sp) - # Jumping to endif_8794497432489 - j endif_8794497432489 + # Jumping to endif_8753943065616 + j endif_8753943065616 - else_8794497432489: + else_8753943065616: # Allocating Bool 0 li $v0, 9 @@ -4334,7 +4807,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_46 = address of allocated object Int + sw $v0, 28($sp) # internal_46 = address of allocated object Int # Allocating String li $v0, 9 @@ -4352,40 +4825,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 16($sp) # internal_47 = "9" + sw $v0, 24($sp) # internal_47 = "9" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_47 - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t0, 0($sp) # Storing internal_47 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 24($sp) # internal_48 = result of function_equal + sw $v1, 32($sp) # internal_48 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_46 = internal_48 - lw $t0, 12($sp) - sw $t0, 20($sp) + lw $t0, 20($sp) + sw $t0, 28($sp) - # If internal_46 then goto then_8794497432468 - lw $t0, 20($sp) # Loading the address of the condition + # If internal_46 then goto then_8753943065607 + lw $t0, 28($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497432468 + beq $t0, $t1, then_8753943065607 - # Jumping to else_8794497432468 - j else_8794497432468 + # Jumping to else_8753943065607 + j else_8753943065607 - then_8794497432468: + then_8753943065607: # Allocating Int 9 li $v0, 9 @@ -4397,29 +4870,53 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 9 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_49 = address of allocated object Int + sw $v0, 16($sp) # internal_49 = address of allocated object Int # internal_45 = internal_49 - lw $t0, 8($sp) - sw $t0, 24($sp) + lw $t0, 16($sp) + sw $t0, 32($sp) + + # Jumping to endif_8753943065607 + j endif_8753943065607 + + else_8753943065607: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Jumping to endif_8794497432468 - j endif_8794497432468 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_51 = address of allocated object Int - else_8794497432468: + # Get method abort of A2I + lw $t0, 220($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 0($sp) # Storing self - # Calling function function_abort_at_Object - jal function_abort_at_Object + # Calling function internal_52 + lw $t0, 12($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 12($sp) # internal_50 = result of function_abort_at_Object + sw $v1, 20($sp) # internal_50 = result of internal_52 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 0 @@ -4432,114 +4929,114 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_51 = address of allocated object Int + sw $v0, 0($sp) # internal_53 = address of allocated object Int - # internal_45 = internal_51 + # internal_45 = internal_53 lw $t0, 0($sp) - sw $t0, 24($sp) + sw $t0, 32($sp) - # Jumping to endif_8794497432468 - j endif_8794497432468 + # Jumping to endif_8753943065607 + j endif_8753943065607 - endif_8794497432468: + endif_8753943065607: # internal_40 = internal_45 - lw $t0, 24($sp) - sw $t0, 44($sp) + lw $t0, 32($sp) + sw $t0, 52($sp) - # Jumping to endif_8794497432489 - j endif_8794497432489 + # Jumping to endif_8753943065616 + j endif_8753943065616 - endif_8794497432489: + endif_8753943065616: # internal_35 = internal_40 - lw $t0, 44($sp) - sw $t0, 64($sp) + lw $t0, 52($sp) + sw $t0, 72($sp) - # Jumping to endif_8794497432495 - j endif_8794497432495 + # Jumping to endif_8753943065622 + j endif_8753943065622 - endif_8794497432495: + endif_8753943065622: # internal_30 = internal_35 - lw $t0, 64($sp) - sw $t0, 84($sp) + lw $t0, 72($sp) + sw $t0, 92($sp) - # Jumping to endif_8794497432501 - j endif_8794497432501 + # Jumping to endif_8753943065628 + j endif_8753943065628 - endif_8794497432501: + endif_8753943065628: # internal_25 = internal_30 - lw $t0, 84($sp) - sw $t0, 104($sp) + lw $t0, 92($sp) + sw $t0, 112($sp) - # Jumping to endif_8794497432507 - j endif_8794497432507 + # Jumping to endif_8753943065634 + j endif_8753943065634 - endif_8794497432507: + endif_8753943065634: # internal_20 = internal_25 - lw $t0, 104($sp) - sw $t0, 124($sp) + lw $t0, 112($sp) + sw $t0, 132($sp) - # Jumping to endif_8794497432513 - j endif_8794497432513 + # Jumping to endif_8753943065640 + j endif_8753943065640 - endif_8794497432513: + endif_8753943065640: # internal_15 = internal_20 - lw $t0, 124($sp) - sw $t0, 144($sp) + lw $t0, 132($sp) + sw $t0, 152($sp) - # Jumping to endif_8794497432519 - j endif_8794497432519 + # Jumping to endif_8753943065646 + j endif_8753943065646 - endif_8794497432519: + endif_8753943065646: # internal_10 = internal_15 - lw $t0, 144($sp) - sw $t0, 164($sp) + lw $t0, 152($sp) + sw $t0, 172($sp) - # Jumping to endif_8794497432525 - j endif_8794497432525 + # Jumping to endif_8753943065652 + j endif_8753943065652 - endif_8794497432525: + endif_8753943065652: # internal_5 = internal_10 - lw $t0, 164($sp) - sw $t0, 184($sp) + lw $t0, 172($sp) + sw $t0, 192($sp) - # Jumping to endif_8794497432531 - j endif_8794497432531 + # Jumping to endif_8753943065658 + j endif_8753943065658 - endif_8794497432531: + endif_8753943065658: # internal_0 = internal_5 - lw $t0, 184($sp) - sw $t0, 204($sp) + lw $t0, 192($sp) + sw $t0, 212($sp) - # Jumping to endif_8794497432537 - j endif_8794497432537 + # Jumping to endif_8753943065664 + j endif_8753943065664 - endif_8794497432537: + endif_8753943065664: # Loading return value in $v1 - lw $v1, 204($sp) + lw $v1, 212($sp) # Freeing space for local variables - addi $sp, $sp, 208 + addi $sp, $sp, 216 jr $ra function_i2c_at_A2I: # Function parameters - # $ra = 216($sp) - # self = 212($sp) - # i = 208($sp) + # $ra = 224($sp) + # self = 220($sp) + # i = 216($sp) # Reserving space for local variables - addi $sp, $sp, -208 + addi $sp, $sp, -216 # Allocating Bool 0 li $v0, 9 @@ -4551,7 +5048,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 200($sp) # internal_1 = address of allocated object Int + sw $v0, 208($sp) # internal_1 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -4563,40 +5060,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 196($sp) # internal_2 = address of allocated object Int + sw $v0, 204($sp) # internal_2 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing i # Argument internal_2 - lw $t0, 208($sp) + lw $t0, 216($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 204($sp) # internal_3 = result of function_equal + sw $v1, 212($sp) # internal_3 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_1 = internal_3 - lw $t0, 192($sp) - sw $t0, 200($sp) + lw $t0, 200($sp) + sw $t0, 208($sp) - # If internal_1 then goto then_8794497433375 - lw $t0, 200($sp) # Loading the address of the condition + # If internal_1 then goto then_8753943066242 + lw $t0, 208($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497433375 + beq $t0, $t1, then_8753943066242 - # Jumping to else_8794497433375 - j else_8794497433375 + # Jumping to else_8753943066242 + j else_8753943066242 - then_8794497433375: + then_8753943066242: # Allocating String li $v0, 9 @@ -4614,16 +5111,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 188($sp) # internal_4 = "0" + sw $v0, 196($sp) # internal_4 = "0" # internal_0 = internal_4 - lw $t0, 188($sp) - sw $t0, 204($sp) + lw $t0, 196($sp) + sw $t0, 212($sp) - # Jumping to endif_8794497433375 - j endif_8794497433375 + # Jumping to endif_8753943066242 + j endif_8753943066242 - else_8794497433375: + else_8753943066242: # Allocating Bool 0 li $v0, 9 @@ -4635,7 +5132,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 180($sp) # internal_6 = address of allocated object Int + sw $v0, 188($sp) # internal_6 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -4647,40 +5144,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 176($sp) # internal_7 = address of allocated object Int + sw $v0, 184($sp) # internal_7 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing i # Argument internal_7 - lw $t0, 188($sp) + lw $t0, 196($sp) sw $t0, 0($sp) # Storing internal_7 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 184($sp) # internal_8 = result of function_equal + sw $v1, 192($sp) # internal_8 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_6 = internal_8 - lw $t0, 172($sp) - sw $t0, 180($sp) + lw $t0, 180($sp) + sw $t0, 188($sp) - # If internal_6 then goto then_8794497433369 - lw $t0, 180($sp) # Loading the address of the condition + # If internal_6 then goto then_8753943066236 + lw $t0, 188($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497433369 + beq $t0, $t1, then_8753943066236 - # Jumping to else_8794497433369 - j else_8794497433369 + # Jumping to else_8753943066236 + j else_8753943066236 - then_8794497433369: + then_8753943066236: # Allocating String li $v0, 9 @@ -4698,16 +5195,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 168($sp) # internal_9 = "1" + sw $v0, 176($sp) # internal_9 = "1" # internal_5 = internal_9 - lw $t0, 168($sp) - sw $t0, 184($sp) + lw $t0, 176($sp) + sw $t0, 192($sp) - # Jumping to endif_8794497433369 - j endif_8794497433369 + # Jumping to endif_8753943066236 + j endif_8753943066236 - else_8794497433369: + else_8753943066236: # Allocating Bool 0 li $v0, 9 @@ -4719,7 +5216,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 160($sp) # internal_11 = address of allocated object Int + sw $v0, 168($sp) # internal_11 = address of allocated object Int # Allocating Int 2 li $v0, 9 @@ -4731,40 +5228,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 156($sp) # internal_12 = address of allocated object Int + sw $v0, 164($sp) # internal_12 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing i # Argument internal_12 - lw $t0, 168($sp) + lw $t0, 176($sp) sw $t0, 0($sp) # Storing internal_12 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 164($sp) # internal_13 = result of function_equal + sw $v1, 172($sp) # internal_13 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_11 = internal_13 - lw $t0, 152($sp) - sw $t0, 160($sp) + lw $t0, 160($sp) + sw $t0, 168($sp) - # If internal_11 then goto then_8794497433363 - lw $t0, 160($sp) # Loading the address of the condition + # If internal_11 then goto then_8753943066230 + lw $t0, 168($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497433363 + beq $t0, $t1, then_8753943066230 - # Jumping to else_8794497433363 - j else_8794497433363 + # Jumping to else_8753943066230 + j else_8753943066230 - then_8794497433363: + then_8753943066230: # Allocating String li $v0, 9 @@ -4782,16 +5279,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 148($sp) # internal_14 = "2" + sw $v0, 156($sp) # internal_14 = "2" # internal_10 = internal_14 - lw $t0, 148($sp) - sw $t0, 164($sp) + lw $t0, 156($sp) + sw $t0, 172($sp) - # Jumping to endif_8794497433363 - j endif_8794497433363 + # Jumping to endif_8753943066230 + j endif_8753943066230 - else_8794497433363: + else_8753943066230: # Allocating Bool 0 li $v0, 9 @@ -4803,7 +5300,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 140($sp) # internal_16 = address of allocated object Int + sw $v0, 148($sp) # internal_16 = address of allocated object Int # Allocating Int 3 li $v0, 9 @@ -4815,40 +5312,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 136($sp) # internal_17 = address of allocated object Int + sw $v0, 144($sp) # internal_17 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing i # Argument internal_17 - lw $t0, 148($sp) + lw $t0, 156($sp) sw $t0, 0($sp) # Storing internal_17 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 144($sp) # internal_18 = result of function_equal + sw $v1, 152($sp) # internal_18 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_16 = internal_18 - lw $t0, 132($sp) - sw $t0, 140($sp) + lw $t0, 140($sp) + sw $t0, 148($sp) - # If internal_16 then goto then_8794497433357 - lw $t0, 140($sp) # Loading the address of the condition + # If internal_16 then goto then_8753943066224 + lw $t0, 148($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497433357 + beq $t0, $t1, then_8753943066224 - # Jumping to else_8794497433357 - j else_8794497433357 + # Jumping to else_8753943066224 + j else_8753943066224 - then_8794497433357: + then_8753943066224: # Allocating String li $v0, 9 @@ -4866,16 +5363,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 128($sp) # internal_19 = "3" + sw $v0, 136($sp) # internal_19 = "3" # internal_15 = internal_19 - lw $t0, 128($sp) - sw $t0, 144($sp) + lw $t0, 136($sp) + sw $t0, 152($sp) - # Jumping to endif_8794497433357 - j endif_8794497433357 + # Jumping to endif_8753943066224 + j endif_8753943066224 - else_8794497433357: + else_8753943066224: # Allocating Bool 0 li $v0, 9 @@ -4887,7 +5384,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 120($sp) # internal_21 = address of allocated object Int + sw $v0, 128($sp) # internal_21 = address of allocated object Int # Allocating Int 4 li $v0, 9 @@ -4899,40 +5396,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 116($sp) # internal_22 = address of allocated object Int + sw $v0, 124($sp) # internal_22 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing i # Argument internal_22 - lw $t0, 128($sp) + lw $t0, 136($sp) sw $t0, 0($sp) # Storing internal_22 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 124($sp) # internal_23 = result of function_equal + sw $v1, 132($sp) # internal_23 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_21 = internal_23 - lw $t0, 112($sp) - sw $t0, 120($sp) + lw $t0, 120($sp) + sw $t0, 128($sp) - # If internal_21 then goto then_8794497433351 - lw $t0, 120($sp) # Loading the address of the condition + # If internal_21 then goto then_8753943066218 + lw $t0, 128($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497433351 + beq $t0, $t1, then_8753943066218 - # Jumping to else_8794497433351 - j else_8794497433351 + # Jumping to else_8753943066218 + j else_8753943066218 - then_8794497433351: + then_8753943066218: # Allocating String li $v0, 9 @@ -4950,16 +5447,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 108($sp) # internal_24 = "4" + sw $v0, 116($sp) # internal_24 = "4" # internal_20 = internal_24 - lw $t0, 108($sp) - sw $t0, 124($sp) + lw $t0, 116($sp) + sw $t0, 132($sp) - # Jumping to endif_8794497433351 - j endif_8794497433351 + # Jumping to endif_8753943066218 + j endif_8753943066218 - else_8794497433351: + else_8753943066218: # Allocating Bool 0 li $v0, 9 @@ -4971,7 +5468,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 100($sp) # internal_26 = address of allocated object Int + sw $v0, 108($sp) # internal_26 = address of allocated object Int # Allocating Int 5 li $v0, 9 @@ -4983,40 +5480,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 5 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 96($sp) # internal_27 = address of allocated object Int + sw $v0, 104($sp) # internal_27 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing i # Argument internal_27 - lw $t0, 108($sp) + lw $t0, 116($sp) sw $t0, 0($sp) # Storing internal_27 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 104($sp) # internal_28 = result of function_equal + sw $v1, 112($sp) # internal_28 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_26 = internal_28 - lw $t0, 92($sp) - sw $t0, 100($sp) + lw $t0, 100($sp) + sw $t0, 108($sp) - # If internal_26 then goto then_8794497433085 - lw $t0, 100($sp) # Loading the address of the condition + # If internal_26 then goto then_8753943066212 + lw $t0, 108($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497433085 + beq $t0, $t1, then_8753943066212 - # Jumping to else_8794497433085 - j else_8794497433085 + # Jumping to else_8753943066212 + j else_8753943066212 - then_8794497433085: + then_8753943066212: # Allocating String li $v0, 9 @@ -5034,16 +5531,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 88($sp) # internal_29 = "5" + sw $v0, 96($sp) # internal_29 = "5" # internal_25 = internal_29 - lw $t0, 88($sp) - sw $t0, 104($sp) + lw $t0, 96($sp) + sw $t0, 112($sp) - # Jumping to endif_8794497433085 - j endif_8794497433085 + # Jumping to endif_8753943066212 + j endif_8753943066212 - else_8794497433085: + else_8753943066212: # Allocating Bool 0 li $v0, 9 @@ -5055,7 +5552,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # internal_31 = address of allocated object Int + sw $v0, 88($sp) # internal_31 = address of allocated object Int # Allocating Int 6 li $v0, 9 @@ -5067,40 +5564,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 6 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 76($sp) # internal_32 = address of allocated object Int + sw $v0, 84($sp) # internal_32 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing i # Argument internal_32 - lw $t0, 88($sp) + lw $t0, 96($sp) sw $t0, 0($sp) # Storing internal_32 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 84($sp) # internal_33 = result of function_equal + sw $v1, 92($sp) # internal_33 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_31 = internal_33 - lw $t0, 72($sp) - sw $t0, 80($sp) + lw $t0, 80($sp) + sw $t0, 88($sp) - # If internal_31 then goto then_8794497433079 - lw $t0, 80($sp) # Loading the address of the condition + # If internal_31 then goto then_8753943066206 + lw $t0, 88($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497433079 + beq $t0, $t1, then_8753943066206 - # Jumping to else_8794497433079 - j else_8794497433079 + # Jumping to else_8753943066206 + j else_8753943066206 - then_8794497433079: + then_8753943066206: # Allocating String li $v0, 9 @@ -5118,16 +5615,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 68($sp) # internal_34 = "6" + sw $v0, 76($sp) # internal_34 = "6" # internal_30 = internal_34 - lw $t0, 68($sp) - sw $t0, 84($sp) + lw $t0, 76($sp) + sw $t0, 92($sp) - # Jumping to endif_8794497433079 - j endif_8794497433079 + # Jumping to endif_8753943066206 + j endif_8753943066206 - else_8794497433079: + else_8753943066206: # Allocating Bool 0 li $v0, 9 @@ -5139,7 +5636,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_36 = address of allocated object Int + sw $v0, 68($sp) # internal_36 = address of allocated object Int # Allocating Int 7 li $v0, 9 @@ -5151,40 +5648,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 7 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 56($sp) # internal_37 = address of allocated object Int + sw $v0, 64($sp) # internal_37 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing i # Argument internal_37 - lw $t0, 68($sp) + lw $t0, 76($sp) sw $t0, 0($sp) # Storing internal_37 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 64($sp) # internal_38 = result of function_equal + sw $v1, 72($sp) # internal_38 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_36 = internal_38 - lw $t0, 52($sp) - sw $t0, 60($sp) + lw $t0, 60($sp) + sw $t0, 68($sp) - # If internal_36 then goto then_8794497433073 - lw $t0, 60($sp) # Loading the address of the condition + # If internal_36 then goto then_8753943066200 + lw $t0, 68($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497433073 + beq $t0, $t1, then_8753943066200 - # Jumping to else_8794497433073 - j else_8794497433073 + # Jumping to else_8753943066200 + j else_8753943066200 - then_8794497433073: + then_8753943066200: # Allocating String li $v0, 9 @@ -5202,16 +5699,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 48($sp) # internal_39 = "7" + sw $v0, 56($sp) # internal_39 = "7" # internal_35 = internal_39 - lw $t0, 48($sp) - sw $t0, 64($sp) + lw $t0, 56($sp) + sw $t0, 72($sp) - # Jumping to endif_8794497433073 - j endif_8794497433073 + # Jumping to endif_8753943066200 + j endif_8753943066200 - else_8794497433073: + else_8753943066200: # Allocating Bool 0 li $v0, 9 @@ -5223,7 +5720,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_41 = address of allocated object Int + sw $v0, 48($sp) # internal_41 = address of allocated object Int # Allocating Int 8 li $v0, 9 @@ -5235,40 +5732,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 8 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_42 = address of allocated object Int + sw $v0, 44($sp) # internal_42 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing i # Argument internal_42 - lw $t0, 48($sp) + lw $t0, 56($sp) sw $t0, 0($sp) # Storing internal_42 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 44($sp) # internal_43 = result of function_equal + sw $v1, 52($sp) # internal_43 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_41 = internal_43 - lw $t0, 32($sp) - sw $t0, 40($sp) + lw $t0, 40($sp) + sw $t0, 48($sp) - # If internal_41 then goto then_8794497433067 - lw $t0, 40($sp) # Loading the address of the condition + # If internal_41 then goto then_8753943066194 + lw $t0, 48($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497433067 + beq $t0, $t1, then_8753943066194 - # Jumping to else_8794497433067 - j else_8794497433067 + # Jumping to else_8753943066194 + j else_8753943066194 - then_8794497433067: + then_8753943066194: # Allocating String li $v0, 9 @@ -5286,16 +5783,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 28($sp) # internal_44 = "8" + sw $v0, 36($sp) # internal_44 = "8" # internal_40 = internal_44 - lw $t0, 28($sp) - sw $t0, 44($sp) + lw $t0, 36($sp) + sw $t0, 52($sp) - # Jumping to endif_8794497433067 - j endif_8794497433067 + # Jumping to endif_8753943066194 + j endif_8753943066194 - else_8794497433067: + else_8753943066194: # Allocating Bool 0 li $v0, 9 @@ -5307,7 +5804,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_46 = address of allocated object Int + sw $v0, 28($sp) # internal_46 = address of allocated object Int # Allocating Int 9 li $v0, 9 @@ -5319,40 +5816,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 9 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_47 = address of allocated object Int + sw $v0, 24($sp) # internal_47 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing i # Argument internal_47 - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t0, 0($sp) # Storing internal_47 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 24($sp) # internal_48 = result of function_equal + sw $v1, 32($sp) # internal_48 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_46 = internal_48 - lw $t0, 12($sp) - sw $t0, 20($sp) + lw $t0, 20($sp) + sw $t0, 28($sp) - # If internal_46 then goto then_8794497433046 - lw $t0, 20($sp) # Loading the address of the condition + # If internal_46 then goto then_8753943066173 + lw $t0, 28($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497433046 + beq $t0, $t1, then_8753943066173 - # Jumping to else_8794497433046 - j else_8794497433046 + # Jumping to else_8753943066173 + j else_8753943066173 - then_8794497433046: + then_8753943066173: # Allocating String li $v0, 9 @@ -5370,29 +5867,53 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 8($sp) # internal_49 = "9" + sw $v0, 16($sp) # internal_49 = "9" # internal_45 = internal_49 - lw $t0, 8($sp) - sw $t0, 24($sp) + lw $t0, 16($sp) + sw $t0, 32($sp) + + # Jumping to endif_8753943066173 + j endif_8753943066173 - # Jumping to endif_8794497433046 - j endif_8794497433046 + else_8753943066173: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_51 = address of allocated object Int - else_8794497433046: + # Get method abort of A2I + lw $t0, 220($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 0($sp) # Storing self - # Calling function function_abort_at_Object - jal function_abort_at_Object + # Calling function internal_52 + lw $t0, 12($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 12($sp) # internal_50 = result of function_abort_at_Object + sw $v1, 20($sp) # internal_50 = result of internal_52 addi $sp, $sp, 8 # Freeing space for arguments # Allocating String @@ -5408,114 +5929,114 @@ sb $zero, 8($v0) # Null-terminator at the end of the string - sw $v0, 0($sp) # internal_51 = "" + sw $v0, 0($sp) # internal_53 = "" - # internal_45 = internal_51 + # internal_45 = internal_53 lw $t0, 0($sp) - sw $t0, 24($sp) + sw $t0, 32($sp) - # Jumping to endif_8794497433046 - j endif_8794497433046 + # Jumping to endif_8753943066173 + j endif_8753943066173 - endif_8794497433046: + endif_8753943066173: # internal_40 = internal_45 - lw $t0, 24($sp) - sw $t0, 44($sp) - - # Jumping to endif_8794497433067 - j endif_8794497433067 + lw $t0, 32($sp) + sw $t0, 52($sp) + + # Jumping to endif_8753943066194 + j endif_8753943066194 - endif_8794497433067: + endif_8753943066194: # internal_35 = internal_40 - lw $t0, 44($sp) - sw $t0, 64($sp) + lw $t0, 52($sp) + sw $t0, 72($sp) - # Jumping to endif_8794497433073 - j endif_8794497433073 + # Jumping to endif_8753943066200 + j endif_8753943066200 - endif_8794497433073: + endif_8753943066200: # internal_30 = internal_35 - lw $t0, 64($sp) - sw $t0, 84($sp) + lw $t0, 72($sp) + sw $t0, 92($sp) - # Jumping to endif_8794497433079 - j endif_8794497433079 + # Jumping to endif_8753943066206 + j endif_8753943066206 - endif_8794497433079: + endif_8753943066206: # internal_25 = internal_30 - lw $t0, 84($sp) - sw $t0, 104($sp) + lw $t0, 92($sp) + sw $t0, 112($sp) - # Jumping to endif_8794497433085 - j endif_8794497433085 + # Jumping to endif_8753943066212 + j endif_8753943066212 - endif_8794497433085: + endif_8753943066212: # internal_20 = internal_25 - lw $t0, 104($sp) - sw $t0, 124($sp) + lw $t0, 112($sp) + sw $t0, 132($sp) - # Jumping to endif_8794497433351 - j endif_8794497433351 + # Jumping to endif_8753943066218 + j endif_8753943066218 - endif_8794497433351: + endif_8753943066218: # internal_15 = internal_20 - lw $t0, 124($sp) - sw $t0, 144($sp) + lw $t0, 132($sp) + sw $t0, 152($sp) - # Jumping to endif_8794497433357 - j endif_8794497433357 + # Jumping to endif_8753943066224 + j endif_8753943066224 - endif_8794497433357: + endif_8753943066224: # internal_10 = internal_15 - lw $t0, 144($sp) - sw $t0, 164($sp) + lw $t0, 152($sp) + sw $t0, 172($sp) - # Jumping to endif_8794497433363 - j endif_8794497433363 + # Jumping to endif_8753943066230 + j endif_8753943066230 - endif_8794497433363: + endif_8753943066230: # internal_5 = internal_10 - lw $t0, 164($sp) - sw $t0, 184($sp) + lw $t0, 172($sp) + sw $t0, 192($sp) - # Jumping to endif_8794497433369 - j endif_8794497433369 + # Jumping to endif_8753943066236 + j endif_8753943066236 - endif_8794497433369: + endif_8753943066236: # internal_0 = internal_5 - lw $t0, 184($sp) - sw $t0, 204($sp) + lw $t0, 192($sp) + sw $t0, 212($sp) - # Jumping to endif_8794497433375 - j endif_8794497433375 + # Jumping to endif_8753943066242 + j endif_8753943066242 - endif_8794497433375: + endif_8753943066242: # Loading return value in $v1 - lw $v1, 204($sp) + lw $v1, 212($sp) # Freeing space for local variables - addi $sp, $sp, 208 + addi $sp, $sp, 216 jr $ra function_a2i_at_A2I: # Function parameters - # $ra = 152($sp) - # self = 148($sp) - # s = 144($sp) + # $ra = 232($sp) + # self = 228($sp) + # s = 224($sp) # Reserving space for local variables - addi $sp, $sp, -144 + addi $sp, $sp, -224 # Allocating Bool 0 li $v0, 9 @@ -5527,20 +6048,44 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 136($sp) # internal_1 = address of allocated object Int + sw $v0, 216($sp) # internal_1 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 208($sp) # internal_3 = address of allocated object Int + + # Get method length of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 208($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 204($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument s - lw $t0, 152($sp) + lw $t0, 232($sp) sw $t0, 0($sp) # Storing s - # Calling function function_length_at_String - jal function_length_at_String + # Calling function internal_4 + lw $t0, 212($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 140($sp) # internal_2 = result of function_length_at_String + sw $v1, 220($sp) # internal_2 = result of internal_4 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 0 @@ -5553,40 +6098,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 128($sp) # internal_3 = address of allocated object Int + sw $v0, 200($sp) # internal_5 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_2 - lw $t0, 144($sp) + lw $t0, 224($sp) sw $t0, 4($sp) # Storing internal_2 - # Argument internal_3 - lw $t0, 140($sp) - sw $t0, 0($sp) # Storing internal_3 + # Argument internal_5 + lw $t0, 212($sp) + sw $t0, 0($sp) # Storing internal_5 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 136($sp) # internal_4 = result of function_equal + sw $v1, 208($sp) # internal_6 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_1 = internal_4 - lw $t0, 124($sp) - sw $t0, 136($sp) + # internal_1 = internal_6 + lw $t0, 196($sp) + sw $t0, 216($sp) - # If internal_1 then goto then_8794497433561 - lw $t0, 136($sp) # Loading the address of the condition + # If internal_1 then goto then_8753943066688 + lw $t0, 216($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497433561 + beq $t0, $t1, then_8753943066688 - # Jumping to else_8794497433561 - j else_8794497433561 + # Jumping to else_8753943066688 + j else_8753943066688 - then_8794497433561: + then_8753943066688: # Allocating Int 0 li $v0, 9 @@ -5598,16 +6143,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 120($sp) # internal_5 = address of allocated object Int + sw $v0, 192($sp) # internal_7 = address of allocated object Int - # internal_0 = internal_5 - lw $t0, 120($sp) - sw $t0, 140($sp) + # internal_0 = internal_7 + lw $t0, 192($sp) + sw $t0, 220($sp) - # Jumping to endif_8794497433561 - j endif_8794497433561 + # Jumping to endif_8753943066688 + j endif_8753943066688 - else_8794497433561: + else_8753943066688: # Allocating Bool 0 li $v0, 9 @@ -5619,7 +6164,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 112($sp) # internal_7 = address of allocated object Int + sw $v0, 184($sp) # internal_9 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -5631,7 +6176,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 108($sp) # internal_8 = address of allocated object Int + sw $v0, 180($sp) # internal_10 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -5643,28 +6188,52 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 104($sp) # internal_9 = address of allocated object Int + sw $v0, 176($sp) # internal_11 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 168($sp) # internal_13 = address of allocated object Int + + # Get method substr of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 168($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 164($sp) # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument s - lw $t0, 160($sp) + lw $t0, 240($sp) sw $t0, 8($sp) # Storing s - # Argument internal_8 - lw $t0, 124($sp) - sw $t0, 4($sp) # Storing internal_8 + # Argument internal_10 + lw $t0, 196($sp) + sw $t0, 4($sp) # Storing internal_10 - # Argument internal_9 - lw $t0, 120($sp) - sw $t0, 0($sp) # Storing internal_9 + # Argument internal_11 + lw $t0, 192($sp) + sw $t0, 0($sp) # Storing internal_11 - # Calling function function_substr_at_String - jal function_substr_at_String + # Calling function internal_14 + lw $t0, 180($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 116($sp) # internal_10 = result of function_substr_at_String + sw $v1, 188($sp) # internal_12 = result of internal_14 addi $sp, $sp, 16 # Freeing space for arguments # Allocating String @@ -5679,44 +6248,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 45 - sb $t0, 8($v0) # internal_11[0] = '-' + sb $t0, 8($v0) # internal_15[0] = '-' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 96($sp) # internal_11 = "-" + sw $v0, 160($sp) # internal_15 = "-" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_10 - lw $t0, 112($sp) - sw $t0, 4($sp) # Storing internal_10 + # Argument internal_12 + lw $t0, 184($sp) + sw $t0, 4($sp) # Storing internal_12 - # Argument internal_11 - lw $t0, 108($sp) - sw $t0, 0($sp) # Storing internal_11 + # Argument internal_15 + lw $t0, 172($sp) + sw $t0, 0($sp) # Storing internal_15 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 104($sp) # internal_12 = result of function_equal + sw $v1, 168($sp) # internal_16 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_7 = internal_12 - lw $t0, 92($sp) - sw $t0, 112($sp) + # internal_9 = internal_16 + lw $t0, 156($sp) + sw $t0, 184($sp) - # If internal_7 then goto then_8794497433576 - lw $t0, 112($sp) # Loading the address of the condition + # If internal_9 then goto then_8753943066703 + lw $t0, 184($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497433576 + beq $t0, $t1, then_8753943066703 - # Jumping to else_8794497433576 - j else_8794497433576 + # Jumping to else_8753943066703 + j else_8753943066703 - then_8794497433576: + then_8753943066703: # Allocating Int 1 li $v0, 9 @@ -5728,20 +6297,44 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 88($sp) # internal_13 = address of allocated object Int + sw $v0, 152($sp) # internal_17 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_19 = address of allocated object Int + + # Get method length of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 144($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 140($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument s - lw $t0, 152($sp) + lw $t0, 232($sp) sw $t0, 0($sp) # Storing s - # Calling function function_length_at_String - jal function_length_at_String + # Calling function internal_20 + lw $t0, 148($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 92($sp) # internal_14 = result of function_length_at_String + sw $v1, 156($sp) # internal_18 = result of internal_20 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 1 @@ -5754,64 +6347,112 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # internal_15 = address of allocated object Int + sw $v0, 136($sp) # internal_21 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_14 - lw $t0, 96($sp) - sw $t0, 4($sp) # Storing internal_14 + # Argument internal_18 + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing internal_18 - # Argument internal_15 - lw $t0, 92($sp) - sw $t0, 0($sp) # Storing internal_15 + # Argument internal_21 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_21 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 88($sp) # internal_16 = result of function_sub + sw $v1, 144($sp) # internal_22 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 124($sp) # internal_24 = address of allocated object Int + + # Get method substr of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 124($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 120($sp) + # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument s - lw $t0, 160($sp) + lw $t0, 240($sp) sw $t0, 8($sp) # Storing s - # Argument internal_13 - lw $t0, 104($sp) - sw $t0, 4($sp) # Storing internal_13 + # Argument internal_17 + lw $t0, 168($sp) + sw $t0, 4($sp) # Storing internal_17 - # Argument internal_16 - lw $t0, 92($sp) - sw $t0, 0($sp) # Storing internal_16 + # Argument internal_22 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_22 - # Calling function function_substr_at_String - jal function_substr_at_String + # Calling function internal_25 + lw $t0, 136($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 88($sp) # internal_17 = result of function_substr_at_String + sw $v1, 144($sp) # internal_23 = result of internal_25 addi $sp, $sp, 16 # Freeing space for arguments + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_27 = address of allocated object Int + + # Get method a2i_aux of A2I + lw $t0, 228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 112($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 108($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 160($sp) + lw $t0, 240($sp) sw $t0, 4($sp) # Storing self - # Argument internal_17 - lw $t0, 84($sp) - sw $t0, 0($sp) # Storing internal_17 + # Argument internal_23 + lw $t0, 140($sp) + sw $t0, 0($sp) # Storing internal_23 - # Calling function function_a2i_aux_at_A2I - jal function_a2i_aux_at_A2I + # Calling function internal_28 + lw $t0, 120($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 80($sp) # internal_18 = result of function_a2i_aux_at_A2I + sw $v1, 128($sp) # internal_26 = result of internal_28 addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -5824,7 +6465,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 64($sp) # internal_19 = address of allocated object Int + sw $v0, 104($sp) # internal_29 = address of allocated object Int # Allocating Int 4294967295 li $v0, 9 @@ -5836,7 +6477,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4294967295 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_20 = address of allocated object Int + sw $v0, 100($sp) # internal_30 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -5848,52 +6489,52 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 56($sp) # internal_21 = address of allocated object Int + sw $v0, 96($sp) # internal_31 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_18 - lw $t0, 80($sp) - sw $t0, 4($sp) # Storing internal_18 + # Argument internal_26 + lw $t0, 128($sp) + sw $t0, 4($sp) # Storing internal_26 - # Argument internal_20 - lw $t0, 72($sp) - sw $t0, 0($sp) # Storing internal_20 + # Argument internal_30 + lw $t0, 112($sp) + sw $t0, 0($sp) # Storing internal_30 # Calling function function_xor jal function_xor lw $ra, 8($sp) - sw $v1, 68($sp) # internal_21 = result of function_xor + sw $v1, 108($sp) # internal_31 = result of function_xor addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_21 - lw $t0, 68($sp) - sw $t0, 4($sp) # Storing internal_21 + # Argument internal_31 + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing internal_31 - # Argument internal_19 - lw $t0, 76($sp) - sw $t0, 0($sp) # Storing internal_19 + # Argument internal_29 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_29 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 68($sp) # internal_21 = result of function_add + sw $v1, 108($sp) # internal_31 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # internal_6 = internal_21 - lw $t0, 56($sp) - sw $t0, 116($sp) + # internal_8 = internal_31 + lw $t0, 96($sp) + sw $t0, 188($sp) - # Jumping to endif_8794497433576 - j endif_8794497433576 + # Jumping to endif_8753943066703 + j endif_8753943066703 - else_8794497433576: + else_8753943066703: # Allocating Bool 0 li $v0, 9 @@ -5905,7 +6546,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_23 = address of allocated object Int + sw $v0, 88($sp) # internal_33 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -5917,7 +6558,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_24 = address of allocated object Int + sw $v0, 84($sp) # internal_34 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -5929,28 +6570,52 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_25 = address of allocated object Int + sw $v0, 80($sp) # internal_35 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_37 = address of allocated object Int + + # Get method substr of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 72($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 68($sp) # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument s - lw $t0, 160($sp) + lw $t0, 240($sp) sw $t0, 8($sp) # Storing s - # Argument internal_24 - lw $t0, 60($sp) - sw $t0, 4($sp) # Storing internal_24 + # Argument internal_34 + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing internal_34 - # Argument internal_25 - lw $t0, 56($sp) - sw $t0, 0($sp) # Storing internal_25 + # Argument internal_35 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_35 - # Calling function function_substr_at_String - jal function_substr_at_String + # Calling function internal_38 + lw $t0, 84($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 52($sp) # internal_26 = result of function_substr_at_String + sw $v1, 92($sp) # internal_36 = result of internal_38 addi $sp, $sp, 16 # Freeing space for arguments # Allocating String @@ -5965,44 +6630,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 43 - sb $t0, 8($v0) # internal_27[0] = '+' + sb $t0, 8($v0) # internal_39[0] = '+' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 32($sp) # internal_27 = "+" + sw $v0, 64($sp) # internal_39 = "+" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_26 - lw $t0, 48($sp) - sw $t0, 4($sp) # Storing internal_26 + # Argument internal_36 + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing internal_36 - # Argument internal_27 - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_27 + # Argument internal_39 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_39 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 40($sp) # internal_28 = result of function_equal + sw $v1, 72($sp) # internal_40 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_23 = internal_28 - lw $t0, 28($sp) - sw $t0, 48($sp) + # internal_33 = internal_40 + lw $t0, 60($sp) + sw $t0, 88($sp) - # If internal_23 then goto then_8794497433570 - lw $t0, 48($sp) # Loading the address of the condition + # If internal_33 then goto then_8753943066697 + lw $t0, 88($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497433570 + beq $t0, $t1, then_8753943066697 - # Jumping to else_8794497433570 - j else_8794497433570 + # Jumping to else_8753943066697 + j else_8753943066697 - then_8794497433570: + then_8753943066697: # Allocating Int 1 li $v0, 9 @@ -6014,20 +6679,44 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_29 = address of allocated object Int + sw $v0, 56($sp) # internal_41 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_43 = address of allocated object Int + + # Get method length of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 48($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 44($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument s - lw $t0, 152($sp) + lw $t0, 232($sp) sw $t0, 0($sp) # Storing s - # Calling function function_length_at_String - jal function_length_at_String + # Calling function internal_44 + lw $t0, 52($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 28($sp) # internal_30 = result of function_length_at_String + sw $v1, 60($sp) # internal_42 = result of internal_44 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 1 @@ -6040,136 +6729,208 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_31 = address of allocated object Int + sw $v0, 40($sp) # internal_45 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_30 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_30 + # Argument internal_42 + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing internal_42 - # Argument internal_31 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_31 + # Argument internal_45 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_45 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_46 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_48 = address of allocated object Int - # Calling function function_sub - jal function_sub - lw $ra, 8($sp) - sw $v1, 24($sp) # internal_32 = result of function_sub - addi $sp, $sp, 12 # Freeing space for arguments + # Get method substr of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 28($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 24($sp) # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument s - lw $t0, 160($sp) + lw $t0, 240($sp) sw $t0, 8($sp) # Storing s - # Argument internal_29 - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing internal_29 + # Argument internal_41 + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing internal_41 - # Argument internal_32 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_32 + # Argument internal_46 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_46 - # Calling function function_substr_at_String - jal function_substr_at_String + # Calling function internal_49 + lw $t0, 40($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 24($sp) # internal_33 = result of function_substr_at_String + sw $v1, 48($sp) # internal_47 = result of internal_49 addi $sp, $sp, 16 # Freeing space for arguments + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_51 = address of allocated object Int + + # Get method a2i_aux of A2I + lw $t0, 228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 160($sp) + lw $t0, 240($sp) sw $t0, 4($sp) # Storing self - # Argument internal_33 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_33 + # Argument internal_47 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_47 - # Calling function function_a2i_aux_at_A2I - jal function_a2i_aux_at_A2I + # Calling function internal_52 + lw $t0, 24($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 16($sp) # internal_34 = result of function_a2i_aux_at_A2I + sw $v1, 32($sp) # internal_50 = result of internal_52 addi $sp, $sp, 12 # Freeing space for arguments - # internal_22 = internal_34 - lw $t0, 4($sp) - sw $t0, 52($sp) + # internal_32 = internal_50 + lw $t0, 20($sp) + sw $t0, 92($sp) + + # Jumping to endif_8753943066697 + j endif_8753943066697 + + else_8753943066697: - # Jumping to endif_8794497433570 - j endif_8794497433570 + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_54 = address of allocated object Int - else_8794497433570: + # Get method a2i_aux of A2I + lw $t0, 228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 160($sp) + lw $t0, 240($sp) sw $t0, 4($sp) # Storing self # Argument s - lw $t0, 156($sp) + lw $t0, 236($sp) sw $t0, 0($sp) # Storing s - # Calling function function_a2i_aux_at_A2I - jal function_a2i_aux_at_A2I + # Calling function internal_55 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_35 = result of function_a2i_aux_at_A2I + sw $v1, 20($sp) # internal_53 = result of internal_55 addi $sp, $sp, 12 # Freeing space for arguments - # internal_22 = internal_35 - lw $t0, 0($sp) - sw $t0, 52($sp) + # internal_32 = internal_53 + lw $t0, 8($sp) + sw $t0, 92($sp) - # Jumping to endif_8794497433570 - j endif_8794497433570 + # Jumping to endif_8753943066697 + j endif_8753943066697 - endif_8794497433570: + endif_8753943066697: - # internal_6 = internal_22 - lw $t0, 52($sp) - sw $t0, 116($sp) + # internal_8 = internal_32 + lw $t0, 92($sp) + sw $t0, 188($sp) - # Jumping to endif_8794497433576 - j endif_8794497433576 + # Jumping to endif_8753943066703 + j endif_8753943066703 - endif_8794497433576: + endif_8753943066703: - # internal_0 = internal_6 - lw $t0, 116($sp) - sw $t0, 140($sp) + # internal_0 = internal_8 + lw $t0, 188($sp) + sw $t0, 220($sp) - # Jumping to endif_8794497433561 - j endif_8794497433561 + # Jumping to endif_8753943066688 + j endif_8753943066688 - endif_8794497433561: + endif_8753943066688: # Loading return value in $v1 - lw $v1, 140($sp) + lw $v1, 220($sp) # Freeing space for local variables - addi $sp, $sp, 144 + addi $sp, $sp, 224 jr $ra function_a2i_aux_at_A2I: # Function parameters - # $ra = 68($sp) - # self = 64($sp) - # s = 60($sp) + # $ra = 96($sp) + # self = 92($sp) + # s = 88($sp) # Reserving space for local variables - addi $sp, $sp, -60 + addi $sp, $sp, -88 # Allocating Int 0 li $v0, 9 @@ -6181,38 +6942,62 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 52($sp) # internal_1 = address of allocated object Int + sw $v0, 80($sp) # internal_1 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument int - lw $t0, 68($sp) + lw $t0, 96($sp) sw $t0, 4($sp) # Storing int # Argument internal_1 - lw $t0, 64($sp) + lw $t0, 92($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 68($sp) # int = result of function_assign + sw $v1, 96($sp) # int = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_4 = address of allocated object Int + + # Get method length of String + lw $t0, 88($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 68($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 64($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument s - lw $t0, 68($sp) + lw $t0, 96($sp) sw $t0, 0($sp) # Storing s - # Calling function function_length_at_String - jal function_length_at_String + # Calling function internal_5 + lw $t0, 72($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 52($sp) # internal_3 = result of function_length_at_String + sw $v1, 80($sp) # internal_3 = result of internal_5 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments @@ -6220,17 +7005,17 @@ sw $ra, 8($sp) # Storing return address # Argument j - lw $t0, 60($sp) + lw $t0, 88($sp) sw $t0, 4($sp) # Storing j # Argument internal_3 - lw $t0, 56($sp) + lw $t0, 84($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 60($sp) # j = result of function_assign + sw $v1, 88($sp) # j = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 0 @@ -6243,56 +7028,59 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_5 = address of allocated object Int + sw $v0, 56($sp) # internal_7 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 52($sp) + lw $t0, 72($sp) sw $t0, 4($sp) # Storing i - # Argument internal_5 - lw $t0, 48($sp) - sw $t0, 0($sp) # Storing internal_5 + # Argument internal_7 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_7 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 52($sp) # i = result of function_assign + sw $v1, 72($sp) # i = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - while_start_8794497433974: + # Allocating NUll to internal_8 + sw $zero, 52($sp) # internal_8 = 0 + + while_start_8753943066841: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 52($sp) + lw $t0, 72($sp) sw $t0, 4($sp) # Storing i # Argument j - lw $t0, 60($sp) + lw $t0, 88($sp) sw $t0, 0($sp) # Storing j # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 44($sp) # internal_6 = result of function_less_than + sw $v1, 60($sp) # internal_9 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_6 then goto while_body_8794497433974 - lw $t0, 32($sp) # Loading the address of the condition + # If internal_9 then goto while_body_8753943066841 + lw $t0, 48($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8794497433974 + beq $t0, $t1, while_body_8753943066841 - # Jumping to while_end_8794497433974 - j while_end_8794497433974 + # Jumping to while_end_8753943066841 + j while_end_8753943066841 - while_body_8794497433974: + while_body_8753943066841: # Allocating Int 10 li $v0, 9 @@ -6304,24 +7092,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 10 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_7 = address of allocated object Int + sw $v0, 44($sp) # internal_10 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument int - lw $t0, 68($sp) + lw $t0, 96($sp) sw $t0, 4($sp) # Storing int - # Argument internal_7 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_7 + # Argument internal_10 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_10 # Calling function function_mult jal function_mult lw $ra, 8($sp) - sw $v1, 36($sp) # internal_8 = result of function_mult + sw $v1, 52($sp) # internal_11 = result of function_mult addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -6334,64 +7122,112 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_9 = address of allocated object Int + sw $v0, 36($sp) # internal_12 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_14 = address of allocated object Int + + # Get method substr of String + lw $t0, 88($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 28($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 24($sp) # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument s - lw $t0, 76($sp) + lw $t0, 104($sp) sw $t0, 8($sp) # Storing s # Argument i - lw $t0, 56($sp) + lw $t0, 76($sp) sw $t0, 4($sp) # Storing i - # Argument internal_9 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_9 + # Argument internal_12 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_12 - # Calling function function_substr_at_String - jal function_substr_at_String + # Calling function internal_15 + lw $t0, 40($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 32($sp) # internal_10 = result of function_substr_at_String + sw $v1, 48($sp) # internal_13 = result of internal_15 addi $sp, $sp, 16 # Freeing space for arguments + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_17 = address of allocated object Int + + # Get method c2i of A2I + lw $t0, 92($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 76($sp) + lw $t0, 104($sp) sw $t0, 4($sp) # Storing self - # Argument internal_10 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_10 + # Argument internal_13 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_13 - # Calling function function_c2i_at_A2I - jal function_c2i_at_A2I + # Calling function internal_18 + lw $t0, 24($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 24($sp) # internal_11 = result of function_c2i_at_A2I + sw $v1, 32($sp) # internal_16 = result of internal_18 addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_8 - lw $t0, 36($sp) - sw $t0, 4($sp) # Storing internal_8 - # Argument internal_11 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_11 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_11 + + # Argument internal_16 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_16 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 20($sp) # internal_12 = result of function_add + sw $v1, 20($sp) # internal_19 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -6399,17 +7235,17 @@ sw $ra, 8($sp) # Storing return address # Argument int - lw $t0, 68($sp) + lw $t0, 96($sp) sw $t0, 4($sp) # Storing int - # Argument internal_12 + # Argument internal_19 lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_12 + sw $t0, 0($sp) # Storing internal_19 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 68($sp) # int = result of function_assign + sw $v1, 96($sp) # int = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -6422,24 +7258,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_13 = address of allocated object Int + sw $v0, 4($sp) # internal_20 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 52($sp) + lw $t0, 72($sp) sw $t0, 4($sp) # Storing i - # Argument internal_13 + # Argument internal_20 lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_13 + sw $t0, 0($sp) # Storing internal_20 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 12($sp) # internal_14 = result of function_add + sw $v1, 12($sp) # internal_21 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -6447,40 +7283,40 @@ sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 52($sp) + lw $t0, 72($sp) sw $t0, 4($sp) # Storing i - # Argument internal_14 + # Argument internal_21 lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_14 + sw $t0, 0($sp) # Storing internal_21 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 52($sp) # i = result of function_assign + sw $v1, 72($sp) # i = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to while_start_8794497433974 - j while_start_8794497433974 + # Jumping to while_start_8753943066841 + j while_start_8753943066841 - while_end_8794497433974: + while_end_8753943066841: # Loading return value in $v1 - lw $v1, 56($sp) + lw $v1, 84($sp) # Freeing space for local variables - addi $sp, $sp, 60 + addi $sp, $sp, 88 jr $ra function_i2a_at_A2I: # Function parameters - # $ra = 80($sp) - # self = 76($sp) - # i = 72($sp) + # $ra = 104($sp) + # self = 100($sp) + # i = 96($sp) # Reserving space for local variables - addi $sp, $sp, -72 + addi $sp, $sp, -96 # Allocating Bool 0 li $v0, 9 @@ -6492,7 +7328,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 64($sp) # internal_1 = address of allocated object Int + sw $v0, 88($sp) # internal_1 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -6504,40 +7340,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_2 = address of allocated object Int + sw $v0, 84($sp) # internal_2 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 84($sp) + lw $t0, 108($sp) sw $t0, 4($sp) # Storing i # Argument internal_2 - lw $t0, 72($sp) + lw $t0, 96($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 68($sp) # internal_3 = result of function_equal + sw $v1, 92($sp) # internal_3 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_1 = internal_3 - lw $t0, 56($sp) - sw $t0, 64($sp) + lw $t0, 80($sp) + sw $t0, 88($sp) - # If internal_1 then goto then_8794497434103 - lw $t0, 64($sp) # Loading the address of the condition + # If internal_1 then goto then_8753943034462 + lw $t0, 88($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497434103 + beq $t0, $t1, then_8753943034462 - # Jumping to else_8794497434103 - j else_8794497434103 + # Jumping to else_8753943034462 + j else_8753943034462 - then_8794497434103: + then_8753943034462: # Allocating String li $v0, 9 @@ -6555,16 +7391,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 52($sp) # internal_4 = "0" + sw $v0, 76($sp) # internal_4 = "0" # internal_0 = internal_4 - lw $t0, 52($sp) - sw $t0, 68($sp) + lw $t0, 76($sp) + sw $t0, 92($sp) - # Jumping to endif_8794497434103 - j endif_8794497434103 + # Jumping to endif_8753943034462 + j endif_8753943034462 - else_8794497434103: + else_8753943034462: # Allocating Bool 0 li $v0, 9 @@ -6576,7 +7412,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_6 = address of allocated object Int + sw $v0, 68($sp) # internal_6 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -6588,67 +7424,91 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_7 = address of allocated object Int + sw $v0, 64($sp) # internal_7 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_7 - lw $t0, 52($sp) + lw $t0, 76($sp) sw $t0, 4($sp) # Storing internal_7 # Argument i - lw $t0, 84($sp) + lw $t0, 108($sp) sw $t0, 0($sp) # Storing i # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 48($sp) # internal_8 = result of function_less_than + sw $v1, 72($sp) # internal_8 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments # internal_6 = internal_8 - lw $t0, 36($sp) - sw $t0, 44($sp) + lw $t0, 60($sp) + sw $t0, 68($sp) - # If internal_6 then goto then_8794497434109 - lw $t0, 44($sp) # Loading the address of the condition + # If internal_6 then goto then_8753943034468 + lw $t0, 68($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497434109 + beq $t0, $t1, then_8753943034468 + + # Jumping to else_8753943034468 + j else_8753943034468 + + then_8753943034468: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Jumping to else_8794497434109 - j else_8794497434109 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_10 = address of allocated object Int - then_8794497434109: + # Get method i2a_aux of A2I + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 52($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 48($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 88($sp) + lw $t0, 112($sp) sw $t0, 4($sp) # Storing self # Argument i - lw $t0, 84($sp) + lw $t0, 108($sp) sw $t0, 0($sp) # Storing i - # Calling function function_i2a_aux_at_A2I - jal function_i2a_aux_at_A2I + # Calling function internal_11 + lw $t0, 60($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 44($sp) # internal_9 = result of function_i2a_aux_at_A2I + sw $v1, 68($sp) # internal_9 = result of internal_11 addi $sp, $sp, 12 # Freeing space for arguments # internal_5 = internal_9 - lw $t0, 32($sp) - sw $t0, 48($sp) + lw $t0, 56($sp) + sw $t0, 72($sp) - # Jumping to endif_8794497434109 - j endif_8794497434109 + # Jumping to endif_8753943034468 + j endif_8753943034468 - else_8794497434109: + else_8753943034468: # Allocating String li $v0, 9 @@ -6662,11 +7522,11 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 45 - sb $t0, 8($v0) # internal_10[0] = '-' + sb $t0, 8($v0) # internal_12[0] = '-' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 28($sp) # internal_10 = "-" + sw $v0, 44($sp) # internal_12 = "-" # Allocating Int 1 li $v0, 9 @@ -6678,7 +7538,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_11 = address of allocated object Int + sw $v0, 40($sp) # internal_13 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -6690,7 +7550,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_12 = address of allocated object Int + sw $v0, 36($sp) # internal_14 = address of allocated object Int # Allocating Int 4294967295 li $v0, 9 @@ -6702,7 +7562,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4294967295 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_13 = address of allocated object Int + sw $v0, 32($sp) # internal_15 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -6714,42 +7574,42 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_14 = address of allocated object Int + sw $v0, 28($sp) # internal_16 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_11 - lw $t0, 36($sp) - sw $t0, 4($sp) # Storing internal_11 - # Argument internal_13 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_13 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_13 + + # Argument internal_15 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_15 # Calling function function_xor jal function_xor lw $ra, 8($sp) - sw $v1, 24($sp) # internal_14 = result of function_xor + sw $v1, 40($sp) # internal_16 = result of function_xor addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_14 - lw $t0, 24($sp) - sw $t0, 4($sp) # Storing internal_14 + # Argument internal_16 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_16 - # Argument internal_12 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_12 + # Argument internal_14 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_14 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 24($sp) # internal_14 = result of function_add + sw $v1, 40($sp) # internal_16 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -6757,89 +7617,137 @@ sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 84($sp) + lw $t0, 108($sp) sw $t0, 4($sp) # Storing i - # Argument internal_14 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_14 + # Argument internal_16 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_16 # Calling function function_mult jal function_mult lw $ra, 8($sp) - sw $v1, 20($sp) # internal_15 = result of function_mult + sw $v1, 36($sp) # internal_17 = result of function_mult addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_19 = address of allocated object Int + + # Get method i2a_aux of A2I + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 88($sp) + lw $t0, 112($sp) sw $t0, 4($sp) # Storing self - # Argument internal_15 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_15 + # Argument internal_17 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_17 - # Calling function function_i2a_aux_at_A2I - jal function_i2a_aux_at_A2I + # Calling function internal_20 + lw $t0, 24($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 16($sp) # internal_16 = result of function_i2a_aux_at_A2I + sw $v1, 32($sp) # internal_18 = result of internal_20 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_22 = address of allocated object Int + + # Get method concat of String + lw $t0, 44($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_10 - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing internal_10 + # Argument internal_12 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_12 - # Argument internal_16 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_16 + # Argument internal_18 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_18 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_23 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_17 = result of function_concat_at_String + sw $v1, 20($sp) # internal_21 = result of internal_23 addi $sp, $sp, 12 # Freeing space for arguments - # internal_5 = internal_17 - lw $t0, 0($sp) - sw $t0, 48($sp) + # internal_5 = internal_21 + lw $t0, 8($sp) + sw $t0, 72($sp) - # Jumping to endif_8794497434109 - j endif_8794497434109 + # Jumping to endif_8753943034468 + j endif_8753943034468 - endif_8794497434109: + endif_8753943034468: # internal_0 = internal_5 - lw $t0, 48($sp) - sw $t0, 68($sp) + lw $t0, 72($sp) + sw $t0, 92($sp) - # Jumping to endif_8794497434103 - j endif_8794497434103 + # Jumping to endif_8753943034462 + j endif_8753943034462 - endif_8794497434103: + endif_8753943034462: # Loading return value in $v1 - lw $v1, 68($sp) + lw $v1, 92($sp) # Freeing space for local variables - addi $sp, $sp, 72 + addi $sp, $sp, 96 jr $ra function_i2a_aux_at_A2I: # Function parameters - # $ra = 64($sp) - # self = 60($sp) - # i = 56($sp) + # $ra = 88($sp) + # self = 84($sp) + # i = 80($sp) # Reserving space for local variables - addi $sp, $sp, -56 + addi $sp, $sp, -80 # Allocating Bool 0 li $v0, 9 @@ -6851,7 +7759,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_1 = address of allocated object Int + sw $v0, 72($sp) # internal_1 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -6863,40 +7771,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_2 = address of allocated object Int + sw $v0, 68($sp) # internal_2 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 68($sp) + lw $t0, 92($sp) sw $t0, 4($sp) # Storing i # Argument internal_2 - lw $t0, 56($sp) + lw $t0, 80($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 52($sp) # internal_3 = result of function_equal + sw $v1, 76($sp) # internal_3 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_1 = internal_3 - lw $t0, 40($sp) - sw $t0, 48($sp) + lw $t0, 64($sp) + sw $t0, 72($sp) - # If internal_1 then goto then_8794497434733 - lw $t0, 48($sp) # Loading the address of the condition + # If internal_1 then goto then_8753943034576 + lw $t0, 72($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497434733 + beq $t0, $t1, then_8753943034576 - # Jumping to else_8794497434733 - j else_8794497434733 + # Jumping to else_8753943034576 + j else_8753943034576 - then_8794497434733: + then_8753943034576: # Allocating String li $v0, 9 @@ -6911,16 +7819,16 @@ sb $zero, 8($v0) # Null-terminator at the end of the string - sw $v0, 36($sp) # internal_4 = "" + sw $v0, 60($sp) # internal_4 = "" # internal_0 = internal_4 - lw $t0, 36($sp) - sw $t0, 52($sp) + lw $t0, 60($sp) + sw $t0, 76($sp) - # Jumping to endif_8794497434733 - j endif_8794497434733 + # Jumping to endif_8753943034576 + j endif_8753943034576 - else_8794497434733: + else_8753943034576: # Allocating Int 10 li $v0, 9 @@ -6932,24 +7840,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 10 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_6 = address of allocated object Int + sw $v0, 52($sp) # internal_6 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 68($sp) + lw $t0, 92($sp) sw $t0, 4($sp) # Storing i # Argument internal_6 - lw $t0, 40($sp) + lw $t0, 64($sp) sw $t0, 0($sp) # Storing internal_6 # Calling function function_div jal function_div lw $ra, 8($sp) - sw $v1, 36($sp) # internal_7 = result of function_div + sw $v1, 60($sp) # internal_7 = result of function_div addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -6957,35 +7865,59 @@ sw $ra, 8($sp) # Storing return address # Argument next - lw $t0, 44($sp) + lw $t0, 68($sp) sw $t0, 4($sp) # Storing next # Argument internal_7 - lw $t0, 36($sp) + lw $t0, 60($sp) sw $t0, 0($sp) # Storing internal_7 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 44($sp) # next = result of function_assign + sw $v1, 68($sp) # next = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_9 = address of allocated object Int + + # Get method i2a_aux of A2I + lw $t0, 84($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 40($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 36($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 72($sp) + lw $t0, 96($sp) sw $t0, 4($sp) # Storing self # Argument next - lw $t0, 44($sp) + lw $t0, 68($sp) sw $t0, 0($sp) # Storing next - # Calling function function_i2a_aux_at_A2I - jal function_i2a_aux_at_A2I + # Calling function internal_10 + lw $t0, 48($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 32($sp) # internal_8 = result of function_i2a_aux_at_A2I + sw $v1, 56($sp) # internal_8 = result of internal_10 addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 10 @@ -6998,24 +7930,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 10 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_9 = address of allocated object Int + sw $v0, 32($sp) # internal_11 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument next - lw $t0, 44($sp) + lw $t0, 68($sp) sw $t0, 4($sp) # Storing next - # Argument internal_9 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_9 + # Argument internal_11 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_11 # Calling function function_mult jal function_mult lw $ra, 8($sp) - sw $v1, 24($sp) # internal_10 = result of function_mult + sw $v1, 40($sp) # internal_12 = result of function_mult addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -7023,69 +7955,117 @@ sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 68($sp) + lw $t0, 92($sp) sw $t0, 4($sp) # Storing i - # Argument internal_10 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_10 + # Argument internal_12 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_12 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 20($sp) # internal_11 = result of function_sub + sw $v1, 36($sp) # internal_13 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_15 = address of allocated object Int + + # Get method i2c of A2I + lw $t0, 84($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 72($sp) + lw $t0, 96($sp) sw $t0, 4($sp) # Storing self - # Argument internal_11 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_11 + # Argument internal_13 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_13 - # Calling function function_i2c_at_A2I - jal function_i2c_at_A2I + # Calling function internal_16 + lw $t0, 24($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 16($sp) # internal_12 = result of function_i2c_at_A2I + sw $v1, 32($sp) # internal_14 = result of internal_16 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_18 = address of allocated object Int + + # Get method concat of String + lw $t0, 44($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_8 - lw $t0, 32($sp) + lw $t0, 56($sp) sw $t0, 4($sp) # Storing internal_8 - # Argument internal_12 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_12 + # Argument internal_14 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_14 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_19 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_13 = result of function_concat_at_String + sw $v1, 20($sp) # internal_17 = result of internal_19 addi $sp, $sp, 12 # Freeing space for arguments - # internal_0 = internal_13 - lw $t0, 0($sp) - sw $t0, 52($sp) + # internal_0 = internal_17 + lw $t0, 8($sp) + sw $t0, 76($sp) - # Jumping to endif_8794497434733 - j endif_8794497434733 + # Jumping to endif_8753943034576 + j endif_8753943034576 - endif_8794497434733: + endif_8753943034576: # Loading return value in $v1 - lw $v1, 52($sp) + lw $v1, 76($sp) # Freeing space for local variables - addi $sp, $sp, 56 + addi $sp, $sp, 80 jr $ra @@ -7115,17 +8095,17 @@ # Set attribute char of self lw $t0, 16($sp) # $t0 = self lw $t1, 12($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8794497354337 + beq $t1, $zero, object_set_attribute_8753942956644 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8794497354337 + beq $t6, $t5, int_set_attribute_8753942956644 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8794497354337 - j object_set_attribute_8794497354337 - int_set_attribute_8794497354337: + beq $t6, $t5, bool_set_attribute_8753942956644 + j object_set_attribute_8753942956644 + int_set_attribute_8753942956644: li $v0, 9 addi $a0, $zero, 12 syscall @@ -7134,8 +8114,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.char = internal_0 - j end_set_attribute_8794497354337 - bool_set_attribute_8794497354337: + j end_set_attribute_8753942956644 + bool_set_attribute_8753942956644: li $v0, 9 addi $a0, $zero, 12 syscall @@ -7144,10 +8124,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.char = internal_0 - j end_set_attribute_8794497354337 - object_set_attribute_8794497354337: + j end_set_attribute_8753942956644 + object_set_attribute_8753942956644: sw $t1, 8($t0) # self.char = internal_0 - end_set_attribute_8794497354337: + end_set_attribute_8753942956644: # Allocating NUll to internal_1 sw $zero, 8($sp) # internal_1 = 0 @@ -7155,17 +8135,17 @@ # Set attribute avar of self lw $t0, 16($sp) # $t0 = self lw $t1, 8($sp) # $t1 = internal_1 - beq $t1, $zero, object_set_attribute_8794497354358 + beq $t1, $zero, object_set_attribute_8753942956665 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8794497354358 + beq $t6, $t5, int_set_attribute_8753942956665 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8794497354358 - j object_set_attribute_8794497354358 - int_set_attribute_8794497354358: + beq $t6, $t5, bool_set_attribute_8753942956665 + j object_set_attribute_8753942956665 + int_set_attribute_8753942956665: li $v0, 9 addi $a0, $zero, 12 syscall @@ -7174,8 +8154,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.avar = internal_1 - j end_set_attribute_8794497354358 - bool_set_attribute_8794497354358: + j end_set_attribute_8753942956665 + bool_set_attribute_8753942956665: li $v0, 9 addi $a0, $zero, 12 syscall @@ -7184,10 +8164,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.avar = internal_1 - j end_set_attribute_8794497354358 - object_set_attribute_8794497354358: + j end_set_attribute_8753942956665 + object_set_attribute_8753942956665: sw $t1, 12($t0) # self.avar = internal_1 - end_set_attribute_8794497354358: + end_set_attribute_8753942956665: # Allocating NUll to internal_2 sw $zero, 4($sp) # internal_2 = 0 @@ -7195,17 +8175,17 @@ # Set attribute a_var of self lw $t0, 16($sp) # $t0 = self lw $t1, 4($sp) # $t1 = internal_2 - beq $t1, $zero, object_set_attribute_8794497354379 + beq $t1, $zero, object_set_attribute_8753942956686 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8794497354379 + beq $t6, $t5, int_set_attribute_8753942956686 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8794497354379 - j object_set_attribute_8794497354379 - int_set_attribute_8794497354379: + beq $t6, $t5, bool_set_attribute_8753942956686 + j object_set_attribute_8753942956686 + int_set_attribute_8753942956686: li $v0, 9 addi $a0, $zero, 12 syscall @@ -7214,8 +8194,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.a_var = internal_2 - j end_set_attribute_8794497354379 - bool_set_attribute_8794497354379: + j end_set_attribute_8753942956686 + bool_set_attribute_8753942956686: li $v0, 9 addi $a0, $zero, 12 syscall @@ -7224,10 +8204,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.a_var = internal_2 - j end_set_attribute_8794497354379 - object_set_attribute_8794497354379: + j end_set_attribute_8753942956686 + object_set_attribute_8753942956686: sw $t1, 16($t0) # self.a_var = internal_2 - end_set_attribute_8794497354379: + end_set_attribute_8753942956686: # Allocating Bool 1 li $v0, 9 @@ -7244,17 +8224,17 @@ # Set attribute flag of self lw $t0, 16($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_3 - beq $t1, $zero, object_set_attribute_8794497354400 + beq $t1, $zero, object_set_attribute_8753942956707 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8794497354400 + beq $t6, $t5, int_set_attribute_8753942956707 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8794497354400 - j object_set_attribute_8794497354400 - int_set_attribute_8794497354400: + beq $t6, $t5, bool_set_attribute_8753942956707 + j object_set_attribute_8753942956707 + int_set_attribute_8753942956707: li $v0, 9 addi $a0, $zero, 12 syscall @@ -7263,8 +8243,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 20($t0) # self.flag = internal_3 - j end_set_attribute_8794497354400 - bool_set_attribute_8794497354400: + j end_set_attribute_8753942956707 + bool_set_attribute_8753942956707: li $v0, 9 addi $a0, $zero, 12 syscall @@ -7273,10 +8253,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 20($t0) # self.flag = internal_3 - j end_set_attribute_8794497354400 - object_set_attribute_8794497354400: + j end_set_attribute_8753942956707 + object_set_attribute_8753942956707: sw $t1, 20($t0) # self.flag = internal_3 - end_set_attribute_8794497354400: + end_set_attribute_8753942956707: # Loading return value in $v1 lw $v1, 16($sp) @@ -7288,11 +8268,11 @@ function_menu_at_Main: # Function parameters - # $ra = 216($sp) - # self = 212($sp) + # $ra = 432($sp) + # self = 428($sp) # Reserving space for local variables - addi $sp, $sp, -212 + addi $sp, $sp, -428 # Allocating String li $v0, 9 @@ -7370,39 +8350,63 @@ sb $zero, 29($v0) # Null-terminator at the end of the string - sw $v0, 208($sp) # internal_0 = "\n\tTo add a number to " + sw $v0, 424($sp) # internal_0 = "\n\tTo add a number to " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 416($sp) # internal_2 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 416($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 412($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 440($sp) sw $t0, 4($sp) # Storing self # Argument internal_0 - lw $t0, 220($sp) + lw $t0, 436($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_3 + lw $t0, 424($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 216($sp) # internal_1 = result of function_out_string_at_IO + sw $v1, 432($sp) # internal_1 = result of internal_3 addi $sp, $sp, 12 # Freeing space for arguments # Get attribute avar of self - lw $t0, 212($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t0, 428($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497354490 + beq $t6, $t5, int_get_attribute_8753942957337 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497354490 - j object_get_attribute_8794497354490 - int_get_attribute_8794497354490: + beq $t6, $t5, bool_get_attribute_8753942957337 + j object_get_attribute_8753942957337 + int_get_attribute_8753942957337: li $v0, 9 addi $a0, $zero, 12 syscall @@ -7410,9 +8414,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 200($sp) # internal_2 = self.avar - j end_get_attribute_8794497354490 - bool_get_attribute_8794497354490: + sw $v0, 408($sp) # internal_4 = self.avar + j end_get_attribute_8753942957337 + bool_get_attribute_8753942957337: li $v0, 9 addi $a0, $zero, 12 syscall @@ -7420,28 +8424,52 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 200($sp) # internal_2 = self.avar - j end_get_attribute_8794497354490 - object_get_attribute_8794497354490: - sw $t1, 200($sp) # internal_2 = avar - end_get_attribute_8794497354490: + sw $v0, 408($sp) # internal_4 = self.avar + j end_get_attribute_8753942957337 + object_get_attribute_8753942957337: + sw $t1, 408($sp) # internal_4 = self.avar + end_get_attribute_8753942957337: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 400($sp) # internal_6 = address of allocated object Int + + # Get method print of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 400($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 396($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 440($sp) sw $t0, 4($sp) # Storing self - # Argument internal_2 - lw $t0, 212($sp) - sw $t0, 0($sp) # Storing internal_2 + # Argument internal_4 + lw $t0, 420($sp) + sw $t0, 0($sp) # Storing internal_4 - # Calling function function_print_at_Main - jal function_print_at_Main + # Calling function internal_7 + lw $t0, 408($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 208($sp) # internal_3 = result of function_print_at_Main + sw $v1, 416($sp) # internal_5 = result of internal_7 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -7456,61 +8484,85 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 46 - sb $t0, 8($v0) # internal_4[0] = '.' + sb $t0, 8($v0) # internal_8[0] = '.' addi $t0, $zero, 46 - sb $t0, 9($v0) # internal_4[1] = '.' + sb $t0, 9($v0) # internal_8[1] = '.' addi $t0, $zero, 46 - sb $t0, 10($v0) # internal_4[2] = '.' + sb $t0, 10($v0) # internal_8[2] = '.' addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_4[3] = 'e' + sb $t0, 11($v0) # internal_8[3] = 'e' addi $t0, $zero, 110 - sb $t0, 12($v0) # internal_4[4] = 'n' + sb $t0, 12($v0) # internal_8[4] = 'n' addi $t0, $zero, 116 - sb $t0, 13($v0) # internal_4[5] = 't' + sb $t0, 13($v0) # internal_8[5] = 't' addi $t0, $zero, 101 - sb $t0, 14($v0) # internal_4[6] = 'e' + sb $t0, 14($v0) # internal_8[6] = 'e' addi $t0, $zero, 114 - sb $t0, 15($v0) # internal_4[7] = 'r' + sb $t0, 15($v0) # internal_8[7] = 'r' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_4[8] = ' ' + sb $t0, 16($v0) # internal_8[8] = ' ' addi $t0, $zero, 97 - sb $t0, 17($v0) # internal_4[9] = 'a' + sb $t0, 17($v0) # internal_8[9] = 'a' addi $t0, $zero, 58 - sb $t0, 18($v0) # internal_4[10] = ':' + sb $t0, 18($v0) # internal_8[10] = ':' addi $t0, $zero, 10 - sb $t0, 19($v0) # internal_4[11] = '\n' + sb $t0, 19($v0) # internal_8[11] = '\n' sb $zero, 20($v0) # Null-terminator at the end of the string - sw $v0, 192($sp) # internal_4 = "...enter a:\n" + sw $v0, 392($sp) # internal_8 = "...enter a:\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 384($sp) # internal_10 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 384($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 380($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 440($sp) sw $t0, 4($sp) # Storing self - # Argument internal_4 - lw $t0, 204($sp) - sw $t0, 0($sp) # Storing internal_4 + # Argument internal_8 + lw $t0, 404($sp) + sw $t0, 0($sp) # Storing internal_8 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_11 + lw $t0, 392($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 200($sp) # internal_5 = result of function_out_string_at_IO + sw $v1, 400($sp) # internal_9 = result of internal_11 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -7525,73 +8577,97 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_6[0] = '\t' + sb $t0, 8($v0) # internal_12[0] = '\t' addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_6[1] = 'T' + sb $t0, 9($v0) # internal_12[1] = 'T' addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_6[2] = 'o' + sb $t0, 10($v0) # internal_12[2] = 'o' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_6[3] = ' ' + sb $t0, 11($v0) # internal_12[3] = ' ' addi $t0, $zero, 110 - sb $t0, 12($v0) # internal_6[4] = 'n' + sb $t0, 12($v0) # internal_12[4] = 'n' addi $t0, $zero, 101 - sb $t0, 13($v0) # internal_6[5] = 'e' + sb $t0, 13($v0) # internal_12[5] = 'e' addi $t0, $zero, 103 - sb $t0, 14($v0) # internal_6[6] = 'g' + sb $t0, 14($v0) # internal_12[6] = 'g' addi $t0, $zero, 97 - sb $t0, 15($v0) # internal_6[7] = 'a' + sb $t0, 15($v0) # internal_12[7] = 'a' addi $t0, $zero, 116 - sb $t0, 16($v0) # internal_6[8] = 't' + sb $t0, 16($v0) # internal_12[8] = 't' addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_6[9] = 'e' + sb $t0, 17($v0) # internal_12[9] = 'e' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_6[10] = ' ' + sb $t0, 18($v0) # internal_12[10] = ' ' sb $zero, 19($v0) # Null-terminator at the end of the string - sw $v0, 184($sp) # internal_6 = "\tTo negate " + sw $v0, 376($sp) # internal_12 = "\tTo negate " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 368($sp) # internal_14 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 368($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 364($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 440($sp) sw $t0, 4($sp) # Storing self - # Argument internal_6 - lw $t0, 196($sp) - sw $t0, 0($sp) # Storing internal_6 + # Argument internal_12 + lw $t0, 388($sp) + sw $t0, 0($sp) # Storing internal_12 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_15 + lw $t0, 376($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 192($sp) # internal_7 = result of function_out_string_at_IO + sw $v1, 384($sp) # internal_13 = result of internal_15 addi $sp, $sp, 12 # Freeing space for arguments # Get attribute avar of self - lw $t0, 212($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t0, 428($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497355370 + beq $t6, $t5, int_get_attribute_8753942957517 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497355370 - j object_get_attribute_8794497355370 - int_get_attribute_8794497355370: + beq $t6, $t5, bool_get_attribute_8753942957517 + j object_get_attribute_8753942957517 + int_get_attribute_8753942957517: li $v0, 9 addi $a0, $zero, 12 syscall @@ -7599,9 +8675,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 176($sp) # internal_8 = self.avar - j end_get_attribute_8794497355370 - bool_get_attribute_8794497355370: + sw $v0, 360($sp) # internal_16 = self.avar + j end_get_attribute_8753942957517 + bool_get_attribute_8753942957517: li $v0, 9 addi $a0, $zero, 12 syscall @@ -7609,28 +8685,52 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 176($sp) # internal_8 = self.avar - j end_get_attribute_8794497355370 - object_get_attribute_8794497355370: - sw $t1, 176($sp) # internal_8 = avar - end_get_attribute_8794497355370: + sw $v0, 360($sp) # internal_16 = self.avar + j end_get_attribute_8753942957517 + object_get_attribute_8753942957517: + sw $t1, 360($sp) # internal_16 = self.avar + end_get_attribute_8753942957517: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 352($sp) # internal_18 = address of allocated object Int + + # Get method print of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 352($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 348($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 440($sp) sw $t0, 4($sp) # Storing self - # Argument internal_8 - lw $t0, 188($sp) - sw $t0, 0($sp) # Storing internal_8 + # Argument internal_16 + lw $t0, 372($sp) + sw $t0, 0($sp) # Storing internal_16 - # Calling function function_print_at_Main - jal function_print_at_Main + # Calling function internal_19 + lw $t0, 360($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 184($sp) # internal_9 = result of function_print_at_Main + sw $v1, 368($sp) # internal_17 = result of internal_19 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -7645,61 +8745,85 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 46 - sb $t0, 8($v0) # internal_10[0] = '.' + sb $t0, 8($v0) # internal_20[0] = '.' addi $t0, $zero, 46 - sb $t0, 9($v0) # internal_10[1] = '.' + sb $t0, 9($v0) # internal_20[1] = '.' addi $t0, $zero, 46 - sb $t0, 10($v0) # internal_10[2] = '.' + sb $t0, 10($v0) # internal_20[2] = '.' addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_10[3] = 'e' + sb $t0, 11($v0) # internal_20[3] = 'e' addi $t0, $zero, 110 - sb $t0, 12($v0) # internal_10[4] = 'n' + sb $t0, 12($v0) # internal_20[4] = 'n' addi $t0, $zero, 116 - sb $t0, 13($v0) # internal_10[5] = 't' + sb $t0, 13($v0) # internal_20[5] = 't' addi $t0, $zero, 101 - sb $t0, 14($v0) # internal_10[6] = 'e' + sb $t0, 14($v0) # internal_20[6] = 'e' addi $t0, $zero, 114 - sb $t0, 15($v0) # internal_10[7] = 'r' + sb $t0, 15($v0) # internal_20[7] = 'r' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_10[8] = ' ' + sb $t0, 16($v0) # internal_20[8] = ' ' addi $t0, $zero, 98 - sb $t0, 17($v0) # internal_10[9] = 'b' + sb $t0, 17($v0) # internal_20[9] = 'b' addi $t0, $zero, 58 - sb $t0, 18($v0) # internal_10[10] = ':' + sb $t0, 18($v0) # internal_20[10] = ':' addi $t0, $zero, 10 - sb $t0, 19($v0) # internal_10[11] = '\n' + sb $t0, 19($v0) # internal_20[11] = '\n' sb $zero, 20($v0) # Null-terminator at the end of the string - sw $v0, 168($sp) # internal_10 = "...enter b:\n" + sw $v0, 344($sp) # internal_20 = "...enter b:\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 336($sp) # internal_22 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 336($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 332($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 440($sp) sw $t0, 4($sp) # Storing self - # Argument internal_10 - lw $t0, 180($sp) - sw $t0, 0($sp) # Storing internal_10 + # Argument internal_20 + lw $t0, 356($sp) + sw $t0, 0($sp) # Storing internal_20 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_23 + lw $t0, 344($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 176($sp) # internal_11 = result of function_out_string_at_IO + sw $v1, 352($sp) # internal_21 = result of internal_23 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -7714,136 +8838,160 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_12[0] = '\t' + sb $t0, 8($v0) # internal_24[0] = '\t' addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_12[1] = 'T' + sb $t0, 9($v0) # internal_24[1] = 'T' addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_12[2] = 'o' + sb $t0, 10($v0) # internal_24[2] = 'o' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_12[3] = ' ' + sb $t0, 11($v0) # internal_24[3] = ' ' addi $t0, $zero, 102 - sb $t0, 12($v0) # internal_12[4] = 'f' + sb $t0, 12($v0) # internal_24[4] = 'f' addi $t0, $zero, 105 - sb $t0, 13($v0) # internal_12[5] = 'i' + sb $t0, 13($v0) # internal_24[5] = 'i' addi $t0, $zero, 110 - sb $t0, 14($v0) # internal_12[6] = 'n' + sb $t0, 14($v0) # internal_24[6] = 'n' addi $t0, $zero, 100 - sb $t0, 15($v0) # internal_12[7] = 'd' + sb $t0, 15($v0) # internal_24[7] = 'd' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_12[8] = ' ' + sb $t0, 16($v0) # internal_24[8] = ' ' addi $t0, $zero, 116 - sb $t0, 17($v0) # internal_12[9] = 't' + sb $t0, 17($v0) # internal_24[9] = 't' addi $t0, $zero, 104 - sb $t0, 18($v0) # internal_12[10] = 'h' + sb $t0, 18($v0) # internal_24[10] = 'h' addi $t0, $zero, 101 - sb $t0, 19($v0) # internal_12[11] = 'e' + sb $t0, 19($v0) # internal_24[11] = 'e' addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_12[12] = ' ' + sb $t0, 20($v0) # internal_24[12] = ' ' addi $t0, $zero, 100 - sb $t0, 21($v0) # internal_12[13] = 'd' + sb $t0, 21($v0) # internal_24[13] = 'd' addi $t0, $zero, 105 - sb $t0, 22($v0) # internal_12[14] = 'i' + sb $t0, 22($v0) # internal_24[14] = 'i' addi $t0, $zero, 102 - sb $t0, 23($v0) # internal_12[15] = 'f' + sb $t0, 23($v0) # internal_24[15] = 'f' addi $t0, $zero, 102 - sb $t0, 24($v0) # internal_12[16] = 'f' + sb $t0, 24($v0) # internal_24[16] = 'f' addi $t0, $zero, 101 - sb $t0, 25($v0) # internal_12[17] = 'e' + sb $t0, 25($v0) # internal_24[17] = 'e' addi $t0, $zero, 114 - sb $t0, 26($v0) # internal_12[18] = 'r' + sb $t0, 26($v0) # internal_24[18] = 'r' addi $t0, $zero, 101 - sb $t0, 27($v0) # internal_12[19] = 'e' + sb $t0, 27($v0) # internal_24[19] = 'e' addi $t0, $zero, 110 - sb $t0, 28($v0) # internal_12[20] = 'n' + sb $t0, 28($v0) # internal_24[20] = 'n' addi $t0, $zero, 99 - sb $t0, 29($v0) # internal_12[21] = 'c' + sb $t0, 29($v0) # internal_24[21] = 'c' addi $t0, $zero, 101 - sb $t0, 30($v0) # internal_12[22] = 'e' + sb $t0, 30($v0) # internal_24[22] = 'e' addi $t0, $zero, 32 - sb $t0, 31($v0) # internal_12[23] = ' ' + sb $t0, 31($v0) # internal_24[23] = ' ' addi $t0, $zero, 98 - sb $t0, 32($v0) # internal_12[24] = 'b' + sb $t0, 32($v0) # internal_24[24] = 'b' addi $t0, $zero, 101 - sb $t0, 33($v0) # internal_12[25] = 'e' + sb $t0, 33($v0) # internal_24[25] = 'e' addi $t0, $zero, 116 - sb $t0, 34($v0) # internal_12[26] = 't' + sb $t0, 34($v0) # internal_24[26] = 't' addi $t0, $zero, 119 - sb $t0, 35($v0) # internal_12[27] = 'w' + sb $t0, 35($v0) # internal_24[27] = 'w' addi $t0, $zero, 101 - sb $t0, 36($v0) # internal_12[28] = 'e' + sb $t0, 36($v0) # internal_24[28] = 'e' addi $t0, $zero, 101 - sb $t0, 37($v0) # internal_12[29] = 'e' + sb $t0, 37($v0) # internal_24[29] = 'e' addi $t0, $zero, 110 - sb $t0, 38($v0) # internal_12[30] = 'n' + sb $t0, 38($v0) # internal_24[30] = 'n' addi $t0, $zero, 32 - sb $t0, 39($v0) # internal_12[31] = ' ' + sb $t0, 39($v0) # internal_24[31] = ' ' sb $zero, 40($v0) # Null-terminator at the end of the string - sw $v0, 160($sp) # internal_12 = "\tTo find the difference between " + sw $v0, 328($sp) # internal_24 = "\tTo find the difference between " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 320($sp) # internal_26 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 320($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 316($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 440($sp) sw $t0, 4($sp) # Storing self - # Argument internal_12 - lw $t0, 172($sp) - sw $t0, 0($sp) # Storing internal_12 + # Argument internal_24 + lw $t0, 340($sp) + sw $t0, 0($sp) # Storing internal_24 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_27 + lw $t0, 328($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 168($sp) # internal_13 = result of function_out_string_at_IO + sw $v1, 336($sp) # internal_25 = result of internal_27 addi $sp, $sp, 12 # Freeing space for arguments # Get attribute avar of self - lw $t0, 212($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t0, 428($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497355478 + beq $t6, $t5, int_get_attribute_8753942958469 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497355478 - j object_get_attribute_8794497355478 - int_get_attribute_8794497355478: + beq $t6, $t5, bool_get_attribute_8753942958469 + j object_get_attribute_8753942958469 + int_get_attribute_8753942958469: li $v0, 9 addi $a0, $zero, 12 syscall @@ -7851,9 +8999,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 152($sp) # internal_14 = self.avar - j end_get_attribute_8794497355478 - bool_get_attribute_8794497355478: + sw $v0, 312($sp) # internal_28 = self.avar + j end_get_attribute_8753942958469 + bool_get_attribute_8753942958469: li $v0, 9 addi $a0, $zero, 12 syscall @@ -7861,28 +9009,52 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 152($sp) # internal_14 = self.avar - j end_get_attribute_8794497355478 - object_get_attribute_8794497355478: - sw $t1, 152($sp) # internal_14 = avar - end_get_attribute_8794497355478: + sw $v0, 312($sp) # internal_28 = self.avar + j end_get_attribute_8753942958469 + object_get_attribute_8753942958469: + sw $t1, 312($sp) # internal_28 = self.avar + end_get_attribute_8753942958469: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 304($sp) # internal_30 = address of allocated object Int + + # Get method print of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 304($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 300($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 440($sp) sw $t0, 4($sp) # Storing self - # Argument internal_14 - lw $t0, 164($sp) - sw $t0, 0($sp) # Storing internal_14 + # Argument internal_28 + lw $t0, 324($sp) + sw $t0, 0($sp) # Storing internal_28 - # Calling function function_print_at_Main - jal function_print_at_Main + # Calling function internal_31 + lw $t0, 312($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 160($sp) # internal_15 = result of function_print_at_Main + sw $v1, 320($sp) # internal_29 = result of internal_31 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -7897,115 +9069,139 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 97 - sb $t0, 8($v0) # internal_16[0] = 'a' + sb $t0, 8($v0) # internal_32[0] = 'a' addi $t0, $zero, 110 - sb $t0, 9($v0) # internal_16[1] = 'n' + sb $t0, 9($v0) # internal_32[1] = 'n' addi $t0, $zero, 100 - sb $t0, 10($v0) # internal_16[2] = 'd' + sb $t0, 10($v0) # internal_32[2] = 'd' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_16[3] = ' ' + sb $t0, 11($v0) # internal_32[3] = ' ' addi $t0, $zero, 97 - sb $t0, 12($v0) # internal_16[4] = 'a' + sb $t0, 12($v0) # internal_32[4] = 'a' addi $t0, $zero, 110 - sb $t0, 13($v0) # internal_16[5] = 'n' + sb $t0, 13($v0) # internal_32[5] = 'n' addi $t0, $zero, 111 - sb $t0, 14($v0) # internal_16[6] = 'o' + sb $t0, 14($v0) # internal_32[6] = 'o' addi $t0, $zero, 116 - sb $t0, 15($v0) # internal_16[7] = 't' + sb $t0, 15($v0) # internal_32[7] = 't' addi $t0, $zero, 104 - sb $t0, 16($v0) # internal_16[8] = 'h' + sb $t0, 16($v0) # internal_32[8] = 'h' addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_16[9] = 'e' + sb $t0, 17($v0) # internal_32[9] = 'e' addi $t0, $zero, 114 - sb $t0, 18($v0) # internal_16[10] = 'r' + sb $t0, 18($v0) # internal_32[10] = 'r' addi $t0, $zero, 32 - sb $t0, 19($v0) # internal_16[11] = ' ' + sb $t0, 19($v0) # internal_32[11] = ' ' addi $t0, $zero, 110 - sb $t0, 20($v0) # internal_16[12] = 'n' + sb $t0, 20($v0) # internal_32[12] = 'n' addi $t0, $zero, 117 - sb $t0, 21($v0) # internal_16[13] = 'u' + sb $t0, 21($v0) # internal_32[13] = 'u' addi $t0, $zero, 109 - sb $t0, 22($v0) # internal_16[14] = 'm' + sb $t0, 22($v0) # internal_32[14] = 'm' addi $t0, $zero, 98 - sb $t0, 23($v0) # internal_16[15] = 'b' + sb $t0, 23($v0) # internal_32[15] = 'b' addi $t0, $zero, 101 - sb $t0, 24($v0) # internal_16[16] = 'e' + sb $t0, 24($v0) # internal_32[16] = 'e' addi $t0, $zero, 114 - sb $t0, 25($v0) # internal_16[17] = 'r' + sb $t0, 25($v0) # internal_32[17] = 'r' addi $t0, $zero, 46 - sb $t0, 26($v0) # internal_16[18] = '.' + sb $t0, 26($v0) # internal_32[18] = '.' addi $t0, $zero, 46 - sb $t0, 27($v0) # internal_16[19] = '.' + sb $t0, 27($v0) # internal_32[19] = '.' addi $t0, $zero, 46 - sb $t0, 28($v0) # internal_16[20] = '.' + sb $t0, 28($v0) # internal_32[20] = '.' addi $t0, $zero, 101 - sb $t0, 29($v0) # internal_16[21] = 'e' + sb $t0, 29($v0) # internal_32[21] = 'e' addi $t0, $zero, 110 - sb $t0, 30($v0) # internal_16[22] = 'n' + sb $t0, 30($v0) # internal_32[22] = 'n' addi $t0, $zero, 116 - sb $t0, 31($v0) # internal_16[23] = 't' + sb $t0, 31($v0) # internal_32[23] = 't' addi $t0, $zero, 101 - sb $t0, 32($v0) # internal_16[24] = 'e' + sb $t0, 32($v0) # internal_32[24] = 'e' addi $t0, $zero, 114 - sb $t0, 33($v0) # internal_16[25] = 'r' + sb $t0, 33($v0) # internal_32[25] = 'r' addi $t0, $zero, 32 - sb $t0, 34($v0) # internal_16[26] = ' ' + sb $t0, 34($v0) # internal_32[26] = ' ' addi $t0, $zero, 99 - sb $t0, 35($v0) # internal_16[27] = 'c' + sb $t0, 35($v0) # internal_32[27] = 'c' addi $t0, $zero, 58 - sb $t0, 36($v0) # internal_16[28] = ':' + sb $t0, 36($v0) # internal_32[28] = ':' addi $t0, $zero, 10 - sb $t0, 37($v0) # internal_16[29] = '\n' + sb $t0, 37($v0) # internal_32[29] = '\n' sb $zero, 38($v0) # Null-terminator at the end of the string - sw $v0, 144($sp) # internal_16 = "and another number...enter c:\n" + sw $v0, 296($sp) # internal_32 = "and another number...enter c:\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 288($sp) # internal_34 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 288($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 284($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 440($sp) sw $t0, 4($sp) # Storing self - # Argument internal_16 - lw $t0, 156($sp) - sw $t0, 0($sp) # Storing internal_16 + # Argument internal_32 + lw $t0, 308($sp) + sw $t0, 0($sp) # Storing internal_32 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_35 + lw $t0, 296($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 152($sp) # internal_17 = result of function_out_string_at_IO + sw $v1, 304($sp) # internal_33 = result of internal_35 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -8020,118 +9216,142 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_18[0] = '\t' + sb $t0, 8($v0) # internal_36[0] = '\t' addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_18[1] = 'T' + sb $t0, 9($v0) # internal_36[1] = 'T' addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_18[2] = 'o' + sb $t0, 10($v0) # internal_36[2] = 'o' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_18[3] = ' ' + sb $t0, 11($v0) # internal_36[3] = ' ' addi $t0, $zero, 102 - sb $t0, 12($v0) # internal_18[4] = 'f' + sb $t0, 12($v0) # internal_36[4] = 'f' addi $t0, $zero, 105 - sb $t0, 13($v0) # internal_18[5] = 'i' + sb $t0, 13($v0) # internal_36[5] = 'i' addi $t0, $zero, 110 - sb $t0, 14($v0) # internal_18[6] = 'n' + sb $t0, 14($v0) # internal_36[6] = 'n' addi $t0, $zero, 100 - sb $t0, 15($v0) # internal_18[7] = 'd' + sb $t0, 15($v0) # internal_36[7] = 'd' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_18[8] = ' ' + sb $t0, 16($v0) # internal_36[8] = ' ' addi $t0, $zero, 116 - sb $t0, 17($v0) # internal_18[9] = 't' + sb $t0, 17($v0) # internal_36[9] = 't' addi $t0, $zero, 104 - sb $t0, 18($v0) # internal_18[10] = 'h' + sb $t0, 18($v0) # internal_36[10] = 'h' addi $t0, $zero, 101 - sb $t0, 19($v0) # internal_18[11] = 'e' + sb $t0, 19($v0) # internal_36[11] = 'e' addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_18[12] = ' ' + sb $t0, 20($v0) # internal_36[12] = ' ' addi $t0, $zero, 102 - sb $t0, 21($v0) # internal_18[13] = 'f' + sb $t0, 21($v0) # internal_36[13] = 'f' addi $t0, $zero, 97 - sb $t0, 22($v0) # internal_18[14] = 'a' + sb $t0, 22($v0) # internal_36[14] = 'a' addi $t0, $zero, 99 - sb $t0, 23($v0) # internal_18[15] = 'c' + sb $t0, 23($v0) # internal_36[15] = 'c' addi $t0, $zero, 116 - sb $t0, 24($v0) # internal_18[16] = 't' + sb $t0, 24($v0) # internal_36[16] = 't' addi $t0, $zero, 111 - sb $t0, 25($v0) # internal_18[17] = 'o' + sb $t0, 25($v0) # internal_36[17] = 'o' addi $t0, $zero, 114 - sb $t0, 26($v0) # internal_18[18] = 'r' + sb $t0, 26($v0) # internal_36[18] = 'r' addi $t0, $zero, 105 - sb $t0, 27($v0) # internal_18[19] = 'i' + sb $t0, 27($v0) # internal_36[19] = 'i' addi $t0, $zero, 97 - sb $t0, 28($v0) # internal_18[20] = 'a' + sb $t0, 28($v0) # internal_36[20] = 'a' addi $t0, $zero, 108 - sb $t0, 29($v0) # internal_18[21] = 'l' + sb $t0, 29($v0) # internal_36[21] = 'l' addi $t0, $zero, 32 - sb $t0, 30($v0) # internal_18[22] = ' ' + sb $t0, 30($v0) # internal_36[22] = ' ' addi $t0, $zero, 111 - sb $t0, 31($v0) # internal_18[23] = 'o' + sb $t0, 31($v0) # internal_36[23] = 'o' addi $t0, $zero, 102 - sb $t0, 32($v0) # internal_18[24] = 'f' + sb $t0, 32($v0) # internal_36[24] = 'f' addi $t0, $zero, 32 - sb $t0, 33($v0) # internal_18[25] = ' ' + sb $t0, 33($v0) # internal_36[25] = ' ' sb $zero, 34($v0) # Null-terminator at the end of the string - sw $v0, 136($sp) # internal_18 = "\tTo find the factorial of " + sw $v0, 280($sp) # internal_36 = "\tTo find the factorial of " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 272($sp) # internal_38 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 272($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 268($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 440($sp) sw $t0, 4($sp) # Storing self - # Argument internal_18 - lw $t0, 148($sp) - sw $t0, 0($sp) # Storing internal_18 + # Argument internal_36 + lw $t0, 292($sp) + sw $t0, 0($sp) # Storing internal_36 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_39 + lw $t0, 280($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 144($sp) # internal_19 = result of function_out_string_at_IO + sw $v1, 288($sp) # internal_37 = result of internal_39 addi $sp, $sp, 12 # Freeing space for arguments # Get attribute avar of self - lw $t0, 212($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t0, 428($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497355846 + beq $t6, $t5, int_get_attribute_8753942958909 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497355846 - j object_get_attribute_8794497355846 - int_get_attribute_8794497355846: + beq $t6, $t5, bool_get_attribute_8753942958909 + j object_get_attribute_8753942958909 + int_get_attribute_8753942958909: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8139,9 +9359,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 128($sp) # internal_20 = self.avar - j end_get_attribute_8794497355846 - bool_get_attribute_8794497355846: + sw $v0, 264($sp) # internal_40 = self.avar + j end_get_attribute_8753942958909 + bool_get_attribute_8753942958909: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8149,28 +9369,52 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 128($sp) # internal_20 = self.avar - j end_get_attribute_8794497355846 - object_get_attribute_8794497355846: - sw $t1, 128($sp) # internal_20 = avar - end_get_attribute_8794497355846: + sw $v0, 264($sp) # internal_40 = self.avar + j end_get_attribute_8753942958909 + object_get_attribute_8753942958909: + sw $t1, 264($sp) # internal_40 = self.avar + end_get_attribute_8753942958909: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 256($sp) # internal_42 = address of allocated object Int + + # Get method print of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 256($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 252($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 440($sp) sw $t0, 4($sp) # Storing self - # Argument internal_20 - lw $t0, 140($sp) - sw $t0, 0($sp) # Storing internal_20 + # Argument internal_40 + lw $t0, 276($sp) + sw $t0, 0($sp) # Storing internal_40 - # Calling function function_print_at_Main - jal function_print_at_Main + # Calling function internal_43 + lw $t0, 264($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 136($sp) # internal_21 = result of function_print_at_Main + sw $v1, 272($sp) # internal_41 = result of internal_43 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -8185,61 +9429,85 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 46 - sb $t0, 8($v0) # internal_22[0] = '.' + sb $t0, 8($v0) # internal_44[0] = '.' addi $t0, $zero, 46 - sb $t0, 9($v0) # internal_22[1] = '.' + sb $t0, 9($v0) # internal_44[1] = '.' addi $t0, $zero, 46 - sb $t0, 10($v0) # internal_22[2] = '.' + sb $t0, 10($v0) # internal_44[2] = '.' addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_22[3] = 'e' + sb $t0, 11($v0) # internal_44[3] = 'e' addi $t0, $zero, 110 - sb $t0, 12($v0) # internal_22[4] = 'n' + sb $t0, 12($v0) # internal_44[4] = 'n' addi $t0, $zero, 116 - sb $t0, 13($v0) # internal_22[5] = 't' + sb $t0, 13($v0) # internal_44[5] = 't' addi $t0, $zero, 101 - sb $t0, 14($v0) # internal_22[6] = 'e' + sb $t0, 14($v0) # internal_44[6] = 'e' addi $t0, $zero, 114 - sb $t0, 15($v0) # internal_22[7] = 'r' + sb $t0, 15($v0) # internal_44[7] = 'r' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_22[8] = ' ' + sb $t0, 16($v0) # internal_44[8] = ' ' addi $t0, $zero, 100 - sb $t0, 17($v0) # internal_22[9] = 'd' + sb $t0, 17($v0) # internal_44[9] = 'd' addi $t0, $zero, 58 - sb $t0, 18($v0) # internal_22[10] = ':' + sb $t0, 18($v0) # internal_44[10] = ':' addi $t0, $zero, 10 - sb $t0, 19($v0) # internal_22[11] = '\n' + sb $t0, 19($v0) # internal_44[11] = '\n' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 248($sp) # internal_44 = "...enter d:\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall - sb $zero, 20($v0) # Null-terminator at the end of the string + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 240($sp) # internal_46 = address of allocated object Int - sw $v0, 120($sp) # internal_22 = "...enter d:\n" + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 240($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 236($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 440($sp) sw $t0, 4($sp) # Storing self - # Argument internal_22 - lw $t0, 132($sp) - sw $t0, 0($sp) # Storing internal_22 + # Argument internal_44 + lw $t0, 260($sp) + sw $t0, 0($sp) # Storing internal_44 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_47 + lw $t0, 248($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 128($sp) # internal_23 = result of function_out_string_at_IO + sw $v1, 256($sp) # internal_45 = result of internal_47 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -8254,73 +9522,97 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_24[0] = '\t' + sb $t0, 8($v0) # internal_48[0] = '\t' addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_24[1] = 'T' + sb $t0, 9($v0) # internal_48[1] = 'T' addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_24[2] = 'o' + sb $t0, 10($v0) # internal_48[2] = 'o' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_24[3] = ' ' + sb $t0, 11($v0) # internal_48[3] = ' ' addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_24[4] = 's' + sb $t0, 12($v0) # internal_48[4] = 's' addi $t0, $zero, 113 - sb $t0, 13($v0) # internal_24[5] = 'q' + sb $t0, 13($v0) # internal_48[5] = 'q' addi $t0, $zero, 117 - sb $t0, 14($v0) # internal_24[6] = 'u' + sb $t0, 14($v0) # internal_48[6] = 'u' addi $t0, $zero, 97 - sb $t0, 15($v0) # internal_24[7] = 'a' + sb $t0, 15($v0) # internal_48[7] = 'a' addi $t0, $zero, 114 - sb $t0, 16($v0) # internal_24[8] = 'r' + sb $t0, 16($v0) # internal_48[8] = 'r' addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_24[9] = 'e' + sb $t0, 17($v0) # internal_48[9] = 'e' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_24[10] = ' ' + sb $t0, 18($v0) # internal_48[10] = ' ' sb $zero, 19($v0) # Null-terminator at the end of the string - sw $v0, 112($sp) # internal_24 = "\tTo square " + sw $v0, 232($sp) # internal_48 = "\tTo square " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 224($sp) # internal_50 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 224($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 220($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 440($sp) sw $t0, 4($sp) # Storing self - # Argument internal_24 - lw $t0, 124($sp) - sw $t0, 0($sp) # Storing internal_24 + # Argument internal_48 + lw $t0, 244($sp) + sw $t0, 0($sp) # Storing internal_48 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_51 + lw $t0, 232($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 120($sp) # internal_25 = result of function_out_string_at_IO + sw $v1, 240($sp) # internal_49 = result of internal_51 addi $sp, $sp, 12 # Freeing space for arguments # Get attribute avar of self - lw $t0, 212($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t0, 428($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497355954 + beq $t6, $t5, int_get_attribute_8753942959089 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497355954 - j object_get_attribute_8794497355954 - int_get_attribute_8794497355954: + beq $t6, $t5, bool_get_attribute_8753942959089 + j object_get_attribute_8753942959089 + int_get_attribute_8753942959089: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8328,9 +9620,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 104($sp) # internal_26 = self.avar - j end_get_attribute_8794497355954 - bool_get_attribute_8794497355954: + sw $v0, 216($sp) # internal_52 = self.avar + j end_get_attribute_8753942959089 + bool_get_attribute_8753942959089: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8338,28 +9630,52 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 104($sp) # internal_26 = self.avar - j end_get_attribute_8794497355954 - object_get_attribute_8794497355954: - sw $t1, 104($sp) # internal_26 = avar - end_get_attribute_8794497355954: + sw $v0, 216($sp) # internal_52 = self.avar + j end_get_attribute_8753942959089 + object_get_attribute_8753942959089: + sw $t1, 216($sp) # internal_52 = self.avar + end_get_attribute_8753942959089: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 208($sp) # internal_54 = address of allocated object Int + + # Get method print of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 208($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 204($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 440($sp) sw $t0, 4($sp) # Storing self - # Argument internal_26 - lw $t0, 116($sp) - sw $t0, 0($sp) # Storing internal_26 + # Argument internal_52 + lw $t0, 228($sp) + sw $t0, 0($sp) # Storing internal_52 - # Calling function function_print_at_Main - jal function_print_at_Main + # Calling function internal_55 + lw $t0, 216($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 112($sp) # internal_27 = result of function_print_at_Main + sw $v1, 224($sp) # internal_53 = result of internal_55 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -8374,61 +9690,85 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 46 - sb $t0, 8($v0) # internal_28[0] = '.' + sb $t0, 8($v0) # internal_56[0] = '.' addi $t0, $zero, 46 - sb $t0, 9($v0) # internal_28[1] = '.' + sb $t0, 9($v0) # internal_56[1] = '.' addi $t0, $zero, 46 - sb $t0, 10($v0) # internal_28[2] = '.' + sb $t0, 10($v0) # internal_56[2] = '.' addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_28[3] = 'e' + sb $t0, 11($v0) # internal_56[3] = 'e' addi $t0, $zero, 110 - sb $t0, 12($v0) # internal_28[4] = 'n' + sb $t0, 12($v0) # internal_56[4] = 'n' addi $t0, $zero, 116 - sb $t0, 13($v0) # internal_28[5] = 't' + sb $t0, 13($v0) # internal_56[5] = 't' addi $t0, $zero, 101 - sb $t0, 14($v0) # internal_28[6] = 'e' + sb $t0, 14($v0) # internal_56[6] = 'e' addi $t0, $zero, 114 - sb $t0, 15($v0) # internal_28[7] = 'r' + sb $t0, 15($v0) # internal_56[7] = 'r' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_28[8] = ' ' + sb $t0, 16($v0) # internal_56[8] = ' ' addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_28[9] = 'e' + sb $t0, 17($v0) # internal_56[9] = 'e' addi $t0, $zero, 58 - sb $t0, 18($v0) # internal_28[10] = ':' + sb $t0, 18($v0) # internal_56[10] = ':' addi $t0, $zero, 10 - sb $t0, 19($v0) # internal_28[11] = '\n' + sb $t0, 19($v0) # internal_56[11] = '\n' sb $zero, 20($v0) # Null-terminator at the end of the string - sw $v0, 96($sp) # internal_28 = "...enter e:\n" + sw $v0, 200($sp) # internal_56 = "...enter e:\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 192($sp) # internal_58 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 192($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 188($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 440($sp) sw $t0, 4($sp) # Storing self - # Argument internal_28 - lw $t0, 108($sp) - sw $t0, 0($sp) # Storing internal_28 + # Argument internal_56 + lw $t0, 212($sp) + sw $t0, 0($sp) # Storing internal_56 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_59 + lw $t0, 200($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 104($sp) # internal_29 = result of function_out_string_at_IO + sw $v1, 208($sp) # internal_57 = result of internal_59 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -8443,67 +9783,91 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_30[0] = '\t' + sb $t0, 8($v0) # internal_60[0] = '\t' addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_30[1] = 'T' + sb $t0, 9($v0) # internal_60[1] = 'T' addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_30[2] = 'o' + sb $t0, 10($v0) # internal_60[2] = 'o' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_30[3] = ' ' + sb $t0, 11($v0) # internal_60[3] = ' ' addi $t0, $zero, 99 - sb $t0, 12($v0) # internal_30[4] = 'c' + sb $t0, 12($v0) # internal_60[4] = 'c' addi $t0, $zero, 117 - sb $t0, 13($v0) # internal_30[5] = 'u' + sb $t0, 13($v0) # internal_60[5] = 'u' addi $t0, $zero, 98 - sb $t0, 14($v0) # internal_30[6] = 'b' + sb $t0, 14($v0) # internal_60[6] = 'b' addi $t0, $zero, 101 - sb $t0, 15($v0) # internal_30[7] = 'e' + sb $t0, 15($v0) # internal_60[7] = 'e' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_30[8] = ' ' + sb $t0, 16($v0) # internal_60[8] = ' ' sb $zero, 17($v0) # Null-terminator at the end of the string - sw $v0, 88($sp) # internal_30 = "\tTo cube " + sw $v0, 184($sp) # internal_60 = "\tTo cube " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 176($sp) # internal_62 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 176($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 172($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 440($sp) sw $t0, 4($sp) # Storing self - # Argument internal_30 - lw $t0, 100($sp) - sw $t0, 0($sp) # Storing internal_30 + # Argument internal_60 + lw $t0, 196($sp) + sw $t0, 0($sp) # Storing internal_60 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_63 + lw $t0, 184($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 96($sp) # internal_31 = result of function_out_string_at_IO + sw $v1, 192($sp) # internal_61 = result of internal_63 addi $sp, $sp, 12 # Freeing space for arguments # Get attribute avar of self - lw $t0, 212($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t0, 428($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497356322 + beq $t6, $t5, int_get_attribute_8753942959529 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497356322 - j object_get_attribute_8794497356322 - int_get_attribute_8794497356322: + beq $t6, $t5, bool_get_attribute_8753942959529 + j object_get_attribute_8753942959529 + int_get_attribute_8753942959529: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8511,9 +9875,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 80($sp) # internal_32 = self.avar - j end_get_attribute_8794497356322 - bool_get_attribute_8794497356322: + sw $v0, 168($sp) # internal_64 = self.avar + j end_get_attribute_8753942959529 + bool_get_attribute_8753942959529: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8521,28 +9885,52 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 80($sp) # internal_32 = self.avar - j end_get_attribute_8794497356322 - object_get_attribute_8794497356322: - sw $t1, 80($sp) # internal_32 = avar - end_get_attribute_8794497356322: + sw $v0, 168($sp) # internal_64 = self.avar + j end_get_attribute_8753942959529 + object_get_attribute_8753942959529: + sw $t1, 168($sp) # internal_64 = self.avar + end_get_attribute_8753942959529: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_66 = address of allocated object Int + + # Get method print of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 160($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 156($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 440($sp) sw $t0, 4($sp) # Storing self - # Argument internal_32 - lw $t0, 92($sp) - sw $t0, 0($sp) # Storing internal_32 + # Argument internal_64 + lw $t0, 180($sp) + sw $t0, 0($sp) # Storing internal_64 - # Calling function function_print_at_Main - jal function_print_at_Main + # Calling function internal_67 + lw $t0, 168($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 88($sp) # internal_33 = result of function_print_at_Main + sw $v1, 176($sp) # internal_65 = result of internal_67 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -8557,61 +9945,85 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 46 - sb $t0, 8($v0) # internal_34[0] = '.' + sb $t0, 8($v0) # internal_68[0] = '.' addi $t0, $zero, 46 - sb $t0, 9($v0) # internal_34[1] = '.' + sb $t0, 9($v0) # internal_68[1] = '.' addi $t0, $zero, 46 - sb $t0, 10($v0) # internal_34[2] = '.' + sb $t0, 10($v0) # internal_68[2] = '.' addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_34[3] = 'e' + sb $t0, 11($v0) # internal_68[3] = 'e' addi $t0, $zero, 110 - sb $t0, 12($v0) # internal_34[4] = 'n' + sb $t0, 12($v0) # internal_68[4] = 'n' addi $t0, $zero, 116 - sb $t0, 13($v0) # internal_34[5] = 't' + sb $t0, 13($v0) # internal_68[5] = 't' addi $t0, $zero, 101 - sb $t0, 14($v0) # internal_34[6] = 'e' + sb $t0, 14($v0) # internal_68[6] = 'e' addi $t0, $zero, 114 - sb $t0, 15($v0) # internal_34[7] = 'r' + sb $t0, 15($v0) # internal_68[7] = 'r' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_34[8] = ' ' + sb $t0, 16($v0) # internal_68[8] = ' ' addi $t0, $zero, 102 - sb $t0, 17($v0) # internal_34[9] = 'f' + sb $t0, 17($v0) # internal_68[9] = 'f' addi $t0, $zero, 58 - sb $t0, 18($v0) # internal_34[10] = ':' + sb $t0, 18($v0) # internal_68[10] = ':' addi $t0, $zero, 10 - sb $t0, 19($v0) # internal_34[11] = '\n' + sb $t0, 19($v0) # internal_68[11] = '\n' sb $zero, 20($v0) # Null-terminator at the end of the string - sw $v0, 72($sp) # internal_34 = "...enter f:\n" + sw $v0, 152($sp) # internal_68 = "...enter f:\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_70 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 144($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 140($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 440($sp) sw $t0, 4($sp) # Storing self - # Argument internal_34 - lw $t0, 84($sp) - sw $t0, 0($sp) # Storing internal_34 + # Argument internal_68 + lw $t0, 164($sp) + sw $t0, 0($sp) # Storing internal_68 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_71 + lw $t0, 152($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 80($sp) # internal_35 = result of function_out_string_at_IO + sw $v1, 160($sp) # internal_69 = result of internal_71 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -8626,88 +10038,112 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_36[0] = '\t' + sb $t0, 8($v0) # internal_72[0] = '\t' addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_36[1] = 'T' + sb $t0, 9($v0) # internal_72[1] = 'T' addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_36[2] = 'o' + sb $t0, 10($v0) # internal_72[2] = 'o' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_36[3] = ' ' + sb $t0, 11($v0) # internal_72[3] = ' ' addi $t0, $zero, 102 - sb $t0, 12($v0) # internal_36[4] = 'f' + sb $t0, 12($v0) # internal_72[4] = 'f' addi $t0, $zero, 105 - sb $t0, 13($v0) # internal_36[5] = 'i' + sb $t0, 13($v0) # internal_72[5] = 'i' addi $t0, $zero, 110 - sb $t0, 14($v0) # internal_36[6] = 'n' + sb $t0, 14($v0) # internal_72[6] = 'n' addi $t0, $zero, 100 - sb $t0, 15($v0) # internal_36[7] = 'd' + sb $t0, 15($v0) # internal_72[7] = 'd' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_36[8] = ' ' + sb $t0, 16($v0) # internal_72[8] = ' ' addi $t0, $zero, 111 - sb $t0, 17($v0) # internal_36[9] = 'o' + sb $t0, 17($v0) # internal_72[9] = 'o' addi $t0, $zero, 117 - sb $t0, 18($v0) # internal_36[10] = 'u' + sb $t0, 18($v0) # internal_72[10] = 'u' addi $t0, $zero, 116 - sb $t0, 19($v0) # internal_36[11] = 't' + sb $t0, 19($v0) # internal_72[11] = 't' addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_36[12] = ' ' + sb $t0, 20($v0) # internal_72[12] = ' ' addi $t0, $zero, 105 - sb $t0, 21($v0) # internal_36[13] = 'i' + sb $t0, 21($v0) # internal_72[13] = 'i' addi $t0, $zero, 102 - sb $t0, 22($v0) # internal_36[14] = 'f' + sb $t0, 22($v0) # internal_72[14] = 'f' addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_36[15] = ' ' + sb $t0, 23($v0) # internal_72[15] = ' ' sb $zero, 24($v0) # Null-terminator at the end of the string - sw $v0, 64($sp) # internal_36 = "\tTo find out if " + sw $v0, 136($sp) # internal_72 = "\tTo find out if " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_74 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 128($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 124($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 440($sp) sw $t0, 4($sp) # Storing self - # Argument internal_36 - lw $t0, 76($sp) - sw $t0, 0($sp) # Storing internal_36 + # Argument internal_72 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_72 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_75 + lw $t0, 136($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 72($sp) # internal_37 = result of function_out_string_at_IO + sw $v1, 144($sp) # internal_73 = result of internal_75 addi $sp, $sp, 12 # Freeing space for arguments # Get attribute avar of self - lw $t0, 212($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t0, 428($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497356430 + beq $t6, $t5, int_get_attribute_8753942959969 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497356430 - j object_get_attribute_8794497356430 - int_get_attribute_8794497356430: + beq $t6, $t5, bool_get_attribute_8753942959969 + j object_get_attribute_8753942959969 + int_get_attribute_8753942959969: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8715,9 +10151,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 56($sp) # internal_38 = self.avar - j end_get_attribute_8794497356430 - bool_get_attribute_8794497356430: + sw $v0, 120($sp) # internal_76 = self.avar + j end_get_attribute_8753942959969 + bool_get_attribute_8753942959969: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8725,28 +10161,52 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 56($sp) # internal_38 = self.avar - j end_get_attribute_8794497356430 - object_get_attribute_8794497356430: - sw $t1, 56($sp) # internal_38 = avar - end_get_attribute_8794497356430: + sw $v0, 120($sp) # internal_76 = self.avar + j end_get_attribute_8753942959969 + object_get_attribute_8753942959969: + sw $t1, 120($sp) # internal_76 = self.avar + end_get_attribute_8753942959969: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_78 = address of allocated object Int + + # Get method print of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 112($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 108($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 440($sp) sw $t0, 4($sp) # Storing self - # Argument internal_38 - lw $t0, 68($sp) - sw $t0, 0($sp) # Storing internal_38 + # Argument internal_76 + lw $t0, 132($sp) + sw $t0, 0($sp) # Storing internal_76 - # Calling function function_print_at_Main - jal function_print_at_Main + # Calling function internal_79 + lw $t0, 120($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 64($sp) # internal_39 = result of function_print_at_Main + sw $v1, 128($sp) # internal_77 = result of internal_79 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -8761,115 +10221,139 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 105 - sb $t0, 8($v0) # internal_40[0] = 'i' + sb $t0, 8($v0) # internal_80[0] = 'i' addi $t0, $zero, 115 - sb $t0, 9($v0) # internal_40[1] = 's' + sb $t0, 9($v0) # internal_80[1] = 's' addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_40[2] = ' ' + sb $t0, 10($v0) # internal_80[2] = ' ' addi $t0, $zero, 97 - sb $t0, 11($v0) # internal_40[3] = 'a' + sb $t0, 11($v0) # internal_80[3] = 'a' addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_40[4] = ' ' + sb $t0, 12($v0) # internal_80[4] = ' ' addi $t0, $zero, 109 - sb $t0, 13($v0) # internal_40[5] = 'm' + sb $t0, 13($v0) # internal_80[5] = 'm' addi $t0, $zero, 117 - sb $t0, 14($v0) # internal_40[6] = 'u' + sb $t0, 14($v0) # internal_80[6] = 'u' addi $t0, $zero, 108 - sb $t0, 15($v0) # internal_40[7] = 'l' + sb $t0, 15($v0) # internal_80[7] = 'l' addi $t0, $zero, 116 - sb $t0, 16($v0) # internal_40[8] = 't' + sb $t0, 16($v0) # internal_80[8] = 't' addi $t0, $zero, 105 - sb $t0, 17($v0) # internal_40[9] = 'i' + sb $t0, 17($v0) # internal_80[9] = 'i' addi $t0, $zero, 112 - sb $t0, 18($v0) # internal_40[10] = 'p' + sb $t0, 18($v0) # internal_80[10] = 'p' addi $t0, $zero, 108 - sb $t0, 19($v0) # internal_40[11] = 'l' + sb $t0, 19($v0) # internal_80[11] = 'l' addi $t0, $zero, 101 - sb $t0, 20($v0) # internal_40[12] = 'e' + sb $t0, 20($v0) # internal_80[12] = 'e' addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_40[13] = ' ' + sb $t0, 21($v0) # internal_80[13] = ' ' addi $t0, $zero, 111 - sb $t0, 22($v0) # internal_40[14] = 'o' + sb $t0, 22($v0) # internal_80[14] = 'o' addi $t0, $zero, 102 - sb $t0, 23($v0) # internal_40[15] = 'f' + sb $t0, 23($v0) # internal_80[15] = 'f' addi $t0, $zero, 32 - sb $t0, 24($v0) # internal_40[16] = ' ' + sb $t0, 24($v0) # internal_80[16] = ' ' addi $t0, $zero, 51 - sb $t0, 25($v0) # internal_40[17] = '3' + sb $t0, 25($v0) # internal_80[17] = '3' addi $t0, $zero, 46 - sb $t0, 26($v0) # internal_40[18] = '.' + sb $t0, 26($v0) # internal_80[18] = '.' addi $t0, $zero, 46 - sb $t0, 27($v0) # internal_40[19] = '.' + sb $t0, 27($v0) # internal_80[19] = '.' addi $t0, $zero, 46 - sb $t0, 28($v0) # internal_40[20] = '.' + sb $t0, 28($v0) # internal_80[20] = '.' addi $t0, $zero, 101 - sb $t0, 29($v0) # internal_40[21] = 'e' + sb $t0, 29($v0) # internal_80[21] = 'e' addi $t0, $zero, 110 - sb $t0, 30($v0) # internal_40[22] = 'n' + sb $t0, 30($v0) # internal_80[22] = 'n' addi $t0, $zero, 116 - sb $t0, 31($v0) # internal_40[23] = 't' + sb $t0, 31($v0) # internal_80[23] = 't' addi $t0, $zero, 101 - sb $t0, 32($v0) # internal_40[24] = 'e' + sb $t0, 32($v0) # internal_80[24] = 'e' addi $t0, $zero, 114 - sb $t0, 33($v0) # internal_40[25] = 'r' + sb $t0, 33($v0) # internal_80[25] = 'r' addi $t0, $zero, 32 - sb $t0, 34($v0) # internal_40[26] = ' ' + sb $t0, 34($v0) # internal_80[26] = ' ' addi $t0, $zero, 103 - sb $t0, 35($v0) # internal_40[27] = 'g' + sb $t0, 35($v0) # internal_80[27] = 'g' addi $t0, $zero, 58 - sb $t0, 36($v0) # internal_40[28] = ':' + sb $t0, 36($v0) # internal_80[28] = ':' addi $t0, $zero, 10 - sb $t0, 37($v0) # internal_40[29] = '\n' + sb $t0, 37($v0) # internal_80[29] = '\n' sb $zero, 38($v0) # Null-terminator at the end of the string - sw $v0, 48($sp) # internal_40 = "is a multiple of 3...enter g:\n" + sw $v0, 104($sp) # internal_80 = "is a multiple of 3...enter g:\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_82 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 96($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 92($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 440($sp) sw $t0, 4($sp) # Storing self - # Argument internal_40 - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing internal_40 + # Argument internal_80 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_80 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_83 + lw $t0, 104($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 56($sp) # internal_41 = result of function_out_string_at_IO + sw $v1, 112($sp) # internal_81 = result of internal_83 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -8884,73 +10368,97 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_42[0] = '\t' + sb $t0, 8($v0) # internal_84[0] = '\t' addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_42[1] = 'T' + sb $t0, 9($v0) # internal_84[1] = 'T' addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_42[2] = 'o' + sb $t0, 10($v0) # internal_84[2] = 'o' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_42[3] = ' ' + sb $t0, 11($v0) # internal_84[3] = ' ' addi $t0, $zero, 100 - sb $t0, 12($v0) # internal_42[4] = 'd' + sb $t0, 12($v0) # internal_84[4] = 'd' addi $t0, $zero, 105 - sb $t0, 13($v0) # internal_42[5] = 'i' + sb $t0, 13($v0) # internal_84[5] = 'i' addi $t0, $zero, 118 - sb $t0, 14($v0) # internal_42[6] = 'v' + sb $t0, 14($v0) # internal_84[6] = 'v' addi $t0, $zero, 105 - sb $t0, 15($v0) # internal_42[7] = 'i' + sb $t0, 15($v0) # internal_84[7] = 'i' addi $t0, $zero, 100 - sb $t0, 16($v0) # internal_42[8] = 'd' + sb $t0, 16($v0) # internal_84[8] = 'd' addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_42[9] = 'e' + sb $t0, 17($v0) # internal_84[9] = 'e' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_42[10] = ' ' + sb $t0, 18($v0) # internal_84[10] = ' ' + + sb $zero, 19($v0) # Null-terminator at the end of the string + + sw $v0, 88($sp) # internal_84 = "\tTo divide " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall - sb $zero, 19($v0) # Null-terminator at the end of the string + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_86 = address of allocated object Int - sw $v0, 40($sp) # internal_42 = "\tTo divide " + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 80($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 76($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 440($sp) sw $t0, 4($sp) # Storing self - # Argument internal_42 - lw $t0, 52($sp) - sw $t0, 0($sp) # Storing internal_42 + # Argument internal_84 + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing internal_84 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_87 + lw $t0, 88($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 48($sp) # internal_43 = result of function_out_string_at_IO + sw $v1, 96($sp) # internal_85 = result of internal_87 addi $sp, $sp, 12 # Freeing space for arguments # Get attribute avar of self - lw $t0, 212($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t0, 428($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497356538 + beq $t6, $t5, int_get_attribute_8753942960409 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497356538 - j object_get_attribute_8794497356538 - int_get_attribute_8794497356538: + beq $t6, $t5, bool_get_attribute_8753942960409 + j object_get_attribute_8753942960409 + int_get_attribute_8753942960409: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8958,9 +10466,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 32($sp) # internal_44 = self.avar - j end_get_attribute_8794497356538 - bool_get_attribute_8794497356538: + sw $v0, 72($sp) # internal_88 = self.avar + j end_get_attribute_8753942960409 + bool_get_attribute_8753942960409: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8968,28 +10476,52 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 32($sp) # internal_44 = self.avar - j end_get_attribute_8794497356538 - object_get_attribute_8794497356538: - sw $t1, 32($sp) # internal_44 = avar - end_get_attribute_8794497356538: + sw $v0, 72($sp) # internal_88 = self.avar + j end_get_attribute_8753942960409 + object_get_attribute_8753942960409: + sw $t1, 72($sp) # internal_88 = self.avar + end_get_attribute_8753942960409: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_90 = address of allocated object Int + + # Get method print of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 64($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 60($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 440($sp) sw $t0, 4($sp) # Storing self - # Argument internal_44 - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_44 + # Argument internal_88 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_88 - # Calling function function_print_at_Main - jal function_print_at_Main + # Calling function internal_91 + lw $t0, 72($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 40($sp) # internal_45 = result of function_print_at_Main + sw $v1, 80($sp) # internal_89 = result of internal_91 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -9004,73 +10536,97 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 98 - sb $t0, 8($v0) # internal_46[0] = 'b' + sb $t0, 8($v0) # internal_92[0] = 'b' addi $t0, $zero, 121 - sb $t0, 9($v0) # internal_46[1] = 'y' + sb $t0, 9($v0) # internal_92[1] = 'y' addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_46[2] = ' ' + sb $t0, 10($v0) # internal_92[2] = ' ' addi $t0, $zero, 56 - sb $t0, 11($v0) # internal_46[3] = '8' + sb $t0, 11($v0) # internal_92[3] = '8' addi $t0, $zero, 46 - sb $t0, 12($v0) # internal_46[4] = '.' + sb $t0, 12($v0) # internal_92[4] = '.' addi $t0, $zero, 46 - sb $t0, 13($v0) # internal_46[5] = '.' + sb $t0, 13($v0) # internal_92[5] = '.' addi $t0, $zero, 46 - sb $t0, 14($v0) # internal_46[6] = '.' + sb $t0, 14($v0) # internal_92[6] = '.' addi $t0, $zero, 101 - sb $t0, 15($v0) # internal_46[7] = 'e' + sb $t0, 15($v0) # internal_92[7] = 'e' addi $t0, $zero, 110 - sb $t0, 16($v0) # internal_46[8] = 'n' + sb $t0, 16($v0) # internal_92[8] = 'n' addi $t0, $zero, 116 - sb $t0, 17($v0) # internal_46[9] = 't' + sb $t0, 17($v0) # internal_92[9] = 't' addi $t0, $zero, 101 - sb $t0, 18($v0) # internal_46[10] = 'e' + sb $t0, 18($v0) # internal_92[10] = 'e' addi $t0, $zero, 114 - sb $t0, 19($v0) # internal_46[11] = 'r' + sb $t0, 19($v0) # internal_92[11] = 'r' addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_46[12] = ' ' + sb $t0, 20($v0) # internal_92[12] = ' ' addi $t0, $zero, 104 - sb $t0, 21($v0) # internal_46[13] = 'h' + sb $t0, 21($v0) # internal_92[13] = 'h' addi $t0, $zero, 58 - sb $t0, 22($v0) # internal_46[14] = ':' + sb $t0, 22($v0) # internal_92[14] = ':' addi $t0, $zero, 10 - sb $t0, 23($v0) # internal_46[15] = '\n' + sb $t0, 23($v0) # internal_92[15] = '\n' sb $zero, 24($v0) # Null-terminator at the end of the string - sw $v0, 24($sp) # internal_46 = "by 8...enter h:\n" + sw $v0, 56($sp) # internal_92 = "by 8...enter h:\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_94 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 48($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 44($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 440($sp) sw $t0, 4($sp) # Storing self - # Argument internal_46 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_46 + # Argument internal_92 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_92 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_95 + lw $t0, 56($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 32($sp) # internal_47 = result of function_out_string_at_IO + sw $v1, 64($sp) # internal_93 = result of internal_95 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -9085,121 +10641,145 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_48[0] = '\t' + sb $t0, 8($v0) # internal_96[0] = '\t' addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_48[1] = 'T' + sb $t0, 9($v0) # internal_96[1] = 'T' addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_48[2] = 'o' + sb $t0, 10($v0) # internal_96[2] = 'o' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_48[3] = ' ' + sb $t0, 11($v0) # internal_96[3] = ' ' addi $t0, $zero, 103 - sb $t0, 12($v0) # internal_48[4] = 'g' + sb $t0, 12($v0) # internal_96[4] = 'g' addi $t0, $zero, 101 - sb $t0, 13($v0) # internal_48[5] = 'e' + sb $t0, 13($v0) # internal_96[5] = 'e' addi $t0, $zero, 116 - sb $t0, 14($v0) # internal_48[6] = 't' + sb $t0, 14($v0) # internal_96[6] = 't' addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_48[7] = ' ' + sb $t0, 15($v0) # internal_96[7] = ' ' addi $t0, $zero, 97 - sb $t0, 16($v0) # internal_48[8] = 'a' + sb $t0, 16($v0) # internal_96[8] = 'a' addi $t0, $zero, 32 - sb $t0, 17($v0) # internal_48[9] = ' ' + sb $t0, 17($v0) # internal_96[9] = ' ' addi $t0, $zero, 110 - sb $t0, 18($v0) # internal_48[10] = 'n' + sb $t0, 18($v0) # internal_96[10] = 'n' addi $t0, $zero, 101 - sb $t0, 19($v0) # internal_48[11] = 'e' + sb $t0, 19($v0) # internal_96[11] = 'e' addi $t0, $zero, 119 - sb $t0, 20($v0) # internal_48[12] = 'w' + sb $t0, 20($v0) # internal_96[12] = 'w' addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_48[13] = ' ' + sb $t0, 21($v0) # internal_96[13] = ' ' addi $t0, $zero, 110 - sb $t0, 22($v0) # internal_48[14] = 'n' + sb $t0, 22($v0) # internal_96[14] = 'n' addi $t0, $zero, 117 - sb $t0, 23($v0) # internal_48[15] = 'u' + sb $t0, 23($v0) # internal_96[15] = 'u' addi $t0, $zero, 109 - sb $t0, 24($v0) # internal_48[16] = 'm' + sb $t0, 24($v0) # internal_96[16] = 'm' addi $t0, $zero, 98 - sb $t0, 25($v0) # internal_48[17] = 'b' + sb $t0, 25($v0) # internal_96[17] = 'b' addi $t0, $zero, 101 - sb $t0, 26($v0) # internal_48[18] = 'e' + sb $t0, 26($v0) # internal_96[18] = 'e' addi $t0, $zero, 114 - sb $t0, 27($v0) # internal_48[19] = 'r' + sb $t0, 27($v0) # internal_96[19] = 'r' addi $t0, $zero, 46 - sb $t0, 28($v0) # internal_48[20] = '.' + sb $t0, 28($v0) # internal_96[20] = '.' addi $t0, $zero, 46 - sb $t0, 29($v0) # internal_48[21] = '.' + sb $t0, 29($v0) # internal_96[21] = '.' addi $t0, $zero, 46 - sb $t0, 30($v0) # internal_48[22] = '.' + sb $t0, 30($v0) # internal_96[22] = '.' addi $t0, $zero, 101 - sb $t0, 31($v0) # internal_48[23] = 'e' + sb $t0, 31($v0) # internal_96[23] = 'e' addi $t0, $zero, 110 - sb $t0, 32($v0) # internal_48[24] = 'n' + sb $t0, 32($v0) # internal_96[24] = 'n' addi $t0, $zero, 116 - sb $t0, 33($v0) # internal_48[25] = 't' + sb $t0, 33($v0) # internal_96[25] = 't' addi $t0, $zero, 101 - sb $t0, 34($v0) # internal_48[26] = 'e' + sb $t0, 34($v0) # internal_96[26] = 'e' addi $t0, $zero, 114 - sb $t0, 35($v0) # internal_48[27] = 'r' + sb $t0, 35($v0) # internal_96[27] = 'r' addi $t0, $zero, 32 - sb $t0, 36($v0) # internal_48[28] = ' ' + sb $t0, 36($v0) # internal_96[28] = ' ' addi $t0, $zero, 106 - sb $t0, 37($v0) # internal_48[29] = 'j' + sb $t0, 37($v0) # internal_96[29] = 'j' addi $t0, $zero, 58 - sb $t0, 38($v0) # internal_48[30] = ':' + sb $t0, 38($v0) # internal_96[30] = ':' addi $t0, $zero, 10 - sb $t0, 39($v0) # internal_48[31] = '\n' + sb $t0, 39($v0) # internal_96[31] = '\n' sb $zero, 40($v0) # Null-terminator at the end of the string - sw $v0, 16($sp) # internal_48 = "\tTo get a new number...enter j:\n" + sw $v0, 40($sp) # internal_96 = "\tTo get a new number...enter j:\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_98 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 32($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 28($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 440($sp) sw $t0, 4($sp) # Storing self - # Argument internal_48 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_48 + # Argument internal_96 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_96 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_99 + lw $t0, 40($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 24($sp) # internal_49 = result of function_out_string_at_IO + sw $v1, 48($sp) # internal_97 = result of internal_99 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -9214,119 +10794,167 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_50[0] = '\t' + sb $t0, 8($v0) # internal_100[0] = '\t' addi $t0, $zero, 84 - sb $t0, 9($v0) # internal_50[1] = 'T' + sb $t0, 9($v0) # internal_100[1] = 'T' addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_50[2] = 'o' + sb $t0, 10($v0) # internal_100[2] = 'o' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_50[3] = ' ' + sb $t0, 11($v0) # internal_100[3] = ' ' addi $t0, $zero, 113 - sb $t0, 12($v0) # internal_50[4] = 'q' + sb $t0, 12($v0) # internal_100[4] = 'q' addi $t0, $zero, 117 - sb $t0, 13($v0) # internal_50[5] = 'u' + sb $t0, 13($v0) # internal_100[5] = 'u' addi $t0, $zero, 105 - sb $t0, 14($v0) # internal_50[6] = 'i' + sb $t0, 14($v0) # internal_100[6] = 'i' addi $t0, $zero, 116 - sb $t0, 15($v0) # internal_50[7] = 't' + sb $t0, 15($v0) # internal_100[7] = 't' addi $t0, $zero, 46 - sb $t0, 16($v0) # internal_50[8] = '.' + sb $t0, 16($v0) # internal_100[8] = '.' addi $t0, $zero, 46 - sb $t0, 17($v0) # internal_50[9] = '.' + sb $t0, 17($v0) # internal_100[9] = '.' addi $t0, $zero, 46 - sb $t0, 18($v0) # internal_50[10] = '.' + sb $t0, 18($v0) # internal_100[10] = '.' addi $t0, $zero, 101 - sb $t0, 19($v0) # internal_50[11] = 'e' + sb $t0, 19($v0) # internal_100[11] = 'e' addi $t0, $zero, 110 - sb $t0, 20($v0) # internal_50[12] = 'n' + sb $t0, 20($v0) # internal_100[12] = 'n' addi $t0, $zero, 116 - sb $t0, 21($v0) # internal_50[13] = 't' + sb $t0, 21($v0) # internal_100[13] = 't' addi $t0, $zero, 101 - sb $t0, 22($v0) # internal_50[14] = 'e' + sb $t0, 22($v0) # internal_100[14] = 'e' addi $t0, $zero, 114 - sb $t0, 23($v0) # internal_50[15] = 'r' + sb $t0, 23($v0) # internal_100[15] = 'r' addi $t0, $zero, 32 - sb $t0, 24($v0) # internal_50[16] = ' ' + sb $t0, 24($v0) # internal_100[16] = ' ' addi $t0, $zero, 113 - sb $t0, 25($v0) # internal_50[17] = 'q' + sb $t0, 25($v0) # internal_100[17] = 'q' addi $t0, $zero, 58 - sb $t0, 26($v0) # internal_50[18] = ':' + sb $t0, 26($v0) # internal_100[18] = ':' addi $t0, $zero, 10 - sb $t0, 27($v0) # internal_50[19] = '\n' + sb $t0, 27($v0) # internal_100[19] = '\n' addi $t0, $zero, 10 - sb $t0, 28($v0) # internal_50[20] = '\n' + sb $t0, 28($v0) # internal_100[20] = '\n' sb $zero, 29($v0) # Null-terminator at the end of the string - sw $v0, 8($sp) # internal_50 = "\tTo quit...enter q:\n\n" + sw $v0, 24($sp) # internal_100 = "\tTo quit...enter q:\n\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_102 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 224($sp) + lw $t0, 440($sp) sw $t0, 4($sp) # Storing self - # Argument internal_50 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_50 + # Argument internal_100 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_100 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_103 + lw $t0, 24($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 16($sp) # internal_51 = result of function_out_string_at_IO + sw $v1, 32($sp) # internal_101 = result of internal_103 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_105 = address of allocated object Int + + # Get method in_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 220($sp) + lw $t0, 436($sp) sw $t0, 0($sp) # Storing self - # Calling function function_in_string_at_IO - jal function_in_string_at_IO + # Calling function internal_106 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_52 = result of function_in_string_at_IO + sw $v1, 16($sp) # internal_104 = result of internal_106 addi $sp, $sp, 8 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 212 + addi $sp, $sp, 428 jr $ra function_prompt_at_Main: # Function parameters - # $ra = 24($sp) - # self = 20($sp) + # $ra = 48($sp) + # self = 44($sp) # Reserving space for local variables - addi $sp, $sp, -20 + addi $sp, $sp, -44 # Allocating String li $v0, 9 @@ -9344,24 +10972,48 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 16($sp) # internal_0 = "\n" + sw $v0, 40($sp) # internal_0 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_2 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 44($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 32($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 28($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 32($sp) + lw $t0, 56($sp) sw $t0, 4($sp) # Storing self # Argument internal_0 - lw $t0, 28($sp) + lw $t0, 52($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_3 + lw $t0, 40($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 24($sp) # internal_1 = result of function_out_string_at_IO + sw $v1, 48($sp) # internal_1 = result of internal_3 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -9376,134 +11028,182 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 80 - sb $t0, 8($v0) # internal_2[0] = 'P' + sb $t0, 8($v0) # internal_4[0] = 'P' addi $t0, $zero, 108 - sb $t0, 9($v0) # internal_2[1] = 'l' + sb $t0, 9($v0) # internal_4[1] = 'l' addi $t0, $zero, 101 - sb $t0, 10($v0) # internal_2[2] = 'e' + sb $t0, 10($v0) # internal_4[2] = 'e' addi $t0, $zero, 97 - sb $t0, 11($v0) # internal_2[3] = 'a' + sb $t0, 11($v0) # internal_4[3] = 'a' addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_2[4] = 's' + sb $t0, 12($v0) # internal_4[4] = 's' addi $t0, $zero, 101 - sb $t0, 13($v0) # internal_2[5] = 'e' + sb $t0, 13($v0) # internal_4[5] = 'e' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_2[6] = ' ' + sb $t0, 14($v0) # internal_4[6] = ' ' addi $t0, $zero, 101 - sb $t0, 15($v0) # internal_2[7] = 'e' + sb $t0, 15($v0) # internal_4[7] = 'e' addi $t0, $zero, 110 - sb $t0, 16($v0) # internal_2[8] = 'n' + sb $t0, 16($v0) # internal_4[8] = 'n' addi $t0, $zero, 116 - sb $t0, 17($v0) # internal_2[9] = 't' + sb $t0, 17($v0) # internal_4[9] = 't' addi $t0, $zero, 101 - sb $t0, 18($v0) # internal_2[10] = 'e' + sb $t0, 18($v0) # internal_4[10] = 'e' addi $t0, $zero, 114 - sb $t0, 19($v0) # internal_2[11] = 'r' + sb $t0, 19($v0) # internal_4[11] = 'r' addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_2[12] = ' ' + sb $t0, 20($v0) # internal_4[12] = ' ' addi $t0, $zero, 97 - sb $t0, 21($v0) # internal_2[13] = 'a' + sb $t0, 21($v0) # internal_4[13] = 'a' addi $t0, $zero, 32 - sb $t0, 22($v0) # internal_2[14] = ' ' + sb $t0, 22($v0) # internal_4[14] = ' ' addi $t0, $zero, 110 - sb $t0, 23($v0) # internal_2[15] = 'n' + sb $t0, 23($v0) # internal_4[15] = 'n' addi $t0, $zero, 117 - sb $t0, 24($v0) # internal_2[16] = 'u' + sb $t0, 24($v0) # internal_4[16] = 'u' addi $t0, $zero, 109 - sb $t0, 25($v0) # internal_2[17] = 'm' + sb $t0, 25($v0) # internal_4[17] = 'm' addi $t0, $zero, 98 - sb $t0, 26($v0) # internal_2[18] = 'b' + sb $t0, 26($v0) # internal_4[18] = 'b' addi $t0, $zero, 101 - sb $t0, 27($v0) # internal_2[19] = 'e' + sb $t0, 27($v0) # internal_4[19] = 'e' addi $t0, $zero, 114 - sb $t0, 28($v0) # internal_2[20] = 'r' + sb $t0, 28($v0) # internal_4[20] = 'r' addi $t0, $zero, 46 - sb $t0, 29($v0) # internal_2[21] = '.' + sb $t0, 29($v0) # internal_4[21] = '.' addi $t0, $zero, 46 - sb $t0, 30($v0) # internal_2[22] = '.' + sb $t0, 30($v0) # internal_4[22] = '.' addi $t0, $zero, 46 - sb $t0, 31($v0) # internal_2[23] = '.' + sb $t0, 31($v0) # internal_4[23] = '.' addi $t0, $zero, 32 - sb $t0, 32($v0) # internal_2[24] = ' ' + sb $t0, 32($v0) # internal_4[24] = ' ' addi $t0, $zero, 32 - sb $t0, 33($v0) # internal_2[25] = ' ' + sb $t0, 33($v0) # internal_4[25] = ' ' sb $zero, 34($v0) # Null-terminator at the end of the string - sw $v0, 8($sp) # internal_2 = "Please enter a number... " + sw $v0, 24($sp) # internal_4 = "Please enter a number... " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_6 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 44($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 32($sp) + lw $t0, 56($sp) sw $t0, 4($sp) # Storing self - # Argument internal_2 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_2 + # Argument internal_4 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_4 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_7 + lw $t0, 24($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 16($sp) # internal_3 = result of function_out_string_at_IO + sw $v1, 32($sp) # internal_5 = result of internal_7 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_9 = address of allocated object Int + + # Get method in_string of Main + lw $t0, 44($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 28($sp) + lw $t0, 52($sp) sw $t0, 0($sp) # Storing self - # Calling function function_in_string_at_IO - jal function_in_string_at_IO + # Calling function internal_10 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_4 = result of function_in_string_at_IO + sw $v1, 16($sp) # internal_8 = result of internal_10 addi $sp, $sp, 8 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 20 + addi $sp, $sp, 44 jr $ra function_get_int_at_Main: # Function parameters - # $ra = 24($sp) - # self = 20($sp) + # $ra = 40($sp) + # self = 36($sp) # Reserving space for local variables - addi $sp, $sp, -20 + addi $sp, $sp, -36 # Allocating A2I li $v0, 9 @@ -9512,20 +11212,20 @@ la $t0, type_A2I # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 12($sp) # internal_1 = address of allocated object A2I + sw $v0, 28($sp) # internal_1 = address of allocated object A2I # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_1 - lw $t0, 20($sp) + lw $t0, 36($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function___init___at_A2I jal function___init___at_A2I lw $ra, 4($sp) - sw $v1, 20($sp) # internal_1 = result of function___init___at_A2I + sw $v1, 36($sp) # internal_1 = result of function___init___at_A2I addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments @@ -9533,31 +11233,55 @@ sw $ra, 8($sp) # Storing return address # Argument z - lw $t0, 28($sp) + lw $t0, 44($sp) sw $t0, 4($sp) # Storing z # Argument internal_1 - lw $t0, 24($sp) + lw $t0, 40($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 28($sp) # z = result of function_assign + sw $v1, 44($sp) # z = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_4 = address of allocated object Int + + # Get method prompt of Main + lw $t0, 36($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 28($sp) + lw $t0, 44($sp) sw $t0, 0($sp) # Storing self - # Calling function function_prompt_at_Main - jal function_prompt_at_Main + # Calling function internal_5 + lw $t0, 20($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 12($sp) # internal_3 = result of function_prompt_at_Main + sw $v1, 28($sp) # internal_3 = result of internal_5 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments @@ -9565,70 +11289,94 @@ sw $ra, 8($sp) # Storing return address # Argument s - lw $t0, 20($sp) + lw $t0, 36($sp) sw $t0, 4($sp) # Storing s # Argument internal_3 - lw $t0, 16($sp) + lw $t0, 32($sp) sw $t0, 0($sp) # Storing internal_3 - # Calling function function_assign - jal function_assign - lw $ra, 8($sp) - sw $v1, 20($sp) # s = result of function_assign - addi $sp, $sp, 12 # Freeing space for arguments + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 36($sp) # s = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_7 = address of allocated object Int + + # Get method a2i of A2I + lw $t0, 32($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument z - lw $t0, 28($sp) + lw $t0, 44($sp) sw $t0, 4($sp) # Storing z # Argument s - lw $t0, 20($sp) + lw $t0, 36($sp) sw $t0, 0($sp) # Storing s - # Calling function function_a2i_at_A2I - jal function_a2i_at_A2I + # Calling function internal_8 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_4 = result of function_a2i_at_A2I + sw $v1, 20($sp) # internal_6 = result of internal_8 addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 20 + addi $sp, $sp, 36 jr $ra function_is_even_at_Main: # Function parameters - # $ra = 96($sp) - # self = 92($sp) - # num = 88($sp) + # $ra = 112($sp) + # self = 108($sp) + # num = 104($sp) # Reserving space for local variables - addi $sp, $sp, -88 + addi $sp, $sp, -104 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument x - lw $t0, 96($sp) + lw $t0, 112($sp) sw $t0, 4($sp) # Storing x # Argument num - lw $t0, 100($sp) + lw $t0, 116($sp) sw $t0, 0($sp) # Storing num # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 96($sp) # x = result of function_assign + sw $v1, 112($sp) # x = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bool 0 @@ -9641,7 +11389,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 76($sp) # internal_2 = address of allocated object Int + sw $v0, 92($sp) # internal_2 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -9653,40 +11401,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 72($sp) # internal_3 = address of allocated object Int + sw $v0, 88($sp) # internal_3 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument x - lw $t0, 96($sp) + lw $t0, 112($sp) sw $t0, 4($sp) # Storing x # Argument internal_3 - lw $t0, 84($sp) + lw $t0, 100($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 80($sp) # internal_4 = result of function_less_than + sw $v1, 96($sp) # internal_4 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments # internal_2 = internal_4 - lw $t0, 68($sp) - sw $t0, 76($sp) + lw $t0, 84($sp) + sw $t0, 92($sp) - # If internal_2 then goto then_8794497403462 - lw $t0, 76($sp) # Loading the address of the condition + # If internal_2 then goto then_8753943036073 + lw $t0, 92($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497403462 + beq $t0, $t1, then_8753943036073 - # Jumping to else_8794497403462 - j else_8794497403462 + # Jumping to else_8753943036073 + j else_8753943036073 - then_8794497403462: + then_8753943036073: # Allocating Int 1 li $v0, 9 @@ -9698,7 +11446,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 64($sp) # internal_5 = address of allocated object Int + sw $v0, 80($sp) # internal_5 = address of allocated object Int # Allocating Int 4294967295 li $v0, 9 @@ -9710,7 +11458,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4294967295 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_6 = address of allocated object Int + sw $v0, 76($sp) # internal_6 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -9722,24 +11470,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 56($sp) # internal_7 = address of allocated object Int + sw $v0, 72($sp) # internal_7 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument x - lw $t0, 96($sp) + lw $t0, 112($sp) sw $t0, 4($sp) # Storing x # Argument internal_6 - lw $t0, 72($sp) + lw $t0, 88($sp) sw $t0, 0($sp) # Storing internal_6 # Calling function function_xor jal function_xor lw $ra, 8($sp) - sw $v1, 68($sp) # internal_7 = result of function_xor + sw $v1, 84($sp) # internal_7 = result of function_xor addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -9747,45 +11495,69 @@ sw $ra, 8($sp) # Storing return address # Argument internal_7 - lw $t0, 68($sp) + lw $t0, 84($sp) sw $t0, 4($sp) # Storing internal_7 # Argument internal_5 - lw $t0, 76($sp) + lw $t0, 92($sp) sw $t0, 0($sp) # Storing internal_5 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 68($sp) # internal_7 = result of function_add + sw $v1, 84($sp) # internal_7 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_9 = address of allocated object Int + + # Get method is_even of Main + lw $t0, 108($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 64($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 60($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 104($sp) + lw $t0, 120($sp) sw $t0, 4($sp) # Storing self # Argument internal_7 - lw $t0, 68($sp) + lw $t0, 84($sp) sw $t0, 0($sp) # Storing internal_7 - # Calling function function_is_even_at_Main - jal function_is_even_at_Main + # Calling function internal_10 + lw $t0, 72($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 64($sp) # internal_8 = result of function_is_even_at_Main + sw $v1, 80($sp) # internal_8 = result of internal_10 addi $sp, $sp, 12 # Freeing space for arguments # internal_1 = internal_8 - lw $t0, 52($sp) - sw $t0, 80($sp) + lw $t0, 68($sp) + sw $t0, 96($sp) - # Jumping to endif_8794497403462 - j endif_8794497403462 + # Jumping to endif_8753943036073 + j endif_8753943036073 - else_8794497403462: + else_8753943036073: # Allocating Bool 0 li $v0, 9 @@ -9797,7 +11569,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_10 = address of allocated object Int + sw $v0, 52($sp) # internal_12 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -9809,40 +11581,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_11 = address of allocated object Int + sw $v0, 48($sp) # internal_13 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_11 - lw $t0, 52($sp) - sw $t0, 4($sp) # Storing internal_11 + # Argument internal_13 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing internal_13 # Argument x - lw $t0, 96($sp) + lw $t0, 112($sp) sw $t0, 0($sp) # Storing x # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 48($sp) # internal_12 = result of function_equal + sw $v1, 56($sp) # internal_14 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_10 = internal_12 - lw $t0, 36($sp) - sw $t0, 44($sp) + # internal_12 = internal_14 + lw $t0, 44($sp) + sw $t0, 52($sp) - # If internal_10 then goto then_8794497403465 - lw $t0, 44($sp) # Loading the address of the condition + # If internal_12 then goto then_8753943036076 + lw $t0, 52($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497403465 + beq $t0, $t1, then_8753943036076 - # Jumping to else_8794497403465 - j else_8794497403465 + # Jumping to else_8753943036076 + j else_8753943036076 - then_8794497403465: + then_8753943036076: # Allocating Bool 1 li $v0, 9 @@ -9854,16 +11626,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_13 = address of allocated object Int + sw $v0, 40($sp) # internal_15 = address of allocated object Int - # internal_9 = internal_13 - lw $t0, 32($sp) - sw $t0, 48($sp) + # internal_11 = internal_15 + lw $t0, 40($sp) + sw $t0, 56($sp) - # Jumping to endif_8794497403465 - j endif_8794497403465 + # Jumping to endif_8753943036076 + j endif_8753943036076 - else_8794497403465: + else_8753943036076: # Allocating Bool 0 li $v0, 9 @@ -9875,7 +11647,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_15 = address of allocated object Int + sw $v0, 32($sp) # internal_17 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -9887,40 +11659,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_16 = address of allocated object Int + sw $v0, 28($sp) # internal_18 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_16 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_16 + # Argument internal_18 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_18 # Argument x - lw $t0, 96($sp) + lw $t0, 112($sp) sw $t0, 0($sp) # Storing x # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 28($sp) # internal_17 = result of function_equal + sw $v1, 36($sp) # internal_19 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_15 = internal_17 - lw $t0, 16($sp) - sw $t0, 24($sp) + # internal_17 = internal_19 + lw $t0, 24($sp) + sw $t0, 32($sp) - # If internal_15 then goto then_8794497403471 - lw $t0, 24($sp) # Loading the address of the condition + # If internal_17 then goto then_8753943036082 + lw $t0, 32($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497403471 + beq $t0, $t1, then_8753943036082 - # Jumping to else_8794497403471 - j else_8794497403471 + # Jumping to else_8753943036082 + j else_8753943036082 - then_8794497403471: + then_8753943036082: # Allocating Bool 0 li $v0, 9 @@ -9932,16 +11704,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_18 = address of allocated object Int + sw $v0, 20($sp) # internal_20 = address of allocated object Int - # internal_14 = internal_18 - lw $t0, 12($sp) - sw $t0, 28($sp) + # internal_16 = internal_20 + lw $t0, 20($sp) + sw $t0, 36($sp) - # Jumping to endif_8794497403471 - j endif_8794497403471 + # Jumping to endif_8753943036082 + j endif_8753943036082 - else_8794497403471: + else_8753943036082: # Allocating Int 2 li $v0, 9 @@ -9953,87 +11725,111 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_19 = address of allocated object Int + sw $v0, 16($sp) # internal_21 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument x - lw $t0, 96($sp) + lw $t0, 112($sp) sw $t0, 4($sp) # Storing x - # Argument internal_19 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_19 + # Argument internal_21 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_21 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 16($sp) # internal_20 = result of function_sub + sw $v1, 24($sp) # internal_22 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_24 = address of allocated object Int + + # Get method is_even of Main + lw $t0, 108($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 104($sp) + lw $t0, 120($sp) sw $t0, 4($sp) # Storing self - # Argument internal_20 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_20 + # Argument internal_22 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_22 - # Calling function function_is_even_at_Main - jal function_is_even_at_Main + # Calling function internal_25 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_21 = result of function_is_even_at_Main + sw $v1, 20($sp) # internal_23 = result of internal_25 addi $sp, $sp, 12 # Freeing space for arguments - # internal_14 = internal_21 - lw $t0, 0($sp) - sw $t0, 28($sp) + # internal_16 = internal_23 + lw $t0, 8($sp) + sw $t0, 36($sp) - # Jumping to endif_8794497403471 - j endif_8794497403471 + # Jumping to endif_8753943036082 + j endif_8753943036082 - endif_8794497403471: + endif_8753943036082: - # internal_9 = internal_14 - lw $t0, 28($sp) - sw $t0, 48($sp) + # internal_11 = internal_16 + lw $t0, 36($sp) + sw $t0, 56($sp) - # Jumping to endif_8794497403465 - j endif_8794497403465 + # Jumping to endif_8753943036076 + j endif_8753943036076 - endif_8794497403465: + endif_8753943036076: - # internal_1 = internal_9 - lw $t0, 48($sp) - sw $t0, 80($sp) + # internal_1 = internal_11 + lw $t0, 56($sp) + sw $t0, 96($sp) - # Jumping to endif_8794497403462 - j endif_8794497403462 + # Jumping to endif_8753943036073 + j endif_8753943036073 - endif_8794497403462: + endif_8753943036073: # Loading return value in $v1 - lw $v1, 80($sp) + lw $v1, 96($sp) # Freeing space for local variables - addi $sp, $sp, 88 + addi $sp, $sp, 104 jr $ra function_class_type_at_Main: # Function parameters - # $ra = 300($sp) - # self = 296($sp) - # var = 292($sp) + # $ra = 340($sp) + # self = 336($sp) + # var = 332($sp) # Reserving space for local variables - addi $sp, $sp, -292 + addi $sp, $sp, -332 # Allocating Int 0 li $v0, 9 @@ -10045,7 +11841,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 288($sp) # internal_0 = address of allocated object Int + sw $v0, 328($sp) # internal_0 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -10057,7 +11853,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 284($sp) # internal_1 = address of allocated object Int + sw $v0, 324($sp) # internal_1 = address of allocated object Int # Allocating Int 6 li $v0, 9 @@ -10069,10 +11865,10 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 6 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 280($sp) # internal_2 = address of allocated object Int + sw $v0, 320($sp) # internal_2 = address of allocated object Int # Allocating NUll to internal_3 - sw $zero, 276($sp) # internal_3 = 0 + sw $zero, 316($sp) # internal_3 = 0 # Allocating Int 0 li $v0, 9 @@ -10084,7 +11880,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 272($sp) # internal_4 = address of allocated object Int + sw $v0, 312($sp) # internal_4 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -10096,66 +11892,66 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 260($sp) # internal_7 = address of allocated object Int + sw $v0, 300($sp) # internal_7 = address of allocated object Int # internal_5 = typeof var that is the first word of the object - lw $t0, 292($sp) + lw $t0, 332($sp) lw $t0, 0($t0) - sw $t0, 268($sp) + sw $t0, 308($sp) # internal_6 = internal_5 - lw $t0, 268($sp) - sw $t0, 264($sp) + lw $t0, 308($sp) + sw $t0, 304($sp) - while_start_8794497403564: + while_start_8753943036435: # internal_7 = EqualAddress(internal_6, internal_3) - lw $t0, 264($sp) - lw $t1, 276($sp) + lw $t0, 304($sp) + lw $t1, 316($sp) seq $t2, $t0, $t1 - lw $t0, 260($sp) + lw $t0, 300($sp) sw $t2, 8($t0) - # If internal_7 then goto while_end_8794497403564 - lw $t0, 260($sp) # Loading the address of the condition + # If internal_7 then goto while_end_8753943036435 + lw $t0, 300($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_end_8794497403564 + beq $t0, $t1, while_end_8753943036435 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_4 - lw $t0, 284($sp) + lw $t0, 324($sp) sw $t0, 4($sp) # Storing internal_4 # Argument internal_1 - lw $t0, 296($sp) + lw $t0, 336($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 284($sp) # internal_4 = result of function_add + sw $v1, 324($sp) # internal_4 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # internal_6 = ancestor of internal_6 - lw $t0, 264($sp) + lw $t0, 304($sp) lw $t0, 4($t0) - sw $t0, 264($sp) + sw $t0, 304($sp) - # Jumping to while_start_8794497403564 - j while_start_8794497403564 + # Jumping to while_start_8753943036435 + j while_start_8753943036435 - while_end_8794497403564: + while_end_8753943036435: # internal_6 = internal_5 - lw $t0, 268($sp) - sw $t0, 264($sp) + lw $t0, 308($sp) + sw $t0, 304($sp) # initialize Array [internal_4] - lw $t0, 272($sp) # $t0 = internal_4 + lw $t0, 312($sp) # $t0 = internal_4 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -10163,7 +11959,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 256($sp) # internal_8 = new Array[internal_4] + sw $v0, 296($sp) # internal_8 = new Array[internal_4] # Allocating Int 0 li $v0, 9 @@ -10175,7 +11971,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 252($sp) # internal_9 = address of allocated object Int + sw $v0, 292($sp) # internal_9 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -10187,80 +11983,80 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 248($sp) # internal_10 = address of allocated object Int + sw $v0, 288($sp) # internal_10 = address of allocated object Int - foreach_start_8794497403564: + foreach_start_8753943036435: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_9 - lw $t0, 264($sp) + lw $t0, 304($sp) sw $t0, 4($sp) # Storing internal_9 # Argument internal_4 - lw $t0, 284($sp) + lw $t0, 324($sp) sw $t0, 0($sp) # Storing internal_4 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 260($sp) # internal_10 = result of function_less_than + sw $v1, 300($sp) # internal_10 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_10 then goto foreach_body_8794497403564 - lw $t0, 248($sp) # Loading the address of the condition + # If internal_10 then goto foreach_body_8753943036435 + lw $t0, 288($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_body_8794497403564 + beq $t0, $t1, foreach_body_8753943036435 - # Jumping to foreach_end_8794497403564 - j foreach_end_8794497403564 + # Jumping to foreach_end_8753943036435 + j foreach_end_8753943036435 - foreach_body_8794497403564: + foreach_body_8753943036435: # array internal_8[4 * internal_9] = internal_6 - lw $t0, 252($sp) # $t0 = internal_9 + lw $t0, 292($sp) # $t0 = internal_9 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 256($sp) # $t1 = internal_8 + lw $t1, 296($sp) # $t1 = internal_8 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 264($sp) + lw $t0, 304($sp) sw $t0, 0($t1) # internal_6 = ancestor of internal_6 - lw $t0, 264($sp) + lw $t0, 304($sp) lw $t0, 4($t0) - sw $t0, 264($sp) + sw $t0, 304($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_9 - lw $t0, 264($sp) + lw $t0, 304($sp) sw $t0, 4($sp) # Storing internal_9 # Argument internal_1 - lw $t0, 296($sp) + lw $t0, 336($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 264($sp) # internal_9 = result of function_add + sw $v1, 304($sp) # internal_9 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_start_8794497403564 - j foreach_start_8794497403564 + # Jumping to foreach_start_8753943036435 + j foreach_start_8753943036435 - foreach_end_8794497403564: + foreach_end_8753943036435: # initialize Array [internal_2] - lw $t0, 280($sp) # $t0 = internal_2 + lw $t0, 320($sp) # $t0 = internal_2 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -10268,10 +12064,10 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 244($sp) # internal_11 = new Array[internal_2] + sw $v0, 284($sp) # internal_11 = new Array[internal_2] # initialize Array [internal_2] - lw $t0, 280($sp) # $t0 = internal_2 + lw $t0, 320($sp) # $t0 = internal_2 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -10279,7 +12075,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 240($sp) # internal_12 = new Array[internal_2] + sw $v0, 280($sp) # internal_12 = new Array[internal_2] # Allocating Int 0 li $v0, 9 @@ -10291,32 +12087,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 232($sp) # internal_14 = address of allocated object Int + sw $v0, 272($sp) # internal_14 = address of allocated object Int # internal_13 = direction of A la $t0, type_A - sw $t0, 236($sp) + sw $t0, 276($sp) # array internal_11[4 * internal_14] = internal_13 - lw $t0, 232($sp) # $t0 = internal_14 + lw $t0, 272($sp) # $t0 = internal_14 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 244($sp) # $t1 = internal_11 + lw $t1, 284($sp) # $t1 = internal_11 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 236($sp) + lw $t0, 276($sp) sw $t0, 0($t1) # array internal_12[4 * internal_14] = internal_4 - lw $t0, 232($sp) # $t0 = internal_14 + lw $t0, 272($sp) # $t0 = internal_14 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 240($sp) # $t1 = internal_12 + lw $t1, 280($sp) # $t1 = internal_12 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 272($sp) + lw $t0, 312($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -10330,32 +12126,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 224($sp) # internal_16 = address of allocated object Int + sw $v0, 264($sp) # internal_16 = address of allocated object Int # internal_15 = direction of B la $t0, type_B - sw $t0, 228($sp) + sw $t0, 268($sp) # array internal_11[4 * internal_16] = internal_15 - lw $t0, 224($sp) # $t0 = internal_16 + lw $t0, 264($sp) # $t0 = internal_16 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 244($sp) # $t1 = internal_11 + lw $t1, 284($sp) # $t1 = internal_11 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 228($sp) + lw $t0, 268($sp) sw $t0, 0($t1) # array internal_12[4 * internal_16] = internal_4 - lw $t0, 224($sp) # $t0 = internal_16 + lw $t0, 264($sp) # $t0 = internal_16 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 240($sp) # $t1 = internal_12 + lw $t1, 280($sp) # $t1 = internal_12 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 272($sp) + lw $t0, 312($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -10369,32 +12165,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 216($sp) # internal_18 = address of allocated object Int + sw $v0, 256($sp) # internal_18 = address of allocated object Int # internal_17 = direction of C la $t0, type_C - sw $t0, 220($sp) + sw $t0, 260($sp) # array internal_11[4 * internal_18] = internal_17 - lw $t0, 216($sp) # $t0 = internal_18 + lw $t0, 256($sp) # $t0 = internal_18 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 244($sp) # $t1 = internal_11 + lw $t1, 284($sp) # $t1 = internal_11 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 220($sp) + lw $t0, 260($sp) sw $t0, 0($t1) # array internal_12[4 * internal_18] = internal_4 - lw $t0, 216($sp) # $t0 = internal_18 + lw $t0, 256($sp) # $t0 = internal_18 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 240($sp) # $t1 = internal_12 + lw $t1, 280($sp) # $t1 = internal_12 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 272($sp) + lw $t0, 312($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -10408,32 +12204,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 208($sp) # internal_20 = address of allocated object Int + sw $v0, 248($sp) # internal_20 = address of allocated object Int # internal_19 = direction of D la $t0, type_D - sw $t0, 212($sp) + sw $t0, 252($sp) # array internal_11[4 * internal_20] = internal_19 - lw $t0, 208($sp) # $t0 = internal_20 + lw $t0, 248($sp) # $t0 = internal_20 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 244($sp) # $t1 = internal_11 + lw $t1, 284($sp) # $t1 = internal_11 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 212($sp) + lw $t0, 252($sp) sw $t0, 0($t1) # array internal_12[4 * internal_20] = internal_4 - lw $t0, 208($sp) # $t0 = internal_20 + lw $t0, 248($sp) # $t0 = internal_20 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 240($sp) # $t1 = internal_12 + lw $t1, 280($sp) # $t1 = internal_12 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 272($sp) + lw $t0, 312($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -10447,32 +12243,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 200($sp) # internal_22 = address of allocated object Int + sw $v0, 240($sp) # internal_22 = address of allocated object Int # internal_21 = direction of E la $t0, type_E - sw $t0, 204($sp) + sw $t0, 244($sp) # array internal_11[4 * internal_22] = internal_21 - lw $t0, 200($sp) # $t0 = internal_22 + lw $t0, 240($sp) # $t0 = internal_22 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 244($sp) # $t1 = internal_11 + lw $t1, 284($sp) # $t1 = internal_11 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 204($sp) + lw $t0, 244($sp) sw $t0, 0($t1) # array internal_12[4 * internal_22] = internal_4 - lw $t0, 200($sp) # $t0 = internal_22 + lw $t0, 240($sp) # $t0 = internal_22 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 240($sp) # $t1 = internal_12 + lw $t1, 280($sp) # $t1 = internal_12 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 272($sp) + lw $t0, 312($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -10486,32 +12282,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 5 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 192($sp) # internal_24 = address of allocated object Int + sw $v0, 232($sp) # internal_24 = address of allocated object Int # internal_23 = direction of Object la $t0, type_Object - sw $t0, 196($sp) + sw $t0, 236($sp) # array internal_11[4 * internal_24] = internal_23 - lw $t0, 192($sp) # $t0 = internal_24 + lw $t0, 232($sp) # $t0 = internal_24 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 244($sp) # $t1 = internal_11 + lw $t1, 284($sp) # $t1 = internal_11 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 196($sp) + lw $t0, 236($sp) sw $t0, 0($t1) # array internal_12[4 * internal_24] = internal_4 - lw $t0, 192($sp) # $t0 = internal_24 + lw $t0, 232($sp) # $t0 = internal_24 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 240($sp) # $t1 = internal_12 + lw $t1, 280($sp) # $t1 = internal_12 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 272($sp) + lw $t0, 312($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -10525,7 +12321,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 188($sp) # internal_25 = address of allocated object Int + sw $v0, 228($sp) # internal_25 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -10537,7 +12333,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 184($sp) # internal_26 = address of allocated object Int + sw $v0, 224($sp) # internal_26 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -10549,7 +12345,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 176($sp) # internal_28 = address of allocated object Int + sw $v0, 216($sp) # internal_28 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -10561,7 +12357,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 172($sp) # internal_29 = address of allocated object Int + sw $v0, 212($sp) # internal_29 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -10573,155 +12369,155 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 164($sp) # internal_31 = address of allocated object Int + sw $v0, 204($sp) # internal_31 = address of allocated object Int - foreach_type_start_8794497403564: + foreach_type_start_8753943036435: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_25 - lw $t0, 200($sp) + lw $t0, 240($sp) sw $t0, 4($sp) # Storing internal_25 # Argument internal_2 - lw $t0, 292($sp) + lw $t0, 332($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 196($sp) # internal_26 = result of function_less_than + sw $v1, 236($sp) # internal_26 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_26 then goto foreach_type_body_8794497403564 - lw $t0, 184($sp) # Loading the address of the condition + # If internal_26 then goto foreach_type_body_8753943036435 + lw $t0, 224($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_type_body_8794497403564 + beq $t0, $t1, foreach_type_body_8753943036435 - # Jumping to foreach_type_end_8794497403564 - j foreach_type_end_8794497403564 + # Jumping to foreach_type_end_8753943036435 + j foreach_type_end_8753943036435 - foreach_type_body_8794497403564: + foreach_type_body_8753943036435: # internal_27 = array internal_11[4 * internal_25] - lw $t0, 188($sp) # $t0 = internal_25 + lw $t0, 228($sp) # $t0 = internal_25 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 244($sp) # $t1 = internal_11 + lw $t1, 284($sp) # $t1 = internal_11 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - sw $t0, 180($sp) # internal_27 = array internal_11[4 * internal_25] + sw $t0, 220($sp) # internal_27 = array internal_11[4 * internal_25] # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_28 - lw $t0, 188($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing internal_28 # Argument internal_0 - lw $t0, 300($sp) + lw $t0, 340($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 188($sp) # internal_28 = result of function_assign + sw $v1, 228($sp) # internal_28 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - foreach_ancestor_start_8794497403564: + foreach_ancestor_start_8753943036435: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_28 - lw $t0, 188($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing internal_28 # Argument internal_4 - lw $t0, 284($sp) + lw $t0, 324($sp) sw $t0, 0($sp) # Storing internal_4 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 184($sp) # internal_29 = result of function_less_than + sw $v1, 224($sp) # internal_29 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_29 then goto foreach_ancestor_body_8794497403564 - lw $t0, 172($sp) # Loading the address of the condition + # If internal_29 then goto foreach_ancestor_body_8753943036435 + lw $t0, 212($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_body_8794497403564 + beq $t0, $t1, foreach_ancestor_body_8753943036435 - # Jumping to foreach_ancestor_end_8794497403564 - j foreach_ancestor_end_8794497403564 + # Jumping to foreach_ancestor_end_8753943036435 + j foreach_ancestor_end_8753943036435 - foreach_ancestor_body_8794497403564: + foreach_ancestor_body_8753943036435: # internal_30 = array internal_8[4 * internal_28] - lw $t0, 176($sp) # $t0 = internal_28 + lw $t0, 216($sp) # $t0 = internal_28 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 256($sp) # $t1 = internal_8 + lw $t1, 296($sp) # $t1 = internal_8 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - sw $t0, 168($sp) # internal_30 = array internal_8[4 * internal_28] + sw $t0, 208($sp) # internal_30 = array internal_8[4 * internal_28] # internal_31 = EqualAddress(internal_27, internal_30) - lw $t0, 180($sp) - lw $t1, 168($sp) + lw $t0, 220($sp) + lw $t1, 208($sp) seq $t2, $t0, $t1 - lw $t0, 164($sp) + lw $t0, 204($sp) sw $t2, 8($t0) - # If internal_31 then goto foreach_ancestor_end_8794497403564 - lw $t0, 164($sp) # Loading the address of the condition + # If internal_31 then goto foreach_ancestor_end_8753943036435 + lw $t0, 204($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_end_8794497403564 + beq $t0, $t1, foreach_ancestor_end_8753943036435 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_28 - lw $t0, 188($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing internal_28 # Argument internal_1 - lw $t0, 296($sp) + lw $t0, 336($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 188($sp) # internal_28 = result of function_add + sw $v1, 228($sp) # internal_28 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_ancestor_start_8794497403564 - j foreach_ancestor_start_8794497403564 + # Jumping to foreach_ancestor_start_8753943036435 + j foreach_ancestor_start_8753943036435 - foreach_ancestor_end_8794497403564: + foreach_ancestor_end_8753943036435: # array internal_12[4 * internal_25] = internal_28 - lw $t0, 188($sp) # $t0 = internal_25 + lw $t0, 228($sp) # $t0 = internal_25 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 240($sp) # $t1 = internal_12 + lw $t1, 280($sp) # $t1 = internal_12 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 176($sp) + lw $t0, 216($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -10729,60 +12525,24 @@ addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_25 - lw $t0, 200($sp) - sw $t0, 4($sp) # Storing internal_25 - - # Argument internal_1 - lw $t0, 296($sp) - sw $t0, 0($sp) # Storing internal_1 - - # Calling function function_add - jal function_add - lw $ra, 8($sp) - sw $v1, 200($sp) # internal_25 = result of function_add - addi $sp, $sp, 12 # Freeing space for arguments - - # Jumping to foreach_type_start_8794497403564 - j foreach_type_start_8794497403564 - - foreach_type_end_8794497403564: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_37[0] = '\n' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 140($sp) # internal_37 = "\n" - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object + # Argument internal_25 + lw $t0, 240($sp) + sw $t0, 4($sp) # Storing internal_25 - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object + # Argument internal_1 + lw $t0, 336($sp) + sw $t0, 0($sp) # Storing internal_1 - addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_38[0] = ' ' + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 240($sp) # internal_25 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments - sb $zero, 9($v0) # Null-terminator at the end of the string + # Jumping to foreach_type_start_8753943036435 + j foreach_type_start_8753943036435 - sw $v0, 136($sp) # internal_38 = " " + foreach_type_end_8753943036435: # Allocating Int 0 li $v0, 9 @@ -10794,7 +12554,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 160($sp) # internal_32 = address of allocated object Int + sw $v0, 200($sp) # internal_32 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -10806,7 +12566,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 156($sp) # internal_33 = address of allocated object Int + sw $v0, 196($sp) # internal_33 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -10818,7 +12578,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 152($sp) # internal_34 = address of allocated object Int + sw $v0, 192($sp) # internal_34 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -10830,7 +12590,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 148($sp) # internal_35 = address of allocated object Int + sw $v0, 188($sp) # internal_35 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -10842,67 +12602,67 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 144($sp) # internal_36 = address of allocated object Int + sw $v0, 184($sp) # internal_36 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_35 - lw $t0, 160($sp) + lw $t0, 200($sp) sw $t0, 4($sp) # Storing internal_35 # Argument internal_4 - lw $t0, 284($sp) + lw $t0, 324($sp) sw $t0, 0($sp) # Storing internal_4 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 160($sp) # internal_35 = result of function_assign + sw $v1, 200($sp) # internal_35 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - foreach_min_start_8794497403564: + foreach_min_start_8753943036435: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_32 - lw $t0, 172($sp) + lw $t0, 212($sp) sw $t0, 4($sp) # Storing internal_32 # Argument internal_2 - lw $t0, 292($sp) + lw $t0, 332($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 156($sp) # internal_36 = result of function_less_than + sw $v1, 196($sp) # internal_36 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_36 then goto foreach_min_body_8794497403564 - lw $t0, 144($sp) # Loading the address of the condition + # If internal_36 then goto foreach_min_body_8753943036435 + lw $t0, 184($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_min_body_8794497403564 + beq $t0, $t1, foreach_min_body_8753943036435 - # Jumping to foreach_min_end_8794497403564 - j foreach_min_end_8794497403564 + # Jumping to foreach_min_end_8753943036435 + j foreach_min_end_8753943036435 - foreach_min_body_8794497403564: + foreach_min_body_8753943036435: # internal_34 = array internal_12[4 * internal_32] - lw $t0, 160($sp) # $t0 = internal_32 + lw $t0, 200($sp) # $t0 = internal_32 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 240($sp) # $t1 = internal_12 + lw $t1, 280($sp) # $t1 = internal_12 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 152($sp) # internal_34 = array internal_12[4 * internal_32] + lw $t2, 192($sp) # internal_34 = array internal_12[4 * internal_32] sw $t0, 8($t2) # Passing function arguments @@ -10910,46 +12670,46 @@ sw $ra, 8($sp) # Storing return address # Argument internal_34 - lw $t0, 164($sp) + lw $t0, 204($sp) sw $t0, 4($sp) # Storing internal_34 # Argument internal_35 - lw $t0, 160($sp) + lw $t0, 200($sp) sw $t0, 0($sp) # Storing internal_35 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 156($sp) # internal_36 = result of function_less_than + sw $v1, 196($sp) # internal_36 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_36 then goto update_min_8794497403564 - lw $t0, 144($sp) # Loading the address of the condition + # If internal_36 then goto update_min_8753943036435 + lw $t0, 184($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, update_min_8794497403564 + beq $t0, $t1, update_min_8753943036435 - # Jumping to update_min_end_8794497403564 - j update_min_end_8794497403564 + # Jumping to update_min_end_8753943036435 + j update_min_end_8753943036435 - update_min_8794497403564: + update_min_8753943036435: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_35 - lw $t0, 160($sp) + lw $t0, 200($sp) sw $t0, 4($sp) # Storing internal_35 # Argument internal_34 - lw $t0, 164($sp) + lw $t0, 204($sp) sw $t0, 0($sp) # Storing internal_34 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 160($sp) # internal_35 = result of function_assign + sw $v1, 200($sp) # internal_35 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -10957,46 +12717,46 @@ sw $ra, 8($sp) # Storing return address # Argument internal_33 - lw $t0, 168($sp) + lw $t0, 208($sp) sw $t0, 4($sp) # Storing internal_33 # Argument internal_32 - lw $t0, 172($sp) + lw $t0, 212($sp) sw $t0, 0($sp) # Storing internal_32 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 168($sp) # internal_33 = result of function_assign + sw $v1, 208($sp) # internal_33 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - update_min_end_8794497403564: + update_min_end_8753943036435: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_32 - lw $t0, 172($sp) + lw $t0, 212($sp) sw $t0, 4($sp) # Storing internal_32 # Argument internal_1 - lw $t0, 296($sp) + lw $t0, 336($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 172($sp) # internal_32 = result of function_add + sw $v1, 212($sp) # internal_32 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_min_start_8794497403564 - j foreach_min_start_8794497403564 + # Jumping to foreach_min_start_8753943036435 + j foreach_min_start_8753943036435 - foreach_min_end_8794497403564: + foreach_min_end_8753943036435: # initialize Array [internal_2] - lw $t0, 280($sp) # $t0 = internal_2 + lw $t0, 320($sp) # $t0 = internal_2 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -11004,7 +12764,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 132($sp) # internal_39 = new Array[internal_2] + sw $v0, 180($sp) # internal_37 = new Array[internal_2] # Allocating Int 0 li $v0, 9 @@ -11016,17 +12776,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 128($sp) # internal_40 = address of allocated object Int + sw $v0, 176($sp) # internal_38 = address of allocated object Int - # array internal_39[4 * internal_40] = internal_0 - lw $t0, 128($sp) # $t0 = internal_40 + # array internal_37[4 * internal_38] = internal_0 + lw $t0, 176($sp) # $t0 = internal_38 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 132($sp) # $t1 = internal_39 + lw $t1, 180($sp) # $t1 = internal_37 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 288($sp) + lw $t0, 328($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -11040,17 +12800,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 124($sp) # internal_41 = address of allocated object Int + sw $v0, 172($sp) # internal_39 = address of allocated object Int - # array internal_39[4 * internal_41] = internal_0 - lw $t0, 124($sp) # $t0 = internal_41 + # array internal_37[4 * internal_39] = internal_0 + lw $t0, 172($sp) # $t0 = internal_39 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 132($sp) # $t1 = internal_39 + lw $t1, 180($sp) # $t1 = internal_37 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 288($sp) + lw $t0, 328($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -11064,17 +12824,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 120($sp) # internal_42 = address of allocated object Int + sw $v0, 168($sp) # internal_40 = address of allocated object Int - # array internal_39[4 * internal_42] = internal_0 - lw $t0, 120($sp) # $t0 = internal_42 + # array internal_37[4 * internal_40] = internal_0 + lw $t0, 168($sp) # $t0 = internal_40 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 132($sp) # $t1 = internal_39 + lw $t1, 180($sp) # $t1 = internal_37 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 288($sp) + lw $t0, 328($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -11088,17 +12848,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 116($sp) # internal_43 = address of allocated object Int + sw $v0, 164($sp) # internal_41 = address of allocated object Int - # array internal_39[4 * internal_43] = internal_0 - lw $t0, 116($sp) # $t0 = internal_43 + # array internal_37[4 * internal_41] = internal_0 + lw $t0, 164($sp) # $t0 = internal_41 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 132($sp) # $t1 = internal_39 + lw $t1, 180($sp) # $t1 = internal_37 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 288($sp) + lw $t0, 328($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -11112,17 +12872,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 112($sp) # internal_44 = address of allocated object Int + sw $v0, 160($sp) # internal_42 = address of allocated object Int - # array internal_39[4 * internal_44] = internal_0 - lw $t0, 112($sp) # $t0 = internal_44 + # array internal_37[4 * internal_42] = internal_0 + lw $t0, 160($sp) # $t0 = internal_42 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 132($sp) # $t1 = internal_39 + lw $t1, 180($sp) # $t1 = internal_37 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 288($sp) + lw $t0, 328($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -11136,17 +12896,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 5 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 108($sp) # internal_45 = address of allocated object Int + sw $v0, 156($sp) # internal_43 = address of allocated object Int - # array internal_39[4 * internal_45] = internal_0 - lw $t0, 108($sp) # $t0 = internal_45 + # array internal_37[4 * internal_43] = internal_0 + lw $t0, 156($sp) # $t0 = internal_43 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 132($sp) # $t1 = internal_39 + lw $t1, 180($sp) # $t1 = internal_37 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 288($sp) + lw $t0, 328($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -11160,41 +12920,41 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 104($sp) # internal_46 = address of allocated object Int + sw $v0, 152($sp) # internal_44 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_35 - lw $t0, 160($sp) + lw $t0, 200($sp) sw $t0, 4($sp) # Storing internal_35 # Argument internal_4 - lw $t0, 284($sp) + lw $t0, 324($sp) sw $t0, 0($sp) # Storing internal_4 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 116($sp) # internal_46 = result of function_equal + sw $v1, 164($sp) # internal_44 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # If internal_46 then goto error_branch_8794497403564 - lw $t0, 104($sp) # Loading the address of the condition + # If internal_44 then goto error_branch_8753943036435 + lw $t0, 152($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, error_branch_8794497403564 + beq $t0, $t1, error_branch_8753943036435 - # array internal_39[4 * internal_33] = internal_1 - lw $t0, 156($sp) # $t0 = internal_33 + # array internal_37[4 * internal_33] = internal_1 + lw $t0, 196($sp) # $t0 = internal_33 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 132($sp) # $t1 = internal_39 + lw $t1, 180($sp) # $t1 = internal_37 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 284($sp) + lw $t0, 324($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -11208,7 +12968,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 100($sp) # internal_47 = address of allocated object Int + sw $v0, 148($sp) # internal_45 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -11220,25 +12980,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 96($sp) # internal_48 = address of allocated object Int + sw $v0, 144($sp) # internal_46 = address of allocated object Int - # internal_47 = array internal_39[4 * internal_48] - lw $t0, 96($sp) # $t0 = internal_48 + # internal_45 = array internal_37[4 * internal_46] + lw $t0, 144($sp) # $t0 = internal_46 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 132($sp) # $t1 = internal_39 + lw $t1, 180($sp) # $t1 = internal_37 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 100($sp) # internal_47 = array internal_39[4 * internal_48] + lw $t2, 148($sp) # internal_45 = array internal_37[4 * internal_46] sw $t0, 8($t2) - # If internal_47 then goto branch_A_8794497403564 - lw $t0, 100($sp) # Loading the address of the condition + # If internal_45 then goto branch_A_8753943036435 + lw $t0, 148($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_A_8794497403564 + beq $t0, $t1, branch_A_8753943036435 # Allocating Int 1 li $v0, 9 @@ -11250,25 +13010,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 92($sp) # internal_49 = address of allocated object Int + sw $v0, 140($sp) # internal_47 = address of allocated object Int - # internal_47 = array internal_39[4 * internal_49] - lw $t0, 92($sp) # $t0 = internal_49 + # internal_45 = array internal_37[4 * internal_47] + lw $t0, 140($sp) # $t0 = internal_47 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 132($sp) # $t1 = internal_39 + lw $t1, 180($sp) # $t1 = internal_37 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 100($sp) # internal_47 = array internal_39[4 * internal_49] + lw $t2, 148($sp) # internal_45 = array internal_37[4 * internal_47] sw $t0, 8($t2) - # If internal_47 then goto branch_B_8794497403564 - lw $t0, 100($sp) # Loading the address of the condition + # If internal_45 then goto branch_B_8753943036435 + lw $t0, 148($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_B_8794497403564 + beq $t0, $t1, branch_B_8753943036435 # Allocating Int 2 li $v0, 9 @@ -11280,25 +13040,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 88($sp) # internal_50 = address of allocated object Int + sw $v0, 136($sp) # internal_48 = address of allocated object Int - # internal_47 = array internal_39[4 * internal_50] - lw $t0, 88($sp) # $t0 = internal_50 + # internal_45 = array internal_37[4 * internal_48] + lw $t0, 136($sp) # $t0 = internal_48 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 132($sp) # $t1 = internal_39 + lw $t1, 180($sp) # $t1 = internal_37 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 100($sp) # internal_47 = array internal_39[4 * internal_50] + lw $t2, 148($sp) # internal_45 = array internal_37[4 * internal_48] sw $t0, 8($t2) - # If internal_47 then goto branch_C_8794497403564 - lw $t0, 100($sp) # Loading the address of the condition + # If internal_45 then goto branch_C_8753943036435 + lw $t0, 148($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_C_8794497403564 + beq $t0, $t1, branch_C_8753943036435 # Allocating Int 3 li $v0, 9 @@ -11310,25 +13070,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 84($sp) # internal_51 = address of allocated object Int + sw $v0, 132($sp) # internal_49 = address of allocated object Int - # internal_47 = array internal_39[4 * internal_51] - lw $t0, 84($sp) # $t0 = internal_51 + # internal_45 = array internal_37[4 * internal_49] + lw $t0, 132($sp) # $t0 = internal_49 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 132($sp) # $t1 = internal_39 + lw $t1, 180($sp) # $t1 = internal_37 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 100($sp) # internal_47 = array internal_39[4 * internal_51] + lw $t2, 148($sp) # internal_45 = array internal_37[4 * internal_49] sw $t0, 8($t2) - # If internal_47 then goto branch_D_8794497403564 - lw $t0, 100($sp) # Loading the address of the condition + # If internal_45 then goto branch_D_8753943036435 + lw $t0, 148($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_D_8794497403564 + beq $t0, $t1, branch_D_8753943036435 # Allocating Int 4 li $v0, 9 @@ -11340,25 +13100,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # internal_52 = address of allocated object Int + sw $v0, 128($sp) # internal_50 = address of allocated object Int - # internal_47 = array internal_39[4 * internal_52] - lw $t0, 80($sp) # $t0 = internal_52 + # internal_45 = array internal_37[4 * internal_50] + lw $t0, 128($sp) # $t0 = internal_50 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 132($sp) # $t1 = internal_39 + lw $t1, 180($sp) # $t1 = internal_37 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 100($sp) # internal_47 = array internal_39[4 * internal_52] + lw $t2, 148($sp) # internal_45 = array internal_37[4 * internal_50] sw $t0, 8($t2) - # If internal_47 then goto branch_E_8794497403564 - lw $t0, 100($sp) # Loading the address of the condition + # If internal_45 then goto branch_E_8753943036435 + lw $t0, 148($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_E_8794497403564 + beq $t0, $t1, branch_E_8753943036435 # Allocating Int 5 li $v0, 9 @@ -11370,44 +13130,44 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 5 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 76($sp) # internal_53 = address of allocated object Int + sw $v0, 124($sp) # internal_51 = address of allocated object Int - # internal_47 = array internal_39[4 * internal_53] - lw $t0, 76($sp) # $t0 = internal_53 + # internal_45 = array internal_37[4 * internal_51] + lw $t0, 124($sp) # $t0 = internal_51 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 132($sp) # $t1 = internal_39 + lw $t1, 180($sp) # $t1 = internal_37 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 100($sp) # internal_47 = array internal_39[4 * internal_53] + lw $t2, 148($sp) # internal_45 = array internal_37[4 * internal_51] sw $t0, 8($t2) - # If internal_47 then goto branch_Object_8794497403564 - lw $t0, 100($sp) # Loading the address of the condition + # If internal_45 then goto branch_Object_8753943036435 + lw $t0, 148($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Object_8794497403564 + beq $t0, $t1, branch_Object_8753943036435 - branch_A_8794497403564: + branch_A_8753943036435: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument a - lw $t0, 80($sp) + lw $t0, 128($sp) sw $t0, 4($sp) # Storing a # Argument var - lw $t0, 304($sp) + lw $t0, 344($sp) sw $t0, 0($sp) # Storing var # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 80($sp) # a = result of function_assign + sw $v1, 128($sp) # a = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -11422,130 +13182,154 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 67 - sb $t0, 8($v0) # internal_56[0] = 'C' + sb $t0, 8($v0) # internal_54[0] = 'C' addi $t0, $zero, 108 - sb $t0, 9($v0) # internal_56[1] = 'l' + sb $t0, 9($v0) # internal_54[1] = 'l' addi $t0, $zero, 97 - sb $t0, 10($v0) # internal_56[2] = 'a' + sb $t0, 10($v0) # internal_54[2] = 'a' addi $t0, $zero, 115 - sb $t0, 11($v0) # internal_56[3] = 's' + sb $t0, 11($v0) # internal_54[3] = 's' addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_56[4] = 's' + sb $t0, 12($v0) # internal_54[4] = 's' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_56[5] = ' ' + sb $t0, 13($v0) # internal_54[5] = ' ' addi $t0, $zero, 116 - sb $t0, 14($v0) # internal_56[6] = 't' + sb $t0, 14($v0) # internal_54[6] = 't' addi $t0, $zero, 121 - sb $t0, 15($v0) # internal_56[7] = 'y' + sb $t0, 15($v0) # internal_54[7] = 'y' addi $t0, $zero, 112 - sb $t0, 16($v0) # internal_56[8] = 'p' + sb $t0, 16($v0) # internal_54[8] = 'p' addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_56[9] = 'e' + sb $t0, 17($v0) # internal_54[9] = 'e' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_56[10] = ' ' + sb $t0, 18($v0) # internal_54[10] = ' ' addi $t0, $zero, 105 - sb $t0, 19($v0) # internal_56[11] = 'i' + sb $t0, 19($v0) # internal_54[11] = 'i' addi $t0, $zero, 115 - sb $t0, 20($v0) # internal_56[12] = 's' + sb $t0, 20($v0) # internal_54[12] = 's' addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_56[13] = ' ' + sb $t0, 21($v0) # internal_54[13] = ' ' addi $t0, $zero, 110 - sb $t0, 22($v0) # internal_56[14] = 'n' + sb $t0, 22($v0) # internal_54[14] = 'n' addi $t0, $zero, 111 - sb $t0, 23($v0) # internal_56[15] = 'o' + sb $t0, 23($v0) # internal_54[15] = 'o' addi $t0, $zero, 119 - sb $t0, 24($v0) # internal_56[16] = 'w' + sb $t0, 24($v0) # internal_54[16] = 'w' addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_56[17] = ' ' + sb $t0, 25($v0) # internal_54[17] = ' ' addi $t0, $zero, 65 - sb $t0, 26($v0) # internal_56[18] = 'A' + sb $t0, 26($v0) # internal_54[18] = 'A' addi $t0, $zero, 10 - sb $t0, 27($v0) # internal_56[19] = '\n' + sb $t0, 27($v0) # internal_54[19] = '\n' sb $zero, 28($v0) # Null-terminator at the end of the string - sw $v0, 64($sp) # internal_56 = "Class type is now A\n" + sw $v0, 112($sp) # internal_54 = "Class type is now A\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_56 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 336($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 104($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 100($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 308($sp) + lw $t0, 348($sp) sw $t0, 4($sp) # Storing self - # Argument internal_56 - lw $t0, 76($sp) - sw $t0, 0($sp) # Storing internal_56 + # Argument internal_54 + lw $t0, 124($sp) + sw $t0, 0($sp) # Storing internal_54 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_57 + lw $t0, 112($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 72($sp) # internal_57 = result of function_out_string_at_IO + sw $v1, 120($sp) # internal_55 = result of internal_57 addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_54 - lw $t0, 84($sp) - sw $t0, 4($sp) # Storing internal_54 + # Argument internal_52 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_52 - # Argument internal_57 - lw $t0, 72($sp) - sw $t0, 0($sp) # Storing internal_57 + # Argument internal_55 + lw $t0, 120($sp) + sw $t0, 0($sp) # Storing internal_55 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 84($sp) # internal_54 = result of function_assign + sw $v1, 132($sp) # internal_52 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_54 = internal_57 - lw $t0, 60($sp) - sw $t0, 72($sp) + # internal_52 = internal_55 + lw $t0, 108($sp) + sw $t0, 120($sp) - # Jumping to branch_end_8794497403564 - j branch_end_8794497403564 + # Jumping to branch_end_8753943036435 + j branch_end_8753943036435 - branch_B_8794497403564: + branch_B_8753943036435: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument b - lw $t0, 68($sp) + lw $t0, 108($sp) sw $t0, 4($sp) # Storing b # Argument var - lw $t0, 304($sp) + lw $t0, 344($sp) sw $t0, 0($sp) # Storing var # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 68($sp) # b = result of function_assign + sw $v1, 108($sp) # b = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -11621,69 +13405,93 @@ sb $zero, 28($v0) # Null-terminator at the end of the string - sw $v0, 52($sp) # internal_59 = "Class type is now B\n" + sw $v0, 92($sp) # internal_59 = "Class type is now B\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_61 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 336($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 84($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 80($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 308($sp) + lw $t0, 348($sp) sw $t0, 4($sp) # Storing self # Argument internal_59 - lw $t0, 64($sp) + lw $t0, 104($sp) sw $t0, 0($sp) # Storing internal_59 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_62 + lw $t0, 92($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 60($sp) # internal_60 = result of function_out_string_at_IO + sw $v1, 100($sp) # internal_60 = result of internal_62 addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_54 - lw $t0, 84($sp) - sw $t0, 4($sp) # Storing internal_54 + # Argument internal_52 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_52 # Argument internal_60 - lw $t0, 60($sp) + lw $t0, 100($sp) sw $t0, 0($sp) # Storing internal_60 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 84($sp) # internal_54 = result of function_assign + sw $v1, 132($sp) # internal_52 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_54 = internal_60 - lw $t0, 48($sp) - sw $t0, 72($sp) + # internal_52 = internal_60 + lw $t0, 88($sp) + sw $t0, 120($sp) - # Jumping to branch_end_8794497403564 - j branch_end_8794497403564 + # Jumping to branch_end_8753943036435 + j branch_end_8753943036435 - branch_C_8794497403564: + branch_C_8753943036435: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument c - lw $t0, 56($sp) + lw $t0, 88($sp) sw $t0, 4($sp) # Storing c # Argument var - lw $t0, 304($sp) + lw $t0, 344($sp) sw $t0, 0($sp) # Storing var # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 56($sp) # c = result of function_assign + sw $v1, 88($sp) # c = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -11698,130 +13506,154 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 67 - sb $t0, 8($v0) # internal_62[0] = 'C' + sb $t0, 8($v0) # internal_64[0] = 'C' addi $t0, $zero, 108 - sb $t0, 9($v0) # internal_62[1] = 'l' + sb $t0, 9($v0) # internal_64[1] = 'l' addi $t0, $zero, 97 - sb $t0, 10($v0) # internal_62[2] = 'a' + sb $t0, 10($v0) # internal_64[2] = 'a' addi $t0, $zero, 115 - sb $t0, 11($v0) # internal_62[3] = 's' + sb $t0, 11($v0) # internal_64[3] = 's' addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_62[4] = 's' + sb $t0, 12($v0) # internal_64[4] = 's' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_62[5] = ' ' + sb $t0, 13($v0) # internal_64[5] = ' ' addi $t0, $zero, 116 - sb $t0, 14($v0) # internal_62[6] = 't' + sb $t0, 14($v0) # internal_64[6] = 't' addi $t0, $zero, 121 - sb $t0, 15($v0) # internal_62[7] = 'y' + sb $t0, 15($v0) # internal_64[7] = 'y' addi $t0, $zero, 112 - sb $t0, 16($v0) # internal_62[8] = 'p' + sb $t0, 16($v0) # internal_64[8] = 'p' addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_62[9] = 'e' + sb $t0, 17($v0) # internal_64[9] = 'e' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_62[10] = ' ' + sb $t0, 18($v0) # internal_64[10] = ' ' addi $t0, $zero, 105 - sb $t0, 19($v0) # internal_62[11] = 'i' + sb $t0, 19($v0) # internal_64[11] = 'i' addi $t0, $zero, 115 - sb $t0, 20($v0) # internal_62[12] = 's' + sb $t0, 20($v0) # internal_64[12] = 's' addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_62[13] = ' ' + sb $t0, 21($v0) # internal_64[13] = ' ' addi $t0, $zero, 110 - sb $t0, 22($v0) # internal_62[14] = 'n' + sb $t0, 22($v0) # internal_64[14] = 'n' addi $t0, $zero, 111 - sb $t0, 23($v0) # internal_62[15] = 'o' + sb $t0, 23($v0) # internal_64[15] = 'o' addi $t0, $zero, 119 - sb $t0, 24($v0) # internal_62[16] = 'w' + sb $t0, 24($v0) # internal_64[16] = 'w' addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_62[17] = ' ' + sb $t0, 25($v0) # internal_64[17] = ' ' addi $t0, $zero, 67 - sb $t0, 26($v0) # internal_62[18] = 'C' + sb $t0, 26($v0) # internal_64[18] = 'C' addi $t0, $zero, 10 - sb $t0, 27($v0) # internal_62[19] = '\n' + sb $t0, 27($v0) # internal_64[19] = '\n' sb $zero, 28($v0) # Null-terminator at the end of the string - sw $v0, 40($sp) # internal_62 = "Class type is now C\n" + sw $v0, 72($sp) # internal_64 = "Class type is now C\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_66 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 336($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 64($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 60($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 308($sp) + lw $t0, 348($sp) sw $t0, 4($sp) # Storing self - # Argument internal_62 - lw $t0, 52($sp) - sw $t0, 0($sp) # Storing internal_62 + # Argument internal_64 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_64 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_67 + lw $t0, 72($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 48($sp) # internal_63 = result of function_out_string_at_IO + sw $v1, 80($sp) # internal_65 = result of internal_67 addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_54 - lw $t0, 84($sp) - sw $t0, 4($sp) # Storing internal_54 + # Argument internal_52 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_52 - # Argument internal_63 - lw $t0, 48($sp) - sw $t0, 0($sp) # Storing internal_63 + # Argument internal_65 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_65 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 84($sp) # internal_54 = result of function_assign + sw $v1, 132($sp) # internal_52 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_54 = internal_63 - lw $t0, 36($sp) - sw $t0, 72($sp) + # internal_52 = internal_65 + lw $t0, 68($sp) + sw $t0, 120($sp) - # Jumping to branch_end_8794497403564 - j branch_end_8794497403564 + # Jumping to branch_end_8753943036435 + j branch_end_8753943036435 - branch_D_8794497403564: + branch_D_8753943036435: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument d - lw $t0, 44($sp) + lw $t0, 68($sp) sw $t0, 4($sp) # Storing d # Argument var - lw $t0, 304($sp) + lw $t0, 344($sp) sw $t0, 0($sp) # Storing var # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 44($sp) # d = result of function_assign + sw $v1, 68($sp) # d = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -11836,130 +13668,154 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 67 - sb $t0, 8($v0) # internal_65[0] = 'C' + sb $t0, 8($v0) # internal_69[0] = 'C' addi $t0, $zero, 108 - sb $t0, 9($v0) # internal_65[1] = 'l' + sb $t0, 9($v0) # internal_69[1] = 'l' addi $t0, $zero, 97 - sb $t0, 10($v0) # internal_65[2] = 'a' + sb $t0, 10($v0) # internal_69[2] = 'a' addi $t0, $zero, 115 - sb $t0, 11($v0) # internal_65[3] = 's' + sb $t0, 11($v0) # internal_69[3] = 's' addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_65[4] = 's' + sb $t0, 12($v0) # internal_69[4] = 's' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_65[5] = ' ' + sb $t0, 13($v0) # internal_69[5] = ' ' addi $t0, $zero, 116 - sb $t0, 14($v0) # internal_65[6] = 't' + sb $t0, 14($v0) # internal_69[6] = 't' addi $t0, $zero, 121 - sb $t0, 15($v0) # internal_65[7] = 'y' + sb $t0, 15($v0) # internal_69[7] = 'y' addi $t0, $zero, 112 - sb $t0, 16($v0) # internal_65[8] = 'p' + sb $t0, 16($v0) # internal_69[8] = 'p' addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_65[9] = 'e' + sb $t0, 17($v0) # internal_69[9] = 'e' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_65[10] = ' ' + sb $t0, 18($v0) # internal_69[10] = ' ' addi $t0, $zero, 105 - sb $t0, 19($v0) # internal_65[11] = 'i' + sb $t0, 19($v0) # internal_69[11] = 'i' addi $t0, $zero, 115 - sb $t0, 20($v0) # internal_65[12] = 's' + sb $t0, 20($v0) # internal_69[12] = 's' addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_65[13] = ' ' + sb $t0, 21($v0) # internal_69[13] = ' ' addi $t0, $zero, 110 - sb $t0, 22($v0) # internal_65[14] = 'n' + sb $t0, 22($v0) # internal_69[14] = 'n' addi $t0, $zero, 111 - sb $t0, 23($v0) # internal_65[15] = 'o' + sb $t0, 23($v0) # internal_69[15] = 'o' addi $t0, $zero, 119 - sb $t0, 24($v0) # internal_65[16] = 'w' + sb $t0, 24($v0) # internal_69[16] = 'w' addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_65[17] = ' ' + sb $t0, 25($v0) # internal_69[17] = ' ' addi $t0, $zero, 68 - sb $t0, 26($v0) # internal_65[18] = 'D' + sb $t0, 26($v0) # internal_69[18] = 'D' addi $t0, $zero, 10 - sb $t0, 27($v0) # internal_65[19] = '\n' + sb $t0, 27($v0) # internal_69[19] = '\n' sb $zero, 28($v0) # Null-terminator at the end of the string - sw $v0, 28($sp) # internal_65 = "Class type is now D\n" + sw $v0, 52($sp) # internal_69 = "Class type is now D\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_71 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 336($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 44($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 40($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 308($sp) + lw $t0, 348($sp) sw $t0, 4($sp) # Storing self - # Argument internal_65 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_65 + # Argument internal_69 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_69 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_72 + lw $t0, 52($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 36($sp) # internal_66 = result of function_out_string_at_IO + sw $v1, 60($sp) # internal_70 = result of internal_72 addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_54 - lw $t0, 84($sp) - sw $t0, 4($sp) # Storing internal_54 + # Argument internal_52 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_52 - # Argument internal_66 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_66 + # Argument internal_70 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_70 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 84($sp) # internal_54 = result of function_assign + sw $v1, 132($sp) # internal_52 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_54 = internal_66 - lw $t0, 24($sp) - sw $t0, 72($sp) + # internal_52 = internal_70 + lw $t0, 48($sp) + sw $t0, 120($sp) - # Jumping to branch_end_8794497403564 - j branch_end_8794497403564 + # Jumping to branch_end_8753943036435 + j branch_end_8753943036435 - branch_E_8794497403564: + branch_E_8753943036435: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument e - lw $t0, 32($sp) + lw $t0, 48($sp) sw $t0, 4($sp) # Storing e # Argument var - lw $t0, 304($sp) + lw $t0, 344($sp) sw $t0, 0($sp) # Storing var # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 32($sp) # e = result of function_assign + sw $v1, 48($sp) # e = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -11974,130 +13830,154 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 67 - sb $t0, 8($v0) # internal_68[0] = 'C' + sb $t0, 8($v0) # internal_74[0] = 'C' addi $t0, $zero, 108 - sb $t0, 9($v0) # internal_68[1] = 'l' + sb $t0, 9($v0) # internal_74[1] = 'l' addi $t0, $zero, 97 - sb $t0, 10($v0) # internal_68[2] = 'a' + sb $t0, 10($v0) # internal_74[2] = 'a' addi $t0, $zero, 115 - sb $t0, 11($v0) # internal_68[3] = 's' + sb $t0, 11($v0) # internal_74[3] = 's' addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_68[4] = 's' + sb $t0, 12($v0) # internal_74[4] = 's' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_68[5] = ' ' + sb $t0, 13($v0) # internal_74[5] = ' ' addi $t0, $zero, 116 - sb $t0, 14($v0) # internal_68[6] = 't' + sb $t0, 14($v0) # internal_74[6] = 't' addi $t0, $zero, 121 - sb $t0, 15($v0) # internal_68[7] = 'y' + sb $t0, 15($v0) # internal_74[7] = 'y' addi $t0, $zero, 112 - sb $t0, 16($v0) # internal_68[8] = 'p' + sb $t0, 16($v0) # internal_74[8] = 'p' addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_68[9] = 'e' + sb $t0, 17($v0) # internal_74[9] = 'e' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_68[10] = ' ' + sb $t0, 18($v0) # internal_74[10] = ' ' addi $t0, $zero, 105 - sb $t0, 19($v0) # internal_68[11] = 'i' + sb $t0, 19($v0) # internal_74[11] = 'i' addi $t0, $zero, 115 - sb $t0, 20($v0) # internal_68[12] = 's' + sb $t0, 20($v0) # internal_74[12] = 's' addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_68[13] = ' ' + sb $t0, 21($v0) # internal_74[13] = ' ' addi $t0, $zero, 110 - sb $t0, 22($v0) # internal_68[14] = 'n' + sb $t0, 22($v0) # internal_74[14] = 'n' addi $t0, $zero, 111 - sb $t0, 23($v0) # internal_68[15] = 'o' + sb $t0, 23($v0) # internal_74[15] = 'o' addi $t0, $zero, 119 - sb $t0, 24($v0) # internal_68[16] = 'w' + sb $t0, 24($v0) # internal_74[16] = 'w' addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_68[17] = ' ' + sb $t0, 25($v0) # internal_74[17] = ' ' addi $t0, $zero, 69 - sb $t0, 26($v0) # internal_68[18] = 'E' + sb $t0, 26($v0) # internal_74[18] = 'E' addi $t0, $zero, 10 - sb $t0, 27($v0) # internal_68[19] = '\n' + sb $t0, 27($v0) # internal_74[19] = '\n' sb $zero, 28($v0) # Null-terminator at the end of the string - sw $v0, 16($sp) # internal_68 = "Class type is now E\n" + sw $v0, 32($sp) # internal_74 = "Class type is now E\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_76 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 336($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 24($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 20($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 308($sp) + lw $t0, 348($sp) sw $t0, 4($sp) # Storing self - # Argument internal_68 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_68 + # Argument internal_74 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_74 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_77 + lw $t0, 32($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 24($sp) # internal_69 = result of function_out_string_at_IO + sw $v1, 40($sp) # internal_75 = result of internal_77 addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_54 - lw $t0, 84($sp) - sw $t0, 4($sp) # Storing internal_54 + # Argument internal_52 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_52 - # Argument internal_69 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_69 + # Argument internal_75 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_75 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 84($sp) # internal_54 = result of function_assign + sw $v1, 132($sp) # internal_52 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_54 = internal_69 - lw $t0, 12($sp) - sw $t0, 72($sp) + # internal_52 = internal_75 + lw $t0, 28($sp) + sw $t0, 120($sp) - # Jumping to branch_end_8794497403564 - j branch_end_8794497403564 + # Jumping to branch_end_8753943036435 + j branch_end_8753943036435 - branch_Object_8794497403564: + branch_Object_8753943036435: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument o - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 4($sp) # Storing o # Argument var - lw $t0, 304($sp) + lw $t0, 344($sp) sw $t0, 0($sp) # Storing var # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 20($sp) # o = result of function_assign + sw $v1, 28($sp) # o = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -12112,93 +13992,117 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 79 - sb $t0, 8($v0) # internal_71[0] = 'O' + sb $t0, 8($v0) # internal_79[0] = 'O' addi $t0, $zero, 111 - sb $t0, 9($v0) # internal_71[1] = 'o' + sb $t0, 9($v0) # internal_79[1] = 'o' addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_71[2] = 'o' + sb $t0, 10($v0) # internal_79[2] = 'o' addi $t0, $zero, 111 - sb $t0, 11($v0) # internal_71[3] = 'o' + sb $t0, 11($v0) # internal_79[3] = 'o' addi $t0, $zero, 112 - sb $t0, 12($v0) # internal_71[4] = 'p' + sb $t0, 12($v0) # internal_79[4] = 'p' addi $t0, $zero, 115 - sb $t0, 13($v0) # internal_71[5] = 's' + sb $t0, 13($v0) # internal_79[5] = 's' addi $t0, $zero, 10 - sb $t0, 14($v0) # internal_71[6] = '\n' + sb $t0, 14($v0) # internal_79[6] = '\n' sb $zero, 15($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_71 = "Oooops\n" + sw $v0, 12($sp) # internal_79 = "Oooops\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_81 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 336($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 308($sp) + lw $t0, 348($sp) sw $t0, 4($sp) # Storing self - # Argument internal_71 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_71 + # Argument internal_79 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_79 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_82 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_72 = result of function_out_string_at_IO + sw $v1, 20($sp) # internal_80 = result of internal_82 addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_54 - lw $t0, 84($sp) - sw $t0, 4($sp) # Storing internal_54 + # Argument internal_52 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_52 - # Argument internal_72 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_72 + # Argument internal_80 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_80 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 84($sp) # internal_54 = result of function_assign + sw $v1, 132($sp) # internal_52 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_54 = internal_72 - lw $t0, 0($sp) - sw $t0, 72($sp) + # internal_52 = internal_80 + lw $t0, 8($sp) + sw $t0, 120($sp) - # Jumping to branch_end_8794497403564 - j branch_end_8794497403564 + # Jumping to branch_end_8753943036435 + j branch_end_8753943036435 - error_branch_8794497403564: + error_branch_8753943036435: - branch_end_8794497403564: + branch_end_8753943036435: # Loading return value in $v1 - lw $v1, 72($sp) + lw $v1, 120($sp) # Freeing space for local variables - addi $sp, $sp, 292 + addi $sp, $sp, 332 jr $ra function_print_at_Main: # Function parameters - # $ra = 36($sp) - # self = 32($sp) - # var = 28($sp) + # $ra = 68($sp) + # self = 64($sp) + # var = 60($sp) # Reserving space for local variables - addi $sp, $sp, -28 + addi $sp, $sp, -60 # Allocating A2I li $v0, 9 @@ -12207,20 +14111,20 @@ la $t0, type_A2I # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 20($sp) # internal_1 = address of allocated object A2I + sw $v0, 52($sp) # internal_1 = address of allocated object A2I # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_1 - lw $t0, 28($sp) + lw $t0, 60($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function___init___at_A2I jal function___init___at_A2I lw $ra, 4($sp) - sw $v1, 28($sp) # internal_1 = result of function___init___at_A2I + sw $v1, 60($sp) # internal_1 = result of function___init___at_A2I addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments @@ -12228,67 +14132,139 @@ sw $ra, 8($sp) # Storing return address # Argument z - lw $t0, 36($sp) + lw $t0, 68($sp) sw $t0, 4($sp) # Storing z # Argument internal_1 - lw $t0, 32($sp) + lw $t0, 64($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 36($sp) # z = result of function_assign + sw $v1, 68($sp) # z = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_3 = address of allocated object Int + + # Get method value of A + lw $t0, 60($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 44($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 40($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument var - lw $t0, 36($sp) + lw $t0, 68($sp) sw $t0, 0($sp) # Storing var - # Calling function function_value_at_A - jal function_value_at_A + # Calling function internal_4 + lw $t0, 48($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 24($sp) # internal_2 = result of function_value_at_A + sw $v1, 56($sp) # internal_2 = result of internal_4 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_6 = address of allocated object Int + + # Get method i2a of A2I + lw $t0, 56($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 32($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 28($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument z - lw $t0, 36($sp) + lw $t0, 68($sp) sw $t0, 4($sp) # Storing z # Argument internal_2 - lw $t0, 28($sp) + lw $t0, 60($sp) sw $t0, 0($sp) # Storing internal_2 - # Calling function function_i2a_at_A2I - jal function_i2a_at_A2I + # Calling function internal_7 + lw $t0, 40($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 24($sp) # internal_3 = result of function_i2a_at_A2I + sw $v1, 48($sp) # internal_5 = result of internal_7 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_9 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 64($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 44($sp) + lw $t0, 76($sp) sw $t0, 4($sp) # Storing self - # Argument internal_3 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_3 + # Argument internal_5 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_5 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_10 + lw $t0, 28($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 20($sp) # internal_4 = result of function_out_string_at_IO + sw $v1, 36($sp) # internal_8 = result of internal_10 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -12303,45 +14279,69 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_5[0] = ' ' + sb $t0, 8($v0) # internal_11[0] = ' ' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_5 = " " + sw $v0, 12($sp) # internal_11 = " " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_13 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 64($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 44($sp) + lw $t0, 76($sp) sw $t0, 4($sp) # Storing self - # Argument internal_5 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_5 + # Argument internal_11 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_11 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_14 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_6 = result of function_out_string_at_IO + sw $v1, 20($sp) # internal_12 = result of internal_14 addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 28 + addi $sp, $sp, 60 jr $ra function_main_at_Main: # Function parameters - # $ra = 820($sp) - # self = 816($sp) + # $ra = 1232($sp) + # self = 1228($sp) # Reserving space for local variables - addi $sp, $sp, -816 + addi $sp, $sp, -1228 # Allocating A li $v0, 9 @@ -12350,36 +14350,36 @@ la $t0, type_A # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 812($sp) # internal_0 = address of allocated object A + sw $v0, 1224($sp) # internal_0 = address of allocated object A # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 820($sp) + lw $t0, 1232($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_A jal function___init___at_A lw $ra, 4($sp) - sw $v1, 820($sp) # internal_0 = result of function___init___at_A + sw $v1, 1232($sp) # internal_0 = result of function___init___at_A addi $sp, $sp, 8 # Freeing space for arguments # Set attribute avar of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 812($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8794497362086 + lw $t0, 1228($sp) # $t0 = self + lw $t1, 1224($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8753942936052 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8794497362086 + beq $t6, $t5, int_set_attribute_8753942936052 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8794497362086 - j object_set_attribute_8794497362086 - int_set_attribute_8794497362086: + beq $t6, $t5, bool_set_attribute_8753942936052 + j object_set_attribute_8753942936052 + int_set_attribute_8753942936052: li $v0, 9 addi $a0, $zero, 12 syscall @@ -12388,8 +14388,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.avar = internal_0 - j end_set_attribute_8794497362086 - bool_set_attribute_8794497362086: + j end_set_attribute_8753942936052 + bool_set_attribute_8753942936052: li $v0, 9 addi $a0, $zero, 12 syscall @@ -12398,26 +14398,29 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.avar = internal_0 - j end_set_attribute_8794497362086 - object_set_attribute_8794497362086: + j end_set_attribute_8753942936052 + object_set_attribute_8753942936052: sw $t1, 12($t0) # self.avar = internal_0 - end_set_attribute_8794497362086: + end_set_attribute_8753942936052: + + # Allocating NUll to internal_1 + sw $zero, 1220($sp) # internal_1 = 0 - while_start_8794497406615: + while_start_8753943038970: # Get attribute flag of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 20($t0) # Get the attribute 'flag' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'flag' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497362146 + beq $t6, $t5, int_get_attribute_8753942936384 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497362146 - j object_get_attribute_8794497362146 - int_get_attribute_8794497362146: + beq $t6, $t5, bool_get_attribute_8753942936384 + j object_get_attribute_8753942936384 + int_get_attribute_8753942936384: li $v0, 9 addi $a0, $zero, 12 syscall @@ -12425,9 +14428,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 808($sp) # internal_1 = self.flag - j end_get_attribute_8794497362146 - bool_get_attribute_8794497362146: + sw $v0, 1216($sp) # internal_2 = self.flag + j end_get_attribute_8753942936384 + bool_get_attribute_8753942936384: li $v0, 9 addi $a0, $zero, 12 syscall @@ -12435,22 +14438,22 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 808($sp) # internal_1 = self.flag - j end_get_attribute_8794497362146 - object_get_attribute_8794497362146: - sw $t1, 808($sp) # internal_1 = flag - end_get_attribute_8794497362146: - - # If internal_1 then goto while_body_8794497406615 - lw $t0, 808($sp) # Loading the address of the condition + sw $v0, 1216($sp) # internal_2 = self.flag + j end_get_attribute_8753942936384 + object_get_attribute_8753942936384: + sw $t1, 1216($sp) # internal_2 = self.flag + end_get_attribute_8753942936384: + + # If internal_2 then goto while_body_8753943038970 + lw $t0, 1216($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8794497406615 + beq $t0, $t1, while_body_8753943038970 - # Jumping to while_end_8794497406615 - j while_end_8794497406615 + # Jumping to while_end_8753943038970 + j while_end_8753943038970 - while_body_8794497406615: + while_body_8753943038970: # Allocating String li $v0, 9 @@ -12464,61 +14467,85 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 110 - sb $t0, 8($v0) # internal_2[0] = 'n' + sb $t0, 8($v0) # internal_3[0] = 'n' addi $t0, $zero, 117 - sb $t0, 9($v0) # internal_2[1] = 'u' + sb $t0, 9($v0) # internal_3[1] = 'u' addi $t0, $zero, 109 - sb $t0, 10($v0) # internal_2[2] = 'm' + sb $t0, 10($v0) # internal_3[2] = 'm' addi $t0, $zero, 98 - sb $t0, 11($v0) # internal_2[3] = 'b' + sb $t0, 11($v0) # internal_3[3] = 'b' addi $t0, $zero, 101 - sb $t0, 12($v0) # internal_2[4] = 'e' + sb $t0, 12($v0) # internal_3[4] = 'e' addi $t0, $zero, 114 - sb $t0, 13($v0) # internal_2[5] = 'r' + sb $t0, 13($v0) # internal_3[5] = 'r' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_2[6] = ' ' + sb $t0, 14($v0) # internal_3[6] = ' ' sb $zero, 15($v0) # Null-terminator at the end of the string - sw $v0, 804($sp) # internal_2 = "number " + sw $v0, 1212($sp) # internal_3 = "number " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 1204($sp) # internal_5 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 1204($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 1200($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 828($sp) + lw $t0, 1240($sp) sw $t0, 4($sp) # Storing self - # Argument internal_2 - lw $t0, 816($sp) - sw $t0, 0($sp) # Storing internal_2 + # Argument internal_3 + lw $t0, 1224($sp) + sw $t0, 0($sp) # Storing internal_3 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_6 + lw $t0, 1212($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 812($sp) # internal_3 = result of function_out_string_at_IO + sw $v1, 1220($sp) # internal_4 = result of internal_6 addi $sp, $sp, 12 # Freeing space for arguments # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497362505 + beq $t6, $t5, int_get_attribute_8753942936507 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497362505 - j object_get_attribute_8794497362505 - int_get_attribute_8794497362505: + beq $t6, $t5, bool_get_attribute_8753942936507 + j object_get_attribute_8753942936507 + int_get_attribute_8753942936507: li $v0, 9 addi $a0, $zero, 12 syscall @@ -12526,9 +14553,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 796($sp) # internal_4 = self.avar - j end_get_attribute_8794497362505 - bool_get_attribute_8794497362505: + sw $v0, 1196($sp) # internal_7 = self.avar + j end_get_attribute_8753942936507 + bool_get_attribute_8753942936507: li $v0, 9 addi $a0, $zero, 12 syscall @@ -12536,28 +14563,52 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 796($sp) # internal_4 = self.avar - j end_get_attribute_8794497362505 - object_get_attribute_8794497362505: - sw $t1, 796($sp) # internal_4 = avar - end_get_attribute_8794497362505: + sw $v0, 1196($sp) # internal_7 = self.avar + j end_get_attribute_8753942936507 + object_get_attribute_8753942936507: + sw $t1, 1196($sp) # internal_7 = self.avar + end_get_attribute_8753942936507: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 1188($sp) # internal_9 = address of allocated object Int + + # Get method print of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 1188($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 1184($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 828($sp) + lw $t0, 1240($sp) sw $t0, 4($sp) # Storing self - # Argument internal_4 - lw $t0, 808($sp) - sw $t0, 0($sp) # Storing internal_4 + # Argument internal_7 + lw $t0, 1208($sp) + sw $t0, 0($sp) # Storing internal_7 - # Calling function function_print_at_Main - jal function_print_at_Main + # Calling function internal_10 + lw $t0, 1196($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 804($sp) # internal_5 = result of function_print_at_Main + sw $v1, 1204($sp) # internal_8 = result of internal_10 addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bool 0 @@ -12570,21 +14621,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 784($sp) # internal_7 = address of allocated object Int + sw $v0, 1176($sp) # internal_12 = address of allocated object Int # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497362589 + beq $t6, $t5, int_get_attribute_8753942937131 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497362589 - j object_get_attribute_8794497362589 - int_get_attribute_8794497362589: + beq $t6, $t5, bool_get_attribute_8753942937131 + j object_get_attribute_8753942937131 + int_get_attribute_8753942937131: li $v0, 9 addi $a0, $zero, 12 syscall @@ -12592,9 +14643,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 780($sp) # internal_8 = self.avar - j end_get_attribute_8794497362589 - bool_get_attribute_8794497362589: + sw $v0, 1172($sp) # internal_13 = self.avar + j end_get_attribute_8753942937131 + bool_get_attribute_8753942937131: li $v0, 9 addi $a0, $zero, 12 syscall @@ -12602,58 +14653,106 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 780($sp) # internal_8 = self.avar - j end_get_attribute_8794497362589 - object_get_attribute_8794497362589: - sw $t1, 780($sp) # internal_8 = avar - end_get_attribute_8794497362589: + sw $v0, 1172($sp) # internal_13 = self.avar + j end_get_attribute_8753942937131 + object_get_attribute_8753942937131: + sw $t1, 1172($sp) # internal_13 = self.avar + end_get_attribute_8753942937131: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 1164($sp) # internal_15 = address of allocated object Int + + # Get method value of A + lw $t0, 1172($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 1164($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 1160($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_8 - lw $t0, 788($sp) - sw $t0, 0($sp) # Storing internal_8 + # Argument internal_13 + lw $t0, 1180($sp) + sw $t0, 0($sp) # Storing internal_13 - # Calling function function_value_at_A - jal function_value_at_A + # Calling function internal_16 + lw $t0, 1168($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 784($sp) # internal_9 = result of function_value_at_A + sw $v1, 1176($sp) # internal_14 = result of internal_16 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 1152($sp) # internal_18 = address of allocated object Int + + # Get method is_even of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 1152($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 1148($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 828($sp) + lw $t0, 1240($sp) sw $t0, 4($sp) # Storing self - # Argument internal_9 - lw $t0, 788($sp) - sw $t0, 0($sp) # Storing internal_9 + # Argument internal_14 + lw $t0, 1180($sp) + sw $t0, 0($sp) # Storing internal_14 - # Calling function function_is_even_at_Main - jal function_is_even_at_Main + # Calling function internal_19 + lw $t0, 1160($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 784($sp) # internal_10 = result of function_is_even_at_Main + sw $v1, 1168($sp) # internal_17 = result of internal_19 addi $sp, $sp, 12 # Freeing space for arguments - # internal_7 = internal_10 - lw $t0, 772($sp) - sw $t0, 784($sp) + # internal_12 = internal_17 + lw $t0, 1156($sp) + sw $t0, 1176($sp) - # If internal_7 then goto then_8794497404453 - lw $t0, 784($sp) # Loading the address of the condition + # If internal_12 then goto then_8753943036552 + lw $t0, 1176($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497404453 + beq $t0, $t1, then_8753943036552 - # Jumping to else_8794497404453 - j else_8794497404453 + # Jumping to else_8753943036552 + j else_8753943036552 - then_8794497404453: + then_8753943036552: # Allocating String li $v0, 9 @@ -12667,62 +14766,86 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 105 - sb $t0, 8($v0) # internal_11[0] = 'i' + sb $t0, 8($v0) # internal_20[0] = 'i' addi $t0, $zero, 115 - sb $t0, 9($v0) # internal_11[1] = 's' + sb $t0, 9($v0) # internal_20[1] = 's' addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_11[2] = ' ' + sb $t0, 10($v0) # internal_20[2] = ' ' addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_11[3] = 'e' + sb $t0, 11($v0) # internal_20[3] = 'e' addi $t0, $zero, 118 - sb $t0, 12($v0) # internal_11[4] = 'v' + sb $t0, 12($v0) # internal_20[4] = 'v' addi $t0, $zero, 101 - sb $t0, 13($v0) # internal_11[5] = 'e' + sb $t0, 13($v0) # internal_20[5] = 'e' addi $t0, $zero, 110 - sb $t0, 14($v0) # internal_11[6] = 'n' + sb $t0, 14($v0) # internal_20[6] = 'n' addi $t0, $zero, 33 - sb $t0, 15($v0) # internal_11[7] = '!' + sb $t0, 15($v0) # internal_20[7] = '!' addi $t0, $zero, 10 - sb $t0, 16($v0) # internal_11[8] = '\n' + sb $t0, 16($v0) # internal_20[8] = '\n' sb $zero, 17($v0) # Null-terminator at the end of the string - sw $v0, 768($sp) # internal_11 = "is even!\n" + sw $v0, 1144($sp) # internal_20 = "is even!\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 1136($sp) # internal_22 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 1136($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 1132($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 828($sp) + lw $t0, 1240($sp) sw $t0, 4($sp) # Storing self - # Argument internal_11 - lw $t0, 780($sp) - sw $t0, 0($sp) # Storing internal_11 + # Argument internal_20 + lw $t0, 1156($sp) + sw $t0, 0($sp) # Storing internal_20 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_23 + lw $t0, 1144($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 776($sp) # internal_12 = result of function_out_string_at_IO + sw $v1, 1152($sp) # internal_21 = result of internal_23 addi $sp, $sp, 12 # Freeing space for arguments - # internal_6 = internal_12 - lw $t0, 764($sp) - sw $t0, 788($sp) + # internal_11 = internal_21 + lw $t0, 1140($sp) + sw $t0, 1180($sp) - # Jumping to endif_8794497404453 - j endif_8794497404453 + # Jumping to endif_8753943036552 + j endif_8753943036552 - else_8794497404453: + else_8753943036552: # Allocating String li $v0, 9 @@ -12736,73 +14859,97 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 105 - sb $t0, 8($v0) # internal_13[0] = 'i' + sb $t0, 8($v0) # internal_24[0] = 'i' addi $t0, $zero, 115 - sb $t0, 9($v0) # internal_13[1] = 's' + sb $t0, 9($v0) # internal_24[1] = 's' addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_13[2] = ' ' + sb $t0, 10($v0) # internal_24[2] = ' ' addi $t0, $zero, 111 - sb $t0, 11($v0) # internal_13[3] = 'o' + sb $t0, 11($v0) # internal_24[3] = 'o' addi $t0, $zero, 100 - sb $t0, 12($v0) # internal_13[4] = 'd' + sb $t0, 12($v0) # internal_24[4] = 'd' addi $t0, $zero, 100 - sb $t0, 13($v0) # internal_13[5] = 'd' + sb $t0, 13($v0) # internal_24[5] = 'd' addi $t0, $zero, 33 - sb $t0, 14($v0) # internal_13[6] = '!' + sb $t0, 14($v0) # internal_24[6] = '!' addi $t0, $zero, 10 - sb $t0, 15($v0) # internal_13[7] = '\n' + sb $t0, 15($v0) # internal_24[7] = '\n' sb $zero, 16($v0) # Null-terminator at the end of the string - sw $v0, 760($sp) # internal_13 = "is odd!\n" + sw $v0, 1128($sp) # internal_24 = "is odd!\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 1120($sp) # internal_26 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 1120($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 1116($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 828($sp) + lw $t0, 1240($sp) sw $t0, 4($sp) # Storing self - # Argument internal_13 - lw $t0, 772($sp) - sw $t0, 0($sp) # Storing internal_13 + # Argument internal_24 + lw $t0, 1140($sp) + sw $t0, 0($sp) # Storing internal_24 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_27 + lw $t0, 1128($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 768($sp) # internal_14 = result of function_out_string_at_IO + sw $v1, 1136($sp) # internal_25 = result of internal_27 addi $sp, $sp, 12 # Freeing space for arguments - # internal_6 = internal_14 - lw $t0, 756($sp) - sw $t0, 788($sp) + # internal_11 = internal_25 + lw $t0, 1124($sp) + sw $t0, 1180($sp) - # Jumping to endif_8794497404453 - j endif_8794497404453 + # Jumping to endif_8753943036552 + j endif_8753943036552 - endif_8794497404453: + endif_8753943036552: # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497362764 + beq $t6, $t5, int_get_attribute_8753942937658 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497362764 - j object_get_attribute_8794497362764 - int_get_attribute_8794497362764: + beq $t6, $t5, bool_get_attribute_8753942937658 + j object_get_attribute_8753942937658 + int_get_attribute_8753942937658: li $v0, 9 addi $a0, $zero, 12 syscall @@ -12810,9 +14957,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 752($sp) # internal_15 = self.avar - j end_get_attribute_8794497362764 - bool_get_attribute_8794497362764: + sw $v0, 1112($sp) # internal_28 = self.avar + j end_get_attribute_8753942937658 + bool_get_attribute_8753942937658: li $v0, 9 addi $a0, $zero, 12 syscall @@ -12820,58 +14967,106 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 752($sp) # internal_15 = self.avar - j end_get_attribute_8794497362764 - object_get_attribute_8794497362764: - sw $t1, 752($sp) # internal_15 = avar - end_get_attribute_8794497362764: + sw $v0, 1112($sp) # internal_28 = self.avar + j end_get_attribute_8753942937658 + object_get_attribute_8753942937658: + sw $t1, 1112($sp) # internal_28 = self.avar + end_get_attribute_8753942937658: + + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 1104($sp) # internal_30 = address of allocated object Int + + # Get method class_type of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 1104($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 1100($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 828($sp) + lw $t0, 1240($sp) sw $t0, 4($sp) # Storing self - # Argument internal_15 - lw $t0, 764($sp) - sw $t0, 0($sp) # Storing internal_15 + # Argument internal_28 + lw $t0, 1124($sp) + sw $t0, 0($sp) # Storing internal_28 - # Calling function function_class_type_at_Main - jal function_class_type_at_Main + # Calling function internal_31 + lw $t0, 1112($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 760($sp) # internal_16 = result of function_class_type_at_Main + sw $v1, 1120($sp) # internal_29 = result of internal_31 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 1092($sp) # internal_33 = address of allocated object Int + + # Get method menu of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 1092($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 1088($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 824($sp) + lw $t0, 1236($sp) sw $t0, 0($sp) # Storing self - # Calling function function_menu_at_Main - jal function_menu_at_Main + # Calling function internal_34 + lw $t0, 1096($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 752($sp) # internal_17 = result of function_menu_at_Main + sw $v1, 1104($sp) # internal_32 = result of internal_34 addi $sp, $sp, 8 # Freeing space for arguments # Set attribute char of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 744($sp) # $t1 = internal_17 - beq $t1, $zero, object_set_attribute_8794497362785 + lw $t0, 1228($sp) # $t0 = self + lw $t1, 1096($sp) # $t1 = internal_32 + beq $t1, $zero, object_set_attribute_8753942937703 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8794497362785 + beq $t6, $t5, int_set_attribute_8753942937703 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8794497362785 - j object_set_attribute_8794497362785 - int_set_attribute_8794497362785: + beq $t6, $t5, bool_set_attribute_8753942937703 + j object_set_attribute_8753942937703 + int_set_attribute_8753942937703: li $v0, 9 addi $a0, $zero, 12 syscall @@ -12879,9 +15074,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($t0) # self.char = internal_17 - j end_set_attribute_8794497362785 - bool_set_attribute_8794497362785: + sw $v0, 8($t0) # self.char = internal_32 + j end_set_attribute_8753942937703 + bool_set_attribute_8753942937703: li $v0, 9 addi $a0, $zero, 12 syscall @@ -12889,11 +15084,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($t0) # self.char = internal_17 - j end_set_attribute_8794497362785 - object_set_attribute_8794497362785: - sw $t1, 8($t0) # self.char = internal_17 - end_set_attribute_8794497362785: + sw $v0, 8($t0) # self.char = internal_32 + j end_set_attribute_8753942937703 + object_set_attribute_8753942937703: + sw $t1, 8($t0) # self.char = internal_32 + end_set_attribute_8753942937703: # Allocating Bool 0 li $v0, 9 @@ -12905,21 +15100,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 736($sp) # internal_19 = address of allocated object Int + sw $v0, 1080($sp) # internal_36 = address of allocated object Int # Get attribute char of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'char' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497362860 + beq $t6, $t5, int_get_attribute_8753942937802 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497362860 - j object_get_attribute_8794497362860 - int_get_attribute_8794497362860: + beq $t6, $t5, bool_get_attribute_8753942937802 + j object_get_attribute_8753942937802 + int_get_attribute_8753942937802: li $v0, 9 addi $a0, $zero, 12 syscall @@ -12927,9 +15122,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 732($sp) # internal_20 = self.char - j end_get_attribute_8794497362860 - bool_get_attribute_8794497362860: + sw $v0, 1076($sp) # internal_37 = self.char + j end_get_attribute_8753942937802 + bool_get_attribute_8753942937802: li $v0, 9 addi $a0, $zero, 12 syscall @@ -12937,11 +15132,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 732($sp) # internal_20 = self.char - j end_get_attribute_8794497362860 - object_get_attribute_8794497362860: - sw $t1, 732($sp) # internal_20 = char - end_get_attribute_8794497362860: + sw $v0, 1076($sp) # internal_37 = self.char + j end_get_attribute_8753942937802 + object_get_attribute_8753942937802: + sw $t1, 1076($sp) # internal_37 = self.char + end_get_attribute_8753942937802: # Allocating String li $v0, 9 @@ -12955,44 +15150,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 97 - sb $t0, 8($v0) # internal_21[0] = 'a' + sb $t0, 8($v0) # internal_38[0] = 'a' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 728($sp) # internal_21 = "a" + sw $v0, 1072($sp) # internal_38 = "a" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_20 - lw $t0, 744($sp) - sw $t0, 4($sp) # Storing internal_20 + # Argument internal_37 + lw $t0, 1088($sp) + sw $t0, 4($sp) # Storing internal_37 - # Argument internal_21 - lw $t0, 740($sp) - sw $t0, 0($sp) # Storing internal_21 + # Argument internal_38 + lw $t0, 1084($sp) + sw $t0, 0($sp) # Storing internal_38 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 736($sp) # internal_22 = result of function_equal + sw $v1, 1080($sp) # internal_39 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_19 = internal_22 - lw $t0, 724($sp) - sw $t0, 736($sp) + # internal_36 = internal_39 + lw $t0, 1068($sp) + sw $t0, 1080($sp) - # If internal_19 then goto then_8794497406600 - lw $t0, 736($sp) # Loading the address of the condition + # If internal_36 then goto then_8753943038955 + lw $t0, 1080($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497406600 + beq $t0, $t1, then_8753943038955 - # Jumping to else_8794497406600 - j else_8794497406600 + # Jumping to else_8753943038955 + j else_8753943038955 - then_8794497406600: + then_8753943038955: # Allocating A li $v0, 9 @@ -13001,68 +15196,116 @@ la $t0, type_A # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 720($sp) # internal_23 = address of allocated object A + sw $v0, 1064($sp) # internal_40 = address of allocated object A # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_23 - lw $t0, 728($sp) - sw $t0, 0($sp) # Storing internal_23 + # Argument internal_40 + lw $t0, 1072($sp) + sw $t0, 0($sp) # Storing internal_40 # Calling function function___init___at_A jal function___init___at_A lw $ra, 4($sp) - sw $v1, 728($sp) # internal_23 = result of function___init___at_A + sw $v1, 1072($sp) # internal_40 = result of function___init___at_A addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 1056($sp) # internal_42 = address of allocated object Int + + # Get method get_int of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 1056($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 1052($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 824($sp) + lw $t0, 1236($sp) sw $t0, 0($sp) # Storing self - # Calling function function_get_int_at_Main - jal function_get_int_at_Main + # Calling function internal_43 + lw $t0, 1060($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 724($sp) # internal_24 = result of function_get_int_at_Main + sw $v1, 1068($sp) # internal_41 = result of internal_43 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 1044($sp) # internal_45 = address of allocated object Int + + # Get method set_var of A + lw $t0, 1064($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 1044($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 1040($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_23 - lw $t0, 732($sp) - sw $t0, 4($sp) # Storing internal_23 + # Argument internal_40 + lw $t0, 1076($sp) + sw $t0, 4($sp) # Storing internal_40 - # Argument internal_24 - lw $t0, 728($sp) - sw $t0, 0($sp) # Storing internal_24 + # Argument internal_41 + lw $t0, 1072($sp) + sw $t0, 0($sp) # Storing internal_41 - # Calling function function_set_var_at_A - jal function_set_var_at_A + # Calling function internal_46 + lw $t0, 1052($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 724($sp) # internal_25 = result of function_set_var_at_A + sw $v1, 1060($sp) # internal_44 = result of internal_46 addi $sp, $sp, 12 # Freeing space for arguments # Set attribute a_var of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 712($sp) # $t1 = internal_25 - beq $t1, $zero, object_set_attribute_8794497362938 + lw $t0, 1228($sp) # $t0 = self + lw $t1, 1048($sp) # $t1 = internal_44 + beq $t1, $zero, object_set_attribute_8753942938143 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8794497362938 + beq $t6, $t5, int_set_attribute_8753942938143 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8794497362938 - j object_set_attribute_8794497362938 - int_set_attribute_8794497362938: + beq $t6, $t5, bool_set_attribute_8753942938143 + j object_set_attribute_8753942938143 + int_set_attribute_8753942938143: li $v0, 9 addi $a0, $zero, 12 syscall @@ -13070,9 +15313,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 16($t0) # self.a_var = internal_25 - j end_set_attribute_8794497362938 - bool_set_attribute_8794497362938: + sw $v0, 16($t0) # self.a_var = internal_44 + j end_set_attribute_8753942938143 + bool_set_attribute_8753942938143: li $v0, 9 addi $a0, $zero, 12 syscall @@ -13080,11 +15323,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 16($t0) # self.a_var = internal_25 - j end_set_attribute_8794497362938 - object_set_attribute_8794497362938: - sw $t1, 16($t0) # self.a_var = internal_25 - end_set_attribute_8794497362938: + sw $v0, 16($t0) # self.a_var = internal_44 + j end_set_attribute_8753942938143 + object_set_attribute_8753942938143: + sw $t1, 16($t0) # self.a_var = internal_44 + end_set_attribute_8753942938143: # Allocating B li $v0, 9 @@ -13093,35 +15336,35 @@ la $t0, type_B # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 708($sp) # internal_26 = address of allocated object B + sw $v0, 1036($sp) # internal_47 = address of allocated object B # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_26 - lw $t0, 716($sp) - sw $t0, 0($sp) # Storing internal_26 + # Argument internal_47 + lw $t0, 1044($sp) + sw $t0, 0($sp) # Storing internal_47 # Calling function function___init___at_B jal function___init___at_B lw $ra, 4($sp) - sw $v1, 716($sp) # internal_26 = result of function___init___at_B + sw $v1, 1044($sp) # internal_47 = result of function___init___at_B addi $sp, $sp, 8 # Freeing space for arguments # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497363339 + beq $t6, $t5, int_get_attribute_8753942938329 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497363339 - j object_get_attribute_8794497363339 - int_get_attribute_8794497363339: + beq $t6, $t5, bool_get_attribute_8753942938329 + j object_get_attribute_8753942938329 + int_get_attribute_8753942938329: li $v0, 9 addi $a0, $zero, 12 syscall @@ -13129,9 +15372,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 704($sp) # internal_27 = self.avar - j end_get_attribute_8794497363339 - bool_get_attribute_8794497363339: + sw $v0, 1032($sp) # internal_48 = self.avar + j end_get_attribute_8753942938329 + bool_get_attribute_8753942938329: li $v0, 9 addi $a0, $zero, 12 syscall @@ -13139,39 +15382,63 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 704($sp) # internal_27 = self.avar - j end_get_attribute_8794497363339 - object_get_attribute_8794497363339: - sw $t1, 704($sp) # internal_27 = avar - end_get_attribute_8794497363339: + sw $v0, 1032($sp) # internal_48 = self.avar + j end_get_attribute_8753942938329 + object_get_attribute_8753942938329: + sw $t1, 1032($sp) # internal_48 = self.avar + end_get_attribute_8753942938329: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 1024($sp) # internal_50 = address of allocated object Int + + # Get method value of A + lw $t0, 1032($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 1024($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 1020($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_27 - lw $t0, 712($sp) - sw $t0, 0($sp) # Storing internal_27 + # Argument internal_48 + lw $t0, 1040($sp) + sw $t0, 0($sp) # Storing internal_48 - # Calling function function_value_at_A - jal function_value_at_A + # Calling function internal_51 + lw $t0, 1028($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 708($sp) # internal_28 = result of function_value_at_A + sw $v1, 1036($sp) # internal_49 = result of internal_51 addi $sp, $sp, 8 # Freeing space for arguments # Get attribute a_var of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 16($t0) # Get the attribute 'a_var' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'a_var' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497363369 + beq $t6, $t5, int_get_attribute_8753942938643 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497363369 - j object_get_attribute_8794497363369 - int_get_attribute_8794497363369: + beq $t6, $t5, bool_get_attribute_8753942938643 + j object_get_attribute_8753942938643 + int_get_attribute_8753942938643: li $v0, 9 addi $a0, $zero, 12 syscall @@ -13179,9 +15446,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 696($sp) # internal_29 = self.a_var - j end_get_attribute_8794497363369 - bool_get_attribute_8794497363369: + sw $v0, 1016($sp) # internal_52 = self.a_var + j end_get_attribute_8753942938643 + bool_get_attribute_8753942938643: li $v0, 9 addi $a0, $zero, 12 syscall @@ -13189,62 +15456,110 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 696($sp) # internal_29 = self.a_var - j end_get_attribute_8794497363369 - object_get_attribute_8794497363369: - sw $t1, 696($sp) # internal_29 = a_var - end_get_attribute_8794497363369: + sw $v0, 1016($sp) # internal_52 = self.a_var + j end_get_attribute_8753942938643 + object_get_attribute_8753942938643: + sw $t1, 1016($sp) # internal_52 = self.a_var + end_get_attribute_8753942938643: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 1008($sp) # internal_54 = address of allocated object Int + + # Get method value of A + lw $t0, 1016($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 1008($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 1004($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_29 - lw $t0, 704($sp) - sw $t0, 0($sp) # Storing internal_29 + # Argument internal_52 + lw $t0, 1024($sp) + sw $t0, 0($sp) # Storing internal_52 - # Calling function function_value_at_A - jal function_value_at_A + # Calling function internal_55 + lw $t0, 1012($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 700($sp) # internal_30 = result of function_value_at_A + sw $v1, 1020($sp) # internal_53 = result of internal_55 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 996($sp) # internal_57 = address of allocated object Int + + # Get method method2 of B + lw $t0, 1036($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 996($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 992($sp) + # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address - # Argument internal_26 - lw $t0, 724($sp) - sw $t0, 8($sp) # Storing internal_26 + # Argument internal_47 + lw $t0, 1052($sp) + sw $t0, 8($sp) # Storing internal_47 - # Argument internal_28 - lw $t0, 716($sp) - sw $t0, 4($sp) # Storing internal_28 + # Argument internal_49 + lw $t0, 1044($sp) + sw $t0, 4($sp) # Storing internal_49 - # Argument internal_30 - lw $t0, 708($sp) - sw $t0, 0($sp) # Storing internal_30 + # Argument internal_53 + lw $t0, 1028($sp) + sw $t0, 0($sp) # Storing internal_53 - # Calling function function_method2_at_A - jal function_method2_at_A + # Calling function internal_58 + lw $t0, 1008($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 704($sp) # internal_31 = result of function_method2_at_A + sw $v1, 1016($sp) # internal_56 = result of internal_58 addi $sp, $sp, 16 # Freeing space for arguments # Set attribute avar of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 688($sp) # $t1 = internal_31 - beq $t1, $zero, object_set_attribute_8794497363276 + lw $t0, 1228($sp) # $t0 = self + lw $t1, 1000($sp) # $t1 = internal_56 + beq $t1, $zero, object_set_attribute_8753942938266 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8794497363276 + beq $t6, $t5, int_set_attribute_8753942938266 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8794497363276 - j object_set_attribute_8794497363276 - int_set_attribute_8794497363276: + beq $t6, $t5, bool_set_attribute_8753942938266 + j object_set_attribute_8753942938266 + int_set_attribute_8753942938266: li $v0, 9 addi $a0, $zero, 12 syscall @@ -13252,9 +15567,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_31 - j end_set_attribute_8794497363276 - bool_set_attribute_8794497363276: + sw $v0, 12($t0) # self.avar = internal_56 + j end_set_attribute_8753942938266 + bool_set_attribute_8753942938266: li $v0, 9 addi $a0, $zero, 12 syscall @@ -13262,20 +15577,20 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_31 - j end_set_attribute_8794497363276 - object_set_attribute_8794497363276: - sw $t1, 12($t0) # self.avar = internal_31 - end_set_attribute_8794497363276: + sw $v0, 12($t0) # self.avar = internal_56 + j end_set_attribute_8753942938266 + object_set_attribute_8753942938266: + sw $t1, 12($t0) # self.avar = internal_56 + end_set_attribute_8753942938266: - # internal_18 = internal_31 - lw $t0, 688($sp) - sw $t0, 740($sp) + # internal_35 = internal_56 + lw $t0, 1000($sp) + sw $t0, 1084($sp) - # Jumping to endif_8794497406600 - j endif_8794497406600 + # Jumping to endif_8753943038955 + j endif_8753943038955 - else_8794497406600: + else_8753943038955: # Allocating Bool 0 li $v0, 9 @@ -13287,21 +15602,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 680($sp) # internal_33 = address of allocated object Int + sw $v0, 984($sp) # internal_60 = address of allocated object Int # Get attribute char of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'char' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497363453 + beq $t6, $t5, int_get_attribute_8753942938775 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497363453 - j object_get_attribute_8794497363453 - int_get_attribute_8794497363453: + beq $t6, $t5, bool_get_attribute_8753942938775 + j object_get_attribute_8753942938775 + int_get_attribute_8753942938775: li $v0, 9 addi $a0, $zero, 12 syscall @@ -13309,9 +15624,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 676($sp) # internal_34 = self.char - j end_get_attribute_8794497363453 - bool_get_attribute_8794497363453: + sw $v0, 980($sp) # internal_61 = self.char + j end_get_attribute_8753942938775 + bool_get_attribute_8753942938775: li $v0, 9 addi $a0, $zero, 12 syscall @@ -13319,11 +15634,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 676($sp) # internal_34 = self.char - j end_get_attribute_8794497363453 - object_get_attribute_8794497363453: - sw $t1, 676($sp) # internal_34 = char - end_get_attribute_8794497363453: + sw $v0, 980($sp) # internal_61 = self.char + j end_get_attribute_8753942938775 + object_get_attribute_8753942938775: + sw $t1, 980($sp) # internal_61 = self.char + end_get_attribute_8753942938775: # Allocating String li $v0, 9 @@ -13337,58 +15652,58 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 98 - sb $t0, 8($v0) # internal_35[0] = 'b' + sb $t0, 8($v0) # internal_62[0] = 'b' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 672($sp) # internal_35 = "b" + sw $v0, 976($sp) # internal_62 = "b" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_34 - lw $t0, 688($sp) - sw $t0, 4($sp) # Storing internal_34 + # Argument internal_61 + lw $t0, 992($sp) + sw $t0, 4($sp) # Storing internal_61 - # Argument internal_35 - lw $t0, 684($sp) - sw $t0, 0($sp) # Storing internal_35 + # Argument internal_62 + lw $t0, 988($sp) + sw $t0, 0($sp) # Storing internal_62 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 680($sp) # internal_36 = result of function_equal + sw $v1, 984($sp) # internal_63 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_33 = internal_36 - lw $t0, 668($sp) - sw $t0, 680($sp) + # internal_60 = internal_63 + lw $t0, 972($sp) + sw $t0, 984($sp) - # If internal_33 then goto then_8794497406594 - lw $t0, 680($sp) # Loading the address of the condition + # If internal_60 then goto then_8753943038949 + lw $t0, 984($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497406594 + beq $t0, $t1, then_8753943038949 - # Jumping to else_8794497406594 - j else_8794497406594 + # Jumping to else_8753943038949 + j else_8753943038949 - then_8794497406594: + then_8753943038949: # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497364050 + beq $t6, $t5, int_get_attribute_8753942938856 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497364050 - j object_get_attribute_8794497364050 - int_get_attribute_8794497364050: + beq $t6, $t5, bool_get_attribute_8753942938856 + j object_get_attribute_8753942938856 + int_get_attribute_8753942938856: li $v0, 9 addi $a0, $zero, 12 syscall @@ -13396,9 +15711,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 664($sp) # internal_37 = self.avar - j end_get_attribute_8794497364050 - bool_get_attribute_8794497364050: + sw $v0, 968($sp) # internal_64 = self.avar + j end_get_attribute_8753942938856 + bool_get_attribute_8753942938856: li $v0, 9 addi $a0, $zero, 12 syscall @@ -13406,11 +15721,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 664($sp) # internal_37 = self.avar - j end_get_attribute_8794497364050 - object_get_attribute_8794497364050: - sw $t1, 664($sp) # internal_37 = avar - end_get_attribute_8794497364050: + sw $v0, 968($sp) # internal_64 = self.avar + j end_get_attribute_8753942938856 + object_get_attribute_8753942938856: + sw $t1, 968($sp) # internal_64 = self.avar + end_get_attribute_8753942938856: # Allocating Int 0 li $v0, 9 @@ -13422,7 +15737,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 660($sp) # internal_38 = address of allocated object Int + sw $v0, 964($sp) # internal_65 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -13434,7 +15749,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 656($sp) # internal_39 = address of allocated object Int + sw $v0, 960($sp) # internal_66 = address of allocated object Int # Allocating Int 3 li $v0, 9 @@ -13446,10 +15761,10 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 652($sp) # internal_40 = address of allocated object Int + sw $v0, 956($sp) # internal_67 = address of allocated object Int - # Allocating NUll to internal_41 - sw $zero, 648($sp) # internal_41 = 0 + # Allocating NUll to internal_68 + sw $zero, 952($sp) # internal_68 = 0 # Allocating Int 0 li $v0, 9 @@ -13461,7 +15776,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 644($sp) # internal_42 = address of allocated object Int + sw $v0, 948($sp) # internal_69 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -13473,66 +15788,66 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 632($sp) # internal_45 = address of allocated object Int + sw $v0, 936($sp) # internal_72 = address of allocated object Int - # internal_43 = typeof internal_37 that is the first word of the object - lw $t0, 664($sp) + # internal_70 = typeof internal_64 that is the first word of the object + lw $t0, 968($sp) lw $t0, 0($t0) - sw $t0, 640($sp) + sw $t0, 944($sp) - # internal_44 = internal_43 - lw $t0, 640($sp) - sw $t0, 636($sp) + # internal_71 = internal_70 + lw $t0, 944($sp) + sw $t0, 940($sp) - while_start_8794497404654: + while_start_8753943037525: - # internal_45 = EqualAddress(internal_44, internal_41) - lw $t0, 636($sp) - lw $t1, 648($sp) + # internal_72 = EqualAddress(internal_71, internal_68) + lw $t0, 940($sp) + lw $t1, 952($sp) seq $t2, $t0, $t1 - lw $t0, 632($sp) + lw $t0, 936($sp) sw $t2, 8($t0) - # If internal_45 then goto while_end_8794497404654 - lw $t0, 632($sp) # Loading the address of the condition + # If internal_72 then goto while_end_8753943037525 + lw $t0, 936($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_end_8794497404654 + beq $t0, $t1, while_end_8753943037525 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_42 - lw $t0, 656($sp) - sw $t0, 4($sp) # Storing internal_42 + # Argument internal_69 + lw $t0, 960($sp) + sw $t0, 4($sp) # Storing internal_69 - # Argument internal_39 - lw $t0, 668($sp) - sw $t0, 0($sp) # Storing internal_39 + # Argument internal_66 + lw $t0, 972($sp) + sw $t0, 0($sp) # Storing internal_66 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 656($sp) # internal_42 = result of function_add + sw $v1, 960($sp) # internal_69 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # internal_44 = ancestor of internal_44 - lw $t0, 636($sp) + # internal_71 = ancestor of internal_71 + lw $t0, 940($sp) lw $t0, 4($t0) - sw $t0, 636($sp) + sw $t0, 940($sp) - # Jumping to while_start_8794497404654 - j while_start_8794497404654 + # Jumping to while_start_8753943037525 + j while_start_8753943037525 - while_end_8794497404654: + while_end_8753943037525: - # internal_44 = internal_43 - lw $t0, 640($sp) - sw $t0, 636($sp) + # internal_71 = internal_70 + lw $t0, 944($sp) + sw $t0, 940($sp) - # initialize Array [internal_42] - lw $t0, 644($sp) # $t0 = internal_42 + # initialize Array [internal_69] + lw $t0, 948($sp) # $t0 = internal_69 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -13540,7 +15855,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 628($sp) # internal_46 = new Array[internal_42] + sw $v0, 932($sp) # internal_73 = new Array[internal_69] # Allocating Int 0 li $v0, 9 @@ -13552,7 +15867,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 624($sp) # internal_47 = address of allocated object Int + sw $v0, 928($sp) # internal_74 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -13564,80 +15879,80 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 620($sp) # internal_48 = address of allocated object Int + sw $v0, 924($sp) # internal_75 = address of allocated object Int - foreach_start_8794497404654: + foreach_start_8753943037525: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_47 - lw $t0, 636($sp) - sw $t0, 4($sp) # Storing internal_47 + # Argument internal_74 + lw $t0, 940($sp) + sw $t0, 4($sp) # Storing internal_74 - # Argument internal_42 - lw $t0, 656($sp) - sw $t0, 0($sp) # Storing internal_42 + # Argument internal_69 + lw $t0, 960($sp) + sw $t0, 0($sp) # Storing internal_69 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 632($sp) # internal_48 = result of function_less_than + sw $v1, 936($sp) # internal_75 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_48 then goto foreach_body_8794497404654 - lw $t0, 620($sp) # Loading the address of the condition + # If internal_75 then goto foreach_body_8753943037525 + lw $t0, 924($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_body_8794497404654 + beq $t0, $t1, foreach_body_8753943037525 - # Jumping to foreach_end_8794497404654 - j foreach_end_8794497404654 + # Jumping to foreach_end_8753943037525 + j foreach_end_8753943037525 - foreach_body_8794497404654: + foreach_body_8753943037525: - # array internal_46[4 * internal_47] = internal_44 - lw $t0, 624($sp) # $t0 = internal_47 + # array internal_73[4 * internal_74] = internal_71 + lw $t0, 928($sp) # $t0 = internal_74 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 628($sp) # $t1 = internal_46 + lw $t1, 932($sp) # $t1 = internal_73 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 636($sp) + lw $t0, 940($sp) sw $t0, 0($t1) - # internal_44 = ancestor of internal_44 - lw $t0, 636($sp) + # internal_71 = ancestor of internal_71 + lw $t0, 940($sp) lw $t0, 4($t0) - sw $t0, 636($sp) + sw $t0, 940($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_47 - lw $t0, 636($sp) - sw $t0, 4($sp) # Storing internal_47 + # Argument internal_74 + lw $t0, 940($sp) + sw $t0, 4($sp) # Storing internal_74 - # Argument internal_39 - lw $t0, 668($sp) - sw $t0, 0($sp) # Storing internal_39 + # Argument internal_66 + lw $t0, 972($sp) + sw $t0, 0($sp) # Storing internal_66 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 636($sp) # internal_47 = result of function_add + sw $v1, 940($sp) # internal_74 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_start_8794497404654 - j foreach_start_8794497404654 + # Jumping to foreach_start_8753943037525 + j foreach_start_8753943037525 - foreach_end_8794497404654: + foreach_end_8753943037525: - # initialize Array [internal_40] - lw $t0, 652($sp) # $t0 = internal_40 + # initialize Array [internal_67] + lw $t0, 956($sp) # $t0 = internal_67 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -13645,10 +15960,10 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 616($sp) # internal_49 = new Array[internal_40] + sw $v0, 920($sp) # internal_76 = new Array[internal_67] - # initialize Array [internal_40] - lw $t0, 652($sp) # $t0 = internal_40 + # initialize Array [internal_67] + lw $t0, 956($sp) # $t0 = internal_67 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -13656,7 +15971,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 612($sp) # internal_50 = new Array[internal_40] + sw $v0, 916($sp) # internal_77 = new Array[internal_67] # Allocating Int 0 li $v0, 9 @@ -13668,32 +15983,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 604($sp) # internal_52 = address of allocated object Int + sw $v0, 908($sp) # internal_79 = address of allocated object Int - # internal_51 = direction of C + # internal_78 = direction of C la $t0, type_C - sw $t0, 608($sp) + sw $t0, 912($sp) - # array internal_49[4 * internal_52] = internal_51 - lw $t0, 604($sp) # $t0 = internal_52 + # array internal_76[4 * internal_79] = internal_78 + lw $t0, 908($sp) # $t0 = internal_79 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 616($sp) # $t1 = internal_49 + lw $t1, 920($sp) # $t1 = internal_76 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 608($sp) + lw $t0, 912($sp) sw $t0, 0($t1) - # array internal_50[4 * internal_52] = internal_42 - lw $t0, 604($sp) # $t0 = internal_52 + # array internal_77[4 * internal_79] = internal_69 + lw $t0, 908($sp) # $t0 = internal_79 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 612($sp) # $t1 = internal_50 + lw $t1, 916($sp) # $t1 = internal_77 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 644($sp) + lw $t0, 948($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -13707,32 +16022,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 596($sp) # internal_54 = address of allocated object Int + sw $v0, 900($sp) # internal_81 = address of allocated object Int - # internal_53 = direction of A + # internal_80 = direction of A la $t0, type_A - sw $t0, 600($sp) + sw $t0, 904($sp) - # array internal_49[4 * internal_54] = internal_53 - lw $t0, 596($sp) # $t0 = internal_54 + # array internal_76[4 * internal_81] = internal_80 + lw $t0, 900($sp) # $t0 = internal_81 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 616($sp) # $t1 = internal_49 + lw $t1, 920($sp) # $t1 = internal_76 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 600($sp) + lw $t0, 904($sp) sw $t0, 0($t1) - # array internal_50[4 * internal_54] = internal_42 - lw $t0, 596($sp) # $t0 = internal_54 + # array internal_77[4 * internal_81] = internal_69 + lw $t0, 900($sp) # $t0 = internal_81 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 612($sp) # $t1 = internal_50 + lw $t1, 916($sp) # $t1 = internal_77 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 644($sp) + lw $t0, 948($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -13746,32 +16061,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 588($sp) # internal_56 = address of allocated object Int + sw $v0, 892($sp) # internal_83 = address of allocated object Int - # internal_55 = direction of Object + # internal_82 = direction of Object la $t0, type_Object - sw $t0, 592($sp) + sw $t0, 896($sp) - # array internal_49[4 * internal_56] = internal_55 - lw $t0, 588($sp) # $t0 = internal_56 + # array internal_76[4 * internal_83] = internal_82 + lw $t0, 892($sp) # $t0 = internal_83 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 616($sp) # $t1 = internal_49 + lw $t1, 920($sp) # $t1 = internal_76 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 592($sp) + lw $t0, 896($sp) sw $t0, 0($t1) - # array internal_50[4 * internal_56] = internal_42 - lw $t0, 588($sp) # $t0 = internal_56 + # array internal_77[4 * internal_83] = internal_69 + lw $t0, 892($sp) # $t0 = internal_83 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 612($sp) # $t1 = internal_50 + lw $t1, 916($sp) # $t1 = internal_77 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 644($sp) + lw $t0, 948($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -13785,7 +16100,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 584($sp) # internal_57 = address of allocated object Int + sw $v0, 888($sp) # internal_84 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -13797,7 +16112,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 580($sp) # internal_58 = address of allocated object Int + sw $v0, 884($sp) # internal_85 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -13809,7 +16124,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 572($sp) # internal_60 = address of allocated object Int + sw $v0, 876($sp) # internal_87 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -13821,7 +16136,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 568($sp) # internal_61 = address of allocated object Int + sw $v0, 872($sp) # internal_88 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -13833,155 +16148,155 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 560($sp) # internal_63 = address of allocated object Int + sw $v0, 864($sp) # internal_90 = address of allocated object Int - foreach_type_start_8794497404654: + foreach_type_start_8753943037525: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_57 - lw $t0, 596($sp) - sw $t0, 4($sp) # Storing internal_57 + # Argument internal_84 + lw $t0, 900($sp) + sw $t0, 4($sp) # Storing internal_84 - # Argument internal_40 - lw $t0, 664($sp) - sw $t0, 0($sp) # Storing internal_40 + # Argument internal_67 + lw $t0, 968($sp) + sw $t0, 0($sp) # Storing internal_67 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 592($sp) # internal_58 = result of function_less_than + sw $v1, 896($sp) # internal_85 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_58 then goto foreach_type_body_8794497404654 - lw $t0, 580($sp) # Loading the address of the condition + # If internal_85 then goto foreach_type_body_8753943037525 + lw $t0, 884($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_type_body_8794497404654 + beq $t0, $t1, foreach_type_body_8753943037525 - # Jumping to foreach_type_end_8794497404654 - j foreach_type_end_8794497404654 + # Jumping to foreach_type_end_8753943037525 + j foreach_type_end_8753943037525 - foreach_type_body_8794497404654: + foreach_type_body_8753943037525: - # internal_59 = array internal_49[4 * internal_57] - lw $t0, 584($sp) # $t0 = internal_57 + # internal_86 = array internal_76[4 * internal_84] + lw $t0, 888($sp) # $t0 = internal_84 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 616($sp) # $t1 = internal_49 + lw $t1, 920($sp) # $t1 = internal_76 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - sw $t0, 576($sp) # internal_59 = array internal_49[4 * internal_57] + sw $t0, 880($sp) # internal_86 = array internal_76[4 * internal_84] # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_60 - lw $t0, 584($sp) - sw $t0, 4($sp) # Storing internal_60 + # Argument internal_87 + lw $t0, 888($sp) + sw $t0, 4($sp) # Storing internal_87 - # Argument internal_38 - lw $t0, 672($sp) - sw $t0, 0($sp) # Storing internal_38 + # Argument internal_65 + lw $t0, 976($sp) + sw $t0, 0($sp) # Storing internal_65 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 584($sp) # internal_60 = result of function_assign + sw $v1, 888($sp) # internal_87 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - foreach_ancestor_start_8794497404654: + foreach_ancestor_start_8753943037525: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_60 - lw $t0, 584($sp) - sw $t0, 4($sp) # Storing internal_60 + # Argument internal_87 + lw $t0, 888($sp) + sw $t0, 4($sp) # Storing internal_87 - # Argument internal_42 - lw $t0, 656($sp) - sw $t0, 0($sp) # Storing internal_42 + # Argument internal_69 + lw $t0, 960($sp) + sw $t0, 0($sp) # Storing internal_69 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 580($sp) # internal_61 = result of function_less_than + sw $v1, 884($sp) # internal_88 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_61 then goto foreach_ancestor_body_8794497404654 - lw $t0, 568($sp) # Loading the address of the condition + # If internal_88 then goto foreach_ancestor_body_8753943037525 + lw $t0, 872($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_body_8794497404654 + beq $t0, $t1, foreach_ancestor_body_8753943037525 - # Jumping to foreach_ancestor_end_8794497404654 - j foreach_ancestor_end_8794497404654 + # Jumping to foreach_ancestor_end_8753943037525 + j foreach_ancestor_end_8753943037525 - foreach_ancestor_body_8794497404654: + foreach_ancestor_body_8753943037525: - # internal_62 = array internal_46[4 * internal_60] - lw $t0, 572($sp) # $t0 = internal_60 + # internal_89 = array internal_73[4 * internal_87] + lw $t0, 876($sp) # $t0 = internal_87 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 628($sp) # $t1 = internal_46 + lw $t1, 932($sp) # $t1 = internal_73 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - sw $t0, 564($sp) # internal_62 = array internal_46[4 * internal_60] + sw $t0, 868($sp) # internal_89 = array internal_73[4 * internal_87] - # internal_63 = EqualAddress(internal_59, internal_62) - lw $t0, 576($sp) - lw $t1, 564($sp) + # internal_90 = EqualAddress(internal_86, internal_89) + lw $t0, 880($sp) + lw $t1, 868($sp) seq $t2, $t0, $t1 - lw $t0, 560($sp) + lw $t0, 864($sp) sw $t2, 8($t0) - # If internal_63 then goto foreach_ancestor_end_8794497404654 - lw $t0, 560($sp) # Loading the address of the condition + # If internal_90 then goto foreach_ancestor_end_8753943037525 + lw $t0, 864($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_end_8794497404654 + beq $t0, $t1, foreach_ancestor_end_8753943037525 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_60 - lw $t0, 584($sp) - sw $t0, 4($sp) # Storing internal_60 + # Argument internal_87 + lw $t0, 888($sp) + sw $t0, 4($sp) # Storing internal_87 - # Argument internal_39 - lw $t0, 668($sp) - sw $t0, 0($sp) # Storing internal_39 + # Argument internal_66 + lw $t0, 972($sp) + sw $t0, 0($sp) # Storing internal_66 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 584($sp) # internal_60 = result of function_add + sw $v1, 888($sp) # internal_87 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_ancestor_start_8794497404654 - j foreach_ancestor_start_8794497404654 + # Jumping to foreach_ancestor_start_8753943037525 + j foreach_ancestor_start_8753943037525 - foreach_ancestor_end_8794497404654: + foreach_ancestor_end_8753943037525: - # array internal_50[4 * internal_57] = internal_60 - lw $t0, 584($sp) # $t0 = internal_57 + # array internal_77[4 * internal_84] = internal_87 + lw $t0, 888($sp) # $t0 = internal_84 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 612($sp) # $t1 = internal_50 + lw $t1, 916($sp) # $t1 = internal_77 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 572($sp) + lw $t0, 876($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -13989,60 +16304,24 @@ addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_57 - lw $t0, 596($sp) - sw $t0, 4($sp) # Storing internal_57 + # Argument internal_84 + lw $t0, 900($sp) + sw $t0, 4($sp) # Storing internal_84 - # Argument internal_39 - lw $t0, 668($sp) - sw $t0, 0($sp) # Storing internal_39 + # Argument internal_66 + lw $t0, 972($sp) + sw $t0, 0($sp) # Storing internal_66 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 596($sp) # internal_57 = result of function_add + sw $v1, 900($sp) # internal_84 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_type_start_8794497404654 - j foreach_type_start_8794497404654 - - foreach_type_end_8794497404654: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_69[0] = '\n' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 536($sp) # internal_69 = "\n" - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_70[0] = ' ' - - sb $zero, 9($v0) # Null-terminator at the end of the string + # Jumping to foreach_type_start_8753943037525 + j foreach_type_start_8753943037525 - sw $v0, 532($sp) # internal_70 = " " + foreach_type_end_8753943037525: # Allocating Int 0 li $v0, 9 @@ -14054,7 +16333,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 556($sp) # internal_64 = address of allocated object Int + sw $v0, 860($sp) # internal_91 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -14066,7 +16345,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 552($sp) # internal_65 = address of allocated object Int + sw $v0, 856($sp) # internal_92 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -14078,7 +16357,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 548($sp) # internal_66 = address of allocated object Int + sw $v0, 852($sp) # internal_93 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -14090,7 +16369,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 544($sp) # internal_67 = address of allocated object Int + sw $v0, 848($sp) # internal_94 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -14102,161 +16381,161 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 540($sp) # internal_68 = address of allocated object Int + sw $v0, 844($sp) # internal_95 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_67 - lw $t0, 556($sp) - sw $t0, 4($sp) # Storing internal_67 + # Argument internal_94 + lw $t0, 860($sp) + sw $t0, 4($sp) # Storing internal_94 - # Argument internal_42 - lw $t0, 656($sp) - sw $t0, 0($sp) # Storing internal_42 + # Argument internal_69 + lw $t0, 960($sp) + sw $t0, 0($sp) # Storing internal_69 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 556($sp) # internal_67 = result of function_assign + sw $v1, 860($sp) # internal_94 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - foreach_min_start_8794497404654: + foreach_min_start_8753943037525: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_64 - lw $t0, 568($sp) - sw $t0, 4($sp) # Storing internal_64 + # Argument internal_91 + lw $t0, 872($sp) + sw $t0, 4($sp) # Storing internal_91 - # Argument internal_40 - lw $t0, 664($sp) - sw $t0, 0($sp) # Storing internal_40 + # Argument internal_67 + lw $t0, 968($sp) + sw $t0, 0($sp) # Storing internal_67 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 552($sp) # internal_68 = result of function_less_than + sw $v1, 856($sp) # internal_95 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_68 then goto foreach_min_body_8794497404654 - lw $t0, 540($sp) # Loading the address of the condition + # If internal_95 then goto foreach_min_body_8753943037525 + lw $t0, 844($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_min_body_8794497404654 + beq $t0, $t1, foreach_min_body_8753943037525 - # Jumping to foreach_min_end_8794497404654 - j foreach_min_end_8794497404654 + # Jumping to foreach_min_end_8753943037525 + j foreach_min_end_8753943037525 - foreach_min_body_8794497404654: + foreach_min_body_8753943037525: - # internal_66 = array internal_50[4 * internal_64] - lw $t0, 556($sp) # $t0 = internal_64 + # internal_93 = array internal_77[4 * internal_91] + lw $t0, 860($sp) # $t0 = internal_91 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 612($sp) # $t1 = internal_50 + lw $t1, 916($sp) # $t1 = internal_77 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 548($sp) # internal_66 = array internal_50[4 * internal_64] + lw $t2, 852($sp) # internal_93 = array internal_77[4 * internal_91] sw $t0, 8($t2) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_66 - lw $t0, 560($sp) - sw $t0, 4($sp) # Storing internal_66 + # Argument internal_93 + lw $t0, 864($sp) + sw $t0, 4($sp) # Storing internal_93 - # Argument internal_67 - lw $t0, 556($sp) - sw $t0, 0($sp) # Storing internal_67 + # Argument internal_94 + lw $t0, 860($sp) + sw $t0, 0($sp) # Storing internal_94 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 552($sp) # internal_68 = result of function_less_than + sw $v1, 856($sp) # internal_95 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_68 then goto update_min_8794497404654 - lw $t0, 540($sp) # Loading the address of the condition + # If internal_95 then goto update_min_8753943037525 + lw $t0, 844($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, update_min_8794497404654 + beq $t0, $t1, update_min_8753943037525 - # Jumping to update_min_end_8794497404654 - j update_min_end_8794497404654 + # Jumping to update_min_end_8753943037525 + j update_min_end_8753943037525 - update_min_8794497404654: + update_min_8753943037525: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_67 - lw $t0, 556($sp) - sw $t0, 4($sp) # Storing internal_67 + # Argument internal_94 + lw $t0, 860($sp) + sw $t0, 4($sp) # Storing internal_94 - # Argument internal_66 - lw $t0, 560($sp) - sw $t0, 0($sp) # Storing internal_66 + # Argument internal_93 + lw $t0, 864($sp) + sw $t0, 0($sp) # Storing internal_93 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 556($sp) # internal_67 = result of function_assign + sw $v1, 860($sp) # internal_94 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_65 - lw $t0, 564($sp) - sw $t0, 4($sp) # Storing internal_65 + # Argument internal_92 + lw $t0, 868($sp) + sw $t0, 4($sp) # Storing internal_92 - # Argument internal_64 - lw $t0, 568($sp) - sw $t0, 0($sp) # Storing internal_64 + # Argument internal_91 + lw $t0, 872($sp) + sw $t0, 0($sp) # Storing internal_91 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 564($sp) # internal_65 = result of function_assign + sw $v1, 868($sp) # internal_92 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - update_min_end_8794497404654: + update_min_end_8753943037525: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_64 - lw $t0, 568($sp) - sw $t0, 4($sp) # Storing internal_64 + # Argument internal_91 + lw $t0, 872($sp) + sw $t0, 4($sp) # Storing internal_91 - # Argument internal_39 - lw $t0, 668($sp) - sw $t0, 0($sp) # Storing internal_39 + # Argument internal_66 + lw $t0, 972($sp) + sw $t0, 0($sp) # Storing internal_66 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 568($sp) # internal_64 = result of function_add + sw $v1, 872($sp) # internal_91 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_min_start_8794497404654 - j foreach_min_start_8794497404654 + # Jumping to foreach_min_start_8753943037525 + j foreach_min_start_8753943037525 - foreach_min_end_8794497404654: + foreach_min_end_8753943037525: - # initialize Array [internal_40] - lw $t0, 652($sp) # $t0 = internal_40 + # initialize Array [internal_67] + lw $t0, 956($sp) # $t0 = internal_67 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -14264,7 +16543,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 528($sp) # internal_71 = new Array[internal_40] + sw $v0, 840($sp) # internal_96 = new Array[internal_67] # Allocating Int 0 li $v0, 9 @@ -14276,17 +16555,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 524($sp) # internal_72 = address of allocated object Int + sw $v0, 836($sp) # internal_97 = address of allocated object Int - # array internal_71[4 * internal_72] = internal_38 - lw $t0, 524($sp) # $t0 = internal_72 + # array internal_96[4 * internal_97] = internal_65 + lw $t0, 836($sp) # $t0 = internal_97 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 528($sp) # $t1 = internal_71 + lw $t1, 840($sp) # $t1 = internal_96 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 660($sp) + lw $t0, 964($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -14300,17 +16579,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 520($sp) # internal_73 = address of allocated object Int + sw $v0, 832($sp) # internal_98 = address of allocated object Int - # array internal_71[4 * internal_73] = internal_38 - lw $t0, 520($sp) # $t0 = internal_73 + # array internal_96[4 * internal_98] = internal_65 + lw $t0, 832($sp) # $t0 = internal_98 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 528($sp) # $t1 = internal_71 + lw $t1, 840($sp) # $t1 = internal_96 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 660($sp) + lw $t0, 964($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -14324,17 +16603,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 516($sp) # internal_74 = address of allocated object Int + sw $v0, 828($sp) # internal_99 = address of allocated object Int - # array internal_71[4 * internal_74] = internal_38 - lw $t0, 516($sp) # $t0 = internal_74 + # array internal_96[4 * internal_99] = internal_65 + lw $t0, 828($sp) # $t0 = internal_99 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 528($sp) # $t1 = internal_71 + lw $t1, 840($sp) # $t1 = internal_96 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 660($sp) + lw $t0, 964($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -14348,41 +16627,41 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 512($sp) # internal_75 = address of allocated object Int + sw $v0, 824($sp) # internal_100 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_67 - lw $t0, 556($sp) - sw $t0, 4($sp) # Storing internal_67 + # Argument internal_94 + lw $t0, 860($sp) + sw $t0, 4($sp) # Storing internal_94 - # Argument internal_42 - lw $t0, 656($sp) - sw $t0, 0($sp) # Storing internal_42 + # Argument internal_69 + lw $t0, 960($sp) + sw $t0, 0($sp) # Storing internal_69 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 524($sp) # internal_75 = result of function_equal + sw $v1, 836($sp) # internal_100 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # If internal_75 then goto error_branch_8794497404654 - lw $t0, 512($sp) # Loading the address of the condition + # If internal_100 then goto error_branch_8753943037525 + lw $t0, 824($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, error_branch_8794497404654 + beq $t0, $t1, error_branch_8753943037525 - # array internal_71[4 * internal_65] = internal_39 - lw $t0, 552($sp) # $t0 = internal_65 + # array internal_96[4 * internal_92] = internal_66 + lw $t0, 856($sp) # $t0 = internal_92 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 528($sp) # $t1 = internal_71 + lw $t1, 840($sp) # $t1 = internal_96 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 656($sp) + lw $t0, 960($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -14396,7 +16675,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 508($sp) # internal_76 = address of allocated object Int + sw $v0, 820($sp) # internal_101 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -14408,25 +16687,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 504($sp) # internal_77 = address of allocated object Int + sw $v0, 816($sp) # internal_102 = address of allocated object Int - # internal_76 = array internal_71[4 * internal_77] - lw $t0, 504($sp) # $t0 = internal_77 + # internal_101 = array internal_96[4 * internal_102] + lw $t0, 816($sp) # $t0 = internal_102 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 528($sp) # $t1 = internal_71 + lw $t1, 840($sp) # $t1 = internal_96 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 508($sp) # internal_76 = array internal_71[4 * internal_77] + lw $t2, 820($sp) # internal_101 = array internal_96[4 * internal_102] sw $t0, 8($t2) - # If internal_76 then goto branch_C_8794497404654 - lw $t0, 508($sp) # Loading the address of the condition + # If internal_101 then goto branch_C_8753943037525 + lw $t0, 820($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_C_8794497404654 + beq $t0, $t1, branch_C_8753943037525 # Allocating Int 1 li $v0, 9 @@ -14438,25 +16717,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 500($sp) # internal_78 = address of allocated object Int + sw $v0, 812($sp) # internal_103 = address of allocated object Int - # internal_76 = array internal_71[4 * internal_78] - lw $t0, 500($sp) # $t0 = internal_78 + # internal_101 = array internal_96[4 * internal_103] + lw $t0, 812($sp) # $t0 = internal_103 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 528($sp) # $t1 = internal_71 + lw $t1, 840($sp) # $t1 = internal_96 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 508($sp) # internal_76 = array internal_71[4 * internal_78] + lw $t2, 820($sp) # internal_101 = array internal_96[4 * internal_103] sw $t0, 8($t2) - # If internal_76 then goto branch_A_8794497404654 - lw $t0, 508($sp) # Loading the address of the condition + # If internal_101 then goto branch_A_8753943037525 + lw $t0, 820($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_A_8794497404654 + beq $t0, $t1, branch_A_8753943037525 # Allocating Int 2 li $v0, 9 @@ -14468,92 +16747,140 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 496($sp) # internal_79 = address of allocated object Int + sw $v0, 808($sp) # internal_104 = address of allocated object Int - # internal_76 = array internal_71[4 * internal_79] - lw $t0, 496($sp) # $t0 = internal_79 + # internal_101 = array internal_96[4 * internal_104] + lw $t0, 808($sp) # $t0 = internal_104 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 528($sp) # $t1 = internal_71 + lw $t1, 840($sp) # $t1 = internal_96 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 508($sp) # internal_76 = array internal_71[4 * internal_79] + lw $t2, 820($sp) # internal_101 = array internal_96[4 * internal_104] sw $t0, 8($t2) - # If internal_76 then goto branch_Object_8794497404654 - lw $t0, 508($sp) # Loading the address of the condition + # If internal_101 then goto branch_Object_8753943037525 + lw $t0, 820($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Object_8794497404654 + beq $t0, $t1, branch_Object_8753943037525 - branch_C_8794497404654: + branch_C_8753943037525: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument c - lw $t0, 500($sp) + lw $t0, 812($sp) sw $t0, 4($sp) # Storing c - # Argument internal_37 - lw $t0, 676($sp) - sw $t0, 0($sp) # Storing internal_37 + # Argument internal_64 + lw $t0, 980($sp) + sw $t0, 0($sp) # Storing internal_64 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 500($sp) # c = result of function_assign + sw $v1, 812($sp) # c = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 792($sp) # internal_108 = address of allocated object Int + + # Get method value of C + lw $t0, 800($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 792($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 788($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument c - lw $t0, 496($sp) + lw $t0, 808($sp) sw $t0, 0($sp) # Storing c - # Calling function function_value_at_A - jal function_value_at_A + # Calling function internal_109 + lw $t0, 796($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 492($sp) # internal_82 = result of function_value_at_A + sw $v1, 804($sp) # internal_107 = result of internal_109 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 780($sp) # internal_111 = address of allocated object Int + + # Get method method6 of C + lw $t0, 800($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 780($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 776($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument c - lw $t0, 500($sp) + lw $t0, 812($sp) sw $t0, 4($sp) # Storing c - # Argument internal_82 - lw $t0, 496($sp) - sw $t0, 0($sp) # Storing internal_82 + # Argument internal_107 + lw $t0, 808($sp) + sw $t0, 0($sp) # Storing internal_107 - # Calling function function_method6_at_C - jal function_method6_at_C + # Calling function internal_112 + lw $t0, 788($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 492($sp) # internal_83 = result of function_method6_at_C + sw $v1, 796($sp) # internal_110 = result of internal_112 addi $sp, $sp, 12 # Freeing space for arguments # Set attribute avar of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 480($sp) # $t1 = internal_83 - beq $t1, $zero, object_set_attribute_8794497366456 + lw $t0, 1228($sp) # $t0 = self + lw $t1, 784($sp) # $t1 = internal_110 + beq $t1, $zero, object_set_attribute_8753942994969 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8794497366456 + beq $t6, $t5, int_set_attribute_8753942994969 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8794497366456 - j object_set_attribute_8794497366456 - int_set_attribute_8794497366456: + beq $t6, $t5, bool_set_attribute_8753942994969 + j object_set_attribute_8753942994969 + int_set_attribute_8753942994969: li $v0, 9 addi $a0, $zero, 12 syscall @@ -14561,9 +16888,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_83 - j end_set_attribute_8794497366456 - bool_set_attribute_8794497366456: + sw $v0, 12($t0) # self.avar = internal_110 + j end_set_attribute_8753942994969 + bool_set_attribute_8753942994969: li $v0, 9 addi $a0, $zero, 12 syscall @@ -14571,103 +16898,151 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_83 - j end_set_attribute_8794497366456 - object_set_attribute_8794497366456: - sw $t1, 12($t0) # self.avar = internal_83 - end_set_attribute_8794497366456: + sw $v0, 12($t0) # self.avar = internal_110 + j end_set_attribute_8753942994969 + object_set_attribute_8753942994969: + sw $t1, 12($t0) # self.avar = internal_110 + end_set_attribute_8753942994969: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_80 - lw $t0, 504($sp) - sw $t0, 4($sp) # Storing internal_80 + # Argument internal_105 + lw $t0, 816($sp) + sw $t0, 4($sp) # Storing internal_105 - # Argument internal_83 - lw $t0, 492($sp) - sw $t0, 0($sp) # Storing internal_83 + # Argument internal_110 + lw $t0, 796($sp) + sw $t0, 0($sp) # Storing internal_110 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 504($sp) # internal_80 = result of function_assign + sw $v1, 816($sp) # internal_105 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_80 = internal_83 - lw $t0, 480($sp) - sw $t0, 492($sp) + # internal_105 = internal_110 + lw $t0, 784($sp) + sw $t0, 804($sp) - # Jumping to branch_end_8794497404654 - j branch_end_8794497404654 + # Jumping to branch_end_8753943037525 + j branch_end_8753943037525 - branch_A_8794497404654: + branch_A_8753943037525: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument a - lw $t0, 488($sp) + lw $t0, 784($sp) sw $t0, 4($sp) # Storing a - # Argument internal_37 - lw $t0, 676($sp) - sw $t0, 0($sp) # Storing internal_37 + # Argument internal_64 + lw $t0, 980($sp) + sw $t0, 0($sp) # Storing internal_64 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 488($sp) # a = result of function_assign + sw $v1, 784($sp) # a = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 764($sp) # internal_115 = address of allocated object Int + + # Get method value of A + lw $t0, 772($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 764($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 760($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument a - lw $t0, 484($sp) + lw $t0, 780($sp) sw $t0, 0($sp) # Storing a - # Calling function function_value_at_A - jal function_value_at_A + # Calling function internal_116 + lw $t0, 768($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 480($sp) # internal_85 = result of function_value_at_A + sw $v1, 776($sp) # internal_114 = result of internal_116 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 752($sp) # internal_118 = address of allocated object Int + + # Get method method3 of A + lw $t0, 772($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 752($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 748($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument a - lw $t0, 488($sp) + lw $t0, 784($sp) sw $t0, 4($sp) # Storing a - # Argument internal_85 - lw $t0, 484($sp) - sw $t0, 0($sp) # Storing internal_85 + # Argument internal_114 + lw $t0, 780($sp) + sw $t0, 0($sp) # Storing internal_114 - # Calling function function_method3_at_A - jal function_method3_at_A + # Calling function internal_119 + lw $t0, 760($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 480($sp) # internal_86 = result of function_method3_at_A + sw $v1, 768($sp) # internal_117 = result of internal_119 addi $sp, $sp, 12 # Freeing space for arguments # Set attribute avar of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 468($sp) # $t1 = internal_86 - beq $t1, $zero, object_set_attribute_8794497375534 + lw $t0, 1228($sp) # $t0 = self + lw $t1, 756($sp) # $t1 = internal_117 + beq $t1, $zero, object_set_attribute_8753942994213 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8794497375534 + beq $t6, $t5, int_set_attribute_8753942994213 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8794497375534 - j object_set_attribute_8794497375534 - int_set_attribute_8794497375534: + beq $t6, $t5, bool_set_attribute_8753942994213 + j object_set_attribute_8753942994213 + int_set_attribute_8753942994213: li $v0, 9 addi $a0, $zero, 12 syscall @@ -14675,9 +17050,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_86 - j end_set_attribute_8794497375534 - bool_set_attribute_8794497375534: + sw $v0, 12($t0) # self.avar = internal_117 + j end_set_attribute_8753942994213 + bool_set_attribute_8753942994213: li $v0, 9 addi $a0, $zero, 12 syscall @@ -14685,55 +17060,55 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_86 - j end_set_attribute_8794497375534 - object_set_attribute_8794497375534: - sw $t1, 12($t0) # self.avar = internal_86 - end_set_attribute_8794497375534: + sw $v0, 12($t0) # self.avar = internal_117 + j end_set_attribute_8753942994213 + object_set_attribute_8753942994213: + sw $t1, 12($t0) # self.avar = internal_117 + end_set_attribute_8753942994213: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_80 - lw $t0, 504($sp) - sw $t0, 4($sp) # Storing internal_80 + # Argument internal_105 + lw $t0, 816($sp) + sw $t0, 4($sp) # Storing internal_105 - # Argument internal_86 - lw $t0, 480($sp) - sw $t0, 0($sp) # Storing internal_86 + # Argument internal_117 + lw $t0, 768($sp) + sw $t0, 0($sp) # Storing internal_117 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 504($sp) # internal_80 = result of function_assign + sw $v1, 816($sp) # internal_105 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_80 = internal_86 - lw $t0, 468($sp) - sw $t0, 492($sp) + # internal_105 = internal_117 + lw $t0, 756($sp) + sw $t0, 804($sp) - # Jumping to branch_end_8794497404654 - j branch_end_8794497404654 + # Jumping to branch_end_8753943037525 + j branch_end_8753943037525 - branch_Object_8794497404654: + branch_Object_8753943037525: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument o - lw $t0, 476($sp) + lw $t0, 756($sp) sw $t0, 4($sp) # Storing o - # Argument internal_37 - lw $t0, 676($sp) - sw $t0, 0($sp) # Storing internal_37 + # Argument internal_64 + lw $t0, 980($sp) + sw $t0, 0($sp) # Storing internal_64 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 476($sp) # o = result of function_assign + sw $v1, 756($sp) # o = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -14748,60 +17123,108 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 79 - sb $t0, 8($v0) # internal_88[0] = 'O' + sb $t0, 8($v0) # internal_121[0] = 'O' addi $t0, $zero, 111 - sb $t0, 9($v0) # internal_88[1] = 'o' + sb $t0, 9($v0) # internal_121[1] = 'o' addi $t0, $zero, 111 - sb $t0, 10($v0) # internal_88[2] = 'o' + sb $t0, 10($v0) # internal_121[2] = 'o' addi $t0, $zero, 111 - sb $t0, 11($v0) # internal_88[3] = 'o' + sb $t0, 11($v0) # internal_121[3] = 'o' addi $t0, $zero, 112 - sb $t0, 12($v0) # internal_88[4] = 'p' + sb $t0, 12($v0) # internal_121[4] = 'p' addi $t0, $zero, 115 - sb $t0, 13($v0) # internal_88[5] = 's' + sb $t0, 13($v0) # internal_121[5] = 's' addi $t0, $zero, 10 - sb $t0, 14($v0) # internal_88[6] = '\n' + sb $t0, 14($v0) # internal_121[6] = '\n' sb $zero, 15($v0) # Null-terminator at the end of the string - sw $v0, 460($sp) # internal_88 = "Oooops\n" + sw $v0, 740($sp) # internal_121 = "Oooops\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 732($sp) # internal_123 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 732($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 728($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 828($sp) + lw $t0, 1240($sp) sw $t0, 4($sp) # Storing self - # Argument internal_88 - lw $t0, 472($sp) - sw $t0, 0($sp) # Storing internal_88 + # Argument internal_121 + lw $t0, 752($sp) + sw $t0, 0($sp) # Storing internal_121 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_124 + lw $t0, 740($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 468($sp) # internal_89 = result of function_out_string_at_IO + sw $v1, 748($sp) # internal_122 = result of internal_124 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 720($sp) # internal_126 = address of allocated object Int + + # Get method abort of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 720($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 716($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 824($sp) + lw $t0, 1236($sp) sw $t0, 0($sp) # Storing self - # Calling function function_abort_at_Object - jal function_abort_at_Object + # Calling function internal_127 + lw $t0, 724($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 460($sp) # internal_90 = result of function_abort_at_Object + sw $v1, 732($sp) # internal_125 = result of internal_127 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 0 @@ -14814,45 +17237,45 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 448($sp) # internal_91 = address of allocated object Int + sw $v0, 712($sp) # internal_128 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_80 - lw $t0, 504($sp) - sw $t0, 4($sp) # Storing internal_80 + # Argument internal_105 + lw $t0, 816($sp) + sw $t0, 4($sp) # Storing internal_105 - # Argument internal_91 - lw $t0, 460($sp) - sw $t0, 0($sp) # Storing internal_91 + # Argument internal_128 + lw $t0, 724($sp) + sw $t0, 0($sp) # Storing internal_128 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 504($sp) # internal_80 = result of function_assign + sw $v1, 816($sp) # internal_105 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_80 = internal_91 - lw $t0, 448($sp) - sw $t0, 492($sp) + # internal_105 = internal_128 + lw $t0, 712($sp) + sw $t0, 804($sp) - # Jumping to branch_end_8794497404654 - j branch_end_8794497404654 + # Jumping to branch_end_8753943037525 + j branch_end_8753943037525 - error_branch_8794497404654: + error_branch_8753943037525: - branch_end_8794497404654: + branch_end_8753943037525: - # internal_32 = internal_80 - lw $t0, 492($sp) - sw $t0, 684($sp) + # internal_59 = internal_105 + lw $t0, 804($sp) + sw $t0, 988($sp) - # Jumping to endif_8794497406594 - j endif_8794497406594 + # Jumping to endif_8753943038949 + j endif_8753943038949 - else_8794497406594: + else_8753943038949: # Allocating Bool 0 li $v0, 9 @@ -14864,21 +17287,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 440($sp) # internal_93 = address of allocated object Int + sw $v0, 704($sp) # internal_130 = address of allocated object Int # Get attribute char of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'char' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497367372 + beq $t6, $t5, int_get_attribute_8753942990818 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497367372 - j object_get_attribute_8794497367372 - int_get_attribute_8794497367372: + beq $t6, $t5, bool_get_attribute_8753942990818 + j object_get_attribute_8753942990818 + int_get_attribute_8753942990818: li $v0, 9 addi $a0, $zero, 12 syscall @@ -14886,9 +17309,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 436($sp) # internal_94 = self.char - j end_get_attribute_8794497367372 - bool_get_attribute_8794497367372: + sw $v0, 700($sp) # internal_131 = self.char + j end_get_attribute_8753942990818 + bool_get_attribute_8753942990818: li $v0, 9 addi $a0, $zero, 12 syscall @@ -14896,11 +17319,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 436($sp) # internal_94 = self.char - j end_get_attribute_8794497367372 - object_get_attribute_8794497367372: - sw $t1, 436($sp) # internal_94 = char - end_get_attribute_8794497367372: + sw $v0, 700($sp) # internal_131 = self.char + j end_get_attribute_8753942990818 + object_get_attribute_8753942990818: + sw $t1, 700($sp) # internal_131 = self.char + end_get_attribute_8753942990818: # Allocating String li $v0, 9 @@ -14914,44 +17337,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 99 - sb $t0, 8($v0) # internal_95[0] = 'c' + sb $t0, 8($v0) # internal_132[0] = 'c' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 432($sp) # internal_95 = "c" + sw $v0, 696($sp) # internal_132 = "c" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_94 - lw $t0, 448($sp) - sw $t0, 4($sp) # Storing internal_94 + # Argument internal_131 + lw $t0, 712($sp) + sw $t0, 4($sp) # Storing internal_131 - # Argument internal_95 - lw $t0, 444($sp) - sw $t0, 0($sp) # Storing internal_95 + # Argument internal_132 + lw $t0, 708($sp) + sw $t0, 0($sp) # Storing internal_132 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 440($sp) # internal_96 = result of function_equal + sw $v1, 704($sp) # internal_133 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_93 = internal_96 - lw $t0, 428($sp) - sw $t0, 440($sp) + # internal_130 = internal_133 + lw $t0, 692($sp) + sw $t0, 704($sp) - # If internal_93 then goto then_8794497406588 - lw $t0, 440($sp) # Loading the address of the condition + # If internal_130 then goto then_8753943038943 + lw $t0, 704($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497406588 + beq $t0, $t1, then_8753943038943 - # Jumping to else_8794497406588 - j else_8794497406588 + # Jumping to else_8753943038943 + j else_8753943038943 - then_8794497406588: + then_8753943038943: # Allocating A li $v0, 9 @@ -14960,68 +17383,116 @@ la $t0, type_A # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 424($sp) # internal_97 = address of allocated object A + sw $v0, 688($sp) # internal_134 = address of allocated object A # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_97 - lw $t0, 432($sp) - sw $t0, 0($sp) # Storing internal_97 + # Argument internal_134 + lw $t0, 696($sp) + sw $t0, 0($sp) # Storing internal_134 # Calling function function___init___at_A jal function___init___at_A lw $ra, 4($sp) - sw $v1, 432($sp) # internal_97 = result of function___init___at_A + sw $v1, 696($sp) # internal_134 = result of function___init___at_A addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 680($sp) # internal_136 = address of allocated object Int + + # Get method get_int of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 680($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 676($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 824($sp) + lw $t0, 1236($sp) sw $t0, 0($sp) # Storing self - # Calling function function_get_int_at_Main - jal function_get_int_at_Main + # Calling function internal_137 + lw $t0, 684($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 428($sp) # internal_98 = result of function_get_int_at_Main + sw $v1, 692($sp) # internal_135 = result of internal_137 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 668($sp) # internal_139 = address of allocated object Int + + # Get method set_var of A + lw $t0, 688($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 668($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 664($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_97 - lw $t0, 436($sp) - sw $t0, 4($sp) # Storing internal_97 + # Argument internal_134 + lw $t0, 700($sp) + sw $t0, 4($sp) # Storing internal_134 - # Argument internal_98 - lw $t0, 432($sp) - sw $t0, 0($sp) # Storing internal_98 + # Argument internal_135 + lw $t0, 696($sp) + sw $t0, 0($sp) # Storing internal_135 - # Calling function function_set_var_at_A - jal function_set_var_at_A + # Calling function internal_140 + lw $t0, 676($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 428($sp) # internal_99 = result of function_set_var_at_A + sw $v1, 684($sp) # internal_138 = result of internal_140 addi $sp, $sp, 12 # Freeing space for arguments # Set attribute a_var of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 416($sp) # $t1 = internal_99 - beq $t1, $zero, object_set_attribute_8794497367453 + lw $t0, 1228($sp) # $t0 = self + lw $t1, 672($sp) # $t1 = internal_138 + beq $t1, $zero, object_set_attribute_8753942990599 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8794497367453 + beq $t6, $t5, int_set_attribute_8753942990599 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8794497367453 - j object_set_attribute_8794497367453 - int_set_attribute_8794497367453: + beq $t6, $t5, bool_set_attribute_8753942990599 + j object_set_attribute_8753942990599 + int_set_attribute_8753942990599: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15029,9 +17500,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 16($t0) # self.a_var = internal_99 - j end_set_attribute_8794497367453 - bool_set_attribute_8794497367453: + sw $v0, 16($t0) # self.a_var = internal_138 + j end_set_attribute_8753942990599 + bool_set_attribute_8753942990599: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15039,11 +17510,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 16($t0) # self.a_var = internal_99 - j end_set_attribute_8794497367453 - object_set_attribute_8794497367453: - sw $t1, 16($t0) # self.a_var = internal_99 - end_set_attribute_8794497367453: + sw $v0, 16($t0) # self.a_var = internal_138 + j end_set_attribute_8753942990599 + object_set_attribute_8753942990599: + sw $t1, 16($t0) # self.a_var = internal_138 + end_set_attribute_8753942990599: # Allocating D li $v0, 9 @@ -15052,35 +17523,35 @@ la $t0, type_D # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 412($sp) # internal_100 = address of allocated object D + sw $v0, 660($sp) # internal_141 = address of allocated object D # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_100 - lw $t0, 420($sp) - sw $t0, 0($sp) # Storing internal_100 + # Argument internal_141 + lw $t0, 668($sp) + sw $t0, 0($sp) # Storing internal_141 # Calling function function___init___at_D jal function___init___at_D lw $ra, 4($sp) - sw $v1, 420($sp) # internal_100 = result of function___init___at_D + sw $v1, 668($sp) # internal_141 = result of function___init___at_D addi $sp, $sp, 8 # Freeing space for arguments # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497367851 + beq $t6, $t5, int_get_attribute_8753942992701 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497367851 - j object_get_attribute_8794497367851 - int_get_attribute_8794497367851: + beq $t6, $t5, bool_get_attribute_8753942992701 + j object_get_attribute_8753942992701 + int_get_attribute_8753942992701: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15088,9 +17559,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 408($sp) # internal_101 = self.avar - j end_get_attribute_8794497367851 - bool_get_attribute_8794497367851: + sw $v0, 656($sp) # internal_142 = self.avar + j end_get_attribute_8753942992701 + bool_get_attribute_8753942992701: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15098,39 +17569,63 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 408($sp) # internal_101 = self.avar - j end_get_attribute_8794497367851 - object_get_attribute_8794497367851: - sw $t1, 408($sp) # internal_101 = avar - end_get_attribute_8794497367851: + sw $v0, 656($sp) # internal_142 = self.avar + j end_get_attribute_8753942992701 + object_get_attribute_8753942992701: + sw $t1, 656($sp) # internal_142 = self.avar + end_get_attribute_8753942992701: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 648($sp) # internal_144 = address of allocated object Int + + # Get method value of A + lw $t0, 656($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 648($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 644($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_101 - lw $t0, 416($sp) - sw $t0, 0($sp) # Storing internal_101 + # Argument internal_142 + lw $t0, 664($sp) + sw $t0, 0($sp) # Storing internal_142 - # Calling function function_value_at_A - jal function_value_at_A + # Calling function internal_145 + lw $t0, 652($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 412($sp) # internal_102 = result of function_value_at_A + sw $v1, 660($sp) # internal_143 = result of internal_145 addi $sp, $sp, 8 # Freeing space for arguments # Get attribute a_var of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 16($t0) # Get the attribute 'a_var' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'a_var' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497367881 + beq $t6, $t5, int_get_attribute_8753942993399 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497367881 - j object_get_attribute_8794497367881 - int_get_attribute_8794497367881: + beq $t6, $t5, bool_get_attribute_8753942993399 + j object_get_attribute_8753942993399 + int_get_attribute_8753942993399: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15138,9 +17633,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 400($sp) # internal_103 = self.a_var - j end_get_attribute_8794497367881 - bool_get_attribute_8794497367881: + sw $v0, 640($sp) # internal_146 = self.a_var + j end_get_attribute_8753942993399 + bool_get_attribute_8753942993399: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15148,62 +17643,110 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 400($sp) # internal_103 = self.a_var - j end_get_attribute_8794497367881 - object_get_attribute_8794497367881: - sw $t1, 400($sp) # internal_103 = a_var - end_get_attribute_8794497367881: + sw $v0, 640($sp) # internal_146 = self.a_var + j end_get_attribute_8753942993399 + object_get_attribute_8753942993399: + sw $t1, 640($sp) # internal_146 = self.a_var + end_get_attribute_8753942993399: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 632($sp) # internal_148 = address of allocated object Int + + # Get method value of A + lw $t0, 640($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 632($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 628($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_103 - lw $t0, 408($sp) - sw $t0, 0($sp) # Storing internal_103 + # Argument internal_146 + lw $t0, 648($sp) + sw $t0, 0($sp) # Storing internal_146 - # Calling function function_value_at_A - jal function_value_at_A + # Calling function internal_149 + lw $t0, 636($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 404($sp) # internal_104 = result of function_value_at_A + sw $v1, 644($sp) # internal_147 = result of internal_149 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 620($sp) # internal_151 = address of allocated object Int + + # Get method method4 of D + lw $t0, 660($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 620($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 616($sp) + # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address - # Argument internal_100 - lw $t0, 428($sp) - sw $t0, 8($sp) # Storing internal_100 + # Argument internal_141 + lw $t0, 676($sp) + sw $t0, 8($sp) # Storing internal_141 - # Argument internal_102 - lw $t0, 420($sp) - sw $t0, 4($sp) # Storing internal_102 + # Argument internal_143 + lw $t0, 668($sp) + sw $t0, 4($sp) # Storing internal_143 - # Argument internal_104 - lw $t0, 412($sp) - sw $t0, 0($sp) # Storing internal_104 + # Argument internal_147 + lw $t0, 652($sp) + sw $t0, 0($sp) # Storing internal_147 - # Calling function function_method4_at_A - jal function_method4_at_A + # Calling function internal_152 + lw $t0, 632($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 408($sp) # internal_105 = result of function_method4_at_A + sw $v1, 640($sp) # internal_150 = result of internal_152 addi $sp, $sp, 16 # Freeing space for arguments # Set attribute avar of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 392($sp) # $t1 = internal_105 - beq $t1, $zero, object_set_attribute_8794497367528 + lw $t0, 1228($sp) # $t0 = self + lw $t1, 624($sp) # $t1 = internal_150 + beq $t1, $zero, object_set_attribute_8753942992740 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8794497367528 + beq $t6, $t5, int_set_attribute_8753942992740 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8794497367528 - j object_set_attribute_8794497367528 - int_set_attribute_8794497367528: + beq $t6, $t5, bool_set_attribute_8753942992740 + j object_set_attribute_8753942992740 + int_set_attribute_8753942992740: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15211,9 +17754,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_105 - j end_set_attribute_8794497367528 - bool_set_attribute_8794497367528: + sw $v0, 12($t0) # self.avar = internal_150 + j end_set_attribute_8753942992740 + bool_set_attribute_8753942992740: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15221,20 +17764,20 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_105 - j end_set_attribute_8794497367528 - object_set_attribute_8794497367528: - sw $t1, 12($t0) # self.avar = internal_105 - end_set_attribute_8794497367528: + sw $v0, 12($t0) # self.avar = internal_150 + j end_set_attribute_8753942992740 + object_set_attribute_8753942992740: + sw $t1, 12($t0) # self.avar = internal_150 + end_set_attribute_8753942992740: - # internal_92 = internal_105 - lw $t0, 392($sp) - sw $t0, 444($sp) + # internal_129 = internal_150 + lw $t0, 624($sp) + sw $t0, 708($sp) - # Jumping to endif_8794497406588 - j endif_8794497406588 + # Jumping to endif_8753943038943 + j endif_8753943038943 - else_8794497406588: + else_8753943038943: # Allocating Bool 0 li $v0, 9 @@ -15246,21 +17789,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 384($sp) # internal_107 = address of allocated object Int + sw $v0, 608($sp) # internal_154 = address of allocated object Int # Get attribute char of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'char' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497367965 + beq $t6, $t5, int_get_attribute_8753942993252 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497367965 - j object_get_attribute_8794497367965 - int_get_attribute_8794497367965: + beq $t6, $t5, bool_get_attribute_8753942993252 + j object_get_attribute_8753942993252 + int_get_attribute_8753942993252: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15268,9 +17811,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 380($sp) # internal_108 = self.char - j end_get_attribute_8794497367965 - bool_get_attribute_8794497367965: + sw $v0, 604($sp) # internal_155 = self.char + j end_get_attribute_8753942993252 + bool_get_attribute_8753942993252: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15278,11 +17821,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 380($sp) # internal_108 = self.char - j end_get_attribute_8794497367965 - object_get_attribute_8794497367965: - sw $t1, 380($sp) # internal_108 = char - end_get_attribute_8794497367965: + sw $v0, 604($sp) # internal_155 = self.char + j end_get_attribute_8753942993252 + object_get_attribute_8753942993252: + sw $t1, 604($sp) # internal_155 = self.char + end_get_attribute_8753942993252: # Allocating String li $v0, 9 @@ -15296,44 +17839,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 100 - sb $t0, 8($v0) # internal_109[0] = 'd' + sb $t0, 8($v0) # internal_156[0] = 'd' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 376($sp) # internal_109 = "d" + sw $v0, 600($sp) # internal_156 = "d" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_108 - lw $t0, 392($sp) - sw $t0, 4($sp) # Storing internal_108 + # Argument internal_155 + lw $t0, 616($sp) + sw $t0, 4($sp) # Storing internal_155 - # Argument internal_109 - lw $t0, 388($sp) - sw $t0, 0($sp) # Storing internal_109 + # Argument internal_156 + lw $t0, 612($sp) + sw $t0, 0($sp) # Storing internal_156 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 384($sp) # internal_110 = result of function_equal + sw $v1, 608($sp) # internal_157 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_107 = internal_110 - lw $t0, 372($sp) - sw $t0, 384($sp) + # internal_154 = internal_157 + lw $t0, 596($sp) + sw $t0, 608($sp) - # If internal_107 then goto then_8794497406582 - lw $t0, 384($sp) # Loading the address of the condition + # If internal_154 then goto then_8753943038937 + lw $t0, 608($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497406582 + beq $t0, $t1, then_8753943038937 - # Jumping to else_8794497406582 - j else_8794497406582 + # Jumping to else_8753943038937 + j else_8753943038937 - then_8794497406582: + then_8753943038937: # Allocating C li $v0, 9 @@ -15342,35 +17885,35 @@ la $t0, type_C # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 368($sp) # internal_111 = address of allocated object C + sw $v0, 592($sp) # internal_158 = address of allocated object C # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_111 - lw $t0, 376($sp) - sw $t0, 0($sp) # Storing internal_111 + # Argument internal_158 + lw $t0, 600($sp) + sw $t0, 0($sp) # Storing internal_158 # Calling function function___init___at_C jal function___init___at_C lw $ra, 4($sp) - sw $v1, 376($sp) # internal_111 = result of function___init___at_C + sw $v1, 600($sp) # internal_158 = result of function___init___at_C addi $sp, $sp, 8 # Freeing space for arguments # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497368610 + beq $t6, $t5, int_get_attribute_8753942991276 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497368610 - j object_get_attribute_8794497368610 - int_get_attribute_8794497368610: + beq $t6, $t5, bool_get_attribute_8753942991276 + j object_get_attribute_8753942991276 + int_get_attribute_8753942991276: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15378,9 +17921,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 364($sp) # internal_112 = self.avar - j end_get_attribute_8794497368610 - bool_get_attribute_8794497368610: + sw $v0, 588($sp) # internal_159 = self.avar + j end_get_attribute_8753942991276 + bool_get_attribute_8753942991276: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15388,58 +17931,105 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 364($sp) # internal_112 = self.avar - j end_get_attribute_8794497368610 - object_get_attribute_8794497368610: - sw $t1, 364($sp) # internal_112 = avar - end_get_attribute_8794497368610: + sw $v0, 588($sp) # internal_159 = self.avar + j end_get_attribute_8753942991276 + object_get_attribute_8753942991276: + sw $t1, 588($sp) # internal_159 = self.avar + end_get_attribute_8753942991276: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 580($sp) # internal_161 = address of allocated object Int + + # Get method value of A + lw $t0, 588($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 580($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 576($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_112 - lw $t0, 372($sp) - sw $t0, 0($sp) # Storing internal_112 + # Argument internal_159 + lw $t0, 596($sp) + sw $t0, 0($sp) # Storing internal_159 - # Calling function function_value_at_A - jal function_value_at_A + # Calling function internal_162 + lw $t0, 584($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 368($sp) # internal_113 = result of function_value_at_A + sw $v1, 592($sp) # internal_160 = result of internal_162 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 568($sp) # internal_164 = address of allocated object Int + + # Get method method5 of A + lw $t0, 592($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 568($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 564($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_111 - lw $t0, 380($sp) - sw $t0, 4($sp) # Storing internal_111 + # Argument internal_158 + lw $t0, 604($sp) + sw $t0, 4($sp) # Storing internal_158 - # Argument internal_113 - lw $t0, 372($sp) - sw $t0, 0($sp) # Storing internal_113 + # Argument internal_160 + lw $t0, 596($sp) + sw $t0, 0($sp) # Storing internal_160 - # Calling function function_method5_at_C - jal function_method5_at_C + # Calling function function_method5_at_A + jal function_method5_at_A lw $ra, 8($sp) - sw $v1, 368($sp) # internal_114 = result of function_method5_at_C + sw $v1, 584($sp) # internal_163 = result of function_method5_at_A addi $sp, $sp, 12 # Freeing space for arguments # Set attribute avar of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 356($sp) # $t1 = internal_114 - beq $t1, $zero, object_set_attribute_8794497368031 + lw $t0, 1228($sp) # $t0 = self + lw $t1, 572($sp) # $t1 = internal_163 + beq $t1, $zero, object_set_attribute_8753942991312 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8794497368031 + beq $t6, $t5, int_set_attribute_8753942991312 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8794497368031 - j object_set_attribute_8794497368031 - int_set_attribute_8794497368031: + beq $t6, $t5, bool_set_attribute_8753942991312 + j object_set_attribute_8753942991312 + int_set_attribute_8753942991312: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15447,9 +18037,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_114 - j end_set_attribute_8794497368031 - bool_set_attribute_8794497368031: + sw $v0, 12($t0) # self.avar = internal_163 + j end_set_attribute_8753942991312 + bool_set_attribute_8753942991312: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15457,20 +18047,20 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_114 - j end_set_attribute_8794497368031 - object_set_attribute_8794497368031: - sw $t1, 12($t0) # self.avar = internal_114 - end_set_attribute_8794497368031: + sw $v0, 12($t0) # self.avar = internal_163 + j end_set_attribute_8753942991312 + object_set_attribute_8753942991312: + sw $t1, 12($t0) # self.avar = internal_163 + end_set_attribute_8753942991312: - # internal_106 = internal_114 - lw $t0, 356($sp) - sw $t0, 388($sp) + # internal_153 = internal_163 + lw $t0, 572($sp) + sw $t0, 612($sp) - # Jumping to endif_8794497406582 - j endif_8794497406582 + # Jumping to endif_8753943038937 + j endif_8753943038937 - else_8794497406582: + else_8753943038937: # Allocating Bool 0 li $v0, 9 @@ -15482,21 +18072,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 348($sp) # internal_116 = address of allocated object Int + sw $v0, 556($sp) # internal_167 = address of allocated object Int # Get attribute char of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'char' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497368703 + beq $t6, $t5, int_get_attribute_8753942990433 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497368703 - j object_get_attribute_8794497368703 - int_get_attribute_8794497368703: + beq $t6, $t5, bool_get_attribute_8753942990433 + j object_get_attribute_8753942990433 + int_get_attribute_8753942990433: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15504,9 +18094,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 344($sp) # internal_117 = self.char - j end_get_attribute_8794497368703 - bool_get_attribute_8794497368703: + sw $v0, 552($sp) # internal_168 = self.char + j end_get_attribute_8753942990433 + bool_get_attribute_8753942990433: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15514,11 +18104,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 344($sp) # internal_117 = self.char - j end_get_attribute_8794497368703 - object_get_attribute_8794497368703: - sw $t1, 344($sp) # internal_117 = char - end_get_attribute_8794497368703: + sw $v0, 552($sp) # internal_168 = self.char + j end_get_attribute_8753942990433 + object_get_attribute_8753942990433: + sw $t1, 552($sp) # internal_168 = self.char + end_get_attribute_8753942990433: # Allocating String li $v0, 9 @@ -15532,44 +18122,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 101 - sb $t0, 8($v0) # internal_118[0] = 'e' + sb $t0, 8($v0) # internal_169[0] = 'e' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 340($sp) # internal_118 = "e" + sw $v0, 548($sp) # internal_169 = "e" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_117 - lw $t0, 356($sp) - sw $t0, 4($sp) # Storing internal_117 + # Argument internal_168 + lw $t0, 564($sp) + sw $t0, 4($sp) # Storing internal_168 - # Argument internal_118 - lw $t0, 352($sp) - sw $t0, 0($sp) # Storing internal_118 + # Argument internal_169 + lw $t0, 560($sp) + sw $t0, 0($sp) # Storing internal_169 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 348($sp) # internal_119 = result of function_equal + sw $v1, 556($sp) # internal_170 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_116 = internal_119 - lw $t0, 336($sp) - sw $t0, 348($sp) + # internal_167 = internal_170 + lw $t0, 544($sp) + sw $t0, 556($sp) - # If internal_116 then goto then_8794497406576 - lw $t0, 348($sp) # Loading the address of the condition + # If internal_167 then goto then_8753943038931 + lw $t0, 556($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497406576 + beq $t0, $t1, then_8753943038931 - # Jumping to else_8794497406576 - j else_8794497406576 + # Jumping to else_8753943038931 + j else_8753943038931 - then_8794497406576: + then_8753943038931: # Allocating C li $v0, 9 @@ -15578,35 +18168,35 @@ la $t0, type_C # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 332($sp) # internal_120 = address of allocated object C + sw $v0, 540($sp) # internal_171 = address of allocated object C # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_120 - lw $t0, 340($sp) - sw $t0, 0($sp) # Storing internal_120 + # Argument internal_171 + lw $t0, 548($sp) + sw $t0, 0($sp) # Storing internal_171 # Calling function function___init___at_C jal function___init___at_C lw $ra, 4($sp) - sw $v1, 340($sp) # internal_120 = result of function___init___at_C + sw $v1, 548($sp) # internal_171 = result of function___init___at_C addi $sp, $sp, 8 # Freeing space for arguments # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497368324 + beq $t6, $t5, int_get_attribute_8753942942073 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497368324 - j object_get_attribute_8794497368324 - int_get_attribute_8794497368324: + beq $t6, $t5, bool_get_attribute_8753942942073 + j object_get_attribute_8753942942073 + int_get_attribute_8753942942073: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15614,9 +18204,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 328($sp) # internal_121 = self.avar - j end_get_attribute_8794497368324 - bool_get_attribute_8794497368324: + sw $v0, 536($sp) # internal_172 = self.avar + j end_get_attribute_8753942942073 + bool_get_attribute_8753942942073: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15624,58 +18214,105 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 328($sp) # internal_121 = self.avar - j end_get_attribute_8794497368324 - object_get_attribute_8794497368324: - sw $t1, 328($sp) # internal_121 = avar - end_get_attribute_8794497368324: + sw $v0, 536($sp) # internal_172 = self.avar + j end_get_attribute_8753942942073 + object_get_attribute_8753942942073: + sw $t1, 536($sp) # internal_172 = self.avar + end_get_attribute_8753942942073: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 528($sp) # internal_174 = address of allocated object Int + + # Get method value of A + lw $t0, 536($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 528($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 524($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_121 - lw $t0, 336($sp) - sw $t0, 0($sp) # Storing internal_121 + # Argument internal_172 + lw $t0, 544($sp) + sw $t0, 0($sp) # Storing internal_172 - # Calling function function_value_at_A - jal function_value_at_A + # Calling function internal_175 + lw $t0, 532($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 332($sp) # internal_122 = result of function_value_at_A + sw $v1, 540($sp) # internal_173 = result of internal_175 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 516($sp) # internal_177 = address of allocated object Int + + # Get method method5 of B + lw $t0, 540($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 516($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 512($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_120 - lw $t0, 344($sp) - sw $t0, 4($sp) # Storing internal_120 + # Argument internal_171 + lw $t0, 552($sp) + sw $t0, 4($sp) # Storing internal_171 - # Argument internal_122 - lw $t0, 336($sp) - sw $t0, 0($sp) # Storing internal_122 + # Argument internal_173 + lw $t0, 544($sp) + sw $t0, 0($sp) # Storing internal_173 - # Calling function function_method5_at_C - jal function_method5_at_C + # Calling function function_method5_at_B + jal function_method5_at_B lw $ra, 8($sp) - sw $v1, 332($sp) # internal_123 = result of function_method5_at_C + sw $v1, 532($sp) # internal_176 = result of function_method5_at_B addi $sp, $sp, 12 # Freeing space for arguments # Set attribute avar of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 320($sp) # $t1 = internal_123 - beq $t1, $zero, object_set_attribute_8794497368769 + lw $t0, 1228($sp) # $t0 = self + lw $t1, 520($sp) # $t1 = internal_176 + beq $t1, $zero, object_set_attribute_8753942942010 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8794497368769 + beq $t6, $t5, int_set_attribute_8753942942010 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8794497368769 - j object_set_attribute_8794497368769 - int_set_attribute_8794497368769: + beq $t6, $t5, bool_set_attribute_8753942942010 + j object_set_attribute_8753942942010 + int_set_attribute_8753942942010: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15683,9 +18320,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_123 - j end_set_attribute_8794497368769 - bool_set_attribute_8794497368769: + sw $v0, 12($t0) # self.avar = internal_176 + j end_set_attribute_8753942942010 + bool_set_attribute_8753942942010: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15693,20 +18330,20 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_123 - j end_set_attribute_8794497368769 - object_set_attribute_8794497368769: - sw $t1, 12($t0) # self.avar = internal_123 - end_set_attribute_8794497368769: - - # internal_115 = internal_123 - lw $t0, 320($sp) - sw $t0, 352($sp) + sw $v0, 12($t0) # self.avar = internal_176 + j end_set_attribute_8753942942010 + object_set_attribute_8753942942010: + sw $t1, 12($t0) # self.avar = internal_176 + end_set_attribute_8753942942010: + + # internal_166 = internal_176 + lw $t0, 520($sp) + sw $t0, 560($sp) - # Jumping to endif_8794497406576 - j endif_8794497406576 + # Jumping to endif_8753943038931 + j endif_8753943038931 - else_8794497406576: + else_8753943038931: # Allocating Bool 0 li $v0, 9 @@ -15718,21 +18355,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 312($sp) # internal_125 = address of allocated object Int + sw $v0, 504($sp) # internal_180 = address of allocated object Int # Get attribute char of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'char' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497368417 + beq $t6, $t5, int_get_attribute_8753942942218 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497368417 - j object_get_attribute_8794497368417 - int_get_attribute_8794497368417: + beq $t6, $t5, bool_get_attribute_8753942942218 + j object_get_attribute_8753942942218 + int_get_attribute_8753942942218: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15740,9 +18377,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 308($sp) # internal_126 = self.char - j end_get_attribute_8794497368417 - bool_get_attribute_8794497368417: + sw $v0, 500($sp) # internal_181 = self.char + j end_get_attribute_8753942942218 + bool_get_attribute_8753942942218: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15750,11 +18387,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 308($sp) # internal_126 = self.char - j end_get_attribute_8794497368417 - object_get_attribute_8794497368417: - sw $t1, 308($sp) # internal_126 = char - end_get_attribute_8794497368417: + sw $v0, 500($sp) # internal_181 = self.char + j end_get_attribute_8753942942218 + object_get_attribute_8753942942218: + sw $t1, 500($sp) # internal_181 = self.char + end_get_attribute_8753942942218: # Allocating String li $v0, 9 @@ -15768,44 +18405,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 102 - sb $t0, 8($v0) # internal_127[0] = 'f' + sb $t0, 8($v0) # internal_182[0] = 'f' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 304($sp) # internal_127 = "f" + sw $v0, 496($sp) # internal_182 = "f" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_126 - lw $t0, 320($sp) - sw $t0, 4($sp) # Storing internal_126 + # Argument internal_181 + lw $t0, 512($sp) + sw $t0, 4($sp) # Storing internal_181 - # Argument internal_127 - lw $t0, 316($sp) - sw $t0, 0($sp) # Storing internal_127 + # Argument internal_182 + lw $t0, 508($sp) + sw $t0, 0($sp) # Storing internal_182 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 312($sp) # internal_128 = result of function_equal + sw $v1, 504($sp) # internal_183 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_125 = internal_128 - lw $t0, 300($sp) - sw $t0, 312($sp) + # internal_180 = internal_183 + lw $t0, 492($sp) + sw $t0, 504($sp) - # If internal_125 then goto then_8794497406570 - lw $t0, 312($sp) # Loading the address of the condition + # If internal_180 then goto then_8753943038925 + lw $t0, 504($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497406570 + beq $t0, $t1, then_8753943038925 - # Jumping to else_8794497406570 - j else_8794497406570 + # Jumping to else_8753943038925 + j else_8753943038925 - then_8794497406570: + then_8753943038925: # Allocating C li $v0, 9 @@ -15814,35 +18451,35 @@ la $t0, type_C # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 296($sp) # internal_129 = address of allocated object C + sw $v0, 488($sp) # internal_184 = address of allocated object C # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_129 - lw $t0, 304($sp) - sw $t0, 0($sp) # Storing internal_129 + # Argument internal_184 + lw $t0, 496($sp) + sw $t0, 0($sp) # Storing internal_184 # Calling function function___init___at_C jal function___init___at_C lw $ra, 4($sp) - sw $v1, 304($sp) # internal_129 = result of function___init___at_C + sw $v1, 496($sp) # internal_184 = result of function___init___at_C addi $sp, $sp, 8 # Freeing space for arguments # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497368546 + beq $t6, $t5, int_get_attribute_8753942942347 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497368546 - j object_get_attribute_8794497368546 - int_get_attribute_8794497368546: + beq $t6, $t5, bool_get_attribute_8753942942347 + j object_get_attribute_8753942942347 + int_get_attribute_8753942942347: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15850,9 +18487,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 292($sp) # internal_130 = self.avar - j end_get_attribute_8794497368546 - bool_get_attribute_8794497368546: + sw $v0, 484($sp) # internal_185 = self.avar + j end_get_attribute_8753942942347 + bool_get_attribute_8753942942347: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15860,58 +18497,105 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 292($sp) # internal_130 = self.avar - j end_get_attribute_8794497368546 - object_get_attribute_8794497368546: - sw $t1, 292($sp) # internal_130 = avar - end_get_attribute_8794497368546: + sw $v0, 484($sp) # internal_185 = self.avar + j end_get_attribute_8753942942347 + object_get_attribute_8753942942347: + sw $t1, 484($sp) # internal_185 = self.avar + end_get_attribute_8753942942347: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 476($sp) # internal_187 = address of allocated object Int + + # Get method value of A + lw $t0, 484($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 476($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 472($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_130 - lw $t0, 300($sp) - sw $t0, 0($sp) # Storing internal_130 + # Argument internal_185 + lw $t0, 492($sp) + sw $t0, 0($sp) # Storing internal_185 - # Calling function function_value_at_A - jal function_value_at_A + # Calling function internal_188 + lw $t0, 480($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 296($sp) # internal_131 = result of function_value_at_A + sw $v1, 488($sp) # internal_186 = result of internal_188 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 464($sp) # internal_190 = address of allocated object Int + + # Get method method5 of C + lw $t0, 488($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 464($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 460($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_129 - lw $t0, 308($sp) - sw $t0, 4($sp) # Storing internal_129 + # Argument internal_184 + lw $t0, 500($sp) + sw $t0, 4($sp) # Storing internal_184 - # Argument internal_131 - lw $t0, 300($sp) - sw $t0, 0($sp) # Storing internal_131 + # Argument internal_186 + lw $t0, 492($sp) + sw $t0, 0($sp) # Storing internal_186 # Calling function function_method5_at_C jal function_method5_at_C lw $ra, 8($sp) - sw $v1, 296($sp) # internal_132 = result of function_method5_at_C + sw $v1, 480($sp) # internal_189 = result of function_method5_at_C addi $sp, $sp, 12 # Freeing space for arguments # Set attribute avar of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 284($sp) # $t1 = internal_132 - beq $t1, $zero, object_set_attribute_8794497368483 + lw $t0, 1228($sp) # $t0 = self + lw $t1, 468($sp) # $t1 = internal_189 + beq $t1, $zero, object_set_attribute_8753942942284 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8794497368483 + beq $t6, $t5, int_set_attribute_8753942942284 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8794497368483 - j object_set_attribute_8794497368483 - int_set_attribute_8794497368483: + beq $t6, $t5, bool_set_attribute_8753942942284 + j object_set_attribute_8753942942284 + int_set_attribute_8753942942284: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15919,9 +18603,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_132 - j end_set_attribute_8794497368483 - bool_set_attribute_8794497368483: + sw $v0, 12($t0) # self.avar = internal_189 + j end_set_attribute_8753942942284 + bool_set_attribute_8753942942284: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15929,20 +18613,20 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_132 - j end_set_attribute_8794497368483 - object_set_attribute_8794497368483: - sw $t1, 12($t0) # self.avar = internal_132 - end_set_attribute_8794497368483: + sw $v0, 12($t0) # self.avar = internal_189 + j end_set_attribute_8753942942284 + object_set_attribute_8753942942284: + sw $t1, 12($t0) # self.avar = internal_189 + end_set_attribute_8753942942284: - # internal_124 = internal_132 - lw $t0, 284($sp) - sw $t0, 316($sp) + # internal_179 = internal_189 + lw $t0, 468($sp) + sw $t0, 508($sp) - # Jumping to endif_8794497406570 - j endif_8794497406570 + # Jumping to endif_8753943038925 + j endif_8753943038925 - else_8794497406570: + else_8753943038925: # Allocating Bool 0 li $v0, 9 @@ -15954,21 +18638,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 276($sp) # internal_134 = address of allocated object Int + sw $v0, 452($sp) # internal_193 = address of allocated object Int # Get attribute char of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'char' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497369667 + beq $t6, $t5, int_get_attribute_8753942942492 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497369667 - j object_get_attribute_8794497369667 - int_get_attribute_8794497369667: + beq $t6, $t5, bool_get_attribute_8753942942492 + j object_get_attribute_8753942942492 + int_get_attribute_8753942942492: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15976,9 +18660,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 272($sp) # internal_135 = self.char - j end_get_attribute_8794497369667 - bool_get_attribute_8794497369667: + sw $v0, 448($sp) # internal_194 = self.char + j end_get_attribute_8753942942492 + bool_get_attribute_8753942942492: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15986,11 +18670,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 272($sp) # internal_135 = self.char - j end_get_attribute_8794497369667 - object_get_attribute_8794497369667: - sw $t1, 272($sp) # internal_135 = char - end_get_attribute_8794497369667: + sw $v0, 448($sp) # internal_194 = self.char + j end_get_attribute_8753942942492 + object_get_attribute_8753942942492: + sw $t1, 448($sp) # internal_194 = self.char + end_get_attribute_8753942942492: # Allocating String li $v0, 9 @@ -16004,44 +18688,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 103 - sb $t0, 8($v0) # internal_136[0] = 'g' + sb $t0, 8($v0) # internal_195[0] = 'g' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 268($sp) # internal_136 = "g" + sw $v0, 444($sp) # internal_195 = "g" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_135 - lw $t0, 284($sp) - sw $t0, 4($sp) # Storing internal_135 + # Argument internal_194 + lw $t0, 460($sp) + sw $t0, 4($sp) # Storing internal_194 - # Argument internal_136 - lw $t0, 280($sp) - sw $t0, 0($sp) # Storing internal_136 + # Argument internal_195 + lw $t0, 456($sp) + sw $t0, 0($sp) # Storing internal_195 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 276($sp) # internal_137 = result of function_equal + sw $v1, 452($sp) # internal_196 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_134 = internal_137 - lw $t0, 264($sp) - sw $t0, 276($sp) + # internal_193 = internal_196 + lw $t0, 440($sp) + sw $t0, 452($sp) - # If internal_134 then goto then_8794497406564 - lw $t0, 276($sp) # Loading the address of the condition + # If internal_193 then goto then_8753943038919 + lw $t0, 452($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497406564 + beq $t0, $t1, then_8753943038919 - # Jumping to else_8794497406564 - j else_8794497406564 + # Jumping to else_8753943038919 + j else_8753943038919 - then_8794497406564: + then_8753943038919: # Allocating Bool 0 li $v0, 9 @@ -16053,7 +18737,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 256($sp) # internal_139 = address of allocated object Int + sw $v0, 432($sp) # internal_198 = address of allocated object Int # Allocating D li $v0, 9 @@ -16062,35 +18746,35 @@ la $t0, type_D # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 252($sp) # internal_140 = address of allocated object D + sw $v0, 428($sp) # internal_199 = address of allocated object D # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_140 - lw $t0, 260($sp) - sw $t0, 0($sp) # Storing internal_140 + # Argument internal_199 + lw $t0, 436($sp) + sw $t0, 0($sp) # Storing internal_199 # Calling function function___init___at_D jal function___init___at_D lw $ra, 4($sp) - sw $v1, 260($sp) # internal_140 = result of function___init___at_D + sw $v1, 436($sp) # internal_199 = result of function___init___at_D addi $sp, $sp, 8 # Freeing space for arguments # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497369820 + beq $t6, $t5, int_get_attribute_8753942942645 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497369820 - j object_get_attribute_8794497369820 - int_get_attribute_8794497369820: + beq $t6, $t5, bool_get_attribute_8753942942645 + j object_get_attribute_8753942942645 + int_get_attribute_8753942942645: li $v0, 9 addi $a0, $zero, 12 syscall @@ -16098,9 +18782,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 248($sp) # internal_141 = self.avar - j end_get_attribute_8794497369820 - bool_get_attribute_8794497369820: + sw $v0, 424($sp) # internal_200 = self.avar + j end_get_attribute_8753942942645 + bool_get_attribute_8753942942645: li $v0, 9 addi $a0, $zero, 12 syscall @@ -16108,58 +18792,106 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 248($sp) # internal_141 = self.avar - j end_get_attribute_8794497369820 - object_get_attribute_8794497369820: - sw $t1, 248($sp) # internal_141 = avar - end_get_attribute_8794497369820: + sw $v0, 424($sp) # internal_200 = self.avar + j end_get_attribute_8753942942645 + object_get_attribute_8753942942645: + sw $t1, 424($sp) # internal_200 = self.avar + end_get_attribute_8753942942645: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 416($sp) # internal_202 = address of allocated object Int + + # Get method value of A + lw $t0, 424($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 416($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 412($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_141 - lw $t0, 256($sp) - sw $t0, 0($sp) # Storing internal_141 + # Argument internal_200 + lw $t0, 432($sp) + sw $t0, 0($sp) # Storing internal_200 - # Calling function function_value_at_A - jal function_value_at_A + # Calling function internal_203 + lw $t0, 420($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 252($sp) # internal_142 = result of function_value_at_A + sw $v1, 428($sp) # internal_201 = result of internal_203 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 404($sp) # internal_205 = address of allocated object Int + + # Get method method7 of D + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 404($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 400($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_140 - lw $t0, 264($sp) - sw $t0, 4($sp) # Storing internal_140 + # Argument internal_199 + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing internal_199 - # Argument internal_142 - lw $t0, 256($sp) - sw $t0, 0($sp) # Storing internal_142 + # Argument internal_201 + lw $t0, 432($sp) + sw $t0, 0($sp) # Storing internal_201 - # Calling function function_method7_at_D - jal function_method7_at_D + # Calling function internal_206 + lw $t0, 412($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 252($sp) # internal_143 = result of function_method7_at_D + sw $v1, 420($sp) # internal_204 = result of internal_206 addi $sp, $sp, 12 # Freeing space for arguments - # internal_139 = internal_143 - lw $t0, 240($sp) - sw $t0, 256($sp) + # internal_198 = internal_204 + lw $t0, 408($sp) + sw $t0, 432($sp) - # If internal_139 then goto then_8794497405727 - lw $t0, 256($sp) # Loading the address of the condition + # If internal_198 then goto then_8753943038082 + lw $t0, 432($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497405727 + beq $t0, $t1, then_8753943038082 - # Jumping to else_8794497405727 - j else_8794497405727 + # Jumping to else_8753943038082 + j else_8753943038082 - then_8794497405727: + then_8753943038082: # Allocating String li $v0, 9 @@ -16173,61 +18905,85 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 110 - sb $t0, 8($v0) # internal_144[0] = 'n' + sb $t0, 8($v0) # internal_207[0] = 'n' addi $t0, $zero, 117 - sb $t0, 9($v0) # internal_144[1] = 'u' + sb $t0, 9($v0) # internal_207[1] = 'u' addi $t0, $zero, 109 - sb $t0, 10($v0) # internal_144[2] = 'm' + sb $t0, 10($v0) # internal_207[2] = 'm' addi $t0, $zero, 98 - sb $t0, 11($v0) # internal_144[3] = 'b' + sb $t0, 11($v0) # internal_207[3] = 'b' addi $t0, $zero, 101 - sb $t0, 12($v0) # internal_144[4] = 'e' + sb $t0, 12($v0) # internal_207[4] = 'e' addi $t0, $zero, 114 - sb $t0, 13($v0) # internal_144[5] = 'r' + sb $t0, 13($v0) # internal_207[5] = 'r' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_144[6] = ' ' + sb $t0, 14($v0) # internal_207[6] = ' ' sb $zero, 15($v0) # Null-terminator at the end of the string - sw $v0, 236($sp) # internal_144 = "number " + sw $v0, 396($sp) # internal_207 = "number " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 388($sp) # internal_209 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 388($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 384($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 828($sp) + lw $t0, 1240($sp) sw $t0, 4($sp) # Storing self - # Argument internal_144 - lw $t0, 248($sp) - sw $t0, 0($sp) # Storing internal_144 + # Argument internal_207 + lw $t0, 408($sp) + sw $t0, 0($sp) # Storing internal_207 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_210 + lw $t0, 396($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 244($sp) # internal_145 = result of function_out_string_at_IO + sw $v1, 404($sp) # internal_208 = result of internal_210 addi $sp, $sp, 12 # Freeing space for arguments # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497337688 + beq $t6, $t5, int_get_attribute_8753942942841 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497337688 - j object_get_attribute_8794497337688 - int_get_attribute_8794497337688: + beq $t6, $t5, bool_get_attribute_8753942942841 + j object_get_attribute_8753942942841 + int_get_attribute_8753942942841: li $v0, 9 addi $a0, $zero, 12 syscall @@ -16235,9 +18991,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 228($sp) # internal_146 = self.avar - j end_get_attribute_8794497337688 - bool_get_attribute_8794497337688: + sw $v0, 380($sp) # internal_211 = self.avar + j end_get_attribute_8753942942841 + bool_get_attribute_8753942942841: li $v0, 9 addi $a0, $zero, 12 syscall @@ -16245,28 +19001,52 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 228($sp) # internal_146 = self.avar - j end_get_attribute_8794497337688 - object_get_attribute_8794497337688: - sw $t1, 228($sp) # internal_146 = avar - end_get_attribute_8794497337688: + sw $v0, 380($sp) # internal_211 = self.avar + j end_get_attribute_8753942942841 + object_get_attribute_8753942942841: + sw $t1, 380($sp) # internal_211 = self.avar + end_get_attribute_8753942942841: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 372($sp) # internal_213 = address of allocated object Int + + # Get method print of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 372($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 368($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 828($sp) + lw $t0, 1240($sp) sw $t0, 4($sp) # Storing self - # Argument internal_146 - lw $t0, 240($sp) - sw $t0, 0($sp) # Storing internal_146 + # Argument internal_211 + lw $t0, 392($sp) + sw $t0, 0($sp) # Storing internal_211 - # Calling function function_print_at_Main - jal function_print_at_Main + # Calling function internal_214 + lw $t0, 380($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 236($sp) # internal_147 = result of function_print_at_Main + sw $v1, 388($sp) # internal_212 = result of internal_214 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -16281,92 +19061,116 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 105 - sb $t0, 8($v0) # internal_148[0] = 'i' + sb $t0, 8($v0) # internal_215[0] = 'i' addi $t0, $zero, 115 - sb $t0, 9($v0) # internal_148[1] = 's' + sb $t0, 9($v0) # internal_215[1] = 's' addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_148[2] = ' ' + sb $t0, 10($v0) # internal_215[2] = ' ' addi $t0, $zero, 100 - sb $t0, 11($v0) # internal_148[3] = 'd' + sb $t0, 11($v0) # internal_215[3] = 'd' addi $t0, $zero, 105 - sb $t0, 12($v0) # internal_148[4] = 'i' + sb $t0, 12($v0) # internal_215[4] = 'i' addi $t0, $zero, 118 - sb $t0, 13($v0) # internal_148[5] = 'v' + sb $t0, 13($v0) # internal_215[5] = 'v' addi $t0, $zero, 105 - sb $t0, 14($v0) # internal_148[6] = 'i' + sb $t0, 14($v0) # internal_215[6] = 'i' addi $t0, $zero, 115 - sb $t0, 15($v0) # internal_148[7] = 's' + sb $t0, 15($v0) # internal_215[7] = 's' addi $t0, $zero, 105 - sb $t0, 16($v0) # internal_148[8] = 'i' + sb $t0, 16($v0) # internal_215[8] = 'i' addi $t0, $zero, 98 - sb $t0, 17($v0) # internal_148[9] = 'b' + sb $t0, 17($v0) # internal_215[9] = 'b' addi $t0, $zero, 108 - sb $t0, 18($v0) # internal_148[10] = 'l' + sb $t0, 18($v0) # internal_215[10] = 'l' addi $t0, $zero, 101 - sb $t0, 19($v0) # internal_148[11] = 'e' + sb $t0, 19($v0) # internal_215[11] = 'e' addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_148[12] = ' ' + sb $t0, 20($v0) # internal_215[12] = ' ' addi $t0, $zero, 98 - sb $t0, 21($v0) # internal_148[13] = 'b' + sb $t0, 21($v0) # internal_215[13] = 'b' addi $t0, $zero, 121 - sb $t0, 22($v0) # internal_148[14] = 'y' + sb $t0, 22($v0) # internal_215[14] = 'y' addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_148[15] = ' ' + sb $t0, 23($v0) # internal_215[15] = ' ' addi $t0, $zero, 51 - sb $t0, 24($v0) # internal_148[16] = '3' + sb $t0, 24($v0) # internal_215[16] = '3' addi $t0, $zero, 46 - sb $t0, 25($v0) # internal_148[17] = '.' + sb $t0, 25($v0) # internal_215[17] = '.' addi $t0, $zero, 10 - sb $t0, 26($v0) # internal_148[18] = '\n' + sb $t0, 26($v0) # internal_215[18] = '\n' sb $zero, 27($v0) # Null-terminator at the end of the string - sw $v0, 220($sp) # internal_148 = "is divisible by 3.\n" + sw $v0, 364($sp) # internal_215 = "is divisible by 3.\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 356($sp) # internal_217 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 356($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 352($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 828($sp) + lw $t0, 1240($sp) sw $t0, 4($sp) # Storing self - # Argument internal_148 - lw $t0, 232($sp) - sw $t0, 0($sp) # Storing internal_148 + # Argument internal_215 + lw $t0, 376($sp) + sw $t0, 0($sp) # Storing internal_215 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_218 + lw $t0, 364($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 228($sp) # internal_149 = result of function_out_string_at_IO + sw $v1, 372($sp) # internal_216 = result of internal_218 addi $sp, $sp, 12 # Freeing space for arguments - # internal_138 = internal_149 - lw $t0, 216($sp) - sw $t0, 260($sp) + # internal_197 = internal_216 + lw $t0, 360($sp) + sw $t0, 436($sp) - # Jumping to endif_8794497405727 - j endif_8794497405727 + # Jumping to endif_8753943038082 + j endif_8753943038082 - else_8794497405727: + else_8753943038082: # Allocating String li $v0, 9 @@ -16380,61 +19184,85 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 110 - sb $t0, 8($v0) # internal_150[0] = 'n' + sb $t0, 8($v0) # internal_219[0] = 'n' addi $t0, $zero, 117 - sb $t0, 9($v0) # internal_150[1] = 'u' + sb $t0, 9($v0) # internal_219[1] = 'u' addi $t0, $zero, 109 - sb $t0, 10($v0) # internal_150[2] = 'm' + sb $t0, 10($v0) # internal_219[2] = 'm' addi $t0, $zero, 98 - sb $t0, 11($v0) # internal_150[3] = 'b' + sb $t0, 11($v0) # internal_219[3] = 'b' addi $t0, $zero, 101 - sb $t0, 12($v0) # internal_150[4] = 'e' + sb $t0, 12($v0) # internal_219[4] = 'e' addi $t0, $zero, 114 - sb $t0, 13($v0) # internal_150[5] = 'r' + sb $t0, 13($v0) # internal_219[5] = 'r' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_150[6] = ' ' + sb $t0, 14($v0) # internal_219[6] = ' ' sb $zero, 15($v0) # Null-terminator at the end of the string - sw $v0, 212($sp) # internal_150 = "number " + sw $v0, 348($sp) # internal_219 = "number " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 340($sp) # internal_221 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 340($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 336($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 828($sp) + lw $t0, 1240($sp) sw $t0, 4($sp) # Storing self - # Argument internal_150 - lw $t0, 224($sp) - sw $t0, 0($sp) # Storing internal_150 + # Argument internal_219 + lw $t0, 360($sp) + sw $t0, 0($sp) # Storing internal_219 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_222 + lw $t0, 348($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 220($sp) # internal_151 = result of function_out_string_at_IO + sw $v1, 356($sp) # internal_220 = result of internal_222 addi $sp, $sp, 12 # Freeing space for arguments # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497337817 + beq $t6, $t5, int_get_attribute_8753942943558 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497337817 - j object_get_attribute_8794497337817 - int_get_attribute_8794497337817: + beq $t6, $t5, bool_get_attribute_8753942943558 + j object_get_attribute_8753942943558 + int_get_attribute_8753942943558: li $v0, 9 addi $a0, $zero, 12 syscall @@ -16442,9 +19270,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 204($sp) # internal_152 = self.avar - j end_get_attribute_8794497337817 - bool_get_attribute_8794497337817: + sw $v0, 332($sp) # internal_223 = self.avar + j end_get_attribute_8753942943558 + bool_get_attribute_8753942943558: li $v0, 9 addi $a0, $zero, 12 syscall @@ -16452,28 +19280,52 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 204($sp) # internal_152 = self.avar - j end_get_attribute_8794497337817 - object_get_attribute_8794497337817: - sw $t1, 204($sp) # internal_152 = avar - end_get_attribute_8794497337817: + sw $v0, 332($sp) # internal_223 = self.avar + j end_get_attribute_8753942943558 + object_get_attribute_8753942943558: + sw $t1, 332($sp) # internal_223 = self.avar + end_get_attribute_8753942943558: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 324($sp) # internal_225 = address of allocated object Int + + # Get method print of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 324($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 320($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 828($sp) + lw $t0, 1240($sp) sw $t0, 4($sp) # Storing self - # Argument internal_152 - lw $t0, 216($sp) - sw $t0, 0($sp) # Storing internal_152 + # Argument internal_223 + lw $t0, 344($sp) + sw $t0, 0($sp) # Storing internal_223 - # Calling function function_print_at_Main - jal function_print_at_Main + # Calling function internal_226 + lw $t0, 332($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 212($sp) # internal_153 = result of function_print_at_Main + sw $v1, 340($sp) # internal_224 = result of internal_226 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -16488,113 +19340,137 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 105 - sb $t0, 8($v0) # internal_154[0] = 'i' + sb $t0, 8($v0) # internal_227[0] = 'i' addi $t0, $zero, 115 - sb $t0, 9($v0) # internal_154[1] = 's' + sb $t0, 9($v0) # internal_227[1] = 's' addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_154[2] = ' ' + sb $t0, 10($v0) # internal_227[2] = ' ' addi $t0, $zero, 110 - sb $t0, 11($v0) # internal_154[3] = 'n' + sb $t0, 11($v0) # internal_227[3] = 'n' addi $t0, $zero, 111 - sb $t0, 12($v0) # internal_154[4] = 'o' + sb $t0, 12($v0) # internal_227[4] = 'o' addi $t0, $zero, 116 - sb $t0, 13($v0) # internal_154[5] = 't' + sb $t0, 13($v0) # internal_227[5] = 't' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_154[6] = ' ' + sb $t0, 14($v0) # internal_227[6] = ' ' addi $t0, $zero, 100 - sb $t0, 15($v0) # internal_154[7] = 'd' + sb $t0, 15($v0) # internal_227[7] = 'd' addi $t0, $zero, 105 - sb $t0, 16($v0) # internal_154[8] = 'i' + sb $t0, 16($v0) # internal_227[8] = 'i' addi $t0, $zero, 118 - sb $t0, 17($v0) # internal_154[9] = 'v' + sb $t0, 17($v0) # internal_227[9] = 'v' addi $t0, $zero, 105 - sb $t0, 18($v0) # internal_154[10] = 'i' + sb $t0, 18($v0) # internal_227[10] = 'i' addi $t0, $zero, 115 - sb $t0, 19($v0) # internal_154[11] = 's' + sb $t0, 19($v0) # internal_227[11] = 's' addi $t0, $zero, 105 - sb $t0, 20($v0) # internal_154[12] = 'i' + sb $t0, 20($v0) # internal_227[12] = 'i' addi $t0, $zero, 98 - sb $t0, 21($v0) # internal_154[13] = 'b' + sb $t0, 21($v0) # internal_227[13] = 'b' addi $t0, $zero, 108 - sb $t0, 22($v0) # internal_154[14] = 'l' + sb $t0, 22($v0) # internal_227[14] = 'l' addi $t0, $zero, 101 - sb $t0, 23($v0) # internal_154[15] = 'e' + sb $t0, 23($v0) # internal_227[15] = 'e' addi $t0, $zero, 32 - sb $t0, 24($v0) # internal_154[16] = ' ' + sb $t0, 24($v0) # internal_227[16] = ' ' addi $t0, $zero, 98 - sb $t0, 25($v0) # internal_154[17] = 'b' + sb $t0, 25($v0) # internal_227[17] = 'b' addi $t0, $zero, 121 - sb $t0, 26($v0) # internal_154[18] = 'y' + sb $t0, 26($v0) # internal_227[18] = 'y' addi $t0, $zero, 32 - sb $t0, 27($v0) # internal_154[19] = ' ' + sb $t0, 27($v0) # internal_227[19] = ' ' addi $t0, $zero, 51 - sb $t0, 28($v0) # internal_154[20] = '3' + sb $t0, 28($v0) # internal_227[20] = '3' addi $t0, $zero, 46 - sb $t0, 29($v0) # internal_154[21] = '.' + sb $t0, 29($v0) # internal_227[21] = '.' addi $t0, $zero, 10 - sb $t0, 30($v0) # internal_154[22] = '\n' + sb $t0, 30($v0) # internal_227[22] = '\n' sb $zero, 31($v0) # Null-terminator at the end of the string - sw $v0, 196($sp) # internal_154 = "is not divisible by 3.\n" + sw $v0, 316($sp) # internal_227 = "is not divisible by 3.\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 308($sp) # internal_229 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 308($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 304($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 828($sp) + lw $t0, 1240($sp) sw $t0, 4($sp) # Storing self - # Argument internal_154 - lw $t0, 208($sp) - sw $t0, 0($sp) # Storing internal_154 + # Argument internal_227 + lw $t0, 328($sp) + sw $t0, 0($sp) # Storing internal_227 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_230 + lw $t0, 316($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 204($sp) # internal_155 = result of function_out_string_at_IO + sw $v1, 324($sp) # internal_228 = result of internal_230 addi $sp, $sp, 12 # Freeing space for arguments - # internal_138 = internal_155 - lw $t0, 192($sp) - sw $t0, 260($sp) + # internal_197 = internal_228 + lw $t0, 312($sp) + sw $t0, 436($sp) - # Jumping to endif_8794497405727 - j endif_8794497405727 + # Jumping to endif_8753943038082 + j endif_8753943038082 - endif_8794497405727: + endif_8753943038082: - # internal_133 = internal_138 - lw $t0, 260($sp) - sw $t0, 280($sp) + # internal_192 = internal_197 + lw $t0, 436($sp) + sw $t0, 456($sp) - # Jumping to endif_8794497406564 - j endif_8794497406564 + # Jumping to endif_8753943038919 + j endif_8753943038919 - else_8794497406564: + else_8753943038919: # Allocating Bool 0 li $v0, 9 @@ -16606,21 +19482,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 184($sp) # internal_157 = address of allocated object Int + sw $v0, 296($sp) # internal_232 = address of allocated object Int # Get attribute char of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'char' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497337941 + beq $t6, $t5, int_get_attribute_8753942943726 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497337941 - j object_get_attribute_8794497337941 - int_get_attribute_8794497337941: + beq $t6, $t5, bool_get_attribute_8753942943726 + j object_get_attribute_8753942943726 + int_get_attribute_8753942943726: li $v0, 9 addi $a0, $zero, 12 syscall @@ -16628,9 +19504,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 180($sp) # internal_158 = self.char - j end_get_attribute_8794497337941 - bool_get_attribute_8794497337941: + sw $v0, 292($sp) # internal_233 = self.char + j end_get_attribute_8753942943726 + bool_get_attribute_8753942943726: li $v0, 9 addi $a0, $zero, 12 syscall @@ -16638,11 +19514,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 180($sp) # internal_158 = self.char - j end_get_attribute_8794497337941 - object_get_attribute_8794497337941: - sw $t1, 180($sp) # internal_158 = char - end_get_attribute_8794497337941: + sw $v0, 292($sp) # internal_233 = self.char + j end_get_attribute_8753942943726 + object_get_attribute_8753942943726: + sw $t1, 292($sp) # internal_233 = self.char + end_get_attribute_8753942943726: # Allocating String li $v0, 9 @@ -16656,47 +19532,47 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 104 - sb $t0, 8($v0) # internal_159[0] = 'h' + sb $t0, 8($v0) # internal_234[0] = 'h' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 176($sp) # internal_159 = "h" + sw $v0, 288($sp) # internal_234 = "h" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_158 - lw $t0, 192($sp) - sw $t0, 4($sp) # Storing internal_158 + # Argument internal_233 + lw $t0, 304($sp) + sw $t0, 4($sp) # Storing internal_233 - # Argument internal_159 - lw $t0, 188($sp) - sw $t0, 0($sp) # Storing internal_159 + # Argument internal_234 + lw $t0, 300($sp) + sw $t0, 0($sp) # Storing internal_234 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 184($sp) # internal_160 = result of function_equal + sw $v1, 296($sp) # internal_235 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_157 = internal_160 - lw $t0, 172($sp) - sw $t0, 184($sp) + # internal_232 = internal_235 + lw $t0, 284($sp) + sw $t0, 296($sp) - # If internal_157 then goto then_8794497406558 - lw $t0, 184($sp) # Loading the address of the condition + # If internal_232 then goto then_8753943038913 + lw $t0, 296($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497406558 + beq $t0, $t1, then_8753943038913 - # Jumping to else_8794497406558 - j else_8794497406558 + # Jumping to else_8753943038913 + j else_8753943038913 - then_8794497406558: + then_8753943038913: # Allocating NUll to x - sw $zero, 168($sp) # x = 0 + sw $zero, 280($sp) # x = 0 # Allocating E li $v0, 9 @@ -16705,35 +19581,35 @@ la $t0, type_E # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 164($sp) # internal_162 = address of allocated object E + sw $v0, 276($sp) # internal_237 = address of allocated object E # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_162 - lw $t0, 172($sp) - sw $t0, 0($sp) # Storing internal_162 + # Argument internal_237 + lw $t0, 284($sp) + sw $t0, 0($sp) # Storing internal_237 # Calling function function___init___at_E jal function___init___at_E lw $ra, 4($sp) - sw $v1, 172($sp) # internal_162 = result of function___init___at_E + sw $v1, 284($sp) # internal_237 = result of function___init___at_E addi $sp, $sp, 8 # Freeing space for arguments # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497338119 + beq $t6, $t5, int_get_attribute_8753942944160 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497338119 - j object_get_attribute_8794497338119 - int_get_attribute_8794497338119: + beq $t6, $t5, bool_get_attribute_8753942944160 + j object_get_attribute_8753942944160 + int_get_attribute_8753942944160: li $v0, 9 addi $a0, $zero, 12 syscall @@ -16741,9 +19617,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 160($sp) # internal_163 = self.avar - j end_get_attribute_8794497338119 - bool_get_attribute_8794497338119: + sw $v0, 272($sp) # internal_238 = self.avar + j end_get_attribute_8753942944160 + bool_get_attribute_8753942944160: li $v0, 9 addi $a0, $zero, 12 syscall @@ -16751,42 +19627,90 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 160($sp) # internal_163 = self.avar - j end_get_attribute_8794497338119 - object_get_attribute_8794497338119: - sw $t1, 160($sp) # internal_163 = avar - end_get_attribute_8794497338119: + sw $v0, 272($sp) # internal_238 = self.avar + j end_get_attribute_8753942944160 + object_get_attribute_8753942944160: + sw $t1, 272($sp) # internal_238 = self.avar + end_get_attribute_8753942944160: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 264($sp) # internal_240 = address of allocated object Int + + # Get method value of A + lw $t0, 272($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 264($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 260($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_163 - lw $t0, 168($sp) - sw $t0, 0($sp) # Storing internal_163 + # Argument internal_238 + lw $t0, 280($sp) + sw $t0, 0($sp) # Storing internal_238 - # Calling function function_value_at_A - jal function_value_at_A + # Calling function internal_241 + lw $t0, 268($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 164($sp) # internal_164 = result of function_value_at_A + sw $v1, 276($sp) # internal_239 = result of internal_241 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 252($sp) # internal_243 = address of allocated object Int + + # Get method method6 of E + lw $t0, 276($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 252($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 248($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_162 - lw $t0, 176($sp) - sw $t0, 4($sp) # Storing internal_162 + # Argument internal_237 + lw $t0, 288($sp) + sw $t0, 4($sp) # Storing internal_237 - # Argument internal_164 - lw $t0, 168($sp) - sw $t0, 0($sp) # Storing internal_164 + # Argument internal_239 + lw $t0, 280($sp) + sw $t0, 0($sp) # Storing internal_239 - # Calling function function_method6_at_E - jal function_method6_at_E + # Calling function internal_244 + lw $t0, 260($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 164($sp) # internal_165 = result of function_method6_at_E + sw $v1, 268($sp) # internal_242 = result of internal_244 addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -16794,32 +19718,32 @@ sw $ra, 8($sp) # Storing return address # Argument x - lw $t0, 180($sp) + lw $t0, 292($sp) sw $t0, 4($sp) # Storing x - # Argument internal_165 - lw $t0, 164($sp) - sw $t0, 0($sp) # Storing internal_165 + # Argument internal_242 + lw $t0, 268($sp) + sw $t0, 0($sp) # Storing internal_242 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 180($sp) # x = result of function_assign + sw $v1, 292($sp) # x = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497338209 + beq $t6, $t5, int_get_attribute_8753942944558 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497338209 - j object_get_attribute_8794497338209 - int_get_attribute_8794497338209: + beq $t6, $t5, bool_get_attribute_8753942944558 + j object_get_attribute_8753942944558 + int_get_attribute_8753942944558: li $v0, 9 addi $a0, $zero, 12 syscall @@ -16827,9 +19751,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 144($sp) # internal_167 = self.avar - j end_get_attribute_8794497338209 - bool_get_attribute_8794497338209: + sw $v0, 240($sp) # internal_246 = self.avar + j end_get_attribute_8753942944558 + bool_get_attribute_8753942944558: li $v0, 9 addi $a0, $zero, 12 syscall @@ -16837,38 +19761,86 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 144($sp) # internal_167 = self.avar - j end_get_attribute_8794497338209 - object_get_attribute_8794497338209: - sw $t1, 144($sp) # internal_167 = avar - end_get_attribute_8794497338209: + sw $v0, 240($sp) # internal_246 = self.avar + j end_get_attribute_8753942944558 + object_get_attribute_8753942944558: + sw $t1, 240($sp) # internal_246 = self.avar + end_get_attribute_8753942944558: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 232($sp) # internal_248 = address of allocated object Int + + # Get method value of A + lw $t0, 240($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 232($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 228($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_167 - lw $t0, 152($sp) - sw $t0, 0($sp) # Storing internal_167 + # Argument internal_246 + lw $t0, 248($sp) + sw $t0, 0($sp) # Storing internal_246 - # Calling function function_value_at_A - jal function_value_at_A + # Calling function internal_249 + lw $t0, 236($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 148($sp) # internal_168 = result of function_value_at_A + sw $v1, 244($sp) # internal_247 = result of internal_249 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 220($sp) # internal_251 = address of allocated object Int + + # Get method value of A + lw $t0, 280($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 220($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 216($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument x - lw $t0, 176($sp) + lw $t0, 288($sp) sw $t0, 0($sp) # Storing x - # Calling function function_value_at_A - jal function_value_at_A + # Calling function internal_252 + lw $t0, 224($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 144($sp) # internal_169 = result of function_value_at_A + sw $v1, 232($sp) # internal_250 = result of internal_252 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 8 @@ -16881,42 +19853,42 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 8 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 132($sp) # internal_170 = address of allocated object Int + sw $v0, 212($sp) # internal_253 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_169 - lw $t0, 148($sp) - sw $t0, 4($sp) # Storing internal_169 + # Argument internal_250 + lw $t0, 236($sp) + sw $t0, 4($sp) # Storing internal_250 - # Argument internal_170 - lw $t0, 144($sp) - sw $t0, 0($sp) # Storing internal_170 + # Argument internal_253 + lw $t0, 224($sp) + sw $t0, 0($sp) # Storing internal_253 # Calling function function_mult jal function_mult lw $ra, 8($sp) - sw $v1, 140($sp) # internal_171 = result of function_mult + sw $v1, 220($sp) # internal_254 = result of function_mult addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_168 - lw $t0, 152($sp) - sw $t0, 4($sp) # Storing internal_168 + # Argument internal_247 + lw $t0, 248($sp) + sw $t0, 4($sp) # Storing internal_247 - # Argument internal_171 - lw $t0, 140($sp) - sw $t0, 0($sp) # Storing internal_171 + # Argument internal_254 + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing internal_254 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 136($sp) # internal_172 = result of function_sub + sw $v1, 216($sp) # internal_255 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -16924,17 +19896,17 @@ sw $ra, 8($sp) # Storing return address # Argument r - lw $t0, 160($sp) + lw $t0, 256($sp) sw $t0, 4($sp) # Storing r - # Argument internal_172 - lw $t0, 136($sp) - sw $t0, 0($sp) # Storing internal_172 + # Argument internal_255 + lw $t0, 216($sp) + sw $t0, 0($sp) # Storing internal_255 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 160($sp) # r = result of function_assign + sw $v1, 256($sp) # r = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -16949,61 +19921,85 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 110 - sb $t0, 8($v0) # internal_173[0] = 'n' + sb $t0, 8($v0) # internal_256[0] = 'n' addi $t0, $zero, 117 - sb $t0, 9($v0) # internal_173[1] = 'u' + sb $t0, 9($v0) # internal_256[1] = 'u' addi $t0, $zero, 109 - sb $t0, 10($v0) # internal_173[2] = 'm' + sb $t0, 10($v0) # internal_256[2] = 'm' addi $t0, $zero, 98 - sb $t0, 11($v0) # internal_173[3] = 'b' + sb $t0, 11($v0) # internal_256[3] = 'b' addi $t0, $zero, 101 - sb $t0, 12($v0) # internal_173[4] = 'e' + sb $t0, 12($v0) # internal_256[4] = 'e' addi $t0, $zero, 114 - sb $t0, 13($v0) # internal_173[5] = 'r' + sb $t0, 13($v0) # internal_256[5] = 'r' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_173[6] = ' ' + sb $t0, 14($v0) # internal_256[6] = ' ' sb $zero, 15($v0) # Null-terminator at the end of the string - sw $v0, 120($sp) # internal_173 = "number " + sw $v0, 200($sp) # internal_256 = "number " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 192($sp) # internal_258 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 192($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 188($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 828($sp) + lw $t0, 1240($sp) sw $t0, 4($sp) # Storing self - # Argument internal_173 - lw $t0, 132($sp) - sw $t0, 0($sp) # Storing internal_173 + # Argument internal_256 + lw $t0, 212($sp) + sw $t0, 0($sp) # Storing internal_256 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_259 + lw $t0, 200($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 128($sp) # internal_174 = result of function_out_string_at_IO + sw $v1, 208($sp) # internal_257 = result of internal_259 addi $sp, $sp, 12 # Freeing space for arguments # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497338640 + beq $t6, $t5, int_get_attribute_8753942945317 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497338640 - j object_get_attribute_8794497338640 - int_get_attribute_8794497338640: + beq $t6, $t5, bool_get_attribute_8753942945317 + j object_get_attribute_8753942945317 + int_get_attribute_8753942945317: li $v0, 9 addi $a0, $zero, 12 syscall @@ -17011,9 +20007,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 112($sp) # internal_175 = self.avar - j end_get_attribute_8794497338640 - bool_get_attribute_8794497338640: + sw $v0, 184($sp) # internal_260 = self.avar + j end_get_attribute_8753942945317 + bool_get_attribute_8753942945317: li $v0, 9 addi $a0, $zero, 12 syscall @@ -17021,28 +20017,52 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 112($sp) # internal_175 = self.avar - j end_get_attribute_8794497338640 - object_get_attribute_8794497338640: - sw $t1, 112($sp) # internal_175 = avar - end_get_attribute_8794497338640: + sw $v0, 184($sp) # internal_260 = self.avar + j end_get_attribute_8753942945317 + object_get_attribute_8753942945317: + sw $t1, 184($sp) # internal_260 = self.avar + end_get_attribute_8753942945317: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 176($sp) # internal_262 = address of allocated object Int + + # Get method print of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 176($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 172($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 828($sp) + lw $t0, 1240($sp) sw $t0, 4($sp) # Storing self - # Argument internal_175 - lw $t0, 124($sp) - sw $t0, 0($sp) # Storing internal_175 + # Argument internal_260 + lw $t0, 196($sp) + sw $t0, 0($sp) # Storing internal_260 - # Calling function function_print_at_Main - jal function_print_at_Main + # Calling function internal_263 + lw $t0, 184($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 120($sp) # internal_176 = result of function_print_at_Main + sw $v1, 192($sp) # internal_261 = result of internal_263 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -17057,79 +20077,127 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 105 - sb $t0, 8($v0) # internal_177[0] = 'i' + sb $t0, 8($v0) # internal_264[0] = 'i' addi $t0, $zero, 115 - sb $t0, 9($v0) # internal_177[1] = 's' + sb $t0, 9($v0) # internal_264[1] = 's' addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_177[2] = ' ' + sb $t0, 10($v0) # internal_264[2] = ' ' addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_177[3] = 'e' + sb $t0, 11($v0) # internal_264[3] = 'e' addi $t0, $zero, 113 - sb $t0, 12($v0) # internal_177[4] = 'q' + sb $t0, 12($v0) # internal_264[4] = 'q' addi $t0, $zero, 117 - sb $t0, 13($v0) # internal_177[5] = 'u' + sb $t0, 13($v0) # internal_264[5] = 'u' addi $t0, $zero, 97 - sb $t0, 14($v0) # internal_177[6] = 'a' + sb $t0, 14($v0) # internal_264[6] = 'a' addi $t0, $zero, 108 - sb $t0, 15($v0) # internal_177[7] = 'l' + sb $t0, 15($v0) # internal_264[7] = 'l' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_177[8] = ' ' + sb $t0, 16($v0) # internal_264[8] = ' ' addi $t0, $zero, 116 - sb $t0, 17($v0) # internal_177[9] = 't' + sb $t0, 17($v0) # internal_264[9] = 't' addi $t0, $zero, 111 - sb $t0, 18($v0) # internal_177[10] = 'o' + sb $t0, 18($v0) # internal_264[10] = 'o' addi $t0, $zero, 32 - sb $t0, 19($v0) # internal_177[11] = ' ' + sb $t0, 19($v0) # internal_264[11] = ' ' sb $zero, 20($v0) # Null-terminator at the end of the string - sw $v0, 104($sp) # internal_177 = "is equal to " + sw $v0, 168($sp) # internal_264 = "is equal to " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_266 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 160($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 156($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 828($sp) + lw $t0, 1240($sp) sw $t0, 4($sp) # Storing self - # Argument internal_177 - lw $t0, 116($sp) - sw $t0, 0($sp) # Storing internal_177 + # Argument internal_264 + lw $t0, 180($sp) + sw $t0, 0($sp) # Storing internal_264 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_267 + lw $t0, 168($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 112($sp) # internal_178 = result of function_out_string_at_IO + sw $v1, 176($sp) # internal_265 = result of internal_267 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 148($sp) # internal_269 = address of allocated object Int + + # Get method print of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 148($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 144($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 828($sp) + lw $t0, 1240($sp) sw $t0, 4($sp) # Storing self # Argument x - lw $t0, 180($sp) + lw $t0, 292($sp) sw $t0, 0($sp) # Storing x - # Calling function function_print_at_Main - jal function_print_at_Main + # Calling function internal_270 + lw $t0, 156($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 108($sp) # internal_179 = result of function_print_at_Main + sw $v1, 164($sp) # internal_268 = result of internal_270 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -17144,109 +20212,133 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 116 - sb $t0, 8($v0) # internal_180[0] = 't' + sb $t0, 8($v0) # internal_271[0] = 't' addi $t0, $zero, 105 - sb $t0, 9($v0) # internal_180[1] = 'i' + sb $t0, 9($v0) # internal_271[1] = 'i' addi $t0, $zero, 109 - sb $t0, 10($v0) # internal_180[2] = 'm' + sb $t0, 10($v0) # internal_271[2] = 'm' addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_180[3] = 'e' + sb $t0, 11($v0) # internal_271[3] = 'e' addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_180[4] = 's' + sb $t0, 12($v0) # internal_271[4] = 's' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_180[5] = ' ' + sb $t0, 13($v0) # internal_271[5] = ' ' addi $t0, $zero, 56 - sb $t0, 14($v0) # internal_180[6] = '8' + sb $t0, 14($v0) # internal_271[6] = '8' addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_180[7] = ' ' + sb $t0, 15($v0) # internal_271[7] = ' ' addi $t0, $zero, 119 - sb $t0, 16($v0) # internal_180[8] = 'w' + sb $t0, 16($v0) # internal_271[8] = 'w' addi $t0, $zero, 105 - sb $t0, 17($v0) # internal_180[9] = 'i' + sb $t0, 17($v0) # internal_271[9] = 'i' addi $t0, $zero, 116 - sb $t0, 18($v0) # internal_180[10] = 't' + sb $t0, 18($v0) # internal_271[10] = 't' addi $t0, $zero, 104 - sb $t0, 19($v0) # internal_180[11] = 'h' + sb $t0, 19($v0) # internal_271[11] = 'h' addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_180[12] = ' ' + sb $t0, 20($v0) # internal_271[12] = ' ' addi $t0, $zero, 97 - sb $t0, 21($v0) # internal_180[13] = 'a' + sb $t0, 21($v0) # internal_271[13] = 'a' addi $t0, $zero, 32 - sb $t0, 22($v0) # internal_180[14] = ' ' + sb $t0, 22($v0) # internal_271[14] = ' ' addi $t0, $zero, 114 - sb $t0, 23($v0) # internal_180[15] = 'r' + sb $t0, 23($v0) # internal_271[15] = 'r' addi $t0, $zero, 101 - sb $t0, 24($v0) # internal_180[16] = 'e' + sb $t0, 24($v0) # internal_271[16] = 'e' addi $t0, $zero, 109 - sb $t0, 25($v0) # internal_180[17] = 'm' + sb $t0, 25($v0) # internal_271[17] = 'm' addi $t0, $zero, 97 - sb $t0, 26($v0) # internal_180[18] = 'a' + sb $t0, 26($v0) # internal_271[18] = 'a' addi $t0, $zero, 105 - sb $t0, 27($v0) # internal_180[19] = 'i' + sb $t0, 27($v0) # internal_271[19] = 'i' addi $t0, $zero, 110 - sb $t0, 28($v0) # internal_180[20] = 'n' + sb $t0, 28($v0) # internal_271[20] = 'n' addi $t0, $zero, 100 - sb $t0, 29($v0) # internal_180[21] = 'd' + sb $t0, 29($v0) # internal_271[21] = 'd' addi $t0, $zero, 101 - sb $t0, 30($v0) # internal_180[22] = 'e' + sb $t0, 30($v0) # internal_271[22] = 'e' addi $t0, $zero, 114 - sb $t0, 31($v0) # internal_180[23] = 'r' + sb $t0, 31($v0) # internal_271[23] = 'r' addi $t0, $zero, 32 - sb $t0, 32($v0) # internal_180[24] = ' ' + sb $t0, 32($v0) # internal_271[24] = ' ' addi $t0, $zero, 111 - sb $t0, 33($v0) # internal_180[25] = 'o' + sb $t0, 33($v0) # internal_271[25] = 'o' addi $t0, $zero, 102 - sb $t0, 34($v0) # internal_180[26] = 'f' + sb $t0, 34($v0) # internal_271[26] = 'f' addi $t0, $zero, 32 - sb $t0, 35($v0) # internal_180[27] = ' ' + sb $t0, 35($v0) # internal_271[27] = ' ' sb $zero, 36($v0) # Null-terminator at the end of the string - sw $v0, 92($sp) # internal_180 = "times 8 with a remainder of " + sw $v0, 140($sp) # internal_271 = "times 8 with a remainder of " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 132($sp) # internal_273 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 132($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 128($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 828($sp) + lw $t0, 1240($sp) sw $t0, 4($sp) # Storing self - # Argument internal_180 - lw $t0, 104($sp) - sw $t0, 0($sp) # Storing internal_180 + # Argument internal_271 + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing internal_271 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_274 + lw $t0, 140($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 100($sp) # internal_181 = result of function_out_string_at_IO + sw $v1, 148($sp) # internal_272 = result of internal_274 addi $sp, $sp, 12 # Freeing space for arguments # Allocating A2I @@ -17256,20 +20348,20 @@ la $t0, type_A2I # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 80($sp) # internal_183 = address of allocated object A2I + sw $v0, 120($sp) # internal_276 = address of allocated object A2I # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_183 - lw $t0, 88($sp) - sw $t0, 0($sp) # Storing internal_183 + # Argument internal_276 + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing internal_276 # Calling function function___init___at_A2I jal function___init___at_A2I lw $ra, 4($sp) - sw $v1, 88($sp) # internal_183 = result of function___init___at_A2I + sw $v1, 128($sp) # internal_276 = result of function___init___at_A2I addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments @@ -17277,53 +20369,101 @@ sw $ra, 8($sp) # Storing return address # Argument a - lw $t0, 488($sp) + lw $t0, 784($sp) sw $t0, 4($sp) # Storing a - # Argument internal_183 - lw $t0, 92($sp) - sw $t0, 0($sp) # Storing internal_183 + # Argument internal_276 + lw $t0, 132($sp) + sw $t0, 0($sp) # Storing internal_276 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 488($sp) # a = result of function_assign + sw $v1, 784($sp) # a = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_278 = address of allocated object Int + + # Get method i2a of A2I + lw $t0, 772($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 112($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 108($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument a - lw $t0, 488($sp) + lw $t0, 784($sp) sw $t0, 4($sp) # Storing a # Argument r - lw $t0, 160($sp) + lw $t0, 256($sp) sw $t0, 0($sp) # Storing r - # Calling function function_i2a_at_A2I - jal function_i2a_at_A2I + # Calling function internal_279 + lw $t0, 120($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 88($sp) # internal_184 = result of function_i2a_at_A2I + sw $v1, 128($sp) # internal_277 = result of internal_279 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_281 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 100($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 96($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 828($sp) + lw $t0, 1240($sp) sw $t0, 4($sp) # Storing self - # Argument internal_184 - lw $t0, 88($sp) - sw $t0, 0($sp) # Storing internal_184 + # Argument internal_277 + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing internal_277 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_282 + lw $t0, 108($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 84($sp) # internal_185 = result of function_out_string_at_IO + sw $v1, 116($sp) # internal_280 = result of internal_282 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -17338,44 +20478,68 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_186[0] = '\n' + sb $t0, 8($v0) # internal_283[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 68($sp) # internal_186 = "\n" + sw $v0, 92($sp) # internal_283 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_285 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 84($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 80($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 828($sp) + lw $t0, 1240($sp) sw $t0, 4($sp) # Storing self - # Argument internal_186 - lw $t0, 80($sp) - sw $t0, 0($sp) # Storing internal_186 + # Argument internal_283 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_283 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_286 + lw $t0, 92($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 76($sp) # internal_187 = result of function_out_string_at_IO + sw $v1, 100($sp) # internal_284 = result of internal_286 addi $sp, $sp, 12 # Freeing space for arguments # Set attribute avar of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 168($sp) # $t1 = x - beq $t1, $zero, object_set_attribute_8794497338299 + lw $t0, 1228($sp) # $t0 = self + lw $t1, 280($sp) # $t1 = x + beq $t1, $zero, object_set_attribute_8753942944696 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8794497338299 + beq $t6, $t5, int_set_attribute_8753942944696 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8794497338299 - j object_set_attribute_8794497338299 - int_set_attribute_8794497338299: + beq $t6, $t5, bool_set_attribute_8753942944696 + j object_set_attribute_8753942944696 + int_set_attribute_8753942944696: li $v0, 9 addi $a0, $zero, 12 syscall @@ -17384,8 +20548,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.avar = x - j end_set_attribute_8794497338299 - bool_set_attribute_8794497338299: + j end_set_attribute_8753942944696 + bool_set_attribute_8753942944696: li $v0, 9 addi $a0, $zero, 12 syscall @@ -17394,19 +20558,19 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.avar = x - j end_set_attribute_8794497338299 - object_set_attribute_8794497338299: + j end_set_attribute_8753942944696 + object_set_attribute_8753942944696: sw $t1, 12($t0) # self.avar = x - end_set_attribute_8794497338299: + end_set_attribute_8753942944696: - # internal_156 = x - lw $t0, 168($sp) - sw $t0, 188($sp) + # internal_231 = x + lw $t0, 280($sp) + sw $t0, 300($sp) - # Jumping to endif_8794497406558 - j endif_8794497406558 + # Jumping to endif_8753943038913 + j endif_8753943038913 - else_8794497406558: + else_8753943038913: # Allocating Bool 0 li $v0, 9 @@ -17418,21 +20582,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 56($sp) # internal_189 = address of allocated object Int + sw $v0, 72($sp) # internal_288 = address of allocated object Int # Get attribute char of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'char' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497339182 + beq $t6, $t5, int_get_attribute_8753942946027 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497339182 - j object_get_attribute_8794497339182 - int_get_attribute_8794497339182: + beq $t6, $t5, bool_get_attribute_8753942946027 + j object_get_attribute_8753942946027 + int_get_attribute_8753942946027: li $v0, 9 addi $a0, $zero, 12 syscall @@ -17440,9 +20604,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 52($sp) # internal_190 = self.char - j end_get_attribute_8794497339182 - bool_get_attribute_8794497339182: + sw $v0, 68($sp) # internal_289 = self.char + j end_get_attribute_8753942946027 + bool_get_attribute_8753942946027: li $v0, 9 addi $a0, $zero, 12 syscall @@ -17450,11 +20614,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 52($sp) # internal_190 = self.char - j end_get_attribute_8794497339182 - object_get_attribute_8794497339182: - sw $t1, 52($sp) # internal_190 = char - end_get_attribute_8794497339182: + sw $v0, 68($sp) # internal_289 = self.char + j end_get_attribute_8753942946027 + object_get_attribute_8753942946027: + sw $t1, 68($sp) # internal_289 = self.char + end_get_attribute_8753942946027: # Allocating String li $v0, 9 @@ -17468,44 +20632,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 106 - sb $t0, 8($v0) # internal_191[0] = 'j' + sb $t0, 8($v0) # internal_290[0] = 'j' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 48($sp) # internal_191 = "j" + sw $v0, 64($sp) # internal_290 = "j" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_190 - lw $t0, 64($sp) - sw $t0, 4($sp) # Storing internal_190 + # Argument internal_289 + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing internal_289 - # Argument internal_191 - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing internal_191 + # Argument internal_290 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_290 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 56($sp) # internal_192 = result of function_equal + sw $v1, 72($sp) # internal_291 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_189 = internal_192 - lw $t0, 44($sp) - sw $t0, 56($sp) + # internal_288 = internal_291 + lw $t0, 60($sp) + sw $t0, 72($sp) - # If internal_189 then goto then_8794497406552 - lw $t0, 56($sp) # Loading the address of the condition + # If internal_288 then goto then_8753943038907 + lw $t0, 72($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497406552 + beq $t0, $t1, then_8753943038907 - # Jumping to else_8794497406552 - j else_8794497406552 + # Jumping to else_8753943038907 + j else_8753943038907 - then_8794497406552: + then_8753943038907: # Allocating A li $v0, 9 @@ -17514,36 +20678,36 @@ la $t0, type_A # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 40($sp) # internal_193 = address of allocated object A + sw $v0, 56($sp) # internal_292 = address of allocated object A # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_193 - lw $t0, 48($sp) - sw $t0, 0($sp) # Storing internal_193 + # Argument internal_292 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_292 # Calling function function___init___at_A jal function___init___at_A lw $ra, 4($sp) - sw $v1, 48($sp) # internal_193 = result of function___init___at_A + sw $v1, 64($sp) # internal_292 = result of function___init___at_A addi $sp, $sp, 8 # Freeing space for arguments # Set attribute avar of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 40($sp) # $t1 = internal_193 - beq $t1, $zero, object_set_attribute_8794497339248 + lw $t0, 1228($sp) # $t0 = self + lw $t1, 56($sp) # $t1 = internal_292 + beq $t1, $zero, object_set_attribute_8753942946353 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8794497339248 + beq $t6, $t5, int_set_attribute_8753942946353 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8794497339248 - j object_set_attribute_8794497339248 - int_set_attribute_8794497339248: + beq $t6, $t5, bool_set_attribute_8753942946353 + j object_set_attribute_8753942946353 + int_set_attribute_8753942946353: li $v0, 9 addi $a0, $zero, 12 syscall @@ -17551,9 +20715,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_193 - j end_set_attribute_8794497339248 - bool_set_attribute_8794497339248: + sw $v0, 12($t0) # self.avar = internal_292 + j end_set_attribute_8753942946353 + bool_set_attribute_8753942946353: li $v0, 9 addi $a0, $zero, 12 syscall @@ -17561,20 +20725,20 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_193 - j end_set_attribute_8794497339248 - object_set_attribute_8794497339248: - sw $t1, 12($t0) # self.avar = internal_193 - end_set_attribute_8794497339248: + sw $v0, 12($t0) # self.avar = internal_292 + j end_set_attribute_8753942946353 + object_set_attribute_8753942946353: + sw $t1, 12($t0) # self.avar = internal_292 + end_set_attribute_8753942946353: - # internal_188 = internal_193 - lw $t0, 40($sp) - sw $t0, 60($sp) + # internal_287 = internal_292 + lw $t0, 56($sp) + sw $t0, 76($sp) - # Jumping to endif_8794497406552 - j endif_8794497406552 + # Jumping to endif_8753943038907 + j endif_8753943038907 - else_8794497406552: + else_8753943038907: # Allocating Bool 0 li $v0, 9 @@ -17586,21 +20750,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_195 = address of allocated object Int + sw $v0, 48($sp) # internal_294 = address of allocated object Int # Get attribute char of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'char' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497339350 + beq $t6, $t5, int_get_attribute_8753942946455 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497339350 - j object_get_attribute_8794497339350 - int_get_attribute_8794497339350: + beq $t6, $t5, bool_get_attribute_8753942946455 + j object_get_attribute_8753942946455 + int_get_attribute_8753942946455: li $v0, 9 addi $a0, $zero, 12 syscall @@ -17608,9 +20772,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 28($sp) # internal_196 = self.char - j end_get_attribute_8794497339350 - bool_get_attribute_8794497339350: + sw $v0, 44($sp) # internal_295 = self.char + j end_get_attribute_8753942946455 + bool_get_attribute_8753942946455: li $v0, 9 addi $a0, $zero, 12 syscall @@ -17618,11 +20782,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 28($sp) # internal_196 = self.char - j end_get_attribute_8794497339350 - object_get_attribute_8794497339350: - sw $t1, 28($sp) # internal_196 = char - end_get_attribute_8794497339350: + sw $v0, 44($sp) # internal_295 = self.char + j end_get_attribute_8753942946455 + object_get_attribute_8753942946455: + sw $t1, 44($sp) # internal_295 = self.char + end_get_attribute_8753942946455: # Allocating String li $v0, 9 @@ -17636,44 +20800,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 113 - sb $t0, 8($v0) # internal_197[0] = 'q' + sb $t0, 8($v0) # internal_296[0] = 'q' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 24($sp) # internal_197 = "q" + sw $v0, 40($sp) # internal_296 = "q" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_196 - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing internal_196 + # Argument internal_295 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_295 - # Argument internal_197 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_197 + # Argument internal_296 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_296 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 32($sp) # internal_198 = result of function_equal + sw $v1, 48($sp) # internal_297 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_195 = internal_198 - lw $t0, 20($sp) - sw $t0, 32($sp) + # internal_294 = internal_297 + lw $t0, 36($sp) + sw $t0, 48($sp) - # If internal_195 then goto then_8794497406528 - lw $t0, 32($sp) # Loading the address of the condition + # If internal_294 then goto then_8753943038883 + lw $t0, 48($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8794497406528 + beq $t0, $t1, then_8753943038883 - # Jumping to else_8794497406528 - j else_8794497406528 + # Jumping to else_8753943038883 + j else_8753943038883 - then_8794497406528: + then_8753943038883: # Allocating Bool 0 li $v0, 9 @@ -17685,22 +20849,22 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_199 = address of allocated object Int + sw $v0, 32($sp) # internal_298 = address of allocated object Int # Set attribute flag of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 16($sp) # $t1 = internal_199 - beq $t1, $zero, object_set_attribute_8794497339932 + lw $t0, 1228($sp) # $t0 = self + lw $t1, 32($sp) # $t1 = internal_298 + beq $t1, $zero, object_set_attribute_8753942946521 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8794497339932 + beq $t6, $t5, int_set_attribute_8753942946521 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8794497339932 - j object_set_attribute_8794497339932 - int_set_attribute_8794497339932: + beq $t6, $t5, bool_set_attribute_8753942946521 + j object_set_attribute_8753942946521 + int_set_attribute_8753942946521: li $v0, 9 addi $a0, $zero, 12 syscall @@ -17708,9 +20872,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 20($t0) # self.flag = internal_199 - j end_set_attribute_8794497339932 - bool_set_attribute_8794497339932: + sw $v0, 20($t0) # self.flag = internal_298 + j end_set_attribute_8753942946521 + bool_set_attribute_8753942946521: li $v0, 9 addi $a0, $zero, 12 syscall @@ -17718,20 +20882,20 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 20($t0) # self.flag = internal_199 - j end_set_attribute_8794497339932 - object_set_attribute_8794497339932: - sw $t1, 20($t0) # self.flag = internal_199 - end_set_attribute_8794497339932: + sw $v0, 20($t0) # self.flag = internal_298 + j end_set_attribute_8753942946521 + object_set_attribute_8753942946521: + sw $t1, 20($t0) # self.flag = internal_298 + end_set_attribute_8753942946521: - # internal_194 = internal_199 - lw $t0, 16($sp) - sw $t0, 36($sp) + # internal_293 = internal_298 + lw $t0, 32($sp) + sw $t0, 52($sp) - # Jumping to endif_8794497406528 - j endif_8794497406528 + # Jumping to endif_8753943038883 + j endif_8753943038883 - else_8794497406528: + else_8753943038883: # Allocating A li $v0, 9 @@ -17740,35 +20904,35 @@ la $t0, type_A # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 12($sp) # internal_200 = address of allocated object A + sw $v0, 28($sp) # internal_299 = address of allocated object A # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_200 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_200 + # Argument internal_299 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_299 # Calling function function___init___at_A jal function___init___at_A lw $ra, 4($sp) - sw $v1, 20($sp) # internal_200 = result of function___init___at_A + sw $v1, 36($sp) # internal_299 = result of function___init___at_A addi $sp, $sp, 8 # Freeing space for arguments # Get attribute avar of self - lw $t0, 816($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'avar' from the instance + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8794497340037 + beq $t6, $t5, int_get_attribute_8753942947142 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8794497340037 - j object_get_attribute_8794497340037 - int_get_attribute_8794497340037: + beq $t6, $t5, bool_get_attribute_8753942947142 + j object_get_attribute_8753942947142 + int_get_attribute_8753942947142: li $v0, 9 addi $a0, $zero, 12 syscall @@ -17776,9 +20940,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($sp) # internal_201 = self.avar - j end_get_attribute_8794497340037 - bool_get_attribute_8794497340037: + sw $v0, 24($sp) # internal_300 = self.avar + j end_get_attribute_8753942947142 + bool_get_attribute_8753942947142: li $v0, 9 addi $a0, $zero, 12 syscall @@ -17786,58 +20950,106 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($sp) # internal_201 = self.avar - j end_get_attribute_8794497340037 - object_get_attribute_8794497340037: - sw $t1, 8($sp) # internal_201 = avar - end_get_attribute_8794497340037: + sw $v0, 24($sp) # internal_300 = self.avar + j end_get_attribute_8753942947142 + object_get_attribute_8753942947142: + sw $t1, 24($sp) # internal_300 = self.avar + end_get_attribute_8753942947142: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_302 = address of allocated object Int + + # Get method value of A + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_201 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_201 + # Argument internal_300 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_300 - # Calling function function_value_at_A - jal function_value_at_A + # Calling function internal_303 + lw $t0, 20($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 12($sp) # internal_202 = result of function_value_at_A + sw $v1, 28($sp) # internal_301 = result of internal_303 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_305 = address of allocated object Int + + # Get method method1 of A + lw $t0, 28($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_200 - lw $t0, 24($sp) - sw $t0, 4($sp) # Storing internal_200 + # Argument internal_299 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_299 - # Argument internal_202 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_202 + # Argument internal_301 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_301 - # Calling function function_method1_at_A - jal function_method1_at_A + # Calling function internal_306 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_203 = result of function_method1_at_A + sw $v1, 20($sp) # internal_304 = result of internal_306 addi $sp, $sp, 12 # Freeing space for arguments # Set attribute avar of self - lw $t0, 816($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_203 - beq $t1, $zero, object_set_attribute_8794497339974 + lw $t0, 1228($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_304 + beq $t1, $zero, object_set_attribute_8753942947082 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8794497339974 + beq $t6, $t5, int_set_attribute_8753942947082 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8794497339974 - j object_set_attribute_8794497339974 - int_set_attribute_8794497339974: + beq $t6, $t5, bool_set_attribute_8753942947082 + j object_set_attribute_8753942947082 + int_set_attribute_8753942947082: li $v0, 9 addi $a0, $zero, 12 syscall @@ -17845,9 +21057,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_203 - j end_set_attribute_8794497339974 - bool_set_attribute_8794497339974: + sw $v0, 12($t0) # self.avar = internal_304 + j end_set_attribute_8753942947082 + bool_set_attribute_8753942947082: li $v0, 9 addi $a0, $zero, 12 syscall @@ -17855,118 +21067,118 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.avar = internal_203 - j end_set_attribute_8794497339974 - object_set_attribute_8794497339974: - sw $t1, 12($t0) # self.avar = internal_203 - end_set_attribute_8794497339974: + sw $v0, 12($t0) # self.avar = internal_304 + j end_set_attribute_8753942947082 + object_set_attribute_8753942947082: + sw $t1, 12($t0) # self.avar = internal_304 + end_set_attribute_8753942947082: - # internal_194 = internal_203 - lw $t0, 0($sp) - sw $t0, 36($sp) + # internal_293 = internal_304 + lw $t0, 8($sp) + sw $t0, 52($sp) - # Jumping to endif_8794497406528 - j endif_8794497406528 + # Jumping to endif_8753943038883 + j endif_8753943038883 - endif_8794497406528: + endif_8753943038883: - # internal_188 = internal_194 - lw $t0, 36($sp) - sw $t0, 60($sp) + # internal_287 = internal_293 + lw $t0, 52($sp) + sw $t0, 76($sp) - # Jumping to endif_8794497406552 - j endif_8794497406552 + # Jumping to endif_8753943038907 + j endif_8753943038907 - endif_8794497406552: + endif_8753943038907: - # internal_156 = internal_188 - lw $t0, 60($sp) - sw $t0, 188($sp) + # internal_231 = internal_287 + lw $t0, 76($sp) + sw $t0, 300($sp) - # Jumping to endif_8794497406558 - j endif_8794497406558 + # Jumping to endif_8753943038913 + j endif_8753943038913 - endif_8794497406558: + endif_8753943038913: - # internal_133 = internal_156 - lw $t0, 188($sp) - sw $t0, 280($sp) + # internal_192 = internal_231 + lw $t0, 300($sp) + sw $t0, 456($sp) - # Jumping to endif_8794497406564 - j endif_8794497406564 + # Jumping to endif_8753943038919 + j endif_8753943038919 - endif_8794497406564: + endif_8753943038919: - # internal_124 = internal_133 - lw $t0, 280($sp) - sw $t0, 316($sp) + # internal_179 = internal_192 + lw $t0, 456($sp) + sw $t0, 508($sp) - # Jumping to endif_8794497406570 - j endif_8794497406570 + # Jumping to endif_8753943038925 + j endif_8753943038925 - endif_8794497406570: + endif_8753943038925: - # internal_115 = internal_124 - lw $t0, 316($sp) - sw $t0, 352($sp) + # internal_166 = internal_179 + lw $t0, 508($sp) + sw $t0, 560($sp) - # Jumping to endif_8794497406576 - j endif_8794497406576 + # Jumping to endif_8753943038931 + j endif_8753943038931 - endif_8794497406576: + endif_8753943038931: - # internal_106 = internal_115 - lw $t0, 352($sp) - sw $t0, 388($sp) + # internal_153 = internal_166 + lw $t0, 560($sp) + sw $t0, 612($sp) - # Jumping to endif_8794497406582 - j endif_8794497406582 + # Jumping to endif_8753943038937 + j endif_8753943038937 - endif_8794497406582: + endif_8753943038937: - # internal_92 = internal_106 - lw $t0, 388($sp) - sw $t0, 444($sp) + # internal_129 = internal_153 + lw $t0, 612($sp) + sw $t0, 708($sp) - # Jumping to endif_8794497406588 - j endif_8794497406588 + # Jumping to endif_8753943038943 + j endif_8753943038943 - endif_8794497406588: + endif_8753943038943: - # internal_32 = internal_92 - lw $t0, 444($sp) - sw $t0, 684($sp) + # internal_59 = internal_129 + lw $t0, 708($sp) + sw $t0, 988($sp) - # Jumping to endif_8794497406594 - j endif_8794497406594 + # Jumping to endif_8753943038949 + j endif_8753943038949 - endif_8794497406594: + endif_8753943038949: - # internal_18 = internal_32 - lw $t0, 684($sp) - sw $t0, 740($sp) + # internal_35 = internal_59 + lw $t0, 988($sp) + sw $t0, 1084($sp) - # Jumping to endif_8794497406600 - j endif_8794497406600 + # Jumping to endif_8753943038955 + j endif_8753943038955 - endif_8794497406600: + endif_8753943038955: - # Jumping to while_start_8794497406615 - j while_start_8794497406615 + # Jumping to while_start_8753943038970 + j while_start_8753943038970 - while_end_8794497406615: + while_end_8753943038970: # Loading return value in $v1 - addi $v1, $zero, 0 + lw $v1, 1220($sp) # Freeing space for local variables - addi $sp, $sp, 816 + addi $sp, $sp, 1228 jr $ra main: # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Allocating Main li $v0, 9 @@ -17975,34 +21187,58 @@ la $t0, type_Main # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object Main + sw $v0, 12($sp) # internal_0 = address of allocated object Main # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_Main jal function___init___at_Main lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 14 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 14 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_main_at_Main - jal function_main_at_Main + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + sw $v1, 16($sp) # internal_1 = result of internal_3 addi $sp, $sp, 8 # Freeing space for arguments # Exit program diff --git a/tests/codegen/atoi.mips b/tests/codegen/atoi.mips index b1f88f98b..52fb36721 100644 --- a/tests/codegen/atoi.mips +++ b/tests/codegen/atoi.mips @@ -1,52 +1,98 @@ .data - type_Object: .word 8 + type_Object: .word 24 type_Object_inherits_from: .word 0 - type_Object_attributes: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_A2I: .word 48 + type_A2I_inherits_from: .word type_Object + type_A2I_name_address: .word type_A2I_name_size + type_A2I___init__: .word function___init___at_A2I + type_A2I_abort: .word function_abort_at_Object + type_A2I_type_name: .word function_type_name_at_Object + type_A2I_copy: .word function_copy_at_Object + type_A2I_c2i: .word function_c2i_at_A2I + type_A2I_i2c: .word function_i2c_at_A2I + type_A2I_a2i: .word function_a2i_at_A2I + type_A2I_a2i_aux: .word function_a2i_aux_at_A2I + type_A2I_i2a: .word function_i2a_at_A2I + type_A2I_i2a_aux: .word function_i2a_aux_at_A2I + + type_Main: .word 44 + type_Main_inherits_from: .word type_IO + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_out_string: .word function_out_string_at_IO + type_Main_out_int: .word function_out_int_at_IO + type_Main_in_string: .word function_in_string_at_IO + type_Main_in_int: .word function_in_int_at_IO + type_Main_main: .word function_main_at_Main + type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" - type_Object_abort_message: .asciiz "Abort called from class Object\n" - type_IO: .word 8 - type_IO_inherits_from: .word type_Object - type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" - type_IO_abort_message: .asciiz "Abort called from class IO\n" - - type_Int: .word 8 - type_Int_inherits_from: .word type_Object - type_Int_attributes: .word 0 - type_Int_name_size: .word 3 - type_Int_name: .asciiz "Int" - type_Int_abort_message: .asciiz "Abort called from class Int\n" - type_String: .word 8 - type_String_inherits_from: .word type_Object - type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" - type_String_abort_message: .asciiz "Abort called from class String\n" - type_Bool: .word 8 - type_Bool_inherits_from: .word type_Object - type_Bool_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" - type_Bool_abort_message: .asciiz "Abort called from class Bool\n" - type_A2I: .word 8 - type_A2I_inherits_from: .word type_Object - type_A2I_attributes: .word 0 type_A2I_name_size: .word 3 type_A2I_name: .asciiz "A2I" - type_A2I_abort_message: .asciiz "Abort called from class A2I\n" - type_Main: .word 8 - type_Main_inherits_from: .word type_IO - type_Main_attributes: .word 0 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" - type_Main_abort_message: .asciiz "Abort called from class Main\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -707,11 +753,11 @@ function_abort_at_Object: # Function parameters - # $ra = 20($sp) - # self = 16($sp) + # $ra = 28($sp) + # self = 24($sp) # Reserving space for local variables - addi $sp, $sp, -16 + addi $sp, $sp, -24 # Allocating String li $v0, 9 @@ -798,7 +844,7 @@ sb $zero, 32($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_0 = "Abort called from class " + sw $v0, 20($sp) # internal_0 = "Abort called from class " # Allocating String li $v0, 9 @@ -812,66 +858,138 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_2[0] = '\n' + sb $t0, 8($v0) # internal_3[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_2 = "\n" + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 0($sp) # Storing self - # Calling function function_type_name_at_Object - jal function_type_name_at_Object + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + sw $v1, 24($sp) # internal_1 = result of internal_5 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_0 - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing internal_0 # Argument internal_1 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_1 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_3 - lw $t0, 12($sp) - sw $t0, 4($sp) # Storing internal_3 - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) # $t0 = internal_3 + lw $t0, 12($sp) # $t0 = internal_2 addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string internal_3 + # Printing the String internal_2 li $v0, 4 move $a0, $t0 syscall @@ -881,10 +999,10 @@ syscall # Loading return value in $v1 - lw $v1, 16($sp) + lw $v1, 24($sp) # Freeing space for local variables - addi $sp, $sp, 16 + addi $sp, $sp, 24 jr $ra @@ -899,8 +1017,9 @@ # internal_0 = name of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($t0) # $t1 = type of self - lw $t2, 12($t1) # $t1 = length of the name of self - la $t3, 16($t1) # $t1 = name of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 @@ -1003,7 +1122,7 @@ lw $t0, 0($sp) # $t0 = x addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string x + # Printing the String x li $v0, 4 move $a0, $t0 syscall @@ -1019,7 +1138,7 @@ # self = 4($sp) # x = 0($sp) - # Printing the string x + # Printing the Int x li $v0, 1 lw $a0, 0($sp) lw $a0, 8($a0) @@ -1046,11 +1165,13 @@ xor $t0, $t0, $t0 # Initializing counter while_read_start: lb $t1, buffer_input($t0) # Loading the byte - beq $t1, $zero, while_read_end + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end addi $t0, $t0, 1 # Incrementing counter j while_read_start while_read_end: - addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 @@ -1297,6 +1418,26 @@ jr $ra + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + function___init___at_A2I: # Function parameters # $ra = 4($sp) @@ -1309,12 +1450,12 @@ function_c2i_at_A2I: # Function parameters - # $ra = 216($sp) - # self = 212($sp) - # char = 208($sp) + # $ra = 224($sp) + # self = 220($sp) + # char = 216($sp) # Reserving space for local variables - addi $sp, $sp, -208 + addi $sp, $sp, -216 # Allocating Bool 0 li $v0, 9 @@ -1326,7 +1467,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 200($sp) # internal_1 = address of allocated object Int + sw $v0, 208($sp) # internal_1 = address of allocated object Int # Allocating String li $v0, 9 @@ -1344,40 +1485,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 196($sp) # internal_2 = "0" + sw $v0, 204($sp) # internal_2 = "0" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_2 - lw $t0, 208($sp) + lw $t0, 216($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 204($sp) # internal_3 = result of function_equal + sw $v1, 212($sp) # internal_3 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_1 = internal_3 - lw $t0, 192($sp) - sw $t0, 200($sp) + lw $t0, 200($sp) + sw $t0, 208($sp) - # If internal_1 then goto then_8751054232010 - lw $t0, 200($sp) # Loading the address of the condition + # If internal_1 then goto then_8743499620654 + lw $t0, 208($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8751054232010 + beq $t0, $t1, then_8743499620654 - # Jumping to else_8751054232010 - j else_8751054232010 + # Jumping to else_8743499620654 + j else_8743499620654 - then_8751054232010: + then_8743499620654: # Allocating Int 0 li $v0, 9 @@ -1389,16 +1530,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 188($sp) # internal_4 = address of allocated object Int + sw $v0, 196($sp) # internal_4 = address of allocated object Int # internal_0 = internal_4 - lw $t0, 188($sp) - sw $t0, 204($sp) + lw $t0, 196($sp) + sw $t0, 212($sp) - # Jumping to endif_8751054232010 - j endif_8751054232010 + # Jumping to endif_8743499620654 + j endif_8743499620654 - else_8751054232010: + else_8743499620654: # Allocating Bool 0 li $v0, 9 @@ -1410,7 +1551,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 180($sp) # internal_6 = address of allocated object Int + sw $v0, 188($sp) # internal_6 = address of allocated object Int # Allocating String li $v0, 9 @@ -1428,40 +1569,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 176($sp) # internal_7 = "1" + sw $v0, 184($sp) # internal_7 = "1" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_7 - lw $t0, 188($sp) + lw $t0, 196($sp) sw $t0, 0($sp) # Storing internal_7 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 184($sp) # internal_8 = result of function_equal + sw $v1, 192($sp) # internal_8 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_6 = internal_8 - lw $t0, 172($sp) - sw $t0, 180($sp) + lw $t0, 180($sp) + sw $t0, 188($sp) - # If internal_6 then goto then_8751054232004 - lw $t0, 180($sp) # Loading the address of the condition + # If internal_6 then goto then_8743499620648 + lw $t0, 188($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8751054232004 + beq $t0, $t1, then_8743499620648 - # Jumping to else_8751054232004 - j else_8751054232004 + # Jumping to else_8743499620648 + j else_8743499620648 - then_8751054232004: + then_8743499620648: # Allocating Int 1 li $v0, 9 @@ -1473,16 +1614,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 168($sp) # internal_9 = address of allocated object Int + sw $v0, 176($sp) # internal_9 = address of allocated object Int # internal_5 = internal_9 - lw $t0, 168($sp) - sw $t0, 184($sp) + lw $t0, 176($sp) + sw $t0, 192($sp) - # Jumping to endif_8751054232004 - j endif_8751054232004 + # Jumping to endif_8743499620648 + j endif_8743499620648 - else_8751054232004: + else_8743499620648: # Allocating Bool 0 li $v0, 9 @@ -1494,7 +1635,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 160($sp) # internal_11 = address of allocated object Int + sw $v0, 168($sp) # internal_11 = address of allocated object Int # Allocating String li $v0, 9 @@ -1512,40 +1653,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 156($sp) # internal_12 = "2" + sw $v0, 164($sp) # internal_12 = "2" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_12 - lw $t0, 168($sp) + lw $t0, 176($sp) sw $t0, 0($sp) # Storing internal_12 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 164($sp) # internal_13 = result of function_equal + sw $v1, 172($sp) # internal_13 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_11 = internal_13 - lw $t0, 152($sp) - sw $t0, 160($sp) + lw $t0, 160($sp) + sw $t0, 168($sp) - # If internal_11 then goto then_8751054231998 - lw $t0, 160($sp) # Loading the address of the condition + # If internal_11 then goto then_8743499620642 + lw $t0, 168($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8751054231998 + beq $t0, $t1, then_8743499620642 - # Jumping to else_8751054231998 - j else_8751054231998 + # Jumping to else_8743499620642 + j else_8743499620642 - then_8751054231998: + then_8743499620642: # Allocating Int 2 li $v0, 9 @@ -1557,16 +1698,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 148($sp) # internal_14 = address of allocated object Int + sw $v0, 156($sp) # internal_14 = address of allocated object Int # internal_10 = internal_14 - lw $t0, 148($sp) - sw $t0, 164($sp) + lw $t0, 156($sp) + sw $t0, 172($sp) - # Jumping to endif_8751054231998 - j endif_8751054231998 + # Jumping to endif_8743499620642 + j endif_8743499620642 - else_8751054231998: + else_8743499620642: # Allocating Bool 0 li $v0, 9 @@ -1578,7 +1719,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 140($sp) # internal_16 = address of allocated object Int + sw $v0, 148($sp) # internal_16 = address of allocated object Int # Allocating String li $v0, 9 @@ -1596,40 +1737,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 136($sp) # internal_17 = "3" + sw $v0, 144($sp) # internal_17 = "3" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_17 - lw $t0, 148($sp) + lw $t0, 156($sp) sw $t0, 0($sp) # Storing internal_17 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 144($sp) # internal_18 = result of function_equal + sw $v1, 152($sp) # internal_18 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_16 = internal_18 - lw $t0, 132($sp) - sw $t0, 140($sp) + lw $t0, 140($sp) + sw $t0, 148($sp) - # If internal_16 then goto then_8751054231992 - lw $t0, 140($sp) # Loading the address of the condition + # If internal_16 then goto then_8743499620636 + lw $t0, 148($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8751054231992 + beq $t0, $t1, then_8743499620636 - # Jumping to else_8751054231992 - j else_8751054231992 + # Jumping to else_8743499620636 + j else_8743499620636 - then_8751054231992: + then_8743499620636: # Allocating Int 3 li $v0, 9 @@ -1641,16 +1782,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 128($sp) # internal_19 = address of allocated object Int + sw $v0, 136($sp) # internal_19 = address of allocated object Int # internal_15 = internal_19 - lw $t0, 128($sp) - sw $t0, 144($sp) + lw $t0, 136($sp) + sw $t0, 152($sp) - # Jumping to endif_8751054231992 - j endif_8751054231992 + # Jumping to endif_8743499620636 + j endif_8743499620636 - else_8751054231992: + else_8743499620636: # Allocating Bool 0 li $v0, 9 @@ -1662,7 +1803,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 120($sp) # internal_21 = address of allocated object Int + sw $v0, 128($sp) # internal_21 = address of allocated object Int # Allocating String li $v0, 9 @@ -1680,40 +1821,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 116($sp) # internal_22 = "4" + sw $v0, 124($sp) # internal_22 = "4" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_22 - lw $t0, 128($sp) + lw $t0, 136($sp) sw $t0, 0($sp) # Storing internal_22 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 124($sp) # internal_23 = result of function_equal + sw $v1, 132($sp) # internal_23 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_21 = internal_23 - lw $t0, 112($sp) - sw $t0, 120($sp) + lw $t0, 120($sp) + sw $t0, 128($sp) - # If internal_21 then goto then_8751054231986 - lw $t0, 120($sp) # Loading the address of the condition + # If internal_21 then goto then_8743499620630 + lw $t0, 128($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8751054231986 + beq $t0, $t1, then_8743499620630 - # Jumping to else_8751054231986 - j else_8751054231986 + # Jumping to else_8743499620630 + j else_8743499620630 - then_8751054231986: + then_8743499620630: # Allocating Int 4 li $v0, 9 @@ -1725,16 +1866,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 108($sp) # internal_24 = address of allocated object Int + sw $v0, 116($sp) # internal_24 = address of allocated object Int # internal_20 = internal_24 - lw $t0, 108($sp) - sw $t0, 124($sp) + lw $t0, 116($sp) + sw $t0, 132($sp) - # Jumping to endif_8751054231986 - j endif_8751054231986 + # Jumping to endif_8743499620630 + j endif_8743499620630 - else_8751054231986: + else_8743499620630: # Allocating Bool 0 li $v0, 9 @@ -1746,7 +1887,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 100($sp) # internal_26 = address of allocated object Int + sw $v0, 108($sp) # internal_26 = address of allocated object Int # Allocating String li $v0, 9 @@ -1764,40 +1905,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 96($sp) # internal_27 = "5" + sw $v0, 104($sp) # internal_27 = "5" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_27 - lw $t0, 108($sp) + lw $t0, 116($sp) sw $t0, 0($sp) # Storing internal_27 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 104($sp) # internal_28 = result of function_equal + sw $v1, 112($sp) # internal_28 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_26 = internal_28 - lw $t0, 92($sp) - sw $t0, 100($sp) + lw $t0, 100($sp) + sw $t0, 108($sp) - # If internal_26 then goto then_8751054231980 - lw $t0, 100($sp) # Loading the address of the condition + # If internal_26 then goto then_8743499620624 + lw $t0, 108($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8751054231980 + beq $t0, $t1, then_8743499620624 - # Jumping to else_8751054231980 - j else_8751054231980 + # Jumping to else_8743499620624 + j else_8743499620624 - then_8751054231980: + then_8743499620624: # Allocating Int 5 li $v0, 9 @@ -1809,16 +1950,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 5 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 88($sp) # internal_29 = address of allocated object Int + sw $v0, 96($sp) # internal_29 = address of allocated object Int # internal_25 = internal_29 - lw $t0, 88($sp) - sw $t0, 104($sp) + lw $t0, 96($sp) + sw $t0, 112($sp) - # Jumping to endif_8751054231980 - j endif_8751054231980 + # Jumping to endif_8743499620624 + j endif_8743499620624 - else_8751054231980: + else_8743499620624: # Allocating Bool 0 li $v0, 9 @@ -1830,7 +1971,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # internal_31 = address of allocated object Int + sw $v0, 88($sp) # internal_31 = address of allocated object Int # Allocating String li $v0, 9 @@ -1848,40 +1989,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 76($sp) # internal_32 = "6" + sw $v0, 84($sp) # internal_32 = "6" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_32 - lw $t0, 88($sp) + lw $t0, 96($sp) sw $t0, 0($sp) # Storing internal_32 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 84($sp) # internal_33 = result of function_equal + sw $v1, 92($sp) # internal_33 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_31 = internal_33 - lw $t0, 72($sp) - sw $t0, 80($sp) + lw $t0, 80($sp) + sw $t0, 88($sp) - # If internal_31 then goto then_8751054231974 - lw $t0, 80($sp) # Loading the address of the condition + # If internal_31 then goto then_8743499620618 + lw $t0, 88($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8751054231974 + beq $t0, $t1, then_8743499620618 - # Jumping to else_8751054231974 - j else_8751054231974 + # Jumping to else_8743499620618 + j else_8743499620618 - then_8751054231974: + then_8743499620618: # Allocating Int 6 li $v0, 9 @@ -1893,16 +2034,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 6 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 68($sp) # internal_34 = address of allocated object Int + sw $v0, 76($sp) # internal_34 = address of allocated object Int # internal_30 = internal_34 - lw $t0, 68($sp) - sw $t0, 84($sp) + lw $t0, 76($sp) + sw $t0, 92($sp) - # Jumping to endif_8751054231974 - j endif_8751054231974 + # Jumping to endif_8743499620618 + j endif_8743499620618 - else_8751054231974: + else_8743499620618: # Allocating Bool 0 li $v0, 9 @@ -1914,7 +2055,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_36 = address of allocated object Int + sw $v0, 68($sp) # internal_36 = address of allocated object Int # Allocating String li $v0, 9 @@ -1932,40 +2073,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 56($sp) # internal_37 = "7" + sw $v0, 64($sp) # internal_37 = "7" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_37 - lw $t0, 68($sp) + lw $t0, 76($sp) sw $t0, 0($sp) # Storing internal_37 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 64($sp) # internal_38 = result of function_equal + sw $v1, 72($sp) # internal_38 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_36 = internal_38 - lw $t0, 52($sp) - sw $t0, 60($sp) + lw $t0, 60($sp) + sw $t0, 68($sp) - # If internal_36 then goto then_8751054231968 - lw $t0, 60($sp) # Loading the address of the condition + # If internal_36 then goto then_8743499620612 + lw $t0, 68($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8751054231968 + beq $t0, $t1, then_8743499620612 - # Jumping to else_8751054231968 - j else_8751054231968 + # Jumping to else_8743499620612 + j else_8743499620612 - then_8751054231968: + then_8743499620612: # Allocating Int 7 li $v0, 9 @@ -1977,16 +2118,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 7 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_39 = address of allocated object Int + sw $v0, 56($sp) # internal_39 = address of allocated object Int # internal_35 = internal_39 - lw $t0, 48($sp) - sw $t0, 64($sp) + lw $t0, 56($sp) + sw $t0, 72($sp) - # Jumping to endif_8751054231968 - j endif_8751054231968 + # Jumping to endif_8743499620612 + j endif_8743499620612 - else_8751054231968: + else_8743499620612: # Allocating Bool 0 li $v0, 9 @@ -1998,7 +2139,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_41 = address of allocated object Int + sw $v0, 48($sp) # internal_41 = address of allocated object Int # Allocating String li $v0, 9 @@ -2016,40 +2157,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 36($sp) # internal_42 = "8" + sw $v0, 44($sp) # internal_42 = "8" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_42 - lw $t0, 48($sp) + lw $t0, 56($sp) sw $t0, 0($sp) # Storing internal_42 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 44($sp) # internal_43 = result of function_equal + sw $v1, 52($sp) # internal_43 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_41 = internal_43 - lw $t0, 32($sp) - sw $t0, 40($sp) + lw $t0, 40($sp) + sw $t0, 48($sp) - # If internal_41 then goto then_8751054231962 - lw $t0, 40($sp) # Loading the address of the condition + # If internal_41 then goto then_8743499619578 + lw $t0, 48($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8751054231962 + beq $t0, $t1, then_8743499619578 - # Jumping to else_8751054231962 - j else_8751054231962 + # Jumping to else_8743499619578 + j else_8743499619578 - then_8751054231962: + then_8743499619578: # Allocating Int 8 li $v0, 9 @@ -2061,16 +2202,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 8 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_44 = address of allocated object Int + sw $v0, 36($sp) # internal_44 = address of allocated object Int # internal_40 = internal_44 - lw $t0, 28($sp) - sw $t0, 44($sp) + lw $t0, 36($sp) + sw $t0, 52($sp) - # Jumping to endif_8751054231962 - j endif_8751054231962 + # Jumping to endif_8743499619578 + j endif_8743499619578 - else_8751054231962: + else_8743499619578: # Allocating Bool 0 li $v0, 9 @@ -2082,7 +2223,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_46 = address of allocated object Int + sw $v0, 28($sp) # internal_46 = address of allocated object Int # Allocating String li $v0, 9 @@ -2100,40 +2241,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 16($sp) # internal_47 = "9" + sw $v0, 24($sp) # internal_47 = "9" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_47 - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t0, 0($sp) # Storing internal_47 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 24($sp) # internal_48 = result of function_equal + sw $v1, 32($sp) # internal_48 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_46 = internal_48 - lw $t0, 12($sp) - sw $t0, 20($sp) + lw $t0, 20($sp) + sw $t0, 28($sp) - # If internal_46 then goto then_8751054231941 - lw $t0, 20($sp) # Loading the address of the condition + # If internal_46 then goto then_8743499619557 + lw $t0, 28($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8751054231941 + beq $t0, $t1, then_8743499619557 - # Jumping to else_8751054231941 - j else_8751054231941 + # Jumping to else_8743499619557 + j else_8743499619557 - then_8751054231941: + then_8743499619557: # Allocating Int 9 li $v0, 9 @@ -2145,29 +2286,53 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 9 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_49 = address of allocated object Int + sw $v0, 16($sp) # internal_49 = address of allocated object Int # internal_45 = internal_49 - lw $t0, 8($sp) - sw $t0, 24($sp) + lw $t0, 16($sp) + sw $t0, 32($sp) - # Jumping to endif_8751054231941 - j endif_8751054231941 + # Jumping to endif_8743499619557 + j endif_8743499619557 - else_8751054231941: + else_8743499619557: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_51 = address of allocated object Int + + # Get method abort of A2I + lw $t0, 220($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 0($sp) # Storing self - # Calling function function_abort_at_Object - jal function_abort_at_Object + # Calling function internal_52 + lw $t0, 12($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 12($sp) # internal_50 = result of function_abort_at_Object + sw $v1, 20($sp) # internal_50 = result of internal_52 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 0 @@ -2180,114 +2345,114 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_51 = address of allocated object Int + sw $v0, 0($sp) # internal_53 = address of allocated object Int - # internal_45 = internal_51 + # internal_45 = internal_53 lw $t0, 0($sp) - sw $t0, 24($sp) + sw $t0, 32($sp) - # Jumping to endif_8751054231941 - j endif_8751054231941 + # Jumping to endif_8743499619557 + j endif_8743499619557 - endif_8751054231941: + endif_8743499619557: # internal_40 = internal_45 - lw $t0, 24($sp) - sw $t0, 44($sp) + lw $t0, 32($sp) + sw $t0, 52($sp) - # Jumping to endif_8751054231962 - j endif_8751054231962 + # Jumping to endif_8743499619578 + j endif_8743499619578 - endif_8751054231962: + endif_8743499619578: # internal_35 = internal_40 - lw $t0, 44($sp) - sw $t0, 64($sp) + lw $t0, 52($sp) + sw $t0, 72($sp) - # Jumping to endif_8751054231968 - j endif_8751054231968 + # Jumping to endif_8743499620612 + j endif_8743499620612 - endif_8751054231968: + endif_8743499620612: # internal_30 = internal_35 - lw $t0, 64($sp) - sw $t0, 84($sp) + lw $t0, 72($sp) + sw $t0, 92($sp) - # Jumping to endif_8751054231974 - j endif_8751054231974 + # Jumping to endif_8743499620618 + j endif_8743499620618 - endif_8751054231974: + endif_8743499620618: # internal_25 = internal_30 - lw $t0, 84($sp) - sw $t0, 104($sp) + lw $t0, 92($sp) + sw $t0, 112($sp) - # Jumping to endif_8751054231980 - j endif_8751054231980 + # Jumping to endif_8743499620624 + j endif_8743499620624 - endif_8751054231980: + endif_8743499620624: # internal_20 = internal_25 - lw $t0, 104($sp) - sw $t0, 124($sp) + lw $t0, 112($sp) + sw $t0, 132($sp) - # Jumping to endif_8751054231986 - j endif_8751054231986 + # Jumping to endif_8743499620630 + j endif_8743499620630 - endif_8751054231986: + endif_8743499620630: # internal_15 = internal_20 - lw $t0, 124($sp) - sw $t0, 144($sp) + lw $t0, 132($sp) + sw $t0, 152($sp) - # Jumping to endif_8751054231992 - j endif_8751054231992 + # Jumping to endif_8743499620636 + j endif_8743499620636 - endif_8751054231992: + endif_8743499620636: # internal_10 = internal_15 - lw $t0, 144($sp) - sw $t0, 164($sp) + lw $t0, 152($sp) + sw $t0, 172($sp) - # Jumping to endif_8751054231998 - j endif_8751054231998 + # Jumping to endif_8743499620642 + j endif_8743499620642 - endif_8751054231998: + endif_8743499620642: # internal_5 = internal_10 - lw $t0, 164($sp) - sw $t0, 184($sp) + lw $t0, 172($sp) + sw $t0, 192($sp) - # Jumping to endif_8751054232004 - j endif_8751054232004 + # Jumping to endif_8743499620648 + j endif_8743499620648 - endif_8751054232004: + endif_8743499620648: # internal_0 = internal_5 - lw $t0, 184($sp) - sw $t0, 204($sp) + lw $t0, 192($sp) + sw $t0, 212($sp) - # Jumping to endif_8751054232010 - j endif_8751054232010 + # Jumping to endif_8743499620654 + j endif_8743499620654 - endif_8751054232010: + endif_8743499620654: # Loading return value in $v1 - lw $v1, 204($sp) + lw $v1, 212($sp) # Freeing space for local variables - addi $sp, $sp, 208 + addi $sp, $sp, 216 jr $ra function_i2c_at_A2I: # Function parameters - # $ra = 216($sp) - # self = 212($sp) - # i = 208($sp) + # $ra = 224($sp) + # self = 220($sp) + # i = 216($sp) # Reserving space for local variables - addi $sp, $sp, -208 + addi $sp, $sp, -216 # Allocating Bool 0 li $v0, 9 @@ -2299,7 +2464,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 200($sp) # internal_1 = address of allocated object Int + sw $v0, 208($sp) # internal_1 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -2311,40 +2476,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 196($sp) # internal_2 = address of allocated object Int + sw $v0, 204($sp) # internal_2 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing i # Argument internal_2 - lw $t0, 208($sp) + lw $t0, 216($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 204($sp) # internal_3 = result of function_equal + sw $v1, 212($sp) # internal_3 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_1 = internal_3 - lw $t0, 192($sp) - sw $t0, 200($sp) + lw $t0, 200($sp) + sw $t0, 208($sp) - # If internal_1 then goto then_8751054233360 - lw $t0, 200($sp) # Loading the address of the condition + # If internal_1 then goto then_8743499621488 + lw $t0, 208($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8751054233360 + beq $t0, $t1, then_8743499621488 - # Jumping to else_8751054233360 - j else_8751054233360 + # Jumping to else_8743499621488 + j else_8743499621488 - then_8751054233360: + then_8743499621488: # Allocating String li $v0, 9 @@ -2362,16 +2527,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 188($sp) # internal_4 = "0" + sw $v0, 196($sp) # internal_4 = "0" # internal_0 = internal_4 - lw $t0, 188($sp) - sw $t0, 204($sp) + lw $t0, 196($sp) + sw $t0, 212($sp) - # Jumping to endif_8751054233360 - j endif_8751054233360 + # Jumping to endif_8743499621488 + j endif_8743499621488 - else_8751054233360: + else_8743499621488: # Allocating Bool 0 li $v0, 9 @@ -2383,7 +2548,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 180($sp) # internal_6 = address of allocated object Int + sw $v0, 188($sp) # internal_6 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -2395,40 +2560,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 176($sp) # internal_7 = address of allocated object Int + sw $v0, 184($sp) # internal_7 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing i # Argument internal_7 - lw $t0, 188($sp) + lw $t0, 196($sp) sw $t0, 0($sp) # Storing internal_7 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 184($sp) # internal_8 = result of function_equal + sw $v1, 192($sp) # internal_8 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_6 = internal_8 - lw $t0, 172($sp) - sw $t0, 180($sp) + lw $t0, 180($sp) + sw $t0, 188($sp) - # If internal_6 then goto then_8751054233354 - lw $t0, 180($sp) # Loading the address of the condition + # If internal_6 then goto then_8743499621482 + lw $t0, 188($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8751054233354 + beq $t0, $t1, then_8743499621482 - # Jumping to else_8751054233354 - j else_8751054233354 + # Jumping to else_8743499621482 + j else_8743499621482 - then_8751054233354: + then_8743499621482: # Allocating String li $v0, 9 @@ -2446,16 +2611,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 168($sp) # internal_9 = "1" + sw $v0, 176($sp) # internal_9 = "1" # internal_5 = internal_9 - lw $t0, 168($sp) - sw $t0, 184($sp) + lw $t0, 176($sp) + sw $t0, 192($sp) - # Jumping to endif_8751054233354 - j endif_8751054233354 + # Jumping to endif_8743499621482 + j endif_8743499621482 - else_8751054233354: + else_8743499621482: # Allocating Bool 0 li $v0, 9 @@ -2467,7 +2632,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 160($sp) # internal_11 = address of allocated object Int + sw $v0, 168($sp) # internal_11 = address of allocated object Int # Allocating Int 2 li $v0, 9 @@ -2479,40 +2644,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 156($sp) # internal_12 = address of allocated object Int + sw $v0, 164($sp) # internal_12 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing i # Argument internal_12 - lw $t0, 168($sp) + lw $t0, 176($sp) sw $t0, 0($sp) # Storing internal_12 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 164($sp) # internal_13 = result of function_equal + sw $v1, 172($sp) # internal_13 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_11 = internal_13 - lw $t0, 152($sp) - sw $t0, 160($sp) + lw $t0, 160($sp) + sw $t0, 168($sp) - # If internal_11 then goto then_8751054233348 - lw $t0, 160($sp) # Loading the address of the condition + # If internal_11 then goto then_8743499621476 + lw $t0, 168($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8751054233348 + beq $t0, $t1, then_8743499621476 - # Jumping to else_8751054233348 - j else_8751054233348 + # Jumping to else_8743499621476 + j else_8743499621476 - then_8751054233348: + then_8743499621476: # Allocating String li $v0, 9 @@ -2530,16 +2695,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 148($sp) # internal_14 = "2" + sw $v0, 156($sp) # internal_14 = "2" # internal_10 = internal_14 - lw $t0, 148($sp) - sw $t0, 164($sp) + lw $t0, 156($sp) + sw $t0, 172($sp) - # Jumping to endif_8751054233348 - j endif_8751054233348 + # Jumping to endif_8743499621476 + j endif_8743499621476 - else_8751054233348: + else_8743499621476: # Allocating Bool 0 li $v0, 9 @@ -2551,7 +2716,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 140($sp) # internal_16 = address of allocated object Int + sw $v0, 148($sp) # internal_16 = address of allocated object Int # Allocating Int 3 li $v0, 9 @@ -2563,40 +2728,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 136($sp) # internal_17 = address of allocated object Int + sw $v0, 144($sp) # internal_17 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing i # Argument internal_17 - lw $t0, 148($sp) + lw $t0, 156($sp) sw $t0, 0($sp) # Storing internal_17 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 144($sp) # internal_18 = result of function_equal + sw $v1, 152($sp) # internal_18 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_16 = internal_18 - lw $t0, 132($sp) - sw $t0, 140($sp) + lw $t0, 140($sp) + sw $t0, 148($sp) - # If internal_16 then goto then_8751054233082 - lw $t0, 140($sp) # Loading the address of the condition + # If internal_16 then goto then_8743499621470 + lw $t0, 148($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8751054233082 + beq $t0, $t1, then_8743499621470 - # Jumping to else_8751054233082 - j else_8751054233082 + # Jumping to else_8743499621470 + j else_8743499621470 - then_8751054233082: + then_8743499621470: # Allocating String li $v0, 9 @@ -2614,16 +2779,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 128($sp) # internal_19 = "3" + sw $v0, 136($sp) # internal_19 = "3" # internal_15 = internal_19 - lw $t0, 128($sp) - sw $t0, 144($sp) + lw $t0, 136($sp) + sw $t0, 152($sp) - # Jumping to endif_8751054233082 - j endif_8751054233082 + # Jumping to endif_8743499621470 + j endif_8743499621470 - else_8751054233082: + else_8743499621470: # Allocating Bool 0 li $v0, 9 @@ -2635,7 +2800,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 120($sp) # internal_21 = address of allocated object Int + sw $v0, 128($sp) # internal_21 = address of allocated object Int # Allocating Int 4 li $v0, 9 @@ -2647,40 +2812,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 116($sp) # internal_22 = address of allocated object Int + sw $v0, 124($sp) # internal_22 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing i # Argument internal_22 - lw $t0, 128($sp) + lw $t0, 136($sp) sw $t0, 0($sp) # Storing internal_22 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 124($sp) # internal_23 = result of function_equal + sw $v1, 132($sp) # internal_23 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_21 = internal_23 - lw $t0, 112($sp) - sw $t0, 120($sp) + lw $t0, 120($sp) + sw $t0, 128($sp) - # If internal_21 then goto then_8751054233076 - lw $t0, 120($sp) # Loading the address of the condition + # If internal_21 then goto then_8743499621464 + lw $t0, 128($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8751054233076 + beq $t0, $t1, then_8743499621464 - # Jumping to else_8751054233076 - j else_8751054233076 + # Jumping to else_8743499621464 + j else_8743499621464 - then_8751054233076: + then_8743499621464: # Allocating String li $v0, 9 @@ -2698,16 +2863,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 108($sp) # internal_24 = "4" + sw $v0, 116($sp) # internal_24 = "4" # internal_20 = internal_24 - lw $t0, 108($sp) - sw $t0, 124($sp) + lw $t0, 116($sp) + sw $t0, 132($sp) - # Jumping to endif_8751054233076 - j endif_8751054233076 + # Jumping to endif_8743499621464 + j endif_8743499621464 - else_8751054233076: + else_8743499621464: # Allocating Bool 0 li $v0, 9 @@ -2719,7 +2884,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 100($sp) # internal_26 = address of allocated object Int + sw $v0, 108($sp) # internal_26 = address of allocated object Int # Allocating Int 5 li $v0, 9 @@ -2731,40 +2896,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 5 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 96($sp) # internal_27 = address of allocated object Int + sw $v0, 104($sp) # internal_27 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing i # Argument internal_27 - lw $t0, 108($sp) + lw $t0, 116($sp) sw $t0, 0($sp) # Storing internal_27 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 104($sp) # internal_28 = result of function_equal + sw $v1, 112($sp) # internal_28 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_26 = internal_28 - lw $t0, 92($sp) - sw $t0, 100($sp) + lw $t0, 100($sp) + sw $t0, 108($sp) - # If internal_26 then goto then_8751054233070 - lw $t0, 100($sp) # Loading the address of the condition + # If internal_26 then goto then_8743499621458 + lw $t0, 108($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8751054233070 + beq $t0, $t1, then_8743499621458 - # Jumping to else_8751054233070 - j else_8751054233070 + # Jumping to else_8743499621458 + j else_8743499621458 - then_8751054233070: + then_8743499621458: # Allocating String li $v0, 9 @@ -2782,16 +2947,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 88($sp) # internal_29 = "5" + sw $v0, 96($sp) # internal_29 = "5" # internal_25 = internal_29 - lw $t0, 88($sp) - sw $t0, 104($sp) + lw $t0, 96($sp) + sw $t0, 112($sp) - # Jumping to endif_8751054233070 - j endif_8751054233070 + # Jumping to endif_8743499621458 + j endif_8743499621458 - else_8751054233070: + else_8743499621458: # Allocating Bool 0 li $v0, 9 @@ -2803,7 +2968,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # internal_31 = address of allocated object Int + sw $v0, 88($sp) # internal_31 = address of allocated object Int # Allocating Int 6 li $v0, 9 @@ -2815,40 +2980,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 6 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 76($sp) # internal_32 = address of allocated object Int + sw $v0, 84($sp) # internal_32 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing i # Argument internal_32 - lw $t0, 88($sp) + lw $t0, 96($sp) sw $t0, 0($sp) # Storing internal_32 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 84($sp) # internal_33 = result of function_equal + sw $v1, 92($sp) # internal_33 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_31 = internal_33 - lw $t0, 72($sp) - sw $t0, 80($sp) + lw $t0, 80($sp) + sw $t0, 88($sp) - # If internal_31 then goto then_8751054233064 - lw $t0, 80($sp) # Loading the address of the condition + # If internal_31 then goto then_8743499621452 + lw $t0, 88($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8751054233064 + beq $t0, $t1, then_8743499621452 - # Jumping to else_8751054233064 - j else_8751054233064 + # Jumping to else_8743499621452 + j else_8743499621452 - then_8751054233064: + then_8743499621452: # Allocating String li $v0, 9 @@ -2866,16 +3031,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 68($sp) # internal_34 = "6" + sw $v0, 76($sp) # internal_34 = "6" # internal_30 = internal_34 - lw $t0, 68($sp) - sw $t0, 84($sp) + lw $t0, 76($sp) + sw $t0, 92($sp) - # Jumping to endif_8751054233064 - j endif_8751054233064 + # Jumping to endif_8743499621452 + j endif_8743499621452 - else_8751054233064: + else_8743499621452: # Allocating Bool 0 li $v0, 9 @@ -2887,7 +3052,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_36 = address of allocated object Int + sw $v0, 68($sp) # internal_36 = address of allocated object Int # Allocating Int 7 li $v0, 9 @@ -2899,40 +3064,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 7 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 56($sp) # internal_37 = address of allocated object Int + sw $v0, 64($sp) # internal_37 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing i # Argument internal_37 - lw $t0, 68($sp) + lw $t0, 76($sp) sw $t0, 0($sp) # Storing internal_37 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 64($sp) # internal_38 = result of function_equal + sw $v1, 72($sp) # internal_38 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_36 = internal_38 - lw $t0, 52($sp) - sw $t0, 60($sp) + lw $t0, 60($sp) + sw $t0, 68($sp) - # If internal_36 then goto then_8751054233058 - lw $t0, 60($sp) # Loading the address of the condition + # If internal_36 then goto then_8743499621446 + lw $t0, 68($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8751054233058 + beq $t0, $t1, then_8743499621446 - # Jumping to else_8751054233058 - j else_8751054233058 + # Jumping to else_8743499621446 + j else_8743499621446 - then_8751054233058: + then_8743499621446: # Allocating String li $v0, 9 @@ -2950,16 +3115,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 48($sp) # internal_39 = "7" + sw $v0, 56($sp) # internal_39 = "7" # internal_35 = internal_39 - lw $t0, 48($sp) - sw $t0, 64($sp) + lw $t0, 56($sp) + sw $t0, 72($sp) - # Jumping to endif_8751054233058 - j endif_8751054233058 + # Jumping to endif_8743499621446 + j endif_8743499621446 - else_8751054233058: + else_8743499621446: # Allocating Bool 0 li $v0, 9 @@ -2971,7 +3136,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_41 = address of allocated object Int + sw $v0, 48($sp) # internal_41 = address of allocated object Int # Allocating Int 8 li $v0, 9 @@ -2983,40 +3148,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 8 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_42 = address of allocated object Int + sw $v0, 44($sp) # internal_42 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing i # Argument internal_42 - lw $t0, 48($sp) + lw $t0, 56($sp) sw $t0, 0($sp) # Storing internal_42 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 44($sp) # internal_43 = result of function_equal + sw $v1, 52($sp) # internal_43 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_41 = internal_43 - lw $t0, 32($sp) - sw $t0, 40($sp) + lw $t0, 40($sp) + sw $t0, 48($sp) - # If internal_41 then goto then_8751054233052 - lw $t0, 40($sp) # Loading the address of the condition + # If internal_41 then goto then_8743499621440 + lw $t0, 48($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8751054233052 + beq $t0, $t1, then_8743499621440 - # Jumping to else_8751054233052 - j else_8751054233052 + # Jumping to else_8743499621440 + j else_8743499621440 - then_8751054233052: + then_8743499621440: # Allocating String li $v0, 9 @@ -3034,16 +3199,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 28($sp) # internal_44 = "8" + sw $v0, 36($sp) # internal_44 = "8" # internal_40 = internal_44 - lw $t0, 28($sp) - sw $t0, 44($sp) + lw $t0, 36($sp) + sw $t0, 52($sp) - # Jumping to endif_8751054233052 - j endif_8751054233052 + # Jumping to endif_8743499621440 + j endif_8743499621440 - else_8751054233052: + else_8743499621440: # Allocating Bool 0 li $v0, 9 @@ -3055,7 +3220,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_46 = address of allocated object Int + sw $v0, 28($sp) # internal_46 = address of allocated object Int # Allocating Int 9 li $v0, 9 @@ -3067,40 +3232,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 9 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_47 = address of allocated object Int + sw $v0, 24($sp) # internal_47 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing i # Argument internal_47 - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t0, 0($sp) # Storing internal_47 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 24($sp) # internal_48 = result of function_equal + sw $v1, 32($sp) # internal_48 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_46 = internal_48 - lw $t0, 12($sp) - sw $t0, 20($sp) + lw $t0, 20($sp) + sw $t0, 28($sp) - # If internal_46 then goto then_8751054233031 - lw $t0, 20($sp) # Loading the address of the condition + # If internal_46 then goto then_8743499621419 + lw $t0, 28($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8751054233031 + beq $t0, $t1, then_8743499621419 - # Jumping to else_8751054233031 - j else_8751054233031 + # Jumping to else_8743499621419 + j else_8743499621419 - then_8751054233031: + then_8743499621419: # Allocating String li $v0, 9 @@ -3118,29 +3283,53 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 8($sp) # internal_49 = "9" + sw $v0, 16($sp) # internal_49 = "9" # internal_45 = internal_49 - lw $t0, 8($sp) - sw $t0, 24($sp) + lw $t0, 16($sp) + sw $t0, 32($sp) - # Jumping to endif_8751054233031 - j endif_8751054233031 + # Jumping to endif_8743499621419 + j endif_8743499621419 + + else_8743499621419: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_51 = address of allocated object Int - else_8751054233031: + # Get method abort of A2I + lw $t0, 220($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 0($sp) # Storing self - # Calling function function_abort_at_Object - jal function_abort_at_Object + # Calling function internal_52 + lw $t0, 12($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 12($sp) # internal_50 = result of function_abort_at_Object + sw $v1, 20($sp) # internal_50 = result of internal_52 addi $sp, $sp, 8 # Freeing space for arguments # Allocating String @@ -3156,114 +3345,114 @@ sb $zero, 8($v0) # Null-terminator at the end of the string - sw $v0, 0($sp) # internal_51 = "" + sw $v0, 0($sp) # internal_53 = "" - # internal_45 = internal_51 + # internal_45 = internal_53 lw $t0, 0($sp) - sw $t0, 24($sp) + sw $t0, 32($sp) - # Jumping to endif_8751054233031 - j endif_8751054233031 + # Jumping to endif_8743499621419 + j endif_8743499621419 - endif_8751054233031: + endif_8743499621419: # internal_40 = internal_45 - lw $t0, 24($sp) - sw $t0, 44($sp) + lw $t0, 32($sp) + sw $t0, 52($sp) - # Jumping to endif_8751054233052 - j endif_8751054233052 + # Jumping to endif_8743499621440 + j endif_8743499621440 - endif_8751054233052: + endif_8743499621440: # internal_35 = internal_40 - lw $t0, 44($sp) - sw $t0, 64($sp) + lw $t0, 52($sp) + sw $t0, 72($sp) - # Jumping to endif_8751054233058 - j endif_8751054233058 + # Jumping to endif_8743499621446 + j endif_8743499621446 - endif_8751054233058: + endif_8743499621446: # internal_30 = internal_35 - lw $t0, 64($sp) - sw $t0, 84($sp) + lw $t0, 72($sp) + sw $t0, 92($sp) - # Jumping to endif_8751054233064 - j endif_8751054233064 + # Jumping to endif_8743499621452 + j endif_8743499621452 - endif_8751054233064: + endif_8743499621452: # internal_25 = internal_30 - lw $t0, 84($sp) - sw $t0, 104($sp) + lw $t0, 92($sp) + sw $t0, 112($sp) - # Jumping to endif_8751054233070 - j endif_8751054233070 + # Jumping to endif_8743499621458 + j endif_8743499621458 - endif_8751054233070: + endif_8743499621458: # internal_20 = internal_25 - lw $t0, 104($sp) - sw $t0, 124($sp) + lw $t0, 112($sp) + sw $t0, 132($sp) - # Jumping to endif_8751054233076 - j endif_8751054233076 + # Jumping to endif_8743499621464 + j endif_8743499621464 - endif_8751054233076: + endif_8743499621464: # internal_15 = internal_20 - lw $t0, 124($sp) - sw $t0, 144($sp) + lw $t0, 132($sp) + sw $t0, 152($sp) - # Jumping to endif_8751054233082 - j endif_8751054233082 + # Jumping to endif_8743499621470 + j endif_8743499621470 - endif_8751054233082: + endif_8743499621470: # internal_10 = internal_15 - lw $t0, 144($sp) - sw $t0, 164($sp) + lw $t0, 152($sp) + sw $t0, 172($sp) - # Jumping to endif_8751054233348 - j endif_8751054233348 + # Jumping to endif_8743499621476 + j endif_8743499621476 - endif_8751054233348: + endif_8743499621476: # internal_5 = internal_10 - lw $t0, 164($sp) - sw $t0, 184($sp) + lw $t0, 172($sp) + sw $t0, 192($sp) - # Jumping to endif_8751054233354 - j endif_8751054233354 + # Jumping to endif_8743499621482 + j endif_8743499621482 - endif_8751054233354: + endif_8743499621482: # internal_0 = internal_5 - lw $t0, 184($sp) - sw $t0, 204($sp) + lw $t0, 192($sp) + sw $t0, 212($sp) - # Jumping to endif_8751054233360 - j endif_8751054233360 + # Jumping to endif_8743499621488 + j endif_8743499621488 - endif_8751054233360: + endif_8743499621488: # Loading return value in $v1 - lw $v1, 204($sp) + lw $v1, 212($sp) # Freeing space for local variables - addi $sp, $sp, 208 + addi $sp, $sp, 216 jr $ra function_a2i_at_A2I: # Function parameters - # $ra = 152($sp) - # self = 148($sp) - # s = 144($sp) + # $ra = 232($sp) + # self = 228($sp) + # s = 224($sp) # Reserving space for local variables - addi $sp, $sp, -144 + addi $sp, $sp, -224 # Allocating Bool 0 li $v0, 9 @@ -3275,20 +3464,44 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 136($sp) # internal_1 = address of allocated object Int + sw $v0, 216($sp) # internal_1 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 208($sp) # internal_3 = address of allocated object Int + + # Get method length of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 208($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 204($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument s - lw $t0, 152($sp) + lw $t0, 232($sp) sw $t0, 0($sp) # Storing s - # Calling function function_length_at_String - jal function_length_at_String + # Calling function internal_4 + lw $t0, 212($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 140($sp) # internal_2 = result of function_length_at_String + sw $v1, 220($sp) # internal_2 = result of internal_4 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 0 @@ -3301,40 +3514,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 128($sp) # internal_3 = address of allocated object Int + sw $v0, 200($sp) # internal_5 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_2 - lw $t0, 144($sp) + lw $t0, 224($sp) sw $t0, 4($sp) # Storing internal_2 - # Argument internal_3 - lw $t0, 140($sp) - sw $t0, 0($sp) # Storing internal_3 + # Argument internal_5 + lw $t0, 212($sp) + sw $t0, 0($sp) # Storing internal_5 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 136($sp) # internal_4 = result of function_equal + sw $v1, 208($sp) # internal_6 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_1 = internal_4 - lw $t0, 124($sp) - sw $t0, 136($sp) + # internal_1 = internal_6 + lw $t0, 196($sp) + sw $t0, 216($sp) - # If internal_1 then goto then_8751054233546 - lw $t0, 136($sp) # Loading the address of the condition + # If internal_1 then goto then_8743499622190 + lw $t0, 216($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8751054233546 + beq $t0, $t1, then_8743499622190 - # Jumping to else_8751054233546 - j else_8751054233546 + # Jumping to else_8743499622190 + j else_8743499622190 - then_8751054233546: + then_8743499622190: # Allocating Int 0 li $v0, 9 @@ -3346,16 +3559,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 120($sp) # internal_5 = address of allocated object Int + sw $v0, 192($sp) # internal_7 = address of allocated object Int - # internal_0 = internal_5 - lw $t0, 120($sp) - sw $t0, 140($sp) + # internal_0 = internal_7 + lw $t0, 192($sp) + sw $t0, 220($sp) - # Jumping to endif_8751054233546 - j endif_8751054233546 + # Jumping to endif_8743499622190 + j endif_8743499622190 - else_8751054233546: + else_8743499622190: # Allocating Bool 0 li $v0, 9 @@ -3367,7 +3580,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 112($sp) # internal_7 = address of allocated object Int + sw $v0, 184($sp) # internal_9 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -3379,7 +3592,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 108($sp) # internal_8 = address of allocated object Int + sw $v0, 180($sp) # internal_10 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -3391,28 +3604,52 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 104($sp) # internal_9 = address of allocated object Int + sw $v0, 176($sp) # internal_11 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 168($sp) # internal_13 = address of allocated object Int + + # Get method substr of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 168($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 164($sp) # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument s - lw $t0, 160($sp) + lw $t0, 240($sp) sw $t0, 8($sp) # Storing s - # Argument internal_8 - lw $t0, 124($sp) - sw $t0, 4($sp) # Storing internal_8 + # Argument internal_10 + lw $t0, 196($sp) + sw $t0, 4($sp) # Storing internal_10 - # Argument internal_9 - lw $t0, 120($sp) - sw $t0, 0($sp) # Storing internal_9 + # Argument internal_11 + lw $t0, 192($sp) + sw $t0, 0($sp) # Storing internal_11 - # Calling function function_substr_at_String - jal function_substr_at_String + # Calling function internal_14 + lw $t0, 180($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 116($sp) # internal_10 = result of function_substr_at_String + sw $v1, 188($sp) # internal_12 = result of internal_14 addi $sp, $sp, 16 # Freeing space for arguments # Allocating String @@ -3427,44 +3664,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 45 - sb $t0, 8($v0) # internal_11[0] = '-' + sb $t0, 8($v0) # internal_15[0] = '-' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 96($sp) # internal_11 = "-" + sw $v0, 160($sp) # internal_15 = "-" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_10 - lw $t0, 112($sp) - sw $t0, 4($sp) # Storing internal_10 + # Argument internal_12 + lw $t0, 184($sp) + sw $t0, 4($sp) # Storing internal_12 - # Argument internal_11 - lw $t0, 108($sp) - sw $t0, 0($sp) # Storing internal_11 + # Argument internal_15 + lw $t0, 172($sp) + sw $t0, 0($sp) # Storing internal_15 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 104($sp) # internal_12 = result of function_equal + sw $v1, 168($sp) # internal_16 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_7 = internal_12 - lw $t0, 92($sp) - sw $t0, 112($sp) + # internal_9 = internal_16 + lw $t0, 156($sp) + sw $t0, 184($sp) - # If internal_7 then goto then_8751054233561 - lw $t0, 112($sp) # Loading the address of the condition + # If internal_9 then goto then_8743499622205 + lw $t0, 184($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8751054233561 + beq $t0, $t1, then_8743499622205 - # Jumping to else_8751054233561 - j else_8751054233561 + # Jumping to else_8743499622205 + j else_8743499622205 - then_8751054233561: + then_8743499622205: # Allocating Int 1 li $v0, 9 @@ -3476,20 +3713,44 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 88($sp) # internal_13 = address of allocated object Int + sw $v0, 152($sp) # internal_17 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_19 = address of allocated object Int + + # Get method length of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 144($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 140($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument s - lw $t0, 152($sp) + lw $t0, 232($sp) sw $t0, 0($sp) # Storing s - # Calling function function_length_at_String - jal function_length_at_String + # Calling function internal_20 + lw $t0, 148($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 92($sp) # internal_14 = result of function_length_at_String + sw $v1, 156($sp) # internal_18 = result of internal_20 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 1 @@ -3502,64 +3763,112 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # internal_15 = address of allocated object Int + sw $v0, 136($sp) # internal_21 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_14 - lw $t0, 96($sp) - sw $t0, 4($sp) # Storing internal_14 + # Argument internal_18 + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing internal_18 - # Argument internal_15 - lw $t0, 92($sp) - sw $t0, 0($sp) # Storing internal_15 + # Argument internal_21 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_21 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 88($sp) # internal_16 = result of function_sub + sw $v1, 144($sp) # internal_22 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 124($sp) # internal_24 = address of allocated object Int + + # Get method substr of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 124($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 120($sp) + # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument s - lw $t0, 160($sp) + lw $t0, 240($sp) sw $t0, 8($sp) # Storing s - # Argument internal_13 - lw $t0, 104($sp) - sw $t0, 4($sp) # Storing internal_13 + # Argument internal_17 + lw $t0, 168($sp) + sw $t0, 4($sp) # Storing internal_17 - # Argument internal_16 - lw $t0, 92($sp) - sw $t0, 0($sp) # Storing internal_16 + # Argument internal_22 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_22 - # Calling function function_substr_at_String - jal function_substr_at_String + # Calling function internal_25 + lw $t0, 136($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 88($sp) # internal_17 = result of function_substr_at_String + sw $v1, 144($sp) # internal_23 = result of internal_25 addi $sp, $sp, 16 # Freeing space for arguments + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_27 = address of allocated object Int + + # Get method a2i_aux of A2I + lw $t0, 228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 112($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 108($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 160($sp) + lw $t0, 240($sp) sw $t0, 4($sp) # Storing self - # Argument internal_17 - lw $t0, 84($sp) - sw $t0, 0($sp) # Storing internal_17 + # Argument internal_23 + lw $t0, 140($sp) + sw $t0, 0($sp) # Storing internal_23 - # Calling function function_a2i_aux_at_A2I - jal function_a2i_aux_at_A2I + # Calling function internal_28 + lw $t0, 120($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 80($sp) # internal_18 = result of function_a2i_aux_at_A2I + sw $v1, 128($sp) # internal_26 = result of internal_28 addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -3572,7 +3881,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 64($sp) # internal_19 = address of allocated object Int + sw $v0, 104($sp) # internal_29 = address of allocated object Int # Allocating Int 4294967295 li $v0, 9 @@ -3584,7 +3893,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4294967295 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_20 = address of allocated object Int + sw $v0, 100($sp) # internal_30 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -3596,52 +3905,52 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 56($sp) # internal_21 = address of allocated object Int + sw $v0, 96($sp) # internal_31 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_18 - lw $t0, 80($sp) - sw $t0, 4($sp) # Storing internal_18 + # Argument internal_26 + lw $t0, 128($sp) + sw $t0, 4($sp) # Storing internal_26 - # Argument internal_20 - lw $t0, 72($sp) - sw $t0, 0($sp) # Storing internal_20 + # Argument internal_30 + lw $t0, 112($sp) + sw $t0, 0($sp) # Storing internal_30 # Calling function function_xor jal function_xor lw $ra, 8($sp) - sw $v1, 68($sp) # internal_21 = result of function_xor + sw $v1, 108($sp) # internal_31 = result of function_xor addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_21 - lw $t0, 68($sp) - sw $t0, 4($sp) # Storing internal_21 + # Argument internal_31 + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing internal_31 - # Argument internal_19 - lw $t0, 76($sp) - sw $t0, 0($sp) # Storing internal_19 + # Argument internal_29 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_29 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 68($sp) # internal_21 = result of function_add + sw $v1, 108($sp) # internal_31 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # internal_6 = internal_21 - lw $t0, 56($sp) - sw $t0, 116($sp) + # internal_8 = internal_31 + lw $t0, 96($sp) + sw $t0, 188($sp) - # Jumping to endif_8751054233561 - j endif_8751054233561 + # Jumping to endif_8743499622205 + j endif_8743499622205 - else_8751054233561: + else_8743499622205: # Allocating Bool 0 li $v0, 9 @@ -3653,7 +3962,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_23 = address of allocated object Int + sw $v0, 88($sp) # internal_33 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -3665,7 +3974,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_24 = address of allocated object Int + sw $v0, 84($sp) # internal_34 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -3677,28 +3986,52 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_25 = address of allocated object Int + sw $v0, 80($sp) # internal_35 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_37 = address of allocated object Int + + # Get method substr of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 72($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 68($sp) # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument s - lw $t0, 160($sp) + lw $t0, 240($sp) sw $t0, 8($sp) # Storing s - # Argument internal_24 - lw $t0, 60($sp) - sw $t0, 4($sp) # Storing internal_24 + # Argument internal_34 + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing internal_34 - # Argument internal_25 - lw $t0, 56($sp) - sw $t0, 0($sp) # Storing internal_25 + # Argument internal_35 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_35 - # Calling function function_substr_at_String - jal function_substr_at_String + # Calling function internal_38 + lw $t0, 84($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 52($sp) # internal_26 = result of function_substr_at_String + sw $v1, 92($sp) # internal_36 = result of internal_38 addi $sp, $sp, 16 # Freeing space for arguments # Allocating String @@ -3713,44 +4046,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 43 - sb $t0, 8($v0) # internal_27[0] = '+' + sb $t0, 8($v0) # internal_39[0] = '+' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 32($sp) # internal_27 = "+" + sw $v0, 64($sp) # internal_39 = "+" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_26 - lw $t0, 48($sp) - sw $t0, 4($sp) # Storing internal_26 + # Argument internal_36 + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing internal_36 - # Argument internal_27 - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_27 + # Argument internal_39 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_39 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 40($sp) # internal_28 = result of function_equal + sw $v1, 72($sp) # internal_40 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_23 = internal_28 - lw $t0, 28($sp) - sw $t0, 48($sp) + # internal_33 = internal_40 + lw $t0, 60($sp) + sw $t0, 88($sp) - # If internal_23 then goto then_8751054233555 - lw $t0, 48($sp) # Loading the address of the condition + # If internal_33 then goto then_8743499622199 + lw $t0, 88($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8751054233555 + beq $t0, $t1, then_8743499622199 - # Jumping to else_8751054233555 - j else_8751054233555 + # Jumping to else_8743499622199 + j else_8743499622199 - then_8751054233555: + then_8743499622199: # Allocating Int 1 li $v0, 9 @@ -3762,20 +4095,44 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_29 = address of allocated object Int + sw $v0, 56($sp) # internal_41 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_43 = address of allocated object Int + + # Get method length of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 48($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 44($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument s - lw $t0, 152($sp) + lw $t0, 232($sp) sw $t0, 0($sp) # Storing s - # Calling function function_length_at_String - jal function_length_at_String + # Calling function internal_44 + lw $t0, 52($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 28($sp) # internal_30 = result of function_length_at_String + sw $v1, 60($sp) # internal_42 = result of internal_44 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 1 @@ -3788,136 +4145,208 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_31 = address of allocated object Int + sw $v0, 40($sp) # internal_45 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_30 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_30 + # Argument internal_42 + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing internal_42 - # Argument internal_31 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_31 + # Argument internal_45 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_45 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 24($sp) # internal_32 = result of function_sub + sw $v1, 48($sp) # internal_46 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_48 = address of allocated object Int + + # Get method substr of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 28($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 24($sp) + # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument s - lw $t0, 160($sp) + lw $t0, 240($sp) sw $t0, 8($sp) # Storing s - # Argument internal_29 - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing internal_29 + # Argument internal_41 + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing internal_41 - # Argument internal_32 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_32 + # Argument internal_46 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_46 - # Calling function function_substr_at_String - jal function_substr_at_String + # Calling function internal_49 + lw $t0, 40($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 24($sp) # internal_33 = result of function_substr_at_String + sw $v1, 48($sp) # internal_47 = result of internal_49 addi $sp, $sp, 16 # Freeing space for arguments + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_51 = address of allocated object Int + + # Get method a2i_aux of A2I + lw $t0, 228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 160($sp) + lw $t0, 240($sp) sw $t0, 4($sp) # Storing self - # Argument internal_33 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_33 + # Argument internal_47 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_47 - # Calling function function_a2i_aux_at_A2I - jal function_a2i_aux_at_A2I + # Calling function internal_52 + lw $t0, 24($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 16($sp) # internal_34 = result of function_a2i_aux_at_A2I + sw $v1, 32($sp) # internal_50 = result of internal_52 addi $sp, $sp, 12 # Freeing space for arguments - # internal_22 = internal_34 - lw $t0, 4($sp) - sw $t0, 52($sp) + # internal_32 = internal_50 + lw $t0, 20($sp) + sw $t0, 92($sp) + + # Jumping to endif_8743499622199 + j endif_8743499622199 - # Jumping to endif_8751054233555 - j endif_8751054233555 + else_8743499622199: + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_54 = address of allocated object Int - else_8751054233555: + # Get method a2i_aux of A2I + lw $t0, 228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 160($sp) + lw $t0, 240($sp) sw $t0, 4($sp) # Storing self # Argument s - lw $t0, 156($sp) + lw $t0, 236($sp) sw $t0, 0($sp) # Storing s - # Calling function function_a2i_aux_at_A2I - jal function_a2i_aux_at_A2I + # Calling function internal_55 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_35 = result of function_a2i_aux_at_A2I + sw $v1, 20($sp) # internal_53 = result of internal_55 addi $sp, $sp, 12 # Freeing space for arguments - # internal_22 = internal_35 - lw $t0, 0($sp) - sw $t0, 52($sp) + # internal_32 = internal_53 + lw $t0, 8($sp) + sw $t0, 92($sp) - # Jumping to endif_8751054233555 - j endif_8751054233555 + # Jumping to endif_8743499622199 + j endif_8743499622199 - endif_8751054233555: + endif_8743499622199: - # internal_6 = internal_22 - lw $t0, 52($sp) - sw $t0, 116($sp) + # internal_8 = internal_32 + lw $t0, 92($sp) + sw $t0, 188($sp) - # Jumping to endif_8751054233561 - j endif_8751054233561 + # Jumping to endif_8743499622205 + j endif_8743499622205 - endif_8751054233561: + endif_8743499622205: - # internal_0 = internal_6 - lw $t0, 116($sp) - sw $t0, 140($sp) + # internal_0 = internal_8 + lw $t0, 188($sp) + sw $t0, 220($sp) - # Jumping to endif_8751054233546 - j endif_8751054233546 + # Jumping to endif_8743499622190 + j endif_8743499622190 - endif_8751054233546: + endif_8743499622190: # Loading return value in $v1 - lw $v1, 140($sp) + lw $v1, 220($sp) # Freeing space for local variables - addi $sp, $sp, 144 + addi $sp, $sp, 224 jr $ra function_a2i_aux_at_A2I: # Function parameters - # $ra = 68($sp) - # self = 64($sp) - # s = 60($sp) + # $ra = 96($sp) + # self = 92($sp) + # s = 88($sp) # Reserving space for local variables - addi $sp, $sp, -60 + addi $sp, $sp, -88 # Allocating Int 0 li $v0, 9 @@ -3929,38 +4358,62 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 52($sp) # internal_1 = address of allocated object Int + sw $v0, 80($sp) # internal_1 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument int - lw $t0, 68($sp) + lw $t0, 96($sp) sw $t0, 4($sp) # Storing int # Argument internal_1 - lw $t0, 64($sp) + lw $t0, 92($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 68($sp) # int = result of function_assign + sw $v1, 96($sp) # int = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_4 = address of allocated object Int + + # Get method length of String + lw $t0, 88($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 68($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 64($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument s - lw $t0, 68($sp) + lw $t0, 96($sp) sw $t0, 0($sp) # Storing s - # Calling function function_length_at_String - jal function_length_at_String + # Calling function internal_5 + lw $t0, 72($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 52($sp) # internal_3 = result of function_length_at_String + sw $v1, 80($sp) # internal_3 = result of internal_5 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments @@ -3968,17 +4421,17 @@ sw $ra, 8($sp) # Storing return address # Argument j - lw $t0, 60($sp) + lw $t0, 88($sp) sw $t0, 4($sp) # Storing j # Argument internal_3 - lw $t0, 56($sp) + lw $t0, 84($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 60($sp) # j = result of function_assign + sw $v1, 88($sp) # j = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 0 @@ -3991,56 +4444,59 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_5 = address of allocated object Int + sw $v0, 56($sp) # internal_7 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 52($sp) + lw $t0, 72($sp) sw $t0, 4($sp) # Storing i - # Argument internal_5 - lw $t0, 48($sp) - sw $t0, 0($sp) # Storing internal_5 + # Argument internal_7 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_7 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 52($sp) # i = result of function_assign + sw $v1, 72($sp) # i = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - while_start_8751054233959: + # Allocating NUll to internal_8 + sw $zero, 52($sp) # internal_8 = 0 + + while_start_8743499622343: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 52($sp) + lw $t0, 72($sp) sw $t0, 4($sp) # Storing i # Argument j - lw $t0, 60($sp) + lw $t0, 88($sp) sw $t0, 0($sp) # Storing j # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 44($sp) # internal_6 = result of function_less_than + sw $v1, 60($sp) # internal_9 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_6 then goto while_body_8751054233959 - lw $t0, 32($sp) # Loading the address of the condition + # If internal_9 then goto while_body_8743499622343 + lw $t0, 48($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8751054233959 + beq $t0, $t1, while_body_8743499622343 - # Jumping to while_end_8751054233959 - j while_end_8751054233959 + # Jumping to while_end_8743499622343 + j while_end_8743499622343 - while_body_8751054233959: + while_body_8743499622343: # Allocating Int 10 li $v0, 9 @@ -4052,24 +4508,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 10 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_7 = address of allocated object Int + sw $v0, 44($sp) # internal_10 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument int - lw $t0, 68($sp) + lw $t0, 96($sp) sw $t0, 4($sp) # Storing int - # Argument internal_7 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_7 + # Argument internal_10 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_10 # Calling function function_mult jal function_mult lw $ra, 8($sp) - sw $v1, 36($sp) # internal_8 = result of function_mult + sw $v1, 52($sp) # internal_11 = result of function_mult addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -4082,64 +4538,112 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_9 = address of allocated object Int + sw $v0, 36($sp) # internal_12 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_14 = address of allocated object Int + + # Get method substr of String + lw $t0, 88($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 28($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 24($sp) # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument s - lw $t0, 76($sp) + lw $t0, 104($sp) sw $t0, 8($sp) # Storing s # Argument i - lw $t0, 56($sp) + lw $t0, 76($sp) sw $t0, 4($sp) # Storing i - # Argument internal_9 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_9 + # Argument internal_12 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_12 - # Calling function function_substr_at_String - jal function_substr_at_String + # Calling function internal_15 + lw $t0, 40($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 32($sp) # internal_10 = result of function_substr_at_String + sw $v1, 48($sp) # internal_13 = result of internal_15 addi $sp, $sp, 16 # Freeing space for arguments + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_17 = address of allocated object Int + + # Get method c2i of A2I + lw $t0, 92($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 76($sp) + lw $t0, 104($sp) sw $t0, 4($sp) # Storing self - # Argument internal_10 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_10 + # Argument internal_13 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_13 - # Calling function function_c2i_at_A2I - jal function_c2i_at_A2I + # Calling function internal_18 + lw $t0, 24($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 24($sp) # internal_11 = result of function_c2i_at_A2I + sw $v1, 32($sp) # internal_16 = result of internal_18 addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_8 - lw $t0, 36($sp) - sw $t0, 4($sp) # Storing internal_8 - # Argument internal_11 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_11 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_11 + + # Argument internal_16 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_16 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 20($sp) # internal_12 = result of function_add + sw $v1, 20($sp) # internal_19 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -4147,17 +4651,17 @@ sw $ra, 8($sp) # Storing return address # Argument int - lw $t0, 68($sp) + lw $t0, 96($sp) sw $t0, 4($sp) # Storing int - # Argument internal_12 + # Argument internal_19 lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_12 + sw $t0, 0($sp) # Storing internal_19 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 68($sp) # int = result of function_assign + sw $v1, 96($sp) # int = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -4170,24 +4674,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_13 = address of allocated object Int + sw $v0, 4($sp) # internal_20 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 52($sp) + lw $t0, 72($sp) sw $t0, 4($sp) # Storing i - # Argument internal_13 + # Argument internal_20 lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_13 + sw $t0, 0($sp) # Storing internal_20 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 12($sp) # internal_14 = result of function_add + sw $v1, 12($sp) # internal_21 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -4195,40 +4699,40 @@ sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 52($sp) + lw $t0, 72($sp) sw $t0, 4($sp) # Storing i - # Argument internal_14 + # Argument internal_21 lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_14 + sw $t0, 0($sp) # Storing internal_21 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 52($sp) # i = result of function_assign + sw $v1, 72($sp) # i = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to while_start_8751054233959 - j while_start_8751054233959 + # Jumping to while_start_8743499622343 + j while_start_8743499622343 - while_end_8751054233959: + while_end_8743499622343: # Loading return value in $v1 - lw $v1, 56($sp) + lw $v1, 84($sp) # Freeing space for local variables - addi $sp, $sp, 60 + addi $sp, $sp, 88 jr $ra function_i2a_at_A2I: # Function parameters - # $ra = 80($sp) - # self = 76($sp) - # i = 72($sp) + # $ra = 104($sp) + # self = 100($sp) + # i = 96($sp) # Reserving space for local variables - addi $sp, $sp, -72 + addi $sp, $sp, -96 # Allocating Bool 0 li $v0, 9 @@ -4240,7 +4744,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 64($sp) # internal_1 = address of allocated object Int + sw $v0, 88($sp) # internal_1 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -4252,40 +4756,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_2 = address of allocated object Int + sw $v0, 84($sp) # internal_2 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 84($sp) + lw $t0, 108($sp) sw $t0, 4($sp) # Storing i # Argument internal_2 - lw $t0, 72($sp) + lw $t0, 96($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 68($sp) # internal_3 = result of function_equal + sw $v1, 92($sp) # internal_3 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_1 = internal_3 - lw $t0, 56($sp) - sw $t0, 64($sp) + lw $t0, 80($sp) + sw $t0, 88($sp) - # If internal_1 then goto then_8751054234088 - lw $t0, 64($sp) # Loading the address of the condition + # If internal_1 then goto then_8743499622988 + lw $t0, 88($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8751054234088 + beq $t0, $t1, then_8743499622988 - # Jumping to else_8751054234088 - j else_8751054234088 + # Jumping to else_8743499622988 + j else_8743499622988 - then_8751054234088: + then_8743499622988: # Allocating String li $v0, 9 @@ -4303,16 +4807,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 52($sp) # internal_4 = "0" + sw $v0, 76($sp) # internal_4 = "0" # internal_0 = internal_4 - lw $t0, 52($sp) - sw $t0, 68($sp) + lw $t0, 76($sp) + sw $t0, 92($sp) - # Jumping to endif_8751054234088 - j endif_8751054234088 + # Jumping to endif_8743499622988 + j endif_8743499622988 - else_8751054234088: + else_8743499622988: # Allocating Bool 0 li $v0, 9 @@ -4324,7 +4828,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_6 = address of allocated object Int + sw $v0, 68($sp) # internal_6 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -4336,67 +4840,91 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_7 = address of allocated object Int + sw $v0, 64($sp) # internal_7 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_7 - lw $t0, 52($sp) + lw $t0, 76($sp) sw $t0, 4($sp) # Storing internal_7 # Argument i - lw $t0, 84($sp) + lw $t0, 108($sp) sw $t0, 0($sp) # Storing i # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 48($sp) # internal_8 = result of function_less_than + sw $v1, 72($sp) # internal_8 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments # internal_6 = internal_8 - lw $t0, 36($sp) - sw $t0, 44($sp) + lw $t0, 60($sp) + sw $t0, 68($sp) - # If internal_6 then goto then_8751054234094 - lw $t0, 44($sp) # Loading the address of the condition + # If internal_6 then goto then_8743499622994 + lw $t0, 68($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8751054234094 + beq $t0, $t1, then_8743499622994 + + # Jumping to else_8743499622994 + j else_8743499622994 - # Jumping to else_8751054234094 - j else_8751054234094 + then_8743499622994: - then_8751054234094: + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_10 = address of allocated object Int + + # Get method i2a_aux of A2I + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 52($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 48($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 88($sp) + lw $t0, 112($sp) sw $t0, 4($sp) # Storing self # Argument i - lw $t0, 84($sp) + lw $t0, 108($sp) sw $t0, 0($sp) # Storing i - # Calling function function_i2a_aux_at_A2I - jal function_i2a_aux_at_A2I + # Calling function internal_11 + lw $t0, 60($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 44($sp) # internal_9 = result of function_i2a_aux_at_A2I + sw $v1, 68($sp) # internal_9 = result of internal_11 addi $sp, $sp, 12 # Freeing space for arguments # internal_5 = internal_9 - lw $t0, 32($sp) - sw $t0, 48($sp) + lw $t0, 56($sp) + sw $t0, 72($sp) - # Jumping to endif_8751054234094 - j endif_8751054234094 + # Jumping to endif_8743499622994 + j endif_8743499622994 - else_8751054234094: + else_8743499622994: # Allocating String li $v0, 9 @@ -4410,11 +4938,11 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 45 - sb $t0, 8($v0) # internal_10[0] = '-' + sb $t0, 8($v0) # internal_12[0] = '-' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 28($sp) # internal_10 = "-" + sw $v0, 44($sp) # internal_12 = "-" # Allocating Int 1 li $v0, 9 @@ -4426,7 +4954,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_11 = address of allocated object Int + sw $v0, 40($sp) # internal_13 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -4438,7 +4966,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_12 = address of allocated object Int + sw $v0, 36($sp) # internal_14 = address of allocated object Int # Allocating Int 4294967295 li $v0, 9 @@ -4450,7 +4978,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4294967295 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_13 = address of allocated object Int + sw $v0, 32($sp) # internal_15 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -4462,42 +4990,42 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_14 = address of allocated object Int + sw $v0, 28($sp) # internal_16 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_11 - lw $t0, 36($sp) - sw $t0, 4($sp) # Storing internal_11 - # Argument internal_13 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_13 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_13 + + # Argument internal_15 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_15 # Calling function function_xor jal function_xor lw $ra, 8($sp) - sw $v1, 24($sp) # internal_14 = result of function_xor + sw $v1, 40($sp) # internal_16 = result of function_xor addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_14 - lw $t0, 24($sp) - sw $t0, 4($sp) # Storing internal_14 + # Argument internal_16 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_16 - # Argument internal_12 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_12 + # Argument internal_14 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_14 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 24($sp) # internal_14 = result of function_add + sw $v1, 40($sp) # internal_16 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -4505,89 +5033,137 @@ sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 84($sp) + lw $t0, 108($sp) sw $t0, 4($sp) # Storing i - # Argument internal_14 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_14 + # Argument internal_16 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_16 # Calling function function_mult jal function_mult lw $ra, 8($sp) - sw $v1, 20($sp) # internal_15 = result of function_mult + sw $v1, 36($sp) # internal_17 = result of function_mult addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_19 = address of allocated object Int + + # Get method i2a_aux of A2I + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 88($sp) + lw $t0, 112($sp) sw $t0, 4($sp) # Storing self - # Argument internal_15 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_15 + # Argument internal_17 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_17 - # Calling function function_i2a_aux_at_A2I - jal function_i2a_aux_at_A2I + # Calling function internal_20 + lw $t0, 24($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 16($sp) # internal_16 = result of function_i2a_aux_at_A2I + sw $v1, 32($sp) # internal_18 = result of internal_20 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_22 = address of allocated object Int + + # Get method concat of String + lw $t0, 44($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_10 - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing internal_10 + # Argument internal_12 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_12 - # Argument internal_16 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_16 + # Argument internal_18 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_18 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_23 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_17 = result of function_concat_at_String + sw $v1, 20($sp) # internal_21 = result of internal_23 addi $sp, $sp, 12 # Freeing space for arguments - # internal_5 = internal_17 - lw $t0, 0($sp) - sw $t0, 48($sp) + # internal_5 = internal_21 + lw $t0, 8($sp) + sw $t0, 72($sp) - # Jumping to endif_8751054234094 - j endif_8751054234094 + # Jumping to endif_8743499622994 + j endif_8743499622994 - endif_8751054234094: + endif_8743499622994: # internal_0 = internal_5 - lw $t0, 48($sp) - sw $t0, 68($sp) + lw $t0, 72($sp) + sw $t0, 92($sp) - # Jumping to endif_8751054234088 - j endif_8751054234088 + # Jumping to endif_8743499622988 + j endif_8743499622988 - endif_8751054234088: + endif_8743499622988: # Loading return value in $v1 - lw $v1, 68($sp) + lw $v1, 92($sp) # Freeing space for local variables - addi $sp, $sp, 72 + addi $sp, $sp, 96 jr $ra function_i2a_aux_at_A2I: # Function parameters - # $ra = 64($sp) - # self = 60($sp) - # i = 56($sp) + # $ra = 88($sp) + # self = 84($sp) + # i = 80($sp) # Reserving space for local variables - addi $sp, $sp, -56 + addi $sp, $sp, -80 # Allocating Bool 0 li $v0, 9 @@ -4599,7 +5175,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_1 = address of allocated object Int + sw $v0, 72($sp) # internal_1 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -4611,40 +5187,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_2 = address of allocated object Int + sw $v0, 68($sp) # internal_2 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 68($sp) + lw $t0, 92($sp) sw $t0, 4($sp) # Storing i # Argument internal_2 - lw $t0, 56($sp) + lw $t0, 80($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 52($sp) # internal_3 = result of function_equal + sw $v1, 76($sp) # internal_3 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_1 = internal_3 - lw $t0, 40($sp) - sw $t0, 48($sp) + lw $t0, 64($sp) + sw $t0, 72($sp) - # If internal_1 then goto then_8751054234974 - lw $t0, 48($sp) # Loading the address of the condition + # If internal_1 then goto then_8743499623102 + lw $t0, 72($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8751054234974 + beq $t0, $t1, then_8743499623102 - # Jumping to else_8751054234974 - j else_8751054234974 + # Jumping to else_8743499623102 + j else_8743499623102 - then_8751054234974: + then_8743499623102: # Allocating String li $v0, 9 @@ -4659,16 +5235,16 @@ sb $zero, 8($v0) # Null-terminator at the end of the string - sw $v0, 36($sp) # internal_4 = "" + sw $v0, 60($sp) # internal_4 = "" # internal_0 = internal_4 - lw $t0, 36($sp) - sw $t0, 52($sp) + lw $t0, 60($sp) + sw $t0, 76($sp) - # Jumping to endif_8751054234974 - j endif_8751054234974 + # Jumping to endif_8743499623102 + j endif_8743499623102 - else_8751054234974: + else_8743499623102: # Allocating Int 10 li $v0, 9 @@ -4680,24 +5256,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 10 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_6 = address of allocated object Int + sw $v0, 52($sp) # internal_6 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 68($sp) + lw $t0, 92($sp) sw $t0, 4($sp) # Storing i # Argument internal_6 - lw $t0, 40($sp) + lw $t0, 64($sp) sw $t0, 0($sp) # Storing internal_6 # Calling function function_div jal function_div lw $ra, 8($sp) - sw $v1, 36($sp) # internal_7 = result of function_div + sw $v1, 60($sp) # internal_7 = result of function_div addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -4705,35 +5281,59 @@ sw $ra, 8($sp) # Storing return address # Argument next - lw $t0, 44($sp) + lw $t0, 68($sp) sw $t0, 4($sp) # Storing next # Argument internal_7 - lw $t0, 36($sp) + lw $t0, 60($sp) sw $t0, 0($sp) # Storing internal_7 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 44($sp) # next = result of function_assign + sw $v1, 68($sp) # next = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_9 = address of allocated object Int + + # Get method i2a_aux of A2I + lw $t0, 84($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 40($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 36($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 72($sp) + lw $t0, 96($sp) sw $t0, 4($sp) # Storing self # Argument next - lw $t0, 44($sp) + lw $t0, 68($sp) sw $t0, 0($sp) # Storing next - # Calling function function_i2a_aux_at_A2I - jal function_i2a_aux_at_A2I + # Calling function internal_10 + lw $t0, 48($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 32($sp) # internal_8 = result of function_i2a_aux_at_A2I + sw $v1, 56($sp) # internal_8 = result of internal_10 addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 10 @@ -4746,24 +5346,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 10 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_9 = address of allocated object Int + sw $v0, 32($sp) # internal_11 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument next - lw $t0, 44($sp) + lw $t0, 68($sp) sw $t0, 4($sp) # Storing next - # Argument internal_9 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_9 + # Argument internal_11 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_11 # Calling function function_mult jal function_mult lw $ra, 8($sp) - sw $v1, 24($sp) # internal_10 = result of function_mult + sw $v1, 40($sp) # internal_12 = result of function_mult addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -4771,69 +5371,117 @@ sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 68($sp) + lw $t0, 92($sp) sw $t0, 4($sp) # Storing i - # Argument internal_10 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_10 + # Argument internal_12 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_12 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 20($sp) # internal_11 = result of function_sub + sw $v1, 36($sp) # internal_13 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_15 = address of allocated object Int + + # Get method i2c of A2I + lw $t0, 84($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 72($sp) + lw $t0, 96($sp) sw $t0, 4($sp) # Storing self - # Argument internal_11 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_11 + # Argument internal_13 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_13 - # Calling function function_i2c_at_A2I - jal function_i2c_at_A2I + # Calling function internal_16 + lw $t0, 24($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 16($sp) # internal_12 = result of function_i2c_at_A2I + sw $v1, 32($sp) # internal_14 = result of internal_16 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_18 = address of allocated object Int + + # Get method concat of String + lw $t0, 44($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_8 - lw $t0, 32($sp) + lw $t0, 56($sp) sw $t0, 4($sp) # Storing internal_8 - # Argument internal_12 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_12 + # Argument internal_14 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_14 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_19 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_13 = result of function_concat_at_String + sw $v1, 20($sp) # internal_17 = result of internal_19 addi $sp, $sp, 12 # Freeing space for arguments - # internal_0 = internal_13 - lw $t0, 0($sp) - sw $t0, 52($sp) + # internal_0 = internal_17 + lw $t0, 8($sp) + sw $t0, 76($sp) - # Jumping to endif_8751054234974 - j endif_8751054234974 + # Jumping to endif_8743499623102 + j endif_8743499623102 - endif_8751054234974: + endif_8743499623102: # Loading return value in $v1 - lw $v1, 52($sp) + lw $v1, 76($sp) # Freeing space for local variables - addi $sp, $sp, 56 + addi $sp, $sp, 80 jr $ra @@ -4849,11 +5497,11 @@ function_main_at_Main: # Function parameters - # $ra = 60($sp) - # self = 56($sp) + # $ra = 108($sp) + # self = 104($sp) # Reserving space for local variables - addi $sp, $sp, -56 + addi $sp, $sp, -104 # Allocating A2I li $v0, 9 @@ -4862,20 +5510,20 @@ la $t0, type_A2I # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 48($sp) # internal_1 = address of allocated object A2I + sw $v0, 96($sp) # internal_1 = address of allocated object A2I # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_1 - lw $t0, 56($sp) + lw $t0, 104($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function___init___at_A2I jal function___init___at_A2I lw $ra, 4($sp) - sw $v1, 56($sp) # internal_1 = result of function___init___at_A2I + sw $v1, 104($sp) # internal_1 = result of function___init___at_A2I addi $sp, $sp, 8 # Freeing space for arguments # Allocating String @@ -4909,24 +5557,48 @@ sb $zero, 14($v0) # Null-terminator at the end of the string - sw $v0, 44($sp) # internal_2 = "678987" + sw $v0, 92($sp) # internal_2 = "678987" + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_4 = address of allocated object Int + + # Get method a2i of A2I + lw $t0, 96($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 84($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 80($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_1 - lw $t0, 60($sp) + lw $t0, 108($sp) sw $t0, 4($sp) # Storing internal_1 # Argument internal_2 - lw $t0, 56($sp) + lw $t0, 104($sp) sw $t0, 0($sp) # Storing internal_2 - # Calling function function_a2i_at_A2I - jal function_a2i_at_A2I + # Calling function internal_5 + lw $t0, 92($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 52($sp) # internal_3 = result of function_a2i_at_A2I + sw $v1, 100($sp) # internal_3 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -4934,17 +5606,17 @@ sw $ra, 8($sp) # Storing return address # Argument a - lw $t0, 64($sp) + lw $t0, 112($sp) sw $t0, 4($sp) # Storing a # Argument internal_3 - lw $t0, 52($sp) + lw $t0, 100($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 64($sp) # a = result of function_assign + sw $v1, 112($sp) # a = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating A2I @@ -4954,20 +5626,20 @@ la $t0, type_A2I # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 32($sp) # internal_5 = address of allocated object A2I + sw $v0, 72($sp) # internal_7 = address of allocated object A2I # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_5 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_5 + # Argument internal_7 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_7 # Calling function function___init___at_A2I jal function___init___at_A2I lw $ra, 4($sp) - sw $v1, 40($sp) # internal_5 = result of function___init___at_A2I + sw $v1, 80($sp) # internal_7 = result of function___init___at_A2I addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 678987 @@ -4980,24 +5652,48 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 678987 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_6 = address of allocated object Int + sw $v0, 68($sp) # internal_8 = address of allocated object Int + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_10 = address of allocated object Int + + # Get method i2a of A2I + lw $t0, 72($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 60($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 56($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_5 - lw $t0, 44($sp) - sw $t0, 4($sp) # Storing internal_5 + # Argument internal_7 + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing internal_7 - # Argument internal_6 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_6 + # Argument internal_8 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_8 - # Calling function function_i2a_at_A2I - jal function_i2a_at_A2I + # Calling function internal_11 + lw $t0, 68($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 36($sp) # internal_7 = result of function_i2a_at_A2I + sw $v1, 76($sp) # internal_9 = result of internal_11 addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -5005,35 +5701,59 @@ sw $ra, 8($sp) # Storing return address # Argument b - lw $t0, 48($sp) + lw $t0, 88($sp) sw $t0, 4($sp) # Storing b - # Argument internal_7 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_7 + # Argument internal_9 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_9 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 48($sp) # b = result of function_assign + sw $v1, 88($sp) # b = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_13 = address of allocated object Int + + # Get method out_int of Main + lw $t0, 104($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 48($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 44($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 68($sp) + lw $t0, 116($sp) sw $t0, 4($sp) # Storing self # Argument a - lw $t0, 64($sp) + lw $t0, 112($sp) sw $t0, 0($sp) # Storing a - # Calling function function_out_int_at_IO - jal function_out_int_at_IO + # Calling function internal_14 + lw $t0, 56($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 32($sp) # internal_8 = result of function_out_int_at_IO + sw $v1, 64($sp) # internal_12 = result of internal_14 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -5048,55 +5768,103 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_9[0] = ' ' + sb $t0, 8($v0) # internal_15[0] = ' ' addi $t0, $zero, 61 - sb $t0, 9($v0) # internal_9[1] = '=' + sb $t0, 9($v0) # internal_15[1] = '=' addi $t0, $zero, 61 - sb $t0, 10($v0) # internal_9[2] = '=' + sb $t0, 10($v0) # internal_15[2] = '=' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_9[3] = ' ' + sb $t0, 11($v0) # internal_15[3] = ' ' sb $zero, 12($v0) # Null-terminator at the end of the string - sw $v0, 16($sp) # internal_9 = " == " + sw $v0, 40($sp) # internal_15 = " == " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_17 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 104($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 32($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 28($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 68($sp) + lw $t0, 116($sp) sw $t0, 4($sp) # Storing self - # Argument internal_9 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_9 + # Argument internal_15 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_15 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_18 + lw $t0, 40($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 24($sp) # internal_10 = result of function_out_string_at_IO + sw $v1, 48($sp) # internal_16 = result of internal_18 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_20 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 104($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 68($sp) + lw $t0, 116($sp) sw $t0, 4($sp) # Storing self # Argument b - lw $t0, 48($sp) + lw $t0, 88($sp) sw $t0, 0($sp) # Storing b - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_21 + lw $t0, 28($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 20($sp) # internal_11 = result of function_out_string_at_IO + sw $v1, 36($sp) # internal_19 = result of internal_21 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -5111,41 +5879,65 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_12[0] = '\n' + sb $t0, 8($v0) # internal_22[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_12 = "\n" + sw $v0, 12($sp) # internal_22 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_24 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 104($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 68($sp) + lw $t0, 116($sp) sw $t0, 4($sp) # Storing self - # Argument internal_12 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_12 + # Argument internal_22 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_22 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_25 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_13 = result of function_out_string_at_IO + sw $v1, 20($sp) # internal_23 = result of internal_25 addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 56 + addi $sp, $sp, 104 jr $ra main: # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Allocating Main li $v0, 9 @@ -5154,34 +5946,58 @@ la $t0, type_Main # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object Main + sw $v0, 12($sp) # internal_0 = address of allocated object Main # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_Main jal function___init___at_Main lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_main_at_Main - jal function_main_at_Main + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + sw $v1, 16($sp) # internal_1 = result of internal_3 addi $sp, $sp, 8 # Freeing space for arguments # Exit program diff --git a/tests/codegen/book_list.mips b/tests/codegen/book_list.mips new file mode 100644 index 000000000..70d280afd --- /dev/null +++ b/tests/codegen/book_list.mips @@ -0,0 +1,5934 @@ +.data + type_Object: .word 24 + type_Object_inherits_from: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_Book: .word 56 + type_Book_inherits_from: .word type_IO + type_Book_name_address: .word type_Book_name_size + type_Book___init__: .word function___init___at_Book + type_Book_abort: .word function_abort_at_Object + type_Book_type_name: .word function_type_name_at_Object + type_Book_copy: .word function_copy_at_Object + type_Book_out_string: .word function_out_string_at_IO + type_Book_out_int: .word function_out_int_at_IO + type_Book_in_string: .word function_in_string_at_IO + type_Book_in_int: .word function_in_int_at_IO + type_Book_initBook: .word function_initBook_at_Book + type_Book_print: .word function_print_at_Book + + type_Article: .word 64 + type_Article_inherits_from: .word type_Book + type_Article_name_address: .word type_Article_name_size + type_Article___init__: .word function___init___at_Article + type_Article_abort: .word function_abort_at_Object + type_Article_type_name: .word function_type_name_at_Object + type_Article_copy: .word function_copy_at_Object + type_Article_out_string: .word function_out_string_at_IO + type_Article_out_int: .word function_out_int_at_IO + type_Article_in_string: .word function_in_string_at_IO + type_Article_in_int: .word function_in_int_at_IO + type_Article_initBook: .word function_initBook_at_Book + type_Article_print: .word function_print_at_Article + type_Article_initArticle: .word function_initArticle_at_Article + + type_BookList: .word 60 + type_BookList_inherits_from: .word type_IO + type_BookList_name_address: .word type_BookList_name_size + type_BookList___init__: .word function___init___at_BookList + type_BookList_abort: .word function_abort_at_Object + type_BookList_type_name: .word function_type_name_at_Object + type_BookList_copy: .word function_copy_at_Object + type_BookList_out_string: .word function_out_string_at_IO + type_BookList_out_int: .word function_out_int_at_IO + type_BookList_in_string: .word function_in_string_at_IO + type_BookList_in_int: .word function_in_int_at_IO + type_BookList_isNil: .word function_isNil_at_BookList + type_BookList_cons: .word function_cons_at_BookList + type_BookList_car: .word function_car_at_BookList + type_BookList_cdr: .word function_cdr_at_BookList + type_BookList_print_list: .word function_print_list_at_BookList + + type_Cons: .word 72 + type_Cons_inherits_from: .word type_BookList + type_Cons_name_address: .word type_Cons_name_size + type_Cons___init__: .word function___init___at_Cons + type_Cons_abort: .word function_abort_at_Object + type_Cons_type_name: .word function_type_name_at_Object + type_Cons_copy: .word function_copy_at_Object + type_Cons_out_string: .word function_out_string_at_IO + type_Cons_out_int: .word function_out_int_at_IO + type_Cons_in_string: .word function_in_string_at_IO + type_Cons_in_int: .word function_in_int_at_IO + type_Cons_isNil: .word function_isNil_at_Cons + type_Cons_cons: .word function_cons_at_BookList + type_Cons_car: .word function_car_at_Cons + type_Cons_cdr: .word function_cdr_at_Cons + type_Cons_print_list: .word function_print_list_at_Cons + type_Cons_init: .word function_init_at_Cons + + type_Nil: .word 60 + type_Nil_inherits_from: .word type_BookList + type_Nil_name_address: .word type_Nil_name_size + type_Nil___init__: .word function___init___at_Nil + type_Nil_abort: .word function_abort_at_Object + type_Nil_type_name: .word function_type_name_at_Object + type_Nil_copy: .word function_copy_at_Object + type_Nil_out_string: .word function_out_string_at_IO + type_Nil_out_int: .word function_out_int_at_IO + type_Nil_in_string: .word function_in_string_at_IO + type_Nil_in_int: .word function_in_int_at_IO + type_Nil_isNil: .word function_isNil_at_Nil + type_Nil_cons: .word function_cons_at_BookList + type_Nil_car: .word function_car_at_BookList + type_Nil_cdr: .word function_cdr_at_BookList + type_Nil_print_list: .word function_print_list_at_Nil + + type_Main: .word 32 + type_Main_inherits_from: .word type_Object + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_main: .word function_main_at_Main + + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_Book_name_size: .word 4 + type_Book_name: .asciiz "Book" + + type_Article_name_size: .word 7 + type_Article_name: .asciiz "Article" + + type_BookList_name_size: .word 8 + type_BookList_name: .asciiz "BookList" + + type_Cons_name_size: .word 4 + type_Cons_name: .asciiz "Cons" + + type_Nil_name_size: .word 3 + type_Nil_name: .asciiz "Nil" + + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_0 = address of allocated object Int + + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_5 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_6 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_7 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_8 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_9 = address of allocated object Int + + # internal_7 = EqualAddress(internal_3, internal_4) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_8 = EqualAddress(internal_3, internal_5) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_9 = EqualAddress(internal_3, internal_6) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_7 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_8 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_9 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 44($sp) + lw $t0, 8($t0) + lw $t1, 40($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 36($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 44($sp) + lw $t1, 40($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 36($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 36($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 36($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_3[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_1 = result of internal_5 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) # $t0 = internal_2 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String internal_2 + li $v0, 4 + move $a0, $t0 + syscall + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t4, $v0, 0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t3, $t3, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $v0, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the Int x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lb $t1, buffer_input($t0) # Loading the byte + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lb $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + lw $t0, 0($sp) + sw $t1, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 8($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 8($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 + lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) + lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bgt $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Book: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_0 = "" + + # Set attribute title of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8728344732944 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8728344732944 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8728344732944 + j object_set_attribute_8728344732944 + int_set_attribute_8728344732944: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.title = internal_0 + j end_set_attribute_8728344732944 + bool_set_attribute_8728344732944: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.title = internal_0 + j end_set_attribute_8728344732944 + object_set_attribute_8728344732944: + sw $t1, 8($t0) # self.title = internal_0 + end_set_attribute_8728344732944: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_1 = "" + + # Set attribute author of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8728344732965 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8728344732965 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8728344732965 + j object_set_attribute_8728344732965 + int_set_attribute_8728344732965: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.author = internal_1 + j end_set_attribute_8728344732965 + bool_set_attribute_8728344732965: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.author = internal_1 + j end_set_attribute_8728344732965 + object_set_attribute_8728344732965: + sw $t1, 12($t0) # self.author = internal_1 + end_set_attribute_8728344732965: + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_initBook_at_Book: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # title_p = 4($sp) + # author_p = 0($sp) + + # Set attribute title of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = title_p + beq $t1, $zero, object_set_attribute_8728344733016 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8728344733016 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8728344733016 + j object_set_attribute_8728344733016 + int_set_attribute_8728344733016: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.title = title_p + j end_set_attribute_8728344733016 + bool_set_attribute_8728344733016: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.title = title_p + j end_set_attribute_8728344733016 + object_set_attribute_8728344733016: + sw $t1, 8($t0) # self.title = title_p + end_set_attribute_8728344733016: + + # Set attribute author of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = author_p + beq $t1, $zero, object_set_attribute_8728344733025 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8728344733025 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8728344733025 + j object_set_attribute_8728344733025 + int_set_attribute_8728344733025: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.author = author_p + j end_set_attribute_8728344733025 + bool_set_attribute_8728344733025: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.author = author_p + j end_set_attribute_8728344733025 + object_set_attribute_8728344733025: + sw $t1, 12($t0) # self.author = author_p + end_set_attribute_8728344733025: + + # Loading return value in $v1 + lw $v1, 8($sp) + + jr $ra + + function_print_at_Book: + # Function parameters + # $ra = 100($sp) + # self = 96($sp) + + # Reserving space for local variables + addi $sp, $sp, -96 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 21 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 116 + sb $t0, 8($v0) # internal_0[0] = 't' + + addi $t0, $zero, 105 + sb $t0, 9($v0) # internal_0[1] = 'i' + + addi $t0, $zero, 116 + sb $t0, 10($v0) # internal_0[2] = 't' + + addi $t0, $zero, 108 + sb $t0, 11($v0) # internal_0[3] = 'l' + + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_0[4] = 'e' + + addi $t0, $zero, 58 + sb $t0, 13($v0) # internal_0[5] = ':' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_0[6] = ' ' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_0[7] = ' ' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_0[8] = ' ' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_0[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_0[10] = ' ' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_0[11] = ' ' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 92($sp) # internal_0 = "title: " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_2 = address of allocated object Int + + # Get method out_string of Book + lw $t0, 96($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 84($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 80($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 92($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute title of self + lw $t0, 96($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'title' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8728344733139 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8728344733139 + j object_get_attribute_8728344733139 + int_get_attribute_8728344733139: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 76($sp) # internal_4 = self.title + j end_get_attribute_8728344733139 + bool_get_attribute_8728344733139: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 76($sp) # internal_4 = self.title + j end_get_attribute_8728344733139 + object_get_attribute_8728344733139: + sw $t1, 76($sp) # internal_4 = self.title + end_get_attribute_8728344733139: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_6 = address of allocated object Int + + # Get method out_string of Book + lw $t0, 88($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 68($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 64($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_4 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function internal_7 + lw $t0, 76($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_5 = result of internal_7 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_8[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 60($sp) # internal_8 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_10 = address of allocated object Int + + # Get method out_string of Book + lw $t0, 72($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 52($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 48($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_5 + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing internal_5 + + # Argument internal_8 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function internal_11 + lw $t0, 60($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_9 = result of internal_11 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 21 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 97 + sb $t0, 8($v0) # internal_12[0] = 'a' + + addi $t0, $zero, 117 + sb $t0, 9($v0) # internal_12[1] = 'u' + + addi $t0, $zero, 116 + sb $t0, 10($v0) # internal_12[2] = 't' + + addi $t0, $zero, 104 + sb $t0, 11($v0) # internal_12[3] = 'h' + + addi $t0, $zero, 111 + sb $t0, 12($v0) # internal_12[4] = 'o' + + addi $t0, $zero, 114 + sb $t0, 13($v0) # internal_12[5] = 'r' + + addi $t0, $zero, 58 + sb $t0, 14($v0) # internal_12[6] = ':' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_12[7] = ' ' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_12[8] = ' ' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_12[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_12[10] = ' ' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_12[11] = ' ' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 44($sp) # internal_12 = "author: " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_14 = address of allocated object Int + + # Get method out_string of Book + lw $t0, 96($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 36($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 32($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_12 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function internal_15 + lw $t0, 44($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_13 = result of internal_15 + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute author of self + lw $t0, 96($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'author' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8728344734347 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8728344734347 + j object_get_attribute_8728344734347 + int_get_attribute_8728344734347: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_16 = self.author + j end_get_attribute_8728344734347 + bool_get_attribute_8728344734347: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_16 = self.author + j end_get_attribute_8728344734347 + object_get_attribute_8728344734347: + sw $t1, 28($sp) # internal_16 = self.author + end_get_attribute_8728344734347: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_18 = address of allocated object Int + + # Get method out_string of Book + lw $t0, 40($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_13 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_13 + + # Argument internal_16 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function internal_19 + lw $t0, 28($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_17 = result of internal_19 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_20[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_20 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_22 = address of allocated object Int + + # Get method out_string of Book + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_17 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_17 + + # Argument internal_20 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function internal_23 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_21 = result of internal_23 + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 96($sp) + + # Freeing space for local variables + addi $sp, $sp, 96 + + jr $ra + + function___init___at_Article: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_0 = "" + + # Set attribute title of self + lw $t0, 12($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8728344734458 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8728344734458 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8728344734458 + j object_set_attribute_8728344734458 + int_set_attribute_8728344734458: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.title = internal_0 + j end_set_attribute_8728344734458 + bool_set_attribute_8728344734458: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.title = internal_0 + j end_set_attribute_8728344734458 + object_set_attribute_8728344734458: + sw $t1, 8($t0) # self.title = internal_0 + end_set_attribute_8728344734458: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_1 = "" + + # Set attribute author of self + lw $t0, 12($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8728344732441 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8728344732441 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8728344732441 + j object_set_attribute_8728344732441 + int_set_attribute_8728344732441: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.author = internal_1 + j end_set_attribute_8728344732441 + bool_set_attribute_8728344732441: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.author = internal_1 + j end_set_attribute_8728344732441 + object_set_attribute_8728344732441: + sw $t1, 12($t0) # self.author = internal_1 + end_set_attribute_8728344732441: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_2 = "" + + # Set attribute per_title of self + lw $t0, 12($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_2 + beq $t1, $zero, object_set_attribute_8728344732462 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8728344732462 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8728344732462 + j object_set_attribute_8728344732462 + int_set_attribute_8728344732462: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.per_title = internal_2 + j end_set_attribute_8728344732462 + bool_set_attribute_8728344732462: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.per_title = internal_2 + j end_set_attribute_8728344732462 + object_set_attribute_8728344732462: + sw $t1, 16($t0) # self.per_title = internal_2 + end_set_attribute_8728344732462: + + # Loading return value in $v1 + lw $v1, 12($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + function_initArticle_at_Article: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + # title_p = 20($sp) + # author_p = 16($sp) + # per_title_p = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + # Get method initBook of Article + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument self + lw $t0, 40($sp) + sw $t0, 8($sp) # Storing self + + # Argument title_p + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing title_p + + # Argument author_p + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing author_p + + # Calling function internal_2 + lw $t0, 16($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 24($sp) # internal_0 = result of internal_2 + addi $sp, $sp, 16 # Freeing space for arguments + + # Set attribute per_title of self + lw $t0, 24($sp) # $t0 = self + lw $t1, 12($sp) # $t1 = per_title_p + beq $t1, $zero, object_set_attribute_8728344732573 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8728344732573 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8728344732573 + j object_set_attribute_8728344732573 + int_set_attribute_8728344732573: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.per_title = per_title_p + j end_set_attribute_8728344732573 + bool_set_attribute_8728344732573: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.per_title = per_title_p + j end_set_attribute_8728344732573 + object_set_attribute_8728344732573: + sw $t1, 16($t0) # self.per_title = per_title_p + end_set_attribute_8728344732573: + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + function_print_at_Article: + # Function parameters + # $ra = 64($sp) + # self = 60($sp) + + # Reserving space for local variables + addi $sp, $sp, -60 + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_1 = address of allocated object Int + + # Get method print of Book + lw $t0, 60($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 52($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 48($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_print_at_Book + jal function_print_at_Book + lw $ra, 4($sp) + sw $v1, 64($sp) # internal_0 = result of function_print_at_Book + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 22 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 22 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 112 + sb $t0, 8($v0) # internal_3[0] = 'p' + + addi $t0, $zero, 101 + sb $t0, 9($v0) # internal_3[1] = 'e' + + addi $t0, $zero, 114 + sb $t0, 10($v0) # internal_3[2] = 'r' + + addi $t0, $zero, 105 + sb $t0, 11($v0) # internal_3[3] = 'i' + + addi $t0, $zero, 111 + sb $t0, 12($v0) # internal_3[4] = 'o' + + addi $t0, $zero, 100 + sb $t0, 13($v0) # internal_3[5] = 'd' + + addi $t0, $zero, 105 + sb $t0, 14($v0) # internal_3[6] = 'i' + + addi $t0, $zero, 99 + sb $t0, 15($v0) # internal_3[7] = 'c' + + addi $t0, $zero, 97 + sb $t0, 16($v0) # internal_3[8] = 'a' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_3[9] = 'l' + + addi $t0, $zero, 58 + sb $t0, 18($v0) # internal_3[10] = ':' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_3[11] = ' ' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_3[12] = ' ' + + sb $zero, 21($v0) # Null-terminator at the end of the string + + sw $v0, 44($sp) # internal_3 = "periodical: " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_5 = address of allocated object Int + + # Get method out_string of Article + lw $t0, 60($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 36($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 32($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_3 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_6 + lw $t0, 44($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_4 = result of internal_6 + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute per_title of self + lw $t0, 60($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'per_title' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8728344703037 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8728344703037 + j object_get_attribute_8728344703037 + int_get_attribute_8728344703037: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_7 = self.per_title + j end_get_attribute_8728344703037 + bool_get_attribute_8728344703037: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_7 = self.per_title + j end_get_attribute_8728344703037 + object_get_attribute_8728344703037: + sw $t1, 28($sp) # internal_7 = self.per_title + end_get_attribute_8728344703037: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_9 = address of allocated object Int + + # Get method out_string of Article + lw $t0, 40($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument internal_7 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function internal_10 + lw $t0, 28($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_8 = result of internal_10 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_11[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_11 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_13 = address of allocated object Int + + # Get method out_string of Article + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_8 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument internal_11 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function internal_14 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_12 = result of internal_14 + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 60($sp) + + # Freeing space for local variables + addi $sp, $sp, 60 + + jr $ra + + function___init___at_BookList: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_isNil_at_BookList: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_1 = address of allocated object Int + + # Get method abort of BookList + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_2 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of internal_2 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_3 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_cons_at_BookList: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + # hd = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # Allocating Cons + li $v0, 9 + lw $a0, type_Cons + syscall + la $t0, type_Cons # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_1 = address of allocated object Cons + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_Cons + jal function___init___at_Cons + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_1 = result of function___init___at_Cons + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument new_cell + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing new_cell + + # Argument internal_1 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 28($sp) # new_cell = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_3 = address of allocated object Int + + # Get method init of Cons + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument new_cell + lw $t0, 32($sp) + sw $t0, 8($sp) # Storing new_cell + + # Argument hd + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing hd + + # Argument self + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_4 + lw $t0, 16($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 24($sp) # internal_2 = result of internal_4 + addi $sp, $sp, 16 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 20 + + jr $ra + + function_car_at_BookList: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_1 = address of allocated object Int + + # Get method abort of BookList + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_2 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of internal_2 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Book + li $v0, 9 + lw $a0, type_Book + syscall + la $t0, type_Book # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 0($sp) # internal_3 = address of allocated object Book + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_3 + lw $t0, 8($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function___init___at_Book + jal function___init___at_Book + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_3 = result of function___init___at_Book + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_cdr_at_BookList: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_1 = address of allocated object Int + + # Get method abort of BookList + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_2 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of internal_2 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating BookList + li $v0, 9 + lw $a0, type_BookList + syscall + la $t0, type_BookList # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 0($sp) # internal_3 = address of allocated object BookList + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_3 + lw $t0, 8($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function___init___at_BookList + jal function___init___at_BookList + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_3 = result of function___init___at_BookList + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_print_list_at_BookList: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + # Get method abort of BookList + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_2 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_0 = result of internal_2 + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + function___init___at_Cons: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating NUll to internal_0 + sw $zero, 4($sp) # internal_0 = 0 + + # Set attribute xcar of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8728344704645 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8728344704645 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8728344704645 + j object_set_attribute_8728344704645 + int_set_attribute_8728344704645: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.xcar = internal_0 + j end_set_attribute_8728344704645 + bool_set_attribute_8728344704645: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.xcar = internal_0 + j end_set_attribute_8728344704645 + object_set_attribute_8728344704645: + sw $t1, 8($t0) # self.xcar = internal_0 + end_set_attribute_8728344704645: + + # Allocating NUll to internal_1 + sw $zero, 0($sp) # internal_1 = 0 + + # Set attribute xcdr of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8728344704666 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8728344704666 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8728344704666 + j object_set_attribute_8728344704666 + int_set_attribute_8728344704666: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.xcdr = internal_1 + j end_set_attribute_8728344704666 + bool_set_attribute_8728344704666: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.xcdr = internal_1 + j end_set_attribute_8728344704666 + object_set_attribute_8728344704666: + sw $t1, 12($t0) # self.xcdr = internal_1 + end_set_attribute_8728344704666: + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_isNil_at_Cons: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_init_at_Cons: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # hd = 4($sp) + # tl = 0($sp) + + # Set attribute xcar of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = hd + beq $t1, $zero, object_set_attribute_8728344704747 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8728344704747 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8728344704747 + j object_set_attribute_8728344704747 + int_set_attribute_8728344704747: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.xcar = hd + j end_set_attribute_8728344704747 + bool_set_attribute_8728344704747: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.xcar = hd + j end_set_attribute_8728344704747 + object_set_attribute_8728344704747: + sw $t1, 8($t0) # self.xcar = hd + end_set_attribute_8728344704747: + + # Set attribute xcdr of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = tl + beq $t1, $zero, object_set_attribute_8728344704756 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8728344704756 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8728344704756 + j object_set_attribute_8728344704756 + int_set_attribute_8728344704756: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.xcdr = tl + j end_set_attribute_8728344704756 + bool_set_attribute_8728344704756: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.xcdr = tl + j end_set_attribute_8728344704756 + object_set_attribute_8728344704756: + sw $t1, 12($t0) # self.xcdr = tl + end_set_attribute_8728344704756: + + # Loading return value in $v1 + lw $v1, 8($sp) + + jr $ra + + function_car_at_Cons: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute xcar of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8728344705028 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8728344705028 + j object_get_attribute_8728344705028 + int_get_attribute_8728344705028: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.xcar + j end_get_attribute_8728344705028 + bool_get_attribute_8728344705028: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.xcar + j end_get_attribute_8728344705028 + object_get_attribute_8728344705028: + sw $t1, 0($sp) # internal_0 = self.xcar + end_get_attribute_8728344705028: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_cdr_at_Cons: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute xcdr of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'xcdr' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8728344705058 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8728344705058 + j object_get_attribute_8728344705058 + int_get_attribute_8728344705058: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.xcdr + j end_get_attribute_8728344705058 + bool_get_attribute_8728344705058: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.xcdr + j end_get_attribute_8728344705058 + object_get_attribute_8728344705058: + sw $t1, 0($sp) # internal_0 = self.xcdr + end_get_attribute_8728344705058: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_print_list_at_Cons: + # Function parameters + # $ra = 224($sp) + # self = 220($sp) + + # Reserving space for local variables + addi $sp, $sp, -220 + + # Get attribute xcar of self + lw $t0, 220($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8728344705130 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8728344705130 + j object_get_attribute_8728344705130 + int_get_attribute_8728344705130: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 216($sp) # internal_0 = self.xcar + j end_get_attribute_8728344705130 + bool_get_attribute_8728344705130: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 216($sp) # internal_0 = self.xcar + j end_get_attribute_8728344705130 + object_get_attribute_8728344705130: + sw $t1, 216($sp) # internal_0 = self.xcar + end_get_attribute_8728344705130: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 208($sp) # internal_2 = address of allocated object Int + + # Get method print of Book + lw $t0, 216($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 208($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 204($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 224($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 212($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 220($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 200($sp) # internal_4 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 196($sp) # internal_5 = address of allocated object Int + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 192($sp) # internal_6 = address of allocated object Int + + # Allocating NUll to internal_7 + sw $zero, 188($sp) # internal_7 = 0 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 184($sp) # internal_8 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 172($sp) # internal_11 = address of allocated object Int + + # internal_9 = typeof internal_1 that is the first word of the object + lw $t0, 212($sp) + lw $t0, 0($t0) + sw $t0, 180($sp) + + # internal_10 = internal_9 + lw $t0, 180($sp) + sw $t0, 176($sp) + + while_start_8728344748960: + + # internal_11 = EqualAddress(internal_10, internal_7) + lw $t0, 176($sp) + lw $t1, 188($sp) + seq $t2, $t0, $t1 + lw $t0, 172($sp) + sw $t2, 8($t0) + + # If internal_11 then goto while_end_8728344748960 + lw $t0, 172($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8728344748960 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_8 + lw $t0, 196($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument internal_5 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 196($sp) # internal_8 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_10 = ancestor of internal_10 + lw $t0, 176($sp) + lw $t0, 4($t0) + sw $t0, 176($sp) + + # Jumping to while_start_8728344748960 + j while_start_8728344748960 + + while_end_8728344748960: + + # internal_10 = internal_9 + lw $t0, 180($sp) + sw $t0, 176($sp) + + # initialize Array [internal_8] + lw $t0, 184($sp) # $t0 = internal_8 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 168($sp) # internal_12 = new Array[internal_8] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 164($sp) # internal_13 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_14 = address of allocated object Int + + foreach_start_8728344748960: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_13 + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing internal_13 + + # Argument internal_8 + lw $t0, 196($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 172($sp) # internal_14 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_14 then goto foreach_body_8728344748960 + lw $t0, 160($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8728344748960 + + # Jumping to foreach_end_8728344748960 + j foreach_end_8728344748960 + + foreach_body_8728344748960: + + # array internal_12[4 * internal_13] = internal_10 + lw $t0, 164($sp) # $t0 = internal_13 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 168($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 176($sp) + sw $t0, 0($t1) + + # internal_10 = ancestor of internal_10 + lw $t0, 176($sp) + lw $t0, 4($t0) + sw $t0, 176($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_13 + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing internal_13 + + # Argument internal_5 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 176($sp) # internal_13 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_start_8728344748960 + j foreach_start_8728344748960 + + foreach_end_8728344748960: + + # initialize Array [internal_6] + lw $t0, 192($sp) # $t0 = internal_6 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 156($sp) # internal_15 = new Array[internal_6] + + # initialize Array [internal_6] + lw $t0, 192($sp) # $t0 = internal_6 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 152($sp) # internal_16 = new Array[internal_6] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_18 = address of allocated object Int + + # internal_17 = direction of Book + la $t0, type_Book + sw $t0, 148($sp) + + # array internal_15[4 * internal_18] = internal_17 + lw $t0, 144($sp) # $t0 = internal_18 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 156($sp) # $t1 = internal_15 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 148($sp) + sw $t0, 0($t1) + + # array internal_16[4 * internal_18] = internal_8 + lw $t0, 144($sp) # $t0 = internal_18 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 152($sp) # $t1 = internal_16 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 184($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_20 = address of allocated object Int + + # internal_19 = direction of Article + la $t0, type_Article + sw $t0, 140($sp) + + # array internal_15[4 * internal_20] = internal_19 + lw $t0, 136($sp) # $t0 = internal_20 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 156($sp) # $t1 = internal_15 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 140($sp) + sw $t0, 0($t1) + + # array internal_16[4 * internal_20] = internal_8 + lw $t0, 136($sp) # $t0 = internal_20 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 152($sp) # $t1 = internal_16 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 184($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 132($sp) # internal_21 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_22 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_24 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 116($sp) # internal_25 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_27 = address of allocated object Int + + foreach_type_start_8728344748960: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_21 + lw $t0, 144($sp) + sw $t0, 4($sp) # Storing internal_21 + + # Argument internal_6 + lw $t0, 204($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 140($sp) # internal_22 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_22 then goto foreach_type_body_8728344748960 + lw $t0, 128($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8728344748960 + + # Jumping to foreach_type_end_8728344748960 + j foreach_type_end_8728344748960 + + foreach_type_body_8728344748960: + + # internal_23 = array internal_15[4 * internal_21] + lw $t0, 132($sp) # $t0 = internal_21 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 156($sp) # $t1 = internal_15 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 124($sp) # internal_23 = array internal_15[4 * internal_21] + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_24 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_24 + + # Argument internal_4 + lw $t0, 212($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 132($sp) # internal_24 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_ancestor_start_8728344748960: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_24 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_24 + + # Argument internal_8 + lw $t0, 196($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 128($sp) # internal_25 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_25 then goto foreach_ancestor_body_8728344748960 + lw $t0, 116($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8728344748960 + + # Jumping to foreach_ancestor_end_8728344748960 + j foreach_ancestor_end_8728344748960 + + foreach_ancestor_body_8728344748960: + + # internal_26 = array internal_12[4 * internal_24] + lw $t0, 120($sp) # $t0 = internal_24 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 168($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 112($sp) # internal_26 = array internal_12[4 * internal_24] + + # internal_27 = EqualAddress(internal_23, internal_26) + lw $t0, 124($sp) + lw $t1, 112($sp) + seq $t2, $t0, $t1 + lw $t0, 108($sp) + sw $t2, 8($t0) + + # If internal_27 then goto foreach_ancestor_end_8728344748960 + lw $t0, 108($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8728344748960 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_24 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_24 + + # Argument internal_5 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 132($sp) # internal_24 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_ancestor_start_8728344748960 + j foreach_ancestor_start_8728344748960 + + foreach_ancestor_end_8728344748960: + + # array internal_16[4 * internal_21] = internal_24 + lw $t0, 132($sp) # $t0 = internal_21 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 152($sp) # $t1 = internal_16 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 120($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_21 + lw $t0, 144($sp) + sw $t0, 4($sp) # Storing internal_21 + + # Argument internal_5 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 144($sp) # internal_21 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_type_start_8728344748960 + j foreach_type_start_8728344748960 + + foreach_type_end_8728344748960: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_28 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_29 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_30 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 92($sp) # internal_31 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_32 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_31 + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing internal_31 + + # Argument internal_8 + lw $t0, 196($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 104($sp) # internal_31 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_min_start_8728344748960: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_28 + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing internal_28 + + # Argument internal_6 + lw $t0, 204($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_32 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_32 then goto foreach_min_body_8728344748960 + lw $t0, 88($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8728344748960 + + # Jumping to foreach_min_end_8728344748960 + j foreach_min_end_8728344748960 + + foreach_min_body_8728344748960: + + # internal_30 = array internal_16[4 * internal_28] + lw $t0, 104($sp) # $t0 = internal_28 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 152($sp) # $t1 = internal_16 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 96($sp) # internal_30 = array internal_16[4 * internal_28] + sw $t0, 8($t2) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_30 + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing internal_30 + + # Argument internal_31 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_31 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_32 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_32 then goto update_min_8728344748960 + lw $t0, 88($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8728344748960 + + # Jumping to update_min_end_8728344748960 + j update_min_end_8728344748960 + + update_min_8728344748960: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_31 + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing internal_31 + + # Argument internal_30 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_30 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 104($sp) # internal_31 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_29 + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing internal_29 + + # Argument internal_28 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_28 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 112($sp) # internal_29 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + update_min_end_8728344748960: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_28 + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing internal_28 + + # Argument internal_5 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 116($sp) # internal_28 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_min_start_8728344748960 + j foreach_min_start_8728344748960 + + foreach_min_end_8728344748960: + + # initialize Array [internal_6] + lw $t0, 192($sp) # $t0 = internal_6 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 84($sp) # internal_33 = new Array[internal_6] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_34 = address of allocated object Int + + # array internal_33[4 * internal_34] = internal_4 + lw $t0, 80($sp) # $t0 = internal_34 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 84($sp) # $t1 = internal_33 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 200($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_35 = address of allocated object Int + + # array internal_33[4 * internal_35] = internal_4 + lw $t0, 76($sp) # $t0 = internal_35 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 84($sp) # $t1 = internal_33 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 200($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_36 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_31 + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing internal_31 + + # Argument internal_8 + lw $t0, 196($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_36 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_36 then goto error_branch_8728344748960 + lw $t0, 72($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8728344748960 + + # array internal_33[4 * internal_29] = internal_5 + lw $t0, 100($sp) # $t0 = internal_29 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 84($sp) # $t1 = internal_33 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 196($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_37 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_38 = address of allocated object Int + + # internal_37 = array internal_33[4 * internal_38] + lw $t0, 64($sp) # $t0 = internal_38 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 84($sp) # $t1 = internal_33 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 68($sp) # internal_37 = array internal_33[4 * internal_38] + sw $t0, 8($t2) + + # If internal_37 then goto branch_Book_8728344748960 + lw $t0, 68($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Book_8728344748960 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_39 = address of allocated object Int + + # internal_37 = array internal_33[4 * internal_39] + lw $t0, 60($sp) # $t0 = internal_39 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 84($sp) # $t1 = internal_33 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 68($sp) # internal_37 = array internal_33[4 * internal_39] + sw $t0, 8($t2) + + # If internal_37 then goto branch_Article_8728344748960 + lw $t0, 68($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Article_8728344748960 + + branch_Book_8728344748960: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument dummy + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing dummy + + # Argument internal_1 + lw $t0, 224($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 64($sp) # dummy = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 35 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 35 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 45 + sb $t0, 8($v0) # internal_42[0] = '-' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_42[1] = ' ' + + addi $t0, $zero, 100 + sb $t0, 10($v0) # internal_42[2] = 'd' + + addi $t0, $zero, 121 + sb $t0, 11($v0) # internal_42[3] = 'y' + + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_42[4] = 'n' + + addi $t0, $zero, 97 + sb $t0, 13($v0) # internal_42[5] = 'a' + + addi $t0, $zero, 109 + sb $t0, 14($v0) # internal_42[6] = 'm' + + addi $t0, $zero, 105 + sb $t0, 15($v0) # internal_42[7] = 'i' + + addi $t0, $zero, 99 + sb $t0, 16($v0) # internal_42[8] = 'c' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_42[9] = ' ' + + addi $t0, $zero, 116 + sb $t0, 18($v0) # internal_42[10] = 't' + + addi $t0, $zero, 121 + sb $t0, 19($v0) # internal_42[11] = 'y' + + addi $t0, $zero, 112 + sb $t0, 20($v0) # internal_42[12] = 'p' + + addi $t0, $zero, 101 + sb $t0, 21($v0) # internal_42[13] = 'e' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_42[14] = ' ' + + addi $t0, $zero, 119 + sb $t0, 23($v0) # internal_42[15] = 'w' + + addi $t0, $zero, 97 + sb $t0, 24($v0) # internal_42[16] = 'a' + + addi $t0, $zero, 115 + sb $t0, 25($v0) # internal_42[17] = 's' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_42[18] = ' ' + + addi $t0, $zero, 66 + sb $t0, 27($v0) # internal_42[19] = 'B' + + addi $t0, $zero, 111 + sb $t0, 28($v0) # internal_42[20] = 'o' + + addi $t0, $zero, 111 + sb $t0, 29($v0) # internal_42[21] = 'o' + + addi $t0, $zero, 107 + sb $t0, 30($v0) # internal_42[22] = 'k' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_42[23] = ' ' + + addi $t0, $zero, 45 + sb $t0, 32($v0) # internal_42[24] = '-' + + addi $t0, $zero, 10 + sb $t0, 33($v0) # internal_42[25] = '\n' + + sb $zero, 34($v0) # Null-terminator at the end of the string + + sw $v0, 48($sp) # internal_42 = "- dynamic type was Book -\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_44 = address of allocated object Int + + # Get method out_string of Cons + lw $t0, 220($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 40($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 36($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 232($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_42 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_42 + + # Calling function internal_45 + lw $t0, 48($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 56($sp) # internal_43 = result of internal_45 + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_40 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_40 + + # Argument internal_43 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_43 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_40 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_40 = internal_43 + lw $t0, 44($sp) + sw $t0, 56($sp) + + # Jumping to branch_end_8728344748960 + j branch_end_8728344748960 + + branch_Article_8728344748960: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument dummy + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing dummy + + # Argument internal_1 + lw $t0, 224($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 64($sp) # dummy = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 38 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 38 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 45 + sb $t0, 8($v0) # internal_47[0] = '-' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_47[1] = ' ' + + addi $t0, $zero, 100 + sb $t0, 10($v0) # internal_47[2] = 'd' + + addi $t0, $zero, 121 + sb $t0, 11($v0) # internal_47[3] = 'y' + + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_47[4] = 'n' + + addi $t0, $zero, 97 + sb $t0, 13($v0) # internal_47[5] = 'a' + + addi $t0, $zero, 109 + sb $t0, 14($v0) # internal_47[6] = 'm' + + addi $t0, $zero, 105 + sb $t0, 15($v0) # internal_47[7] = 'i' + + addi $t0, $zero, 99 + sb $t0, 16($v0) # internal_47[8] = 'c' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_47[9] = ' ' + + addi $t0, $zero, 116 + sb $t0, 18($v0) # internal_47[10] = 't' + + addi $t0, $zero, 121 + sb $t0, 19($v0) # internal_47[11] = 'y' + + addi $t0, $zero, 112 + sb $t0, 20($v0) # internal_47[12] = 'p' + + addi $t0, $zero, 101 + sb $t0, 21($v0) # internal_47[13] = 'e' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_47[14] = ' ' + + addi $t0, $zero, 119 + sb $t0, 23($v0) # internal_47[15] = 'w' + + addi $t0, $zero, 97 + sb $t0, 24($v0) # internal_47[16] = 'a' + + addi $t0, $zero, 115 + sb $t0, 25($v0) # internal_47[17] = 's' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_47[18] = ' ' + + addi $t0, $zero, 65 + sb $t0, 27($v0) # internal_47[19] = 'A' + + addi $t0, $zero, 114 + sb $t0, 28($v0) # internal_47[20] = 'r' + + addi $t0, $zero, 116 + sb $t0, 29($v0) # internal_47[21] = 't' + + addi $t0, $zero, 105 + sb $t0, 30($v0) # internal_47[22] = 'i' + + addi $t0, $zero, 99 + sb $t0, 31($v0) # internal_47[23] = 'c' + + addi $t0, $zero, 108 + sb $t0, 32($v0) # internal_47[24] = 'l' + + addi $t0, $zero, 101 + sb $t0, 33($v0) # internal_47[25] = 'e' + + addi $t0, $zero, 32 + sb $t0, 34($v0) # internal_47[26] = ' ' + + addi $t0, $zero, 45 + sb $t0, 35($v0) # internal_47[27] = '-' + + addi $t0, $zero, 10 + sb $t0, 36($v0) # internal_47[28] = '\n' + + sb $zero, 37($v0) # Null-terminator at the end of the string + + sw $v0, 28($sp) # internal_47 = "- dynamic type was Article -\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_49 = address of allocated object Int + + # Get method out_string of Cons + lw $t0, 220($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 232($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_47 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_47 + + # Calling function internal_50 + lw $t0, 28($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_48 = result of internal_50 + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_40 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_40 + + # Argument internal_48 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_48 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_40 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_40 = internal_48 + lw $t0, 24($sp) + sw $t0, 56($sp) + + # Jumping to branch_end_8728344748960 + j branch_end_8728344748960 + + error_branch_8728344748960: + + branch_end_8728344748960: + + # Get attribute xcdr of self + lw $t0, 220($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'xcdr' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8728344708774 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8728344708774 + j object_get_attribute_8728344708774 + int_get_attribute_8728344708774: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_51 = self.xcdr + j end_get_attribute_8728344708774 + bool_get_attribute_8728344708774: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_51 = self.xcdr + j end_get_attribute_8728344708774 + object_get_attribute_8728344708774: + sw $t1, 12($sp) # internal_51 = self.xcdr + end_get_attribute_8728344708774: + + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_53 = address of allocated object Int + + # Get method print_list of BookList + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_51 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_51 + + # Calling function internal_54 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_52 = result of internal_54 + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 220 + + jr $ra + + function___init___at_Nil: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_isNil_at_Nil: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_print_list_at_Nil: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating NUll to internal_0 + sw $zero, 0($sp) # internal_0 = 0 + + # Set attribute books of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8728344709184 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8728344709184 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8728344709184 + j object_set_attribute_8728344709184 + int_set_attribute_8728344709184: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.books = internal_0 + j end_set_attribute_8728344709184 + bool_set_attribute_8728344709184: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.books = internal_0 + j end_set_attribute_8728344709184 + object_set_attribute_8728344709184: + sw $t1, 8($t0) # self.books = internal_0 + end_set_attribute_8728344709184: + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 108($sp) + # self = 104($sp) + + # Reserving space for local variables + addi $sp, $sp, -104 + + # Allocating Book + li $v0, 9 + lw $a0, type_Book + syscall + la $t0, type_Book # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 96($sp) # internal_1 = address of allocated object Book + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_Book + jal function___init___at_Book + lw $ra, 4($sp) + sw $v1, 104($sp) # internal_1 = result of function___init___at_Book + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 53 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 53 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_2[0] = 'C' + + addi $t0, $zero, 111 + sb $t0, 9($v0) # internal_2[1] = 'o' + + addi $t0, $zero, 109 + sb $t0, 10($v0) # internal_2[2] = 'm' + + addi $t0, $zero, 112 + sb $t0, 11($v0) # internal_2[3] = 'p' + + addi $t0, $zero, 105 + sb $t0, 12($v0) # internal_2[4] = 'i' + + addi $t0, $zero, 108 + sb $t0, 13($v0) # internal_2[5] = 'l' + + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_2[6] = 'e' + + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_2[7] = 'r' + + addi $t0, $zero, 115 + sb $t0, 16($v0) # internal_2[8] = 's' + + addi $t0, $zero, 44 + sb $t0, 17($v0) # internal_2[9] = ',' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_2[10] = ' ' + + addi $t0, $zero, 80 + sb $t0, 19($v0) # internal_2[11] = 'P' + + addi $t0, $zero, 114 + sb $t0, 20($v0) # internal_2[12] = 'r' + + addi $t0, $zero, 105 + sb $t0, 21($v0) # internal_2[13] = 'i' + + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_2[14] = 'n' + + addi $t0, $zero, 99 + sb $t0, 23($v0) # internal_2[15] = 'c' + + addi $t0, $zero, 105 + sb $t0, 24($v0) # internal_2[16] = 'i' + + addi $t0, $zero, 112 + sb $t0, 25($v0) # internal_2[17] = 'p' + + addi $t0, $zero, 108 + sb $t0, 26($v0) # internal_2[18] = 'l' + + addi $t0, $zero, 101 + sb $t0, 27($v0) # internal_2[19] = 'e' + + addi $t0, $zero, 115 + sb $t0, 28($v0) # internal_2[20] = 's' + + addi $t0, $zero, 44 + sb $t0, 29($v0) # internal_2[21] = ',' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_2[22] = ' ' + + addi $t0, $zero, 84 + sb $t0, 31($v0) # internal_2[23] = 'T' + + addi $t0, $zero, 101 + sb $t0, 32($v0) # internal_2[24] = 'e' + + addi $t0, $zero, 99 + sb $t0, 33($v0) # internal_2[25] = 'c' + + addi $t0, $zero, 104 + sb $t0, 34($v0) # internal_2[26] = 'h' + + addi $t0, $zero, 110 + sb $t0, 35($v0) # internal_2[27] = 'n' + + addi $t0, $zero, 105 + sb $t0, 36($v0) # internal_2[28] = 'i' + + addi $t0, $zero, 113 + sb $t0, 37($v0) # internal_2[29] = 'q' + + addi $t0, $zero, 117 + sb $t0, 38($v0) # internal_2[30] = 'u' + + addi $t0, $zero, 101 + sb $t0, 39($v0) # internal_2[31] = 'e' + + addi $t0, $zero, 115 + sb $t0, 40($v0) # internal_2[32] = 's' + + addi $t0, $zero, 44 + sb $t0, 41($v0) # internal_2[33] = ',' + + addi $t0, $zero, 32 + sb $t0, 42($v0) # internal_2[34] = ' ' + + addi $t0, $zero, 97 + sb $t0, 43($v0) # internal_2[35] = 'a' + + addi $t0, $zero, 110 + sb $t0, 44($v0) # internal_2[36] = 'n' + + addi $t0, $zero, 100 + sb $t0, 45($v0) # internal_2[37] = 'd' + + addi $t0, $zero, 32 + sb $t0, 46($v0) # internal_2[38] = ' ' + + addi $t0, $zero, 84 + sb $t0, 47($v0) # internal_2[39] = 'T' + + addi $t0, $zero, 111 + sb $t0, 48($v0) # internal_2[40] = 'o' + + addi $t0, $zero, 111 + sb $t0, 49($v0) # internal_2[41] = 'o' + + addi $t0, $zero, 108 + sb $t0, 50($v0) # internal_2[42] = 'l' + + addi $t0, $zero, 115 + sb $t0, 51($v0) # internal_2[43] = 's' + + sb $zero, 52($v0) # Null-terminator at the end of the string + + sw $v0, 92($sp) # internal_2 = "Compilers, Principles, Techniques, and Tools" + + # Allocating String + li $v0, 9 + addi $a0, $zero, 31 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 31 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_3[0] = 'A' + + addi $t0, $zero, 104 + sb $t0, 9($v0) # internal_3[1] = 'h' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_3[2] = 'o' + + addi $t0, $zero, 44 + sb $t0, 11($v0) # internal_3[3] = ',' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_3[4] = ' ' + + addi $t0, $zero, 83 + sb $t0, 13($v0) # internal_3[5] = 'S' + + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_3[6] = 'e' + + addi $t0, $zero, 116 + sb $t0, 15($v0) # internal_3[7] = 't' + + addi $t0, $zero, 104 + sb $t0, 16($v0) # internal_3[8] = 'h' + + addi $t0, $zero, 105 + sb $t0, 17($v0) # internal_3[9] = 'i' + + addi $t0, $zero, 44 + sb $t0, 18($v0) # internal_3[10] = ',' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_3[11] = ' ' + + addi $t0, $zero, 97 + sb $t0, 20($v0) # internal_3[12] = 'a' + + addi $t0, $zero, 110 + sb $t0, 21($v0) # internal_3[13] = 'n' + + addi $t0, $zero, 100 + sb $t0, 22($v0) # internal_3[14] = 'd' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_3[15] = ' ' + + addi $t0, $zero, 85 + sb $t0, 24($v0) # internal_3[16] = 'U' + + addi $t0, $zero, 108 + sb $t0, 25($v0) # internal_3[17] = 'l' + + addi $t0, $zero, 108 + sb $t0, 26($v0) # internal_3[18] = 'l' + + addi $t0, $zero, 109 + sb $t0, 27($v0) # internal_3[19] = 'm' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_3[20] = 'a' + + addi $t0, $zero, 110 + sb $t0, 29($v0) # internal_3[21] = 'n' + + sb $zero, 30($v0) # Null-terminator at the end of the string + + sw $v0, 88($sp) # internal_3 = "Aho, Sethi, and Ullman" + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_5 = address of allocated object Int + + # Get method initBook of Book + lw $t0, 96($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 80($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 76($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_1 + lw $t0, 112($sp) + sw $t0, 8($sp) # Storing internal_1 + + # Argument internal_2 + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_6 + lw $t0, 92($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 100($sp) # internal_4 = result of internal_6 + addi $sp, $sp, 16 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument a_book + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing a_book + + # Argument internal_4 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 112($sp) # a_book = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Article + li $v0, 9 + lw $a0, type_Article + syscall + la $t0, type_Article # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 68($sp) # internal_8 = address of allocated object Article + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_8 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function___init___at_Article + jal function___init___at_Article + lw $ra, 4($sp) + sw $v1, 76($sp) # internal_8 = result of function___init___at_Article + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 28 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 28 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 84 + sb $t0, 8($v0) # internal_9[0] = 'T' + + addi $t0, $zero, 104 + sb $t0, 9($v0) # internal_9[1] = 'h' + + addi $t0, $zero, 101 + sb $t0, 10($v0) # internal_9[2] = 'e' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_9[3] = ' ' + + addi $t0, $zero, 84 + sb $t0, 12($v0) # internal_9[4] = 'T' + + addi $t0, $zero, 111 + sb $t0, 13($v0) # internal_9[5] = 'o' + + addi $t0, $zero, 112 + sb $t0, 14($v0) # internal_9[6] = 'p' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_9[7] = ' ' + + addi $t0, $zero, 49 + sb $t0, 16($v0) # internal_9[8] = '1' + + addi $t0, $zero, 48 + sb $t0, 17($v0) # internal_9[9] = '0' + + addi $t0, $zero, 48 + sb $t0, 18($v0) # internal_9[10] = '0' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_9[11] = ' ' + + addi $t0, $zero, 67 + sb $t0, 20($v0) # internal_9[12] = 'C' + + addi $t0, $zero, 68 + sb $t0, 21($v0) # internal_9[13] = 'D' + + addi $t0, $zero, 95 + sb $t0, 22($v0) # internal_9[14] = '_' + + addi $t0, $zero, 82 + sb $t0, 23($v0) # internal_9[15] = 'R' + + addi $t0, $zero, 79 + sb $t0, 24($v0) # internal_9[16] = 'O' + + addi $t0, $zero, 77 + sb $t0, 25($v0) # internal_9[17] = 'M' + + addi $t0, $zero, 115 + sb $t0, 26($v0) # internal_9[18] = 's' + + sb $zero, 27($v0) # Null-terminator at the end of the string + + sw $v0, 64($sp) # internal_9 = "The Top 100 CD_ROMs" + + # Allocating String + li $v0, 9 + addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 16 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 85 + sb $t0, 8($v0) # internal_10[0] = 'U' + + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_10[1] = 'l' + + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_10[2] = 'a' + + addi $t0, $zero, 110 + sb $t0, 11($v0) # internal_10[3] = 'n' + + addi $t0, $zero, 111 + sb $t0, 12($v0) # internal_10[4] = 'o' + + addi $t0, $zero, 102 + sb $t0, 13($v0) # internal_10[5] = 'f' + + addi $t0, $zero, 102 + sb $t0, 14($v0) # internal_10[6] = 'f' + + sb $zero, 15($v0) # Null-terminator at the end of the string + + sw $v0, 60($sp) # internal_10 = "Ulanoff" + + # Allocating String + li $v0, 9 + addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 20 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 80 + sb $t0, 8($v0) # internal_11[0] = 'P' + + addi $t0, $zero, 67 + sb $t0, 9($v0) # internal_11[1] = 'C' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_11[2] = ' ' + + addi $t0, $zero, 77 + sb $t0, 11($v0) # internal_11[3] = 'M' + + addi $t0, $zero, 97 + sb $t0, 12($v0) # internal_11[4] = 'a' + + addi $t0, $zero, 103 + sb $t0, 13($v0) # internal_11[5] = 'g' + + addi $t0, $zero, 97 + sb $t0, 14($v0) # internal_11[6] = 'a' + + addi $t0, $zero, 122 + sb $t0, 15($v0) # internal_11[7] = 'z' + + addi $t0, $zero, 105 + sb $t0, 16($v0) # internal_11[8] = 'i' + + addi $t0, $zero, 110 + sb $t0, 17($v0) # internal_11[9] = 'n' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_11[10] = 'e' + + sb $zero, 19($v0) # Null-terminator at the end of the string + + sw $v0, 56($sp) # internal_11 = "PC Magazine" + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_13 = address of allocated object Int + + # Get method initArticle of Article + lw $t0, 68($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 48($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 44($sp) + + # Passing function arguments + addi $sp, $sp, -20 # Reserving space for arguments + sw $ra, 16($sp) # Storing return address + + # Argument internal_8 + lw $t0, 88($sp) + sw $t0, 12($sp) # Storing internal_8 + + # Argument internal_9 + lw $t0, 84($sp) + sw $t0, 8($sp) # Storing internal_9 + + # Argument internal_10 + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_11 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function internal_14 + lw $t0, 64($sp) + jalr $t0 + lw $ra, 16($sp) + sw $v1, 72($sp) # internal_12 = result of internal_14 + addi $sp, $sp, 20 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument an_article + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing an_article + + # Argument internal_12 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 84($sp) # an_article = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Nil + li $v0, 9 + lw $a0, type_Nil + syscall + la $t0, type_Nil # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 40($sp) # internal_15 = address of allocated object Nil + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_15 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function___init___at_Nil + jal function___init___at_Nil + lw $ra, 4($sp) + sw $v1, 48($sp) # internal_15 = result of function___init___at_Nil + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_17 = address of allocated object Int + + # Get method cons of Nil + lw $t0, 40($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 32($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 28($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_15 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_15 + + # Argument a_book + lw $t0, 112($sp) + sw $t0, 0($sp) # Storing a_book + + # Calling function internal_18 + lw $t0, 40($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_16 = result of internal_18 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_20 = address of allocated object Int + + # Get method cons of Cons + lw $t0, 36($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_16 + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing internal_16 + + # Argument an_article + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing an_article + + # Calling function internal_21 + lw $t0, 28($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_19 = result of internal_21 + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute books of self + lw $t0, 104($sp) # $t0 = self + lw $t1, 24($sp) # $t1 = internal_19 + beq $t1, $zero, object_set_attribute_8728344710051 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8728344710051 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8728344710051 + j object_set_attribute_8728344710051 + int_set_attribute_8728344710051: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.books = internal_19 + j end_set_attribute_8728344710051 + bool_set_attribute_8728344710051: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.books = internal_19 + j end_set_attribute_8728344710051 + object_set_attribute_8728344710051: + sw $t1, 8($t0) # self.books = internal_19 + end_set_attribute_8728344710051: + + # Get attribute books of self + lw $t0, 104($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'books' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8728344710708 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8728344710708 + j object_get_attribute_8728344710708 + int_get_attribute_8728344710708: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_22 = self.books + j end_get_attribute_8728344710708 + bool_get_attribute_8728344710708: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_22 = self.books + j end_get_attribute_8728344710708 + object_get_attribute_8728344710708: + sw $t1, 12($sp) # internal_22 = self.books + end_get_attribute_8728344710708: + + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_24 = address of allocated object Int + + # Get method print_list of BookList + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_22 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function internal_25 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_23 = result of internal_25 + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 104 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/cells.mips b/tests/codegen/cells.mips index c2d1d4546..f04830399 100644 --- a/tests/codegen/cells.mips +++ b/tests/codegen/cells.mips @@ -1,52 +1,100 @@ .data - type_Object: .word 8 + type_Object: .word 24 type_Object_inherits_from: .word 0 - type_Object_attributes: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_CellularAutomaton: .word 76 + type_CellularAutomaton_inherits_from: .word type_IO + type_CellularAutomaton_name_address: .word type_CellularAutomaton_name_size + type_CellularAutomaton___init__: .word function___init___at_CellularAutomaton + type_CellularAutomaton_abort: .word function_abort_at_Object + type_CellularAutomaton_type_name: .word function_type_name_at_Object + type_CellularAutomaton_copy: .word function_copy_at_Object + type_CellularAutomaton_out_string: .word function_out_string_at_IO + type_CellularAutomaton_out_int: .word function_out_int_at_IO + type_CellularAutomaton_in_string: .word function_in_string_at_IO + type_CellularAutomaton_in_int: .word function_in_int_at_IO + type_CellularAutomaton_init: .word function_init_at_CellularAutomaton + type_CellularAutomaton_print: .word function_print_at_CellularAutomaton + type_CellularAutomaton_num_cells: .word function_num_cells_at_CellularAutomaton + type_CellularAutomaton_cell: .word function_cell_at_CellularAutomaton + type_CellularAutomaton_cell_left_neighbor: .word function_cell_left_neighbor_at_CellularAutomaton + type_CellularAutomaton_cell_right_neighbor: .word function_cell_right_neighbor_at_CellularAutomaton + type_CellularAutomaton_cell_at_next_evolution: .word function_cell_at_next_evolution_at_CellularAutomaton + type_CellularAutomaton_evolve: .word function_evolve_at_CellularAutomaton + + type_Main: .word 32 + type_Main_inherits_from: .word type_Object + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_main: .word function_main_at_Main + type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" - type_Object_abort_message: .asciiz "Abort called from class Object\n" - type_IO: .word 8 - type_IO_inherits_from: .word type_Object - type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" - type_IO_abort_message: .asciiz "Abort called from class IO\n" - - type_Int: .word 8 - type_Int_inherits_from: .word type_Object - type_Int_attributes: .word 0 - type_Int_name_size: .word 3 - type_Int_name: .asciiz "Int" - type_Int_abort_message: .asciiz "Abort called from class Int\n" - type_String: .word 8 - type_String_inherits_from: .word type_Object - type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" - type_String_abort_message: .asciiz "Abort called from class String\n" - type_Bool: .word 8 - type_Bool_inherits_from: .word type_Object - type_Bool_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" - type_Bool_abort_message: .asciiz "Abort called from class Bool\n" - type_CellularAutomaton: .word 12 - type_CellularAutomaton_inherits_from: .word type_IO - type_CellularAutomaton_attributes: .word 1 type_CellularAutomaton_name_size: .word 17 type_CellularAutomaton_name: .asciiz "CellularAutomaton" - type_CellularAutomaton_abort_message: .asciiz "Abort called from class CellularAutomaton\n" - type_Main: .word 12 - type_Main_inherits_from: .word type_Object - type_Main_attributes: .word 1 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" - type_Main_abort_message: .asciiz "Abort called from class Main\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -707,11 +755,11 @@ function_abort_at_Object: # Function parameters - # $ra = 20($sp) - # self = 16($sp) + # $ra = 28($sp) + # self = 24($sp) # Reserving space for local variables - addi $sp, $sp, -16 + addi $sp, $sp, -24 # Allocating String li $v0, 9 @@ -798,7 +846,7 @@ sb $zero, 32($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_0 = "Abort called from class " + sw $v0, 20($sp) # internal_0 = "Abort called from class " # Allocating String li $v0, 9 @@ -812,66 +860,138 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_2[0] = '\n' + sb $t0, 8($v0) # internal_3[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_2 = "\n" + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 0($sp) # Storing self - # Calling function function_type_name_at_Object - jal function_type_name_at_Object + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + sw $v1, 24($sp) # internal_1 = result of internal_5 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_0 - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing internal_0 # Argument internal_1 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_1 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_3 - lw $t0, 12($sp) - sw $t0, 4($sp) # Storing internal_3 - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 - # Calling function function_concat_at_String - jal function_concat_at_String + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) # $t0 = internal_3 + lw $t0, 12($sp) # $t0 = internal_2 addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string internal_3 + # Printing the String internal_2 li $v0, 4 move $a0, $t0 syscall @@ -881,10 +1001,10 @@ syscall # Loading return value in $v1 - lw $v1, 16($sp) + lw $v1, 24($sp) # Freeing space for local variables - addi $sp, $sp, 16 + addi $sp, $sp, 24 jr $ra @@ -899,8 +1019,9 @@ # internal_0 = name of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($t0) # $t1 = type of self - lw $t2, 12($t1) # $t1 = length of the name of self - la $t3, 16($t1) # $t1 = name of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 @@ -1003,7 +1124,7 @@ lw $t0, 0($sp) # $t0 = x addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string x + # Printing the String x li $v0, 4 move $a0, $t0 syscall @@ -1019,7 +1140,7 @@ # self = 4($sp) # x = 0($sp) - # Printing the string x + # Printing the Int x li $v0, 1 lw $a0, 0($sp) lw $a0, 8($a0) @@ -1046,11 +1167,13 @@ xor $t0, $t0, $t0 # Initializing counter while_read_start: lb $t1, buffer_input($t0) # Loading the byte - beq $t1, $zero, while_read_end + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end addi $t0, $t0, 1 # Incrementing counter j while_read_start while_read_end: - addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 @@ -1297,6 +1420,26 @@ jr $ra + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + function___init___at_CellularAutomaton: # Function parameters # $ra = 8($sp) @@ -1323,17 +1466,17 @@ # Set attribute population_map of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8758890018919 + beq $t1, $zero, object_set_attribute_8754020047171 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8758890018919 + beq $t6, $t5, int_set_attribute_8754020047171 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8758890018919 - j object_set_attribute_8758890018919 - int_set_attribute_8758890018919: + beq $t6, $t5, bool_set_attribute_8754020047171 + j object_set_attribute_8754020047171 + int_set_attribute_8754020047171: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1342,8 +1485,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.population_map = internal_0 - j end_set_attribute_8758890018919 - bool_set_attribute_8758890018919: + j end_set_attribute_8754020047171 + bool_set_attribute_8754020047171: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1352,10 +1495,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.population_map = internal_0 - j end_set_attribute_8758890018919 - object_set_attribute_8758890018919: + j end_set_attribute_8754020047171 + object_set_attribute_8754020047171: sw $t1, 8($t0) # self.population_map = internal_0 - end_set_attribute_8758890018919: + end_set_attribute_8754020047171: # Loading return value in $v1 lw $v1, 4($sp) @@ -1374,17 +1517,17 @@ # Set attribute population_map of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($sp) # $t1 = map - beq $t1, $zero, object_set_attribute_8758890018964 + beq $t1, $zero, object_set_attribute_8754020047216 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8758890018964 + beq $t6, $t5, int_set_attribute_8754020047216 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8758890018964 - j object_set_attribute_8758890018964 - int_set_attribute_8758890018964: + beq $t6, $t5, bool_set_attribute_8754020047216 + j object_set_attribute_8754020047216 + int_set_attribute_8754020047216: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1393,8 +1536,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.population_map = map - j end_set_attribute_8758890018964 - bool_set_attribute_8758890018964: + j end_set_attribute_8754020047216 + bool_set_attribute_8754020047216: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1403,10 +1546,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.population_map = map - j end_set_attribute_8758890018964 - object_set_attribute_8758890018964: + j end_set_attribute_8754020047216 + object_set_attribute_8754020047216: sw $t1, 8($t0) # self.population_map = map - end_set_attribute_8758890018964: + end_set_attribute_8754020047216: # Loading return value in $v1 lw $v1, 4($sp) @@ -1415,25 +1558,25 @@ function_print_at_CellularAutomaton: # Function parameters - # $ra = 20($sp) - # self = 16($sp) + # $ra = 36($sp) + # self = 32($sp) # Reserving space for local variables - addi $sp, $sp, -16 + addi $sp, $sp, -32 # Get attribute population_map of self - lw $t0, 16($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'population_map' from the instance + lw $t0, 32($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'population_map' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8758890019018 + beq $t6, $t5, int_get_attribute_8754020047270 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8758890019018 - j object_get_attribute_8758890019018 - int_get_attribute_8758890019018: + beq $t6, $t5, bool_get_attribute_8754020047270 + j object_get_attribute_8754020047270 + int_get_attribute_8754020047270: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1441,9 +1584,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_0 = self.population_map - j end_get_attribute_8758890019018 - bool_get_attribute_8758890019018: + sw $v0, 28($sp) # internal_0 = self.population_map + j end_get_attribute_8754020047270 + bool_get_attribute_8754020047270: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1451,11 +1594,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_0 = self.population_map - j end_get_attribute_8758890019018 - object_get_attribute_8758890019018: - sw $t1, 12($sp) # internal_0 = population_map - end_get_attribute_8758890019018: + sw $v0, 28($sp) # internal_0 = self.population_map + j end_get_attribute_8754020047270 + object_get_attribute_8754020047270: + sw $t1, 28($sp) # internal_0 = self.population_map + end_get_attribute_8754020047270: # Allocating String li $v0, 9 @@ -1473,73 +1616,121 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 8($sp) # internal_1 = "\n" + sw $v0, 24($sp) # internal_1 = "\n" + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_3 = address of allocated object Int + + # Get method concat of String + lw $t0, 28($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_0 - lw $t0, 24($sp) + lw $t0, 40($sp) sw $t0, 4($sp) # Storing internal_0 # Argument internal_1 - lw $t0, 20($sp) + lw $t0, 36($sp) sw $t0, 0($sp) # Storing internal_1 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_4 + lw $t0, 24($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 16($sp) # internal_2 = result of function_concat_at_String + sw $v1, 32($sp) # internal_2 = result of internal_4 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 32($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 28($sp) + lw $t0, 44($sp) sw $t0, 4($sp) # Storing self # Argument internal_2 - lw $t0, 16($sp) + lw $t0, 32($sp) sw $t0, 0($sp) # Storing internal_2 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_7 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_out_string_at_IO + sw $v1, 20($sp) # internal_5 = result of internal_7 addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 16($sp) + lw $v1, 32($sp) # Freeing space for local variables - addi $sp, $sp, 16 + addi $sp, $sp, 32 jr $ra function_num_cells_at_CellularAutomaton: # Function parameters - # $ra = 12($sp) - # self = 8($sp) + # $ra = 20($sp) + # self = 16($sp) # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Get attribute population_map of self - lw $t0, 8($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'population_map' from the instance + lw $t0, 16($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'population_map' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8758890020618 + beq $t6, $t5, int_get_attribute_8754020048918 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8758890020618 - j object_get_attribute_8758890020618 - int_get_attribute_8758890020618: + beq $t6, $t5, bool_get_attribute_8754020048918 + j object_get_attribute_8754020048918 + int_get_attribute_8754020048918: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1547,9 +1738,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_0 = self.population_map - j end_get_attribute_8758890020618 - bool_get_attribute_8758890020618: + sw $v0, 12($sp) # internal_0 = self.population_map + j end_get_attribute_8754020048918 + bool_get_attribute_8754020048918: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1557,56 +1748,80 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_0 = self.population_map - j end_get_attribute_8758890020618 - object_get_attribute_8758890020618: - sw $t1, 4($sp) # internal_0 = population_map - end_get_attribute_8758890020618: + sw $v0, 12($sp) # internal_0 = self.population_map + j end_get_attribute_8754020048918 + object_get_attribute_8754020048918: + sw $t1, 12($sp) # internal_0 = self.population_map + end_get_attribute_8754020048918: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method length of String + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_length_at_String - jal function_length_at_String + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function_length_at_String + sw $v1, 16($sp) # internal_1 = result of internal_3 addi $sp, $sp, 8 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 8 + addi $sp, $sp, 16 jr $ra function_cell_at_CellularAutomaton: # Function parameters - # $ra = 20($sp) - # self = 16($sp) - # position = 12($sp) + # $ra = 28($sp) + # self = 24($sp) + # position = 20($sp) # Reserving space for local variables - addi $sp, $sp, -12 + addi $sp, $sp, -20 # Get attribute population_map of self - lw $t0, 16($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'population_map' from the instance + lw $t0, 24($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'population_map' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8758890020672 + beq $t6, $t5, int_get_attribute_8754020048996 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8758890020672 - j object_get_attribute_8758890020672 - int_get_attribute_8758890020672: + beq $t6, $t5, bool_get_attribute_8754020048996 + j object_get_attribute_8754020048996 + int_get_attribute_8754020048996: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1614,9 +1829,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($sp) # internal_0 = self.population_map - j end_get_attribute_8758890020672 - bool_get_attribute_8758890020672: + sw $v0, 16($sp) # internal_0 = self.population_map + j end_get_attribute_8754020048996 + bool_get_attribute_8754020048996: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1624,11 +1839,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($sp) # internal_0 = self.population_map - j end_get_attribute_8758890020672 - object_get_attribute_8758890020672: - sw $t1, 8($sp) # internal_0 = population_map - end_get_attribute_8758890020672: + sw $v0, 16($sp) # internal_0 = self.population_map + j end_get_attribute_8754020048996 + object_get_attribute_8754020048996: + sw $t1, 16($sp) # internal_0 = self.population_map + end_get_attribute_8754020048996: # Allocating Int 1 li $v0, 9 @@ -1640,46 +1855,70 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_1 = address of allocated object Int + sw $v0, 12($sp) # internal_1 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_3 = address of allocated object Int + + # Get method substr of String + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument internal_0 - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 8($sp) # Storing internal_0 # Argument position - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t0, 4($sp) # Storing position # Argument internal_1 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_1 - # Calling function function_substr_at_String - jal function_substr_at_String + # Calling function internal_4 + lw $t0, 16($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 16($sp) # internal_2 = result of function_substr_at_String + sw $v1, 24($sp) # internal_2 = result of internal_4 addi $sp, $sp, 16 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 12 + addi $sp, $sp, 20 jr $ra function_cell_left_neighbor_at_CellularAutomaton: # Function parameters - # $ra = 52($sp) - # self = 48($sp) - # position = 44($sp) + # $ra = 76($sp) + # self = 72($sp) + # position = 68($sp) # Reserving space for local variables - addi $sp, $sp, -44 + addi $sp, $sp, -68 # Allocating Bool 0 li $v0, 9 @@ -1691,7 +1930,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_1 = address of allocated object Int + sw $v0, 60($sp) # internal_1 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -1703,53 +1942,77 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_2 = address of allocated object Int + sw $v0, 56($sp) # internal_2 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 56($sp) + lw $t0, 80($sp) sw $t0, 4($sp) # Storing position # Argument internal_2 - lw $t0, 44($sp) + lw $t0, 68($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 40($sp) # internal_3 = result of function_equal + sw $v1, 64($sp) # internal_3 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_1 = internal_3 - lw $t0, 28($sp) - sw $t0, 36($sp) + lw $t0, 52($sp) + sw $t0, 60($sp) - # If internal_1 then goto then_8758890036240 - lw $t0, 36($sp) # Loading the address of the condition + # If internal_1 then goto then_8754020062838 + lw $t0, 60($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8758890036240 + beq $t0, $t1, then_8754020062838 + + # Jumping to else_8754020062838 + j else_8754020062838 - # Jumping to else_8758890036240 - j else_8758890036240 + then_8754020062838: - then_8758890036240: + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_5 = address of allocated object Int + + # Get method num_cells of CellularAutomaton + lw $t0, 72($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 44($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 40($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 56($sp) + lw $t0, 80($sp) sw $t0, 0($sp) # Storing self - # Calling function function_num_cells_at_CellularAutomaton - jal function_num_cells_at_CellularAutomaton + # Calling function internal_6 + lw $t0, 48($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 32($sp) # internal_4 = result of function_num_cells_at_CellularAutomaton + sw $v1, 56($sp) # internal_4 = result of internal_6 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 1 @@ -1762,52 +2025,76 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_5 = address of allocated object Int + sw $v0, 36($sp) # internal_7 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_4 - lw $t0, 36($sp) + lw $t0, 60($sp) sw $t0, 4($sp) # Storing internal_4 - # Argument internal_5 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_5 + # Argument internal_7 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_7 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 28($sp) # internal_6 = result of function_sub + sw $v1, 44($sp) # internal_8 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Argument self - lw $t0, 60($sp) + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_10 = address of allocated object Int + + # Get method cell of CellularAutomaton + lw $t0, 72($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 24($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 20($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 84($sp) sw $t0, 4($sp) # Storing self - # Argument internal_6 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_6 + # Argument internal_8 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_8 - # Calling function function_cell_at_CellularAutomaton - jal function_cell_at_CellularAutomaton + # Calling function internal_11 + lw $t0, 32($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 24($sp) # internal_7 = result of function_cell_at_CellularAutomaton + sw $v1, 40($sp) # internal_9 = result of internal_11 addi $sp, $sp, 12 # Freeing space for arguments - # internal_0 = internal_7 - lw $t0, 12($sp) - sw $t0, 40($sp) + # internal_0 = internal_9 + lw $t0, 28($sp) + sw $t0, 64($sp) - # Jumping to endif_8758890036240 - j endif_8758890036240 + # Jumping to endif_8754020062838 + j endif_8754020062838 - else_8758890036240: + else_8754020062838: # Allocating Int 1 li $v0, 9 @@ -1819,69 +2106,93 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_8 = address of allocated object Int + sw $v0, 16($sp) # internal_12 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 56($sp) + lw $t0, 80($sp) sw $t0, 4($sp) # Storing position - # Argument internal_8 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_8 + # Argument internal_12 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_12 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 16($sp) # internal_9 = result of function_sub + sw $v1, 24($sp) # internal_13 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_15 = address of allocated object Int + + # Get method cell of CellularAutomaton + lw $t0, 72($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 60($sp) + lw $t0, 84($sp) sw $t0, 4($sp) # Storing self - # Argument internal_9 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_9 + # Argument internal_13 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_13 - # Calling function function_cell_at_CellularAutomaton - jal function_cell_at_CellularAutomaton + # Calling function internal_16 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_10 = result of function_cell_at_CellularAutomaton + sw $v1, 20($sp) # internal_14 = result of internal_16 addi $sp, $sp, 12 # Freeing space for arguments - # internal_0 = internal_10 - lw $t0, 0($sp) - sw $t0, 40($sp) + # internal_0 = internal_14 + lw $t0, 8($sp) + sw $t0, 64($sp) - # Jumping to endif_8758890036240 - j endif_8758890036240 + # Jumping to endif_8754020062838 + j endif_8754020062838 - endif_8758890036240: + endif_8754020062838: # Loading return value in $v1 - lw $v1, 40($sp) + lw $v1, 64($sp) # Freeing space for local variables - addi $sp, $sp, 44 + addi $sp, $sp, 68 jr $ra function_cell_right_neighbor_at_CellularAutomaton: # Function parameters - # $ra = 52($sp) - # self = 48($sp) - # position = 44($sp) + # $ra = 76($sp) + # self = 72($sp) + # position = 68($sp) # Reserving space for local variables - addi $sp, $sp, -44 + addi $sp, $sp, -68 # Allocating Bool 0 li $v0, 9 @@ -1893,20 +2204,44 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_1 = address of allocated object Int + sw $v0, 60($sp) # internal_1 = address of allocated object Int + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_3 = address of allocated object Int + + # Get method num_cells of CellularAutomaton + lw $t0, 72($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 52($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 48($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 56($sp) + lw $t0, 80($sp) sw $t0, 0($sp) # Storing self - # Calling function function_num_cells_at_CellularAutomaton - jal function_num_cells_at_CellularAutomaton + # Calling function internal_4 + lw $t0, 56($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 40($sp) # internal_2 = result of function_num_cells_at_CellularAutomaton + sw $v1, 64($sp) # internal_2 = result of internal_4 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 1 @@ -1919,24 +2254,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_3 = address of allocated object Int + sw $v0, 44($sp) # internal_5 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_2 - lw $t0, 44($sp) + lw $t0, 68($sp) sw $t0, 4($sp) # Storing internal_2 - # Argument internal_3 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_3 + # Argument internal_5 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_5 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 36($sp) # internal_4 = result of function_sub + sw $v1, 52($sp) # internal_6 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -1944,33 +2279,33 @@ sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 56($sp) + lw $t0, 80($sp) sw $t0, 4($sp) # Storing position - # Argument internal_4 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_4 + # Argument internal_6 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_6 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 32($sp) # internal_5 = result of function_equal + sw $v1, 48($sp) # internal_7 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_1 = internal_5 - lw $t0, 20($sp) - sw $t0, 36($sp) + # internal_1 = internal_7 + lw $t0, 36($sp) + sw $t0, 60($sp) - # If internal_1 then goto then_8758890036306 - lw $t0, 36($sp) # Loading the address of the condition + # If internal_1 then goto then_8754020062904 + lw $t0, 60($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8758890036306 + beq $t0, $t1, then_8754020062904 - # Jumping to else_8758890036306 - j else_8758890036306 + # Jumping to else_8754020062904 + j else_8754020062904 - then_8758890036306: + then_8754020062904: # Allocating Int 0 li $v0, 9 @@ -1982,34 +2317,58 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_6 = address of allocated object Int + sw $v0, 32($sp) # internal_8 = address of allocated object Int + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_10 = address of allocated object Int + + # Get method cell of CellularAutomaton + lw $t0, 72($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 24($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 20($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 60($sp) + lw $t0, 84($sp) sw $t0, 4($sp) # Storing self - # Argument internal_6 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_6 + # Argument internal_8 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_8 - # Calling function function_cell_at_CellularAutomaton - jal function_cell_at_CellularAutomaton + # Calling function internal_11 + lw $t0, 32($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 24($sp) # internal_7 = result of function_cell_at_CellularAutomaton + sw $v1, 40($sp) # internal_9 = result of internal_11 addi $sp, $sp, 12 # Freeing space for arguments - # internal_0 = internal_7 - lw $t0, 12($sp) - sw $t0, 40($sp) + # internal_0 = internal_9 + lw $t0, 28($sp) + sw $t0, 64($sp) - # Jumping to endif_8758890036306 - j endif_8758890036306 + # Jumping to endif_8754020062904 + j endif_8754020062904 - else_8758890036306: + else_8754020062904: # Allocating Int 1 li $v0, 9 @@ -2021,69 +2380,93 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_8 = address of allocated object Int + sw $v0, 16($sp) # internal_12 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 56($sp) + lw $t0, 80($sp) sw $t0, 4($sp) # Storing position - # Argument internal_8 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_8 + # Argument internal_12 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_12 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 16($sp) # internal_9 = result of function_add + sw $v1, 24($sp) # internal_13 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_15 = address of allocated object Int + + # Get method cell of CellularAutomaton + lw $t0, 72($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 60($sp) + lw $t0, 84($sp) sw $t0, 4($sp) # Storing self - # Argument internal_9 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_9 + # Argument internal_13 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_13 - # Calling function function_cell_at_CellularAutomaton - jal function_cell_at_CellularAutomaton + # Calling function internal_16 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_10 = result of function_cell_at_CellularAutomaton + sw $v1, 20($sp) # internal_14 = result of internal_16 addi $sp, $sp, 12 # Freeing space for arguments - # internal_0 = internal_10 - lw $t0, 0($sp) - sw $t0, 40($sp) + # internal_0 = internal_14 + lw $t0, 8($sp) + sw $t0, 64($sp) - # Jumping to endif_8758890036306 - j endif_8758890036306 + # Jumping to endif_8754020062904 + j endif_8754020062904 - endif_8758890036306: + endif_8754020062904: # Loading return value in $v1 - lw $v1, 40($sp) + lw $v1, 64($sp) # Freeing space for local variables - addi $sp, $sp, 44 + addi $sp, $sp, 68 jr $ra function_cell_at_next_evolution_at_CellularAutomaton: # Function parameters - # $ra = 124($sp) - # self = 120($sp) - # position = 116($sp) + # $ra = 148($sp) + # self = 144($sp) + # position = 140($sp) # Reserving space for local variables - addi $sp, $sp, -116 + addi $sp, $sp, -140 # Allocating Bool 0 li $v0, 9 @@ -2095,7 +2478,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 108($sp) # internal_1 = address of allocated object Int + sw $v0, 132($sp) # internal_1 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -2107,24 +2490,48 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 100($sp) # internal_3 = address of allocated object Int + sw $v0, 124($sp) # internal_3 = address of allocated object Int + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 116($sp) # internal_5 = address of allocated object Int + + # Get method cell of CellularAutomaton + lw $t0, 144($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 116($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 112($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 132($sp) + lw $t0, 156($sp) sw $t0, 4($sp) # Storing self # Argument position - lw $t0, 128($sp) + lw $t0, 152($sp) sw $t0, 0($sp) # Storing position - # Calling function function_cell_at_CellularAutomaton - jal function_cell_at_CellularAutomaton + # Calling function internal_6 + lw $t0, 124($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 108($sp) # internal_4 = result of function_cell_at_CellularAutomaton + sw $v1, 132($sp) # internal_4 = result of internal_6 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -2139,44 +2546,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 - sb $t0, 8($v0) # internal_5[0] = 'X' + sb $t0, 8($v0) # internal_7[0] = 'X' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 92($sp) # internal_5 = "X" + sw $v0, 108($sp) # internal_7 = "X" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_4 - lw $t0, 108($sp) + lw $t0, 132($sp) sw $t0, 4($sp) # Storing internal_4 - # Argument internal_5 - lw $t0, 104($sp) - sw $t0, 0($sp) # Storing internal_5 + # Argument internal_7 + lw $t0, 120($sp) + sw $t0, 0($sp) # Storing internal_7 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 100($sp) # internal_6 = result of function_equal + sw $v1, 116($sp) # internal_8 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_3 = internal_6 - lw $t0, 88($sp) - sw $t0, 100($sp) + # internal_3 = internal_8 + lw $t0, 104($sp) + sw $t0, 124($sp) - # If internal_3 then goto then_8758890036342 - lw $t0, 100($sp) # Loading the address of the condition + # If internal_3 then goto then_8754020062940 + lw $t0, 124($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8758890036342 + beq $t0, $t1, then_8754020062940 - # Jumping to else_8758890036342 - j else_8758890036342 + # Jumping to else_8754020062940 + j else_8754020062940 - then_8758890036342: + then_8754020062940: # Allocating Int 1 li $v0, 9 @@ -2188,16 +2595,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 84($sp) # internal_7 = address of allocated object Int + sw $v0, 100($sp) # internal_9 = address of allocated object Int - # internal_2 = internal_7 - lw $t0, 84($sp) - sw $t0, 104($sp) + # internal_2 = internal_9 + lw $t0, 100($sp) + sw $t0, 128($sp) - # Jumping to endif_8758890036342 - j endif_8758890036342 + # Jumping to endif_8754020062940 + j endif_8754020062940 - else_8758890036342: + else_8754020062940: # Allocating Int 0 li $v0, 9 @@ -2209,16 +2616,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # internal_8 = address of allocated object Int + sw $v0, 96($sp) # internal_10 = address of allocated object Int - # internal_2 = internal_8 - lw $t0, 80($sp) - sw $t0, 104($sp) + # internal_2 = internal_10 + lw $t0, 96($sp) + sw $t0, 128($sp) - # Jumping to endif_8758890036342 - j endif_8758890036342 + # Jumping to endif_8754020062940 + j endif_8754020062940 - endif_8758890036342: + endif_8754020062940: # Allocating Bool 0 li $v0, 9 @@ -2230,24 +2637,48 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 72($sp) # internal_10 = address of allocated object Int + sw $v0, 88($sp) # internal_12 = address of allocated object Int + + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_14 = address of allocated object Int + + # Get method cell_left_neighbor of CellularAutomaton + lw $t0, 144($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 80($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 76($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 132($sp) + lw $t0, 156($sp) sw $t0, 4($sp) # Storing self # Argument position - lw $t0, 128($sp) + lw $t0, 152($sp) sw $t0, 0($sp) # Storing position - # Calling function function_cell_left_neighbor_at_CellularAutomaton - jal function_cell_left_neighbor_at_CellularAutomaton + # Calling function internal_15 + lw $t0, 88($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 80($sp) # internal_11 = result of function_cell_left_neighbor_at_CellularAutomaton + sw $v1, 96($sp) # internal_13 = result of internal_15 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -2262,44 +2693,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 - sb $t0, 8($v0) # internal_12[0] = 'X' + sb $t0, 8($v0) # internal_16[0] = 'X' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 64($sp) # internal_12 = "X" + sw $v0, 72($sp) # internal_16 = "X" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_11 - lw $t0, 80($sp) - sw $t0, 4($sp) # Storing internal_11 + # Argument internal_13 + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing internal_13 - # Argument internal_12 - lw $t0, 76($sp) - sw $t0, 0($sp) # Storing internal_12 + # Argument internal_16 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_16 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 72($sp) # internal_13 = result of function_equal + sw $v1, 80($sp) # internal_17 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_10 = internal_13 - lw $t0, 60($sp) - sw $t0, 72($sp) + # internal_12 = internal_17 + lw $t0, 68($sp) + sw $t0, 88($sp) - # If internal_10 then goto then_8758890036381 - lw $t0, 72($sp) # Loading the address of the condition + # If internal_12 then goto then_8754020063751 + lw $t0, 88($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8758890036381 + beq $t0, $t1, then_8754020063751 - # Jumping to else_8758890036381 - j else_8758890036381 + # Jumping to else_8754020063751 + j else_8754020063751 - then_8758890036381: + then_8754020063751: # Allocating Int 1 li $v0, 9 @@ -2311,16 +2742,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 56($sp) # internal_14 = address of allocated object Int + sw $v0, 64($sp) # internal_18 = address of allocated object Int - # internal_9 = internal_14 - lw $t0, 56($sp) - sw $t0, 76($sp) + # internal_11 = internal_18 + lw $t0, 64($sp) + sw $t0, 92($sp) - # Jumping to endif_8758890036381 - j endif_8758890036381 + # Jumping to endif_8754020063751 + j endif_8754020063751 - else_8758890036381: + else_8754020063751: # Allocating Int 0 li $v0, 9 @@ -2332,33 +2763,33 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 52($sp) # internal_15 = address of allocated object Int + sw $v0, 60($sp) # internal_19 = address of allocated object Int - # internal_9 = internal_15 - lw $t0, 52($sp) - sw $t0, 76($sp) + # internal_11 = internal_19 + lw $t0, 60($sp) + sw $t0, 92($sp) - # Jumping to endif_8758890036381 - j endif_8758890036381 + # Jumping to endif_8754020063751 + j endif_8754020063751 - endif_8758890036381: + endif_8754020063751: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_2 - lw $t0, 116($sp) + lw $t0, 140($sp) sw $t0, 4($sp) # Storing internal_2 - # Argument internal_9 - lw $t0, 88($sp) - sw $t0, 0($sp) # Storing internal_9 + # Argument internal_11 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_11 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 60($sp) # internal_16 = result of function_add + sw $v1, 68($sp) # internal_20 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bool 0 @@ -2371,24 +2802,48 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_18 = address of allocated object Int + sw $v0, 48($sp) # internal_22 = address of allocated object Int + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_24 = address of allocated object Int + + # Get method cell_right_neighbor of CellularAutomaton + lw $t0, 144($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 40($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 36($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 132($sp) + lw $t0, 156($sp) sw $t0, 4($sp) # Storing self # Argument position - lw $t0, 128($sp) + lw $t0, 152($sp) sw $t0, 0($sp) # Storing position - # Calling function function_cell_right_neighbor_at_CellularAutomaton - jal function_cell_right_neighbor_at_CellularAutomaton + # Calling function internal_25 + lw $t0, 48($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 48($sp) # internal_19 = result of function_cell_right_neighbor_at_CellularAutomaton + sw $v1, 56($sp) # internal_23 = result of internal_25 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -2403,44 +2858,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 - sb $t0, 8($v0) # internal_20[0] = 'X' + sb $t0, 8($v0) # internal_26[0] = 'X' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 32($sp) # internal_20 = "X" + sw $v0, 32($sp) # internal_26 = "X" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_19 - lw $t0, 48($sp) - sw $t0, 4($sp) # Storing internal_19 + # Argument internal_23 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_23 - # Argument internal_20 + # Argument internal_26 lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_20 + sw $t0, 0($sp) # Storing internal_26 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 40($sp) # internal_21 = result of function_equal + sw $v1, 40($sp) # internal_27 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_18 = internal_21 + # internal_22 = internal_27 lw $t0, 28($sp) - sw $t0, 40($sp) + sw $t0, 48($sp) - # If internal_18 then goto then_8758890036426 - lw $t0, 40($sp) # Loading the address of the condition + # If internal_22 then goto then_8754020063796 + lw $t0, 48($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8758890036426 + beq $t0, $t1, then_8754020063796 - # Jumping to else_8758890036426 - j else_8758890036426 + # Jumping to else_8754020063796 + j else_8754020063796 - then_8758890036426: + then_8754020063796: # Allocating Int 1 li $v0, 9 @@ -2452,16 +2907,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_22 = address of allocated object Int + sw $v0, 24($sp) # internal_28 = address of allocated object Int - # internal_17 = internal_22 + # internal_21 = internal_28 lw $t0, 24($sp) - sw $t0, 44($sp) + sw $t0, 52($sp) - # Jumping to endif_8758890036426 - j endif_8758890036426 + # Jumping to endif_8754020063796 + j endif_8754020063796 - else_8758890036426: + else_8754020063796: # Allocating Int 0 li $v0, 9 @@ -2473,33 +2928,33 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_23 = address of allocated object Int + sw $v0, 20($sp) # internal_29 = address of allocated object Int - # internal_17 = internal_23 + # internal_21 = internal_29 lw $t0, 20($sp) - sw $t0, 44($sp) + sw $t0, 52($sp) - # Jumping to endif_8758890036426 - j endif_8758890036426 + # Jumping to endif_8754020063796 + j endif_8754020063796 - endif_8758890036426: + endif_8754020063796: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_16 - lw $t0, 60($sp) - sw $t0, 4($sp) # Storing internal_16 + # Argument internal_20 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_20 - # Argument internal_17 - lw $t0, 56($sp) - sw $t0, 0($sp) # Storing internal_17 + # Argument internal_21 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_21 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 28($sp) # internal_24 = result of function_add + sw $v1, 28($sp) # internal_30 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -2512,40 +2967,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_25 = address of allocated object Int + sw $v0, 12($sp) # internal_31 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_24 + # Argument internal_30 lw $t0, 28($sp) - sw $t0, 4($sp) # Storing internal_24 + sw $t0, 4($sp) # Storing internal_30 - # Argument internal_25 + # Argument internal_31 lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_25 + sw $t0, 0($sp) # Storing internal_31 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 20($sp) # internal_26 = result of function_equal + sw $v1, 20($sp) # internal_32 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_1 = internal_26 + # internal_1 = internal_32 lw $t0, 8($sp) - sw $t0, 108($sp) + sw $t0, 132($sp) - # If internal_1 then goto then_8758890036462 - lw $t0, 108($sp) # Loading the address of the condition + # If internal_1 then goto then_8754020063832 + lw $t0, 132($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8758890036462 + beq $t0, $t1, then_8754020063832 - # Jumping to else_8758890036462 - j else_8758890036462 + # Jumping to else_8754020063832 + j else_8754020063832 - then_8758890036462: + then_8754020063832: # Allocating String li $v0, 9 @@ -2559,20 +3014,20 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 - sb $t0, 8($v0) # internal_27[0] = 'X' + sb $t0, 8($v0) # internal_33[0] = 'X' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_27 = "X" + sw $v0, 4($sp) # internal_33 = "X" - # internal_0 = internal_27 + # internal_0 = internal_33 lw $t0, 4($sp) - sw $t0, 112($sp) + sw $t0, 136($sp) - # Jumping to endif_8758890036462 - j endif_8758890036462 + # Jumping to endif_8754020063832 + j endif_8754020063832 - else_8758890036462: + else_8754020063832: # Allocating String li $v0, 9 @@ -2586,36 +3041,36 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 46 - sb $t0, 8($v0) # internal_28[0] = '.' + sb $t0, 8($v0) # internal_34[0] = '.' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 0($sp) # internal_28 = "." + sw $v0, 0($sp) # internal_34 = "." - # internal_0 = internal_28 + # internal_0 = internal_34 lw $t0, 0($sp) - sw $t0, 112($sp) + sw $t0, 136($sp) - # Jumping to endif_8758890036462 - j endif_8758890036462 + # Jumping to endif_8754020063832 + j endif_8754020063832 - endif_8758890036462: + endif_8754020063832: # Loading return value in $v1 - lw $v1, 112($sp) + lw $v1, 136($sp) # Freeing space for local variables - addi $sp, $sp, 116 + addi $sp, $sp, 140 jr $ra function_evolve_at_CellularAutomaton: # Function parameters - # $ra = 40($sp) - # self = 36($sp) + # $ra = 68($sp) + # self = 64($sp) # Reserving space for local variables - addi $sp, $sp, -36 + addi $sp, $sp, -64 # Allocating Int 0 li $v0, 9 @@ -2627,20 +3082,44 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # position = address of allocated object Int + sw $v0, 60($sp) # position = address of allocated object Int + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_3 = address of allocated object Int + + # Get method num_cells of CellularAutomaton + lw $t0, 64($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 48($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 44($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 44($sp) + lw $t0, 72($sp) sw $t0, 0($sp) # Storing self - # Calling function function_num_cells_at_CellularAutomaton - jal function_num_cells_at_CellularAutomaton + # Calling function internal_4 + lw $t0, 52($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 32($sp) # internal_2 = result of function_num_cells_at_CellularAutomaton + sw $v1, 60($sp) # internal_2 = result of internal_4 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments @@ -2648,17 +3127,17 @@ sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 40($sp) + lw $t0, 68($sp) sw $t0, 4($sp) # Storing num # Argument internal_2 - lw $t0, 36($sp) + lw $t0, 64($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 40($sp) # num = result of function_assign + sw $v1, 68($sp) # num = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -2674,73 +3153,124 @@ sb $zero, 8($v0) # Null-terminator at the end of the string - sw $v0, 20($sp) # temp = "" + sw $v0, 40($sp) # temp = "" - while_start_8758890036806: + # Allocating NUll to internal_6 + sw $zero, 36($sp) # internal_6 = 0 + + while_start_8754020063916: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 44($sp) + lw $t0, 72($sp) sw $t0, 4($sp) # Storing position # Argument num - lw $t0, 40($sp) + lw $t0, 68($sp) sw $t0, 0($sp) # Storing num # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 28($sp) # internal_4 = result of function_less_than + sw $v1, 44($sp) # internal_7 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_4 then goto while_body_8758890036806 - lw $t0, 16($sp) # Loading the address of the condition + # If internal_7 then goto while_body_8754020063916 + lw $t0, 32($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8758890036806 + beq $t0, $t1, while_body_8754020063916 - # Jumping to while_end_8758890036806 - j while_end_8758890036806 + # Jumping to while_end_8754020063916 + j while_end_8754020063916 - while_body_8758890036806: + while_body_8754020063916: + + # Allocating Int 14 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 14 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_9 = address of allocated object Int + + # Get method cell_at_next_evolution of CellularAutomaton + lw $t0, 64($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 24($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 20($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 48($sp) + lw $t0, 76($sp) sw $t0, 4($sp) # Storing self # Argument position - lw $t0, 44($sp) + lw $t0, 72($sp) sw $t0, 0($sp) # Storing position - # Calling function function_cell_at_next_evolution_at_CellularAutomaton - jal function_cell_at_next_evolution_at_CellularAutomaton + # Calling function internal_10 + lw $t0, 32($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 24($sp) # internal_5 = result of function_cell_at_next_evolution_at_CellularAutomaton + sw $v1, 40($sp) # internal_8 = result of internal_10 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_12 = address of allocated object Int + + # Get method concat of String + lw $t0, 40($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 12($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 8($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument temp - lw $t0, 32($sp) + lw $t0, 52($sp) sw $t0, 4($sp) # Storing temp - # Argument internal_5 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_5 + # Argument internal_8 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_8 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_13 + lw $t0, 20($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 20($sp) # internal_6 = result of function_concat_at_String + sw $v1, 28($sp) # internal_11 = result of internal_13 addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -2748,17 +3278,17 @@ sw $ra, 8($sp) # Storing return address # Argument temp - lw $t0, 32($sp) + lw $t0, 52($sp) sw $t0, 4($sp) # Storing temp - # Argument internal_6 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_6 + # Argument internal_11 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_11 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 32($sp) # temp = result of function_assign + sw $v1, 52($sp) # temp = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -2771,24 +3301,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_7 = address of allocated object Int + sw $v0, 4($sp) # internal_14 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 44($sp) + lw $t0, 72($sp) sw $t0, 4($sp) # Storing position - # Argument internal_7 + # Argument internal_14 lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_7 + sw $t0, 0($sp) # Storing internal_14 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 12($sp) # internal_8 = result of function_add + sw $v1, 12($sp) # internal_15 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -2796,38 +3326,38 @@ sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 44($sp) + lw $t0, 72($sp) sw $t0, 4($sp) # Storing position - # Argument internal_8 + # Argument internal_15 lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_8 + sw $t0, 0($sp) # Storing internal_15 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 44($sp) # position = result of function_assign + sw $v1, 72($sp) # position = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to while_start_8758890036806 - j while_start_8758890036806 + # Jumping to while_start_8754020063916 + j while_start_8754020063916 - while_end_8758890036806: + while_end_8754020063916: # Set attribute population_map of self - lw $t0, 36($sp) # $t0 = self - lw $t1, 20($sp) # $t1 = temp - beq $t1, $zero, object_set_attribute_8758890024650 + lw $t0, 64($sp) # $t0 = self + lw $t1, 40($sp) # $t1 = temp + beq $t1, $zero, object_set_attribute_8754020049930 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8758890024650 + beq $t6, $t5, int_set_attribute_8754020049930 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8758890024650 - j object_set_attribute_8758890024650 - int_set_attribute_8758890024650: + beq $t6, $t5, bool_set_attribute_8754020049930 + j object_set_attribute_8754020049930 + int_set_attribute_8754020049930: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2836,8 +3366,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.population_map = temp - j end_set_attribute_8758890024650 - bool_set_attribute_8758890024650: + j end_set_attribute_8754020049930 + bool_set_attribute_8754020049930: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2846,16 +3376,16 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.population_map = temp - j end_set_attribute_8758890024650 - object_set_attribute_8758890024650: + j end_set_attribute_8754020049930 + object_set_attribute_8754020049930: sw $t1, 8($t0) # self.population_map = temp - end_set_attribute_8758890024650: + end_set_attribute_8754020049930: # Loading return value in $v1 - lw $v1, 36($sp) + lw $v1, 64($sp) # Freeing space for local variables - addi $sp, $sp, 36 + addi $sp, $sp, 64 jr $ra @@ -2873,17 +3403,17 @@ # Set attribute cells of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8758890024557 + beq $t1, $zero, object_set_attribute_8754020020637 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8758890024557 + beq $t6, $t5, int_set_attribute_8754020020637 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8758890024557 - j object_set_attribute_8758890024557 - int_set_attribute_8758890024557: + beq $t6, $t5, bool_set_attribute_8754020020637 + j object_set_attribute_8754020020637 + int_set_attribute_8754020020637: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2892,8 +3422,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.cells = internal_0 - j end_set_attribute_8758890024557 - bool_set_attribute_8758890024557: + j end_set_attribute_8754020020637 + bool_set_attribute_8754020020637: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2902,10 +3432,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.cells = internal_0 - j end_set_attribute_8758890024557 - object_set_attribute_8758890024557: + j end_set_attribute_8754020020637 + object_set_attribute_8754020020637: sw $t1, 8($t0) # self.cells = internal_0 - end_set_attribute_8758890024557: + end_set_attribute_8754020020637: # Loading return value in $v1 lw $v1, 4($sp) @@ -2917,11 +3447,11 @@ function_main_at_Main: # Function parameters - # $ra = 64($sp) - # self = 60($sp) + # $ra = 100($sp) + # self = 96($sp) # Reserving space for local variables - addi $sp, $sp, -60 + addi $sp, $sp, -96 # Allocating CellularAutomaton li $v0, 9 @@ -2930,20 +3460,20 @@ la $t0, type_CellularAutomaton # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 56($sp) # internal_0 = address of allocated object CellularAutomaton + sw $v0, 92($sp) # internal_0 = address of allocated object CellularAutomaton # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 64($sp) + lw $t0, 100($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_CellularAutomaton jal function___init___at_CellularAutomaton lw $ra, 4($sp) - sw $v1, 64($sp) # internal_0 = result of function___init___at_CellularAutomaton + sw $v1, 100($sp) # internal_0 = result of function___init___at_CellularAutomaton addi $sp, $sp, 8 # Freeing space for arguments # Allocating String @@ -3016,40 +3546,64 @@ sb $zero, 27($v0) # Null-terminator at the end of the string - sw $v0, 52($sp) # internal_1 = " X " + sw $v0, 88($sp) # internal_1 = " X " + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_3 = address of allocated object Int + + # Get method init of CellularAutomaton + lw $t0, 92($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 80($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 76($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_0 - lw $t0, 68($sp) + lw $t0, 104($sp) sw $t0, 4($sp) # Storing internal_0 # Argument internal_1 - lw $t0, 64($sp) + lw $t0, 100($sp) sw $t0, 0($sp) # Storing internal_1 - # Calling function function_init_at_CellularAutomaton - jal function_init_at_CellularAutomaton + # Calling function internal_4 + lw $t0, 88($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 60($sp) # internal_2 = result of function_init_at_CellularAutomaton + sw $v1, 96($sp) # internal_2 = result of internal_4 addi $sp, $sp, 12 # Freeing space for arguments # Set attribute cells of self - lw $t0, 60($sp) # $t0 = self - lw $t1, 48($sp) # $t1 = internal_2 - beq $t1, $zero, object_set_attribute_8758890025075 + lw $t0, 96($sp) # $t0 = self + lw $t1, 84($sp) # $t1 = internal_2 + beq $t1, $zero, object_set_attribute_8754020050143 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8758890025075 + beq $t6, $t5, int_set_attribute_8754020050143 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8758890025075 - j object_set_attribute_8758890025075 - int_set_attribute_8758890025075: + beq $t6, $t5, bool_set_attribute_8754020050143 + j object_set_attribute_8754020050143 + int_set_attribute_8754020050143: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3058,8 +3612,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.cells = internal_2 - j end_set_attribute_8758890025075 - bool_set_attribute_8758890025075: + j end_set_attribute_8754020050143 + bool_set_attribute_8754020050143: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3068,24 +3622,24 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.cells = internal_2 - j end_set_attribute_8758890025075 - object_set_attribute_8758890025075: + j end_set_attribute_8754020050143 + object_set_attribute_8754020050143: sw $t1, 8($t0) # self.cells = internal_2 - end_set_attribute_8758890025075: + end_set_attribute_8754020050143: # Get attribute cells of self - lw $t0, 60($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'cells' from the instance + lw $t0, 96($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'cells' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8758890025156 + beq $t6, $t5, int_get_attribute_8754020022092 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8758890025156 - j object_get_attribute_8758890025156 - int_get_attribute_8758890025156: + beq $t6, $t5, bool_get_attribute_8754020022092 + j object_get_attribute_8754020022092 + int_get_attribute_8754020022092: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3093,9 +3647,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 44($sp) # internal_3 = self.cells - j end_get_attribute_8758890025156 - bool_get_attribute_8758890025156: + sw $v0, 72($sp) # internal_5 = self.cells + j end_get_attribute_8754020022092 + bool_get_attribute_8754020022092: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3103,24 +3657,48 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 44($sp) # internal_3 = self.cells - j end_get_attribute_8758890025156 - object_get_attribute_8758890025156: - sw $t1, 44($sp) # internal_3 = cells - end_get_attribute_8758890025156: + sw $v0, 72($sp) # internal_5 = self.cells + j end_get_attribute_8754020022092 + object_get_attribute_8754020022092: + sw $t1, 72($sp) # internal_5 = self.cells + end_get_attribute_8754020022092: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_7 = address of allocated object Int + + # Get method print of CellularAutomaton + lw $t0, 72($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 64($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 60($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_3 - lw $t0, 52($sp) - sw $t0, 0($sp) # Storing internal_3 + # Argument internal_5 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_5 - # Calling function function_print_at_CellularAutomaton - jal function_print_at_CellularAutomaton + # Calling function internal_8 + lw $t0, 68($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 48($sp) # internal_4 = result of function_print_at_CellularAutomaton + sw $v1, 76($sp) # internal_6 = result of internal_8 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 20 @@ -3133,27 +3711,30 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 20 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_6 = address of allocated object Int + sw $v0, 52($sp) # internal_10 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument countdown - lw $t0, 48($sp) + lw $t0, 68($sp) sw $t0, 4($sp) # Storing countdown - # Argument internal_6 - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_6 + # Argument internal_10 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_10 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 48($sp) # countdown = result of function_assign + sw $v1, 68($sp) # countdown = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - while_start_8758890036959: + # Allocating NUll to internal_11 + sw $zero, 48($sp) # internal_11 = 0 + + while_start_8754020064841: # Allocating Int 0 li $v0, 9 @@ -3165,50 +3746,50 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_7 = address of allocated object Int + sw $v0, 44($sp) # internal_12 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_7 - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing internal_7 + # Argument internal_12 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_12 # Argument countdown - lw $t0, 48($sp) + lw $t0, 68($sp) sw $t0, 0($sp) # Storing countdown # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 36($sp) # internal_8 = result of function_less_than + sw $v1, 52($sp) # internal_13 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_8 then goto while_body_8758890036959 - lw $t0, 24($sp) # Loading the address of the condition + # If internal_13 then goto while_body_8754020064841 + lw $t0, 40($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8758890036959 + beq $t0, $t1, while_body_8754020064841 - # Jumping to while_end_8758890036959 - j while_end_8758890036959 + # Jumping to while_end_8754020064841 + j while_end_8754020064841 - while_body_8758890036959: + while_body_8754020064841: # Get attribute cells of self - lw $t0, 60($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'cells' from the instance + lw $t0, 96($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'cells' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8758890026373 + beq $t6, $t5, int_get_attribute_8754020022577 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8758890026373 - j object_get_attribute_8758890026373 - int_get_attribute_8758890026373: + beq $t6, $t5, bool_get_attribute_8754020022577 + j object_get_attribute_8754020022577 + int_get_attribute_8754020022577: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3216,9 +3797,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 20($sp) # internal_9 = self.cells - j end_get_attribute_8758890026373 - bool_get_attribute_8758890026373: + sw $v0, 36($sp) # internal_14 = self.cells + j end_get_attribute_8754020022577 + bool_get_attribute_8754020022577: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3226,39 +3807,63 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 20($sp) # internal_9 = self.cells - j end_get_attribute_8758890026373 - object_get_attribute_8758890026373: - sw $t1, 20($sp) # internal_9 = cells - end_get_attribute_8758890026373: + sw $v0, 36($sp) # internal_14 = self.cells + j end_get_attribute_8754020022577 + object_get_attribute_8754020022577: + sw $t1, 36($sp) # internal_14 = self.cells + end_get_attribute_8754020022577: + + # Allocating Int 15 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 15 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_16 = address of allocated object Int + + # Get method evolve of CellularAutomaton + lw $t0, 36($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 28($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 24($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_9 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_9 + # Argument internal_14 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_14 - # Calling function function_evolve_at_CellularAutomaton - jal function_evolve_at_CellularAutomaton + # Calling function internal_17 + lw $t0, 32($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 24($sp) # internal_10 = result of function_evolve_at_CellularAutomaton + sw $v1, 40($sp) # internal_15 = result of internal_17 addi $sp, $sp, 8 # Freeing space for arguments # Get attribute cells of self - lw $t0, 60($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'cells' from the instance + lw $t0, 96($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'cells' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8758890026403 + beq $t6, $t5, int_get_attribute_8754020022631 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8758890026403 - j object_get_attribute_8758890026403 - int_get_attribute_8758890026403: + beq $t6, $t5, bool_get_attribute_8754020022631 + j object_get_attribute_8754020022631 + int_get_attribute_8754020022631: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3266,9 +3871,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_11 = self.cells - j end_get_attribute_8758890026403 - bool_get_attribute_8758890026403: + sw $v0, 20($sp) # internal_18 = self.cells + j end_get_attribute_8754020022631 + bool_get_attribute_8754020022631: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3276,24 +3881,48 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_11 = self.cells - j end_get_attribute_8758890026403 - object_get_attribute_8758890026403: - sw $t1, 12($sp) # internal_11 = cells - end_get_attribute_8758890026403: + sw $v0, 20($sp) # internal_18 = self.cells + j end_get_attribute_8754020022631 + object_get_attribute_8754020022631: + sw $t1, 20($sp) # internal_18 = self.cells + end_get_attribute_8754020022631: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_20 = address of allocated object Int + + # Get method print of CellularAutomaton + lw $t0, 20($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 12($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 8($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_11 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_11 + # Argument internal_18 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_18 - # Calling function function_print_at_CellularAutomaton - jal function_print_at_CellularAutomaton + # Calling function internal_21 + lw $t0, 16($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 16($sp) # internal_12 = result of function_print_at_CellularAutomaton + sw $v1, 24($sp) # internal_19 = result of internal_21 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 1 @@ -3306,24 +3935,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_13 = address of allocated object Int + sw $v0, 4($sp) # internal_22 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument countdown - lw $t0, 48($sp) + lw $t0, 68($sp) sw $t0, 4($sp) # Storing countdown - # Argument internal_13 + # Argument internal_22 lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_13 + sw $t0, 0($sp) # Storing internal_22 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 12($sp) # internal_14 = result of function_sub + sw $v1, 12($sp) # internal_23 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -3331,35 +3960,35 @@ sw $ra, 8($sp) # Storing return address # Argument countdown - lw $t0, 48($sp) + lw $t0, 68($sp) sw $t0, 4($sp) # Storing countdown - # Argument internal_14 + # Argument internal_23 lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_14 + sw $t0, 0($sp) # Storing internal_23 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 48($sp) # countdown = result of function_assign + sw $v1, 68($sp) # countdown = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to while_start_8758890036959 - j while_start_8758890036959 + # Jumping to while_start_8754020064841 + j while_start_8754020064841 - while_end_8758890036959: + while_end_8754020064841: # Loading return value in $v1 - lw $v1, 60($sp) + lw $v1, 96($sp) # Freeing space for local variables - addi $sp, $sp, 60 + addi $sp, $sp, 96 jr $ra main: # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Allocating Main li $v0, 9 @@ -3368,34 +3997,58 @@ la $t0, type_Main # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object Main + sw $v0, 12($sp) # internal_0 = address of allocated object Main # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_Main jal function___init___at_Main lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_main_at_Main - jal function_main_at_Main + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + sw $v1, 16($sp) # internal_1 = result of internal_3 addi $sp, $sp, 8 # Freeing space for arguments # Exit program diff --git a/tests/codegen/complex.mips b/tests/codegen/complex.mips index 73308518c..a433db5d5 100644 --- a/tests/codegen/complex.mips +++ b/tests/codegen/complex.mips @@ -1,52 +1,101 @@ .data - type_Object: .word 8 + type_Object: .word 24 type_Object_inherits_from: .word 0 - type_Object_attributes: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_Main: .word 44 + type_Main_inherits_from: .word type_IO + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_out_string: .word function_out_string_at_IO + type_Main_out_int: .word function_out_int_at_IO + type_Main_in_string: .word function_in_string_at_IO + type_Main_in_int: .word function_in_int_at_IO + type_Main_main: .word function_main_at_Main + + type_Complex: .word 68 + type_Complex_inherits_from: .word type_IO + type_Complex_name_address: .word type_Complex_name_size + type_Complex___init__: .word function___init___at_Complex + type_Complex_abort: .word function_abort_at_Object + type_Complex_type_name: .word function_type_name_at_Object + type_Complex_copy: .word function_copy_at_Object + type_Complex_out_string: .word function_out_string_at_IO + type_Complex_out_int: .word function_out_int_at_IO + type_Complex_in_string: .word function_in_string_at_IO + type_Complex_in_int: .word function_in_int_at_IO + type_Complex_init: .word function_init_at_Complex + type_Complex_print: .word function_print_at_Complex + type_Complex_reflect_0: .word function_reflect_0_at_Complex + type_Complex_reflect_X: .word function_reflect_X_at_Complex + type_Complex_reflect_Y: .word function_reflect_Y_at_Complex + type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" - type_Object_abort_message: .asciiz "Abort called from class Object\n" - type_IO: .word 8 - type_IO_inherits_from: .word type_Object - type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" - type_IO_abort_message: .asciiz "Abort called from class IO\n" - - type_Int: .word 8 - type_Int_inherits_from: .word type_Object - type_Int_attributes: .word 0 - type_Int_name_size: .word 3 - type_Int_name: .asciiz "Int" - type_Int_abort_message: .asciiz "Abort called from class Int\n" - type_String: .word 8 - type_String_inherits_from: .word type_Object - type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" - type_String_abort_message: .asciiz "Abort called from class String\n" - type_Bool: .word 8 - type_Bool_inherits_from: .word type_Object - type_Bool_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" - type_Bool_abort_message: .asciiz "Abort called from class Bool\n" - type_Main: .word 8 - type_Main_inherits_from: .word type_IO - type_Main_attributes: .word 0 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" - type_Main_abort_message: .asciiz "Abort called from class Main\n" - type_Complex: .word 16 - type_Complex_inherits_from: .word type_IO - type_Complex_attributes: .word 2 type_Complex_name_size: .word 7 type_Complex_name: .asciiz "Complex" - type_Complex_abort_message: .asciiz "Abort called from class Complex\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -707,11 +756,11 @@ function_abort_at_Object: # Function parameters - # $ra = 20($sp) - # self = 16($sp) + # $ra = 28($sp) + # self = 24($sp) # Reserving space for local variables - addi $sp, $sp, -16 + addi $sp, $sp, -24 # Allocating String li $v0, 9 @@ -798,7 +847,7 @@ sb $zero, 32($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_0 = "Abort called from class " + sw $v0, 20($sp) # internal_0 = "Abort called from class " # Allocating String li $v0, 9 @@ -812,66 +861,138 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_2[0] = '\n' + sb $t0, 8($v0) # internal_3[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_2 = "\n" + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 0($sp) # Storing self - # Calling function function_type_name_at_Object - jal function_type_name_at_Object + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + sw $v1, 24($sp) # internal_1 = result of internal_5 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_0 - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing internal_0 # Argument internal_1 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_1 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_3 - lw $t0, 12($sp) - sw $t0, 4($sp) # Storing internal_3 - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) # $t0 = internal_3 + lw $t0, 12($sp) # $t0 = internal_2 addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string internal_3 + # Printing the String internal_2 li $v0, 4 move $a0, $t0 syscall @@ -881,10 +1002,10 @@ syscall # Loading return value in $v1 - lw $v1, 16($sp) + lw $v1, 24($sp) # Freeing space for local variables - addi $sp, $sp, 16 + addi $sp, $sp, 24 jr $ra @@ -899,8 +1020,9 @@ # internal_0 = name of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($t0) # $t1 = type of self - lw $t2, 12($t1) # $t1 = length of the name of self - la $t3, 16($t1) # $t1 = name of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 @@ -1003,7 +1125,7 @@ lw $t0, 0($sp) # $t0 = x addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string x + # Printing the String x li $v0, 4 move $a0, $t0 syscall @@ -1019,7 +1141,7 @@ # self = 4($sp) # x = 0($sp) - # Printing the string x + # Printing the Int x li $v0, 1 lw $a0, 0($sp) lw $a0, 8($a0) @@ -1046,11 +1168,13 @@ xor $t0, $t0, $t0 # Initializing counter while_read_start: lb $t1, buffer_input($t0) # Loading the byte - beq $t1, $zero, while_read_end + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end addi $t0, $t0, 1 # Incrementing counter j while_read_start while_read_end: - addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 @@ -1297,6 +1421,26 @@ jr $ra + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + function___init___at_Main: # Function parameters # $ra = 4($sp) @@ -1309,11 +1453,11 @@ function_main_at_Main: # Function parameters - # $ra = 64($sp) - # self = 60($sp) + # $ra = 112($sp) + # self = 108($sp) # Reserving space for local variables - addi $sp, $sp, -60 + addi $sp, $sp, -108 # Allocating Complex li $v0, 9 @@ -1322,20 +1466,20 @@ la $t0, type_Complex # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 52($sp) # internal_1 = address of allocated object Complex + sw $v0, 100($sp) # internal_1 = address of allocated object Complex # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_1 - lw $t0, 60($sp) + lw $t0, 108($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function___init___at_Complex jal function___init___at_Complex lw $ra, 4($sp) - sw $v1, 60($sp) # internal_1 = result of function___init___at_Complex + sw $v1, 108($sp) # internal_1 = result of function___init___at_Complex addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 1 @@ -1348,7 +1492,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_2 = address of allocated object Int + sw $v0, 96($sp) # internal_2 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -1360,28 +1504,52 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_3 = address of allocated object Int + sw $v0, 92($sp) # internal_3 = address of allocated object Int + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_5 = address of allocated object Int + + # Get method init of Complex + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 84($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 80($sp) # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument internal_1 - lw $t0, 68($sp) + lw $t0, 116($sp) sw $t0, 8($sp) # Storing internal_1 # Argument internal_2 - lw $t0, 64($sp) + lw $t0, 112($sp) sw $t0, 4($sp) # Storing internal_2 # Argument internal_3 - lw $t0, 60($sp) + lw $t0, 108($sp) sw $t0, 0($sp) # Storing internal_3 - # Calling function function_init_at_Complex - jal function_init_at_Complex + # Calling function internal_6 + lw $t0, 96($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 56($sp) # internal_4 = result of function_init_at_Complex + sw $v1, 104($sp) # internal_4 = result of internal_6 addi $sp, $sp, 16 # Freeing space for arguments # Passing function arguments @@ -1389,17 +1557,17 @@ sw $ra, 8($sp) # Storing return address # Argument c - lw $t0, 68($sp) + lw $t0, 116($sp) sw $t0, 4($sp) # Storing c # Argument internal_4 - lw $t0, 52($sp) + lw $t0, 100($sp) sw $t0, 0($sp) # Storing internal_4 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 68($sp) # c = result of function_assign + sw $v1, 116($sp) # c = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bool 0 @@ -1412,82 +1580,154 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_6 = address of allocated object Int + sw $v0, 72($sp) # internal_8 = address of allocated object Int + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_10 = address of allocated object Int + + # Get method reflect_X of Complex + lw $t0, 104($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 64($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 60($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument c - lw $t0, 64($sp) + lw $t0, 112($sp) sw $t0, 0($sp) # Storing c - # Calling function function_reflect_X_at_Complex - jal function_reflect_X_at_Complex + # Calling function internal_11 + lw $t0, 68($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 36($sp) # internal_7 = result of function_reflect_X_at_Complex + sw $v1, 76($sp) # internal_9 = result of internal_11 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_13 = address of allocated object Int + + # Get method reflect_Y of Complex + lw $t0, 68($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 52($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 48($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_7 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_7 + # Argument internal_9 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_9 - # Calling function function_reflect_Y_at_Complex - jal function_reflect_Y_at_Complex + # Calling function internal_14 + lw $t0, 56($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 32($sp) # internal_8 = result of function_reflect_Y_at_Complex + sw $v1, 64($sp) # internal_12 = result of internal_14 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_16 = address of allocated object Int + + # Get method reflect_0 of Complex + lw $t0, 104($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 40($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 36($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument c - lw $t0, 64($sp) + lw $t0, 112($sp) sw $t0, 0($sp) # Storing c - # Calling function function_reflect_0_at_Complex - jal function_reflect_0_at_Complex + # Calling function internal_17 + lw $t0, 44($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 28($sp) # internal_9 = result of function_reflect_0_at_Complex + sw $v1, 52($sp) # internal_15 = result of internal_17 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_8 - lw $t0, 36($sp) - sw $t0, 4($sp) # Storing internal_8 + # Argument internal_12 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_12 - # Argument internal_9 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_9 + # Argument internal_15 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_15 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 28($sp) # internal_10 = result of function_equal + sw $v1, 44($sp) # internal_18 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_6 = internal_10 - lw $t0, 16($sp) - sw $t0, 32($sp) + # internal_8 = internal_18 + lw $t0, 32($sp) + sw $t0, 72($sp) - # If internal_6 then goto then_8730036302602 - lw $t0, 32($sp) # Loading the address of the condition + # If internal_8 then goto then_8758062354023 + lw $t0, 72($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8730036302602 + beq $t0, $t1, then_8758062354023 - # Jumping to else_8730036302602 - j else_8730036302602 + # Jumping to else_8758062354023 + j else_8758062354023 - then_8730036302602: + then_8758062354023: # Allocating String li $v0, 9 @@ -1501,44 +1741,68 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 61 - sb $t0, 8($v0) # internal_11[0] = '=' + sb $t0, 8($v0) # internal_19[0] = '=' addi $t0, $zero, 41 - sb $t0, 9($v0) # internal_11[1] = ')' + sb $t0, 9($v0) # internal_19[1] = ')' addi $t0, $zero, 10 - sb $t0, 10($v0) # internal_11[2] = '\n' + sb $t0, 10($v0) # internal_19[2] = '\n' sb $zero, 11($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_11 = "=)\n" + sw $v0, 28($sp) # internal_19 = "=)\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_21 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 108($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 72($sp) + lw $t0, 120($sp) sw $t0, 4($sp) # Storing self - # Argument internal_11 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_11 + # Argument internal_19 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_19 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_22 + lw $t0, 28($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 20($sp) # internal_12 = result of function_out_string_at_IO + sw $v1, 36($sp) # internal_20 = result of internal_22 addi $sp, $sp, 12 # Freeing space for arguments - # internal_5 = internal_12 - lw $t0, 8($sp) - sw $t0, 36($sp) + # internal_7 = internal_20 + lw $t0, 24($sp) + sw $t0, 76($sp) - # Jumping to endif_8730036302602 - j endif_8730036302602 + # Jumping to endif_8758062354023 + j endif_8758062354023 - else_8730036302602: + else_8758062354023: # Allocating String li $v0, 9 @@ -1552,50 +1816,74 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 61 - sb $t0, 8($v0) # internal_13[0] = '=' + sb $t0, 8($v0) # internal_23[0] = '=' addi $t0, $zero, 40 - sb $t0, 9($v0) # internal_13[1] = '(' + sb $t0, 9($v0) # internal_23[1] = '(' addi $t0, $zero, 10 - sb $t0, 10($v0) # internal_13[2] = '\n' + sb $t0, 10($v0) # internal_23[2] = '\n' sb $zero, 11($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_13 = "=(\n" + sw $v0, 12($sp) # internal_23 = "=(\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_25 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 108($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 72($sp) + lw $t0, 120($sp) sw $t0, 4($sp) # Storing self - # Argument internal_13 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_13 + # Argument internal_23 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_23 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_26 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_14 = result of function_out_string_at_IO + sw $v1, 20($sp) # internal_24 = result of internal_26 addi $sp, $sp, 12 # Freeing space for arguments - # internal_5 = internal_14 - lw $t0, 0($sp) - sw $t0, 36($sp) + # internal_7 = internal_24 + lw $t0, 8($sp) + sw $t0, 76($sp) - # Jumping to endif_8730036302602 - j endif_8730036302602 + # Jumping to endif_8758062354023 + j endif_8758062354023 - endif_8730036302602: + endif_8758062354023: # Loading return value in $v1 - lw $v1, 36($sp) + lw $v1, 76($sp) # Freeing space for local variables - addi $sp, $sp, 60 + addi $sp, $sp, 108 jr $ra @@ -1622,17 +1910,17 @@ # Set attribute x of self lw $t0, 8($sp) # $t0 = self lw $t1, 4($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8730036284642 + beq $t1, $zero, object_set_attribute_8758062313289 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8730036284642 + beq $t6, $t5, int_set_attribute_8758062313289 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8730036284642 - j object_set_attribute_8730036284642 - int_set_attribute_8730036284642: + beq $t6, $t5, bool_set_attribute_8758062313289 + j object_set_attribute_8758062313289 + int_set_attribute_8758062313289: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1641,8 +1929,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.x = internal_0 - j end_set_attribute_8730036284642 - bool_set_attribute_8730036284642: + j end_set_attribute_8758062313289 + bool_set_attribute_8758062313289: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1651,10 +1939,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.x = internal_0 - j end_set_attribute_8730036284642 - object_set_attribute_8730036284642: + j end_set_attribute_8758062313289 + object_set_attribute_8758062313289: sw $t1, 8($t0) # self.x = internal_0 - end_set_attribute_8730036284642: + end_set_attribute_8758062313289: # Allocating Int 0 li $v0, 9 @@ -1671,17 +1959,17 @@ # Set attribute y of self lw $t0, 8($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_1 - beq $t1, $zero, object_set_attribute_8730036284663 + beq $t1, $zero, object_set_attribute_8758062313310 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8730036284663 + beq $t6, $t5, int_set_attribute_8758062313310 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8730036284663 - j object_set_attribute_8730036284663 - int_set_attribute_8730036284663: + beq $t6, $t5, bool_set_attribute_8758062313310 + j object_set_attribute_8758062313310 + int_set_attribute_8758062313310: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1690,8 +1978,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.y = internal_1 - j end_set_attribute_8730036284663 - bool_set_attribute_8730036284663: + j end_set_attribute_8758062313310 + bool_set_attribute_8758062313310: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1700,10 +1988,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.y = internal_1 - j end_set_attribute_8730036284663 - object_set_attribute_8730036284663: + j end_set_attribute_8758062313310 + object_set_attribute_8758062313310: sw $t1, 12($t0) # self.y = internal_1 - end_set_attribute_8730036284663: + end_set_attribute_8758062313310: # Loading return value in $v1 lw $v1, 8($sp) @@ -1725,17 +2013,17 @@ # Get attribute x of self lw $t0, 24($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t1, 8($t0) # Get the attribute 'x' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8730036284986 + beq $t6, $t5, int_get_attribute_8758062313373 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8730036284986 - j object_get_attribute_8730036284986 - int_get_attribute_8730036284986: + beq $t6, $t5, bool_get_attribute_8758062313373 + j object_get_attribute_8758062313373 + int_get_attribute_8758062313373: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1744,8 +2032,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($sp) # internal_0 = self.x - j end_get_attribute_8730036284986 - bool_get_attribute_8730036284986: + j end_get_attribute_8758062313373 + bool_get_attribute_8758062313373: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1754,10 +2042,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($sp) # internal_0 = self.x - j end_get_attribute_8730036284986 - object_get_attribute_8730036284986: - sw $t1, 12($sp) # internal_0 = x - end_get_attribute_8730036284986: + j end_get_attribute_8758062313373 + object_get_attribute_8758062313373: + sw $t1, 12($sp) # internal_0 = self.x + end_get_attribute_8758062313373: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -1779,17 +2067,17 @@ # Get attribute y of self lw $t0, 24($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t1, 12($t0) # Get the attribute 'y' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8730036285025 + beq $t6, $t5, int_get_attribute_8758062313412 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8730036285025 - j object_get_attribute_8730036285025 - int_get_attribute_8730036285025: + beq $t6, $t5, bool_get_attribute_8758062313412 + j object_get_attribute_8758062313412 + int_get_attribute_8758062313412: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1798,8 +2086,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 4($sp) # internal_2 = self.y - j end_get_attribute_8730036285025 - bool_get_attribute_8730036285025: + j end_get_attribute_8758062313412 + bool_get_attribute_8758062313412: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1808,10 +2096,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 4($sp) # internal_2 = self.y - j end_get_attribute_8730036285025 - object_get_attribute_8730036285025: - sw $t1, 4($sp) # internal_2 = y - end_get_attribute_8730036285025: + j end_get_attribute_8758062313412 + object_get_attribute_8758062313412: + sw $t1, 4($sp) # internal_2 = self.y + end_get_attribute_8758062313412: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -1841,11 +2129,11 @@ function_print_at_Complex: # Function parameters - # $ra = 64($sp) - # self = 60($sp) + # $ra = 104($sp) + # self = 100($sp) # Reserving space for local variables - addi $sp, $sp, -60 + addi $sp, $sp, -100 # Allocating Bool 0 li $v0, 9 @@ -1857,21 +2145,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 52($sp) # internal_1 = address of allocated object Int + sw $v0, 92($sp) # internal_1 = address of allocated object Int # Get attribute y of self - lw $t0, 60($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t0, 100($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8730036285103 + beq $t6, $t5, int_get_attribute_8758062314262 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8730036285103 - j object_get_attribute_8730036285103 - int_get_attribute_8730036285103: + beq $t6, $t5, bool_get_attribute_8758062314262 + j object_get_attribute_8758062314262 + int_get_attribute_8758062314262: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1879,9 +2167,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 48($sp) # internal_2 = self.y - j end_get_attribute_8730036285103 - bool_get_attribute_8730036285103: + sw $v0, 88($sp) # internal_2 = self.y + j end_get_attribute_8758062314262 + bool_get_attribute_8758062314262: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1889,11 +2177,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 48($sp) # internal_2 = self.y - j end_get_attribute_8730036285103 - object_get_attribute_8730036285103: - sw $t1, 48($sp) # internal_2 = y - end_get_attribute_8730036285103: + sw $v0, 88($sp) # internal_2 = self.y + j end_get_attribute_8758062314262 + object_get_attribute_8758062314262: + sw $t1, 88($sp) # internal_2 = self.y + end_get_attribute_8758062314262: # Allocating Int 0 li $v0, 9 @@ -1905,54 +2193,54 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_3 = address of allocated object Int + sw $v0, 84($sp) # internal_3 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_2 - lw $t0, 60($sp) + lw $t0, 100($sp) sw $t0, 4($sp) # Storing internal_2 # Argument internal_3 - lw $t0, 56($sp) + lw $t0, 96($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 52($sp) # internal_4 = result of function_equal + sw $v1, 92($sp) # internal_4 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_1 = internal_4 - lw $t0, 40($sp) - sw $t0, 52($sp) + lw $t0, 80($sp) + sw $t0, 92($sp) - # If internal_1 then goto then_8730036302746 - lw $t0, 52($sp) # Loading the address of the condition + # If internal_1 then goto then_8758062354167 + lw $t0, 92($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8730036302746 + beq $t0, $t1, then_8758062354167 - # Jumping to else_8730036302746 - j else_8730036302746 + # Jumping to else_8758062354167 + j else_8758062354167 - then_8730036302746: + then_8758062354167: # Get attribute x of self - lw $t0, 60($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t0, 100($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8730036285956 + beq $t6, $t5, int_get_attribute_8758062314343 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8730036285956 - j object_get_attribute_8730036285956 - int_get_attribute_8730036285956: + beq $t6, $t5, bool_get_attribute_8758062314343 + j object_get_attribute_8758062314343 + int_get_attribute_8758062314343: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1960,9 +2248,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 36($sp) # internal_5 = self.x - j end_get_attribute_8730036285956 - bool_get_attribute_8730036285956: + sw $v0, 76($sp) # internal_5 = self.x + j end_get_attribute_8758062314343 + bool_get_attribute_8758062314343: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1970,52 +2258,76 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 36($sp) # internal_5 = self.x - j end_get_attribute_8730036285956 - object_get_attribute_8730036285956: - sw $t1, 36($sp) # internal_5 = x - end_get_attribute_8730036285956: + sw $v0, 76($sp) # internal_5 = self.x + j end_get_attribute_8758062314343 + object_get_attribute_8758062314343: + sw $t1, 76($sp) # internal_5 = self.x + end_get_attribute_8758062314343: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_7 = address of allocated object Int + + # Get method out_int of Complex + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 68($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 64($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 72($sp) + lw $t0, 112($sp) sw $t0, 4($sp) # Storing self # Argument internal_5 - lw $t0, 48($sp) + lw $t0, 88($sp) sw $t0, 0($sp) # Storing internal_5 - # Calling function function_out_int_at_IO - jal function_out_int_at_IO + # Calling function internal_8 + lw $t0, 76($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 44($sp) # internal_6 = result of function_out_int_at_IO + sw $v1, 84($sp) # internal_6 = result of internal_8 addi $sp, $sp, 12 # Freeing space for arguments # internal_0 = internal_6 - lw $t0, 32($sp) - sw $t0, 56($sp) + lw $t0, 72($sp) + sw $t0, 96($sp) - # Jumping to endif_8730036302746 - j endif_8730036302746 + # Jumping to endif_8758062354167 + j endif_8758062354167 - else_8730036302746: + else_8758062354167: # Get attribute x of self - lw $t0, 60($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t0, 100($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8730036286049 + beq $t6, $t5, int_get_attribute_8758062314460 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8730036286049 - j object_get_attribute_8730036286049 - int_get_attribute_8730036286049: + beq $t6, $t5, bool_get_attribute_8758062314460 + j object_get_attribute_8758062314460 + int_get_attribute_8758062314460: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2023,9 +2335,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 28($sp) # internal_7 = self.x - j end_get_attribute_8730036286049 - bool_get_attribute_8730036286049: + sw $v0, 60($sp) # internal_9 = self.x + j end_get_attribute_8758062314460 + bool_get_attribute_8758062314460: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2033,28 +2345,52 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 28($sp) # internal_7 = self.x - j end_get_attribute_8730036286049 - object_get_attribute_8730036286049: - sw $t1, 28($sp) # internal_7 = x - end_get_attribute_8730036286049: + sw $v0, 60($sp) # internal_9 = self.x + j end_get_attribute_8758062314460 + object_get_attribute_8758062314460: + sw $t1, 60($sp) # internal_9 = self.x + end_get_attribute_8758062314460: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_11 = address of allocated object Int + + # Get method out_int of Complex + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 52($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 48($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 72($sp) + lw $t0, 112($sp) sw $t0, 4($sp) # Storing self - # Argument internal_7 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_7 + # Argument internal_9 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_9 - # Calling function function_out_int_at_IO - jal function_out_int_at_IO + # Calling function internal_12 + lw $t0, 60($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 36($sp) # internal_8 = result of function_out_int_at_IO + sw $v1, 68($sp) # internal_10 = result of internal_12 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -2069,43 +2405,67 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 43 - sb $t0, 8($v0) # internal_9[0] = '+' + sb $t0, 8($v0) # internal_13[0] = '+' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 20($sp) # internal_9 = "+" + sw $v0, 44($sp) # internal_13 = "+" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_15 = address of allocated object Int + + # Get method out_string of Complex + lw $t0, 56($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 36($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 32($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_8 - lw $t0, 36($sp) - sw $t0, 4($sp) # Storing internal_8 + # Argument internal_10 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_10 - # Argument internal_9 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_9 + # Argument internal_13 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_13 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_16 + lw $t0, 44($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 28($sp) # internal_10 = result of function_out_string_at_IO + sw $v1, 52($sp) # internal_14 = result of internal_16 addi $sp, $sp, 12 # Freeing space for arguments # Get attribute y of self - lw $t0, 60($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t0, 100($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8730036286097 + beq $t6, $t5, int_get_attribute_8758062314816 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8730036286097 - j object_get_attribute_8730036286097 - int_get_attribute_8730036286097: + beq $t6, $t5, bool_get_attribute_8758062314816 + j object_get_attribute_8758062314816 + int_get_attribute_8758062314816: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2113,9 +2473,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_11 = self.y - j end_get_attribute_8730036286097 - bool_get_attribute_8730036286097: + sw $v0, 28($sp) # internal_17 = self.y + j end_get_attribute_8758062314816 + bool_get_attribute_8758062314816: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2123,28 +2483,52 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_11 = self.y - j end_get_attribute_8730036286097 - object_get_attribute_8730036286097: - sw $t1, 12($sp) # internal_11 = y - end_get_attribute_8730036286097: + sw $v0, 28($sp) # internal_17 = self.y + j end_get_attribute_8758062314816 + object_get_attribute_8758062314816: + sw $t1, 28($sp) # internal_17 = self.y + end_get_attribute_8758062314816: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_19 = address of allocated object Int + + # Get method out_int of Complex + lw $t0, 40($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_10 - lw $t0, 28($sp) - sw $t0, 4($sp) # Storing internal_10 + # Argument internal_14 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_14 - # Argument internal_11 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_11 + # Argument internal_17 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_17 - # Calling function function_out_int_at_IO - jal function_out_int_at_IO + # Calling function internal_20 + lw $t0, 28($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 20($sp) # internal_12 = result of function_out_int_at_IO + sw $v1, 36($sp) # internal_18 = result of internal_20 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -2159,44 +2543,68 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 73 - sb $t0, 8($v0) # internal_13[0] = 'I' + sb $t0, 8($v0) # internal_21[0] = 'I' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_13 = "I" + sw $v0, 12($sp) # internal_21 = "I" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_23 = address of allocated object Int + + # Get method out_string of Complex + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_12 - lw $t0, 20($sp) - sw $t0, 4($sp) # Storing internal_12 + # Argument internal_18 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_18 - # Argument internal_13 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_13 + # Argument internal_21 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_21 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_24 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_14 = result of function_out_string_at_IO + sw $v1, 20($sp) # internal_22 = result of internal_24 addi $sp, $sp, 12 # Freeing space for arguments - # internal_0 = internal_14 - lw $t0, 0($sp) - sw $t0, 56($sp) + # internal_0 = internal_22 + lw $t0, 8($sp) + sw $t0, 96($sp) - # Jumping to endif_8730036302746 - j endif_8730036302746 + # Jumping to endif_8758062354167 + j endif_8758062354167 - endif_8730036302746: + endif_8758062354167: # Loading return value in $v1 - lw $v1, 56($sp) + lw $v1, 96($sp) # Freeing space for local variables - addi $sp, $sp, 60 + addi $sp, $sp, 100 jr $ra @@ -2210,17 +2618,17 @@ # Get attribute x of self lw $t0, 48($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t1, 8($t0) # Get the attribute 'x' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8730036286196 + beq $t6, $t5, int_get_attribute_8758062314963 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8730036286196 - j object_get_attribute_8730036286196 - int_get_attribute_8730036286196: + beq $t6, $t5, bool_get_attribute_8758062314963 + j object_get_attribute_8758062314963 + int_get_attribute_8758062314963: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2229,8 +2637,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 44($sp) # internal_0 = self.x - j end_get_attribute_8730036286196 - bool_get_attribute_8730036286196: + j end_get_attribute_8758062314963 + bool_get_attribute_8758062314963: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2239,24 +2647,24 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 44($sp) # internal_0 = self.x - j end_get_attribute_8730036286196 - object_get_attribute_8730036286196: - sw $t1, 44($sp) # internal_0 = x - end_get_attribute_8730036286196: + j end_get_attribute_8758062314963 + object_get_attribute_8758062314963: + sw $t1, 44($sp) # internal_0 = self.x + end_get_attribute_8758062314963: # Get attribute x of self lw $t0, 48($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t1, 8($t0) # Get the attribute 'x' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8730036286736 + beq $t6, $t5, int_get_attribute_8758062314987 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8730036286736 - j object_get_attribute_8730036286736 - int_get_attribute_8730036286736: + beq $t6, $t5, bool_get_attribute_8758062314987 + j object_get_attribute_8758062314987 + int_get_attribute_8758062314987: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2265,8 +2673,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 40($sp) # internal_1 = self.x - j end_get_attribute_8730036286736 - bool_get_attribute_8730036286736: + j end_get_attribute_8758062314987 + bool_get_attribute_8758062314987: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2275,10 +2683,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 40($sp) # internal_1 = self.x - j end_get_attribute_8730036286736 - object_get_attribute_8730036286736: - sw $t1, 40($sp) # internal_1 = x - end_get_attribute_8730036286736: + j end_get_attribute_8758062314987 + object_get_attribute_8758062314987: + sw $t1, 40($sp) # internal_1 = self.x + end_get_attribute_8758062314987: # Allocating Int 1 li $v0, 9 @@ -2372,17 +2780,17 @@ # Get attribute y of self lw $t0, 48($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t1, 12($t0) # Get the attribute 'y' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8730036286835 + beq $t6, $t5, int_get_attribute_8758062315346 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8730036286835 - j object_get_attribute_8730036286835 - int_get_attribute_8730036286835: + beq $t6, $t5, bool_get_attribute_8758062315346 + j object_get_attribute_8758062315346 + int_get_attribute_8758062315346: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2391,8 +2799,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 20($sp) # internal_6 = self.y - j end_get_attribute_8730036286835 - bool_get_attribute_8730036286835: + j end_get_attribute_8758062315346 + bool_get_attribute_8758062315346: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2401,24 +2809,24 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 20($sp) # internal_6 = self.y - j end_get_attribute_8730036286835 - object_get_attribute_8730036286835: - sw $t1, 20($sp) # internal_6 = y - end_get_attribute_8730036286835: + j end_get_attribute_8758062315346 + object_get_attribute_8758062315346: + sw $t1, 20($sp) # internal_6 = self.y + end_get_attribute_8758062315346: # Get attribute y of self lw $t0, 48($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t1, 12($t0) # Get the attribute 'y' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8730036286859 + beq $t6, $t5, int_get_attribute_8758062315370 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8730036286859 - j object_get_attribute_8730036286859 - int_get_attribute_8730036286859: + beq $t6, $t5, bool_get_attribute_8758062315370 + j object_get_attribute_8758062315370 + int_get_attribute_8758062315370: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2427,8 +2835,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($sp) # internal_7 = self.y - j end_get_attribute_8730036286859 - bool_get_attribute_8730036286859: + j end_get_attribute_8758062315370 + bool_get_attribute_8758062315370: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2437,10 +2845,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($sp) # internal_7 = self.y - j end_get_attribute_8730036286859 - object_get_attribute_8730036286859: - sw $t1, 16($sp) # internal_7 = y - end_get_attribute_8730036286859: + j end_get_attribute_8758062315370 + object_get_attribute_8758062315370: + sw $t1, 16($sp) # internal_7 = self.y + end_get_attribute_8758062315370: # Allocating Int 1 li $v0, 9 @@ -2550,17 +2958,17 @@ # Get attribute y of self lw $t0, 24($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t1, 12($t0) # Get the attribute 'y' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8730036287492 + beq $t6, $t5, int_get_attribute_8758062315487 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8730036287492 - j object_get_attribute_8730036287492 - int_get_attribute_8730036287492: + beq $t6, $t5, bool_get_attribute_8758062315487 + j object_get_attribute_8758062315487 + int_get_attribute_8758062315487: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2569,8 +2977,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 20($sp) # internal_0 = self.y - j end_get_attribute_8730036287492 - bool_get_attribute_8730036287492: + j end_get_attribute_8758062315487 + bool_get_attribute_8758062315487: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2579,24 +2987,24 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 20($sp) # internal_0 = self.y - j end_get_attribute_8730036287492 - object_get_attribute_8730036287492: - sw $t1, 20($sp) # internal_0 = y - end_get_attribute_8730036287492: + j end_get_attribute_8758062315487 + object_get_attribute_8758062315487: + sw $t1, 20($sp) # internal_0 = self.y + end_get_attribute_8758062315487: # Get attribute y of self lw $t0, 24($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t1, 12($t0) # Get the attribute 'y' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8730036287516 + beq $t6, $t5, int_get_attribute_8758062315511 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8730036287516 - j object_get_attribute_8730036287516 - int_get_attribute_8730036287516: + beq $t6, $t5, bool_get_attribute_8758062315511 + j object_get_attribute_8758062315511 + int_get_attribute_8758062315511: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2605,8 +3013,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($sp) # internal_1 = self.y - j end_get_attribute_8730036287516 - bool_get_attribute_8730036287516: + j end_get_attribute_8758062315511 + bool_get_attribute_8758062315511: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2615,10 +3023,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($sp) # internal_1 = self.y - j end_get_attribute_8730036287516 - object_get_attribute_8730036287516: - sw $t1, 16($sp) # internal_1 = y - end_get_attribute_8730036287516: + j end_get_attribute_8758062315511 + object_get_attribute_8758062315511: + sw $t1, 16($sp) # internal_1 = self.y + end_get_attribute_8758062315511: # Allocating Int 1 li $v0, 9 @@ -2728,17 +3136,17 @@ # Get attribute x of self lw $t0, 24($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t1, 8($t0) # Get the attribute 'x' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8730036287633 + beq $t6, $t5, int_get_attribute_8758062316144 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8730036287633 - j object_get_attribute_8730036287633 - int_get_attribute_8730036287633: + beq $t6, $t5, bool_get_attribute_8758062316144 + j object_get_attribute_8758062316144 + int_get_attribute_8758062316144: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2747,8 +3155,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 20($sp) # internal_0 = self.x - j end_get_attribute_8730036287633 - bool_get_attribute_8730036287633: + j end_get_attribute_8758062316144 + bool_get_attribute_8758062316144: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2757,24 +3165,24 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 20($sp) # internal_0 = self.x - j end_get_attribute_8730036287633 - object_get_attribute_8730036287633: - sw $t1, 20($sp) # internal_0 = x - end_get_attribute_8730036287633: + j end_get_attribute_8758062316144 + object_get_attribute_8758062316144: + sw $t1, 20($sp) # internal_0 = self.x + end_get_attribute_8758062316144: # Get attribute x of self lw $t0, 24($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t1, 8($t0) # Get the attribute 'x' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8730036287657 + beq $t6, $t5, int_get_attribute_8758062316168 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8730036287657 - j object_get_attribute_8730036287657 - int_get_attribute_8730036287657: + beq $t6, $t5, bool_get_attribute_8758062316168 + j object_get_attribute_8758062316168 + int_get_attribute_8758062316168: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2783,8 +3191,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($sp) # internal_1 = self.x - j end_get_attribute_8730036287657 - bool_get_attribute_8730036287657: + j end_get_attribute_8758062316168 + bool_get_attribute_8758062316168: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2793,10 +3201,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($sp) # internal_1 = self.x - j end_get_attribute_8730036287657 - object_get_attribute_8730036287657: - sw $t1, 16($sp) # internal_1 = x - end_get_attribute_8730036287657: + j end_get_attribute_8758062316168 + object_get_attribute_8758062316168: + sw $t1, 16($sp) # internal_1 = self.x + end_get_attribute_8758062316168: # Allocating Int 1 li $v0, 9 @@ -2898,7 +3306,7 @@ main: # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Allocating Main li $v0, 9 @@ -2907,34 +3315,58 @@ la $t0, type_Main # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object Main + sw $v0, 12($sp) # internal_0 = address of allocated object Main # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_Main jal function___init___at_Main lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_main_at_Main - jal function_main_at_Main + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + sw $v1, 16($sp) # internal_1 = result of internal_3 addi $sp, $sp, 8 # Freeing space for arguments # Exit program diff --git a/tests/codegen/fib.mips b/tests/codegen/fib.mips index 0ab3ea35b..41559974f 100644 --- a/tests/codegen/fib.mips +++ b/tests/codegen/fib.mips @@ -1,45 +1,82 @@ .data - type_Object: .word 8 + type_Object: .word 24 type_Object_inherits_from: .word 0 - type_Object_attributes: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_Main: .word 48 + type_Main_inherits_from: .word type_IO + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_out_string: .word function_out_string_at_IO + type_Main_out_int: .word function_out_int_at_IO + type_Main_in_string: .word function_in_string_at_IO + type_Main_in_int: .word function_in_int_at_IO + type_Main_main: .word function_main_at_Main + type_Main_fib: .word function_fib_at_Main + type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" - type_Object_abort_message: .asciiz "Abort called from class Object\n" - type_IO: .word 8 - type_IO_inherits_from: .word type_Object - type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" - type_IO_abort_message: .asciiz "Abort called from class IO\n" - - type_Int: .word 8 - type_Int_inherits_from: .word type_Object - type_Int_attributes: .word 0 - type_Int_name_size: .word 3 - type_Int_name: .asciiz "Int" - type_Int_abort_message: .asciiz "Abort called from class Int\n" - type_String: .word 8 - type_String_inherits_from: .word type_Object - type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" - type_String_abort_message: .asciiz "Abort called from class String\n" - type_Bool: .word 8 - type_Bool_inherits_from: .word type_Object - type_Bool_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" - type_Bool_abort_message: .asciiz "Abort called from class Bool\n" - type_Main: .word 8 - type_Main_inherits_from: .word type_IO - type_Main_attributes: .word 0 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" - type_Main_abort_message: .asciiz "Abort called from class Main\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -700,11 +737,11 @@ function_abort_at_Object: # Function parameters - # $ra = 20($sp) - # self = 16($sp) + # $ra = 28($sp) + # self = 24($sp) # Reserving space for local variables - addi $sp, $sp, -16 + addi $sp, $sp, -24 # Allocating String li $v0, 9 @@ -791,7 +828,7 @@ sb $zero, 32($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_0 = "Abort called from class " + sw $v0, 20($sp) # internal_0 = "Abort called from class " # Allocating String li $v0, 9 @@ -805,66 +842,138 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_2[0] = '\n' + sb $t0, 8($v0) # internal_3[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_2 = "\n" + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 0($sp) # Storing self - # Calling function function_type_name_at_Object - jal function_type_name_at_Object + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + sw $v1, 24($sp) # internal_1 = result of internal_5 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_0 - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing internal_0 # Argument internal_1 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_1 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_3 - lw $t0, 12($sp) - sw $t0, 4($sp) # Storing internal_3 - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 - # Calling function function_concat_at_String - jal function_concat_at_String + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) # $t0 = internal_3 + lw $t0, 12($sp) # $t0 = internal_2 addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string internal_3 + # Printing the String internal_2 li $v0, 4 move $a0, $t0 syscall @@ -874,10 +983,10 @@ syscall # Loading return value in $v1 - lw $v1, 16($sp) + lw $v1, 24($sp) # Freeing space for local variables - addi $sp, $sp, 16 + addi $sp, $sp, 24 jr $ra @@ -892,8 +1001,9 @@ # internal_0 = name of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($t0) # $t1 = type of self - lw $t2, 12($t1) # $t1 = length of the name of self - la $t3, 16($t1) # $t1 = name of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 @@ -996,7 +1106,7 @@ lw $t0, 0($sp) # $t0 = x addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string x + # Printing the String x li $v0, 4 move $a0, $t0 syscall @@ -1012,7 +1122,7 @@ # self = 4($sp) # x = 0($sp) - # Printing the string x + # Printing the Int x li $v0, 1 lw $a0, 0($sp) lw $a0, 8($a0) @@ -1039,11 +1149,13 @@ xor $t0, $t0, $t0 # Initializing counter while_read_start: lb $t1, buffer_input($t0) # Loading the byte - beq $t1, $zero, while_read_end + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end addi $t0, $t0, 1 # Incrementing counter j while_read_start while_read_end: - addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 @@ -1290,6 +1402,26 @@ jr $ra + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + function___init___at_Main: # Function parameters # $ra = 4($sp) @@ -1302,11 +1434,11 @@ function_main_at_Main: # Function parameters - # $ra = 32($sp) - # self = 28($sp) + # $ra = 72($sp) + # self = 68($sp) # Reserving space for local variables - addi $sp, $sp, -28 + addi $sp, $sp, -68 # Allocating String li $v0, 9 @@ -1435,74 +1567,170 @@ sb $zero, 46($v0) # Null-terminator at the end of the string - sw $v0, 24($sp) # internal_0 = "Enter n to find nth fibonacci number!\n" + sw $v0, 64($sp) # internal_0 = "Enter n to find nth fibonacci number!\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_2 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 68($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 56($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 52($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 40($sp) + lw $t0, 80($sp) sw $t0, 4($sp) # Storing self # Argument internal_0 - lw $t0, 36($sp) + lw $t0, 76($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_3 + lw $t0, 64($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 32($sp) # internal_1 = result of function_out_string_at_IO + sw $v1, 72($sp) # internal_1 = result of internal_3 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_5 = address of allocated object Int + + # Get method in_int of Main + lw $t0, 68($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 44($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 40($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 36($sp) + lw $t0, 76($sp) sw $t0, 0($sp) # Storing self - # Calling function function_in_int_at_IO - jal function_in_int_at_IO + # Calling function internal_6 + lw $t0, 48($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 24($sp) # internal_2 = result of function_in_int_at_IO + sw $v1, 56($sp) # internal_4 = result of internal_6 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_8 = address of allocated object Int + + # Get method fib of Main + lw $t0, 68($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 32($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 28($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 40($sp) + lw $t0, 80($sp) sw $t0, 4($sp) # Storing self - # Argument internal_2 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_2 + # Argument internal_4 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_4 - # Calling function function_fib_at_Main - jal function_fib_at_Main + # Calling function internal_9 + lw $t0, 40($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 24($sp) # internal_3 = result of function_fib_at_Main + sw $v1, 48($sp) # internal_7 = result of internal_9 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_11 = address of allocated object Int + + # Get method out_int of Main + lw $t0, 68($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 40($sp) + lw $t0, 80($sp) sw $t0, 4($sp) # Storing self - # Argument internal_3 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_3 + # Argument internal_7 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_7 - # Calling function function_out_int_at_IO - jal function_out_int_at_IO + # Calling function internal_12 + lw $t0, 28($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 20($sp) # internal_4 = result of function_out_int_at_IO + sw $v1, 36($sp) # internal_10 = result of internal_12 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -1517,46 +1745,70 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_5[0] = '\n' + sb $t0, 8($v0) # internal_13[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_5 = "\n" + sw $v0, 12($sp) # internal_13 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_15 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 68($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 40($sp) + lw $t0, 80($sp) sw $t0, 4($sp) # Storing self - # Argument internal_5 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_5 + # Argument internal_13 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_13 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_16 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_6 = result of function_out_string_at_IO + sw $v1, 20($sp) # internal_14 = result of internal_16 addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 28 + addi $sp, $sp, 68 jr $ra function_fib_at_Main: # Function parameters - # $ra = 60($sp) - # self = 56($sp) - # i = 52($sp) + # $ra = 64($sp) + # self = 60($sp) + # i = 56($sp) # Reserving space for local variables - addi $sp, $sp, -52 + addi $sp, $sp, -56 # Allocating Int 1 li $v0, 9 @@ -1568,24 +1820,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_1 = address of allocated object Int + sw $v0, 48($sp) # internal_1 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument a - lw $t0, 60($sp) + lw $t0, 64($sp) sw $t0, 4($sp) # Storing a # Argument internal_1 - lw $t0, 56($sp) + lw $t0, 60($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 60($sp) # a = result of function_assign + sw $v1, 64($sp) # a = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 0 @@ -1598,24 +1850,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_3 = address of allocated object Int + sw $v0, 40($sp) # internal_3 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument b - lw $t0, 52($sp) + lw $t0, 56($sp) sw $t0, 4($sp) # Storing b # Argument internal_3 - lw $t0, 48($sp) + lw $t0, 52($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 52($sp) # b = result of function_assign + sw $v1, 56($sp) # b = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 0 @@ -1628,27 +1880,30 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_5 = address of allocated object Int + sw $v0, 32($sp) # internal_5 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument c - lw $t0, 44($sp) + lw $t0, 48($sp) sw $t0, 4($sp) # Storing c # Argument internal_5 - lw $t0, 40($sp) + lw $t0, 44($sp) sw $t0, 0($sp) # Storing internal_5 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 44($sp) # c = result of function_assign + sw $v1, 48($sp) # c = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - while_start_8738767818289: + # Allocating NUll to internal_6 + sw $zero, 28($sp) # internal_6 = 0 + + while_start_8732083779214: # Allocating Int 0 li $v0, 9 @@ -1660,24 +1915,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_6 = address of allocated object Int + sw $v0, 24($sp) # internal_7 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 64($sp) + lw $t0, 68($sp) sw $t0, 4($sp) # Storing i - # Argument internal_6 + # Argument internal_7 lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_6 + sw $t0, 0($sp) # Storing internal_7 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 32($sp) # internal_7 = result of function_equal + sw $v1, 32($sp) # internal_8 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -1690,7 +1945,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_8 = address of allocated object Int + sw $v0, 16($sp) # internal_9 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -1702,53 +1957,53 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_9 = address of allocated object Int + sw $v0, 12($sp) # internal_10 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_7 + # Argument internal_8 lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_7 + sw $t0, 4($sp) # Storing internal_8 - # Argument internal_8 + # Argument internal_9 lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_8 + sw $t0, 0($sp) # Storing internal_9 # Calling function function_xor jal function_xor lw $ra, 8($sp) - sw $v1, 24($sp) # internal_9 = result of function_xor + sw $v1, 24($sp) # internal_10 = result of function_xor addi $sp, $sp, 12 # Freeing space for arguments - # If internal_9 then goto while_body_8738767818289 + # If internal_10 then goto while_body_8732083779214 lw $t0, 12($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8738767818289 + beq $t0, $t1, while_body_8732083779214 - # Jumping to while_end_8738767818289 - j while_end_8738767818289 + # Jumping to while_end_8732083779214 + j while_end_8732083779214 - while_body_8738767818289: + while_body_8732083779214: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument a - lw $t0, 60($sp) + lw $t0, 64($sp) sw $t0, 4($sp) # Storing a # Argument b - lw $t0, 52($sp) + lw $t0, 56($sp) sw $t0, 0($sp) # Storing b # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 20($sp) # internal_10 = result of function_add + sw $v1, 20($sp) # internal_11 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -1756,17 +2011,17 @@ sw $ra, 8($sp) # Storing return address # Argument c - lw $t0, 44($sp) + lw $t0, 48($sp) sw $t0, 4($sp) # Storing c - # Argument internal_10 + # Argument internal_11 lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_10 + sw $t0, 0($sp) # Storing internal_11 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 44($sp) # c = result of function_assign + sw $v1, 48($sp) # c = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -1779,24 +2034,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_11 = address of allocated object Int + sw $v0, 4($sp) # internal_12 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 64($sp) + lw $t0, 68($sp) sw $t0, 4($sp) # Storing i - # Argument internal_11 + # Argument internal_12 lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_11 + sw $t0, 0($sp) # Storing internal_12 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 12($sp) # internal_12 = result of function_sub + sw $v1, 12($sp) # internal_13 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -1804,17 +2059,17 @@ sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 64($sp) + lw $t0, 68($sp) sw $t0, 4($sp) # Storing i - # Argument internal_12 + # Argument internal_13 lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_12 + sw $t0, 0($sp) # Storing internal_13 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 64($sp) # i = result of function_assign + sw $v1, 68($sp) # i = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -1822,17 +2077,17 @@ sw $ra, 8($sp) # Storing return address # Argument b - lw $t0, 52($sp) + lw $t0, 56($sp) sw $t0, 4($sp) # Storing b # Argument a - lw $t0, 60($sp) + lw $t0, 64($sp) sw $t0, 0($sp) # Storing a # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 52($sp) # b = result of function_assign + sw $v1, 56($sp) # b = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -1840,35 +2095,35 @@ sw $ra, 8($sp) # Storing return address # Argument a - lw $t0, 60($sp) + lw $t0, 64($sp) sw $t0, 4($sp) # Storing a # Argument c - lw $t0, 44($sp) + lw $t0, 48($sp) sw $t0, 0($sp) # Storing c # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 60($sp) # a = result of function_assign + sw $v1, 64($sp) # a = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to while_start_8738767818289 - j while_start_8738767818289 + # Jumping to while_start_8732083779214 + j while_start_8732083779214 - while_end_8738767818289: + while_end_8732083779214: # Loading return value in $v1 - lw $v1, 32($sp) + lw $v1, 36($sp) # Freeing space for local variables - addi $sp, $sp, 52 + addi $sp, $sp, 56 jr $ra main: # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Allocating Main li $v0, 9 @@ -1877,34 +2132,58 @@ la $t0, type_Main # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object Main + sw $v0, 12($sp) # internal_0 = address of allocated object Main # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_Main jal function___init___at_Main lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_main_at_Main - jal function_main_at_Main + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + sw $v1, 16($sp) # internal_1 = result of internal_3 addi $sp, $sp, 8 # Freeing space for arguments # Exit program diff --git a/tests/codegen/graph.mips b/tests/codegen/graph.mips index 5c9a68a6b..41c8852ef 100644 --- a/tests/codegen/graph.mips +++ b/tests/codegen/graph.mips @@ -1,108 +1,254 @@ .data - type_Object: .word 8 + type_Object: .word 24 type_Object_inherits_from: .word 0 - type_Object_attributes: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_Graph: .word 44 + type_Graph_inherits_from: .word type_Object + type_Graph_name_address: .word type_Graph_name_size + type_Graph___init__: .word function___init___at_Graph + type_Graph_abort: .word function_abort_at_Object + type_Graph_type_name: .word function_type_name_at_Object + type_Graph_copy: .word function_copy_at_Object + type_Graph_add_vertice: .word function_add_vertice_at_Graph + type_Graph_print_E: .word function_print_E_at_Graph + type_Graph_print_V: .word function_print_V_at_Graph + + type_Vertice: .word 68 + type_Vertice_inherits_from: .word type_IO + type_Vertice_name_address: .word type_Vertice_name_size + type_Vertice___init__: .word function___init___at_Vertice + type_Vertice_abort: .word function_abort_at_Object + type_Vertice_type_name: .word function_type_name_at_Object + type_Vertice_copy: .word function_copy_at_Object + type_Vertice_out_string: .word function_out_string_at_IO + type_Vertice_out_int: .word function_out_int_at_IO + type_Vertice_in_string: .word function_in_string_at_IO + type_Vertice_in_int: .word function_in_int_at_IO + type_Vertice_outgoing: .word function_outgoing_at_Vertice + type_Vertice_number: .word function_number_at_Vertice + type_Vertice_init: .word function_init_at_Vertice + type_Vertice_add_out: .word function_add_out_at_Vertice + type_Vertice_print: .word function_print_at_Vertice + + type_Edge: .word 60 + type_Edge_inherits_from: .word type_IO + type_Edge_name_address: .word type_Edge_name_size + type_Edge___init__: .word function___init___at_Edge + type_Edge_abort: .word function_abort_at_Object + type_Edge_type_name: .word function_type_name_at_Object + type_Edge_copy: .word function_copy_at_Object + type_Edge_out_string: .word function_out_string_at_IO + type_Edge_out_int: .word function_out_int_at_IO + type_Edge_in_string: .word function_in_string_at_IO + type_Edge_in_int: .word function_in_int_at_IO + type_Edge_init: .word function_init_at_Edge + type_Edge_print: .word function_print_at_Edge + + type_EList: .word 68 + type_EList_inherits_from: .word type_IO + type_EList_name_address: .word type_EList_name_size + type_EList___init__: .word function___init___at_EList + type_EList_abort: .word function_abort_at_Object + type_EList_type_name: .word function_type_name_at_Object + type_EList_copy: .word function_copy_at_Object + type_EList_out_string: .word function_out_string_at_IO + type_EList_out_int: .word function_out_int_at_IO + type_EList_in_string: .word function_in_string_at_IO + type_EList_in_int: .word function_in_int_at_IO + type_EList_isNil: .word function_isNil_at_EList + type_EList_head: .word function_head_at_EList + type_EList_tail: .word function_tail_at_EList + type_EList_cons: .word function_cons_at_EList + type_EList_append: .word function_append_at_EList + type_EList_print: .word function_print_at_EList + + type_ECons: .word 76 + type_ECons_inherits_from: .word type_EList + type_ECons_name_address: .word type_ECons_name_size + type_ECons___init__: .word function___init___at_ECons + type_ECons_abort: .word function_abort_at_Object + type_ECons_type_name: .word function_type_name_at_Object + type_ECons_copy: .word function_copy_at_Object + type_ECons_out_string: .word function_out_string_at_IO + type_ECons_out_int: .word function_out_int_at_IO + type_ECons_in_string: .word function_in_string_at_IO + type_ECons_in_int: .word function_in_int_at_IO + type_ECons_isNil: .word function_isNil_at_ECons + type_ECons_head: .word function_head_at_ECons + type_ECons_tail: .word function_tail_at_ECons + type_ECons_cons: .word function_cons_at_EList + type_ECons_append: .word function_append_at_EList + type_ECons_print: .word function_print_at_ECons + type_ECons_init: .word function_init_at_ECons + + type_VList: .word 64 + type_VList_inherits_from: .word type_IO + type_VList_name_address: .word type_VList_name_size + type_VList___init__: .word function___init___at_VList + type_VList_abort: .word function_abort_at_Object + type_VList_type_name: .word function_type_name_at_Object + type_VList_copy: .word function_copy_at_Object + type_VList_out_string: .word function_out_string_at_IO + type_VList_out_int: .word function_out_int_at_IO + type_VList_in_string: .word function_in_string_at_IO + type_VList_in_int: .word function_in_int_at_IO + type_VList_isNil: .word function_isNil_at_VList + type_VList_head: .word function_head_at_VList + type_VList_tail: .word function_tail_at_VList + type_VList_cons: .word function_cons_at_VList + type_VList_print: .word function_print_at_VList + + type_VCons: .word 72 + type_VCons_inherits_from: .word type_VList + type_VCons_name_address: .word type_VCons_name_size + type_VCons___init__: .word function___init___at_VCons + type_VCons_abort: .word function_abort_at_Object + type_VCons_type_name: .word function_type_name_at_Object + type_VCons_copy: .word function_copy_at_Object + type_VCons_out_string: .word function_out_string_at_IO + type_VCons_out_int: .word function_out_int_at_IO + type_VCons_in_string: .word function_in_string_at_IO + type_VCons_in_int: .word function_in_int_at_IO + type_VCons_isNil: .word function_isNil_at_VCons + type_VCons_head: .word function_head_at_VCons + type_VCons_tail: .word function_tail_at_VCons + type_VCons_cons: .word function_cons_at_VList + type_VCons_print: .word function_print_at_VCons + type_VCons_init: .word function_init_at_VCons + + type_Parse: .word 68 + type_Parse_inherits_from: .word type_IO + type_Parse_name_address: .word type_Parse_name_size + type_Parse___init__: .word function___init___at_Parse + type_Parse_abort: .word function_abort_at_Object + type_Parse_type_name: .word function_type_name_at_Object + type_Parse_copy: .word function_copy_at_Object + type_Parse_out_string: .word function_out_string_at_IO + type_Parse_out_int: .word function_out_int_at_IO + type_Parse_in_string: .word function_in_string_at_IO + type_Parse_in_int: .word function_in_int_at_IO + type_Parse_read_input: .word function_read_input_at_Parse + type_Parse_parse_line: .word function_parse_line_at_Parse + type_Parse_c2i: .word function_c2i_at_Parse + type_Parse_a2i: .word function_a2i_at_Parse + type_Parse_a2i_aux: .word function_a2i_aux_at_Parse + + type_Main: .word 76 + type_Main_inherits_from: .word type_Parse + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_out_string: .word function_out_string_at_IO + type_Main_out_int: .word function_out_int_at_IO + type_Main_in_string: .word function_in_string_at_IO + type_Main_in_int: .word function_in_int_at_IO + type_Main_read_input: .word function_read_input_at_Parse + type_Main_parse_line: .word function_parse_line_at_Parse + type_Main_c2i: .word function_c2i_at_Parse + type_Main_a2i: .word function_a2i_at_Parse + type_Main_a2i_aux: .word function_a2i_aux_at_Parse + type_Main_main: .word function_main_at_Main + + type_BoolOp: .word 32 + type_BoolOp_inherits_from: .word type_Object + type_BoolOp_name_address: .word type_BoolOp_name_size + type_BoolOp___init__: .word function___init___at_BoolOp + type_BoolOp_abort: .word function_abort_at_Object + type_BoolOp_type_name: .word function_type_name_at_Object + type_BoolOp_copy: .word function_copy_at_Object + type_BoolOp_and: .word function_and_at_BoolOp + type_BoolOp_or: .word function_or_at_BoolOp + type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" - type_Object_abort_message: .asciiz "Abort called from class Object\n" - type_IO: .word 8 - type_IO_inherits_from: .word type_Object - type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" - type_IO_abort_message: .asciiz "Abort called from class IO\n" - - type_Int: .word 8 - type_Int_inherits_from: .word type_Object - type_Int_attributes: .word 0 - type_Int_name_size: .word 3 - type_Int_name: .asciiz "Int" - type_Int_abort_message: .asciiz "Abort called from class Int\n" - type_String: .word 8 - type_String_inherits_from: .word type_Object - type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" - type_String_abort_message: .asciiz "Abort called from class String\n" - type_Bool: .word 8 - type_Bool_inherits_from: .word type_Object - type_Bool_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" - type_Bool_abort_message: .asciiz "Abort called from class Bool\n" - type_Graph: .word 16 - type_Graph_inherits_from: .word type_Object - type_Graph_attributes: .word 2 type_Graph_name_size: .word 5 type_Graph_name: .asciiz "Graph" - type_Graph_abort_message: .asciiz "Abort called from class Graph\n" - type_Vertice: .word 16 - type_Vertice_inherits_from: .word type_IO - type_Vertice_attributes: .word 2 type_Vertice_name_size: .word 7 type_Vertice_name: .asciiz "Vertice" - type_Vertice_abort_message: .asciiz "Abort called from class Vertice\n" - type_Edge: .word 20 - type_Edge_inherits_from: .word type_IO - type_Edge_attributes: .word 3 type_Edge_name_size: .word 4 type_Edge_name: .asciiz "Edge" - type_Edge_abort_message: .asciiz "Abort called from class Edge\n" - type_EList: .word 12 - type_EList_inherits_from: .word type_IO - type_EList_attributes: .word 1 type_EList_name_size: .word 5 type_EList_name: .asciiz "EList" - type_EList_abort_message: .asciiz "Abort called from class EList\n" - type_ECons: .word 16 - type_ECons_inherits_from: .word type_EList - type_ECons_attributes: .word 2 type_ECons_name_size: .word 5 type_ECons_name: .asciiz "ECons" - type_ECons_abort_message: .asciiz "Abort called from class ECons\n" - type_VList: .word 12 - type_VList_inherits_from: .word type_IO - type_VList_attributes: .word 1 type_VList_name_size: .word 5 type_VList_name: .asciiz "VList" - type_VList_abort_message: .asciiz "Abort called from class VList\n" - type_VCons: .word 16 - type_VCons_inherits_from: .word type_VList - type_VCons_attributes: .word 2 type_VCons_name_size: .word 5 type_VCons_name: .asciiz "VCons" - type_VCons_abort_message: .asciiz "Abort called from class VCons\n" - type_Parse: .word 16 - type_Parse_inherits_from: .word type_IO - type_Parse_attributes: .word 2 type_Parse_name_size: .word 5 type_Parse_name: .asciiz "Parse" - type_Parse_abort_message: .asciiz "Abort called from class Parse\n" - type_Main: .word 20 - type_Main_inherits_from: .word type_Parse - type_Main_attributes: .word 3 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" - type_Main_abort_message: .asciiz "Abort called from class Main\n" - type_BoolOp: .word 8 - type_BoolOp_inherits_from: .word type_Object - type_BoolOp_attributes: .word 0 type_BoolOp_name_size: .word 6 type_BoolOp_name: .asciiz "BoolOp" - type_BoolOp_abort_message: .asciiz "Abort called from class BoolOp\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -763,11 +909,11 @@ function_abort_at_Object: # Function parameters - # $ra = 20($sp) - # self = 16($sp) + # $ra = 28($sp) + # self = 24($sp) # Reserving space for local variables - addi $sp, $sp, -16 + addi $sp, $sp, -24 # Allocating String li $v0, 9 @@ -854,7 +1000,7 @@ sb $zero, 32($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_0 = "Abort called from class " + sw $v0, 20($sp) # internal_0 = "Abort called from class " # Allocating String li $v0, 9 @@ -868,66 +1014,138 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_2[0] = '\n' + sb $t0, 8($v0) # internal_3[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_2 = "\n" + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 0($sp) # Storing self - # Calling function function_type_name_at_Object - jal function_type_name_at_Object + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + sw $v1, 24($sp) # internal_1 = result of internal_5 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_0 - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing internal_0 # Argument internal_1 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_1 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_3 - lw $t0, 12($sp) - sw $t0, 4($sp) # Storing internal_3 - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 - # Calling function function_concat_at_String - jal function_concat_at_String + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) # $t0 = internal_3 + lw $t0, 12($sp) # $t0 = internal_2 addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string internal_3 + # Printing the String internal_2 li $v0, 4 move $a0, $t0 syscall @@ -937,10 +1155,10 @@ syscall # Loading return value in $v1 - lw $v1, 16($sp) + lw $v1, 24($sp) # Freeing space for local variables - addi $sp, $sp, 16 + addi $sp, $sp, 24 jr $ra @@ -955,8 +1173,9 @@ # internal_0 = name of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($t0) # $t1 = type of self - lw $t2, 12($t1) # $t1 = length of the name of self - la $t3, 16($t1) # $t1 = name of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 @@ -1059,7 +1278,7 @@ lw $t0, 0($sp) # $t0 = x addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string x + # Printing the String x li $v0, 4 move $a0, $t0 syscall @@ -1075,7 +1294,7 @@ # self = 4($sp) # x = 0($sp) - # Printing the string x + # Printing the Int x li $v0, 1 lw $a0, 0($sp) lw $a0, 8($a0) @@ -1102,11 +1321,13 @@ xor $t0, $t0, $t0 # Initializing counter while_read_start: lb $t1, buffer_input($t0) # Loading the byte - beq $t1, $zero, while_read_end + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end addi $t0, $t0, 1 # Incrementing counter j while_read_start while_read_end: - addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 @@ -1353,6 +1574,26 @@ jr $ra + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + function___init___at_Graph: # Function parameters # $ra = 12($sp) @@ -1387,17 +1628,17 @@ # Set attribute vertices of self lw $t0, 8($sp) # $t0 = self lw $t1, 4($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8756104435866 + beq $t1, $zero, object_set_attribute_8772684627131 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104435866 + beq $t6, $t5, int_set_attribute_8772684627131 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104435866 - j object_set_attribute_8756104435866 - int_set_attribute_8756104435866: + beq $t6, $t5, bool_set_attribute_8772684627131 + j object_set_attribute_8772684627131 + int_set_attribute_8772684627131: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1406,8 +1647,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.vertices = internal_0 - j end_set_attribute_8756104435866 - bool_set_attribute_8756104435866: + j end_set_attribute_8772684627131 + bool_set_attribute_8772684627131: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1416,10 +1657,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.vertices = internal_0 - j end_set_attribute_8756104435866 - object_set_attribute_8756104435866: + j end_set_attribute_8772684627131 + object_set_attribute_8772684627131: sw $t1, 8($t0) # self.vertices = internal_0 - end_set_attribute_8756104435866: + end_set_attribute_8772684627131: # Allocating EList li $v0, 9 @@ -1447,17 +1688,17 @@ # Set attribute edges of self lw $t0, 8($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_1 - beq $t1, $zero, object_set_attribute_8756104435899 + beq $t1, $zero, object_set_attribute_8772684627164 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104435899 + beq $t6, $t5, int_set_attribute_8772684627164 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104435899 - j object_set_attribute_8756104435899 - int_set_attribute_8756104435899: + beq $t6, $t5, bool_set_attribute_8772684627164 + j object_set_attribute_8772684627164 + int_set_attribute_8772684627164: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1466,8 +1707,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.edges = internal_1 - j end_set_attribute_8756104435899 - bool_set_attribute_8756104435899: + j end_set_attribute_8772684627164 + bool_set_attribute_8772684627164: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1476,10 +1717,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.edges = internal_1 - j end_set_attribute_8756104435899 - object_set_attribute_8756104435899: + j end_set_attribute_8772684627164 + object_set_attribute_8772684627164: sw $t1, 12($t0) # self.edges = internal_1 - end_set_attribute_8756104435899: + end_set_attribute_8772684627164: # Loading return value in $v1 lw $v1, 8($sp) @@ -1491,40 +1732,64 @@ function_add_vertice_at_Graph: # Function parameters - # $ra = 28($sp) - # self = 24($sp) - # v = 20($sp) + # $ra = 52($sp) + # self = 48($sp) + # v = 44($sp) # Reserving space for local variables - addi $sp, $sp, -20 + addi $sp, $sp, -44 + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_1 = address of allocated object Int + + # Get method outgoing of Vertice + lw $t0, 44($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 36($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 32($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument v - lw $t0, 28($sp) + lw $t0, 52($sp) sw $t0, 0($sp) # Storing v - # Calling function function_outgoing_at_Vertice - jal function_outgoing_at_Vertice + # Calling function internal_2 + lw $t0, 40($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 24($sp) # internal_0 = result of function_outgoing_at_Vertice + sw $v1, 48($sp) # internal_0 = result of internal_2 addi $sp, $sp, 8 # Freeing space for arguments # Get attribute edges of self - lw $t0, 24($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'edges' from the instance + lw $t0, 48($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'edges' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8756104437029 + beq $t6, $t5, int_get_attribute_8772684628318 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8756104437029 - j object_get_attribute_8756104437029 - int_get_attribute_8756104437029: + beq $t6, $t5, bool_get_attribute_8772684628318 + j object_get_attribute_8772684628318 + int_get_attribute_8772684628318: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1532,9 +1797,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_1 = self.edges - j end_get_attribute_8756104437029 - bool_get_attribute_8756104437029: + sw $v0, 28($sp) # internal_3 = self.edges + j end_get_attribute_8772684628318 + bool_get_attribute_8772684628318: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1542,44 +1807,68 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_1 = self.edges - j end_get_attribute_8756104437029 - object_get_attribute_8756104437029: - sw $t1, 12($sp) # internal_1 = edges - end_get_attribute_8756104437029: + sw $v0, 28($sp) # internal_3 = self.edges + j end_get_attribute_8772684628318 + object_get_attribute_8772684628318: + sw $t1, 28($sp) # internal_3 = self.edges + end_get_attribute_8772684628318: + + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_5 = address of allocated object Int + + # Get method append of EList + lw $t0, 40($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_0 - lw $t0, 28($sp) + lw $t0, 52($sp) sw $t0, 4($sp) # Storing internal_0 - # Argument internal_1 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_1 + # Argument internal_3 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_3 - # Calling function function_append_at_EList - jal function_append_at_EList + # Calling function internal_6 + lw $t0, 28($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 20($sp) # internal_2 = result of function_append_at_EList + sw $v1, 36($sp) # internal_4 = result of internal_6 addi $sp, $sp, 12 # Freeing space for arguments # Set attribute edges of self - lw $t0, 24($sp) # $t0 = self - lw $t1, 8($sp) # $t1 = internal_2 - beq $t1, $zero, object_set_attribute_8756104435956 + lw $t0, 48($sp) # $t0 = self + lw $t1, 24($sp) # $t1 = internal_4 + beq $t1, $zero, object_set_attribute_8772684628249 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104435956 + beq $t6, $t5, int_set_attribute_8772684628249 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104435956 - j object_set_attribute_8756104435956 - int_set_attribute_8756104435956: + beq $t6, $t5, bool_set_attribute_8772684628249 + j object_set_attribute_8772684628249 + int_set_attribute_8772684628249: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1587,9 +1876,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.edges = internal_2 - j end_set_attribute_8756104435956 - bool_set_attribute_8756104435956: + sw $v0, 12($t0) # self.edges = internal_4 + j end_set_attribute_8772684628249 + bool_set_attribute_8772684628249: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1597,25 +1886,25 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.edges = internal_2 - j end_set_attribute_8756104435956 - object_set_attribute_8756104435956: - sw $t1, 12($t0) # self.edges = internal_2 - end_set_attribute_8756104435956: + sw $v0, 12($t0) # self.edges = internal_4 + j end_set_attribute_8772684628249 + object_set_attribute_8772684628249: + sw $t1, 12($t0) # self.edges = internal_4 + end_set_attribute_8772684628249: # Get attribute vertices of self - lw $t0, 24($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'vertices' from the instance + lw $t0, 48($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'vertices' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8756104437071 + beq $t6, $t5, int_get_attribute_8772684628384 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8756104437071 - j object_get_attribute_8756104437071 - int_get_attribute_8756104437071: + beq $t6, $t5, bool_get_attribute_8772684628384 + j object_get_attribute_8772684628384 + int_get_attribute_8772684628384: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1623,9 +1912,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_3 = self.vertices - j end_get_attribute_8756104437071 - bool_get_attribute_8756104437071: + sw $v0, 12($sp) # internal_7 = self.vertices + j end_get_attribute_8772684628384 + bool_get_attribute_8772684628384: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1633,44 +1922,68 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_3 = self.vertices - j end_get_attribute_8756104437071 - object_get_attribute_8756104437071: - sw $t1, 4($sp) # internal_3 = vertices - end_get_attribute_8756104437071: + sw $v0, 12($sp) # internal_7 = self.vertices + j end_get_attribute_8772684628384 + object_get_attribute_8772684628384: + sw $t1, 12($sp) # internal_7 = self.vertices + end_get_attribute_8772684628384: + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_9 = address of allocated object Int + + # Get method cons of VList + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_3 - lw $t0, 16($sp) - sw $t0, 4($sp) # Storing internal_3 + # Argument internal_7 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_7 # Argument v - lw $t0, 32($sp) + lw $t0, 56($sp) sw $t0, 0($sp) # Storing v - # Calling function function_cons_at_VList - jal function_cons_at_VList + # Calling function internal_10 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_4 = result of function_cons_at_VList + sw $v1, 20($sp) # internal_8 = result of internal_10 addi $sp, $sp, 12 # Freeing space for arguments # Set attribute vertices of self - lw $t0, 24($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_4 - beq $t1, $zero, object_set_attribute_8756104437050 + lw $t0, 48($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_8 + beq $t1, $zero, object_set_attribute_8772684628360 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104437050 + beq $t6, $t5, int_set_attribute_8772684628360 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104437050 - j object_set_attribute_8756104437050 - int_set_attribute_8756104437050: + beq $t6, $t5, bool_set_attribute_8772684628360 + j object_set_attribute_8772684628360 + int_set_attribute_8772684628360: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1678,9 +1991,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($t0) # self.vertices = internal_4 - j end_set_attribute_8756104437050 - bool_set_attribute_8756104437050: + sw $v0, 8($t0) # self.vertices = internal_8 + j end_set_attribute_8772684628360 + bool_set_attribute_8772684628360: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1688,41 +2001,41 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($t0) # self.vertices = internal_4 - j end_set_attribute_8756104437050 - object_set_attribute_8756104437050: - sw $t1, 8($t0) # self.vertices = internal_4 - end_set_attribute_8756104437050: + sw $v0, 8($t0) # self.vertices = internal_8 + j end_set_attribute_8772684628360 + object_set_attribute_8772684628360: + sw $t1, 8($t0) # self.vertices = internal_8 + end_set_attribute_8772684628360: # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 20 + addi $sp, $sp, 44 jr $ra function_print_E_at_Graph: # Function parameters - # $ra = 12($sp) - # self = 8($sp) + # $ra = 20($sp) + # self = 16($sp) # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Get attribute edges of self - lw $t0, 8($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'edges' from the instance + lw $t0, 16($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'edges' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8756104437107 + beq $t6, $t5, int_get_attribute_8772684628444 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8756104437107 - j object_get_attribute_8756104437107 - int_get_attribute_8756104437107: + beq $t6, $t5, bool_get_attribute_8772684628444 + j object_get_attribute_8772684628444 + int_get_attribute_8772684628444: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1730,9 +2043,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_0 = self.edges - j end_get_attribute_8756104437107 - bool_get_attribute_8756104437107: + sw $v0, 12($sp) # internal_0 = self.edges + j end_get_attribute_8772684628444 + bool_get_attribute_8772684628444: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1740,55 +2053,79 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_0 = self.edges - j end_get_attribute_8756104437107 - object_get_attribute_8756104437107: - sw $t1, 4($sp) # internal_0 = edges - end_get_attribute_8756104437107: + sw $v0, 12($sp) # internal_0 = self.edges + j end_get_attribute_8772684628444 + object_get_attribute_8772684628444: + sw $t1, 12($sp) # internal_0 = self.edges + end_get_attribute_8772684628444: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method print of EList + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_print_at_EList - jal function_print_at_EList + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function_print_at_EList + sw $v1, 16($sp) # internal_1 = result of internal_3 addi $sp, $sp, 8 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 8 + addi $sp, $sp, 16 jr $ra function_print_V_at_Graph: # Function parameters - # $ra = 12($sp) - # self = 8($sp) + # $ra = 20($sp) + # self = 16($sp) # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Get attribute vertices of self - lw $t0, 8($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'vertices' from the instance + lw $t0, 16($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'vertices' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8756104437155 + beq $t6, $t5, int_get_attribute_8772684629032 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8756104437155 - j object_get_attribute_8756104437155 - int_get_attribute_8756104437155: + beq $t6, $t5, bool_get_attribute_8772684629032 + j object_get_attribute_8772684629032 + int_get_attribute_8772684629032: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1796,9 +2133,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_0 = self.vertices - j end_get_attribute_8756104437155 - bool_get_attribute_8756104437155: + sw $v0, 12($sp) # internal_0 = self.vertices + j end_get_attribute_8772684629032 + bool_get_attribute_8772684629032: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1806,31 +2143,55 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_0 = self.vertices - j end_get_attribute_8756104437155 - object_get_attribute_8756104437155: - sw $t1, 4($sp) # internal_0 = vertices - end_get_attribute_8756104437155: + sw $v0, 12($sp) # internal_0 = self.vertices + j end_get_attribute_8772684629032 + object_get_attribute_8772684629032: + sw $t1, 12($sp) # internal_0 = self.vertices + end_get_attribute_8772684629032: + + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method print of VList + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_print_at_VList - jal function_print_at_VList + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function_print_at_VList + sw $v1, 16($sp) # internal_1 = result of internal_3 addi $sp, $sp, 8 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 8 + addi $sp, $sp, 16 jr $ra @@ -1857,17 +2218,17 @@ # Set attribute num of self lw $t0, 8($sp) # $t0 = self lw $t1, 4($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8756104437212 + beq $t1, $zero, object_set_attribute_8772684629113 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104437212 + beq $t6, $t5, int_set_attribute_8772684629113 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104437212 - j object_set_attribute_8756104437212 - int_set_attribute_8756104437212: + beq $t6, $t5, bool_set_attribute_8772684629113 + j object_set_attribute_8772684629113 + int_set_attribute_8772684629113: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1876,8 +2237,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.num = internal_0 - j end_set_attribute_8756104437212 - bool_set_attribute_8756104437212: + j end_set_attribute_8772684629113 + bool_set_attribute_8772684629113: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1886,10 +2247,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.num = internal_0 - j end_set_attribute_8756104437212 - object_set_attribute_8756104437212: + j end_set_attribute_8772684629113 + object_set_attribute_8772684629113: sw $t1, 8($t0) # self.num = internal_0 - end_set_attribute_8756104437212: + end_set_attribute_8772684629113: # Allocating EList li $v0, 9 @@ -1917,17 +2278,17 @@ # Set attribute out of self lw $t0, 8($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_1 - beq $t1, $zero, object_set_attribute_8756104437233 + beq $t1, $zero, object_set_attribute_8772684629134 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104437233 + beq $t6, $t5, int_set_attribute_8772684629134 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104437233 - j object_set_attribute_8756104437233 - int_set_attribute_8756104437233: + beq $t6, $t5, bool_set_attribute_8772684629134 + j object_set_attribute_8772684629134 + int_set_attribute_8772684629134: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1936,8 +2297,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.out = internal_1 - j end_set_attribute_8756104437233 - bool_set_attribute_8756104437233: + j end_set_attribute_8772684629134 + bool_set_attribute_8772684629134: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1946,10 +2307,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.out = internal_1 - j end_set_attribute_8756104437233 - object_set_attribute_8756104437233: + j end_set_attribute_8772684629134 + object_set_attribute_8772684629134: sw $t1, 12($t0) # self.out = internal_1 - end_set_attribute_8756104437233: + end_set_attribute_8772684629134: # Loading return value in $v1 lw $v1, 8($sp) @@ -1969,17 +2330,17 @@ # Get attribute out of self lw $t0, 4($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'out' from the instance + lw $t1, 12($t0) # Get the attribute 'out' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8756104437529 + beq $t6, $t5, int_get_attribute_8772684629170 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8756104437529 - j object_get_attribute_8756104437529 - int_get_attribute_8756104437529: + beq $t6, $t5, bool_get_attribute_8772684629170 + j object_get_attribute_8772684629170 + int_get_attribute_8772684629170: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1988,8 +2349,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 0($sp) # internal_0 = self.out - j end_get_attribute_8756104437529 - bool_get_attribute_8756104437529: + j end_get_attribute_8772684629170 + bool_get_attribute_8772684629170: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1998,10 +2359,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 0($sp) # internal_0 = self.out - j end_get_attribute_8756104437529 - object_get_attribute_8756104437529: - sw $t1, 0($sp) # internal_0 = out - end_get_attribute_8756104437529: + j end_get_attribute_8772684629170 + object_get_attribute_8772684629170: + sw $t1, 0($sp) # internal_0 = self.out + end_get_attribute_8772684629170: # Loading return value in $v1 lw $v1, 0($sp) @@ -2021,17 +2382,17 @@ # Get attribute num of self lw $t0, 4($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'num' from the instance + lw $t1, 8($t0) # Get the attribute 'num' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8756104437559 + beq $t6, $t5, int_get_attribute_8772684629200 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8756104437559 - j object_get_attribute_8756104437559 - int_get_attribute_8756104437559: + beq $t6, $t5, bool_get_attribute_8772684629200 + j object_get_attribute_8772684629200 + int_get_attribute_8772684629200: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2040,8 +2401,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 0($sp) # internal_0 = self.num - j end_get_attribute_8756104437559 - bool_get_attribute_8756104437559: + j end_get_attribute_8772684629200 + bool_get_attribute_8772684629200: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2050,10 +2411,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 0($sp) # internal_0 = self.num - j end_get_attribute_8756104437559 - object_get_attribute_8756104437559: - sw $t1, 0($sp) # internal_0 = num - end_get_attribute_8756104437559: + j end_get_attribute_8772684629200 + object_get_attribute_8772684629200: + sw $t1, 0($sp) # internal_0 = self.num + end_get_attribute_8772684629200: # Loading return value in $v1 lw $v1, 0($sp) @@ -2072,17 +2433,17 @@ # Set attribute num of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($sp) # $t1 = n - beq $t1, $zero, object_set_attribute_8756104437610 + beq $t1, $zero, object_set_attribute_8772684629514 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104437610 + beq $t6, $t5, int_set_attribute_8772684629514 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104437610 - j object_set_attribute_8756104437610 - int_set_attribute_8756104437610: + beq $t6, $t5, bool_set_attribute_8772684629514 + j object_set_attribute_8772684629514 + int_set_attribute_8772684629514: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2091,8 +2452,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.num = n - j end_set_attribute_8756104437610 - bool_set_attribute_8756104437610: + j end_set_attribute_8772684629514 + bool_set_attribute_8772684629514: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2101,10 +2462,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.num = n - j end_set_attribute_8756104437610 - object_set_attribute_8756104437610: + j end_set_attribute_8772684629514 + object_set_attribute_8772684629514: sw $t1, 8($t0) # self.num = n - end_set_attribute_8756104437610: + end_set_attribute_8772684629514: # Loading return value in $v1 lw $v1, 4($sp) @@ -2113,26 +2474,26 @@ function_add_out_at_Vertice: # Function parameters - # $ra = 16($sp) - # self = 12($sp) - # s = 8($sp) + # $ra = 24($sp) + # self = 20($sp) + # s = 16($sp) # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Get attribute out of self - lw $t0, 12($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'out' from the instance + lw $t0, 20($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'out' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8756104437667 + beq $t6, $t5, int_get_attribute_8772684629568 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8756104437667 - j object_get_attribute_8756104437667 - int_get_attribute_8756104437667: + beq $t6, $t5, bool_get_attribute_8772684629568 + j object_get_attribute_8772684629568 + int_get_attribute_8772684629568: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2140,9 +2501,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_0 = self.out - j end_get_attribute_8756104437667 - bool_get_attribute_8756104437667: + sw $v0, 12($sp) # internal_0 = self.out + j end_get_attribute_8772684629568 + bool_get_attribute_8772684629568: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2150,44 +2511,68 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_0 = self.out - j end_get_attribute_8756104437667 - object_get_attribute_8756104437667: - sw $t1, 4($sp) # internal_0 = out - end_get_attribute_8756104437667: + sw $v0, 12($sp) # internal_0 = self.out + j end_get_attribute_8772684629568 + object_get_attribute_8772684629568: + sw $t1, 12($sp) # internal_0 = self.out + end_get_attribute_8772684629568: + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method cons of EList + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_0 - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 4($sp) # Storing internal_0 # Argument s - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing s - # Calling function function_cons_at_EList - jal function_cons_at_EList + # Calling function internal_3 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_1 = result of function_cons_at_EList + sw $v1, 20($sp) # internal_1 = result of internal_3 addi $sp, $sp, 12 # Freeing space for arguments # Set attribute out of self - lw $t0, 12($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_1 - beq $t1, $zero, object_set_attribute_8756104437643 + lw $t0, 20($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8772684629544 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104437643 + beq $t6, $t5, int_set_attribute_8772684629544 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104437643 - j object_set_attribute_8756104437643 - int_set_attribute_8756104437643: + beq $t6, $t5, bool_set_attribute_8772684629544 + j object_set_attribute_8772684629544 + int_set_attribute_8772684629544: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2196,8 +2581,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.out = internal_1 - j end_set_attribute_8756104437643 - bool_set_attribute_8756104437643: + j end_set_attribute_8772684629544 + bool_set_attribute_8772684629544: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2206,40 +2591,40 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.out = internal_1 - j end_set_attribute_8756104437643 - object_set_attribute_8756104437643: + j end_set_attribute_8772684629544 + object_set_attribute_8772684629544: sw $t1, 12($t0) # self.out = internal_1 - end_set_attribute_8756104437643: + end_set_attribute_8772684629544: # Loading return value in $v1 - lw $v1, 12($sp) + lw $v1, 20($sp) # Freeing space for local variables - addi $sp, $sp, 8 + addi $sp, $sp, 16 jr $ra function_print_at_Vertice: # Function parameters - # $ra = 20($sp) - # self = 16($sp) + # $ra = 36($sp) + # self = 32($sp) # Reserving space for local variables - addi $sp, $sp, -16 + addi $sp, $sp, -32 # Get attribute num of self - lw $t0, 16($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'num' from the instance + lw $t0, 32($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'num' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8756104437721 + beq $t6, $t5, int_get_attribute_8772684629646 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8756104437721 - j object_get_attribute_8756104437721 - int_get_attribute_8756104437721: + beq $t6, $t5, bool_get_attribute_8772684629646 + j object_get_attribute_8772684629646 + int_get_attribute_8772684629646: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2247,9 +2632,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_0 = self.num - j end_get_attribute_8756104437721 - bool_get_attribute_8756104437721: + sw $v0, 28($sp) # internal_0 = self.num + j end_get_attribute_8772684629646 + bool_get_attribute_8772684629646: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2257,43 +2642,67 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_0 = self.num - j end_get_attribute_8756104437721 - object_get_attribute_8756104437721: - sw $t1, 12($sp) # internal_0 = num - end_get_attribute_8756104437721: + sw $v0, 28($sp) # internal_0 = self.num + j end_get_attribute_8772684629646 + object_get_attribute_8772684629646: + sw $t1, 28($sp) # internal_0 = self.num + end_get_attribute_8772684629646: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_2 = address of allocated object Int + + # Get method out_int of Vertice + lw $t0, 32($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 28($sp) + lw $t0, 44($sp) sw $t0, 4($sp) # Storing self # Argument internal_0 - lw $t0, 24($sp) + lw $t0, 40($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_out_int_at_IO - jal function_out_int_at_IO + # Calling function internal_3 + lw $t0, 28($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 20($sp) # internal_1 = result of function_out_int_at_IO + sw $v1, 36($sp) # internal_1 = result of internal_3 addi $sp, $sp, 12 # Freeing space for arguments # Get attribute out of self - lw $t0, 16($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'out' from the instance + lw $t0, 32($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'out' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8756104437754 + beq $t6, $t5, int_get_attribute_8772684629703 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8756104437754 - j object_get_attribute_8756104437754 - int_get_attribute_8756104437754: + beq $t6, $t5, bool_get_attribute_8772684629703 + j object_get_attribute_8772684629703 + int_get_attribute_8772684629703: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2301,9 +2710,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_2 = self.out - j end_get_attribute_8756104437754 - bool_get_attribute_8756104437754: + sw $v0, 12($sp) # internal_4 = self.out + j end_get_attribute_8772684629703 + bool_get_attribute_8772684629703: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2311,31 +2720,55 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_2 = self.out - j end_get_attribute_8756104437754 - object_get_attribute_8756104437754: - sw $t1, 4($sp) # internal_2 = out - end_get_attribute_8756104437754: + sw $v0, 12($sp) # internal_4 = self.out + j end_get_attribute_8772684629703 + object_get_attribute_8772684629703: + sw $t1, 12($sp) # internal_4 = self.out + end_get_attribute_8772684629703: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Get method print of EList + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_2 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_2 + # Argument internal_4 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_4 - # Calling function function_print_at_EList - jal function_print_at_EList + # Calling function internal_7 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_3 = result of function_print_at_EList + sw $v1, 16($sp) # internal_5 = result of internal_7 addi $sp, $sp, 8 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 16 + addi $sp, $sp, 32 jr $ra @@ -2362,17 +2795,17 @@ # Set attribute from of self lw $t0, 12($sp) # $t0 = self lw $t1, 8($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8756104438056 + beq $t1, $zero, object_set_attribute_8772684630541 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104438056 + beq $t6, $t5, int_set_attribute_8772684630541 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104438056 - j object_set_attribute_8756104438056 - int_set_attribute_8756104438056: + beq $t6, $t5, bool_set_attribute_8772684630541 + j object_set_attribute_8772684630541 + int_set_attribute_8772684630541: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2381,8 +2814,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.from = internal_0 - j end_set_attribute_8756104438056 - bool_set_attribute_8756104438056: + j end_set_attribute_8772684630541 + bool_set_attribute_8772684630541: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2391,10 +2824,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.from = internal_0 - j end_set_attribute_8756104438056 - object_set_attribute_8756104438056: + j end_set_attribute_8772684630541 + object_set_attribute_8772684630541: sw $t1, 8($t0) # self.from = internal_0 - end_set_attribute_8756104438056: + end_set_attribute_8772684630541: # Allocating Int 0 li $v0, 9 @@ -2411,17 +2844,17 @@ # Set attribute to of self lw $t0, 12($sp) # $t0 = self lw $t1, 4($sp) # $t1 = internal_1 - beq $t1, $zero, object_set_attribute_8756104438077 + beq $t1, $zero, object_set_attribute_8772684630562 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104438077 + beq $t6, $t5, int_set_attribute_8772684630562 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104438077 - j object_set_attribute_8756104438077 - int_set_attribute_8756104438077: + beq $t6, $t5, bool_set_attribute_8772684630562 + j object_set_attribute_8772684630562 + int_set_attribute_8772684630562: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2430,8 +2863,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.to = internal_1 - j end_set_attribute_8756104438077 - bool_set_attribute_8756104438077: + j end_set_attribute_8772684630562 + bool_set_attribute_8772684630562: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2440,10 +2873,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.to = internal_1 - j end_set_attribute_8756104438077 - object_set_attribute_8756104438077: + j end_set_attribute_8772684630562 + object_set_attribute_8772684630562: sw $t1, 12($t0) # self.to = internal_1 - end_set_attribute_8756104438077: + end_set_attribute_8772684630562: # Allocating Int 0 li $v0, 9 @@ -2460,17 +2893,17 @@ # Set attribute weight of self lw $t0, 12($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_2 - beq $t1, $zero, object_set_attribute_8756104438098 + beq $t1, $zero, object_set_attribute_8772684630583 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104438098 + beq $t6, $t5, int_set_attribute_8772684630583 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104438098 - j object_set_attribute_8756104438098 - int_set_attribute_8756104438098: + beq $t6, $t5, bool_set_attribute_8772684630583 + j object_set_attribute_8772684630583 + int_set_attribute_8772684630583: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2479,8 +2912,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.weight = internal_2 - j end_set_attribute_8756104438098 - bool_set_attribute_8756104438098: + j end_set_attribute_8772684630583 + bool_set_attribute_8772684630583: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2489,10 +2922,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.weight = internal_2 - j end_set_attribute_8756104438098 - object_set_attribute_8756104438098: + j end_set_attribute_8772684630583 + object_set_attribute_8772684630583: sw $t1, 16($t0) # self.weight = internal_2 - end_set_attribute_8756104438098: + end_set_attribute_8772684630583: # Loading return value in $v1 lw $v1, 12($sp) @@ -2513,17 +2946,17 @@ # Set attribute from of self lw $t0, 12($sp) # $t0 = self lw $t1, 8($sp) # $t1 = f - beq $t1, $zero, object_set_attribute_8756104438155 + beq $t1, $zero, object_set_attribute_8772684630640 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104438155 + beq $t6, $t5, int_set_attribute_8772684630640 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104438155 - j object_set_attribute_8756104438155 - int_set_attribute_8756104438155: + beq $t6, $t5, bool_set_attribute_8772684630640 + j object_set_attribute_8772684630640 + int_set_attribute_8772684630640: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2532,8 +2965,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.from = f - j end_set_attribute_8756104438155 - bool_set_attribute_8756104438155: + j end_set_attribute_8772684630640 + bool_set_attribute_8772684630640: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2542,25 +2975,25 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.from = f - j end_set_attribute_8756104438155 - object_set_attribute_8756104438155: + j end_set_attribute_8772684630640 + object_set_attribute_8772684630640: sw $t1, 8($t0) # self.from = f - end_set_attribute_8756104438155: + end_set_attribute_8772684630640: # Set attribute to of self lw $t0, 12($sp) # $t0 = self lw $t1, 4($sp) # $t1 = t - beq $t1, $zero, object_set_attribute_8756104438164 + beq $t1, $zero, object_set_attribute_8772684630649 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104438164 + beq $t6, $t5, int_set_attribute_8772684630649 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104438164 - j object_set_attribute_8756104438164 - int_set_attribute_8756104438164: + beq $t6, $t5, bool_set_attribute_8772684630649 + j object_set_attribute_8772684630649 + int_set_attribute_8772684630649: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2569,8 +3002,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.to = t - j end_set_attribute_8756104438164 - bool_set_attribute_8756104438164: + j end_set_attribute_8772684630649 + bool_set_attribute_8772684630649: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2579,25 +3012,25 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.to = t - j end_set_attribute_8756104438164 - object_set_attribute_8756104438164: + j end_set_attribute_8772684630649 + object_set_attribute_8772684630649: sw $t1, 12($t0) # self.to = t - end_set_attribute_8756104438164: + end_set_attribute_8772684630649: # Set attribute weight of self lw $t0, 12($sp) # $t0 = self lw $t1, 0($sp) # $t1 = w - beq $t1, $zero, object_set_attribute_8756104438173 + beq $t1, $zero, object_set_attribute_8772684630658 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104438173 + beq $t6, $t5, int_set_attribute_8772684630658 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104438173 - j object_set_attribute_8756104438173 - int_set_attribute_8756104438173: + beq $t6, $t5, bool_set_attribute_8772684630658 + j object_set_attribute_8772684630658 + int_set_attribute_8772684630658: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2606,8 +3039,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.weight = w - j end_set_attribute_8756104438173 - bool_set_attribute_8756104438173: + j end_set_attribute_8772684630658 + bool_set_attribute_8772684630658: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2616,10 +3049,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.weight = w - j end_set_attribute_8756104438173 - object_set_attribute_8756104438173: + j end_set_attribute_8772684630658 + object_set_attribute_8772684630658: sw $t1, 16($t0) # self.weight = w - end_set_attribute_8756104438173: + end_set_attribute_8772684630658: # Loading return value in $v1 lw $v1, 12($sp) @@ -2628,11 +3061,11 @@ function_print_at_Edge: # Function parameters - # $ra = 52($sp) - # self = 48($sp) + # $ra = 100($sp) + # self = 96($sp) # Reserving space for local variables - addi $sp, $sp, -48 + addi $sp, $sp, -96 # Allocating String li $v0, 9 @@ -2653,39 +3086,63 @@ sb $zero, 10($v0) # Null-terminator at the end of the string - sw $v0, 44($sp) # internal_0 = " (" + sw $v0, 92($sp) # internal_0 = " (" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_2 = address of allocated object Int + + # Get method out_string of Edge + lw $t0, 96($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 84($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 80($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 60($sp) + lw $t0, 108($sp) sw $t0, 4($sp) # Storing self # Argument internal_0 - lw $t0, 56($sp) + lw $t0, 104($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_3 + lw $t0, 92($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 52($sp) # internal_1 = result of function_out_string_at_IO + sw $v1, 100($sp) # internal_1 = result of internal_3 addi $sp, $sp, 12 # Freeing space for arguments # Get attribute from of self - lw $t0, 48($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'from' from the instance + lw $t0, 96($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'from' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8756104438251 + beq $t6, $t5, int_get_attribute_8772684630760 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8756104438251 - j object_get_attribute_8756104438251 - int_get_attribute_8756104438251: + beq $t6, $t5, bool_get_attribute_8772684630760 + j object_get_attribute_8772684630760 + int_get_attribute_8772684630760: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2693,9 +3150,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 36($sp) # internal_2 = self.from - j end_get_attribute_8756104438251 - bool_get_attribute_8756104438251: + sw $v0, 76($sp) # internal_4 = self.from + j end_get_attribute_8772684630760 + bool_get_attribute_8772684630760: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2703,28 +3160,52 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 36($sp) # internal_2 = self.from - j end_get_attribute_8756104438251 - object_get_attribute_8756104438251: - sw $t1, 36($sp) # internal_2 = from - end_get_attribute_8756104438251: + sw $v0, 76($sp) # internal_4 = self.from + j end_get_attribute_8772684630760 + object_get_attribute_8772684630760: + sw $t1, 76($sp) # internal_4 = self.from + end_get_attribute_8772684630760: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_6 = address of allocated object Int + + # Get method out_int of Edge + lw $t0, 96($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 68($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 64($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 60($sp) + lw $t0, 108($sp) sw $t0, 4($sp) # Storing self - # Argument internal_2 - lw $t0, 48($sp) - sw $t0, 0($sp) # Storing internal_2 + # Argument internal_4 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_4 - # Calling function function_out_int_at_IO - jal function_out_int_at_IO + # Calling function internal_7 + lw $t0, 76($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 44($sp) # internal_3 = result of function_out_int_at_IO + sw $v1, 84($sp) # internal_5 = result of internal_7 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -2739,43 +3220,67 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 44 - sb $t0, 8($v0) # internal_4[0] = ',' + sb $t0, 8($v0) # internal_8[0] = ',' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 28($sp) # internal_4 = "," + sw $v0, 60($sp) # internal_8 = "," + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_10 = address of allocated object Int + + # Get method out_string of Edge + lw $t0, 96($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 52($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 48($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 60($sp) + lw $t0, 108($sp) sw $t0, 4($sp) # Storing self - # Argument internal_4 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_4 + # Argument internal_8 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_8 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_11 + lw $t0, 60($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 36($sp) # internal_5 = result of function_out_string_at_IO + sw $v1, 68($sp) # internal_9 = result of internal_11 addi $sp, $sp, 12 # Freeing space for arguments # Get attribute to of self - lw $t0, 48($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'to' from the instance + lw $t0, 96($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'to' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8756104439351 + beq $t6, $t5, int_get_attribute_8772684631140 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8756104439351 - j object_get_attribute_8756104439351 - int_get_attribute_8756104439351: + beq $t6, $t5, bool_get_attribute_8772684631140 + j object_get_attribute_8772684631140 + int_get_attribute_8772684631140: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2783,9 +3288,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 20($sp) # internal_6 = self.to - j end_get_attribute_8756104439351 - bool_get_attribute_8756104439351: + sw $v0, 44($sp) # internal_12 = self.to + j end_get_attribute_8772684631140 + bool_get_attribute_8772684631140: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2793,28 +3298,52 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 20($sp) # internal_6 = self.to - j end_get_attribute_8756104439351 - object_get_attribute_8756104439351: - sw $t1, 20($sp) # internal_6 = to - end_get_attribute_8756104439351: + sw $v0, 44($sp) # internal_12 = self.to + j end_get_attribute_8772684631140 + object_get_attribute_8772684631140: + sw $t1, 44($sp) # internal_12 = self.to + end_get_attribute_8772684631140: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_14 = address of allocated object Int + + # Get method out_int of Edge + lw $t0, 96($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 36($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 32($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 60($sp) + lw $t0, 108($sp) sw $t0, 4($sp) # Storing self - # Argument internal_6 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_6 + # Argument internal_12 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_12 - # Calling function function_out_int_at_IO - jal function_out_int_at_IO + # Calling function internal_15 + lw $t0, 44($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 28($sp) # internal_7 = result of function_out_int_at_IO + sw $v1, 52($sp) # internal_13 = result of internal_15 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -2829,43 +3358,67 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 41 - sb $t0, 8($v0) # internal_8[0] = ')' + sb $t0, 8($v0) # internal_16[0] = ')' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_8 = ")" + sw $v0, 28($sp) # internal_16 = ")" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_18 = address of allocated object Int + + # Get method out_string of Edge + lw $t0, 96($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 60($sp) + lw $t0, 108($sp) sw $t0, 4($sp) # Storing self - # Argument internal_8 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_8 + # Argument internal_16 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_16 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_19 + lw $t0, 28($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 20($sp) # internal_9 = result of function_out_string_at_IO + sw $v1, 36($sp) # internal_17 = result of internal_19 addi $sp, $sp, 12 # Freeing space for arguments # Get attribute weight of self - lw $t0, 48($sp) # Get the address of self - lw $t1, 16($t0) # Get the attribute 'weight' from the instance + lw $t0, 96($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'weight' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8756104439423 + beq $t6, $t5, int_get_attribute_8772684631260 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8756104439423 - j object_get_attribute_8756104439423 - int_get_attribute_8756104439423: + beq $t6, $t5, bool_get_attribute_8772684631260 + j object_get_attribute_8772684631260 + int_get_attribute_8772684631260: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2873,9 +3426,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_10 = self.weight - j end_get_attribute_8756104439423 - bool_get_attribute_8756104439423: + sw $v0, 12($sp) # internal_20 = self.weight + j end_get_attribute_8772684631260 + bool_get_attribute_8772684631260: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2883,35 +3436,59 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_10 = self.weight - j end_get_attribute_8756104439423 - object_get_attribute_8756104439423: - sw $t1, 4($sp) # internal_10 = weight - end_get_attribute_8756104439423: - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + sw $v0, 12($sp) # internal_20 = self.weight + j end_get_attribute_8772684631260 + object_get_attribute_8772684631260: + sw $t1, 12($sp) # internal_20 = self.weight + end_get_attribute_8772684631260: - # Argument self - lw $t0, 60($sp) - sw $t0, 4($sp) # Storing self + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Argument internal_10 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_10 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_22 = address of allocated object Int - # Calling function function_out_int_at_IO - jal function_out_int_at_IO + # Get method out_int of Edge + lw $t0, 96($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_20 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function internal_23 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_11 = result of function_out_int_at_IO + sw $v1, 20($sp) # internal_21 = result of internal_23 addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 48 + addi $sp, $sp, 96 jr $ra @@ -2929,17 +3506,17 @@ # Set attribute car of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8756104439468 + beq $t1, $zero, object_set_attribute_8772684631845 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104439468 + beq $t6, $t5, int_set_attribute_8772684631845 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104439468 - j object_set_attribute_8756104439468 - int_set_attribute_8756104439468: + beq $t6, $t5, bool_set_attribute_8772684631845 + j object_set_attribute_8772684631845 + int_set_attribute_8772684631845: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2948,8 +3525,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.car = internal_0 - j end_set_attribute_8756104439468 - bool_set_attribute_8756104439468: + j end_set_attribute_8772684631845 + bool_set_attribute_8772684631845: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2958,10 +3535,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.car = internal_0 - j end_set_attribute_8756104439468 - object_set_attribute_8756104439468: + j end_set_attribute_8772684631845 + object_set_attribute_8772684631845: sw $t1, 8($t0) # self.car = internal_0 - end_set_attribute_8756104439468: + end_set_attribute_8772684631845: # Loading return value in $v1 lw $v1, 4($sp) @@ -3001,39 +3578,63 @@ function_head_at_EList: # Function parameters - # $ra = 12($sp) - # self = 8($sp) + # $ra = 20($sp) + # self = 16($sp) # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_1 = address of allocated object Int + + # Get method abort of EList + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 0($sp) # Storing self - # Calling function function_abort_at_Object - jal function_abort_at_Object + # Calling function internal_2 + lw $t0, 12($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function_abort_at_Object + sw $v1, 20($sp) # internal_0 = result of internal_2 addi $sp, $sp, 8 # Freeing space for arguments # Get attribute car of self - lw $t0, 8($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'car' from the instance + lw $t0, 16($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'car' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8756104439815 + beq $t6, $t5, int_get_attribute_8772684631956 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8756104439815 - j object_get_attribute_8756104439815 - int_get_attribute_8756104439815: + beq $t6, $t5, bool_get_attribute_8772684631956 + j object_get_attribute_8772684631956 + int_get_attribute_8772684631956: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3041,9 +3642,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 0($sp) # internal_1 = self.car - j end_get_attribute_8756104439815 - bool_get_attribute_8756104439815: + sw $v0, 0($sp) # internal_3 = self.car + j end_get_attribute_8772684631956 + bool_get_attribute_8772684631956: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3051,58 +3652,82 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 0($sp) # internal_1 = self.car - j end_get_attribute_8756104439815 - object_get_attribute_8756104439815: - sw $t1, 0($sp) # internal_1 = car - end_get_attribute_8756104439815: + sw $v0, 0($sp) # internal_3 = self.car + j end_get_attribute_8772684631956 + object_get_attribute_8772684631956: + sw $t1, 0($sp) # internal_3 = self.car + end_get_attribute_8772684631956: # Loading return value in $v1 lw $v1, 0($sp) # Freeing space for local variables - addi $sp, $sp, 8 + addi $sp, $sp, 16 jr $ra function_tail_at_EList: # Function parameters - # $ra = 8($sp) - # self = 4($sp) + # $ra = 16($sp) + # self = 12($sp) # Reserving space for local variables - addi $sp, $sp, -4 + addi $sp, $sp, -12 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + # Get method abort of EList + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing self - # Calling function function_abort_at_Object - jal function_abort_at_Object + # Calling function internal_2 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_0 = result of function_abort_at_Object + sw $v1, 16($sp) # internal_0 = result of internal_2 addi $sp, $sp, 8 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 4($sp) + lw $v1, 12($sp) # Freeing space for local variables - addi $sp, $sp, 4 + addi $sp, $sp, 12 jr $ra function_cons_at_EList: # Function parameters - # $ra = 16($sp) - # self = 12($sp) - # e = 8($sp) + # $ra = 24($sp) + # self = 20($sp) + # e = 16($sp) # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Allocating ECons li $v0, 9 @@ -3111,60 +3736,84 @@ la $t0, type_ECons # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object ECons + sw $v0, 12($sp) # internal_0 = address of allocated object ECons # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_ECons jal function___init___at_ECons lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_ECons + sw $v1, 20($sp) # internal_0 = result of function___init___at_ECons addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 14 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 14 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method init of ECons + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument internal_0 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 8($sp) # Storing internal_0 # Argument e - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing e # Argument self - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t0, 0($sp) # Storing self - # Calling function function_init_at_ECons - jal function_init_at_ECons + # Calling function internal_3 + lw $t0, 16($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 16($sp) # internal_1 = result of function_init_at_ECons + sw $v1, 24($sp) # internal_1 = result of internal_3 addi $sp, $sp, 16 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 8 + addi $sp, $sp, 16 jr $ra function_append_at_EList: # Function parameters - # $ra = 36($sp) - # self = 32($sp) - # l = 28($sp) + # $ra = 76($sp) + # self = 72($sp) + # l = 68($sp) # Reserving space for local variables - addi $sp, $sp, -28 + addi $sp, $sp, -68 # Allocating Bool 0 li $v0, 9 @@ -3176,134 +3825,254 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_1 = address of allocated object Int + sw $v0, 60($sp) # internal_1 = address of allocated object Int + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_3 = address of allocated object Int + + # Get method isNil of EList + lw $t0, 72($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 52($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 48($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 40($sp) + lw $t0, 80($sp) sw $t0, 0($sp) # Storing self - # Calling function function_isNil_at_EList - jal function_isNil_at_EList + # Calling function internal_4 + lw $t0, 56($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 24($sp) # internal_2 = result of function_isNil_at_EList + sw $v1, 64($sp) # internal_2 = result of internal_4 addi $sp, $sp, 8 # Freeing space for arguments # internal_1 = internal_2 - lw $t0, 16($sp) - sw $t0, 20($sp) + lw $t0, 56($sp) + sw $t0, 60($sp) - # If internal_1 then goto then_8756104470233 - lw $t0, 20($sp) # Loading the address of the condition + # If internal_1 then goto then_8772684690496 + lw $t0, 60($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8756104470233 + beq $t0, $t1, then_8772684690496 - # Jumping to else_8756104470233 - j else_8756104470233 + # Jumping to else_8772684690496 + j else_8772684690496 - then_8756104470233: + then_8772684690496: # internal_0 = l - lw $t0, 28($sp) - sw $t0, 24($sp) + lw $t0, 68($sp) + sw $t0, 64($sp) - # Jumping to endif_8756104470233 - j endif_8756104470233 + # Jumping to endif_8772684690496 + j endif_8772684690496 - else_8756104470233: + else_8772684690496: + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_6 = address of allocated object Int + + # Get method tail of EList + lw $t0, 72($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 40($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 36($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 40($sp) + lw $t0, 80($sp) sw $t0, 0($sp) # Storing self - # Calling function function_tail_at_EList - jal function_tail_at_EList + # Calling function internal_7 + lw $t0, 44($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 20($sp) # internal_3 = result of function_tail_at_EList + sw $v1, 52($sp) # internal_5 = result of internal_7 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_9 = address of allocated object Int + + # Get method append of EList + lw $t0, 44($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 28($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 24($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_3 - lw $t0, 24($sp) - sw $t0, 4($sp) # Storing internal_3 + # Argument internal_5 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_5 # Argument l - lw $t0, 40($sp) + lw $t0, 80($sp) sw $t0, 0($sp) # Storing l - # Calling function function_append_at_EList - jal function_append_at_EList + # Calling function internal_10 + lw $t0, 36($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 20($sp) # internal_4 = result of function_append_at_EList + sw $v1, 44($sp) # internal_8 = result of internal_10 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_12 = address of allocated object Int + + # Get method head of EList + lw $t0, 72($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 40($sp) + lw $t0, 80($sp) sw $t0, 0($sp) # Storing self - # Calling function function_head_at_EList - jal function_head_at_EList + # Calling function internal_13 + lw $t0, 20($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 12($sp) # internal_5 = result of function_head_at_EList + sw $v1, 28($sp) # internal_11 = result of internal_13 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_15 = address of allocated object Int + + # Get method cons of EList + lw $t0, 32($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_4 - lw $t0, 20($sp) - sw $t0, 4($sp) # Storing internal_4 + # Argument internal_8 + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing internal_8 - # Argument internal_5 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_5 + # Argument internal_11 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_11 - # Calling function function_cons_at_EList - jal function_cons_at_EList + # Calling function internal_16 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_6 = result of function_cons_at_EList + sw $v1, 20($sp) # internal_14 = result of internal_16 addi $sp, $sp, 12 # Freeing space for arguments - # internal_0 = internal_6 - lw $t0, 0($sp) - sw $t0, 24($sp) + # internal_0 = internal_14 + lw $t0, 8($sp) + sw $t0, 64($sp) - # Jumping to endif_8756104470233 - j endif_8756104470233 + # Jumping to endif_8772684690496 + j endif_8772684690496 - endif_8756104470233: + endif_8772684690496: # Loading return value in $v1 - lw $v1, 24($sp) + lw $v1, 64($sp) # Freeing space for local variables - addi $sp, $sp, 28 + addi $sp, $sp, 68 jr $ra function_print_at_EList: # Function parameters - # $ra = 12($sp) - # self = 8($sp) + # $ra = 20($sp) + # self = 16($sp) # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Allocating String li $v0, 9 @@ -3321,31 +4090,55 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_0 = "\n" + sw $v0, 12($sp) # internal_0 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method out_string of EList + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 4($sp) # Storing self # Argument internal_0 - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_3 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_1 = result of function_out_string_at_IO + sw $v1, 20($sp) # internal_1 = result of internal_3 addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 8 + addi $sp, $sp, 16 jr $ra @@ -3363,17 +4156,17 @@ # Set attribute car of self lw $t0, 8($sp) # $t0 = self lw $t1, 4($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8756104440754 + beq $t1, $zero, object_set_attribute_8772684633866 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104440754 + beq $t6, $t5, int_set_attribute_8772684633866 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104440754 - j object_set_attribute_8756104440754 - int_set_attribute_8756104440754: + beq $t6, $t5, bool_set_attribute_8772684633866 + j object_set_attribute_8772684633866 + int_set_attribute_8772684633866: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3382,8 +4175,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.car = internal_0 - j end_set_attribute_8756104440754 - bool_set_attribute_8756104440754: + j end_set_attribute_8772684633866 + bool_set_attribute_8772684633866: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3392,10 +4185,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.car = internal_0 - j end_set_attribute_8756104440754 - object_set_attribute_8756104440754: + j end_set_attribute_8772684633866 + object_set_attribute_8772684633866: sw $t1, 8($t0) # self.car = internal_0 - end_set_attribute_8756104440754: + end_set_attribute_8772684633866: # Allocating NUll to internal_1 sw $zero, 0($sp) # internal_1 = 0 @@ -3403,17 +4196,17 @@ # Set attribute cdr of self lw $t0, 8($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_1 - beq $t1, $zero, object_set_attribute_8756104440775 + beq $t1, $zero, object_set_attribute_8772684633884 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104440775 + beq $t6, $t5, int_set_attribute_8772684633884 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104440775 - j object_set_attribute_8756104440775 - int_set_attribute_8756104440775: + beq $t6, $t5, bool_set_attribute_8772684633884 + j object_set_attribute_8772684633884 + int_set_attribute_8772684633884: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3422,8 +4215,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.cdr = internal_1 - j end_set_attribute_8756104440775 - bool_set_attribute_8756104440775: + j end_set_attribute_8772684633884 + bool_set_attribute_8772684633884: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3432,10 +4225,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.cdr = internal_1 - j end_set_attribute_8756104440775 - object_set_attribute_8756104440775: + j end_set_attribute_8772684633884 + object_set_attribute_8772684633884: sw $t1, 12($t0) # self.cdr = internal_1 - end_set_attribute_8756104440775: + end_set_attribute_8772684633884: # Loading return value in $v1 lw $v1, 8($sp) @@ -3483,17 +4276,17 @@ # Get attribute car of self lw $t0, 4($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'car' from the instance + lw $t1, 8($t0) # Get the attribute 'car' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8756104440829 + beq $t6, $t5, int_get_attribute_8772684633938 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8756104440829 - j object_get_attribute_8756104440829 - int_get_attribute_8756104440829: + beq $t6, $t5, bool_get_attribute_8772684633938 + j object_get_attribute_8772684633938 + int_get_attribute_8772684633938: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3502,8 +4295,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 0($sp) # internal_0 = self.car - j end_get_attribute_8756104440829 - bool_get_attribute_8756104440829: + j end_get_attribute_8772684633938 + bool_get_attribute_8772684633938: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3512,10 +4305,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 0($sp) # internal_0 = self.car - j end_get_attribute_8756104440829 - object_get_attribute_8756104440829: - sw $t1, 0($sp) # internal_0 = car - end_get_attribute_8756104440829: + j end_get_attribute_8772684633938 + object_get_attribute_8772684633938: + sw $t1, 0($sp) # internal_0 = self.car + end_get_attribute_8772684633938: # Loading return value in $v1 lw $v1, 0($sp) @@ -3535,17 +4328,17 @@ # Get attribute cdr of self lw $t0, 4($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'cdr' from the instance + lw $t1, 12($t0) # Get the attribute 'cdr' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8756104441119 + beq $t6, $t5, int_get_attribute_8772684633968 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8756104441119 - j object_get_attribute_8756104441119 - int_get_attribute_8756104441119: + beq $t6, $t5, bool_get_attribute_8772684633968 + j object_get_attribute_8772684633968 + int_get_attribute_8772684633968: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3554,8 +4347,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 0($sp) # internal_0 = self.cdr - j end_get_attribute_8756104441119 - bool_get_attribute_8756104441119: + j end_get_attribute_8772684633968 + bool_get_attribute_8772684633968: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3564,10 +4357,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 0($sp) # internal_0 = self.cdr - j end_get_attribute_8756104441119 - object_get_attribute_8756104441119: - sw $t1, 0($sp) # internal_0 = cdr - end_get_attribute_8756104441119: + j end_get_attribute_8772684633968 + object_get_attribute_8772684633968: + sw $t1, 0($sp) # internal_0 = self.cdr + end_get_attribute_8772684633968: # Loading return value in $v1 lw $v1, 0($sp) @@ -3587,17 +4380,17 @@ # Set attribute car of self lw $t0, 8($sp) # $t0 = self lw $t1, 4($sp) # $t1 = e - beq $t1, $zero, object_set_attribute_8756104441176 + beq $t1, $zero, object_set_attribute_8772684634025 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104441176 + beq $t6, $t5, int_set_attribute_8772684634025 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104441176 - j object_set_attribute_8756104441176 - int_set_attribute_8756104441176: + beq $t6, $t5, bool_set_attribute_8772684634025 + j object_set_attribute_8772684634025 + int_set_attribute_8772684634025: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3606,8 +4399,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.car = e - j end_set_attribute_8756104441176 - bool_set_attribute_8756104441176: + j end_set_attribute_8772684634025 + bool_set_attribute_8772684634025: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3616,25 +4409,25 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.car = e - j end_set_attribute_8756104441176 - object_set_attribute_8756104441176: + j end_set_attribute_8772684634025 + object_set_attribute_8772684634025: sw $t1, 8($t0) # self.car = e - end_set_attribute_8756104441176: + end_set_attribute_8772684634025: # Set attribute cdr of self lw $t0, 8($sp) # $t0 = self lw $t1, 0($sp) # $t1 = rest - beq $t1, $zero, object_set_attribute_8756104441185 + beq $t1, $zero, object_set_attribute_8772684634034 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104441185 + beq $t6, $t5, int_set_attribute_8772684634034 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104441185 - j object_set_attribute_8756104441185 - int_set_attribute_8756104441185: + beq $t6, $t5, bool_set_attribute_8772684634034 + j object_set_attribute_8772684634034 + int_set_attribute_8772684634034: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3643,8 +4436,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.cdr = rest - j end_set_attribute_8756104441185 - bool_set_attribute_8756104441185: + j end_set_attribute_8772684634034 + bool_set_attribute_8772684634034: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3653,10 +4446,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.cdr = rest - j end_set_attribute_8756104441185 - object_set_attribute_8756104441185: + j end_set_attribute_8772684634034 + object_set_attribute_8772684634034: sw $t1, 12($t0) # self.cdr = rest - end_set_attribute_8756104441185: + end_set_attribute_8772684634034: # Loading return value in $v1 lw $v1, 8($sp) @@ -3665,25 +4458,25 @@ function_print_at_ECons: # Function parameters - # $ra = 20($sp) - # self = 16($sp) + # $ra = 36($sp) + # self = 32($sp) # Reserving space for local variables - addi $sp, $sp, -16 + addi $sp, $sp, -32 # Get attribute car of self - lw $t0, 16($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'car' from the instance + lw $t0, 32($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'car' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8756104441224 + beq $t6, $t5, int_get_attribute_8772684634073 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8756104441224 - j object_get_attribute_8756104441224 - int_get_attribute_8756104441224: + beq $t6, $t5, bool_get_attribute_8772684634073 + j object_get_attribute_8772684634073 + int_get_attribute_8772684634073: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3691,9 +4484,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_0 = self.car - j end_get_attribute_8756104441224 - bool_get_attribute_8756104441224: + sw $v0, 28($sp) # internal_0 = self.car + j end_get_attribute_8772684634073 + bool_get_attribute_8772684634073: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3701,39 +4494,63 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_0 = self.car - j end_get_attribute_8756104441224 - object_get_attribute_8756104441224: - sw $t1, 12($sp) # internal_0 = car - end_get_attribute_8756104441224: + sw $v0, 28($sp) # internal_0 = self.car + j end_get_attribute_8772684634073 + object_get_attribute_8772684634073: + sw $t1, 28($sp) # internal_0 = self.car + end_get_attribute_8772684634073: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_2 = address of allocated object Int + + # Get method print of Edge + lw $t0, 28($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 20($sp) + lw $t0, 36($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_print_at_Edge - jal function_print_at_Edge + # Calling function internal_3 + lw $t0, 24($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_print_at_Edge + sw $v1, 32($sp) # internal_1 = result of internal_3 addi $sp, $sp, 8 # Freeing space for arguments # Get attribute cdr of self - lw $t0, 16($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'cdr' from the instance + lw $t0, 32($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'cdr' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8756104441254 + beq $t6, $t5, int_get_attribute_8772684634387 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8756104441254 - j object_get_attribute_8756104441254 - int_get_attribute_8756104441254: + beq $t6, $t5, bool_get_attribute_8772684634387 + j object_get_attribute_8772684634387 + int_get_attribute_8772684634387: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3741,9 +4558,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_2 = self.cdr - j end_get_attribute_8756104441254 - bool_get_attribute_8756104441254: + sw $v0, 12($sp) # internal_4 = self.cdr + j end_get_attribute_8772684634387 + bool_get_attribute_8772684634387: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3751,31 +4568,55 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_2 = self.cdr - j end_get_attribute_8756104441254 - object_get_attribute_8756104441254: - sw $t1, 4($sp) # internal_2 = cdr - end_get_attribute_8756104441254: + sw $v0, 12($sp) # internal_4 = self.cdr + j end_get_attribute_8772684634387 + object_get_attribute_8772684634387: + sw $t1, 12($sp) # internal_4 = self.cdr + end_get_attribute_8772684634387: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Get method print of EList + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_2 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_2 + # Argument internal_4 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_4 - # Calling function function_print_at_EList - jal function_print_at_EList + # Calling function internal_7 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_3 = result of function_print_at_EList + sw $v1, 16($sp) # internal_5 = result of internal_7 addi $sp, $sp, 8 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 16 + addi $sp, $sp, 32 jr $ra @@ -3793,17 +4634,17 @@ # Set attribute car of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8756104441296 + beq $t1, $zero, object_set_attribute_8772684634453 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104441296 + beq $t6, $t5, int_set_attribute_8772684634453 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104441296 - j object_set_attribute_8756104441296 - int_set_attribute_8756104441296: + beq $t6, $t5, bool_set_attribute_8772684634453 + j object_set_attribute_8772684634453 + int_set_attribute_8772684634453: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3812,8 +4653,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.car = internal_0 - j end_set_attribute_8756104441296 - bool_set_attribute_8756104441296: + j end_set_attribute_8772684634453 + bool_set_attribute_8772684634453: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3822,10 +4663,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.car = internal_0 - j end_set_attribute_8756104441296 - object_set_attribute_8756104441296: + j end_set_attribute_8772684634453 + object_set_attribute_8772684634453: sw $t1, 8($t0) # self.car = internal_0 - end_set_attribute_8756104441296: + end_set_attribute_8772684634453: # Loading return value in $v1 lw $v1, 4($sp) @@ -3865,39 +4706,63 @@ function_head_at_VList: # Function parameters - # $ra = 12($sp) - # self = 8($sp) + # $ra = 20($sp) + # self = 16($sp) # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_1 = address of allocated object Int + + # Get method abort of VList + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 0($sp) # Storing self - # Calling function function_abort_at_Object - jal function_abort_at_Object + # Calling function internal_2 + lw $t0, 12($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function_abort_at_Object + sw $v1, 20($sp) # internal_0 = result of internal_2 addi $sp, $sp, 8 # Freeing space for arguments # Get attribute car of self - lw $t0, 8($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'car' from the instance + lw $t0, 16($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'car' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8756104441899 + beq $t6, $t5, int_get_attribute_8772684634564 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8756104441899 - j object_get_attribute_8756104441899 - int_get_attribute_8756104441899: + beq $t6, $t5, bool_get_attribute_8772684634564 + j object_get_attribute_8772684634564 + int_get_attribute_8772684634564: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3905,9 +4770,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 0($sp) # internal_1 = self.car - j end_get_attribute_8756104441899 - bool_get_attribute_8756104441899: + sw $v0, 0($sp) # internal_3 = self.car + j end_get_attribute_8772684634564 + bool_get_attribute_8772684634564: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3915,58 +4780,82 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 0($sp) # internal_1 = self.car - j end_get_attribute_8756104441899 - object_get_attribute_8756104441899: - sw $t1, 0($sp) # internal_1 = car - end_get_attribute_8756104441899: + sw $v0, 0($sp) # internal_3 = self.car + j end_get_attribute_8772684634564 + object_get_attribute_8772684634564: + sw $t1, 0($sp) # internal_3 = self.car + end_get_attribute_8772684634564: # Loading return value in $v1 lw $v1, 0($sp) # Freeing space for local variables - addi $sp, $sp, 8 + addi $sp, $sp, 16 jr $ra function_tail_at_VList: # Function parameters - # $ra = 8($sp) - # self = 4($sp) + # $ra = 16($sp) + # self = 12($sp) # Reserving space for local variables - addi $sp, $sp, -4 + addi $sp, $sp, -12 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + # Get method abort of VList + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing self - # Calling function function_abort_at_Object - jal function_abort_at_Object + # Calling function internal_2 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_0 = result of function_abort_at_Object + sw $v1, 16($sp) # internal_0 = result of internal_2 addi $sp, $sp, 8 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 4($sp) + lw $v1, 12($sp) # Freeing space for local variables - addi $sp, $sp, 4 + addi $sp, $sp, 12 jr $ra function_cons_at_VList: # Function parameters - # $ra = 16($sp) - # self = 12($sp) - # v = 8($sp) + # $ra = 24($sp) + # self = 20($sp) + # v = 16($sp) # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Allocating VCons li $v0, 9 @@ -3975,59 +4864,83 @@ la $t0, type_VCons # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object VCons + sw $v0, 12($sp) # internal_0 = address of allocated object VCons # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_VCons jal function___init___at_VCons lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_VCons + sw $v1, 20($sp) # internal_0 = result of function___init___at_VCons addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method init of VCons + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument internal_0 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 8($sp) # Storing internal_0 # Argument v - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing v # Argument self - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t0, 0($sp) # Storing self - # Calling function function_init_at_VCons - jal function_init_at_VCons + # Calling function internal_3 + lw $t0, 16($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 16($sp) # internal_1 = result of function_init_at_VCons + sw $v1, 24($sp) # internal_1 = result of internal_3 addi $sp, $sp, 16 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 8 + addi $sp, $sp, 16 jr $ra function_print_at_VList: # Function parameters - # $ra = 12($sp) - # self = 8($sp) + # $ra = 20($sp) + # self = 16($sp) # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Allocating String li $v0, 9 @@ -4045,31 +4958,55 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_0 = "\n" + sw $v0, 12($sp) # internal_0 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method out_string of VList + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 4($sp) # Storing self # Argument internal_0 - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_3 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_1 = result of function_out_string_at_IO + sw $v1, 20($sp) # internal_1 = result of internal_3 addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 8 + addi $sp, $sp, 16 jr $ra @@ -4087,17 +5024,17 @@ # Set attribute car of self lw $t0, 8($sp) # $t0 = self lw $t1, 4($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8756104442103 + beq $t1, $zero, object_set_attribute_8772684633308 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104442103 + beq $t6, $t5, int_set_attribute_8772684633308 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104442103 - j object_set_attribute_8756104442103 - int_set_attribute_8756104442103: + beq $t6, $t5, bool_set_attribute_8772684633308 + j object_set_attribute_8772684633308 + int_set_attribute_8772684633308: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4106,8 +5043,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.car = internal_0 - j end_set_attribute_8756104442103 - bool_set_attribute_8756104442103: + j end_set_attribute_8772684633308 + bool_set_attribute_8772684633308: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4116,10 +5053,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.car = internal_0 - j end_set_attribute_8756104442103 - object_set_attribute_8756104442103: + j end_set_attribute_8772684633308 + object_set_attribute_8772684633308: sw $t1, 8($t0) # self.car = internal_0 - end_set_attribute_8756104442103: + end_set_attribute_8772684633308: # Allocating NUll to internal_1 sw $zero, 0($sp) # internal_1 = 0 @@ -4127,17 +5064,17 @@ # Set attribute cdr of self lw $t0, 8($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_1 - beq $t1, $zero, object_set_attribute_8756104442643 + beq $t1, $zero, object_set_attribute_8772684633329 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104442643 + beq $t6, $t5, int_set_attribute_8772684633329 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104442643 - j object_set_attribute_8756104442643 - int_set_attribute_8756104442643: + beq $t6, $t5, bool_set_attribute_8772684633329 + j object_set_attribute_8772684633329 + int_set_attribute_8772684633329: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4146,8 +5083,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.cdr = internal_1 - j end_set_attribute_8756104442643 - bool_set_attribute_8756104442643: + j end_set_attribute_8772684633329 + bool_set_attribute_8772684633329: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4156,10 +5093,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.cdr = internal_1 - j end_set_attribute_8756104442643 - object_set_attribute_8756104442643: + j end_set_attribute_8772684633329 + object_set_attribute_8772684633329: sw $t1, 12($t0) # self.cdr = internal_1 - end_set_attribute_8756104442643: + end_set_attribute_8772684633329: # Loading return value in $v1 lw $v1, 8($sp) @@ -4207,17 +5144,17 @@ # Get attribute car of self lw $t0, 4($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'car' from the instance + lw $t1, 8($t0) # Get the attribute 'car' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8756104442694 + beq $t6, $t5, int_get_attribute_8772684602923 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8756104442694 - j object_get_attribute_8756104442694 - int_get_attribute_8756104442694: + beq $t6, $t5, bool_get_attribute_8772684602923 + j object_get_attribute_8772684602923 + int_get_attribute_8772684602923: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4226,8 +5163,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 0($sp) # internal_0 = self.car - j end_get_attribute_8756104442694 - bool_get_attribute_8756104442694: + j end_get_attribute_8772684602923 + bool_get_attribute_8772684602923: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4236,10 +5173,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 0($sp) # internal_0 = self.car - j end_get_attribute_8756104442694 - object_get_attribute_8756104442694: - sw $t1, 0($sp) # internal_0 = car - end_get_attribute_8756104442694: + j end_get_attribute_8772684602923 + object_get_attribute_8772684602923: + sw $t1, 0($sp) # internal_0 = self.car + end_get_attribute_8772684602923: # Loading return value in $v1 lw $v1, 0($sp) @@ -4259,17 +5196,17 @@ # Get attribute cdr of self lw $t0, 4($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'cdr' from the instance + lw $t1, 12($t0) # Get the attribute 'cdr' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8756104442724 + beq $t6, $t5, int_get_attribute_8772684602953 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8756104442724 - j object_get_attribute_8756104442724 - int_get_attribute_8756104442724: + beq $t6, $t5, bool_get_attribute_8772684602953 + j object_get_attribute_8772684602953 + int_get_attribute_8772684602953: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4278,8 +5215,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 0($sp) # internal_0 = self.cdr - j end_get_attribute_8756104442724 - bool_get_attribute_8756104442724: + j end_get_attribute_8772684602953 + bool_get_attribute_8772684602953: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4288,10 +5225,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 0($sp) # internal_0 = self.cdr - j end_get_attribute_8756104442724 - object_get_attribute_8756104442724: - sw $t1, 0($sp) # internal_0 = cdr - end_get_attribute_8756104442724: + j end_get_attribute_8772684602953 + object_get_attribute_8772684602953: + sw $t1, 0($sp) # internal_0 = self.cdr + end_get_attribute_8772684602953: # Loading return value in $v1 lw $v1, 0($sp) @@ -4311,17 +5248,17 @@ # Set attribute car of self lw $t0, 8($sp) # $t0 = self lw $t1, 4($sp) # $t1 = v - beq $t1, $zero, object_set_attribute_8756104442781 + beq $t1, $zero, object_set_attribute_8772684603010 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104442781 + beq $t6, $t5, int_set_attribute_8772684603010 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104442781 - j object_set_attribute_8756104442781 - int_set_attribute_8756104442781: + beq $t6, $t5, bool_set_attribute_8772684603010 + j object_set_attribute_8772684603010 + int_set_attribute_8772684603010: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4330,8 +5267,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.car = v - j end_set_attribute_8756104442781 - bool_set_attribute_8756104442781: + j end_set_attribute_8772684603010 + bool_set_attribute_8772684603010: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4340,25 +5277,25 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.car = v - j end_set_attribute_8756104442781 - object_set_attribute_8756104442781: + j end_set_attribute_8772684603010 + object_set_attribute_8772684603010: sw $t1, 8($t0) # self.car = v - end_set_attribute_8756104442781: + end_set_attribute_8772684603010: # Set attribute cdr of self lw $t0, 8($sp) # $t0 = self lw $t1, 0($sp) # $t1 = rest - beq $t1, $zero, object_set_attribute_8756104442790 + beq $t1, $zero, object_set_attribute_8772684603019 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104442790 + beq $t6, $t5, int_set_attribute_8772684603019 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104442790 - j object_set_attribute_8756104442790 - int_set_attribute_8756104442790: + beq $t6, $t5, bool_set_attribute_8772684603019 + j object_set_attribute_8772684603019 + int_set_attribute_8772684603019: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4367,8 +5304,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.cdr = rest - j end_set_attribute_8756104442790 - bool_set_attribute_8756104442790: + j end_set_attribute_8772684603019 + bool_set_attribute_8772684603019: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4377,10 +5314,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.cdr = rest - j end_set_attribute_8756104442790 - object_set_attribute_8756104442790: + j end_set_attribute_8772684603019 + object_set_attribute_8772684603019: sw $t1, 12($t0) # self.cdr = rest - end_set_attribute_8756104442790: + end_set_attribute_8772684603019: # Loading return value in $v1 lw $v1, 8($sp) @@ -4389,25 +5326,25 @@ function_print_at_VCons: # Function parameters - # $ra = 20($sp) - # self = 16($sp) + # $ra = 36($sp) + # self = 32($sp) # Reserving space for local variables - addi $sp, $sp, -16 + addi $sp, $sp, -32 # Get attribute car of self - lw $t0, 16($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'car' from the instance + lw $t0, 32($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'car' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8756104442829 + beq $t6, $t5, int_get_attribute_8772684603058 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8756104442829 - j object_get_attribute_8756104442829 - int_get_attribute_8756104442829: + beq $t6, $t5, bool_get_attribute_8772684603058 + j object_get_attribute_8772684603058 + int_get_attribute_8772684603058: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4415,9 +5352,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_0 = self.car - j end_get_attribute_8756104442829 - bool_get_attribute_8756104442829: + sw $v0, 28($sp) # internal_0 = self.car + j end_get_attribute_8772684603058 + bool_get_attribute_8772684603058: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4425,39 +5362,63 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_0 = self.car - j end_get_attribute_8756104442829 - object_get_attribute_8756104442829: - sw $t1, 12($sp) # internal_0 = car - end_get_attribute_8756104442829: + sw $v0, 28($sp) # internal_0 = self.car + j end_get_attribute_8772684603058 + object_get_attribute_8772684603058: + sw $t1, 28($sp) # internal_0 = self.car + end_get_attribute_8772684603058: + + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_2 = address of allocated object Int + + # Get method print of Vertice + lw $t0, 28($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 20($sp) + lw $t0, 36($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_print_at_Vertice - jal function_print_at_Vertice + # Calling function internal_3 + lw $t0, 24($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_print_at_Vertice + sw $v1, 32($sp) # internal_1 = result of internal_3 addi $sp, $sp, 8 # Freeing space for arguments # Get attribute cdr of self - lw $t0, 16($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'cdr' from the instance + lw $t0, 32($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'cdr' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8756104442859 + beq $t6, $t5, int_get_attribute_8772684603112 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8756104442859 - j object_get_attribute_8756104442859 - int_get_attribute_8756104442859: + beq $t6, $t5, bool_get_attribute_8772684603112 + j object_get_attribute_8772684603112 + int_get_attribute_8772684603112: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4465,9 +5426,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_2 = self.cdr - j end_get_attribute_8756104442859 - bool_get_attribute_8756104442859: + sw $v0, 12($sp) # internal_4 = self.cdr + j end_get_attribute_8772684603112 + bool_get_attribute_8772684603112: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4475,31 +5436,55 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_2 = self.cdr - j end_get_attribute_8756104442859 - object_get_attribute_8756104442859: - sw $t1, 4($sp) # internal_2 = cdr - end_get_attribute_8756104442859: + sw $v0, 12($sp) # internal_4 = self.cdr + j end_get_attribute_8772684603112 + object_get_attribute_8772684603112: + sw $t1, 12($sp) # internal_4 = self.cdr + end_get_attribute_8772684603112: + + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Get method print of VList + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_2 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_2 + # Argument internal_4 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_4 - # Calling function function_print_at_VList - jal function_print_at_VList + # Calling function internal_7 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_3 = result of function_print_at_VList + sw $v1, 16($sp) # internal_5 = result of internal_7 addi $sp, $sp, 8 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 16 + addi $sp, $sp, 32 jr $ra @@ -4537,17 +5522,17 @@ # Set attribute boolop of self lw $t0, 8($sp) # $t0 = self lw $t1, 4($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8756104443417 + beq $t1, $zero, object_set_attribute_8772684603694 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104443417 + beq $t6, $t5, int_set_attribute_8772684603694 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104443417 - j object_set_attribute_8756104443417 - int_set_attribute_8756104443417: + beq $t6, $t5, bool_set_attribute_8772684603694 + j object_set_attribute_8772684603694 + int_set_attribute_8772684603694: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4556,8 +5541,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.boolop = internal_0 - j end_set_attribute_8756104443417 - bool_set_attribute_8756104443417: + j end_set_attribute_8772684603694 + bool_set_attribute_8772684603694: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4566,10 +5551,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.boolop = internal_0 - j end_set_attribute_8756104443417 - object_set_attribute_8756104443417: + j end_set_attribute_8772684603694 + object_set_attribute_8772684603694: sw $t1, 8($t0) # self.boolop = internal_0 - end_set_attribute_8756104443417: + end_set_attribute_8772684603694: # Allocating String li $v0, 9 @@ -4589,17 +5574,17 @@ # Set attribute rest of self lw $t0, 8($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_1 - beq $t1, $zero, object_set_attribute_8756104443450 + beq $t1, $zero, object_set_attribute_8772684603727 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104443450 + beq $t6, $t5, int_set_attribute_8772684603727 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104443450 - j object_set_attribute_8756104443450 - int_set_attribute_8756104443450: + beq $t6, $t5, bool_set_attribute_8772684603727 + j object_set_attribute_8772684603727 + int_set_attribute_8772684603727: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4608,8 +5593,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.rest = internal_1 - j end_set_attribute_8756104443450 - bool_set_attribute_8756104443450: + j end_set_attribute_8772684603727 + bool_set_attribute_8772684603727: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4618,10 +5603,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.rest = internal_1 - j end_set_attribute_8756104443450 - object_set_attribute_8756104443450: + j end_set_attribute_8772684603727 + object_set_attribute_8772684603727: sw $t1, 12($t0) # self.rest = internal_1 - end_set_attribute_8756104443450: + end_set_attribute_8772684603727: # Loading return value in $v1 lw $v1, 8($sp) @@ -4633,11 +5618,11 @@ function_read_input_at_Parse: # Function parameters - # $ra = 72($sp) - # self = 68($sp) + # $ra = 116($sp) + # self = 112($sp) # Reserving space for local variables - addi $sp, $sp, -68 + addi $sp, $sp, -112 # Allocating Graph li $v0, 9 @@ -4646,20 +5631,20 @@ la $t0, type_Graph # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 60($sp) # internal_1 = address of allocated object Graph + sw $v0, 104($sp) # internal_1 = address of allocated object Graph # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_1 - lw $t0, 68($sp) + lw $t0, 112($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function___init___at_Graph jal function___init___at_Graph lw $ra, 4($sp) - sw $v1, 68($sp) # internal_1 = result of function___init___at_Graph + sw $v1, 112($sp) # internal_1 = result of function___init___at_Graph addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments @@ -4667,31 +5652,55 @@ sw $ra, 8($sp) # Storing return address # Argument g - lw $t0, 76($sp) + lw $t0, 120($sp) sw $t0, 4($sp) # Storing g # Argument internal_1 - lw $t0, 72($sp) + lw $t0, 116($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 76($sp) # g = result of function_assign + sw $v1, 120($sp) # g = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 92($sp) # internal_4 = address of allocated object Int + + # Get method in_string of Parse + lw $t0, 112($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 92($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 88($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 76($sp) + lw $t0, 120($sp) sw $t0, 0($sp) # Storing self - # Calling function function_in_string_at_IO - jal function_in_string_at_IO + # Calling function internal_5 + lw $t0, 96($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 60($sp) # internal_3 = result of function_in_string_at_IO + sw $v1, 104($sp) # internal_3 = result of internal_5 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments @@ -4699,34 +5708,37 @@ sw $ra, 8($sp) # Storing return address # Argument line - lw $t0, 68($sp) + lw $t0, 112($sp) sw $t0, 4($sp) # Storing line # Argument internal_3 - lw $t0, 64($sp) + lw $t0, 108($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 68($sp) # line = result of function_assign + sw $v1, 112($sp) # line = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - while_start_8756104471956: + # Allocating NUll to internal_6 + sw $zero, 84($sp) # internal_6 = 0 + + while_start_8772684691703: # Get attribute boolop of self - lw $t0, 68($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'boolop' from the instance + lw $t0, 112($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'boolop' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8756104443664 + beq $t6, $t5, int_get_attribute_8772684604233 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8756104443664 - j object_get_attribute_8756104443664 - int_get_attribute_8756104443664: + beq $t6, $t5, bool_get_attribute_8772684604233 + j object_get_attribute_8772684604233 + int_get_attribute_8772684604233: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4734,9 +5746,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 48($sp) # internal_4 = self.boolop - j end_get_attribute_8756104443664 - bool_get_attribute_8756104443664: + sw $v0, 80($sp) # internal_7 = self.boolop + j end_get_attribute_8772684604233 + bool_get_attribute_8772684604233: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4744,11 +5756,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 48($sp) # internal_4 = self.boolop - j end_get_attribute_8756104443664 - object_get_attribute_8756104443664: - sw $t1, 48($sp) # internal_4 = boolop - end_get_attribute_8756104443664: + sw $v0, 80($sp) # internal_7 = self.boolop + j end_get_attribute_8772684604233 + object_get_attribute_8772684604233: + sw $t1, 80($sp) # internal_7 = self.boolop + end_get_attribute_8772684604233: # Allocating String li $v0, 9 @@ -4762,28 +5774,28 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_5[0] = '\n' + sb $t0, 8($v0) # internal_8[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 44($sp) # internal_5 = "\n" + sw $v0, 76($sp) # internal_8 = "\n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument line - lw $t0, 68($sp) + lw $t0, 112($sp) sw $t0, 4($sp) # Storing line - # Argument internal_5 - lw $t0, 56($sp) - sw $t0, 0($sp) # Storing internal_5 + # Argument internal_8 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_8 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 52($sp) # internal_6 = result of function_equal + sw $v1, 84($sp) # internal_9 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -4796,7 +5808,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_7 = address of allocated object Int + sw $v0, 68($sp) # internal_10 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -4808,24 +5820,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_8 = address of allocated object Int + sw $v0, 64($sp) # internal_11 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_6 - lw $t0, 52($sp) - sw $t0, 4($sp) # Storing internal_6 + # Argument internal_9 + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing internal_9 - # Argument internal_7 - lw $t0, 48($sp) - sw $t0, 0($sp) # Storing internal_7 + # Argument internal_10 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_10 # Calling function function_xor jal function_xor lw $ra, 8($sp) - sw $v1, 44($sp) # internal_8 = result of function_xor + sw $v1, 76($sp) # internal_11 = result of function_xor addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -4841,24 +5853,24 @@ sb $zero, 8($v0) # Null-terminator at the end of the string - sw $v0, 28($sp) # internal_9 = "" + sw $v0, 60($sp) # internal_12 = "" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument line - lw $t0, 68($sp) + lw $t0, 112($sp) sw $t0, 4($sp) # Storing line - # Argument internal_9 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_9 + # Argument internal_12 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_12 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 36($sp) # internal_10 = result of function_equal + sw $v1, 68($sp) # internal_13 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -4871,7 +5883,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_11 = address of allocated object Int + sw $v0, 52($sp) # internal_14 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -4883,107 +5895,203 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_12 = address of allocated object Int + sw $v0, 48($sp) # internal_15 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_10 - lw $t0, 36($sp) - sw $t0, 4($sp) # Storing internal_10 + # Argument internal_13 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_13 - # Argument internal_11 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_11 + # Argument internal_14 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_14 # Calling function function_xor jal function_xor lw $ra, 8($sp) - sw $v1, 28($sp) # internal_12 = result of function_xor + sw $v1, 60($sp) # internal_15 = result of function_xor addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_17 = address of allocated object Int + + # Get method and of BoolOp + lw $t0, 80($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 40($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 36($sp) + # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address - # Argument internal_4 - lw $t0, 64($sp) - sw $t0, 8($sp) # Storing internal_4 + # Argument internal_7 + lw $t0, 96($sp) + sw $t0, 8($sp) # Storing internal_7 - # Argument internal_8 - lw $t0, 48($sp) - sw $t0, 4($sp) # Storing internal_8 + # Argument internal_11 + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing internal_11 - # Argument internal_12 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_12 + # Argument internal_15 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_15 - # Calling function function_and_at_BoolOp - jal function_and_at_BoolOp + # Calling function internal_18 + lw $t0, 52($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 28($sp) # internal_13 = result of function_and_at_BoolOp + sw $v1, 60($sp) # internal_16 = result of internal_18 addi $sp, $sp, 16 # Freeing space for arguments - # If internal_13 then goto while_body_8756104471956 - lw $t0, 12($sp) # Loading the address of the condition + # If internal_16 then goto while_body_8772684691703 + lw $t0, 44($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8756104471956 + beq $t0, $t1, while_body_8772684691703 + + # Jumping to while_end_8772684691703 + j while_end_8772684691703 + + while_body_8772684691703: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Jumping to while_end_8756104471956 - j while_end_8756104471956 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_20 = address of allocated object Int - while_body_8756104471956: + # Get method parse_line of Parse + lw $t0, 112($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 28($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 24($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 80($sp) + lw $t0, 124($sp) sw $t0, 4($sp) # Storing self # Argument line - lw $t0, 68($sp) + lw $t0, 112($sp) sw $t0, 0($sp) # Storing line - # Calling function function_parse_line_at_Parse - jal function_parse_line_at_Parse + # Calling function internal_21 + lw $t0, 36($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 20($sp) # internal_14 = result of function_parse_line_at_Parse + sw $v1, 44($sp) # internal_19 = result of internal_21 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_23 = address of allocated object Int + + # Get method add_vertice of Graph + lw $t0, 108($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument g - lw $t0, 76($sp) + lw $t0, 120($sp) sw $t0, 4($sp) # Storing g - # Argument internal_14 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_14 + # Argument internal_19 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_19 - # Calling function function_add_vertice_at_Graph - jal function_add_vertice_at_Graph + # Calling function internal_24 + lw $t0, 24($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 16($sp) # internal_15 = result of function_add_vertice_at_Graph + sw $v1, 32($sp) # internal_22 = result of internal_24 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_26 = address of allocated object Int + + # Get method in_string of Parse + lw $t0, 112($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 76($sp) + lw $t0, 120($sp) sw $t0, 0($sp) # Storing self - # Calling function function_in_string_at_IO - jal function_in_string_at_IO + # Calling function internal_27 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_16 = result of function_in_string_at_IO + sw $v1, 16($sp) # internal_25 = result of internal_27 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments @@ -4991,40 +6099,40 @@ sw $ra, 8($sp) # Storing return address # Argument line - lw $t0, 68($sp) + lw $t0, 112($sp) sw $t0, 4($sp) # Storing line - # Argument internal_16 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_16 + # Argument internal_25 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_25 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 68($sp) # line = result of function_assign + sw $v1, 112($sp) # line = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to while_start_8756104471956 - j while_start_8756104471956 + # Jumping to while_start_8772684691703 + j while_start_8772684691703 - while_end_8756104471956: + while_end_8772684691703: # Loading return value in $v1 - lw $v1, 64($sp) + lw $v1, 108($sp) # Freeing space for local variables - addi $sp, $sp, 68 + addi $sp, $sp, 112 jr $ra function_parse_line_at_Parse: # Function parameters - # $ra = 88($sp) - # self = 84($sp) - # s = 80($sp) + # $ra = 156($sp) + # self = 152($sp) + # s = 148($sp) # Reserving space for local variables - addi $sp, $sp, -80 + addi $sp, $sp, -148 # Allocating Vertice li $v0, 9 @@ -5033,56 +6141,104 @@ la $t0, type_Vertice # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 72($sp) # internal_1 = address of allocated object Vertice + sw $v0, 140($sp) # internal_1 = address of allocated object Vertice # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_1 - lw $t0, 80($sp) + lw $t0, 148($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function___init___at_Vertice jal function___init___at_Vertice lw $ra, 4($sp) - sw $v1, 80($sp) # internal_1 = result of function___init___at_Vertice + sw $v1, 148($sp) # internal_1 = result of function___init___at_Vertice addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 132($sp) # internal_3 = address of allocated object Int + + # Get method a2i of Parse + lw $t0, 152($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 132($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 128($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 96($sp) + lw $t0, 164($sp) sw $t0, 4($sp) # Storing self # Argument s - lw $t0, 92($sp) + lw $t0, 160($sp) sw $t0, 0($sp) # Storing s - # Calling function function_a2i_at_Parse - jal function_a2i_at_Parse + # Calling function internal_4 + lw $t0, 140($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 80($sp) # internal_2 = result of function_a2i_at_Parse + sw $v1, 148($sp) # internal_2 = result of internal_4 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_6 = address of allocated object Int + + # Get method init of Vertice + lw $t0, 140($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 120($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 116($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_1 - lw $t0, 84($sp) + lw $t0, 152($sp) sw $t0, 4($sp) # Storing internal_1 # Argument internal_2 - lw $t0, 80($sp) + lw $t0, 148($sp) sw $t0, 0($sp) # Storing internal_2 - # Calling function function_init_at_Vertice - jal function_init_at_Vertice + # Calling function internal_7 + lw $t0, 128($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 76($sp) # internal_3 = result of function_init_at_Vertice + sw $v1, 136($sp) # internal_5 = result of internal_7 addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -5090,34 +6246,37 @@ sw $ra, 8($sp) # Storing return address # Argument v - lw $t0, 88($sp) + lw $t0, 156($sp) sw $t0, 4($sp) # Storing v - # Argument internal_3 - lw $t0, 76($sp) - sw $t0, 0($sp) # Storing internal_3 + # Argument internal_5 + lw $t0, 136($sp) + sw $t0, 0($sp) # Storing internal_5 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 88($sp) # v = result of function_assign + sw $v1, 156($sp) # v = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - while_start_8756104472890: + # Allocating NUll to internal_8 + sw $zero, 112($sp) # internal_8 = 0 + + while_start_8772684692381: # Get attribute rest of self - lw $t0, 84($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'rest' from the instance + lw $t0, 152($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'rest' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8756104445175 + beq $t6, $t5, int_get_attribute_8772684605904 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8756104445175 - j object_get_attribute_8756104445175 - int_get_attribute_8756104445175: + beq $t6, $t5, bool_get_attribute_8772684605904 + j object_get_attribute_8772684605904 + int_get_attribute_8772684605904: li $v0, 9 addi $a0, $zero, 12 syscall @@ -5125,9 +6284,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 60($sp) # internal_4 = self.rest - j end_get_attribute_8756104445175 - bool_get_attribute_8756104445175: + sw $v0, 108($sp) # internal_9 = self.rest + j end_get_attribute_8772684605904 + bool_get_attribute_8772684605904: li $v0, 9 addi $a0, $zero, 12 syscall @@ -5135,24 +6294,48 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 60($sp) # internal_4 = self.rest - j end_get_attribute_8756104445175 - object_get_attribute_8756104445175: - sw $t1, 60($sp) # internal_4 = rest - end_get_attribute_8756104445175: + sw $v0, 108($sp) # internal_9 = self.rest + j end_get_attribute_8772684605904 + object_get_attribute_8772684605904: + sw $t1, 108($sp) # internal_9 = self.rest + end_get_attribute_8772684605904: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_11 = address of allocated object Int + + # Get method length of String + lw $t0, 108($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 100($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 96($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_4 - lw $t0, 68($sp) - sw $t0, 0($sp) # Storing internal_4 + # Argument internal_9 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_9 - # Calling function function_length_at_String - jal function_length_at_String + # Calling function internal_12 + lw $t0, 104($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 64($sp) # internal_5 = result of function_length_at_String + sw $v1, 112($sp) # internal_10 = result of internal_12 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 0 @@ -5165,24 +6348,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 52($sp) # internal_6 = address of allocated object Int + sw $v0, 92($sp) # internal_13 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_5 - lw $t0, 68($sp) - sw $t0, 4($sp) # Storing internal_5 + # Argument internal_10 + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing internal_10 - # Argument internal_6 - lw $t0, 64($sp) - sw $t0, 0($sp) # Storing internal_6 + # Argument internal_13 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_13 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 60($sp) # internal_7 = result of function_equal + sw $v1, 100($sp) # internal_14 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -5195,7 +6378,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_8 = address of allocated object Int + sw $v0, 84($sp) # internal_15 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -5207,50 +6390,50 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_9 = address of allocated object Int + sw $v0, 80($sp) # internal_16 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_7 - lw $t0, 60($sp) - sw $t0, 4($sp) # Storing internal_7 + # Argument internal_14 + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing internal_14 - # Argument internal_8 - lw $t0, 56($sp) - sw $t0, 0($sp) # Storing internal_8 + # Argument internal_15 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_15 # Calling function function_xor jal function_xor lw $ra, 8($sp) - sw $v1, 52($sp) # internal_9 = result of function_xor + sw $v1, 92($sp) # internal_16 = result of function_xor addi $sp, $sp, 12 # Freeing space for arguments - # If internal_9 then goto while_body_8756104472890 - lw $t0, 40($sp) # Loading the address of the condition + # If internal_16 then goto while_body_8772684692381 + lw $t0, 80($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8756104472890 + beq $t0, $t1, while_body_8772684692381 - # Jumping to while_end_8756104472890 - j while_end_8756104472890 + # Jumping to while_end_8772684692381 + j while_end_8772684692381 - while_body_8756104472890: + while_body_8772684692381: # Get attribute rest of self - lw $t0, 84($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'rest' from the instance + lw $t0, 152($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'rest' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8756104445591 + beq $t6, $t5, int_get_attribute_8772684606344 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8756104445591 - j object_get_attribute_8756104445591 - int_get_attribute_8756104445591: + beq $t6, $t5, bool_get_attribute_8772684606344 + j object_get_attribute_8772684606344 + int_get_attribute_8772684606344: li $v0, 9 addi $a0, $zero, 12 syscall @@ -5258,9 +6441,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 32($sp) # internal_11 = self.rest - j end_get_attribute_8756104445591 - bool_get_attribute_8756104445591: + sw $v0, 72($sp) # internal_18 = self.rest + j end_get_attribute_8772684606344 + bool_get_attribute_8772684606344: li $v0, 9 addi $a0, $zero, 12 syscall @@ -5268,28 +6451,52 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 32($sp) # internal_11 = self.rest - j end_get_attribute_8756104445591 - object_get_attribute_8756104445591: - sw $t1, 32($sp) # internal_11 = rest - end_get_attribute_8756104445591: + sw $v0, 72($sp) # internal_18 = self.rest + j end_get_attribute_8772684606344 + object_get_attribute_8772684606344: + sw $t1, 72($sp) # internal_18 = self.rest + end_get_attribute_8772684606344: + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_20 = address of allocated object Int + + # Get method a2i of Parse + lw $t0, 152($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 64($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 60($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 96($sp) + lw $t0, 164($sp) sw $t0, 4($sp) # Storing self - # Argument internal_11 - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_11 + # Argument internal_18 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_18 - # Calling function function_a2i_at_Parse - jal function_a2i_at_Parse + # Calling function internal_21 + lw $t0, 72($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 40($sp) # internal_12 = result of function_a2i_at_Parse + sw $v1, 80($sp) # internal_19 = result of internal_21 addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -5297,32 +6504,32 @@ sw $ra, 8($sp) # Storing return address # Argument succ - lw $t0, 48($sp) + lw $t0, 88($sp) sw $t0, 4($sp) # Storing succ - # Argument internal_12 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_12 + # Argument internal_19 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_19 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 48($sp) # succ = result of function_assign + sw $v1, 88($sp) # succ = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Get attribute rest of self - lw $t0, 84($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'rest' from the instance + lw $t0, 152($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'rest' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8756104445672 + beq $t6, $t5, int_get_attribute_8772684606449 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8756104445672 - j object_get_attribute_8756104445672 - int_get_attribute_8756104445672: + beq $t6, $t5, bool_get_attribute_8772684606449 + j object_get_attribute_8772684606449 + int_get_attribute_8772684606449: li $v0, 9 addi $a0, $zero, 12 syscall @@ -5330,9 +6537,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 20($sp) # internal_14 = self.rest - j end_get_attribute_8756104445672 - bool_get_attribute_8756104445672: + sw $v0, 52($sp) # internal_23 = self.rest + j end_get_attribute_8772684606449 + bool_get_attribute_8772684606449: li $v0, 9 addi $a0, $zero, 12 syscall @@ -5340,28 +6547,52 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 20($sp) # internal_14 = self.rest - j end_get_attribute_8756104445672 - object_get_attribute_8756104445672: - sw $t1, 20($sp) # internal_14 = rest - end_get_attribute_8756104445672: + sw $v0, 52($sp) # internal_23 = self.rest + j end_get_attribute_8772684606449 + object_get_attribute_8772684606449: + sw $t1, 52($sp) # internal_23 = self.rest + end_get_attribute_8772684606449: + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_25 = address of allocated object Int + + # Get method a2i of Parse + lw $t0, 152($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 44($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 40($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 96($sp) + lw $t0, 164($sp) sw $t0, 4($sp) # Storing self - # Argument internal_14 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_14 + # Argument internal_23 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_23 - # Calling function function_a2i_at_Parse - jal function_a2i_at_Parse + # Calling function internal_26 + lw $t0, 52($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 28($sp) # internal_15 = result of function_a2i_at_Parse + sw $v1, 60($sp) # internal_24 = result of internal_26 addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -5369,17 +6600,17 @@ sw $ra, 8($sp) # Storing return address # Argument weight - lw $t0, 36($sp) + lw $t0, 68($sp) sw $t0, 4($sp) # Storing weight - # Argument internal_15 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_15 + # Argument internal_24 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_24 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 36($sp) # weight = result of function_assign + sw $v1, 68($sp) # weight = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Edge @@ -5389,101 +6620,173 @@ la $t0, type_Edge # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 12($sp) # internal_16 = address of allocated object Edge + sw $v0, 36($sp) # internal_27 = address of allocated object Edge # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_16 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_16 + # Argument internal_27 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_27 # Calling function function___init___at_Edge jal function___init___at_Edge lw $ra, 4($sp) - sw $v1, 20($sp) # internal_16 = result of function___init___at_Edge + sw $v1, 44($sp) # internal_27 = result of function___init___at_Edge addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_29 = address of allocated object Int + + # Get method number of Vertice + lw $t0, 144($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 28($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 24($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument v - lw $t0, 84($sp) + lw $t0, 152($sp) sw $t0, 0($sp) # Storing v - # Calling function function_number_at_Vertice - jal function_number_at_Vertice + # Calling function internal_30 + lw $t0, 32($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 16($sp) # internal_17 = result of function_number_at_Vertice + sw $v1, 40($sp) # internal_28 = result of internal_30 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_32 = address of allocated object Int + + # Get method init of Edge + lw $t0, 36($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + # Passing function arguments addi $sp, $sp, -20 # Reserving space for arguments sw $ra, 16($sp) # Storing return address - # Argument internal_16 - lw $t0, 32($sp) - sw $t0, 12($sp) # Storing internal_16 + # Argument internal_27 + lw $t0, 56($sp) + sw $t0, 12($sp) # Storing internal_27 - # Argument internal_17 - lw $t0, 28($sp) - sw $t0, 8($sp) # Storing internal_17 + # Argument internal_28 + lw $t0, 52($sp) + sw $t0, 8($sp) # Storing internal_28 # Argument succ - lw $t0, 56($sp) + lw $t0, 96($sp) sw $t0, 4($sp) # Storing succ # Argument weight - lw $t0, 44($sp) + lw $t0, 76($sp) sw $t0, 0($sp) # Storing weight - # Calling function function_init_at_Edge - jal function_init_at_Edge + # Calling function internal_33 + lw $t0, 32($sp) + jalr $t0 lw $ra, 16($sp) - sw $v1, 24($sp) # internal_18 = result of function_init_at_Edge + sw $v1, 40($sp) # internal_31 = result of internal_33 addi $sp, $sp, 20 # Freeing space for arguments + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_35 = address of allocated object Int + + # Get method add_out of Vertice + lw $t0, 144($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument v - lw $t0, 88($sp) + lw $t0, 156($sp) sw $t0, 4($sp) # Storing v - # Argument internal_18 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_18 + # Argument internal_31 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_31 - # Calling function function_add_out_at_Vertice - jal function_add_out_at_Vertice + # Calling function internal_36 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_19 = result of function_add_out_at_Vertice + sw $v1, 20($sp) # internal_34 = result of internal_36 addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to while_start_8756104472890 - j while_start_8756104472890 + # Jumping to while_start_8772684692381 + j while_start_8772684692381 - while_end_8756104472890: + while_end_8772684692381: # Loading return value in $v1 - lw $v1, 76($sp) + lw $v1, 144($sp) # Freeing space for local variables - addi $sp, $sp, 80 + addi $sp, $sp, 148 jr $ra function_c2i_at_Parse: # Function parameters - # $ra = 216($sp) - # self = 212($sp) - # char = 208($sp) + # $ra = 224($sp) + # self = 220($sp) + # char = 216($sp) # Reserving space for local variables - addi $sp, $sp, -208 + addi $sp, $sp, -216 # Allocating Bool 0 li $v0, 9 @@ -5495,7 +6798,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 200($sp) # internal_1 = address of allocated object Int + sw $v0, 208($sp) # internal_1 = address of allocated object Int # Allocating String li $v0, 9 @@ -5513,40 +6816,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 196($sp) # internal_2 = "0" + sw $v0, 204($sp) # internal_2 = "0" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_2 - lw $t0, 208($sp) + lw $t0, 216($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 204($sp) # internal_3 = result of function_equal + sw $v1, 212($sp) # internal_3 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_1 = internal_3 - lw $t0, 192($sp) - sw $t0, 200($sp) + lw $t0, 200($sp) + sw $t0, 208($sp) - # If internal_1 then goto then_8756104473483 - lw $t0, 200($sp) # Loading the address of the condition + # If internal_1 then goto then_8772684693486 + lw $t0, 208($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8756104473483 + beq $t0, $t1, then_8772684693486 - # Jumping to else_8756104473483 - j else_8756104473483 + # Jumping to else_8772684693486 + j else_8772684693486 - then_8756104473483: + then_8772684693486: # Allocating Int 0 li $v0, 9 @@ -5558,16 +6861,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 188($sp) # internal_4 = address of allocated object Int + sw $v0, 196($sp) # internal_4 = address of allocated object Int # internal_0 = internal_4 - lw $t0, 188($sp) - sw $t0, 204($sp) + lw $t0, 196($sp) + sw $t0, 212($sp) - # Jumping to endif_8756104473483 - j endif_8756104473483 + # Jumping to endif_8772684693486 + j endif_8772684693486 - else_8756104473483: + else_8772684693486: # Allocating Bool 0 li $v0, 9 @@ -5579,7 +6882,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 180($sp) # internal_6 = address of allocated object Int + sw $v0, 188($sp) # internal_6 = address of allocated object Int # Allocating String li $v0, 9 @@ -5597,40 +6900,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 176($sp) # internal_7 = "1" + sw $v0, 184($sp) # internal_7 = "1" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_7 - lw $t0, 188($sp) + lw $t0, 196($sp) sw $t0, 0($sp) # Storing internal_7 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 184($sp) # internal_8 = result of function_equal + sw $v1, 192($sp) # internal_8 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_6 = internal_8 - lw $t0, 172($sp) - sw $t0, 180($sp) + lw $t0, 180($sp) + sw $t0, 188($sp) - # If internal_6 then goto then_8756104473477 - lw $t0, 180($sp) # Loading the address of the condition + # If internal_6 then goto then_8772684693480 + lw $t0, 188($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8756104473477 + beq $t0, $t1, then_8772684693480 - # Jumping to else_8756104473477 - j else_8756104473477 + # Jumping to else_8772684693480 + j else_8772684693480 - then_8756104473477: + then_8772684693480: # Allocating Int 1 li $v0, 9 @@ -5642,16 +6945,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 168($sp) # internal_9 = address of allocated object Int + sw $v0, 176($sp) # internal_9 = address of allocated object Int # internal_5 = internal_9 - lw $t0, 168($sp) - sw $t0, 184($sp) + lw $t0, 176($sp) + sw $t0, 192($sp) - # Jumping to endif_8756104473477 - j endif_8756104473477 + # Jumping to endif_8772684693480 + j endif_8772684693480 - else_8756104473477: + else_8772684693480: # Allocating Bool 0 li $v0, 9 @@ -5663,7 +6966,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 160($sp) # internal_11 = address of allocated object Int + sw $v0, 168($sp) # internal_11 = address of allocated object Int # Allocating String li $v0, 9 @@ -5681,40 +6984,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 156($sp) # internal_12 = "2" + sw $v0, 164($sp) # internal_12 = "2" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_12 - lw $t0, 168($sp) + lw $t0, 176($sp) sw $t0, 0($sp) # Storing internal_12 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 164($sp) # internal_13 = result of function_equal + sw $v1, 172($sp) # internal_13 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_11 = internal_13 - lw $t0, 152($sp) - sw $t0, 160($sp) + lw $t0, 160($sp) + sw $t0, 168($sp) - # If internal_11 then goto then_8756104473471 - lw $t0, 160($sp) # Loading the address of the condition + # If internal_11 then goto then_8772684693474 + lw $t0, 168($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8756104473471 + beq $t0, $t1, then_8772684693474 - # Jumping to else_8756104473471 - j else_8756104473471 + # Jumping to else_8772684693474 + j else_8772684693474 - then_8756104473471: + then_8772684693474: # Allocating Int 2 li $v0, 9 @@ -5726,16 +7029,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 148($sp) # internal_14 = address of allocated object Int + sw $v0, 156($sp) # internal_14 = address of allocated object Int # internal_10 = internal_14 - lw $t0, 148($sp) - sw $t0, 164($sp) + lw $t0, 156($sp) + sw $t0, 172($sp) - # Jumping to endif_8756104473471 - j endif_8756104473471 + # Jumping to endif_8772684693474 + j endif_8772684693474 - else_8756104473471: + else_8772684693474: # Allocating Bool 0 li $v0, 9 @@ -5747,7 +7050,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 140($sp) # internal_16 = address of allocated object Int + sw $v0, 148($sp) # internal_16 = address of allocated object Int # Allocating String li $v0, 9 @@ -5765,40 +7068,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 136($sp) # internal_17 = "3" + sw $v0, 144($sp) # internal_17 = "3" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_17 - lw $t0, 148($sp) + lw $t0, 156($sp) sw $t0, 0($sp) # Storing internal_17 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 144($sp) # internal_18 = result of function_equal + sw $v1, 152($sp) # internal_18 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_16 = internal_18 - lw $t0, 132($sp) - sw $t0, 140($sp) + lw $t0, 140($sp) + sw $t0, 148($sp) - # If internal_16 then goto then_8756104473465 - lw $t0, 140($sp) # Loading the address of the condition + # If internal_16 then goto then_8772684693468 + lw $t0, 148($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8756104473465 + beq $t0, $t1, then_8772684693468 - # Jumping to else_8756104473465 - j else_8756104473465 + # Jumping to else_8772684693468 + j else_8772684693468 - then_8756104473465: + then_8772684693468: # Allocating Int 3 li $v0, 9 @@ -5810,16 +7113,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 128($sp) # internal_19 = address of allocated object Int + sw $v0, 136($sp) # internal_19 = address of allocated object Int # internal_15 = internal_19 - lw $t0, 128($sp) - sw $t0, 144($sp) + lw $t0, 136($sp) + sw $t0, 152($sp) - # Jumping to endif_8756104473465 - j endif_8756104473465 + # Jumping to endif_8772684693468 + j endif_8772684693468 - else_8756104473465: + else_8772684693468: # Allocating Bool 0 li $v0, 9 @@ -5831,7 +7134,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 120($sp) # internal_21 = address of allocated object Int + sw $v0, 128($sp) # internal_21 = address of allocated object Int # Allocating String li $v0, 9 @@ -5849,40 +7152,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 116($sp) # internal_22 = "4" + sw $v0, 124($sp) # internal_22 = "4" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_22 - lw $t0, 128($sp) + lw $t0, 136($sp) sw $t0, 0($sp) # Storing internal_22 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 124($sp) # internal_23 = result of function_equal + sw $v1, 132($sp) # internal_23 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_21 = internal_23 - lw $t0, 112($sp) - sw $t0, 120($sp) + lw $t0, 120($sp) + sw $t0, 128($sp) - # If internal_21 then goto then_8756104473459 - lw $t0, 120($sp) # Loading the address of the condition + # If internal_21 then goto then_8772684693462 + lw $t0, 128($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8756104473459 + beq $t0, $t1, then_8772684693462 - # Jumping to else_8756104473459 - j else_8756104473459 + # Jumping to else_8772684693462 + j else_8772684693462 - then_8756104473459: + then_8772684693462: # Allocating Int 4 li $v0, 9 @@ -5894,16 +7197,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 108($sp) # internal_24 = address of allocated object Int + sw $v0, 116($sp) # internal_24 = address of allocated object Int # internal_20 = internal_24 - lw $t0, 108($sp) - sw $t0, 124($sp) + lw $t0, 116($sp) + sw $t0, 132($sp) - # Jumping to endif_8756104473459 - j endif_8756104473459 + # Jumping to endif_8772684693462 + j endif_8772684693462 - else_8756104473459: + else_8772684693462: # Allocating Bool 0 li $v0, 9 @@ -5915,7 +7218,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 100($sp) # internal_26 = address of allocated object Int + sw $v0, 108($sp) # internal_26 = address of allocated object Int # Allocating String li $v0, 9 @@ -5933,40 +7236,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 96($sp) # internal_27 = "5" + sw $v0, 104($sp) # internal_27 = "5" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_27 - lw $t0, 108($sp) + lw $t0, 116($sp) sw $t0, 0($sp) # Storing internal_27 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 104($sp) # internal_28 = result of function_equal + sw $v1, 112($sp) # internal_28 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_26 = internal_28 - lw $t0, 92($sp) - sw $t0, 100($sp) + lw $t0, 100($sp) + sw $t0, 108($sp) - # If internal_26 then goto then_8756104473453 - lw $t0, 100($sp) # Loading the address of the condition + # If internal_26 then goto then_8772684693456 + lw $t0, 108($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8756104473453 + beq $t0, $t1, then_8772684693456 - # Jumping to else_8756104473453 - j else_8756104473453 + # Jumping to else_8772684693456 + j else_8772684693456 - then_8756104473453: + then_8772684693456: # Allocating Int 5 li $v0, 9 @@ -5978,16 +7281,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 5 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 88($sp) # internal_29 = address of allocated object Int + sw $v0, 96($sp) # internal_29 = address of allocated object Int # internal_25 = internal_29 - lw $t0, 88($sp) - sw $t0, 104($sp) + lw $t0, 96($sp) + sw $t0, 112($sp) - # Jumping to endif_8756104473453 - j endif_8756104473453 + # Jumping to endif_8772684693456 + j endif_8772684693456 - else_8756104473453: + else_8772684693456: # Allocating Bool 0 li $v0, 9 @@ -5999,7 +7302,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # internal_31 = address of allocated object Int + sw $v0, 88($sp) # internal_31 = address of allocated object Int # Allocating String li $v0, 9 @@ -6017,40 +7320,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 76($sp) # internal_32 = "6" + sw $v0, 84($sp) # internal_32 = "6" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_32 - lw $t0, 88($sp) + lw $t0, 96($sp) sw $t0, 0($sp) # Storing internal_32 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 84($sp) # internal_33 = result of function_equal + sw $v1, 92($sp) # internal_33 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_31 = internal_33 - lw $t0, 72($sp) - sw $t0, 80($sp) + lw $t0, 80($sp) + sw $t0, 88($sp) - # If internal_31 then goto then_8756104473447 - lw $t0, 80($sp) # Loading the address of the condition + # If internal_31 then goto then_8772684693450 + lw $t0, 88($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8756104473447 + beq $t0, $t1, then_8772684693450 - # Jumping to else_8756104473447 - j else_8756104473447 + # Jumping to else_8772684693450 + j else_8772684693450 - then_8756104473447: + then_8772684693450: # Allocating Int 6 li $v0, 9 @@ -6062,16 +7365,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 6 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 68($sp) # internal_34 = address of allocated object Int + sw $v0, 76($sp) # internal_34 = address of allocated object Int # internal_30 = internal_34 - lw $t0, 68($sp) - sw $t0, 84($sp) + lw $t0, 76($sp) + sw $t0, 92($sp) - # Jumping to endif_8756104473447 - j endif_8756104473447 + # Jumping to endif_8772684693450 + j endif_8772684693450 - else_8756104473447: + else_8772684693450: # Allocating Bool 0 li $v0, 9 @@ -6083,7 +7386,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_36 = address of allocated object Int + sw $v0, 68($sp) # internal_36 = address of allocated object Int # Allocating String li $v0, 9 @@ -6101,40 +7404,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 56($sp) # internal_37 = "7" + sw $v0, 64($sp) # internal_37 = "7" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_37 - lw $t0, 68($sp) + lw $t0, 76($sp) sw $t0, 0($sp) # Storing internal_37 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 64($sp) # internal_38 = result of function_equal + sw $v1, 72($sp) # internal_38 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_36 = internal_38 - lw $t0, 52($sp) - sw $t0, 60($sp) + lw $t0, 60($sp) + sw $t0, 68($sp) - # If internal_36 then goto then_8756104473441 - lw $t0, 60($sp) # Loading the address of the condition + # If internal_36 then goto then_8772684693444 + lw $t0, 68($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8756104473441 + beq $t0, $t1, then_8772684693444 - # Jumping to else_8756104473441 - j else_8756104473441 + # Jumping to else_8772684693444 + j else_8772684693444 - then_8756104473441: + then_8772684693444: # Allocating Int 7 li $v0, 9 @@ -6146,16 +7449,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 7 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_39 = address of allocated object Int + sw $v0, 56($sp) # internal_39 = address of allocated object Int # internal_35 = internal_39 - lw $t0, 48($sp) - sw $t0, 64($sp) + lw $t0, 56($sp) + sw $t0, 72($sp) - # Jumping to endif_8756104473441 - j endif_8756104473441 + # Jumping to endif_8772684693444 + j endif_8772684693444 - else_8756104473441: + else_8772684693444: # Allocating Bool 0 li $v0, 9 @@ -6167,7 +7470,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_41 = address of allocated object Int + sw $v0, 48($sp) # internal_41 = address of allocated object Int # Allocating String li $v0, 9 @@ -6185,40 +7488,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 36($sp) # internal_42 = "8" + sw $v0, 44($sp) # internal_42 = "8" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_42 - lw $t0, 48($sp) + lw $t0, 56($sp) sw $t0, 0($sp) # Storing internal_42 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 44($sp) # internal_43 = result of function_equal + sw $v1, 52($sp) # internal_43 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_41 = internal_43 - lw $t0, 32($sp) - sw $t0, 40($sp) + lw $t0, 40($sp) + sw $t0, 48($sp) - # If internal_41 then goto then_8756104473435 - lw $t0, 40($sp) # Loading the address of the condition + # If internal_41 then goto then_8772684693438 + lw $t0, 48($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8756104473435 + beq $t0, $t1, then_8772684693438 - # Jumping to else_8756104473435 - j else_8756104473435 + # Jumping to else_8772684693438 + j else_8772684693438 - then_8756104473435: + then_8772684693438: # Allocating Int 8 li $v0, 9 @@ -6230,16 +7533,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 8 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_44 = address of allocated object Int + sw $v0, 36($sp) # internal_44 = address of allocated object Int # internal_40 = internal_44 - lw $t0, 28($sp) - sw $t0, 44($sp) + lw $t0, 36($sp) + sw $t0, 52($sp) - # Jumping to endif_8756104473435 - j endif_8756104473435 + # Jumping to endif_8772684693438 + j endif_8772684693438 - else_8756104473435: + else_8772684693438: # Allocating Bool 0 li $v0, 9 @@ -6251,7 +7554,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_46 = address of allocated object Int + sw $v0, 28($sp) # internal_46 = address of allocated object Int # Allocating String li $v0, 9 @@ -6269,40 +7572,40 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 16($sp) # internal_47 = "9" + sw $v0, 24($sp) # internal_47 = "9" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument char - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 4($sp) # Storing char # Argument internal_47 - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t0, 0($sp) # Storing internal_47 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 24($sp) # internal_48 = result of function_equal + sw $v1, 32($sp) # internal_48 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_46 = internal_48 - lw $t0, 12($sp) - sw $t0, 20($sp) + lw $t0, 20($sp) + sw $t0, 28($sp) - # If internal_46 then goto then_8756104473414 - lw $t0, 20($sp) # Loading the address of the condition + # If internal_46 then goto then_8772684693417 + lw $t0, 28($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8756104473414 + beq $t0, $t1, then_8772684693417 - # Jumping to else_8756104473414 - j else_8756104473414 + # Jumping to else_8772684693417 + j else_8772684693417 - then_8756104473414: + then_8772684693417: # Allocating Int 9 li $v0, 9 @@ -6314,29 +7617,53 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 9 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_49 = address of allocated object Int + sw $v0, 16($sp) # internal_49 = address of allocated object Int # internal_45 = internal_49 - lw $t0, 8($sp) - sw $t0, 24($sp) + lw $t0, 16($sp) + sw $t0, 32($sp) + + # Jumping to endif_8772684693417 + j endif_8772684693417 - # Jumping to endif_8756104473414 - j endif_8756104473414 + else_8772684693417: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_51 = address of allocated object Int - else_8756104473414: + # Get method abort of Parse + lw $t0, 220($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 220($sp) + lw $t0, 228($sp) sw $t0, 0($sp) # Storing self - # Calling function function_abort_at_Object - jal function_abort_at_Object + # Calling function internal_52 + lw $t0, 12($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 12($sp) # internal_50 = result of function_abort_at_Object + sw $v1, 20($sp) # internal_50 = result of internal_52 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 0 @@ -6349,114 +7676,114 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_51 = address of allocated object Int + sw $v0, 0($sp) # internal_53 = address of allocated object Int - # internal_45 = internal_51 + # internal_45 = internal_53 lw $t0, 0($sp) - sw $t0, 24($sp) + sw $t0, 32($sp) - # Jumping to endif_8756104473414 - j endif_8756104473414 + # Jumping to endif_8772684693417 + j endif_8772684693417 - endif_8756104473414: + endif_8772684693417: # internal_40 = internal_45 - lw $t0, 24($sp) - sw $t0, 44($sp) + lw $t0, 32($sp) + sw $t0, 52($sp) - # Jumping to endif_8756104473435 - j endif_8756104473435 + # Jumping to endif_8772684693438 + j endif_8772684693438 - endif_8756104473435: + endif_8772684693438: # internal_35 = internal_40 - lw $t0, 44($sp) - sw $t0, 64($sp) + lw $t0, 52($sp) + sw $t0, 72($sp) - # Jumping to endif_8756104473441 - j endif_8756104473441 + # Jumping to endif_8772684693444 + j endif_8772684693444 - endif_8756104473441: + endif_8772684693444: # internal_30 = internal_35 - lw $t0, 64($sp) - sw $t0, 84($sp) + lw $t0, 72($sp) + sw $t0, 92($sp) - # Jumping to endif_8756104473447 - j endif_8756104473447 + # Jumping to endif_8772684693450 + j endif_8772684693450 - endif_8756104473447: + endif_8772684693450: # internal_25 = internal_30 - lw $t0, 84($sp) - sw $t0, 104($sp) + lw $t0, 92($sp) + sw $t0, 112($sp) - # Jumping to endif_8756104473453 - j endif_8756104473453 + # Jumping to endif_8772684693456 + j endif_8772684693456 - endif_8756104473453: + endif_8772684693456: # internal_20 = internal_25 - lw $t0, 104($sp) - sw $t0, 124($sp) + lw $t0, 112($sp) + sw $t0, 132($sp) - # Jumping to endif_8756104473459 - j endif_8756104473459 + # Jumping to endif_8772684693462 + j endif_8772684693462 - endif_8756104473459: + endif_8772684693462: # internal_15 = internal_20 - lw $t0, 124($sp) - sw $t0, 144($sp) + lw $t0, 132($sp) + sw $t0, 152($sp) - # Jumping to endif_8756104473465 - j endif_8756104473465 + # Jumping to endif_8772684693468 + j endif_8772684693468 - endif_8756104473465: + endif_8772684693468: # internal_10 = internal_15 - lw $t0, 144($sp) - sw $t0, 164($sp) + lw $t0, 152($sp) + sw $t0, 172($sp) - # Jumping to endif_8756104473471 - j endif_8756104473471 + # Jumping to endif_8772684693474 + j endif_8772684693474 - endif_8756104473471: + endif_8772684693474: # internal_5 = internal_10 - lw $t0, 164($sp) - sw $t0, 184($sp) + lw $t0, 172($sp) + sw $t0, 192($sp) - # Jumping to endif_8756104473477 - j endif_8756104473477 + # Jumping to endif_8772684693480 + j endif_8772684693480 - endif_8756104473477: + endif_8772684693480: # internal_0 = internal_5 - lw $t0, 184($sp) - sw $t0, 204($sp) + lw $t0, 192($sp) + sw $t0, 212($sp) - # Jumping to endif_8756104473483 - j endif_8756104473483 + # Jumping to endif_8772684693486 + j endif_8772684693486 - endif_8756104473483: + endif_8772684693486: # Loading return value in $v1 - lw $v1, 204($sp) + lw $v1, 212($sp) # Freeing space for local variables - addi $sp, $sp, 208 + addi $sp, $sp, 216 jr $ra function_a2i_at_Parse: # Function parameters - # $ra = 152($sp) - # self = 148($sp) - # s = 144($sp) + # $ra = 232($sp) + # self = 228($sp) + # s = 224($sp) # Reserving space for local variables - addi $sp, $sp, -144 + addi $sp, $sp, -224 # Allocating Bool 0 li $v0, 9 @@ -6468,20 +7795,44 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 136($sp) # internal_1 = address of allocated object Int + sw $v0, 216($sp) # internal_1 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 208($sp) # internal_3 = address of allocated object Int + + # Get method length of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 208($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 204($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument s - lw $t0, 152($sp) + lw $t0, 232($sp) sw $t0, 0($sp) # Storing s - # Calling function function_length_at_String - jal function_length_at_String + # Calling function internal_4 + lw $t0, 212($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 140($sp) # internal_2 = result of function_length_at_String + sw $v1, 220($sp) # internal_2 = result of internal_4 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 0 @@ -6494,40 +7845,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 128($sp) # internal_3 = address of allocated object Int + sw $v0, 200($sp) # internal_5 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_2 - lw $t0, 144($sp) + lw $t0, 224($sp) sw $t0, 4($sp) # Storing internal_2 - # Argument internal_3 - lw $t0, 140($sp) - sw $t0, 0($sp) # Storing internal_3 + # Argument internal_5 + lw $t0, 212($sp) + sw $t0, 0($sp) # Storing internal_5 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 136($sp) # internal_4 = result of function_equal + sw $v1, 208($sp) # internal_6 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_1 = internal_4 - lw $t0, 124($sp) - sw $t0, 136($sp) + # internal_1 = internal_6 + lw $t0, 196($sp) + sw $t0, 216($sp) - # If internal_1 then goto then_8756104473935 - lw $t0, 136($sp) # Loading the address of the condition + # If internal_1 then goto then_8772684693938 + lw $t0, 216($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8756104473935 + beq $t0, $t1, then_8772684693938 - # Jumping to else_8756104473935 - j else_8756104473935 + # Jumping to else_8772684693938 + j else_8772684693938 - then_8756104473935: + then_8772684693938: # Allocating Int 0 li $v0, 9 @@ -6539,16 +7890,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 120($sp) # internal_5 = address of allocated object Int + sw $v0, 192($sp) # internal_7 = address of allocated object Int - # internal_0 = internal_5 - lw $t0, 120($sp) - sw $t0, 140($sp) + # internal_0 = internal_7 + lw $t0, 192($sp) + sw $t0, 220($sp) - # Jumping to endif_8756104473935 - j endif_8756104473935 + # Jumping to endif_8772684693938 + j endif_8772684693938 - else_8756104473935: + else_8772684693938: # Allocating Bool 0 li $v0, 9 @@ -6560,7 +7911,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 112($sp) # internal_7 = address of allocated object Int + sw $v0, 184($sp) # internal_9 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -6572,7 +7923,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 108($sp) # internal_8 = address of allocated object Int + sw $v0, 180($sp) # internal_10 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -6584,28 +7935,52 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 104($sp) # internal_9 = address of allocated object Int + sw $v0, 176($sp) # internal_11 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 168($sp) # internal_13 = address of allocated object Int + + # Get method substr of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 168($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 164($sp) # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument s - lw $t0, 160($sp) + lw $t0, 240($sp) sw $t0, 8($sp) # Storing s - # Argument internal_8 - lw $t0, 124($sp) - sw $t0, 4($sp) # Storing internal_8 + # Argument internal_10 + lw $t0, 196($sp) + sw $t0, 4($sp) # Storing internal_10 - # Argument internal_9 - lw $t0, 120($sp) - sw $t0, 0($sp) # Storing internal_9 + # Argument internal_11 + lw $t0, 192($sp) + sw $t0, 0($sp) # Storing internal_11 - # Calling function function_substr_at_String - jal function_substr_at_String + # Calling function internal_14 + lw $t0, 180($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 116($sp) # internal_10 = result of function_substr_at_String + sw $v1, 188($sp) # internal_12 = result of internal_14 addi $sp, $sp, 16 # Freeing space for arguments # Allocating String @@ -6620,44 +7995,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 45 - sb $t0, 8($v0) # internal_11[0] = '-' + sb $t0, 8($v0) # internal_15[0] = '-' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 96($sp) # internal_11 = "-" + sw $v0, 160($sp) # internal_15 = "-" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_10 - lw $t0, 112($sp) - sw $t0, 4($sp) # Storing internal_10 + # Argument internal_12 + lw $t0, 184($sp) + sw $t0, 4($sp) # Storing internal_12 - # Argument internal_11 - lw $t0, 108($sp) - sw $t0, 0($sp) # Storing internal_11 + # Argument internal_15 + lw $t0, 172($sp) + sw $t0, 0($sp) # Storing internal_15 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 104($sp) # internal_12 = result of function_equal + sw $v1, 168($sp) # internal_16 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_7 = internal_12 - lw $t0, 92($sp) - sw $t0, 112($sp) + # internal_9 = internal_16 + lw $t0, 156($sp) + sw $t0, 184($sp) - # If internal_7 then goto then_8756104473950 - lw $t0, 112($sp) # Loading the address of the condition + # If internal_9 then goto then_8772684693953 + lw $t0, 184($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8756104473950 + beq $t0, $t1, then_8772684693953 - # Jumping to else_8756104473950 - j else_8756104473950 + # Jumping to else_8772684693953 + j else_8772684693953 - then_8756104473950: + then_8772684693953: # Allocating Int 1 li $v0, 9 @@ -6669,20 +8044,44 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 88($sp) # internal_13 = address of allocated object Int + sw $v0, 152($sp) # internal_17 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_19 = address of allocated object Int + + # Get method length of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 144($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 140($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument s - lw $t0, 152($sp) + lw $t0, 232($sp) sw $t0, 0($sp) # Storing s - # Calling function function_length_at_String - jal function_length_at_String + # Calling function internal_20 + lw $t0, 148($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 92($sp) # internal_14 = result of function_length_at_String + sw $v1, 156($sp) # internal_18 = result of internal_20 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 1 @@ -6695,64 +8094,112 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # internal_15 = address of allocated object Int + sw $v0, 136($sp) # internal_21 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_14 - lw $t0, 96($sp) - sw $t0, 4($sp) # Storing internal_14 + # Argument internal_18 + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing internal_18 - # Argument internal_15 - lw $t0, 92($sp) - sw $t0, 0($sp) # Storing internal_15 + # Argument internal_21 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_21 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 88($sp) # internal_16 = result of function_sub + sw $v1, 144($sp) # internal_22 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 124($sp) # internal_24 = address of allocated object Int + + # Get method substr of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 124($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 120($sp) + # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument s - lw $t0, 160($sp) + lw $t0, 240($sp) sw $t0, 8($sp) # Storing s - # Argument internal_13 - lw $t0, 104($sp) - sw $t0, 4($sp) # Storing internal_13 + # Argument internal_17 + lw $t0, 168($sp) + sw $t0, 4($sp) # Storing internal_17 - # Argument internal_16 - lw $t0, 92($sp) - sw $t0, 0($sp) # Storing internal_16 + # Argument internal_22 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_22 - # Calling function function_substr_at_String - jal function_substr_at_String + # Calling function internal_25 + lw $t0, 136($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 88($sp) # internal_17 = result of function_substr_at_String + sw $v1, 144($sp) # internal_23 = result of internal_25 addi $sp, $sp, 16 # Freeing space for arguments + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_27 = address of allocated object Int + + # Get method a2i_aux of Parse + lw $t0, 228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 112($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 108($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 160($sp) + lw $t0, 240($sp) sw $t0, 4($sp) # Storing self - # Argument internal_17 - lw $t0, 84($sp) - sw $t0, 0($sp) # Storing internal_17 + # Argument internal_23 + lw $t0, 140($sp) + sw $t0, 0($sp) # Storing internal_23 - # Calling function function_a2i_aux_at_Parse - jal function_a2i_aux_at_Parse + # Calling function internal_28 + lw $t0, 120($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 80($sp) # internal_18 = result of function_a2i_aux_at_Parse + sw $v1, 128($sp) # internal_26 = result of internal_28 addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -6765,7 +8212,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 64($sp) # internal_19 = address of allocated object Int + sw $v0, 104($sp) # internal_29 = address of allocated object Int # Allocating Int 4294967295 li $v0, 9 @@ -6777,7 +8224,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4294967295 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_20 = address of allocated object Int + sw $v0, 100($sp) # internal_30 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -6789,52 +8236,52 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 56($sp) # internal_21 = address of allocated object Int + sw $v0, 96($sp) # internal_31 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_18 - lw $t0, 80($sp) - sw $t0, 4($sp) # Storing internal_18 + # Argument internal_26 + lw $t0, 128($sp) + sw $t0, 4($sp) # Storing internal_26 - # Argument internal_20 - lw $t0, 72($sp) - sw $t0, 0($sp) # Storing internal_20 + # Argument internal_30 + lw $t0, 112($sp) + sw $t0, 0($sp) # Storing internal_30 # Calling function function_xor jal function_xor lw $ra, 8($sp) - sw $v1, 68($sp) # internal_21 = result of function_xor + sw $v1, 108($sp) # internal_31 = result of function_xor addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_21 - lw $t0, 68($sp) - sw $t0, 4($sp) # Storing internal_21 + # Argument internal_31 + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing internal_31 - # Argument internal_19 - lw $t0, 76($sp) - sw $t0, 0($sp) # Storing internal_19 + # Argument internal_29 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_29 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 68($sp) # internal_21 = result of function_add + sw $v1, 108($sp) # internal_31 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # internal_6 = internal_21 - lw $t0, 56($sp) - sw $t0, 116($sp) + # internal_8 = internal_31 + lw $t0, 96($sp) + sw $t0, 188($sp) - # Jumping to endif_8756104473950 - j endif_8756104473950 + # Jumping to endif_8772684693953 + j endif_8772684693953 - else_8756104473950: + else_8772684693953: # Allocating Bool 0 li $v0, 9 @@ -6846,7 +8293,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_23 = address of allocated object Int + sw $v0, 88($sp) # internal_33 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -6858,7 +8305,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_24 = address of allocated object Int + sw $v0, 84($sp) # internal_34 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -6870,28 +8317,52 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_25 = address of allocated object Int + sw $v0, 80($sp) # internal_35 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_37 = address of allocated object Int + + # Get method substr of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 72($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 68($sp) # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument s - lw $t0, 160($sp) + lw $t0, 240($sp) sw $t0, 8($sp) # Storing s - # Argument internal_24 - lw $t0, 60($sp) - sw $t0, 4($sp) # Storing internal_24 + # Argument internal_34 + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing internal_34 - # Argument internal_25 - lw $t0, 56($sp) - sw $t0, 0($sp) # Storing internal_25 + # Argument internal_35 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_35 - # Calling function function_substr_at_String - jal function_substr_at_String + # Calling function internal_38 + lw $t0, 84($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 52($sp) # internal_26 = result of function_substr_at_String + sw $v1, 92($sp) # internal_36 = result of internal_38 addi $sp, $sp, 16 # Freeing space for arguments # Allocating String @@ -6906,46 +8377,58 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_27[0] = ' ' + sb $t0, 8($v0) # internal_39[0] = ' ' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 32($sp) # internal_27 = " " + sw $v0, 64($sp) # internal_39 = " " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_26 - lw $t0, 48($sp) - sw $t0, 4($sp) # Storing internal_26 + # Argument internal_36 + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing internal_36 - # Argument internal_27 - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_27 + # Argument internal_39 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_39 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 40($sp) # internal_28 = result of function_equal + sw $v1, 72($sp) # internal_40 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_23 = internal_28 - lw $t0, 28($sp) - sw $t0, 48($sp) + # internal_33 = internal_40 + lw $t0, 60($sp) + sw $t0, 88($sp) - # If internal_23 then goto then_8756104473944 - lw $t0, 48($sp) # Loading the address of the condition + # If internal_33 then goto then_8772684693947 + lw $t0, 88($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8756104473944 + beq $t0, $t1, then_8772684693947 + + # Jumping to else_8772684693947 + j else_8772684693947 - # Jumping to else_8756104473944 - j else_8756104473944 + then_8772684693947: - then_8756104473944: + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_41 = address of allocated object Int - # Allocating Int 1 + # Allocating Int 4 li $v0, 9 addi $a0, $zero, 12 syscall @@ -6953,22 +8436,34 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of the object sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 1 + addi $t0, $zero, 4 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_29 = address of allocated object Int + sw $v0, 48($sp) # internal_43 = address of allocated object Int + + # Get method length of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 48($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 44($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument s - lw $t0, 152($sp) + lw $t0, 232($sp) sw $t0, 0($sp) # Storing s - # Calling function function_length_at_String - jal function_length_at_String + # Calling function internal_44 + lw $t0, 52($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 28($sp) # internal_30 = result of function_length_at_String + sw $v1, 60($sp) # internal_42 = result of internal_44 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 1 @@ -6981,136 +8476,208 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_31 = address of allocated object Int + sw $v0, 40($sp) # internal_45 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_30 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_30 + # Argument internal_42 + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing internal_42 - # Argument internal_31 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_31 + # Argument internal_45 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_45 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 24($sp) # internal_32 = result of function_sub + sw $v1, 48($sp) # internal_46 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_48 = address of allocated object Int + + # Get method substr of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 28($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 24($sp) + # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument s - lw $t0, 160($sp) + lw $t0, 240($sp) sw $t0, 8($sp) # Storing s - # Argument internal_29 - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing internal_29 + # Argument internal_41 + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing internal_41 - # Argument internal_32 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_32 + # Argument internal_46 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_46 - # Calling function function_substr_at_String - jal function_substr_at_String + # Calling function internal_49 + lw $t0, 40($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 24($sp) # internal_33 = result of function_substr_at_String + sw $v1, 48($sp) # internal_47 = result of internal_49 addi $sp, $sp, 16 # Freeing space for arguments + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_51 = address of allocated object Int + + # Get method a2i of Parse + lw $t0, 228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 160($sp) + lw $t0, 240($sp) sw $t0, 4($sp) # Storing self - # Argument internal_33 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_33 + # Argument internal_47 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_47 - # Calling function function_a2i_at_Parse - jal function_a2i_at_Parse + # Calling function internal_52 + lw $t0, 24($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 16($sp) # internal_34 = result of function_a2i_at_Parse + sw $v1, 32($sp) # internal_50 = result of internal_52 addi $sp, $sp, 12 # Freeing space for arguments - # internal_22 = internal_34 - lw $t0, 4($sp) - sw $t0, 52($sp) + # internal_32 = internal_50 + lw $t0, 20($sp) + sw $t0, 92($sp) - # Jumping to endif_8756104473944 - j endif_8756104473944 + # Jumping to endif_8772684693947 + j endif_8772684693947 + + else_8772684693947: + + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_54 = address of allocated object Int - else_8756104473944: + # Get method a2i_aux of Parse + lw $t0, 228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 160($sp) + lw $t0, 240($sp) sw $t0, 4($sp) # Storing self # Argument s - lw $t0, 156($sp) + lw $t0, 236($sp) sw $t0, 0($sp) # Storing s - # Calling function function_a2i_aux_at_Parse - jal function_a2i_aux_at_Parse + # Calling function internal_55 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_35 = result of function_a2i_aux_at_Parse + sw $v1, 20($sp) # internal_53 = result of internal_55 addi $sp, $sp, 12 # Freeing space for arguments - # internal_22 = internal_35 - lw $t0, 0($sp) - sw $t0, 52($sp) + # internal_32 = internal_53 + lw $t0, 8($sp) + sw $t0, 92($sp) - # Jumping to endif_8756104473944 - j endif_8756104473944 + # Jumping to endif_8772684693947 + j endif_8772684693947 - endif_8756104473944: + endif_8772684693947: - # internal_6 = internal_22 - lw $t0, 52($sp) - sw $t0, 116($sp) + # internal_8 = internal_32 + lw $t0, 92($sp) + sw $t0, 188($sp) - # Jumping to endif_8756104473950 - j endif_8756104473950 + # Jumping to endif_8772684693953 + j endif_8772684693953 - endif_8756104473950: + endif_8772684693953: - # internal_0 = internal_6 - lw $t0, 116($sp) - sw $t0, 140($sp) + # internal_0 = internal_8 + lw $t0, 188($sp) + sw $t0, 220($sp) - # Jumping to endif_8756104473935 - j endif_8756104473935 + # Jumping to endif_8772684693938 + j endif_8772684693938 - endif_8756104473935: + endif_8772684693938: # Loading return value in $v1 - lw $v1, 140($sp) + lw $v1, 220($sp) # Freeing space for local variables - addi $sp, $sp, 144 + addi $sp, $sp, 224 jr $ra function_a2i_aux_at_Parse: # Function parameters - # $ra = 188($sp) - # self = 184($sp) - # s = 180($sp) + # $ra = 256($sp) + # self = 252($sp) + # s = 248($sp) # Reserving space for local variables - addi $sp, $sp, -180 + addi $sp, $sp, -248 # Allocating Int 0 li $v0, 9 @@ -7122,38 +8689,62 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 172($sp) # internal_1 = address of allocated object Int + sw $v0, 240($sp) # internal_1 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument int - lw $t0, 188($sp) + lw $t0, 256($sp) sw $t0, 4($sp) # Storing int # Argument internal_1 - lw $t0, 184($sp) + lw $t0, 252($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 188($sp) # int = result of function_assign + sw $v1, 256($sp) # int = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 228($sp) # internal_4 = address of allocated object Int + + # Get method length of String + lw $t0, 248($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 228($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 224($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument s - lw $t0, 188($sp) + lw $t0, 256($sp) sw $t0, 0($sp) # Storing s - # Calling function function_length_at_String - jal function_length_at_String + # Calling function internal_5 + lw $t0, 232($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 172($sp) # internal_3 = result of function_length_at_String + sw $v1, 240($sp) # internal_3 = result of internal_5 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments @@ -7161,17 +8752,17 @@ sw $ra, 8($sp) # Storing return address # Argument j - lw $t0, 180($sp) + lw $t0, 248($sp) sw $t0, 4($sp) # Storing j # Argument internal_3 - lw $t0, 176($sp) + lw $t0, 244($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 180($sp) # j = result of function_assign + sw $v1, 248($sp) # j = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 0 @@ -7184,56 +8775,59 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 156($sp) # internal_5 = address of allocated object Int + sw $v0, 216($sp) # internal_7 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 172($sp) + lw $t0, 232($sp) sw $t0, 4($sp) # Storing i - # Argument internal_5 - lw $t0, 168($sp) - sw $t0, 0($sp) # Storing internal_5 + # Argument internal_7 + lw $t0, 228($sp) + sw $t0, 0($sp) # Storing internal_7 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 172($sp) # i = result of function_assign + sw $v1, 232($sp) # i = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - while_start_8756104475158: + # Allocating NUll to internal_8 + sw $zero, 212($sp) # internal_8 = 0 + + while_start_8772684695161: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 172($sp) + lw $t0, 232($sp) sw $t0, 4($sp) # Storing i # Argument j - lw $t0, 180($sp) + lw $t0, 248($sp) sw $t0, 0($sp) # Storing j # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 164($sp) # internal_6 = result of function_less_than + sw $v1, 220($sp) # internal_9 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_6 then goto while_body_8756104475158 - lw $t0, 152($sp) # Loading the address of the condition + # If internal_9 then goto while_body_8772684695161 + lw $t0, 208($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8756104475158 + beq $t0, $t1, while_body_8772684695161 - # Jumping to while_end_8756104475158 - j while_end_8756104475158 + # Jumping to while_end_8772684695161 + j while_end_8772684695161 - while_body_8756104475158: + while_body_8772684695161: # Allocating Int 1 li $v0, 9 @@ -7245,28 +8839,52 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 144($sp) # internal_8 = address of allocated object Int + sw $v0, 200($sp) # internal_11 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 192($sp) # internal_13 = address of allocated object Int + + # Get method substr of String + lw $t0, 248($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 192($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 188($sp) # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument s - lw $t0, 196($sp) + lw $t0, 264($sp) sw $t0, 8($sp) # Storing s # Argument i - lw $t0, 176($sp) + lw $t0, 236($sp) sw $t0, 4($sp) # Storing i - # Argument internal_8 - lw $t0, 160($sp) - sw $t0, 0($sp) # Storing internal_8 + # Argument internal_11 + lw $t0, 216($sp) + sw $t0, 0($sp) # Storing internal_11 - # Calling function function_substr_at_String - jal function_substr_at_String + # Calling function internal_14 + lw $t0, 204($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 156($sp) # internal_9 = result of function_substr_at_String + sw $v1, 212($sp) # internal_12 = result of internal_14 addi $sp, $sp, 16 # Freeing space for arguments # Passing function arguments @@ -7274,17 +8892,17 @@ sw $ra, 8($sp) # Storing return address # Argument c - lw $t0, 160($sp) + lw $t0, 216($sp) sw $t0, 4($sp) # Storing c - # Argument internal_9 - lw $t0, 152($sp) - sw $t0, 0($sp) # Storing internal_9 + # Argument internal_12 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_12 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 160($sp) # c = result of function_assign + sw $v1, 216($sp) # c = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bool 0 @@ -7297,7 +8915,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 132($sp) # internal_11 = address of allocated object Int + sw $v0, 180($sp) # internal_16 = address of allocated object Int # Allocating String li $v0, 9 @@ -7311,44 +8929,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_12[0] = ' ' + sb $t0, 8($v0) # internal_17[0] = ' ' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 128($sp) # internal_12 = " " + sw $v0, 176($sp) # internal_17 = " " # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument c - lw $t0, 160($sp) + lw $t0, 216($sp) sw $t0, 4($sp) # Storing c - # Argument internal_12 - lw $t0, 140($sp) - sw $t0, 0($sp) # Storing internal_12 + # Argument internal_17 + lw $t0, 188($sp) + sw $t0, 0($sp) # Storing internal_17 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 136($sp) # internal_13 = result of function_equal + sw $v1, 184($sp) # internal_18 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_11 = internal_13 - lw $t0, 124($sp) - sw $t0, 132($sp) + # internal_16 = internal_18 + lw $t0, 172($sp) + sw $t0, 180($sp) - # If internal_11 then goto then_8756104474877 - lw $t0, 132($sp) # Loading the address of the condition + # If internal_16 then goto then_8772684695140 + lw $t0, 180($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8756104474877 + beq $t0, $t1, then_8772684695140 - # Jumping to else_8756104474877 - j else_8756104474877 + # Jumping to else_8772684695140 + j else_8772684695140 - then_8756104474877: + then_8772684695140: # Allocating Int 1 li $v0, 9 @@ -7360,56 +8978,80 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 120($sp) # internal_14 = address of allocated object Int + sw $v0, 168($sp) # internal_19 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 172($sp) + lw $t0, 232($sp) sw $t0, 4($sp) # Storing i - # Argument internal_14 - lw $t0, 132($sp) - sw $t0, 0($sp) # Storing internal_14 + # Argument internal_19 + lw $t0, 180($sp) + sw $t0, 0($sp) # Storing internal_19 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 128($sp) # internal_15 = result of function_add + sw $v1, 176($sp) # internal_20 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 156($sp) # internal_22 = address of allocated object Int + + # Get method length of String + lw $t0, 248($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 156($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 152($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument s - lw $t0, 188($sp) + lw $t0, 256($sp) sw $t0, 0($sp) # Storing s - # Calling function function_length_at_String - jal function_length_at_String + # Calling function internal_23 + lw $t0, 160($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 120($sp) # internal_16 = result of function_length_at_String + sw $v1, 168($sp) # internal_21 = result of internal_23 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_16 - lw $t0, 124($sp) - sw $t0, 4($sp) # Storing internal_16 + # Argument internal_21 + lw $t0, 172($sp) + sw $t0, 4($sp) # Storing internal_21 # Argument i - lw $t0, 172($sp) + lw $t0, 232($sp) sw $t0, 0($sp) # Storing i # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 120($sp) # internal_17 = result of function_sub + sw $v1, 160($sp) # internal_24 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -7422,62 +9064,86 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 104($sp) # internal_18 = address of allocated object Int + sw $v0, 144($sp) # internal_25 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_17 - lw $t0, 120($sp) - sw $t0, 4($sp) # Storing internal_17 + # Argument internal_24 + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing internal_24 - # Argument internal_18 - lw $t0, 116($sp) - sw $t0, 0($sp) # Storing internal_18 + # Argument internal_25 + lw $t0, 156($sp) + sw $t0, 0($sp) # Storing internal_25 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 112($sp) # internal_19 = result of function_sub + sw $v1, 152($sp) # internal_26 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 132($sp) # internal_28 = address of allocated object Int + + # Get method substr of String + lw $t0, 248($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 132($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 128($sp) + # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument s - lw $t0, 196($sp) + lw $t0, 264($sp) sw $t0, 8($sp) # Storing s - # Argument internal_15 - lw $t0, 132($sp) - sw $t0, 4($sp) # Storing internal_15 + # Argument internal_20 + lw $t0, 180($sp) + sw $t0, 4($sp) # Storing internal_20 - # Argument internal_19 - lw $t0, 116($sp) - sw $t0, 0($sp) # Storing internal_19 + # Argument internal_26 + lw $t0, 156($sp) + sw $t0, 0($sp) # Storing internal_26 - # Calling function function_substr_at_String - jal function_substr_at_String + # Calling function internal_29 + lw $t0, 144($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 112($sp) # internal_20 = result of function_substr_at_String + sw $v1, 152($sp) # internal_27 = result of internal_29 addi $sp, $sp, 16 # Freeing space for arguments # Set attribute rest of self - lw $t0, 184($sp) # $t0 = self - lw $t1, 96($sp) # $t1 = internal_20 - beq $t1, $zero, object_set_attribute_8756104419500 + lw $t0, 252($sp) # $t0 = self + lw $t1, 136($sp) # $t1 = internal_27 + beq $t1, $zero, object_set_attribute_8772684613985 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104419500 + beq $t6, $t5, int_set_attribute_8772684613985 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104419500 - j object_set_attribute_8756104419500 - int_set_attribute_8756104419500: + beq $t6, $t5, bool_set_attribute_8772684613985 + j object_set_attribute_8772684613985 + int_set_attribute_8772684613985: li $v0, 9 addi $a0, $zero, 12 syscall @@ -7485,9 +9151,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.rest = internal_20 - j end_set_attribute_8756104419500 - bool_set_attribute_8756104419500: + sw $v0, 12($t0) # self.rest = internal_27 + j end_set_attribute_8772684613985 + bool_set_attribute_8772684613985: li $v0, 9 addi $a0, $zero, 12 syscall @@ -7495,38 +9161,38 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.rest = internal_20 - j end_set_attribute_8756104419500 - object_set_attribute_8756104419500: - sw $t1, 12($t0) # self.rest = internal_20 - end_set_attribute_8756104419500: + sw $v0, 12($t0) # self.rest = internal_27 + j end_set_attribute_8772684613985 + object_set_attribute_8772684613985: + sw $t1, 12($t0) # self.rest = internal_27 + end_set_attribute_8772684613985: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 172($sp) + lw $t0, 232($sp) sw $t0, 4($sp) # Storing i # Argument j - lw $t0, 180($sp) + lw $t0, 248($sp) sw $t0, 0($sp) # Storing j # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 172($sp) # i = result of function_assign + sw $v1, 232($sp) # i = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_10 = i - lw $t0, 160($sp) - sw $t0, 136($sp) + # internal_15 = i + lw $t0, 220($sp) + sw $t0, 184($sp) - # Jumping to endif_8756104474877 - j endif_8756104474877 + # Jumping to endif_8772684695140 + j endif_8772684695140 - else_8756104474877: + else_8772684695140: # Allocating Bool 0 li $v0, 9 @@ -7538,7 +9204,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 88($sp) # internal_22 = address of allocated object Int + sw $v0, 120($sp) # internal_31 = address of allocated object Int # Allocating String li $v0, 9 @@ -7552,44 +9218,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 44 - sb $t0, 8($v0) # internal_23[0] = ',' + sb $t0, 8($v0) # internal_32[0] = ',' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 84($sp) # internal_23 = "," + sw $v0, 116($sp) # internal_32 = "," # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument c - lw $t0, 160($sp) + lw $t0, 216($sp) sw $t0, 4($sp) # Storing c - # Argument internal_23 - lw $t0, 96($sp) - sw $t0, 0($sp) # Storing internal_23 + # Argument internal_32 + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing internal_32 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 92($sp) # internal_24 = result of function_equal + sw $v1, 124($sp) # internal_33 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_22 = internal_24 - lw $t0, 80($sp) - sw $t0, 88($sp) + # internal_31 = internal_33 + lw $t0, 112($sp) + sw $t0, 120($sp) - # If internal_22 then goto then_8756104474865 - lw $t0, 88($sp) # Loading the address of the condition + # If internal_31 then goto then_8772684695128 + lw $t0, 120($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8756104474865 + beq $t0, $t1, then_8772684695128 - # Jumping to else_8756104474865 - j else_8756104474865 + # Jumping to else_8772684695128 + j else_8772684695128 - then_8756104474865: + then_8772684695128: # Allocating Int 1 li $v0, 9 @@ -7601,56 +9267,80 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 76($sp) # internal_25 = address of allocated object Int + sw $v0, 108($sp) # internal_34 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 172($sp) + lw $t0, 232($sp) sw $t0, 4($sp) # Storing i - # Argument internal_25 - lw $t0, 88($sp) - sw $t0, 0($sp) # Storing internal_25 + # Argument internal_34 + lw $t0, 120($sp) + sw $t0, 0($sp) # Storing internal_34 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 84($sp) # internal_26 = result of function_add + sw $v1, 116($sp) # internal_35 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_37 = address of allocated object Int + + # Get method length of String + lw $t0, 248($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 96($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 92($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument s - lw $t0, 188($sp) + lw $t0, 256($sp) sw $t0, 0($sp) # Storing s - # Calling function function_length_at_String - jal function_length_at_String + # Calling function internal_38 + lw $t0, 100($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 76($sp) # internal_27 = result of function_length_at_String + sw $v1, 108($sp) # internal_36 = result of internal_38 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_27 - lw $t0, 80($sp) - sw $t0, 4($sp) # Storing internal_27 + # Argument internal_36 + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing internal_36 # Argument i - lw $t0, 172($sp) + lw $t0, 232($sp) sw $t0, 0($sp) # Storing i # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 76($sp) # internal_28 = result of function_sub + sw $v1, 100($sp) # internal_39 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -7663,62 +9353,86 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_29 = address of allocated object Int + sw $v0, 84($sp) # internal_40 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_28 - lw $t0, 76($sp) - sw $t0, 4($sp) # Storing internal_28 + # Argument internal_39 + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing internal_39 - # Argument internal_29 - lw $t0, 72($sp) - sw $t0, 0($sp) # Storing internal_29 + # Argument internal_40 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_40 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 68($sp) # internal_30 = result of function_sub + sw $v1, 92($sp) # internal_41 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_43 = address of allocated object Int + + # Get method substr of String + lw $t0, 248($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 72($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 68($sp) + # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument s - lw $t0, 196($sp) + lw $t0, 264($sp) sw $t0, 8($sp) # Storing s - # Argument internal_26 - lw $t0, 88($sp) - sw $t0, 4($sp) # Storing internal_26 + # Argument internal_35 + lw $t0, 120($sp) + sw $t0, 4($sp) # Storing internal_35 - # Argument internal_30 - lw $t0, 72($sp) - sw $t0, 0($sp) # Storing internal_30 + # Argument internal_41 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_41 - # Calling function function_substr_at_String - jal function_substr_at_String + # Calling function internal_44 + lw $t0, 84($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 68($sp) # internal_31 = result of function_substr_at_String + sw $v1, 92($sp) # internal_42 = result of internal_44 addi $sp, $sp, 16 # Freeing space for arguments # Set attribute rest of self - lw $t0, 184($sp) # $t0 = self - lw $t1, 52($sp) # $t1 = internal_31 - beq $t1, $zero, object_set_attribute_8756104419810 + lw $t0, 252($sp) # $t0 = self + lw $t1, 76($sp) # $t1 = internal_42 + beq $t1, $zero, object_set_attribute_8772684614599 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104419810 + beq $t6, $t5, int_set_attribute_8772684614599 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104419810 - j object_set_attribute_8756104419810 - int_set_attribute_8756104419810: + beq $t6, $t5, bool_set_attribute_8772684614599 + j object_set_attribute_8772684614599 + int_set_attribute_8772684614599: li $v0, 9 addi $a0, $zero, 12 syscall @@ -7726,9 +9440,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.rest = internal_31 - j end_set_attribute_8756104419810 - bool_set_attribute_8756104419810: + sw $v0, 12($t0) # self.rest = internal_42 + j end_set_attribute_8772684614599 + bool_set_attribute_8772684614599: li $v0, 9 addi $a0, $zero, 12 syscall @@ -7736,38 +9450,38 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.rest = internal_31 - j end_set_attribute_8756104419810 - object_set_attribute_8756104419810: - sw $t1, 12($t0) # self.rest = internal_31 - end_set_attribute_8756104419810: + sw $v0, 12($t0) # self.rest = internal_42 + j end_set_attribute_8772684614599 + object_set_attribute_8772684614599: + sw $t1, 12($t0) # self.rest = internal_42 + end_set_attribute_8772684614599: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 172($sp) + lw $t0, 232($sp) sw $t0, 4($sp) # Storing i # Argument j - lw $t0, 180($sp) + lw $t0, 248($sp) sw $t0, 0($sp) # Storing j # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 172($sp) # i = result of function_assign + sw $v1, 232($sp) # i = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_21 = i - lw $t0, 160($sp) - sw $t0, 92($sp) + # internal_30 = i + lw $t0, 220($sp) + sw $t0, 124($sp) - # Jumping to endif_8756104474865 - j endif_8756104474865 + # Jumping to endif_8772684695128 + j endif_8772684695128 - else_8756104474865: + else_8772684695128: # Allocating Int 10 li $v0, 9 @@ -7779,24 +9493,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 10 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_32 = address of allocated object Int + sw $v0, 64($sp) # internal_45 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument int - lw $t0, 188($sp) + lw $t0, 256($sp) sw $t0, 4($sp) # Storing int - # Argument internal_32 - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing internal_32 + # Argument internal_45 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_45 # Calling function function_mult jal function_mult lw $ra, 8($sp) - sw $v1, 56($sp) # internal_33 = result of function_mult + sw $v1, 72($sp) # internal_46 = result of function_mult addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -7809,64 +9523,112 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_34 = address of allocated object Int + sw $v0, 56($sp) # internal_47 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_49 = address of allocated object Int + + # Get method substr of String + lw $t0, 248($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 48($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 44($sp) # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument s - lw $t0, 196($sp) + lw $t0, 264($sp) sw $t0, 8($sp) # Storing s # Argument i - lw $t0, 176($sp) + lw $t0, 236($sp) sw $t0, 4($sp) # Storing i - # Argument internal_34 - lw $t0, 56($sp) - sw $t0, 0($sp) # Storing internal_34 + # Argument internal_47 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_47 - # Calling function function_substr_at_String - jal function_substr_at_String + # Calling function internal_50 + lw $t0, 60($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 52($sp) # internal_35 = result of function_substr_at_String + sw $v1, 68($sp) # internal_48 = result of internal_50 addi $sp, $sp, 16 # Freeing space for arguments + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_52 = address of allocated object Int + + # Get method c2i of Parse + lw $t0, 252($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 36($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 32($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 196($sp) + lw $t0, 264($sp) sw $t0, 4($sp) # Storing self - # Argument internal_35 - lw $t0, 48($sp) - sw $t0, 0($sp) # Storing internal_35 + # Argument internal_48 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_48 - # Calling function function_c2i_at_Parse - jal function_c2i_at_Parse + # Calling function internal_53 + lw $t0, 44($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 44($sp) # internal_36 = result of function_c2i_at_Parse + sw $v1, 52($sp) # internal_51 = result of internal_53 addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_33 - lw $t0, 56($sp) - sw $t0, 4($sp) # Storing internal_33 + # Argument internal_46 + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing internal_46 - # Argument internal_36 - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_36 + # Argument internal_51 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_51 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 40($sp) # internal_37 = result of function_add + sw $v1, 40($sp) # internal_54 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -7874,17 +9636,17 @@ sw $ra, 8($sp) # Storing return address # Argument int - lw $t0, 188($sp) + lw $t0, 256($sp) sw $t0, 4($sp) # Storing int - # Argument internal_37 + # Argument internal_54 lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_37 + sw $t0, 0($sp) # Storing internal_54 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 188($sp) # int = result of function_assign + sw $v1, 256($sp) # int = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -7897,24 +9659,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_38 = address of allocated object Int + sw $v0, 24($sp) # internal_55 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 172($sp) + lw $t0, 232($sp) sw $t0, 4($sp) # Storing i - # Argument internal_38 + # Argument internal_55 lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_38 + sw $t0, 0($sp) # Storing internal_55 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 32($sp) # internal_39 = result of function_add + sw $v1, 32($sp) # internal_56 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -7922,17 +9684,17 @@ sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 172($sp) + lw $t0, 232($sp) sw $t0, 4($sp) # Storing i - # Argument internal_39 + # Argument internal_56 lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_39 + sw $t0, 0($sp) # Storing internal_56 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 172($sp) # i = result of function_assign + sw $v1, 232($sp) # i = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bool 0 @@ -7945,40 +9707,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_41 = address of allocated object Int + sw $v0, 12($sp) # internal_58 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 172($sp) + lw $t0, 232($sp) sw $t0, 4($sp) # Storing i # Argument j - lw $t0, 180($sp) + lw $t0, 248($sp) sw $t0, 0($sp) # Storing j # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 20($sp) # internal_42 = result of function_equal + sw $v1, 20($sp) # internal_59 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_41 = internal_42 + # internal_58 = internal_59 lw $t0, 8($sp) sw $t0, 12($sp) - # If internal_41 then goto then_8756104474859 + # If internal_58 then goto then_8772684695122 lw $t0, 12($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8756104474859 + beq $t0, $t1, then_8772684695122 - # Jumping to else_8756104474859 - j else_8756104474859 + # Jumping to else_8772684695122 + j else_8772684695122 - then_8756104474859: + then_8772684695122: # Allocating String li $v0, 9 @@ -7993,22 +9755,22 @@ sb $zero, 8($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_43 = "" + sw $v0, 4($sp) # internal_60 = "" # Set attribute rest of self - lw $t0, 184($sp) # $t0 = self - lw $t1, 4($sp) # $t1 = internal_43 - beq $t1, $zero, object_set_attribute_8756104421093 + lw $t0, 252($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_60 + beq $t1, $zero, object_set_attribute_8772684615982 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104421093 + beq $t6, $t5, int_set_attribute_8772684615982 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104421093 - j object_set_attribute_8756104421093 - int_set_attribute_8756104421093: + beq $t6, $t5, bool_set_attribute_8772684615982 + j object_set_attribute_8772684615982 + int_set_attribute_8772684615982: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8016,9 +9778,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.rest = internal_43 - j end_set_attribute_8756104421093 - bool_set_attribute_8756104421093: + sw $v0, 12($t0) # self.rest = internal_60 + j end_set_attribute_8772684615982 + bool_set_attribute_8772684615982: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8026,20 +9788,20 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.rest = internal_43 - j end_set_attribute_8756104421093 - object_set_attribute_8756104421093: - sw $t1, 12($t0) # self.rest = internal_43 - end_set_attribute_8756104421093: + sw $v0, 12($t0) # self.rest = internal_60 + j end_set_attribute_8772684615982 + object_set_attribute_8772684615982: + sw $t1, 12($t0) # self.rest = internal_60 + end_set_attribute_8772684615982: - # internal_40 = internal_43 + # internal_57 = internal_60 lw $t0, 4($sp) sw $t0, 16($sp) - # Jumping to endif_8756104474859 - j endif_8756104474859 + # Jumping to endif_8772684695122 + j endif_8772684695122 - else_8756104474859: + else_8772684695122: # Allocating String li $v0, 9 @@ -8054,55 +9816,55 @@ sb $zero, 8($v0) # Null-terminator at the end of the string - sw $v0, 0($sp) # internal_44 = "" + sw $v0, 0($sp) # internal_61 = "" - # internal_40 = internal_44 + # internal_57 = internal_61 lw $t0, 0($sp) sw $t0, 16($sp) - # Jumping to endif_8756104474859 - j endif_8756104474859 + # Jumping to endif_8772684695122 + j endif_8772684695122 - endif_8756104474859: + endif_8772684695122: - # internal_21 = internal_40 + # internal_30 = internal_57 lw $t0, 16($sp) - sw $t0, 92($sp) + sw $t0, 124($sp) - # Jumping to endif_8756104474865 - j endif_8756104474865 + # Jumping to endif_8772684695128 + j endif_8772684695128 - endif_8756104474865: + endif_8772684695128: - # internal_10 = internal_21 - lw $t0, 92($sp) - sw $t0, 136($sp) + # internal_15 = internal_30 + lw $t0, 124($sp) + sw $t0, 184($sp) - # Jumping to endif_8756104474877 - j endif_8756104474877 + # Jumping to endif_8772684695140 + j endif_8772684695140 - endif_8756104474877: + endif_8772684695140: - # Jumping to while_start_8756104475158 - j while_start_8756104475158 + # Jumping to while_start_8772684695161 + j while_start_8772684695161 - while_end_8756104475158: + while_end_8772684695161: # Loading return value in $v1 - lw $v1, 176($sp) + lw $v1, 244($sp) # Freeing space for local variables - addi $sp, $sp, 180 + addi $sp, $sp, 248 jr $ra function___init___at_Main: # Function parameters - # $ra = 16($sp) - # self = 12($sp) + # $ra = 24($sp) + # self = 20($sp) # Reserving space for local variables - addi $sp, $sp, -12 + addi $sp, $sp, -20 # Allocating BoolOp li $v0, 9 @@ -8111,36 +9873,36 @@ la $t0, type_BoolOp # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 8($sp) # internal_0 = address of allocated object BoolOp + sw $v0, 16($sp) # internal_0 = address of allocated object BoolOp # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_BoolOp jal function___init___at_BoolOp lw $ra, 4($sp) - sw $v1, 16($sp) # internal_0 = result of function___init___at_BoolOp + sw $v1, 24($sp) # internal_0 = result of function___init___at_BoolOp addi $sp, $sp, 8 # Freeing space for arguments # Set attribute boolop of self - lw $t0, 12($sp) # $t0 = self - lw $t1, 8($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8756104418178 + lw $t0, 20($sp) # $t0 = self + lw $t1, 16($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8772684613093 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104418178 + beq $t6, $t5, int_set_attribute_8772684613093 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104418178 - j object_set_attribute_8756104418178 - int_set_attribute_8756104418178: + beq $t6, $t5, bool_set_attribute_8772684613093 + j object_set_attribute_8772684613093 + int_set_attribute_8772684613093: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8149,8 +9911,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.boolop = internal_0 - j end_set_attribute_8756104418178 - bool_set_attribute_8756104418178: + j end_set_attribute_8772684613093 + bool_set_attribute_8772684613093: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8159,10 +9921,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.boolop = internal_0 - j end_set_attribute_8756104418178 - object_set_attribute_8756104418178: + j end_set_attribute_8772684613093 + object_set_attribute_8772684613093: sw $t1, 8($t0) # self.boolop = internal_0 - end_set_attribute_8756104418178: + end_set_attribute_8772684613093: # Allocating String li $v0, 9 @@ -8177,22 +9939,22 @@ sb $zero, 8($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_1 = "" + sw $v0, 12($sp) # internal_1 = "" # Set attribute rest of self - lw $t0, 12($sp) # $t0 = self - lw $t1, 4($sp) # $t1 = internal_1 - beq $t1, $zero, object_set_attribute_8756104420666 + lw $t0, 20($sp) # $t0 = self + lw $t1, 12($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8772684616063 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104420666 + beq $t6, $t5, int_set_attribute_8772684616063 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104420666 - j object_set_attribute_8756104420666 - int_set_attribute_8756104420666: + beq $t6, $t5, bool_set_attribute_8772684616063 + j object_set_attribute_8772684616063 + int_set_attribute_8772684616063: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8201,8 +9963,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.rest = internal_1 - j end_set_attribute_8756104420666 - bool_set_attribute_8756104420666: + j end_set_attribute_8772684616063 + bool_set_attribute_8772684616063: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8211,39 +9973,63 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.rest = internal_1 - j end_set_attribute_8756104420666 - object_set_attribute_8756104420666: + j end_set_attribute_8772684616063 + object_set_attribute_8772684616063: sw $t1, 12($t0) # self.rest = internal_1 - end_set_attribute_8756104420666: + end_set_attribute_8772684616063: + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_3 = address of allocated object Int + + # Get method read_input of Main + lw $t0, 20($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing self - # Calling function function_read_input_at_Parse - jal function_read_input_at_Parse + # Calling function internal_4 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_2 = result of function_read_input_at_Parse + sw $v1, 16($sp) # internal_2 = result of internal_4 addi $sp, $sp, 8 # Freeing space for arguments # Set attribute g of self - lw $t0, 12($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_2 - beq $t1, $zero, object_set_attribute_8756104420684 + lw $t0, 20($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_2 + beq $t1, $zero, object_set_attribute_8772684616081 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8756104420684 + beq $t6, $t5, int_set_attribute_8772684616081 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8756104420684 - j object_set_attribute_8756104420684 - int_set_attribute_8756104420684: + beq $t6, $t5, bool_set_attribute_8772684616081 + j object_set_attribute_8772684616081 + int_set_attribute_8772684616081: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8252,8 +10038,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.g = internal_2 - j end_set_attribute_8756104420684 - bool_set_attribute_8756104420684: + j end_set_attribute_8772684616081 + bool_set_attribute_8772684616081: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8262,40 +10048,40 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.g = internal_2 - j end_set_attribute_8756104420684 - object_set_attribute_8756104420684: + j end_set_attribute_8772684616081 + object_set_attribute_8772684616081: sw $t1, 16($t0) # self.g = internal_2 - end_set_attribute_8756104420684: + end_set_attribute_8772684616081: # Loading return value in $v1 - lw $v1, 12($sp) + lw $v1, 20($sp) # Freeing space for local variables - addi $sp, $sp, 12 + addi $sp, $sp, 20 jr $ra function_main_at_Main: # Function parameters - # $ra = 20($sp) - # self = 16($sp) + # $ra = 36($sp) + # self = 32($sp) # Reserving space for local variables - addi $sp, $sp, -16 + addi $sp, $sp, -32 # Get attribute g of self - lw $t0, 16($sp) # Get the address of self - lw $t1, 16($t0) # Get the attribute 'g' from the instance + lw $t0, 32($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'g' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8756104420741 + beq $t6, $t5, int_get_attribute_8772684616162 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8756104420741 - j object_get_attribute_8756104420741 - int_get_attribute_8756104420741: + beq $t6, $t5, bool_get_attribute_8772684616162 + j object_get_attribute_8772684616162 + int_get_attribute_8772684616162: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8303,9 +10089,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_0 = self.g - j end_get_attribute_8756104420741 - bool_get_attribute_8756104420741: + sw $v0, 28($sp) # internal_0 = self.g + j end_get_attribute_8772684616162 + bool_get_attribute_8772684616162: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8313,39 +10099,63 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_0 = self.g - j end_get_attribute_8756104420741 - object_get_attribute_8756104420741: - sw $t1, 12($sp) # internal_0 = g - end_get_attribute_8756104420741: + sw $v0, 28($sp) # internal_0 = self.g + j end_get_attribute_8772684616162 + object_get_attribute_8772684616162: + sw $t1, 28($sp) # internal_0 = self.g + end_get_attribute_8772684616162: + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_2 = address of allocated object Int + + # Get method print_V of Graph + lw $t0, 28($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 20($sp) + lw $t0, 36($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_print_V_at_Graph - jal function_print_V_at_Graph + # Calling function internal_3 + lw $t0, 24($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_print_V_at_Graph + sw $v1, 32($sp) # internal_1 = result of internal_3 addi $sp, $sp, 8 # Freeing space for arguments # Get attribute g of self - lw $t0, 16($sp) # Get the address of self - lw $t1, 16($t0) # Get the attribute 'g' from the instance + lw $t0, 32($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'g' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8756104420771 + beq $t6, $t5, int_get_attribute_8772684616732 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8756104420771 - j object_get_attribute_8756104420771 - int_get_attribute_8756104420771: + beq $t6, $t5, bool_get_attribute_8772684616732 + j object_get_attribute_8772684616732 + int_get_attribute_8772684616732: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8353,9 +10163,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_2 = self.g - j end_get_attribute_8756104420771 - bool_get_attribute_8756104420771: + sw $v0, 12($sp) # internal_4 = self.g + j end_get_attribute_8772684616732 + bool_get_attribute_8772684616732: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8363,31 +10173,55 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_2 = self.g - j end_get_attribute_8756104420771 - object_get_attribute_8756104420771: - sw $t1, 4($sp) # internal_2 = g - end_get_attribute_8756104420771: + sw $v0, 12($sp) # internal_4 = self.g + j end_get_attribute_8772684616732 + object_get_attribute_8772684616732: + sw $t1, 12($sp) # internal_4 = self.g + end_get_attribute_8772684616732: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Get method print_E of Graph + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_2 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_2 + # Argument internal_4 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_4 - # Calling function function_print_E_at_Graph - jal function_print_E_at_Graph + # Calling function internal_7 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_3 = result of function_print_E_at_Graph + sw $v1, 16($sp) # internal_5 = result of internal_7 addi $sp, $sp, 8 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 16 + addi $sp, $sp, 32 jr $ra @@ -8427,25 +10261,25 @@ lw $t0, 16($sp) sw $t0, 4($sp) - # If internal_1 then goto then_8756104475254 + # If internal_1 then goto then_8772684695257 lw $t0, 4($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8756104475254 + beq $t0, $t1, then_8772684695257 - # Jumping to else_8756104475254 - j else_8756104475254 + # Jumping to else_8772684695257 + j else_8772684695257 - then_8756104475254: + then_8772684695257: # internal_0 = b2 lw $t0, 12($sp) sw $t0, 8($sp) - # Jumping to endif_8756104475254 - j endif_8756104475254 + # Jumping to endif_8772684695257 + j endif_8772684695257 - else_8756104475254: + else_8772684695257: # Allocating Bool 0 li $v0, 9 @@ -8463,10 +10297,10 @@ lw $t0, 0($sp) sw $t0, 8($sp) - # Jumping to endif_8756104475254 - j endif_8756104475254 + # Jumping to endif_8772684695257 + j endif_8772684695257 - endif_8756104475254: + endif_8772684695257: # Loading return value in $v1 lw $v1, 8($sp) @@ -8502,16 +10336,16 @@ lw $t0, 16($sp) sw $t0, 4($sp) - # If internal_1 then goto then_8756104475281 + # If internal_1 then goto then_8772684695284 lw $t0, 4($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8756104475281 + beq $t0, $t1, then_8772684695284 - # Jumping to else_8756104475281 - j else_8756104475281 + # Jumping to else_8772684695284 + j else_8772684695284 - then_8756104475281: + then_8772684695284: # Allocating Bool 1 li $v0, 9 @@ -8529,19 +10363,19 @@ lw $t0, 0($sp) sw $t0, 8($sp) - # Jumping to endif_8756104475281 - j endif_8756104475281 + # Jumping to endif_8772684695284 + j endif_8772684695284 - else_8756104475281: + else_8772684695284: # internal_0 = b2 lw $t0, 12($sp) sw $t0, 8($sp) - # Jumping to endif_8756104475281 - j endif_8756104475281 + # Jumping to endif_8772684695284 + j endif_8772684695284 - endif_8756104475281: + endif_8772684695284: # Loading return value in $v1 lw $v1, 8($sp) @@ -8553,7 +10387,7 @@ main: # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Allocating Main li $v0, 9 @@ -8562,34 +10396,58 @@ la $t0, type_Main # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object Main + sw $v0, 12($sp) # internal_0 = address of allocated object Main # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_Main jal function___init___at_Main lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_main_at_Main - jal function_main_at_Main + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + sw $v1, 16($sp) # internal_1 = result of internal_3 addi $sp, $sp, 8 # Freeing space for arguments # Exit program diff --git a/tests/codegen/hairyscary.mips b/tests/codegen/hairyscary.mips index c46228a96..a6f377ab6 100644 --- a/tests/codegen/hairyscary.mips +++ b/tests/codegen/hairyscary.mips @@ -1,73 +1,145 @@ .data - type_Object: .word 8 + type_Object: .word 24 type_Object_inherits_from: .word 0 - type_Object_attributes: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_Foo: .word 68 + type_Foo_inherits_from: .word type_Bazz + type_Foo_name_address: .word type_Foo_name_size + type_Foo___init__: .word function___init___at_Foo + type_Foo_abort: .word function_abort_at_Object + type_Foo_type_name: .word function_type_name_at_Object + type_Foo_copy: .word function_copy_at_Object + type_Foo_out_string: .word function_out_string_at_IO + type_Foo_out_int: .word function_out_int_at_IO + type_Foo_in_string: .word function_in_string_at_IO + type_Foo_in_int: .word function_in_int_at_IO + type_Foo_printh: .word function_printh_at_Bazz + type_Foo_doh: .word function_doh_at_Foo + + type_Bar: .word 84 + type_Bar_inherits_from: .word type_Razz + type_Bar_name_address: .word type_Bar_name_size + type_Bar___init__: .word function___init___at_Bar + type_Bar_abort: .word function_abort_at_Object + type_Bar_type_name: .word function_type_name_at_Object + type_Bar_copy: .word function_copy_at_Object + type_Bar_out_string: .word function_out_string_at_IO + type_Bar_out_int: .word function_out_int_at_IO + type_Bar_in_string: .word function_in_string_at_IO + type_Bar_in_int: .word function_in_int_at_IO + type_Bar_printh: .word function_printh_at_Bazz + type_Bar_doh: .word function_doh_at_Foo + + type_Razz: .word 76 + type_Razz_inherits_from: .word type_Foo + type_Razz_name_address: .word type_Razz_name_size + type_Razz___init__: .word function___init___at_Razz + type_Razz_abort: .word function_abort_at_Object + type_Razz_type_name: .word function_type_name_at_Object + type_Razz_copy: .word function_copy_at_Object + type_Razz_out_string: .word function_out_string_at_IO + type_Razz_out_int: .word function_out_int_at_IO + type_Razz_in_string: .word function_in_string_at_IO + type_Razz_in_int: .word function_in_int_at_IO + type_Razz_printh: .word function_printh_at_Bazz + type_Razz_doh: .word function_doh_at_Foo + + type_Bazz: .word 60 + type_Bazz_inherits_from: .word type_IO + type_Bazz_name_address: .word type_Bazz_name_size + type_Bazz___init__: .word function___init___at_Bazz + type_Bazz_abort: .word function_abort_at_Object + type_Bazz_type_name: .word function_type_name_at_Object + type_Bazz_copy: .word function_copy_at_Object + type_Bazz_out_string: .word function_out_string_at_IO + type_Bazz_out_int: .word function_out_int_at_IO + type_Bazz_in_string: .word function_in_string_at_IO + type_Bazz_in_int: .word function_in_int_at_IO + type_Bazz_printh: .word function_printh_at_Bazz + type_Bazz_doh: .word function_doh_at_Bazz + + type_Main: .word 44 + type_Main_inherits_from: .word type_Object + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_main: .word function_main_at_Main + type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" - type_Object_abort_message: .asciiz "Abort called from class Object\n" - type_IO: .word 8 - type_IO_inherits_from: .word type_Object - type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" - type_IO_abort_message: .asciiz "Abort called from class IO\n" - - type_Int: .word 8 - type_Int_inherits_from: .word type_Object - type_Int_attributes: .word 0 - type_Int_name_size: .word 3 - type_Int_name: .asciiz "Int" - type_Int_abort_message: .asciiz "Abort called from class Int\n" - type_String: .word 8 - type_String_inherits_from: .word type_Object - type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" - type_String_abort_message: .asciiz "Abort called from class String\n" - type_Bool: .word 8 - type_Bool_inherits_from: .word type_Object - type_Bool_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" - type_Bool_abort_message: .asciiz "Abort called from class Bool\n" - type_Foo: .word 28 - type_Foo_inherits_from: .word type_Bazz - type_Foo_attributes: .word 5 type_Foo_name_size: .word 3 type_Foo_name: .asciiz "Foo" - type_Foo_abort_message: .asciiz "Abort called from class Foo\n" - type_Bar: .word 44 - type_Bar_inherits_from: .word type_Razz - type_Bar_attributes: .word 9 type_Bar_name_size: .word 3 type_Bar_name: .asciiz "Bar" - type_Bar_abort_message: .asciiz "Abort called from class Bar\n" - type_Razz: .word 36 - type_Razz_inherits_from: .word type_Foo - type_Razz_attributes: .word 7 type_Razz_name_size: .word 4 type_Razz_name: .asciiz "Razz" - type_Razz_abort_message: .asciiz "Abort called from class Razz\n" - type_Bazz: .word 20 - type_Bazz_inherits_from: .word type_IO - type_Bazz_attributes: .word 3 type_Bazz_name_size: .word 4 type_Bazz_name: .asciiz "Bazz" - type_Bazz_abort_message: .asciiz "Abort called from class Bazz\n" - type_Main: .word 24 - type_Main_inherits_from: .word type_Object - type_Main_attributes: .word 4 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" - type_Main_abort_message: .asciiz "Abort called from class Main\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -728,11 +800,11 @@ function_abort_at_Object: # Function parameters - # $ra = 20($sp) - # self = 16($sp) + # $ra = 28($sp) + # self = 24($sp) # Reserving space for local variables - addi $sp, $sp, -16 + addi $sp, $sp, -24 # Allocating String li $v0, 9 @@ -819,7 +891,7 @@ sb $zero, 32($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_0 = "Abort called from class " + sw $v0, 20($sp) # internal_0 = "Abort called from class " # Allocating String li $v0, 9 @@ -833,66 +905,138 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_2[0] = '\n' + sb $t0, 8($v0) # internal_3[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_2 = "\n" + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 0($sp) # Storing self - # Calling function function_type_name_at_Object - jal function_type_name_at_Object + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + sw $v1, 24($sp) # internal_1 = result of internal_5 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_0 - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing internal_0 # Argument internal_1 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_1 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_3 - lw $t0, 12($sp) - sw $t0, 4($sp) # Storing internal_3 - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) # $t0 = internal_3 + lw $t0, 12($sp) # $t0 = internal_2 addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string internal_3 + # Printing the String internal_2 li $v0, 4 move $a0, $t0 syscall @@ -902,10 +1046,10 @@ syscall # Loading return value in $v1 - lw $v1, 16($sp) + lw $v1, 24($sp) # Freeing space for local variables - addi $sp, $sp, 16 + addi $sp, $sp, 24 jr $ra @@ -920,8 +1064,9 @@ # internal_0 = name of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($t0) # $t1 = type of self - lw $t2, 12($t1) # $t1 = length of the name of self - la $t3, 16($t1) # $t1 = name of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 @@ -1024,7 +1169,7 @@ lw $t0, 0($sp) # $t0 = x addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string x + # Printing the String x li $v0, 4 move $a0, $t0 syscall @@ -1040,7 +1185,7 @@ # self = 4($sp) # x = 0($sp) - # Printing the string x + # Printing the Int x li $v0, 1 lw $a0, 0($sp) lw $a0, 8($a0) @@ -1067,11 +1212,13 @@ xor $t0, $t0, $t0 # Initializing counter while_read_start: lb $t1, buffer_input($t0) # Loading the byte - beq $t1, $zero, while_read_end + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end addi $t0, $t0, 1 # Incrementing counter j while_read_start while_read_end: - addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 @@ -1318,13 +1465,33 @@ jr $ra + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + function___init___at_Foo: # Function parameters - # $ra = 456($sp) - # self = 452($sp) + # $ra = 480($sp) + # self = 476($sp) # Reserving space for local variables - addi $sp, $sp, -452 + addi $sp, $sp, -476 # Allocating Int 1 li $v0, 9 @@ -1336,22 +1503,22 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 448($sp) # internal_0 = address of allocated object Int + sw $v0, 472($sp) # internal_0 = address of allocated object Int # Set attribute h of self - lw $t0, 452($sp) # $t0 = self - lw $t1, 448($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8744937288307 + lw $t0, 476($sp) # $t0 = self + lw $t1, 472($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8794484661456 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937288307 + beq $t6, $t5, int_set_attribute_8794484661456 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937288307 - j object_set_attribute_8744937288307 - int_set_attribute_8744937288307: + beq $t6, $t5, bool_set_attribute_8794484661456 + j object_set_attribute_8794484661456 + int_set_attribute_8794484661456: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1360,8 +1527,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.h = internal_0 - j end_set_attribute_8744937288307 - bool_set_attribute_8744937288307: + j end_set_attribute_8794484661456 + bool_set_attribute_8794484661456: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1370,10 +1537,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.h = internal_0 - j end_set_attribute_8744937288307 - object_set_attribute_8744937288307: + j end_set_attribute_8794484661456 + object_set_attribute_8794484661456: sw $t1, 8($t0) # self.h = internal_0 - end_set_attribute_8744937288307: + end_set_attribute_8794484661456: # Allocating Int 0 li $v0, 9 @@ -1385,7 +1552,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 444($sp) # internal_1 = address of allocated object Int + sw $v0, 468($sp) # internal_1 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -1397,7 +1564,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 440($sp) # internal_2 = address of allocated object Int + sw $v0, 464($sp) # internal_2 = address of allocated object Int # Allocating Int 4 li $v0, 9 @@ -1409,10 +1576,10 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 436($sp) # internal_3 = address of allocated object Int + sw $v0, 460($sp) # internal_3 = address of allocated object Int # Allocating NUll to internal_4 - sw $zero, 432($sp) # internal_4 = 0 + sw $zero, 456($sp) # internal_4 = 0 # Allocating Int 0 li $v0, 9 @@ -1424,7 +1591,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 428($sp) # internal_5 = address of allocated object Int + sw $v0, 452($sp) # internal_5 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -1436,66 +1603,66 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 416($sp) # internal_8 = address of allocated object Int + sw $v0, 440($sp) # internal_8 = address of allocated object Int # internal_6 = typeof self that is the first word of the object - lw $t0, 452($sp) + lw $t0, 476($sp) lw $t0, 0($t0) - sw $t0, 424($sp) + sw $t0, 448($sp) # internal_7 = internal_6 - lw $t0, 424($sp) - sw $t0, 420($sp) + lw $t0, 448($sp) + sw $t0, 444($sp) - while_start_8744937301489: + while_start_8794484741346: # internal_8 = EqualAddress(internal_7, internal_4) - lw $t0, 420($sp) - lw $t1, 432($sp) + lw $t0, 444($sp) + lw $t1, 456($sp) seq $t2, $t0, $t1 - lw $t0, 416($sp) + lw $t0, 440($sp) sw $t2, 8($t0) - # If internal_8 then goto while_end_8744937301489 - lw $t0, 416($sp) # Loading the address of the condition + # If internal_8 then goto while_end_8794484741346 + lw $t0, 440($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_end_8744937301489 + beq $t0, $t1, while_end_8794484741346 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_5 - lw $t0, 440($sp) + lw $t0, 464($sp) sw $t0, 4($sp) # Storing internal_5 # Argument internal_2 - lw $t0, 452($sp) + lw $t0, 476($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 440($sp) # internal_5 = result of function_add + sw $v1, 464($sp) # internal_5 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # internal_7 = ancestor of internal_7 - lw $t0, 420($sp) + lw $t0, 444($sp) lw $t0, 4($t0) - sw $t0, 420($sp) + sw $t0, 444($sp) - # Jumping to while_start_8744937301489 - j while_start_8744937301489 + # Jumping to while_start_8794484741346 + j while_start_8794484741346 - while_end_8744937301489: + while_end_8794484741346: # internal_7 = internal_6 - lw $t0, 424($sp) - sw $t0, 420($sp) + lw $t0, 448($sp) + sw $t0, 444($sp) # initialize Array [internal_5] - lw $t0, 428($sp) # $t0 = internal_5 + lw $t0, 452($sp) # $t0 = internal_5 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -1503,7 +1670,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 412($sp) # internal_9 = new Array[internal_5] + sw $v0, 436($sp) # internal_9 = new Array[internal_5] # Allocating Int 0 li $v0, 9 @@ -1515,7 +1682,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 408($sp) # internal_10 = address of allocated object Int + sw $v0, 432($sp) # internal_10 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -1527,80 +1694,80 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 404($sp) # internal_11 = address of allocated object Int + sw $v0, 428($sp) # internal_11 = address of allocated object Int - foreach_start_8744937301489: + foreach_start_8794484741346: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_10 - lw $t0, 420($sp) + lw $t0, 444($sp) sw $t0, 4($sp) # Storing internal_10 # Argument internal_5 - lw $t0, 440($sp) + lw $t0, 464($sp) sw $t0, 0($sp) # Storing internal_5 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 416($sp) # internal_11 = result of function_less_than + sw $v1, 440($sp) # internal_11 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_11 then goto foreach_body_8744937301489 - lw $t0, 404($sp) # Loading the address of the condition + # If internal_11 then goto foreach_body_8794484741346 + lw $t0, 428($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_body_8744937301489 + beq $t0, $t1, foreach_body_8794484741346 - # Jumping to foreach_end_8744937301489 - j foreach_end_8744937301489 + # Jumping to foreach_end_8794484741346 + j foreach_end_8794484741346 - foreach_body_8744937301489: + foreach_body_8794484741346: # array internal_9[4 * internal_10] = internal_7 - lw $t0, 408($sp) # $t0 = internal_10 + lw $t0, 432($sp) # $t0 = internal_10 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 412($sp) # $t1 = internal_9 + lw $t1, 436($sp) # $t1 = internal_9 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 420($sp) + lw $t0, 444($sp) sw $t0, 0($t1) # internal_7 = ancestor of internal_7 - lw $t0, 420($sp) + lw $t0, 444($sp) lw $t0, 4($t0) - sw $t0, 420($sp) + sw $t0, 444($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_10 - lw $t0, 420($sp) + lw $t0, 444($sp) sw $t0, 4($sp) # Storing internal_10 # Argument internal_2 - lw $t0, 452($sp) + lw $t0, 476($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 420($sp) # internal_10 = result of function_add + sw $v1, 444($sp) # internal_10 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_start_8744937301489 - j foreach_start_8744937301489 + # Jumping to foreach_start_8794484741346 + j foreach_start_8794484741346 - foreach_end_8744937301489: + foreach_end_8794484741346: # initialize Array [internal_3] - lw $t0, 436($sp) # $t0 = internal_3 + lw $t0, 460($sp) # $t0 = internal_3 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -1608,10 +1775,10 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 400($sp) # internal_12 = new Array[internal_3] + sw $v0, 424($sp) # internal_12 = new Array[internal_3] # initialize Array [internal_3] - lw $t0, 436($sp) # $t0 = internal_3 + lw $t0, 460($sp) # $t0 = internal_3 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -1619,7 +1786,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 396($sp) # internal_13 = new Array[internal_3] + sw $v0, 420($sp) # internal_13 = new Array[internal_3] # Allocating Int 0 li $v0, 9 @@ -1631,32 +1798,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 388($sp) # internal_15 = address of allocated object Int + sw $v0, 412($sp) # internal_15 = address of allocated object Int # internal_14 = direction of Bazz la $t0, type_Bazz - sw $t0, 392($sp) + sw $t0, 416($sp) # array internal_12[4 * internal_15] = internal_14 - lw $t0, 388($sp) # $t0 = internal_15 + lw $t0, 412($sp) # $t0 = internal_15 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 400($sp) # $t1 = internal_12 + lw $t1, 424($sp) # $t1 = internal_12 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 392($sp) + lw $t0, 416($sp) sw $t0, 0($t1) # array internal_13[4 * internal_15] = internal_5 - lw $t0, 388($sp) # $t0 = internal_15 + lw $t0, 412($sp) # $t0 = internal_15 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 396($sp) # $t1 = internal_13 + lw $t1, 420($sp) # $t1 = internal_13 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 428($sp) + lw $t0, 452($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -1670,32 +1837,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 380($sp) # internal_17 = address of allocated object Int + sw $v0, 404($sp) # internal_17 = address of allocated object Int # internal_16 = direction of Razz la $t0, type_Razz - sw $t0, 384($sp) + sw $t0, 408($sp) # array internal_12[4 * internal_17] = internal_16 - lw $t0, 380($sp) # $t0 = internal_17 + lw $t0, 404($sp) # $t0 = internal_17 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 400($sp) # $t1 = internal_12 + lw $t1, 424($sp) # $t1 = internal_12 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 384($sp) + lw $t0, 408($sp) sw $t0, 0($t1) # array internal_13[4 * internal_17] = internal_5 - lw $t0, 380($sp) # $t0 = internal_17 + lw $t0, 404($sp) # $t0 = internal_17 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 396($sp) # $t1 = internal_13 + lw $t1, 420($sp) # $t1 = internal_13 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 428($sp) + lw $t0, 452($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -1709,32 +1876,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 372($sp) # internal_19 = address of allocated object Int + sw $v0, 396($sp) # internal_19 = address of allocated object Int # internal_18 = direction of Foo la $t0, type_Foo - sw $t0, 376($sp) + sw $t0, 400($sp) # array internal_12[4 * internal_19] = internal_18 - lw $t0, 372($sp) # $t0 = internal_19 + lw $t0, 396($sp) # $t0 = internal_19 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 400($sp) # $t1 = internal_12 + lw $t1, 424($sp) # $t1 = internal_12 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 376($sp) + lw $t0, 400($sp) sw $t0, 0($t1) # array internal_13[4 * internal_19] = internal_5 - lw $t0, 372($sp) # $t0 = internal_19 + lw $t0, 396($sp) # $t0 = internal_19 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 396($sp) # $t1 = internal_13 + lw $t1, 420($sp) # $t1 = internal_13 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 428($sp) + lw $t0, 452($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -1748,32 +1915,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 364($sp) # internal_21 = address of allocated object Int + sw $v0, 388($sp) # internal_21 = address of allocated object Int # internal_20 = direction of Bar la $t0, type_Bar - sw $t0, 368($sp) + sw $t0, 392($sp) # array internal_12[4 * internal_21] = internal_20 - lw $t0, 364($sp) # $t0 = internal_21 + lw $t0, 388($sp) # $t0 = internal_21 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 400($sp) # $t1 = internal_12 + lw $t1, 424($sp) # $t1 = internal_12 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 368($sp) + lw $t0, 392($sp) sw $t0, 0($t1) # array internal_13[4 * internal_21] = internal_5 - lw $t0, 364($sp) # $t0 = internal_21 + lw $t0, 388($sp) # $t0 = internal_21 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 396($sp) # $t1 = internal_13 + lw $t1, 420($sp) # $t1 = internal_13 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 428($sp) + lw $t0, 452($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -1787,7 +1954,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 360($sp) # internal_22 = address of allocated object Int + sw $v0, 384($sp) # internal_22 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -1799,7 +1966,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 356($sp) # internal_23 = address of allocated object Int + sw $v0, 380($sp) # internal_23 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -1811,7 +1978,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 348($sp) # internal_25 = address of allocated object Int + sw $v0, 372($sp) # internal_25 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -1823,7 +1990,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 344($sp) # internal_26 = address of allocated object Int + sw $v0, 368($sp) # internal_26 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -1835,155 +2002,155 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 336($sp) # internal_28 = address of allocated object Int + sw $v0, 360($sp) # internal_28 = address of allocated object Int - foreach_type_start_8744937301489: + foreach_type_start_8794484741346: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_22 - lw $t0, 372($sp) + lw $t0, 396($sp) sw $t0, 4($sp) # Storing internal_22 # Argument internal_3 - lw $t0, 448($sp) + lw $t0, 472($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 368($sp) # internal_23 = result of function_less_than + sw $v1, 392($sp) # internal_23 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_23 then goto foreach_type_body_8744937301489 - lw $t0, 356($sp) # Loading the address of the condition + # If internal_23 then goto foreach_type_body_8794484741346 + lw $t0, 380($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_type_body_8744937301489 + beq $t0, $t1, foreach_type_body_8794484741346 - # Jumping to foreach_type_end_8744937301489 - j foreach_type_end_8744937301489 + # Jumping to foreach_type_end_8794484741346 + j foreach_type_end_8794484741346 - foreach_type_body_8744937301489: + foreach_type_body_8794484741346: # internal_24 = array internal_12[4 * internal_22] - lw $t0, 360($sp) # $t0 = internal_22 + lw $t0, 384($sp) # $t0 = internal_22 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 400($sp) # $t1 = internal_12 + lw $t1, 424($sp) # $t1 = internal_12 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - sw $t0, 352($sp) # internal_24 = array internal_12[4 * internal_22] + sw $t0, 376($sp) # internal_24 = array internal_12[4 * internal_22] # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_25 - lw $t0, 360($sp) + lw $t0, 384($sp) sw $t0, 4($sp) # Storing internal_25 # Argument internal_1 - lw $t0, 456($sp) + lw $t0, 480($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 360($sp) # internal_25 = result of function_assign + sw $v1, 384($sp) # internal_25 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - foreach_ancestor_start_8744937301489: + foreach_ancestor_start_8794484741346: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_25 - lw $t0, 360($sp) + lw $t0, 384($sp) sw $t0, 4($sp) # Storing internal_25 # Argument internal_5 - lw $t0, 440($sp) + lw $t0, 464($sp) sw $t0, 0($sp) # Storing internal_5 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 356($sp) # internal_26 = result of function_less_than + sw $v1, 380($sp) # internal_26 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_26 then goto foreach_ancestor_body_8744937301489 - lw $t0, 344($sp) # Loading the address of the condition + # If internal_26 then goto foreach_ancestor_body_8794484741346 + lw $t0, 368($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_body_8744937301489 + beq $t0, $t1, foreach_ancestor_body_8794484741346 - # Jumping to foreach_ancestor_end_8744937301489 - j foreach_ancestor_end_8744937301489 + # Jumping to foreach_ancestor_end_8794484741346 + j foreach_ancestor_end_8794484741346 - foreach_ancestor_body_8744937301489: + foreach_ancestor_body_8794484741346: # internal_27 = array internal_9[4 * internal_25] - lw $t0, 348($sp) # $t0 = internal_25 + lw $t0, 372($sp) # $t0 = internal_25 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 412($sp) # $t1 = internal_9 + lw $t1, 436($sp) # $t1 = internal_9 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - sw $t0, 340($sp) # internal_27 = array internal_9[4 * internal_25] + sw $t0, 364($sp) # internal_27 = array internal_9[4 * internal_25] # internal_28 = EqualAddress(internal_24, internal_27) - lw $t0, 352($sp) - lw $t1, 340($sp) + lw $t0, 376($sp) + lw $t1, 364($sp) seq $t2, $t0, $t1 - lw $t0, 336($sp) + lw $t0, 360($sp) sw $t2, 8($t0) - # If internal_28 then goto foreach_ancestor_end_8744937301489 - lw $t0, 336($sp) # Loading the address of the condition + # If internal_28 then goto foreach_ancestor_end_8794484741346 + lw $t0, 360($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_end_8744937301489 + beq $t0, $t1, foreach_ancestor_end_8794484741346 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_25 - lw $t0, 360($sp) + lw $t0, 384($sp) sw $t0, 4($sp) # Storing internal_25 # Argument internal_2 - lw $t0, 452($sp) + lw $t0, 476($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 360($sp) # internal_25 = result of function_add + sw $v1, 384($sp) # internal_25 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_ancestor_start_8744937301489 - j foreach_ancestor_start_8744937301489 + # Jumping to foreach_ancestor_start_8794484741346 + j foreach_ancestor_start_8794484741346 - foreach_ancestor_end_8744937301489: + foreach_ancestor_end_8794484741346: # array internal_13[4 * internal_22] = internal_25 - lw $t0, 360($sp) # $t0 = internal_22 + lw $t0, 384($sp) # $t0 = internal_22 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 396($sp) # $t1 = internal_13 + lw $t1, 420($sp) # $t1 = internal_13 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 348($sp) + lw $t0, 372($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -1992,59 +2159,23 @@ sw $ra, 8($sp) # Storing return address # Argument internal_22 - lw $t0, 372($sp) + lw $t0, 396($sp) sw $t0, 4($sp) # Storing internal_22 # Argument internal_2 - lw $t0, 452($sp) + lw $t0, 476($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 372($sp) # internal_22 = result of function_add + sw $v1, 396($sp) # internal_22 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_type_start_8744937301489 - j foreach_type_start_8744937301489 - - foreach_type_end_8744937301489: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_34[0] = '\n' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 312($sp) # internal_34 = "\n" - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_35[0] = ' ' - - sb $zero, 9($v0) # Null-terminator at the end of the string + # Jumping to foreach_type_start_8794484741346 + j foreach_type_start_8794484741346 - sw $v0, 308($sp) # internal_35 = " " + foreach_type_end_8794484741346: # Allocating Int 0 li $v0, 9 @@ -2056,7 +2187,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 332($sp) # internal_29 = address of allocated object Int + sw $v0, 356($sp) # internal_29 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -2068,7 +2199,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 328($sp) # internal_30 = address of allocated object Int + sw $v0, 352($sp) # internal_30 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -2080,7 +2211,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 324($sp) # internal_31 = address of allocated object Int + sw $v0, 348($sp) # internal_31 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -2092,7 +2223,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 320($sp) # internal_32 = address of allocated object Int + sw $v0, 344($sp) # internal_32 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -2104,67 +2235,67 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 316($sp) # internal_33 = address of allocated object Int + sw $v0, 340($sp) # internal_33 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_32 - lw $t0, 332($sp) + lw $t0, 356($sp) sw $t0, 4($sp) # Storing internal_32 # Argument internal_5 - lw $t0, 440($sp) + lw $t0, 464($sp) sw $t0, 0($sp) # Storing internal_5 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 332($sp) # internal_32 = result of function_assign + sw $v1, 356($sp) # internal_32 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - foreach_min_start_8744937301489: + foreach_min_start_8794484741346: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_29 - lw $t0, 344($sp) + lw $t0, 368($sp) sw $t0, 4($sp) # Storing internal_29 # Argument internal_3 - lw $t0, 448($sp) + lw $t0, 472($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 328($sp) # internal_33 = result of function_less_than + sw $v1, 352($sp) # internal_33 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_33 then goto foreach_min_body_8744937301489 - lw $t0, 316($sp) # Loading the address of the condition + # If internal_33 then goto foreach_min_body_8794484741346 + lw $t0, 340($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_min_body_8744937301489 + beq $t0, $t1, foreach_min_body_8794484741346 - # Jumping to foreach_min_end_8744937301489 - j foreach_min_end_8744937301489 + # Jumping to foreach_min_end_8794484741346 + j foreach_min_end_8794484741346 - foreach_min_body_8744937301489: + foreach_min_body_8794484741346: # internal_31 = array internal_13[4 * internal_29] - lw $t0, 332($sp) # $t0 = internal_29 + lw $t0, 356($sp) # $t0 = internal_29 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 396($sp) # $t1 = internal_13 + lw $t1, 420($sp) # $t1 = internal_13 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 324($sp) # internal_31 = array internal_13[4 * internal_29] + lw $t2, 348($sp) # internal_31 = array internal_13[4 * internal_29] sw $t0, 8($t2) # Passing function arguments @@ -2172,46 +2303,46 @@ sw $ra, 8($sp) # Storing return address # Argument internal_31 - lw $t0, 336($sp) + lw $t0, 360($sp) sw $t0, 4($sp) # Storing internal_31 # Argument internal_32 - lw $t0, 332($sp) + lw $t0, 356($sp) sw $t0, 0($sp) # Storing internal_32 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 328($sp) # internal_33 = result of function_less_than + sw $v1, 352($sp) # internal_33 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_33 then goto update_min_8744937301489 - lw $t0, 316($sp) # Loading the address of the condition + # If internal_33 then goto update_min_8794484741346 + lw $t0, 340($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, update_min_8744937301489 + beq $t0, $t1, update_min_8794484741346 - # Jumping to update_min_end_8744937301489 - j update_min_end_8744937301489 + # Jumping to update_min_end_8794484741346 + j update_min_end_8794484741346 - update_min_8744937301489: + update_min_8794484741346: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_32 - lw $t0, 332($sp) + lw $t0, 356($sp) sw $t0, 4($sp) # Storing internal_32 # Argument internal_31 - lw $t0, 336($sp) + lw $t0, 360($sp) sw $t0, 0($sp) # Storing internal_31 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 332($sp) # internal_32 = result of function_assign + sw $v1, 356($sp) # internal_32 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -2219,46 +2350,46 @@ sw $ra, 8($sp) # Storing return address # Argument internal_30 - lw $t0, 340($sp) + lw $t0, 364($sp) sw $t0, 4($sp) # Storing internal_30 # Argument internal_29 - lw $t0, 344($sp) + lw $t0, 368($sp) sw $t0, 0($sp) # Storing internal_29 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 340($sp) # internal_30 = result of function_assign + sw $v1, 364($sp) # internal_30 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - update_min_end_8744937301489: + update_min_end_8794484741346: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_29 - lw $t0, 344($sp) + lw $t0, 368($sp) sw $t0, 4($sp) # Storing internal_29 # Argument internal_2 - lw $t0, 452($sp) + lw $t0, 476($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 344($sp) # internal_29 = result of function_add + sw $v1, 368($sp) # internal_29 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_min_start_8744937301489 - j foreach_min_start_8744937301489 + # Jumping to foreach_min_start_8794484741346 + j foreach_min_start_8794484741346 - foreach_min_end_8744937301489: + foreach_min_end_8794484741346: # initialize Array [internal_3] - lw $t0, 436($sp) # $t0 = internal_3 + lw $t0, 460($sp) # $t0 = internal_3 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -2266,7 +2397,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 304($sp) # internal_36 = new Array[internal_3] + sw $v0, 336($sp) # internal_34 = new Array[internal_3] # Allocating Int 0 li $v0, 9 @@ -2278,17 +2409,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 300($sp) # internal_37 = address of allocated object Int + sw $v0, 332($sp) # internal_35 = address of allocated object Int - # array internal_36[4 * internal_37] = internal_1 - lw $t0, 300($sp) # $t0 = internal_37 + # array internal_34[4 * internal_35] = internal_1 + lw $t0, 332($sp) # $t0 = internal_35 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 304($sp) # $t1 = internal_36 + lw $t1, 336($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 444($sp) + lw $t0, 468($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -2302,17 +2433,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 296($sp) # internal_38 = address of allocated object Int + sw $v0, 328($sp) # internal_36 = address of allocated object Int - # array internal_36[4 * internal_38] = internal_1 - lw $t0, 296($sp) # $t0 = internal_38 + # array internal_34[4 * internal_36] = internal_1 + lw $t0, 328($sp) # $t0 = internal_36 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 304($sp) # $t1 = internal_36 + lw $t1, 336($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 444($sp) + lw $t0, 468($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -2326,17 +2457,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 292($sp) # internal_39 = address of allocated object Int + sw $v0, 324($sp) # internal_37 = address of allocated object Int - # array internal_36[4 * internal_39] = internal_1 - lw $t0, 292($sp) # $t0 = internal_39 + # array internal_34[4 * internal_37] = internal_1 + lw $t0, 324($sp) # $t0 = internal_37 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 304($sp) # $t1 = internal_36 + lw $t1, 336($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 444($sp) + lw $t0, 468($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -2350,17 +2481,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 288($sp) # internal_40 = address of allocated object Int + sw $v0, 320($sp) # internal_38 = address of allocated object Int - # array internal_36[4 * internal_40] = internal_1 - lw $t0, 288($sp) # $t0 = internal_40 + # array internal_34[4 * internal_38] = internal_1 + lw $t0, 320($sp) # $t0 = internal_38 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 304($sp) # $t1 = internal_36 + lw $t1, 336($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 444($sp) + lw $t0, 468($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -2374,41 +2505,41 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 284($sp) # internal_41 = address of allocated object Int + sw $v0, 316($sp) # internal_39 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_32 - lw $t0, 332($sp) + lw $t0, 356($sp) sw $t0, 4($sp) # Storing internal_32 # Argument internal_5 - lw $t0, 440($sp) + lw $t0, 464($sp) sw $t0, 0($sp) # Storing internal_5 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 296($sp) # internal_41 = result of function_equal + sw $v1, 328($sp) # internal_39 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # If internal_41 then goto error_branch_8744937301489 - lw $t0, 284($sp) # Loading the address of the condition + # If internal_39 then goto error_branch_8794484741346 + lw $t0, 316($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, error_branch_8744937301489 + beq $t0, $t1, error_branch_8794484741346 - # array internal_36[4 * internal_30] = internal_2 - lw $t0, 328($sp) # $t0 = internal_30 + # array internal_34[4 * internal_30] = internal_2 + lw $t0, 352($sp) # $t0 = internal_30 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 304($sp) # $t1 = internal_36 + lw $t1, 336($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 440($sp) + lw $t0, 464($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -2422,7 +2553,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 280($sp) # internal_42 = address of allocated object Int + sw $v0, 312($sp) # internal_40 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -2434,25 +2565,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 276($sp) # internal_43 = address of allocated object Int + sw $v0, 308($sp) # internal_41 = address of allocated object Int - # internal_42 = array internal_36[4 * internal_43] - lw $t0, 276($sp) # $t0 = internal_43 + # internal_40 = array internal_34[4 * internal_41] + lw $t0, 308($sp) # $t0 = internal_41 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 304($sp) # $t1 = internal_36 + lw $t1, 336($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 280($sp) # internal_42 = array internal_36[4 * internal_43] + lw $t2, 312($sp) # internal_40 = array internal_34[4 * internal_41] sw $t0, 8($t2) - # If internal_42 then goto branch_Bazz_8744937301489 - lw $t0, 280($sp) # Loading the address of the condition + # If internal_40 then goto branch_Bazz_8794484741346 + lw $t0, 312($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Bazz_8744937301489 + beq $t0, $t1, branch_Bazz_8794484741346 # Allocating Int 1 li $v0, 9 @@ -2464,25 +2595,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 272($sp) # internal_44 = address of allocated object Int + sw $v0, 304($sp) # internal_42 = address of allocated object Int - # internal_42 = array internal_36[4 * internal_44] - lw $t0, 272($sp) # $t0 = internal_44 + # internal_40 = array internal_34[4 * internal_42] + lw $t0, 304($sp) # $t0 = internal_42 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 304($sp) # $t1 = internal_36 + lw $t1, 336($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 280($sp) # internal_42 = array internal_36[4 * internal_44] + lw $t2, 312($sp) # internal_40 = array internal_34[4 * internal_42] sw $t0, 8($t2) - # If internal_42 then goto branch_Razz_8744937301489 - lw $t0, 280($sp) # Loading the address of the condition + # If internal_40 then goto branch_Razz_8794484741346 + lw $t0, 312($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Razz_8744937301489 + beq $t0, $t1, branch_Razz_8794484741346 # Allocating Int 2 li $v0, 9 @@ -2494,25 +2625,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 268($sp) # internal_45 = address of allocated object Int + sw $v0, 300($sp) # internal_43 = address of allocated object Int - # internal_42 = array internal_36[4 * internal_45] - lw $t0, 268($sp) # $t0 = internal_45 + # internal_40 = array internal_34[4 * internal_43] + lw $t0, 300($sp) # $t0 = internal_43 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 304($sp) # $t1 = internal_36 + lw $t1, 336($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 280($sp) # internal_42 = array internal_36[4 * internal_45] + lw $t2, 312($sp) # internal_40 = array internal_34[4 * internal_43] sw $t0, 8($t2) - # If internal_42 then goto branch_Foo_8744937301489 - lw $t0, 280($sp) # Loading the address of the condition + # If internal_40 then goto branch_Foo_8794484741346 + lw $t0, 312($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Foo_8744937301489 + beq $t0, $t1, branch_Foo_8794484741346 # Allocating Int 3 li $v0, 9 @@ -2524,44 +2655,44 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 264($sp) # internal_46 = address of allocated object Int + sw $v0, 296($sp) # internal_44 = address of allocated object Int - # internal_42 = array internal_36[4 * internal_46] - lw $t0, 264($sp) # $t0 = internal_46 + # internal_40 = array internal_34[4 * internal_44] + lw $t0, 296($sp) # $t0 = internal_44 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 304($sp) # $t1 = internal_36 + lw $t1, 336($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 280($sp) # internal_42 = array internal_36[4 * internal_46] + lw $t2, 312($sp) # internal_40 = array internal_34[4 * internal_44] sw $t0, 8($t2) - # If internal_42 then goto branch_Bar_8744937301489 - lw $t0, 280($sp) # Loading the address of the condition + # If internal_40 then goto branch_Bar_8794484741346 + lw $t0, 312($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Bar_8744937301489 + beq $t0, $t1, branch_Bar_8794484741346 - branch_Bazz_8744937301489: + branch_Bazz_8794484741346: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 268($sp) + lw $t0, 300($sp) sw $t0, 4($sp) # Storing n # Argument self - lw $t0, 464($sp) + lw $t0, 488($sp) sw $t0, 0($sp) # Storing self # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 268($sp) # n = result of function_assign + sw $v1, 300($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Foo @@ -2571,65 +2702,65 @@ la $t0, type_Foo # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 252($sp) # internal_49 = address of allocated object Foo + sw $v0, 284($sp) # internal_47 = address of allocated object Foo # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_49 - lw $t0, 260($sp) - sw $t0, 0($sp) # Storing internal_49 + # Argument internal_47 + lw $t0, 292($sp) + sw $t0, 0($sp) # Storing internal_47 # Calling function function___init___at_Foo jal function___init___at_Foo lw $ra, 4($sp) - sw $v1, 260($sp) # internal_49 = result of function___init___at_Foo + sw $v1, 292($sp) # internal_47 = result of function___init___at_Foo addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_47 - lw $t0, 272($sp) - sw $t0, 4($sp) # Storing internal_47 + # Argument internal_45 + lw $t0, 304($sp) + sw $t0, 4($sp) # Storing internal_45 - # Argument internal_49 - lw $t0, 264($sp) - sw $t0, 0($sp) # Storing internal_49 + # Argument internal_47 + lw $t0, 296($sp) + sw $t0, 0($sp) # Storing internal_47 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 272($sp) # internal_47 = result of function_assign + sw $v1, 304($sp) # internal_45 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_47 = internal_49 - lw $t0, 252($sp) - sw $t0, 260($sp) + # internal_45 = internal_47 + lw $t0, 284($sp) + sw $t0, 292($sp) - # Jumping to branch_end_8744937301489 - j branch_end_8744937301489 + # Jumping to branch_end_8794484741346 + j branch_end_8794484741346 - branch_Razz_8744937301489: + branch_Razz_8794484741346: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 268($sp) + lw $t0, 300($sp) sw $t0, 4($sp) # Storing n # Argument self - lw $t0, 464($sp) + lw $t0, 488($sp) sw $t0, 0($sp) # Storing self # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 268($sp) # n = result of function_assign + sw $v1, 300($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bar @@ -2639,65 +2770,65 @@ la $t0, type_Bar # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 244($sp) # internal_51 = address of allocated object Bar + sw $v0, 276($sp) # internal_49 = address of allocated object Bar # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_51 - lw $t0, 252($sp) - sw $t0, 0($sp) # Storing internal_51 + # Argument internal_49 + lw $t0, 284($sp) + sw $t0, 0($sp) # Storing internal_49 # Calling function function___init___at_Bar jal function___init___at_Bar lw $ra, 4($sp) - sw $v1, 252($sp) # internal_51 = result of function___init___at_Bar + sw $v1, 284($sp) # internal_49 = result of function___init___at_Bar addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_47 - lw $t0, 272($sp) - sw $t0, 4($sp) # Storing internal_47 + # Argument internal_45 + lw $t0, 304($sp) + sw $t0, 4($sp) # Storing internal_45 - # Argument internal_51 - lw $t0, 256($sp) - sw $t0, 0($sp) # Storing internal_51 + # Argument internal_49 + lw $t0, 288($sp) + sw $t0, 0($sp) # Storing internal_49 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 272($sp) # internal_47 = result of function_assign + sw $v1, 304($sp) # internal_45 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_47 = internal_51 - lw $t0, 244($sp) - sw $t0, 260($sp) + # internal_45 = internal_49 + lw $t0, 276($sp) + sw $t0, 292($sp) - # Jumping to branch_end_8744937301489 - j branch_end_8744937301489 + # Jumping to branch_end_8794484741346 + j branch_end_8794484741346 - branch_Foo_8744937301489: + branch_Foo_8794484741346: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 268($sp) + lw $t0, 300($sp) sw $t0, 4($sp) # Storing n # Argument self - lw $t0, 464($sp) + lw $t0, 488($sp) sw $t0, 0($sp) # Storing self # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 268($sp) # n = result of function_assign + sw $v1, 300($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Razz @@ -2707,110 +2838,110 @@ la $t0, type_Razz # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 236($sp) # internal_53 = address of allocated object Razz + sw $v0, 268($sp) # internal_51 = address of allocated object Razz # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_53 - lw $t0, 244($sp) - sw $t0, 0($sp) # Storing internal_53 + # Argument internal_51 + lw $t0, 276($sp) + sw $t0, 0($sp) # Storing internal_51 # Calling function function___init___at_Razz jal function___init___at_Razz lw $ra, 4($sp) - sw $v1, 244($sp) # internal_53 = result of function___init___at_Razz + sw $v1, 276($sp) # internal_51 = result of function___init___at_Razz addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_47 - lw $t0, 272($sp) - sw $t0, 4($sp) # Storing internal_47 + # Argument internal_45 + lw $t0, 304($sp) + sw $t0, 4($sp) # Storing internal_45 - # Argument internal_53 - lw $t0, 248($sp) - sw $t0, 0($sp) # Storing internal_53 + # Argument internal_51 + lw $t0, 280($sp) + sw $t0, 0($sp) # Storing internal_51 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 272($sp) # internal_47 = result of function_assign + sw $v1, 304($sp) # internal_45 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_47 = internal_53 - lw $t0, 236($sp) - sw $t0, 260($sp) + # internal_45 = internal_51 + lw $t0, 268($sp) + sw $t0, 292($sp) - # Jumping to branch_end_8744937301489 - j branch_end_8744937301489 + # Jumping to branch_end_8794484741346 + j branch_end_8794484741346 - branch_Bar_8744937301489: + branch_Bar_8794484741346: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 268($sp) + lw $t0, 300($sp) sw $t0, 4($sp) # Storing n # Argument self - lw $t0, 464($sp) + lw $t0, 488($sp) sw $t0, 0($sp) # Storing self # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 268($sp) # n = result of function_assign + sw $v1, 300($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_47 - lw $t0, 272($sp) - sw $t0, 4($sp) # Storing internal_47 + # Argument internal_45 + lw $t0, 304($sp) + sw $t0, 4($sp) # Storing internal_45 # Argument n - lw $t0, 268($sp) + lw $t0, 300($sp) sw $t0, 0($sp) # Storing n # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 272($sp) # internal_47 = result of function_assign + sw $v1, 304($sp) # internal_45 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_47 = n - lw $t0, 256($sp) - sw $t0, 260($sp) + # internal_45 = n + lw $t0, 288($sp) + sw $t0, 292($sp) - # Jumping to branch_end_8744937301489 - j branch_end_8744937301489 + # Jumping to branch_end_8794484741346 + j branch_end_8794484741346 - error_branch_8744937301489: + error_branch_8794484741346: - branch_end_8744937301489: + branch_end_8794484741346: # Set attribute g of self - lw $t0, 452($sp) # $t0 = self - lw $t1, 260($sp) # $t1 = internal_47 - beq $t1, $zero, object_set_attribute_8744937288328 + lw $t0, 476($sp) # $t0 = self + lw $t1, 292($sp) # $t1 = internal_45 + beq $t1, $zero, object_set_attribute_8794484661477 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937288328 + beq $t6, $t5, int_set_attribute_8794484661477 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937288328 - j object_set_attribute_8744937288328 - int_set_attribute_8744937288328: + beq $t6, $t5, bool_set_attribute_8794484661477 + j object_set_attribute_8794484661477 + int_set_attribute_8794484661477: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2818,9 +2949,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.g = internal_47 - j end_set_attribute_8744937288328 - bool_set_attribute_8744937288328: + sw $v0, 12($t0) # self.g = internal_45 + j end_set_attribute_8794484661477 + bool_set_attribute_8794484661477: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2828,40 +2959,64 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.g = internal_47 - j end_set_attribute_8744937288328 - object_set_attribute_8744937288328: - sw $t1, 12($t0) # self.g = internal_47 - end_set_attribute_8744937288328: + sw $v0, 12($t0) # self.g = internal_45 + j end_set_attribute_8794484661477 + object_set_attribute_8794484661477: + sw $t1, 12($t0) # self.g = internal_45 + end_set_attribute_8794484661477: + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 256($sp) # internal_54 = address of allocated object Int + + # Get method printh of Foo + lw $t0, 476($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 256($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 252($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 460($sp) + lw $t0, 484($sp) sw $t0, 0($sp) # Storing self - # Calling function function_printh_at_Bazz - jal function_printh_at_Bazz + # Calling function internal_55 + lw $t0, 260($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 236($sp) # internal_55 = result of function_printh_at_Bazz + sw $v1, 268($sp) # internal_53 = result of internal_55 addi $sp, $sp, 8 # Freeing space for arguments # Set attribute i of self - lw $t0, 452($sp) # $t0 = self - lw $t1, 228($sp) # $t1 = internal_55 - beq $t1, $zero, object_set_attribute_8744937288325 + lw $t0, 476($sp) # $t0 = self + lw $t1, 260($sp) # $t1 = internal_53 + beq $t1, $zero, object_set_attribute_8794484666103 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937288325 + beq $t6, $t5, int_set_attribute_8794484666103 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937288325 - j object_set_attribute_8744937288325 - int_set_attribute_8744937288325: + beq $t6, $t5, bool_set_attribute_8794484666103 + j object_set_attribute_8794484666103 + int_set_attribute_8794484666103: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2869,9 +3024,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 16($t0) # self.i = internal_55 - j end_set_attribute_8744937288325 - bool_set_attribute_8744937288325: + sw $v0, 16($t0) # self.i = internal_53 + j end_set_attribute_8794484666103 + bool_set_attribute_8794484666103: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2879,11 +3034,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 16($t0) # self.i = internal_55 - j end_set_attribute_8744937288325 - object_set_attribute_8744937288325: - sw $t1, 16($t0) # self.i = internal_55 - end_set_attribute_8744937288325: + sw $v0, 16($t0) # self.i = internal_53 + j end_set_attribute_8794484666103 + object_set_attribute_8794484666103: + sw $t1, 16($t0) # self.i = internal_53 + end_set_attribute_8794484666103: # Allocating Int 0 li $v0, 9 @@ -2895,7 +3050,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 224($sp) # internal_56 = address of allocated object Int + sw $v0, 248($sp) # internal_56 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -2907,7 +3062,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 220($sp) # internal_57 = address of allocated object Int + sw $v0, 244($sp) # internal_57 = address of allocated object Int # Allocating Int 3 li $v0, 9 @@ -2919,10 +3074,10 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 216($sp) # internal_58 = address of allocated object Int + sw $v0, 240($sp) # internal_58 = address of allocated object Int # Allocating NUll to internal_59 - sw $zero, 212($sp) # internal_59 = 0 + sw $zero, 236($sp) # internal_59 = 0 # Allocating Int 0 li $v0, 9 @@ -2934,7 +3089,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 208($sp) # internal_60 = address of allocated object Int + sw $v0, 232($sp) # internal_60 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -2946,66 +3101,66 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 196($sp) # internal_63 = address of allocated object Int + sw $v0, 220($sp) # internal_63 = address of allocated object Int # internal_61 = typeof self that is the first word of the object - lw $t0, 452($sp) + lw $t0, 476($sp) lw $t0, 0($t0) - sw $t0, 204($sp) + sw $t0, 228($sp) # internal_62 = internal_61 - lw $t0, 204($sp) - sw $t0, 200($sp) + lw $t0, 228($sp) + sw $t0, 224($sp) - while_start_8744937325815: + while_start_8794484748198: # internal_63 = EqualAddress(internal_62, internal_59) - lw $t0, 200($sp) - lw $t1, 212($sp) + lw $t0, 224($sp) + lw $t1, 236($sp) seq $t2, $t0, $t1 - lw $t0, 196($sp) + lw $t0, 220($sp) sw $t2, 8($t0) - # If internal_63 then goto while_end_8744937325815 - lw $t0, 196($sp) # Loading the address of the condition + # If internal_63 then goto while_end_8794484748198 + lw $t0, 220($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_end_8744937325815 + beq $t0, $t1, while_end_8794484748198 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_60 - lw $t0, 220($sp) + lw $t0, 244($sp) sw $t0, 4($sp) # Storing internal_60 # Argument internal_57 - lw $t0, 232($sp) + lw $t0, 256($sp) sw $t0, 0($sp) # Storing internal_57 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 220($sp) # internal_60 = result of function_add + sw $v1, 244($sp) # internal_60 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # internal_62 = ancestor of internal_62 - lw $t0, 200($sp) + lw $t0, 224($sp) lw $t0, 4($t0) - sw $t0, 200($sp) + sw $t0, 224($sp) - # Jumping to while_start_8744937325815 - j while_start_8744937325815 + # Jumping to while_start_8794484748198 + j while_start_8794484748198 - while_end_8744937325815: + while_end_8794484748198: # internal_62 = internal_61 - lw $t0, 204($sp) - sw $t0, 200($sp) + lw $t0, 228($sp) + sw $t0, 224($sp) # initialize Array [internal_60] - lw $t0, 208($sp) # $t0 = internal_60 + lw $t0, 232($sp) # $t0 = internal_60 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -3013,7 +3168,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 192($sp) # internal_64 = new Array[internal_60] + sw $v0, 216($sp) # internal_64 = new Array[internal_60] # Allocating Int 0 li $v0, 9 @@ -3025,7 +3180,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 188($sp) # internal_65 = address of allocated object Int + sw $v0, 212($sp) # internal_65 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -3037,80 +3192,80 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 184($sp) # internal_66 = address of allocated object Int + sw $v0, 208($sp) # internal_66 = address of allocated object Int - foreach_start_8744937325815: + foreach_start_8794484748198: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_65 - lw $t0, 200($sp) + lw $t0, 224($sp) sw $t0, 4($sp) # Storing internal_65 # Argument internal_60 - lw $t0, 220($sp) + lw $t0, 244($sp) sw $t0, 0($sp) # Storing internal_60 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 196($sp) # internal_66 = result of function_less_than + sw $v1, 220($sp) # internal_66 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_66 then goto foreach_body_8744937325815 - lw $t0, 184($sp) # Loading the address of the condition + # If internal_66 then goto foreach_body_8794484748198 + lw $t0, 208($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_body_8744937325815 + beq $t0, $t1, foreach_body_8794484748198 - # Jumping to foreach_end_8744937325815 - j foreach_end_8744937325815 + # Jumping to foreach_end_8794484748198 + j foreach_end_8794484748198 - foreach_body_8744937325815: + foreach_body_8794484748198: # array internal_64[4 * internal_65] = internal_62 - lw $t0, 188($sp) # $t0 = internal_65 + lw $t0, 212($sp) # $t0 = internal_65 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 192($sp) # $t1 = internal_64 + lw $t1, 216($sp) # $t1 = internal_64 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 200($sp) + lw $t0, 224($sp) sw $t0, 0($t1) # internal_62 = ancestor of internal_62 - lw $t0, 200($sp) + lw $t0, 224($sp) lw $t0, 4($t0) - sw $t0, 200($sp) + sw $t0, 224($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_65 - lw $t0, 200($sp) + lw $t0, 224($sp) sw $t0, 4($sp) # Storing internal_65 # Argument internal_57 - lw $t0, 232($sp) + lw $t0, 256($sp) sw $t0, 0($sp) # Storing internal_57 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 200($sp) # internal_65 = result of function_add + sw $v1, 224($sp) # internal_65 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_start_8744937325815 - j foreach_start_8744937325815 + # Jumping to foreach_start_8794484748198 + j foreach_start_8794484748198 - foreach_end_8744937325815: + foreach_end_8794484748198: # initialize Array [internal_58] - lw $t0, 216($sp) # $t0 = internal_58 + lw $t0, 240($sp) # $t0 = internal_58 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -3118,10 +3273,10 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 180($sp) # internal_67 = new Array[internal_58] + sw $v0, 204($sp) # internal_67 = new Array[internal_58] # initialize Array [internal_58] - lw $t0, 216($sp) # $t0 = internal_58 + lw $t0, 240($sp) # $t0 = internal_58 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -3129,7 +3284,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 176($sp) # internal_68 = new Array[internal_58] + sw $v0, 200($sp) # internal_68 = new Array[internal_58] # Allocating Int 0 li $v0, 9 @@ -3141,32 +3296,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 168($sp) # internal_70 = address of allocated object Int + sw $v0, 192($sp) # internal_70 = address of allocated object Int # internal_69 = direction of Razz la $t0, type_Razz - sw $t0, 172($sp) + sw $t0, 196($sp) # array internal_67[4 * internal_70] = internal_69 - lw $t0, 168($sp) # $t0 = internal_70 + lw $t0, 192($sp) # $t0 = internal_70 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 180($sp) # $t1 = internal_67 + lw $t1, 204($sp) # $t1 = internal_67 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 172($sp) + lw $t0, 196($sp) sw $t0, 0($t1) # array internal_68[4 * internal_70] = internal_60 - lw $t0, 168($sp) # $t0 = internal_70 + lw $t0, 192($sp) # $t0 = internal_70 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 176($sp) # $t1 = internal_68 + lw $t1, 200($sp) # $t1 = internal_68 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 208($sp) + lw $t0, 232($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -3180,32 +3335,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 160($sp) # internal_72 = address of allocated object Int + sw $v0, 184($sp) # internal_72 = address of allocated object Int # internal_71 = direction of Foo la $t0, type_Foo - sw $t0, 164($sp) + sw $t0, 188($sp) # array internal_67[4 * internal_72] = internal_71 - lw $t0, 160($sp) # $t0 = internal_72 + lw $t0, 184($sp) # $t0 = internal_72 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 180($sp) # $t1 = internal_67 + lw $t1, 204($sp) # $t1 = internal_67 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 164($sp) + lw $t0, 188($sp) sw $t0, 0($t1) # array internal_68[4 * internal_72] = internal_60 - lw $t0, 160($sp) # $t0 = internal_72 + lw $t0, 184($sp) # $t0 = internal_72 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 176($sp) # $t1 = internal_68 + lw $t1, 200($sp) # $t1 = internal_68 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 208($sp) + lw $t0, 232($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -3219,32 +3374,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 152($sp) # internal_74 = address of allocated object Int + sw $v0, 176($sp) # internal_74 = address of allocated object Int # internal_73 = direction of Bar la $t0, type_Bar - sw $t0, 156($sp) + sw $t0, 180($sp) # array internal_67[4 * internal_74] = internal_73 - lw $t0, 152($sp) # $t0 = internal_74 + lw $t0, 176($sp) # $t0 = internal_74 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 180($sp) # $t1 = internal_67 + lw $t1, 204($sp) # $t1 = internal_67 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 156($sp) + lw $t0, 180($sp) sw $t0, 0($t1) # array internal_68[4 * internal_74] = internal_60 - lw $t0, 152($sp) # $t0 = internal_74 + lw $t0, 176($sp) # $t0 = internal_74 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 176($sp) # $t1 = internal_68 + lw $t1, 200($sp) # $t1 = internal_68 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 208($sp) + lw $t0, 232($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -3258,7 +3413,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 148($sp) # internal_75 = address of allocated object Int + sw $v0, 172($sp) # internal_75 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -3270,7 +3425,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 144($sp) # internal_76 = address of allocated object Int + sw $v0, 168($sp) # internal_76 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -3282,7 +3437,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 136($sp) # internal_78 = address of allocated object Int + sw $v0, 160($sp) # internal_78 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -3294,7 +3449,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 132($sp) # internal_79 = address of allocated object Int + sw $v0, 156($sp) # internal_79 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -3306,155 +3461,155 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 124($sp) # internal_81 = address of allocated object Int + sw $v0, 148($sp) # internal_81 = address of allocated object Int - foreach_type_start_8744937325815: + foreach_type_start_8794484748198: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_75 - lw $t0, 160($sp) + lw $t0, 184($sp) sw $t0, 4($sp) # Storing internal_75 # Argument internal_58 - lw $t0, 228($sp) + lw $t0, 252($sp) sw $t0, 0($sp) # Storing internal_58 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 156($sp) # internal_76 = result of function_less_than + sw $v1, 180($sp) # internal_76 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_76 then goto foreach_type_body_8744937325815 - lw $t0, 144($sp) # Loading the address of the condition + # If internal_76 then goto foreach_type_body_8794484748198 + lw $t0, 168($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_type_body_8744937325815 + beq $t0, $t1, foreach_type_body_8794484748198 - # Jumping to foreach_type_end_8744937325815 - j foreach_type_end_8744937325815 + # Jumping to foreach_type_end_8794484748198 + j foreach_type_end_8794484748198 - foreach_type_body_8744937325815: + foreach_type_body_8794484748198: # internal_77 = array internal_67[4 * internal_75] - lw $t0, 148($sp) # $t0 = internal_75 + lw $t0, 172($sp) # $t0 = internal_75 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 180($sp) # $t1 = internal_67 + lw $t1, 204($sp) # $t1 = internal_67 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - sw $t0, 140($sp) # internal_77 = array internal_67[4 * internal_75] + sw $t0, 164($sp) # internal_77 = array internal_67[4 * internal_75] # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_78 - lw $t0, 148($sp) + lw $t0, 172($sp) sw $t0, 4($sp) # Storing internal_78 # Argument internal_56 - lw $t0, 236($sp) + lw $t0, 260($sp) sw $t0, 0($sp) # Storing internal_56 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 148($sp) # internal_78 = result of function_assign + sw $v1, 172($sp) # internal_78 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - foreach_ancestor_start_8744937325815: + foreach_ancestor_start_8794484748198: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_78 - lw $t0, 148($sp) + lw $t0, 172($sp) sw $t0, 4($sp) # Storing internal_78 # Argument internal_60 - lw $t0, 220($sp) + lw $t0, 244($sp) sw $t0, 0($sp) # Storing internal_60 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 144($sp) # internal_79 = result of function_less_than + sw $v1, 168($sp) # internal_79 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_79 then goto foreach_ancestor_body_8744937325815 - lw $t0, 132($sp) # Loading the address of the condition + # If internal_79 then goto foreach_ancestor_body_8794484748198 + lw $t0, 156($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_body_8744937325815 + beq $t0, $t1, foreach_ancestor_body_8794484748198 - # Jumping to foreach_ancestor_end_8744937325815 - j foreach_ancestor_end_8744937325815 + # Jumping to foreach_ancestor_end_8794484748198 + j foreach_ancestor_end_8794484748198 - foreach_ancestor_body_8744937325815: + foreach_ancestor_body_8794484748198: # internal_80 = array internal_64[4 * internal_78] - lw $t0, 136($sp) # $t0 = internal_78 + lw $t0, 160($sp) # $t0 = internal_78 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 192($sp) # $t1 = internal_64 + lw $t1, 216($sp) # $t1 = internal_64 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - sw $t0, 128($sp) # internal_80 = array internal_64[4 * internal_78] + sw $t0, 152($sp) # internal_80 = array internal_64[4 * internal_78] # internal_81 = EqualAddress(internal_77, internal_80) - lw $t0, 140($sp) - lw $t1, 128($sp) + lw $t0, 164($sp) + lw $t1, 152($sp) seq $t2, $t0, $t1 - lw $t0, 124($sp) + lw $t0, 148($sp) sw $t2, 8($t0) - # If internal_81 then goto foreach_ancestor_end_8744937325815 - lw $t0, 124($sp) # Loading the address of the condition + # If internal_81 then goto foreach_ancestor_end_8794484748198 + lw $t0, 148($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_end_8744937325815 + beq $t0, $t1, foreach_ancestor_end_8794484748198 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_78 - lw $t0, 148($sp) + lw $t0, 172($sp) sw $t0, 4($sp) # Storing internal_78 # Argument internal_57 - lw $t0, 232($sp) + lw $t0, 256($sp) sw $t0, 0($sp) # Storing internal_57 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 148($sp) # internal_78 = result of function_add + sw $v1, 172($sp) # internal_78 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_ancestor_start_8744937325815 - j foreach_ancestor_start_8744937325815 + # Jumping to foreach_ancestor_start_8794484748198 + j foreach_ancestor_start_8794484748198 - foreach_ancestor_end_8744937325815: + foreach_ancestor_end_8794484748198: # array internal_68[4 * internal_75] = internal_78 - lw $t0, 148($sp) # $t0 = internal_75 + lw $t0, 172($sp) # $t0 = internal_75 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 176($sp) # $t1 = internal_68 + lw $t1, 200($sp) # $t1 = internal_68 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 136($sp) + lw $t0, 160($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -3463,59 +3618,23 @@ sw $ra, 8($sp) # Storing return address # Argument internal_75 - lw $t0, 160($sp) + lw $t0, 184($sp) sw $t0, 4($sp) # Storing internal_75 # Argument internal_57 - lw $t0, 232($sp) + lw $t0, 256($sp) sw $t0, 0($sp) # Storing internal_57 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 160($sp) # internal_75 = result of function_add + sw $v1, 184($sp) # internal_75 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_type_start_8744937325815 - j foreach_type_start_8744937325815 - - foreach_type_end_8744937325815: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_87[0] = '\n' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 100($sp) # internal_87 = "\n" - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_88[0] = ' ' - - sb $zero, 9($v0) # Null-terminator at the end of the string + # Jumping to foreach_type_start_8794484748198 + j foreach_type_start_8794484748198 - sw $v0, 96($sp) # internal_88 = " " + foreach_type_end_8794484748198: # Allocating Int 0 li $v0, 9 @@ -3527,7 +3646,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 120($sp) # internal_82 = address of allocated object Int + sw $v0, 144($sp) # internal_82 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -3539,7 +3658,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 116($sp) # internal_83 = address of allocated object Int + sw $v0, 140($sp) # internal_83 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -3551,7 +3670,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 112($sp) # internal_84 = address of allocated object Int + sw $v0, 136($sp) # internal_84 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -3563,7 +3682,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 108($sp) # internal_85 = address of allocated object Int + sw $v0, 132($sp) # internal_85 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -3575,67 +3694,67 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 104($sp) # internal_86 = address of allocated object Int + sw $v0, 128($sp) # internal_86 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_85 - lw $t0, 120($sp) + lw $t0, 144($sp) sw $t0, 4($sp) # Storing internal_85 # Argument internal_60 - lw $t0, 220($sp) + lw $t0, 244($sp) sw $t0, 0($sp) # Storing internal_60 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 120($sp) # internal_85 = result of function_assign + sw $v1, 144($sp) # internal_85 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - foreach_min_start_8744937325815: + foreach_min_start_8794484748198: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_82 - lw $t0, 132($sp) + lw $t0, 156($sp) sw $t0, 4($sp) # Storing internal_82 # Argument internal_58 - lw $t0, 228($sp) + lw $t0, 252($sp) sw $t0, 0($sp) # Storing internal_58 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 116($sp) # internal_86 = result of function_less_than + sw $v1, 140($sp) # internal_86 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_86 then goto foreach_min_body_8744937325815 - lw $t0, 104($sp) # Loading the address of the condition + # If internal_86 then goto foreach_min_body_8794484748198 + lw $t0, 128($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_min_body_8744937325815 + beq $t0, $t1, foreach_min_body_8794484748198 - # Jumping to foreach_min_end_8744937325815 - j foreach_min_end_8744937325815 + # Jumping to foreach_min_end_8794484748198 + j foreach_min_end_8794484748198 - foreach_min_body_8744937325815: + foreach_min_body_8794484748198: # internal_84 = array internal_68[4 * internal_82] - lw $t0, 120($sp) # $t0 = internal_82 + lw $t0, 144($sp) # $t0 = internal_82 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 176($sp) # $t1 = internal_68 + lw $t1, 200($sp) # $t1 = internal_68 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 112($sp) # internal_84 = array internal_68[4 * internal_82] + lw $t2, 136($sp) # internal_84 = array internal_68[4 * internal_82] sw $t0, 8($t2) # Passing function arguments @@ -3643,46 +3762,46 @@ sw $ra, 8($sp) # Storing return address # Argument internal_84 - lw $t0, 124($sp) + lw $t0, 148($sp) sw $t0, 4($sp) # Storing internal_84 # Argument internal_85 - lw $t0, 120($sp) + lw $t0, 144($sp) sw $t0, 0($sp) # Storing internal_85 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 116($sp) # internal_86 = result of function_less_than + sw $v1, 140($sp) # internal_86 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_86 then goto update_min_8744937325815 - lw $t0, 104($sp) # Loading the address of the condition + # If internal_86 then goto update_min_8794484748198 + lw $t0, 128($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, update_min_8744937325815 + beq $t0, $t1, update_min_8794484748198 - # Jumping to update_min_end_8744937325815 - j update_min_end_8744937325815 + # Jumping to update_min_end_8794484748198 + j update_min_end_8794484748198 - update_min_8744937325815: + update_min_8794484748198: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_85 - lw $t0, 120($sp) + lw $t0, 144($sp) sw $t0, 4($sp) # Storing internal_85 # Argument internal_84 - lw $t0, 124($sp) + lw $t0, 148($sp) sw $t0, 0($sp) # Storing internal_84 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 120($sp) # internal_85 = result of function_assign + sw $v1, 144($sp) # internal_85 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -3690,46 +3809,46 @@ sw $ra, 8($sp) # Storing return address # Argument internal_83 - lw $t0, 128($sp) + lw $t0, 152($sp) sw $t0, 4($sp) # Storing internal_83 # Argument internal_82 - lw $t0, 132($sp) + lw $t0, 156($sp) sw $t0, 0($sp) # Storing internal_82 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 128($sp) # internal_83 = result of function_assign + sw $v1, 152($sp) # internal_83 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - update_min_end_8744937325815: + update_min_end_8794484748198: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_82 - lw $t0, 132($sp) + lw $t0, 156($sp) sw $t0, 4($sp) # Storing internal_82 # Argument internal_57 - lw $t0, 232($sp) + lw $t0, 256($sp) sw $t0, 0($sp) # Storing internal_57 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 132($sp) # internal_82 = result of function_add + sw $v1, 156($sp) # internal_82 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_min_start_8744937325815 - j foreach_min_start_8744937325815 + # Jumping to foreach_min_start_8794484748198 + j foreach_min_start_8794484748198 - foreach_min_end_8744937325815: + foreach_min_end_8794484748198: # initialize Array [internal_58] - lw $t0, 216($sp) # $t0 = internal_58 + lw $t0, 240($sp) # $t0 = internal_58 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -3737,7 +3856,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 92($sp) # internal_89 = new Array[internal_58] + sw $v0, 124($sp) # internal_87 = new Array[internal_58] # Allocating Int 0 li $v0, 9 @@ -3749,17 +3868,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 88($sp) # internal_90 = address of allocated object Int + sw $v0, 120($sp) # internal_88 = address of allocated object Int - # array internal_89[4 * internal_90] = internal_56 - lw $t0, 88($sp) # $t0 = internal_90 + # array internal_87[4 * internal_88] = internal_56 + lw $t0, 120($sp) # $t0 = internal_88 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 92($sp) # $t1 = internal_89 + lw $t1, 124($sp) # $t1 = internal_87 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 224($sp) + lw $t0, 248($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -3773,17 +3892,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 84($sp) # internal_91 = address of allocated object Int + sw $v0, 116($sp) # internal_89 = address of allocated object Int - # array internal_89[4 * internal_91] = internal_56 - lw $t0, 84($sp) # $t0 = internal_91 + # array internal_87[4 * internal_89] = internal_56 + lw $t0, 116($sp) # $t0 = internal_89 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 92($sp) # $t1 = internal_89 + lw $t1, 124($sp) # $t1 = internal_87 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 224($sp) + lw $t0, 248($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -3797,17 +3916,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # internal_92 = address of allocated object Int + sw $v0, 112($sp) # internal_90 = address of allocated object Int - # array internal_89[4 * internal_92] = internal_56 - lw $t0, 80($sp) # $t0 = internal_92 + # array internal_87[4 * internal_90] = internal_56 + lw $t0, 112($sp) # $t0 = internal_90 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 92($sp) # $t1 = internal_89 + lw $t1, 124($sp) # $t1 = internal_87 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 224($sp) + lw $t0, 248($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -3821,41 +3940,41 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 76($sp) # internal_93 = address of allocated object Int + sw $v0, 108($sp) # internal_91 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_85 - lw $t0, 120($sp) + lw $t0, 144($sp) sw $t0, 4($sp) # Storing internal_85 # Argument internal_60 - lw $t0, 220($sp) + lw $t0, 244($sp) sw $t0, 0($sp) # Storing internal_60 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 88($sp) # internal_93 = result of function_equal + sw $v1, 120($sp) # internal_91 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # If internal_93 then goto error_branch_8744937325815 - lw $t0, 76($sp) # Loading the address of the condition + # If internal_91 then goto error_branch_8794484748198 + lw $t0, 108($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, error_branch_8744937325815 + beq $t0, $t1, error_branch_8794484748198 - # array internal_89[4 * internal_83] = internal_57 - lw $t0, 116($sp) # $t0 = internal_83 + # array internal_87[4 * internal_83] = internal_57 + lw $t0, 140($sp) # $t0 = internal_83 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 92($sp) # $t1 = internal_89 + lw $t1, 124($sp) # $t1 = internal_87 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 220($sp) + lw $t0, 244($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -3869,7 +3988,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 72($sp) # internal_94 = address of allocated object Int + sw $v0, 104($sp) # internal_92 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -3881,25 +4000,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 68($sp) # internal_95 = address of allocated object Int + sw $v0, 100($sp) # internal_93 = address of allocated object Int - # internal_94 = array internal_89[4 * internal_95] - lw $t0, 68($sp) # $t0 = internal_95 + # internal_92 = array internal_87[4 * internal_93] + lw $t0, 100($sp) # $t0 = internal_93 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 92($sp) # $t1 = internal_89 + lw $t1, 124($sp) # $t1 = internal_87 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 72($sp) # internal_94 = array internal_89[4 * internal_95] + lw $t2, 104($sp) # internal_92 = array internal_87[4 * internal_93] sw $t0, 8($t2) - # If internal_94 then goto branch_Razz_8744937325815 - lw $t0, 72($sp) # Loading the address of the condition + # If internal_92 then goto branch_Razz_8794484748198 + lw $t0, 104($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Razz_8744937325815 + beq $t0, $t1, branch_Razz_8794484748198 # Allocating Int 1 li $v0, 9 @@ -3911,25 +4030,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 64($sp) # internal_96 = address of allocated object Int + sw $v0, 96($sp) # internal_94 = address of allocated object Int - # internal_94 = array internal_89[4 * internal_96] - lw $t0, 64($sp) # $t0 = internal_96 + # internal_92 = array internal_87[4 * internal_94] + lw $t0, 96($sp) # $t0 = internal_94 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 92($sp) # $t1 = internal_89 + lw $t1, 124($sp) # $t1 = internal_87 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 72($sp) # internal_94 = array internal_89[4 * internal_96] + lw $t2, 104($sp) # internal_92 = array internal_87[4 * internal_94] sw $t0, 8($t2) - # If internal_94 then goto branch_Foo_8744937325815 - lw $t0, 72($sp) # Loading the address of the condition + # If internal_92 then goto branch_Foo_8794484748198 + lw $t0, 104($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Foo_8744937325815 + beq $t0, $t1, branch_Foo_8794484748198 # Allocating Int 2 li $v0, 9 @@ -3941,44 +4060,44 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_97 = address of allocated object Int + sw $v0, 92($sp) # internal_95 = address of allocated object Int - # internal_94 = array internal_89[4 * internal_97] - lw $t0, 60($sp) # $t0 = internal_97 + # internal_92 = array internal_87[4 * internal_95] + lw $t0, 92($sp) # $t0 = internal_95 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 92($sp) # $t1 = internal_89 + lw $t1, 124($sp) # $t1 = internal_87 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 72($sp) # internal_94 = array internal_89[4 * internal_97] + lw $t2, 104($sp) # internal_92 = array internal_87[4 * internal_95] sw $t0, 8($t2) - # If internal_94 then goto branch_Bar_8744937325815 - lw $t0, 72($sp) # Loading the address of the condition + # If internal_92 then goto branch_Bar_8794484748198 + lw $t0, 104($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Bar_8744937325815 + beq $t0, $t1, branch_Bar_8794484748198 - branch_Razz_8744937325815: + branch_Razz_8794484748198: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 268($sp) + lw $t0, 300($sp) sw $t0, 4($sp) # Storing n # Argument self - lw $t0, 464($sp) + lw $t0, 488($sp) sw $t0, 0($sp) # Storing self # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 268($sp) # n = result of function_assign + sw $v1, 300($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bar @@ -3988,65 +4107,65 @@ la $t0, type_Bar # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 48($sp) # internal_100 = address of allocated object Bar + sw $v0, 80($sp) # internal_98 = address of allocated object Bar # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_100 - lw $t0, 56($sp) - sw $t0, 0($sp) # Storing internal_100 + # Argument internal_98 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_98 # Calling function function___init___at_Bar jal function___init___at_Bar lw $ra, 4($sp) - sw $v1, 56($sp) # internal_100 = result of function___init___at_Bar + sw $v1, 88($sp) # internal_98 = result of function___init___at_Bar addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_98 - lw $t0, 68($sp) - sw $t0, 4($sp) # Storing internal_98 + # Argument internal_96 + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing internal_96 - # Argument internal_100 - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing internal_100 + # Argument internal_98 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_98 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 68($sp) # internal_98 = result of function_assign + sw $v1, 100($sp) # internal_96 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_98 = internal_100 - lw $t0, 48($sp) - sw $t0, 56($sp) + # internal_96 = internal_98 + lw $t0, 80($sp) + sw $t0, 88($sp) - # Jumping to branch_end_8744937325815 - j branch_end_8744937325815 + # Jumping to branch_end_8794484748198 + j branch_end_8794484748198 - branch_Foo_8744937325815: + branch_Foo_8794484748198: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 268($sp) + lw $t0, 300($sp) sw $t0, 4($sp) # Storing n # Argument self - lw $t0, 464($sp) + lw $t0, 488($sp) sw $t0, 0($sp) # Storing self # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 268($sp) # n = result of function_assign + sw $v1, 300($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Razz @@ -4056,110 +4175,110 @@ la $t0, type_Razz # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 40($sp) # internal_102 = address of allocated object Razz + sw $v0, 72($sp) # internal_100 = address of allocated object Razz # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_102 - lw $t0, 48($sp) - sw $t0, 0($sp) # Storing internal_102 + # Argument internal_100 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_100 # Calling function function___init___at_Razz jal function___init___at_Razz lw $ra, 4($sp) - sw $v1, 48($sp) # internal_102 = result of function___init___at_Razz + sw $v1, 80($sp) # internal_100 = result of function___init___at_Razz addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_98 - lw $t0, 68($sp) - sw $t0, 4($sp) # Storing internal_98 + # Argument internal_96 + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing internal_96 - # Argument internal_102 - lw $t0, 52($sp) - sw $t0, 0($sp) # Storing internal_102 + # Argument internal_100 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_100 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 68($sp) # internal_98 = result of function_assign + sw $v1, 100($sp) # internal_96 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_98 = internal_102 - lw $t0, 40($sp) - sw $t0, 56($sp) + # internal_96 = internal_100 + lw $t0, 72($sp) + sw $t0, 88($sp) - # Jumping to branch_end_8744937325815 - j branch_end_8744937325815 + # Jumping to branch_end_8794484748198 + j branch_end_8794484748198 - branch_Bar_8744937325815: + branch_Bar_8794484748198: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 268($sp) + lw $t0, 300($sp) sw $t0, 4($sp) # Storing n # Argument self - lw $t0, 464($sp) + lw $t0, 488($sp) sw $t0, 0($sp) # Storing self # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 268($sp) # n = result of function_assign + sw $v1, 300($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_98 - lw $t0, 68($sp) - sw $t0, 4($sp) # Storing internal_98 + # Argument internal_96 + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing internal_96 # Argument n - lw $t0, 268($sp) + lw $t0, 300($sp) sw $t0, 0($sp) # Storing n # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 68($sp) # internal_98 = result of function_assign + sw $v1, 100($sp) # internal_96 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_98 = n - lw $t0, 256($sp) - sw $t0, 56($sp) + # internal_96 = n + lw $t0, 288($sp) + sw $t0, 88($sp) - # Jumping to branch_end_8744937325815 - j branch_end_8744937325815 + # Jumping to branch_end_8794484748198 + j branch_end_8794484748198 - error_branch_8744937325815: + error_branch_8794484748198: - branch_end_8744937325815: + branch_end_8794484748198: # Set attribute a of self - lw $t0, 452($sp) # $t0 = self - lw $t1, 56($sp) # $t1 = internal_98 - beq $t1, $zero, object_set_attribute_8744937293460 + lw $t0, 476($sp) # $t0 = self + lw $t1, 88($sp) # $t1 = internal_96 + beq $t1, $zero, object_set_attribute_8794484666673 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937293460 + beq $t6, $t5, int_set_attribute_8794484666673 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937293460 - j object_set_attribute_8744937293460 - int_set_attribute_8744937293460: + beq $t6, $t5, bool_set_attribute_8794484666673 + j object_set_attribute_8794484666673 + int_set_attribute_8794484666673: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4167,9 +4286,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 20($t0) # self.a = internal_98 - j end_set_attribute_8744937293460 - bool_set_attribute_8744937293460: + sw $v0, 20($t0) # self.a = internal_96 + j end_set_attribute_8794484666673 + bool_set_attribute_8794484666673: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4177,25 +4296,25 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 20($t0) # self.a = internal_98 - j end_set_attribute_8744937293460 - object_set_attribute_8744937293460: - sw $t1, 20($t0) # self.a = internal_98 - end_set_attribute_8744937293460: + sw $v0, 20($t0) # self.a = internal_96 + j end_set_attribute_8794484666673 + object_set_attribute_8794484666673: + sw $t1, 20($t0) # self.a = internal_96 + end_set_attribute_8794484666673: # Get attribute a of self - lw $t0, 452($sp) # Get the address of self - lw $t1, 20($t0) # Get the attribute 'a' from the instance + lw $t0, 476($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'a' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8744937293593 + beq $t6, $t5, int_get_attribute_8794484637392 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8744937293593 - j object_get_attribute_8744937293593 - int_get_attribute_8744937293593: + beq $t6, $t5, bool_get_attribute_8794484637392 + j object_get_attribute_8794484637392 + int_get_attribute_8794484637392: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4203,9 +4322,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 32($sp) # internal_104 = self.a - j end_get_attribute_8744937293593 - bool_get_attribute_8744937293593: + sw $v0, 64($sp) # internal_102 = self.a + j end_get_attribute_8794484637392 + bool_get_attribute_8794484637392: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4213,39 +4332,63 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 32($sp) # internal_104 = self.a - j end_get_attribute_8744937293593 - object_get_attribute_8744937293593: - sw $t1, 32($sp) # internal_104 = a - end_get_attribute_8744937293593: + sw $v0, 64($sp) # internal_102 = self.a + j end_get_attribute_8794484637392 + object_get_attribute_8794484637392: + sw $t1, 64($sp) # internal_102 = self.a + end_get_attribute_8794484637392: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_104 = address of allocated object Int + + # Get method doh of Razz + lw $t0, 64($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 56($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 52($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_104 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_104 + # Argument internal_102 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_102 - # Calling function function_doh_at_Foo - jal function_doh_at_Foo + # Calling function internal_105 + lw $t0, 60($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 36($sp) # internal_105 = result of function_doh_at_Foo + sw $v1, 68($sp) # internal_103 = result of internal_105 addi $sp, $sp, 8 # Freeing space for arguments # Get attribute g of self - lw $t0, 452($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'g' from the instance + lw $t0, 476($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'g' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8744937293623 + beq $t6, $t5, int_get_attribute_8794484637706 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8744937293623 - j object_get_attribute_8744937293623 - int_get_attribute_8744937293623: + beq $t6, $t5, bool_get_attribute_8794484637706 + j object_get_attribute_8794484637706 + int_get_attribute_8794484637706: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4253,9 +4396,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 24($sp) # internal_106 = self.g - j end_get_attribute_8744937293623 - bool_get_attribute_8744937293623: + sw $v0, 48($sp) # internal_106 = self.g + j end_get_attribute_8794484637706 + bool_get_attribute_8794484637706: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4263,122 +4406,194 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 24($sp) # internal_106 = self.g - j end_get_attribute_8744937293623 - object_get_attribute_8744937293623: - sw $t1, 24($sp) # internal_106 = g - end_get_attribute_8744937293623: + sw $v0, 48($sp) # internal_106 = self.g + j end_get_attribute_8794484637706 + object_get_attribute_8794484637706: + sw $t1, 48($sp) # internal_106 = self.g + end_get_attribute_8794484637706: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_108 = address of allocated object Int + + # Get method doh of Foo + lw $t0, 48($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 40($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 36($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_106 - lw $t0, 32($sp) + lw $t0, 56($sp) sw $t0, 0($sp) # Storing internal_106 - # Calling function function_doh_at_Foo - jal function_doh_at_Foo + # Calling function internal_109 + lw $t0, 44($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 28($sp) # internal_107 = result of function_doh_at_Foo + sw $v1, 52($sp) # internal_107 = result of internal_109 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_105 - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing internal_105 + # Argument internal_103 + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing internal_103 # Argument internal_107 - lw $t0, 32($sp) + lw $t0, 56($sp) sw $t0, 0($sp) # Storing internal_107 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 28($sp) # internal_108 = result of function_add + sw $v1, 44($sp) # internal_110 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_112 = address of allocated object Int + + # Get method doh of Foo + lw $t0, 476($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 24($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 20($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 460($sp) + lw $t0, 484($sp) sw $t0, 0($sp) # Storing self - # Calling function function_doh_at_Foo - jal function_doh_at_Foo + # Calling function internal_113 + lw $t0, 28($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 20($sp) # internal_109 = result of function_doh_at_Foo + sw $v1, 36($sp) # internal_111 = result of internal_113 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_108 - lw $t0, 28($sp) - sw $t0, 4($sp) # Storing internal_108 + # Argument internal_110 + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing internal_110 - # Argument internal_109 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_109 + # Argument internal_111 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_111 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 20($sp) # internal_110 = result of function_add + sw $v1, 28($sp) # internal_114 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_116 = address of allocated object Int + + # Get method printh of Foo + lw $t0, 476($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 460($sp) + lw $t0, 484($sp) sw $t0, 0($sp) # Storing self - # Calling function function_printh_at_Bazz - jal function_printh_at_Bazz + # Calling function internal_117 + lw $t0, 12($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 12($sp) # internal_111 = result of function_printh_at_Bazz + sw $v1, 20($sp) # internal_115 = result of internal_117 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_110 - lw $t0, 20($sp) - sw $t0, 4($sp) # Storing internal_110 + # Argument internal_114 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_114 - # Argument internal_111 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_111 + # Argument internal_115 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_115 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 12($sp) # internal_112 = result of function_add + sw $v1, 12($sp) # internal_118 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Set attribute b of self - lw $t0, 452($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_112 - beq $t1, $zero, object_set_attribute_8744937263321 + lw $t0, 476($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_118 + beq $t1, $zero, object_set_attribute_8794484637332 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937263321 + beq $t6, $t5, int_set_attribute_8794484637332 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937263321 - j object_set_attribute_8744937263321 - int_set_attribute_8744937263321: + beq $t6, $t5, bool_set_attribute_8794484637332 + j object_set_attribute_8794484637332 + int_set_attribute_8794484637332: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4386,9 +4601,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 24($t0) # self.b = internal_112 - j end_set_attribute_8744937263321 - bool_set_attribute_8744937263321: + sw $v0, 24($t0) # self.b = internal_118 + j end_set_attribute_8794484637332 + bool_set_attribute_8794484637332: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4396,17 +4611,17 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 24($t0) # self.b = internal_112 - j end_set_attribute_8744937263321 - object_set_attribute_8744937263321: - sw $t1, 24($t0) # self.b = internal_112 - end_set_attribute_8744937263321: + sw $v0, 24($t0) # self.b = internal_118 + j end_set_attribute_8794484637332 + object_set_attribute_8794484637332: + sw $t1, 24($t0) # self.b = internal_118 + end_set_attribute_8794484637332: # Loading return value in $v1 - lw $v1, 452($sp) + lw $v1, 476($sp) # Freeing space for local variables - addi $sp, $sp, 452 + addi $sp, $sp, 476 jr $ra @@ -4420,17 +4635,17 @@ # Get attribute h of self lw $t0, 20($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'h' from the instance + lw $t1, 8($t0) # Get the attribute 'h' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8744937293752 + beq $t6, $t5, int_get_attribute_8794484637907 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8744937293752 - j object_get_attribute_8744937293752 - int_get_attribute_8744937293752: + beq $t6, $t5, bool_get_attribute_8794484637907 + j object_get_attribute_8794484637907 + int_get_attribute_8794484637907: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4439,8 +4654,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($sp) # internal_1 = self.h - j end_get_attribute_8744937293752 - bool_get_attribute_8744937293752: + j end_get_attribute_8794484637907 + bool_get_attribute_8794484637907: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4449,10 +4664,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($sp) # internal_1 = self.h - j end_get_attribute_8744937293752 - object_get_attribute_8744937293752: - sw $t1, 12($sp) # internal_1 = h - end_get_attribute_8744937293752: + j end_get_attribute_8794484637907 + object_get_attribute_8794484637907: + sw $t1, 12($sp) # internal_1 = self.h + end_get_attribute_8794484637907: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -4474,17 +4689,17 @@ # Get attribute h of self lw $t0, 20($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'h' from the instance + lw $t1, 8($t0) # Get the attribute 'h' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8744937293818 + beq $t6, $t5, int_get_attribute_8794484638233 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8744937293818 - j object_get_attribute_8744937293818 - int_get_attribute_8744937293818: + beq $t6, $t5, bool_get_attribute_8794484638233 + j object_get_attribute_8794484638233 + int_get_attribute_8794484638233: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4493,8 +4708,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($sp) # internal_2 = self.h - j end_get_attribute_8744937293818 - bool_get_attribute_8744937293818: + j end_get_attribute_8794484638233 + bool_get_attribute_8794484638233: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4503,10 +4718,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($sp) # internal_2 = self.h - j end_get_attribute_8744937293818 - object_get_attribute_8744937293818: - sw $t1, 8($sp) # internal_2 = h - end_get_attribute_8744937293818: + j end_get_attribute_8794484638233 + object_get_attribute_8794484638233: + sw $t1, 8($sp) # internal_2 = self.h + end_get_attribute_8794484638233: # Allocating Int 2 li $v0, 9 @@ -4541,17 +4756,17 @@ # Set attribute h of self lw $t0, 20($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_4 - beq $t1, $zero, object_set_attribute_8744937293794 + beq $t1, $zero, object_set_attribute_8794484637946 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937293794 + beq $t6, $t5, int_set_attribute_8794484637946 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937293794 - j object_set_attribute_8744937293794 - int_set_attribute_8744937293794: + beq $t6, $t5, bool_set_attribute_8794484637946 + j object_set_attribute_8794484637946 + int_set_attribute_8794484637946: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4560,8 +4775,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.h = internal_4 - j end_set_attribute_8744937293794 - bool_set_attribute_8744937293794: + j end_set_attribute_8794484637946 + bool_set_attribute_8794484637946: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4570,10 +4785,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.h = internal_4 - j end_set_attribute_8744937293794 - object_set_attribute_8744937293794: + j end_set_attribute_8794484637946 + object_set_attribute_8794484637946: sw $t1, 8($t0) # self.h = internal_4 - end_set_attribute_8744937293794: + end_set_attribute_8794484637946: # Loading return value in $v1 lw $v1, 16($sp) @@ -4585,11 +4800,11 @@ function___init___at_Bar: # Function parameters - # $ra = 680($sp) - # self = 676($sp) + # $ra = 752($sp) + # self = 748($sp) # Reserving space for local variables - addi $sp, $sp, -676 + addi $sp, $sp, -748 # Allocating Int 1 li $v0, 9 @@ -4601,22 +4816,22 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 672($sp) # internal_0 = address of allocated object Int + sw $v0, 744($sp) # internal_0 = address of allocated object Int # Set attribute h of self - lw $t0, 676($sp) # $t0 = self - lw $t1, 672($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8744937263918 + lw $t0, 748($sp) # $t0 = self + lw $t1, 744($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8794484638281 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937263918 + beq $t6, $t5, int_set_attribute_8794484638281 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937263918 - j object_set_attribute_8744937263918 - int_set_attribute_8744937263918: + beq $t6, $t5, bool_set_attribute_8794484638281 + j object_set_attribute_8794484638281 + int_set_attribute_8794484638281: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4625,8 +4840,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.h = internal_0 - j end_set_attribute_8744937263918 - bool_set_attribute_8744937263918: + j end_set_attribute_8794484638281 + bool_set_attribute_8794484638281: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4635,10 +4850,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.h = internal_0 - j end_set_attribute_8744937263918 - object_set_attribute_8744937263918: + j end_set_attribute_8794484638281 + object_set_attribute_8794484638281: sw $t1, 8($t0) # self.h = internal_0 - end_set_attribute_8744937263918: + end_set_attribute_8794484638281: # Allocating Int 0 li $v0, 9 @@ -4650,7 +4865,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 668($sp) # internal_1 = address of allocated object Int + sw $v0, 740($sp) # internal_1 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -4662,7 +4877,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 664($sp) # internal_2 = address of allocated object Int + sw $v0, 736($sp) # internal_2 = address of allocated object Int # Allocating Int 4 li $v0, 9 @@ -4674,10 +4889,10 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 660($sp) # internal_3 = address of allocated object Int + sw $v0, 732($sp) # internal_3 = address of allocated object Int # Allocating NUll to internal_4 - sw $zero, 656($sp) # internal_4 = 0 + sw $zero, 728($sp) # internal_4 = 0 # Allocating Int 0 li $v0, 9 @@ -4689,7 +4904,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 652($sp) # internal_5 = address of allocated object Int + sw $v0, 724($sp) # internal_5 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -4701,66 +4916,66 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 640($sp) # internal_8 = address of allocated object Int + sw $v0, 712($sp) # internal_8 = address of allocated object Int # internal_6 = typeof self that is the first word of the object - lw $t0, 676($sp) + lw $t0, 748($sp) lw $t0, 0($t0) - sw $t0, 648($sp) + sw $t0, 720($sp) # internal_7 = internal_6 - lw $t0, 648($sp) - sw $t0, 644($sp) + lw $t0, 720($sp) + sw $t0, 716($sp) - while_start_8744937301489: + while_start_8794484723258: # internal_8 = EqualAddress(internal_7, internal_4) - lw $t0, 644($sp) - lw $t1, 656($sp) + lw $t0, 716($sp) + lw $t1, 728($sp) seq $t2, $t0, $t1 - lw $t0, 640($sp) + lw $t0, 712($sp) sw $t2, 8($t0) - # If internal_8 then goto while_end_8744937301489 - lw $t0, 640($sp) # Loading the address of the condition + # If internal_8 then goto while_end_8794484723258 + lw $t0, 712($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_end_8744937301489 + beq $t0, $t1, while_end_8794484723258 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_5 - lw $t0, 664($sp) + lw $t0, 736($sp) sw $t0, 4($sp) # Storing internal_5 # Argument internal_2 - lw $t0, 676($sp) + lw $t0, 748($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 664($sp) # internal_5 = result of function_add + sw $v1, 736($sp) # internal_5 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # internal_7 = ancestor of internal_7 - lw $t0, 644($sp) + lw $t0, 716($sp) lw $t0, 4($t0) - sw $t0, 644($sp) + sw $t0, 716($sp) - # Jumping to while_start_8744937301489 - j while_start_8744937301489 + # Jumping to while_start_8794484723258 + j while_start_8794484723258 - while_end_8744937301489: + while_end_8794484723258: # internal_7 = internal_6 - lw $t0, 648($sp) - sw $t0, 644($sp) + lw $t0, 720($sp) + sw $t0, 716($sp) # initialize Array [internal_5] - lw $t0, 652($sp) # $t0 = internal_5 + lw $t0, 724($sp) # $t0 = internal_5 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -4768,7 +4983,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 636($sp) # internal_9 = new Array[internal_5] + sw $v0, 708($sp) # internal_9 = new Array[internal_5] # Allocating Int 0 li $v0, 9 @@ -4780,7 +4995,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 632($sp) # internal_10 = address of allocated object Int + sw $v0, 704($sp) # internal_10 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -4792,80 +5007,80 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 628($sp) # internal_11 = address of allocated object Int + sw $v0, 700($sp) # internal_11 = address of allocated object Int - foreach_start_8744937301489: + foreach_start_8794484723258: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_10 - lw $t0, 644($sp) + lw $t0, 716($sp) sw $t0, 4($sp) # Storing internal_10 # Argument internal_5 - lw $t0, 664($sp) + lw $t0, 736($sp) sw $t0, 0($sp) # Storing internal_5 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 640($sp) # internal_11 = result of function_less_than + sw $v1, 712($sp) # internal_11 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_11 then goto foreach_body_8744937301489 - lw $t0, 628($sp) # Loading the address of the condition + # If internal_11 then goto foreach_body_8794484723258 + lw $t0, 700($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_body_8744937301489 + beq $t0, $t1, foreach_body_8794484723258 - # Jumping to foreach_end_8744937301489 - j foreach_end_8744937301489 + # Jumping to foreach_end_8794484723258 + j foreach_end_8794484723258 - foreach_body_8744937301489: + foreach_body_8794484723258: # array internal_9[4 * internal_10] = internal_7 - lw $t0, 632($sp) # $t0 = internal_10 + lw $t0, 704($sp) # $t0 = internal_10 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 636($sp) # $t1 = internal_9 + lw $t1, 708($sp) # $t1 = internal_9 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 644($sp) + lw $t0, 716($sp) sw $t0, 0($t1) # internal_7 = ancestor of internal_7 - lw $t0, 644($sp) + lw $t0, 716($sp) lw $t0, 4($t0) - sw $t0, 644($sp) + sw $t0, 716($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_10 - lw $t0, 644($sp) + lw $t0, 716($sp) sw $t0, 4($sp) # Storing internal_10 # Argument internal_2 - lw $t0, 676($sp) + lw $t0, 748($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 644($sp) # internal_10 = result of function_add + sw $v1, 716($sp) # internal_10 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_start_8744937301489 - j foreach_start_8744937301489 + # Jumping to foreach_start_8794484723258 + j foreach_start_8794484723258 - foreach_end_8744937301489: + foreach_end_8794484723258: # initialize Array [internal_3] - lw $t0, 660($sp) # $t0 = internal_3 + lw $t0, 732($sp) # $t0 = internal_3 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -4873,10 +5088,10 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 624($sp) # internal_12 = new Array[internal_3] + sw $v0, 696($sp) # internal_12 = new Array[internal_3] # initialize Array [internal_3] - lw $t0, 660($sp) # $t0 = internal_3 + lw $t0, 732($sp) # $t0 = internal_3 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -4884,7 +5099,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 620($sp) # internal_13 = new Array[internal_3] + sw $v0, 692($sp) # internal_13 = new Array[internal_3] # Allocating Int 0 li $v0, 9 @@ -4896,32 +5111,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 612($sp) # internal_15 = address of allocated object Int + sw $v0, 684($sp) # internal_15 = address of allocated object Int # internal_14 = direction of Bazz la $t0, type_Bazz - sw $t0, 616($sp) + sw $t0, 688($sp) # array internal_12[4 * internal_15] = internal_14 - lw $t0, 612($sp) # $t0 = internal_15 + lw $t0, 684($sp) # $t0 = internal_15 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 624($sp) # $t1 = internal_12 + lw $t1, 696($sp) # $t1 = internal_12 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 616($sp) + lw $t0, 688($sp) sw $t0, 0($t1) # array internal_13[4 * internal_15] = internal_5 - lw $t0, 612($sp) # $t0 = internal_15 + lw $t0, 684($sp) # $t0 = internal_15 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 620($sp) # $t1 = internal_13 + lw $t1, 692($sp) # $t1 = internal_13 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 652($sp) + lw $t0, 724($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -4935,32 +5150,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 604($sp) # internal_17 = address of allocated object Int + sw $v0, 676($sp) # internal_17 = address of allocated object Int # internal_16 = direction of Razz la $t0, type_Razz - sw $t0, 608($sp) + sw $t0, 680($sp) # array internal_12[4 * internal_17] = internal_16 - lw $t0, 604($sp) # $t0 = internal_17 + lw $t0, 676($sp) # $t0 = internal_17 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 624($sp) # $t1 = internal_12 + lw $t1, 696($sp) # $t1 = internal_12 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 608($sp) + lw $t0, 680($sp) sw $t0, 0($t1) # array internal_13[4 * internal_17] = internal_5 - lw $t0, 604($sp) # $t0 = internal_17 + lw $t0, 676($sp) # $t0 = internal_17 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 620($sp) # $t1 = internal_13 + lw $t1, 692($sp) # $t1 = internal_13 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 652($sp) + lw $t0, 724($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -4974,32 +5189,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 596($sp) # internal_19 = address of allocated object Int + sw $v0, 668($sp) # internal_19 = address of allocated object Int # internal_18 = direction of Foo la $t0, type_Foo - sw $t0, 600($sp) + sw $t0, 672($sp) # array internal_12[4 * internal_19] = internal_18 - lw $t0, 596($sp) # $t0 = internal_19 + lw $t0, 668($sp) # $t0 = internal_19 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 624($sp) # $t1 = internal_12 + lw $t1, 696($sp) # $t1 = internal_12 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 600($sp) + lw $t0, 672($sp) sw $t0, 0($t1) # array internal_13[4 * internal_19] = internal_5 - lw $t0, 596($sp) # $t0 = internal_19 + lw $t0, 668($sp) # $t0 = internal_19 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 620($sp) # $t1 = internal_13 + lw $t1, 692($sp) # $t1 = internal_13 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 652($sp) + lw $t0, 724($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -5013,32 +5228,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 588($sp) # internal_21 = address of allocated object Int + sw $v0, 660($sp) # internal_21 = address of allocated object Int # internal_20 = direction of Bar la $t0, type_Bar - sw $t0, 592($sp) + sw $t0, 664($sp) # array internal_12[4 * internal_21] = internal_20 - lw $t0, 588($sp) # $t0 = internal_21 + lw $t0, 660($sp) # $t0 = internal_21 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 624($sp) # $t1 = internal_12 + lw $t1, 696($sp) # $t1 = internal_12 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 592($sp) + lw $t0, 664($sp) sw $t0, 0($t1) # array internal_13[4 * internal_21] = internal_5 - lw $t0, 588($sp) # $t0 = internal_21 + lw $t0, 660($sp) # $t0 = internal_21 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 620($sp) # $t1 = internal_13 + lw $t1, 692($sp) # $t1 = internal_13 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 652($sp) + lw $t0, 724($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -5052,7 +5267,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 584($sp) # internal_22 = address of allocated object Int + sw $v0, 656($sp) # internal_22 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -5064,7 +5279,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 580($sp) # internal_23 = address of allocated object Int + sw $v0, 652($sp) # internal_23 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -5076,7 +5291,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 572($sp) # internal_25 = address of allocated object Int + sw $v0, 644($sp) # internal_25 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -5088,7 +5303,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 568($sp) # internal_26 = address of allocated object Int + sw $v0, 640($sp) # internal_26 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -5100,155 +5315,155 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 560($sp) # internal_28 = address of allocated object Int + sw $v0, 632($sp) # internal_28 = address of allocated object Int - foreach_type_start_8744937301489: + foreach_type_start_8794484723258: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_22 - lw $t0, 596($sp) + lw $t0, 668($sp) sw $t0, 4($sp) # Storing internal_22 # Argument internal_3 - lw $t0, 672($sp) + lw $t0, 744($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 592($sp) # internal_23 = result of function_less_than + sw $v1, 664($sp) # internal_23 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_23 then goto foreach_type_body_8744937301489 - lw $t0, 580($sp) # Loading the address of the condition + # If internal_23 then goto foreach_type_body_8794484723258 + lw $t0, 652($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_type_body_8744937301489 + beq $t0, $t1, foreach_type_body_8794484723258 - # Jumping to foreach_type_end_8744937301489 - j foreach_type_end_8744937301489 + # Jumping to foreach_type_end_8794484723258 + j foreach_type_end_8794484723258 - foreach_type_body_8744937301489: + foreach_type_body_8794484723258: # internal_24 = array internal_12[4 * internal_22] - lw $t0, 584($sp) # $t0 = internal_22 + lw $t0, 656($sp) # $t0 = internal_22 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 624($sp) # $t1 = internal_12 + lw $t1, 696($sp) # $t1 = internal_12 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - sw $t0, 576($sp) # internal_24 = array internal_12[4 * internal_22] + sw $t0, 648($sp) # internal_24 = array internal_12[4 * internal_22] # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_25 - lw $t0, 584($sp) + lw $t0, 656($sp) sw $t0, 4($sp) # Storing internal_25 # Argument internal_1 - lw $t0, 680($sp) + lw $t0, 752($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 584($sp) # internal_25 = result of function_assign + sw $v1, 656($sp) # internal_25 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - foreach_ancestor_start_8744937301489: + foreach_ancestor_start_8794484723258: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_25 - lw $t0, 584($sp) + lw $t0, 656($sp) sw $t0, 4($sp) # Storing internal_25 # Argument internal_5 - lw $t0, 664($sp) + lw $t0, 736($sp) sw $t0, 0($sp) # Storing internal_5 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 580($sp) # internal_26 = result of function_less_than + sw $v1, 652($sp) # internal_26 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_26 then goto foreach_ancestor_body_8744937301489 - lw $t0, 568($sp) # Loading the address of the condition + # If internal_26 then goto foreach_ancestor_body_8794484723258 + lw $t0, 640($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_body_8744937301489 + beq $t0, $t1, foreach_ancestor_body_8794484723258 - # Jumping to foreach_ancestor_end_8744937301489 - j foreach_ancestor_end_8744937301489 + # Jumping to foreach_ancestor_end_8794484723258 + j foreach_ancestor_end_8794484723258 - foreach_ancestor_body_8744937301489: + foreach_ancestor_body_8794484723258: # internal_27 = array internal_9[4 * internal_25] - lw $t0, 572($sp) # $t0 = internal_25 + lw $t0, 644($sp) # $t0 = internal_25 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 636($sp) # $t1 = internal_9 + lw $t1, 708($sp) # $t1 = internal_9 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - sw $t0, 564($sp) # internal_27 = array internal_9[4 * internal_25] + sw $t0, 636($sp) # internal_27 = array internal_9[4 * internal_25] # internal_28 = EqualAddress(internal_24, internal_27) - lw $t0, 576($sp) - lw $t1, 564($sp) + lw $t0, 648($sp) + lw $t1, 636($sp) seq $t2, $t0, $t1 - lw $t0, 560($sp) + lw $t0, 632($sp) sw $t2, 8($t0) - # If internal_28 then goto foreach_ancestor_end_8744937301489 - lw $t0, 560($sp) # Loading the address of the condition + # If internal_28 then goto foreach_ancestor_end_8794484723258 + lw $t0, 632($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_end_8744937301489 + beq $t0, $t1, foreach_ancestor_end_8794484723258 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_25 - lw $t0, 584($sp) + lw $t0, 656($sp) sw $t0, 4($sp) # Storing internal_25 # Argument internal_2 - lw $t0, 676($sp) + lw $t0, 748($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 584($sp) # internal_25 = result of function_add + sw $v1, 656($sp) # internal_25 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_ancestor_start_8744937301489 - j foreach_ancestor_start_8744937301489 + # Jumping to foreach_ancestor_start_8794484723258 + j foreach_ancestor_start_8794484723258 - foreach_ancestor_end_8744937301489: + foreach_ancestor_end_8794484723258: # array internal_13[4 * internal_22] = internal_25 - lw $t0, 584($sp) # $t0 = internal_22 + lw $t0, 656($sp) # $t0 = internal_22 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 620($sp) # $t1 = internal_13 + lw $t1, 692($sp) # $t1 = internal_13 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 572($sp) + lw $t0, 644($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -5257,59 +5472,23 @@ sw $ra, 8($sp) # Storing return address # Argument internal_22 - lw $t0, 596($sp) + lw $t0, 668($sp) sw $t0, 4($sp) # Storing internal_22 # Argument internal_2 - lw $t0, 676($sp) + lw $t0, 748($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 596($sp) # internal_22 = result of function_add + sw $v1, 668($sp) # internal_22 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_type_start_8744937301489 - j foreach_type_start_8744937301489 - - foreach_type_end_8744937301489: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_34[0] = '\n' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 536($sp) # internal_34 = "\n" - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_35[0] = ' ' - - sb $zero, 9($v0) # Null-terminator at the end of the string + # Jumping to foreach_type_start_8794484723258 + j foreach_type_start_8794484723258 - sw $v0, 532($sp) # internal_35 = " " + foreach_type_end_8794484723258: # Allocating Int 0 li $v0, 9 @@ -5321,7 +5500,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 556($sp) # internal_29 = address of allocated object Int + sw $v0, 628($sp) # internal_29 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -5333,7 +5512,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 552($sp) # internal_30 = address of allocated object Int + sw $v0, 624($sp) # internal_30 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -5345,7 +5524,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 548($sp) # internal_31 = address of allocated object Int + sw $v0, 620($sp) # internal_31 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -5357,7 +5536,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 544($sp) # internal_32 = address of allocated object Int + sw $v0, 616($sp) # internal_32 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -5369,67 +5548,67 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 540($sp) # internal_33 = address of allocated object Int + sw $v0, 612($sp) # internal_33 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_32 - lw $t0, 556($sp) + lw $t0, 628($sp) sw $t0, 4($sp) # Storing internal_32 # Argument internal_5 - lw $t0, 664($sp) + lw $t0, 736($sp) sw $t0, 0($sp) # Storing internal_5 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 556($sp) # internal_32 = result of function_assign + sw $v1, 628($sp) # internal_32 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - foreach_min_start_8744937301489: + foreach_min_start_8794484723258: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_29 - lw $t0, 568($sp) + lw $t0, 640($sp) sw $t0, 4($sp) # Storing internal_29 # Argument internal_3 - lw $t0, 672($sp) + lw $t0, 744($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 552($sp) # internal_33 = result of function_less_than + sw $v1, 624($sp) # internal_33 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_33 then goto foreach_min_body_8744937301489 - lw $t0, 540($sp) # Loading the address of the condition + # If internal_33 then goto foreach_min_body_8794484723258 + lw $t0, 612($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_min_body_8744937301489 + beq $t0, $t1, foreach_min_body_8794484723258 - # Jumping to foreach_min_end_8744937301489 - j foreach_min_end_8744937301489 + # Jumping to foreach_min_end_8794484723258 + j foreach_min_end_8794484723258 - foreach_min_body_8744937301489: + foreach_min_body_8794484723258: # internal_31 = array internal_13[4 * internal_29] - lw $t0, 556($sp) # $t0 = internal_29 + lw $t0, 628($sp) # $t0 = internal_29 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 620($sp) # $t1 = internal_13 + lw $t1, 692($sp) # $t1 = internal_13 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 548($sp) # internal_31 = array internal_13[4 * internal_29] + lw $t2, 620($sp) # internal_31 = array internal_13[4 * internal_29] sw $t0, 8($t2) # Passing function arguments @@ -5437,46 +5616,46 @@ sw $ra, 8($sp) # Storing return address # Argument internal_31 - lw $t0, 560($sp) + lw $t0, 632($sp) sw $t0, 4($sp) # Storing internal_31 # Argument internal_32 - lw $t0, 556($sp) + lw $t0, 628($sp) sw $t0, 0($sp) # Storing internal_32 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 552($sp) # internal_33 = result of function_less_than + sw $v1, 624($sp) # internal_33 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_33 then goto update_min_8744937301489 - lw $t0, 540($sp) # Loading the address of the condition + # If internal_33 then goto update_min_8794484723258 + lw $t0, 612($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, update_min_8744937301489 + beq $t0, $t1, update_min_8794484723258 - # Jumping to update_min_end_8744937301489 - j update_min_end_8744937301489 + # Jumping to update_min_end_8794484723258 + j update_min_end_8794484723258 - update_min_8744937301489: + update_min_8794484723258: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_32 - lw $t0, 556($sp) + lw $t0, 628($sp) sw $t0, 4($sp) # Storing internal_32 # Argument internal_31 - lw $t0, 560($sp) + lw $t0, 632($sp) sw $t0, 0($sp) # Storing internal_31 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 556($sp) # internal_32 = result of function_assign + sw $v1, 628($sp) # internal_32 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -5484,46 +5663,46 @@ sw $ra, 8($sp) # Storing return address # Argument internal_30 - lw $t0, 564($sp) + lw $t0, 636($sp) sw $t0, 4($sp) # Storing internal_30 # Argument internal_29 - lw $t0, 568($sp) + lw $t0, 640($sp) sw $t0, 0($sp) # Storing internal_29 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 564($sp) # internal_30 = result of function_assign + sw $v1, 636($sp) # internal_30 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - update_min_end_8744937301489: + update_min_end_8794484723258: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_29 - lw $t0, 568($sp) + lw $t0, 640($sp) sw $t0, 4($sp) # Storing internal_29 # Argument internal_2 - lw $t0, 676($sp) + lw $t0, 748($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 568($sp) # internal_29 = result of function_add + sw $v1, 640($sp) # internal_29 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_min_start_8744937301489 - j foreach_min_start_8744937301489 + # Jumping to foreach_min_start_8794484723258 + j foreach_min_start_8794484723258 - foreach_min_end_8744937301489: + foreach_min_end_8794484723258: # initialize Array [internal_3] - lw $t0, 660($sp) # $t0 = internal_3 + lw $t0, 732($sp) # $t0 = internal_3 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -5531,7 +5710,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 528($sp) # internal_36 = new Array[internal_3] + sw $v0, 608($sp) # internal_34 = new Array[internal_3] # Allocating Int 0 li $v0, 9 @@ -5543,17 +5722,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 524($sp) # internal_37 = address of allocated object Int + sw $v0, 604($sp) # internal_35 = address of allocated object Int - # array internal_36[4 * internal_37] = internal_1 - lw $t0, 524($sp) # $t0 = internal_37 + # array internal_34[4 * internal_35] = internal_1 + lw $t0, 604($sp) # $t0 = internal_35 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 528($sp) # $t1 = internal_36 + lw $t1, 608($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 668($sp) + lw $t0, 740($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -5567,17 +5746,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 520($sp) # internal_38 = address of allocated object Int + sw $v0, 600($sp) # internal_36 = address of allocated object Int - # array internal_36[4 * internal_38] = internal_1 - lw $t0, 520($sp) # $t0 = internal_38 + # array internal_34[4 * internal_36] = internal_1 + lw $t0, 600($sp) # $t0 = internal_36 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 528($sp) # $t1 = internal_36 + lw $t1, 608($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 668($sp) + lw $t0, 740($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -5591,17 +5770,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 516($sp) # internal_39 = address of allocated object Int + sw $v0, 596($sp) # internal_37 = address of allocated object Int - # array internal_36[4 * internal_39] = internal_1 - lw $t0, 516($sp) # $t0 = internal_39 + # array internal_34[4 * internal_37] = internal_1 + lw $t0, 596($sp) # $t0 = internal_37 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 528($sp) # $t1 = internal_36 + lw $t1, 608($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 668($sp) + lw $t0, 740($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -5615,17 +5794,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 512($sp) # internal_40 = address of allocated object Int + sw $v0, 592($sp) # internal_38 = address of allocated object Int - # array internal_36[4 * internal_40] = internal_1 - lw $t0, 512($sp) # $t0 = internal_40 + # array internal_34[4 * internal_38] = internal_1 + lw $t0, 592($sp) # $t0 = internal_38 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 528($sp) # $t1 = internal_36 + lw $t1, 608($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 668($sp) + lw $t0, 740($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -5639,41 +5818,41 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 508($sp) # internal_41 = address of allocated object Int + sw $v0, 588($sp) # internal_39 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_32 - lw $t0, 556($sp) + lw $t0, 628($sp) sw $t0, 4($sp) # Storing internal_32 # Argument internal_5 - lw $t0, 664($sp) + lw $t0, 736($sp) sw $t0, 0($sp) # Storing internal_5 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 520($sp) # internal_41 = result of function_equal + sw $v1, 600($sp) # internal_39 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # If internal_41 then goto error_branch_8744937301489 - lw $t0, 508($sp) # Loading the address of the condition + # If internal_39 then goto error_branch_8794484723258 + lw $t0, 588($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, error_branch_8744937301489 + beq $t0, $t1, error_branch_8794484723258 - # array internal_36[4 * internal_30] = internal_2 - lw $t0, 552($sp) # $t0 = internal_30 + # array internal_34[4 * internal_30] = internal_2 + lw $t0, 624($sp) # $t0 = internal_30 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 528($sp) # $t1 = internal_36 + lw $t1, 608($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 664($sp) + lw $t0, 736($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -5687,7 +5866,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 504($sp) # internal_42 = address of allocated object Int + sw $v0, 584($sp) # internal_40 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -5699,25 +5878,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 500($sp) # internal_43 = address of allocated object Int + sw $v0, 580($sp) # internal_41 = address of allocated object Int - # internal_42 = array internal_36[4 * internal_43] - lw $t0, 500($sp) # $t0 = internal_43 + # internal_40 = array internal_34[4 * internal_41] + lw $t0, 580($sp) # $t0 = internal_41 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 528($sp) # $t1 = internal_36 + lw $t1, 608($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 504($sp) # internal_42 = array internal_36[4 * internal_43] + lw $t2, 584($sp) # internal_40 = array internal_34[4 * internal_41] sw $t0, 8($t2) - # If internal_42 then goto branch_Bazz_8744937301489 - lw $t0, 504($sp) # Loading the address of the condition + # If internal_40 then goto branch_Bazz_8794484723258 + lw $t0, 584($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Bazz_8744937301489 + beq $t0, $t1, branch_Bazz_8794484723258 # Allocating Int 1 li $v0, 9 @@ -5729,25 +5908,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 496($sp) # internal_44 = address of allocated object Int + sw $v0, 576($sp) # internal_42 = address of allocated object Int - # internal_42 = array internal_36[4 * internal_44] - lw $t0, 496($sp) # $t0 = internal_44 + # internal_40 = array internal_34[4 * internal_42] + lw $t0, 576($sp) # $t0 = internal_42 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 528($sp) # $t1 = internal_36 + lw $t1, 608($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 504($sp) # internal_42 = array internal_36[4 * internal_44] + lw $t2, 584($sp) # internal_40 = array internal_34[4 * internal_42] sw $t0, 8($t2) - # If internal_42 then goto branch_Razz_8744937301489 - lw $t0, 504($sp) # Loading the address of the condition + # If internal_40 then goto branch_Razz_8794484723258 + lw $t0, 584($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Razz_8744937301489 + beq $t0, $t1, branch_Razz_8794484723258 # Allocating Int 2 li $v0, 9 @@ -5759,25 +5938,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 492($sp) # internal_45 = address of allocated object Int + sw $v0, 572($sp) # internal_43 = address of allocated object Int - # internal_42 = array internal_36[4 * internal_45] - lw $t0, 492($sp) # $t0 = internal_45 + # internal_40 = array internal_34[4 * internal_43] + lw $t0, 572($sp) # $t0 = internal_43 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 528($sp) # $t1 = internal_36 + lw $t1, 608($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 504($sp) # internal_42 = array internal_36[4 * internal_45] + lw $t2, 584($sp) # internal_40 = array internal_34[4 * internal_43] sw $t0, 8($t2) - # If internal_42 then goto branch_Foo_8744937301489 - lw $t0, 504($sp) # Loading the address of the condition + # If internal_40 then goto branch_Foo_8794484723258 + lw $t0, 584($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Foo_8744937301489 + beq $t0, $t1, branch_Foo_8794484723258 # Allocating Int 3 li $v0, 9 @@ -5789,44 +5968,44 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 488($sp) # internal_46 = address of allocated object Int + sw $v0, 568($sp) # internal_44 = address of allocated object Int - # internal_42 = array internal_36[4 * internal_46] - lw $t0, 488($sp) # $t0 = internal_46 + # internal_40 = array internal_34[4 * internal_44] + lw $t0, 568($sp) # $t0 = internal_44 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 528($sp) # $t1 = internal_36 + lw $t1, 608($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 504($sp) # internal_42 = array internal_36[4 * internal_46] + lw $t2, 584($sp) # internal_40 = array internal_34[4 * internal_44] sw $t0, 8($t2) - # If internal_42 then goto branch_Bar_8744937301489 - lw $t0, 504($sp) # Loading the address of the condition + # If internal_40 then goto branch_Bar_8794484723258 + lw $t0, 584($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Bar_8744937301489 + beq $t0, $t1, branch_Bar_8794484723258 - branch_Bazz_8744937301489: + branch_Bazz_8794484723258: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 492($sp) + lw $t0, 572($sp) sw $t0, 4($sp) # Storing n # Argument self - lw $t0, 688($sp) + lw $t0, 760($sp) sw $t0, 0($sp) # Storing self # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 492($sp) # n = result of function_assign + sw $v1, 572($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Foo @@ -5836,65 +6015,65 @@ la $t0, type_Foo # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 476($sp) # internal_49 = address of allocated object Foo + sw $v0, 556($sp) # internal_47 = address of allocated object Foo # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_49 - lw $t0, 484($sp) - sw $t0, 0($sp) # Storing internal_49 + # Argument internal_47 + lw $t0, 564($sp) + sw $t0, 0($sp) # Storing internal_47 # Calling function function___init___at_Foo jal function___init___at_Foo lw $ra, 4($sp) - sw $v1, 484($sp) # internal_49 = result of function___init___at_Foo + sw $v1, 564($sp) # internal_47 = result of function___init___at_Foo addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_47 - lw $t0, 496($sp) - sw $t0, 4($sp) # Storing internal_47 + # Argument internal_45 + lw $t0, 576($sp) + sw $t0, 4($sp) # Storing internal_45 - # Argument internal_49 - lw $t0, 488($sp) - sw $t0, 0($sp) # Storing internal_49 + # Argument internal_47 + lw $t0, 568($sp) + sw $t0, 0($sp) # Storing internal_47 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 496($sp) # internal_47 = result of function_assign + sw $v1, 576($sp) # internal_45 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_47 = internal_49 - lw $t0, 476($sp) - sw $t0, 484($sp) + # internal_45 = internal_47 + lw $t0, 556($sp) + sw $t0, 564($sp) - # Jumping to branch_end_8744937301489 - j branch_end_8744937301489 + # Jumping to branch_end_8794484723258 + j branch_end_8794484723258 - branch_Razz_8744937301489: + branch_Razz_8794484723258: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 492($sp) + lw $t0, 572($sp) sw $t0, 4($sp) # Storing n # Argument self - lw $t0, 688($sp) + lw $t0, 760($sp) sw $t0, 0($sp) # Storing self # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 492($sp) # n = result of function_assign + sw $v1, 572($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bar @@ -5904,65 +6083,65 @@ la $t0, type_Bar # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 468($sp) # internal_51 = address of allocated object Bar + sw $v0, 548($sp) # internal_49 = address of allocated object Bar # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_51 - lw $t0, 476($sp) - sw $t0, 0($sp) # Storing internal_51 + # Argument internal_49 + lw $t0, 556($sp) + sw $t0, 0($sp) # Storing internal_49 # Calling function function___init___at_Bar jal function___init___at_Bar lw $ra, 4($sp) - sw $v1, 476($sp) # internal_51 = result of function___init___at_Bar + sw $v1, 556($sp) # internal_49 = result of function___init___at_Bar addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_47 - lw $t0, 496($sp) - sw $t0, 4($sp) # Storing internal_47 + # Argument internal_45 + lw $t0, 576($sp) + sw $t0, 4($sp) # Storing internal_45 - # Argument internal_51 - lw $t0, 480($sp) - sw $t0, 0($sp) # Storing internal_51 + # Argument internal_49 + lw $t0, 560($sp) + sw $t0, 0($sp) # Storing internal_49 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 496($sp) # internal_47 = result of function_assign + sw $v1, 576($sp) # internal_45 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_47 = internal_51 - lw $t0, 468($sp) - sw $t0, 484($sp) + # internal_45 = internal_49 + lw $t0, 548($sp) + sw $t0, 564($sp) - # Jumping to branch_end_8744937301489 - j branch_end_8744937301489 + # Jumping to branch_end_8794484723258 + j branch_end_8794484723258 - branch_Foo_8744937301489: + branch_Foo_8794484723258: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 492($sp) + lw $t0, 572($sp) sw $t0, 4($sp) # Storing n # Argument self - lw $t0, 688($sp) + lw $t0, 760($sp) sw $t0, 0($sp) # Storing self # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 492($sp) # n = result of function_assign + sw $v1, 572($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Razz @@ -5972,110 +6151,110 @@ la $t0, type_Razz # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 460($sp) # internal_53 = address of allocated object Razz + sw $v0, 540($sp) # internal_51 = address of allocated object Razz # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_53 - lw $t0, 468($sp) - sw $t0, 0($sp) # Storing internal_53 + # Argument internal_51 + lw $t0, 548($sp) + sw $t0, 0($sp) # Storing internal_51 # Calling function function___init___at_Razz jal function___init___at_Razz lw $ra, 4($sp) - sw $v1, 468($sp) # internal_53 = result of function___init___at_Razz + sw $v1, 548($sp) # internal_51 = result of function___init___at_Razz addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_47 - lw $t0, 496($sp) - sw $t0, 4($sp) # Storing internal_47 + # Argument internal_45 + lw $t0, 576($sp) + sw $t0, 4($sp) # Storing internal_45 - # Argument internal_53 - lw $t0, 472($sp) - sw $t0, 0($sp) # Storing internal_53 + # Argument internal_51 + lw $t0, 552($sp) + sw $t0, 0($sp) # Storing internal_51 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 496($sp) # internal_47 = result of function_assign + sw $v1, 576($sp) # internal_45 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_47 = internal_53 - lw $t0, 460($sp) - sw $t0, 484($sp) + # internal_45 = internal_51 + lw $t0, 540($sp) + sw $t0, 564($sp) - # Jumping to branch_end_8744937301489 - j branch_end_8744937301489 + # Jumping to branch_end_8794484723258 + j branch_end_8794484723258 - branch_Bar_8744937301489: + branch_Bar_8794484723258: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 492($sp) + lw $t0, 572($sp) sw $t0, 4($sp) # Storing n # Argument self - lw $t0, 688($sp) + lw $t0, 760($sp) sw $t0, 0($sp) # Storing self # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 492($sp) # n = result of function_assign + sw $v1, 572($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_47 - lw $t0, 496($sp) - sw $t0, 4($sp) # Storing internal_47 + # Argument internal_45 + lw $t0, 576($sp) + sw $t0, 4($sp) # Storing internal_45 # Argument n - lw $t0, 492($sp) + lw $t0, 572($sp) sw $t0, 0($sp) # Storing n # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 496($sp) # internal_47 = result of function_assign + sw $v1, 576($sp) # internal_45 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_47 = n - lw $t0, 480($sp) - sw $t0, 484($sp) + # internal_45 = n + lw $t0, 560($sp) + sw $t0, 564($sp) - # Jumping to branch_end_8744937301489 - j branch_end_8744937301489 + # Jumping to branch_end_8794484723258 + j branch_end_8794484723258 - error_branch_8744937301489: + error_branch_8794484723258: - branch_end_8744937301489: + branch_end_8794484723258: # Set attribute g of self - lw $t0, 676($sp) # $t0 = self - lw $t1, 484($sp) # $t1 = internal_47 - beq $t1, $zero, object_set_attribute_8744937263936 + lw $t0, 748($sp) # $t0 = self + lw $t1, 564($sp) # $t1 = internal_45 + beq $t1, $zero, object_set_attribute_8794484638299 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937263936 + beq $t6, $t5, int_set_attribute_8794484638299 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937263936 - j object_set_attribute_8744937263936 - int_set_attribute_8744937263936: + beq $t6, $t5, bool_set_attribute_8794484638299 + j object_set_attribute_8794484638299 + int_set_attribute_8794484638299: li $v0, 9 addi $a0, $zero, 12 syscall @@ -6083,9 +6262,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.g = internal_47 - j end_set_attribute_8744937263936 - bool_set_attribute_8744937263936: + sw $v0, 12($t0) # self.g = internal_45 + j end_set_attribute_8794484638299 + bool_set_attribute_8794484638299: li $v0, 9 addi $a0, $zero, 12 syscall @@ -6093,40 +6272,64 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.g = internal_47 - j end_set_attribute_8744937263936 - object_set_attribute_8744937263936: - sw $t1, 12($t0) # self.g = internal_47 - end_set_attribute_8744937263936: + sw $v0, 12($t0) # self.g = internal_45 + j end_set_attribute_8794484638299 + object_set_attribute_8794484638299: + sw $t1, 12($t0) # self.g = internal_45 + end_set_attribute_8794484638299: + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 528($sp) # internal_54 = address of allocated object Int + + # Get method printh of Bar + lw $t0, 748($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 528($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 524($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 684($sp) + lw $t0, 756($sp) sw $t0, 0($sp) # Storing self - # Calling function function_printh_at_Bazz - jal function_printh_at_Bazz + # Calling function internal_55 + lw $t0, 532($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 460($sp) # internal_55 = result of function_printh_at_Bazz + sw $v1, 540($sp) # internal_53 = result of internal_55 addi $sp, $sp, 8 # Freeing space for arguments # Set attribute i of self - lw $t0, 676($sp) # $t0 = self - lw $t1, 452($sp) # $t1 = internal_55 - beq $t1, $zero, object_set_attribute_8744937263939 + lw $t0, 748($sp) # $t0 = self + lw $t1, 532($sp) # $t1 = internal_53 + beq $t1, $zero, object_set_attribute_8794484638302 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937263939 + beq $t6, $t5, int_set_attribute_8794484638302 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937263939 - j object_set_attribute_8744937263939 - int_set_attribute_8744937263939: + beq $t6, $t5, bool_set_attribute_8794484638302 + j object_set_attribute_8794484638302 + int_set_attribute_8794484638302: li $v0, 9 addi $a0, $zero, 12 syscall @@ -6134,9 +6337,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 16($t0) # self.i = internal_55 - j end_set_attribute_8744937263939 - bool_set_attribute_8744937263939: + sw $v0, 16($t0) # self.i = internal_53 + j end_set_attribute_8794484638302 + bool_set_attribute_8794484638302: li $v0, 9 addi $a0, $zero, 12 syscall @@ -6144,11 +6347,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 16($t0) # self.i = internal_55 - j end_set_attribute_8744937263939 - object_set_attribute_8744937263939: - sw $t1, 16($t0) # self.i = internal_55 - end_set_attribute_8744937263939: + sw $v0, 16($t0) # self.i = internal_53 + j end_set_attribute_8794484638302 + object_set_attribute_8794484638302: + sw $t1, 16($t0) # self.i = internal_53 + end_set_attribute_8794484638302: # Allocating Int 0 li $v0, 9 @@ -6160,7 +6363,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 448($sp) # internal_56 = address of allocated object Int + sw $v0, 520($sp) # internal_56 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -6172,7 +6375,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 444($sp) # internal_57 = address of allocated object Int + sw $v0, 516($sp) # internal_57 = address of allocated object Int # Allocating Int 3 li $v0, 9 @@ -6184,10 +6387,10 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 440($sp) # internal_58 = address of allocated object Int + sw $v0, 512($sp) # internal_58 = address of allocated object Int # Allocating NUll to internal_59 - sw $zero, 436($sp) # internal_59 = 0 + sw $zero, 508($sp) # internal_59 = 0 # Allocating Int 0 li $v0, 9 @@ -6199,7 +6402,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 432($sp) # internal_60 = address of allocated object Int + sw $v0, 504($sp) # internal_60 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -6211,66 +6414,66 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 420($sp) # internal_63 = address of allocated object Int + sw $v0, 492($sp) # internal_63 = address of allocated object Int # internal_61 = typeof self that is the first word of the object - lw $t0, 676($sp) + lw $t0, 748($sp) lw $t0, 0($t0) - sw $t0, 428($sp) + sw $t0, 500($sp) # internal_62 = internal_61 - lw $t0, 428($sp) - sw $t0, 424($sp) + lw $t0, 500($sp) + sw $t0, 496($sp) - while_start_8744937325815: + while_start_8794484728583: # internal_63 = EqualAddress(internal_62, internal_59) - lw $t0, 424($sp) - lw $t1, 436($sp) + lw $t0, 496($sp) + lw $t1, 508($sp) seq $t2, $t0, $t1 - lw $t0, 420($sp) + lw $t0, 492($sp) sw $t2, 8($t0) - # If internal_63 then goto while_end_8744937325815 - lw $t0, 420($sp) # Loading the address of the condition + # If internal_63 then goto while_end_8794484728583 + lw $t0, 492($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_end_8744937325815 + beq $t0, $t1, while_end_8794484728583 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_60 - lw $t0, 444($sp) + lw $t0, 516($sp) sw $t0, 4($sp) # Storing internal_60 # Argument internal_57 - lw $t0, 456($sp) + lw $t0, 528($sp) sw $t0, 0($sp) # Storing internal_57 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 444($sp) # internal_60 = result of function_add + sw $v1, 516($sp) # internal_60 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # internal_62 = ancestor of internal_62 - lw $t0, 424($sp) + lw $t0, 496($sp) lw $t0, 4($t0) - sw $t0, 424($sp) + sw $t0, 496($sp) - # Jumping to while_start_8744937325815 - j while_start_8744937325815 + # Jumping to while_start_8794484728583 + j while_start_8794484728583 - while_end_8744937325815: + while_end_8794484728583: # internal_62 = internal_61 - lw $t0, 428($sp) - sw $t0, 424($sp) + lw $t0, 500($sp) + sw $t0, 496($sp) # initialize Array [internal_60] - lw $t0, 432($sp) # $t0 = internal_60 + lw $t0, 504($sp) # $t0 = internal_60 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -6278,7 +6481,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 416($sp) # internal_64 = new Array[internal_60] + sw $v0, 488($sp) # internal_64 = new Array[internal_60] # Allocating Int 0 li $v0, 9 @@ -6290,7 +6493,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 412($sp) # internal_65 = address of allocated object Int + sw $v0, 484($sp) # internal_65 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -6302,80 +6505,80 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 408($sp) # internal_66 = address of allocated object Int + sw $v0, 480($sp) # internal_66 = address of allocated object Int - foreach_start_8744937325815: + foreach_start_8794484728583: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_65 - lw $t0, 424($sp) + lw $t0, 496($sp) sw $t0, 4($sp) # Storing internal_65 # Argument internal_60 - lw $t0, 444($sp) + lw $t0, 516($sp) sw $t0, 0($sp) # Storing internal_60 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 420($sp) # internal_66 = result of function_less_than + sw $v1, 492($sp) # internal_66 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_66 then goto foreach_body_8744937325815 - lw $t0, 408($sp) # Loading the address of the condition + # If internal_66 then goto foreach_body_8794484728583 + lw $t0, 480($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_body_8744937325815 + beq $t0, $t1, foreach_body_8794484728583 - # Jumping to foreach_end_8744937325815 - j foreach_end_8744937325815 + # Jumping to foreach_end_8794484728583 + j foreach_end_8794484728583 - foreach_body_8744937325815: + foreach_body_8794484728583: # array internal_64[4 * internal_65] = internal_62 - lw $t0, 412($sp) # $t0 = internal_65 + lw $t0, 484($sp) # $t0 = internal_65 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 416($sp) # $t1 = internal_64 + lw $t1, 488($sp) # $t1 = internal_64 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 424($sp) + lw $t0, 496($sp) sw $t0, 0($t1) # internal_62 = ancestor of internal_62 - lw $t0, 424($sp) + lw $t0, 496($sp) lw $t0, 4($t0) - sw $t0, 424($sp) + sw $t0, 496($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_65 - lw $t0, 424($sp) + lw $t0, 496($sp) sw $t0, 4($sp) # Storing internal_65 # Argument internal_57 - lw $t0, 456($sp) + lw $t0, 528($sp) sw $t0, 0($sp) # Storing internal_57 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 424($sp) # internal_65 = result of function_add + sw $v1, 496($sp) # internal_65 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_start_8744937325815 - j foreach_start_8744937325815 + # Jumping to foreach_start_8794484728583 + j foreach_start_8794484728583 - foreach_end_8744937325815: + foreach_end_8794484728583: # initialize Array [internal_58] - lw $t0, 440($sp) # $t0 = internal_58 + lw $t0, 512($sp) # $t0 = internal_58 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -6383,10 +6586,10 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 404($sp) # internal_67 = new Array[internal_58] + sw $v0, 476($sp) # internal_67 = new Array[internal_58] # initialize Array [internal_58] - lw $t0, 440($sp) # $t0 = internal_58 + lw $t0, 512($sp) # $t0 = internal_58 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -6394,7 +6597,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 400($sp) # internal_68 = new Array[internal_58] + sw $v0, 472($sp) # internal_68 = new Array[internal_58] # Allocating Int 0 li $v0, 9 @@ -6406,32 +6609,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 392($sp) # internal_70 = address of allocated object Int + sw $v0, 464($sp) # internal_70 = address of allocated object Int # internal_69 = direction of Razz la $t0, type_Razz - sw $t0, 396($sp) + sw $t0, 468($sp) # array internal_67[4 * internal_70] = internal_69 - lw $t0, 392($sp) # $t0 = internal_70 + lw $t0, 464($sp) # $t0 = internal_70 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 404($sp) # $t1 = internal_67 + lw $t1, 476($sp) # $t1 = internal_67 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 396($sp) + lw $t0, 468($sp) sw $t0, 0($t1) # array internal_68[4 * internal_70] = internal_60 - lw $t0, 392($sp) # $t0 = internal_70 + lw $t0, 464($sp) # $t0 = internal_70 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 400($sp) # $t1 = internal_68 + lw $t1, 472($sp) # $t1 = internal_68 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 432($sp) + lw $t0, 504($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -6445,32 +6648,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 384($sp) # internal_72 = address of allocated object Int + sw $v0, 456($sp) # internal_72 = address of allocated object Int # internal_71 = direction of Foo la $t0, type_Foo - sw $t0, 388($sp) + sw $t0, 460($sp) # array internal_67[4 * internal_72] = internal_71 - lw $t0, 384($sp) # $t0 = internal_72 + lw $t0, 456($sp) # $t0 = internal_72 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 404($sp) # $t1 = internal_67 + lw $t1, 476($sp) # $t1 = internal_67 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 388($sp) + lw $t0, 460($sp) sw $t0, 0($t1) # array internal_68[4 * internal_72] = internal_60 - lw $t0, 384($sp) # $t0 = internal_72 + lw $t0, 456($sp) # $t0 = internal_72 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 400($sp) # $t1 = internal_68 + lw $t1, 472($sp) # $t1 = internal_68 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 432($sp) + lw $t0, 504($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -6484,32 +6687,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 376($sp) # internal_74 = address of allocated object Int + sw $v0, 448($sp) # internal_74 = address of allocated object Int # internal_73 = direction of Bar la $t0, type_Bar - sw $t0, 380($sp) + sw $t0, 452($sp) # array internal_67[4 * internal_74] = internal_73 - lw $t0, 376($sp) # $t0 = internal_74 + lw $t0, 448($sp) # $t0 = internal_74 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 404($sp) # $t1 = internal_67 + lw $t1, 476($sp) # $t1 = internal_67 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 380($sp) + lw $t0, 452($sp) sw $t0, 0($t1) # array internal_68[4 * internal_74] = internal_60 - lw $t0, 376($sp) # $t0 = internal_74 + lw $t0, 448($sp) # $t0 = internal_74 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 400($sp) # $t1 = internal_68 + lw $t1, 472($sp) # $t1 = internal_68 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 432($sp) + lw $t0, 504($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -6523,7 +6726,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 372($sp) # internal_75 = address of allocated object Int + sw $v0, 444($sp) # internal_75 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -6535,7 +6738,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 368($sp) # internal_76 = address of allocated object Int + sw $v0, 440($sp) # internal_76 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -6547,7 +6750,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 360($sp) # internal_78 = address of allocated object Int + sw $v0, 432($sp) # internal_78 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -6559,7 +6762,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 356($sp) # internal_79 = address of allocated object Int + sw $v0, 428($sp) # internal_79 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -6571,155 +6774,155 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 348($sp) # internal_81 = address of allocated object Int + sw $v0, 420($sp) # internal_81 = address of allocated object Int - foreach_type_start_8744937325815: + foreach_type_start_8794484728583: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_75 - lw $t0, 384($sp) + lw $t0, 456($sp) sw $t0, 4($sp) # Storing internal_75 # Argument internal_58 - lw $t0, 452($sp) + lw $t0, 524($sp) sw $t0, 0($sp) # Storing internal_58 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 380($sp) # internal_76 = result of function_less_than + sw $v1, 452($sp) # internal_76 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_76 then goto foreach_type_body_8744937325815 - lw $t0, 368($sp) # Loading the address of the condition + # If internal_76 then goto foreach_type_body_8794484728583 + lw $t0, 440($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_type_body_8744937325815 + beq $t0, $t1, foreach_type_body_8794484728583 - # Jumping to foreach_type_end_8744937325815 - j foreach_type_end_8744937325815 + # Jumping to foreach_type_end_8794484728583 + j foreach_type_end_8794484728583 - foreach_type_body_8744937325815: + foreach_type_body_8794484728583: # internal_77 = array internal_67[4 * internal_75] - lw $t0, 372($sp) # $t0 = internal_75 + lw $t0, 444($sp) # $t0 = internal_75 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 404($sp) # $t1 = internal_67 + lw $t1, 476($sp) # $t1 = internal_67 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - sw $t0, 364($sp) # internal_77 = array internal_67[4 * internal_75] + sw $t0, 436($sp) # internal_77 = array internal_67[4 * internal_75] # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_78 - lw $t0, 372($sp) + lw $t0, 444($sp) sw $t0, 4($sp) # Storing internal_78 # Argument internal_56 - lw $t0, 460($sp) + lw $t0, 532($sp) sw $t0, 0($sp) # Storing internal_56 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 372($sp) # internal_78 = result of function_assign + sw $v1, 444($sp) # internal_78 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - foreach_ancestor_start_8744937325815: + foreach_ancestor_start_8794484728583: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_78 - lw $t0, 372($sp) + lw $t0, 444($sp) sw $t0, 4($sp) # Storing internal_78 # Argument internal_60 - lw $t0, 444($sp) + lw $t0, 516($sp) sw $t0, 0($sp) # Storing internal_60 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 368($sp) # internal_79 = result of function_less_than + sw $v1, 440($sp) # internal_79 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_79 then goto foreach_ancestor_body_8744937325815 - lw $t0, 356($sp) # Loading the address of the condition + # If internal_79 then goto foreach_ancestor_body_8794484728583 + lw $t0, 428($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_body_8744937325815 + beq $t0, $t1, foreach_ancestor_body_8794484728583 - # Jumping to foreach_ancestor_end_8744937325815 - j foreach_ancestor_end_8744937325815 + # Jumping to foreach_ancestor_end_8794484728583 + j foreach_ancestor_end_8794484728583 - foreach_ancestor_body_8744937325815: + foreach_ancestor_body_8794484728583: # internal_80 = array internal_64[4 * internal_78] - lw $t0, 360($sp) # $t0 = internal_78 + lw $t0, 432($sp) # $t0 = internal_78 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 416($sp) # $t1 = internal_64 + lw $t1, 488($sp) # $t1 = internal_64 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - sw $t0, 352($sp) # internal_80 = array internal_64[4 * internal_78] + sw $t0, 424($sp) # internal_80 = array internal_64[4 * internal_78] # internal_81 = EqualAddress(internal_77, internal_80) - lw $t0, 364($sp) - lw $t1, 352($sp) + lw $t0, 436($sp) + lw $t1, 424($sp) seq $t2, $t0, $t1 - lw $t0, 348($sp) + lw $t0, 420($sp) sw $t2, 8($t0) - # If internal_81 then goto foreach_ancestor_end_8744937325815 - lw $t0, 348($sp) # Loading the address of the condition + # If internal_81 then goto foreach_ancestor_end_8794484728583 + lw $t0, 420($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_end_8744937325815 + beq $t0, $t1, foreach_ancestor_end_8794484728583 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_78 - lw $t0, 372($sp) + lw $t0, 444($sp) sw $t0, 4($sp) # Storing internal_78 # Argument internal_57 - lw $t0, 456($sp) + lw $t0, 528($sp) sw $t0, 0($sp) # Storing internal_57 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 372($sp) # internal_78 = result of function_add + sw $v1, 444($sp) # internal_78 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_ancestor_start_8744937325815 - j foreach_ancestor_start_8744937325815 + # Jumping to foreach_ancestor_start_8794484728583 + j foreach_ancestor_start_8794484728583 - foreach_ancestor_end_8744937325815: + foreach_ancestor_end_8794484728583: # array internal_68[4 * internal_75] = internal_78 - lw $t0, 372($sp) # $t0 = internal_75 + lw $t0, 444($sp) # $t0 = internal_75 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 400($sp) # $t1 = internal_68 + lw $t1, 472($sp) # $t1 = internal_68 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 360($sp) + lw $t0, 432($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -6728,59 +6931,23 @@ sw $ra, 8($sp) # Storing return address # Argument internal_75 - lw $t0, 384($sp) + lw $t0, 456($sp) sw $t0, 4($sp) # Storing internal_75 # Argument internal_57 - lw $t0, 456($sp) + lw $t0, 528($sp) sw $t0, 0($sp) # Storing internal_57 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 384($sp) # internal_75 = result of function_add + sw $v1, 456($sp) # internal_75 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_type_start_8744937325815 - j foreach_type_start_8744937325815 - - foreach_type_end_8744937325815: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_87[0] = '\n' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 324($sp) # internal_87 = "\n" - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_88[0] = ' ' - - sb $zero, 9($v0) # Null-terminator at the end of the string + # Jumping to foreach_type_start_8794484728583 + j foreach_type_start_8794484728583 - sw $v0, 320($sp) # internal_88 = " " + foreach_type_end_8794484728583: # Allocating Int 0 li $v0, 9 @@ -6792,7 +6959,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 344($sp) # internal_82 = address of allocated object Int + sw $v0, 416($sp) # internal_82 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -6804,7 +6971,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 340($sp) # internal_83 = address of allocated object Int + sw $v0, 412($sp) # internal_83 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -6816,7 +6983,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 336($sp) # internal_84 = address of allocated object Int + sw $v0, 408($sp) # internal_84 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -6828,7 +6995,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 332($sp) # internal_85 = address of allocated object Int + sw $v0, 404($sp) # internal_85 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -6840,67 +7007,67 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 328($sp) # internal_86 = address of allocated object Int + sw $v0, 400($sp) # internal_86 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_85 - lw $t0, 344($sp) + lw $t0, 416($sp) sw $t0, 4($sp) # Storing internal_85 # Argument internal_60 - lw $t0, 444($sp) + lw $t0, 516($sp) sw $t0, 0($sp) # Storing internal_60 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 344($sp) # internal_85 = result of function_assign + sw $v1, 416($sp) # internal_85 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - foreach_min_start_8744937325815: + foreach_min_start_8794484728583: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_82 - lw $t0, 356($sp) + lw $t0, 428($sp) sw $t0, 4($sp) # Storing internal_82 # Argument internal_58 - lw $t0, 452($sp) + lw $t0, 524($sp) sw $t0, 0($sp) # Storing internal_58 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 340($sp) # internal_86 = result of function_less_than + sw $v1, 412($sp) # internal_86 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_86 then goto foreach_min_body_8744937325815 - lw $t0, 328($sp) # Loading the address of the condition + # If internal_86 then goto foreach_min_body_8794484728583 + lw $t0, 400($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_min_body_8744937325815 + beq $t0, $t1, foreach_min_body_8794484728583 - # Jumping to foreach_min_end_8744937325815 - j foreach_min_end_8744937325815 + # Jumping to foreach_min_end_8794484728583 + j foreach_min_end_8794484728583 - foreach_min_body_8744937325815: + foreach_min_body_8794484728583: # internal_84 = array internal_68[4 * internal_82] - lw $t0, 344($sp) # $t0 = internal_82 + lw $t0, 416($sp) # $t0 = internal_82 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 400($sp) # $t1 = internal_68 + lw $t1, 472($sp) # $t1 = internal_68 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 336($sp) # internal_84 = array internal_68[4 * internal_82] + lw $t2, 408($sp) # internal_84 = array internal_68[4 * internal_82] sw $t0, 8($t2) # Passing function arguments @@ -6908,46 +7075,46 @@ sw $ra, 8($sp) # Storing return address # Argument internal_84 - lw $t0, 348($sp) + lw $t0, 420($sp) sw $t0, 4($sp) # Storing internal_84 # Argument internal_85 - lw $t0, 344($sp) + lw $t0, 416($sp) sw $t0, 0($sp) # Storing internal_85 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 340($sp) # internal_86 = result of function_less_than + sw $v1, 412($sp) # internal_86 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_86 then goto update_min_8744937325815 - lw $t0, 328($sp) # Loading the address of the condition + # If internal_86 then goto update_min_8794484728583 + lw $t0, 400($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, update_min_8744937325815 + beq $t0, $t1, update_min_8794484728583 - # Jumping to update_min_end_8744937325815 - j update_min_end_8744937325815 + # Jumping to update_min_end_8794484728583 + j update_min_end_8794484728583 - update_min_8744937325815: + update_min_8794484728583: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_85 - lw $t0, 344($sp) + lw $t0, 416($sp) sw $t0, 4($sp) # Storing internal_85 # Argument internal_84 - lw $t0, 348($sp) + lw $t0, 420($sp) sw $t0, 0($sp) # Storing internal_84 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 344($sp) # internal_85 = result of function_assign + sw $v1, 416($sp) # internal_85 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -6955,46 +7122,46 @@ sw $ra, 8($sp) # Storing return address # Argument internal_83 - lw $t0, 352($sp) + lw $t0, 424($sp) sw $t0, 4($sp) # Storing internal_83 # Argument internal_82 - lw $t0, 356($sp) + lw $t0, 428($sp) sw $t0, 0($sp) # Storing internal_82 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 352($sp) # internal_83 = result of function_assign + sw $v1, 424($sp) # internal_83 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - update_min_end_8744937325815: + update_min_end_8794484728583: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_82 - lw $t0, 356($sp) + lw $t0, 428($sp) sw $t0, 4($sp) # Storing internal_82 # Argument internal_57 - lw $t0, 456($sp) + lw $t0, 528($sp) sw $t0, 0($sp) # Storing internal_57 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 356($sp) # internal_82 = result of function_add + sw $v1, 428($sp) # internal_82 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_min_start_8744937325815 - j foreach_min_start_8744937325815 + # Jumping to foreach_min_start_8794484728583 + j foreach_min_start_8794484728583 - foreach_min_end_8744937325815: + foreach_min_end_8794484728583: # initialize Array [internal_58] - lw $t0, 440($sp) # $t0 = internal_58 + lw $t0, 512($sp) # $t0 = internal_58 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -7002,7 +7169,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 316($sp) # internal_89 = new Array[internal_58] + sw $v0, 396($sp) # internal_87 = new Array[internal_58] # Allocating Int 0 li $v0, 9 @@ -7014,17 +7181,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 312($sp) # internal_90 = address of allocated object Int + sw $v0, 392($sp) # internal_88 = address of allocated object Int - # array internal_89[4 * internal_90] = internal_56 - lw $t0, 312($sp) # $t0 = internal_90 + # array internal_87[4 * internal_88] = internal_56 + lw $t0, 392($sp) # $t0 = internal_88 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 316($sp) # $t1 = internal_89 + lw $t1, 396($sp) # $t1 = internal_87 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 448($sp) + lw $t0, 520($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -7038,17 +7205,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 308($sp) # internal_91 = address of allocated object Int + sw $v0, 388($sp) # internal_89 = address of allocated object Int - # array internal_89[4 * internal_91] = internal_56 - lw $t0, 308($sp) # $t0 = internal_91 + # array internal_87[4 * internal_89] = internal_56 + lw $t0, 388($sp) # $t0 = internal_89 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 316($sp) # $t1 = internal_89 + lw $t1, 396($sp) # $t1 = internal_87 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 448($sp) + lw $t0, 520($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -7062,17 +7229,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 304($sp) # internal_92 = address of allocated object Int + sw $v0, 384($sp) # internal_90 = address of allocated object Int - # array internal_89[4 * internal_92] = internal_56 - lw $t0, 304($sp) # $t0 = internal_92 + # array internal_87[4 * internal_90] = internal_56 + lw $t0, 384($sp) # $t0 = internal_90 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 316($sp) # $t1 = internal_89 + lw $t1, 396($sp) # $t1 = internal_87 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 448($sp) + lw $t0, 520($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -7086,41 +7253,41 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 300($sp) # internal_93 = address of allocated object Int + sw $v0, 380($sp) # internal_91 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_85 - lw $t0, 344($sp) + lw $t0, 416($sp) sw $t0, 4($sp) # Storing internal_85 # Argument internal_60 - lw $t0, 444($sp) + lw $t0, 516($sp) sw $t0, 0($sp) # Storing internal_60 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 312($sp) # internal_93 = result of function_equal + sw $v1, 392($sp) # internal_91 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # If internal_93 then goto error_branch_8744937325815 - lw $t0, 300($sp) # Loading the address of the condition + # If internal_91 then goto error_branch_8794484728583 + lw $t0, 380($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, error_branch_8744937325815 + beq $t0, $t1, error_branch_8794484728583 - # array internal_89[4 * internal_83] = internal_57 - lw $t0, 340($sp) # $t0 = internal_83 + # array internal_87[4 * internal_83] = internal_57 + lw $t0, 412($sp) # $t0 = internal_83 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 316($sp) # $t1 = internal_89 + lw $t1, 396($sp) # $t1 = internal_87 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 444($sp) + lw $t0, 516($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -7134,7 +7301,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 296($sp) # internal_94 = address of allocated object Int + sw $v0, 376($sp) # internal_92 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -7146,25 +7313,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 292($sp) # internal_95 = address of allocated object Int + sw $v0, 372($sp) # internal_93 = address of allocated object Int - # internal_94 = array internal_89[4 * internal_95] - lw $t0, 292($sp) # $t0 = internal_95 + # internal_92 = array internal_87[4 * internal_93] + lw $t0, 372($sp) # $t0 = internal_93 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 316($sp) # $t1 = internal_89 + lw $t1, 396($sp) # $t1 = internal_87 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 296($sp) # internal_94 = array internal_89[4 * internal_95] + lw $t2, 376($sp) # internal_92 = array internal_87[4 * internal_93] sw $t0, 8($t2) - # If internal_94 then goto branch_Razz_8744937325815 - lw $t0, 296($sp) # Loading the address of the condition + # If internal_92 then goto branch_Razz_8794484728583 + lw $t0, 376($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Razz_8744937325815 + beq $t0, $t1, branch_Razz_8794484728583 # Allocating Int 1 li $v0, 9 @@ -7176,25 +7343,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 288($sp) # internal_96 = address of allocated object Int + sw $v0, 368($sp) # internal_94 = address of allocated object Int - # internal_94 = array internal_89[4 * internal_96] - lw $t0, 288($sp) # $t0 = internal_96 + # internal_92 = array internal_87[4 * internal_94] + lw $t0, 368($sp) # $t0 = internal_94 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 316($sp) # $t1 = internal_89 + lw $t1, 396($sp) # $t1 = internal_87 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 296($sp) # internal_94 = array internal_89[4 * internal_96] + lw $t2, 376($sp) # internal_92 = array internal_87[4 * internal_94] sw $t0, 8($t2) - # If internal_94 then goto branch_Foo_8744937325815 - lw $t0, 296($sp) # Loading the address of the condition + # If internal_92 then goto branch_Foo_8794484728583 + lw $t0, 376($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Foo_8744937325815 + beq $t0, $t1, branch_Foo_8794484728583 # Allocating Int 2 li $v0, 9 @@ -7206,44 +7373,44 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 284($sp) # internal_97 = address of allocated object Int + sw $v0, 364($sp) # internal_95 = address of allocated object Int - # internal_94 = array internal_89[4 * internal_97] - lw $t0, 284($sp) # $t0 = internal_97 + # internal_92 = array internal_87[4 * internal_95] + lw $t0, 364($sp) # $t0 = internal_95 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 316($sp) # $t1 = internal_89 + lw $t1, 396($sp) # $t1 = internal_87 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 296($sp) # internal_94 = array internal_89[4 * internal_97] + lw $t2, 376($sp) # internal_92 = array internal_87[4 * internal_95] sw $t0, 8($t2) - # If internal_94 then goto branch_Bar_8744937325815 - lw $t0, 296($sp) # Loading the address of the condition + # If internal_92 then goto branch_Bar_8794484728583 + lw $t0, 376($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Bar_8744937325815 + beq $t0, $t1, branch_Bar_8794484728583 - branch_Razz_8744937325815: + branch_Razz_8794484728583: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 492($sp) + lw $t0, 572($sp) sw $t0, 4($sp) # Storing n # Argument self - lw $t0, 688($sp) + lw $t0, 760($sp) sw $t0, 0($sp) # Storing self # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 492($sp) # n = result of function_assign + sw $v1, 572($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bar @@ -7253,65 +7420,65 @@ la $t0, type_Bar # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 272($sp) # internal_100 = address of allocated object Bar + sw $v0, 352($sp) # internal_98 = address of allocated object Bar # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_100 - lw $t0, 280($sp) - sw $t0, 0($sp) # Storing internal_100 + # Argument internal_98 + lw $t0, 360($sp) + sw $t0, 0($sp) # Storing internal_98 # Calling function function___init___at_Bar jal function___init___at_Bar lw $ra, 4($sp) - sw $v1, 280($sp) # internal_100 = result of function___init___at_Bar + sw $v1, 360($sp) # internal_98 = result of function___init___at_Bar addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_98 - lw $t0, 292($sp) - sw $t0, 4($sp) # Storing internal_98 + # Argument internal_96 + lw $t0, 372($sp) + sw $t0, 4($sp) # Storing internal_96 - # Argument internal_100 - lw $t0, 284($sp) - sw $t0, 0($sp) # Storing internal_100 + # Argument internal_98 + lw $t0, 364($sp) + sw $t0, 0($sp) # Storing internal_98 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 292($sp) # internal_98 = result of function_assign + sw $v1, 372($sp) # internal_96 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_98 = internal_100 - lw $t0, 272($sp) - sw $t0, 280($sp) + # internal_96 = internal_98 + lw $t0, 352($sp) + sw $t0, 360($sp) - # Jumping to branch_end_8744937325815 - j branch_end_8744937325815 + # Jumping to branch_end_8794484728583 + j branch_end_8794484728583 - branch_Foo_8744937325815: + branch_Foo_8794484728583: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 492($sp) + lw $t0, 572($sp) sw $t0, 4($sp) # Storing n # Argument self - lw $t0, 688($sp) + lw $t0, 760($sp) sw $t0, 0($sp) # Storing self # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 492($sp) # n = result of function_assign + sw $v1, 572($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Razz @@ -7321,110 +7488,110 @@ la $t0, type_Razz # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 264($sp) # internal_102 = address of allocated object Razz + sw $v0, 344($sp) # internal_100 = address of allocated object Razz # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_102 - lw $t0, 272($sp) - sw $t0, 0($sp) # Storing internal_102 + # Argument internal_100 + lw $t0, 352($sp) + sw $t0, 0($sp) # Storing internal_100 # Calling function function___init___at_Razz jal function___init___at_Razz lw $ra, 4($sp) - sw $v1, 272($sp) # internal_102 = result of function___init___at_Razz + sw $v1, 352($sp) # internal_100 = result of function___init___at_Razz addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_98 - lw $t0, 292($sp) - sw $t0, 4($sp) # Storing internal_98 + # Argument internal_96 + lw $t0, 372($sp) + sw $t0, 4($sp) # Storing internal_96 - # Argument internal_102 - lw $t0, 276($sp) - sw $t0, 0($sp) # Storing internal_102 + # Argument internal_100 + lw $t0, 356($sp) + sw $t0, 0($sp) # Storing internal_100 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 292($sp) # internal_98 = result of function_assign + sw $v1, 372($sp) # internal_96 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_98 = internal_102 - lw $t0, 264($sp) - sw $t0, 280($sp) + # internal_96 = internal_100 + lw $t0, 344($sp) + sw $t0, 360($sp) - # Jumping to branch_end_8744937325815 - j branch_end_8744937325815 + # Jumping to branch_end_8794484728583 + j branch_end_8794484728583 - branch_Bar_8744937325815: + branch_Bar_8794484728583: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 492($sp) + lw $t0, 572($sp) sw $t0, 4($sp) # Storing n # Argument self - lw $t0, 688($sp) + lw $t0, 760($sp) sw $t0, 0($sp) # Storing self # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 492($sp) # n = result of function_assign + sw $v1, 572($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_98 - lw $t0, 292($sp) - sw $t0, 4($sp) # Storing internal_98 + # Argument internal_96 + lw $t0, 372($sp) + sw $t0, 4($sp) # Storing internal_96 # Argument n - lw $t0, 492($sp) + lw $t0, 572($sp) sw $t0, 0($sp) # Storing n # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 292($sp) # internal_98 = result of function_assign + sw $v1, 372($sp) # internal_96 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_98 = n - lw $t0, 480($sp) - sw $t0, 280($sp) + # internal_96 = n + lw $t0, 560($sp) + sw $t0, 360($sp) - # Jumping to branch_end_8744937325815 - j branch_end_8744937325815 + # Jumping to branch_end_8794484728583 + j branch_end_8794484728583 - error_branch_8744937325815: + error_branch_8794484728583: - branch_end_8744937325815: + branch_end_8794484728583: # Set attribute a of self - lw $t0, 676($sp) # $t0 = self - lw $t1, 280($sp) # $t1 = internal_98 - beq $t1, $zero, object_set_attribute_8744937268044 + lw $t0, 748($sp) # $t0 = self + lw $t1, 360($sp) # $t1 = internal_96 + beq $t1, $zero, object_set_attribute_8794484641952 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937268044 + beq $t6, $t5, int_set_attribute_8794484641952 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937268044 - j object_set_attribute_8744937268044 - int_set_attribute_8744937268044: + beq $t6, $t5, bool_set_attribute_8794484641952 + j object_set_attribute_8794484641952 + int_set_attribute_8794484641952: li $v0, 9 addi $a0, $zero, 12 syscall @@ -7432,9 +7599,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 20($t0) # self.a = internal_98 - j end_set_attribute_8744937268044 - bool_set_attribute_8744937268044: + sw $v0, 20($t0) # self.a = internal_96 + j end_set_attribute_8794484641952 + bool_set_attribute_8794484641952: li $v0, 9 addi $a0, $zero, 12 syscall @@ -7442,25 +7609,25 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 20($t0) # self.a = internal_98 - j end_set_attribute_8744937268044 - object_set_attribute_8744937268044: - sw $t1, 20($t0) # self.a = internal_98 - end_set_attribute_8744937268044: + sw $v0, 20($t0) # self.a = internal_96 + j end_set_attribute_8794484641952 + object_set_attribute_8794484641952: + sw $t1, 20($t0) # self.a = internal_96 + end_set_attribute_8794484641952: # Get attribute a of self - lw $t0, 676($sp) # Get the address of self - lw $t1, 20($t0) # Get the attribute 'a' from the instance + lw $t0, 748($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'a' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8744937271248 + beq $t6, $t5, int_get_attribute_8794484645705 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8744937271248 - j object_get_attribute_8744937271248 - int_get_attribute_8744937271248: + beq $t6, $t5, bool_get_attribute_8794484645705 + j object_get_attribute_8794484645705 + int_get_attribute_8794484645705: li $v0, 9 addi $a0, $zero, 12 syscall @@ -7468,9 +7635,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 256($sp) # internal_104 = self.a - j end_get_attribute_8744937271248 - bool_get_attribute_8744937271248: + sw $v0, 336($sp) # internal_102 = self.a + j end_get_attribute_8794484645705 + bool_get_attribute_8794484645705: li $v0, 9 addi $a0, $zero, 12 syscall @@ -7478,39 +7645,63 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 256($sp) # internal_104 = self.a - j end_get_attribute_8744937271248 - object_get_attribute_8744937271248: - sw $t1, 256($sp) # internal_104 = a - end_get_attribute_8744937271248: + sw $v0, 336($sp) # internal_102 = self.a + j end_get_attribute_8794484645705 + object_get_attribute_8794484645705: + sw $t1, 336($sp) # internal_102 = self.a + end_get_attribute_8794484645705: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 328($sp) # internal_104 = address of allocated object Int + + # Get method doh of Razz + lw $t0, 336($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 328($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 324($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_104 - lw $t0, 264($sp) - sw $t0, 0($sp) # Storing internal_104 + # Argument internal_102 + lw $t0, 344($sp) + sw $t0, 0($sp) # Storing internal_102 - # Calling function function_doh_at_Foo - jal function_doh_at_Foo + # Calling function internal_105 + lw $t0, 332($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 260($sp) # internal_105 = result of function_doh_at_Foo + sw $v1, 340($sp) # internal_103 = result of internal_105 addi $sp, $sp, 8 # Freeing space for arguments # Get attribute g of self - lw $t0, 676($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'g' from the instance + lw $t0, 748($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'g' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8744937271278 + beq $t6, $t5, int_get_attribute_8794484645759 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8744937271278 - j object_get_attribute_8744937271278 - int_get_attribute_8744937271278: + beq $t6, $t5, bool_get_attribute_8794484645759 + j object_get_attribute_8794484645759 + int_get_attribute_8794484645759: li $v0, 9 addi $a0, $zero, 12 syscall @@ -7518,9 +7709,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 248($sp) # internal_106 = self.g - j end_get_attribute_8744937271278 - bool_get_attribute_8744937271278: + sw $v0, 320($sp) # internal_106 = self.g + j end_get_attribute_8794484645759 + bool_get_attribute_8794484645759: li $v0, 9 addi $a0, $zero, 12 syscall @@ -7528,122 +7719,194 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 248($sp) # internal_106 = self.g - j end_get_attribute_8744937271278 - object_get_attribute_8744937271278: - sw $t1, 248($sp) # internal_106 = g - end_get_attribute_8744937271278: + sw $v0, 320($sp) # internal_106 = self.g + j end_get_attribute_8794484645759 + object_get_attribute_8794484645759: + sw $t1, 320($sp) # internal_106 = self.g + end_get_attribute_8794484645759: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 312($sp) # internal_108 = address of allocated object Int + + # Get method doh of Foo + lw $t0, 320($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 312($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 308($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_106 - lw $t0, 256($sp) + lw $t0, 328($sp) sw $t0, 0($sp) # Storing internal_106 - # Calling function function_doh_at_Foo - jal function_doh_at_Foo + # Calling function internal_109 + lw $t0, 316($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 252($sp) # internal_107 = result of function_doh_at_Foo + sw $v1, 324($sp) # internal_107 = result of internal_109 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_105 - lw $t0, 264($sp) - sw $t0, 4($sp) # Storing internal_105 + # Argument internal_103 + lw $t0, 344($sp) + sw $t0, 4($sp) # Storing internal_103 # Argument internal_107 - lw $t0, 256($sp) + lw $t0, 328($sp) sw $t0, 0($sp) # Storing internal_107 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 252($sp) # internal_108 = result of function_add + sw $v1, 316($sp) # internal_110 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 296($sp) # internal_112 = address of allocated object Int + + # Get method doh of Bar + lw $t0, 748($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 296($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 292($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 684($sp) + lw $t0, 756($sp) sw $t0, 0($sp) # Storing self - # Calling function function_doh_at_Foo - jal function_doh_at_Foo + # Calling function internal_113 + lw $t0, 300($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 244($sp) # internal_109 = result of function_doh_at_Foo + sw $v1, 308($sp) # internal_111 = result of internal_113 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_108 - lw $t0, 252($sp) - sw $t0, 4($sp) # Storing internal_108 + # Argument internal_110 + lw $t0, 316($sp) + sw $t0, 4($sp) # Storing internal_110 - # Argument internal_109 - lw $t0, 248($sp) - sw $t0, 0($sp) # Storing internal_109 + # Argument internal_111 + lw $t0, 312($sp) + sw $t0, 0($sp) # Storing internal_111 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 244($sp) # internal_110 = result of function_add + sw $v1, 300($sp) # internal_114 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 280($sp) # internal_116 = address of allocated object Int + + # Get method printh of Bar + lw $t0, 748($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 280($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 276($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 684($sp) + lw $t0, 756($sp) sw $t0, 0($sp) # Storing self - # Calling function function_printh_at_Bazz - jal function_printh_at_Bazz + # Calling function internal_117 + lw $t0, 284($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 236($sp) # internal_111 = result of function_printh_at_Bazz + sw $v1, 292($sp) # internal_115 = result of internal_117 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_110 - lw $t0, 244($sp) - sw $t0, 4($sp) # Storing internal_110 + # Argument internal_114 + lw $t0, 300($sp) + sw $t0, 4($sp) # Storing internal_114 - # Argument internal_111 - lw $t0, 240($sp) - sw $t0, 0($sp) # Storing internal_111 + # Argument internal_115 + lw $t0, 296($sp) + sw $t0, 0($sp) # Storing internal_115 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 236($sp) # internal_112 = result of function_add + sw $v1, 284($sp) # internal_118 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Set attribute b of self - lw $t0, 676($sp) # $t0 = self - lw $t1, 224($sp) # $t1 = internal_112 - beq $t1, $zero, object_set_attribute_8744937271188 + lw $t0, 748($sp) # $t0 = self + lw $t1, 272($sp) # $t1 = internal_118 + beq $t1, $zero, object_set_attribute_8794484645645 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937271188 + beq $t6, $t5, int_set_attribute_8794484645645 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937271188 - j object_set_attribute_8744937271188 - int_set_attribute_8744937271188: + beq $t6, $t5, bool_set_attribute_8794484645645 + j object_set_attribute_8794484645645 + int_set_attribute_8794484645645: li $v0, 9 addi $a0, $zero, 12 syscall @@ -7651,9 +7914,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 24($t0) # self.b = internal_112 - j end_set_attribute_8744937271188 - bool_set_attribute_8744937271188: + sw $v0, 24($t0) # self.b = internal_118 + j end_set_attribute_8794484645645 + bool_set_attribute_8794484645645: li $v0, 9 addi $a0, $zero, 12 syscall @@ -7661,11 +7924,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 24($t0) # self.b = internal_112 - j end_set_attribute_8744937271188 - object_set_attribute_8744937271188: - sw $t1, 24($t0) # self.b = internal_112 - end_set_attribute_8744937271188: + sw $v0, 24($t0) # self.b = internal_118 + j end_set_attribute_8794484645645 + object_set_attribute_8794484645645: + sw $t1, 24($t0) # self.b = internal_118 + end_set_attribute_8794484645645: # Allocating Int 0 li $v0, 9 @@ -7677,7 +7940,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 220($sp) # internal_113 = address of allocated object Int + sw $v0, 268($sp) # internal_119 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -7689,7 +7952,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 216($sp) # internal_114 = address of allocated object Int + sw $v0, 264($sp) # internal_120 = address of allocated object Int # Allocating Int 2 li $v0, 9 @@ -7701,10 +7964,10 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 212($sp) # internal_115 = address of allocated object Int + sw $v0, 260($sp) # internal_121 = address of allocated object Int - # Allocating NUll to internal_116 - sw $zero, 208($sp) # internal_116 = 0 + # Allocating NUll to internal_122 + sw $zero, 256($sp) # internal_122 = 0 # Allocating Int 0 li $v0, 9 @@ -7716,7 +7979,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 204($sp) # internal_117 = address of allocated object Int + sw $v0, 252($sp) # internal_123 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -7728,66 +7991,66 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 192($sp) # internal_120 = address of allocated object Int + sw $v0, 240($sp) # internal_126 = address of allocated object Int - # internal_118 = typeof self that is the first word of the object - lw $t0, 676($sp) + # internal_124 = typeof self that is the first word of the object + lw $t0, 748($sp) lw $t0, 0($t0) - sw $t0, 200($sp) + sw $t0, 248($sp) - # internal_119 = internal_118 - lw $t0, 200($sp) - sw $t0, 196($sp) + # internal_125 = internal_124 + lw $t0, 248($sp) + sw $t0, 244($sp) - while_start_8744937301390: + while_start_8794484734308: - # internal_120 = EqualAddress(internal_119, internal_116) - lw $t0, 196($sp) - lw $t1, 208($sp) + # internal_126 = EqualAddress(internal_125, internal_122) + lw $t0, 244($sp) + lw $t1, 256($sp) seq $t2, $t0, $t1 - lw $t0, 192($sp) + lw $t0, 240($sp) sw $t2, 8($t0) - # If internal_120 then goto while_end_8744937301390 - lw $t0, 192($sp) # Loading the address of the condition + # If internal_126 then goto while_end_8794484734308 + lw $t0, 240($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_end_8744937301390 + beq $t0, $t1, while_end_8794484734308 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_117 - lw $t0, 216($sp) - sw $t0, 4($sp) # Storing internal_117 + # Argument internal_123 + lw $t0, 264($sp) + sw $t0, 4($sp) # Storing internal_123 - # Argument internal_114 - lw $t0, 228($sp) - sw $t0, 0($sp) # Storing internal_114 + # Argument internal_120 + lw $t0, 276($sp) + sw $t0, 0($sp) # Storing internal_120 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 216($sp) # internal_117 = result of function_add + sw $v1, 264($sp) # internal_123 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # internal_119 = ancestor of internal_119 - lw $t0, 196($sp) + # internal_125 = ancestor of internal_125 + lw $t0, 244($sp) lw $t0, 4($t0) - sw $t0, 196($sp) + sw $t0, 244($sp) - # Jumping to while_start_8744937301390 - j while_start_8744937301390 + # Jumping to while_start_8794484734308 + j while_start_8794484734308 - while_end_8744937301390: + while_end_8794484734308: - # internal_119 = internal_118 - lw $t0, 200($sp) - sw $t0, 196($sp) + # internal_125 = internal_124 + lw $t0, 248($sp) + sw $t0, 244($sp) - # initialize Array [internal_117] - lw $t0, 204($sp) # $t0 = internal_117 + # initialize Array [internal_123] + lw $t0, 252($sp) # $t0 = internal_123 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -7795,7 +8058,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 188($sp) # internal_121 = new Array[internal_117] + sw $v0, 236($sp) # internal_127 = new Array[internal_123] # Allocating Int 0 li $v0, 9 @@ -7807,7 +8070,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 184($sp) # internal_122 = address of allocated object Int + sw $v0, 232($sp) # internal_128 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -7819,80 +8082,80 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 180($sp) # internal_123 = address of allocated object Int + sw $v0, 228($sp) # internal_129 = address of allocated object Int - foreach_start_8744937301390: + foreach_start_8794484734308: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_122 - lw $t0, 196($sp) - sw $t0, 4($sp) # Storing internal_122 + # Argument internal_128 + lw $t0, 244($sp) + sw $t0, 4($sp) # Storing internal_128 - # Argument internal_117 - lw $t0, 216($sp) - sw $t0, 0($sp) # Storing internal_117 + # Argument internal_123 + lw $t0, 264($sp) + sw $t0, 0($sp) # Storing internal_123 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 192($sp) # internal_123 = result of function_less_than + sw $v1, 240($sp) # internal_129 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_123 then goto foreach_body_8744937301390 - lw $t0, 180($sp) # Loading the address of the condition + # If internal_129 then goto foreach_body_8794484734308 + lw $t0, 228($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_body_8744937301390 + beq $t0, $t1, foreach_body_8794484734308 - # Jumping to foreach_end_8744937301390 - j foreach_end_8744937301390 + # Jumping to foreach_end_8794484734308 + j foreach_end_8794484734308 - foreach_body_8744937301390: + foreach_body_8794484734308: - # array internal_121[4 * internal_122] = internal_119 - lw $t0, 184($sp) # $t0 = internal_122 + # array internal_127[4 * internal_128] = internal_125 + lw $t0, 232($sp) # $t0 = internal_128 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 188($sp) # $t1 = internal_121 + lw $t1, 236($sp) # $t1 = internal_127 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 196($sp) + lw $t0, 244($sp) sw $t0, 0($t1) - # internal_119 = ancestor of internal_119 - lw $t0, 196($sp) + # internal_125 = ancestor of internal_125 + lw $t0, 244($sp) lw $t0, 4($t0) - sw $t0, 196($sp) + sw $t0, 244($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_122 - lw $t0, 196($sp) - sw $t0, 4($sp) # Storing internal_122 + # Argument internal_128 + lw $t0, 244($sp) + sw $t0, 4($sp) # Storing internal_128 - # Argument internal_114 - lw $t0, 228($sp) - sw $t0, 0($sp) # Storing internal_114 + # Argument internal_120 + lw $t0, 276($sp) + sw $t0, 0($sp) # Storing internal_120 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 196($sp) # internal_122 = result of function_add + sw $v1, 244($sp) # internal_128 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_start_8744937301390 - j foreach_start_8744937301390 + # Jumping to foreach_start_8794484734308 + j foreach_start_8794484734308 - foreach_end_8744937301390: + foreach_end_8794484734308: - # initialize Array [internal_115] - lw $t0, 212($sp) # $t0 = internal_115 + # initialize Array [internal_121] + lw $t0, 260($sp) # $t0 = internal_121 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -7900,10 +8163,10 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 176($sp) # internal_124 = new Array[internal_115] + sw $v0, 224($sp) # internal_130 = new Array[internal_121] - # initialize Array [internal_115] - lw $t0, 212($sp) # $t0 = internal_115 + # initialize Array [internal_121] + lw $t0, 260($sp) # $t0 = internal_121 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -7911,7 +8174,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 172($sp) # internal_125 = new Array[internal_115] + sw $v0, 220($sp) # internal_131 = new Array[internal_121] # Allocating Int 0 li $v0, 9 @@ -7923,32 +8186,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 164($sp) # internal_127 = address of allocated object Int + sw $v0, 212($sp) # internal_133 = address of allocated object Int - # internal_126 = direction of Razz + # internal_132 = direction of Razz la $t0, type_Razz - sw $t0, 168($sp) + sw $t0, 216($sp) - # array internal_124[4 * internal_127] = internal_126 - lw $t0, 164($sp) # $t0 = internal_127 + # array internal_130[4 * internal_133] = internal_132 + lw $t0, 212($sp) # $t0 = internal_133 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 176($sp) # $t1 = internal_124 + lw $t1, 224($sp) # $t1 = internal_130 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 168($sp) + lw $t0, 216($sp) sw $t0, 0($t1) - # array internal_125[4 * internal_127] = internal_117 - lw $t0, 164($sp) # $t0 = internal_127 + # array internal_131[4 * internal_133] = internal_123 + lw $t0, 212($sp) # $t0 = internal_133 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 172($sp) # $t1 = internal_125 + lw $t1, 220($sp) # $t1 = internal_131 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 204($sp) + lw $t0, 252($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -7962,32 +8225,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 156($sp) # internal_129 = address of allocated object Int + sw $v0, 204($sp) # internal_135 = address of allocated object Int - # internal_128 = direction of Bar + # internal_134 = direction of Bar la $t0, type_Bar - sw $t0, 160($sp) + sw $t0, 208($sp) - # array internal_124[4 * internal_129] = internal_128 - lw $t0, 156($sp) # $t0 = internal_129 + # array internal_130[4 * internal_135] = internal_134 + lw $t0, 204($sp) # $t0 = internal_135 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 176($sp) # $t1 = internal_124 + lw $t1, 224($sp) # $t1 = internal_130 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 160($sp) + lw $t0, 208($sp) sw $t0, 0($t1) - # array internal_125[4 * internal_129] = internal_117 - lw $t0, 156($sp) # $t0 = internal_129 + # array internal_131[4 * internal_135] = internal_123 + lw $t0, 204($sp) # $t0 = internal_135 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 172($sp) # $t1 = internal_125 + lw $t1, 220($sp) # $t1 = internal_131 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 204($sp) + lw $t0, 252($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -8001,7 +8264,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 152($sp) # internal_130 = address of allocated object Int + sw $v0, 200($sp) # internal_136 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -8013,7 +8276,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 148($sp) # internal_131 = address of allocated object Int + sw $v0, 196($sp) # internal_137 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -8025,7 +8288,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 140($sp) # internal_133 = address of allocated object Int + sw $v0, 188($sp) # internal_139 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -8037,7 +8300,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 136($sp) # internal_134 = address of allocated object Int + sw $v0, 184($sp) # internal_140 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -8049,155 +8312,155 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 128($sp) # internal_136 = address of allocated object Int + sw $v0, 176($sp) # internal_142 = address of allocated object Int - foreach_type_start_8744937301390: + foreach_type_start_8794484734308: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_130 - lw $t0, 164($sp) - sw $t0, 4($sp) # Storing internal_130 + # Argument internal_136 + lw $t0, 212($sp) + sw $t0, 4($sp) # Storing internal_136 - # Argument internal_115 - lw $t0, 224($sp) - sw $t0, 0($sp) # Storing internal_115 + # Argument internal_121 + lw $t0, 272($sp) + sw $t0, 0($sp) # Storing internal_121 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 160($sp) # internal_131 = result of function_less_than + sw $v1, 208($sp) # internal_137 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_131 then goto foreach_type_body_8744937301390 - lw $t0, 148($sp) # Loading the address of the condition + # If internal_137 then goto foreach_type_body_8794484734308 + lw $t0, 196($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_type_body_8744937301390 + beq $t0, $t1, foreach_type_body_8794484734308 - # Jumping to foreach_type_end_8744937301390 - j foreach_type_end_8744937301390 + # Jumping to foreach_type_end_8794484734308 + j foreach_type_end_8794484734308 - foreach_type_body_8744937301390: + foreach_type_body_8794484734308: - # internal_132 = array internal_124[4 * internal_130] - lw $t0, 152($sp) # $t0 = internal_130 + # internal_138 = array internal_130[4 * internal_136] + lw $t0, 200($sp) # $t0 = internal_136 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 176($sp) # $t1 = internal_124 + lw $t1, 224($sp) # $t1 = internal_130 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - sw $t0, 144($sp) # internal_132 = array internal_124[4 * internal_130] + sw $t0, 192($sp) # internal_138 = array internal_130[4 * internal_136] # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_133 - lw $t0, 152($sp) - sw $t0, 4($sp) # Storing internal_133 + # Argument internal_139 + lw $t0, 200($sp) + sw $t0, 4($sp) # Storing internal_139 - # Argument internal_113 - lw $t0, 232($sp) - sw $t0, 0($sp) # Storing internal_113 + # Argument internal_119 + lw $t0, 280($sp) + sw $t0, 0($sp) # Storing internal_119 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 152($sp) # internal_133 = result of function_assign + sw $v1, 200($sp) # internal_139 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - foreach_ancestor_start_8744937301390: + foreach_ancestor_start_8794484734308: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_133 - lw $t0, 152($sp) - sw $t0, 4($sp) # Storing internal_133 + # Argument internal_139 + lw $t0, 200($sp) + sw $t0, 4($sp) # Storing internal_139 - # Argument internal_117 - lw $t0, 216($sp) - sw $t0, 0($sp) # Storing internal_117 + # Argument internal_123 + lw $t0, 264($sp) + sw $t0, 0($sp) # Storing internal_123 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 148($sp) # internal_134 = result of function_less_than + sw $v1, 196($sp) # internal_140 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_134 then goto foreach_ancestor_body_8744937301390 - lw $t0, 136($sp) # Loading the address of the condition + # If internal_140 then goto foreach_ancestor_body_8794484734308 + lw $t0, 184($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_body_8744937301390 + beq $t0, $t1, foreach_ancestor_body_8794484734308 - # Jumping to foreach_ancestor_end_8744937301390 - j foreach_ancestor_end_8744937301390 + # Jumping to foreach_ancestor_end_8794484734308 + j foreach_ancestor_end_8794484734308 - foreach_ancestor_body_8744937301390: + foreach_ancestor_body_8794484734308: - # internal_135 = array internal_121[4 * internal_133] - lw $t0, 140($sp) # $t0 = internal_133 + # internal_141 = array internal_127[4 * internal_139] + lw $t0, 188($sp) # $t0 = internal_139 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 188($sp) # $t1 = internal_121 + lw $t1, 236($sp) # $t1 = internal_127 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - sw $t0, 132($sp) # internal_135 = array internal_121[4 * internal_133] + sw $t0, 180($sp) # internal_141 = array internal_127[4 * internal_139] - # internal_136 = EqualAddress(internal_132, internal_135) - lw $t0, 144($sp) - lw $t1, 132($sp) + # internal_142 = EqualAddress(internal_138, internal_141) + lw $t0, 192($sp) + lw $t1, 180($sp) seq $t2, $t0, $t1 - lw $t0, 128($sp) + lw $t0, 176($sp) sw $t2, 8($t0) - # If internal_136 then goto foreach_ancestor_end_8744937301390 - lw $t0, 128($sp) # Loading the address of the condition + # If internal_142 then goto foreach_ancestor_end_8794484734308 + lw $t0, 176($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_end_8744937301390 + beq $t0, $t1, foreach_ancestor_end_8794484734308 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_133 - lw $t0, 152($sp) - sw $t0, 4($sp) # Storing internal_133 + # Argument internal_139 + lw $t0, 200($sp) + sw $t0, 4($sp) # Storing internal_139 - # Argument internal_114 - lw $t0, 228($sp) - sw $t0, 0($sp) # Storing internal_114 + # Argument internal_120 + lw $t0, 276($sp) + sw $t0, 0($sp) # Storing internal_120 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 152($sp) # internal_133 = result of function_add + sw $v1, 200($sp) # internal_139 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_ancestor_start_8744937301390 - j foreach_ancestor_start_8744937301390 + # Jumping to foreach_ancestor_start_8794484734308 + j foreach_ancestor_start_8794484734308 - foreach_ancestor_end_8744937301390: + foreach_ancestor_end_8794484734308: - # array internal_125[4 * internal_130] = internal_133 - lw $t0, 152($sp) # $t0 = internal_130 + # array internal_131[4 * internal_136] = internal_139 + lw $t0, 200($sp) # $t0 = internal_136 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 172($sp) # $t1 = internal_125 + lw $t1, 220($sp) # $t1 = internal_131 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 140($sp) + lw $t0, 188($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -8205,60 +8468,24 @@ addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_130 - lw $t0, 164($sp) - sw $t0, 4($sp) # Storing internal_130 + # Argument internal_136 + lw $t0, 212($sp) + sw $t0, 4($sp) # Storing internal_136 - # Argument internal_114 - lw $t0, 228($sp) - sw $t0, 0($sp) # Storing internal_114 + # Argument internal_120 + lw $t0, 276($sp) + sw $t0, 0($sp) # Storing internal_120 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 164($sp) # internal_130 = result of function_add + sw $v1, 212($sp) # internal_136 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_type_start_8744937301390 - j foreach_type_start_8744937301390 - - foreach_type_end_8744937301390: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_142[0] = '\n' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 104($sp) # internal_142 = "\n" - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_143[0] = ' ' - - sb $zero, 9($v0) # Null-terminator at the end of the string + # Jumping to foreach_type_start_8794484734308 + j foreach_type_start_8794484734308 - sw $v0, 100($sp) # internal_143 = " " + foreach_type_end_8794484734308: # Allocating Int 0 li $v0, 9 @@ -8270,7 +8497,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 124($sp) # internal_137 = address of allocated object Int + sw $v0, 172($sp) # internal_143 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -8282,7 +8509,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 120($sp) # internal_138 = address of allocated object Int + sw $v0, 168($sp) # internal_144 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -8294,7 +8521,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 116($sp) # internal_139 = address of allocated object Int + sw $v0, 164($sp) # internal_145 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -8306,7 +8533,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 112($sp) # internal_140 = address of allocated object Int + sw $v0, 160($sp) # internal_146 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -8318,161 +8545,161 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 108($sp) # internal_141 = address of allocated object Int + sw $v0, 156($sp) # internal_147 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_140 - lw $t0, 124($sp) - sw $t0, 4($sp) # Storing internal_140 + # Argument internal_146 + lw $t0, 172($sp) + sw $t0, 4($sp) # Storing internal_146 - # Argument internal_117 - lw $t0, 216($sp) - sw $t0, 0($sp) # Storing internal_117 + # Argument internal_123 + lw $t0, 264($sp) + sw $t0, 0($sp) # Storing internal_123 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 124($sp) # internal_140 = result of function_assign + sw $v1, 172($sp) # internal_146 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - foreach_min_start_8744937301390: + foreach_min_start_8794484734308: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_137 - lw $t0, 136($sp) - sw $t0, 4($sp) # Storing internal_137 + # Argument internal_143 + lw $t0, 184($sp) + sw $t0, 4($sp) # Storing internal_143 - # Argument internal_115 - lw $t0, 224($sp) - sw $t0, 0($sp) # Storing internal_115 + # Argument internal_121 + lw $t0, 272($sp) + sw $t0, 0($sp) # Storing internal_121 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 120($sp) # internal_141 = result of function_less_than + sw $v1, 168($sp) # internal_147 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_141 then goto foreach_min_body_8744937301390 - lw $t0, 108($sp) # Loading the address of the condition + # If internal_147 then goto foreach_min_body_8794484734308 + lw $t0, 156($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_min_body_8744937301390 + beq $t0, $t1, foreach_min_body_8794484734308 - # Jumping to foreach_min_end_8744937301390 - j foreach_min_end_8744937301390 + # Jumping to foreach_min_end_8794484734308 + j foreach_min_end_8794484734308 - foreach_min_body_8744937301390: + foreach_min_body_8794484734308: - # internal_139 = array internal_125[4 * internal_137] - lw $t0, 124($sp) # $t0 = internal_137 + # internal_145 = array internal_131[4 * internal_143] + lw $t0, 172($sp) # $t0 = internal_143 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 172($sp) # $t1 = internal_125 + lw $t1, 220($sp) # $t1 = internal_131 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 116($sp) # internal_139 = array internal_125[4 * internal_137] + lw $t2, 164($sp) # internal_145 = array internal_131[4 * internal_143] sw $t0, 8($t2) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_139 - lw $t0, 128($sp) - sw $t0, 4($sp) # Storing internal_139 + # Argument internal_145 + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing internal_145 - # Argument internal_140 - lw $t0, 124($sp) - sw $t0, 0($sp) # Storing internal_140 + # Argument internal_146 + lw $t0, 172($sp) + sw $t0, 0($sp) # Storing internal_146 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 120($sp) # internal_141 = result of function_less_than + sw $v1, 168($sp) # internal_147 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_141 then goto update_min_8744937301390 - lw $t0, 108($sp) # Loading the address of the condition + # If internal_147 then goto update_min_8794484734308 + lw $t0, 156($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, update_min_8744937301390 + beq $t0, $t1, update_min_8794484734308 - # Jumping to update_min_end_8744937301390 - j update_min_end_8744937301390 + # Jumping to update_min_end_8794484734308 + j update_min_end_8794484734308 - update_min_8744937301390: + update_min_8794484734308: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_140 - lw $t0, 124($sp) - sw $t0, 4($sp) # Storing internal_140 + # Argument internal_146 + lw $t0, 172($sp) + sw $t0, 4($sp) # Storing internal_146 - # Argument internal_139 - lw $t0, 128($sp) - sw $t0, 0($sp) # Storing internal_139 + # Argument internal_145 + lw $t0, 176($sp) + sw $t0, 0($sp) # Storing internal_145 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 124($sp) # internal_140 = result of function_assign + sw $v1, 172($sp) # internal_146 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_138 - lw $t0, 132($sp) - sw $t0, 4($sp) # Storing internal_138 + # Argument internal_144 + lw $t0, 180($sp) + sw $t0, 4($sp) # Storing internal_144 - # Argument internal_137 - lw $t0, 136($sp) - sw $t0, 0($sp) # Storing internal_137 + # Argument internal_143 + lw $t0, 184($sp) + sw $t0, 0($sp) # Storing internal_143 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 132($sp) # internal_138 = result of function_assign + sw $v1, 180($sp) # internal_144 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - update_min_end_8744937301390: + update_min_end_8794484734308: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_137 - lw $t0, 136($sp) - sw $t0, 4($sp) # Storing internal_137 + # Argument internal_143 + lw $t0, 184($sp) + sw $t0, 4($sp) # Storing internal_143 - # Argument internal_114 - lw $t0, 228($sp) - sw $t0, 0($sp) # Storing internal_114 + # Argument internal_120 + lw $t0, 276($sp) + sw $t0, 0($sp) # Storing internal_120 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 136($sp) # internal_137 = result of function_add + sw $v1, 184($sp) # internal_143 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_min_start_8744937301390 - j foreach_min_start_8744937301390 + # Jumping to foreach_min_start_8794484734308 + j foreach_min_start_8794484734308 - foreach_min_end_8744937301390: + foreach_min_end_8794484734308: - # initialize Array [internal_115] - lw $t0, 212($sp) # $t0 = internal_115 + # initialize Array [internal_121] + lw $t0, 260($sp) # $t0 = internal_121 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -8480,7 +8707,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 96($sp) # internal_144 = new Array[internal_115] + sw $v0, 152($sp) # internal_148 = new Array[internal_121] # Allocating Int 0 li $v0, 9 @@ -8492,17 +8719,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 92($sp) # internal_145 = address of allocated object Int + sw $v0, 148($sp) # internal_149 = address of allocated object Int - # array internal_144[4 * internal_145] = internal_113 - lw $t0, 92($sp) # $t0 = internal_145 + # array internal_148[4 * internal_149] = internal_119 + lw $t0, 148($sp) # $t0 = internal_149 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 96($sp) # $t1 = internal_144 + lw $t1, 152($sp) # $t1 = internal_148 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 220($sp) + lw $t0, 268($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -8516,17 +8743,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 88($sp) # internal_146 = address of allocated object Int + sw $v0, 144($sp) # internal_150 = address of allocated object Int - # array internal_144[4 * internal_146] = internal_113 - lw $t0, 88($sp) # $t0 = internal_146 + # array internal_148[4 * internal_150] = internal_119 + lw $t0, 144($sp) # $t0 = internal_150 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 96($sp) # $t1 = internal_144 + lw $t1, 152($sp) # $t1 = internal_148 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 220($sp) + lw $t0, 268($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -8540,41 +8767,41 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 84($sp) # internal_147 = address of allocated object Int + sw $v0, 140($sp) # internal_151 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_140 - lw $t0, 124($sp) - sw $t0, 4($sp) # Storing internal_140 + # Argument internal_146 + lw $t0, 172($sp) + sw $t0, 4($sp) # Storing internal_146 - # Argument internal_117 - lw $t0, 216($sp) - sw $t0, 0($sp) # Storing internal_117 + # Argument internal_123 + lw $t0, 264($sp) + sw $t0, 0($sp) # Storing internal_123 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 96($sp) # internal_147 = result of function_equal + sw $v1, 152($sp) # internal_151 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # If internal_147 then goto error_branch_8744937301390 - lw $t0, 84($sp) # Loading the address of the condition + # If internal_151 then goto error_branch_8794484734308 + lw $t0, 140($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, error_branch_8744937301390 + beq $t0, $t1, error_branch_8794484734308 - # array internal_144[4 * internal_138] = internal_114 - lw $t0, 120($sp) # $t0 = internal_138 + # array internal_148[4 * internal_144] = internal_120 + lw $t0, 168($sp) # $t0 = internal_144 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 96($sp) # $t1 = internal_144 + lw $t1, 152($sp) # $t1 = internal_148 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 216($sp) + lw $t0, 264($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -8588,7 +8815,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # internal_148 = address of allocated object Int + sw $v0, 136($sp) # internal_152 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -8600,25 +8827,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 76($sp) # internal_149 = address of allocated object Int + sw $v0, 132($sp) # internal_153 = address of allocated object Int - # internal_148 = array internal_144[4 * internal_149] - lw $t0, 76($sp) # $t0 = internal_149 + # internal_152 = array internal_148[4 * internal_153] + lw $t0, 132($sp) # $t0 = internal_153 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 96($sp) # $t1 = internal_144 + lw $t1, 152($sp) # $t1 = internal_148 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 80($sp) # internal_148 = array internal_144[4 * internal_149] + lw $t2, 136($sp) # internal_152 = array internal_148[4 * internal_153] sw $t0, 8($t2) - # If internal_148 then goto branch_Razz_8744937301390 - lw $t0, 80($sp) # Loading the address of the condition + # If internal_152 then goto branch_Razz_8794484734308 + lw $t0, 136($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Razz_8744937301390 + beq $t0, $t1, branch_Razz_8794484734308 # Allocating Int 1 li $v0, 9 @@ -8630,44 +8857,44 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 72($sp) # internal_150 = address of allocated object Int + sw $v0, 128($sp) # internal_154 = address of allocated object Int - # internal_148 = array internal_144[4 * internal_150] - lw $t0, 72($sp) # $t0 = internal_150 + # internal_152 = array internal_148[4 * internal_154] + lw $t0, 128($sp) # $t0 = internal_154 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 96($sp) # $t1 = internal_144 + lw $t1, 152($sp) # $t1 = internal_148 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 80($sp) # internal_148 = array internal_144[4 * internal_150] + lw $t2, 136($sp) # internal_152 = array internal_148[4 * internal_154] sw $t0, 8($t2) - # If internal_148 then goto branch_Bar_8744937301390 - lw $t0, 80($sp) # Loading the address of the condition + # If internal_152 then goto branch_Bar_8794484734308 + lw $t0, 136($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Bar_8744937301390 + beq $t0, $t1, branch_Bar_8794484734308 - branch_Razz_8744937301390: + branch_Razz_8794484734308: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 492($sp) + lw $t0, 572($sp) sw $t0, 4($sp) # Storing n # Argument self - lw $t0, 688($sp) + lw $t0, 760($sp) sw $t0, 0($sp) # Storing self # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 492($sp) # n = result of function_assign + sw $v1, 572($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bar @@ -8677,110 +8904,110 @@ la $t0, type_Bar # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 60($sp) # internal_153 = address of allocated object Bar + sw $v0, 116($sp) # internal_157 = address of allocated object Bar # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_153 - lw $t0, 68($sp) - sw $t0, 0($sp) # Storing internal_153 + # Argument internal_157 + lw $t0, 124($sp) + sw $t0, 0($sp) # Storing internal_157 # Calling function function___init___at_Bar jal function___init___at_Bar lw $ra, 4($sp) - sw $v1, 68($sp) # internal_153 = result of function___init___at_Bar + sw $v1, 124($sp) # internal_157 = result of function___init___at_Bar addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_151 - lw $t0, 80($sp) - sw $t0, 4($sp) # Storing internal_151 + # Argument internal_155 + lw $t0, 136($sp) + sw $t0, 4($sp) # Storing internal_155 - # Argument internal_153 - lw $t0, 72($sp) - sw $t0, 0($sp) # Storing internal_153 + # Argument internal_157 + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing internal_157 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 80($sp) # internal_151 = result of function_assign + sw $v1, 136($sp) # internal_155 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_151 = internal_153 - lw $t0, 60($sp) - sw $t0, 68($sp) + # internal_155 = internal_157 + lw $t0, 116($sp) + sw $t0, 124($sp) - # Jumping to branch_end_8744937301390 - j branch_end_8744937301390 + # Jumping to branch_end_8794484734308 + j branch_end_8794484734308 - branch_Bar_8744937301390: + branch_Bar_8794484734308: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 492($sp) + lw $t0, 572($sp) sw $t0, 4($sp) # Storing n # Argument self - lw $t0, 688($sp) + lw $t0, 760($sp) sw $t0, 0($sp) # Storing self # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 492($sp) # n = result of function_assign + sw $v1, 572($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_151 - lw $t0, 80($sp) - sw $t0, 4($sp) # Storing internal_151 + # Argument internal_155 + lw $t0, 136($sp) + sw $t0, 4($sp) # Storing internal_155 # Argument n - lw $t0, 492($sp) + lw $t0, 572($sp) sw $t0, 0($sp) # Storing n # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 80($sp) # internal_151 = result of function_assign + sw $v1, 136($sp) # internal_155 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_151 = n - lw $t0, 480($sp) - sw $t0, 68($sp) + # internal_155 = n + lw $t0, 560($sp) + sw $t0, 124($sp) - # Jumping to branch_end_8744937301390 - j branch_end_8744937301390 + # Jumping to branch_end_8794484734308 + j branch_end_8794484734308 - error_branch_8744937301390: + error_branch_8794484734308: - branch_end_8744937301390: + branch_end_8794484734308: # Set attribute e of self - lw $t0, 676($sp) # $t0 = self - lw $t1, 68($sp) # $t1 = internal_151 - beq $t1, $zero, object_set_attribute_8744937271893 + lw $t0, 748($sp) # $t0 = self + lw $t1, 124($sp) # $t1 = internal_155 + beq $t1, $zero, object_set_attribute_8794484646446 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937271893 + beq $t6, $t5, int_set_attribute_8794484646446 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937271893 - j object_set_attribute_8744937271893 - int_set_attribute_8744937271893: + beq $t6, $t5, bool_set_attribute_8794484646446 + j object_set_attribute_8794484646446 + int_set_attribute_8794484646446: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8788,9 +9015,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 28($t0) # self.e = internal_151 - j end_set_attribute_8744937271893 - bool_set_attribute_8744937271893: + sw $v0, 28($t0) # self.e = internal_155 + j end_set_attribute_8794484646446 + bool_set_attribute_8794484646446: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8798,25 +9025,25 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 28($t0) # self.e = internal_151 - j end_set_attribute_8744937271893 - object_set_attribute_8744937271893: - sw $t1, 28($t0) # self.e = internal_151 - end_set_attribute_8744937271893: + sw $v0, 28($t0) # self.e = internal_155 + j end_set_attribute_8794484646446 + object_set_attribute_8794484646446: + sw $t1, 28($t0) # self.e = internal_155 + end_set_attribute_8794484646446: # Get attribute a of self - lw $t0, 676($sp) # Get the address of self - lw $t1, 20($t0) # Get the attribute 'a' from the instance + lw $t0, 748($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'a' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8744937274935 + beq $t6, $t5, int_get_attribute_8794484649521 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8744937274935 - j object_get_attribute_8744937274935 - int_get_attribute_8744937274935: + beq $t6, $t5, bool_get_attribute_8794484649521 + j object_get_attribute_8794484649521 + int_get_attribute_8794484649521: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8824,9 +9051,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 52($sp) # internal_155 = self.a - j end_get_attribute_8744937274935 - bool_get_attribute_8744937274935: + sw $v0, 108($sp) # internal_159 = self.a + j end_get_attribute_8794484649521 + bool_get_attribute_8794484649521: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8834,39 +9061,62 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 52($sp) # internal_155 = self.a - j end_get_attribute_8744937274935 - object_get_attribute_8744937274935: - sw $t1, 52($sp) # internal_155 = a - end_get_attribute_8744937274935: + sw $v0, 108($sp) # internal_159 = self.a + j end_get_attribute_8794484649521 + object_get_attribute_8794484649521: + sw $t1, 108($sp) # internal_159 = self.a + end_get_attribute_8794484649521: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_161 = address of allocated object Int + + # Get method doh of Bazz + lw $t0, 108($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 100($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 96($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_155 - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing internal_155 + # Argument internal_159 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_159 - # Calling function function_doh_at_Foo - jal function_doh_at_Foo + # Calling function function_doh_at_Bazz + jal function_doh_at_Bazz lw $ra, 4($sp) - sw $v1, 56($sp) # internal_156 = result of function_doh_at_Foo + sw $v1, 112($sp) # internal_160 = result of function_doh_at_Bazz addi $sp, $sp, 8 # Freeing space for arguments # Get attribute g of self - lw $t0, 676($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'g' from the instance + lw $t0, 748($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'g' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8744937274965 + beq $t6, $t5, int_get_attribute_8794484649575 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8744937274965 - j object_get_attribute_8744937274965 - int_get_attribute_8744937274965: + beq $t6, $t5, bool_get_attribute_8794484649575 + j object_get_attribute_8794484649575 + int_get_attribute_8794484649575: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8874,9 +9124,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 44($sp) # internal_157 = self.g - j end_get_attribute_8744937274965 - bool_get_attribute_8744937274965: + sw $v0, 92($sp) # internal_163 = self.g + j end_get_attribute_8794484649575 + bool_get_attribute_8794484649575: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8884,57 +9134,81 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 44($sp) # internal_157 = self.g - j end_get_attribute_8744937274965 - object_get_attribute_8744937274965: - sw $t1, 44($sp) # internal_157 = g - end_get_attribute_8744937274965: + sw $v0, 92($sp) # internal_163 = self.g + j end_get_attribute_8794484649575 + object_get_attribute_8794484649575: + sw $t1, 92($sp) # internal_163 = self.g + end_get_attribute_8794484649575: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_165 = address of allocated object Int + + # Get method doh of Foo + lw $t0, 92($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 84($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 80($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_157 - lw $t0, 52($sp) - sw $t0, 0($sp) # Storing internal_157 + # Argument internal_163 + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing internal_163 - # Calling function function_doh_at_Foo - jal function_doh_at_Foo + # Calling function internal_166 + lw $t0, 88($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 48($sp) # internal_158 = result of function_doh_at_Foo + sw $v1, 96($sp) # internal_164 = result of internal_166 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_156 - lw $t0, 60($sp) - sw $t0, 4($sp) # Storing internal_156 + # Argument internal_160 + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing internal_160 - # Argument internal_158 - lw $t0, 52($sp) - sw $t0, 0($sp) # Storing internal_158 + # Argument internal_164 + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing internal_164 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 48($sp) # internal_159 = result of function_add + sw $v1, 88($sp) # internal_167 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Get attribute e of self - lw $t0, 676($sp) # Get the address of self - lw $t1, 28($t0) # Get the attribute 'e' from the instance + lw $t0, 748($sp) # Get the address of self + lw $t1, 28($t0) # Get the attribute 'e' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8744937275010 + beq $t6, $t5, int_get_attribute_8794484649644 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8744937275010 - j object_get_attribute_8744937275010 - int_get_attribute_8744937275010: + beq $t6, $t5, bool_get_attribute_8794484649644 + j object_get_attribute_8794484649644 + int_get_attribute_8794484649644: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8942,9 +9216,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 32($sp) # internal_160 = self.e - j end_get_attribute_8744937275010 - bool_get_attribute_8744937275010: + sw $v0, 72($sp) # internal_168 = self.e + j end_get_attribute_8794484649644 + bool_get_attribute_8794484649644: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8952,122 +9226,194 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 32($sp) # internal_160 = self.e - j end_get_attribute_8744937275010 - object_get_attribute_8744937275010: - sw $t1, 32($sp) # internal_160 = e - end_get_attribute_8744937275010: - - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + sw $v0, 72($sp) # internal_168 = self.e + j end_get_attribute_8794484649644 + object_get_attribute_8794484649644: + sw $t1, 72($sp) # internal_168 = self.e + end_get_attribute_8794484649644: - # Argument internal_160 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_160 + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Calling function function_doh_at_Foo - jal function_doh_at_Foo - lw $ra, 4($sp) - sw $v1, 36($sp) # internal_161 = result of function_doh_at_Foo - addi $sp, $sp, 8 # Freeing space for arguments + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_170 = address of allocated object Int + + # Get method doh of Bar + lw $t0, 72($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 64($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 60($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_168 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_168 + + # Calling function internal_171 + lw $t0, 68($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 76($sp) # internal_169 = result of internal_171 + addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_159 - lw $t0, 48($sp) - sw $t0, 4($sp) # Storing internal_159 + # Argument internal_167 + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing internal_167 - # Argument internal_161 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_161 + # Argument internal_169 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_169 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 36($sp) # internal_162 = result of function_add + sw $v1, 68($sp) # internal_172 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_174 = address of allocated object Int + + # Get method doh of Bar + lw $t0, 748($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 48($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 44($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 684($sp) + lw $t0, 756($sp) sw $t0, 0($sp) # Storing self - # Calling function function_doh_at_Foo - jal function_doh_at_Foo + # Calling function internal_175 + lw $t0, 52($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 28($sp) # internal_163 = result of function_doh_at_Foo + sw $v1, 60($sp) # internal_173 = result of internal_175 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_162 - lw $t0, 36($sp) - sw $t0, 4($sp) # Storing internal_162 + # Argument internal_172 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_172 - # Argument internal_163 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_163 + # Argument internal_173 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_173 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 28($sp) # internal_164 = result of function_add + sw $v1, 52($sp) # internal_176 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_178 = address of allocated object Int + + # Get method printh of Bar + lw $t0, 748($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 32($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 28($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 684($sp) + lw $t0, 756($sp) sw $t0, 0($sp) # Storing self - # Calling function function_printh_at_Bazz - jal function_printh_at_Bazz + # Calling function internal_179 + lw $t0, 36($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 20($sp) # internal_165 = result of function_printh_at_Bazz + sw $v1, 44($sp) # internal_177 = result of internal_179 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_164 - lw $t0, 28($sp) - sw $t0, 4($sp) # Storing internal_164 + # Argument internal_176 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_176 - # Argument internal_165 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_165 + # Argument internal_177 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_177 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 20($sp) # internal_166 = result of function_add + sw $v1, 36($sp) # internal_180 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Set attribute f of self - lw $t0, 676($sp) # $t0 = self - lw $t1, 8($sp) # $t1 = internal_166 - beq $t1, $zero, object_set_attribute_8744937274603 + lw $t0, 748($sp) # $t0 = self + lw $t1, 24($sp) # $t1 = internal_180 + beq $t1, $zero, object_set_attribute_8794484649189 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937274603 + beq $t6, $t5, int_set_attribute_8794484649189 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937274603 - j object_set_attribute_8744937274603 - int_set_attribute_8744937274603: + beq $t6, $t5, bool_set_attribute_8794484649189 + j object_set_attribute_8794484649189 + int_set_attribute_8794484649189: li $v0, 9 addi $a0, $zero, 12 syscall @@ -9075,9 +9421,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 32($t0) # self.f = internal_166 - j end_set_attribute_8744937274603 - bool_set_attribute_8744937274603: + sw $v0, 32($t0) # self.f = internal_180 + j end_set_attribute_8794484649189 + bool_set_attribute_8794484649189: li $v0, 9 addi $a0, $zero, 12 syscall @@ -9085,40 +9431,64 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 32($t0) # self.f = internal_166 - j end_set_attribute_8744937274603 - object_set_attribute_8744937274603: - sw $t1, 32($t0) # self.f = internal_166 - end_set_attribute_8744937274603: + sw $v0, 32($t0) # self.f = internal_180 + j end_set_attribute_8794484649189 + object_set_attribute_8794484649189: + sw $t1, 32($t0) # self.f = internal_180 + end_set_attribute_8794484649189: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_182 = address of allocated object Int + + # Get method doh of Bar + lw $t0, 748($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 684($sp) + lw $t0, 756($sp) sw $t0, 0($sp) # Storing self - # Calling function function_doh_at_Foo - jal function_doh_at_Foo + # Calling function internal_183 + lw $t0, 20($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 12($sp) # internal_167 = result of function_doh_at_Foo + sw $v1, 28($sp) # internal_181 = result of internal_183 addi $sp, $sp, 8 # Freeing space for arguments # Set attribute c of self - lw $t0, 676($sp) # $t0 = self - lw $t1, 4($sp) # $t1 = internal_167 - beq $t1, $zero, object_set_attribute_8744937275109 + lw $t0, 748($sp) # $t0 = self + lw $t1, 20($sp) # $t1 = internal_181 + beq $t1, $zero, object_set_attribute_8794484650075 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937275109 + beq $t6, $t5, int_set_attribute_8794484650075 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937275109 - j object_set_attribute_8744937275109 - int_set_attribute_8744937275109: + beq $t6, $t5, bool_set_attribute_8794484650075 + j object_set_attribute_8794484650075 + int_set_attribute_8794484650075: li $v0, 9 addi $a0, $zero, 12 syscall @@ -9126,9 +9496,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 36($t0) # self.c = internal_167 - j end_set_attribute_8744937275109 - bool_set_attribute_8744937275109: + sw $v0, 36($t0) # self.c = internal_181 + j end_set_attribute_8794484650075 + bool_set_attribute_8794484650075: li $v0, 9 addi $a0, $zero, 12 syscall @@ -9136,40 +9506,64 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 36($t0) # self.c = internal_167 - j end_set_attribute_8744937275109 - object_set_attribute_8744937275109: - sw $t1, 36($t0) # self.c = internal_167 - end_set_attribute_8744937275109: + sw $v0, 36($t0) # self.c = internal_181 + j end_set_attribute_8794484650075 + object_set_attribute_8794484650075: + sw $t1, 36($t0) # self.c = internal_181 + end_set_attribute_8794484650075: + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_185 = address of allocated object Int + + # Get method printh of Bar + lw $t0, 748($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 684($sp) + lw $t0, 756($sp) sw $t0, 0($sp) # Storing self - # Calling function function_printh_at_Bazz - jal function_printh_at_Bazz + # Calling function internal_186 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_168 = result of function_printh_at_Bazz + sw $v1, 16($sp) # internal_184 = result of internal_186 addi $sp, $sp, 8 # Freeing space for arguments # Set attribute d of self - lw $t0, 676($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_168 - beq $t1, $zero, object_set_attribute_8744937275106 + lw $t0, 748($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_184 + beq $t1, $zero, object_set_attribute_8794484650120 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937275106 + beq $t6, $t5, int_set_attribute_8794484650120 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937275106 - j object_set_attribute_8744937275106 - int_set_attribute_8744937275106: + beq $t6, $t5, bool_set_attribute_8794484650120 + j object_set_attribute_8794484650120 + int_set_attribute_8794484650120: li $v0, 9 addi $a0, $zero, 12 syscall @@ -9177,9 +9571,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 40($t0) # self.d = internal_168 - j end_set_attribute_8744937275106 - bool_set_attribute_8744937275106: + sw $v0, 40($t0) # self.d = internal_184 + j end_set_attribute_8794484650120 + bool_set_attribute_8794484650120: li $v0, 9 addi $a0, $zero, 12 syscall @@ -9187,27 +9581,27 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 40($t0) # self.d = internal_168 - j end_set_attribute_8744937275106 - object_set_attribute_8744937275106: - sw $t1, 40($t0) # self.d = internal_168 - end_set_attribute_8744937275106: + sw $v0, 40($t0) # self.d = internal_184 + j end_set_attribute_8794484650120 + object_set_attribute_8794484650120: + sw $t1, 40($t0) # self.d = internal_184 + end_set_attribute_8794484650120: # Loading return value in $v1 - lw $v1, 676($sp) + lw $v1, 748($sp) # Freeing space for local variables - addi $sp, $sp, 676 + addi $sp, $sp, 748 jr $ra function___init___at_Razz: # Function parameters - # $ra = 672($sp) - # self = 668($sp) + # $ra = 728($sp) + # self = 724($sp) # Reserving space for local variables - addi $sp, $sp, -668 + addi $sp, $sp, -724 # Allocating Int 1 li $v0, 9 @@ -9219,22 +9613,22 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 664($sp) # internal_0 = address of allocated object Int + sw $v0, 720($sp) # internal_0 = address of allocated object Int # Set attribute h of self - lw $t0, 668($sp) # $t0 = self - lw $t1, 664($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8744937275700 + lw $t0, 724($sp) # $t0 = self + lw $t1, 720($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8794484650198 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937275700 + beq $t6, $t5, int_set_attribute_8794484650198 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937275700 - j object_set_attribute_8744937275700 - int_set_attribute_8744937275700: + beq $t6, $t5, bool_set_attribute_8794484650198 + j object_set_attribute_8794484650198 + int_set_attribute_8794484650198: li $v0, 9 addi $a0, $zero, 12 syscall @@ -9243,8 +9637,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.h = internal_0 - j end_set_attribute_8744937275700 - bool_set_attribute_8744937275700: + j end_set_attribute_8794484650198 + bool_set_attribute_8794484650198: li $v0, 9 addi $a0, $zero, 12 syscall @@ -9253,10 +9647,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.h = internal_0 - j end_set_attribute_8744937275700 - object_set_attribute_8744937275700: + j end_set_attribute_8794484650198 + object_set_attribute_8794484650198: sw $t1, 8($t0) # self.h = internal_0 - end_set_attribute_8744937275700: + end_set_attribute_8794484650198: # Allocating Int 0 li $v0, 9 @@ -9268,7 +9662,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 660($sp) # internal_1 = address of allocated object Int + sw $v0, 716($sp) # internal_1 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -9280,7 +9674,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 656($sp) # internal_2 = address of allocated object Int + sw $v0, 712($sp) # internal_2 = address of allocated object Int # Allocating Int 4 li $v0, 9 @@ -9292,10 +9686,10 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 652($sp) # internal_3 = address of allocated object Int + sw $v0, 708($sp) # internal_3 = address of allocated object Int # Allocating NUll to internal_4 - sw $zero, 648($sp) # internal_4 = 0 + sw $zero, 704($sp) # internal_4 = 0 # Allocating Int 0 li $v0, 9 @@ -9307,7 +9701,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 644($sp) # internal_5 = address of allocated object Int + sw $v0, 700($sp) # internal_5 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -9319,66 +9713,66 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 632($sp) # internal_8 = address of allocated object Int + sw $v0, 688($sp) # internal_8 = address of allocated object Int # internal_6 = typeof self that is the first word of the object - lw $t0, 668($sp) + lw $t0, 724($sp) lw $t0, 0($t0) - sw $t0, 640($sp) + sw $t0, 696($sp) # internal_7 = internal_6 - lw $t0, 640($sp) - sw $t0, 636($sp) + lw $t0, 696($sp) + sw $t0, 692($sp) - while_start_8744937301489: + while_start_8794484717692: # internal_8 = EqualAddress(internal_7, internal_4) - lw $t0, 636($sp) - lw $t1, 648($sp) + lw $t0, 692($sp) + lw $t1, 704($sp) seq $t2, $t0, $t1 - lw $t0, 632($sp) + lw $t0, 688($sp) sw $t2, 8($t0) - # If internal_8 then goto while_end_8744937301489 - lw $t0, 632($sp) # Loading the address of the condition + # If internal_8 then goto while_end_8794484717692 + lw $t0, 688($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_end_8744937301489 + beq $t0, $t1, while_end_8794484717692 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_5 - lw $t0, 656($sp) + lw $t0, 712($sp) sw $t0, 4($sp) # Storing internal_5 # Argument internal_2 - lw $t0, 668($sp) + lw $t0, 724($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 656($sp) # internal_5 = result of function_add + sw $v1, 712($sp) # internal_5 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # internal_7 = ancestor of internal_7 - lw $t0, 636($sp) + lw $t0, 692($sp) lw $t0, 4($t0) - sw $t0, 636($sp) + sw $t0, 692($sp) - # Jumping to while_start_8744937301489 - j while_start_8744937301489 + # Jumping to while_start_8794484717692 + j while_start_8794484717692 - while_end_8744937301489: + while_end_8794484717692: # internal_7 = internal_6 - lw $t0, 640($sp) - sw $t0, 636($sp) + lw $t0, 696($sp) + sw $t0, 692($sp) # initialize Array [internal_5] - lw $t0, 644($sp) # $t0 = internal_5 + lw $t0, 700($sp) # $t0 = internal_5 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -9386,7 +9780,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 628($sp) # internal_9 = new Array[internal_5] + sw $v0, 684($sp) # internal_9 = new Array[internal_5] # Allocating Int 0 li $v0, 9 @@ -9398,7 +9792,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 624($sp) # internal_10 = address of allocated object Int + sw $v0, 680($sp) # internal_10 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -9410,80 +9804,80 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 620($sp) # internal_11 = address of allocated object Int + sw $v0, 676($sp) # internal_11 = address of allocated object Int - foreach_start_8744937301489: + foreach_start_8794484717692: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_10 - lw $t0, 636($sp) + lw $t0, 692($sp) sw $t0, 4($sp) # Storing internal_10 # Argument internal_5 - lw $t0, 656($sp) + lw $t0, 712($sp) sw $t0, 0($sp) # Storing internal_5 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 632($sp) # internal_11 = result of function_less_than + sw $v1, 688($sp) # internal_11 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_11 then goto foreach_body_8744937301489 - lw $t0, 620($sp) # Loading the address of the condition + # If internal_11 then goto foreach_body_8794484717692 + lw $t0, 676($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_body_8744937301489 + beq $t0, $t1, foreach_body_8794484717692 - # Jumping to foreach_end_8744937301489 - j foreach_end_8744937301489 + # Jumping to foreach_end_8794484717692 + j foreach_end_8794484717692 - foreach_body_8744937301489: + foreach_body_8794484717692: # array internal_9[4 * internal_10] = internal_7 - lw $t0, 624($sp) # $t0 = internal_10 + lw $t0, 680($sp) # $t0 = internal_10 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 628($sp) # $t1 = internal_9 + lw $t1, 684($sp) # $t1 = internal_9 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 636($sp) + lw $t0, 692($sp) sw $t0, 0($t1) # internal_7 = ancestor of internal_7 - lw $t0, 636($sp) + lw $t0, 692($sp) lw $t0, 4($t0) - sw $t0, 636($sp) + sw $t0, 692($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_10 - lw $t0, 636($sp) + lw $t0, 692($sp) sw $t0, 4($sp) # Storing internal_10 # Argument internal_2 - lw $t0, 668($sp) + lw $t0, 724($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 636($sp) # internal_10 = result of function_add + sw $v1, 692($sp) # internal_10 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_start_8744937301489 - j foreach_start_8744937301489 + # Jumping to foreach_start_8794484717692 + j foreach_start_8794484717692 - foreach_end_8744937301489: + foreach_end_8794484717692: # initialize Array [internal_3] - lw $t0, 652($sp) # $t0 = internal_3 + lw $t0, 708($sp) # $t0 = internal_3 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -9491,10 +9885,10 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 616($sp) # internal_12 = new Array[internal_3] + sw $v0, 672($sp) # internal_12 = new Array[internal_3] # initialize Array [internal_3] - lw $t0, 652($sp) # $t0 = internal_3 + lw $t0, 708($sp) # $t0 = internal_3 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -9502,7 +9896,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 612($sp) # internal_13 = new Array[internal_3] + sw $v0, 668($sp) # internal_13 = new Array[internal_3] # Allocating Int 0 li $v0, 9 @@ -9514,32 +9908,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 604($sp) # internal_15 = address of allocated object Int + sw $v0, 660($sp) # internal_15 = address of allocated object Int # internal_14 = direction of Bazz la $t0, type_Bazz - sw $t0, 608($sp) + sw $t0, 664($sp) # array internal_12[4 * internal_15] = internal_14 - lw $t0, 604($sp) # $t0 = internal_15 + lw $t0, 660($sp) # $t0 = internal_15 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 616($sp) # $t1 = internal_12 + lw $t1, 672($sp) # $t1 = internal_12 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 608($sp) + lw $t0, 664($sp) sw $t0, 0($t1) # array internal_13[4 * internal_15] = internal_5 - lw $t0, 604($sp) # $t0 = internal_15 + lw $t0, 660($sp) # $t0 = internal_15 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 612($sp) # $t1 = internal_13 + lw $t1, 668($sp) # $t1 = internal_13 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 644($sp) + lw $t0, 700($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -9553,32 +9947,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 596($sp) # internal_17 = address of allocated object Int + sw $v0, 652($sp) # internal_17 = address of allocated object Int # internal_16 = direction of Razz la $t0, type_Razz - sw $t0, 600($sp) + sw $t0, 656($sp) # array internal_12[4 * internal_17] = internal_16 - lw $t0, 596($sp) # $t0 = internal_17 + lw $t0, 652($sp) # $t0 = internal_17 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 616($sp) # $t1 = internal_12 + lw $t1, 672($sp) # $t1 = internal_12 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 600($sp) + lw $t0, 656($sp) sw $t0, 0($t1) # array internal_13[4 * internal_17] = internal_5 - lw $t0, 596($sp) # $t0 = internal_17 + lw $t0, 652($sp) # $t0 = internal_17 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 612($sp) # $t1 = internal_13 + lw $t1, 668($sp) # $t1 = internal_13 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 644($sp) + lw $t0, 700($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -9592,32 +9986,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 588($sp) # internal_19 = address of allocated object Int + sw $v0, 644($sp) # internal_19 = address of allocated object Int # internal_18 = direction of Foo la $t0, type_Foo - sw $t0, 592($sp) + sw $t0, 648($sp) # array internal_12[4 * internal_19] = internal_18 - lw $t0, 588($sp) # $t0 = internal_19 + lw $t0, 644($sp) # $t0 = internal_19 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 616($sp) # $t1 = internal_12 + lw $t1, 672($sp) # $t1 = internal_12 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 592($sp) + lw $t0, 648($sp) sw $t0, 0($t1) # array internal_13[4 * internal_19] = internal_5 - lw $t0, 588($sp) # $t0 = internal_19 + lw $t0, 644($sp) # $t0 = internal_19 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 612($sp) # $t1 = internal_13 + lw $t1, 668($sp) # $t1 = internal_13 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 644($sp) + lw $t0, 700($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -9631,32 +10025,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 580($sp) # internal_21 = address of allocated object Int + sw $v0, 636($sp) # internal_21 = address of allocated object Int # internal_20 = direction of Bar la $t0, type_Bar - sw $t0, 584($sp) + sw $t0, 640($sp) # array internal_12[4 * internal_21] = internal_20 - lw $t0, 580($sp) # $t0 = internal_21 + lw $t0, 636($sp) # $t0 = internal_21 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 616($sp) # $t1 = internal_12 + lw $t1, 672($sp) # $t1 = internal_12 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 584($sp) + lw $t0, 640($sp) sw $t0, 0($t1) # array internal_13[4 * internal_21] = internal_5 - lw $t0, 580($sp) # $t0 = internal_21 + lw $t0, 636($sp) # $t0 = internal_21 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 612($sp) # $t1 = internal_13 + lw $t1, 668($sp) # $t1 = internal_13 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 644($sp) + lw $t0, 700($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -9670,7 +10064,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 576($sp) # internal_22 = address of allocated object Int + sw $v0, 632($sp) # internal_22 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -9682,7 +10076,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 572($sp) # internal_23 = address of allocated object Int + sw $v0, 628($sp) # internal_23 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -9694,7 +10088,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 564($sp) # internal_25 = address of allocated object Int + sw $v0, 620($sp) # internal_25 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -9706,7 +10100,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 560($sp) # internal_26 = address of allocated object Int + sw $v0, 616($sp) # internal_26 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -9718,155 +10112,155 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 552($sp) # internal_28 = address of allocated object Int + sw $v0, 608($sp) # internal_28 = address of allocated object Int - foreach_type_start_8744937301489: + foreach_type_start_8794484717692: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_22 - lw $t0, 588($sp) + lw $t0, 644($sp) sw $t0, 4($sp) # Storing internal_22 # Argument internal_3 - lw $t0, 664($sp) + lw $t0, 720($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 584($sp) # internal_23 = result of function_less_than + sw $v1, 640($sp) # internal_23 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_23 then goto foreach_type_body_8744937301489 - lw $t0, 572($sp) # Loading the address of the condition + # If internal_23 then goto foreach_type_body_8794484717692 + lw $t0, 628($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_type_body_8744937301489 + beq $t0, $t1, foreach_type_body_8794484717692 - # Jumping to foreach_type_end_8744937301489 - j foreach_type_end_8744937301489 + # Jumping to foreach_type_end_8794484717692 + j foreach_type_end_8794484717692 - foreach_type_body_8744937301489: + foreach_type_body_8794484717692: # internal_24 = array internal_12[4 * internal_22] - lw $t0, 576($sp) # $t0 = internal_22 + lw $t0, 632($sp) # $t0 = internal_22 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 616($sp) # $t1 = internal_12 + lw $t1, 672($sp) # $t1 = internal_12 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - sw $t0, 568($sp) # internal_24 = array internal_12[4 * internal_22] + sw $t0, 624($sp) # internal_24 = array internal_12[4 * internal_22] # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_25 - lw $t0, 576($sp) + lw $t0, 632($sp) sw $t0, 4($sp) # Storing internal_25 # Argument internal_1 - lw $t0, 672($sp) + lw $t0, 728($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 576($sp) # internal_25 = result of function_assign + sw $v1, 632($sp) # internal_25 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - foreach_ancestor_start_8744937301489: + foreach_ancestor_start_8794484717692: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_25 - lw $t0, 576($sp) + lw $t0, 632($sp) sw $t0, 4($sp) # Storing internal_25 # Argument internal_5 - lw $t0, 656($sp) + lw $t0, 712($sp) sw $t0, 0($sp) # Storing internal_5 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 572($sp) # internal_26 = result of function_less_than + sw $v1, 628($sp) # internal_26 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_26 then goto foreach_ancestor_body_8744937301489 - lw $t0, 560($sp) # Loading the address of the condition + # If internal_26 then goto foreach_ancestor_body_8794484717692 + lw $t0, 616($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_body_8744937301489 + beq $t0, $t1, foreach_ancestor_body_8794484717692 - # Jumping to foreach_ancestor_end_8744937301489 - j foreach_ancestor_end_8744937301489 + # Jumping to foreach_ancestor_end_8794484717692 + j foreach_ancestor_end_8794484717692 - foreach_ancestor_body_8744937301489: + foreach_ancestor_body_8794484717692: # internal_27 = array internal_9[4 * internal_25] - lw $t0, 564($sp) # $t0 = internal_25 + lw $t0, 620($sp) # $t0 = internal_25 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 628($sp) # $t1 = internal_9 + lw $t1, 684($sp) # $t1 = internal_9 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - sw $t0, 556($sp) # internal_27 = array internal_9[4 * internal_25] + sw $t0, 612($sp) # internal_27 = array internal_9[4 * internal_25] # internal_28 = EqualAddress(internal_24, internal_27) - lw $t0, 568($sp) - lw $t1, 556($sp) + lw $t0, 624($sp) + lw $t1, 612($sp) seq $t2, $t0, $t1 - lw $t0, 552($sp) + lw $t0, 608($sp) sw $t2, 8($t0) - # If internal_28 then goto foreach_ancestor_end_8744937301489 - lw $t0, 552($sp) # Loading the address of the condition + # If internal_28 then goto foreach_ancestor_end_8794484717692 + lw $t0, 608($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_end_8744937301489 + beq $t0, $t1, foreach_ancestor_end_8794484717692 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_25 - lw $t0, 576($sp) + lw $t0, 632($sp) sw $t0, 4($sp) # Storing internal_25 # Argument internal_2 - lw $t0, 668($sp) + lw $t0, 724($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 576($sp) # internal_25 = result of function_add + sw $v1, 632($sp) # internal_25 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_ancestor_start_8744937301489 - j foreach_ancestor_start_8744937301489 + # Jumping to foreach_ancestor_start_8794484717692 + j foreach_ancestor_start_8794484717692 - foreach_ancestor_end_8744937301489: + foreach_ancestor_end_8794484717692: # array internal_13[4 * internal_22] = internal_25 - lw $t0, 576($sp) # $t0 = internal_22 + lw $t0, 632($sp) # $t0 = internal_22 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 612($sp) # $t1 = internal_13 + lw $t1, 668($sp) # $t1 = internal_13 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 564($sp) + lw $t0, 620($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -9875,59 +10269,23 @@ sw $ra, 8($sp) # Storing return address # Argument internal_22 - lw $t0, 588($sp) + lw $t0, 644($sp) sw $t0, 4($sp) # Storing internal_22 # Argument internal_2 - lw $t0, 668($sp) + lw $t0, 724($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 588($sp) # internal_22 = result of function_add + sw $v1, 644($sp) # internal_22 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_type_start_8744937301489 - j foreach_type_start_8744937301489 - - foreach_type_end_8744937301489: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_34[0] = '\n' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 528($sp) # internal_34 = "\n" - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_35[0] = ' ' + # Jumping to foreach_type_start_8794484717692 + j foreach_type_start_8794484717692 - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 524($sp) # internal_35 = " " + foreach_type_end_8794484717692: # Allocating Int 0 li $v0, 9 @@ -9939,7 +10297,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 548($sp) # internal_29 = address of allocated object Int + sw $v0, 604($sp) # internal_29 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -9951,7 +10309,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 544($sp) # internal_30 = address of allocated object Int + sw $v0, 600($sp) # internal_30 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -9963,7 +10321,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 540($sp) # internal_31 = address of allocated object Int + sw $v0, 596($sp) # internal_31 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -9975,7 +10333,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 536($sp) # internal_32 = address of allocated object Int + sw $v0, 592($sp) # internal_32 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -9987,67 +10345,67 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 532($sp) # internal_33 = address of allocated object Int + sw $v0, 588($sp) # internal_33 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_32 - lw $t0, 548($sp) + lw $t0, 604($sp) sw $t0, 4($sp) # Storing internal_32 # Argument internal_5 - lw $t0, 656($sp) + lw $t0, 712($sp) sw $t0, 0($sp) # Storing internal_5 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 548($sp) # internal_32 = result of function_assign + sw $v1, 604($sp) # internal_32 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - foreach_min_start_8744937301489: + foreach_min_start_8794484717692: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_29 - lw $t0, 560($sp) + lw $t0, 616($sp) sw $t0, 4($sp) # Storing internal_29 # Argument internal_3 - lw $t0, 664($sp) + lw $t0, 720($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 544($sp) # internal_33 = result of function_less_than + sw $v1, 600($sp) # internal_33 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_33 then goto foreach_min_body_8744937301489 - lw $t0, 532($sp) # Loading the address of the condition + # If internal_33 then goto foreach_min_body_8794484717692 + lw $t0, 588($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_min_body_8744937301489 + beq $t0, $t1, foreach_min_body_8794484717692 - # Jumping to foreach_min_end_8744937301489 - j foreach_min_end_8744937301489 + # Jumping to foreach_min_end_8794484717692 + j foreach_min_end_8794484717692 - foreach_min_body_8744937301489: + foreach_min_body_8794484717692: # internal_31 = array internal_13[4 * internal_29] - lw $t0, 548($sp) # $t0 = internal_29 + lw $t0, 604($sp) # $t0 = internal_29 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 612($sp) # $t1 = internal_13 + lw $t1, 668($sp) # $t1 = internal_13 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 540($sp) # internal_31 = array internal_13[4 * internal_29] + lw $t2, 596($sp) # internal_31 = array internal_13[4 * internal_29] sw $t0, 8($t2) # Passing function arguments @@ -10055,46 +10413,46 @@ sw $ra, 8($sp) # Storing return address # Argument internal_31 - lw $t0, 552($sp) + lw $t0, 608($sp) sw $t0, 4($sp) # Storing internal_31 # Argument internal_32 - lw $t0, 548($sp) + lw $t0, 604($sp) sw $t0, 0($sp) # Storing internal_32 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 544($sp) # internal_33 = result of function_less_than + sw $v1, 600($sp) # internal_33 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_33 then goto update_min_8744937301489 - lw $t0, 532($sp) # Loading the address of the condition + # If internal_33 then goto update_min_8794484717692 + lw $t0, 588($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, update_min_8744937301489 + beq $t0, $t1, update_min_8794484717692 - # Jumping to update_min_end_8744937301489 - j update_min_end_8744937301489 + # Jumping to update_min_end_8794484717692 + j update_min_end_8794484717692 - update_min_8744937301489: + update_min_8794484717692: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_32 - lw $t0, 548($sp) + lw $t0, 604($sp) sw $t0, 4($sp) # Storing internal_32 # Argument internal_31 - lw $t0, 552($sp) + lw $t0, 608($sp) sw $t0, 0($sp) # Storing internal_31 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 548($sp) # internal_32 = result of function_assign + sw $v1, 604($sp) # internal_32 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -10102,46 +10460,46 @@ sw $ra, 8($sp) # Storing return address # Argument internal_30 - lw $t0, 556($sp) + lw $t0, 612($sp) sw $t0, 4($sp) # Storing internal_30 # Argument internal_29 - lw $t0, 560($sp) + lw $t0, 616($sp) sw $t0, 0($sp) # Storing internal_29 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 556($sp) # internal_30 = result of function_assign + sw $v1, 612($sp) # internal_30 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - update_min_end_8744937301489: + update_min_end_8794484717692: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_29 - lw $t0, 560($sp) + lw $t0, 616($sp) sw $t0, 4($sp) # Storing internal_29 # Argument internal_2 - lw $t0, 668($sp) + lw $t0, 724($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 560($sp) # internal_29 = result of function_add + sw $v1, 616($sp) # internal_29 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_min_start_8744937301489 - j foreach_min_start_8744937301489 + # Jumping to foreach_min_start_8794484717692 + j foreach_min_start_8794484717692 - foreach_min_end_8744937301489: + foreach_min_end_8794484717692: # initialize Array [internal_3] - lw $t0, 652($sp) # $t0 = internal_3 + lw $t0, 708($sp) # $t0 = internal_3 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -10149,7 +10507,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 520($sp) # internal_36 = new Array[internal_3] + sw $v0, 584($sp) # internal_34 = new Array[internal_3] # Allocating Int 0 li $v0, 9 @@ -10161,17 +10519,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 516($sp) # internal_37 = address of allocated object Int + sw $v0, 580($sp) # internal_35 = address of allocated object Int - # array internal_36[4 * internal_37] = internal_1 - lw $t0, 516($sp) # $t0 = internal_37 + # array internal_34[4 * internal_35] = internal_1 + lw $t0, 580($sp) # $t0 = internal_35 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 520($sp) # $t1 = internal_36 + lw $t1, 584($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 660($sp) + lw $t0, 716($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -10185,17 +10543,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 512($sp) # internal_38 = address of allocated object Int + sw $v0, 576($sp) # internal_36 = address of allocated object Int - # array internal_36[4 * internal_38] = internal_1 - lw $t0, 512($sp) # $t0 = internal_38 + # array internal_34[4 * internal_36] = internal_1 + lw $t0, 576($sp) # $t0 = internal_36 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 520($sp) # $t1 = internal_36 + lw $t1, 584($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 660($sp) + lw $t0, 716($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -10209,17 +10567,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 508($sp) # internal_39 = address of allocated object Int + sw $v0, 572($sp) # internal_37 = address of allocated object Int - # array internal_36[4 * internal_39] = internal_1 - lw $t0, 508($sp) # $t0 = internal_39 + # array internal_34[4 * internal_37] = internal_1 + lw $t0, 572($sp) # $t0 = internal_37 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 520($sp) # $t1 = internal_36 + lw $t1, 584($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 660($sp) + lw $t0, 716($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -10233,17 +10591,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 504($sp) # internal_40 = address of allocated object Int + sw $v0, 568($sp) # internal_38 = address of allocated object Int - # array internal_36[4 * internal_40] = internal_1 - lw $t0, 504($sp) # $t0 = internal_40 + # array internal_34[4 * internal_38] = internal_1 + lw $t0, 568($sp) # $t0 = internal_38 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 520($sp) # $t1 = internal_36 + lw $t1, 584($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 660($sp) + lw $t0, 716($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -10257,41 +10615,41 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 500($sp) # internal_41 = address of allocated object Int + sw $v0, 564($sp) # internal_39 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_32 - lw $t0, 548($sp) + lw $t0, 604($sp) sw $t0, 4($sp) # Storing internal_32 # Argument internal_5 - lw $t0, 656($sp) + lw $t0, 712($sp) sw $t0, 0($sp) # Storing internal_5 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 512($sp) # internal_41 = result of function_equal + sw $v1, 576($sp) # internal_39 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # If internal_41 then goto error_branch_8744937301489 - lw $t0, 500($sp) # Loading the address of the condition + # If internal_39 then goto error_branch_8794484717692 + lw $t0, 564($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, error_branch_8744937301489 + beq $t0, $t1, error_branch_8794484717692 - # array internal_36[4 * internal_30] = internal_2 - lw $t0, 544($sp) # $t0 = internal_30 + # array internal_34[4 * internal_30] = internal_2 + lw $t0, 600($sp) # $t0 = internal_30 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 520($sp) # $t1 = internal_36 + lw $t1, 584($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 656($sp) + lw $t0, 712($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -10305,7 +10663,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 496($sp) # internal_42 = address of allocated object Int + sw $v0, 560($sp) # internal_40 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -10317,25 +10675,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 492($sp) # internal_43 = address of allocated object Int + sw $v0, 556($sp) # internal_41 = address of allocated object Int - # internal_42 = array internal_36[4 * internal_43] - lw $t0, 492($sp) # $t0 = internal_43 + # internal_40 = array internal_34[4 * internal_41] + lw $t0, 556($sp) # $t0 = internal_41 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 520($sp) # $t1 = internal_36 + lw $t1, 584($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 496($sp) # internal_42 = array internal_36[4 * internal_43] + lw $t2, 560($sp) # internal_40 = array internal_34[4 * internal_41] sw $t0, 8($t2) - # If internal_42 then goto branch_Bazz_8744937301489 - lw $t0, 496($sp) # Loading the address of the condition + # If internal_40 then goto branch_Bazz_8794484717692 + lw $t0, 560($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Bazz_8744937301489 + beq $t0, $t1, branch_Bazz_8794484717692 # Allocating Int 1 li $v0, 9 @@ -10347,25 +10705,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 488($sp) # internal_44 = address of allocated object Int + sw $v0, 552($sp) # internal_42 = address of allocated object Int - # internal_42 = array internal_36[4 * internal_44] - lw $t0, 488($sp) # $t0 = internal_44 + # internal_40 = array internal_34[4 * internal_42] + lw $t0, 552($sp) # $t0 = internal_42 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 520($sp) # $t1 = internal_36 + lw $t1, 584($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 496($sp) # internal_42 = array internal_36[4 * internal_44] + lw $t2, 560($sp) # internal_40 = array internal_34[4 * internal_42] sw $t0, 8($t2) - # If internal_42 then goto branch_Razz_8744937301489 - lw $t0, 496($sp) # Loading the address of the condition + # If internal_40 then goto branch_Razz_8794484717692 + lw $t0, 560($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Razz_8744937301489 + beq $t0, $t1, branch_Razz_8794484717692 # Allocating Int 2 li $v0, 9 @@ -10377,25 +10735,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 484($sp) # internal_45 = address of allocated object Int + sw $v0, 548($sp) # internal_43 = address of allocated object Int - # internal_42 = array internal_36[4 * internal_45] - lw $t0, 484($sp) # $t0 = internal_45 + # internal_40 = array internal_34[4 * internal_43] + lw $t0, 548($sp) # $t0 = internal_43 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 520($sp) # $t1 = internal_36 + lw $t1, 584($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 496($sp) # internal_42 = array internal_36[4 * internal_45] + lw $t2, 560($sp) # internal_40 = array internal_34[4 * internal_43] sw $t0, 8($t2) - # If internal_42 then goto branch_Foo_8744937301489 - lw $t0, 496($sp) # Loading the address of the condition + # If internal_40 then goto branch_Foo_8794484717692 + lw $t0, 560($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Foo_8744937301489 + beq $t0, $t1, branch_Foo_8794484717692 # Allocating Int 3 li $v0, 9 @@ -10407,44 +10765,44 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 480($sp) # internal_46 = address of allocated object Int + sw $v0, 544($sp) # internal_44 = address of allocated object Int - # internal_42 = array internal_36[4 * internal_46] - lw $t0, 480($sp) # $t0 = internal_46 + # internal_40 = array internal_34[4 * internal_44] + lw $t0, 544($sp) # $t0 = internal_44 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 520($sp) # $t1 = internal_36 + lw $t1, 584($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 496($sp) # internal_42 = array internal_36[4 * internal_46] + lw $t2, 560($sp) # internal_40 = array internal_34[4 * internal_44] sw $t0, 8($t2) - # If internal_42 then goto branch_Bar_8744937301489 - lw $t0, 496($sp) # Loading the address of the condition + # If internal_40 then goto branch_Bar_8794484717692 + lw $t0, 560($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Bar_8744937301489 + beq $t0, $t1, branch_Bar_8794484717692 - branch_Bazz_8744937301489: + branch_Bazz_8794484717692: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 484($sp) + lw $t0, 548($sp) sw $t0, 4($sp) # Storing n # Argument self - lw $t0, 680($sp) + lw $t0, 736($sp) sw $t0, 0($sp) # Storing self # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 484($sp) # n = result of function_assign + sw $v1, 548($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Foo @@ -10454,65 +10812,65 @@ la $t0, type_Foo # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 468($sp) # internal_49 = address of allocated object Foo + sw $v0, 532($sp) # internal_47 = address of allocated object Foo # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_49 - lw $t0, 476($sp) - sw $t0, 0($sp) # Storing internal_49 + # Argument internal_47 + lw $t0, 540($sp) + sw $t0, 0($sp) # Storing internal_47 # Calling function function___init___at_Foo jal function___init___at_Foo lw $ra, 4($sp) - sw $v1, 476($sp) # internal_49 = result of function___init___at_Foo + sw $v1, 540($sp) # internal_47 = result of function___init___at_Foo addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_47 - lw $t0, 488($sp) - sw $t0, 4($sp) # Storing internal_47 + # Argument internal_45 + lw $t0, 552($sp) + sw $t0, 4($sp) # Storing internal_45 - # Argument internal_49 - lw $t0, 480($sp) - sw $t0, 0($sp) # Storing internal_49 + # Argument internal_47 + lw $t0, 544($sp) + sw $t0, 0($sp) # Storing internal_47 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 488($sp) # internal_47 = result of function_assign + sw $v1, 552($sp) # internal_45 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_47 = internal_49 - lw $t0, 468($sp) - sw $t0, 476($sp) + # internal_45 = internal_47 + lw $t0, 532($sp) + sw $t0, 540($sp) - # Jumping to branch_end_8744937301489 - j branch_end_8744937301489 + # Jumping to branch_end_8794484717692 + j branch_end_8794484717692 - branch_Razz_8744937301489: + branch_Razz_8794484717692: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 484($sp) + lw $t0, 548($sp) sw $t0, 4($sp) # Storing n # Argument self - lw $t0, 680($sp) + lw $t0, 736($sp) sw $t0, 0($sp) # Storing self # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 484($sp) # n = result of function_assign + sw $v1, 548($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bar @@ -10522,65 +10880,65 @@ la $t0, type_Bar # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 460($sp) # internal_51 = address of allocated object Bar + sw $v0, 524($sp) # internal_49 = address of allocated object Bar # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_51 - lw $t0, 468($sp) - sw $t0, 0($sp) # Storing internal_51 + # Argument internal_49 + lw $t0, 532($sp) + sw $t0, 0($sp) # Storing internal_49 # Calling function function___init___at_Bar jal function___init___at_Bar lw $ra, 4($sp) - sw $v1, 468($sp) # internal_51 = result of function___init___at_Bar + sw $v1, 532($sp) # internal_49 = result of function___init___at_Bar addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_47 - lw $t0, 488($sp) - sw $t0, 4($sp) # Storing internal_47 + # Argument internal_45 + lw $t0, 552($sp) + sw $t0, 4($sp) # Storing internal_45 - # Argument internal_51 - lw $t0, 472($sp) - sw $t0, 0($sp) # Storing internal_51 + # Argument internal_49 + lw $t0, 536($sp) + sw $t0, 0($sp) # Storing internal_49 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 488($sp) # internal_47 = result of function_assign + sw $v1, 552($sp) # internal_45 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_47 = internal_51 - lw $t0, 460($sp) - sw $t0, 476($sp) + # internal_45 = internal_49 + lw $t0, 524($sp) + sw $t0, 540($sp) - # Jumping to branch_end_8744937301489 - j branch_end_8744937301489 + # Jumping to branch_end_8794484717692 + j branch_end_8794484717692 - branch_Foo_8744937301489: + branch_Foo_8794484717692: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 484($sp) + lw $t0, 548($sp) sw $t0, 4($sp) # Storing n # Argument self - lw $t0, 680($sp) + lw $t0, 736($sp) sw $t0, 0($sp) # Storing self # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 484($sp) # n = result of function_assign + sw $v1, 548($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Razz @@ -10590,110 +10948,110 @@ la $t0, type_Razz # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 452($sp) # internal_53 = address of allocated object Razz + sw $v0, 516($sp) # internal_51 = address of allocated object Razz # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_53 - lw $t0, 460($sp) - sw $t0, 0($sp) # Storing internal_53 + # Argument internal_51 + lw $t0, 524($sp) + sw $t0, 0($sp) # Storing internal_51 # Calling function function___init___at_Razz jal function___init___at_Razz lw $ra, 4($sp) - sw $v1, 460($sp) # internal_53 = result of function___init___at_Razz + sw $v1, 524($sp) # internal_51 = result of function___init___at_Razz addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_47 - lw $t0, 488($sp) - sw $t0, 4($sp) # Storing internal_47 + # Argument internal_45 + lw $t0, 552($sp) + sw $t0, 4($sp) # Storing internal_45 - # Argument internal_53 - lw $t0, 464($sp) - sw $t0, 0($sp) # Storing internal_53 + # Argument internal_51 + lw $t0, 528($sp) + sw $t0, 0($sp) # Storing internal_51 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 488($sp) # internal_47 = result of function_assign + sw $v1, 552($sp) # internal_45 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_47 = internal_53 - lw $t0, 452($sp) - sw $t0, 476($sp) + # internal_45 = internal_51 + lw $t0, 516($sp) + sw $t0, 540($sp) - # Jumping to branch_end_8744937301489 - j branch_end_8744937301489 + # Jumping to branch_end_8794484717692 + j branch_end_8794484717692 - branch_Bar_8744937301489: + branch_Bar_8794484717692: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 484($sp) + lw $t0, 548($sp) sw $t0, 4($sp) # Storing n # Argument self - lw $t0, 680($sp) + lw $t0, 736($sp) sw $t0, 0($sp) # Storing self # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 484($sp) # n = result of function_assign + sw $v1, 548($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_47 - lw $t0, 488($sp) - sw $t0, 4($sp) # Storing internal_47 + # Argument internal_45 + lw $t0, 552($sp) + sw $t0, 4($sp) # Storing internal_45 # Argument n - lw $t0, 484($sp) + lw $t0, 548($sp) sw $t0, 0($sp) # Storing n # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 488($sp) # internal_47 = result of function_assign + sw $v1, 552($sp) # internal_45 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_47 = n - lw $t0, 472($sp) - sw $t0, 476($sp) + # internal_45 = n + lw $t0, 536($sp) + sw $t0, 540($sp) - # Jumping to branch_end_8744937301489 - j branch_end_8744937301489 + # Jumping to branch_end_8794484717692 + j branch_end_8794484717692 - error_branch_8744937301489: + error_branch_8794484717692: - branch_end_8744937301489: + branch_end_8794484717692: # Set attribute g of self - lw $t0, 668($sp) # $t0 = self - lw $t1, 476($sp) # $t1 = internal_47 - beq $t1, $zero, object_set_attribute_8744937275721 + lw $t0, 724($sp) # $t0 = self + lw $t1, 540($sp) # $t1 = internal_45 + beq $t1, $zero, object_set_attribute_8794484650219 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937275721 + beq $t6, $t5, int_set_attribute_8794484650219 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937275721 - j object_set_attribute_8744937275721 - int_set_attribute_8744937275721: + beq $t6, $t5, bool_set_attribute_8794484650219 + j object_set_attribute_8794484650219 + int_set_attribute_8794484650219: li $v0, 9 addi $a0, $zero, 12 syscall @@ -10701,9 +11059,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.g = internal_47 - j end_set_attribute_8744937275721 - bool_set_attribute_8744937275721: + sw $v0, 12($t0) # self.g = internal_45 + j end_set_attribute_8794484650219 + bool_set_attribute_8794484650219: li $v0, 9 addi $a0, $zero, 12 syscall @@ -10711,40 +11069,64 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.g = internal_47 - j end_set_attribute_8744937275721 - object_set_attribute_8744937275721: - sw $t1, 12($t0) # self.g = internal_47 - end_set_attribute_8744937275721: + sw $v0, 12($t0) # self.g = internal_45 + j end_set_attribute_8794484650219 + object_set_attribute_8794484650219: + sw $t1, 12($t0) # self.g = internal_45 + end_set_attribute_8794484650219: + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 504($sp) # internal_54 = address of allocated object Int + + # Get method printh of Razz + lw $t0, 724($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 504($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 500($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 676($sp) + lw $t0, 732($sp) sw $t0, 0($sp) # Storing self - # Calling function function_printh_at_Bazz - jal function_printh_at_Bazz + # Calling function internal_55 + lw $t0, 508($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 452($sp) # internal_55 = result of function_printh_at_Bazz + sw $v1, 516($sp) # internal_53 = result of internal_55 addi $sp, $sp, 8 # Freeing space for arguments # Set attribute i of self - lw $t0, 668($sp) # $t0 = self - lw $t1, 444($sp) # $t1 = internal_55 - beq $t1, $zero, object_set_attribute_8744937275694 + lw $t0, 724($sp) # $t0 = self + lw $t1, 508($sp) # $t1 = internal_53 + beq $t1, $zero, object_set_attribute_8794484650195 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937275694 + beq $t6, $t5, int_set_attribute_8794484650195 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937275694 - j object_set_attribute_8744937275694 - int_set_attribute_8744937275694: + beq $t6, $t5, bool_set_attribute_8794484650195 + j object_set_attribute_8794484650195 + int_set_attribute_8794484650195: li $v0, 9 addi $a0, $zero, 12 syscall @@ -10752,9 +11134,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 16($t0) # self.i = internal_55 - j end_set_attribute_8744937275694 - bool_set_attribute_8744937275694: + sw $v0, 16($t0) # self.i = internal_53 + j end_set_attribute_8794484650195 + bool_set_attribute_8794484650195: li $v0, 9 addi $a0, $zero, 12 syscall @@ -10762,11 +11144,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 16($t0) # self.i = internal_55 - j end_set_attribute_8744937275694 - object_set_attribute_8744937275694: - sw $t1, 16($t0) # self.i = internal_55 - end_set_attribute_8744937275694: + sw $v0, 16($t0) # self.i = internal_53 + j end_set_attribute_8794484650195 + object_set_attribute_8794484650195: + sw $t1, 16($t0) # self.i = internal_53 + end_set_attribute_8794484650195: # Allocating Int 0 li $v0, 9 @@ -10778,7 +11160,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 440($sp) # internal_56 = address of allocated object Int + sw $v0, 496($sp) # internal_56 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -10790,7 +11172,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 436($sp) # internal_57 = address of allocated object Int + sw $v0, 492($sp) # internal_57 = address of allocated object Int # Allocating Int 3 li $v0, 9 @@ -10802,10 +11184,10 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 432($sp) # internal_58 = address of allocated object Int + sw $v0, 488($sp) # internal_58 = address of allocated object Int # Allocating NUll to internal_59 - sw $zero, 428($sp) # internal_59 = 0 + sw $zero, 484($sp) # internal_59 = 0 # Allocating Int 0 li $v0, 9 @@ -10817,7 +11199,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 424($sp) # internal_60 = address of allocated object Int + sw $v0, 480($sp) # internal_60 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -10829,66 +11211,66 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 412($sp) # internal_63 = address of allocated object Int + sw $v0, 468($sp) # internal_63 = address of allocated object Int # internal_61 = typeof self that is the first word of the object - lw $t0, 668($sp) + lw $t0, 724($sp) lw $t0, 0($t0) - sw $t0, 420($sp) + sw $t0, 476($sp) # internal_62 = internal_61 - lw $t0, 420($sp) - sw $t0, 416($sp) + lw $t0, 476($sp) + sw $t0, 472($sp) - while_start_8744937325815: + while_start_8794484687207: # internal_63 = EqualAddress(internal_62, internal_59) - lw $t0, 416($sp) - lw $t1, 428($sp) + lw $t0, 472($sp) + lw $t1, 484($sp) seq $t2, $t0, $t1 - lw $t0, 412($sp) + lw $t0, 468($sp) sw $t2, 8($t0) - # If internal_63 then goto while_end_8744937325815 - lw $t0, 412($sp) # Loading the address of the condition + # If internal_63 then goto while_end_8794484687207 + lw $t0, 468($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_end_8744937325815 + beq $t0, $t1, while_end_8794484687207 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_60 - lw $t0, 436($sp) + lw $t0, 492($sp) sw $t0, 4($sp) # Storing internal_60 # Argument internal_57 - lw $t0, 448($sp) + lw $t0, 504($sp) sw $t0, 0($sp) # Storing internal_57 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 436($sp) # internal_60 = result of function_add + sw $v1, 492($sp) # internal_60 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # internal_62 = ancestor of internal_62 - lw $t0, 416($sp) + lw $t0, 472($sp) lw $t0, 4($t0) - sw $t0, 416($sp) + sw $t0, 472($sp) - # Jumping to while_start_8744937325815 - j while_start_8744937325815 + # Jumping to while_start_8794484687207 + j while_start_8794484687207 - while_end_8744937325815: + while_end_8794484687207: # internal_62 = internal_61 - lw $t0, 420($sp) - sw $t0, 416($sp) + lw $t0, 476($sp) + sw $t0, 472($sp) # initialize Array [internal_60] - lw $t0, 424($sp) # $t0 = internal_60 + lw $t0, 480($sp) # $t0 = internal_60 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -10896,7 +11278,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 408($sp) # internal_64 = new Array[internal_60] + sw $v0, 464($sp) # internal_64 = new Array[internal_60] # Allocating Int 0 li $v0, 9 @@ -10908,7 +11290,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 404($sp) # internal_65 = address of allocated object Int + sw $v0, 460($sp) # internal_65 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -10920,80 +11302,80 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 400($sp) # internal_66 = address of allocated object Int + sw $v0, 456($sp) # internal_66 = address of allocated object Int - foreach_start_8744937325815: + foreach_start_8794484687207: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_65 - lw $t0, 416($sp) + lw $t0, 472($sp) sw $t0, 4($sp) # Storing internal_65 # Argument internal_60 - lw $t0, 436($sp) + lw $t0, 492($sp) sw $t0, 0($sp) # Storing internal_60 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 412($sp) # internal_66 = result of function_less_than + sw $v1, 468($sp) # internal_66 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_66 then goto foreach_body_8744937325815 - lw $t0, 400($sp) # Loading the address of the condition + # If internal_66 then goto foreach_body_8794484687207 + lw $t0, 456($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_body_8744937325815 + beq $t0, $t1, foreach_body_8794484687207 - # Jumping to foreach_end_8744937325815 - j foreach_end_8744937325815 + # Jumping to foreach_end_8794484687207 + j foreach_end_8794484687207 - foreach_body_8744937325815: + foreach_body_8794484687207: # array internal_64[4 * internal_65] = internal_62 - lw $t0, 404($sp) # $t0 = internal_65 + lw $t0, 460($sp) # $t0 = internal_65 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 408($sp) # $t1 = internal_64 + lw $t1, 464($sp) # $t1 = internal_64 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 416($sp) + lw $t0, 472($sp) sw $t0, 0($t1) # internal_62 = ancestor of internal_62 - lw $t0, 416($sp) + lw $t0, 472($sp) lw $t0, 4($t0) - sw $t0, 416($sp) + sw $t0, 472($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_65 - lw $t0, 416($sp) + lw $t0, 472($sp) sw $t0, 4($sp) # Storing internal_65 # Argument internal_57 - lw $t0, 448($sp) + lw $t0, 504($sp) sw $t0, 0($sp) # Storing internal_57 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 416($sp) # internal_65 = result of function_add + sw $v1, 472($sp) # internal_65 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_start_8744937325815 - j foreach_start_8744937325815 + # Jumping to foreach_start_8794484687207 + j foreach_start_8794484687207 - foreach_end_8744937325815: + foreach_end_8794484687207: # initialize Array [internal_58] - lw $t0, 432($sp) # $t0 = internal_58 + lw $t0, 488($sp) # $t0 = internal_58 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -11001,10 +11383,10 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 396($sp) # internal_67 = new Array[internal_58] + sw $v0, 452($sp) # internal_67 = new Array[internal_58] # initialize Array [internal_58] - lw $t0, 432($sp) # $t0 = internal_58 + lw $t0, 488($sp) # $t0 = internal_58 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -11012,7 +11394,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 392($sp) # internal_68 = new Array[internal_58] + sw $v0, 448($sp) # internal_68 = new Array[internal_58] # Allocating Int 0 li $v0, 9 @@ -11024,32 +11406,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 384($sp) # internal_70 = address of allocated object Int + sw $v0, 440($sp) # internal_70 = address of allocated object Int # internal_69 = direction of Razz la $t0, type_Razz - sw $t0, 388($sp) + sw $t0, 444($sp) # array internal_67[4 * internal_70] = internal_69 - lw $t0, 384($sp) # $t0 = internal_70 + lw $t0, 440($sp) # $t0 = internal_70 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 396($sp) # $t1 = internal_67 + lw $t1, 452($sp) # $t1 = internal_67 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 388($sp) + lw $t0, 444($sp) sw $t0, 0($t1) # array internal_68[4 * internal_70] = internal_60 - lw $t0, 384($sp) # $t0 = internal_70 + lw $t0, 440($sp) # $t0 = internal_70 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 392($sp) # $t1 = internal_68 + lw $t1, 448($sp) # $t1 = internal_68 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 424($sp) + lw $t0, 480($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -11063,32 +11445,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 376($sp) # internal_72 = address of allocated object Int + sw $v0, 432($sp) # internal_72 = address of allocated object Int # internal_71 = direction of Foo la $t0, type_Foo - sw $t0, 380($sp) + sw $t0, 436($sp) # array internal_67[4 * internal_72] = internal_71 - lw $t0, 376($sp) # $t0 = internal_72 + lw $t0, 432($sp) # $t0 = internal_72 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 396($sp) # $t1 = internal_67 + lw $t1, 452($sp) # $t1 = internal_67 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 380($sp) + lw $t0, 436($sp) sw $t0, 0($t1) # array internal_68[4 * internal_72] = internal_60 - lw $t0, 376($sp) # $t0 = internal_72 + lw $t0, 432($sp) # $t0 = internal_72 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 392($sp) # $t1 = internal_68 + lw $t1, 448($sp) # $t1 = internal_68 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 424($sp) + lw $t0, 480($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -11102,32 +11484,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 368($sp) # internal_74 = address of allocated object Int + sw $v0, 424($sp) # internal_74 = address of allocated object Int # internal_73 = direction of Bar la $t0, type_Bar - sw $t0, 372($sp) + sw $t0, 428($sp) # array internal_67[4 * internal_74] = internal_73 - lw $t0, 368($sp) # $t0 = internal_74 + lw $t0, 424($sp) # $t0 = internal_74 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 396($sp) # $t1 = internal_67 + lw $t1, 452($sp) # $t1 = internal_67 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 372($sp) + lw $t0, 428($sp) sw $t0, 0($t1) # array internal_68[4 * internal_74] = internal_60 - lw $t0, 368($sp) # $t0 = internal_74 + lw $t0, 424($sp) # $t0 = internal_74 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 392($sp) # $t1 = internal_68 + lw $t1, 448($sp) # $t1 = internal_68 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 424($sp) + lw $t0, 480($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -11141,7 +11523,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 364($sp) # internal_75 = address of allocated object Int + sw $v0, 420($sp) # internal_75 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -11153,7 +11535,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 360($sp) # internal_76 = address of allocated object Int + sw $v0, 416($sp) # internal_76 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -11165,7 +11547,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 352($sp) # internal_78 = address of allocated object Int + sw $v0, 408($sp) # internal_78 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -11177,7 +11559,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 348($sp) # internal_79 = address of allocated object Int + sw $v0, 404($sp) # internal_79 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -11189,155 +11571,155 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 340($sp) # internal_81 = address of allocated object Int + sw $v0, 396($sp) # internal_81 = address of allocated object Int - foreach_type_start_8744937325815: + foreach_type_start_8794484687207: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_75 - lw $t0, 376($sp) + lw $t0, 432($sp) sw $t0, 4($sp) # Storing internal_75 # Argument internal_58 - lw $t0, 444($sp) + lw $t0, 500($sp) sw $t0, 0($sp) # Storing internal_58 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 372($sp) # internal_76 = result of function_less_than + sw $v1, 428($sp) # internal_76 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_76 then goto foreach_type_body_8744937325815 - lw $t0, 360($sp) # Loading the address of the condition + # If internal_76 then goto foreach_type_body_8794484687207 + lw $t0, 416($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_type_body_8744937325815 + beq $t0, $t1, foreach_type_body_8794484687207 - # Jumping to foreach_type_end_8744937325815 - j foreach_type_end_8744937325815 + # Jumping to foreach_type_end_8794484687207 + j foreach_type_end_8794484687207 - foreach_type_body_8744937325815: + foreach_type_body_8794484687207: # internal_77 = array internal_67[4 * internal_75] - lw $t0, 364($sp) # $t0 = internal_75 + lw $t0, 420($sp) # $t0 = internal_75 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 396($sp) # $t1 = internal_67 + lw $t1, 452($sp) # $t1 = internal_67 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - sw $t0, 356($sp) # internal_77 = array internal_67[4 * internal_75] + sw $t0, 412($sp) # internal_77 = array internal_67[4 * internal_75] # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_78 - lw $t0, 364($sp) + lw $t0, 420($sp) sw $t0, 4($sp) # Storing internal_78 # Argument internal_56 - lw $t0, 452($sp) + lw $t0, 508($sp) sw $t0, 0($sp) # Storing internal_56 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 364($sp) # internal_78 = result of function_assign + sw $v1, 420($sp) # internal_78 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - foreach_ancestor_start_8744937325815: + foreach_ancestor_start_8794484687207: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_78 - lw $t0, 364($sp) + lw $t0, 420($sp) sw $t0, 4($sp) # Storing internal_78 # Argument internal_60 - lw $t0, 436($sp) + lw $t0, 492($sp) sw $t0, 0($sp) # Storing internal_60 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 360($sp) # internal_79 = result of function_less_than + sw $v1, 416($sp) # internal_79 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_79 then goto foreach_ancestor_body_8744937325815 - lw $t0, 348($sp) # Loading the address of the condition + # If internal_79 then goto foreach_ancestor_body_8794484687207 + lw $t0, 404($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_body_8744937325815 + beq $t0, $t1, foreach_ancestor_body_8794484687207 - # Jumping to foreach_ancestor_end_8744937325815 - j foreach_ancestor_end_8744937325815 + # Jumping to foreach_ancestor_end_8794484687207 + j foreach_ancestor_end_8794484687207 - foreach_ancestor_body_8744937325815: + foreach_ancestor_body_8794484687207: # internal_80 = array internal_64[4 * internal_78] - lw $t0, 352($sp) # $t0 = internal_78 + lw $t0, 408($sp) # $t0 = internal_78 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 408($sp) # $t1 = internal_64 + lw $t1, 464($sp) # $t1 = internal_64 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - sw $t0, 344($sp) # internal_80 = array internal_64[4 * internal_78] + sw $t0, 400($sp) # internal_80 = array internal_64[4 * internal_78] # internal_81 = EqualAddress(internal_77, internal_80) - lw $t0, 356($sp) - lw $t1, 344($sp) + lw $t0, 412($sp) + lw $t1, 400($sp) seq $t2, $t0, $t1 - lw $t0, 340($sp) + lw $t0, 396($sp) sw $t2, 8($t0) - # If internal_81 then goto foreach_ancestor_end_8744937325815 - lw $t0, 340($sp) # Loading the address of the condition + # If internal_81 then goto foreach_ancestor_end_8794484687207 + lw $t0, 396($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_end_8744937325815 + beq $t0, $t1, foreach_ancestor_end_8794484687207 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_78 - lw $t0, 364($sp) + lw $t0, 420($sp) sw $t0, 4($sp) # Storing internal_78 # Argument internal_57 - lw $t0, 448($sp) + lw $t0, 504($sp) sw $t0, 0($sp) # Storing internal_57 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 364($sp) # internal_78 = result of function_add + sw $v1, 420($sp) # internal_78 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_ancestor_start_8744937325815 - j foreach_ancestor_start_8744937325815 + # Jumping to foreach_ancestor_start_8794484687207 + j foreach_ancestor_start_8794484687207 - foreach_ancestor_end_8744937325815: + foreach_ancestor_end_8794484687207: # array internal_68[4 * internal_75] = internal_78 - lw $t0, 364($sp) # $t0 = internal_75 + lw $t0, 420($sp) # $t0 = internal_75 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 392($sp) # $t1 = internal_68 + lw $t1, 448($sp) # $t1 = internal_68 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 352($sp) + lw $t0, 408($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -11346,59 +11728,23 @@ sw $ra, 8($sp) # Storing return address # Argument internal_75 - lw $t0, 376($sp) + lw $t0, 432($sp) sw $t0, 4($sp) # Storing internal_75 # Argument internal_57 - lw $t0, 448($sp) + lw $t0, 504($sp) sw $t0, 0($sp) # Storing internal_57 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 376($sp) # internal_75 = result of function_add + sw $v1, 432($sp) # internal_75 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_type_start_8744937325815 - j foreach_type_start_8744937325815 - - foreach_type_end_8744937325815: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_87[0] = '\n' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 316($sp) # internal_87 = "\n" - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_88[0] = ' ' + # Jumping to foreach_type_start_8794484687207 + j foreach_type_start_8794484687207 - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 312($sp) # internal_88 = " " + foreach_type_end_8794484687207: # Allocating Int 0 li $v0, 9 @@ -11410,7 +11756,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 336($sp) # internal_82 = address of allocated object Int + sw $v0, 392($sp) # internal_82 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -11422,7 +11768,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 332($sp) # internal_83 = address of allocated object Int + sw $v0, 388($sp) # internal_83 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -11434,7 +11780,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 328($sp) # internal_84 = address of allocated object Int + sw $v0, 384($sp) # internal_84 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -11446,7 +11792,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 324($sp) # internal_85 = address of allocated object Int + sw $v0, 380($sp) # internal_85 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -11458,67 +11804,67 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 320($sp) # internal_86 = address of allocated object Int + sw $v0, 376($sp) # internal_86 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_85 - lw $t0, 336($sp) + lw $t0, 392($sp) sw $t0, 4($sp) # Storing internal_85 # Argument internal_60 - lw $t0, 436($sp) + lw $t0, 492($sp) sw $t0, 0($sp) # Storing internal_60 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 336($sp) # internal_85 = result of function_assign + sw $v1, 392($sp) # internal_85 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - foreach_min_start_8744937325815: + foreach_min_start_8794484687207: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_82 - lw $t0, 348($sp) + lw $t0, 404($sp) sw $t0, 4($sp) # Storing internal_82 # Argument internal_58 - lw $t0, 444($sp) + lw $t0, 500($sp) sw $t0, 0($sp) # Storing internal_58 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 332($sp) # internal_86 = result of function_less_than + sw $v1, 388($sp) # internal_86 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_86 then goto foreach_min_body_8744937325815 - lw $t0, 320($sp) # Loading the address of the condition + # If internal_86 then goto foreach_min_body_8794484687207 + lw $t0, 376($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_min_body_8744937325815 + beq $t0, $t1, foreach_min_body_8794484687207 - # Jumping to foreach_min_end_8744937325815 - j foreach_min_end_8744937325815 + # Jumping to foreach_min_end_8794484687207 + j foreach_min_end_8794484687207 - foreach_min_body_8744937325815: + foreach_min_body_8794484687207: # internal_84 = array internal_68[4 * internal_82] - lw $t0, 336($sp) # $t0 = internal_82 + lw $t0, 392($sp) # $t0 = internal_82 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 392($sp) # $t1 = internal_68 + lw $t1, 448($sp) # $t1 = internal_68 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 328($sp) # internal_84 = array internal_68[4 * internal_82] + lw $t2, 384($sp) # internal_84 = array internal_68[4 * internal_82] sw $t0, 8($t2) # Passing function arguments @@ -11526,46 +11872,46 @@ sw $ra, 8($sp) # Storing return address # Argument internal_84 - lw $t0, 340($sp) + lw $t0, 396($sp) sw $t0, 4($sp) # Storing internal_84 # Argument internal_85 - lw $t0, 336($sp) + lw $t0, 392($sp) sw $t0, 0($sp) # Storing internal_85 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 332($sp) # internal_86 = result of function_less_than + sw $v1, 388($sp) # internal_86 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_86 then goto update_min_8744937325815 - lw $t0, 320($sp) # Loading the address of the condition + # If internal_86 then goto update_min_8794484687207 + lw $t0, 376($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, update_min_8744937325815 + beq $t0, $t1, update_min_8794484687207 - # Jumping to update_min_end_8744937325815 - j update_min_end_8744937325815 + # Jumping to update_min_end_8794484687207 + j update_min_end_8794484687207 - update_min_8744937325815: + update_min_8794484687207: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_85 - lw $t0, 336($sp) + lw $t0, 392($sp) sw $t0, 4($sp) # Storing internal_85 # Argument internal_84 - lw $t0, 340($sp) + lw $t0, 396($sp) sw $t0, 0($sp) # Storing internal_84 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 336($sp) # internal_85 = result of function_assign + sw $v1, 392($sp) # internal_85 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -11573,46 +11919,46 @@ sw $ra, 8($sp) # Storing return address # Argument internal_83 - lw $t0, 344($sp) + lw $t0, 400($sp) sw $t0, 4($sp) # Storing internal_83 # Argument internal_82 - lw $t0, 348($sp) + lw $t0, 404($sp) sw $t0, 0($sp) # Storing internal_82 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 344($sp) # internal_83 = result of function_assign + sw $v1, 400($sp) # internal_83 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - update_min_end_8744937325815: + update_min_end_8794484687207: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_82 - lw $t0, 348($sp) + lw $t0, 404($sp) sw $t0, 4($sp) # Storing internal_82 # Argument internal_57 - lw $t0, 448($sp) + lw $t0, 504($sp) sw $t0, 0($sp) # Storing internal_57 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 348($sp) # internal_82 = result of function_add + sw $v1, 404($sp) # internal_82 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_min_start_8744937325815 - j foreach_min_start_8744937325815 + # Jumping to foreach_min_start_8794484687207 + j foreach_min_start_8794484687207 - foreach_min_end_8744937325815: + foreach_min_end_8794484687207: # initialize Array [internal_58] - lw $t0, 432($sp) # $t0 = internal_58 + lw $t0, 488($sp) # $t0 = internal_58 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -11620,7 +11966,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 308($sp) # internal_89 = new Array[internal_58] + sw $v0, 372($sp) # internal_87 = new Array[internal_58] # Allocating Int 0 li $v0, 9 @@ -11632,17 +11978,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 304($sp) # internal_90 = address of allocated object Int + sw $v0, 368($sp) # internal_88 = address of allocated object Int - # array internal_89[4 * internal_90] = internal_56 - lw $t0, 304($sp) # $t0 = internal_90 + # array internal_87[4 * internal_88] = internal_56 + lw $t0, 368($sp) # $t0 = internal_88 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 308($sp) # $t1 = internal_89 + lw $t1, 372($sp) # $t1 = internal_87 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 440($sp) + lw $t0, 496($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -11656,17 +12002,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 300($sp) # internal_91 = address of allocated object Int + sw $v0, 364($sp) # internal_89 = address of allocated object Int - # array internal_89[4 * internal_91] = internal_56 - lw $t0, 300($sp) # $t0 = internal_91 + # array internal_87[4 * internal_89] = internal_56 + lw $t0, 364($sp) # $t0 = internal_89 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 308($sp) # $t1 = internal_89 + lw $t1, 372($sp) # $t1 = internal_87 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 440($sp) + lw $t0, 496($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -11680,17 +12026,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 296($sp) # internal_92 = address of allocated object Int + sw $v0, 360($sp) # internal_90 = address of allocated object Int - # array internal_89[4 * internal_92] = internal_56 - lw $t0, 296($sp) # $t0 = internal_92 + # array internal_87[4 * internal_90] = internal_56 + lw $t0, 360($sp) # $t0 = internal_90 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 308($sp) # $t1 = internal_89 + lw $t1, 372($sp) # $t1 = internal_87 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 440($sp) + lw $t0, 496($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -11704,41 +12050,41 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 292($sp) # internal_93 = address of allocated object Int + sw $v0, 356($sp) # internal_91 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_85 - lw $t0, 336($sp) + lw $t0, 392($sp) sw $t0, 4($sp) # Storing internal_85 # Argument internal_60 - lw $t0, 436($sp) + lw $t0, 492($sp) sw $t0, 0($sp) # Storing internal_60 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 304($sp) # internal_93 = result of function_equal + sw $v1, 368($sp) # internal_91 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # If internal_93 then goto error_branch_8744937325815 - lw $t0, 292($sp) # Loading the address of the condition + # If internal_91 then goto error_branch_8794484687207 + lw $t0, 356($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, error_branch_8744937325815 + beq $t0, $t1, error_branch_8794484687207 - # array internal_89[4 * internal_83] = internal_57 - lw $t0, 332($sp) # $t0 = internal_83 + # array internal_87[4 * internal_83] = internal_57 + lw $t0, 388($sp) # $t0 = internal_83 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 308($sp) # $t1 = internal_89 + lw $t1, 372($sp) # $t1 = internal_87 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 436($sp) + lw $t0, 492($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -11752,7 +12098,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 288($sp) # internal_94 = address of allocated object Int + sw $v0, 352($sp) # internal_92 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -11764,25 +12110,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 284($sp) # internal_95 = address of allocated object Int + sw $v0, 348($sp) # internal_93 = address of allocated object Int - # internal_94 = array internal_89[4 * internal_95] - lw $t0, 284($sp) # $t0 = internal_95 + # internal_92 = array internal_87[4 * internal_93] + lw $t0, 348($sp) # $t0 = internal_93 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 308($sp) # $t1 = internal_89 + lw $t1, 372($sp) # $t1 = internal_87 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 288($sp) # internal_94 = array internal_89[4 * internal_95] + lw $t2, 352($sp) # internal_92 = array internal_87[4 * internal_93] sw $t0, 8($t2) - # If internal_94 then goto branch_Razz_8744937325815 - lw $t0, 288($sp) # Loading the address of the condition + # If internal_92 then goto branch_Razz_8794484687207 + lw $t0, 352($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Razz_8744937325815 + beq $t0, $t1, branch_Razz_8794484687207 # Allocating Int 1 li $v0, 9 @@ -11794,25 +12140,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 280($sp) # internal_96 = address of allocated object Int + sw $v0, 344($sp) # internal_94 = address of allocated object Int - # internal_94 = array internal_89[4 * internal_96] - lw $t0, 280($sp) # $t0 = internal_96 + # internal_92 = array internal_87[4 * internal_94] + lw $t0, 344($sp) # $t0 = internal_94 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 308($sp) # $t1 = internal_89 + lw $t1, 372($sp) # $t1 = internal_87 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 288($sp) # internal_94 = array internal_89[4 * internal_96] + lw $t2, 352($sp) # internal_92 = array internal_87[4 * internal_94] sw $t0, 8($t2) - # If internal_94 then goto branch_Foo_8744937325815 - lw $t0, 288($sp) # Loading the address of the condition + # If internal_92 then goto branch_Foo_8794484687207 + lw $t0, 352($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Foo_8744937325815 + beq $t0, $t1, branch_Foo_8794484687207 # Allocating Int 2 li $v0, 9 @@ -11824,44 +12170,44 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 276($sp) # internal_97 = address of allocated object Int + sw $v0, 340($sp) # internal_95 = address of allocated object Int - # internal_94 = array internal_89[4 * internal_97] - lw $t0, 276($sp) # $t0 = internal_97 + # internal_92 = array internal_87[4 * internal_95] + lw $t0, 340($sp) # $t0 = internal_95 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 308($sp) # $t1 = internal_89 + lw $t1, 372($sp) # $t1 = internal_87 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 288($sp) # internal_94 = array internal_89[4 * internal_97] + lw $t2, 352($sp) # internal_92 = array internal_87[4 * internal_95] sw $t0, 8($t2) - # If internal_94 then goto branch_Bar_8744937325815 - lw $t0, 288($sp) # Loading the address of the condition + # If internal_92 then goto branch_Bar_8794484687207 + lw $t0, 352($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Bar_8744937325815 + beq $t0, $t1, branch_Bar_8794484687207 - branch_Razz_8744937325815: + branch_Razz_8794484687207: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 484($sp) + lw $t0, 548($sp) sw $t0, 4($sp) # Storing n # Argument self - lw $t0, 680($sp) + lw $t0, 736($sp) sw $t0, 0($sp) # Storing self # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 484($sp) # n = result of function_assign + sw $v1, 548($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bar @@ -11871,65 +12217,65 @@ la $t0, type_Bar # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 264($sp) # internal_100 = address of allocated object Bar + sw $v0, 328($sp) # internal_98 = address of allocated object Bar # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_100 - lw $t0, 272($sp) - sw $t0, 0($sp) # Storing internal_100 + # Argument internal_98 + lw $t0, 336($sp) + sw $t0, 0($sp) # Storing internal_98 # Calling function function___init___at_Bar jal function___init___at_Bar lw $ra, 4($sp) - sw $v1, 272($sp) # internal_100 = result of function___init___at_Bar + sw $v1, 336($sp) # internal_98 = result of function___init___at_Bar addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_98 - lw $t0, 284($sp) - sw $t0, 4($sp) # Storing internal_98 + # Argument internal_96 + lw $t0, 348($sp) + sw $t0, 4($sp) # Storing internal_96 - # Argument internal_100 - lw $t0, 276($sp) - sw $t0, 0($sp) # Storing internal_100 + # Argument internal_98 + lw $t0, 340($sp) + sw $t0, 0($sp) # Storing internal_98 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 284($sp) # internal_98 = result of function_assign + sw $v1, 348($sp) # internal_96 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_98 = internal_100 - lw $t0, 264($sp) - sw $t0, 272($sp) + # internal_96 = internal_98 + lw $t0, 328($sp) + sw $t0, 336($sp) - # Jumping to branch_end_8744937325815 - j branch_end_8744937325815 + # Jumping to branch_end_8794484687207 + j branch_end_8794484687207 - branch_Foo_8744937325815: + branch_Foo_8794484687207: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 484($sp) + lw $t0, 548($sp) sw $t0, 4($sp) # Storing n # Argument self - lw $t0, 680($sp) + lw $t0, 736($sp) sw $t0, 0($sp) # Storing self # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 484($sp) # n = result of function_assign + sw $v1, 548($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Razz @@ -11939,110 +12285,110 @@ la $t0, type_Razz # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 256($sp) # internal_102 = address of allocated object Razz + sw $v0, 320($sp) # internal_100 = address of allocated object Razz # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_102 - lw $t0, 264($sp) - sw $t0, 0($sp) # Storing internal_102 + # Argument internal_100 + lw $t0, 328($sp) + sw $t0, 0($sp) # Storing internal_100 # Calling function function___init___at_Razz jal function___init___at_Razz lw $ra, 4($sp) - sw $v1, 264($sp) # internal_102 = result of function___init___at_Razz + sw $v1, 328($sp) # internal_100 = result of function___init___at_Razz addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_98 - lw $t0, 284($sp) - sw $t0, 4($sp) # Storing internal_98 + # Argument internal_96 + lw $t0, 348($sp) + sw $t0, 4($sp) # Storing internal_96 - # Argument internal_102 - lw $t0, 268($sp) - sw $t0, 0($sp) # Storing internal_102 + # Argument internal_100 + lw $t0, 332($sp) + sw $t0, 0($sp) # Storing internal_100 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 284($sp) # internal_98 = result of function_assign + sw $v1, 348($sp) # internal_96 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_98 = internal_102 - lw $t0, 256($sp) - sw $t0, 272($sp) + # internal_96 = internal_100 + lw $t0, 320($sp) + sw $t0, 336($sp) - # Jumping to branch_end_8744937325815 - j branch_end_8744937325815 + # Jumping to branch_end_8794484687207 + j branch_end_8794484687207 - branch_Bar_8744937325815: + branch_Bar_8794484687207: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 484($sp) + lw $t0, 548($sp) sw $t0, 4($sp) # Storing n # Argument self - lw $t0, 680($sp) + lw $t0, 736($sp) sw $t0, 0($sp) # Storing self # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 484($sp) # n = result of function_assign + sw $v1, 548($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_98 - lw $t0, 284($sp) - sw $t0, 4($sp) # Storing internal_98 + # Argument internal_96 + lw $t0, 348($sp) + sw $t0, 4($sp) # Storing internal_96 # Argument n - lw $t0, 484($sp) + lw $t0, 548($sp) sw $t0, 0($sp) # Storing n # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 284($sp) # internal_98 = result of function_assign + sw $v1, 348($sp) # internal_96 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_98 = n - lw $t0, 472($sp) - sw $t0, 272($sp) + # internal_96 = n + lw $t0, 536($sp) + sw $t0, 336($sp) - # Jumping to branch_end_8744937325815 - j branch_end_8744937325815 + # Jumping to branch_end_8794484687207 + j branch_end_8794484687207 - error_branch_8744937325815: + error_branch_8794484687207: - branch_end_8744937325815: + branch_end_8794484687207: # Set attribute a of self - lw $t0, 668($sp) # $t0 = self - lw $t1, 272($sp) # $t1 = internal_98 - beq $t1, $zero, object_set_attribute_8744937246805 + lw $t0, 724($sp) # $t0 = self + lw $t1, 336($sp) # $t1 = internal_96 + beq $t1, $zero, object_set_attribute_8794484622132 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937246805 + beq $t6, $t5, int_set_attribute_8794484622132 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937246805 - j object_set_attribute_8744937246805 - int_set_attribute_8744937246805: + beq $t6, $t5, bool_set_attribute_8794484622132 + j object_set_attribute_8794484622132 + int_set_attribute_8794484622132: li $v0, 9 addi $a0, $zero, 12 syscall @@ -12050,9 +12396,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 20($t0) # self.a = internal_98 - j end_set_attribute_8744937246805 - bool_set_attribute_8744937246805: + sw $v0, 20($t0) # self.a = internal_96 + j end_set_attribute_8794484622132 + bool_set_attribute_8794484622132: li $v0, 9 addi $a0, $zero, 12 syscall @@ -12060,25 +12406,25 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 20($t0) # self.a = internal_98 - j end_set_attribute_8744937246805 - object_set_attribute_8744937246805: - sw $t1, 20($t0) # self.a = internal_98 - end_set_attribute_8744937246805: + sw $v0, 20($t0) # self.a = internal_96 + j end_set_attribute_8794484622132 + object_set_attribute_8794484622132: + sw $t1, 20($t0) # self.a = internal_96 + end_set_attribute_8794484622132: # Get attribute a of self - lw $t0, 668($sp) # Get the address of self - lw $t1, 20($t0) # Get the attribute 'a' from the instance + lw $t0, 724($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'a' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8744937250006 + beq $t6, $t5, int_get_attribute_8794484677946 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8744937250006 - j object_get_attribute_8744937250006 - int_get_attribute_8744937250006: + beq $t6, $t5, bool_get_attribute_8794484677946 + j object_get_attribute_8794484677946 + int_get_attribute_8794484677946: li $v0, 9 addi $a0, $zero, 12 syscall @@ -12086,9 +12432,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 248($sp) # internal_104 = self.a - j end_get_attribute_8744937250006 - bool_get_attribute_8744937250006: + sw $v0, 312($sp) # internal_102 = self.a + j end_get_attribute_8794484677946 + bool_get_attribute_8794484677946: li $v0, 9 addi $a0, $zero, 12 syscall @@ -12096,39 +12442,63 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 248($sp) # internal_104 = self.a - j end_get_attribute_8744937250006 - object_get_attribute_8744937250006: - sw $t1, 248($sp) # internal_104 = a - end_get_attribute_8744937250006: + sw $v0, 312($sp) # internal_102 = self.a + j end_get_attribute_8794484677946 + object_get_attribute_8794484677946: + sw $t1, 312($sp) # internal_102 = self.a + end_get_attribute_8794484677946: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 304($sp) # internal_104 = address of allocated object Int + + # Get method doh of Razz + lw $t0, 312($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 304($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 300($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_104 - lw $t0, 256($sp) - sw $t0, 0($sp) # Storing internal_104 + # Argument internal_102 + lw $t0, 320($sp) + sw $t0, 0($sp) # Storing internal_102 - # Calling function function_doh_at_Foo - jal function_doh_at_Foo + # Calling function internal_105 + lw $t0, 308($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 252($sp) # internal_105 = result of function_doh_at_Foo + sw $v1, 316($sp) # internal_103 = result of internal_105 addi $sp, $sp, 8 # Freeing space for arguments # Get attribute g of self - lw $t0, 668($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'g' from the instance + lw $t0, 724($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'g' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8744937250036 + beq $t6, $t5, int_get_attribute_8794484677985 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8744937250036 - j object_get_attribute_8744937250036 - int_get_attribute_8744937250036: + beq $t6, $t5, bool_get_attribute_8794484677985 + j object_get_attribute_8794484677985 + int_get_attribute_8794484677985: li $v0, 9 addi $a0, $zero, 12 syscall @@ -12136,9 +12506,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 240($sp) # internal_106 = self.g - j end_get_attribute_8744937250036 - bool_get_attribute_8744937250036: + sw $v0, 296($sp) # internal_106 = self.g + j end_get_attribute_8794484677985 + bool_get_attribute_8794484677985: li $v0, 9 addi $a0, $zero, 12 syscall @@ -12146,122 +12516,194 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 240($sp) # internal_106 = self.g - j end_get_attribute_8744937250036 - object_get_attribute_8744937250036: - sw $t1, 240($sp) # internal_106 = g - end_get_attribute_8744937250036: + sw $v0, 296($sp) # internal_106 = self.g + j end_get_attribute_8794484677985 + object_get_attribute_8794484677985: + sw $t1, 296($sp) # internal_106 = self.g + end_get_attribute_8794484677985: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 288($sp) # internal_108 = address of allocated object Int + + # Get method doh of Foo + lw $t0, 296($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 288($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 284($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_106 - lw $t0, 248($sp) + lw $t0, 304($sp) sw $t0, 0($sp) # Storing internal_106 - # Calling function function_doh_at_Foo - jal function_doh_at_Foo + # Calling function internal_109 + lw $t0, 292($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 244($sp) # internal_107 = result of function_doh_at_Foo + sw $v1, 300($sp) # internal_107 = result of internal_109 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_105 - lw $t0, 256($sp) - sw $t0, 4($sp) # Storing internal_105 + # Argument internal_103 + lw $t0, 320($sp) + sw $t0, 4($sp) # Storing internal_103 # Argument internal_107 - lw $t0, 248($sp) + lw $t0, 304($sp) sw $t0, 0($sp) # Storing internal_107 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 244($sp) # internal_108 = result of function_add + sw $v1, 292($sp) # internal_110 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 272($sp) # internal_112 = address of allocated object Int + + # Get method doh of Razz + lw $t0, 724($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 272($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 268($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 676($sp) + lw $t0, 732($sp) sw $t0, 0($sp) # Storing self - # Calling function function_doh_at_Foo - jal function_doh_at_Foo + # Calling function internal_113 + lw $t0, 276($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 236($sp) # internal_109 = result of function_doh_at_Foo + sw $v1, 284($sp) # internal_111 = result of internal_113 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_108 - lw $t0, 244($sp) - sw $t0, 4($sp) # Storing internal_108 + # Argument internal_110 + lw $t0, 292($sp) + sw $t0, 4($sp) # Storing internal_110 - # Argument internal_109 - lw $t0, 240($sp) - sw $t0, 0($sp) # Storing internal_109 + # Argument internal_111 + lw $t0, 288($sp) + sw $t0, 0($sp) # Storing internal_111 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 236($sp) # internal_110 = result of function_add + sw $v1, 276($sp) # internal_114 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 256($sp) # internal_116 = address of allocated object Int + + # Get method printh of Razz + lw $t0, 724($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 256($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 252($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 676($sp) + lw $t0, 732($sp) sw $t0, 0($sp) # Storing self - # Calling function function_printh_at_Bazz - jal function_printh_at_Bazz + # Calling function internal_117 + lw $t0, 260($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 228($sp) # internal_111 = result of function_printh_at_Bazz + sw $v1, 268($sp) # internal_115 = result of internal_117 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_110 - lw $t0, 236($sp) - sw $t0, 4($sp) # Storing internal_110 + # Argument internal_114 + lw $t0, 276($sp) + sw $t0, 4($sp) # Storing internal_114 - # Argument internal_111 - lw $t0, 232($sp) - sw $t0, 0($sp) # Storing internal_111 + # Argument internal_115 + lw $t0, 272($sp) + sw $t0, 0($sp) # Storing internal_115 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 228($sp) # internal_112 = result of function_add + sw $v1, 260($sp) # internal_118 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Set attribute b of self - lw $t0, 668($sp) # $t0 = self - lw $t1, 216($sp) # $t1 = internal_112 - beq $t1, $zero, object_set_attribute_8744937249946 + lw $t0, 724($sp) # $t0 = self + lw $t1, 248($sp) # $t1 = internal_118 + beq $t1, $zero, object_set_attribute_8794484673540 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937249946 + beq $t6, $t5, int_set_attribute_8794484673540 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937249946 - j object_set_attribute_8744937249946 - int_set_attribute_8744937249946: + beq $t6, $t5, bool_set_attribute_8794484673540 + j object_set_attribute_8794484673540 + int_set_attribute_8794484673540: li $v0, 9 addi $a0, $zero, 12 syscall @@ -12269,9 +12711,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 24($t0) # self.b = internal_112 - j end_set_attribute_8744937249946 - bool_set_attribute_8744937249946: + sw $v0, 24($t0) # self.b = internal_118 + j end_set_attribute_8794484673540 + bool_set_attribute_8794484673540: li $v0, 9 addi $a0, $zero, 12 syscall @@ -12279,11 +12721,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 24($t0) # self.b = internal_112 - j end_set_attribute_8744937249946 - object_set_attribute_8744937249946: - sw $t1, 24($t0) # self.b = internal_112 - end_set_attribute_8744937249946: + sw $v0, 24($t0) # self.b = internal_118 + j end_set_attribute_8794484673540 + object_set_attribute_8794484673540: + sw $t1, 24($t0) # self.b = internal_118 + end_set_attribute_8794484673540: # Allocating Int 0 li $v0, 9 @@ -12295,7 +12737,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 212($sp) # internal_113 = address of allocated object Int + sw $v0, 244($sp) # internal_119 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -12307,7 +12749,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 208($sp) # internal_114 = address of allocated object Int + sw $v0, 240($sp) # internal_120 = address of allocated object Int # Allocating Int 2 li $v0, 9 @@ -12319,10 +12761,10 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 204($sp) # internal_115 = address of allocated object Int + sw $v0, 236($sp) # internal_121 = address of allocated object Int - # Allocating NUll to internal_116 - sw $zero, 200($sp) # internal_116 = 0 + # Allocating NUll to internal_122 + sw $zero, 232($sp) # internal_122 = 0 # Allocating Int 0 li $v0, 9 @@ -12334,7 +12776,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 196($sp) # internal_117 = address of allocated object Int + sw $v0, 228($sp) # internal_123 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -12346,66 +12788,66 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 184($sp) # internal_120 = address of allocated object Int + sw $v0, 216($sp) # internal_126 = address of allocated object Int - # internal_118 = typeof self that is the first word of the object - lw $t0, 668($sp) + # internal_124 = typeof self that is the first word of the object + lw $t0, 724($sp) lw $t0, 0($t0) - sw $t0, 192($sp) + sw $t0, 224($sp) - # internal_119 = internal_118 - lw $t0, 192($sp) - sw $t0, 188($sp) + # internal_125 = internal_124 + lw $t0, 224($sp) + sw $t0, 220($sp) - while_start_8744937301390: + while_start_8794484690189: - # internal_120 = EqualAddress(internal_119, internal_116) - lw $t0, 188($sp) - lw $t1, 200($sp) + # internal_126 = EqualAddress(internal_125, internal_122) + lw $t0, 220($sp) + lw $t1, 232($sp) seq $t2, $t0, $t1 - lw $t0, 184($sp) + lw $t0, 216($sp) sw $t2, 8($t0) - # If internal_120 then goto while_end_8744937301390 - lw $t0, 184($sp) # Loading the address of the condition + # If internal_126 then goto while_end_8794484690189 + lw $t0, 216($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_end_8744937301390 + beq $t0, $t1, while_end_8794484690189 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_117 - lw $t0, 208($sp) - sw $t0, 4($sp) # Storing internal_117 + # Argument internal_123 + lw $t0, 240($sp) + sw $t0, 4($sp) # Storing internal_123 - # Argument internal_114 - lw $t0, 220($sp) - sw $t0, 0($sp) # Storing internal_114 + # Argument internal_120 + lw $t0, 252($sp) + sw $t0, 0($sp) # Storing internal_120 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 208($sp) # internal_117 = result of function_add + sw $v1, 240($sp) # internal_123 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # internal_119 = ancestor of internal_119 - lw $t0, 188($sp) + # internal_125 = ancestor of internal_125 + lw $t0, 220($sp) lw $t0, 4($t0) - sw $t0, 188($sp) + sw $t0, 220($sp) - # Jumping to while_start_8744937301390 - j while_start_8744937301390 + # Jumping to while_start_8794484690189 + j while_start_8794484690189 - while_end_8744937301390: + while_end_8794484690189: - # internal_119 = internal_118 - lw $t0, 192($sp) - sw $t0, 188($sp) + # internal_125 = internal_124 + lw $t0, 224($sp) + sw $t0, 220($sp) - # initialize Array [internal_117] - lw $t0, 196($sp) # $t0 = internal_117 + # initialize Array [internal_123] + lw $t0, 228($sp) # $t0 = internal_123 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -12413,7 +12855,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 180($sp) # internal_121 = new Array[internal_117] + sw $v0, 212($sp) # internal_127 = new Array[internal_123] # Allocating Int 0 li $v0, 9 @@ -12425,7 +12867,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 176($sp) # internal_122 = address of allocated object Int + sw $v0, 208($sp) # internal_128 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -12437,80 +12879,80 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 172($sp) # internal_123 = address of allocated object Int + sw $v0, 204($sp) # internal_129 = address of allocated object Int - foreach_start_8744937301390: + foreach_start_8794484690189: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_122 - lw $t0, 188($sp) - sw $t0, 4($sp) # Storing internal_122 + # Argument internal_128 + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing internal_128 - # Argument internal_117 - lw $t0, 208($sp) - sw $t0, 0($sp) # Storing internal_117 + # Argument internal_123 + lw $t0, 240($sp) + sw $t0, 0($sp) # Storing internal_123 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 184($sp) # internal_123 = result of function_less_than + sw $v1, 216($sp) # internal_129 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_123 then goto foreach_body_8744937301390 - lw $t0, 172($sp) # Loading the address of the condition + # If internal_129 then goto foreach_body_8794484690189 + lw $t0, 204($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_body_8744937301390 + beq $t0, $t1, foreach_body_8794484690189 - # Jumping to foreach_end_8744937301390 - j foreach_end_8744937301390 + # Jumping to foreach_end_8794484690189 + j foreach_end_8794484690189 - foreach_body_8744937301390: + foreach_body_8794484690189: - # array internal_121[4 * internal_122] = internal_119 - lw $t0, 176($sp) # $t0 = internal_122 + # array internal_127[4 * internal_128] = internal_125 + lw $t0, 208($sp) # $t0 = internal_128 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 180($sp) # $t1 = internal_121 + lw $t1, 212($sp) # $t1 = internal_127 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 188($sp) + lw $t0, 220($sp) sw $t0, 0($t1) - # internal_119 = ancestor of internal_119 - lw $t0, 188($sp) + # internal_125 = ancestor of internal_125 + lw $t0, 220($sp) lw $t0, 4($t0) - sw $t0, 188($sp) + sw $t0, 220($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_122 - lw $t0, 188($sp) - sw $t0, 4($sp) # Storing internal_122 - - # Argument internal_114 + # Argument internal_128 lw $t0, 220($sp) - sw $t0, 0($sp) # Storing internal_114 + sw $t0, 4($sp) # Storing internal_128 + + # Argument internal_120 + lw $t0, 252($sp) + sw $t0, 0($sp) # Storing internal_120 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 188($sp) # internal_122 = result of function_add + sw $v1, 220($sp) # internal_128 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_start_8744937301390 - j foreach_start_8744937301390 + # Jumping to foreach_start_8794484690189 + j foreach_start_8794484690189 - foreach_end_8744937301390: + foreach_end_8794484690189: - # initialize Array [internal_115] - lw $t0, 204($sp) # $t0 = internal_115 + # initialize Array [internal_121] + lw $t0, 236($sp) # $t0 = internal_121 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -12518,10 +12960,10 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 168($sp) # internal_124 = new Array[internal_115] + sw $v0, 200($sp) # internal_130 = new Array[internal_121] - # initialize Array [internal_115] - lw $t0, 204($sp) # $t0 = internal_115 + # initialize Array [internal_121] + lw $t0, 236($sp) # $t0 = internal_121 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -12529,7 +12971,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 164($sp) # internal_125 = new Array[internal_115] + sw $v0, 196($sp) # internal_131 = new Array[internal_121] # Allocating Int 0 li $v0, 9 @@ -12541,32 +12983,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 156($sp) # internal_127 = address of allocated object Int + sw $v0, 188($sp) # internal_133 = address of allocated object Int - # internal_126 = direction of Razz + # internal_132 = direction of Razz la $t0, type_Razz - sw $t0, 160($sp) + sw $t0, 192($sp) - # array internal_124[4 * internal_127] = internal_126 - lw $t0, 156($sp) # $t0 = internal_127 + # array internal_130[4 * internal_133] = internal_132 + lw $t0, 188($sp) # $t0 = internal_133 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 168($sp) # $t1 = internal_124 + lw $t1, 200($sp) # $t1 = internal_130 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 160($sp) + lw $t0, 192($sp) sw $t0, 0($t1) - # array internal_125[4 * internal_127] = internal_117 - lw $t0, 156($sp) # $t0 = internal_127 + # array internal_131[4 * internal_133] = internal_123 + lw $t0, 188($sp) # $t0 = internal_133 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 164($sp) # $t1 = internal_125 + lw $t1, 196($sp) # $t1 = internal_131 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 196($sp) + lw $t0, 228($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -12580,32 +13022,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 148($sp) # internal_129 = address of allocated object Int + sw $v0, 180($sp) # internal_135 = address of allocated object Int - # internal_128 = direction of Bar + # internal_134 = direction of Bar la $t0, type_Bar - sw $t0, 152($sp) + sw $t0, 184($sp) - # array internal_124[4 * internal_129] = internal_128 - lw $t0, 148($sp) # $t0 = internal_129 + # array internal_130[4 * internal_135] = internal_134 + lw $t0, 180($sp) # $t0 = internal_135 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 168($sp) # $t1 = internal_124 + lw $t1, 200($sp) # $t1 = internal_130 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 152($sp) + lw $t0, 184($sp) sw $t0, 0($t1) - # array internal_125[4 * internal_129] = internal_117 - lw $t0, 148($sp) # $t0 = internal_129 + # array internal_131[4 * internal_135] = internal_123 + lw $t0, 180($sp) # $t0 = internal_135 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 164($sp) # $t1 = internal_125 + lw $t1, 196($sp) # $t1 = internal_131 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 196($sp) + lw $t0, 228($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -12619,7 +13061,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 144($sp) # internal_130 = address of allocated object Int + sw $v0, 176($sp) # internal_136 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -12631,7 +13073,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 140($sp) # internal_131 = address of allocated object Int + sw $v0, 172($sp) # internal_137 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -12643,7 +13085,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 132($sp) # internal_133 = address of allocated object Int + sw $v0, 164($sp) # internal_139 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -12655,7 +13097,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 128($sp) # internal_134 = address of allocated object Int + sw $v0, 160($sp) # internal_140 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -12667,155 +13109,155 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 120($sp) # internal_136 = address of allocated object Int + sw $v0, 152($sp) # internal_142 = address of allocated object Int - foreach_type_start_8744937301390: + foreach_type_start_8794484690189: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_130 - lw $t0, 156($sp) - sw $t0, 4($sp) # Storing internal_130 + # Argument internal_136 + lw $t0, 188($sp) + sw $t0, 4($sp) # Storing internal_136 - # Argument internal_115 - lw $t0, 216($sp) - sw $t0, 0($sp) # Storing internal_115 + # Argument internal_121 + lw $t0, 248($sp) + sw $t0, 0($sp) # Storing internal_121 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 152($sp) # internal_131 = result of function_less_than + sw $v1, 184($sp) # internal_137 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_131 then goto foreach_type_body_8744937301390 - lw $t0, 140($sp) # Loading the address of the condition + # If internal_137 then goto foreach_type_body_8794484690189 + lw $t0, 172($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_type_body_8744937301390 + beq $t0, $t1, foreach_type_body_8794484690189 - # Jumping to foreach_type_end_8744937301390 - j foreach_type_end_8744937301390 + # Jumping to foreach_type_end_8794484690189 + j foreach_type_end_8794484690189 - foreach_type_body_8744937301390: + foreach_type_body_8794484690189: - # internal_132 = array internal_124[4 * internal_130] - lw $t0, 144($sp) # $t0 = internal_130 + # internal_138 = array internal_130[4 * internal_136] + lw $t0, 176($sp) # $t0 = internal_136 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 168($sp) # $t1 = internal_124 + lw $t1, 200($sp) # $t1 = internal_130 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - sw $t0, 136($sp) # internal_132 = array internal_124[4 * internal_130] + sw $t0, 168($sp) # internal_138 = array internal_130[4 * internal_136] # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_133 - lw $t0, 144($sp) - sw $t0, 4($sp) # Storing internal_133 + # Argument internal_139 + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing internal_139 - # Argument internal_113 - lw $t0, 224($sp) - sw $t0, 0($sp) # Storing internal_113 + # Argument internal_119 + lw $t0, 256($sp) + sw $t0, 0($sp) # Storing internal_119 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 144($sp) # internal_133 = result of function_assign + sw $v1, 176($sp) # internal_139 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - foreach_ancestor_start_8744937301390: + foreach_ancestor_start_8794484690189: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_133 - lw $t0, 144($sp) - sw $t0, 4($sp) # Storing internal_133 + # Argument internal_139 + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing internal_139 - # Argument internal_117 - lw $t0, 208($sp) - sw $t0, 0($sp) # Storing internal_117 + # Argument internal_123 + lw $t0, 240($sp) + sw $t0, 0($sp) # Storing internal_123 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 140($sp) # internal_134 = result of function_less_than + sw $v1, 172($sp) # internal_140 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_134 then goto foreach_ancestor_body_8744937301390 - lw $t0, 128($sp) # Loading the address of the condition + # If internal_140 then goto foreach_ancestor_body_8794484690189 + lw $t0, 160($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_body_8744937301390 + beq $t0, $t1, foreach_ancestor_body_8794484690189 - # Jumping to foreach_ancestor_end_8744937301390 - j foreach_ancestor_end_8744937301390 + # Jumping to foreach_ancestor_end_8794484690189 + j foreach_ancestor_end_8794484690189 - foreach_ancestor_body_8744937301390: + foreach_ancestor_body_8794484690189: - # internal_135 = array internal_121[4 * internal_133] - lw $t0, 132($sp) # $t0 = internal_133 + # internal_141 = array internal_127[4 * internal_139] + lw $t0, 164($sp) # $t0 = internal_139 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 180($sp) # $t1 = internal_121 + lw $t1, 212($sp) # $t1 = internal_127 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - sw $t0, 124($sp) # internal_135 = array internal_121[4 * internal_133] + sw $t0, 156($sp) # internal_141 = array internal_127[4 * internal_139] - # internal_136 = EqualAddress(internal_132, internal_135) - lw $t0, 136($sp) - lw $t1, 124($sp) + # internal_142 = EqualAddress(internal_138, internal_141) + lw $t0, 168($sp) + lw $t1, 156($sp) seq $t2, $t0, $t1 - lw $t0, 120($sp) + lw $t0, 152($sp) sw $t2, 8($t0) - # If internal_136 then goto foreach_ancestor_end_8744937301390 - lw $t0, 120($sp) # Loading the address of the condition + # If internal_142 then goto foreach_ancestor_end_8794484690189 + lw $t0, 152($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_end_8744937301390 + beq $t0, $t1, foreach_ancestor_end_8794484690189 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_133 - lw $t0, 144($sp) - sw $t0, 4($sp) # Storing internal_133 + # Argument internal_139 + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing internal_139 - # Argument internal_114 - lw $t0, 220($sp) - sw $t0, 0($sp) # Storing internal_114 + # Argument internal_120 + lw $t0, 252($sp) + sw $t0, 0($sp) # Storing internal_120 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 144($sp) # internal_133 = result of function_add + sw $v1, 176($sp) # internal_139 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_ancestor_start_8744937301390 - j foreach_ancestor_start_8744937301390 + # Jumping to foreach_ancestor_start_8794484690189 + j foreach_ancestor_start_8794484690189 - foreach_ancestor_end_8744937301390: + foreach_ancestor_end_8794484690189: - # array internal_125[4 * internal_130] = internal_133 - lw $t0, 144($sp) # $t0 = internal_130 + # array internal_131[4 * internal_136] = internal_139 + lw $t0, 176($sp) # $t0 = internal_136 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 164($sp) # $t1 = internal_125 + lw $t1, 196($sp) # $t1 = internal_131 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 132($sp) + lw $t0, 164($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -12823,60 +13265,24 @@ addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_130 - lw $t0, 156($sp) - sw $t0, 4($sp) # Storing internal_130 + # Argument internal_136 + lw $t0, 188($sp) + sw $t0, 4($sp) # Storing internal_136 - # Argument internal_114 - lw $t0, 220($sp) - sw $t0, 0($sp) # Storing internal_114 + # Argument internal_120 + lw $t0, 252($sp) + sw $t0, 0($sp) # Storing internal_120 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 156($sp) # internal_130 = result of function_add + sw $v1, 188($sp) # internal_136 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_type_start_8744937301390 - j foreach_type_start_8744937301390 + # Jumping to foreach_type_start_8794484690189 + j foreach_type_start_8794484690189 - foreach_type_end_8744937301390: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_142[0] = '\n' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 96($sp) # internal_142 = "\n" - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_143[0] = ' ' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 92($sp) # internal_143 = " " + foreach_type_end_8794484690189: # Allocating Int 0 li $v0, 9 @@ -12888,7 +13294,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 116($sp) # internal_137 = address of allocated object Int + sw $v0, 148($sp) # internal_143 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -12900,7 +13306,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 112($sp) # internal_138 = address of allocated object Int + sw $v0, 144($sp) # internal_144 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -12912,7 +13318,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 108($sp) # internal_139 = address of allocated object Int + sw $v0, 140($sp) # internal_145 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -12924,7 +13330,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 104($sp) # internal_140 = address of allocated object Int + sw $v0, 136($sp) # internal_146 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -12936,161 +13342,161 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 100($sp) # internal_141 = address of allocated object Int + sw $v0, 132($sp) # internal_147 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_140 - lw $t0, 116($sp) - sw $t0, 4($sp) # Storing internal_140 + # Argument internal_146 + lw $t0, 148($sp) + sw $t0, 4($sp) # Storing internal_146 - # Argument internal_117 - lw $t0, 208($sp) - sw $t0, 0($sp) # Storing internal_117 + # Argument internal_123 + lw $t0, 240($sp) + sw $t0, 0($sp) # Storing internal_123 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 116($sp) # internal_140 = result of function_assign + sw $v1, 148($sp) # internal_146 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - foreach_min_start_8744937301390: + foreach_min_start_8794484690189: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_137 - lw $t0, 128($sp) - sw $t0, 4($sp) # Storing internal_137 + # Argument internal_143 + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing internal_143 - # Argument internal_115 - lw $t0, 216($sp) - sw $t0, 0($sp) # Storing internal_115 + # Argument internal_121 + lw $t0, 248($sp) + sw $t0, 0($sp) # Storing internal_121 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 112($sp) # internal_141 = result of function_less_than + sw $v1, 144($sp) # internal_147 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_141 then goto foreach_min_body_8744937301390 - lw $t0, 100($sp) # Loading the address of the condition + # If internal_147 then goto foreach_min_body_8794484690189 + lw $t0, 132($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_min_body_8744937301390 + beq $t0, $t1, foreach_min_body_8794484690189 - # Jumping to foreach_min_end_8744937301390 - j foreach_min_end_8744937301390 + # Jumping to foreach_min_end_8794484690189 + j foreach_min_end_8794484690189 - foreach_min_body_8744937301390: + foreach_min_body_8794484690189: - # internal_139 = array internal_125[4 * internal_137] - lw $t0, 116($sp) # $t0 = internal_137 + # internal_145 = array internal_131[4 * internal_143] + lw $t0, 148($sp) # $t0 = internal_143 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 164($sp) # $t1 = internal_125 + lw $t1, 196($sp) # $t1 = internal_131 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 108($sp) # internal_139 = array internal_125[4 * internal_137] + lw $t2, 140($sp) # internal_145 = array internal_131[4 * internal_143] sw $t0, 8($t2) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_139 - lw $t0, 120($sp) - sw $t0, 4($sp) # Storing internal_139 + # Argument internal_145 + lw $t0, 152($sp) + sw $t0, 4($sp) # Storing internal_145 - # Argument internal_140 - lw $t0, 116($sp) - sw $t0, 0($sp) # Storing internal_140 + # Argument internal_146 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_146 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 112($sp) # internal_141 = result of function_less_than + sw $v1, 144($sp) # internal_147 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_141 then goto update_min_8744937301390 - lw $t0, 100($sp) # Loading the address of the condition + # If internal_147 then goto update_min_8794484690189 + lw $t0, 132($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, update_min_8744937301390 + beq $t0, $t1, update_min_8794484690189 - # Jumping to update_min_end_8744937301390 - j update_min_end_8744937301390 + # Jumping to update_min_end_8794484690189 + j update_min_end_8794484690189 - update_min_8744937301390: + update_min_8794484690189: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_140 - lw $t0, 116($sp) - sw $t0, 4($sp) # Storing internal_140 + # Argument internal_146 + lw $t0, 148($sp) + sw $t0, 4($sp) # Storing internal_146 - # Argument internal_139 - lw $t0, 120($sp) - sw $t0, 0($sp) # Storing internal_139 + # Argument internal_145 + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing internal_145 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 116($sp) # internal_140 = result of function_assign + sw $v1, 148($sp) # internal_146 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_138 - lw $t0, 124($sp) - sw $t0, 4($sp) # Storing internal_138 + # Argument internal_144 + lw $t0, 156($sp) + sw $t0, 4($sp) # Storing internal_144 - # Argument internal_137 - lw $t0, 128($sp) - sw $t0, 0($sp) # Storing internal_137 + # Argument internal_143 + lw $t0, 160($sp) + sw $t0, 0($sp) # Storing internal_143 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 124($sp) # internal_138 = result of function_assign + sw $v1, 156($sp) # internal_144 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - update_min_end_8744937301390: + update_min_end_8794484690189: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_137 - lw $t0, 128($sp) - sw $t0, 4($sp) # Storing internal_137 + # Argument internal_143 + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing internal_143 - # Argument internal_114 - lw $t0, 220($sp) - sw $t0, 0($sp) # Storing internal_114 + # Argument internal_120 + lw $t0, 252($sp) + sw $t0, 0($sp) # Storing internal_120 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 128($sp) # internal_137 = result of function_add + sw $v1, 160($sp) # internal_143 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_min_start_8744937301390 - j foreach_min_start_8744937301390 + # Jumping to foreach_min_start_8794484690189 + j foreach_min_start_8794484690189 - foreach_min_end_8744937301390: + foreach_min_end_8794484690189: - # initialize Array [internal_115] - lw $t0, 204($sp) # $t0 = internal_115 + # initialize Array [internal_121] + lw $t0, 236($sp) # $t0 = internal_121 lw $t0, 8($t0) # $t0 = value of the size addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 @@ -13098,7 +13504,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 88($sp) # internal_144 = new Array[internal_115] + sw $v0, 128($sp) # internal_148 = new Array[internal_121] # Allocating Int 0 li $v0, 9 @@ -13110,17 +13516,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 84($sp) # internal_145 = address of allocated object Int + sw $v0, 124($sp) # internal_149 = address of allocated object Int - # array internal_144[4 * internal_145] = internal_113 - lw $t0, 84($sp) # $t0 = internal_145 + # array internal_148[4 * internal_149] = internal_119 + lw $t0, 124($sp) # $t0 = internal_149 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 88($sp) # $t1 = internal_144 + lw $t1, 128($sp) # $t1 = internal_148 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 212($sp) + lw $t0, 244($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -13134,17 +13540,17 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # internal_146 = address of allocated object Int + sw $v0, 120($sp) # internal_150 = address of allocated object Int - # array internal_144[4 * internal_146] = internal_113 - lw $t0, 80($sp) # $t0 = internal_146 + # array internal_148[4 * internal_150] = internal_119 + lw $t0, 120($sp) # $t0 = internal_150 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 88($sp) # $t1 = internal_144 + lw $t1, 128($sp) # $t1 = internal_148 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 212($sp) + lw $t0, 244($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -13158,41 +13564,41 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 76($sp) # internal_147 = address of allocated object Int + sw $v0, 116($sp) # internal_151 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_140 - lw $t0, 116($sp) - sw $t0, 4($sp) # Storing internal_140 + # Argument internal_146 + lw $t0, 148($sp) + sw $t0, 4($sp) # Storing internal_146 - # Argument internal_117 - lw $t0, 208($sp) - sw $t0, 0($sp) # Storing internal_117 + # Argument internal_123 + lw $t0, 240($sp) + sw $t0, 0($sp) # Storing internal_123 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 88($sp) # internal_147 = result of function_equal + sw $v1, 128($sp) # internal_151 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # If internal_147 then goto error_branch_8744937301390 - lw $t0, 76($sp) # Loading the address of the condition + # If internal_151 then goto error_branch_8794484690189 + lw $t0, 116($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, error_branch_8744937301390 + beq $t0, $t1, error_branch_8794484690189 - # array internal_144[4 * internal_138] = internal_114 - lw $t0, 112($sp) # $t0 = internal_138 + # array internal_148[4 * internal_144] = internal_120 + lw $t0, 144($sp) # $t0 = internal_144 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 88($sp) # $t1 = internal_144 + lw $t1, 128($sp) # $t1 = internal_148 add $t1, $t1, $t0 # Move the pointer to the index - lw $t0, 208($sp) + lw $t0, 240($sp) lw $t0, 8($t0) sw $t0, 0($t1) @@ -13206,7 +13612,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 72($sp) # internal_148 = address of allocated object Int + sw $v0, 112($sp) # internal_152 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -13218,25 +13624,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 68($sp) # internal_149 = address of allocated object Int + sw $v0, 108($sp) # internal_153 = address of allocated object Int - # internal_148 = array internal_144[4 * internal_149] - lw $t0, 68($sp) # $t0 = internal_149 + # internal_152 = array internal_148[4 * internal_153] + lw $t0, 108($sp) # $t0 = internal_153 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 88($sp) # $t1 = internal_144 + lw $t1, 128($sp) # $t1 = internal_148 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 72($sp) # internal_148 = array internal_144[4 * internal_149] + lw $t2, 112($sp) # internal_152 = array internal_148[4 * internal_153] sw $t0, 8($t2) - # If internal_148 then goto branch_Razz_8744937301390 - lw $t0, 72($sp) # Loading the address of the condition + # If internal_152 then goto branch_Razz_8794484690189 + lw $t0, 112($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Razz_8744937301390 + beq $t0, $t1, branch_Razz_8794484690189 # Allocating Int 1 li $v0, 9 @@ -13248,44 +13654,44 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 64($sp) # internal_150 = address of allocated object Int + sw $v0, 104($sp) # internal_154 = address of allocated object Int - # internal_148 = array internal_144[4 * internal_150] - lw $t0, 64($sp) # $t0 = internal_150 + # internal_152 = array internal_148[4 * internal_154] + lw $t0, 104($sp) # $t0 = internal_154 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 88($sp) # $t1 = internal_144 + lw $t1, 128($sp) # $t1 = internal_148 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 72($sp) # internal_148 = array internal_144[4 * internal_150] + lw $t2, 112($sp) # internal_152 = array internal_148[4 * internal_154] sw $t0, 8($t2) - # If internal_148 then goto branch_Bar_8744937301390 - lw $t0, 72($sp) # Loading the address of the condition + # If internal_152 then goto branch_Bar_8794484690189 + lw $t0, 112($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Bar_8744937301390 + beq $t0, $t1, branch_Bar_8794484690189 - branch_Razz_8744937301390: + branch_Razz_8794484690189: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 484($sp) + lw $t0, 548($sp) sw $t0, 4($sp) # Storing n # Argument self - lw $t0, 680($sp) + lw $t0, 736($sp) sw $t0, 0($sp) # Storing self # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 484($sp) # n = result of function_assign + sw $v1, 548($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bar @@ -13295,110 +13701,110 @@ la $t0, type_Bar # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 52($sp) # internal_153 = address of allocated object Bar + sw $v0, 92($sp) # internal_157 = address of allocated object Bar # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_153 - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing internal_153 + # Argument internal_157 + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing internal_157 # Calling function function___init___at_Bar jal function___init___at_Bar lw $ra, 4($sp) - sw $v1, 60($sp) # internal_153 = result of function___init___at_Bar + sw $v1, 100($sp) # internal_157 = result of function___init___at_Bar addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_151 - lw $t0, 72($sp) - sw $t0, 4($sp) # Storing internal_151 + # Argument internal_155 + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing internal_155 - # Argument internal_153 - lw $t0, 64($sp) - sw $t0, 0($sp) # Storing internal_153 + # Argument internal_157 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_157 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 72($sp) # internal_151 = result of function_assign + sw $v1, 112($sp) # internal_155 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_151 = internal_153 - lw $t0, 52($sp) - sw $t0, 60($sp) + # internal_155 = internal_157 + lw $t0, 92($sp) + sw $t0, 100($sp) - # Jumping to branch_end_8744937301390 - j branch_end_8744937301390 + # Jumping to branch_end_8794484690189 + j branch_end_8794484690189 - branch_Bar_8744937301390: + branch_Bar_8794484690189: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 484($sp) + lw $t0, 548($sp) sw $t0, 4($sp) # Storing n # Argument self - lw $t0, 680($sp) + lw $t0, 736($sp) sw $t0, 0($sp) # Storing self # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 484($sp) # n = result of function_assign + sw $v1, 548($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_151 - lw $t0, 72($sp) - sw $t0, 4($sp) # Storing internal_151 + # Argument internal_155 + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing internal_155 # Argument n - lw $t0, 484($sp) + lw $t0, 548($sp) sw $t0, 0($sp) # Storing n # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 72($sp) # internal_151 = result of function_assign + sw $v1, 112($sp) # internal_155 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_151 = n - lw $t0, 472($sp) - sw $t0, 60($sp) + # internal_155 = n + lw $t0, 536($sp) + sw $t0, 100($sp) - # Jumping to branch_end_8744937301390 - j branch_end_8744937301390 + # Jumping to branch_end_8794484690189 + j branch_end_8794484690189 - error_branch_8744937301390: + error_branch_8794484690189: - branch_end_8744937301390: + branch_end_8794484690189: # Set attribute e of self - lw $t0, 668($sp) # $t0 = self - lw $t1, 60($sp) # $t1 = internal_151 - beq $t1, $zero, object_set_attribute_8744937250395 + lw $t0, 724($sp) # $t0 = self + lw $t1, 100($sp) # $t1 = internal_155 + beq $t1, $zero, object_set_attribute_8794484675603 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937250395 + beq $t6, $t5, int_set_attribute_8794484675603 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937250395 - j object_set_attribute_8744937250395 - int_set_attribute_8744937250395: + beq $t6, $t5, bool_set_attribute_8794484675603 + j object_set_attribute_8794484675603 + int_set_attribute_8794484675603: li $v0, 9 addi $a0, $zero, 12 syscall @@ -13406,9 +13812,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 28($t0) # self.e = internal_151 - j end_set_attribute_8744937250395 - bool_set_attribute_8744937250395: + sw $v0, 28($t0) # self.e = internal_155 + j end_set_attribute_8794484675603 + bool_set_attribute_8794484675603: li $v0, 9 addi $a0, $zero, 12 syscall @@ -13416,25 +13822,25 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 28($t0) # self.e = internal_151 - j end_set_attribute_8744937250395 - object_set_attribute_8744937250395: - sw $t1, 28($t0) # self.e = internal_151 - end_set_attribute_8744937250395: + sw $v0, 28($t0) # self.e = internal_155 + j end_set_attribute_8794484675603 + object_set_attribute_8794484675603: + sw $t1, 28($t0) # self.e = internal_155 + end_set_attribute_8794484675603: # Get attribute a of self - lw $t0, 668($sp) # Get the address of self - lw $t1, 20($t0) # Get the attribute 'a' from the instance + lw $t0, 724($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'a' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8744937253437 + beq $t6, $t5, int_get_attribute_8794484654758 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8744937253437 - j object_get_attribute_8744937253437 - int_get_attribute_8744937253437: + beq $t6, $t5, bool_get_attribute_8794484654758 + j object_get_attribute_8794484654758 + int_get_attribute_8794484654758: li $v0, 9 addi $a0, $zero, 12 syscall @@ -13442,9 +13848,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 44($sp) # internal_155 = self.a - j end_get_attribute_8744937253437 - bool_get_attribute_8744937253437: + sw $v0, 84($sp) # internal_159 = self.a + j end_get_attribute_8794484654758 + bool_get_attribute_8794484654758: li $v0, 9 addi $a0, $zero, 12 syscall @@ -13452,39 +13858,62 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 44($sp) # internal_155 = self.a - j end_get_attribute_8744937253437 - object_get_attribute_8744937253437: - sw $t1, 44($sp) # internal_155 = a - end_get_attribute_8744937253437: + sw $v0, 84($sp) # internal_159 = self.a + j end_get_attribute_8794484654758 + object_get_attribute_8794484654758: + sw $t1, 84($sp) # internal_159 = self.a + end_get_attribute_8794484654758: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_161 = address of allocated object Int + + # Get method doh of Bazz + lw $t0, 84($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 76($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 72($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_155 - lw $t0, 52($sp) - sw $t0, 0($sp) # Storing internal_155 + # Argument internal_159 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_159 - # Calling function function_doh_at_Foo - jal function_doh_at_Foo + # Calling function function_doh_at_Bazz + jal function_doh_at_Bazz lw $ra, 4($sp) - sw $v1, 48($sp) # internal_156 = result of function_doh_at_Foo + sw $v1, 88($sp) # internal_160 = result of function_doh_at_Bazz addi $sp, $sp, 8 # Freeing space for arguments # Get attribute g of self - lw $t0, 668($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'g' from the instance + lw $t0, 724($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'g' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8744937253467 + beq $t6, $t5, int_get_attribute_8794484654680 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8744937253467 - j object_get_attribute_8744937253467 - int_get_attribute_8744937253467: + beq $t6, $t5, bool_get_attribute_8794484654680 + j object_get_attribute_8794484654680 + int_get_attribute_8794484654680: li $v0, 9 addi $a0, $zero, 12 syscall @@ -13492,9 +13921,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 36($sp) # internal_157 = self.g - j end_get_attribute_8744937253467 - bool_get_attribute_8744937253467: + sw $v0, 68($sp) # internal_163 = self.g + j end_get_attribute_8794484654680 + bool_get_attribute_8794484654680: li $v0, 9 addi $a0, $zero, 12 syscall @@ -13502,57 +13931,81 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 36($sp) # internal_157 = self.g - j end_get_attribute_8744937253467 - object_get_attribute_8744937253467: - sw $t1, 36($sp) # internal_157 = g - end_get_attribute_8744937253467: + sw $v0, 68($sp) # internal_163 = self.g + j end_get_attribute_8794484654680 + object_get_attribute_8794484654680: + sw $t1, 68($sp) # internal_163 = self.g + end_get_attribute_8794484654680: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_165 = address of allocated object Int + + # Get method doh of Foo + lw $t0, 68($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 60($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 56($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_157 - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_157 + # Argument internal_163 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_163 - # Calling function function_doh_at_Foo - jal function_doh_at_Foo + # Calling function internal_166 + lw $t0, 64($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 40($sp) # internal_158 = result of function_doh_at_Foo + sw $v1, 72($sp) # internal_164 = result of internal_166 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_156 - lw $t0, 52($sp) - sw $t0, 4($sp) # Storing internal_156 + # Argument internal_160 + lw $t0, 92($sp) + sw $t0, 4($sp) # Storing internal_160 - # Argument internal_158 - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_158 + # Argument internal_164 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_164 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 40($sp) # internal_159 = result of function_add + sw $v1, 64($sp) # internal_167 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Get attribute e of self - lw $t0, 668($sp) # Get the address of self - lw $t1, 28($t0) # Get the attribute 'e' from the instance + lw $t0, 724($sp) # Get the address of self + lw $t1, 28($t0) # Get the attribute 'e' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8744937253512 + beq $t6, $t5, int_get_attribute_8794484654806 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8744937253512 - j object_get_attribute_8744937253512 - int_get_attribute_8744937253512: + beq $t6, $t5, bool_get_attribute_8794484654806 + j object_get_attribute_8794484654806 + int_get_attribute_8794484654806: li $v0, 9 addi $a0, $zero, 12 syscall @@ -13560,9 +14013,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 24($sp) # internal_160 = self.e - j end_get_attribute_8744937253512 - bool_get_attribute_8744937253512: + sw $v0, 48($sp) # internal_168 = self.e + j end_get_attribute_8794484654806 + bool_get_attribute_8794484654806: li $v0, 9 addi $a0, $zero, 12 syscall @@ -13570,122 +14023,194 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 24($sp) # internal_160 = self.e - j end_get_attribute_8744937253512 - object_get_attribute_8744937253512: - sw $t1, 24($sp) # internal_160 = e - end_get_attribute_8744937253512: + sw $v0, 48($sp) # internal_168 = self.e + j end_get_attribute_8794484654806 + object_get_attribute_8794484654806: + sw $t1, 48($sp) # internal_168 = self.e + end_get_attribute_8794484654806: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_170 = address of allocated object Int + + # Get method doh of Bar + lw $t0, 48($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 40($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 36($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_160 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_160 + # Argument internal_168 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_168 - # Calling function function_doh_at_Foo - jal function_doh_at_Foo + # Calling function internal_171 + lw $t0, 44($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 28($sp) # internal_161 = result of function_doh_at_Foo + sw $v1, 52($sp) # internal_169 = result of internal_171 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_159 - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing internal_159 + # Argument internal_167 + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing internal_167 - # Argument internal_161 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_161 + # Argument internal_169 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_169 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 28($sp) # internal_162 = result of function_add + sw $v1, 44($sp) # internal_172 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_174 = address of allocated object Int + + # Get method doh of Razz + lw $t0, 724($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 24($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 20($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 676($sp) + lw $t0, 732($sp) sw $t0, 0($sp) # Storing self - # Calling function function_doh_at_Foo - jal function_doh_at_Foo + # Calling function internal_175 + lw $t0, 28($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 20($sp) # internal_163 = result of function_doh_at_Foo + sw $v1, 36($sp) # internal_173 = result of internal_175 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_162 - lw $t0, 28($sp) - sw $t0, 4($sp) # Storing internal_162 + # Argument internal_172 + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing internal_172 - # Argument internal_163 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_163 + # Argument internal_173 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_173 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 20($sp) # internal_164 = result of function_add + sw $v1, 28($sp) # internal_176 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_178 = address of allocated object Int + + # Get method printh of Razz + lw $t0, 724($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 676($sp) + lw $t0, 732($sp) sw $t0, 0($sp) # Storing self - # Calling function function_printh_at_Bazz - jal function_printh_at_Bazz + # Calling function internal_179 + lw $t0, 12($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 12($sp) # internal_165 = result of function_printh_at_Bazz + sw $v1, 20($sp) # internal_177 = result of internal_179 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_164 - lw $t0, 20($sp) - sw $t0, 4($sp) # Storing internal_164 + # Argument internal_176 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_176 - # Argument internal_165 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_165 + # Argument internal_177 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_177 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 12($sp) # internal_166 = result of function_add + sw $v1, 12($sp) # internal_180 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Set attribute f of self - lw $t0, 668($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_166 - beq $t1, $zero, object_set_attribute_8744937253105 + lw $t0, 724($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_180 + beq $t1, $zero, object_set_attribute_8794484654695 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937253105 + beq $t6, $t5, int_set_attribute_8794484654695 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937253105 - j object_set_attribute_8744937253105 - int_set_attribute_8744937253105: + beq $t6, $t5, bool_set_attribute_8794484654695 + j object_set_attribute_8794484654695 + int_set_attribute_8794484654695: li $v0, 9 addi $a0, $zero, 12 syscall @@ -13693,9 +14218,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 32($t0) # self.f = internal_166 - j end_set_attribute_8744937253105 - bool_set_attribute_8744937253105: + sw $v0, 32($t0) # self.f = internal_180 + j end_set_attribute_8794484654695 + bool_set_attribute_8794484654695: li $v0, 9 addi $a0, $zero, 12 syscall @@ -13703,17 +14228,17 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 32($t0) # self.f = internal_166 - j end_set_attribute_8744937253105 - object_set_attribute_8744937253105: - sw $t1, 32($t0) # self.f = internal_166 - end_set_attribute_8744937253105: + sw $v0, 32($t0) # self.f = internal_180 + j end_set_attribute_8794484654695 + object_set_attribute_8794484654695: + sw $t1, 32($t0) # self.f = internal_180 + end_set_attribute_8794484654695: # Loading return value in $v1 - lw $v1, 668($sp) + lw $v1, 724($sp) # Freeing space for local variables - addi $sp, $sp, 668 + addi $sp, $sp, 724 jr $ra @@ -13740,17 +14265,17 @@ # Set attribute h of self lw $t0, 224($sp) # $t0 = self lw $t1, 220($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8744937253626 + beq $t1, $zero, object_set_attribute_8794484653707 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937253626 + beq $t6, $t5, int_set_attribute_8794484653707 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937253626 - j object_set_attribute_8744937253626 - int_set_attribute_8744937253626: + beq $t6, $t5, bool_set_attribute_8794484653707 + j object_set_attribute_8794484653707 + int_set_attribute_8794484653707: li $v0, 9 addi $a0, $zero, 12 syscall @@ -13759,8 +14284,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.h = internal_0 - j end_set_attribute_8744937253626 - bool_set_attribute_8744937253626: + j end_set_attribute_8794484653707 + bool_set_attribute_8794484653707: li $v0, 9 addi $a0, $zero, 12 syscall @@ -13769,10 +14294,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.h = internal_0 - j end_set_attribute_8744937253626 - object_set_attribute_8744937253626: + j end_set_attribute_8794484653707 + object_set_attribute_8794484653707: sw $t1, 8($t0) # self.h = internal_0 - end_set_attribute_8744937253626: + end_set_attribute_8794484653707: # Allocating Int 0 li $v0, 9 @@ -13846,7 +14371,7 @@ lw $t0, 196($sp) sw $t0, 192($sp) - while_start_8744937301489: + while_start_8794484671537: # internal_8 = EqualAddress(internal_7, internal_4) lw $t0, 192($sp) @@ -13855,11 +14380,11 @@ lw $t0, 188($sp) sw $t2, 8($t0) - # If internal_8 then goto while_end_8744937301489 + # If internal_8 then goto while_end_8794484671537 lw $t0, 188($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_end_8744937301489 + beq $t0, $t1, while_end_8794484671537 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -13884,10 +14409,10 @@ lw $t0, 4($t0) sw $t0, 192($sp) - # Jumping to while_start_8744937301489 - j while_start_8744937301489 + # Jumping to while_start_8794484671537 + j while_start_8794484671537 - while_end_8744937301489: + while_end_8794484671537: # internal_7 = internal_6 lw $t0, 196($sp) @@ -13928,7 +14453,7 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 176($sp) # internal_11 = address of allocated object Int - foreach_start_8744937301489: + foreach_start_8794484671537: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -13948,16 +14473,16 @@ sw $v1, 188($sp) # internal_11 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_11 then goto foreach_body_8744937301489 + # If internal_11 then goto foreach_body_8794484671537 lw $t0, 176($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_body_8744937301489 + beq $t0, $t1, foreach_body_8794484671537 - # Jumping to foreach_end_8744937301489 - j foreach_end_8744937301489 + # Jumping to foreach_end_8794484671537 + j foreach_end_8794484671537 - foreach_body_8744937301489: + foreach_body_8794484671537: # array internal_9[4 * internal_10] = internal_7 lw $t0, 180($sp) # $t0 = internal_10 @@ -13993,10 +14518,10 @@ sw $v1, 192($sp) # internal_10 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_start_8744937301489 - j foreach_start_8744937301489 + # Jumping to foreach_start_8794484671537 + j foreach_start_8794484671537 - foreach_end_8744937301489: + foreach_end_8794484671537: # initialize Array [internal_3] lw $t0, 208($sp) # $t0 = internal_3 @@ -14236,7 +14761,7 @@ sw $t0, 8($v0) # Setting value in the third word of the object sw $v0, 108($sp) # internal_28 = address of allocated object Int - foreach_type_start_8744937301489: + foreach_type_start_8794484671537: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -14256,16 +14781,16 @@ sw $v1, 140($sp) # internal_23 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_23 then goto foreach_type_body_8744937301489 + # If internal_23 then goto foreach_type_body_8794484671537 lw $t0, 128($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_type_body_8744937301489 + beq $t0, $t1, foreach_type_body_8794484671537 - # Jumping to foreach_type_end_8744937301489 - j foreach_type_end_8744937301489 + # Jumping to foreach_type_end_8794484671537 + j foreach_type_end_8794484671537 - foreach_type_body_8744937301489: + foreach_type_body_8794484671537: # internal_24 = array internal_12[4 * internal_22] lw $t0, 132($sp) # $t0 = internal_22 @@ -14296,7 +14821,7 @@ sw $v1, 132($sp) # internal_25 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - foreach_ancestor_start_8744937301489: + foreach_ancestor_start_8794484671537: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -14316,16 +14841,16 @@ sw $v1, 128($sp) # internal_26 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_26 then goto foreach_ancestor_body_8744937301489 + # If internal_26 then goto foreach_ancestor_body_8794484671537 lw $t0, 116($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_body_8744937301489 + beq $t0, $t1, foreach_ancestor_body_8794484671537 - # Jumping to foreach_ancestor_end_8744937301489 - j foreach_ancestor_end_8744937301489 + # Jumping to foreach_ancestor_end_8794484671537 + j foreach_ancestor_end_8794484671537 - foreach_ancestor_body_8744937301489: + foreach_ancestor_body_8794484671537: # internal_27 = array internal_9[4 * internal_25] lw $t0, 120($sp) # $t0 = internal_25 @@ -14345,11 +14870,11 @@ lw $t0, 108($sp) sw $t2, 8($t0) - # If internal_28 then goto foreach_ancestor_end_8744937301489 + # If internal_28 then goto foreach_ancestor_end_8794484671537 lw $t0, 108($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_ancestor_end_8744937301489 + beq $t0, $t1, foreach_ancestor_end_8794484671537 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -14369,10 +14894,10 @@ sw $v1, 132($sp) # internal_25 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_ancestor_start_8744937301489 - j foreach_ancestor_start_8744937301489 + # Jumping to foreach_ancestor_start_8794484671537 + j foreach_ancestor_start_8794484671537 - foreach_ancestor_end_8744937301489: + foreach_ancestor_end_8794484671537: # array internal_13[4 * internal_22] = internal_25 lw $t0, 132($sp) # $t0 = internal_22 @@ -14404,46 +14929,10 @@ sw $v1, 144($sp) # internal_22 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_type_start_8744937301489 - j foreach_type_start_8744937301489 - - foreach_type_end_8744937301489: - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_34[0] = '\n' - - sb $zero, 9($v0) # Null-terminator at the end of the string - - sw $v0, 84($sp) # internal_34 = "\n" - - # Allocating String - li $v0, 9 - addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator - syscall - - la $t0, type_String - sw $t0, 0($v0) # Setting type in the first word of the object - - addi $t0, $zero, 10 - sw $t0, 4($v0) # Setting length of the string in the second word of the object - - addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_35[0] = ' ' - - sb $zero, 9($v0) # Null-terminator at the end of the string + # Jumping to foreach_type_start_8794484671537 + j foreach_type_start_8794484671537 - sw $v0, 80($sp) # internal_35 = " " + foreach_type_end_8794484671537: # Allocating Int 0 li $v0, 9 @@ -14523,7 +15012,7 @@ sw $v1, 104($sp) # internal_32 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - foreach_min_start_8744937301489: + foreach_min_start_8794484671537: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -14543,16 +15032,16 @@ sw $v1, 100($sp) # internal_33 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_33 then goto foreach_min_body_8744937301489 + # If internal_33 then goto foreach_min_body_8794484671537 lw $t0, 88($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, foreach_min_body_8744937301489 + beq $t0, $t1, foreach_min_body_8794484671537 - # Jumping to foreach_min_end_8744937301489 - j foreach_min_end_8744937301489 + # Jumping to foreach_min_end_8794484671537 + j foreach_min_end_8794484671537 - foreach_min_body_8744937301489: + foreach_min_body_8794484671537: # internal_31 = array internal_13[4 * internal_29] lw $t0, 104($sp) # $t0 = internal_29 @@ -14584,16 +15073,16 @@ sw $v1, 100($sp) # internal_33 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_33 then goto update_min_8744937301489 + # If internal_33 then goto update_min_8794484671537 lw $t0, 88($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, update_min_8744937301489 + beq $t0, $t1, update_min_8794484671537 - # Jumping to update_min_end_8744937301489 - j update_min_end_8744937301489 + # Jumping to update_min_end_8794484671537 + j update_min_end_8794484671537 - update_min_8744937301489: + update_min_8794484671537: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -14631,7 +15120,7 @@ sw $v1, 112($sp) # internal_30 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - update_min_end_8744937301489: + update_min_end_8794484671537: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -14651,10 +15140,10 @@ sw $v1, 116($sp) # internal_29 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to foreach_min_start_8744937301489 - j foreach_min_start_8744937301489 + # Jumping to foreach_min_start_8794484671537 + j foreach_min_start_8794484671537 - foreach_min_end_8744937301489: + foreach_min_end_8794484671537: # initialize Array [internal_3] lw $t0, 208($sp) # $t0 = internal_3 @@ -14665,7 +15154,7 @@ li $v0, 9 move $a0, $t0 syscall - sw $v0, 76($sp) # internal_36 = new Array[internal_3] + sw $v0, 84($sp) # internal_34 = new Array[internal_3] # Allocating Int 0 li $v0, 9 @@ -14677,15 +15166,15 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 72($sp) # internal_37 = address of allocated object Int + sw $v0, 80($sp) # internal_35 = address of allocated object Int - # array internal_36[4 * internal_37] = internal_1 - lw $t0, 72($sp) # $t0 = internal_37 + # array internal_34[4 * internal_35] = internal_1 + lw $t0, 80($sp) # $t0 = internal_35 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 76($sp) # $t1 = internal_36 + lw $t1, 84($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 216($sp) lw $t0, 8($t0) @@ -14701,15 +15190,15 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 68($sp) # internal_38 = address of allocated object Int + sw $v0, 76($sp) # internal_36 = address of allocated object Int - # array internal_36[4 * internal_38] = internal_1 - lw $t0, 68($sp) # $t0 = internal_38 + # array internal_34[4 * internal_36] = internal_1 + lw $t0, 76($sp) # $t0 = internal_36 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 76($sp) # $t1 = internal_36 + lw $t1, 84($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 216($sp) lw $t0, 8($t0) @@ -14725,15 +15214,15 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 64($sp) # internal_39 = address of allocated object Int + sw $v0, 72($sp) # internal_37 = address of allocated object Int - # array internal_36[4 * internal_39] = internal_1 - lw $t0, 64($sp) # $t0 = internal_39 + # array internal_34[4 * internal_37] = internal_1 + lw $t0, 72($sp) # $t0 = internal_37 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 76($sp) # $t1 = internal_36 + lw $t1, 84($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 216($sp) lw $t0, 8($t0) @@ -14749,15 +15238,15 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_40 = address of allocated object Int + sw $v0, 68($sp) # internal_38 = address of allocated object Int - # array internal_36[4 * internal_40] = internal_1 - lw $t0, 60($sp) # $t0 = internal_40 + # array internal_34[4 * internal_38] = internal_1 + lw $t0, 68($sp) # $t0 = internal_38 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 76($sp) # $t1 = internal_36 + lw $t1, 84($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 216($sp) lw $t0, 8($t0) @@ -14773,7 +15262,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 56($sp) # internal_41 = address of allocated object Int + sw $v0, 64($sp) # internal_39 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -14790,22 +15279,22 @@ # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 68($sp) # internal_41 = result of function_equal + sw $v1, 76($sp) # internal_39 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # If internal_41 then goto error_branch_8744937301489 - lw $t0, 56($sp) # Loading the address of the condition + # If internal_39 then goto error_branch_8794484671537 + lw $t0, 64($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, error_branch_8744937301489 + beq $t0, $t1, error_branch_8794484671537 - # array internal_36[4 * internal_30] = internal_2 + # array internal_34[4 * internal_30] = internal_2 lw $t0, 100($sp) # $t0 = internal_30 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 76($sp) # $t1 = internal_36 + lw $t1, 84($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 212($sp) lw $t0, 8($t0) @@ -14821,7 +15310,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 52($sp) # internal_42 = address of allocated object Int + sw $v0, 60($sp) # internal_40 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -14833,25 +15322,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_43 = address of allocated object Int + sw $v0, 56($sp) # internal_41 = address of allocated object Int - # internal_42 = array internal_36[4 * internal_43] - lw $t0, 48($sp) # $t0 = internal_43 + # internal_40 = array internal_34[4 * internal_41] + lw $t0, 56($sp) # $t0 = internal_41 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 76($sp) # $t1 = internal_36 + lw $t1, 84($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 52($sp) # internal_42 = array internal_36[4 * internal_43] + lw $t2, 60($sp) # internal_40 = array internal_34[4 * internal_41] sw $t0, 8($t2) - # If internal_42 then goto branch_Bazz_8744937301489 - lw $t0, 52($sp) # Loading the address of the condition + # If internal_40 then goto branch_Bazz_8794484671537 + lw $t0, 60($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Bazz_8744937301489 + beq $t0, $t1, branch_Bazz_8794484671537 # Allocating Int 1 li $v0, 9 @@ -14863,25 +15352,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_44 = address of allocated object Int + sw $v0, 52($sp) # internal_42 = address of allocated object Int - # internal_42 = array internal_36[4 * internal_44] - lw $t0, 44($sp) # $t0 = internal_44 + # internal_40 = array internal_34[4 * internal_42] + lw $t0, 52($sp) # $t0 = internal_42 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 76($sp) # $t1 = internal_36 + lw $t1, 84($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 52($sp) # internal_42 = array internal_36[4 * internal_44] + lw $t2, 60($sp) # internal_40 = array internal_34[4 * internal_42] sw $t0, 8($t2) - # If internal_42 then goto branch_Razz_8744937301489 - lw $t0, 52($sp) # Loading the address of the condition + # If internal_40 then goto branch_Razz_8794484671537 + lw $t0, 60($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Razz_8744937301489 + beq $t0, $t1, branch_Razz_8794484671537 # Allocating Int 2 li $v0, 9 @@ -14893,25 +15382,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_45 = address of allocated object Int + sw $v0, 48($sp) # internal_43 = address of allocated object Int - # internal_42 = array internal_36[4 * internal_45] - lw $t0, 40($sp) # $t0 = internal_45 + # internal_40 = array internal_34[4 * internal_43] + lw $t0, 48($sp) # $t0 = internal_43 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 76($sp) # $t1 = internal_36 + lw $t1, 84($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 52($sp) # internal_42 = array internal_36[4 * internal_45] + lw $t2, 60($sp) # internal_40 = array internal_34[4 * internal_43] sw $t0, 8($t2) - # If internal_42 then goto branch_Foo_8744937301489 - lw $t0, 52($sp) # Loading the address of the condition + # If internal_40 then goto branch_Foo_8794484671537 + lw $t0, 60($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Foo_8744937301489 + beq $t0, $t1, branch_Foo_8794484671537 # Allocating Int 3 li $v0, 9 @@ -14923,34 +15412,34 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_46 = address of allocated object Int + sw $v0, 44($sp) # internal_44 = address of allocated object Int - # internal_42 = array internal_36[4 * internal_46] - lw $t0, 36($sp) # $t0 = internal_46 + # internal_40 = array internal_34[4 * internal_44] + lw $t0, 44($sp) # $t0 = internal_44 lw $t0, 8($t0) # $t0 = value of the index addi $t1, $zero, 4 # $t1 = 4 mult $t0, $t1 # $t0 = $t0 * 4 mflo $t0 - lw $t1, 76($sp) # $t1 = internal_36 + lw $t1, 84($sp) # $t1 = internal_34 add $t1, $t1, $t0 # Move the pointer to the index lw $t0, 0($t1) # $t1 = value in the position - lw $t2, 52($sp) # internal_42 = array internal_36[4 * internal_46] + lw $t2, 60($sp) # internal_40 = array internal_34[4 * internal_44] sw $t0, 8($t2) - # If internal_42 then goto branch_Bar_8744937301489 - lw $t0, 52($sp) # Loading the address of the condition + # If internal_40 then goto branch_Bar_8794484671537 + lw $t0, 60($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, branch_Bar_8744937301489 + beq $t0, $t1, branch_Bar_8794484671537 - branch_Bazz_8744937301489: + branch_Bazz_8794484671537: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 40($sp) + lw $t0, 48($sp) sw $t0, 4($sp) # Storing n # Argument self @@ -14960,7 +15449,7 @@ # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 40($sp) # n = result of function_assign + sw $v1, 48($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Foo @@ -14970,55 +15459,55 @@ la $t0, type_Foo # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 24($sp) # internal_49 = address of allocated object Foo + sw $v0, 32($sp) # internal_47 = address of allocated object Foo # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_49 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_49 + # Argument internal_47 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_47 # Calling function function___init___at_Foo jal function___init___at_Foo lw $ra, 4($sp) - sw $v1, 32($sp) # internal_49 = result of function___init___at_Foo + sw $v1, 40($sp) # internal_47 = result of function___init___at_Foo addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address + # Argument internal_45 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_45 + # Argument internal_47 lw $t0, 44($sp) - sw $t0, 4($sp) # Storing internal_47 - - # Argument internal_49 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_49 + sw $t0, 0($sp) # Storing internal_47 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 44($sp) # internal_47 = result of function_assign + sw $v1, 52($sp) # internal_45 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_47 = internal_49 - lw $t0, 24($sp) - sw $t0, 32($sp) + # internal_45 = internal_47 + lw $t0, 32($sp) + sw $t0, 40($sp) - # Jumping to branch_end_8744937301489 - j branch_end_8744937301489 + # Jumping to branch_end_8794484671537 + j branch_end_8794484671537 - branch_Razz_8744937301489: + branch_Razz_8794484671537: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 40($sp) + lw $t0, 48($sp) sw $t0, 4($sp) # Storing n # Argument self @@ -15028,7 +15517,7 @@ # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 40($sp) # n = result of function_assign + sw $v1, 48($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bar @@ -15038,55 +15527,55 @@ la $t0, type_Bar # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 16($sp) # internal_51 = address of allocated object Bar + sw $v0, 24($sp) # internal_49 = address of allocated object Bar # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_51 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_51 + # Argument internal_49 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_49 # Calling function function___init___at_Bar jal function___init___at_Bar lw $ra, 4($sp) - sw $v1, 24($sp) # internal_51 = result of function___init___at_Bar + sw $v1, 32($sp) # internal_49 = result of function___init___at_Bar addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_47 - lw $t0, 44($sp) - sw $t0, 4($sp) # Storing internal_47 + # Argument internal_45 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_45 - # Argument internal_51 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_51 + # Argument internal_49 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_49 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 44($sp) # internal_47 = result of function_assign + sw $v1, 52($sp) # internal_45 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_47 = internal_51 - lw $t0, 16($sp) - sw $t0, 32($sp) + # internal_45 = internal_49 + lw $t0, 24($sp) + sw $t0, 40($sp) - # Jumping to branch_end_8744937301489 - j branch_end_8744937301489 + # Jumping to branch_end_8794484671537 + j branch_end_8794484671537 - branch_Foo_8744937301489: + branch_Foo_8794484671537: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 40($sp) + lw $t0, 48($sp) sw $t0, 4($sp) # Storing n # Argument self @@ -15096,7 +15585,7 @@ # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 40($sp) # n = result of function_assign + sw $v1, 48($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Razz @@ -15106,55 +15595,55 @@ la $t0, type_Razz # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 8($sp) # internal_53 = address of allocated object Razz + sw $v0, 16($sp) # internal_51 = address of allocated object Razz # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_53 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_53 + # Argument internal_51 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_51 # Calling function function___init___at_Razz jal function___init___at_Razz lw $ra, 4($sp) - sw $v1, 16($sp) # internal_53 = result of function___init___at_Razz + sw $v1, 24($sp) # internal_51 = result of function___init___at_Razz addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_47 - lw $t0, 44($sp) - sw $t0, 4($sp) # Storing internal_47 + # Argument internal_45 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_45 - # Argument internal_53 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_53 + # Argument internal_51 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_51 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 44($sp) # internal_47 = result of function_assign + sw $v1, 52($sp) # internal_45 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_47 = internal_53 - lw $t0, 8($sp) - sw $t0, 32($sp) + # internal_45 = internal_51 + lw $t0, 16($sp) + sw $t0, 40($sp) - # Jumping to branch_end_8744937301489 - j branch_end_8744937301489 + # Jumping to branch_end_8794484671537 + j branch_end_8794484671537 - branch_Bar_8744937301489: + branch_Bar_8794484671537: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument n - lw $t0, 40($sp) + lw $t0, 48($sp) sw $t0, 4($sp) # Storing n # Argument self @@ -15164,52 +15653,52 @@ # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 40($sp) # n = result of function_assign + sw $v1, 48($sp) # n = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_47 - lw $t0, 44($sp) - sw $t0, 4($sp) # Storing internal_47 + # Argument internal_45 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_45 # Argument n - lw $t0, 40($sp) + lw $t0, 48($sp) sw $t0, 0($sp) # Storing n # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 44($sp) # internal_47 = result of function_assign + sw $v1, 52($sp) # internal_45 = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_47 = n - lw $t0, 28($sp) - sw $t0, 32($sp) + # internal_45 = n + lw $t0, 36($sp) + sw $t0, 40($sp) - # Jumping to branch_end_8744937301489 - j branch_end_8744937301489 + # Jumping to branch_end_8794484671537 + j branch_end_8794484671537 - error_branch_8744937301489: + error_branch_8794484671537: - branch_end_8744937301489: + branch_end_8794484671537: # Set attribute g of self lw $t0, 224($sp) # $t0 = self - lw $t1, 32($sp) # $t1 = internal_47 - beq $t1, $zero, object_set_attribute_8744937254169 + lw $t1, 40($sp) # $t1 = internal_45 + beq $t1, $zero, object_set_attribute_8794484653728 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937254169 + beq $t6, $t5, int_set_attribute_8794484653728 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937254169 - j object_set_attribute_8744937254169 - int_set_attribute_8744937254169: + beq $t6, $t5, bool_set_attribute_8794484653728 + j object_set_attribute_8794484653728 + int_set_attribute_8794484653728: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15217,9 +15706,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.g = internal_47 - j end_set_attribute_8744937254169 - bool_set_attribute_8744937254169: + sw $v0, 12($t0) # self.g = internal_45 + j end_set_attribute_8794484653728 + bool_set_attribute_8794484653728: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15227,11 +15716,34 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.g = internal_47 - j end_set_attribute_8744937254169 - object_set_attribute_8744937254169: - sw $t1, 12($t0) # self.g = internal_47 - end_set_attribute_8744937254169: + sw $v0, 12($t0) # self.g = internal_45 + j end_set_attribute_8794484653728 + object_set_attribute_8794484653728: + sw $t1, 12($t0) # self.g = internal_45 + end_set_attribute_8794484653728: + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_54 = address of allocated object Int + + # Get method printh of Bazz + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments @@ -15241,26 +15753,27 @@ lw $t0, 232($sp) sw $t0, 0($sp) # Storing self - # Calling function function_printh_at_Bazz - jal function_printh_at_Bazz + # Calling function internal_55 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_55 = result of function_printh_at_Bazz + sw $v1, 16($sp) # internal_53 = result of internal_55 addi $sp, $sp, 8 # Freeing space for arguments # Set attribute i of self lw $t0, 224($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_55 - beq $t1, $zero, object_set_attribute_8744937254148 + lw $t1, 8($sp) # $t1 = internal_53 + beq $t1, $zero, object_set_attribute_8794484653701 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937254148 + beq $t6, $t5, int_set_attribute_8794484653701 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937254148 - j object_set_attribute_8744937254148 - int_set_attribute_8744937254148: + beq $t6, $t5, bool_set_attribute_8794484653701 + j object_set_attribute_8794484653701 + int_set_attribute_8794484653701: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15268,9 +15781,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 16($t0) # self.i = internal_55 - j end_set_attribute_8744937254148 - bool_set_attribute_8744937254148: + sw $v0, 16($t0) # self.i = internal_53 + j end_set_attribute_8794484653701 + bool_set_attribute_8794484653701: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15278,11 +15791,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 16($t0) # self.i = internal_55 - j end_set_attribute_8744937254148 - object_set_attribute_8744937254148: - sw $t1, 16($t0) # self.i = internal_55 - end_set_attribute_8744937254148: + sw $v0, 16($t0) # self.i = internal_53 + j end_set_attribute_8794484653701 + object_set_attribute_8794484653701: + sw $t1, 16($t0) # self.i = internal_53 + end_set_attribute_8794484653701: # Loading return value in $v1 lw $v1, 224($sp) @@ -15294,25 +15807,25 @@ function_printh_at_Bazz: # Function parameters - # $ra = 16($sp) - # self = 12($sp) + # $ra = 24($sp) + # self = 20($sp) # Reserving space for local variables - addi $sp, $sp, -12 + addi $sp, $sp, -20 # Get attribute h of self - lw $t0, 12($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'h' from the instance + lw $t0, 20($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'h' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8744937257798 + beq $t6, $t5, int_get_attribute_8794484682042 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8744937257798 - j object_get_attribute_8744937257798 - int_get_attribute_8744937257798: + beq $t6, $t5, bool_get_attribute_8794484682042 + j object_get_attribute_8794484682042 + int_get_attribute_8794484682042: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15320,9 +15833,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($sp) # internal_0 = self.h - j end_get_attribute_8744937257798 - bool_get_attribute_8744937257798: + sw $v0, 16($sp) # internal_0 = self.h + j end_get_attribute_8794484682042 + bool_get_attribute_8794484682042: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15330,28 +15843,52 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($sp) # internal_0 = self.h - j end_get_attribute_8744937257798 - object_get_attribute_8744937257798: - sw $t1, 8($sp) # internal_0 = h - end_get_attribute_8744937257798: + sw $v0, 16($sp) # internal_0 = self.h + j end_get_attribute_8794484682042 + object_get_attribute_8794484682042: + sw $t1, 16($sp) # internal_0 = self.h + end_get_attribute_8794484682042: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_2 = address of allocated object Int + + # Get method out_int of Bazz + lw $t0, 20($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing self # Argument internal_0 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_out_int_at_IO - jal function_out_int_at_IO + # Calling function internal_3 + lw $t0, 16($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 16($sp) # internal_1 = result of function_out_int_at_IO + sw $v1, 24($sp) # internal_1 = result of internal_3 addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 0 @@ -15364,13 +15901,13 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_2 = address of allocated object Int + sw $v0, 0($sp) # internal_4 = address of allocated object Int # Loading return value in $v1 lw $v1, 0($sp) # Freeing space for local variables - addi $sp, $sp, 12 + addi $sp, $sp, 20 jr $ra @@ -15384,17 +15921,17 @@ # Get attribute h of self lw $t0, 20($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'h' from the instance + lw $t1, 8($t0) # Get the attribute 'h' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8744937257864 + beq $t6, $t5, int_get_attribute_8794484682015 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8744937257864 - j object_get_attribute_8744937257864 - int_get_attribute_8744937257864: + beq $t6, $t5, bool_get_attribute_8794484682015 + j object_get_attribute_8794484682015 + int_get_attribute_8794484682015: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15403,8 +15940,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($sp) # internal_1 = self.h - j end_get_attribute_8744937257864 - bool_get_attribute_8744937257864: + j end_get_attribute_8794484682015 + bool_get_attribute_8794484682015: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15413,10 +15950,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($sp) # internal_1 = self.h - j end_get_attribute_8744937257864 - object_get_attribute_8744937257864: - sw $t1, 12($sp) # internal_1 = h - end_get_attribute_8744937257864: + j end_get_attribute_8794484682015 + object_get_attribute_8794484682015: + sw $t1, 12($sp) # internal_1 = self.h + end_get_attribute_8794484682015: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -15438,17 +15975,17 @@ # Get attribute h of self lw $t0, 20($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'h' from the instance + lw $t1, 8($t0) # Get the attribute 'h' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8744937257930 + beq $t6, $t5, int_get_attribute_8794484682141 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8744937257930 - j object_get_attribute_8744937257930 - int_get_attribute_8744937257930: + beq $t6, $t5, bool_get_attribute_8794484682141 + j object_get_attribute_8794484682141 + int_get_attribute_8794484682141: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15457,8 +15994,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($sp) # internal_2 = self.h - j end_get_attribute_8744937257930 - bool_get_attribute_8744937257930: + j end_get_attribute_8794484682141 + bool_get_attribute_8794484682141: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15467,10 +16004,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($sp) # internal_2 = self.h - j end_get_attribute_8744937257930 - object_get_attribute_8744937257930: - sw $t1, 8($sp) # internal_2 = h - end_get_attribute_8744937257930: + j end_get_attribute_8794484682141 + object_get_attribute_8794484682141: + sw $t1, 8($sp) # internal_2 = self.h + end_get_attribute_8794484682141: # Allocating Int 1 li $v0, 9 @@ -15505,17 +16042,17 @@ # Set attribute h of self lw $t0, 20($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_4 - beq $t1, $zero, object_set_attribute_8744937257906 + beq $t1, $zero, object_set_attribute_8794484682165 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937257906 + beq $t6, $t5, int_set_attribute_8794484682165 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937257906 - j object_set_attribute_8744937257906 - int_set_attribute_8744937257906: + beq $t6, $t5, bool_set_attribute_8794484682165 + j object_set_attribute_8794484682165 + int_set_attribute_8794484682165: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15524,8 +16061,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.h = internal_4 - j end_set_attribute_8744937257906 - bool_set_attribute_8744937257906: + j end_set_attribute_8794484682165 + bool_set_attribute_8794484682165: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15534,10 +16071,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.h = internal_4 - j end_set_attribute_8744937257906 - object_set_attribute_8744937257906: + j end_set_attribute_8794484682165 + object_set_attribute_8794484682165: sw $t1, 8($t0) # self.h = internal_4 - end_set_attribute_8744937257906: + end_set_attribute_8794484682165: # Loading return value in $v1 lw $v1, 16($sp) @@ -15581,17 +16118,17 @@ # Set attribute a of self lw $t0, 16($sp) # $t0 = self lw $t1, 12($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8744937257978 + beq $t1, $zero, object_set_attribute_8794484682219 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937257978 + beq $t6, $t5, int_set_attribute_8794484682219 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937257978 - j object_set_attribute_8744937257978 - int_set_attribute_8744937257978: + beq $t6, $t5, bool_set_attribute_8794484682219 + j object_set_attribute_8794484682219 + int_set_attribute_8794484682219: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15600,8 +16137,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.a = internal_0 - j end_set_attribute_8744937257978 - bool_set_attribute_8744937257978: + j end_set_attribute_8794484682219 + bool_set_attribute_8794484682219: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15610,10 +16147,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.a = internal_0 - j end_set_attribute_8744937257978 - object_set_attribute_8744937257978: + j end_set_attribute_8794484682219 + object_set_attribute_8794484682219: sw $t1, 8($t0) # self.a = internal_0 - end_set_attribute_8744937257978: + end_set_attribute_8794484682219: # Allocating Foo li $v0, 9 @@ -15641,17 +16178,17 @@ # Set attribute b of self lw $t0, 16($sp) # $t0 = self lw $t1, 8($sp) # $t1 = internal_1 - beq $t1, $zero, object_set_attribute_8744937258530 + beq $t1, $zero, object_set_attribute_8794484682045 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937258530 + beq $t6, $t5, int_set_attribute_8794484682045 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937258530 - j object_set_attribute_8744937258530 - int_set_attribute_8744937258530: + beq $t6, $t5, bool_set_attribute_8794484682045 + j object_set_attribute_8794484682045 + int_set_attribute_8794484682045: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15660,8 +16197,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.b = internal_1 - j end_set_attribute_8744937258530 - bool_set_attribute_8744937258530: + j end_set_attribute_8794484682045 + bool_set_attribute_8794484682045: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15670,10 +16207,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.b = internal_1 - j end_set_attribute_8744937258530 - object_set_attribute_8744937258530: + j end_set_attribute_8794484682045 + object_set_attribute_8794484682045: sw $t1, 12($t0) # self.b = internal_1 - end_set_attribute_8744937258530: + end_set_attribute_8794484682045: # Allocating Razz li $v0, 9 @@ -15701,17 +16238,17 @@ # Set attribute c of self lw $t0, 16($sp) # $t0 = self lw $t1, 4($sp) # $t1 = internal_2 - beq $t1, $zero, object_set_attribute_8744937258560 + beq $t1, $zero, object_set_attribute_8794484682527 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937258560 + beq $t6, $t5, int_set_attribute_8794484682527 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937258560 - j object_set_attribute_8744937258560 - int_set_attribute_8744937258560: + beq $t6, $t5, bool_set_attribute_8794484682527 + j object_set_attribute_8794484682527 + int_set_attribute_8794484682527: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15720,8 +16257,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.c = internal_2 - j end_set_attribute_8744937258560 - bool_set_attribute_8744937258560: + j end_set_attribute_8794484682527 + bool_set_attribute_8794484682527: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15730,10 +16267,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.c = internal_2 - j end_set_attribute_8744937258560 - object_set_attribute_8744937258560: + j end_set_attribute_8794484682527 + object_set_attribute_8794484682527: sw $t1, 16($t0) # self.c = internal_2 - end_set_attribute_8744937258560: + end_set_attribute_8794484682527: # Allocating Bar li $v0, 9 @@ -15761,17 +16298,17 @@ # Set attribute d of self lw $t0, 16($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_3 - beq $t1, $zero, object_set_attribute_8744937258593 + beq $t1, $zero, object_set_attribute_8794484682557 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8744937258593 + beq $t6, $t5, int_set_attribute_8794484682557 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8744937258593 - j object_set_attribute_8744937258593 - int_set_attribute_8744937258593: + beq $t6, $t5, bool_set_attribute_8794484682557 + j object_set_attribute_8794484682557 + int_set_attribute_8794484682557: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15780,8 +16317,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 20($t0) # self.d = internal_3 - j end_set_attribute_8744937258593 - bool_set_attribute_8744937258593: + j end_set_attribute_8794484682557 + bool_set_attribute_8794484682557: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15790,10 +16327,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 20($t0) # self.d = internal_3 - j end_set_attribute_8744937258593 - object_set_attribute_8744937258593: + j end_set_attribute_8794484682557 + object_set_attribute_8794484682557: sw $t1, 20($t0) # self.d = internal_3 - end_set_attribute_8744937258593: + end_set_attribute_8794484682557: # Loading return value in $v1 lw $v1, 16($sp) @@ -15866,7 +16403,7 @@ main: # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Allocating Main li $v0, 9 @@ -15875,34 +16412,58 @@ la $t0, type_Main # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object Main + sw $v0, 12($sp) # internal_0 = address of allocated object Main # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_Main jal function___init___at_Main lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_main_at_Main - jal function_main_at_Main + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + sw $v1, 16($sp) # internal_1 = result of internal_3 addi $sp, $sp, 8 # Freeing space for arguments # Exit program diff --git a/tests/codegen/hello_world.mips b/tests/codegen/hello_world.mips index 36ea4cb0d..aaa620711 100644 --- a/tests/codegen/hello_world.mips +++ b/tests/codegen/hello_world.mips @@ -1,45 +1,81 @@ .data - type_Object: .word 8 + type_Object: .word 24 type_Object_inherits_from: .word 0 - type_Object_attributes: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_Main: .word 44 + type_Main_inherits_from: .word type_IO + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_out_string: .word function_out_string_at_IO + type_Main_out_int: .word function_out_int_at_IO + type_Main_in_string: .word function_in_string_at_IO + type_Main_in_int: .word function_in_int_at_IO + type_Main_main: .word function_main_at_Main + type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" - type_Object_abort_message: .asciiz "Abort called from class Object\n" - type_IO: .word 8 - type_IO_inherits_from: .word type_Object - type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" - type_IO_abort_message: .asciiz "Abort called from class IO\n" - - type_Int: .word 8 - type_Int_inherits_from: .word type_Object - type_Int_attributes: .word 0 - type_Int_name_size: .word 3 - type_Int_name: .asciiz "Int" - type_Int_abort_message: .asciiz "Abort called from class Int\n" - type_String: .word 8 - type_String_inherits_from: .word type_Object - type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" - type_String_abort_message: .asciiz "Abort called from class String\n" - type_Bool: .word 8 - type_Bool_inherits_from: .word type_Object - type_Bool_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" - type_Bool_abort_message: .asciiz "Abort called from class Bool\n" - type_Main: .word 8 - type_Main_inherits_from: .word type_IO - type_Main_attributes: .word 0 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" - type_Main_abort_message: .asciiz "Abort called from class Main\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -700,11 +736,11 @@ function_abort_at_Object: # Function parameters - # $ra = 20($sp) - # self = 16($sp) + # $ra = 28($sp) + # self = 24($sp) # Reserving space for local variables - addi $sp, $sp, -16 + addi $sp, $sp, -24 # Allocating String li $v0, 9 @@ -791,7 +827,7 @@ sb $zero, 32($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_0 = "Abort called from class " + sw $v0, 20($sp) # internal_0 = "Abort called from class " # Allocating String li $v0, 9 @@ -805,66 +841,138 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_2[0] = '\n' + sb $t0, 8($v0) # internal_3[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_2 = "\n" + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 0($sp) # Storing self - # Calling function function_type_name_at_Object - jal function_type_name_at_Object + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + sw $v1, 24($sp) # internal_1 = result of internal_5 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_0 - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing internal_0 # Argument internal_1 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_1 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_3 - lw $t0, 12($sp) - sw $t0, 4($sp) # Storing internal_3 - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 - # Calling function function_concat_at_String - jal function_concat_at_String + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) # $t0 = internal_3 + lw $t0, 12($sp) # $t0 = internal_2 addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string internal_3 + # Printing the String internal_2 li $v0, 4 move $a0, $t0 syscall @@ -874,10 +982,10 @@ syscall # Loading return value in $v1 - lw $v1, 16($sp) + lw $v1, 24($sp) # Freeing space for local variables - addi $sp, $sp, 16 + addi $sp, $sp, 24 jr $ra @@ -892,8 +1000,9 @@ # internal_0 = name of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($t0) # $t1 = type of self - lw $t2, 12($t1) # $t1 = length of the name of self - la $t3, 16($t1) # $t1 = name of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 @@ -996,7 +1105,7 @@ lw $t0, 0($sp) # $t0 = x addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string x + # Printing the String x li $v0, 4 move $a0, $t0 syscall @@ -1012,7 +1121,7 @@ # self = 4($sp) # x = 0($sp) - # Printing the string x + # Printing the Int x li $v0, 1 lw $a0, 0($sp) lw $a0, 8($a0) @@ -1039,11 +1148,13 @@ xor $t0, $t0, $t0 # Initializing counter while_read_start: lb $t1, buffer_input($t0) # Loading the byte - beq $t1, $zero, while_read_end + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end addi $t0, $t0, 1 # Incrementing counter j while_read_start while_read_end: - addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 @@ -1290,6 +1401,26 @@ jr $ra + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + function___init___at_Main: # Function parameters # $ra = 4($sp) @@ -1302,11 +1433,11 @@ function_main_at_Main: # Function parameters - # $ra = 12($sp) - # self = 8($sp) + # $ra = 20($sp) + # self = 16($sp) # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Allocating String li $v0, 9 @@ -1363,37 +1494,61 @@ sb $zero, 22($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_0 = "Hello, World.\n" + sw $v0, 12($sp) # internal_0 = "Hello, World.\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 4($sp) # Storing self # Argument internal_0 - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_3 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_1 = result of function_out_string_at_IO + sw $v1, 20($sp) # internal_1 = result of internal_3 addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 8 + addi $sp, $sp, 16 jr $ra main: # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Allocating Main li $v0, 9 @@ -1402,34 +1557,58 @@ la $t0, type_Main # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object Main + sw $v0, 12($sp) # internal_0 = address of allocated object Main # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_Main jal function___init___at_Main lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_main_at_Main - jal function_main_at_Main + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + sw $v1, 16($sp) # internal_1 = result of internal_3 addi $sp, $sp, 8 # Freeing space for arguments # Exit program diff --git a/tests/codegen/io.mips b/tests/codegen/io.mips index 92427642c..c1d9b7cda 100644 --- a/tests/codegen/io.mips +++ b/tests/codegen/io.mips @@ -1,73 +1,139 @@ .data - type_Object: .word 8 + type_Object: .word 24 type_Object_inherits_from: .word 0 - type_Object_attributes: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_A: .word 32 + type_A_inherits_from: .word type_Object + type_A_name_address: .word type_A_name_size + type_A___init__: .word function___init___at_A + type_A_abort: .word function_abort_at_Object + type_A_type_name: .word function_type_name_at_Object + type_A_copy: .word function_copy_at_Object + type_A_out_a: .word function_out_a_at_A + + type_B: .word 36 + type_B_inherits_from: .word type_A + type_B_name_address: .word type_B_name_size + type_B___init__: .word function___init___at_B + type_B_abort: .word function_abort_at_Object + type_B_type_name: .word function_type_name_at_Object + type_B_copy: .word function_copy_at_Object + type_B_out_a: .word function_out_a_at_A + type_B_out_b: .word function_out_b_at_B + + type_C: .word 44 + type_C_inherits_from: .word type_IO + type_C_name_address: .word type_C_name_size + type_C___init__: .word function___init___at_C + type_C_abort: .word function_abort_at_Object + type_C_type_name: .word function_type_name_at_Object + type_C_copy: .word function_copy_at_Object + type_C_out_string: .word function_out_string_at_IO + type_C_out_int: .word function_out_int_at_IO + type_C_in_string: .word function_in_string_at_IO + type_C_in_int: .word function_in_int_at_IO + type_C_out_c: .word function_out_c_at_C + + type_D: .word 48 + type_D_inherits_from: .word type_C + type_D_name_address: .word type_D_name_size + type_D___init__: .word function___init___at_D + type_D_abort: .word function_abort_at_Object + type_D_type_name: .word function_type_name_at_Object + type_D_copy: .word function_copy_at_Object + type_D_out_string: .word function_out_string_at_IO + type_D_out_int: .word function_out_int_at_IO + type_D_in_string: .word function_in_string_at_IO + type_D_in_int: .word function_in_int_at_IO + type_D_out_c: .word function_out_c_at_C + type_D_out_d: .word function_out_d_at_D + + type_Main: .word 44 + type_Main_inherits_from: .word type_IO + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_out_string: .word function_out_string_at_IO + type_Main_out_int: .word function_out_int_at_IO + type_Main_in_string: .word function_in_string_at_IO + type_Main_in_int: .word function_in_int_at_IO + type_Main_main: .word function_main_at_Main + type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" - type_Object_abort_message: .asciiz "Abort called from class Object\n" - type_IO: .word 8 - type_IO_inherits_from: .word type_Object - type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" - type_IO_abort_message: .asciiz "Abort called from class IO\n" - - type_Int: .word 8 - type_Int_inherits_from: .word type_Object - type_Int_attributes: .word 0 - type_Int_name_size: .word 3 - type_Int_name: .asciiz "Int" - type_Int_abort_message: .asciiz "Abort called from class Int\n" - type_String: .word 8 - type_String_inherits_from: .word type_Object - type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" - type_String_abort_message: .asciiz "Abort called from class String\n" - type_Bool: .word 8 - type_Bool_inherits_from: .word type_Object - type_Bool_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" - type_Bool_abort_message: .asciiz "Abort called from class Bool\n" - type_A: .word 12 - type_A_inherits_from: .word type_Object - type_A_attributes: .word 1 type_A_name_size: .word 1 type_A_name: .asciiz "A" - type_A_abort_message: .asciiz "Abort called from class A\n" - type_B: .word 12 - type_B_inherits_from: .word type_A - type_B_attributes: .word 1 type_B_name_size: .word 1 type_B_name: .asciiz "B" - type_B_abort_message: .asciiz "Abort called from class B\n" - type_C: .word 8 - type_C_inherits_from: .word type_IO - type_C_attributes: .word 0 type_C_name_size: .word 1 type_C_name: .asciiz "C" - type_C_abort_message: .asciiz "Abort called from class C\n" - type_D: .word 8 - type_D_inherits_from: .word type_C - type_D_attributes: .word 0 type_D_name_size: .word 1 type_D_name: .asciiz "D" - type_D_abort_message: .asciiz "Abort called from class D\n" - type_Main: .word 8 - type_Main_inherits_from: .word type_IO - type_Main_attributes: .word 0 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" - type_Main_abort_message: .asciiz "Abort called from class Main\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -728,11 +794,11 @@ function_abort_at_Object: # Function parameters - # $ra = 20($sp) - # self = 16($sp) + # $ra = 28($sp) + # self = 24($sp) # Reserving space for local variables - addi $sp, $sp, -16 + addi $sp, $sp, -24 # Allocating String li $v0, 9 @@ -819,7 +885,7 @@ sb $zero, 32($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_0 = "Abort called from class " + sw $v0, 20($sp) # internal_0 = "Abort called from class " # Allocating String li $v0, 9 @@ -833,66 +899,138 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_2[0] = '\n' + sb $t0, 8($v0) # internal_3[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_2 = "\n" + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 0($sp) # Storing self - # Calling function function_type_name_at_Object - jal function_type_name_at_Object + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + sw $v1, 24($sp) # internal_1 = result of internal_5 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_0 - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing internal_0 # Argument internal_1 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_1 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_3 - lw $t0, 12($sp) - sw $t0, 4($sp) # Storing internal_3 - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) # $t0 = internal_3 + lw $t0, 12($sp) # $t0 = internal_2 addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string internal_3 + # Printing the String internal_2 li $v0, 4 move $a0, $t0 syscall @@ -902,10 +1040,10 @@ syscall # Loading return value in $v1 - lw $v1, 16($sp) + lw $v1, 24($sp) # Freeing space for local variables - addi $sp, $sp, 16 + addi $sp, $sp, 24 jr $ra @@ -920,8 +1058,9 @@ # internal_0 = name of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($t0) # $t1 = type of self - lw $t2, 12($t1) # $t1 = length of the name of self - la $t3, 16($t1) # $t1 = name of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 @@ -1024,7 +1163,7 @@ lw $t0, 0($sp) # $t0 = x addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string x + # Printing the String x li $v0, 4 move $a0, $t0 syscall @@ -1040,7 +1179,7 @@ # self = 4($sp) # x = 0($sp) - # Printing the string x + # Printing the Int x li $v0, 1 lw $a0, 0($sp) lw $a0, 8($a0) @@ -1067,11 +1206,13 @@ xor $t0, $t0, $t0 # Initializing counter while_read_start: lb $t1, buffer_input($t0) # Loading the byte - beq $t1, $zero, while_read_end + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end addi $t0, $t0, 1 # Incrementing counter j while_read_start while_read_end: - addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 @@ -1318,6 +1459,26 @@ jr $ra + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + function___init___at_A: # Function parameters # $ra = 8($sp) @@ -1352,17 +1513,17 @@ # Set attribute io of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8735122690286 + beq $t1, $zero, object_set_attribute_8786052814141 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8735122690286 + beq $t6, $t5, int_set_attribute_8786052814141 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8735122690286 - j object_set_attribute_8735122690286 - int_set_attribute_8735122690286: + beq $t6, $t5, bool_set_attribute_8786052814141 + j object_set_attribute_8786052814141 + int_set_attribute_8786052814141: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1371,8 +1532,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.io = internal_0 - j end_set_attribute_8735122690286 - bool_set_attribute_8735122690286: + j end_set_attribute_8786052814141 + bool_set_attribute_8786052814141: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1381,10 +1542,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.io = internal_0 - j end_set_attribute_8735122690286 - object_set_attribute_8735122690286: + j end_set_attribute_8786052814141 + object_set_attribute_8786052814141: sw $t1, 8($t0) # self.io = internal_0 - end_set_attribute_8735122690286: + end_set_attribute_8786052814141: # Loading return value in $v1 lw $v1, 4($sp) @@ -1396,25 +1557,25 @@ function_out_a_at_A: # Function parameters - # $ra = 16($sp) - # self = 12($sp) + # $ra = 24($sp) + # self = 20($sp) # Reserving space for local variables - addi $sp, $sp, -12 + addi $sp, $sp, -20 # Get attribute io of self - lw $t0, 12($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'io' from the instance + lw $t0, 20($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'io' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8735122690850 + beq $t6, $t5, int_get_attribute_8786052814189 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8735122690850 - j object_get_attribute_8735122690850 - int_get_attribute_8735122690850: + beq $t6, $t5, bool_get_attribute_8786052814189 + j object_get_attribute_8786052814189 + int_get_attribute_8786052814189: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1422,9 +1583,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($sp) # internal_0 = self.io - j end_get_attribute_8735122690850 - bool_get_attribute_8735122690850: + sw $v0, 16($sp) # internal_0 = self.io + j end_get_attribute_8786052814189 + bool_get_attribute_8786052814189: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1432,11 +1593,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($sp) # internal_0 = self.io - j end_get_attribute_8735122690850 - object_get_attribute_8735122690850: - sw $t1, 8($sp) # internal_0 = io - end_get_attribute_8735122690850: + sw $v0, 16($sp) # internal_0 = self.io + j end_get_attribute_8786052814189 + object_get_attribute_8786052814189: + sw $t1, 16($sp) # internal_0 = self.io + end_get_attribute_8786052814189: # Allocating String li $v0, 9 @@ -1496,31 +1657,55 @@ sb $zero, 23($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_1 = "A: Hello world\n" + sw $v0, 12($sp) # internal_1 = "A: Hello world\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_3 = address of allocated object Int + + # Get method out_string of IO + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_0 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 4($sp) # Storing internal_0 # Argument internal_1 - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 0($sp) # Storing internal_1 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_4 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_2 = result of function_out_string_at_IO + sw $v1, 20($sp) # internal_2 = result of internal_4 addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 12 + addi $sp, $sp, 20 jr $ra @@ -1558,17 +1743,17 @@ # Set attribute io of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8735122690925 + beq $t1, $zero, object_set_attribute_8786052814288 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8735122690925 + beq $t6, $t5, int_set_attribute_8786052814288 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8735122690925 - j object_set_attribute_8735122690925 - int_set_attribute_8735122690925: + beq $t6, $t5, bool_set_attribute_8786052814288 + j object_set_attribute_8786052814288 + int_set_attribute_8786052814288: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1577,8 +1762,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.io = internal_0 - j end_set_attribute_8735122690925 - bool_set_attribute_8735122690925: + j end_set_attribute_8786052814288 + bool_set_attribute_8786052814288: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1587,10 +1772,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.io = internal_0 - j end_set_attribute_8735122690925 - object_set_attribute_8735122690925: + j end_set_attribute_8786052814288 + object_set_attribute_8786052814288: sw $t1, 8($t0) # self.io = internal_0 - end_set_attribute_8735122690925: + end_set_attribute_8786052814288: # Loading return value in $v1 lw $v1, 4($sp) @@ -1602,25 +1787,25 @@ function_out_b_at_B: # Function parameters - # $ra = 16($sp) - # self = 12($sp) + # $ra = 24($sp) + # self = 20($sp) # Reserving space for local variables - addi $sp, $sp, -12 + addi $sp, $sp, -20 # Get attribute io of self - lw $t0, 12($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'io' from the instance + lw $t0, 20($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'io' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8735122690973 + beq $t6, $t5, int_get_attribute_8786052815364 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8735122690973 - j object_get_attribute_8735122690973 - int_get_attribute_8735122690973: + beq $t6, $t5, bool_get_attribute_8786052815364 + j object_get_attribute_8786052815364 + int_get_attribute_8786052815364: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1628,9 +1813,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($sp) # internal_0 = self.io - j end_get_attribute_8735122690973 - bool_get_attribute_8735122690973: + sw $v0, 16($sp) # internal_0 = self.io + j end_get_attribute_8786052815364 + bool_get_attribute_8786052815364: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1638,11 +1823,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($sp) # internal_0 = self.io - j end_get_attribute_8735122690973 - object_get_attribute_8735122690973: - sw $t1, 8($sp) # internal_0 = io - end_get_attribute_8735122690973: + sw $v0, 16($sp) # internal_0 = self.io + j end_get_attribute_8786052815364 + object_get_attribute_8786052815364: + sw $t1, 16($sp) # internal_0 = self.io + end_get_attribute_8786052815364: # Allocating String li $v0, 9 @@ -1702,31 +1887,55 @@ sb $zero, 23($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_1 = "B: Hello world\n" + sw $v0, 12($sp) # internal_1 = "B: Hello world\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_3 = address of allocated object Int + + # Get method out_string of IO + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_0 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 4($sp) # Storing internal_0 # Argument internal_1 - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 0($sp) # Storing internal_1 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_4 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_2 = result of function_out_string_at_IO + sw $v1, 20($sp) # internal_2 = result of internal_4 addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 12 + addi $sp, $sp, 20 jr $ra @@ -1742,11 +1951,11 @@ function_out_c_at_C: # Function parameters - # $ra = 12($sp) - # self = 8($sp) + # $ra = 20($sp) + # self = 16($sp) # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Allocating String li $v0, 9 @@ -1806,31 +2015,55 @@ sb $zero, 23($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_0 = "C: Hello world\n" + sw $v0, 12($sp) # internal_0 = "C: Hello world\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method out_string of C + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 4($sp) # Storing self # Argument internal_0 - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_3 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_1 = result of function_out_string_at_IO + sw $v1, 20($sp) # internal_1 = result of internal_3 addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 8 + addi $sp, $sp, 16 jr $ra @@ -1846,11 +2079,11 @@ function_out_d_at_D: # Function parameters - # $ra = 12($sp) - # self = 8($sp) + # $ra = 20($sp) + # self = 16($sp) # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Allocating String li $v0, 9 @@ -1910,31 +2143,55 @@ sb $zero, 23($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_0 = "D: Hello world\n" + sw $v0, 12($sp) # internal_0 = "D: Hello world\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method out_string of D + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 4($sp) # Storing self # Argument internal_0 - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_3 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_1 = result of function_out_string_at_IO + sw $v1, 20($sp) # internal_1 = result of internal_3 addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 8 + addi $sp, $sp, 16 jr $ra @@ -1950,11 +2207,11 @@ function_main_at_Main: # Function parameters - # $ra = 44($sp) - # self = 40($sp) + # $ra = 84($sp) + # self = 80($sp) # Reserving space for local variables - addi $sp, $sp, -40 + addi $sp, $sp, -80 # Allocating A li $v0, 9 @@ -1963,34 +2220,58 @@ la $t0, type_A # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 36($sp) # internal_0 = address of allocated object A + sw $v0, 76($sp) # internal_0 = address of allocated object A # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 44($sp) + lw $t0, 84($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_A jal function___init___at_A lw $ra, 4($sp) - sw $v1, 44($sp) # internal_0 = result of function___init___at_A + sw $v1, 84($sp) # internal_0 = result of function___init___at_A addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_2 = address of allocated object Int + + # Get method out_a of A + lw $t0, 76($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 68($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 64($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 44($sp) + lw $t0, 84($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_out_a_at_A - jal function_out_a_at_A + # Calling function internal_3 + lw $t0, 72($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 40($sp) # internal_1 = result of function_out_a_at_A + sw $v1, 80($sp) # internal_1 = result of internal_3 addi $sp, $sp, 8 # Freeing space for arguments # Allocating B @@ -2000,34 +2281,58 @@ la $t0, type_B # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 28($sp) # internal_2 = address of allocated object B + sw $v0, 60($sp) # internal_4 = address of allocated object B # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_2 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_2 + # Argument internal_4 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_4 # Calling function function___init___at_B jal function___init___at_B lw $ra, 4($sp) - sw $v1, 36($sp) # internal_2 = result of function___init___at_B + sw $v1, 68($sp) # internal_4 = result of function___init___at_B addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_6 = address of allocated object Int + + # Get method out_b of B + lw $t0, 60($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 52($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 48($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_2 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_2 + # Argument internal_4 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_4 - # Calling function function_out_b_at_B - jal function_out_b_at_B + # Calling function internal_7 + lw $t0, 56($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 32($sp) # internal_3 = result of function_out_b_at_B + sw $v1, 64($sp) # internal_5 = result of internal_7 addi $sp, $sp, 8 # Freeing space for arguments # Allocating C @@ -2037,34 +2342,58 @@ la $t0, type_C # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 20($sp) # internal_4 = address of allocated object C + sw $v0, 44($sp) # internal_8 = address of allocated object C # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_4 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_4 + # Argument internal_8 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_8 # Calling function function___init___at_C jal function___init___at_C lw $ra, 4($sp) - sw $v1, 28($sp) # internal_4 = result of function___init___at_C + sw $v1, 52($sp) # internal_8 = result of function___init___at_C addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_10 = address of allocated object Int + + # Get method out_c of C + lw $t0, 44($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 36($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 32($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_4 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_4 + # Argument internal_8 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_8 - # Calling function function_out_c_at_C - jal function_out_c_at_C + # Calling function internal_11 + lw $t0, 40($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 24($sp) # internal_5 = result of function_out_c_at_C + sw $v1, 48($sp) # internal_9 = result of internal_11 addi $sp, $sp, 8 # Freeing space for arguments # Allocating D @@ -2074,34 +2403,58 @@ la $t0, type_D # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 12($sp) # internal_6 = address of allocated object D + sw $v0, 28($sp) # internal_12 = address of allocated object D # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_6 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_6 + # Argument internal_12 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_12 # Calling function function___init___at_D jal function___init___at_D lw $ra, 4($sp) - sw $v1, 20($sp) # internal_6 = result of function___init___at_D + sw $v1, 36($sp) # internal_12 = result of function___init___at_D addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_14 = address of allocated object Int + + # Get method out_d of D + lw $t0, 28($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_6 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_6 + # Argument internal_12 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_12 - # Calling function function_out_d_at_D - jal function_out_d_at_D + # Calling function internal_15 + lw $t0, 24($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 16($sp) # internal_7 = result of function_out_d_at_D + sw $v1, 32($sp) # internal_13 = result of internal_15 addi $sp, $sp, 8 # Freeing space for arguments # Allocating String @@ -2116,56 +2469,80 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 68 - sb $t0, 8($v0) # internal_8[0] = 'D' + sb $t0, 8($v0) # internal_16[0] = 'D' addi $t0, $zero, 111 - sb $t0, 9($v0) # internal_8[1] = 'o' + sb $t0, 9($v0) # internal_16[1] = 'o' addi $t0, $zero, 110 - sb $t0, 10($v0) # internal_8[2] = 'n' + sb $t0, 10($v0) # internal_16[2] = 'n' addi $t0, $zero, 101 - sb $t0, 11($v0) # internal_8[3] = 'e' + sb $t0, 11($v0) # internal_16[3] = 'e' addi $t0, $zero, 46 - sb $t0, 12($v0) # internal_8[4] = '.' + sb $t0, 12($v0) # internal_16[4] = '.' addi $t0, $zero, 10 - sb $t0, 13($v0) # internal_8[5] = '\n' + sb $t0, 13($v0) # internal_16[5] = '\n' sb $zero, 14($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_8 = "Done.\n" + sw $v0, 12($sp) # internal_16 = "Done.\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_18 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 80($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 52($sp) + lw $t0, 92($sp) sw $t0, 4($sp) # Storing self - # Argument internal_8 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_8 + # Argument internal_16 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_16 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_19 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_9 = result of function_out_string_at_IO + sw $v1, 20($sp) # internal_17 = result of internal_19 addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 40 + addi $sp, $sp, 80 jr $ra main: # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Allocating Main li $v0, 9 @@ -2174,34 +2551,58 @@ la $t0, type_Main # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object Main + sw $v0, 12($sp) # internal_0 = address of allocated object Main # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_Main jal function___init___at_Main lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_main_at_Main - jal function_main_at_Main + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + sw $v1, 16($sp) # internal_1 = result of internal_3 addi $sp, $sp, 8 # Freeing space for arguments # Exit program diff --git a/tests/codegen/life.mips b/tests/codegen/life.mips index a63beffb4..8aa7a5ce6 100644 --- a/tests/codegen/life.mips +++ b/tests/codegen/life.mips @@ -1,59 +1,153 @@ .data - type_Object: .word 8 + type_Object: .word 24 type_Object_inherits_from: .word 0 - type_Object_attributes: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_Board: .word 60 + type_Board_inherits_from: .word type_IO + type_Board_name_address: .word type_Board_name_size + type_Board___init__: .word function___init___at_Board + type_Board_abort: .word function_abort_at_Object + type_Board_type_name: .word function_type_name_at_Object + type_Board_copy: .word function_copy_at_Object + type_Board_out_string: .word function_out_string_at_IO + type_Board_out_int: .word function_out_int_at_IO + type_Board_in_string: .word function_in_string_at_IO + type_Board_in_int: .word function_in_int_at_IO + type_Board_size_of_board: .word function_size_of_board_at_Board + type_Board_board_init: .word function_board_init_at_Board + + type_CellularAutomaton: .word 136 + type_CellularAutomaton_inherits_from: .word type_Board + type_CellularAutomaton_name_address: .word type_CellularAutomaton_name_size + type_CellularAutomaton___init__: .word function___init___at_CellularAutomaton + type_CellularAutomaton_abort: .word function_abort_at_Object + type_CellularAutomaton_type_name: .word function_type_name_at_Object + type_CellularAutomaton_copy: .word function_copy_at_Object + type_CellularAutomaton_out_string: .word function_out_string_at_IO + type_CellularAutomaton_out_int: .word function_out_int_at_IO + type_CellularAutomaton_in_string: .word function_in_string_at_IO + type_CellularAutomaton_in_int: .word function_in_int_at_IO + type_CellularAutomaton_size_of_board: .word function_size_of_board_at_Board + type_CellularAutomaton_board_init: .word function_board_init_at_Board + type_CellularAutomaton_init: .word function_init_at_CellularAutomaton + type_CellularAutomaton_print: .word function_print_at_CellularAutomaton + type_CellularAutomaton_num_cells: .word function_num_cells_at_CellularAutomaton + type_CellularAutomaton_cell: .word function_cell_at_CellularAutomaton + type_CellularAutomaton_north: .word function_north_at_CellularAutomaton + type_CellularAutomaton_south: .word function_south_at_CellularAutomaton + type_CellularAutomaton_east: .word function_east_at_CellularAutomaton + type_CellularAutomaton_west: .word function_west_at_CellularAutomaton + type_CellularAutomaton_northwest: .word function_northwest_at_CellularAutomaton + type_CellularAutomaton_northeast: .word function_northeast_at_CellularAutomaton + type_CellularAutomaton_southeast: .word function_southeast_at_CellularAutomaton + type_CellularAutomaton_southwest: .word function_southwest_at_CellularAutomaton + type_CellularAutomaton_neighbors: .word function_neighbors_at_CellularAutomaton + type_CellularAutomaton_cell_at_next_evolution: .word function_cell_at_next_evolution_at_CellularAutomaton + type_CellularAutomaton_evolve: .word function_evolve_at_CellularAutomaton + type_CellularAutomaton_option: .word function_option_at_CellularAutomaton + type_CellularAutomaton_prompt: .word function_prompt_at_CellularAutomaton + type_CellularAutomaton_prompt2: .word function_prompt2_at_CellularAutomaton + + type_Main: .word 144 + type_Main_inherits_from: .word type_CellularAutomaton + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_out_string: .word function_out_string_at_IO + type_Main_out_int: .word function_out_int_at_IO + type_Main_in_string: .word function_in_string_at_IO + type_Main_in_int: .word function_in_int_at_IO + type_Main_size_of_board: .word function_size_of_board_at_Board + type_Main_board_init: .word function_board_init_at_Board + type_Main_init: .word function_init_at_CellularAutomaton + type_Main_print: .word function_print_at_CellularAutomaton + type_Main_num_cells: .word function_num_cells_at_CellularAutomaton + type_Main_cell: .word function_cell_at_CellularAutomaton + type_Main_north: .word function_north_at_CellularAutomaton + type_Main_south: .word function_south_at_CellularAutomaton + type_Main_east: .word function_east_at_CellularAutomaton + type_Main_west: .word function_west_at_CellularAutomaton + type_Main_northwest: .word function_northwest_at_CellularAutomaton + type_Main_northeast: .word function_northeast_at_CellularAutomaton + type_Main_southeast: .word function_southeast_at_CellularAutomaton + type_Main_southwest: .word function_southwest_at_CellularAutomaton + type_Main_neighbors: .word function_neighbors_at_CellularAutomaton + type_Main_cell_at_next_evolution: .word function_cell_at_next_evolution_at_CellularAutomaton + type_Main_evolve: .word function_evolve_at_CellularAutomaton + type_Main_option: .word function_option_at_CellularAutomaton + type_Main_prompt: .word function_prompt_at_CellularAutomaton + type_Main_prompt2: .word function_prompt2_at_CellularAutomaton + type_Main_main: .word function_main_at_Main + type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" - type_Object_abort_message: .asciiz "Abort called from class Object\n" - type_IO: .word 8 - type_IO_inherits_from: .word type_Object - type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" - type_IO_abort_message: .asciiz "Abort called from class IO\n" - type_Int: .word 8 - type_Int_inherits_from: .word type_Object - type_Int_attributes: .word 0 - type_Int_name_size: .word 3 - type_Int_name: .asciiz "Int" - type_Int_abort_message: .asciiz "Abort called from class Int\n" - - type_String: .word 8 - type_String_inherits_from: .word type_Object - type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" - type_String_abort_message: .asciiz "Abort called from class String\n" - type_Bool: .word 8 - type_Bool_inherits_from: .word type_Object - type_Bool_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" - type_Bool_abort_message: .asciiz "Abort called from class Bool\n" - type_Board: .word 20 - type_Board_inherits_from: .word type_IO - type_Board_attributes: .word 3 type_Board_name_size: .word 5 type_Board_name: .asciiz "Board" - type_Board_abort_message: .asciiz "Abort called from class Board\n" - type_CellularAutomaton: .word 24 - type_CellularAutomaton_inherits_from: .word type_Board - type_CellularAutomaton_attributes: .word 4 type_CellularAutomaton_name_size: .word 17 type_CellularAutomaton_name: .asciiz "CellularAutomaton" - type_CellularAutomaton_abort_message: .asciiz "Abort called from class CellularAutomaton\n" - type_Main: .word 28 - type_Main_inherits_from: .word type_CellularAutomaton - type_Main_attributes: .word 5 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" - type_Main_abort_message: .asciiz "Abort called from class Main\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -714,11 +808,11 @@ function_abort_at_Object: # Function parameters - # $ra = 20($sp) - # self = 16($sp) + # $ra = 28($sp) + # self = 24($sp) # Reserving space for local variables - addi $sp, $sp, -16 + addi $sp, $sp, -24 # Allocating String li $v0, 9 @@ -805,7 +899,7 @@ sb $zero, 32($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_0 = "Abort called from class " + sw $v0, 20($sp) # internal_0 = "Abort called from class " # Allocating String li $v0, 9 @@ -819,66 +913,138 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_2[0] = '\n' + sb $t0, 8($v0) # internal_3[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_2 = "\n" + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 0($sp) # Storing self - # Calling function function_type_name_at_Object - jal function_type_name_at_Object + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + sw $v1, 24($sp) # internal_1 = result of internal_5 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_0 - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing internal_0 # Argument internal_1 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_1 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_3 - lw $t0, 12($sp) - sw $t0, 4($sp) # Storing internal_3 - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) # $t0 = internal_3 + lw $t0, 12($sp) # $t0 = internal_2 addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string internal_3 + # Printing the String internal_2 li $v0, 4 move $a0, $t0 syscall @@ -888,10 +1054,10 @@ syscall # Loading return value in $v1 - lw $v1, 16($sp) + lw $v1, 24($sp) # Freeing space for local variables - addi $sp, $sp, 16 + addi $sp, $sp, 24 jr $ra @@ -906,8 +1072,9 @@ # internal_0 = name of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($t0) # $t1 = type of self - lw $t2, 12($t1) # $t1 = length of the name of self - la $t3, 16($t1) # $t1 = name of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 @@ -1010,7 +1177,7 @@ lw $t0, 0($sp) # $t0 = x addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string x + # Printing the String x li $v0, 4 move $a0, $t0 syscall @@ -1026,7 +1193,7 @@ # self = 4($sp) # x = 0($sp) - # Printing the string x + # Printing the Int x li $v0, 1 lw $a0, 0($sp) lw $a0, 8($a0) @@ -1053,11 +1220,13 @@ xor $t0, $t0, $t0 # Initializing counter while_read_start: lb $t1, buffer_input($t0) # Loading the byte - beq $t1, $zero, while_read_end + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end addi $t0, $t0, 1 # Incrementing counter j while_read_start while_read_end: - addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 @@ -1304,6 +1473,26 @@ jr $ra + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + function___init___at_Board: # Function parameters # $ra = 16($sp) @@ -1327,17 +1516,17 @@ # Set attribute rows of self lw $t0, 12($sp) # $t0 = self lw $t1, 8($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8768338369229 + beq $t1, $zero, object_set_attribute_8737379815328 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338369229 + beq $t6, $t5, int_set_attribute_8737379815328 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338369229 - j object_set_attribute_8768338369229 - int_set_attribute_8768338369229: + beq $t6, $t5, bool_set_attribute_8737379815328 + j object_set_attribute_8737379815328 + int_set_attribute_8737379815328: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1346,8 +1535,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.rows = internal_0 - j end_set_attribute_8768338369229 - bool_set_attribute_8768338369229: + j end_set_attribute_8737379815328 + bool_set_attribute_8737379815328: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1356,10 +1545,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.rows = internal_0 - j end_set_attribute_8768338369229 - object_set_attribute_8768338369229: + j end_set_attribute_8737379815328 + object_set_attribute_8737379815328: sw $t1, 8($t0) # self.rows = internal_0 - end_set_attribute_8768338369229: + end_set_attribute_8737379815328: # Allocating Int 0 li $v0, 9 @@ -1376,17 +1565,17 @@ # Set attribute columns of self lw $t0, 12($sp) # $t0 = self lw $t1, 4($sp) # $t1 = internal_1 - beq $t1, $zero, object_set_attribute_8768338369250 + beq $t1, $zero, object_set_attribute_8737379815349 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338369250 + beq $t6, $t5, int_set_attribute_8737379815349 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338369250 - j object_set_attribute_8768338369250 - int_set_attribute_8768338369250: + beq $t6, $t5, bool_set_attribute_8737379815349 + j object_set_attribute_8737379815349 + int_set_attribute_8737379815349: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1395,8 +1584,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.columns = internal_1 - j end_set_attribute_8768338369250 - bool_set_attribute_8768338369250: + j end_set_attribute_8737379815349 + bool_set_attribute_8737379815349: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1405,10 +1594,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.columns = internal_1 - j end_set_attribute_8768338369250 - object_set_attribute_8768338369250: + j end_set_attribute_8737379815349 + object_set_attribute_8737379815349: sw $t1, 12($t0) # self.columns = internal_1 - end_set_attribute_8768338369250: + end_set_attribute_8737379815349: # Allocating Int 0 li $v0, 9 @@ -1425,17 +1614,17 @@ # Set attribute board_size of self lw $t0, 12($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_2 - beq $t1, $zero, object_set_attribute_8768338369271 + beq $t1, $zero, object_set_attribute_8737379815370 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338369271 + beq $t6, $t5, int_set_attribute_8737379815370 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338369271 - j object_set_attribute_8768338369271 - int_set_attribute_8768338369271: + beq $t6, $t5, bool_set_attribute_8737379815370 + j object_set_attribute_8737379815370 + int_set_attribute_8737379815370: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1444,8 +1633,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.board_size = internal_2 - j end_set_attribute_8768338369271 - bool_set_attribute_8768338369271: + j end_set_attribute_8737379815370 + bool_set_attribute_8737379815370: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1454,10 +1643,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.board_size = internal_2 - j end_set_attribute_8768338369271 - object_set_attribute_8768338369271: + j end_set_attribute_8737379815370 + object_set_attribute_8737379815370: sw $t1, 16($t0) # self.board_size = internal_2 - end_set_attribute_8768338369271: + end_set_attribute_8737379815370: # Loading return value in $v1 lw $v1, 12($sp) @@ -1469,60 +1658,108 @@ function_size_of_board_at_Board: # Function parameters - # $ra = 12($sp) - # self = 8($sp) - # initial = 4($sp) + # $ra = 20($sp) + # self = 16($sp) + # initial = 12($sp) # Reserving space for local variables - addi $sp, $sp, -4 + addi $sp, $sp, -12 + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + # Get method length of String + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument initial - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing initial - # Calling function function_length_at_String - jal function_length_at_String + # Calling function internal_2 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_0 = result of function_length_at_String + sw $v1, 16($sp) # internal_0 = result of internal_2 addi $sp, $sp, 8 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 4 + addi $sp, $sp, 12 jr $ra function_board_init_at_Board: # Function parameters - # $ra = 168($sp) - # self = 164($sp) - # start = 160($sp) + # $ra = 176($sp) + # self = 172($sp) + # start = 168($sp) # Reserving space for local variables - addi $sp, $sp, -160 + addi $sp, $sp, -168 + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 156($sp) # internal_2 = address of allocated object Int + + # Get method size_of_board of Board + lw $t0, 172($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 156($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 152($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 176($sp) + lw $t0, 184($sp) sw $t0, 4($sp) # Storing self # Argument start - lw $t0, 172($sp) + lw $t0, 180($sp) sw $t0, 0($sp) # Storing start - # Calling function function_size_of_board_at_Board - jal function_size_of_board_at_Board + # Calling function internal_3 + lw $t0, 164($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 164($sp) # internal_1 = result of function_size_of_board_at_Board + sw $v1, 172($sp) # internal_1 = result of internal_3 addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -1530,17 +1767,17 @@ sw $ra, 8($sp) # Storing return address # Argument size - lw $t0, 168($sp) + lw $t0, 176($sp) sw $t0, 4($sp) # Storing size # Argument internal_1 - lw $t0, 164($sp) + lw $t0, 172($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 168($sp) # size = result of function_assign + sw $v1, 176($sp) # size = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bool 0 @@ -1553,7 +1790,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 144($sp) # internal_3 = address of allocated object Int + sw $v0, 144($sp) # internal_5 = address of allocated object Int # Allocating Int 15 li $v0, 9 @@ -1565,40 +1802,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 15 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 140($sp) # internal_4 = address of allocated object Int + sw $v0, 140($sp) # internal_6 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument size - lw $t0, 168($sp) + lw $t0, 176($sp) sw $t0, 4($sp) # Storing size - # Argument internal_4 + # Argument internal_6 lw $t0, 152($sp) - sw $t0, 0($sp) # Storing internal_4 + sw $t0, 0($sp) # Storing internal_6 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 148($sp) # internal_5 = result of function_equal + sw $v1, 148($sp) # internal_7 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_3 = internal_5 + # internal_5 = internal_7 lw $t0, 136($sp) sw $t0, 144($sp) - # If internal_3 then goto then_8768338404482 + # If internal_5 then goto then_8737379850719 lw $t0, 144($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338404482 + beq $t0, $t1, then_8737379850719 - # Jumping to else_8768338404482 - j else_8768338404482 + # Jumping to else_8737379850719 + j else_8737379850719 - then_8768338404482: + then_8737379850719: # Allocating Int 3 li $v0, 9 @@ -1610,22 +1847,22 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 132($sp) # internal_6 = address of allocated object Int + sw $v0, 132($sp) # internal_8 = address of allocated object Int # Set attribute rows of self - lw $t0, 164($sp) # $t0 = self - lw $t1, 132($sp) # $t1 = internal_6 - beq $t1, $zero, object_set_attribute_8768338370320 + lw $t0, 172($sp) # $t0 = self + lw $t1, 132($sp) # $t1 = internal_8 + beq $t1, $zero, object_set_attribute_8737379817747 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338370320 + beq $t6, $t5, int_set_attribute_8737379817747 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338370320 - j object_set_attribute_8768338370320 - int_set_attribute_8768338370320: + beq $t6, $t5, bool_set_attribute_8737379817747 + j object_set_attribute_8737379817747 + int_set_attribute_8737379817747: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1633,9 +1870,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($t0) # self.rows = internal_6 - j end_set_attribute_8768338370320 - bool_set_attribute_8768338370320: + sw $v0, 8($t0) # self.rows = internal_8 + j end_set_attribute_8737379817747 + bool_set_attribute_8737379817747: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1643,11 +1880,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($t0) # self.rows = internal_6 - j end_set_attribute_8768338370320 - object_set_attribute_8768338370320: - sw $t1, 8($t0) # self.rows = internal_6 - end_set_attribute_8768338370320: + sw $v0, 8($t0) # self.rows = internal_8 + j end_set_attribute_8737379817747 + object_set_attribute_8737379817747: + sw $t1, 8($t0) # self.rows = internal_8 + end_set_attribute_8737379817747: # Allocating Int 5 li $v0, 9 @@ -1659,22 +1896,22 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 5 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 128($sp) # internal_7 = address of allocated object Int + sw $v0, 128($sp) # internal_9 = address of allocated object Int # Set attribute columns of self - lw $t0, 164($sp) # $t0 = self - lw $t1, 128($sp) # $t1 = internal_7 - beq $t1, $zero, object_set_attribute_8768338370341 + lw $t0, 172($sp) # $t0 = self + lw $t1, 128($sp) # $t1 = internal_9 + beq $t1, $zero, object_set_attribute_8737379817768 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338370341 + beq $t6, $t5, int_set_attribute_8737379817768 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338370341 - j object_set_attribute_8768338370341 - int_set_attribute_8768338370341: + beq $t6, $t5, bool_set_attribute_8737379817768 + j object_set_attribute_8737379817768 + int_set_attribute_8737379817768: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1682,9 +1919,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.columns = internal_7 - j end_set_attribute_8768338370341 - bool_set_attribute_8768338370341: + sw $v0, 12($t0) # self.columns = internal_9 + j end_set_attribute_8737379817768 + bool_set_attribute_8737379817768: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1692,26 +1929,26 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.columns = internal_7 - j end_set_attribute_8768338370341 - object_set_attribute_8768338370341: - sw $t1, 12($t0) # self.columns = internal_7 - end_set_attribute_8768338370341: + sw $v0, 12($t0) # self.columns = internal_9 + j end_set_attribute_8737379817768 + object_set_attribute_8737379817768: + sw $t1, 12($t0) # self.columns = internal_9 + end_set_attribute_8737379817768: # Set attribute board_size of self - lw $t0, 164($sp) # $t0 = self - lw $t1, 156($sp) # $t1 = size - beq $t1, $zero, object_set_attribute_8768338370362 + lw $t0, 172($sp) # $t0 = self + lw $t1, 164($sp) # $t1 = size + beq $t1, $zero, object_set_attribute_8737379817789 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338370362 + beq $t6, $t5, int_set_attribute_8737379817789 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338370362 - j object_set_attribute_8768338370362 - int_set_attribute_8768338370362: + beq $t6, $t5, bool_set_attribute_8737379817789 + j object_set_attribute_8737379817789 + int_set_attribute_8737379817789: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1720,8 +1957,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.board_size = size - j end_set_attribute_8768338370362 - bool_set_attribute_8768338370362: + j end_set_attribute_8737379817789 + bool_set_attribute_8737379817789: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1730,19 +1967,19 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.board_size = size - j end_set_attribute_8768338370362 - object_set_attribute_8768338370362: + j end_set_attribute_8737379817789 + object_set_attribute_8737379817789: sw $t1, 16($t0) # self.board_size = size - end_set_attribute_8768338370362: + end_set_attribute_8737379817789: - # internal_2 = size - lw $t0, 156($sp) + # internal_4 = size + lw $t0, 164($sp) sw $t0, 148($sp) - # Jumping to endif_8768338404482 - j endif_8768338404482 + # Jumping to endif_8737379850719 + j endif_8737379850719 - else_8768338404482: + else_8737379850719: # Allocating Bool 0 li $v0, 9 @@ -1754,7 +1991,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 120($sp) # internal_9 = address of allocated object Int + sw $v0, 120($sp) # internal_11 = address of allocated object Int # Allocating Int 16 li $v0, 9 @@ -1766,40 +2003,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 16 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 116($sp) # internal_10 = address of allocated object Int + sw $v0, 116($sp) # internal_12 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument size - lw $t0, 168($sp) + lw $t0, 176($sp) sw $t0, 4($sp) # Storing size - # Argument internal_10 + # Argument internal_12 lw $t0, 128($sp) - sw $t0, 0($sp) # Storing internal_10 + sw $t0, 0($sp) # Storing internal_12 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 124($sp) # internal_11 = result of function_equal + sw $v1, 124($sp) # internal_13 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_9 = internal_11 + # internal_11 = internal_13 lw $t0, 112($sp) sw $t0, 120($sp) - # If internal_9 then goto then_8768338404476 + # If internal_11 then goto then_8737379850713 lw $t0, 120($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338404476 + beq $t0, $t1, then_8737379850713 - # Jumping to else_8768338404476 - j else_8768338404476 + # Jumping to else_8737379850713 + j else_8737379850713 - then_8768338404476: + then_8737379850713: # Allocating Int 4 li $v0, 9 @@ -1811,22 +2048,22 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 108($sp) # internal_12 = address of allocated object Int + sw $v0, 108($sp) # internal_14 = address of allocated object Int # Set attribute rows of self - lw $t0, 164($sp) # $t0 = self - lw $t1, 108($sp) # $t1 = internal_12 - beq $t1, $zero, object_set_attribute_8768338370494 + lw $t0, 172($sp) # $t0 = self + lw $t1, 108($sp) # $t1 = internal_14 + beq $t1, $zero, object_set_attribute_8737379817921 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338370494 + beq $t6, $t5, int_set_attribute_8737379817921 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338370494 - j object_set_attribute_8768338370494 - int_set_attribute_8768338370494: + beq $t6, $t5, bool_set_attribute_8737379817921 + j object_set_attribute_8737379817921 + int_set_attribute_8737379817921: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1834,9 +2071,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($t0) # self.rows = internal_12 - j end_set_attribute_8768338370494 - bool_set_attribute_8768338370494: + sw $v0, 8($t0) # self.rows = internal_14 + j end_set_attribute_8737379817921 + bool_set_attribute_8737379817921: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1844,11 +2081,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($t0) # self.rows = internal_12 - j end_set_attribute_8768338370494 - object_set_attribute_8768338370494: - sw $t1, 8($t0) # self.rows = internal_12 - end_set_attribute_8768338370494: + sw $v0, 8($t0) # self.rows = internal_14 + j end_set_attribute_8737379817921 + object_set_attribute_8737379817921: + sw $t1, 8($t0) # self.rows = internal_14 + end_set_attribute_8737379817921: # Allocating Int 4 li $v0, 9 @@ -1860,22 +2097,22 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 104($sp) # internal_13 = address of allocated object Int + sw $v0, 104($sp) # internal_15 = address of allocated object Int # Set attribute columns of self - lw $t0, 164($sp) # $t0 = self - lw $t1, 104($sp) # $t1 = internal_13 - beq $t1, $zero, object_set_attribute_8768338370515 + lw $t0, 172($sp) # $t0 = self + lw $t1, 104($sp) # $t1 = internal_15 + beq $t1, $zero, object_set_attribute_8737379817942 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338370515 + beq $t6, $t5, int_set_attribute_8737379817942 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338370515 - j object_set_attribute_8768338370515 - int_set_attribute_8768338370515: + beq $t6, $t5, bool_set_attribute_8737379817942 + j object_set_attribute_8737379817942 + int_set_attribute_8737379817942: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1883,9 +2120,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.columns = internal_13 - j end_set_attribute_8768338370515 - bool_set_attribute_8768338370515: + sw $v0, 12($t0) # self.columns = internal_15 + j end_set_attribute_8737379817942 + bool_set_attribute_8737379817942: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1893,26 +2130,26 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.columns = internal_13 - j end_set_attribute_8768338370515 - object_set_attribute_8768338370515: - sw $t1, 12($t0) # self.columns = internal_13 - end_set_attribute_8768338370515: + sw $v0, 12($t0) # self.columns = internal_15 + j end_set_attribute_8737379817942 + object_set_attribute_8737379817942: + sw $t1, 12($t0) # self.columns = internal_15 + end_set_attribute_8737379817942: # Set attribute board_size of self - lw $t0, 164($sp) # $t0 = self - lw $t1, 156($sp) # $t1 = size - beq $t1, $zero, object_set_attribute_8768338370536 + lw $t0, 172($sp) # $t0 = self + lw $t1, 164($sp) # $t1 = size + beq $t1, $zero, object_set_attribute_8737379817963 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338370536 + beq $t6, $t5, int_set_attribute_8737379817963 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338370536 - j object_set_attribute_8768338370536 - int_set_attribute_8768338370536: + beq $t6, $t5, bool_set_attribute_8737379817963 + j object_set_attribute_8737379817963 + int_set_attribute_8737379817963: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1921,8 +2158,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.board_size = size - j end_set_attribute_8768338370536 - bool_set_attribute_8768338370536: + j end_set_attribute_8737379817963 + bool_set_attribute_8737379817963: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1931,19 +2168,19 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.board_size = size - j end_set_attribute_8768338370536 - object_set_attribute_8768338370536: + j end_set_attribute_8737379817963 + object_set_attribute_8737379817963: sw $t1, 16($t0) # self.board_size = size - end_set_attribute_8768338370536: + end_set_attribute_8737379817963: - # internal_8 = size - lw $t0, 156($sp) + # internal_10 = size + lw $t0, 164($sp) sw $t0, 124($sp) - # Jumping to endif_8768338404476 - j endif_8768338404476 + # Jumping to endif_8737379850713 + j endif_8737379850713 - else_8768338404476: + else_8737379850713: # Allocating Bool 0 li $v0, 9 @@ -1955,7 +2192,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 96($sp) # internal_15 = address of allocated object Int + sw $v0, 96($sp) # internal_17 = address of allocated object Int # Allocating Int 20 li $v0, 9 @@ -1967,40 +2204,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 20 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 92($sp) # internal_16 = address of allocated object Int + sw $v0, 92($sp) # internal_18 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument size - lw $t0, 168($sp) + lw $t0, 176($sp) sw $t0, 4($sp) # Storing size - # Argument internal_16 + # Argument internal_18 lw $t0, 104($sp) - sw $t0, 0($sp) # Storing internal_16 + sw $t0, 0($sp) # Storing internal_18 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 100($sp) # internal_17 = result of function_equal + sw $v1, 100($sp) # internal_19 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_15 = internal_17 + # internal_17 = internal_19 lw $t0, 88($sp) sw $t0, 96($sp) - # If internal_15 then goto then_8768338404470 + # If internal_17 then goto then_8737379850707 lw $t0, 96($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338404470 + beq $t0, $t1, then_8737379850707 - # Jumping to else_8768338404470 - j else_8768338404470 + # Jumping to else_8737379850707 + j else_8737379850707 - then_8768338404470: + then_8737379850707: # Allocating Int 4 li $v0, 9 @@ -2012,22 +2249,22 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 84($sp) # internal_18 = address of allocated object Int + sw $v0, 84($sp) # internal_20 = address of allocated object Int # Set attribute rows of self - lw $t0, 164($sp) # $t0 = self - lw $t1, 84($sp) # $t1 = internal_18 - beq $t1, $zero, object_set_attribute_8768338371184 + lw $t0, 172($sp) # $t0 = self + lw $t1, 84($sp) # $t1 = internal_20 + beq $t1, $zero, object_set_attribute_8737379818355 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338371184 + beq $t6, $t5, int_set_attribute_8737379818355 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338371184 - j object_set_attribute_8768338371184 - int_set_attribute_8768338371184: + beq $t6, $t5, bool_set_attribute_8737379818355 + j object_set_attribute_8737379818355 + int_set_attribute_8737379818355: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2035,9 +2272,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($t0) # self.rows = internal_18 - j end_set_attribute_8768338371184 - bool_set_attribute_8768338371184: + sw $v0, 8($t0) # self.rows = internal_20 + j end_set_attribute_8737379818355 + bool_set_attribute_8737379818355: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2045,11 +2282,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($t0) # self.rows = internal_18 - j end_set_attribute_8768338371184 - object_set_attribute_8768338371184: - sw $t1, 8($t0) # self.rows = internal_18 - end_set_attribute_8768338371184: + sw $v0, 8($t0) # self.rows = internal_20 + j end_set_attribute_8737379818355 + object_set_attribute_8737379818355: + sw $t1, 8($t0) # self.rows = internal_20 + end_set_attribute_8737379818355: # Allocating Int 5 li $v0, 9 @@ -2061,22 +2298,22 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 5 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # internal_19 = address of allocated object Int + sw $v0, 80($sp) # internal_21 = address of allocated object Int # Set attribute columns of self - lw $t0, 164($sp) # $t0 = self - lw $t1, 80($sp) # $t1 = internal_19 - beq $t1, $zero, object_set_attribute_8768338371205 + lw $t0, 172($sp) # $t0 = self + lw $t1, 80($sp) # $t1 = internal_21 + beq $t1, $zero, object_set_attribute_8737379818376 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338371205 + beq $t6, $t5, int_set_attribute_8737379818376 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338371205 - j object_set_attribute_8768338371205 - int_set_attribute_8768338371205: + beq $t6, $t5, bool_set_attribute_8737379818376 + j object_set_attribute_8737379818376 + int_set_attribute_8737379818376: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2084,9 +2321,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.columns = internal_19 - j end_set_attribute_8768338371205 - bool_set_attribute_8768338371205: + sw $v0, 12($t0) # self.columns = internal_21 + j end_set_attribute_8737379818376 + bool_set_attribute_8737379818376: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2094,26 +2331,26 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.columns = internal_19 - j end_set_attribute_8768338371205 - object_set_attribute_8768338371205: - sw $t1, 12($t0) # self.columns = internal_19 - end_set_attribute_8768338371205: + sw $v0, 12($t0) # self.columns = internal_21 + j end_set_attribute_8737379818376 + object_set_attribute_8737379818376: + sw $t1, 12($t0) # self.columns = internal_21 + end_set_attribute_8737379818376: # Set attribute board_size of self - lw $t0, 164($sp) # $t0 = self - lw $t1, 156($sp) # $t1 = size - beq $t1, $zero, object_set_attribute_8768338371226 + lw $t0, 172($sp) # $t0 = self + lw $t1, 164($sp) # $t1 = size + beq $t1, $zero, object_set_attribute_8737379818397 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338371226 + beq $t6, $t5, int_set_attribute_8737379818397 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338371226 - j object_set_attribute_8768338371226 - int_set_attribute_8768338371226: + beq $t6, $t5, bool_set_attribute_8737379818397 + j object_set_attribute_8737379818397 + int_set_attribute_8737379818397: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2122,8 +2359,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.board_size = size - j end_set_attribute_8768338371226 - bool_set_attribute_8768338371226: + j end_set_attribute_8737379818397 + bool_set_attribute_8737379818397: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2132,19 +2369,19 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.board_size = size - j end_set_attribute_8768338371226 - object_set_attribute_8768338371226: + j end_set_attribute_8737379818397 + object_set_attribute_8737379818397: sw $t1, 16($t0) # self.board_size = size - end_set_attribute_8768338371226: + end_set_attribute_8737379818397: - # internal_14 = size - lw $t0, 156($sp) + # internal_16 = size + lw $t0, 164($sp) sw $t0, 100($sp) - # Jumping to endif_8768338404470 - j endif_8768338404470 + # Jumping to endif_8737379850707 + j endif_8737379850707 - else_8768338404470: + else_8737379850707: # Allocating Bool 0 li $v0, 9 @@ -2156,7 +2393,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 72($sp) # internal_21 = address of allocated object Int + sw $v0, 72($sp) # internal_23 = address of allocated object Int # Allocating Int 21 li $v0, 9 @@ -2168,40 +2405,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 21 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 68($sp) # internal_22 = address of allocated object Int + sw $v0, 68($sp) # internal_24 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument size - lw $t0, 168($sp) + lw $t0, 176($sp) sw $t0, 4($sp) # Storing size - # Argument internal_22 + # Argument internal_24 lw $t0, 80($sp) - sw $t0, 0($sp) # Storing internal_22 + sw $t0, 0($sp) # Storing internal_24 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 76($sp) # internal_23 = result of function_equal + sw $v1, 76($sp) # internal_25 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_21 = internal_23 + # internal_23 = internal_25 lw $t0, 64($sp) sw $t0, 72($sp) - # If internal_21 then goto then_8768338404464 + # If internal_23 then goto then_8737379850701 lw $t0, 72($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338404464 + beq $t0, $t1, then_8737379850701 - # Jumping to else_8768338404464 - j else_8768338404464 + # Jumping to else_8737379850701 + j else_8737379850701 - then_8768338404464: + then_8737379850701: # Allocating Int 3 li $v0, 9 @@ -2213,22 +2450,22 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_24 = address of allocated object Int + sw $v0, 60($sp) # internal_26 = address of allocated object Int # Set attribute rows of self - lw $t0, 164($sp) # $t0 = self - lw $t1, 60($sp) # $t1 = internal_24 - beq $t1, $zero, object_set_attribute_8768338371618 + lw $t0, 172($sp) # $t0 = self + lw $t1, 60($sp) # $t1 = internal_26 + beq $t1, $zero, object_set_attribute_8737379819045 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338371618 + beq $t6, $t5, int_set_attribute_8737379819045 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338371618 - j object_set_attribute_8768338371618 - int_set_attribute_8768338371618: + beq $t6, $t5, bool_set_attribute_8737379819045 + j object_set_attribute_8737379819045 + int_set_attribute_8737379819045: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2236,9 +2473,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($t0) # self.rows = internal_24 - j end_set_attribute_8768338371618 - bool_set_attribute_8768338371618: + sw $v0, 8($t0) # self.rows = internal_26 + j end_set_attribute_8737379819045 + bool_set_attribute_8737379819045: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2246,11 +2483,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($t0) # self.rows = internal_24 - j end_set_attribute_8768338371618 - object_set_attribute_8768338371618: - sw $t1, 8($t0) # self.rows = internal_24 - end_set_attribute_8768338371618: + sw $v0, 8($t0) # self.rows = internal_26 + j end_set_attribute_8737379819045 + object_set_attribute_8737379819045: + sw $t1, 8($t0) # self.rows = internal_26 + end_set_attribute_8737379819045: # Allocating Int 7 li $v0, 9 @@ -2262,22 +2499,22 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 7 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 56($sp) # internal_25 = address of allocated object Int + sw $v0, 56($sp) # internal_27 = address of allocated object Int # Set attribute columns of self - lw $t0, 164($sp) # $t0 = self - lw $t1, 56($sp) # $t1 = internal_25 - beq $t1, $zero, object_set_attribute_8768338371639 + lw $t0, 172($sp) # $t0 = self + lw $t1, 56($sp) # $t1 = internal_27 + beq $t1, $zero, object_set_attribute_8737379819066 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338371639 + beq $t6, $t5, int_set_attribute_8737379819066 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338371639 - j object_set_attribute_8768338371639 - int_set_attribute_8768338371639: + beq $t6, $t5, bool_set_attribute_8737379819066 + j object_set_attribute_8737379819066 + int_set_attribute_8737379819066: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2285,9 +2522,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.columns = internal_25 - j end_set_attribute_8768338371639 - bool_set_attribute_8768338371639: + sw $v0, 12($t0) # self.columns = internal_27 + j end_set_attribute_8737379819066 + bool_set_attribute_8737379819066: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2295,26 +2532,26 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.columns = internal_25 - j end_set_attribute_8768338371639 - object_set_attribute_8768338371639: - sw $t1, 12($t0) # self.columns = internal_25 - end_set_attribute_8768338371639: + sw $v0, 12($t0) # self.columns = internal_27 + j end_set_attribute_8737379819066 + object_set_attribute_8737379819066: + sw $t1, 12($t0) # self.columns = internal_27 + end_set_attribute_8737379819066: # Set attribute board_size of self - lw $t0, 164($sp) # $t0 = self - lw $t1, 156($sp) # $t1 = size - beq $t1, $zero, object_set_attribute_8768338371660 + lw $t0, 172($sp) # $t0 = self + lw $t1, 164($sp) # $t1 = size + beq $t1, $zero, object_set_attribute_8737379819087 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338371660 + beq $t6, $t5, int_set_attribute_8737379819087 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338371660 - j object_set_attribute_8768338371660 - int_set_attribute_8768338371660: + beq $t6, $t5, bool_set_attribute_8737379819087 + j object_set_attribute_8737379819087 + int_set_attribute_8737379819087: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2323,8 +2560,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.board_size = size - j end_set_attribute_8768338371660 - bool_set_attribute_8768338371660: + j end_set_attribute_8737379819087 + bool_set_attribute_8737379819087: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2333,19 +2570,19 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.board_size = size - j end_set_attribute_8768338371660 - object_set_attribute_8768338371660: + j end_set_attribute_8737379819087 + object_set_attribute_8737379819087: sw $t1, 16($t0) # self.board_size = size - end_set_attribute_8768338371660: + end_set_attribute_8737379819087: - # internal_20 = size - lw $t0, 156($sp) + # internal_22 = size + lw $t0, 164($sp) sw $t0, 76($sp) - # Jumping to endif_8768338404464 - j endif_8768338404464 + # Jumping to endif_8737379850701 + j endif_8737379850701 - else_8768338404464: + else_8737379850701: # Allocating Bool 0 li $v0, 9 @@ -2357,7 +2594,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_27 = address of allocated object Int + sw $v0, 48($sp) # internal_29 = address of allocated object Int # Allocating Int 25 li $v0, 9 @@ -2369,40 +2606,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 25 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_28 = address of allocated object Int + sw $v0, 44($sp) # internal_30 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument size - lw $t0, 168($sp) + lw $t0, 176($sp) sw $t0, 4($sp) # Storing size - # Argument internal_28 + # Argument internal_30 lw $t0, 56($sp) - sw $t0, 0($sp) # Storing internal_28 + sw $t0, 0($sp) # Storing internal_30 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 52($sp) # internal_29 = result of function_equal + sw $v1, 52($sp) # internal_31 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_27 = internal_29 + # internal_29 = internal_31 lw $t0, 40($sp) sw $t0, 48($sp) - # If internal_27 then goto then_8768338404458 + # If internal_29 then goto then_8737379850695 lw $t0, 48($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338404458 + beq $t0, $t1, then_8737379850695 - # Jumping to else_8768338404458 - j else_8768338404458 + # Jumping to else_8737379850695 + j else_8737379850695 - then_8768338404458: + then_8737379850695: # Allocating Int 5 li $v0, 9 @@ -2414,22 +2651,22 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 5 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_30 = address of allocated object Int + sw $v0, 36($sp) # internal_32 = address of allocated object Int # Set attribute rows of self - lw $t0, 164($sp) # $t0 = self - lw $t1, 36($sp) # $t1 = internal_30 - beq $t1, $zero, object_set_attribute_8768338371792 + lw $t0, 172($sp) # $t0 = self + lw $t1, 36($sp) # $t1 = internal_32 + beq $t1, $zero, object_set_attribute_8737379819219 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338371792 + beq $t6, $t5, int_set_attribute_8737379819219 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338371792 - j object_set_attribute_8768338371792 - int_set_attribute_8768338371792: + beq $t6, $t5, bool_set_attribute_8737379819219 + j object_set_attribute_8737379819219 + int_set_attribute_8737379819219: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2437,9 +2674,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($t0) # self.rows = internal_30 - j end_set_attribute_8768338371792 - bool_set_attribute_8768338371792: + sw $v0, 8($t0) # self.rows = internal_32 + j end_set_attribute_8737379819219 + bool_set_attribute_8737379819219: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2447,11 +2684,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($t0) # self.rows = internal_30 - j end_set_attribute_8768338371792 - object_set_attribute_8768338371792: - sw $t1, 8($t0) # self.rows = internal_30 - end_set_attribute_8768338371792: + sw $v0, 8($t0) # self.rows = internal_32 + j end_set_attribute_8737379819219 + object_set_attribute_8737379819219: + sw $t1, 8($t0) # self.rows = internal_32 + end_set_attribute_8737379819219: # Allocating Int 5 li $v0, 9 @@ -2463,22 +2700,22 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 5 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_31 = address of allocated object Int + sw $v0, 32($sp) # internal_33 = address of allocated object Int # Set attribute columns of self - lw $t0, 164($sp) # $t0 = self - lw $t1, 32($sp) # $t1 = internal_31 - beq $t1, $zero, object_set_attribute_8768338371813 + lw $t0, 172($sp) # $t0 = self + lw $t1, 32($sp) # $t1 = internal_33 + beq $t1, $zero, object_set_attribute_8737379819240 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338371813 + beq $t6, $t5, int_set_attribute_8737379819240 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338371813 - j object_set_attribute_8768338371813 - int_set_attribute_8768338371813: + beq $t6, $t5, bool_set_attribute_8737379819240 + j object_set_attribute_8737379819240 + int_set_attribute_8737379819240: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2486,9 +2723,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.columns = internal_31 - j end_set_attribute_8768338371813 - bool_set_attribute_8768338371813: + sw $v0, 12($t0) # self.columns = internal_33 + j end_set_attribute_8737379819240 + bool_set_attribute_8737379819240: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2496,26 +2733,26 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.columns = internal_31 - j end_set_attribute_8768338371813 - object_set_attribute_8768338371813: - sw $t1, 12($t0) # self.columns = internal_31 - end_set_attribute_8768338371813: + sw $v0, 12($t0) # self.columns = internal_33 + j end_set_attribute_8737379819240 + object_set_attribute_8737379819240: + sw $t1, 12($t0) # self.columns = internal_33 + end_set_attribute_8737379819240: # Set attribute board_size of self - lw $t0, 164($sp) # $t0 = self - lw $t1, 156($sp) # $t1 = size - beq $t1, $zero, object_set_attribute_8768338371834 + lw $t0, 172($sp) # $t0 = self + lw $t1, 164($sp) # $t1 = size + beq $t1, $zero, object_set_attribute_8737379819258 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338371834 + beq $t6, $t5, int_set_attribute_8737379819258 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338371834 - j object_set_attribute_8768338371834 - int_set_attribute_8768338371834: + beq $t6, $t5, bool_set_attribute_8737379819258 + j object_set_attribute_8737379819258 + int_set_attribute_8737379819258: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2524,8 +2761,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.board_size = size - j end_set_attribute_8768338371834 - bool_set_attribute_8768338371834: + j end_set_attribute_8737379819258 + bool_set_attribute_8737379819258: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2534,19 +2771,19 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.board_size = size - j end_set_attribute_8768338371834 - object_set_attribute_8768338371834: + j end_set_attribute_8737379819258 + object_set_attribute_8737379819258: sw $t1, 16($t0) # self.board_size = size - end_set_attribute_8768338371834: + end_set_attribute_8737379819258: - # internal_26 = size - lw $t0, 156($sp) + # internal_28 = size + lw $t0, 164($sp) sw $t0, 52($sp) - # Jumping to endif_8768338404458 - j endif_8768338404458 + # Jumping to endif_8737379850695 + j endif_8737379850695 - else_8768338404458: + else_8737379850695: # Allocating Bool 0 li $v0, 9 @@ -2558,7 +2795,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_33 = address of allocated object Int + sw $v0, 24($sp) # internal_35 = address of allocated object Int # Allocating Int 28 li $v0, 9 @@ -2570,40 +2807,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 28 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_34 = address of allocated object Int + sw $v0, 20($sp) # internal_36 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument size - lw $t0, 168($sp) + lw $t0, 176($sp) sw $t0, 4($sp) # Storing size - # Argument internal_34 + # Argument internal_36 lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_34 + sw $t0, 0($sp) # Storing internal_36 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 28($sp) # internal_35 = result of function_equal + sw $v1, 28($sp) # internal_37 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_33 = internal_35 + # internal_35 = internal_37 lw $t0, 16($sp) sw $t0, 24($sp) - # If internal_33 then goto then_8768338404446 + # If internal_35 then goto then_8737379850683 lw $t0, 24($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338404446 + beq $t0, $t1, then_8737379850683 - # Jumping to else_8768338404446 - j else_8768338404446 + # Jumping to else_8737379850683 + j else_8737379850683 - then_8768338404446: + then_8737379850683: # Allocating Int 7 li $v0, 9 @@ -2615,22 +2852,22 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 7 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_36 = address of allocated object Int + sw $v0, 12($sp) # internal_38 = address of allocated object Int # Set attribute rows of self - lw $t0, 164($sp) # $t0 = self - lw $t1, 12($sp) # $t1 = internal_36 - beq $t1, $zero, object_set_attribute_8768338372226 + lw $t0, 172($sp) # $t0 = self + lw $t1, 12($sp) # $t1 = internal_38 + beq $t1, $zero, object_set_attribute_8737379819397 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338372226 + beq $t6, $t5, int_set_attribute_8737379819397 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338372226 - j object_set_attribute_8768338372226 - int_set_attribute_8768338372226: + beq $t6, $t5, bool_set_attribute_8737379819397 + j object_set_attribute_8737379819397 + int_set_attribute_8737379819397: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2638,9 +2875,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($t0) # self.rows = internal_36 - j end_set_attribute_8768338372226 - bool_set_attribute_8768338372226: + sw $v0, 8($t0) # self.rows = internal_38 + j end_set_attribute_8737379819397 + bool_set_attribute_8737379819397: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2648,11 +2885,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($t0) # self.rows = internal_36 - j end_set_attribute_8768338372226 - object_set_attribute_8768338372226: - sw $t1, 8($t0) # self.rows = internal_36 - end_set_attribute_8768338372226: + sw $v0, 8($t0) # self.rows = internal_38 + j end_set_attribute_8737379819397 + object_set_attribute_8737379819397: + sw $t1, 8($t0) # self.rows = internal_38 + end_set_attribute_8737379819397: # Allocating Int 4 li $v0, 9 @@ -2664,22 +2901,22 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_37 = address of allocated object Int + sw $v0, 8($sp) # internal_39 = address of allocated object Int # Set attribute columns of self - lw $t0, 164($sp) # $t0 = self - lw $t1, 8($sp) # $t1 = internal_37 - beq $t1, $zero, object_set_attribute_8768338372247 + lw $t0, 172($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_39 + beq $t1, $zero, object_set_attribute_8737379819418 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338372247 + beq $t6, $t5, int_set_attribute_8737379819418 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338372247 - j object_set_attribute_8768338372247 - int_set_attribute_8768338372247: + beq $t6, $t5, bool_set_attribute_8737379819418 + j object_set_attribute_8737379819418 + int_set_attribute_8737379819418: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2687,9 +2924,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.columns = internal_37 - j end_set_attribute_8768338372247 - bool_set_attribute_8768338372247: + sw $v0, 12($t0) # self.columns = internal_39 + j end_set_attribute_8737379819418 + bool_set_attribute_8737379819418: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2697,26 +2934,26 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.columns = internal_37 - j end_set_attribute_8768338372247 - object_set_attribute_8768338372247: - sw $t1, 12($t0) # self.columns = internal_37 - end_set_attribute_8768338372247: + sw $v0, 12($t0) # self.columns = internal_39 + j end_set_attribute_8737379819418 + object_set_attribute_8737379819418: + sw $t1, 12($t0) # self.columns = internal_39 + end_set_attribute_8737379819418: # Set attribute board_size of self - lw $t0, 164($sp) # $t0 = self - lw $t1, 156($sp) # $t1 = size - beq $t1, $zero, object_set_attribute_8768338372268 + lw $t0, 172($sp) # $t0 = self + lw $t1, 164($sp) # $t1 = size + beq $t1, $zero, object_set_attribute_8737379819439 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338372268 + beq $t6, $t5, int_set_attribute_8737379819439 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338372268 - j object_set_attribute_8768338372268 - int_set_attribute_8768338372268: + beq $t6, $t5, bool_set_attribute_8737379819439 + j object_set_attribute_8737379819439 + int_set_attribute_8737379819439: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2725,8 +2962,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.board_size = size - j end_set_attribute_8768338372268 - bool_set_attribute_8768338372268: + j end_set_attribute_8737379819439 + bool_set_attribute_8737379819439: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2735,19 +2972,19 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.board_size = size - j end_set_attribute_8768338372268 - object_set_attribute_8768338372268: + j end_set_attribute_8737379819439 + object_set_attribute_8737379819439: sw $t1, 16($t0) # self.board_size = size - end_set_attribute_8768338372268: + end_set_attribute_8737379819439: - # internal_32 = size - lw $t0, 156($sp) + # internal_34 = size + lw $t0, 164($sp) sw $t0, 28($sp) - # Jumping to endif_8768338404446 - j endif_8768338404446 + # Jumping to endif_8737379850683 + j endif_8737379850683 - else_8768338404446: + else_8737379850683: # Allocating Int 5 li $v0, 9 @@ -2759,22 +2996,22 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 5 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_38 = address of allocated object Int + sw $v0, 4($sp) # internal_40 = address of allocated object Int # Set attribute rows of self - lw $t0, 164($sp) # $t0 = self - lw $t1, 4($sp) # $t1 = internal_38 - beq $t1, $zero, object_set_attribute_8768338372298 + lw $t0, 172($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_40 + beq $t1, $zero, object_set_attribute_8737379819469 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338372298 + beq $t6, $t5, int_set_attribute_8737379819469 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338372298 - j object_set_attribute_8768338372298 - int_set_attribute_8768338372298: + beq $t6, $t5, bool_set_attribute_8737379819469 + j object_set_attribute_8737379819469 + int_set_attribute_8737379819469: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2782,9 +3019,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($t0) # self.rows = internal_38 - j end_set_attribute_8768338372298 - bool_set_attribute_8768338372298: + sw $v0, 8($t0) # self.rows = internal_40 + j end_set_attribute_8737379819469 + bool_set_attribute_8737379819469: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2792,11 +3029,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($t0) # self.rows = internal_38 - j end_set_attribute_8768338372298 - object_set_attribute_8768338372298: - sw $t1, 8($t0) # self.rows = internal_38 - end_set_attribute_8768338372298: + sw $v0, 8($t0) # self.rows = internal_40 + j end_set_attribute_8737379819469 + object_set_attribute_8737379819469: + sw $t1, 8($t0) # self.rows = internal_40 + end_set_attribute_8737379819469: # Allocating Int 5 li $v0, 9 @@ -2808,22 +3045,22 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 5 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_39 = address of allocated object Int + sw $v0, 0($sp) # internal_41 = address of allocated object Int # Set attribute columns of self - lw $t0, 164($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_39 - beq $t1, $zero, object_set_attribute_8768338372319 + lw $t0, 172($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_41 + beq $t1, $zero, object_set_attribute_8737379819490 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338372319 + beq $t6, $t5, int_set_attribute_8737379819490 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338372319 - j object_set_attribute_8768338372319 - int_set_attribute_8768338372319: + beq $t6, $t5, bool_set_attribute_8737379819490 + j object_set_attribute_8737379819490 + int_set_attribute_8737379819490: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2831,9 +3068,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.columns = internal_39 - j end_set_attribute_8768338372319 - bool_set_attribute_8768338372319: + sw $v0, 12($t0) # self.columns = internal_41 + j end_set_attribute_8737379819490 + bool_set_attribute_8737379819490: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2841,26 +3078,26 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.columns = internal_39 - j end_set_attribute_8768338372319 - object_set_attribute_8768338372319: - sw $t1, 12($t0) # self.columns = internal_39 - end_set_attribute_8768338372319: + sw $v0, 12($t0) # self.columns = internal_41 + j end_set_attribute_8737379819490 + object_set_attribute_8737379819490: + sw $t1, 12($t0) # self.columns = internal_41 + end_set_attribute_8737379819490: # Set attribute board_size of self - lw $t0, 164($sp) # $t0 = self - lw $t1, 156($sp) # $t1 = size - beq $t1, $zero, object_set_attribute_8768338372340 + lw $t0, 172($sp) # $t0 = self + lw $t1, 164($sp) # $t1 = size + beq $t1, $zero, object_set_attribute_8737379819511 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338372340 + beq $t6, $t5, int_set_attribute_8737379819511 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338372340 - j object_set_attribute_8768338372340 - int_set_attribute_8768338372340: + beq $t6, $t5, bool_set_attribute_8737379819511 + j object_set_attribute_8737379819511 + int_set_attribute_8737379819511: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2869,8 +3106,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.board_size = size - j end_set_attribute_8768338372340 - bool_set_attribute_8768338372340: + j end_set_attribute_8737379819511 + bool_set_attribute_8737379819511: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2879,70 +3116,70 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.board_size = size - j end_set_attribute_8768338372340 - object_set_attribute_8768338372340: + j end_set_attribute_8737379819511 + object_set_attribute_8737379819511: sw $t1, 16($t0) # self.board_size = size - end_set_attribute_8768338372340: + end_set_attribute_8737379819511: - # internal_32 = size - lw $t0, 156($sp) + # internal_34 = size + lw $t0, 164($sp) sw $t0, 28($sp) - # Jumping to endif_8768338404446 - j endif_8768338404446 + # Jumping to endif_8737379850683 + j endif_8737379850683 - endif_8768338404446: + endif_8737379850683: - # internal_26 = internal_32 + # internal_28 = internal_34 lw $t0, 28($sp) sw $t0, 52($sp) - # Jumping to endif_8768338404458 - j endif_8768338404458 + # Jumping to endif_8737379850695 + j endif_8737379850695 - endif_8768338404458: + endif_8737379850695: - # internal_20 = internal_26 + # internal_22 = internal_28 lw $t0, 52($sp) sw $t0, 76($sp) - # Jumping to endif_8768338404464 - j endif_8768338404464 + # Jumping to endif_8737379850701 + j endif_8737379850701 - endif_8768338404464: + endif_8737379850701: - # internal_14 = internal_20 + # internal_16 = internal_22 lw $t0, 76($sp) sw $t0, 100($sp) - # Jumping to endif_8768338404470 - j endif_8768338404470 + # Jumping to endif_8737379850707 + j endif_8737379850707 - endif_8768338404470: + endif_8737379850707: - # internal_8 = internal_14 + # internal_10 = internal_16 lw $t0, 100($sp) sw $t0, 124($sp) - # Jumping to endif_8768338404476 - j endif_8768338404476 + # Jumping to endif_8737379850713 + j endif_8737379850713 - endif_8768338404476: + endif_8737379850713: - # internal_2 = internal_8 + # internal_4 = internal_10 lw $t0, 124($sp) sw $t0, 148($sp) - # Jumping to endif_8768338404482 - j endif_8768338404482 + # Jumping to endif_8737379850719 + j endif_8737379850719 - endif_8768338404482: + endif_8737379850719: # Loading return value in $v1 - lw $v1, 164($sp) + lw $v1, 172($sp) # Freeing space for local variables - addi $sp, $sp, 160 + addi $sp, $sp, 168 jr $ra @@ -2969,17 +3206,17 @@ # Set attribute rows of self lw $t0, 16($sp) # $t0 = self lw $t1, 12($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8768338372916 + beq $t1, $zero, object_set_attribute_8737379820087 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338372916 + beq $t6, $t5, int_set_attribute_8737379820087 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338372916 - j object_set_attribute_8768338372916 - int_set_attribute_8768338372916: + beq $t6, $t5, bool_set_attribute_8737379820087 + j object_set_attribute_8737379820087 + int_set_attribute_8737379820087: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2988,8 +3225,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.rows = internal_0 - j end_set_attribute_8768338372916 - bool_set_attribute_8768338372916: + j end_set_attribute_8737379820087 + bool_set_attribute_8737379820087: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2998,10 +3235,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.rows = internal_0 - j end_set_attribute_8768338372916 - object_set_attribute_8768338372916: + j end_set_attribute_8737379820087 + object_set_attribute_8737379820087: sw $t1, 8($t0) # self.rows = internal_0 - end_set_attribute_8768338372916: + end_set_attribute_8737379820087: # Allocating Int 0 li $v0, 9 @@ -3018,17 +3255,17 @@ # Set attribute columns of self lw $t0, 16($sp) # $t0 = self lw $t1, 8($sp) # $t1 = internal_1 - beq $t1, $zero, object_set_attribute_8768338372937 + beq $t1, $zero, object_set_attribute_8737379820108 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338372937 + beq $t6, $t5, int_set_attribute_8737379820108 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338372937 - j object_set_attribute_8768338372937 - int_set_attribute_8768338372937: + beq $t6, $t5, bool_set_attribute_8737379820108 + j object_set_attribute_8737379820108 + int_set_attribute_8737379820108: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3037,8 +3274,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.columns = internal_1 - j end_set_attribute_8768338372937 - bool_set_attribute_8768338372937: + j end_set_attribute_8737379820108 + bool_set_attribute_8737379820108: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3047,10 +3284,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.columns = internal_1 - j end_set_attribute_8768338372937 - object_set_attribute_8768338372937: + j end_set_attribute_8737379820108 + object_set_attribute_8737379820108: sw $t1, 12($t0) # self.columns = internal_1 - end_set_attribute_8768338372937: + end_set_attribute_8737379820108: # Allocating Int 0 li $v0, 9 @@ -3067,17 +3304,17 @@ # Set attribute board_size of self lw $t0, 16($sp) # $t0 = self lw $t1, 4($sp) # $t1 = internal_2 - beq $t1, $zero, object_set_attribute_8768338372958 + beq $t1, $zero, object_set_attribute_8737379820129 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338372958 + beq $t6, $t5, int_set_attribute_8737379820129 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338372958 - j object_set_attribute_8768338372958 - int_set_attribute_8768338372958: + beq $t6, $t5, bool_set_attribute_8737379820129 + j object_set_attribute_8737379820129 + int_set_attribute_8737379820129: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3086,8 +3323,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.board_size = internal_2 - j end_set_attribute_8768338372958 - bool_set_attribute_8768338372958: + j end_set_attribute_8737379820129 + bool_set_attribute_8737379820129: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3096,10 +3333,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.board_size = internal_2 - j end_set_attribute_8768338372958 - object_set_attribute_8768338372958: + j end_set_attribute_8737379820129 + object_set_attribute_8737379820129: sw $t1, 16($t0) # self.board_size = internal_2 - end_set_attribute_8768338372958: + end_set_attribute_8737379820129: # Allocating String li $v0, 9 @@ -3119,17 +3356,17 @@ # Set attribute population_map of self lw $t0, 16($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_3 - beq $t1, $zero, object_set_attribute_8768338372979 + beq $t1, $zero, object_set_attribute_8737379820150 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338372979 + beq $t6, $t5, int_set_attribute_8737379820150 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338372979 - j object_set_attribute_8768338372979 - int_set_attribute_8768338372979: + beq $t6, $t5, bool_set_attribute_8737379820150 + j object_set_attribute_8737379820150 + int_set_attribute_8737379820150: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3138,8 +3375,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 20($t0) # self.population_map = internal_3 - j end_set_attribute_8768338372979 - bool_set_attribute_8768338372979: + j end_set_attribute_8737379820150 + bool_set_attribute_8737379820150: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3148,10 +3385,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 20($t0) # self.population_map = internal_3 - j end_set_attribute_8768338372979 - object_set_attribute_8768338372979: + j end_set_attribute_8737379820150 + object_set_attribute_8737379820150: sw $t1, 20($t0) # self.population_map = internal_3 - end_set_attribute_8768338372979: + end_set_attribute_8737379820150: # Loading return value in $v1 lw $v1, 16($sp) @@ -3163,27 +3400,27 @@ function_init_at_CellularAutomaton: # Function parameters - # $ra = 12($sp) - # self = 8($sp) - # map = 4($sp) + # $ra = 20($sp) + # self = 16($sp) + # map = 12($sp) # Reserving space for local variables - addi $sp, $sp, -4 + addi $sp, $sp, -12 # Set attribute population_map of self - lw $t0, 8($sp) # $t0 = self - lw $t1, 4($sp) # $t1 = map - beq $t1, $zero, object_set_attribute_8768338373024 + lw $t0, 16($sp) # $t0 = self + lw $t1, 12($sp) # $t1 = map + beq $t1, $zero, object_set_attribute_8737379820195 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338373024 + beq $t6, $t5, int_set_attribute_8737379820195 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338373024 - j object_set_attribute_8768338373024 - int_set_attribute_8768338373024: + beq $t6, $t5, bool_set_attribute_8737379820195 + j object_set_attribute_8737379820195 + int_set_attribute_8737379820195: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3192,8 +3429,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 20($t0) # self.population_map = map - j end_set_attribute_8768338373024 - bool_set_attribute_8768338373024: + j end_set_attribute_8737379820195 + bool_set_attribute_8737379820195: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3202,44 +3439,68 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 20($t0) # self.population_map = map - j end_set_attribute_8768338373024 - object_set_attribute_8768338373024: + j end_set_attribute_8737379820195 + object_set_attribute_8737379820195: sw $t1, 20($t0) # self.population_map = map - end_set_attribute_8768338373024: + end_set_attribute_8737379820195: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + # Get method board_init of CellularAutomaton + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 4($sp) # Storing self # Argument map - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 0($sp) # Storing map - # Calling function function_board_init_at_Board - jal function_board_init_at_Board + # Calling function internal_2 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_0 = result of function_board_init_at_Board + sw $v1, 20($sp) # internal_0 = result of internal_2 addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 8($sp) + lw $v1, 16($sp) # Freeing space for local variables - addi $sp, $sp, 4 + addi $sp, $sp, 12 jr $ra function_print_at_CellularAutomaton: # Function parameters - # $ra = 72($sp) - # self = 68($sp) + # $ra = 116($sp) + # self = 112($sp) # Reserving space for local variables - addi $sp, $sp, -68 + addi $sp, $sp, -112 # Allocating Int 0 li $v0, 9 @@ -3251,39 +3512,39 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_1 = address of allocated object Int + sw $v0, 104($sp) # internal_1 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 76($sp) + lw $t0, 120($sp) sw $t0, 4($sp) # Storing i # Argument internal_1 - lw $t0, 72($sp) + lw $t0, 116($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 76($sp) # i = result of function_assign + sw $v1, 120($sp) # i = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Get attribute board_size of self - lw $t0, 68($sp) # Get the address of self - lw $t1, 16($t0) # Get the attribute 'board_size' from the instance + lw $t0, 112($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'board_size' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338373919 + beq $t6, $t5, int_get_attribute_8737379821114 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338373919 - j object_get_attribute_8768338373919 - int_get_attribute_8768338373919: + beq $t6, $t5, bool_get_attribute_8737379821114 + j object_get_attribute_8737379821114 + int_get_attribute_8737379821114: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3291,9 +3552,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 52($sp) # internal_3 = self.board_size - j end_get_attribute_8768338373919 - bool_get_attribute_8768338373919: + sw $v0, 96($sp) # internal_3 = self.board_size + j end_get_attribute_8737379821114 + bool_get_attribute_8737379821114: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3301,28 +3562,28 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 52($sp) # internal_3 = self.board_size - j end_get_attribute_8768338373919 - object_get_attribute_8768338373919: - sw $t1, 52($sp) # internal_3 = board_size - end_get_attribute_8768338373919: + sw $v0, 96($sp) # internal_3 = self.board_size + j end_get_attribute_8737379821114 + object_get_attribute_8737379821114: + sw $t1, 96($sp) # internal_3 = self.board_size + end_get_attribute_8737379821114: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 68($sp) + lw $t0, 112($sp) sw $t0, 4($sp) # Storing num # Argument internal_3 - lw $t0, 64($sp) + lw $t0, 108($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 68($sp) # num = result of function_assign + sw $v1, 112($sp) # num = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -3341,70 +3602,97 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 48($sp) # internal_4 = "\n" + sw $v0, 92($sp) # internal_4 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_6 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 112($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 84($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 80($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 80($sp) + lw $t0, 124($sp) sw $t0, 4($sp) # Storing self # Argument internal_4 - lw $t0, 60($sp) + lw $t0, 104($sp) sw $t0, 0($sp) # Storing internal_4 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_7 + lw $t0, 92($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 56($sp) # internal_5 = result of function_out_string_at_IO + sw $v1, 100($sp) # internal_5 = result of internal_7 addi $sp, $sp, 12 # Freeing space for arguments - while_start_8768338405422: + # Allocating NUll to internal_8 + sw $zero, 76($sp) # internal_8 = 0 + + while_start_8737379851659: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 76($sp) + lw $t0, 120($sp) sw $t0, 4($sp) # Storing i # Argument num - lw $t0, 68($sp) + lw $t0, 112($sp) sw $t0, 0($sp) # Storing num # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 52($sp) # internal_6 = result of function_less_than + sw $v1, 84($sp) # internal_9 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_6 then goto while_body_8768338405422 - lw $t0, 40($sp) # Loading the address of the condition + # If internal_9 then goto while_body_8737379851659 + lw $t0, 72($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8768338405422 + beq $t0, $t1, while_body_8737379851659 - # Jumping to while_end_8768338405422 - j while_end_8768338405422 + # Jumping to while_end_8737379851659 + j while_end_8737379851659 - while_body_8768338405422: + while_body_8737379851659: # Get attribute population_map of self - lw $t0, 68($sp) # Get the address of self - lw $t1, 20($t0) # Get the attribute 'population_map' from the instance + lw $t0, 112($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'population_map' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338374114 + beq $t6, $t5, int_get_attribute_8737379821861 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338374114 - j object_get_attribute_8768338374114 - int_get_attribute_8768338374114: + beq $t6, $t5, bool_get_attribute_8737379821861 + j object_get_attribute_8737379821861 + int_get_attribute_8737379821861: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3412,9 +3700,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 36($sp) # internal_7 = self.population_map - j end_get_attribute_8768338374114 - bool_get_attribute_8768338374114: + sw $v0, 68($sp) # internal_10 = self.population_map + j end_get_attribute_8737379821861 + bool_get_attribute_8737379821861: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3422,25 +3710,25 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 36($sp) # internal_7 = self.population_map - j end_get_attribute_8768338374114 - object_get_attribute_8768338374114: - sw $t1, 36($sp) # internal_7 = population_map - end_get_attribute_8768338374114: + sw $v0, 68($sp) # internal_10 = self.population_map + j end_get_attribute_8737379821861 + object_get_attribute_8737379821861: + sw $t1, 68($sp) # internal_10 = self.population_map + end_get_attribute_8737379821861: # Get attribute columns of self - lw $t0, 68($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t0, 112($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338374129 + beq $t6, $t5, int_get_attribute_8737379821876 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338374129 - j object_get_attribute_8768338374129 - int_get_attribute_8768338374129: + beq $t6, $t5, bool_get_attribute_8737379821876 + j object_get_attribute_8737379821876 + int_get_attribute_8737379821876: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3448,9 +3736,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 32($sp) # internal_8 = self.columns - j end_get_attribute_8768338374129 - bool_get_attribute_8768338374129: + sw $v0, 64($sp) # internal_11 = self.columns + j end_get_attribute_8737379821876 + bool_get_attribute_8737379821876: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3458,50 +3746,98 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 32($sp) # internal_8 = self.columns - j end_get_attribute_8768338374129 - object_get_attribute_8768338374129: - sw $t1, 32($sp) # internal_8 = columns - end_get_attribute_8768338374129: + sw $v0, 64($sp) # internal_11 = self.columns + j end_get_attribute_8737379821876 + object_get_attribute_8737379821876: + sw $t1, 64($sp) # internal_11 = self.columns + end_get_attribute_8737379821876: + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_13 = address of allocated object Int + + # Get method substr of String + lw $t0, 68($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 56($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 52($sp) # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address - # Argument internal_7 - lw $t0, 52($sp) - sw $t0, 8($sp) # Storing internal_7 + # Argument internal_10 + lw $t0, 84($sp) + sw $t0, 8($sp) # Storing internal_10 # Argument i - lw $t0, 80($sp) + lw $t0, 124($sp) sw $t0, 4($sp) # Storing i - # Argument internal_8 - lw $t0, 48($sp) - sw $t0, 0($sp) # Storing internal_8 + # Argument internal_11 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_11 - # Calling function function_substr_at_String - jal function_substr_at_String + # Calling function internal_14 + lw $t0, 68($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 44($sp) # internal_9 = result of function_substr_at_String + sw $v1, 76($sp) # internal_12 = result of internal_14 addi $sp, $sp, 16 # Freeing space for arguments + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_16 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 112($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 44($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 40($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 80($sp) + lw $t0, 124($sp) sw $t0, 4($sp) # Storing self - # Argument internal_9 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_9 + # Argument internal_12 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_12 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_17 + lw $t0, 52($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 36($sp) # internal_10 = result of function_out_string_at_IO + sw $v1, 60($sp) # internal_15 = result of internal_17 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -3516,43 +3852,67 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_11[0] = '\n' + sb $t0, 8($v0) # internal_18[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 20($sp) # internal_11 = "\n" + sw $v0, 36($sp) # internal_18 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_20 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 112($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 28($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 24($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 80($sp) + lw $t0, 124($sp) sw $t0, 4($sp) # Storing self - # Argument internal_11 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_11 + # Argument internal_18 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_18 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_21 + lw $t0, 36($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 28($sp) # internal_12 = result of function_out_string_at_IO + sw $v1, 44($sp) # internal_19 = result of internal_21 addi $sp, $sp, 12 # Freeing space for arguments # Get attribute columns of self - lw $t0, 68($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t0, 112($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338374485 + beq $t6, $t5, int_get_attribute_8737379822044 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338374485 - j object_get_attribute_8768338374485 - int_get_attribute_8768338374485: + beq $t6, $t5, bool_get_attribute_8737379822044 + j object_get_attribute_8737379822044 + int_get_attribute_8737379822044: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3560,9 +3920,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_13 = self.columns - j end_get_attribute_8768338374485 - bool_get_attribute_8768338374485: + sw $v0, 20($sp) # internal_22 = self.columns + j end_get_attribute_8737379822044 + bool_get_attribute_8737379822044: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3570,28 +3930,28 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_13 = self.columns - j end_get_attribute_8768338374485 - object_get_attribute_8768338374485: - sw $t1, 12($sp) # internal_13 = columns - end_get_attribute_8768338374485: + sw $v0, 20($sp) # internal_22 = self.columns + j end_get_attribute_8737379822044 + object_get_attribute_8737379822044: + sw $t1, 20($sp) # internal_22 = self.columns + end_get_attribute_8737379822044: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 76($sp) + lw $t0, 120($sp) sw $t0, 4($sp) # Storing i - # Argument internal_13 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_13 + # Argument internal_22 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_22 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 20($sp) # internal_14 = result of function_add + sw $v1, 28($sp) # internal_23 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -3599,23 +3959,23 @@ sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 76($sp) + lw $t0, 120($sp) sw $t0, 4($sp) # Storing i - # Argument internal_14 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_14 + # Argument internal_23 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_23 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 76($sp) # i = result of function_assign + sw $v1, 120($sp) # i = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to while_start_8768338405422 - j while_start_8768338405422 + # Jumping to while_start_8737379851659 + j while_start_8737379851659 - while_end_8768338405422: + while_end_8737379851659: # Allocating String li $v0, 9 @@ -3629,59 +3989,83 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_15[0] = '\n' + sb $t0, 8($v0) # internal_24[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_15 = "\n" + sw $v0, 12($sp) # internal_24 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_26 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 112($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 80($sp) + lw $t0, 124($sp) sw $t0, 4($sp) # Storing self - # Argument internal_15 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_15 + # Argument internal_24 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_24 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_27 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_16 = result of function_out_string_at_IO + sw $v1, 20($sp) # internal_25 = result of internal_27 addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 68($sp) + lw $v1, 112($sp) # Freeing space for local variables - addi $sp, $sp, 68 + addi $sp, $sp, 112 jr $ra function_num_cells_at_CellularAutomaton: # Function parameters - # $ra = 12($sp) - # self = 8($sp) + # $ra = 20($sp) + # self = 16($sp) # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Get attribute population_map of self - lw $t0, 8($sp) # Get the address of self - lw $t1, 20($t0) # Get the attribute 'population_map' from the instance + lw $t0, 16($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'population_map' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338373952 + beq $t6, $t5, int_get_attribute_8737379821147 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338373952 - j object_get_attribute_8768338373952 - int_get_attribute_8768338373952: + beq $t6, $t5, bool_get_attribute_8737379821147 + j object_get_attribute_8737379821147 + int_get_attribute_8737379821147: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3689,9 +4073,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_0 = self.population_map - j end_get_attribute_8768338373952 - bool_get_attribute_8768338373952: + sw $v0, 12($sp) # internal_0 = self.population_map + j end_get_attribute_8737379821147 + bool_get_attribute_8737379821147: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3699,42 +4083,66 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_0 = self.population_map - j end_get_attribute_8768338373952 - object_get_attribute_8768338373952: - sw $t1, 4($sp) # internal_0 = population_map - end_get_attribute_8768338373952: + sw $v0, 12($sp) # internal_0 = self.population_map + j end_get_attribute_8737379821147 + object_get_attribute_8737379821147: + sw $t1, 12($sp) # internal_0 = self.population_map + end_get_attribute_8737379821147: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method length of String + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_length_at_String - jal function_length_at_String + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function_length_at_String + sw $v1, 16($sp) # internal_1 = result of internal_3 addi $sp, $sp, 8 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 8 + addi $sp, $sp, 16 jr $ra function_cell_at_CellularAutomaton: # Function parameters - # $ra = 48($sp) - # self = 44($sp) - # position = 40($sp) + # $ra = 56($sp) + # self = 52($sp) + # position = 48($sp) # Reserving space for local variables - addi $sp, $sp, -40 + addi $sp, $sp, -48 # Allocating Bool 0 li $v0, 9 @@ -3746,21 +4154,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_1 = address of allocated object Int + sw $v0, 40($sp) # internal_1 = address of allocated object Int # Get attribute board_size of self - lw $t0, 44($sp) # Get the address of self - lw $t1, 16($t0) # Get the attribute 'board_size' from the instance + lw $t0, 52($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'board_size' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338374638 + beq $t6, $t5, int_get_attribute_8737379822761 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338374638 - j object_get_attribute_8768338374638 - int_get_attribute_8768338374638: + beq $t6, $t5, bool_get_attribute_8737379822761 + j object_get_attribute_8737379822761 + int_get_attribute_8737379822761: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3768,9 +4176,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 28($sp) # internal_2 = self.board_size - j end_get_attribute_8768338374638 - bool_get_attribute_8768338374638: + sw $v0, 36($sp) # internal_2 = self.board_size + j end_get_attribute_8737379822761 + bool_get_attribute_8737379822761: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3778,11 +4186,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 28($sp) # internal_2 = self.board_size - j end_get_attribute_8768338374638 - object_get_attribute_8768338374638: - sw $t1, 28($sp) # internal_2 = board_size - end_get_attribute_8768338374638: + sw $v0, 36($sp) # internal_2 = self.board_size + j end_get_attribute_8737379822761 + object_get_attribute_8737379822761: + sw $t1, 36($sp) # internal_2 = self.board_size + end_get_attribute_8737379822761: # Allocating Int 1 li $v0, 9 @@ -3794,24 +4202,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_3 = address of allocated object Int + sw $v0, 32($sp) # internal_3 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_2 - lw $t0, 40($sp) + lw $t0, 48($sp) sw $t0, 4($sp) # Storing internal_2 # Argument internal_3 - lw $t0, 36($sp) + lw $t0, 44($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 32($sp) # internal_4 = result of function_sub + sw $v1, 40($sp) # internal_4 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -3819,33 +4227,33 @@ sw $ra, 8($sp) # Storing return address # Argument internal_4 - lw $t0, 32($sp) + lw $t0, 40($sp) sw $t0, 4($sp) # Storing internal_4 # Argument position - lw $t0, 52($sp) + lw $t0, 60($sp) sw $t0, 0($sp) # Storing position # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 28($sp) # internal_5 = result of function_less_than + sw $v1, 36($sp) # internal_5 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments # internal_1 = internal_5 - lw $t0, 16($sp) - sw $t0, 32($sp) + lw $t0, 24($sp) + sw $t0, 40($sp) - # If internal_1 then goto then_8768338405551 - lw $t0, 32($sp) # Loading the address of the condition + # If internal_1 then goto then_8737379852304 + lw $t0, 40($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338405551 + beq $t0, $t1, then_8737379852304 - # Jumping to else_8768338405551 - j else_8768338405551 + # Jumping to else_8737379852304 + j else_8737379852304 - then_8768338405551: + then_8737379852304: # Allocating String li $v0, 9 @@ -3863,30 +4271,30 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_6 = " " + sw $v0, 20($sp) # internal_6 = " " # internal_0 = internal_6 - lw $t0, 12($sp) - sw $t0, 36($sp) + lw $t0, 20($sp) + sw $t0, 44($sp) - # Jumping to endif_8768338405551 - j endif_8768338405551 + # Jumping to endif_8737379852304 + j endif_8737379852304 - else_8768338405551: + else_8737379852304: # Get attribute population_map of self - lw $t0, 44($sp) # Get the address of self - lw $t1, 20($t0) # Get the attribute 'population_map' from the instance + lw $t0, 52($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'population_map' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338375536 + beq $t6, $t5, int_get_attribute_8737379816235 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338375536 - j object_get_attribute_8768338375536 - int_get_attribute_8768338375536: + beq $t6, $t5, bool_get_attribute_8737379816235 + j object_get_attribute_8737379816235 + int_get_attribute_8737379816235: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3894,9 +4302,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($sp) # internal_7 = self.population_map - j end_get_attribute_8768338375536 - bool_get_attribute_8768338375536: + sw $v0, 16($sp) # internal_7 = self.population_map + j end_get_attribute_8737379816235 + bool_get_attribute_8737379816235: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3904,11 +4312,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($sp) # internal_7 = self.population_map - j end_get_attribute_8768338375536 - object_get_attribute_8768338375536: - sw $t1, 8($sp) # internal_7 = population_map - end_get_attribute_8768338375536: + sw $v0, 16($sp) # internal_7 = self.population_map + j end_get_attribute_8737379816235 + object_get_attribute_8737379816235: + sw $t1, 16($sp) # internal_7 = self.population_map + end_get_attribute_8737379816235: # Allocating Int 1 li $v0, 9 @@ -3920,55 +4328,79 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_8 = address of allocated object Int + sw $v0, 12($sp) # internal_8 = address of allocated object Int - # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Argument internal_7 - lw $t0, 24($sp) - sw $t0, 8($sp) # Storing internal_7 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_10 = address of allocated object Int + + # Get method substr of String + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_7 + lw $t0, 32($sp) + sw $t0, 8($sp) # Storing internal_7 # Argument position - lw $t0, 56($sp) + lw $t0, 64($sp) sw $t0, 4($sp) # Storing position # Argument internal_8 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_8 - # Calling function function_substr_at_String - jal function_substr_at_String + # Calling function internal_11 + lw $t0, 16($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 16($sp) # internal_9 = result of function_substr_at_String + sw $v1, 24($sp) # internal_9 = result of internal_11 addi $sp, $sp, 16 # Freeing space for arguments # internal_0 = internal_9 - lw $t0, 0($sp) - sw $t0, 36($sp) + lw $t0, 8($sp) + sw $t0, 44($sp) - # Jumping to endif_8768338405551 - j endif_8768338405551 + # Jumping to endif_8737379852304 + j endif_8737379852304 - endif_8768338405551: + endif_8737379852304: # Loading return value in $v1 - lw $v1, 36($sp) + lw $v1, 44($sp) # Freeing space for local variables - addi $sp, $sp, 40 + addi $sp, $sp, 48 jr $ra function_north_at_CellularAutomaton: # Function parameters - # $ra = 48($sp) - # self = 44($sp) - # position = 40($sp) + # $ra = 56($sp) + # self = 52($sp) + # position = 48($sp) # Reserving space for local variables - addi $sp, $sp, -40 + addi $sp, $sp, -48 # Allocating Bool 0 li $v0, 9 @@ -3980,21 +4412,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_1 = address of allocated object Int + sw $v0, 40($sp) # internal_1 = address of allocated object Int # Get attribute columns of self - lw $t0, 44($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t0, 52($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338375671 + beq $t6, $t5, int_get_attribute_8737379816394 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338375671 - j object_get_attribute_8768338375671 - int_get_attribute_8768338375671: + beq $t6, $t5, bool_get_attribute_8737379816394 + j object_get_attribute_8737379816394 + int_get_attribute_8737379816394: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4002,9 +4434,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 28($sp) # internal_2 = self.columns - j end_get_attribute_8768338375671 - bool_get_attribute_8768338375671: + sw $v0, 36($sp) # internal_2 = self.columns + j end_get_attribute_8737379816394 + bool_get_attribute_8737379816394: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4012,28 +4444,28 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 28($sp) # internal_2 = self.columns - j end_get_attribute_8768338375671 - object_get_attribute_8768338375671: - sw $t1, 28($sp) # internal_2 = columns - end_get_attribute_8768338375671: + sw $v0, 36($sp) # internal_2 = self.columns + j end_get_attribute_8737379816394 + object_get_attribute_8737379816394: + sw $t1, 36($sp) # internal_2 = self.columns + end_get_attribute_8737379816394: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 52($sp) + lw $t0, 60($sp) sw $t0, 4($sp) # Storing position # Argument internal_2 - lw $t0, 40($sp) + lw $t0, 48($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 36($sp) # internal_3 = result of function_sub + sw $v1, 44($sp) # internal_3 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 0 @@ -4046,40 +4478,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_4 = address of allocated object Int + sw $v0, 28($sp) # internal_4 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_3 - lw $t0, 36($sp) + lw $t0, 44($sp) sw $t0, 4($sp) # Storing internal_3 # Argument internal_4 - lw $t0, 32($sp) + lw $t0, 40($sp) sw $t0, 0($sp) # Storing internal_4 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 28($sp) # internal_5 = result of function_less_than + sw $v1, 36($sp) # internal_5 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments # internal_1 = internal_5 - lw $t0, 16($sp) - sw $t0, 32($sp) + lw $t0, 24($sp) + sw $t0, 40($sp) - # If internal_1 then goto then_8768338405617 - lw $t0, 32($sp) # Loading the address of the condition + # If internal_1 then goto then_8737379852370 + lw $t0, 40($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338405617 + beq $t0, $t1, then_8737379852370 - # Jumping to else_8768338405617 - j else_8768338405617 + # Jumping to else_8737379852370 + j else_8737379852370 - then_8768338405617: + then_8737379852370: # Allocating String li $v0, 9 @@ -4097,30 +4529,30 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_6 = " " + sw $v0, 20($sp) # internal_6 = " " # internal_0 = internal_6 - lw $t0, 12($sp) - sw $t0, 36($sp) + lw $t0, 20($sp) + sw $t0, 44($sp) - # Jumping to endif_8768338405617 - j endif_8768338405617 + # Jumping to endif_8737379852370 + j endif_8737379852370 - else_8768338405617: + else_8737379852370: # Get attribute columns of self - lw $t0, 44($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t0, 52($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338376072 + beq $t6, $t5, int_get_attribute_8737379823707 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338376072 - j object_get_attribute_8768338376072 - int_get_attribute_8768338376072: + beq $t6, $t5, bool_get_attribute_8737379823707 + j object_get_attribute_8737379823707 + int_get_attribute_8737379823707: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4128,9 +4560,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($sp) # internal_7 = self.columns - j end_get_attribute_8768338376072 - bool_get_attribute_8768338376072: + sw $v0, 16($sp) # internal_7 = self.columns + j end_get_attribute_8737379823707 + bool_get_attribute_8737379823707: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4138,73 +4570,97 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($sp) # internal_7 = self.columns - j end_get_attribute_8768338376072 - object_get_attribute_8768338376072: - sw $t1, 8($sp) # internal_7 = columns - end_get_attribute_8768338376072: + sw $v0, 16($sp) # internal_7 = self.columns + j end_get_attribute_8737379823707 + object_get_attribute_8737379823707: + sw $t1, 16($sp) # internal_7 = self.columns + end_get_attribute_8737379823707: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 52($sp) + lw $t0, 60($sp) sw $t0, 4($sp) # Storing position # Argument internal_7 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_7 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 16($sp) # internal_8 = result of function_sub + sw $v1, 24($sp) # internal_8 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_10 = address of allocated object Int + + # Get method cell of CellularAutomaton + lw $t0, 52($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 56($sp) + lw $t0, 64($sp) sw $t0, 4($sp) # Storing self # Argument internal_8 - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 0($sp) # Storing internal_8 - # Calling function function_cell_at_CellularAutomaton - jal function_cell_at_CellularAutomaton + # Calling function internal_11 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_9 = result of function_cell_at_CellularAutomaton + sw $v1, 20($sp) # internal_9 = result of internal_11 addi $sp, $sp, 12 # Freeing space for arguments # internal_0 = internal_9 - lw $t0, 0($sp) - sw $t0, 36($sp) + lw $t0, 8($sp) + sw $t0, 44($sp) - # Jumping to endif_8768338405617 - j endif_8768338405617 + # Jumping to endif_8737379852370 + j endif_8737379852370 - endif_8768338405617: + endif_8737379852370: # Loading return value in $v1 - lw $v1, 36($sp) + lw $v1, 44($sp) # Freeing space for local variables - addi $sp, $sp, 40 + addi $sp, $sp, 48 jr $ra function_south_at_CellularAutomaton: # Function parameters - # $ra = 48($sp) - # self = 44($sp) - # position = 40($sp) + # $ra = 56($sp) + # self = 52($sp) + # position = 48($sp) # Reserving space for local variables - addi $sp, $sp, -40 + addi $sp, $sp, -48 # Allocating Bool 0 li $v0, 9 @@ -4216,21 +4672,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_1 = address of allocated object Int + sw $v0, 40($sp) # internal_1 = address of allocated object Int # Get attribute board_size of self - lw $t0, 44($sp) # Get the address of self - lw $t1, 16($t0) # Get the attribute 'board_size' from the instance + lw $t0, 52($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'board_size' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338376189 + beq $t6, $t5, int_get_attribute_8737379823848 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338376189 - j object_get_attribute_8768338376189 - int_get_attribute_8768338376189: + beq $t6, $t5, bool_get_attribute_8737379823848 + j object_get_attribute_8737379823848 + int_get_attribute_8737379823848: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4238,9 +4694,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 28($sp) # internal_2 = self.board_size - j end_get_attribute_8768338376189 - bool_get_attribute_8768338376189: + sw $v0, 36($sp) # internal_2 = self.board_size + j end_get_attribute_8737379823848 + bool_get_attribute_8737379823848: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4248,25 +4704,25 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 28($sp) # internal_2 = self.board_size - j end_get_attribute_8768338376189 - object_get_attribute_8768338376189: - sw $t1, 28($sp) # internal_2 = board_size - end_get_attribute_8768338376189: + sw $v0, 36($sp) # internal_2 = self.board_size + j end_get_attribute_8737379823848 + object_get_attribute_8737379823848: + sw $t1, 36($sp) # internal_2 = self.board_size + end_get_attribute_8737379823848: # Get attribute columns of self - lw $t0, 44($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t0, 52($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338376473 + beq $t6, $t5, int_get_attribute_8737379824388 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338376473 - j object_get_attribute_8768338376473 - int_get_attribute_8768338376473: + beq $t6, $t5, bool_get_attribute_8737379824388 + j object_get_attribute_8737379824388 + int_get_attribute_8737379824388: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4274,9 +4730,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 24($sp) # internal_3 = self.columns - j end_get_attribute_8768338376473 - bool_get_attribute_8768338376473: + sw $v0, 32($sp) # internal_3 = self.columns + j end_get_attribute_8737379824388 + bool_get_attribute_8737379824388: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4284,28 +4740,28 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 24($sp) # internal_3 = self.columns - j end_get_attribute_8768338376473 - object_get_attribute_8768338376473: - sw $t1, 24($sp) # internal_3 = columns - end_get_attribute_8768338376473: + sw $v0, 32($sp) # internal_3 = self.columns + j end_get_attribute_8737379824388 + object_get_attribute_8737379824388: + sw $t1, 32($sp) # internal_3 = self.columns + end_get_attribute_8737379824388: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 52($sp) + lw $t0, 60($sp) sw $t0, 4($sp) # Storing position # Argument internal_3 - lw $t0, 36($sp) + lw $t0, 44($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 32($sp) # internal_4 = result of function_add + sw $v1, 40($sp) # internal_4 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -4313,33 +4769,33 @@ sw $ra, 8($sp) # Storing return address # Argument internal_2 - lw $t0, 40($sp) + lw $t0, 48($sp) sw $t0, 4($sp) # Storing internal_2 # Argument internal_4 - lw $t0, 32($sp) + lw $t0, 40($sp) sw $t0, 0($sp) # Storing internal_4 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 28($sp) # internal_5 = result of function_less_than + sw $v1, 36($sp) # internal_5 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments # internal_1 = internal_5 - lw $t0, 16($sp) - sw $t0, 32($sp) + lw $t0, 24($sp) + sw $t0, 40($sp) - # If internal_1 then goto then_8768338406455 - lw $t0, 32($sp) # Loading the address of the condition + # If internal_1 then goto then_8737379852436 + lw $t0, 40($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338406455 + beq $t0, $t1, then_8737379852436 - # Jumping to else_8768338406455 - j else_8768338406455 + # Jumping to else_8737379852436 + j else_8737379852436 - then_8768338406455: + then_8737379852436: # Allocating String li $v0, 9 @@ -4357,30 +4813,30 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_6 = " " + sw $v0, 20($sp) # internal_6 = " " # internal_0 = internal_6 - lw $t0, 12($sp) - sw $t0, 36($sp) + lw $t0, 20($sp) + sw $t0, 44($sp) - # Jumping to endif_8768338406455 - j endif_8768338406455 + # Jumping to endif_8737379852436 + j endif_8737379852436 - else_8768338406455: + else_8737379852436: # Get attribute columns of self - lw $t0, 44($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t0, 52($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338376602 + beq $t6, $t5, int_get_attribute_8737379824517 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338376602 - j object_get_attribute_8768338376602 - int_get_attribute_8768338376602: + beq $t6, $t5, bool_get_attribute_8737379824517 + j object_get_attribute_8737379824517 + int_get_attribute_8737379824517: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4388,9 +4844,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($sp) # internal_7 = self.columns - j end_get_attribute_8768338376602 - bool_get_attribute_8768338376602: + sw $v0, 16($sp) # internal_7 = self.columns + j end_get_attribute_8737379824517 + bool_get_attribute_8737379824517: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4398,73 +4854,97 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($sp) # internal_7 = self.columns - j end_get_attribute_8768338376602 - object_get_attribute_8768338376602: - sw $t1, 8($sp) # internal_7 = columns - end_get_attribute_8768338376602: + sw $v0, 16($sp) # internal_7 = self.columns + j end_get_attribute_8737379824517 + object_get_attribute_8737379824517: + sw $t1, 16($sp) # internal_7 = self.columns + end_get_attribute_8737379824517: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 52($sp) + lw $t0, 60($sp) sw $t0, 4($sp) # Storing position # Argument internal_7 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_7 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 16($sp) # internal_8 = result of function_add + sw $v1, 24($sp) # internal_8 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_10 = address of allocated object Int + + # Get method cell of CellularAutomaton + lw $t0, 52($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 56($sp) + lw $t0, 64($sp) sw $t0, 4($sp) # Storing self # Argument internal_8 - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 0($sp) # Storing internal_8 - # Calling function function_cell_at_CellularAutomaton - jal function_cell_at_CellularAutomaton + # Calling function internal_11 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_9 = result of function_cell_at_CellularAutomaton + sw $v1, 20($sp) # internal_9 = result of internal_11 addi $sp, $sp, 12 # Freeing space for arguments # internal_0 = internal_9 - lw $t0, 0($sp) - sw $t0, 36($sp) + lw $t0, 8($sp) + sw $t0, 44($sp) - # Jumping to endif_8768338406455 - j endif_8768338406455 + # Jumping to endif_8737379852436 + j endif_8737379852436 - endif_8768338406455: + endif_8737379852436: # Loading return value in $v1 - lw $v1, 36($sp) + lw $v1, 44($sp) # Freeing space for local variables - addi $sp, $sp, 40 + addi $sp, $sp, 48 jr $ra function_east_at_CellularAutomaton: # Function parameters - # $ra = 68($sp) - # self = 64($sp) - # position = 60($sp) + # $ra = 76($sp) + # self = 72($sp) + # position = 68($sp) # Reserving space for local variables - addi $sp, $sp, -60 + addi $sp, $sp, -68 # Allocating Bool 0 li $v0, 9 @@ -4476,7 +4956,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 52($sp) # internal_1 = address of allocated object Int + sw $v0, 60($sp) # internal_1 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -4488,39 +4968,39 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_2 = address of allocated object Int + sw $v0, 56($sp) # internal_2 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 72($sp) + lw $t0, 80($sp) sw $t0, 4($sp) # Storing position # Argument internal_2 - lw $t0, 60($sp) + lw $t0, 68($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 56($sp) # internal_3 = result of function_add + sw $v1, 64($sp) # internal_3 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Get attribute columns of self - lw $t0, 64($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t0, 72($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338377042 + beq $t6, $t5, int_get_attribute_8737379824981 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338377042 - j object_get_attribute_8768338377042 - int_get_attribute_8768338377042: + beq $t6, $t5, bool_get_attribute_8737379824981 + j object_get_attribute_8737379824981 + int_get_attribute_8737379824981: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4528,9 +5008,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 40($sp) # internal_4 = self.columns - j end_get_attribute_8768338377042 - bool_get_attribute_8768338377042: + sw $v0, 48($sp) # internal_4 = self.columns + j end_get_attribute_8737379824981 + bool_get_attribute_8737379824981: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4538,43 +5018,43 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 40($sp) # internal_4 = self.columns - j end_get_attribute_8768338377042 - object_get_attribute_8768338377042: - sw $t1, 40($sp) # internal_4 = columns - end_get_attribute_8768338377042: + sw $v0, 48($sp) # internal_4 = self.columns + j end_get_attribute_8737379824981 + object_get_attribute_8737379824981: + sw $t1, 48($sp) # internal_4 = self.columns + end_get_attribute_8737379824981: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_3 - lw $t0, 56($sp) + lw $t0, 64($sp) sw $t0, 4($sp) # Storing internal_3 # Argument internal_4 - lw $t0, 52($sp) + lw $t0, 60($sp) sw $t0, 0($sp) # Storing internal_4 # Calling function function_div jal function_div lw $ra, 8($sp) - sw $v1, 48($sp) # internal_5 = result of function_div + sw $v1, 56($sp) # internal_5 = result of function_div addi $sp, $sp, 12 # Freeing space for arguments # Get attribute columns of self - lw $t0, 64($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t0, 72($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338377069 + beq $t6, $t5, int_get_attribute_8737379825008 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338377069 - j object_get_attribute_8768338377069 - int_get_attribute_8768338377069: + beq $t6, $t5, bool_get_attribute_8737379825008 + j object_get_attribute_8737379825008 + int_get_attribute_8737379825008: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4582,9 +5062,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 32($sp) # internal_6 = self.columns - j end_get_attribute_8768338377069 - bool_get_attribute_8768338377069: + sw $v0, 40($sp) # internal_6 = self.columns + j end_get_attribute_8737379825008 + bool_get_attribute_8737379825008: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4592,28 +5072,28 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 32($sp) # internal_6 = self.columns - j end_get_attribute_8768338377069 - object_get_attribute_8768338377069: - sw $t1, 32($sp) # internal_6 = columns - end_get_attribute_8768338377069: + sw $v0, 40($sp) # internal_6 = self.columns + j end_get_attribute_8737379825008 + object_get_attribute_8737379825008: + sw $t1, 40($sp) # internal_6 = self.columns + end_get_attribute_8737379825008: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_5 - lw $t0, 48($sp) + lw $t0, 56($sp) sw $t0, 4($sp) # Storing internal_5 # Argument internal_6 - lw $t0, 44($sp) + lw $t0, 52($sp) sw $t0, 0($sp) # Storing internal_6 # Calling function function_mult jal function_mult lw $ra, 8($sp) - sw $v1, 40($sp) # internal_7 = result of function_mult + sw $v1, 48($sp) # internal_7 = result of function_mult addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -4626,24 +5106,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_8 = address of allocated object Int + sw $v0, 32($sp) # internal_8 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 72($sp) + lw $t0, 80($sp) sw $t0, 4($sp) # Storing position # Argument internal_8 - lw $t0, 36($sp) + lw $t0, 44($sp) sw $t0, 0($sp) # Storing internal_8 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 32($sp) # internal_9 = result of function_add + sw $v1, 40($sp) # internal_9 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -4651,33 +5131,33 @@ sw $ra, 8($sp) # Storing return address # Argument internal_7 - lw $t0, 40($sp) + lw $t0, 48($sp) sw $t0, 4($sp) # Storing internal_7 # Argument internal_9 - lw $t0, 32($sp) + lw $t0, 40($sp) sw $t0, 0($sp) # Storing internal_9 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 28($sp) # internal_10 = result of function_equal + sw $v1, 36($sp) # internal_10 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_1 = internal_10 - lw $t0, 16($sp) - sw $t0, 52($sp) + lw $t0, 24($sp) + sw $t0, 60($sp) - # If internal_1 then goto then_8768338406557 - lw $t0, 52($sp) # Loading the address of the condition + # If internal_1 then goto then_8737379852538 + lw $t0, 60($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338406557 + beq $t0, $t1, then_8737379852538 - # Jumping to else_8768338406557 - j else_8768338406557 + # Jumping to else_8737379852538 + j else_8737379852538 - then_8768338406557: + then_8737379852538: # Allocating String li $v0, 9 @@ -4695,16 +5175,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_11 = " " + sw $v0, 20($sp) # internal_11 = " " # internal_0 = internal_11 - lw $t0, 12($sp) - sw $t0, 56($sp) + lw $t0, 20($sp) + sw $t0, 64($sp) - # Jumping to endif_8768338406557 - j endif_8768338406557 + # Jumping to endif_8737379852538 + j endif_8737379852538 - else_8768338406557: + else_8737379852538: # Allocating Int 1 li $v0, 9 @@ -4716,69 +5196,93 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_12 = address of allocated object Int + sw $v0, 16($sp) # internal_12 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 72($sp) + lw $t0, 80($sp) sw $t0, 4($sp) # Storing position # Argument internal_12 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_12 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 16($sp) # internal_13 = result of function_add + sw $v1, 24($sp) # internal_13 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_15 = address of allocated object Int + + # Get method cell of CellularAutomaton + lw $t0, 72($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 76($sp) + lw $t0, 84($sp) sw $t0, 4($sp) # Storing self # Argument internal_13 - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 0($sp) # Storing internal_13 - # Calling function function_cell_at_CellularAutomaton - jal function_cell_at_CellularAutomaton + # Calling function internal_16 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_14 = result of function_cell_at_CellularAutomaton + sw $v1, 20($sp) # internal_14 = result of internal_16 addi $sp, $sp, 12 # Freeing space for arguments # internal_0 = internal_14 - lw $t0, 0($sp) - sw $t0, 56($sp) + lw $t0, 8($sp) + sw $t0, 64($sp) - # Jumping to endif_8768338406557 - j endif_8768338406557 + # Jumping to endif_8737379852538 + j endif_8737379852538 - endif_8768338406557: + endif_8737379852538: # Loading return value in $v1 - lw $v1, 56($sp) + lw $v1, 64($sp) # Freeing space for local variables - addi $sp, $sp, 60 + addi $sp, $sp, 68 jr $ra function_west_at_CellularAutomaton: # Function parameters - # $ra = 72($sp) - # self = 68($sp) - # position = 64($sp) + # $ra = 80($sp) + # self = 76($sp) + # position = 72($sp) # Reserving space for local variables - addi $sp, $sp, -64 + addi $sp, $sp, -72 # Allocating Bool 0 li $v0, 9 @@ -4790,7 +5294,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 56($sp) # internal_1 = address of allocated object Int + sw $v0, 64($sp) # internal_1 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -4802,40 +5306,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 52($sp) # internal_2 = address of allocated object Int + sw $v0, 60($sp) # internal_2 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 76($sp) + lw $t0, 84($sp) sw $t0, 4($sp) # Storing position # Argument internal_2 - lw $t0, 64($sp) + lw $t0, 72($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 60($sp) # internal_3 = result of function_equal + sw $v1, 68($sp) # internal_3 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_1 = internal_3 - lw $t0, 48($sp) - sw $t0, 56($sp) + lw $t0, 56($sp) + sw $t0, 64($sp) - # If internal_1 then goto then_8768338406653 - lw $t0, 56($sp) # Loading the address of the condition + # If internal_1 then goto then_8737379852894 + lw $t0, 64($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338406653 + beq $t0, $t1, then_8737379852894 - # Jumping to else_8768338406653 - j else_8768338406653 + # Jumping to else_8737379852894 + j else_8737379852894 - then_8768338406653: + then_8737379852894: # Allocating String li $v0, 9 @@ -4853,16 +5357,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 44($sp) # internal_4 = " " + sw $v0, 52($sp) # internal_4 = " " # internal_0 = internal_4 - lw $t0, 44($sp) - sw $t0, 60($sp) + lw $t0, 52($sp) + sw $t0, 68($sp) - # Jumping to endif_8768338406653 - j endif_8768338406653 + # Jumping to endif_8737379852894 + j endif_8737379852894 - else_8768338406653: + else_8737379852894: # Allocating Bool 0 li $v0, 9 @@ -4874,21 +5378,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_6 = address of allocated object Int + sw $v0, 44($sp) # internal_6 = address of allocated object Int # Get attribute columns of self - lw $t0, 68($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t0, 76($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338378033 + beq $t6, $t5, int_get_attribute_8737379825740 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338378033 - j object_get_attribute_8768338378033 - int_get_attribute_8768338378033: + beq $t6, $t5, bool_get_attribute_8737379825740 + j object_get_attribute_8737379825740 + int_get_attribute_8737379825740: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4896,9 +5400,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 32($sp) # internal_7 = self.columns - j end_get_attribute_8768338378033 - bool_get_attribute_8768338378033: + sw $v0, 40($sp) # internal_7 = self.columns + j end_get_attribute_8737379825740 + bool_get_attribute_8737379825740: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4906,43 +5410,43 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 32($sp) # internal_7 = self.columns - j end_get_attribute_8768338378033 - object_get_attribute_8768338378033: - sw $t1, 32($sp) # internal_7 = columns - end_get_attribute_8768338378033: + sw $v0, 40($sp) # internal_7 = self.columns + j end_get_attribute_8737379825740 + object_get_attribute_8737379825740: + sw $t1, 40($sp) # internal_7 = self.columns + end_get_attribute_8737379825740: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 76($sp) + lw $t0, 84($sp) sw $t0, 4($sp) # Storing position # Argument internal_7 - lw $t0, 44($sp) + lw $t0, 52($sp) sw $t0, 0($sp) # Storing internal_7 # Calling function function_div jal function_div lw $ra, 8($sp) - sw $v1, 40($sp) # internal_8 = result of function_div + sw $v1, 48($sp) # internal_8 = result of function_div addi $sp, $sp, 12 # Freeing space for arguments # Get attribute columns of self - lw $t0, 68($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t0, 76($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338378060 + beq $t6, $t5, int_get_attribute_8737379825767 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338378060 - j object_get_attribute_8768338378060 - int_get_attribute_8768338378060: + beq $t6, $t5, bool_get_attribute_8737379825767 + j object_get_attribute_8737379825767 + int_get_attribute_8737379825767: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4950,9 +5454,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 24($sp) # internal_9 = self.columns - j end_get_attribute_8768338378060 - bool_get_attribute_8768338378060: + sw $v0, 32($sp) # internal_9 = self.columns + j end_get_attribute_8737379825767 + bool_get_attribute_8737379825767: li $v0, 9 addi $a0, $zero, 12 syscall @@ -4960,28 +5464,28 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 24($sp) # internal_9 = self.columns - j end_get_attribute_8768338378060 - object_get_attribute_8768338378060: - sw $t1, 24($sp) # internal_9 = columns - end_get_attribute_8768338378060: + sw $v0, 32($sp) # internal_9 = self.columns + j end_get_attribute_8737379825767 + object_get_attribute_8737379825767: + sw $t1, 32($sp) # internal_9 = self.columns + end_get_attribute_8737379825767: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_8 - lw $t0, 40($sp) + lw $t0, 48($sp) sw $t0, 4($sp) # Storing internal_8 # Argument internal_9 - lw $t0, 36($sp) + lw $t0, 44($sp) sw $t0, 0($sp) # Storing internal_9 # Calling function function_mult jal function_mult lw $ra, 8($sp) - sw $v1, 32($sp) # internal_10 = result of function_mult + sw $v1, 40($sp) # internal_10 = result of function_mult addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -4989,33 +5493,33 @@ sw $ra, 8($sp) # Storing return address # Argument internal_10 - lw $t0, 32($sp) + lw $t0, 40($sp) sw $t0, 4($sp) # Storing internal_10 # Argument position - lw $t0, 76($sp) + lw $t0, 84($sp) sw $t0, 0($sp) # Storing position # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 28($sp) # internal_11 = result of function_equal + sw $v1, 36($sp) # internal_11 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_6 = internal_11 - lw $t0, 16($sp) - sw $t0, 36($sp) + lw $t0, 24($sp) + sw $t0, 44($sp) - # If internal_6 then goto then_8768338406663 - lw $t0, 36($sp) # Loading the address of the condition + # If internal_6 then goto then_8737379852900 + lw $t0, 44($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338406663 + beq $t0, $t1, then_8737379852900 - # Jumping to else_8768338406663 - j else_8768338406663 + # Jumping to else_8737379852900 + j else_8737379852900 - then_8768338406663: + then_8737379852900: # Allocating String li $v0, 9 @@ -5033,16 +5537,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_12 = " " + sw $v0, 20($sp) # internal_12 = " " # internal_5 = internal_12 - lw $t0, 12($sp) - sw $t0, 40($sp) + lw $t0, 20($sp) + sw $t0, 48($sp) - # Jumping to endif_8768338406663 - j endif_8768338406663 + # Jumping to endif_8737379852900 + j endif_8737379852900 - else_8768338406663: + else_8737379852900: # Allocating Int 1 li $v0, 9 @@ -5054,78 +5558,102 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_13 = address of allocated object Int + sw $v0, 16($sp) # internal_13 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 76($sp) + lw $t0, 84($sp) sw $t0, 4($sp) # Storing position # Argument internal_13 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_13 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 16($sp) # internal_14 = result of function_sub + sw $v1, 24($sp) # internal_14 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Argument self - lw $t0, 80($sp) - sw $t0, 4($sp) # Storing self + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_16 = address of allocated object Int + + # Get method cell of CellularAutomaton + lw $t0, 76($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing self # Argument internal_14 - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 0($sp) # Storing internal_14 - # Calling function function_cell_at_CellularAutomaton - jal function_cell_at_CellularAutomaton + # Calling function internal_17 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_15 = result of function_cell_at_CellularAutomaton + sw $v1, 20($sp) # internal_15 = result of internal_17 addi $sp, $sp, 12 # Freeing space for arguments # internal_5 = internal_15 - lw $t0, 0($sp) - sw $t0, 40($sp) + lw $t0, 8($sp) + sw $t0, 48($sp) - # Jumping to endif_8768338406663 - j endif_8768338406663 + # Jumping to endif_8737379852900 + j endif_8737379852900 - endif_8768338406663: + endif_8737379852900: # internal_0 = internal_5 - lw $t0, 40($sp) - sw $t0, 60($sp) + lw $t0, 48($sp) + sw $t0, 68($sp) - # Jumping to endif_8768338406653 - j endif_8768338406653 + # Jumping to endif_8737379852894 + j endif_8737379852894 - endif_8768338406653: + endif_8737379852894: # Loading return value in $v1 - lw $v1, 60($sp) + lw $v1, 68($sp) # Freeing space for local variables - addi $sp, $sp, 64 + addi $sp, $sp, 72 jr $ra function_northwest_at_CellularAutomaton: # Function parameters - # $ra = 80($sp) - # self = 76($sp) - # position = 72($sp) + # $ra = 88($sp) + # self = 84($sp) + # position = 80($sp) # Reserving space for local variables - addi $sp, $sp, -72 + addi $sp, $sp, -80 # Allocating Bool 0 li $v0, 9 @@ -5137,21 +5665,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 64($sp) # internal_1 = address of allocated object Int + sw $v0, 72($sp) # internal_1 = address of allocated object Int # Get attribute columns of self - lw $t0, 76($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t0, 84($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338378843 + beq $t6, $t5, int_get_attribute_8737379793550 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338378843 - j object_get_attribute_8768338378843 - int_get_attribute_8768338378843: + beq $t6, $t5, bool_get_attribute_8737379793550 + j object_get_attribute_8737379793550 + int_get_attribute_8737379793550: li $v0, 9 addi $a0, $zero, 12 syscall @@ -5159,9 +5687,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 60($sp) # internal_2 = self.columns - j end_get_attribute_8768338378843 - bool_get_attribute_8768338378843: + sw $v0, 68($sp) # internal_2 = self.columns + j end_get_attribute_8737379793550 + bool_get_attribute_8737379793550: li $v0, 9 addi $a0, $zero, 12 syscall @@ -5169,28 +5697,28 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 60($sp) # internal_2 = self.columns - j end_get_attribute_8768338378843 - object_get_attribute_8768338378843: - sw $t1, 60($sp) # internal_2 = columns - end_get_attribute_8768338378843: + sw $v0, 68($sp) # internal_2 = self.columns + j end_get_attribute_8737379793550 + object_get_attribute_8737379793550: + sw $t1, 68($sp) # internal_2 = self.columns + end_get_attribute_8737379793550: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 84($sp) + lw $t0, 92($sp) sw $t0, 4($sp) # Storing position # Argument internal_2 - lw $t0, 72($sp) + lw $t0, 80($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 68($sp) # internal_3 = result of function_sub + sw $v1, 76($sp) # internal_3 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 0 @@ -5203,40 +5731,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 52($sp) # internal_4 = address of allocated object Int + sw $v0, 60($sp) # internal_4 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_3 - lw $t0, 68($sp) + lw $t0, 76($sp) sw $t0, 4($sp) # Storing internal_3 # Argument internal_4 - lw $t0, 64($sp) + lw $t0, 72($sp) sw $t0, 0($sp) # Storing internal_4 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 60($sp) # internal_5 = result of function_less_than + sw $v1, 68($sp) # internal_5 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments # internal_1 = internal_5 - lw $t0, 48($sp) - sw $t0, 64($sp) + lw $t0, 56($sp) + sw $t0, 72($sp) - # If internal_1 then goto then_8768338406777 - lw $t0, 64($sp) # Loading the address of the condition + # If internal_1 then goto then_8737379853014 + lw $t0, 72($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338406777 + beq $t0, $t1, then_8737379853014 - # Jumping to else_8768338406777 - j else_8768338406777 + # Jumping to else_8737379853014 + j else_8737379853014 - then_8768338406777: + then_8737379853014: # Allocating String li $v0, 9 @@ -5254,16 +5782,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 44($sp) # internal_6 = " " + sw $v0, 52($sp) # internal_6 = " " # internal_0 = internal_6 - lw $t0, 44($sp) - sw $t0, 68($sp) + lw $t0, 52($sp) + sw $t0, 76($sp) - # Jumping to endif_8768338406777 - j endif_8768338406777 + # Jumping to endif_8737379853014 + j endif_8737379853014 - else_8768338406777: + else_8737379853014: # Allocating Bool 0 li $v0, 9 @@ -5275,21 +5803,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_8 = address of allocated object Int + sw $v0, 44($sp) # internal_8 = address of allocated object Int # Get attribute columns of self - lw $t0, 76($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t0, 84($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338379545 + beq $t6, $t5, int_get_attribute_8737379794252 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338379545 - j object_get_attribute_8768338379545 - int_get_attribute_8768338379545: + beq $t6, $t5, bool_get_attribute_8737379794252 + j object_get_attribute_8737379794252 + int_get_attribute_8737379794252: li $v0, 9 addi $a0, $zero, 12 syscall @@ -5297,9 +5825,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 32($sp) # internal_9 = self.columns - j end_get_attribute_8768338379545 - bool_get_attribute_8768338379545: + sw $v0, 40($sp) # internal_9 = self.columns + j end_get_attribute_8737379794252 + bool_get_attribute_8737379794252: li $v0, 9 addi $a0, $zero, 12 syscall @@ -5307,43 +5835,43 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 32($sp) # internal_9 = self.columns - j end_get_attribute_8768338379545 - object_get_attribute_8768338379545: - sw $t1, 32($sp) # internal_9 = columns - end_get_attribute_8768338379545: + sw $v0, 40($sp) # internal_9 = self.columns + j end_get_attribute_8737379794252 + object_get_attribute_8737379794252: + sw $t1, 40($sp) # internal_9 = self.columns + end_get_attribute_8737379794252: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 84($sp) + lw $t0, 92($sp) sw $t0, 4($sp) # Storing position # Argument internal_9 - lw $t0, 44($sp) + lw $t0, 52($sp) sw $t0, 0($sp) # Storing internal_9 # Calling function function_div jal function_div lw $ra, 8($sp) - sw $v1, 40($sp) # internal_10 = result of function_div + sw $v1, 48($sp) # internal_10 = result of function_div addi $sp, $sp, 12 # Freeing space for arguments # Get attribute columns of self - lw $t0, 76($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t0, 84($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338379572 + beq $t6, $t5, int_get_attribute_8737379794279 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338379572 - j object_get_attribute_8768338379572 - int_get_attribute_8768338379572: + beq $t6, $t5, bool_get_attribute_8737379794279 + j object_get_attribute_8737379794279 + int_get_attribute_8737379794279: li $v0, 9 addi $a0, $zero, 12 syscall @@ -5351,9 +5879,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 24($sp) # internal_11 = self.columns - j end_get_attribute_8768338379572 - bool_get_attribute_8768338379572: + sw $v0, 32($sp) # internal_11 = self.columns + j end_get_attribute_8737379794279 + bool_get_attribute_8737379794279: li $v0, 9 addi $a0, $zero, 12 syscall @@ -5361,28 +5889,28 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 24($sp) # internal_11 = self.columns - j end_get_attribute_8768338379572 - object_get_attribute_8768338379572: - sw $t1, 24($sp) # internal_11 = columns - end_get_attribute_8768338379572: + sw $v0, 32($sp) # internal_11 = self.columns + j end_get_attribute_8737379794279 + object_get_attribute_8737379794279: + sw $t1, 32($sp) # internal_11 = self.columns + end_get_attribute_8737379794279: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_10 - lw $t0, 40($sp) + lw $t0, 48($sp) sw $t0, 4($sp) # Storing internal_10 # Argument internal_11 - lw $t0, 36($sp) + lw $t0, 44($sp) sw $t0, 0($sp) # Storing internal_11 # Calling function function_mult jal function_mult lw $ra, 8($sp) - sw $v1, 32($sp) # internal_12 = result of function_mult + sw $v1, 40($sp) # internal_12 = result of function_mult addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -5390,33 +5918,33 @@ sw $ra, 8($sp) # Storing return address # Argument internal_12 - lw $t0, 32($sp) + lw $t0, 40($sp) sw $t0, 4($sp) # Storing internal_12 # Argument position - lw $t0, 84($sp) + lw $t0, 92($sp) sw $t0, 0($sp) # Storing position # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 28($sp) # internal_13 = result of function_equal + sw $v1, 36($sp) # internal_13 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_8 = internal_13 - lw $t0, 16($sp) - sw $t0, 36($sp) + lw $t0, 24($sp) + sw $t0, 44($sp) - # If internal_8 then goto then_8768338406783 - lw $t0, 36($sp) # Loading the address of the condition + # If internal_8 then goto then_8737379853020 + lw $t0, 44($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338406783 + beq $t0, $t1, then_8737379853020 - # Jumping to else_8768338406783 - j else_8768338406783 + # Jumping to else_8737379853020 + j else_8737379853020 - then_8768338406783: + then_8737379853020: # Allocating String li $v0, 9 @@ -5434,16 +5962,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_14 = " " + sw $v0, 20($sp) # internal_14 = " " # internal_7 = internal_14 - lw $t0, 12($sp) - sw $t0, 40($sp) + lw $t0, 20($sp) + sw $t0, 48($sp) - # Jumping to endif_8768338406783 - j endif_8768338406783 + # Jumping to endif_8737379853020 + j endif_8737379853020 - else_8768338406783: + else_8737379853020: # Allocating Int 1 li $v0, 9 @@ -5455,78 +5983,102 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_15 = address of allocated object Int + sw $v0, 16($sp) # internal_15 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 84($sp) + lw $t0, 92($sp) sw $t0, 4($sp) # Storing position # Argument internal_15 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_15 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 16($sp) # internal_16 = result of function_sub + sw $v1, 24($sp) # internal_16 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 14 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 14 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_18 = address of allocated object Int + + # Get method north of CellularAutomaton + lw $t0, 84($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 88($sp) + lw $t0, 96($sp) sw $t0, 4($sp) # Storing self # Argument internal_16 - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 0($sp) # Storing internal_16 - # Calling function function_north_at_CellularAutomaton - jal function_north_at_CellularAutomaton + # Calling function internal_19 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_17 = result of function_north_at_CellularAutomaton + sw $v1, 20($sp) # internal_17 = result of internal_19 addi $sp, $sp, 12 # Freeing space for arguments # internal_7 = internal_17 - lw $t0, 0($sp) - sw $t0, 40($sp) + lw $t0, 8($sp) + sw $t0, 48($sp) - # Jumping to endif_8768338406783 - j endif_8768338406783 + # Jumping to endif_8737379853020 + j endif_8737379853020 - endif_8768338406783: + endif_8737379853020: # internal_0 = internal_7 - lw $t0, 40($sp) - sw $t0, 68($sp) + lw $t0, 48($sp) + sw $t0, 76($sp) - # Jumping to endif_8768338406777 - j endif_8768338406777 + # Jumping to endif_8737379853014 + j endif_8737379853014 - endif_8768338406777: + endif_8737379853014: # Loading return value in $v1 - lw $v1, 68($sp) + lw $v1, 76($sp) # Freeing space for local variables - addi $sp, $sp, 72 + addi $sp, $sp, 80 jr $ra function_northeast_at_CellularAutomaton: # Function parameters - # $ra = 96($sp) - # self = 92($sp) - # position = 88($sp) + # $ra = 104($sp) + # self = 100($sp) + # position = 96($sp) # Reserving space for local variables - addi $sp, $sp, -88 + addi $sp, $sp, -96 # Allocating Bool 0 li $v0, 9 @@ -5538,21 +6090,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # internal_1 = address of allocated object Int + sw $v0, 88($sp) # internal_1 = address of allocated object Int # Get attribute columns of self - lw $t0, 92($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t0, 100($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338380099 + beq $t6, $t5, int_get_attribute_8737379794830 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338380099 - j object_get_attribute_8768338380099 - int_get_attribute_8768338380099: + beq $t6, $t5, bool_get_attribute_8737379794830 + j object_get_attribute_8737379794830 + int_get_attribute_8737379794830: li $v0, 9 addi $a0, $zero, 12 syscall @@ -5560,9 +6112,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 76($sp) # internal_2 = self.columns - j end_get_attribute_8768338380099 - bool_get_attribute_8768338380099: + sw $v0, 84($sp) # internal_2 = self.columns + j end_get_attribute_8737379794830 + bool_get_attribute_8737379794830: li $v0, 9 addi $a0, $zero, 12 syscall @@ -5570,28 +6122,28 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 76($sp) # internal_2 = self.columns - j end_get_attribute_8768338380099 - object_get_attribute_8768338380099: - sw $t1, 76($sp) # internal_2 = columns - end_get_attribute_8768338380099: + sw $v0, 84($sp) # internal_2 = self.columns + j end_get_attribute_8737379794830 + object_get_attribute_8737379794830: + sw $t1, 84($sp) # internal_2 = self.columns + end_get_attribute_8737379794830: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 100($sp) + lw $t0, 108($sp) sw $t0, 4($sp) # Storing position # Argument internal_2 - lw $t0, 88($sp) + lw $t0, 96($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 84($sp) # internal_3 = result of function_sub + sw $v1, 92($sp) # internal_3 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 0 @@ -5604,40 +6156,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 68($sp) # internal_4 = address of allocated object Int + sw $v0, 76($sp) # internal_4 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_3 - lw $t0, 84($sp) + lw $t0, 92($sp) sw $t0, 4($sp) # Storing internal_3 # Argument internal_4 - lw $t0, 80($sp) + lw $t0, 88($sp) sw $t0, 0($sp) # Storing internal_4 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 76($sp) # internal_5 = result of function_less_than + sw $v1, 84($sp) # internal_5 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments # internal_1 = internal_5 - lw $t0, 64($sp) - sw $t0, 80($sp) + lw $t0, 72($sp) + sw $t0, 88($sp) - # If internal_1 then goto then_8768338407181 - lw $t0, 80($sp) # Loading the address of the condition + # If internal_1 then goto then_8737379853418 + lw $t0, 88($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338407181 + beq $t0, $t1, then_8737379853418 - # Jumping to else_8768338407181 - j else_8768338407181 + # Jumping to else_8737379853418 + j else_8737379853418 - then_8768338407181: + then_8737379853418: # Allocating String li $v0, 9 @@ -5655,16 +6207,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 60($sp) # internal_6 = " " + sw $v0, 68($sp) # internal_6 = " " # internal_0 = internal_6 - lw $t0, 60($sp) - sw $t0, 84($sp) + lw $t0, 68($sp) + sw $t0, 92($sp) - # Jumping to endif_8768338407181 - j endif_8768338407181 + # Jumping to endif_8737379853418 + j endif_8737379853418 - else_8768338407181: + else_8737379853418: # Allocating Bool 0 li $v0, 9 @@ -5676,7 +6228,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 52($sp) # internal_8 = address of allocated object Int + sw $v0, 60($sp) # internal_8 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -5688,39 +6240,39 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_9 = address of allocated object Int + sw $v0, 56($sp) # internal_9 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 100($sp) + lw $t0, 108($sp) sw $t0, 4($sp) # Storing position # Argument internal_9 - lw $t0, 60($sp) + lw $t0, 68($sp) sw $t0, 0($sp) # Storing internal_9 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 56($sp) # internal_10 = result of function_add + sw $v1, 64($sp) # internal_10 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Get attribute columns of self - lw $t0, 92($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t0, 100($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338380584 + beq $t6, $t5, int_get_attribute_8737379795315 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338380584 - j object_get_attribute_8768338380584 - int_get_attribute_8768338380584: + beq $t6, $t5, bool_get_attribute_8737379795315 + j object_get_attribute_8737379795315 + int_get_attribute_8737379795315: li $v0, 9 addi $a0, $zero, 12 syscall @@ -5728,9 +6280,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 40($sp) # internal_11 = self.columns - j end_get_attribute_8768338380584 - bool_get_attribute_8768338380584: + sw $v0, 48($sp) # internal_11 = self.columns + j end_get_attribute_8737379795315 + bool_get_attribute_8737379795315: li $v0, 9 addi $a0, $zero, 12 syscall @@ -5738,43 +6290,43 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 40($sp) # internal_11 = self.columns - j end_get_attribute_8768338380584 - object_get_attribute_8768338380584: - sw $t1, 40($sp) # internal_11 = columns - end_get_attribute_8768338380584: + sw $v0, 48($sp) # internal_11 = self.columns + j end_get_attribute_8737379795315 + object_get_attribute_8737379795315: + sw $t1, 48($sp) # internal_11 = self.columns + end_get_attribute_8737379795315: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_10 - lw $t0, 56($sp) + lw $t0, 64($sp) sw $t0, 4($sp) # Storing internal_10 # Argument internal_11 - lw $t0, 52($sp) + lw $t0, 60($sp) sw $t0, 0($sp) # Storing internal_11 # Calling function function_div jal function_div lw $ra, 8($sp) - sw $v1, 48($sp) # internal_12 = result of function_div + sw $v1, 56($sp) # internal_12 = result of function_div addi $sp, $sp, 12 # Freeing space for arguments # Get attribute columns of self - lw $t0, 92($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t0, 100($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338380611 + beq $t6, $t5, int_get_attribute_8737379795342 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338380611 - j object_get_attribute_8768338380611 - int_get_attribute_8768338380611: + beq $t6, $t5, bool_get_attribute_8737379795342 + j object_get_attribute_8737379795342 + int_get_attribute_8737379795342: li $v0, 9 addi $a0, $zero, 12 syscall @@ -5782,9 +6334,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 32($sp) # internal_13 = self.columns - j end_get_attribute_8768338380611 - bool_get_attribute_8768338380611: + sw $v0, 40($sp) # internal_13 = self.columns + j end_get_attribute_8737379795342 + bool_get_attribute_8737379795342: li $v0, 9 addi $a0, $zero, 12 syscall @@ -5792,28 +6344,28 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 32($sp) # internal_13 = self.columns - j end_get_attribute_8768338380611 - object_get_attribute_8768338380611: - sw $t1, 32($sp) # internal_13 = columns - end_get_attribute_8768338380611: + sw $v0, 40($sp) # internal_13 = self.columns + j end_get_attribute_8737379795342 + object_get_attribute_8737379795342: + sw $t1, 40($sp) # internal_13 = self.columns + end_get_attribute_8737379795342: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_12 - lw $t0, 48($sp) + lw $t0, 56($sp) sw $t0, 4($sp) # Storing internal_12 # Argument internal_13 - lw $t0, 44($sp) + lw $t0, 52($sp) sw $t0, 0($sp) # Storing internal_13 # Calling function function_mult jal function_mult lw $ra, 8($sp) - sw $v1, 40($sp) # internal_14 = result of function_mult + sw $v1, 48($sp) # internal_14 = result of function_mult addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -5826,24 +6378,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_15 = address of allocated object Int + sw $v0, 32($sp) # internal_15 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 100($sp) + lw $t0, 108($sp) sw $t0, 4($sp) # Storing position # Argument internal_15 - lw $t0, 36($sp) + lw $t0, 44($sp) sw $t0, 0($sp) # Storing internal_15 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 32($sp) # internal_16 = result of function_add + sw $v1, 40($sp) # internal_16 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -5851,33 +6403,33 @@ sw $ra, 8($sp) # Storing return address # Argument internal_14 - lw $t0, 40($sp) + lw $t0, 48($sp) sw $t0, 4($sp) # Storing internal_14 # Argument internal_16 - lw $t0, 32($sp) + lw $t0, 40($sp) sw $t0, 0($sp) # Storing internal_16 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 28($sp) # internal_17 = result of function_equal + sw $v1, 36($sp) # internal_17 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_8 = internal_17 - lw $t0, 16($sp) - sw $t0, 52($sp) + lw $t0, 24($sp) + sw $t0, 60($sp) - # If internal_8 then goto then_8768338407187 - lw $t0, 52($sp) # Loading the address of the condition + # If internal_8 then goto then_8737379853424 + lw $t0, 60($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338407187 + beq $t0, $t1, then_8737379853424 - # Jumping to else_8768338407187 - j else_8768338407187 + # Jumping to else_8737379853424 + j else_8737379853424 - then_8768338407187: + then_8737379853424: # Allocating String li $v0, 9 @@ -5895,16 +6447,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_18 = " " + sw $v0, 20($sp) # internal_18 = " " # internal_7 = internal_18 - lw $t0, 12($sp) - sw $t0, 56($sp) + lw $t0, 20($sp) + sw $t0, 64($sp) - # Jumping to endif_8768338407187 - j endif_8768338407187 + # Jumping to endif_8737379853424 + j endif_8737379853424 - else_8768338407187: + else_8737379853424: # Allocating Int 1 li $v0, 9 @@ -5916,78 +6468,102 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_19 = address of allocated object Int + sw $v0, 16($sp) # internal_19 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 100($sp) + lw $t0, 108($sp) sw $t0, 4($sp) # Storing position # Argument internal_19 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_19 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 16($sp) # internal_20 = result of function_add + sw $v1, 24($sp) # internal_20 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 14 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 14 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_22 = address of allocated object Int + + # Get method north of CellularAutomaton + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 104($sp) + lw $t0, 112($sp) sw $t0, 4($sp) # Storing self # Argument internal_20 - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 0($sp) # Storing internal_20 - # Calling function function_north_at_CellularAutomaton - jal function_north_at_CellularAutomaton + # Calling function internal_23 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_21 = result of function_north_at_CellularAutomaton + sw $v1, 20($sp) # internal_21 = result of internal_23 addi $sp, $sp, 12 # Freeing space for arguments # internal_7 = internal_21 - lw $t0, 0($sp) - sw $t0, 56($sp) + lw $t0, 8($sp) + sw $t0, 64($sp) - # Jumping to endif_8768338407187 - j endif_8768338407187 + # Jumping to endif_8737379853424 + j endif_8737379853424 - endif_8768338407187: + endif_8737379853424: # internal_0 = internal_7 - lw $t0, 56($sp) - sw $t0, 84($sp) + lw $t0, 64($sp) + sw $t0, 92($sp) - # Jumping to endif_8768338407181 - j endif_8768338407181 + # Jumping to endif_8737379853418 + j endif_8737379853418 - endif_8768338407181: + endif_8737379853418: # Loading return value in $v1 - lw $v1, 84($sp) + lw $v1, 92($sp) # Freeing space for local variables - addi $sp, $sp, 88 + addi $sp, $sp, 96 jr $ra function_southeast_at_CellularAutomaton: # Function parameters - # $ra = 96($sp) - # self = 92($sp) - # position = 88($sp) + # $ra = 104($sp) + # self = 100($sp) + # position = 96($sp) # Reserving space for local variables - addi $sp, $sp, -88 + addi $sp, $sp, -96 # Allocating Bool 0 li $v0, 9 @@ -5999,21 +6575,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # internal_1 = address of allocated object Int + sw $v0, 88($sp) # internal_1 = address of allocated object Int # Get attribute board_size of self - lw $t0, 92($sp) # Get the address of self - lw $t1, 16($t0) # Get the attribute 'board_size' from the instance + lw $t0, 100($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'board_size' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338381165 + beq $t6, $t5, int_get_attribute_8737379796176 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338381165 - j object_get_attribute_8768338381165 - int_get_attribute_8768338381165: + beq $t6, $t5, bool_get_attribute_8737379796176 + j object_get_attribute_8737379796176 + int_get_attribute_8737379796176: li $v0, 9 addi $a0, $zero, 12 syscall @@ -6021,9 +6597,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 76($sp) # internal_2 = self.board_size - j end_get_attribute_8768338381165 - bool_get_attribute_8768338381165: + sw $v0, 84($sp) # internal_2 = self.board_size + j end_get_attribute_8737379796176 + bool_get_attribute_8737379796176: li $v0, 9 addi $a0, $zero, 12 syscall @@ -6031,25 +6607,25 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 76($sp) # internal_2 = self.board_size - j end_get_attribute_8768338381165 - object_get_attribute_8768338381165: - sw $t1, 76($sp) # internal_2 = board_size - end_get_attribute_8768338381165: + sw $v0, 84($sp) # internal_2 = self.board_size + j end_get_attribute_8737379796176 + object_get_attribute_8737379796176: + sw $t1, 84($sp) # internal_2 = self.board_size + end_get_attribute_8737379796176: # Get attribute columns of self - lw $t0, 92($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t0, 100($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338381189 + beq $t6, $t5, int_get_attribute_8737379796200 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338381189 - j object_get_attribute_8768338381189 - int_get_attribute_8768338381189: + beq $t6, $t5, bool_get_attribute_8737379796200 + j object_get_attribute_8737379796200 + int_get_attribute_8737379796200: li $v0, 9 addi $a0, $zero, 12 syscall @@ -6057,9 +6633,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 72($sp) # internal_3 = self.columns - j end_get_attribute_8768338381189 - bool_get_attribute_8768338381189: + sw $v0, 80($sp) # internal_3 = self.columns + j end_get_attribute_8737379796200 + bool_get_attribute_8737379796200: li $v0, 9 addi $a0, $zero, 12 syscall @@ -6067,28 +6643,28 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 72($sp) # internal_3 = self.columns - j end_get_attribute_8768338381189 - object_get_attribute_8768338381189: - sw $t1, 72($sp) # internal_3 = columns - end_get_attribute_8768338381189: + sw $v0, 80($sp) # internal_3 = self.columns + j end_get_attribute_8737379796200 + object_get_attribute_8737379796200: + sw $t1, 80($sp) # internal_3 = self.columns + end_get_attribute_8737379796200: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 100($sp) + lw $t0, 108($sp) sw $t0, 4($sp) # Storing position # Argument internal_3 - lw $t0, 84($sp) + lw $t0, 92($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 80($sp) # internal_4 = result of function_add + sw $v1, 88($sp) # internal_4 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -6096,33 +6672,33 @@ sw $ra, 8($sp) # Storing return address # Argument internal_2 - lw $t0, 88($sp) + lw $t0, 96($sp) sw $t0, 4($sp) # Storing internal_2 # Argument internal_4 - lw $t0, 80($sp) + lw $t0, 88($sp) sw $t0, 0($sp) # Storing internal_4 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 76($sp) # internal_5 = result of function_less_than + sw $v1, 84($sp) # internal_5 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments # internal_1 = internal_5 - lw $t0, 64($sp) - sw $t0, 80($sp) + lw $t0, 72($sp) + sw $t0, 88($sp) - # If internal_1 then goto then_8768338407325 - lw $t0, 80($sp) # Loading the address of the condition + # If internal_1 then goto then_8737379853562 + lw $t0, 88($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338407325 + beq $t0, $t1, then_8737379853562 - # Jumping to else_8768338407325 - j else_8768338407325 + # Jumping to else_8737379853562 + j else_8737379853562 - then_8768338407325: + then_8737379853562: # Allocating String li $v0, 9 @@ -6140,16 +6716,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 60($sp) # internal_6 = " " + sw $v0, 68($sp) # internal_6 = " " # internal_0 = internal_6 - lw $t0, 60($sp) - sw $t0, 84($sp) + lw $t0, 68($sp) + sw $t0, 92($sp) - # Jumping to endif_8768338407325 - j endif_8768338407325 + # Jumping to endif_8737379853562 + j endif_8737379853562 - else_8768338407325: + else_8737379853562: # Allocating Bool 0 li $v0, 9 @@ -6161,7 +6737,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 52($sp) # internal_8 = address of allocated object Int + sw $v0, 60($sp) # internal_8 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -6173,39 +6749,39 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_9 = address of allocated object Int + sw $v0, 56($sp) # internal_9 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 100($sp) + lw $t0, 108($sp) sw $t0, 4($sp) # Storing position # Argument internal_9 - lw $t0, 60($sp) + lw $t0, 68($sp) sw $t0, 0($sp) # Storing internal_9 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 56($sp) # internal_10 = result of function_add + sw $v1, 64($sp) # internal_10 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Get attribute columns of self - lw $t0, 92($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t0, 100($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338381406 + beq $t6, $t5, int_get_attribute_8737379796673 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338381406 - j object_get_attribute_8768338381406 - int_get_attribute_8768338381406: + beq $t6, $t5, bool_get_attribute_8737379796673 + j object_get_attribute_8737379796673 + int_get_attribute_8737379796673: li $v0, 9 addi $a0, $zero, 12 syscall @@ -6213,9 +6789,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 40($sp) # internal_11 = self.columns - j end_get_attribute_8768338381406 - bool_get_attribute_8768338381406: + sw $v0, 48($sp) # internal_11 = self.columns + j end_get_attribute_8737379796673 + bool_get_attribute_8737379796673: li $v0, 9 addi $a0, $zero, 12 syscall @@ -6223,43 +6799,43 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 40($sp) # internal_11 = self.columns - j end_get_attribute_8768338381406 - object_get_attribute_8768338381406: - sw $t1, 40($sp) # internal_11 = columns - end_get_attribute_8768338381406: + sw $v0, 48($sp) # internal_11 = self.columns + j end_get_attribute_8737379796673 + object_get_attribute_8737379796673: + sw $t1, 48($sp) # internal_11 = self.columns + end_get_attribute_8737379796673: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_10 - lw $t0, 56($sp) + lw $t0, 64($sp) sw $t0, 4($sp) # Storing internal_10 # Argument internal_11 - lw $t0, 52($sp) + lw $t0, 60($sp) sw $t0, 0($sp) # Storing internal_11 # Calling function function_div jal function_div lw $ra, 8($sp) - sw $v1, 48($sp) # internal_12 = result of function_div + sw $v1, 56($sp) # internal_12 = result of function_div addi $sp, $sp, 12 # Freeing space for arguments # Get attribute columns of self - lw $t0, 92($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t0, 100($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338381433 + beq $t6, $t5, int_get_attribute_8737379796700 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338381433 - j object_get_attribute_8768338381433 - int_get_attribute_8768338381433: + beq $t6, $t5, bool_get_attribute_8737379796700 + j object_get_attribute_8737379796700 + int_get_attribute_8737379796700: li $v0, 9 addi $a0, $zero, 12 syscall @@ -6267,9 +6843,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 32($sp) # internal_13 = self.columns - j end_get_attribute_8768338381433 - bool_get_attribute_8768338381433: + sw $v0, 40($sp) # internal_13 = self.columns + j end_get_attribute_8737379796700 + bool_get_attribute_8737379796700: li $v0, 9 addi $a0, $zero, 12 syscall @@ -6277,28 +6853,28 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 32($sp) # internal_13 = self.columns - j end_get_attribute_8768338381433 - object_get_attribute_8768338381433: - sw $t1, 32($sp) # internal_13 = columns - end_get_attribute_8768338381433: + sw $v0, 40($sp) # internal_13 = self.columns + j end_get_attribute_8737379796700 + object_get_attribute_8737379796700: + sw $t1, 40($sp) # internal_13 = self.columns + end_get_attribute_8737379796700: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_12 - lw $t0, 48($sp) + lw $t0, 56($sp) sw $t0, 4($sp) # Storing internal_12 # Argument internal_13 - lw $t0, 44($sp) + lw $t0, 52($sp) sw $t0, 0($sp) # Storing internal_13 # Calling function function_mult jal function_mult lw $ra, 8($sp) - sw $v1, 40($sp) # internal_14 = result of function_mult + sw $v1, 48($sp) # internal_14 = result of function_mult addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -6311,24 +6887,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_15 = address of allocated object Int + sw $v0, 32($sp) # internal_15 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 100($sp) + lw $t0, 108($sp) sw $t0, 4($sp) # Storing position # Argument internal_15 - lw $t0, 36($sp) + lw $t0, 44($sp) sw $t0, 0($sp) # Storing internal_15 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 32($sp) # internal_16 = result of function_add + sw $v1, 40($sp) # internal_16 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -6336,33 +6912,33 @@ sw $ra, 8($sp) # Storing return address # Argument internal_14 - lw $t0, 40($sp) + lw $t0, 48($sp) sw $t0, 4($sp) # Storing internal_14 # Argument internal_16 - lw $t0, 32($sp) + lw $t0, 40($sp) sw $t0, 0($sp) # Storing internal_16 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 28($sp) # internal_17 = result of function_equal + sw $v1, 36($sp) # internal_17 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_8 = internal_17 - lw $t0, 16($sp) - sw $t0, 52($sp) + lw $t0, 24($sp) + sw $t0, 60($sp) - # If internal_8 then goto then_8768338407331 - lw $t0, 52($sp) # Loading the address of the condition + # If internal_8 then goto then_8737379853828 + lw $t0, 60($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338407331 + beq $t0, $t1, then_8737379853828 - # Jumping to else_8768338407331 - j else_8768338407331 + # Jumping to else_8737379853828 + j else_8737379853828 - then_8768338407331: + then_8737379853828: # Allocating String li $v0, 9 @@ -6380,16 +6956,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_18 = " " + sw $v0, 20($sp) # internal_18 = " " # internal_7 = internal_18 - lw $t0, 12($sp) - sw $t0, 56($sp) + lw $t0, 20($sp) + sw $t0, 64($sp) - # Jumping to endif_8768338407331 - j endif_8768338407331 + # Jumping to endif_8737379853828 + j endif_8737379853828 - else_8768338407331: + else_8737379853828: # Allocating Int 1 li $v0, 9 @@ -6401,78 +6977,102 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_19 = address of allocated object Int + sw $v0, 16($sp) # internal_19 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 100($sp) + lw $t0, 108($sp) sw $t0, 4($sp) # Storing position # Argument internal_19 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_19 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 16($sp) # internal_20 = result of function_add + sw $v1, 24($sp) # internal_20 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 104($sp) + # Allocating Int 15 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 15 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_22 = address of allocated object Int + + # Get method south of CellularAutomaton + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 112($sp) sw $t0, 4($sp) # Storing self # Argument internal_20 - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 0($sp) # Storing internal_20 - # Calling function function_south_at_CellularAutomaton - jal function_south_at_CellularAutomaton + # Calling function internal_23 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_21 = result of function_south_at_CellularAutomaton + sw $v1, 20($sp) # internal_21 = result of internal_23 addi $sp, $sp, 12 # Freeing space for arguments # internal_7 = internal_21 - lw $t0, 0($sp) - sw $t0, 56($sp) + lw $t0, 8($sp) + sw $t0, 64($sp) - # Jumping to endif_8768338407331 - j endif_8768338407331 + # Jumping to endif_8737379853828 + j endif_8737379853828 - endif_8768338407331: + endif_8737379853828: # internal_0 = internal_7 - lw $t0, 56($sp) - sw $t0, 84($sp) + lw $t0, 64($sp) + sw $t0, 92($sp) - # Jumping to endif_8768338407325 - j endif_8768338407325 + # Jumping to endif_8737379853562 + j endif_8737379853562 - endif_8768338407325: + endif_8737379853562: # Loading return value in $v1 - lw $v1, 84($sp) + lw $v1, 92($sp) # Freeing space for local variables - addi $sp, $sp, 88 + addi $sp, $sp, 96 jr $ra function_southwest_at_CellularAutomaton: # Function parameters - # $ra = 80($sp) - # self = 76($sp) - # position = 72($sp) + # $ra = 88($sp) + # self = 84($sp) + # position = 80($sp) # Reserving space for local variables - addi $sp, $sp, -72 + addi $sp, $sp, -80 # Allocating Bool 0 li $v0, 9 @@ -6484,21 +7084,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 64($sp) # internal_1 = address of allocated object Int + sw $v0, 72($sp) # internal_1 = address of allocated object Int # Get attribute board_size of self - lw $t0, 76($sp) # Get the address of self - lw $t1, 16($t0) # Get the attribute 'board_size' from the instance + lw $t0, 84($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'board_size' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338349219 + beq $t6, $t5, int_get_attribute_8737379797538 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338349219 - j object_get_attribute_8768338349219 - int_get_attribute_8768338349219: + beq $t6, $t5, bool_get_attribute_8737379797538 + j object_get_attribute_8737379797538 + int_get_attribute_8737379797538: li $v0, 9 addi $a0, $zero, 12 syscall @@ -6506,9 +7106,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 60($sp) # internal_2 = self.board_size - j end_get_attribute_8768338349219 - bool_get_attribute_8768338349219: + sw $v0, 68($sp) # internal_2 = self.board_size + j end_get_attribute_8737379797538 + bool_get_attribute_8737379797538: li $v0, 9 addi $a0, $zero, 12 syscall @@ -6516,25 +7116,25 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 60($sp) # internal_2 = self.board_size - j end_get_attribute_8768338349219 - object_get_attribute_8768338349219: - sw $t1, 60($sp) # internal_2 = board_size - end_get_attribute_8768338349219: + sw $v0, 68($sp) # internal_2 = self.board_size + j end_get_attribute_8737379797538 + object_get_attribute_8737379797538: + sw $t1, 68($sp) # internal_2 = self.board_size + end_get_attribute_8737379797538: # Get attribute columns of self - lw $t0, 76($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t0, 84($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338349243 + beq $t6, $t5, int_get_attribute_8737379797562 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338349243 - j object_get_attribute_8768338349243 - int_get_attribute_8768338349243: + beq $t6, $t5, bool_get_attribute_8737379797562 + j object_get_attribute_8737379797562 + int_get_attribute_8737379797562: li $v0, 9 addi $a0, $zero, 12 syscall @@ -6542,9 +7142,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 56($sp) # internal_3 = self.columns - j end_get_attribute_8768338349243 - bool_get_attribute_8768338349243: + sw $v0, 64($sp) # internal_3 = self.columns + j end_get_attribute_8737379797562 + bool_get_attribute_8737379797562: li $v0, 9 addi $a0, $zero, 12 syscall @@ -6552,28 +7152,28 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 56($sp) # internal_3 = self.columns - j end_get_attribute_8768338349243 - object_get_attribute_8768338349243: - sw $t1, 56($sp) # internal_3 = columns - end_get_attribute_8768338349243: + sw $v0, 64($sp) # internal_3 = self.columns + j end_get_attribute_8737379797562 + object_get_attribute_8737379797562: + sw $t1, 64($sp) # internal_3 = self.columns + end_get_attribute_8737379797562: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 84($sp) + lw $t0, 92($sp) sw $t0, 4($sp) # Storing position # Argument internal_3 - lw $t0, 68($sp) + lw $t0, 76($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 64($sp) # internal_4 = result of function_add + sw $v1, 72($sp) # internal_4 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -6581,33 +7181,33 @@ sw $ra, 8($sp) # Storing return address # Argument internal_2 - lw $t0, 72($sp) + lw $t0, 80($sp) sw $t0, 4($sp) # Storing internal_2 # Argument internal_4 - lw $t0, 64($sp) + lw $t0, 72($sp) sw $t0, 0($sp) # Storing internal_4 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 60($sp) # internal_5 = result of function_less_than + sw $v1, 68($sp) # internal_5 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments # internal_1 = internal_5 - lw $t0, 48($sp) - sw $t0, 64($sp) + lw $t0, 56($sp) + sw $t0, 72($sp) - # If internal_1 then goto then_8768338407705 - lw $t0, 64($sp) # Loading the address of the condition + # If internal_1 then goto then_8737379853942 + lw $t0, 72($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338407705 + beq $t0, $t1, then_8737379853942 - # Jumping to else_8768338407705 - j else_8768338407705 + # Jumping to else_8737379853942 + j else_8737379853942 - then_8768338407705: + then_8737379853942: # Allocating String li $v0, 9 @@ -6625,16 +7225,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 44($sp) # internal_6 = " " + sw $v0, 52($sp) # internal_6 = " " # internal_0 = internal_6 - lw $t0, 44($sp) - sw $t0, 68($sp) + lw $t0, 52($sp) + sw $t0, 76($sp) - # Jumping to endif_8768338407705 - j endif_8768338407705 + # Jumping to endif_8737379853942 + j endif_8737379853942 - else_8768338407705: + else_8737379853942: # Allocating Bool 0 li $v0, 9 @@ -6646,21 +7246,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_8 = address of allocated object Int + sw $v0, 44($sp) # internal_8 = address of allocated object Int # Get attribute columns of self - lw $t0, 76($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t0, 84($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338349677 + beq $t6, $t5, int_get_attribute_8737379797736 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338349677 - j object_get_attribute_8768338349677 - int_get_attribute_8768338349677: + beq $t6, $t5, bool_get_attribute_8737379797736 + j object_get_attribute_8737379797736 + int_get_attribute_8737379797736: li $v0, 9 addi $a0, $zero, 12 syscall @@ -6668,9 +7268,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 32($sp) # internal_9 = self.columns - j end_get_attribute_8768338349677 - bool_get_attribute_8768338349677: + sw $v0, 40($sp) # internal_9 = self.columns + j end_get_attribute_8737379797736 + bool_get_attribute_8737379797736: li $v0, 9 addi $a0, $zero, 12 syscall @@ -6678,43 +7278,43 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 32($sp) # internal_9 = self.columns - j end_get_attribute_8768338349677 - object_get_attribute_8768338349677: - sw $t1, 32($sp) # internal_9 = columns - end_get_attribute_8768338349677: + sw $v0, 40($sp) # internal_9 = self.columns + j end_get_attribute_8737379797736 + object_get_attribute_8737379797736: + sw $t1, 40($sp) # internal_9 = self.columns + end_get_attribute_8737379797736: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 84($sp) + lw $t0, 92($sp) sw $t0, 4($sp) # Storing position # Argument internal_9 - lw $t0, 44($sp) + lw $t0, 52($sp) sw $t0, 0($sp) # Storing internal_9 # Calling function function_div jal function_div lw $ra, 8($sp) - sw $v1, 40($sp) # internal_10 = result of function_div + sw $v1, 48($sp) # internal_10 = result of function_div addi $sp, $sp, 12 # Freeing space for arguments # Get attribute columns of self - lw $t0, 76($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'columns' from the instance + lw $t0, 84($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338349704 + beq $t6, $t5, int_get_attribute_8737379798535 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338349704 - j object_get_attribute_8768338349704 - int_get_attribute_8768338349704: + beq $t6, $t5, bool_get_attribute_8737379798535 + j object_get_attribute_8737379798535 + int_get_attribute_8737379798535: li $v0, 9 addi $a0, $zero, 12 syscall @@ -6722,9 +7322,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 24($sp) # internal_11 = self.columns - j end_get_attribute_8768338349704 - bool_get_attribute_8768338349704: + sw $v0, 32($sp) # internal_11 = self.columns + j end_get_attribute_8737379798535 + bool_get_attribute_8737379798535: li $v0, 9 addi $a0, $zero, 12 syscall @@ -6732,28 +7332,28 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 24($sp) # internal_11 = self.columns - j end_get_attribute_8768338349704 - object_get_attribute_8768338349704: - sw $t1, 24($sp) # internal_11 = columns - end_get_attribute_8768338349704: + sw $v0, 32($sp) # internal_11 = self.columns + j end_get_attribute_8737379798535 + object_get_attribute_8737379798535: + sw $t1, 32($sp) # internal_11 = self.columns + end_get_attribute_8737379798535: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_10 - lw $t0, 40($sp) + lw $t0, 48($sp) sw $t0, 4($sp) # Storing internal_10 # Argument internal_11 - lw $t0, 36($sp) + lw $t0, 44($sp) sw $t0, 0($sp) # Storing internal_11 # Calling function function_mult jal function_mult lw $ra, 8($sp) - sw $v1, 32($sp) # internal_12 = result of function_mult + sw $v1, 40($sp) # internal_12 = result of function_mult addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -6761,33 +7361,33 @@ sw $ra, 8($sp) # Storing return address # Argument internal_12 - lw $t0, 32($sp) + lw $t0, 40($sp) sw $t0, 4($sp) # Storing internal_12 # Argument position - lw $t0, 84($sp) + lw $t0, 92($sp) sw $t0, 0($sp) # Storing position # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 28($sp) # internal_13 = result of function_equal + sw $v1, 36($sp) # internal_13 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_8 = internal_13 - lw $t0, 16($sp) - sw $t0, 36($sp) + lw $t0, 24($sp) + sw $t0, 44($sp) - # If internal_8 then goto then_8768338407711 - lw $t0, 36($sp) # Loading the address of the condition + # If internal_8 then goto then_8737379853948 + lw $t0, 44($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338407711 + beq $t0, $t1, then_8737379853948 - # Jumping to else_8768338407711 - j else_8768338407711 + # Jumping to else_8737379853948 + j else_8737379853948 - then_8768338407711: + then_8737379853948: # Allocating String li $v0, 9 @@ -6805,16 +7405,16 @@ sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_14 = " " + sw $v0, 20($sp) # internal_14 = " " # internal_7 = internal_14 - lw $t0, 12($sp) - sw $t0, 40($sp) + lw $t0, 20($sp) + sw $t0, 48($sp) - # Jumping to endif_8768338407711 - j endif_8768338407711 + # Jumping to endif_8737379853948 + j endif_8737379853948 - else_8768338407711: + else_8737379853948: # Allocating Int 1 li $v0, 9 @@ -6826,78 +7426,102 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_15 = address of allocated object Int + sw $v0, 16($sp) # internal_15 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 84($sp) + lw $t0, 92($sp) sw $t0, 4($sp) # Storing position # Argument internal_15 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_15 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 16($sp) # internal_16 = result of function_sub + sw $v1, 24($sp) # internal_16 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 15 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 15 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_18 = address of allocated object Int + + # Get method south of CellularAutomaton + lw $t0, 84($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 88($sp) + lw $t0, 96($sp) sw $t0, 4($sp) # Storing self # Argument internal_16 - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 0($sp) # Storing internal_16 - # Calling function function_south_at_CellularAutomaton - jal function_south_at_CellularAutomaton + # Calling function internal_19 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_17 = result of function_south_at_CellularAutomaton + sw $v1, 20($sp) # internal_17 = result of internal_19 addi $sp, $sp, 12 # Freeing space for arguments # internal_7 = internal_17 - lw $t0, 0($sp) - sw $t0, 40($sp) + lw $t0, 8($sp) + sw $t0, 48($sp) - # Jumping to endif_8768338407711 - j endif_8768338407711 + # Jumping to endif_8737379853948 + j endif_8737379853948 - endif_8768338407711: + endif_8737379853948: # internal_0 = internal_7 - lw $t0, 40($sp) - sw $t0, 68($sp) + lw $t0, 48($sp) + sw $t0, 76($sp) - # Jumping to endif_8768338407705 - j endif_8768338407705 + # Jumping to endif_8737379853942 + j endif_8737379853942 - endif_8768338407705: + endif_8737379853942: # Loading return value in $v1 - lw $v1, 68($sp) + lw $v1, 76($sp) # Freeing space for local variables - addi $sp, $sp, 72 + addi $sp, $sp, 80 jr $ra function_neighbors_at_CellularAutomaton: # Function parameters - # $ra = 260($sp) - # self = 256($sp) - # position = 252($sp) + # $ra = 324($sp) + # self = 320($sp) + # position = 316($sp) # Reserving space for local variables - addi $sp, $sp, -252 + addi $sp, $sp, -316 # Allocating Bool 0 li $v0, 9 @@ -6909,24 +7533,48 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 244($sp) # internal_1 = address of allocated object Int + sw $v0, 308($sp) # internal_1 = address of allocated object Int + + # Allocating Int 14 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 14 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 300($sp) # internal_3 = address of allocated object Int + + # Get method north of CellularAutomaton + lw $t0, 320($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 300($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 296($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 268($sp) + lw $t0, 332($sp) sw $t0, 4($sp) # Storing self # Argument position - lw $t0, 264($sp) + lw $t0, 328($sp) sw $t0, 0($sp) # Storing position - # Calling function function_north_at_CellularAutomaton - jal function_north_at_CellularAutomaton + # Calling function internal_4 + lw $t0, 308($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 252($sp) # internal_2 = result of function_north_at_CellularAutomaton + sw $v1, 316($sp) # internal_2 = result of internal_4 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -6941,44 +7589,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 - sb $t0, 8($v0) # internal_3[0] = 'X' + sb $t0, 8($v0) # internal_5[0] = 'X' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 236($sp) # internal_3 = "X" + sw $v0, 292($sp) # internal_5 = "X" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_2 - lw $t0, 252($sp) + lw $t0, 316($sp) sw $t0, 4($sp) # Storing internal_2 - # Argument internal_3 - lw $t0, 248($sp) - sw $t0, 0($sp) # Storing internal_3 + # Argument internal_5 + lw $t0, 304($sp) + sw $t0, 0($sp) # Storing internal_5 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 244($sp) # internal_4 = result of function_equal + sw $v1, 300($sp) # internal_6 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_1 = internal_4 - lw $t0, 232($sp) - sw $t0, 244($sp) + # internal_1 = internal_6 + lw $t0, 288($sp) + sw $t0, 308($sp) - # If internal_1 then goto then_8768338407753 - lw $t0, 244($sp) # Loading the address of the condition + # If internal_1 then goto then_8737379853990 + lw $t0, 308($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338407753 + beq $t0, $t1, then_8737379853990 - # Jumping to else_8768338407753 - j else_8768338407753 + # Jumping to else_8737379853990 + j else_8737379853990 - then_8768338407753: + then_8737379853990: # Allocating Int 1 li $v0, 9 @@ -6990,16 +7638,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 228($sp) # internal_5 = address of allocated object Int + sw $v0, 284($sp) # internal_7 = address of allocated object Int - # internal_0 = internal_5 - lw $t0, 228($sp) - sw $t0, 248($sp) + # internal_0 = internal_7 + lw $t0, 284($sp) + sw $t0, 312($sp) - # Jumping to endif_8768338407753 - j endif_8768338407753 + # Jumping to endif_8737379853990 + j endif_8737379853990 - else_8768338407753: + else_8737379853990: # Allocating Int 0 li $v0, 9 @@ -7011,16 +7659,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 224($sp) # internal_6 = address of allocated object Int + sw $v0, 280($sp) # internal_8 = address of allocated object Int - # internal_0 = internal_6 - lw $t0, 224($sp) - sw $t0, 248($sp) + # internal_0 = internal_8 + lw $t0, 280($sp) + sw $t0, 312($sp) - # Jumping to endif_8768338407753 - j endif_8768338407753 + # Jumping to endif_8737379853990 + j endif_8737379853990 - endif_8768338407753: + endif_8737379853990: # Allocating Bool 0 li $v0, 9 @@ -7032,24 +7680,48 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 216($sp) # internal_8 = address of allocated object Int + sw $v0, 272($sp) # internal_10 = address of allocated object Int + + # Allocating Int 15 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 15 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 264($sp) # internal_12 = address of allocated object Int + + # Get method south of CellularAutomaton + lw $t0, 320($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 264($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 260($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 268($sp) + lw $t0, 332($sp) sw $t0, 4($sp) # Storing self # Argument position - lw $t0, 264($sp) + lw $t0, 328($sp) sw $t0, 0($sp) # Storing position - # Calling function function_south_at_CellularAutomaton - jal function_south_at_CellularAutomaton + # Calling function internal_13 + lw $t0, 272($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 224($sp) # internal_9 = result of function_south_at_CellularAutomaton + sw $v1, 280($sp) # internal_11 = result of internal_13 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -7064,44 +7736,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 - sb $t0, 8($v0) # internal_10[0] = 'X' + sb $t0, 8($v0) # internal_14[0] = 'X' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 208($sp) # internal_10 = "X" + sw $v0, 256($sp) # internal_14 = "X" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_9 - lw $t0, 224($sp) - sw $t0, 4($sp) # Storing internal_9 + # Argument internal_11 + lw $t0, 280($sp) + sw $t0, 4($sp) # Storing internal_11 - # Argument internal_10 - lw $t0, 220($sp) - sw $t0, 0($sp) # Storing internal_10 + # Argument internal_14 + lw $t0, 268($sp) + sw $t0, 0($sp) # Storing internal_14 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 216($sp) # internal_11 = result of function_equal + sw $v1, 264($sp) # internal_15 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_8 = internal_11 - lw $t0, 204($sp) - sw $t0, 216($sp) + # internal_10 = internal_15 + lw $t0, 252($sp) + sw $t0, 272($sp) - # If internal_8 then goto then_8768338407792 - lw $t0, 216($sp) # Loading the address of the condition + # If internal_10 then goto then_8737379854029 + lw $t0, 272($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338407792 + beq $t0, $t1, then_8737379854029 - # Jumping to else_8768338407792 - j else_8768338407792 + # Jumping to else_8737379854029 + j else_8737379854029 - then_8768338407792: + then_8737379854029: # Allocating Int 1 li $v0, 9 @@ -7113,16 +7785,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 200($sp) # internal_12 = address of allocated object Int + sw $v0, 248($sp) # internal_16 = address of allocated object Int - # internal_7 = internal_12 - lw $t0, 200($sp) - sw $t0, 220($sp) + # internal_9 = internal_16 + lw $t0, 248($sp) + sw $t0, 276($sp) - # Jumping to endif_8768338407792 - j endif_8768338407792 + # Jumping to endif_8737379854029 + j endif_8737379854029 - else_8768338407792: + else_8737379854029: # Allocating Int 0 li $v0, 9 @@ -7134,33 +7806,33 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 196($sp) # internal_13 = address of allocated object Int + sw $v0, 244($sp) # internal_17 = address of allocated object Int - # internal_7 = internal_13 - lw $t0, 196($sp) - sw $t0, 220($sp) + # internal_9 = internal_17 + lw $t0, 244($sp) + sw $t0, 276($sp) - # Jumping to endif_8768338407792 - j endif_8768338407792 + # Jumping to endif_8737379854029 + j endif_8737379854029 - endif_8768338407792: + endif_8737379854029: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_0 - lw $t0, 260($sp) + lw $t0, 324($sp) sw $t0, 4($sp) # Storing internal_0 - # Argument internal_7 - lw $t0, 232($sp) - sw $t0, 0($sp) # Storing internal_7 + # Argument internal_9 + lw $t0, 288($sp) + sw $t0, 0($sp) # Storing internal_9 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 204($sp) # internal_14 = result of function_add + sw $v1, 252($sp) # internal_18 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bool 0 @@ -7173,24 +7845,48 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 184($sp) # internal_16 = address of allocated object Int + sw $v0, 232($sp) # internal_20 = address of allocated object Int + + # Allocating Int 16 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 16 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 224($sp) # internal_22 = address of allocated object Int + + # Get method east of CellularAutomaton + lw $t0, 320($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 224($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 220($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 268($sp) + lw $t0, 332($sp) sw $t0, 4($sp) # Storing self # Argument position - lw $t0, 264($sp) + lw $t0, 328($sp) sw $t0, 0($sp) # Storing position - # Calling function function_east_at_CellularAutomaton - jal function_east_at_CellularAutomaton + # Calling function internal_23 + lw $t0, 232($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 192($sp) # internal_17 = result of function_east_at_CellularAutomaton + sw $v1, 240($sp) # internal_21 = result of internal_23 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -7205,44 +7901,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 - sb $t0, 8($v0) # internal_18[0] = 'X' + sb $t0, 8($v0) # internal_24[0] = 'X' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 176($sp) # internal_18 = "X" + sw $v0, 216($sp) # internal_24 = "X" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_17 - lw $t0, 192($sp) - sw $t0, 4($sp) # Storing internal_17 + # Argument internal_21 + lw $t0, 240($sp) + sw $t0, 4($sp) # Storing internal_21 - # Argument internal_18 - lw $t0, 188($sp) - sw $t0, 0($sp) # Storing internal_18 + # Argument internal_24 + lw $t0, 228($sp) + sw $t0, 0($sp) # Storing internal_24 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 184($sp) # internal_19 = result of function_equal + sw $v1, 224($sp) # internal_25 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_16 = internal_19 - lw $t0, 172($sp) - sw $t0, 184($sp) + # internal_20 = internal_25 + lw $t0, 212($sp) + sw $t0, 232($sp) - # If internal_16 then goto then_8768338407837 - lw $t0, 184($sp) # Loading the address of the condition + # If internal_20 then goto then_8737379854074 + lw $t0, 232($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338407837 + beq $t0, $t1, then_8737379854074 - # Jumping to else_8768338407837 - j else_8768338407837 + # Jumping to else_8737379854074 + j else_8737379854074 - then_8768338407837: + then_8737379854074: # Allocating Int 1 li $v0, 9 @@ -7254,16 +7950,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 168($sp) # internal_20 = address of allocated object Int + sw $v0, 208($sp) # internal_26 = address of allocated object Int - # internal_15 = internal_20 - lw $t0, 168($sp) - sw $t0, 188($sp) + # internal_19 = internal_26 + lw $t0, 208($sp) + sw $t0, 236($sp) - # Jumping to endif_8768338407837 - j endif_8768338407837 + # Jumping to endif_8737379854074 + j endif_8737379854074 - else_8768338407837: + else_8737379854074: # Allocating Int 0 li $v0, 9 @@ -7275,33 +7971,33 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 164($sp) # internal_21 = address of allocated object Int + sw $v0, 204($sp) # internal_27 = address of allocated object Int - # internal_15 = internal_21 - lw $t0, 164($sp) - sw $t0, 188($sp) + # internal_19 = internal_27 + lw $t0, 204($sp) + sw $t0, 236($sp) - # Jumping to endif_8768338407837 - j endif_8768338407837 + # Jumping to endif_8737379854074 + j endif_8737379854074 - endif_8768338407837: + endif_8737379854074: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_14 - lw $t0, 204($sp) - sw $t0, 4($sp) # Storing internal_14 - - # Argument internal_15 - lw $t0, 200($sp) - sw $t0, 0($sp) # Storing internal_15 + # Argument internal_18 + lw $t0, 252($sp) + sw $t0, 4($sp) # Storing internal_18 + + # Argument internal_19 + lw $t0, 248($sp) + sw $t0, 0($sp) # Storing internal_19 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 172($sp) # internal_22 = result of function_add + sw $v1, 212($sp) # internal_28 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bool 0 @@ -7314,24 +8010,48 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 152($sp) # internal_24 = address of allocated object Int + sw $v0, 192($sp) # internal_30 = address of allocated object Int + + # Allocating Int 17 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 17 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 184($sp) # internal_32 = address of allocated object Int + + # Get method west of CellularAutomaton + lw $t0, 320($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 184($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 180($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 268($sp) + lw $t0, 332($sp) sw $t0, 4($sp) # Storing self # Argument position - lw $t0, 264($sp) + lw $t0, 328($sp) sw $t0, 0($sp) # Storing position - # Calling function function_west_at_CellularAutomaton - jal function_west_at_CellularAutomaton + # Calling function internal_33 + lw $t0, 192($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 160($sp) # internal_25 = result of function_west_at_CellularAutomaton + sw $v1, 200($sp) # internal_31 = result of internal_33 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -7346,44 +8066,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 - sb $t0, 8($v0) # internal_26[0] = 'X' + sb $t0, 8($v0) # internal_34[0] = 'X' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 144($sp) # internal_26 = "X" + sw $v0, 176($sp) # internal_34 = "X" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_25 - lw $t0, 160($sp) - sw $t0, 4($sp) # Storing internal_25 + # Argument internal_31 + lw $t0, 200($sp) + sw $t0, 4($sp) # Storing internal_31 - # Argument internal_26 - lw $t0, 156($sp) - sw $t0, 0($sp) # Storing internal_26 + # Argument internal_34 + lw $t0, 188($sp) + sw $t0, 0($sp) # Storing internal_34 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 152($sp) # internal_27 = result of function_equal + sw $v1, 184($sp) # internal_35 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_24 = internal_27 - lw $t0, 140($sp) - sw $t0, 152($sp) + # internal_30 = internal_35 + lw $t0, 172($sp) + sw $t0, 192($sp) - # If internal_24 then goto then_8768338407882 - lw $t0, 152($sp) # Loading the address of the condition + # If internal_30 then goto then_8737379854379 + lw $t0, 192($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338407882 + beq $t0, $t1, then_8737379854379 - # Jumping to else_8768338407882 - j else_8768338407882 + # Jumping to else_8737379854379 + j else_8737379854379 - then_8768338407882: + then_8737379854379: # Allocating Int 1 li $v0, 9 @@ -7395,16 +8115,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 136($sp) # internal_28 = address of allocated object Int + sw $v0, 168($sp) # internal_36 = address of allocated object Int - # internal_23 = internal_28 - lw $t0, 136($sp) - sw $t0, 156($sp) + # internal_29 = internal_36 + lw $t0, 168($sp) + sw $t0, 196($sp) - # Jumping to endif_8768338407882 - j endif_8768338407882 + # Jumping to endif_8737379854379 + j endif_8737379854379 - else_8768338407882: + else_8737379854379: # Allocating Int 0 li $v0, 9 @@ -7416,33 +8136,33 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 132($sp) # internal_29 = address of allocated object Int + sw $v0, 164($sp) # internal_37 = address of allocated object Int - # internal_23 = internal_29 - lw $t0, 132($sp) - sw $t0, 156($sp) + # internal_29 = internal_37 + lw $t0, 164($sp) + sw $t0, 196($sp) - # Jumping to endif_8768338407882 - j endif_8768338407882 + # Jumping to endif_8737379854379 + j endif_8737379854379 - endif_8768338407882: + endif_8737379854379: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_22 - lw $t0, 172($sp) - sw $t0, 4($sp) # Storing internal_22 + # Argument internal_28 + lw $t0, 212($sp) + sw $t0, 4($sp) # Storing internal_28 - # Argument internal_23 - lw $t0, 168($sp) - sw $t0, 0($sp) # Storing internal_23 + # Argument internal_29 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_29 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 140($sp) # internal_30 = result of function_add + sw $v1, 172($sp) # internal_38 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bool 0 @@ -7455,24 +8175,48 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 120($sp) # internal_32 = address of allocated object Int + sw $v0, 152($sp) # internal_40 = address of allocated object Int + + # Allocating Int 19 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 19 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_42 = address of allocated object Int + + # Get method northeast of CellularAutomaton + lw $t0, 320($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 144($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 140($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 268($sp) + lw $t0, 332($sp) sw $t0, 4($sp) # Storing self # Argument position - lw $t0, 264($sp) + lw $t0, 328($sp) sw $t0, 0($sp) # Storing position - # Calling function function_northeast_at_CellularAutomaton - jal function_northeast_at_CellularAutomaton + # Calling function internal_43 + lw $t0, 152($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 128($sp) # internal_33 = result of function_northeast_at_CellularAutomaton + sw $v1, 160($sp) # internal_41 = result of internal_43 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -7487,44 +8231,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 - sb $t0, 8($v0) # internal_34[0] = 'X' + sb $t0, 8($v0) # internal_44[0] = 'X' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 112($sp) # internal_34 = "X" + sw $v0, 136($sp) # internal_44 = "X" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_33 - lw $t0, 128($sp) - sw $t0, 4($sp) # Storing internal_33 + # Argument internal_41 + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing internal_41 - # Argument internal_34 - lw $t0, 124($sp) - sw $t0, 0($sp) # Storing internal_34 + # Argument internal_44 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_44 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 120($sp) # internal_35 = result of function_equal + sw $v1, 144($sp) # internal_45 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_32 = internal_35 - lw $t0, 108($sp) - sw $t0, 120($sp) + # internal_40 = internal_45 + lw $t0, 132($sp) + sw $t0, 152($sp) - # If internal_32 then goto then_8768338407927 - lw $t0, 120($sp) # Loading the address of the condition + # If internal_40 then goto then_8737379854424 + lw $t0, 152($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338407927 + beq $t0, $t1, then_8737379854424 - # Jumping to else_8768338407927 - j else_8768338407927 + # Jumping to else_8737379854424 + j else_8737379854424 - then_8768338407927: + then_8737379854424: # Allocating Int 1 li $v0, 9 @@ -7536,16 +8280,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 104($sp) # internal_36 = address of allocated object Int + sw $v0, 128($sp) # internal_46 = address of allocated object Int - # internal_31 = internal_36 - lw $t0, 104($sp) - sw $t0, 124($sp) + # internal_39 = internal_46 + lw $t0, 128($sp) + sw $t0, 156($sp) - # Jumping to endif_8768338407927 - j endif_8768338407927 + # Jumping to endif_8737379854424 + j endif_8737379854424 - else_8768338407927: + else_8737379854424: # Allocating Int 0 li $v0, 9 @@ -7557,33 +8301,33 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 100($sp) # internal_37 = address of allocated object Int + sw $v0, 124($sp) # internal_47 = address of allocated object Int - # internal_31 = internal_37 - lw $t0, 100($sp) - sw $t0, 124($sp) + # internal_39 = internal_47 + lw $t0, 124($sp) + sw $t0, 156($sp) - # Jumping to endif_8768338407927 - j endif_8768338407927 + # Jumping to endif_8737379854424 + j endif_8737379854424 - endif_8768338407927: + endif_8737379854424: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_30 - lw $t0, 140($sp) - sw $t0, 4($sp) # Storing internal_30 + # Argument internal_38 + lw $t0, 172($sp) + sw $t0, 4($sp) # Storing internal_38 - # Argument internal_31 - lw $t0, 136($sp) - sw $t0, 0($sp) # Storing internal_31 + # Argument internal_39 + lw $t0, 168($sp) + sw $t0, 0($sp) # Storing internal_39 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 108($sp) # internal_38 = result of function_add + sw $v1, 132($sp) # internal_48 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bool 0 @@ -7596,24 +8340,48 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 88($sp) # internal_40 = address of allocated object Int + sw $v0, 112($sp) # internal_50 = address of allocated object Int + + # Allocating Int 18 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 18 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_52 = address of allocated object Int + + # Get method northwest of CellularAutomaton + lw $t0, 320($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 104($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 100($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 268($sp) + lw $t0, 332($sp) sw $t0, 4($sp) # Storing self # Argument position - lw $t0, 264($sp) + lw $t0, 328($sp) sw $t0, 0($sp) # Storing position - # Calling function function_northwest_at_CellularAutomaton - jal function_northwest_at_CellularAutomaton + # Calling function internal_53 + lw $t0, 112($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 96($sp) # internal_41 = result of function_northwest_at_CellularAutomaton + sw $v1, 120($sp) # internal_51 = result of internal_53 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -7628,44 +8396,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 - sb $t0, 8($v0) # internal_42[0] = 'X' + sb $t0, 8($v0) # internal_54[0] = 'X' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 80($sp) # internal_42 = "X" + sw $v0, 96($sp) # internal_54 = "X" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_41 - lw $t0, 96($sp) - sw $t0, 4($sp) # Storing internal_41 + # Argument internal_51 + lw $t0, 120($sp) + sw $t0, 4($sp) # Storing internal_51 - # Argument internal_42 - lw $t0, 92($sp) - sw $t0, 0($sp) # Storing internal_42 + # Argument internal_54 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_54 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 88($sp) # internal_43 = result of function_equal + sw $v1, 104($sp) # internal_55 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_40 = internal_43 - lw $t0, 76($sp) - sw $t0, 88($sp) + # internal_50 = internal_55 + lw $t0, 92($sp) + sw $t0, 112($sp) - # If internal_40 then goto then_8768338408232 - lw $t0, 88($sp) # Loading the address of the condition + # If internal_50 then goto then_8737379854469 + lw $t0, 112($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338408232 + beq $t0, $t1, then_8737379854469 - # Jumping to else_8768338408232 - j else_8768338408232 + # Jumping to else_8737379854469 + j else_8737379854469 - then_8768338408232: + then_8737379854469: # Allocating Int 1 li $v0, 9 @@ -7677,16 +8445,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 72($sp) # internal_44 = address of allocated object Int + sw $v0, 88($sp) # internal_56 = address of allocated object Int - # internal_39 = internal_44 - lw $t0, 72($sp) - sw $t0, 92($sp) + # internal_49 = internal_56 + lw $t0, 88($sp) + sw $t0, 116($sp) - # Jumping to endif_8768338408232 - j endif_8768338408232 + # Jumping to endif_8737379854469 + j endif_8737379854469 - else_8768338408232: + else_8737379854469: # Allocating Int 0 li $v0, 9 @@ -7698,33 +8466,33 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 68($sp) # internal_45 = address of allocated object Int + sw $v0, 84($sp) # internal_57 = address of allocated object Int - # internal_39 = internal_45 - lw $t0, 68($sp) - sw $t0, 92($sp) + # internal_49 = internal_57 + lw $t0, 84($sp) + sw $t0, 116($sp) - # Jumping to endif_8768338408232 - j endif_8768338408232 + # Jumping to endif_8737379854469 + j endif_8737379854469 - endif_8768338408232: + endif_8737379854469: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_38 - lw $t0, 108($sp) - sw $t0, 4($sp) # Storing internal_38 + # Argument internal_48 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_48 - # Argument internal_39 - lw $t0, 104($sp) - sw $t0, 0($sp) # Storing internal_39 + # Argument internal_49 + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing internal_49 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 76($sp) # internal_46 = result of function_add + sw $v1, 92($sp) # internal_58 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bool 0 @@ -7737,24 +8505,48 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 56($sp) # internal_48 = address of allocated object Int + sw $v0, 72($sp) # internal_60 = address of allocated object Int + + # Allocating Int 20 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 20 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_62 = address of allocated object Int + + # Get method southeast of CellularAutomaton + lw $t0, 320($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 64($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 60($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 268($sp) + lw $t0, 332($sp) sw $t0, 4($sp) # Storing self # Argument position - lw $t0, 264($sp) + lw $t0, 328($sp) sw $t0, 0($sp) # Storing position - # Calling function function_southeast_at_CellularAutomaton - jal function_southeast_at_CellularAutomaton + # Calling function internal_63 + lw $t0, 72($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 64($sp) # internal_49 = result of function_southeast_at_CellularAutomaton + sw $v1, 80($sp) # internal_61 = result of internal_63 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -7769,44 +8561,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 - sb $t0, 8($v0) # internal_50[0] = 'X' + sb $t0, 8($v0) # internal_64[0] = 'X' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 48($sp) # internal_50 = "X" + sw $v0, 56($sp) # internal_64 = "X" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_49 - lw $t0, 64($sp) - sw $t0, 4($sp) # Storing internal_49 + # Argument internal_61 + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing internal_61 - # Argument internal_50 - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing internal_50 + # Argument internal_64 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_64 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 56($sp) # internal_51 = result of function_equal + sw $v1, 64($sp) # internal_65 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_48 = internal_51 - lw $t0, 44($sp) - sw $t0, 56($sp) + # internal_60 = internal_65 + lw $t0, 52($sp) + sw $t0, 72($sp) - # If internal_48 then goto then_8768338408277 - lw $t0, 56($sp) # Loading the address of the condition + # If internal_60 then goto then_8737379854514 + lw $t0, 72($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338408277 + beq $t0, $t1, then_8737379854514 - # Jumping to else_8768338408277 - j else_8768338408277 + # Jumping to else_8737379854514 + j else_8737379854514 - then_8768338408277: + then_8737379854514: # Allocating Int 1 li $v0, 9 @@ -7818,16 +8610,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_52 = address of allocated object Int + sw $v0, 48($sp) # internal_66 = address of allocated object Int - # internal_47 = internal_52 - lw $t0, 40($sp) - sw $t0, 60($sp) + # internal_59 = internal_66 + lw $t0, 48($sp) + sw $t0, 76($sp) - # Jumping to endif_8768338408277 - j endif_8768338408277 + # Jumping to endif_8737379854514 + j endif_8737379854514 - else_8768338408277: + else_8737379854514: # Allocating Int 0 li $v0, 9 @@ -7839,33 +8631,33 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_53 = address of allocated object Int + sw $v0, 44($sp) # internal_67 = address of allocated object Int - # internal_47 = internal_53 - lw $t0, 36($sp) - sw $t0, 60($sp) + # internal_59 = internal_67 + lw $t0, 44($sp) + sw $t0, 76($sp) - # Jumping to endif_8768338408277 - j endif_8768338408277 + # Jumping to endif_8737379854514 + j endif_8737379854514 - endif_8768338408277: + endif_8737379854514: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_46 - lw $t0, 76($sp) - sw $t0, 4($sp) # Storing internal_46 + # Argument internal_58 + lw $t0, 92($sp) + sw $t0, 4($sp) # Storing internal_58 - # Argument internal_47 - lw $t0, 72($sp) - sw $t0, 0($sp) # Storing internal_47 + # Argument internal_59 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_59 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 44($sp) # internal_54 = result of function_add + sw $v1, 52($sp) # internal_68 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bool 0 @@ -7878,24 +8670,48 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_56 = address of allocated object Int + sw $v0, 32($sp) # internal_70 = address of allocated object Int + + # Allocating Int 21 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 21 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_72 = address of allocated object Int + + # Get method southwest of CellularAutomaton + lw $t0, 320($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 24($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 20($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 268($sp) + lw $t0, 332($sp) sw $t0, 4($sp) # Storing self # Argument position - lw $t0, 264($sp) + lw $t0, 328($sp) sw $t0, 0($sp) # Storing position - # Calling function function_southwest_at_CellularAutomaton - jal function_southwest_at_CellularAutomaton + # Calling function internal_73 + lw $t0, 32($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 32($sp) # internal_57 = result of function_southwest_at_CellularAutomaton + sw $v1, 40($sp) # internal_71 = result of internal_73 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -7910,44 +8726,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 - sb $t0, 8($v0) # internal_58[0] = 'X' + sb $t0, 8($v0) # internal_74[0] = 'X' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 16($sp) # internal_58 = "X" + sw $v0, 16($sp) # internal_74 = "X" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_57 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_57 + # Argument internal_71 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_71 - # Argument internal_58 + # Argument internal_74 lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_58 + sw $t0, 0($sp) # Storing internal_74 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 24($sp) # internal_59 = result of function_equal + sw $v1, 24($sp) # internal_75 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_56 = internal_59 + # internal_70 = internal_75 lw $t0, 12($sp) - sw $t0, 24($sp) + sw $t0, 32($sp) - # If internal_56 then goto then_8768338408322 - lw $t0, 24($sp) # Loading the address of the condition + # If internal_70 then goto then_8737379854559 + lw $t0, 32($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338408322 + beq $t0, $t1, then_8737379854559 - # Jumping to else_8768338408322 - j else_8768338408322 + # Jumping to else_8737379854559 + j else_8737379854559 - then_8768338408322: + then_8737379854559: # Allocating Int 1 li $v0, 9 @@ -7959,16 +8775,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_60 = address of allocated object Int + sw $v0, 8($sp) # internal_76 = address of allocated object Int - # internal_55 = internal_60 + # internal_69 = internal_76 lw $t0, 8($sp) - sw $t0, 28($sp) + sw $t0, 36($sp) - # Jumping to endif_8768338408322 - j endif_8768338408322 + # Jumping to endif_8737379854559 + j endif_8737379854559 - else_8768338408322: + else_8737379854559: # Allocating Int 0 li $v0, 9 @@ -7980,51 +8796,51 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_61 = address of allocated object Int + sw $v0, 4($sp) # internal_77 = address of allocated object Int - # internal_55 = internal_61 + # internal_69 = internal_77 lw $t0, 4($sp) - sw $t0, 28($sp) + sw $t0, 36($sp) - # Jumping to endif_8768338408322 - j endif_8768338408322 + # Jumping to endif_8737379854559 + j endif_8737379854559 - endif_8768338408322: + endif_8737379854559: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_54 - lw $t0, 44($sp) - sw $t0, 4($sp) # Storing internal_54 + # Argument internal_68 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_68 - # Argument internal_55 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_55 + # Argument internal_69 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_69 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 12($sp) # internal_62 = result of function_add + sw $v1, 12($sp) # internal_78 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 lw $v1, 0($sp) # Freeing space for local variables - addi $sp, $sp, 252 + addi $sp, $sp, 316 jr $ra function_cell_at_next_evolution_at_CellularAutomaton: # Function parameters - # $ra = 84($sp) - # self = 80($sp) - # position = 76($sp) + # $ra = 108($sp) + # self = 104($sp) + # position = 100($sp) # Reserving space for local variables - addi $sp, $sp, -76 + addi $sp, $sp, -100 # Allocating Bool 0 li $v0, 9 @@ -8036,24 +8852,48 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 68($sp) # internal_1 = address of allocated object Int + sw $v0, 92($sp) # internal_1 = address of allocated object Int - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + # Allocating Int 22 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 22 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_3 = address of allocated object Int + + # Get method neighbors of CellularAutomaton + lw $t0, 104($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 84($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 80($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 92($sp) + lw $t0, 116($sp) sw $t0, 4($sp) # Storing self # Argument position - lw $t0, 88($sp) + lw $t0, 112($sp) sw $t0, 0($sp) # Storing position - # Calling function function_neighbors_at_CellularAutomaton - jal function_neighbors_at_CellularAutomaton + # Calling function internal_4 + lw $t0, 92($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 76($sp) # internal_2 = result of function_neighbors_at_CellularAutomaton + sw $v1, 100($sp) # internal_2 = result of internal_4 addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 3 @@ -8066,40 +8906,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_3 = address of allocated object Int + sw $v0, 76($sp) # internal_5 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_2 - lw $t0, 76($sp) + lw $t0, 100($sp) sw $t0, 4($sp) # Storing internal_2 - # Argument internal_3 - lw $t0, 72($sp) - sw $t0, 0($sp) # Storing internal_3 + # Argument internal_5 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_5 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 68($sp) # internal_4 = result of function_equal + sw $v1, 84($sp) # internal_6 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_1 = internal_4 - lw $t0, 56($sp) - sw $t0, 68($sp) + # internal_1 = internal_6 + lw $t0, 72($sp) + sw $t0, 92($sp) - # If internal_1 then goto then_8768338408442 - lw $t0, 68($sp) # Loading the address of the condition + # If internal_1 then goto then_8737379854939 + lw $t0, 92($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338408442 + beq $t0, $t1, then_8737379854939 - # Jumping to else_8768338408442 - j else_8768338408442 + # Jumping to else_8737379854939 + j else_8737379854939 - then_8768338408442: + then_8737379854939: # Allocating String li $v0, 9 @@ -8113,20 +8953,20 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 - sb $t0, 8($v0) # internal_5[0] = 'X' + sb $t0, 8($v0) # internal_7[0] = 'X' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 52($sp) # internal_5 = "X" + sw $v0, 68($sp) # internal_7 = "X" - # internal_0 = internal_5 - lw $t0, 52($sp) - sw $t0, 72($sp) + # internal_0 = internal_7 + lw $t0, 68($sp) + sw $t0, 96($sp) - # Jumping to endif_8768338408442 - j endif_8768338408442 + # Jumping to endif_8737379854939 + j endif_8737379854939 - else_8768338408442: + else_8737379854939: # Allocating Bool 0 li $v0, 9 @@ -8138,24 +8978,48 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_7 = address of allocated object Int + sw $v0, 60($sp) # internal_9 = address of allocated object Int + + # Allocating Int 22 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 22 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_11 = address of allocated object Int + + # Get method neighbors of CellularAutomaton + lw $t0, 104($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 52($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 48($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 92($sp) + lw $t0, 116($sp) sw $t0, 4($sp) # Storing self # Argument position - lw $t0, 88($sp) + lw $t0, 112($sp) sw $t0, 0($sp) # Storing position - # Calling function function_neighbors_at_CellularAutomaton - jal function_neighbors_at_CellularAutomaton + # Calling function internal_12 + lw $t0, 60($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 52($sp) # internal_8 = result of function_neighbors_at_CellularAutomaton + sw $v1, 68($sp) # internal_10 = result of internal_12 addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 2 @@ -8168,40 +9032,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_9 = address of allocated object Int + sw $v0, 44($sp) # internal_13 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_8 - lw $t0, 52($sp) - sw $t0, 4($sp) # Storing internal_8 + # Argument internal_10 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_10 - # Argument internal_9 - lw $t0, 48($sp) - sw $t0, 0($sp) # Storing internal_9 + # Argument internal_13 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_13 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 44($sp) # internal_10 = result of function_equal + sw $v1, 52($sp) # internal_14 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_7 = internal_10 - lw $t0, 32($sp) - sw $t0, 44($sp) + # internal_9 = internal_14 + lw $t0, 40($sp) + sw $t0, 60($sp) - # If internal_7 then goto then_8768338408436 - lw $t0, 44($sp) # Loading the address of the condition + # If internal_9 then goto then_8737379854933 + lw $t0, 60($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338408436 + beq $t0, $t1, then_8737379854933 - # Jumping to else_8768338408436 - j else_8768338408436 + # Jumping to else_8737379854933 + j else_8737379854933 - then_8768338408436: + then_8737379854933: # Allocating Bool 0 li $v0, 9 @@ -8213,24 +9077,48 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_12 = address of allocated object Int + sw $v0, 32($sp) # internal_16 = address of allocated object Int + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_18 = address of allocated object Int + + # Get method cell of CellularAutomaton + lw $t0, 104($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 24($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 20($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 92($sp) + lw $t0, 116($sp) sw $t0, 4($sp) # Storing self # Argument position - lw $t0, 88($sp) + lw $t0, 112($sp) sw $t0, 0($sp) # Storing position - # Calling function function_cell_at_CellularAutomaton - jal function_cell_at_CellularAutomaton + # Calling function internal_19 + lw $t0, 32($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 32($sp) # internal_13 = result of function_cell_at_CellularAutomaton + sw $v1, 40($sp) # internal_17 = result of internal_19 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -8245,44 +9133,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 - sb $t0, 8($v0) # internal_14[0] = 'X' + sb $t0, 8($v0) # internal_20[0] = 'X' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 16($sp) # internal_14 = "X" + sw $v0, 16($sp) # internal_20 = "X" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_13 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_13 + # Argument internal_17 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_17 - # Argument internal_14 + # Argument internal_20 lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_14 + sw $t0, 0($sp) # Storing internal_20 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 24($sp) # internal_15 = result of function_equal + sw $v1, 24($sp) # internal_21 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_12 = internal_15 + # internal_16 = internal_21 lw $t0, 12($sp) - sw $t0, 24($sp) + sw $t0, 32($sp) - # If internal_12 then goto then_8768338408424 - lw $t0, 24($sp) # Loading the address of the condition + # If internal_16 then goto then_8737379854921 + lw $t0, 32($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338408424 + beq $t0, $t1, then_8737379854921 - # Jumping to else_8768338408424 - j else_8768338408424 + # Jumping to else_8737379854921 + j else_8737379854921 - then_8768338408424: + then_8737379854921: # Allocating String li $v0, 9 @@ -8296,20 +9184,20 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 - sb $t0, 8($v0) # internal_16[0] = 'X' + sb $t0, 8($v0) # internal_22[0] = 'X' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 8($sp) # internal_16 = "X" + sw $v0, 8($sp) # internal_22 = "X" - # internal_11 = internal_16 + # internal_15 = internal_22 lw $t0, 8($sp) - sw $t0, 28($sp) + sw $t0, 36($sp) - # Jumping to endif_8768338408424 - j endif_8768338408424 + # Jumping to endif_8737379854921 + j endif_8737379854921 - else_8768338408424: + else_8737379854921: # Allocating String li $v0, 9 @@ -8323,29 +9211,29 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 45 - sb $t0, 8($v0) # internal_17[0] = '-' + sb $t0, 8($v0) # internal_23[0] = '-' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_17 = "-" + sw $v0, 4($sp) # internal_23 = "-" - # internal_11 = internal_17 + # internal_15 = internal_23 lw $t0, 4($sp) - sw $t0, 28($sp) + sw $t0, 36($sp) - # Jumping to endif_8768338408424 - j endif_8768338408424 + # Jumping to endif_8737379854921 + j endif_8737379854921 - endif_8768338408424: + endif_8737379854921: - # internal_6 = internal_11 - lw $t0, 28($sp) - sw $t0, 48($sp) + # internal_8 = internal_15 + lw $t0, 36($sp) + sw $t0, 64($sp) - # Jumping to endif_8768338408436 - j endif_8768338408436 + # Jumping to endif_8737379854933 + j endif_8737379854933 - else_8768338408436: + else_8737379854933: # Allocating String li $v0, 9 @@ -8359,45 +9247,45 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 45 - sb $t0, 8($v0) # internal_18[0] = '-' + sb $t0, 8($v0) # internal_24[0] = '-' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 0($sp) # internal_18 = "-" + sw $v0, 0($sp) # internal_24 = "-" - # internal_6 = internal_18 + # internal_8 = internal_24 lw $t0, 0($sp) - sw $t0, 48($sp) + sw $t0, 64($sp) - # Jumping to endif_8768338408436 - j endif_8768338408436 + # Jumping to endif_8737379854933 + j endif_8737379854933 - endif_8768338408436: + endif_8737379854933: - # internal_0 = internal_6 - lw $t0, 48($sp) - sw $t0, 72($sp) + # internal_0 = internal_8 + lw $t0, 64($sp) + sw $t0, 96($sp) - # Jumping to endif_8768338408442 - j endif_8768338408442 + # Jumping to endif_8737379854939 + j endif_8737379854939 - endif_8768338408442: + endif_8737379854939: # Loading return value in $v1 - lw $v1, 72($sp) + lw $v1, 96($sp) # Freeing space for local variables - addi $sp, $sp, 76 + addi $sp, $sp, 100 jr $ra function_evolve_at_CellularAutomaton: # Function parameters - # $ra = 44($sp) - # self = 40($sp) + # $ra = 72($sp) + # self = 68($sp) # Reserving space for local variables - addi $sp, $sp, -40 + addi $sp, $sp, -68 # Allocating Int 0 li $v0, 9 @@ -8409,38 +9297,62 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_1 = address of allocated object Int + sw $v0, 60($sp) # internal_1 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 48($sp) + lw $t0, 76($sp) sw $t0, 4($sp) # Storing position # Argument internal_1 - lw $t0, 44($sp) + lw $t0, 72($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 48($sp) # position = result of function_assign + sw $v1, 76($sp) # position = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_4 = address of allocated object Int + + # Get method num_cells of CellularAutomaton + lw $t0, 68($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 48($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 44($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 48($sp) + lw $t0, 76($sp) sw $t0, 0($sp) # Storing self - # Calling function function_num_cells_at_CellularAutomaton - jal function_num_cells_at_CellularAutomaton + # Calling function internal_5 + lw $t0, 52($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 32($sp) # internal_3 = result of function_num_cells_at_CellularAutomaton + sw $v1, 60($sp) # internal_3 = result of internal_5 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments @@ -8448,17 +9360,17 @@ sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 40($sp) + lw $t0, 68($sp) sw $t0, 4($sp) # Storing num # Argument internal_3 - lw $t0, 36($sp) + lw $t0, 64($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 40($sp) # num = result of function_assign + sw $v1, 68($sp) # num = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -8474,73 +9386,124 @@ sb $zero, 8($v0) # Null-terminator at the end of the string - sw $v0, 20($sp) # temp = "" + sw $v0, 40($sp) # temp = "" + + # Allocating NUll to internal_7 + sw $zero, 36($sp) # internal_7 = 0 - while_start_8768338408792: + while_start_8737379855029: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 48($sp) + lw $t0, 76($sp) sw $t0, 4($sp) # Storing position # Argument num - lw $t0, 40($sp) + lw $t0, 68($sp) sw $t0, 0($sp) # Storing num # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 28($sp) # internal_5 = result of function_less_than + sw $v1, 44($sp) # internal_8 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_5 then goto while_body_8768338408792 - lw $t0, 16($sp) # Loading the address of the condition + # If internal_8 then goto while_body_8737379855029 + lw $t0, 32($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8768338408792 + beq $t0, $t1, while_body_8737379855029 + + # Jumping to while_end_8737379855029 + j while_end_8737379855029 + + while_body_8737379855029: + + # Allocating Int 23 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Jumping to while_end_8768338408792 - j while_end_8768338408792 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 23 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_10 = address of allocated object Int - while_body_8768338408792: + # Get method cell_at_next_evolution of CellularAutomaton + lw $t0, 68($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 24($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 20($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 52($sp) + lw $t0, 80($sp) sw $t0, 4($sp) # Storing self # Argument position - lw $t0, 48($sp) + lw $t0, 76($sp) sw $t0, 0($sp) # Storing position - # Calling function function_cell_at_next_evolution_at_CellularAutomaton - jal function_cell_at_next_evolution_at_CellularAutomaton + # Calling function internal_11 + lw $t0, 32($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 24($sp) # internal_6 = result of function_cell_at_next_evolution_at_CellularAutomaton + sw $v1, 40($sp) # internal_9 = result of internal_11 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_13 = address of allocated object Int + + # Get method concat of String + lw $t0, 40($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 12($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 8($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument temp - lw $t0, 32($sp) + lw $t0, 52($sp) sw $t0, 4($sp) # Storing temp - # Argument internal_6 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_6 + # Argument internal_9 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_9 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_14 + lw $t0, 20($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 20($sp) # internal_7 = result of function_concat_at_String + sw $v1, 28($sp) # internal_12 = result of internal_14 addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -8548,17 +9511,17 @@ sw $ra, 8($sp) # Storing return address # Argument temp - lw $t0, 32($sp) + lw $t0, 52($sp) sw $t0, 4($sp) # Storing temp - # Argument internal_7 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_7 + # Argument internal_12 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_12 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 32($sp) # temp = result of function_assign + sw $v1, 52($sp) # temp = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -8571,24 +9534,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_8 = address of allocated object Int + sw $v0, 4($sp) # internal_15 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 48($sp) + lw $t0, 76($sp) sw $t0, 4($sp) # Storing position - # Argument internal_8 + # Argument internal_15 lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_8 + sw $t0, 0($sp) # Storing internal_15 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 12($sp) # internal_9 = result of function_add + sw $v1, 12($sp) # internal_16 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -8596,38 +9559,38 @@ sw $ra, 8($sp) # Storing return address # Argument position - lw $t0, 48($sp) + lw $t0, 76($sp) sw $t0, 4($sp) # Storing position - # Argument internal_9 + # Argument internal_16 lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_9 + sw $t0, 0($sp) # Storing internal_16 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 48($sp) # position = result of function_assign + sw $v1, 76($sp) # position = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to while_start_8768338408792 - j while_start_8768338408792 + # Jumping to while_start_8737379855029 + j while_start_8737379855029 - while_end_8768338408792: + while_end_8737379855029: # Set attribute population_map of self - lw $t0, 40($sp) # $t0 = self - lw $t1, 20($sp) # $t1 = temp - beq $t1, $zero, object_set_attribute_8768338355706 + lw $t0, 68($sp) # $t0 = self + lw $t1, 40($sp) # $t1 = temp + beq $t1, $zero, object_set_attribute_8737379805380 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338355706 + beq $t6, $t5, int_set_attribute_8737379805380 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338355706 - j object_set_attribute_8768338355706 - int_set_attribute_8768338355706: + beq $t6, $t5, bool_set_attribute_8737379805380 + j object_set_attribute_8737379805380 + int_set_attribute_8737379805380: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8636,8 +9599,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 20($t0) # self.population_map = temp - j end_set_attribute_8768338355706 - bool_set_attribute_8768338355706: + j end_set_attribute_8737379805380 + bool_set_attribute_8737379805380: li $v0, 9 addi $a0, $zero, 12 syscall @@ -8646,26 +9609,26 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 20($t0) # self.population_map = temp - j end_set_attribute_8768338355706 - object_set_attribute_8768338355706: + j end_set_attribute_8737379805380 + object_set_attribute_8737379805380: sw $t1, 20($t0) # self.population_map = temp - end_set_attribute_8768338355706: + end_set_attribute_8737379805380: # Loading return value in $v1 - lw $v1, 40($sp) + lw $v1, 68($sp) # Freeing space for local variables - addi $sp, $sp, 40 + addi $sp, $sp, 68 jr $ra function_option_at_CellularAutomaton: # Function parameters - # $ra = 628($sp) - # self = 624($sp) + # $ra = 828($sp) + # self = 824($sp) # Reserving space for local variables - addi $sp, $sp, -624 + addi $sp, $sp, -824 # Allocating Int 0 li $v0, 9 @@ -8677,7 +9640,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 620($sp) # num = address of allocated object Int + sw $v0, 820($sp) # num = address of allocated object Int # Allocating String li $v0, 9 @@ -8764,24 +9727,48 @@ sb $zero, 32($v0) # Null-terminator at the end of the string - sw $v0, 616($sp) # internal_1 = "\nPlease chose a number:\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address - - # Argument self - lw $t0, 636($sp) - sw $t0, 4($sp) # Storing self + sw $v0, 816($sp) # internal_1 = "\nPlease chose a number:\n" - # Argument internal_1 - lw $t0, 628($sp) - sw $t0, 0($sp) # Storing internal_1 + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 808($sp) # internal_3 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 808($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 804($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 836($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_1 + lw $t0, 828($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function internal_4 + lw $t0, 816($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 624($sp) # internal_2 = result of function_out_string_at_IO + sw $v1, 824($sp) # internal_2 = result of internal_4 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -8796,61 +9783,85 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_3[0] = '\t' + sb $t0, 8($v0) # internal_5[0] = '\t' addi $t0, $zero, 49 - sb $t0, 9($v0) # internal_3[1] = '1' + sb $t0, 9($v0) # internal_5[1] = '1' addi $t0, $zero, 58 - sb $t0, 10($v0) # internal_3[2] = ':' + sb $t0, 10($v0) # internal_5[2] = ':' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_3[3] = ' ' + sb $t0, 11($v0) # internal_5[3] = ' ' addi $t0, $zero, 65 - sb $t0, 12($v0) # internal_3[4] = 'A' + sb $t0, 12($v0) # internal_5[4] = 'A' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_3[5] = ' ' + sb $t0, 13($v0) # internal_5[5] = ' ' addi $t0, $zero, 99 - sb $t0, 14($v0) # internal_3[6] = 'c' + sb $t0, 14($v0) # internal_5[6] = 'c' addi $t0, $zero, 114 - sb $t0, 15($v0) # internal_3[7] = 'r' + sb $t0, 15($v0) # internal_5[7] = 'r' addi $t0, $zero, 111 - sb $t0, 16($v0) # internal_3[8] = 'o' + sb $t0, 16($v0) # internal_5[8] = 'o' addi $t0, $zero, 115 - sb $t0, 17($v0) # internal_3[9] = 's' + sb $t0, 17($v0) # internal_5[9] = 's' addi $t0, $zero, 115 - sb $t0, 18($v0) # internal_3[10] = 's' + sb $t0, 18($v0) # internal_5[10] = 's' addi $t0, $zero, 10 - sb $t0, 19($v0) # internal_3[11] = '\n' + sb $t0, 19($v0) # internal_5[11] = '\n' sb $zero, 20($v0) # Null-terminator at the end of the string - sw $v0, 608($sp) # internal_3 = "\t1: A cross\n" + sw $v0, 800($sp) # internal_5 = "\t1: A cross\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 792($sp) # internal_7 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 792($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 788($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 636($sp) + lw $t0, 836($sp) sw $t0, 4($sp) # Storing self - # Argument internal_3 - lw $t0, 620($sp) - sw $t0, 0($sp) # Storing internal_3 + # Argument internal_5 + lw $t0, 812($sp) + sw $t0, 0($sp) # Storing internal_5 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_8 + lw $t0, 800($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 616($sp) # internal_4 = result of function_out_string_at_IO + sw $v1, 808($sp) # internal_6 = result of internal_8 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -8865,166 +9876,190 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_5[0] = '\t' + sb $t0, 8($v0) # internal_9[0] = '\t' addi $t0, $zero, 50 - sb $t0, 9($v0) # internal_5[1] = '2' + sb $t0, 9($v0) # internal_9[1] = '2' addi $t0, $zero, 58 - sb $t0, 10($v0) # internal_5[2] = ':' + sb $t0, 10($v0) # internal_9[2] = ':' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_5[3] = ' ' + sb $t0, 11($v0) # internal_9[3] = ' ' addi $t0, $zero, 65 - sb $t0, 12($v0) # internal_5[4] = 'A' + sb $t0, 12($v0) # internal_9[4] = 'A' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_5[5] = ' ' + sb $t0, 13($v0) # internal_9[5] = ' ' addi $t0, $zero, 115 - sb $t0, 14($v0) # internal_5[6] = 's' + sb $t0, 14($v0) # internal_9[6] = 's' addi $t0, $zero, 108 - sb $t0, 15($v0) # internal_5[7] = 'l' + sb $t0, 15($v0) # internal_9[7] = 'l' addi $t0, $zero, 97 - sb $t0, 16($v0) # internal_5[8] = 'a' + sb $t0, 16($v0) # internal_9[8] = 'a' addi $t0, $zero, 115 - sb $t0, 17($v0) # internal_5[9] = 's' + sb $t0, 17($v0) # internal_9[9] = 's' addi $t0, $zero, 104 - sb $t0, 18($v0) # internal_5[10] = 'h' + sb $t0, 18($v0) # internal_9[10] = 'h' addi $t0, $zero, 32 - sb $t0, 19($v0) # internal_5[11] = ' ' + sb $t0, 19($v0) # internal_9[11] = ' ' addi $t0, $zero, 102 - sb $t0, 20($v0) # internal_5[12] = 'f' + sb $t0, 20($v0) # internal_9[12] = 'f' addi $t0, $zero, 114 - sb $t0, 21($v0) # internal_5[13] = 'r' + sb $t0, 21($v0) # internal_9[13] = 'r' addi $t0, $zero, 111 - sb $t0, 22($v0) # internal_5[14] = 'o' + sb $t0, 22($v0) # internal_9[14] = 'o' addi $t0, $zero, 109 - sb $t0, 23($v0) # internal_5[15] = 'm' + sb $t0, 23($v0) # internal_9[15] = 'm' addi $t0, $zero, 32 - sb $t0, 24($v0) # internal_5[16] = ' ' + sb $t0, 24($v0) # internal_9[16] = ' ' addi $t0, $zero, 116 - sb $t0, 25($v0) # internal_5[17] = 't' + sb $t0, 25($v0) # internal_9[17] = 't' addi $t0, $zero, 104 - sb $t0, 26($v0) # internal_5[18] = 'h' + sb $t0, 26($v0) # internal_9[18] = 'h' addi $t0, $zero, 101 - sb $t0, 27($v0) # internal_5[19] = 'e' + sb $t0, 27($v0) # internal_9[19] = 'e' addi $t0, $zero, 32 - sb $t0, 28($v0) # internal_5[20] = ' ' + sb $t0, 28($v0) # internal_9[20] = ' ' addi $t0, $zero, 117 - sb $t0, 29($v0) # internal_5[21] = 'u' + sb $t0, 29($v0) # internal_9[21] = 'u' addi $t0, $zero, 112 - sb $t0, 30($v0) # internal_5[22] = 'p' + sb $t0, 30($v0) # internal_9[22] = 'p' addi $t0, $zero, 112 - sb $t0, 31($v0) # internal_5[23] = 'p' + sb $t0, 31($v0) # internal_9[23] = 'p' addi $t0, $zero, 101 - sb $t0, 32($v0) # internal_5[24] = 'e' + sb $t0, 32($v0) # internal_9[24] = 'e' addi $t0, $zero, 114 - sb $t0, 33($v0) # internal_5[25] = 'r' + sb $t0, 33($v0) # internal_9[25] = 'r' addi $t0, $zero, 32 - sb $t0, 34($v0) # internal_5[26] = ' ' + sb $t0, 34($v0) # internal_9[26] = ' ' addi $t0, $zero, 108 - sb $t0, 35($v0) # internal_5[27] = 'l' + sb $t0, 35($v0) # internal_9[27] = 'l' addi $t0, $zero, 101 - sb $t0, 36($v0) # internal_5[28] = 'e' + sb $t0, 36($v0) # internal_9[28] = 'e' addi $t0, $zero, 102 - sb $t0, 37($v0) # internal_5[29] = 'f' + sb $t0, 37($v0) # internal_9[29] = 'f' addi $t0, $zero, 116 - sb $t0, 38($v0) # internal_5[30] = 't' + sb $t0, 38($v0) # internal_9[30] = 't' addi $t0, $zero, 32 - sb $t0, 39($v0) # internal_5[31] = ' ' + sb $t0, 39($v0) # internal_9[31] = ' ' addi $t0, $zero, 116 - sb $t0, 40($v0) # internal_5[32] = 't' + sb $t0, 40($v0) # internal_9[32] = 't' addi $t0, $zero, 111 - sb $t0, 41($v0) # internal_5[33] = 'o' + sb $t0, 41($v0) # internal_9[33] = 'o' addi $t0, $zero, 32 - sb $t0, 42($v0) # internal_5[34] = ' ' + sb $t0, 42($v0) # internal_9[34] = ' ' addi $t0, $zero, 108 - sb $t0, 43($v0) # internal_5[35] = 'l' + sb $t0, 43($v0) # internal_9[35] = 'l' addi $t0, $zero, 111 - sb $t0, 44($v0) # internal_5[36] = 'o' + sb $t0, 44($v0) # internal_9[36] = 'o' addi $t0, $zero, 119 - sb $t0, 45($v0) # internal_5[37] = 'w' + sb $t0, 45($v0) # internal_9[37] = 'w' addi $t0, $zero, 101 - sb $t0, 46($v0) # internal_5[38] = 'e' + sb $t0, 46($v0) # internal_9[38] = 'e' addi $t0, $zero, 114 - sb $t0, 47($v0) # internal_5[39] = 'r' + sb $t0, 47($v0) # internal_9[39] = 'r' addi $t0, $zero, 32 - sb $t0, 48($v0) # internal_5[40] = ' ' + sb $t0, 48($v0) # internal_9[40] = ' ' addi $t0, $zero, 114 - sb $t0, 49($v0) # internal_5[41] = 'r' + sb $t0, 49($v0) # internal_9[41] = 'r' addi $t0, $zero, 105 - sb $t0, 50($v0) # internal_5[42] = 'i' + sb $t0, 50($v0) # internal_9[42] = 'i' addi $t0, $zero, 103 - sb $t0, 51($v0) # internal_5[43] = 'g' + sb $t0, 51($v0) # internal_9[43] = 'g' addi $t0, $zero, 104 - sb $t0, 52($v0) # internal_5[44] = 'h' + sb $t0, 52($v0) # internal_9[44] = 'h' addi $t0, $zero, 116 - sb $t0, 53($v0) # internal_5[45] = 't' + sb $t0, 53($v0) # internal_9[45] = 't' addi $t0, $zero, 10 - sb $t0, 54($v0) # internal_5[46] = '\n' + sb $t0, 54($v0) # internal_9[46] = '\n' sb $zero, 55($v0) # Null-terminator at the end of the string - sw $v0, 600($sp) # internal_5 = "\t2: A slash from the upper left to lower right\n" + sw $v0, 784($sp) # internal_9 = "\t2: A slash from the upper left to lower right\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 776($sp) # internal_11 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 776($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 772($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 636($sp) + lw $t0, 836($sp) sw $t0, 4($sp) # Storing self - # Argument internal_5 - lw $t0, 612($sp) - sw $t0, 0($sp) # Storing internal_5 + # Argument internal_9 + lw $t0, 796($sp) + sw $t0, 0($sp) # Storing internal_9 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_12 + lw $t0, 784($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 608($sp) # internal_6 = result of function_out_string_at_IO + sw $v1, 792($sp) # internal_10 = result of internal_12 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -9039,166 +10074,190 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_7[0] = '\t' + sb $t0, 8($v0) # internal_13[0] = '\t' addi $t0, $zero, 51 - sb $t0, 9($v0) # internal_7[1] = '3' + sb $t0, 9($v0) # internal_13[1] = '3' addi $t0, $zero, 58 - sb $t0, 10($v0) # internal_7[2] = ':' + sb $t0, 10($v0) # internal_13[2] = ':' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_7[3] = ' ' + sb $t0, 11($v0) # internal_13[3] = ' ' addi $t0, $zero, 65 - sb $t0, 12($v0) # internal_7[4] = 'A' + sb $t0, 12($v0) # internal_13[4] = 'A' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_7[5] = ' ' + sb $t0, 13($v0) # internal_13[5] = ' ' addi $t0, $zero, 115 - sb $t0, 14($v0) # internal_7[6] = 's' + sb $t0, 14($v0) # internal_13[6] = 's' addi $t0, $zero, 108 - sb $t0, 15($v0) # internal_7[7] = 'l' + sb $t0, 15($v0) # internal_13[7] = 'l' addi $t0, $zero, 97 - sb $t0, 16($v0) # internal_7[8] = 'a' + sb $t0, 16($v0) # internal_13[8] = 'a' addi $t0, $zero, 115 - sb $t0, 17($v0) # internal_7[9] = 's' + sb $t0, 17($v0) # internal_13[9] = 's' addi $t0, $zero, 104 - sb $t0, 18($v0) # internal_7[10] = 'h' + sb $t0, 18($v0) # internal_13[10] = 'h' addi $t0, $zero, 32 - sb $t0, 19($v0) # internal_7[11] = ' ' + sb $t0, 19($v0) # internal_13[11] = ' ' addi $t0, $zero, 102 - sb $t0, 20($v0) # internal_7[12] = 'f' + sb $t0, 20($v0) # internal_13[12] = 'f' addi $t0, $zero, 114 - sb $t0, 21($v0) # internal_7[13] = 'r' + sb $t0, 21($v0) # internal_13[13] = 'r' addi $t0, $zero, 111 - sb $t0, 22($v0) # internal_7[14] = 'o' + sb $t0, 22($v0) # internal_13[14] = 'o' addi $t0, $zero, 109 - sb $t0, 23($v0) # internal_7[15] = 'm' + sb $t0, 23($v0) # internal_13[15] = 'm' addi $t0, $zero, 32 - sb $t0, 24($v0) # internal_7[16] = ' ' + sb $t0, 24($v0) # internal_13[16] = ' ' addi $t0, $zero, 116 - sb $t0, 25($v0) # internal_7[17] = 't' + sb $t0, 25($v0) # internal_13[17] = 't' addi $t0, $zero, 104 - sb $t0, 26($v0) # internal_7[18] = 'h' + sb $t0, 26($v0) # internal_13[18] = 'h' addi $t0, $zero, 101 - sb $t0, 27($v0) # internal_7[19] = 'e' + sb $t0, 27($v0) # internal_13[19] = 'e' addi $t0, $zero, 32 - sb $t0, 28($v0) # internal_7[20] = ' ' + sb $t0, 28($v0) # internal_13[20] = ' ' addi $t0, $zero, 117 - sb $t0, 29($v0) # internal_7[21] = 'u' + sb $t0, 29($v0) # internal_13[21] = 'u' addi $t0, $zero, 112 - sb $t0, 30($v0) # internal_7[22] = 'p' + sb $t0, 30($v0) # internal_13[22] = 'p' addi $t0, $zero, 112 - sb $t0, 31($v0) # internal_7[23] = 'p' + sb $t0, 31($v0) # internal_13[23] = 'p' addi $t0, $zero, 101 - sb $t0, 32($v0) # internal_7[24] = 'e' + sb $t0, 32($v0) # internal_13[24] = 'e' addi $t0, $zero, 114 - sb $t0, 33($v0) # internal_7[25] = 'r' + sb $t0, 33($v0) # internal_13[25] = 'r' addi $t0, $zero, 32 - sb $t0, 34($v0) # internal_7[26] = ' ' + sb $t0, 34($v0) # internal_13[26] = ' ' addi $t0, $zero, 114 - sb $t0, 35($v0) # internal_7[27] = 'r' + sb $t0, 35($v0) # internal_13[27] = 'r' addi $t0, $zero, 105 - sb $t0, 36($v0) # internal_7[28] = 'i' + sb $t0, 36($v0) # internal_13[28] = 'i' addi $t0, $zero, 103 - sb $t0, 37($v0) # internal_7[29] = 'g' + sb $t0, 37($v0) # internal_13[29] = 'g' addi $t0, $zero, 104 - sb $t0, 38($v0) # internal_7[30] = 'h' + sb $t0, 38($v0) # internal_13[30] = 'h' addi $t0, $zero, 116 - sb $t0, 39($v0) # internal_7[31] = 't' + sb $t0, 39($v0) # internal_13[31] = 't' addi $t0, $zero, 32 - sb $t0, 40($v0) # internal_7[32] = ' ' + sb $t0, 40($v0) # internal_13[32] = ' ' addi $t0, $zero, 116 - sb $t0, 41($v0) # internal_7[33] = 't' + sb $t0, 41($v0) # internal_13[33] = 't' addi $t0, $zero, 111 - sb $t0, 42($v0) # internal_7[34] = 'o' + sb $t0, 42($v0) # internal_13[34] = 'o' addi $t0, $zero, 32 - sb $t0, 43($v0) # internal_7[35] = ' ' + sb $t0, 43($v0) # internal_13[35] = ' ' addi $t0, $zero, 108 - sb $t0, 44($v0) # internal_7[36] = 'l' + sb $t0, 44($v0) # internal_13[36] = 'l' addi $t0, $zero, 111 - sb $t0, 45($v0) # internal_7[37] = 'o' + sb $t0, 45($v0) # internal_13[37] = 'o' addi $t0, $zero, 119 - sb $t0, 46($v0) # internal_7[38] = 'w' + sb $t0, 46($v0) # internal_13[38] = 'w' addi $t0, $zero, 101 - sb $t0, 47($v0) # internal_7[39] = 'e' + sb $t0, 47($v0) # internal_13[39] = 'e' addi $t0, $zero, 114 - sb $t0, 48($v0) # internal_7[40] = 'r' + sb $t0, 48($v0) # internal_13[40] = 'r' addi $t0, $zero, 32 - sb $t0, 49($v0) # internal_7[41] = ' ' + sb $t0, 49($v0) # internal_13[41] = ' ' addi $t0, $zero, 108 - sb $t0, 50($v0) # internal_7[42] = 'l' + sb $t0, 50($v0) # internal_13[42] = 'l' addi $t0, $zero, 101 - sb $t0, 51($v0) # internal_7[43] = 'e' + sb $t0, 51($v0) # internal_13[43] = 'e' addi $t0, $zero, 102 - sb $t0, 52($v0) # internal_7[44] = 'f' + sb $t0, 52($v0) # internal_13[44] = 'f' addi $t0, $zero, 116 - sb $t0, 53($v0) # internal_7[45] = 't' + sb $t0, 53($v0) # internal_13[45] = 't' addi $t0, $zero, 10 - sb $t0, 54($v0) # internal_7[46] = '\n' + sb $t0, 54($v0) # internal_13[46] = '\n' sb $zero, 55($v0) # Null-terminator at the end of the string - sw $v0, 592($sp) # internal_7 = "\t3: A slash from the upper right to lower left\n" + sw $v0, 768($sp) # internal_13 = "\t3: A slash from the upper right to lower left\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 760($sp) # internal_15 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 760($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 756($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 636($sp) + lw $t0, 836($sp) sw $t0, 4($sp) # Storing self - # Argument internal_7 - lw $t0, 604($sp) - sw $t0, 0($sp) # Storing internal_7 + # Argument internal_13 + lw $t0, 780($sp) + sw $t0, 0($sp) # Storing internal_13 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_16 + lw $t0, 768($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 600($sp) # internal_8 = result of function_out_string_at_IO + sw $v1, 776($sp) # internal_14 = result of internal_16 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -9213,52 +10272,76 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_9[0] = '\t' + sb $t0, 8($v0) # internal_17[0] = '\t' addi $t0, $zero, 52 - sb $t0, 9($v0) # internal_9[1] = '4' + sb $t0, 9($v0) # internal_17[1] = '4' addi $t0, $zero, 58 - sb $t0, 10($v0) # internal_9[2] = ':' + sb $t0, 10($v0) # internal_17[2] = ':' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_9[3] = ' ' + sb $t0, 11($v0) # internal_17[3] = ' ' addi $t0, $zero, 65 - sb $t0, 12($v0) # internal_9[4] = 'A' + sb $t0, 12($v0) # internal_17[4] = 'A' addi $t0, $zero, 110 - sb $t0, 13($v0) # internal_9[5] = 'n' + sb $t0, 13($v0) # internal_17[5] = 'n' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_9[6] = ' ' + sb $t0, 14($v0) # internal_17[6] = ' ' addi $t0, $zero, 88 - sb $t0, 15($v0) # internal_9[7] = 'X' + sb $t0, 15($v0) # internal_17[7] = 'X' addi $t0, $zero, 10 - sb $t0, 16($v0) # internal_9[8] = '\n' + sb $t0, 16($v0) # internal_17[8] = '\n' sb $zero, 17($v0) # Null-terminator at the end of the string - sw $v0, 584($sp) # internal_9 = "\t4: An X\n" + sw $v0, 752($sp) # internal_17 = "\t4: An X\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 744($sp) # internal_19 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 744($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 740($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 636($sp) + lw $t0, 836($sp) sw $t0, 4($sp) # Storing self - # Argument internal_9 - lw $t0, 596($sp) - sw $t0, 0($sp) # Storing internal_9 + # Argument internal_17 + lw $t0, 764($sp) + sw $t0, 0($sp) # Storing internal_17 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_20 + lw $t0, 752($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 592($sp) # internal_10 = result of function_out_string_at_IO + sw $v1, 760($sp) # internal_18 = result of internal_20 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -9273,100 +10356,124 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_11[0] = '\t' + sb $t0, 8($v0) # internal_21[0] = '\t' addi $t0, $zero, 53 - sb $t0, 9($v0) # internal_11[1] = '5' + sb $t0, 9($v0) # internal_21[1] = '5' addi $t0, $zero, 58 - sb $t0, 10($v0) # internal_11[2] = ':' + sb $t0, 10($v0) # internal_21[2] = ':' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_11[3] = ' ' + sb $t0, 11($v0) # internal_21[3] = ' ' addi $t0, $zero, 65 - sb $t0, 12($v0) # internal_11[4] = 'A' + sb $t0, 12($v0) # internal_21[4] = 'A' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_11[5] = ' ' + sb $t0, 13($v0) # internal_21[5] = ' ' addi $t0, $zero, 103 - sb $t0, 14($v0) # internal_11[6] = 'g' + sb $t0, 14($v0) # internal_21[6] = 'g' addi $t0, $zero, 114 - sb $t0, 15($v0) # internal_11[7] = 'r' + sb $t0, 15($v0) # internal_21[7] = 'r' addi $t0, $zero, 101 - sb $t0, 16($v0) # internal_11[8] = 'e' + sb $t0, 16($v0) # internal_21[8] = 'e' addi $t0, $zero, 97 - sb $t0, 17($v0) # internal_11[9] = 'a' + sb $t0, 17($v0) # internal_21[9] = 'a' addi $t0, $zero, 116 - sb $t0, 18($v0) # internal_11[10] = 't' + sb $t0, 18($v0) # internal_21[10] = 't' addi $t0, $zero, 101 - sb $t0, 19($v0) # internal_11[11] = 'e' + sb $t0, 19($v0) # internal_21[11] = 'e' addi $t0, $zero, 114 - sb $t0, 20($v0) # internal_11[12] = 'r' + sb $t0, 20($v0) # internal_21[12] = 'r' addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_11[13] = ' ' + sb $t0, 21($v0) # internal_21[13] = ' ' addi $t0, $zero, 116 - sb $t0, 22($v0) # internal_11[14] = 't' + sb $t0, 22($v0) # internal_21[14] = 't' addi $t0, $zero, 104 - sb $t0, 23($v0) # internal_11[15] = 'h' + sb $t0, 23($v0) # internal_21[15] = 'h' addi $t0, $zero, 97 - sb $t0, 24($v0) # internal_11[16] = 'a' + sb $t0, 24($v0) # internal_21[16] = 'a' addi $t0, $zero, 110 - sb $t0, 25($v0) # internal_11[17] = 'n' + sb $t0, 25($v0) # internal_21[17] = 'n' addi $t0, $zero, 32 - sb $t0, 26($v0) # internal_11[18] = ' ' + sb $t0, 26($v0) # internal_21[18] = ' ' addi $t0, $zero, 115 - sb $t0, 27($v0) # internal_11[19] = 's' + sb $t0, 27($v0) # internal_21[19] = 's' addi $t0, $zero, 105 - sb $t0, 28($v0) # internal_11[20] = 'i' + sb $t0, 28($v0) # internal_21[20] = 'i' addi $t0, $zero, 103 - sb $t0, 29($v0) # internal_11[21] = 'g' + sb $t0, 29($v0) # internal_21[21] = 'g' addi $t0, $zero, 110 - sb $t0, 30($v0) # internal_11[22] = 'n' + sb $t0, 30($v0) # internal_21[22] = 'n' addi $t0, $zero, 32 - sb $t0, 31($v0) # internal_11[23] = ' ' + sb $t0, 31($v0) # internal_21[23] = ' ' addi $t0, $zero, 10 - sb $t0, 32($v0) # internal_11[24] = '\n' + sb $t0, 32($v0) # internal_21[24] = '\n' sb $zero, 33($v0) # Null-terminator at the end of the string - sw $v0, 576($sp) # internal_11 = "\t5: A greater than sign \n" + sw $v0, 736($sp) # internal_21 = "\t5: A greater than sign \n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 728($sp) # internal_23 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 728($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 724($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 636($sp) + lw $t0, 836($sp) sw $t0, 4($sp) # Storing self - # Argument internal_11 - lw $t0, 588($sp) - sw $t0, 0($sp) # Storing internal_11 + # Argument internal_21 + lw $t0, 748($sp) + sw $t0, 0($sp) # Storing internal_21 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_24 + lw $t0, 736($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 584($sp) # internal_12 = result of function_out_string_at_IO + sw $v1, 744($sp) # internal_22 = result of internal_24 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -9381,88 +10488,112 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_13[0] = '\t' + sb $t0, 8($v0) # internal_25[0] = '\t' addi $t0, $zero, 54 - sb $t0, 9($v0) # internal_13[1] = '6' + sb $t0, 9($v0) # internal_25[1] = '6' addi $t0, $zero, 58 - sb $t0, 10($v0) # internal_13[2] = ':' + sb $t0, 10($v0) # internal_25[2] = ':' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_13[3] = ' ' + sb $t0, 11($v0) # internal_25[3] = ' ' addi $t0, $zero, 65 - sb $t0, 12($v0) # internal_13[4] = 'A' + sb $t0, 12($v0) # internal_25[4] = 'A' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_13[5] = ' ' + sb $t0, 13($v0) # internal_25[5] = ' ' addi $t0, $zero, 108 - sb $t0, 14($v0) # internal_13[6] = 'l' + sb $t0, 14($v0) # internal_25[6] = 'l' addi $t0, $zero, 101 - sb $t0, 15($v0) # internal_13[7] = 'e' + sb $t0, 15($v0) # internal_25[7] = 'e' addi $t0, $zero, 115 - sb $t0, 16($v0) # internal_13[8] = 's' + sb $t0, 16($v0) # internal_25[8] = 's' addi $t0, $zero, 115 - sb $t0, 17($v0) # internal_13[9] = 's' + sb $t0, 17($v0) # internal_25[9] = 's' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_13[10] = ' ' + sb $t0, 18($v0) # internal_25[10] = ' ' addi $t0, $zero, 116 - sb $t0, 19($v0) # internal_13[11] = 't' + sb $t0, 19($v0) # internal_25[11] = 't' addi $t0, $zero, 104 - sb $t0, 20($v0) # internal_13[12] = 'h' + sb $t0, 20($v0) # internal_25[12] = 'h' addi $t0, $zero, 97 - sb $t0, 21($v0) # internal_13[13] = 'a' + sb $t0, 21($v0) # internal_25[13] = 'a' addi $t0, $zero, 110 - sb $t0, 22($v0) # internal_13[14] = 'n' + sb $t0, 22($v0) # internal_25[14] = 'n' addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_13[15] = ' ' + sb $t0, 23($v0) # internal_25[15] = ' ' addi $t0, $zero, 115 - sb $t0, 24($v0) # internal_13[16] = 's' + sb $t0, 24($v0) # internal_25[16] = 's' addi $t0, $zero, 105 - sb $t0, 25($v0) # internal_13[17] = 'i' + sb $t0, 25($v0) # internal_25[17] = 'i' addi $t0, $zero, 103 - sb $t0, 26($v0) # internal_13[18] = 'g' + sb $t0, 26($v0) # internal_25[18] = 'g' addi $t0, $zero, 110 - sb $t0, 27($v0) # internal_13[19] = 'n' + sb $t0, 27($v0) # internal_25[19] = 'n' addi $t0, $zero, 10 - sb $t0, 28($v0) # internal_13[20] = '\n' + sb $t0, 28($v0) # internal_25[20] = '\n' sb $zero, 29($v0) # Null-terminator at the end of the string - sw $v0, 568($sp) # internal_13 = "\t6: A less than sign\n" + sw $v0, 720($sp) # internal_25 = "\t6: A less than sign\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 712($sp) # internal_27 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 712($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 708($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 636($sp) + lw $t0, 836($sp) sw $t0, 4($sp) # Storing self - # Argument internal_13 - lw $t0, 580($sp) - sw $t0, 0($sp) # Storing internal_13 + # Argument internal_25 + lw $t0, 732($sp) + sw $t0, 0($sp) # Storing internal_25 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_28 + lw $t0, 720($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 576($sp) # internal_14 = result of function_out_string_at_IO + sw $v1, 728($sp) # internal_26 = result of internal_28 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -9477,106 +10608,130 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_15[0] = '\t' + sb $t0, 8($v0) # internal_29[0] = '\t' addi $t0, $zero, 55 - sb $t0, 9($v0) # internal_15[1] = '7' + sb $t0, 9($v0) # internal_29[1] = '7' addi $t0, $zero, 58 - sb $t0, 10($v0) # internal_15[2] = ':' + sb $t0, 10($v0) # internal_29[2] = ':' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_15[3] = ' ' + sb $t0, 11($v0) # internal_29[3] = ' ' addi $t0, $zero, 84 - sb $t0, 12($v0) # internal_15[4] = 'T' + sb $t0, 12($v0) # internal_29[4] = 'T' addi $t0, $zero, 119 - sb $t0, 13($v0) # internal_15[5] = 'w' + sb $t0, 13($v0) # internal_29[5] = 'w' addi $t0, $zero, 111 - sb $t0, 14($v0) # internal_15[6] = 'o' + sb $t0, 14($v0) # internal_29[6] = 'o' addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_15[7] = ' ' + sb $t0, 15($v0) # internal_29[7] = ' ' addi $t0, $zero, 103 - sb $t0, 16($v0) # internal_15[8] = 'g' + sb $t0, 16($v0) # internal_29[8] = 'g' addi $t0, $zero, 114 - sb $t0, 17($v0) # internal_15[9] = 'r' + sb $t0, 17($v0) # internal_29[9] = 'r' addi $t0, $zero, 101 - sb $t0, 18($v0) # internal_15[10] = 'e' + sb $t0, 18($v0) # internal_29[10] = 'e' addi $t0, $zero, 97 - sb $t0, 19($v0) # internal_15[11] = 'a' + sb $t0, 19($v0) # internal_29[11] = 'a' addi $t0, $zero, 116 - sb $t0, 20($v0) # internal_15[12] = 't' + sb $t0, 20($v0) # internal_29[12] = 't' addi $t0, $zero, 101 - sb $t0, 21($v0) # internal_15[13] = 'e' + sb $t0, 21($v0) # internal_29[13] = 'e' addi $t0, $zero, 114 - sb $t0, 22($v0) # internal_15[14] = 'r' + sb $t0, 22($v0) # internal_29[14] = 'r' addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_15[15] = ' ' + sb $t0, 23($v0) # internal_29[15] = ' ' addi $t0, $zero, 116 - sb $t0, 24($v0) # internal_15[16] = 't' + sb $t0, 24($v0) # internal_29[16] = 't' addi $t0, $zero, 104 - sb $t0, 25($v0) # internal_15[17] = 'h' + sb $t0, 25($v0) # internal_29[17] = 'h' addi $t0, $zero, 97 - sb $t0, 26($v0) # internal_15[18] = 'a' + sb $t0, 26($v0) # internal_29[18] = 'a' addi $t0, $zero, 110 - sb $t0, 27($v0) # internal_15[19] = 'n' + sb $t0, 27($v0) # internal_29[19] = 'n' addi $t0, $zero, 32 - sb $t0, 28($v0) # internal_15[20] = ' ' + sb $t0, 28($v0) # internal_29[20] = ' ' addi $t0, $zero, 115 - sb $t0, 29($v0) # internal_15[21] = 's' + sb $t0, 29($v0) # internal_29[21] = 's' addi $t0, $zero, 105 - sb $t0, 30($v0) # internal_15[22] = 'i' + sb $t0, 30($v0) # internal_29[22] = 'i' addi $t0, $zero, 103 - sb $t0, 31($v0) # internal_15[23] = 'g' + sb $t0, 31($v0) # internal_29[23] = 'g' addi $t0, $zero, 110 - sb $t0, 32($v0) # internal_15[24] = 'n' + sb $t0, 32($v0) # internal_29[24] = 'n' addi $t0, $zero, 115 - sb $t0, 33($v0) # internal_15[25] = 's' + sb $t0, 33($v0) # internal_29[25] = 's' addi $t0, $zero, 10 - sb $t0, 34($v0) # internal_15[26] = '\n' + sb $t0, 34($v0) # internal_29[26] = '\n' sb $zero, 35($v0) # Null-terminator at the end of the string - sw $v0, 560($sp) # internal_15 = "\t7: Two greater than signs\n" + sw $v0, 704($sp) # internal_29 = "\t7: Two greater than signs\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 696($sp) # internal_31 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 696($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 692($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 636($sp) + lw $t0, 836($sp) sw $t0, 4($sp) # Storing self - # Argument internal_15 - lw $t0, 572($sp) - sw $t0, 0($sp) # Storing internal_15 + # Argument internal_29 + lw $t0, 716($sp) + sw $t0, 0($sp) # Storing internal_29 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_32 + lw $t0, 704($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 568($sp) # internal_16 = result of function_out_string_at_IO + sw $v1, 712($sp) # internal_30 = result of internal_32 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -9591,97 +10746,121 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_17[0] = '\t' + sb $t0, 8($v0) # internal_33[0] = '\t' addi $t0, $zero, 56 - sb $t0, 9($v0) # internal_17[1] = '8' + sb $t0, 9($v0) # internal_33[1] = '8' addi $t0, $zero, 58 - sb $t0, 10($v0) # internal_17[2] = ':' + sb $t0, 10($v0) # internal_33[2] = ':' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_17[3] = ' ' + sb $t0, 11($v0) # internal_33[3] = ' ' addi $t0, $zero, 84 - sb $t0, 12($v0) # internal_17[4] = 'T' + sb $t0, 12($v0) # internal_33[4] = 'T' addi $t0, $zero, 119 - sb $t0, 13($v0) # internal_17[5] = 'w' + sb $t0, 13($v0) # internal_33[5] = 'w' addi $t0, $zero, 111 - sb $t0, 14($v0) # internal_17[6] = 'o' + sb $t0, 14($v0) # internal_33[6] = 'o' addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_17[7] = ' ' + sb $t0, 15($v0) # internal_33[7] = ' ' addi $t0, $zero, 108 - sb $t0, 16($v0) # internal_17[8] = 'l' + sb $t0, 16($v0) # internal_33[8] = 'l' addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_17[9] = 'e' + sb $t0, 17($v0) # internal_33[9] = 'e' addi $t0, $zero, 115 - sb $t0, 18($v0) # internal_17[10] = 's' + sb $t0, 18($v0) # internal_33[10] = 's' addi $t0, $zero, 115 - sb $t0, 19($v0) # internal_17[11] = 's' + sb $t0, 19($v0) # internal_33[11] = 's' addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_17[12] = ' ' + sb $t0, 20($v0) # internal_33[12] = ' ' addi $t0, $zero, 116 - sb $t0, 21($v0) # internal_17[13] = 't' + sb $t0, 21($v0) # internal_33[13] = 't' addi $t0, $zero, 104 - sb $t0, 22($v0) # internal_17[14] = 'h' + sb $t0, 22($v0) # internal_33[14] = 'h' addi $t0, $zero, 97 - sb $t0, 23($v0) # internal_17[15] = 'a' + sb $t0, 23($v0) # internal_33[15] = 'a' addi $t0, $zero, 110 - sb $t0, 24($v0) # internal_17[16] = 'n' + sb $t0, 24($v0) # internal_33[16] = 'n' addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_17[17] = ' ' + sb $t0, 25($v0) # internal_33[17] = ' ' addi $t0, $zero, 115 - sb $t0, 26($v0) # internal_17[18] = 's' + sb $t0, 26($v0) # internal_33[18] = 's' addi $t0, $zero, 105 - sb $t0, 27($v0) # internal_17[19] = 'i' + sb $t0, 27($v0) # internal_33[19] = 'i' addi $t0, $zero, 103 - sb $t0, 28($v0) # internal_17[20] = 'g' + sb $t0, 28($v0) # internal_33[20] = 'g' addi $t0, $zero, 110 - sb $t0, 29($v0) # internal_17[21] = 'n' + sb $t0, 29($v0) # internal_33[21] = 'n' addi $t0, $zero, 115 - sb $t0, 30($v0) # internal_17[22] = 's' + sb $t0, 30($v0) # internal_33[22] = 's' addi $t0, $zero, 10 - sb $t0, 31($v0) # internal_17[23] = '\n' + sb $t0, 31($v0) # internal_33[23] = '\n' sb $zero, 32($v0) # Null-terminator at the end of the string - sw $v0, 552($sp) # internal_17 = "\t8: Two less than signs\n" + sw $v0, 688($sp) # internal_33 = "\t8: Two less than signs\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 680($sp) # internal_35 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 680($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 676($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 636($sp) + lw $t0, 836($sp) sw $t0, 4($sp) # Storing self - # Argument internal_17 - lw $t0, 564($sp) - sw $t0, 0($sp) # Storing internal_17 + # Argument internal_33 + lw $t0, 700($sp) + sw $t0, 0($sp) # Storing internal_33 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_36 + lw $t0, 688($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 560($sp) # internal_18 = result of function_out_string_at_IO + sw $v1, 696($sp) # internal_34 = result of internal_36 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -9696,55 +10875,79 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_19[0] = '\t' + sb $t0, 8($v0) # internal_37[0] = '\t' addi $t0, $zero, 57 - sb $t0, 9($v0) # internal_19[1] = '9' + sb $t0, 9($v0) # internal_37[1] = '9' addi $t0, $zero, 58 - sb $t0, 10($v0) # internal_19[2] = ':' + sb $t0, 10($v0) # internal_37[2] = ':' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_19[3] = ' ' + sb $t0, 11($v0) # internal_37[3] = ' ' addi $t0, $zero, 65 - sb $t0, 12($v0) # internal_19[4] = 'A' + sb $t0, 12($v0) # internal_37[4] = 'A' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_19[5] = ' ' + sb $t0, 13($v0) # internal_37[5] = ' ' addi $t0, $zero, 39 - sb $t0, 14($v0) # internal_19[6] = ''' + sb $t0, 14($v0) # internal_37[6] = ''' addi $t0, $zero, 86 - sb $t0, 15($v0) # internal_19[7] = 'V' + sb $t0, 15($v0) # internal_37[7] = 'V' addi $t0, $zero, 39 - sb $t0, 16($v0) # internal_19[8] = ''' + sb $t0, 16($v0) # internal_37[8] = ''' addi $t0, $zero, 10 - sb $t0, 17($v0) # internal_19[9] = '\n' + sb $t0, 17($v0) # internal_37[9] = '\n' sb $zero, 18($v0) # Null-terminator at the end of the string - sw $v0, 544($sp) # internal_19 = "\t9: A 'V'\n" + sw $v0, 672($sp) # internal_37 = "\t9: A 'V'\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 664($sp) # internal_39 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 664($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 660($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 636($sp) + lw $t0, 836($sp) sw $t0, 4($sp) # Storing self - # Argument internal_19 - lw $t0, 556($sp) - sw $t0, 0($sp) # Storing internal_19 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Argument internal_37 + lw $t0, 684($sp) + sw $t0, 0($sp) # Storing internal_37 + + # Calling function internal_40 + lw $t0, 672($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 552($sp) # internal_20 = result of function_out_string_at_IO + sw $v1, 680($sp) # internal_38 = result of internal_40 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -9759,85 +10962,109 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_21[0] = '\t' + sb $t0, 8($v0) # internal_41[0] = '\t' addi $t0, $zero, 49 - sb $t0, 9($v0) # internal_21[1] = '1' + sb $t0, 9($v0) # internal_41[1] = '1' addi $t0, $zero, 48 - sb $t0, 10($v0) # internal_21[2] = '0' + sb $t0, 10($v0) # internal_41[2] = '0' addi $t0, $zero, 58 - sb $t0, 11($v0) # internal_21[3] = ':' + sb $t0, 11($v0) # internal_41[3] = ':' addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_21[4] = ' ' + sb $t0, 12($v0) # internal_41[4] = ' ' addi $t0, $zero, 65 - sb $t0, 13($v0) # internal_21[5] = 'A' + sb $t0, 13($v0) # internal_41[5] = 'A' addi $t0, $zero, 110 - sb $t0, 14($v0) # internal_21[6] = 'n' + sb $t0, 14($v0) # internal_41[6] = 'n' addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_21[7] = ' ' + sb $t0, 15($v0) # internal_41[7] = ' ' addi $t0, $zero, 105 - sb $t0, 16($v0) # internal_21[8] = 'i' + sb $t0, 16($v0) # internal_41[8] = 'i' addi $t0, $zero, 110 - sb $t0, 17($v0) # internal_21[9] = 'n' + sb $t0, 17($v0) # internal_41[9] = 'n' addi $t0, $zero, 118 - sb $t0, 18($v0) # internal_21[10] = 'v' + sb $t0, 18($v0) # internal_41[10] = 'v' addi $t0, $zero, 101 - sb $t0, 19($v0) # internal_21[11] = 'e' + sb $t0, 19($v0) # internal_41[11] = 'e' addi $t0, $zero, 114 - sb $t0, 20($v0) # internal_21[12] = 'r' + sb $t0, 20($v0) # internal_41[12] = 'r' addi $t0, $zero, 115 - sb $t0, 21($v0) # internal_21[13] = 's' + sb $t0, 21($v0) # internal_41[13] = 's' addi $t0, $zero, 101 - sb $t0, 22($v0) # internal_21[14] = 'e' + sb $t0, 22($v0) # internal_41[14] = 'e' addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_21[15] = ' ' + sb $t0, 23($v0) # internal_41[15] = ' ' addi $t0, $zero, 39 - sb $t0, 24($v0) # internal_21[16] = ''' + sb $t0, 24($v0) # internal_41[16] = ''' addi $t0, $zero, 86 - sb $t0, 25($v0) # internal_21[17] = 'V' + sb $t0, 25($v0) # internal_41[17] = 'V' addi $t0, $zero, 39 - sb $t0, 26($v0) # internal_21[18] = ''' + sb $t0, 26($v0) # internal_41[18] = ''' addi $t0, $zero, 10 - sb $t0, 27($v0) # internal_21[19] = '\n' + sb $t0, 27($v0) # internal_41[19] = '\n' sb $zero, 28($v0) # Null-terminator at the end of the string - sw $v0, 536($sp) # internal_21 = "\t10: An inverse 'V'\n" + sw $v0, 656($sp) # internal_41 = "\t10: An inverse 'V'\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 648($sp) # internal_43 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 648($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 644($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 636($sp) + lw $t0, 836($sp) sw $t0, 4($sp) # Storing self - # Argument internal_21 - lw $t0, 548($sp) - sw $t0, 0($sp) # Storing internal_21 + # Argument internal_41 + lw $t0, 668($sp) + sw $t0, 0($sp) # Storing internal_41 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_44 + lw $t0, 656($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 544($sp) # internal_22 = result of function_out_string_at_IO + sw $v1, 664($sp) # internal_42 = result of internal_44 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -9852,118 +11079,142 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_23[0] = '\t' + sb $t0, 8($v0) # internal_45[0] = '\t' addi $t0, $zero, 49 - sb $t0, 9($v0) # internal_23[1] = '1' + sb $t0, 9($v0) # internal_45[1] = '1' addi $t0, $zero, 49 - sb $t0, 10($v0) # internal_23[2] = '1' + sb $t0, 10($v0) # internal_45[2] = '1' addi $t0, $zero, 58 - sb $t0, 11($v0) # internal_23[3] = ':' + sb $t0, 11($v0) # internal_45[3] = ':' addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_23[4] = ' ' + sb $t0, 12($v0) # internal_45[4] = ' ' addi $t0, $zero, 78 - sb $t0, 13($v0) # internal_23[5] = 'N' + sb $t0, 13($v0) # internal_45[5] = 'N' addi $t0, $zero, 117 - sb $t0, 14($v0) # internal_23[6] = 'u' + sb $t0, 14($v0) # internal_45[6] = 'u' addi $t0, $zero, 109 - sb $t0, 15($v0) # internal_23[7] = 'm' + sb $t0, 15($v0) # internal_45[7] = 'm' addi $t0, $zero, 98 - sb $t0, 16($v0) # internal_23[8] = 'b' + sb $t0, 16($v0) # internal_45[8] = 'b' addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_23[9] = 'e' + sb $t0, 17($v0) # internal_45[9] = 'e' addi $t0, $zero, 114 - sb $t0, 18($v0) # internal_23[10] = 'r' + sb $t0, 18($v0) # internal_45[10] = 'r' addi $t0, $zero, 115 - sb $t0, 19($v0) # internal_23[11] = 's' + sb $t0, 19($v0) # internal_45[11] = 's' addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_23[12] = ' ' + sb $t0, 20($v0) # internal_45[12] = ' ' addi $t0, $zero, 57 - sb $t0, 21($v0) # internal_23[13] = '9' + sb $t0, 21($v0) # internal_45[13] = '9' addi $t0, $zero, 32 - sb $t0, 22($v0) # internal_23[14] = ' ' + sb $t0, 22($v0) # internal_45[14] = ' ' addi $t0, $zero, 97 - sb $t0, 23($v0) # internal_23[15] = 'a' + sb $t0, 23($v0) # internal_45[15] = 'a' addi $t0, $zero, 110 - sb $t0, 24($v0) # internal_23[16] = 'n' + sb $t0, 24($v0) # internal_45[16] = 'n' addi $t0, $zero, 100 - sb $t0, 25($v0) # internal_23[17] = 'd' + sb $t0, 25($v0) # internal_45[17] = 'd' addi $t0, $zero, 32 - sb $t0, 26($v0) # internal_23[18] = ' ' + sb $t0, 26($v0) # internal_45[18] = ' ' addi $t0, $zero, 49 - sb $t0, 27($v0) # internal_23[19] = '1' + sb $t0, 27($v0) # internal_45[19] = '1' addi $t0, $zero, 48 - sb $t0, 28($v0) # internal_23[20] = '0' + sb $t0, 28($v0) # internal_45[20] = '0' addi $t0, $zero, 32 - sb $t0, 29($v0) # internal_23[21] = ' ' + sb $t0, 29($v0) # internal_45[21] = ' ' addi $t0, $zero, 99 - sb $t0, 30($v0) # internal_23[22] = 'c' + sb $t0, 30($v0) # internal_45[22] = 'c' addi $t0, $zero, 111 - sb $t0, 31($v0) # internal_23[23] = 'o' + sb $t0, 31($v0) # internal_45[23] = 'o' addi $t0, $zero, 109 - sb $t0, 32($v0) # internal_23[24] = 'm' + sb $t0, 32($v0) # internal_45[24] = 'm' addi $t0, $zero, 98 - sb $t0, 33($v0) # internal_23[25] = 'b' + sb $t0, 33($v0) # internal_45[25] = 'b' addi $t0, $zero, 105 - sb $t0, 34($v0) # internal_23[26] = 'i' + sb $t0, 34($v0) # internal_45[26] = 'i' addi $t0, $zero, 110 - sb $t0, 35($v0) # internal_23[27] = 'n' + sb $t0, 35($v0) # internal_45[27] = 'n' addi $t0, $zero, 101 - sb $t0, 36($v0) # internal_23[28] = 'e' + sb $t0, 36($v0) # internal_45[28] = 'e' addi $t0, $zero, 100 - sb $t0, 37($v0) # internal_23[29] = 'd' + sb $t0, 37($v0) # internal_45[29] = 'd' addi $t0, $zero, 10 - sb $t0, 38($v0) # internal_23[30] = '\n' + sb $t0, 38($v0) # internal_45[30] = '\n' sb $zero, 39($v0) # Null-terminator at the end of the string - sw $v0, 528($sp) # internal_23 = "\t11: Numbers 9 and 10 combined\n" + sw $v0, 640($sp) # internal_45 = "\t11: Numbers 9 and 10 combined\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 632($sp) # internal_47 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 632($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 628($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 636($sp) + lw $t0, 836($sp) sw $t0, 4($sp) # Storing self - # Argument internal_23 - lw $t0, 540($sp) - sw $t0, 0($sp) # Storing internal_23 + # Argument internal_45 + lw $t0, 652($sp) + sw $t0, 0($sp) # Storing internal_45 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_48 + lw $t0, 640($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 536($sp) # internal_24 = result of function_out_string_at_IO + sw $v1, 648($sp) # internal_46 = result of internal_48 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -9978,76 +11229,100 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_25[0] = '\t' + sb $t0, 8($v0) # internal_49[0] = '\t' addi $t0, $zero, 49 - sb $t0, 9($v0) # internal_25[1] = '1' + sb $t0, 9($v0) # internal_49[1] = '1' addi $t0, $zero, 50 - sb $t0, 10($v0) # internal_25[2] = '2' + sb $t0, 10($v0) # internal_49[2] = '2' addi $t0, $zero, 58 - sb $t0, 11($v0) # internal_25[3] = ':' + sb $t0, 11($v0) # internal_49[3] = ':' addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_25[4] = ' ' + sb $t0, 12($v0) # internal_49[4] = ' ' addi $t0, $zero, 65 - sb $t0, 13($v0) # internal_25[5] = 'A' + sb $t0, 13($v0) # internal_49[5] = 'A' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_25[6] = ' ' + sb $t0, 14($v0) # internal_49[6] = ' ' addi $t0, $zero, 102 - sb $t0, 15($v0) # internal_25[7] = 'f' + sb $t0, 15($v0) # internal_49[7] = 'f' addi $t0, $zero, 117 - sb $t0, 16($v0) # internal_25[8] = 'u' + sb $t0, 16($v0) # internal_49[8] = 'u' addi $t0, $zero, 108 - sb $t0, 17($v0) # internal_25[9] = 'l' + sb $t0, 17($v0) # internal_49[9] = 'l' addi $t0, $zero, 108 - sb $t0, 18($v0) # internal_25[10] = 'l' + sb $t0, 18($v0) # internal_49[10] = 'l' addi $t0, $zero, 32 - sb $t0, 19($v0) # internal_25[11] = ' ' + sb $t0, 19($v0) # internal_49[11] = ' ' addi $t0, $zero, 103 - sb $t0, 20($v0) # internal_25[12] = 'g' + sb $t0, 20($v0) # internal_49[12] = 'g' addi $t0, $zero, 114 - sb $t0, 21($v0) # internal_25[13] = 'r' + sb $t0, 21($v0) # internal_49[13] = 'r' addi $t0, $zero, 105 - sb $t0, 22($v0) # internal_25[14] = 'i' + sb $t0, 22($v0) # internal_49[14] = 'i' addi $t0, $zero, 100 - sb $t0, 23($v0) # internal_25[15] = 'd' + sb $t0, 23($v0) # internal_49[15] = 'd' addi $t0, $zero, 10 - sb $t0, 24($v0) # internal_25[16] = '\n' + sb $t0, 24($v0) # internal_49[16] = '\n' sb $zero, 25($v0) # Null-terminator at the end of the string - sw $v0, 520($sp) # internal_25 = "\t12: A full grid\n" + sw $v0, 624($sp) # internal_49 = "\t12: A full grid\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 616($sp) # internal_51 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 616($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 612($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 636($sp) + lw $t0, 836($sp) sw $t0, 4($sp) # Storing self - # Argument internal_25 - lw $t0, 532($sp) - sw $t0, 0($sp) # Storing internal_25 + # Argument internal_49 + lw $t0, 636($sp) + sw $t0, 0($sp) # Storing internal_49 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_52 + lw $t0, 624($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 528($sp) # internal_26 = result of function_out_string_at_IO + sw $v1, 632($sp) # internal_50 = result of internal_52 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -10062,58 +11337,82 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_27[0] = '\t' + sb $t0, 8($v0) # internal_53[0] = '\t' addi $t0, $zero, 49 - sb $t0, 9($v0) # internal_27[1] = '1' + sb $t0, 9($v0) # internal_53[1] = '1' addi $t0, $zero, 51 - sb $t0, 10($v0) # internal_27[2] = '3' + sb $t0, 10($v0) # internal_53[2] = '3' addi $t0, $zero, 58 - sb $t0, 11($v0) # internal_27[3] = ':' + sb $t0, 11($v0) # internal_53[3] = ':' addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_27[4] = ' ' + sb $t0, 12($v0) # internal_53[4] = ' ' addi $t0, $zero, 65 - sb $t0, 13($v0) # internal_27[5] = 'A' + sb $t0, 13($v0) # internal_53[5] = 'A' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_27[6] = ' ' + sb $t0, 14($v0) # internal_53[6] = ' ' addi $t0, $zero, 39 - sb $t0, 15($v0) # internal_27[7] = ''' + sb $t0, 15($v0) # internal_53[7] = ''' addi $t0, $zero, 84 - sb $t0, 16($v0) # internal_27[8] = 'T' + sb $t0, 16($v0) # internal_53[8] = 'T' addi $t0, $zero, 39 - sb $t0, 17($v0) # internal_27[9] = ''' + sb $t0, 17($v0) # internal_53[9] = ''' addi $t0, $zero, 10 - sb $t0, 18($v0) # internal_27[10] = '\n' + sb $t0, 18($v0) # internal_53[10] = '\n' sb $zero, 19($v0) # Null-terminator at the end of the string - sw $v0, 512($sp) # internal_27 = "\t13: A 'T'\n" + sw $v0, 608($sp) # internal_53 = "\t13: A 'T'\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 600($sp) # internal_55 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 600($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 596($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 636($sp) + lw $t0, 836($sp) sw $t0, 4($sp) # Storing self - # Argument internal_27 - lw $t0, 524($sp) - sw $t0, 0($sp) # Storing internal_27 + # Argument internal_53 + lw $t0, 620($sp) + sw $t0, 0($sp) # Storing internal_53 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_56 + lw $t0, 608($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 520($sp) # internal_28 = result of function_out_string_at_IO + sw $v1, 616($sp) # internal_54 = result of internal_56 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -10128,73 +11427,97 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_29[0] = '\t' + sb $t0, 8($v0) # internal_57[0] = '\t' addi $t0, $zero, 49 - sb $t0, 9($v0) # internal_29[1] = '1' + sb $t0, 9($v0) # internal_57[1] = '1' addi $t0, $zero, 52 - sb $t0, 10($v0) # internal_29[2] = '4' + sb $t0, 10($v0) # internal_57[2] = '4' addi $t0, $zero, 58 - sb $t0, 11($v0) # internal_29[3] = ':' + sb $t0, 11($v0) # internal_57[3] = ':' addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_29[4] = ' ' + sb $t0, 12($v0) # internal_57[4] = ' ' addi $t0, $zero, 65 - sb $t0, 13($v0) # internal_29[5] = 'A' + sb $t0, 13($v0) # internal_57[5] = 'A' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_29[6] = ' ' + sb $t0, 14($v0) # internal_57[6] = ' ' addi $t0, $zero, 112 - sb $t0, 15($v0) # internal_29[7] = 'p' + sb $t0, 15($v0) # internal_57[7] = 'p' addi $t0, $zero, 108 - sb $t0, 16($v0) # internal_29[8] = 'l' + sb $t0, 16($v0) # internal_57[8] = 'l' addi $t0, $zero, 117 - sb $t0, 17($v0) # internal_29[9] = 'u' + sb $t0, 17($v0) # internal_57[9] = 'u' addi $t0, $zero, 115 - sb $t0, 18($v0) # internal_29[10] = 's' + sb $t0, 18($v0) # internal_57[10] = 's' addi $t0, $zero, 32 - sb $t0, 19($v0) # internal_29[11] = ' ' + sb $t0, 19($v0) # internal_57[11] = ' ' addi $t0, $zero, 39 - sb $t0, 20($v0) # internal_29[12] = ''' + sb $t0, 20($v0) # internal_57[12] = ''' addi $t0, $zero, 43 - sb $t0, 21($v0) # internal_29[13] = '+' + sb $t0, 21($v0) # internal_57[13] = '+' addi $t0, $zero, 39 - sb $t0, 22($v0) # internal_29[14] = ''' + sb $t0, 22($v0) # internal_57[14] = ''' addi $t0, $zero, 10 - sb $t0, 23($v0) # internal_29[15] = '\n' + sb $t0, 23($v0) # internal_57[15] = '\n' sb $zero, 24($v0) # Null-terminator at the end of the string - sw $v0, 504($sp) # internal_29 = "\t14: A plus '+'\n" + sw $v0, 592($sp) # internal_57 = "\t14: A plus '+'\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 584($sp) # internal_59 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 584($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 580($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 636($sp) + lw $t0, 836($sp) sw $t0, 4($sp) # Storing self - # Argument internal_29 - lw $t0, 516($sp) - sw $t0, 0($sp) # Storing internal_29 + # Argument internal_57 + lw $t0, 604($sp) + sw $t0, 0($sp) # Storing internal_57 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_60 + lw $t0, 592($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 512($sp) # internal_30 = result of function_out_string_at_IO + sw $v1, 600($sp) # internal_58 = result of internal_60 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -10209,58 +11532,82 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_31[0] = '\t' + sb $t0, 8($v0) # internal_61[0] = '\t' addi $t0, $zero, 49 - sb $t0, 9($v0) # internal_31[1] = '1' + sb $t0, 9($v0) # internal_61[1] = '1' addi $t0, $zero, 53 - sb $t0, 10($v0) # internal_31[2] = '5' + sb $t0, 10($v0) # internal_61[2] = '5' addi $t0, $zero, 58 - sb $t0, 11($v0) # internal_31[3] = ':' + sb $t0, 11($v0) # internal_61[3] = ':' addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_31[4] = ' ' + sb $t0, 12($v0) # internal_61[4] = ' ' addi $t0, $zero, 65 - sb $t0, 13($v0) # internal_31[5] = 'A' + sb $t0, 13($v0) # internal_61[5] = 'A' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_31[6] = ' ' + sb $t0, 14($v0) # internal_61[6] = ' ' addi $t0, $zero, 39 - sb $t0, 15($v0) # internal_31[7] = ''' + sb $t0, 15($v0) # internal_61[7] = ''' addi $t0, $zero, 87 - sb $t0, 16($v0) # internal_31[8] = 'W' + sb $t0, 16($v0) # internal_61[8] = 'W' addi $t0, $zero, 39 - sb $t0, 17($v0) # internal_31[9] = ''' + sb $t0, 17($v0) # internal_61[9] = ''' addi $t0, $zero, 10 - sb $t0, 18($v0) # internal_31[10] = '\n' + sb $t0, 18($v0) # internal_61[10] = '\n' sb $zero, 19($v0) # Null-terminator at the end of the string - sw $v0, 496($sp) # internal_31 = "\t15: A 'W'\n" + sw $v0, 576($sp) # internal_61 = "\t15: A 'W'\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 568($sp) # internal_63 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 568($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 564($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 636($sp) + lw $t0, 836($sp) sw $t0, 4($sp) # Storing self - # Argument internal_31 - lw $t0, 508($sp) - sw $t0, 0($sp) # Storing internal_31 + # Argument internal_61 + lw $t0, 588($sp) + sw $t0, 0($sp) # Storing internal_61 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_64 + lw $t0, 576($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 504($sp) # internal_32 = result of function_out_string_at_IO + sw $v1, 584($sp) # internal_62 = result of internal_64 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -10275,61 +11622,85 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_33[0] = '\t' + sb $t0, 8($v0) # internal_65[0] = '\t' addi $t0, $zero, 49 - sb $t0, 9($v0) # internal_33[1] = '1' + sb $t0, 9($v0) # internal_65[1] = '1' addi $t0, $zero, 54 - sb $t0, 10($v0) # internal_33[2] = '6' + sb $t0, 10($v0) # internal_65[2] = '6' addi $t0, $zero, 58 - sb $t0, 11($v0) # internal_33[3] = ':' + sb $t0, 11($v0) # internal_65[3] = ':' addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_33[4] = ' ' + sb $t0, 12($v0) # internal_65[4] = ' ' addi $t0, $zero, 65 - sb $t0, 13($v0) # internal_33[5] = 'A' + sb $t0, 13($v0) # internal_65[5] = 'A' addi $t0, $zero, 110 - sb $t0, 14($v0) # internal_33[6] = 'n' + sb $t0, 14($v0) # internal_65[6] = 'n' addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_33[7] = ' ' + sb $t0, 15($v0) # internal_65[7] = ' ' addi $t0, $zero, 39 - sb $t0, 16($v0) # internal_33[8] = ''' + sb $t0, 16($v0) # internal_65[8] = ''' addi $t0, $zero, 77 - sb $t0, 17($v0) # internal_33[9] = 'M' + sb $t0, 17($v0) # internal_65[9] = 'M' addi $t0, $zero, 39 - sb $t0, 18($v0) # internal_33[10] = ''' + sb $t0, 18($v0) # internal_65[10] = ''' addi $t0, $zero, 10 - sb $t0, 19($v0) # internal_33[11] = '\n' + sb $t0, 19($v0) # internal_65[11] = '\n' sb $zero, 20($v0) # Null-terminator at the end of the string - sw $v0, 488($sp) # internal_33 = "\t16: An 'M'\n" + sw $v0, 560($sp) # internal_65 = "\t16: An 'M'\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 552($sp) # internal_67 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 552($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 548($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 636($sp) + lw $t0, 836($sp) sw $t0, 4($sp) # Storing self - # Argument internal_33 - lw $t0, 500($sp) - sw $t0, 0($sp) # Storing internal_33 + # Argument internal_65 + lw $t0, 572($sp) + sw $t0, 0($sp) # Storing internal_65 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_68 + lw $t0, 560($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 496($sp) # internal_34 = result of function_out_string_at_IO + sw $v1, 568($sp) # internal_66 = result of internal_68 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -10344,61 +11715,85 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_35[0] = '\t' + sb $t0, 8($v0) # internal_69[0] = '\t' addi $t0, $zero, 49 - sb $t0, 9($v0) # internal_35[1] = '1' + sb $t0, 9($v0) # internal_69[1] = '1' addi $t0, $zero, 55 - sb $t0, 10($v0) # internal_35[2] = '7' + sb $t0, 10($v0) # internal_69[2] = '7' addi $t0, $zero, 58 - sb $t0, 11($v0) # internal_35[3] = ':' + sb $t0, 11($v0) # internal_69[3] = ':' addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_35[4] = ' ' + sb $t0, 12($v0) # internal_69[4] = ' ' addi $t0, $zero, 65 - sb $t0, 13($v0) # internal_35[5] = 'A' + sb $t0, 13($v0) # internal_69[5] = 'A' addi $t0, $zero, 110 - sb $t0, 14($v0) # internal_35[6] = 'n' + sb $t0, 14($v0) # internal_69[6] = 'n' addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_35[7] = ' ' + sb $t0, 15($v0) # internal_69[7] = ' ' addi $t0, $zero, 39 - sb $t0, 16($v0) # internal_35[8] = ''' + sb $t0, 16($v0) # internal_69[8] = ''' addi $t0, $zero, 69 - sb $t0, 17($v0) # internal_35[9] = 'E' + sb $t0, 17($v0) # internal_69[9] = 'E' addi $t0, $zero, 39 - sb $t0, 18($v0) # internal_35[10] = ''' + sb $t0, 18($v0) # internal_69[10] = ''' addi $t0, $zero, 10 - sb $t0, 19($v0) # internal_35[11] = '\n' + sb $t0, 19($v0) # internal_69[11] = '\n' sb $zero, 20($v0) # Null-terminator at the end of the string - sw $v0, 480($sp) # internal_35 = "\t17: An 'E'\n" + sw $v0, 544($sp) # internal_69 = "\t17: An 'E'\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 536($sp) # internal_71 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 536($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 532($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 636($sp) + lw $t0, 836($sp) sw $t0, 4($sp) # Storing self - # Argument internal_35 - lw $t0, 492($sp) - sw $t0, 0($sp) # Storing internal_35 + # Argument internal_69 + lw $t0, 556($sp) + sw $t0, 0($sp) # Storing internal_69 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_72 + lw $t0, 544($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 488($sp) # internal_36 = result of function_out_string_at_IO + sw $v1, 552($sp) # internal_70 = result of internal_72 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -10413,58 +11808,82 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_37[0] = '\t' + sb $t0, 8($v0) # internal_73[0] = '\t' addi $t0, $zero, 49 - sb $t0, 9($v0) # internal_37[1] = '1' + sb $t0, 9($v0) # internal_73[1] = '1' addi $t0, $zero, 56 - sb $t0, 10($v0) # internal_37[2] = '8' + sb $t0, 10($v0) # internal_73[2] = '8' addi $t0, $zero, 58 - sb $t0, 11($v0) # internal_37[3] = ':' + sb $t0, 11($v0) # internal_73[3] = ':' addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_37[4] = ' ' + sb $t0, 12($v0) # internal_73[4] = ' ' addi $t0, $zero, 65 - sb $t0, 13($v0) # internal_37[5] = 'A' + sb $t0, 13($v0) # internal_73[5] = 'A' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_37[6] = ' ' + sb $t0, 14($v0) # internal_73[6] = ' ' addi $t0, $zero, 39 - sb $t0, 15($v0) # internal_37[7] = ''' + sb $t0, 15($v0) # internal_73[7] = ''' addi $t0, $zero, 51 - sb $t0, 16($v0) # internal_37[8] = '3' + sb $t0, 16($v0) # internal_73[8] = '3' addi $t0, $zero, 39 - sb $t0, 17($v0) # internal_37[9] = ''' + sb $t0, 17($v0) # internal_73[9] = ''' addi $t0, $zero, 10 - sb $t0, 18($v0) # internal_37[10] = '\n' + sb $t0, 18($v0) # internal_73[10] = '\n' sb $zero, 19($v0) # Null-terminator at the end of the string - sw $v0, 472($sp) # internal_37 = "\t18: A '3'\n" + sw $v0, 528($sp) # internal_73 = "\t18: A '3'\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 520($sp) # internal_75 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 520($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 516($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 636($sp) + lw $t0, 836($sp) sw $t0, 4($sp) # Storing self - # Argument internal_37 - lw $t0, 484($sp) - sw $t0, 0($sp) # Storing internal_37 + # Argument internal_73 + lw $t0, 540($sp) + sw $t0, 0($sp) # Storing internal_73 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_76 + lw $t0, 528($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 480($sp) # internal_38 = result of function_out_string_at_IO + sw $v1, 536($sp) # internal_74 = result of internal_76 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -10479,61 +11898,85 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_39[0] = '\t' + sb $t0, 8($v0) # internal_77[0] = '\t' addi $t0, $zero, 49 - sb $t0, 9($v0) # internal_39[1] = '1' + sb $t0, 9($v0) # internal_77[1] = '1' addi $t0, $zero, 57 - sb $t0, 10($v0) # internal_39[2] = '9' + sb $t0, 10($v0) # internal_77[2] = '9' addi $t0, $zero, 58 - sb $t0, 11($v0) # internal_39[3] = ':' + sb $t0, 11($v0) # internal_77[3] = ':' addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_39[4] = ' ' + sb $t0, 12($v0) # internal_77[4] = ' ' addi $t0, $zero, 65 - sb $t0, 13($v0) # internal_39[5] = 'A' + sb $t0, 13($v0) # internal_77[5] = 'A' addi $t0, $zero, 110 - sb $t0, 14($v0) # internal_39[6] = 'n' + sb $t0, 14($v0) # internal_77[6] = 'n' addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_39[7] = ' ' + sb $t0, 15($v0) # internal_77[7] = ' ' addi $t0, $zero, 39 - sb $t0, 16($v0) # internal_39[8] = ''' + sb $t0, 16($v0) # internal_77[8] = ''' addi $t0, $zero, 79 - sb $t0, 17($v0) # internal_39[9] = 'O' + sb $t0, 17($v0) # internal_77[9] = 'O' addi $t0, $zero, 39 - sb $t0, 18($v0) # internal_39[10] = ''' + sb $t0, 18($v0) # internal_77[10] = ''' addi $t0, $zero, 10 - sb $t0, 19($v0) # internal_39[11] = '\n' + sb $t0, 19($v0) # internal_77[11] = '\n' sb $zero, 20($v0) # Null-terminator at the end of the string - sw $v0, 464($sp) # internal_39 = "\t19: An 'O'\n" + sw $v0, 512($sp) # internal_77 = "\t19: An 'O'\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 504($sp) # internal_79 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 504($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 500($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 636($sp) + lw $t0, 836($sp) sw $t0, 4($sp) # Storing self - # Argument internal_39 - lw $t0, 476($sp) - sw $t0, 0($sp) # Storing internal_39 + # Argument internal_77 + lw $t0, 524($sp) + sw $t0, 0($sp) # Storing internal_77 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_80 + lw $t0, 512($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 472($sp) # internal_40 = result of function_out_string_at_IO + sw $v1, 520($sp) # internal_78 = result of internal_80 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -10548,61 +11991,85 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_41[0] = '\t' + sb $t0, 8($v0) # internal_81[0] = '\t' addi $t0, $zero, 50 - sb $t0, 9($v0) # internal_41[1] = '2' + sb $t0, 9($v0) # internal_81[1] = '2' addi $t0, $zero, 48 - sb $t0, 10($v0) # internal_41[2] = '0' + sb $t0, 10($v0) # internal_81[2] = '0' addi $t0, $zero, 58 - sb $t0, 11($v0) # internal_41[3] = ':' + sb $t0, 11($v0) # internal_81[3] = ':' addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_41[4] = ' ' + sb $t0, 12($v0) # internal_81[4] = ' ' addi $t0, $zero, 65 - sb $t0, 13($v0) # internal_41[5] = 'A' + sb $t0, 13($v0) # internal_81[5] = 'A' addi $t0, $zero, 110 - sb $t0, 14($v0) # internal_41[6] = 'n' + sb $t0, 14($v0) # internal_81[6] = 'n' addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_41[7] = ' ' + sb $t0, 15($v0) # internal_81[7] = ' ' addi $t0, $zero, 39 - sb $t0, 16($v0) # internal_41[8] = ''' + sb $t0, 16($v0) # internal_81[8] = ''' addi $t0, $zero, 56 - sb $t0, 17($v0) # internal_41[9] = '8' + sb $t0, 17($v0) # internal_81[9] = '8' addi $t0, $zero, 39 - sb $t0, 18($v0) # internal_41[10] = ''' + sb $t0, 18($v0) # internal_81[10] = ''' addi $t0, $zero, 10 - sb $t0, 19($v0) # internal_41[11] = '\n' + sb $t0, 19($v0) # internal_81[11] = '\n' sb $zero, 20($v0) # Null-terminator at the end of the string - sw $v0, 456($sp) # internal_41 = "\t20: An '8'\n" + sw $v0, 496($sp) # internal_81 = "\t20: An '8'\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 488($sp) # internal_83 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 488($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 484($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 636($sp) + lw $t0, 836($sp) sw $t0, 4($sp) # Storing self - # Argument internal_41 - lw $t0, 468($sp) - sw $t0, 0($sp) # Storing internal_41 + # Argument internal_81 + lw $t0, 508($sp) + sw $t0, 0($sp) # Storing internal_81 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_84 + lw $t0, 496($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 464($sp) # internal_42 = result of function_out_string_at_IO + sw $v1, 504($sp) # internal_82 = result of internal_84 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -10617,61 +12084,85 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 9 - sb $t0, 8($v0) # internal_43[0] = '\t' + sb $t0, 8($v0) # internal_85[0] = '\t' addi $t0, $zero, 50 - sb $t0, 9($v0) # internal_43[1] = '2' + sb $t0, 9($v0) # internal_85[1] = '2' addi $t0, $zero, 49 - sb $t0, 10($v0) # internal_43[2] = '1' + sb $t0, 10($v0) # internal_85[2] = '1' addi $t0, $zero, 58 - sb $t0, 11($v0) # internal_43[3] = ':' + sb $t0, 11($v0) # internal_85[3] = ':' addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_43[4] = ' ' + sb $t0, 12($v0) # internal_85[4] = ' ' addi $t0, $zero, 65 - sb $t0, 13($v0) # internal_43[5] = 'A' + sb $t0, 13($v0) # internal_85[5] = 'A' addi $t0, $zero, 110 - sb $t0, 14($v0) # internal_43[6] = 'n' + sb $t0, 14($v0) # internal_85[6] = 'n' addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_43[7] = ' ' + sb $t0, 15($v0) # internal_85[7] = ' ' addi $t0, $zero, 39 - sb $t0, 16($v0) # internal_43[8] = ''' + sb $t0, 16($v0) # internal_85[8] = ''' addi $t0, $zero, 83 - sb $t0, 17($v0) # internal_43[9] = 'S' + sb $t0, 17($v0) # internal_85[9] = 'S' addi $t0, $zero, 39 - sb $t0, 18($v0) # internal_43[10] = ''' + sb $t0, 18($v0) # internal_85[10] = ''' addi $t0, $zero, 10 - sb $t0, 19($v0) # internal_43[11] = '\n' + sb $t0, 19($v0) # internal_85[11] = '\n' sb $zero, 20($v0) # Null-terminator at the end of the string - sw $v0, 448($sp) # internal_43 = "\t21: An 'S'\n" - - # Passing function arguments - addi $sp, $sp, -12 # Reserving space for arguments - sw $ra, 8($sp) # Storing return address + sw $v0, 480($sp) # internal_85 = "\t21: An 'S'\n" - # Argument self - lw $t0, 636($sp) - sw $t0, 4($sp) # Storing self + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall - # Argument internal_43 - lw $t0, 460($sp) - sw $t0, 0($sp) # Storing internal_43 + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 472($sp) # internal_87 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 472($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 468($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 836($sp) + sw $t0, 4($sp) # Storing self - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Argument internal_85 + lw $t0, 492($sp) + sw $t0, 0($sp) # Storing internal_85 + + # Calling function internal_88 + lw $t0, 480($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 456($sp) # internal_44 = result of function_out_string_at_IO + sw $v1, 488($sp) # internal_86 = result of internal_88 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -10686,84 +12177,132 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 89 - sb $t0, 8($v0) # internal_45[0] = 'Y' + sb $t0, 8($v0) # internal_89[0] = 'Y' addi $t0, $zero, 111 - sb $t0, 9($v0) # internal_45[1] = 'o' + sb $t0, 9($v0) # internal_89[1] = 'o' addi $t0, $zero, 117 - sb $t0, 10($v0) # internal_45[2] = 'u' + sb $t0, 10($v0) # internal_89[2] = 'u' addi $t0, $zero, 114 - sb $t0, 11($v0) # internal_45[3] = 'r' + sb $t0, 11($v0) # internal_89[3] = 'r' addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_45[4] = ' ' + sb $t0, 12($v0) # internal_89[4] = ' ' addi $t0, $zero, 99 - sb $t0, 13($v0) # internal_45[5] = 'c' + sb $t0, 13($v0) # internal_89[5] = 'c' addi $t0, $zero, 104 - sb $t0, 14($v0) # internal_45[6] = 'h' + sb $t0, 14($v0) # internal_89[6] = 'h' addi $t0, $zero, 111 - sb $t0, 15($v0) # internal_45[7] = 'o' + sb $t0, 15($v0) # internal_89[7] = 'o' addi $t0, $zero, 105 - sb $t0, 16($v0) # internal_45[8] = 'i' + sb $t0, 16($v0) # internal_89[8] = 'i' addi $t0, $zero, 99 - sb $t0, 17($v0) # internal_45[9] = 'c' + sb $t0, 17($v0) # internal_89[9] = 'c' addi $t0, $zero, 101 - sb $t0, 18($v0) # internal_45[10] = 'e' + sb $t0, 18($v0) # internal_89[10] = 'e' addi $t0, $zero, 32 - sb $t0, 19($v0) # internal_45[11] = ' ' + sb $t0, 19($v0) # internal_89[11] = ' ' addi $t0, $zero, 61 - sb $t0, 20($v0) # internal_45[12] = '=' + sb $t0, 20($v0) # internal_89[12] = '=' addi $t0, $zero, 62 - sb $t0, 21($v0) # internal_45[13] = '>' + sb $t0, 21($v0) # internal_89[13] = '>' addi $t0, $zero, 32 - sb $t0, 22($v0) # internal_45[14] = ' ' + sb $t0, 22($v0) # internal_89[14] = ' ' sb $zero, 23($v0) # Null-terminator at the end of the string - sw $v0, 440($sp) # internal_45 = "Your choice => " + sw $v0, 464($sp) # internal_89 = "Your choice => " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 456($sp) # internal_91 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 456($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 452($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 636($sp) + lw $t0, 836($sp) sw $t0, 4($sp) # Storing self - # Argument internal_45 - lw $t0, 452($sp) - sw $t0, 0($sp) # Storing internal_45 + # Argument internal_89 + lw $t0, 476($sp) + sw $t0, 0($sp) # Storing internal_89 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_92 + lw $t0, 464($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 448($sp) # internal_46 = result of function_out_string_at_IO + sw $v1, 472($sp) # internal_90 = result of internal_92 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 444($sp) # internal_94 = address of allocated object Int + + # Get method in_int of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 444($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 440($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 632($sp) + lw $t0, 832($sp) sw $t0, 0($sp) # Storing self - # Calling function function_in_int_at_IO - jal function_in_int_at_IO + # Calling function internal_95 + lw $t0, 448($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 440($sp) # internal_47 = result of function_in_int_at_IO + sw $v1, 456($sp) # internal_93 = result of internal_95 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments @@ -10771,17 +12310,17 @@ sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 632($sp) + lw $t0, 832($sp) sw $t0, 4($sp) # Storing num - # Argument internal_47 - lw $t0, 444($sp) - sw $t0, 0($sp) # Storing internal_47 + # Argument internal_93 + lw $t0, 460($sp) + sw $t0, 0($sp) # Storing internal_93 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 632($sp) # num = result of function_assign + sw $v1, 832($sp) # num = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -10796,28 +12335,52 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_48[0] = '\n' + sb $t0, 8($v0) # internal_96[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 428($sp) # internal_48 = "\n" + sw $v0, 436($sp) # internal_96 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 428($sp) # internal_98 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 428($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 424($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 636($sp) + lw $t0, 836($sp) sw $t0, 4($sp) # Storing self - # Argument internal_48 - lw $t0, 440($sp) - sw $t0, 0($sp) # Storing internal_48 + # Argument internal_96 + lw $t0, 448($sp) + sw $t0, 0($sp) # Storing internal_96 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_99 + lw $t0, 436($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 436($sp) # internal_49 = result of function_out_string_at_IO + sw $v1, 444($sp) # internal_97 = result of internal_99 addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bool 0 @@ -10830,7 +12393,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 416($sp) # internal_51 = address of allocated object Int + sw $v0, 416($sp) # internal_101 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -10842,40 +12405,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 412($sp) # internal_52 = address of allocated object Int + sw $v0, 412($sp) # internal_102 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 632($sp) + lw $t0, 832($sp) sw $t0, 4($sp) # Storing num - # Argument internal_52 + # Argument internal_102 lw $t0, 424($sp) - sw $t0, 0($sp) # Storing internal_52 + sw $t0, 0($sp) # Storing internal_102 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 420($sp) # internal_53 = result of function_equal + sw $v1, 420($sp) # internal_103 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_51 = internal_53 + # internal_101 = internal_103 lw $t0, 408($sp) sw $t0, 416($sp) - # If internal_51 then goto then_8768338410734 + # If internal_101 then goto then_8737379857231 lw $t0, 416($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338410734 + beq $t0, $t1, then_8737379857231 - # Jumping to else_8768338410734 - j else_8768338410734 + # Jumping to else_8737379857231 + j else_8737379857231 - then_8768338410734: + then_8737379857231: # Allocating String li $v0, 9 @@ -10889,77 +12452,77 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_54[0] = ' ' + sb $t0, 8($v0) # internal_104[0] = ' ' addi $t0, $zero, 88 - sb $t0, 9($v0) # internal_54[1] = 'X' + sb $t0, 9($v0) # internal_104[1] = 'X' addi $t0, $zero, 88 - sb $t0, 10($v0) # internal_54[2] = 'X' + sb $t0, 10($v0) # internal_104[2] = 'X' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_54[3] = ' ' + sb $t0, 11($v0) # internal_104[3] = ' ' addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_54[4] = ' ' + sb $t0, 12($v0) # internal_104[4] = ' ' addi $t0, $zero, 88 - sb $t0, 13($v0) # internal_54[5] = 'X' + sb $t0, 13($v0) # internal_104[5] = 'X' addi $t0, $zero, 88 - sb $t0, 14($v0) # internal_54[6] = 'X' + sb $t0, 14($v0) # internal_104[6] = 'X' addi $t0, $zero, 88 - sb $t0, 15($v0) # internal_54[7] = 'X' + sb $t0, 15($v0) # internal_104[7] = 'X' addi $t0, $zero, 88 - sb $t0, 16($v0) # internal_54[8] = 'X' + sb $t0, 16($v0) # internal_104[8] = 'X' addi $t0, $zero, 32 - sb $t0, 17($v0) # internal_54[9] = ' ' + sb $t0, 17($v0) # internal_104[9] = ' ' addi $t0, $zero, 88 - sb $t0, 18($v0) # internal_54[10] = 'X' + sb $t0, 18($v0) # internal_104[10] = 'X' addi $t0, $zero, 88 - sb $t0, 19($v0) # internal_54[11] = 'X' + sb $t0, 19($v0) # internal_104[11] = 'X' addi $t0, $zero, 88 - sb $t0, 20($v0) # internal_54[12] = 'X' + sb $t0, 20($v0) # internal_104[12] = 'X' addi $t0, $zero, 88 - sb $t0, 21($v0) # internal_54[13] = 'X' + sb $t0, 21($v0) # internal_104[13] = 'X' addi $t0, $zero, 32 - sb $t0, 22($v0) # internal_54[14] = ' ' + sb $t0, 22($v0) # internal_104[14] = ' ' addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_54[15] = ' ' + sb $t0, 23($v0) # internal_104[15] = ' ' addi $t0, $zero, 88 - sb $t0, 24($v0) # internal_54[16] = 'X' + sb $t0, 24($v0) # internal_104[16] = 'X' addi $t0, $zero, 88 - sb $t0, 25($v0) # internal_54[17] = 'X' + sb $t0, 25($v0) # internal_104[17] = 'X' addi $t0, $zero, 32 - sb $t0, 26($v0) # internal_54[18] = ' ' + sb $t0, 26($v0) # internal_104[18] = ' ' addi $t0, $zero, 32 - sb $t0, 27($v0) # internal_54[19] = ' ' + sb $t0, 27($v0) # internal_104[19] = ' ' sb $zero, 28($v0) # Null-terminator at the end of the string - sw $v0, 404($sp) # internal_54 = " XX XXXX XXXX XX " + sw $v0, 404($sp) # internal_104 = " XX XXXX XXXX XX " - # internal_50 = internal_54 + # internal_100 = internal_104 lw $t0, 404($sp) sw $t0, 420($sp) - # Jumping to endif_8768338410734 - j endif_8768338410734 + # Jumping to endif_8737379857231 + j endif_8737379857231 - else_8768338410734: + else_8737379857231: # Allocating Bool 0 li $v0, 9 @@ -10971,7 +12534,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 396($sp) # internal_56 = address of allocated object Int + sw $v0, 396($sp) # internal_106 = address of allocated object Int # Allocating Int 2 li $v0, 9 @@ -10983,40 +12546,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 392($sp) # internal_57 = address of allocated object Int + sw $v0, 392($sp) # internal_107 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 632($sp) + lw $t0, 832($sp) sw $t0, 4($sp) # Storing num - # Argument internal_57 + # Argument internal_107 lw $t0, 404($sp) - sw $t0, 0($sp) # Storing internal_57 + sw $t0, 0($sp) # Storing internal_107 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 400($sp) # internal_58 = result of function_equal + sw $v1, 400($sp) # internal_108 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_56 = internal_58 + # internal_106 = internal_108 lw $t0, 388($sp) sw $t0, 396($sp) - # If internal_56 then goto then_8768338410728 + # If internal_106 then goto then_8737379857225 lw $t0, 396($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338410728 + beq $t0, $t1, then_8737379857225 - # Jumping to else_8768338410728 - j else_8768338410728 + # Jumping to else_8737379857225 + j else_8737379857225 - then_8768338410728: + then_8737379857225: # Allocating String li $v0, 9 @@ -11030,92 +12593,92 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_59[0] = ' ' + sb $t0, 8($v0) # internal_109[0] = ' ' addi $t0, $zero, 32 - sb $t0, 9($v0) # internal_59[1] = ' ' + sb $t0, 9($v0) # internal_109[1] = ' ' addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_59[2] = ' ' + sb $t0, 10($v0) # internal_109[2] = ' ' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_59[3] = ' ' + sb $t0, 11($v0) # internal_109[3] = ' ' addi $t0, $zero, 88 - sb $t0, 12($v0) # internal_59[4] = 'X' + sb $t0, 12($v0) # internal_109[4] = 'X' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_59[5] = ' ' + sb $t0, 13($v0) # internal_109[5] = ' ' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_59[6] = ' ' + sb $t0, 14($v0) # internal_109[6] = ' ' addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_59[7] = ' ' + sb $t0, 15($v0) # internal_109[7] = ' ' addi $t0, $zero, 88 - sb $t0, 16($v0) # internal_59[8] = 'X' + sb $t0, 16($v0) # internal_109[8] = 'X' addi $t0, $zero, 32 - sb $t0, 17($v0) # internal_59[9] = ' ' + sb $t0, 17($v0) # internal_109[9] = ' ' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_59[10] = ' ' + sb $t0, 18($v0) # internal_109[10] = ' ' addi $t0, $zero, 32 - sb $t0, 19($v0) # internal_59[11] = ' ' + sb $t0, 19($v0) # internal_109[11] = ' ' addi $t0, $zero, 88 - sb $t0, 20($v0) # internal_59[12] = 'X' + sb $t0, 20($v0) # internal_109[12] = 'X' addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_59[13] = ' ' + sb $t0, 21($v0) # internal_109[13] = ' ' addi $t0, $zero, 32 - sb $t0, 22($v0) # internal_59[14] = ' ' + sb $t0, 22($v0) # internal_109[14] = ' ' addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_59[15] = ' ' + sb $t0, 23($v0) # internal_109[15] = ' ' addi $t0, $zero, 88 - sb $t0, 24($v0) # internal_59[16] = 'X' + sb $t0, 24($v0) # internal_109[16] = 'X' addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_59[17] = ' ' + sb $t0, 25($v0) # internal_109[17] = ' ' addi $t0, $zero, 32 - sb $t0, 26($v0) # internal_59[18] = ' ' + sb $t0, 26($v0) # internal_109[18] = ' ' addi $t0, $zero, 32 - sb $t0, 27($v0) # internal_59[19] = ' ' + sb $t0, 27($v0) # internal_109[19] = ' ' addi $t0, $zero, 88 - sb $t0, 28($v0) # internal_59[20] = 'X' + sb $t0, 28($v0) # internal_109[20] = 'X' addi $t0, $zero, 32 - sb $t0, 29($v0) # internal_59[21] = ' ' + sb $t0, 29($v0) # internal_109[21] = ' ' addi $t0, $zero, 32 - sb $t0, 30($v0) # internal_59[22] = ' ' + sb $t0, 30($v0) # internal_109[22] = ' ' addi $t0, $zero, 32 - sb $t0, 31($v0) # internal_59[23] = ' ' + sb $t0, 31($v0) # internal_109[23] = ' ' addi $t0, $zero, 32 - sb $t0, 32($v0) # internal_59[24] = ' ' + sb $t0, 32($v0) # internal_109[24] = ' ' sb $zero, 33($v0) # Null-terminator at the end of the string - sw $v0, 384($sp) # internal_59 = " X X X X X " + sw $v0, 384($sp) # internal_109 = " X X X X X " - # internal_55 = internal_59 + # internal_105 = internal_109 lw $t0, 384($sp) sw $t0, 400($sp) - # Jumping to endif_8768338410728 - j endif_8768338410728 + # Jumping to endif_8737379857225 + j endif_8737379857225 - else_8768338410728: + else_8737379857225: # Allocating Bool 0 li $v0, 9 @@ -11127,7 +12690,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 376($sp) # internal_61 = address of allocated object Int + sw $v0, 376($sp) # internal_111 = address of allocated object Int # Allocating Int 3 li $v0, 9 @@ -11139,40 +12702,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 372($sp) # internal_62 = address of allocated object Int + sw $v0, 372($sp) # internal_112 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 632($sp) + lw $t0, 832($sp) sw $t0, 4($sp) # Storing num - # Argument internal_62 + # Argument internal_112 lw $t0, 384($sp) - sw $t0, 0($sp) # Storing internal_62 + sw $t0, 0($sp) # Storing internal_112 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 380($sp) # internal_63 = result of function_equal + sw $v1, 380($sp) # internal_113 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_61 = internal_63 + # internal_111 = internal_113 lw $t0, 368($sp) sw $t0, 376($sp) - # If internal_61 then goto then_8768338410722 + # If internal_111 then goto then_8737379857219 lw $t0, 376($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338410722 + beq $t0, $t1, then_8737379857219 - # Jumping to else_8768338410722 - j else_8768338410722 + # Jumping to else_8737379857219 + j else_8737379857219 - then_8768338410722: + then_8737379857219: # Allocating String li $v0, 9 @@ -11186,92 +12749,92 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 - sb $t0, 8($v0) # internal_64[0] = 'X' + sb $t0, 8($v0) # internal_114[0] = 'X' addi $t0, $zero, 32 - sb $t0, 9($v0) # internal_64[1] = ' ' + sb $t0, 9($v0) # internal_114[1] = ' ' addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_64[2] = ' ' + sb $t0, 10($v0) # internal_114[2] = ' ' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_64[3] = ' ' + sb $t0, 11($v0) # internal_114[3] = ' ' addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_64[4] = ' ' + sb $t0, 12($v0) # internal_114[4] = ' ' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_64[5] = ' ' + sb $t0, 13($v0) # internal_114[5] = ' ' addi $t0, $zero, 88 - sb $t0, 14($v0) # internal_64[6] = 'X' + sb $t0, 14($v0) # internal_114[6] = 'X' addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_64[7] = ' ' + sb $t0, 15($v0) # internal_114[7] = ' ' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_64[8] = ' ' + sb $t0, 16($v0) # internal_114[8] = ' ' addi $t0, $zero, 32 - sb $t0, 17($v0) # internal_64[9] = ' ' + sb $t0, 17($v0) # internal_114[9] = ' ' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_64[10] = ' ' + sb $t0, 18($v0) # internal_114[10] = ' ' addi $t0, $zero, 32 - sb $t0, 19($v0) # internal_64[11] = ' ' + sb $t0, 19($v0) # internal_114[11] = ' ' addi $t0, $zero, 88 - sb $t0, 20($v0) # internal_64[12] = 'X' + sb $t0, 20($v0) # internal_114[12] = 'X' addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_64[13] = ' ' + sb $t0, 21($v0) # internal_114[13] = ' ' addi $t0, $zero, 32 - sb $t0, 22($v0) # internal_64[14] = ' ' + sb $t0, 22($v0) # internal_114[14] = ' ' addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_64[15] = ' ' + sb $t0, 23($v0) # internal_114[15] = ' ' addi $t0, $zero, 32 - sb $t0, 24($v0) # internal_64[16] = ' ' + sb $t0, 24($v0) # internal_114[16] = ' ' addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_64[17] = ' ' + sb $t0, 25($v0) # internal_114[17] = ' ' addi $t0, $zero, 88 - sb $t0, 26($v0) # internal_64[18] = 'X' + sb $t0, 26($v0) # internal_114[18] = 'X' addi $t0, $zero, 32 - sb $t0, 27($v0) # internal_64[19] = ' ' + sb $t0, 27($v0) # internal_114[19] = ' ' addi $t0, $zero, 32 - sb $t0, 28($v0) # internal_64[20] = ' ' + sb $t0, 28($v0) # internal_114[20] = ' ' addi $t0, $zero, 32 - sb $t0, 29($v0) # internal_64[21] = ' ' + sb $t0, 29($v0) # internal_114[21] = ' ' addi $t0, $zero, 32 - sb $t0, 30($v0) # internal_64[22] = ' ' + sb $t0, 30($v0) # internal_114[22] = ' ' addi $t0, $zero, 32 - sb $t0, 31($v0) # internal_64[23] = ' ' + sb $t0, 31($v0) # internal_114[23] = ' ' addi $t0, $zero, 88 - sb $t0, 32($v0) # internal_64[24] = 'X' + sb $t0, 32($v0) # internal_114[24] = 'X' sb $zero, 33($v0) # Null-terminator at the end of the string - sw $v0, 364($sp) # internal_64 = "X X X X X" + sw $v0, 364($sp) # internal_114 = "X X X X X" - # internal_60 = internal_64 + # internal_110 = internal_114 lw $t0, 364($sp) sw $t0, 380($sp) - # Jumping to endif_8768338410722 - j endif_8768338410722 + # Jumping to endif_8737379857219 + j endif_8737379857219 - else_8768338410722: + else_8737379857219: # Allocating Bool 0 li $v0, 9 @@ -11283,7 +12846,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 356($sp) # internal_66 = address of allocated object Int + sw $v0, 356($sp) # internal_116 = address of allocated object Int # Allocating Int 4 li $v0, 9 @@ -11295,40 +12858,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 352($sp) # internal_67 = address of allocated object Int + sw $v0, 352($sp) # internal_117 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 632($sp) + lw $t0, 832($sp) sw $t0, 4($sp) # Storing num - # Argument internal_67 + # Argument internal_117 lw $t0, 364($sp) - sw $t0, 0($sp) # Storing internal_67 + sw $t0, 0($sp) # Storing internal_117 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 360($sp) # internal_68 = result of function_equal + sw $v1, 360($sp) # internal_118 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_66 = internal_68 + # internal_116 = internal_118 lw $t0, 348($sp) sw $t0, 356($sp) - # If internal_66 then goto then_8768338410716 + # If internal_116 then goto then_8737379857213 lw $t0, 356($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338410716 + beq $t0, $t1, then_8737379857213 - # Jumping to else_8768338410716 - j else_8768338410716 + # Jumping to else_8737379857213 + j else_8737379857213 - then_8768338410716: + then_8737379857213: # Allocating String li $v0, 9 @@ -11342,92 +12905,92 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 - sb $t0, 8($v0) # internal_69[0] = 'X' + sb $t0, 8($v0) # internal_119[0] = 'X' addi $t0, $zero, 32 - sb $t0, 9($v0) # internal_69[1] = ' ' + sb $t0, 9($v0) # internal_119[1] = ' ' addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_69[2] = ' ' + sb $t0, 10($v0) # internal_119[2] = ' ' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_69[3] = ' ' + sb $t0, 11($v0) # internal_119[3] = ' ' addi $t0, $zero, 88 - sb $t0, 12($v0) # internal_69[4] = 'X' + sb $t0, 12($v0) # internal_119[4] = 'X' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_69[5] = ' ' + sb $t0, 13($v0) # internal_119[5] = ' ' addi $t0, $zero, 88 - sb $t0, 14($v0) # internal_69[6] = 'X' + sb $t0, 14($v0) # internal_119[6] = 'X' addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_69[7] = ' ' + sb $t0, 15($v0) # internal_119[7] = ' ' addi $t0, $zero, 88 - sb $t0, 16($v0) # internal_69[8] = 'X' + sb $t0, 16($v0) # internal_119[8] = 'X' addi $t0, $zero, 32 - sb $t0, 17($v0) # internal_69[9] = ' ' + sb $t0, 17($v0) # internal_119[9] = ' ' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_69[10] = ' ' + sb $t0, 18($v0) # internal_119[10] = ' ' addi $t0, $zero, 32 - sb $t0, 19($v0) # internal_69[11] = ' ' + sb $t0, 19($v0) # internal_119[11] = ' ' addi $t0, $zero, 88 - sb $t0, 20($v0) # internal_69[12] = 'X' + sb $t0, 20($v0) # internal_119[12] = 'X' addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_69[13] = ' ' + sb $t0, 21($v0) # internal_119[13] = ' ' addi $t0, $zero, 32 - sb $t0, 22($v0) # internal_69[14] = ' ' + sb $t0, 22($v0) # internal_119[14] = ' ' addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_69[15] = ' ' + sb $t0, 23($v0) # internal_119[15] = ' ' addi $t0, $zero, 88 - sb $t0, 24($v0) # internal_69[16] = 'X' + sb $t0, 24($v0) # internal_119[16] = 'X' addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_69[17] = ' ' + sb $t0, 25($v0) # internal_119[17] = ' ' addi $t0, $zero, 88 - sb $t0, 26($v0) # internal_69[18] = 'X' + sb $t0, 26($v0) # internal_119[18] = 'X' addi $t0, $zero, 32 - sb $t0, 27($v0) # internal_69[19] = ' ' + sb $t0, 27($v0) # internal_119[19] = ' ' addi $t0, $zero, 88 - sb $t0, 28($v0) # internal_69[20] = 'X' + sb $t0, 28($v0) # internal_119[20] = 'X' addi $t0, $zero, 32 - sb $t0, 29($v0) # internal_69[21] = ' ' + sb $t0, 29($v0) # internal_119[21] = ' ' addi $t0, $zero, 32 - sb $t0, 30($v0) # internal_69[22] = ' ' + sb $t0, 30($v0) # internal_119[22] = ' ' addi $t0, $zero, 32 - sb $t0, 31($v0) # internal_69[23] = ' ' + sb $t0, 31($v0) # internal_119[23] = ' ' addi $t0, $zero, 88 - sb $t0, 32($v0) # internal_69[24] = 'X' + sb $t0, 32($v0) # internal_119[24] = 'X' sb $zero, 33($v0) # Null-terminator at the end of the string - sw $v0, 344($sp) # internal_69 = "X X X X X X X X X" + sw $v0, 344($sp) # internal_119 = "X X X X X X X X X" - # internal_65 = internal_69 + # internal_115 = internal_119 lw $t0, 344($sp) sw $t0, 360($sp) - # Jumping to endif_8768338410716 - j endif_8768338410716 + # Jumping to endif_8737379857213 + j endif_8737379857213 - else_8768338410716: + else_8737379857213: # Allocating Bool 0 li $v0, 9 @@ -11439,7 +13002,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 336($sp) # internal_71 = address of allocated object Int + sw $v0, 336($sp) # internal_121 = address of allocated object Int # Allocating Int 5 li $v0, 9 @@ -11451,40 +13014,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 5 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 332($sp) # internal_72 = address of allocated object Int + sw $v0, 332($sp) # internal_122 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 632($sp) + lw $t0, 832($sp) sw $t0, 4($sp) # Storing num - # Argument internal_72 + # Argument internal_122 lw $t0, 344($sp) - sw $t0, 0($sp) # Storing internal_72 + sw $t0, 0($sp) # Storing internal_122 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 340($sp) # internal_73 = result of function_equal + sw $v1, 340($sp) # internal_123 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_71 = internal_73 + # internal_121 = internal_123 lw $t0, 328($sp) sw $t0, 336($sp) - # If internal_71 then goto then_8768338410710 + # If internal_121 then goto then_8737379857207 lw $t0, 336($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338410710 + beq $t0, $t1, then_8737379857207 - # Jumping to else_8768338410710 - j else_8768338410710 + # Jumping to else_8737379857207 + j else_8737379857207 - then_8768338410710: + then_8737379857207: # Allocating String li $v0, 9 @@ -11498,92 +13061,92 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 - sb $t0, 8($v0) # internal_74[0] = 'X' + sb $t0, 8($v0) # internal_124[0] = 'X' addi $t0, $zero, 32 - sb $t0, 9($v0) # internal_74[1] = ' ' + sb $t0, 9($v0) # internal_124[1] = ' ' addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_74[2] = ' ' + sb $t0, 10($v0) # internal_124[2] = ' ' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_74[3] = ' ' + sb $t0, 11($v0) # internal_124[3] = ' ' addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_74[4] = ' ' + sb $t0, 12($v0) # internal_124[4] = ' ' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_74[5] = ' ' + sb $t0, 13($v0) # internal_124[5] = ' ' addi $t0, $zero, 88 - sb $t0, 14($v0) # internal_74[6] = 'X' + sb $t0, 14($v0) # internal_124[6] = 'X' addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_74[7] = ' ' + sb $t0, 15($v0) # internal_124[7] = ' ' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_74[8] = ' ' + sb $t0, 16($v0) # internal_124[8] = ' ' addi $t0, $zero, 32 - sb $t0, 17($v0) # internal_74[9] = ' ' + sb $t0, 17($v0) # internal_124[9] = ' ' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_74[10] = ' ' + sb $t0, 18($v0) # internal_124[10] = ' ' addi $t0, $zero, 32 - sb $t0, 19($v0) # internal_74[11] = ' ' + sb $t0, 19($v0) # internal_124[11] = ' ' addi $t0, $zero, 88 - sb $t0, 20($v0) # internal_74[12] = 'X' + sb $t0, 20($v0) # internal_124[12] = 'X' addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_74[13] = ' ' + sb $t0, 21($v0) # internal_124[13] = ' ' addi $t0, $zero, 32 - sb $t0, 22($v0) # internal_74[14] = ' ' + sb $t0, 22($v0) # internal_124[14] = ' ' addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_74[15] = ' ' + sb $t0, 23($v0) # internal_124[15] = ' ' addi $t0, $zero, 88 - sb $t0, 24($v0) # internal_74[16] = 'X' + sb $t0, 24($v0) # internal_124[16] = 'X' addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_74[17] = ' ' + sb $t0, 25($v0) # internal_124[17] = ' ' addi $t0, $zero, 32 - sb $t0, 26($v0) # internal_74[18] = ' ' + sb $t0, 26($v0) # internal_124[18] = ' ' addi $t0, $zero, 32 - sb $t0, 27($v0) # internal_74[19] = ' ' + sb $t0, 27($v0) # internal_124[19] = ' ' addi $t0, $zero, 88 - sb $t0, 28($v0) # internal_74[20] = 'X' + sb $t0, 28($v0) # internal_124[20] = 'X' addi $t0, $zero, 32 - sb $t0, 29($v0) # internal_74[21] = ' ' + sb $t0, 29($v0) # internal_124[21] = ' ' addi $t0, $zero, 32 - sb $t0, 30($v0) # internal_74[22] = ' ' + sb $t0, 30($v0) # internal_124[22] = ' ' addi $t0, $zero, 32 - sb $t0, 31($v0) # internal_74[23] = ' ' + sb $t0, 31($v0) # internal_124[23] = ' ' addi $t0, $zero, 32 - sb $t0, 32($v0) # internal_74[24] = ' ' + sb $t0, 32($v0) # internal_124[24] = ' ' sb $zero, 33($v0) # Null-terminator at the end of the string - sw $v0, 324($sp) # internal_74 = "X X X X X " + sw $v0, 324($sp) # internal_124 = "X X X X X " - # internal_70 = internal_74 + # internal_120 = internal_124 lw $t0, 324($sp) sw $t0, 340($sp) - # Jumping to endif_8768338410710 - j endif_8768338410710 + # Jumping to endif_8737379857207 + j endif_8737379857207 - else_8768338410710: + else_8737379857207: # Allocating Bool 0 li $v0, 9 @@ -11595,7 +13158,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 316($sp) # internal_76 = address of allocated object Int + sw $v0, 316($sp) # internal_126 = address of allocated object Int # Allocating Int 6 li $v0, 9 @@ -11607,40 +13170,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 6 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 312($sp) # internal_77 = address of allocated object Int + sw $v0, 312($sp) # internal_127 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 632($sp) + lw $t0, 832($sp) sw $t0, 4($sp) # Storing num - # Argument internal_77 + # Argument internal_127 lw $t0, 324($sp) - sw $t0, 0($sp) # Storing internal_77 + sw $t0, 0($sp) # Storing internal_127 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 320($sp) # internal_78 = result of function_equal + sw $v1, 320($sp) # internal_128 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_76 = internal_78 + # internal_126 = internal_128 lw $t0, 308($sp) sw $t0, 316($sp) - # If internal_76 then goto then_8768338410704 + # If internal_126 then goto then_8737379857201 lw $t0, 316($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338410704 + beq $t0, $t1, then_8737379857201 - # Jumping to else_8768338410704 - j else_8768338410704 + # Jumping to else_8737379857201 + j else_8737379857201 - then_8768338410704: + then_8737379857201: # Allocating String li $v0, 9 @@ -11654,92 +13217,92 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_79[0] = ' ' + sb $t0, 8($v0) # internal_129[0] = ' ' addi $t0, $zero, 32 - sb $t0, 9($v0) # internal_79[1] = ' ' + sb $t0, 9($v0) # internal_129[1] = ' ' addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_79[2] = ' ' + sb $t0, 10($v0) # internal_129[2] = ' ' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_79[3] = ' ' + sb $t0, 11($v0) # internal_129[3] = ' ' addi $t0, $zero, 88 - sb $t0, 12($v0) # internal_79[4] = 'X' + sb $t0, 12($v0) # internal_129[4] = 'X' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_79[5] = ' ' + sb $t0, 13($v0) # internal_129[5] = ' ' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_79[6] = ' ' + sb $t0, 14($v0) # internal_129[6] = ' ' addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_79[7] = ' ' + sb $t0, 15($v0) # internal_129[7] = ' ' addi $t0, $zero, 88 - sb $t0, 16($v0) # internal_79[8] = 'X' + sb $t0, 16($v0) # internal_129[8] = 'X' addi $t0, $zero, 32 - sb $t0, 17($v0) # internal_79[9] = ' ' + sb $t0, 17($v0) # internal_129[9] = ' ' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_79[10] = ' ' + sb $t0, 18($v0) # internal_129[10] = ' ' addi $t0, $zero, 32 - sb $t0, 19($v0) # internal_79[11] = ' ' + sb $t0, 19($v0) # internal_129[11] = ' ' addi $t0, $zero, 88 - sb $t0, 20($v0) # internal_79[12] = 'X' + sb $t0, 20($v0) # internal_129[12] = 'X' addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_79[13] = ' ' + sb $t0, 21($v0) # internal_129[13] = ' ' addi $t0, $zero, 32 - sb $t0, 22($v0) # internal_79[14] = ' ' + sb $t0, 22($v0) # internal_129[14] = ' ' addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_79[15] = ' ' + sb $t0, 23($v0) # internal_129[15] = ' ' addi $t0, $zero, 32 - sb $t0, 24($v0) # internal_79[16] = ' ' + sb $t0, 24($v0) # internal_129[16] = ' ' addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_79[17] = ' ' + sb $t0, 25($v0) # internal_129[17] = ' ' addi $t0, $zero, 88 - sb $t0, 26($v0) # internal_79[18] = 'X' + sb $t0, 26($v0) # internal_129[18] = 'X' addi $t0, $zero, 32 - sb $t0, 27($v0) # internal_79[19] = ' ' + sb $t0, 27($v0) # internal_129[19] = ' ' addi $t0, $zero, 32 - sb $t0, 28($v0) # internal_79[20] = ' ' + sb $t0, 28($v0) # internal_129[20] = ' ' addi $t0, $zero, 32 - sb $t0, 29($v0) # internal_79[21] = ' ' + sb $t0, 29($v0) # internal_129[21] = ' ' addi $t0, $zero, 32 - sb $t0, 30($v0) # internal_79[22] = ' ' + sb $t0, 30($v0) # internal_129[22] = ' ' addi $t0, $zero, 32 - sb $t0, 31($v0) # internal_79[23] = ' ' + sb $t0, 31($v0) # internal_129[23] = ' ' addi $t0, $zero, 88 - sb $t0, 32($v0) # internal_79[24] = 'X' + sb $t0, 32($v0) # internal_129[24] = 'X' sb $zero, 33($v0) # Null-terminator at the end of the string - sw $v0, 304($sp) # internal_79 = " X X X X X" + sw $v0, 304($sp) # internal_129 = " X X X X X" - # internal_75 = internal_79 + # internal_125 = internal_129 lw $t0, 304($sp) sw $t0, 320($sp) - # Jumping to endif_8768338410704 - j endif_8768338410704 + # Jumping to endif_8737379857201 + j endif_8737379857201 - else_8768338410704: + else_8737379857201: # Allocating Bool 0 li $v0, 9 @@ -11751,7 +13314,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 296($sp) # internal_81 = address of allocated object Int + sw $v0, 296($sp) # internal_131 = address of allocated object Int # Allocating Int 7 li $v0, 9 @@ -11763,40 +13326,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 7 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 292($sp) # internal_82 = address of allocated object Int + sw $v0, 292($sp) # internal_132 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 632($sp) + lw $t0, 832($sp) sw $t0, 4($sp) # Storing num - # Argument internal_82 + # Argument internal_132 lw $t0, 304($sp) - sw $t0, 0($sp) # Storing internal_82 + sw $t0, 0($sp) # Storing internal_132 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 300($sp) # internal_83 = result of function_equal + sw $v1, 300($sp) # internal_133 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_81 = internal_83 + # internal_131 = internal_133 lw $t0, 288($sp) sw $t0, 296($sp) - # If internal_81 then goto then_8768338410698 + # If internal_131 then goto then_8737379857195 lw $t0, 296($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338410698 + beq $t0, $t1, then_8737379857195 - # Jumping to else_8768338410698 - j else_8768338410698 + # Jumping to else_8737379857195 + j else_8737379857195 - then_8768338410698: + then_8737379857195: # Allocating String li $v0, 9 @@ -11810,77 +13373,77 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 - sb $t0, 8($v0) # internal_84[0] = 'X' + sb $t0, 8($v0) # internal_134[0] = 'X' addi $t0, $zero, 32 - sb $t0, 9($v0) # internal_84[1] = ' ' + sb $t0, 9($v0) # internal_134[1] = ' ' addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_84[2] = ' ' + sb $t0, 10($v0) # internal_134[2] = ' ' addi $t0, $zero, 88 - sb $t0, 11($v0) # internal_84[3] = 'X' + sb $t0, 11($v0) # internal_134[3] = 'X' addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_84[4] = ' ' + sb $t0, 12($v0) # internal_134[4] = ' ' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_84[5] = ' ' + sb $t0, 13($v0) # internal_134[5] = ' ' addi $t0, $zero, 88 - sb $t0, 14($v0) # internal_84[6] = 'X' + sb $t0, 14($v0) # internal_134[6] = 'X' addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_84[7] = ' ' + sb $t0, 15($v0) # internal_134[7] = ' ' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_84[8] = ' ' + sb $t0, 16($v0) # internal_134[8] = ' ' addi $t0, $zero, 88 - sb $t0, 17($v0) # internal_84[9] = 'X' + sb $t0, 17($v0) # internal_134[9] = 'X' addi $t0, $zero, 88 - sb $t0, 18($v0) # internal_84[10] = 'X' + sb $t0, 18($v0) # internal_134[10] = 'X' addi $t0, $zero, 32 - sb $t0, 19($v0) # internal_84[11] = ' ' + sb $t0, 19($v0) # internal_134[11] = ' ' addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_84[12] = ' ' + sb $t0, 20($v0) # internal_134[12] = ' ' addi $t0, $zero, 88 - sb $t0, 21($v0) # internal_84[13] = 'X' + sb $t0, 21($v0) # internal_134[13] = 'X' addi $t0, $zero, 32 - sb $t0, 22($v0) # internal_84[14] = ' ' + sb $t0, 22($v0) # internal_134[14] = ' ' addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_84[15] = ' ' + sb $t0, 23($v0) # internal_134[15] = ' ' addi $t0, $zero, 32 - sb $t0, 24($v0) # internal_84[16] = ' ' + sb $t0, 24($v0) # internal_134[16] = ' ' addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_84[17] = ' ' + sb $t0, 25($v0) # internal_134[17] = ' ' addi $t0, $zero, 32 - sb $t0, 26($v0) # internal_84[18] = ' ' + sb $t0, 26($v0) # internal_134[18] = ' ' addi $t0, $zero, 32 - sb $t0, 27($v0) # internal_84[19] = ' ' + sb $t0, 27($v0) # internal_134[19] = ' ' sb $zero, 28($v0) # Null-terminator at the end of the string - sw $v0, 284($sp) # internal_84 = "X X X XX X " + sw $v0, 284($sp) # internal_134 = "X X X XX X " - # internal_80 = internal_84 + # internal_130 = internal_134 lw $t0, 284($sp) sw $t0, 300($sp) - # Jumping to endif_8768338410698 - j endif_8768338410698 + # Jumping to endif_8737379857195 + j endif_8737379857195 - else_8768338410698: + else_8737379857195: # Allocating Bool 0 li $v0, 9 @@ -11892,7 +13455,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 276($sp) # internal_86 = address of allocated object Int + sw $v0, 276($sp) # internal_136 = address of allocated object Int # Allocating Int 8 li $v0, 9 @@ -11904,40 +13467,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 8 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 272($sp) # internal_87 = address of allocated object Int + sw $v0, 272($sp) # internal_137 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 632($sp) + lw $t0, 832($sp) sw $t0, 4($sp) # Storing num - # Argument internal_87 + # Argument internal_137 lw $t0, 284($sp) - sw $t0, 0($sp) # Storing internal_87 + sw $t0, 0($sp) # Storing internal_137 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 280($sp) # internal_88 = result of function_equal + sw $v1, 280($sp) # internal_138 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_86 = internal_88 + # internal_136 = internal_138 lw $t0, 268($sp) sw $t0, 276($sp) - # If internal_86 then goto then_8768338410692 + # If internal_136 then goto then_8737379857189 lw $t0, 276($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338410692 + beq $t0, $t1, then_8737379857189 - # Jumping to else_8768338410692 - j else_8768338410692 + # Jumping to else_8737379857189 + j else_8737379857189 - then_8768338410692: + then_8737379857189: # Allocating String li $v0, 9 @@ -11951,77 +13514,77 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_89[0] = ' ' + sb $t0, 8($v0) # internal_139[0] = ' ' addi $t0, $zero, 88 - sb $t0, 9($v0) # internal_89[1] = 'X' + sb $t0, 9($v0) # internal_139[1] = 'X' addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_89[2] = ' ' + sb $t0, 10($v0) # internal_139[2] = ' ' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_89[3] = ' ' + sb $t0, 11($v0) # internal_139[3] = ' ' addi $t0, $zero, 88 - sb $t0, 12($v0) # internal_89[4] = 'X' + sb $t0, 12($v0) # internal_139[4] = 'X' addi $t0, $zero, 88 - sb $t0, 13($v0) # internal_89[5] = 'X' + sb $t0, 13($v0) # internal_139[5] = 'X' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_89[6] = ' ' + sb $t0, 14($v0) # internal_139[6] = ' ' addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_89[7] = ' ' + sb $t0, 15($v0) # internal_139[7] = ' ' addi $t0, $zero, 88 - sb $t0, 16($v0) # internal_89[8] = 'X' + sb $t0, 16($v0) # internal_139[8] = 'X' addi $t0, $zero, 32 - sb $t0, 17($v0) # internal_89[9] = ' ' + sb $t0, 17($v0) # internal_139[9] = ' ' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_89[10] = ' ' + sb $t0, 18($v0) # internal_139[10] = ' ' addi $t0, $zero, 88 - sb $t0, 19($v0) # internal_89[11] = 'X' + sb $t0, 19($v0) # internal_139[11] = 'X' addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_89[12] = ' ' + sb $t0, 20($v0) # internal_139[12] = ' ' addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_89[13] = ' ' + sb $t0, 21($v0) # internal_139[13] = ' ' addi $t0, $zero, 88 - sb $t0, 22($v0) # internal_89[14] = 'X' + sb $t0, 22($v0) # internal_139[14] = 'X' addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_89[15] = ' ' + sb $t0, 23($v0) # internal_139[15] = ' ' addi $t0, $zero, 32 - sb $t0, 24($v0) # internal_89[16] = ' ' + sb $t0, 24($v0) # internal_139[16] = ' ' addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_89[17] = ' ' + sb $t0, 25($v0) # internal_139[17] = ' ' addi $t0, $zero, 32 - sb $t0, 26($v0) # internal_89[18] = ' ' + sb $t0, 26($v0) # internal_139[18] = ' ' addi $t0, $zero, 32 - sb $t0, 27($v0) # internal_89[19] = ' ' + sb $t0, 27($v0) # internal_139[19] = ' ' sb $zero, 28($v0) # Null-terminator at the end of the string - sw $v0, 264($sp) # internal_89 = " X XX X X X " + sw $v0, 264($sp) # internal_139 = " X XX X X X " - # internal_85 = internal_89 + # internal_135 = internal_139 lw $t0, 264($sp) sw $t0, 280($sp) - # Jumping to endif_8768338410692 - j endif_8768338410692 + # Jumping to endif_8737379857189 + j endif_8737379857189 - else_8768338410692: + else_8737379857189: # Allocating Bool 0 li $v0, 9 @@ -12033,7 +13596,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 256($sp) # internal_91 = address of allocated object Int + sw $v0, 256($sp) # internal_141 = address of allocated object Int # Allocating Int 9 li $v0, 9 @@ -12045,40 +13608,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 9 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 252($sp) # internal_92 = address of allocated object Int + sw $v0, 252($sp) # internal_142 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 632($sp) + lw $t0, 832($sp) sw $t0, 4($sp) # Storing num - # Argument internal_92 + # Argument internal_142 lw $t0, 264($sp) - sw $t0, 0($sp) # Storing internal_92 + sw $t0, 0($sp) # Storing internal_142 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 260($sp) # internal_93 = result of function_equal + sw $v1, 260($sp) # internal_143 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_91 = internal_93 + # internal_141 = internal_143 lw $t0, 248($sp) sw $t0, 256($sp) - # If internal_91 then goto then_8768338410686 + # If internal_141 then goto then_8737379857183 lw $t0, 256($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338410686 + beq $t0, $t1, then_8737379857183 - # Jumping to else_8768338410686 - j else_8768338410686 + # Jumping to else_8737379857183 + j else_8737379857183 - then_8768338410686: + then_8737379857183: # Allocating String li $v0, 9 @@ -12092,62 +13655,62 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 - sb $t0, 8($v0) # internal_94[0] = 'X' + sb $t0, 8($v0) # internal_144[0] = 'X' addi $t0, $zero, 32 - sb $t0, 9($v0) # internal_94[1] = ' ' + sb $t0, 9($v0) # internal_144[1] = ' ' addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_94[2] = ' ' + sb $t0, 10($v0) # internal_144[2] = ' ' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_94[3] = ' ' + sb $t0, 11($v0) # internal_144[3] = ' ' addi $t0, $zero, 88 - sb $t0, 12($v0) # internal_94[4] = 'X' + sb $t0, 12($v0) # internal_144[4] = 'X' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_94[5] = ' ' + sb $t0, 13($v0) # internal_144[5] = ' ' addi $t0, $zero, 88 - sb $t0, 14($v0) # internal_94[6] = 'X' + sb $t0, 14($v0) # internal_144[6] = 'X' addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_94[7] = ' ' + sb $t0, 15($v0) # internal_144[7] = ' ' addi $t0, $zero, 88 - sb $t0, 16($v0) # internal_94[8] = 'X' + sb $t0, 16($v0) # internal_144[8] = 'X' addi $t0, $zero, 32 - sb $t0, 17($v0) # internal_94[9] = ' ' + sb $t0, 17($v0) # internal_144[9] = ' ' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_94[10] = ' ' + sb $t0, 18($v0) # internal_144[10] = ' ' addi $t0, $zero, 32 - sb $t0, 19($v0) # internal_94[11] = ' ' + sb $t0, 19($v0) # internal_144[11] = ' ' addi $t0, $zero, 88 - sb $t0, 20($v0) # internal_94[12] = 'X' + sb $t0, 20($v0) # internal_144[12] = 'X' addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_94[13] = ' ' + sb $t0, 21($v0) # internal_144[13] = ' ' addi $t0, $zero, 32 - sb $t0, 22($v0) # internal_94[14] = ' ' + sb $t0, 22($v0) # internal_144[14] = ' ' sb $zero, 23($v0) # Null-terminator at the end of the string - sw $v0, 244($sp) # internal_94 = "X X X X X " + sw $v0, 244($sp) # internal_144 = "X X X X X " - # internal_90 = internal_94 + # internal_140 = internal_144 lw $t0, 244($sp) sw $t0, 260($sp) - # Jumping to endif_8768338410686 - j endif_8768338410686 + # Jumping to endif_8737379857183 + j endif_8737379857183 - else_8768338410686: + else_8737379857183: # Allocating Bool 0 li $v0, 9 @@ -12159,7 +13722,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 236($sp) # internal_96 = address of allocated object Int + sw $v0, 236($sp) # internal_146 = address of allocated object Int # Allocating Int 10 li $v0, 9 @@ -12171,40 +13734,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 10 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 232($sp) # internal_97 = address of allocated object Int + sw $v0, 232($sp) # internal_147 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 632($sp) + lw $t0, 832($sp) sw $t0, 4($sp) # Storing num - # Argument internal_97 + # Argument internal_147 lw $t0, 244($sp) - sw $t0, 0($sp) # Storing internal_97 + sw $t0, 0($sp) # Storing internal_147 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 240($sp) # internal_98 = result of function_equal + sw $v1, 240($sp) # internal_148 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_96 = internal_98 + # internal_146 = internal_148 lw $t0, 228($sp) sw $t0, 236($sp) - # If internal_96 then goto then_8768338410680 + # If internal_146 then goto then_8737379857177 lw $t0, 236($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338410680 + beq $t0, $t1, then_8737379857177 - # Jumping to else_8768338410680 - j else_8768338410680 + # Jumping to else_8737379857177 + j else_8737379857177 - then_8768338410680: + then_8737379857177: # Allocating String li $v0, 9 @@ -12218,62 +13781,62 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_99[0] = ' ' + sb $t0, 8($v0) # internal_149[0] = ' ' addi $t0, $zero, 32 - sb $t0, 9($v0) # internal_99[1] = ' ' + sb $t0, 9($v0) # internal_149[1] = ' ' addi $t0, $zero, 88 - sb $t0, 10($v0) # internal_99[2] = 'X' + sb $t0, 10($v0) # internal_149[2] = 'X' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_99[3] = ' ' + sb $t0, 11($v0) # internal_149[3] = ' ' addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_99[4] = ' ' + sb $t0, 12($v0) # internal_149[4] = ' ' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_99[5] = ' ' + sb $t0, 13($v0) # internal_149[5] = ' ' addi $t0, $zero, 88 - sb $t0, 14($v0) # internal_99[6] = 'X' + sb $t0, 14($v0) # internal_149[6] = 'X' addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_99[7] = ' ' + sb $t0, 15($v0) # internal_149[7] = ' ' addi $t0, $zero, 88 - sb $t0, 16($v0) # internal_99[8] = 'X' + sb $t0, 16($v0) # internal_149[8] = 'X' addi $t0, $zero, 32 - sb $t0, 17($v0) # internal_99[9] = ' ' + sb $t0, 17($v0) # internal_149[9] = ' ' addi $t0, $zero, 88 - sb $t0, 18($v0) # internal_99[10] = 'X' + sb $t0, 18($v0) # internal_149[10] = 'X' addi $t0, $zero, 32 - sb $t0, 19($v0) # internal_99[11] = ' ' + sb $t0, 19($v0) # internal_149[11] = ' ' addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_99[12] = ' ' + sb $t0, 20($v0) # internal_149[12] = ' ' addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_99[13] = ' ' + sb $t0, 21($v0) # internal_149[13] = ' ' addi $t0, $zero, 88 - sb $t0, 22($v0) # internal_99[14] = 'X' + sb $t0, 22($v0) # internal_149[14] = 'X' sb $zero, 23($v0) # Null-terminator at the end of the string - sw $v0, 224($sp) # internal_99 = " X X X X X" + sw $v0, 224($sp) # internal_149 = " X X X X X" - # internal_95 = internal_99 + # internal_145 = internal_149 lw $t0, 224($sp) sw $t0, 240($sp) - # Jumping to endif_8768338410680 - j endif_8768338410680 + # Jumping to endif_8737379857177 + j endif_8737379857177 - else_8768338410680: + else_8737379857177: # Allocating Bool 0 li $v0, 9 @@ -12285,7 +13848,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 216($sp) # internal_101 = address of allocated object Int + sw $v0, 216($sp) # internal_151 = address of allocated object Int # Allocating Int 11 li $v0, 9 @@ -12297,40 +13860,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 11 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 212($sp) # internal_102 = address of allocated object Int + sw $v0, 212($sp) # internal_152 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 632($sp) + lw $t0, 832($sp) sw $t0, 4($sp) # Storing num - # Argument internal_102 + # Argument internal_152 lw $t0, 224($sp) - sw $t0, 0($sp) # Storing internal_102 + sw $t0, 0($sp) # Storing internal_152 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 220($sp) # internal_103 = result of function_equal + sw $v1, 220($sp) # internal_153 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_101 = internal_103 + # internal_151 = internal_153 lw $t0, 208($sp) sw $t0, 216($sp) - # If internal_101 then goto then_8768338410674 + # If internal_151 then goto then_8737379857171 lw $t0, 216($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338410674 + beq $t0, $t1, then_8737379857171 - # Jumping to else_8768338410674 - j else_8768338410674 + # Jumping to else_8737379857171 + j else_8737379857171 - then_8768338410674: + then_8737379857171: # Allocating String li $v0, 9 @@ -12344,62 +13907,62 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 - sb $t0, 8($v0) # internal_104[0] = 'X' + sb $t0, 8($v0) # internal_154[0] = 'X' addi $t0, $zero, 32 - sb $t0, 9($v0) # internal_104[1] = ' ' + sb $t0, 9($v0) # internal_154[1] = ' ' addi $t0, $zero, 88 - sb $t0, 10($v0) # internal_104[2] = 'X' + sb $t0, 10($v0) # internal_154[2] = 'X' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_104[3] = ' ' + sb $t0, 11($v0) # internal_154[3] = ' ' addi $t0, $zero, 88 - sb $t0, 12($v0) # internal_104[4] = 'X' + sb $t0, 12($v0) # internal_154[4] = 'X' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_104[5] = ' ' + sb $t0, 13($v0) # internal_154[5] = ' ' addi $t0, $zero, 88 - sb $t0, 14($v0) # internal_104[6] = 'X' + sb $t0, 14($v0) # internal_154[6] = 'X' addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_104[7] = ' ' + sb $t0, 15($v0) # internal_154[7] = ' ' addi $t0, $zero, 88 - sb $t0, 16($v0) # internal_104[8] = 'X' + sb $t0, 16($v0) # internal_154[8] = 'X' addi $t0, $zero, 32 - sb $t0, 17($v0) # internal_104[9] = ' ' + sb $t0, 17($v0) # internal_154[9] = ' ' addi $t0, $zero, 88 - sb $t0, 18($v0) # internal_104[10] = 'X' + sb $t0, 18($v0) # internal_154[10] = 'X' addi $t0, $zero, 32 - sb $t0, 19($v0) # internal_104[11] = ' ' + sb $t0, 19($v0) # internal_154[11] = ' ' addi $t0, $zero, 88 - sb $t0, 20($v0) # internal_104[12] = 'X' + sb $t0, 20($v0) # internal_154[12] = 'X' addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_104[13] = ' ' + sb $t0, 21($v0) # internal_154[13] = ' ' addi $t0, $zero, 88 - sb $t0, 22($v0) # internal_104[14] = 'X' + sb $t0, 22($v0) # internal_154[14] = 'X' sb $zero, 23($v0) # Null-terminator at the end of the string - sw $v0, 204($sp) # internal_104 = "X X X X X X X X" + sw $v0, 204($sp) # internal_154 = "X X X X X X X X" - # internal_100 = internal_104 + # internal_150 = internal_154 lw $t0, 204($sp) sw $t0, 220($sp) - # Jumping to endif_8768338410674 - j endif_8768338410674 + # Jumping to endif_8737379857171 + j endif_8737379857171 - else_8768338410674: + else_8737379857171: # Allocating Bool 0 li $v0, 9 @@ -12411,7 +13974,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 196($sp) # internal_106 = address of allocated object Int + sw $v0, 196($sp) # internal_156 = address of allocated object Int # Allocating Int 12 li $v0, 9 @@ -12423,40 +13986,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 12 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 192($sp) # internal_107 = address of allocated object Int + sw $v0, 192($sp) # internal_157 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 632($sp) + lw $t0, 832($sp) sw $t0, 4($sp) # Storing num - # Argument internal_107 + # Argument internal_157 lw $t0, 204($sp) - sw $t0, 0($sp) # Storing internal_107 + sw $t0, 0($sp) # Storing internal_157 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 200($sp) # internal_108 = result of function_equal + sw $v1, 200($sp) # internal_158 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_106 = internal_108 + # internal_156 = internal_158 lw $t0, 188($sp) sw $t0, 196($sp) - # If internal_106 then goto then_8768338410668 + # If internal_156 then goto then_8737379857165 lw $t0, 196($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338410668 + beq $t0, $t1, then_8737379857165 - # Jumping to else_8768338410668 - j else_8768338410668 + # Jumping to else_8737379857165 + j else_8737379857165 - then_8768338410668: + then_8737379857165: # Allocating String li $v0, 9 @@ -12470,92 +14033,92 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 - sb $t0, 8($v0) # internal_109[0] = 'X' + sb $t0, 8($v0) # internal_159[0] = 'X' addi $t0, $zero, 88 - sb $t0, 9($v0) # internal_109[1] = 'X' + sb $t0, 9($v0) # internal_159[1] = 'X' addi $t0, $zero, 88 - sb $t0, 10($v0) # internal_109[2] = 'X' + sb $t0, 10($v0) # internal_159[2] = 'X' addi $t0, $zero, 88 - sb $t0, 11($v0) # internal_109[3] = 'X' + sb $t0, 11($v0) # internal_159[3] = 'X' addi $t0, $zero, 88 - sb $t0, 12($v0) # internal_109[4] = 'X' + sb $t0, 12($v0) # internal_159[4] = 'X' addi $t0, $zero, 88 - sb $t0, 13($v0) # internal_109[5] = 'X' + sb $t0, 13($v0) # internal_159[5] = 'X' addi $t0, $zero, 88 - sb $t0, 14($v0) # internal_109[6] = 'X' + sb $t0, 14($v0) # internal_159[6] = 'X' addi $t0, $zero, 88 - sb $t0, 15($v0) # internal_109[7] = 'X' + sb $t0, 15($v0) # internal_159[7] = 'X' addi $t0, $zero, 88 - sb $t0, 16($v0) # internal_109[8] = 'X' + sb $t0, 16($v0) # internal_159[8] = 'X' addi $t0, $zero, 88 - sb $t0, 17($v0) # internal_109[9] = 'X' + sb $t0, 17($v0) # internal_159[9] = 'X' addi $t0, $zero, 88 - sb $t0, 18($v0) # internal_109[10] = 'X' + sb $t0, 18($v0) # internal_159[10] = 'X' addi $t0, $zero, 88 - sb $t0, 19($v0) # internal_109[11] = 'X' + sb $t0, 19($v0) # internal_159[11] = 'X' addi $t0, $zero, 88 - sb $t0, 20($v0) # internal_109[12] = 'X' + sb $t0, 20($v0) # internal_159[12] = 'X' addi $t0, $zero, 88 - sb $t0, 21($v0) # internal_109[13] = 'X' + sb $t0, 21($v0) # internal_159[13] = 'X' addi $t0, $zero, 88 - sb $t0, 22($v0) # internal_109[14] = 'X' + sb $t0, 22($v0) # internal_159[14] = 'X' addi $t0, $zero, 88 - sb $t0, 23($v0) # internal_109[15] = 'X' + sb $t0, 23($v0) # internal_159[15] = 'X' addi $t0, $zero, 88 - sb $t0, 24($v0) # internal_109[16] = 'X' + sb $t0, 24($v0) # internal_159[16] = 'X' addi $t0, $zero, 88 - sb $t0, 25($v0) # internal_109[17] = 'X' + sb $t0, 25($v0) # internal_159[17] = 'X' addi $t0, $zero, 88 - sb $t0, 26($v0) # internal_109[18] = 'X' + sb $t0, 26($v0) # internal_159[18] = 'X' addi $t0, $zero, 88 - sb $t0, 27($v0) # internal_109[19] = 'X' + sb $t0, 27($v0) # internal_159[19] = 'X' addi $t0, $zero, 88 - sb $t0, 28($v0) # internal_109[20] = 'X' + sb $t0, 28($v0) # internal_159[20] = 'X' addi $t0, $zero, 88 - sb $t0, 29($v0) # internal_109[21] = 'X' + sb $t0, 29($v0) # internal_159[21] = 'X' addi $t0, $zero, 88 - sb $t0, 30($v0) # internal_109[22] = 'X' + sb $t0, 30($v0) # internal_159[22] = 'X' addi $t0, $zero, 88 - sb $t0, 31($v0) # internal_109[23] = 'X' + sb $t0, 31($v0) # internal_159[23] = 'X' addi $t0, $zero, 88 - sb $t0, 32($v0) # internal_109[24] = 'X' + sb $t0, 32($v0) # internal_159[24] = 'X' sb $zero, 33($v0) # Null-terminator at the end of the string - sw $v0, 184($sp) # internal_109 = "XXXXXXXXXXXXXXXXXXXXXXXXX" + sw $v0, 184($sp) # internal_159 = "XXXXXXXXXXXXXXXXXXXXXXXXX" - # internal_105 = internal_109 + # internal_155 = internal_159 lw $t0, 184($sp) sw $t0, 200($sp) - # Jumping to endif_8768338410668 - j endif_8768338410668 + # Jumping to endif_8737379857165 + j endif_8737379857165 - else_8768338410668: + else_8737379857165: # Allocating Bool 0 li $v0, 9 @@ -12567,7 +14130,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 176($sp) # internal_111 = address of allocated object Int + sw $v0, 176($sp) # internal_161 = address of allocated object Int # Allocating Int 13 li $v0, 9 @@ -12579,40 +14142,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 13 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 172($sp) # internal_112 = address of allocated object Int + sw $v0, 172($sp) # internal_162 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 632($sp) + lw $t0, 832($sp) sw $t0, 4($sp) # Storing num - # Argument internal_112 + # Argument internal_162 lw $t0, 184($sp) - sw $t0, 0($sp) # Storing internal_112 + sw $t0, 0($sp) # Storing internal_162 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 180($sp) # internal_113 = result of function_equal + sw $v1, 180($sp) # internal_163 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_111 = internal_113 + # internal_161 = internal_163 lw $t0, 168($sp) sw $t0, 176($sp) - # If internal_111 then goto then_8768338410662 + # If internal_161 then goto then_8737379857159 lw $t0, 176($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338410662 + beq $t0, $t1, then_8737379857159 - # Jumping to else_8768338410662 - j else_8768338410662 + # Jumping to else_8737379857159 + j else_8737379857159 - then_8768338410662: + then_8737379857159: # Allocating String li $v0, 9 @@ -12626,92 +14189,92 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 - sb $t0, 8($v0) # internal_114[0] = 'X' + sb $t0, 8($v0) # internal_164[0] = 'X' addi $t0, $zero, 88 - sb $t0, 9($v0) # internal_114[1] = 'X' + sb $t0, 9($v0) # internal_164[1] = 'X' addi $t0, $zero, 88 - sb $t0, 10($v0) # internal_114[2] = 'X' + sb $t0, 10($v0) # internal_164[2] = 'X' addi $t0, $zero, 88 - sb $t0, 11($v0) # internal_114[3] = 'X' + sb $t0, 11($v0) # internal_164[3] = 'X' addi $t0, $zero, 88 - sb $t0, 12($v0) # internal_114[4] = 'X' + sb $t0, 12($v0) # internal_164[4] = 'X' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_114[5] = ' ' + sb $t0, 13($v0) # internal_164[5] = ' ' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_114[6] = ' ' + sb $t0, 14($v0) # internal_164[6] = ' ' addi $t0, $zero, 88 - sb $t0, 15($v0) # internal_114[7] = 'X' + sb $t0, 15($v0) # internal_164[7] = 'X' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_114[8] = ' ' + sb $t0, 16($v0) # internal_164[8] = ' ' addi $t0, $zero, 32 - sb $t0, 17($v0) # internal_114[9] = ' ' + sb $t0, 17($v0) # internal_164[9] = ' ' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_114[10] = ' ' + sb $t0, 18($v0) # internal_164[10] = ' ' addi $t0, $zero, 32 - sb $t0, 19($v0) # internal_114[11] = ' ' + sb $t0, 19($v0) # internal_164[11] = ' ' addi $t0, $zero, 88 - sb $t0, 20($v0) # internal_114[12] = 'X' + sb $t0, 20($v0) # internal_164[12] = 'X' addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_114[13] = ' ' + sb $t0, 21($v0) # internal_164[13] = ' ' addi $t0, $zero, 32 - sb $t0, 22($v0) # internal_114[14] = ' ' + sb $t0, 22($v0) # internal_164[14] = ' ' addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_114[15] = ' ' + sb $t0, 23($v0) # internal_164[15] = ' ' addi $t0, $zero, 32 - sb $t0, 24($v0) # internal_114[16] = ' ' + sb $t0, 24($v0) # internal_164[16] = ' ' addi $t0, $zero, 88 - sb $t0, 25($v0) # internal_114[17] = 'X' + sb $t0, 25($v0) # internal_164[17] = 'X' addi $t0, $zero, 32 - sb $t0, 26($v0) # internal_114[18] = ' ' + sb $t0, 26($v0) # internal_164[18] = ' ' addi $t0, $zero, 32 - sb $t0, 27($v0) # internal_114[19] = ' ' + sb $t0, 27($v0) # internal_164[19] = ' ' addi $t0, $zero, 32 - sb $t0, 28($v0) # internal_114[20] = ' ' + sb $t0, 28($v0) # internal_164[20] = ' ' addi $t0, $zero, 32 - sb $t0, 29($v0) # internal_114[21] = ' ' + sb $t0, 29($v0) # internal_164[21] = ' ' addi $t0, $zero, 88 - sb $t0, 30($v0) # internal_114[22] = 'X' + sb $t0, 30($v0) # internal_164[22] = 'X' addi $t0, $zero, 32 - sb $t0, 31($v0) # internal_114[23] = ' ' + sb $t0, 31($v0) # internal_164[23] = ' ' addi $t0, $zero, 32 - sb $t0, 32($v0) # internal_114[24] = ' ' + sb $t0, 32($v0) # internal_164[24] = ' ' sb $zero, 33($v0) # Null-terminator at the end of the string - sw $v0, 164($sp) # internal_114 = "XXXXX X X X X " + sw $v0, 164($sp) # internal_164 = "XXXXX X X X X " - # internal_110 = internal_114 + # internal_160 = internal_164 lw $t0, 164($sp) sw $t0, 180($sp) - # Jumping to endif_8768338410662 - j endif_8768338410662 + # Jumping to endif_8737379857159 + j endif_8737379857159 - else_8768338410662: + else_8737379857159: # Allocating Bool 0 li $v0, 9 @@ -12723,7 +14286,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 156($sp) # internal_116 = address of allocated object Int + sw $v0, 156($sp) # internal_166 = address of allocated object Int # Allocating Int 14 li $v0, 9 @@ -12735,40 +14298,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 14 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 152($sp) # internal_117 = address of allocated object Int + sw $v0, 152($sp) # internal_167 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 632($sp) + lw $t0, 832($sp) sw $t0, 4($sp) # Storing num - # Argument internal_117 + # Argument internal_167 lw $t0, 164($sp) - sw $t0, 0($sp) # Storing internal_117 + sw $t0, 0($sp) # Storing internal_167 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 160($sp) # internal_118 = result of function_equal + sw $v1, 160($sp) # internal_168 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_116 = internal_118 + # internal_166 = internal_168 lw $t0, 148($sp) sw $t0, 156($sp) - # If internal_116 then goto then_8768338410656 + # If internal_166 then goto then_8737379856893 lw $t0, 156($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338410656 + beq $t0, $t1, then_8737379856893 - # Jumping to else_8768338410656 - j else_8768338410656 + # Jumping to else_8737379856893 + j else_8737379856893 - then_8768338410656: + then_8737379856893: # Allocating String li $v0, 9 @@ -12782,92 +14345,92 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_119[0] = ' ' + sb $t0, 8($v0) # internal_169[0] = ' ' addi $t0, $zero, 32 - sb $t0, 9($v0) # internal_119[1] = ' ' + sb $t0, 9($v0) # internal_169[1] = ' ' addi $t0, $zero, 88 - sb $t0, 10($v0) # internal_119[2] = 'X' + sb $t0, 10($v0) # internal_169[2] = 'X' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_119[3] = ' ' + sb $t0, 11($v0) # internal_169[3] = ' ' addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_119[4] = ' ' + sb $t0, 12($v0) # internal_169[4] = ' ' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_119[5] = ' ' + sb $t0, 13($v0) # internal_169[5] = ' ' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_119[6] = ' ' + sb $t0, 14($v0) # internal_169[6] = ' ' addi $t0, $zero, 88 - sb $t0, 15($v0) # internal_119[7] = 'X' + sb $t0, 15($v0) # internal_169[7] = 'X' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_119[8] = ' ' + sb $t0, 16($v0) # internal_169[8] = ' ' addi $t0, $zero, 32 - sb $t0, 17($v0) # internal_119[9] = ' ' + sb $t0, 17($v0) # internal_169[9] = ' ' addi $t0, $zero, 88 - sb $t0, 18($v0) # internal_119[10] = 'X' + sb $t0, 18($v0) # internal_169[10] = 'X' addi $t0, $zero, 88 - sb $t0, 19($v0) # internal_119[11] = 'X' + sb $t0, 19($v0) # internal_169[11] = 'X' addi $t0, $zero, 88 - sb $t0, 20($v0) # internal_119[12] = 'X' + sb $t0, 20($v0) # internal_169[12] = 'X' addi $t0, $zero, 88 - sb $t0, 21($v0) # internal_119[13] = 'X' + sb $t0, 21($v0) # internal_169[13] = 'X' addi $t0, $zero, 88 - sb $t0, 22($v0) # internal_119[14] = 'X' + sb $t0, 22($v0) # internal_169[14] = 'X' addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_119[15] = ' ' + sb $t0, 23($v0) # internal_169[15] = ' ' addi $t0, $zero, 32 - sb $t0, 24($v0) # internal_119[16] = ' ' + sb $t0, 24($v0) # internal_169[16] = ' ' addi $t0, $zero, 88 - sb $t0, 25($v0) # internal_119[17] = 'X' + sb $t0, 25($v0) # internal_169[17] = 'X' addi $t0, $zero, 32 - sb $t0, 26($v0) # internal_119[18] = ' ' + sb $t0, 26($v0) # internal_169[18] = ' ' addi $t0, $zero, 32 - sb $t0, 27($v0) # internal_119[19] = ' ' + sb $t0, 27($v0) # internal_169[19] = ' ' addi $t0, $zero, 32 - sb $t0, 28($v0) # internal_119[20] = ' ' + sb $t0, 28($v0) # internal_169[20] = ' ' addi $t0, $zero, 32 - sb $t0, 29($v0) # internal_119[21] = ' ' + sb $t0, 29($v0) # internal_169[21] = ' ' addi $t0, $zero, 88 - sb $t0, 30($v0) # internal_119[22] = 'X' + sb $t0, 30($v0) # internal_169[22] = 'X' addi $t0, $zero, 32 - sb $t0, 31($v0) # internal_119[23] = ' ' + sb $t0, 31($v0) # internal_169[23] = ' ' addi $t0, $zero, 32 - sb $t0, 32($v0) # internal_119[24] = ' ' + sb $t0, 32($v0) # internal_169[24] = ' ' sb $zero, 33($v0) # Null-terminator at the end of the string - sw $v0, 144($sp) # internal_119 = " X X XXXXX X X " + sw $v0, 144($sp) # internal_169 = " X X XXXXX X X " - # internal_115 = internal_119 + # internal_165 = internal_169 lw $t0, 144($sp) sw $t0, 160($sp) - # Jumping to endif_8768338410656 - j endif_8768338410656 + # Jumping to endif_8737379856893 + j endif_8737379856893 - else_8768338410656: + else_8737379856893: # Allocating Bool 0 li $v0, 9 @@ -12879,7 +14442,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 136($sp) # internal_121 = address of allocated object Int + sw $v0, 136($sp) # internal_171 = address of allocated object Int # Allocating Int 15 li $v0, 9 @@ -12891,40 +14454,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 15 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 132($sp) # internal_122 = address of allocated object Int + sw $v0, 132($sp) # internal_172 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 632($sp) + lw $t0, 832($sp) sw $t0, 4($sp) # Storing num - # Argument internal_122 + # Argument internal_172 lw $t0, 144($sp) - sw $t0, 0($sp) # Storing internal_122 + sw $t0, 0($sp) # Storing internal_172 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 140($sp) # internal_123 = result of function_equal + sw $v1, 140($sp) # internal_173 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_121 = internal_123 + # internal_171 = internal_173 lw $t0, 128($sp) sw $t0, 136($sp) - # If internal_121 then goto then_8768338410650 + # If internal_171 then goto then_8737379856887 lw $t0, 136($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338410650 + beq $t0, $t1, then_8737379856887 - # Jumping to else_8768338410650 - j else_8768338410650 + # Jumping to else_8737379856887 + j else_8737379856887 - then_8768338410650: + then_8737379856887: # Allocating String li $v0, 9 @@ -12938,80 +14501,80 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 - sb $t0, 8($v0) # internal_124[0] = 'X' + sb $t0, 8($v0) # internal_174[0] = 'X' addi $t0, $zero, 32 - sb $t0, 9($v0) # internal_124[1] = ' ' + sb $t0, 9($v0) # internal_174[1] = ' ' addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_124[2] = ' ' + sb $t0, 10($v0) # internal_174[2] = ' ' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_124[3] = ' ' + sb $t0, 11($v0) # internal_174[3] = ' ' addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_124[4] = ' ' + sb $t0, 12($v0) # internal_174[4] = ' ' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_124[5] = ' ' + sb $t0, 13($v0) # internal_174[5] = ' ' addi $t0, $zero, 88 - sb $t0, 14($v0) # internal_124[6] = 'X' + sb $t0, 14($v0) # internal_174[6] = 'X' addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_124[7] = ' ' + sb $t0, 15($v0) # internal_174[7] = ' ' addi $t0, $zero, 88 - sb $t0, 16($v0) # internal_124[8] = 'X' + sb $t0, 16($v0) # internal_174[8] = 'X' addi $t0, $zero, 32 - sb $t0, 17($v0) # internal_124[9] = ' ' + sb $t0, 17($v0) # internal_174[9] = ' ' addi $t0, $zero, 88 - sb $t0, 18($v0) # internal_124[10] = 'X' + sb $t0, 18($v0) # internal_174[10] = 'X' addi $t0, $zero, 32 - sb $t0, 19($v0) # internal_124[11] = ' ' + sb $t0, 19($v0) # internal_174[11] = ' ' addi $t0, $zero, 88 - sb $t0, 20($v0) # internal_124[12] = 'X' + sb $t0, 20($v0) # internal_174[12] = 'X' addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_124[13] = ' ' + sb $t0, 21($v0) # internal_174[13] = ' ' addi $t0, $zero, 32 - sb $t0, 22($v0) # internal_124[14] = ' ' + sb $t0, 22($v0) # internal_174[14] = ' ' addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_124[15] = ' ' + sb $t0, 23($v0) # internal_174[15] = ' ' addi $t0, $zero, 88 - sb $t0, 24($v0) # internal_124[16] = 'X' + sb $t0, 24($v0) # internal_174[16] = 'X' addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_124[17] = ' ' + sb $t0, 25($v0) # internal_174[17] = ' ' addi $t0, $zero, 88 - sb $t0, 26($v0) # internal_124[18] = 'X' + sb $t0, 26($v0) # internal_174[18] = 'X' addi $t0, $zero, 32 - sb $t0, 27($v0) # internal_124[19] = ' ' + sb $t0, 27($v0) # internal_174[19] = ' ' addi $t0, $zero, 32 - sb $t0, 28($v0) # internal_124[20] = ' ' + sb $t0, 28($v0) # internal_174[20] = ' ' sb $zero, 29($v0) # Null-terminator at the end of the string - sw $v0, 124($sp) # internal_124 = "X X X X X X X " + sw $v0, 124($sp) # internal_174 = "X X X X X X X " - # internal_120 = internal_124 + # internal_170 = internal_174 lw $t0, 124($sp) sw $t0, 140($sp) - # Jumping to endif_8768338410650 - j endif_8768338410650 + # Jumping to endif_8737379856887 + j endif_8737379856887 - else_8768338410650: + else_8737379856887: # Allocating Bool 0 li $v0, 9 @@ -13023,7 +14586,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 116($sp) # internal_126 = address of allocated object Int + sw $v0, 116($sp) # internal_176 = address of allocated object Int # Allocating Int 16 li $v0, 9 @@ -13035,40 +14598,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 16 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 112($sp) # internal_127 = address of allocated object Int + sw $v0, 112($sp) # internal_177 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 632($sp) + lw $t0, 832($sp) sw $t0, 4($sp) # Storing num - # Argument internal_127 + # Argument internal_177 lw $t0, 124($sp) - sw $t0, 0($sp) # Storing internal_127 + sw $t0, 0($sp) # Storing internal_177 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 120($sp) # internal_128 = result of function_equal + sw $v1, 120($sp) # internal_178 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_126 = internal_128 + # internal_176 = internal_178 lw $t0, 108($sp) sw $t0, 116($sp) - # If internal_126 then goto then_8768338410644 + # If internal_176 then goto then_8737379856881 lw $t0, 116($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338410644 + beq $t0, $t1, then_8737379856881 - # Jumping to else_8768338410644 - j else_8768338410644 + # Jumping to else_8737379856881 + j else_8737379856881 - then_8768338410644: + then_8737379856881: # Allocating String li $v0, 9 @@ -13082,80 +14645,80 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_129[0] = ' ' + sb $t0, 8($v0) # internal_179[0] = ' ' addi $t0, $zero, 32 - sb $t0, 9($v0) # internal_129[1] = ' ' + sb $t0, 9($v0) # internal_179[1] = ' ' addi $t0, $zero, 88 - sb $t0, 10($v0) # internal_129[2] = 'X' + sb $t0, 10($v0) # internal_179[2] = 'X' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_129[3] = ' ' + sb $t0, 11($v0) # internal_179[3] = ' ' addi $t0, $zero, 88 - sb $t0, 12($v0) # internal_129[4] = 'X' + sb $t0, 12($v0) # internal_179[4] = 'X' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_129[5] = ' ' + sb $t0, 13($v0) # internal_179[5] = ' ' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_129[6] = ' ' + sb $t0, 14($v0) # internal_179[6] = ' ' addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_129[7] = ' ' + sb $t0, 15($v0) # internal_179[7] = ' ' addi $t0, $zero, 88 - sb $t0, 16($v0) # internal_129[8] = 'X' + sb $t0, 16($v0) # internal_179[8] = 'X' addi $t0, $zero, 32 - sb $t0, 17($v0) # internal_129[9] = ' ' + sb $t0, 17($v0) # internal_179[9] = ' ' addi $t0, $zero, 88 - sb $t0, 18($v0) # internal_129[10] = 'X' + sb $t0, 18($v0) # internal_179[10] = 'X' addi $t0, $zero, 32 - sb $t0, 19($v0) # internal_129[11] = ' ' + sb $t0, 19($v0) # internal_179[11] = ' ' addi $t0, $zero, 88 - sb $t0, 20($v0) # internal_129[12] = 'X' + sb $t0, 20($v0) # internal_179[12] = 'X' addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_129[13] = ' ' + sb $t0, 21($v0) # internal_179[13] = ' ' addi $t0, $zero, 88 - sb $t0, 22($v0) # internal_129[14] = 'X' + sb $t0, 22($v0) # internal_179[14] = 'X' addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_129[15] = ' ' + sb $t0, 23($v0) # internal_179[15] = ' ' addi $t0, $zero, 32 - sb $t0, 24($v0) # internal_129[16] = ' ' + sb $t0, 24($v0) # internal_179[16] = ' ' addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_129[17] = ' ' + sb $t0, 25($v0) # internal_179[17] = ' ' addi $t0, $zero, 32 - sb $t0, 26($v0) # internal_129[18] = ' ' + sb $t0, 26($v0) # internal_179[18] = ' ' addi $t0, $zero, 32 - sb $t0, 27($v0) # internal_129[19] = ' ' + sb $t0, 27($v0) # internal_179[19] = ' ' addi $t0, $zero, 88 - sb $t0, 28($v0) # internal_129[20] = 'X' + sb $t0, 28($v0) # internal_179[20] = 'X' sb $zero, 29($v0) # Null-terminator at the end of the string - sw $v0, 104($sp) # internal_129 = " X X X X X X X" + sw $v0, 104($sp) # internal_179 = " X X X X X X X" - # internal_125 = internal_129 + # internal_175 = internal_179 lw $t0, 104($sp) sw $t0, 120($sp) - # Jumping to endif_8768338410644 - j endif_8768338410644 + # Jumping to endif_8737379856881 + j endif_8737379856881 - else_8768338410644: + else_8737379856881: # Allocating Bool 0 li $v0, 9 @@ -13167,7 +14730,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 96($sp) # internal_131 = address of allocated object Int + sw $v0, 96($sp) # internal_181 = address of allocated object Int # Allocating Int 17 li $v0, 9 @@ -13179,40 +14742,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 17 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 92($sp) # internal_132 = address of allocated object Int + sw $v0, 92($sp) # internal_182 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 632($sp) + lw $t0, 832($sp) sw $t0, 4($sp) # Storing num - # Argument internal_132 + # Argument internal_182 lw $t0, 104($sp) - sw $t0, 0($sp) # Storing internal_132 + sw $t0, 0($sp) # Storing internal_182 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 100($sp) # internal_133 = result of function_equal + sw $v1, 100($sp) # internal_183 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_131 = internal_133 + # internal_181 = internal_183 lw $t0, 88($sp) sw $t0, 96($sp) - # If internal_131 then goto then_8768338410638 + # If internal_181 then goto then_8737379856875 lw $t0, 96($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338410638 + beq $t0, $t1, then_8737379856875 - # Jumping to else_8768338410638 - j else_8768338410638 + # Jumping to else_8737379856875 + j else_8737379856875 - then_8768338410638: + then_8737379856875: # Allocating String li $v0, 9 @@ -13226,101 +14789,101 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 - sb $t0, 8($v0) # internal_134[0] = 'X' + sb $t0, 8($v0) # internal_184[0] = 'X' addi $t0, $zero, 88 - sb $t0, 9($v0) # internal_134[1] = 'X' + sb $t0, 9($v0) # internal_184[1] = 'X' addi $t0, $zero, 88 - sb $t0, 10($v0) # internal_134[2] = 'X' + sb $t0, 10($v0) # internal_184[2] = 'X' addi $t0, $zero, 88 - sb $t0, 11($v0) # internal_134[3] = 'X' + sb $t0, 11($v0) # internal_184[3] = 'X' addi $t0, $zero, 88 - sb $t0, 12($v0) # internal_134[4] = 'X' + sb $t0, 12($v0) # internal_184[4] = 'X' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_134[5] = ' ' + sb $t0, 13($v0) # internal_184[5] = ' ' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_134[6] = ' ' + sb $t0, 14($v0) # internal_184[6] = ' ' addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_134[7] = ' ' + sb $t0, 15($v0) # internal_184[7] = ' ' addi $t0, $zero, 88 - sb $t0, 16($v0) # internal_134[8] = 'X' + sb $t0, 16($v0) # internal_184[8] = 'X' addi $t0, $zero, 32 - sb $t0, 17($v0) # internal_134[9] = ' ' + sb $t0, 17($v0) # internal_184[9] = ' ' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_134[10] = ' ' + sb $t0, 18($v0) # internal_184[10] = ' ' addi $t0, $zero, 32 - sb $t0, 19($v0) # internal_134[11] = ' ' + sb $t0, 19($v0) # internal_184[11] = ' ' addi $t0, $zero, 88 - sb $t0, 20($v0) # internal_134[12] = 'X' + sb $t0, 20($v0) # internal_184[12] = 'X' addi $t0, $zero, 88 - sb $t0, 21($v0) # internal_134[13] = 'X' + sb $t0, 21($v0) # internal_184[13] = 'X' addi $t0, $zero, 88 - sb $t0, 22($v0) # internal_134[14] = 'X' + sb $t0, 22($v0) # internal_184[14] = 'X' addi $t0, $zero, 88 - sb $t0, 23($v0) # internal_134[15] = 'X' + sb $t0, 23($v0) # internal_184[15] = 'X' addi $t0, $zero, 88 - sb $t0, 24($v0) # internal_134[16] = 'X' + sb $t0, 24($v0) # internal_184[16] = 'X' addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_134[17] = ' ' + sb $t0, 25($v0) # internal_184[17] = ' ' addi $t0, $zero, 32 - sb $t0, 26($v0) # internal_134[18] = ' ' + sb $t0, 26($v0) # internal_184[18] = ' ' addi $t0, $zero, 32 - sb $t0, 27($v0) # internal_134[19] = ' ' + sb $t0, 27($v0) # internal_184[19] = ' ' addi $t0, $zero, 88 - sb $t0, 28($v0) # internal_134[20] = 'X' + sb $t0, 28($v0) # internal_184[20] = 'X' addi $t0, $zero, 32 - sb $t0, 29($v0) # internal_134[21] = ' ' + sb $t0, 29($v0) # internal_184[21] = ' ' addi $t0, $zero, 32 - sb $t0, 30($v0) # internal_134[22] = ' ' + sb $t0, 30($v0) # internal_184[22] = ' ' addi $t0, $zero, 32 - sb $t0, 31($v0) # internal_134[23] = ' ' + sb $t0, 31($v0) # internal_184[23] = ' ' addi $t0, $zero, 88 - sb $t0, 32($v0) # internal_134[24] = 'X' + sb $t0, 32($v0) # internal_184[24] = 'X' addi $t0, $zero, 88 - sb $t0, 33($v0) # internal_134[25] = 'X' + sb $t0, 33($v0) # internal_184[25] = 'X' addi $t0, $zero, 88 - sb $t0, 34($v0) # internal_134[26] = 'X' + sb $t0, 34($v0) # internal_184[26] = 'X' addi $t0, $zero, 88 - sb $t0, 35($v0) # internal_134[27] = 'X' + sb $t0, 35($v0) # internal_184[27] = 'X' sb $zero, 36($v0) # Null-terminator at the end of the string - sw $v0, 84($sp) # internal_134 = "XXXXX X XXXXX X XXXX" + sw $v0, 84($sp) # internal_184 = "XXXXX X XXXXX X XXXX" - # internal_130 = internal_134 + # internal_180 = internal_184 lw $t0, 84($sp) sw $t0, 100($sp) - # Jumping to endif_8768338410638 - j endif_8768338410638 + # Jumping to endif_8737379856875 + j endif_8737379856875 - else_8768338410638: + else_8737379856875: # Allocating Bool 0 li $v0, 9 @@ -13332,7 +14895,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 76($sp) # internal_136 = address of allocated object Int + sw $v0, 76($sp) # internal_186 = address of allocated object Int # Allocating Int 18 li $v0, 9 @@ -13344,40 +14907,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 18 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 72($sp) # internal_137 = address of allocated object Int + sw $v0, 72($sp) # internal_187 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 632($sp) + lw $t0, 832($sp) sw $t0, 4($sp) # Storing num - # Argument internal_137 + # Argument internal_187 lw $t0, 84($sp) - sw $t0, 0($sp) # Storing internal_137 + sw $t0, 0($sp) # Storing internal_187 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 80($sp) # internal_138 = result of function_equal + sw $v1, 80($sp) # internal_188 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_136 = internal_138 + # internal_186 = internal_188 lw $t0, 68($sp) sw $t0, 76($sp) - # If internal_136 then goto then_8768338410632 + # If internal_186 then goto then_8737379856869 lw $t0, 76($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338410632 + beq $t0, $t1, then_8737379856869 - # Jumping to else_8768338410632 - j else_8768338410632 + # Jumping to else_8737379856869 + j else_8737379856869 - then_8768338410632: + then_8737379856869: # Allocating String li $v0, 9 @@ -13391,101 +14954,101 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 88 - sb $t0, 8($v0) # internal_139[0] = 'X' + sb $t0, 8($v0) # internal_189[0] = 'X' addi $t0, $zero, 88 - sb $t0, 9($v0) # internal_139[1] = 'X' + sb $t0, 9($v0) # internal_189[1] = 'X' addi $t0, $zero, 88 - sb $t0, 10($v0) # internal_139[2] = 'X' + sb $t0, 10($v0) # internal_189[2] = 'X' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_139[3] = ' ' + sb $t0, 11($v0) # internal_189[3] = ' ' addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_139[4] = ' ' + sb $t0, 12($v0) # internal_189[4] = ' ' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_139[5] = ' ' + sb $t0, 13($v0) # internal_189[5] = ' ' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_139[6] = ' ' + sb $t0, 14($v0) # internal_189[6] = ' ' addi $t0, $zero, 88 - sb $t0, 15($v0) # internal_139[7] = 'X' + sb $t0, 15($v0) # internal_189[7] = 'X' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_139[8] = ' ' + sb $t0, 16($v0) # internal_189[8] = ' ' addi $t0, $zero, 32 - sb $t0, 17($v0) # internal_139[9] = ' ' + sb $t0, 17($v0) # internal_189[9] = ' ' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_139[10] = ' ' + sb $t0, 18($v0) # internal_189[10] = ' ' addi $t0, $zero, 88 - sb $t0, 19($v0) # internal_139[11] = 'X' + sb $t0, 19($v0) # internal_189[11] = 'X' addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_139[12] = ' ' + sb $t0, 20($v0) # internal_189[12] = ' ' addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_139[13] = ' ' + sb $t0, 21($v0) # internal_189[13] = ' ' addi $t0, $zero, 88 - sb $t0, 22($v0) # internal_139[14] = 'X' + sb $t0, 22($v0) # internal_189[14] = 'X' addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_139[15] = ' ' + sb $t0, 23($v0) # internal_189[15] = ' ' addi $t0, $zero, 32 - sb $t0, 24($v0) # internal_139[16] = ' ' + sb $t0, 24($v0) # internal_189[16] = ' ' addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_139[17] = ' ' + sb $t0, 25($v0) # internal_189[17] = ' ' addi $t0, $zero, 32 - sb $t0, 26($v0) # internal_139[18] = ' ' + sb $t0, 26($v0) # internal_189[18] = ' ' addi $t0, $zero, 88 - sb $t0, 27($v0) # internal_139[19] = 'X' + sb $t0, 27($v0) # internal_189[19] = 'X' addi $t0, $zero, 32 - sb $t0, 28($v0) # internal_139[20] = ' ' + sb $t0, 28($v0) # internal_189[20] = ' ' addi $t0, $zero, 32 - sb $t0, 29($v0) # internal_139[21] = ' ' + sb $t0, 29($v0) # internal_189[21] = ' ' addi $t0, $zero, 32 - sb $t0, 30($v0) # internal_139[22] = ' ' + sb $t0, 30($v0) # internal_189[22] = ' ' addi $t0, $zero, 88 - sb $t0, 31($v0) # internal_139[23] = 'X' + sb $t0, 31($v0) # internal_189[23] = 'X' addi $t0, $zero, 88 - sb $t0, 32($v0) # internal_139[24] = 'X' + sb $t0, 32($v0) # internal_189[24] = 'X' addi $t0, $zero, 88 - sb $t0, 33($v0) # internal_139[25] = 'X' + sb $t0, 33($v0) # internal_189[25] = 'X' addi $t0, $zero, 88 - sb $t0, 34($v0) # internal_139[26] = 'X' + sb $t0, 34($v0) # internal_189[26] = 'X' addi $t0, $zero, 32 - sb $t0, 35($v0) # internal_139[27] = ' ' + sb $t0, 35($v0) # internal_189[27] = ' ' sb $zero, 36($v0) # Null-terminator at the end of the string - sw $v0, 64($sp) # internal_139 = "XXX X X X X XXXX " + sw $v0, 64($sp) # internal_189 = "XXX X X X X XXXX " - # internal_135 = internal_139 + # internal_185 = internal_189 lw $t0, 64($sp) sw $t0, 80($sp) - # Jumping to endif_8768338410632 - j endif_8768338410632 + # Jumping to endif_8737379856869 + j endif_8737379856869 - else_8768338410632: + else_8737379856869: # Allocating Bool 0 li $v0, 9 @@ -13497,7 +15060,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 56($sp) # internal_141 = address of allocated object Int + sw $v0, 56($sp) # internal_191 = address of allocated object Int # Allocating Int 19 li $v0, 9 @@ -13509,40 +15072,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 19 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 52($sp) # internal_142 = address of allocated object Int + sw $v0, 52($sp) # internal_192 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 632($sp) + lw $t0, 832($sp) sw $t0, 4($sp) # Storing num - # Argument internal_142 + # Argument internal_192 lw $t0, 64($sp) - sw $t0, 0($sp) # Storing internal_142 + sw $t0, 0($sp) # Storing internal_192 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 60($sp) # internal_143 = result of function_equal + sw $v1, 60($sp) # internal_193 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_141 = internal_143 + # internal_191 = internal_193 lw $t0, 48($sp) sw $t0, 56($sp) - # If internal_141 then goto then_8768338410626 + # If internal_191 then goto then_8737379856863 lw $t0, 56($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338410626 + beq $t0, $t1, then_8737379856863 - # Jumping to else_8768338410626 - j else_8768338410626 + # Jumping to else_8737379856863 + j else_8737379856863 - then_8768338410626: + then_8737379856863: # Allocating String li $v0, 9 @@ -13556,65 +15119,65 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_144[0] = ' ' + sb $t0, 8($v0) # internal_194[0] = ' ' addi $t0, $zero, 88 - sb $t0, 9($v0) # internal_144[1] = 'X' + sb $t0, 9($v0) # internal_194[1] = 'X' addi $t0, $zero, 88 - sb $t0, 10($v0) # internal_144[2] = 'X' + sb $t0, 10($v0) # internal_194[2] = 'X' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_144[3] = ' ' + sb $t0, 11($v0) # internal_194[3] = ' ' addi $t0, $zero, 88 - sb $t0, 12($v0) # internal_144[4] = 'X' + sb $t0, 12($v0) # internal_194[4] = 'X' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_144[5] = ' ' + sb $t0, 13($v0) # internal_194[5] = ' ' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_144[6] = ' ' + sb $t0, 14($v0) # internal_194[6] = ' ' addi $t0, $zero, 88 - sb $t0, 15($v0) # internal_144[7] = 'X' + sb $t0, 15($v0) # internal_194[7] = 'X' addi $t0, $zero, 88 - sb $t0, 16($v0) # internal_144[8] = 'X' + sb $t0, 16($v0) # internal_194[8] = 'X' addi $t0, $zero, 32 - sb $t0, 17($v0) # internal_144[9] = ' ' + sb $t0, 17($v0) # internal_194[9] = ' ' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_144[10] = ' ' + sb $t0, 18($v0) # internal_194[10] = ' ' addi $t0, $zero, 88 - sb $t0, 19($v0) # internal_144[11] = 'X' + sb $t0, 19($v0) # internal_194[11] = 'X' addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_144[12] = ' ' + sb $t0, 20($v0) # internal_194[12] = ' ' addi $t0, $zero, 88 - sb $t0, 21($v0) # internal_144[13] = 'X' + sb $t0, 21($v0) # internal_194[13] = 'X' addi $t0, $zero, 88 - sb $t0, 22($v0) # internal_144[14] = 'X' + sb $t0, 22($v0) # internal_194[14] = 'X' addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_144[15] = ' ' + sb $t0, 23($v0) # internal_194[15] = ' ' sb $zero, 24($v0) # Null-terminator at the end of the string - sw $v0, 44($sp) # internal_144 = " XX X XX X XX " + sw $v0, 44($sp) # internal_194 = " XX X XX X XX " - # internal_140 = internal_144 + # internal_190 = internal_194 lw $t0, 44($sp) sw $t0, 60($sp) - # Jumping to endif_8768338410626 - j endif_8768338410626 + # Jumping to endif_8737379856863 + j endif_8737379856863 - else_8768338410626: + else_8737379856863: # Allocating Bool 0 li $v0, 9 @@ -13626,7 +15189,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_146 = address of allocated object Int + sw $v0, 36($sp) # internal_196 = address of allocated object Int # Allocating Int 20 li $v0, 9 @@ -13638,40 +15201,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 20 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_147 = address of allocated object Int + sw $v0, 32($sp) # internal_197 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 632($sp) + lw $t0, 832($sp) sw $t0, 4($sp) # Storing num - # Argument internal_147 + # Argument internal_197 lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_147 + sw $t0, 0($sp) # Storing internal_197 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 40($sp) # internal_148 = result of function_equal + sw $v1, 40($sp) # internal_198 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_146 = internal_148 + # internal_196 = internal_198 lw $t0, 28($sp) sw $t0, 36($sp) - # If internal_146 then goto then_8768338410620 + # If internal_196 then goto then_8737379856857 lw $t0, 36($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338410620 + beq $t0, $t1, then_8737379856857 - # Jumping to else_8768338410620 - j else_8768338410620 + # Jumping to else_8737379856857 + j else_8737379856857 - then_8768338410620: + then_8737379856857: # Allocating String li $v0, 9 @@ -13685,101 +15248,101 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_149[0] = ' ' + sb $t0, 8($v0) # internal_199[0] = ' ' addi $t0, $zero, 88 - sb $t0, 9($v0) # internal_149[1] = 'X' + sb $t0, 9($v0) # internal_199[1] = 'X' addi $t0, $zero, 88 - sb $t0, 10($v0) # internal_149[2] = 'X' + sb $t0, 10($v0) # internal_199[2] = 'X' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_149[3] = ' ' + sb $t0, 11($v0) # internal_199[3] = ' ' addi $t0, $zero, 88 - sb $t0, 12($v0) # internal_149[4] = 'X' + sb $t0, 12($v0) # internal_199[4] = 'X' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_149[5] = ' ' + sb $t0, 13($v0) # internal_199[5] = ' ' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_149[6] = ' ' + sb $t0, 14($v0) # internal_199[6] = ' ' addi $t0, $zero, 88 - sb $t0, 15($v0) # internal_149[7] = 'X' + sb $t0, 15($v0) # internal_199[7] = 'X' addi $t0, $zero, 88 - sb $t0, 16($v0) # internal_149[8] = 'X' + sb $t0, 16($v0) # internal_199[8] = 'X' addi $t0, $zero, 32 - sb $t0, 17($v0) # internal_149[9] = ' ' + sb $t0, 17($v0) # internal_199[9] = ' ' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_149[10] = ' ' + sb $t0, 18($v0) # internal_199[10] = ' ' addi $t0, $zero, 88 - sb $t0, 19($v0) # internal_149[11] = 'X' + sb $t0, 19($v0) # internal_199[11] = 'X' addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_149[12] = ' ' + sb $t0, 20($v0) # internal_199[12] = ' ' addi $t0, $zero, 88 - sb $t0, 21($v0) # internal_149[13] = 'X' + sb $t0, 21($v0) # internal_199[13] = 'X' addi $t0, $zero, 88 - sb $t0, 22($v0) # internal_149[14] = 'X' + sb $t0, 22($v0) # internal_199[14] = 'X' addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_149[15] = ' ' + sb $t0, 23($v0) # internal_199[15] = ' ' addi $t0, $zero, 88 - sb $t0, 24($v0) # internal_149[16] = 'X' + sb $t0, 24($v0) # internal_199[16] = 'X' addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_149[17] = ' ' + sb $t0, 25($v0) # internal_199[17] = ' ' addi $t0, $zero, 32 - sb $t0, 26($v0) # internal_149[18] = ' ' + sb $t0, 26($v0) # internal_199[18] = ' ' addi $t0, $zero, 88 - sb $t0, 27($v0) # internal_149[19] = 'X' + sb $t0, 27($v0) # internal_199[19] = 'X' addi $t0, $zero, 88 - sb $t0, 28($v0) # internal_149[20] = 'X' + sb $t0, 28($v0) # internal_199[20] = 'X' addi $t0, $zero, 32 - sb $t0, 29($v0) # internal_149[21] = ' ' + sb $t0, 29($v0) # internal_199[21] = ' ' addi $t0, $zero, 32 - sb $t0, 30($v0) # internal_149[22] = ' ' + sb $t0, 30($v0) # internal_199[22] = ' ' addi $t0, $zero, 88 - sb $t0, 31($v0) # internal_149[23] = 'X' + sb $t0, 31($v0) # internal_199[23] = 'X' addi $t0, $zero, 32 - sb $t0, 32($v0) # internal_149[24] = ' ' + sb $t0, 32($v0) # internal_199[24] = ' ' addi $t0, $zero, 88 - sb $t0, 33($v0) # internal_149[25] = 'X' + sb $t0, 33($v0) # internal_199[25] = 'X' addi $t0, $zero, 88 - sb $t0, 34($v0) # internal_149[26] = 'X' + sb $t0, 34($v0) # internal_199[26] = 'X' addi $t0, $zero, 32 - sb $t0, 35($v0) # internal_149[27] = ' ' + sb $t0, 35($v0) # internal_199[27] = ' ' sb $zero, 36($v0) # Null-terminator at the end of the string - sw $v0, 24($sp) # internal_149 = " XX X XX X XX X XX X XX " + sw $v0, 24($sp) # internal_199 = " XX X XX X XX X XX X XX " - # internal_145 = internal_149 + # internal_195 = internal_199 lw $t0, 24($sp) sw $t0, 40($sp) - # Jumping to endif_8768338410620 - j endif_8768338410620 + # Jumping to endif_8737379856857 + j endif_8737379856857 - else_8768338410620: + else_8737379856857: # Allocating Bool 0 li $v0, 9 @@ -13791,7 +15354,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_151 = address of allocated object Int + sw $v0, 16($sp) # internal_201 = address of allocated object Int # Allocating Int 21 li $v0, 9 @@ -13803,40 +15366,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 21 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 12($sp) # internal_152 = address of allocated object Int + sw $v0, 12($sp) # internal_202 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument num - lw $t0, 632($sp) + lw $t0, 832($sp) sw $t0, 4($sp) # Storing num - # Argument internal_152 + # Argument internal_202 lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_152 + sw $t0, 0($sp) # Storing internal_202 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 20($sp) # internal_153 = result of function_equal + sw $v1, 20($sp) # internal_203 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_151 = internal_153 + # internal_201 = internal_203 lw $t0, 8($sp) sw $t0, 16($sp) - # If internal_151 then goto then_8768338410614 + # If internal_201 then goto then_8737379856851 lw $t0, 16($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338410614 + beq $t0, $t1, then_8737379856851 - # Jumping to else_8768338410614 - j else_8768338410614 + # Jumping to else_8737379856851 + j else_8737379856851 - then_8768338410614: + then_8737379856851: # Allocating String li $v0, 9 @@ -13850,101 +15413,101 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_154[0] = ' ' + sb $t0, 8($v0) # internal_204[0] = ' ' addi $t0, $zero, 88 - sb $t0, 9($v0) # internal_154[1] = 'X' + sb $t0, 9($v0) # internal_204[1] = 'X' addi $t0, $zero, 88 - sb $t0, 10($v0) # internal_154[2] = 'X' + sb $t0, 10($v0) # internal_204[2] = 'X' addi $t0, $zero, 88 - sb $t0, 11($v0) # internal_154[3] = 'X' + sb $t0, 11($v0) # internal_204[3] = 'X' addi $t0, $zero, 88 - sb $t0, 12($v0) # internal_154[4] = 'X' + sb $t0, 12($v0) # internal_204[4] = 'X' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_154[5] = ' ' + sb $t0, 13($v0) # internal_204[5] = ' ' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_154[6] = ' ' + sb $t0, 14($v0) # internal_204[6] = ' ' addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_154[7] = ' ' + sb $t0, 15($v0) # internal_204[7] = ' ' addi $t0, $zero, 88 - sb $t0, 16($v0) # internal_154[8] = 'X' + sb $t0, 16($v0) # internal_204[8] = 'X' addi $t0, $zero, 32 - sb $t0, 17($v0) # internal_154[9] = ' ' + sb $t0, 17($v0) # internal_204[9] = ' ' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_154[10] = ' ' + sb $t0, 18($v0) # internal_204[10] = ' ' addi $t0, $zero, 32 - sb $t0, 19($v0) # internal_154[11] = ' ' + sb $t0, 19($v0) # internal_204[11] = ' ' addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_154[12] = ' ' + sb $t0, 20($v0) # internal_204[12] = ' ' addi $t0, $zero, 88 - sb $t0, 21($v0) # internal_154[13] = 'X' + sb $t0, 21($v0) # internal_204[13] = 'X' addi $t0, $zero, 88 - sb $t0, 22($v0) # internal_154[14] = 'X' + sb $t0, 22($v0) # internal_204[14] = 'X' addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_154[15] = ' ' + sb $t0, 23($v0) # internal_204[15] = ' ' addi $t0, $zero, 32 - sb $t0, 24($v0) # internal_154[16] = ' ' + sb $t0, 24($v0) # internal_204[16] = ' ' addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_154[17] = ' ' + sb $t0, 25($v0) # internal_204[17] = ' ' addi $t0, $zero, 32 - sb $t0, 26($v0) # internal_154[18] = ' ' + sb $t0, 26($v0) # internal_204[18] = ' ' addi $t0, $zero, 88 - sb $t0, 27($v0) # internal_154[19] = 'X' + sb $t0, 27($v0) # internal_204[19] = 'X' addi $t0, $zero, 32 - sb $t0, 28($v0) # internal_154[20] = ' ' + sb $t0, 28($v0) # internal_204[20] = ' ' addi $t0, $zero, 32 - sb $t0, 29($v0) # internal_154[21] = ' ' + sb $t0, 29($v0) # internal_204[21] = ' ' addi $t0, $zero, 32 - sb $t0, 30($v0) # internal_154[22] = ' ' + sb $t0, 30($v0) # internal_204[22] = ' ' addi $t0, $zero, 88 - sb $t0, 31($v0) # internal_154[23] = 'X' + sb $t0, 31($v0) # internal_204[23] = 'X' addi $t0, $zero, 88 - sb $t0, 32($v0) # internal_154[24] = 'X' + sb $t0, 32($v0) # internal_204[24] = 'X' addi $t0, $zero, 88 - sb $t0, 33($v0) # internal_154[25] = 'X' + sb $t0, 33($v0) # internal_204[25] = 'X' addi $t0, $zero, 88 - sb $t0, 34($v0) # internal_154[26] = 'X' + sb $t0, 34($v0) # internal_204[26] = 'X' addi $t0, $zero, 32 - sb $t0, 35($v0) # internal_154[27] = ' ' + sb $t0, 35($v0) # internal_204[27] = ' ' sb $zero, 36($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_154 = " XXXX X XX X XXXX " + sw $v0, 4($sp) # internal_204 = " XXXX X XX X XXXX " - # internal_150 = internal_154 + # internal_200 = internal_204 lw $t0, 4($sp) sw $t0, 20($sp) - # Jumping to endif_8768338410614 - j endif_8768338410614 + # Jumping to endif_8737379856851 + j endif_8737379856851 - else_8768338410614: + else_8737379856851: # Allocating String li $v0, 9 @@ -13958,288 +15521,288 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_155[0] = ' ' + sb $t0, 8($v0) # internal_205[0] = ' ' addi $t0, $zero, 32 - sb $t0, 9($v0) # internal_155[1] = ' ' + sb $t0, 9($v0) # internal_205[1] = ' ' addi $t0, $zero, 32 - sb $t0, 10($v0) # internal_155[2] = ' ' + sb $t0, 10($v0) # internal_205[2] = ' ' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_155[3] = ' ' + sb $t0, 11($v0) # internal_205[3] = ' ' addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_155[4] = ' ' + sb $t0, 12($v0) # internal_205[4] = ' ' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_155[5] = ' ' + sb $t0, 13($v0) # internal_205[5] = ' ' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_155[6] = ' ' + sb $t0, 14($v0) # internal_205[6] = ' ' addi $t0, $zero, 32 - sb $t0, 15($v0) # internal_155[7] = ' ' + sb $t0, 15($v0) # internal_205[7] = ' ' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_155[8] = ' ' + sb $t0, 16($v0) # internal_205[8] = ' ' addi $t0, $zero, 32 - sb $t0, 17($v0) # internal_155[9] = ' ' + sb $t0, 17($v0) # internal_205[9] = ' ' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_155[10] = ' ' + sb $t0, 18($v0) # internal_205[10] = ' ' addi $t0, $zero, 32 - sb $t0, 19($v0) # internal_155[11] = ' ' + sb $t0, 19($v0) # internal_205[11] = ' ' addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_155[12] = ' ' + sb $t0, 20($v0) # internal_205[12] = ' ' addi $t0, $zero, 32 - sb $t0, 21($v0) # internal_155[13] = ' ' + sb $t0, 21($v0) # internal_205[13] = ' ' addi $t0, $zero, 32 - sb $t0, 22($v0) # internal_155[14] = ' ' + sb $t0, 22($v0) # internal_205[14] = ' ' addi $t0, $zero, 32 - sb $t0, 23($v0) # internal_155[15] = ' ' + sb $t0, 23($v0) # internal_205[15] = ' ' addi $t0, $zero, 32 - sb $t0, 24($v0) # internal_155[16] = ' ' + sb $t0, 24($v0) # internal_205[16] = ' ' addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_155[17] = ' ' + sb $t0, 25($v0) # internal_205[17] = ' ' addi $t0, $zero, 32 - sb $t0, 26($v0) # internal_155[18] = ' ' + sb $t0, 26($v0) # internal_205[18] = ' ' addi $t0, $zero, 32 - sb $t0, 27($v0) # internal_155[19] = ' ' + sb $t0, 27($v0) # internal_205[19] = ' ' addi $t0, $zero, 32 - sb $t0, 28($v0) # internal_155[20] = ' ' + sb $t0, 28($v0) # internal_205[20] = ' ' addi $t0, $zero, 32 - sb $t0, 29($v0) # internal_155[21] = ' ' + sb $t0, 29($v0) # internal_205[21] = ' ' addi $t0, $zero, 32 - sb $t0, 30($v0) # internal_155[22] = ' ' + sb $t0, 30($v0) # internal_205[22] = ' ' addi $t0, $zero, 32 - sb $t0, 31($v0) # internal_155[23] = ' ' + sb $t0, 31($v0) # internal_205[23] = ' ' addi $t0, $zero, 32 - sb $t0, 32($v0) # internal_155[24] = ' ' + sb $t0, 32($v0) # internal_205[24] = ' ' sb $zero, 33($v0) # Null-terminator at the end of the string - sw $v0, 0($sp) # internal_155 = " " + sw $v0, 0($sp) # internal_205 = " " - # internal_150 = internal_155 + # internal_200 = internal_205 lw $t0, 0($sp) sw $t0, 20($sp) - # Jumping to endif_8768338410614 - j endif_8768338410614 + # Jumping to endif_8737379856851 + j endif_8737379856851 - endif_8768338410614: + endif_8737379856851: - # internal_145 = internal_150 + # internal_195 = internal_200 lw $t0, 20($sp) sw $t0, 40($sp) - # Jumping to endif_8768338410620 - j endif_8768338410620 + # Jumping to endif_8737379856857 + j endif_8737379856857 - endif_8768338410620: + endif_8737379856857: - # internal_140 = internal_145 + # internal_190 = internal_195 lw $t0, 40($sp) sw $t0, 60($sp) - # Jumping to endif_8768338410626 - j endif_8768338410626 + # Jumping to endif_8737379856863 + j endif_8737379856863 - endif_8768338410626: + endif_8737379856863: - # internal_135 = internal_140 + # internal_185 = internal_190 lw $t0, 60($sp) sw $t0, 80($sp) - # Jumping to endif_8768338410632 - j endif_8768338410632 + # Jumping to endif_8737379856869 + j endif_8737379856869 - endif_8768338410632: + endif_8737379856869: - # internal_130 = internal_135 + # internal_180 = internal_185 lw $t0, 80($sp) sw $t0, 100($sp) - # Jumping to endif_8768338410638 - j endif_8768338410638 + # Jumping to endif_8737379856875 + j endif_8737379856875 - endif_8768338410638: + endif_8737379856875: - # internal_125 = internal_130 + # internal_175 = internal_180 lw $t0, 100($sp) sw $t0, 120($sp) - # Jumping to endif_8768338410644 - j endif_8768338410644 + # Jumping to endif_8737379856881 + j endif_8737379856881 - endif_8768338410644: + endif_8737379856881: - # internal_120 = internal_125 + # internal_170 = internal_175 lw $t0, 120($sp) sw $t0, 140($sp) - # Jumping to endif_8768338410650 - j endif_8768338410650 + # Jumping to endif_8737379856887 + j endif_8737379856887 - endif_8768338410650: + endif_8737379856887: - # internal_115 = internal_120 + # internal_165 = internal_170 lw $t0, 140($sp) sw $t0, 160($sp) - # Jumping to endif_8768338410656 - j endif_8768338410656 + # Jumping to endif_8737379856893 + j endif_8737379856893 - endif_8768338410656: + endif_8737379856893: - # internal_110 = internal_115 + # internal_160 = internal_165 lw $t0, 160($sp) sw $t0, 180($sp) - # Jumping to endif_8768338410662 - j endif_8768338410662 + # Jumping to endif_8737379857159 + j endif_8737379857159 - endif_8768338410662: + endif_8737379857159: - # internal_105 = internal_110 + # internal_155 = internal_160 lw $t0, 180($sp) sw $t0, 200($sp) - # Jumping to endif_8768338410668 - j endif_8768338410668 + # Jumping to endif_8737379857165 + j endif_8737379857165 - endif_8768338410668: + endif_8737379857165: - # internal_100 = internal_105 + # internal_150 = internal_155 lw $t0, 200($sp) sw $t0, 220($sp) - # Jumping to endif_8768338410674 - j endif_8768338410674 + # Jumping to endif_8737379857171 + j endif_8737379857171 - endif_8768338410674: + endif_8737379857171: - # internal_95 = internal_100 + # internal_145 = internal_150 lw $t0, 220($sp) sw $t0, 240($sp) - # Jumping to endif_8768338410680 - j endif_8768338410680 + # Jumping to endif_8737379857177 + j endif_8737379857177 - endif_8768338410680: + endif_8737379857177: - # internal_90 = internal_95 + # internal_140 = internal_145 lw $t0, 240($sp) sw $t0, 260($sp) - # Jumping to endif_8768338410686 - j endif_8768338410686 + # Jumping to endif_8737379857183 + j endif_8737379857183 - endif_8768338410686: + endif_8737379857183: - # internal_85 = internal_90 + # internal_135 = internal_140 lw $t0, 260($sp) sw $t0, 280($sp) - # Jumping to endif_8768338410692 - j endif_8768338410692 + # Jumping to endif_8737379857189 + j endif_8737379857189 - endif_8768338410692: + endif_8737379857189: - # internal_80 = internal_85 + # internal_130 = internal_135 lw $t0, 280($sp) sw $t0, 300($sp) - # Jumping to endif_8768338410698 - j endif_8768338410698 + # Jumping to endif_8737379857195 + j endif_8737379857195 - endif_8768338410698: + endif_8737379857195: - # internal_75 = internal_80 + # internal_125 = internal_130 lw $t0, 300($sp) sw $t0, 320($sp) - # Jumping to endif_8768338410704 - j endif_8768338410704 + # Jumping to endif_8737379857201 + j endif_8737379857201 - endif_8768338410704: + endif_8737379857201: - # internal_70 = internal_75 + # internal_120 = internal_125 lw $t0, 320($sp) sw $t0, 340($sp) - # Jumping to endif_8768338410710 - j endif_8768338410710 + # Jumping to endif_8737379857207 + j endif_8737379857207 - endif_8768338410710: + endif_8737379857207: - # internal_65 = internal_70 + # internal_115 = internal_120 lw $t0, 340($sp) sw $t0, 360($sp) - # Jumping to endif_8768338410716 - j endif_8768338410716 + # Jumping to endif_8737379857213 + j endif_8737379857213 - endif_8768338410716: + endif_8737379857213: - # internal_60 = internal_65 + # internal_110 = internal_115 lw $t0, 360($sp) sw $t0, 380($sp) - # Jumping to endif_8768338410722 - j endif_8768338410722 + # Jumping to endif_8737379857219 + j endif_8737379857219 - endif_8768338410722: + endif_8737379857219: - # internal_55 = internal_60 + # internal_105 = internal_110 lw $t0, 380($sp) sw $t0, 400($sp) - # Jumping to endif_8768338410728 - j endif_8768338410728 + # Jumping to endif_8737379857225 + j endif_8737379857225 - endif_8768338410728: + endif_8737379857225: - # internal_50 = internal_55 + # internal_100 = internal_105 lw $t0, 400($sp) sw $t0, 420($sp) - # Jumping to endif_8768338410734 - j endif_8768338410734 + # Jumping to endif_8737379857231 + j endif_8737379857231 - endif_8768338410734: + endif_8737379857231: # Loading return value in $v1 lw $v1, 420($sp) # Freeing space for local variables - addi $sp, $sp, 624 + addi $sp, $sp, 824 jr $ra function_prompt_at_CellularAutomaton: # Function parameters - # $ra = 60($sp) - # self = 56($sp) + # $ra = 92($sp) + # self = 88($sp) # Reserving space for local variables - addi $sp, $sp, -56 + addi $sp, $sp, -88 # Allocating String li $v0, 9 @@ -14254,7 +15817,7 @@ sb $zero, 8($v0) # Null-terminator at the end of the string - sw $v0, 52($sp) # ans = "" + sw $v0, 84($sp) # ans = "" # Allocating String li $v0, 9 @@ -14431,24 +15994,48 @@ sb $zero, 62($v0) # Null-terminator at the end of the string - sw $v0, 48($sp) # internal_1 = "Would you like to continue with the next generation? \n" + sw $v0, 80($sp) # internal_1 = "Would you like to continue with the next generation? \n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_3 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 88($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 72($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 68($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 68($sp) + lw $t0, 100($sp) sw $t0, 4($sp) # Storing self # Argument internal_1 - lw $t0, 60($sp) + lw $t0, 92($sp) sw $t0, 0($sp) # Storing internal_1 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_4 + lw $t0, 80($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 56($sp) # internal_2 = result of function_out_string_at_IO + sw $v1, 88($sp) # internal_2 = result of internal_4 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -14463,186 +16050,234 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 80 - sb $t0, 8($v0) # internal_3[0] = 'P' + sb $t0, 8($v0) # internal_5[0] = 'P' addi $t0, $zero, 108 - sb $t0, 9($v0) # internal_3[1] = 'l' + sb $t0, 9($v0) # internal_5[1] = 'l' addi $t0, $zero, 101 - sb $t0, 10($v0) # internal_3[2] = 'e' + sb $t0, 10($v0) # internal_5[2] = 'e' addi $t0, $zero, 97 - sb $t0, 11($v0) # internal_3[3] = 'a' + sb $t0, 11($v0) # internal_5[3] = 'a' addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_3[4] = 's' + sb $t0, 12($v0) # internal_5[4] = 's' addi $t0, $zero, 101 - sb $t0, 13($v0) # internal_3[5] = 'e' + sb $t0, 13($v0) # internal_5[5] = 'e' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_3[6] = ' ' + sb $t0, 14($v0) # internal_5[6] = ' ' addi $t0, $zero, 117 - sb $t0, 15($v0) # internal_3[7] = 'u' + sb $t0, 15($v0) # internal_5[7] = 'u' addi $t0, $zero, 115 - sb $t0, 16($v0) # internal_3[8] = 's' + sb $t0, 16($v0) # internal_5[8] = 's' addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_3[9] = 'e' + sb $t0, 17($v0) # internal_5[9] = 'e' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_3[10] = ' ' + sb $t0, 18($v0) # internal_5[10] = ' ' addi $t0, $zero, 108 - sb $t0, 19($v0) # internal_3[11] = 'l' + sb $t0, 19($v0) # internal_5[11] = 'l' addi $t0, $zero, 111 - sb $t0, 20($v0) # internal_3[12] = 'o' + sb $t0, 20($v0) # internal_5[12] = 'o' addi $t0, $zero, 119 - sb $t0, 21($v0) # internal_3[13] = 'w' + sb $t0, 21($v0) # internal_5[13] = 'w' addi $t0, $zero, 101 - sb $t0, 22($v0) # internal_3[14] = 'e' + sb $t0, 22($v0) # internal_5[14] = 'e' addi $t0, $zero, 114 - sb $t0, 23($v0) # internal_3[15] = 'r' + sb $t0, 23($v0) # internal_5[15] = 'r' addi $t0, $zero, 99 - sb $t0, 24($v0) # internal_3[16] = 'c' + sb $t0, 24($v0) # internal_5[16] = 'c' addi $t0, $zero, 97 - sb $t0, 25($v0) # internal_3[17] = 'a' + sb $t0, 25($v0) # internal_5[17] = 'a' addi $t0, $zero, 115 - sb $t0, 26($v0) # internal_3[18] = 's' + sb $t0, 26($v0) # internal_5[18] = 's' addi $t0, $zero, 101 - sb $t0, 27($v0) # internal_3[19] = 'e' + sb $t0, 27($v0) # internal_5[19] = 'e' addi $t0, $zero, 32 - sb $t0, 28($v0) # internal_3[20] = ' ' + sb $t0, 28($v0) # internal_5[20] = ' ' addi $t0, $zero, 121 - sb $t0, 29($v0) # internal_3[21] = 'y' + sb $t0, 29($v0) # internal_5[21] = 'y' addi $t0, $zero, 32 - sb $t0, 30($v0) # internal_3[22] = ' ' + sb $t0, 30($v0) # internal_5[22] = ' ' addi $t0, $zero, 111 - sb $t0, 31($v0) # internal_3[23] = 'o' + sb $t0, 31($v0) # internal_5[23] = 'o' addi $t0, $zero, 114 - sb $t0, 32($v0) # internal_3[24] = 'r' + sb $t0, 32($v0) # internal_5[24] = 'r' addi $t0, $zero, 32 - sb $t0, 33($v0) # internal_3[25] = ' ' + sb $t0, 33($v0) # internal_5[25] = ' ' addi $t0, $zero, 110 - sb $t0, 34($v0) # internal_3[26] = 'n' + sb $t0, 34($v0) # internal_5[26] = 'n' addi $t0, $zero, 32 - sb $t0, 35($v0) # internal_3[27] = ' ' + sb $t0, 35($v0) # internal_5[27] = ' ' addi $t0, $zero, 102 - sb $t0, 36($v0) # internal_3[28] = 'f' + sb $t0, 36($v0) # internal_5[28] = 'f' addi $t0, $zero, 111 - sb $t0, 37($v0) # internal_3[29] = 'o' + sb $t0, 37($v0) # internal_5[29] = 'o' addi $t0, $zero, 114 - sb $t0, 38($v0) # internal_3[30] = 'r' + sb $t0, 38($v0) # internal_5[30] = 'r' addi $t0, $zero, 32 - sb $t0, 39($v0) # internal_3[31] = ' ' + sb $t0, 39($v0) # internal_5[31] = ' ' addi $t0, $zero, 121 - sb $t0, 40($v0) # internal_3[32] = 'y' + sb $t0, 40($v0) # internal_5[32] = 'y' addi $t0, $zero, 111 - sb $t0, 41($v0) # internal_3[33] = 'o' + sb $t0, 41($v0) # internal_5[33] = 'o' addi $t0, $zero, 117 - sb $t0, 42($v0) # internal_3[34] = 'u' + sb $t0, 42($v0) # internal_5[34] = 'u' addi $t0, $zero, 114 - sb $t0, 43($v0) # internal_3[35] = 'r' + sb $t0, 43($v0) # internal_5[35] = 'r' addi $t0, $zero, 32 - sb $t0, 44($v0) # internal_3[36] = ' ' + sb $t0, 44($v0) # internal_5[36] = ' ' addi $t0, $zero, 97 - sb $t0, 45($v0) # internal_3[37] = 'a' + sb $t0, 45($v0) # internal_5[37] = 'a' addi $t0, $zero, 110 - sb $t0, 46($v0) # internal_3[38] = 'n' + sb $t0, 46($v0) # internal_5[38] = 'n' addi $t0, $zero, 115 - sb $t0, 47($v0) # internal_3[39] = 's' + sb $t0, 47($v0) # internal_5[39] = 's' addi $t0, $zero, 119 - sb $t0, 48($v0) # internal_3[40] = 'w' + sb $t0, 48($v0) # internal_5[40] = 'w' addi $t0, $zero, 101 - sb $t0, 49($v0) # internal_3[41] = 'e' + sb $t0, 49($v0) # internal_5[41] = 'e' addi $t0, $zero, 114 - sb $t0, 50($v0) # internal_3[42] = 'r' + sb $t0, 50($v0) # internal_5[42] = 'r' addi $t0, $zero, 32 - sb $t0, 51($v0) # internal_3[43] = ' ' + sb $t0, 51($v0) # internal_5[43] = ' ' addi $t0, $zero, 91 - sb $t0, 52($v0) # internal_3[44] = '[' + sb $t0, 52($v0) # internal_5[44] = '[' addi $t0, $zero, 121 - sb $t0, 53($v0) # internal_3[45] = 'y' + sb $t0, 53($v0) # internal_5[45] = 'y' addi $t0, $zero, 93 - sb $t0, 54($v0) # internal_3[46] = ']' + sb $t0, 54($v0) # internal_5[46] = ']' addi $t0, $zero, 58 - sb $t0, 55($v0) # internal_3[47] = ':' + sb $t0, 55($v0) # internal_5[47] = ':' addi $t0, $zero, 32 - sb $t0, 56($v0) # internal_3[48] = ' ' + sb $t0, 56($v0) # internal_5[48] = ' ' sb $zero, 57($v0) # Null-terminator at the end of the string - sw $v0, 40($sp) # internal_3 = "Please use lowercase y or n for your answer [y]: " + sw $v0, 64($sp) # internal_5 = "Please use lowercase y or n for your answer [y]: " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_7 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 88($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 56($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 52($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 68($sp) + lw $t0, 100($sp) sw $t0, 4($sp) # Storing self - # Argument internal_3 - lw $t0, 52($sp) - sw $t0, 0($sp) # Storing internal_3 - - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Argument internal_5 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function internal_8 + lw $t0, 64($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 48($sp) # internal_4 = result of function_out_string_at_IO + sw $v1, 72($sp) # internal_6 = result of internal_8 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_10 = address of allocated object Int + + # Get method in_string of CellularAutomaton + lw $t0, 88($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 44($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 40($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 64($sp) + lw $t0, 96($sp) sw $t0, 0($sp) # Storing self - # Calling function function_in_string_at_IO - jal function_in_string_at_IO + # Calling function internal_11 + lw $t0, 48($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 40($sp) # internal_5 = result of function_in_string_at_IO + sw $v1, 56($sp) # internal_9 = result of internal_11 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments @@ -14650,17 +16285,17 @@ sw $ra, 8($sp) # Storing return address # Argument ans - lw $t0, 64($sp) + lw $t0, 96($sp) sw $t0, 4($sp) # Storing ans - # Argument internal_5 - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_5 + # Argument internal_9 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_9 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 64($sp) # ans = result of function_assign + sw $v1, 96($sp) # ans = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -14675,28 +16310,52 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_6[0] = '\n' + sb $t0, 8($v0) # internal_12[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 28($sp) # internal_6 = "\n" + sw $v0, 36($sp) # internal_12 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_14 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 88($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 28($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 24($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 68($sp) + lw $t0, 100($sp) sw $t0, 4($sp) # Storing self - # Argument internal_6 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_6 + # Argument internal_12 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_12 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_15 + lw $t0, 36($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 36($sp) # internal_7 = result of function_out_string_at_IO + sw $v1, 44($sp) # internal_13 = result of internal_15 addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bool 0 @@ -14709,7 +16368,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_9 = address of allocated object Int + sw $v0, 16($sp) # internal_17 = address of allocated object Int # Allocating String li $v0, 9 @@ -14723,44 +16382,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 110 - sb $t0, 8($v0) # internal_10[0] = 'n' + sb $t0, 8($v0) # internal_18[0] = 'n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_10 = "n" + sw $v0, 12($sp) # internal_18 = "n" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument ans - lw $t0, 64($sp) + lw $t0, 96($sp) sw $t0, 4($sp) # Storing ans - # Argument internal_10 + # Argument internal_18 lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_10 + sw $t0, 0($sp) # Storing internal_18 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 20($sp) # internal_11 = result of function_equal + sw $v1, 20($sp) # internal_19 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_9 = internal_11 + # internal_17 = internal_19 lw $t0, 8($sp) sw $t0, 16($sp) - # If internal_9 then goto then_8768338411087 + # If internal_17 then goto then_8737379857324 lw $t0, 16($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338411087 + beq $t0, $t1, then_8737379857324 - # Jumping to else_8768338411087 - j else_8768338411087 + # Jumping to else_8737379857324 + j else_8737379857324 - then_8768338411087: + then_8737379857324: # Allocating Bool 0 li $v0, 9 @@ -14772,16 +16431,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_12 = address of allocated object Int + sw $v0, 4($sp) # internal_20 = address of allocated object Int - # internal_8 = internal_12 + # internal_16 = internal_20 lw $t0, 4($sp) sw $t0, 20($sp) - # Jumping to endif_8768338411087 - j endif_8768338411087 + # Jumping to endif_8737379857324 + j endif_8737379857324 - else_8768338411087: + else_8737379857324: # Allocating Bool 1 li $v0, 9 @@ -14793,32 +16452,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_13 = address of allocated object Int + sw $v0, 0($sp) # internal_21 = address of allocated object Int - # internal_8 = internal_13 + # internal_16 = internal_21 lw $t0, 0($sp) sw $t0, 20($sp) - # Jumping to endif_8768338411087 - j endif_8768338411087 + # Jumping to endif_8737379857324 + j endif_8737379857324 - endif_8768338411087: + endif_8737379857324: # Loading return value in $v1 lw $v1, 20($sp) # Freeing space for local variables - addi $sp, $sp, 56 + addi $sp, $sp, 88 jr $ra function_prompt2_at_CellularAutomaton: # Function parameters - # $ra = 60($sp) - # self = 56($sp) + # $ra = 92($sp) + # self = 88($sp) # Reserving space for local variables - addi $sp, $sp, -56 + addi $sp, $sp, -88 # Allocating String li $v0, 9 @@ -14833,7 +16492,7 @@ sb $zero, 8($v0) # Null-terminator at the end of the string - sw $v0, 52($sp) # ans = "" + sw $v0, 84($sp) # ans = "" # Allocating String li $v0, 9 @@ -14854,24 +16513,48 @@ sb $zero, 10($v0) # Null-terminator at the end of the string - sw $v0, 48($sp) # internal_1 = "\n\n" + sw $v0, 80($sp) # internal_1 = "\n\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_3 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 88($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 72($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 68($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 68($sp) + lw $t0, 100($sp) sw $t0, 4($sp) # Storing self # Argument internal_1 - lw $t0, 60($sp) + lw $t0, 92($sp) sw $t0, 0($sp) # Storing internal_1 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_4 + lw $t0, 80($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 56($sp) # internal_2 = result of function_out_string_at_IO + sw $v1, 88($sp) # internal_2 = result of internal_4 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -14886,169 +16569,193 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 87 - sb $t0, 8($v0) # internal_3[0] = 'W' + sb $t0, 8($v0) # internal_5[0] = 'W' addi $t0, $zero, 111 - sb $t0, 9($v0) # internal_3[1] = 'o' + sb $t0, 9($v0) # internal_5[1] = 'o' addi $t0, $zero, 117 - sb $t0, 10($v0) # internal_3[2] = 'u' + sb $t0, 10($v0) # internal_5[2] = 'u' addi $t0, $zero, 108 - sb $t0, 11($v0) # internal_3[3] = 'l' + sb $t0, 11($v0) # internal_5[3] = 'l' addi $t0, $zero, 100 - sb $t0, 12($v0) # internal_3[4] = 'd' + sb $t0, 12($v0) # internal_5[4] = 'd' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_3[5] = ' ' + sb $t0, 13($v0) # internal_5[5] = ' ' addi $t0, $zero, 121 - sb $t0, 14($v0) # internal_3[6] = 'y' + sb $t0, 14($v0) # internal_5[6] = 'y' addi $t0, $zero, 111 - sb $t0, 15($v0) # internal_3[7] = 'o' + sb $t0, 15($v0) # internal_5[7] = 'o' addi $t0, $zero, 117 - sb $t0, 16($v0) # internal_3[8] = 'u' + sb $t0, 16($v0) # internal_5[8] = 'u' addi $t0, $zero, 32 - sb $t0, 17($v0) # internal_3[9] = ' ' + sb $t0, 17($v0) # internal_5[9] = ' ' addi $t0, $zero, 108 - sb $t0, 18($v0) # internal_3[10] = 'l' + sb $t0, 18($v0) # internal_5[10] = 'l' addi $t0, $zero, 105 - sb $t0, 19($v0) # internal_3[11] = 'i' + sb $t0, 19($v0) # internal_5[11] = 'i' addi $t0, $zero, 107 - sb $t0, 20($v0) # internal_3[12] = 'k' + sb $t0, 20($v0) # internal_5[12] = 'k' addi $t0, $zero, 101 - sb $t0, 21($v0) # internal_3[13] = 'e' + sb $t0, 21($v0) # internal_5[13] = 'e' addi $t0, $zero, 32 - sb $t0, 22($v0) # internal_3[14] = ' ' + sb $t0, 22($v0) # internal_5[14] = ' ' addi $t0, $zero, 116 - sb $t0, 23($v0) # internal_3[15] = 't' + sb $t0, 23($v0) # internal_5[15] = 't' addi $t0, $zero, 111 - sb $t0, 24($v0) # internal_3[16] = 'o' + sb $t0, 24($v0) # internal_5[16] = 'o' addi $t0, $zero, 32 - sb $t0, 25($v0) # internal_3[17] = ' ' + sb $t0, 25($v0) # internal_5[17] = ' ' addi $t0, $zero, 99 - sb $t0, 26($v0) # internal_3[18] = 'c' + sb $t0, 26($v0) # internal_5[18] = 'c' addi $t0, $zero, 104 - sb $t0, 27($v0) # internal_3[19] = 'h' + sb $t0, 27($v0) # internal_5[19] = 'h' addi $t0, $zero, 111 - sb $t0, 28($v0) # internal_3[20] = 'o' + sb $t0, 28($v0) # internal_5[20] = 'o' addi $t0, $zero, 111 - sb $t0, 29($v0) # internal_3[21] = 'o' + sb $t0, 29($v0) # internal_5[21] = 'o' addi $t0, $zero, 115 - sb $t0, 30($v0) # internal_3[22] = 's' + sb $t0, 30($v0) # internal_5[22] = 's' addi $t0, $zero, 101 - sb $t0, 31($v0) # internal_3[23] = 'e' + sb $t0, 31($v0) # internal_5[23] = 'e' addi $t0, $zero, 32 - sb $t0, 32($v0) # internal_3[24] = ' ' + sb $t0, 32($v0) # internal_5[24] = ' ' addi $t0, $zero, 97 - sb $t0, 33($v0) # internal_3[25] = 'a' + sb $t0, 33($v0) # internal_5[25] = 'a' addi $t0, $zero, 32 - sb $t0, 34($v0) # internal_3[26] = ' ' + sb $t0, 34($v0) # internal_5[26] = ' ' addi $t0, $zero, 98 - sb $t0, 35($v0) # internal_3[27] = 'b' + sb $t0, 35($v0) # internal_5[27] = 'b' addi $t0, $zero, 97 - sb $t0, 36($v0) # internal_3[28] = 'a' + sb $t0, 36($v0) # internal_5[28] = 'a' addi $t0, $zero, 99 - sb $t0, 37($v0) # internal_3[29] = 'c' + sb $t0, 37($v0) # internal_5[29] = 'c' addi $t0, $zero, 107 - sb $t0, 38($v0) # internal_3[30] = 'k' + sb $t0, 38($v0) # internal_5[30] = 'k' addi $t0, $zero, 103 - sb $t0, 39($v0) # internal_3[31] = 'g' + sb $t0, 39($v0) # internal_5[31] = 'g' addi $t0, $zero, 114 - sb $t0, 40($v0) # internal_3[32] = 'r' + sb $t0, 40($v0) # internal_5[32] = 'r' addi $t0, $zero, 111 - sb $t0, 41($v0) # internal_3[33] = 'o' + sb $t0, 41($v0) # internal_5[33] = 'o' addi $t0, $zero, 117 - sb $t0, 42($v0) # internal_3[34] = 'u' + sb $t0, 42($v0) # internal_5[34] = 'u' addi $t0, $zero, 110 - sb $t0, 43($v0) # internal_3[35] = 'n' + sb $t0, 43($v0) # internal_5[35] = 'n' addi $t0, $zero, 100 - sb $t0, 44($v0) # internal_3[36] = 'd' + sb $t0, 44($v0) # internal_5[36] = 'd' addi $t0, $zero, 32 - sb $t0, 45($v0) # internal_3[37] = ' ' + sb $t0, 45($v0) # internal_5[37] = ' ' addi $t0, $zero, 112 - sb $t0, 46($v0) # internal_3[38] = 'p' + sb $t0, 46($v0) # internal_5[38] = 'p' addi $t0, $zero, 97 - sb $t0, 47($v0) # internal_3[39] = 'a' + sb $t0, 47($v0) # internal_5[39] = 'a' addi $t0, $zero, 116 - sb $t0, 48($v0) # internal_3[40] = 't' + sb $t0, 48($v0) # internal_5[40] = 't' addi $t0, $zero, 116 - sb $t0, 49($v0) # internal_3[41] = 't' + sb $t0, 49($v0) # internal_5[41] = 't' addi $t0, $zero, 101 - sb $t0, 50($v0) # internal_3[42] = 'e' + sb $t0, 50($v0) # internal_5[42] = 'e' addi $t0, $zero, 114 - sb $t0, 51($v0) # internal_3[43] = 'r' + sb $t0, 51($v0) # internal_5[43] = 'r' addi $t0, $zero, 110 - sb $t0, 52($v0) # internal_3[44] = 'n' + sb $t0, 52($v0) # internal_5[44] = 'n' addi $t0, $zero, 63 - sb $t0, 53($v0) # internal_3[45] = '?' + sb $t0, 53($v0) # internal_5[45] = '?' addi $t0, $zero, 32 - sb $t0, 54($v0) # internal_3[46] = ' ' + sb $t0, 54($v0) # internal_5[46] = ' ' addi $t0, $zero, 10 - sb $t0, 55($v0) # internal_3[47] = '\n' + sb $t0, 55($v0) # internal_5[47] = '\n' sb $zero, 56($v0) # Null-terminator at the end of the string - sw $v0, 40($sp) # internal_3 = "Would you like to choose a background pattern? \n" + sw $v0, 64($sp) # internal_5 = "Would you like to choose a background pattern? \n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_7 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 88($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 56($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 52($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 68($sp) + lw $t0, 100($sp) sw $t0, 4($sp) # Storing self - # Argument internal_3 - lw $t0, 52($sp) - sw $t0, 0($sp) # Storing internal_3 + # Argument internal_5 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_5 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_8 + lw $t0, 64($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 48($sp) # internal_4 = result of function_out_string_at_IO + sw $v1, 72($sp) # internal_6 = result of internal_8 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -15063,186 +16770,234 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 80 - sb $t0, 8($v0) # internal_5[0] = 'P' + sb $t0, 8($v0) # internal_9[0] = 'P' addi $t0, $zero, 108 - sb $t0, 9($v0) # internal_5[1] = 'l' + sb $t0, 9($v0) # internal_9[1] = 'l' addi $t0, $zero, 101 - sb $t0, 10($v0) # internal_5[2] = 'e' + sb $t0, 10($v0) # internal_9[2] = 'e' addi $t0, $zero, 97 - sb $t0, 11($v0) # internal_5[3] = 'a' + sb $t0, 11($v0) # internal_9[3] = 'a' addi $t0, $zero, 115 - sb $t0, 12($v0) # internal_5[4] = 's' + sb $t0, 12($v0) # internal_9[4] = 's' addi $t0, $zero, 101 - sb $t0, 13($v0) # internal_5[5] = 'e' + sb $t0, 13($v0) # internal_9[5] = 'e' addi $t0, $zero, 32 - sb $t0, 14($v0) # internal_5[6] = ' ' + sb $t0, 14($v0) # internal_9[6] = ' ' addi $t0, $zero, 117 - sb $t0, 15($v0) # internal_5[7] = 'u' + sb $t0, 15($v0) # internal_9[7] = 'u' addi $t0, $zero, 115 - sb $t0, 16($v0) # internal_5[8] = 's' + sb $t0, 16($v0) # internal_9[8] = 's' addi $t0, $zero, 101 - sb $t0, 17($v0) # internal_5[9] = 'e' + sb $t0, 17($v0) # internal_9[9] = 'e' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_5[10] = ' ' + sb $t0, 18($v0) # internal_9[10] = ' ' addi $t0, $zero, 108 - sb $t0, 19($v0) # internal_5[11] = 'l' + sb $t0, 19($v0) # internal_9[11] = 'l' addi $t0, $zero, 111 - sb $t0, 20($v0) # internal_5[12] = 'o' + sb $t0, 20($v0) # internal_9[12] = 'o' addi $t0, $zero, 119 - sb $t0, 21($v0) # internal_5[13] = 'w' + sb $t0, 21($v0) # internal_9[13] = 'w' addi $t0, $zero, 101 - sb $t0, 22($v0) # internal_5[14] = 'e' + sb $t0, 22($v0) # internal_9[14] = 'e' addi $t0, $zero, 114 - sb $t0, 23($v0) # internal_5[15] = 'r' + sb $t0, 23($v0) # internal_9[15] = 'r' addi $t0, $zero, 99 - sb $t0, 24($v0) # internal_5[16] = 'c' + sb $t0, 24($v0) # internal_9[16] = 'c' addi $t0, $zero, 97 - sb $t0, 25($v0) # internal_5[17] = 'a' + sb $t0, 25($v0) # internal_9[17] = 'a' addi $t0, $zero, 115 - sb $t0, 26($v0) # internal_5[18] = 's' + sb $t0, 26($v0) # internal_9[18] = 's' addi $t0, $zero, 101 - sb $t0, 27($v0) # internal_5[19] = 'e' + sb $t0, 27($v0) # internal_9[19] = 'e' addi $t0, $zero, 32 - sb $t0, 28($v0) # internal_5[20] = ' ' + sb $t0, 28($v0) # internal_9[20] = ' ' addi $t0, $zero, 121 - sb $t0, 29($v0) # internal_5[21] = 'y' + sb $t0, 29($v0) # internal_9[21] = 'y' addi $t0, $zero, 32 - sb $t0, 30($v0) # internal_5[22] = ' ' + sb $t0, 30($v0) # internal_9[22] = ' ' addi $t0, $zero, 111 - sb $t0, 31($v0) # internal_5[23] = 'o' + sb $t0, 31($v0) # internal_9[23] = 'o' addi $t0, $zero, 114 - sb $t0, 32($v0) # internal_5[24] = 'r' + sb $t0, 32($v0) # internal_9[24] = 'r' addi $t0, $zero, 32 - sb $t0, 33($v0) # internal_5[25] = ' ' + sb $t0, 33($v0) # internal_9[25] = ' ' addi $t0, $zero, 110 - sb $t0, 34($v0) # internal_5[26] = 'n' + sb $t0, 34($v0) # internal_9[26] = 'n' addi $t0, $zero, 32 - sb $t0, 35($v0) # internal_5[27] = ' ' + sb $t0, 35($v0) # internal_9[27] = ' ' addi $t0, $zero, 102 - sb $t0, 36($v0) # internal_5[28] = 'f' + sb $t0, 36($v0) # internal_9[28] = 'f' addi $t0, $zero, 111 - sb $t0, 37($v0) # internal_5[29] = 'o' + sb $t0, 37($v0) # internal_9[29] = 'o' addi $t0, $zero, 114 - sb $t0, 38($v0) # internal_5[30] = 'r' + sb $t0, 38($v0) # internal_9[30] = 'r' addi $t0, $zero, 32 - sb $t0, 39($v0) # internal_5[31] = ' ' + sb $t0, 39($v0) # internal_9[31] = ' ' addi $t0, $zero, 121 - sb $t0, 40($v0) # internal_5[32] = 'y' + sb $t0, 40($v0) # internal_9[32] = 'y' addi $t0, $zero, 111 - sb $t0, 41($v0) # internal_5[33] = 'o' + sb $t0, 41($v0) # internal_9[33] = 'o' addi $t0, $zero, 117 - sb $t0, 42($v0) # internal_5[34] = 'u' + sb $t0, 42($v0) # internal_9[34] = 'u' addi $t0, $zero, 114 - sb $t0, 43($v0) # internal_5[35] = 'r' + sb $t0, 43($v0) # internal_9[35] = 'r' addi $t0, $zero, 32 - sb $t0, 44($v0) # internal_5[36] = ' ' + sb $t0, 44($v0) # internal_9[36] = ' ' addi $t0, $zero, 97 - sb $t0, 45($v0) # internal_5[37] = 'a' + sb $t0, 45($v0) # internal_9[37] = 'a' addi $t0, $zero, 110 - sb $t0, 46($v0) # internal_5[38] = 'n' + sb $t0, 46($v0) # internal_9[38] = 'n' addi $t0, $zero, 115 - sb $t0, 47($v0) # internal_5[39] = 's' + sb $t0, 47($v0) # internal_9[39] = 's' addi $t0, $zero, 119 - sb $t0, 48($v0) # internal_5[40] = 'w' + sb $t0, 48($v0) # internal_9[40] = 'w' addi $t0, $zero, 101 - sb $t0, 49($v0) # internal_5[41] = 'e' + sb $t0, 49($v0) # internal_9[41] = 'e' addi $t0, $zero, 114 - sb $t0, 50($v0) # internal_5[42] = 'r' + sb $t0, 50($v0) # internal_9[42] = 'r' addi $t0, $zero, 32 - sb $t0, 51($v0) # internal_5[43] = ' ' + sb $t0, 51($v0) # internal_9[43] = ' ' addi $t0, $zero, 91 - sb $t0, 52($v0) # internal_5[44] = '[' + sb $t0, 52($v0) # internal_9[44] = '[' addi $t0, $zero, 110 - sb $t0, 53($v0) # internal_5[45] = 'n' + sb $t0, 53($v0) # internal_9[45] = 'n' addi $t0, $zero, 93 - sb $t0, 54($v0) # internal_5[46] = ']' + sb $t0, 54($v0) # internal_9[46] = ']' addi $t0, $zero, 58 - sb $t0, 55($v0) # internal_5[47] = ':' + sb $t0, 55($v0) # internal_9[47] = ':' addi $t0, $zero, 32 - sb $t0, 56($v0) # internal_5[48] = ' ' + sb $t0, 56($v0) # internal_9[48] = ' ' sb $zero, 57($v0) # Null-terminator at the end of the string - sw $v0, 32($sp) # internal_5 = "Please use lowercase y or n for your answer [n]: " + sw $v0, 48($sp) # internal_9 = "Please use lowercase y or n for your answer [n]: " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_11 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 88($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 40($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 36($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 68($sp) + lw $t0, 100($sp) sw $t0, 4($sp) # Storing self - # Argument internal_5 - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_5 + # Argument internal_9 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_9 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_12 + lw $t0, 48($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 40($sp) # internal_6 = result of function_out_string_at_IO + sw $v1, 56($sp) # internal_10 = result of internal_12 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_14 = address of allocated object Int + + # Get method in_string of CellularAutomaton + lw $t0, 88($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 28($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 24($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 64($sp) + lw $t0, 96($sp) sw $t0, 0($sp) # Storing self - # Calling function function_in_string_at_IO - jal function_in_string_at_IO + # Calling function internal_15 + lw $t0, 32($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 32($sp) # internal_7 = result of function_in_string_at_IO + sw $v1, 40($sp) # internal_13 = result of internal_15 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments @@ -15250,17 +17005,17 @@ sw $ra, 8($sp) # Storing return address # Argument ans - lw $t0, 64($sp) + lw $t0, 96($sp) sw $t0, 4($sp) # Storing ans - # Argument internal_7 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_7 + # Argument internal_13 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_13 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 64($sp) # ans = result of function_assign + sw $v1, 96($sp) # ans = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bool 0 @@ -15273,7 +17028,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_9 = address of allocated object Int + sw $v0, 16($sp) # internal_17 = address of allocated object Int # Allocating String li $v0, 9 @@ -15287,44 +17042,44 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 121 - sb $t0, 8($v0) # internal_10[0] = 'y' + sb $t0, 8($v0) # internal_18[0] = 'y' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_10 = "y" + sw $v0, 12($sp) # internal_18 = "y" # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument ans - lw $t0, 64($sp) + lw $t0, 96($sp) sw $t0, 4($sp) # Storing ans - # Argument internal_10 + # Argument internal_18 lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_10 + sw $t0, 0($sp) # Storing internal_18 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 20($sp) # internal_11 = result of function_equal + sw $v1, 20($sp) # internal_19 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_9 = internal_11 + # internal_17 = internal_19 lw $t0, 8($sp) sw $t0, 16($sp) - # If internal_9 then goto then_8768338411183 + # If internal_17 then goto then_8737379857680 lw $t0, 16($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338411183 + beq $t0, $t1, then_8737379857680 - # Jumping to else_8768338411183 - j else_8768338411183 + # Jumping to else_8737379857680 + j else_8737379857680 - then_8768338411183: + then_8737379857680: # Allocating Bool 1 li $v0, 9 @@ -15336,16 +17091,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_12 = address of allocated object Int + sw $v0, 4($sp) # internal_20 = address of allocated object Int - # internal_8 = internal_12 + # internal_16 = internal_20 lw $t0, 4($sp) sw $t0, 20($sp) - # Jumping to endif_8768338411183 - j endif_8768338411183 + # Jumping to endif_8737379857680 + j endif_8737379857680 - else_8768338411183: + else_8737379857680: # Allocating Bool 0 li $v0, 9 @@ -15357,22 +17112,22 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_13 = address of allocated object Int + sw $v0, 0($sp) # internal_21 = address of allocated object Int - # internal_8 = internal_13 + # internal_16 = internal_21 lw $t0, 0($sp) sw $t0, 20($sp) - # Jumping to endif_8768338411183 - j endif_8768338411183 + # Jumping to endif_8737379857680 + j endif_8737379857680 - endif_8768338411183: + endif_8737379857680: # Loading return value in $v1 lw $v1, 20($sp) # Freeing space for local variables - addi $sp, $sp, 56 + addi $sp, $sp, 88 jr $ra @@ -15399,17 +17154,17 @@ # Set attribute rows of self lw $t0, 20($sp) # $t0 = self lw $t1, 16($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8768338333172 + beq $t1, $zero, object_set_attribute_8737379851650 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338333172 + beq $t6, $t5, int_set_attribute_8737379851650 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338333172 - j object_set_attribute_8768338333172 - int_set_attribute_8768338333172: + beq $t6, $t5, bool_set_attribute_8737379851650 + j object_set_attribute_8737379851650 + int_set_attribute_8737379851650: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15418,8 +17173,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.rows = internal_0 - j end_set_attribute_8768338333172 - bool_set_attribute_8768338333172: + j end_set_attribute_8737379851650 + bool_set_attribute_8737379851650: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15428,10 +17183,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.rows = internal_0 - j end_set_attribute_8768338333172 - object_set_attribute_8768338333172: + j end_set_attribute_8737379851650 + object_set_attribute_8737379851650: sw $t1, 8($t0) # self.rows = internal_0 - end_set_attribute_8768338333172: + end_set_attribute_8737379851650: # Allocating Int 0 li $v0, 9 @@ -15448,17 +17203,17 @@ # Set attribute columns of self lw $t0, 20($sp) # $t0 = self lw $t1, 12($sp) # $t1 = internal_1 - beq $t1, $zero, object_set_attribute_8768338333968 + beq $t1, $zero, object_set_attribute_8737379852418 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338333968 + beq $t6, $t5, int_set_attribute_8737379852418 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338333968 - j object_set_attribute_8768338333968 - int_set_attribute_8768338333968: + beq $t6, $t5, bool_set_attribute_8737379852418 + j object_set_attribute_8737379852418 + int_set_attribute_8737379852418: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15467,8 +17222,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.columns = internal_1 - j end_set_attribute_8768338333968 - bool_set_attribute_8768338333968: + j end_set_attribute_8737379852418 + bool_set_attribute_8737379852418: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15477,10 +17232,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.columns = internal_1 - j end_set_attribute_8768338333968 - object_set_attribute_8768338333968: + j end_set_attribute_8737379852418 + object_set_attribute_8737379852418: sw $t1, 12($t0) # self.columns = internal_1 - end_set_attribute_8768338333968: + end_set_attribute_8737379852418: # Allocating Int 0 li $v0, 9 @@ -15497,17 +17252,17 @@ # Set attribute board_size of self lw $t0, 20($sp) # $t0 = self lw $t1, 8($sp) # $t1 = internal_2 - beq $t1, $zero, object_set_attribute_8768338333986 + beq $t1, $zero, object_set_attribute_8737379852352 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338333986 + beq $t6, $t5, int_set_attribute_8737379852352 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338333986 - j object_set_attribute_8768338333986 - int_set_attribute_8768338333986: + beq $t6, $t5, bool_set_attribute_8737379852352 + j object_set_attribute_8737379852352 + int_set_attribute_8737379852352: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15516,8 +17271,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.board_size = internal_2 - j end_set_attribute_8768338333986 - bool_set_attribute_8768338333986: + j end_set_attribute_8737379852352 + bool_set_attribute_8737379852352: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15526,10 +17281,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($t0) # self.board_size = internal_2 - j end_set_attribute_8768338333986 - object_set_attribute_8768338333986: + j end_set_attribute_8737379852352 + object_set_attribute_8737379852352: sw $t1, 16($t0) # self.board_size = internal_2 - end_set_attribute_8768338333986: + end_set_attribute_8737379852352: # Allocating String li $v0, 9 @@ -15549,17 +17304,17 @@ # Set attribute population_map of self lw $t0, 20($sp) # $t0 = self lw $t1, 4($sp) # $t1 = internal_3 - beq $t1, $zero, object_set_attribute_8768338334007 + beq $t1, $zero, object_set_attribute_8737379832989 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338334007 + beq $t6, $t5, int_set_attribute_8737379832989 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338334007 - j object_set_attribute_8768338334007 - int_set_attribute_8768338334007: + beq $t6, $t5, bool_set_attribute_8737379832989 + j object_set_attribute_8737379832989 + int_set_attribute_8737379832989: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15568,8 +17323,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 20($t0) # self.population_map = internal_3 - j end_set_attribute_8768338334007 - bool_set_attribute_8768338334007: + j end_set_attribute_8737379832989 + bool_set_attribute_8737379832989: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15578,10 +17333,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 20($t0) # self.population_map = internal_3 - j end_set_attribute_8768338334007 - object_set_attribute_8768338334007: + j end_set_attribute_8737379832989 + object_set_attribute_8737379832989: sw $t1, 20($t0) # self.population_map = internal_3 - end_set_attribute_8768338334007: + end_set_attribute_8737379832989: # Allocating NUll to internal_4 sw $zero, 0($sp) # internal_4 = 0 @@ -15589,17 +17344,17 @@ # Set attribute cells of self lw $t0, 20($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_4 - beq $t1, $zero, object_set_attribute_8768338334028 + beq $t1, $zero, object_set_attribute_8737379832857 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338334028 + beq $t6, $t5, int_set_attribute_8737379832857 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338334028 - j object_set_attribute_8768338334028 - int_set_attribute_8768338334028: + beq $t6, $t5, bool_set_attribute_8737379832857 + j object_set_attribute_8737379832857 + int_set_attribute_8737379832857: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15608,8 +17363,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 24($t0) # self.cells = internal_4 - j end_set_attribute_8768338334028 - bool_set_attribute_8768338334028: + j end_set_attribute_8737379832857 + bool_set_attribute_8737379832857: li $v0, 9 addi $a0, $zero, 12 syscall @@ -15618,10 +17373,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 24($t0) # self.cells = internal_4 - j end_set_attribute_8768338334028 - object_set_attribute_8768338334028: + j end_set_attribute_8737379832857 + object_set_attribute_8737379832857: sw $t1, 24($t0) # self.cells = internal_4 - end_set_attribute_8768338334028: + end_set_attribute_8737379832857: # Loading return value in $v1 lw $v1, 20($sp) @@ -15633,11 +17388,11 @@ function_main_at_Main: # Function parameters - # $ra = 88($sp) - # self = 84($sp) + # $ra = 168($sp) + # self = 164($sp) # Reserving space for local variables - addi $sp, $sp, -84 + addi $sp, $sp, -164 # Allocating Bool 0 li $v0, 9 @@ -15649,7 +17404,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # continue = address of allocated object Int + sw $v0, 160($sp) # continue = address of allocated object Int # Allocating String li $v0, 9 @@ -15664,7 +17419,7 @@ sb $zero, 8($v0) # Null-terminator at the end of the string - sw $v0, 76($sp) # choice = "" + sw $v0, 156($sp) # choice = "" # Allocating String li $v0, 9 @@ -15766,24 +17521,48 @@ sb $zero, 37($v0) # Null-terminator at the end of the string - sw $v0, 72($sp) # internal_2 = "Welcome to the Game of Life.\n" + sw $v0, 152($sp) # internal_2 = "Welcome to the Game of Life.\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_4 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 164($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 144($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 140($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 96($sp) + lw $t0, 176($sp) sw $t0, 4($sp) # Storing self # Argument internal_2 - lw $t0, 84($sp) + lw $t0, 164($sp) sw $t0, 0($sp) # Storing internal_2 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_5 + lw $t0, 152($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 80($sp) # internal_3 = result of function_out_string_at_IO + sw $v1, 160($sp) # internal_3 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -15798,194 +17577,245 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 84 - sb $t0, 8($v0) # internal_4[0] = 'T' + sb $t0, 8($v0) # internal_6[0] = 'T' addi $t0, $zero, 104 - sb $t0, 9($v0) # internal_4[1] = 'h' + sb $t0, 9($v0) # internal_6[1] = 'h' addi $t0, $zero, 101 - sb $t0, 10($v0) # internal_4[2] = 'e' + sb $t0, 10($v0) # internal_6[2] = 'e' addi $t0, $zero, 114 - sb $t0, 11($v0) # internal_4[3] = 'r' + sb $t0, 11($v0) # internal_6[3] = 'r' addi $t0, $zero, 101 - sb $t0, 12($v0) # internal_4[4] = 'e' + sb $t0, 12($v0) # internal_6[4] = 'e' addi $t0, $zero, 32 - sb $t0, 13($v0) # internal_4[5] = ' ' + sb $t0, 13($v0) # internal_6[5] = ' ' addi $t0, $zero, 97 - sb $t0, 14($v0) # internal_4[6] = 'a' + sb $t0, 14($v0) # internal_6[6] = 'a' addi $t0, $zero, 114 - sb $t0, 15($v0) # internal_4[7] = 'r' + sb $t0, 15($v0) # internal_6[7] = 'r' addi $t0, $zero, 101 - sb $t0, 16($v0) # internal_4[8] = 'e' + sb $t0, 16($v0) # internal_6[8] = 'e' addi $t0, $zero, 32 - sb $t0, 17($v0) # internal_4[9] = ' ' + sb $t0, 17($v0) # internal_6[9] = ' ' addi $t0, $zero, 109 - sb $t0, 18($v0) # internal_4[10] = 'm' + sb $t0, 18($v0) # internal_6[10] = 'm' addi $t0, $zero, 97 - sb $t0, 19($v0) # internal_4[11] = 'a' + sb $t0, 19($v0) # internal_6[11] = 'a' addi $t0, $zero, 110 - sb $t0, 20($v0) # internal_4[12] = 'n' + sb $t0, 20($v0) # internal_6[12] = 'n' addi $t0, $zero, 121 - sb $t0, 21($v0) # internal_4[13] = 'y' + sb $t0, 21($v0) # internal_6[13] = 'y' addi $t0, $zero, 32 - sb $t0, 22($v0) # internal_4[14] = ' ' + sb $t0, 22($v0) # internal_6[14] = ' ' addi $t0, $zero, 105 - sb $t0, 23($v0) # internal_4[15] = 'i' + sb $t0, 23($v0) # internal_6[15] = 'i' addi $t0, $zero, 110 - sb $t0, 24($v0) # internal_4[16] = 'n' + sb $t0, 24($v0) # internal_6[16] = 'n' addi $t0, $zero, 105 - sb $t0, 25($v0) # internal_4[17] = 'i' + sb $t0, 25($v0) # internal_6[17] = 'i' addi $t0, $zero, 116 - sb $t0, 26($v0) # internal_4[18] = 't' + sb $t0, 26($v0) # internal_6[18] = 't' addi $t0, $zero, 105 - sb $t0, 27($v0) # internal_4[19] = 'i' + sb $t0, 27($v0) # internal_6[19] = 'i' addi $t0, $zero, 97 - sb $t0, 28($v0) # internal_4[20] = 'a' + sb $t0, 28($v0) # internal_6[20] = 'a' addi $t0, $zero, 108 - sb $t0, 29($v0) # internal_4[21] = 'l' + sb $t0, 29($v0) # internal_6[21] = 'l' addi $t0, $zero, 32 - sb $t0, 30($v0) # internal_4[22] = ' ' + sb $t0, 30($v0) # internal_6[22] = ' ' addi $t0, $zero, 115 - sb $t0, 31($v0) # internal_4[23] = 's' + sb $t0, 31($v0) # internal_6[23] = 's' addi $t0, $zero, 116 - sb $t0, 32($v0) # internal_4[24] = 't' + sb $t0, 32($v0) # internal_6[24] = 't' addi $t0, $zero, 97 - sb $t0, 33($v0) # internal_4[25] = 'a' + sb $t0, 33($v0) # internal_6[25] = 'a' addi $t0, $zero, 116 - sb $t0, 34($v0) # internal_4[26] = 't' + sb $t0, 34($v0) # internal_6[26] = 't' addi $t0, $zero, 101 - sb $t0, 35($v0) # internal_4[27] = 'e' + sb $t0, 35($v0) # internal_6[27] = 'e' addi $t0, $zero, 115 - sb $t0, 36($v0) # internal_4[28] = 's' + sb $t0, 36($v0) # internal_6[28] = 's' addi $t0, $zero, 32 - sb $t0, 37($v0) # internal_4[29] = ' ' + sb $t0, 37($v0) # internal_6[29] = ' ' addi $t0, $zero, 116 - sb $t0, 38($v0) # internal_4[30] = 't' + sb $t0, 38($v0) # internal_6[30] = 't' addi $t0, $zero, 111 - sb $t0, 39($v0) # internal_4[31] = 'o' + sb $t0, 39($v0) # internal_6[31] = 'o' addi $t0, $zero, 32 - sb $t0, 40($v0) # internal_4[32] = ' ' + sb $t0, 40($v0) # internal_6[32] = ' ' addi $t0, $zero, 99 - sb $t0, 41($v0) # internal_4[33] = 'c' + sb $t0, 41($v0) # internal_6[33] = 'c' addi $t0, $zero, 104 - sb $t0, 42($v0) # internal_4[34] = 'h' + sb $t0, 42($v0) # internal_6[34] = 'h' addi $t0, $zero, 111 - sb $t0, 43($v0) # internal_4[35] = 'o' + sb $t0, 43($v0) # internal_6[35] = 'o' addi $t0, $zero, 111 - sb $t0, 44($v0) # internal_4[36] = 'o' + sb $t0, 44($v0) # internal_6[36] = 'o' addi $t0, $zero, 115 - sb $t0, 45($v0) # internal_4[37] = 's' + sb $t0, 45($v0) # internal_6[37] = 's' addi $t0, $zero, 101 - sb $t0, 46($v0) # internal_4[38] = 'e' + sb $t0, 46($v0) # internal_6[38] = 'e' addi $t0, $zero, 32 - sb $t0, 47($v0) # internal_4[39] = ' ' + sb $t0, 47($v0) # internal_6[39] = ' ' addi $t0, $zero, 102 - sb $t0, 48($v0) # internal_4[40] = 'f' + sb $t0, 48($v0) # internal_6[40] = 'f' addi $t0, $zero, 114 - sb $t0, 49($v0) # internal_4[41] = 'r' + sb $t0, 49($v0) # internal_6[41] = 'r' addi $t0, $zero, 111 - sb $t0, 50($v0) # internal_4[42] = 'o' + sb $t0, 50($v0) # internal_6[42] = 'o' addi $t0, $zero, 109 - sb $t0, 51($v0) # internal_4[43] = 'm' + sb $t0, 51($v0) # internal_6[43] = 'm' addi $t0, $zero, 46 - sb $t0, 52($v0) # internal_4[44] = '.' + sb $t0, 52($v0) # internal_6[44] = '.' addi $t0, $zero, 32 - sb $t0, 53($v0) # internal_4[45] = ' ' + sb $t0, 53($v0) # internal_6[45] = ' ' addi $t0, $zero, 10 - sb $t0, 54($v0) # internal_4[46] = '\n' + sb $t0, 54($v0) # internal_6[46] = '\n' sb $zero, 55($v0) # Null-terminator at the end of the string - sw $v0, 64($sp) # internal_4 = "There are many initial states to choose from. \n" + sw $v0, 136($sp) # internal_6 = "There are many initial states to choose from. \n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_8 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 164($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 128($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 124($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 96($sp) + lw $t0, 176($sp) sw $t0, 4($sp) # Storing self - # Argument internal_4 - lw $t0, 76($sp) - sw $t0, 0($sp) # Storing internal_4 + # Argument internal_6 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_6 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_9 + lw $t0, 136($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 72($sp) # internal_5 = result of function_out_string_at_IO + sw $v1, 144($sp) # internal_7 = result of internal_9 addi $sp, $sp, 12 # Freeing space for arguments - while_start_8768338411614: + # Allocating NUll to internal_10 + sw $zero, 120($sp) # internal_10 = 0 + + while_start_8737379857851: + + # Allocating Int 27 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 27 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_12 = address of allocated object Int + + # Get method prompt2 of Main + lw $t0, 164($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 112($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 108($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 92($sp) + lw $t0, 172($sp) sw $t0, 0($sp) # Storing self - # Calling function function_prompt2_at_CellularAutomaton - jal function_prompt2_at_CellularAutomaton + # Calling function internal_13 + lw $t0, 116($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 64($sp) # internal_6 = result of function_prompt2_at_CellularAutomaton + sw $v1, 124($sp) # internal_11 = result of internal_13 addi $sp, $sp, 8 # Freeing space for arguments - # If internal_6 then goto while_body_8768338411614 - lw $t0, 56($sp) # Loading the address of the condition + # If internal_11 then goto while_body_8737379857851 + lw $t0, 116($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8768338411614 + beq $t0, $t1, while_body_8737379857851 - # Jumping to while_end_8768338411614 - j while_end_8768338411614 + # Jumping to while_end_8737379857851 + j while_end_8737379857851 - while_body_8768338411614: + while_body_8737379857851: # Allocating Bool 1 li $v0, 9 @@ -15997,38 +17827,62 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 52($sp) # internal_7 = address of allocated object Int + sw $v0, 104($sp) # internal_14 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument continue - lw $t0, 92($sp) + lw $t0, 172($sp) sw $t0, 4($sp) # Storing continue - # Argument internal_7 - lw $t0, 64($sp) - sw $t0, 0($sp) # Storing internal_7 + # Argument internal_14 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_14 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 92($sp) # continue = result of function_assign + sw $v1, 172($sp) # continue = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 25 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 25 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_16 = address of allocated object Int + + # Get method option of Main + lw $t0, 164($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 96($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 92($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 92($sp) + lw $t0, 172($sp) sw $t0, 0($sp) # Storing self - # Calling function function_option_at_CellularAutomaton - jal function_option_at_CellularAutomaton + # Calling function internal_17 + lw $t0, 100($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 56($sp) # internal_8 = result of function_option_at_CellularAutomaton + sw $v1, 108($sp) # internal_15 = result of internal_17 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments @@ -16036,17 +17890,17 @@ sw $ra, 8($sp) # Storing return address # Argument choice - lw $t0, 88($sp) + lw $t0, 168($sp) sw $t0, 4($sp) # Storing choice - # Argument internal_8 - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing internal_8 + # Argument internal_15 + lw $t0, 112($sp) + sw $t0, 0($sp) # Storing internal_15 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 88($sp) # choice = result of function_assign + sw $v1, 168($sp) # choice = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating CellularAutomaton @@ -16056,54 +17910,78 @@ la $t0, type_CellularAutomaton # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 44($sp) # internal_9 = address of allocated object CellularAutomaton + sw $v0, 88($sp) # internal_18 = address of allocated object CellularAutomaton # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_9 - lw $t0, 52($sp) - sw $t0, 0($sp) # Storing internal_9 + # Argument internal_18 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_18 # Calling function function___init___at_CellularAutomaton jal function___init___at_CellularAutomaton lw $ra, 4($sp) - sw $v1, 52($sp) # internal_9 = result of function___init___at_CellularAutomaton + sw $v1, 96($sp) # internal_18 = result of function___init___at_CellularAutomaton addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_20 = address of allocated object Int + + # Get method init of CellularAutomaton + lw $t0, 88($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 80($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 76($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_9 - lw $t0, 56($sp) - sw $t0, 4($sp) # Storing internal_9 + # Argument internal_18 + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing internal_18 # Argument choice - lw $t0, 88($sp) + lw $t0, 168($sp) sw $t0, 0($sp) # Storing choice - # Calling function function_init_at_CellularAutomaton - jal function_init_at_CellularAutomaton + # Calling function internal_21 + lw $t0, 88($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 52($sp) # internal_10 = result of function_init_at_CellularAutomaton + sw $v1, 96($sp) # internal_19 = result of internal_21 addi $sp, $sp, 12 # Freeing space for arguments # Set attribute cells of self - lw $t0, 84($sp) # $t0 = self - lw $t1, 40($sp) # $t1 = internal_10 - beq $t1, $zero, object_set_attribute_8768338334883 + lw $t0, 164($sp) # $t0 = self + lw $t1, 84($sp) # $t1 = internal_19 + beq $t1, $zero, object_set_attribute_8737379784638 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8768338334883 + beq $t6, $t5, int_set_attribute_8737379784638 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8768338334883 - j object_set_attribute_8768338334883 - int_set_attribute_8768338334883: + beq $t6, $t5, bool_set_attribute_8737379784638 + j object_set_attribute_8737379784638 + int_set_attribute_8737379784638: li $v0, 9 addi $a0, $zero, 12 syscall @@ -16111,9 +17989,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 24($t0) # self.cells = internal_10 - j end_set_attribute_8768338334883 - bool_set_attribute_8768338334883: + sw $v0, 24($t0) # self.cells = internal_19 + j end_set_attribute_8737379784638 + bool_set_attribute_8737379784638: li $v0, 9 addi $a0, $zero, 12 syscall @@ -16121,25 +17999,25 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 24($t0) # self.cells = internal_10 - j end_set_attribute_8768338334883 - object_set_attribute_8768338334883: - sw $t1, 24($t0) # self.cells = internal_10 - end_set_attribute_8768338334883: + sw $v0, 24($t0) # self.cells = internal_19 + j end_set_attribute_8737379784638 + object_set_attribute_8737379784638: + sw $t1, 24($t0) # self.cells = internal_19 + end_set_attribute_8737379784638: # Get attribute cells of self - lw $t0, 84($sp) # Get the address of self - lw $t1, 24($t0) # Get the attribute 'cells' from the instance + lw $t0, 164($sp) # Get the address of self + lw $t1, 24($t0) # Get the attribute 'cells' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338334952 + beq $t6, $t5, int_get_attribute_8737379785247 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338334952 - j object_get_attribute_8768338334952 - int_get_attribute_8768338334952: + beq $t6, $t5, bool_get_attribute_8737379785247 + j object_get_attribute_8737379785247 + int_get_attribute_8737379785247: li $v0, 9 addi $a0, $zero, 12 syscall @@ -16147,9 +18025,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 36($sp) # internal_11 = self.cells - j end_get_attribute_8768338334952 - bool_get_attribute_8768338334952: + sw $v0, 72($sp) # internal_22 = self.cells + j end_get_attribute_8737379785247 + bool_get_attribute_8737379785247: li $v0, 9 addi $a0, $zero, 12 syscall @@ -16157,38 +18035,65 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 36($sp) # internal_11 = self.cells - j end_get_attribute_8768338334952 - object_get_attribute_8768338334952: - sw $t1, 36($sp) # internal_11 = cells - end_get_attribute_8768338334952: + sw $v0, 72($sp) # internal_22 = self.cells + j end_get_attribute_8737379785247 + object_get_attribute_8737379785247: + sw $t1, 72($sp) # internal_22 = self.cells + end_get_attribute_8737379785247: + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_24 = address of allocated object Int + + # Get method print of CellularAutomaton + lw $t0, 72($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 64($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 60($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_11 - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_11 + # Argument internal_22 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_22 - # Calling function function_print_at_CellularAutomaton - jal function_print_at_CellularAutomaton + # Calling function internal_25 + lw $t0, 68($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 40($sp) # internal_12 = result of function_print_at_CellularAutomaton + sw $v1, 76($sp) # internal_23 = result of internal_25 addi $sp, $sp, 8 # Freeing space for arguments - while_start_8768338411602: + # Allocating NUll to internal_26 + sw $zero, 56($sp) # internal_26 = 0 + + while_start_8737379857839: - # If continue then goto while_body_8768338411602 - lw $t0, 80($sp) # Loading the address of the condition + # If continue then goto while_body_8737379857839 + lw $t0, 160($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8768338411602 + beq $t0, $t1, while_body_8737379857839 - # Jumping to while_end_8768338411602 - j while_end_8768338411602 + # Jumping to while_end_8737379857839 + j while_end_8737379857839 - while_body_8768338411602: + while_body_8737379857839: # Allocating Bool 0 li $v0, 9 @@ -16200,50 +18105,74 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_14 = address of allocated object Int + sw $v0, 48($sp) # internal_28 = address of allocated object Int + + # Allocating Int 26 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 26 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_30 = address of allocated object Int + + # Get method prompt of Main + lw $t0, 164($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 40($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 36($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 92($sp) + lw $t0, 172($sp) sw $t0, 0($sp) # Storing self - # Calling function function_prompt_at_CellularAutomaton - jal function_prompt_at_CellularAutomaton + # Calling function internal_31 + lw $t0, 44($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 28($sp) # internal_15 = result of function_prompt_at_CellularAutomaton + sw $v1, 52($sp) # internal_29 = result of internal_31 addi $sp, $sp, 8 # Freeing space for arguments - # internal_14 = internal_15 - lw $t0, 20($sp) - sw $t0, 24($sp) + # internal_28 = internal_29 + lw $t0, 44($sp) + sw $t0, 48($sp) - # If internal_14 then goto then_8768338411596 - lw $t0, 24($sp) # Loading the address of the condition + # If internal_28 then goto then_8737379857833 + lw $t0, 48($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8768338411596 + beq $t0, $t1, then_8737379857833 - # Jumping to else_8768338411596 - j else_8768338411596 + # Jumping to else_8737379857833 + j else_8737379857833 - then_8768338411596: + then_8737379857833: # Get attribute cells of self - lw $t0, 84($sp) # Get the address of self - lw $t1, 24($t0) # Get the attribute 'cells' from the instance + lw $t0, 164($sp) # Get the address of self + lw $t1, 24($t0) # Get the attribute 'cells' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338335386 + beq $t6, $t5, int_get_attribute_8737379785741 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338335386 - j object_get_attribute_8768338335386 - int_get_attribute_8768338335386: + beq $t6, $t5, bool_get_attribute_8737379785741 + j object_get_attribute_8737379785741 + int_get_attribute_8737379785741: li $v0, 9 addi $a0, $zero, 12 syscall @@ -16251,9 +18180,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 16($sp) # internal_16 = self.cells - j end_get_attribute_8768338335386 - bool_get_attribute_8768338335386: + sw $v0, 32($sp) # internal_32 = self.cells + j end_get_attribute_8737379785741 + bool_get_attribute_8737379785741: li $v0, 9 addi $a0, $zero, 12 syscall @@ -16261,39 +18190,63 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 16($sp) # internal_16 = self.cells - j end_get_attribute_8768338335386 - object_get_attribute_8768338335386: - sw $t1, 16($sp) # internal_16 = cells - end_get_attribute_8768338335386: + sw $v0, 32($sp) # internal_32 = self.cells + j end_get_attribute_8737379785741 + object_get_attribute_8737379785741: + sw $t1, 32($sp) # internal_32 = self.cells + end_get_attribute_8737379785741: + + # Allocating Int 24 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 24 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_34 = address of allocated object Int + + # Get method evolve of CellularAutomaton + lw $t0, 32($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 24($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 20($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_16 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_16 + # Argument internal_32 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_32 - # Calling function function_evolve_at_CellularAutomaton - jal function_evolve_at_CellularAutomaton + # Calling function internal_35 + lw $t0, 28($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 20($sp) # internal_17 = result of function_evolve_at_CellularAutomaton + sw $v1, 36($sp) # internal_33 = result of internal_35 addi $sp, $sp, 8 # Freeing space for arguments # Get attribute cells of self - lw $t0, 84($sp) # Get the address of self - lw $t1, 24($t0) # Get the attribute 'cells' from the instance + lw $t0, 164($sp) # Get the address of self + lw $t1, 24($t0) # Get the attribute 'cells' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8768338335416 + beq $t6, $t5, int_get_attribute_8737379785795 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8768338335416 - j object_get_attribute_8768338335416 - int_get_attribute_8768338335416: + beq $t6, $t5, bool_get_attribute_8737379785795 + j object_get_attribute_8737379785795 + int_get_attribute_8737379785795: li $v0, 9 addi $a0, $zero, 12 syscall @@ -16301,9 +18254,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($sp) # internal_18 = self.cells - j end_get_attribute_8768338335416 - bool_get_attribute_8768338335416: + sw $v0, 16($sp) # internal_36 = self.cells + j end_get_attribute_8737379785795 + bool_get_attribute_8737379785795: li $v0, 9 addi $a0, $zero, 12 syscall @@ -16311,34 +18264,58 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($sp) # internal_18 = self.cells - j end_get_attribute_8768338335416 - object_get_attribute_8768338335416: - sw $t1, 8($sp) # internal_18 = cells - end_get_attribute_8768338335416: + sw $v0, 16($sp) # internal_36 = self.cells + j end_get_attribute_8737379785795 + object_get_attribute_8737379785795: + sw $t1, 16($sp) # internal_36 = self.cells + end_get_attribute_8737379785795: + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_38 = address of allocated object Int + + # Get method print of CellularAutomaton + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_18 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_18 + # Argument internal_36 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_36 - # Calling function function_print_at_CellularAutomaton - jal function_print_at_CellularAutomaton + # Calling function internal_39 + lw $t0, 12($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 12($sp) # internal_19 = result of function_print_at_CellularAutomaton + sw $v1, 20($sp) # internal_37 = result of internal_39 addi $sp, $sp, 8 # Freeing space for arguments - # internal_13 = internal_19 - lw $t0, 4($sp) - sw $t0, 28($sp) + # internal_27 = internal_37 + lw $t0, 12($sp) + sw $t0, 52($sp) - # Jumping to endif_8768338411596 - j endif_8768338411596 + # Jumping to endif_8737379857833 + j endif_8737379857833 - else_8768338411596: + else_8737379857833: # Allocating Bool 0 li $v0, 9 @@ -16350,56 +18327,56 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_20 = address of allocated object Int + sw $v0, 0($sp) # internal_40 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument continue - lw $t0, 92($sp) + lw $t0, 172($sp) sw $t0, 4($sp) # Storing continue - # Argument internal_20 + # Argument internal_40 lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_20 + sw $t0, 0($sp) # Storing internal_40 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 92($sp) # continue = result of function_assign + sw $v1, 172($sp) # continue = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # internal_13 = continue - lw $t0, 80($sp) - sw $t0, 28($sp) + # internal_27 = continue + lw $t0, 160($sp) + sw $t0, 52($sp) - # Jumping to endif_8768338411596 - j endif_8768338411596 + # Jumping to endif_8737379857833 + j endif_8737379857833 - endif_8768338411596: + endif_8737379857833: - # Jumping to while_start_8768338411602 - j while_start_8768338411602 + # Jumping to while_start_8737379857839 + j while_start_8737379857839 - while_end_8768338411602: + while_end_8737379857839: - # Jumping to while_start_8768338411614 - j while_start_8768338411614 + # Jumping to while_start_8737379857851 + j while_start_8737379857851 - while_end_8768338411614: + while_end_8737379857851: # Loading return value in $v1 - lw $v1, 84($sp) + lw $v1, 164($sp) # Freeing space for local variables - addi $sp, $sp, 84 + addi $sp, $sp, 164 jr $ra main: # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Allocating Main li $v0, 9 @@ -16408,34 +18385,58 @@ la $t0, type_Main # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object Main + sw $v0, 12($sp) # internal_0 = address of allocated object Main # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_Main jal function___init___at_Main lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 28 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 28 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_main_at_Main - jal function_main_at_Main + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + sw $v1, 16($sp) # internal_1 = result of internal_3 addi $sp, $sp, 8 # Freeing space for arguments # Exit program diff --git a/tests/codegen/list.mips b/tests/codegen/list.mips index b4897ba63..6ab00bdea 100644 --- a/tests/codegen/list.mips +++ b/tests/codegen/list.mips @@ -1,59 +1,113 @@ .data - type_Object: .word 8 + type_Object: .word 24 type_Object_inherits_from: .word 0 - type_Object_attributes: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_List: .word 40 + type_List_inherits_from: .word type_Object + type_List_name_address: .word type_List_name_size + type_List___init__: .word function___init___at_List + type_List_abort: .word function_abort_at_Object + type_List_type_name: .word function_type_name_at_Object + type_List_copy: .word function_copy_at_Object + type_List_isNil: .word function_isNil_at_List + type_List_head: .word function_head_at_List + type_List_tail: .word function_tail_at_List + type_List_cons: .word function_cons_at_List + + type_Cons: .word 52 + type_Cons_inherits_from: .word type_List + type_Cons_name_address: .word type_Cons_name_size + type_Cons___init__: .word function___init___at_Cons + type_Cons_abort: .word function_abort_at_Object + type_Cons_type_name: .word function_type_name_at_Object + type_Cons_copy: .word function_copy_at_Object + type_Cons_isNil: .word function_isNil_at_Cons + type_Cons_head: .word function_head_at_Cons + type_Cons_tail: .word function_tail_at_Cons + type_Cons_cons: .word function_cons_at_List + type_Cons_init: .word function_init_at_Cons + + type_Main: .word 52 + type_Main_inherits_from: .word type_IO + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_out_string: .word function_out_string_at_IO + type_Main_out_int: .word function_out_int_at_IO + type_Main_in_string: .word function_in_string_at_IO + type_Main_in_int: .word function_in_int_at_IO + type_Main_print_list: .word function_print_list_at_Main + type_Main_main: .word function_main_at_Main + type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" - type_Object_abort_message: .asciiz "Abort called from class Object\n" - type_IO: .word 8 - type_IO_inherits_from: .word type_Object - type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" - type_IO_abort_message: .asciiz "Abort called from class IO\n" - type_Int: .word 8 - type_Int_inherits_from: .word type_Object - type_Int_attributes: .word 0 - type_Int_name_size: .word 3 - type_Int_name: .asciiz "Int" - type_Int_abort_message: .asciiz "Abort called from class Int\n" - - type_String: .word 8 - type_String_inherits_from: .word type_Object - type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" - type_String_abort_message: .asciiz "Abort called from class String\n" - type_Bool: .word 8 - type_Bool_inherits_from: .word type_Object - type_Bool_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" - type_Bool_abort_message: .asciiz "Abort called from class Bool\n" - type_List: .word 8 - type_List_inherits_from: .word type_Object - type_List_attributes: .word 0 type_List_name_size: .word 4 type_List_name: .asciiz "List" - type_List_abort_message: .asciiz "Abort called from class List\n" - type_Cons: .word 16 - type_Cons_inherits_from: .word type_List - type_Cons_attributes: .word 2 type_Cons_name_size: .word 4 type_Cons_name: .asciiz "Cons" - type_Cons_abort_message: .asciiz "Abort called from class Cons\n" - type_Main: .word 12 - type_Main_inherits_from: .word type_IO - type_Main_attributes: .word 1 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" - type_Main_abort_message: .asciiz "Abort called from class Main\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -714,11 +768,11 @@ function_abort_at_Object: # Function parameters - # $ra = 20($sp) - # self = 16($sp) + # $ra = 28($sp) + # self = 24($sp) # Reserving space for local variables - addi $sp, $sp, -16 + addi $sp, $sp, -24 # Allocating String li $v0, 9 @@ -805,7 +859,7 @@ sb $zero, 32($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_0 = "Abort called from class " + sw $v0, 20($sp) # internal_0 = "Abort called from class " # Allocating String li $v0, 9 @@ -819,66 +873,138 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_2[0] = '\n' + sb $t0, 8($v0) # internal_3[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_2 = "\n" + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 0($sp) # Storing self - # Calling function function_type_name_at_Object - jal function_type_name_at_Object + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + sw $v1, 24($sp) # internal_1 = result of internal_5 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_0 - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing internal_0 # Argument internal_1 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_1 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_3 - lw $t0, 12($sp) - sw $t0, 4($sp) # Storing internal_3 - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) # $t0 = internal_3 + lw $t0, 12($sp) # $t0 = internal_2 addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string internal_3 + # Printing the String internal_2 li $v0, 4 move $a0, $t0 syscall @@ -888,10 +1014,10 @@ syscall # Loading return value in $v1 - lw $v1, 16($sp) + lw $v1, 24($sp) # Freeing space for local variables - addi $sp, $sp, 16 + addi $sp, $sp, 24 jr $ra @@ -906,8 +1032,9 @@ # internal_0 = name of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($t0) # $t1 = type of self - lw $t2, 12($t1) # $t1 = length of the name of self - la $t3, 16($t1) # $t1 = name of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 @@ -1010,7 +1137,7 @@ lw $t0, 0($sp) # $t0 = x addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string x + # Printing the String x li $v0, 4 move $a0, $t0 syscall @@ -1026,7 +1153,7 @@ # self = 4($sp) # x = 0($sp) - # Printing the string x + # Printing the Int x li $v0, 1 lw $a0, 0($sp) lw $a0, 8($a0) @@ -1053,11 +1180,13 @@ xor $t0, $t0, $t0 # Initializing counter while_read_start: lb $t1, buffer_input($t0) # Loading the byte - beq $t1, $zero, while_read_end + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end addi $t0, $t0, 1 # Incrementing counter j while_read_start while_read_end: - addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 @@ -1304,6 +1433,26 @@ jr $ra + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + function___init___at_List: # Function parameters # $ra = 4($sp) @@ -1344,24 +1493,48 @@ function_head_at_List: # Function parameters - # $ra = 12($sp) - # self = 8($sp) + # $ra = 20($sp) + # self = 16($sp) # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_1 = address of allocated object Int + + # Get method abort of List + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 0($sp) # Storing self - # Calling function function_abort_at_Object - jal function_abort_at_Object + # Calling function internal_2 + lw $t0, 12($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function_abort_at_Object + sw $v1, 20($sp) # internal_0 = result of internal_2 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 0 @@ -1374,54 +1547,78 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_1 = address of allocated object Int + sw $v0, 0($sp) # internal_3 = address of allocated object Int # Loading return value in $v1 lw $v1, 0($sp) # Freeing space for local variables - addi $sp, $sp, 8 + addi $sp, $sp, 16 jr $ra function_tail_at_List: # Function parameters - # $ra = 8($sp) - # self = 4($sp) + # $ra = 16($sp) + # self = 12($sp) # Reserving space for local variables - addi $sp, $sp, -4 + addi $sp, $sp, -12 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + # Get method abort of List + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing self - # Calling function function_abort_at_Object - jal function_abort_at_Object + # Calling function internal_2 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_0 = result of function_abort_at_Object + sw $v1, 16($sp) # internal_0 = result of internal_2 addi $sp, $sp, 8 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 4($sp) + lw $v1, 12($sp) # Freeing space for local variables - addi $sp, $sp, 4 + addi $sp, $sp, 12 jr $ra function_cons_at_List: # Function parameters - # $ra = 16($sp) - # self = 12($sp) - # i = 8($sp) + # $ra = 24($sp) + # self = 20($sp) + # i = 16($sp) # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Allocating Cons li $v0, 9 @@ -1430,49 +1627,73 @@ la $t0, type_Cons # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object Cons + sw $v0, 12($sp) # internal_0 = address of allocated object Cons # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_Cons jal function___init___at_Cons lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_Cons + sw $v1, 20($sp) # internal_0 = result of function___init___at_Cons addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method init of Cons + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument internal_0 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 8($sp) # Storing internal_0 # Argument i - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing i # Argument self - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t0, 0($sp) # Storing self - # Calling function function_init_at_Cons - jal function_init_at_Cons + # Calling function internal_3 + lw $t0, 16($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 16($sp) # internal_1 = result of function_init_at_Cons + sw $v1, 24($sp) # internal_1 = result of internal_3 addi $sp, $sp, 16 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 8 + addi $sp, $sp, 16 jr $ra @@ -1499,17 +1720,17 @@ # Set attribute car of self lw $t0, 8($sp) # $t0 = self lw $t1, 4($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8758768081695 + beq $t1, $zero, object_set_attribute_8747373028931 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8758768081695 + beq $t6, $t5, int_set_attribute_8747373028931 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8758768081695 - j object_set_attribute_8758768081695 - int_set_attribute_8758768081695: + beq $t6, $t5, bool_set_attribute_8747373028931 + j object_set_attribute_8747373028931 + int_set_attribute_8747373028931: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1518,8 +1739,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.car = internal_0 - j end_set_attribute_8758768081695 - bool_set_attribute_8758768081695: + j end_set_attribute_8747373028931 + bool_set_attribute_8747373028931: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1528,10 +1749,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.car = internal_0 - j end_set_attribute_8758768081695 - object_set_attribute_8758768081695: + j end_set_attribute_8747373028931 + object_set_attribute_8747373028931: sw $t1, 8($t0) # self.car = internal_0 - end_set_attribute_8758768081695: + end_set_attribute_8747373028931: # Allocating NUll to internal_1 sw $zero, 0($sp) # internal_1 = 0 @@ -1539,17 +1760,17 @@ # Set attribute cdr of self lw $t0, 8($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_1 - beq $t1, $zero, object_set_attribute_8758768081716 + beq $t1, $zero, object_set_attribute_8747373028952 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8758768081716 + beq $t6, $t5, int_set_attribute_8747373028952 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8758768081716 - j object_set_attribute_8758768081716 - int_set_attribute_8758768081716: + beq $t6, $t5, bool_set_attribute_8747373028952 + j object_set_attribute_8747373028952 + int_set_attribute_8747373028952: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1558,8 +1779,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.cdr = internal_1 - j end_set_attribute_8758768081716 - bool_set_attribute_8758768081716: + j end_set_attribute_8747373028952 + bool_set_attribute_8747373028952: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1568,10 +1789,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.cdr = internal_1 - j end_set_attribute_8758768081716 - object_set_attribute_8758768081716: + j end_set_attribute_8747373028952 + object_set_attribute_8747373028952: sw $t1, 12($t0) # self.cdr = internal_1 - end_set_attribute_8758768081716: + end_set_attribute_8747373028952: # Loading return value in $v1 lw $v1, 8($sp) @@ -1619,17 +1840,17 @@ # Get attribute car of self lw $t0, 4($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'car' from the instance + lw $t1, 8($t0) # Get the attribute 'car' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8758768081770 + beq $t6, $t5, int_get_attribute_8747373029006 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8758768081770 - j object_get_attribute_8758768081770 - int_get_attribute_8758768081770: + beq $t6, $t5, bool_get_attribute_8747373029006 + j object_get_attribute_8747373029006 + int_get_attribute_8747373029006: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1638,8 +1859,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 0($sp) # internal_0 = self.car - j end_get_attribute_8758768081770 - bool_get_attribute_8758768081770: + j end_get_attribute_8747373029006 + bool_get_attribute_8747373029006: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1648,10 +1869,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 0($sp) # internal_0 = self.car - j end_get_attribute_8758768081770 - object_get_attribute_8758768081770: - sw $t1, 0($sp) # internal_0 = car - end_get_attribute_8758768081770: + j end_get_attribute_8747373029006 + object_get_attribute_8747373029006: + sw $t1, 0($sp) # internal_0 = self.car + end_get_attribute_8747373029006: # Loading return value in $v1 lw $v1, 0($sp) @@ -1671,17 +1892,17 @@ # Get attribute cdr of self lw $t0, 4($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'cdr' from the instance + lw $t1, 12($t0) # Get the attribute 'cdr' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8758768081800 + beq $t6, $t5, int_get_attribute_8747373029036 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8758768081800 - j object_get_attribute_8758768081800 - int_get_attribute_8758768081800: + beq $t6, $t5, bool_get_attribute_8747373029036 + j object_get_attribute_8747373029036 + int_get_attribute_8747373029036: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1690,8 +1911,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 0($sp) # internal_0 = self.cdr - j end_get_attribute_8758768081800 - bool_get_attribute_8758768081800: + j end_get_attribute_8747373029036 + bool_get_attribute_8747373029036: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1700,10 +1921,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 0($sp) # internal_0 = self.cdr - j end_get_attribute_8758768081800 - object_get_attribute_8758768081800: - sw $t1, 0($sp) # internal_0 = cdr - end_get_attribute_8758768081800: + j end_get_attribute_8747373029036 + object_get_attribute_8747373029036: + sw $t1, 0($sp) # internal_0 = self.cdr + end_get_attribute_8747373029036: # Loading return value in $v1 lw $v1, 0($sp) @@ -1723,17 +1944,17 @@ # Set attribute car of self lw $t0, 8($sp) # $t0 = self lw $t1, 4($sp) # $t1 = i - beq $t1, $zero, object_set_attribute_8758768081857 + beq $t1, $zero, object_set_attribute_8747373029093 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8758768081857 + beq $t6, $t5, int_set_attribute_8747373029093 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8758768081857 - j object_set_attribute_8758768081857 - int_set_attribute_8758768081857: + beq $t6, $t5, bool_set_attribute_8747373029093 + j object_set_attribute_8747373029093 + int_set_attribute_8747373029093: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1742,8 +1963,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.car = i - j end_set_attribute_8758768081857 - bool_set_attribute_8758768081857: + j end_set_attribute_8747373029093 + bool_set_attribute_8747373029093: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1752,25 +1973,25 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.car = i - j end_set_attribute_8758768081857 - object_set_attribute_8758768081857: + j end_set_attribute_8747373029093 + object_set_attribute_8747373029093: sw $t1, 8($t0) # self.car = i - end_set_attribute_8758768081857: + end_set_attribute_8747373029093: # Set attribute cdr of self lw $t0, 8($sp) # $t0 = self lw $t1, 0($sp) # $t1 = rest - beq $t1, $zero, object_set_attribute_8758768081866 + beq $t1, $zero, object_set_attribute_8747373029102 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8758768081866 + beq $t6, $t5, int_set_attribute_8747373029102 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8758768081866 - j object_set_attribute_8758768081866 - int_set_attribute_8758768081866: + beq $t6, $t5, bool_set_attribute_8747373029102 + j object_set_attribute_8747373029102 + int_set_attribute_8747373029102: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1779,8 +2000,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.cdr = rest - j end_set_attribute_8758768081866 - bool_set_attribute_8758768081866: + j end_set_attribute_8747373029102 + bool_set_attribute_8747373029102: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1789,10 +2010,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.cdr = rest - j end_set_attribute_8758768081866 - object_set_attribute_8758768081866: + j end_set_attribute_8747373029102 + object_set_attribute_8747373029102: sw $t1, 12($t0) # self.cdr = rest - end_set_attribute_8758768081866: + end_set_attribute_8747373029102: # Loading return value in $v1 lw $v1, 8($sp) @@ -1813,17 +2034,17 @@ # Set attribute mylist of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8758768081899 + beq $t1, $zero, object_set_attribute_8747373029907 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8758768081899 + beq $t6, $t5, int_set_attribute_8747373029907 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8758768081899 - j object_set_attribute_8758768081899 - int_set_attribute_8758768081899: + beq $t6, $t5, bool_set_attribute_8747373029907 + j object_set_attribute_8747373029907 + int_set_attribute_8747373029907: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1832,8 +2053,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.mylist = internal_0 - j end_set_attribute_8758768081899 - bool_set_attribute_8758768081899: + j end_set_attribute_8747373029907 + bool_set_attribute_8747373029907: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1842,10 +2063,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.mylist = internal_0 - j end_set_attribute_8758768081899 - object_set_attribute_8758768081899: + j end_set_attribute_8747373029907 + object_set_attribute_8747373029907: sw $t1, 8($t0) # self.mylist = internal_0 - end_set_attribute_8758768081899: + end_set_attribute_8747373029907: # Loading return value in $v1 lw $v1, 4($sp) @@ -1857,12 +2078,12 @@ function_print_list_at_Main: # Function parameters - # $ra = 52($sp) - # self = 48($sp) - # l = 44($sp) + # $ra = 108($sp) + # self = 104($sp) + # l = 100($sp) # Reserving space for local variables - addi $sp, $sp, -44 + addi $sp, $sp, -100 # Allocating Bool 0 li $v0, 9 @@ -1874,36 +2095,60 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_1 = address of allocated object Int + sw $v0, 92($sp) # internal_1 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_3 = address of allocated object Int + + # Get method isNil of List + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 84($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 80($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument l - lw $t0, 52($sp) + lw $t0, 108($sp) sw $t0, 0($sp) # Storing l - # Calling function function_isNil_at_List - jal function_isNil_at_List + # Calling function internal_4 + lw $t0, 88($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 40($sp) # internal_2 = result of function_isNil_at_List + sw $v1, 96($sp) # internal_2 = result of internal_4 addi $sp, $sp, 8 # Freeing space for arguments # internal_1 = internal_2 - lw $t0, 32($sp) - sw $t0, 36($sp) + lw $t0, 88($sp) + sw $t0, 92($sp) - # If internal_1 then goto then_8758768100422 - lw $t0, 36($sp) # Loading the address of the condition + # If internal_1 then goto then_8747373045164 + lw $t0, 92($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8758768100422 + beq $t0, $t1, then_8747373045164 - # Jumping to else_8758768100422 - j else_8758768100422 + # Jumping to else_8747373045164 + j else_8747373045164 - then_8758768100422: + then_8747373045164: # Allocating String li $v0, 9 @@ -1917,69 +2162,141 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_3[0] = '\n' + sb $t0, 8($v0) # internal_5[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 28($sp) # internal_3 = "\n" + sw $v0, 76($sp) # internal_5 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_7 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 104($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 68($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 64($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 60($sp) + lw $t0, 116($sp) sw $t0, 4($sp) # Storing self - # Argument internal_3 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_3 + # Argument internal_5 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_5 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_8 + lw $t0, 76($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 36($sp) # internal_4 = result of function_out_string_at_IO + sw $v1, 84($sp) # internal_6 = result of internal_8 addi $sp, $sp, 12 # Freeing space for arguments - # internal_0 = internal_4 - lw $t0, 24($sp) - sw $t0, 40($sp) + # internal_0 = internal_6 + lw $t0, 72($sp) + sw $t0, 96($sp) - # Jumping to endif_8758768100422 - j endif_8758768100422 + # Jumping to endif_8747373045164 + j endif_8747373045164 - else_8758768100422: + else_8747373045164: - # Passing function arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_10 = address of allocated object Int + + # Get method head of List + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 56($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 52($sp) + + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument l - lw $t0, 52($sp) + lw $t0, 108($sp) sw $t0, 0($sp) # Storing l - # Calling function function_head_at_List - jal function_head_at_List + # Calling function internal_11 + lw $t0, 60($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 28($sp) # internal_5 = result of function_head_at_List + sw $v1, 68($sp) # internal_9 = result of internal_11 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_13 = address of allocated object Int + + # Get method out_int of Main + lw $t0, 104($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 44($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 40($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 60($sp) + lw $t0, 116($sp) sw $t0, 4($sp) # Storing self - # Argument internal_5 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_5 + # Argument internal_9 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_9 - # Calling function function_out_int_at_IO - jal function_out_int_at_IO + # Calling function internal_14 + lw $t0, 52($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 28($sp) # internal_6 = result of function_out_int_at_IO + sw $v1, 60($sp) # internal_12 = result of internal_14 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -1994,86 +2311,158 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_7[0] = ' ' + sb $t0, 8($v0) # internal_15[0] = ' ' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_7 = " " + sw $v0, 36($sp) # internal_15 = " " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_17 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 104($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 28($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 24($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 60($sp) + lw $t0, 116($sp) sw $t0, 4($sp) # Storing self - # Argument internal_7 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_7 + # Argument internal_15 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_15 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_18 + lw $t0, 36($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 20($sp) # internal_8 = result of function_out_string_at_IO + sw $v1, 44($sp) # internal_16 = result of internal_18 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_20 = address of allocated object Int + + # Get method tail of List + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument l - lw $t0, 52($sp) + lw $t0, 108($sp) sw $t0, 0($sp) # Storing l - # Calling function function_tail_at_List - jal function_tail_at_List + # Calling function internal_21 + lw $t0, 20($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 12($sp) # internal_9 = result of function_tail_at_List + sw $v1, 28($sp) # internal_19 = result of internal_21 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_23 = address of allocated object Int + + # Get method print_list of Main + lw $t0, 104($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 60($sp) + lw $t0, 116($sp) sw $t0, 4($sp) # Storing self - # Argument internal_9 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_9 + # Argument internal_19 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_19 - # Calling function function_print_list_at_Main - jal function_print_list_at_Main + # Calling function internal_24 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_10 = result of function_print_list_at_Main + sw $v1, 20($sp) # internal_22 = result of internal_24 addi $sp, $sp, 12 # Freeing space for arguments - # internal_0 = internal_10 - lw $t0, 0($sp) - sw $t0, 40($sp) + # internal_0 = internal_22 + lw $t0, 8($sp) + sw $t0, 96($sp) - # Jumping to endif_8758768100422 - j endif_8758768100422 + # Jumping to endif_8747373045164 + j endif_8747373045164 - endif_8758768100422: + endif_8747373045164: # Loading return value in $v1 - lw $v1, 40($sp) + lw $v1, 96($sp) # Freeing space for local variables - addi $sp, $sp, 44 + addi $sp, $sp, 100 jr $ra function_main_at_Main: # Function parameters - # $ra = 80($sp) - # self = 76($sp) + # $ra = 148($sp) + # self = 144($sp) # Reserving space for local variables - addi $sp, $sp, -76 + addi $sp, $sp, -144 # Allocating List li $v0, 9 @@ -2082,20 +2471,20 @@ la $t0, type_List # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 72($sp) # internal_0 = address of allocated object List + sw $v0, 140($sp) # internal_0 = address of allocated object List # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 80($sp) + lw $t0, 148($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_List jal function___init___at_List lw $ra, 4($sp) - sw $v1, 80($sp) # internal_0 = result of function___init___at_List + sw $v1, 148($sp) # internal_0 = result of function___init___at_List addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 1 @@ -2108,24 +2497,48 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 68($sp) # internal_1 = address of allocated object Int + sw $v0, 136($sp) # internal_1 = address of allocated object Int + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_3 = address of allocated object Int + + # Get method cons of List + lw $t0, 140($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 128($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 124($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_0 - lw $t0, 84($sp) + lw $t0, 152($sp) sw $t0, 4($sp) # Storing internal_0 # Argument internal_1 - lw $t0, 80($sp) + lw $t0, 148($sp) sw $t0, 0($sp) # Storing internal_1 - # Calling function function_cons_at_List - jal function_cons_at_List + # Calling function internal_4 + lw $t0, 136($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 76($sp) # internal_2 = result of function_cons_at_List + sw $v1, 144($sp) # internal_2 = result of internal_4 addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 2 @@ -2138,24 +2551,48 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_3 = address of allocated object Int + sw $v0, 120($sp) # internal_5 = address of allocated object Int + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_7 = address of allocated object Int + + # Get method cons of List + lw $t0, 132($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 112($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 108($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_2 - lw $t0, 76($sp) + lw $t0, 144($sp) sw $t0, 4($sp) # Storing internal_2 - # Argument internal_3 - lw $t0, 72($sp) - sw $t0, 0($sp) # Storing internal_3 + # Argument internal_5 + lw $t0, 132($sp) + sw $t0, 0($sp) # Storing internal_5 - # Calling function function_cons_at_List - jal function_cons_at_List + # Calling function internal_8 + lw $t0, 120($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 68($sp) # internal_4 = result of function_cons_at_List + sw $v1, 128($sp) # internal_6 = result of internal_8 addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 3 @@ -2168,24 +2605,48 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 52($sp) # internal_5 = address of allocated object Int + sw $v0, 104($sp) # internal_9 = address of allocated object Int + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_11 = address of allocated object Int + + # Get method cons of List + lw $t0, 116($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 96($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 92($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_4 - lw $t0, 68($sp) - sw $t0, 4($sp) # Storing internal_4 + # Argument internal_6 + lw $t0, 128($sp) + sw $t0, 4($sp) # Storing internal_6 - # Argument internal_5 - lw $t0, 64($sp) - sw $t0, 0($sp) # Storing internal_5 + # Argument internal_9 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_9 - # Calling function function_cons_at_List - jal function_cons_at_List + # Calling function internal_12 + lw $t0, 104($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 60($sp) # internal_6 = result of function_cons_at_List + sw $v1, 112($sp) # internal_10 = result of internal_12 addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 4 @@ -2198,24 +2659,48 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_7 = address of allocated object Int + sw $v0, 88($sp) # internal_13 = address of allocated object Int + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_15 = address of allocated object Int + + # Get method cons of List + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 80($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 76($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_6 - lw $t0, 60($sp) - sw $t0, 4($sp) # Storing internal_6 + # Argument internal_10 + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing internal_10 - # Argument internal_7 - lw $t0, 56($sp) - sw $t0, 0($sp) # Storing internal_7 + # Argument internal_13 + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing internal_13 - # Calling function function_cons_at_List - jal function_cons_at_List + # Calling function internal_16 + lw $t0, 88($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 52($sp) # internal_8 = result of function_cons_at_List + sw $v1, 96($sp) # internal_14 = result of internal_16 addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 5 @@ -2228,40 +2713,64 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 5 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_9 = address of allocated object Int + sw $v0, 72($sp) # internal_17 = address of allocated object Int + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_19 = address of allocated object Int + + # Get method cons of List + lw $t0, 84($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 64($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 60($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_8 - lw $t0, 52($sp) - sw $t0, 4($sp) # Storing internal_8 + # Argument internal_14 + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing internal_14 - # Argument internal_9 - lw $t0, 48($sp) - sw $t0, 0($sp) # Storing internal_9 + # Argument internal_17 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_17 - # Calling function function_cons_at_List - jal function_cons_at_List + # Calling function internal_20 + lw $t0, 72($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 44($sp) # internal_10 = result of function_cons_at_List + sw $v1, 80($sp) # internal_18 = result of internal_20 addi $sp, $sp, 12 # Freeing space for arguments # Set attribute mylist of self - lw $t0, 76($sp) # $t0 = self - lw $t1, 32($sp) # $t1 = internal_10 - beq $t1, $zero, object_set_attribute_8758768083517 + lw $t0, 144($sp) # $t0 = self + lw $t1, 68($sp) # $t1 = internal_18 + beq $t1, $zero, object_set_attribute_8747373031181 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8758768083517 + beq $t6, $t5, int_set_attribute_8747373031181 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8758768083517 - j object_set_attribute_8758768083517 - int_set_attribute_8758768083517: + beq $t6, $t5, bool_set_attribute_8747373031181 + j object_set_attribute_8747373031181 + int_set_attribute_8747373031181: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2269,9 +2778,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($t0) # self.mylist = internal_10 - j end_set_attribute_8758768083517 - bool_set_attribute_8758768083517: + sw $v0, 8($t0) # self.mylist = internal_18 + j end_set_attribute_8747373031181 + bool_set_attribute_8747373031181: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2279,27 +2788,30 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($t0) # self.mylist = internal_10 - j end_set_attribute_8758768083517 - object_set_attribute_8758768083517: - sw $t1, 8($t0) # self.mylist = internal_10 - end_set_attribute_8758768083517: + sw $v0, 8($t0) # self.mylist = internal_18 + j end_set_attribute_8747373031181 + object_set_attribute_8747373031181: + sw $t1, 8($t0) # self.mylist = internal_18 + end_set_attribute_8747373031181: - while_start_8758768100533: + # Allocating NUll to internal_21 + sw $zero, 56($sp) # internal_21 = 0 + + while_start_8747373046303: # Get attribute mylist of self - lw $t0, 76($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'mylist' from the instance + lw $t0, 144($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'mylist' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8758768084041 + beq $t6, $t5, int_get_attribute_8747373031837 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8758768084041 - j object_get_attribute_8758768084041 - int_get_attribute_8758768084041: + beq $t6, $t5, bool_get_attribute_8747373031837 + j object_get_attribute_8747373031837 + int_get_attribute_8747373031837: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2307,9 +2819,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 28($sp) # internal_11 = self.mylist - j end_get_attribute_8758768084041 - bool_get_attribute_8758768084041: + sw $v0, 52($sp) # internal_22 = self.mylist + j end_get_attribute_8747373031837 + bool_get_attribute_8747373031837: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2317,24 +2829,48 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 28($sp) # internal_11 = self.mylist - j end_get_attribute_8758768084041 - object_get_attribute_8758768084041: - sw $t1, 28($sp) # internal_11 = mylist - end_get_attribute_8758768084041: + sw $v0, 52($sp) # internal_22 = self.mylist + j end_get_attribute_8747373031837 + object_get_attribute_8747373031837: + sw $t1, 52($sp) # internal_22 = self.mylist + end_get_attribute_8747373031837: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_24 = address of allocated object Int + + # Get method isNil of List + lw $t0, 52($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 44($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 40($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_11 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_11 + # Argument internal_22 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_22 - # Calling function function_isNil_at_List - jal function_isNil_at_List + # Calling function internal_25 + lw $t0, 48($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 32($sp) # internal_12 = result of function_isNil_at_List + sw $v1, 56($sp) # internal_23 = result of internal_25 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 1 @@ -2347,7 +2883,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_13 = address of allocated object Int + sw $v0, 36($sp) # internal_26 = address of allocated object Int # Allocating Bool 0 li $v0, 9 @@ -2359,50 +2895,50 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_14 = address of allocated object Int + sw $v0, 32($sp) # internal_27 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_12 - lw $t0, 36($sp) - sw $t0, 4($sp) # Storing internal_12 + # Argument internal_23 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing internal_23 - # Argument internal_13 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_13 + # Argument internal_26 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_26 # Calling function function_xor jal function_xor lw $ra, 8($sp) - sw $v1, 28($sp) # internal_14 = result of function_xor + sw $v1, 44($sp) # internal_27 = result of function_xor addi $sp, $sp, 12 # Freeing space for arguments - # If internal_14 then goto while_body_8758768100533 - lw $t0, 16($sp) # Loading the address of the condition + # If internal_27 then goto while_body_8747373046303 + lw $t0, 32($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8758768100533 + beq $t0, $t1, while_body_8747373046303 - # Jumping to while_end_8758768100533 - j while_end_8758768100533 + # Jumping to while_end_8747373046303 + j while_end_8747373046303 - while_body_8758768100533: + while_body_8747373046303: # Get attribute mylist of self - lw $t0, 76($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'mylist' from the instance + lw $t0, 144($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'mylist' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8758768084140 + beq $t6, $t5, int_get_attribute_8747373032220 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8758768084140 - j object_get_attribute_8758768084140 - int_get_attribute_8758768084140: + beq $t6, $t5, bool_get_attribute_8747373032220 + j object_get_attribute_8747373032220 + int_get_attribute_8747373032220: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2410,9 +2946,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_15 = self.mylist - j end_get_attribute_8758768084140 - bool_get_attribute_8758768084140: + sw $v0, 28($sp) # internal_28 = self.mylist + j end_get_attribute_8747373032220 + bool_get_attribute_8747373032220: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2420,43 +2956,67 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_15 = self.mylist - j end_get_attribute_8758768084140 - object_get_attribute_8758768084140: - sw $t1, 12($sp) # internal_15 = mylist - end_get_attribute_8758768084140: + sw $v0, 28($sp) # internal_28 = self.mylist + j end_get_attribute_8747373032220 + object_get_attribute_8747373032220: + sw $t1, 28($sp) # internal_28 = self.mylist + end_get_attribute_8747373032220: + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_30 = address of allocated object Int + + # Get method print_list of Main + lw $t0, 144($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 88($sp) + lw $t0, 156($sp) sw $t0, 4($sp) # Storing self - # Argument internal_15 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_15 + # Argument internal_28 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_28 - # Calling function function_print_list_at_Main - jal function_print_list_at_Main + # Calling function internal_31 + lw $t0, 28($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 20($sp) # internal_16 = result of function_print_list_at_Main + sw $v1, 36($sp) # internal_29 = result of internal_31 addi $sp, $sp, 12 # Freeing space for arguments # Get attribute mylist of self - lw $t0, 76($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'mylist' from the instance + lw $t0, 144($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'mylist' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8758768084185 + beq $t6, $t5, int_get_attribute_8747373032289 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8758768084185 - j object_get_attribute_8758768084185 - int_get_attribute_8758768084185: + beq $t6, $t5, bool_get_attribute_8747373032289 + j object_get_attribute_8747373032289 + int_get_attribute_8747373032289: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2464,9 +3024,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_17 = self.mylist - j end_get_attribute_8758768084185 - bool_get_attribute_8758768084185: + sw $v0, 12($sp) # internal_32 = self.mylist + j end_get_attribute_8747373032289 + bool_get_attribute_8747373032289: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2474,40 +3034,64 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_17 = self.mylist - j end_get_attribute_8758768084185 - object_get_attribute_8758768084185: - sw $t1, 4($sp) # internal_17 = mylist - end_get_attribute_8758768084185: + sw $v0, 12($sp) # internal_32 = self.mylist + j end_get_attribute_8747373032289 + object_get_attribute_8747373032289: + sw $t1, 12($sp) # internal_32 = self.mylist + end_get_attribute_8747373032289: + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_34 = address of allocated object Int + + # Get method tail of List + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_17 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_17 + # Argument internal_32 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_32 - # Calling function function_tail_at_List - jal function_tail_at_List + # Calling function internal_35 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_18 = result of function_tail_at_List + sw $v1, 16($sp) # internal_33 = result of internal_35 addi $sp, $sp, 8 # Freeing space for arguments # Set attribute mylist of self - lw $t0, 76($sp) # $t0 = self - lw $t1, 0($sp) # $t1 = internal_18 - beq $t1, $zero, object_set_attribute_8758768084161 + lw $t0, 144($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_33 + beq $t1, $zero, object_set_attribute_8747373032265 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8758768084161 + beq $t6, $t5, int_set_attribute_8747373032265 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8758768084161 - j object_set_attribute_8758768084161 - int_set_attribute_8758768084161: + beq $t6, $t5, bool_set_attribute_8747373032265 + j object_set_attribute_8747373032265 + int_set_attribute_8747373032265: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2515,9 +3099,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($t0) # self.mylist = internal_18 - j end_set_attribute_8758768084161 - bool_set_attribute_8758768084161: + sw $v0, 8($t0) # self.mylist = internal_33 + j end_set_attribute_8747373032265 + bool_set_attribute_8747373032265: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2525,28 +3109,28 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($t0) # self.mylist = internal_18 - j end_set_attribute_8758768084161 - object_set_attribute_8758768084161: - sw $t1, 8($t0) # self.mylist = internal_18 - end_set_attribute_8758768084161: + sw $v0, 8($t0) # self.mylist = internal_33 + j end_set_attribute_8747373032265 + object_set_attribute_8747373032265: + sw $t1, 8($t0) # self.mylist = internal_33 + end_set_attribute_8747373032265: - # Jumping to while_start_8758768100533 - j while_start_8758768100533 + # Jumping to while_start_8747373046303 + j while_start_8747373046303 - while_end_8758768100533: + while_end_8747373046303: # Loading return value in $v1 - addi $v1, $zero, 0 + lw $v1, 56($sp) # Freeing space for local variables - addi $sp, $sp, 76 + addi $sp, $sp, 144 jr $ra main: # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Allocating Main li $v0, 9 @@ -2555,34 +3139,58 @@ la $t0, type_Main # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object Main + sw $v0, 12($sp) # internal_0 = address of allocated object Main # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_Main jal function___init___at_Main lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_main_at_Main - jal function_main_at_Main + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + sw $v1, 16($sp) # internal_1 = result of internal_3 addi $sp, $sp, 8 # Freeing space for arguments # Exit program diff --git a/tests/codegen/new_complex.mips b/tests/codegen/new_complex.mips index 5c60b1112..c83ae4ed1 100644 --- a/tests/codegen/new_complex.mips +++ b/tests/codegen/new_complex.mips @@ -1,52 +1,104 @@ .data - type_Object: .word 8 + type_Object: .word 24 type_Object_inherits_from: .word 0 - type_Object_attributes: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_Main: .word 44 + type_Main_inherits_from: .word type_IO + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_out_string: .word function_out_string_at_IO + type_Main_out_int: .word function_out_int_at_IO + type_Main_in_string: .word function_in_string_at_IO + type_Main_in_int: .word function_in_int_at_IO + type_Main_main: .word function_main_at_Main + + type_Complex: .word 80 + type_Complex_inherits_from: .word type_IO + type_Complex_name_address: .word type_Complex_name_size + type_Complex___init__: .word function___init___at_Complex + type_Complex_abort: .word function_abort_at_Object + type_Complex_type_name: .word function_type_name_at_Object + type_Complex_copy: .word function_copy_at_Object + type_Complex_out_string: .word function_out_string_at_IO + type_Complex_out_int: .word function_out_int_at_IO + type_Complex_in_string: .word function_in_string_at_IO + type_Complex_in_int: .word function_in_int_at_IO + type_Complex_init: .word function_init_at_Complex + type_Complex_print: .word function_print_at_Complex + type_Complex_reflect_0: .word function_reflect_0_at_Complex + type_Complex_reflect_X: .word function_reflect_X_at_Complex + type_Complex_reflect_Y: .word function_reflect_Y_at_Complex + type_Complex_equal: .word function_equal_at_Complex + type_Complex_x_value: .word function_x_value_at_Complex + type_Complex_y_value: .word function_y_value_at_Complex + type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" - type_Object_abort_message: .asciiz "Abort called from class Object\n" - type_IO: .word 8 - type_IO_inherits_from: .word type_Object - type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" - type_IO_abort_message: .asciiz "Abort called from class IO\n" - - type_Int: .word 8 - type_Int_inherits_from: .word type_Object - type_Int_attributes: .word 0 - type_Int_name_size: .word 3 - type_Int_name: .asciiz "Int" - type_Int_abort_message: .asciiz "Abort called from class Int\n" - type_String: .word 8 - type_String_inherits_from: .word type_Object - type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" - type_String_abort_message: .asciiz "Abort called from class String\n" - type_Bool: .word 8 - type_Bool_inherits_from: .word type_Object - type_Bool_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" - type_Bool_abort_message: .asciiz "Abort called from class Bool\n" - type_Main: .word 8 - type_Main_inherits_from: .word type_IO - type_Main_attributes: .word 0 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" - type_Main_abort_message: .asciiz "Abort called from class Main\n" - type_Complex: .word 16 - type_Complex_inherits_from: .word type_IO - type_Complex_attributes: .word 2 type_Complex_name_size: .word 7 type_Complex_name: .asciiz "Complex" - type_Complex_abort_message: .asciiz "Abort called from class Complex\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -707,11 +759,11 @@ function_abort_at_Object: # Function parameters - # $ra = 20($sp) - # self = 16($sp) + # $ra = 28($sp) + # self = 24($sp) # Reserving space for local variables - addi $sp, $sp, -16 + addi $sp, $sp, -24 # Allocating String li $v0, 9 @@ -798,7 +850,7 @@ sb $zero, 32($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_0 = "Abort called from class " + sw $v0, 20($sp) # internal_0 = "Abort called from class " # Allocating String li $v0, 9 @@ -812,66 +864,138 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_2[0] = '\n' + sb $t0, 8($v0) # internal_3[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_2 = "\n" + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 0($sp) # Storing self - # Calling function function_type_name_at_Object - jal function_type_name_at_Object + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + sw $v1, 24($sp) # internal_1 = result of internal_5 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_0 - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing internal_0 # Argument internal_1 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_1 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_3 - lw $t0, 12($sp) - sw $t0, 4($sp) # Storing internal_3 - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) # $t0 = internal_3 + lw $t0, 12($sp) # $t0 = internal_2 addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string internal_3 + # Printing the String internal_2 li $v0, 4 move $a0, $t0 syscall @@ -881,10 +1005,10 @@ syscall # Loading return value in $v1 - lw $v1, 16($sp) + lw $v1, 24($sp) # Freeing space for local variables - addi $sp, $sp, 16 + addi $sp, $sp, 24 jr $ra @@ -899,8 +1023,9 @@ # internal_0 = name of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($t0) # $t1 = type of self - lw $t2, 12($t1) # $t1 = length of the name of self - la $t3, 16($t1) # $t1 = name of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 @@ -1003,7 +1128,7 @@ lw $t0, 0($sp) # $t0 = x addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string x + # Printing the String x li $v0, 4 move $a0, $t0 syscall @@ -1019,7 +1144,7 @@ # self = 4($sp) # x = 0($sp) - # Printing the string x + # Printing the Int x li $v0, 1 lw $a0, 0($sp) lw $a0, 8($a0) @@ -1046,11 +1171,13 @@ xor $t0, $t0, $t0 # Initializing counter while_read_start: lb $t1, buffer_input($t0) # Loading the byte - beq $t1, $zero, while_read_end + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end addi $t0, $t0, 1 # Incrementing counter j while_read_start while_read_end: - addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 @@ -1297,6 +1424,26 @@ jr $ra + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + function___init___at_Main: # Function parameters # $ra = 4($sp) @@ -1309,11 +1456,11 @@ function_main_at_Main: # Function parameters - # $ra = 100($sp) - # self = 96($sp) + # $ra = 188($sp) + # self = 184($sp) # Reserving space for local variables - addi $sp, $sp, -96 + addi $sp, $sp, -184 # Allocating Complex li $v0, 9 @@ -1322,20 +1469,20 @@ la $t0, type_Complex # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 88($sp) # internal_1 = address of allocated object Complex + sw $v0, 176($sp) # internal_1 = address of allocated object Complex # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_1 - lw $t0, 96($sp) + lw $t0, 184($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function___init___at_Complex jal function___init___at_Complex lw $ra, 4($sp) - sw $v1, 96($sp) # internal_1 = result of function___init___at_Complex + sw $v1, 184($sp) # internal_1 = result of function___init___at_Complex addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 1 @@ -1348,7 +1495,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 84($sp) # internal_2 = address of allocated object Int + sw $v0, 172($sp) # internal_2 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -1360,28 +1507,52 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # internal_3 = address of allocated object Int + sw $v0, 168($sp) # internal_3 = address of allocated object Int + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_5 = address of allocated object Int + + # Get method init of Complex + lw $t0, 176($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 160($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 156($sp) # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument internal_1 - lw $t0, 104($sp) + lw $t0, 192($sp) sw $t0, 8($sp) # Storing internal_1 # Argument internal_2 - lw $t0, 100($sp) + lw $t0, 188($sp) sw $t0, 4($sp) # Storing internal_2 # Argument internal_3 - lw $t0, 96($sp) + lw $t0, 184($sp) sw $t0, 0($sp) # Storing internal_3 - # Calling function function_init_at_Complex - jal function_init_at_Complex + # Calling function internal_6 + lw $t0, 172($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 92($sp) # internal_4 = result of function_init_at_Complex + sw $v1, 180($sp) # internal_4 = result of internal_6 addi $sp, $sp, 16 # Freeing space for arguments # Passing function arguments @@ -1389,17 +1560,17 @@ sw $ra, 8($sp) # Storing return address # Argument c - lw $t0, 104($sp) + lw $t0, 192($sp) sw $t0, 4($sp) # Storing c # Argument internal_4 - lw $t0, 88($sp) + lw $t0, 176($sp) sw $t0, 0($sp) # Storing internal_4 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 104($sp) # c = result of function_assign + sw $v1, 192($sp) # c = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bool 0 @@ -1412,68 +1583,116 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 68($sp) # internal_6 = address of allocated object Int + sw $v0, 148($sp) # internal_8 = address of allocated object Int + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 140($sp) # internal_10 = address of allocated object Int + + # Get method reflect_X of Complex + lw $t0, 180($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 140($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 136($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument c - lw $t0, 100($sp) + lw $t0, 188($sp) sw $t0, 0($sp) # Storing c - # Calling function function_reflect_X_at_Complex - jal function_reflect_X_at_Complex + # Calling function internal_11 + lw $t0, 144($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 72($sp) # internal_7 = result of function_reflect_X_at_Complex + sw $v1, 152($sp) # internal_9 = result of internal_11 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_13 = address of allocated object Int + + # Get method reflect_0 of Complex + lw $t0, 180($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 128($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 124($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument c - lw $t0, 100($sp) + lw $t0, 188($sp) sw $t0, 0($sp) # Storing c - # Calling function function_reflect_0_at_Complex - jal function_reflect_0_at_Complex + # Calling function internal_14 + lw $t0, 132($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 68($sp) # internal_8 = result of function_reflect_0_at_Complex + sw $v1, 140($sp) # internal_12 = result of internal_14 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_7 - lw $t0, 76($sp) - sw $t0, 4($sp) # Storing internal_7 + # Argument internal_9 + lw $t0, 156($sp) + sw $t0, 4($sp) # Storing internal_9 - # Argument internal_8 - lw $t0, 72($sp) - sw $t0, 0($sp) # Storing internal_8 + # Argument internal_12 + lw $t0, 144($sp) + sw $t0, 0($sp) # Storing internal_12 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 68($sp) # internal_9 = result of function_equal + sw $v1, 132($sp) # internal_15 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_6 = internal_9 - lw $t0, 56($sp) - sw $t0, 68($sp) + # internal_8 = internal_15 + lw $t0, 120($sp) + sw $t0, 148($sp) - # If internal_6 then goto then_8784369540115 - lw $t0, 68($sp) # Loading the address of the condition + # If internal_8 then goto then_8753583571026 + lw $t0, 148($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8784369540115 + beq $t0, $t1, then_8753583571026 - # Jumping to else_8784369540115 - j else_8784369540115 + # Jumping to else_8753583571026 + j else_8753583571026 - then_8784369540115: + then_8753583571026: # Allocating String li $v0, 9 @@ -1487,44 +1706,68 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 61 - sb $t0, 8($v0) # internal_10[0] = '=' + sb $t0, 8($v0) # internal_16[0] = '=' addi $t0, $zero, 41 - sb $t0, 9($v0) # internal_10[1] = ')' + sb $t0, 9($v0) # internal_16[1] = ')' addi $t0, $zero, 10 - sb $t0, 10($v0) # internal_10[2] = '\n' + sb $t0, 10($v0) # internal_16[2] = '\n' sb $zero, 11($v0) # Null-terminator at the end of the string - sw $v0, 52($sp) # internal_10 = "=)\n" + sw $v0, 116($sp) # internal_16 = "=)\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_18 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 184($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 108($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 104($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 108($sp) + lw $t0, 196($sp) sw $t0, 4($sp) # Storing self - # Argument internal_10 - lw $t0, 64($sp) - sw $t0, 0($sp) # Storing internal_10 + # Argument internal_16 + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing internal_16 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_19 + lw $t0, 116($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 60($sp) # internal_11 = result of function_out_string_at_IO + sw $v1, 124($sp) # internal_17 = result of internal_19 addi $sp, $sp, 12 # Freeing space for arguments - # internal_5 = internal_11 - lw $t0, 48($sp) - sw $t0, 72($sp) + # internal_7 = internal_17 + lw $t0, 112($sp) + sw $t0, 152($sp) - # Jumping to endif_8784369540115 - j endif_8784369540115 + # Jumping to endif_8753583571026 + j endif_8753583571026 - else_8784369540115: + else_8753583571026: # Allocating String li $v0, 9 @@ -1538,44 +1781,68 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 61 - sb $t0, 8($v0) # internal_12[0] = '=' + sb $t0, 8($v0) # internal_20[0] = '=' addi $t0, $zero, 40 - sb $t0, 9($v0) # internal_12[1] = '(' + sb $t0, 9($v0) # internal_20[1] = '(' addi $t0, $zero, 10 - sb $t0, 10($v0) # internal_12[2] = '\n' + sb $t0, 10($v0) # internal_20[2] = '\n' sb $zero, 11($v0) # Null-terminator at the end of the string - sw $v0, 44($sp) # internal_12 = "=(\n" + sw $v0, 100($sp) # internal_20 = "=(\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 92($sp) # internal_22 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 184($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 92($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 88($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 108($sp) + lw $t0, 196($sp) sw $t0, 4($sp) # Storing self - # Argument internal_12 - lw $t0, 56($sp) - sw $t0, 0($sp) # Storing internal_12 + # Argument internal_20 + lw $t0, 112($sp) + sw $t0, 0($sp) # Storing internal_20 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_23 + lw $t0, 100($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 52($sp) # internal_13 = result of function_out_string_at_IO + sw $v1, 108($sp) # internal_21 = result of internal_23 addi $sp, $sp, 12 # Freeing space for arguments - # internal_5 = internal_13 - lw $t0, 40($sp) - sw $t0, 72($sp) + # internal_7 = internal_21 + lw $t0, 96($sp) + sw $t0, 152($sp) - # Jumping to endif_8784369540115 - j endif_8784369540115 + # Jumping to endif_8753583571026 + j endif_8753583571026 - endif_8784369540115: + endif_8753583571026: # Allocating Bool 0 li $v0, 9 @@ -1587,82 +1854,178 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_15 = address of allocated object Int + sw $v0, 80($sp) # internal_25 = address of allocated object Int + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_27 = address of allocated object Int + + # Get method reflect_X of Complex + lw $t0, 180($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 72($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 68($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument c - lw $t0, 100($sp) + lw $t0, 188($sp) sw $t0, 0($sp) # Storing c - # Calling function function_reflect_X_at_Complex - jal function_reflect_X_at_Complex + # Calling function internal_28 + lw $t0, 76($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 36($sp) # internal_16 = result of function_reflect_X_at_Complex + sw $v1, 84($sp) # internal_26 = result of internal_28 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_30 = address of allocated object Int + + # Get method reflect_Y of Complex + lw $t0, 76($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 60($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 56($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_16 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_16 + # Argument internal_26 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_26 - # Calling function function_reflect_Y_at_Complex - jal function_reflect_Y_at_Complex + # Calling function internal_31 + lw $t0, 64($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 32($sp) # internal_17 = result of function_reflect_Y_at_Complex + sw $v1, 72($sp) # internal_29 = result of internal_31 addi $sp, $sp, 8 # Freeing space for arguments - # Passing function arguments - addi $sp, $sp, -8 # Reserving space for arguments - sw $ra, 4($sp) # Storing return address + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_33 = address of allocated object Int + + # Get method reflect_0 of Complex + lw $t0, 180($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 48($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 44($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address # Argument c - lw $t0, 100($sp) + lw $t0, 188($sp) sw $t0, 0($sp) # Storing c - # Calling function function_reflect_0_at_Complex - jal function_reflect_0_at_Complex + # Calling function internal_34 + lw $t0, 52($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 28($sp) # internal_18 = result of function_reflect_0_at_Complex + sw $v1, 60($sp) # internal_32 = result of internal_34 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_36 = address of allocated object Int + + # Get method equal of Complex + lw $t0, 64($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 36($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 32($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_17 - lw $t0, 36($sp) - sw $t0, 4($sp) # Storing internal_17 + # Argument internal_29 + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing internal_29 - # Argument internal_18 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_18 + # Argument internal_32 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_32 - # Calling function function_equal_at_Complex - jal function_equal_at_Complex + # Calling function internal_37 + lw $t0, 44($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 28($sp) # internal_19 = result of function_equal_at_Complex + sw $v1, 52($sp) # internal_35 = result of internal_37 addi $sp, $sp, 12 # Freeing space for arguments - # internal_15 = internal_19 - lw $t0, 16($sp) - sw $t0, 32($sp) + # internal_25 = internal_35 + lw $t0, 40($sp) + sw $t0, 80($sp) - # If internal_15 then goto then_8784369540163 - lw $t0, 32($sp) # Loading the address of the condition + # If internal_25 then goto then_8753583571074 + lw $t0, 80($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8784369540163 + beq $t0, $t1, then_8753583571074 - # Jumping to else_8784369540163 - j else_8784369540163 + # Jumping to else_8753583571074 + j else_8753583571074 - then_8784369540163: + then_8753583571074: # Allocating String li $v0, 9 @@ -1676,44 +2039,68 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 61 - sb $t0, 8($v0) # internal_20[0] = '=' + sb $t0, 8($v0) # internal_38[0] = '=' addi $t0, $zero, 41 - sb $t0, 9($v0) # internal_20[1] = ')' + sb $t0, 9($v0) # internal_38[1] = ')' addi $t0, $zero, 10 - sb $t0, 10($v0) # internal_20[2] = '\n' + sb $t0, 10($v0) # internal_38[2] = '\n' sb $zero, 11($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_20 = "=)\n" + sw $v0, 28($sp) # internal_38 = "=)\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_40 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 184($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 108($sp) + lw $t0, 196($sp) sw $t0, 4($sp) # Storing self - # Argument internal_20 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_20 + # Argument internal_38 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_38 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_41 + lw $t0, 28($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 20($sp) # internal_21 = result of function_out_string_at_IO + sw $v1, 36($sp) # internal_39 = result of internal_41 addi $sp, $sp, 12 # Freeing space for arguments - # internal_14 = internal_21 - lw $t0, 8($sp) - sw $t0, 36($sp) + # internal_24 = internal_39 + lw $t0, 24($sp) + sw $t0, 84($sp) - # Jumping to endif_8784369540163 - j endif_8784369540163 + # Jumping to endif_8753583571074 + j endif_8753583571074 - else_8784369540163: + else_8753583571074: # Allocating String li $v0, 9 @@ -1727,50 +2114,74 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 61 - sb $t0, 8($v0) # internal_22[0] = '=' + sb $t0, 8($v0) # internal_42[0] = '=' addi $t0, $zero, 40 - sb $t0, 9($v0) # internal_22[1] = '(' + sb $t0, 9($v0) # internal_42[1] = '(' addi $t0, $zero, 10 - sb $t0, 10($v0) # internal_22[2] = '\n' + sb $t0, 10($v0) # internal_42[2] = '\n' sb $zero, 11($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_22 = "=(\n" + sw $v0, 12($sp) # internal_42 = "=(\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_44 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 184($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 108($sp) + lw $t0, 196($sp) sw $t0, 4($sp) # Storing self - # Argument internal_22 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_22 + # Argument internal_42 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_42 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_45 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_23 = result of function_out_string_at_IO + sw $v1, 20($sp) # internal_43 = result of internal_45 addi $sp, $sp, 12 # Freeing space for arguments - # internal_14 = internal_23 - lw $t0, 0($sp) - sw $t0, 36($sp) + # internal_24 = internal_43 + lw $t0, 8($sp) + sw $t0, 84($sp) - # Jumping to endif_8784369540163 - j endif_8784369540163 + # Jumping to endif_8753583571074 + j endif_8753583571074 - endif_8784369540163: + endif_8753583571074: # Loading return value in $v1 - lw $v1, 36($sp) + lw $v1, 84($sp) # Freeing space for local variables - addi $sp, $sp, 96 + addi $sp, $sp, 184 jr $ra @@ -1797,17 +2208,17 @@ # Set attribute x of self lw $t0, 8($sp) # $t0 = self lw $t1, 4($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8784369523008 + beq $t1, $zero, object_set_attribute_8753583564794 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8784369523008 + beq $t6, $t5, int_set_attribute_8753583564794 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8784369523008 - j object_set_attribute_8784369523008 - int_set_attribute_8784369523008: + beq $t6, $t5, bool_set_attribute_8753583564794 + j object_set_attribute_8753583564794 + int_set_attribute_8753583564794: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1816,8 +2227,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.x = internal_0 - j end_set_attribute_8784369523008 - bool_set_attribute_8784369523008: + j end_set_attribute_8753583564794 + bool_set_attribute_8753583564794: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1826,10 +2237,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.x = internal_0 - j end_set_attribute_8784369523008 - object_set_attribute_8784369523008: + j end_set_attribute_8753583564794 + object_set_attribute_8753583564794: sw $t1, 8($t0) # self.x = internal_0 - end_set_attribute_8784369523008: + end_set_attribute_8753583564794: # Allocating Int 0 li $v0, 9 @@ -1846,17 +2257,17 @@ # Set attribute y of self lw $t0, 8($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_1 - beq $t1, $zero, object_set_attribute_8784369523029 + beq $t1, $zero, object_set_attribute_8753583565590 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8784369523029 + beq $t6, $t5, int_set_attribute_8753583565590 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8784369523029 - j object_set_attribute_8784369523029 - int_set_attribute_8784369523029: + beq $t6, $t5, bool_set_attribute_8753583565590 + j object_set_attribute_8753583565590 + int_set_attribute_8753583565590: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1865,8 +2276,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.y = internal_1 - j end_set_attribute_8784369523029 - bool_set_attribute_8784369523029: + j end_set_attribute_8753583565590 + bool_set_attribute_8753583565590: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1875,10 +2286,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.y = internal_1 - j end_set_attribute_8784369523029 - object_set_attribute_8784369523029: + j end_set_attribute_8753583565590 + object_set_attribute_8753583565590: sw $t1, 12($t0) # self.y = internal_1 - end_set_attribute_8784369523029: + end_set_attribute_8753583565590: # Loading return value in $v1 lw $v1, 8($sp) @@ -1900,17 +2311,17 @@ # Get attribute x of self lw $t0, 24($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t1, 8($t0) # Get the attribute 'x' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8784369523092 + beq $t6, $t5, int_get_attribute_8753583565653 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8784369523092 - j object_get_attribute_8784369523092 - int_get_attribute_8784369523092: + beq $t6, $t5, bool_get_attribute_8753583565653 + j object_get_attribute_8753583565653 + int_get_attribute_8753583565653: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1919,8 +2330,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($sp) # internal_0 = self.x - j end_get_attribute_8784369523092 - bool_get_attribute_8784369523092: + j end_get_attribute_8753583565653 + bool_get_attribute_8753583565653: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1929,10 +2340,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($sp) # internal_0 = self.x - j end_get_attribute_8784369523092 - object_get_attribute_8784369523092: - sw $t1, 12($sp) # internal_0 = x - end_get_attribute_8784369523092: + j end_get_attribute_8753583565653 + object_get_attribute_8753583565653: + sw $t1, 12($sp) # internal_0 = self.x + end_get_attribute_8753583565653: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -1954,17 +2365,17 @@ # Get attribute y of self lw $t0, 24($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t1, 12($t0) # Get the attribute 'y' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8784369523131 + beq $t6, $t5, int_get_attribute_8753583565692 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8784369523131 - j object_get_attribute_8784369523131 - int_get_attribute_8784369523131: + beq $t6, $t5, bool_get_attribute_8753583565692 + j object_get_attribute_8753583565692 + int_get_attribute_8753583565692: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1973,8 +2384,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 4($sp) # internal_2 = self.y - j end_get_attribute_8784369523131 - bool_get_attribute_8784369523131: + j end_get_attribute_8753583565692 + bool_get_attribute_8753583565692: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1983,10 +2394,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 4($sp) # internal_2 = self.y - j end_get_attribute_8784369523131 - object_get_attribute_8784369523131: - sw $t1, 4($sp) # internal_2 = y - end_get_attribute_8784369523131: + j end_get_attribute_8753583565692 + object_get_attribute_8753583565692: + sw $t1, 4($sp) # internal_2 = self.y + end_get_attribute_8753583565692: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments @@ -2016,11 +2427,11 @@ function_print_at_Complex: # Function parameters - # $ra = 64($sp) - # self = 60($sp) + # $ra = 104($sp) + # self = 100($sp) # Reserving space for local variables - addi $sp, $sp, -60 + addi $sp, $sp, -100 # Allocating Bool 0 li $v0, 9 @@ -2032,21 +2443,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 52($sp) # internal_1 = address of allocated object Int + sw $v0, 92($sp) # internal_1 = address of allocated object Int # Get attribute y of self - lw $t0, 60($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t0, 100($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8784369523981 + beq $t6, $t5, int_get_attribute_8753583565770 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8784369523981 - j object_get_attribute_8784369523981 - int_get_attribute_8784369523981: + beq $t6, $t5, bool_get_attribute_8753583565770 + j object_get_attribute_8753583565770 + int_get_attribute_8753583565770: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2054,9 +2465,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 48($sp) # internal_2 = self.y - j end_get_attribute_8784369523981 - bool_get_attribute_8784369523981: + sw $v0, 88($sp) # internal_2 = self.y + j end_get_attribute_8753583565770 + bool_get_attribute_8753583565770: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2064,11 +2475,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 48($sp) # internal_2 = self.y - j end_get_attribute_8784369523981 - object_get_attribute_8784369523981: - sw $t1, 48($sp) # internal_2 = y - end_get_attribute_8784369523981: + sw $v0, 88($sp) # internal_2 = self.y + j end_get_attribute_8753583565770 + object_get_attribute_8753583565770: + sw $t1, 88($sp) # internal_2 = self.y + end_get_attribute_8753583565770: # Allocating Int 0 li $v0, 9 @@ -2080,54 +2491,54 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_3 = address of allocated object Int + sw $v0, 84($sp) # internal_3 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_2 - lw $t0, 60($sp) + lw $t0, 100($sp) sw $t0, 4($sp) # Storing internal_2 # Argument internal_3 - lw $t0, 56($sp) + lw $t0, 96($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 52($sp) # internal_4 = result of function_equal + sw $v1, 92($sp) # internal_4 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments # internal_1 = internal_4 - lw $t0, 40($sp) - sw $t0, 52($sp) + lw $t0, 80($sp) + sw $t0, 92($sp) - # If internal_1 then goto then_8784369540313 - lw $t0, 52($sp) # Loading the address of the condition + # If internal_1 then goto then_8753583580956 + lw $t0, 92($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8784369540313 + beq $t0, $t1, then_8753583580956 - # Jumping to else_8784369540313 - j else_8784369540313 + # Jumping to else_8753583580956 + j else_8753583580956 - then_8784369540313: + then_8753583580956: # Get attribute x of self - lw $t0, 60($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t0, 100($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8784369524062 + beq $t6, $t5, int_get_attribute_8753583566111 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8784369524062 - j object_get_attribute_8784369524062 - int_get_attribute_8784369524062: + beq $t6, $t5, bool_get_attribute_8753583566111 + j object_get_attribute_8753583566111 + int_get_attribute_8753583566111: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2135,9 +2546,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 36($sp) # internal_5 = self.x - j end_get_attribute_8784369524062 - bool_get_attribute_8784369524062: + sw $v0, 76($sp) # internal_5 = self.x + j end_get_attribute_8753583566111 + bool_get_attribute_8753583566111: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2145,52 +2556,76 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 36($sp) # internal_5 = self.x - j end_get_attribute_8784369524062 - object_get_attribute_8784369524062: - sw $t1, 36($sp) # internal_5 = x - end_get_attribute_8784369524062: + sw $v0, 76($sp) # internal_5 = self.x + j end_get_attribute_8753583566111 + object_get_attribute_8753583566111: + sw $t1, 76($sp) # internal_5 = self.x + end_get_attribute_8753583566111: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_7 = address of allocated object Int + + # Get method out_int of Complex + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 68($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 64($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 72($sp) + lw $t0, 112($sp) sw $t0, 4($sp) # Storing self # Argument internal_5 - lw $t0, 48($sp) + lw $t0, 88($sp) sw $t0, 0($sp) # Storing internal_5 - # Calling function function_out_int_at_IO - jal function_out_int_at_IO + # Calling function internal_8 + lw $t0, 76($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 44($sp) # internal_6 = result of function_out_int_at_IO + sw $v1, 84($sp) # internal_6 = result of internal_8 addi $sp, $sp, 12 # Freeing space for arguments # internal_0 = internal_6 - lw $t0, 32($sp) - sw $t0, 56($sp) + lw $t0, 72($sp) + sw $t0, 96($sp) - # Jumping to endif_8784369540313 - j endif_8784369540313 + # Jumping to endif_8753583580956 + j endif_8753583580956 - else_8784369540313: + else_8753583580956: # Get attribute x of self - lw $t0, 60($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t0, 100($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8784369524155 + beq $t6, $t5, int_get_attribute_8753583566228 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8784369524155 - j object_get_attribute_8784369524155 - int_get_attribute_8784369524155: + beq $t6, $t5, bool_get_attribute_8753583566228 + j object_get_attribute_8753583566228 + int_get_attribute_8753583566228: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2198,9 +2633,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 28($sp) # internal_7 = self.x - j end_get_attribute_8784369524155 - bool_get_attribute_8784369524155: + sw $v0, 60($sp) # internal_9 = self.x + j end_get_attribute_8753583566228 + bool_get_attribute_8753583566228: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2208,28 +2643,52 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 28($sp) # internal_7 = self.x - j end_get_attribute_8784369524155 - object_get_attribute_8784369524155: - sw $t1, 28($sp) # internal_7 = x - end_get_attribute_8784369524155: + sw $v0, 60($sp) # internal_9 = self.x + j end_get_attribute_8753583566228 + object_get_attribute_8753583566228: + sw $t1, 60($sp) # internal_9 = self.x + end_get_attribute_8753583566228: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_11 = address of allocated object Int + + # Get method out_int of Complex + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 52($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 48($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 72($sp) + lw $t0, 112($sp) sw $t0, 4($sp) # Storing self - # Argument internal_7 - lw $t0, 40($sp) - sw $t0, 0($sp) # Storing internal_7 + # Argument internal_9 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_9 - # Calling function function_out_int_at_IO - jal function_out_int_at_IO + # Calling function internal_12 + lw $t0, 60($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 36($sp) # internal_8 = result of function_out_int_at_IO + sw $v1, 68($sp) # internal_10 = result of internal_12 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -2244,43 +2703,67 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 43 - sb $t0, 8($v0) # internal_9[0] = '+' + sb $t0, 8($v0) # internal_13[0] = '+' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 20($sp) # internal_9 = "+" + sw $v0, 44($sp) # internal_13 = "+" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_15 = address of allocated object Int + + # Get method out_string of Complex + lw $t0, 56($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 36($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 32($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_8 - lw $t0, 36($sp) - sw $t0, 4($sp) # Storing internal_8 + # Argument internal_10 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_10 - # Argument internal_9 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_9 + # Argument internal_13 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_13 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_16 + lw $t0, 44($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 28($sp) # internal_10 = result of function_out_string_at_IO + sw $v1, 52($sp) # internal_14 = result of internal_16 addi $sp, $sp, 12 # Freeing space for arguments # Get attribute y of self - lw $t0, 60($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t0, 100($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8784369524203 + beq $t6, $t5, int_get_attribute_8753583566324 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8784369524203 - j object_get_attribute_8784369524203 - int_get_attribute_8784369524203: + beq $t6, $t5, bool_get_attribute_8753583566324 + j object_get_attribute_8753583566324 + int_get_attribute_8753583566324: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2288,9 +2771,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_11 = self.y - j end_get_attribute_8784369524203 - bool_get_attribute_8784369524203: + sw $v0, 28($sp) # internal_17 = self.y + j end_get_attribute_8753583566324 + bool_get_attribute_8753583566324: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2298,28 +2781,52 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_11 = self.y - j end_get_attribute_8784369524203 - object_get_attribute_8784369524203: - sw $t1, 12($sp) # internal_11 = y - end_get_attribute_8784369524203: + sw $v0, 28($sp) # internal_17 = self.y + j end_get_attribute_8753583566324 + object_get_attribute_8753583566324: + sw $t1, 28($sp) # internal_17 = self.y + end_get_attribute_8753583566324: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_19 = address of allocated object Int + + # Get method out_int of Complex + lw $t0, 40($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_10 - lw $t0, 28($sp) - sw $t0, 4($sp) # Storing internal_10 + # Argument internal_14 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_14 - # Argument internal_11 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_11 + # Argument internal_17 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_17 - # Calling function function_out_int_at_IO - jal function_out_int_at_IO + # Calling function internal_20 + lw $t0, 28($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 20($sp) # internal_12 = result of function_out_int_at_IO + sw $v1, 36($sp) # internal_18 = result of internal_20 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -2334,44 +2841,68 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 73 - sb $t0, 8($v0) # internal_13[0] = 'I' + sb $t0, 8($v0) # internal_21[0] = 'I' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_13 = "I" + sw $v0, 12($sp) # internal_21 = "I" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_23 = address of allocated object Int + + # Get method out_string of Complex + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_12 - lw $t0, 20($sp) - sw $t0, 4($sp) # Storing internal_12 + # Argument internal_18 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_18 - # Argument internal_13 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_13 + # Argument internal_21 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_21 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_24 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_14 = result of function_out_string_at_IO + sw $v1, 20($sp) # internal_22 = result of internal_24 addi $sp, $sp, 12 # Freeing space for arguments - # internal_0 = internal_14 - lw $t0, 0($sp) - sw $t0, 56($sp) + # internal_0 = internal_22 + lw $t0, 8($sp) + sw $t0, 96($sp) - # Jumping to endif_8784369540313 - j endif_8784369540313 + # Jumping to endif_8753583580956 + j endif_8753583580956 - endif_8784369540313: + endif_8753583580956: # Loading return value in $v1 - lw $v1, 56($sp) + lw $v1, 96($sp) # Freeing space for local variables - addi $sp, $sp, 60 + addi $sp, $sp, 100 jr $ra @@ -2385,17 +2916,17 @@ # Get attribute x of self lw $t0, 48($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t1, 8($t0) # Get the attribute 'x' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8784369524818 + beq $t6, $t5, int_get_attribute_8753583566731 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8784369524818 - j object_get_attribute_8784369524818 - int_get_attribute_8784369524818: + beq $t6, $t5, bool_get_attribute_8753583566731 + j object_get_attribute_8753583566731 + int_get_attribute_8753583566731: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2404,8 +2935,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 44($sp) # internal_0 = self.x - j end_get_attribute_8784369524818 - bool_get_attribute_8784369524818: + j end_get_attribute_8753583566731 + bool_get_attribute_8753583566731: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2414,24 +2945,24 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 44($sp) # internal_0 = self.x - j end_get_attribute_8784369524818 - object_get_attribute_8784369524818: - sw $t1, 44($sp) # internal_0 = x - end_get_attribute_8784369524818: + j end_get_attribute_8753583566731 + object_get_attribute_8753583566731: + sw $t1, 44($sp) # internal_0 = self.x + end_get_attribute_8753583566731: # Get attribute x of self lw $t0, 48($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t1, 8($t0) # Get the attribute 'x' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8784369524842 + beq $t6, $t5, int_get_attribute_8753583566755 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8784369524842 - j object_get_attribute_8784369524842 - int_get_attribute_8784369524842: + beq $t6, $t5, bool_get_attribute_8753583566755 + j object_get_attribute_8753583566755 + int_get_attribute_8753583566755: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2440,8 +2971,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 40($sp) # internal_1 = self.x - j end_get_attribute_8784369524842 - bool_get_attribute_8784369524842: + j end_get_attribute_8753583566755 + bool_get_attribute_8753583566755: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2450,10 +2981,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 40($sp) # internal_1 = self.x - j end_get_attribute_8784369524842 - object_get_attribute_8784369524842: - sw $t1, 40($sp) # internal_1 = x - end_get_attribute_8784369524842: + j end_get_attribute_8753583566755 + object_get_attribute_8753583566755: + sw $t1, 40($sp) # internal_1 = self.x + end_get_attribute_8753583566755: # Allocating Int 1 li $v0, 9 @@ -2547,17 +3078,17 @@ # Get attribute y of self lw $t0, 48($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t1, 12($t0) # Get the attribute 'y' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8784369524941 + beq $t6, $t5, int_get_attribute_8753583567370 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8784369524941 - j object_get_attribute_8784369524941 - int_get_attribute_8784369524941: + beq $t6, $t5, bool_get_attribute_8753583567370 + j object_get_attribute_8753583567370 + int_get_attribute_8753583567370: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2566,8 +3097,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 20($sp) # internal_6 = self.y - j end_get_attribute_8784369524941 - bool_get_attribute_8784369524941: + j end_get_attribute_8753583567370 + bool_get_attribute_8753583567370: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2576,24 +3107,24 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 20($sp) # internal_6 = self.y - j end_get_attribute_8784369524941 - object_get_attribute_8784369524941: - sw $t1, 20($sp) # internal_6 = y - end_get_attribute_8784369524941: + j end_get_attribute_8753583567370 + object_get_attribute_8753583567370: + sw $t1, 20($sp) # internal_6 = self.y + end_get_attribute_8753583567370: # Get attribute y of self lw $t0, 48($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t1, 12($t0) # Get the attribute 'y' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8784369524965 + beq $t6, $t5, int_get_attribute_8753583567394 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8784369524965 - j object_get_attribute_8784369524965 - int_get_attribute_8784369524965: + beq $t6, $t5, bool_get_attribute_8753583567394 + j object_get_attribute_8753583567394 + int_get_attribute_8753583567394: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2602,8 +3133,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($sp) # internal_7 = self.y - j end_get_attribute_8784369524965 - bool_get_attribute_8784369524965: + j end_get_attribute_8753583567394 + bool_get_attribute_8753583567394: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2612,10 +3143,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($sp) # internal_7 = self.y - j end_get_attribute_8784369524965 - object_get_attribute_8784369524965: - sw $t1, 16($sp) # internal_7 = y - end_get_attribute_8784369524965: + j end_get_attribute_8753583567394 + object_get_attribute_8753583567394: + sw $t1, 16($sp) # internal_7 = self.y + end_get_attribute_8753583567394: # Allocating Int 1 li $v0, 9 @@ -2725,17 +3256,17 @@ # Get attribute y of self lw $t0, 24($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t1, 12($t0) # Get the attribute 'y' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8784369525342 + beq $t6, $t5, int_get_attribute_8753583567511 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8784369525342 - j object_get_attribute_8784369525342 - int_get_attribute_8784369525342: + beq $t6, $t5, bool_get_attribute_8753583567511 + j object_get_attribute_8753583567511 + int_get_attribute_8753583567511: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2744,8 +3275,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 20($sp) # internal_0 = self.y - j end_get_attribute_8784369525342 - bool_get_attribute_8784369525342: + j end_get_attribute_8753583567511 + bool_get_attribute_8753583567511: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2754,24 +3285,24 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 20($sp) # internal_0 = self.y - j end_get_attribute_8784369525342 - object_get_attribute_8784369525342: - sw $t1, 20($sp) # internal_0 = y - end_get_attribute_8784369525342: + j end_get_attribute_8753583567511 + object_get_attribute_8753583567511: + sw $t1, 20($sp) # internal_0 = self.y + end_get_attribute_8753583567511: # Get attribute y of self lw $t0, 24($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t1, 12($t0) # Get the attribute 'y' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8784369525366 + beq $t6, $t5, int_get_attribute_8753583567535 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8784369525366 - j object_get_attribute_8784369525366 - int_get_attribute_8784369525366: + beq $t6, $t5, bool_get_attribute_8753583567535 + j object_get_attribute_8753583567535 + int_get_attribute_8753583567535: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2780,8 +3311,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($sp) # internal_1 = self.y - j end_get_attribute_8784369525366 - bool_get_attribute_8784369525366: + j end_get_attribute_8753583567535 + bool_get_attribute_8753583567535: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2790,10 +3321,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($sp) # internal_1 = self.y - j end_get_attribute_8784369525366 - object_get_attribute_8784369525366: - sw $t1, 16($sp) # internal_1 = y - end_get_attribute_8784369525366: + j end_get_attribute_8753583567535 + object_get_attribute_8753583567535: + sw $t1, 16($sp) # internal_1 = self.y + end_get_attribute_8753583567535: # Allocating Int 1 li $v0, 9 @@ -2903,17 +3434,17 @@ # Get attribute x of self lw $t0, 24($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t1, 8($t0) # Get the attribute 'x' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8784369525483 + beq $t6, $t5, int_get_attribute_8753583568168 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8784369525483 - j object_get_attribute_8784369525483 - int_get_attribute_8784369525483: + beq $t6, $t5, bool_get_attribute_8753583568168 + j object_get_attribute_8753583568168 + int_get_attribute_8753583568168: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2922,8 +3453,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 20($sp) # internal_0 = self.x - j end_get_attribute_8784369525483 - bool_get_attribute_8784369525483: + j end_get_attribute_8753583568168 + bool_get_attribute_8753583568168: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2932,24 +3463,24 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 20($sp) # internal_0 = self.x - j end_get_attribute_8784369525483 - object_get_attribute_8784369525483: - sw $t1, 20($sp) # internal_0 = x - end_get_attribute_8784369525483: + j end_get_attribute_8753583568168 + object_get_attribute_8753583568168: + sw $t1, 20($sp) # internal_0 = self.x + end_get_attribute_8753583568168: # Get attribute x of self lw $t0, 24($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t1, 8($t0) # Get the attribute 'x' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8784369526023 + beq $t6, $t5, int_get_attribute_8753583568192 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8784369526023 - j object_get_attribute_8784369526023 - int_get_attribute_8784369526023: + beq $t6, $t5, bool_get_attribute_8753583568192 + j object_get_attribute_8753583568192 + int_get_attribute_8753583568192: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2958,8 +3489,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($sp) # internal_1 = self.x - j end_get_attribute_8784369526023 - bool_get_attribute_8784369526023: + j end_get_attribute_8753583568192 + bool_get_attribute_8753583568192: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2968,10 +3499,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 16($sp) # internal_1 = self.x - j end_get_attribute_8784369526023 - object_get_attribute_8784369526023: - sw $t1, 16($sp) # internal_1 = x - end_get_attribute_8784369526023: + j end_get_attribute_8753583568192 + object_get_attribute_8753583568192: + sw $t1, 16($sp) # internal_1 = self.x + end_get_attribute_8753583568192: # Allocating Int 1 li $v0, 9 @@ -3073,12 +3604,12 @@ function_equal_at_Complex: # Function parameters - # $ra = 60($sp) - # self = 56($sp) - # d = 52($sp) + # $ra = 76($sp) + # self = 72($sp) + # d = 68($sp) # Reserving space for local variables - addi $sp, $sp, -52 + addi $sp, $sp, -68 # Allocating Bool 0 li $v0, 9 @@ -3090,21 +3621,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_1 = address of allocated object Int + sw $v0, 60($sp) # internal_1 = address of allocated object Int # Get attribute x of self - lw $t0, 56($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t0, 72($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8784369526167 + beq $t6, $t5, int_get_attribute_8753583568336 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8784369526167 - j object_get_attribute_8784369526167 - int_get_attribute_8784369526167: + beq $t6, $t5, bool_get_attribute_8753583568336 + j object_get_attribute_8753583568336 + int_get_attribute_8753583568336: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3112,9 +3643,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 40($sp) # internal_2 = self.x - j end_get_attribute_8784369526167 - bool_get_attribute_8784369526167: + sw $v0, 56($sp) # internal_2 = self.x + j end_get_attribute_8753583568336 + bool_get_attribute_8753583568336: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3122,24 +3653,48 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 40($sp) # internal_2 = self.x - j end_get_attribute_8784369526167 - object_get_attribute_8784369526167: - sw $t1, 40($sp) # internal_2 = x - end_get_attribute_8784369526167: + sw $v0, 56($sp) # internal_2 = self.x + j end_get_attribute_8753583568336 + object_get_attribute_8753583568336: + sw $t1, 56($sp) # internal_2 = self.x + end_get_attribute_8753583568336: + + # Allocating Int 14 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 14 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_4 = address of allocated object Int + + # Get method x_value of Complex + lw $t0, 68($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 48($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 44($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument d - lw $t0, 60($sp) + lw $t0, 76($sp) sw $t0, 0($sp) # Storing d - # Calling function function_x_value_at_Complex - jal function_x_value_at_Complex + # Calling function internal_5 + lw $t0, 52($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 44($sp) # internal_3 = result of function_x_value_at_Complex + sw $v1, 60($sp) # internal_3 = result of internal_5 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments @@ -3147,33 +3702,33 @@ sw $ra, 8($sp) # Storing return address # Argument internal_2 - lw $t0, 52($sp) + lw $t0, 68($sp) sw $t0, 4($sp) # Storing internal_2 # Argument internal_3 - lw $t0, 48($sp) + lw $t0, 64($sp) sw $t0, 0($sp) # Storing internal_3 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 44($sp) # internal_4 = result of function_equal + sw $v1, 52($sp) # internal_6 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_1 = internal_4 - lw $t0, 32($sp) - sw $t0, 44($sp) + # internal_1 = internal_6 + lw $t0, 40($sp) + sw $t0, 60($sp) - # If internal_1 then goto then_8784369541560 - lw $t0, 44($sp) # Loading the address of the condition + # If internal_1 then goto then_8753583581175 + lw $t0, 60($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8784369541560 + beq $t0, $t1, then_8753583581175 - # Jumping to else_8784369541560 - j else_8784369541560 + # Jumping to else_8753583581175 + j else_8753583581175 - then_8784369541560: + then_8753583581175: # Allocating Bool 0 li $v0, 9 @@ -3185,21 +3740,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_6 = address of allocated object Int + sw $v0, 32($sp) # internal_8 = address of allocated object Int # Get attribute y of self - lw $t0, 56($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t0, 72($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8784369526547 + beq $t6, $t5, int_get_attribute_8753583568740 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8784369526547 - j object_get_attribute_8784369526547 - int_get_attribute_8784369526547: + beq $t6, $t5, bool_get_attribute_8753583568740 + j object_get_attribute_8753583568740 + int_get_attribute_8753583568740: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3207,9 +3762,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 20($sp) # internal_7 = self.y - j end_get_attribute_8784369526547 - bool_get_attribute_8784369526547: + sw $v0, 28($sp) # internal_9 = self.y + j end_get_attribute_8753583568740 + bool_get_attribute_8753583568740: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3217,58 +3772,82 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 20($sp) # internal_7 = self.y - j end_get_attribute_8784369526547 - object_get_attribute_8784369526547: - sw $t1, 20($sp) # internal_7 = y - end_get_attribute_8784369526547: + sw $v0, 28($sp) # internal_9 = self.y + j end_get_attribute_8753583568740 + object_get_attribute_8753583568740: + sw $t1, 28($sp) # internal_9 = self.y + end_get_attribute_8753583568740: + + # Allocating Int 15 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 15 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_11 = address of allocated object Int + + # Get method y_value of Complex + lw $t0, 68($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument d - lw $t0, 60($sp) + lw $t0, 76($sp) sw $t0, 0($sp) # Storing d - # Calling function function_y_value_at_Complex - jal function_y_value_at_Complex + # Calling function internal_12 + lw $t0, 24($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 24($sp) # internal_8 = result of function_y_value_at_Complex + sw $v1, 32($sp) # internal_10 = result of internal_12 addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_7 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_7 + # Argument internal_9 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_9 - # Argument internal_8 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_8 + # Argument internal_10 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_10 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 24($sp) # internal_9 = result of function_equal + sw $v1, 24($sp) # internal_13 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_6 = internal_9 + # internal_8 = internal_13 lw $t0, 12($sp) - sw $t0, 24($sp) + sw $t0, 32($sp) - # If internal_6 then goto then_8784369541548 - lw $t0, 24($sp) # Loading the address of the condition + # If internal_8 then goto then_8753583581163 + lw $t0, 32($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8784369541548 + beq $t0, $t1, then_8753583581163 - # Jumping to else_8784369541548 - j else_8784369541548 + # Jumping to else_8753583581163 + j else_8753583581163 - then_8784369541548: + then_8753583581163: # Allocating Bool 1 li $v0, 9 @@ -3280,16 +3859,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_10 = address of allocated object Int + sw $v0, 8($sp) # internal_14 = address of allocated object Int - # internal_5 = internal_10 + # internal_7 = internal_14 lw $t0, 8($sp) - sw $t0, 28($sp) + sw $t0, 36($sp) - # Jumping to endif_8784369541548 - j endif_8784369541548 + # Jumping to endif_8753583581163 + j endif_8753583581163 - else_8784369541548: + else_8753583581163: # Allocating Bool 0 li $v0, 9 @@ -3301,25 +3880,25 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 4($sp) # internal_11 = address of allocated object Int + sw $v0, 4($sp) # internal_15 = address of allocated object Int - # internal_5 = internal_11 + # internal_7 = internal_15 lw $t0, 4($sp) - sw $t0, 28($sp) + sw $t0, 36($sp) - # Jumping to endif_8784369541548 - j endif_8784369541548 + # Jumping to endif_8753583581163 + j endif_8753583581163 - endif_8784369541548: + endif_8753583581163: - # internal_0 = internal_5 - lw $t0, 28($sp) - sw $t0, 48($sp) + # internal_0 = internal_7 + lw $t0, 36($sp) + sw $t0, 64($sp) - # Jumping to endif_8784369541560 - j endif_8784369541560 + # Jumping to endif_8753583581175 + j endif_8753583581175 - else_8784369541560: + else_8753583581175: # Allocating Bool 0 li $v0, 9 @@ -3331,22 +3910,22 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_12 = address of allocated object Int + sw $v0, 0($sp) # internal_16 = address of allocated object Int - # internal_0 = internal_12 + # internal_0 = internal_16 lw $t0, 0($sp) - sw $t0, 48($sp) + sw $t0, 64($sp) - # Jumping to endif_8784369541560 - j endif_8784369541560 + # Jumping to endif_8753583581175 + j endif_8753583581175 - endif_8784369541560: + endif_8753583581175: # Loading return value in $v1 - lw $v1, 48($sp) + lw $v1, 64($sp) # Freeing space for local variables - addi $sp, $sp, 52 + addi $sp, $sp, 68 jr $ra @@ -3360,17 +3939,17 @@ # Get attribute x of self lw $t0, 4($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'x' from the instance + lw $t1, 8($t0) # Get the attribute 'x' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8784369526733 + beq $t6, $t5, int_get_attribute_8753583569210 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8784369526733 - j object_get_attribute_8784369526733 - int_get_attribute_8784369526733: + beq $t6, $t5, bool_get_attribute_8753583569210 + j object_get_attribute_8753583569210 + int_get_attribute_8753583569210: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3379,8 +3958,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 0($sp) # internal_0 = self.x - j end_get_attribute_8784369526733 - bool_get_attribute_8784369526733: + j end_get_attribute_8753583569210 + bool_get_attribute_8753583569210: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3389,10 +3968,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 0($sp) # internal_0 = self.x - j end_get_attribute_8784369526733 - object_get_attribute_8784369526733: - sw $t1, 0($sp) # internal_0 = x - end_get_attribute_8784369526733: + j end_get_attribute_8753583569210 + object_get_attribute_8753583569210: + sw $t1, 0($sp) # internal_0 = self.x + end_get_attribute_8753583569210: # Loading return value in $v1 lw $v1, 0($sp) @@ -3412,17 +3991,17 @@ # Get attribute y of self lw $t0, 4($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'y' from the instance + lw $t1, 12($t0) # Get the attribute 'y' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8784369526763 + beq $t6, $t5, int_get_attribute_8753583569240 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8784369526763 - j object_get_attribute_8784369526763 - int_get_attribute_8784369526763: + beq $t6, $t5, bool_get_attribute_8753583569240 + j object_get_attribute_8753583569240 + int_get_attribute_8753583569240: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3431,8 +4010,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 0($sp) # internal_0 = self.y - j end_get_attribute_8784369526763 - bool_get_attribute_8784369526763: + j end_get_attribute_8753583569240 + bool_get_attribute_8753583569240: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3441,10 +4020,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 0($sp) # internal_0 = self.y - j end_get_attribute_8784369526763 - object_get_attribute_8784369526763: - sw $t1, 0($sp) # internal_0 = y - end_get_attribute_8784369526763: + j end_get_attribute_8753583569240 + object_get_attribute_8753583569240: + sw $t1, 0($sp) # internal_0 = self.y + end_get_attribute_8753583569240: # Loading return value in $v1 lw $v1, 0($sp) @@ -3456,7 +4035,7 @@ main: # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Allocating Main li $v0, 9 @@ -3465,34 +4044,58 @@ la $t0, type_Main # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object Main + sw $v0, 12($sp) # internal_0 = address of allocated object Main # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_Main jal function___init___at_Main lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_main_at_Main - jal function_main_at_Main + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + sw $v1, 16($sp) # internal_1 = result of internal_3 addi $sp, $sp, 8 # Freeing space for arguments # Exit program diff --git a/tests/codegen/palindrome.mips b/tests/codegen/palindrome.mips index 02d914a4d..7dae1e29d 100644 --- a/tests/codegen/palindrome.mips +++ b/tests/codegen/palindrome.mips @@ -1,45 +1,82 @@ .data - type_Object: .word 8 + type_Object: .word 24 type_Object_inherits_from: .word 0 - type_Object_attributes: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_Main: .word 52 + type_Main_inherits_from: .word type_IO + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_out_string: .word function_out_string_at_IO + type_Main_out_int: .word function_out_int_at_IO + type_Main_in_string: .word function_in_string_at_IO + type_Main_in_int: .word function_in_int_at_IO + type_Main_pal: .word function_pal_at_Main + type_Main_main: .word function_main_at_Main + type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" - type_Object_abort_message: .asciiz "Abort called from class Object\n" - type_IO: .word 8 - type_IO_inherits_from: .word type_Object - type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" - type_IO_abort_message: .asciiz "Abort called from class IO\n" - type_Int: .word 8 - type_Int_inherits_from: .word type_Object - type_Int_attributes: .word 0 - type_Int_name_size: .word 3 - type_Int_name: .asciiz "Int" - type_Int_abort_message: .asciiz "Abort called from class Int\n" - - type_String: .word 8 - type_String_inherits_from: .word type_Object - type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" - type_String_abort_message: .asciiz "Abort called from class String\n" - type_Bool: .word 8 - type_Bool_inherits_from: .word type_Object - type_Bool_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" - type_Bool_abort_message: .asciiz "Abort called from class Bool\n" - type_Main: .word 12 - type_Main_inherits_from: .word type_IO - type_Main_attributes: .word 1 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" - type_Main_abort_message: .asciiz "Abort called from class Main\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -700,11 +737,11 @@ function_abort_at_Object: # Function parameters - # $ra = 20($sp) - # self = 16($sp) + # $ra = 28($sp) + # self = 24($sp) # Reserving space for local variables - addi $sp, $sp, -16 + addi $sp, $sp, -24 # Allocating String li $v0, 9 @@ -791,7 +828,7 @@ sb $zero, 32($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_0 = "Abort called from class " + sw $v0, 20($sp) # internal_0 = "Abort called from class " # Allocating String li $v0, 9 @@ -805,66 +842,138 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_2[0] = '\n' + sb $t0, 8($v0) # internal_3[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_2 = "\n" + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 0($sp) # Storing self - # Calling function function_type_name_at_Object - jal function_type_name_at_Object + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + sw $v1, 24($sp) # internal_1 = result of internal_5 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_0 - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing internal_0 # Argument internal_1 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_1 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_3 - lw $t0, 12($sp) - sw $t0, 4($sp) # Storing internal_3 - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 - # Calling function function_concat_at_String - jal function_concat_at_String + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) # $t0 = internal_3 + lw $t0, 12($sp) # $t0 = internal_2 addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string internal_3 + # Printing the String internal_2 li $v0, 4 move $a0, $t0 syscall @@ -874,10 +983,10 @@ syscall # Loading return value in $v1 - lw $v1, 16($sp) + lw $v1, 24($sp) # Freeing space for local variables - addi $sp, $sp, 16 + addi $sp, $sp, 24 jr $ra @@ -892,8 +1001,9 @@ # internal_0 = name of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($t0) # $t1 = type of self - lw $t2, 12($t1) # $t1 = length of the name of self - la $t3, 16($t1) # $t1 = name of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 @@ -996,7 +1106,7 @@ lw $t0, 0($sp) # $t0 = x addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string x + # Printing the String x li $v0, 4 move $a0, $t0 syscall @@ -1012,7 +1122,7 @@ # self = 4($sp) # x = 0($sp) - # Printing the string x + # Printing the Int x li $v0, 1 lw $a0, 0($sp) lw $a0, 8($a0) @@ -1039,11 +1149,13 @@ xor $t0, $t0, $t0 # Initializing counter while_read_start: lb $t1, buffer_input($t0) # Loading the byte - beq $t1, $zero, while_read_end + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end addi $t0, $t0, 1 # Incrementing counter j while_read_start while_read_end: - addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 @@ -1290,6 +1402,26 @@ jr $ra + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + function___init___at_Main: # Function parameters # $ra = 8($sp) @@ -1313,17 +1445,17 @@ # Set attribute i of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8763703739865 + beq $t1, $zero, object_set_attribute_8768235507348 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8763703739865 + beq $t6, $t5, int_set_attribute_8768235507348 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8763703739865 - j object_set_attribute_8763703739865 - int_set_attribute_8763703739865: + beq $t6, $t5, bool_set_attribute_8768235507348 + j object_set_attribute_8768235507348 + int_set_attribute_8768235507348: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1332,8 +1464,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.i = internal_0 - j end_set_attribute_8763703739865 - bool_set_attribute_8763703739865: + j end_set_attribute_8768235507348 + bool_set_attribute_8768235507348: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1342,10 +1474,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.i = internal_0 - j end_set_attribute_8763703739865 - object_set_attribute_8763703739865: + j end_set_attribute_8768235507348 + object_set_attribute_8768235507348: sw $t1, 8($t0) # self.i = internal_0 - end_set_attribute_8763703739865: + end_set_attribute_8768235507348: # Loading return value in $v1 lw $v1, 4($sp) @@ -1357,12 +1489,12 @@ function_pal_at_Main: # Function parameters - # $ra = 128($sp) - # self = 124($sp) - # s = 120($sp) + # $ra = 192($sp) + # self = 188($sp) + # s = 184($sp) # Reserving space for local variables - addi $sp, $sp, -120 + addi $sp, $sp, -184 # Allocating Bool 0 li $v0, 9 @@ -1374,20 +1506,44 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 112($sp) # internal_1 = address of allocated object Int + sw $v0, 176($sp) # internal_1 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 168($sp) # internal_3 = address of allocated object Int + + # Get method length of String + lw $t0, 184($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 168($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 164($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument s - lw $t0, 128($sp) + lw $t0, 192($sp) sw $t0, 0($sp) # Storing s - # Calling function function_length_at_String - jal function_length_at_String + # Calling function internal_4 + lw $t0, 172($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 116($sp) # internal_2 = result of function_length_at_String + sw $v1, 180($sp) # internal_2 = result of internal_4 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 0 @@ -1400,40 +1556,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 104($sp) # internal_3 = address of allocated object Int + sw $v0, 160($sp) # internal_5 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_2 - lw $t0, 120($sp) + lw $t0, 184($sp) sw $t0, 4($sp) # Storing internal_2 - # Argument internal_3 - lw $t0, 116($sp) - sw $t0, 0($sp) # Storing internal_3 + # Argument internal_5 + lw $t0, 172($sp) + sw $t0, 0($sp) # Storing internal_5 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 112($sp) # internal_4 = result of function_equal + sw $v1, 168($sp) # internal_6 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_1 = internal_4 - lw $t0, 100($sp) - sw $t0, 112($sp) + # internal_1 = internal_6 + lw $t0, 156($sp) + sw $t0, 176($sp) - # If internal_1 then goto then_8763703753186 - lw $t0, 112($sp) # Loading the address of the condition + # If internal_1 then goto then_8768235527467 + lw $t0, 176($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8763703753186 + beq $t0, $t1, then_8768235527467 - # Jumping to else_8763703753186 - j else_8763703753186 + # Jumping to else_8768235527467 + j else_8768235527467 - then_8763703753186: + then_8768235527467: # Allocating Bool 1 li $v0, 9 @@ -1445,16 +1601,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 96($sp) # internal_5 = address of allocated object Int + sw $v0, 152($sp) # internal_7 = address of allocated object Int - # internal_0 = internal_5 - lw $t0, 96($sp) - sw $t0, 116($sp) + # internal_0 = internal_7 + lw $t0, 152($sp) + sw $t0, 180($sp) - # Jumping to endif_8763703753186 - j endif_8763703753186 + # Jumping to endif_8768235527467 + j endif_8768235527467 - else_8763703753186: + else_8768235527467: # Allocating Bool 0 li $v0, 9 @@ -1466,20 +1622,44 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 88($sp) # internal_7 = address of allocated object Int + sw $v0, 144($sp) # internal_9 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_11 = address of allocated object Int + + # Get method length of String + lw $t0, 184($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 136($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 132($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument s - lw $t0, 128($sp) + lw $t0, 192($sp) sw $t0, 0($sp) # Storing s - # Calling function function_length_at_String - jal function_length_at_String + # Calling function internal_12 + lw $t0, 140($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 92($sp) # internal_8 = result of function_length_at_String + sw $v1, 148($sp) # internal_10 = result of internal_12 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 1 @@ -1492,40 +1672,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 80($sp) # internal_9 = address of allocated object Int + sw $v0, 128($sp) # internal_13 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_8 - lw $t0, 96($sp) - sw $t0, 4($sp) # Storing internal_8 + # Argument internal_10 + lw $t0, 152($sp) + sw $t0, 4($sp) # Storing internal_10 - # Argument internal_9 - lw $t0, 92($sp) - sw $t0, 0($sp) # Storing internal_9 + # Argument internal_13 + lw $t0, 140($sp) + sw $t0, 0($sp) # Storing internal_13 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 88($sp) # internal_10 = result of function_equal + sw $v1, 136($sp) # internal_14 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_7 = internal_10 - lw $t0, 76($sp) - sw $t0, 88($sp) + # internal_9 = internal_14 + lw $t0, 124($sp) + sw $t0, 144($sp) - # If internal_7 then goto then_8763703753168 - lw $t0, 88($sp) # Loading the address of the condition + # If internal_9 then goto then_8768235527449 + lw $t0, 144($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8763703753168 + beq $t0, $t1, then_8768235527449 - # Jumping to else_8763703753168 - j else_8763703753168 + # Jumping to else_8768235527449 + j else_8768235527449 - then_8763703753168: + then_8768235527449: # Allocating Bool 1 li $v0, 9 @@ -1537,16 +1717,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 72($sp) # internal_11 = address of allocated object Int + sw $v0, 120($sp) # internal_15 = address of allocated object Int - # internal_6 = internal_11 - lw $t0, 72($sp) - sw $t0, 92($sp) + # internal_8 = internal_15 + lw $t0, 120($sp) + sw $t0, 148($sp) - # Jumping to endif_8763703753168 - j endif_8763703753168 + # Jumping to endif_8768235527449 + j endif_8768235527449 - else_8763703753168: + else_8768235527449: # Allocating Bool 0 li $v0, 9 @@ -1558,7 +1738,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 64($sp) # internal_13 = address of allocated object Int + sw $v0, 112($sp) # internal_17 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -1570,7 +1750,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 60($sp) # internal_14 = address of allocated object Int + sw $v0, 108($sp) # internal_18 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -1582,42 +1762,90 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 56($sp) # internal_15 = address of allocated object Int + sw $v0, 104($sp) # internal_19 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_21 = address of allocated object Int + + # Get method substr of String + lw $t0, 184($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 96($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 92($sp) # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument s - lw $t0, 136($sp) + lw $t0, 200($sp) sw $t0, 8($sp) # Storing s - # Argument internal_14 - lw $t0, 76($sp) - sw $t0, 4($sp) # Storing internal_14 + # Argument internal_18 + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing internal_18 - # Argument internal_15 - lw $t0, 72($sp) - sw $t0, 0($sp) # Storing internal_15 + # Argument internal_19 + lw $t0, 120($sp) + sw $t0, 0($sp) # Storing internal_19 - # Calling function function_substr_at_String - jal function_substr_at_String + # Calling function internal_22 + lw $t0, 108($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 68($sp) # internal_16 = result of function_substr_at_String + sw $v1, 116($sp) # internal_20 = result of internal_22 addi $sp, $sp, 16 # Freeing space for arguments + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_24 = address of allocated object Int + + # Get method length of String + lw $t0, 184($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 84($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 80($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument s - lw $t0, 128($sp) + lw $t0, 192($sp) sw $t0, 0($sp) # Storing s - # Calling function function_length_at_String - jal function_length_at_String + # Calling function internal_25 + lw $t0, 88($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 56($sp) # internal_17 = result of function_length_at_String + sw $v1, 96($sp) # internal_23 = result of internal_25 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 1 @@ -1630,24 +1858,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_18 = address of allocated object Int + sw $v0, 76($sp) # internal_26 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_17 - lw $t0, 60($sp) - sw $t0, 4($sp) # Storing internal_17 + # Argument internal_23 + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing internal_23 - # Argument internal_18 - lw $t0, 56($sp) - sw $t0, 0($sp) # Storing internal_18 + # Argument internal_26 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_26 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 52($sp) # internal_19 = result of function_sub + sw $v1, 84($sp) # internal_27 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 1 @@ -1660,62 +1888,86 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_20 = address of allocated object Int + sw $v0, 68($sp) # internal_28 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_30 = address of allocated object Int + + # Get method substr of String + lw $t0, 184($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 60($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 56($sp) # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument s - lw $t0, 136($sp) + lw $t0, 200($sp) sw $t0, 8($sp) # Storing s - # Argument internal_19 - lw $t0, 56($sp) - sw $t0, 4($sp) # Storing internal_19 + # Argument internal_27 + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing internal_27 - # Argument internal_20 - lw $t0, 52($sp) - sw $t0, 0($sp) # Storing internal_20 + # Argument internal_28 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_28 - # Calling function function_substr_at_String - jal function_substr_at_String + # Calling function internal_31 + lw $t0, 72($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 48($sp) # internal_21 = result of function_substr_at_String + sw $v1, 80($sp) # internal_29 = result of internal_31 addi $sp, $sp, 16 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_16 - lw $t0, 64($sp) - sw $t0, 4($sp) # Storing internal_16 + # Argument internal_20 + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing internal_20 - # Argument internal_21 - lw $t0, 44($sp) - sw $t0, 0($sp) # Storing internal_21 + # Argument internal_29 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_29 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 40($sp) # internal_22 = result of function_equal + sw $v1, 64($sp) # internal_32 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_13 = internal_22 - lw $t0, 28($sp) - sw $t0, 64($sp) + # internal_17 = internal_32 + lw $t0, 52($sp) + sw $t0, 112($sp) - # If internal_13 then goto then_8763703753171 - lw $t0, 64($sp) # Loading the address of the condition + # If internal_17 then goto then_8768235527452 + lw $t0, 112($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8763703753171 + beq $t0, $t1, then_8768235527452 - # Jumping to else_8763703753171 - j else_8763703753171 + # Jumping to else_8768235527452 + j else_8768235527452 - then_8763703753171: + then_8768235527452: # Allocating Int 1 li $v0, 9 @@ -1727,20 +1979,44 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_23 = address of allocated object Int + sw $v0, 48($sp) # internal_33 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_35 = address of allocated object Int + + # Get method length of String + lw $t0, 184($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 40($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 36($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument s - lw $t0, 128($sp) + lw $t0, 192($sp) sw $t0, 0($sp) # Storing s - # Calling function function_length_at_String - jal function_length_at_String + # Calling function internal_36 + lw $t0, 44($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 28($sp) # internal_24 = result of function_length_at_String + sw $v1, 52($sp) # internal_34 = result of internal_36 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 2 @@ -1753,74 +2029,122 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_25 = address of allocated object Int + sw $v0, 32($sp) # internal_37 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_24 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_24 + # Argument internal_34 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_34 - # Argument internal_25 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_25 + # Argument internal_37 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_37 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 24($sp) # internal_26 = result of function_sub + sw $v1, 40($sp) # internal_38 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_40 = address of allocated object Int + + # Get method substr of String + lw $t0, 184($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument s - lw $t0, 136($sp) + lw $t0, 200($sp) sw $t0, 8($sp) # Storing s - # Argument internal_23 - lw $t0, 40($sp) - sw $t0, 4($sp) # Storing internal_23 + # Argument internal_33 + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing internal_33 - # Argument internal_26 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_26 + # Argument internal_38 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_38 - # Calling function function_substr_at_String - jal function_substr_at_String + # Calling function internal_41 + lw $t0, 32($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 24($sp) # internal_27 = result of function_substr_at_String + sw $v1, 40($sp) # internal_39 = result of internal_41 addi $sp, $sp, 16 # Freeing space for arguments + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_43 = address of allocated object Int + + # Get method pal of Main + lw $t0, 188($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 136($sp) + lw $t0, 200($sp) sw $t0, 4($sp) # Storing self - # Argument internal_27 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_27 + # Argument internal_39 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_39 - # Calling function function_pal_at_Main - jal function_pal_at_Main + # Calling function internal_44 + lw $t0, 16($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 16($sp) # internal_28 = result of function_pal_at_Main + sw $v1, 24($sp) # internal_42 = result of internal_44 addi $sp, $sp, 12 # Freeing space for arguments - # internal_12 = internal_28 - lw $t0, 4($sp) - sw $t0, 68($sp) + # internal_16 = internal_42 + lw $t0, 12($sp) + sw $t0, 116($sp) - # Jumping to endif_8763703753171 - j endif_8763703753171 + # Jumping to endif_8768235527452 + j endif_8768235527452 - else_8763703753171: + else_8768235527452: # Allocating Bool 0 li $v0, 9 @@ -1832,50 +2156,50 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_29 = address of allocated object Int + sw $v0, 0($sp) # internal_45 = address of allocated object Int - # internal_12 = internal_29 + # internal_16 = internal_45 lw $t0, 0($sp) - sw $t0, 68($sp) + sw $t0, 116($sp) - # Jumping to endif_8763703753171 - j endif_8763703753171 + # Jumping to endif_8768235527452 + j endif_8768235527452 - endif_8763703753171: + endif_8768235527452: - # internal_6 = internal_12 - lw $t0, 68($sp) - sw $t0, 92($sp) + # internal_8 = internal_16 + lw $t0, 116($sp) + sw $t0, 148($sp) - # Jumping to endif_8763703753168 - j endif_8763703753168 + # Jumping to endif_8768235527449 + j endif_8768235527449 - endif_8763703753168: + endif_8768235527449: - # internal_0 = internal_6 - lw $t0, 92($sp) - sw $t0, 116($sp) + # internal_0 = internal_8 + lw $t0, 148($sp) + sw $t0, 180($sp) - # Jumping to endif_8763703753186 - j endif_8763703753186 + # Jumping to endif_8768235527467 + j endif_8768235527467 - endif_8763703753186: + endif_8768235527467: # Loading return value in $v1 - lw $v1, 116($sp) + lw $v1, 180($sp) # Freeing space for local variables - addi $sp, $sp, 120 + addi $sp, $sp, 184 jr $ra function_main_at_Main: # Function parameters - # $ra = 60($sp) - # self = 56($sp) + # $ra = 100($sp) + # self = 96($sp) # Reserving space for local variables - addi $sp, $sp, -56 + addi $sp, $sp, -96 # Allocating Int 1 li $v0, 9 @@ -1887,7 +2211,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 52($sp) # internal_0 = address of allocated object Int + sw $v0, 92($sp) # internal_0 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -1899,7 +2223,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_1 = address of allocated object Int + sw $v0, 88($sp) # internal_1 = address of allocated object Int # Allocating Int 4294967295 li $v0, 9 @@ -1911,7 +2235,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4294967295 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_2 = address of allocated object Int + sw $v0, 84($sp) # internal_2 = address of allocated object Int # Allocating Int 0 li $v0, 9 @@ -1923,24 +2247,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 40($sp) # internal_3 = address of allocated object Int + sw $v0, 80($sp) # internal_3 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_0 - lw $t0, 64($sp) + lw $t0, 104($sp) sw $t0, 4($sp) # Storing internal_0 # Argument internal_2 - lw $t0, 56($sp) + lw $t0, 96($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_xor jal function_xor lw $ra, 8($sp) - sw $v1, 52($sp) # internal_3 = result of function_xor + sw $v1, 92($sp) # internal_3 = result of function_xor addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -1948,33 +2272,33 @@ sw $ra, 8($sp) # Storing return address # Argument internal_3 - lw $t0, 52($sp) + lw $t0, 92($sp) sw $t0, 4($sp) # Storing internal_3 # Argument internal_1 - lw $t0, 60($sp) + lw $t0, 100($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 52($sp) # internal_3 = result of function_add + sw $v1, 92($sp) # internal_3 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Set attribute i of self - lw $t0, 56($sp) # $t0 = self - lw $t1, 40($sp) # $t1 = internal_3 - beq $t1, $zero, object_set_attribute_8763703710714 + lw $t0, 96($sp) # $t0 = self + lw $t1, 80($sp) # $t1 = internal_3 + beq $t1, $zero, object_set_attribute_8768235510655 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8763703710714 + beq $t6, $t5, int_set_attribute_8768235510655 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8763703710714 - j object_set_attribute_8763703710714 - int_set_attribute_8763703710714: + beq $t6, $t5, bool_set_attribute_8768235510655 + j object_set_attribute_8768235510655 + int_set_attribute_8768235510655: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1983,8 +2307,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.i = internal_3 - j end_set_attribute_8763703710714 - bool_set_attribute_8763703710714: + j end_set_attribute_8768235510655 + bool_set_attribute_8768235510655: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1993,10 +2317,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.i = internal_3 - j end_set_attribute_8763703710714 - object_set_attribute_8763703710714: + j end_set_attribute_8768235510655 + object_set_attribute_8768235510655: sw $t1, 8($t0) # self.i = internal_3 - end_set_attribute_8763703710714: + end_set_attribute_8768235510655: # Allocating String li $v0, 9 @@ -2056,24 +2380,48 @@ sb $zero, 23($v0) # Null-terminator at the end of the string - sw $v0, 36($sp) # internal_4 = "enter a string\n" + sw $v0, 76($sp) # internal_4 = "enter a string\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_6 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 96($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 68($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 64($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 68($sp) + lw $t0, 108($sp) sw $t0, 4($sp) # Storing self # Argument internal_4 - lw $t0, 48($sp) + lw $t0, 88($sp) sw $t0, 0($sp) # Storing internal_4 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_7 + lw $t0, 76($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 44($sp) # internal_5 = result of function_out_string_at_IO + sw $v1, 84($sp) # internal_5 = result of internal_7 addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bool 0 @@ -2086,54 +2434,102 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_7 = address of allocated object Int + sw $v0, 56($sp) # internal_9 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_11 = address of allocated object Int + + # Get method in_string of Main + lw $t0, 96($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 48($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 44($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 64($sp) + lw $t0, 104($sp) sw $t0, 0($sp) # Storing self - # Calling function function_in_string_at_IO - jal function_in_string_at_IO + # Calling function internal_12 + lw $t0, 52($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 28($sp) # internal_8 = result of function_in_string_at_IO + sw $v1, 60($sp) # internal_10 = result of internal_12 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_14 = address of allocated object Int + + # Get method pal of Main + lw $t0, 96($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 36($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 32($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 68($sp) + lw $t0, 108($sp) sw $t0, 4($sp) # Storing self - # Argument internal_8 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_8 + # Argument internal_10 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_10 - # Calling function function_pal_at_Main - jal function_pal_at_Main + # Calling function internal_15 + lw $t0, 44($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 28($sp) # internal_9 = result of function_pal_at_Main + sw $v1, 52($sp) # internal_13 = result of internal_15 addi $sp, $sp, 12 # Freeing space for arguments - # internal_7 = internal_9 - lw $t0, 16($sp) - sw $t0, 24($sp) + # internal_9 = internal_13 + lw $t0, 40($sp) + sw $t0, 56($sp) - # If internal_7 then goto then_8763703729448 - lw $t0, 24($sp) # Loading the address of the condition + # If internal_9 then goto then_8768235527533 + lw $t0, 56($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8763703729448 + beq $t0, $t1, then_8768235527533 - # Jumping to else_8763703729448 - j else_8763703729448 + # Jumping to else_8768235527533 + j else_8768235527533 - then_8763703729448: + then_8768235527533: # Allocating String li $v0, 9 @@ -2147,101 +2543,125 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 116 - sb $t0, 8($v0) # internal_10[0] = 't' + sb $t0, 8($v0) # internal_16[0] = 't' addi $t0, $zero, 104 - sb $t0, 9($v0) # internal_10[1] = 'h' + sb $t0, 9($v0) # internal_16[1] = 'h' addi $t0, $zero, 97 - sb $t0, 10($v0) # internal_10[2] = 'a' + sb $t0, 10($v0) # internal_16[2] = 'a' addi $t0, $zero, 116 - sb $t0, 11($v0) # internal_10[3] = 't' + sb $t0, 11($v0) # internal_16[3] = 't' addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_10[4] = ' ' + sb $t0, 12($v0) # internal_16[4] = ' ' addi $t0, $zero, 119 - sb $t0, 13($v0) # internal_10[5] = 'w' + sb $t0, 13($v0) # internal_16[5] = 'w' addi $t0, $zero, 97 - sb $t0, 14($v0) # internal_10[6] = 'a' + sb $t0, 14($v0) # internal_16[6] = 'a' addi $t0, $zero, 115 - sb $t0, 15($v0) # internal_10[7] = 's' + sb $t0, 15($v0) # internal_16[7] = 's' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_10[8] = ' ' + sb $t0, 16($v0) # internal_16[8] = ' ' addi $t0, $zero, 97 - sb $t0, 17($v0) # internal_10[9] = 'a' + sb $t0, 17($v0) # internal_16[9] = 'a' addi $t0, $zero, 32 - sb $t0, 18($v0) # internal_10[10] = ' ' + sb $t0, 18($v0) # internal_16[10] = ' ' addi $t0, $zero, 112 - sb $t0, 19($v0) # internal_10[11] = 'p' + sb $t0, 19($v0) # internal_16[11] = 'p' addi $t0, $zero, 97 - sb $t0, 20($v0) # internal_10[12] = 'a' + sb $t0, 20($v0) # internal_16[12] = 'a' addi $t0, $zero, 108 - sb $t0, 21($v0) # internal_10[13] = 'l' + sb $t0, 21($v0) # internal_16[13] = 'l' addi $t0, $zero, 105 - sb $t0, 22($v0) # internal_10[14] = 'i' + sb $t0, 22($v0) # internal_16[14] = 'i' addi $t0, $zero, 110 - sb $t0, 23($v0) # internal_10[15] = 'n' + sb $t0, 23($v0) # internal_16[15] = 'n' addi $t0, $zero, 100 - sb $t0, 24($v0) # internal_10[16] = 'd' + sb $t0, 24($v0) # internal_16[16] = 'd' addi $t0, $zero, 114 - sb $t0, 25($v0) # internal_10[17] = 'r' + sb $t0, 25($v0) # internal_16[17] = 'r' addi $t0, $zero, 111 - sb $t0, 26($v0) # internal_10[18] = 'o' + sb $t0, 26($v0) # internal_16[18] = 'o' addi $t0, $zero, 109 - sb $t0, 27($v0) # internal_10[19] = 'm' + sb $t0, 27($v0) # internal_16[19] = 'm' addi $t0, $zero, 101 - sb $t0, 28($v0) # internal_10[20] = 'e' + sb $t0, 28($v0) # internal_16[20] = 'e' addi $t0, $zero, 10 - sb $t0, 29($v0) # internal_10[21] = '\n' + sb $t0, 29($v0) # internal_16[21] = '\n' sb $zero, 30($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_10 = "that was a palindrome\n" + sw $v0, 28($sp) # internal_16 = "that was a palindrome\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_18 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 96($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 68($sp) + lw $t0, 108($sp) sw $t0, 4($sp) # Storing self - # Argument internal_10 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_10 + # Argument internal_16 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_16 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_19 + lw $t0, 28($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 20($sp) # internal_11 = result of function_out_string_at_IO + sw $v1, 36($sp) # internal_17 = result of internal_19 addi $sp, $sp, 12 # Freeing space for arguments - # internal_6 = internal_11 - lw $t0, 8($sp) - sw $t0, 28($sp) + # internal_8 = internal_17 + lw $t0, 24($sp) + sw $t0, 60($sp) - # Jumping to endif_8763703729448 - j endif_8763703729448 + # Jumping to endif_8768235527533 + j endif_8768235527533 - else_8763703729448: + else_8768235527533: # Allocating String li $v0, 9 @@ -2255,125 +2675,149 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 116 - sb $t0, 8($v0) # internal_12[0] = 't' + sb $t0, 8($v0) # internal_20[0] = 't' addi $t0, $zero, 104 - sb $t0, 9($v0) # internal_12[1] = 'h' + sb $t0, 9($v0) # internal_20[1] = 'h' addi $t0, $zero, 97 - sb $t0, 10($v0) # internal_12[2] = 'a' + sb $t0, 10($v0) # internal_20[2] = 'a' addi $t0, $zero, 116 - sb $t0, 11($v0) # internal_12[3] = 't' + sb $t0, 11($v0) # internal_20[3] = 't' addi $t0, $zero, 32 - sb $t0, 12($v0) # internal_12[4] = ' ' + sb $t0, 12($v0) # internal_20[4] = ' ' addi $t0, $zero, 119 - sb $t0, 13($v0) # internal_12[5] = 'w' + sb $t0, 13($v0) # internal_20[5] = 'w' addi $t0, $zero, 97 - sb $t0, 14($v0) # internal_12[6] = 'a' + sb $t0, 14($v0) # internal_20[6] = 'a' addi $t0, $zero, 115 - sb $t0, 15($v0) # internal_12[7] = 's' + sb $t0, 15($v0) # internal_20[7] = 's' addi $t0, $zero, 32 - sb $t0, 16($v0) # internal_12[8] = ' ' + sb $t0, 16($v0) # internal_20[8] = ' ' addi $t0, $zero, 110 - sb $t0, 17($v0) # internal_12[9] = 'n' + sb $t0, 17($v0) # internal_20[9] = 'n' addi $t0, $zero, 111 - sb $t0, 18($v0) # internal_12[10] = 'o' + sb $t0, 18($v0) # internal_20[10] = 'o' addi $t0, $zero, 116 - sb $t0, 19($v0) # internal_12[11] = 't' + sb $t0, 19($v0) # internal_20[11] = 't' addi $t0, $zero, 32 - sb $t0, 20($v0) # internal_12[12] = ' ' + sb $t0, 20($v0) # internal_20[12] = ' ' addi $t0, $zero, 97 - sb $t0, 21($v0) # internal_12[13] = 'a' + sb $t0, 21($v0) # internal_20[13] = 'a' addi $t0, $zero, 32 - sb $t0, 22($v0) # internal_12[14] = ' ' + sb $t0, 22($v0) # internal_20[14] = ' ' addi $t0, $zero, 112 - sb $t0, 23($v0) # internal_12[15] = 'p' + sb $t0, 23($v0) # internal_20[15] = 'p' addi $t0, $zero, 97 - sb $t0, 24($v0) # internal_12[16] = 'a' + sb $t0, 24($v0) # internal_20[16] = 'a' addi $t0, $zero, 108 - sb $t0, 25($v0) # internal_12[17] = 'l' + sb $t0, 25($v0) # internal_20[17] = 'l' addi $t0, $zero, 105 - sb $t0, 26($v0) # internal_12[18] = 'i' + sb $t0, 26($v0) # internal_20[18] = 'i' addi $t0, $zero, 110 - sb $t0, 27($v0) # internal_12[19] = 'n' + sb $t0, 27($v0) # internal_20[19] = 'n' addi $t0, $zero, 100 - sb $t0, 28($v0) # internal_12[20] = 'd' + sb $t0, 28($v0) # internal_20[20] = 'd' addi $t0, $zero, 114 - sb $t0, 29($v0) # internal_12[21] = 'r' + sb $t0, 29($v0) # internal_20[21] = 'r' addi $t0, $zero, 111 - sb $t0, 30($v0) # internal_12[22] = 'o' + sb $t0, 30($v0) # internal_20[22] = 'o' addi $t0, $zero, 109 - sb $t0, 31($v0) # internal_12[23] = 'm' + sb $t0, 31($v0) # internal_20[23] = 'm' addi $t0, $zero, 101 - sb $t0, 32($v0) # internal_12[24] = 'e' + sb $t0, 32($v0) # internal_20[24] = 'e' addi $t0, $zero, 10 - sb $t0, 33($v0) # internal_12[25] = '\n' + sb $t0, 33($v0) # internal_20[25] = '\n' sb $zero, 34($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_12 = "that was not a palindrome\n" + sw $v0, 12($sp) # internal_20 = "that was not a palindrome\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_22 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 96($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 68($sp) + lw $t0, 108($sp) sw $t0, 4($sp) # Storing self - # Argument internal_12 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_12 + # Argument internal_20 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_20 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_23 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_13 = result of function_out_string_at_IO + sw $v1, 20($sp) # internal_21 = result of internal_23 addi $sp, $sp, 12 # Freeing space for arguments - # internal_6 = internal_13 - lw $t0, 0($sp) - sw $t0, 28($sp) + # internal_8 = internal_21 + lw $t0, 8($sp) + sw $t0, 60($sp) - # Jumping to endif_8763703729448 - j endif_8763703729448 + # Jumping to endif_8768235527533 + j endif_8768235527533 - endif_8763703729448: + endif_8768235527533: # Loading return value in $v1 - lw $v1, 28($sp) + lw $v1, 60($sp) # Freeing space for local variables - addi $sp, $sp, 56 + addi $sp, $sp, 96 jr $ra main: # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Allocating Main li $v0, 9 @@ -2382,34 +2826,58 @@ la $t0, type_Main # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object Main + sw $v0, 12($sp) # internal_0 = address of allocated object Main # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_Main jal function___init___at_Main lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_main_at_Main - jal function_main_at_Main + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + sw $v1, 16($sp) # internal_1 = result of internal_3 addi $sp, $sp, 8 # Freeing space for arguments # Exit program diff --git a/tests/codegen/primes.mips b/tests/codegen/primes.mips index a9636c2f3..29fb03b3c 100644 --- a/tests/codegen/primes.mips +++ b/tests/codegen/primes.mips @@ -1,45 +1,81 @@ .data - type_Object: .word 8 + type_Object: .word 24 type_Object_inherits_from: .word 0 - type_Object_attributes: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_Main: .word 64 + type_Main_inherits_from: .word type_IO + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_out_string: .word function_out_string_at_IO + type_Main_out_int: .word function_out_int_at_IO + type_Main_in_string: .word function_in_string_at_IO + type_Main_in_int: .word function_in_int_at_IO + type_Main_main: .word function_main_at_Main + type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" - type_Object_abort_message: .asciiz "Abort called from class Object\n" - type_IO: .word 8 - type_IO_inherits_from: .word type_Object - type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" - type_IO_abort_message: .asciiz "Abort called from class IO\n" - type_Int: .word 8 - type_Int_inherits_from: .word type_Object - type_Int_attributes: .word 0 - type_Int_name_size: .word 3 - type_Int_name: .asciiz "Int" - type_Int_abort_message: .asciiz "Abort called from class Int\n" - - type_String: .word 8 - type_String_inherits_from: .word type_Object - type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" - type_String_abort_message: .asciiz "Abort called from class String\n" - type_Bool: .word 8 - type_Bool_inherits_from: .word type_Object - type_Bool_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" - type_Bool_abort_message: .asciiz "Abort called from class Bool\n" - type_Main: .word 28 - type_Main_inherits_from: .word type_IO - type_Main_attributes: .word 5 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" - type_Main_abort_message: .asciiz "Abort called from class Main\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -700,11 +736,11 @@ function_abort_at_Object: # Function parameters - # $ra = 20($sp) - # self = 16($sp) + # $ra = 28($sp) + # self = 24($sp) # Reserving space for local variables - addi $sp, $sp, -16 + addi $sp, $sp, -24 # Allocating String li $v0, 9 @@ -791,7 +827,7 @@ sb $zero, 32($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_0 = "Abort called from class " + sw $v0, 20($sp) # internal_0 = "Abort called from class " # Allocating String li $v0, 9 @@ -805,66 +841,138 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_2[0] = '\n' + sb $t0, 8($v0) # internal_3[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_2 = "\n" + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 0($sp) # Storing self - # Calling function function_type_name_at_Object - jal function_type_name_at_Object + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + sw $v1, 24($sp) # internal_1 = result of internal_5 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_0 - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing internal_0 # Argument internal_1 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_1 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_3 - lw $t0, 12($sp) - sw $t0, 4($sp) # Storing internal_3 - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 - # Calling function function_concat_at_String - jal function_concat_at_String + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) # $t0 = internal_3 + lw $t0, 12($sp) # $t0 = internal_2 addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string internal_3 + # Printing the String internal_2 li $v0, 4 move $a0, $t0 syscall @@ -874,10 +982,10 @@ syscall # Loading return value in $v1 - lw $v1, 16($sp) + lw $v1, 24($sp) # Freeing space for local variables - addi $sp, $sp, 16 + addi $sp, $sp, 24 jr $ra @@ -892,8 +1000,9 @@ # internal_0 = name of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($t0) # $t1 = type of self - lw $t2, 12($t1) # $t1 = length of the name of self - la $t3, 16($t1) # $t1 = name of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 @@ -996,7 +1105,7 @@ lw $t0, 0($sp) # $t0 = x addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string x + # Printing the String x li $v0, 4 move $a0, $t0 syscall @@ -1012,7 +1121,7 @@ # self = 4($sp) # x = 0($sp) - # Printing the string x + # Printing the Int x li $v0, 1 lw $a0, 0($sp) lw $a0, 8($a0) @@ -1039,11 +1148,13 @@ xor $t0, $t0, $t0 # Initializing counter while_read_start: lb $t1, buffer_input($t0) # Loading the byte - beq $t1, $zero, while_read_end + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end addi $t0, $t0, 1 # Incrementing counter j while_read_start while_read_end: - addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 @@ -1290,13 +1401,33 @@ jr $ra + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + function___init___at_Main: # Function parameters - # $ra = 228($sp) - # self = 224($sp) + # $ra = 268($sp) + # self = 264($sp) # Reserving space for local variables - addi $sp, $sp, -224 + addi $sp, $sp, -264 # Allocating String li $v0, 9 @@ -1377,24 +1508,48 @@ sb $zero, 30($v0) # Null-terminator at the end of the string - sw $v0, 220($sp) # internal_0 = "2 is trivially prime.\n" + sw $v0, 260($sp) # internal_0 = "2 is trivially prime.\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 252($sp) # internal_2 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 264($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 252($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 248($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 236($sp) + lw $t0, 276($sp) sw $t0, 4($sp) # Storing self # Argument internal_0 - lw $t0, 232($sp) + lw $t0, 272($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_3 + lw $t0, 260($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 228($sp) # internal_1 = result of function_out_string_at_IO + sw $v1, 268($sp) # internal_1 = result of internal_3 addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 2 @@ -1407,22 +1562,22 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 212($sp) # internal_2 = address of allocated object Int + sw $v0, 244($sp) # internal_4 = address of allocated object Int # Set attribute out of self - lw $t0, 224($sp) # $t0 = self - lw $t1, 212($sp) # $t1 = internal_2 - beq $t1, $zero, object_set_attribute_8739917756133 + lw $t0, 264($sp) # $t0 = self + lw $t1, 244($sp) # $t1 = internal_4 + beq $t1, $zero, object_set_attribute_8775727459699 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8739917756133 + beq $t6, $t5, int_set_attribute_8775727459699 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8739917756133 - j object_set_attribute_8739917756133 - int_set_attribute_8739917756133: + beq $t6, $t5, bool_set_attribute_8775727459699 + j object_set_attribute_8775727459699 + int_set_attribute_8775727459699: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1430,9 +1585,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($t0) # self.out = internal_2 - j end_set_attribute_8739917756133 - bool_set_attribute_8739917756133: + sw $v0, 8($t0) # self.out = internal_4 + j end_set_attribute_8775727459699 + bool_set_attribute_8775727459699: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1440,25 +1595,25 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($t0) # self.out = internal_2 - j end_set_attribute_8739917756133 - object_set_attribute_8739917756133: - sw $t1, 8($t0) # self.out = internal_2 - end_set_attribute_8739917756133: + sw $v0, 8($t0) # self.out = internal_4 + j end_set_attribute_8775727459699 + object_set_attribute_8775727459699: + sw $t1, 8($t0) # self.out = internal_4 + end_set_attribute_8775727459699: # Get attribute out of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'out' from the instance + lw $t0, 264($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'out' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8739917757486 + beq $t6, $t5, int_get_attribute_8775727459792 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8739917757486 - j object_get_attribute_8739917757486 - int_get_attribute_8739917757486: + beq $t6, $t5, bool_get_attribute_8775727459792 + j object_get_attribute_8775727459792 + int_get_attribute_8775727459792: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1466,9 +1621,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 208($sp) # internal_3 = self.out - j end_get_attribute_8739917757486 - bool_get_attribute_8739917757486: + sw $v0, 240($sp) # internal_5 = self.out + j end_get_attribute_8775727459792 + bool_get_attribute_8775727459792: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1476,26 +1631,26 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 208($sp) # internal_3 = self.out - j end_get_attribute_8739917757486 - object_get_attribute_8739917757486: - sw $t1, 208($sp) # internal_3 = out - end_get_attribute_8739917757486: + sw $v0, 240($sp) # internal_5 = self.out + j end_get_attribute_8775727459792 + object_get_attribute_8775727459792: + sw $t1, 240($sp) # internal_5 = self.out + end_get_attribute_8775727459792: # Set attribute testee of self - lw $t0, 224($sp) # $t0 = self - lw $t1, 208($sp) # $t1 = internal_3 - beq $t1, $zero, object_set_attribute_8739917756142 + lw $t0, 264($sp) # $t0 = self + lw $t1, 240($sp) # $t1 = internal_5 + beq $t1, $zero, object_set_attribute_8775727459708 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8739917756142 + beq $t6, $t5, int_set_attribute_8775727459708 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8739917756142 - j object_set_attribute_8739917756142 - int_set_attribute_8739917756142: + beq $t6, $t5, bool_set_attribute_8775727459708 + j object_set_attribute_8775727459708 + int_set_attribute_8775727459708: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1503,9 +1658,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.testee = internal_3 - j end_set_attribute_8739917756142 - bool_set_attribute_8739917756142: + sw $v0, 12($t0) # self.testee = internal_5 + j end_set_attribute_8775727459708 + bool_set_attribute_8775727459708: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1513,11 +1668,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.testee = internal_3 - j end_set_attribute_8739917756142 - object_set_attribute_8739917756142: - sw $t1, 12($t0) # self.testee = internal_3 - end_set_attribute_8739917756142: + sw $v0, 12($t0) # self.testee = internal_5 + j end_set_attribute_8775727459708 + object_set_attribute_8775727459708: + sw $t1, 12($t0) # self.testee = internal_5 + end_set_attribute_8775727459708: # Allocating Int 0 li $v0, 9 @@ -1529,22 +1684,22 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 204($sp) # internal_4 = address of allocated object Int + sw $v0, 236($sp) # internal_6 = address of allocated object Int # Set attribute divisor of self - lw $t0, 224($sp) # $t0 = self - lw $t1, 204($sp) # $t1 = internal_4 - beq $t1, $zero, object_set_attribute_8739917757498 + lw $t0, 264($sp) # $t0 = self + lw $t1, 236($sp) # $t1 = internal_6 + beq $t1, $zero, object_set_attribute_8775727459801 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8739917757498 + beq $t6, $t5, int_set_attribute_8775727459801 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8739917757498 - j object_set_attribute_8739917757498 - int_set_attribute_8739917757498: + beq $t6, $t5, bool_set_attribute_8775727459801 + j object_set_attribute_8775727459801 + int_set_attribute_8775727459801: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1552,9 +1707,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 16($t0) # self.divisor = internal_4 - j end_set_attribute_8739917757498 - bool_set_attribute_8739917757498: + sw $v0, 16($t0) # self.divisor = internal_6 + j end_set_attribute_8775727459801 + bool_set_attribute_8775727459801: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1562,11 +1717,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 16($t0) # self.divisor = internal_4 - j end_set_attribute_8739917757498 - object_set_attribute_8739917757498: - sw $t1, 16($t0) # self.divisor = internal_4 - end_set_attribute_8739917757498: + sw $v0, 16($t0) # self.divisor = internal_6 + j end_set_attribute_8775727459801 + object_set_attribute_8775727459801: + sw $t1, 16($t0) # self.divisor = internal_6 + end_set_attribute_8775727459801: # Allocating Int 500 li $v0, 9 @@ -1578,22 +1733,22 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 500 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 200($sp) # internal_5 = address of allocated object Int + sw $v0, 232($sp) # internal_7 = address of allocated object Int # Set attribute stop of self - lw $t0, 224($sp) # $t0 = self - lw $t1, 200($sp) # $t1 = internal_5 - beq $t1, $zero, object_set_attribute_8739917757516 + lw $t0, 264($sp) # $t0 = self + lw $t1, 232($sp) # $t1 = internal_7 + beq $t1, $zero, object_set_attribute_8775727459822 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8739917757516 + beq $t6, $t5, int_set_attribute_8775727459822 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8739917757516 - j object_set_attribute_8739917757516 - int_set_attribute_8739917757516: + beq $t6, $t5, bool_set_attribute_8775727459822 + j object_set_attribute_8775727459822 + int_set_attribute_8775727459822: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1601,9 +1756,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 20($t0) # self.stop = internal_5 - j end_set_attribute_8739917757516 - bool_set_attribute_8739917757516: + sw $v0, 20($t0) # self.stop = internal_7 + j end_set_attribute_8775727459822 + bool_set_attribute_8775727459822: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1611,13 +1766,16 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 20($t0) # self.stop = internal_5 - j end_set_attribute_8739917757516 - object_set_attribute_8739917757516: - sw $t1, 20($t0) # self.stop = internal_5 - end_set_attribute_8739917757516: + sw $v0, 20($t0) # self.stop = internal_7 + j end_set_attribute_8775727459822 + object_set_attribute_8775727459822: + sw $t1, 20($t0) # self.stop = internal_7 + end_set_attribute_8775727459822: - while_start_8739917777412: + # Allocating NUll to internal_8 + sw $zero, 228($sp) # internal_8 = 0 + + while_start_8775727452179: # Allocating Bool 1 li $v0, 9 @@ -1629,32 +1787,32 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 196($sp) # internal_6 = address of allocated object Int + sw $v0, 224($sp) # internal_9 = address of allocated object Int - # If internal_6 then goto while_body_8739917777412 - lw $t0, 196($sp) # Loading the address of the condition + # If internal_9 then goto while_body_8775727452179 + lw $t0, 224($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8739917777412 + beq $t0, $t1, while_body_8775727452179 - # Jumping to while_end_8739917777412 - j while_end_8739917777412 + # Jumping to while_end_8775727452179 + j while_end_8775727452179 - while_body_8739917777412: + while_body_8775727452179: # Get attribute testee of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'testee' from the instance + lw $t0, 264($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'testee' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8739917757648 + beq $t6, $t5, int_get_attribute_8775727461250 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8739917757648 - j object_get_attribute_8739917757648 - int_get_attribute_8739917757648: + beq $t6, $t5, bool_get_attribute_8775727461250 + j object_get_attribute_8775727461250 + int_get_attribute_8775727461250: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1662,9 +1820,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 192($sp) # internal_7 = self.testee - j end_get_attribute_8739917757648 - bool_get_attribute_8739917757648: + sw $v0, 220($sp) # internal_10 = self.testee + j end_get_attribute_8775727461250 + bool_get_attribute_8775727461250: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1672,11 +1830,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 192($sp) # internal_7 = self.testee - j end_get_attribute_8739917757648 - object_get_attribute_8739917757648: - sw $t1, 192($sp) # internal_7 = testee - end_get_attribute_8739917757648: + sw $v0, 220($sp) # internal_10 = self.testee + j end_get_attribute_8775727461250 + object_get_attribute_8775727461250: + sw $t1, 220($sp) # internal_10 = self.testee + end_get_attribute_8775727461250: # Allocating Int 1 li $v0, 9 @@ -1688,40 +1846,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 188($sp) # internal_8 = address of allocated object Int + sw $v0, 216($sp) # internal_11 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_7 - lw $t0, 204($sp) - sw $t0, 4($sp) # Storing internal_7 + # Argument internal_10 + lw $t0, 232($sp) + sw $t0, 4($sp) # Storing internal_10 - # Argument internal_8 - lw $t0, 200($sp) - sw $t0, 0($sp) # Storing internal_8 + # Argument internal_11 + lw $t0, 228($sp) + sw $t0, 0($sp) # Storing internal_11 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 196($sp) # internal_9 = result of function_add + sw $v1, 224($sp) # internal_12 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Set attribute testee of self - lw $t0, 224($sp) # $t0 = self - lw $t1, 184($sp) # $t1 = internal_9 - beq $t1, $zero, object_set_attribute_8739917757624 + lw $t0, 264($sp) # $t0 = self + lw $t1, 212($sp) # $t1 = internal_12 + beq $t1, $zero, object_set_attribute_8775727461226 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8739917757624 + beq $t6, $t5, int_set_attribute_8775727461226 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8739917757624 - j object_set_attribute_8739917757624 - int_set_attribute_8739917757624: + beq $t6, $t5, bool_set_attribute_8775727461226 + j object_set_attribute_8775727461226 + int_set_attribute_8775727461226: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1729,9 +1887,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.testee = internal_9 - j end_set_attribute_8739917757624 - bool_set_attribute_8739917757624: + sw $v0, 12($t0) # self.testee = internal_12 + j end_set_attribute_8775727461226 + bool_set_attribute_8775727461226: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1739,11 +1897,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($t0) # self.testee = internal_9 - j end_set_attribute_8739917757624 - object_set_attribute_8739917757624: - sw $t1, 12($t0) # self.testee = internal_9 - end_set_attribute_8739917757624: + sw $v0, 12($t0) # self.testee = internal_12 + j end_set_attribute_8775727461226 + object_set_attribute_8775727461226: + sw $t1, 12($t0) # self.testee = internal_12 + end_set_attribute_8775727461226: # Allocating Int 2 li $v0, 9 @@ -1755,22 +1913,22 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 2 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 180($sp) # internal_10 = address of allocated object Int + sw $v0, 208($sp) # internal_13 = address of allocated object Int # Set attribute divisor of self - lw $t0, 224($sp) # $t0 = self - lw $t1, 180($sp) # $t1 = internal_10 - beq $t1, $zero, object_set_attribute_8739917757684 + lw $t0, 264($sp) # $t0 = self + lw $t1, 208($sp) # $t1 = internal_13 + beq $t1, $zero, object_set_attribute_8775727461286 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8739917757684 + beq $t6, $t5, int_set_attribute_8775727461286 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8739917757684 - j object_set_attribute_8739917757684 - int_set_attribute_8739917757684: + beq $t6, $t5, bool_set_attribute_8775727461286 + j object_set_attribute_8775727461286 + int_set_attribute_8775727461286: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1778,9 +1936,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 16($t0) # self.divisor = internal_10 - j end_set_attribute_8739917757684 - bool_set_attribute_8739917757684: + sw $v0, 16($t0) # self.divisor = internal_13 + j end_set_attribute_8775727461286 + bool_set_attribute_8775727461286: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1788,13 +1946,16 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 16($t0) # self.divisor = internal_10 - j end_set_attribute_8739917757684 - object_set_attribute_8739917757684: - sw $t1, 16($t0) # self.divisor = internal_10 - end_set_attribute_8739917757684: + sw $v0, 16($t0) # self.divisor = internal_13 + j end_set_attribute_8775727461286 + object_set_attribute_8775727461286: + sw $t1, 16($t0) # self.divisor = internal_13 + end_set_attribute_8775727461286: - while_start_8739917776764: + # Allocating NUll to internal_14 + sw $zero, 204($sp) # internal_14 = 0 + + while_start_8775727453447: # Allocating Bool 0 li $v0, 9 @@ -1806,21 +1967,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 172($sp) # internal_12 = address of allocated object Int + sw $v0, 196($sp) # internal_16 = address of allocated object Int # Get attribute testee of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'testee' from the instance + lw $t0, 264($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'testee' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8739917759320 + beq $t6, $t5, int_get_attribute_8775727461654 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8739917759320 - j object_get_attribute_8739917759320 - int_get_attribute_8739917759320: + beq $t6, $t5, bool_get_attribute_8775727461654 + j object_get_attribute_8775727461654 + int_get_attribute_8775727461654: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1828,9 +1989,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 168($sp) # internal_13 = self.testee - j end_get_attribute_8739917759320 - bool_get_attribute_8739917759320: + sw $v0, 192($sp) # internal_17 = self.testee + j end_get_attribute_8775727461654 + bool_get_attribute_8775727461654: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1838,25 +1999,25 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 168($sp) # internal_13 = self.testee - j end_get_attribute_8739917759320 - object_get_attribute_8739917759320: - sw $t1, 168($sp) # internal_13 = testee - end_get_attribute_8739917759320: + sw $v0, 192($sp) # internal_17 = self.testee + j end_get_attribute_8775727461654 + object_get_attribute_8775727461654: + sw $t1, 192($sp) # internal_17 = self.testee + end_get_attribute_8775727461654: # Get attribute divisor of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 16($t0) # Get the attribute 'divisor' from the instance + lw $t0, 264($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'divisor' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8739917759344 + beq $t6, $t5, int_get_attribute_8775727461678 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8739917759344 - j object_get_attribute_8739917759344 - int_get_attribute_8739917759344: + beq $t6, $t5, bool_get_attribute_8775727461678 + j object_get_attribute_8775727461678 + int_get_attribute_8775727461678: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1864,9 +2025,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 164($sp) # internal_14 = self.divisor - j end_get_attribute_8739917759344 - bool_get_attribute_8739917759344: + sw $v0, 188($sp) # internal_18 = self.divisor + j end_get_attribute_8775727461678 + bool_get_attribute_8775727461678: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1874,25 +2035,25 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 164($sp) # internal_14 = self.divisor - j end_get_attribute_8739917759344 - object_get_attribute_8739917759344: - sw $t1, 164($sp) # internal_14 = divisor - end_get_attribute_8739917759344: + sw $v0, 188($sp) # internal_18 = self.divisor + j end_get_attribute_8775727461678 + object_get_attribute_8775727461678: + sw $t1, 188($sp) # internal_18 = self.divisor + end_get_attribute_8775727461678: # Get attribute divisor of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 16($t0) # Get the attribute 'divisor' from the instance + lw $t0, 264($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'divisor' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8739917759356 + beq $t6, $t5, int_get_attribute_8775727461690 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8739917759356 - j object_get_attribute_8739917759356 - int_get_attribute_8739917759356: + beq $t6, $t5, bool_get_attribute_8775727461690 + j object_get_attribute_8775727461690 + int_get_attribute_8775727461690: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1900,9 +2061,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 160($sp) # internal_15 = self.divisor - j end_get_attribute_8739917759356 - bool_get_attribute_8739917759356: + sw $v0, 184($sp) # internal_19 = self.divisor + j end_get_attribute_8775727461690 + bool_get_attribute_8775727461690: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1910,62 +2071,62 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 160($sp) # internal_15 = self.divisor - j end_get_attribute_8739917759356 - object_get_attribute_8739917759356: - sw $t1, 160($sp) # internal_15 = divisor - end_get_attribute_8739917759356: + sw $v0, 184($sp) # internal_19 = self.divisor + j end_get_attribute_8775727461690 + object_get_attribute_8775727461690: + sw $t1, 184($sp) # internal_19 = self.divisor + end_get_attribute_8775727461690: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_14 - lw $t0, 176($sp) - sw $t0, 4($sp) # Storing internal_14 + # Argument internal_18 + lw $t0, 200($sp) + sw $t0, 4($sp) # Storing internal_18 - # Argument internal_15 - lw $t0, 172($sp) - sw $t0, 0($sp) # Storing internal_15 + # Argument internal_19 + lw $t0, 196($sp) + sw $t0, 0($sp) # Storing internal_19 # Calling function function_mult jal function_mult lw $ra, 8($sp) - sw $v1, 168($sp) # internal_16 = result of function_mult + sw $v1, 192($sp) # internal_20 = result of function_mult addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_13 - lw $t0, 180($sp) - sw $t0, 4($sp) # Storing internal_13 + # Argument internal_17 + lw $t0, 204($sp) + sw $t0, 4($sp) # Storing internal_17 - # Argument internal_16 - lw $t0, 168($sp) - sw $t0, 0($sp) # Storing internal_16 + # Argument internal_20 + lw $t0, 192($sp) + sw $t0, 0($sp) # Storing internal_20 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 164($sp) # internal_17 = result of function_less_than + sw $v1, 188($sp) # internal_21 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # internal_12 = internal_17 - lw $t0, 152($sp) - sw $t0, 172($sp) + # internal_16 = internal_21 + lw $t0, 176($sp) + sw $t0, 196($sp) - # If internal_12 then goto then_8739917776740 - lw $t0, 172($sp) # Loading the address of the condition + # If internal_16 then goto then_8775727453459 + lw $t0, 196($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8739917776740 + beq $t0, $t1, then_8775727453459 - # Jumping to else_8739917776740 - j else_8739917776740 + # Jumping to else_8775727453459 + j else_8775727453459 - then_8739917776740: + then_8775727453459: # Allocating Bool 0 li $v0, 9 @@ -1977,16 +2138,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 148($sp) # internal_18 = address of allocated object Int + sw $v0, 172($sp) # internal_22 = address of allocated object Int - # internal_11 = internal_18 - lw $t0, 148($sp) - sw $t0, 176($sp) + # internal_15 = internal_22 + lw $t0, 172($sp) + sw $t0, 200($sp) - # Jumping to endif_8739917776740 - j endif_8739917776740 + # Jumping to endif_8775727453459 + j endif_8775727453459 - else_8739917776740: + else_8775727453459: # Allocating Bool 0 li $v0, 9 @@ -1998,21 +2159,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 140($sp) # internal_20 = address of allocated object Int + sw $v0, 164($sp) # internal_24 = address of allocated object Int # Get attribute testee of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'testee' from the instance + lw $t0, 264($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'testee' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8739917759778 + beq $t6, $t5, int_get_attribute_8775727461852 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8739917759778 - j object_get_attribute_8739917759778 - int_get_attribute_8739917759778: + beq $t6, $t5, bool_get_attribute_8775727461852 + j object_get_attribute_8775727461852 + int_get_attribute_8775727461852: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2020,9 +2181,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 136($sp) # internal_21 = self.testee - j end_get_attribute_8739917759778 - bool_get_attribute_8739917759778: + sw $v0, 160($sp) # internal_25 = self.testee + j end_get_attribute_8775727461852 + bool_get_attribute_8775727461852: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2030,25 +2191,25 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 136($sp) # internal_21 = self.testee - j end_get_attribute_8739917759778 - object_get_attribute_8739917759778: - sw $t1, 136($sp) # internal_21 = testee - end_get_attribute_8739917759778: + sw $v0, 160($sp) # internal_25 = self.testee + j end_get_attribute_8775727461852 + object_get_attribute_8775727461852: + sw $t1, 160($sp) # internal_25 = self.testee + end_get_attribute_8775727461852: # Get attribute divisor of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 16($t0) # Get the attribute 'divisor' from the instance + lw $t0, 264($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'divisor' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8739917759802 + beq $t6, $t5, int_get_attribute_8775727461876 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8739917759802 - j object_get_attribute_8739917759802 - int_get_attribute_8739917759802: + beq $t6, $t5, bool_get_attribute_8775727461876 + j object_get_attribute_8775727461876 + int_get_attribute_8775727461876: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2056,9 +2217,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 132($sp) # internal_22 = self.divisor - j end_get_attribute_8739917759802 - bool_get_attribute_8739917759802: + sw $v0, 156($sp) # internal_26 = self.divisor + j end_get_attribute_8775727461876 + bool_get_attribute_8775727461876: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2066,25 +2227,25 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 132($sp) # internal_22 = self.divisor - j end_get_attribute_8739917759802 - object_get_attribute_8739917759802: - sw $t1, 132($sp) # internal_22 = divisor - end_get_attribute_8739917759802: + sw $v0, 156($sp) # internal_26 = self.divisor + j end_get_attribute_8775727461876 + object_get_attribute_8775727461876: + sw $t1, 156($sp) # internal_26 = self.divisor + end_get_attribute_8775727461876: # Get attribute testee of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'testee' from the instance + lw $t0, 264($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'testee' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8739917759826 + beq $t6, $t5, int_get_attribute_8775727462672 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8739917759826 - j object_get_attribute_8739917759826 - int_get_attribute_8739917759826: + beq $t6, $t5, bool_get_attribute_8775727462672 + j object_get_attribute_8775727462672 + int_get_attribute_8775727462672: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2092,9 +2253,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 128($sp) # internal_23 = self.testee - j end_get_attribute_8739917759826 - bool_get_attribute_8739917759826: + sw $v0, 152($sp) # internal_27 = self.testee + j end_get_attribute_8775727462672 + bool_get_attribute_8775727462672: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2102,25 +2263,25 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 128($sp) # internal_23 = self.testee - j end_get_attribute_8739917759826 - object_get_attribute_8739917759826: - sw $t1, 128($sp) # internal_23 = testee - end_get_attribute_8739917759826: + sw $v0, 152($sp) # internal_27 = self.testee + j end_get_attribute_8775727462672 + object_get_attribute_8775727462672: + sw $t1, 152($sp) # internal_27 = self.testee + end_get_attribute_8775727462672: # Get attribute divisor of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 16($t0) # Get the attribute 'divisor' from the instance + lw $t0, 264($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'divisor' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8739917759838 + beq $t6, $t5, int_get_attribute_8775727462684 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8739917759838 - j object_get_attribute_8739917759838 - int_get_attribute_8739917759838: + beq $t6, $t5, bool_get_attribute_8775727462684 + j object_get_attribute_8775727462684 + int_get_attribute_8775727462684: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2128,9 +2289,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 124($sp) # internal_24 = self.divisor - j end_get_attribute_8739917759838 - bool_get_attribute_8739917759838: + sw $v0, 148($sp) # internal_28 = self.divisor + j end_get_attribute_8775727462684 + bool_get_attribute_8775727462684: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2138,64 +2299,64 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 124($sp) # internal_24 = self.divisor - j end_get_attribute_8739917759838 - object_get_attribute_8739917759838: - sw $t1, 124($sp) # internal_24 = divisor - end_get_attribute_8739917759838: + sw $v0, 148($sp) # internal_28 = self.divisor + j end_get_attribute_8775727462684 + object_get_attribute_8775727462684: + sw $t1, 148($sp) # internal_28 = self.divisor + end_get_attribute_8775727462684: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_23 - lw $t0, 140($sp) - sw $t0, 4($sp) # Storing internal_23 + # Argument internal_27 + lw $t0, 164($sp) + sw $t0, 4($sp) # Storing internal_27 - # Argument internal_24 - lw $t0, 136($sp) - sw $t0, 0($sp) # Storing internal_24 + # Argument internal_28 + lw $t0, 160($sp) + sw $t0, 0($sp) # Storing internal_28 # Calling function function_div jal function_div lw $ra, 8($sp) - sw $v1, 132($sp) # internal_25 = result of function_div + sw $v1, 156($sp) # internal_29 = result of function_div addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_22 - lw $t0, 144($sp) - sw $t0, 4($sp) # Storing internal_22 + # Argument internal_26 + lw $t0, 168($sp) + sw $t0, 4($sp) # Storing internal_26 - # Argument internal_25 - lw $t0, 132($sp) - sw $t0, 0($sp) # Storing internal_25 + # Argument internal_29 + lw $t0, 156($sp) + sw $t0, 0($sp) # Storing internal_29 # Calling function function_mult jal function_mult lw $ra, 8($sp) - sw $v1, 128($sp) # internal_26 = result of function_mult + sw $v1, 152($sp) # internal_30 = result of function_mult addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_21 - lw $t0, 148($sp) - sw $t0, 4($sp) # Storing internal_21 + # Argument internal_25 + lw $t0, 172($sp) + sw $t0, 4($sp) # Storing internal_25 - # Argument internal_26 - lw $t0, 128($sp) - sw $t0, 0($sp) # Storing internal_26 + # Argument internal_30 + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing internal_30 # Calling function function_sub jal function_sub lw $ra, 8($sp) - sw $v1, 124($sp) # internal_27 = result of function_sub + sw $v1, 148($sp) # internal_31 = result of function_sub addi $sp, $sp, 12 # Freeing space for arguments # Allocating Int 0 @@ -2208,40 +2369,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 108($sp) # internal_28 = address of allocated object Int + sw $v0, 132($sp) # internal_32 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_27 - lw $t0, 124($sp) - sw $t0, 4($sp) # Storing internal_27 + # Argument internal_31 + lw $t0, 148($sp) + sw $t0, 4($sp) # Storing internal_31 - # Argument internal_28 - lw $t0, 120($sp) - sw $t0, 0($sp) # Storing internal_28 + # Argument internal_32 + lw $t0, 144($sp) + sw $t0, 0($sp) # Storing internal_32 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 116($sp) # internal_29 = result of function_equal + sw $v1, 140($sp) # internal_33 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_20 = internal_29 - lw $t0, 104($sp) - sw $t0, 140($sp) + # internal_24 = internal_33 + lw $t0, 128($sp) + sw $t0, 164($sp) - # If internal_20 then goto then_8739917776734 - lw $t0, 140($sp) # Loading the address of the condition + # If internal_24 then goto then_8775727453519 + lw $t0, 164($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8739917776734 + beq $t0, $t1, then_8775727453519 - # Jumping to else_8739917776734 - j else_8739917776734 + # Jumping to else_8775727453519 + j else_8775727453519 - then_8739917776734: + then_8775727453519: # Allocating Bool 0 li $v0, 9 @@ -2253,16 +2414,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 100($sp) # internal_30 = address of allocated object Int + sw $v0, 124($sp) # internal_34 = address of allocated object Int - # internal_19 = internal_30 - lw $t0, 100($sp) - sw $t0, 144($sp) + # internal_23 = internal_34 + lw $t0, 124($sp) + sw $t0, 168($sp) - # Jumping to endif_8739917776734 - j endif_8739917776734 + # Jumping to endif_8775727453519 + j endif_8775727453519 - else_8739917776734: + else_8775727453519: # Allocating Bool 1 li $v0, 9 @@ -2274,50 +2435,50 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 96($sp) # internal_31 = address of allocated object Int + sw $v0, 120($sp) # internal_35 = address of allocated object Int - # internal_19 = internal_31 - lw $t0, 96($sp) - sw $t0, 144($sp) + # internal_23 = internal_35 + lw $t0, 120($sp) + sw $t0, 168($sp) - # Jumping to endif_8739917776734 - j endif_8739917776734 + # Jumping to endif_8775727453519 + j endif_8775727453519 - endif_8739917776734: + endif_8775727453519: - # internal_11 = internal_19 - lw $t0, 144($sp) - sw $t0, 176($sp) + # internal_15 = internal_23 + lw $t0, 168($sp) + sw $t0, 200($sp) - # Jumping to endif_8739917776740 - j endif_8739917776740 + # Jumping to endif_8775727453459 + j endif_8775727453459 - endif_8739917776740: + endif_8775727453459: - # If internal_11 then goto while_body_8739917776764 - lw $t0, 176($sp) # Loading the address of the condition + # If internal_15 then goto while_body_8775727453447 + lw $t0, 200($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8739917776764 + beq $t0, $t1, while_body_8775727453447 - # Jumping to while_end_8739917776764 - j while_end_8739917776764 + # Jumping to while_end_8775727453447 + j while_end_8775727453447 - while_body_8739917776764: + while_body_8775727453447: # Get attribute divisor of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 16($t0) # Get the attribute 'divisor' from the instance + lw $t0, 264($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'divisor' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8739917761085 + beq $t6, $t5, int_get_attribute_8775727462903 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8739917761085 - j object_get_attribute_8739917761085 - int_get_attribute_8739917761085: + beq $t6, $t5, bool_get_attribute_8775727462903 + j object_get_attribute_8775727462903 + int_get_attribute_8775727462903: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2325,9 +2486,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 92($sp) # internal_32 = self.divisor - j end_get_attribute_8739917761085 - bool_get_attribute_8739917761085: + sw $v0, 116($sp) # internal_36 = self.divisor + j end_get_attribute_8775727462903 + bool_get_attribute_8775727462903: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2335,11 +2496,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 92($sp) # internal_32 = self.divisor - j end_get_attribute_8739917761085 - object_get_attribute_8739917761085: - sw $t1, 92($sp) # internal_32 = divisor - end_get_attribute_8739917761085: + sw $v0, 116($sp) # internal_36 = self.divisor + j end_get_attribute_8775727462903 + object_get_attribute_8775727462903: + sw $t1, 116($sp) # internal_36 = self.divisor + end_get_attribute_8775727462903: # Allocating Int 1 li $v0, 9 @@ -2351,40 +2512,40 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 88($sp) # internal_33 = address of allocated object Int + sw $v0, 112($sp) # internal_37 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_32 - lw $t0, 104($sp) - sw $t0, 4($sp) # Storing internal_32 + # Argument internal_36 + lw $t0, 128($sp) + sw $t0, 4($sp) # Storing internal_36 - # Argument internal_33 - lw $t0, 100($sp) - sw $t0, 0($sp) # Storing internal_33 + # Argument internal_37 + lw $t0, 124($sp) + sw $t0, 0($sp) # Storing internal_37 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 96($sp) # internal_34 = result of function_add + sw $v1, 120($sp) # internal_38 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Set attribute divisor of self - lw $t0, 224($sp) # $t0 = self - lw $t1, 84($sp) # $t1 = internal_34 - beq $t1, $zero, object_set_attribute_8739917761061 + lw $t0, 264($sp) # $t0 = self + lw $t1, 108($sp) # $t1 = internal_38 + beq $t1, $zero, object_set_attribute_8775727462879 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8739917761061 + beq $t6, $t5, int_set_attribute_8775727462879 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8739917761061 - j object_set_attribute_8739917761061 - int_set_attribute_8739917761061: + beq $t6, $t5, bool_set_attribute_8775727462879 + j object_set_attribute_8775727462879 + int_set_attribute_8775727462879: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2392,9 +2553,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 16($t0) # self.divisor = internal_34 - j end_set_attribute_8739917761061 - bool_set_attribute_8739917761061: + sw $v0, 16($t0) # self.divisor = internal_38 + j end_set_attribute_8775727462879 + bool_set_attribute_8775727462879: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2402,16 +2563,16 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 16($t0) # self.divisor = internal_34 - j end_set_attribute_8739917761061 - object_set_attribute_8739917761061: - sw $t1, 16($t0) # self.divisor = internal_34 - end_set_attribute_8739917761061: + sw $v0, 16($t0) # self.divisor = internal_38 + j end_set_attribute_8775727462879 + object_set_attribute_8775727462879: + sw $t1, 16($t0) # self.divisor = internal_38 + end_set_attribute_8775727462879: - # Jumping to while_start_8739917776764 - j while_start_8739917776764 + # Jumping to while_start_8775727453447 + j while_start_8775727453447 - while_end_8739917776764: + while_end_8775727453447: # Allocating Bool 0 li $v0, 9 @@ -2423,21 +2584,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 76($sp) # internal_36 = address of allocated object Int + sw $v0, 100($sp) # internal_40 = address of allocated object Int # Get attribute testee of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'testee' from the instance + lw $t0, 264($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'testee' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8739917761172 + beq $t6, $t5, int_get_attribute_8775727463250 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8739917761172 - j object_get_attribute_8739917761172 - int_get_attribute_8739917761172: + beq $t6, $t5, bool_get_attribute_8775727463250 + j object_get_attribute_8775727463250 + int_get_attribute_8775727463250: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2445,9 +2606,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 72($sp) # internal_37 = self.testee - j end_get_attribute_8739917761172 - bool_get_attribute_8739917761172: + sw $v0, 96($sp) # internal_41 = self.testee + j end_get_attribute_8775727463250 + bool_get_attribute_8775727463250: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2455,25 +2616,25 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 72($sp) # internal_37 = self.testee - j end_get_attribute_8739917761172 - object_get_attribute_8739917761172: - sw $t1, 72($sp) # internal_37 = testee - end_get_attribute_8739917761172: + sw $v0, 96($sp) # internal_41 = self.testee + j end_get_attribute_8775727463250 + object_get_attribute_8775727463250: + sw $t1, 96($sp) # internal_41 = self.testee + end_get_attribute_8775727463250: # Get attribute divisor of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 16($t0) # Get the attribute 'divisor' from the instance + lw $t0, 264($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'divisor' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8739917761196 + beq $t6, $t5, int_get_attribute_8775727463274 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8739917761196 - j object_get_attribute_8739917761196 - int_get_attribute_8739917761196: + beq $t6, $t5, bool_get_attribute_8775727463274 + j object_get_attribute_8775727463274 + int_get_attribute_8775727463274: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2481,9 +2642,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 68($sp) # internal_38 = self.divisor - j end_get_attribute_8739917761196 - bool_get_attribute_8739917761196: + sw $v0, 92($sp) # internal_42 = self.divisor + j end_get_attribute_8775727463274 + bool_get_attribute_8775727463274: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2491,25 +2652,25 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 68($sp) # internal_38 = self.divisor - j end_get_attribute_8739917761196 - object_get_attribute_8739917761196: - sw $t1, 68($sp) # internal_38 = divisor - end_get_attribute_8739917761196: + sw $v0, 92($sp) # internal_42 = self.divisor + j end_get_attribute_8775727463274 + object_get_attribute_8775727463274: + sw $t1, 92($sp) # internal_42 = self.divisor + end_get_attribute_8775727463274: # Get attribute divisor of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 16($t0) # Get the attribute 'divisor' from the instance + lw $t0, 264($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'divisor' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8739917761208 + beq $t6, $t5, int_get_attribute_8775727463286 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8739917761208 - j object_get_attribute_8739917761208 - int_get_attribute_8739917761208: + beq $t6, $t5, bool_get_attribute_8775727463286 + j object_get_attribute_8775727463286 + int_get_attribute_8775727463286: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2517,9 +2678,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 64($sp) # internal_39 = self.divisor - j end_get_attribute_8739917761208 - bool_get_attribute_8739917761208: + sw $v0, 88($sp) # internal_43 = self.divisor + j end_get_attribute_8775727463286 + bool_get_attribute_8775727463286: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2527,76 +2688,76 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 64($sp) # internal_39 = self.divisor - j end_get_attribute_8739917761208 - object_get_attribute_8739917761208: - sw $t1, 64($sp) # internal_39 = divisor - end_get_attribute_8739917761208: + sw $v0, 88($sp) # internal_43 = self.divisor + j end_get_attribute_8775727463286 + object_get_attribute_8775727463286: + sw $t1, 88($sp) # internal_43 = self.divisor + end_get_attribute_8775727463286: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_38 - lw $t0, 80($sp) - sw $t0, 4($sp) # Storing internal_38 + # Argument internal_42 + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing internal_42 - # Argument internal_39 - lw $t0, 76($sp) - sw $t0, 0($sp) # Storing internal_39 + # Argument internal_43 + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing internal_43 # Calling function function_mult jal function_mult lw $ra, 8($sp) - sw $v1, 72($sp) # internal_40 = result of function_mult + sw $v1, 96($sp) # internal_44 = result of function_mult addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_37 - lw $t0, 84($sp) - sw $t0, 4($sp) # Storing internal_37 + # Argument internal_41 + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing internal_41 - # Argument internal_40 - lw $t0, 72($sp) - sw $t0, 0($sp) # Storing internal_40 + # Argument internal_44 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_44 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 68($sp) # internal_41 = result of function_less_than + sw $v1, 92($sp) # internal_45 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # internal_36 = internal_41 - lw $t0, 56($sp) - sw $t0, 76($sp) + # internal_40 = internal_45 + lw $t0, 80($sp) + sw $t0, 100($sp) - # If internal_36 then goto then_8739917776830 - lw $t0, 76($sp) # Loading the address of the condition + # If internal_40 then goto then_8775727453525 + lw $t0, 100($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8739917776830 + beq $t0, $t1, then_8775727453525 - # Jumping to else_8739917776830 - j else_8739917776830 + # Jumping to else_8775727453525 + j else_8775727453525 - then_8739917776830: + then_8775727453525: # Get attribute testee of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'testee' from the instance + lw $t0, 264($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'testee' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8739917761564 + beq $t6, $t5, int_get_attribute_8775727463382 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8739917761564 - j object_get_attribute_8739917761564 - int_get_attribute_8739917761564: + beq $t6, $t5, bool_get_attribute_8775727463382 + j object_get_attribute_8775727463382 + int_get_attribute_8775727463382: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2604,9 +2765,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 52($sp) # internal_42 = self.testee - j end_get_attribute_8739917761564 - bool_get_attribute_8739917761564: + sw $v0, 76($sp) # internal_46 = self.testee + j end_get_attribute_8775727463382 + bool_get_attribute_8775727463382: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2614,26 +2775,26 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 52($sp) # internal_42 = self.testee - j end_get_attribute_8739917761564 - object_get_attribute_8739917761564: - sw $t1, 52($sp) # internal_42 = testee - end_get_attribute_8739917761564: + sw $v0, 76($sp) # internal_46 = self.testee + j end_get_attribute_8775727463382 + object_get_attribute_8775727463382: + sw $t1, 76($sp) # internal_46 = self.testee + end_get_attribute_8775727463382: # Set attribute out of self - lw $t0, 224($sp) # $t0 = self - lw $t1, 52($sp) # $t1 = internal_42 - beq $t1, $zero, object_set_attribute_8739917761552 + lw $t0, 264($sp) # $t0 = self + lw $t1, 76($sp) # $t1 = internal_46 + beq $t1, $zero, object_set_attribute_8775727463370 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8739917761552 + beq $t6, $t5, int_set_attribute_8775727463370 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8739917761552 - j object_set_attribute_8739917761552 - int_set_attribute_8739917761552: + beq $t6, $t5, bool_set_attribute_8775727463370 + j object_set_attribute_8775727463370 + int_set_attribute_8775727463370: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2641,9 +2802,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($t0) # self.out = internal_42 - j end_set_attribute_8739917761552 - bool_set_attribute_8739917761552: + sw $v0, 8($t0) # self.out = internal_46 + j end_set_attribute_8775727463370 + bool_set_attribute_8775727463370: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2651,25 +2812,25 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($t0) # self.out = internal_42 - j end_set_attribute_8739917761552 - object_set_attribute_8739917761552: - sw $t1, 8($t0) # self.out = internal_42 - end_set_attribute_8739917761552: + sw $v0, 8($t0) # self.out = internal_46 + j end_set_attribute_8775727463370 + object_set_attribute_8775727463370: + sw $t1, 8($t0) # self.out = internal_46 + end_set_attribute_8775727463370: # Get attribute out of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'out' from the instance + lw $t0, 264($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'out' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8739917761588 + beq $t6, $t5, int_get_attribute_8775727463406 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8739917761588 - j object_get_attribute_8739917761588 - int_get_attribute_8739917761588: + beq $t6, $t5, bool_get_attribute_8775727463406 + j object_get_attribute_8775727463406 + int_get_attribute_8775727463406: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2677,9 +2838,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 48($sp) # internal_43 = self.out - j end_get_attribute_8739917761588 - bool_get_attribute_8739917761588: + sw $v0, 72($sp) # internal_47 = self.out + j end_get_attribute_8775727463406 + bool_get_attribute_8775727463406: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2687,28 +2848,52 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 48($sp) # internal_43 = self.out - j end_get_attribute_8739917761588 - object_get_attribute_8739917761588: - sw $t1, 48($sp) # internal_43 = out - end_get_attribute_8739917761588: + sw $v0, 72($sp) # internal_47 = self.out + j end_get_attribute_8775727463406 + object_get_attribute_8775727463406: + sw $t1, 72($sp) # internal_47 = self.out + end_get_attribute_8775727463406: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_49 = address of allocated object Int + + # Get method out_int of Main + lw $t0, 264($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 64($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 60($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 236($sp) + lw $t0, 276($sp) sw $t0, 4($sp) # Storing self - # Argument internal_43 - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing internal_43 + # Argument internal_47 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_47 - # Calling function function_out_int_at_IO - jal function_out_int_at_IO + # Calling function internal_50 + lw $t0, 72($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 56($sp) # internal_44 = result of function_out_int_at_IO + sw $v1, 80($sp) # internal_48 = result of internal_50 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -2723,68 +2908,92 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 32 - sb $t0, 8($v0) # internal_45[0] = ' ' + sb $t0, 8($v0) # internal_51[0] = ' ' addi $t0, $zero, 105 - sb $t0, 9($v0) # internal_45[1] = 'i' + sb $t0, 9($v0) # internal_51[1] = 'i' addi $t0, $zero, 115 - sb $t0, 10($v0) # internal_45[2] = 's' + sb $t0, 10($v0) # internal_51[2] = 's' addi $t0, $zero, 32 - sb $t0, 11($v0) # internal_45[3] = ' ' + sb $t0, 11($v0) # internal_51[3] = ' ' addi $t0, $zero, 112 - sb $t0, 12($v0) # internal_45[4] = 'p' + sb $t0, 12($v0) # internal_51[4] = 'p' addi $t0, $zero, 114 - sb $t0, 13($v0) # internal_45[5] = 'r' + sb $t0, 13($v0) # internal_51[5] = 'r' addi $t0, $zero, 105 - sb $t0, 14($v0) # internal_45[6] = 'i' + sb $t0, 14($v0) # internal_51[6] = 'i' addi $t0, $zero, 109 - sb $t0, 15($v0) # internal_45[7] = 'm' + sb $t0, 15($v0) # internal_51[7] = 'm' addi $t0, $zero, 101 - sb $t0, 16($v0) # internal_45[8] = 'e' + sb $t0, 16($v0) # internal_51[8] = 'e' addi $t0, $zero, 46 - sb $t0, 17($v0) # internal_45[9] = '.' + sb $t0, 17($v0) # internal_51[9] = '.' addi $t0, $zero, 10 - sb $t0, 18($v0) # internal_45[10] = '\n' + sb $t0, 18($v0) # internal_51[10] = '\n' sb $zero, 19($v0) # Null-terminator at the end of the string - sw $v0, 40($sp) # internal_45 = " is prime.\n" + sw $v0, 56($sp) # internal_51 = " is prime.\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_53 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 264($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 48($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 44($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 236($sp) + lw $t0, 276($sp) sw $t0, 4($sp) # Storing self - # Argument internal_45 - lw $t0, 52($sp) - sw $t0, 0($sp) # Storing internal_45 + # Argument internal_51 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_51 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_54 + lw $t0, 56($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 48($sp) # internal_46 = result of function_out_string_at_IO + sw $v1, 64($sp) # internal_52 = result of internal_54 addi $sp, $sp, 12 # Freeing space for arguments - # internal_35 = internal_46 - lw $t0, 36($sp) - sw $t0, 80($sp) + # internal_39 = internal_52 + lw $t0, 52($sp) + sw $t0, 104($sp) - # Jumping to endif_8739917776830 - j endif_8739917776830 + # Jumping to endif_8775727453525 + j endif_8775727453525 - else_8739917776830: + else_8775727453525: # Allocating Int 0 li $v0, 9 @@ -2796,16 +3005,16 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 32($sp) # internal_47 = address of allocated object Int + sw $v0, 40($sp) # internal_55 = address of allocated object Int - # internal_35 = internal_47 - lw $t0, 32($sp) - sw $t0, 80($sp) + # internal_39 = internal_55 + lw $t0, 40($sp) + sw $t0, 104($sp) - # Jumping to endif_8739917776830 - j endif_8739917776830 + # Jumping to endif_8775727453525 + j endif_8775727453525 - endif_8739917776830: + endif_8775727453525: # Allocating Bool 0 li $v0, 9 @@ -2817,21 +3026,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 24($sp) # internal_49 = address of allocated object Int + sw $v0, 32($sp) # internal_57 = address of allocated object Int # Get attribute stop of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 20($t0) # Get the attribute 'stop' from the instance + lw $t0, 264($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'stop' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8739917761720 + beq $t6, $t5, int_get_attribute_8775727460518 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8739917761720 - j object_get_attribute_8739917761720 - int_get_attribute_8739917761720: + beq $t6, $t5, bool_get_attribute_8775727460518 + j object_get_attribute_8775727460518 + int_get_attribute_8775727460518: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2839,9 +3048,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 20($sp) # internal_50 = self.stop - j end_get_attribute_8739917761720 - bool_get_attribute_8739917761720: + sw $v0, 28($sp) # internal_58 = self.stop + j end_get_attribute_8775727460518 + bool_get_attribute_8775727460518: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2849,25 +3058,25 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 20($sp) # internal_50 = self.stop - j end_get_attribute_8739917761720 - object_get_attribute_8739917761720: - sw $t1, 20($sp) # internal_50 = stop - end_get_attribute_8739917761720: + sw $v0, 28($sp) # internal_58 = self.stop + j end_get_attribute_8775727460518 + object_get_attribute_8775727460518: + sw $t1, 28($sp) # internal_58 = self.stop + end_get_attribute_8775727460518: # Get attribute testee of self - lw $t0, 224($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'testee' from the instance + lw $t0, 264($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'testee' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8739917761732 + beq $t6, $t5, int_get_attribute_8775727460530 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8739917761732 - j object_get_attribute_8739917761732 - int_get_attribute_8739917761732: + beq $t6, $t5, bool_get_attribute_8775727460530 + j object_get_attribute_8775727460530 + int_get_attribute_8775727460530: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2875,9 +3084,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 16($sp) # internal_51 = self.testee - j end_get_attribute_8739917761732 - bool_get_attribute_8739917761732: + sw $v0, 24($sp) # internal_59 = self.testee + j end_get_attribute_8775727460530 + bool_get_attribute_8775727460530: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2885,44 +3094,44 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 16($sp) # internal_51 = self.testee - j end_get_attribute_8739917761732 - object_get_attribute_8739917761732: - sw $t1, 16($sp) # internal_51 = testee - end_get_attribute_8739917761732: + sw $v0, 24($sp) # internal_59 = self.testee + j end_get_attribute_8775727460530 + object_get_attribute_8775727460530: + sw $t1, 24($sp) # internal_59 = self.testee + end_get_attribute_8775727460530: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_50 - lw $t0, 32($sp) - sw $t0, 4($sp) # Storing internal_50 + # Argument internal_58 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_58 - # Argument internal_51 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_51 + # Argument internal_59 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_59 # Calling function function_less_than_or_equal jal function_less_than_or_equal lw $ra, 8($sp) - sw $v1, 24($sp) # internal_52 = result of function_less_than_or_equal + sw $v1, 32($sp) # internal_60 = result of function_less_than_or_equal addi $sp, $sp, 12 # Freeing space for arguments - # internal_49 = internal_52 - lw $t0, 12($sp) - sw $t0, 24($sp) + # internal_57 = internal_60 + lw $t0, 20($sp) + sw $t0, 32($sp) - # If internal_49 then goto then_8739917776878 - lw $t0, 24($sp) # Loading the address of the condition + # If internal_57 then goto then_8775727453621 + lw $t0, 32($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8739917776878 + beq $t0, $t1, then_8775727453621 - # Jumping to else_8739917776878 - j else_8739917776878 + # Jumping to else_8775727453621 + j else_8775727453621 - then_8739917776878: + then_8775727453621: # Allocating String li $v0, 9 @@ -2936,43 +3145,67 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 104 - sb $t0, 8($v0) # internal_53[0] = 'h' + sb $t0, 8($v0) # internal_61[0] = 'h' addi $t0, $zero, 97 - sb $t0, 9($v0) # internal_53[1] = 'a' + sb $t0, 9($v0) # internal_61[1] = 'a' addi $t0, $zero, 108 - sb $t0, 10($v0) # internal_53[2] = 'l' + sb $t0, 10($v0) # internal_61[2] = 'l' addi $t0, $zero, 116 - sb $t0, 11($v0) # internal_53[3] = 't' + sb $t0, 11($v0) # internal_61[3] = 't' sb $zero, 12($v0) # Null-terminator at the end of the string - sw $v0, 8($sp) # internal_53 = "halt" + sw $v0, 16($sp) # internal_61 = "halt" + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_63 = address of allocated object Int + + # Get method abort of String + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_53 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_53 + # Argument internal_61 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_61 - # Calling function function_abort_at_Object - jal function_abort_at_Object + # Calling function internal_64 + lw $t0, 12($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 12($sp) # internal_54 = result of function_abort_at_Object + sw $v1, 20($sp) # internal_62 = result of internal_64 addi $sp, $sp, 8 # Freeing space for arguments - # internal_48 = internal_54 - lw $t0, 4($sp) - sw $t0, 28($sp) + # internal_56 = internal_62 + lw $t0, 12($sp) + sw $t0, 36($sp) - # Jumping to endif_8739917776878 - j endif_8739917776878 + # Jumping to endif_8775727453621 + j endif_8775727453621 - else_8739917776878: + else_8775727453621: # Allocating String li $v0, 9 @@ -2986,54 +3219,89 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 99 - sb $t0, 8($v0) # internal_55[0] = 'c' + sb $t0, 8($v0) # internal_65[0] = 'c' addi $t0, $zero, 111 - sb $t0, 9($v0) # internal_55[1] = 'o' + sb $t0, 9($v0) # internal_65[1] = 'o' addi $t0, $zero, 110 - sb $t0, 10($v0) # internal_55[2] = 'n' + sb $t0, 10($v0) # internal_65[2] = 'n' addi $t0, $zero, 116 - sb $t0, 11($v0) # internal_55[3] = 't' + sb $t0, 11($v0) # internal_65[3] = 't' addi $t0, $zero, 105 - sb $t0, 12($v0) # internal_55[4] = 'i' + sb $t0, 12($v0) # internal_65[4] = 'i' addi $t0, $zero, 110 - sb $t0, 13($v0) # internal_55[5] = 'n' + sb $t0, 13($v0) # internal_65[5] = 'n' addi $t0, $zero, 117 - sb $t0, 14($v0) # internal_55[6] = 'u' + sb $t0, 14($v0) # internal_65[6] = 'u' addi $t0, $zero, 101 - sb $t0, 15($v0) # internal_55[7] = 'e' + sb $t0, 15($v0) # internal_65[7] = 'e' sb $zero, 16($v0) # Null-terminator at the end of the string - sw $v0, 0($sp) # internal_55 = "continue" + sw $v0, 0($sp) # internal_65 = "continue" - # internal_48 = internal_55 + # internal_56 = internal_65 lw $t0, 0($sp) - sw $t0, 28($sp) + sw $t0, 36($sp) - # Jumping to endif_8739917776878 - j endif_8739917776878 + # Jumping to endif_8775727453621 + j endif_8775727453621 - endif_8739917776878: + endif_8775727453621: - # Jumping to while_start_8739917777412 - j while_start_8739917777412 + # Jumping to while_start_8775727452179 + j while_start_8775727452179 - while_end_8739917777412: + while_end_8775727452179: # Set attribute m of self - lw $t0, 224($sp) # $t0 = self + lw $t0, 264($sp) # $t0 = self + lw $t1, 228($sp) # $t1 = internal_8 + beq $t1, $zero, object_set_attribute_8775727461130 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8775727461130 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8775727461130 + j object_set_attribute_8775727461130 + int_set_attribute_8775727461130: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($t0) # self.m = internal_8 + j end_set_attribute_8775727461130 + bool_set_attribute_8775727461130: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($t0) # self.m = internal_8 + j end_set_attribute_8775727461130 + object_set_attribute_8775727461130: + sw $t1, 24($t0) # self.m = internal_8 + end_set_attribute_8775727461130: + # Loading return value in $v1 - lw $v1, 224($sp) + lw $v1, 264($sp) # Freeing space for local variables - addi $sp, $sp, 224 + addi $sp, $sp, 264 jr $ra @@ -3067,7 +3335,7 @@ main: # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Allocating Main li $v0, 9 @@ -3076,34 +3344,58 @@ la $t0, type_Main # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object Main + sw $v0, 12($sp) # internal_0 = address of allocated object Main # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_Main jal function___init___at_Main lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_main_at_Main - jal function_main_at_Main + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + sw $v1, 16($sp) # internal_1 = result of internal_3 addi $sp, $sp, 8 # Freeing space for arguments # Exit program diff --git a/tests/codegen/print-cool.mips b/tests/codegen/print-cool.mips index 742fdbd1f..065321163 100644 --- a/tests/codegen/print-cool.mips +++ b/tests/codegen/print-cool.mips @@ -1,45 +1,81 @@ .data - type_Object: .word 8 + type_Object: .word 24 type_Object_inherits_from: .word 0 - type_Object_attributes: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_Main: .word 44 + type_Main_inherits_from: .word type_IO + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_out_string: .word function_out_string_at_IO + type_Main_out_int: .word function_out_int_at_IO + type_Main_in_string: .word function_in_string_at_IO + type_Main_in_int: .word function_in_int_at_IO + type_Main_main: .word function_main_at_Main + type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" - type_Object_abort_message: .asciiz "Abort called from class Object\n" - type_IO: .word 8 - type_IO_inherits_from: .word type_Object - type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" - type_IO_abort_message: .asciiz "Abort called from class IO\n" - - type_Int: .word 8 - type_Int_inherits_from: .word type_Object - type_Int_attributes: .word 0 - type_Int_name_size: .word 3 - type_Int_name: .asciiz "Int" - type_Int_abort_message: .asciiz "Abort called from class Int\n" - type_String: .word 8 - type_String_inherits_from: .word type_Object - type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" - type_String_abort_message: .asciiz "Abort called from class String\n" - type_Bool: .word 8 - type_Bool_inherits_from: .word type_Object - type_Bool_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" - type_Bool_abort_message: .asciiz "Abort called from class Bool\n" - type_Main: .word 8 - type_Main_inherits_from: .word type_IO - type_Main_attributes: .word 0 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" - type_Main_abort_message: .asciiz "Abort called from class Main\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -700,11 +736,11 @@ function_abort_at_Object: # Function parameters - # $ra = 20($sp) - # self = 16($sp) + # $ra = 28($sp) + # self = 24($sp) # Reserving space for local variables - addi $sp, $sp, -16 + addi $sp, $sp, -24 # Allocating String li $v0, 9 @@ -791,7 +827,7 @@ sb $zero, 32($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_0 = "Abort called from class " + sw $v0, 20($sp) # internal_0 = "Abort called from class " # Allocating String li $v0, 9 @@ -805,66 +841,138 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_2[0] = '\n' + sb $t0, 8($v0) # internal_3[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_2 = "\n" + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 0($sp) # Storing self - # Calling function function_type_name_at_Object - jal function_type_name_at_Object + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + sw $v1, 24($sp) # internal_1 = result of internal_5 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_0 - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing internal_0 # Argument internal_1 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_1 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_3 - lw $t0, 12($sp) - sw $t0, 4($sp) # Storing internal_3 - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) # $t0 = internal_3 + lw $t0, 12($sp) # $t0 = internal_2 addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string internal_3 + # Printing the String internal_2 li $v0, 4 move $a0, $t0 syscall @@ -874,10 +982,10 @@ syscall # Loading return value in $v1 - lw $v1, 16($sp) + lw $v1, 24($sp) # Freeing space for local variables - addi $sp, $sp, 16 + addi $sp, $sp, 24 jr $ra @@ -892,8 +1000,9 @@ # internal_0 = name of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($t0) # $t1 = type of self - lw $t2, 12($t1) # $t1 = length of the name of self - la $t3, 16($t1) # $t1 = name of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 @@ -996,7 +1105,7 @@ lw $t0, 0($sp) # $t0 = x addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string x + # Printing the String x li $v0, 4 move $a0, $t0 syscall @@ -1012,7 +1121,7 @@ # self = 4($sp) # x = 0($sp) - # Printing the string x + # Printing the Int x li $v0, 1 lw $a0, 0($sp) lw $a0, 8($a0) @@ -1039,11 +1148,13 @@ xor $t0, $t0, $t0 # Initializing counter while_read_start: lb $t1, buffer_input($t0) # Loading the byte - beq $t1, $zero, while_read_end + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end addi $t0, $t0, 1 # Incrementing counter j while_read_start while_read_end: - addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 @@ -1290,6 +1401,26 @@ jr $ra + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + function___init___at_Main: # Function parameters # $ra = 4($sp) @@ -1302,11 +1433,11 @@ function_main_at_Main: # Function parameters - # $ra = 64($sp) - # self = 60($sp) + # $ra = 120($sp) + # self = 116($sp) # Reserving space for local variables - addi $sp, $sp, -60 + addi $sp, $sp, -116 # Allocating Object li $v0, 9 @@ -1315,34 +1446,58 @@ la $t0, type_Object # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 56($sp) # internal_0 = address of allocated object Object + sw $v0, 112($sp) # internal_0 = address of allocated object Object # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 64($sp) + lw $t0, 120($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_Object jal function___init___at_Object lw $ra, 4($sp) - sw $v1, 64($sp) # internal_0 = result of function___init___at_Object + sw $v1, 120($sp) # internal_0 = result of function___init___at_Object addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_2 = address of allocated object Int + + # Get method type_name of Object + lw $t0, 112($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 104($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 100($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 64($sp) + lw $t0, 120($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_type_name_at_Object - jal function_type_name_at_Object + # Calling function internal_3 + lw $t0, 108($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 60($sp) # internal_1 = result of function_type_name_at_Object + sw $v1, 116($sp) # internal_1 = result of internal_3 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 4 @@ -1355,7 +1510,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 4 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 48($sp) # internal_2 = address of allocated object Int + sw $v0, 96($sp) # internal_4 = address of allocated object Int # Allocating Int 1 li $v0, 9 @@ -1367,46 +1522,94 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 44($sp) # internal_3 = address of allocated object Int + sw $v0, 92($sp) # internal_5 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_7 = address of allocated object Int + + # Get method substr of String + lw $t0, 108($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 84($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 80($sp) # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument internal_1 - lw $t0, 68($sp) + lw $t0, 124($sp) sw $t0, 8($sp) # Storing internal_1 - # Argument internal_2 - lw $t0, 64($sp) - sw $t0, 4($sp) # Storing internal_2 + # Argument internal_4 + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing internal_4 - # Argument internal_3 - lw $t0, 60($sp) - sw $t0, 0($sp) # Storing internal_3 + # Argument internal_5 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_5 - # Calling function function_substr_at_String - jal function_substr_at_String + # Calling function internal_8 + lw $t0, 96($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 56($sp) # internal_4 = result of function_substr_at_String + sw $v1, 104($sp) # internal_6 = result of internal_8 addi $sp, $sp, 16 # Freeing space for arguments + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_10 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 116($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 72($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 68($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 72($sp) + lw $t0, 128($sp) sw $t0, 4($sp) # Storing self - # Argument internal_4 - lw $t0, 52($sp) - sw $t0, 0($sp) # Storing internal_4 + # Argument internal_6 + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing internal_6 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_11 + lw $t0, 80($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 48($sp) # internal_5 = result of function_out_string_at_IO + sw $v1, 88($sp) # internal_9 = result of internal_11 addi $sp, $sp, 12 # Freeing space for arguments # Allocating Bool 0 @@ -1419,41 +1622,65 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_7 = address of allocated object Int + sw $v0, 60($sp) # internal_13 = address of allocated object Int - # Allocating NUll to internal_6 - sw $zero, 32($sp) # internal_6 = 0 + # Allocating NUll to internal_12 + sw $zero, 64($sp) # internal_12 = 0 # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 72($sp) + lw $t0, 128($sp) sw $t0, 4($sp) # Storing self - # Argument self - lw $t0, 72($sp) - sw $t0, 0($sp) # Storing self + # Argument internal_12 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_12 # Calling function function_equal jal function_equal lw $ra, 8($sp) - sw $v1, 40($sp) # internal_7 = result of function_equal + sw $v1, 72($sp) # internal_13 = result of function_equal addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_15 = address of allocated object Int + + # Get method type_name of Bool + lw $t0, 60($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 52($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 48($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_7 - lw $t0, 36($sp) - sw $t0, 0($sp) # Storing internal_7 + # Argument internal_13 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_13 - # Calling function function_type_name_at_Object - jal function_type_name_at_Object + # Calling function internal_16 + lw $t0, 56($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 32($sp) # internal_8 = result of function_type_name_at_Object + sw $v1, 64($sp) # internal_14 = result of internal_16 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int 1 @@ -1466,7 +1693,7 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 20($sp) # internal_9 = address of allocated object Int + sw $v0, 44($sp) # internal_17 = address of allocated object Int # Allocating Int 3 li $v0, 9 @@ -1478,46 +1705,94 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 3 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 16($sp) # internal_10 = address of allocated object Int + sw $v0, 40($sp) # internal_18 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_20 = address of allocated object Int + + # Get method substr of String + lw $t0, 56($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 32($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 28($sp) # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address - # Argument internal_8 - lw $t0, 40($sp) - sw $t0, 8($sp) # Storing internal_8 + # Argument internal_14 + lw $t0, 72($sp) + sw $t0, 8($sp) # Storing internal_14 - # Argument internal_9 - lw $t0, 36($sp) - sw $t0, 4($sp) # Storing internal_9 + # Argument internal_17 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing internal_17 - # Argument internal_10 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_10 + # Argument internal_18 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_18 - # Calling function function_substr_at_String - jal function_substr_at_String + # Calling function internal_21 + lw $t0, 44($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 28($sp) # internal_11 = result of function_substr_at_String + sw $v1, 52($sp) # internal_19 = result of internal_21 addi $sp, $sp, 16 # Freeing space for arguments + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_23 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 76($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_5 - lw $t0, 48($sp) - sw $t0, 4($sp) # Storing internal_5 + # Argument internal_9 + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing internal_9 - # Argument internal_11 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_11 + # Argument internal_19 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_19 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_24 + lw $t0, 28($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 20($sp) # internal_12 = result of function_out_string_at_IO + sw $v1, 36($sp) # internal_22 = result of internal_24 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -1532,41 +1807,65 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_13[0] = '\n' + sb $t0, 8($v0) # internal_25[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_13 = "\n" + sw $v0, 12($sp) # internal_25 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_27 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 116($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 72($sp) + lw $t0, 128($sp) sw $t0, 4($sp) # Storing self - # Argument internal_13 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_13 + # Argument internal_25 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_25 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_28 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_14 = result of function_out_string_at_IO + sw $v1, 20($sp) # internal_26 = result of internal_28 addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 60 + addi $sp, $sp, 116 jr $ra main: # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Allocating Main li $v0, 9 @@ -1575,34 +1874,58 @@ la $t0, type_Main # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object Main + sw $v0, 12($sp) # internal_0 = address of allocated object Main # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_Main jal function___init___at_Main lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_main_at_Main - jal function_main_at_Main + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + sw $v1, 16($sp) # internal_1 = result of internal_3 addi $sp, $sp, 8 # Freeing space for arguments # Exit program diff --git a/tests/codegen/sort-list.mips b/tests/codegen/sort-list.mips index f930284e5..5f6e839af 100644 --- a/tests/codegen/sort-list.mips +++ b/tests/codegen/sort-list.mips @@ -1,66 +1,155 @@ .data - type_Object: .word 8 + type_Object: .word 24 type_Object_inherits_from: .word 0 - type_Object_attributes: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_List: .word 76 + type_List_inherits_from: .word type_IO + type_List_name_address: .word type_List_name_size + type_List___init__: .word function___init___at_List + type_List_abort: .word function_abort_at_Object + type_List_type_name: .word function_type_name_at_Object + type_List_copy: .word function_copy_at_Object + type_List_out_string: .word function_out_string_at_IO + type_List_out_int: .word function_out_int_at_IO + type_List_in_string: .word function_in_string_at_IO + type_List_in_int: .word function_in_int_at_IO + type_List_isNil: .word function_isNil_at_List + type_List_cons: .word function_cons_at_List + type_List_car: .word function_car_at_List + type_List_cdr: .word function_cdr_at_List + type_List_rev: .word function_rev_at_List + type_List_sort: .word function_sort_at_List + type_List_insert: .word function_insert_at_List + type_List_rcons: .word function_rcons_at_List + type_List_print_list: .word function_print_list_at_List + + type_Cons: .word 88 + type_Cons_inherits_from: .word type_List + type_Cons_name_address: .word type_Cons_name_size + type_Cons___init__: .word function___init___at_Cons + type_Cons_abort: .word function_abort_at_Object + type_Cons_type_name: .word function_type_name_at_Object + type_Cons_copy: .word function_copy_at_Object + type_Cons_out_string: .word function_out_string_at_IO + type_Cons_out_int: .word function_out_int_at_IO + type_Cons_in_string: .word function_in_string_at_IO + type_Cons_in_int: .word function_in_int_at_IO + type_Cons_isNil: .word function_isNil_at_Cons + type_Cons_cons: .word function_cons_at_List + type_Cons_car: .word function_car_at_Cons + type_Cons_cdr: .word function_cdr_at_Cons + type_Cons_rev: .word function_rev_at_Cons + type_Cons_sort: .word function_sort_at_Cons + type_Cons_insert: .word function_insert_at_Cons + type_Cons_rcons: .word function_rcons_at_Cons + type_Cons_print_list: .word function_print_list_at_Cons + type_Cons_init: .word function_init_at_Cons + + type_Nil: .word 76 + type_Nil_inherits_from: .word type_List + type_Nil_name_address: .word type_Nil_name_size + type_Nil___init__: .word function___init___at_Nil + type_Nil_abort: .word function_abort_at_Object + type_Nil_type_name: .word function_type_name_at_Object + type_Nil_copy: .word function_copy_at_Object + type_Nil_out_string: .word function_out_string_at_IO + type_Nil_out_int: .word function_out_int_at_IO + type_Nil_in_string: .word function_in_string_at_IO + type_Nil_in_int: .word function_in_int_at_IO + type_Nil_isNil: .word function_isNil_at_Nil + type_Nil_cons: .word function_cons_at_List + type_Nil_car: .word function_car_at_List + type_Nil_cdr: .word function_cdr_at_List + type_Nil_rev: .word function_rev_at_Nil + type_Nil_sort: .word function_sort_at_Nil + type_Nil_insert: .word function_insert_at_Nil + type_Nil_rcons: .word function_rcons_at_Nil + type_Nil_print_list: .word function_print_list_at_Nil + + type_Main: .word 52 + type_Main_inherits_from: .word type_IO + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_out_string: .word function_out_string_at_IO + type_Main_out_int: .word function_out_int_at_IO + type_Main_in_string: .word function_in_string_at_IO + type_Main_in_int: .word function_in_int_at_IO + type_Main_iota: .word function_iota_at_Main + type_Main_main: .word function_main_at_Main + type_Object_name_size: .word 6 type_Object_name: .asciiz "Object" - type_Object_abort_message: .asciiz "Abort called from class Object\n" - type_IO: .word 8 - type_IO_inherits_from: .word type_Object - type_IO_attributes: .word 0 type_IO_name_size: .word 2 type_IO_name: .asciiz "IO" - type_IO_abort_message: .asciiz "Abort called from class IO\n" - - type_Int: .word 8 - type_Int_inherits_from: .word type_Object - type_Int_attributes: .word 0 - type_Int_name_size: .word 3 - type_Int_name: .asciiz "Int" - type_Int_abort_message: .asciiz "Abort called from class Int\n" - type_String: .word 8 - type_String_inherits_from: .word type_Object - type_String_attributes: .word 0 type_String_name_size: .word 6 type_String_name: .asciiz "String" - type_String_abort_message: .asciiz "Abort called from class String\n" - type_Bool: .word 8 - type_Bool_inherits_from: .word type_Object - type_Bool_attributes: .word 0 + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + type_Bool_name_size: .word 4 type_Bool_name: .asciiz "Bool" - type_Bool_abort_message: .asciiz "Abort called from class Bool\n" - type_List: .word 8 - type_List_inherits_from: .word type_IO - type_List_attributes: .word 0 type_List_name_size: .word 4 type_List_name: .asciiz "List" - type_List_abort_message: .asciiz "Abort called from class List\n" - type_Cons: .word 16 - type_Cons_inherits_from: .word type_List - type_Cons_attributes: .word 2 type_Cons_name_size: .word 4 type_Cons_name: .asciiz "Cons" - type_Cons_abort_message: .asciiz "Abort called from class Cons\n" - type_Nil: .word 8 - type_Nil_inherits_from: .word type_List - type_Nil_attributes: .word 0 type_Nil_name_size: .word 3 type_Nil_name: .asciiz "Nil" - type_Nil_abort_message: .asciiz "Abort called from class Nil\n" - type_Main: .word 12 - type_Main_inherits_from: .word type_IO - type_Main_attributes: .word 1 type_Main_name_size: .word 4 type_Main_name: .asciiz "Main" - type_Main_abort_message: .asciiz "Abort called from class Main\n" buffer_input: .space 1024 debug_log: .asciiz "debug_log\n" @@ -721,11 +810,11 @@ function_abort_at_Object: # Function parameters - # $ra = 20($sp) - # self = 16($sp) + # $ra = 28($sp) + # self = 24($sp) # Reserving space for local variables - addi $sp, $sp, -16 + addi $sp, $sp, -24 # Allocating String li $v0, 9 @@ -812,7 +901,7 @@ sb $zero, 32($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_0 = "Abort called from class " + sw $v0, 20($sp) # internal_0 = "Abort called from class " # Allocating String li $v0, 9 @@ -826,66 +915,138 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_2[0] = '\n' + sb $t0, 8($v0) # internal_3[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 4($sp) # internal_2 = "\n" + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 0($sp) # Storing self - # Calling function function_type_name_at_Object - jal function_type_name_at_Object + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_type_name_at_Object + sw $v1, 24($sp) # internal_1 = result of internal_5 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_0 - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing internal_0 # Argument internal_1 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 0($sp) # Storing internal_1 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_3 - lw $t0, 12($sp) - sw $t0, 4($sp) # Storing internal_3 - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 - # Calling function function_concat_at_String - jal function_concat_at_String + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_concat_at_String + sw $v1, 24($sp) # internal_2 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments - lw $t0, 0($sp) # $t0 = internal_3 + lw $t0, 12($sp) # $t0 = internal_2 addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string internal_3 + # Printing the String internal_2 li $v0, 4 move $a0, $t0 syscall @@ -895,10 +1056,10 @@ syscall # Loading return value in $v1 - lw $v1, 16($sp) + lw $v1, 24($sp) # Freeing space for local variables - addi $sp, $sp, 16 + addi $sp, $sp, 24 jr $ra @@ -913,8 +1074,9 @@ # internal_0 = name of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($t0) # $t1 = type of self - lw $t2, 12($t1) # $t1 = length of the name of self - la $t3, 16($t1) # $t1 = name of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name addi $t2, $t2, 9 # Setting space for the type, the size and the null byte li $v0, 9 @@ -1017,7 +1179,7 @@ lw $t0, 0($sp) # $t0 = x addi $t0, $t0, 8 # Pointer to the first character of the string - # Printing the string x + # Printing the String x li $v0, 4 move $a0, $t0 syscall @@ -1033,7 +1195,7 @@ # self = 4($sp) # x = 0($sp) - # Printing the string x + # Printing the Int x li $v0, 1 lw $a0, 0($sp) lw $a0, 8($a0) @@ -1060,11 +1222,13 @@ xor $t0, $t0, $t0 # Initializing counter while_read_start: lb $t1, buffer_input($t0) # Loading the byte - beq $t1, $zero, while_read_end + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end addi $t0, $t0, 1 # Incrementing counter j while_read_start while_read_end: - addi $t0, $t0, -1 # Decrementing counter to eliminate the '\n' addi $t0, $t0, 9 # Adding space for the type, the size and the null byte li $v0, 9 @@ -1316,18 +1480,6 @@ # $ra = 4($sp) # self = 0($sp) - # Allocating Int 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Int # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # self = address of allocated object Int - # Loading return value in $v1 lw $v1, 0($sp) @@ -1338,18 +1490,6 @@ # $ra = 4($sp) # self = 0($sp) - # Allocating Bool 0 - li $v0, 9 - addi $a0, $zero, 12 - syscall - - la $t0, type_Bool # $t0 = address of the type - sw $t0, 0($v0) # Setting type in the first word of the object - sw $a0, 4($v0) # Setting size in the second word of the object - addi $t0, $zero, 0 - sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # self = address of allocated object Int - # Loading return value in $v1 lw $v1, 0($sp) @@ -1367,24 +1507,48 @@ function_isNil_at_List: # Function parameters - # $ra = 12($sp) - # self = 8($sp) + # $ra = 20($sp) + # self = 16($sp) # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_1 = address of allocated object Int + + # Get method abort of List + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 0($sp) # Storing self - # Calling function function_abort_at_Object - jal function_abort_at_Object + # Calling function internal_2 + lw $t0, 12($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function_abort_at_Object + sw $v1, 20($sp) # internal_0 = result of internal_2 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Bool 1 @@ -1397,24 +1561,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 0($sp) # internal_1 = address of allocated object Int + sw $v0, 0($sp) # internal_3 = address of allocated object Int # Loading return value in $v1 lw $v1, 0($sp) # Freeing space for local variables - addi $sp, $sp, 8 + addi $sp, $sp, 16 jr $ra function_cons_at_List: # Function parameters - # $ra = 20($sp) - # self = 16($sp) - # hd = 12($sp) + # $ra = 28($sp) + # self = 24($sp) + # hd = 20($sp) # Reserving space for local variables - addi $sp, $sp, -12 + addi $sp, $sp, -20 # Allocating Cons li $v0, 9 @@ -1423,20 +1587,20 @@ la $t0, type_Cons # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_1 = address of allocated object Cons + sw $v0, 12($sp) # internal_1 = address of allocated object Cons # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_1 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function___init___at_Cons jal function___init___at_Cons lw $ra, 4($sp) - sw $v1, 12($sp) # internal_1 = result of function___init___at_Cons + sw $v1, 20($sp) # internal_1 = result of function___init___at_Cons addi $sp, $sp, 8 # Freeing space for arguments # Passing function arguments @@ -1444,69 +1608,117 @@ sw $ra, 8($sp) # Storing return address # Argument new_cell - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 4($sp) # Storing new_cell # Argument internal_1 - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 0($sp) # Storing internal_1 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 20($sp) # new_cell = result of function_assign + sw $v1, 28($sp) # new_cell = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 17 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 17 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_3 = address of allocated object Int + + # Get method init of Cons + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument new_cell - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 8($sp) # Storing new_cell # Argument hd - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t0, 4($sp) # Storing hd # Argument self - lw $t0, 32($sp) + lw $t0, 40($sp) sw $t0, 0($sp) # Storing self - # Calling function function_init_at_Cons - jal function_init_at_Cons + # Calling function internal_4 + lw $t0, 16($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 16($sp) # internal_2 = result of function_init_at_Cons + sw $v1, 24($sp) # internal_2 = result of internal_4 addi $sp, $sp, 16 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 12 + addi $sp, $sp, 20 jr $ra function_car_at_List: # Function parameters - # $ra = 12($sp) - # self = 8($sp) + # $ra = 20($sp) + # self = 16($sp) # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_1 = address of allocated object Int + + # Get method abort of List + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 0($sp) # Storing self - # Calling function function_abort_at_Object - jal function_abort_at_Object + # Calling function internal_2 + lw $t0, 12($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function_abort_at_Object + sw $v1, 20($sp) # internal_0 = result of internal_2 addi $sp, $sp, 8 # Freeing space for arguments # Allocating Int @@ -1516,50 +1728,74 @@ la $t0, type_Int # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 0($sp) # internal_1 = address of allocated object Int + sw $v0, 0($sp) # internal_3 = address of allocated object Int # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_1 + # Argument internal_3 lw $t0, 8($sp) - sw $t0, 0($sp) # Storing internal_1 + sw $t0, 0($sp) # Storing internal_3 # Calling function function___init___at_Int jal function___init___at_Int lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function___init___at_Int + sw $v1, 8($sp) # internal_3 = result of function___init___at_Int addi $sp, $sp, 8 # Freeing space for arguments # Loading return value in $v1 lw $v1, 0($sp) # Freeing space for local variables - addi $sp, $sp, 8 + addi $sp, $sp, 16 jr $ra function_cdr_at_List: # Function parameters - # $ra = 12($sp) - # self = 8($sp) + # $ra = 20($sp) + # self = 16($sp) # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_1 = address of allocated object Int + + # Get method abort of List + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 0($sp) # Storing self - # Calling function function_abort_at_Object - jal function_abort_at_Object + # Calling function internal_2 + lw $t0, 12($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function_abort_at_Object + sw $v1, 20($sp) # internal_0 = result of internal_2 addi $sp, $sp, 8 # Freeing space for arguments # Allocating List @@ -1569,179 +1805,299 @@ la $t0, type_List # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 0($sp) # internal_1 = address of allocated object List + sw $v0, 0($sp) # internal_3 = address of allocated object List # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_1 + # Argument internal_3 lw $t0, 8($sp) - sw $t0, 0($sp) # Storing internal_1 + sw $t0, 0($sp) # Storing internal_3 # Calling function function___init___at_List jal function___init___at_List lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function___init___at_List + sw $v1, 8($sp) # internal_3 = result of function___init___at_List addi $sp, $sp, 8 # Freeing space for arguments # Loading return value in $v1 lw $v1, 0($sp) # Freeing space for local variables - addi $sp, $sp, 8 + addi $sp, $sp, 16 jr $ra function_rev_at_List: # Function parameters - # $ra = 8($sp) - # self = 4($sp) + # $ra = 16($sp) + # self = 12($sp) # Reserving space for local variables - addi $sp, $sp, -4 + addi $sp, $sp, -12 + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + # Get method cdr of List + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing self - # Calling function function_cdr_at_List - jal function_cdr_at_List + # Calling function internal_2 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_0 = result of function_cdr_at_List + sw $v1, 16($sp) # internal_0 = result of internal_2 addi $sp, $sp, 8 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 4 + addi $sp, $sp, 12 jr $ra function_sort_at_List: # Function parameters - # $ra = 8($sp) - # self = 4($sp) + # $ra = 16($sp) + # self = 12($sp) # Reserving space for local variables - addi $sp, $sp, -4 + addi $sp, $sp, -12 + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + # Get method cdr of List + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing self - # Calling function function_cdr_at_List - jal function_cdr_at_List + # Calling function internal_2 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_0 = result of function_cdr_at_List + sw $v1, 16($sp) # internal_0 = result of internal_2 addi $sp, $sp, 8 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 4 + addi $sp, $sp, 12 jr $ra function_insert_at_List: # Function parameters - # $ra = 12($sp) - # self = 8($sp) - # i = 4($sp) + # $ra = 20($sp) + # self = 16($sp) + # i = 12($sp) # Reserving space for local variables - addi $sp, $sp, -4 + addi $sp, $sp, -12 + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + # Get method cdr of List + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 0($sp) # Storing self - # Calling function function_cdr_at_List - jal function_cdr_at_List + # Calling function internal_2 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_0 = result of function_cdr_at_List + sw $v1, 16($sp) # internal_0 = result of internal_2 addi $sp, $sp, 8 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 4 + addi $sp, $sp, 12 jr $ra function_rcons_at_List: # Function parameters - # $ra = 12($sp) - # self = 8($sp) - # i = 4($sp) + # $ra = 20($sp) + # self = 16($sp) + # i = 12($sp) # Reserving space for local variables - addi $sp, $sp, -4 + addi $sp, $sp, -12 + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + # Get method cdr of List + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 0($sp) # Storing self - # Calling function function_cdr_at_List - jal function_cdr_at_List + # Calling function internal_2 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_0 = result of function_cdr_at_List + sw $v1, 16($sp) # internal_0 = result of internal_2 addi $sp, $sp, 8 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 4 + addi $sp, $sp, 12 jr $ra function_print_list_at_List: # Function parameters - # $ra = 8($sp) - # self = 4($sp) + # $ra = 16($sp) + # self = 12($sp) # Reserving space for local variables - addi $sp, $sp, -4 + addi $sp, $sp, -12 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + # Get method abort of List + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing self - # Calling function function_abort_at_Object - jal function_abort_at_Object + # Calling function internal_2 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_0 = result of function_abort_at_Object + sw $v1, 16($sp) # internal_0 = result of internal_2 addi $sp, $sp, 8 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 4 + addi $sp, $sp, 12 jr $ra @@ -1768,17 +2124,17 @@ # Set attribute xcar of self lw $t0, 8($sp) # $t0 = self lw $t1, 4($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8775953324198 + beq $t1, $zero, object_set_attribute_8776576596306 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8775953324198 + beq $t6, $t5, int_set_attribute_8776576596306 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8775953324198 - j object_set_attribute_8775953324198 - int_set_attribute_8775953324198: + beq $t6, $t5, bool_set_attribute_8776576596306 + j object_set_attribute_8776576596306 + int_set_attribute_8776576596306: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1787,8 +2143,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.xcar = internal_0 - j end_set_attribute_8775953324198 - bool_set_attribute_8775953324198: + j end_set_attribute_8776576596306 + bool_set_attribute_8776576596306: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1797,10 +2153,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.xcar = internal_0 - j end_set_attribute_8775953324198 - object_set_attribute_8775953324198: + j end_set_attribute_8776576596306 + object_set_attribute_8776576596306: sw $t1, 8($t0) # self.xcar = internal_0 - end_set_attribute_8775953324198: + end_set_attribute_8776576596306: # Allocating NUll to internal_1 sw $zero, 0($sp) # internal_1 = 0 @@ -1808,17 +2164,17 @@ # Set attribute xcdr of self lw $t0, 8($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_1 - beq $t1, $zero, object_set_attribute_8775953324219 + beq $t1, $zero, object_set_attribute_8776576596234 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8775953324219 + beq $t6, $t5, int_set_attribute_8776576596234 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8775953324219 - j object_set_attribute_8775953324219 - int_set_attribute_8775953324219: + beq $t6, $t5, bool_set_attribute_8776576596234 + j object_set_attribute_8776576596234 + int_set_attribute_8776576596234: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1827,8 +2183,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.xcdr = internal_1 - j end_set_attribute_8775953324219 - bool_set_attribute_8775953324219: + j end_set_attribute_8776576596234 + bool_set_attribute_8776576596234: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1837,10 +2193,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.xcdr = internal_1 - j end_set_attribute_8775953324219 - object_set_attribute_8775953324219: + j end_set_attribute_8776576596234 + object_set_attribute_8776576596234: sw $t1, 12($t0) # self.xcdr = internal_1 - end_set_attribute_8775953324219: + end_set_attribute_8776576596234: # Loading return value in $v1 lw $v1, 8($sp) @@ -1888,17 +2244,17 @@ # Set attribute xcar of self lw $t0, 8($sp) # $t0 = self lw $t1, 4($sp) # $t1 = hd - beq $t1, $zero, object_set_attribute_8775953325584 + beq $t1, $zero, object_set_attribute_8776576595607 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8775953325584 + beq $t6, $t5, int_set_attribute_8776576595607 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8775953325584 - j object_set_attribute_8775953325584 - int_set_attribute_8775953325584: + beq $t6, $t5, bool_set_attribute_8776576595607 + j object_set_attribute_8776576595607 + int_set_attribute_8776576595607: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1907,8 +2263,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.xcar = hd - j end_set_attribute_8775953325584 - bool_set_attribute_8775953325584: + j end_set_attribute_8776576595607 + bool_set_attribute_8776576595607: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1917,25 +2273,25 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.xcar = hd - j end_set_attribute_8775953325584 - object_set_attribute_8775953325584: + j end_set_attribute_8776576595607 + object_set_attribute_8776576595607: sw $t1, 8($t0) # self.xcar = hd - end_set_attribute_8775953325584: + end_set_attribute_8776576595607: # Set attribute xcdr of self lw $t0, 8($sp) # $t0 = self lw $t1, 0($sp) # $t1 = tl - beq $t1, $zero, object_set_attribute_8775953325593 + beq $t1, $zero, object_set_attribute_8776576595502 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8775953325593 + beq $t6, $t5, int_set_attribute_8776576595502 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8775953325593 - j object_set_attribute_8775953325593 - int_set_attribute_8775953325593: + beq $t6, $t5, bool_set_attribute_8776576595502 + j object_set_attribute_8776576595502 + int_set_attribute_8776576595502: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1944,8 +2300,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.xcdr = tl - j end_set_attribute_8775953325593 - bool_set_attribute_8775953325593: + j end_set_attribute_8776576595502 + bool_set_attribute_8776576595502: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1954,10 +2310,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 12($t0) # self.xcdr = tl - j end_set_attribute_8775953325593 - object_set_attribute_8775953325593: + j end_set_attribute_8776576595502 + object_set_attribute_8776576595502: sw $t1, 12($t0) # self.xcdr = tl - end_set_attribute_8775953325593: + end_set_attribute_8776576595502: # Loading return value in $v1 lw $v1, 8($sp) @@ -1974,17 +2330,17 @@ # Get attribute xcar of self lw $t0, 4($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'xcar' from the instance + lw $t1, 8($t0) # Get the attribute 'xcar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8775953325605 + beq $t6, $t5, int_get_attribute_8776576595523 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8775953325605 - j object_get_attribute_8775953325605 - int_get_attribute_8775953325605: + beq $t6, $t5, bool_get_attribute_8776576595523 + j object_get_attribute_8776576595523 + int_get_attribute_8776576595523: li $v0, 9 addi $a0, $zero, 12 syscall @@ -1993,8 +2349,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 0($sp) # internal_0 = self.xcar - j end_get_attribute_8775953325605 - bool_get_attribute_8775953325605: + j end_get_attribute_8776576595523 + bool_get_attribute_8776576595523: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2003,10 +2359,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 0($sp) # internal_0 = self.xcar - j end_get_attribute_8775953325605 - object_get_attribute_8775953325605: - sw $t1, 0($sp) # internal_0 = xcar - end_get_attribute_8775953325605: + j end_get_attribute_8776576595523 + object_get_attribute_8776576595523: + sw $t1, 0($sp) # internal_0 = self.xcar + end_get_attribute_8776576595523: # Loading return value in $v1 lw $v1, 0($sp) @@ -2026,17 +2382,17 @@ # Get attribute xcdr of self lw $t0, 4($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'xcdr' from the instance + lw $t1, 12($t0) # Get the attribute 'xcdr' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8775953313320 + beq $t6, $t5, int_get_attribute_8776576595565 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8775953313320 - j object_get_attribute_8775953313320 - int_get_attribute_8775953313320: + beq $t6, $t5, bool_get_attribute_8776576595565 + j object_get_attribute_8776576595565 + int_get_attribute_8776576595565: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2045,8 +2401,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 0($sp) # internal_0 = self.xcdr - j end_get_attribute_8775953313320 - bool_get_attribute_8775953313320: + j end_get_attribute_8776576595565 + bool_get_attribute_8776576595565: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2055,10 +2411,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 0($sp) # internal_0 = self.xcdr - j end_get_attribute_8775953313320 - object_get_attribute_8775953313320: - sw $t1, 0($sp) # internal_0 = xcdr - end_get_attribute_8775953313320: + j end_get_attribute_8776576595565 + object_get_attribute_8776576595565: + sw $t1, 0($sp) # internal_0 = self.xcdr + end_get_attribute_8776576595565: # Loading return value in $v1 lw $v1, 0($sp) @@ -2070,25 +2426,25 @@ function_rev_at_Cons: # Function parameters - # $ra = 20($sp) - # self = 16($sp) + # $ra = 36($sp) + # self = 32($sp) # Reserving space for local variables - addi $sp, $sp, -16 + addi $sp, $sp, -32 # Get attribute xcdr of self - lw $t0, 16($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'xcdr' from the instance + lw $t0, 32($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'xcdr' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8775953311034 + beq $t6, $t5, int_get_attribute_8776576593830 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8775953311034 - j object_get_attribute_8775953311034 - int_get_attribute_8775953311034: + beq $t6, $t5, bool_get_attribute_8776576593830 + j object_get_attribute_8776576593830 + int_get_attribute_8776576593830: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2096,9 +2452,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_0 = self.xcdr - j end_get_attribute_8775953311034 - bool_get_attribute_8775953311034: + sw $v0, 28($sp) # internal_0 = self.xcdr + j end_get_attribute_8776576593830 + bool_get_attribute_8776576593830: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2106,39 +2462,63 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_0 = self.xcdr - j end_get_attribute_8775953311034 - object_get_attribute_8775953311034: - sw $t1, 12($sp) # internal_0 = xcdr - end_get_attribute_8775953311034: + sw $v0, 28($sp) # internal_0 = self.xcdr + j end_get_attribute_8776576593830 + object_get_attribute_8776576593830: + sw $t1, 28($sp) # internal_0 = self.xcdr + end_get_attribute_8776576593830: + + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_2 = address of allocated object Int + + # Get method rev of List + lw $t0, 28($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 20($sp) + lw $t0, 36($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_rev_at_List - jal function_rev_at_List + # Calling function internal_3 + lw $t0, 24($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_rev_at_List + sw $v1, 32($sp) # internal_1 = result of internal_3 addi $sp, $sp, 8 # Freeing space for arguments # Get attribute xcar of self - lw $t0, 16($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'xcar' from the instance + lw $t0, 32($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8775953311037 + beq $t6, $t5, int_get_attribute_8776576593896 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8775953311037 - j object_get_attribute_8775953311037 - int_get_attribute_8775953311037: + beq $t6, $t5, bool_get_attribute_8776576593896 + j object_get_attribute_8776576593896 + int_get_attribute_8776576593896: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2146,9 +2526,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_2 = self.xcar - j end_get_attribute_8775953311037 - bool_get_attribute_8775953311037: + sw $v0, 12($sp) # internal_4 = self.xcar + j end_get_attribute_8776576593896 + bool_get_attribute_8776576593896: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2156,59 +2536,83 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_2 = self.xcar - j end_get_attribute_8775953311037 - object_get_attribute_8775953311037: - sw $t1, 4($sp) # internal_2 = xcar - end_get_attribute_8775953311037: + sw $v0, 12($sp) # internal_4 = self.xcar + j end_get_attribute_8776576593896 + object_get_attribute_8776576593896: + sw $t1, 12($sp) # internal_4 = self.xcar + end_get_attribute_8776576593896: + + # Allocating Int 15 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 15 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Get method rcons of List + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_1 - lw $t0, 20($sp) + lw $t0, 36($sp) sw $t0, 4($sp) # Storing internal_1 - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_2 + # Argument internal_4 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_4 - # Calling function function_rcons_at_List - jal function_rcons_at_List + # Calling function internal_7 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_rcons_at_List + sw $v1, 20($sp) # internal_5 = result of internal_7 addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 16 + addi $sp, $sp, 32 jr $ra function_sort_at_Cons: # Function parameters - # $ra = 20($sp) - # self = 16($sp) + # $ra = 36($sp) + # self = 32($sp) # Reserving space for local variables - addi $sp, $sp, -16 + addi $sp, $sp, -32 # Get attribute xcdr of self - lw $t0, 16($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'xcdr' from the instance + lw $t0, 32($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'xcdr' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8775953310980 + beq $t6, $t5, int_get_attribute_8776576576431 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8775953310980 - j object_get_attribute_8775953310980 - int_get_attribute_8775953310980: + beq $t6, $t5, bool_get_attribute_8776576576431 + j object_get_attribute_8776576576431 + int_get_attribute_8776576576431: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2216,9 +2620,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_0 = self.xcdr - j end_get_attribute_8775953310980 - bool_get_attribute_8775953310980: + sw $v0, 28($sp) # internal_0 = self.xcdr + j end_get_attribute_8776576576431 + bool_get_attribute_8776576576431: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2226,39 +2630,63 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_0 = self.xcdr - j end_get_attribute_8775953310980 - object_get_attribute_8775953310980: - sw $t1, 12($sp) # internal_0 = xcdr - end_get_attribute_8775953310980: + sw $v0, 28($sp) # internal_0 = self.xcdr + j end_get_attribute_8776576576431 + object_get_attribute_8776576576431: + sw $t1, 28($sp) # internal_0 = self.xcdr + end_get_attribute_8776576576431: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_2 = address of allocated object Int + + # Get method sort of List + lw $t0, 28($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 20($sp) + lw $t0, 36($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_sort_at_List - jal function_sort_at_List + # Calling function internal_3 + lw $t0, 24($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 16($sp) # internal_1 = result of function_sort_at_List + sw $v1, 32($sp) # internal_1 = result of internal_3 addi $sp, $sp, 8 # Freeing space for arguments # Get attribute xcar of self - lw $t0, 16($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'xcar' from the instance + lw $t0, 32($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8775953310570 + beq $t6, $t5, int_get_attribute_8776576576476 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8775953310570 - j object_get_attribute_8775953310570 - int_get_attribute_8775953310570: + beq $t6, $t5, bool_get_attribute_8776576576476 + j object_get_attribute_8776576576476 + int_get_attribute_8776576576476: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2266,9 +2694,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_2 = self.xcar - j end_get_attribute_8775953310570 - bool_get_attribute_8775953310570: + sw $v0, 12($sp) # internal_4 = self.xcar + j end_get_attribute_8776576576476 + bool_get_attribute_8776576576476: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2276,46 +2704,70 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_2 = self.xcar - j end_get_attribute_8775953310570 - object_get_attribute_8775953310570: - sw $t1, 4($sp) # internal_2 = xcar - end_get_attribute_8775953310570: + sw $v0, 12($sp) # internal_4 = self.xcar + j end_get_attribute_8776576576476 + object_get_attribute_8776576576476: + sw $t1, 12($sp) # internal_4 = self.xcar + end_get_attribute_8776576576476: + + # Allocating Int 14 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 14 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Get method insert of List + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_1 - lw $t0, 20($sp) + lw $t0, 36($sp) sw $t0, 4($sp) # Storing internal_1 - # Argument internal_2 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_2 + # Argument internal_4 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_4 - # Calling function function_insert_at_List - jal function_insert_at_List + # Calling function internal_7 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_3 = result of function_insert_at_List + sw $v1, 20($sp) # internal_5 = result of internal_7 addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 16 + addi $sp, $sp, 32 jr $ra function_insert_at_Cons: # Function parameters - # $ra = 52($sp) - # self = 48($sp) - # i = 44($sp) + # $ra = 76($sp) + # self = 72($sp) + # i = 68($sp) # Reserving space for local variables - addi $sp, $sp, -44 + addi $sp, $sp, -68 # Allocating Bool 0 li $v0, 9 @@ -2327,21 +2779,21 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 36($sp) # internal_1 = address of allocated object Int + sw $v0, 60($sp) # internal_1 = address of allocated object Int # Get attribute xcar of self - lw $t0, 48($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'xcar' from the instance + lw $t0, 72($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8775953310642 + beq $t6, $t5, int_get_attribute_8776576575829 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8775953310642 - j object_get_attribute_8775953310642 - int_get_attribute_8775953310642: + beq $t6, $t5, bool_get_attribute_8776576575829 + j object_get_attribute_8776576575829 + int_get_attribute_8776576575829: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2349,9 +2801,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 32($sp) # internal_2 = self.xcar - j end_get_attribute_8775953310642 - bool_get_attribute_8775953310642: + sw $v0, 56($sp) # internal_2 = self.xcar + j end_get_attribute_8776576575829 + bool_get_attribute_8776576575829: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2359,44 +2811,44 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 32($sp) # internal_2 = self.xcar - j end_get_attribute_8775953310642 - object_get_attribute_8775953310642: - sw $t1, 32($sp) # internal_2 = xcar - end_get_attribute_8775953310642: + sw $v0, 56($sp) # internal_2 = self.xcar + j end_get_attribute_8776576575829 + object_get_attribute_8776576575829: + sw $t1, 56($sp) # internal_2 = self.xcar + end_get_attribute_8776576575829: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument i - lw $t0, 56($sp) + lw $t0, 80($sp) sw $t0, 4($sp) # Storing i # Argument internal_2 - lw $t0, 44($sp) + lw $t0, 68($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 40($sp) # internal_3 = result of function_less_than + sw $v1, 64($sp) # internal_3 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments # internal_1 = internal_3 - lw $t0, 28($sp) - sw $t0, 36($sp) + lw $t0, 52($sp) + sw $t0, 60($sp) - # If internal_1 then goto then_8775953337375 - lw $t0, 36($sp) # Loading the address of the condition + # If internal_1 then goto then_8776576620171 + lw $t0, 60($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, then_8775953337375 + beq $t0, $t1, then_8776576620171 - # Jumping to else_8775953337375 - j else_8775953337375 + # Jumping to else_8776576620171 + j else_8776576620171 - then_8775953337375: + then_8776576620171: # Allocating Cons li $v0, 9 @@ -2405,52 +2857,76 @@ la $t0, type_Cons # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 24($sp) # internal_4 = address of allocated object Cons + sw $v0, 48($sp) # internal_4 = address of allocated object Cons # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_4 - lw $t0, 32($sp) + lw $t0, 56($sp) sw $t0, 0($sp) # Storing internal_4 # Calling function function___init___at_Cons jal function___init___at_Cons lw $ra, 4($sp) - sw $v1, 32($sp) # internal_4 = result of function___init___at_Cons + sw $v1, 56($sp) # internal_4 = result of function___init___at_Cons addi $sp, $sp, 8 # Freeing space for arguments - # Passing function arguments - addi $sp, $sp, -16 # Reserving space for arguments - sw $ra, 12($sp) # Storing return address - + # Allocating Int 17 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 17 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_6 = address of allocated object Int + + # Get method init of Cons + lw $t0, 48($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 40($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 36($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + # Argument internal_4 - lw $t0, 40($sp) + lw $t0, 64($sp) sw $t0, 8($sp) # Storing internal_4 # Argument i - lw $t0, 60($sp) + lw $t0, 84($sp) sw $t0, 4($sp) # Storing i # Argument self - lw $t0, 64($sp) + lw $t0, 88($sp) sw $t0, 0($sp) # Storing self - # Calling function function_init_at_Cons - jal function_init_at_Cons + # Calling function internal_7 + lw $t0, 52($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 36($sp) # internal_5 = result of function_init_at_Cons + sw $v1, 60($sp) # internal_5 = result of internal_7 addi $sp, $sp, 16 # Freeing space for arguments # internal_0 = internal_5 - lw $t0, 20($sp) - sw $t0, 40($sp) + lw $t0, 44($sp) + sw $t0, 64($sp) - # Jumping to endif_8775953337375 - j endif_8775953337375 + # Jumping to endif_8776576620171 + j endif_8776576620171 - else_8775953337375: + else_8776576620171: # Allocating Cons li $v0, 9 @@ -2459,35 +2935,35 @@ la $t0, type_Cons # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 16($sp) # internal_6 = address of allocated object Cons + sw $v0, 32($sp) # internal_8 = address of allocated object Cons # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_6 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_6 + # Argument internal_8 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_8 # Calling function function___init___at_Cons jal function___init___at_Cons lw $ra, 4($sp) - sw $v1, 24($sp) # internal_6 = result of function___init___at_Cons + sw $v1, 40($sp) # internal_8 = result of function___init___at_Cons addi $sp, $sp, 8 # Freeing space for arguments # Get attribute xcar of self - lw $t0, 48($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'xcar' from the instance + lw $t0, 72($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8775953312010 + beq $t6, $t5, int_get_attribute_8776576577817 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8775953312010 - j object_get_attribute_8775953312010 - int_get_attribute_8775953312010: + beq $t6, $t5, bool_get_attribute_8776576577817 + j object_get_attribute_8776576577817 + int_get_attribute_8776576577817: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2495,9 +2971,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_7 = self.xcar - j end_get_attribute_8775953312010 - bool_get_attribute_8775953312010: + sw $v0, 28($sp) # internal_9 = self.xcar + j end_get_attribute_8776576577817 + bool_get_attribute_8776576577817: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2505,25 +2981,25 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_7 = self.xcar - j end_get_attribute_8775953312010 - object_get_attribute_8775953312010: - sw $t1, 12($sp) # internal_7 = xcar - end_get_attribute_8775953312010: + sw $v0, 28($sp) # internal_9 = self.xcar + j end_get_attribute_8776576577817 + object_get_attribute_8776576577817: + sw $t1, 28($sp) # internal_9 = self.xcar + end_get_attribute_8776576577817: # Get attribute xcdr of self - lw $t0, 48($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'xcdr' from the instance + lw $t0, 72($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'xcdr' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8775953309943 + beq $t6, $t5, int_get_attribute_8776576577841 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8775953309943 - j object_get_attribute_8775953309943 - int_get_attribute_8775953309943: + beq $t6, $t5, bool_get_attribute_8776576577841 + j object_get_attribute_8776576577841 + int_get_attribute_8776576577841: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2531,9 +3007,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($sp) # internal_8 = self.xcdr - j end_get_attribute_8775953309943 - bool_get_attribute_8775953309943: + sw $v0, 24($sp) # internal_10 = self.xcdr + j end_get_attribute_8776576577841 + bool_get_attribute_8776576577841: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2541,77 +3017,125 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($sp) # internal_8 = self.xcdr - j end_get_attribute_8775953309943 - object_get_attribute_8775953309943: - sw $t1, 8($sp) # internal_8 = xcdr - end_get_attribute_8775953309943: + sw $v0, 24($sp) # internal_10 = self.xcdr + j end_get_attribute_8776576577841 + object_get_attribute_8776576577841: + sw $t1, 24($sp) # internal_10 = self.xcdr + end_get_attribute_8776576577841: + + # Allocating Int 14 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 14 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_12 = address of allocated object Int + + # Get method insert of List + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address - # Argument internal_8 - lw $t0, 20($sp) - sw $t0, 4($sp) # Storing internal_8 + # Argument internal_10 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_10 # Argument i - lw $t0, 56($sp) + lw $t0, 80($sp) sw $t0, 0($sp) # Storing i - # Calling function function_insert_at_List - jal function_insert_at_List + # Calling function internal_13 + lw $t0, 24($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 16($sp) # internal_9 = result of function_insert_at_List + sw $v1, 32($sp) # internal_11 = result of internal_13 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 17 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 17 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_15 = address of allocated object Int + + # Get method init of Cons + lw $t0, 32($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address - # Argument internal_6 - lw $t0, 32($sp) - sw $t0, 8($sp) # Storing internal_6 - - # Argument internal_7 - lw $t0, 28($sp) - sw $t0, 4($sp) # Storing internal_7 + # Argument internal_8 + lw $t0, 48($sp) + sw $t0, 8($sp) # Storing internal_8 # Argument internal_9 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_9 + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing internal_9 + + # Argument internal_11 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_11 - # Calling function function_init_at_Cons - jal function_init_at_Cons + # Calling function internal_16 + lw $t0, 16($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 16($sp) # internal_10 = result of function_init_at_Cons + sw $v1, 24($sp) # internal_14 = result of internal_16 addi $sp, $sp, 16 # Freeing space for arguments - # internal_0 = internal_10 - lw $t0, 0($sp) - sw $t0, 40($sp) + # internal_0 = internal_14 + lw $t0, 8($sp) + sw $t0, 64($sp) - # Jumping to endif_8775953337375 - j endif_8775953337375 + # Jumping to endif_8776576620171 + j endif_8776576620171 - endif_8775953337375: + endif_8776576620171: # Loading return value in $v1 - lw $v1, 40($sp) + lw $v1, 64($sp) # Freeing space for local variables - addi $sp, $sp, 44 + addi $sp, $sp, 68 jr $ra function_rcons_at_Cons: # Function parameters - # $ra = 28($sp) - # self = 24($sp) - # i = 20($sp) + # $ra = 44($sp) + # self = 40($sp) + # i = 36($sp) # Reserving space for local variables - addi $sp, $sp, -20 + addi $sp, $sp, -36 # Allocating Cons li $v0, 9 @@ -2620,35 +3144,35 @@ la $t0, type_Cons # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 16($sp) # internal_0 = address of allocated object Cons + sw $v0, 32($sp) # internal_0 = address of allocated object Cons # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 24($sp) + lw $t0, 40($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_Cons jal function___init___at_Cons lw $ra, 4($sp) - sw $v1, 24($sp) # internal_0 = result of function___init___at_Cons + sw $v1, 40($sp) # internal_0 = result of function___init___at_Cons addi $sp, $sp, 8 # Freeing space for arguments # Get attribute xcar of self - lw $t0, 24($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'xcar' from the instance + lw $t0, 40($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8775953325722 + beq $t6, $t5, int_get_attribute_8776576578000 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8775953325722 - j object_get_attribute_8775953325722 - int_get_attribute_8775953325722: + beq $t6, $t5, bool_get_attribute_8776576578000 + j object_get_attribute_8776576578000 + int_get_attribute_8776576578000: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2656,9 +3180,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_1 = self.xcar - j end_get_attribute_8775953325722 - bool_get_attribute_8775953325722: + sw $v0, 28($sp) # internal_1 = self.xcar + j end_get_attribute_8776576578000 + bool_get_attribute_8776576578000: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2666,25 +3190,25 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 12($sp) # internal_1 = self.xcar - j end_get_attribute_8775953325722 - object_get_attribute_8775953325722: - sw $t1, 12($sp) # internal_1 = xcar - end_get_attribute_8775953325722: + sw $v0, 28($sp) # internal_1 = self.xcar + j end_get_attribute_8776576578000 + object_get_attribute_8776576578000: + sw $t1, 28($sp) # internal_1 = self.xcar + end_get_attribute_8776576578000: # Get attribute xcdr of self - lw $t0, 24($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'xcdr' from the instance + lw $t0, 40($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'xcdr' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8775953325746 + beq $t6, $t5, int_get_attribute_8776576578024 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8775953325746 - j object_get_attribute_8775953325746 - int_get_attribute_8775953325746: + beq $t6, $t5, bool_get_attribute_8776576578024 + j object_get_attribute_8776576578024 + int_get_attribute_8776576578024: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2692,9 +3216,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($sp) # internal_2 = self.xcdr - j end_get_attribute_8775953325746 - bool_get_attribute_8775953325746: + sw $v0, 24($sp) # internal_2 = self.xcdr + j end_get_attribute_8776576578024 + bool_get_attribute_8776576578024: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2702,81 +3226,129 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($sp) # internal_2 = self.xcdr - j end_get_attribute_8775953325746 - object_get_attribute_8775953325746: - sw $t1, 8($sp) # internal_2 = xcdr - end_get_attribute_8775953325746: + sw $v0, 24($sp) # internal_2 = self.xcdr + j end_get_attribute_8776576578024 + object_get_attribute_8776576578024: + sw $t1, 24($sp) # internal_2 = self.xcdr + end_get_attribute_8776576578024: + + # Allocating Int 15 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 15 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_4 = address of allocated object Int + + # Get method rcons of List + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument internal_2 - lw $t0, 20($sp) + lw $t0, 36($sp) sw $t0, 4($sp) # Storing internal_2 # Argument i - lw $t0, 32($sp) + lw $t0, 48($sp) sw $t0, 0($sp) # Storing i - # Calling function function_rcons_at_List - jal function_rcons_at_List + # Calling function internal_5 + lw $t0, 24($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 16($sp) # internal_3 = result of function_rcons_at_List + sw $v1, 32($sp) # internal_3 = result of internal_5 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 17 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 17 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_7 = address of allocated object Int + + # Get method init of Cons + lw $t0, 32($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument internal_0 - lw $t0, 32($sp) + lw $t0, 48($sp) sw $t0, 8($sp) # Storing internal_0 # Argument internal_1 - lw $t0, 28($sp) + lw $t0, 44($sp) sw $t0, 4($sp) # Storing internal_1 # Argument internal_3 - lw $t0, 20($sp) + lw $t0, 36($sp) sw $t0, 0($sp) # Storing internal_3 - # Calling function function_init_at_Cons - jal function_init_at_Cons + # Calling function internal_8 + lw $t0, 16($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 16($sp) # internal_4 = result of function_init_at_Cons + sw $v1, 24($sp) # internal_6 = result of internal_8 addi $sp, $sp, 16 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 20 + addi $sp, $sp, 36 jr $ra function_print_list_at_Cons: # Function parameters - # $ra = 28($sp) - # self = 24($sp) + # $ra = 52($sp) + # self = 48($sp) # Reserving space for local variables - addi $sp, $sp, -24 + addi $sp, $sp, -48 # Get attribute xcar of self - lw $t0, 24($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'xcar' from the instance + lw $t0, 48($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8775953293325 + beq $t6, $t5, int_get_attribute_8776576578419 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8775953293325 - j object_get_attribute_8775953293325 - int_get_attribute_8775953293325: + beq $t6, $t5, bool_get_attribute_8776576578419 + j object_get_attribute_8776576578419 + int_get_attribute_8776576578419: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2784,9 +3356,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 20($sp) # internal_0 = self.xcar - j end_get_attribute_8775953293325 - bool_get_attribute_8775953293325: + sw $v0, 44($sp) # internal_0 = self.xcar + j end_get_attribute_8776576578419 + bool_get_attribute_8776576578419: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2794,28 +3366,52 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 20($sp) # internal_0 = self.xcar - j end_get_attribute_8775953293325 - object_get_attribute_8775953293325: - sw $t1, 20($sp) # internal_0 = xcar - end_get_attribute_8775953293325: + sw $v0, 44($sp) # internal_0 = self.xcar + j end_get_attribute_8776576578419 + object_get_attribute_8776576578419: + sw $t1, 44($sp) # internal_0 = self.xcar + end_get_attribute_8776576578419: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_2 = address of allocated object Int + + # Get method out_int of Cons + lw $t0, 48($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 36($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 32($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 36($sp) + lw $t0, 60($sp) sw $t0, 4($sp) # Storing self # Argument internal_0 - lw $t0, 32($sp) + lw $t0, 56($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_out_int_at_IO - jal function_out_int_at_IO + # Calling function internal_3 + lw $t0, 44($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 28($sp) # internal_1 = result of function_out_int_at_IO + sw $v1, 52($sp) # internal_1 = result of internal_3 addi $sp, $sp, 12 # Freeing space for arguments # Allocating String @@ -2830,43 +3426,67 @@ sw $t0, 4($v0) # Setting length of the string in the second word of the object addi $t0, $zero, 10 - sb $t0, 8($v0) # internal_2[0] = '\n' + sb $t0, 8($v0) # internal_4[0] = '\n' sb $zero, 9($v0) # Null-terminator at the end of the string - sw $v0, 12($sp) # internal_2 = "\n" + sw $v0, 28($sp) # internal_4 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_6 = address of allocated object Int + + # Get method out_string of Cons + lw $t0, 48($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 36($sp) + lw $t0, 60($sp) sw $t0, 4($sp) # Storing self - # Argument internal_2 - lw $t0, 24($sp) - sw $t0, 0($sp) # Storing internal_2 + # Argument internal_4 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_4 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_7 + lw $t0, 28($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 20($sp) # internal_3 = result of function_out_string_at_IO + sw $v1, 36($sp) # internal_5 = result of internal_7 addi $sp, $sp, 12 # Freeing space for arguments # Get attribute xcdr of self - lw $t0, 24($sp) # Get the address of self - lw $t1, 12($t0) # Get the attribute 'xcdr' from the instance + lw $t0, 48($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'xcdr' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8775953293394 + beq $t6, $t5, int_get_attribute_8776576578536 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8775953293394 - j object_get_attribute_8775953293394 - int_get_attribute_8775953293394: + beq $t6, $t5, bool_get_attribute_8776576578536 + j object_get_attribute_8776576578536 + int_get_attribute_8776576578536: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2874,9 +3494,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_4 = self.xcdr - j end_get_attribute_8775953293394 - bool_get_attribute_8775953293394: + sw $v0, 12($sp) # internal_8 = self.xcdr + j end_get_attribute_8776576578536 + bool_get_attribute_8776576578536: li $v0, 9 addi $a0, $zero, 12 syscall @@ -2884,31 +3504,55 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 4($sp) # internal_4 = self.xcdr - j end_get_attribute_8775953293394 - object_get_attribute_8775953293394: - sw $t1, 4($sp) # internal_4 = xcdr - end_get_attribute_8775953293394: + sw $v0, 12($sp) # internal_8 = self.xcdr + j end_get_attribute_8776576578536 + object_get_attribute_8776576578536: + sw $t1, 12($sp) # internal_8 = self.xcdr + end_get_attribute_8776576578536: + + # Allocating Int 16 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 16 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_10 = address of allocated object Int + + # Get method print_list of List + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_4 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_4 + # Argument internal_8 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_8 - # Calling function function_print_list_at_List - jal function_print_list_at_List + # Calling function internal_11 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_5 = result of function_print_list_at_List + sw $v1, 16($sp) # internal_9 = result of internal_11 addi $sp, $sp, 8 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 24 + addi $sp, $sp, 48 jr $ra @@ -2972,47 +3616,71 @@ function_insert_at_Nil: # Function parameters - # $ra = 12($sp) - # self = 8($sp) - # i = 4($sp) + # $ra = 20($sp) + # self = 16($sp) + # i = 12($sp) # Reserving space for local variables - addi $sp, $sp, -4 + addi $sp, $sp, -12 + + # Allocating Int 15 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 15 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + # Get method rcons of Nil + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 4($sp) # Storing self # Argument i - lw $t0, 16($sp) + lw $t0, 24($sp) sw $t0, 0($sp) # Storing i - # Calling function function_rcons_at_Nil - jal function_rcons_at_Nil + # Calling function internal_2 + lw $t0, 12($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 12($sp) # internal_0 = result of function_rcons_at_Nil + sw $v1, 20($sp) # internal_0 = result of internal_2 addi $sp, $sp, 12 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 4 + addi $sp, $sp, 12 jr $ra function_rcons_at_Nil: # Function parameters - # $ra = 16($sp) - # self = 12($sp) - # i = 8($sp) + # $ra = 24($sp) + # self = 20($sp) + # i = 16($sp) # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Allocating Cons li $v0, 9 @@ -3021,49 +3689,73 @@ la $t0, type_Cons # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object Cons + sw $v0, 12($sp) # internal_0 = address of allocated object Cons # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_Cons jal function___init___at_Cons lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_Cons + sw $v1, 20($sp) # internal_0 = result of function___init___at_Cons addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 17 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 17 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method init of Cons + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address # Argument internal_0 - lw $t0, 20($sp) + lw $t0, 28($sp) sw $t0, 8($sp) # Storing internal_0 # Argument i - lw $t0, 24($sp) + lw $t0, 32($sp) sw $t0, 4($sp) # Storing i # Argument self - lw $t0, 28($sp) + lw $t0, 36($sp) sw $t0, 0($sp) # Storing self - # Calling function function_init_at_Cons - jal function_init_at_Cons + # Calling function internal_3 + lw $t0, 16($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 16($sp) # internal_1 = result of function_init_at_Cons + sw $v1, 24($sp) # internal_1 = result of internal_3 addi $sp, $sp, 16 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 8 + addi $sp, $sp, 16 jr $ra @@ -3109,17 +3801,17 @@ # Set attribute l of self lw $t0, 4($sp) # $t0 = self lw $t1, 0($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8775953294198 + beq $t1, $zero, object_set_attribute_8776576580184 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8775953294198 + beq $t6, $t5, int_set_attribute_8776576580184 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8775953294198 - j object_set_attribute_8775953294198 - int_set_attribute_8775953294198: + beq $t6, $t5, bool_set_attribute_8776576580184 + j object_set_attribute_8776576580184 + int_set_attribute_8776576580184: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3128,8 +3820,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.l = internal_0 - j end_set_attribute_8775953294198 - bool_set_attribute_8775953294198: + j end_set_attribute_8776576580184 + bool_set_attribute_8776576580184: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3138,10 +3830,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.l = internal_0 - j end_set_attribute_8775953294198 - object_set_attribute_8775953294198: + j end_set_attribute_8776576580184 + object_set_attribute_8776576580184: sw $t1, 8($t0) # self.l = internal_0 - end_set_attribute_8775953294198: + end_set_attribute_8776576580184: # Loading return value in $v1 lw $v1, 4($sp) @@ -3153,12 +3845,12 @@ function_iota_at_Main: # Function parameters - # $ra = 48($sp) - # self = 44($sp) - # i = 40($sp) + # $ra = 60($sp) + # self = 56($sp) + # i = 52($sp) # Reserving space for local variables - addi $sp, $sp, -40 + addi $sp, $sp, -52 # Allocating Nil li $v0, 9 @@ -3167,36 +3859,36 @@ la $t0, type_Nil # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 36($sp) # internal_0 = address of allocated object Nil + sw $v0, 48($sp) # internal_0 = address of allocated object Nil # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 44($sp) + lw $t0, 56($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_Nil jal function___init___at_Nil lw $ra, 4($sp) - sw $v1, 44($sp) # internal_0 = result of function___init___at_Nil + sw $v1, 56($sp) # internal_0 = result of function___init___at_Nil addi $sp, $sp, 8 # Freeing space for arguments # Set attribute l of self - lw $t0, 44($sp) # $t0 = self - lw $t1, 36($sp) # $t1 = internal_0 - beq $t1, $zero, object_set_attribute_8775953294243 + lw $t0, 56($sp) # $t0 = self + lw $t1, 48($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8776576580229 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8775953294243 + beq $t6, $t5, int_set_attribute_8776576580229 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8775953294243 - j object_set_attribute_8775953294243 - int_set_attribute_8775953294243: + beq $t6, $t5, bool_set_attribute_8776576580229 + j object_set_attribute_8776576580229 + int_set_attribute_8776576580229: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3205,8 +3897,8 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.l = internal_0 - j end_set_attribute_8775953294243 - bool_set_attribute_8775953294243: + j end_set_attribute_8776576580229 + bool_set_attribute_8776576580229: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3215,10 +3907,10 @@ lw $t5, 8($t1) sw $t5, 8($v0) sw $v0, 8($t0) # self.l = internal_0 - j end_set_attribute_8775953294243 - object_set_attribute_8775953294243: + j end_set_attribute_8776576580229 + object_set_attribute_8776576580229: sw $t1, 8($t0) # self.l = internal_0 - end_set_attribute_8775953294243: + end_set_attribute_8776576580229: # Allocating Int 0 li $v0, 9 @@ -3230,56 +3922,59 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 0 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 28($sp) # internal_2 = address of allocated object Int + sw $v0, 40($sp) # internal_2 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument j - lw $t0, 44($sp) + lw $t0, 56($sp) sw $t0, 4($sp) # Storing j # Argument internal_2 - lw $t0, 40($sp) + lw $t0, 52($sp) sw $t0, 0($sp) # Storing internal_2 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 44($sp) # j = result of function_assign + sw $v1, 56($sp) # j = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - while_start_8775953337896: + # Allocating NUll to internal_3 + sw $zero, 36($sp) # internal_3 = 0 + + while_start_8776576620948: # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument j - lw $t0, 44($sp) + lw $t0, 56($sp) sw $t0, 4($sp) # Storing j # Argument i - lw $t0, 52($sp) + lw $t0, 64($sp) sw $t0, 0($sp) # Storing i # Calling function function_less_than jal function_less_than lw $ra, 8($sp) - sw $v1, 36($sp) # internal_3 = result of function_less_than + sw $v1, 44($sp) # internal_4 = result of function_less_than addi $sp, $sp, 12 # Freeing space for arguments - # If internal_3 then goto while_body_8775953337896 - lw $t0, 24($sp) # Loading the address of the condition + # If internal_4 then goto while_body_8776576620948 + lw $t0, 32($sp) # Loading the address of the condition lw $t0, 8($t0) # Loading the value of the condition addi $t1, $zero, 1 # Setting the value to 1 for comparison - beq $t0, $t1, while_body_8775953337896 + beq $t0, $t1, while_body_8776576620948 - # Jumping to while_end_8775953337896 - j while_end_8775953337896 + # Jumping to while_end_8776576620948 + j while_end_8776576620948 - while_body_8775953337896: + while_body_8776576620948: # Allocating Cons li $v0, 9 @@ -3288,35 +3983,35 @@ la $t0, type_Cons # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 20($sp) # internal_4 = address of allocated object Cons + sw $v0, 28($sp) # internal_5 = address of allocated object Cons # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_4 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_4 + # Argument internal_5 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_5 # Calling function function___init___at_Cons jal function___init___at_Cons lw $ra, 4($sp) - sw $v1, 28($sp) # internal_4 = result of function___init___at_Cons + sw $v1, 36($sp) # internal_5 = result of function___init___at_Cons addi $sp, $sp, 8 # Freeing space for arguments # Get attribute l of self - lw $t0, 44($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'l' from the instance + lw $t0, 56($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'l' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8775953325198 + beq $t6, $t5, int_get_attribute_8776576580988 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8775953325198 - j object_get_attribute_8775953325198 - int_get_attribute_8775953325198: + beq $t6, $t5, bool_get_attribute_8776576580988 + j object_get_attribute_8776576580988 + int_get_attribute_8776576580988: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3324,9 +4019,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 16($sp) # internal_5 = self.l - j end_get_attribute_8775953325198 - bool_get_attribute_8775953325198: + sw $v0, 24($sp) # internal_6 = self.l + j end_get_attribute_8776576580988 + bool_get_attribute_8776576580988: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3334,48 +4029,72 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 16($sp) # internal_5 = self.l - j end_get_attribute_8775953325198 - object_get_attribute_8775953325198: - sw $t1, 16($sp) # internal_5 = l - end_get_attribute_8775953325198: + sw $v0, 24($sp) # internal_6 = self.l + j end_get_attribute_8776576580988 + object_get_attribute_8776576580988: + sw $t1, 24($sp) # internal_6 = self.l + end_get_attribute_8776576580988: + + # Allocating Int 17 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 17 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_8 = address of allocated object Int + + # Get method init of Cons + lw $t0, 28($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) # Passing function arguments addi $sp, $sp, -16 # Reserving space for arguments sw $ra, 12($sp) # Storing return address - # Argument internal_4 - lw $t0, 36($sp) - sw $t0, 8($sp) # Storing internal_4 + # Argument internal_5 + lw $t0, 44($sp) + sw $t0, 8($sp) # Storing internal_5 # Argument j - lw $t0, 48($sp) + lw $t0, 60($sp) sw $t0, 4($sp) # Storing j - # Argument internal_5 - lw $t0, 32($sp) - sw $t0, 0($sp) # Storing internal_5 + # Argument internal_6 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_6 - # Calling function function_init_at_Cons - jal function_init_at_Cons + # Calling function internal_9 + lw $t0, 28($sp) + jalr $t0 lw $ra, 12($sp) - sw $v1, 28($sp) # internal_6 = result of function_init_at_Cons + sw $v1, 36($sp) # internal_7 = result of internal_9 addi $sp, $sp, 16 # Freeing space for arguments # Set attribute l of self - lw $t0, 44($sp) # $t0 = self - lw $t1, 12($sp) # $t1 = internal_6 - beq $t1, $zero, object_set_attribute_8775953325147 + lw $t0, 56($sp) # $t0 = self + lw $t1, 20($sp) # $t1 = internal_7 + beq $t1, $zero, object_set_attribute_8776576580937 lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_set_attribute_8775953325147 + beq $t6, $t5, int_set_attribute_8776576580937 seq $t6, $t2, $t4 - beq $t6, $t5, bool_set_attribute_8775953325147 - j object_set_attribute_8775953325147 - int_set_attribute_8775953325147: + beq $t6, $t5, bool_set_attribute_8776576580937 + j object_set_attribute_8776576580937 + int_set_attribute_8776576580937: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3383,9 +4102,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($t0) # self.l = internal_6 - j end_set_attribute_8775953325147 - bool_set_attribute_8775953325147: + sw $v0, 8($t0) # self.l = internal_7 + j end_set_attribute_8776576580937 + bool_set_attribute_8776576580937: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3393,11 +4112,11 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 8($t0) # self.l = internal_6 - j end_set_attribute_8775953325147 - object_set_attribute_8775953325147: - sw $t1, 8($t0) # self.l = internal_6 - end_set_attribute_8775953325147: + sw $v0, 8($t0) # self.l = internal_7 + j end_set_attribute_8776576580937 + object_set_attribute_8776576580937: + sw $t1, 8($t0) # self.l = internal_7 + end_set_attribute_8776576580937: # Allocating Int 1 li $v0, 9 @@ -3409,24 +4128,24 @@ sw $a0, 4($v0) # Setting size in the second word of the object addi $t0, $zero, 1 sw $t0, 8($v0) # Setting value in the third word of the object - sw $v0, 8($sp) # internal_7 = address of allocated object Int + sw $v0, 8($sp) # internal_10 = address of allocated object Int # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument j - lw $t0, 44($sp) + lw $t0, 56($sp) sw $t0, 4($sp) # Storing j - # Argument internal_7 + # Argument internal_10 lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_7 + sw $t0, 0($sp) # Storing internal_10 # Calling function function_add jal function_add lw $ra, 8($sp) - sw $v1, 16($sp) # internal_8 = result of function_add + sw $v1, 16($sp) # internal_11 = result of function_add addi $sp, $sp, 12 # Freeing space for arguments # Passing function arguments @@ -3434,37 +4153,37 @@ sw $ra, 8($sp) # Storing return address # Argument j - lw $t0, 44($sp) + lw $t0, 56($sp) sw $t0, 4($sp) # Storing j - # Argument internal_8 + # Argument internal_11 lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_8 + sw $t0, 0($sp) # Storing internal_11 # Calling function function_assign jal function_assign lw $ra, 8($sp) - sw $v1, 44($sp) # j = result of function_assign + sw $v1, 56($sp) # j = result of function_assign addi $sp, $sp, 12 # Freeing space for arguments - # Jumping to while_start_8775953337896 - j while_start_8775953337896 + # Jumping to while_start_8776576620948 + j while_start_8776576620948 - while_end_8775953337896: + while_end_8776576620948: # Get attribute l of self - lw $t0, 44($sp) # Get the address of self - lw $t1, 8($t0) # Get the attribute 'l' from the instance + lw $t0, 56($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'l' from the self lw $t2, 0($t1) la $t3, type_Int la $t4, type_Bool addi $t5, $zero, 1 seq $t6, $t2, $t3 - beq $t6, $t5, int_get_attribute_8775953294318 + beq $t6, $t5, int_get_attribute_8776576580304 seq $t6, $t2, $t4 - beq $t6, $t5, bool_get_attribute_8775953294318 - j object_get_attribute_8775953294318 - int_get_attribute_8775953294318: + beq $t6, $t5, bool_get_attribute_8776576580304 + j object_get_attribute_8776576580304 + int_get_attribute_8776576580304: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3472,9 +4191,9 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 0($sp) # internal_9 = self.l - j end_get_attribute_8775953294318 - bool_get_attribute_8775953294318: + sw $v0, 0($sp) # internal_12 = self.l + j end_get_attribute_8776576580304 + bool_get_attribute_8776576580304: li $v0, 9 addi $a0, $zero, 12 syscall @@ -3482,27 +4201,27 @@ sw $a0, 4($v0) lw $t5, 8($t1) sw $t5, 8($v0) - sw $v0, 0($sp) # internal_9 = self.l - j end_get_attribute_8775953294318 - object_get_attribute_8775953294318: - sw $t1, 0($sp) # internal_9 = l - end_get_attribute_8775953294318: + sw $v0, 0($sp) # internal_12 = self.l + j end_get_attribute_8776576580304 + object_get_attribute_8776576580304: + sw $t1, 0($sp) # internal_12 = self.l + end_get_attribute_8776576580304: # Loading return value in $v1 lw $v1, 0($sp) # Freeing space for local variables - addi $sp, $sp, 40 + addi $sp, $sp, 52 jr $ra function_main_at_Main: # Function parameters - # $ra = 32($sp) - # self = 28($sp) + # $ra = 80($sp) + # self = 76($sp) # Reserving space for local variables - addi $sp, $sp, -28 + addi $sp, $sp, -76 # Allocating String li $v0, 9 @@ -3595,111 +4314,255 @@ sb $zero, 34($v0) # Null-terminator at the end of the string - sw $v0, 24($sp) # internal_0 = "How many numbers to sort? " + sw $v0, 72($sp) # internal_0 = "How many numbers to sort? " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_2 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 76($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 64($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 60($sp) # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 40($sp) + lw $t0, 88($sp) sw $t0, 4($sp) # Storing self # Argument internal_0 - lw $t0, 36($sp) + lw $t0, 84($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_out_string_at_IO - jal function_out_string_at_IO + # Calling function internal_3 + lw $t0, 72($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 32($sp) # internal_1 = result of function_out_string_at_IO + sw $v1, 80($sp) # internal_1 = result of internal_3 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_5 = address of allocated object Int + + # Get method in_int of Main + lw $t0, 76($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 52($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 48($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument self - lw $t0, 36($sp) + lw $t0, 84($sp) sw $t0, 0($sp) # Storing self - # Calling function function_in_int_at_IO - jal function_in_int_at_IO + # Calling function internal_6 + lw $t0, 56($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 24($sp) # internal_2 = result of function_in_int_at_IO + sw $v1, 64($sp) # internal_4 = result of internal_6 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_8 = address of allocated object Int + + # Get method iota of Main + lw $t0, 76($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 40($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 36($sp) + # Passing function arguments addi $sp, $sp, -12 # Reserving space for arguments sw $ra, 8($sp) # Storing return address # Argument self - lw $t0, 40($sp) + lw $t0, 88($sp) sw $t0, 4($sp) # Storing self - # Argument internal_2 - lw $t0, 28($sp) - sw $t0, 0($sp) # Storing internal_2 + # Argument internal_4 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_4 - # Calling function function_iota_at_Main - jal function_iota_at_Main + # Calling function internal_9 + lw $t0, 48($sp) + jalr $t0 lw $ra, 8($sp) - sw $v1, 24($sp) # internal_3 = result of function_iota_at_Main + sw $v1, 56($sp) # internal_7 = result of internal_9 addi $sp, $sp, 12 # Freeing space for arguments + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_11 = address of allocated object Int + + # Get method rev of List + lw $t0, 44($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 28($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 24($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_3 - lw $t0, 20($sp) - sw $t0, 0($sp) # Storing internal_3 + # Argument internal_7 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_7 - # Calling function function_rev_at_List - jal function_rev_at_List + # Calling function internal_12 + lw $t0, 32($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 16($sp) # internal_4 = result of function_rev_at_List + sw $v1, 40($sp) # internal_10 = result of internal_12 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_14 = address of allocated object Int + + # Get method sort of List + lw $t0, 32($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_4 - lw $t0, 16($sp) - sw $t0, 0($sp) # Storing internal_4 + # Argument internal_10 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_10 - # Calling function function_sort_at_List - jal function_sort_at_List + # Calling function internal_15 + lw $t0, 20($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 12($sp) # internal_5 = result of function_sort_at_List + sw $v1, 28($sp) # internal_13 = result of internal_15 addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 16 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 16 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_17 = address of allocated object Int + + # Get method print_list of List + lw $t0, 20($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address - # Argument internal_5 - lw $t0, 12($sp) - sw $t0, 0($sp) # Storing internal_5 + # Argument internal_13 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_13 - # Calling function function_print_list_at_List - jal function_print_list_at_List + # Calling function internal_18 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_6 = result of function_print_list_at_List + sw $v1, 16($sp) # internal_16 = result of internal_18 addi $sp, $sp, 8 # Freeing space for arguments # Loading return value in $v1 - lw $v1, 0($sp) + lw $v1, 8($sp) # Freeing space for local variables - addi $sp, $sp, 28 + addi $sp, $sp, 76 jr $ra main: # Reserving space for local variables - addi $sp, $sp, -8 + addi $sp, $sp, -16 # Allocating Main li $v0, 9 @@ -3708,34 +4571,58 @@ la $t0, type_Main # $t0 = address of the type sw $t0, 0($v0) # Setting type in the first word of th object sw $a0, 4($v0) # Setting size in the second word of th object - sw $v0, 4($sp) # internal_0 = address of allocated object Main + sw $v0, 12($sp) # internal_0 = address of allocated object Main # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 # Calling function function___init___at_Main jal function___init___at_Main lw $ra, 4($sp) - sw $v1, 12($sp) # internal_0 = result of function___init___at_Main + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main addi $sp, $sp, 8 # Freeing space for arguments + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + # Passing function arguments addi $sp, $sp, -8 # Reserving space for arguments sw $ra, 4($sp) # Storing return address # Argument internal_0 - lw $t0, 12($sp) + lw $t0, 20($sp) sw $t0, 0($sp) # Storing internal_0 - # Calling function function_main_at_Main - jal function_main_at_Main + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 lw $ra, 4($sp) - sw $v1, 8($sp) # internal_1 = result of function_main_at_Main + sw $v1, 16($sp) # internal_1 = result of internal_3 addi $sp, $sp, 8 # Freeing space for arguments # Exit program